aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acbuffer.h14
-rw-r--r--include/acpi/acpi_bus.h35
-rw-r--r--include/acpi/acpixf.h2
-rw-r--r--include/acpi/actypes.h4
-rw-r--r--include/acpi/processor.h7
-rw-r--r--include/asm-generic/barrier.h8
-rw-r--r--include/asm-generic/futex.h114
-rw-r--r--include/asm-generic/hash.h9
-rw-r--r--include/asm-generic/io.h751
-rw-r--r--include/asm-generic/mm_hooks.h17
-rw-r--r--include/asm-generic/msi.h32
-rw-r--r--include/asm-generic/pgtable.h11
-rw-r--r--include/asm-generic/preempt.h3
-rw-r--r--include/asm-generic/seccomp.h30
-rw-r--r--include/asm-generic/tlb.h57
-rw-r--r--include/crypto/hash.h492
-rw-r--r--include/crypto/if_alg.h1
-rw-r--r--include/crypto/rng.h80
-rw-r--r--include/drm/drmP.h27
-rw-r--r--include/drm/drm_atomic.h69
-rw-r--r--include/drm/drm_atomic_helper.h126
-rw-r--r--include/drm/drm_crtc.h327
-rw-r--r--include/drm/drm_crtc_helper.h13
-rw-r--r--include/drm/drm_displayid.h76
-rw-r--r--include/drm/drm_dp_helper.h26
-rw-r--r--include/drm/drm_dp_mst_helper.h8
-rw-r--r--include/drm/drm_edid.h109
-rw-r--r--include/drm/drm_fb_helper.h6
-rw-r--r--include/drm/drm_flip_work.h33
-rw-r--r--include/drm/drm_gem.h7
-rw-r--r--include/drm/drm_gem_cma_helper.h30
-rw-r--r--include/drm/drm_mipi_dsi.h94
-rw-r--r--include/drm/drm_modeset_lock.h5
-rw-r--r--include/drm/drm_plane_helper.h44
-rw-r--r--include/drm/i915_pciids.h17
-rw-r--r--include/drm/ttm/ttm_execbuf_util.h9
-rw-r--r--include/dt-bindings/arm/ux500_pm_domains.h15
-rw-r--r--include/dt-bindings/clock/imx5-clock.h5
-rw-r--r--include/dt-bindings/clock/qcom,mmcc-apq8084.h2
-rw-r--r--include/dt-bindings/clock/r8a7740-clock.h1
-rw-r--r--include/dt-bindings/clock/r8a7790-clock.h14
-rw-r--r--include/dt-bindings/clock/r8a7791-clock.h11
-rw-r--r--include/dt-bindings/clock/r8a7794-clock.h9
-rw-r--r--include/dt-bindings/clock/stih407-clks.h86
-rw-r--r--include/dt-bindings/clock/stih410-clks.h25
-rw-r--r--include/dt-bindings/clock/tegra114-car.h2
-rw-r--r--include/dt-bindings/clock/tegra124-car.h2
-rw-r--r--include/dt-bindings/clock/tegra20-car.h2
-rw-r--r--include/dt-bindings/dma/at91.h25
-rw-r--r--include/dt-bindings/interrupt-controller/mips-gic.h9
-rw-r--r--include/dt-bindings/memory/tegra114-mc.h25
-rw-r--r--include/dt-bindings/memory/tegra124-mc.h31
-rw-r--r--include/dt-bindings/memory/tegra30-mc.h24
-rw-r--r--include/dt-bindings/phy/phy.h19
-rw-r--r--include/dt-bindings/pinctrl/qcom,pmic-gpio.h142
-rw-r--r--include/dt-bindings/pinctrl/qcom,pmic-mpp.h44
-rw-r--r--include/dt-bindings/regulator/maxim,max77802.h18
-rw-r--r--include/dt-bindings/reset-controller/stih407-resets.h61
-rw-r--r--include/linux/acpi.h167
-rw-r--r--include/linux/amba/bus.h11
-rw-r--r--include/linux/ath9k_platform.h3
-rw-r--r--include/linux/atmel-mci.h2
-rw-r--r--include/linux/audit.h9
-rw-r--r--include/linux/bcma/bcma.h2
-rw-r--r--include/linux/bcma/bcma_driver_mips.h4
-rw-r--r--include/linux/binfmts.h4
-rw-r--r--include/linux/bio.h5
-rw-r--r--include/linux/bitmap.h39
-rw-r--r--include/linux/blk-mq.h27
-rw-r--r--include/linux/blkdev.h6
-rw-r--r--include/linux/bpf.h11
-rw-r--r--include/linux/cacheinfo.h100
-rw-r--r--include/linux/can/dev.h3
-rw-r--r--include/linux/cgroup.h34
-rw-r--r--include/linux/clk-provider.h1
-rw-r--r--include/linux/clk/ti.h15
-rw-r--r--include/linux/compaction.h10
-rw-r--r--include/linux/compat.h3
-rw-r--r--include/linux/coresight.h263
-rw-r--r--include/linux/cpu.h4
-rw-r--r--include/linux/cpufreq.h54
-rw-r--r--include/linux/cpuidle.h4
-rw-r--r--include/linux/cpumask.h17
-rw-r--r--include/linux/cpuset.h37
-rw-r--r--include/linux/crypto.h1112
-rw-r--r--include/linux/dcache.h9
-rw-r--r--include/linux/debugfs.h24
-rw-r--r--include/linux/device-mapper.h2
-rw-r--r--include/linux/device.h40
-rw-r--r--include/linux/dmaengine.h3
-rw-r--r--include/linux/dmar.h50
-rw-r--r--include/linux/drbd.h2
-rw-r--r--include/linux/edac.h4
-rw-r--r--include/linux/eeprom_93cx6.h4
-rw-r--r--include/linux/efi.h6
-rw-r--r--include/linux/elf.h5
-rw-r--r--include/linux/etherdevice.h12
-rw-r--r--include/linux/ethtool.h42
-rw-r--r--include/linux/f2fs_fs.h27
-rw-r--r--include/linux/fault-inject.h17
-rw-r--r--include/linux/fence.h4
-rw-r--r--include/linux/file.h1
-rw-r--r--include/linux/filter.h1
-rw-r--r--include/linux/freezer.h50
-rw-r--r--include/linux/fs.h46
-rw-r--r--include/linux/fsnotify_backend.h31
-rw-r--r--include/linux/ftrace.h43
-rw-r--r--include/linux/ftrace_event.h11
-rw-r--r--include/linux/gfp.h11
-rw-r--r--include/linux/gpio.h7
-rw-r--r--include/linux/gpio/consumer.h47
-rw-r--r--include/linux/gpio/driver.h8
-rw-r--r--include/linux/gpio_keys.h3
-rw-r--r--include/linux/hash.h35
-rw-r--r--include/linux/hdmi.h21
-rw-r--r--include/linux/hid.h43
-rw-r--r--include/linux/hugetlb.h49
-rw-r--r--include/linux/hugetlb_cgroup.h1
-rw-r--r--include/linux/hyperv.h2
-rw-r--r--include/linux/i2c.h31
-rw-r--r--include/linux/i2c/pmbus.h4
-rw-r--r--include/linux/i2c/twl.h2
-rw-r--r--include/linux/ieee80211.h71
-rw-r--r--include/linux/ieee802154.h (renamed from include/net/ieee802154.h)61
-rw-r--r--include/linux/if_bridge.h31
-rw-r--r--include/linux/if_vlan.h107
-rw-r--r--include/linux/iio/common/st_sensors.h10
-rw-r--r--include/linux/iio/events.h2
-rw-r--r--include/linux/iio/iio.h8
-rw-r--r--include/linux/init_task.h12
-rw-r--r--include/linux/integrity.h6
-rw-r--r--include/linux/interrupt.h6
-rw-r--r--include/linux/io.h4
-rw-r--r--include/linux/iommu.h25
-rw-r--r--include/linux/ipc_namespace.h20
-rw-r--r--include/linux/ipmi.h6
-rw-r--r--include/linux/ipmi_smi.h10
-rw-r--r--include/linux/ipv6.h11
-rw-r--r--include/linux/irq.h65
-rw-r--r--include/linux/irqchip/arm-gic-v3.h128
-rw-r--r--include/linux/irqchip/arm-gic.h4
-rw-r--r--include/linux/irqchip/mips-gic.h249
-rw-r--r--include/linux/irqdomain.h101
-rw-r--r--include/linux/irqhandler.h14
-rw-r--r--include/linux/kern_levels.h13
-rw-r--r--include/linux/kernel.h9
-rw-r--r--include/linux/kernfs.h8
-rw-r--r--include/linux/kmemleak.h2
-rw-r--r--include/linux/kprobes.h1
-rw-r--r--include/linux/kvm_host.h2
-rw-r--r--include/linux/leds.h43
-rw-r--r--include/linux/libata.h10
-rw-r--r--include/linux/list.h34
-rw-r--r--include/linux/lockd/debug.h6
-rw-r--r--include/linux/mailbox_client.h3
-rw-r--r--include/linux/marvell_phy.h1
-rw-r--r--include/linux/mbus.h1
-rw-r--r--include/linux/memcontrol.h66
-rw-r--r--include/linux/mfd/abx500/ab8500-sysctrl.h1
-rw-r--r--include/linux/mfd/arizona/core.h1
-rw-r--r--include/linux/mfd/arizona/registers.h50
-rw-r--r--include/linux/mfd/atmel-hlcdc.h85
-rw-r--r--include/linux/mfd/axp20x.h59
-rw-r--r--include/linux/mfd/core.h7
-rw-r--r--include/linux/mfd/davinci_voicecodec.h7
-rw-r--r--include/linux/mfd/dln2.h103
-rw-r--r--include/linux/mfd/max77686.h7
-rw-r--r--include/linux/mfd/max77693-private.h1
-rw-r--r--include/linux/mfd/rtsx_pci.h37
-rw-r--r--include/linux/mfd/samsung/core.h2
-rw-r--r--include/linux/mfd/samsung/s2mps13.h186
-rw-r--r--include/linux/mfd/syscon/imx6q-iomuxc-gpr.h39
-rw-r--r--include/linux/mfd/tc3589x.h8
-rw-r--r--include/linux/micrel_phy.h1
-rw-r--r--include/linux/mlx4/cmd.h31
-rw-r--r--include/linux/mlx4/device.h127
-rw-r--r--include/linux/mlx4/qp.h4
-rw-r--r--include/linux/mlx5/device.h8
-rw-r--r--include/linux/mlx5/driver.h8
-rw-r--r--include/linux/mm.h59
-rw-r--r--include/linux/mm_types.h21
-rw-r--r--include/linux/mmc/card.h23
-rw-r--r--include/linux/mmc/core.h3
-rw-r--r--include/linux/mmc/dw_mmc.h7
-rw-r--r--include/linux/mmc/host.h1
-rw-r--r--include/linux/mmc/mmc.h3
-rw-r--r--include/linux/mmc/sdhci.h18
-rw-r--r--include/linux/mmc/sdio_func.h2
-rw-r--r--include/linux/mmu_notifier.h90
-rw-r--r--include/linux/mmzone.h14
-rw-r--r--include/linux/mod_devicetable.h2
-rw-r--r--include/linux/msi.h187
-rw-r--r--include/linux/netdev_features.h9
-rw-r--r--include/linux/netdevice.h134
-rw-r--r--include/linux/nfs4.h2
-rw-r--r--include/linux/nfs_fs.h4
-rw-r--r--include/linux/nfs_fs_sb.h2
-rw-r--r--include/linux/nfs_xdr.h14
-rw-r--r--include/linux/nl802154.h4
-rw-r--r--include/linux/nvme.h18
-rw-r--r--include/linux/of.h169
-rw-r--r--include/linux/of_address.h4
-rw-r--r--include/linux/of_pci.h12
-rw-r--r--include/linux/of_pdt.h3
-rw-r--r--include/linux/of_platform.h6
-rw-r--r--include/linux/omap-gpmc.h199
-rw-r--r--include/linux/omap-mailbox.h16
-rw-r--r--include/linux/oom.h11
-rw-r--r--include/linux/page-debug-flags.h32
-rw-r--r--include/linux/page_cgroup.h105
-rw-r--r--include/linux/page_counter.h51
-rw-r--r--include/linux/page_ext.h84
-rw-r--r--include/linux/page_owner.h38
-rw-r--r--include/linux/pci.h5
-rw-r--r--include/linux/pci_hotplug.h1
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/percpu-defs.h2
-rw-r--r--include/linux/percpu-refcount.h51
-rw-r--r--include/linux/percpu.h4
-rw-r--r--include/linux/perf_event.h37
-rw-r--r--include/linux/phy.h26
-rw-r--r--include/linux/phy/phy.h52
-rw-r--r--include/linux/platform_data/asoc-s3c.h1
-rw-r--r--include/linux/platform_data/bcmgenet.h18
-rw-r--r--include/linux/platform_data/dma-imx.h1
-rw-r--r--include/linux/platform_data/dwc3-exynos.h24
-rw-r--r--include/linux/platform_data/hsmmc-omap.h90
-rw-r--r--include/linux/platform_data/lp855x.h2
-rw-r--r--include/linux/platform_data/mmc-atmel-mci.h22
-rw-r--r--include/linux/platform_data/mmc-omap.h27
-rw-r--r--include/linux/platform_data/pxa_sdhci.h5
-rw-r--r--include/linux/platform_data/rcar-du.h74
-rw-r--r--include/linux/platform_data/serial-omap.h3
-rw-r--r--include/linux/platform_data/st21nfca.h1
-rw-r--r--include/linux/platform_data/st21nfcb.h1
-rw-r--r--include/linux/platform_device.h12
-rw-r--r--include/linux/plist.h10
-rw-r--r--include/linux/pm.h19
-rw-r--r--include/linux/pm_clock.h8
-rw-r--r--include/linux/pm_domain.h17
-rw-r--r--include/linux/pm_opp.h12
-rw-r--r--include/linux/pm_qos.h38
-rw-r--r--include/linux/pm_runtime.h27
-rw-r--r--include/linux/printk.h3
-rw-r--r--include/linux/property.h143
-rw-r--r--include/linux/pstore_ram.h4
-rw-r--r--include/linux/ptrace.h2
-rw-r--r--include/linux/pxa168_eth.h3
-rw-r--r--include/linux/pxa2xx_ssp.h20
-rw-r--r--include/linux/quota.h5
-rw-r--r--include/linux/quotaops.h8
-rw-r--r--include/linux/ratelimit.h12
-rw-r--r--include/linux/rculist.h17
-rw-r--r--include/linux/rcupdate.h19
-rw-r--r--include/linux/rcutiny.h2
-rw-r--r--include/linux/rcutree.h6
-rw-r--r--include/linux/regmap.h7
-rw-r--r--include/linux/regulator/consumer.h6
-rw-r--r--include/linux/regulator/driver.h8
-rw-r--r--include/linux/regulator/of_regulator.h9
-rw-r--r--include/linux/res_counter.h223
-rw-r--r--include/linux/reset-controller.h2
-rw-r--r--include/linux/reset.h7
-rw-r--r--include/linux/rhashtable.h15
-rw-r--r--include/linux/rtc.h21
-rw-r--r--include/linux/rtnetlink.h14
-rw-r--r--include/linux/sched.h102
-rw-r--r--include/linux/seq_buf.h136
-rw-r--r--include/linux/seq_file.h15
-rw-r--r--include/linux/serial_8250.h3
-rw-r--r--include/linux/serial_bcm63xx.h2
-rw-r--r--include/linux/serial_core.h67
-rw-r--r--include/linux/shrinker.h2
-rw-r--r--include/linux/skbuff.h188
-rw-r--r--include/linux/slab.h6
-rw-r--r--include/linux/socket.h24
-rw-r--r--include/linux/spi/spi.h6
-rw-r--r--include/linux/spmi.h3
-rw-r--r--include/linux/stacktrace.h5
-rw-r--r--include/linux/sunrpc/auth.h2
-rw-r--r--include/linux/sunrpc/clnt.h4
-rw-r--r--include/linux/sunrpc/debug.h64
-rw-r--r--include/linux/sunrpc/metrics.h3
-rw-r--r--include/linux/sunrpc/sched.h8
-rw-r--r--include/linux/sunrpc/xprt.h3
-rw-r--r--include/linux/sunrpc/xprtsock.h59
-rw-r--r--include/linux/swap.h8
-rw-r--r--include/linux/swap_cgroup.h42
-rw-r--r--include/linux/syscalls.h11
-rw-r--r--include/linux/sysfs.h9
-rw-r--r--include/linux/syslog.h9
-rw-r--r--include/linux/tcp.h8
-rw-r--r--include/linux/time.h17
-rw-r--r--include/linux/timekeeper_internal.h2
-rw-r--r--include/linux/timekeeping.h51
-rw-r--r--include/linux/trace_seq.h77
-rw-r--r--include/linux/tty.h28
-rw-r--r--include/linux/uio.h7
-rw-r--r--include/linux/uio_driver.h2
-rw-r--r--include/linux/usb.h2
-rw-r--r--include/linux/usb/chipidea.h5
-rw-r--r--include/linux/usb/composite.h7
-rw-r--r--include/linux/usb/ehci-dbgp.h83
-rw-r--r--include/linux/usb/ehci_def.h65
-rw-r--r--include/linux/usb/gadget.h5
-rw-r--r--include/linux/usb/hcd.h10
-rw-r--r--include/linux/usb/otg.h7
-rw-r--r--include/linux/usb/phy.h6
-rw-r--r--include/linux/usb/renesas_usbhs.h4
-rw-r--r--include/linux/vexpress.h19
-rw-r--r--include/linux/virtio.h12
-rw-r--r--include/linux/virtio_byteorder.h59
-rw-r--r--include/linux/virtio_config.h103
-rw-r--r--include/linux/vm_event_item.h1
-rw-r--r--include/linux/vmw_vmci_api.h5
-rw-r--r--include/linux/wait.h80
-rw-r--r--include/media/davinci/vpbe.h2
-rw-r--r--include/media/davinci/vpbe_display.h21
-rw-r--r--include/media/davinci/vpbe_venc.h5
-rw-r--r--include/media/exynos-fimc.h2
-rw-r--r--include/media/lirc_dev.h8
-rw-r--r--include/media/radio-si4713.h30
-rw-r--r--include/media/si4713.h4
-rw-r--r--include/media/soc_camera.h2
-rw-r--r--include/media/soc_mediabus.h6
-rw-r--r--include/media/v4l2-common.h17
-rw-r--r--include/media/v4l2-ctrls.h25
-rw-r--r--include/media/v4l2-image-sizes.h9
-rw-r--r--include/media/v4l2-mediabus.h6
-rw-r--r--include/media/v4l2-subdev.h2
-rw-r--r--include/media/videobuf2-core.h42
-rw-r--r--include/media/videobuf2-dma-sg.h3
-rw-r--r--include/net/6lowpan.h12
-rw-r--r--include/net/af_ieee802154.h4
-rw-r--r--include/net/af_vsock.h6
-rw-r--r--include/net/bluetooth/hci.h68
-rw-r--r--include/net/bluetooth/hci_core.h78
-rw-r--r--include/net/bluetooth/l2cap.h50
-rw-r--r--include/net/bluetooth/mgmt.h24
-rw-r--r--include/net/bond_3ad.h283
-rw-r--r--include/net/bond_alb.h181
-rw-r--r--include/net/bond_options.h130
-rw-r--r--include/net/bonding.h654
-rw-r--r--include/net/cfg80211.h241
-rw-r--r--include/net/cfg802154.h161
-rw-r--r--include/net/checksum.h16
-rw-r--r--include/net/compat.h5
-rw-r--r--include/net/dsa.h33
-rw-r--r--include/net/fou.h19
-rw-r--r--include/net/gue.h103
-rw-r--r--include/net/ieee802154_netdev.h18
-rw-r--r--include/net/inet6_hashtables.h10
-rw-r--r--include/net/inet_common.h2
-rw-r--r--include/net/ip6_tunnel.h3
-rw-r--r--include/net/ip_fib.h4
-rw-r--r--include/net/ip_tunnels.h16
-rw-r--r--include/net/ipx.h5
-rw-r--r--include/net/irda/irda.h15
-rw-r--r--include/net/irda/irlap.h2
-rw-r--r--include/net/irda/parameters.h6
-rw-r--r--include/net/llc_c_st.h4
-rw-r--r--include/net/llc_s_st.h2
-rw-r--r--include/net/mac80211.h319
-rw-r--r--include/net/mac802154.h158
-rw-r--r--include/net/mpls.h39
-rw-r--r--include/net/neighbour.h14
-rw-r--r--include/net/netfilter/nf_conntrack.h15
-rw-r--r--include/net/netfilter/nf_conntrack_core.h2
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h4
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h6
-rw-r--r--include/net/netfilter/nf_nat_redirect.h12
-rw-r--r--include/net/netfilter/nf_tables_bridge.h7
-rw-r--r--include/net/netfilter/nft_redir.h21
-rw-r--r--include/net/netlink.h10
-rw-r--r--include/net/netns/xfrm.h4
-rw-r--r--include/net/nfc/digital.h13
-rw-r--r--include/net/nfc/hci.h4
-rw-r--r--include/net/nfc/nci.h37
-rw-r--r--include/net/nfc/nci_core.h9
-rw-r--r--include/net/nfc/nfc.h2
-rw-r--r--include/net/nl802154.h226
-rw-r--r--include/net/ping.h2
-rw-r--r--include/net/regulatory.h12
-rw-r--r--include/net/sch_generic.h1
-rw-r--r--include/net/sctp/sm.h2
-rw-r--r--include/net/sctp/structs.h7
-rw-r--r--include/net/sock.h73
-rw-r--r--include/net/switchdev.h37
-rw-r--r--include/net/tc_act/tc_vlan.h27
-rw-r--r--include/net/tcp.h25
-rw-r--r--include/net/udplite.h10
-rw-r--r--include/net/wpan-phy.h105
-rw-r--r--include/scsi/libfc.h2
-rw-r--r--include/scsi/libiscsi.h2
-rw-r--r--include/scsi/libsas.h28
-rw-r--r--include/scsi/scsi.h12
-rw-r--r--include/scsi/scsi_cmnd.h6
-rw-r--r--include/scsi/scsi_dbg.h28
-rw-r--r--include/scsi/scsi_device.h21
-rw-r--r--include/scsi/scsi_driver.h1
-rw-r--r--include/scsi/scsi_eh.h24
-rw-r--r--include/scsi/scsi_host.h41
-rw-r--r--include/scsi/scsi_ioctl.h4
-rw-r--r--include/scsi/scsi_tcq.h87
-rw-r--r--include/scsi/scsi_transport_spi.h1
-rw-r--r--include/scsi/sg.h5
-rw-r--r--include/soc/at91/at91rm9200_sdramc.h63
-rw-r--r--include/soc/at91/at91sam9_ddrsdr.h124
-rw-r--r--include/soc/at91/at91sam9_sdramc.h85
-rw-r--r--include/soc/tegra/mc.h107
-rw-r--r--include/sound/compress_driver.h5
-rw-r--r--include/sound/jack.h26
-rw-r--r--include/sound/omap-hdmi-audio.h43
-rw-r--r--include/sound/pcm.h256
-rw-r--r--include/sound/rcar_snd.h8
-rw-r--r--include/sound/rt5645.h4
-rw-r--r--include/sound/rt5677.h10
-rw-r--r--include/sound/seq_kernel.h4
-rw-r--r--include/sound/soc-dai.h7
-rw-r--r--include/sound/soc-dapm.h9
-rw-r--r--include/sound/soc.h116
-rw-r--r--include/sound/uda134x.h12
-rw-r--r--include/trace/events/asoc.h25
-rw-r--r--include/trace/events/ext4.h17
-rw-r--r--include/trace/events/host1x.h27
-rw-r--r--include/trace/events/rcu.h4
-rw-r--r--include/trace/events/sched.h9
-rw-r--r--include/trace/events/scsi.h2
-rw-r--r--include/trace/events/sunrpc.h160
-rw-r--r--include/trace/events/target.h2
-rw-r--r--include/trace/ftrace.h8
-rw-r--r--include/uapi/asm-generic/siginfo.h9
-rw-r--r--include/uapi/asm-generic/socket.h5
-rw-r--r--include/uapi/asm-generic/unistd.h4
-rw-r--r--include/uapi/drm/drm_mode.h2
-rw-r--r--include/uapi/drm/i915_drm.h7
-rw-r--r--include/uapi/linux/Kbuild96
-rw-r--r--include/uapi/linux/android/Kbuild2
-rw-r--r--include/uapi/linux/android/binder.h352
-rw-r--r--include/uapi/linux/audit.h17
-rw-r--r--include/uapi/linux/bpf.h14
-rw-r--r--include/uapi/linux/btrfs.h1
-rw-r--r--include/uapi/linux/can/error.h1
-rw-r--r--include/uapi/linux/dlmconstants.h2
-rw-r--r--include/uapi/linux/dm-ioctl.h9
-rw-r--r--include/uapi/linux/elf-em.h1
-rw-r--r--include/uapi/linux/elf.h1
-rw-r--r--include/uapi/linux/ethtool.h28
-rw-r--r--include/uapi/linux/hyperv.h1
-rw-r--r--include/uapi/linux/if_alg.h2
-rw-r--r--include/uapi/linux/if_bridge.h1
-rw-r--r--include/uapi/linux/if_link.h18
-rw-r--r--include/uapi/linux/if_tun.h17
-rw-r--r--include/uapi/linux/if_tunnel.h1
-rw-r--r--include/uapi/linux/ipv6.h1
-rw-r--r--include/uapi/linux/kcmp.h (renamed from include/linux/kcmp.h)6
-rw-r--r--include/uapi/linux/kfd_ioctl.h154
-rw-r--r--include/uapi/linux/media-bus-format.h125
-rw-r--r--include/uapi/linux/msg.h28
-rw-r--r--include/uapi/linux/neighbour.h6
-rw-r--r--include/uapi/linux/net_tstamp.h3
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set.h8
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h18
-rw-r--r--include/uapi/linux/netfilter/xt_set.h13
-rw-r--r--include/uapi/linux/nfc.h23
-rw-r--r--include/uapi/linux/nfsd/debug.h2
-rw-r--r--include/uapi/linux/nl80211.h147
-rw-r--r--include/uapi/linux/nvme.h46
-rw-r--r--include/uapi/linux/openvswitch.h53
-rw-r--r--include/uapi/linux/perf_event.h15
-rw-r--r--include/uapi/linux/prctl.h6
-rw-r--r--include/uapi/linux/rtnetlink.h1
-rw-r--r--include/uapi/linux/sched.h4
-rw-r--r--include/uapi/linux/sem.h18
-rw-r--r--include/uapi/linux/serial_core.h3
-rw-r--r--include/uapi/linux/serial_reg.h1
-rw-r--r--include/uapi/linux/snmp.h5
-rw-r--r--include/uapi/linux/sysctl.h1
-rw-r--r--include/uapi/linux/tc_act/Kbuild1
-rw-r--r--include/uapi/linux/tc_act/tc_vlan.h35
-rw-r--r--include/uapi/linux/tipc_netlink.h244
-rw-r--r--include/uapi/linux/tty_flags.h19
-rw-r--r--include/uapi/linux/v4l2-common.h2
-rw-r--r--include/uapi/linux/v4l2-mediabus.h219
-rw-r--r--include/uapi/linux/v4l2-subdev.h6
-rw-r--r--include/uapi/linux/videodev2.h101
-rw-r--r--include/uapi/linux/virtio_blk.h15
-rw-r--r--include/uapi/linux/virtio_config.h9
-rw-r--r--include/uapi/linux/virtio_console.h7
-rw-r--r--include/uapi/linux/virtio_net.h15
-rw-r--r--include/uapi/linux/virtio_ring.h45
-rw-r--r--include/uapi/linux/virtio_scsi.h (renamed from include/linux/virtio_scsi.h)106
-rw-r--r--include/uapi/linux/virtio_types.h46
-rw-r--r--include/uapi/linux/vt.h3
-rw-r--r--include/uapi/sound/asound.h7
-rw-r--r--include/uapi/sound/compress_offload.h17
-rw-r--r--include/uapi/sound/firewire.h3
-rw-r--r--include/uapi/sound/hdspm.h12
-rw-r--r--include/video/omapdss.h45
-rw-r--r--include/xen/interface/features.h3
-rw-r--r--include/xen/interface/grant_table.h19
501 files changed, 15620 insertions, 3348 deletions
diff --git a/include/acpi/acbuffer.h b/include/acpi/acbuffer.h
index 88cb477524a6..d5ec6c87810f 100644
--- a/include/acpi/acbuffer.h
+++ b/include/acpi/acbuffer.h
@@ -111,7 +111,9 @@ struct acpi_gtm_info {
111struct acpi_pld_info { 111struct acpi_pld_info {
112 u8 revision; 112 u8 revision;
113 u8 ignore_color; 113 u8 ignore_color;
114 u32 color; 114 u8 red;
115 u8 green;
116 u8 blue;
115 u16 width; 117 u16 width;
116 u16 height; 118 u16 height;
117 u8 user_visible; 119 u8 user_visible;
@@ -155,8 +157,14 @@ struct acpi_pld_info {
155#define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK) 157#define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK)
156#define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */ 158#define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */
157 159
158#define ACPI_PLD_GET_COLOR(dword) ACPI_GET_BITS (dword, 8, ACPI_24BIT_MASK) 160#define ACPI_PLD_GET_RED(dword) ACPI_GET_BITS (dword, 8, ACPI_8BIT_MASK)
159#define ACPI_PLD_SET_COLOR(dword,value) ACPI_SET_BITS (dword, 8, ACPI_24BIT_MASK, value) /* Offset 8, Len 24 */ 161#define ACPI_PLD_SET_RED(dword,value) ACPI_SET_BITS (dword, 8, ACPI_8BIT_MASK, value) /* Offset 8, Len 8 */
162
163#define ACPI_PLD_GET_GREEN(dword) ACPI_GET_BITS (dword, 16, ACPI_8BIT_MASK)
164#define ACPI_PLD_SET_GREEN(dword,value) ACPI_SET_BITS (dword, 16, ACPI_8BIT_MASK, value) /* Offset 16, Len 8 */
165
166#define ACPI_PLD_GET_BLUE(dword) ACPI_GET_BITS (dword, 24, ACPI_8BIT_MASK)
167#define ACPI_PLD_SET_BLUE(dword,value) ACPI_SET_BITS (dword, 24, ACPI_8BIT_MASK, value) /* Offset 24, Len 8 */
160 168
161/* Second 32-bit dword, bits 33:63 */ 169/* Second 32-bit dword, bits 33:63 */
162 170
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index f34a0835aa4f..7581518e3eff 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -27,6 +27,7 @@
27#define __ACPI_BUS_H__ 27#define __ACPI_BUS_H__
28 28
29#include <linux/device.h> 29#include <linux/device.h>
30#include <linux/property.h>
30 31
31/* TBD: Make dynamic */ 32/* TBD: Make dynamic */
32#define ACPI_MAX_HANDLES 10 33#define ACPI_MAX_HANDLES 10
@@ -337,10 +338,20 @@ struct acpi_device_physical_node {
337 bool put_online:1; 338 bool put_online:1;
338}; 339};
339 340
341/* ACPI Device Specific Data (_DSD) */
342struct acpi_device_data {
343 const union acpi_object *pointer;
344 const union acpi_object *properties;
345 const union acpi_object *of_compatible;
346};
347
348struct acpi_gpio_mapping;
349
340/* Device */ 350/* Device */
341struct acpi_device { 351struct acpi_device {
342 int device_type; 352 int device_type;
343 acpi_handle handle; /* no handle for fixed hardware */ 353 acpi_handle handle; /* no handle for fixed hardware */
354 struct fwnode_handle fwnode;
344 struct acpi_device *parent; 355 struct acpi_device *parent;
345 struct list_head children; 356 struct list_head children;
346 struct list_head node; 357 struct list_head node;
@@ -353,17 +364,35 @@ struct acpi_device {
353 struct acpi_device_wakeup wakeup; 364 struct acpi_device_wakeup wakeup;
354 struct acpi_device_perf performance; 365 struct acpi_device_perf performance;
355 struct acpi_device_dir dir; 366 struct acpi_device_dir dir;
367 struct acpi_device_data data;
356 struct acpi_scan_handler *handler; 368 struct acpi_scan_handler *handler;
357 struct acpi_hotplug_context *hp; 369 struct acpi_hotplug_context *hp;
358 struct acpi_driver *driver; 370 struct acpi_driver *driver;
371 const struct acpi_gpio_mapping *driver_gpios;
359 void *driver_data; 372 void *driver_data;
360 struct device dev; 373 struct device dev;
361 unsigned int physical_node_count; 374 unsigned int physical_node_count;
375 unsigned int dep_unmet;
362 struct list_head physical_node_list; 376 struct list_head physical_node_list;
363 struct mutex physical_node_lock; 377 struct mutex physical_node_lock;
364 void (*remove)(struct acpi_device *); 378 void (*remove)(struct acpi_device *);
365}; 379};
366 380
381static inline bool is_acpi_node(struct fwnode_handle *fwnode)
382{
383 return fwnode && fwnode->type == FWNODE_ACPI;
384}
385
386static inline struct acpi_device *acpi_node(struct fwnode_handle *fwnode)
387{
388 return fwnode ? container_of(fwnode, struct acpi_device, fwnode) : NULL;
389}
390
391static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
392{
393 return &adev->fwnode;
394}
395
367static inline void *acpi_driver_data(struct acpi_device *d) 396static inline void *acpi_driver_data(struct acpi_device *d)
368{ 397{
369 return d->driver_data; 398 return d->driver_data;
@@ -516,6 +545,7 @@ acpi_status acpi_add_pm_notifier(struct acpi_device *adev, struct device *dev,
516 void (*work_func)(struct work_struct *work)); 545 void (*work_func)(struct work_struct *work));
517acpi_status acpi_remove_pm_notifier(struct acpi_device *adev); 546acpi_status acpi_remove_pm_notifier(struct acpi_device *adev);
518int acpi_pm_device_sleep_state(struct device *, int *, int); 547int acpi_pm_device_sleep_state(struct device *, int *, int);
548int acpi_pm_device_run_wake(struct device *, bool);
519#else 549#else
520static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev, 550static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
521 struct device *dev, 551 struct device *dev,
@@ -535,11 +565,6 @@ static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
535 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3_COLD) ? 565 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3_COLD) ?
536 m : ACPI_STATE_D0; 566 m : ACPI_STATE_D0;
537} 567}
538#endif
539
540#ifdef CONFIG_PM_RUNTIME
541int acpi_pm_device_run_wake(struct device *, bool);
542#else
543static inline int acpi_pm_device_run_wake(struct device *dev, bool enable) 568static inline int acpi_pm_device_run_wake(struct device *dev, bool enable)
544{ 569{
545 return -ENODEV; 570 return -ENODEV;
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index ab2acf629a64..5ba78464c1b1 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -46,7 +46,7 @@
46 46
47/* Current ACPICA subsystem version in YYYYMMDD format */ 47/* Current ACPICA subsystem version in YYYYMMDD format */
48 48
49#define ACPI_CA_VERSION 0x20140926 49#define ACPI_CA_VERSION 0x20141107
50 50
51#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
52#include <acpi/actypes.h> 52#include <acpi/actypes.h>
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 7000e66f768e..bbef17368e49 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -736,6 +736,10 @@ typedef u32 acpi_event_status;
736#define ACPI_GPE_ENABLE 0 736#define ACPI_GPE_ENABLE 0
737#define ACPI_GPE_DISABLE 1 737#define ACPI_GPE_DISABLE 1
738#define ACPI_GPE_CONDITIONAL_ENABLE 2 738#define ACPI_GPE_CONDITIONAL_ENABLE 2
739#define ACPI_GPE_SAVE_MASK 4
740
741#define ACPI_GPE_ENABLE_SAVE (ACPI_GPE_ENABLE | ACPI_GPE_SAVE_MASK)
742#define ACPI_GPE_DISABLE_SAVE (ACPI_GPE_DISABLE | ACPI_GPE_SAVE_MASK)
739 743
740/* 744/*
741 * GPE info flags - Per GPE 745 * GPE info flags - Per GPE
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 9b9b6f29bbf3..3ca9b751f122 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -67,9 +67,6 @@ struct acpi_processor_cx {
67}; 67};
68 68
69struct acpi_processor_power { 69struct acpi_processor_power {
70 struct acpi_processor_cx *state;
71 unsigned long bm_check_timestamp;
72 u32 default_state;
73 int count; 70 int count;
74 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; 71 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
75 int timer_broadcast_on_state; 72 int timer_broadcast_on_state;
@@ -313,11 +310,13 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
313#endif /* CONFIG_CPU_FREQ */ 310#endif /* CONFIG_CPU_FREQ */
314 311
315/* in processor_core.c */ 312/* in processor_core.c */
316void acpi_processor_set_pdc(acpi_handle handle);
317int acpi_get_apicid(acpi_handle, int type, u32 acpi_id); 313int acpi_get_apicid(acpi_handle, int type, u32 acpi_id);
318int acpi_map_cpuid(int apic_id, u32 acpi_id); 314int acpi_map_cpuid(int apic_id, u32 acpi_id);
319int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id); 315int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
320 316
317/* in processor_pdc.c */
318void acpi_processor_set_pdc(acpi_handle handle);
319
321/* in processor_throttling.c */ 320/* in processor_throttling.c */
322int acpi_processor_tstate_has_changed(struct acpi_processor *pr); 321int acpi_processor_tstate_has_changed(struct acpi_processor *pr);
323int acpi_processor_get_throttling_info(struct acpi_processor *pr); 322int acpi_processor_get_throttling_info(struct acpi_processor *pr);
diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h
index 1402fa855388..f5c40b0fadc2 100644
--- a/include/asm-generic/barrier.h
+++ b/include/asm-generic/barrier.h
@@ -42,6 +42,14 @@
42#define wmb() mb() 42#define wmb() mb()
43#endif 43#endif
44 44
45#ifndef dma_rmb
46#define dma_rmb() rmb()
47#endif
48
49#ifndef dma_wmb
50#define dma_wmb() wmb()
51#endif
52
45#ifndef read_barrier_depends 53#ifndef read_barrier_depends
46#define read_barrier_depends() do { } while (0) 54#define read_barrier_depends() do { } while (0)
47#endif 55#endif
diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h
index 01f227e14254..b59b5a52637e 100644
--- a/include/asm-generic/futex.h
+++ b/include/asm-generic/futex.h
@@ -5,6 +5,119 @@
5#include <linux/uaccess.h> 5#include <linux/uaccess.h>
6#include <asm/errno.h> 6#include <asm/errno.h>
7 7
8#ifndef CONFIG_SMP
9/*
10 * The following implementation only for uniprocessor machines.
11 * For UP, it's relies on the fact that pagefault_disable() also disables
12 * preemption to ensure mutual exclusion.
13 *
14 */
15
16/**
17 * futex_atomic_op_inuser() - Atomic arithmetic operation with constant
18 * argument and comparison of the previous
19 * futex value with another constant.
20 *
21 * @encoded_op: encoded operation to execute
22 * @uaddr: pointer to user space address
23 *
24 * Return:
25 * 0 - On success
26 * <0 - On error
27 */
28static inline int
29futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)
30{
31 int op = (encoded_op >> 28) & 7;
32 int cmp = (encoded_op >> 24) & 15;
33 int oparg = (encoded_op << 8) >> 20;
34 int cmparg = (encoded_op << 20) >> 20;
35 int oldval, ret;
36 u32 tmp;
37
38 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
39 oparg = 1 << oparg;
40
41 pagefault_disable();
42
43 ret = -EFAULT;
44 if (unlikely(get_user(oldval, uaddr) != 0))
45 goto out_pagefault_enable;
46
47 ret = 0;
48 tmp = oldval;
49
50 switch (op) {
51 case FUTEX_OP_SET:
52 tmp = oparg;
53 break;
54 case FUTEX_OP_ADD:
55 tmp += oparg;
56 break;
57 case FUTEX_OP_OR:
58 tmp |= oparg;
59 break;
60 case FUTEX_OP_ANDN:
61 tmp &= ~oparg;
62 break;
63 case FUTEX_OP_XOR:
64 tmp ^= oparg;
65 break;
66 default:
67 ret = -ENOSYS;
68 }
69
70 if (ret == 0 && unlikely(put_user(tmp, uaddr) != 0))
71 ret = -EFAULT;
72
73out_pagefault_enable:
74 pagefault_enable();
75
76 if (ret == 0) {
77 switch (cmp) {
78 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
79 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
80 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
81 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
82 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
83 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
84 default: ret = -ENOSYS;
85 }
86 }
87 return ret;
88}
89
90/**
91 * futex_atomic_cmpxchg_inatomic() - Compare and exchange the content of the
92 * uaddr with newval if the current value is
93 * oldval.
94 * @uval: pointer to store content of @uaddr
95 * @uaddr: pointer to user space address
96 * @oldval: old value
97 * @newval: new value to store to @uaddr
98 *
99 * Return:
100 * 0 - On success
101 * <0 - On error
102 */
103static inline int
104futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
105 u32 oldval, u32 newval)
106{
107 u32 val;
108
109 if (unlikely(get_user(val, uaddr) != 0))
110 return -EFAULT;
111
112 if (val == oldval && unlikely(put_user(newval, uaddr) != 0))
113 return -EFAULT;
114
115 *uval = val;
116
117 return 0;
118}
119
120#else
8static inline int 121static inline int
9futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) 122futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
10{ 123{
@@ -54,4 +167,5 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
54 return -ENOSYS; 167 return -ENOSYS;
55} 168}
56 169
170#endif /* CONFIG_SMP */
57#endif 171#endif
diff --git a/include/asm-generic/hash.h b/include/asm-generic/hash.h
deleted file mode 100644
index b6312843dbd9..000000000000
--- a/include/asm-generic/hash.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __ASM_GENERIC_HASH_H
2#define __ASM_GENERIC_HASH_H
3
4struct fast_hash_ops;
5static inline void setup_arch_fast_hash(struct fast_hash_ops *ops)
6{
7}
8
9#endif /* __ASM_GENERIC_HASH_H */
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index b8fdc57a7335..9db042304df3 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -12,6 +12,7 @@
12#define __ASM_GENERIC_IO_H 12#define __ASM_GENERIC_IO_H
13 13
14#include <asm/page.h> /* I/O is all done through memory accesses */ 14#include <asm/page.h> /* I/O is all done through memory accesses */
15#include <linux/string.h> /* for memset() and memcpy() */
15#include <linux/types.h> 16#include <linux/types.h>
16 17
17#ifdef CONFIG_GENERIC_IOMAP 18#ifdef CONFIG_GENERIC_IOMAP
@@ -24,260 +25,691 @@
24#define mmiowb() do {} while (0) 25#define mmiowb() do {} while (0)
25#endif 26#endif
26 27
27/*****************************************************************************/
28/* 28/*
29 * readX/writeX() are used to access memory mapped devices. On some 29 * __raw_{read,write}{b,w,l,q}() access memory in native endianness.
30 * architectures the memory mapped IO stuff needs to be accessed 30 *
31 * differently. On the simple architectures, we just read/write the 31 * On some architectures memory mapped IO needs to be accessed differently.
32 * memory location directly. 32 * On the simple architectures, we just read/write the memory location
33 * directly.
33 */ 34 */
35
34#ifndef __raw_readb 36#ifndef __raw_readb
37#define __raw_readb __raw_readb
35static inline u8 __raw_readb(const volatile void __iomem *addr) 38static inline u8 __raw_readb(const volatile void __iomem *addr)
36{ 39{
37 return *(const volatile u8 __force *) addr; 40 return *(const volatile u8 __force *)addr;
38} 41}
39#endif 42#endif
40 43
41#ifndef __raw_readw 44#ifndef __raw_readw
45#define __raw_readw __raw_readw
42static inline u16 __raw_readw(const volatile void __iomem *addr) 46static inline u16 __raw_readw(const volatile void __iomem *addr)
43{ 47{
44 return *(const volatile u16 __force *) addr; 48 return *(const volatile u16 __force *)addr;
45} 49}
46#endif 50#endif
47 51
48#ifndef __raw_readl 52#ifndef __raw_readl
53#define __raw_readl __raw_readl
49static inline u32 __raw_readl(const volatile void __iomem *addr) 54static inline u32 __raw_readl(const volatile void __iomem *addr)
50{ 55{
51 return *(const volatile u32 __force *) addr; 56 return *(const volatile u32 __force *)addr;
52} 57}
53#endif 58#endif
54 59
55#define readb __raw_readb 60#ifdef CONFIG_64BIT
56 61#ifndef __raw_readq
57#define readw readw 62#define __raw_readq __raw_readq
58static inline u16 readw(const volatile void __iomem *addr) 63static inline u64 __raw_readq(const volatile void __iomem *addr)
59{
60 return __le16_to_cpu(__raw_readw(addr));
61}
62
63#define readl readl
64static inline u32 readl(const volatile void __iomem *addr)
65{ 64{
66 return __le32_to_cpu(__raw_readl(addr)); 65 return *(const volatile u64 __force *)addr;
67} 66}
67#endif
68#endif /* CONFIG_64BIT */
68 69
69#ifndef __raw_writeb 70#ifndef __raw_writeb
70static inline void __raw_writeb(u8 b, volatile void __iomem *addr) 71#define __raw_writeb __raw_writeb
72static inline void __raw_writeb(u8 value, volatile void __iomem *addr)
71{ 73{
72 *(volatile u8 __force *) addr = b; 74 *(volatile u8 __force *)addr = value;
73} 75}
74#endif 76#endif
75 77
76#ifndef __raw_writew 78#ifndef __raw_writew
77static inline void __raw_writew(u16 b, volatile void __iomem *addr) 79#define __raw_writew __raw_writew
80static inline void __raw_writew(u16 value, volatile void __iomem *addr)
78{ 81{
79 *(volatile u16 __force *) addr = b; 82 *(volatile u16 __force *)addr = value;
80} 83}
81#endif 84#endif
82 85
83#ifndef __raw_writel 86#ifndef __raw_writel
84static inline void __raw_writel(u32 b, volatile void __iomem *addr) 87#define __raw_writel __raw_writel
88static inline void __raw_writel(u32 value, volatile void __iomem *addr)
85{ 89{
86 *(volatile u32 __force *) addr = b; 90 *(volatile u32 __force *)addr = value;
87} 91}
88#endif 92#endif
89 93
90#define writeb __raw_writeb
91#define writew(b,addr) __raw_writew(__cpu_to_le16(b),addr)
92#define writel(b,addr) __raw_writel(__cpu_to_le32(b),addr)
93
94#ifdef CONFIG_64BIT 94#ifdef CONFIG_64BIT
95#ifndef __raw_readq 95#ifndef __raw_writeq
96static inline u64 __raw_readq(const volatile void __iomem *addr) 96#define __raw_writeq __raw_writeq
97static inline void __raw_writeq(u64 value, volatile void __iomem *addr)
97{ 98{
98 return *(const volatile u64 __force *) addr; 99 *(volatile u64 __force *)addr = value;
99} 100}
100#endif 101#endif
102#endif /* CONFIG_64BIT */
101 103
102#define readq readq 104/*
103static inline u64 readq(const volatile void __iomem *addr) 105 * {read,write}{b,w,l,q}() access little endian memory and return result in
104{ 106 * native endianness.
105 return __le64_to_cpu(__raw_readq(addr)); 107 */
106}
107 108
108#ifndef __raw_writeq 109#ifndef readb
109static inline void __raw_writeq(u64 b, volatile void __iomem *addr) 110#define readb readb
111static inline u8 readb(const volatile void __iomem *addr)
110{ 112{
111 *(volatile u64 __force *) addr = b; 113 return __raw_readb(addr);
112} 114}
113#endif 115#endif
114 116
115#define writeq(b, addr) __raw_writeq(__cpu_to_le64(b), addr) 117#ifndef readw
116#endif /* CONFIG_64BIT */ 118#define readw readw
117 119static inline u16 readw(const volatile void __iomem *addr)
118#ifndef PCI_IOBASE 120{
119#define PCI_IOBASE ((void __iomem *) 0) 121 return __le16_to_cpu(__raw_readw(addr));
122}
120#endif 123#endif
121 124
122/*****************************************************************************/ 125#ifndef readl
123/* 126#define readl readl
124 * traditional input/output functions 127static inline u32 readl(const volatile void __iomem *addr)
125 */
126
127static inline u8 inb(unsigned long addr)
128{ 128{
129 return readb(addr + PCI_IOBASE); 129 return __le32_to_cpu(__raw_readl(addr));
130} 130}
131#endif
131 132
132static inline u16 inw(unsigned long addr) 133#ifdef CONFIG_64BIT
134#ifndef readq
135#define readq readq
136static inline u64 readq(const volatile void __iomem *addr)
133{ 137{
134 return readw(addr + PCI_IOBASE); 138 return __le64_to_cpu(__raw_readq(addr));
135} 139}
140#endif
141#endif /* CONFIG_64BIT */
136 142
137static inline u32 inl(unsigned long addr) 143#ifndef writeb
144#define writeb writeb
145static inline void writeb(u8 value, volatile void __iomem *addr)
138{ 146{
139 return readl(addr + PCI_IOBASE); 147 __raw_writeb(value, addr);
140} 148}
149#endif
141 150
142static inline void outb(u8 b, unsigned long addr) 151#ifndef writew
152#define writew writew
153static inline void writew(u16 value, volatile void __iomem *addr)
143{ 154{
144 writeb(b, addr + PCI_IOBASE); 155 __raw_writew(cpu_to_le16(value), addr);
145} 156}
157#endif
146 158
147static inline void outw(u16 b, unsigned long addr) 159#ifndef writel
160#define writel writel
161static inline void writel(u32 value, volatile void __iomem *addr)
148{ 162{
149 writew(b, addr + PCI_IOBASE); 163 __raw_writel(__cpu_to_le32(value), addr);
150} 164}
165#endif
151 166
152static inline void outl(u32 b, unsigned long addr) 167#ifdef CONFIG_64BIT
168#ifndef writeq
169#define writeq writeq
170static inline void writeq(u64 value, volatile void __iomem *addr)
153{ 171{
154 writel(b, addr + PCI_IOBASE); 172 __raw_writeq(__cpu_to_le64(value), addr);
155} 173}
174#endif
175#endif /* CONFIG_64BIT */
176
177/*
178 * {read,write}{b,w,l,q}_relaxed() are like the regular version, but
179 * are not guaranteed to provide ordering against spinlocks or memory
180 * accesses.
181 */
182#ifndef readb_relaxed
183#define readb_relaxed readb
184#endif
156 185
157#define inb_p(addr) inb(addr) 186#ifndef readw_relaxed
158#define inw_p(addr) inw(addr) 187#define readw_relaxed readw
159#define inl_p(addr) inl(addr) 188#endif
160#define outb_p(x, addr) outb((x), (addr))
161#define outw_p(x, addr) outw((x), (addr))
162#define outl_p(x, addr) outl((x), (addr))
163 189
164#ifndef insb 190#ifndef readl_relaxed
165static inline void insb(unsigned long addr, void *buffer, int count) 191#define readl_relaxed readl
192#endif
193
194#ifndef readq_relaxed
195#define readq_relaxed readq
196#endif
197
198#ifndef writeb_relaxed
199#define writeb_relaxed writeb
200#endif
201
202#ifndef writew_relaxed
203#define writew_relaxed writew
204#endif
205
206#ifndef writel_relaxed
207#define writel_relaxed writel
208#endif
209
210#ifndef writeq_relaxed
211#define writeq_relaxed writeq
212#endif
213
214/*
215 * {read,write}s{b,w,l,q}() repeatedly access the same memory address in
216 * native endianness in 8-, 16-, 32- or 64-bit chunks (@count times).
217 */
218#ifndef readsb
219#define readsb readsb
220static inline void readsb(const volatile void __iomem *addr, void *buffer,
221 unsigned int count)
166{ 222{
167 if (count) { 223 if (count) {
168 u8 *buf = buffer; 224 u8 *buf = buffer;
225
169 do { 226 do {
170 u8 x = __raw_readb(addr + PCI_IOBASE); 227 u8 x = __raw_readb(addr);
171 *buf++ = x; 228 *buf++ = x;
172 } while (--count); 229 } while (--count);
173 } 230 }
174} 231}
175#endif 232#endif
176 233
177#ifndef insw 234#ifndef readsw
178static inline void insw(unsigned long addr, void *buffer, int count) 235#define readsw readsw
236static inline void readsw(const volatile void __iomem *addr, void *buffer,
237 unsigned int count)
179{ 238{
180 if (count) { 239 if (count) {
181 u16 *buf = buffer; 240 u16 *buf = buffer;
241
182 do { 242 do {
183 u16 x = __raw_readw(addr + PCI_IOBASE); 243 u16 x = __raw_readw(addr);
184 *buf++ = x; 244 *buf++ = x;
185 } while (--count); 245 } while (--count);
186 } 246 }
187} 247}
188#endif 248#endif
189 249
190#ifndef insl 250#ifndef readsl
191static inline void insl(unsigned long addr, void *buffer, int count) 251#define readsl readsl
252static inline void readsl(const volatile void __iomem *addr, void *buffer,
253 unsigned int count)
192{ 254{
193 if (count) { 255 if (count) {
194 u32 *buf = buffer; 256 u32 *buf = buffer;
257
195 do { 258 do {
196 u32 x = __raw_readl(addr + PCI_IOBASE); 259 u32 x = __raw_readl(addr);
197 *buf++ = x; 260 *buf++ = x;
198 } while (--count); 261 } while (--count);
199 } 262 }
200} 263}
201#endif 264#endif
202 265
203#ifndef outsb 266#ifdef CONFIG_64BIT
204static inline void outsb(unsigned long addr, const void *buffer, int count) 267#ifndef readsq
268#define readsq readsq
269static inline void readsq(const volatile void __iomem *addr, void *buffer,
270 unsigned int count)
271{
272 if (count) {
273 u64 *buf = buffer;
274
275 do {
276 u64 x = __raw_readq(addr);
277 *buf++ = x;
278 } while (--count);
279 }
280}
281#endif
282#endif /* CONFIG_64BIT */
283
284#ifndef writesb
285#define writesb writesb
286static inline void writesb(volatile void __iomem *addr, const void *buffer,
287 unsigned int count)
205{ 288{
206 if (count) { 289 if (count) {
207 const u8 *buf = buffer; 290 const u8 *buf = buffer;
291
208 do { 292 do {
209 __raw_writeb(*buf++, addr + PCI_IOBASE); 293 __raw_writeb(*buf++, addr);
210 } while (--count); 294 } while (--count);
211 } 295 }
212} 296}
213#endif 297#endif
214 298
215#ifndef outsw 299#ifndef writesw
216static inline void outsw(unsigned long addr, const void *buffer, int count) 300#define writesw writesw
301static inline void writesw(volatile void __iomem *addr, const void *buffer,
302 unsigned int count)
217{ 303{
218 if (count) { 304 if (count) {
219 const u16 *buf = buffer; 305 const u16 *buf = buffer;
306
220 do { 307 do {
221 __raw_writew(*buf++, addr + PCI_IOBASE); 308 __raw_writew(*buf++, addr);
222 } while (--count); 309 } while (--count);
223 } 310 }
224} 311}
225#endif 312#endif
226 313
227#ifndef outsl 314#ifndef writesl
228static inline void outsl(unsigned long addr, const void *buffer, int count) 315#define writesl writesl
316static inline void writesl(volatile void __iomem *addr, const void *buffer,
317 unsigned int count)
229{ 318{
230 if (count) { 319 if (count) {
231 const u32 *buf = buffer; 320 const u32 *buf = buffer;
321
232 do { 322 do {
233 __raw_writel(*buf++, addr + PCI_IOBASE); 323 __raw_writel(*buf++, addr);
234 } while (--count); 324 } while (--count);
235 } 325 }
236} 326}
237#endif 327#endif
238 328
239#ifndef CONFIG_GENERIC_IOMAP 329#ifdef CONFIG_64BIT
240#define ioread8(addr) readb(addr) 330#ifndef writesq
241#define ioread16(addr) readw(addr) 331#define writesq writesq
242#define ioread16be(addr) __be16_to_cpu(__raw_readw(addr)) 332static inline void writesq(volatile void __iomem *addr, const void *buffer,
243#define ioread32(addr) readl(addr) 333 unsigned int count)
244#define ioread32be(addr) __be32_to_cpu(__raw_readl(addr)) 334{
245 335 if (count) {
246#define iowrite8(v, addr) writeb((v), (addr)) 336 const u64 *buf = buffer;
247#define iowrite16(v, addr) writew((v), (addr)) 337
248#define iowrite16be(v, addr) __raw_writew(__cpu_to_be16(v), addr) 338 do {
249#define iowrite32(v, addr) writel((v), (addr)) 339 __raw_writeq(*buf++, addr);
250#define iowrite32be(v, addr) __raw_writel(__cpu_to_be32(v), addr) 340 } while (--count);
251 341 }
252#define ioread8_rep(p, dst, count) \ 342}
253 insb((unsigned long) (p), (dst), (count)) 343#endif
254#define ioread16_rep(p, dst, count) \ 344#endif /* CONFIG_64BIT */
255 insw((unsigned long) (p), (dst), (count)) 345
256#define ioread32_rep(p, dst, count) \ 346#ifndef PCI_IOBASE
257 insl((unsigned long) (p), (dst), (count)) 347#define PCI_IOBASE ((void __iomem *)0)
258 348#endif
259#define iowrite8_rep(p, src, count) \
260 outsb((unsigned long) (p), (src), (count))
261#define iowrite16_rep(p, src, count) \
262 outsw((unsigned long) (p), (src), (count))
263#define iowrite32_rep(p, src, count) \
264 outsl((unsigned long) (p), (src), (count))
265#endif /* CONFIG_GENERIC_IOMAP */
266 349
267#ifndef IO_SPACE_LIMIT 350#ifndef IO_SPACE_LIMIT
268#define IO_SPACE_LIMIT 0xffff 351#define IO_SPACE_LIMIT 0xffff
269#endif 352#endif
270 353
354/*
355 * {in,out}{b,w,l}() access little endian I/O. {in,out}{b,w,l}_p() can be
356 * implemented on hardware that needs an additional delay for I/O accesses to
357 * take effect.
358 */
359
360#ifndef inb
361#define inb inb
362static inline u8 inb(unsigned long addr)
363{
364 return readb(PCI_IOBASE + addr);
365}
366#endif
367
368#ifndef inw
369#define inw inw
370static inline u16 inw(unsigned long addr)
371{
372 return readw(PCI_IOBASE + addr);
373}
374#endif
375
376#ifndef inl
377#define inl inl
378static inline u32 inl(unsigned long addr)
379{
380 return readl(PCI_IOBASE + addr);
381}
382#endif
383
384#ifndef outb
385#define outb outb
386static inline void outb(u8 value, unsigned long addr)
387{
388 writeb(value, PCI_IOBASE + addr);
389}
390#endif
391
392#ifndef outw
393#define outw outw
394static inline void outw(u16 value, unsigned long addr)
395{
396 writew(value, PCI_IOBASE + addr);
397}
398#endif
399
400#ifndef outl
401#define outl outl
402static inline void outl(u32 value, unsigned long addr)
403{
404 writel(value, PCI_IOBASE + addr);
405}
406#endif
407
408#ifndef inb_p
409#define inb_p inb_p
410static inline u8 inb_p(unsigned long addr)
411{
412 return inb(addr);
413}
414#endif
415
416#ifndef inw_p
417#define inw_p inw_p
418static inline u16 inw_p(unsigned long addr)
419{
420 return inw(addr);
421}
422#endif
423
424#ifndef inl_p
425#define inl_p inl_p
426static inline u32 inl_p(unsigned long addr)
427{
428 return inl(addr);
429}
430#endif
431
432#ifndef outb_p
433#define outb_p outb_p
434static inline void outb_p(u8 value, unsigned long addr)
435{
436 outb(value, addr);
437}
438#endif
439
440#ifndef outw_p
441#define outw_p outw_p
442static inline void outw_p(u16 value, unsigned long addr)
443{
444 outw(value, addr);
445}
446#endif
447
448#ifndef outl_p
449#define outl_p outl_p
450static inline void outl_p(u32 value, unsigned long addr)
451{
452 outl(value, addr);
453}
454#endif
455
456/*
457 * {in,out}s{b,w,l}{,_p}() are variants of the above that repeatedly access a
458 * single I/O port multiple times.
459 */
460
461#ifndef insb
462#define insb insb
463static inline void insb(unsigned long addr, void *buffer, unsigned int count)
464{
465 readsb(PCI_IOBASE + addr, buffer, count);
466}
467#endif
468
469#ifndef insw
470#define insw insw
471static inline void insw(unsigned long addr, void *buffer, unsigned int count)
472{
473 readsw(PCI_IOBASE + addr, buffer, count);
474}
475#endif
476
477#ifndef insl
478#define insl insl
479static inline void insl(unsigned long addr, void *buffer, unsigned int count)
480{
481 readsl(PCI_IOBASE + addr, buffer, count);
482}
483#endif
484
485#ifndef outsb
486#define outsb outsb
487static inline void outsb(unsigned long addr, const void *buffer,
488 unsigned int count)
489{
490 writesb(PCI_IOBASE + addr, buffer, count);
491}
492#endif
493
494#ifndef outsw
495#define outsw outsw
496static inline void outsw(unsigned long addr, const void *buffer,
497 unsigned int count)
498{
499 writesw(PCI_IOBASE + addr, buffer, count);
500}
501#endif
502
503#ifndef outsl
504#define outsl outsl
505static inline void outsl(unsigned long addr, const void *buffer,
506 unsigned int count)
507{
508 writesl(PCI_IOBASE + addr, buffer, count);
509}
510#endif
511
512#ifndef insb_p
513#define insb_p insb_p
514static inline void insb_p(unsigned long addr, void *buffer, unsigned int count)
515{
516 insb(addr, buffer, count);
517}
518#endif
519
520#ifndef insw_p
521#define insw_p insw_p
522static inline void insw_p(unsigned long addr, void *buffer, unsigned int count)
523{
524 insw(addr, buffer, count);
525}
526#endif
527
528#ifndef insl_p
529#define insl_p insl_p
530static inline void insl_p(unsigned long addr, void *buffer, unsigned int count)
531{
532 insl(addr, buffer, count);
533}
534#endif
535
536#ifndef outsb_p
537#define outsb_p outsb_p
538static inline void outsb_p(unsigned long addr, const void *buffer,
539 unsigned int count)
540{
541 outsb(addr, buffer, count);
542}
543#endif
544
545#ifndef outsw_p
546#define outsw_p outsw_p
547static inline void outsw_p(unsigned long addr, const void *buffer,
548 unsigned int count)
549{
550 outsw(addr, buffer, count);
551}
552#endif
553
554#ifndef outsl_p
555#define outsl_p outsl_p
556static inline void outsl_p(unsigned long addr, const void *buffer,
557 unsigned int count)
558{
559 outsl(addr, buffer, count);
560}
561#endif
562
563#ifndef CONFIG_GENERIC_IOMAP
564#ifndef ioread8
565#define ioread8 ioread8
566static inline u8 ioread8(const volatile void __iomem *addr)
567{
568 return readb(addr);
569}
570#endif
571
572#ifndef ioread16
573#define ioread16 ioread16
574static inline u16 ioread16(const volatile void __iomem *addr)
575{
576 return readw(addr);
577}
578#endif
579
580#ifndef ioread32
581#define ioread32 ioread32
582static inline u32 ioread32(const volatile void __iomem *addr)
583{
584 return readl(addr);
585}
586#endif
587
588#ifndef iowrite8
589#define iowrite8 iowrite8
590static inline void iowrite8(u8 value, volatile void __iomem *addr)
591{
592 writeb(value, addr);
593}
594#endif
595
596#ifndef iowrite16
597#define iowrite16 iowrite16
598static inline void iowrite16(u16 value, volatile void __iomem *addr)
599{
600 writew(value, addr);
601}
602#endif
603
604#ifndef iowrite32
605#define iowrite32 iowrite32
606static inline void iowrite32(u32 value, volatile void __iomem *addr)
607{
608 writel(value, addr);
609}
610#endif
611
612#ifndef ioread16be
613#define ioread16be ioread16be
614static inline u16 ioread16be(const volatile void __iomem *addr)
615{
616 return __be16_to_cpu(__raw_readw(addr));
617}
618#endif
619
620#ifndef ioread32be
621#define ioread32be ioread32be
622static inline u32 ioread32be(const volatile void __iomem *addr)
623{
624 return __be32_to_cpu(__raw_readl(addr));
625}
626#endif
627
628#ifndef iowrite16be
629#define iowrite16be iowrite16be
630static inline void iowrite16be(u16 value, void volatile __iomem *addr)
631{
632 __raw_writew(__cpu_to_be16(value), addr);
633}
634#endif
635
636#ifndef iowrite32be
637#define iowrite32be iowrite32be
638static inline void iowrite32be(u32 value, volatile void __iomem *addr)
639{
640 __raw_writel(__cpu_to_be32(value), addr);
641}
642#endif
643
644#ifndef ioread8_rep
645#define ioread8_rep ioread8_rep
646static inline void ioread8_rep(const volatile void __iomem *addr, void *buffer,
647 unsigned int count)
648{
649 readsb(addr, buffer, count);
650}
651#endif
652
653#ifndef ioread16_rep
654#define ioread16_rep ioread16_rep
655static inline void ioread16_rep(const volatile void __iomem *addr,
656 void *buffer, unsigned int count)
657{
658 readsw(addr, buffer, count);
659}
660#endif
661
662#ifndef ioread32_rep
663#define ioread32_rep ioread32_rep
664static inline void ioread32_rep(const volatile void __iomem *addr,
665 void *buffer, unsigned int count)
666{
667 readsl(addr, buffer, count);
668}
669#endif
670
671#ifndef iowrite8_rep
672#define iowrite8_rep iowrite8_rep
673static inline void iowrite8_rep(volatile void __iomem *addr,
674 const void *buffer,
675 unsigned int count)
676{
677 writesb(addr, buffer, count);
678}
679#endif
680
681#ifndef iowrite16_rep
682#define iowrite16_rep iowrite16_rep
683static inline void iowrite16_rep(volatile void __iomem *addr,
684 const void *buffer,
685 unsigned int count)
686{
687 writesw(addr, buffer, count);
688}
689#endif
690
691#ifndef iowrite32_rep
692#define iowrite32_rep iowrite32_rep
693static inline void iowrite32_rep(volatile void __iomem *addr,
694 const void *buffer,
695 unsigned int count)
696{
697 writesl(addr, buffer, count);
698}
699#endif
700#endif /* CONFIG_GENERIC_IOMAP */
701
271#ifdef __KERNEL__ 702#ifdef __KERNEL__
272 703
273#include <linux/vmalloc.h> 704#include <linux/vmalloc.h>
274#define __io_virt(x) ((void __force *) (x)) 705#define __io_virt(x) ((void __force *)(x))
275 706
276#ifndef CONFIG_GENERIC_IOMAP 707#ifndef CONFIG_GENERIC_IOMAP
277struct pci_dev; 708struct pci_dev;
278extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); 709extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
279 710
280#ifndef pci_iounmap 711#ifndef pci_iounmap
712#define pci_iounmap pci_iounmap
281static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) 713static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
282{ 714{
283} 715}
@@ -289,11 +721,15 @@ static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
289 * These are pretty trivial 721 * These are pretty trivial
290 */ 722 */
291#ifndef virt_to_phys 723#ifndef virt_to_phys
724#define virt_to_phys virt_to_phys
292static inline unsigned long virt_to_phys(volatile void *address) 725static inline unsigned long virt_to_phys(volatile void *address)
293{ 726{
294 return __pa((unsigned long)address); 727 return __pa((unsigned long)address);
295} 728}
729#endif
296 730
731#ifndef phys_to_virt
732#define phys_to_virt phys_to_virt
297static inline void *phys_to_virt(unsigned long address) 733static inline void *phys_to_virt(unsigned long address)
298{ 734{
299 return __va(address); 735 return __va(address);
@@ -306,37 +742,65 @@ static inline void *phys_to_virt(unsigned long address)
306 * This implementation is for the no-MMU case only... if you have an MMU 742 * This implementation is for the no-MMU case only... if you have an MMU
307 * you'll need to provide your own definitions. 743 * you'll need to provide your own definitions.
308 */ 744 */
745
309#ifndef CONFIG_MMU 746#ifndef CONFIG_MMU
310static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size) 747#ifndef ioremap
748#define ioremap ioremap
749static inline void __iomem *ioremap(phys_addr_t offset, size_t size)
311{ 750{
312 return (void __iomem*) (unsigned long)offset; 751 return (void __iomem *)(unsigned long)offset;
313} 752}
753#endif
314 754
315#define __ioremap(offset, size, flags) ioremap(offset, size) 755#ifndef __ioremap
756#define __ioremap __ioremap
757static inline void __iomem *__ioremap(phys_addr_t offset, size_t size,
758 unsigned long flags)
759{
760 return ioremap(offset, size);
761}
762#endif
316 763
317#ifndef ioremap_nocache 764#ifndef ioremap_nocache
318#define ioremap_nocache ioremap 765#define ioremap_nocache ioremap_nocache
766static inline void __iomem *ioremap_nocache(phys_addr_t offset, size_t size)
767{
768 return ioremap(offset, size);
769}
319#endif 770#endif
320 771
321#ifndef ioremap_wc 772#ifndef ioremap_wc
322#define ioremap_wc ioremap_nocache 773#define ioremap_wc ioremap_wc
774static inline void __iomem *ioremap_wc(phys_addr_t offset, size_t size)
775{
776 return ioremap_nocache(offset, size);
777}
323#endif 778#endif
324 779
780#ifndef iounmap
781#define iounmap iounmap
325static inline void iounmap(void __iomem *addr) 782static inline void iounmap(void __iomem *addr)
326{ 783{
327} 784}
785#endif
328#endif /* CONFIG_MMU */ 786#endif /* CONFIG_MMU */
329 787
330#ifdef CONFIG_HAS_IOPORT_MAP 788#ifdef CONFIG_HAS_IOPORT_MAP
331#ifndef CONFIG_GENERIC_IOMAP 789#ifndef CONFIG_GENERIC_IOMAP
790#ifndef ioport_map
791#define ioport_map ioport_map
332static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) 792static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
333{ 793{
334 return PCI_IOBASE + (port & IO_SPACE_LIMIT); 794 return PCI_IOBASE + (port & IO_SPACE_LIMIT);
335} 795}
796#endif
336 797
798#ifndef ioport_unmap
799#define ioport_unmap ioport_unmap
337static inline void ioport_unmap(void __iomem *p) 800static inline void ioport_unmap(void __iomem *p)
338{ 801{
339} 802}
803#endif
340#else /* CONFIG_GENERIC_IOMAP */ 804#else /* CONFIG_GENERIC_IOMAP */
341extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 805extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
342extern void ioport_unmap(void __iomem *p); 806extern void ioport_unmap(void __iomem *p);
@@ -344,35 +808,68 @@ extern void ioport_unmap(void __iomem *p);
344#endif /* CONFIG_HAS_IOPORT_MAP */ 808#endif /* CONFIG_HAS_IOPORT_MAP */
345 809
346#ifndef xlate_dev_kmem_ptr 810#ifndef xlate_dev_kmem_ptr
347#define xlate_dev_kmem_ptr(p) p 811#define xlate_dev_kmem_ptr xlate_dev_kmem_ptr
812static inline void *xlate_dev_kmem_ptr(void *addr)
813{
814 return addr;
815}
348#endif 816#endif
817
349#ifndef xlate_dev_mem_ptr 818#ifndef xlate_dev_mem_ptr
350#define xlate_dev_mem_ptr(p) __va(p) 819#define xlate_dev_mem_ptr xlate_dev_mem_ptr
820static inline void *xlate_dev_mem_ptr(phys_addr_t addr)
821{
822 return __va(addr);
823}
824#endif
825
826#ifndef unxlate_dev_mem_ptr
827#define unxlate_dev_mem_ptr unxlate_dev_mem_ptr
828static inline void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
829{
830}
351#endif 831#endif
352 832
353#ifdef CONFIG_VIRT_TO_BUS 833#ifdef CONFIG_VIRT_TO_BUS
354#ifndef virt_to_bus 834#ifndef virt_to_bus
355static inline unsigned long virt_to_bus(volatile void *address) 835static inline unsigned long virt_to_bus(void *address)
356{ 836{
357 return ((unsigned long) address); 837 return (unsigned long)address;
358} 838}
359 839
360static inline void *bus_to_virt(unsigned long address) 840static inline void *bus_to_virt(unsigned long address)
361{ 841{
362 return (void *) address; 842 return (void *)address;
363} 843}
364#endif 844#endif
365#endif 845#endif
366 846
367#ifndef memset_io 847#ifndef memset_io
368#define memset_io(a, b, c) memset(__io_virt(a), (b), (c)) 848#define memset_io memset_io
849static inline void memset_io(volatile void __iomem *addr, int value,
850 size_t size)
851{
852 memset(__io_virt(addr), value, size);
853}
369#endif 854#endif
370 855
371#ifndef memcpy_fromio 856#ifndef memcpy_fromio
372#define memcpy_fromio(a, b, c) memcpy((a), __io_virt(b), (c)) 857#define memcpy_fromio memcpy_fromio
858static inline void memcpy_fromio(void *buffer,
859 const volatile void __iomem *addr,
860 size_t size)
861{
862 memcpy(buffer, __io_virt(addr), size);
863}
373#endif 864#endif
865
374#ifndef memcpy_toio 866#ifndef memcpy_toio
375#define memcpy_toio(a, b, c) memcpy(__io_virt(a), (b), (c)) 867#define memcpy_toio memcpy_toio
868static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer,
869 size_t size)
870{
871 memcpy(__io_virt(addr), buffer, size);
872}
376#endif 873#endif
377 874
378#endif /* __KERNEL__ */ 875#endif /* __KERNEL__ */
diff --git a/include/asm-generic/mm_hooks.h b/include/asm-generic/mm_hooks.h
index 67dea8123683..866aa461efa5 100644
--- a/include/asm-generic/mm_hooks.h
+++ b/include/asm-generic/mm_hooks.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Define generic no-op hooks for arch_dup_mmap and arch_exit_mmap, to 2 * Define generic no-op hooks for arch_dup_mmap, arch_exit_mmap
3 * be included in asm-FOO/mmu_context.h for any arch FOO which doesn't 3 * and arch_unmap to be included in asm-FOO/mmu_context.h for any
4 * need to hook these. 4 * arch FOO which doesn't need to hook these.
5 */ 5 */
6#ifndef _ASM_GENERIC_MM_HOOKS_H 6#ifndef _ASM_GENERIC_MM_HOOKS_H
7#define _ASM_GENERIC_MM_HOOKS_H 7#define _ASM_GENERIC_MM_HOOKS_H
@@ -15,4 +15,15 @@ static inline void arch_exit_mmap(struct mm_struct *mm)
15{ 15{
16} 16}
17 17
18static inline void arch_unmap(struct mm_struct *mm,
19 struct vm_area_struct *vma,
20 unsigned long start, unsigned long end)
21{
22}
23
24static inline void arch_bprm_mm_init(struct mm_struct *mm,
25 struct vm_area_struct *vma)
26{
27}
28
18#endif /* _ASM_GENERIC_MM_HOOKS_H */ 29#endif /* _ASM_GENERIC_MM_HOOKS_H */
diff --git a/include/asm-generic/msi.h b/include/asm-generic/msi.h
new file mode 100644
index 000000000000..61c58d8878ce
--- /dev/null
+++ b/include/asm-generic/msi.h
@@ -0,0 +1,32 @@
1#ifndef __ASM_GENERIC_MSI_H
2#define __ASM_GENERIC_MSI_H
3
4#include <linux/types.h>
5
6#ifndef NUM_MSI_ALLOC_SCRATCHPAD_REGS
7# define NUM_MSI_ALLOC_SCRATCHPAD_REGS 2
8#endif
9
10struct msi_desc;
11
12/**
13 * struct msi_alloc_info - Default structure for MSI interrupt allocation.
14 * @desc: Pointer to msi descriptor
15 * @hwirq: Associated hw interrupt number in the domain
16 * @scratchpad: Storage for implementation specific scratch data
17 *
18 * Architectures can provide their own implementation by not including
19 * asm-generic/msi.h into their arch specific header file.
20 */
21typedef struct msi_alloc_info {
22 struct msi_desc *desc;
23 irq_hw_number_t hwirq;
24 union {
25 unsigned long ul;
26 void *ptr;
27 } scratchpad[NUM_MSI_ALLOC_SCRATCHPAD_REGS];
28} msi_alloc_info_t;
29
30#define GENERIC_MSI_DOMAIN_OPS 1
31
32#endif
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 752e30d63904..177d5973b132 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -103,6 +103,17 @@ static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
103#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 103#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
104#endif 104#endif
105 105
106#ifndef __HAVE_ARCH_PMDP_GET_AND_CLEAR_FULL
107#ifdef CONFIG_TRANSPARENT_HUGEPAGE
108static inline pmd_t pmdp_get_and_clear_full(struct mm_struct *mm,
109 unsigned long address, pmd_t *pmdp,
110 int full)
111{
112 return pmdp_get_and_clear(mm, address, pmdp);
113}
114#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
115#endif
116
106#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL 117#ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
107static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, 118static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
108 unsigned long address, pte_t *ptep, 119 unsigned long address, pte_t *ptep,
diff --git a/include/asm-generic/preempt.h b/include/asm-generic/preempt.h
index 1cd3f5d767a8..eb6f9e6c3075 100644
--- a/include/asm-generic/preempt.h
+++ b/include/asm-generic/preempt.h
@@ -23,9 +23,6 @@ static __always_inline void preempt_count_set(int pc)
23/* 23/*
24 * must be macros to avoid header recursion hell 24 * must be macros to avoid header recursion hell
25 */ 25 */
26#define task_preempt_count(p) \
27 (task_thread_info(p)->preempt_count & ~PREEMPT_NEED_RESCHED)
28
29#define init_task_preempt_count(p) do { \ 26#define init_task_preempt_count(p) do { \
30 task_thread_info(p)->preempt_count = PREEMPT_DISABLED; \ 27 task_thread_info(p)->preempt_count = PREEMPT_DISABLED; \
31} while (0) 28} while (0)
diff --git a/include/asm-generic/seccomp.h b/include/asm-generic/seccomp.h
new file mode 100644
index 000000000000..9fa1f653ed3b
--- /dev/null
+++ b/include/asm-generic/seccomp.h
@@ -0,0 +1,30 @@
1/*
2 * include/asm-generic/seccomp.h
3 *
4 * Copyright (C) 2014 Linaro Limited
5 * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef _ASM_GENERIC_SECCOMP_H
12#define _ASM_GENERIC_SECCOMP_H
13
14#include <linux/unistd.h>
15
16#if defined(CONFIG_COMPAT) && !defined(__NR_seccomp_read_32)
17#define __NR_seccomp_read_32 __NR_read
18#define __NR_seccomp_write_32 __NR_write
19#define __NR_seccomp_exit_32 __NR_exit
20#define __NR_seccomp_sigreturn_32 __NR_rt_sigreturn
21#endif /* CONFIG_COMPAT && ! already defined */
22
23#define __NR_seccomp_read __NR_read
24#define __NR_seccomp_write __NR_write
25#define __NR_seccomp_exit __NR_exit
26#ifndef __NR_seccomp_sigreturn
27#define __NR_seccomp_sigreturn __NR_rt_sigreturn
28#endif
29
30#endif /* _ASM_GENERIC_SECCOMP_H */
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index 5672d7ea1fa0..08848050922e 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -96,10 +96,9 @@ struct mmu_gather {
96#endif 96#endif
97 unsigned long start; 97 unsigned long start;
98 unsigned long end; 98 unsigned long end;
99 unsigned int need_flush : 1, /* Did free PTEs */
100 /* we are in the middle of an operation to clear 99 /* we are in the middle of an operation to clear
101 * a full mm and can make some optimizations */ 100 * a full mm and can make some optimizations */
102 fullmm : 1, 101 unsigned int fullmm : 1,
103 /* we have performed an operation which 102 /* we have performed an operation which
104 * requires a complete flush of the tlb */ 103 * requires a complete flush of the tlb */
105 need_flush_all : 1; 104 need_flush_all : 1;
@@ -128,16 +127,54 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
128 tlb_flush_mmu(tlb); 127 tlb_flush_mmu(tlb);
129} 128}
130 129
130static inline void __tlb_adjust_range(struct mmu_gather *tlb,
131 unsigned long address)
132{
133 tlb->start = min(tlb->start, address);
134 tlb->end = max(tlb->end, address + PAGE_SIZE);
135}
136
137static inline void __tlb_reset_range(struct mmu_gather *tlb)
138{
139 tlb->start = TASK_SIZE;
140 tlb->end = 0;
141}
142
143/*
144 * In the case of tlb vma handling, we can optimise these away in the
145 * case where we're doing a full MM flush. When we're doing a munmap,
146 * the vmas are adjusted to only cover the region to be torn down.
147 */
148#ifndef tlb_start_vma
149#define tlb_start_vma(tlb, vma) do { } while (0)
150#endif
151
152#define __tlb_end_vma(tlb, vma) \
153 do { \
154 if (!tlb->fullmm && tlb->end) { \
155 tlb_flush(tlb); \
156 __tlb_reset_range(tlb); \
157 } \
158 } while (0)
159
160#ifndef tlb_end_vma
161#define tlb_end_vma __tlb_end_vma
162#endif
163
164#ifndef __tlb_remove_tlb_entry
165#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
166#endif
167
131/** 168/**
132 * tlb_remove_tlb_entry - remember a pte unmapping for later tlb invalidation. 169 * tlb_remove_tlb_entry - remember a pte unmapping for later tlb invalidation.
133 * 170 *
134 * Record the fact that pte's were really umapped in ->need_flush, so we can 171 * Record the fact that pte's were really unmapped by updating the range,
135 * later optimise away the tlb invalidate. This helps when userspace is 172 * so we can later optimise away the tlb invalidate. This helps when
136 * unmapping already-unmapped pages, which happens quite a lot. 173 * userspace is unmapping already-unmapped pages, which happens quite a lot.
137 */ 174 */
138#define tlb_remove_tlb_entry(tlb, ptep, address) \ 175#define tlb_remove_tlb_entry(tlb, ptep, address) \
139 do { \ 176 do { \
140 tlb->need_flush = 1; \ 177 __tlb_adjust_range(tlb, address); \
141 __tlb_remove_tlb_entry(tlb, ptep, address); \ 178 __tlb_remove_tlb_entry(tlb, ptep, address); \
142 } while (0) 179 } while (0)
143 180
@@ -151,27 +188,27 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
151 188
152#define tlb_remove_pmd_tlb_entry(tlb, pmdp, address) \ 189#define tlb_remove_pmd_tlb_entry(tlb, pmdp, address) \
153 do { \ 190 do { \
154 tlb->need_flush = 1; \ 191 __tlb_adjust_range(tlb, address); \
155 __tlb_remove_pmd_tlb_entry(tlb, pmdp, address); \ 192 __tlb_remove_pmd_tlb_entry(tlb, pmdp, address); \
156 } while (0) 193 } while (0)
157 194
158#define pte_free_tlb(tlb, ptep, address) \ 195#define pte_free_tlb(tlb, ptep, address) \
159 do { \ 196 do { \
160 tlb->need_flush = 1; \ 197 __tlb_adjust_range(tlb, address); \
161 __pte_free_tlb(tlb, ptep, address); \ 198 __pte_free_tlb(tlb, ptep, address); \
162 } while (0) 199 } while (0)
163 200
164#ifndef __ARCH_HAS_4LEVEL_HACK 201#ifndef __ARCH_HAS_4LEVEL_HACK
165#define pud_free_tlb(tlb, pudp, address) \ 202#define pud_free_tlb(tlb, pudp, address) \
166 do { \ 203 do { \
167 tlb->need_flush = 1; \ 204 __tlb_adjust_range(tlb, address); \
168 __pud_free_tlb(tlb, pudp, address); \ 205 __pud_free_tlb(tlb, pudp, address); \
169 } while (0) 206 } while (0)
170#endif 207#endif
171 208
172#define pmd_free_tlb(tlb, pmdp, address) \ 209#define pmd_free_tlb(tlb, pmdp, address) \
173 do { \ 210 do { \
174 tlb->need_flush = 1; \ 211 __tlb_adjust_range(tlb, address); \
175 __pmd_free_tlb(tlb, pmdp, address); \ 212 __pmd_free_tlb(tlb, pmdp, address); \
176 } while (0) 213 } while (0)
177 214
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index 74b13ec1ebd4..98abda9ed3aa 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -17,6 +17,32 @@
17 17
18struct crypto_ahash; 18struct crypto_ahash;
19 19
20/**
21 * DOC: Message Digest Algorithm Definitions
22 *
23 * These data structures define modular message digest algorithm
24 * implementations, managed via crypto_register_ahash(),
25 * crypto_register_shash(), crypto_unregister_ahash() and
26 * crypto_unregister_shash().
27 */
28
29/**
30 * struct hash_alg_common - define properties of message digest
31 * @digestsize: Size of the result of the transformation. A buffer of this size
32 * must be available to the @final and @finup calls, so they can
33 * store the resulting hash into it. For various predefined sizes,
34 * search include/crypto/ using
35 * git grep _DIGEST_SIZE include/crypto.
36 * @statesize: Size of the block for partial state of the transformation. A
37 * buffer of this size must be passed to the @export function as it
38 * will save the partial state of the transformation into it. On the
39 * other side, the @import function will load the state from a
40 * buffer of this size as well.
41 * @base: Start of data structure of cipher algorithm. The common data
42 * structure of crypto_alg contains information common to all ciphers.
43 * The hash_alg_common data structure now adds the hash-specific
44 * information.
45 */
20struct hash_alg_common { 46struct hash_alg_common {
21 unsigned int digestsize; 47 unsigned int digestsize;
22 unsigned int statesize; 48 unsigned int statesize;
@@ -37,6 +63,63 @@ struct ahash_request {
37 void *__ctx[] CRYPTO_MINALIGN_ATTR; 63 void *__ctx[] CRYPTO_MINALIGN_ATTR;
38}; 64};
39 65
66/**
67 * struct ahash_alg - asynchronous message digest definition
68 * @init: Initialize the transformation context. Intended only to initialize the
69 * state of the HASH transformation at the begining. This shall fill in
70 * the internal structures used during the entire duration of the whole
71 * transformation. No data processing happens at this point.
72 * @update: Push a chunk of data into the driver for transformation. This
73 * function actually pushes blocks of data from upper layers into the
74 * driver, which then passes those to the hardware as seen fit. This
75 * function must not finalize the HASH transformation by calculating the
76 * final message digest as this only adds more data into the
77 * transformation. This function shall not modify the transformation
78 * context, as this function may be called in parallel with the same
79 * transformation object. Data processing can happen synchronously
80 * [SHASH] or asynchronously [AHASH] at this point.
81 * @final: Retrieve result from the driver. This function finalizes the
82 * transformation and retrieves the resulting hash from the driver and
83 * pushes it back to upper layers. No data processing happens at this
84 * point.
85 * @finup: Combination of @update and @final. This function is effectively a
86 * combination of @update and @final calls issued in sequence. As some
87 * hardware cannot do @update and @final separately, this callback was
88 * added to allow such hardware to be used at least by IPsec. Data
89 * processing can happen synchronously [SHASH] or asynchronously [AHASH]
90 * at this point.
91 * @digest: Combination of @init and @update and @final. This function
92 * effectively behaves as the entire chain of operations, @init,
93 * @update and @final issued in sequence. Just like @finup, this was
94 * added for hardware which cannot do even the @finup, but can only do
95 * the whole transformation in one run. Data processing can happen
96 * synchronously [SHASH] or asynchronously [AHASH] at this point.
97 * @setkey: Set optional key used by the hashing algorithm. Intended to push
98 * optional key used by the hashing algorithm from upper layers into
99 * the driver. This function can store the key in the transformation
100 * context or can outright program it into the hardware. In the former
101 * case, one must be careful to program the key into the hardware at
102 * appropriate time and one must be careful that .setkey() can be
103 * called multiple times during the existence of the transformation
104 * object. Not all hashing algorithms do implement this function as it
105 * is only needed for keyed message digests. SHAx/MDx/CRCx do NOT
106 * implement this function. HMAC(MDx)/HMAC(SHAx)/CMAC(AES) do implement
107 * this function. This function must be called before any other of the
108 * @init, @update, @final, @finup, @digest is called. No data
109 * processing happens at this point.
110 * @export: Export partial state of the transformation. This function dumps the
111 * entire state of the ongoing transformation into a provided block of
112 * data so it can be @import 'ed back later on. This is useful in case
113 * you want to save partial result of the transformation after
114 * processing certain amount of data and reload this partial result
115 * multiple times later on for multiple re-use. No data processing
116 * happens at this point.
117 * @import: Import partial state of the transformation. This function loads the
118 * entire state of the ongoing transformation from a provided block of
119 * data so the transformation can continue from this point onward. No
120 * data processing happens at this point.
121 * @halg: see struct hash_alg_common
122 */
40struct ahash_alg { 123struct ahash_alg {
41 int (*init)(struct ahash_request *req); 124 int (*init)(struct ahash_request *req);
42 int (*update)(struct ahash_request *req); 125 int (*update)(struct ahash_request *req);
@@ -63,6 +146,23 @@ struct shash_desc {
63 crypto_shash_descsize(ctx)] CRYPTO_MINALIGN_ATTR; \ 146 crypto_shash_descsize(ctx)] CRYPTO_MINALIGN_ATTR; \
64 struct shash_desc *shash = (struct shash_desc *)__##shash##_desc 147 struct shash_desc *shash = (struct shash_desc *)__##shash##_desc
65 148
149/**
150 * struct shash_alg - synchronous message digest definition
151 * @init: see struct ahash_alg
152 * @update: see struct ahash_alg
153 * @final: see struct ahash_alg
154 * @finup: see struct ahash_alg
155 * @digest: see struct ahash_alg
156 * @export: see struct ahash_alg
157 * @import: see struct ahash_alg
158 * @setkey: see struct ahash_alg
159 * @digestsize: see struct ahash_alg
160 * @statesize: see struct ahash_alg
161 * @descsize: Size of the operational state for the message digest. This state
162 * size is the memory size that needs to be allocated for
163 * shash_desc.__ctx
164 * @base: internally used
165 */
66struct shash_alg { 166struct shash_alg {
67 int (*init)(struct shash_desc *desc); 167 int (*init)(struct shash_desc *desc);
68 int (*update)(struct shash_desc *desc, const u8 *data, 168 int (*update)(struct shash_desc *desc, const u8 *data,
@@ -107,11 +207,35 @@ struct crypto_shash {
107 struct crypto_tfm base; 207 struct crypto_tfm base;
108}; 208};
109 209
210/**
211 * DOC: Asynchronous Message Digest API
212 *
213 * The asynchronous message digest API is used with the ciphers of type
214 * CRYPTO_ALG_TYPE_AHASH (listed as type "ahash" in /proc/crypto)
215 *
216 * The asynchronous cipher operation discussion provided for the
217 * CRYPTO_ALG_TYPE_ABLKCIPHER API applies here as well.
218 */
219
110static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm) 220static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm)
111{ 221{
112 return container_of(tfm, struct crypto_ahash, base); 222 return container_of(tfm, struct crypto_ahash, base);
113} 223}
114 224
225/**
226 * crypto_alloc_ahash() - allocate ahash cipher handle
227 * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
228 * ahash cipher
229 * @type: specifies the type of the cipher
230 * @mask: specifies the mask for the cipher
231 *
232 * Allocate a cipher handle for an ahash. The returned struct
233 * crypto_ahash is the cipher handle that is required for any subsequent
234 * API invocation for that ahash.
235 *
236 * Return: allocated cipher handle in case of success; IS_ERR() is true in case
237 * of an error, PTR_ERR() returns the error code.
238 */
115struct crypto_ahash *crypto_alloc_ahash(const char *alg_name, u32 type, 239struct crypto_ahash *crypto_alloc_ahash(const char *alg_name, u32 type,
116 u32 mask); 240 u32 mask);
117 241
@@ -120,6 +244,10 @@ static inline struct crypto_tfm *crypto_ahash_tfm(struct crypto_ahash *tfm)
120 return &tfm->base; 244 return &tfm->base;
121} 245}
122 246
247/**
248 * crypto_free_ahash() - zeroize and free the ahash handle
249 * @tfm: cipher handle to be freed
250 */
123static inline void crypto_free_ahash(struct crypto_ahash *tfm) 251static inline void crypto_free_ahash(struct crypto_ahash *tfm)
124{ 252{
125 crypto_destroy_tfm(tfm, crypto_ahash_tfm(tfm)); 253 crypto_destroy_tfm(tfm, crypto_ahash_tfm(tfm));
@@ -143,6 +271,16 @@ static inline struct hash_alg_common *crypto_hash_alg_common(
143 return __crypto_hash_alg_common(crypto_ahash_tfm(tfm)->__crt_alg); 271 return __crypto_hash_alg_common(crypto_ahash_tfm(tfm)->__crt_alg);
144} 272}
145 273
274/**
275 * crypto_ahash_digestsize() - obtain message digest size
276 * @tfm: cipher handle
277 *
278 * The size for the message digest created by the message digest cipher
279 * referenced with the cipher handle is returned.
280 *
281 *
282 * Return: message digest size of cipher
283 */
146static inline unsigned int crypto_ahash_digestsize(struct crypto_ahash *tfm) 284static inline unsigned int crypto_ahash_digestsize(struct crypto_ahash *tfm)
147{ 285{
148 return crypto_hash_alg_common(tfm)->digestsize; 286 return crypto_hash_alg_common(tfm)->digestsize;
@@ -168,12 +306,32 @@ static inline void crypto_ahash_clear_flags(struct crypto_ahash *tfm, u32 flags)
168 crypto_tfm_clear_flags(crypto_ahash_tfm(tfm), flags); 306 crypto_tfm_clear_flags(crypto_ahash_tfm(tfm), flags);
169} 307}
170 308
309/**
310 * crypto_ahash_reqtfm() - obtain cipher handle from request
311 * @req: asynchronous request handle that contains the reference to the ahash
312 * cipher handle
313 *
314 * Return the ahash cipher handle that is registered with the asynchronous
315 * request handle ahash_request.
316 *
317 * Return: ahash cipher handle
318 */
171static inline struct crypto_ahash *crypto_ahash_reqtfm( 319static inline struct crypto_ahash *crypto_ahash_reqtfm(
172 struct ahash_request *req) 320 struct ahash_request *req)
173{ 321{
174 return __crypto_ahash_cast(req->base.tfm); 322 return __crypto_ahash_cast(req->base.tfm);
175} 323}
176 324
325/**
326 * crypto_ahash_reqsize() - obtain size of the request data structure
327 * @tfm: cipher handle
328 *
329 * Return the size of the ahash state size. With the crypto_ahash_export
330 * function, the caller can export the state into a buffer whose size is
331 * defined with this function.
332 *
333 * Return: size of the ahash state
334 */
177static inline unsigned int crypto_ahash_reqsize(struct crypto_ahash *tfm) 335static inline unsigned int crypto_ahash_reqsize(struct crypto_ahash *tfm)
178{ 336{
179 return tfm->reqsize; 337 return tfm->reqsize;
@@ -184,38 +342,166 @@ static inline void *ahash_request_ctx(struct ahash_request *req)
184 return req->__ctx; 342 return req->__ctx;
185} 343}
186 344
345/**
346 * crypto_ahash_setkey - set key for cipher handle
347 * @tfm: cipher handle
348 * @key: buffer holding the key
349 * @keylen: length of the key in bytes
350 *
351 * The caller provided key is set for the ahash cipher. The cipher
352 * handle must point to a keyed hash in order for this function to succeed.
353 *
354 * Return: 0 if the setting of the key was successful; < 0 if an error occurred
355 */
187int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key, 356int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key,
188 unsigned int keylen); 357 unsigned int keylen);
358
359/**
360 * crypto_ahash_finup() - update and finalize message digest
361 * @req: reference to the ahash_request handle that holds all information
362 * needed to perform the cipher operation
363 *
364 * This function is a "short-hand" for the function calls of
365 * crypto_ahash_update and crypto_shash_final. The parameters have the same
366 * meaning as discussed for those separate functions.
367 *
368 * Return: 0 if the message digest creation was successful; < 0 if an error
369 * occurred
370 */
189int crypto_ahash_finup(struct ahash_request *req); 371int crypto_ahash_finup(struct ahash_request *req);
372
373/**
374 * crypto_ahash_final() - calculate message digest
375 * @req: reference to the ahash_request handle that holds all information
376 * needed to perform the cipher operation
377 *
378 * Finalize the message digest operation and create the message digest
379 * based on all data added to the cipher handle. The message digest is placed
380 * into the output buffer registered with the ahash_request handle.
381 *
382 * Return: 0 if the message digest creation was successful; < 0 if an error
383 * occurred
384 */
190int crypto_ahash_final(struct ahash_request *req); 385int crypto_ahash_final(struct ahash_request *req);
386
387/**
388 * crypto_ahash_digest() - calculate message digest for a buffer
389 * @req: reference to the ahash_request handle that holds all information
390 * needed to perform the cipher operation
391 *
392 * This function is a "short-hand" for the function calls of crypto_ahash_init,
393 * crypto_ahash_update and crypto_ahash_final. The parameters have the same
394 * meaning as discussed for those separate three functions.
395 *
396 * Return: 0 if the message digest creation was successful; < 0 if an error
397 * occurred
398 */
191int crypto_ahash_digest(struct ahash_request *req); 399int crypto_ahash_digest(struct ahash_request *req);
192 400
401/**
402 * crypto_ahash_export() - extract current message digest state
403 * @req: reference to the ahash_request handle whose state is exported
404 * @out: output buffer of sufficient size that can hold the hash state
405 *
406 * This function exports the hash state of the ahash_request handle into the
407 * caller-allocated output buffer out which must have sufficient size (e.g. by
408 * calling crypto_ahash_reqsize).
409 *
410 * Return: 0 if the export was successful; < 0 if an error occurred
411 */
193static inline int crypto_ahash_export(struct ahash_request *req, void *out) 412static inline int crypto_ahash_export(struct ahash_request *req, void *out)
194{ 413{
195 return crypto_ahash_reqtfm(req)->export(req, out); 414 return crypto_ahash_reqtfm(req)->export(req, out);
196} 415}
197 416
417/**
418 * crypto_ahash_import() - import message digest state
419 * @req: reference to ahash_request handle the state is imported into
420 * @in: buffer holding the state
421 *
422 * This function imports the hash state into the ahash_request handle from the
423 * input buffer. That buffer should have been generated with the
424 * crypto_ahash_export function.
425 *
426 * Return: 0 if the import was successful; < 0 if an error occurred
427 */
198static inline int crypto_ahash_import(struct ahash_request *req, const void *in) 428static inline int crypto_ahash_import(struct ahash_request *req, const void *in)
199{ 429{
200 return crypto_ahash_reqtfm(req)->import(req, in); 430 return crypto_ahash_reqtfm(req)->import(req, in);
201} 431}
202 432
433/**
434 * crypto_ahash_init() - (re)initialize message digest handle
435 * @req: ahash_request handle that already is initialized with all necessary
436 * data using the ahash_request_* API functions
437 *
438 * The call (re-)initializes the message digest referenced by the ahash_request
439 * handle. Any potentially existing state created by previous operations is
440 * discarded.
441 *
442 * Return: 0 if the message digest initialization was successful; < 0 if an
443 * error occurred
444 */
203static inline int crypto_ahash_init(struct ahash_request *req) 445static inline int crypto_ahash_init(struct ahash_request *req)
204{ 446{
205 return crypto_ahash_reqtfm(req)->init(req); 447 return crypto_ahash_reqtfm(req)->init(req);
206} 448}
207 449
450/**
451 * crypto_ahash_update() - add data to message digest for processing
452 * @req: ahash_request handle that was previously initialized with the
453 * crypto_ahash_init call.
454 *
455 * Updates the message digest state of the &ahash_request handle. The input data
456 * is pointed to by the scatter/gather list registered in the &ahash_request
457 * handle
458 *
459 * Return: 0 if the message digest update was successful; < 0 if an error
460 * occurred
461 */
208static inline int crypto_ahash_update(struct ahash_request *req) 462static inline int crypto_ahash_update(struct ahash_request *req)
209{ 463{
210 return crypto_ahash_reqtfm(req)->update(req); 464 return crypto_ahash_reqtfm(req)->update(req);
211} 465}
212 466
467/**
468 * DOC: Asynchronous Hash Request Handle
469 *
470 * The &ahash_request data structure contains all pointers to data
471 * required for the asynchronous cipher operation. This includes the cipher
472 * handle (which can be used by multiple &ahash_request instances), pointer
473 * to plaintext and the message digest output buffer, asynchronous callback
474 * function, etc. It acts as a handle to the ahash_request_* API calls in a
475 * similar way as ahash handle to the crypto_ahash_* API calls.
476 */
477
478/**
479 * ahash_request_set_tfm() - update cipher handle reference in request
480 * @req: request handle to be modified
481 * @tfm: cipher handle that shall be added to the request handle
482 *
483 * Allow the caller to replace the existing ahash handle in the request
484 * data structure with a different one.
485 */
213static inline void ahash_request_set_tfm(struct ahash_request *req, 486static inline void ahash_request_set_tfm(struct ahash_request *req,
214 struct crypto_ahash *tfm) 487 struct crypto_ahash *tfm)
215{ 488{
216 req->base.tfm = crypto_ahash_tfm(tfm); 489 req->base.tfm = crypto_ahash_tfm(tfm);
217} 490}
218 491
492/**
493 * ahash_request_alloc() - allocate request data structure
494 * @tfm: cipher handle to be registered with the request
495 * @gfp: memory allocation flag that is handed to kmalloc by the API call.
496 *
497 * Allocate the request data structure that must be used with the ahash
498 * message digest API calls. During
499 * the allocation, the provided ahash handle
500 * is registered in the request data structure.
501 *
502 * Return: allocated request handle in case of success; IS_ERR() is true in case
503 * of an error, PTR_ERR() returns the error code.
504 */
219static inline struct ahash_request *ahash_request_alloc( 505static inline struct ahash_request *ahash_request_alloc(
220 struct crypto_ahash *tfm, gfp_t gfp) 506 struct crypto_ahash *tfm, gfp_t gfp)
221{ 507{
@@ -230,6 +516,10 @@ static inline struct ahash_request *ahash_request_alloc(
230 return req; 516 return req;
231} 517}
232 518
519/**
520 * ahash_request_free() - zeroize and free the request data structure
521 * @req: request data structure cipher handle to be freed
522 */
233static inline void ahash_request_free(struct ahash_request *req) 523static inline void ahash_request_free(struct ahash_request *req)
234{ 524{
235 kzfree(req); 525 kzfree(req);
@@ -241,6 +531,31 @@ static inline struct ahash_request *ahash_request_cast(
241 return container_of(req, struct ahash_request, base); 531 return container_of(req, struct ahash_request, base);
242} 532}
243 533
534/**
535 * ahash_request_set_callback() - set asynchronous callback function
536 * @req: request handle
537 * @flags: specify zero or an ORing of the flags
538 * CRYPTO_TFM_REQ_MAY_BACKLOG the request queue may back log and
539 * increase the wait queue beyond the initial maximum size;
540 * CRYPTO_TFM_REQ_MAY_SLEEP the request processing may sleep
541 * @compl: callback function pointer to be registered with the request handle
542 * @data: The data pointer refers to memory that is not used by the kernel
543 * crypto API, but provided to the callback function for it to use. Here,
544 * the caller can provide a reference to memory the callback function can
545 * operate on. As the callback function is invoked asynchronously to the
546 * related functionality, it may need to access data structures of the
547 * related functionality which can be referenced using this pointer. The
548 * callback function can access the memory via the "data" field in the
549 * &crypto_async_request data structure provided to the callback function.
550 *
551 * This function allows setting the callback function that is triggered once
552 * the cipher operation completes.
553 *
554 * The callback function is registered with the &ahash_request handle and
555 * must comply with the following template
556 *
557 * void callback_function(struct crypto_async_request *req, int error)
558 */
244static inline void ahash_request_set_callback(struct ahash_request *req, 559static inline void ahash_request_set_callback(struct ahash_request *req,
245 u32 flags, 560 u32 flags,
246 crypto_completion_t compl, 561 crypto_completion_t compl,
@@ -251,6 +566,19 @@ static inline void ahash_request_set_callback(struct ahash_request *req,
251 req->base.flags = flags; 566 req->base.flags = flags;
252} 567}
253 568
569/**
570 * ahash_request_set_crypt() - set data buffers
571 * @req: ahash_request handle to be updated
572 * @src: source scatter/gather list
573 * @result: buffer that is filled with the message digest -- the caller must
574 * ensure that the buffer has sufficient space by, for example, calling
575 * crypto_ahash_digestsize()
576 * @nbytes: number of bytes to process from the source scatter/gather list
577 *
578 * By using this call, the caller references the source scatter/gather list.
579 * The source scatter/gather list points to the data the message digest is to
580 * be calculated for.
581 */
254static inline void ahash_request_set_crypt(struct ahash_request *req, 582static inline void ahash_request_set_crypt(struct ahash_request *req,
255 struct scatterlist *src, u8 *result, 583 struct scatterlist *src, u8 *result,
256 unsigned int nbytes) 584 unsigned int nbytes)
@@ -260,6 +588,33 @@ static inline void ahash_request_set_crypt(struct ahash_request *req,
260 req->result = result; 588 req->result = result;
261} 589}
262 590
591/**
592 * DOC: Synchronous Message Digest API
593 *
594 * The synchronous message digest API is used with the ciphers of type
595 * CRYPTO_ALG_TYPE_SHASH (listed as type "shash" in /proc/crypto)
596 *
597 * The message digest API is able to maintain state information for the
598 * caller.
599 *
600 * The synchronous message digest API can store user-related context in in its
601 * shash_desc request data structure.
602 */
603
604/**
605 * crypto_alloc_shash() - allocate message digest handle
606 * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
607 * message digest cipher
608 * @type: specifies the type of the cipher
609 * @mask: specifies the mask for the cipher
610 *
611 * Allocate a cipher handle for a message digest. The returned &struct
612 * crypto_shash is the cipher handle that is required for any subsequent
613 * API invocation for that message digest.
614 *
615 * Return: allocated cipher handle in case of success; IS_ERR() is true in case
616 * of an error, PTR_ERR() returns the error code.
617 */
263struct crypto_shash *crypto_alloc_shash(const char *alg_name, u32 type, 618struct crypto_shash *crypto_alloc_shash(const char *alg_name, u32 type,
264 u32 mask); 619 u32 mask);
265 620
@@ -268,6 +623,10 @@ static inline struct crypto_tfm *crypto_shash_tfm(struct crypto_shash *tfm)
268 return &tfm->base; 623 return &tfm->base;
269} 624}
270 625
626/**
627 * crypto_free_shash() - zeroize and free the message digest handle
628 * @tfm: cipher handle to be freed
629 */
271static inline void crypto_free_shash(struct crypto_shash *tfm) 630static inline void crypto_free_shash(struct crypto_shash *tfm)
272{ 631{
273 crypto_destroy_tfm(tfm, crypto_shash_tfm(tfm)); 632 crypto_destroy_tfm(tfm, crypto_shash_tfm(tfm));
@@ -279,6 +638,15 @@ static inline unsigned int crypto_shash_alignmask(
279 return crypto_tfm_alg_alignmask(crypto_shash_tfm(tfm)); 638 return crypto_tfm_alg_alignmask(crypto_shash_tfm(tfm));
280} 639}
281 640
641/**
642 * crypto_shash_blocksize() - obtain block size for cipher
643 * @tfm: cipher handle
644 *
645 * The block size for the message digest cipher referenced with the cipher
646 * handle is returned.
647 *
648 * Return: block size of cipher
649 */
282static inline unsigned int crypto_shash_blocksize(struct crypto_shash *tfm) 650static inline unsigned int crypto_shash_blocksize(struct crypto_shash *tfm)
283{ 651{
284 return crypto_tfm_alg_blocksize(crypto_shash_tfm(tfm)); 652 return crypto_tfm_alg_blocksize(crypto_shash_tfm(tfm));
@@ -294,6 +662,15 @@ static inline struct shash_alg *crypto_shash_alg(struct crypto_shash *tfm)
294 return __crypto_shash_alg(crypto_shash_tfm(tfm)->__crt_alg); 662 return __crypto_shash_alg(crypto_shash_tfm(tfm)->__crt_alg);
295} 663}
296 664
665/**
666 * crypto_shash_digestsize() - obtain message digest size
667 * @tfm: cipher handle
668 *
669 * The size for the message digest created by the message digest cipher
670 * referenced with the cipher handle is returned.
671 *
672 * Return: digest size of cipher
673 */
297static inline unsigned int crypto_shash_digestsize(struct crypto_shash *tfm) 674static inline unsigned int crypto_shash_digestsize(struct crypto_shash *tfm)
298{ 675{
299 return crypto_shash_alg(tfm)->digestsize; 676 return crypto_shash_alg(tfm)->digestsize;
@@ -319,6 +696,21 @@ static inline void crypto_shash_clear_flags(struct crypto_shash *tfm, u32 flags)
319 crypto_tfm_clear_flags(crypto_shash_tfm(tfm), flags); 696 crypto_tfm_clear_flags(crypto_shash_tfm(tfm), flags);
320} 697}
321 698
699/**
700 * crypto_shash_descsize() - obtain the operational state size
701 * @tfm: cipher handle
702 *
703 * The size of the operational state the cipher needs during operation is
704 * returned for the hash referenced with the cipher handle. This size is
705 * required to calculate the memory requirements to allow the caller allocating
706 * sufficient memory for operational state.
707 *
708 * The operational state is defined with struct shash_desc where the size of
709 * that data structure is to be calculated as
710 * sizeof(struct shash_desc) + crypto_shash_descsize(alg)
711 *
712 * Return: size of the operational state
713 */
322static inline unsigned int crypto_shash_descsize(struct crypto_shash *tfm) 714static inline unsigned int crypto_shash_descsize(struct crypto_shash *tfm)
323{ 715{
324 return tfm->descsize; 716 return tfm->descsize;
@@ -329,29 +721,129 @@ static inline void *shash_desc_ctx(struct shash_desc *desc)
329 return desc->__ctx; 721 return desc->__ctx;
330} 722}
331 723
724/**
725 * crypto_shash_setkey() - set key for message digest
726 * @tfm: cipher handle
727 * @key: buffer holding the key
728 * @keylen: length of the key in bytes
729 *
730 * The caller provided key is set for the keyed message digest cipher. The
731 * cipher handle must point to a keyed message digest cipher in order for this
732 * function to succeed.
733 *
734 * Return: 0 if the setting of the key was successful; < 0 if an error occurred
735 */
332int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key, 736int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key,
333 unsigned int keylen); 737 unsigned int keylen);
738
739/**
740 * crypto_shash_digest() - calculate message digest for buffer
741 * @desc: see crypto_shash_final()
742 * @data: see crypto_shash_update()
743 * @len: see crypto_shash_update()
744 * @out: see crypto_shash_final()
745 *
746 * This function is a "short-hand" for the function calls of crypto_shash_init,
747 * crypto_shash_update and crypto_shash_final. The parameters have the same
748 * meaning as discussed for those separate three functions.
749 *
750 * Return: 0 if the message digest creation was successful; < 0 if an error
751 * occurred
752 */
334int crypto_shash_digest(struct shash_desc *desc, const u8 *data, 753int crypto_shash_digest(struct shash_desc *desc, const u8 *data,
335 unsigned int len, u8 *out); 754 unsigned int len, u8 *out);
336 755
756/**
757 * crypto_shash_export() - extract operational state for message digest
758 * @desc: reference to the operational state handle whose state is exported
759 * @out: output buffer of sufficient size that can hold the hash state
760 *
761 * This function exports the hash state of the operational state handle into the
762 * caller-allocated output buffer out which must have sufficient size (e.g. by
763 * calling crypto_shash_descsize).
764 *
765 * Return: 0 if the export creation was successful; < 0 if an error occurred
766 */
337static inline int crypto_shash_export(struct shash_desc *desc, void *out) 767static inline int crypto_shash_export(struct shash_desc *desc, void *out)
338{ 768{
339 return crypto_shash_alg(desc->tfm)->export(desc, out); 769 return crypto_shash_alg(desc->tfm)->export(desc, out);
340} 770}
341 771
772/**
773 * crypto_shash_import() - import operational state
774 * @desc: reference to the operational state handle the state imported into
775 * @in: buffer holding the state
776 *
777 * This function imports the hash state into the operational state handle from
778 * the input buffer. That buffer should have been generated with the
779 * crypto_ahash_export function.
780 *
781 * Return: 0 if the import was successful; < 0 if an error occurred
782 */
342static inline int crypto_shash_import(struct shash_desc *desc, const void *in) 783static inline int crypto_shash_import(struct shash_desc *desc, const void *in)
343{ 784{
344 return crypto_shash_alg(desc->tfm)->import(desc, in); 785 return crypto_shash_alg(desc->tfm)->import(desc, in);
345} 786}
346 787
788/**
789 * crypto_shash_init() - (re)initialize message digest
790 * @desc: operational state handle that is already filled
791 *
792 * The call (re-)initializes the message digest referenced by the
793 * operational state handle. Any potentially existing state created by
794 * previous operations is discarded.
795 *
796 * Return: 0 if the message digest initialization was successful; < 0 if an
797 * error occurred
798 */
347static inline int crypto_shash_init(struct shash_desc *desc) 799static inline int crypto_shash_init(struct shash_desc *desc)
348{ 800{
349 return crypto_shash_alg(desc->tfm)->init(desc); 801 return crypto_shash_alg(desc->tfm)->init(desc);
350} 802}
351 803
804/**
805 * crypto_shash_update() - add data to message digest for processing
806 * @desc: operational state handle that is already initialized
807 * @data: input data to be added to the message digest
808 * @len: length of the input data
809 *
810 * Updates the message digest state of the operational state handle.
811 *
812 * Return: 0 if the message digest update was successful; < 0 if an error
813 * occurred
814 */
352int crypto_shash_update(struct shash_desc *desc, const u8 *data, 815int crypto_shash_update(struct shash_desc *desc, const u8 *data,
353 unsigned int len); 816 unsigned int len);
817
818/**
819 * crypto_shash_final() - calculate message digest
820 * @desc: operational state handle that is already filled with data
821 * @out: output buffer filled with the message digest
822 *
823 * Finalize the message digest operation and create the message digest
824 * based on all data added to the cipher handle. The message digest is placed
825 * into the output buffer. The caller must ensure that the output buffer is
826 * large enough by using crypto_shash_digestsize.
827 *
828 * Return: 0 if the message digest creation was successful; < 0 if an error
829 * occurred
830 */
354int crypto_shash_final(struct shash_desc *desc, u8 *out); 831int crypto_shash_final(struct shash_desc *desc, u8 *out);
832
833/**
834 * crypto_shash_finup() - calculate message digest of buffer
835 * @desc: see crypto_shash_final()
836 * @data: see crypto_shash_update()
837 * @len: see crypto_shash_update()
838 * @out: see crypto_shash_final()
839 *
840 * This function is a "short-hand" for the function calls of
841 * crypto_shash_update and crypto_shash_final. The parameters have the same
842 * meaning as discussed for those separate functions.
843 *
844 * Return: 0 if the message digest creation was successful; < 0 if an error
845 * occurred
846 */
355int crypto_shash_finup(struct shash_desc *desc, const u8 *data, 847int crypto_shash_finup(struct shash_desc *desc, const u8 *data,
356 unsigned int len, u8 *out); 848 unsigned int len, u8 *out);
357 849
diff --git a/include/crypto/if_alg.h b/include/crypto/if_alg.h
index d61c11170213..cd62bf4289e9 100644
--- a/include/crypto/if_alg.h
+++ b/include/crypto/if_alg.h
@@ -42,6 +42,7 @@ struct af_alg_completion {
42struct af_alg_control { 42struct af_alg_control {
43 struct af_alg_iv *iv; 43 struct af_alg_iv *iv;
44 int op; 44 int op;
45 unsigned int aead_assoclen;
45}; 46};
46 47
47struct af_alg_type { 48struct af_alg_type {
diff --git a/include/crypto/rng.h b/include/crypto/rng.h
index c93f9b917925..a16fb10142bf 100644
--- a/include/crypto/rng.h
+++ b/include/crypto/rng.h
@@ -20,11 +20,38 @@ extern struct crypto_rng *crypto_default_rng;
20int crypto_get_default_rng(void); 20int crypto_get_default_rng(void);
21void crypto_put_default_rng(void); 21void crypto_put_default_rng(void);
22 22
23/**
24 * DOC: Random number generator API
25 *
26 * The random number generator API is used with the ciphers of type
27 * CRYPTO_ALG_TYPE_RNG (listed as type "rng" in /proc/crypto)
28 */
29
23static inline struct crypto_rng *__crypto_rng_cast(struct crypto_tfm *tfm) 30static inline struct crypto_rng *__crypto_rng_cast(struct crypto_tfm *tfm)
24{ 31{
25 return (struct crypto_rng *)tfm; 32 return (struct crypto_rng *)tfm;
26} 33}
27 34
35/**
36 * crypto_alloc_rng() -- allocate RNG handle
37 * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
38 * message digest cipher
39 * @type: specifies the type of the cipher
40 * @mask: specifies the mask for the cipher
41 *
42 * Allocate a cipher handle for a random number generator. The returned struct
43 * crypto_rng is the cipher handle that is required for any subsequent
44 * API invocation for that random number generator.
45 *
46 * For all random number generators, this call creates a new private copy of
47 * the random number generator that does not share a state with other
48 * instances. The only exception is the "krng" random number generator which
49 * is a kernel crypto API use case for the get_random_bytes() function of the
50 * /dev/random driver.
51 *
52 * Return: allocated cipher handle in case of success; IS_ERR() is true in case
53 * of an error, PTR_ERR() returns the error code.
54 */
28static inline struct crypto_rng *crypto_alloc_rng(const char *alg_name, 55static inline struct crypto_rng *crypto_alloc_rng(const char *alg_name,
29 u32 type, u32 mask) 56 u32 type, u32 mask)
30{ 57{
@@ -40,6 +67,14 @@ static inline struct crypto_tfm *crypto_rng_tfm(struct crypto_rng *tfm)
40 return &tfm->base; 67 return &tfm->base;
41} 68}
42 69
70/**
71 * crypto_rng_alg - obtain name of RNG
72 * @tfm: cipher handle
73 *
74 * Return the generic name (cra_name) of the initialized random number generator
75 *
76 * Return: generic name string
77 */
43static inline struct rng_alg *crypto_rng_alg(struct crypto_rng *tfm) 78static inline struct rng_alg *crypto_rng_alg(struct crypto_rng *tfm)
44{ 79{
45 return &crypto_rng_tfm(tfm)->__crt_alg->cra_rng; 80 return &crypto_rng_tfm(tfm)->__crt_alg->cra_rng;
@@ -50,23 +85,68 @@ static inline struct rng_tfm *crypto_rng_crt(struct crypto_rng *tfm)
50 return &crypto_rng_tfm(tfm)->crt_rng; 85 return &crypto_rng_tfm(tfm)->crt_rng;
51} 86}
52 87
88/**
89 * crypto_free_rng() - zeroize and free RNG handle
90 * @tfm: cipher handle to be freed
91 */
53static inline void crypto_free_rng(struct crypto_rng *tfm) 92static inline void crypto_free_rng(struct crypto_rng *tfm)
54{ 93{
55 crypto_free_tfm(crypto_rng_tfm(tfm)); 94 crypto_free_tfm(crypto_rng_tfm(tfm));
56} 95}
57 96
97/**
98 * crypto_rng_get_bytes() - get random number
99 * @tfm: cipher handle
100 * @rdata: output buffer holding the random numbers
101 * @dlen: length of the output buffer
102 *
103 * This function fills the caller-allocated buffer with random numbers using the
104 * random number generator referenced by the cipher handle.
105 *
106 * Return: > 0 function was successful and returns the number of generated
107 * bytes; < 0 if an error occurred
108 */
58static inline int crypto_rng_get_bytes(struct crypto_rng *tfm, 109static inline int crypto_rng_get_bytes(struct crypto_rng *tfm,
59 u8 *rdata, unsigned int dlen) 110 u8 *rdata, unsigned int dlen)
60{ 111{
61 return crypto_rng_crt(tfm)->rng_gen_random(tfm, rdata, dlen); 112 return crypto_rng_crt(tfm)->rng_gen_random(tfm, rdata, dlen);
62} 113}
63 114
115/**
116 * crypto_rng_reset() - re-initialize the RNG
117 * @tfm: cipher handle
118 * @seed: seed input data
119 * @slen: length of the seed input data
120 *
121 * The reset function completely re-initializes the random number generator
122 * referenced by the cipher handle by clearing the current state. The new state
123 * is initialized with the caller provided seed or automatically, depending
124 * on the random number generator type (the ANSI X9.31 RNG requires
125 * caller-provided seed, the SP800-90A DRBGs perform an automatic seeding).
126 * The seed is provided as a parameter to this function call. The provided seed
127 * should have the length of the seed size defined for the random number
128 * generator as defined by crypto_rng_seedsize.
129 *
130 * Return: 0 if the setting of the key was successful; < 0 if an error occurred
131 */
64static inline int crypto_rng_reset(struct crypto_rng *tfm, 132static inline int crypto_rng_reset(struct crypto_rng *tfm,
65 u8 *seed, unsigned int slen) 133 u8 *seed, unsigned int slen)
66{ 134{
67 return crypto_rng_crt(tfm)->rng_reset(tfm, seed, slen); 135 return crypto_rng_crt(tfm)->rng_reset(tfm, seed, slen);
68} 136}
69 137
138/**
139 * crypto_rng_seedsize() - obtain seed size of RNG
140 * @tfm: cipher handle
141 *
142 * The function returns the seed size for the random number generator
143 * referenced by the cipher handle. This value may be zero if the random
144 * number generator does not implement or require a reseeding. For example,
145 * the SP800-90A DRBGs implement an automated reseeding after reaching a
146 * pre-defined threshold.
147 *
148 * Return: seed size for the random number generator
149 */
70static inline int crypto_rng_seedsize(struct crypto_rng *tfm) 150static inline int crypto_rng_seedsize(struct crypto_rng *tfm)
71{ 151{
72 return crypto_rng_alg(tfm)->seedsize; 152 return crypto_rng_alg(tfm)->seedsize;
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 53ed87698a74..8ba35c622e22 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -125,8 +125,8 @@ struct dma_buf_attachment;
125extern __printf(2, 3) 125extern __printf(2, 3)
126void drm_ut_debug_printk(const char *function_name, 126void drm_ut_debug_printk(const char *function_name,
127 const char *format, ...); 127 const char *format, ...);
128extern __printf(2, 3) 128extern __printf(1, 2)
129void drm_err(const char *func, const char *format, ...); 129void drm_err(const char *format, ...);
130 130
131/***********************************************************************/ 131/***********************************************************************/
132/** \name DRM template customization defaults */ 132/** \name DRM template customization defaults */
@@ -155,7 +155,7 @@ void drm_err(const char *func, const char *format, ...);
155 * \param arg arguments 155 * \param arg arguments
156 */ 156 */
157#define DRM_ERROR(fmt, ...) \ 157#define DRM_ERROR(fmt, ...) \
158 drm_err(__func__, fmt, ##__VA_ARGS__) 158 drm_err(fmt, ##__VA_ARGS__)
159 159
160/** 160/**
161 * Rate limited error output. Like DRM_ERROR() but won't flood the log. 161 * Rate limited error output. Like DRM_ERROR() but won't flood the log.
@@ -170,7 +170,7 @@ void drm_err(const char *func, const char *format, ...);
170 DEFAULT_RATELIMIT_BURST); \ 170 DEFAULT_RATELIMIT_BURST); \
171 \ 171 \
172 if (__ratelimit(&_rs)) \ 172 if (__ratelimit(&_rs)) \
173 drm_err(__func__, fmt, ##__VA_ARGS__); \ 173 drm_err(fmt, ##__VA_ARGS__); \
174}) 174})
175 175
176#define DRM_INFO(fmt, ...) \ 176#define DRM_INFO(fmt, ...) \
@@ -809,7 +809,7 @@ struct drm_device {
809 struct drm_local_map *agp_buffer_map; 809 struct drm_local_map *agp_buffer_map;
810 unsigned int agp_buffer_token; 810 unsigned int agp_buffer_token;
811 811
812 struct drm_mode_config mode_config; /**< Current mode config */ 812 struct drm_mode_config mode_config; /**< Current mode config */
813 813
814 /** \name GEM information */ 814 /** \name GEM information */
815 /*@{ */ 815 /*@{ */
@@ -986,7 +986,7 @@ extern void drm_gem_dmabuf_release(struct dma_buf *dma_buf);
986 986
987extern int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages, 987extern int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
988 dma_addr_t *addrs, int max_pages); 988 dma_addr_t *addrs, int max_pages);
989extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages); 989extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, unsigned int nr_pages);
990extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg); 990extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg);
991 991
992 992
@@ -1028,10 +1028,25 @@ void drm_pci_agp_destroy(struct drm_device *dev);
1028 1028
1029extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver); 1029extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
1030extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver); 1030extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
1031#ifdef CONFIG_PCI
1031extern int drm_get_pci_dev(struct pci_dev *pdev, 1032extern int drm_get_pci_dev(struct pci_dev *pdev,
1032 const struct pci_device_id *ent, 1033 const struct pci_device_id *ent,
1033 struct drm_driver *driver); 1034 struct drm_driver *driver);
1034extern int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master); 1035extern int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master);
1036#else
1037static inline int drm_get_pci_dev(struct pci_dev *pdev,
1038 const struct pci_device_id *ent,
1039 struct drm_driver *driver)
1040{
1041 return -ENOSYS;
1042}
1043
1044static inline int drm_pci_set_busid(struct drm_device *dev,
1045 struct drm_master *master)
1046{
1047 return -ENOSYS;
1048}
1049#endif
1035 1050
1036#define DRM_PCIE_SPEED_25 1 1051#define DRM_PCIE_SPEED_25 1
1037#define DRM_PCIE_SPEED_50 2 1052#define DRM_PCIE_SPEED_50 2
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
new file mode 100644
index 000000000000..ad2229574dd9
--- /dev/null
+++ b/include/drm/drm_atomic.h
@@ -0,0 +1,69 @@
1/*
2 * Copyright (C) 2014 Red Hat
3 * Copyright (C) 2014 Intel Corp.
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 * Authors:
24 * Rob Clark <robdclark@gmail.com>
25 * Daniel Vetter <daniel.vetter@ffwll.ch>
26 */
27
28#ifndef DRM_ATOMIC_H_
29#define DRM_ATOMIC_H_
30
31#include <drm/drm_crtc.h>
32
33struct drm_atomic_state * __must_check
34drm_atomic_state_alloc(struct drm_device *dev);
35void drm_atomic_state_clear(struct drm_atomic_state *state);
36void drm_atomic_state_free(struct drm_atomic_state *state);
37
38struct drm_crtc_state * __must_check
39drm_atomic_get_crtc_state(struct drm_atomic_state *state,
40 struct drm_crtc *crtc);
41struct drm_plane_state * __must_check
42drm_atomic_get_plane_state(struct drm_atomic_state *state,
43 struct drm_plane *plane);
44struct drm_connector_state * __must_check
45drm_atomic_get_connector_state(struct drm_atomic_state *state,
46 struct drm_connector *connector);
47
48int __must_check
49drm_atomic_set_crtc_for_plane(struct drm_atomic_state *state,
50 struct drm_plane *plane, struct drm_crtc *crtc);
51void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
52 struct drm_framebuffer *fb);
53int __must_check
54drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
55 struct drm_crtc *crtc);
56int __must_check
57drm_atomic_add_affected_connectors(struct drm_atomic_state *state,
58 struct drm_crtc *crtc);
59int
60drm_atomic_connectors_for_crtc(struct drm_atomic_state *state,
61 struct drm_crtc *crtc);
62
63void drm_atomic_legacy_backoff(struct drm_atomic_state *state);
64
65int __must_check drm_atomic_check_only(struct drm_atomic_state *state);
66int __must_check drm_atomic_commit(struct drm_atomic_state *state);
67int __must_check drm_atomic_async_commit(struct drm_atomic_state *state);
68
69#endif /* DRM_ATOMIC_H_ */
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
new file mode 100644
index 000000000000..f956b413311e
--- /dev/null
+++ b/include/drm/drm_atomic_helper.h
@@ -0,0 +1,126 @@
1/*
2 * Copyright (C) 2014 Red Hat
3 * Copyright (C) 2014 Intel Corp.
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 * Authors:
24 * Rob Clark <robdclark@gmail.com>
25 * Daniel Vetter <daniel.vetter@ffwll.ch>
26 */
27
28#ifndef DRM_ATOMIC_HELPER_H_
29#define DRM_ATOMIC_HELPER_H_
30
31#include <drm/drm_crtc.h>
32
33int drm_atomic_helper_check(struct drm_device *dev,
34 struct drm_atomic_state *state);
35int drm_atomic_helper_commit(struct drm_device *dev,
36 struct drm_atomic_state *state,
37 bool async);
38
39void drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
40 struct drm_atomic_state *old_state);
41
42void drm_atomic_helper_commit_pre_planes(struct drm_device *dev,
43 struct drm_atomic_state *state);
44void drm_atomic_helper_commit_post_planes(struct drm_device *dev,
45 struct drm_atomic_state *old_state);
46
47int drm_atomic_helper_prepare_planes(struct drm_device *dev,
48 struct drm_atomic_state *state);
49void drm_atomic_helper_commit_planes(struct drm_device *dev,
50 struct drm_atomic_state *state);
51void drm_atomic_helper_cleanup_planes(struct drm_device *dev,
52 struct drm_atomic_state *old_state);
53
54void drm_atomic_helper_swap_state(struct drm_device *dev,
55 struct drm_atomic_state *state);
56
57/* implementations for legacy interfaces */
58int drm_atomic_helper_update_plane(struct drm_plane *plane,
59 struct drm_crtc *crtc,
60 struct drm_framebuffer *fb,
61 int crtc_x, int crtc_y,
62 unsigned int crtc_w, unsigned int crtc_h,
63 uint32_t src_x, uint32_t src_y,
64 uint32_t src_w, uint32_t src_h);
65int drm_atomic_helper_disable_plane(struct drm_plane *plane);
66int drm_atomic_helper_set_config(struct drm_mode_set *set);
67
68int drm_atomic_helper_crtc_set_property(struct drm_crtc *crtc,
69 struct drm_property *property,
70 uint64_t val);
71int drm_atomic_helper_plane_set_property(struct drm_plane *plane,
72 struct drm_property *property,
73 uint64_t val);
74int drm_atomic_helper_connector_set_property(struct drm_connector *connector,
75 struct drm_property *property,
76 uint64_t val);
77int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
78 struct drm_framebuffer *fb,
79 struct drm_pending_vblank_event *event,
80 uint32_t flags);
81
82/* default implementations for state handling */
83void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc);
84struct drm_crtc_state *
85drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc);
86void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
87 struct drm_crtc_state *state);
88
89void drm_atomic_helper_plane_reset(struct drm_plane *plane);
90struct drm_plane_state *
91drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane);
92void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
93 struct drm_plane_state *state);
94
95void drm_atomic_helper_connector_reset(struct drm_connector *connector);
96struct drm_connector_state *
97drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector);
98void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector,
99 struct drm_connector_state *state);
100
101/**
102 * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC
103 * @plane: the loop cursor
104 * @crtc: the crtc whose planes are iterated
105 *
106 * This iterates over the current state, useful (for example) when applying
107 * atomic state after it has been checked and swapped. To iterate over the
108 * planes which *will* be attached (for ->atomic_check()) see
109 * drm_crtc_for_each_pending_plane()
110 */
111#define drm_atomic_crtc_for_each_plane(plane, crtc) \
112 drm_for_each_plane_mask(plane, (crtc)->dev, (crtc)->state->plane_mask)
113
114/**
115 * drm_crtc_atomic_state_for_each_plane - iterate over attached planes in new state
116 * @plane: the loop cursor
117 * @crtc_state: the incoming crtc-state
118 *
119 * Similar to drm_crtc_for_each_plane(), but iterates the planes that will be
120 * attached if the specified state is applied. Useful during (for example)
121 * ->atomic_check() operations, to validate the incoming state
122 */
123#define drm_atomic_crtc_state_for_each_plane(plane, crtc_state) \
124 drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask)
125
126#endif /* DRM_ATOMIC_HELPER_H_ */
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index c40070a92d6b..b86329813ad3 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -42,6 +42,7 @@ struct drm_object_properties;
42struct drm_file; 42struct drm_file;
43struct drm_clip_rect; 43struct drm_clip_rect;
44struct device_node; 44struct device_node;
45struct fence;
45 46
46#define DRM_MODE_OBJECT_CRTC 0xcccccccc 47#define DRM_MODE_OBJECT_CRTC 0xcccccccc
47#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 48#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
@@ -136,14 +137,22 @@ struct drm_display_info {
136 u8 cea_rev; 137 u8 cea_rev;
137}; 138};
138 139
140/* data corresponds to displayid vend/prod/serial */
141struct drm_tile_group {
142 struct kref refcount;
143 struct drm_device *dev;
144 int id;
145 u8 group_data[8];
146};
147
139struct drm_framebuffer_funcs { 148struct drm_framebuffer_funcs {
140 /* note: use drm_framebuffer_remove() */ 149 /* note: use drm_framebuffer_remove() */
141 void (*destroy)(struct drm_framebuffer *framebuffer); 150 void (*destroy)(struct drm_framebuffer *framebuffer);
142 int (*create_handle)(struct drm_framebuffer *fb, 151 int (*create_handle)(struct drm_framebuffer *fb,
143 struct drm_file *file_priv, 152 struct drm_file *file_priv,
144 unsigned int *handle); 153 unsigned int *handle);
145 /** 154 /*
146 * Optinal callback for the dirty fb ioctl. 155 * Optional callback for the dirty fb ioctl.
147 * 156 *
148 * Userspace can notify the driver via this callback 157 * Userspace can notify the driver via this callback
149 * that a area of the framebuffer has changed and should 158 * that a area of the framebuffer has changed and should
@@ -196,7 +205,7 @@ struct drm_framebuffer {
196struct drm_property_blob { 205struct drm_property_blob {
197 struct drm_mode_object base; 206 struct drm_mode_object base;
198 struct list_head head; 207 struct list_head head;
199 unsigned int length; 208 size_t length;
200 unsigned char data[]; 209 unsigned char data[];
201}; 210};
202 211
@@ -215,7 +224,7 @@ struct drm_property {
215 uint64_t *values; 224 uint64_t *values;
216 struct drm_device *dev; 225 struct drm_device *dev;
217 226
218 struct list_head enum_blob_list; 227 struct list_head enum_list;
219}; 228};
220 229
221struct drm_crtc; 230struct drm_crtc;
@@ -224,19 +233,65 @@ struct drm_encoder;
224struct drm_pending_vblank_event; 233struct drm_pending_vblank_event;
225struct drm_plane; 234struct drm_plane;
226struct drm_bridge; 235struct drm_bridge;
236struct drm_atomic_state;
227 237
228/** 238/**
229 * drm_crtc_funcs - control CRTCs for a given device 239 * struct drm_crtc_state - mutable CRTC state
240 * @enable: whether the CRTC should be enabled, gates all other state
241 * @mode_changed: for use by helpers and drivers when computing state updates
242 * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
243 * @last_vblank_count: for helpers and drivers to capture the vblank of the
244 * update to ensure framebuffer cleanup isn't done too early
245 * @planes_changed: for use by helpers and drivers when computing state updates
246 * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings
247 * @mode: current mode timings
248 * @event: optional pointer to a DRM event to signal upon completion of the
249 * state update
250 * @state: backpointer to global drm_atomic_state
251 */
252struct drm_crtc_state {
253 bool enable;
254
255 /* computed state bits used by helpers and drivers */
256 bool planes_changed : 1;
257 bool mode_changed : 1;
258
259 /* attached planes bitmask:
260 * WARNING: transitional helpers do not maintain plane_mask so
261 * drivers not converted over to atomic helpers should not rely
262 * on plane_mask being accurate!
263 */
264 u32 plane_mask;
265
266 /* last_vblank_count: for vblank waits before cleanup */
267 u32 last_vblank_count;
268
269 /* adjusted_mode: for use by helpers and drivers */
270 struct drm_display_mode adjusted_mode;
271
272 struct drm_display_mode mode;
273
274 struct drm_pending_vblank_event *event;
275
276 struct drm_atomic_state *state;
277};
278
279/**
280 * struct drm_crtc_funcs - control CRTCs for a given device
230 * @save: save CRTC state 281 * @save: save CRTC state
231 * @restore: restore CRTC state 282 * @restore: restore CRTC state
232 * @reset: reset CRTC after state has been invalidated (e.g. resume) 283 * @reset: reset CRTC after state has been invalidated (e.g. resume)
233 * @cursor_set: setup the cursor 284 * @cursor_set: setup the cursor
285 * @cursor_set2: setup the cursor with hotspot, superseeds @cursor_set if set
234 * @cursor_move: move the cursor 286 * @cursor_move: move the cursor
235 * @gamma_set: specify color ramp for CRTC 287 * @gamma_set: specify color ramp for CRTC
236 * @destroy: deinit and free object 288 * @destroy: deinit and free object
237 * @set_property: called when a property is changed 289 * @set_property: called when a property is changed
238 * @set_config: apply a new CRTC configuration 290 * @set_config: apply a new CRTC configuration
239 * @page_flip: initiate a page flip 291 * @page_flip: initiate a page flip
292 * @atomic_duplicate_state: duplicate the atomic state for this CRTC
293 * @atomic_destroy_state: destroy an atomic state for this CRTC
294 * @atomic_set_property: set a property on an atomic state for this CRTC
240 * 295 *
241 * The drm_crtc_funcs structure is the central CRTC management structure 296 * The drm_crtc_funcs structure is the central CRTC management structure
242 * in the DRM. Each CRTC controls one or more connectors (note that the name 297 * in the DRM. Each CRTC controls one or more connectors (note that the name
@@ -287,16 +342,28 @@ struct drm_crtc_funcs {
287 342
288 int (*set_property)(struct drm_crtc *crtc, 343 int (*set_property)(struct drm_crtc *crtc,
289 struct drm_property *property, uint64_t val); 344 struct drm_property *property, uint64_t val);
345
346 /* atomic update handling */
347 struct drm_crtc_state *(*atomic_duplicate_state)(struct drm_crtc *crtc);
348 void (*atomic_destroy_state)(struct drm_crtc *crtc,
349 struct drm_crtc_state *state);
350 int (*atomic_set_property)(struct drm_crtc *crtc,
351 struct drm_crtc_state *state,
352 struct drm_property *property,
353 uint64_t val);
290}; 354};
291 355
292/** 356/**
293 * drm_crtc - central CRTC control structure 357 * struct drm_crtc - central CRTC control structure
294 * @dev: parent DRM device 358 * @dev: parent DRM device
359 * @port: OF node used by drm_of_find_possible_crtcs()
295 * @head: list management 360 * @head: list management
296 * @mutex: per-CRTC locking 361 * @mutex: per-CRTC locking
297 * @base: base KMS object for ID tracking etc. 362 * @base: base KMS object for ID tracking etc.
298 * @primary: primary plane for this CRTC 363 * @primary: primary plane for this CRTC
299 * @cursor: cursor plane for this CRTC 364 * @cursor: cursor plane for this CRTC
365 * @cursor_x: current x position of the cursor, used for universal cursor planes
366 * @cursor_y: current y position of the cursor, used for universal cursor planes
300 * @enabled: is this CRTC enabled? 367 * @enabled: is this CRTC enabled?
301 * @mode: current mode timings 368 * @mode: current mode timings
302 * @hwmode: mode timings as programmed to hw regs 369 * @hwmode: mode timings as programmed to hw regs
@@ -309,10 +376,13 @@ struct drm_crtc_funcs {
309 * @gamma_size: size of gamma ramp 376 * @gamma_size: size of gamma ramp
310 * @gamma_store: gamma ramp values 377 * @gamma_store: gamma ramp values
311 * @framedur_ns: precise frame timing 378 * @framedur_ns: precise frame timing
312 * @framedur_ns: precise line timing 379 * @linedur_ns: precise line timing
313 * @pixeldur_ns: precise pixel timing 380 * @pixeldur_ns: precise pixel timing
314 * @helper_private: mid-layer private data 381 * @helper_private: mid-layer private data
315 * @properties: property tracking for this CRTC 382 * @properties: property tracking for this CRTC
383 * @state: current atomic state for this CRTC
384 * @acquire_ctx: per-CRTC implicit acquire context used by atomic drivers for
385 * legacy ioctls
316 * 386 *
317 * Each CRTC may have one or more connectors associated with it. This structure 387 * Each CRTC may have one or more connectors associated with it. This structure
318 * allows the CRTC to be controlled. 388 * allows the CRTC to be controlled.
@@ -322,7 +392,7 @@ struct drm_crtc {
322 struct device_node *port; 392 struct device_node *port;
323 struct list_head head; 393 struct list_head head;
324 394
325 /** 395 /*
326 * crtc mutex 396 * crtc mutex
327 * 397 *
328 * This provides a read lock for the overall crtc state (mode, dpms 398 * This provides a read lock for the overall crtc state (mode, dpms
@@ -368,6 +438,8 @@ struct drm_crtc {
368 438
369 struct drm_object_properties properties; 439 struct drm_object_properties properties;
370 440
441 struct drm_crtc_state *state;
442
371 /* 443 /*
372 * For legacy crtc ioctls so that atomic drivers can get at the locking 444 * For legacy crtc ioctls so that atomic drivers can get at the locking
373 * acquire context. 445 * acquire context.
@@ -375,9 +447,22 @@ struct drm_crtc {
375 struct drm_modeset_acquire_ctx *acquire_ctx; 447 struct drm_modeset_acquire_ctx *acquire_ctx;
376}; 448};
377 449
450/**
451 * struct drm_connector_state - mutable connector state
452 * @crtc: CRTC to connect connector to, NULL if disabled
453 * @best_encoder: can be used by helpers and drivers to select the encoder
454 * @state: backpointer to global drm_atomic_state
455 */
456struct drm_connector_state {
457 struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_connector() */
458
459 struct drm_encoder *best_encoder;
460
461 struct drm_atomic_state *state;
462};
378 463
379/** 464/**
380 * drm_connector_funcs - control connectors on a given device 465 * struct drm_connector_funcs - control connectors on a given device
381 * @dpms: set power state (see drm_crtc_funcs above) 466 * @dpms: set power state (see drm_crtc_funcs above)
382 * @save: save connector state 467 * @save: save connector state
383 * @restore: restore connector state 468 * @restore: restore connector state
@@ -387,6 +472,9 @@ struct drm_crtc {
387 * @set_property: property for this connector may need an update 472 * @set_property: property for this connector may need an update
388 * @destroy: make object go away 473 * @destroy: make object go away
389 * @force: notify the driver that the connector is forced on 474 * @force: notify the driver that the connector is forced on
475 * @atomic_duplicate_state: duplicate the atomic state for this connector
476 * @atomic_destroy_state: destroy an atomic state for this connector
477 * @atomic_set_property: set a property on an atomic state for this connector
390 * 478 *
391 * Each CRTC may have one or more connectors attached to it. The functions 479 * Each CRTC may have one or more connectors attached to it. The functions
392 * below allow the core DRM code to control connectors, enumerate available modes, 480 * below allow the core DRM code to control connectors, enumerate available modes,
@@ -411,10 +499,19 @@ struct drm_connector_funcs {
411 uint64_t val); 499 uint64_t val);
412 void (*destroy)(struct drm_connector *connector); 500 void (*destroy)(struct drm_connector *connector);
413 void (*force)(struct drm_connector *connector); 501 void (*force)(struct drm_connector *connector);
502
503 /* atomic update handling */
504 struct drm_connector_state *(*atomic_duplicate_state)(struct drm_connector *connector);
505 void (*atomic_destroy_state)(struct drm_connector *connector,
506 struct drm_connector_state *state);
507 int (*atomic_set_property)(struct drm_connector *connector,
508 struct drm_connector_state *state,
509 struct drm_property *property,
510 uint64_t val);
414}; 511};
415 512
416/** 513/**
417 * drm_encoder_funcs - encoder controls 514 * struct drm_encoder_funcs - encoder controls
418 * @reset: reset state (e.g. at init or resume time) 515 * @reset: reset state (e.g. at init or resume time)
419 * @destroy: cleanup and free associated data 516 * @destroy: cleanup and free associated data
420 * 517 *
@@ -428,7 +525,7 @@ struct drm_encoder_funcs {
428#define DRM_CONNECTOR_MAX_ENCODER 3 525#define DRM_CONNECTOR_MAX_ENCODER 3
429 526
430/** 527/**
431 * drm_encoder - central DRM encoder structure 528 * struct drm_encoder - central DRM encoder structure
432 * @dev: parent DRM device 529 * @dev: parent DRM device
433 * @head: list management 530 * @head: list management
434 * @base: base KMS object 531 * @base: base KMS object
@@ -472,7 +569,7 @@ struct drm_encoder {
472#define MAX_ELD_BYTES 128 569#define MAX_ELD_BYTES 128
473 570
474/** 571/**
475 * drm_connector - central DRM connector control structure 572 * struct drm_connector - central DRM connector control structure
476 * @dev: parent DRM device 573 * @dev: parent DRM device
477 * @kdev: kernel device for sysfs attributes 574 * @kdev: kernel device for sysfs attributes
478 * @attr: sysfs attributes 575 * @attr: sysfs attributes
@@ -483,6 +580,7 @@ struct drm_encoder {
483 * @connector_type_id: index into connector type enum 580 * @connector_type_id: index into connector type enum
484 * @interlace_allowed: can this connector handle interlaced modes? 581 * @interlace_allowed: can this connector handle interlaced modes?
485 * @doublescan_allowed: can this connector handle doublescan? 582 * @doublescan_allowed: can this connector handle doublescan?
583 * @stereo_allowed: can this connector handle stereo modes?
486 * @modes: modes available on this connector (from fill_modes() + user) 584 * @modes: modes available on this connector (from fill_modes() + user)
487 * @status: one of the drm_connector_status enums (connected, not, or unknown) 585 * @status: one of the drm_connector_status enums (connected, not, or unknown)
488 * @probed_modes: list of modes derived directly from the display 586 * @probed_modes: list of modes derived directly from the display
@@ -490,10 +588,13 @@ struct drm_encoder {
490 * @funcs: connector control functions 588 * @funcs: connector control functions
491 * @edid_blob_ptr: DRM property containing EDID if present 589 * @edid_blob_ptr: DRM property containing EDID if present
492 * @properties: property tracking for this connector 590 * @properties: property tracking for this connector
591 * @path_blob_ptr: DRM blob property data for the DP MST path property
493 * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling 592 * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling
494 * @dpms: current dpms state 593 * @dpms: current dpms state
495 * @helper_private: mid-layer private data 594 * @helper_private: mid-layer private data
595 * @cmdline_mode: mode line parsed from the kernel cmdline for this connector
496 * @force: a %DRM_FORCE_<foo> state for forced mode sets 596 * @force: a %DRM_FORCE_<foo> state for forced mode sets
597 * @override_edid: has the EDID been overwritten through debugfs for testing?
497 * @encoder_ids: valid encoders for this connector 598 * @encoder_ids: valid encoders for this connector
498 * @encoder: encoder driving this connector, if any 599 * @encoder: encoder driving this connector, if any
499 * @eld: EDID-like data, if present 600 * @eld: EDID-like data, if present
@@ -503,6 +604,18 @@ struct drm_encoder {
503 * @video_latency: video latency info from ELD, if found 604 * @video_latency: video latency info from ELD, if found
504 * @audio_latency: audio latency info from ELD, if found 605 * @audio_latency: audio latency info from ELD, if found
505 * @null_edid_counter: track sinks that give us all zeros for the EDID 606 * @null_edid_counter: track sinks that give us all zeros for the EDID
607 * @bad_edid_counter: track sinks that give us an EDID with invalid checksum
608 * @debugfs_entry: debugfs directory for this connector
609 * @state: current atomic state for this connector
610 * @has_tile: is this connector connected to a tiled monitor
611 * @tile_group: tile group for the connected monitor
612 * @tile_is_single_monitor: whether the tile is one monitor housing
613 * @num_h_tile: number of horizontal tiles in the tile group
614 * @num_v_tile: number of vertical tiles in the tile group
615 * @tile_h_loc: horizontal location of this tile
616 * @tile_v_loc: vertical location of this tile
617 * @tile_h_size: horizontal size of this tile.
618 * @tile_v_size: vertical size of this tile.
506 * 619 *
507 * Each connector may be connected to one or more CRTCs, or may be clonable by 620 * Each connector may be connected to one or more CRTCs, or may be clonable by
508 * another connector if they can share a CRTC. Each connector also has a specific 621 * another connector if they can share a CRTC. Each connector also has a specific
@@ -538,6 +651,8 @@ struct drm_connector {
538 651
539 struct drm_property_blob *path_blob_ptr; 652 struct drm_property_blob *path_blob_ptr;
540 653
654 struct drm_property_blob *tile_blob_ptr;
655
541 uint8_t polled; /* DRM_CONNECTOR_POLL_* */ 656 uint8_t polled; /* DRM_CONNECTOR_POLL_* */
542 657
543 /* requested DPMS state */ 658 /* requested DPMS state */
@@ -563,14 +678,63 @@ struct drm_connector {
563 unsigned bad_edid_counter; 678 unsigned bad_edid_counter;
564 679
565 struct dentry *debugfs_entry; 680 struct dentry *debugfs_entry;
681
682 struct drm_connector_state *state;
683
684 /* DisplayID bits */
685 bool has_tile;
686 struct drm_tile_group *tile_group;
687 bool tile_is_single_monitor;
688
689 uint8_t num_h_tile, num_v_tile;
690 uint8_t tile_h_loc, tile_v_loc;
691 uint16_t tile_h_size, tile_v_size;
692};
693
694/**
695 * struct drm_plane_state - mutable plane state
696 * @crtc: currently bound CRTC, NULL if disabled
697 * @fb: currently bound framebuffer
698 * @fence: optional fence to wait for before scanning out @fb
699 * @crtc_x: left position of visible portion of plane on crtc
700 * @crtc_y: upper position of visible portion of plane on crtc
701 * @crtc_w: width of visible portion of plane on crtc
702 * @crtc_h: height of visible portion of plane on crtc
703 * @src_x: left position of visible portion of plane within
704 * plane (in 16.16)
705 * @src_y: upper position of visible portion of plane within
706 * plane (in 16.16)
707 * @src_w: width of visible portion of plane (in 16.16)
708 * @src_h: height of visible portion of plane (in 16.16)
709 * @state: backpointer to global drm_atomic_state
710 */
711struct drm_plane_state {
712 struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */
713 struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */
714 struct fence *fence;
715
716 /* Signed dest location allows it to be partially off screen */
717 int32_t crtc_x, crtc_y;
718 uint32_t crtc_w, crtc_h;
719
720 /* Source values are 16.16 fixed point */
721 uint32_t src_x, src_y;
722 uint32_t src_h, src_w;
723
724 struct drm_atomic_state *state;
566}; 725};
567 726
727
568/** 728/**
569 * drm_plane_funcs - driver plane control functions 729 * struct drm_plane_funcs - driver plane control functions
570 * @update_plane: update the plane configuration 730 * @update_plane: update the plane configuration
571 * @disable_plane: shut down the plane 731 * @disable_plane: shut down the plane
572 * @destroy: clean up plane resources 732 * @destroy: clean up plane resources
733 * @reset: reset plane after state has been invalidated (e.g. resume)
573 * @set_property: called when a property is changed 734 * @set_property: called when a property is changed
735 * @atomic_duplicate_state: duplicate the atomic state for this plane
736 * @atomic_destroy_state: destroy an atomic state for this plane
737 * @atomic_set_property: set a property on an atomic state for this plane
574 */ 738 */
575struct drm_plane_funcs { 739struct drm_plane_funcs {
576 int (*update_plane)(struct drm_plane *plane, 740 int (*update_plane)(struct drm_plane *plane,
@@ -585,6 +749,15 @@ struct drm_plane_funcs {
585 749
586 int (*set_property)(struct drm_plane *plane, 750 int (*set_property)(struct drm_plane *plane,
587 struct drm_property *property, uint64_t val); 751 struct drm_property *property, uint64_t val);
752
753 /* atomic update handling */
754 struct drm_plane_state *(*atomic_duplicate_state)(struct drm_plane *plane);
755 void (*atomic_destroy_state)(struct drm_plane *plane,
756 struct drm_plane_state *state);
757 int (*atomic_set_property)(struct drm_plane *plane,
758 struct drm_plane_state *state,
759 struct drm_property *property,
760 uint64_t val);
588}; 761};
589 762
590enum drm_plane_type { 763enum drm_plane_type {
@@ -594,7 +767,7 @@ enum drm_plane_type {
594}; 767};
595 768
596/** 769/**
597 * drm_plane - central DRM plane control structure 770 * struct drm_plane - central DRM plane control structure
598 * @dev: DRM device this plane belongs to 771 * @dev: DRM device this plane belongs to
599 * @head: for list management 772 * @head: for list management
600 * @base: base mode object 773 * @base: base mode object
@@ -603,14 +776,19 @@ enum drm_plane_type {
603 * @format_count: number of formats supported 776 * @format_count: number of formats supported
604 * @crtc: currently bound CRTC 777 * @crtc: currently bound CRTC
605 * @fb: currently bound fb 778 * @fb: currently bound fb
779 * @old_fb: Temporary tracking of the old fb while a modeset is ongoing. Used by
780 * drm_mode_set_config_internal() to implement correct refcounting.
606 * @funcs: helper functions 781 * @funcs: helper functions
607 * @properties: property tracking for this plane 782 * @properties: property tracking for this plane
608 * @type: type of plane (overlay, primary, cursor) 783 * @type: type of plane (overlay, primary, cursor)
784 * @state: current atomic state for this plane
609 */ 785 */
610struct drm_plane { 786struct drm_plane {
611 struct drm_device *dev; 787 struct drm_device *dev;
612 struct list_head head; 788 struct list_head head;
613 789
790 struct drm_modeset_lock mutex;
791
614 struct drm_mode_object base; 792 struct drm_mode_object base;
615 793
616 uint32_t possible_crtcs; 794 uint32_t possible_crtcs;
@@ -620,8 +798,6 @@ struct drm_plane {
620 struct drm_crtc *crtc; 798 struct drm_crtc *crtc;
621 struct drm_framebuffer *fb; 799 struct drm_framebuffer *fb;
622 800
623 /* Temporary tracking of the old fb while a modeset is ongoing. Used
624 * by drm_mode_set_config_internal to implement correct refcounting. */
625 struct drm_framebuffer *old_fb; 801 struct drm_framebuffer *old_fb;
626 802
627 const struct drm_plane_funcs *funcs; 803 const struct drm_plane_funcs *funcs;
@@ -629,10 +805,14 @@ struct drm_plane {
629 struct drm_object_properties properties; 805 struct drm_object_properties properties;
630 806
631 enum drm_plane_type type; 807 enum drm_plane_type type;
808
809 void *helper_private;
810
811 struct drm_plane_state *state;
632}; 812};
633 813
634/** 814/**
635 * drm_bridge_funcs - drm_bridge control functions 815 * struct drm_bridge_funcs - drm_bridge control functions
636 * @mode_fixup: Try to fixup (or reject entirely) proposed mode for this bridge 816 * @mode_fixup: Try to fixup (or reject entirely) proposed mode for this bridge
637 * @disable: Called right before encoder prepare, disables the bridge 817 * @disable: Called right before encoder prepare, disables the bridge
638 * @post_disable: Called right after encoder prepare, for lockstepped disable 818 * @post_disable: Called right after encoder prepare, for lockstepped disable
@@ -656,7 +836,7 @@ struct drm_bridge_funcs {
656}; 836};
657 837
658/** 838/**
659 * drm_bridge - central DRM bridge control structure 839 * struct drm_bridge - central DRM bridge control structure
660 * @dev: DRM device this bridge belongs to 840 * @dev: DRM device this bridge belongs to
661 * @head: list management 841 * @head: list management
662 * @base: base mode object 842 * @base: base mode object
@@ -674,8 +854,35 @@ struct drm_bridge {
674}; 854};
675 855
676/** 856/**
677 * drm_mode_set - new values for a CRTC config change 857 * struct struct drm_atomic_state - the global state object for atomic updates
678 * @head: list management 858 * @dev: parent DRM device
859 * @flags: state flags like async update
860 * @planes: pointer to array of plane pointers
861 * @plane_states: pointer to array of plane states pointers
862 * @crtcs: pointer to array of CRTC pointers
863 * @crtc_states: pointer to array of CRTC states pointers
864 * @num_connector: size of the @connectors and @connector_states arrays
865 * @connectors: pointer to array of connector pointers
866 * @connector_states: pointer to array of connector states pointers
867 * @acquire_ctx: acquire context for this atomic modeset state update
868 */
869struct drm_atomic_state {
870 struct drm_device *dev;
871 uint32_t flags;
872 struct drm_plane **planes;
873 struct drm_plane_state **plane_states;
874 struct drm_crtc **crtcs;
875 struct drm_crtc_state **crtc_states;
876 int num_connector;
877 struct drm_connector **connectors;
878 struct drm_connector_state **connector_states;
879
880 struct drm_modeset_acquire_ctx *acquire_ctx;
881};
882
883
884/**
885 * struct drm_mode_set - new values for a CRTC config change
679 * @fb: framebuffer to use for new config 886 * @fb: framebuffer to use for new config
680 * @crtc: CRTC whose configuration we're about to change 887 * @crtc: CRTC whose configuration we're about to change
681 * @mode: mode timings to use 888 * @mode: mode timings to use
@@ -705,6 +912,9 @@ struct drm_mode_set {
705 * struct drm_mode_config_funcs - basic driver provided mode setting functions 912 * struct drm_mode_config_funcs - basic driver provided mode setting functions
706 * @fb_create: create a new framebuffer object 913 * @fb_create: create a new framebuffer object
707 * @output_poll_changed: function to handle output configuration changes 914 * @output_poll_changed: function to handle output configuration changes
915 * @atomic_check: check whether a give atomic state update is possible
916 * @atomic_commit: commit an atomic state update previously verified with
917 * atomic_check()
708 * 918 *
709 * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that 919 * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that
710 * involve drivers. 920 * involve drivers.
@@ -714,13 +924,20 @@ struct drm_mode_config_funcs {
714 struct drm_file *file_priv, 924 struct drm_file *file_priv,
715 struct drm_mode_fb_cmd2 *mode_cmd); 925 struct drm_mode_fb_cmd2 *mode_cmd);
716 void (*output_poll_changed)(struct drm_device *dev); 926 void (*output_poll_changed)(struct drm_device *dev);
927
928 int (*atomic_check)(struct drm_device *dev,
929 struct drm_atomic_state *a);
930 int (*atomic_commit)(struct drm_device *dev,
931 struct drm_atomic_state *a,
932 bool async);
717}; 933};
718 934
719/** 935/**
720 * drm_mode_group - group of mode setting resources for potential sub-grouping 936 * struct drm_mode_group - group of mode setting resources for potential sub-grouping
721 * @num_crtcs: CRTC count 937 * @num_crtcs: CRTC count
722 * @num_encoders: encoder count 938 * @num_encoders: encoder count
723 * @num_connectors: connector count 939 * @num_connectors: connector count
940 * @num_bridges: bridge count
724 * @id_list: list of KMS object IDs in this group 941 * @id_list: list of KMS object IDs in this group
725 * 942 *
726 * Currently this simply tracks the global mode setting state. But in the 943 * Currently this simply tracks the global mode setting state. But in the
@@ -740,10 +957,14 @@ struct drm_mode_group {
740}; 957};
741 958
742/** 959/**
743 * drm_mode_config - Mode configuration control structure 960 * struct drm_mode_config - Mode configuration control structure
744 * @mutex: mutex protecting KMS related lists and structures 961 * @mutex: mutex protecting KMS related lists and structures
962 * @connection_mutex: ww mutex protecting connector state and routing
963 * @acquire_ctx: global implicit acquire context used by atomic drivers for
964 * legacy ioctls
745 * @idr_mutex: mutex for KMS ID allocation and management 965 * @idr_mutex: mutex for KMS ID allocation and management
746 * @crtc_idr: main KMS ID tracking object 966 * @crtc_idr: main KMS ID tracking object
967 * @fb_lock: mutex to protect fb state and lists
747 * @num_fb: number of fbs available 968 * @num_fb: number of fbs available
748 * @fb_list: list of framebuffers available 969 * @fb_list: list of framebuffers available
749 * @num_connector: number of connectors on this device 970 * @num_connector: number of connectors on this device
@@ -752,17 +973,28 @@ struct drm_mode_group {
752 * @bridge_list: list of bridge objects 973 * @bridge_list: list of bridge objects
753 * @num_encoder: number of encoders on this device 974 * @num_encoder: number of encoders on this device
754 * @encoder_list: list of encoder objects 975 * @encoder_list: list of encoder objects
976 * @num_overlay_plane: number of overlay planes on this device
977 * @num_total_plane: number of universal (i.e. with primary/curso) planes on this device
978 * @plane_list: list of plane objects
755 * @num_crtc: number of CRTCs on this device 979 * @num_crtc: number of CRTCs on this device
756 * @crtc_list: list of CRTC objects 980 * @crtc_list: list of CRTC objects
981 * @property_list: list of property objects
757 * @min_width: minimum pixel width on this device 982 * @min_width: minimum pixel width on this device
758 * @min_height: minimum pixel height on this device 983 * @min_height: minimum pixel height on this device
759 * @max_width: maximum pixel width on this device 984 * @max_width: maximum pixel width on this device
760 * @max_height: maximum pixel height on this device 985 * @max_height: maximum pixel height on this device
761 * @funcs: core driver provided mode setting functions 986 * @funcs: core driver provided mode setting functions
762 * @fb_base: base address of the framebuffer 987 * @fb_base: base address of the framebuffer
763 * @poll_enabled: track polling status for this device 988 * @poll_enabled: track polling support for this device
989 * @poll_running: track polling status for this device
764 * @output_poll_work: delayed work for polling in process context 990 * @output_poll_work: delayed work for polling in process context
991 * @property_blob_list: list of all the blob property objects
765 * @*_property: core property tracking 992 * @*_property: core property tracking
993 * @preferred_depth: preferred RBG pixel depth, used by fb helpers
994 * @prefer_shadow: hint to userspace to prefer shadow-fb rendering
995 * @async_page_flip: does this device support async flips on the primary plane?
996 * @cursor_width: hint to userspace for max cursor width
997 * @cursor_height: hint to userspace for max cursor height
766 * 998 *
767 * Core mode resource tracking structure. All CRTC, encoders, and connectors 999 * Core mode resource tracking structure. All CRTC, encoders, and connectors
768 * enumerated by the driver are added here, as are global properties. Some 1000 * enumerated by the driver are added here, as are global properties. Some
@@ -774,16 +1006,10 @@ struct drm_mode_config {
774 struct drm_modeset_acquire_ctx *acquire_ctx; /* for legacy _lock_all() / _unlock_all() */ 1006 struct drm_modeset_acquire_ctx *acquire_ctx; /* for legacy _lock_all() / _unlock_all() */
775 struct mutex idr_mutex; /* for IDR management */ 1007 struct mutex idr_mutex; /* for IDR management */
776 struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */ 1008 struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */
1009 struct idr tile_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */
777 /* this is limited to one for now */ 1010 /* this is limited to one for now */
778 1011
779 1012 struct mutex fb_lock; /* proctects global and per-file fb lists */
780 /**
781 * fb_lock - mutex to protect fb state
782 *
783 * Besides the global fb list his also protects the fbs list in the
784 * file_priv
785 */
786 struct mutex fb_lock;
787 int num_fb; 1013 int num_fb;
788 struct list_head fb_list; 1014 struct list_head fb_list;
789 1015
@@ -824,6 +1050,7 @@ struct drm_mode_config {
824 struct drm_property *edid_property; 1050 struct drm_property *edid_property;
825 struct drm_property *dpms_property; 1051 struct drm_property *dpms_property;
826 struct drm_property *path_property; 1052 struct drm_property *path_property;
1053 struct drm_property *tile_property;
827 struct drm_property *plane_type_property; 1054 struct drm_property *plane_type_property;
828 struct drm_property *rotation_property; 1055 struct drm_property *rotation_property;
829 1056
@@ -851,6 +1078,10 @@ struct drm_mode_config {
851 struct drm_property *aspect_ratio_property; 1078 struct drm_property *aspect_ratio_property;
852 struct drm_property *dirty_info_property; 1079 struct drm_property *dirty_info_property;
853 1080
1081 /* properties for virtual machine layout */
1082 struct drm_property *suggested_x_property;
1083 struct drm_property *suggested_y_property;
1084
854 /* dumb ioctl parameters */ 1085 /* dumb ioctl parameters */
855 uint32_t preferred_depth, prefer_shadow; 1086 uint32_t preferred_depth, prefer_shadow;
856 1087
@@ -861,6 +1092,19 @@ struct drm_mode_config {
861 uint32_t cursor_width, cursor_height; 1092 uint32_t cursor_width, cursor_height;
862}; 1093};
863 1094
1095/**
1096 * drm_for_each_plane_mask - iterate over planes specified by bitmask
1097 * @plane: the loop cursor
1098 * @dev: the DRM device
1099 * @plane_mask: bitmask of plane indices
1100 *
1101 * Iterate over all planes specified by bitmask.
1102 */
1103#define drm_for_each_plane_mask(plane, dev, plane_mask) \
1104 list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \
1105 if ((plane_mask) & (1 << drm_plane_index(plane)))
1106
1107
864#define obj_to_crtc(x) container_of(x, struct drm_crtc, base) 1108#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
865#define obj_to_connector(x) container_of(x, struct drm_connector, base) 1109#define obj_to_connector(x) container_of(x, struct drm_connector, base)
866#define obj_to_encoder(x) container_of(x, struct drm_encoder, base) 1110#define obj_to_encoder(x) container_of(x, struct drm_encoder, base)
@@ -880,9 +1124,6 @@ extern int drm_crtc_init_with_planes(struct drm_device *dev,
880 struct drm_plane *primary, 1124 struct drm_plane *primary,
881 struct drm_plane *cursor, 1125 struct drm_plane *cursor,
882 const struct drm_crtc_funcs *funcs); 1126 const struct drm_crtc_funcs *funcs);
883extern int drm_crtc_init(struct drm_device *dev,
884 struct drm_crtc *crtc,
885 const struct drm_crtc_funcs *funcs);
886extern void drm_crtc_cleanup(struct drm_crtc *crtc); 1127extern void drm_crtc_cleanup(struct drm_crtc *crtc);
887extern unsigned int drm_crtc_index(struct drm_crtc *crtc); 1128extern unsigned int drm_crtc_index(struct drm_crtc *crtc);
888 1129
@@ -978,9 +1219,10 @@ extern void drm_mode_config_reset(struct drm_device *dev);
978extern void drm_mode_config_cleanup(struct drm_device *dev); 1219extern void drm_mode_config_cleanup(struct drm_device *dev);
979 1220
980extern int drm_mode_connector_set_path_property(struct drm_connector *connector, 1221extern int drm_mode_connector_set_path_property(struct drm_connector *connector,
981 char *path); 1222 const char *path);
1223int drm_mode_connector_set_tile_property(struct drm_connector *connector);
982extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, 1224extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
983 struct edid *edid); 1225 const struct edid *edid);
984 1226
985static inline bool drm_property_type_is(struct drm_property *property, 1227static inline bool drm_property_type_is(struct drm_property *property,
986 uint32_t type) 1228 uint32_t type)
@@ -1041,11 +1283,13 @@ extern void drm_property_destroy(struct drm_device *dev, struct drm_property *pr
1041extern int drm_property_add_enum(struct drm_property *property, int index, 1283extern int drm_property_add_enum(struct drm_property *property, int index,
1042 uint64_t value, const char *name); 1284 uint64_t value, const char *name);
1043extern int drm_mode_create_dvi_i_properties(struct drm_device *dev); 1285extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
1044extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats, 1286extern int drm_mode_create_tv_properties(struct drm_device *dev,
1045 char *formats[]); 1287 unsigned int num_modes,
1288 char *modes[]);
1046extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); 1289extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
1047extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev); 1290extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
1048extern int drm_mode_create_dirty_info_property(struct drm_device *dev); 1291extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
1292extern int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
1049 1293
1050extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, 1294extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
1051 struct drm_encoder *encoder); 1295 struct drm_encoder *encoder);
@@ -1113,6 +1357,13 @@ extern void drm_set_preferred_mode(struct drm_connector *connector,
1113extern int drm_edid_header_is_valid(const u8 *raw_edid); 1357extern int drm_edid_header_is_valid(const u8 *raw_edid);
1114extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid); 1358extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid);
1115extern bool drm_edid_is_valid(struct edid *edid); 1359extern bool drm_edid_is_valid(struct edid *edid);
1360
1361extern struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
1362 char topology[8]);
1363extern struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev,
1364 char topology[8]);
1365extern void drm_mode_put_tile_group(struct drm_device *dev,
1366 struct drm_tile_group *tg);
1116struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, 1367struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
1117 int hsize, int vsize, int fresh, 1368 int hsize, int vsize, int fresh,
1118 bool rb); 1369 bool rb);
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index a3d75fefd010..7adbb65ea8ae 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -68,6 +68,7 @@ struct drm_crtc_helper_funcs {
68 int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode, 68 int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode,
69 struct drm_display_mode *adjusted_mode, int x, int y, 69 struct drm_display_mode *adjusted_mode, int x, int y,
70 struct drm_framebuffer *old_fb); 70 struct drm_framebuffer *old_fb);
71 void (*mode_set_nofb)(struct drm_crtc *crtc);
71 72
72 /* Move the crtc on the current fb to the given position *optional* */ 73 /* Move the crtc on the current fb to the given position *optional* */
73 int (*mode_set_base)(struct drm_crtc *crtc, int x, int y, 74 int (*mode_set_base)(struct drm_crtc *crtc, int x, int y,
@@ -81,6 +82,12 @@ struct drm_crtc_helper_funcs {
81 82
82 /* disable crtc when not in use - more explicit than dpms off */ 83 /* disable crtc when not in use - more explicit than dpms off */
83 void (*disable)(struct drm_crtc *crtc); 84 void (*disable)(struct drm_crtc *crtc);
85
86 /* atomic helpers */
87 int (*atomic_check)(struct drm_crtc *crtc,
88 struct drm_crtc_state *state);
89 void (*atomic_begin)(struct drm_crtc *crtc);
90 void (*atomic_flush)(struct drm_crtc *crtc);
84}; 91};
85 92
86/** 93/**
@@ -161,6 +168,12 @@ static inline void drm_connector_helper_add(struct drm_connector *connector,
161 168
162extern void drm_helper_resume_force_mode(struct drm_device *dev); 169extern void drm_helper_resume_force_mode(struct drm_device *dev);
163 170
171int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
172 struct drm_display_mode *adjusted_mode, int x, int y,
173 struct drm_framebuffer *old_fb);
174int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
175 struct drm_framebuffer *old_fb);
176
164/* drm_probe_helper.c */ 177/* drm_probe_helper.c */
165extern int drm_helper_probe_single_connector_modes(struct drm_connector 178extern int drm_helper_probe_single_connector_modes(struct drm_connector
166 *connector, uint32_t maxX, 179 *connector, uint32_t maxX,
diff --git a/include/drm/drm_displayid.h b/include/drm/drm_displayid.h
new file mode 100644
index 000000000000..623b4e98e748
--- /dev/null
+++ b/include/drm/drm_displayid.h
@@ -0,0 +1,76 @@
1/*
2 * Copyright © 2014 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22#ifndef DRM_DISPLAYID_H
23#define DRM_DISPLAYID_H
24
25#define DATA_BLOCK_PRODUCT_ID 0x00
26#define DATA_BLOCK_DISPLAY_PARAMETERS 0x01
27#define DATA_BLOCK_COLOR_CHARACTERISTICS 0x02
28#define DATA_BLOCK_TYPE_1_DETAILED_TIMING 0x03
29#define DATA_BLOCK_TYPE_2_DETAILED_TIMING 0x04
30#define DATA_BLOCK_TYPE_3_SHORT_TIMING 0x05
31#define DATA_BLOCK_TYPE_4_DMT_TIMING 0x06
32#define DATA_BLOCK_VESA_TIMING 0x07
33#define DATA_BLOCK_CEA_TIMING 0x08
34#define DATA_BLOCK_VIDEO_TIMING_RANGE 0x09
35#define DATA_BLOCK_PRODUCT_SERIAL_NUMBER 0x0a
36#define DATA_BLOCK_GP_ASCII_STRING 0x0b
37#define DATA_BLOCK_DISPLAY_DEVICE_DATA 0x0c
38#define DATA_BLOCK_INTERFACE_POWER_SEQUENCING 0x0d
39#define DATA_BLOCK_TRANSFER_CHARACTERISTICS 0x0e
40#define DATA_BLOCK_DISPLAY_INTERFACE 0x0f
41#define DATA_BLOCK_STEREO_DISPLAY_INTERFACE 0x10
42#define DATA_BLOCK_TILED_DISPLAY 0x12
43
44#define DATA_BLOCK_VENDOR_SPECIFIC 0x7f
45
46#define PRODUCT_TYPE_EXTENSION 0
47#define PRODUCT_TYPE_TEST 1
48#define PRODUCT_TYPE_PANEL 2
49#define PRODUCT_TYPE_MONITOR 3
50#define PRODUCT_TYPE_TV 4
51#define PRODUCT_TYPE_REPEATER 5
52#define PRODUCT_TYPE_DIRECT_DRIVE 6
53
54struct displayid_hdr {
55 u8 rev;
56 u8 bytes;
57 u8 prod_id;
58 u8 ext_count;
59} __packed;
60
61struct displayid_block {
62 u8 tag;
63 u8 rev;
64 u8 num_bytes;
65} __packed;
66
67struct displayid_tiled_block {
68 struct displayid_block base;
69 u8 tile_cap;
70 u8 topo[3];
71 u8 tile_size[4];
72 u8 tile_pixel_bezel[5];
73 u8 topology_id[8];
74} __packed;
75
76#endif
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 9305c718d789..11f8c84f98ce 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -303,7 +303,8 @@
303#define DP_TEST_CRC_B_CB 0x244 303#define DP_TEST_CRC_B_CB 0x244
304 304
305#define DP_TEST_SINK_MISC 0x246 305#define DP_TEST_SINK_MISC 0x246
306#define DP_TEST_CRC_SUPPORTED (1 << 5) 306# define DP_TEST_CRC_SUPPORTED (1 << 5)
307# define DP_TEST_COUNT_MASK 0x7
307 308
308#define DP_TEST_RESPONSE 0x260 309#define DP_TEST_RESPONSE 0x260
309# define DP_TEST_ACK (1 << 0) 310# define DP_TEST_ACK (1 << 0)
@@ -313,7 +314,7 @@
313#define DP_TEST_EDID_CHECKSUM 0x261 314#define DP_TEST_EDID_CHECKSUM 0x261
314 315
315#define DP_TEST_SINK 0x270 316#define DP_TEST_SINK 0x270
316#define DP_TEST_SINK_START (1 << 0) 317# define DP_TEST_SINK_START (1 << 0)
317 318
318#define DP_PAYLOAD_TABLE_UPDATE_STATUS 0x2c0 /* 1.2 MST */ 319#define DP_PAYLOAD_TABLE_UPDATE_STATUS 0x2c0 /* 1.2 MST */
319# define DP_PAYLOAD_TABLE_UPDATED (1 << 0) 320# define DP_PAYLOAD_TABLE_UPDATED (1 << 0)
@@ -404,26 +405,6 @@
404#define MODE_I2C_READ 4 405#define MODE_I2C_READ 4
405#define MODE_I2C_STOP 8 406#define MODE_I2C_STOP 8
406 407
407/**
408 * struct i2c_algo_dp_aux_data - driver interface structure for i2c over dp
409 * aux algorithm
410 * @running: set by the algo indicating whether an i2c is ongoing or whether
411 * the i2c bus is quiescent
412 * @address: i2c target address for the currently ongoing transfer
413 * @aux_ch: driver callback to transfer a single byte of the i2c payload
414 */
415struct i2c_algo_dp_aux_data {
416 bool running;
417 u16 address;
418 int (*aux_ch) (struct i2c_adapter *adapter,
419 int mode, uint8_t write_byte,
420 uint8_t *read_byte);
421};
422
423int
424i2c_dp_aux_add_bus(struct i2c_adapter *adapter);
425
426
427#define DP_LINK_STATUS_SIZE 6 408#define DP_LINK_STATUS_SIZE 6
428bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE], 409bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
429 int lane_count); 410 int lane_count);
@@ -550,6 +531,7 @@ struct drm_dp_aux {
550 struct mutex hw_mutex; 531 struct mutex hw_mutex;
551 ssize_t (*transfer)(struct drm_dp_aux *aux, 532 ssize_t (*transfer)(struct drm_dp_aux *aux,
552 struct drm_dp_aux_msg *msg); 533 struct drm_dp_aux_msg *msg);
534 unsigned i2c_nack_count, i2c_defer_count;
553}; 535};
554 536
555ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset, 537ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
index 338fc1053835..00c1da927245 100644
--- a/include/drm/drm_dp_mst_helper.h
+++ b/include/drm/drm_dp_mst_helper.h
@@ -28,7 +28,7 @@
28struct drm_dp_mst_branch; 28struct drm_dp_mst_branch;
29 29
30/** 30/**
31 * struct drm_dp_vcpi - Virtual Channel Payload Identifer 31 * struct drm_dp_vcpi - Virtual Channel Payload Identifier
32 * @vcpi: Virtual channel ID. 32 * @vcpi: Virtual channel ID.
33 * @pbn: Payload Bandwidth Number for this channel 33 * @pbn: Payload Bandwidth Number for this channel
34 * @aligned_pbn: PBN aligned with slot size 34 * @aligned_pbn: PBN aligned with slot size
@@ -92,6 +92,8 @@ struct drm_dp_mst_port {
92 struct drm_dp_vcpi vcpi; 92 struct drm_dp_vcpi vcpi;
93 struct drm_connector *connector; 93 struct drm_connector *connector;
94 struct drm_dp_mst_topology_mgr *mgr; 94 struct drm_dp_mst_topology_mgr *mgr;
95
96 struct edid *cached_edid; /* for DP logical ports - make tiling work */
95}; 97};
96 98
97/** 99/**
@@ -371,7 +373,7 @@ struct drm_dp_sideband_msg_tx {
371struct drm_dp_mst_topology_mgr; 373struct drm_dp_mst_topology_mgr;
372struct drm_dp_mst_topology_cbs { 374struct drm_dp_mst_topology_cbs {
373 /* create a connector for a port */ 375 /* create a connector for a port */
374 struct drm_connector *(*add_connector)(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, char *path); 376 struct drm_connector *(*add_connector)(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, const char *path);
375 void (*destroy_connector)(struct drm_dp_mst_topology_mgr *mgr, 377 void (*destroy_connector)(struct drm_dp_mst_topology_mgr *mgr,
376 struct drm_connector *connector); 378 struct drm_connector *connector);
377 void (*hotplug)(struct drm_dp_mst_topology_mgr *mgr); 379 void (*hotplug)(struct drm_dp_mst_topology_mgr *mgr);
@@ -474,7 +476,7 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
474int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handled); 476int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handled);
475 477
476 478
477enum drm_connector_status drm_dp_mst_detect_port(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); 479enum drm_connector_status drm_dp_mst_detect_port(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
478 480
479struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); 481struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
480 482
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index b96031d947a0..87d85e81d3a7 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -27,12 +27,14 @@
27 27
28#define EDID_LENGTH 128 28#define EDID_LENGTH 128
29#define DDC_ADDR 0x50 29#define DDC_ADDR 0x50
30#define DDC_ADDR2 0x52 /* E-DDC 1.2 - where DisplayID can hide */
30 31
31#define CEA_EXT 0x02 32#define CEA_EXT 0x02
32#define VTB_EXT 0x10 33#define VTB_EXT 0x10
33#define DI_EXT 0x40 34#define DI_EXT 0x40
34#define LS_EXT 0x50 35#define LS_EXT 0x50
35#define MI_EXT 0x60 36#define MI_EXT 0x60
37#define DISPLAYID_EXT 0x70
36 38
37struct est_timings { 39struct est_timings {
38 u8 t1; 40 u8 t1;
@@ -207,6 +209,61 @@ struct detailed_timing {
207#define DRM_EDID_HDMI_DC_30 (1 << 4) 209#define DRM_EDID_HDMI_DC_30 (1 << 4)
208#define DRM_EDID_HDMI_DC_Y444 (1 << 3) 210#define DRM_EDID_HDMI_DC_Y444 (1 << 3)
209 211
212/* ELD Header Block */
213#define DRM_ELD_HEADER_BLOCK_SIZE 4
214
215#define DRM_ELD_VER 0
216# define DRM_ELD_VER_SHIFT 3
217# define DRM_ELD_VER_MASK (0x1f << 3)
218
219#define DRM_ELD_BASELINE_ELD_LEN 2 /* in dwords! */
220
221/* ELD Baseline Block for ELD_Ver == 2 */
222#define DRM_ELD_CEA_EDID_VER_MNL 4
223# define DRM_ELD_CEA_EDID_VER_SHIFT 5
224# define DRM_ELD_CEA_EDID_VER_MASK (7 << 5)
225# define DRM_ELD_CEA_EDID_VER_NONE (0 << 5)
226# define DRM_ELD_CEA_EDID_VER_CEA861 (1 << 5)
227# define DRM_ELD_CEA_EDID_VER_CEA861A (2 << 5)
228# define DRM_ELD_CEA_EDID_VER_CEA861BCD (3 << 5)
229# define DRM_ELD_MNL_SHIFT 0
230# define DRM_ELD_MNL_MASK (0x1f << 0)
231
232#define DRM_ELD_SAD_COUNT_CONN_TYPE 5
233# define DRM_ELD_SAD_COUNT_SHIFT 4
234# define DRM_ELD_SAD_COUNT_MASK (0xf << 4)
235# define DRM_ELD_CONN_TYPE_SHIFT 2
236# define DRM_ELD_CONN_TYPE_MASK (3 << 2)
237# define DRM_ELD_CONN_TYPE_HDMI (0 << 2)
238# define DRM_ELD_CONN_TYPE_DP (1 << 2)
239# define DRM_ELD_SUPPORTS_AI (1 << 1)
240# define DRM_ELD_SUPPORTS_HDCP (1 << 0)
241
242#define DRM_ELD_AUD_SYNCH_DELAY 6 /* in units of 2 ms */
243# define DRM_ELD_AUD_SYNCH_DELAY_MAX 0xfa /* 500 ms */
244
245#define DRM_ELD_SPEAKER 7
246# define DRM_ELD_SPEAKER_RLRC (1 << 6)
247# define DRM_ELD_SPEAKER_FLRC (1 << 5)
248# define DRM_ELD_SPEAKER_RC (1 << 4)
249# define DRM_ELD_SPEAKER_RLR (1 << 3)
250# define DRM_ELD_SPEAKER_FC (1 << 2)
251# define DRM_ELD_SPEAKER_LFE (1 << 1)
252# define DRM_ELD_SPEAKER_FLR (1 << 0)
253
254#define DRM_ELD_PORT_ID 8 /* offsets 8..15 inclusive */
255# define DRM_ELD_PORT_ID_LEN 8
256
257#define DRM_ELD_MANUFACTURER_NAME0 16
258#define DRM_ELD_MANUFACTURER_NAME1 17
259
260#define DRM_ELD_PRODUCT_CODE0 18
261#define DRM_ELD_PRODUCT_CODE1 19
262
263#define DRM_ELD_MONITOR_NAME_STRING 20 /* offsets 20..(20+mnl-1) inclusive */
264
265#define DRM_ELD_CEA_SAD(mnl, sad) (20 + (mnl) + 3 * (sad))
266
210struct edid { 267struct edid {
211 u8 header[8]; 268 u8 header[8];
212 /* Vendor & product info */ 269 /* Vendor & product info */
@@ -279,4 +336,56 @@ int
279drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, 336drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
280 const struct drm_display_mode *mode); 337 const struct drm_display_mode *mode);
281 338
339/**
340 * drm_eld_mnl - Get ELD monitor name length in bytes.
341 * @eld: pointer to an eld memory structure with mnl set
342 */
343static inline int drm_eld_mnl(const uint8_t *eld)
344{
345 return (eld[DRM_ELD_CEA_EDID_VER_MNL] & DRM_ELD_MNL_MASK) >> DRM_ELD_MNL_SHIFT;
346}
347
348/**
349 * drm_eld_sad_count - Get ELD SAD count.
350 * @eld: pointer to an eld memory structure with sad_count set
351 */
352static inline int drm_eld_sad_count(const uint8_t *eld)
353{
354 return (eld[DRM_ELD_SAD_COUNT_CONN_TYPE] & DRM_ELD_SAD_COUNT_MASK) >>
355 DRM_ELD_SAD_COUNT_SHIFT;
356}
357
358/**
359 * drm_eld_calc_baseline_block_size - Calculate baseline block size in bytes
360 * @eld: pointer to an eld memory structure with mnl and sad_count set
361 *
362 * This is a helper for determining the payload size of the baseline block, in
363 * bytes, for e.g. setting the Baseline_ELD_Len field in the ELD header block.
364 */
365static inline int drm_eld_calc_baseline_block_size(const uint8_t *eld)
366{
367 return DRM_ELD_MONITOR_NAME_STRING - DRM_ELD_HEADER_BLOCK_SIZE +
368 drm_eld_mnl(eld) + drm_eld_sad_count(eld) * 3;
369}
370
371/**
372 * drm_eld_size - Get ELD size in bytes
373 * @eld: pointer to a complete eld memory structure
374 *
375 * The returned value does not include the vendor block. It's vendor specific,
376 * and comprises of the remaining bytes in the ELD memory buffer after
377 * drm_eld_size() bytes of header and baseline block.
378 *
379 * The returned value is guaranteed to be a multiple of 4.
380 */
381static inline int drm_eld_size(const uint8_t *eld)
382{
383 return DRM_ELD_HEADER_BLOCK_SIZE + eld[DRM_ELD_BASELINE_ELD_LEN] * 4;
384}
385
386struct edid *drm_do_get_edid(struct drm_connector *connector,
387 int (*get_edid_block)(void *data, u8 *buf, unsigned int block,
388 size_t len),
389 void *data);
390
282#endif /* __DRM_EDID_H__ */ 391#endif /* __DRM_EDID_H__ */
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index f4ad254e3488..b597068103aa 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -34,9 +34,14 @@ struct drm_fb_helper;
34 34
35#include <linux/kgdb.h> 35#include <linux/kgdb.h>
36 36
37struct drm_fb_offset {
38 int x, y;
39};
40
37struct drm_fb_helper_crtc { 41struct drm_fb_helper_crtc {
38 struct drm_mode_set mode_set; 42 struct drm_mode_set mode_set;
39 struct drm_display_mode *desired_mode; 43 struct drm_display_mode *desired_mode;
44 int x, y;
40}; 45};
41 46
42struct drm_fb_helper_surface_size { 47struct drm_fb_helper_surface_size {
@@ -72,6 +77,7 @@ struct drm_fb_helper_funcs {
72 bool (*initial_config)(struct drm_fb_helper *fb_helper, 77 bool (*initial_config)(struct drm_fb_helper *fb_helper,
73 struct drm_fb_helper_crtc **crtcs, 78 struct drm_fb_helper_crtc **crtcs,
74 struct drm_display_mode **modes, 79 struct drm_display_mode **modes,
80 struct drm_fb_offset *offsets,
75 bool *enabled, int width, int height); 81 bool *enabled, int width, int height);
76}; 82};
77 83
diff --git a/include/drm/drm_flip_work.h b/include/drm/drm_flip_work.h
index 9eed34dcd6af..d387cf06ae05 100644
--- a/include/drm/drm_flip_work.h
+++ b/include/drm/drm_flip_work.h
@@ -25,6 +25,7 @@
25#define DRM_FLIP_WORK_H 25#define DRM_FLIP_WORK_H
26 26
27#include <linux/kfifo.h> 27#include <linux/kfifo.h>
28#include <linux/spinlock.h>
28#include <linux/workqueue.h> 29#include <linux/workqueue.h>
29 30
30/** 31/**
@@ -32,9 +33,9 @@
32 * 33 *
33 * Util to queue up work to run from work-queue context after flip/vblank. 34 * Util to queue up work to run from work-queue context after flip/vblank.
34 * Typically this can be used to defer unref of framebuffer's, cursor 35 * Typically this can be used to defer unref of framebuffer's, cursor
35 * bo's, etc until after vblank. The APIs are all safe (and lockless) 36 * bo's, etc until after vblank. The APIs are all thread-safe.
36 * for up to one producer and once consumer at a time. The single-consumer 37 * Moreover, drm_flip_work_queue_task and drm_flip_work_queue can be called
37 * aspect is ensured by committing the queued work to a single work-queue. 38 * in atomic context.
38 */ 39 */
39 40
40struct drm_flip_work; 41struct drm_flip_work;
@@ -51,26 +52,40 @@ struct drm_flip_work;
51typedef void (*drm_flip_func_t)(struct drm_flip_work *work, void *val); 52typedef void (*drm_flip_func_t)(struct drm_flip_work *work, void *val);
52 53
53/** 54/**
55 * struct drm_flip_task - flip work task
56 * @node: list entry element
57 * @data: data to pass to work->func
58 */
59struct drm_flip_task {
60 struct list_head node;
61 void *data;
62};
63
64/**
54 * struct drm_flip_work - flip work queue 65 * struct drm_flip_work - flip work queue
55 * @name: debug name 66 * @name: debug name
56 * @pending: number of queued but not committed items
57 * @count: number of committed items
58 * @func: callback fxn called for each committed item 67 * @func: callback fxn called for each committed item
59 * @worker: worker which calls @func 68 * @worker: worker which calls @func
60 * @fifo: queue of committed items 69 * @queued: queued tasks
70 * @commited: commited tasks
71 * @lock: lock to access queued and commited lists
61 */ 72 */
62struct drm_flip_work { 73struct drm_flip_work {
63 const char *name; 74 const char *name;
64 atomic_t pending, count;
65 drm_flip_func_t func; 75 drm_flip_func_t func;
66 struct work_struct worker; 76 struct work_struct worker;
67 DECLARE_KFIFO_PTR(fifo, void *); 77 struct list_head queued;
78 struct list_head commited;
79 spinlock_t lock;
68}; 80};
69 81
82struct drm_flip_task *drm_flip_work_allocate_task(void *data, gfp_t flags);
83void drm_flip_work_queue_task(struct drm_flip_work *work,
84 struct drm_flip_task *task);
70void drm_flip_work_queue(struct drm_flip_work *work, void *val); 85void drm_flip_work_queue(struct drm_flip_work *work, void *val);
71void drm_flip_work_commit(struct drm_flip_work *work, 86void drm_flip_work_commit(struct drm_flip_work *work,
72 struct workqueue_struct *wq); 87 struct workqueue_struct *wq);
73int drm_flip_work_init(struct drm_flip_work *work, int size, 88void drm_flip_work_init(struct drm_flip_work *work,
74 const char *name, drm_flip_func_t func); 89 const char *name, drm_flip_func_t func);
75void drm_flip_work_cleanup(struct drm_flip_work *work); 90void drm_flip_work_cleanup(struct drm_flip_work *work);
76 91
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index 1e6ae1458f7a..780511a459c0 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -119,6 +119,13 @@ struct drm_gem_object {
119 * simply leave it as NULL. 119 * simply leave it as NULL.
120 */ 120 */
121 struct dma_buf_attachment *import_attach; 121 struct dma_buf_attachment *import_attach;
122
123 /**
124 * dumb - created as dumb buffer
125 * Whether the gem object was created using the dumb buffer interface
126 * as such it may not be used for GPU rendering.
127 */
128 bool dumb;
122}; 129};
123 130
124void drm_gem_object_release(struct drm_gem_object *obj); 131void drm_gem_object_release(struct drm_gem_object *obj);
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
index 2ff35f3de9c5..acd6af8a8e67 100644
--- a/include/drm/drm_gem_cma_helper.h
+++ b/include/drm/drm_gem_cma_helper.h
@@ -4,6 +4,13 @@
4#include <drm/drmP.h> 4#include <drm/drmP.h>
5#include <drm/drm_gem.h> 5#include <drm/drm_gem.h>
6 6
7/**
8 * struct drm_gem_cma_object - GEM object backed by CMA memory allocations
9 * @base: base GEM object
10 * @paddr: physical address of the backing memory
11 * @sgt: scatter/gather table for imported PRIME buffers
12 * @vaddr: kernel virtual address of the backing memory
13 */
7struct drm_gem_cma_object { 14struct drm_gem_cma_object {
8 struct drm_gem_object base; 15 struct drm_gem_object base;
9 dma_addr_t paddr; 16 dma_addr_t paddr;
@@ -19,23 +26,30 @@ to_drm_gem_cma_obj(struct drm_gem_object *gem_obj)
19 return container_of(gem_obj, struct drm_gem_cma_object, base); 26 return container_of(gem_obj, struct drm_gem_cma_object, base);
20} 27}
21 28
22/* free gem object. */ 29/* free GEM object */
23void drm_gem_cma_free_object(struct drm_gem_object *gem_obj); 30void drm_gem_cma_free_object(struct drm_gem_object *gem_obj);
24 31
25/* create memory region for drm framebuffer. */ 32/* create memory region for DRM framebuffer */
33int drm_gem_cma_dumb_create_internal(struct drm_file *file_priv,
34 struct drm_device *drm,
35 struct drm_mode_create_dumb *args);
36
37/* create memory region for DRM framebuffer */
26int drm_gem_cma_dumb_create(struct drm_file *file_priv, 38int drm_gem_cma_dumb_create(struct drm_file *file_priv,
27 struct drm_device *drm, struct drm_mode_create_dumb *args); 39 struct drm_device *drm,
40 struct drm_mode_create_dumb *args);
28 41
29/* map memory region for drm framebuffer to user space. */ 42/* map memory region for DRM framebuffer to user space */
30int drm_gem_cma_dumb_map_offset(struct drm_file *file_priv, 43int drm_gem_cma_dumb_map_offset(struct drm_file *file_priv,
31 struct drm_device *drm, uint32_t handle, uint64_t *offset); 44 struct drm_device *drm, u32 handle,
45 u64 *offset);
32 46
33/* set vm_flags and we can change the vm attribute to other one at here. */ 47/* set vm_flags and we can change the VM attribute to other one at here */
34int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma); 48int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma);
35 49
36/* allocate physical memory. */ 50/* allocate physical memory */
37struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, 51struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
38 unsigned int size); 52 size_t size);
39 53
40extern const struct vm_operations_struct drm_gem_cma_vm_ops; 54extern const struct vm_operations_struct drm_gem_cma_vm_ops;
41 55
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 8569dc5a1026..f1d8d0dbb4f1 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -26,6 +26,7 @@ struct mipi_dsi_device;
26 * struct mipi_dsi_msg - read/write DSI buffer 26 * struct mipi_dsi_msg - read/write DSI buffer
27 * @channel: virtual channel id 27 * @channel: virtual channel id
28 * @type: payload data type 28 * @type: payload data type
29 * @flags: flags controlling this message transmission
29 * @tx_len: length of @tx_buf 30 * @tx_len: length of @tx_buf
30 * @tx_buf: data to be written 31 * @tx_buf: data to be written
31 * @rx_len: length of @rx_buf 32 * @rx_len: length of @rx_buf
@@ -43,12 +44,44 @@ struct mipi_dsi_msg {
43 void *rx_buf; 44 void *rx_buf;
44}; 45};
45 46
47bool mipi_dsi_packet_format_is_short(u8 type);
48bool mipi_dsi_packet_format_is_long(u8 type);
49
50/**
51 * struct mipi_dsi_packet - represents a MIPI DSI packet in protocol format
52 * @size: size (in bytes) of the packet
53 * @header: the four bytes that make up the header (Data ID, Word Count or
54 * Packet Data, and ECC)
55 * @payload_length: number of bytes in the payload
56 * @payload: a pointer to a buffer containing the payload, if any
57 */
58struct mipi_dsi_packet {
59 size_t size;
60 u8 header[4];
61 size_t payload_length;
62 const u8 *payload;
63};
64
65int mipi_dsi_create_packet(struct mipi_dsi_packet *packet,
66 const struct mipi_dsi_msg *msg);
67
46/** 68/**
47 * struct mipi_dsi_host_ops - DSI bus operations 69 * struct mipi_dsi_host_ops - DSI bus operations
48 * @attach: attach DSI device to DSI host 70 * @attach: attach DSI device to DSI host
49 * @detach: detach DSI device from DSI host 71 * @detach: detach DSI device from DSI host
50 * @transfer: send and/or receive DSI packet, return number of received bytes, 72 * @transfer: transmit a DSI packet
51 * or error 73 *
74 * DSI packets transmitted by .transfer() are passed in as mipi_dsi_msg
75 * structures. This structure contains information about the type of packet
76 * being transmitted as well as the transmit and receive buffers. When an
77 * error is encountered during transmission, this function will return a
78 * negative error code. On success it shall return the number of bytes
79 * transmitted for write packets or the number of bytes received for read
80 * packets.
81 *
82 * Note that typically DSI packet transmission is atomic, so the .transfer()
83 * function will seldomly return anything other than the number of bytes
84 * contained in the transmit buffer on success.
52 */ 85 */
53struct mipi_dsi_host_ops { 86struct mipi_dsi_host_ops {
54 int (*attach)(struct mipi_dsi_host *host, 87 int (*attach)(struct mipi_dsi_host *host,
@@ -56,7 +89,7 @@ struct mipi_dsi_host_ops {
56 int (*detach)(struct mipi_dsi_host *host, 89 int (*detach)(struct mipi_dsi_host *host,
57 struct mipi_dsi_device *dsi); 90 struct mipi_dsi_device *dsi);
58 ssize_t (*transfer)(struct mipi_dsi_host *host, 91 ssize_t (*transfer)(struct mipi_dsi_host *host,
59 struct mipi_dsi_msg *msg); 92 const struct mipi_dsi_msg *msg);
60}; 93};
61 94
62/** 95/**
@@ -130,12 +163,57 @@ static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev)
130 return container_of(dev, struct mipi_dsi_device, dev); 163 return container_of(dev, struct mipi_dsi_device, dev);
131} 164}
132 165
166struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np);
133int mipi_dsi_attach(struct mipi_dsi_device *dsi); 167int mipi_dsi_attach(struct mipi_dsi_device *dsi);
134int mipi_dsi_detach(struct mipi_dsi_device *dsi); 168int mipi_dsi_detach(struct mipi_dsi_device *dsi);
135ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, const void *data, 169int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
136 size_t len); 170 u16 value);
171
172ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload,
173 size_t size);
174ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params,
175 size_t num_params, void *data, size_t size);
176
177/**
178 * enum mipi_dsi_dcs_tear_mode - Tearing Effect Output Line mode
179 * @MIPI_DSI_DCS_TEAR_MODE_VBLANK: the TE output line consists of V-Blanking
180 * information only
181 * @MIPI_DSI_DCS_TEAR_MODE_VHBLANK : the TE output line consists of both
182 * V-Blanking and H-Blanking information
183 */
184enum mipi_dsi_dcs_tear_mode {
185 MIPI_DSI_DCS_TEAR_MODE_VBLANK,
186 MIPI_DSI_DCS_TEAR_MODE_VHBLANK,
187};
188
189#define MIPI_DSI_DCS_POWER_MODE_DISPLAY (1 << 2)
190#define MIPI_DSI_DCS_POWER_MODE_NORMAL (1 << 3)
191#define MIPI_DSI_DCS_POWER_MODE_SLEEP (1 << 4)
192#define MIPI_DSI_DCS_POWER_MODE_PARTIAL (1 << 5)
193#define MIPI_DSI_DCS_POWER_MODE_IDLE (1 << 6)
194
195ssize_t mipi_dsi_dcs_write_buffer(struct mipi_dsi_device *dsi,
196 const void *data, size_t len);
197ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, u8 cmd,
198 const void *data, size_t len);
137ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data, 199ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data,
138 size_t len); 200 size_t len);
201int mipi_dsi_dcs_nop(struct mipi_dsi_device *dsi);
202int mipi_dsi_dcs_soft_reset(struct mipi_dsi_device *dsi);
203int mipi_dsi_dcs_get_power_mode(struct mipi_dsi_device *dsi, u8 *mode);
204int mipi_dsi_dcs_get_pixel_format(struct mipi_dsi_device *dsi, u8 *format);
205int mipi_dsi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi);
206int mipi_dsi_dcs_exit_sleep_mode(struct mipi_dsi_device *dsi);
207int mipi_dsi_dcs_set_display_off(struct mipi_dsi_device *dsi);
208int mipi_dsi_dcs_set_display_on(struct mipi_dsi_device *dsi);
209int mipi_dsi_dcs_set_column_address(struct mipi_dsi_device *dsi, u16 start,
210 u16 end);
211int mipi_dsi_dcs_set_page_address(struct mipi_dsi_device *dsi, u16 start,
212 u16 end);
213int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi);
214int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
215 enum mipi_dsi_dcs_tear_mode mode);
216int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
139 217
140/** 218/**
141 * struct mipi_dsi_driver - DSI driver 219 * struct mipi_dsi_driver - DSI driver
@@ -167,9 +245,13 @@ static inline void mipi_dsi_set_drvdata(struct mipi_dsi_device *dsi, void *data)
167 dev_set_drvdata(&dsi->dev, data); 245 dev_set_drvdata(&dsi->dev, data);
168} 246}
169 247
170int mipi_dsi_driver_register(struct mipi_dsi_driver *driver); 248int mipi_dsi_driver_register_full(struct mipi_dsi_driver *driver,
249 struct module *owner);
171void mipi_dsi_driver_unregister(struct mipi_dsi_driver *driver); 250void mipi_dsi_driver_unregister(struct mipi_dsi_driver *driver);
172 251
252#define mipi_dsi_driver_register(driver) \
253 mipi_dsi_driver_register_full(driver, THIS_MODULE)
254
173#define module_mipi_dsi_driver(__mipi_dsi_driver) \ 255#define module_mipi_dsi_driver(__mipi_dsi_driver) \
174 module_driver(__mipi_dsi_driver, mipi_dsi_driver_register, \ 256 module_driver(__mipi_dsi_driver, mipi_dsi_driver_register, \
175 mipi_dsi_driver_unregister) 257 mipi_dsi_driver_unregister)
diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h
index 75a5c45e21c7..70595ff565ba 100644
--- a/include/drm/drm_modeset_lock.h
+++ b/include/drm/drm_modeset_lock.h
@@ -33,6 +33,7 @@ struct drm_modeset_lock;
33 * @ww_ctx: base acquire ctx 33 * @ww_ctx: base acquire ctx
34 * @contended: used internally for -EDEADLK handling 34 * @contended: used internally for -EDEADLK handling
35 * @locked: list of held locks 35 * @locked: list of held locks
36 * @trylock_only: trylock mode used in atomic contexts/panic notifiers
36 * 37 *
37 * Each thread competing for a set of locks must use one acquire 38 * 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 * ctx. And if any lock fxn returns -EDEADLK, it must backoff and
@@ -126,11 +127,13 @@ void drm_modeset_unlock(struct drm_modeset_lock *lock);
126 127
127struct drm_device; 128struct drm_device;
128struct drm_crtc; 129struct drm_crtc;
130struct drm_plane;
129 131
130void drm_modeset_lock_all(struct drm_device *dev); 132void drm_modeset_lock_all(struct drm_device *dev);
131int __drm_modeset_lock_all(struct drm_device *dev, bool trylock); 133int __drm_modeset_lock_all(struct drm_device *dev, bool trylock);
132void drm_modeset_unlock_all(struct drm_device *dev); 134void drm_modeset_unlock_all(struct drm_device *dev);
133void drm_modeset_lock_crtc(struct drm_crtc *crtc); 135void drm_modeset_lock_crtc(struct drm_crtc *crtc,
136 struct drm_plane *plane);
134void drm_modeset_unlock_crtc(struct drm_crtc *crtc); 137void drm_modeset_unlock_crtc(struct drm_crtc *crtc);
135void drm_warn_on_modeset_not_all_locked(struct drm_device *dev); 138void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
136struct drm_modeset_acquire_ctx * 139struct drm_modeset_acquire_ctx *
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
index 52e6870534b2..a185392cafeb 100644
--- a/include/drm/drm_plane_helper.h
+++ b/include/drm/drm_plane_helper.h
@@ -25,6 +25,7 @@
25#define DRM_PLANE_HELPER_H 25#define DRM_PLANE_HELPER_H
26 26
27#include <drm/drm_rect.h> 27#include <drm/drm_rect.h>
28#include <drm/drm_crtc.h>
28 29
29/* 30/*
30 * Drivers that don't allow primary plane scaling may pass this macro in place 31 * Drivers that don't allow primary plane scaling may pass this macro in place
@@ -42,6 +43,37 @@
42 * planes. 43 * planes.
43 */ 44 */
44 45
46extern int drm_crtc_init(struct drm_device *dev,
47 struct drm_crtc *crtc,
48 const struct drm_crtc_funcs *funcs);
49
50/**
51 * drm_plane_helper_funcs - helper operations for CRTCs
52 * @prepare_fb: prepare a framebuffer for use by the plane
53 * @cleanup_fb: cleanup a framebuffer when it's no longer used by the plane
54 * @atomic_check: check that a given atomic state is valid and can be applied
55 * @atomic_update: apply an atomic state to the plane
56 *
57 * The helper operations are called by the mid-layer CRTC helper.
58 */
59struct drm_plane_helper_funcs {
60 int (*prepare_fb)(struct drm_plane *plane,
61 struct drm_framebuffer *fb);
62 void (*cleanup_fb)(struct drm_plane *plane,
63 struct drm_framebuffer *fb);
64
65 int (*atomic_check)(struct drm_plane *plane,
66 struct drm_plane_state *state);
67 void (*atomic_update)(struct drm_plane *plane,
68 struct drm_plane_state *old_state);
69};
70
71static inline void drm_plane_helper_add(struct drm_plane *plane,
72 const struct drm_plane_helper_funcs *funcs)
73{
74 plane->helper_private = (void *)funcs;
75}
76
45extern int drm_plane_helper_check_update(struct drm_plane *plane, 77extern int drm_plane_helper_check_update(struct drm_plane *plane,
46 struct drm_crtc *crtc, 78 struct drm_crtc *crtc,
47 struct drm_framebuffer *fb, 79 struct drm_framebuffer *fb,
@@ -68,4 +100,16 @@ extern struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,
68 int num_formats); 100 int num_formats);
69 101
70 102
103int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
104 struct drm_framebuffer *fb,
105 int crtc_x, int crtc_y,
106 unsigned int crtc_w, unsigned int crtc_h,
107 uint32_t src_x, uint32_t src_y,
108 uint32_t src_w, uint32_t src_h);
109int drm_plane_helper_disable(struct drm_plane *plane);
110
111/* For use by drm_crtc_helper.c */
112int drm_plane_helper_commit(struct drm_plane *plane,
113 struct drm_plane_state *plane_state,
114 struct drm_framebuffer *old_fb);
71#endif 115#endif
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h
index a70d45647898..180ad0e6de21 100644
--- a/include/drm/i915_pciids.h
+++ b/include/drm/i915_pciids.h
@@ -259,4 +259,21 @@
259 INTEL_VGA_DEVICE(0x22b2, info), \ 259 INTEL_VGA_DEVICE(0x22b2, info), \
260 INTEL_VGA_DEVICE(0x22b3, info) 260 INTEL_VGA_DEVICE(0x22b3, info)
261 261
262#define INTEL_SKL_IDS(info) \
263 INTEL_VGA_DEVICE(0x1916, info), /* ULT GT2 */ \
264 INTEL_VGA_DEVICE(0x1906, info), /* ULT GT1 */ \
265 INTEL_VGA_DEVICE(0x1926, info), /* ULT GT3 */ \
266 INTEL_VGA_DEVICE(0x1921, info), /* ULT GT2F */ \
267 INTEL_VGA_DEVICE(0x190E, info), /* ULX GT1 */ \
268 INTEL_VGA_DEVICE(0x191E, info), /* ULX GT2 */ \
269 INTEL_VGA_DEVICE(0x1912, info), /* DT GT2 */ \
270 INTEL_VGA_DEVICE(0x1902, info), /* DT GT1 */ \
271 INTEL_VGA_DEVICE(0x191B, info), /* Halo GT2 */ \
272 INTEL_VGA_DEVICE(0x192B, info), /* Halo GT3 */ \
273 INTEL_VGA_DEVICE(0x190B, info), /* Halo GT1 */ \
274 INTEL_VGA_DEVICE(0x191A, info), /* SRV GT2 */ \
275 INTEL_VGA_DEVICE(0x192A, info), /* SRV GT3 */ \
276 INTEL_VGA_DEVICE(0x190A, info), /* SRV GT1 */ \
277 INTEL_VGA_DEVICE(0x191D, info) /* WKS GT2 */
278
262#endif /* _I915_PCIIDS_H */ 279#endif /* _I915_PCIIDS_H */
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h
index 460441714413..b620c317c772 100644
--- a/include/drm/ttm/ttm_execbuf_util.h
+++ b/include/drm/ttm/ttm_execbuf_util.h
@@ -68,6 +68,7 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
68 * non-blocking reserves should be tried. 68 * non-blocking reserves should be tried.
69 * @list: thread private list of ttm_validate_buffer structs. 69 * @list: thread private list of ttm_validate_buffer structs.
70 * @intr: should the wait be interruptible 70 * @intr: should the wait be interruptible
71 * @dups: [out] optional list of duplicates.
71 * 72 *
72 * Tries to reserve bos pointed to by the list entries for validation. 73 * Tries to reserve bos pointed to by the list entries for validation.
73 * If the function returns 0, all buffers are marked as "unfenced", 74 * If the function returns 0, all buffers are marked as "unfenced",
@@ -83,6 +84,11 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
83 * calling process receives a signal while waiting. In that case, no 84 * calling process receives a signal while waiting. In that case, no
84 * buffers on the list will be reserved upon return. 85 * buffers on the list will be reserved upon return.
85 * 86 *
87 * If dups is non NULL all buffers already reserved by the current thread
88 * (e.g. duplicates) are added to this list, otherwise -EALREADY is returned
89 * on the first already reserved buffer and all buffers from the list are
90 * unreserved again.
91 *
86 * Buffers reserved by this function should be unreserved by 92 * Buffers reserved by this function should be unreserved by
87 * a call to either ttm_eu_backoff_reservation() or 93 * a call to either ttm_eu_backoff_reservation() or
88 * ttm_eu_fence_buffer_objects() when command submission is complete or 94 * ttm_eu_fence_buffer_objects() when command submission is complete or
@@ -90,7 +96,8 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
90 */ 96 */
91 97
92extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, 98extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
93 struct list_head *list, bool intr); 99 struct list_head *list, bool intr,
100 struct list_head *dups);
94 101
95/** 102/**
96 * function ttm_eu_fence_buffer_objects. 103 * function ttm_eu_fence_buffer_objects.
diff --git a/include/dt-bindings/arm/ux500_pm_domains.h b/include/dt-bindings/arm/ux500_pm_domains.h
new file mode 100644
index 000000000000..398a6c0288d1
--- /dev/null
+++ b/include/dt-bindings/arm/ux500_pm_domains.h
@@ -0,0 +1,15 @@
1/*
2 * Copyright (C) 2014 Linaro Ltd.
3 *
4 * Author: Ulf Hansson <ulf.hansson@linaro.org>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7#ifndef _DT_BINDINGS_ARM_UX500_PM_DOMAINS_H
8#define _DT_BINDINGS_ARM_UX500_PM_DOMAINS_H
9
10#define DOMAIN_VAPE 0
11
12/* Number of PM domains. */
13#define NR_DOMAINS (DOMAIN_VAPE + 1)
14
15#endif
diff --git a/include/dt-bindings/clock/imx5-clock.h b/include/dt-bindings/clock/imx5-clock.h
index 5f2667ecd98e..f4b7478e23c8 100644
--- a/include/dt-bindings/clock/imx5-clock.h
+++ b/include/dt-bindings/clock/imx5-clock.h
@@ -198,6 +198,9 @@
198#define IMX5_CLK_OCRAM 186 198#define IMX5_CLK_OCRAM 186
199#define IMX5_CLK_SAHARA_IPG_GATE 187 199#define IMX5_CLK_SAHARA_IPG_GATE 187
200#define IMX5_CLK_SATA_REF 188 200#define IMX5_CLK_SATA_REF 188
201#define IMX5_CLK_END 189 201#define IMX5_CLK_STEP_SEL 189
202#define IMX5_CLK_CPU_PODF_SEL 190
203#define IMX5_CLK_ARM 191
204#define IMX5_CLK_END 192
202 205
203#endif /* __DT_BINDINGS_CLOCK_IMX5_H */ 206#endif /* __DT_BINDINGS_CLOCK_IMX5_H */
diff --git a/include/dt-bindings/clock/qcom,mmcc-apq8084.h b/include/dt-bindings/clock/qcom,mmcc-apq8084.h
index a929f86d0ddd..d72b5b35f15e 100644
--- a/include/dt-bindings/clock/qcom,mmcc-apq8084.h
+++ b/include/dt-bindings/clock/qcom,mmcc-apq8084.h
@@ -60,7 +60,7 @@
60#define ESC1_CLK_SRC 43 60#define ESC1_CLK_SRC 43
61#define HDMI_CLK_SRC 44 61#define HDMI_CLK_SRC 44
62#define VSYNC_CLK_SRC 45 62#define VSYNC_CLK_SRC 45
63#define RBCPR_CLK_SRC 46 63#define MMSS_RBCPR_CLK_SRC 46
64#define RBBMTIMER_CLK_SRC 47 64#define RBBMTIMER_CLK_SRC 47
65#define MAPLE_CLK_SRC 48 65#define MAPLE_CLK_SRC 48
66#define VDP_CLK_SRC 49 66#define VDP_CLK_SRC 49
diff --git a/include/dt-bindings/clock/r8a7740-clock.h b/include/dt-bindings/clock/r8a7740-clock.h
index f6b4b0fe7a43..476135da0f23 100644
--- a/include/dt-bindings/clock/r8a7740-clock.h
+++ b/include/dt-bindings/clock/r8a7740-clock.h
@@ -40,6 +40,7 @@
40 40
41/* MSTP2 */ 41/* MSTP2 */
42#define R8A7740_CLK_SCIFA6 30 42#define R8A7740_CLK_SCIFA6 30
43#define R8A7740_CLK_INTCA 29
43#define R8A7740_CLK_SCIFA7 22 44#define R8A7740_CLK_SCIFA7 22
44#define R8A7740_CLK_DMAC1 18 45#define R8A7740_CLK_DMAC1 18
45#define R8A7740_CLK_DMAC2 17 46#define R8A7740_CLK_DMAC2 17
diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
index 8ea7ab0346ad..c27b3b5133b9 100644
--- a/include/dt-bindings/clock/r8a7790-clock.h
+++ b/include/dt-bindings/clock/r8a7790-clock.h
@@ -26,8 +26,18 @@
26#define R8A7790_CLK_MSIOF0 0 26#define R8A7790_CLK_MSIOF0 0
27 27
28/* MSTP1 */ 28/* MSTP1 */
29#define R8A7790_CLK_JPU 6 29#define R8A7790_CLK_VCP1 0
30#define R8A7790_CLK_VCP0 1
31#define R8A7790_CLK_VPC1 2
32#define R8A7790_CLK_VPC0 3
33#define R8A7790_CLK_JPU 6
34#define R8A7790_CLK_SSP1 9
30#define R8A7790_CLK_TMU1 11 35#define R8A7790_CLK_TMU1 11
36#define R8A7790_CLK_3DG 12
37#define R8A7790_CLK_2DDMAC 15
38#define R8A7790_CLK_FDP1_2 17
39#define R8A7790_CLK_FDP1_1 18
40#define R8A7790_CLK_FDP1_0 19
31#define R8A7790_CLK_TMU3 21 41#define R8A7790_CLK_TMU3 21
32#define R8A7790_CLK_TMU2 22 42#define R8A7790_CLK_TMU2 22
33#define R8A7790_CLK_CMT0 24 43#define R8A7790_CLK_CMT0 24
@@ -68,6 +78,8 @@
68#define R8A7790_CLK_USBDMAC1 31 78#define R8A7790_CLK_USBDMAC1 31
69 79
70/* MSTP5 */ 80/* MSTP5 */
81#define R8A7790_CLK_AUDIO_DMAC1 1
82#define R8A7790_CLK_AUDIO_DMAC0 2
71#define R8A7790_CLK_THERMAL 22 83#define R8A7790_CLK_THERMAL 22
72#define R8A7790_CLK_PWM 23 84#define R8A7790_CLK_PWM 23
73 85
diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h
index 58c3f49d068c..3ea2bbc0da3f 100644
--- a/include/dt-bindings/clock/r8a7791-clock.h
+++ b/include/dt-bindings/clock/r8a7791-clock.h
@@ -25,8 +25,15 @@
25#define R8A7791_CLK_MSIOF0 0 25#define R8A7791_CLK_MSIOF0 0
26 26
27/* MSTP1 */ 27/* MSTP1 */
28#define R8A7791_CLK_JPU 6 28#define R8A7791_CLK_VCP0 1
29#define R8A7791_CLK_VPC0 3
30#define R8A7791_CLK_JPU 6
31#define R8A7791_CLK_SSP1 9
29#define R8A7791_CLK_TMU1 11 32#define R8A7791_CLK_TMU1 11
33#define R8A7791_CLK_3DG 12
34#define R8A7791_CLK_2DDMAC 15
35#define R8A7791_CLK_FDP1_1 18
36#define R8A7791_CLK_FDP1_0 19
30#define R8A7791_CLK_TMU3 21 37#define R8A7791_CLK_TMU3 21
31#define R8A7791_CLK_TMU2 22 38#define R8A7791_CLK_TMU2 22
32#define R8A7791_CLK_CMT0 24 39#define R8A7791_CLK_CMT0 24
@@ -62,6 +69,8 @@
62#define R8A7791_CLK_USBDMAC1 31 69#define R8A7791_CLK_USBDMAC1 31
63 70
64/* MSTP5 */ 71/* MSTP5 */
72#define R8A7791_CLK_AUDIO_DMAC1 1
73#define R8A7791_CLK_AUDIO_DMAC0 2
65#define R8A7791_CLK_THERMAL 22 74#define R8A7791_CLK_THERMAL 22
66#define R8A7791_CLK_PWM 23 75#define R8A7791_CLK_PWM 23
67 76
diff --git a/include/dt-bindings/clock/r8a7794-clock.h b/include/dt-bindings/clock/r8a7794-clock.h
index 9ac1043e25bc..aa9c286e60c0 100644
--- a/include/dt-bindings/clock/r8a7794-clock.h
+++ b/include/dt-bindings/clock/r8a7794-clock.h
@@ -26,11 +26,18 @@
26#define R8A7794_CLK_MSIOF0 0 26#define R8A7794_CLK_MSIOF0 0
27 27
28/* MSTP1 */ 28/* MSTP1 */
29#define R8A7794_CLK_VCP0 1
30#define R8A7794_CLK_VPC0 3
29#define R8A7794_CLK_TMU1 11 31#define R8A7794_CLK_TMU1 11
32#define R8A7794_CLK_3DG 12
33#define R8A7794_CLK_2DDMAC 15
34#define R8A7794_CLK_FDP1_0 19
30#define R8A7794_CLK_TMU3 21 35#define R8A7794_CLK_TMU3 21
31#define R8A7794_CLK_TMU2 22 36#define R8A7794_CLK_TMU2 22
32#define R8A7794_CLK_CMT0 24 37#define R8A7794_CLK_CMT0 24
33#define R8A7794_CLK_TMU0 25 38#define R8A7794_CLK_TMU0 25
39#define R8A7794_CLK_VSP1_DU0 28
40#define R8A7794_CLK_VSP1_S 31
34 41
35/* MSTP2 */ 42/* MSTP2 */
36#define R8A7794_CLK_SCIFA2 2 43#define R8A7794_CLK_SCIFA2 2
@@ -61,6 +68,8 @@
61#define R8A7794_CLK_SCIF0 21 68#define R8A7794_CLK_SCIF0 21
62 69
63/* MSTP8 */ 70/* MSTP8 */
71#define R8A7794_CLK_VIN1 10
72#define R8A7794_CLK_VIN0 11
64#define R8A7794_CLK_ETHER 13 73#define R8A7794_CLK_ETHER 13
65 74
66/* MSTP9 */ 75/* MSTP9 */
diff --git a/include/dt-bindings/clock/stih407-clks.h b/include/dt-bindings/clock/stih407-clks.h
new file mode 100644
index 000000000000..7af2b717b3b2
--- /dev/null
+++ b/include/dt-bindings/clock/stih407-clks.h
@@ -0,0 +1,86 @@
1/*
2 * This header provides constants clk index STMicroelectronics
3 * STiH407 SoC.
4 */
5#ifndef _DT_BINDINGS_CLK_STIH407
6#define _DT_BINDINGS_CLK_STIH407
7
8/* CLOCKGEN C0 */
9#define CLK_ICN_GPU 0
10#define CLK_FDMA 1
11#define CLK_NAND 2
12#define CLK_HVA 3
13#define CLK_PROC_STFE 4
14#define CLK_PROC_TP 5
15#define CLK_RX_ICN_DMU 6
16#define CLK_RX_ICN_DISP_0 6
17#define CLK_RX_ICN_DISP_1 6
18#define CLK_RX_ICN_HVA 7
19#define CLK_RX_ICN_TS 7
20#define CLK_ICN_CPU 8
21#define CLK_TX_ICN_DMU 9
22#define CLK_TX_ICN_HVA 9
23#define CLK_TX_ICN_TS 9
24#define CLK_ICN_COMPO 9
25#define CLK_MMC_0 10
26#define CLK_MMC_1 11
27#define CLK_JPEGDEC 12
28#define CLK_ICN_REG 13
29#define CLK_TRACE_A9 13
30#define CLK_PTI_STM 13
31#define CLK_EXT2F_A9 13
32#define CLK_IC_BDISP_0 14
33#define CLK_IC_BDISP_1 15
34#define CLK_PP_DMU 16
35#define CLK_VID_DMU 17
36#define CLK_DSS_LPC 18
37#define CLK_ST231_AUD_0 19
38#define CLK_ST231_GP_0 19
39#define CLK_ST231_GP_1 20
40#define CLK_ST231_DMU 21
41#define CLK_ICN_LMI 22
42#define CLK_TX_ICN_DISP_0 23
43#define CLK_TX_ICN_DISP_1 23
44#define CLK_ICN_SBC 24
45#define CLK_STFE_FRC2 25
46#define CLK_ETH_PHY 26
47#define CLK_ETH_REF_PHYCLK 27
48#define CLK_FLASH_PROMIP 28
49#define CLK_MAIN_DISP 29
50#define CLK_AUX_DISP 30
51#define CLK_COMPO_DVP 31
52
53/* CLOCKGEN D0 */
54#define CLK_PCM_0 0
55#define CLK_PCM_1 1
56#define CLK_PCM_2 2
57#define CLK_SPDIFF 3
58
59/* CLOCKGEN D2 */
60#define CLK_PIX_MAIN_DISP 0
61#define CLK_PIX_PIP 1
62#define CLK_PIX_GDP1 2
63#define CLK_PIX_GDP2 3
64#define CLK_PIX_GDP3 4
65#define CLK_PIX_GDP4 5
66#define CLK_PIX_AUX_DISP 6
67#define CLK_DENC 7
68#define CLK_PIX_HDDAC 8
69#define CLK_HDDAC 9
70#define CLK_SDDAC 10
71#define CLK_PIX_DVO 11
72#define CLK_DVO 12
73#define CLK_PIX_HDMI 13
74#define CLK_TMDS_HDMI 14
75#define CLK_REF_HDMIPHY 15
76
77/* CLOCKGEN D3 */
78#define CLK_STFE_FRC1 0
79#define CLK_TSOUT_0 1
80#define CLK_TSOUT_1 2
81#define CLK_MCHI 3
82#define CLK_VSENS_COMPO 4
83#define CLK_FRC1_REMOTE 5
84#define CLK_LPC_0 6
85#define CLK_LPC_1 7
86#endif
diff --git a/include/dt-bindings/clock/stih410-clks.h b/include/dt-bindings/clock/stih410-clks.h
new file mode 100644
index 000000000000..2097a4bbe155
--- /dev/null
+++ b/include/dt-bindings/clock/stih410-clks.h
@@ -0,0 +1,25 @@
1/*
2 * This header provides constants clk index STMicroelectronics
3 * STiH410 SoC.
4 */
5#ifndef _DT_BINDINGS_CLK_STIH410
6#define _DT_BINDINGS_CLK_STIH410
7
8#include "stih407-clks.h"
9
10/* STiH410 introduces new clock outputs compared to STiH407 */
11
12/* CLOCKGEN C0 */
13#define CLK_TX_ICN_HADES 32
14#define CLK_RX_ICN_HADES 33
15#define CLK_ICN_REG_16 34
16#define CLK_PP_HADES 35
17#define CLK_CLUST_HADES 36
18#define CLK_HWPE_HADES 37
19#define CLK_FC_HADES 38
20
21/* CLOCKGEN D0 */
22#define CLK_PCMR10_MASTER 4
23#define CLK_USB2_PHY 5
24
25#endif
diff --git a/include/dt-bindings/clock/tegra114-car.h b/include/dt-bindings/clock/tegra114-car.h
index fc12621fb432..534c03f8ad72 100644
--- a/include/dt-bindings/clock/tegra114-car.h
+++ b/include/dt-bindings/clock/tegra114-car.h
@@ -49,7 +49,7 @@
49#define TEGRA114_CLK_I2S0 30 49#define TEGRA114_CLK_I2S0 30
50/* 31 */ 50/* 31 */
51 51
52/* 32 */ 52#define TEGRA114_CLK_MC 32
53/* 33 */ 53/* 33 */
54#define TEGRA114_CLK_APBDMA 34 54#define TEGRA114_CLK_APBDMA 34
55/* 35 */ 55/* 35 */
diff --git a/include/dt-bindings/clock/tegra124-car.h b/include/dt-bindings/clock/tegra124-car.h
index 6bac637fd635..af9bc9a3ddbc 100644
--- a/include/dt-bindings/clock/tegra124-car.h
+++ b/include/dt-bindings/clock/tegra124-car.h
@@ -48,7 +48,7 @@
48#define TEGRA124_CLK_I2S0 30 48#define TEGRA124_CLK_I2S0 30
49/* 31 */ 49/* 31 */
50 50
51/* 32 */ 51#define TEGRA124_CLK_MC 32
52/* 33 */ 52/* 33 */
53#define TEGRA124_CLK_APBDMA 34 53#define TEGRA124_CLK_APBDMA 34
54/* 35 */ 54/* 35 */
diff --git a/include/dt-bindings/clock/tegra20-car.h b/include/dt-bindings/clock/tegra20-car.h
index 9406207cfac8..04500b243a4d 100644
--- a/include/dt-bindings/clock/tegra20-car.h
+++ b/include/dt-bindings/clock/tegra20-car.h
@@ -49,7 +49,7 @@
49/* 30 */ 49/* 30 */
50#define TEGRA20_CLK_CACHE2 31 50#define TEGRA20_CLK_CACHE2 31
51 51
52#define TEGRA20_CLK_MEM 32 52#define TEGRA20_CLK_MC 32
53#define TEGRA20_CLK_AHBDMA 33 53#define TEGRA20_CLK_AHBDMA 33
54#define TEGRA20_CLK_APBDMA 34 54#define TEGRA20_CLK_APBDMA 34
55/* 35 */ 55/* 35 */
diff --git a/include/dt-bindings/dma/at91.h b/include/dt-bindings/dma/at91.h
index e835037a77b4..ab6cbba45401 100644
--- a/include/dt-bindings/dma/at91.h
+++ b/include/dt-bindings/dma/at91.h
@@ -9,6 +9,8 @@
9#ifndef __DT_BINDINGS_AT91_DMA_H__ 9#ifndef __DT_BINDINGS_AT91_DMA_H__
10#define __DT_BINDINGS_AT91_DMA_H__ 10#define __DT_BINDINGS_AT91_DMA_H__
11 11
12/* ---------- HDMAC ---------- */
13
12/* 14/*
13 * Source and/or destination peripheral ID 15 * Source and/or destination peripheral ID
14 */ 16 */
@@ -24,4 +26,27 @@
24#define AT91_DMA_CFG_FIFOCFG_ALAP (0x1 << AT91_DMA_CFG_FIFOCFG_OFFSET) /* largest defined AHB burst */ 26#define AT91_DMA_CFG_FIFOCFG_ALAP (0x1 << AT91_DMA_CFG_FIFOCFG_OFFSET) /* largest defined AHB burst */
25#define AT91_DMA_CFG_FIFOCFG_ASAP (0x2 << AT91_DMA_CFG_FIFOCFG_OFFSET) /* single AHB access */ 27#define AT91_DMA_CFG_FIFOCFG_ASAP (0x2 << AT91_DMA_CFG_FIFOCFG_OFFSET) /* single AHB access */
26 28
29
30/* ---------- XDMAC ---------- */
31#define AT91_XDMAC_DT_MEM_IF_MASK (0x1)
32#define AT91_XDMAC_DT_MEM_IF_OFFSET (13)
33#define AT91_XDMAC_DT_MEM_IF(mem_if) (((mem_if) & AT91_XDMAC_DT_MEM_IF_MASK) \
34 << AT91_XDMAC_DT_MEM_IF_OFFSET)
35#define AT91_XDMAC_DT_GET_MEM_IF(cfg) (((cfg) >> AT91_XDMAC_DT_MEM_IF_OFFSET) \
36 & AT91_XDMAC_DT_MEM_IF_MASK)
37
38#define AT91_XDMAC_DT_PER_IF_MASK (0x1)
39#define AT91_XDMAC_DT_PER_IF_OFFSET (14)
40#define AT91_XDMAC_DT_PER_IF(per_if) (((per_if) & AT91_XDMAC_DT_PER_IF_MASK) \
41 << AT91_XDMAC_DT_PER_IF_OFFSET)
42#define AT91_XDMAC_DT_GET_PER_IF(cfg) (((cfg) >> AT91_XDMAC_DT_PER_IF_OFFSET) \
43 & AT91_XDMAC_DT_PER_IF_MASK)
44
45#define AT91_XDMAC_DT_PERID_MASK (0x7f)
46#define AT91_XDMAC_DT_PERID_OFFSET (24)
47#define AT91_XDMAC_DT_PERID(perid) (((perid) & AT91_XDMAC_DT_PERID_MASK) \
48 << AT91_XDMAC_DT_PERID_OFFSET)
49#define AT91_XDMAC_DT_GET_PERID(cfg) (((cfg) >> AT91_XDMAC_DT_PERID_OFFSET) \
50 & AT91_XDMAC_DT_PERID_MASK)
51
27#endif /* __DT_BINDINGS_AT91_DMA_H__ */ 52#endif /* __DT_BINDINGS_AT91_DMA_H__ */
diff --git a/include/dt-bindings/interrupt-controller/mips-gic.h b/include/dt-bindings/interrupt-controller/mips-gic.h
new file mode 100644
index 000000000000..cf35a577e371
--- /dev/null
+++ b/include/dt-bindings/interrupt-controller/mips-gic.h
@@ -0,0 +1,9 @@
1#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_MIPS_GIC_H
2#define _DT_BINDINGS_INTERRUPT_CONTROLLER_MIPS_GIC_H
3
4#include <dt-bindings/interrupt-controller/irq.h>
5
6#define GIC_SHARED 0
7#define GIC_LOCAL 1
8
9#endif
diff --git a/include/dt-bindings/memory/tegra114-mc.h b/include/dt-bindings/memory/tegra114-mc.h
new file mode 100644
index 000000000000..8f48985a3139
--- /dev/null
+++ b/include/dt-bindings/memory/tegra114-mc.h
@@ -0,0 +1,25 @@
1#ifndef DT_BINDINGS_MEMORY_TEGRA114_MC_H
2#define DT_BINDINGS_MEMORY_TEGRA114_MC_H
3
4#define TEGRA_SWGROUP_PTC 0
5#define TEGRA_SWGROUP_DC 1
6#define TEGRA_SWGROUP_DCB 2
7#define TEGRA_SWGROUP_EPP 3
8#define TEGRA_SWGROUP_G2 4
9#define TEGRA_SWGROUP_AVPC 5
10#define TEGRA_SWGROUP_NV 6
11#define TEGRA_SWGROUP_HDA 7
12#define TEGRA_SWGROUP_HC 8
13#define TEGRA_SWGROUP_MSENC 9
14#define TEGRA_SWGROUP_PPCS 10
15#define TEGRA_SWGROUP_VDE 11
16#define TEGRA_SWGROUP_MPCORELP 12
17#define TEGRA_SWGROUP_MPCORE 13
18#define TEGRA_SWGROUP_VI 14
19#define TEGRA_SWGROUP_ISP 15
20#define TEGRA_SWGROUP_XUSB_HOST 16
21#define TEGRA_SWGROUP_XUSB_DEV 17
22#define TEGRA_SWGROUP_EMUCIF 18
23#define TEGRA_SWGROUP_TSEC 19
24
25#endif
diff --git a/include/dt-bindings/memory/tegra124-mc.h b/include/dt-bindings/memory/tegra124-mc.h
new file mode 100644
index 000000000000..7d8ee798f34e
--- /dev/null
+++ b/include/dt-bindings/memory/tegra124-mc.h
@@ -0,0 +1,31 @@
1#ifndef DT_BINDINGS_MEMORY_TEGRA124_MC_H
2#define DT_BINDINGS_MEMORY_TEGRA124_MC_H
3
4#define TEGRA_SWGROUP_PTC 0
5#define TEGRA_SWGROUP_DC 1
6#define TEGRA_SWGROUP_DCB 2
7#define TEGRA_SWGROUP_AFI 3
8#define TEGRA_SWGROUP_AVPC 4
9#define TEGRA_SWGROUP_HDA 5
10#define TEGRA_SWGROUP_HC 6
11#define TEGRA_SWGROUP_MSENC 7
12#define TEGRA_SWGROUP_PPCS 8
13#define TEGRA_SWGROUP_SATA 9
14#define TEGRA_SWGROUP_VDE 10
15#define TEGRA_SWGROUP_MPCORELP 11
16#define TEGRA_SWGROUP_MPCORE 12
17#define TEGRA_SWGROUP_ISP2 13
18#define TEGRA_SWGROUP_XUSB_HOST 14
19#define TEGRA_SWGROUP_XUSB_DEV 15
20#define TEGRA_SWGROUP_ISP2B 16
21#define TEGRA_SWGROUP_TSEC 17
22#define TEGRA_SWGROUP_A9AVP 18
23#define TEGRA_SWGROUP_GPU 19
24#define TEGRA_SWGROUP_SDMMC1A 20
25#define TEGRA_SWGROUP_SDMMC2A 21
26#define TEGRA_SWGROUP_SDMMC3A 22
27#define TEGRA_SWGROUP_SDMMC4A 23
28#define TEGRA_SWGROUP_VIC 24
29#define TEGRA_SWGROUP_VI 25
30
31#endif
diff --git a/include/dt-bindings/memory/tegra30-mc.h b/include/dt-bindings/memory/tegra30-mc.h
new file mode 100644
index 000000000000..502beb03d777
--- /dev/null
+++ b/include/dt-bindings/memory/tegra30-mc.h
@@ -0,0 +1,24 @@
1#ifndef DT_BINDINGS_MEMORY_TEGRA30_MC_H
2#define DT_BINDINGS_MEMORY_TEGRA30_MC_H
3
4#define TEGRA_SWGROUP_PTC 0
5#define TEGRA_SWGROUP_DC 1
6#define TEGRA_SWGROUP_DCB 2
7#define TEGRA_SWGROUP_EPP 3
8#define TEGRA_SWGROUP_G2 4
9#define TEGRA_SWGROUP_MPE 5
10#define TEGRA_SWGROUP_VI 6
11#define TEGRA_SWGROUP_AFI 7
12#define TEGRA_SWGROUP_AVPC 8
13#define TEGRA_SWGROUP_NV 9
14#define TEGRA_SWGROUP_NV2 10
15#define TEGRA_SWGROUP_HDA 11
16#define TEGRA_SWGROUP_HC 12
17#define TEGRA_SWGROUP_PPCS 13
18#define TEGRA_SWGROUP_SATA 14
19#define TEGRA_SWGROUP_VDE 15
20#define TEGRA_SWGROUP_MPCORELP 16
21#define TEGRA_SWGROUP_MPCORE 17
22#define TEGRA_SWGROUP_ISP 18
23
24#endif
diff --git a/include/dt-bindings/phy/phy.h b/include/dt-bindings/phy/phy.h
new file mode 100644
index 000000000000..6c901930eb3e
--- /dev/null
+++ b/include/dt-bindings/phy/phy.h
@@ -0,0 +1,19 @@
1/*
2 *
3 * This header provides constants for the phy framework
4 *
5 * Copyright (C) 2014 STMicroelectronics
6 * Author: Gabriel Fernandez <gabriel.fernandez@st.com>
7 * License terms: GNU General Public License (GPL), version 2
8 */
9
10#ifndef _DT_BINDINGS_PHY
11#define _DT_BINDINGS_PHY
12
13#define PHY_NONE 0
14#define PHY_TYPE_SATA 1
15#define PHY_TYPE_PCIE 2
16#define PHY_TYPE_USB2 3
17#define PHY_TYPE_USB3 4
18
19#endif /* _DT_BINDINGS_PHY */
diff --git a/include/dt-bindings/pinctrl/qcom,pmic-gpio.h b/include/dt-bindings/pinctrl/qcom,pmic-gpio.h
new file mode 100644
index 000000000000..fa74d7cc960c
--- /dev/null
+++ b/include/dt-bindings/pinctrl/qcom,pmic-gpio.h
@@ -0,0 +1,142 @@
1/*
2 * This header provides constants for the Qualcomm PMIC GPIO binding.
3 */
4
5#ifndef _DT_BINDINGS_PINCTRL_QCOM_PMIC_GPIO_H
6#define _DT_BINDINGS_PINCTRL_QCOM_PMIC_GPIO_H
7
8#define PMIC_GPIO_PULL_UP_30 0
9#define PMIC_GPIO_PULL_UP_1P5 1
10#define PMIC_GPIO_PULL_UP_31P5 2
11#define PMIC_GPIO_PULL_UP_1P5_30 3
12
13#define PMIC_GPIO_STRENGTH_NO 0
14#define PMIC_GPIO_STRENGTH_HIGH 1
15#define PMIC_GPIO_STRENGTH_MED 2
16#define PMIC_GPIO_STRENGTH_LOW 3
17
18/*
19 * Note: PM8018 GPIO3 and GPIO4 are supporting
20 * only S3 and L2 options (1.8V)
21 */
22#define PM8018_GPIO_L6 0
23#define PM8018_GPIO_L5 1
24#define PM8018_GPIO_S3 2
25#define PM8018_GPIO_L14 3
26#define PM8018_GPIO_L2 4
27#define PM8018_GPIO_L4 5
28#define PM8018_GPIO_VDD 6
29
30/*
31 * Note: PM8038 GPIO7 and GPIO8 are supporting
32 * only L11 and L4 options (1.8V)
33 */
34#define PM8038_GPIO_VPH 0
35#define PM8038_GPIO_BB 1
36#define PM8038_GPIO_L11 2
37#define PM8038_GPIO_L15 3
38#define PM8038_GPIO_L4 4
39#define PM8038_GPIO_L3 5
40#define PM8038_GPIO_L17 6
41
42#define PM8058_GPIO_VPH 0
43#define PM8058_GPIO_BB 1
44#define PM8058_GPIO_S3 2
45#define PM8058_GPIO_L3 3
46#define PM8058_GPIO_L7 4
47#define PM8058_GPIO_L6 5
48#define PM8058_GPIO_L5 6
49#define PM8058_GPIO_L2 7
50
51#define PM8917_GPIO_VPH 0
52#define PM8917_GPIO_S4 2
53#define PM8917_GPIO_L15 3
54#define PM8917_GPIO_L4 4
55#define PM8917_GPIO_L3 5
56#define PM8917_GPIO_L17 6
57
58#define PM8921_GPIO_VPH 0
59#define PM8921_GPIO_BB 1
60#define PM8921_GPIO_S4 2
61#define PM8921_GPIO_L15 3
62#define PM8921_GPIO_L4 4
63#define PM8921_GPIO_L3 5
64#define PM8921_GPIO_L17 6
65
66/*
67 * Note: PM8941 gpios from 15 to 18 are supporting
68 * only S3 and L6 options (1.8V)
69 */
70#define PM8941_GPIO_VPH 0
71#define PM8941_GPIO_L1 1
72#define PM8941_GPIO_S3 2
73#define PM8941_GPIO_L6 3
74
75/*
76 * Note: PMA8084 gpios from 15 to 18 are supporting
77 * only S4 and L6 options (1.8V)
78 */
79#define PMA8084_GPIO_VPH 0
80#define PMA8084_GPIO_L1 1
81#define PMA8084_GPIO_S4 2
82#define PMA8084_GPIO_L6 3
83
84/* To be used with "function" */
85#define PMIC_GPIO_FUNC_NORMAL "normal"
86#define PMIC_GPIO_FUNC_PAIRED "paired"
87#define PMIC_GPIO_FUNC_FUNC1 "func1"
88#define PMIC_GPIO_FUNC_FUNC2 "func2"
89#define PMIC_GPIO_FUNC_DTEST1 "dtest1"
90#define PMIC_GPIO_FUNC_DTEST2 "dtest2"
91#define PMIC_GPIO_FUNC_DTEST3 "dtest3"
92#define PMIC_GPIO_FUNC_DTEST4 "dtest4"
93
94#define PM8038_GPIO1_2_LPG_DRV PMIC_GPIO_FUNC_FUNC1
95#define PM8038_GPIO3_5V_BOOST_EN PMIC_GPIO_FUNC_FUNC1
96#define PM8038_GPIO4_SSBI_ALT_CLK PMIC_GPIO_FUNC_FUNC1
97#define PM8038_GPIO5_6_EXT_REG_EN PMIC_GPIO_FUNC_FUNC1
98#define PM8038_GPIO10_11_EXT_REG_EN PMIC_GPIO_FUNC_FUNC1
99#define PM8038_GPIO6_7_CLK PMIC_GPIO_FUNC_FUNC1
100#define PM8038_GPIO9_BAT_ALRM_OUT PMIC_GPIO_FUNC_FUNC1
101#define PM8038_GPIO6_12_KYPD_DRV PMIC_GPIO_FUNC_FUNC2
102
103#define PM8058_GPIO7_8_MP3_CLK PMIC_GPIO_FUNC_FUNC1
104#define PM8058_GPIO7_8_BCLK_19P2MHZ PMIC_GPIO_FUNC_FUNC2
105#define PM8058_GPIO9_26_KYPD_DRV PMIC_GPIO_FUNC_FUNC1
106#define PM8058_GPIO21_23_UART_TX PMIC_GPIO_FUNC_FUNC2
107#define PM8058_GPIO24_26_LPG_DRV PMIC_GPIO_FUNC_FUNC2
108#define PM8058_GPIO33_BCLK_19P2MHZ PMIC_GPIO_FUNC_FUNC1
109#define PM8058_GPIO34_35_MP3_CLK PMIC_GPIO_FUNC_FUNC1
110#define PM8058_GPIO36_BCLK_19P2MHZ PMIC_GPIO_FUNC_FUNC1
111#define PM8058_GPIO37_UPL_OUT PMIC_GPIO_FUNC_FUNC1
112#define PM8058_GPIO37_UART_M_RX PMIC_GPIO_FUNC_FUNC2
113#define PM8058_GPIO38_XO_SLEEP_CLK PMIC_GPIO_FUNC_FUNC1
114#define PM8058_GPIO38_39_CLK_32KHZ PMIC_GPIO_FUNC_FUNC2
115#define PM8058_GPIO39_MP3_CLK PMIC_GPIO_FUNC_FUNC1
116#define PM8058_GPIO40_EXT_BB_EN PMIC_GPIO_FUNC_FUNC1
117
118#define PM8917_GPIO9_18_KEYP_DRV PMIC_GPIO_FUNC_FUNC1
119#define PM8917_GPIO20_BAT_ALRM_OUT PMIC_GPIO_FUNC_FUNC1
120#define PM8917_GPIO21_23_UART_TX PMIC_GPIO_FUNC_FUNC2
121#define PM8917_GPIO25_26_EXT_REG_EN PMIC_GPIO_FUNC_FUNC1
122#define PM8917_GPIO37_38_XO_SLEEP_CLK PMIC_GPIO_FUNC_FUNC1
123#define PM8917_GPIO37_38_MP3_CLK PMIC_GPIO_FUNC_FUNC2
124
125#define PM8941_GPIO9_14_KYPD_DRV PMIC_GPIO_FUNC_FUNC1
126#define PM8941_GPIO15_18_DIV_CLK PMIC_GPIO_FUNC_FUNC1
127#define PM8941_GPIO15_18_SLEEP_CLK PMIC_GPIO_FUNC_FUNC2
128#define PM8941_GPIO23_26_KYPD_DRV PMIC_GPIO_FUNC_FUNC1
129#define PM8941_GPIO23_26_LPG_DRV_HI PMIC_GPIO_FUNC_FUNC2
130#define PM8941_GPIO31_BAT_ALRM_OUT PMIC_GPIO_FUNC_FUNC1
131#define PM8941_GPIO33_36_LPG_DRV_3D PMIC_GPIO_FUNC_FUNC1
132#define PM8941_GPIO33_36_LPG_DRV_HI PMIC_GPIO_FUNC_FUNC2
133
134#define PMA8084_GPIO4_5_LPG_DRV PMIC_GPIO_FUNC_FUNC1
135#define PMA8084_GPIO7_10_LPG_DRV PMIC_GPIO_FUNC_FUNC1
136#define PMA8084_GPIO5_14_KEYP_DRV PMIC_GPIO_FUNC_FUNC2
137#define PMA8084_GPIO19_21_KEYP_DRV PMIC_GPIO_FUNC_FUNC2
138#define PMA8084_GPIO15_18_DIV_CLK PMIC_GPIO_FUNC_FUNC1
139#define PMA8084_GPIO15_18_SLEEP_CLK PMIC_GPIO_FUNC_FUNC2
140#define PMA8084_GPIO22_BAT_ALRM_OUT PMIC_GPIO_FUNC_FUNC1
141
142#endif
diff --git a/include/dt-bindings/pinctrl/qcom,pmic-mpp.h b/include/dt-bindings/pinctrl/qcom,pmic-mpp.h
new file mode 100644
index 000000000000..d2c7dabe3223
--- /dev/null
+++ b/include/dt-bindings/pinctrl/qcom,pmic-mpp.h
@@ -0,0 +1,44 @@
1/*
2 * This header provides constants for the Qualcomm PMIC's
3 * Multi-Purpose Pin binding.
4 */
5
6#ifndef _DT_BINDINGS_PINCTRL_QCOM_PMIC_MPP_H
7#define _DT_BINDINGS_PINCTRL_QCOM_PMIC_MPP_H
8
9/* power-source */
10#define PM8841_MPP_VPH 0
11#define PM8841_MPP_S3 2
12
13#define PM8941_MPP_VPH 0
14#define PM8941_MPP_L1 1
15#define PM8941_MPP_S3 2
16#define PM8941_MPP_L6 3
17
18#define PMA8084_MPP_VPH 0
19#define PMA8084_MPP_L1 1
20#define PMA8084_MPP_S4 2
21#define PMA8084_MPP_L6 3
22
23/*
24 * Analog Input - Set the source for analog input.
25 * To be used with "qcom,amux-route" property
26 */
27#define PMIC_MPP_AMUX_ROUTE_CH5 0
28#define PMIC_MPP_AMUX_ROUTE_CH6 1
29#define PMIC_MPP_AMUX_ROUTE_CH7 2
30#define PMIC_MPP_AMUX_ROUTE_CH8 3
31#define PMIC_MPP_AMUX_ROUTE_ABUS1 4
32#define PMIC_MPP_AMUX_ROUTE_ABUS2 5
33#define PMIC_MPP_AMUX_ROUTE_ABUS3 6
34#define PMIC_MPP_AMUX_ROUTE_ABUS4 7
35
36/* To be used with "function" */
37#define PMIC_MPP_FUNC_NORMAL "normal"
38#define PMIC_MPP_FUNC_PAIRED "paired"
39#define PMIC_MPP_FUNC_DTEST1 "dtest1"
40#define PMIC_MPP_FUNC_DTEST2 "dtest2"
41#define PMIC_MPP_FUNC_DTEST3 "dtest3"
42#define PMIC_MPP_FUNC_DTEST4 "dtest4"
43
44#endif
diff --git a/include/dt-bindings/regulator/maxim,max77802.h b/include/dt-bindings/regulator/maxim,max77802.h
new file mode 100644
index 000000000000..cf28631d7109
--- /dev/null
+++ b/include/dt-bindings/regulator/maxim,max77802.h
@@ -0,0 +1,18 @@
1/*
2 * Copyright (C) 2014 Google, 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 version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Device Tree binding constants for the Maxim 77802 PMIC regulators
9 */
10
11#ifndef _DT_BINDINGS_REGULATOR_MAXIM_MAX77802_H
12#define _DT_BINDINGS_REGULATOR_MAXIM_MAX77802_H
13
14/* Regulator operating modes */
15#define MAX77802_OPMODE_LP 1
16#define MAX77802_OPMODE_NORMAL 3
17
18#endif /* _DT_BINDINGS_REGULATOR_MAXIM_MAX77802_H */
diff --git a/include/dt-bindings/reset-controller/stih407-resets.h b/include/dt-bindings/reset-controller/stih407-resets.h
new file mode 100644
index 000000000000..02d4328fe479
--- /dev/null
+++ b/include/dt-bindings/reset-controller/stih407-resets.h
@@ -0,0 +1,61 @@
1/*
2 * This header provides constants for the reset controller
3 * based peripheral powerdown requests on the STMicroelectronics
4 * STiH407 SoC.
5 */
6#ifndef _DT_BINDINGS_RESET_CONTROLLER_STIH407
7#define _DT_BINDINGS_RESET_CONTROLLER_STIH407
8
9/* Powerdown requests control 0 */
10#define STIH407_EMISS_POWERDOWN 0
11#define STIH407_NAND_POWERDOWN 1
12
13/* Synp GMAC PowerDown */
14#define STIH407_ETH1_POWERDOWN 2
15
16/* Powerdown requests control 1 */
17#define STIH407_USB3_POWERDOWN 3
18#define STIH407_USB2_PORT1_POWERDOWN 4
19#define STIH407_USB2_PORT0_POWERDOWN 5
20#define STIH407_PCIE1_POWERDOWN 6
21#define STIH407_PCIE0_POWERDOWN 7
22#define STIH407_SATA1_POWERDOWN 8
23#define STIH407_SATA0_POWERDOWN 9
24
25/* Reset defines */
26#define STIH407_ETH1_SOFTRESET 0
27#define STIH407_MMC1_SOFTRESET 1
28#define STIH407_PICOPHY_SOFTRESET 2
29#define STIH407_IRB_SOFTRESET 3
30#define STIH407_PCIE0_SOFTRESET 4
31#define STIH407_PCIE1_SOFTRESET 5
32#define STIH407_SATA0_SOFTRESET 6
33#define STIH407_SATA1_SOFTRESET 7
34#define STIH407_MIPHY0_SOFTRESET 8
35#define STIH407_MIPHY1_SOFTRESET 9
36#define STIH407_MIPHY2_SOFTRESET 10
37#define STIH407_SATA0_PWR_SOFTRESET 11
38#define STIH407_SATA1_PWR_SOFTRESET 12
39#define STIH407_DELTA_SOFTRESET 13
40#define STIH407_BLITTER_SOFTRESET 14
41#define STIH407_HDTVOUT_SOFTRESET 15
42#define STIH407_HDQVDP_SOFTRESET 16
43#define STIH407_VDP_AUX_SOFTRESET 17
44#define STIH407_COMPO_SOFTRESET 18
45#define STIH407_HDMI_TX_PHY_SOFTRESET 19
46#define STIH407_JPEG_DEC_SOFTRESET 20
47#define STIH407_VP8_DEC_SOFTRESET 21
48#define STIH407_GPU_SOFTRESET 22
49#define STIH407_HVA_SOFTRESET 23
50#define STIH407_ERAM_HVA_SOFTRESET 24
51#define STIH407_LPM_SOFTRESET 25
52#define STIH407_KEYSCAN_SOFTRESET 26
53#define STIH407_USB2_PORT0_SOFTRESET 27
54#define STIH407_USB2_PORT1_SOFTRESET 28
55
56/* Picophy reset defines */
57#define STIH407_PICOPHY0_RESET 0
58#define STIH407_PICOPHY1_RESET 1
59#define STIH407_PICOPHY2_RESET 2
60
61#endif /* _DT_BINDINGS_RESET_CONTROLLER_STIH407 */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 407a12f663eb..6bff83b1f298 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -28,6 +28,7 @@
28#include <linux/errno.h> 28#include <linux/errno.h>
29#include <linux/ioport.h> /* for struct resource */ 29#include <linux/ioport.h> /* for struct resource */
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/property.h>
31 32
32#ifndef _LINUX 33#ifndef _LINUX
33#define _LINUX 34#define _LINUX
@@ -123,6 +124,10 @@ int acpi_numa_init (void);
123 124
124int acpi_table_init (void); 125int acpi_table_init (void);
125int acpi_table_parse(char *id, acpi_tbl_table_handler handler); 126int acpi_table_parse(char *id, acpi_tbl_table_handler handler);
127int __init acpi_parse_entries(char *id, unsigned long table_size,
128 acpi_tbl_entry_handler handler,
129 struct acpi_table_header *table_header,
130 int entry_id, unsigned int max_entries);
126int __init acpi_table_parse_entries(char *id, unsigned long table_size, 131int __init acpi_table_parse_entries(char *id, unsigned long table_size,
127 int entry_id, 132 int entry_id,
128 acpi_tbl_entry_handler handler, 133 acpi_tbl_entry_handler handler,
@@ -423,14 +428,11 @@ extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
423const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, 428const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
424 const struct device *dev); 429 const struct device *dev);
425 430
426static inline bool acpi_driver_match_device(struct device *dev, 431extern bool acpi_driver_match_device(struct device *dev,
427 const struct device_driver *drv) 432 const struct device_driver *drv);
428{
429 return !!acpi_match_device(drv->acpi_match_table, dev);
430}
431
432int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); 433int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *);
433int acpi_device_modalias(struct device *, char *, int); 434int acpi_device_modalias(struct device *, char *, int);
435void acpi_walk_dep_device_list(acpi_handle handle);
434 436
435struct platform_device *acpi_create_platform_device(struct acpi_device *); 437struct platform_device *acpi_create_platform_device(struct acpi_device *);
436#define ACPI_PTR(_ptr) (_ptr) 438#define ACPI_PTR(_ptr) (_ptr)
@@ -443,6 +445,23 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *);
443#define ACPI_COMPANION_SET(dev, adev) do { } while (0) 445#define ACPI_COMPANION_SET(dev, adev) do { } while (0)
444#define ACPI_HANDLE(dev) (NULL) 446#define ACPI_HANDLE(dev) (NULL)
445 447
448struct fwnode_handle;
449
450static inline bool is_acpi_node(struct fwnode_handle *fwnode)
451{
452 return false;
453}
454
455static inline struct acpi_device *acpi_node(struct fwnode_handle *fwnode)
456{
457 return NULL;
458}
459
460static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
461{
462 return NULL;
463}
464
446static inline const char *acpi_dev_name(struct acpi_device *adev) 465static inline const char *acpi_dev_name(struct acpi_device *adev)
447{ 466{
448 return NULL; 467 return NULL;
@@ -553,16 +572,26 @@ static inline void arch_reserve_mem_area(acpi_physical_address addr,
553#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) 572#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
554#endif 573#endif
555 574
556#if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME) 575#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
557int acpi_dev_runtime_suspend(struct device *dev); 576int acpi_dev_runtime_suspend(struct device *dev);
558int acpi_dev_runtime_resume(struct device *dev); 577int acpi_dev_runtime_resume(struct device *dev);
559int acpi_subsys_runtime_suspend(struct device *dev); 578int acpi_subsys_runtime_suspend(struct device *dev);
560int acpi_subsys_runtime_resume(struct device *dev); 579int acpi_subsys_runtime_resume(struct device *dev);
580struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
581int acpi_dev_pm_attach(struct device *dev, bool power_on);
561#else 582#else
562static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; } 583static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; }
563static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; } 584static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; }
564static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; } 585static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }
565static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; } 586static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
587static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
588{
589 return NULL;
590}
591static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
592{
593 return -ENODEV;
594}
566#endif 595#endif
567 596
568#if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP) 597#if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP)
@@ -585,20 +614,6 @@ static inline int acpi_subsys_suspend(struct device *dev) { return 0; }
585static inline int acpi_subsys_freeze(struct device *dev) { return 0; } 614static inline int acpi_subsys_freeze(struct device *dev) { return 0; }
586#endif 615#endif
587 616
588#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
589struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
590int acpi_dev_pm_attach(struct device *dev, bool power_on);
591#else
592static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
593{
594 return NULL;
595}
596static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
597{
598 return -ENODEV;
599}
600#endif
601
602#ifdef CONFIG_ACPI 617#ifdef CONFIG_ACPI
603__printf(3, 4) 618__printf(3, 4)
604void acpi_handle_printk(const char *level, acpi_handle handle, 619void acpi_handle_printk(const char *level, acpi_handle handle,
@@ -659,4 +674,114 @@ do { \
659#endif 674#endif
660#endif 675#endif
661 676
677struct acpi_gpio_params {
678 unsigned int crs_entry_index;
679 unsigned int line_index;
680 bool active_low;
681};
682
683struct acpi_gpio_mapping {
684 const char *name;
685 const struct acpi_gpio_params *data;
686 unsigned int size;
687};
688
689#if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
690int acpi_dev_add_driver_gpios(struct acpi_device *adev,
691 const struct acpi_gpio_mapping *gpios);
692
693static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev)
694{
695 if (adev)
696 adev->driver_gpios = NULL;
697}
698#else
699static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev,
700 const struct acpi_gpio_mapping *gpios)
701{
702 return -ENXIO;
703}
704static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) {}
705#endif
706
707/* Device properties */
708
709#define MAX_ACPI_REFERENCE_ARGS 8
710struct acpi_reference_args {
711 struct acpi_device *adev;
712 size_t nargs;
713 u64 args[MAX_ACPI_REFERENCE_ARGS];
714};
715
716#ifdef CONFIG_ACPI
717int acpi_dev_get_property(struct acpi_device *adev, const char *name,
718 acpi_object_type type, const union acpi_object **obj);
719int acpi_dev_get_property_array(struct acpi_device *adev, const char *name,
720 acpi_object_type type,
721 const union acpi_object **obj);
722int acpi_dev_get_property_reference(struct acpi_device *adev,
723 const char *name, size_t index,
724 struct acpi_reference_args *args);
725
726int acpi_dev_prop_get(struct acpi_device *adev, const char *propname,
727 void **valptr);
728int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname,
729 enum dev_prop_type proptype, void *val);
730int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
731 enum dev_prop_type proptype, void *val, size_t nval);
732
733struct acpi_device *acpi_get_next_child(struct device *dev,
734 struct acpi_device *child);
735#else
736static inline int acpi_dev_get_property(struct acpi_device *adev,
737 const char *name, acpi_object_type type,
738 const union acpi_object **obj)
739{
740 return -ENXIO;
741}
742static inline int acpi_dev_get_property_array(struct acpi_device *adev,
743 const char *name,
744 acpi_object_type type,
745 const union acpi_object **obj)
746{
747 return -ENXIO;
748}
749static inline int acpi_dev_get_property_reference(struct acpi_device *adev,
750 const char *name, const char *cells_name,
751 size_t index, struct acpi_reference_args *args)
752{
753 return -ENXIO;
754}
755
756static inline int acpi_dev_prop_get(struct acpi_device *adev,
757 const char *propname,
758 void **valptr)
759{
760 return -ENXIO;
761}
762
763static inline int acpi_dev_prop_read_single(struct acpi_device *adev,
764 const char *propname,
765 enum dev_prop_type proptype,
766 void *val)
767{
768 return -ENXIO;
769}
770
771static inline int acpi_dev_prop_read(struct acpi_device *adev,
772 const char *propname,
773 enum dev_prop_type proptype,
774 void *val, size_t nval)
775{
776 return -ENXIO;
777}
778
779static inline struct acpi_device *acpi_get_next_child(struct device *dev,
780 struct acpi_device *child)
781{
782 return NULL;
783}
784
785#endif
786
662#endif /*_LINUX_ACPI_H*/ 787#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index c324f5700d1a..2afc618b15ce 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -23,6 +23,7 @@
23 23
24#define AMBA_NR_IRQS 9 24#define AMBA_NR_IRQS 9
25#define AMBA_CID 0xb105f00d 25#define AMBA_CID 0xb105f00d
26#define CORESIGHT_CID 0xb105900d
26 27
27struct clk; 28struct clk;
28 29
@@ -97,6 +98,16 @@ void amba_release_regions(struct amba_device *);
97#define amba_pclk_disable(d) \ 98#define amba_pclk_disable(d) \
98 do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0) 99 do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0)
99 100
101static inline int amba_pclk_prepare(struct amba_device *dev)
102{
103 return clk_prepare(dev->pclk);
104}
105
106static inline void amba_pclk_unprepare(struct amba_device *dev)
107{
108 clk_unprepare(dev->pclk);
109}
110
100/* Some drivers don't use the struct amba_device */ 111/* Some drivers don't use the struct amba_device */
101#define AMBA_CONFIG_BITS(a) (((a) >> 24) & 0xff) 112#define AMBA_CONFIG_BITS(a) (((a) >> 24) & 0xff)
102#define AMBA_REV_BITS(a) (((a) >> 20) & 0x0f) 113#define AMBA_REV_BITS(a) (((a) >> 20) & 0x0f)
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
index a495a959e8a7..33eb274cd0e6 100644
--- a/include/linux/ath9k_platform.h
+++ b/include/linux/ath9k_platform.h
@@ -31,8 +31,11 @@ struct ath9k_platform_data {
31 u32 gpio_mask; 31 u32 gpio_mask;
32 u32 gpio_val; 32 u32 gpio_val;
33 33
34 bool endian_check;
34 bool is_clk_25mhz; 35 bool is_clk_25mhz;
35 bool tx_gain_buffalo; 36 bool tx_gain_buffalo;
37 bool disable_2ghz;
38 bool disable_5ghz;
36 39
37 int (*get_mac_revision)(void); 40 int (*get_mac_revision)(void);
38 int (*external_reset)(void); 41 int (*external_reset)(void);
diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h
index 91b77f8d495d..9177947bf032 100644
--- a/include/linux/atmel-mci.h
+++ b/include/linux/atmel-mci.h
@@ -11,6 +11,7 @@
11 * @detect_pin: GPIO pin wired to the card detect switch 11 * @detect_pin: GPIO pin wired to the card detect switch
12 * @wp_pin: GPIO pin wired to the write protect sensor 12 * @wp_pin: GPIO pin wired to the write protect sensor
13 * @detect_is_active_high: The state of the detect pin when it is active 13 * @detect_is_active_high: The state of the detect pin when it is active
14 * @non_removable: The slot is not removable, only detect once
14 * 15 *
15 * If a given slot is not present on the board, @bus_width should be 16 * If a given slot is not present on the board, @bus_width should be
16 * set to 0. The other fields are ignored in this case. 17 * set to 0. The other fields are ignored in this case.
@@ -26,6 +27,7 @@ struct mci_slot_pdata {
26 int detect_pin; 27 int detect_pin;
27 int wp_pin; 28 int wp_pin;
28 bool detect_is_active_high; 29 bool detect_is_active_high;
30 bool non_removable;
29}; 31};
30 32
31/** 33/**
diff --git a/include/linux/audit.h b/include/linux/audit.h
index e58fe7df8b9c..0c04917c2f12 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -130,6 +130,7 @@ extern void audit_putname(struct filename *name);
130#define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */ 130#define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */
131extern void __audit_inode(struct filename *name, const struct dentry *dentry, 131extern void __audit_inode(struct filename *name, const struct dentry *dentry,
132 unsigned int flags); 132 unsigned int flags);
133extern void __audit_file(const struct file *);
133extern void __audit_inode_child(const struct inode *parent, 134extern void __audit_inode_child(const struct inode *parent,
134 const struct dentry *dentry, 135 const struct dentry *dentry,
135 const unsigned char type); 136 const unsigned char type);
@@ -183,6 +184,11 @@ static inline void audit_inode(struct filename *name,
183 __audit_inode(name, dentry, flags); 184 __audit_inode(name, dentry, flags);
184 } 185 }
185} 186}
187static inline void audit_file(struct file *file)
188{
189 if (unlikely(!audit_dummy_context()))
190 __audit_file(file);
191}
186static inline void audit_inode_parent_hidden(struct filename *name, 192static inline void audit_inode_parent_hidden(struct filename *name,
187 const struct dentry *dentry) 193 const struct dentry *dentry)
188{ 194{
@@ -357,6 +363,9 @@ static inline void audit_inode(struct filename *name,
357 const struct dentry *dentry, 363 const struct dentry *dentry,
358 unsigned int parent) 364 unsigned int parent)
359{ } 365{ }
366static inline void audit_file(struct file *file)
367{
368}
360static inline void audit_inode_parent_hidden(struct filename *name, 369static inline void audit_inode_parent_hidden(struct filename *name,
361 const struct dentry *dentry) 370 const struct dentry *dentry)
362{ } 371{ }
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 729f48e6b20b..eb1c6a47b67f 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -447,4 +447,6 @@ extern u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset);
447#define BCMA_DMA_TRANSLATION_DMA64_CMT 0x80000000 /* Client Mode Translation for 64-bit DMA */ 447#define BCMA_DMA_TRANSLATION_DMA64_CMT 0x80000000 /* Client Mode Translation for 64-bit DMA */
448extern u32 bcma_core_dma_translation(struct bcma_device *core); 448extern u32 bcma_core_dma_translation(struct bcma_device *core);
449 449
450extern unsigned int bcma_core_irq(struct bcma_device *core, int num);
451
450#endif /* LINUX_BCMA_H_ */ 452#endif /* LINUX_BCMA_H_ */
diff --git a/include/linux/bcma/bcma_driver_mips.h b/include/linux/bcma/bcma_driver_mips.h
index fb61f3fb4ddb..0b3b32aeeb8a 100644
--- a/include/linux/bcma/bcma_driver_mips.h
+++ b/include/linux/bcma/bcma_driver_mips.h
@@ -43,12 +43,12 @@ struct bcma_drv_mips {
43extern void bcma_core_mips_init(struct bcma_drv_mips *mcore); 43extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
44extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore); 44extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
45 45
46extern unsigned int bcma_core_irq(struct bcma_device *core); 46extern unsigned int bcma_core_mips_irq(struct bcma_device *dev);
47#else 47#else
48static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { } 48static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
49static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { } 49static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
50 50
51static inline unsigned int bcma_core_irq(struct bcma_device *core) 51static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
52{ 52{
53 return 0; 53 return 0;
54} 54}
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 61f29e5ea840..576e4639ca60 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -53,6 +53,10 @@ struct linux_binprm {
53#define BINPRM_FLAGS_EXECFD_BIT 1 53#define BINPRM_FLAGS_EXECFD_BIT 1
54#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT) 54#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT)
55 55
56/* filename of the binary will be inaccessible after exec */
57#define BINPRM_FLAGS_PATH_INACCESSIBLE_BIT 2
58#define BINPRM_FLAGS_PATH_INACCESSIBLE (1 << BINPRM_FLAGS_PATH_INACCESSIBLE_BIT)
59
56/* Function parameter for binfmt->coredump */ 60/* Function parameter for binfmt->coredump */
57struct coredump_params { 61struct coredump_params {
58 const siginfo_t *siginfo; 62 const siginfo_t *siginfo;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 7347f486ceca..efead0b532c4 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -443,6 +443,11 @@ extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int,
443extern void bio_set_pages_dirty(struct bio *bio); 443extern void bio_set_pages_dirty(struct bio *bio);
444extern void bio_check_pages_dirty(struct bio *bio); 444extern void bio_check_pages_dirty(struct bio *bio);
445 445
446void generic_start_io_acct(int rw, unsigned long sectors,
447 struct hd_struct *part);
448void generic_end_io_acct(int rw, struct hd_struct *part,
449 unsigned long start_time);
450
446#ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 451#ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
447# error "You should define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE for your platform" 452# error "You should define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE for your platform"
448#endif 453#endif
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index e1c8d080c427..202e4034fe26 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -45,6 +45,7 @@
45 * bitmap_set(dst, pos, nbits) Set specified bit area 45 * bitmap_set(dst, pos, nbits) Set specified bit area
46 * bitmap_clear(dst, pos, nbits) Clear specified bit area 46 * bitmap_clear(dst, pos, nbits) Clear specified bit area
47 * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area 47 * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area
48 * bitmap_find_next_zero_area_off(buf, len, pos, n, mask) as above
48 * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n 49 * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n
49 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n 50 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
50 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) 51 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src)
@@ -60,6 +61,7 @@
60 * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region 61 * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region
61 * bitmap_release_region(bitmap, pos, order) Free specified bit region 62 * bitmap_release_region(bitmap, pos, order) Free specified bit region
62 * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region 63 * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region
64 * bitmap_print_to_pagebuf(list, buf, mask, nbits) Print bitmap src as list/hex
63 */ 65 */
64 66
65/* 67/*
@@ -114,11 +116,36 @@ extern int __bitmap_weight(const unsigned long *bitmap, unsigned int nbits);
114 116
115extern void bitmap_set(unsigned long *map, unsigned int start, int len); 117extern void bitmap_set(unsigned long *map, unsigned int start, int len);
116extern void bitmap_clear(unsigned long *map, unsigned int start, int len); 118extern void bitmap_clear(unsigned long *map, unsigned int start, int len);
117extern unsigned long bitmap_find_next_zero_area(unsigned long *map, 119
118 unsigned long size, 120extern unsigned long bitmap_find_next_zero_area_off(unsigned long *map,
119 unsigned long start, 121 unsigned long size,
120 unsigned int nr, 122 unsigned long start,
121 unsigned long align_mask); 123 unsigned int nr,
124 unsigned long align_mask,
125 unsigned long align_offset);
126
127/**
128 * bitmap_find_next_zero_area - find a contiguous aligned zero area
129 * @map: The address to base the search on
130 * @size: The bitmap size in bits
131 * @start: The bitnumber to start searching at
132 * @nr: The number of zeroed bits we're looking for
133 * @align_mask: Alignment mask for zero area
134 *
135 * The @align_mask should be one less than a power of 2; the effect is that
136 * the bit offset of all zero areas this function finds is multiples of that
137 * power of 2. A @align_mask of 0 means no alignment is required.
138 */
139static inline unsigned long
140bitmap_find_next_zero_area(unsigned long *map,
141 unsigned long size,
142 unsigned long start,
143 unsigned int nr,
144 unsigned long align_mask)
145{
146 return bitmap_find_next_zero_area_off(map, size, start, nr,
147 align_mask, 0);
148}
122 149
123extern int bitmap_scnprintf(char *buf, unsigned int len, 150extern int bitmap_scnprintf(char *buf, unsigned int len,
124 const unsigned long *src, int nbits); 151 const unsigned long *src, int nbits);
@@ -145,6 +172,8 @@ extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int o
145extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order); 172extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order);
146extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); 173extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits);
147extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits); 174extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits);
175extern int bitmap_print_to_pagebuf(bool list, char *buf,
176 const unsigned long *maskp, int nmaskbits);
148 177
149#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG)) 178#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG))
150#define BITMAP_LAST_WORD_MASK(nbits) \ 179#define BITMAP_LAST_WORD_MASK(nbits) \
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index c9be1589415a..8aded9ab2e4e 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -79,7 +79,13 @@ struct blk_mq_tag_set {
79 struct list_head tag_list; 79 struct list_head tag_list;
80}; 80};
81 81
82typedef int (queue_rq_fn)(struct blk_mq_hw_ctx *, struct request *, bool); 82struct blk_mq_queue_data {
83 struct request *rq;
84 struct list_head *list;
85 bool last;
86};
87
88typedef int (queue_rq_fn)(struct blk_mq_hw_ctx *, const struct blk_mq_queue_data *);
83typedef struct blk_mq_hw_ctx *(map_queue_fn)(struct request_queue *, const int); 89typedef struct blk_mq_hw_ctx *(map_queue_fn)(struct request_queue *, const int);
84typedef enum blk_eh_timer_return (timeout_fn)(struct request *, bool); 90typedef enum blk_eh_timer_return (timeout_fn)(struct request *, bool);
85typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int); 91typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int);
@@ -140,6 +146,7 @@ enum {
140 BLK_MQ_F_TAG_SHARED = 1 << 1, 146 BLK_MQ_F_TAG_SHARED = 1 << 1,
141 BLK_MQ_F_SG_MERGE = 1 << 2, 147 BLK_MQ_F_SG_MERGE = 1 << 2,
142 BLK_MQ_F_SYSFS_UP = 1 << 3, 148 BLK_MQ_F_SYSFS_UP = 1 << 3,
149 BLK_MQ_F_DEFER_ISSUE = 1 << 4,
143 150
144 BLK_MQ_S_STOPPED = 0, 151 BLK_MQ_S_STOPPED = 0,
145 BLK_MQ_S_TAG_ACTIVE = 1, 152 BLK_MQ_S_TAG_ACTIVE = 1,
@@ -162,11 +169,29 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule);
162void blk_mq_insert_request(struct request *, bool, bool, bool); 169void blk_mq_insert_request(struct request *, bool, bool, bool);
163void blk_mq_run_queues(struct request_queue *q, bool async); 170void blk_mq_run_queues(struct request_queue *q, bool async);
164void blk_mq_free_request(struct request *rq); 171void blk_mq_free_request(struct request *rq);
172void blk_mq_free_hctx_request(struct blk_mq_hw_ctx *, struct request *rq);
165bool blk_mq_can_queue(struct blk_mq_hw_ctx *); 173bool blk_mq_can_queue(struct blk_mq_hw_ctx *);
166struct request *blk_mq_alloc_request(struct request_queue *q, int rw, 174struct request *blk_mq_alloc_request(struct request_queue *q, int rw,
167 gfp_t gfp, bool reserved); 175 gfp_t gfp, bool reserved);
168struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag); 176struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag);
169 177
178enum {
179 BLK_MQ_UNIQUE_TAG_BITS = 16,
180 BLK_MQ_UNIQUE_TAG_MASK = (1 << BLK_MQ_UNIQUE_TAG_BITS) - 1,
181};
182
183u32 blk_mq_unique_tag(struct request *rq);
184
185static inline u16 blk_mq_unique_tag_to_hwq(u32 unique_tag)
186{
187 return unique_tag >> BLK_MQ_UNIQUE_TAG_BITS;
188}
189
190static inline u16 blk_mq_unique_tag_to_tag(u32 unique_tag)
191{
192 return unique_tag & BLK_MQ_UNIQUE_TAG_MASK;
193}
194
170struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index); 195struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index);
171struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_tag_set *, unsigned int, int); 196struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_tag_set *, unsigned int, int);
172 197
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index aac0f9ea952a..92f4b4b288dd 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -398,7 +398,7 @@ struct request_queue {
398 */ 398 */
399 struct kobject mq_kobj; 399 struct kobject mq_kobj;
400 400
401#ifdef CONFIG_PM_RUNTIME 401#ifdef CONFIG_PM
402 struct device *dev; 402 struct device *dev;
403 int rpm_status; 403 int rpm_status;
404 unsigned int nr_pending; 404 unsigned int nr_pending;
@@ -1057,7 +1057,7 @@ extern void blk_put_queue(struct request_queue *);
1057/* 1057/*
1058 * block layer runtime pm functions 1058 * block layer runtime pm functions
1059 */ 1059 */
1060#ifdef CONFIG_PM_RUNTIME 1060#ifdef CONFIG_PM
1061extern void blk_pm_runtime_init(struct request_queue *q, struct device *dev); 1061extern void blk_pm_runtime_init(struct request_queue *q, struct device *dev);
1062extern int blk_pre_runtime_suspend(struct request_queue *q); 1062extern int blk_pre_runtime_suspend(struct request_queue *q);
1063extern void blk_post_runtime_suspend(struct request_queue *q, int err); 1063extern void blk_post_runtime_suspend(struct request_queue *q, int err);
@@ -1136,7 +1136,6 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk)
1136/* 1136/*
1137 * tag stuff 1137 * tag stuff
1138 */ 1138 */
1139#define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED)
1140extern int blk_queue_start_tag(struct request_queue *, struct request *); 1139extern int blk_queue_start_tag(struct request_queue *, struct request *);
1141extern struct request *blk_queue_find_tag(struct request_queue *, int); 1140extern struct request *blk_queue_find_tag(struct request_queue *, int);
1142extern void blk_queue_end_tag(struct request_queue *, struct request *); 1141extern void blk_queue_end_tag(struct request_queue *, struct request *);
@@ -1185,7 +1184,6 @@ extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm);
1185enum blk_default_limits { 1184enum blk_default_limits {
1186 BLK_MAX_SEGMENTS = 128, 1185 BLK_MAX_SEGMENTS = 128,
1187 BLK_SAFE_MAX_SECTORS = 255, 1186 BLK_SAFE_MAX_SECTORS = 255,
1188 BLK_DEF_MAX_SECTORS = 1024,
1189 BLK_MAX_SEGMENT_SIZE = 65536, 1187 BLK_MAX_SEGMENT_SIZE = 65536,
1190 BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL, 1188 BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL,
1191}; 1189};
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 3cf91754a957..bbfceb756452 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -22,7 +22,7 @@ struct bpf_map_ops {
22 22
23 /* funcs callable from userspace and from eBPF programs */ 23 /* funcs callable from userspace and from eBPF programs */
24 void *(*map_lookup_elem)(struct bpf_map *map, void *key); 24 void *(*map_lookup_elem)(struct bpf_map *map, void *key);
25 int (*map_update_elem)(struct bpf_map *map, void *key, void *value); 25 int (*map_update_elem)(struct bpf_map *map, void *key, void *value, u64 flags);
26 int (*map_delete_elem)(struct bpf_map *map, void *key); 26 int (*map_delete_elem)(struct bpf_map *map, void *key);
27}; 27};
28 28
@@ -128,9 +128,18 @@ struct bpf_prog_aux {
128 struct work_struct work; 128 struct work_struct work;
129}; 129};
130 130
131#ifdef CONFIG_BPF_SYSCALL
131void bpf_prog_put(struct bpf_prog *prog); 132void bpf_prog_put(struct bpf_prog *prog);
133#else
134static inline void bpf_prog_put(struct bpf_prog *prog) {}
135#endif
132struct bpf_prog *bpf_prog_get(u32 ufd); 136struct bpf_prog *bpf_prog_get(u32 ufd);
133/* verify correctness of eBPF program */ 137/* verify correctness of eBPF program */
134int bpf_check(struct bpf_prog *fp, union bpf_attr *attr); 138int bpf_check(struct bpf_prog *fp, union bpf_attr *attr);
135 139
140/* verifier prototypes for helper functions called from eBPF programs */
141extern struct bpf_func_proto bpf_map_lookup_elem_proto;
142extern struct bpf_func_proto bpf_map_update_elem_proto;
143extern struct bpf_func_proto bpf_map_delete_elem_proto;
144
136#endif /* _LINUX_BPF_H */ 145#endif /* _LINUX_BPF_H */
diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h
new file mode 100644
index 000000000000..3daf5ed392c9
--- /dev/null
+++ b/include/linux/cacheinfo.h
@@ -0,0 +1,100 @@
1#ifndef _LINUX_CACHEINFO_H
2#define _LINUX_CACHEINFO_H
3
4#include <linux/bitops.h>
5#include <linux/cpumask.h>
6#include <linux/smp.h>
7
8struct device_node;
9struct attribute;
10
11enum cache_type {
12 CACHE_TYPE_NOCACHE = 0,
13 CACHE_TYPE_INST = BIT(0),
14 CACHE_TYPE_DATA = BIT(1),
15 CACHE_TYPE_SEPARATE = CACHE_TYPE_INST | CACHE_TYPE_DATA,
16 CACHE_TYPE_UNIFIED = BIT(2),
17};
18
19/**
20 * struct cacheinfo - represent a cache leaf node
21 * @type: type of the cache - data, inst or unified
22 * @level: represents the hierarcy in the multi-level cache
23 * @coherency_line_size: size of each cache line usually representing
24 * the minimum amount of data that gets transferred from memory
25 * @number_of_sets: total number of sets, a set is a collection of cache
26 * lines sharing the same index
27 * @ways_of_associativity: number of ways in which a particular memory
28 * block can be placed in the cache
29 * @physical_line_partition: number of physical cache lines sharing the
30 * same cachetag
31 * @size: Total size of the cache
32 * @shared_cpu_map: logical cpumask representing all the cpus sharing
33 * this cache node
34 * @attributes: bitfield representing various cache attributes
35 * @of_node: if devicetree is used, this represents either the cpu node in
36 * case there's no explicit cache node or the cache node itself in the
37 * device tree
38 * @disable_sysfs: indicates whether this node is visible to the user via
39 * sysfs or not
40 * @priv: pointer to any private data structure specific to particular
41 * cache design
42 *
43 * While @of_node, @disable_sysfs and @priv are used for internal book
44 * keeping, the remaining members form the core properties of the cache
45 */
46struct cacheinfo {
47 enum cache_type type;
48 unsigned int level;
49 unsigned int coherency_line_size;
50 unsigned int number_of_sets;
51 unsigned int ways_of_associativity;
52 unsigned int physical_line_partition;
53 unsigned int size;
54 cpumask_t shared_cpu_map;
55 unsigned int attributes;
56#define CACHE_WRITE_THROUGH BIT(0)
57#define CACHE_WRITE_BACK BIT(1)
58#define CACHE_WRITE_POLICY_MASK \
59 (CACHE_WRITE_THROUGH | CACHE_WRITE_BACK)
60#define CACHE_READ_ALLOCATE BIT(2)
61#define CACHE_WRITE_ALLOCATE BIT(3)
62#define CACHE_ALLOCATE_POLICY_MASK \
63 (CACHE_READ_ALLOCATE | CACHE_WRITE_ALLOCATE)
64
65 struct device_node *of_node;
66 bool disable_sysfs;
67 void *priv;
68};
69
70struct cpu_cacheinfo {
71 struct cacheinfo *info_list;
72 unsigned int num_levels;
73 unsigned int num_leaves;
74};
75
76/*
77 * Helpers to make sure "func" is executed on the cpu whose cache
78 * attributes are being detected
79 */
80#define DEFINE_SMP_CALL_CACHE_FUNCTION(func) \
81static inline void _##func(void *ret) \
82{ \
83 int cpu = smp_processor_id(); \
84 *(int *)ret = __##func(cpu); \
85} \
86 \
87int func(unsigned int cpu) \
88{ \
89 int ret; \
90 smp_call_function_single(cpu, _##func, &ret, true); \
91 return ret; \
92}
93
94struct cpu_cacheinfo *get_cpu_cacheinfo(unsigned int cpu);
95int init_cache_level(unsigned int cpu);
96int populate_cache_leaves(unsigned int cpu);
97
98const struct attribute_group *cache_get_priv_group(struct cacheinfo *this_leaf);
99
100#endif /* _LINUX_CACHEINFO_H */
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index b37ea95bc348..c05ff0f9f9a5 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -127,6 +127,9 @@ void unregister_candev(struct net_device *dev);
127int can_restart_now(struct net_device *dev); 127int can_restart_now(struct net_device *dev);
128void can_bus_off(struct net_device *dev); 128void can_bus_off(struct net_device *dev);
129 129
130void can_change_state(struct net_device *dev, struct can_frame *cf,
131 enum can_state tx_state, enum can_state rx_state);
132
130void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, 133void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
131 unsigned int idx); 134 unsigned int idx);
132unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx); 135unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 1d5196889048..da0dae0600e6 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -113,6 +113,19 @@ static inline void css_get(struct cgroup_subsys_state *css)
113} 113}
114 114
115/** 115/**
116 * css_get_many - obtain references on the specified css
117 * @css: target css
118 * @n: number of references to get
119 *
120 * The caller must already have a reference.
121 */
122static inline void css_get_many(struct cgroup_subsys_state *css, unsigned int n)
123{
124 if (!(css->flags & CSS_NO_REF))
125 percpu_ref_get_many(&css->refcnt, n);
126}
127
128/**
116 * css_tryget - try to obtain a reference on the specified css 129 * css_tryget - try to obtain a reference on the specified css
117 * @css: target css 130 * @css: target css
118 * 131 *
@@ -159,6 +172,19 @@ static inline void css_put(struct cgroup_subsys_state *css)
159 percpu_ref_put(&css->refcnt); 172 percpu_ref_put(&css->refcnt);
160} 173}
161 174
175/**
176 * css_put_many - put css references
177 * @css: target css
178 * @n: number of references to put
179 *
180 * Put references obtained via css_get() and css_tryget_online().
181 */
182static inline void css_put_many(struct cgroup_subsys_state *css, unsigned int n)
183{
184 if (!(css->flags & CSS_NO_REF))
185 percpu_ref_put_many(&css->refcnt, n);
186}
187
162/* bits in struct cgroup flags field */ 188/* bits in struct cgroup flags field */
163enum { 189enum {
164 /* Control Group requires release notifications to userspace */ 190 /* Control Group requires release notifications to userspace */
@@ -367,8 +393,8 @@ struct css_set {
367 * struct cftype: handler definitions for cgroup control files 393 * struct cftype: handler definitions for cgroup control files
368 * 394 *
369 * When reading/writing to a file: 395 * When reading/writing to a file:
370 * - the cgroup to use is file->f_dentry->d_parent->d_fsdata 396 * - the cgroup to use is file->f_path.dentry->d_parent->d_fsdata
371 * - the 'cftype' of the file is file->f_dentry->d_fsdata 397 * - the 'cftype' of the file is file->f_path.dentry->d_fsdata
372 */ 398 */
373 399
374/* cftype->flags */ 400/* cftype->flags */
@@ -612,8 +638,10 @@ struct cgroup_subsys {
612 struct cgroup_subsys_state *(*css_alloc)(struct cgroup_subsys_state *parent_css); 638 struct cgroup_subsys_state *(*css_alloc)(struct cgroup_subsys_state *parent_css);
613 int (*css_online)(struct cgroup_subsys_state *css); 639 int (*css_online)(struct cgroup_subsys_state *css);
614 void (*css_offline)(struct cgroup_subsys_state *css); 640 void (*css_offline)(struct cgroup_subsys_state *css);
641 void (*css_released)(struct cgroup_subsys_state *css);
615 void (*css_free)(struct cgroup_subsys_state *css); 642 void (*css_free)(struct cgroup_subsys_state *css);
616 void (*css_reset)(struct cgroup_subsys_state *css); 643 void (*css_reset)(struct cgroup_subsys_state *css);
644 void (*css_e_css_changed)(struct cgroup_subsys_state *css);
617 645
618 int (*can_attach)(struct cgroup_subsys_state *css, 646 int (*can_attach)(struct cgroup_subsys_state *css,
619 struct cgroup_taskset *tset); 647 struct cgroup_taskset *tset);
@@ -908,6 +936,8 @@ void css_task_iter_end(struct css_task_iter *it);
908int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); 936int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
909int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); 937int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
910 938
939struct cgroup_subsys_state *cgroup_get_e_css(struct cgroup *cgroup,
940 struct cgroup_subsys *ss);
911struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry, 941struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry,
912 struct cgroup_subsys *ss); 942 struct cgroup_subsys *ss);
913 943
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index be21af149f11..2839c639f092 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -352,7 +352,6 @@ struct clk_divider {
352#define CLK_DIVIDER_READ_ONLY BIT(5) 352#define CLK_DIVIDER_READ_ONLY BIT(5)
353 353
354extern const struct clk_ops clk_divider_ops; 354extern const struct clk_ops clk_divider_ops;
355extern const struct clk_ops clk_divider_ro_ops;
356struct clk *clk_register_divider(struct device *dev, const char *name, 355struct clk *clk_register_divider(struct device *dev, const char *name,
357 const char *parent_name, unsigned long flags, 356 const char *parent_name, unsigned long flags,
358 void __iomem *reg, u8 shift, u8 width, 357 void __iomem *reg, u8 shift, u8 width,
diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h
index f75acbf70e96..74e5341463c9 100644
--- a/include/linux/clk/ti.h
+++ b/include/linux/clk/ti.h
@@ -254,13 +254,26 @@ extern const struct clk_ops ti_clk_mux_ops;
254void omap2_init_clk_hw_omap_clocks(struct clk *clk); 254void omap2_init_clk_hw_omap_clocks(struct clk *clk);
255int omap3_noncore_dpll_enable(struct clk_hw *hw); 255int omap3_noncore_dpll_enable(struct clk_hw *hw);
256void omap3_noncore_dpll_disable(struct clk_hw *hw); 256void omap3_noncore_dpll_disable(struct clk_hw *hw);
257int omap3_noncore_dpll_set_parent(struct clk_hw *hw, u8 index);
257int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate, 258int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
258 unsigned long parent_rate); 259 unsigned long parent_rate);
260int omap3_noncore_dpll_set_rate_and_parent(struct clk_hw *hw,
261 unsigned long rate,
262 unsigned long parent_rate,
263 u8 index);
264long omap3_noncore_dpll_determine_rate(struct clk_hw *hw,
265 unsigned long rate,
266 unsigned long *best_parent_rate,
267 struct clk **best_parent_clk);
259unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw, 268unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw,
260 unsigned long parent_rate); 269 unsigned long parent_rate);
261long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw, 270long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw,
262 unsigned long target_rate, 271 unsigned long target_rate,
263 unsigned long *parent_rate); 272 unsigned long *parent_rate);
273long omap4_dpll_regm4xen_determine_rate(struct clk_hw *hw,
274 unsigned long rate,
275 unsigned long *best_parent_rate,
276 struct clk **best_parent_clk);
264u8 omap2_init_dpll_parent(struct clk_hw *hw); 277u8 omap2_init_dpll_parent(struct clk_hw *hw);
265unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate); 278unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate);
266long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate, 279long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
@@ -278,6 +291,8 @@ int omap2_clk_disable_autoidle_all(void);
278void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks); 291void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks);
279int omap3_dpll4_set_rate(struct clk_hw *clk, unsigned long rate, 292int omap3_dpll4_set_rate(struct clk_hw *clk, unsigned long rate,
280 unsigned long parent_rate); 293 unsigned long parent_rate);
294int omap3_dpll4_set_rate_and_parent(struct clk_hw *hw, unsigned long rate,
295 unsigned long parent_rate, u8 index);
281int omap2_dflt_clk_enable(struct clk_hw *hw); 296int omap2_dflt_clk_enable(struct clk_hw *hw);
282void omap2_dflt_clk_disable(struct clk_hw *hw); 297void omap2_dflt_clk_disable(struct clk_hw *hw);
283int omap2_dflt_clk_is_enabled(struct clk_hw *hw); 298int omap2_dflt_clk_is_enabled(struct clk_hw *hw);
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 60bdf8dc02a3..3238ffa33f68 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -33,10 +33,11 @@ extern int fragmentation_index(struct zone *zone, unsigned int order);
33extern unsigned long try_to_compact_pages(struct zonelist *zonelist, 33extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
34 int order, gfp_t gfp_mask, nodemask_t *mask, 34 int order, gfp_t gfp_mask, nodemask_t *mask,
35 enum migrate_mode mode, int *contended, 35 enum migrate_mode mode, int *contended,
36 struct zone **candidate_zone); 36 int alloc_flags, int classzone_idx);
37extern void compact_pgdat(pg_data_t *pgdat, int order); 37extern void compact_pgdat(pg_data_t *pgdat, int order);
38extern void reset_isolation_suitable(pg_data_t *pgdat); 38extern void reset_isolation_suitable(pg_data_t *pgdat);
39extern unsigned long compaction_suitable(struct zone *zone, int order); 39extern unsigned long compaction_suitable(struct zone *zone, int order,
40 int alloc_flags, int classzone_idx);
40 41
41/* Do not skip compaction more than 64 times */ 42/* Do not skip compaction more than 64 times */
42#define COMPACT_MAX_DEFER_SHIFT 6 43#define COMPACT_MAX_DEFER_SHIFT 6
@@ -103,7 +104,7 @@ static inline bool compaction_restarting(struct zone *zone, int order)
103static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, 104static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
104 int order, gfp_t gfp_mask, nodemask_t *nodemask, 105 int order, gfp_t gfp_mask, nodemask_t *nodemask,
105 enum migrate_mode mode, int *contended, 106 enum migrate_mode mode, int *contended,
106 struct zone **candidate_zone) 107 int alloc_flags, int classzone_idx)
107{ 108{
108 return COMPACT_CONTINUE; 109 return COMPACT_CONTINUE;
109} 110}
@@ -116,7 +117,8 @@ static inline void reset_isolation_suitable(pg_data_t *pgdat)
116{ 117{
117} 118}
118 119
119static inline unsigned long compaction_suitable(struct zone *zone, int order) 120static inline unsigned long compaction_suitable(struct zone *zone, int order,
121 int alloc_flags, int classzone_idx)
120{ 122{
121 return COMPACT_SKIPPED; 123 return COMPACT_SKIPPED;
122} 124}
diff --git a/include/linux/compat.h b/include/linux/compat.h
index e6494261eaff..7450ca2ac1fc 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -357,6 +357,9 @@ asmlinkage long compat_sys_lseek(unsigned int, compat_off_t, unsigned int);
357 357
358asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv, 358asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
359 const compat_uptr_t __user *envp); 359 const compat_uptr_t __user *envp);
360asmlinkage long compat_sys_execveat(int dfd, const char __user *filename,
361 const compat_uptr_t __user *argv,
362 const compat_uptr_t __user *envp, int flags);
360 363
361asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, 364asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
362 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 365 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
diff --git a/include/linux/coresight.h b/include/linux/coresight.h
new file mode 100644
index 000000000000..5d3c54311f7a
--- /dev/null
+++ b/include/linux/coresight.h
@@ -0,0 +1,263 @@
1/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef _LINUX_CORESIGHT_H
14#define _LINUX_CORESIGHT_H
15
16#include <linux/device.h>
17
18/* Peripheral id registers (0xFD0-0xFEC) */
19#define CORESIGHT_PERIPHIDR4 0xfd0
20#define CORESIGHT_PERIPHIDR5 0xfd4
21#define CORESIGHT_PERIPHIDR6 0xfd8
22#define CORESIGHT_PERIPHIDR7 0xfdC
23#define CORESIGHT_PERIPHIDR0 0xfe0
24#define CORESIGHT_PERIPHIDR1 0xfe4
25#define CORESIGHT_PERIPHIDR2 0xfe8
26#define CORESIGHT_PERIPHIDR3 0xfeC
27/* Component id registers (0xFF0-0xFFC) */
28#define CORESIGHT_COMPIDR0 0xff0
29#define CORESIGHT_COMPIDR1 0xff4
30#define CORESIGHT_COMPIDR2 0xff8
31#define CORESIGHT_COMPIDR3 0xffC
32
33#define ETM_ARCH_V3_3 0x23
34#define ETM_ARCH_V3_5 0x25
35#define PFT_ARCH_V1_0 0x30
36#define PFT_ARCH_V1_1 0x31
37
38#define CORESIGHT_UNLOCK 0xc5acce55
39
40extern struct bus_type coresight_bustype;
41
42enum coresight_dev_type {
43 CORESIGHT_DEV_TYPE_NONE,
44 CORESIGHT_DEV_TYPE_SINK,
45 CORESIGHT_DEV_TYPE_LINK,
46 CORESIGHT_DEV_TYPE_LINKSINK,
47 CORESIGHT_DEV_TYPE_SOURCE,
48};
49
50enum coresight_dev_subtype_sink {
51 CORESIGHT_DEV_SUBTYPE_SINK_NONE,
52 CORESIGHT_DEV_SUBTYPE_SINK_PORT,
53 CORESIGHT_DEV_SUBTYPE_SINK_BUFFER,
54};
55
56enum coresight_dev_subtype_link {
57 CORESIGHT_DEV_SUBTYPE_LINK_NONE,
58 CORESIGHT_DEV_SUBTYPE_LINK_MERG,
59 CORESIGHT_DEV_SUBTYPE_LINK_SPLIT,
60 CORESIGHT_DEV_SUBTYPE_LINK_FIFO,
61};
62
63enum coresight_dev_subtype_source {
64 CORESIGHT_DEV_SUBTYPE_SOURCE_NONE,
65 CORESIGHT_DEV_SUBTYPE_SOURCE_PROC,
66 CORESIGHT_DEV_SUBTYPE_SOURCE_BUS,
67 CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE,
68};
69
70/**
71 * struct coresight_dev_subtype - further characterisation of a type
72 * @sink_subtype: type of sink this component is, as defined
73 by @coresight_dev_subtype_sink.
74 * @link_subtype: type of link this component is, as defined
75 by @coresight_dev_subtype_link.
76 * @source_subtype: type of source this component is, as defined
77 by @coresight_dev_subtype_source.
78 */
79struct coresight_dev_subtype {
80 enum coresight_dev_subtype_sink sink_subtype;
81 enum coresight_dev_subtype_link link_subtype;
82 enum coresight_dev_subtype_source source_subtype;
83};
84
85/**
86 * struct coresight_platform_data - data harvested from the DT specification
87 * @cpu: the CPU a source belongs to. Only applicable for ETM/PTMs.
88 * @name: name of the component as shown under sysfs.
89 * @nr_inport: number of input ports for this component.
90 * @outports: list of remote endpoint port number.
91 * @child_names:name of all child components connected to this device.
92 * @child_ports:child component port number the current component is
93 connected to.
94 * @nr_outport: number of output ports for this component.
95 * @clk: The clock this component is associated to.
96 */
97struct coresight_platform_data {
98 int cpu;
99 const char *name;
100 int nr_inport;
101 int *outports;
102 const char **child_names;
103 int *child_ports;
104 int nr_outport;
105 struct clk *clk;
106};
107
108/**
109 * struct coresight_desc - description of a component required from drivers
110 * @type: as defined by @coresight_dev_type.
111 * @subtype: as defined by @coresight_dev_subtype.
112 * @ops: generic operations for this component, as defined
113 by @coresight_ops.
114 * @pdata: platform data collected from DT.
115 * @dev: The device entity associated to this component.
116 * @groups: operations specific to this component. These will end up
117 in the component's sysfs sub-directory.
118 */
119struct coresight_desc {
120 enum coresight_dev_type type;
121 struct coresight_dev_subtype subtype;
122 const struct coresight_ops *ops;
123 struct coresight_platform_data *pdata;
124 struct device *dev;
125 const struct attribute_group **groups;
126};
127
128/**
129 * struct coresight_connection - representation of a single connection
130 * @outport: a connection's output port number.
131 * @chid_name: remote component's name.
132 * @child_port: remote component's port number @output is connected to.
133 * @child_dev: a @coresight_device representation of the component
134 connected to @outport.
135 */
136struct coresight_connection {
137 int outport;
138 const char *child_name;
139 int child_port;
140 struct coresight_device *child_dev;
141};
142
143/**
144 * struct coresight_device - representation of a device as used by the framework
145 * @conns: array of coresight_connections associated to this component.
146 * @nr_inport: number of input port associated to this component.
147 * @nr_outport: number of output port associated to this component.
148 * @type: as defined by @coresight_dev_type.
149 * @subtype: as defined by @coresight_dev_subtype.
150 * @ops: generic operations for this component, as defined
151 by @coresight_ops.
152 * @dev: The device entity associated to this component.
153 * @refcnt: keep track of what is in use.
154 * @path_link: link of current component into the path being enabled.
155 * @orphan: true if the component has connections that haven't been linked.
156 * @enable: 'true' if component is currently part of an active path.
157 * @activated: 'true' only if a _sink_ has been activated. A sink can be
158 activated but not yet enabled. Enabling for a _sink_
159 happens when a source has been selected for that it.
160 */
161struct coresight_device {
162 struct coresight_connection *conns;
163 int nr_inport;
164 int nr_outport;
165 enum coresight_dev_type type;
166 struct coresight_dev_subtype subtype;
167 const struct coresight_ops *ops;
168 struct device dev;
169 atomic_t *refcnt;
170 struct list_head path_link;
171 bool orphan;
172 bool enable; /* true only if configured as part of a path */
173 bool activated; /* true only if a sink is part of a path */
174};
175
176#define to_coresight_device(d) container_of(d, struct coresight_device, dev)
177
178#define source_ops(csdev) csdev->ops->source_ops
179#define sink_ops(csdev) csdev->ops->sink_ops
180#define link_ops(csdev) csdev->ops->link_ops
181
182#define CORESIGHT_DEBUGFS_ENTRY(__name, __entry_name, \
183 __mode, __get, __set, __fmt) \
184DEFINE_SIMPLE_ATTRIBUTE(__name ## _ops, __get, __set, __fmt); \
185static const struct coresight_ops_entry __name ## _entry = { \
186 .name = __entry_name, \
187 .mode = __mode, \
188 .ops = &__name ## _ops \
189}
190
191/**
192 * struct coresight_ops_sink - basic operations for a sink
193 * Operations available for sinks
194 * @enable: enables the sink.
195 * @disable: disables the sink.
196 */
197struct coresight_ops_sink {
198 int (*enable)(struct coresight_device *csdev);
199 void (*disable)(struct coresight_device *csdev);
200};
201
202/**
203 * struct coresight_ops_link - basic operations for a link
204 * Operations available for links.
205 * @enable: enables flow between iport and oport.
206 * @disable: disables flow between iport and oport.
207 */
208struct coresight_ops_link {
209 int (*enable)(struct coresight_device *csdev, int iport, int oport);
210 void (*disable)(struct coresight_device *csdev, int iport, int oport);
211};
212
213/**
214 * struct coresight_ops_source - basic operations for a source
215 * Operations available for sources.
216 * @trace_id: returns the value of the component's trace ID as known
217 to the HW.
218 * @enable: enables tracing from a source.
219 * @disable: disables tracing for a source.
220 */
221struct coresight_ops_source {
222 int (*trace_id)(struct coresight_device *csdev);
223 int (*enable)(struct coresight_device *csdev);
224 void (*disable)(struct coresight_device *csdev);
225};
226
227struct coresight_ops {
228 const struct coresight_ops_sink *sink_ops;
229 const struct coresight_ops_link *link_ops;
230 const struct coresight_ops_source *source_ops;
231};
232
233#ifdef CONFIG_CORESIGHT
234extern struct coresight_device *
235coresight_register(struct coresight_desc *desc);
236extern void coresight_unregister(struct coresight_device *csdev);
237extern int coresight_enable(struct coresight_device *csdev);
238extern void coresight_disable(struct coresight_device *csdev);
239extern int coresight_is_bit_set(u32 val, int position, int value);
240extern int coresight_timeout(void __iomem *addr, u32 offset,
241 int position, int value);
242#ifdef CONFIG_OF
243extern struct coresight_platform_data *of_get_coresight_platform_data(
244 struct device *dev, struct device_node *node);
245#endif
246#else
247static inline struct coresight_device *
248coresight_register(struct coresight_desc *desc) { return NULL; }
249static inline void coresight_unregister(struct coresight_device *csdev) {}
250static inline int
251coresight_enable(struct coresight_device *csdev) { return -ENOSYS; }
252static inline void coresight_disable(struct coresight_device *csdev) {}
253static inline int coresight_is_bit_set(u32 val, int position, int value)
254 { return 0; }
255static inline int coresight_timeout(void __iomem *addr, u32 offset,
256 int position, int value) { return 1; }
257#ifdef CONFIG_OF
258static inline struct coresight_platform_data *of_get_coresight_platform_data(
259 struct device *dev, struct device_node *node) { return NULL; }
260#endif
261#endif
262
263#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index b2d9a43012b2..4260e8594bd7 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -19,6 +19,7 @@
19 19
20struct device; 20struct device;
21struct device_node; 21struct device_node;
22struct attribute_group;
22 23
23struct cpu { 24struct cpu {
24 int node_id; /* The node which contains the CPU */ 25 int node_id; /* The node which contains the CPU */
@@ -39,6 +40,9 @@ extern void cpu_remove_dev_attr(struct device_attribute *attr);
39extern int cpu_add_dev_attr_group(struct attribute_group *attrs); 40extern int cpu_add_dev_attr_group(struct attribute_group *attrs);
40extern void cpu_remove_dev_attr_group(struct attribute_group *attrs); 41extern void cpu_remove_dev_attr_group(struct attribute_group *attrs);
41 42
43extern struct device *cpu_device_create(struct device *parent, void *drvdata,
44 const struct attribute_group **groups,
45 const char *fmt, ...);
42#ifdef CONFIG_HOTPLUG_CPU 46#ifdef CONFIG_HOTPLUG_CPU
43extern void unregister_cpu(struct cpu *cpu); 47extern void unregister_cpu(struct cpu *cpu);
44extern ssize_t arch_cpu_probe(const char *, size_t); 48extern ssize_t arch_cpu_probe(const char *, size_t);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 503b085b7832..4d078cebafd2 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -217,26 +217,26 @@ __ATTR(_name, 0644, show_##_name, store_##_name)
217 217
218 218
219struct cpufreq_driver { 219struct cpufreq_driver {
220 char name[CPUFREQ_NAME_LEN]; 220 char name[CPUFREQ_NAME_LEN];
221 u8 flags; 221 u8 flags;
222 void *driver_data; 222 void *driver_data;
223 223
224 /* needed by all drivers */ 224 /* needed by all drivers */
225 int (*init) (struct cpufreq_policy *policy); 225 int (*init)(struct cpufreq_policy *policy);
226 int (*verify) (struct cpufreq_policy *policy); 226 int (*verify)(struct cpufreq_policy *policy);
227 227
228 /* define one out of two */ 228 /* define one out of two */
229 int (*setpolicy) (struct cpufreq_policy *policy); 229 int (*setpolicy)(struct cpufreq_policy *policy);
230 230
231 /* 231 /*
232 * On failure, should always restore frequency to policy->restore_freq 232 * On failure, should always restore frequency to policy->restore_freq
233 * (i.e. old freq). 233 * (i.e. old freq).
234 */ 234 */
235 int (*target) (struct cpufreq_policy *policy, /* Deprecated */ 235 int (*target)(struct cpufreq_policy *policy,
236 unsigned int target_freq, 236 unsigned int target_freq,
237 unsigned int relation); 237 unsigned int relation); /* Deprecated */
238 int (*target_index) (struct cpufreq_policy *policy, 238 int (*target_index)(struct cpufreq_policy *policy,
239 unsigned int index); 239 unsigned int index);
240 /* 240 /*
241 * Only for drivers with target_index() and CPUFREQ_ASYNC_NOTIFICATION 241 * Only for drivers with target_index() and CPUFREQ_ASYNC_NOTIFICATION
242 * unset. 242 * unset.
@@ -252,27 +252,31 @@ struct cpufreq_driver {
252 * wish to switch to intermediate frequency for some target frequency. 252 * wish to switch to intermediate frequency for some target frequency.
253 * In that case core will directly call ->target_index(). 253 * In that case core will directly call ->target_index().
254 */ 254 */
255 unsigned int (*get_intermediate)(struct cpufreq_policy *policy, 255 unsigned int (*get_intermediate)(struct cpufreq_policy *policy,
256 unsigned int index); 256 unsigned int index);
257 int (*target_intermediate)(struct cpufreq_policy *policy, 257 int (*target_intermediate)(struct cpufreq_policy *policy,
258 unsigned int index); 258 unsigned int index);
259 259
260 /* should be defined, if possible */ 260 /* should be defined, if possible */
261 unsigned int (*get) (unsigned int cpu); 261 unsigned int (*get)(unsigned int cpu);
262 262
263 /* optional */ 263 /* optional */
264 int (*bios_limit) (int cpu, unsigned int *limit); 264 int (*bios_limit)(int cpu, unsigned int *limit);
265
266 int (*exit)(struct cpufreq_policy *policy);
267 void (*stop_cpu)(struct cpufreq_policy *policy);
268 int (*suspend)(struct cpufreq_policy *policy);
269 int (*resume)(struct cpufreq_policy *policy);
270
271 /* Will be called after the driver is fully initialized */
272 void (*ready)(struct cpufreq_policy *policy);
265 273
266 int (*exit) (struct cpufreq_policy *policy); 274 struct freq_attr **attr;
267 void (*stop_cpu) (struct cpufreq_policy *policy);
268 int (*suspend) (struct cpufreq_policy *policy);
269 int (*resume) (struct cpufreq_policy *policy);
270 struct freq_attr **attr;
271 275
272 /* platform specific boost support code */ 276 /* platform specific boost support code */
273 bool boost_supported; 277 bool boost_supported;
274 bool boost_enabled; 278 bool boost_enabled;
275 int (*set_boost) (int state); 279 int (*set_boost)(int state);
276}; 280};
277 281
278/* flags */ 282/* flags */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 25e0df6155a4..a07e087f54b2 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -53,7 +53,7 @@ struct cpuidle_state {
53}; 53};
54 54
55/* Idle State Flags */ 55/* Idle State Flags */
56#define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */ 56#define CPUIDLE_FLAG_TIME_INVALID (0x01) /* is residency time measurable? */
57#define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */ 57#define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */
58#define CPUIDLE_FLAG_TIMER_STOP (0x04) /* timer is stopped on this state */ 58#define CPUIDLE_FLAG_TIMER_STOP (0x04) /* timer is stopped on this state */
59 59
@@ -90,7 +90,7 @@ DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev);
90 * cpuidle_get_last_residency - retrieves the last state's residency time 90 * cpuidle_get_last_residency - retrieves the last state's residency time
91 * @dev: the target CPU 91 * @dev: the target CPU
92 * 92 *
93 * NOTE: this value is invalid if CPUIDLE_FLAG_TIME_VALID isn't set 93 * NOTE: this value is invalid if CPUIDLE_FLAG_TIME_INVALID is set
94 */ 94 */
95static inline int cpuidle_get_last_residency(struct cpuidle_device *dev) 95static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
96{ 96{
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 0a9a6da21e74..b950e9d6008b 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -803,6 +803,23 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
803} 803}
804#endif /* NR_CPUS > BITS_PER_LONG */ 804#endif /* NR_CPUS > BITS_PER_LONG */
805 805
806/**
807 * cpumap_print_to_pagebuf - copies the cpumask into the buffer either
808 * as comma-separated list of cpus or hex values of cpumask
809 * @list: indicates whether the cpumap must be list
810 * @mask: the cpumask to copy
811 * @buf: the buffer to copy into
812 *
813 * Returns the length of the (null-terminated) @buf string, zero if
814 * nothing is copied.
815 */
816static inline ssize_t
817cpumap_print_to_pagebuf(bool list, char *buf, const struct cpumask *mask)
818{
819 return bitmap_print_to_pagebuf(list, buf, cpumask_bits(mask),
820 nr_cpumask_bits);
821}
822
806/* 823/*
807 * 824 *
808 * From here down, all obsolete. Use cpumask_ variants! 825 * From here down, all obsolete. Use cpumask_ variants!
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 2f073db7392e..1b357997cac5 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -48,29 +48,16 @@ extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
48void cpuset_init_current_mems_allowed(void); 48void cpuset_init_current_mems_allowed(void);
49int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask); 49int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask);
50 50
51extern int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask); 51extern int __cpuset_node_allowed(int node, gfp_t gfp_mask);
52extern int __cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask);
53 52
54static inline int cpuset_node_allowed_softwall(int node, gfp_t gfp_mask) 53static inline int cpuset_node_allowed(int node, gfp_t gfp_mask)
55{ 54{
56 return nr_cpusets() <= 1 || 55 return nr_cpusets() <= 1 || __cpuset_node_allowed(node, gfp_mask);
57 __cpuset_node_allowed_softwall(node, gfp_mask);
58} 56}
59 57
60static inline int cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask) 58static inline int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
61{ 59{
62 return nr_cpusets() <= 1 || 60 return cpuset_node_allowed(zone_to_nid(z), gfp_mask);
63 __cpuset_node_allowed_hardwall(node, gfp_mask);
64}
65
66static inline int cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask)
67{
68 return cpuset_node_allowed_softwall(zone_to_nid(z), gfp_mask);
69}
70
71static inline int cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask)
72{
73 return cpuset_node_allowed_hardwall(zone_to_nid(z), gfp_mask);
74} 61}
75 62
76extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1, 63extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
@@ -179,22 +166,12 @@ static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
179 return 1; 166 return 1;
180} 167}
181 168
182static inline int cpuset_node_allowed_softwall(int node, gfp_t gfp_mask) 169static inline int cpuset_node_allowed(int node, gfp_t gfp_mask)
183{
184 return 1;
185}
186
187static inline int cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask)
188{
189 return 1;
190}
191
192static inline int cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask)
193{ 170{
194 return 1; 171 return 1;
195} 172}
196 173
197static inline int cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask) 174static inline int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
198{ 175{
199 return 1; 176 return 1;
200} 177}
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index d45e949699ea..9c8776d0ada8 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -26,6 +26,19 @@
26#include <linux/uaccess.h> 26#include <linux/uaccess.h>
27 27
28/* 28/*
29 * Autoloaded crypto modules should only use a prefixed name to avoid allowing
30 * arbitrary modules to be loaded. Loading from userspace may still need the
31 * unprefixed names, so retains those aliases as well.
32 * This uses __MODULE_INFO directly instead of MODULE_ALIAS because pre-4.3
33 * gcc (e.g. avr32 toolchain) uses __LINE__ for uniqueness, and this macro
34 * expands twice on the same line. Instead, use a separate base name for the
35 * alias.
36 */
37#define MODULE_ALIAS_CRYPTO(name) \
38 __MODULE_INFO(alias, alias_userspace, name); \
39 __MODULE_INFO(alias, alias_crypto, "crypto-" name)
40
41/*
29 * Algorithm masks and types. 42 * Algorithm masks and types.
30 */ 43 */
31#define CRYPTO_ALG_TYPE_MASK 0x0000000f 44#define CRYPTO_ALG_TYPE_MASK 0x0000000f
@@ -127,6 +140,13 @@ struct skcipher_givcrypt_request;
127 140
128typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err); 141typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);
129 142
143/**
144 * DOC: Block Cipher Context Data Structures
145 *
146 * These data structures define the operating context for each block cipher
147 * type.
148 */
149
130struct crypto_async_request { 150struct crypto_async_request {
131 struct list_head list; 151 struct list_head list;
132 crypto_completion_t complete; 152 crypto_completion_t complete;
@@ -194,9 +214,63 @@ struct hash_desc {
194 u32 flags; 214 u32 flags;
195}; 215};
196 216
197/* 217/**
198 * Algorithms: modular crypto algorithm implementations, managed 218 * DOC: Block Cipher Algorithm Definitions
199 * via crypto_register_alg() and crypto_unregister_alg(). 219 *
220 * These data structures define modular crypto algorithm implementations,
221 * managed via crypto_register_alg() and crypto_unregister_alg().
222 */
223
224/**
225 * struct ablkcipher_alg - asynchronous block cipher definition
226 * @min_keysize: Minimum key size supported by the transformation. This is the
227 * smallest key length supported by this transformation algorithm.
228 * This must be set to one of the pre-defined values as this is
229 * not hardware specific. Possible values for this field can be
230 * found via git grep "_MIN_KEY_SIZE" include/crypto/
231 * @max_keysize: Maximum key size supported by the transformation. This is the
232 * largest key length supported by this transformation algorithm.
233 * This must be set to one of the pre-defined values as this is
234 * not hardware specific. Possible values for this field can be
235 * found via git grep "_MAX_KEY_SIZE" include/crypto/
236 * @setkey: Set key for the transformation. This function is used to either
237 * program a supplied key into the hardware or store the key in the
238 * transformation context for programming it later. Note that this
239 * function does modify the transformation context. This function can
240 * be called multiple times during the existence of the transformation
241 * object, so one must make sure the key is properly reprogrammed into
242 * the hardware. This function is also responsible for checking the key
243 * length for validity. In case a software fallback was put in place in
244 * the @cra_init call, this function might need to use the fallback if
245 * the algorithm doesn't support all of the key sizes.
246 * @encrypt: Encrypt a scatterlist of blocks. This function is used to encrypt
247 * the supplied scatterlist containing the blocks of data. The crypto
248 * API consumer is responsible for aligning the entries of the
249 * scatterlist properly and making sure the chunks are correctly
250 * sized. In case a software fallback was put in place in the
251 * @cra_init call, this function might need to use the fallback if
252 * the algorithm doesn't support all of the key sizes. In case the
253 * key was stored in transformation context, the key might need to be
254 * re-programmed into the hardware in this function. This function
255 * shall not modify the transformation context, as this function may
256 * be called in parallel with the same transformation object.
257 * @decrypt: Decrypt a single block. This is a reverse counterpart to @encrypt
258 * and the conditions are exactly the same.
259 * @givencrypt: Update the IV for encryption. With this function, a cipher
260 * implementation may provide the function on how to update the IV
261 * for encryption.
262 * @givdecrypt: Update the IV for decryption. This is the reverse of
263 * @givencrypt .
264 * @geniv: The transformation implementation may use an "IV generator" provided
265 * by the kernel crypto API. Several use cases have a predefined
266 * approach how IVs are to be updated. For such use cases, the kernel
267 * crypto API provides ready-to-use implementations that can be
268 * referenced with this variable.
269 * @ivsize: IV size applicable for transformation. The consumer must provide an
270 * IV of exactly that size to perform the encrypt or decrypt operation.
271 *
272 * All fields except @givencrypt , @givdecrypt , @geniv and @ivsize are
273 * mandatory and must be filled.
200 */ 274 */
201struct ablkcipher_alg { 275struct ablkcipher_alg {
202 int (*setkey)(struct crypto_ablkcipher *tfm, const u8 *key, 276 int (*setkey)(struct crypto_ablkcipher *tfm, const u8 *key,
@@ -213,6 +287,32 @@ struct ablkcipher_alg {
213 unsigned int ivsize; 287 unsigned int ivsize;
214}; 288};
215 289
290/**
291 * struct aead_alg - AEAD cipher definition
292 * @maxauthsize: Set the maximum authentication tag size supported by the
293 * transformation. A transformation may support smaller tag sizes.
294 * As the authentication tag is a message digest to ensure the
295 * integrity of the encrypted data, a consumer typically wants the
296 * largest authentication tag possible as defined by this
297 * variable.
298 * @setauthsize: Set authentication size for the AEAD transformation. This
299 * function is used to specify the consumer requested size of the
300 * authentication tag to be either generated by the transformation
301 * during encryption or the size of the authentication tag to be
302 * supplied during the decryption operation. This function is also
303 * responsible for checking the authentication tag size for
304 * validity.
305 * @setkey: see struct ablkcipher_alg
306 * @encrypt: see struct ablkcipher_alg
307 * @decrypt: see struct ablkcipher_alg
308 * @givencrypt: see struct ablkcipher_alg
309 * @givdecrypt: see struct ablkcipher_alg
310 * @geniv: see struct ablkcipher_alg
311 * @ivsize: see struct ablkcipher_alg
312 *
313 * All fields except @givencrypt , @givdecrypt , @geniv and @ivsize are
314 * mandatory and must be filled.
315 */
216struct aead_alg { 316struct aead_alg {
217 int (*setkey)(struct crypto_aead *tfm, const u8 *key, 317 int (*setkey)(struct crypto_aead *tfm, const u8 *key,
218 unsigned int keylen); 318 unsigned int keylen);
@@ -228,6 +328,18 @@ struct aead_alg {
228 unsigned int maxauthsize; 328 unsigned int maxauthsize;
229}; 329};
230 330
331/**
332 * struct blkcipher_alg - synchronous block cipher definition
333 * @min_keysize: see struct ablkcipher_alg
334 * @max_keysize: see struct ablkcipher_alg
335 * @setkey: see struct ablkcipher_alg
336 * @encrypt: see struct ablkcipher_alg
337 * @decrypt: see struct ablkcipher_alg
338 * @geniv: see struct ablkcipher_alg
339 * @ivsize: see struct ablkcipher_alg
340 *
341 * All fields except @geniv and @ivsize are mandatory and must be filled.
342 */
231struct blkcipher_alg { 343struct blkcipher_alg {
232 int (*setkey)(struct crypto_tfm *tfm, const u8 *key, 344 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
233 unsigned int keylen); 345 unsigned int keylen);
@@ -245,6 +357,53 @@ struct blkcipher_alg {
245 unsigned int ivsize; 357 unsigned int ivsize;
246}; 358};
247 359
360/**
361 * struct cipher_alg - single-block symmetric ciphers definition
362 * @cia_min_keysize: Minimum key size supported by the transformation. This is
363 * the smallest key length supported by this transformation
364 * algorithm. This must be set to one of the pre-defined
365 * values as this is not hardware specific. Possible values
366 * for this field can be found via git grep "_MIN_KEY_SIZE"
367 * include/crypto/
368 * @cia_max_keysize: Maximum key size supported by the transformation. This is
369 * the largest key length supported by this transformation
370 * algorithm. This must be set to one of the pre-defined values
371 * as this is not hardware specific. Possible values for this
372 * field can be found via git grep "_MAX_KEY_SIZE"
373 * include/crypto/
374 * @cia_setkey: Set key for the transformation. This function is used to either
375 * program a supplied key into the hardware or store the key in the
376 * transformation context for programming it later. Note that this
377 * function does modify the transformation context. This function
378 * can be called multiple times during the existence of the
379 * transformation object, so one must make sure the key is properly
380 * reprogrammed into the hardware. This function is also
381 * responsible for checking the key length for validity.
382 * @cia_encrypt: Encrypt a single block. This function is used to encrypt a
383 * single block of data, which must be @cra_blocksize big. This
384 * always operates on a full @cra_blocksize and it is not possible
385 * to encrypt a block of smaller size. The supplied buffers must
386 * therefore also be at least of @cra_blocksize size. Both the
387 * input and output buffers are always aligned to @cra_alignmask.
388 * In case either of the input or output buffer supplied by user
389 * of the crypto API is not aligned to @cra_alignmask, the crypto
390 * API will re-align the buffers. The re-alignment means that a
391 * new buffer will be allocated, the data will be copied into the
392 * new buffer, then the processing will happen on the new buffer,
393 * then the data will be copied back into the original buffer and
394 * finally the new buffer will be freed. In case a software
395 * fallback was put in place in the @cra_init call, this function
396 * might need to use the fallback if the algorithm doesn't support
397 * all of the key sizes. In case the key was stored in
398 * transformation context, the key might need to be re-programmed
399 * into the hardware in this function. This function shall not
400 * modify the transformation context, as this function may be
401 * called in parallel with the same transformation object.
402 * @cia_decrypt: Decrypt a single block. This is a reverse counterpart to
403 * @cia_encrypt, and the conditions are exactly the same.
404 *
405 * All fields are mandatory and must be filled.
406 */
248struct cipher_alg { 407struct cipher_alg {
249 unsigned int cia_min_keysize; 408 unsigned int cia_min_keysize;
250 unsigned int cia_max_keysize; 409 unsigned int cia_max_keysize;
@@ -261,6 +420,25 @@ struct compress_alg {
261 unsigned int slen, u8 *dst, unsigned int *dlen); 420 unsigned int slen, u8 *dst, unsigned int *dlen);
262}; 421};
263 422
423/**
424 * struct rng_alg - random number generator definition
425 * @rng_make_random: The function defined by this variable obtains a random
426 * number. The random number generator transform must generate
427 * the random number out of the context provided with this
428 * call.
429 * @rng_reset: Reset of the random number generator by clearing the entire state.
430 * With the invocation of this function call, the random number
431 * generator shall completely reinitialize its state. If the random
432 * number generator requires a seed for setting up a new state,
433 * the seed must be provided by the consumer while invoking this
434 * function. The required size of the seed is defined with
435 * @seedsize .
436 * @seedsize: The seed size required for a random number generator
437 * initialization defined with this variable. Some random number
438 * generators like the SP800-90A DRBG does not require a seed as the
439 * seeding is implemented internally without the need of support by
440 * the consumer. In this case, the seed size is set to zero.
441 */
264struct rng_alg { 442struct rng_alg {
265 int (*rng_make_random)(struct crypto_rng *tfm, u8 *rdata, 443 int (*rng_make_random)(struct crypto_rng *tfm, u8 *rdata,
266 unsigned int dlen); 444 unsigned int dlen);
@@ -277,6 +455,81 @@ struct rng_alg {
277#define cra_compress cra_u.compress 455#define cra_compress cra_u.compress
278#define cra_rng cra_u.rng 456#define cra_rng cra_u.rng
279 457
458/**
459 * struct crypto_alg - definition of a cryptograpic cipher algorithm
460 * @cra_flags: Flags describing this transformation. See include/linux/crypto.h
461 * CRYPTO_ALG_* flags for the flags which go in here. Those are
462 * used for fine-tuning the description of the transformation
463 * algorithm.
464 * @cra_blocksize: Minimum block size of this transformation. The size in bytes
465 * of the smallest possible unit which can be transformed with
466 * this algorithm. The users must respect this value.
467 * In case of HASH transformation, it is possible for a smaller
468 * block than @cra_blocksize to be passed to the crypto API for
469 * transformation, in case of any other transformation type, an
470 * error will be returned upon any attempt to transform smaller
471 * than @cra_blocksize chunks.
472 * @cra_ctxsize: Size of the operational context of the transformation. This
473 * value informs the kernel crypto API about the memory size
474 * needed to be allocated for the transformation context.
475 * @cra_alignmask: Alignment mask for the input and output data buffer. The data
476 * buffer containing the input data for the algorithm must be
477 * aligned to this alignment mask. The data buffer for the
478 * output data must be aligned to this alignment mask. Note that
479 * the Crypto API will do the re-alignment in software, but
480 * only under special conditions and there is a performance hit.
481 * The re-alignment happens at these occasions for different
482 * @cra_u types: cipher -- For both input data and output data
483 * buffer; ahash -- For output hash destination buf; shash --
484 * For output hash destination buf.
485 * This is needed on hardware which is flawed by design and
486 * cannot pick data from arbitrary addresses.
487 * @cra_priority: Priority of this transformation implementation. In case
488 * multiple transformations with same @cra_name are available to
489 * the Crypto API, the kernel will use the one with highest
490 * @cra_priority.
491 * @cra_name: Generic name (usable by multiple implementations) of the
492 * transformation algorithm. This is the name of the transformation
493 * itself. This field is used by the kernel when looking up the
494 * providers of particular transformation.
495 * @cra_driver_name: Unique name of the transformation provider. This is the
496 * name of the provider of the transformation. This can be any
497 * arbitrary value, but in the usual case, this contains the
498 * name of the chip or provider and the name of the
499 * transformation algorithm.
500 * @cra_type: Type of the cryptographic transformation. This is a pointer to
501 * struct crypto_type, which implements callbacks common for all
502 * trasnformation types. There are multiple options:
503 * &crypto_blkcipher_type, &crypto_ablkcipher_type,
504 * &crypto_ahash_type, &crypto_aead_type, &crypto_rng_type.
505 * This field might be empty. In that case, there are no common
506 * callbacks. This is the case for: cipher, compress, shash.
507 * @cra_u: Callbacks implementing the transformation. This is a union of
508 * multiple structures. Depending on the type of transformation selected
509 * by @cra_type and @cra_flags above, the associated structure must be
510 * filled with callbacks. This field might be empty. This is the case
511 * for ahash, shash.
512 * @cra_init: Initialize the cryptographic transformation object. This function
513 * is used to initialize the cryptographic transformation object.
514 * This function is called only once at the instantiation time, right
515 * after the transformation context was allocated. In case the
516 * cryptographic hardware has some special requirements which need to
517 * be handled by software, this function shall check for the precise
518 * requirement of the transformation and put any software fallbacks
519 * in place.
520 * @cra_exit: Deinitialize the cryptographic transformation object. This is a
521 * counterpart to @cra_init, used to remove various changes set in
522 * @cra_init.
523 * @cra_module: Owner of this transformation implementation. Set to THIS_MODULE
524 * @cra_list: internally used
525 * @cra_users: internally used
526 * @cra_refcnt: internally used
527 * @cra_destroy: internally used
528 *
529 * The struct crypto_alg describes a generic Crypto API algorithm and is common
530 * for all of the transformations. Any variable not documented here shall not
531 * be used by a cipher implementation as it is internal to the Crypto API.
532 */
280struct crypto_alg { 533struct crypto_alg {
281 struct list_head cra_list; 534 struct list_head cra_list;
282 struct list_head cra_users; 535 struct list_head cra_users;
@@ -581,6 +834,50 @@ static inline u32 crypto_skcipher_mask(u32 mask)
581 return mask; 834 return mask;
582} 835}
583 836
837/**
838 * DOC: Asynchronous Block Cipher API
839 *
840 * Asynchronous block cipher API is used with the ciphers of type
841 * CRYPTO_ALG_TYPE_ABLKCIPHER (listed as type "ablkcipher" in /proc/crypto).
842 *
843 * Asynchronous cipher operations imply that the function invocation for a
844 * cipher request returns immediately before the completion of the operation.
845 * The cipher request is scheduled as a separate kernel thread and therefore
846 * load-balanced on the different CPUs via the process scheduler. To allow
847 * the kernel crypto API to inform the caller about the completion of a cipher
848 * request, the caller must provide a callback function. That function is
849 * invoked with the cipher handle when the request completes.
850 *
851 * To support the asynchronous operation, additional information than just the
852 * cipher handle must be supplied to the kernel crypto API. That additional
853 * information is given by filling in the ablkcipher_request data structure.
854 *
855 * For the asynchronous block cipher API, the state is maintained with the tfm
856 * cipher handle. A single tfm can be used across multiple calls and in
857 * parallel. For asynchronous block cipher calls, context data supplied and
858 * only used by the caller can be referenced the request data structure in
859 * addition to the IV used for the cipher request. The maintenance of such
860 * state information would be important for a crypto driver implementer to
861 * have, because when calling the callback function upon completion of the
862 * cipher operation, that callback function may need some information about
863 * which operation just finished if it invoked multiple in parallel. This
864 * state information is unused by the kernel crypto API.
865 */
866
867/**
868 * crypto_alloc_ablkcipher() - allocate asynchronous block cipher handle
869 * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
870 * ablkcipher cipher
871 * @type: specifies the type of the cipher
872 * @mask: specifies the mask for the cipher
873 *
874 * Allocate a cipher handle for an ablkcipher. The returned struct
875 * crypto_ablkcipher is the cipher handle that is required for any subsequent
876 * API invocation for that ablkcipher.
877 *
878 * Return: allocated cipher handle in case of success; IS_ERR() is true in case
879 * of an error, PTR_ERR() returns the error code.
880 */
584struct crypto_ablkcipher *crypto_alloc_ablkcipher(const char *alg_name, 881struct crypto_ablkcipher *crypto_alloc_ablkcipher(const char *alg_name,
585 u32 type, u32 mask); 882 u32 type, u32 mask);
586 883
@@ -590,11 +887,25 @@ static inline struct crypto_tfm *crypto_ablkcipher_tfm(
590 return &tfm->base; 887 return &tfm->base;
591} 888}
592 889
890/**
891 * crypto_free_ablkcipher() - zeroize and free cipher handle
892 * @tfm: cipher handle to be freed
893 */
593static inline void crypto_free_ablkcipher(struct crypto_ablkcipher *tfm) 894static inline void crypto_free_ablkcipher(struct crypto_ablkcipher *tfm)
594{ 895{
595 crypto_free_tfm(crypto_ablkcipher_tfm(tfm)); 896 crypto_free_tfm(crypto_ablkcipher_tfm(tfm));
596} 897}
597 898
899/**
900 * crypto_has_ablkcipher() - Search for the availability of an ablkcipher.
901 * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
902 * ablkcipher
903 * @type: specifies the type of the cipher
904 * @mask: specifies the mask for the cipher
905 *
906 * Return: true when the ablkcipher is known to the kernel crypto API; false
907 * otherwise
908 */
598static inline int crypto_has_ablkcipher(const char *alg_name, u32 type, 909static inline int crypto_has_ablkcipher(const char *alg_name, u32 type,
599 u32 mask) 910 u32 mask)
600{ 911{
@@ -608,12 +919,31 @@ static inline struct ablkcipher_tfm *crypto_ablkcipher_crt(
608 return &crypto_ablkcipher_tfm(tfm)->crt_ablkcipher; 919 return &crypto_ablkcipher_tfm(tfm)->crt_ablkcipher;
609} 920}
610 921
922/**
923 * crypto_ablkcipher_ivsize() - obtain IV size
924 * @tfm: cipher handle
925 *
926 * The size of the IV for the ablkcipher referenced by the cipher handle is
927 * returned. This IV size may be zero if the cipher does not need an IV.
928 *
929 * Return: IV size in bytes
930 */
611static inline unsigned int crypto_ablkcipher_ivsize( 931static inline unsigned int crypto_ablkcipher_ivsize(
612 struct crypto_ablkcipher *tfm) 932 struct crypto_ablkcipher *tfm)
613{ 933{
614 return crypto_ablkcipher_crt(tfm)->ivsize; 934 return crypto_ablkcipher_crt(tfm)->ivsize;
615} 935}
616 936
937/**
938 * crypto_ablkcipher_blocksize() - obtain block size of cipher
939 * @tfm: cipher handle
940 *
941 * The block size for the ablkcipher referenced with the cipher handle is
942 * returned. The caller may use that information to allocate appropriate
943 * memory for the data returned by the encryption or decryption operation
944 *
945 * Return: block size of cipher
946 */
617static inline unsigned int crypto_ablkcipher_blocksize( 947static inline unsigned int crypto_ablkcipher_blocksize(
618 struct crypto_ablkcipher *tfm) 948 struct crypto_ablkcipher *tfm)
619{ 949{
@@ -643,6 +973,22 @@ static inline void crypto_ablkcipher_clear_flags(struct crypto_ablkcipher *tfm,
643 crypto_tfm_clear_flags(crypto_ablkcipher_tfm(tfm), flags); 973 crypto_tfm_clear_flags(crypto_ablkcipher_tfm(tfm), flags);
644} 974}
645 975
976/**
977 * crypto_ablkcipher_setkey() - set key for cipher
978 * @tfm: cipher handle
979 * @key: buffer holding the key
980 * @keylen: length of the key in bytes
981 *
982 * The caller provided key is set for the ablkcipher referenced by the cipher
983 * handle.
984 *
985 * Note, the key length determines the cipher type. Many block ciphers implement
986 * different cipher modes depending on the key size, such as AES-128 vs AES-192
987 * vs. AES-256. When providing a 16 byte key for an AES cipher handle, AES-128
988 * is performed.
989 *
990 * Return: 0 if the setting of the key was successful; < 0 if an error occurred
991 */
646static inline int crypto_ablkcipher_setkey(struct crypto_ablkcipher *tfm, 992static inline int crypto_ablkcipher_setkey(struct crypto_ablkcipher *tfm,
647 const u8 *key, unsigned int keylen) 993 const u8 *key, unsigned int keylen)
648{ 994{
@@ -651,12 +997,32 @@ static inline int crypto_ablkcipher_setkey(struct crypto_ablkcipher *tfm,
651 return crt->setkey(crt->base, key, keylen); 997 return crt->setkey(crt->base, key, keylen);
652} 998}
653 999
1000/**
1001 * crypto_ablkcipher_reqtfm() - obtain cipher handle from request
1002 * @req: ablkcipher_request out of which the cipher handle is to be obtained
1003 *
1004 * Return the crypto_ablkcipher handle when furnishing an ablkcipher_request
1005 * data structure.
1006 *
1007 * Return: crypto_ablkcipher handle
1008 */
654static inline struct crypto_ablkcipher *crypto_ablkcipher_reqtfm( 1009static inline struct crypto_ablkcipher *crypto_ablkcipher_reqtfm(
655 struct ablkcipher_request *req) 1010 struct ablkcipher_request *req)
656{ 1011{
657 return __crypto_ablkcipher_cast(req->base.tfm); 1012 return __crypto_ablkcipher_cast(req->base.tfm);
658} 1013}
659 1014
1015/**
1016 * crypto_ablkcipher_encrypt() - encrypt plaintext
1017 * @req: reference to the ablkcipher_request handle that holds all information
1018 * needed to perform the cipher operation
1019 *
1020 * Encrypt plaintext data using the ablkcipher_request handle. That data
1021 * structure and how it is filled with data is discussed with the
1022 * ablkcipher_request_* functions.
1023 *
1024 * Return: 0 if the cipher operation was successful; < 0 if an error occurred
1025 */
660static inline int crypto_ablkcipher_encrypt(struct ablkcipher_request *req) 1026static inline int crypto_ablkcipher_encrypt(struct ablkcipher_request *req)
661{ 1027{
662 struct ablkcipher_tfm *crt = 1028 struct ablkcipher_tfm *crt =
@@ -664,6 +1030,17 @@ static inline int crypto_ablkcipher_encrypt(struct ablkcipher_request *req)
664 return crt->encrypt(req); 1030 return crt->encrypt(req);
665} 1031}
666 1032
1033/**
1034 * crypto_ablkcipher_decrypt() - decrypt ciphertext
1035 * @req: reference to the ablkcipher_request handle that holds all information
1036 * needed to perform the cipher operation
1037 *
1038 * Decrypt ciphertext data using the ablkcipher_request handle. That data
1039 * structure and how it is filled with data is discussed with the
1040 * ablkcipher_request_* functions.
1041 *
1042 * Return: 0 if the cipher operation was successful; < 0 if an error occurred
1043 */
667static inline int crypto_ablkcipher_decrypt(struct ablkcipher_request *req) 1044static inline int crypto_ablkcipher_decrypt(struct ablkcipher_request *req)
668{ 1045{
669 struct ablkcipher_tfm *crt = 1046 struct ablkcipher_tfm *crt =
@@ -671,12 +1048,37 @@ static inline int crypto_ablkcipher_decrypt(struct ablkcipher_request *req)
671 return crt->decrypt(req); 1048 return crt->decrypt(req);
672} 1049}
673 1050
1051/**
1052 * DOC: Asynchronous Cipher Request Handle
1053 *
1054 * The ablkcipher_request data structure contains all pointers to data
1055 * required for the asynchronous cipher operation. This includes the cipher
1056 * handle (which can be used by multiple ablkcipher_request instances), pointer
1057 * to plaintext and ciphertext, asynchronous callback function, etc. It acts
1058 * as a handle to the ablkcipher_request_* API calls in a similar way as
1059 * ablkcipher handle to the crypto_ablkcipher_* API calls.
1060 */
1061
1062/**
1063 * crypto_ablkcipher_reqsize() - obtain size of the request data structure
1064 * @tfm: cipher handle
1065 *
1066 * Return: number of bytes
1067 */
674static inline unsigned int crypto_ablkcipher_reqsize( 1068static inline unsigned int crypto_ablkcipher_reqsize(
675 struct crypto_ablkcipher *tfm) 1069 struct crypto_ablkcipher *tfm)
676{ 1070{
677 return crypto_ablkcipher_crt(tfm)->reqsize; 1071 return crypto_ablkcipher_crt(tfm)->reqsize;
678} 1072}
679 1073
1074/**
1075 * ablkcipher_request_set_tfm() - update cipher handle reference in request
1076 * @req: request handle to be modified
1077 * @tfm: cipher handle that shall be added to the request handle
1078 *
1079 * Allow the caller to replace the existing ablkcipher handle in the request
1080 * data structure with a different one.
1081 */
680static inline void ablkcipher_request_set_tfm( 1082static inline void ablkcipher_request_set_tfm(
681 struct ablkcipher_request *req, struct crypto_ablkcipher *tfm) 1083 struct ablkcipher_request *req, struct crypto_ablkcipher *tfm)
682{ 1084{
@@ -689,6 +1091,18 @@ static inline struct ablkcipher_request *ablkcipher_request_cast(
689 return container_of(req, struct ablkcipher_request, base); 1091 return container_of(req, struct ablkcipher_request, base);
690} 1092}
691 1093
1094/**
1095 * ablkcipher_request_alloc() - allocate request data structure
1096 * @tfm: cipher handle to be registered with the request
1097 * @gfp: memory allocation flag that is handed to kmalloc by the API call.
1098 *
1099 * Allocate the request data structure that must be used with the ablkcipher
1100 * encrypt and decrypt API calls. During the allocation, the provided ablkcipher
1101 * handle is registered in the request data structure.
1102 *
1103 * Return: allocated request handle in case of success; IS_ERR() is true in case
1104 * of an error, PTR_ERR() returns the error code.
1105 */
692static inline struct ablkcipher_request *ablkcipher_request_alloc( 1106static inline struct ablkcipher_request *ablkcipher_request_alloc(
693 struct crypto_ablkcipher *tfm, gfp_t gfp) 1107 struct crypto_ablkcipher *tfm, gfp_t gfp)
694{ 1108{
@@ -703,11 +1117,40 @@ static inline struct ablkcipher_request *ablkcipher_request_alloc(
703 return req; 1117 return req;
704} 1118}
705 1119
1120/**
1121 * ablkcipher_request_free() - zeroize and free request data structure
1122 * @req: request data structure cipher handle to be freed
1123 */
706static inline void ablkcipher_request_free(struct ablkcipher_request *req) 1124static inline void ablkcipher_request_free(struct ablkcipher_request *req)
707{ 1125{
708 kzfree(req); 1126 kzfree(req);
709} 1127}
710 1128
1129/**
1130 * ablkcipher_request_set_callback() - set asynchronous callback function
1131 * @req: request handle
1132 * @flags: specify zero or an ORing of the flags
1133 * CRYPTO_TFM_REQ_MAY_BACKLOG the request queue may back log and
1134 * increase the wait queue beyond the initial maximum size;
1135 * CRYPTO_TFM_REQ_MAY_SLEEP the request processing may sleep
1136 * @compl: callback function pointer to be registered with the request handle
1137 * @data: The data pointer refers to memory that is not used by the kernel
1138 * crypto API, but provided to the callback function for it to use. Here,
1139 * the caller can provide a reference to memory the callback function can
1140 * operate on. As the callback function is invoked asynchronously to the
1141 * related functionality, it may need to access data structures of the
1142 * related functionality which can be referenced using this pointer. The
1143 * callback function can access the memory via the "data" field in the
1144 * crypto_async_request data structure provided to the callback function.
1145 *
1146 * This function allows setting the callback function that is triggered once the
1147 * cipher operation completes.
1148 *
1149 * The callback function is registered with the ablkcipher_request handle and
1150 * must comply with the following template:
1151 *
1152 * void callback_function(struct crypto_async_request *req, int error)
1153 */
711static inline void ablkcipher_request_set_callback( 1154static inline void ablkcipher_request_set_callback(
712 struct ablkcipher_request *req, 1155 struct ablkcipher_request *req,
713 u32 flags, crypto_completion_t compl, void *data) 1156 u32 flags, crypto_completion_t compl, void *data)
@@ -717,6 +1160,22 @@ static inline void ablkcipher_request_set_callback(
717 req->base.flags = flags; 1160 req->base.flags = flags;
718} 1161}
719 1162
1163/**
1164 * ablkcipher_request_set_crypt() - set data buffers
1165 * @req: request handle
1166 * @src: source scatter / gather list
1167 * @dst: destination scatter / gather list
1168 * @nbytes: number of bytes to process from @src
1169 * @iv: IV for the cipher operation which must comply with the IV size defined
1170 * by crypto_ablkcipher_ivsize
1171 *
1172 * This function allows setting of the source data and destination data
1173 * scatter / gather lists.
1174 *
1175 * For encryption, the source is treated as the plaintext and the
1176 * destination is the ciphertext. For a decryption operation, the use is
1177 * reversed: the source is the ciphertext and the destination is the plaintext.
1178 */
720static inline void ablkcipher_request_set_crypt( 1179static inline void ablkcipher_request_set_crypt(
721 struct ablkcipher_request *req, 1180 struct ablkcipher_request *req,
722 struct scatterlist *src, struct scatterlist *dst, 1181 struct scatterlist *src, struct scatterlist *dst,
@@ -728,11 +1187,55 @@ static inline void ablkcipher_request_set_crypt(
728 req->info = iv; 1187 req->info = iv;
729} 1188}
730 1189
1190/**
1191 * DOC: Authenticated Encryption With Associated Data (AEAD) Cipher API
1192 *
1193 * The AEAD cipher API is used with the ciphers of type CRYPTO_ALG_TYPE_AEAD
1194 * (listed as type "aead" in /proc/crypto)
1195 *
1196 * The most prominent examples for this type of encryption is GCM and CCM.
1197 * However, the kernel supports other types of AEAD ciphers which are defined
1198 * with the following cipher string:
1199 *
1200 * authenc(keyed message digest, block cipher)
1201 *
1202 * For example: authenc(hmac(sha256), cbc(aes))
1203 *
1204 * The example code provided for the asynchronous block cipher operation
1205 * applies here as well. Naturally all *ablkcipher* symbols must be exchanged
1206 * the *aead* pendants discussed in the following. In addtion, for the AEAD
1207 * operation, the aead_request_set_assoc function must be used to set the
1208 * pointer to the associated data memory location before performing the
1209 * encryption or decryption operation. In case of an encryption, the associated
1210 * data memory is filled during the encryption operation. For decryption, the
1211 * associated data memory must contain data that is used to verify the integrity
1212 * of the decrypted data. Another deviation from the asynchronous block cipher
1213 * operation is that the caller should explicitly check for -EBADMSG of the
1214 * crypto_aead_decrypt. That error indicates an authentication error, i.e.
1215 * a breach in the integrity of the message. In essence, that -EBADMSG error
1216 * code is the key bonus an AEAD cipher has over "standard" block chaining
1217 * modes.
1218 */
1219
731static inline struct crypto_aead *__crypto_aead_cast(struct crypto_tfm *tfm) 1220static inline struct crypto_aead *__crypto_aead_cast(struct crypto_tfm *tfm)
732{ 1221{
733 return (struct crypto_aead *)tfm; 1222 return (struct crypto_aead *)tfm;
734} 1223}
735 1224
1225/**
1226 * crypto_alloc_aead() - allocate AEAD cipher handle
1227 * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
1228 * AEAD cipher
1229 * @type: specifies the type of the cipher
1230 * @mask: specifies the mask for the cipher
1231 *
1232 * Allocate a cipher handle for an AEAD. The returned struct
1233 * crypto_aead is the cipher handle that is required for any subsequent
1234 * API invocation for that AEAD.
1235 *
1236 * Return: allocated cipher handle in case of success; IS_ERR() is true in case
1237 * of an error, PTR_ERR() returns the error code.
1238 */
736struct crypto_aead *crypto_alloc_aead(const char *alg_name, u32 type, u32 mask); 1239struct crypto_aead *crypto_alloc_aead(const char *alg_name, u32 type, u32 mask);
737 1240
738static inline struct crypto_tfm *crypto_aead_tfm(struct crypto_aead *tfm) 1241static inline struct crypto_tfm *crypto_aead_tfm(struct crypto_aead *tfm)
@@ -740,6 +1243,10 @@ static inline struct crypto_tfm *crypto_aead_tfm(struct crypto_aead *tfm)
740 return &tfm->base; 1243 return &tfm->base;
741} 1244}
742 1245
1246/**
1247 * crypto_free_aead() - zeroize and free aead handle
1248 * @tfm: cipher handle to be freed
1249 */
743static inline void crypto_free_aead(struct crypto_aead *tfm) 1250static inline void crypto_free_aead(struct crypto_aead *tfm)
744{ 1251{
745 crypto_free_tfm(crypto_aead_tfm(tfm)); 1252 crypto_free_tfm(crypto_aead_tfm(tfm));
@@ -750,16 +1257,47 @@ static inline struct aead_tfm *crypto_aead_crt(struct crypto_aead *tfm)
750 return &crypto_aead_tfm(tfm)->crt_aead; 1257 return &crypto_aead_tfm(tfm)->crt_aead;
751} 1258}
752 1259
1260/**
1261 * crypto_aead_ivsize() - obtain IV size
1262 * @tfm: cipher handle
1263 *
1264 * The size of the IV for the aead referenced by the cipher handle is
1265 * returned. This IV size may be zero if the cipher does not need an IV.
1266 *
1267 * Return: IV size in bytes
1268 */
753static inline unsigned int crypto_aead_ivsize(struct crypto_aead *tfm) 1269static inline unsigned int crypto_aead_ivsize(struct crypto_aead *tfm)
754{ 1270{
755 return crypto_aead_crt(tfm)->ivsize; 1271 return crypto_aead_crt(tfm)->ivsize;
756} 1272}
757 1273
1274/**
1275 * crypto_aead_authsize() - obtain maximum authentication data size
1276 * @tfm: cipher handle
1277 *
1278 * The maximum size of the authentication data for the AEAD cipher referenced
1279 * by the AEAD cipher handle is returned. The authentication data size may be
1280 * zero if the cipher implements a hard-coded maximum.
1281 *
1282 * The authentication data may also be known as "tag value".
1283 *
1284 * Return: authentication data size / tag size in bytes
1285 */
758static inline unsigned int crypto_aead_authsize(struct crypto_aead *tfm) 1286static inline unsigned int crypto_aead_authsize(struct crypto_aead *tfm)
759{ 1287{
760 return crypto_aead_crt(tfm)->authsize; 1288 return crypto_aead_crt(tfm)->authsize;
761} 1289}
762 1290
1291/**
1292 * crypto_aead_blocksize() - obtain block size of cipher
1293 * @tfm: cipher handle
1294 *
1295 * The block size for the AEAD referenced with the cipher handle is returned.
1296 * The caller may use that information to allocate appropriate memory for the
1297 * data returned by the encryption or decryption operation
1298 *
1299 * Return: block size of cipher
1300 */
763static inline unsigned int crypto_aead_blocksize(struct crypto_aead *tfm) 1301static inline unsigned int crypto_aead_blocksize(struct crypto_aead *tfm)
764{ 1302{
765 return crypto_tfm_alg_blocksize(crypto_aead_tfm(tfm)); 1303 return crypto_tfm_alg_blocksize(crypto_aead_tfm(tfm));
@@ -785,6 +1323,22 @@ static inline void crypto_aead_clear_flags(struct crypto_aead *tfm, u32 flags)
785 crypto_tfm_clear_flags(crypto_aead_tfm(tfm), flags); 1323 crypto_tfm_clear_flags(crypto_aead_tfm(tfm), flags);
786} 1324}
787 1325
1326/**
1327 * crypto_aead_setkey() - set key for cipher
1328 * @tfm: cipher handle
1329 * @key: buffer holding the key
1330 * @keylen: length of the key in bytes
1331 *
1332 * The caller provided key is set for the AEAD referenced by the cipher
1333 * handle.
1334 *
1335 * Note, the key length determines the cipher type. Many block ciphers implement
1336 * different cipher modes depending on the key size, such as AES-128 vs AES-192
1337 * vs. AES-256. When providing a 16 byte key for an AES cipher handle, AES-128
1338 * is performed.
1339 *
1340 * Return: 0 if the setting of the key was successful; < 0 if an error occurred
1341 */
788static inline int crypto_aead_setkey(struct crypto_aead *tfm, const u8 *key, 1342static inline int crypto_aead_setkey(struct crypto_aead *tfm, const u8 *key,
789 unsigned int keylen) 1343 unsigned int keylen)
790{ 1344{
@@ -793,6 +1347,16 @@ static inline int crypto_aead_setkey(struct crypto_aead *tfm, const u8 *key,
793 return crt->setkey(crt->base, key, keylen); 1347 return crt->setkey(crt->base, key, keylen);
794} 1348}
795 1349
1350/**
1351 * crypto_aead_setauthsize() - set authentication data size
1352 * @tfm: cipher handle
1353 * @authsize: size of the authentication data / tag in bytes
1354 *
1355 * Set the authentication data size / tag size. AEAD requires an authentication
1356 * tag (or MAC) in addition to the associated data.
1357 *
1358 * Return: 0 if the setting of the key was successful; < 0 if an error occurred
1359 */
796int crypto_aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize); 1360int crypto_aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize);
797 1361
798static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req) 1362static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req)
@@ -800,27 +1364,105 @@ static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req)
800 return __crypto_aead_cast(req->base.tfm); 1364 return __crypto_aead_cast(req->base.tfm);
801} 1365}
802 1366
1367/**
1368 * crypto_aead_encrypt() - encrypt plaintext
1369 * @req: reference to the aead_request handle that holds all information
1370 * needed to perform the cipher operation
1371 *
1372 * Encrypt plaintext data using the aead_request handle. That data structure
1373 * and how it is filled with data is discussed with the aead_request_*
1374 * functions.
1375 *
1376 * IMPORTANT NOTE The encryption operation creates the authentication data /
1377 * tag. That data is concatenated with the created ciphertext.
1378 * The ciphertext memory size is therefore the given number of
1379 * block cipher blocks + the size defined by the
1380 * crypto_aead_setauthsize invocation. The caller must ensure
1381 * that sufficient memory is available for the ciphertext and
1382 * the authentication tag.
1383 *
1384 * Return: 0 if the cipher operation was successful; < 0 if an error occurred
1385 */
803static inline int crypto_aead_encrypt(struct aead_request *req) 1386static inline int crypto_aead_encrypt(struct aead_request *req)
804{ 1387{
805 return crypto_aead_crt(crypto_aead_reqtfm(req))->encrypt(req); 1388 return crypto_aead_crt(crypto_aead_reqtfm(req))->encrypt(req);
806} 1389}
807 1390
1391/**
1392 * crypto_aead_decrypt() - decrypt ciphertext
1393 * @req: reference to the ablkcipher_request handle that holds all information
1394 * needed to perform the cipher operation
1395 *
1396 * Decrypt ciphertext data using the aead_request handle. That data structure
1397 * and how it is filled with data is discussed with the aead_request_*
1398 * functions.
1399 *
1400 * IMPORTANT NOTE The caller must concatenate the ciphertext followed by the
1401 * authentication data / tag. That authentication data / tag
1402 * must have the size defined by the crypto_aead_setauthsize
1403 * invocation.
1404 *
1405 *
1406 * Return: 0 if the cipher operation was successful; -EBADMSG: The AEAD
1407 * cipher operation performs the authentication of the data during the
1408 * decryption operation. Therefore, the function returns this error if
1409 * the authentication of the ciphertext was unsuccessful (i.e. the
1410 * integrity of the ciphertext or the associated data was violated);
1411 * < 0 if an error occurred.
1412 */
808static inline int crypto_aead_decrypt(struct aead_request *req) 1413static inline int crypto_aead_decrypt(struct aead_request *req)
809{ 1414{
810 return crypto_aead_crt(crypto_aead_reqtfm(req))->decrypt(req); 1415 return crypto_aead_crt(crypto_aead_reqtfm(req))->decrypt(req);
811} 1416}
812 1417
1418/**
1419 * DOC: Asynchronous AEAD Request Handle
1420 *
1421 * The aead_request data structure contains all pointers to data required for
1422 * the AEAD cipher operation. This includes the cipher handle (which can be
1423 * used by multiple aead_request instances), pointer to plaintext and
1424 * ciphertext, asynchronous callback function, etc. It acts as a handle to the
1425 * aead_request_* API calls in a similar way as AEAD handle to the
1426 * crypto_aead_* API calls.
1427 */
1428
1429/**
1430 * crypto_aead_reqsize() - obtain size of the request data structure
1431 * @tfm: cipher handle
1432 *
1433 * Return: number of bytes
1434 */
813static inline unsigned int crypto_aead_reqsize(struct crypto_aead *tfm) 1435static inline unsigned int crypto_aead_reqsize(struct crypto_aead *tfm)
814{ 1436{
815 return crypto_aead_crt(tfm)->reqsize; 1437 return crypto_aead_crt(tfm)->reqsize;
816} 1438}
817 1439
1440/**
1441 * aead_request_set_tfm() - update cipher handle reference in request
1442 * @req: request handle to be modified
1443 * @tfm: cipher handle that shall be added to the request handle
1444 *
1445 * Allow the caller to replace the existing aead handle in the request
1446 * data structure with a different one.
1447 */
818static inline void aead_request_set_tfm(struct aead_request *req, 1448static inline void aead_request_set_tfm(struct aead_request *req,
819 struct crypto_aead *tfm) 1449 struct crypto_aead *tfm)
820{ 1450{
821 req->base.tfm = crypto_aead_tfm(crypto_aead_crt(tfm)->base); 1451 req->base.tfm = crypto_aead_tfm(crypto_aead_crt(tfm)->base);
822} 1452}
823 1453
1454/**
1455 * aead_request_alloc() - allocate request data structure
1456 * @tfm: cipher handle to be registered with the request
1457 * @gfp: memory allocation flag that is handed to kmalloc by the API call.
1458 *
1459 * Allocate the request data structure that must be used with the AEAD
1460 * encrypt and decrypt API calls. During the allocation, the provided aead
1461 * handle is registered in the request data structure.
1462 *
1463 * Return: allocated request handle in case of success; IS_ERR() is true in case
1464 * of an error, PTR_ERR() returns the error code.
1465 */
824static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm, 1466static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm,
825 gfp_t gfp) 1467 gfp_t gfp)
826{ 1468{
@@ -834,11 +1476,40 @@ static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm,
834 return req; 1476 return req;
835} 1477}
836 1478
1479/**
1480 * aead_request_free() - zeroize and free request data structure
1481 * @req: request data structure cipher handle to be freed
1482 */
837static inline void aead_request_free(struct aead_request *req) 1483static inline void aead_request_free(struct aead_request *req)
838{ 1484{
839 kzfree(req); 1485 kzfree(req);
840} 1486}
841 1487
1488/**
1489 * aead_request_set_callback() - set asynchronous callback function
1490 * @req: request handle
1491 * @flags: specify zero or an ORing of the flags
1492 * CRYPTO_TFM_REQ_MAY_BACKLOG the request queue may back log and
1493 * increase the wait queue beyond the initial maximum size;
1494 * CRYPTO_TFM_REQ_MAY_SLEEP the request processing may sleep
1495 * @compl: callback function pointer to be registered with the request handle
1496 * @data: The data pointer refers to memory that is not used by the kernel
1497 * crypto API, but provided to the callback function for it to use. Here,
1498 * the caller can provide a reference to memory the callback function can
1499 * operate on. As the callback function is invoked asynchronously to the
1500 * related functionality, it may need to access data structures of the
1501 * related functionality which can be referenced using this pointer. The
1502 * callback function can access the memory via the "data" field in the
1503 * crypto_async_request data structure provided to the callback function.
1504 *
1505 * Setting the callback function that is triggered once the cipher operation
1506 * completes
1507 *
1508 * The callback function is registered with the aead_request handle and
1509 * must comply with the following template:
1510 *
1511 * void callback_function(struct crypto_async_request *req, int error)
1512 */
842static inline void aead_request_set_callback(struct aead_request *req, 1513static inline void aead_request_set_callback(struct aead_request *req,
843 u32 flags, 1514 u32 flags,
844 crypto_completion_t compl, 1515 crypto_completion_t compl,
@@ -849,6 +1520,36 @@ static inline void aead_request_set_callback(struct aead_request *req,
849 req->base.flags = flags; 1520 req->base.flags = flags;
850} 1521}
851 1522
1523/**
1524 * aead_request_set_crypt - set data buffers
1525 * @req: request handle
1526 * @src: source scatter / gather list
1527 * @dst: destination scatter / gather list
1528 * @cryptlen: number of bytes to process from @src
1529 * @iv: IV for the cipher operation which must comply with the IV size defined
1530 * by crypto_aead_ivsize()
1531 *
1532 * Setting the source data and destination data scatter / gather lists.
1533 *
1534 * For encryption, the source is treated as the plaintext and the
1535 * destination is the ciphertext. For a decryption operation, the use is
1536 * reversed: the source is the ciphertext and the destination is the plaintext.
1537 *
1538 * IMPORTANT NOTE AEAD requires an authentication tag (MAC). For decryption,
1539 * the caller must concatenate the ciphertext followed by the
1540 * authentication tag and provide the entire data stream to the
1541 * decryption operation (i.e. the data length used for the
1542 * initialization of the scatterlist and the data length for the
1543 * decryption operation is identical). For encryption, however,
1544 * the authentication tag is created while encrypting the data.
1545 * The destination buffer must hold sufficient space for the
1546 * ciphertext and the authentication tag while the encryption
1547 * invocation must only point to the plaintext data size. The
1548 * following code snippet illustrates the memory usage
1549 * buffer = kmalloc(ptbuflen + (enc ? authsize : 0));
1550 * sg_init_one(&sg, buffer, ptbuflen + (enc ? authsize : 0));
1551 * aead_request_set_crypt(req, &sg, &sg, ptbuflen, iv);
1552 */
852static inline void aead_request_set_crypt(struct aead_request *req, 1553static inline void aead_request_set_crypt(struct aead_request *req,
853 struct scatterlist *src, 1554 struct scatterlist *src,
854 struct scatterlist *dst, 1555 struct scatterlist *dst,
@@ -860,6 +1561,15 @@ static inline void aead_request_set_crypt(struct aead_request *req,
860 req->iv = iv; 1561 req->iv = iv;
861} 1562}
862 1563
1564/**
1565 * aead_request_set_assoc() - set the associated data scatter / gather list
1566 * @req: request handle
1567 * @assoc: associated data scatter / gather list
1568 * @assoclen: number of bytes to process from @assoc
1569 *
1570 * For encryption, the memory is filled with the associated data. For
1571 * decryption, the memory must point to the associated data.
1572 */
863static inline void aead_request_set_assoc(struct aead_request *req, 1573static inline void aead_request_set_assoc(struct aead_request *req,
864 struct scatterlist *assoc, 1574 struct scatterlist *assoc,
865 unsigned int assoclen) 1575 unsigned int assoclen)
@@ -868,6 +1578,36 @@ static inline void aead_request_set_assoc(struct aead_request *req,
868 req->assoclen = assoclen; 1578 req->assoclen = assoclen;
869} 1579}
870 1580
1581/**
1582 * DOC: Synchronous Block Cipher API
1583 *
1584 * The synchronous block cipher API is used with the ciphers of type
1585 * CRYPTO_ALG_TYPE_BLKCIPHER (listed as type "blkcipher" in /proc/crypto)
1586 *
1587 * Synchronous calls, have a context in the tfm. But since a single tfm can be
1588 * used in multiple calls and in parallel, this info should not be changeable
1589 * (unless a lock is used). This applies, for example, to the symmetric key.
1590 * However, the IV is changeable, so there is an iv field in blkcipher_tfm
1591 * structure for synchronous blkcipher api. So, its the only state info that can
1592 * be kept for synchronous calls without using a big lock across a tfm.
1593 *
1594 * The block cipher API allows the use of a complete cipher, i.e. a cipher
1595 * consisting of a template (a block chaining mode) and a single block cipher
1596 * primitive (e.g. AES).
1597 *
1598 * The plaintext data buffer and the ciphertext data buffer are pointed to
1599 * by using scatter/gather lists. The cipher operation is performed
1600 * on all segments of the provided scatter/gather lists.
1601 *
1602 * The kernel crypto API supports a cipher operation "in-place" which means that
1603 * the caller may provide the same scatter/gather list for the plaintext and
1604 * cipher text. After the completion of the cipher operation, the plaintext
1605 * data is replaced with the ciphertext data in case of an encryption and vice
1606 * versa for a decryption. The caller must ensure that the scatter/gather lists
1607 * for the output data point to sufficiently large buffers, i.e. multiples of
1608 * the block size of the cipher.
1609 */
1610
871static inline struct crypto_blkcipher *__crypto_blkcipher_cast( 1611static inline struct crypto_blkcipher *__crypto_blkcipher_cast(
872 struct crypto_tfm *tfm) 1612 struct crypto_tfm *tfm)
873{ 1613{
@@ -881,6 +1621,20 @@ static inline struct crypto_blkcipher *crypto_blkcipher_cast(
881 return __crypto_blkcipher_cast(tfm); 1621 return __crypto_blkcipher_cast(tfm);
882} 1622}
883 1623
1624/**
1625 * crypto_alloc_blkcipher() - allocate synchronous block cipher handle
1626 * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
1627 * blkcipher cipher
1628 * @type: specifies the type of the cipher
1629 * @mask: specifies the mask for the cipher
1630 *
1631 * Allocate a cipher handle for a block cipher. The returned struct
1632 * crypto_blkcipher is the cipher handle that is required for any subsequent
1633 * API invocation for that block cipher.
1634 *
1635 * Return: allocated cipher handle in case of success; IS_ERR() is true in case
1636 * of an error, PTR_ERR() returns the error code.
1637 */
884static inline struct crypto_blkcipher *crypto_alloc_blkcipher( 1638static inline struct crypto_blkcipher *crypto_alloc_blkcipher(
885 const char *alg_name, u32 type, u32 mask) 1639 const char *alg_name, u32 type, u32 mask)
886{ 1640{
@@ -897,11 +1651,25 @@ static inline struct crypto_tfm *crypto_blkcipher_tfm(
897 return &tfm->base; 1651 return &tfm->base;
898} 1652}
899 1653
1654/**
1655 * crypto_free_blkcipher() - zeroize and free the block cipher handle
1656 * @tfm: cipher handle to be freed
1657 */
900static inline void crypto_free_blkcipher(struct crypto_blkcipher *tfm) 1658static inline void crypto_free_blkcipher(struct crypto_blkcipher *tfm)
901{ 1659{
902 crypto_free_tfm(crypto_blkcipher_tfm(tfm)); 1660 crypto_free_tfm(crypto_blkcipher_tfm(tfm));
903} 1661}
904 1662
1663/**
1664 * crypto_has_blkcipher() - Search for the availability of a block cipher
1665 * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
1666 * block cipher
1667 * @type: specifies the type of the cipher
1668 * @mask: specifies the mask for the cipher
1669 *
1670 * Return: true when the block cipher is known to the kernel crypto API; false
1671 * otherwise
1672 */
905static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask) 1673static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask)
906{ 1674{
907 type &= ~CRYPTO_ALG_TYPE_MASK; 1675 type &= ~CRYPTO_ALG_TYPE_MASK;
@@ -911,6 +1679,12 @@ static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask)
911 return crypto_has_alg(alg_name, type, mask); 1679 return crypto_has_alg(alg_name, type, mask);
912} 1680}
913 1681
1682/**
1683 * crypto_blkcipher_name() - return the name / cra_name from the cipher handle
1684 * @tfm: cipher handle
1685 *
1686 * Return: The character string holding the name of the cipher
1687 */
914static inline const char *crypto_blkcipher_name(struct crypto_blkcipher *tfm) 1688static inline const char *crypto_blkcipher_name(struct crypto_blkcipher *tfm)
915{ 1689{
916 return crypto_tfm_alg_name(crypto_blkcipher_tfm(tfm)); 1690 return crypto_tfm_alg_name(crypto_blkcipher_tfm(tfm));
@@ -928,11 +1702,30 @@ static inline struct blkcipher_alg *crypto_blkcipher_alg(
928 return &crypto_blkcipher_tfm(tfm)->__crt_alg->cra_blkcipher; 1702 return &crypto_blkcipher_tfm(tfm)->__crt_alg->cra_blkcipher;
929} 1703}
930 1704
1705/**
1706 * crypto_blkcipher_ivsize() - obtain IV size
1707 * @tfm: cipher handle
1708 *
1709 * The size of the IV for the block cipher referenced by the cipher handle is
1710 * returned. This IV size may be zero if the cipher does not need an IV.
1711 *
1712 * Return: IV size in bytes
1713 */
931static inline unsigned int crypto_blkcipher_ivsize(struct crypto_blkcipher *tfm) 1714static inline unsigned int crypto_blkcipher_ivsize(struct crypto_blkcipher *tfm)
932{ 1715{
933 return crypto_blkcipher_alg(tfm)->ivsize; 1716 return crypto_blkcipher_alg(tfm)->ivsize;
934} 1717}
935 1718
1719/**
1720 * crypto_blkcipher_blocksize() - obtain block size of cipher
1721 * @tfm: cipher handle
1722 *
1723 * The block size for the block cipher referenced with the cipher handle is
1724 * returned. The caller may use that information to allocate appropriate
1725 * memory for the data returned by the encryption or decryption operation.
1726 *
1727 * Return: block size of cipher
1728 */
936static inline unsigned int crypto_blkcipher_blocksize( 1729static inline unsigned int crypto_blkcipher_blocksize(
937 struct crypto_blkcipher *tfm) 1730 struct crypto_blkcipher *tfm)
938{ 1731{
@@ -962,6 +1755,22 @@ static inline void crypto_blkcipher_clear_flags(struct crypto_blkcipher *tfm,
962 crypto_tfm_clear_flags(crypto_blkcipher_tfm(tfm), flags); 1755 crypto_tfm_clear_flags(crypto_blkcipher_tfm(tfm), flags);
963} 1756}
964 1757
1758/**
1759 * crypto_blkcipher_setkey() - set key for cipher
1760 * @tfm: cipher handle
1761 * @key: buffer holding the key
1762 * @keylen: length of the key in bytes
1763 *
1764 * The caller provided key is set for the block cipher referenced by the cipher
1765 * handle.
1766 *
1767 * Note, the key length determines the cipher type. Many block ciphers implement
1768 * different cipher modes depending on the key size, such as AES-128 vs AES-192
1769 * vs. AES-256. When providing a 16 byte key for an AES cipher handle, AES-128
1770 * is performed.
1771 *
1772 * Return: 0 if the setting of the key was successful; < 0 if an error occurred
1773 */
965static inline int crypto_blkcipher_setkey(struct crypto_blkcipher *tfm, 1774static inline int crypto_blkcipher_setkey(struct crypto_blkcipher *tfm,
966 const u8 *key, unsigned int keylen) 1775 const u8 *key, unsigned int keylen)
967{ 1776{
@@ -969,6 +1778,24 @@ static inline int crypto_blkcipher_setkey(struct crypto_blkcipher *tfm,
969 key, keylen); 1778 key, keylen);
970} 1779}
971 1780
1781/**
1782 * crypto_blkcipher_encrypt() - encrypt plaintext
1783 * @desc: reference to the block cipher handle with meta data
1784 * @dst: scatter/gather list that is filled by the cipher operation with the
1785 * ciphertext
1786 * @src: scatter/gather list that holds the plaintext
1787 * @nbytes: number of bytes of the plaintext to encrypt.
1788 *
1789 * Encrypt plaintext data using the IV set by the caller with a preceding
1790 * call of crypto_blkcipher_set_iv.
1791 *
1792 * The blkcipher_desc data structure must be filled by the caller and can
1793 * reside on the stack. The caller must fill desc as follows: desc.tfm is filled
1794 * with the block cipher handle; desc.flags is filled with either
1795 * CRYPTO_TFM_REQ_MAY_SLEEP or 0.
1796 *
1797 * Return: 0 if the cipher operation was successful; < 0 if an error occurred
1798 */
972static inline int crypto_blkcipher_encrypt(struct blkcipher_desc *desc, 1799static inline int crypto_blkcipher_encrypt(struct blkcipher_desc *desc,
973 struct scatterlist *dst, 1800 struct scatterlist *dst,
974 struct scatterlist *src, 1801 struct scatterlist *src,
@@ -978,6 +1805,25 @@ static inline int crypto_blkcipher_encrypt(struct blkcipher_desc *desc,
978 return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes); 1805 return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes);
979} 1806}
980 1807
1808/**
1809 * crypto_blkcipher_encrypt_iv() - encrypt plaintext with dedicated IV
1810 * @desc: reference to the block cipher handle with meta data
1811 * @dst: scatter/gather list that is filled by the cipher operation with the
1812 * ciphertext
1813 * @src: scatter/gather list that holds the plaintext
1814 * @nbytes: number of bytes of the plaintext to encrypt.
1815 *
1816 * Encrypt plaintext data with the use of an IV that is solely used for this
1817 * cipher operation. Any previously set IV is not used.
1818 *
1819 * The blkcipher_desc data structure must be filled by the caller and can
1820 * reside on the stack. The caller must fill desc as follows: desc.tfm is filled
1821 * with the block cipher handle; desc.info is filled with the IV to be used for
1822 * the current operation; desc.flags is filled with either
1823 * CRYPTO_TFM_REQ_MAY_SLEEP or 0.
1824 *
1825 * Return: 0 if the cipher operation was successful; < 0 if an error occurred
1826 */
981static inline int crypto_blkcipher_encrypt_iv(struct blkcipher_desc *desc, 1827static inline int crypto_blkcipher_encrypt_iv(struct blkcipher_desc *desc,
982 struct scatterlist *dst, 1828 struct scatterlist *dst,
983 struct scatterlist *src, 1829 struct scatterlist *src,
@@ -986,6 +1832,23 @@ static inline int crypto_blkcipher_encrypt_iv(struct blkcipher_desc *desc,
986 return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes); 1832 return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes);
987} 1833}
988 1834
1835/**
1836 * crypto_blkcipher_decrypt() - decrypt ciphertext
1837 * @desc: reference to the block cipher handle with meta data
1838 * @dst: scatter/gather list that is filled by the cipher operation with the
1839 * plaintext
1840 * @src: scatter/gather list that holds the ciphertext
1841 * @nbytes: number of bytes of the ciphertext to decrypt.
1842 *
1843 * Decrypt ciphertext data using the IV set by the caller with a preceding
1844 * call of crypto_blkcipher_set_iv.
1845 *
1846 * The blkcipher_desc data structure must be filled by the caller as documented
1847 * for the crypto_blkcipher_encrypt call above.
1848 *
1849 * Return: 0 if the cipher operation was successful; < 0 if an error occurred
1850 *
1851 */
989static inline int crypto_blkcipher_decrypt(struct blkcipher_desc *desc, 1852static inline int crypto_blkcipher_decrypt(struct blkcipher_desc *desc,
990 struct scatterlist *dst, 1853 struct scatterlist *dst,
991 struct scatterlist *src, 1854 struct scatterlist *src,
@@ -995,6 +1858,22 @@ static inline int crypto_blkcipher_decrypt(struct blkcipher_desc *desc,
995 return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes); 1858 return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes);
996} 1859}
997 1860
1861/**
1862 * crypto_blkcipher_decrypt_iv() - decrypt ciphertext with dedicated IV
1863 * @desc: reference to the block cipher handle with meta data
1864 * @dst: scatter/gather list that is filled by the cipher operation with the
1865 * plaintext
1866 * @src: scatter/gather list that holds the ciphertext
1867 * @nbytes: number of bytes of the ciphertext to decrypt.
1868 *
1869 * Decrypt ciphertext data with the use of an IV that is solely used for this
1870 * cipher operation. Any previously set IV is not used.
1871 *
1872 * The blkcipher_desc data structure must be filled by the caller as documented
1873 * for the crypto_blkcipher_encrypt_iv call above.
1874 *
1875 * Return: 0 if the cipher operation was successful; < 0 if an error occurred
1876 */
998static inline int crypto_blkcipher_decrypt_iv(struct blkcipher_desc *desc, 1877static inline int crypto_blkcipher_decrypt_iv(struct blkcipher_desc *desc,
999 struct scatterlist *dst, 1878 struct scatterlist *dst,
1000 struct scatterlist *src, 1879 struct scatterlist *src,
@@ -1003,18 +1882,54 @@ static inline int crypto_blkcipher_decrypt_iv(struct blkcipher_desc *desc,
1003 return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes); 1882 return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes);
1004} 1883}
1005 1884
1885/**
1886 * crypto_blkcipher_set_iv() - set IV for cipher
1887 * @tfm: cipher handle
1888 * @src: buffer holding the IV
1889 * @len: length of the IV in bytes
1890 *
1891 * The caller provided IV is set for the block cipher referenced by the cipher
1892 * handle.
1893 */
1006static inline void crypto_blkcipher_set_iv(struct crypto_blkcipher *tfm, 1894static inline void crypto_blkcipher_set_iv(struct crypto_blkcipher *tfm,
1007 const u8 *src, unsigned int len) 1895 const u8 *src, unsigned int len)
1008{ 1896{
1009 memcpy(crypto_blkcipher_crt(tfm)->iv, src, len); 1897 memcpy(crypto_blkcipher_crt(tfm)->iv, src, len);
1010} 1898}
1011 1899
1900/**
1901 * crypto_blkcipher_get_iv() - obtain IV from cipher
1902 * @tfm: cipher handle
1903 * @dst: buffer filled with the IV
1904 * @len: length of the buffer dst
1905 *
1906 * The caller can obtain the IV set for the block cipher referenced by the
1907 * cipher handle and store it into the user-provided buffer. If the buffer
1908 * has an insufficient space, the IV is truncated to fit the buffer.
1909 */
1012static inline void crypto_blkcipher_get_iv(struct crypto_blkcipher *tfm, 1910static inline void crypto_blkcipher_get_iv(struct crypto_blkcipher *tfm,
1013 u8 *dst, unsigned int len) 1911 u8 *dst, unsigned int len)
1014{ 1912{
1015 memcpy(dst, crypto_blkcipher_crt(tfm)->iv, len); 1913 memcpy(dst, crypto_blkcipher_crt(tfm)->iv, len);
1016} 1914}
1017 1915
1916/**
1917 * DOC: Single Block Cipher API
1918 *
1919 * The single block cipher API is used with the ciphers of type
1920 * CRYPTO_ALG_TYPE_CIPHER (listed as type "cipher" in /proc/crypto).
1921 *
1922 * Using the single block cipher API calls, operations with the basic cipher
1923 * primitive can be implemented. These cipher primitives exclude any block
1924 * chaining operations including IV handling.
1925 *
1926 * The purpose of this single block cipher API is to support the implementation
1927 * of templates or other concepts that only need to perform the cipher operation
1928 * on one block at a time. Templates invoke the underlying cipher primitive
1929 * block-wise and process either the input or the output data of these cipher
1930 * operations.
1931 */
1932
1018static inline struct crypto_cipher *__crypto_cipher_cast(struct crypto_tfm *tfm) 1933static inline struct crypto_cipher *__crypto_cipher_cast(struct crypto_tfm *tfm)
1019{ 1934{
1020 return (struct crypto_cipher *)tfm; 1935 return (struct crypto_cipher *)tfm;
@@ -1026,6 +1941,20 @@ static inline struct crypto_cipher *crypto_cipher_cast(struct crypto_tfm *tfm)
1026 return __crypto_cipher_cast(tfm); 1941 return __crypto_cipher_cast(tfm);
1027} 1942}
1028 1943
1944/**
1945 * crypto_alloc_cipher() - allocate single block cipher handle
1946 * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
1947 * single block cipher
1948 * @type: specifies the type of the cipher
1949 * @mask: specifies the mask for the cipher
1950 *
1951 * Allocate a cipher handle for a single block cipher. The returned struct
1952 * crypto_cipher is the cipher handle that is required for any subsequent API
1953 * invocation for that single block cipher.
1954 *
1955 * Return: allocated cipher handle in case of success; IS_ERR() is true in case
1956 * of an error, PTR_ERR() returns the error code.
1957 */
1029static inline struct crypto_cipher *crypto_alloc_cipher(const char *alg_name, 1958static inline struct crypto_cipher *crypto_alloc_cipher(const char *alg_name,
1030 u32 type, u32 mask) 1959 u32 type, u32 mask)
1031{ 1960{
@@ -1041,11 +1970,25 @@ static inline struct crypto_tfm *crypto_cipher_tfm(struct crypto_cipher *tfm)
1041 return &tfm->base; 1970 return &tfm->base;
1042} 1971}
1043 1972
1973/**
1974 * crypto_free_cipher() - zeroize and free the single block cipher handle
1975 * @tfm: cipher handle to be freed
1976 */
1044static inline void crypto_free_cipher(struct crypto_cipher *tfm) 1977static inline void crypto_free_cipher(struct crypto_cipher *tfm)
1045{ 1978{
1046 crypto_free_tfm(crypto_cipher_tfm(tfm)); 1979 crypto_free_tfm(crypto_cipher_tfm(tfm));
1047} 1980}
1048 1981
1982/**
1983 * crypto_has_cipher() - Search for the availability of a single block cipher
1984 * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
1985 * single block cipher
1986 * @type: specifies the type of the cipher
1987 * @mask: specifies the mask for the cipher
1988 *
1989 * Return: true when the single block cipher is known to the kernel crypto API;
1990 * false otherwise
1991 */
1049static inline int crypto_has_cipher(const char *alg_name, u32 type, u32 mask) 1992static inline int crypto_has_cipher(const char *alg_name, u32 type, u32 mask)
1050{ 1993{
1051 type &= ~CRYPTO_ALG_TYPE_MASK; 1994 type &= ~CRYPTO_ALG_TYPE_MASK;
@@ -1060,6 +2003,16 @@ static inline struct cipher_tfm *crypto_cipher_crt(struct crypto_cipher *tfm)
1060 return &crypto_cipher_tfm(tfm)->crt_cipher; 2003 return &crypto_cipher_tfm(tfm)->crt_cipher;
1061} 2004}
1062 2005
2006/**
2007 * crypto_cipher_blocksize() - obtain block size for cipher
2008 * @tfm: cipher handle
2009 *
2010 * The block size for the single block cipher referenced with the cipher handle
2011 * tfm is returned. The caller may use that information to allocate appropriate
2012 * memory for the data returned by the encryption or decryption operation
2013 *
2014 * Return: block size of cipher
2015 */
1063static inline unsigned int crypto_cipher_blocksize(struct crypto_cipher *tfm) 2016static inline unsigned int crypto_cipher_blocksize(struct crypto_cipher *tfm)
1064{ 2017{
1065 return crypto_tfm_alg_blocksize(crypto_cipher_tfm(tfm)); 2018 return crypto_tfm_alg_blocksize(crypto_cipher_tfm(tfm));
@@ -1087,6 +2040,22 @@ static inline void crypto_cipher_clear_flags(struct crypto_cipher *tfm,
1087 crypto_tfm_clear_flags(crypto_cipher_tfm(tfm), flags); 2040 crypto_tfm_clear_flags(crypto_cipher_tfm(tfm), flags);
1088} 2041}
1089 2042
2043/**
2044 * crypto_cipher_setkey() - set key for cipher
2045 * @tfm: cipher handle
2046 * @key: buffer holding the key
2047 * @keylen: length of the key in bytes
2048 *
2049 * The caller provided key is set for the single block cipher referenced by the
2050 * cipher handle.
2051 *
2052 * Note, the key length determines the cipher type. Many block ciphers implement
2053 * different cipher modes depending on the key size, such as AES-128 vs AES-192
2054 * vs. AES-256. When providing a 16 byte key for an AES cipher handle, AES-128
2055 * is performed.
2056 *
2057 * Return: 0 if the setting of the key was successful; < 0 if an error occurred
2058 */
1090static inline int crypto_cipher_setkey(struct crypto_cipher *tfm, 2059static inline int crypto_cipher_setkey(struct crypto_cipher *tfm,
1091 const u8 *key, unsigned int keylen) 2060 const u8 *key, unsigned int keylen)
1092{ 2061{
@@ -1094,6 +2063,15 @@ static inline int crypto_cipher_setkey(struct crypto_cipher *tfm,
1094 key, keylen); 2063 key, keylen);
1095} 2064}
1096 2065
2066/**
2067 * crypto_cipher_encrypt_one() - encrypt one block of plaintext
2068 * @tfm: cipher handle
2069 * @dst: points to the buffer that will be filled with the ciphertext
2070 * @src: buffer holding the plaintext to be encrypted
2071 *
2072 * Invoke the encryption operation of one block. The caller must ensure that
2073 * the plaintext and ciphertext buffers are at least one block in size.
2074 */
1097static inline void crypto_cipher_encrypt_one(struct crypto_cipher *tfm, 2075static inline void crypto_cipher_encrypt_one(struct crypto_cipher *tfm,
1098 u8 *dst, const u8 *src) 2076 u8 *dst, const u8 *src)
1099{ 2077{
@@ -1101,6 +2079,15 @@ static inline void crypto_cipher_encrypt_one(struct crypto_cipher *tfm,
1101 dst, src); 2079 dst, src);
1102} 2080}
1103 2081
2082/**
2083 * crypto_cipher_decrypt_one() - decrypt one block of ciphertext
2084 * @tfm: cipher handle
2085 * @dst: points to the buffer that will be filled with the plaintext
2086 * @src: buffer holding the ciphertext to be decrypted
2087 *
2088 * Invoke the decryption operation of one block. The caller must ensure that
2089 * the plaintext and ciphertext buffers are at least one block in size.
2090 */
1104static inline void crypto_cipher_decrypt_one(struct crypto_cipher *tfm, 2091static inline void crypto_cipher_decrypt_one(struct crypto_cipher *tfm,
1105 u8 *dst, const u8 *src) 2092 u8 *dst, const u8 *src)
1106{ 2093{
@@ -1108,6 +2095,13 @@ static inline void crypto_cipher_decrypt_one(struct crypto_cipher *tfm,
1108 dst, src); 2095 dst, src);
1109} 2096}
1110 2097
2098/**
2099 * DOC: Synchronous Message Digest API
2100 *
2101 * The synchronous message digest API is used with the ciphers of type
2102 * CRYPTO_ALG_TYPE_HASH (listed as type "hash" in /proc/crypto)
2103 */
2104
1111static inline struct crypto_hash *__crypto_hash_cast(struct crypto_tfm *tfm) 2105static inline struct crypto_hash *__crypto_hash_cast(struct crypto_tfm *tfm)
1112{ 2106{
1113 return (struct crypto_hash *)tfm; 2107 return (struct crypto_hash *)tfm;
@@ -1120,6 +2114,20 @@ static inline struct crypto_hash *crypto_hash_cast(struct crypto_tfm *tfm)
1120 return __crypto_hash_cast(tfm); 2114 return __crypto_hash_cast(tfm);
1121} 2115}
1122 2116
2117/**
2118 * crypto_alloc_hash() - allocate synchronous message digest handle
2119 * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
2120 * message digest cipher
2121 * @type: specifies the type of the cipher
2122 * @mask: specifies the mask for the cipher
2123 *
2124 * Allocate a cipher handle for a message digest. The returned struct
2125 * crypto_hash is the cipher handle that is required for any subsequent
2126 * API invocation for that message digest.
2127 *
2128 * Return: allocated cipher handle in case of success; IS_ERR() is true in case
2129 * of an error, PTR_ERR() returns the error code.
2130 */
1123static inline struct crypto_hash *crypto_alloc_hash(const char *alg_name, 2131static inline struct crypto_hash *crypto_alloc_hash(const char *alg_name,
1124 u32 type, u32 mask) 2132 u32 type, u32 mask)
1125{ 2133{
@@ -1136,11 +2144,25 @@ static inline struct crypto_tfm *crypto_hash_tfm(struct crypto_hash *tfm)
1136 return &tfm->base; 2144 return &tfm->base;
1137} 2145}
1138 2146
2147/**
2148 * crypto_free_hash() - zeroize and free message digest handle
2149 * @tfm: cipher handle to be freed
2150 */
1139static inline void crypto_free_hash(struct crypto_hash *tfm) 2151static inline void crypto_free_hash(struct crypto_hash *tfm)
1140{ 2152{
1141 crypto_free_tfm(crypto_hash_tfm(tfm)); 2153 crypto_free_tfm(crypto_hash_tfm(tfm));
1142} 2154}
1143 2155
2156/**
2157 * crypto_has_hash() - Search for the availability of a message digest
2158 * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
2159 * message digest cipher
2160 * @type: specifies the type of the cipher
2161 * @mask: specifies the mask for the cipher
2162 *
2163 * Return: true when the message digest cipher is known to the kernel crypto
2164 * API; false otherwise
2165 */
1144static inline int crypto_has_hash(const char *alg_name, u32 type, u32 mask) 2166static inline int crypto_has_hash(const char *alg_name, u32 type, u32 mask)
1145{ 2167{
1146 type &= ~CRYPTO_ALG_TYPE_MASK; 2168 type &= ~CRYPTO_ALG_TYPE_MASK;
@@ -1156,6 +2178,15 @@ static inline struct hash_tfm *crypto_hash_crt(struct crypto_hash *tfm)
1156 return &crypto_hash_tfm(tfm)->crt_hash; 2178 return &crypto_hash_tfm(tfm)->crt_hash;
1157} 2179}
1158 2180
2181/**
2182 * crypto_hash_blocksize() - obtain block size for message digest
2183 * @tfm: cipher handle
2184 *
2185 * The block size for the message digest cipher referenced with the cipher
2186 * handle is returned.
2187 *
2188 * Return: block size of cipher
2189 */
1159static inline unsigned int crypto_hash_blocksize(struct crypto_hash *tfm) 2190static inline unsigned int crypto_hash_blocksize(struct crypto_hash *tfm)
1160{ 2191{
1161 return crypto_tfm_alg_blocksize(crypto_hash_tfm(tfm)); 2192 return crypto_tfm_alg_blocksize(crypto_hash_tfm(tfm));
@@ -1166,6 +2197,15 @@ static inline unsigned int crypto_hash_alignmask(struct crypto_hash *tfm)
1166 return crypto_tfm_alg_alignmask(crypto_hash_tfm(tfm)); 2197 return crypto_tfm_alg_alignmask(crypto_hash_tfm(tfm));
1167} 2198}
1168 2199
2200/**
2201 * crypto_hash_digestsize() - obtain message digest size
2202 * @tfm: cipher handle
2203 *
2204 * The size for the message digest created by the message digest cipher
2205 * referenced with the cipher handle is returned.
2206 *
2207 * Return: message digest size
2208 */
1169static inline unsigned int crypto_hash_digestsize(struct crypto_hash *tfm) 2209static inline unsigned int crypto_hash_digestsize(struct crypto_hash *tfm)
1170{ 2210{
1171 return crypto_hash_crt(tfm)->digestsize; 2211 return crypto_hash_crt(tfm)->digestsize;
@@ -1186,11 +2226,38 @@ static inline void crypto_hash_clear_flags(struct crypto_hash *tfm, u32 flags)
1186 crypto_tfm_clear_flags(crypto_hash_tfm(tfm), flags); 2226 crypto_tfm_clear_flags(crypto_hash_tfm(tfm), flags);
1187} 2227}
1188 2228
2229/**
2230 * crypto_hash_init() - (re)initialize message digest handle
2231 * @desc: cipher request handle that to be filled by caller --
2232 * desc.tfm is filled with the hash cipher handle;
2233 * desc.flags is filled with either CRYPTO_TFM_REQ_MAY_SLEEP or 0.
2234 *
2235 * The call (re-)initializes the message digest referenced by the hash cipher
2236 * request handle. Any potentially existing state created by previous
2237 * operations is discarded.
2238 *
2239 * Return: 0 if the message digest initialization was successful; < 0 if an
2240 * error occurred
2241 */
1189static inline int crypto_hash_init(struct hash_desc *desc) 2242static inline int crypto_hash_init(struct hash_desc *desc)
1190{ 2243{
1191 return crypto_hash_crt(desc->tfm)->init(desc); 2244 return crypto_hash_crt(desc->tfm)->init(desc);
1192} 2245}
1193 2246
2247/**
2248 * crypto_hash_update() - add data to message digest for processing
2249 * @desc: cipher request handle
2250 * @sg: scatter / gather list pointing to the data to be added to the message
2251 * digest
2252 * @nbytes: number of bytes to be processed from @sg
2253 *
2254 * Updates the message digest state of the cipher handle pointed to by the
2255 * hash cipher request handle with the input data pointed to by the
2256 * scatter/gather list.
2257 *
2258 * Return: 0 if the message digest update was successful; < 0 if an error
2259 * occurred
2260 */
1194static inline int crypto_hash_update(struct hash_desc *desc, 2261static inline int crypto_hash_update(struct hash_desc *desc,
1195 struct scatterlist *sg, 2262 struct scatterlist *sg,
1196 unsigned int nbytes) 2263 unsigned int nbytes)
@@ -1198,11 +2265,39 @@ static inline int crypto_hash_update(struct hash_desc *desc,
1198 return crypto_hash_crt(desc->tfm)->update(desc, sg, nbytes); 2265 return crypto_hash_crt(desc->tfm)->update(desc, sg, nbytes);
1199} 2266}
1200 2267
2268/**
2269 * crypto_hash_final() - calculate message digest
2270 * @desc: cipher request handle
2271 * @out: message digest output buffer -- The caller must ensure that the out
2272 * buffer has a sufficient size (e.g. by using the crypto_hash_digestsize
2273 * function).
2274 *
2275 * Finalize the message digest operation and create the message digest
2276 * based on all data added to the cipher handle. The message digest is placed
2277 * into the output buffer.
2278 *
2279 * Return: 0 if the message digest creation was successful; < 0 if an error
2280 * occurred
2281 */
1201static inline int crypto_hash_final(struct hash_desc *desc, u8 *out) 2282static inline int crypto_hash_final(struct hash_desc *desc, u8 *out)
1202{ 2283{
1203 return crypto_hash_crt(desc->tfm)->final(desc, out); 2284 return crypto_hash_crt(desc->tfm)->final(desc, out);
1204} 2285}
1205 2286
2287/**
2288 * crypto_hash_digest() - calculate message digest for a buffer
2289 * @desc: see crypto_hash_final()
2290 * @sg: see crypto_hash_update()
2291 * @nbytes: see crypto_hash_update()
2292 * @out: see crypto_hash_final()
2293 *
2294 * This function is a "short-hand" for the function calls of crypto_hash_init,
2295 * crypto_hash_update and crypto_hash_final. The parameters have the same
2296 * meaning as discussed for those separate three functions.
2297 *
2298 * Return: 0 if the message digest creation was successful; < 0 if an error
2299 * occurred
2300 */
1206static inline int crypto_hash_digest(struct hash_desc *desc, 2301static inline int crypto_hash_digest(struct hash_desc *desc,
1207 struct scatterlist *sg, 2302 struct scatterlist *sg,
1208 unsigned int nbytes, u8 *out) 2303 unsigned int nbytes, u8 *out)
@@ -1210,6 +2305,17 @@ static inline int crypto_hash_digest(struct hash_desc *desc,
1210 return crypto_hash_crt(desc->tfm)->digest(desc, sg, nbytes, out); 2305 return crypto_hash_crt(desc->tfm)->digest(desc, sg, nbytes, out);
1211} 2306}
1212 2307
2308/**
2309 * crypto_hash_setkey() - set key for message digest
2310 * @hash: cipher handle
2311 * @key: buffer holding the key
2312 * @keylen: length of the key in bytes
2313 *
2314 * The caller provided key is set for the message digest cipher. The cipher
2315 * handle must point to a keyed hash in order for this function to succeed.
2316 *
2317 * Return: 0 if the setting of the key was successful; < 0 if an error occurred
2318 */
1213static inline int crypto_hash_setkey(struct crypto_hash *hash, 2319static inline int crypto_hash_setkey(struct crypto_hash *hash,
1214 const u8 *key, unsigned int keylen) 2320 const u8 *key, unsigned int keylen)
1215{ 2321{
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index b2a2a08523bf..5a813988e6d4 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -124,15 +124,15 @@ struct dentry {
124 void *d_fsdata; /* fs-specific data */ 124 void *d_fsdata; /* fs-specific data */
125 125
126 struct list_head d_lru; /* LRU list */ 126 struct list_head d_lru; /* LRU list */
127 struct list_head d_child; /* child of parent list */
128 struct list_head d_subdirs; /* our children */
127 /* 129 /*
128 * d_child and d_rcu can share memory 130 * d_alias and d_rcu can share memory
129 */ 131 */
130 union { 132 union {
131 struct list_head d_child; /* child of parent list */ 133 struct hlist_node d_alias; /* inode alias list */
132 struct rcu_head d_rcu; 134 struct rcu_head d_rcu;
133 } d_u; 135 } d_u;
134 struct list_head d_subdirs; /* our children */
135 struct hlist_node d_alias; /* inode alias list */
136}; 136};
137 137
138/* 138/*
@@ -230,7 +230,6 @@ extern seqlock_t rename_lock;
230 */ 230 */
231extern void d_instantiate(struct dentry *, struct inode *); 231extern void d_instantiate(struct dentry *, struct inode *);
232extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); 232extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
233extern struct dentry * d_materialise_unique(struct dentry *, struct inode *);
234extern int d_instantiate_no_diralias(struct dentry *, struct inode *); 233extern int d_instantiate_no_diralias(struct dentry *, struct inode *);
235extern void __d_drop(struct dentry *dentry); 234extern void __d_drop(struct dentry *dentry);
236extern void d_drop(struct dentry *dentry); 235extern void d_drop(struct dentry *dentry);
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 4d0b4d1aa132..da4c4983adbe 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -20,6 +20,7 @@
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22 22
23struct device;
23struct file_operations; 24struct file_operations;
24 25
25struct debugfs_blob_wrapper { 26struct debugfs_blob_wrapper {
@@ -92,20 +93,25 @@ struct dentry *debugfs_create_regset32(const char *name, umode_t mode,
92 struct dentry *parent, 93 struct dentry *parent,
93 struct debugfs_regset32 *regset); 94 struct debugfs_regset32 *regset);
94 95
95int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, 96void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
96 int nregs, void __iomem *base, char *prefix); 97 int nregs, void __iomem *base, char *prefix);
97 98
98struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, 99struct dentry *debugfs_create_u32_array(const char *name, umode_t mode,
99 struct dentry *parent, 100 struct dentry *parent,
100 u32 *array, u32 elements); 101 u32 *array, u32 elements);
101 102
103struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
104 struct dentry *parent,
105 int (*read_fn)(struct seq_file *s,
106 void *data));
107
102bool debugfs_initialized(void); 108bool debugfs_initialized(void);
103 109
104#else 110#else
105 111
106#include <linux/err.h> 112#include <linux/err.h>
107 113
108/* 114/*
109 * We do not return NULL from these functions if CONFIG_DEBUG_FS is not enabled 115 * We do not return NULL from these functions if CONFIG_DEBUG_FS is not enabled
110 * so users have a chance to detect if there was a real error or not. We don't 116 * so users have a chance to detect if there was a real error or not. We don't
111 * want to duplicate the design decision mistakes of procfs and devfs again. 117 * want to duplicate the design decision mistakes of procfs and devfs again.
@@ -233,10 +239,9 @@ static inline struct dentry *debugfs_create_regset32(const char *name,
233 return ERR_PTR(-ENODEV); 239 return ERR_PTR(-ENODEV);
234} 240}
235 241
236static inline int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, 242static inline void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
237 int nregs, void __iomem *base, char *prefix) 243 int nregs, void __iomem *base, char *prefix)
238{ 244{
239 return 0;
240} 245}
241 246
242static inline bool debugfs_initialized(void) 247static inline bool debugfs_initialized(void)
@@ -251,6 +256,15 @@ static inline struct dentry *debugfs_create_u32_array(const char *name, umode_t
251 return ERR_PTR(-ENODEV); 256 return ERR_PTR(-ENODEV);
252} 257}
253 258
259static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev,
260 const char *name,
261 struct dentry *parent,
262 int (*read_fn)(struct seq_file *s,
263 void *data))
264{
265 return ERR_PTR(-ENODEV);
266}
267
254#endif 268#endif
255 269
256#endif 270#endif
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index e1707de043ae..ca6d2acc5eb7 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -64,6 +64,7 @@ typedef int (*dm_request_endio_fn) (struct dm_target *ti,
64 union map_info *map_context); 64 union map_info *map_context);
65 65
66typedef void (*dm_presuspend_fn) (struct dm_target *ti); 66typedef void (*dm_presuspend_fn) (struct dm_target *ti);
67typedef void (*dm_presuspend_undo_fn) (struct dm_target *ti);
67typedef void (*dm_postsuspend_fn) (struct dm_target *ti); 68typedef void (*dm_postsuspend_fn) (struct dm_target *ti);
68typedef int (*dm_preresume_fn) (struct dm_target *ti); 69typedef int (*dm_preresume_fn) (struct dm_target *ti);
69typedef void (*dm_resume_fn) (struct dm_target *ti); 70typedef void (*dm_resume_fn) (struct dm_target *ti);
@@ -145,6 +146,7 @@ struct target_type {
145 dm_endio_fn end_io; 146 dm_endio_fn end_io;
146 dm_request_endio_fn rq_end_io; 147 dm_request_endio_fn rq_end_io;
147 dm_presuspend_fn presuspend; 148 dm_presuspend_fn presuspend;
149 dm_presuspend_undo_fn presuspend_undo;
148 dm_postsuspend_fn postsuspend; 150 dm_postsuspend_fn postsuspend;
149 dm_preresume_fn preresume; 151 dm_preresume_fn preresume;
150 dm_resume_fn resume; 152 dm_resume_fn resume;
diff --git a/include/linux/device.h b/include/linux/device.h
index ce1f21608b16..fb506738f7b7 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -911,6 +911,11 @@ static inline void device_unlock(struct device *dev)
911 mutex_unlock(&dev->mutex); 911 mutex_unlock(&dev->mutex);
912} 912}
913 913
914static inline void device_lock_assert(struct device *dev)
915{
916 lockdep_assert_held(&dev->mutex);
917}
918
914void driver_init(void); 919void driver_init(void);
915 920
916/* 921/*
@@ -1118,6 +1123,41 @@ do { \
1118}) 1123})
1119#endif 1124#endif
1120 1125
1126#ifdef CONFIG_PRINTK
1127#define dev_level_once(dev_level, dev, fmt, ...) \
1128do { \
1129 static bool __print_once __read_mostly; \
1130 \
1131 if (!__print_once) { \
1132 __print_once = true; \
1133 dev_level(dev, fmt, ##__VA_ARGS__); \
1134 } \
1135} while (0)
1136#else
1137#define dev_level_once(dev_level, dev, fmt, ...) \
1138do { \
1139 if (0) \
1140 dev_level(dev, fmt, ##__VA_ARGS__); \
1141} while (0)
1142#endif
1143
1144#define dev_emerg_once(dev, fmt, ...) \
1145 dev_level_once(dev_emerg, dev, fmt, ##__VA_ARGS__)
1146#define dev_alert_once(dev, fmt, ...) \
1147 dev_level_once(dev_alert, dev, fmt, ##__VA_ARGS__)
1148#define dev_crit_once(dev, fmt, ...) \
1149 dev_level_once(dev_crit, dev, fmt, ##__VA_ARGS__)
1150#define dev_err_once(dev, fmt, ...) \
1151 dev_level_once(dev_err, dev, fmt, ##__VA_ARGS__)
1152#define dev_warn_once(dev, fmt, ...) \
1153 dev_level_once(dev_warn, dev, fmt, ##__VA_ARGS__)
1154#define dev_notice_once(dev, fmt, ...) \
1155 dev_level_once(dev_notice, dev, fmt, ##__VA_ARGS__)
1156#define dev_info_once(dev, fmt, ...) \
1157 dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__)
1158#define dev_dbg_once(dev, fmt, ...) \
1159 dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__)
1160
1121#define dev_level_ratelimited(dev_level, dev, fmt, ...) \ 1161#define dev_level_ratelimited(dev_level, dev, fmt, ...) \
1122do { \ 1162do { \
1123 static DEFINE_RATELIMIT_STATE(_rs, \ 1163 static DEFINE_RATELIMIT_STATE(_rs, \
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 653a1fd07ae8..40cd75e21ea2 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -447,7 +447,8 @@ struct dmaengine_unmap_data {
447 * communicate status 447 * communicate status
448 * @phys: physical address of the descriptor 448 * @phys: physical address of the descriptor
449 * @chan: target channel for this operation 449 * @chan: target channel for this operation
450 * @tx_submit: set the prepared descriptor(s) to be executed by the engine 450 * @tx_submit: accept the descriptor, assign ordered cookie and mark the
451 * descriptor pending. To be pushed on .issue_pending() call
451 * @callback: routine to call after this operation is complete 452 * @callback: routine to call after this operation is complete
452 * @callback_param: general parameter to pass to the callback routine 453 * @callback_param: general parameter to pass to the callback routine
453 * ---async_tx api specific fields--- 454 * ---async_tx api specific fields---
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 593fff99e6bf..30624954dec5 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -30,6 +30,12 @@
30 30
31struct acpi_dmar_header; 31struct acpi_dmar_header;
32 32
33#ifdef CONFIG_X86
34# define DMAR_UNITS_SUPPORTED MAX_IO_APICS
35#else
36# define DMAR_UNITS_SUPPORTED 64
37#endif
38
33/* DMAR Flags */ 39/* DMAR Flags */
34#define DMAR_INTR_REMAP 0x1 40#define DMAR_INTR_REMAP 0x1
35#define DMAR_X2APIC_OPT_OUT 0x2 41#define DMAR_X2APIC_OPT_OUT 0x2
@@ -120,28 +126,60 @@ extern int dmar_remove_dev_scope(struct dmar_pci_notify_info *info,
120/* Intel IOMMU detection */ 126/* Intel IOMMU detection */
121extern int detect_intel_iommu(void); 127extern int detect_intel_iommu(void);
122extern int enable_drhd_fault_handling(void); 128extern int enable_drhd_fault_handling(void);
129extern int dmar_device_add(acpi_handle handle);
130extern int dmar_device_remove(acpi_handle handle);
131
132static inline int dmar_res_noop(struct acpi_dmar_header *hdr, void *arg)
133{
134 return 0;
135}
123 136
124#ifdef CONFIG_INTEL_IOMMU 137#ifdef CONFIG_INTEL_IOMMU
125extern int iommu_detected, no_iommu; 138extern int iommu_detected, no_iommu;
126extern int intel_iommu_init(void); 139extern int intel_iommu_init(void);
127extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header); 140extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg);
128extern int dmar_parse_one_atsr(struct acpi_dmar_header *header); 141extern int dmar_parse_one_atsr(struct acpi_dmar_header *header, void *arg);
142extern int dmar_check_one_atsr(struct acpi_dmar_header *hdr, void *arg);
143extern int dmar_release_one_atsr(struct acpi_dmar_header *hdr, void *arg);
144extern int dmar_iommu_hotplug(struct dmar_drhd_unit *dmaru, bool insert);
129extern int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info); 145extern int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info);
130#else /* !CONFIG_INTEL_IOMMU: */ 146#else /* !CONFIG_INTEL_IOMMU: */
131static inline int intel_iommu_init(void) { return -ENODEV; } 147static inline int intel_iommu_init(void) { return -ENODEV; }
132static inline int dmar_parse_one_rmrr(struct acpi_dmar_header *header) 148
149#define dmar_parse_one_rmrr dmar_res_noop
150#define dmar_parse_one_atsr dmar_res_noop
151#define dmar_check_one_atsr dmar_res_noop
152#define dmar_release_one_atsr dmar_res_noop
153
154static inline int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info)
133{ 155{
134 return 0; 156 return 0;
135} 157}
136static inline int dmar_parse_one_atsr(struct acpi_dmar_header *header) 158
159static inline int dmar_iommu_hotplug(struct dmar_drhd_unit *dmaru, bool insert)
137{ 160{
138 return 0; 161 return 0;
139} 162}
140static inline int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info) 163#endif /* CONFIG_INTEL_IOMMU */
164
165#ifdef CONFIG_IRQ_REMAP
166extern int dmar_ir_hotplug(struct dmar_drhd_unit *dmaru, bool insert);
167#else /* CONFIG_IRQ_REMAP */
168static inline int dmar_ir_hotplug(struct dmar_drhd_unit *dmaru, bool insert)
169{ return 0; }
170#endif /* CONFIG_IRQ_REMAP */
171
172#else /* CONFIG_DMAR_TABLE */
173
174static inline int dmar_device_add(void *handle)
175{
176 return 0;
177}
178
179static inline int dmar_device_remove(void *handle)
141{ 180{
142 return 0; 181 return 0;
143} 182}
144#endif /* CONFIG_INTEL_IOMMU */
145 183
146#endif /* CONFIG_DMAR_TABLE */ 184#endif /* CONFIG_DMAR_TABLE */
147 185
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index debb70d40547..8723f2a99e15 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -172,7 +172,7 @@ enum drbd_ret_code {
172 ERR_RES_NOT_KNOWN = 158, 172 ERR_RES_NOT_KNOWN = 158,
173 ERR_RES_IN_USE = 159, 173 ERR_RES_IN_USE = 159,
174 ERR_MINOR_CONFIGURED = 160, 174 ERR_MINOR_CONFIGURED = 160,
175 ERR_MINOR_EXISTS = 161, 175 ERR_MINOR_OR_VOLUME_EXISTS = 161,
176 ERR_INVALID_REQUEST = 162, 176 ERR_INVALID_REQUEST = 162,
177 ERR_NEED_APV_100 = 163, 177 ERR_NEED_APV_100 = 163,
178 ERR_NEED_ALLOW_TWO_PRI = 164, 178 ERR_NEED_ALLOW_TWO_PRI = 164,
diff --git a/include/linux/edac.h b/include/linux/edac.h
index e1e68da6f35c..da3b72e95db3 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -194,7 +194,8 @@ static inline char *mc_event_error_type(const unsigned int err_type)
194 * @MEM_DDR3: DDR3 RAM 194 * @MEM_DDR3: DDR3 RAM
195 * @MEM_RDDR3: Registered DDR3 RAM 195 * @MEM_RDDR3: Registered DDR3 RAM
196 * This is a variant of the DDR3 memories. 196 * This is a variant of the DDR3 memories.
197 * @MEM_DDR4: DDR4 RAM 197 * @MEM_LRDDR3 Load-Reduced DDR3 memory.
198 * @MEM_DDR4: Unbuffered DDR4 RAM
198 * @MEM_RDDR4: Registered DDR4 RAM 199 * @MEM_RDDR4: Registered DDR4 RAM
199 * This is a variant of the DDR4 memories. 200 * This is a variant of the DDR4 memories.
200 */ 201 */
@@ -216,6 +217,7 @@ enum mem_type {
216 MEM_XDR, 217 MEM_XDR,
217 MEM_DDR3, 218 MEM_DDR3,
218 MEM_RDDR3, 219 MEM_RDDR3,
220 MEM_LRDDR3,
219 MEM_DDR4, 221 MEM_DDR4,
220 MEM_RDDR4, 222 MEM_RDDR4,
221}; 223};
diff --git a/include/linux/eeprom_93cx6.h b/include/linux/eeprom_93cx6.h
index e50f98b0297a..eb0b1988050a 100644
--- a/include/linux/eeprom_93cx6.h
+++ b/include/linux/eeprom_93cx6.h
@@ -75,6 +75,10 @@ extern void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom,
75 const u8 word, u16 *data); 75 const u8 word, u16 *data);
76extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom, 76extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom,
77 const u8 word, __le16 *data, const u16 words); 77 const u8 word, __le16 *data, const u16 words);
78extern void eeprom_93cx6_readb(struct eeprom_93cx6 *eeprom,
79 const u8 byte, u8 *data);
80extern void eeprom_93cx6_multireadb(struct eeprom_93cx6 *eeprom,
81 const u8 byte, u8 *data, const u16 bytes);
78 82
79extern void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable); 83extern void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable);
80 84
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 0949f9c7e872..0238d612750e 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -547,6 +547,9 @@ void efi_native_runtime_setup(void);
547#define SMBIOS_TABLE_GUID \ 547#define SMBIOS_TABLE_GUID \
548 EFI_GUID( 0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d ) 548 EFI_GUID( 0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
549 549
550#define SMBIOS3_TABLE_GUID \
551 EFI_GUID( 0xf2fd1544, 0x9794, 0x4a2c, 0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94 )
552
550#define SAL_SYSTEM_TABLE_GUID \ 553#define SAL_SYSTEM_TABLE_GUID \
551 EFI_GUID( 0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d ) 554 EFI_GUID( 0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
552 555
@@ -810,7 +813,8 @@ extern struct efi {
810 unsigned long mps; /* MPS table */ 813 unsigned long mps; /* MPS table */
811 unsigned long acpi; /* ACPI table (IA64 ext 0.71) */ 814 unsigned long acpi; /* ACPI table (IA64 ext 0.71) */
812 unsigned long acpi20; /* ACPI table (ACPI 2.0) */ 815 unsigned long acpi20; /* ACPI table (ACPI 2.0) */
813 unsigned long smbios; /* SM BIOS table */ 816 unsigned long smbios; /* SMBIOS table (32 bit entry point) */
817 unsigned long smbios3; /* SMBIOS table (64 bit entry point) */
814 unsigned long sal_systab; /* SAL system table */ 818 unsigned long sal_systab; /* SAL system table */
815 unsigned long boot_info; /* boot info table */ 819 unsigned long boot_info; /* boot info table */
816 unsigned long hcdp; /* HCDP table */ 820 unsigned long hcdp; /* HCDP table */
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 67a5fa7830c4..20fa8d8ae313 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -15,6 +15,11 @@
15 set_personality(PER_LINUX | (current->personality & (~PER_MASK))) 15 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
16#endif 16#endif
17 17
18#ifndef SET_PERSONALITY2
19#define SET_PERSONALITY2(ex, state) \
20 SET_PERSONALITY(ex)
21#endif
22
18#if ELF_CLASS == ELFCLASS32 23#if ELF_CLASS == ELFCLASS32
19 24
20extern Elf32_Dyn _DYNAMIC []; 25extern Elf32_Dyn _DYNAMIC [];
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 733980fce8e3..41c891d05f04 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -392,4 +392,16 @@ static inline unsigned long compare_ether_header(const void *a, const void *b)
392#endif 392#endif
393} 393}
394 394
395/**
396 * eth_skb_pad - Pad buffer to mininum number of octets for Ethernet frame
397 * @skb: Buffer to pad
398 *
399 * An Ethernet frame should have a minimum size of 60 bytes. This function
400 * takes short frames and pads them with zeros up to the 60 byte limit.
401 */
402static inline int eth_skb_pad(struct sk_buff *skb)
403{
404 return skb_put_padto(skb, ETH_ZLEN);
405}
406
395#endif /* _LINUX_ETHERDEVICE_H */ 407#endif /* _LINUX_ETHERDEVICE_H */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index c1a2d60dfb82..653dc9c4ebac 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -59,6 +59,26 @@ enum ethtool_phys_id_state {
59 ETHTOOL_ID_OFF 59 ETHTOOL_ID_OFF
60}; 60};
61 61
62enum {
63 ETH_RSS_HASH_TOP_BIT, /* Configurable RSS hash function - Toeplitz */
64 ETH_RSS_HASH_XOR_BIT, /* Configurable RSS hash function - Xor */
65
66 /*
67 * Add your fresh new hash function bits above and remember to update
68 * rss_hash_func_strings[] in ethtool.c
69 */
70 ETH_RSS_HASH_FUNCS_COUNT
71};
72
73#define __ETH_RSS_HASH_BIT(bit) ((u32)1 << (bit))
74#define __ETH_RSS_HASH(name) __ETH_RSS_HASH_BIT(ETH_RSS_HASH_##name##_BIT)
75
76#define ETH_RSS_HASH_TOP __ETH_RSS_HASH(TOP)
77#define ETH_RSS_HASH_XOR __ETH_RSS_HASH(XOR)
78
79#define ETH_RSS_HASH_UNKNOWN 0
80#define ETH_RSS_HASH_NO_CHANGE 0
81
62struct net_device; 82struct net_device;
63 83
64/* Some generic methods drivers may use in their ethtool_ops */ 84/* Some generic methods drivers may use in their ethtool_ops */
@@ -158,17 +178,14 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
158 * Returns zero if not supported for this specific device. 178 * Returns zero if not supported for this specific device.
159 * @get_rxfh_indir_size: Get the size of the RX flow hash indirection table. 179 * @get_rxfh_indir_size: Get the size of the RX flow hash indirection table.
160 * Returns zero if not supported for this specific device. 180 * Returns zero if not supported for this specific device.
161 * @get_rxfh: Get the contents of the RX flow hash indirection table and hash 181 * @get_rxfh: Get the contents of the RX flow hash indirection table, hash key
162 * key. 182 * and/or hash function.
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.
165 * Returns a negative error code or zero.
166 * @set_rxfh: Set the contents of the RX flow hash indirection table and/or
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.
171 * Returns a negative error code or zero. 183 * Returns a negative error code or zero.
184 * @set_rxfh: Set the contents of the RX flow hash indirection table, hash
185 * key, and/or hash function. Arguments which are set to %NULL or zero
186 * will remain unchanged.
187 * Returns a negative error code or zero. An error code must be returned
188 * if at least one unsupported change was requested.
172 * @get_channels: Get number of channels. 189 * @get_channels: Get number of channels.
173 * @set_channels: Set number of channels. Returns a negative error code or 190 * @set_channels: Set number of channels. Returns a negative error code or
174 * zero. 191 * zero.
@@ -241,9 +258,10 @@ struct ethtool_ops {
241 int (*reset)(struct net_device *, u32 *); 258 int (*reset)(struct net_device *, u32 *);
242 u32 (*get_rxfh_key_size)(struct net_device *); 259 u32 (*get_rxfh_key_size)(struct net_device *);
243 u32 (*get_rxfh_indir_size)(struct net_device *); 260 u32 (*get_rxfh_indir_size)(struct net_device *);
244 int (*get_rxfh)(struct net_device *, u32 *indir, u8 *key); 261 int (*get_rxfh)(struct net_device *, u32 *indir, u8 *key,
262 u8 *hfunc);
245 int (*set_rxfh)(struct net_device *, const u32 *indir, 263 int (*set_rxfh)(struct net_device *, const u32 *indir,
246 const u8 *key); 264 const u8 *key, const u8 hfunc);
247 void (*get_channels)(struct net_device *, struct ethtool_channels *); 265 void (*get_channels)(struct net_device *, struct ethtool_channels *);
248 int (*set_channels)(struct net_device *, struct ethtool_channels *); 266 int (*set_channels)(struct net_device *, struct ethtool_channels *);
249 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *); 267 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 860313a33a43..87f14e90e984 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -33,7 +33,8 @@
33#define F2FS_META_INO(sbi) (sbi->meta_ino_num) 33#define F2FS_META_INO(sbi) (sbi->meta_ino_num)
34 34
35/* This flag is used by node and meta inodes, and by recovery */ 35/* This flag is used by node and meta inodes, and by recovery */
36#define GFP_F2FS_ZERO (GFP_NOFS | __GFP_ZERO) 36#define GFP_F2FS_ZERO (GFP_NOFS | __GFP_ZERO)
37#define GFP_F2FS_HIGH_ZERO (GFP_NOFS | __GFP_ZERO | __GFP_HIGHMEM)
37 38
38/* 39/*
39 * For further optimization on multi-head logs, on-disk layout supports maximum 40 * For further optimization on multi-head logs, on-disk layout supports maximum
@@ -170,14 +171,12 @@ struct f2fs_extent {
170 171
171#define F2FS_INLINE_XATTR 0x01 /* file inline xattr flag */ 172#define F2FS_INLINE_XATTR 0x01 /* file inline xattr flag */
172#define F2FS_INLINE_DATA 0x02 /* file inline data flag */ 173#define F2FS_INLINE_DATA 0x02 /* file inline data flag */
174#define F2FS_INLINE_DENTRY 0x04 /* file inline dentry flag */
175#define F2FS_DATA_EXIST 0x08 /* file inline data exist flag */
173 176
174#define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \ 177#define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \
175 F2FS_INLINE_XATTR_ADDRS - 1)) 178 F2FS_INLINE_XATTR_ADDRS - 1))
176 179
177#define INLINE_DATA_OFFSET (PAGE_CACHE_SIZE - sizeof(struct node_footer) -\
178 sizeof(__le32) * (DEF_ADDRS_PER_INODE + \
179 DEF_NIDS_PER_INODE - 1))
180
181struct f2fs_inode { 180struct f2fs_inode {
182 __le16 i_mode; /* file mode */ 181 __le16 i_mode; /* file mode */
183 __u8 i_advise; /* file hints */ 182 __u8 i_advise; /* file hints */
@@ -435,6 +434,24 @@ struct f2fs_dentry_block {
435 __u8 filename[NR_DENTRY_IN_BLOCK][F2FS_SLOT_LEN]; 434 __u8 filename[NR_DENTRY_IN_BLOCK][F2FS_SLOT_LEN];
436} __packed; 435} __packed;
437 436
437/* for inline dir */
438#define NR_INLINE_DENTRY (MAX_INLINE_DATA * BITS_PER_BYTE / \
439 ((SIZE_OF_DIR_ENTRY + F2FS_SLOT_LEN) * \
440 BITS_PER_BYTE + 1))
441#define INLINE_DENTRY_BITMAP_SIZE ((NR_INLINE_DENTRY + \
442 BITS_PER_BYTE - 1) / BITS_PER_BYTE)
443#define INLINE_RESERVED_SIZE (MAX_INLINE_DATA - \
444 ((SIZE_OF_DIR_ENTRY + F2FS_SLOT_LEN) * \
445 NR_INLINE_DENTRY + INLINE_DENTRY_BITMAP_SIZE))
446
447/* inline directory entry structure */
448struct f2fs_inline_dentry {
449 __u8 dentry_bitmap[INLINE_DENTRY_BITMAP_SIZE];
450 __u8 reserved[INLINE_RESERVED_SIZE];
451 struct f2fs_dir_entry dentry[NR_INLINE_DENTRY];
452 __u8 filename[NR_INLINE_DENTRY][F2FS_SLOT_LEN];
453} __packed;
454
438/* file types used in inode_info->flags */ 455/* file types used in inode_info->flags */
439enum { 456enum {
440 F2FS_FT_UNKNOWN, 457 F2FS_FT_UNKNOWN,
diff --git a/include/linux/fault-inject.h b/include/linux/fault-inject.h
index c6f996f2abb6..798fad9e420d 100644
--- a/include/linux/fault-inject.h
+++ b/include/linux/fault-inject.h
@@ -5,6 +5,7 @@
5 5
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/debugfs.h> 7#include <linux/debugfs.h>
8#include <linux/ratelimit.h>
8#include <linux/atomic.h> 9#include <linux/atomic.h>
9 10
10/* 11/*
@@ -25,14 +26,18 @@ struct fault_attr {
25 unsigned long reject_end; 26 unsigned long reject_end;
26 27
27 unsigned long count; 28 unsigned long count;
29 struct ratelimit_state ratelimit_state;
30 struct dentry *dname;
28}; 31};
29 32
30#define FAULT_ATTR_INITIALIZER { \ 33#define FAULT_ATTR_INITIALIZER { \
31 .interval = 1, \ 34 .interval = 1, \
32 .times = ATOMIC_INIT(1), \ 35 .times = ATOMIC_INIT(1), \
33 .require_end = ULONG_MAX, \ 36 .require_end = ULONG_MAX, \
34 .stacktrace_depth = 32, \ 37 .stacktrace_depth = 32, \
35 .verbose = 2, \ 38 .ratelimit_state = RATELIMIT_STATE_INIT_DISABLED, \
39 .verbose = 2, \
40 .dname = NULL, \
36 } 41 }
37 42
38#define DECLARE_FAULT_ATTR(name) struct fault_attr name = FAULT_ATTR_INITIALIZER 43#define DECLARE_FAULT_ATTR(name) struct fault_attr name = FAULT_ATTR_INITIALIZER
diff --git a/include/linux/fence.h b/include/linux/fence.h
index d174585b874b..39efee130d2b 100644
--- a/include/linux/fence.h
+++ b/include/linux/fence.h
@@ -128,8 +128,8 @@ struct fence_cb {
128 * from irq context, so normal spinlocks can be used. 128 * from irq context, so normal spinlocks can be used.
129 * 129 *
130 * A return value of false indicates the fence already passed, 130 * A return value of false indicates the fence already passed,
131 * or some failure occured that made it impossible to enable 131 * or some failure occurred that made it impossible to enable
132 * signaling. True indicates succesful enabling. 132 * signaling. True indicates successful enabling.
133 * 133 *
134 * fence->status may be set in enable_signaling, but only when false is 134 * fence->status may be set in enable_signaling, but only when false is
135 * returned. 135 * returned.
diff --git a/include/linux/file.h b/include/linux/file.h
index 4d69123377a2..f87d30882a24 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -66,7 +66,6 @@ extern void set_close_on_exec(unsigned int fd, int flag);
66extern bool get_close_on_exec(unsigned int fd); 66extern bool get_close_on_exec(unsigned int fd);
67extern void put_filp(struct file *); 67extern void put_filp(struct file *);
68extern int get_unused_fd_flags(unsigned flags); 68extern int get_unused_fd_flags(unsigned flags);
69#define get_unused_fd() get_unused_fd_flags(0)
70extern void put_unused_fd(unsigned int fd); 69extern void put_unused_fd(unsigned int fd);
71 70
72extern void fd_install(unsigned int fd, struct file *file); 71extern void fd_install(unsigned int fd, struct file *file);
diff --git a/include/linux/filter.h b/include/linux/filter.h
index ca95abd2bed1..caac2087a4d5 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -381,6 +381,7 @@ int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog);
381void bpf_prog_destroy(struct bpf_prog *fp); 381void bpf_prog_destroy(struct bpf_prog *fp);
382 382
383int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 383int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
384int sk_attach_bpf(u32 ufd, struct sock *sk);
384int sk_detach_filter(struct sock *sk); 385int sk_detach_filter(struct sock *sk);
385 386
386int bpf_check_classic(const struct sock_filter *filter, unsigned int flen); 387int bpf_check_classic(const struct sock_filter *filter, unsigned int flen);
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 7fd81b8c4897..6b7fd9cf5ea2 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -246,15 +246,6 @@ static inline int freezable_schedule_hrtimeout_range(ktime_t *expires,
246 * defined in <linux/wait.h> 246 * defined in <linux/wait.h>
247 */ 247 */
248 248
249#define wait_event_freezekillable(wq, condition) \
250({ \
251 int __retval; \
252 freezer_do_not_count(); \
253 __retval = wait_event_killable(wq, (condition)); \
254 freezer_count(); \
255 __retval; \
256})
257
258/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */ 249/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
259#define wait_event_freezekillable_unsafe(wq, condition) \ 250#define wait_event_freezekillable_unsafe(wq, condition) \
260({ \ 251({ \
@@ -265,35 +256,6 @@ static inline int freezable_schedule_hrtimeout_range(ktime_t *expires,
265 __retval; \ 256 __retval; \
266}) 257})
267 258
268#define wait_event_freezable(wq, condition) \
269({ \
270 int __retval; \
271 freezer_do_not_count(); \
272 __retval = wait_event_interruptible(wq, (condition)); \
273 freezer_count(); \
274 __retval; \
275})
276
277#define wait_event_freezable_timeout(wq, condition, timeout) \
278({ \
279 long __retval = timeout; \
280 freezer_do_not_count(); \
281 __retval = wait_event_interruptible_timeout(wq, (condition), \
282 __retval); \
283 freezer_count(); \
284 __retval; \
285})
286
287#define wait_event_freezable_exclusive(wq, condition) \
288({ \
289 int __retval; \
290 freezer_do_not_count(); \
291 __retval = wait_event_interruptible_exclusive(wq, condition); \
292 freezer_count(); \
293 __retval; \
294})
295
296
297#else /* !CONFIG_FREEZER */ 259#else /* !CONFIG_FREEZER */
298static inline bool frozen(struct task_struct *p) { return false; } 260static inline bool frozen(struct task_struct *p) { return false; }
299static inline bool freezing(struct task_struct *p) { return false; } 261static inline bool freezing(struct task_struct *p) { return false; }
@@ -331,18 +293,6 @@ static inline void set_freezable(void) {}
331#define freezable_schedule_hrtimeout_range(expires, delta, mode) \ 293#define freezable_schedule_hrtimeout_range(expires, delta, mode) \
332 schedule_hrtimeout_range(expires, delta, mode) 294 schedule_hrtimeout_range(expires, delta, mode)
333 295
334#define wait_event_freezable(wq, condition) \
335 wait_event_interruptible(wq, condition)
336
337#define wait_event_freezable_timeout(wq, condition, timeout) \
338 wait_event_interruptible_timeout(wq, condition, timeout)
339
340#define wait_event_freezable_exclusive(wq, condition) \
341 wait_event_interruptible_exclusive(wq, condition)
342
343#define wait_event_freezekillable(wq, condition) \
344 wait_event_killable(wq, condition)
345
346#define wait_event_freezekillable_unsafe(wq, condition) \ 296#define wait_event_freezekillable_unsafe(wq, condition) \
347 wait_event_killable(wq, condition) 297 wait_event_killable(wq, condition)
348 298
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 9ab779e8a63c..88157253b9e6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -18,6 +18,7 @@
18#include <linux/pid.h> 18#include <linux/pid.h>
19#include <linux/bug.h> 19#include <linux/bug.h>
20#include <linux/mutex.h> 20#include <linux/mutex.h>
21#include <linux/rwsem.h>
21#include <linux/capability.h> 22#include <linux/capability.h>
22#include <linux/semaphore.h> 23#include <linux/semaphore.h>
23#include <linux/fiemap.h> 24#include <linux/fiemap.h>
@@ -401,7 +402,7 @@ struct address_space {
401 atomic_t i_mmap_writable;/* count VM_SHARED mappings */ 402 atomic_t i_mmap_writable;/* count VM_SHARED mappings */
402 struct rb_root i_mmap; /* tree of private and shared mappings */ 403 struct rb_root i_mmap; /* tree of private and shared mappings */
403 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ 404 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
404 struct mutex i_mmap_mutex; /* protect tree, count, list */ 405 struct rw_semaphore i_mmap_rwsem; /* protect tree, count, list */
405 /* Protected by tree_lock together with the radix tree */ 406 /* Protected by tree_lock together with the radix tree */
406 unsigned long nrpages; /* number of total pages */ 407 unsigned long nrpages; /* number of total pages */
407 unsigned long nrshadows; /* number of shadow entries */ 408 unsigned long nrshadows; /* number of shadow entries */
@@ -467,6 +468,26 @@ struct block_device {
467 468
468int mapping_tagged(struct address_space *mapping, int tag); 469int mapping_tagged(struct address_space *mapping, int tag);
469 470
471static inline void i_mmap_lock_write(struct address_space *mapping)
472{
473 down_write(&mapping->i_mmap_rwsem);
474}
475
476static inline void i_mmap_unlock_write(struct address_space *mapping)
477{
478 up_write(&mapping->i_mmap_rwsem);
479}
480
481static inline void i_mmap_lock_read(struct address_space *mapping)
482{
483 down_read(&mapping->i_mmap_rwsem);
484}
485
486static inline void i_mmap_unlock_read(struct address_space *mapping)
487{
488 up_read(&mapping->i_mmap_rwsem);
489}
490
470/* 491/*
471 * Might pages of this file be mapped into userspace? 492 * Might pages of this file be mapped into userspace?
472 */ 493 */
@@ -606,9 +627,6 @@ struct inode {
606 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 627 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
607 struct file_lock *i_flock; 628 struct file_lock *i_flock;
608 struct address_space i_data; 629 struct address_space i_data;
609#ifdef CONFIG_QUOTA
610 struct dquot *i_dquot[MAXQUOTAS];
611#endif
612 struct list_head i_devices; 630 struct list_head i_devices;
613 union { 631 union {
614 struct pipe_inode_info *i_pipe; 632 struct pipe_inode_info *i_pipe;
@@ -789,7 +807,6 @@ struct file {
789 struct rcu_head fu_rcuhead; 807 struct rcu_head fu_rcuhead;
790 } f_u; 808 } f_u;
791 struct path f_path; 809 struct path f_path;
792#define f_dentry f_path.dentry
793 struct inode *f_inode; /* cached value */ 810 struct inode *f_inode; /* cached value */
794 const struct file_operations *f_op; 811 const struct file_operations *f_op;
795 812
@@ -1224,6 +1241,7 @@ struct super_block {
1224 struct backing_dev_info *s_bdi; 1241 struct backing_dev_info *s_bdi;
1225 struct mtd_info *s_mtd; 1242 struct mtd_info *s_mtd;
1226 struct hlist_node s_instances; 1243 struct hlist_node s_instances;
1244 unsigned int s_quota_types; /* Bitmask of supported quota types */
1227 struct quota_info s_dquot; /* Diskquota specific options */ 1245 struct quota_info s_dquot; /* Diskquota specific options */
1228 1246
1229 struct sb_writers s_writers; 1247 struct sb_writers s_writers;
@@ -1467,7 +1485,10 @@ int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags);
1467 * This allows the kernel to read directories into kernel space or 1485 * This allows the kernel to read directories into kernel space or
1468 * to have different dirent layouts depending on the binary type. 1486 * to have different dirent layouts depending on the binary type.
1469 */ 1487 */
1470typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); 1488struct dir_context;
1489typedef int (*filldir_t)(struct dir_context *, const char *, int, loff_t, u64,
1490 unsigned);
1491
1471struct dir_context { 1492struct dir_context {
1472 const filldir_t actor; 1493 const filldir_t actor;
1473 loff_t pos; 1494 loff_t pos;
@@ -1497,6 +1518,7 @@ struct file_operations {
1497 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 1518 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
1498 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 1519 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
1499 int (*mmap) (struct file *, struct vm_area_struct *); 1520 int (*mmap) (struct file *, struct vm_area_struct *);
1521 void (*mremap)(struct file *, struct vm_area_struct *);
1500 int (*open) (struct inode *, struct file *); 1522 int (*open) (struct inode *, struct file *);
1501 int (*flush) (struct file *, fl_owner_t id); 1523 int (*flush) (struct file *, fl_owner_t id);
1502 int (*release) (struct inode *, struct file *); 1524 int (*release) (struct inode *, struct file *);
@@ -1513,7 +1535,7 @@ struct file_operations {
1513 int (*setlease)(struct file *, long, struct file_lock **, void **); 1535 int (*setlease)(struct file *, long, struct file_lock **, void **);
1514 long (*fallocate)(struct file *file, int mode, loff_t offset, 1536 long (*fallocate)(struct file *file, int mode, loff_t offset,
1515 loff_t len); 1537 loff_t len);
1516 int (*show_fdinfo)(struct seq_file *m, struct file *f); 1538 void (*show_fdinfo)(struct seq_file *m, struct file *f);
1517}; 1539};
1518 1540
1519struct inode_operations { 1541struct inode_operations {
@@ -1560,6 +1582,7 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
1560 struct iovec *fast_pointer, 1582 struct iovec *fast_pointer,
1561 struct iovec **ret_pointer); 1583 struct iovec **ret_pointer);
1562 1584
1585extern ssize_t __vfs_read(struct file *, char __user *, size_t, loff_t *);
1563extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *); 1586extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
1564extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *); 1587extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);
1565extern ssize_t vfs_readv(struct file *, const struct iovec __user *, 1588extern ssize_t vfs_readv(struct file *, const struct iovec __user *,
@@ -1577,7 +1600,9 @@ struct super_operations {
1577 void (*evict_inode) (struct inode *); 1600 void (*evict_inode) (struct inode *);
1578 void (*put_super) (struct super_block *); 1601 void (*put_super) (struct super_block *);
1579 int (*sync_fs)(struct super_block *sb, int wait); 1602 int (*sync_fs)(struct super_block *sb, int wait);
1603 int (*freeze_super) (struct super_block *);
1580 int (*freeze_fs) (struct super_block *); 1604 int (*freeze_fs) (struct super_block *);
1605 int (*thaw_super) (struct super_block *);
1581 int (*unfreeze_fs) (struct super_block *); 1606 int (*unfreeze_fs) (struct super_block *);
1582 int (*statfs) (struct dentry *, struct kstatfs *); 1607 int (*statfs) (struct dentry *, struct kstatfs *);
1583 int (*remount_fs) (struct super_block *, int *, char *); 1608 int (*remount_fs) (struct super_block *, int *, char *);
@@ -1590,6 +1615,7 @@ struct super_operations {
1590#ifdef CONFIG_QUOTA 1615#ifdef CONFIG_QUOTA
1591 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1616 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1592 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1617 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
1618 struct dquot **(*get_dquots)(struct inode *);
1593#endif 1619#endif
1594 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); 1620 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
1595 long (*nr_cached_objects)(struct super_block *, int); 1621 long (*nr_cached_objects)(struct super_block *, int);
@@ -2072,6 +2098,7 @@ extern int vfs_open(const struct path *, struct file *, const struct cred *);
2072extern struct file * dentry_open(const struct path *, int, const struct cred *); 2098extern struct file * dentry_open(const struct path *, int, const struct cred *);
2073extern int filp_close(struct file *, fl_owner_t id); 2099extern int filp_close(struct file *, fl_owner_t id);
2074 2100
2101extern struct filename *getname_flags(const char __user *, int, int *);
2075extern struct filename *getname(const char __user *); 2102extern struct filename *getname(const char __user *);
2076extern struct filename *getname_kernel(const char *); 2103extern struct filename *getname_kernel(const char *);
2077 2104
@@ -2786,6 +2813,11 @@ static inline void inode_has_no_xattr(struct inode *inode)
2786 inode->i_flags |= S_NOSEC; 2813 inode->i_flags |= S_NOSEC;
2787} 2814}
2788 2815
2816static inline bool is_root_inode(struct inode *inode)
2817{
2818 return inode == inode->i_sb->s_root->d_inode;
2819}
2820
2789static inline bool dir_emit(struct dir_context *ctx, 2821static inline bool dir_emit(struct dir_context *ctx,
2790 const char *name, int namelen, 2822 const char *name, int namelen,
2791 u64 ino, unsigned type) 2823 u64 ino, unsigned type)
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index ca060d7c4fa6..0f313f93c586 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -197,24 +197,6 @@ struct fsnotify_group {
197#define FSNOTIFY_EVENT_INODE 2 197#define FSNOTIFY_EVENT_INODE 2
198 198
199/* 199/*
200 * Inode specific fields in an fsnotify_mark
201 */
202struct fsnotify_inode_mark {
203 struct inode *inode; /* inode this mark is associated with */
204 struct hlist_node i_list; /* list of marks by inode->i_fsnotify_marks */
205 struct list_head free_i_list; /* tmp list used when freeing this mark */
206};
207
208/*
209 * Mount point specific fields in an fsnotify_mark
210 */
211struct fsnotify_vfsmount_mark {
212 struct vfsmount *mnt; /* vfsmount this mark is associated with */
213 struct hlist_node m_list; /* list of marks by inode->i_fsnotify_marks */
214 struct list_head free_m_list; /* tmp list used when freeing this mark */
215};
216
217/*
218 * a mark is simply an object attached to an in core inode which allows an 200 * a mark is simply an object attached to an in core inode which allows an
219 * fsnotify listener to indicate they are either no longer interested in events 201 * fsnotify listener to indicate they are either no longer interested in events
220 * of a type matching mask or only interested in those events. 202 * of a type matching mask or only interested in those events.
@@ -230,11 +212,17 @@ struct fsnotify_mark {
230 * in kernel that found and may be using this mark. */ 212 * in kernel that found and may be using this mark. */
231 atomic_t refcnt; /* active things looking at this mark */ 213 atomic_t refcnt; /* active things looking at this mark */
232 struct fsnotify_group *group; /* group this mark is for */ 214 struct fsnotify_group *group; /* group this mark is for */
233 struct list_head g_list; /* list of marks by group->i_fsnotify_marks */ 215 struct list_head g_list; /* list of marks by group->i_fsnotify_marks
216 * Also reused for queueing mark into
217 * destroy_list when it's waiting for
218 * the end of SRCU period before it can
219 * be freed */
234 spinlock_t lock; /* protect group and inode */ 220 spinlock_t lock; /* protect group and inode */
221 struct hlist_node obj_list; /* list of marks for inode / vfsmount */
222 struct list_head free_list; /* tmp list used when freeing this mark */
235 union { 223 union {
236 struct fsnotify_inode_mark i; 224 struct inode *inode; /* inode this mark is associated with */
237 struct fsnotify_vfsmount_mark m; 225 struct vfsmount *mnt; /* vfsmount this mark is associated with */
238 }; 226 };
239 __u32 ignored_mask; /* events types to ignore */ 227 __u32 ignored_mask; /* events types to ignore */
240#define FSNOTIFY_MARK_FLAG_INODE 0x01 228#define FSNOTIFY_MARK_FLAG_INODE 0x01
@@ -243,7 +231,6 @@ struct fsnotify_mark {
243#define FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY 0x08 231#define FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY 0x08
244#define FSNOTIFY_MARK_FLAG_ALIVE 0x10 232#define FSNOTIFY_MARK_FLAG_ALIVE 0x10
245 unsigned int flags; /* vfsmount or inode mark? */ 233 unsigned int flags; /* vfsmount or inode mark? */
246 struct list_head destroy_list;
247 void (*free_mark)(struct fsnotify_mark *mark); /* called on final put+free */ 234 void (*free_mark)(struct fsnotify_mark *mark); /* called on final put+free */
248}; 235};
249 236
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 662697babd48..1da602982cf9 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -39,6 +39,12 @@
39# define FTRACE_FORCE_LIST_FUNC 0 39# define FTRACE_FORCE_LIST_FUNC 0
40#endif 40#endif
41 41
42/* Main tracing buffer and events set up */
43#ifdef CONFIG_TRACING
44void trace_init(void);
45#else
46static inline void trace_init(void) { }
47#endif
42 48
43struct module; 49struct module;
44struct ftrace_hash; 50struct ftrace_hash;
@@ -61,6 +67,11 @@ ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops);
61/* 67/*
62 * FTRACE_OPS_FL_* bits denote the state of ftrace_ops struct and are 68 * FTRACE_OPS_FL_* bits denote the state of ftrace_ops struct and are
63 * set in the flags member. 69 * set in the flags member.
70 * CONTROL, SAVE_REGS, SAVE_REGS_IF_SUPPORTED, RECURSION_SAFE, STUB and
71 * IPMODIFY are a kind of attribute flags which can be set only before
72 * registering the ftrace_ops, and can not be modified while registered.
73 * Changing those attribute flags after regsitering ftrace_ops will
74 * cause unexpected results.
64 * 75 *
65 * ENABLED - set/unset when ftrace_ops is registered/unregistered 76 * ENABLED - set/unset when ftrace_ops is registered/unregistered
66 * DYNAMIC - set when ftrace_ops is registered to denote dynamically 77 * DYNAMIC - set when ftrace_ops is registered to denote dynamically
@@ -94,6 +105,17 @@ ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops);
94 * ADDING - The ops is in the process of being added. 105 * ADDING - The ops is in the process of being added.
95 * REMOVING - The ops is in the process of being removed. 106 * REMOVING - The ops is in the process of being removed.
96 * MODIFYING - The ops is in the process of changing its filter functions. 107 * MODIFYING - The ops is in the process of changing its filter functions.
108 * ALLOC_TRAMP - A dynamic trampoline was allocated by the core code.
109 * The arch specific code sets this flag when it allocated a
110 * trampoline. This lets the arch know that it can update the
111 * trampoline in case the callback function changes.
112 * The ftrace_ops trampoline can be set by the ftrace users, and
113 * in such cases the arch must not modify it. Only the arch ftrace
114 * core code should set this flag.
115 * IPMODIFY - The ops can modify the IP register. This can only be set with
116 * SAVE_REGS. If another ops with this flag set is already registered
117 * for any of the functions that this ops will be registered for, then
118 * this ops will fail to register or set_filter_ip.
97 */ 119 */
98enum { 120enum {
99 FTRACE_OPS_FL_ENABLED = 1 << 0, 121 FTRACE_OPS_FL_ENABLED = 1 << 0,
@@ -108,6 +130,8 @@ enum {
108 FTRACE_OPS_FL_ADDING = 1 << 9, 130 FTRACE_OPS_FL_ADDING = 1 << 9,
109 FTRACE_OPS_FL_REMOVING = 1 << 10, 131 FTRACE_OPS_FL_REMOVING = 1 << 10,
110 FTRACE_OPS_FL_MODIFYING = 1 << 11, 132 FTRACE_OPS_FL_MODIFYING = 1 << 11,
133 FTRACE_OPS_FL_ALLOC_TRAMP = 1 << 12,
134 FTRACE_OPS_FL_IPMODIFY = 1 << 13,
111}; 135};
112 136
113#ifdef CONFIG_DYNAMIC_FTRACE 137#ifdef CONFIG_DYNAMIC_FTRACE
@@ -142,6 +166,7 @@ struct ftrace_ops {
142 struct ftrace_ops_hash *func_hash; 166 struct ftrace_ops_hash *func_hash;
143 struct ftrace_ops_hash old_hash; 167 struct ftrace_ops_hash old_hash;
144 unsigned long trampoline; 168 unsigned long trampoline;
169 unsigned long trampoline_size;
145#endif 170#endif
146}; 171};
147 172
@@ -255,7 +280,9 @@ struct ftrace_func_command {
255int ftrace_arch_code_modify_prepare(void); 280int ftrace_arch_code_modify_prepare(void);
256int ftrace_arch_code_modify_post_process(void); 281int ftrace_arch_code_modify_post_process(void);
257 282
258void ftrace_bug(int err, unsigned long ip); 283struct dyn_ftrace;
284
285void ftrace_bug(int err, struct dyn_ftrace *rec);
259 286
260struct seq_file; 287struct seq_file;
261 288
@@ -287,6 +314,8 @@ extern int ftrace_text_reserved(const void *start, const void *end);
287 314
288extern int ftrace_nr_registered_ops(void); 315extern int ftrace_nr_registered_ops(void);
289 316
317bool is_ftrace_trampoline(unsigned long addr);
318
290/* 319/*
291 * The dyn_ftrace record's flags field is split into two parts. 320 * The dyn_ftrace record's flags field is split into two parts.
292 * the first part which is '0-FTRACE_REF_MAX' is a counter of 321 * the first part which is '0-FTRACE_REF_MAX' is a counter of
@@ -297,6 +326,7 @@ extern int ftrace_nr_registered_ops(void);
297 * ENABLED - the function is being traced 326 * ENABLED - the function is being traced
298 * REGS - the record wants the function to save regs 327 * REGS - the record wants the function to save regs
299 * REGS_EN - the function is set up to save regs. 328 * REGS_EN - the function is set up to save regs.
329 * IPMODIFY - the record allows for the IP address to be changed.
300 * 330 *
301 * When a new ftrace_ops is registered and wants a function to save 331 * When a new ftrace_ops is registered and wants a function to save
302 * pt_regs, the rec->flag REGS is set. When the function has been 332 * pt_regs, the rec->flag REGS is set. When the function has been
@@ -310,10 +340,11 @@ enum {
310 FTRACE_FL_REGS_EN = (1UL << 29), 340 FTRACE_FL_REGS_EN = (1UL << 29),
311 FTRACE_FL_TRAMP = (1UL << 28), 341 FTRACE_FL_TRAMP = (1UL << 28),
312 FTRACE_FL_TRAMP_EN = (1UL << 27), 342 FTRACE_FL_TRAMP_EN = (1UL << 27),
343 FTRACE_FL_IPMODIFY = (1UL << 26),
313}; 344};
314 345
315#define FTRACE_REF_MAX_SHIFT 27 346#define FTRACE_REF_MAX_SHIFT 26
316#define FTRACE_FL_BITS 5 347#define FTRACE_FL_BITS 6
317#define FTRACE_FL_MASKED_BITS ((1UL << FTRACE_FL_BITS) - 1) 348#define FTRACE_FL_MASKED_BITS ((1UL << FTRACE_FL_BITS) - 1)
318#define FTRACE_FL_MASK (FTRACE_FL_MASKED_BITS << FTRACE_REF_MAX_SHIFT) 349#define FTRACE_FL_MASK (FTRACE_FL_MASKED_BITS << FTRACE_REF_MAX_SHIFT)
319#define FTRACE_REF_MAX ((1UL << FTRACE_REF_MAX_SHIFT) - 1) 350#define FTRACE_REF_MAX ((1UL << FTRACE_REF_MAX_SHIFT) - 1)
@@ -586,6 +617,11 @@ static inline ssize_t ftrace_notrace_write(struct file *file, const char __user
586 size_t cnt, loff_t *ppos) { return -ENODEV; } 617 size_t cnt, loff_t *ppos) { return -ENODEV; }
587static inline int 618static inline int
588ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; } 619ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; }
620
621static inline bool is_ftrace_trampoline(unsigned long addr)
622{
623 return false;
624}
589#endif /* CONFIG_DYNAMIC_FTRACE */ 625#endif /* CONFIG_DYNAMIC_FTRACE */
590 626
591/* totally disable ftrace - can not re-enable after this */ 627/* totally disable ftrace - can not re-enable after this */
@@ -843,6 +879,7 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk)
843enum ftrace_dump_mode; 879enum ftrace_dump_mode;
844 880
845extern enum ftrace_dump_mode ftrace_dump_on_oops; 881extern enum ftrace_dump_mode ftrace_dump_on_oops;
882extern int tracepoint_printk;
846 883
847extern void disable_trace_on_warning(void); 884extern void disable_trace_on_warning(void);
848extern int __disable_trace_on_warning; 885extern int __disable_trace_on_warning;
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 28672e87e910..0bebb5c348b8 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -138,6 +138,17 @@ enum print_line_t {
138 TRACE_TYPE_NO_CONSUME = 3 /* Handled but ask to not consume */ 138 TRACE_TYPE_NO_CONSUME = 3 /* Handled but ask to not consume */
139}; 139};
140 140
141/*
142 * Several functions return TRACE_TYPE_PARTIAL_LINE if the trace_seq
143 * overflowed, and TRACE_TYPE_HANDLED otherwise. This helper function
144 * simplifies those functions and keeps them in sync.
145 */
146static inline enum print_line_t trace_handle_return(struct trace_seq *s)
147{
148 return trace_seq_has_overflowed(s) ?
149 TRACE_TYPE_PARTIAL_LINE : TRACE_TYPE_HANDLED;
150}
151
141void tracing_generic_entry_update(struct trace_entry *entry, 152void tracing_generic_entry_update(struct trace_entry *entry,
142 unsigned long flags, 153 unsigned long flags,
143 int pc); 154 int pc);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 41b30fd4d041..b840e3b2770d 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -110,11 +110,8 @@ struct vm_area_struct;
110#define GFP_TEMPORARY (__GFP_WAIT | __GFP_IO | __GFP_FS | \ 110#define GFP_TEMPORARY (__GFP_WAIT | __GFP_IO | __GFP_FS | \
111 __GFP_RECLAIMABLE) 111 __GFP_RECLAIMABLE)
112#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL) 112#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL)
113#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \ 113#define GFP_HIGHUSER (GFP_USER | __GFP_HIGHMEM)
114 __GFP_HIGHMEM) 114#define GFP_HIGHUSER_MOVABLE (GFP_HIGHUSER | __GFP_MOVABLE)
115#define GFP_HIGHUSER_MOVABLE (__GFP_WAIT | __GFP_IO | __GFP_FS | \
116 __GFP_HARDWALL | __GFP_HIGHMEM | \
117 __GFP_MOVABLE)
118#define GFP_IOFS (__GFP_IO | __GFP_FS) 115#define GFP_IOFS (__GFP_IO | __GFP_FS)
119#define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \ 116#define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \
120 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \ 117 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \
@@ -381,8 +378,8 @@ extern void free_kmem_pages(unsigned long addr, unsigned int order);
381 378
382void page_alloc_init(void); 379void page_alloc_init(void);
383void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp); 380void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
384void drain_all_pages(void); 381void drain_all_pages(struct zone *zone);
385void drain_local_pages(void *dummy); 382void drain_local_pages(struct zone *zone);
386 383
387/* 384/*
388 * gfp_allowed_mask is set to GFP_BOOT_MASK during early boot to restrict what 385 * gfp_allowed_mask is set to GFP_BOOT_MASK during early boot to restrict what
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 85aa5d0b9357..ab81339a8590 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -216,14 +216,15 @@ static inline int gpio_to_irq(unsigned gpio)
216 return -EINVAL; 216 return -EINVAL;
217} 217}
218 218
219static inline int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset) 219static inline int gpiochip_lock_as_irq(struct gpio_chip *chip,
220 unsigned int offset)
220{ 221{
221 WARN_ON(1); 222 WARN_ON(1);
222 return -EINVAL; 223 return -EINVAL;
223} 224}
224 225
225static inline void gpio_unlock_as_irq(struct gpio_chip *chip, 226static inline void gpiochip_unlock_as_irq(struct gpio_chip *chip,
226 unsigned int offset) 227 unsigned int offset)
227{ 228{
228 WARN_ON(1); 229 WARN_ON(1);
229} 230}
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 12f146fa6604..fd85cb120ee0 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -66,7 +66,7 @@ __devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
66 unsigned int index, enum gpiod_flags flags); 66 unsigned int index, enum gpiod_flags flags);
67void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); 67void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
68 68
69int gpiod_get_direction(const struct gpio_desc *desc); 69int gpiod_get_direction(struct gpio_desc *desc);
70int gpiod_direction_input(struct gpio_desc *desc); 70int gpiod_direction_input(struct gpio_desc *desc);
71int gpiod_direction_output(struct gpio_desc *desc, int value); 71int gpiod_direction_output(struct gpio_desc *desc, int value);
72int gpiod_direction_output_raw(struct gpio_desc *desc, int value); 72int gpiod_direction_output_raw(struct gpio_desc *desc, int value);
@@ -74,14 +74,24 @@ int gpiod_direction_output_raw(struct gpio_desc *desc, int value);
74/* Value get/set from non-sleeping context */ 74/* Value get/set from non-sleeping context */
75int gpiod_get_value(const struct gpio_desc *desc); 75int gpiod_get_value(const struct gpio_desc *desc);
76void gpiod_set_value(struct gpio_desc *desc, int value); 76void gpiod_set_value(struct gpio_desc *desc, int value);
77void gpiod_set_array(unsigned int array_size,
78 struct gpio_desc **desc_array, int *value_array);
77int gpiod_get_raw_value(const struct gpio_desc *desc); 79int gpiod_get_raw_value(const struct gpio_desc *desc);
78void gpiod_set_raw_value(struct gpio_desc *desc, int value); 80void gpiod_set_raw_value(struct gpio_desc *desc, int value);
81void gpiod_set_raw_array(unsigned int array_size,
82 struct gpio_desc **desc_array, int *value_array);
79 83
80/* Value get/set from sleeping context */ 84/* Value get/set from sleeping context */
81int gpiod_get_value_cansleep(const struct gpio_desc *desc); 85int gpiod_get_value_cansleep(const struct gpio_desc *desc);
82void gpiod_set_value_cansleep(struct gpio_desc *desc, int value); 86void gpiod_set_value_cansleep(struct gpio_desc *desc, int value);
87void gpiod_set_array_cansleep(unsigned int array_size,
88 struct gpio_desc **desc_array,
89 int *value_array);
83int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc); 90int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc);
84void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value); 91void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value);
92void gpiod_set_raw_array_cansleep(unsigned int array_size,
93 struct gpio_desc **desc_array,
94 int *value_array);
85 95
86int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce); 96int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce);
87 97
@@ -94,6 +104,13 @@ int gpiod_to_irq(const struct gpio_desc *desc);
94struct gpio_desc *gpio_to_desc(unsigned gpio); 104struct gpio_desc *gpio_to_desc(unsigned gpio);
95int desc_to_gpio(const struct gpio_desc *desc); 105int desc_to_gpio(const struct gpio_desc *desc);
96 106
107/* Child properties interface */
108struct fwnode_handle;
109
110struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
111 const char *propname);
112struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
113 struct fwnode_handle *child);
97#else /* CONFIG_GPIOLIB */ 114#else /* CONFIG_GPIOLIB */
98 115
99static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev, 116static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev,
@@ -210,6 +227,13 @@ static inline void gpiod_set_value(struct gpio_desc *desc, int value)
210 /* GPIO can never have been requested */ 227 /* GPIO can never have been requested */
211 WARN_ON(1); 228 WARN_ON(1);
212} 229}
230static inline void gpiod_set_array(unsigned int array_size,
231 struct gpio_desc **desc_array,
232 int *value_array)
233{
234 /* GPIO can never have been requested */
235 WARN_ON(1);
236}
213static inline int gpiod_get_raw_value(const struct gpio_desc *desc) 237static inline int gpiod_get_raw_value(const struct gpio_desc *desc)
214{ 238{
215 /* GPIO can never have been requested */ 239 /* GPIO can never have been requested */
@@ -221,6 +245,13 @@ static inline void gpiod_set_raw_value(struct gpio_desc *desc, int value)
221 /* GPIO can never have been requested */ 245 /* GPIO can never have been requested */
222 WARN_ON(1); 246 WARN_ON(1);
223} 247}
248static inline void gpiod_set_raw_array(unsigned int array_size,
249 struct gpio_desc **desc_array,
250 int *value_array)
251{
252 /* GPIO can never have been requested */
253 WARN_ON(1);
254}
224 255
225static inline int gpiod_get_value_cansleep(const struct gpio_desc *desc) 256static inline int gpiod_get_value_cansleep(const struct gpio_desc *desc)
226{ 257{
@@ -233,6 +264,13 @@ static inline void gpiod_set_value_cansleep(struct gpio_desc *desc, int value)
233 /* GPIO can never have been requested */ 264 /* GPIO can never have been requested */
234 WARN_ON(1); 265 WARN_ON(1);
235} 266}
267static inline void gpiod_set_array_cansleep(unsigned int array_size,
268 struct gpio_desc **desc_array,
269 int *value_array)
270{
271 /* GPIO can never have been requested */
272 WARN_ON(1);
273}
236static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc) 274static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc)
237{ 275{
238 /* GPIO can never have been requested */ 276 /* GPIO can never have been requested */
@@ -245,6 +283,13 @@ static inline void gpiod_set_raw_value_cansleep(struct gpio_desc *desc,
245 /* GPIO can never have been requested */ 283 /* GPIO can never have been requested */
246 WARN_ON(1); 284 WARN_ON(1);
247} 285}
286static inline void gpiod_set_raw_array_cansleep(unsigned int array_size,
287 struct gpio_desc **desc_array,
288 int *value_array)
289{
290 /* GPIO can never have been requested */
291 WARN_ON(1);
292}
248 293
249static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce) 294static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce)
250{ 295{
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 249db3057e4d..c497c62889d1 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -32,6 +32,7 @@ struct seq_file;
32 * @get: returns value for signal "offset"; for output signals this 32 * @get: returns value for signal "offset"; for output signals this
33 * returns either the value actually sensed, or zero 33 * returns either the value actually sensed, or zero
34 * @set: assigns output value for signal "offset" 34 * @set: assigns output value for signal "offset"
35 * @set_multiple: assigns output values for multiple signals defined by "mask"
35 * @set_debounce: optional hook for setting debounce time for specified gpio in 36 * @set_debounce: optional hook for setting debounce time for specified gpio in
36 * interrupt triggered gpio chips 37 * interrupt triggered gpio chips
37 * @to_irq: optional hook supporting non-static gpio_to_irq() mappings; 38 * @to_irq: optional hook supporting non-static gpio_to_irq() mappings;
@@ -89,6 +90,9 @@ struct gpio_chip {
89 unsigned offset); 90 unsigned offset);
90 void (*set)(struct gpio_chip *chip, 91 void (*set)(struct gpio_chip *chip,
91 unsigned offset, int value); 92 unsigned offset, int value);
93 void (*set_multiple)(struct gpio_chip *chip,
94 unsigned long *mask,
95 unsigned long *bits);
92 int (*set_debounce)(struct gpio_chip *chip, 96 int (*set_debounce)(struct gpio_chip *chip,
93 unsigned offset, 97 unsigned offset,
94 unsigned debounce); 98 unsigned debounce);
@@ -149,8 +153,8 @@ extern struct gpio_chip *gpiochip_find(void *data,
149 int (*match)(struct gpio_chip *chip, void *data)); 153 int (*match)(struct gpio_chip *chip, void *data));
150 154
151/* lock/unlock as IRQ */ 155/* lock/unlock as IRQ */
152int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset); 156int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
153void gpio_unlock_as_irq(struct gpio_chip *chip, unsigned int offset); 157void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
154 158
155struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc); 159struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
156 160
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index 8b622468952c..ee2d8c6f9130 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -2,6 +2,7 @@
2#define _GPIO_KEYS_H 2#define _GPIO_KEYS_H
3 3
4struct device; 4struct device;
5struct gpio_desc;
5 6
6/** 7/**
7 * struct gpio_keys_button - configuration parameters 8 * struct gpio_keys_button - configuration parameters
@@ -17,6 +18,7 @@ struct device;
17 * disable button via sysfs 18 * disable button via sysfs
18 * @value: axis value for %EV_ABS 19 * @value: axis value for %EV_ABS
19 * @irq: Irq number in case of interrupt keys 20 * @irq: Irq number in case of interrupt keys
21 * @gpiod: GPIO descriptor
20 */ 22 */
21struct gpio_keys_button { 23struct gpio_keys_button {
22 unsigned int code; 24 unsigned int code;
@@ -29,6 +31,7 @@ struct gpio_keys_button {
29 bool can_disable; 31 bool can_disable;
30 int value; 32 int value;
31 unsigned int irq; 33 unsigned int irq;
34 struct gpio_desc *gpiod;
32}; 35};
33 36
34/** 37/**
diff --git a/include/linux/hash.h b/include/linux/hash.h
index d0494c399392..1afde47e1528 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -15,7 +15,6 @@
15 */ 15 */
16 16
17#include <asm/types.h> 17#include <asm/types.h>
18#include <asm/hash.h>
19#include <linux/compiler.h> 18#include <linux/compiler.h>
20 19
21/* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ 20/* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */
@@ -84,38 +83,4 @@ static inline u32 hash32_ptr(const void *ptr)
84 return (u32)val; 83 return (u32)val;
85} 84}
86 85
87struct fast_hash_ops {
88 u32 (*hash)(const void *data, u32 len, u32 seed);
89 u32 (*hash2)(const u32 *data, u32 len, u32 seed);
90};
91
92/**
93 * arch_fast_hash - Caclulates a hash over a given buffer that can have
94 * arbitrary size. This function will eventually use an
95 * architecture-optimized hashing implementation if
96 * available, and trades off distribution for speed.
97 *
98 * @data: buffer to hash
99 * @len: length of buffer in bytes
100 * @seed: start seed
101 *
102 * Returns 32bit hash.
103 */
104extern u32 arch_fast_hash(const void *data, u32 len, u32 seed);
105
106/**
107 * arch_fast_hash2 - Caclulates a hash over a given buffer that has a
108 * size that is of a multiple of 32bit words. This
109 * function will eventually use an architecture-
110 * optimized hashing implementation if available,
111 * and trades off distribution for speed.
112 *
113 * @data: buffer to hash (must be 32bit padded)
114 * @len: number of 32bit words
115 * @seed: start seed
116 *
117 * Returns 32bit hash.
118 */
119extern u32 arch_fast_hash2(const u32 *data, u32 len, u32 seed);
120
121#endif /* _LINUX_HASH_H */ 86#endif /* _LINUX_HASH_H */
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 11c0182a153b..cbb5790a35cd 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (C) 2012 Avionic Design GmbH 2 * Copyright (C) 2012 Avionic Design GmbH
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * it under the terms of the GNU General Public License version 2 as 5 * copy of this software and associated documentation files (the "Software"),
6 * published by the Free Software Foundation. 6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sub license,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the
12 * next paragraph) shall be included in all copies or substantial portions
13 * 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 NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
7 */ 22 */
8 23
9#ifndef __LINUX_HDMI_H_ 24#ifndef __LINUX_HDMI_H_
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 78ea9bf941cd..06c4607744f6 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -234,6 +234,33 @@ struct hid_item {
234#define HID_DG_BARRELSWITCH 0x000d0044 234#define HID_DG_BARRELSWITCH 0x000d0044
235#define HID_DG_ERASER 0x000d0045 235#define HID_DG_ERASER 0x000d0045
236#define HID_DG_TABLETPICK 0x000d0046 236#define HID_DG_TABLETPICK 0x000d0046
237
238#define HID_CP_CONSUMERCONTROL 0x000c0001
239#define HID_CP_NUMERICKEYPAD 0x000c0002
240#define HID_CP_PROGRAMMABLEBUTTONS 0x000c0003
241#define HID_CP_MICROPHONE 0x000c0004
242#define HID_CP_HEADPHONE 0x000c0005
243#define HID_CP_GRAPHICEQUALIZER 0x000c0006
244#define HID_CP_FUNCTIONBUTTONS 0x000c0036
245#define HID_CP_SELECTION 0x000c0080
246#define HID_CP_MEDIASELECTION 0x000c0087
247#define HID_CP_SELECTDISC 0x000c00ba
248#define HID_CP_PLAYBACKSPEED 0x000c00f1
249#define HID_CP_PROXIMITY 0x000c0109
250#define HID_CP_SPEAKERSYSTEM 0x000c0160
251#define HID_CP_CHANNELLEFT 0x000c0161
252#define HID_CP_CHANNELRIGHT 0x000c0162
253#define HID_CP_CHANNELCENTER 0x000c0163
254#define HID_CP_CHANNELFRONT 0x000c0164
255#define HID_CP_CHANNELCENTERFRONT 0x000c0165
256#define HID_CP_CHANNELSIDE 0x000c0166
257#define HID_CP_CHANNELSURROUND 0x000c0167
258#define HID_CP_CHANNELLOWFREQUENCYENHANCEMENT 0x000c0168
259#define HID_CP_CHANNELTOP 0x000c0169
260#define HID_CP_CHANNELUNKNOWN 0x000c016a
261#define HID_CP_APPLICATIONLAUNCHBUTTONS 0x000c0180
262#define HID_CP_GENERICGUIAPPLICATIONCONTROLS 0x000c0200
263
237#define HID_DG_CONFIDENCE 0x000d0047 264#define HID_DG_CONFIDENCE 0x000d0047
238#define HID_DG_WIDTH 0x000d0048 265#define HID_DG_WIDTH 0x000d0048
239#define HID_DG_HEIGHT 0x000d0049 266#define HID_DG_HEIGHT 0x000d0049
@@ -312,11 +339,8 @@ struct hid_item {
312 * Vendor specific HID device groups 339 * Vendor specific HID device groups
313 */ 340 */
314#define HID_GROUP_RMI 0x0100 341#define HID_GROUP_RMI 0x0100
315
316/*
317 * Vendor specific HID device groups
318 */
319#define HID_GROUP_WACOM 0x0101 342#define HID_GROUP_WACOM 0x0101
343#define HID_GROUP_LOGITECH_DJ_DEVICE 0x0102
320 344
321/* 345/*
322 * This is the global environment of the parser. This information is 346 * This is the global environment of the parser. This information is
@@ -1063,6 +1087,17 @@ static inline void hid_hw_wait(struct hid_device *hdev)
1063 hdev->ll_driver->wait(hdev); 1087 hdev->ll_driver->wait(hdev);
1064} 1088}
1065 1089
1090/**
1091 * hid_report_len - calculate the report length
1092 *
1093 * @report: the report we want to know the length
1094 */
1095static inline int hid_report_len(struct hid_report *report)
1096{
1097 /* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */
1098 return ((report->size - 1) >> 3) + 1 + (report->id > 0);
1099}
1100
1066int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, 1101int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
1067 int interrupt); 1102 int interrupt);
1068 1103
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 6e6d338641fe..431b7fc605c9 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -175,6 +175,52 @@ static inline void __unmap_hugepage_range(struct mmu_gather *tlb,
175} 175}
176 176
177#endif /* !CONFIG_HUGETLB_PAGE */ 177#endif /* !CONFIG_HUGETLB_PAGE */
178/*
179 * hugepages at page global directory. If arch support
180 * hugepages at pgd level, they need to define this.
181 */
182#ifndef pgd_huge
183#define pgd_huge(x) 0
184#endif
185
186#ifndef pgd_write
187static inline int pgd_write(pgd_t pgd)
188{
189 BUG();
190 return 0;
191}
192#endif
193
194#ifndef pud_write
195static inline int pud_write(pud_t pud)
196{
197 BUG();
198 return 0;
199}
200#endif
201
202#ifndef is_hugepd
203/*
204 * Some architectures requires a hugepage directory format that is
205 * required to support multiple hugepage sizes. For example
206 * a4fe3ce76 "powerpc/mm: Allow more flexible layouts for hugepage pagetables"
207 * introduced the same on powerpc. This allows for a more flexible hugepage
208 * pagetable layout.
209 */
210typedef struct { unsigned long pd; } hugepd_t;
211#define is_hugepd(hugepd) (0)
212#define __hugepd(x) ((hugepd_t) { (x) })
213static inline int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
214 unsigned pdshift, unsigned long end,
215 int write, struct page **pages, int *nr)
216{
217 return 0;
218}
219#else
220extern int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
221 unsigned pdshift, unsigned long end,
222 int write, struct page **pages, int *nr);
223#endif
178 224
179#define HUGETLB_ANON_FILE "anon_hugepage" 225#define HUGETLB_ANON_FILE "anon_hugepage"
180 226
@@ -311,7 +357,8 @@ static inline struct hstate *hstate_sizelog(int page_size_log)
311{ 357{
312 if (!page_size_log) 358 if (!page_size_log)
313 return &default_hstate; 359 return &default_hstate;
314 return size_to_hstate(1 << page_size_log); 360
361 return size_to_hstate(1UL << page_size_log);
315} 362}
316 363
317static inline struct hstate *hstate_vma(struct vm_area_struct *vma) 364static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h
index 0129f89cf98d..bcc853eccc85 100644
--- a/include/linux/hugetlb_cgroup.h
+++ b/include/linux/hugetlb_cgroup.h
@@ -16,7 +16,6 @@
16#define _LINUX_HUGETLB_CGROUP_H 16#define _LINUX_HUGETLB_CGROUP_H
17 17
18#include <linux/mmdebug.h> 18#include <linux/mmdebug.h>
19#include <linux/res_counter.h>
20 19
21struct hugetlb_cgroup; 20struct hugetlb_cgroup;
22/* 21/*
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 08cfaff8a072..476c685ca6f9 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -650,6 +650,8 @@ struct vmbus_channel {
650 u8 monitor_grp; 650 u8 monitor_grp;
651 u8 monitor_bit; 651 u8 monitor_bit;
652 652
653 bool rescind; /* got rescind msg */
654
653 u32 ringbuffer_gpadlhandle; 655 u32 ringbuffer_gpadlhandle;
654 656
655 /* Allocated memory for ring buffer */ 657 /* Allocated memory for ring buffer */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index b556e0ab946f..e3a1721c8354 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -46,6 +46,8 @@ struct i2c_client;
46struct i2c_driver; 46struct i2c_driver;
47union i2c_smbus_data; 47union i2c_smbus_data;
48struct i2c_board_info; 48struct i2c_board_info;
49enum i2c_slave_event;
50typedef int (*i2c_slave_cb_t)(struct i2c_client *, enum i2c_slave_event, u8 *);
49 51
50struct module; 52struct module;
51 53
@@ -209,6 +211,8 @@ struct i2c_driver {
209 * @irq: indicates the IRQ generated by this device (if any) 211 * @irq: indicates the IRQ generated by this device (if any)
210 * @detected: member of an i2c_driver.clients list or i2c-core's 212 * @detected: member of an i2c_driver.clients list or i2c-core's
211 * userspace_devices list 213 * userspace_devices list
214 * @slave_cb: Callback when I2C slave mode of an adapter is used. The adapter
215 * calls it to pass on slave events to the slave driver.
212 * 216 *
213 * An i2c_client identifies a single device (i.e. chip) connected to an 217 * An i2c_client identifies a single device (i.e. chip) connected to an
214 * i2c bus. The behaviour exposed to Linux is defined by the driver 218 * i2c bus. The behaviour exposed to Linux is defined by the driver
@@ -224,6 +228,7 @@ struct i2c_client {
224 struct device dev; /* the device structure */ 228 struct device dev; /* the device structure */
225 int irq; /* irq issued by device */ 229 int irq; /* irq issued by device */
226 struct list_head detected; 230 struct list_head detected;
231 i2c_slave_cb_t slave_cb; /* callback for slave mode */
227}; 232};
228#define to_i2c_client(d) container_of(d, struct i2c_client, dev) 233#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
229 234
@@ -246,6 +251,25 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
246 dev_set_drvdata(&dev->dev, data); 251 dev_set_drvdata(&dev->dev, data);
247} 252}
248 253
254/* I2C slave support */
255
256enum i2c_slave_event {
257 I2C_SLAVE_REQ_READ_START,
258 I2C_SLAVE_REQ_READ_END,
259 I2C_SLAVE_REQ_WRITE_START,
260 I2C_SLAVE_REQ_WRITE_END,
261 I2C_SLAVE_STOP,
262};
263
264extern int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb);
265extern int i2c_slave_unregister(struct i2c_client *client);
266
267static inline int i2c_slave_event(struct i2c_client *client,
268 enum i2c_slave_event event, u8 *val)
269{
270 return client->slave_cb(client, event, val);
271}
272
249/** 273/**
250 * struct i2c_board_info - template for device creation 274 * struct i2c_board_info - template for device creation
251 * @type: chip type, to initialize i2c_client.name 275 * @type: chip type, to initialize i2c_client.name
@@ -352,6 +376,8 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info,
352 * into I2C transfers instead. 376 * into I2C transfers instead.
353 * @functionality: Return the flags that this algorithm/adapter pair supports 377 * @functionality: Return the flags that this algorithm/adapter pair supports
354 * from the I2C_FUNC_* flags. 378 * from the I2C_FUNC_* flags.
379 * @reg_slave: Register given client to I2C slave mode of this adapter
380 * @unreg_slave: Unregister given client from I2C slave mode of this adapter
355 * 381 *
356 * The following structs are for those who like to implement new bus drivers: 382 * The following structs are for those who like to implement new bus drivers:
357 * i2c_algorithm is the interface to a class of hardware solutions which can 383 * i2c_algorithm is the interface to a class of hardware solutions which can
@@ -359,7 +385,7 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info,
359 * to name two of the most common. 385 * to name two of the most common.
360 * 386 *
361 * The return codes from the @master_xfer field should indicate the type of 387 * The return codes from the @master_xfer field should indicate the type of
362 * error code that occured during the transfer, as documented in the kernel 388 * error code that occurred during the transfer, as documented in the kernel
363 * Documentation file Documentation/i2c/fault-codes. 389 * Documentation file Documentation/i2c/fault-codes.
364 */ 390 */
365struct i2c_algorithm { 391struct i2c_algorithm {
@@ -377,6 +403,9 @@ struct i2c_algorithm {
377 403
378 /* To determine what the adapter supports */ 404 /* To determine what the adapter supports */
379 u32 (*functionality) (struct i2c_adapter *); 405 u32 (*functionality) (struct i2c_adapter *);
406
407 int (*reg_slave)(struct i2c_client *client);
408 int (*unreg_slave)(struct i2c_client *client);
380}; 409};
381 410
382/** 411/**
diff --git a/include/linux/i2c/pmbus.h b/include/linux/i2c/pmbus.h
index 69280db02c41..ee3c2aba2a8e 100644
--- a/include/linux/i2c/pmbus.h
+++ b/include/linux/i2c/pmbus.h
@@ -40,6 +40,10 @@
40 40
41struct pmbus_platform_data { 41struct pmbus_platform_data {
42 u32 flags; /* Device specific flags */ 42 u32 flags; /* Device specific flags */
43
44 /* regulator support */
45 int num_regulators;
46 struct regulator_init_data *reg_init_data;
43}; 47};
44 48
45#endif /* _PMBUS_H_ */ 49#endif /* _PMBUS_H_ */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 8cfb50f38529..0bc03f100d04 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -26,7 +26,6 @@
26#define __TWL_H_ 26#define __TWL_H_
27 27
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/phy/phy.h>
30#include <linux/input/matrix_keypad.h> 29#include <linux/input/matrix_keypad.h>
31 30
32/* 31/*
@@ -634,7 +633,6 @@ enum twl4030_usb_mode {
634struct twl4030_usb_data { 633struct twl4030_usb_data {
635 enum twl4030_usb_mode usb_mode; 634 enum twl4030_usb_mode usb_mode;
636 unsigned long features; 635 unsigned long features;
637 struct phy_init_data *init_data;
638 636
639 int (*phy_init)(struct device *dev); 637 int (*phy_init)(struct device *dev);
640 int (*phy_exit)(struct device *dev); 638 int (*phy_exit)(struct device *dev);
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index b1be39c76931..4f4eea8a6288 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -19,6 +19,7 @@
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/if_ether.h> 20#include <linux/if_ether.h>
21#include <asm/byteorder.h> 21#include <asm/byteorder.h>
22#include <asm/unaligned.h>
22 23
23/* 24/*
24 * DS bit usage 25 * DS bit usage
@@ -1066,6 +1067,12 @@ struct ieee80211_pspoll {
1066 1067
1067/* TDLS */ 1068/* TDLS */
1068 1069
1070/* Channel switch timing */
1071struct ieee80211_ch_switch_timing {
1072 __le16 switch_time;
1073 __le16 switch_timeout;
1074} __packed;
1075
1069/* Link-id information element */ 1076/* Link-id information element */
1070struct ieee80211_tdls_lnkie { 1077struct ieee80211_tdls_lnkie {
1071 u8 ie_type; /* Link Identifier IE */ 1078 u8 ie_type; /* Link Identifier IE */
@@ -1107,6 +1114,15 @@ struct ieee80211_tdls_data {
1107 u8 dialog_token; 1114 u8 dialog_token;
1108 u8 variable[0]; 1115 u8 variable[0];
1109 } __packed discover_req; 1116 } __packed discover_req;
1117 struct {
1118 u8 target_channel;
1119 u8 oper_class;
1120 u8 variable[0];
1121 } __packed chan_switch_req;
1122 struct {
1123 __le16 status_code;
1124 u8 variable[0];
1125 } __packed chan_switch_resp;
1110 } u; 1126 } u;
1111} __packed; 1127} __packed;
1112 1128
@@ -1274,7 +1290,7 @@ struct ieee80211_ht_cap {
1274#define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2 1290#define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2
1275 1291
1276/* 1292/*
1277 * Maximum length of AMPDU that the STA can receive. 1293 * Maximum length of AMPDU that the STA can receive in high-throughput (HT).
1278 * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets) 1294 * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets)
1279 */ 1295 */
1280enum ieee80211_max_ampdu_length_exp { 1296enum ieee80211_max_ampdu_length_exp {
@@ -1284,6 +1300,21 @@ enum ieee80211_max_ampdu_length_exp {
1284 IEEE80211_HT_MAX_AMPDU_64K = 3 1300 IEEE80211_HT_MAX_AMPDU_64K = 3
1285}; 1301};
1286 1302
1303/*
1304 * Maximum length of AMPDU that the STA can receive in VHT.
1305 * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets)
1306 */
1307enum ieee80211_vht_max_ampdu_length_exp {
1308 IEEE80211_VHT_MAX_AMPDU_8K = 0,
1309 IEEE80211_VHT_MAX_AMPDU_16K = 1,
1310 IEEE80211_VHT_MAX_AMPDU_32K = 2,
1311 IEEE80211_VHT_MAX_AMPDU_64K = 3,
1312 IEEE80211_VHT_MAX_AMPDU_128K = 4,
1313 IEEE80211_VHT_MAX_AMPDU_256K = 5,
1314 IEEE80211_VHT_MAX_AMPDU_512K = 6,
1315 IEEE80211_VHT_MAX_AMPDU_1024K = 7
1316};
1317
1287#define IEEE80211_HT_MAX_AMPDU_FACTOR 13 1318#define IEEE80211_HT_MAX_AMPDU_FACTOR 13
1288 1319
1289/* Minimum MPDU start spacing */ 1320/* Minimum MPDU start spacing */
@@ -1998,6 +2029,16 @@ enum ieee80211_tdls_actioncode {
1998 WLAN_TDLS_DISCOVERY_REQUEST = 10, 2029 WLAN_TDLS_DISCOVERY_REQUEST = 10,
1999}; 2030};
2000 2031
2032/* Extended Channel Switching capability to be set in the 1st byte of
2033 * the @WLAN_EID_EXT_CAPABILITY information element
2034 */
2035#define WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING BIT(2)
2036
2037/* TDLS capabilities in the the 4th byte of @WLAN_EID_EXT_CAPABILITY */
2038#define WLAN_EXT_CAPA4_TDLS_BUFFER_STA BIT(4)
2039#define WLAN_EXT_CAPA4_TDLS_PEER_PSM BIT(5)
2040#define WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH BIT(6)
2041
2001/* Interworking capabilities are set in 7th bit of 4th byte of the 2042/* Interworking capabilities are set in 7th bit of 4th byte of the
2002 * @WLAN_EID_EXT_CAPABILITY information element 2043 * @WLAN_EID_EXT_CAPABILITY information element
2003 */ 2044 */
@@ -2009,6 +2050,7 @@ enum ieee80211_tdls_actioncode {
2009 */ 2050 */
2010#define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5) 2051#define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5)
2011#define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6) 2052#define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6)
2053#define WLAN_EXT_CAPA5_TDLS_CH_SW_PROHIBITED BIT(7)
2012 2054
2013#define WLAN_EXT_CAPA8_OPMODE_NOTIF BIT(6) 2055#define WLAN_EXT_CAPA8_OPMODE_NOTIF BIT(6)
2014#define WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED BIT(7) 2056#define WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED BIT(7)
@@ -2016,6 +2058,9 @@ enum ieee80211_tdls_actioncode {
2016/* TDLS specific payload type in the LLC/SNAP header */ 2058/* TDLS specific payload type in the LLC/SNAP header */
2017#define WLAN_TDLS_SNAP_RFTYPE 0x2 2059#define WLAN_TDLS_SNAP_RFTYPE 0x2
2018 2060
2061/* BSS Coex IE information field bits */
2062#define WLAN_BSS_COEX_INFORMATION_REQUEST BIT(0)
2063
2019/** 2064/**
2020 * enum - mesh synchronization method identifier 2065 * enum - mesh synchronization method identifier
2021 * 2066 *
@@ -2398,6 +2443,30 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
2398 return !!(tim->virtual_map[index] & mask); 2443 return !!(tim->virtual_map[index] & mask);
2399} 2444}
2400 2445
2446/**
2447 * ieee80211_get_tdls_action - get tdls packet action (or -1, if not tdls packet)
2448 * @skb: the skb containing the frame, length will not be checked
2449 * @hdr_size: the size of the ieee80211_hdr that starts at skb->data
2450 *
2451 * This function assumes the frame is a data frame, and that the network header
2452 * is in the correct place.
2453 */
2454static inline int ieee80211_get_tdls_action(struct sk_buff *skb, u32 hdr_size)
2455{
2456 if (!skb_is_nonlinear(skb) &&
2457 skb->len > (skb_network_offset(skb) + 2)) {
2458 /* Point to where the indication of TDLS should start */
2459 const u8 *tdls_data = skb_network_header(skb) - 2;
2460
2461 if (get_unaligned_be16(tdls_data) == ETH_P_TDLS &&
2462 tdls_data[2] == WLAN_TDLS_SNAP_RFTYPE &&
2463 tdls_data[3] == WLAN_CATEGORY_TDLS)
2464 return tdls_data[4];
2465 }
2466
2467 return -1;
2468}
2469
2401/* convert time units */ 2470/* convert time units */
2402#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024)) 2471#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024))
2403#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x)) 2472#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x))
diff --git a/include/net/ieee802154.h b/include/linux/ieee802154.h
index 0aa7122e8f15..6e82d888287c 100644
--- a/include/net/ieee802154.h
+++ b/include/linux/ieee802154.h
@@ -12,10 +12,6 @@
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Written by: 15 * Written by:
20 * Pavel Smolenskiy <pavel.smolenskiy@gmail.com> 16 * Pavel Smolenskiy <pavel.smolenskiy@gmail.com>
21 * Maxim Gorbachyov <maxim.gorbachev@siemens.com> 17 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
@@ -24,10 +20,27 @@
24 * Alexander Smirnov <alex.bluesman.smirnov@gmail.com> 20 * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
25 */ 21 */
26 22
27#ifndef NET_IEEE802154_H 23#ifndef LINUX_IEEE802154_H
28#define NET_IEEE802154_H 24#define LINUX_IEEE802154_H
25
26#include <linux/types.h>
27#include <linux/random.h>
28#include <asm/byteorder.h>
29 29
30#define IEEE802154_MTU 127 30#define IEEE802154_MTU 127
31#define IEEE802154_MIN_PSDU_LEN 5
32
33#define IEEE802154_PAN_ID_BROADCAST 0xffff
34#define IEEE802154_ADDR_SHORT_BROADCAST 0xffff
35#define IEEE802154_ADDR_SHORT_UNSPEC 0xfffe
36
37#define IEEE802154_EXTENDED_ADDR_LEN 8
38
39#define IEEE802154_LIFS_PERIOD 40
40#define IEEE802154_SIFS_PERIOD 12
41
42#define IEEE802154_MAX_CHANNEL 26
43#define IEEE802154_MAX_PAGE 31
31 44
32#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */ 45#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */
33#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */ 46#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */
@@ -189,7 +202,41 @@ enum {
189 IEEE802154_SCAN_IN_PROGRESS = 0xfc, 202 IEEE802154_SCAN_IN_PROGRESS = 0xfc,
190}; 203};
191 204
205/**
206 * ieee802154_is_valid_psdu_len - check if psdu len is valid
207 * @len: psdu len with (MHR + payload + MFR)
208 */
209static inline bool ieee802154_is_valid_psdu_len(const u8 len)
210{
211 return (len >= IEEE802154_MIN_PSDU_LEN && len <= IEEE802154_MTU);
212}
213
214/**
215 * ieee802154_is_valid_psdu_len - check if extended addr is valid
216 * @addr: extended addr to check
217 */
218static inline bool ieee802154_is_valid_extended_addr(const __le64 addr)
219{
220 /* These EUI-64 addresses are reserved by IEEE. 0xffffffffffffffff
221 * is used internally as extended to short address broadcast mapping.
222 * This is currently a workaround because neighbor discovery can't
223 * deal with short addresses types right now.
224 */
225 return ((addr != cpu_to_le64(0x0000000000000000ULL)) &&
226 (addr != cpu_to_le64(0xffffffffffffffffULL)));
227}
192 228
193#endif 229/**
230 * ieee802154_random_extended_addr - generates a random extended address
231 * @addr: extended addr pointer to place the random address
232 */
233static inline void ieee802154_random_extended_addr(__le64 *addr)
234{
235 get_random_bytes(addr, IEEE802154_EXTENDED_ADDR_LEN);
194 236
237 /* toggle some bit if we hit an invalid extended addr */
238 if (!ieee802154_is_valid_extended_addr(*addr))
239 ((u8 *)addr)[IEEE802154_EXTENDED_ADDR_LEN - 1] ^= 0x01;
240}
195 241
242#endif /* LINUX_IEEE802154_H */
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 808dcb8cc04f..0a8ce762a47f 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -15,6 +15,7 @@
15 15
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#include <linux/bitops.h>
18 19
19struct br_ip { 20struct br_ip {
20 union { 21 union {
@@ -32,11 +33,41 @@ struct br_ip_list {
32 struct br_ip addr; 33 struct br_ip addr;
33}; 34};
34 35
36#define BR_HAIRPIN_MODE BIT(0)
37#define BR_BPDU_GUARD BIT(1)
38#define BR_ROOT_BLOCK BIT(2)
39#define BR_MULTICAST_FAST_LEAVE BIT(3)
40#define BR_ADMIN_COST BIT(4)
41#define BR_LEARNING BIT(5)
42#define BR_FLOOD BIT(6)
43#define BR_AUTO_MASK (BR_FLOOD | BR_LEARNING)
44#define BR_PROMISC BIT(7)
45#define BR_PROXYARP BIT(8)
46#define BR_LEARNING_SYNC BIT(9)
47
35extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); 48extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
36 49
37typedef int br_should_route_hook_t(struct sk_buff *skb); 50typedef int br_should_route_hook_t(struct sk_buff *skb);
38extern br_should_route_hook_t __rcu *br_should_route_hook; 51extern br_should_route_hook_t __rcu *br_should_route_hook;
39 52
53#if IS_ENABLED(CONFIG_BRIDGE)
54int br_fdb_external_learn_add(struct net_device *dev,
55 const unsigned char *addr, u16 vid);
56int br_fdb_external_learn_del(struct net_device *dev,
57 const unsigned char *addr, u16 vid);
58#else
59static inline int br_fdb_external_learn_add(struct net_device *dev,
60 const unsigned char *addr, u16 vid)
61{
62 return 0;
63}
64static inline int br_fdb_external_learn_del(struct net_device *dev,
65 const unsigned char *addr, u16 vid)
66{
67 return 0;
68}
69#endif
70
40#if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) 71#if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING)
41int br_multicast_list_adjacent(struct net_device *dev, 72int br_multicast_list_adjacent(struct net_device *dev,
42 struct list_head *br_ip_list); 73 struct list_head *br_ip_list);
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index d69f0577a319..515a35e2a48a 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -282,28 +282,24 @@ static inline bool vlan_hw_offload_capable(netdev_features_t features,
282} 282}
283 283
284/** 284/**
285 * vlan_insert_tag - regular VLAN tag inserting 285 * __vlan_insert_tag - regular VLAN tag inserting
286 * @skb: skbuff to tag 286 * @skb: skbuff to tag
287 * @vlan_proto: VLAN encapsulation protocol 287 * @vlan_proto: VLAN encapsulation protocol
288 * @vlan_tci: VLAN TCI to insert 288 * @vlan_tci: VLAN TCI to insert
289 * 289 *
290 * Inserts the VLAN tag into @skb as part of the payload 290 * Inserts the VLAN tag into @skb as part of the payload
291 * Returns a VLAN tagged skb. If a new skb is created, @skb is freed. 291 * Returns error if skb_cow_head failes.
292 *
293 * Following the skb_unshare() example, in case of error, the calling function
294 * doesn't have to worry about freeing the original skb.
295 * 292 *
296 * Does not change skb->protocol so this function can be used during receive. 293 * Does not change skb->protocol so this function can be used during receive.
297 */ 294 */
298static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, 295static inline int __vlan_insert_tag(struct sk_buff *skb,
299 __be16 vlan_proto, u16 vlan_tci) 296 __be16 vlan_proto, u16 vlan_tci)
300{ 297{
301 struct vlan_ethhdr *veth; 298 struct vlan_ethhdr *veth;
302 299
303 if (skb_cow_head(skb, VLAN_HLEN) < 0) { 300 if (skb_cow_head(skb, VLAN_HLEN) < 0)
304 dev_kfree_skb_any(skb); 301 return -ENOMEM;
305 return NULL; 302
306 }
307 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); 303 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
308 304
309 /* Move the mac addresses to the beginning of the new header. */ 305 /* Move the mac addresses to the beginning of the new header. */
@@ -316,12 +312,40 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb,
316 /* now, the TCI */ 312 /* now, the TCI */
317 veth->h_vlan_TCI = htons(vlan_tci); 313 veth->h_vlan_TCI = htons(vlan_tci);
318 314
315 return 0;
316}
317
318/**
319 * vlan_insert_tag - regular VLAN tag inserting
320 * @skb: skbuff to tag
321 * @vlan_proto: VLAN encapsulation protocol
322 * @vlan_tci: VLAN TCI to insert
323 *
324 * Inserts the VLAN tag into @skb as part of the payload
325 * Returns a VLAN tagged skb. If a new skb is created, @skb is freed.
326 *
327 * Following the skb_unshare() example, in case of error, the calling function
328 * doesn't have to worry about freeing the original skb.
329 *
330 * Does not change skb->protocol so this function can be used during receive.
331 */
332static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb,
333 __be16 vlan_proto, u16 vlan_tci)
334{
335 int err;
336
337 err = __vlan_insert_tag(skb, vlan_proto, vlan_tci);
338 if (err) {
339 dev_kfree_skb_any(skb);
340 return NULL;
341 }
319 return skb; 342 return skb;
320} 343}
321 344
322/** 345/**
323 * __vlan_put_tag - regular VLAN tag inserting 346 * vlan_insert_tag_set_proto - regular VLAN tag inserting
324 * @skb: skbuff to tag 347 * @skb: skbuff to tag
348 * @vlan_proto: VLAN encapsulation protocol
325 * @vlan_tci: VLAN TCI to insert 349 * @vlan_tci: VLAN TCI to insert
326 * 350 *
327 * Inserts the VLAN tag into @skb as part of the payload 351 * Inserts the VLAN tag into @skb as part of the payload
@@ -330,8 +354,9 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb,
330 * Following the skb_unshare() example, in case of error, the calling function 354 * Following the skb_unshare() example, in case of error, the calling function
331 * doesn't have to worry about freeing the original skb. 355 * doesn't have to worry about freeing the original skb.
332 */ 356 */
333static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, 357static inline struct sk_buff *vlan_insert_tag_set_proto(struct sk_buff *skb,
334 __be16 vlan_proto, u16 vlan_tci) 358 __be16 vlan_proto,
359 u16 vlan_tci)
335{ 360{
336 skb = vlan_insert_tag(skb, vlan_proto, vlan_tci); 361 skb = vlan_insert_tag(skb, vlan_proto, vlan_tci);
337 if (skb) 362 if (skb)
@@ -339,39 +364,53 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb,
339 return skb; 364 return skb;
340} 365}
341 366
342/** 367/*
343 * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting 368 * __vlan_hwaccel_push_inside - pushes vlan tag to the payload
344 * @skb: skbuff to tag 369 * @skb: skbuff to tag
345 * @vlan_proto: VLAN encapsulation protocol
346 * @vlan_tci: VLAN TCI to insert
347 * 370 *
348 * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest 371 * Pushes the VLAN tag from @skb->vlan_tci inside to the payload.
372 *
373 * Following the skb_unshare() example, in case of error, the calling function
374 * doesn't have to worry about freeing the original skb.
349 */ 375 */
350static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, 376static inline struct sk_buff *__vlan_hwaccel_push_inside(struct sk_buff *skb)
351 __be16 vlan_proto,
352 u16 vlan_tci)
353{ 377{
354 skb->vlan_proto = vlan_proto; 378 skb = vlan_insert_tag_set_proto(skb, skb->vlan_proto,
355 skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci; 379 vlan_tx_tag_get(skb));
380 if (likely(skb))
381 skb->vlan_tci = 0;
382 return skb;
383}
384/*
385 * vlan_hwaccel_push_inside - pushes vlan tag to the payload
386 * @skb: skbuff to tag
387 *
388 * Checks is tag is present in @skb->vlan_tci and if it is, it pushes the
389 * VLAN tag from @skb->vlan_tci inside to the payload.
390 *
391 * Following the skb_unshare() example, in case of error, the calling function
392 * doesn't have to worry about freeing the original skb.
393 */
394static inline struct sk_buff *vlan_hwaccel_push_inside(struct sk_buff *skb)
395{
396 if (vlan_tx_tag_present(skb))
397 skb = __vlan_hwaccel_push_inside(skb);
356 return skb; 398 return skb;
357} 399}
358 400
359/** 401/**
360 * vlan_put_tag - inserts VLAN tag according to device features 402 * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting
361 * @skb: skbuff to tag 403 * @skb: skbuff to tag
404 * @vlan_proto: VLAN encapsulation protocol
362 * @vlan_tci: VLAN TCI to insert 405 * @vlan_tci: VLAN TCI to insert
363 * 406 *
364 * Assumes skb->dev is the target that will xmit this frame. 407 * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest
365 * Returns a VLAN tagged skb.
366 */ 408 */
367static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, 409static inline void __vlan_hwaccel_put_tag(struct sk_buff *skb,
368 __be16 vlan_proto, u16 vlan_tci) 410 __be16 vlan_proto, u16 vlan_tci)
369{ 411{
370 if (vlan_hw_offload_capable(skb->dev->features, vlan_proto)) { 412 skb->vlan_proto = vlan_proto;
371 return __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci); 413 skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci;
372 } else {
373 return __vlan_put_tag(skb, vlan_proto, vlan_tci);
374 }
375} 414}
376 415
377/** 416/**
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index d8257ab60bac..2c476acb87d9 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -164,7 +164,7 @@ struct st_sensor_transfer_function {
164}; 164};
165 165
166/** 166/**
167 * struct st_sensors - ST sensors list 167 * struct st_sensor_settings - ST specific sensor settings
168 * @wai: Contents of WhoAmI register. 168 * @wai: Contents of WhoAmI register.
169 * @sensors_supported: List of supported sensors by struct itself. 169 * @sensors_supported: List of supported sensors by struct itself.
170 * @ch: IIO channels for the sensor. 170 * @ch: IIO channels for the sensor.
@@ -177,7 +177,7 @@ struct st_sensor_transfer_function {
177 * @multi_read_bit: Use or not particular bit for [I2C/SPI] multi-read. 177 * @multi_read_bit: Use or not particular bit for [I2C/SPI] multi-read.
178 * @bootime: samples to discard when sensor passing from power-down to power-up. 178 * @bootime: samples to discard when sensor passing from power-down to power-up.
179 */ 179 */
180struct st_sensors { 180struct st_sensor_settings {
181 u8 wai; 181 u8 wai;
182 char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME]; 182 char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME];
183 struct iio_chan_spec *ch; 183 struct iio_chan_spec *ch;
@@ -196,7 +196,7 @@ struct st_sensors {
196 * struct st_sensor_data - ST sensor device status 196 * struct st_sensor_data - ST sensor device status
197 * @dev: Pointer to instance of struct device (I2C or SPI). 197 * @dev: Pointer to instance of struct device (I2C or SPI).
198 * @trig: The trigger in use by the core driver. 198 * @trig: The trigger in use by the core driver.
199 * @sensor: Pointer to the current sensor struct in use. 199 * @sensor_settings: Pointer to the specific sensor settings in use.
200 * @current_fullscale: Maximum range of measure by the sensor. 200 * @current_fullscale: Maximum range of measure by the sensor.
201 * @vdd: Pointer to sensor's Vdd power supply 201 * @vdd: Pointer to sensor's Vdd power supply
202 * @vdd_io: Pointer to sensor's Vdd-IO power supply 202 * @vdd_io: Pointer to sensor's Vdd-IO power supply
@@ -213,7 +213,7 @@ struct st_sensors {
213struct st_sensor_data { 213struct st_sensor_data {
214 struct device *dev; 214 struct device *dev;
215 struct iio_trigger *trig; 215 struct iio_trigger *trig;
216 struct st_sensors *sensor; 216 struct st_sensor_settings *sensor_settings;
217 struct st_sensor_fullscale_avl *current_fullscale; 217 struct st_sensor_fullscale_avl *current_fullscale;
218 struct regulator *vdd; 218 struct regulator *vdd;
219 struct regulator *vdd_io; 219 struct regulator *vdd_io;
@@ -279,7 +279,7 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,
279 struct iio_chan_spec const *ch, int *val); 279 struct iio_chan_spec const *ch, int *val);
280 280
281int st_sensors_check_device_support(struct iio_dev *indio_dev, 281int st_sensors_check_device_support(struct iio_dev *indio_dev,
282 int num_sensors_list, const struct st_sensors *sensors); 282 int num_sensors_list, const struct st_sensor_settings *sensor_settings);
283 283
284ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev, 284ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev,
285 struct device_attribute *attr, char *buf); 285 struct device_attribute *attr, char *buf);
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
index 8bbd7bc1043d..03fa332ad2a8 100644
--- a/include/linux/iio/events.h
+++ b/include/linux/iio/events.h
@@ -72,7 +72,7 @@ struct iio_event_data {
72 72
73#define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF) 73#define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
74 74
75#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0xCF) 75#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F)
76 76
77#define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF) 77#define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
78 78
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 15dc6bc2bdd2..3642ce7ef512 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -13,6 +13,7 @@
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/cdev.h> 14#include <linux/cdev.h>
15#include <linux/iio/types.h> 15#include <linux/iio/types.h>
16#include <linux/of.h>
16/* IIO TODO LIST */ 17/* IIO TODO LIST */
17/* 18/*
18 * Provide means of adjusting timer accuracy. 19 * Provide means of adjusting timer accuracy.
@@ -326,6 +327,11 @@ struct iio_dev;
326 * @update_scan_mode: function to configure device and scan buffer when 327 * @update_scan_mode: function to configure device and scan buffer when
327 * channels have changed 328 * channels have changed
328 * @debugfs_reg_access: function to read or write register value of device 329 * @debugfs_reg_access: function to read or write register value of device
330 * @of_xlate: function pointer to obtain channel specifier index.
331 * When #iio-cells is greater than '0', the driver could
332 * provide a custom of_xlate function that reads the
333 * *args* and returns the appropriate index in registered
334 * IIO channels array.
329 **/ 335 **/
330struct iio_info { 336struct iio_info {
331 struct module *driver_module; 337 struct module *driver_module;
@@ -385,6 +391,8 @@ struct iio_info {
385 int (*debugfs_reg_access)(struct iio_dev *indio_dev, 391 int (*debugfs_reg_access)(struct iio_dev *indio_dev,
386 unsigned reg, unsigned writeval, 392 unsigned reg, unsigned writeval,
387 unsigned *readval); 393 unsigned *readval);
394 int (*of_xlate)(struct iio_dev *indio_dev,
395 const struct of_phandle_args *iiospec);
388}; 396};
389 397
390/** 398/**
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 77fc43f8fb72..3037fc085e8e 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -102,7 +102,7 @@ extern struct group_info init_groups;
102#define INIT_IDS 102#define INIT_IDS
103#endif 103#endif
104 104
105#ifdef CONFIG_TREE_PREEMPT_RCU 105#ifdef CONFIG_PREEMPT_RCU
106#define INIT_TASK_RCU_TREE_PREEMPT() \ 106#define INIT_TASK_RCU_TREE_PREEMPT() \
107 .rcu_blocked_node = NULL, 107 .rcu_blocked_node = NULL,
108#else 108#else
@@ -166,6 +166,15 @@ extern struct task_group root_task_group;
166# define INIT_RT_MUTEXES(tsk) 166# define INIT_RT_MUTEXES(tsk)
167#endif 167#endif
168 168
169#ifdef CONFIG_NUMA_BALANCING
170# define INIT_NUMA_BALANCING(tsk) \
171 .numa_preferred_nid = -1, \
172 .numa_group = NULL, \
173 .numa_faults = NULL,
174#else
175# define INIT_NUMA_BALANCING(tsk)
176#endif
177
169/* 178/*
170 * INIT_TASK is used to set up the first task table, touch at 179 * INIT_TASK is used to set up the first task table, touch at
171 * your own risk!. Base=0, limit=0x1fffff (=2MB) 180 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -237,6 +246,7 @@ extern struct task_group root_task_group;
237 INIT_CPUSET_SEQ(tsk) \ 246 INIT_CPUSET_SEQ(tsk) \
238 INIT_RT_MUTEXES(tsk) \ 247 INIT_RT_MUTEXES(tsk) \
239 INIT_VTIME(tsk) \ 248 INIT_VTIME(tsk) \
249 INIT_NUMA_BALANCING(tsk) \
240} 250}
241 251
242 252
diff --git a/include/linux/integrity.h b/include/linux/integrity.h
index 83222cebd47b..c2d6082a1a4c 100644
--- a/include/linux/integrity.h
+++ b/include/linux/integrity.h
@@ -24,6 +24,7 @@ enum integrity_status {
24#ifdef CONFIG_INTEGRITY 24#ifdef CONFIG_INTEGRITY
25extern struct integrity_iint_cache *integrity_inode_get(struct inode *inode); 25extern struct integrity_iint_cache *integrity_inode_get(struct inode *inode);
26extern void integrity_inode_free(struct inode *inode); 26extern void integrity_inode_free(struct inode *inode);
27extern void __init integrity_load_keys(void);
27 28
28#else 29#else
29static inline struct integrity_iint_cache * 30static inline struct integrity_iint_cache *
@@ -36,5 +37,10 @@ static inline void integrity_inode_free(struct inode *inode)
36{ 37{
37 return; 38 return;
38} 39}
40
41static inline void integrity_load_keys(void)
42{
43}
39#endif /* CONFIG_INTEGRITY */ 44#endif /* CONFIG_INTEGRITY */
45
40#endif /* _LINUX_INTEGRITY_H */ 46#endif /* _LINUX_INTEGRITY_H */
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 69517a24bc50..d9b05b5bf8c7 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -556,12 +556,6 @@ static inline void tasklet_enable(struct tasklet_struct *t)
556 atomic_dec(&t->count); 556 atomic_dec(&t->count);
557} 557}
558 558
559static inline void tasklet_hi_enable(struct tasklet_struct *t)
560{
561 smp_mb__before_atomic();
562 atomic_dec(&t->count);
563}
564
565extern void tasklet_kill(struct tasklet_struct *t); 559extern void tasklet_kill(struct tasklet_struct *t);
566extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu); 560extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
567extern void tasklet_init(struct tasklet_struct *t, 561extern void tasklet_init(struct tasklet_struct *t,
diff --git a/include/linux/io.h b/include/linux/io.h
index d5fc9b8d8b03..fa02e55e5a2e 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -61,9 +61,9 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
61#define IOMEM_ERR_PTR(err) (__force void __iomem *)ERR_PTR(err) 61#define IOMEM_ERR_PTR(err) (__force void __iomem *)ERR_PTR(err)
62 62
63void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, 63void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
64 unsigned long size); 64 resource_size_t size);
65void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, 65void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
66 unsigned long size); 66 resource_size_t size);
67void devm_iounmap(struct device *dev, void __iomem *addr); 67void devm_iounmap(struct device *dev, void __iomem *addr);
68int check_signature(const volatile void __iomem *io_addr, 68int check_signature(const volatile void __iomem *io_addr,
69 const unsigned char *signature, int length); 69 const unsigned char *signature, int length);
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 415c7613d02c..38daa453f2e5 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -23,12 +23,13 @@
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/scatterlist.h>
26#include <trace/events/iommu.h> 27#include <trace/events/iommu.h>
27 28
28#define IOMMU_READ (1 << 0) 29#define IOMMU_READ (1 << 0)
29#define IOMMU_WRITE (1 << 1) 30#define IOMMU_WRITE (1 << 1)
30#define IOMMU_CACHE (1 << 2) /* DMA cache coherency */ 31#define IOMMU_CACHE (1 << 2) /* DMA cache coherency */
31#define IOMMU_EXEC (1 << 3) 32#define IOMMU_NOEXEC (1 << 3)
32 33
33struct iommu_ops; 34struct iommu_ops;
34struct iommu_group; 35struct iommu_group;
@@ -62,6 +63,7 @@ enum iommu_cap {
62 IOMMU_CAP_CACHE_COHERENCY, /* IOMMU can enforce cache coherent DMA 63 IOMMU_CAP_CACHE_COHERENCY, /* IOMMU can enforce cache coherent DMA
63 transactions */ 64 transactions */
64 IOMMU_CAP_INTR_REMAP, /* IOMMU supports interrupt isolation */ 65 IOMMU_CAP_INTR_REMAP, /* IOMMU supports interrupt isolation */
66 IOMMU_CAP_NOEXEC, /* IOMMU_NOEXEC flag */
65}; 67};
66 68
67/* 69/*
@@ -98,6 +100,8 @@ enum iommu_attr {
98 * @detach_dev: detach device from an iommu domain 100 * @detach_dev: detach device from an iommu domain
99 * @map: map a physically contiguous memory region to an iommu domain 101 * @map: map a physically contiguous memory region to an iommu domain
100 * @unmap: unmap a physically contiguous memory region from an iommu domain 102 * @unmap: unmap a physically contiguous memory region from an iommu domain
103 * @map_sg: map a scatter-gather list of physically contiguous memory chunks
104 * to an iommu domain
101 * @iova_to_phys: translate iova to physical address 105 * @iova_to_phys: translate iova to physical address
102 * @add_device: add device to iommu grouping 106 * @add_device: add device to iommu grouping
103 * @remove_device: remove device from iommu grouping 107 * @remove_device: remove device from iommu grouping
@@ -117,6 +121,8 @@ struct iommu_ops {
117 phys_addr_t paddr, size_t size, int prot); 121 phys_addr_t paddr, size_t size, int prot);
118 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, 122 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
119 size_t size); 123 size_t size);
124 size_t (*map_sg)(struct iommu_domain *domain, unsigned long iova,
125 struct scatterlist *sg, unsigned int nents, int prot);
120 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova); 126 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova);
121 int (*add_device)(struct device *dev); 127 int (*add_device)(struct device *dev);
122 void (*remove_device)(struct device *dev); 128 void (*remove_device)(struct device *dev);
@@ -164,6 +170,9 @@ extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
164 phys_addr_t paddr, size_t size, int prot); 170 phys_addr_t paddr, size_t size, int prot);
165extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, 171extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
166 size_t size); 172 size_t size);
173extern size_t default_iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
174 struct scatterlist *sg,unsigned int nents,
175 int prot);
167extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); 176extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
168extern void iommu_set_fault_handler(struct iommu_domain *domain, 177extern void iommu_set_fault_handler(struct iommu_domain *domain,
169 iommu_fault_handler_t handler, void *token); 178 iommu_fault_handler_t handler, void *token);
@@ -249,6 +258,13 @@ static inline int report_iommu_fault(struct iommu_domain *domain,
249 return ret; 258 return ret;
250} 259}
251 260
261static inline size_t iommu_map_sg(struct iommu_domain *domain,
262 unsigned long iova, struct scatterlist *sg,
263 unsigned int nents, int prot)
264{
265 return domain->ops->map_sg(domain, iova, sg, nents, prot);
266}
267
252#else /* CONFIG_IOMMU_API */ 268#else /* CONFIG_IOMMU_API */
253 269
254struct iommu_ops {}; 270struct iommu_ops {};
@@ -301,6 +317,13 @@ static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
301 return -ENODEV; 317 return -ENODEV;
302} 318}
303 319
320static inline size_t iommu_map_sg(struct iommu_domain *domain,
321 unsigned long iova, struct scatterlist *sg,
322 unsigned int nents, int prot)
323{
324 return -ENODEV;
325}
326
304static inline int iommu_domain_window_enable(struct iommu_domain *domain, 327static inline int iommu_domain_window_enable(struct iommu_domain *domain,
305 u32 wnd_nr, phys_addr_t paddr, 328 u32 wnd_nr, phys_addr_t paddr,
306 u64 size, int prot) 329 u64 size, int prot)
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 35e7eca4e33b..e365d5ec69cb 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -7,15 +7,6 @@
7#include <linux/notifier.h> 7#include <linux/notifier.h>
8#include <linux/nsproxy.h> 8#include <linux/nsproxy.h>
9 9
10/*
11 * ipc namespace events
12 */
13#define IPCNS_MEMCHANGED 0x00000001 /* Notify lowmem size changed */
14#define IPCNS_CREATED 0x00000002 /* Notify new ipc namespace created */
15#define IPCNS_REMOVED 0x00000003 /* Notify ipc namespace removed */
16
17#define IPCNS_CALLBACK_PRI 0
18
19struct user_namespace; 10struct user_namespace;
20 11
21struct ipc_ids { 12struct ipc_ids {
@@ -38,7 +29,6 @@ struct ipc_namespace {
38 unsigned int msg_ctlmni; 29 unsigned int msg_ctlmni;
39 atomic_t msg_bytes; 30 atomic_t msg_bytes;
40 atomic_t msg_hdrs; 31 atomic_t msg_hdrs;
41 int auto_msgmni;
42 32
43 size_t shm_ctlmax; 33 size_t shm_ctlmax;
44 size_t shm_ctlall; 34 size_t shm_ctlall;
@@ -77,18 +67,8 @@ extern atomic_t nr_ipc_ns;
77extern spinlock_t mq_lock; 67extern spinlock_t mq_lock;
78 68
79#ifdef CONFIG_SYSVIPC 69#ifdef CONFIG_SYSVIPC
80extern int register_ipcns_notifier(struct ipc_namespace *);
81extern int cond_register_ipcns_notifier(struct ipc_namespace *);
82extern void unregister_ipcns_notifier(struct ipc_namespace *);
83extern int ipcns_notify(unsigned long);
84extern void shm_destroy_orphaned(struct ipc_namespace *ns); 70extern void shm_destroy_orphaned(struct ipc_namespace *ns);
85#else /* CONFIG_SYSVIPC */ 71#else /* CONFIG_SYSVIPC */
86static inline int register_ipcns_notifier(struct ipc_namespace *ns)
87{ return 0; }
88static inline int cond_register_ipcns_notifier(struct ipc_namespace *ns)
89{ return 0; }
90static inline void unregister_ipcns_notifier(struct ipc_namespace *ns) { }
91static inline int ipcns_notify(unsigned long l) { return 0; }
92static inline void shm_destroy_orphaned(struct ipc_namespace *ns) {} 72static inline void shm_destroy_orphaned(struct ipc_namespace *ns) {}
93#endif /* CONFIG_SYSVIPC */ 73#endif /* CONFIG_SYSVIPC */
94 74
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index 76d2acbfa7c6..838dbfa3c331 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -37,6 +37,7 @@
37 37
38#include <linux/list.h> 38#include <linux/list.h>
39#include <linux/proc_fs.h> 39#include <linux/proc_fs.h>
40#include <linux/acpi.h> /* For acpi_handle */
40 41
41struct module; 42struct module;
42struct device; 43struct device;
@@ -278,15 +279,18 @@ enum ipmi_addr_src {
278 SI_INVALID = 0, SI_HOTMOD, SI_HARDCODED, SI_SPMI, SI_ACPI, SI_SMBIOS, 279 SI_INVALID = 0, SI_HOTMOD, SI_HARDCODED, SI_SPMI, SI_ACPI, SI_SMBIOS,
279 SI_PCI, SI_DEVICETREE, SI_DEFAULT 280 SI_PCI, SI_DEVICETREE, SI_DEFAULT
280}; 281};
282const char *ipmi_addr_src_to_str(enum ipmi_addr_src src);
281 283
282union ipmi_smi_info_union { 284union ipmi_smi_info_union {
285#ifdef CONFIG_ACPI
283 /* 286 /*
284 * the acpi_info element is defined for the SI_ACPI 287 * the acpi_info element is defined for the SI_ACPI
285 * address type 288 * address type
286 */ 289 */
287 struct { 290 struct {
288 void *acpi_handle; 291 acpi_handle acpi_handle;
289 } acpi_info; 292 } acpi_info;
293#endif
290}; 294};
291 295
292struct ipmi_smi_info { 296struct ipmi_smi_info {
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index bd349240d50e..0b1e569f5ff5 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -98,12 +98,11 @@ struct ipmi_smi_handlers {
98 operation is not allowed to fail. If an error occurs, it 98 operation is not allowed to fail. If an error occurs, it
99 should report back the error in a received message. It may 99 should report back the error in a received message. It may
100 do this in the current call context, since no write locks 100 do this in the current call context, since no write locks
101 are held when this is run. If the priority is > 0, the 101 are held when this is run. Message are delivered one at
102 message will go into a high-priority queue and be sent 102 a time by the message handler, a new message will not be
103 first. Otherwise, it goes into a normal-priority queue. */ 103 delivered until the previous message is returned. */
104 void (*sender)(void *send_info, 104 void (*sender)(void *send_info,
105 struct ipmi_smi_msg *msg, 105 struct ipmi_smi_msg *msg);
106 int priority);
107 106
108 /* Called by the upper layer to request that we try to get 107 /* Called by the upper layer to request that we try to get
109 events from the BMC we are attached to. */ 108 events from the BMC we are attached to. */
@@ -212,7 +211,6 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
212 void *send_info, 211 void *send_info,
213 struct ipmi_device_id *device_id, 212 struct ipmi_device_id *device_id,
214 struct device *dev, 213 struct device *dev,
215 const char *sysfs_name,
216 unsigned char slave_addr); 214 unsigned char slave_addr);
217 215
218/* 216/*
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index ff560537dd61..c694e7baa621 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -42,6 +42,7 @@ struct ipv6_devconf {
42 __s32 accept_ra_from_local; 42 __s32 accept_ra_from_local;
43#ifdef CONFIG_IPV6_OPTIMISTIC_DAD 43#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
44 __s32 optimistic_dad; 44 __s32 optimistic_dad;
45 __s32 use_optimistic;
45#endif 46#endif
46#ifdef CONFIG_IPV6_MROUTE 47#ifdef CONFIG_IPV6_MROUTE
47 __s32 mc_forwarding; 48 __s32 mc_forwarding;
@@ -316,14 +317,4 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
316#define tcp_twsk_ipv6only(__sk) 0 317#define tcp_twsk_ipv6only(__sk) 0
317#define inet_v6_ipv6only(__sk) 0 318#define inet_v6_ipv6only(__sk) 0
318#endif /* IS_ENABLED(CONFIG_IPV6) */ 319#endif /* IS_ENABLED(CONFIG_IPV6) */
319
320#define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \
321 (((__sk)->sk_portpair == (__ports)) && \
322 ((__sk)->sk_family == AF_INET6) && \
323 ipv6_addr_equal(&(__sk)->sk_v6_daddr, (__saddr)) && \
324 ipv6_addr_equal(&(__sk)->sk_v6_rcv_saddr, (__daddr)) && \
325 (!(__sk)->sk_bound_dev_if || \
326 ((__sk)->sk_bound_dev_if == (__dif))) && \
327 net_eq(sock_net(__sk), (__net)))
328
329#endif /* _IPV6_H */ 320#endif /* _IPV6_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 03f48d936f66..d09ec7a1243e 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -15,11 +15,13 @@
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/cpumask.h> 16#include <linux/cpumask.h>
17#include <linux/gfp.h> 17#include <linux/gfp.h>
18#include <linux/irqhandler.h>
18#include <linux/irqreturn.h> 19#include <linux/irqreturn.h>
19#include <linux/irqnr.h> 20#include <linux/irqnr.h>
20#include <linux/errno.h> 21#include <linux/errno.h>
21#include <linux/topology.h> 22#include <linux/topology.h>
22#include <linux/wait.h> 23#include <linux/wait.h>
24#include <linux/io.h>
23 25
24#include <asm/irq.h> 26#include <asm/irq.h>
25#include <asm/ptrace.h> 27#include <asm/ptrace.h>
@@ -27,11 +29,7 @@
27 29
28struct seq_file; 30struct seq_file;
29struct module; 31struct module;
30struct irq_desc; 32struct msi_msg;
31struct irq_data;
32typedef void (*irq_flow_handler_t)(unsigned int irq,
33 struct irq_desc *desc);
34typedef void (*irq_preflow_handler_t)(struct irq_data *data);
35 33
36/* 34/*
37 * IRQ line status. 35 * IRQ line status.
@@ -113,10 +111,14 @@ enum {
113 * 111 *
114 * IRQ_SET_MASK_OK - OK, core updates irq_data.affinity 112 * IRQ_SET_MASK_OK - OK, core updates irq_data.affinity
115 * IRQ_SET_MASK_NOCPY - OK, chip did update irq_data.affinity 113 * IRQ_SET_MASK_NOCPY - OK, chip did update irq_data.affinity
114 * IRQ_SET_MASK_OK_DONE - Same as IRQ_SET_MASK_OK for core. Special code to
115 * support stacked irqchips, which indicates skipping
116 * all descendent irqchips.
116 */ 117 */
117enum { 118enum {
118 IRQ_SET_MASK_OK = 0, 119 IRQ_SET_MASK_OK = 0,
119 IRQ_SET_MASK_OK_NOCOPY, 120 IRQ_SET_MASK_OK_NOCOPY,
121 IRQ_SET_MASK_OK_DONE,
120}; 122};
121 123
122struct msi_desc; 124struct msi_desc;
@@ -133,6 +135,8 @@ struct irq_domain;
133 * @chip: low level interrupt hardware access 135 * @chip: low level interrupt hardware access
134 * @domain: Interrupt translation domain; responsible for mapping 136 * @domain: Interrupt translation domain; responsible for mapping
135 * between hwirq number and linux irq number. 137 * between hwirq number and linux irq number.
138 * @parent_data: pointer to parent struct irq_data to support hierarchy
139 * irq_domain
136 * @handler_data: per-IRQ data for the irq_chip methods 140 * @handler_data: per-IRQ data for the irq_chip methods
137 * @chip_data: platform-specific per-chip private data for the chip 141 * @chip_data: platform-specific per-chip private data for the chip
138 * methods, to allow shared chip implementations 142 * methods, to allow shared chip implementations
@@ -151,6 +155,9 @@ struct irq_data {
151 unsigned int state_use_accessors; 155 unsigned int state_use_accessors;
152 struct irq_chip *chip; 156 struct irq_chip *chip;
153 struct irq_domain *domain; 157 struct irq_domain *domain;
158#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
159 struct irq_data *parent_data;
160#endif
154 void *handler_data; 161 void *handler_data;
155 void *chip_data; 162 void *chip_data;
156 struct msi_desc *msi_desc; 163 struct msi_desc *msi_desc;
@@ -315,6 +322,8 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
315 * any other callback related to this irq 322 * any other callback related to this irq
316 * @irq_release_resources: optional to release resources acquired with 323 * @irq_release_resources: optional to release resources acquired with
317 * irq_request_resources 324 * irq_request_resources
325 * @irq_compose_msi_msg: optional to compose message content for MSI
326 * @irq_write_msi_msg: optional to write message content for MSI
318 * @flags: chip specific flags 327 * @flags: chip specific flags
319 */ 328 */
320struct irq_chip { 329struct irq_chip {
@@ -351,6 +360,9 @@ struct irq_chip {
351 int (*irq_request_resources)(struct irq_data *data); 360 int (*irq_request_resources)(struct irq_data *data);
352 void (*irq_release_resources)(struct irq_data *data); 361 void (*irq_release_resources)(struct irq_data *data);
353 362
363 void (*irq_compose_msi_msg)(struct irq_data *data, struct msi_msg *msg);
364 void (*irq_write_msi_msg)(struct irq_data *data, struct msi_msg *msg);
365
354 unsigned long flags; 366 unsigned long flags;
355}; 367};
356 368
@@ -438,6 +450,18 @@ extern void handle_percpu_devid_irq(unsigned int irq, struct irq_desc *desc);
438extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc); 450extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc);
439extern void handle_nested_irq(unsigned int irq); 451extern void handle_nested_irq(unsigned int irq);
440 452
453extern int irq_chip_compose_msi_msg(struct irq_data *data, struct msi_msg *msg);
454#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
455extern void irq_chip_ack_parent(struct irq_data *data);
456extern int irq_chip_retrigger_hierarchy(struct irq_data *data);
457extern void irq_chip_mask_parent(struct irq_data *data);
458extern void irq_chip_unmask_parent(struct irq_data *data);
459extern void irq_chip_eoi_parent(struct irq_data *data);
460extern int irq_chip_set_affinity_parent(struct irq_data *data,
461 const struct cpumask *dest,
462 bool force);
463#endif
464
441/* Handling of unhandled and spurious interrupts: */ 465/* Handling of unhandled and spurious interrupts: */
442extern void note_interrupt(unsigned int irq, struct irq_desc *desc, 466extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
443 irqreturn_t action_ret); 467 irqreturn_t action_ret);
@@ -639,13 +663,6 @@ void arch_teardown_hwirq(unsigned int irq);
639void irq_init_desc(unsigned int irq); 663void irq_init_desc(unsigned int irq);
640#endif 664#endif
641 665
642#ifndef irq_reg_writel
643# define irq_reg_writel(val, addr) writel(val, addr)
644#endif
645#ifndef irq_reg_readl
646# define irq_reg_readl(addr) readl(addr)
647#endif
648
649/** 666/**
650 * struct irq_chip_regs - register offsets for struct irq_gci 667 * struct irq_chip_regs - register offsets for struct irq_gci
651 * @enable: Enable register offset to reg_base 668 * @enable: Enable register offset to reg_base
@@ -692,6 +709,8 @@ struct irq_chip_type {
692 * struct irq_chip_generic - Generic irq chip data structure 709 * struct irq_chip_generic - Generic irq chip data structure
693 * @lock: Lock to protect register and cache data access 710 * @lock: Lock to protect register and cache data access
694 * @reg_base: Register base address (virtual) 711 * @reg_base: Register base address (virtual)
712 * @reg_readl: Alternate I/O accessor (defaults to readl if NULL)
713 * @reg_writel: Alternate I/O accessor (defaults to writel if NULL)
695 * @irq_base: Interrupt base nr for this chip 714 * @irq_base: Interrupt base nr for this chip
696 * @irq_cnt: Number of interrupts handled by this chip 715 * @irq_cnt: Number of interrupts handled by this chip
697 * @mask_cache: Cached mask register shared between all chip types 716 * @mask_cache: Cached mask register shared between all chip types
@@ -716,6 +735,8 @@ struct irq_chip_type {
716struct irq_chip_generic { 735struct irq_chip_generic {
717 raw_spinlock_t lock; 736 raw_spinlock_t lock;
718 void __iomem *reg_base; 737 void __iomem *reg_base;
738 u32 (*reg_readl)(void __iomem *addr);
739 void (*reg_writel)(u32 val, void __iomem *addr);
719 unsigned int irq_base; 740 unsigned int irq_base;
720 unsigned int irq_cnt; 741 unsigned int irq_cnt;
721 u32 mask_cache; 742 u32 mask_cache;
@@ -740,12 +761,14 @@ struct irq_chip_generic {
740 * the parent irq. Usually GPIO implementations 761 * the parent irq. Usually GPIO implementations
741 * @IRQ_GC_MASK_CACHE_PER_TYPE: Mask cache is chip type private 762 * @IRQ_GC_MASK_CACHE_PER_TYPE: Mask cache is chip type private
742 * @IRQ_GC_NO_MASK: Do not calculate irq_data->mask 763 * @IRQ_GC_NO_MASK: Do not calculate irq_data->mask
764 * @IRQ_GC_BE_IO: Use big-endian register accesses (default: LE)
743 */ 765 */
744enum irq_gc_flags { 766enum irq_gc_flags {
745 IRQ_GC_INIT_MASK_CACHE = 1 << 0, 767 IRQ_GC_INIT_MASK_CACHE = 1 << 0,
746 IRQ_GC_INIT_NESTED_LOCK = 1 << 1, 768 IRQ_GC_INIT_NESTED_LOCK = 1 << 1,
747 IRQ_GC_MASK_CACHE_PER_TYPE = 1 << 2, 769 IRQ_GC_MASK_CACHE_PER_TYPE = 1 << 2,
748 IRQ_GC_NO_MASK = 1 << 3, 770 IRQ_GC_NO_MASK = 1 << 3,
771 IRQ_GC_BE_IO = 1 << 4,
749}; 772};
750 773
751/* 774/*
@@ -821,4 +844,22 @@ static inline void irq_gc_lock(struct irq_chip_generic *gc) { }
821static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } 844static inline void irq_gc_unlock(struct irq_chip_generic *gc) { }
822#endif 845#endif
823 846
847static inline void irq_reg_writel(struct irq_chip_generic *gc,
848 u32 val, int reg_offset)
849{
850 if (gc->reg_writel)
851 gc->reg_writel(val, gc->reg_base + reg_offset);
852 else
853 writel(val, gc->reg_base + reg_offset);
854}
855
856static inline u32 irq_reg_readl(struct irq_chip_generic *gc,
857 int reg_offset)
858{
859 if (gc->reg_readl)
860 return gc->reg_readl(gc->reg_base + reg_offset);
861 else
862 return readl(gc->reg_base + reg_offset);
863}
864
824#endif /* _LINUX_IRQ_H */ 865#endif /* _LINUX_IRQ_H */
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h
index 03a4ea37ba86..1e8b0cf30792 100644
--- a/include/linux/irqchip/arm-gic-v3.h
+++ b/include/linux/irqchip/arm-gic-v3.h
@@ -49,6 +49,10 @@
49#define GICD_CTLR_ENABLE_G1A (1U << 1) 49#define GICD_CTLR_ENABLE_G1A (1U << 1)
50#define GICD_CTLR_ENABLE_G1 (1U << 0) 50#define GICD_CTLR_ENABLE_G1 (1U << 0)
51 51
52#define GICD_TYPER_ID_BITS(typer) ((((typer) >> 19) & 0x1f) + 1)
53#define GICD_TYPER_IRQS(typer) ((((typer) & 0x1f) + 1) * 32)
54#define GICD_TYPER_LPIS (1U << 17)
55
52#define GICD_IROUTER_SPI_MODE_ONE (0U << 31) 56#define GICD_IROUTER_SPI_MODE_ONE (0U << 31)
53#define GICD_IROUTER_SPI_MODE_ANY (1U << 31) 57#define GICD_IROUTER_SPI_MODE_ANY (1U << 31)
54 58
@@ -76,9 +80,27 @@
76#define GICR_MOVALLR 0x0110 80#define GICR_MOVALLR 0x0110
77#define GICR_PIDR2 GICD_PIDR2 81#define GICR_PIDR2 GICD_PIDR2
78 82
83#define GICR_CTLR_ENABLE_LPIS (1UL << 0)
84
85#define GICR_TYPER_CPU_NUMBER(r) (((r) >> 8) & 0xffff)
86
79#define GICR_WAKER_ProcessorSleep (1U << 1) 87#define GICR_WAKER_ProcessorSleep (1U << 1)
80#define GICR_WAKER_ChildrenAsleep (1U << 2) 88#define GICR_WAKER_ChildrenAsleep (1U << 2)
81 89
90#define GICR_PROPBASER_NonShareable (0U << 10)
91#define GICR_PROPBASER_InnerShareable (1U << 10)
92#define GICR_PROPBASER_OuterShareable (2U << 10)
93#define GICR_PROPBASER_SHAREABILITY_MASK (3UL << 10)
94#define GICR_PROPBASER_nCnB (0U << 7)
95#define GICR_PROPBASER_nC (1U << 7)
96#define GICR_PROPBASER_RaWt (2U << 7)
97#define GICR_PROPBASER_RaWb (3U << 7)
98#define GICR_PROPBASER_WaWt (4U << 7)
99#define GICR_PROPBASER_WaWb (5U << 7)
100#define GICR_PROPBASER_RaWaWt (6U << 7)
101#define GICR_PROPBASER_RaWaWb (7U << 7)
102#define GICR_PROPBASER_IDBITS_MASK (0x1f)
103
82/* 104/*
83 * Re-Distributor registers, offsets from SGI_base 105 * Re-Distributor registers, offsets from SGI_base
84 */ 106 */
@@ -91,9 +113,93 @@
91#define GICR_IPRIORITYR0 GICD_IPRIORITYR 113#define GICR_IPRIORITYR0 GICD_IPRIORITYR
92#define GICR_ICFGR0 GICD_ICFGR 114#define GICR_ICFGR0 GICD_ICFGR
93 115
116#define GICR_TYPER_PLPIS (1U << 0)
94#define GICR_TYPER_VLPIS (1U << 1) 117#define GICR_TYPER_VLPIS (1U << 1)
95#define GICR_TYPER_LAST (1U << 4) 118#define GICR_TYPER_LAST (1U << 4)
96 119
120#define LPI_PROP_GROUP1 (1 << 1)
121#define LPI_PROP_ENABLED (1 << 0)
122
123/*
124 * ITS registers, offsets from ITS_base
125 */
126#define GITS_CTLR 0x0000
127#define GITS_IIDR 0x0004
128#define GITS_TYPER 0x0008
129#define GITS_CBASER 0x0080
130#define GITS_CWRITER 0x0088
131#define GITS_CREADR 0x0090
132#define GITS_BASER 0x0100
133#define GITS_PIDR2 GICR_PIDR2
134
135#define GITS_TRANSLATER 0x10040
136
137#define GITS_TYPER_PTA (1UL << 19)
138
139#define GITS_CBASER_VALID (1UL << 63)
140#define GITS_CBASER_nCnB (0UL << 59)
141#define GITS_CBASER_nC (1UL << 59)
142#define GITS_CBASER_RaWt (2UL << 59)
143#define GITS_CBASER_RaWb (3UL << 59)
144#define GITS_CBASER_WaWt (4UL << 59)
145#define GITS_CBASER_WaWb (5UL << 59)
146#define GITS_CBASER_RaWaWt (6UL << 59)
147#define GITS_CBASER_RaWaWb (7UL << 59)
148#define GITS_CBASER_NonShareable (0UL << 10)
149#define GITS_CBASER_InnerShareable (1UL << 10)
150#define GITS_CBASER_OuterShareable (2UL << 10)
151#define GITS_CBASER_SHAREABILITY_MASK (3UL << 10)
152
153#define GITS_BASER_NR_REGS 8
154
155#define GITS_BASER_VALID (1UL << 63)
156#define GITS_BASER_nCnB (0UL << 59)
157#define GITS_BASER_nC (1UL << 59)
158#define GITS_BASER_RaWt (2UL << 59)
159#define GITS_BASER_RaWb (3UL << 59)
160#define GITS_BASER_WaWt (4UL << 59)
161#define GITS_BASER_WaWb (5UL << 59)
162#define GITS_BASER_RaWaWt (6UL << 59)
163#define GITS_BASER_RaWaWb (7UL << 59)
164#define GITS_BASER_TYPE_SHIFT (56)
165#define GITS_BASER_TYPE(r) (((r) >> GITS_BASER_TYPE_SHIFT) & 7)
166#define GITS_BASER_ENTRY_SIZE_SHIFT (48)
167#define GITS_BASER_ENTRY_SIZE(r) ((((r) >> GITS_BASER_ENTRY_SIZE_SHIFT) & 0xff) + 1)
168#define GITS_BASER_NonShareable (0UL << 10)
169#define GITS_BASER_InnerShareable (1UL << 10)
170#define GITS_BASER_OuterShareable (2UL << 10)
171#define GITS_BASER_SHAREABILITY_SHIFT (10)
172#define GITS_BASER_SHAREABILITY_MASK (3UL << GITS_BASER_SHAREABILITY_SHIFT)
173#define GITS_BASER_PAGE_SIZE_SHIFT (8)
174#define GITS_BASER_PAGE_SIZE_4K (0UL << GITS_BASER_PAGE_SIZE_SHIFT)
175#define GITS_BASER_PAGE_SIZE_16K (1UL << GITS_BASER_PAGE_SIZE_SHIFT)
176#define GITS_BASER_PAGE_SIZE_64K (2UL << GITS_BASER_PAGE_SIZE_SHIFT)
177#define GITS_BASER_PAGE_SIZE_MASK (3UL << GITS_BASER_PAGE_SIZE_SHIFT)
178
179#define GITS_BASER_TYPE_NONE 0
180#define GITS_BASER_TYPE_DEVICE 1
181#define GITS_BASER_TYPE_VCPU 2
182#define GITS_BASER_TYPE_CPU 3
183#define GITS_BASER_TYPE_COLLECTION 4
184#define GITS_BASER_TYPE_RESERVED5 5
185#define GITS_BASER_TYPE_RESERVED6 6
186#define GITS_BASER_TYPE_RESERVED7 7
187
188/*
189 * ITS commands
190 */
191#define GITS_CMD_MAPD 0x08
192#define GITS_CMD_MAPC 0x09
193#define GITS_CMD_MAPVI 0x0a
194#define GITS_CMD_MOVI 0x01
195#define GITS_CMD_DISCARD 0x0f
196#define GITS_CMD_INV 0x0c
197#define GITS_CMD_MOVALL 0x0e
198#define GITS_CMD_INVALL 0x0d
199#define GITS_CMD_INT 0x03
200#define GITS_CMD_CLEAR 0x04
201#define GITS_CMD_SYNC 0x05
202
97/* 203/*
98 * CPU interface registers 204 * CPU interface registers
99 */ 205 */
@@ -189,12 +295,34 @@
189 295
190#include <linux/stringify.h> 296#include <linux/stringify.h>
191 297
298/*
299 * We need a value to serve as a irq-type for LPIs. Choose one that will
300 * hopefully pique the interest of the reviewer.
301 */
302#define GIC_IRQ_TYPE_LPI 0xa110c8ed
303
304struct rdists {
305 struct {
306 void __iomem *rd_base;
307 struct page *pend_page;
308 phys_addr_t phys_base;
309 } __percpu *rdist;
310 struct page *prop_page;
311 int id_bits;
312 u64 flags;
313};
314
192static inline void gic_write_eoir(u64 irq) 315static inline void gic_write_eoir(u64 irq)
193{ 316{
194 asm volatile("msr_s " __stringify(ICC_EOIR1_EL1) ", %0" : : "r" (irq)); 317 asm volatile("msr_s " __stringify(ICC_EOIR1_EL1) ", %0" : : "r" (irq));
195 isb(); 318 isb();
196} 319}
197 320
321struct irq_domain;
322int its_cpu_init(void);
323int its_init(struct device_node *node, struct rdists *rdists,
324 struct irq_domain *domain);
325
198#endif 326#endif
199 327
200#endif 328#endif
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 13eed92c7d24..71d706d5f169 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -91,6 +91,8 @@
91 91
92#ifndef __ASSEMBLY__ 92#ifndef __ASSEMBLY__
93 93
94#include <linux/irqdomain.h>
95
94struct device_node; 96struct device_node;
95 97
96extern struct irq_chip gic_arch_extn; 98extern struct irq_chip gic_arch_extn;
@@ -106,6 +108,8 @@ static inline void gic_init(unsigned int nr, int start,
106 gic_init_bases(nr, start, dist, cpu, 0, NULL); 108 gic_init_bases(nr, start, dist, cpu, 0, NULL);
107} 109}
108 110
111int gicv2m_of_init(struct device_node *node, struct irq_domain *parent);
112
109void gic_send_sgi(unsigned int cpu_id, unsigned int irq); 113void gic_send_sgi(unsigned int cpu_id, unsigned int irq);
110int gic_get_cpu_id(unsigned int cpu); 114int gic_get_cpu_id(unsigned int cpu);
111void gic_migrate_target(unsigned int new_cpu_id); 115void gic_migrate_target(unsigned int new_cpu_id);
diff --git a/include/linux/irqchip/mips-gic.h b/include/linux/irqchip/mips-gic.h
new file mode 100644
index 000000000000..420f77b34d02
--- /dev/null
+++ b/include/linux/irqchip/mips-gic.h
@@ -0,0 +1,249 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2000, 07 MIPS Technologies, Inc.
7 */
8#ifndef __LINUX_IRQCHIP_MIPS_GIC_H
9#define __LINUX_IRQCHIP_MIPS_GIC_H
10
11#include <linux/clocksource.h>
12
13#define GIC_MAX_INTRS 256
14
15/* Constants */
16#define GIC_POL_POS 1
17#define GIC_POL_NEG 0
18#define GIC_TRIG_EDGE 1
19#define GIC_TRIG_LEVEL 0
20#define GIC_TRIG_DUAL_ENABLE 1
21#define GIC_TRIG_DUAL_DISABLE 0
22
23#define MSK(n) ((1 << (n)) - 1)
24
25/* Accessors */
26#define GIC_REG(segment, offset) (segment##_##SECTION_OFS + offset##_##OFS)
27
28/* GIC Address Space */
29#define SHARED_SECTION_OFS 0x0000
30#define SHARED_SECTION_SIZE 0x8000
31#define VPE_LOCAL_SECTION_OFS 0x8000
32#define VPE_LOCAL_SECTION_SIZE 0x4000
33#define VPE_OTHER_SECTION_OFS 0xc000
34#define VPE_OTHER_SECTION_SIZE 0x4000
35#define USM_VISIBLE_SECTION_OFS 0x10000
36#define USM_VISIBLE_SECTION_SIZE 0x10000
37
38/* Register Map for Shared Section */
39
40#define GIC_SH_CONFIG_OFS 0x0000
41
42/* Shared Global Counter */
43#define GIC_SH_COUNTER_31_00_OFS 0x0010
44#define GIC_SH_COUNTER_63_32_OFS 0x0014
45#define GIC_SH_REVISIONID_OFS 0x0020
46
47/* Convert an interrupt number to a byte offset/bit for multi-word registers */
48#define GIC_INTR_OFS(intr) (((intr) / 32) * 4)
49#define GIC_INTR_BIT(intr) ((intr) % 32)
50
51/* Polarity : Reset Value is always 0 */
52#define GIC_SH_SET_POLARITY_OFS 0x0100
53
54/* Triggering : Reset Value is always 0 */
55#define GIC_SH_SET_TRIGGER_OFS 0x0180
56
57/* Dual edge triggering : Reset Value is always 0 */
58#define GIC_SH_SET_DUAL_OFS 0x0200
59
60/* Set/Clear corresponding bit in Edge Detect Register */
61#define GIC_SH_WEDGE_OFS 0x0280
62
63/* Mask manipulation */
64#define GIC_SH_RMASK_OFS 0x0300
65#define GIC_SH_SMASK_OFS 0x0380
66
67/* Global Interrupt Mask Register (RO) - Bit Set == Interrupt enabled */
68#define GIC_SH_MASK_OFS 0x0400
69
70/* Pending Global Interrupts (RO) */
71#define GIC_SH_PEND_OFS 0x0480
72
73/* Maps Interrupt X to a Pin */
74#define GIC_SH_INTR_MAP_TO_PIN_BASE_OFS 0x0500
75#define GIC_SH_MAP_TO_PIN(intr) (4 * (intr))
76
77/* Maps Interrupt X to a VPE */
78#define GIC_SH_INTR_MAP_TO_VPE_BASE_OFS 0x2000
79#define GIC_SH_MAP_TO_VPE_REG_OFF(intr, vpe) \
80 ((32 * (intr)) + (((vpe) / 32) * 4))
81#define GIC_SH_MAP_TO_VPE_REG_BIT(vpe) (1 << ((vpe) % 32))
82
83/* Register Map for Local Section */
84#define GIC_VPE_CTL_OFS 0x0000
85#define GIC_VPE_PEND_OFS 0x0004
86#define GIC_VPE_MASK_OFS 0x0008
87#define GIC_VPE_RMASK_OFS 0x000c
88#define GIC_VPE_SMASK_OFS 0x0010
89#define GIC_VPE_WD_MAP_OFS 0x0040
90#define GIC_VPE_COMPARE_MAP_OFS 0x0044
91#define GIC_VPE_TIMER_MAP_OFS 0x0048
92#define GIC_VPE_FDC_MAP_OFS 0x004c
93#define GIC_VPE_PERFCTR_MAP_OFS 0x0050
94#define GIC_VPE_SWINT0_MAP_OFS 0x0054
95#define GIC_VPE_SWINT1_MAP_OFS 0x0058
96#define GIC_VPE_OTHER_ADDR_OFS 0x0080
97#define GIC_VPE_WD_CONFIG0_OFS 0x0090
98#define GIC_VPE_WD_COUNT0_OFS 0x0094
99#define GIC_VPE_WD_INITIAL0_OFS 0x0098
100#define GIC_VPE_COMPARE_LO_OFS 0x00a0
101#define GIC_VPE_COMPARE_HI_OFS 0x00a4
102
103#define GIC_VPE_EIC_SHADOW_SET_BASE_OFS 0x0100
104#define GIC_VPE_EIC_SS(intr) (4 * (intr))
105
106#define GIC_VPE_EIC_VEC_BASE_OFS 0x0800
107#define GIC_VPE_EIC_VEC(intr) (4 * (intr))
108
109#define GIC_VPE_TENABLE_NMI_OFS 0x1000
110#define GIC_VPE_TENABLE_YQ_OFS 0x1004
111#define GIC_VPE_TENABLE_INT_31_0_OFS 0x1080
112#define GIC_VPE_TENABLE_INT_63_32_OFS 0x1084
113
114/* User Mode Visible Section Register Map */
115#define GIC_UMV_SH_COUNTER_31_00_OFS 0x0000
116#define GIC_UMV_SH_COUNTER_63_32_OFS 0x0004
117
118/* Masks */
119#define GIC_SH_CONFIG_COUNTSTOP_SHF 28
120#define GIC_SH_CONFIG_COUNTSTOP_MSK (MSK(1) << GIC_SH_CONFIG_COUNTSTOP_SHF)
121
122#define GIC_SH_CONFIG_COUNTBITS_SHF 24
123#define GIC_SH_CONFIG_COUNTBITS_MSK (MSK(4) << GIC_SH_CONFIG_COUNTBITS_SHF)
124
125#define GIC_SH_CONFIG_NUMINTRS_SHF 16
126#define GIC_SH_CONFIG_NUMINTRS_MSK (MSK(8) << GIC_SH_CONFIG_NUMINTRS_SHF)
127
128#define GIC_SH_CONFIG_NUMVPES_SHF 0
129#define GIC_SH_CONFIG_NUMVPES_MSK (MSK(8) << GIC_SH_CONFIG_NUMVPES_SHF)
130
131#define GIC_SH_WEDGE_SET(intr) ((intr) | (0x1 << 31))
132#define GIC_SH_WEDGE_CLR(intr) ((intr) & ~(0x1 << 31))
133
134#define GIC_MAP_TO_PIN_SHF 31
135#define GIC_MAP_TO_PIN_MSK (MSK(1) << GIC_MAP_TO_PIN_SHF)
136#define GIC_MAP_TO_NMI_SHF 30
137#define GIC_MAP_TO_NMI_MSK (MSK(1) << GIC_MAP_TO_NMI_SHF)
138#define GIC_MAP_TO_YQ_SHF 29
139#define GIC_MAP_TO_YQ_MSK (MSK(1) << GIC_MAP_TO_YQ_SHF)
140#define GIC_MAP_SHF 0
141#define GIC_MAP_MSK (MSK(6) << GIC_MAP_SHF)
142
143/* GIC_VPE_CTL Masks */
144#define GIC_VPE_CTL_FDC_RTBL_SHF 4
145#define GIC_VPE_CTL_FDC_RTBL_MSK (MSK(1) << GIC_VPE_CTL_FDC_RTBL_SHF)
146#define GIC_VPE_CTL_SWINT_RTBL_SHF 3
147#define GIC_VPE_CTL_SWINT_RTBL_MSK (MSK(1) << GIC_VPE_CTL_SWINT_RTBL_SHF)
148#define GIC_VPE_CTL_PERFCNT_RTBL_SHF 2
149#define GIC_VPE_CTL_PERFCNT_RTBL_MSK (MSK(1) << GIC_VPE_CTL_PERFCNT_RTBL_SHF)
150#define GIC_VPE_CTL_TIMER_RTBL_SHF 1
151#define GIC_VPE_CTL_TIMER_RTBL_MSK (MSK(1) << GIC_VPE_CTL_TIMER_RTBL_SHF)
152#define GIC_VPE_CTL_EIC_MODE_SHF 0
153#define GIC_VPE_CTL_EIC_MODE_MSK (MSK(1) << GIC_VPE_CTL_EIC_MODE_SHF)
154
155/* GIC_VPE_PEND Masks */
156#define GIC_VPE_PEND_WD_SHF 0
157#define GIC_VPE_PEND_WD_MSK (MSK(1) << GIC_VPE_PEND_WD_SHF)
158#define GIC_VPE_PEND_CMP_SHF 1
159#define GIC_VPE_PEND_CMP_MSK (MSK(1) << GIC_VPE_PEND_CMP_SHF)
160#define GIC_VPE_PEND_TIMER_SHF 2
161#define GIC_VPE_PEND_TIMER_MSK (MSK(1) << GIC_VPE_PEND_TIMER_SHF)
162#define GIC_VPE_PEND_PERFCOUNT_SHF 3
163#define GIC_VPE_PEND_PERFCOUNT_MSK (MSK(1) << GIC_VPE_PEND_PERFCOUNT_SHF)
164#define GIC_VPE_PEND_SWINT0_SHF 4
165#define GIC_VPE_PEND_SWINT0_MSK (MSK(1) << GIC_VPE_PEND_SWINT0_SHF)
166#define GIC_VPE_PEND_SWINT1_SHF 5
167#define GIC_VPE_PEND_SWINT1_MSK (MSK(1) << GIC_VPE_PEND_SWINT1_SHF)
168
169/* GIC_VPE_RMASK Masks */
170#define GIC_VPE_RMASK_WD_SHF 0
171#define GIC_VPE_RMASK_WD_MSK (MSK(1) << GIC_VPE_RMASK_WD_SHF)
172#define GIC_VPE_RMASK_CMP_SHF 1
173#define GIC_VPE_RMASK_CMP_MSK (MSK(1) << GIC_VPE_RMASK_CMP_SHF)
174#define GIC_VPE_RMASK_TIMER_SHF 2
175#define GIC_VPE_RMASK_TIMER_MSK (MSK(1) << GIC_VPE_RMASK_TIMER_SHF)
176#define GIC_VPE_RMASK_PERFCNT_SHF 3
177#define GIC_VPE_RMASK_PERFCNT_MSK (MSK(1) << GIC_VPE_RMASK_PERFCNT_SHF)
178#define GIC_VPE_RMASK_SWINT0_SHF 4
179#define GIC_VPE_RMASK_SWINT0_MSK (MSK(1) << GIC_VPE_RMASK_SWINT0_SHF)
180#define GIC_VPE_RMASK_SWINT1_SHF 5
181#define GIC_VPE_RMASK_SWINT1_MSK (MSK(1) << GIC_VPE_RMASK_SWINT1_SHF)
182
183/* GIC_VPE_SMASK Masks */
184#define GIC_VPE_SMASK_WD_SHF 0
185#define GIC_VPE_SMASK_WD_MSK (MSK(1) << GIC_VPE_SMASK_WD_SHF)
186#define GIC_VPE_SMASK_CMP_SHF 1
187#define GIC_VPE_SMASK_CMP_MSK (MSK(1) << GIC_VPE_SMASK_CMP_SHF)
188#define GIC_VPE_SMASK_TIMER_SHF 2
189#define GIC_VPE_SMASK_TIMER_MSK (MSK(1) << GIC_VPE_SMASK_TIMER_SHF)
190#define GIC_VPE_SMASK_PERFCNT_SHF 3
191#define GIC_VPE_SMASK_PERFCNT_MSK (MSK(1) << GIC_VPE_SMASK_PERFCNT_SHF)
192#define GIC_VPE_SMASK_SWINT0_SHF 4
193#define GIC_VPE_SMASK_SWINT0_MSK (MSK(1) << GIC_VPE_SMASK_SWINT0_SHF)
194#define GIC_VPE_SMASK_SWINT1_SHF 5
195#define GIC_VPE_SMASK_SWINT1_MSK (MSK(1) << GIC_VPE_SMASK_SWINT1_SHF)
196
197/* GIC nomenclature for Core Interrupt Pins. */
198#define GIC_CPU_INT0 0 /* Core Interrupt 2 */
199#define GIC_CPU_INT1 1 /* . */
200#define GIC_CPU_INT2 2 /* . */
201#define GIC_CPU_INT3 3 /* . */
202#define GIC_CPU_INT4 4 /* . */
203#define GIC_CPU_INT5 5 /* Core Interrupt 7 */
204
205/* Add 2 to convert GIC CPU pin to core interrupt */
206#define GIC_CPU_PIN_OFFSET 2
207
208/* Add 2 to convert non-EIC hardware interrupt to EIC vector number. */
209#define GIC_CPU_TO_VEC_OFFSET 2
210
211/* Mapped interrupt to pin X, then GIC will generate the vector (X+1). */
212#define GIC_PIN_TO_VEC_OFFSET 1
213
214/* Local GIC interrupts. */
215#define GIC_LOCAL_INT_WD 0 /* GIC watchdog */
216#define GIC_LOCAL_INT_COMPARE 1 /* GIC count and compare timer */
217#define GIC_LOCAL_INT_TIMER 2 /* CPU timer interrupt */
218#define GIC_LOCAL_INT_PERFCTR 3 /* CPU performance counter */
219#define GIC_LOCAL_INT_SWINT0 4 /* CPU software interrupt 0 */
220#define GIC_LOCAL_INT_SWINT1 5 /* CPU software interrupt 1 */
221#define GIC_LOCAL_INT_FDC 6 /* CPU fast debug channel */
222#define GIC_NUM_LOCAL_INTRS 7
223
224/* Convert between local/shared IRQ number and GIC HW IRQ number. */
225#define GIC_LOCAL_HWIRQ_BASE 0
226#define GIC_LOCAL_TO_HWIRQ(x) (GIC_LOCAL_HWIRQ_BASE + (x))
227#define GIC_HWIRQ_TO_LOCAL(x) ((x) - GIC_LOCAL_HWIRQ_BASE)
228#define GIC_SHARED_HWIRQ_BASE GIC_NUM_LOCAL_INTRS
229#define GIC_SHARED_TO_HWIRQ(x) (GIC_SHARED_HWIRQ_BASE + (x))
230#define GIC_HWIRQ_TO_SHARED(x) ((x) - GIC_SHARED_HWIRQ_BASE)
231
232extern unsigned int gic_present;
233
234extern void gic_init(unsigned long gic_base_addr,
235 unsigned long gic_addrspace_size, unsigned int cpu_vec,
236 unsigned int irqbase);
237extern void gic_clocksource_init(unsigned int);
238extern cycle_t gic_read_count(void);
239extern unsigned int gic_get_count_width(void);
240extern cycle_t gic_read_compare(void);
241extern void gic_write_compare(cycle_t cnt);
242extern void gic_write_cpu_compare(cycle_t cnt, int cpu);
243extern void gic_send_ipi(unsigned int intr);
244extern unsigned int plat_ipi_call_int_xlate(unsigned int);
245extern unsigned int plat_ipi_resched_int_xlate(unsigned int);
246extern unsigned int gic_get_timer_pending(void);
247extern int gic_get_c0_compare_int(void);
248extern int gic_get_c0_perfcount_int(void);
249#endif /* __LINUX_IRQCHIP_MIPS_GIC_H */
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index b0f9d16e48f6..676d7306a360 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -33,11 +33,14 @@
33#define _LINUX_IRQDOMAIN_H 33#define _LINUX_IRQDOMAIN_H
34 34
35#include <linux/types.h> 35#include <linux/types.h>
36#include <linux/irqhandler.h>
36#include <linux/radix-tree.h> 37#include <linux/radix-tree.h>
37 38
38struct device_node; 39struct device_node;
39struct irq_domain; 40struct irq_domain;
40struct of_device_id; 41struct of_device_id;
42struct irq_chip;
43struct irq_data;
41 44
42/* Number of irqs reserved for a legacy isa controller */ 45/* Number of irqs reserved for a legacy isa controller */
43#define NUM_ISA_INTERRUPTS 16 46#define NUM_ISA_INTERRUPTS 16
@@ -64,6 +67,16 @@ struct irq_domain_ops {
64 int (*xlate)(struct irq_domain *d, struct device_node *node, 67 int (*xlate)(struct irq_domain *d, struct device_node *node,
65 const u32 *intspec, unsigned int intsize, 68 const u32 *intspec, unsigned int intsize,
66 unsigned long *out_hwirq, unsigned int *out_type); 69 unsigned long *out_hwirq, unsigned int *out_type);
70
71#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
72 /* extended V2 interfaces to support hierarchy irq_domains */
73 int (*alloc)(struct irq_domain *d, unsigned int virq,
74 unsigned int nr_irqs, void *arg);
75 void (*free)(struct irq_domain *d, unsigned int virq,
76 unsigned int nr_irqs);
77 void (*activate)(struct irq_domain *d, struct irq_data *irq_data);
78 void (*deactivate)(struct irq_domain *d, struct irq_data *irq_data);
79#endif
67}; 80};
68 81
69extern struct irq_domain_ops irq_generic_chip_ops; 82extern struct irq_domain_ops irq_generic_chip_ops;
@@ -77,6 +90,7 @@ struct irq_domain_chip_generic;
77 * @ops: pointer to irq_domain methods 90 * @ops: pointer to irq_domain methods
78 * @host_data: private data pointer for use by owner. Not touched by irq_domain 91 * @host_data: private data pointer for use by owner. Not touched by irq_domain
79 * core code. 92 * core code.
93 * @flags: host per irq_domain flags
80 * 94 *
81 * Optional elements 95 * Optional elements
82 * @of_node: Pointer to device tree nodes associated with the irq_domain. Used 96 * @of_node: Pointer to device tree nodes associated with the irq_domain. Used
@@ -84,6 +98,7 @@ struct irq_domain_chip_generic;
84 * @gc: Pointer to a list of generic chips. There is a helper function for 98 * @gc: Pointer to a list of generic chips. There is a helper function for
85 * setting up one or more generic chips for interrupt controllers 99 * setting up one or more generic chips for interrupt controllers
86 * drivers using the generic chip library which uses this pointer. 100 * drivers using the generic chip library which uses this pointer.
101 * @parent: Pointer to parent irq_domain to support hierarchy irq_domains
87 * 102 *
88 * Revmap data, used internally by irq_domain 103 * Revmap data, used internally by irq_domain
89 * @revmap_direct_max_irq: The largest hwirq that can be set for controllers that 104 * @revmap_direct_max_irq: The largest hwirq that can be set for controllers that
@@ -97,10 +112,14 @@ struct irq_domain {
97 const char *name; 112 const char *name;
98 const struct irq_domain_ops *ops; 113 const struct irq_domain_ops *ops;
99 void *host_data; 114 void *host_data;
115 unsigned int flags;
100 116
101 /* Optional data */ 117 /* Optional data */
102 struct device_node *of_node; 118 struct device_node *of_node;
103 struct irq_domain_chip_generic *gc; 119 struct irq_domain_chip_generic *gc;
120#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
121 struct irq_domain *parent;
122#endif
104 123
105 /* reverse map data. The linear map gets appended to the irq_domain */ 124 /* reverse map data. The linear map gets appended to the irq_domain */
106 irq_hw_number_t hwirq_max; 125 irq_hw_number_t hwirq_max;
@@ -110,6 +129,22 @@ struct irq_domain {
110 unsigned int linear_revmap[]; 129 unsigned int linear_revmap[];
111}; 130};
112 131
132/* Irq domain flags */
133enum {
134 /* Irq domain is hierarchical */
135 IRQ_DOMAIN_FLAG_HIERARCHY = (1 << 0),
136
137 /* Core calls alloc/free recursive through the domain hierarchy. */
138 IRQ_DOMAIN_FLAG_AUTO_RECURSIVE = (1 << 1),
139
140 /*
141 * Flags starting from IRQ_DOMAIN_FLAG_NONCORE are reserved
142 * for implementation specific purposes and ignored by the
143 * core code.
144 */
145 IRQ_DOMAIN_FLAG_NONCORE = (1 << 16),
146};
147
113#ifdef CONFIG_IRQ_DOMAIN 148#ifdef CONFIG_IRQ_DOMAIN
114struct irq_domain *__irq_domain_add(struct device_node *of_node, int size, 149struct irq_domain *__irq_domain_add(struct device_node *of_node, int size,
115 irq_hw_number_t hwirq_max, int direct_max, 150 irq_hw_number_t hwirq_max, int direct_max,
@@ -220,8 +255,74 @@ int irq_domain_xlate_onetwocell(struct irq_domain *d, struct device_node *ctrlr,
220 const u32 *intspec, unsigned int intsize, 255 const u32 *intspec, unsigned int intsize,
221 irq_hw_number_t *out_hwirq, unsigned int *out_type); 256 irq_hw_number_t *out_hwirq, unsigned int *out_type);
222 257
258/* V2 interfaces to support hierarchy IRQ domains. */
259extern struct irq_data *irq_domain_get_irq_data(struct irq_domain *domain,
260 unsigned int virq);
261#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
262extern struct irq_domain *irq_domain_add_hierarchy(struct irq_domain *parent,
263 unsigned int flags, unsigned int size,
264 struct device_node *node,
265 const struct irq_domain_ops *ops, void *host_data);
266extern int __irq_domain_alloc_irqs(struct irq_domain *domain, int irq_base,
267 unsigned int nr_irqs, int node, void *arg,
268 bool realloc);
269extern void irq_domain_free_irqs(unsigned int virq, unsigned int nr_irqs);
270extern void irq_domain_activate_irq(struct irq_data *irq_data);
271extern void irq_domain_deactivate_irq(struct irq_data *irq_data);
272
273static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
274 unsigned int nr_irqs, int node, void *arg)
275{
276 return __irq_domain_alloc_irqs(domain, -1, nr_irqs, node, arg, false);
277}
278
279extern int irq_domain_set_hwirq_and_chip(struct irq_domain *domain,
280 unsigned int virq,
281 irq_hw_number_t hwirq,
282 struct irq_chip *chip,
283 void *chip_data);
284extern void irq_domain_set_info(struct irq_domain *domain, unsigned int virq,
285 irq_hw_number_t hwirq, struct irq_chip *chip,
286 void *chip_data, irq_flow_handler_t handler,
287 void *handler_data, const char *handler_name);
288extern void irq_domain_reset_irq_data(struct irq_data *irq_data);
289extern void irq_domain_free_irqs_common(struct irq_domain *domain,
290 unsigned int virq,
291 unsigned int nr_irqs);
292extern void irq_domain_free_irqs_top(struct irq_domain *domain,
293 unsigned int virq, unsigned int nr_irqs);
294
295extern int irq_domain_alloc_irqs_parent(struct irq_domain *domain,
296 unsigned int irq_base,
297 unsigned int nr_irqs, void *arg);
298
299extern void irq_domain_free_irqs_parent(struct irq_domain *domain,
300 unsigned int irq_base,
301 unsigned int nr_irqs);
302
303static inline bool irq_domain_is_hierarchy(struct irq_domain *domain)
304{
305 return domain->flags & IRQ_DOMAIN_FLAG_HIERARCHY;
306}
307#else /* CONFIG_IRQ_DOMAIN_HIERARCHY */
308static inline void irq_domain_activate_irq(struct irq_data *data) { }
309static inline void irq_domain_deactivate_irq(struct irq_data *data) { }
310static inline int irq_domain_alloc_irqs(struct irq_domain *domain,
311 unsigned int nr_irqs, int node, void *arg)
312{
313 return -1;
314}
315
316static inline bool irq_domain_is_hierarchy(struct irq_domain *domain)
317{
318 return false;
319}
320#endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */
321
223#else /* CONFIG_IRQ_DOMAIN */ 322#else /* CONFIG_IRQ_DOMAIN */
224static inline void irq_dispose_mapping(unsigned int virq) { } 323static inline void irq_dispose_mapping(unsigned int virq) { }
324static inline void irq_domain_activate_irq(struct irq_data *data) { }
325static inline void irq_domain_deactivate_irq(struct irq_data *data) { }
225#endif /* !CONFIG_IRQ_DOMAIN */ 326#endif /* !CONFIG_IRQ_DOMAIN */
226 327
227#endif /* _LINUX_IRQDOMAIN_H */ 328#endif /* _LINUX_IRQDOMAIN_H */
diff --git a/include/linux/irqhandler.h b/include/linux/irqhandler.h
new file mode 100644
index 000000000000..62d543004197
--- /dev/null
+++ b/include/linux/irqhandler.h
@@ -0,0 +1,14 @@
1#ifndef _LINUX_IRQHANDLER_H
2#define _LINUX_IRQHANDLER_H
3
4/*
5 * Interrupt flow handler typedefs are defined here to avoid circular
6 * include dependencies.
7 */
8
9struct irq_desc;
10struct irq_data;
11typedef void (*irq_flow_handler_t)(unsigned int irq, struct irq_desc *desc);
12typedef void (*irq_preflow_handler_t)(struct irq_data *data);
13
14#endif
diff --git a/include/linux/kern_levels.h b/include/linux/kern_levels.h
index 866caaa9e2bb..c2ce155d83cc 100644
--- a/include/linux/kern_levels.h
+++ b/include/linux/kern_levels.h
@@ -22,4 +22,17 @@
22 */ 22 */
23#define KERN_CONT "" 23#define KERN_CONT ""
24 24
25/* integer equivalents of KERN_<LEVEL> */
26#define LOGLEVEL_SCHED -2 /* Deferred messages from sched code
27 * are set to this special level */
28#define LOGLEVEL_DEFAULT -1 /* default (or last) loglevel */
29#define LOGLEVEL_EMERG 0 /* system is unusable */
30#define LOGLEVEL_ALERT 1 /* action must be taken immediately */
31#define LOGLEVEL_CRIT 2 /* critical conditions */
32#define LOGLEVEL_ERR 3 /* error conditions */
33#define LOGLEVEL_WARNING 4 /* warning conditions */
34#define LOGLEVEL_NOTICE 5 /* normal but significant condition */
35#define LOGLEVEL_INFO 6 /* informational */
36#define LOGLEVEL_DEBUG 7 /* debug-level messages */
37
25#endif 38#endif
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 3d770f5564b8..5449d2f4a1ef 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -162,6 +162,7 @@ extern int _cond_resched(void);
162#endif 162#endif
163 163
164#ifdef CONFIG_DEBUG_ATOMIC_SLEEP 164#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
165 void ___might_sleep(const char *file, int line, int preempt_offset);
165 void __might_sleep(const char *file, int line, int preempt_offset); 166 void __might_sleep(const char *file, int line, int preempt_offset);
166/** 167/**
167 * might_sleep - annotation for functions that can sleep 168 * might_sleep - annotation for functions that can sleep
@@ -175,10 +176,14 @@ extern int _cond_resched(void);
175 */ 176 */
176# define might_sleep() \ 177# define might_sleep() \
177 do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0) 178 do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0)
179# define sched_annotate_sleep() __set_current_state(TASK_RUNNING)
178#else 180#else
181 static inline void ___might_sleep(const char *file, int line,
182 int preempt_offset) { }
179 static inline void __might_sleep(const char *file, int line, 183 static inline void __might_sleep(const char *file, int line,
180 int preempt_offset) { } 184 int preempt_offset) { }
181# define might_sleep() do { might_resched(); } while (0) 185# define might_sleep() do { might_resched(); } while (0)
186# define sched_annotate_sleep() do { } while (0)
182#endif 187#endif
183 188
184#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) 189#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
@@ -411,9 +416,6 @@ extern int __kernel_text_address(unsigned long addr);
411extern int kernel_text_address(unsigned long addr); 416extern int kernel_text_address(unsigned long addr);
412extern int func_ptr_is_kernel_text(void *ptr); 417extern int func_ptr_is_kernel_text(void *ptr);
413 418
414struct pid;
415extern struct pid *session_of_pgrp(struct pid *pgrp);
416
417unsigned long int_sqrt(unsigned long); 419unsigned long int_sqrt(unsigned long);
418 420
419extern void bust_spinlocks(int yes); 421extern void bust_spinlocks(int yes);
@@ -422,6 +424,7 @@ extern int panic_timeout;
422extern int panic_on_oops; 424extern int panic_on_oops;
423extern int panic_on_unrecovered_nmi; 425extern int panic_on_unrecovered_nmi;
424extern int panic_on_io_nmi; 426extern int panic_on_io_nmi;
427extern int panic_on_warn;
425extern int sysctl_panic_on_stackoverflow; 428extern int sysctl_panic_on_stackoverflow;
426/* 429/*
427 * Only to be used by arch init code. If the user over-wrote the default 430 * Only to be used by arch init code. If the user over-wrote the default
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index 30faf797c2c3..d4e01b358341 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -179,6 +179,7 @@ struct kernfs_open_file {
179 struct mutex mutex; 179 struct mutex mutex;
180 int event; 180 int event;
181 struct list_head list; 181 struct list_head list;
182 char *prealloc_buf;
182 183
183 size_t atomic_write_len; 184 size_t atomic_write_len;
184 bool mmapped; 185 bool mmapped;
@@ -214,6 +215,13 @@ struct kernfs_ops {
214 * larger ones are rejected with -E2BIG. 215 * larger ones are rejected with -E2BIG.
215 */ 216 */
216 size_t atomic_write_len; 217 size_t atomic_write_len;
218 /*
219 * "prealloc" causes a buffer to be allocated at open for
220 * all read/write requests. As ->seq_show uses seq_read()
221 * which does its own allocation, it is incompatible with
222 * ->prealloc. Provide ->read and ->write with ->prealloc.
223 */
224 bool prealloc;
217 ssize_t (*write)(struct kernfs_open_file *of, char *buf, size_t bytes, 225 ssize_t (*write)(struct kernfs_open_file *of, char *buf, size_t bytes,
218 loff_t off); 226 loff_t off);
219 227
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h
index 057e95971014..e705467ddb47 100644
--- a/include/linux/kmemleak.h
+++ b/include/linux/kmemleak.h
@@ -21,6 +21,8 @@
21#ifndef __KMEMLEAK_H 21#ifndef __KMEMLEAK_H
22#define __KMEMLEAK_H 22#define __KMEMLEAK_H
23 23
24#include <linux/slab.h>
25
24#ifdef CONFIG_DEBUG_KMEMLEAK 26#ifdef CONFIG_DEBUG_KMEMLEAK
25 27
26extern void kmemleak_init(void) __ref; 28extern void kmemleak_init(void) __ref;
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index f7296e57d614..5297f9fa0ef2 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -335,6 +335,7 @@ extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
335extern int arch_prepare_kprobe_ftrace(struct kprobe *p); 335extern int arch_prepare_kprobe_ftrace(struct kprobe *p);
336#endif 336#endif
337 337
338int arch_check_ftrace_location(struct kprobe *p);
338 339
339/* Get the kprobe at this addr (if any) - called with preemption disabled */ 340/* Get the kprobe at this addr (if any) - called with preemption disabled */
340struct kprobe *get_kprobe(void *addr); 341struct kprobe *get_kprobe(void *addr);
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ea53b04993f2..a6059bdf7b03 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -703,7 +703,7 @@ void kvm_arch_sync_events(struct kvm *kvm);
703int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); 703int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu);
704void kvm_vcpu_kick(struct kvm_vcpu *vcpu); 704void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
705 705
706bool kvm_is_mmio_pfn(pfn_t pfn); 706bool kvm_is_reserved_pfn(pfn_t pfn);
707 707
708struct kvm_irq_ack_notifier { 708struct kvm_irq_ack_notifier {
709 struct hlist_node link; 709 struct hlist_node link;
diff --git a/include/linux/leds.h b/include/linux/leds.h
index a57611d0c94e..cfceef32c9b3 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -13,6 +13,7 @@
13#define __LINUX_LEDS_H_INCLUDED 13#define __LINUX_LEDS_H_INCLUDED
14 14
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/mutex.h>
16#include <linux/rwsem.h> 17#include <linux/rwsem.h>
17#include <linux/spinlock.h> 18#include <linux/spinlock.h>
18#include <linux/timer.h> 19#include <linux/timer.h>
@@ -42,11 +43,20 @@ struct led_classdev {
42#define LED_BLINK_ONESHOT (1 << 17) 43#define LED_BLINK_ONESHOT (1 << 17)
43#define LED_BLINK_ONESHOT_STOP (1 << 18) 44#define LED_BLINK_ONESHOT_STOP (1 << 18)
44#define LED_BLINK_INVERT (1 << 19) 45#define LED_BLINK_INVERT (1 << 19)
46#define LED_SYSFS_DISABLE (1 << 20)
47#define SET_BRIGHTNESS_ASYNC (1 << 21)
48#define SET_BRIGHTNESS_SYNC (1 << 22)
45 49
46 /* Set LED brightness level */ 50 /* Set LED brightness level */
47 /* Must not sleep, use a workqueue if needed */ 51 /* Must not sleep, use a workqueue if needed */
48 void (*brightness_set)(struct led_classdev *led_cdev, 52 void (*brightness_set)(struct led_classdev *led_cdev,
49 enum led_brightness brightness); 53 enum led_brightness brightness);
54 /*
55 * Set LED brightness level immediately - it can block the caller for
56 * the time required for accessing a LED device register.
57 */
58 int (*brightness_set_sync)(struct led_classdev *led_cdev,
59 enum led_brightness brightness);
50 /* Get LED brightness level */ 60 /* Get LED brightness level */
51 enum led_brightness (*brightness_get)(struct led_classdev *led_cdev); 61 enum led_brightness (*brightness_get)(struct led_classdev *led_cdev);
52 62
@@ -85,6 +95,9 @@ struct led_classdev {
85 /* true if activated - deactivate routine uses it to do cleanup */ 95 /* true if activated - deactivate routine uses it to do cleanup */
86 bool activated; 96 bool activated;
87#endif 97#endif
98
99 /* Ensures consistent access to the LED Flash Class device */
100 struct mutex led_access;
88}; 101};
89 102
90extern int led_classdev_register(struct device *parent, 103extern int led_classdev_register(struct device *parent,
@@ -151,6 +164,33 @@ extern void led_set_brightness(struct led_classdev *led_cdev,
151 */ 164 */
152extern int led_update_brightness(struct led_classdev *led_cdev); 165extern int led_update_brightness(struct led_classdev *led_cdev);
153 166
167/**
168 * led_sysfs_disable - disable LED sysfs interface
169 * @led_cdev: the LED to set
170 *
171 * Disable the led_cdev's sysfs interface.
172 */
173extern void led_sysfs_disable(struct led_classdev *led_cdev);
174
175/**
176 * led_sysfs_enable - enable LED sysfs interface
177 * @led_cdev: the LED to set
178 *
179 * Enable the led_cdev's sysfs interface.
180 */
181extern void led_sysfs_enable(struct led_classdev *led_cdev);
182
183/**
184 * led_sysfs_is_disabled - check if LED sysfs interface is disabled
185 * @led_cdev: the LED to query
186 *
187 * Returns: true if the led_cdev's sysfs interface is disabled.
188 */
189static inline bool led_sysfs_is_disabled(struct led_classdev *led_cdev)
190{
191 return led_cdev->flags & LED_SYSFS_DISABLE;
192}
193
154/* 194/*
155 * LED Triggers 195 * LED Triggers
156 */ 196 */
@@ -261,6 +301,7 @@ struct gpio_led {
261 unsigned retain_state_suspended : 1; 301 unsigned retain_state_suspended : 1;
262 unsigned default_state : 2; 302 unsigned default_state : 2;
263 /* default_state should be one of LEDS_GPIO_DEFSTATE_(ON|OFF|KEEP) */ 303 /* default_state should be one of LEDS_GPIO_DEFSTATE_(ON|OFF|KEEP) */
304 struct gpio_desc *gpiod;
264}; 305};
265#define LEDS_GPIO_DEFSTATE_OFF 0 306#define LEDS_GPIO_DEFSTATE_OFF 0
266#define LEDS_GPIO_DEFSTATE_ON 1 307#define LEDS_GPIO_DEFSTATE_ON 1
@@ -273,7 +314,7 @@ struct gpio_led_platform_data {
273#define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */ 314#define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */
274#define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */ 315#define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */
275#define GPIO_LED_BLINK 2 /* Please, blink */ 316#define GPIO_LED_BLINK 2 /* Please, blink */
276 int (*gpio_blink_set)(unsigned gpio, int state, 317 int (*gpio_blink_set)(struct gpio_desc *desc, int state,
277 unsigned long *delay_on, 318 unsigned long *delay_on,
278 unsigned long *delay_off); 319 unsigned long *delay_off);
279}; 320};
diff --git a/include/linux/libata.h b/include/linux/libata.h
index bd5fefeaf548..2d182413b1db 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -191,7 +191,8 @@ enum {
191 ATA_DEV_PMP_UNSUP = 6, /* SATA port multiplier (unsupported) */ 191 ATA_DEV_PMP_UNSUP = 6, /* SATA port multiplier (unsupported) */
192 ATA_DEV_SEMB = 7, /* SEMB */ 192 ATA_DEV_SEMB = 7, /* SEMB */
193 ATA_DEV_SEMB_UNSUP = 8, /* SEMB (unsupported) */ 193 ATA_DEV_SEMB_UNSUP = 8, /* SEMB (unsupported) */
194 ATA_DEV_NONE = 9, /* no device */ 194 ATA_DEV_ZAC = 9, /* ZAC device */
195 ATA_DEV_NONE = 10, /* no device */
195 196
196 /* struct ata_link flags */ 197 /* struct ata_link flags */
197 ATA_LFLAG_NO_HRST = (1 << 1), /* avoid hardreset */ 198 ATA_LFLAG_NO_HRST = (1 << 1), /* avoid hardreset */
@@ -1191,9 +1192,9 @@ extern void ata_scsi_unlock_native_capacity(struct scsi_device *sdev);
1191extern int ata_scsi_slave_config(struct scsi_device *sdev); 1192extern int ata_scsi_slave_config(struct scsi_device *sdev);
1192extern void ata_scsi_slave_destroy(struct scsi_device *sdev); 1193extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
1193extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, 1194extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
1194 int queue_depth, int reason); 1195 int queue_depth);
1195extern int __ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev, 1196extern int __ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev,
1196 int queue_depth, int reason); 1197 int queue_depth);
1197extern struct ata_device *ata_dev_pair(struct ata_device *adev); 1198extern struct ata_device *ata_dev_pair(struct ata_device *adev);
1198extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); 1199extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
1199extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap); 1200extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap);
@@ -1491,7 +1492,8 @@ static inline unsigned int ata_tag_internal(unsigned int tag)
1491static inline unsigned int ata_class_enabled(unsigned int class) 1492static inline unsigned int ata_class_enabled(unsigned int class)
1492{ 1493{
1493 return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI || 1494 return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI ||
1494 class == ATA_DEV_PMP || class == ATA_DEV_SEMB; 1495 class == ATA_DEV_PMP || class == ATA_DEV_SEMB ||
1496 class == ATA_DEV_ZAC;
1495} 1497}
1496 1498
1497static inline unsigned int ata_class_disabled(unsigned int class) 1499static inline unsigned int ata_class_disabled(unsigned int class)
diff --git a/include/linux/list.h b/include/linux/list.h
index f33f831eb3c8..feb773c76ee0 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -346,7 +346,7 @@ static inline void list_splice_tail_init(struct list_head *list,
346 * list_entry - get the struct for this entry 346 * list_entry - get the struct for this entry
347 * @ptr: the &struct list_head pointer. 347 * @ptr: the &struct list_head pointer.
348 * @type: the type of the struct this is embedded in. 348 * @type: the type of the struct this is embedded in.
349 * @member: the name of the list_struct within the struct. 349 * @member: the name of the list_head within the struct.
350 */ 350 */
351#define list_entry(ptr, type, member) \ 351#define list_entry(ptr, type, member) \
352 container_of(ptr, type, member) 352 container_of(ptr, type, member)
@@ -355,7 +355,7 @@ static inline void list_splice_tail_init(struct list_head *list,
355 * list_first_entry - get the first element from a list 355 * list_first_entry - get the first element from a list
356 * @ptr: the list head to take the element from. 356 * @ptr: the list head to take the element from.
357 * @type: the type of the struct this is embedded in. 357 * @type: the type of the struct this is embedded in.
358 * @member: the name of the list_struct within the struct. 358 * @member: the name of the list_head within the struct.
359 * 359 *
360 * Note, that list is expected to be not empty. 360 * Note, that list is expected to be not empty.
361 */ 361 */
@@ -366,7 +366,7 @@ static inline void list_splice_tail_init(struct list_head *list,
366 * list_last_entry - get the last element from a list 366 * list_last_entry - get the last element from a list
367 * @ptr: the list head to take the element from. 367 * @ptr: the list head to take the element from.
368 * @type: the type of the struct this is embedded in. 368 * @type: the type of the struct this is embedded in.
369 * @member: the name of the list_struct within the struct. 369 * @member: the name of the list_head within the struct.
370 * 370 *
371 * Note, that list is expected to be not empty. 371 * Note, that list is expected to be not empty.
372 */ 372 */
@@ -377,7 +377,7 @@ static inline void list_splice_tail_init(struct list_head *list,
377 * list_first_entry_or_null - get the first element from a list 377 * list_first_entry_or_null - get the first element from a list
378 * @ptr: the list head to take the element from. 378 * @ptr: the list head to take the element from.
379 * @type: the type of the struct this is embedded in. 379 * @type: the type of the struct this is embedded in.
380 * @member: the name of the list_struct within the struct. 380 * @member: the name of the list_head within the struct.
381 * 381 *
382 * Note that if the list is empty, it returns NULL. 382 * Note that if the list is empty, it returns NULL.
383 */ 383 */
@@ -387,7 +387,7 @@ static inline void list_splice_tail_init(struct list_head *list,
387/** 387/**
388 * list_next_entry - get the next element in list 388 * list_next_entry - get the next element in list
389 * @pos: the type * to cursor 389 * @pos: the type * to cursor
390 * @member: the name of the list_struct within the struct. 390 * @member: the name of the list_head within the struct.
391 */ 391 */
392#define list_next_entry(pos, member) \ 392#define list_next_entry(pos, member) \
393 list_entry((pos)->member.next, typeof(*(pos)), member) 393 list_entry((pos)->member.next, typeof(*(pos)), member)
@@ -395,7 +395,7 @@ static inline void list_splice_tail_init(struct list_head *list,
395/** 395/**
396 * list_prev_entry - get the prev element in list 396 * list_prev_entry - get the prev element in list
397 * @pos: the type * to cursor 397 * @pos: the type * to cursor
398 * @member: the name of the list_struct within the struct. 398 * @member: the name of the list_head within the struct.
399 */ 399 */
400#define list_prev_entry(pos, member) \ 400#define list_prev_entry(pos, member) \
401 list_entry((pos)->member.prev, typeof(*(pos)), member) 401 list_entry((pos)->member.prev, typeof(*(pos)), member)
@@ -441,7 +441,7 @@ static inline void list_splice_tail_init(struct list_head *list,
441 * list_for_each_entry - iterate over list of given type 441 * list_for_each_entry - iterate over list of given type
442 * @pos: the type * to use as a loop cursor. 442 * @pos: the type * to use as a loop cursor.
443 * @head: the head for your list. 443 * @head: the head for your list.
444 * @member: the name of the list_struct within the struct. 444 * @member: the name of the list_head within the struct.
445 */ 445 */
446#define list_for_each_entry(pos, head, member) \ 446#define list_for_each_entry(pos, head, member) \
447 for (pos = list_first_entry(head, typeof(*pos), member); \ 447 for (pos = list_first_entry(head, typeof(*pos), member); \
@@ -452,7 +452,7 @@ static inline void list_splice_tail_init(struct list_head *list,
452 * list_for_each_entry_reverse - iterate backwards over list of given type. 452 * list_for_each_entry_reverse - iterate backwards over list of given type.
453 * @pos: the type * to use as a loop cursor. 453 * @pos: the type * to use as a loop cursor.
454 * @head: the head for your list. 454 * @head: the head for your list.
455 * @member: the name of the list_struct within the struct. 455 * @member: the name of the list_head within the struct.
456 */ 456 */
457#define list_for_each_entry_reverse(pos, head, member) \ 457#define list_for_each_entry_reverse(pos, head, member) \
458 for (pos = list_last_entry(head, typeof(*pos), member); \ 458 for (pos = list_last_entry(head, typeof(*pos), member); \
@@ -463,7 +463,7 @@ static inline void list_splice_tail_init(struct list_head *list,
463 * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue() 463 * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
464 * @pos: the type * to use as a start point 464 * @pos: the type * to use as a start point
465 * @head: the head of the list 465 * @head: the head of the list
466 * @member: the name of the list_struct within the struct. 466 * @member: the name of the list_head within the struct.
467 * 467 *
468 * Prepares a pos entry for use as a start point in list_for_each_entry_continue(). 468 * Prepares a pos entry for use as a start point in list_for_each_entry_continue().
469 */ 469 */
@@ -474,7 +474,7 @@ static inline void list_splice_tail_init(struct list_head *list,
474 * list_for_each_entry_continue - continue iteration over list of given type 474 * list_for_each_entry_continue - continue iteration over list of given type
475 * @pos: the type * to use as a loop cursor. 475 * @pos: the type * to use as a loop cursor.
476 * @head: the head for your list. 476 * @head: the head for your list.
477 * @member: the name of the list_struct within the struct. 477 * @member: the name of the list_head within the struct.
478 * 478 *
479 * Continue to iterate over list of given type, continuing after 479 * Continue to iterate over list of given type, continuing after
480 * the current position. 480 * the current position.
@@ -488,7 +488,7 @@ static inline void list_splice_tail_init(struct list_head *list,
488 * list_for_each_entry_continue_reverse - iterate backwards from the given point 488 * list_for_each_entry_continue_reverse - iterate backwards from the given point
489 * @pos: the type * to use as a loop cursor. 489 * @pos: the type * to use as a loop cursor.
490 * @head: the head for your list. 490 * @head: the head for your list.
491 * @member: the name of the list_struct within the struct. 491 * @member: the name of the list_head within the struct.
492 * 492 *
493 * Start to iterate over list of given type backwards, continuing after 493 * Start to iterate over list of given type backwards, continuing after
494 * the current position. 494 * the current position.
@@ -502,7 +502,7 @@ static inline void list_splice_tail_init(struct list_head *list,
502 * list_for_each_entry_from - iterate over list of given type from the current point 502 * list_for_each_entry_from - iterate over list of given type from the current point
503 * @pos: the type * to use as a loop cursor. 503 * @pos: the type * to use as a loop cursor.
504 * @head: the head for your list. 504 * @head: the head for your list.
505 * @member: the name of the list_struct within the struct. 505 * @member: the name of the list_head within the struct.
506 * 506 *
507 * Iterate over list of given type, continuing from current position. 507 * Iterate over list of given type, continuing from current position.
508 */ 508 */
@@ -515,7 +515,7 @@ static inline void list_splice_tail_init(struct list_head *list,
515 * @pos: the type * to use as a loop cursor. 515 * @pos: the type * to use as a loop cursor.
516 * @n: another type * to use as temporary storage 516 * @n: another type * to use as temporary storage
517 * @head: the head for your list. 517 * @head: the head for your list.
518 * @member: the name of the list_struct within the struct. 518 * @member: the name of the list_head within the struct.
519 */ 519 */
520#define list_for_each_entry_safe(pos, n, head, member) \ 520#define list_for_each_entry_safe(pos, n, head, member) \
521 for (pos = list_first_entry(head, typeof(*pos), member), \ 521 for (pos = list_first_entry(head, typeof(*pos), member), \
@@ -528,7 +528,7 @@ static inline void list_splice_tail_init(struct list_head *list,
528 * @pos: the type * to use as a loop cursor. 528 * @pos: the type * to use as a loop cursor.
529 * @n: another type * to use as temporary storage 529 * @n: another type * to use as temporary storage
530 * @head: the head for your list. 530 * @head: the head for your list.
531 * @member: the name of the list_struct within the struct. 531 * @member: the name of the list_head within the struct.
532 * 532 *
533 * Iterate over list of given type, continuing after current point, 533 * Iterate over list of given type, continuing after current point,
534 * safe against removal of list entry. 534 * safe against removal of list entry.
@@ -544,7 +544,7 @@ static inline void list_splice_tail_init(struct list_head *list,
544 * @pos: the type * to use as a loop cursor. 544 * @pos: the type * to use as a loop cursor.
545 * @n: another type * to use as temporary storage 545 * @n: another type * to use as temporary storage
546 * @head: the head for your list. 546 * @head: the head for your list.
547 * @member: the name of the list_struct within the struct. 547 * @member: the name of the list_head within the struct.
548 * 548 *
549 * Iterate over list of given type from current point, safe against 549 * Iterate over list of given type from current point, safe against
550 * removal of list entry. 550 * removal of list entry.
@@ -559,7 +559,7 @@ static inline void list_splice_tail_init(struct list_head *list,
559 * @pos: the type * to use as a loop cursor. 559 * @pos: the type * to use as a loop cursor.
560 * @n: another type * to use as temporary storage 560 * @n: another type * to use as temporary storage
561 * @head: the head for your list. 561 * @head: the head for your list.
562 * @member: the name of the list_struct within the struct. 562 * @member: the name of the list_head within the struct.
563 * 563 *
564 * Iterate backwards over list of given type, safe against removal 564 * Iterate backwards over list of given type, safe against removal
565 * of list entry. 565 * of list entry.
@@ -574,7 +574,7 @@ static inline void list_splice_tail_init(struct list_head *list,
574 * list_safe_reset_next - reset a stale list_for_each_entry_safe loop 574 * list_safe_reset_next - reset a stale list_for_each_entry_safe loop
575 * @pos: the loop cursor used in the list_for_each_entry_safe loop 575 * @pos: the loop cursor used in the list_for_each_entry_safe loop
576 * @n: temporary storage used in list_for_each_entry_safe 576 * @n: temporary storage used in list_for_each_entry_safe
577 * @member: the name of the list_struct within the struct. 577 * @member: the name of the list_head within the struct.
578 * 578 *
579 * list_safe_reset_next is not safe to use in general if the list may be 579 * list_safe_reset_next is not safe to use in general if the list may be
580 * modified concurrently (eg. the lock is dropped in the loop body). An 580 * modified concurrently (eg. the lock is dropped in the loop body). An
diff --git a/include/linux/lockd/debug.h b/include/linux/lockd/debug.h
index 257d3779f2ab..0ca8109934e4 100644
--- a/include/linux/lockd/debug.h
+++ b/include/linux/lockd/debug.h
@@ -17,12 +17,8 @@
17 * Enable lockd debugging. 17 * Enable lockd debugging.
18 * Requires RPC_DEBUG. 18 * Requires RPC_DEBUG.
19 */ 19 */
20#ifdef RPC_DEBUG
21# define LOCKD_DEBUG 1
22#endif
23
24#undef ifdebug 20#undef ifdebug
25#if defined(RPC_DEBUG) && defined(LOCKD_DEBUG) 21#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
26# define ifdebug(flag) if (unlikely(nlm_debug & NLMDBG_##flag)) 22# define ifdebug(flag) if (unlikely(nlm_debug & NLMDBG_##flag))
27#else 23#else
28# define ifdebug(flag) if (0) 24# define ifdebug(flag) if (0)
diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h
index 307d9cab2026..1726ccbd8009 100644
--- a/include/linux/mailbox_client.h
+++ b/include/linux/mailbox_client.h
@@ -25,6 +25,8 @@ struct mbox_chan;
25 * if the client receives some ACK packet for transmission. 25 * if the client receives some ACK packet for transmission.
26 * Unused if the controller already has TX_Done/RTR IRQ. 26 * Unused if the controller already has TX_Done/RTR IRQ.
27 * @rx_callback: Atomic callback to provide client the data received 27 * @rx_callback: Atomic callback to provide client the data received
28 * @tx_prepare: Atomic callback to ask client to prepare the payload
29 * before initiating the transmission if required.
28 * @tx_done: Atomic callback to tell client of data transmission 30 * @tx_done: Atomic callback to tell client of data transmission
29 */ 31 */
30struct mbox_client { 32struct mbox_client {
@@ -34,6 +36,7 @@ struct mbox_client {
34 bool knows_txdone; 36 bool knows_txdone;
35 37
36 void (*rx_callback)(struct mbox_client *cl, void *mssg); 38 void (*rx_callback)(struct mbox_client *cl, void *mssg);
39 void (*tx_prepare)(struct mbox_client *cl, void *mssg);
37 void (*tx_done)(struct mbox_client *cl, void *mssg, int r); 40 void (*tx_done)(struct mbox_client *cl, void *mssg, int r);
38}; 41};
39 42
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index 8e9a029e093d..e6982ac3200d 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -16,6 +16,7 @@
16#define MARVELL_PHY_ID_88E1318S 0x01410e90 16#define MARVELL_PHY_ID_88E1318S 0x01410e90
17#define MARVELL_PHY_ID_88E1116R 0x01410e40 17#define MARVELL_PHY_ID_88E1116R 0x01410e40
18#define MARVELL_PHY_ID_88E1510 0x01410dd0 18#define MARVELL_PHY_ID_88E1510 0x01410dd0
19#define MARVELL_PHY_ID_88E3016 0x01410e60
19 20
20/* struct phy_device dev_flags definitions */ 21/* struct phy_device dev_flags definitions */
21#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001 22#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index 550c88fb0267..611b69fa8594 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -61,6 +61,7 @@ static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
61} 61}
62#endif 62#endif
63 63
64int mvebu_mbus_save_cpu_target(u32 *store_addr);
64void mvebu_mbus_get_pcie_mem_aperture(struct resource *res); 65void mvebu_mbus_get_pcie_mem_aperture(struct resource *res);
65void mvebu_mbus_get_pcie_io_aperture(struct resource *res); 66void mvebu_mbus_get_pcie_io_aperture(struct resource *res);
66int mvebu_mbus_add_window_remap_by_id(unsigned int target, 67int mvebu_mbus_add_window_remap_by_id(unsigned int target,
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 6b75640ef5ab..7c95af8d552c 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -25,7 +25,6 @@
25#include <linux/jump_label.h> 25#include <linux/jump_label.h>
26 26
27struct mem_cgroup; 27struct mem_cgroup;
28struct page_cgroup;
29struct page; 28struct page;
30struct mm_struct; 29struct mm_struct;
31struct kmem_cache; 30struct kmem_cache;
@@ -68,10 +67,9 @@ void mem_cgroup_migrate(struct page *oldpage, struct page *newpage,
68struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *); 67struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *);
69struct lruvec *mem_cgroup_page_lruvec(struct page *, struct zone *); 68struct lruvec *mem_cgroup_page_lruvec(struct page *, struct zone *);
70 69
71bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg, 70bool mem_cgroup_is_descendant(struct mem_cgroup *memcg,
72 struct mem_cgroup *memcg); 71 struct mem_cgroup *root);
73bool task_in_mem_cgroup(struct task_struct *task, 72bool task_in_mem_cgroup(struct task_struct *task, struct mem_cgroup *memcg);
74 const struct mem_cgroup *memcg);
75 73
76extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); 74extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
77extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); 75extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
@@ -79,15 +77,16 @@ extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
79extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg); 77extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg);
80extern struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *css); 78extern struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *css);
81 79
82static inline 80static inline bool mm_match_cgroup(struct mm_struct *mm,
83bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg) 81 struct mem_cgroup *memcg)
84{ 82{
85 struct mem_cgroup *task_memcg; 83 struct mem_cgroup *task_memcg;
86 bool match; 84 bool match = false;
87 85
88 rcu_read_lock(); 86 rcu_read_lock();
89 task_memcg = mem_cgroup_from_task(rcu_dereference(mm->owner)); 87 task_memcg = mem_cgroup_from_task(rcu_dereference(mm->owner));
90 match = __mem_cgroup_same_or_subtree(memcg, task_memcg); 88 if (task_memcg)
89 match = mem_cgroup_is_descendant(task_memcg, memcg);
91 rcu_read_unlock(); 90 rcu_read_unlock();
92 return match; 91 return match;
93} 92}
@@ -141,8 +140,8 @@ static inline bool mem_cgroup_disabled(void)
141 140
142struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page, bool *locked, 141struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page, bool *locked,
143 unsigned long *flags); 142 unsigned long *flags);
144void mem_cgroup_end_page_stat(struct mem_cgroup *memcg, bool locked, 143void mem_cgroup_end_page_stat(struct mem_cgroup *memcg, bool *locked,
145 unsigned long flags); 144 unsigned long *flags);
146void mem_cgroup_update_page_stat(struct mem_cgroup *memcg, 145void mem_cgroup_update_page_stat(struct mem_cgroup *memcg,
147 enum mem_cgroup_stat_index idx, int val); 146 enum mem_cgroup_stat_index idx, int val);
148 147
@@ -174,10 +173,6 @@ static inline void mem_cgroup_count_vm_event(struct mm_struct *mm,
174void mem_cgroup_split_huge_fixup(struct page *head); 173void mem_cgroup_split_huge_fixup(struct page *head);
175#endif 174#endif
176 175
177#ifdef CONFIG_DEBUG_VM
178bool mem_cgroup_bad_page_check(struct page *page);
179void mem_cgroup_print_bad_page(struct page *page);
180#endif
181#else /* CONFIG_MEMCG */ 176#else /* CONFIG_MEMCG */
182struct mem_cgroup; 177struct mem_cgroup;
183 178
@@ -297,7 +292,7 @@ static inline struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page,
297} 292}
298 293
299static inline void mem_cgroup_end_page_stat(struct mem_cgroup *memcg, 294static inline void mem_cgroup_end_page_stat(struct mem_cgroup *memcg,
300 bool locked, unsigned long flags) 295 bool *locked, unsigned long *flags)
301{ 296{
302} 297}
303 298
@@ -347,19 +342,6 @@ void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
347} 342}
348#endif /* CONFIG_MEMCG */ 343#endif /* CONFIG_MEMCG */
349 344
350#if !defined(CONFIG_MEMCG) || !defined(CONFIG_DEBUG_VM)
351static inline bool
352mem_cgroup_bad_page_check(struct page *page)
353{
354 return false;
355}
356
357static inline void
358mem_cgroup_print_bad_page(struct page *page)
359{
360}
361#endif
362
363enum { 345enum {
364 UNDER_LIMIT, 346 UNDER_LIMIT,
365 SOFT_LIMIT, 347 SOFT_LIMIT,
@@ -418,8 +400,8 @@ int memcg_cache_id(struct mem_cgroup *memcg);
418 400
419void memcg_update_array_size(int num_groups); 401void memcg_update_array_size(int num_groups);
420 402
421struct kmem_cache * 403struct kmem_cache *__memcg_kmem_get_cache(struct kmem_cache *cachep);
422__memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp); 404void __memcg_kmem_put_cache(struct kmem_cache *cachep);
423 405
424int __memcg_charge_slab(struct kmem_cache *cachep, gfp_t gfp, int order); 406int __memcg_charge_slab(struct kmem_cache *cachep, gfp_t gfp, int order);
425void __memcg_uncharge_slab(struct kmem_cache *cachep, int order); 407void __memcg_uncharge_slab(struct kmem_cache *cachep, int order);
@@ -447,9 +429,8 @@ memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **memcg, int order)
447 /* 429 /*
448 * __GFP_NOFAIL allocations will move on even if charging is not 430 * __GFP_NOFAIL allocations will move on even if charging is not
449 * possible. Therefore we don't even try, and have this allocation 431 * possible. Therefore we don't even try, and have this allocation
450 * unaccounted. We could in theory charge it with 432 * unaccounted. We could in theory charge it forcibly, but we hope
451 * res_counter_charge_nofail, but we hope those allocations are rare, 433 * those allocations are rare, and won't be worth the trouble.
452 * and won't be worth the trouble.
453 */ 434 */
454 if (gfp & __GFP_NOFAIL) 435 if (gfp & __GFP_NOFAIL)
455 return true; 436 return true;
@@ -467,8 +448,6 @@ memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **memcg, int order)
467 * memcg_kmem_uncharge_pages: uncharge pages from memcg 448 * memcg_kmem_uncharge_pages: uncharge pages from memcg
468 * @page: pointer to struct page being freed 449 * @page: pointer to struct page being freed
469 * @order: allocation order. 450 * @order: allocation order.
470 *
471 * there is no need to specify memcg here, since it is embedded in page_cgroup
472 */ 451 */
473static inline void 452static inline void
474memcg_kmem_uncharge_pages(struct page *page, int order) 453memcg_kmem_uncharge_pages(struct page *page, int order)
@@ -485,8 +464,7 @@ memcg_kmem_uncharge_pages(struct page *page, int order)
485 * 464 *
486 * Needs to be called after memcg_kmem_newpage_charge, regardless of success or 465 * Needs to be called after memcg_kmem_newpage_charge, regardless of success or
487 * failure of the allocation. if @page is NULL, this function will revert the 466 * failure of the allocation. if @page is NULL, this function will revert the
488 * charges. Otherwise, it will commit the memcg given by @memcg to the 467 * charges. Otherwise, it will commit @page to @memcg.
489 * corresponding page_cgroup.
490 */ 468 */
491static inline void 469static inline void
492memcg_kmem_commit_charge(struct page *page, struct mem_cgroup *memcg, int order) 470memcg_kmem_commit_charge(struct page *page, struct mem_cgroup *memcg, int order)
@@ -514,7 +492,13 @@ memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
514 if (unlikely(fatal_signal_pending(current))) 492 if (unlikely(fatal_signal_pending(current)))
515 return cachep; 493 return cachep;
516 494
517 return __memcg_kmem_get_cache(cachep, gfp); 495 return __memcg_kmem_get_cache(cachep);
496}
497
498static __always_inline void memcg_kmem_put_cache(struct kmem_cache *cachep)
499{
500 if (memcg_kmem_enabled())
501 __memcg_kmem_put_cache(cachep);
518} 502}
519#else 503#else
520#define for_each_memcg_cache_index(_idx) \ 504#define for_each_memcg_cache_index(_idx) \
@@ -550,6 +534,10 @@ memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
550{ 534{
551 return cachep; 535 return cachep;
552} 536}
537
538static inline void memcg_kmem_put_cache(struct kmem_cache *cachep)
539{
540}
553#endif /* CONFIG_MEMCG_KMEM */ 541#endif /* CONFIG_MEMCG_KMEM */
554#endif /* _LINUX_MEMCONTROL_H */ 542#endif /* _LINUX_MEMCONTROL_H */
555 543
diff --git a/include/linux/mfd/abx500/ab8500-sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h
index adba89d9c660..689312745b2f 100644
--- a/include/linux/mfd/abx500/ab8500-sysctrl.h
+++ b/include/linux/mfd/abx500/ab8500-sysctrl.h
@@ -12,7 +12,6 @@
12 12
13int ab8500_sysctrl_read(u16 reg, u8 *value); 13int ab8500_sysctrl_read(u16 reg, u8 *value);
14int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value); 14int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value);
15void ab8500_restart(char mode, const char *cmd);
16 15
17#else 16#else
18 17
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index f34723f7663c..910e3aa1e965 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -141,6 +141,7 @@ struct arizona {
141 141
142 uint16_t dac_comp_coeff; 142 uint16_t dac_comp_coeff;
143 uint8_t dac_comp_enabled; 143 uint8_t dac_comp_enabled;
144 struct mutex dac_comp_lock;
144}; 145};
145 146
146int arizona_clk32k_enable(struct arizona *arizona); 147int arizona_clk32k_enable(struct arizona *arizona);
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index c0b075f6bc35..aacc10d7789c 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -125,6 +125,8 @@
125#define ARIZONA_MIC_BIAS_CTRL_1 0x218 125#define ARIZONA_MIC_BIAS_CTRL_1 0x218
126#define ARIZONA_MIC_BIAS_CTRL_2 0x219 126#define ARIZONA_MIC_BIAS_CTRL_2 0x219
127#define ARIZONA_MIC_BIAS_CTRL_3 0x21A 127#define ARIZONA_MIC_BIAS_CTRL_3 0x21A
128#define ARIZONA_HP_CTRL_1L 0x225
129#define ARIZONA_HP_CTRL_1R 0x226
128#define ARIZONA_ACCESSORY_DETECT_MODE_1 0x293 130#define ARIZONA_ACCESSORY_DETECT_MODE_1 0x293
129#define ARIZONA_HEADPHONE_DETECT_1 0x29B 131#define ARIZONA_HEADPHONE_DETECT_1 0x29B
130#define ARIZONA_HEADPHONE_DETECT_2 0x29C 132#define ARIZONA_HEADPHONE_DETECT_2 0x29C
@@ -279,8 +281,16 @@
279#define ARIZONA_AIF2_FRAME_CTRL_2 0x548 281#define ARIZONA_AIF2_FRAME_CTRL_2 0x548
280#define ARIZONA_AIF2_FRAME_CTRL_3 0x549 282#define ARIZONA_AIF2_FRAME_CTRL_3 0x549
281#define ARIZONA_AIF2_FRAME_CTRL_4 0x54A 283#define ARIZONA_AIF2_FRAME_CTRL_4 0x54A
284#define ARIZONA_AIF2_FRAME_CTRL_5 0x54B
285#define ARIZONA_AIF2_FRAME_CTRL_6 0x54C
286#define ARIZONA_AIF2_FRAME_CTRL_7 0x54D
287#define ARIZONA_AIF2_FRAME_CTRL_8 0x54E
282#define ARIZONA_AIF2_FRAME_CTRL_11 0x551 288#define ARIZONA_AIF2_FRAME_CTRL_11 0x551
283#define ARIZONA_AIF2_FRAME_CTRL_12 0x552 289#define ARIZONA_AIF2_FRAME_CTRL_12 0x552
290#define ARIZONA_AIF2_FRAME_CTRL_13 0x553
291#define ARIZONA_AIF2_FRAME_CTRL_14 0x554
292#define ARIZONA_AIF2_FRAME_CTRL_15 0x555
293#define ARIZONA_AIF2_FRAME_CTRL_16 0x556
284#define ARIZONA_AIF2_TX_ENABLES 0x559 294#define ARIZONA_AIF2_TX_ENABLES 0x559
285#define ARIZONA_AIF2_RX_ENABLES 0x55A 295#define ARIZONA_AIF2_RX_ENABLES 0x55A
286#define ARIZONA_AIF2_FORCE_WRITE 0x55B 296#define ARIZONA_AIF2_FORCE_WRITE 0x55B
@@ -2245,6 +2255,46 @@
2245#define ARIZONA_MICB3_ENA_WIDTH 1 /* MICB3_ENA */ 2255#define ARIZONA_MICB3_ENA_WIDTH 1 /* MICB3_ENA */
2246 2256
2247/* 2257/*
2258 * R549 (0x225) - HP Ctrl 1L
2259 */
2260#define ARIZONA_RMV_SHRT_HP1L 0x4000 /* RMV_SHRT_HP1L */
2261#define ARIZONA_RMV_SHRT_HP1L_MASK 0x4000 /* RMV_SHRT_HP1L */
2262#define ARIZONA_RMV_SHRT_HP1L_SHIFT 14 /* RMV_SHRT_HP1L */
2263#define ARIZONA_RMV_SHRT_HP1L_WIDTH 1 /* RMV_SHRT_HP1L */
2264#define ARIZONA_HP1L_FLWR 0x0004 /* HP1L_FLWR */
2265#define ARIZONA_HP1L_FLWR_MASK 0x0004 /* HP1L_FLWR */
2266#define ARIZONA_HP1L_FLWR_SHIFT 2 /* HP1L_FLWR */
2267#define ARIZONA_HP1L_FLWR_WIDTH 1 /* HP1L_FLWR */
2268#define ARIZONA_HP1L_SHRTI 0x0002 /* HP1L_SHRTI */
2269#define ARIZONA_HP1L_SHRTI_MASK 0x0002 /* HP1L_SHRTI */
2270#define ARIZONA_HP1L_SHRTI_SHIFT 1 /* HP1L_SHRTI */
2271#define ARIZONA_HP1L_SHRTI_WIDTH 1 /* HP1L_SHRTI */
2272#define ARIZONA_HP1L_SHRTO 0x0001 /* HP1L_SHRTO */
2273#define ARIZONA_HP1L_SHRTO_MASK 0x0001 /* HP1L_SHRTO */
2274#define ARIZONA_HP1L_SHRTO_SHIFT 0 /* HP1L_SHRTO */
2275#define ARIZONA_HP1L_SHRTO_WIDTH 1 /* HP1L_SHRTO */
2276
2277/*
2278 * R550 (0x226) - HP Ctrl 1R
2279 */
2280#define ARIZONA_RMV_SHRT_HP1R 0x4000 /* RMV_SHRT_HP1R */
2281#define ARIZONA_RMV_SHRT_HP1R_MASK 0x4000 /* RMV_SHRT_HP1R */
2282#define ARIZONA_RMV_SHRT_HP1R_SHIFT 14 /* RMV_SHRT_HP1R */
2283#define ARIZONA_RMV_SHRT_HP1R_WIDTH 1 /* RMV_SHRT_HP1R */
2284#define ARIZONA_HP1R_FLWR 0x0004 /* HP1R_FLWR */
2285#define ARIZONA_HP1R_FLWR_MASK 0x0004 /* HP1R_FLWR */
2286#define ARIZONA_HP1R_FLWR_SHIFT 2 /* HP1R_FLWR */
2287#define ARIZONA_HP1R_FLWR_WIDTH 1 /* HP1R_FLWR */
2288#define ARIZONA_HP1R_SHRTI 0x0002 /* HP1R_SHRTI */
2289#define ARIZONA_HP1R_SHRTI_MASK 0x0002 /* HP1R_SHRTI */
2290#define ARIZONA_HP1R_SHRTI_SHIFT 1 /* HP1R_SHRTI */
2291#define ARIZONA_HP1R_SHRTI_WIDTH 1 /* HP1R_SHRTI */
2292#define ARIZONA_HP1R_SHRTO 0x0001 /* HP1R_SHRTO */
2293#define ARIZONA_HP1R_SHRTO_MASK 0x0001 /* HP1R_SHRTO */
2294#define ARIZONA_HP1R_SHRTO_SHIFT 0 /* HP1R_SHRTO */
2295#define ARIZONA_HP1R_SHRTO_WIDTH 1 /* HP1R_SHRTO */
2296
2297/*
2248 * R659 (0x293) - Accessory Detect Mode 1 2298 * R659 (0x293) - Accessory Detect Mode 1
2249 */ 2299 */
2250#define ARIZONA_ACCDET_SRC 0x2000 /* ACCDET_SRC */ 2300#define ARIZONA_ACCDET_SRC 0x2000 /* ACCDET_SRC */
diff --git a/include/linux/mfd/atmel-hlcdc.h b/include/linux/mfd/atmel-hlcdc.h
new file mode 100644
index 000000000000..1279ab1644b5
--- /dev/null
+++ b/include/linux/mfd/atmel-hlcdc.h
@@ -0,0 +1,85 @@
1/*
2 * Copyright (C) 2014 Free Electrons
3 * Copyright (C) 2014 Atmel
4 *
5 * Author: Boris BREZILLON <boris.brezillon@free-electrons.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef __LINUX_MFD_HLCDC_H
21#define __LINUX_MFD_HLCDC_H
22
23#include <linux/clk.h>
24#include <linux/regmap.h>
25
26#define ATMEL_HLCDC_CFG(i) ((i) * 0x4)
27#define ATMEL_HLCDC_SIG_CFG LCDCFG(5)
28#define ATMEL_HLCDC_HSPOL BIT(0)
29#define ATMEL_HLCDC_VSPOL BIT(1)
30#define ATMEL_HLCDC_VSPDLYS BIT(2)
31#define ATMEL_HLCDC_VSPDLYE BIT(3)
32#define ATMEL_HLCDC_DISPPOL BIT(4)
33#define ATMEL_HLCDC_DITHER BIT(6)
34#define ATMEL_HLCDC_DISPDLY BIT(7)
35#define ATMEL_HLCDC_MODE_MASK GENMASK(9, 8)
36#define ATMEL_HLCDC_PP BIT(10)
37#define ATMEL_HLCDC_VSPSU BIT(12)
38#define ATMEL_HLCDC_VSPHO BIT(13)
39#define ATMEL_HLCDC_GUARDTIME_MASK GENMASK(20, 16)
40
41#define ATMEL_HLCDC_EN 0x20
42#define ATMEL_HLCDC_DIS 0x24
43#define ATMEL_HLCDC_SR 0x28
44#define ATMEL_HLCDC_IER 0x2c
45#define ATMEL_HLCDC_IDR 0x30
46#define ATMEL_HLCDC_IMR 0x34
47#define ATMEL_HLCDC_ISR 0x38
48
49#define ATMEL_HLCDC_CLKPOL BIT(0)
50#define ATMEL_HLCDC_CLKSEL BIT(2)
51#define ATMEL_HLCDC_CLKPWMSEL BIT(3)
52#define ATMEL_HLCDC_CGDIS(i) BIT(8 + (i))
53#define ATMEL_HLCDC_CLKDIV_SHFT 16
54#define ATMEL_HLCDC_CLKDIV_MASK GENMASK(23, 16)
55#define ATMEL_HLCDC_CLKDIV(div) ((div - 2) << ATMEL_HLCDC_CLKDIV_SHFT)
56
57#define ATMEL_HLCDC_PIXEL_CLK BIT(0)
58#define ATMEL_HLCDC_SYNC BIT(1)
59#define ATMEL_HLCDC_DISP BIT(2)
60#define ATMEL_HLCDC_PWM BIT(3)
61#define ATMEL_HLCDC_SIP BIT(4)
62
63#define ATMEL_HLCDC_SOF BIT(0)
64#define ATMEL_HLCDC_SYNCDIS BIT(1)
65#define ATMEL_HLCDC_FIFOERR BIT(4)
66#define ATMEL_HLCDC_LAYER_STATUS(x) BIT((x) + 8)
67
68/**
69 * Structure shared by the MFD device and its subdevices.
70 *
71 * @regmap: register map used to access HLCDC IP registers
72 * @periph_clk: the hlcdc peripheral clock
73 * @sys_clk: the hlcdc system clock
74 * @slow_clk: the system slow clk
75 * @irq: the hlcdc irq
76 */
77struct atmel_hlcdc {
78 struct regmap *regmap;
79 struct clk *periph_clk;
80 struct clk *sys_clk;
81 struct clk *slow_clk;
82 int irq;
83};
84
85#endif /* __LINUX_MFD_HLCDC_H */
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index d0e31a2287ac..81589d176ae8 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -14,6 +14,8 @@
14enum { 14enum {
15 AXP202_ID = 0, 15 AXP202_ID = 0,
16 AXP209_ID, 16 AXP209_ID,
17 AXP288_ID,
18 NR_AXP20X_VARIANTS,
17}; 19};
18 20
19#define AXP20X_DATACACHE(m) (0x04 + (m)) 21#define AXP20X_DATACACHE(m) (0x04 + (m))
@@ -49,11 +51,13 @@ enum {
49#define AXP20X_IRQ3_EN 0x42 51#define AXP20X_IRQ3_EN 0x42
50#define AXP20X_IRQ4_EN 0x43 52#define AXP20X_IRQ4_EN 0x43
51#define AXP20X_IRQ5_EN 0x44 53#define AXP20X_IRQ5_EN 0x44
54#define AXP20X_IRQ6_EN 0x45
52#define AXP20X_IRQ1_STATE 0x48 55#define AXP20X_IRQ1_STATE 0x48
53#define AXP20X_IRQ2_STATE 0x49 56#define AXP20X_IRQ2_STATE 0x49
54#define AXP20X_IRQ3_STATE 0x4a 57#define AXP20X_IRQ3_STATE 0x4a
55#define AXP20X_IRQ4_STATE 0x4b 58#define AXP20X_IRQ4_STATE 0x4b
56#define AXP20X_IRQ5_STATE 0x4c 59#define AXP20X_IRQ5_STATE 0x4c
60#define AXP20X_IRQ6_STATE 0x4d
57 61
58/* ADC */ 62/* ADC */
59#define AXP20X_ACIN_V_ADC_H 0x56 63#define AXP20X_ACIN_V_ADC_H 0x56
@@ -116,6 +120,15 @@ enum {
116#define AXP20X_CC_CTRL 0xb8 120#define AXP20X_CC_CTRL 0xb8
117#define AXP20X_FG_RES 0xb9 121#define AXP20X_FG_RES 0xb9
118 122
123/* AXP288 specific registers */
124#define AXP288_PMIC_ADC_H 0x56
125#define AXP288_PMIC_ADC_L 0x57
126#define AXP288_ADC_TS_PIN_CTRL 0x84
127
128#define AXP288_PMIC_ADC_EN 0x84
129#define AXP288_FG_TUNE5 0xed
130
131
119/* Regulators IDs */ 132/* Regulators IDs */
120enum { 133enum {
121 AXP20X_LDO1 = 0, 134 AXP20X_LDO1 = 0,
@@ -169,12 +182,58 @@ enum {
169 AXP20X_IRQ_GPIO0_INPUT, 182 AXP20X_IRQ_GPIO0_INPUT,
170}; 183};
171 184
185enum axp288_irqs {
186 AXP288_IRQ_VBUS_FALL = 2,
187 AXP288_IRQ_VBUS_RISE,
188 AXP288_IRQ_OV,
189 AXP288_IRQ_FALLING_ALT,
190 AXP288_IRQ_RISING_ALT,
191 AXP288_IRQ_OV_ALT,
192 AXP288_IRQ_DONE = 10,
193 AXP288_IRQ_CHARGING,
194 AXP288_IRQ_SAFE_QUIT,
195 AXP288_IRQ_SAFE_ENTER,
196 AXP288_IRQ_ABSENT,
197 AXP288_IRQ_APPEND,
198 AXP288_IRQ_QWBTU,
199 AXP288_IRQ_WBTU,
200 AXP288_IRQ_QWBTO,
201 AXP288_IRQ_WBTO,
202 AXP288_IRQ_QCBTU,
203 AXP288_IRQ_CBTU,
204 AXP288_IRQ_QCBTO,
205 AXP288_IRQ_CBTO,
206 AXP288_IRQ_WL2,
207 AXP288_IRQ_WL1,
208 AXP288_IRQ_GPADC,
209 AXP288_IRQ_OT = 31,
210 AXP288_IRQ_GPIO0,
211 AXP288_IRQ_GPIO1,
212 AXP288_IRQ_POKO,
213 AXP288_IRQ_POKL,
214 AXP288_IRQ_POKS,
215 AXP288_IRQ_POKN,
216 AXP288_IRQ_POKP,
217 AXP288_IRQ_TIMER,
218 AXP288_IRQ_MV_CHNG,
219 AXP288_IRQ_BC_USB_CHNG,
220};
221
222#define AXP288_TS_ADC_H 0x58
223#define AXP288_TS_ADC_L 0x59
224#define AXP288_GP_ADC_H 0x5a
225#define AXP288_GP_ADC_L 0x5b
226
172struct axp20x_dev { 227struct axp20x_dev {
173 struct device *dev; 228 struct device *dev;
174 struct i2c_client *i2c_client; 229 struct i2c_client *i2c_client;
175 struct regmap *regmap; 230 struct regmap *regmap;
176 struct regmap_irq_chip_data *regmap_irqc; 231 struct regmap_irq_chip_data *regmap_irqc;
177 long variant; 232 long variant;
233 int nr_cells;
234 struct mfd_cell *cells;
235 const struct regmap_config *regmap_cfg;
236 const struct regmap_irq_chip *regmap_irq_chip;
178}; 237};
179 238
180#endif /* __LINUX_MFD_AXP20X_H */ 239#endif /* __LINUX_MFD_AXP20X_H */
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 73e1709d4c09..a76bc100bf97 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -111,6 +111,13 @@ extern int mfd_add_devices(struct device *parent, int id,
111 struct resource *mem_base, 111 struct resource *mem_base,
112 int irq_base, struct irq_domain *irq_domain); 112 int irq_base, struct irq_domain *irq_domain);
113 113
114static inline int mfd_add_hotplug_devices(struct device *parent,
115 const struct mfd_cell *cells, int n_devs)
116{
117 return mfd_add_devices(parent, PLATFORM_DEVID_AUTO, cells, n_devs,
118 NULL, 0, NULL);
119}
120
114extern void mfd_remove_devices(struct device *parent); 121extern void mfd_remove_devices(struct device *parent);
115 122
116#endif 123#endif
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h
index cb01496bfa49..8e1cdbef3dad 100644
--- a/include/linux/mfd/davinci_voicecodec.h
+++ b/include/linux/mfd/davinci_voicecodec.h
@@ -99,12 +99,6 @@ struct davinci_vcif {
99 dma_addr_t dma_rx_addr; 99 dma_addr_t dma_rx_addr;
100}; 100};
101 101
102struct cq93vc {
103 struct platform_device *pdev;
104 struct snd_soc_codec *codec;
105 u32 sysclk;
106};
107
108struct davinci_vc; 102struct davinci_vc;
109 103
110struct davinci_vc { 104struct davinci_vc {
@@ -122,7 +116,6 @@ struct davinci_vc {
122 116
123 /* Client devices */ 117 /* Client devices */
124 struct davinci_vcif davinci_vcif; 118 struct davinci_vcif davinci_vcif;
125 struct cq93vc cq93vc;
126}; 119};
127 120
128#endif 121#endif
diff --git a/include/linux/mfd/dln2.h b/include/linux/mfd/dln2.h
new file mode 100644
index 000000000000..004b24576da8
--- /dev/null
+++ b/include/linux/mfd/dln2.h
@@ -0,0 +1,103 @@
1#ifndef __LINUX_USB_DLN2_H
2#define __LINUX_USB_DLN2_H
3
4#define DLN2_CMD(cmd, id) ((cmd) | ((id) << 8))
5
6struct dln2_platform_data {
7 u16 handle; /* sub-driver handle (internally used only) */
8 u8 port; /* I2C/SPI port */
9};
10
11/**
12 * dln2_event_cb_t - event callback function signature
13 *
14 * @pdev - the sub-device that registered this callback
15 * @echo - the echo header field received in the message
16 * @data - the data payload
17 * @len - the data payload length
18 *
19 * The callback function is called in interrupt context and the data payload is
20 * only valid during the call. If the user needs later access of the data, it
21 * must copy it.
22 */
23
24typedef void (*dln2_event_cb_t)(struct platform_device *pdev, u16 echo,
25 const void *data, int len);
26
27/**
28 * dl2n_register_event_cb - register a callback function for an event
29 *
30 * @pdev - the sub-device that registers the callback
31 * @event - the event for which to register a callback
32 * @event_cb - the callback function
33 *
34 * @return 0 in case of success, negative value in case of error
35 */
36int dln2_register_event_cb(struct platform_device *pdev, u16 event,
37 dln2_event_cb_t event_cb);
38
39/**
40 * dln2_unregister_event_cb - unregister the callback function for an event
41 *
42 * @pdev - the sub-device that registered the callback
43 * @event - the event for which to register a callback
44 */
45void dln2_unregister_event_cb(struct platform_device *pdev, u16 event);
46
47/**
48 * dln2_transfer - issue a DLN2 command and wait for a response and the
49 * associated data
50 *
51 * @pdev - the sub-device which is issuing this transfer
52 * @cmd - the command to be sent to the device
53 * @obuf - the buffer to be sent to the device; it can be NULL if the user
54 * doesn't need to transmit data with this command
55 * @obuf_len - the size of the buffer to be sent to the device
56 * @ibuf - any data associated with the response will be copied here; it can be
57 * NULL if the user doesn't need the response data
58 * @ibuf_len - must be initialized to the input buffer size; it will be modified
59 * to indicate the actual data transferred;
60 *
61 * @return 0 for success, negative value for errors
62 */
63int dln2_transfer(struct platform_device *pdev, u16 cmd,
64 const void *obuf, unsigned obuf_len,
65 void *ibuf, unsigned *ibuf_len);
66
67/**
68 * dln2_transfer_rx - variant of @dln2_transfer() where TX buffer is not needed
69 *
70 * @pdev - the sub-device which is issuing this transfer
71 * @cmd - the command to be sent to the device
72 * @ibuf - any data associated with the response will be copied here; it can be
73 * NULL if the user doesn't need the response data
74 * @ibuf_len - must be initialized to the input buffer size; it will be modified
75 * to indicate the actual data transferred;
76 *
77 * @return 0 for success, negative value for errors
78 */
79
80static inline int dln2_transfer_rx(struct platform_device *pdev, u16 cmd,
81 void *ibuf, unsigned *ibuf_len)
82{
83 return dln2_transfer(pdev, cmd, NULL, 0, ibuf, ibuf_len);
84}
85
86/**
87 * dln2_transfer_tx - variant of @dln2_transfer() where RX buffer is not needed
88 *
89 * @pdev - the sub-device which is issuing this transfer
90 * @cmd - the command to be sent to the device
91 * @obuf - the buffer to be sent to the device; it can be NULL if the
92 * user doesn't need to transmit data with this command
93 * @obuf_len - the size of the buffer to be sent to the device
94 *
95 * @return 0 for success, negative value for errors
96 */
97static inline int dln2_transfer_tx(struct platform_device *pdev, u16 cmd,
98 const void *obuf, unsigned obuf_len)
99{
100 return dln2_transfer(pdev, cmd, obuf, obuf_len, NULL, NULL);
101}
102
103#endif
diff --git a/include/linux/mfd/max77686.h b/include/linux/mfd/max77686.h
index 7e6dc4b2b795..553f7d09258a 100644
--- a/include/linux/mfd/max77686.h
+++ b/include/linux/mfd/max77686.h
@@ -131,13 +131,6 @@ enum max77686_opmode {
131 MAX77686_OPMODE_STANDBY, 131 MAX77686_OPMODE_STANDBY,
132}; 132};
133 133
134enum max77802_opmode {
135 MAX77802_OPMODE_OFF,
136 MAX77802_OPMODE_STANDBY,
137 MAX77802_OPMODE_LP,
138 MAX77802_OPMODE_NORMAL,
139};
140
141struct max77686_opmode_data { 134struct max77686_opmode_data {
142 int id; 135 int id;
143 int mode; 136 int mode;
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 582e67f34054..08dae01258b9 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -26,7 +26,6 @@
26 26
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28 28
29#define MAX77693_NUM_IRQ_MUIC_REGS 3
30#define MAX77693_REG_INVALID (0xff) 29#define MAX77693_REG_INVALID (0xff)
31 30
32/* Slave addr = 0xCC: PMIC, Charger, Flash LED */ 31/* Slave addr = 0xCC: PMIC, Charger, Flash LED */
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 74346d5e7899..0c12628e91c6 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -558,6 +558,7 @@
558#define SD_SAMPLE_POINT_CTL 0xFDA7 558#define SD_SAMPLE_POINT_CTL 0xFDA7
559#define SD_PUSH_POINT_CTL 0xFDA8 559#define SD_PUSH_POINT_CTL 0xFDA8
560#define SD_CMD0 0xFDA9 560#define SD_CMD0 0xFDA9
561#define SD_CMD_START 0x40
561#define SD_CMD1 0xFDAA 562#define SD_CMD1 0xFDAA
562#define SD_CMD2 0xFDAB 563#define SD_CMD2 0xFDAB
563#define SD_CMD3 0xFDAC 564#define SD_CMD3 0xFDAC
@@ -707,6 +708,14 @@
707#define PM_CTRL1 0xFF44 708#define PM_CTRL1 0xFF44
708#define PM_CTRL2 0xFF45 709#define PM_CTRL2 0xFF45
709#define PM_CTRL3 0xFF46 710#define PM_CTRL3 0xFF46
711#define SDIO_SEND_PME_EN 0x80
712#define FORCE_RC_MODE_ON 0x40
713#define FORCE_RX50_LINK_ON 0x20
714#define D3_DELINK_MODE_EN 0x10
715#define USE_PESRTB_CTL_DELINK 0x08
716#define DELAY_PIN_WAKE 0x04
717#define RESET_PIN_WAKE 0x02
718#define PM_WAKE_EN 0x01
710#define PM_CTRL4 0xFF47 719#define PM_CTRL4 0xFF47
711 720
712/* Memory mapping */ 721/* Memory mapping */
@@ -752,6 +761,14 @@
752#define PHY_DUM_REG 0x1F 761#define PHY_DUM_REG 0x1F
753 762
754#define LCTLR 0x80 763#define LCTLR 0x80
764#define LCTLR_EXT_SYNC 0x80
765#define LCTLR_COMMON_CLOCK_CFG 0x40
766#define LCTLR_RETRAIN_LINK 0x20
767#define LCTLR_LINK_DISABLE 0x10
768#define LCTLR_RCB 0x08
769#define LCTLR_RESERVED 0x04
770#define LCTLR_ASPM_CTL_MASK 0x03
771
755#define PCR_SETTING_REG1 0x724 772#define PCR_SETTING_REG1 0x724
756#define PCR_SETTING_REG2 0x814 773#define PCR_SETTING_REG2 0x814
757#define PCR_SETTING_REG3 0x747 774#define PCR_SETTING_REG3 0x747
@@ -967,4 +984,24 @@ static inline u8 *rtsx_pci_get_cmd_data(struct rtsx_pcr *pcr)
967 return (u8 *)(pcr->host_cmds_ptr); 984 return (u8 *)(pcr->host_cmds_ptr);
968} 985}
969 986
987static inline int rtsx_pci_update_cfg_byte(struct rtsx_pcr *pcr, int addr,
988 u8 mask, u8 append)
989{
990 int err;
991 u8 val;
992
993 err = pci_read_config_byte(pcr->pci, addr, &val);
994 if (err < 0)
995 return err;
996 return pci_write_config_byte(pcr->pci, addr, (val & mask) | append);
997}
998
999static inline void rtsx_pci_write_be32(struct rtsx_pcr *pcr, u16 reg, u32 val)
1000{
1001 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg, 0xFF, val >> 24);
1002 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 1, 0xFF, val >> 16);
1003 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 2, 0xFF, val >> 8);
1004 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 3, 0xFF, val);
1005}
1006
970#endif 1007#endif
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 1825edacbda7..3fdb7cfbffb3 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -28,6 +28,7 @@
28#define MIN_800_MV 800000 28#define MIN_800_MV 800000
29#define MIN_750_MV 750000 29#define MIN_750_MV 750000
30#define MIN_600_MV 600000 30#define MIN_600_MV 600000
31#define MIN_500_MV 500000
31 32
32/* Macros to represent steps for LDO/BUCK */ 33/* Macros to represent steps for LDO/BUCK */
33#define STEP_50_MV 50000 34#define STEP_50_MV 50000
@@ -41,6 +42,7 @@ enum sec_device_type {
41 S5M8767X, 42 S5M8767X,
42 S2MPA01, 43 S2MPA01,
43 S2MPS11X, 44 S2MPS11X,
45 S2MPS13X,
44 S2MPS14X, 46 S2MPS14X,
45 S2MPU02, 47 S2MPU02,
46}; 48};
diff --git a/include/linux/mfd/samsung/s2mps13.h b/include/linux/mfd/samsung/s2mps13.h
new file mode 100644
index 000000000000..ce5dda8958fe
--- /dev/null
+++ b/include/linux/mfd/samsung/s2mps13.h
@@ -0,0 +1,186 @@
1/*
2 * s2mps13.h
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#ifndef __LINUX_MFD_S2MPS13_H
20#define __LINUX_MFD_S2MPS13_H
21
22/* S2MPS13 registers */
23enum s2mps13_reg {
24 S2MPS13_REG_ID,
25 S2MPS13_REG_INT1,
26 S2MPS13_REG_INT2,
27 S2MPS13_REG_INT3,
28 S2MPS13_REG_INT1M,
29 S2MPS13_REG_INT2M,
30 S2MPS13_REG_INT3M,
31 S2MPS13_REG_ST1,
32 S2MPS13_REG_ST2,
33 S2MPS13_REG_PWRONSRC,
34 S2MPS13_REG_OFFSRC,
35 S2MPS13_REG_BU_CHG,
36 S2MPS13_REG_RTCCTRL,
37 S2MPS13_REG_CTRL1,
38 S2MPS13_REG_CTRL2,
39 S2MPS13_REG_RSVD1,
40 S2MPS13_REG_RSVD2,
41 S2MPS13_REG_RSVD3,
42 S2MPS13_REG_RSVD4,
43 S2MPS13_REG_RSVD5,
44 S2MPS13_REG_RSVD6,
45 S2MPS13_REG_CTRL3,
46 S2MPS13_REG_RSVD7,
47 S2MPS13_REG_RSVD8,
48 S2MPS13_REG_WRSTBI,
49 S2MPS13_REG_B1CTRL,
50 S2MPS13_REG_B1OUT,
51 S2MPS13_REG_B2CTRL,
52 S2MPS13_REG_B2OUT,
53 S2MPS13_REG_B3CTRL,
54 S2MPS13_REG_B3OUT,
55 S2MPS13_REG_B4CTRL,
56 S2MPS13_REG_B4OUT,
57 S2MPS13_REG_B5CTRL,
58 S2MPS13_REG_B5OUT,
59 S2MPS13_REG_B6CTRL,
60 S2MPS13_REG_B6OUT,
61 S2MPS13_REG_B7CTRL,
62 S2MPS13_REG_B7OUT,
63 S2MPS13_REG_B8CTRL,
64 S2MPS13_REG_B8OUT,
65 S2MPS13_REG_B9CTRL,
66 S2MPS13_REG_B9OUT,
67 S2MPS13_REG_B10CTRL,
68 S2MPS13_REG_B10OUT,
69 S2MPS13_REG_BB1CTRL,
70 S2MPS13_REG_BB1OUT,
71 S2MPS13_REG_BUCK_RAMP1,
72 S2MPS13_REG_BUCK_RAMP2,
73 S2MPS13_REG_LDO_DVS1,
74 S2MPS13_REG_LDO_DVS2,
75 S2MPS13_REG_LDO_DVS3,
76 S2MPS13_REG_B6OUT2,
77 S2MPS13_REG_L1CTRL,
78 S2MPS13_REG_L2CTRL,
79 S2MPS13_REG_L3CTRL,
80 S2MPS13_REG_L4CTRL,
81 S2MPS13_REG_L5CTRL,
82 S2MPS13_REG_L6CTRL,
83 S2MPS13_REG_L7CTRL,
84 S2MPS13_REG_L8CTRL,
85 S2MPS13_REG_L9CTRL,
86 S2MPS13_REG_L10CTRL,
87 S2MPS13_REG_L11CTRL,
88 S2MPS13_REG_L12CTRL,
89 S2MPS13_REG_L13CTRL,
90 S2MPS13_REG_L14CTRL,
91 S2MPS13_REG_L15CTRL,
92 S2MPS13_REG_L16CTRL,
93 S2MPS13_REG_L17CTRL,
94 S2MPS13_REG_L18CTRL,
95 S2MPS13_REG_L19CTRL,
96 S2MPS13_REG_L20CTRL,
97 S2MPS13_REG_L21CTRL,
98 S2MPS13_REG_L22CTRL,
99 S2MPS13_REG_L23CTRL,
100 S2MPS13_REG_L24CTRL,
101 S2MPS13_REG_L25CTRL,
102 S2MPS13_REG_L26CTRL,
103 S2MPS13_REG_L27CTRL,
104 S2MPS13_REG_L28CTRL,
105 S2MPS13_REG_L30CTRL,
106 S2MPS13_REG_L31CTRL,
107 S2MPS13_REG_L32CTRL,
108 S2MPS13_REG_L33CTRL,
109 S2MPS13_REG_L34CTRL,
110 S2MPS13_REG_L35CTRL,
111 S2MPS13_REG_L36CTRL,
112 S2MPS13_REG_L37CTRL,
113 S2MPS13_REG_L38CTRL,
114 S2MPS13_REG_L39CTRL,
115 S2MPS13_REG_L40CTRL,
116 S2MPS13_REG_LDODSCH1,
117 S2MPS13_REG_LDODSCH2,
118 S2MPS13_REG_LDODSCH3,
119 S2MPS13_REG_LDODSCH4,
120 S2MPS13_REG_LDODSCH5,
121};
122
123/* regulator ids */
124enum s2mps13_regulators {
125 S2MPS13_LDO1,
126 S2MPS13_LDO2,
127 S2MPS13_LDO3,
128 S2MPS13_LDO4,
129 S2MPS13_LDO5,
130 S2MPS13_LDO6,
131 S2MPS13_LDO7,
132 S2MPS13_LDO8,
133 S2MPS13_LDO9,
134 S2MPS13_LDO10,
135 S2MPS13_LDO11,
136 S2MPS13_LDO12,
137 S2MPS13_LDO13,
138 S2MPS13_LDO14,
139 S2MPS13_LDO15,
140 S2MPS13_LDO16,
141 S2MPS13_LDO17,
142 S2MPS13_LDO18,
143 S2MPS13_LDO19,
144 S2MPS13_LDO20,
145 S2MPS13_LDO21,
146 S2MPS13_LDO22,
147 S2MPS13_LDO23,
148 S2MPS13_LDO24,
149 S2MPS13_LDO25,
150 S2MPS13_LDO26,
151 S2MPS13_LDO27,
152 S2MPS13_LDO28,
153 S2MPS13_LDO29,
154 S2MPS13_LDO30,
155 S2MPS13_LDO31,
156 S2MPS13_LDO32,
157 S2MPS13_LDO33,
158 S2MPS13_LDO34,
159 S2MPS13_LDO35,
160 S2MPS13_LDO36,
161 S2MPS13_LDO37,
162 S2MPS13_LDO38,
163 S2MPS13_LDO39,
164 S2MPS13_LDO40,
165 S2MPS13_BUCK1,
166 S2MPS13_BUCK2,
167 S2MPS13_BUCK3,
168 S2MPS13_BUCK4,
169 S2MPS13_BUCK5,
170 S2MPS13_BUCK6,
171 S2MPS13_BUCK7,
172 S2MPS13_BUCK8,
173 S2MPS13_BUCK9,
174 S2MPS13_BUCK10,
175
176 S2MPS13_REGULATOR_MAX,
177};
178
179/*
180 * Default ramp delay in uv/us. Datasheet says that ramp delay can be
181 * controlled however it does not specify which register is used for that.
182 * Let's assume that default value will be set.
183 */
184#define S2MPS13_BUCK_RAMP_DELAY 12500
185
186#endif /* __LINUX_MFD_S2MPS13_H */
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
index ff44374a1a4e..c877cad61a13 100644
--- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -395,4 +395,43 @@
395#define IMX6SL_GPR1_FEC_CLOCK_MUX1_SEL_MASK (0x3 << 17) 395#define IMX6SL_GPR1_FEC_CLOCK_MUX1_SEL_MASK (0x3 << 17)
396#define IMX6SL_GPR1_FEC_CLOCK_MUX2_SEL_MASK (0x1 << 14) 396#define IMX6SL_GPR1_FEC_CLOCK_MUX2_SEL_MASK (0x1 << 14)
397 397
398/* For imx6sx iomux gpr register field define */
399#define IMX6SX_GPR1_VDEC_SW_RST_MASK (0x1 << 20)
400#define IMX6SX_GPR1_VDEC_SW_RST_RESET (0x1 << 20)
401#define IMX6SX_GPR1_VDEC_SW_RST_RELEASE (0x0 << 20)
402#define IMX6SX_GPR1_VADC_SW_RST_MASK (0x1 << 19)
403#define IMX6SX_GPR1_VADC_SW_RST_RESET (0x1 << 19)
404#define IMX6SX_GPR1_VADC_SW_RST_RELEASE (0x0 << 19)
405#define IMX6SX_GPR1_FEC_CLOCK_MUX_SEL_MASK (0x3 << 13)
406#define IMX6SX_GPR1_FEC_CLOCK_PAD_DIR_MASK (0x3 << 17)
407#define IMX6SX_GPR1_FEC_CLOCK_MUX_SEL_EXT (0x3 << 13)
408
409#define IMX6SX_GPR4_FEC_ENET1_STOP_REQ (0x1 << 3)
410#define IMX6SX_GPR4_FEC_ENET2_STOP_REQ (0x1 << 4)
411
412#define IMX6SX_GPR5_DISP_MUX_LDB_CTRL_MASK (0x1 << 3)
413#define IMX6SX_GPR5_DISP_MUX_LDB_CTRL_LCDIF1 (0x0 << 3)
414#define IMX6SX_GPR5_DISP_MUX_LDB_CTRL_LCDIF2 (0x1 << 3)
415
416#define IMX6SX_GPR5_CSI2_MUX_CTRL_MASK (0x3 << 27)
417#define IMX6SX_GPR5_CSI2_MUX_CTRL_EXT_PIN (0x0 << 27)
418#define IMX6SX_GPR5_CSI2_MUX_CTRL_CVD (0x1 << 27)
419#define IMX6SX_GPR5_CSI2_MUX_CTRL_VDAC_TO_CSI (0x2 << 27)
420#define IMX6SX_GPR5_CSI2_MUX_CTRL_GND (0x3 << 27)
421#define IMX6SX_GPR5_VADC_TO_CSI_CAPTURE_EN_MASK (0x1 << 26)
422#define IMX6SX_GPR5_VADC_TO_CSI_CAPTURE_EN_ENABLE (0x1 << 26)
423#define IMX6SX_GPR5_VADC_TO_CSI_CAPTURE_EN_DISABLE (0x0 << 26)
424#define IMX6SX_GPR5_CSI1_MUX_CTRL_MASK (0x3 << 4)
425#define IMX6SX_GPR5_CSI1_MUX_CTRL_EXT_PIN (0x0 << 4)
426#define IMX6SX_GPR5_CSI1_MUX_CTRL_CVD (0x1 << 4)
427#define IMX6SX_GPR5_CSI1_MUX_CTRL_VDAC_TO_CSI (0x2 << 4)
428#define IMX6SX_GPR5_CSI1_MUX_CTRL_GND (0x3 << 4)
429
430#define IMX6SX_GPR5_DISP_MUX_DCIC2_LCDIF2 (0x0 << 2)
431#define IMX6SX_GPR5_DISP_MUX_DCIC2_LVDS (0x1 << 2)
432#define IMX6SX_GPR5_DISP_MUX_DCIC2_MASK (0x1 << 2)
433#define IMX6SX_GPR5_DISP_MUX_DCIC1_LCDIF1 (0x0 << 1)
434#define IMX6SX_GPR5_DISP_MUX_DCIC1_LVDS (0x1 << 1)
435#define IMX6SX_GPR5_DISP_MUX_DCIC1_MASK (0x1 << 1)
436
398#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */ 437#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index e6088c2e2092..e1c12d84c26a 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -164,13 +164,10 @@ struct tc3589x_keypad_platform_data {
164 164
165/** 165/**
166 * struct tc3589x_gpio_platform_data - TC3589x GPIO platform data 166 * struct tc3589x_gpio_platform_data - TC3589x GPIO platform data
167 * @gpio_base: first gpio number assigned to TC3589x. A maximum of
168 * %TC3589x_NR_GPIOS GPIOs will be allocated.
169 * @setup: callback for board-specific initialization 167 * @setup: callback for board-specific initialization
170 * @remove: callback for board-specific teardown 168 * @remove: callback for board-specific teardown
171 */ 169 */
172struct tc3589x_gpio_platform_data { 170struct tc3589x_gpio_platform_data {
173 int gpio_base;
174 void (*setup)(struct tc3589x *tc3589x, unsigned gpio_base); 171 void (*setup)(struct tc3589x *tc3589x, unsigned gpio_base);
175 void (*remove)(struct tc3589x *tc3589x, unsigned gpio_base); 172 void (*remove)(struct tc3589x *tc3589x, unsigned gpio_base);
176}; 173};
@@ -178,18 +175,13 @@ struct tc3589x_gpio_platform_data {
178/** 175/**
179 * struct tc3589x_platform_data - TC3589x platform data 176 * struct tc3589x_platform_data - TC3589x platform data
180 * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*) 177 * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
181 * @irq_base: base IRQ number. %TC3589x_NR_IRQS irqs will be used.
182 * @gpio: GPIO-specific platform data 178 * @gpio: GPIO-specific platform data
183 * @keypad: keypad-specific platform data 179 * @keypad: keypad-specific platform data
184 */ 180 */
185struct tc3589x_platform_data { 181struct tc3589x_platform_data {
186 unsigned int block; 182 unsigned int block;
187 int irq_base;
188 struct tc3589x_gpio_platform_data *gpio; 183 struct tc3589x_gpio_platform_data *gpio;
189 const struct tc3589x_keypad_platform_data *keypad; 184 const struct tc3589x_keypad_platform_data *keypad;
190}; 185};
191 186
192#define TC3589x_NR_GPIOS 24
193#define TC3589x_NR_IRQS TC3589x_INT_GPIO(TC3589x_NR_GPIOS)
194
195#endif 187#endif
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 53d33dee70e1..2e5b194b9b19 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -37,7 +37,6 @@
37 37
38/* struct phy_device dev_flags definitions */ 38/* struct phy_device dev_flags definitions */
39#define MICREL_PHY_50MHZ_CLK 0x00000001 39#define MICREL_PHY_50MHZ_CLK 0x00000001
40#define MICREL_PHY_25MHZ_CLK 0x00000002
41 40
42#define MICREL_KSZ9021_EXTREG_CTRL 0xB 41#define MICREL_KSZ9021_EXTREG_CTRL 0xB
43#define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC 42#define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 379c02648ab3..64d25941b329 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -67,6 +67,8 @@ enum {
67 MLX4_CMD_MAP_ICM_AUX = 0xffc, 67 MLX4_CMD_MAP_ICM_AUX = 0xffc,
68 MLX4_CMD_UNMAP_ICM_AUX = 0xffb, 68 MLX4_CMD_UNMAP_ICM_AUX = 0xffb,
69 MLX4_CMD_SET_ICM_SIZE = 0xffd, 69 MLX4_CMD_SET_ICM_SIZE = 0xffd,
70 MLX4_CMD_ACCESS_REG = 0x3b,
71
70 /*master notify fw on finish for slave's flr*/ 72 /*master notify fw on finish for slave's flr*/
71 MLX4_CMD_INFORM_FLR_DONE = 0x5b, 73 MLX4_CMD_INFORM_FLR_DONE = 0x5b,
72 MLX4_CMD_GET_OP_REQ = 0x59, 74 MLX4_CMD_GET_OP_REQ = 0x59,
@@ -197,6 +199,33 @@ enum {
197 MLX4_CMD_NATIVE 199 MLX4_CMD_NATIVE
198}; 200};
199 201
202/*
203 * MLX4_RX_CSUM_MODE_VAL_NON_TCP_UDP -
204 * Receive checksum value is reported in CQE also for non TCP/UDP packets.
205 *
206 * MLX4_RX_CSUM_MODE_L4 -
207 * L4_CSUM bit in CQE, which indicates whether or not L4 checksum
208 * was validated correctly, is supported.
209 *
210 * MLX4_RX_CSUM_MODE_IP_OK_IP_NON_TCP_UDP -
211 * IP_OK CQE's field is supported also for non TCP/UDP IP packets.
212 *
213 * MLX4_RX_CSUM_MODE_MULTI_VLAN -
214 * Receive Checksum offload is supported for packets with more than 2 vlan headers.
215 */
216enum mlx4_rx_csum_mode {
217 MLX4_RX_CSUM_MODE_VAL_NON_TCP_UDP = 1UL << 0,
218 MLX4_RX_CSUM_MODE_L4 = 1UL << 1,
219 MLX4_RX_CSUM_MODE_IP_OK_IP_NON_TCP_UDP = 1UL << 2,
220 MLX4_RX_CSUM_MODE_MULTI_VLAN = 1UL << 3
221};
222
223struct mlx4_config_dev_params {
224 u16 vxlan_udp_dport;
225 u8 rx_csum_flags_port_1;
226 u8 rx_csum_flags_port_2;
227};
228
200struct mlx4_dev; 229struct mlx4_dev;
201 230
202struct mlx4_cmd_mailbox { 231struct mlx4_cmd_mailbox {
@@ -248,6 +277,8 @@ int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
248int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); 277int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
249int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); 278int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf);
250int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state); 279int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state);
280int mlx4_config_dev_retrieval(struct mlx4_dev *dev,
281 struct mlx4_config_dev_params *params);
251/* 282/*
252 * mlx4_get_slave_default_vlan - 283 * mlx4_get_slave_default_vlan -
253 * return true if VST ( default vlan) 284 * return true if VST ( default vlan)
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 37e4404d0227..25c791e295fd 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -95,7 +95,7 @@ enum {
95 95
96enum { 96enum {
97 MLX4_MAX_NUM_PF = 16, 97 MLX4_MAX_NUM_PF = 16,
98 MLX4_MAX_NUM_VF = 64, 98 MLX4_MAX_NUM_VF = 126,
99 MLX4_MAX_NUM_VF_P_PORT = 64, 99 MLX4_MAX_NUM_VF_P_PORT = 64,
100 MLX4_MFUNC_MAX = 80, 100 MLX4_MFUNC_MAX = 80,
101 MLX4_MAX_EQ_NUM = 1024, 101 MLX4_MAX_EQ_NUM = 1024,
@@ -117,6 +117,14 @@ enum {
117 MLX4_STEERING_MODE_DEVICE_MANAGED 117 MLX4_STEERING_MODE_DEVICE_MANAGED
118}; 118};
119 119
120enum {
121 MLX4_STEERING_DMFS_A0_DEFAULT,
122 MLX4_STEERING_DMFS_A0_DYNAMIC,
123 MLX4_STEERING_DMFS_A0_STATIC,
124 MLX4_STEERING_DMFS_A0_DISABLE,
125 MLX4_STEERING_DMFS_A0_NOT_SUPPORTED
126};
127
120static inline const char *mlx4_steering_mode_str(int steering_mode) 128static inline const char *mlx4_steering_mode_str(int steering_mode)
121{ 129{
122 switch (steering_mode) { 130 switch (steering_mode) {
@@ -186,7 +194,31 @@ enum {
186 MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10, 194 MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10,
187 MLX4_DEV_CAP_FLAG2_MAD_DEMUX = 1LL << 11, 195 MLX4_DEV_CAP_FLAG2_MAD_DEMUX = 1LL << 11,
188 MLX4_DEV_CAP_FLAG2_CQE_STRIDE = 1LL << 12, 196 MLX4_DEV_CAP_FLAG2_CQE_STRIDE = 1LL << 12,
189 MLX4_DEV_CAP_FLAG2_EQE_STRIDE = 1LL << 13 197 MLX4_DEV_CAP_FLAG2_EQE_STRIDE = 1LL << 13,
198 MLX4_DEV_CAP_FLAG2_ETH_PROT_CTRL = 1LL << 14,
199 MLX4_DEV_CAP_FLAG2_ETH_BACKPL_AN_REP = 1LL << 15,
200 MLX4_DEV_CAP_FLAG2_CONFIG_DEV = 1LL << 16,
201 MLX4_DEV_CAP_FLAG2_SYS_EQS = 1LL << 17,
202 MLX4_DEV_CAP_FLAG2_80_VFS = 1LL << 18,
203 MLX4_DEV_CAP_FLAG2_FS_A0 = 1LL << 19
204};
205
206enum {
207 MLX4_QUERY_FUNC_FLAGS_BF_RES_QP = 1LL << 0,
208 MLX4_QUERY_FUNC_FLAGS_A0_RES_QP = 1LL << 1
209};
210
211/* bit enums for an 8-bit flags field indicating special use
212 * QPs which require special handling in qp_reserve_range.
213 * Currently, this only includes QPs used by the ETH interface,
214 * where we expect to use blueflame. These QPs must not have
215 * bits 6 and 7 set in their qp number.
216 *
217 * This enum may use only bits 0..7.
218 */
219enum {
220 MLX4_RESERVE_A0_QP = 1 << 6,
221 MLX4_RESERVE_ETH_BF_QP = 1 << 7,
190}; 222};
191 223
192enum { 224enum {
@@ -202,7 +234,8 @@ enum {
202 234
203enum { 235enum {
204 MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0, 236 MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0,
205 MLX4_FUNC_CAP_EQE_CQE_STRIDE = 1L << 1 237 MLX4_FUNC_CAP_EQE_CQE_STRIDE = 1L << 1,
238 MLX4_FUNC_CAP_DMFS_A0_STATIC = 1L << 2
206}; 239};
207 240
208 241
@@ -328,6 +361,8 @@ enum {
328 361
329enum mlx4_qp_region { 362enum mlx4_qp_region {
330 MLX4_QP_REGION_FW = 0, 363 MLX4_QP_REGION_FW = 0,
364 MLX4_QP_REGION_RSS_RAW_ETH,
365 MLX4_QP_REGION_BOTTOM = MLX4_QP_REGION_RSS_RAW_ETH,
331 MLX4_QP_REGION_ETH_ADDR, 366 MLX4_QP_REGION_ETH_ADDR,
332 MLX4_QP_REGION_FC_ADDR, 367 MLX4_QP_REGION_FC_ADDR,
333 MLX4_QP_REGION_FC_EXCH, 368 MLX4_QP_REGION_FC_EXCH,
@@ -379,6 +414,13 @@ enum {
379#define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \ 414#define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \
380 MLX4_EQ_PORT_INFO_MSTR_SM_LID_CHANGE_MASK) 415 MLX4_EQ_PORT_INFO_MSTR_SM_LID_CHANGE_MASK)
381 416
417enum mlx4_module_id {
418 MLX4_MODULE_ID_SFP = 0x3,
419 MLX4_MODULE_ID_QSFP = 0xC,
420 MLX4_MODULE_ID_QSFP_PLUS = 0xD,
421 MLX4_MODULE_ID_QSFP28 = 0x11,
422};
423
382static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) 424static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
383{ 425{
384 return (major << 32) | (minor << 16) | subminor; 426 return (major << 32) | (minor << 16) | subminor;
@@ -433,6 +475,7 @@ struct mlx4_caps {
433 int num_cqs; 475 int num_cqs;
434 int max_cqes; 476 int max_cqes;
435 int reserved_cqs; 477 int reserved_cqs;
478 int num_sys_eqs;
436 int num_eqs; 479 int num_eqs;
437 int reserved_eqs; 480 int reserved_eqs;
438 int num_comp_vectors; 481 int num_comp_vectors;
@@ -449,6 +492,7 @@ struct mlx4_caps {
449 int reserved_mcgs; 492 int reserved_mcgs;
450 int num_qp_per_mgm; 493 int num_qp_per_mgm;
451 int steering_mode; 494 int steering_mode;
495 int dmfs_high_steer_mode;
452 int fs_log_max_ucast_qp_range_size; 496 int fs_log_max_ucast_qp_range_size;
453 int num_pds; 497 int num_pds;
454 int reserved_pds; 498 int reserved_pds;
@@ -487,6 +531,10 @@ struct mlx4_caps {
487 u16 hca_core_clock; 531 u16 hca_core_clock;
488 u64 phys_port_id[MLX4_MAX_PORTS + 1]; 532 u64 phys_port_id[MLX4_MAX_PORTS + 1];
489 int tunnel_offload_mode; 533 int tunnel_offload_mode;
534 u8 rx_checksum_flags_port[MLX4_MAX_PORTS + 1];
535 u8 alloc_res_qp_mask;
536 u32 dmfs_high_rate_qpn_base;
537 u32 dmfs_high_rate_qpn_range;
490}; 538};
491 539
492struct mlx4_buf_list { 540struct mlx4_buf_list {
@@ -607,6 +655,11 @@ struct mlx4_cq {
607 655
608 atomic_t refcount; 656 atomic_t refcount;
609 struct completion free; 657 struct completion free;
658 struct {
659 struct list_head list;
660 void (*comp)(struct mlx4_cq *);
661 void *priv;
662 } tasklet_ctx;
610}; 663};
611 664
612struct mlx4_qp { 665struct mlx4_qp {
@@ -799,6 +852,26 @@ struct mlx4_init_port_param {
799 u64 si_guid; 852 u64 si_guid;
800}; 853};
801 854
855#define MAD_IFC_DATA_SZ 192
856/* MAD IFC Mailbox */
857struct mlx4_mad_ifc {
858 u8 base_version;
859 u8 mgmt_class;
860 u8 class_version;
861 u8 method;
862 __be16 status;
863 __be16 class_specific;
864 __be64 tid;
865 __be16 attr_id;
866 __be16 resv;
867 __be32 attr_mod;
868 __be64 mkey;
869 __be16 dr_slid;
870 __be16 dr_dlid;
871 u8 reserved[28];
872 u8 data[MAD_IFC_DATA_SZ];
873} __packed;
874
802#define mlx4_foreach_port(port, dev, type) \ 875#define mlx4_foreach_port(port, dev, type) \
803 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 876 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
804 if ((type) == (dev)->caps.port_mask[(port)]) 877 if ((type) == (dev)->caps.port_mask[(port)])
@@ -835,7 +908,9 @@ static inline int mlx4_num_reserved_sqps(struct mlx4_dev *dev)
835static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn) 908static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn)
836{ 909{
837 return (qpn < dev->phys_caps.base_sqpn + 8 + 910 return (qpn < dev->phys_caps.base_sqpn + 8 +
838 16 * MLX4_MFUNC_MAX * !!mlx4_is_master(dev)); 911 16 * MLX4_MFUNC_MAX * !!mlx4_is_master(dev) &&
912 qpn >= dev->phys_caps.base_sqpn) ||
913 (qpn < dev->caps.reserved_qps_cnt[MLX4_QP_REGION_FW]);
839} 914}
840 915
841static inline int mlx4_is_guest_proxy(struct mlx4_dev *dev, int slave, u32 qpn) 916static inline int mlx4_is_guest_proxy(struct mlx4_dev *dev, int slave, u32 qpn)
@@ -911,8 +986,8 @@ int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,
911 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, 986 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq,
912 unsigned vector, int collapsed, int timestamp_en); 987 unsigned vector, int collapsed, int timestamp_en);
913void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); 988void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq);
914 989int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align,
915int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); 990 int *base, u8 flags);
916void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt); 991void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt);
917 992
918int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp, 993int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp,
@@ -1283,10 +1358,50 @@ int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr,
1283 u64 iova, u64 size, int npages, 1358 u64 iova, u64 size, int npages,
1284 int page_shift, struct mlx4_mpt_entry *mpt_entry); 1359 int page_shift, struct mlx4_mpt_entry *mpt_entry);
1285 1360
1361int mlx4_get_module_info(struct mlx4_dev *dev, u8 port,
1362 u16 offset, u16 size, u8 *data);
1363
1286/* Returns true if running in low memory profile (kdump kernel) */ 1364/* Returns true if running in low memory profile (kdump kernel) */
1287static inline bool mlx4_low_memory_profile(void) 1365static inline bool mlx4_low_memory_profile(void)
1288{ 1366{
1289 return is_kdump_kernel(); 1367 return is_kdump_kernel();
1290} 1368}
1291 1369
1370/* ACCESS REG commands */
1371enum mlx4_access_reg_method {
1372 MLX4_ACCESS_REG_QUERY = 0x1,
1373 MLX4_ACCESS_REG_WRITE = 0x2,
1374};
1375
1376/* ACCESS PTYS Reg command */
1377enum mlx4_ptys_proto {
1378 MLX4_PTYS_IB = 1<<0,
1379 MLX4_PTYS_EN = 1<<2,
1380};
1381
1382struct mlx4_ptys_reg {
1383 u8 resrvd1;
1384 u8 local_port;
1385 u8 resrvd2;
1386 u8 proto_mask;
1387 __be32 resrvd3[2];
1388 __be32 eth_proto_cap;
1389 __be16 ib_width_cap;
1390 __be16 ib_speed_cap;
1391 __be32 resrvd4;
1392 __be32 eth_proto_admin;
1393 __be16 ib_width_admin;
1394 __be16 ib_speed_admin;
1395 __be32 resrvd5;
1396 __be32 eth_proto_oper;
1397 __be16 ib_width_oper;
1398 __be16 ib_speed_oper;
1399 __be32 resrvd6;
1400 __be32 eth_proto_lp_adv;
1401} __packed;
1402
1403int mlx4_ACCESS_PTYS_REG(struct mlx4_dev *dev,
1404 enum mlx4_access_reg_method method,
1405 struct mlx4_ptys_reg *ptys_reg);
1406
1292#endif /* MLX4_DEVICE_H */ 1407#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 5f4e36cf0091..467ccdf94c98 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -120,13 +120,15 @@ enum {
120 MLX4_RSS_QPC_FLAG_OFFSET = 13, 120 MLX4_RSS_QPC_FLAG_OFFSET = 13,
121}; 121};
122 122
123#define MLX4_EN_RSS_KEY_SIZE 40
124
123struct mlx4_rss_context { 125struct mlx4_rss_context {
124 __be32 base_qpn; 126 __be32 base_qpn;
125 __be32 default_qpn; 127 __be32 default_qpn;
126 u16 reserved; 128 u16 reserved;
127 u8 hash_fn; 129 u8 hash_fn;
128 u8 flags; 130 u8 flags;
129 __be32 rss_key[10]; 131 __be32 rss_key[MLX4_EN_RSS_KEY_SIZE / sizeof(__be32)];
130 __be32 base_qpn_udp; 132 __be32 base_qpn_udp;
131}; 133};
132 134
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 1d67fd32e71c..ea4f1c46f761 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -219,23 +219,15 @@ enum {
219}; 219};
220 220
221enum { 221enum {
222 MLX5_DEV_CAP_FLAG_RC = 1LL << 0,
223 MLX5_DEV_CAP_FLAG_UC = 1LL << 1,
224 MLX5_DEV_CAP_FLAG_UD = 1LL << 2,
225 MLX5_DEV_CAP_FLAG_XRC = 1LL << 3, 222 MLX5_DEV_CAP_FLAG_XRC = 1LL << 3,
226 MLX5_DEV_CAP_FLAG_SRQ = 1LL << 6,
227 MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8, 223 MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8,
228 MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9, 224 MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9,
229 MLX5_DEV_CAP_FLAG_APM = 1LL << 17, 225 MLX5_DEV_CAP_FLAG_APM = 1LL << 17,
230 MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18, 226 MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18,
231 MLX5_DEV_CAP_FLAG_BLOCK_MCAST = 1LL << 23, 227 MLX5_DEV_CAP_FLAG_BLOCK_MCAST = 1LL << 23,
232 MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24,
233 MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29, 228 MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29,
234 MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30, 229 MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30,
235 MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32,
236 MLX5_DEV_CAP_FLAG_DCT = 1LL << 37, 230 MLX5_DEV_CAP_FLAG_DCT = 1LL << 37,
237 MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38,
238 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39,
239 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40, 231 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
240 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46, 232 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46,
241}; 233};
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 246310dc8bef..b1bf41556b32 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -633,14 +633,6 @@ static inline void *mlx5_vzalloc(unsigned long size)
633 return rtn; 633 return rtn;
634} 634}
635 635
636static inline void mlx5_vfree(const void *addr)
637{
638 if (addr && is_vmalloc_addr(addr))
639 vfree(addr);
640 else
641 kfree(addr);
642}
643
644static inline u32 mlx5_base_mkey(const u32 key) 636static inline u32 mlx5_base_mkey(const u32 key)
645{ 637{
646 return key & 0xffffff00u; 638 return key & 0xffffff00u;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index b46461116cd2..c0a67b894c4c 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -19,6 +19,7 @@
19#include <linux/bit_spinlock.h> 19#include <linux/bit_spinlock.h>
20#include <linux/shrinker.h> 20#include <linux/shrinker.h>
21#include <linux/resource.h> 21#include <linux/resource.h>
22#include <linux/page_ext.h>
22 23
23struct mempolicy; 24struct mempolicy;
24struct anon_vma; 25struct anon_vma;
@@ -56,6 +57,17 @@ extern int sysctl_legacy_va_layout;
56#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0)) 57#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0))
57#endif 58#endif
58 59
60/*
61 * To prevent common memory management code establishing
62 * a zero page mapping on a read fault.
63 * This macro should be defined within <asm/pgtable.h>.
64 * s390 does this to prevent multiplexing of hardware bits
65 * related to the physical page in case of virtualization.
66 */
67#ifndef mm_forbids_zeropage
68#define mm_forbids_zeropage(X) (0)
69#endif
70
59extern unsigned long sysctl_user_reserve_kbytes; 71extern unsigned long sysctl_user_reserve_kbytes;
60extern unsigned long sysctl_admin_reserve_kbytes; 72extern unsigned long sysctl_admin_reserve_kbytes;
61 73
@@ -128,6 +140,7 @@ extern unsigned int kobjsize(const void *objp);
128#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ 140#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
129#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ 141#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */
130#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */ 142#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */
143#define VM_ARCH_2 0x02000000
131#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */ 144#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */
132 145
133#ifdef CONFIG_MEM_SOFT_DIRTY 146#ifdef CONFIG_MEM_SOFT_DIRTY
@@ -155,6 +168,11 @@ extern unsigned int kobjsize(const void *objp);
155# define VM_MAPPED_COPY VM_ARCH_1 /* T if mapped copy of data (nommu mmap) */ 168# define VM_MAPPED_COPY VM_ARCH_1 /* T if mapped copy of data (nommu mmap) */
156#endif 169#endif
157 170
171#if defined(CONFIG_X86)
172/* MPX specific bounds table or bounds directory */
173# define VM_MPX VM_ARCH_2
174#endif
175
158#ifndef VM_GROWSUP 176#ifndef VM_GROWSUP
159# define VM_GROWSUP VM_NONE 177# define VM_GROWSUP VM_NONE
160#endif 178#endif
@@ -2043,7 +2061,22 @@ static inline void vm_stat_account(struct mm_struct *mm,
2043#endif /* CONFIG_PROC_FS */ 2061#endif /* CONFIG_PROC_FS */
2044 2062
2045#ifdef CONFIG_DEBUG_PAGEALLOC 2063#ifdef CONFIG_DEBUG_PAGEALLOC
2046extern void kernel_map_pages(struct page *page, int numpages, int enable); 2064extern bool _debug_pagealloc_enabled;
2065extern void __kernel_map_pages(struct page *page, int numpages, int enable);
2066
2067static inline bool debug_pagealloc_enabled(void)
2068{
2069 return _debug_pagealloc_enabled;
2070}
2071
2072static inline void
2073kernel_map_pages(struct page *page, int numpages, int enable)
2074{
2075 if (!debug_pagealloc_enabled())
2076 return;
2077
2078 __kernel_map_pages(page, numpages, enable);
2079}
2047#ifdef CONFIG_HIBERNATION 2080#ifdef CONFIG_HIBERNATION
2048extern bool kernel_page_present(struct page *page); 2081extern bool kernel_page_present(struct page *page);
2049#endif /* CONFIG_HIBERNATION */ 2082#endif /* CONFIG_HIBERNATION */
@@ -2077,9 +2110,9 @@ int drop_caches_sysctl_handler(struct ctl_table *, int,
2077 void __user *, size_t *, loff_t *); 2110 void __user *, size_t *, loff_t *);
2078#endif 2111#endif
2079 2112
2080unsigned long shrink_slab(struct shrink_control *shrink, 2113unsigned long shrink_node_slabs(gfp_t gfp_mask, int nid,
2081 unsigned long nr_pages_scanned, 2114 unsigned long nr_scanned,
2082 unsigned long lru_pages); 2115 unsigned long nr_eligible);
2083 2116
2084#ifndef CONFIG_MMU 2117#ifndef CONFIG_MMU
2085#define randomize_va_space 0 2118#define randomize_va_space 0
@@ -2138,20 +2171,36 @@ extern void copy_user_huge_page(struct page *dst, struct page *src,
2138 unsigned int pages_per_huge_page); 2171 unsigned int pages_per_huge_page);
2139#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ 2172#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
2140 2173
2174extern struct page_ext_operations debug_guardpage_ops;
2175extern struct page_ext_operations page_poisoning_ops;
2176
2141#ifdef CONFIG_DEBUG_PAGEALLOC 2177#ifdef CONFIG_DEBUG_PAGEALLOC
2142extern unsigned int _debug_guardpage_minorder; 2178extern unsigned int _debug_guardpage_minorder;
2179extern bool _debug_guardpage_enabled;
2143 2180
2144static inline unsigned int debug_guardpage_minorder(void) 2181static inline unsigned int debug_guardpage_minorder(void)
2145{ 2182{
2146 return _debug_guardpage_minorder; 2183 return _debug_guardpage_minorder;
2147} 2184}
2148 2185
2186static inline bool debug_guardpage_enabled(void)
2187{
2188 return _debug_guardpage_enabled;
2189}
2190
2149static inline bool page_is_guard(struct page *page) 2191static inline bool page_is_guard(struct page *page)
2150{ 2192{
2151 return test_bit(PAGE_DEBUG_FLAG_GUARD, &page->debug_flags); 2193 struct page_ext *page_ext;
2194
2195 if (!debug_guardpage_enabled())
2196 return false;
2197
2198 page_ext = lookup_page_ext(page);
2199 return test_bit(PAGE_EXT_DEBUG_GUARD, &page_ext->flags);
2152} 2200}
2153#else 2201#else
2154static inline unsigned int debug_guardpage_minorder(void) { return 0; } 2202static inline unsigned int debug_guardpage_minorder(void) { return 0; }
2203static inline bool debug_guardpage_enabled(void) { return false; }
2155static inline bool page_is_guard(struct page *page) { return false; } 2204static inline bool page_is_guard(struct page *page) { return false; }
2156#endif /* CONFIG_DEBUG_PAGEALLOC */ 2205#endif /* CONFIG_DEBUG_PAGEALLOC */
2157 2206
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 6e0b286649f1..6d34aa266a8c 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -10,7 +10,6 @@
10#include <linux/rwsem.h> 10#include <linux/rwsem.h>
11#include <linux/completion.h> 11#include <linux/completion.h>
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/page-debug-flags.h>
14#include <linux/uprobes.h> 13#include <linux/uprobes.h>
15#include <linux/page-flags-layout.h> 14#include <linux/page-flags-layout.h>
16#include <asm/page.h> 15#include <asm/page.h>
@@ -22,6 +21,7 @@
22#define AT_VECTOR_SIZE (2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1)) 21#define AT_VECTOR_SIZE (2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1))
23 22
24struct address_space; 23struct address_space;
24struct mem_cgroup;
25 25
26#define USE_SPLIT_PTE_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS) 26#define USE_SPLIT_PTE_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS)
27#define USE_SPLIT_PMD_PTLOCKS (USE_SPLIT_PTE_PTLOCKS && \ 27#define USE_SPLIT_PMD_PTLOCKS (USE_SPLIT_PTE_PTLOCKS && \
@@ -167,6 +167,10 @@ struct page {
167 struct page *first_page; /* Compound tail pages */ 167 struct page *first_page; /* Compound tail pages */
168 }; 168 };
169 169
170#ifdef CONFIG_MEMCG
171 struct mem_cgroup *mem_cgroup;
172#endif
173
170 /* 174 /*
171 * On machines where all RAM is mapped into kernel address space, 175 * On machines where all RAM is mapped into kernel address space,
172 * we can simply calculate the virtual address. On machines with 176 * we can simply calculate the virtual address. On machines with
@@ -181,9 +185,6 @@ struct page {
181 void *virtual; /* Kernel virtual address (NULL if 185 void *virtual; /* Kernel virtual address (NULL if
182 not kmapped, ie. highmem) */ 186 not kmapped, ie. highmem) */
183#endif /* WANT_PAGE_VIRTUAL */ 187#endif /* WANT_PAGE_VIRTUAL */
184#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
185 unsigned long debug_flags; /* Use atomic bitops on this */
186#endif
187 188
188#ifdef CONFIG_KMEMCHECK 189#ifdef CONFIG_KMEMCHECK
189 /* 190 /*
@@ -454,6 +455,10 @@ struct mm_struct {
454 bool tlb_flush_pending; 455 bool tlb_flush_pending;
455#endif 456#endif
456 struct uprobes_state uprobes_state; 457 struct uprobes_state uprobes_state;
458#ifdef CONFIG_X86_INTEL_MPX
459 /* address of the bounds directory */
460 void __user *bd_addr;
461#endif
457}; 462};
458 463
459static inline void mm_init_cpumask(struct mm_struct *mm) 464static inline void mm_init_cpumask(struct mm_struct *mm)
@@ -525,4 +530,12 @@ enum tlb_flush_reason {
525 NR_TLB_FLUSH_REASONS, 530 NR_TLB_FLUSH_REASONS,
526}; 531};
527 532
533 /*
534 * A swap entry has to fit into a "unsigned long", as the entry is hidden
535 * in the "index" field of the swapper address space.
536 */
537typedef struct {
538 unsigned long val;
539} swp_entry_t;
540
528#endif /* _LINUX_MM_TYPES_H */ 541#endif /* _LINUX_MM_TYPES_H */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index b0692d28f8e6..4d69c00497bd 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -88,6 +88,9 @@ struct mmc_ext_csd {
88 unsigned int data_tag_unit_size; /* DATA TAG UNIT size */ 88 unsigned int data_tag_unit_size; /* DATA TAG UNIT size */
89 unsigned int boot_ro_lock; /* ro lock support */ 89 unsigned int boot_ro_lock; /* ro lock support */
90 bool boot_ro_lockable; 90 bool boot_ro_lockable;
91 bool ffu_capable; /* Firmware upgrade support */
92#define MMC_FIRMWARE_LEN 8
93 u8 fwrev[MMC_FIRMWARE_LEN]; /* FW version */
91 u8 raw_exception_status; /* 54 */ 94 u8 raw_exception_status; /* 54 */
92 u8 raw_partition_support; /* 160 */ 95 u8 raw_partition_support; /* 160 */
93 u8 raw_rpmb_size_mult; /* 168 */ 96 u8 raw_rpmb_size_mult; /* 168 */
@@ -509,24 +512,8 @@ static inline int mmc_card_broken_irq_polling(const struct mmc_card *c)
509 512
510#define mmc_dev_to_card(d) container_of(d, struct mmc_card, dev) 513#define mmc_dev_to_card(d) container_of(d, struct mmc_card, dev)
511 514
512#define mmc_list_to_card(l) container_of(l, struct mmc_card, node) 515extern int mmc_register_driver(struct device_driver *);
513#define mmc_get_drvdata(c) dev_get_drvdata(&(c)->dev) 516extern void mmc_unregister_driver(struct device_driver *);
514#define mmc_set_drvdata(c,d) dev_set_drvdata(&(c)->dev, d)
515
516/*
517 * MMC device driver (e.g., Flash card, I/O card...)
518 */
519struct mmc_driver {
520 struct device_driver drv;
521 int (*probe)(struct mmc_card *);
522 void (*remove)(struct mmc_card *);
523 int (*suspend)(struct mmc_card *);
524 int (*resume)(struct mmc_card *);
525 void (*shutdown)(struct mmc_card *);
526};
527
528extern int mmc_register_driver(struct mmc_driver *);
529extern void mmc_unregister_driver(struct mmc_driver *);
530 517
531extern void mmc_fixup_device(struct mmc_card *card, 518extern void mmc_fixup_device(struct mmc_card *card,
532 const struct mmc_fixup *table); 519 const struct mmc_fixup *table);
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index f206e29f94d7..cb2b0400d284 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -154,7 +154,8 @@ extern void mmc_start_bkops(struct mmc_card *card, bool from_exception);
154extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool, 154extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool,
155 bool, bool); 155 bool, bool);
156extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); 156extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int);
157extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd); 157extern int mmc_send_tuning(struct mmc_host *host);
158extern int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd);
158 159
159#define MMC_ERASE_ARG 0x00000000 160#define MMC_ERASE_ARG 0x00000000
160#define MMC_SECURE_ERASE_ARG 0x80000000 161#define MMC_SECURE_ERASE_ARG 0x80000000
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 001366927cf4..42b724e8d503 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -54,6 +54,7 @@ struct mmc_data;
54 * transfer is in progress. 54 * transfer is in progress.
55 * @use_dma: Whether DMA channel is initialized or not. 55 * @use_dma: Whether DMA channel is initialized or not.
56 * @using_dma: Whether DMA is in use for the current transfer. 56 * @using_dma: Whether DMA is in use for the current transfer.
57 * @dma_64bit_address: Whether DMA supports 64-bit address mode or not.
57 * @sg_dma: Bus address of DMA buffer. 58 * @sg_dma: Bus address of DMA buffer.
58 * @sg_cpu: Virtual address of DMA buffer. 59 * @sg_cpu: Virtual address of DMA buffer.
59 * @dma_ops: Pointer to platform-specific DMA callbacks. 60 * @dma_ops: Pointer to platform-specific DMA callbacks.
@@ -96,6 +97,7 @@ struct mmc_data;
96 * @quirks: Set of quirks that apply to specific versions of the IP. 97 * @quirks: Set of quirks that apply to specific versions of the IP.
97 * @irq_flags: The flags to be passed to request_irq. 98 * @irq_flags: The flags to be passed to request_irq.
98 * @irq: The irq value to be passed to request_irq. 99 * @irq: The irq value to be passed to request_irq.
100 * @sdio_id0: Number of slot0 in the SDIO interrupt registers.
99 * 101 *
100 * Locking 102 * Locking
101 * ======= 103 * =======
@@ -135,11 +137,11 @@ struct dw_mci {
135 struct mmc_command stop_abort; 137 struct mmc_command stop_abort;
136 unsigned int prev_blksz; 138 unsigned int prev_blksz;
137 unsigned char timing; 139 unsigned char timing;
138 struct workqueue_struct *card_workqueue;
139 140
140 /* DMA interface members*/ 141 /* DMA interface members*/
141 int use_dma; 142 int use_dma;
142 int using_dma; 143 int using_dma;
144 int dma_64bit_address;
143 145
144 dma_addr_t sg_dma; 146 dma_addr_t sg_dma;
145 void *sg_cpu; 147 void *sg_cpu;
@@ -154,7 +156,6 @@ struct dw_mci {
154 u32 stop_cmdr; 156 u32 stop_cmdr;
155 u32 dir_status; 157 u32 dir_status;
156 struct tasklet_struct tasklet; 158 struct tasklet_struct tasklet;
157 struct work_struct card_work;
158 unsigned long pending_events; 159 unsigned long pending_events;
159 unsigned long completed_events; 160 unsigned long completed_events;
160 enum dw_mci_state state; 161 enum dw_mci_state state;
@@ -193,6 +194,8 @@ struct dw_mci {
193 bool vqmmc_enabled; 194 bool vqmmc_enabled;
194 unsigned long irq_flags; /* IRQ flags */ 195 unsigned long irq_flags; /* IRQ flags */
195 int irq; 196 int irq;
197
198 int sdio_id0;
196}; 199};
197 200
198/* DMA ops for Internal/External DMAC interface */ 201/* DMA ops for Internal/External DMAC interface */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index df0c15396bbf..9f322706f7cb 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -289,6 +289,7 @@ struct mmc_host {
289#define MMC_CAP2_HS400_1_2V (1 << 16) /* Can support HS400 1.2V */ 289#define MMC_CAP2_HS400_1_2V (1 << 16) /* Can support HS400 1.2V */
290#define MMC_CAP2_HS400 (MMC_CAP2_HS400_1_8V | \ 290#define MMC_CAP2_HS400 (MMC_CAP2_HS400_1_8V | \
291 MMC_CAP2_HS400_1_2V) 291 MMC_CAP2_HS400_1_2V)
292#define MMC_CAP2_HSX00_1_2V (MMC_CAP2_HS200_1_2V_SDR | MMC_CAP2_HS400_1_2V)
292#define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17) 293#define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17)
293 294
294 mmc_pm_flag_t pm_caps; /* supported pm features */ 295 mmc_pm_flag_t pm_caps; /* supported pm features */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 1cd00b3a75b9..49ad7a943638 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -296,6 +296,7 @@ struct _mmc_csd {
296#define EXT_CSD_SANITIZE_START 165 /* W */ 296#define EXT_CSD_SANITIZE_START 165 /* W */
297#define EXT_CSD_WR_REL_PARAM 166 /* RO */ 297#define EXT_CSD_WR_REL_PARAM 166 /* RO */
298#define EXT_CSD_RPMB_MULT 168 /* RO */ 298#define EXT_CSD_RPMB_MULT 168 /* RO */
299#define EXT_CSD_FW_CONFIG 169 /* R/W */
299#define EXT_CSD_BOOT_WP 173 /* R/W */ 300#define EXT_CSD_BOOT_WP 173 /* R/W */
300#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ 301#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
301#define EXT_CSD_PART_CONFIG 179 /* R/W */ 302#define EXT_CSD_PART_CONFIG 179 /* R/W */
@@ -332,6 +333,8 @@ struct _mmc_csd {
332#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */ 333#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */
333#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ 334#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */
334#define EXT_CSD_PWR_CL_DDR_200_360 253 /* RO */ 335#define EXT_CSD_PWR_CL_DDR_200_360 253 /* RO */
336#define EXT_CSD_FIRMWARE_VERSION 254 /* RO, 8 bytes */
337#define EXT_CSD_SUPPORTED_MODE 493 /* RO */
335#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */ 338#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */
336#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */ 339#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */
337#define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */ 340#define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index dba793e3a331..375af80bde7d 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -100,6 +100,12 @@ struct sdhci_host {
100#define SDHCI_QUIRK2_BROKEN_DDR50 (1<<7) 100#define SDHCI_QUIRK2_BROKEN_DDR50 (1<<7)
101/* Stop command (CMD12) can set Transfer Complete when not using MMC_RSP_BUSY */ 101/* Stop command (CMD12) can set Transfer Complete when not using MMC_RSP_BUSY */
102#define SDHCI_QUIRK2_STOP_WITH_TC (1<<8) 102#define SDHCI_QUIRK2_STOP_WITH_TC (1<<8)
103/* Controller does not support 64-bit DMA */
104#define SDHCI_QUIRK2_BROKEN_64_BIT_DMA (1<<9)
105/* need clear transfer mode register before send cmd */
106#define SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD (1<<10)
107/* Capability register bit-63 indicates HS400 support */
108#define SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 (1<<11)
103 109
104 int irq; /* Device IRQ */ 110 int irq; /* Device IRQ */
105 void __iomem *ioaddr; /* Mapped address */ 111 void __iomem *ioaddr; /* Mapped address */
@@ -130,6 +136,7 @@ struct sdhci_host {
130#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ 136#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */
131#define SDHCI_SDR104_NEEDS_TUNING (1<<10) /* SDR104/HS200 needs tuning */ 137#define SDHCI_SDR104_NEEDS_TUNING (1<<10) /* SDR104/HS200 needs tuning */
132#define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */ 138#define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */
139#define SDHCI_USE_64_BIT_DMA (1<<12) /* Use 64-bit DMA */
133 140
134 unsigned int version; /* SDHCI spec. version */ 141 unsigned int version; /* SDHCI spec. version */
135 142
@@ -155,12 +162,19 @@ struct sdhci_host {
155 162
156 int sg_count; /* Mapped sg entries */ 163 int sg_count; /* Mapped sg entries */
157 164
158 u8 *adma_desc; /* ADMA descriptor table */ 165 void *adma_table; /* ADMA descriptor table */
159 u8 *align_buffer; /* Bounce buffer */ 166 void *align_buffer; /* Bounce buffer */
167
168 size_t adma_table_sz; /* ADMA descriptor table size */
169 size_t align_buffer_sz; /* Bounce buffer size */
160 170
161 dma_addr_t adma_addr; /* Mapped ADMA descr. table */ 171 dma_addr_t adma_addr; /* Mapped ADMA descr. table */
162 dma_addr_t align_addr; /* Mapped bounce buffer */ 172 dma_addr_t align_addr; /* Mapped bounce buffer */
163 173
174 unsigned int desc_sz; /* ADMA descriptor size */
175 unsigned int align_sz; /* ADMA alignment */
176 unsigned int align_mask; /* ADMA alignment mask */
177
164 struct tasklet_struct finish_tasklet; /* Tasklet structures */ 178 struct tasklet_struct finish_tasklet; /* Tasklet structures */
165 179
166 struct timer_list timer; /* Timer for timeouts */ 180 struct timer_list timer; /* Timer for timeouts */
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index 50f0bc952328..aab032a6ae61 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -84,8 +84,6 @@ struct sdio_driver {
84 struct device_driver drv; 84 struct device_driver drv;
85}; 85};
86 86
87#define to_sdio_driver(d) container_of(d, struct sdio_driver, drv)
88
89/** 87/**
90 * SDIO_DEVICE - macro used to describe a specific SDIO device 88 * SDIO_DEVICE - macro used to describe a specific SDIO device
91 * @vend: the 16 bit manufacturer code 89 * @vend: the 16 bit manufacturer code
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 88787bb4b3b9..95243d28a0ee 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -98,11 +98,11 @@ struct mmu_notifier_ops {
98 /* 98 /*
99 * invalidate_range_start() and invalidate_range_end() must be 99 * invalidate_range_start() and invalidate_range_end() must be
100 * paired and are called only when the mmap_sem and/or the 100 * paired and are called only when the mmap_sem and/or the
101 * locks protecting the reverse maps are held. The subsystem 101 * locks protecting the reverse maps are held. If the subsystem
102 * must guarantee that no additional references are taken to 102 * can't guarantee that no additional references are taken to
103 * the pages in the range established between the call to 103 * the pages in the range, it has to implement the
104 * invalidate_range_start() and the matching call to 104 * invalidate_range() notifier to remove any references taken
105 * invalidate_range_end(). 105 * after invalidate_range_start().
106 * 106 *
107 * Invalidation of multiple concurrent ranges may be 107 * Invalidation of multiple concurrent ranges may be
108 * optionally permitted by the driver. Either way the 108 * optionally permitted by the driver. Either way the
@@ -144,6 +144,29 @@ struct mmu_notifier_ops {
144 void (*invalidate_range_end)(struct mmu_notifier *mn, 144 void (*invalidate_range_end)(struct mmu_notifier *mn,
145 struct mm_struct *mm, 145 struct mm_struct *mm,
146 unsigned long start, unsigned long end); 146 unsigned long start, unsigned long end);
147
148 /*
149 * invalidate_range() is either called between
150 * invalidate_range_start() and invalidate_range_end() when the
151 * VM has to free pages that where unmapped, but before the
152 * pages are actually freed, or outside of _start()/_end() when
153 * a (remote) TLB is necessary.
154 *
155 * If invalidate_range() is used to manage a non-CPU TLB with
156 * shared page-tables, it not necessary to implement the
157 * invalidate_range_start()/end() notifiers, as
158 * invalidate_range() alread catches the points in time when an
159 * external TLB range needs to be flushed.
160 *
161 * The invalidate_range() function is called under the ptl
162 * spin-lock and not allowed to sleep.
163 *
164 * Note that this function might be called with just a sub-range
165 * of what was passed to invalidate_range_start()/end(), if
166 * called between those functions.
167 */
168 void (*invalidate_range)(struct mmu_notifier *mn, struct mm_struct *mm,
169 unsigned long start, unsigned long end);
147}; 170};
148 171
149/* 172/*
@@ -154,7 +177,7 @@ struct mmu_notifier_ops {
154 * Therefore notifier chains can only be traversed when either 177 * Therefore notifier chains can only be traversed when either
155 * 178 *
156 * 1. mmap_sem is held. 179 * 1. mmap_sem is held.
157 * 2. One of the reverse map locks is held (i_mmap_mutex or anon_vma->rwsem). 180 * 2. One of the reverse map locks is held (i_mmap_rwsem or anon_vma->rwsem).
158 * 3. No other concurrent thread can access the list (release) 181 * 3. No other concurrent thread can access the list (release)
159 */ 182 */
160struct mmu_notifier { 183struct mmu_notifier {
@@ -190,6 +213,8 @@ extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
190 unsigned long start, unsigned long end); 213 unsigned long start, unsigned long end);
191extern void __mmu_notifier_invalidate_range_end(struct mm_struct *mm, 214extern void __mmu_notifier_invalidate_range_end(struct mm_struct *mm,
192 unsigned long start, unsigned long end); 215 unsigned long start, unsigned long end);
216extern void __mmu_notifier_invalidate_range(struct mm_struct *mm,
217 unsigned long start, unsigned long end);
193 218
194static inline void mmu_notifier_release(struct mm_struct *mm) 219static inline void mmu_notifier_release(struct mm_struct *mm)
195{ 220{
@@ -242,6 +267,13 @@ static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm,
242 __mmu_notifier_invalidate_range_end(mm, start, end); 267 __mmu_notifier_invalidate_range_end(mm, start, end);
243} 268}
244 269
270static inline void mmu_notifier_invalidate_range(struct mm_struct *mm,
271 unsigned long start, unsigned long end)
272{
273 if (mm_has_notifiers(mm))
274 __mmu_notifier_invalidate_range(mm, start, end);
275}
276
245static inline void mmu_notifier_mm_init(struct mm_struct *mm) 277static inline void mmu_notifier_mm_init(struct mm_struct *mm)
246{ 278{
247 mm->mmu_notifier_mm = NULL; 279 mm->mmu_notifier_mm = NULL;
@@ -279,6 +311,44 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
279 __young; \ 311 __young; \
280}) 312})
281 313
314#define ptep_clear_flush_notify(__vma, __address, __ptep) \
315({ \
316 unsigned long ___addr = __address & PAGE_MASK; \
317 struct mm_struct *___mm = (__vma)->vm_mm; \
318 pte_t ___pte; \
319 \
320 ___pte = ptep_clear_flush(__vma, __address, __ptep); \
321 mmu_notifier_invalidate_range(___mm, ___addr, \
322 ___addr + PAGE_SIZE); \
323 \
324 ___pte; \
325})
326
327#define pmdp_clear_flush_notify(__vma, __haddr, __pmd) \
328({ \
329 unsigned long ___haddr = __haddr & HPAGE_PMD_MASK; \
330 struct mm_struct *___mm = (__vma)->vm_mm; \
331 pmd_t ___pmd; \
332 \
333 ___pmd = pmdp_clear_flush(__vma, __haddr, __pmd); \
334 mmu_notifier_invalidate_range(___mm, ___haddr, \
335 ___haddr + HPAGE_PMD_SIZE); \
336 \
337 ___pmd; \
338})
339
340#define pmdp_get_and_clear_notify(__mm, __haddr, __pmd) \
341({ \
342 unsigned long ___haddr = __haddr & HPAGE_PMD_MASK; \
343 pmd_t ___pmd; \
344 \
345 ___pmd = pmdp_get_and_clear(__mm, __haddr, __pmd); \
346 mmu_notifier_invalidate_range(__mm, ___haddr, \
347 ___haddr + HPAGE_PMD_SIZE); \
348 \
349 ___pmd; \
350})
351
282/* 352/*
283 * set_pte_at_notify() sets the pte _after_ running the notifier. 353 * set_pte_at_notify() sets the pte _after_ running the notifier.
284 * This is safe to start by updating the secondary MMUs, because the primary MMU 354 * This is safe to start by updating the secondary MMUs, because the primary MMU
@@ -342,6 +412,11 @@ static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm,
342{ 412{
343} 413}
344 414
415static inline void mmu_notifier_invalidate_range(struct mm_struct *mm,
416 unsigned long start, unsigned long end)
417{
418}
419
345static inline void mmu_notifier_mm_init(struct mm_struct *mm) 420static inline void mmu_notifier_mm_init(struct mm_struct *mm)
346{ 421{
347} 422}
@@ -352,6 +427,9 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
352 427
353#define ptep_clear_flush_young_notify ptep_clear_flush_young 428#define ptep_clear_flush_young_notify ptep_clear_flush_young
354#define pmdp_clear_flush_young_notify pmdp_clear_flush_young 429#define pmdp_clear_flush_young_notify pmdp_clear_flush_young
430#define ptep_clear_flush_notify ptep_clear_flush
431#define pmdp_clear_flush_notify pmdp_clear_flush
432#define pmdp_get_and_clear_notify pmdp_get_and_clear
355#define set_pte_at_notify set_pte_at 433#define set_pte_at_notify set_pte_at
356 434
357#endif /* CONFIG_MMU_NOTIFIER */ 435#endif /* CONFIG_MMU_NOTIFIER */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index ffe66e381c04..2f0856d14b21 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -722,8 +722,8 @@ typedef struct pglist_data {
722 int nr_zones; 722 int nr_zones;
723#ifdef CONFIG_FLAT_NODE_MEM_MAP /* means !SPARSEMEM */ 723#ifdef CONFIG_FLAT_NODE_MEM_MAP /* means !SPARSEMEM */
724 struct page *node_mem_map; 724 struct page *node_mem_map;
725#ifdef CONFIG_MEMCG 725#ifdef CONFIG_PAGE_EXTENSION
726 struct page_cgroup *node_page_cgroup; 726 struct page_ext *node_page_ext;
727#endif 727#endif
728#endif 728#endif
729#ifndef CONFIG_NO_BOOTMEM 729#ifndef CONFIG_NO_BOOTMEM
@@ -1078,7 +1078,7 @@ static inline unsigned long early_pfn_to_nid(unsigned long pfn)
1078#define SECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SECTION_MASK) 1078#define SECTION_ALIGN_DOWN(pfn) ((pfn) & PAGE_SECTION_MASK)
1079 1079
1080struct page; 1080struct page;
1081struct page_cgroup; 1081struct page_ext;
1082struct mem_section { 1082struct mem_section {
1083 /* 1083 /*
1084 * This is, logically, a pointer to an array of struct 1084 * This is, logically, a pointer to an array of struct
@@ -1096,12 +1096,12 @@ struct mem_section {
1096 1096
1097 /* See declaration of similar field in struct zone */ 1097 /* See declaration of similar field in struct zone */
1098 unsigned long *pageblock_flags; 1098 unsigned long *pageblock_flags;
1099#ifdef CONFIG_MEMCG 1099#ifdef CONFIG_PAGE_EXTENSION
1100 /* 1100 /*
1101 * If !SPARSEMEM, pgdat doesn't have page_cgroup pointer. We use 1101 * If !SPARSEMEM, pgdat doesn't have page_ext pointer. We use
1102 * section. (see memcontrol.h/page_cgroup.h about this.) 1102 * section. (see page_ext.h about this.)
1103 */ 1103 */
1104 struct page_cgroup *page_cgroup; 1104 struct page_ext *page_ext;
1105 unsigned long pad; 1105 unsigned long pad;
1106#endif 1106#endif
1107 /* 1107 /*
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 44eeef0da186..745def862580 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -69,7 +69,7 @@ struct ieee1394_device_id {
69 * @bDeviceClass: Class of device; numbers are assigned 69 * @bDeviceClass: Class of device; numbers are assigned
70 * by the USB forum. Products may choose to implement classes, 70 * by the USB forum. Products may choose to implement classes,
71 * or be vendor-specific. Device classes specify behavior of all 71 * or be vendor-specific. Device classes specify behavior of all
72 * the interfaces on a devices. 72 * the interfaces on a device.
73 * @bDeviceSubClass: Subclass of device; associated with bDeviceClass. 73 * @bDeviceSubClass: Subclass of device; associated with bDeviceClass.
74 * @bDeviceProtocol: Protocol of device; associated with bDeviceClass. 74 * @bDeviceProtocol: Protocol of device; associated with bDeviceClass.
75 * @bInterfaceClass: Class of interface; numbers are assigned 75 * @bInterfaceClass: Class of interface; numbers are assigned
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 44f4746d033b..8ac4a68ffae2 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -10,17 +10,12 @@ struct msi_msg {
10 u32 data; /* 16 bits of msi message data */ 10 u32 data; /* 16 bits of msi message data */
11}; 11};
12 12
13extern int pci_msi_ignore_mask;
13/* Helper functions */ 14/* Helper functions */
14struct irq_data; 15struct irq_data;
15struct msi_desc; 16struct msi_desc;
16void mask_msi_irq(struct irq_data *data);
17void unmask_msi_irq(struct irq_data *data);
18void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
19void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg); 17void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
20void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
21void read_msi_msg(unsigned int irq, struct msi_msg *msg);
22void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg); 18void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg);
23void write_msi_msg(unsigned int irq, struct msi_msg *msg);
24 19
25struct msi_desc { 20struct msi_desc {
26 struct { 21 struct {
@@ -48,6 +43,52 @@ struct msi_desc {
48 struct msi_msg msg; 43 struct msi_msg msg;
49}; 44};
50 45
46/* Helpers to hide struct msi_desc implementation details */
47#define msi_desc_to_dev(desc) (&(desc)->dev.dev)
48#define dev_to_msi_list(dev) (&to_pci_dev((dev))->msi_list)
49#define first_msi_entry(dev) \
50 list_first_entry(dev_to_msi_list((dev)), struct msi_desc, list)
51#define for_each_msi_entry(desc, dev) \
52 list_for_each_entry((desc), dev_to_msi_list((dev)), list)
53
54#ifdef CONFIG_PCI_MSI
55#define first_pci_msi_entry(pdev) first_msi_entry(&(pdev)->dev)
56#define for_each_pci_msi_entry(desc, pdev) \
57 for_each_msi_entry((desc), &(pdev)->dev)
58
59static inline struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc)
60{
61 return desc->dev;
62}
63#endif /* CONFIG_PCI_MSI */
64
65void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
66void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
67void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg);
68
69u32 __pci_msix_desc_mask_irq(struct msi_desc *desc, u32 flag);
70u32 __pci_msi_desc_mask_irq(struct msi_desc *desc, u32 mask, u32 flag);
71void pci_msi_mask_irq(struct irq_data *data);
72void pci_msi_unmask_irq(struct irq_data *data);
73
74/* Conversion helpers. Should be removed after merging */
75static inline void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
76{
77 __pci_write_msi_msg(entry, msg);
78}
79static inline void write_msi_msg(int irq, struct msi_msg *msg)
80{
81 pci_write_msi_msg(irq, msg);
82}
83static inline void mask_msi_irq(struct irq_data *data)
84{
85 pci_msi_mask_irq(data);
86}
87static inline void unmask_msi_irq(struct irq_data *data)
88{
89 pci_msi_unmask_irq(data);
90}
91
51/* 92/*
52 * The arch hooks to setup up msi irqs. Those functions are 93 * The arch hooks to setup up msi irqs. Those functions are
53 * implemented as weak symbols so that they /can/ be overriden by 94 * implemented as weak symbols so that they /can/ be overriden by
@@ -61,18 +102,142 @@ void arch_restore_msi_irqs(struct pci_dev *dev);
61 102
62void default_teardown_msi_irqs(struct pci_dev *dev); 103void default_teardown_msi_irqs(struct pci_dev *dev);
63void default_restore_msi_irqs(struct pci_dev *dev); 104void default_restore_msi_irqs(struct pci_dev *dev);
64u32 default_msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag);
65u32 default_msix_mask_irq(struct msi_desc *desc, u32 flag);
66 105
67struct msi_chip { 106struct msi_controller {
68 struct module *owner; 107 struct module *owner;
69 struct device *dev; 108 struct device *dev;
70 struct device_node *of_node; 109 struct device_node *of_node;
71 struct list_head list; 110 struct list_head list;
111#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
112 struct irq_domain *domain;
113#endif
72 114
73 int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev, 115 int (*setup_irq)(struct msi_controller *chip, struct pci_dev *dev,
74 struct msi_desc *desc); 116 struct msi_desc *desc);
75 void (*teardown_irq)(struct msi_chip *chip, unsigned int irq); 117 void (*teardown_irq)(struct msi_controller *chip, unsigned int irq);
118};
119
120#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
121
122#include <linux/irqhandler.h>
123#include <asm/msi.h>
124
125struct irq_domain;
126struct irq_chip;
127struct device_node;
128struct msi_domain_info;
129
130/**
131 * struct msi_domain_ops - MSI interrupt domain callbacks
132 * @get_hwirq: Retrieve the resulting hw irq number
133 * @msi_init: Domain specific init function for MSI interrupts
134 * @msi_free: Domain specific function to free a MSI interrupts
135 * @msi_check: Callback for verification of the domain/info/dev data
136 * @msi_prepare: Prepare the allocation of the interrupts in the domain
137 * @msi_finish: Optional callbacl to finalize the allocation
138 * @set_desc: Set the msi descriptor for an interrupt
139 * @handle_error: Optional error handler if the allocation fails
140 *
141 * @get_hwirq, @msi_init and @msi_free are callbacks used by
142 * msi_create_irq_domain() and related interfaces
143 *
144 * @msi_check, @msi_prepare, @msi_finish, @set_desc and @handle_error
145 * are callbacks used by msi_irq_domain_alloc_irqs() and related
146 * interfaces which are based on msi_desc.
147 */
148struct msi_domain_ops {
149 irq_hw_number_t (*get_hwirq)(struct msi_domain_info *info,
150 msi_alloc_info_t *arg);
151 int (*msi_init)(struct irq_domain *domain,
152 struct msi_domain_info *info,
153 unsigned int virq, irq_hw_number_t hwirq,
154 msi_alloc_info_t *arg);
155 void (*msi_free)(struct irq_domain *domain,
156 struct msi_domain_info *info,
157 unsigned int virq);
158 int (*msi_check)(struct irq_domain *domain,
159 struct msi_domain_info *info,
160 struct device *dev);
161 int (*msi_prepare)(struct irq_domain *domain,
162 struct device *dev, int nvec,
163 msi_alloc_info_t *arg);
164 void (*msi_finish)(msi_alloc_info_t *arg, int retval);
165 void (*set_desc)(msi_alloc_info_t *arg,
166 struct msi_desc *desc);
167 int (*handle_error)(struct irq_domain *domain,
168 struct msi_desc *desc, int error);
169};
170
171/**
172 * struct msi_domain_info - MSI interrupt domain data
173 * @flags: Flags to decribe features and capabilities
174 * @ops: The callback data structure
175 * @chip: Optional: associated interrupt chip
176 * @chip_data: Optional: associated interrupt chip data
177 * @handler: Optional: associated interrupt flow handler
178 * @handler_data: Optional: associated interrupt flow handler data
179 * @handler_name: Optional: associated interrupt flow handler name
180 * @data: Optional: domain specific data
181 */
182struct msi_domain_info {
183 u32 flags;
184 struct msi_domain_ops *ops;
185 struct irq_chip *chip;
186 void *chip_data;
187 irq_flow_handler_t handler;
188 void *handler_data;
189 const char *handler_name;
190 void *data;
191};
192
193/* Flags for msi_domain_info */
194enum {
195 /*
196 * Init non implemented ops callbacks with default MSI domain
197 * callbacks.
198 */
199 MSI_FLAG_USE_DEF_DOM_OPS = (1 << 0),
200 /*
201 * Init non implemented chip callbacks with default MSI chip
202 * callbacks.
203 */
204 MSI_FLAG_USE_DEF_CHIP_OPS = (1 << 1),
205 /* Build identity map between hwirq and irq */
206 MSI_FLAG_IDENTITY_MAP = (1 << 2),
207 /* Support multiple PCI MSI interrupts */
208 MSI_FLAG_MULTI_PCI_MSI = (1 << 3),
209 /* Support PCI MSIX interrupts */
210 MSI_FLAG_PCI_MSIX = (1 << 4),
76}; 211};
77 212
213int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,
214 bool force);
215
216struct irq_domain *msi_create_irq_domain(struct device_node *of_node,
217 struct msi_domain_info *info,
218 struct irq_domain *parent);
219int msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev,
220 int nvec);
221void msi_domain_free_irqs(struct irq_domain *domain, struct device *dev);
222struct msi_domain_info *msi_get_domain_info(struct irq_domain *domain);
223
224#endif /* CONFIG_GENERIC_MSI_IRQ_DOMAIN */
225
226#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
227void pci_msi_domain_write_msg(struct irq_data *irq_data, struct msi_msg *msg);
228struct irq_domain *pci_msi_create_irq_domain(struct device_node *node,
229 struct msi_domain_info *info,
230 struct irq_domain *parent);
231int pci_msi_domain_alloc_irqs(struct irq_domain *domain, struct pci_dev *dev,
232 int nvec, int type);
233void pci_msi_domain_free_irqs(struct irq_domain *domain, struct pci_dev *dev);
234struct irq_domain *pci_msi_create_default_irq_domain(struct device_node *node,
235 struct msi_domain_info *info, struct irq_domain *parent);
236
237irq_hw_number_t pci_msi_domain_calc_hwirq(struct pci_dev *dev,
238 struct msi_desc *desc);
239int pci_msi_domain_check_cap(struct irq_domain *domain,
240 struct msi_domain_info *info, struct device *dev);
241#endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */
242
78#endif /* LINUX_MSI_H */ 243#endif /* LINUX_MSI_H */
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index dcfdecbfa0b7..8e30685affeb 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -47,9 +47,9 @@ enum {
47 NETIF_F_GSO_SIT_BIT, /* ... SIT tunnel with TSO */ 47 NETIF_F_GSO_SIT_BIT, /* ... SIT tunnel with TSO */
48 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 */ 49 NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT,/* ... UDP TUNNEL with TSO & CSUM */
50 NETIF_F_GSO_MPLS_BIT, /* ... MPLS segmentation */ 50 NETIF_F_GSO_TUNNEL_REMCSUM_BIT, /* ... TUNNEL with TSO & REMCSUM */
51 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */ 51 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */
52 NETIF_F_GSO_MPLS_BIT, 52 NETIF_F_GSO_TUNNEL_REMCSUM_BIT,
53 53
54 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ 54 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
55 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */ 55 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
@@ -118,7 +118,7 @@ enum {
118#define NETIF_F_GSO_SIT __NETIF_F(GSO_SIT) 118#define NETIF_F_GSO_SIT __NETIF_F(GSO_SIT)
119#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) 120#define NETIF_F_GSO_UDP_TUNNEL_CSUM __NETIF_F(GSO_UDP_TUNNEL_CSUM)
121#define NETIF_F_GSO_MPLS __NETIF_F(GSO_MPLS) 121#define NETIF_F_GSO_TUNNEL_REMCSUM __NETIF_F(GSO_TUNNEL_REMCSUM)
122#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)
123#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)
124#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) 124#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
@@ -181,7 +181,6 @@ enum {
181 NETIF_F_GSO_IPIP | \ 181 NETIF_F_GSO_IPIP | \
182 NETIF_F_GSO_SIT | \ 182 NETIF_F_GSO_SIT | \
183 NETIF_F_GSO_UDP_TUNNEL | \ 183 NETIF_F_GSO_UDP_TUNNEL | \
184 NETIF_F_GSO_UDP_TUNNEL_CSUM | \ 184 NETIF_F_GSO_UDP_TUNNEL_CSUM)
185 NETIF_F_GSO_MPLS)
186 185
187#endif /* _LINUX_NETDEV_FEATURES_H */ 186#endif /* _LINUX_NETDEV_FEATURES_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 74fd5d37f15a..c31f74d76ebd 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -57,6 +57,8 @@ struct device;
57struct phy_device; 57struct phy_device;
58/* 802.11 specific */ 58/* 802.11 specific */
59struct wireless_dev; 59struct wireless_dev;
60/* 802.15.4 specific */
61struct wpan_dev;
60 62
61void netdev_set_default_ethtool_ops(struct net_device *dev, 63void netdev_set_default_ethtool_ops(struct net_device *dev,
62 const struct ethtool_ops *ops); 64 const struct ethtool_ops *ops);
@@ -314,6 +316,7 @@ struct napi_struct {
314 struct net_device *dev; 316 struct net_device *dev;
315 struct sk_buff *gro_list; 317 struct sk_buff *gro_list;
316 struct sk_buff *skb; 318 struct sk_buff *skb;
319 struct hrtimer timer;
317 struct list_head dev_list; 320 struct list_head dev_list;
318 struct hlist_node napi_hash_node; 321 struct hlist_node napi_hash_node;
319 unsigned int napi_id; 322 unsigned int napi_id;
@@ -386,6 +389,7 @@ typedef enum rx_handler_result rx_handler_result_t;
386typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb); 389typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
387 390
388void __napi_schedule(struct napi_struct *n); 391void __napi_schedule(struct napi_struct *n);
392void __napi_schedule_irqoff(struct napi_struct *n);
389 393
390static inline bool napi_disable_pending(struct napi_struct *n) 394static inline bool napi_disable_pending(struct napi_struct *n)
391{ 395{
@@ -420,6 +424,18 @@ static inline void napi_schedule(struct napi_struct *n)
420 __napi_schedule(n); 424 __napi_schedule(n);
421} 425}
422 426
427/**
428 * napi_schedule_irqoff - schedule NAPI poll
429 * @n: napi context
430 *
431 * Variant of napi_schedule(), assuming hard irqs are masked.
432 */
433static inline void napi_schedule_irqoff(struct napi_struct *n)
434{
435 if (napi_schedule_prep(n))
436 __napi_schedule_irqoff(n);
437}
438
423/* Try to reschedule poll. Called by dev->poll() after napi_complete(). */ 439/* Try to reschedule poll. Called by dev->poll() after napi_complete(). */
424static inline bool napi_reschedule(struct napi_struct *napi) 440static inline bool napi_reschedule(struct napi_struct *napi)
425{ 441{
@@ -430,14 +446,19 @@ static inline bool napi_reschedule(struct napi_struct *napi)
430 return false; 446 return false;
431} 447}
432 448
449void __napi_complete(struct napi_struct *n);
450void napi_complete_done(struct napi_struct *n, int work_done);
433/** 451/**
434 * napi_complete - NAPI processing complete 452 * napi_complete - NAPI processing complete
435 * @n: napi context 453 * @n: napi context
436 * 454 *
437 * Mark NAPI processing as complete. 455 * Mark NAPI processing as complete.
456 * Consider using napi_complete_done() instead.
438 */ 457 */
439void __napi_complete(struct napi_struct *n); 458static inline void napi_complete(struct napi_struct *n)
440void napi_complete(struct napi_struct *n); 459{
460 return napi_complete_done(n, 0);
461}
441 462
442/** 463/**
443 * napi_by_id - lookup a NAPI by napi_id 464 * napi_by_id - lookup a NAPI by napi_id
@@ -472,14 +493,7 @@ void napi_hash_del(struct napi_struct *napi);
472 * Stop NAPI from being scheduled on this context. 493 * Stop NAPI from being scheduled on this context.
473 * Waits till any outstanding processing completes. 494 * Waits till any outstanding processing completes.
474 */ 495 */
475static inline void napi_disable(struct napi_struct *n) 496void napi_disable(struct napi_struct *n);
476{
477 might_sleep();
478 set_bit(NAPI_STATE_DISABLE, &n->state);
479 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
480 msleep(1);
481 clear_bit(NAPI_STATE_DISABLE, &n->state);
482}
483 497
484/** 498/**
485 * napi_enable - enable NAPI scheduling 499 * napi_enable - enable NAPI scheduling
@@ -740,13 +754,13 @@ struct netdev_fcoe_hbainfo {
740}; 754};
741#endif 755#endif
742 756
743#define MAX_PHYS_PORT_ID_LEN 32 757#define MAX_PHYS_ITEM_ID_LEN 32
744 758
745/* This structure holds a unique identifier to identify the 759/* This structure holds a unique identifier to identify some
746 * physical port used by a netdevice. 760 * physical item (port for example) used by a netdevice.
747 */ 761 */
748struct netdev_phys_port_id { 762struct netdev_phys_item_id {
749 unsigned char id[MAX_PHYS_PORT_ID_LEN]; 763 unsigned char id[MAX_PHYS_ITEM_ID_LEN];
750 unsigned char id_len; 764 unsigned char id_len;
751}; 765};
752 766
@@ -937,11 +951,11 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
937 * 951 *
938 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct nlattr *tb[], 952 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct nlattr *tb[],
939 * struct net_device *dev, 953 * struct net_device *dev,
940 * const unsigned char *addr, u16 flags) 954 * const unsigned char *addr, u16 vid, u16 flags)
941 * Adds an FDB entry to dev for addr. 955 * Adds an FDB entry to dev for addr.
942 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct nlattr *tb[], 956 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct nlattr *tb[],
943 * struct net_device *dev, 957 * struct net_device *dev,
944 * const unsigned char *addr) 958 * const unsigned char *addr, u16 vid)
945 * Deletes the FDB entry from dev coresponding to addr. 959 * Deletes the FDB entry from dev coresponding to addr.
946 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, 960 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
947 * struct net_device *dev, struct net_device *filter_dev, 961 * struct net_device *dev, struct net_device *filter_dev,
@@ -962,7 +976,7 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
962 * USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function. 976 * USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function.
963 * 977 *
964 * int (*ndo_get_phys_port_id)(struct net_device *dev, 978 * int (*ndo_get_phys_port_id)(struct net_device *dev,
965 * struct netdev_phys_port_id *ppid); 979 * struct netdev_phys_item_id *ppid);
966 * Called to get ID of physical port of this device. If driver does 980 * Called to get ID of physical port of this device. If driver does
967 * not implement this, it is assumed that the hw is not able to have 981 * not implement this, it is assumed that the hw is not able to have
968 * multiple net devices on single physical port. 982 * multiple net devices on single physical port.
@@ -1004,6 +1018,15 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
1004 * performing GSO on a packet. The device returns true if it is 1018 * performing GSO on a packet. The device returns true if it is
1005 * able to GSO the packet, false otherwise. If the return value is 1019 * able to GSO the packet, false otherwise. If the return value is
1006 * false the stack will do software GSO. 1020 * false the stack will do software GSO.
1021 *
1022 * int (*ndo_switch_parent_id_get)(struct net_device *dev,
1023 * struct netdev_phys_item_id *psid);
1024 * Called to get an ID of the switch chip this port is part of.
1025 * If driver implements this, it indicates that it represents a port
1026 * of a switch chip.
1027 * int (*ndo_switch_port_stp_update)(struct net_device *dev, u8 state);
1028 * Called to notify switch device port of bridge port STP
1029 * state change.
1007 */ 1030 */
1008struct net_device_ops { 1031struct net_device_ops {
1009 int (*ndo_init)(struct net_device *dev); 1032 int (*ndo_init)(struct net_device *dev);
@@ -1114,11 +1137,13 @@ struct net_device_ops {
1114 struct nlattr *tb[], 1137 struct nlattr *tb[],
1115 struct net_device *dev, 1138 struct net_device *dev,
1116 const unsigned char *addr, 1139 const unsigned char *addr,
1140 u16 vid,
1117 u16 flags); 1141 u16 flags);
1118 int (*ndo_fdb_del)(struct ndmsg *ndm, 1142 int (*ndo_fdb_del)(struct ndmsg *ndm,
1119 struct nlattr *tb[], 1143 struct nlattr *tb[],
1120 struct net_device *dev, 1144 struct net_device *dev,
1121 const unsigned char *addr); 1145 const unsigned char *addr,
1146 u16 vid);
1122 int (*ndo_fdb_dump)(struct sk_buff *skb, 1147 int (*ndo_fdb_dump)(struct sk_buff *skb,
1123 struct netlink_callback *cb, 1148 struct netlink_callback *cb,
1124 struct net_device *dev, 1149 struct net_device *dev,
@@ -1136,7 +1161,7 @@ struct net_device_ops {
1136 int (*ndo_change_carrier)(struct net_device *dev, 1161 int (*ndo_change_carrier)(struct net_device *dev,
1137 bool new_carrier); 1162 bool new_carrier);
1138 int (*ndo_get_phys_port_id)(struct net_device *dev, 1163 int (*ndo_get_phys_port_id)(struct net_device *dev,
1139 struct netdev_phys_port_id *ppid); 1164 struct netdev_phys_item_id *ppid);
1140 void (*ndo_add_vxlan_port)(struct net_device *dev, 1165 void (*ndo_add_vxlan_port)(struct net_device *dev,
1141 sa_family_t sa_family, 1166 sa_family_t sa_family,
1142 __be16 port); 1167 __be16 port);
@@ -1155,6 +1180,12 @@ struct net_device_ops {
1155 int (*ndo_get_lock_subclass)(struct net_device *dev); 1180 int (*ndo_get_lock_subclass)(struct net_device *dev);
1156 bool (*ndo_gso_check) (struct sk_buff *skb, 1181 bool (*ndo_gso_check) (struct sk_buff *skb,
1157 struct net_device *dev); 1182 struct net_device *dev);
1183#ifdef CONFIG_NET_SWITCHDEV
1184 int (*ndo_switch_parent_id_get)(struct net_device *dev,
1185 struct netdev_phys_item_id *psid);
1186 int (*ndo_switch_port_stp_update)(struct net_device *dev,
1187 u8 state);
1188#endif
1158}; 1189};
1159 1190
1160/** 1191/**
@@ -1216,6 +1247,8 @@ enum netdev_priv_flags {
1216 IFF_LIVE_ADDR_CHANGE = 1<<20, 1247 IFF_LIVE_ADDR_CHANGE = 1<<20,
1217 IFF_MACVLAN = 1<<21, 1248 IFF_MACVLAN = 1<<21,
1218 IFF_XMIT_DST_RELEASE_PERM = 1<<22, 1249 IFF_XMIT_DST_RELEASE_PERM = 1<<22,
1250 IFF_IPVLAN_MASTER = 1<<23,
1251 IFF_IPVLAN_SLAVE = 1<<24,
1219}; 1252};
1220 1253
1221#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN 1254#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -1241,6 +1274,8 @@ enum netdev_priv_flags {
1241#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE 1274#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE
1242#define IFF_MACVLAN IFF_MACVLAN 1275#define IFF_MACVLAN IFF_MACVLAN
1243#define IFF_XMIT_DST_RELEASE_PERM IFF_XMIT_DST_RELEASE_PERM 1276#define IFF_XMIT_DST_RELEASE_PERM IFF_XMIT_DST_RELEASE_PERM
1277#define IFF_IPVLAN_MASTER IFF_IPVLAN_MASTER
1278#define IFF_IPVLAN_SLAVE IFF_IPVLAN_SLAVE
1244 1279
1245/** 1280/**
1246 * struct net_device - The DEVICE structure. 1281 * struct net_device - The DEVICE structure.
@@ -1572,6 +1607,7 @@ struct net_device {
1572 struct inet6_dev __rcu *ip6_ptr; 1607 struct inet6_dev __rcu *ip6_ptr;
1573 void *ax25_ptr; 1608 void *ax25_ptr;
1574 struct wireless_dev *ieee80211_ptr; 1609 struct wireless_dev *ieee80211_ptr;
1610 struct wpan_dev *ieee802154_ptr;
1575 1611
1576/* 1612/*
1577 * Cache lines mostly used on receive path (including eth_type_trans()) 1613 * Cache lines mostly used on receive path (including eth_type_trans())
@@ -1590,6 +1626,7 @@ struct net_device {
1590 1626
1591#endif 1627#endif
1592 1628
1629 unsigned long gro_flush_timeout;
1593 rx_handler_func_t __rcu *rx_handler; 1630 rx_handler_func_t __rcu *rx_handler;
1594 void __rcu *rx_handler_data; 1631 void __rcu *rx_handler_data;
1595 1632
@@ -2316,10 +2353,7 @@ extern int netdev_flow_limit_table_len;
2316 * Incoming packets are placed on per-cpu queues 2353 * Incoming packets are placed on per-cpu queues
2317 */ 2354 */
2318struct softnet_data { 2355struct softnet_data {
2319 struct Qdisc *output_queue;
2320 struct Qdisc **output_queue_tailp;
2321 struct list_head poll_list; 2356 struct list_head poll_list;
2322 struct sk_buff *completion_queue;
2323 struct sk_buff_head process_queue; 2357 struct sk_buff_head process_queue;
2324 2358
2325 /* stats */ 2359 /* stats */
@@ -2327,10 +2361,17 @@ struct softnet_data {
2327 unsigned int time_squeeze; 2361 unsigned int time_squeeze;
2328 unsigned int cpu_collision; 2362 unsigned int cpu_collision;
2329 unsigned int received_rps; 2363 unsigned int received_rps;
2330
2331#ifdef CONFIG_RPS 2364#ifdef CONFIG_RPS
2332 struct softnet_data *rps_ipi_list; 2365 struct softnet_data *rps_ipi_list;
2366#endif
2367#ifdef CONFIG_NET_FLOW_LIMIT
2368 struct sd_flow_limit __rcu *flow_limit;
2369#endif
2370 struct Qdisc *output_queue;
2371 struct Qdisc **output_queue_tailp;
2372 struct sk_buff *completion_queue;
2333 2373
2374#ifdef CONFIG_RPS
2334 /* Elements below can be accessed between CPUs for RPS */ 2375 /* Elements below can be accessed between CPUs for RPS */
2335 struct call_single_data csd ____cacheline_aligned_in_smp; 2376 struct call_single_data csd ____cacheline_aligned_in_smp;
2336 struct softnet_data *rps_ipi_next; 2377 struct softnet_data *rps_ipi_next;
@@ -2342,9 +2383,6 @@ struct softnet_data {
2342 struct sk_buff_head input_pkt_queue; 2383 struct sk_buff_head input_pkt_queue;
2343 struct napi_struct backlog; 2384 struct napi_struct backlog;
2344 2385
2345#ifdef CONFIG_NET_FLOW_LIMIT
2346 struct sd_flow_limit __rcu *flow_limit;
2347#endif
2348}; 2386};
2349 2387
2350static inline void input_queue_head_incr(struct softnet_data *sd) 2388static inline void input_queue_head_incr(struct softnet_data *sd)
@@ -2748,23 +2786,6 @@ static inline int netif_set_real_num_rx_queues(struct net_device *dev,
2748} 2786}
2749#endif 2787#endif
2750 2788
2751static inline int netif_copy_real_num_queues(struct net_device *to_dev,
2752 const struct net_device *from_dev)
2753{
2754 int err;
2755
2756 err = netif_set_real_num_tx_queues(to_dev,
2757 from_dev->real_num_tx_queues);
2758 if (err)
2759 return err;
2760#ifdef CONFIG_SYSFS
2761 return netif_set_real_num_rx_queues(to_dev,
2762 from_dev->real_num_rx_queues);
2763#else
2764 return 0;
2765#endif
2766}
2767
2768#ifdef CONFIG_SYSFS 2789#ifdef CONFIG_SYSFS
2769static inline unsigned int get_netdev_rx_queue_index( 2790static inline unsigned int get_netdev_rx_queue_index(
2770 struct netdev_rx_queue *queue) 2791 struct netdev_rx_queue *queue)
@@ -2864,7 +2885,7 @@ void dev_set_group(struct net_device *, int);
2864int dev_set_mac_address(struct net_device *, struct sockaddr *); 2885int dev_set_mac_address(struct net_device *, struct sockaddr *);
2865int dev_change_carrier(struct net_device *, bool new_carrier); 2886int dev_change_carrier(struct net_device *, bool new_carrier);
2866int dev_get_phys_port_id(struct net_device *dev, 2887int dev_get_phys_port_id(struct net_device *dev,
2867 struct netdev_phys_port_id *ppid); 2888 struct netdev_phys_item_id *ppid);
2868struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev); 2889struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
2869struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2890struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2870 struct netdev_queue *txq, int *ret); 2891 struct netdev_queue *txq, int *ret);
@@ -3425,6 +3446,12 @@ void netdev_upper_dev_unlink(struct net_device *dev,
3425void netdev_adjacent_rename_links(struct net_device *dev, char *oldname); 3446void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
3426void *netdev_lower_dev_get_private(struct net_device *dev, 3447void *netdev_lower_dev_get_private(struct net_device *dev,
3427 struct net_device *lower_dev); 3448 struct net_device *lower_dev);
3449
3450/* RSS keys are 40 or 52 bytes long */
3451#define NETDEV_RSS_KEY_LEN 52
3452extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN];
3453void netdev_rss_key_fill(void *buffer, size_t len);
3454
3428int dev_get_nest_level(struct net_device *dev, 3455int dev_get_nest_level(struct net_device *dev,
3429 bool (*type_check)(struct net_device *dev)); 3456 bool (*type_check)(struct net_device *dev));
3430int skb_checksum_help(struct sk_buff *skb); 3457int skb_checksum_help(struct sk_buff *skb);
@@ -3569,7 +3596,7 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type)
3569 BUILD_BUG_ON(SKB_GSO_SIT != (NETIF_F_GSO_SIT >> NETIF_F_GSO_SHIFT)); 3596 BUILD_BUG_ON(SKB_GSO_SIT != (NETIF_F_GSO_SIT >> NETIF_F_GSO_SHIFT));
3570 BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL != (NETIF_F_GSO_UDP_TUNNEL >> NETIF_F_GSO_SHIFT)); 3597 BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL != (NETIF_F_GSO_UDP_TUNNEL >> NETIF_F_GSO_SHIFT));
3571 BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL_CSUM != (NETIF_F_GSO_UDP_TUNNEL_CSUM >> NETIF_F_GSO_SHIFT)); 3598 BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL_CSUM != (NETIF_F_GSO_UDP_TUNNEL_CSUM >> NETIF_F_GSO_SHIFT));
3572 BUILD_BUG_ON(SKB_GSO_MPLS != (NETIF_F_GSO_MPLS >> NETIF_F_GSO_SHIFT)); 3599 BUILD_BUG_ON(SKB_GSO_TUNNEL_REMCSUM != (NETIF_F_GSO_TUNNEL_REMCSUM >> NETIF_F_GSO_SHIFT));
3573 3600
3574 return (features & feature) == feature; 3601 return (features & feature) == feature;
3575} 3602}
@@ -3614,6 +3641,21 @@ static inline bool netif_is_macvlan(struct net_device *dev)
3614 return dev->priv_flags & IFF_MACVLAN; 3641 return dev->priv_flags & IFF_MACVLAN;
3615} 3642}
3616 3643
3644static inline bool netif_is_macvlan_port(struct net_device *dev)
3645{
3646 return dev->priv_flags & IFF_MACVLAN_PORT;
3647}
3648
3649static inline bool netif_is_ipvlan(struct net_device *dev)
3650{
3651 return dev->priv_flags & IFF_IPVLAN_SLAVE;
3652}
3653
3654static inline bool netif_is_ipvlan_port(struct net_device *dev)
3655{
3656 return dev->priv_flags & IFF_IPVLAN_MASTER;
3657}
3658
3617static inline bool netif_is_bond_master(struct net_device *dev) 3659static inline bool netif_is_bond_master(struct net_device *dev)
3618{ 3660{
3619 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; 3661 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 356acc2846fd..022b761dbf0a 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -490,6 +490,8 @@ enum {
490 490
491 /* nfs42 */ 491 /* nfs42 */
492 NFSPROC4_CLNT_SEEK, 492 NFSPROC4_CLNT_SEEK,
493 NFSPROC4_CLNT_ALLOCATE,
494 NFSPROC4_CLNT_DEALLOCATE,
493}; 495};
494 496
495/* nfs41 types */ 497/* nfs41 types */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index c72d1ad41ad4..6d627b92df53 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -163,7 +163,7 @@ struct nfs_inode {
163 */ 163 */
164 __be32 cookieverf[2]; 164 __be32 cookieverf[2];
165 165
166 unsigned long npages; 166 unsigned long nrequests;
167 struct nfs_mds_commit_info commit_info; 167 struct nfs_mds_commit_info commit_info;
168 168
169 /* Open contexts for shared mmap writes */ 169 /* Open contexts for shared mmap writes */
@@ -520,7 +520,7 @@ extern void nfs_commit_free(struct nfs_commit_data *data);
520static inline int 520static inline int
521nfs_have_writebacks(struct inode *inode) 521nfs_have_writebacks(struct inode *inode)
522{ 522{
523 return NFS_I(inode)->npages != 0; 523 return NFS_I(inode)->nrequests != 0;
524} 524}
525 525
526/* 526/*
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index a32ba0d7a98f..1e37fbb78f7a 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -231,5 +231,7 @@ struct nfs_server {
231#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17) 231#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17)
232#define NFS_CAP_SECURITY_LABEL (1U << 18) 232#define NFS_CAP_SECURITY_LABEL (1U << 18)
233#define NFS_CAP_SEEK (1U << 19) 233#define NFS_CAP_SEEK (1U << 19)
234#define NFS_CAP_ALLOCATE (1U << 20)
235#define NFS_CAP_DEALLOCATE (1U << 21)
234 236
235#endif 237#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 47ebb4fafd87..467c84efb596 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1243,6 +1243,20 @@ nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1243#endif /* CONFIG_NFS_V4_1 */ 1243#endif /* CONFIG_NFS_V4_1 */
1244 1244
1245#ifdef CONFIG_NFS_V4_2 1245#ifdef CONFIG_NFS_V4_2
1246struct nfs42_falloc_args {
1247 struct nfs4_sequence_args seq_args;
1248
1249 struct nfs_fh *falloc_fh;
1250 nfs4_stateid falloc_stateid;
1251 u64 falloc_offset;
1252 u64 falloc_length;
1253};
1254
1255struct nfs42_falloc_res {
1256 struct nfs4_sequence_res seq_res;
1257 unsigned int status;
1258};
1259
1246struct nfs42_seek_args { 1260struct nfs42_seek_args {
1247 struct nfs4_sequence_args seq_args; 1261 struct nfs4_sequence_args seq_args;
1248 1262
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
index 20163b9a0eae..167342c2ce6b 100644
--- a/include/linux/nl802154.h
+++ b/include/linux/nl802154.h
@@ -12,10 +12,6 @@
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */ 15 */
20 16
21#ifndef NL802154_H 17#ifndef NL802154_H
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 2bf403195c09..258945fcabf1 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -19,6 +19,7 @@
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/miscdevice.h> 20#include <linux/miscdevice.h>
21#include <linux/kref.h> 21#include <linux/kref.h>
22#include <linux/blk-mq.h>
22 23
23struct nvme_bar { 24struct nvme_bar {
24 __u64 cap; /* Controller Capabilities */ 25 __u64 cap; /* Controller Capabilities */
@@ -38,6 +39,7 @@ struct nvme_bar {
38#define NVME_CAP_TIMEOUT(cap) (((cap) >> 24) & 0xff) 39#define NVME_CAP_TIMEOUT(cap) (((cap) >> 24) & 0xff)
39#define NVME_CAP_STRIDE(cap) (((cap) >> 32) & 0xf) 40#define NVME_CAP_STRIDE(cap) (((cap) >> 32) & 0xf)
40#define NVME_CAP_MPSMIN(cap) (((cap) >> 48) & 0xf) 41#define NVME_CAP_MPSMIN(cap) (((cap) >> 48) & 0xf)
42#define NVME_CAP_MPSMAX(cap) (((cap) >> 52) & 0xf)
41 43
42enum { 44enum {
43 NVME_CC_ENABLE = 1 << 0, 45 NVME_CC_ENABLE = 1 << 0,
@@ -70,8 +72,10 @@ extern unsigned char nvme_io_timeout;
70 */ 72 */
71struct nvme_dev { 73struct nvme_dev {
72 struct list_head node; 74 struct list_head node;
73 struct nvme_queue __rcu **queues; 75 struct nvme_queue **queues;
74 unsigned short __percpu *io_queue; 76 struct request_queue *admin_q;
77 struct blk_mq_tag_set tagset;
78 struct blk_mq_tag_set admin_tagset;
75 u32 __iomem *dbs; 79 u32 __iomem *dbs;
76 struct pci_dev *pci_dev; 80 struct pci_dev *pci_dev;
77 struct dma_pool *prp_page_pool; 81 struct dma_pool *prp_page_pool;
@@ -90,15 +94,16 @@ struct nvme_dev {
90 struct miscdevice miscdev; 94 struct miscdevice miscdev;
91 work_func_t reset_workfn; 95 work_func_t reset_workfn;
92 struct work_struct reset_work; 96 struct work_struct reset_work;
93 struct work_struct cpu_work;
94 char name[12]; 97 char name[12];
95 char serial[20]; 98 char serial[20];
96 char model[40]; 99 char model[40];
97 char firmware_rev[8]; 100 char firmware_rev[8];
98 u32 max_hw_sectors; 101 u32 max_hw_sectors;
99 u32 stripe_size; 102 u32 stripe_size;
103 u32 page_size;
100 u16 oncs; 104 u16 oncs;
101 u16 abort_limit; 105 u16 abort_limit;
106 u8 event_limit;
102 u8 vwc; 107 u8 vwc;
103 u8 initialized; 108 u8 initialized;
104}; 109};
@@ -132,7 +137,6 @@ struct nvme_iod {
132 int offset; /* Of PRP list */ 137 int offset; /* Of PRP list */
133 int nents; /* Used in scatterlist */ 138 int nents; /* Used in scatterlist */
134 int length; /* Of data, in bytes */ 139 int length; /* Of data, in bytes */
135 unsigned long start_time;
136 dma_addr_t first_dma; 140 dma_addr_t first_dma;
137 struct list_head node; 141 struct list_head node;
138 struct scatterlist sg[0]; 142 struct scatterlist sg[0];
@@ -150,12 +154,14 @@ static inline u64 nvme_block_nr(struct nvme_ns *ns, sector_t sector)
150 */ 154 */
151void nvme_free_iod(struct nvme_dev *dev, struct nvme_iod *iod); 155void nvme_free_iod(struct nvme_dev *dev, struct nvme_iod *iod);
152 156
153int nvme_setup_prps(struct nvme_dev *, struct nvme_iod *, int , gfp_t); 157int nvme_setup_prps(struct nvme_dev *, struct nvme_iod *, int, gfp_t);
154struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write, 158struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write,
155 unsigned long addr, unsigned length); 159 unsigned long addr, unsigned length);
156void nvme_unmap_user_pages(struct nvme_dev *dev, int write, 160void nvme_unmap_user_pages(struct nvme_dev *dev, int write,
157 struct nvme_iod *iod); 161 struct nvme_iod *iod);
158int nvme_submit_io_cmd(struct nvme_dev *, struct nvme_command *, u32 *); 162int nvme_submit_io_cmd(struct nvme_dev *, struct nvme_ns *,
163 struct nvme_command *, u32 *);
164int nvme_submit_flush_data(struct nvme_queue *nvmeq, struct nvme_ns *ns);
159int nvme_submit_admin_cmd(struct nvme_dev *, struct nvme_command *, 165int nvme_submit_admin_cmd(struct nvme_dev *, struct nvme_command *,
160 u32 *result); 166 u32 *result);
161int nvme_identify(struct nvme_dev *, unsigned nsid, unsigned cns, 167int nvme_identify(struct nvme_dev *, unsigned nsid, unsigned cns,
diff --git a/include/linux/of.h b/include/linux/of.h
index 29f0adc5f3e4..dfde07e77a63 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -23,6 +23,8 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/topology.h> 24#include <linux/topology.h>
25#include <linux/notifier.h> 25#include <linux/notifier.h>
26#include <linux/property.h>
27#include <linux/list.h>
26 28
27#include <asm/byteorder.h> 29#include <asm/byteorder.h>
28#include <asm/errno.h> 30#include <asm/errno.h>
@@ -49,14 +51,13 @@ struct device_node {
49 const char *type; 51 const char *type;
50 phandle phandle; 52 phandle phandle;
51 const char *full_name; 53 const char *full_name;
54 struct fwnode_handle fwnode;
52 55
53 struct property *properties; 56 struct property *properties;
54 struct property *deadprops; /* removed properties */ 57 struct property *deadprops; /* removed properties */
55 struct device_node *parent; 58 struct device_node *parent;
56 struct device_node *child; 59 struct device_node *child;
57 struct device_node *sibling; 60 struct device_node *sibling;
58 struct device_node *next; /* next device of same type */
59 struct device_node *allnext; /* next in list of all nodes */
60 struct kobject kobj; 61 struct kobject kobj;
61 unsigned long _flags; 62 unsigned long _flags;
62 void *data; 63 void *data;
@@ -74,11 +75,18 @@ struct of_phandle_args {
74 uint32_t args[MAX_PHANDLE_ARGS]; 75 uint32_t args[MAX_PHANDLE_ARGS];
75}; 76};
76 77
78struct of_reconfig_data {
79 struct device_node *dn;
80 struct property *prop;
81 struct property *old_prop;
82};
83
77/* initialize a node */ 84/* initialize a node */
78extern struct kobj_type of_node_ktype; 85extern struct kobj_type of_node_ktype;
79static inline void of_node_init(struct device_node *node) 86static inline void of_node_init(struct device_node *node)
80{ 87{
81 kobject_init(&node->kobj, &of_node_ktype); 88 kobject_init(&node->kobj, &of_node_ktype);
89 node->fwnode.type = FWNODE_OF;
82} 90}
83 91
84/* true when node is initialized */ 92/* true when node is initialized */
@@ -105,18 +113,27 @@ static inline struct device_node *of_node_get(struct device_node *node)
105static inline void of_node_put(struct device_node *node) { } 113static inline void of_node_put(struct device_node *node) { }
106#endif /* !CONFIG_OF_DYNAMIC */ 114#endif /* !CONFIG_OF_DYNAMIC */
107 115
108#ifdef CONFIG_OF
109
110/* Pointer for first entry in chain of all nodes. */ 116/* Pointer for first entry in chain of all nodes. */
111extern struct device_node *of_allnodes; 117extern struct device_node *of_root;
112extern struct device_node *of_chosen; 118extern struct device_node *of_chosen;
113extern struct device_node *of_aliases; 119extern struct device_node *of_aliases;
114extern struct device_node *of_stdout; 120extern struct device_node *of_stdout;
115extern raw_spinlock_t devtree_lock; 121extern raw_spinlock_t devtree_lock;
116 122
123#ifdef CONFIG_OF
124static inline bool is_of_node(struct fwnode_handle *fwnode)
125{
126 return fwnode && fwnode->type == FWNODE_OF;
127}
128
129static inline struct device_node *of_node(struct fwnode_handle *fwnode)
130{
131 return fwnode ? container_of(fwnode, struct device_node, fwnode) : NULL;
132}
133
117static inline bool of_have_populated_dt(void) 134static inline bool of_have_populated_dt(void)
118{ 135{
119 return of_allnodes != NULL; 136 return of_root != NULL;
120} 137}
121 138
122static inline bool of_node_is_root(const struct device_node *node) 139static inline bool of_node_is_root(const struct device_node *node)
@@ -160,6 +177,7 @@ static inline void of_property_clear_flag(struct property *p, unsigned long flag
160 clear_bit(flag, &p->_flags); 177 clear_bit(flag, &p->_flags);
161} 178}
162 179
180extern struct device_node *__of_find_all_nodes(struct device_node *prev);
163extern struct device_node *of_find_all_nodes(struct device_node *prev); 181extern struct device_node *of_find_all_nodes(struct device_node *prev);
164 182
165/* 183/*
@@ -215,8 +233,9 @@ static inline const char *of_node_full_name(const struct device_node *np)
215 return np ? np->full_name : "<no-node>"; 233 return np ? np->full_name : "<no-node>";
216} 234}
217 235
218#define for_each_of_allnodes(dn) \ 236#define for_each_of_allnodes_from(from, dn) \
219 for (dn = of_allnodes; dn; dn = dn->allnext) 237 for (dn = __of_find_all_nodes(from); dn; dn = __of_find_all_nodes(dn))
238#define for_each_of_allnodes(dn) for_each_of_allnodes_from(NULL, dn)
220extern struct device_node *of_find_node_by_name(struct device_node *from, 239extern struct device_node *of_find_node_by_name(struct device_node *from,
221 const char *name); 240 const char *name);
222extern struct device_node *of_find_node_by_type(struct device_node *from, 241extern struct device_node *of_find_node_by_type(struct device_node *from,
@@ -228,7 +247,13 @@ extern struct device_node *of_find_matching_node_and_match(
228 const struct of_device_id *matches, 247 const struct of_device_id *matches,
229 const struct of_device_id **match); 248 const struct of_device_id **match);
230 249
231extern struct device_node *of_find_node_by_path(const char *path); 250extern struct device_node *of_find_node_opts_by_path(const char *path,
251 const char **opts);
252static inline struct device_node *of_find_node_by_path(const char *path)
253{
254 return of_find_node_opts_by_path(path, NULL);
255}
256
232extern struct device_node *of_find_node_by_phandle(phandle handle); 257extern struct device_node *of_find_node_by_phandle(phandle handle);
233extern struct device_node *of_get_parent(const struct device_node *node); 258extern struct device_node *of_get_parent(const struct device_node *node);
234extern struct device_node *of_get_next_parent(struct device_node *node); 259extern struct device_node *of_get_next_parent(struct device_node *node);
@@ -263,6 +288,10 @@ extern int of_property_read_u32_array(const struct device_node *np,
263 size_t sz); 288 size_t sz);
264extern int of_property_read_u64(const struct device_node *np, 289extern int of_property_read_u64(const struct device_node *np,
265 const char *propname, u64 *out_value); 290 const char *propname, u64 *out_value);
291extern int of_property_read_u64_array(const struct device_node *np,
292 const char *propname,
293 u64 *out_values,
294 size_t sz);
266 295
267extern int of_property_read_string(struct device_node *np, 296extern int of_property_read_string(struct device_node *np,
268 const char *propname, 297 const char *propname,
@@ -275,7 +304,7 @@ extern int of_property_read_string_helper(struct device_node *np,
275 const char **out_strs, size_t sz, int index); 304 const char **out_strs, size_t sz, int index);
276extern int of_device_is_compatible(const struct device_node *device, 305extern int of_device_is_compatible(const struct device_node *device,
277 const char *); 306 const char *);
278extern int of_device_is_available(const struct device_node *device); 307extern bool of_device_is_available(const struct device_node *device);
279extern const void *of_get_property(const struct device_node *node, 308extern const void *of_get_property(const struct device_node *node,
280 const char *name, 309 const char *name,
281 int *lenp); 310 int *lenp);
@@ -317,16 +346,6 @@ extern int of_update_property(struct device_node *np, struct property *newprop);
317#define OF_RECONFIG_REMOVE_PROPERTY 0x0004 346#define OF_RECONFIG_REMOVE_PROPERTY 0x0004
318#define OF_RECONFIG_UPDATE_PROPERTY 0x0005 347#define OF_RECONFIG_UPDATE_PROPERTY 0x0005
319 348
320struct of_prop_reconfig {
321 struct device_node *dn;
322 struct property *prop;
323 struct property *old_prop;
324};
325
326extern int of_reconfig_notifier_register(struct notifier_block *);
327extern int of_reconfig_notifier_unregister(struct notifier_block *);
328extern int of_reconfig_notify(unsigned long, void *);
329
330extern int of_attach_node(struct device_node *); 349extern int of_attach_node(struct device_node *);
331extern int of_detach_node(struct device_node *); 350extern int of_detach_node(struct device_node *);
332 351
@@ -355,6 +374,16 @@ bool of_console_check(struct device_node *dn, char *name, int index);
355 374
356#else /* CONFIG_OF */ 375#else /* CONFIG_OF */
357 376
377static inline bool is_of_node(struct fwnode_handle *fwnode)
378{
379 return false;
380}
381
382static inline struct device_node *of_node(struct fwnode_handle *fwnode)
383{
384 return NULL;
385}
386
358static inline const char* of_node_full_name(const struct device_node *np) 387static inline const char* of_node_full_name(const struct device_node *np)
359{ 388{
360 return "<no-node>"; 389 return "<no-node>";
@@ -385,6 +414,12 @@ static inline struct device_node *of_find_node_by_path(const char *path)
385 return NULL; 414 return NULL;
386} 415}
387 416
417static inline struct device_node *of_find_node_opts_by_path(const char *path,
418 const char **opts)
419{
420 return NULL;
421}
422
388static inline struct device_node *of_get_parent(const struct device_node *node) 423static inline struct device_node *of_get_parent(const struct device_node *node)
389{ 424{
390 return NULL; 425 return NULL;
@@ -426,9 +461,9 @@ static inline int of_device_is_compatible(const struct device_node *device,
426 return 0; 461 return 0;
427} 462}
428 463
429static inline int of_device_is_available(const struct device_node *device) 464static inline bool of_device_is_available(const struct device_node *device)
430{ 465{
431 return 0; 466 return false;
432} 467}
433 468
434static inline struct property *of_find_property(const struct device_node *np, 469static inline struct property *of_find_property(const struct device_node *np,
@@ -477,6 +512,13 @@ static inline int of_property_read_u32_array(const struct device_node *np,
477 return -ENOSYS; 512 return -ENOSYS;
478} 513}
479 514
515static inline int of_property_read_u64_array(const struct device_node *np,
516 const char *propname,
517 u64 *out_values, size_t sz)
518{
519 return -ENOSYS;
520}
521
480static inline int of_property_read_string(struct device_node *np, 522static inline int of_property_read_string(struct device_node *np,
481 const char *propname, 523 const char *propname,
482 const char **out_string) 524 const char **out_string)
@@ -760,6 +802,13 @@ static inline int of_property_read_u32(const struct device_node *np,
760 return of_property_read_u32_array(np, propname, out_value, 1); 802 return of_property_read_u32_array(np, propname, out_value, 1);
761} 803}
762 804
805static inline int of_property_read_s32(const struct device_node *np,
806 const char *propname,
807 s32 *out_value)
808{
809 return of_property_read_u32(np, propname, (u32*) out_value);
810}
811
763#define of_property_for_each_u32(np, propname, prop, p, u) \ 812#define of_property_for_each_u32(np, propname, prop, p, u) \
764 for (prop = of_find_property(np, propname, NULL), \ 813 for (prop = of_find_property(np, propname, NULL), \
765 p = of_prop_next_u32(prop, NULL, &u); \ 814 p = of_prop_next_u32(prop, NULL, &u); \
@@ -828,7 +877,7 @@ static inline int of_get_available_child_count(const struct device_node *np)
828 = { .compatible = compat, \ 877 = { .compatible = compat, \
829 .data = (fn == (fn_type)NULL) ? fn : fn } 878 .data = (fn == (fn_type)NULL) ? fn : fn }
830#else 879#else
831#define _OF_DECLARE(table, name, compat, fn, fn_type) \ 880#define _OF_DECLARE(table, name, compat, fn, fn_type) \
832 static const struct of_device_id __of_table_##name \ 881 static const struct of_device_id __of_table_##name \
833 __attribute__((unused)) \ 882 __attribute__((unused)) \
834 = { .compatible = compat, \ 883 = { .compatible = compat, \
@@ -879,7 +928,19 @@ struct of_changeset {
879 struct list_head entries; 928 struct list_head entries;
880}; 929};
881 930
931enum of_reconfig_change {
932 OF_RECONFIG_NO_CHANGE = 0,
933 OF_RECONFIG_CHANGE_ADD,
934 OF_RECONFIG_CHANGE_REMOVE,
935};
936
882#ifdef CONFIG_OF_DYNAMIC 937#ifdef CONFIG_OF_DYNAMIC
938extern int of_reconfig_notifier_register(struct notifier_block *);
939extern int of_reconfig_notifier_unregister(struct notifier_block *);
940extern int of_reconfig_notify(unsigned long, struct of_reconfig_data *rd);
941extern int of_reconfig_get_state_change(unsigned long action,
942 struct of_reconfig_data *arg);
943
883extern void of_changeset_init(struct of_changeset *ocs); 944extern void of_changeset_init(struct of_changeset *ocs);
884extern void of_changeset_destroy(struct of_changeset *ocs); 945extern void of_changeset_destroy(struct of_changeset *ocs);
885extern int of_changeset_apply(struct of_changeset *ocs); 946extern int of_changeset_apply(struct of_changeset *ocs);
@@ -917,9 +978,69 @@ static inline int of_changeset_update_property(struct of_changeset *ocs,
917{ 978{
918 return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop); 979 return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop);
919} 980}
920#endif 981#else /* CONFIG_OF_DYNAMIC */
982static inline int of_reconfig_notifier_register(struct notifier_block *nb)
983{
984 return -EINVAL;
985}
986static inline int of_reconfig_notifier_unregister(struct notifier_block *nb)
987{
988 return -EINVAL;
989}
990static inline int of_reconfig_notify(unsigned long action,
991 struct of_reconfig_data *arg)
992{
993 return -EINVAL;
994}
995static inline int of_reconfig_get_state_change(unsigned long action,
996 struct of_reconfig_data *arg)
997{
998 return -EINVAL;
999}
1000#endif /* CONFIG_OF_DYNAMIC */
921 1001
922/* CONFIG_OF_RESOLVE api */ 1002/* CONFIG_OF_RESOLVE api */
923extern int of_resolve_phandles(struct device_node *tree); 1003extern int of_resolve_phandles(struct device_node *tree);
924 1004
1005/**
1006 * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node
1007 * @np: Pointer to the given device_node
1008 *
1009 * return true if present false otherwise
1010 */
1011static inline bool of_device_is_system_power_controller(const struct device_node *np)
1012{
1013 return of_property_read_bool(np, "system-power-controller");
1014}
1015
1016/**
1017 * Overlay support
1018 */
1019
1020#ifdef CONFIG_OF_OVERLAY
1021
1022/* ID based overlays; the API for external users */
1023int of_overlay_create(struct device_node *tree);
1024int of_overlay_destroy(int id);
1025int of_overlay_destroy_all(void);
1026
1027#else
1028
1029static inline int of_overlay_create(struct device_node *tree)
1030{
1031 return -ENOTSUPP;
1032}
1033
1034static inline int of_overlay_destroy(int id)
1035{
1036 return -ENOTSUPP;
1037}
1038
1039static inline int of_overlay_destroy_all(void)
1040{
1041 return -ENOTSUPP;
1042}
1043
1044#endif
1045
925#endif /* _LINUX_OF_H */ 1046#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 8cb14eb393d6..d88e81be6368 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -106,7 +106,7 @@ extern int of_address_to_resource(struct device_node *dev, int index,
106 struct resource *r); 106 struct resource *r);
107void __iomem *of_iomap(struct device_node *node, int index); 107void __iomem *of_iomap(struct device_node *node, int index);
108void __iomem *of_io_request_and_map(struct device_node *device, 108void __iomem *of_io_request_and_map(struct device_node *device,
109 int index, char *name); 109 int index, const char *name);
110#else 110#else
111 111
112#include <linux/io.h> 112#include <linux/io.h>
@@ -123,7 +123,7 @@ static inline void __iomem *of_iomap(struct device_node *device, int index)
123} 123}
124 124
125static inline void __iomem *of_io_request_and_map(struct device_node *device, 125static inline void __iomem *of_io_request_and_map(struct device_node *device,
126 int index, char *name) 126 int index, const char *name)
127{ 127{
128 return IOMEM_ERR_PTR(-EINVAL); 128 return IOMEM_ERR_PTR(-EINVAL);
129} 129}
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index 1fd207e7a847..ce0e5abeb454 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -59,13 +59,13 @@ int of_pci_get_host_bridge_resources(struct device_node *dev,
59#endif 59#endif
60 60
61#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI) 61#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI)
62int of_pci_msi_chip_add(struct msi_chip *chip); 62int of_pci_msi_chip_add(struct msi_controller *chip);
63void of_pci_msi_chip_remove(struct msi_chip *chip); 63void of_pci_msi_chip_remove(struct msi_controller *chip);
64struct msi_chip *of_pci_find_msi_chip_by_node(struct device_node *of_node); 64struct msi_controller *of_pci_find_msi_chip_by_node(struct device_node *of_node);
65#else 65#else
66static inline int of_pci_msi_chip_add(struct msi_chip *chip) { return -EINVAL; } 66static inline int of_pci_msi_chip_add(struct msi_controller *chip) { return -EINVAL; }
67static inline void of_pci_msi_chip_remove(struct msi_chip *chip) { } 67static inline void of_pci_msi_chip_remove(struct msi_controller *chip) { }
68static inline struct msi_chip * 68static inline struct msi_controller *
69of_pci_find_msi_chip_by_node(struct device_node *of_node) { return NULL; } 69of_pci_find_msi_chip_by_node(struct device_node *of_node) { return NULL; }
70#endif 70#endif
71 71
diff --git a/include/linux/of_pdt.h b/include/linux/of_pdt.h
index c65a18a0cfdf..7e09244bb679 100644
--- a/include/linux/of_pdt.h
+++ b/include/linux/of_pdt.h
@@ -39,7 +39,6 @@ extern void *prom_early_alloc(unsigned long size);
39/* for building the device tree */ 39/* for building the device tree */
40extern void of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops); 40extern void of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops);
41 41
42extern void (*of_pdt_build_more)(struct device_node *dp, 42extern void (*of_pdt_build_more)(struct device_node *dp);
43 struct device_node ***nextp);
44 43
45#endif /* _LINUX_OF_PDT_H */ 44#endif /* _LINUX_OF_PDT_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index c2b0627a2317..8a860f096c35 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -84,4 +84,10 @@ static inline int of_platform_populate(struct device_node *root,
84static inline void of_platform_depopulate(struct device *parent) { } 84static inline void of_platform_depopulate(struct device *parent) { }
85#endif 85#endif
86 86
87#ifdef CONFIG_OF_DYNAMIC
88extern void of_platform_register_reconfig_notifier(void);
89#else
90static inline void of_platform_register_reconfig_notifier(void) { }
91#endif
92
87#endif /* _LINUX_OF_PLATFORM_H */ 93#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/omap-gpmc.h b/include/linux/omap-gpmc.h
new file mode 100644
index 000000000000..c2080eebbb47
--- /dev/null
+++ b/include/linux/omap-gpmc.h
@@ -0,0 +1,199 @@
1/*
2 * OMAP GPMC (General Purpose Memory Controller) defines
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 as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10/* Maximum Number of Chip Selects */
11#define GPMC_CS_NUM 8
12
13#define GPMC_CONFIG_WP 0x00000005
14
15#define GPMC_IRQ_FIFOEVENTENABLE 0x01
16#define GPMC_IRQ_COUNT_EVENT 0x02
17
18#define GPMC_BURST_4 4 /* 4 word burst */
19#define GPMC_BURST_8 8 /* 8 word burst */
20#define GPMC_BURST_16 16 /* 16 word burst */
21#define GPMC_DEVWIDTH_8BIT 1 /* 8-bit device width */
22#define GPMC_DEVWIDTH_16BIT 2 /* 16-bit device width */
23#define GPMC_MUX_AAD 1 /* Addr-Addr-Data multiplex */
24#define GPMC_MUX_AD 2 /* Addr-Data multiplex */
25
26/* bool type time settings */
27struct gpmc_bool_timings {
28 bool cycle2cyclediffcsen;
29 bool cycle2cyclesamecsen;
30 bool we_extra_delay;
31 bool oe_extra_delay;
32 bool adv_extra_delay;
33 bool cs_extra_delay;
34 bool time_para_granularity;
35};
36
37/*
38 * Note that all values in this struct are in nanoseconds except sync_clk
39 * (which is in picoseconds), while the register values are in gpmc_fck cycles.
40 */
41struct gpmc_timings {
42 /* Minimum clock period for synchronous mode (in picoseconds) */
43 u32 sync_clk;
44
45 /* Chip-select signal timings corresponding to GPMC_CS_CONFIG2 */
46 u32 cs_on; /* Assertion time */
47 u32 cs_rd_off; /* Read deassertion time */
48 u32 cs_wr_off; /* Write deassertion time */
49
50 /* ADV signal timings corresponding to GPMC_CONFIG3 */
51 u32 adv_on; /* Assertion time */
52 u32 adv_rd_off; /* Read deassertion time */
53 u32 adv_wr_off; /* Write deassertion time */
54
55 /* WE signals timings corresponding to GPMC_CONFIG4 */
56 u32 we_on; /* WE assertion time */
57 u32 we_off; /* WE deassertion time */
58
59 /* OE signals timings corresponding to GPMC_CONFIG4 */
60 u32 oe_on; /* OE assertion time */
61 u32 oe_off; /* OE deassertion time */
62
63 /* Access time and cycle time timings corresponding to GPMC_CONFIG5 */
64 u32 page_burst_access; /* Multiple access word delay */
65 u32 access; /* Start-cycle to first data valid delay */
66 u32 rd_cycle; /* Total read cycle time */
67 u32 wr_cycle; /* Total write cycle time */
68
69 u32 bus_turnaround;
70 u32 cycle2cycle_delay;
71
72 u32 wait_monitoring;
73 u32 clk_activation;
74
75 /* The following are only on OMAP3430 */
76 u32 wr_access; /* WRACCESSTIME */
77 u32 wr_data_mux_bus; /* WRDATAONADMUXBUS */
78
79 struct gpmc_bool_timings bool_timings;
80};
81
82/* Device timings in picoseconds */
83struct gpmc_device_timings {
84 u32 t_ceasu; /* address setup to CS valid */
85 u32 t_avdasu; /* address setup to ADV valid */
86 /* XXX: try to combine t_avdp_r & t_avdp_w. Issue is
87 * of tusb using these timings even for sync whilst
88 * ideally for adv_rd/(wr)_off it should have considered
89 * t_avdh instead. This indirectly necessitates r/w
90 * variations of t_avdp as it is possible to have one
91 * sync & other async
92 */
93 u32 t_avdp_r; /* ADV low time (what about t_cer ?) */
94 u32 t_avdp_w;
95 u32 t_aavdh; /* address hold time */
96 u32 t_oeasu; /* address setup to OE valid */
97 u32 t_aa; /* access time from ADV assertion */
98 u32 t_iaa; /* initial access time */
99 u32 t_oe; /* access time from OE assertion */
100 u32 t_ce; /* access time from CS asertion */
101 u32 t_rd_cycle; /* read cycle time */
102 u32 t_cez_r; /* read CS deassertion to high Z */
103 u32 t_cez_w; /* write CS deassertion to high Z */
104 u32 t_oez; /* OE deassertion to high Z */
105 u32 t_weasu; /* address setup to WE valid */
106 u32 t_wpl; /* write assertion time */
107 u32 t_wph; /* write deassertion time */
108 u32 t_wr_cycle; /* write cycle time */
109
110 u32 clk;
111 u32 t_bacc; /* burst access valid clock to output delay */
112 u32 t_ces; /* CS setup time to clk */
113 u32 t_avds; /* ADV setup time to clk */
114 u32 t_avdh; /* ADV hold time from clk */
115 u32 t_ach; /* address hold time from clk */
116 u32 t_rdyo; /* clk to ready valid */
117
118 u32 t_ce_rdyz; /* XXX: description ?, or use t_cez instead */
119 u32 t_ce_avd; /* CS on to ADV on delay */
120
121 /* XXX: check the possibility of combining
122 * cyc_aavhd_oe & cyc_aavdh_we
123 */
124 u8 cyc_aavdh_oe;/* read address hold time in cycles */
125 u8 cyc_aavdh_we;/* write address hold time in cycles */
126 u8 cyc_oe; /* access time from OE assertion in cycles */
127 u8 cyc_wpl; /* write deassertion time in cycles */
128 u32 cyc_iaa; /* initial access time in cycles */
129
130 /* extra delays */
131 bool ce_xdelay;
132 bool avd_xdelay;
133 bool oe_xdelay;
134 bool we_xdelay;
135};
136
137struct gpmc_settings {
138 bool burst_wrap; /* enables wrap bursting */
139 bool burst_read; /* enables read page/burst mode */
140 bool burst_write; /* enables write page/burst mode */
141 bool device_nand; /* device is NAND */
142 bool sync_read; /* enables synchronous reads */
143 bool sync_write; /* enables synchronous writes */
144 bool wait_on_read; /* monitor wait on reads */
145 bool wait_on_write; /* monitor wait on writes */
146 u32 burst_len; /* page/burst length */
147 u32 device_width; /* device bus width (8 or 16 bit) */
148 u32 mux_add_data; /* multiplex address & data */
149 u32 wait_pin; /* wait-pin to be used */
150};
151
152extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
153 struct gpmc_settings *gpmc_s,
154 struct gpmc_device_timings *dev_t);
155
156struct gpmc_nand_regs;
157struct device_node;
158
159extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs);
160extern int gpmc_get_client_irq(unsigned irq_config);
161
162extern unsigned int gpmc_ticks_to_ns(unsigned int ticks);
163
164extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
165extern int gpmc_calc_divider(unsigned int sync_clk);
166extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t);
167extern int gpmc_cs_program_settings(int cs, struct gpmc_settings *p);
168extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
169extern void gpmc_cs_free(int cs);
170extern int gpmc_configure(int cmd, int wval);
171extern void gpmc_read_settings_dt(struct device_node *np,
172 struct gpmc_settings *p);
173
174extern void omap3_gpmc_save_context(void);
175extern void omap3_gpmc_restore_context(void);
176
177struct gpmc_timings;
178struct omap_nand_platform_data;
179struct omap_onenand_platform_data;
180
181#if IS_ENABLED(CONFIG_MTD_NAND_OMAP2)
182extern int gpmc_nand_init(struct omap_nand_platform_data *d,
183 struct gpmc_timings *gpmc_t);
184#else
185static inline int gpmc_nand_init(struct omap_nand_platform_data *d,
186 struct gpmc_timings *gpmc_t)
187{
188 return 0;
189}
190#endif
191
192#if IS_ENABLED(CONFIG_MTD_ONENAND_OMAP2)
193extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
194#else
195#define board_onenand_data NULL
196static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
197{
198}
199#endif
diff --git a/include/linux/omap-mailbox.h b/include/linux/omap-mailbox.h
index f8322d9cd235..587bbdd31f5a 100644
--- a/include/linux/omap-mailbox.h
+++ b/include/linux/omap-mailbox.h
@@ -10,20 +10,20 @@
10#define OMAP_MAILBOX_H 10#define OMAP_MAILBOX_H
11 11
12typedef u32 mbox_msg_t; 12typedef u32 mbox_msg_t;
13struct omap_mbox;
14 13
15typedef int __bitwise omap_mbox_irq_t; 14typedef int __bitwise omap_mbox_irq_t;
16#define IRQ_TX ((__force omap_mbox_irq_t) 1) 15#define IRQ_TX ((__force omap_mbox_irq_t) 1)
17#define IRQ_RX ((__force omap_mbox_irq_t) 2) 16#define IRQ_RX ((__force omap_mbox_irq_t) 2)
18 17
19int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg); 18struct mbox_chan;
19struct mbox_client;
20 20
21struct omap_mbox *omap_mbox_get(const char *, struct notifier_block *nb); 21struct mbox_chan *omap_mbox_request_channel(struct mbox_client *cl,
22void omap_mbox_put(struct omap_mbox *mbox, struct notifier_block *nb); 22 const char *chan_name);
23 23
24void omap_mbox_save_ctx(struct omap_mbox *mbox); 24void omap_mbox_save_ctx(struct mbox_chan *chan);
25void omap_mbox_restore_ctx(struct omap_mbox *mbox); 25void omap_mbox_restore_ctx(struct mbox_chan *chan);
26void omap_mbox_enable_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq); 26void omap_mbox_enable_irq(struct mbox_chan *chan, omap_mbox_irq_t irq);
27void omap_mbox_disable_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq); 27void omap_mbox_disable_irq(struct mbox_chan *chan, omap_mbox_irq_t irq);
28 28
29#endif /* OMAP_MAILBOX_H */ 29#endif /* OMAP_MAILBOX_H */
diff --git a/include/linux/oom.h b/include/linux/oom.h
index e8d6e1058723..853698c721f7 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -92,6 +92,17 @@ static inline bool oom_gfp_allowed(gfp_t gfp_mask)
92 92
93extern struct task_struct *find_lock_task_mm(struct task_struct *p); 93extern struct task_struct *find_lock_task_mm(struct task_struct *p);
94 94
95static inline bool task_will_free_mem(struct task_struct *task)
96{
97 /*
98 * A coredumping process may sleep for an extended period in exit_mm(),
99 * so the oom killer cannot assume that the process will promptly exit
100 * and release memory.
101 */
102 return (task->flags & PF_EXITING) &&
103 !(task->signal->flags & SIGNAL_GROUP_COREDUMP);
104}
105
95/* sysctls */ 106/* sysctls */
96extern int sysctl_oom_dump_tasks; 107extern int sysctl_oom_dump_tasks;
97extern int sysctl_oom_kill_allocating_task; 108extern int sysctl_oom_kill_allocating_task;
diff --git a/include/linux/page-debug-flags.h b/include/linux/page-debug-flags.h
deleted file mode 100644
index 22691f614043..000000000000
--- a/include/linux/page-debug-flags.h
+++ /dev/null
@@ -1,32 +0,0 @@
1#ifndef LINUX_PAGE_DEBUG_FLAGS_H
2#define LINUX_PAGE_DEBUG_FLAGS_H
3
4/*
5 * page->debug_flags bits:
6 *
7 * PAGE_DEBUG_FLAG_POISON is set for poisoned pages. This is used to
8 * implement generic debug pagealloc feature. The pages are filled with
9 * poison patterns and set this flag after free_pages(). The poisoned
10 * pages are verified whether the patterns are not corrupted and clear
11 * the flag before alloc_pages().
12 */
13
14enum page_debug_flags {
15 PAGE_DEBUG_FLAG_POISON, /* Page is poisoned */
16 PAGE_DEBUG_FLAG_GUARD,
17};
18
19/*
20 * Ensure that CONFIG_WANT_PAGE_DEBUG_FLAGS reliably
21 * gets turned off when no debug features are enabling it!
22 */
23
24#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
25#if !defined(CONFIG_PAGE_POISONING) && \
26 !defined(CONFIG_PAGE_GUARD) \
27/* && !defined(CONFIG_PAGE_DEBUG_SOMETHING_ELSE) && ... */
28#error WANT_PAGE_DEBUG_FLAGS is turned on with no debug features!
29#endif
30#endif /* CONFIG_WANT_PAGE_DEBUG_FLAGS */
31
32#endif /* LINUX_PAGE_DEBUG_FLAGS_H */
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
deleted file mode 100644
index 5c831f1eca79..000000000000
--- a/include/linux/page_cgroup.h
+++ /dev/null
@@ -1,105 +0,0 @@
1#ifndef __LINUX_PAGE_CGROUP_H
2#define __LINUX_PAGE_CGROUP_H
3
4enum {
5 /* flags for mem_cgroup */
6 PCG_USED = 0x01, /* This page is charged to a memcg */
7 PCG_MEM = 0x02, /* This page holds a memory charge */
8 PCG_MEMSW = 0x04, /* This page holds a memory+swap charge */
9};
10
11struct pglist_data;
12
13#ifdef CONFIG_MEMCG
14struct mem_cgroup;
15
16/*
17 * Page Cgroup can be considered as an extended mem_map.
18 * A page_cgroup page is associated with every page descriptor. The
19 * page_cgroup helps us identify information about the cgroup
20 * All page cgroups are allocated at boot or memory hotplug event,
21 * then the page cgroup for pfn always exists.
22 */
23struct page_cgroup {
24 unsigned long flags;
25 struct mem_cgroup *mem_cgroup;
26};
27
28extern void pgdat_page_cgroup_init(struct pglist_data *pgdat);
29
30#ifdef CONFIG_SPARSEMEM
31static inline void page_cgroup_init_flatmem(void)
32{
33}
34extern void page_cgroup_init(void);
35#else
36extern void page_cgroup_init_flatmem(void);
37static inline void page_cgroup_init(void)
38{
39}
40#endif
41
42struct page_cgroup *lookup_page_cgroup(struct page *page);
43
44static inline int PageCgroupUsed(struct page_cgroup *pc)
45{
46 return !!(pc->flags & PCG_USED);
47}
48#else /* !CONFIG_MEMCG */
49struct page_cgroup;
50
51static inline void pgdat_page_cgroup_init(struct pglist_data *pgdat)
52{
53}
54
55static inline struct page_cgroup *lookup_page_cgroup(struct page *page)
56{
57 return NULL;
58}
59
60static inline void page_cgroup_init(void)
61{
62}
63
64static inline void page_cgroup_init_flatmem(void)
65{
66}
67#endif /* CONFIG_MEMCG */
68
69#include <linux/swap.h>
70
71#ifdef CONFIG_MEMCG_SWAP
72extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
73 unsigned short old, unsigned short new);
74extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id);
75extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent);
76extern int swap_cgroup_swapon(int type, unsigned long max_pages);
77extern void swap_cgroup_swapoff(int type);
78#else
79
80static inline
81unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id)
82{
83 return 0;
84}
85
86static inline
87unsigned short lookup_swap_cgroup_id(swp_entry_t ent)
88{
89 return 0;
90}
91
92static inline int
93swap_cgroup_swapon(int type, unsigned long max_pages)
94{
95 return 0;
96}
97
98static inline void swap_cgroup_swapoff(int type)
99{
100 return;
101}
102
103#endif /* CONFIG_MEMCG_SWAP */
104
105#endif /* __LINUX_PAGE_CGROUP_H */
diff --git a/include/linux/page_counter.h b/include/linux/page_counter.h
new file mode 100644
index 000000000000..955421575d16
--- /dev/null
+++ b/include/linux/page_counter.h
@@ -0,0 +1,51 @@
1#ifndef _LINUX_PAGE_COUNTER_H
2#define _LINUX_PAGE_COUNTER_H
3
4#include <linux/atomic.h>
5#include <linux/kernel.h>
6#include <asm/page.h>
7
8struct page_counter {
9 atomic_long_t count;
10 unsigned long limit;
11 struct page_counter *parent;
12
13 /* legacy */
14 unsigned long watermark;
15 unsigned long failcnt;
16};
17
18#if BITS_PER_LONG == 32
19#define PAGE_COUNTER_MAX LONG_MAX
20#else
21#define PAGE_COUNTER_MAX (LONG_MAX / PAGE_SIZE)
22#endif
23
24static inline void page_counter_init(struct page_counter *counter,
25 struct page_counter *parent)
26{
27 atomic_long_set(&counter->count, 0);
28 counter->limit = PAGE_COUNTER_MAX;
29 counter->parent = parent;
30}
31
32static inline unsigned long page_counter_read(struct page_counter *counter)
33{
34 return atomic_long_read(&counter->count);
35}
36
37void page_counter_cancel(struct page_counter *counter, unsigned long nr_pages);
38void page_counter_charge(struct page_counter *counter, unsigned long nr_pages);
39int page_counter_try_charge(struct page_counter *counter,
40 unsigned long nr_pages,
41 struct page_counter **fail);
42void page_counter_uncharge(struct page_counter *counter, unsigned long nr_pages);
43int page_counter_limit(struct page_counter *counter, unsigned long limit);
44int page_counter_memparse(const char *buf, unsigned long *nr_pages);
45
46static inline void page_counter_reset_watermark(struct page_counter *counter)
47{
48 counter->watermark = page_counter_read(counter);
49}
50
51#endif /* _LINUX_PAGE_COUNTER_H */
diff --git a/include/linux/page_ext.h b/include/linux/page_ext.h
new file mode 100644
index 000000000000..d2a2c84c72d0
--- /dev/null
+++ b/include/linux/page_ext.h
@@ -0,0 +1,84 @@
1#ifndef __LINUX_PAGE_EXT_H
2#define __LINUX_PAGE_EXT_H
3
4#include <linux/types.h>
5#include <linux/stacktrace.h>
6
7struct pglist_data;
8struct page_ext_operations {
9 bool (*need)(void);
10 void (*init)(void);
11};
12
13#ifdef CONFIG_PAGE_EXTENSION
14
15/*
16 * page_ext->flags bits:
17 *
18 * PAGE_EXT_DEBUG_POISON is set for poisoned pages. This is used to
19 * implement generic debug pagealloc feature. The pages are filled with
20 * poison patterns and set this flag after free_pages(). The poisoned
21 * pages are verified whether the patterns are not corrupted and clear
22 * the flag before alloc_pages().
23 */
24
25enum page_ext_flags {
26 PAGE_EXT_DEBUG_POISON, /* Page is poisoned */
27 PAGE_EXT_DEBUG_GUARD,
28 PAGE_EXT_OWNER,
29};
30
31/*
32 * Page Extension can be considered as an extended mem_map.
33 * A page_ext page is associated with every page descriptor. The
34 * page_ext helps us add more information about the page.
35 * All page_ext are allocated at boot or memory hotplug event,
36 * then the page_ext for pfn always exists.
37 */
38struct page_ext {
39 unsigned long flags;
40#ifdef CONFIG_PAGE_OWNER
41 unsigned int order;
42 gfp_t gfp_mask;
43 struct stack_trace trace;
44 unsigned long trace_entries[8];
45#endif
46};
47
48extern void pgdat_page_ext_init(struct pglist_data *pgdat);
49
50#ifdef CONFIG_SPARSEMEM
51static inline void page_ext_init_flatmem(void)
52{
53}
54extern void page_ext_init(void);
55#else
56extern void page_ext_init_flatmem(void);
57static inline void page_ext_init(void)
58{
59}
60#endif
61
62struct page_ext *lookup_page_ext(struct page *page);
63
64#else /* !CONFIG_PAGE_EXTENSION */
65struct page_ext;
66
67static inline void pgdat_page_ext_init(struct pglist_data *pgdat)
68{
69}
70
71static inline struct page_ext *lookup_page_ext(struct page *page)
72{
73 return NULL;
74}
75
76static inline void page_ext_init(void)
77{
78}
79
80static inline void page_ext_init_flatmem(void)
81{
82}
83#endif /* CONFIG_PAGE_EXTENSION */
84#endif /* __LINUX_PAGE_EXT_H */
diff --git a/include/linux/page_owner.h b/include/linux/page_owner.h
new file mode 100644
index 000000000000..b48c3471c254
--- /dev/null
+++ b/include/linux/page_owner.h
@@ -0,0 +1,38 @@
1#ifndef __LINUX_PAGE_OWNER_H
2#define __LINUX_PAGE_OWNER_H
3
4#ifdef CONFIG_PAGE_OWNER
5extern bool page_owner_inited;
6extern struct page_ext_operations page_owner_ops;
7
8extern void __reset_page_owner(struct page *page, unsigned int order);
9extern void __set_page_owner(struct page *page,
10 unsigned int order, gfp_t gfp_mask);
11
12static inline void reset_page_owner(struct page *page, unsigned int order)
13{
14 if (likely(!page_owner_inited))
15 return;
16
17 __reset_page_owner(page, order);
18}
19
20static inline void set_page_owner(struct page *page,
21 unsigned int order, gfp_t gfp_mask)
22{
23 if (likely(!page_owner_inited))
24 return;
25
26 __set_page_owner(page, order, gfp_mask);
27}
28#else
29static inline void reset_page_owner(struct page *page, unsigned int order)
30{
31}
32static inline void set_page_owner(struct page *page,
33 unsigned int order, gfp_t gfp_mask)
34{
35}
36
37#endif /* CONFIG_PAGE_OWNER */
38#endif /* __LINUX_PAGE_OWNER_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5be8db45e368..44a27696ab6c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -331,6 +331,7 @@ struct pci_dev {
331 unsigned int is_added:1; 331 unsigned int is_added:1;
332 unsigned int is_busmaster:1; /* device is busmaster */ 332 unsigned int is_busmaster:1; /* device is busmaster */
333 unsigned int no_msi:1; /* device may not use msi */ 333 unsigned int no_msi:1; /* device may not use msi */
334 unsigned int no_64bit_msi:1; /* device may only use 32-bit MSIs */
334 unsigned int block_cfg_access:1; /* config space access is blocked */ 335 unsigned int block_cfg_access:1; /* config space access is blocked */
335 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 336 unsigned int broken_parity_status:1; /* Device generates false positive parity */
336 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ 337 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */
@@ -449,7 +450,7 @@ struct pci_bus {
449 struct resource busn_res; /* bus numbers routed to this bus */ 450 struct resource busn_res; /* bus numbers routed to this bus */
450 451
451 struct pci_ops *ops; /* configuration access functions */ 452 struct pci_ops *ops; /* configuration access functions */
452 struct msi_chip *msi; /* MSI controller */ 453 struct msi_controller *msi; /* MSI controller */
453 void *sysdata; /* hook for sys-specific extension */ 454 void *sysdata; /* hook for sys-specific extension */
454 struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */ 455 struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */
455 456
@@ -1003,6 +1004,8 @@ void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size);
1003int pci_save_state(struct pci_dev *dev); 1004int pci_save_state(struct pci_dev *dev);
1004void pci_restore_state(struct pci_dev *dev); 1005void pci_restore_state(struct pci_dev *dev);
1005struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev); 1006struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev);
1007int pci_load_saved_state(struct pci_dev *dev,
1008 struct pci_saved_state *state);
1006int pci_load_and_free_saved_state(struct pci_dev *dev, 1009int pci_load_and_free_saved_state(struct pci_dev *dev,
1007 struct pci_saved_state **state); 1010 struct pci_saved_state **state);
1008struct pci_cap_saved_state *pci_find_saved_cap(struct pci_dev *dev, char cap); 1011struct pci_cap_saved_state *pci_find_saved_cap(struct pci_dev *dev, char cap);
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 2706ee9a4327..8c7895061121 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -109,7 +109,6 @@ struct hotplug_slot {
109 struct list_head slot_list; 109 struct list_head slot_list;
110 struct pci_slot *pci_slot; 110 struct pci_slot *pci_slot;
111}; 111};
112#define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj)
113 112
114static inline const char *hotplug_slot_name(const struct hotplug_slot *slot) 113static inline const char *hotplug_slot_name(const struct hotplug_slot *slot)
115{ 114{
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 1fa99a301817..e63c02a93f6b 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -522,6 +522,8 @@
522#define PCI_DEVICE_ID_AMD_15H_M10H_F3 0x1403 522#define PCI_DEVICE_ID_AMD_15H_M10H_F3 0x1403
523#define PCI_DEVICE_ID_AMD_15H_M30H_NB_F3 0x141d 523#define PCI_DEVICE_ID_AMD_15H_M30H_NB_F3 0x141d
524#define PCI_DEVICE_ID_AMD_15H_M30H_NB_F4 0x141e 524#define PCI_DEVICE_ID_AMD_15H_M30H_NB_F4 0x141e
525#define PCI_DEVICE_ID_AMD_15H_M60H_NB_F3 0x1573
526#define PCI_DEVICE_ID_AMD_15H_M60H_NB_F4 0x1574
525#define PCI_DEVICE_ID_AMD_15H_NB_F0 0x1600 527#define PCI_DEVICE_ID_AMD_15H_NB_F0 0x1600
526#define PCI_DEVICE_ID_AMD_15H_NB_F1 0x1601 528#define PCI_DEVICE_ID_AMD_15H_NB_F1 0x1601
527#define PCI_DEVICE_ID_AMD_15H_NB_F2 0x1602 529#define PCI_DEVICE_ID_AMD_15H_NB_F2 0x1602
@@ -562,6 +564,7 @@
562#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450 564#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450
563#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451 565#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451
564#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458 566#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458
567#define PCI_DEVICE_ID_AMD_NL_USB 0x7912
565#define PCI_DEVICE_ID_AMD_CS5535_IDE 0x208F 568#define PCI_DEVICE_ID_AMD_CS5535_IDE 0x208F
566#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090 569#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090
567#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091 570#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 420032d41d27..57f3a1c550dc 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -254,8 +254,6 @@ do { \
254#endif /* CONFIG_SMP */ 254#endif /* CONFIG_SMP */
255 255
256#define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu)) 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 257
260/* 258/*
261 * Must be an lvalue. Since @var must be a simple identifier, 259 * Must be an lvalue. Since @var must be a simple identifier,
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
index 51ce60c35f4c..b4337646388b 100644
--- a/include/linux/percpu-refcount.h
+++ b/include/linux/percpu-refcount.h
@@ -128,10 +128,8 @@ static inline void percpu_ref_kill(struct percpu_ref *ref)
128static inline bool __ref_is_percpu(struct percpu_ref *ref, 128static inline bool __ref_is_percpu(struct percpu_ref *ref,
129 unsigned long __percpu **percpu_countp) 129 unsigned long __percpu **percpu_countp)
130{ 130{
131 unsigned long percpu_ptr = ACCESS_ONCE(ref->percpu_count_ptr);
132
133 /* paired with smp_store_release() in percpu_ref_reinit() */ 131 /* paired with smp_store_release() in percpu_ref_reinit() */
134 smp_read_barrier_depends(); 132 unsigned long percpu_ptr = lockless_dereference(ref->percpu_count_ptr);
135 133
136 /* 134 /*
137 * Theoretically, the following could test just ATOMIC; however, 135 * Theoretically, the following could test just ATOMIC; however,
@@ -147,28 +145,42 @@ static inline bool __ref_is_percpu(struct percpu_ref *ref,
147} 145}
148 146
149/** 147/**
150 * percpu_ref_get - increment a percpu refcount 148 * percpu_ref_get_many - increment a percpu refcount
151 * @ref: percpu_ref to get 149 * @ref: percpu_ref to get
150 * @nr: number of references to get
152 * 151 *
153 * Analagous to atomic_long_inc(). 152 * Analogous to atomic_long_add().
154 * 153 *
155 * This function is safe to call as long as @ref is between init and exit. 154 * This function is safe to call as long as @ref is between init and exit.
156 */ 155 */
157static inline void percpu_ref_get(struct percpu_ref *ref) 156static inline void percpu_ref_get_many(struct percpu_ref *ref, unsigned long nr)
158{ 157{
159 unsigned long __percpu *percpu_count; 158 unsigned long __percpu *percpu_count;
160 159
161 rcu_read_lock_sched(); 160 rcu_read_lock_sched();
162 161
163 if (__ref_is_percpu(ref, &percpu_count)) 162 if (__ref_is_percpu(ref, &percpu_count))
164 this_cpu_inc(*percpu_count); 163 this_cpu_add(*percpu_count, nr);
165 else 164 else
166 atomic_long_inc(&ref->count); 165 atomic_long_add(nr, &ref->count);
167 166
168 rcu_read_unlock_sched(); 167 rcu_read_unlock_sched();
169} 168}
170 169
171/** 170/**
171 * percpu_ref_get - increment a percpu refcount
172 * @ref: percpu_ref to get
173 *
174 * Analagous to atomic_long_inc().
175 *
176 * This function is safe to call as long as @ref is between init and exit.
177 */
178static inline void percpu_ref_get(struct percpu_ref *ref)
179{
180 percpu_ref_get_many(ref, 1);
181}
182
183/**
172 * percpu_ref_tryget - try to increment a percpu refcount 184 * percpu_ref_tryget - try to increment a percpu refcount
173 * @ref: percpu_ref to try-get 185 * @ref: percpu_ref to try-get
174 * 186 *
@@ -231,29 +243,44 @@ static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)
231} 243}
232 244
233/** 245/**
234 * percpu_ref_put - decrement a percpu refcount 246 * percpu_ref_put_many - decrement a percpu refcount
235 * @ref: percpu_ref to put 247 * @ref: percpu_ref to put
248 * @nr: number of references to put
236 * 249 *
237 * Decrement the refcount, and if 0, call the release function (which was passed 250 * Decrement the refcount, and if 0, call the release function (which was passed
238 * to percpu_ref_init()) 251 * to percpu_ref_init())
239 * 252 *
240 * This function is safe to call as long as @ref is between init and exit. 253 * This function is safe to call as long as @ref is between init and exit.
241 */ 254 */
242static inline void percpu_ref_put(struct percpu_ref *ref) 255static inline void percpu_ref_put_many(struct percpu_ref *ref, unsigned long nr)
243{ 256{
244 unsigned long __percpu *percpu_count; 257 unsigned long __percpu *percpu_count;
245 258
246 rcu_read_lock_sched(); 259 rcu_read_lock_sched();
247 260
248 if (__ref_is_percpu(ref, &percpu_count)) 261 if (__ref_is_percpu(ref, &percpu_count))
249 this_cpu_dec(*percpu_count); 262 this_cpu_sub(*percpu_count, nr);
250 else if (unlikely(atomic_long_dec_and_test(&ref->count))) 263 else if (unlikely(atomic_long_sub_and_test(nr, &ref->count)))
251 ref->release(ref); 264 ref->release(ref);
252 265
253 rcu_read_unlock_sched(); 266 rcu_read_unlock_sched();
254} 267}
255 268
256/** 269/**
270 * percpu_ref_put - decrement a percpu refcount
271 * @ref: percpu_ref to put
272 *
273 * Decrement the refcount, and if 0, call the release function (which was passed
274 * to percpu_ref_init())
275 *
276 * This function is safe to call as long as @ref is between init and exit.
277 */
278static inline void percpu_ref_put(struct percpu_ref *ref)
279{
280 percpu_ref_put_many(ref, 1);
281}
282
283/**
257 * percpu_ref_is_zero - test whether a percpu refcount reached zero 284 * percpu_ref_is_zero - test whether a percpu refcount reached zero
258 * @ref: percpu_ref to test 285 * @ref: percpu_ref to test
259 * 286 *
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index a3aa63e47637..caebf2a758dc 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -5,6 +5,7 @@
5#include <linux/preempt.h> 5#include <linux/preempt.h>
6#include <linux/smp.h> 6#include <linux/smp.h>
7#include <linux/cpumask.h> 7#include <linux/cpumask.h>
8#include <linux/printk.h>
8#include <linux/pfn.h> 9#include <linux/pfn.h>
9#include <linux/init.h> 10#include <linux/init.h>
10 11
@@ -134,4 +135,7 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
134 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), \ 135 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), \
135 __alignof__(type)) 136 __alignof__(type))
136 137
138/* To avoid include hell, as printk can not declare this, we declare it here */
139DECLARE_PER_CPU(printk_func_t, printk_func);
140
137#endif /* __LINUX_PERCPU_H */ 141#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 893a0d07986f..486e84ccb1f9 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -79,7 +79,7 @@ struct perf_branch_stack {
79 struct perf_branch_entry entries[0]; 79 struct perf_branch_entry entries[0];
80}; 80};
81 81
82struct perf_regs_user { 82struct perf_regs {
83 __u64 abi; 83 __u64 abi;
84 struct pt_regs *regs; 84 struct pt_regs *regs;
85}; 85};
@@ -580,34 +580,40 @@ extern u64 perf_event_read_value(struct perf_event *event,
580 580
581 581
582struct perf_sample_data { 582struct perf_sample_data {
583 u64 type; 583 /*
584 * Fields set by perf_sample_data_init(), group so as to
585 * minimize the cachelines touched.
586 */
587 u64 addr;
588 struct perf_raw_record *raw;
589 struct perf_branch_stack *br_stack;
590 u64 period;
591 u64 weight;
592 u64 txn;
593 union perf_mem_data_src data_src;
584 594
595 /*
596 * The other fields, optionally {set,used} by
597 * perf_{prepare,output}_sample().
598 */
599 u64 type;
585 u64 ip; 600 u64 ip;
586 struct { 601 struct {
587 u32 pid; 602 u32 pid;
588 u32 tid; 603 u32 tid;
589 } tid_entry; 604 } tid_entry;
590 u64 time; 605 u64 time;
591 u64 addr;
592 u64 id; 606 u64 id;
593 u64 stream_id; 607 u64 stream_id;
594 struct { 608 struct {
595 u32 cpu; 609 u32 cpu;
596 u32 reserved; 610 u32 reserved;
597 } cpu_entry; 611 } cpu_entry;
598 u64 period;
599 union perf_mem_data_src data_src;
600 struct perf_callchain_entry *callchain; 612 struct perf_callchain_entry *callchain;
601 struct perf_raw_record *raw; 613 struct perf_regs regs_user;
602 struct perf_branch_stack *br_stack; 614 struct perf_regs regs_intr;
603 struct perf_regs_user regs_user;
604 u64 stack_user_size; 615 u64 stack_user_size;
605 u64 weight; 616} ____cacheline_aligned;
606 /*
607 * Transaction flags for abort events:
608 */
609 u64 txn;
610};
611 617
612/* default value for data source */ 618/* default value for data source */
613#define PERF_MEM_NA (PERF_MEM_S(OP, NA) |\ 619#define PERF_MEM_NA (PERF_MEM_S(OP, NA) |\
@@ -624,9 +630,6 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
624 data->raw = NULL; 630 data->raw = NULL;
625 data->br_stack = NULL; 631 data->br_stack = NULL;
626 data->period = period; 632 data->period = period;
627 data->regs_user.abi = PERF_SAMPLE_REGS_ABI_NONE;
628 data->regs_user.regs = NULL;
629 data->stack_user_size = 0;
630 data->weight = 0; 633 data->weight = 0;
631 data->data_src.val = PERF_MEM_NA; 634 data->data_src.val = PERF_MEM_NA;
632 data->txn = 0; 635 data->txn = 0;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index d090cfcaa167..22af8f8f5802 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -433,6 +433,7 @@ struct phy_device {
433 * by this PHY 433 * by this PHY
434 * flags: A bitfield defining certain other features this PHY 434 * flags: A bitfield defining certain other features this PHY
435 * supports (like interrupts) 435 * supports (like interrupts)
436 * driver_data: static driver data
436 * 437 *
437 * The drivers must implement config_aneg and read_status. All 438 * The drivers must implement config_aneg and read_status. All
438 * other functions are optional. Note that none of these 439 * other functions are optional. Note that none of these
@@ -448,6 +449,7 @@ struct phy_driver {
448 unsigned int phy_id_mask; 449 unsigned int phy_id_mask;
449 u32 features; 450 u32 features;
450 u32 flags; 451 u32 flags;
452 const void *driver_data;
451 453
452 /* 454 /*
453 * Called to issue a PHY software reset 455 * Called to issue a PHY software reset
@@ -772,4 +774,28 @@ int __init mdio_bus_init(void);
772void mdio_bus_exit(void); 774void mdio_bus_exit(void);
773 775
774extern struct bus_type mdio_bus_type; 776extern struct bus_type mdio_bus_type;
777
778/**
779 * module_phy_driver() - Helper macro for registering PHY drivers
780 * @__phy_drivers: array of PHY drivers to register
781 *
782 * Helper macro for PHY drivers which do not do anything special in module
783 * init/exit. Each module may only use this macro once, and calling it
784 * replaces module_init() and module_exit().
785 */
786#define phy_module_driver(__phy_drivers, __count) \
787static int __init phy_module_init(void) \
788{ \
789 return phy_drivers_register(__phy_drivers, __count); \
790} \
791module_init(phy_module_init); \
792static void __exit phy_module_exit(void) \
793{ \
794 phy_drivers_unregister(__phy_drivers, __count); \
795} \
796module_exit(phy_module_exit)
797
798#define module_phy_driver(__phy_drivers) \
799 phy_module_driver(__phy_drivers, ARRAY_SIZE(__phy_drivers))
800
775#endif /* __PHY_H */ 801#endif /* __PHY_H */
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index 8cb6f815475b..a0197fa1b116 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -61,7 +61,6 @@ struct phy {
61 struct device dev; 61 struct device dev;
62 int id; 62 int id;
63 const struct phy_ops *ops; 63 const struct phy_ops *ops;
64 struct phy_init_data *init_data;
65 struct mutex mutex; 64 struct mutex mutex;
66 int init_count; 65 int init_count;
67 int power_count; 66 int power_count;
@@ -84,33 +83,14 @@ struct phy_provider {
84 struct of_phandle_args *args); 83 struct of_phandle_args *args);
85}; 84};
86 85
87/** 86struct phy_lookup {
88 * struct phy_consumer - represents the phy consumer 87 struct list_head node;
89 * @dev_name: the device name of the controller that will use this PHY device 88 const char *dev_id;
90 * @port: name given to the consumer port 89 const char *con_id;
91 */ 90 struct phy *phy;
92struct phy_consumer {
93 const char *dev_name;
94 const char *port;
95};
96
97/**
98 * struct phy_init_data - contains the list of PHY consumers
99 * @num_consumers: number of consumers for this PHY device
100 * @consumers: list of PHY consumers
101 */
102struct phy_init_data {
103 unsigned int num_consumers;
104 struct phy_consumer *consumers;
105}; 91};
106 92
107#define PHY_CONSUMER(_dev_name, _port) \ 93#define to_phy(a) (container_of((a), struct phy, dev))
108{ \
109 .dev_name = _dev_name, \
110 .port = _port, \
111}
112
113#define to_phy(dev) (container_of((dev), struct phy, dev))
114 94
115#define of_phy_provider_register(dev, xlate) \ 95#define of_phy_provider_register(dev, xlate) \
116 __of_phy_provider_register((dev), THIS_MODULE, (xlate)) 96 __of_phy_provider_register((dev), THIS_MODULE, (xlate))
@@ -159,10 +139,9 @@ struct phy *of_phy_get(struct device_node *np, const char *con_id);
159struct phy *of_phy_simple_xlate(struct device *dev, 139struct phy *of_phy_simple_xlate(struct device *dev,
160 struct of_phandle_args *args); 140 struct of_phandle_args *args);
161struct phy *phy_create(struct device *dev, struct device_node *node, 141struct phy *phy_create(struct device *dev, struct device_node *node,
162 const struct phy_ops *ops, 142 const struct phy_ops *ops);
163 struct phy_init_data *init_data);
164struct phy *devm_phy_create(struct device *dev, struct device_node *node, 143struct phy *devm_phy_create(struct device *dev, struct device_node *node,
165 const struct phy_ops *ops, struct phy_init_data *init_data); 144 const struct phy_ops *ops);
166void phy_destroy(struct phy *phy); 145void phy_destroy(struct phy *phy);
167void devm_phy_destroy(struct device *dev, struct phy *phy); 146void devm_phy_destroy(struct device *dev, struct phy *phy);
168struct phy_provider *__of_phy_provider_register(struct device *dev, 147struct phy_provider *__of_phy_provider_register(struct device *dev,
@@ -174,6 +153,8 @@ struct phy_provider *__devm_of_phy_provider_register(struct device *dev,
174void of_phy_provider_unregister(struct phy_provider *phy_provider); 153void of_phy_provider_unregister(struct phy_provider *phy_provider);
175void devm_of_phy_provider_unregister(struct device *dev, 154void devm_of_phy_provider_unregister(struct device *dev,
176 struct phy_provider *phy_provider); 155 struct phy_provider *phy_provider);
156int phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id);
157void phy_remove_lookup(struct phy *phy, const char *con_id, const char *dev_id);
177#else 158#else
178static inline int phy_pm_runtime_get(struct phy *phy) 159static inline int phy_pm_runtime_get(struct phy *phy)
179{ 160{
@@ -301,16 +282,14 @@ static inline struct phy *of_phy_simple_xlate(struct device *dev,
301 282
302static inline struct phy *phy_create(struct device *dev, 283static inline struct phy *phy_create(struct device *dev,
303 struct device_node *node, 284 struct device_node *node,
304 const struct phy_ops *ops, 285 const struct phy_ops *ops)
305 struct phy_init_data *init_data)
306{ 286{
307 return ERR_PTR(-ENOSYS); 287 return ERR_PTR(-ENOSYS);
308} 288}
309 289
310static inline struct phy *devm_phy_create(struct device *dev, 290static inline struct phy *devm_phy_create(struct device *dev,
311 struct device_node *node, 291 struct device_node *node,
312 const struct phy_ops *ops, 292 const struct phy_ops *ops)
313 struct phy_init_data *init_data)
314{ 293{
315 return ERR_PTR(-ENOSYS); 294 return ERR_PTR(-ENOSYS);
316} 295}
@@ -345,6 +324,13 @@ static inline void devm_of_phy_provider_unregister(struct device *dev,
345 struct phy_provider *phy_provider) 324 struct phy_provider *phy_provider)
346{ 325{
347} 326}
327static inline int
328phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id)
329{
330 return 0;
331}
332static inline void phy_remove_lookup(struct phy *phy, const char *con_id,
333 const char *dev_id) { }
348#endif 334#endif
349 335
350#endif /* __DRIVERS_PHY_H */ 336#endif /* __DRIVERS_PHY_H */
diff --git a/include/linux/platform_data/asoc-s3c.h b/include/linux/platform_data/asoc-s3c.h
index a6591c693ebb..5e0bc779e6c5 100644
--- a/include/linux/platform_data/asoc-s3c.h
+++ b/include/linux/platform_data/asoc-s3c.h
@@ -27,6 +27,7 @@ struct samsung_i2s {
27#define QUIRK_NO_MUXPSR (1 << 2) 27#define QUIRK_NO_MUXPSR (1 << 2)
28#define QUIRK_NEED_RSTCLR (1 << 3) 28#define QUIRK_NEED_RSTCLR (1 << 3)
29#define QUIRK_SUPPORTS_TDM (1 << 4) 29#define QUIRK_SUPPORTS_TDM (1 << 4)
30#define QUIRK_SUPPORTS_IDMA (1 << 5)
30 /* Quirks of the I2S controller */ 31 /* Quirks of the I2S controller */
31 u32 quirks; 32 u32 quirks;
32 dma_addr_t idma_addr; 33 dma_addr_t idma_addr;
diff --git a/include/linux/platform_data/bcmgenet.h b/include/linux/platform_data/bcmgenet.h
new file mode 100644
index 000000000000..26af54321958
--- /dev/null
+++ b/include/linux/platform_data/bcmgenet.h
@@ -0,0 +1,18 @@
1#ifndef __LINUX_PLATFORM_DATA_BCMGENET_H__
2#define __LINUX_PLATFORM_DATA_BCMGENET_H__
3
4#include <linux/types.h>
5#include <linux/if_ether.h>
6#include <linux/phy.h>
7
8struct bcmgenet_platform_data {
9 bool mdio_enabled;
10 phy_interface_t phy_interface;
11 int phy_address;
12 int phy_speed;
13 int phy_duplex;
14 u8 mac_address[ETH_ALEN];
15 int genet_version;
16};
17
18#endif
diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h
index 6a1357d31871..7d964e787299 100644
--- a/include/linux/platform_data/dma-imx.h
+++ b/include/linux/platform_data/dma-imx.h
@@ -41,6 +41,7 @@ enum sdma_peripheral_type {
41 IMX_DMATYPE_ESAI, /* ESAI */ 41 IMX_DMATYPE_ESAI, /* ESAI */
42 IMX_DMATYPE_SSI_DUAL, /* SSI Dual FIFO */ 42 IMX_DMATYPE_SSI_DUAL, /* SSI Dual FIFO */
43 IMX_DMATYPE_ASRC_SP, /* Shared ASRC */ 43 IMX_DMATYPE_ASRC_SP, /* Shared ASRC */
44 IMX_DMATYPE_SAI, /* SAI */
44}; 45};
45 46
46enum imx_dma_prio { 47enum imx_dma_prio {
diff --git a/include/linux/platform_data/dwc3-exynos.h b/include/linux/platform_data/dwc3-exynos.h
deleted file mode 100644
index 5eb7da9b3772..000000000000
--- a/include/linux/platform_data/dwc3-exynos.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/**
2 * dwc3-exynos.h - Samsung EXYNOS DWC3 Specific Glue layer, header.
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Author: Anton Tikhomirov <av.tikhomirov@samsung.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#ifndef _DWC3_EXYNOS_H_
16#define _DWC3_EXYNOS_H_
17
18struct dwc3_exynos_data {
19 int phy_type;
20 int (*phy_init)(struct platform_device *pdev, int type);
21 int (*phy_exit)(struct platform_device *pdev, int type);
22};
23
24#endif /* _DWC3_EXYNOS_H_ */
diff --git a/include/linux/platform_data/hsmmc-omap.h b/include/linux/platform_data/hsmmc-omap.h
new file mode 100644
index 000000000000..67bbcf0785f6
--- /dev/null
+++ b/include/linux/platform_data/hsmmc-omap.h
@@ -0,0 +1,90 @@
1/*
2 * MMC definitions for OMAP2
3 *
4 * Copyright (C) 2006 Nokia Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11/*
12 * struct omap_hsmmc_dev_attr.flags possibilities
13 *
14 * OMAP_HSMMC_SUPPORTS_DUAL_VOLT: Some HSMMC controller instances can
15 * operate with either 1.8Vdc or 3.0Vdc card voltages; this flag
16 * should be set if this is the case. See for example Section 22.5.3
17 * "MMC/SD/SDIO1 Bus Voltage Selection" of the OMAP34xx Multimedia
18 * Device Silicon Revision 3.1.x Revision ZR (July 2011) (SWPU223R).
19 *
20 * OMAP_HSMMC_BROKEN_MULTIBLOCK_READ: Multiple-block read transfers
21 * don't work correctly on some MMC controller instances on some
22 * OMAP3 SoCs; this flag should be set if this is the case. See
23 * for example Advisory 2.1.1.128 "MMC: Multiple Block Read
24 * Operation Issue" in _OMAP3530/3525/3515/3503 Silicon Errata_
25 * Revision F (October 2010) (SPRZ278F).
26 */
27#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
28#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
29#define OMAP_HSMMC_SWAKEUP_MISSING BIT(2)
30
31struct omap_hsmmc_dev_attr {
32 u8 flags;
33};
34
35struct mmc_card;
36
37struct omap_hsmmc_platform_data {
38 /* back-link to device */
39 struct device *dev;
40
41 /* set if your board has components or wiring that limits the
42 * maximum frequency on the MMC bus */
43 unsigned int max_freq;
44
45 /* Integrating attributes from the omap_hwmod layer */
46 u8 controller_flags;
47
48 /* Register offset deviation */
49 u16 reg_offset;
50
51 /*
52 * 4/8 wires and any additional host capabilities
53 * need to OR'd all capabilities (ref. linux/mmc/host.h)
54 */
55 u32 caps; /* Used for the MMC driver on 2430 and later */
56 u32 pm_caps; /* PM capabilities of the mmc */
57
58 /* switch pin can be for card detect (default) or card cover */
59 unsigned cover:1;
60
61 /* use the internal clock */
62 unsigned internal_clock:1;
63
64 /* nonremovable e.g. eMMC */
65 unsigned nonremovable:1;
66
67 /* eMMC does not handle power off when not in sleep state */
68 unsigned no_regulator_off_init:1;
69
70 /* we can put the features above into this variable */
71#define HSMMC_HAS_PBIAS (1 << 0)
72#define HSMMC_HAS_UPDATED_RESET (1 << 1)
73#define HSMMC_HAS_HSPE_SUPPORT (1 << 2)
74 unsigned features;
75
76 int switch_pin; /* gpio (card detect) */
77 int gpio_wp; /* gpio (write protect) */
78
79 int (*set_power)(struct device *dev, int power_on, int vdd);
80 void (*remux)(struct device *dev, int power_on);
81 /* Call back before enabling / disabling regulators */
82 void (*before_set_reg)(struct device *dev, int power_on, int vdd);
83 /* Call back after enabling / disabling regulators */
84 void (*after_set_reg)(struct device *dev, int power_on, int vdd);
85 /* if we have special card, init it using this callback */
86 void (*init_card)(struct mmc_card *card);
87
88 const char *name;
89 u32 ocr_mask;
90};
diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
index 1b2ba24e4e03..9c7fd1efe495 100644
--- a/include/linux/platform_data/lp855x.h
+++ b/include/linux/platform_data/lp855x.h
@@ -136,6 +136,7 @@ struct lp855x_rom_data {
136 Only valid when mode is PWM_BASED. 136 Only valid when mode is PWM_BASED.
137 * @size_program : total size of lp855x_rom_data 137 * @size_program : total size of lp855x_rom_data
138 * @rom_data : list of new eeprom/eprom registers 138 * @rom_data : list of new eeprom/eprom registers
139 * @supply : regulator that supplies 3V input
139 */ 140 */
140struct lp855x_platform_data { 141struct lp855x_platform_data {
141 const char *name; 142 const char *name;
@@ -144,6 +145,7 @@ struct lp855x_platform_data {
144 unsigned int period_ns; 145 unsigned int period_ns;
145 int size_program; 146 int size_program;
146 struct lp855x_rom_data *rom_data; 147 struct lp855x_rom_data *rom_data;
148 struct regulator *supply;
147}; 149};
148 150
149#endif 151#endif
diff --git a/include/linux/platform_data/mmc-atmel-mci.h b/include/linux/platform_data/mmc-atmel-mci.h
new file mode 100644
index 000000000000..399a2d5a14bd
--- /dev/null
+++ b/include/linux/platform_data/mmc-atmel-mci.h
@@ -0,0 +1,22 @@
1#ifndef __MMC_ATMEL_MCI_H
2#define __MMC_ATMEL_MCI_H
3
4#include <linux/platform_data/dma-atmel.h>
5#include <linux/platform_data/dma-dw.h>
6
7/**
8 * struct mci_dma_data - DMA data for MCI interface
9 */
10struct mci_dma_data {
11#ifdef CONFIG_ARM
12 struct at_dma_slave sdata;
13#else
14 struct dw_dma_slave sdata;
15#endif
16};
17
18/* accessor macros */
19#define slave_data_ptr(s) (&(s)->sdata)
20#define find_slave_dev(s) ((s)->sdata.dma_dev)
21
22#endif /* __MMC_ATMEL_MCI_H */
diff --git a/include/linux/platform_data/mmc-omap.h b/include/linux/platform_data/mmc-omap.h
index 51e70cf25cbc..5c188f4e9bec 100644
--- a/include/linux/platform_data/mmc-omap.h
+++ b/include/linux/platform_data/mmc-omap.h
@@ -10,32 +10,8 @@
10 10
11#define OMAP_MMC_MAX_SLOTS 2 11#define OMAP_MMC_MAX_SLOTS 2
12 12
13/*
14 * struct omap_mmc_dev_attr.flags possibilities
15 *
16 * OMAP_HSMMC_SUPPORTS_DUAL_VOLT: Some HSMMC controller instances can
17 * operate with either 1.8Vdc or 3.0Vdc card voltages; this flag
18 * should be set if this is the case. See for example Section 22.5.3
19 * "MMC/SD/SDIO1 Bus Voltage Selection" of the OMAP34xx Multimedia
20 * Device Silicon Revision 3.1.x Revision ZR (July 2011) (SWPU223R).
21 *
22 * OMAP_HSMMC_BROKEN_MULTIBLOCK_READ: Multiple-block read transfers
23 * don't work correctly on some MMC controller instances on some
24 * OMAP3 SoCs; this flag should be set if this is the case. See
25 * for example Advisory 2.1.1.128 "MMC: Multiple Block Read
26 * Operation Issue" in _OMAP3530/3525/3515/3503 Silicon Errata_
27 * Revision F (October 2010) (SPRZ278F).
28 */
29#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
30#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
31#define OMAP_HSMMC_SWAKEUP_MISSING BIT(2)
32
33struct mmc_card; 13struct mmc_card;
34 14
35struct omap_mmc_dev_attr {
36 u8 flags;
37};
38
39struct omap_mmc_platform_data { 15struct omap_mmc_platform_data {
40 /* back-link to device */ 16 /* back-link to device */
41 struct device *dev; 17 struct device *dev;
@@ -106,9 +82,6 @@ struct omap_mmc_platform_data {
106 unsigned vcc_aux_disable_is_sleep:1; 82 unsigned vcc_aux_disable_is_sleep:1;
107 83
108 /* we can put the features above into this variable */ 84 /* we can put the features above into this variable */
109#define HSMMC_HAS_PBIAS (1 << 0)
110#define HSMMC_HAS_UPDATED_RESET (1 << 1)
111#define HSMMC_HAS_HSPE_SUPPORT (1 << 2)
112#define MMC_OMAP7XX (1 << 3) 85#define MMC_OMAP7XX (1 << 3)
113#define MMC_OMAP15XX (1 << 4) 86#define MMC_OMAP15XX (1 << 4)
114#define MMC_OMAP16XX (1 << 5) 87#define MMC_OMAP16XX (1 << 5)
diff --git a/include/linux/platform_data/pxa_sdhci.h b/include/linux/platform_data/pxa_sdhci.h
index 27d3156d093a..9e20c2fb4ffd 100644
--- a/include/linux/platform_data/pxa_sdhci.h
+++ b/include/linux/platform_data/pxa_sdhci.h
@@ -55,9 +55,4 @@ struct sdhci_pxa_platdata {
55 unsigned int quirks2; 55 unsigned int quirks2;
56 unsigned int pm_caps; 56 unsigned int pm_caps;
57}; 57};
58
59struct sdhci_pxa {
60 u8 clk_enable;
61 u8 power_mode;
62};
63#endif /* _PXA_SDHCI_H_ */ 58#endif /* _PXA_SDHCI_H_ */
diff --git a/include/linux/platform_data/rcar-du.h b/include/linux/platform_data/rcar-du.h
deleted file mode 100644
index a5f045e1d8fe..000000000000
--- a/include/linux/platform_data/rcar-du.h
+++ /dev/null
@@ -1,74 +0,0 @@
1/*
2 * rcar_du.h -- R-Car Display Unit DRM driver
3 *
4 * Copyright (C) 2013 Renesas Corporation
5 *
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __RCAR_DU_H__
15#define __RCAR_DU_H__
16
17#include <video/videomode.h>
18
19enum rcar_du_output {
20 RCAR_DU_OUTPUT_DPAD0,
21 RCAR_DU_OUTPUT_DPAD1,
22 RCAR_DU_OUTPUT_LVDS0,
23 RCAR_DU_OUTPUT_LVDS1,
24 RCAR_DU_OUTPUT_TCON,
25 RCAR_DU_OUTPUT_MAX,
26};
27
28enum rcar_du_encoder_type {
29 RCAR_DU_ENCODER_UNUSED = 0,
30 RCAR_DU_ENCODER_NONE,
31 RCAR_DU_ENCODER_VGA,
32 RCAR_DU_ENCODER_LVDS,
33};
34
35struct rcar_du_panel_data {
36 unsigned int width_mm; /* Panel width in mm */
37 unsigned int height_mm; /* Panel height in mm */
38 struct videomode mode;
39};
40
41struct rcar_du_connector_lvds_data {
42 struct rcar_du_panel_data panel;
43};
44
45struct rcar_du_connector_vga_data {
46 /* TODO: Add DDC information for EDID retrieval */
47};
48
49/*
50 * struct rcar_du_encoder_data - Encoder platform data
51 * @type: the encoder type (RCAR_DU_ENCODER_*)
52 * @output: the DU output the connector is connected to (RCAR_DU_OUTPUT_*)
53 * @connector.lvds: platform data for LVDS connectors
54 * @connector.vga: platform data for VGA connectors
55 *
56 * Encoder platform data describes an on-board encoder, its associated DU SoC
57 * output, and the connector.
58 */
59struct rcar_du_encoder_data {
60 enum rcar_du_encoder_type type;
61 enum rcar_du_output output;
62
63 union {
64 struct rcar_du_connector_lvds_data lvds;
65 struct rcar_du_connector_vga_data vga;
66 } connector;
67};
68
69struct rcar_du_platform_data {
70 struct rcar_du_encoder_data *encoders;
71 unsigned int num_encoders;
72};
73
74#endif /* __RCAR_DU_H__ */
diff --git a/include/linux/platform_data/serial-omap.h b/include/linux/platform_data/serial-omap.h
index c860c1b314c0..d09275f3cde3 100644
--- a/include/linux/platform_data/serial-omap.h
+++ b/include/linux/platform_data/serial-omap.h
@@ -38,9 +38,6 @@ struct omap_uart_port_info {
38 unsigned int dma_rx_timeout; 38 unsigned int dma_rx_timeout;
39 unsigned int autosuspend_timeout; 39 unsigned int autosuspend_timeout;
40 unsigned int dma_rx_poll_rate; 40 unsigned int dma_rx_poll_rate;
41 int DTR_gpio;
42 int DTR_inverted;
43 int DTR_present;
44 41
45 int (*get_context_loss_count)(struct device *); 42 int (*get_context_loss_count)(struct device *);
46 void (*enable_wakeup)(struct device *, bool); 43 void (*enable_wakeup)(struct device *, bool);
diff --git a/include/linux/platform_data/st21nfca.h b/include/linux/platform_data/st21nfca.h
index 1730312398ff..5087fff96d86 100644
--- a/include/linux/platform_data/st21nfca.h
+++ b/include/linux/platform_data/st21nfca.h
@@ -24,7 +24,6 @@
24#define ST21NFCA_HCI_DRIVER_NAME "st21nfca_hci" 24#define ST21NFCA_HCI_DRIVER_NAME "st21nfca_hci"
25 25
26struct st21nfca_nfc_platform_data { 26struct st21nfca_nfc_platform_data {
27 unsigned int gpio_irq;
28 unsigned int gpio_ena; 27 unsigned int gpio_ena;
29 unsigned int irq_polarity; 28 unsigned int irq_polarity;
30}; 29};
diff --git a/include/linux/platform_data/st21nfcb.h b/include/linux/platform_data/st21nfcb.h
index 2d11f1f5efab..c3b432f5b63e 100644
--- a/include/linux/platform_data/st21nfcb.h
+++ b/include/linux/platform_data/st21nfcb.h
@@ -24,7 +24,6 @@
24#define ST21NFCB_NCI_DRIVER_NAME "st21nfcb_nci" 24#define ST21NFCB_NCI_DRIVER_NAME "st21nfcb_nci"
25 25
26struct st21nfcb_nfc_platform_data { 26struct st21nfcb_nfc_platform_data {
27 unsigned int gpio_irq;
28 unsigned int gpio_reset; 27 unsigned int gpio_reset;
29 unsigned int irq_polarity; 28 unsigned int irq_polarity;
30}; 29};
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 153d303af7eb..ae4882ca4a64 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -197,8 +197,10 @@ extern void platform_driver_unregister(struct platform_driver *);
197/* non-hotpluggable platform devices may use this so that probe() and 197/* non-hotpluggable platform devices may use this so that probe() and
198 * its support may live in __init sections, conserving runtime memory. 198 * its support may live in __init sections, conserving runtime memory.
199 */ 199 */
200extern int platform_driver_probe(struct platform_driver *driver, 200#define platform_driver_probe(drv, probe) \
201 int (*probe)(struct platform_device *)); 201 __platform_driver_probe(drv, probe, THIS_MODULE)
202extern int __platform_driver_probe(struct platform_driver *driver,
203 int (*probe)(struct platform_device *), struct module *module);
202 204
203static inline void *platform_get_drvdata(const struct platform_device *pdev) 205static inline void *platform_get_drvdata(const struct platform_device *pdev)
204{ 206{
@@ -238,10 +240,12 @@ static void __exit __platform_driver##_exit(void) \
238} \ 240} \
239module_exit(__platform_driver##_exit); 241module_exit(__platform_driver##_exit);
240 242
241extern struct platform_device *platform_create_bundle( 243#define platform_create_bundle(driver, probe, res, n_res, data, size) \
244 __platform_create_bundle(driver, probe, res, n_res, data, size, THIS_MODULE)
245extern struct platform_device *__platform_create_bundle(
242 struct platform_driver *driver, int (*probe)(struct platform_device *), 246 struct platform_driver *driver, int (*probe)(struct platform_device *),
243 struct resource *res, unsigned int n_res, 247 struct resource *res, unsigned int n_res,
244 const void *data, size_t size); 248 const void *data, size_t size, struct module *module);
245 249
246/* early platform driver interface */ 250/* early platform driver interface */
247struct early_platform_driver { 251struct early_platform_driver {
diff --git a/include/linux/plist.h b/include/linux/plist.h
index 8b6c970cff6c..97883604a3c5 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -176,7 +176,7 @@ extern void plist_requeue(struct plist_node *node, struct plist_head *head);
176 * plist_for_each_entry - iterate over list of given type 176 * plist_for_each_entry - iterate over list of given type
177 * @pos: the type * to use as a loop counter 177 * @pos: the type * to use as a loop counter
178 * @head: the head for your list 178 * @head: the head for your list
179 * @mem: the name of the list_struct within the struct 179 * @mem: the name of the list_head within the struct
180 */ 180 */
181#define plist_for_each_entry(pos, head, mem) \ 181#define plist_for_each_entry(pos, head, mem) \
182 list_for_each_entry(pos, &(head)->node_list, mem.node_list) 182 list_for_each_entry(pos, &(head)->node_list, mem.node_list)
@@ -185,7 +185,7 @@ extern void plist_requeue(struct plist_node *node, struct plist_head *head);
185 * plist_for_each_entry_continue - continue iteration over list of given type 185 * plist_for_each_entry_continue - continue iteration over list of given type
186 * @pos: the type * to use as a loop cursor 186 * @pos: the type * to use as a loop cursor
187 * @head: the head for your list 187 * @head: the head for your list
188 * @m: the name of the list_struct within the struct 188 * @m: the name of the list_head within the struct
189 * 189 *
190 * Continue to iterate over list of given type, continuing after 190 * Continue to iterate over list of given type, continuing after
191 * the current position. 191 * the current position.
@@ -198,7 +198,7 @@ extern void plist_requeue(struct plist_node *node, struct plist_head *head);
198 * @pos: the type * to use as a loop counter 198 * @pos: the type * to use as a loop counter
199 * @n: another type * to use as temporary storage 199 * @n: another type * to use as temporary storage
200 * @head: the head for your list 200 * @head: the head for your list
201 * @m: the name of the list_struct within the struct 201 * @m: the name of the list_head within the struct
202 * 202 *
203 * Iterate over list of given type, safe against removal of list entry. 203 * Iterate over list of given type, safe against removal of list entry.
204 */ 204 */
@@ -229,7 +229,7 @@ static inline int plist_node_empty(const struct plist_node *node)
229 * plist_first_entry - get the struct for the first entry 229 * plist_first_entry - get the struct for the first entry
230 * @head: the &struct plist_head pointer 230 * @head: the &struct plist_head pointer
231 * @type: the type of the struct this is embedded in 231 * @type: the type of the struct this is embedded in
232 * @member: the name of the list_struct within the struct 232 * @member: the name of the list_head within the struct
233 */ 233 */
234#ifdef CONFIG_DEBUG_PI_LIST 234#ifdef CONFIG_DEBUG_PI_LIST
235# define plist_first_entry(head, type, member) \ 235# define plist_first_entry(head, type, member) \
@@ -246,7 +246,7 @@ static inline int plist_node_empty(const struct plist_node *node)
246 * plist_last_entry - get the struct for the last entry 246 * plist_last_entry - get the struct for the last entry
247 * @head: the &struct plist_head pointer 247 * @head: the &struct plist_head pointer
248 * @type: the type of the struct this is embedded in 248 * @type: the type of the struct this is embedded in
249 * @member: the name of the list_struct within the struct 249 * @member: the name of the list_head within the struct
250 */ 250 */
251#ifdef CONFIG_DEBUG_PI_LIST 251#ifdef CONFIG_DEBUG_PI_LIST
252# define plist_last_entry(head, type, member) \ 252# define plist_last_entry(head, type, member) \
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 383fd68aaee1..66a656eb335b 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -342,7 +342,7 @@ struct dev_pm_ops {
342#define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) 342#define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
343#endif 343#endif
344 344
345#ifdef CONFIG_PM_RUNTIME 345#ifdef CONFIG_PM
346#define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \ 346#define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
347 .runtime_suspend = suspend_fn, \ 347 .runtime_suspend = suspend_fn, \
348 .runtime_resume = resume_fn, \ 348 .runtime_resume = resume_fn, \
@@ -351,14 +351,7 @@ struct dev_pm_ops {
351#define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) 351#define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
352#endif 352#endif
353 353
354#ifdef CONFIG_PM 354#define SET_PM_RUNTIME_PM_OPS SET_RUNTIME_PM_OPS
355#define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
356 .runtime_suspend = suspend_fn, \
357 .runtime_resume = resume_fn, \
358 .runtime_idle = idle_fn,
359#else
360#define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
361#endif
362 355
363/* 356/*
364 * Use this if you want to use the same suspend and resume callbacks for suspend 357 * Use this if you want to use the same suspend and resume callbacks for suspend
@@ -538,11 +531,7 @@ enum rpm_request {
538}; 531};
539 532
540struct wakeup_source; 533struct wakeup_source;
541 534struct pm_domain_data;
542struct pm_domain_data {
543 struct list_head list_node;
544 struct device *dev;
545};
546 535
547struct pm_subsys_data { 536struct pm_subsys_data {
548 spinlock_t lock; 537 spinlock_t lock;
@@ -576,7 +565,7 @@ struct dev_pm_info {
576#else 565#else
577 unsigned int should_wakeup:1; 566 unsigned int should_wakeup:1;
578#endif 567#endif
579#ifdef CONFIG_PM_RUNTIME 568#ifdef CONFIG_PM
580 struct timer_list suspend_timer; 569 struct timer_list suspend_timer;
581 unsigned long timer_expires; 570 unsigned long timer_expires;
582 struct work_struct work; 571 struct work_struct work;
diff --git a/include/linux/pm_clock.h b/include/linux/pm_clock.h
index 8348866e7b05..0b0039634410 100644
--- a/include/linux/pm_clock.h
+++ b/include/linux/pm_clock.h
@@ -18,6 +18,8 @@ struct pm_clk_notifier_block {
18 char *con_ids[]; 18 char *con_ids[];
19}; 19};
20 20
21struct clk;
22
21#ifdef CONFIG_PM_CLK 23#ifdef CONFIG_PM_CLK
22static inline bool pm_clk_no_clocks(struct device *dev) 24static inline bool pm_clk_no_clocks(struct device *dev)
23{ 25{
@@ -29,6 +31,7 @@ extern void pm_clk_init(struct device *dev);
29extern int pm_clk_create(struct device *dev); 31extern int pm_clk_create(struct device *dev);
30extern void pm_clk_destroy(struct device *dev); 32extern void pm_clk_destroy(struct device *dev);
31extern int pm_clk_add(struct device *dev, const char *con_id); 33extern int pm_clk_add(struct device *dev, const char *con_id);
34extern int pm_clk_add_clk(struct device *dev, struct clk *clk);
32extern void pm_clk_remove(struct device *dev, const char *con_id); 35extern void pm_clk_remove(struct device *dev, const char *con_id);
33extern int pm_clk_suspend(struct device *dev); 36extern int pm_clk_suspend(struct device *dev);
34extern int pm_clk_resume(struct device *dev); 37extern int pm_clk_resume(struct device *dev);
@@ -51,6 +54,11 @@ static inline int pm_clk_add(struct device *dev, const char *con_id)
51{ 54{
52 return -EINVAL; 55 return -EINVAL;
53} 56}
57
58static inline int pm_clk_add_clk(struct device *dev, struct clk *clk)
59{
60 return -EINVAL;
61}
54static inline void pm_clk_remove(struct device *dev, const char *con_id) 62static inline void pm_clk_remove(struct device *dev, const char *con_id)
55{ 63{
56} 64}
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 2e0e06daf8c0..6cd20d5e651b 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -17,6 +17,9 @@
17#include <linux/notifier.h> 17#include <linux/notifier.h>
18#include <linux/cpuidle.h> 18#include <linux/cpuidle.h>
19 19
20/* Defines used for the flags field in the struct generic_pm_domain */
21#define GENPD_FLAG_PM_CLK (1U << 0) /* PM domain uses PM clk */
22
20enum gpd_status { 23enum gpd_status {
21 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 24 GPD_STATE_ACTIVE = 0, /* PM domain is active */
22 GPD_STATE_WAIT_MASTER, /* PM domain's master is being waited for */ 25 GPD_STATE_WAIT_MASTER, /* PM domain's master is being waited for */
@@ -76,6 +79,7 @@ struct generic_pm_domain {
76 struct device *dev); 79 struct device *dev);
77 void (*detach_dev)(struct generic_pm_domain *domain, 80 void (*detach_dev)(struct generic_pm_domain *domain,
78 struct device *dev); 81 struct device *dev);
82 unsigned int flags; /* Bit field of configs for genpd */
79}; 83};
80 84
81static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) 85static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
@@ -100,6 +104,11 @@ struct gpd_timing_data {
100 bool cached_stop_ok; 104 bool cached_stop_ok;
101}; 105};
102 106
107struct pm_domain_data {
108 struct list_head list_node;
109 struct device *dev;
110};
111
103struct generic_pm_domain_data { 112struct generic_pm_domain_data {
104 struct pm_domain_data base; 113 struct pm_domain_data base;
105 struct gpd_timing_data td; 114 struct gpd_timing_data td;
@@ -147,6 +156,7 @@ extern void pm_genpd_init(struct generic_pm_domain *genpd,
147 156
148extern int pm_genpd_poweron(struct generic_pm_domain *genpd); 157extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
149extern int pm_genpd_name_poweron(const char *domain_name); 158extern int pm_genpd_name_poweron(const char *domain_name);
159extern void pm_genpd_poweroff_unused(void);
150 160
151extern struct dev_power_governor simple_qos_governor; 161extern struct dev_power_governor simple_qos_governor;
152extern struct dev_power_governor pm_domain_always_on_gov; 162extern struct dev_power_governor pm_domain_always_on_gov;
@@ -221,6 +231,7 @@ static inline int pm_genpd_name_poweron(const char *domain_name)
221{ 231{
222 return -ENOSYS; 232 return -ENOSYS;
223} 233}
234static inline void pm_genpd_poweroff_unused(void) {}
224#define simple_qos_governor NULL 235#define simple_qos_governor NULL
225#define pm_domain_always_on_gov NULL 236#define pm_domain_always_on_gov NULL
226#endif 237#endif
@@ -237,12 +248,6 @@ static inline int pm_genpd_name_add_device(const char *domain_name,
237 return __pm_genpd_name_add_device(domain_name, dev, NULL); 248 return __pm_genpd_name_add_device(domain_name, dev, NULL);
238} 249}
239 250
240#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME
241extern void pm_genpd_poweroff_unused(void);
242#else
243static inline void pm_genpd_poweroff_unused(void) {}
244#endif
245
246#ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP 251#ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP
247extern void pm_genpd_syscore_poweroff(struct device *dev); 252extern void pm_genpd_syscore_poweroff(struct device *dev);
248extern void pm_genpd_syscore_poweron(struct device *dev); 253extern void pm_genpd_syscore_poweron(struct device *dev);
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index 0330217abfad..cec2d4540914 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -21,7 +21,7 @@ struct dev_pm_opp;
21struct device; 21struct device;
22 22
23enum dev_pm_opp_event { 23enum dev_pm_opp_event {
24 OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, 24 OPP_EVENT_ADD, OPP_EVENT_REMOVE, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
25}; 25};
26 26
27#if defined(CONFIG_PM_OPP) 27#if defined(CONFIG_PM_OPP)
@@ -44,6 +44,7 @@ struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
44 44
45int dev_pm_opp_add(struct device *dev, unsigned long freq, 45int dev_pm_opp_add(struct device *dev, unsigned long freq,
46 unsigned long u_volt); 46 unsigned long u_volt);
47void dev_pm_opp_remove(struct device *dev, unsigned long freq);
47 48
48int dev_pm_opp_enable(struct device *dev, unsigned long freq); 49int dev_pm_opp_enable(struct device *dev, unsigned long freq);
49 50
@@ -90,6 +91,10 @@ static inline int dev_pm_opp_add(struct device *dev, unsigned long freq,
90 return -EINVAL; 91 return -EINVAL;
91} 92}
92 93
94static inline void dev_pm_opp_remove(struct device *dev, unsigned long freq)
95{
96}
97
93static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq) 98static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq)
94{ 99{
95 return 0; 100 return 0;
@@ -109,11 +114,16 @@ static inline struct srcu_notifier_head *dev_pm_opp_get_notifier(
109 114
110#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) 115#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
111int of_init_opp_table(struct device *dev); 116int of_init_opp_table(struct device *dev);
117void of_free_opp_table(struct device *dev);
112#else 118#else
113static inline int of_init_opp_table(struct device *dev) 119static inline int of_init_opp_table(struct device *dev)
114{ 120{
115 return -EINVAL; 121 return -EINVAL;
116} 122}
123
124static inline void of_free_opp_table(struct device *dev)
125{
126}
117#endif 127#endif
118 128
119#endif /* __LINUX_OPP_H__ */ 129#endif /* __LINUX_OPP_H__ */
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 636e82834506..7b3ae0cffc05 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -154,6 +154,23 @@ void dev_pm_qos_constraints_destroy(struct device *dev);
154int dev_pm_qos_add_ancestor_request(struct device *dev, 154int dev_pm_qos_add_ancestor_request(struct device *dev,
155 struct dev_pm_qos_request *req, 155 struct dev_pm_qos_request *req,
156 enum dev_pm_qos_req_type type, s32 value); 156 enum dev_pm_qos_req_type type, s32 value);
157int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value);
158void dev_pm_qos_hide_latency_limit(struct device *dev);
159int dev_pm_qos_expose_flags(struct device *dev, s32 value);
160void dev_pm_qos_hide_flags(struct device *dev);
161int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set);
162s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev);
163int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val);
164
165static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev)
166{
167 return dev->power.qos->resume_latency_req->data.pnode.prio;
168}
169
170static inline s32 dev_pm_qos_requested_flags(struct device *dev)
171{
172 return dev->power.qos->flags_req->data.flr.flags;
173}
157#else 174#else
158static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, 175static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev,
159 s32 mask) 176 s32 mask)
@@ -200,27 +217,6 @@ static inline int dev_pm_qos_add_ancestor_request(struct device *dev,
200 enum dev_pm_qos_req_type type, 217 enum dev_pm_qos_req_type type,
201 s32 value) 218 s32 value)
202 { return 0; } 219 { return 0; }
203#endif
204
205#ifdef CONFIG_PM_RUNTIME
206int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value);
207void dev_pm_qos_hide_latency_limit(struct device *dev);
208int dev_pm_qos_expose_flags(struct device *dev, s32 value);
209void dev_pm_qos_hide_flags(struct device *dev);
210int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set);
211s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev);
212int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val);
213
214static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev)
215{
216 return dev->power.qos->resume_latency_req->data.pnode.prio;
217}
218
219static inline s32 dev_pm_qos_requested_flags(struct device *dev)
220{
221 return dev->power.qos->flags_req->data.flr.flags;
222}
223#else
224static inline int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) 220static inline int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
225 { return 0; } 221 { return 0; }
226static inline void dev_pm_qos_hide_latency_limit(struct device *dev) {} 222static inline void dev_pm_qos_hide_latency_limit(struct device *dev) {}
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 367f49b9a1c9..30e84d48bfea 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -35,16 +35,6 @@ extern int pm_generic_runtime_suspend(struct device *dev);
35extern int pm_generic_runtime_resume(struct device *dev); 35extern int pm_generic_runtime_resume(struct device *dev);
36extern int pm_runtime_force_suspend(struct device *dev); 36extern int pm_runtime_force_suspend(struct device *dev);
37extern int pm_runtime_force_resume(struct device *dev); 37extern int pm_runtime_force_resume(struct device *dev);
38#else
39static inline bool queue_pm_work(struct work_struct *work) { return false; }
40
41static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
42static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
43static inline int pm_runtime_force_suspend(struct device *dev) { return 0; }
44static inline int pm_runtime_force_resume(struct device *dev) { return 0; }
45#endif
46
47#ifdef CONFIG_PM_RUNTIME
48 38
49extern int __pm_runtime_idle(struct device *dev, int rpmflags); 39extern int __pm_runtime_idle(struct device *dev, int rpmflags);
50extern int __pm_runtime_suspend(struct device *dev, int rpmflags); 40extern int __pm_runtime_suspend(struct device *dev, int rpmflags);
@@ -128,7 +118,19 @@ static inline void pm_runtime_mark_last_busy(struct device *dev)
128 ACCESS_ONCE(dev->power.last_busy) = jiffies; 118 ACCESS_ONCE(dev->power.last_busy) = jiffies;
129} 119}
130 120
131#else /* !CONFIG_PM_RUNTIME */ 121static inline bool pm_runtime_is_irq_safe(struct device *dev)
122{
123 return dev->power.irq_safe;
124}
125
126#else /* !CONFIG_PM */
127
128static inline bool queue_pm_work(struct work_struct *work) { return false; }
129
130static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
131static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
132static inline int pm_runtime_force_suspend(struct device *dev) { return 0; }
133static inline int pm_runtime_force_resume(struct device *dev) { return 0; }
132 134
133static inline int __pm_runtime_idle(struct device *dev, int rpmflags) 135static inline int __pm_runtime_idle(struct device *dev, int rpmflags)
134{ 136{
@@ -167,6 +169,7 @@ static inline bool pm_runtime_enabled(struct device *dev) { return false; }
167 169
168static inline void pm_runtime_no_callbacks(struct device *dev) {} 170static inline void pm_runtime_no_callbacks(struct device *dev) {}
169static inline void pm_runtime_irq_safe(struct device *dev) {} 171static inline void pm_runtime_irq_safe(struct device *dev) {}
172static inline bool pm_runtime_is_irq_safe(struct device *dev) { return false; }
170 173
171static inline bool pm_runtime_callbacks_present(struct device *dev) { return false; } 174static inline bool pm_runtime_callbacks_present(struct device *dev) { return false; }
172static inline void pm_runtime_mark_last_busy(struct device *dev) {} 175static inline void pm_runtime_mark_last_busy(struct device *dev) {}
@@ -179,7 +182,7 @@ static inline unsigned long pm_runtime_autosuspend_expiration(
179static inline void pm_runtime_set_memalloc_noio(struct device *dev, 182static inline void pm_runtime_set_memalloc_noio(struct device *dev,
180 bool enable){} 183 bool enable){}
181 184
182#endif /* !CONFIG_PM_RUNTIME */ 185#endif /* !CONFIG_PM */
183 186
184static inline int pm_runtime_idle(struct device *dev) 187static inline int pm_runtime_idle(struct device *dev)
185{ 188{
diff --git a/include/linux/printk.h b/include/linux/printk.h
index d78125f73ac4..c8f170324e64 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -118,12 +118,13 @@ int no_printk(const char *fmt, ...)
118#ifdef CONFIG_EARLY_PRINTK 118#ifdef CONFIG_EARLY_PRINTK
119extern asmlinkage __printf(1, 2) 119extern asmlinkage __printf(1, 2)
120void early_printk(const char *fmt, ...); 120void early_printk(const char *fmt, ...);
121void early_vprintk(const char *fmt, va_list ap);
122#else 121#else
123static inline __printf(1, 2) __cold 122static inline __printf(1, 2) __cold
124void early_printk(const char *s, ...) { } 123void early_printk(const char *s, ...) { }
125#endif 124#endif
126 125
126typedef int(*printk_func_t)(const char *fmt, va_list args);
127
127#ifdef CONFIG_PRINTK 128#ifdef CONFIG_PRINTK
128asmlinkage __printf(5, 0) 129asmlinkage __printf(5, 0)
129int vprintk_emit(int facility, int level, 130int vprintk_emit(int facility, int level,
diff --git a/include/linux/property.h b/include/linux/property.h
new file mode 100644
index 000000000000..a6a3d98bd7e9
--- /dev/null
+++ b/include/linux/property.h
@@ -0,0 +1,143 @@
1/*
2 * property.h - Unified device property interface.
3 *
4 * Copyright (C) 2014, Intel Corporation
5 * Authors: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 * Mika Westerberg <mika.westerberg@linux.intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef _LINUX_PROPERTY_H_
14#define _LINUX_PROPERTY_H_
15
16#include <linux/types.h>
17
18struct device;
19
20enum dev_prop_type {
21 DEV_PROP_U8,
22 DEV_PROP_U16,
23 DEV_PROP_U32,
24 DEV_PROP_U64,
25 DEV_PROP_STRING,
26 DEV_PROP_MAX,
27};
28
29bool device_property_present(struct device *dev, const char *propname);
30int device_property_read_u8_array(struct device *dev, const char *propname,
31 u8 *val, size_t nval);
32int device_property_read_u16_array(struct device *dev, const char *propname,
33 u16 *val, size_t nval);
34int device_property_read_u32_array(struct device *dev, const char *propname,
35 u32 *val, size_t nval);
36int device_property_read_u64_array(struct device *dev, const char *propname,
37 u64 *val, size_t nval);
38int device_property_read_string_array(struct device *dev, const char *propname,
39 const char **val, size_t nval);
40int device_property_read_string(struct device *dev, const char *propname,
41 const char **val);
42
43enum fwnode_type {
44 FWNODE_INVALID = 0,
45 FWNODE_OF,
46 FWNODE_ACPI,
47};
48
49struct fwnode_handle {
50 enum fwnode_type type;
51};
52
53bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname);
54int fwnode_property_read_u8_array(struct fwnode_handle *fwnode,
55 const char *propname, u8 *val,
56 size_t nval);
57int fwnode_property_read_u16_array(struct fwnode_handle *fwnode,
58 const char *propname, u16 *val,
59 size_t nval);
60int fwnode_property_read_u32_array(struct fwnode_handle *fwnode,
61 const char *propname, u32 *val,
62 size_t nval);
63int fwnode_property_read_u64_array(struct fwnode_handle *fwnode,
64 const char *propname, u64 *val,
65 size_t nval);
66int fwnode_property_read_string_array(struct fwnode_handle *fwnode,
67 const char *propname, const char **val,
68 size_t nval);
69int fwnode_property_read_string(struct fwnode_handle *fwnode,
70 const char *propname, const char **val);
71
72struct fwnode_handle *device_get_next_child_node(struct device *dev,
73 struct fwnode_handle *child);
74
75#define device_for_each_child_node(dev, child) \
76 for (child = device_get_next_child_node(dev, NULL); child; \
77 child = device_get_next_child_node(dev, child))
78
79void fwnode_handle_put(struct fwnode_handle *fwnode);
80
81unsigned int device_get_child_node_count(struct device *dev);
82
83static inline bool device_property_read_bool(struct device *dev,
84 const char *propname)
85{
86 return device_property_present(dev, propname);
87}
88
89static inline int device_property_read_u8(struct device *dev,
90 const char *propname, u8 *val)
91{
92 return device_property_read_u8_array(dev, propname, val, 1);
93}
94
95static inline int device_property_read_u16(struct device *dev,
96 const char *propname, u16 *val)
97{
98 return device_property_read_u16_array(dev, propname, val, 1);
99}
100
101static inline int device_property_read_u32(struct device *dev,
102 const char *propname, u32 *val)
103{
104 return device_property_read_u32_array(dev, propname, val, 1);
105}
106
107static inline int device_property_read_u64(struct device *dev,
108 const char *propname, u64 *val)
109{
110 return device_property_read_u64_array(dev, propname, val, 1);
111}
112
113static inline bool fwnode_property_read_bool(struct fwnode_handle *fwnode,
114 const char *propname)
115{
116 return fwnode_property_present(fwnode, propname);
117}
118
119static inline int fwnode_property_read_u8(struct fwnode_handle *fwnode,
120 const char *propname, u8 *val)
121{
122 return fwnode_property_read_u8_array(fwnode, propname, val, 1);
123}
124
125static inline int fwnode_property_read_u16(struct fwnode_handle *fwnode,
126 const char *propname, u16 *val)
127{
128 return fwnode_property_read_u16_array(fwnode, propname, val, 1);
129}
130
131static inline int fwnode_property_read_u32(struct fwnode_handle *fwnode,
132 const char *propname, u32 *val)
133{
134 return fwnode_property_read_u32_array(fwnode, propname, val, 1);
135}
136
137static inline int fwnode_property_read_u64(struct fwnode_handle *fwnode,
138 const char *propname, u64 *val)
139{
140 return fwnode_property_read_u64_array(fwnode, propname, val, 1);
141}
142
143#endif /* _LINUX_PROPERTY_H_ */
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h
index 9974975d40db..4af3fdc85b01 100644
--- a/include/linux/pstore_ram.h
+++ b/include/linux/pstore_ram.h
@@ -53,7 +53,8 @@ struct persistent_ram_zone {
53}; 53};
54 54
55struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size, 55struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
56 u32 sig, struct persistent_ram_ecc_info *ecc_info); 56 u32 sig, struct persistent_ram_ecc_info *ecc_info,
57 unsigned int memtype);
57void persistent_ram_free(struct persistent_ram_zone *prz); 58void persistent_ram_free(struct persistent_ram_zone *prz);
58void persistent_ram_zap(struct persistent_ram_zone *prz); 59void persistent_ram_zap(struct persistent_ram_zone *prz);
59 60
@@ -76,6 +77,7 @@ ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz,
76struct ramoops_platform_data { 77struct ramoops_platform_data {
77 unsigned long mem_size; 78 unsigned long mem_size;
78 unsigned long mem_address; 79 unsigned long mem_address;
80 unsigned int mem_type;
79 unsigned long record_size; 81 unsigned long record_size;
80 unsigned long console_size; 82 unsigned long console_size;
81 unsigned long ftrace_size; 83 unsigned long ftrace_size;
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index cc79eff4a1ad..987a73a40ef8 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -52,7 +52,7 @@ extern void ptrace_notify(int exit_code);
52extern void __ptrace_link(struct task_struct *child, 52extern void __ptrace_link(struct task_struct *child,
53 struct task_struct *new_parent); 53 struct task_struct *new_parent);
54extern void __ptrace_unlink(struct task_struct *child); 54extern void __ptrace_unlink(struct task_struct *child);
55extern void exit_ptrace(struct task_struct *tracer); 55extern void exit_ptrace(struct task_struct *tracer, struct list_head *dead);
56#define PTRACE_MODE_READ 0x01 56#define PTRACE_MODE_READ 0x01
57#define PTRACE_MODE_ATTACH 0x02 57#define PTRACE_MODE_ATTACH 0x02
58#define PTRACE_MODE_NOAUDIT 0x04 58#define PTRACE_MODE_NOAUDIT 0x04
diff --git a/include/linux/pxa168_eth.h b/include/linux/pxa168_eth.h
index 18d75e795606..e1ab6e86cdb3 100644
--- a/include/linux/pxa168_eth.h
+++ b/include/linux/pxa168_eth.h
@@ -4,6 +4,8 @@
4#ifndef __LINUX_PXA168_ETH_H 4#ifndef __LINUX_PXA168_ETH_H
5#define __LINUX_PXA168_ETH_H 5#define __LINUX_PXA168_ETH_H
6 6
7#include <linux/phy.h>
8
7struct pxa168_eth_platform_data { 9struct pxa168_eth_platform_data {
8 int port_number; 10 int port_number;
9 int phy_addr; 11 int phy_addr;
@@ -13,6 +15,7 @@ struct pxa168_eth_platform_data {
13 */ 15 */
14 int speed; /* 0, SPEED_10, SPEED_100 */ 16 int speed; /* 0, SPEED_10, SPEED_100 */
15 int duplex; /* DUPLEX_HALF or DUPLEX_FULL */ 17 int duplex; /* DUPLEX_HALF or DUPLEX_FULL */
18 phy_interface_t intf;
16 19
17 /* 20 /*
18 * Override default RX/TX queue sizes if nonzero. 21 * Override default RX/TX queue sizes if nonzero.
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
index f2b405116166..77aed9ea1d26 100644
--- a/include/linux/pxa2xx_ssp.h
+++ b/include/linux/pxa2xx_ssp.h
@@ -108,6 +108,25 @@
108#define SSCR1_RxTresh(x) (((x) - 1) << 10) /* level [1..4] */ 108#define SSCR1_RxTresh(x) (((x) - 1) << 10) /* level [1..4] */
109#endif 109#endif
110 110
111/* QUARK_X1000 SSCR0 bit definition */
112#define QUARK_X1000_SSCR0_DSS (0x1F) /* Data Size Select (mask) */
113#define QUARK_X1000_SSCR0_DataSize(x) ((x) - 1) /* Data Size Select [4..32] */
114#define QUARK_X1000_SSCR0_FRF (0x3 << 5) /* FRame Format (mask) */
115#define QUARK_X1000_SSCR0_Motorola (0x0 << 5) /* Motorola's Serial Peripheral Interface (SPI) */
116
117#define RX_THRESH_QUARK_X1000_DFLT 1
118#define TX_THRESH_QUARK_X1000_DFLT 16
119
120#define QUARK_X1000_SSSR_TFL_MASK (0x1F << 8) /* Transmit FIFO Level mask */
121#define QUARK_X1000_SSSR_RFL_MASK (0x1F << 13) /* Receive FIFO Level mask */
122
123#define QUARK_X1000_SSCR1_TFT (0x1F << 6) /* Transmit FIFO Threshold (mask) */
124#define QUARK_X1000_SSCR1_TxTresh(x) (((x) - 1) << 6) /* level [1..32] */
125#define QUARK_X1000_SSCR1_RFT (0x1F << 11) /* Receive FIFO Threshold (mask) */
126#define QUARK_X1000_SSCR1_RxTresh(x) (((x) - 1) << 11) /* level [1..32] */
127#define QUARK_X1000_SSCR1_STRF (1 << 17) /* Select FIFO or EFWR */
128#define QUARK_X1000_SSCR1_EFWR (1 << 16) /* Enable FIFO Write/Read */
129
111/* extra bits in PXA255, PXA26x and PXA27x SSP ports */ 130/* extra bits in PXA255, PXA26x and PXA27x SSP ports */
112#define SSCR0_TISSP (1 << 4) /* TI Sync Serial Protocol */ 131#define SSCR0_TISSP (1 << 4) /* TI Sync Serial Protocol */
113#define SSCR0_PSP (3 << 4) /* PSP - Programmable Serial Protocol */ 132#define SSCR0_PSP (3 << 4) /* PSP - Programmable Serial Protocol */
@@ -175,6 +194,7 @@ enum pxa_ssp_type {
175 PXA910_SSP, 194 PXA910_SSP,
176 CE4100_SSP, 195 CE4100_SSP,
177 LPSS_SSP, 196 LPSS_SSP,
197 QUARK_X1000_SSP,
178}; 198};
179 199
180struct ssp_device { 200struct ssp_device {
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 80d345a3524c..50978b781a19 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -56,6 +56,11 @@ enum quota_type {
56 PRJQUOTA = 2, /* element used for project quotas */ 56 PRJQUOTA = 2, /* element used for project quotas */
57}; 57};
58 58
59/* Masks for quota types when used as a bitmask */
60#define QTYPE_MASK_USR (1 << USRQUOTA)
61#define QTYPE_MASK_GRP (1 << GRPQUOTA)
62#define QTYPE_MASK_PRJ (1 << PRJQUOTA)
63
59typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */ 64typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
60typedef long long qsize_t; /* Type in which we store sizes */ 65typedef long long qsize_t; /* Type in which we store sizes */
61 66
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 1d3eee594cd6..f23538a6e411 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -64,10 +64,10 @@ void dquot_destroy(struct dquot *dquot);
64int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags); 64int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags);
65void __dquot_free_space(struct inode *inode, qsize_t number, int flags); 65void __dquot_free_space(struct inode *inode, qsize_t number, int flags);
66 66
67int dquot_alloc_inode(const struct inode *inode); 67int dquot_alloc_inode(struct inode *inode);
68 68
69int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); 69int dquot_claim_space_nodirty(struct inode *inode, qsize_t number);
70void dquot_free_inode(const struct inode *inode); 70void dquot_free_inode(struct inode *inode);
71void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number); 71void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number);
72 72
73int dquot_disable(struct super_block *sb, int type, unsigned int flags); 73int dquot_disable(struct super_block *sb, int type, unsigned int flags);
@@ -213,12 +213,12 @@ static inline void dquot_drop(struct inode *inode)
213{ 213{
214} 214}
215 215
216static inline int dquot_alloc_inode(const struct inode *inode) 216static inline int dquot_alloc_inode(struct inode *inode)
217{ 217{
218 return 0; 218 return 0;
219} 219}
220 220
221static inline void dquot_free_inode(const struct inode *inode) 221static inline void dquot_free_inode(struct inode *inode)
222{ 222{
223} 223}
224 224
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index 0a260d8a18bf..18102529254e 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -17,14 +17,20 @@ struct ratelimit_state {
17 unsigned long begin; 17 unsigned long begin;
18}; 18};
19 19
20#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init) \ 20#define RATELIMIT_STATE_INIT(name, interval_init, burst_init) { \
21 \
22 struct ratelimit_state name = { \
23 .lock = __RAW_SPIN_LOCK_UNLOCKED(name.lock), \ 21 .lock = __RAW_SPIN_LOCK_UNLOCKED(name.lock), \
24 .interval = interval_init, \ 22 .interval = interval_init, \
25 .burst = burst_init, \ 23 .burst = burst_init, \
26 } 24 }
27 25
26#define RATELIMIT_STATE_INIT_DISABLED \
27 RATELIMIT_STATE_INIT(ratelimit_state, 0, DEFAULT_RATELIMIT_BURST)
28
29#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init) \
30 \
31 struct ratelimit_state name = \
32 RATELIMIT_STATE_INIT(name, interval_init, burst_init) \
33
28static inline void ratelimit_state_init(struct ratelimit_state *rs, 34static inline void ratelimit_state_init(struct ratelimit_state *rs,
29 int interval, int burst) 35 int interval, int burst)
30{ 36{
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 372ad5e0dcb8..529bc946f450 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -241,7 +241,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
241 * list_entry_rcu - get the struct for this entry 241 * list_entry_rcu - get the struct for this entry
242 * @ptr: the &struct list_head pointer. 242 * @ptr: the &struct list_head pointer.
243 * @type: the type of the struct this is embedded in. 243 * @type: the type of the struct this is embedded in.
244 * @member: the name of the list_struct within the struct. 244 * @member: the name of the list_head within the struct.
245 * 245 *
246 * This primitive may safely run concurrently with the _rcu list-mutation 246 * This primitive may safely run concurrently with the _rcu list-mutation
247 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). 247 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
@@ -278,7 +278,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
278 * list_first_or_null_rcu - get the first element from a list 278 * list_first_or_null_rcu - get the first element from a list
279 * @ptr: the list head to take the element from. 279 * @ptr: the list head to take the element from.
280 * @type: the type of the struct this is embedded in. 280 * @type: the type of the struct this is embedded in.
281 * @member: the name of the list_struct within the struct. 281 * @member: the name of the list_head within the struct.
282 * 282 *
283 * Note that if the list is empty, it returns NULL. 283 * Note that if the list is empty, it returns NULL.
284 * 284 *
@@ -296,7 +296,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
296 * list_for_each_entry_rcu - iterate over rcu list of given type 296 * list_for_each_entry_rcu - iterate over rcu list of given type
297 * @pos: the type * to use as a loop cursor. 297 * @pos: the type * to use as a loop cursor.
298 * @head: the head for your list. 298 * @head: the head for your list.
299 * @member: the name of the list_struct within the struct. 299 * @member: the name of the list_head within the struct.
300 * 300 *
301 * This list-traversal primitive may safely run concurrently with 301 * This list-traversal primitive may safely run concurrently with
302 * the _rcu list-mutation primitives such as list_add_rcu() 302 * the _rcu list-mutation primitives such as list_add_rcu()
@@ -311,7 +311,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
311 * list_for_each_entry_continue_rcu - continue iteration over list of given type 311 * list_for_each_entry_continue_rcu - continue iteration over list of given type
312 * @pos: the type * to use as a loop cursor. 312 * @pos: the type * to use as a loop cursor.
313 * @head: the head for your list. 313 * @head: the head for your list.
314 * @member: the name of the list_struct within the struct. 314 * @member: the name of the list_head within the struct.
315 * 315 *
316 * Continue to iterate over list of given type, continuing after 316 * Continue to iterate over list of given type, continuing after
317 * the current position. 317 * the current position.
@@ -542,6 +542,15 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,
542 pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\ 542 pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
543 typeof(*(pos)), member)) 543 typeof(*(pos)), member))
544 544
545/**
546 * hlist_for_each_entry_from_rcu - iterate over a hlist continuing from current point
547 * @pos: the type * to use as a loop cursor.
548 * @member: the name of the hlist_node within the struct.
549 */
550#define hlist_for_each_entry_from_rcu(pos, member) \
551 for (; pos; \
552 pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
553 typeof(*(pos)), member))
545 554
546#endif /* __KERNEL__ */ 555#endif /* __KERNEL__ */
547#endif 556#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 53ff1a752d7e..ed4f5939a452 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -57,7 +57,7 @@ enum rcutorture_type {
57 INVALID_RCU_FLAVOR 57 INVALID_RCU_FLAVOR
58}; 58};
59 59
60#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 60#if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
61void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags, 61void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags,
62 unsigned long *gpnum, unsigned long *completed); 62 unsigned long *gpnum, unsigned long *completed);
63void rcutorture_record_test_transition(void); 63void rcutorture_record_test_transition(void);
@@ -260,7 +260,7 @@ static inline int rcu_preempt_depth(void)
260void rcu_init(void); 260void rcu_init(void);
261void rcu_sched_qs(void); 261void rcu_sched_qs(void);
262void rcu_bh_qs(void); 262void rcu_bh_qs(void);
263void rcu_check_callbacks(int cpu, int user); 263void rcu_check_callbacks(int user);
264struct notifier_block; 264struct notifier_block;
265void rcu_idle_enter(void); 265void rcu_idle_enter(void);
266void rcu_idle_exit(void); 266void rcu_idle_exit(void);
@@ -348,8 +348,8 @@ extern struct srcu_struct tasks_rcu_exit_srcu;
348 */ 348 */
349#define cond_resched_rcu_qs() \ 349#define cond_resched_rcu_qs() \
350do { \ 350do { \
351 rcu_note_voluntary_context_switch(current); \ 351 if (!cond_resched()) \
352 cond_resched(); \ 352 rcu_note_voluntary_context_switch(current); \
353} while (0) 353} while (0)
354 354
355#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) 355#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP)
@@ -365,7 +365,7 @@ typedef void call_rcu_func_t(struct rcu_head *head,
365 void (*func)(struct rcu_head *head)); 365 void (*func)(struct rcu_head *head));
366void wait_rcu_gp(call_rcu_func_t crf); 366void wait_rcu_gp(call_rcu_func_t crf);
367 367
368#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 368#if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
369#include <linux/rcutree.h> 369#include <linux/rcutree.h>
370#elif defined(CONFIG_TINY_RCU) 370#elif defined(CONFIG_TINY_RCU)
371#include <linux/rcutiny.h> 371#include <linux/rcutiny.h>
@@ -867,7 +867,7 @@ static inline void rcu_preempt_sleep_check(void)
867 * 867 *
868 * In non-preemptible RCU implementations (TREE_RCU and TINY_RCU), 868 * In non-preemptible RCU implementations (TREE_RCU and TINY_RCU),
869 * it is illegal to block while in an RCU read-side critical section. 869 * it is illegal to block while in an RCU read-side critical section.
870 * In preemptible RCU implementations (TREE_PREEMPT_RCU) in CONFIG_PREEMPT 870 * In preemptible RCU implementations (PREEMPT_RCU) in CONFIG_PREEMPT
871 * kernel builds, RCU read-side critical sections may be preempted, 871 * kernel builds, RCU read-side critical sections may be preempted,
872 * but explicit blocking is illegal. Finally, in preemptible RCU 872 * but explicit blocking is illegal. Finally, in preemptible RCU
873 * implementations in real-time (with -rt patchset) kernel builds, RCU 873 * implementations in real-time (with -rt patchset) kernel builds, RCU
@@ -902,7 +902,9 @@ static inline void rcu_read_lock(void)
902 * Unfortunately, this function acquires the scheduler's runqueue and 902 * Unfortunately, this function acquires the scheduler's runqueue and
903 * priority-inheritance spinlocks. This means that deadlock could result 903 * priority-inheritance spinlocks. This means that deadlock could result
904 * if the caller of rcu_read_unlock() already holds one of these locks or 904 * if the caller of rcu_read_unlock() already holds one of these locks or
905 * any lock that is ever acquired while holding them. 905 * any lock that is ever acquired while holding them; or any lock which
906 * can be taken from interrupt context because rcu_boost()->rt_mutex_lock()
907 * does not disable irqs while taking ->wait_lock.
906 * 908 *
907 * That said, RCU readers are never priority boosted unless they were 909 * That said, RCU readers are never priority boosted unless they were
908 * preempted. Therefore, one way to avoid deadlock is to make sure 910 * preempted. Therefore, one way to avoid deadlock is to make sure
@@ -1062,6 +1064,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
1062 */ 1064 */
1063#define RCU_INIT_POINTER(p, v) \ 1065#define RCU_INIT_POINTER(p, v) \
1064 do { \ 1066 do { \
1067 rcu_dereference_sparse(p, __rcu); \
1065 p = RCU_INITIALIZER(v); \ 1068 p = RCU_INITIALIZER(v); \
1066 } while (0) 1069 } while (0)
1067 1070
@@ -1118,7 +1121,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
1118 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) 1121 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
1119 1122
1120#if defined(CONFIG_TINY_RCU) || defined(CONFIG_RCU_NOCB_CPU_ALL) 1123#if defined(CONFIG_TINY_RCU) || defined(CONFIG_RCU_NOCB_CPU_ALL)
1121static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies) 1124static inline int rcu_needs_cpu(unsigned long *delta_jiffies)
1122{ 1125{
1123 *delta_jiffies = ULONG_MAX; 1126 *delta_jiffies = ULONG_MAX;
1124 return 0; 1127 return 0;
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 38cc5b1e252d..0e5366200154 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -78,7 +78,7 @@ static inline void kfree_call_rcu(struct rcu_head *head,
78 call_rcu(head, func); 78 call_rcu(head, func);
79} 79}
80 80
81static inline void rcu_note_context_switch(int cpu) 81static inline void rcu_note_context_switch(void)
82{ 82{
83 rcu_sched_qs(); 83 rcu_sched_qs();
84} 84}
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 3e2f5d432743..52953790dcca 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -30,9 +30,9 @@
30#ifndef __LINUX_RCUTREE_H 30#ifndef __LINUX_RCUTREE_H
31#define __LINUX_RCUTREE_H 31#define __LINUX_RCUTREE_H
32 32
33void rcu_note_context_switch(int cpu); 33void rcu_note_context_switch(void);
34#ifndef CONFIG_RCU_NOCB_CPU_ALL 34#ifndef CONFIG_RCU_NOCB_CPU_ALL
35int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies); 35int rcu_needs_cpu(unsigned long *delta_jiffies);
36#endif /* #ifndef CONFIG_RCU_NOCB_CPU_ALL */ 36#endif /* #ifndef CONFIG_RCU_NOCB_CPU_ALL */
37void rcu_cpu_stall_reset(void); 37void rcu_cpu_stall_reset(void);
38 38
@@ -43,7 +43,7 @@ void rcu_cpu_stall_reset(void);
43 */ 43 */
44static inline void rcu_virt_note_context_switch(int cpu) 44static inline void rcu_virt_note_context_switch(int cpu)
45{ 45{
46 rcu_note_context_switch(cpu); 46 rcu_note_context_switch();
47} 47}
48 48
49void synchronize_rcu_bh(void); 49void synchronize_rcu_bh(void);
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index c5ed83f49c4e..4419b99d8d6e 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -27,6 +27,7 @@ struct spmi_device;
27struct regmap; 27struct regmap;
28struct regmap_range_cfg; 28struct regmap_range_cfg;
29struct regmap_field; 29struct regmap_field;
30struct snd_ac97;
30 31
31/* An enum of all the supported cache types */ 32/* An enum of all the supported cache types */
32enum regcache_type { 33enum regcache_type {
@@ -340,6 +341,8 @@ struct regmap *regmap_init_spmi_ext(struct spmi_device *dev,
340struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id, 341struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id,
341 void __iomem *regs, 342 void __iomem *regs,
342 const struct regmap_config *config); 343 const struct regmap_config *config);
344struct regmap *regmap_init_ac97(struct snd_ac97 *ac97,
345 const struct regmap_config *config);
343 346
344struct regmap *devm_regmap_init(struct device *dev, 347struct regmap *devm_regmap_init(struct device *dev,
345 const struct regmap_bus *bus, 348 const struct regmap_bus *bus,
@@ -356,6 +359,10 @@ struct regmap *devm_regmap_init_spmi_ext(struct spmi_device *dev,
356struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id, 359struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id,
357 void __iomem *regs, 360 void __iomem *regs,
358 const struct regmap_config *config); 361 const struct regmap_config *config);
362struct regmap *devm_regmap_init_ac97(struct snd_ac97 *ac97,
363 const struct regmap_config *config);
364
365bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg);
359 366
360/** 367/**
361 * regmap_init_mmio(): Initialise register map 368 * regmap_init_mmio(): Initialise register map
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index f540b1496e2f..d17e1ff7ad01 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -101,6 +101,8 @@ struct regmap;
101 * Data passed is "struct pre_voltage_change_data" 101 * Data passed is "struct pre_voltage_change_data"
102 * ABORT_VOLTAGE_CHANGE Regulator voltage change failed for some reason. 102 * ABORT_VOLTAGE_CHANGE Regulator voltage change failed for some reason.
103 * Data passed is old voltage cast to (void *). 103 * Data passed is old voltage cast to (void *).
104 * PRE_DISABLE Regulator is about to be disabled
105 * ABORT_DISABLE Regulator disable failed for some reason
104 * 106 *
105 * NOTE: These events can be OR'ed together when passed into handler. 107 * NOTE: These events can be OR'ed together when passed into handler.
106 */ 108 */
@@ -115,6 +117,8 @@ struct regmap;
115#define REGULATOR_EVENT_DISABLE 0x80 117#define REGULATOR_EVENT_DISABLE 0x80
116#define REGULATOR_EVENT_PRE_VOLTAGE_CHANGE 0x100 118#define REGULATOR_EVENT_PRE_VOLTAGE_CHANGE 0x100
117#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x200 119#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x200
120#define REGULATOR_EVENT_PRE_DISABLE 0x400
121#define REGULATOR_EVENT_ABORT_DISABLE 0x800
118 122
119/** 123/**
120 * struct pre_voltage_change_data - Data sent with PRE_VOLTAGE_CHANGE event 124 * struct pre_voltage_change_data - Data sent with PRE_VOLTAGE_CHANGE event
@@ -284,7 +288,7 @@ devm_regulator_get(struct device *dev, const char *id)
284static inline struct regulator *__must_check 288static inline struct regulator *__must_check
285regulator_get_exclusive(struct device *dev, const char *id) 289regulator_get_exclusive(struct device *dev, const char *id)
286{ 290{
287 return NULL; 291 return ERR_PTR(-ENODEV);
288} 292}
289 293
290static inline struct regulator *__must_check 294static inline struct regulator *__must_check
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index fc0ee0ce8325..5f1e9ca47417 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -243,6 +243,8 @@ enum regulator_type {
243 * 243 *
244 * @enable_time: Time taken for initial enable of regulator (in uS). 244 * @enable_time: Time taken for initial enable of regulator (in uS).
245 * @off_on_delay: guard time (in uS), before re-enabling a regulator 245 * @off_on_delay: guard time (in uS), before re-enabling a regulator
246 *
247 * @of_map_mode: Maps a hardware mode defined in a DeviceTree to a standard mode
246 */ 248 */
247struct regulator_desc { 249struct regulator_desc {
248 const char *name; 250 const char *name;
@@ -285,6 +287,8 @@ struct regulator_desc {
285 unsigned int enable_time; 287 unsigned int enable_time;
286 288
287 unsigned int off_on_delay; 289 unsigned int off_on_delay;
290
291 unsigned int (*of_map_mode)(unsigned int mode);
288}; 292};
289 293
290/** 294/**
@@ -301,6 +305,9 @@ struct regulator_desc {
301 * NULL). 305 * NULL).
302 * @regmap: regmap to use for core regmap helpers if dev_get_regulator() is 306 * @regmap: regmap to use for core regmap helpers if dev_get_regulator() is
303 * insufficient. 307 * insufficient.
308 * @ena_gpio_initialized: GPIO controlling regulator enable was properly
309 * initialized, meaning that >= 0 is a valid gpio
310 * identifier and < 0 is a non existent gpio.
304 * @ena_gpio: GPIO controlling regulator enable. 311 * @ena_gpio: GPIO controlling regulator enable.
305 * @ena_gpio_invert: Sense for GPIO enable control. 312 * @ena_gpio_invert: Sense for GPIO enable control.
306 * @ena_gpio_flags: Flags to use when calling gpio_request_one() 313 * @ena_gpio_flags: Flags to use when calling gpio_request_one()
@@ -312,6 +319,7 @@ struct regulator_config {
312 struct device_node *of_node; 319 struct device_node *of_node;
313 struct regmap *regmap; 320 struct regmap *regmap;
314 321
322 bool ena_gpio_initialized;
315 int ena_gpio; 323 int ena_gpio;
316 unsigned int ena_gpio_invert:1; 324 unsigned int ena_gpio_invert:1;
317 unsigned int ena_gpio_flags; 325 unsigned int ena_gpio_flags;
diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h
index f9217965aaa3..763953f7e3b8 100644
--- a/include/linux/regulator/of_regulator.h
+++ b/include/linux/regulator/of_regulator.h
@@ -6,24 +6,29 @@
6#ifndef __LINUX_OF_REG_H 6#ifndef __LINUX_OF_REG_H
7#define __LINUX_OF_REG_H 7#define __LINUX_OF_REG_H
8 8
9struct regulator_desc;
10
9struct of_regulator_match { 11struct of_regulator_match {
10 const char *name; 12 const char *name;
11 void *driver_data; 13 void *driver_data;
12 struct regulator_init_data *init_data; 14 struct regulator_init_data *init_data;
13 struct device_node *of_node; 15 struct device_node *of_node;
16 const struct regulator_desc *desc;
14}; 17};
15 18
16#if defined(CONFIG_OF) 19#if defined(CONFIG_OF)
17extern struct regulator_init_data 20extern struct regulator_init_data
18 *of_get_regulator_init_data(struct device *dev, 21 *of_get_regulator_init_data(struct device *dev,
19 struct device_node *node); 22 struct device_node *node,
23 const struct regulator_desc *desc);
20extern int of_regulator_match(struct device *dev, struct device_node *node, 24extern int of_regulator_match(struct device *dev, struct device_node *node,
21 struct of_regulator_match *matches, 25 struct of_regulator_match *matches,
22 unsigned int num_matches); 26 unsigned int num_matches);
23#else 27#else
24static inline struct regulator_init_data 28static inline struct regulator_init_data
25 *of_get_regulator_init_data(struct device *dev, 29 *of_get_regulator_init_data(struct device *dev,
26 struct device_node *node) 30 struct device_node *node,
31 const struct regulator_desc *desc)
27{ 32{
28 return NULL; 33 return NULL;
29} 34}
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
deleted file mode 100644
index 56b7bc32db4f..000000000000
--- a/include/linux/res_counter.h
+++ /dev/null
@@ -1,223 +0,0 @@
1#ifndef __RES_COUNTER_H__
2#define __RES_COUNTER_H__
3
4/*
5 * Resource Counters
6 * Contain common data types and routines for resource accounting
7 *
8 * Copyright 2007 OpenVZ SWsoft Inc
9 *
10 * Author: Pavel Emelianov <xemul@openvz.org>
11 *
12 * See Documentation/cgroups/resource_counter.txt for more
13 * info about what this counter is.
14 */
15
16#include <linux/spinlock.h>
17#include <linux/errno.h>
18
19/*
20 * The core object. the cgroup that wishes to account for some
21 * resource may include this counter into its structures and use
22 * the helpers described beyond
23 */
24
25struct res_counter {
26 /*
27 * the current resource consumption level
28 */
29 unsigned long long usage;
30 /*
31 * the maximal value of the usage from the counter creation
32 */
33 unsigned long long max_usage;
34 /*
35 * the limit that usage cannot exceed
36 */
37 unsigned long long limit;
38 /*
39 * the limit that usage can be exceed
40 */
41 unsigned long long soft_limit;
42 /*
43 * the number of unsuccessful attempts to consume the resource
44 */
45 unsigned long long failcnt;
46 /*
47 * the lock to protect all of the above.
48 * the routines below consider this to be IRQ-safe
49 */
50 spinlock_t lock;
51 /*
52 * Parent counter, used for hierarchial resource accounting
53 */
54 struct res_counter *parent;
55};
56
57#define RES_COUNTER_MAX ULLONG_MAX
58
59/**
60 * Helpers to interact with userspace
61 * res_counter_read_u64() - returns the value of the specified member.
62 * res_counter_read/_write - put/get the specified fields from the
63 * res_counter struct to/from the user
64 *
65 * @counter: the counter in question
66 * @member: the field to work with (see RES_xxx below)
67 * @buf: the buffer to opeate on,...
68 * @nbytes: its size...
69 * @pos: and the offset.
70 */
71
72u64 res_counter_read_u64(struct res_counter *counter, int member);
73
74ssize_t res_counter_read(struct res_counter *counter, int member,
75 const char __user *buf, size_t nbytes, loff_t *pos,
76 int (*read_strategy)(unsigned long long val, char *s));
77
78int res_counter_memparse_write_strategy(const char *buf,
79 unsigned long long *res);
80
81/*
82 * the field descriptors. one for each member of res_counter
83 */
84
85enum {
86 RES_USAGE,
87 RES_MAX_USAGE,
88 RES_LIMIT,
89 RES_FAILCNT,
90 RES_SOFT_LIMIT,
91};
92
93/*
94 * helpers for accounting
95 */
96
97void res_counter_init(struct res_counter *counter, struct res_counter *parent);
98
99/*
100 * charge - try to consume more resource.
101 *
102 * @counter: the counter
103 * @val: the amount of the resource. each controller defines its own
104 * units, e.g. numbers, bytes, Kbytes, etc
105 *
106 * returns 0 on success and <0 if the counter->usage will exceed the
107 * counter->limit
108 *
109 * charge_nofail works the same, except that it charges the resource
110 * counter unconditionally, and returns < 0 if the after the current
111 * charge we are over limit.
112 */
113
114int __must_check res_counter_charge(struct res_counter *counter,
115 unsigned long val, struct res_counter **limit_fail_at);
116int res_counter_charge_nofail(struct res_counter *counter,
117 unsigned long val, struct res_counter **limit_fail_at);
118
119/*
120 * uncharge - tell that some portion of the resource is released
121 *
122 * @counter: the counter
123 * @val: the amount of the resource
124 *
125 * these calls check for usage underflow and show a warning on the console
126 *
127 * returns the total charges still present in @counter.
128 */
129
130u64 res_counter_uncharge(struct res_counter *counter, unsigned long val);
131
132u64 res_counter_uncharge_until(struct res_counter *counter,
133 struct res_counter *top,
134 unsigned long val);
135/**
136 * res_counter_margin - calculate chargeable space of a counter
137 * @cnt: the counter
138 *
139 * Returns the difference between the hard limit and the current usage
140 * of resource counter @cnt.
141 */
142static inline unsigned long long res_counter_margin(struct res_counter *cnt)
143{
144 unsigned long long margin;
145 unsigned long flags;
146
147 spin_lock_irqsave(&cnt->lock, flags);
148 if (cnt->limit > cnt->usage)
149 margin = cnt->limit - cnt->usage;
150 else
151 margin = 0;
152 spin_unlock_irqrestore(&cnt->lock, flags);
153 return margin;
154}
155
156/**
157 * Get the difference between the usage and the soft limit
158 * @cnt: The counter
159 *
160 * Returns 0 if usage is less than or equal to soft limit
161 * The difference between usage and soft limit, otherwise.
162 */
163static inline unsigned long long
164res_counter_soft_limit_excess(struct res_counter *cnt)
165{
166 unsigned long long excess;
167 unsigned long flags;
168
169 spin_lock_irqsave(&cnt->lock, flags);
170 if (cnt->usage <= cnt->soft_limit)
171 excess = 0;
172 else
173 excess = cnt->usage - cnt->soft_limit;
174 spin_unlock_irqrestore(&cnt->lock, flags);
175 return excess;
176}
177
178static inline void res_counter_reset_max(struct res_counter *cnt)
179{
180 unsigned long flags;
181
182 spin_lock_irqsave(&cnt->lock, flags);
183 cnt->max_usage = cnt->usage;
184 spin_unlock_irqrestore(&cnt->lock, flags);
185}
186
187static inline void res_counter_reset_failcnt(struct res_counter *cnt)
188{
189 unsigned long flags;
190
191 spin_lock_irqsave(&cnt->lock, flags);
192 cnt->failcnt = 0;
193 spin_unlock_irqrestore(&cnt->lock, flags);
194}
195
196static inline int res_counter_set_limit(struct res_counter *cnt,
197 unsigned long long limit)
198{
199 unsigned long flags;
200 int ret = -EBUSY;
201
202 spin_lock_irqsave(&cnt->lock, flags);
203 if (cnt->usage <= limit) {
204 cnt->limit = limit;
205 ret = 0;
206 }
207 spin_unlock_irqrestore(&cnt->lock, flags);
208 return ret;
209}
210
211static inline int
212res_counter_set_soft_limit(struct res_counter *cnt,
213 unsigned long long soft_limit)
214{
215 unsigned long flags;
216
217 spin_lock_irqsave(&cnt->lock, flags);
218 cnt->soft_limit = soft_limit;
219 spin_unlock_irqrestore(&cnt->lock, flags);
220 return 0;
221}
222
223#endif
diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h
index 41a4695fde08..ce6b962ffed4 100644
--- a/include/linux/reset-controller.h
+++ b/include/linux/reset-controller.h
@@ -12,11 +12,13 @@ struct reset_controller_dev;
12 * things to reset the device 12 * things to reset the device
13 * @assert: manually assert the reset line, if supported 13 * @assert: manually assert the reset line, if supported
14 * @deassert: manually deassert the reset line, if supported 14 * @deassert: manually deassert the reset line, if supported
15 * @status: return the status of the reset line, if supported
15 */ 16 */
16struct reset_control_ops { 17struct reset_control_ops {
17 int (*reset)(struct reset_controller_dev *rcdev, unsigned long id); 18 int (*reset)(struct reset_controller_dev *rcdev, unsigned long id);
18 int (*assert)(struct reset_controller_dev *rcdev, unsigned long id); 19 int (*assert)(struct reset_controller_dev *rcdev, unsigned long id);
19 int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id); 20 int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id);
21 int (*status)(struct reset_controller_dev *rcdev, unsigned long id);
20}; 22};
21 23
22struct module; 24struct module;
diff --git a/include/linux/reset.h b/include/linux/reset.h
index 349f150ae12c..da5602bd77d7 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -10,6 +10,7 @@ struct reset_control;
10int reset_control_reset(struct reset_control *rstc); 10int reset_control_reset(struct reset_control *rstc);
11int reset_control_assert(struct reset_control *rstc); 11int reset_control_assert(struct reset_control *rstc);
12int reset_control_deassert(struct reset_control *rstc); 12int reset_control_deassert(struct reset_control *rstc);
13int reset_control_status(struct reset_control *rstc);
13 14
14struct reset_control *reset_control_get(struct device *dev, const char *id); 15struct reset_control *reset_control_get(struct device *dev, const char *id);
15void reset_control_put(struct reset_control *rstc); 16void reset_control_put(struct reset_control *rstc);
@@ -57,6 +58,12 @@ static inline int reset_control_deassert(struct reset_control *rstc)
57 return 0; 58 return 0;
58} 59}
59 60
61static inline int reset_control_status(struct reset_control *rstc)
62{
63 WARN_ON(1);
64 return 0;
65}
66
60static inline void reset_control_put(struct reset_control *rstc) 67static inline void reset_control_put(struct reset_control *rstc)
61{ 68{
62 WARN_ON(1); 69 WARN_ON(1);
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index fb298e9d6d3a..b93fd89b2e5e 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -65,7 +65,10 @@ struct rhashtable_params {
65 size_t new_size); 65 size_t new_size);
66 bool (*shrink_decision)(const struct rhashtable *ht, 66 bool (*shrink_decision)(const struct rhashtable *ht,
67 size_t new_size); 67 size_t new_size);
68 int (*mutex_is_held)(void); 68#ifdef CONFIG_PROVE_LOCKING
69 int (*mutex_is_held)(void *parent);
70 void *parent;
71#endif
69}; 72};
70 73
71/** 74/**
@@ -96,16 +99,16 @@ int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params);
96u32 rhashtable_hashfn(const struct rhashtable *ht, const void *key, u32 len); 99u32 rhashtable_hashfn(const struct rhashtable *ht, const void *key, u32 len);
97u32 rhashtable_obj_hashfn(const struct rhashtable *ht, void *ptr); 100u32 rhashtable_obj_hashfn(const struct rhashtable *ht, void *ptr);
98 101
99void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node, gfp_t); 102void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node);
100bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node, gfp_t); 103bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node);
101void rhashtable_remove_pprev(struct rhashtable *ht, struct rhash_head *obj, 104void rhashtable_remove_pprev(struct rhashtable *ht, struct rhash_head *obj,
102 struct rhash_head __rcu **pprev, gfp_t flags); 105 struct rhash_head __rcu **pprev);
103 106
104bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size); 107bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size);
105bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size); 108bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size);
106 109
107int rhashtable_expand(struct rhashtable *ht, gfp_t flags); 110int rhashtable_expand(struct rhashtable *ht);
108int rhashtable_shrink(struct rhashtable *ht, gfp_t flags); 111int rhashtable_shrink(struct rhashtable *ht);
109 112
110void *rhashtable_lookup(const struct rhashtable *ht, const void *key); 113void *rhashtable_lookup(const struct rhashtable *ht, const void *key);
111void *rhashtable_lookup_compare(const struct rhashtable *ht, u32 hash, 114void *rhashtable_lookup_compare(const struct rhashtable *ht, u32 hash,
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index c2c28975293c..6d6be09a2fe5 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -19,11 +19,28 @@
19extern int rtc_month_days(unsigned int month, unsigned int year); 19extern int rtc_month_days(unsigned int month, unsigned int year);
20extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year); 20extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year);
21extern int rtc_valid_tm(struct rtc_time *tm); 21extern int rtc_valid_tm(struct rtc_time *tm);
22extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time); 22extern time64_t rtc_tm_to_time64(struct rtc_time *tm);
23extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm); 23extern void rtc_time64_to_tm(time64_t time, struct rtc_time *tm);
24ktime_t rtc_tm_to_ktime(struct rtc_time tm); 24ktime_t rtc_tm_to_ktime(struct rtc_time tm);
25struct rtc_time rtc_ktime_to_tm(ktime_t kt); 25struct rtc_time rtc_ktime_to_tm(ktime_t kt);
26 26
27/**
28 * Deprecated. Use rtc_time64_to_tm().
29 */
30static inline void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
31{
32 rtc_time64_to_tm(time, tm);
33}
34
35/**
36 * Deprecated. Use rtc_tm_to_time64().
37 */
38static inline int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time)
39{
40 *time = rtc_tm_to_time64(tm);
41
42 return 0;
43}
27 44
28#include <linux/device.h> 45#include <linux/device.h>
29#include <linux/seq_file.h> 46#include <linux/seq_file.h>
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 6cacbce1a06c..5db76a32fcab 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -17,6 +17,11 @@ extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst,
17 u32 id, long expires, u32 error); 17 u32 id, long expires, u32 error);
18 18
19void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change, gfp_t flags); 19void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change, gfp_t flags);
20struct sk_buff *rtmsg_ifinfo_build_skb(int type, struct net_device *dev,
21 unsigned change, gfp_t flags);
22void rtmsg_ifinfo_send(struct sk_buff *skb, struct net_device *dev,
23 gfp_t flags);
24
20 25
21/* RTNL is used as a global lock for all changes to network configuration */ 26/* RTNL is used as a global lock for all changes to network configuration */
22extern void rtnl_lock(void); 27extern void rtnl_lock(void);
@@ -94,12 +99,15 @@ extern int ndo_dflt_fdb_add(struct ndmsg *ndm,
94 struct nlattr *tb[], 99 struct nlattr *tb[],
95 struct net_device *dev, 100 struct net_device *dev,
96 const unsigned char *addr, 101 const unsigned char *addr,
97 u16 flags); 102 u16 vid,
103 u16 flags);
98extern int ndo_dflt_fdb_del(struct ndmsg *ndm, 104extern int ndo_dflt_fdb_del(struct ndmsg *ndm,
99 struct nlattr *tb[], 105 struct nlattr *tb[],
100 struct net_device *dev, 106 struct net_device *dev,
101 const unsigned char *addr); 107 const unsigned char *addr,
108 u16 vid);
102 109
103extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, 110extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
104 struct net_device *dev, u16 mode); 111 struct net_device *dev, u16 mode,
112 u32 flags, u32 mask);
105#endif /* __LINUX_RTNETLINK_H */ 113#endif /* __LINUX_RTNETLINK_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 5e344bbe63ec..8db31ef98d2f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -243,6 +243,43 @@ extern char ___assert_task_state[1 - 2*!!(
243 ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \ 243 ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \
244 (task->flags & PF_FROZEN) == 0) 244 (task->flags & PF_FROZEN) == 0)
245 245
246#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
247
248#define __set_task_state(tsk, state_value) \
249 do { \
250 (tsk)->task_state_change = _THIS_IP_; \
251 (tsk)->state = (state_value); \
252 } while (0)
253#define set_task_state(tsk, state_value) \
254 do { \
255 (tsk)->task_state_change = _THIS_IP_; \
256 set_mb((tsk)->state, (state_value)); \
257 } while (0)
258
259/*
260 * set_current_state() includes a barrier so that the write of current->state
261 * is correctly serialised wrt the caller's subsequent test of whether to
262 * actually sleep:
263 *
264 * set_current_state(TASK_UNINTERRUPTIBLE);
265 * if (do_i_need_to_sleep())
266 * schedule();
267 *
268 * If the caller does not need such serialisation then use __set_current_state()
269 */
270#define __set_current_state(state_value) \
271 do { \
272 current->task_state_change = _THIS_IP_; \
273 current->state = (state_value); \
274 } while (0)
275#define set_current_state(state_value) \
276 do { \
277 current->task_state_change = _THIS_IP_; \
278 set_mb(current->state, (state_value)); \
279 } while (0)
280
281#else
282
246#define __set_task_state(tsk, state_value) \ 283#define __set_task_state(tsk, state_value) \
247 do { (tsk)->state = (state_value); } while (0) 284 do { (tsk)->state = (state_value); } while (0)
248#define set_task_state(tsk, state_value) \ 285#define set_task_state(tsk, state_value) \
@@ -259,11 +296,13 @@ extern char ___assert_task_state[1 - 2*!!(
259 * 296 *
260 * If the caller does not need such serialisation then use __set_current_state() 297 * If the caller does not need such serialisation then use __set_current_state()
261 */ 298 */
262#define __set_current_state(state_value) \ 299#define __set_current_state(state_value) \
263 do { current->state = (state_value); } while (0) 300 do { current->state = (state_value); } while (0)
264#define set_current_state(state_value) \ 301#define set_current_state(state_value) \
265 set_mb(current->state, (state_value)) 302 set_mb(current->state, (state_value))
266 303
304#endif
305
267/* Task command name length */ 306/* Task command name length */
268#define TASK_COMM_LEN 16 307#define TASK_COMM_LEN 16
269 308
@@ -1278,9 +1317,9 @@ struct task_struct {
1278 union rcu_special rcu_read_unlock_special; 1317 union rcu_special rcu_read_unlock_special;
1279 struct list_head rcu_node_entry; 1318 struct list_head rcu_node_entry;
1280#endif /* #ifdef CONFIG_PREEMPT_RCU */ 1319#endif /* #ifdef CONFIG_PREEMPT_RCU */
1281#ifdef CONFIG_TREE_PREEMPT_RCU 1320#ifdef CONFIG_PREEMPT_RCU
1282 struct rcu_node *rcu_blocked_node; 1321 struct rcu_node *rcu_blocked_node;
1283#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ 1322#endif /* #ifdef CONFIG_PREEMPT_RCU */
1284#ifdef CONFIG_TASKS_RCU 1323#ifdef CONFIG_TASKS_RCU
1285 unsigned long rcu_tasks_nvcsw; 1324 unsigned long rcu_tasks_nvcsw;
1286 bool rcu_tasks_holdout; 1325 bool rcu_tasks_holdout;
@@ -1325,6 +1364,10 @@ struct task_struct {
1325 unsigned sched_reset_on_fork:1; 1364 unsigned sched_reset_on_fork:1;
1326 unsigned sched_contributes_to_load:1; 1365 unsigned sched_contributes_to_load:1;
1327 1366
1367#ifdef CONFIG_MEMCG_KMEM
1368 unsigned memcg_kmem_skip_account:1;
1369#endif
1370
1328 unsigned long atomic_flags; /* Flags needing atomic access. */ 1371 unsigned long atomic_flags; /* Flags needing atomic access. */
1329 1372
1330 pid_t pid; 1373 pid_t pid;
@@ -1558,28 +1601,23 @@ struct task_struct {
1558 struct numa_group *numa_group; 1601 struct numa_group *numa_group;
1559 1602
1560 /* 1603 /*
1561 * Exponential decaying average of faults on a per-node basis. 1604 * numa_faults is an array split into four regions:
1562 * Scheduling placement decisions are made based on the these counts. 1605 * faults_memory, faults_cpu, faults_memory_buffer, faults_cpu_buffer
1563 * The values remain static for the duration of a PTE scan 1606 * in this precise order.
1607 *
1608 * faults_memory: Exponential decaying average of faults on a per-node
1609 * basis. Scheduling placement decisions are made based on these
1610 * counts. The values remain static for the duration of a PTE scan.
1611 * faults_cpu: Track the nodes the process was running on when a NUMA
1612 * hinting fault was incurred.
1613 * faults_memory_buffer and faults_cpu_buffer: Record faults per node
1614 * during the current scan window. When the scan completes, the counts
1615 * in faults_memory and faults_cpu decay and these values are copied.
1564 */ 1616 */
1565 unsigned long *numa_faults_memory; 1617 unsigned long *numa_faults;
1566 unsigned long total_numa_faults; 1618 unsigned long total_numa_faults;
1567 1619
1568 /* 1620 /*
1569 * numa_faults_buffer records faults per node during the current
1570 * scan window. When the scan completes, the counts in
1571 * numa_faults_memory decay and these values are copied.
1572 */
1573 unsigned long *numa_faults_buffer_memory;
1574
1575 /*
1576 * Track the nodes the process was running on when a NUMA hinting
1577 * fault was incurred.
1578 */
1579 unsigned long *numa_faults_cpu;
1580 unsigned long *numa_faults_buffer_cpu;
1581
1582 /*
1583 * numa_faults_locality tracks if faults recorded during the last 1621 * numa_faults_locality tracks if faults recorded during the last
1584 * scan window were remote/local. The task scan period is adapted 1622 * scan window were remote/local. The task scan period is adapted
1585 * based on the locality of the faults with different weights 1623 * based on the locality of the faults with different weights
@@ -1645,8 +1683,7 @@ struct task_struct {
1645 /* bitmask and counter of trace recursion */ 1683 /* bitmask and counter of trace recursion */
1646 unsigned long trace_recursion; 1684 unsigned long trace_recursion;
1647#endif /* CONFIG_TRACING */ 1685#endif /* CONFIG_TRACING */
1648#ifdef CONFIG_MEMCG /* memcg uses this to do batch job */ 1686#ifdef CONFIG_MEMCG
1649 unsigned int memcg_kmem_skip_account;
1650 struct memcg_oom_info { 1687 struct memcg_oom_info {
1651 struct mem_cgroup *memcg; 1688 struct mem_cgroup *memcg;
1652 gfp_t gfp_mask; 1689 gfp_t gfp_mask;
@@ -1661,6 +1698,9 @@ struct task_struct {
1661 unsigned int sequential_io; 1698 unsigned int sequential_io;
1662 unsigned int sequential_io_avg; 1699 unsigned int sequential_io_avg;
1663#endif 1700#endif
1701#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
1702 unsigned long task_state_change;
1703#endif
1664}; 1704};
1665 1705
1666/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1706/* Future-safe accessor for struct task_struct's cpus_allowed. */
@@ -2052,6 +2092,10 @@ static inline void tsk_restore_flags(struct task_struct *task,
2052 task->flags |= orig_flags & flags; 2092 task->flags |= orig_flags & flags;
2053} 2093}
2054 2094
2095extern int cpuset_cpumask_can_shrink(const struct cpumask *cur,
2096 const struct cpumask *trial);
2097extern int task_can_attach(struct task_struct *p,
2098 const struct cpumask *cs_cpus_allowed);
2055#ifdef CONFIG_SMP 2099#ifdef CONFIG_SMP
2056extern void do_set_cpus_allowed(struct task_struct *p, 2100extern void do_set_cpus_allowed(struct task_struct *p,
2057 const struct cpumask *new_mask); 2101 const struct cpumask *new_mask);
@@ -2441,6 +2485,10 @@ extern void do_group_exit(int);
2441extern int do_execve(struct filename *, 2485extern int do_execve(struct filename *,
2442 const char __user * const __user *, 2486 const char __user * const __user *,
2443 const char __user * const __user *); 2487 const char __user * const __user *);
2488extern int do_execveat(int, struct filename *,
2489 const char __user * const __user *,
2490 const char __user * const __user *,
2491 int);
2444extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *); 2492extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *);
2445struct task_struct *fork_idle(int); 2493struct task_struct *fork_idle(int);
2446extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); 2494extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
@@ -2760,7 +2808,7 @@ static inline int signal_pending_state(long state, struct task_struct *p)
2760extern int _cond_resched(void); 2808extern int _cond_resched(void);
2761 2809
2762#define cond_resched() ({ \ 2810#define cond_resched() ({ \
2763 __might_sleep(__FILE__, __LINE__, 0); \ 2811 ___might_sleep(__FILE__, __LINE__, 0); \
2764 _cond_resched(); \ 2812 _cond_resched(); \
2765}) 2813})
2766 2814
@@ -2773,14 +2821,14 @@ extern int __cond_resched_lock(spinlock_t *lock);
2773#endif 2821#endif
2774 2822
2775#define cond_resched_lock(lock) ({ \ 2823#define cond_resched_lock(lock) ({ \
2776 __might_sleep(__FILE__, __LINE__, PREEMPT_LOCK_OFFSET); \ 2824 ___might_sleep(__FILE__, __LINE__, PREEMPT_LOCK_OFFSET);\
2777 __cond_resched_lock(lock); \ 2825 __cond_resched_lock(lock); \
2778}) 2826})
2779 2827
2780extern int __cond_resched_softirq(void); 2828extern int __cond_resched_softirq(void);
2781 2829
2782#define cond_resched_softirq() ({ \ 2830#define cond_resched_softirq() ({ \
2783 __might_sleep(__FILE__, __LINE__, SOFTIRQ_DISABLE_OFFSET); \ 2831 ___might_sleep(__FILE__, __LINE__, SOFTIRQ_DISABLE_OFFSET); \
2784 __cond_resched_softirq(); \ 2832 __cond_resched_softirq(); \
2785}) 2833})
2786 2834
diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h
new file mode 100644
index 000000000000..9aafe0e24c68
--- /dev/null
+++ b/include/linux/seq_buf.h
@@ -0,0 +1,136 @@
1#ifndef _LINUX_SEQ_BUF_H
2#define _LINUX_SEQ_BUF_H
3
4#include <linux/fs.h>
5
6/*
7 * Trace sequences are used to allow a function to call several other functions
8 * to create a string of data to use.
9 */
10
11/**
12 * seq_buf - seq buffer structure
13 * @buffer: pointer to the buffer
14 * @size: size of the buffer
15 * @len: the amount of data inside the buffer
16 * @readpos: The next position to read in the buffer.
17 */
18struct seq_buf {
19 char *buffer;
20 size_t size;
21 size_t len;
22 loff_t readpos;
23};
24
25static inline void seq_buf_clear(struct seq_buf *s)
26{
27 s->len = 0;
28 s->readpos = 0;
29}
30
31static inline void
32seq_buf_init(struct seq_buf *s, unsigned char *buf, unsigned int size)
33{
34 s->buffer = buf;
35 s->size = size;
36 seq_buf_clear(s);
37}
38
39/*
40 * seq_buf have a buffer that might overflow. When this happens
41 * the len and size are set to be equal.
42 */
43static inline bool
44seq_buf_has_overflowed(struct seq_buf *s)
45{
46 return s->len > s->size;
47}
48
49static inline void
50seq_buf_set_overflow(struct seq_buf *s)
51{
52 s->len = s->size + 1;
53}
54
55/*
56 * How much buffer is left on the seq_buf?
57 */
58static inline unsigned int
59seq_buf_buffer_left(struct seq_buf *s)
60{
61 if (seq_buf_has_overflowed(s))
62 return 0;
63
64 return s->size - s->len;
65}
66
67/* How much buffer was written? */
68static inline unsigned int seq_buf_used(struct seq_buf *s)
69{
70 return min(s->len, s->size);
71}
72
73/**
74 * seq_buf_get_buf - get buffer to write arbitrary data to
75 * @s: the seq_buf handle
76 * @bufp: the beginning of the buffer is stored here
77 *
78 * Return the number of bytes available in the buffer, or zero if
79 * there's no space.
80 */
81static inline size_t seq_buf_get_buf(struct seq_buf *s, char **bufp)
82{
83 WARN_ON(s->len > s->size + 1);
84
85 if (s->len < s->size) {
86 *bufp = s->buffer + s->len;
87 return s->size - s->len;
88 }
89
90 *bufp = NULL;
91 return 0;
92}
93
94/**
95 * seq_buf_commit - commit data to the buffer
96 * @s: the seq_buf handle
97 * @num: the number of bytes to commit
98 *
99 * Commit @num bytes of data written to a buffer previously acquired
100 * by seq_buf_get. To signal an error condition, or that the data
101 * didn't fit in the available space, pass a negative @num value.
102 */
103static inline void seq_buf_commit(struct seq_buf *s, int num)
104{
105 if (num < 0) {
106 seq_buf_set_overflow(s);
107 } else {
108 /* num must be negative on overflow */
109 BUG_ON(s->len + num > s->size);
110 s->len += num;
111 }
112}
113
114extern __printf(2, 3)
115int seq_buf_printf(struct seq_buf *s, const char *fmt, ...);
116extern __printf(2, 0)
117int seq_buf_vprintf(struct seq_buf *s, const char *fmt, va_list args);
118extern int seq_buf_print_seq(struct seq_file *m, struct seq_buf *s);
119extern int seq_buf_to_user(struct seq_buf *s, char __user *ubuf,
120 int cnt);
121extern int seq_buf_puts(struct seq_buf *s, const char *str);
122extern int seq_buf_putc(struct seq_buf *s, unsigned char c);
123extern int seq_buf_putmem(struct seq_buf *s, const void *mem, unsigned int len);
124extern int seq_buf_putmem_hex(struct seq_buf *s, const void *mem,
125 unsigned int len);
126extern int seq_buf_path(struct seq_buf *s, const struct path *path, const char *esc);
127
128extern int seq_buf_bitmask(struct seq_buf *s, const unsigned long *maskp,
129 int nmaskbits);
130
131#ifdef CONFIG_BINARY_PRINTF
132extern int
133seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary);
134#endif
135
136#endif /* _LINUX_SEQ_BUF_H */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 52e0097f61f0..cf6a9daaaf6d 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -43,6 +43,21 @@ struct seq_operations {
43#define SEQ_SKIP 1 43#define SEQ_SKIP 1
44 44
45/** 45/**
46 * seq_has_overflowed - check if the buffer has overflowed
47 * @m: the seq_file handle
48 *
49 * seq_files have a buffer which may overflow. When this happens a larger
50 * buffer is reallocated and all the data will be printed again.
51 * The overflow state is true when m->count == m->size.
52 *
53 * Returns true if the buffer received more than it can hold.
54 */
55static inline bool seq_has_overflowed(struct seq_file *m)
56{
57 return m->count == m->size;
58}
59
60/**
46 * seq_get_buf - get buffer to write arbitrary data to 61 * seq_get_buf - get buffer to write arbitrary data to
47 * @m: the seq_file handle 62 * @m: the seq_file handle
48 * @bufp: the beginning of the buffer is stored here 63 * @bufp: the beginning of the buffer is stored here
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 3df10d5f154b..e02acf0a0ec9 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -97,13 +97,10 @@ struct uart_8250_port {
97 unsigned char msr_saved_flags; 97 unsigned char msr_saved_flags;
98 98
99 struct uart_8250_dma *dma; 99 struct uart_8250_dma *dma;
100 struct serial_rs485 rs485;
101 100
102 /* 8250 specific callbacks */ 101 /* 8250 specific callbacks */
103 int (*dl_read)(struct uart_8250_port *); 102 int (*dl_read)(struct uart_8250_port *);
104 void (*dl_write)(struct uart_8250_port *, int); 103 void (*dl_write)(struct uart_8250_port *, int);
105 int (*rs485_config)(struct uart_8250_port *,
106 struct serial_rs485 *rs485);
107}; 104};
108 105
109static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up) 106static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up)
diff --git a/include/linux/serial_bcm63xx.h b/include/linux/serial_bcm63xx.h
index a80aa1a5bee2..570e964dc899 100644
--- a/include/linux/serial_bcm63xx.h
+++ b/include/linux/serial_bcm63xx.h
@@ -116,6 +116,4 @@
116 UART_FIFO_PARERR_MASK | \ 116 UART_FIFO_PARERR_MASK | \
117 UART_FIFO_BRKDET_MASK) 117 UART_FIFO_BRKDET_MASK)
118 118
119#define UART_REG_SIZE 24
120
121#endif /* _LINUX_SERIAL_BCM63XX_H */ 119#endif /* _LINUX_SERIAL_BCM63XX_H */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 21c2e05c1bc3..057038cf2788 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -63,7 +63,7 @@ struct uart_ops {
63 void (*flush_buffer)(struct uart_port *); 63 void (*flush_buffer)(struct uart_port *);
64 void (*set_termios)(struct uart_port *, struct ktermios *new, 64 void (*set_termios)(struct uart_port *, struct ktermios *new,
65 struct ktermios *old); 65 struct ktermios *old);
66 void (*set_ldisc)(struct uart_port *, int new); 66 void (*set_ldisc)(struct uart_port *, struct ktermios *);
67 void (*pm)(struct uart_port *, unsigned int state, 67 void (*pm)(struct uart_port *, unsigned int state,
68 unsigned int oldstate); 68 unsigned int oldstate);
69 69
@@ -131,6 +131,8 @@ struct uart_port {
131 void (*pm)(struct uart_port *, unsigned int state, 131 void (*pm)(struct uart_port *, unsigned int state,
132 unsigned int old); 132 unsigned int old);
133 void (*handle_break)(struct uart_port *); 133 void (*handle_break)(struct uart_port *);
134 int (*rs485_config)(struct uart_port *,
135 struct serial_rs485 *rs485);
134 unsigned int irq; /* irq number */ 136 unsigned int irq; /* irq number */
135 unsigned long irqflags; /* irq flags */ 137 unsigned long irqflags; /* irq flags */
136 unsigned int uartclk; /* base uart clock */ 138 unsigned int uartclk; /* base uart clock */
@@ -140,12 +142,13 @@ struct uart_port {
140 unsigned char iotype; /* io access style */ 142 unsigned char iotype; /* io access style */
141 unsigned char unused1; 143 unsigned char unused1;
142 144
143#define UPIO_PORT (0) 145#define UPIO_PORT (0) /* 8b I/O port access */
144#define UPIO_HUB6 (1) 146#define UPIO_HUB6 (1) /* Hub6 ISA card */
145#define UPIO_MEM (2) 147#define UPIO_MEM (2) /* 8b MMIO access */
146#define UPIO_MEM32 (3) 148#define UPIO_MEM32 (3) /* 32b little endian */
147#define UPIO_AU (4) /* Au1x00 and RT288x type IO */ 149#define UPIO_MEM32BE (4) /* 32b big endian */
148#define UPIO_TSI (5) /* Tsi108/109 type IO */ 150#define UPIO_AU (5) /* Au1x00 and RT288x type IO */
151#define UPIO_TSI (6) /* Tsi108/109 type IO */
149 152
150 unsigned int read_status_mask; /* driver specific */ 153 unsigned int read_status_mask; /* driver specific */
151 unsigned int ignore_status_mask; /* driver specific */ 154 unsigned int ignore_status_mask; /* driver specific */
@@ -160,21 +163,33 @@ struct uart_port {
160 /* flags must be updated while holding port mutex */ 163 /* flags must be updated while holding port mutex */
161 upf_t flags; 164 upf_t flags;
162 165
163#define UPF_FOURPORT ((__force upf_t) (1 << 1)) 166 /*
164#define UPF_SAK ((__force upf_t) (1 << 2)) 167 * These flags must be equivalent to the flags defined in
165#define UPF_SPD_MASK ((__force upf_t) (0x1030)) 168 * include/uapi/linux/tty_flags.h which are the userspace definitions
166#define UPF_SPD_HI ((__force upf_t) (0x0010)) 169 * assigned from the serial_struct flags in uart_set_info()
167#define UPF_SPD_VHI ((__force upf_t) (0x0020)) 170 * [for bit definitions in the UPF_CHANGE_MASK]
168#define UPF_SPD_CUST ((__force upf_t) (0x0030)) 171 *
169#define UPF_SPD_SHI ((__force upf_t) (0x1000)) 172 * Bits [0..UPF_LAST_USER] are userspace defined/visible/changeable
170#define UPF_SPD_WARP ((__force upf_t) (0x1010)) 173 * except bit 15 (UPF_NO_TXEN_TEST) which is masked off.
171#define UPF_SKIP_TEST ((__force upf_t) (1 << 6)) 174 * The remaining bits are serial-core specific and not modifiable by
172#define UPF_AUTO_IRQ ((__force upf_t) (1 << 7)) 175 * userspace.
173#define UPF_HARDPPS_CD ((__force upf_t) (1 << 11)) 176 */
174#define UPF_LOW_LATENCY ((__force upf_t) (1 << 13)) 177#define UPF_FOURPORT ((__force upf_t) ASYNC_FOURPORT /* 1 */ )
175#define UPF_BUGGY_UART ((__force upf_t) (1 << 14)) 178#define UPF_SAK ((__force upf_t) ASYNC_SAK /* 2 */ )
179#define UPF_SPD_HI ((__force upf_t) ASYNC_SPD_HI /* 4 */ )
180#define UPF_SPD_VHI ((__force upf_t) ASYNC_SPD_VHI /* 5 */ )
181#define UPF_SPD_CUST ((__force upf_t) ASYNC_SPD_CUST /* 0x0030 */ )
182#define UPF_SPD_WARP ((__force upf_t) ASYNC_SPD_WARP /* 0x1010 */ )
183#define UPF_SPD_MASK ((__force upf_t) ASYNC_SPD_MASK /* 0x1030 */ )
184#define UPF_SKIP_TEST ((__force upf_t) ASYNC_SKIP_TEST /* 6 */ )
185#define UPF_AUTO_IRQ ((__force upf_t) ASYNC_AUTO_IRQ /* 7 */ )
186#define UPF_HARDPPS_CD ((__force upf_t) ASYNC_HARDPPS_CD /* 11 */ )
187#define UPF_SPD_SHI ((__force upf_t) ASYNC_SPD_SHI /* 12 */ )
188#define UPF_LOW_LATENCY ((__force upf_t) ASYNC_LOW_LATENCY /* 13 */ )
189#define UPF_BUGGY_UART ((__force upf_t) ASYNC_BUGGY_UART /* 14 */ )
176#define UPF_NO_TXEN_TEST ((__force upf_t) (1 << 15)) 190#define UPF_NO_TXEN_TEST ((__force upf_t) (1 << 15))
177#define UPF_MAGIC_MULTIPLIER ((__force upf_t) (1 << 16)) 191#define UPF_MAGIC_MULTIPLIER ((__force upf_t) ASYNC_MAGIC_MULTIPLIER /* 16 */ )
192
178/* Port has hardware-assisted h/w flow control (iow, auto-RTS *not* auto-CTS) */ 193/* Port has hardware-assisted h/w flow control (iow, auto-RTS *not* auto-CTS) */
179#define UPF_HARD_FLOW ((__force upf_t) (1 << 21)) 194#define UPF_HARD_FLOW ((__force upf_t) (1 << 21))
180/* Port has hardware-assisted s/w flow control */ 195/* Port has hardware-assisted s/w flow control */
@@ -190,9 +205,14 @@ struct uart_port {
190#define UPF_DEAD ((__force upf_t) (1 << 30)) 205#define UPF_DEAD ((__force upf_t) (1 << 30))
191#define UPF_IOREMAP ((__force upf_t) (1 << 31)) 206#define UPF_IOREMAP ((__force upf_t) (1 << 31))
192 207
193#define UPF_CHANGE_MASK ((__force upf_t) (0x17fff)) 208#define __UPF_CHANGE_MASK 0x17fff
209#define UPF_CHANGE_MASK ((__force upf_t) __UPF_CHANGE_MASK)
194#define UPF_USR_MASK ((__force upf_t) (UPF_SPD_MASK|UPF_LOW_LATENCY)) 210#define UPF_USR_MASK ((__force upf_t) (UPF_SPD_MASK|UPF_LOW_LATENCY))
195 211
212#if __UPF_CHANGE_MASK > ASYNC_FLAGS
213#error Change mask not equivalent to userspace-visible bit defines
214#endif
215
196 /* status must be updated while holding port lock */ 216 /* status must be updated while holding port lock */
197 upstat_t status; 217 upstat_t status;
198 218
@@ -214,6 +234,7 @@ struct uart_port {
214 unsigned char unused[2]; 234 unsigned char unused[2];
215 struct attribute_group *attr_group; /* port specific attributes */ 235 struct attribute_group *attr_group; /* port specific attributes */
216 const struct attribute_group **tty_groups; /* all attributes (serial core use only) */ 236 const struct attribute_group **tty_groups; /* all attributes (serial core use only) */
237 struct serial_rs485 rs485;
217 void *private_data; /* generic platform data pointer */ 238 void *private_data; /* generic platform data pointer */
218}; 239};
219 240
@@ -367,7 +388,7 @@ static inline int uart_tx_stopped(struct uart_port *port)
367 388
368static inline bool uart_cts_enabled(struct uart_port *uport) 389static inline bool uart_cts_enabled(struct uart_port *uport)
369{ 390{
370 return uport->status & UPSTAT_CTS_ENABLE; 391 return !!(uport->status & UPSTAT_CTS_ENABLE);
371} 392}
372 393
373/* 394/*
diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
index 68c097077ef0..f4aee75f00b1 100644
--- a/include/linux/shrinker.h
+++ b/include/linux/shrinker.h
@@ -18,8 +18,6 @@ struct shrink_control {
18 */ 18 */
19 unsigned long nr_to_scan; 19 unsigned long nr_to_scan;
20 20
21 /* shrink from these nodes */
22 nodemask_t nodes_to_scan;
23 /* current node being shrunk (for NUMA aware shrinkers) */ 21 /* current node being shrunk (for NUMA aware shrinkers) */
24 int nid; 22 int nid;
25}; 23};
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 6c8b6f604e76..85ab7d72b54c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -20,6 +20,8 @@
20#include <linux/time.h> 20#include <linux/time.h>
21#include <linux/bug.h> 21#include <linux/bug.h>
22#include <linux/cache.h> 22#include <linux/cache.h>
23#include <linux/rbtree.h>
24#include <linux/socket.h>
23 25
24#include <linux/atomic.h> 26#include <linux/atomic.h>
25#include <asm/types.h> 27#include <asm/types.h>
@@ -148,6 +150,8 @@
148struct net_device; 150struct net_device;
149struct scatterlist; 151struct scatterlist;
150struct pipe_inode_info; 152struct pipe_inode_info;
153struct iov_iter;
154struct napi_struct;
151 155
152#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 156#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
153struct nf_conntrack { 157struct nf_conntrack {
@@ -341,7 +345,6 @@ enum {
341 SKB_FCLONE_UNAVAILABLE, /* skb has no fclone (from head_cache) */ 345 SKB_FCLONE_UNAVAILABLE, /* skb has no fclone (from head_cache) */
342 SKB_FCLONE_ORIG, /* orig skb (from fclone_cache) */ 346 SKB_FCLONE_ORIG, /* orig skb (from fclone_cache) */
343 SKB_FCLONE_CLONE, /* companion fclone skb (from fclone_cache) */ 347 SKB_FCLONE_CLONE, /* companion fclone skb (from fclone_cache) */
344 SKB_FCLONE_FREE, /* this companion fclone skb is available */
345}; 348};
346 349
347enum { 350enum {
@@ -370,8 +373,7 @@ enum {
370 373
371 SKB_GSO_UDP_TUNNEL_CSUM = 1 << 11, 374 SKB_GSO_UDP_TUNNEL_CSUM = 1 << 11,
372 375
373 SKB_GSO_MPLS = 1 << 12, 376 SKB_GSO_TUNNEL_REMCSUM = 1 << 12,
374
375}; 377};
376 378
377#if BITS_PER_LONG > 32 379#if BITS_PER_LONG > 32
@@ -440,6 +442,7 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
440 * @next: Next buffer in list 442 * @next: Next buffer in list
441 * @prev: Previous buffer in list 443 * @prev: Previous buffer in list
442 * @tstamp: Time we arrived/left 444 * @tstamp: Time we arrived/left
445 * @rbnode: RB tree node, alternative to next/prev for netem/tcp
443 * @sk: Socket we are owned by 446 * @sk: Socket we are owned by
444 * @dev: Device we arrived on/are leaving by 447 * @dev: Device we arrived on/are leaving by
445 * @cb: Control buffer. Free for use by every layer. Put private vars here 448 * @cb: Control buffer. Free for use by every layer. Put private vars here
@@ -504,15 +507,19 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
504 */ 507 */
505 508
506struct sk_buff { 509struct sk_buff {
507 /* These two members must be first. */
508 struct sk_buff *next;
509 struct sk_buff *prev;
510
511 union { 510 union {
512 ktime_t tstamp; 511 struct {
513 struct skb_mstamp skb_mstamp; 512 /* These two members must be first. */
513 struct sk_buff *next;
514 struct sk_buff *prev;
515
516 union {
517 ktime_t tstamp;
518 struct skb_mstamp skb_mstamp;
519 };
520 };
521 struct rb_node rbnode; /* used in netem & tcp stack */
514 }; 522 };
515
516 struct sock *sk; 523 struct sock *sk;
517 struct net_device *dev; 524 struct net_device *dev;
518 525
@@ -597,7 +604,8 @@ struct sk_buff {
597#endif 604#endif
598 __u8 ipvs_property:1; 605 __u8 ipvs_property:1;
599 __u8 inner_protocol_type:1; 606 __u8 inner_protocol_type:1;
600 /* 4 or 6 bit hole */ 607 __u8 remcsum_offload:1;
608 /* 3 or 5 bit hole */
601 609
602#ifdef CONFIG_NET_SCHED 610#ifdef CONFIG_NET_SCHED
603 __u16 tc_index; /* traffic control index */ 611 __u16 tc_index; /* traffic control index */
@@ -666,6 +674,7 @@ struct sk_buff {
666 674
667#define SKB_ALLOC_FCLONE 0x01 675#define SKB_ALLOC_FCLONE 0x01
668#define SKB_ALLOC_RX 0x02 676#define SKB_ALLOC_RX 0x02
677#define SKB_ALLOC_NAPI 0x04
669 678
670/* Returns true if the skb was allocated from PFMEMALLOC reserves */ 679/* Returns true if the skb was allocated from PFMEMALLOC reserves */
671static inline bool skb_pfmemalloc(const struct sk_buff *skb) 680static inline bool skb_pfmemalloc(const struct sk_buff *skb)
@@ -710,9 +719,6 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
710 skb->_skb_refdst = (unsigned long)dst; 719 skb->_skb_refdst = (unsigned long)dst;
711} 720}
712 721
713void __skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst,
714 bool force);
715
716/** 722/**
717 * skb_dst_set_noref - sets skb dst, hopefully, without taking reference 723 * skb_dst_set_noref - sets skb dst, hopefully, without taking reference
718 * @skb: buffer 724 * @skb: buffer
@@ -725,24 +731,8 @@ void __skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst,
725 */ 731 */
726static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst) 732static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst)
727{ 733{
728 __skb_dst_set_noref(skb, dst, false); 734 WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
729} 735 skb->_skb_refdst = (unsigned long)dst | SKB_DST_NOREF;
730
731/**
732 * skb_dst_set_noref_force - sets skb dst, without taking reference
733 * @skb: buffer
734 * @dst: dst entry
735 *
736 * Sets skb dst, assuming a reference was not taken on dst.
737 * No reference is taken and no dst_release will be called. While for
738 * cached dsts deferred reclaim is a basic feature, for entries that are
739 * not cached it is caller's job to guarantee that last dst_release for
740 * provided dst happens when nobody uses it, eg. after a RCU grace period.
741 */
742static inline void skb_dst_set_noref_force(struct sk_buff *skb,
743 struct dst_entry *dst)
744{
745 __skb_dst_set_noref(skb, dst, true);
746} 736}
747 737
748/** 738/**
@@ -810,7 +800,7 @@ static inline bool skb_fclone_busy(const struct sock *sk,
810 fclones = container_of(skb, struct sk_buff_fclones, skb1); 800 fclones = container_of(skb, struct sk_buff_fclones, skb1);
811 801
812 return skb->fclone == SKB_FCLONE_ORIG && 802 return skb->fclone == SKB_FCLONE_ORIG &&
813 fclones->skb2.fclone == SKB_FCLONE_CLONE && 803 atomic_read(&fclones->fclone_ref) > 1 &&
814 fclones->skb2.sk == sk; 804 fclones->skb2.sk == sk;
815} 805}
816 806
@@ -2176,47 +2166,61 @@ static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
2176 return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC); 2166 return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC);
2177} 2167}
2178 2168
2169void *napi_alloc_frag(unsigned int fragsz);
2170struct sk_buff *__napi_alloc_skb(struct napi_struct *napi,
2171 unsigned int length, gfp_t gfp_mask);
2172static inline struct sk_buff *napi_alloc_skb(struct napi_struct *napi,
2173 unsigned int length)
2174{
2175 return __napi_alloc_skb(napi, length, GFP_ATOMIC);
2176}
2177
2179/** 2178/**
2180 * __skb_alloc_pages - allocate pages for ps-rx on a skb and preserve pfmemalloc data 2179 * __dev_alloc_pages - allocate page for network Rx
2181 * @gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for network packet RX 2180 * @gfp_mask: allocation priority. Set __GFP_NOMEMALLOC if not for network Rx
2182 * @skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used 2181 * @order: size of the allocation
2183 * @order: size of the allocation
2184 * 2182 *
2185 * Allocate a new page. 2183 * Allocate a new page.
2186 * 2184 *
2187 * %NULL is returned if there is no free memory. 2185 * %NULL is returned if there is no free memory.
2188*/ 2186*/
2189static inline struct page *__skb_alloc_pages(gfp_t gfp_mask, 2187static inline struct page *__dev_alloc_pages(gfp_t gfp_mask,
2190 struct sk_buff *skb, 2188 unsigned int order)
2191 unsigned int order) 2189{
2192{ 2190 /* This piece of code contains several assumptions.
2193 struct page *page; 2191 * 1. This is for device Rx, therefor a cold page is preferred.
2194 2192 * 2. The expectation is the user wants a compound page.
2195 gfp_mask |= __GFP_COLD; 2193 * 3. If requesting a order 0 page it will not be compound
2196 2194 * due to the check to see if order has a value in prep_new_page
2197 if (!(gfp_mask & __GFP_NOMEMALLOC)) 2195 * 4. __GFP_MEMALLOC is ignored if __GFP_NOMEMALLOC is set due to
2198 gfp_mask |= __GFP_MEMALLOC; 2196 * code in gfp_to_alloc_flags that should be enforcing this.
2197 */
2198 gfp_mask |= __GFP_COLD | __GFP_COMP | __GFP_MEMALLOC;
2199 2199
2200 page = alloc_pages_node(NUMA_NO_NODE, gfp_mask, order); 2200 return alloc_pages_node(NUMA_NO_NODE, gfp_mask, order);
2201 if (skb && page && page->pfmemalloc) 2201}
2202 skb->pfmemalloc = true;
2203 2202
2204 return page; 2203static inline struct page *dev_alloc_pages(unsigned int order)
2204{
2205 return __dev_alloc_pages(GFP_ATOMIC, order);
2205} 2206}
2206 2207
2207/** 2208/**
2208 * __skb_alloc_page - allocate a page for ps-rx for a given skb and preserve pfmemalloc data 2209 * __dev_alloc_page - allocate a page for network Rx
2209 * @gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for network packet RX 2210 * @gfp_mask: allocation priority. Set __GFP_NOMEMALLOC if not for network Rx
2210 * @skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used
2211 * 2211 *
2212 * Allocate a new page. 2212 * Allocate a new page.
2213 * 2213 *
2214 * %NULL is returned if there is no free memory. 2214 * %NULL is returned if there is no free memory.
2215 */ 2215 */
2216static inline struct page *__skb_alloc_page(gfp_t gfp_mask, 2216static inline struct page *__dev_alloc_page(gfp_t gfp_mask)
2217 struct sk_buff *skb) 2217{
2218 return __dev_alloc_pages(gfp_mask, 0);
2219}
2220
2221static inline struct page *dev_alloc_page(void)
2218{ 2222{
2219 return __skb_alloc_pages(gfp_mask, skb, 0); 2223 return __dev_alloc_page(GFP_ATOMIC);
2220} 2224}
2221 2225
2222/** 2226/**
@@ -2448,7 +2452,6 @@ static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom)
2448 * is untouched. Otherwise it is extended. Returns zero on 2452 * is untouched. Otherwise it is extended. Returns zero on
2449 * success. The skb is freed on error. 2453 * success. The skb is freed on error.
2450 */ 2454 */
2451
2452static inline int skb_padto(struct sk_buff *skb, unsigned int len) 2455static inline int skb_padto(struct sk_buff *skb, unsigned int len)
2453{ 2456{
2454 unsigned int size = skb->len; 2457 unsigned int size = skb->len;
@@ -2457,6 +2460,29 @@ static inline int skb_padto(struct sk_buff *skb, unsigned int len)
2457 return skb_pad(skb, len - size); 2460 return skb_pad(skb, len - size);
2458} 2461}
2459 2462
2463/**
2464 * skb_put_padto - increase size and pad an skbuff up to a minimal size
2465 * @skb: buffer to pad
2466 * @len: minimal length
2467 *
2468 * Pads up a buffer to ensure the trailing bytes exist and are
2469 * blanked. If the buffer already contains sufficient data it
2470 * is untouched. Otherwise it is extended. Returns zero on
2471 * success. The skb is freed on error.
2472 */
2473static inline int skb_put_padto(struct sk_buff *skb, unsigned int len)
2474{
2475 unsigned int size = skb->len;
2476
2477 if (unlikely(size < len)) {
2478 len -= size;
2479 if (skb_pad(skb, len))
2480 return -ENOMEM;
2481 __skb_put(skb, len);
2482 }
2483 return 0;
2484}
2485
2460static inline int skb_add_data(struct sk_buff *skb, 2486static inline int skb_add_data(struct sk_buff *skb,
2461 char __user *from, int copy) 2487 char __user *from, int copy)
2462{ 2488{
@@ -2629,18 +2655,18 @@ struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock,
2629 int *err); 2655 int *err);
2630unsigned int datagram_poll(struct file *file, struct socket *sock, 2656unsigned int datagram_poll(struct file *file, struct socket *sock,
2631 struct poll_table_struct *wait); 2657 struct poll_table_struct *wait);
2632int skb_copy_datagram_iovec(const struct sk_buff *from, int offset, 2658int skb_copy_datagram_iter(const struct sk_buff *from, int offset,
2633 struct iovec *to, int size); 2659 struct iov_iter *to, int size);
2634int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, int hlen, 2660static inline int skb_copy_datagram_msg(const struct sk_buff *from, int offset,
2635 struct iovec *iov); 2661 struct msghdr *msg, int size)
2636int skb_copy_datagram_from_iovec(struct sk_buff *skb, int offset, 2662{
2637 const struct iovec *from, int from_offset, 2663 return skb_copy_datagram_iter(from, offset, &msg->msg_iter, size);
2638 int len); 2664}
2639int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *frm, 2665int skb_copy_and_csum_datagram_msg(struct sk_buff *skb, int hlen,
2640 int offset, size_t count); 2666 struct msghdr *msg);
2641int skb_copy_datagram_const_iovec(const struct sk_buff *from, int offset, 2667int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset,
2642 const struct iovec *to, int to_offset, 2668 struct iov_iter *from, int len);
2643 int size); 2669int zerocopy_sg_from_iter(struct sk_buff *skb, struct iov_iter *frm);
2644void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 2670void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
2645void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb); 2671void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb);
2646int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags); 2672int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags);
@@ -2661,6 +2687,20 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2661unsigned int skb_gso_transport_seglen(const struct sk_buff *skb); 2687unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
2662struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features); 2688struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
2663struct sk_buff *skb_vlan_untag(struct sk_buff *skb); 2689struct sk_buff *skb_vlan_untag(struct sk_buff *skb);
2690int skb_ensure_writable(struct sk_buff *skb, int write_len);
2691int skb_vlan_pop(struct sk_buff *skb);
2692int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);
2693
2694static inline int memcpy_from_msg(void *data, struct msghdr *msg, int len)
2695{
2696 /* XXX: stripping const */
2697 return memcpy_fromiovec(data, (struct iovec *)msg->msg_iter.iov, len);
2698}
2699
2700static inline int memcpy_to_msg(struct msghdr *msg, void *data, int len)
2701{
2702 return copy_to_iter(data, len, &msg->msg_iter) == len ? 0 : -EFAULT;
2703}
2664 2704
2665struct skb_checksum_ops { 2705struct skb_checksum_ops {
2666 __wsum (*update)(const void *mem, int len, __wsum wsum); 2706 __wsum (*update)(const void *mem, int len, __wsum wsum);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index c265bec6a57d..9a139b637069 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -493,7 +493,6 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
493 * @memcg: pointer to the memcg this cache belongs to 493 * @memcg: pointer to the memcg this cache belongs to
494 * @list: list_head for the list of all caches in this memcg 494 * @list: list_head for the list of all caches in this memcg
495 * @root_cache: pointer to the global, root cache, this cache was derived from 495 * @root_cache: pointer to the global, root cache, this cache was derived from
496 * @nr_pages: number of pages that belongs to this cache.
497 */ 496 */
498struct memcg_cache_params { 497struct memcg_cache_params {
499 bool is_root_cache; 498 bool is_root_cache;
@@ -506,17 +505,12 @@ struct memcg_cache_params {
506 struct mem_cgroup *memcg; 505 struct mem_cgroup *memcg;
507 struct list_head list; 506 struct list_head list;
508 struct kmem_cache *root_cache; 507 struct kmem_cache *root_cache;
509 atomic_t nr_pages;
510 }; 508 };
511 }; 509 };
512}; 510};
513 511
514int memcg_update_all_caches(int num_memcgs); 512int memcg_update_all_caches(int num_memcgs);
515 513
516struct seq_file;
517int cache_show(struct kmem_cache *s, struct seq_file *m);
518void print_slabinfo_header(struct seq_file *m);
519
520/** 514/**
521 * kmalloc_array - allocate memory for an array. 515 * kmalloc_array - allocate memory for an array.
522 * @n: number of elements. 516 * @n: number of elements.
diff --git a/include/linux/socket.h b/include/linux/socket.h
index bb9b83640070..6e49a14365dc 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -47,16 +47,25 @@ struct linger {
47struct msghdr { 47struct msghdr {
48 void *msg_name; /* ptr to socket address structure */ 48 void *msg_name; /* ptr to socket address structure */
49 int msg_namelen; /* size of socket address structure */ 49 int msg_namelen; /* size of socket address structure */
50 struct iovec *msg_iov; /* scatter/gather array */ 50 struct iov_iter msg_iter; /* data */
51 __kernel_size_t msg_iovlen; /* # elements in msg_iov */
52 void *msg_control; /* ancillary data */ 51 void *msg_control; /* ancillary data */
53 __kernel_size_t msg_controllen; /* ancillary data buffer length */ 52 __kernel_size_t msg_controllen; /* ancillary data buffer length */
54 unsigned int msg_flags; /* flags on received message */ 53 unsigned int msg_flags; /* flags on received message */
55}; 54};
55
56struct user_msghdr {
57 void __user *msg_name; /* ptr to socket address structure */
58 int msg_namelen; /* size of socket address structure */
59 struct iovec __user *msg_iov; /* scatter/gather array */
60 __kernel_size_t msg_iovlen; /* # elements in msg_iov */
61 void __user *msg_control; /* ancillary data */
62 __kernel_size_t msg_controllen; /* ancillary data buffer length */
63 unsigned int msg_flags; /* flags on received message */
64};
56 65
57/* For recvmmsg/sendmmsg */ 66/* For recvmmsg/sendmmsg */
58struct mmsghdr { 67struct mmsghdr {
59 struct msghdr msg_hdr; 68 struct user_msghdr msg_hdr;
60 unsigned int msg_len; 69 unsigned int msg_len;
61}; 70};
62 71
@@ -94,6 +103,10 @@ struct cmsghdr {
94 (cmsg)->cmsg_len <= (unsigned long) \ 103 (cmsg)->cmsg_len <= (unsigned long) \
95 ((mhdr)->msg_controllen - \ 104 ((mhdr)->msg_controllen - \
96 ((char *)(cmsg) - (char *)(mhdr)->msg_control))) 105 ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
106#define for_each_cmsghdr(cmsg, msg) \
107 for (cmsg = CMSG_FIRSTHDR(msg); \
108 cmsg; \
109 cmsg = CMSG_NXTHDR(msg, cmsg))
97 110
98/* 111/*
99 * Get the next cmsg header 112 * Get the next cmsg header
@@ -312,15 +325,14 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
312extern unsigned long iov_pages(const struct iovec *iov, int offset, 325extern unsigned long iov_pages(const struct iovec *iov, int offset,
313 unsigned long nr_segs); 326 unsigned long nr_segs);
314 327
315extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode);
316extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr); 328extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr);
317extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); 329extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
318 330
319struct timespec; 331struct timespec;
320 332
321/* The __sys_...msg variants allow MSG_CMSG_COMPAT */ 333/* The __sys_...msg variants allow MSG_CMSG_COMPAT */
322extern long __sys_recvmsg(int fd, struct msghdr __user *msg, unsigned flags); 334extern long __sys_recvmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
323extern long __sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags); 335extern long __sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
324extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, 336extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
325 unsigned int flags, struct timespec *timeout); 337 unsigned int flags, struct timespec *timeout);
326extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, 338extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg,
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 46d188a9947c..a6ef2a8e6de4 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -1049,4 +1049,10 @@ spi_unregister_device(struct spi_device *spi)
1049extern const struct spi_device_id * 1049extern const struct spi_device_id *
1050spi_get_device_id(const struct spi_device *sdev); 1050spi_get_device_id(const struct spi_device *sdev);
1051 1051
1052static inline bool
1053spi_transfer_is_last(struct spi_master *master, struct spi_transfer *xfer)
1054{
1055 return list_is_last(&xfer->transfer_list, &master->cur_msg->transfers);
1056}
1057
1052#endif /* __LINUX_SPI_H */ 1058#endif /* __LINUX_SPI_H */
diff --git a/include/linux/spmi.h b/include/linux/spmi.h
index 91f5eab9e428..f84212cd3b7d 100644
--- a/include/linux/spmi.h
+++ b/include/linux/spmi.h
@@ -134,9 +134,6 @@ void spmi_controller_remove(struct spmi_controller *ctrl);
134 * this structure. 134 * this structure.
135 * @probe: binds this driver to a SPMI device. 135 * @probe: binds this driver to a SPMI device.
136 * @remove: unbinds this driver from the SPMI device. 136 * @remove: unbinds this driver from the SPMI device.
137 * @shutdown: standard shutdown callback used during powerdown/halt.
138 * @suspend: standard suspend callback used during system suspend.
139 * @resume: standard resume callback used during system resume.
140 * 137 *
141 * If PM runtime support is desired for a slave, a device driver can call 138 * If PM runtime support is desired for a slave, a device driver can call
142 * pm_runtime_put() from their probe() routine (and a balancing 139 * pm_runtime_put() from their probe() routine (and a balancing
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 115b570e3bff..669045ab73f3 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_STACKTRACE_H 1#ifndef __LINUX_STACKTRACE_H
2#define __LINUX_STACKTRACE_H 2#define __LINUX_STACKTRACE_H
3 3
4#include <linux/types.h>
5
4struct task_struct; 6struct task_struct;
5struct pt_regs; 7struct pt_regs;
6 8
@@ -20,6 +22,8 @@ extern void save_stack_trace_tsk(struct task_struct *tsk,
20 struct stack_trace *trace); 22 struct stack_trace *trace);
21 23
22extern void print_stack_trace(struct stack_trace *trace, int spaces); 24extern void print_stack_trace(struct stack_trace *trace, int spaces);
25extern int snprint_stack_trace(char *buf, size_t size,
26 struct stack_trace *trace, int spaces);
23 27
24#ifdef CONFIG_USER_STACKTRACE_SUPPORT 28#ifdef CONFIG_USER_STACKTRACE_SUPPORT
25extern void save_stack_trace_user(struct stack_trace *trace); 29extern void save_stack_trace_user(struct stack_trace *trace);
@@ -32,6 +36,7 @@ extern void save_stack_trace_user(struct stack_trace *trace);
32# define save_stack_trace_tsk(tsk, trace) do { } while (0) 36# define save_stack_trace_tsk(tsk, trace) do { } while (0)
33# define save_stack_trace_user(trace) do { } while (0) 37# define save_stack_trace_user(trace) do { } while (0)
34# define print_stack_trace(trace, spaces) do { } while (0) 38# define print_stack_trace(trace, spaces) do { } while (0)
39# define snprint_stack_trace(buf, size, trace, spaces) do { } while (0)
35#endif 40#endif
36 41
37#endif 42#endif
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 8e030075fe79..a7cbb570cc5c 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -53,7 +53,7 @@ struct rpc_cred {
53 struct rcu_head cr_rcu; 53 struct rcu_head cr_rcu;
54 struct rpc_auth * cr_auth; 54 struct rpc_auth * cr_auth;
55 const struct rpc_credops *cr_ops; 55 const struct rpc_credops *cr_ops;
56#ifdef RPC_DEBUG 56#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
57 unsigned long cr_magic; /* 0x0f4aa4f0 */ 57 unsigned long cr_magic; /* 0x0f4aa4f0 */
58#endif 58#endif
59 unsigned long cr_expire; /* when to gc */ 59 unsigned long cr_expire; /* when to gc */
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 70736b98c721..d86acc63b25f 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -63,6 +63,9 @@ struct rpc_clnt {
63 struct rpc_rtt cl_rtt_default; 63 struct rpc_rtt cl_rtt_default;
64 struct rpc_timeout cl_timeout_default; 64 struct rpc_timeout cl_timeout_default;
65 const struct rpc_program *cl_program; 65 const struct rpc_program *cl_program;
66#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
67 struct dentry *cl_debugfs; /* debugfs directory */
68#endif
66}; 69};
67 70
68/* 71/*
@@ -176,5 +179,6 @@ size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
176const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); 179const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
177int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t); 180int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t);
178 181
182const char *rpc_proc_name(const struct rpc_task *task);
179#endif /* __KERNEL__ */ 183#endif /* __KERNEL__ */
180#endif /* _LINUX_SUNRPC_CLNT_H */ 184#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index 9385bd74c860..c57d8ea0716c 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -10,22 +10,10 @@
10 10
11#include <uapi/linux/sunrpc/debug.h> 11#include <uapi/linux/sunrpc/debug.h>
12 12
13
14/*
15 * Enable RPC debugging/profiling.
16 */
17#ifdef CONFIG_SUNRPC_DEBUG
18#define RPC_DEBUG
19#endif
20#ifdef CONFIG_TRACEPOINTS
21#define RPC_TRACEPOINTS
22#endif
23/* #define RPC_PROFILE */
24
25/* 13/*
26 * Debugging macros etc 14 * Debugging macros etc
27 */ 15 */
28#ifdef RPC_DEBUG 16#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
29extern unsigned int rpc_debug; 17extern unsigned int rpc_debug;
30extern unsigned int nfs_debug; 18extern unsigned int nfs_debug;
31extern unsigned int nfsd_debug; 19extern unsigned int nfsd_debug;
@@ -36,7 +24,7 @@ extern unsigned int nlm_debug;
36#define dprintk_rcu(args...) dfprintk_rcu(FACILITY, ## args) 24#define dprintk_rcu(args...) dfprintk_rcu(FACILITY, ## args)
37 25
38#undef ifdebug 26#undef ifdebug
39#ifdef RPC_DEBUG 27#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
40# define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac)) 28# define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac))
41 29
42# define dfprintk(fac, args...) \ 30# define dfprintk(fac, args...) \
@@ -65,9 +53,55 @@ extern unsigned int nlm_debug;
65/* 53/*
66 * Sysctl interface for RPC debugging 54 * Sysctl interface for RPC debugging
67 */ 55 */
68#ifdef RPC_DEBUG 56
57struct rpc_clnt;
58struct rpc_xprt;
59
60#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
69void rpc_register_sysctl(void); 61void rpc_register_sysctl(void);
70void rpc_unregister_sysctl(void); 62void rpc_unregister_sysctl(void);
63int sunrpc_debugfs_init(void);
64void sunrpc_debugfs_exit(void);
65int rpc_clnt_debugfs_register(struct rpc_clnt *);
66void rpc_clnt_debugfs_unregister(struct rpc_clnt *);
67int rpc_xprt_debugfs_register(struct rpc_xprt *);
68void rpc_xprt_debugfs_unregister(struct rpc_xprt *);
69#else
70static inline int
71sunrpc_debugfs_init(void)
72{
73 return 0;
74}
75
76static inline void
77sunrpc_debugfs_exit(void)
78{
79 return;
80}
81
82static inline int
83rpc_clnt_debugfs_register(struct rpc_clnt *clnt)
84{
85 return 0;
86}
87
88static inline void
89rpc_clnt_debugfs_unregister(struct rpc_clnt *clnt)
90{
91 return;
92}
93
94static inline int
95rpc_xprt_debugfs_register(struct rpc_xprt *xprt)
96{
97 return 0;
98}
99
100static inline void
101rpc_xprt_debugfs_unregister(struct rpc_xprt *xprt)
102{
103 return;
104}
71#endif 105#endif
72 106
73#endif /* _LINUX_SUNRPC_DEBUG_H_ */ 107#endif /* _LINUX_SUNRPC_DEBUG_H_ */
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index 1565bbe86d51..eecb5a71e6c0 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -27,10 +27,13 @@
27 27
28#include <linux/seq_file.h> 28#include <linux/seq_file.h>
29#include <linux/ktime.h> 29#include <linux/ktime.h>
30#include <linux/spinlock.h>
30 31
31#define RPC_IOSTATS_VERS "1.0" 32#define RPC_IOSTATS_VERS "1.0"
32 33
33struct rpc_iostats { 34struct rpc_iostats {
35 spinlock_t om_lock;
36
34 /* 37 /*
35 * These counters give an idea about how many request 38 * These counters give an idea about how many request
36 * transmissions are required, on average, to complete that 39 * transmissions are required, on average, to complete that
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 1a8959944c5f..5f1e6bd4c316 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -79,7 +79,7 @@ struct rpc_task {
79 unsigned short tk_flags; /* misc flags */ 79 unsigned short tk_flags; /* misc flags */
80 unsigned short tk_timeouts; /* maj timeouts */ 80 unsigned short tk_timeouts; /* maj timeouts */
81 81
82#if defined(RPC_DEBUG) || defined(RPC_TRACEPOINTS) 82#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS)
83 unsigned short tk_pid; /* debugging aid */ 83 unsigned short tk_pid; /* debugging aid */
84#endif 84#endif
85 unsigned char tk_priority : 2,/* Task priority */ 85 unsigned char tk_priority : 2,/* Task priority */
@@ -187,7 +187,7 @@ struct rpc_wait_queue {
187 unsigned char nr; /* # tasks remaining for cookie */ 187 unsigned char nr; /* # tasks remaining for cookie */
188 unsigned short qlen; /* total # tasks waiting in queue */ 188 unsigned short qlen; /* total # tasks waiting in queue */
189 struct rpc_timer timer_list; 189 struct rpc_timer timer_list;
190#if defined(RPC_DEBUG) || defined(RPC_TRACEPOINTS) 190#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS)
191 const char * name; 191 const char * name;
192#endif 192#endif
193}; 193};
@@ -237,7 +237,7 @@ void 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, wait_bit_action_f *); 239int __rpc_wait_for_completion_task(struct rpc_task *task, wait_bit_action_f *);
240#ifdef RPC_DEBUG 240#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
241struct net; 241struct net;
242void rpc_show_tasks(struct net *); 242void rpc_show_tasks(struct net *);
243#endif 243#endif
@@ -251,7 +251,7 @@ static inline int rpc_wait_for_completion_task(struct rpc_task *task)
251 return __rpc_wait_for_completion_task(task, NULL); 251 return __rpc_wait_for_completion_task(task, NULL);
252} 252}
253 253
254#if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS) 254#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS)
255static inline const char * rpc_qname(const struct rpc_wait_queue *q) 255static inline const char * rpc_qname(const struct rpc_wait_queue *q)
256{ 256{
257 return ((q && q->name) ? q->name : "unknown"); 257 return ((q && q->name) ? q->name : "unknown");
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index cf391eef2e6d..9d27ac45b909 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -239,6 +239,9 @@ struct rpc_xprt {
239 struct net *xprt_net; 239 struct net *xprt_net;
240 const char *servername; 240 const char *servername;
241 const char *address_strings[RPC_DISPLAY_MAX]; 241 const char *address_strings[RPC_DISPLAY_MAX];
242#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
243 struct dentry *debugfs; /* debugfs directory */
244#endif
242}; 245};
243 246
244#if defined(CONFIG_SUNRPC_BACKCHANNEL) 247#if defined(CONFIG_SUNRPC_BACKCHANNEL)
diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h
index 1ad36cc25b2e..7591788e9fbf 100644
--- a/include/linux/sunrpc/xprtsock.h
+++ b/include/linux/sunrpc/xprtsock.h
@@ -17,6 +17,65 @@ void cleanup_socket_xprt(void);
17#define RPC_DEF_MIN_RESVPORT (665U) 17#define RPC_DEF_MIN_RESVPORT (665U)
18#define RPC_DEF_MAX_RESVPORT (1023U) 18#define RPC_DEF_MAX_RESVPORT (1023U)
19 19
20struct sock_xprt {
21 struct rpc_xprt xprt;
22
23 /*
24 * Network layer
25 */
26 struct socket * sock;
27 struct sock * inet;
28
29 /*
30 * State of TCP reply receive
31 */
32 __be32 tcp_fraghdr,
33 tcp_xid,
34 tcp_calldir;
35
36 u32 tcp_offset,
37 tcp_reclen;
38
39 unsigned long tcp_copied,
40 tcp_flags;
41
42 /*
43 * Connection of transports
44 */
45 struct delayed_work connect_worker;
46 struct sockaddr_storage srcaddr;
47 unsigned short srcport;
48
49 /*
50 * UDP socket buffer size parameters
51 */
52 size_t rcvsize,
53 sndsize;
54
55 /*
56 * Saved socket callback addresses
57 */
58 void (*old_data_ready)(struct sock *);
59 void (*old_state_change)(struct sock *);
60 void (*old_write_space)(struct sock *);
61 void (*old_error_report)(struct sock *);
62};
63
64/*
65 * TCP receive state flags
66 */
67#define TCP_RCV_LAST_FRAG (1UL << 0)
68#define TCP_RCV_COPY_FRAGHDR (1UL << 1)
69#define TCP_RCV_COPY_XID (1UL << 2)
70#define TCP_RCV_COPY_DATA (1UL << 3)
71#define TCP_RCV_READ_CALLDIR (1UL << 4)
72#define TCP_RCV_COPY_CALLDIR (1UL << 5)
73
74/*
75 * TCP RPC flags
76 */
77#define TCP_RPC_REPLY (1UL << 6)
78
20#endif /* __KERNEL__ */ 79#endif /* __KERNEL__ */
21 80
22#endif /* _LINUX_SUNRPC_XPRTSOCK_H */ 81#endif /* _LINUX_SUNRPC_XPRTSOCK_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 37a585beef5c..34e8b60ab973 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -102,14 +102,6 @@ union swap_header {
102 } info; 102 } info;
103}; 103};
104 104
105 /* A swap entry has to fit into a "unsigned long", as
106 * the entry is hidden in the "index" field of the
107 * swapper address space.
108 */
109typedef struct {
110 unsigned long val;
111} swp_entry_t;
112
113/* 105/*
114 * current->reclaim_state points to one of these when a task is running 106 * current->reclaim_state points to one of these when a task is running
115 * memory reclaim 107 * memory reclaim
diff --git a/include/linux/swap_cgroup.h b/include/linux/swap_cgroup.h
new file mode 100644
index 000000000000..145306bdc92f
--- /dev/null
+++ b/include/linux/swap_cgroup.h
@@ -0,0 +1,42 @@
1#ifndef __LINUX_SWAP_CGROUP_H
2#define __LINUX_SWAP_CGROUP_H
3
4#include <linux/swap.h>
5
6#ifdef CONFIG_MEMCG_SWAP
7
8extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
9 unsigned short old, unsigned short new);
10extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id);
11extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent);
12extern int swap_cgroup_swapon(int type, unsigned long max_pages);
13extern void swap_cgroup_swapoff(int type);
14
15#else
16
17static inline
18unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id)
19{
20 return 0;
21}
22
23static inline
24unsigned short lookup_swap_cgroup_id(swp_entry_t ent)
25{
26 return 0;
27}
28
29static inline int
30swap_cgroup_swapon(int type, unsigned long max_pages)
31{
32 return 0;
33}
34
35static inline void swap_cgroup_swapoff(int type)
36{
37 return;
38}
39
40#endif /* CONFIG_MEMCG_SWAP */
41
42#endif /* __LINUX_SWAP_CGROUP_H */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index bda9b81357cc..85893d744901 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -25,7 +25,7 @@ struct linux_dirent64;
25struct list_head; 25struct list_head;
26struct mmap_arg_struct; 26struct mmap_arg_struct;
27struct msgbuf; 27struct msgbuf;
28struct msghdr; 28struct user_msghdr;
29struct mmsghdr; 29struct mmsghdr;
30struct msqid_ds; 30struct msqid_ds;
31struct new_utsname; 31struct new_utsname;
@@ -601,13 +601,13 @@ asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *);
601asmlinkage long sys_send(int, void __user *, size_t, unsigned); 601asmlinkage long sys_send(int, void __user *, size_t, unsigned);
602asmlinkage long sys_sendto(int, void __user *, size_t, unsigned, 602asmlinkage long sys_sendto(int, void __user *, size_t, unsigned,
603 struct sockaddr __user *, int); 603 struct sockaddr __user *, int);
604asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags); 604asmlinkage long sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
605asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg, 605asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg,
606 unsigned int vlen, unsigned flags); 606 unsigned int vlen, unsigned flags);
607asmlinkage long sys_recv(int, void __user *, size_t, unsigned); 607asmlinkage long sys_recv(int, void __user *, size_t, unsigned);
608asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned, 608asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned,
609 struct sockaddr __user *, int __user *); 609 struct sockaddr __user *, int __user *);
610asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned flags); 610asmlinkage long sys_recvmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
611asmlinkage long sys_recvmmsg(int fd, struct mmsghdr __user *msg, 611asmlinkage long sys_recvmmsg(int fd, struct mmsghdr __user *msg,
612 unsigned int vlen, unsigned flags, 612 unsigned int vlen, unsigned flags,
613 struct timespec __user *timeout); 613 struct timespec __user *timeout);
@@ -877,4 +877,9 @@ asmlinkage long sys_seccomp(unsigned int op, unsigned int flags,
877asmlinkage long sys_getrandom(char __user *buf, size_t count, 877asmlinkage long sys_getrandom(char __user *buf, size_t count,
878 unsigned int flags); 878 unsigned int flags);
879asmlinkage long sys_bpf(int cmd, union bpf_attr *attr, unsigned int size); 879asmlinkage long sys_bpf(int cmd, union bpf_attr *attr, unsigned int size);
880
881asmlinkage long sys_execveat(int dfd, const char __user *filename,
882 const char __user *const __user *argv,
883 const char __user *const __user *envp, int flags);
884
880#endif 885#endif
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index f97d0dbb59fa..ddad16148bd6 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -70,6 +70,8 @@ struct attribute_group {
70 * for examples.. 70 * for examples..
71 */ 71 */
72 72
73#define SYSFS_PREALLOC 010000
74
73#define __ATTR(_name, _mode, _show, _store) { \ 75#define __ATTR(_name, _mode, _show, _store) { \
74 .attr = {.name = __stringify(_name), \ 76 .attr = {.name = __stringify(_name), \
75 .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \ 77 .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
@@ -77,6 +79,13 @@ struct attribute_group {
77 .store = _store, \ 79 .store = _store, \
78} 80}
79 81
82#define __ATTR_PREALLOC(_name, _mode, _show, _store) { \
83 .attr = {.name = __stringify(_name), \
84 .mode = SYSFS_PREALLOC | VERIFY_OCTAL_PERMISSIONS(_mode) },\
85 .show = _show, \
86 .store = _store, \
87}
88
80#define __ATTR_RO(_name) { \ 89#define __ATTR_RO(_name) { \
81 .attr = { .name = __stringify(_name), .mode = S_IRUGO }, \ 90 .attr = { .name = __stringify(_name), .mode = S_IRUGO }, \
82 .show = _name##_show, \ 91 .show = _name##_show, \
diff --git a/include/linux/syslog.h b/include/linux/syslog.h
index 98a3153c0f96..4b7b875a7ce1 100644
--- a/include/linux/syslog.h
+++ b/include/linux/syslog.h
@@ -49,4 +49,13 @@
49 49
50int do_syslog(int type, char __user *buf, int count, bool from_file); 50int do_syslog(int type, char __user *buf, int count, bool from_file);
51 51
52#ifdef CONFIG_PRINTK
53int check_syslog_permissions(int type, bool from_file);
54#else
55static inline int check_syslog_permissions(int type, bool from_file)
56{
57 return 0;
58}
59#endif
60
52#endif /* _LINUX_SYSLOG_H */ 61#endif /* _LINUX_SYSLOG_H */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index c2dee7deefa8..67309ece0772 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -130,7 +130,7 @@ struct tcp_sock {
130 /* inet_connection_sock has to be the first member of tcp_sock */ 130 /* inet_connection_sock has to be the first member of tcp_sock */
131 struct inet_connection_sock inet_conn; 131 struct inet_connection_sock inet_conn;
132 u16 tcp_header_len; /* Bytes of tcp header to send */ 132 u16 tcp_header_len; /* Bytes of tcp header to send */
133 u16 xmit_size_goal_segs; /* Goal for segmenting output packets */ 133 u16 gso_segs; /* Max number of segs per GSO packet */
134 134
135/* 135/*
136 * Header prediction flags 136 * Header prediction flags
@@ -162,7 +162,7 @@ struct tcp_sock {
162 struct { 162 struct {
163 struct sk_buff_head prequeue; 163 struct sk_buff_head prequeue;
164 struct task_struct *task; 164 struct task_struct *task;
165 struct iovec *iov; 165 struct msghdr *msg;
166 int memory; 166 int memory;
167 int len; 167 int len;
168 } ucopy; 168 } ucopy;
@@ -204,10 +204,10 @@ struct tcp_sock {
204 204
205 u16 urg_data; /* Saved octet of OOB data and control flags */ 205 u16 urg_data; /* Saved octet of OOB data and control flags */
206 u8 ecn_flags; /* ECN status bits. */ 206 u8 ecn_flags; /* ECN status bits. */
207 u8 reordering; /* Packet reordering metric. */ 207 u8 keepalive_probes; /* num of allowed keep alive probes */
208 u32 reordering; /* Packet reordering metric. */
208 u32 snd_up; /* Urgent pointer */ 209 u32 snd_up; /* Urgent pointer */
209 210
210 u8 keepalive_probes; /* num of allowed keep alive probes */
211/* 211/*
212 * Options received (usually on last packet, some only on SYN packets). 212 * Options received (usually on last packet, some only on SYN packets).
213 */ 213 */
diff --git a/include/linux/time.h b/include/linux/time.h
index 8c42cf8d2444..203c2ad40d71 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -39,9 +39,20 @@ static inline int timeval_compare(const struct timeval *lhs, const struct timeva
39 return lhs->tv_usec - rhs->tv_usec; 39 return lhs->tv_usec - rhs->tv_usec;
40} 40}
41 41
42extern unsigned long mktime(const unsigned int year, const unsigned int mon, 42extern time64_t mktime64(const unsigned int year, const unsigned int mon,
43 const unsigned int day, const unsigned int hour, 43 const unsigned int day, const unsigned int hour,
44 const unsigned int min, const unsigned int sec); 44 const unsigned int min, const unsigned int sec);
45
46/**
47 * Deprecated. Use mktime64().
48 */
49static inline unsigned long mktime(const unsigned int year,
50 const unsigned int mon, const unsigned int day,
51 const unsigned int hour, const unsigned int min,
52 const unsigned int sec)
53{
54 return mktime64(year, mon, day, hour, min, sec);
55}
45 56
46extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec); 57extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec);
47 58
diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h
index 95640dcd1899..05af9a334893 100644
--- a/include/linux/timekeeper_internal.h
+++ b/include/linux/timekeeper_internal.h
@@ -42,6 +42,7 @@ struct tk_read_base {
42 * struct timekeeper - Structure holding internal timekeeping values. 42 * struct timekeeper - Structure holding internal timekeeping values.
43 * @tkr: The readout base structure 43 * @tkr: The readout base structure
44 * @xtime_sec: Current CLOCK_REALTIME time in seconds 44 * @xtime_sec: Current CLOCK_REALTIME time in seconds
45 * @ktime_sec: Current CLOCK_MONOTONIC time in seconds
45 * @wall_to_monotonic: CLOCK_REALTIME to CLOCK_MONOTONIC offset 46 * @wall_to_monotonic: CLOCK_REALTIME to CLOCK_MONOTONIC offset
46 * @offs_real: Offset clock monotonic -> clock realtime 47 * @offs_real: Offset clock monotonic -> clock realtime
47 * @offs_boot: Offset clock monotonic -> clock boottime 48 * @offs_boot: Offset clock monotonic -> clock boottime
@@ -77,6 +78,7 @@ struct tk_read_base {
77struct timekeeper { 78struct timekeeper {
78 struct tk_read_base tkr; 79 struct tk_read_base tkr;
79 u64 xtime_sec; 80 u64 xtime_sec;
81 unsigned long ktime_sec;
80 struct timespec64 wall_to_monotonic; 82 struct timespec64 wall_to_monotonic;
81 ktime_t offs_real; 83 ktime_t offs_real;
82 ktime_t offs_boot; 84 ktime_t offs_boot;
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 1caa6b04fdc5..9b63d13ba82b 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -10,7 +10,7 @@ extern int timekeeping_suspended;
10 * Get and set timeofday 10 * Get and set timeofday
11 */ 11 */
12extern void do_gettimeofday(struct timeval *tv); 12extern void do_gettimeofday(struct timeval *tv);
13extern int do_settimeofday(const struct timespec *tv); 13extern int do_settimeofday64(const struct timespec64 *ts);
14extern int do_sys_settimeofday(const struct timespec *tv, 14extern int do_sys_settimeofday(const struct timespec *tv,
15 const struct timezone *tz); 15 const struct timezone *tz);
16 16
@@ -25,14 +25,24 @@ struct timespec __current_kernel_time(void);
25/* 25/*
26 * timespec based interfaces 26 * timespec based interfaces
27 */ 27 */
28struct timespec get_monotonic_coarse(void); 28struct timespec64 get_monotonic_coarse64(void);
29extern void getrawmonotonic(struct timespec *ts); 29extern void getrawmonotonic64(struct timespec64 *ts);
30extern void ktime_get_ts64(struct timespec64 *ts); 30extern void ktime_get_ts64(struct timespec64 *ts);
31extern time64_t ktime_get_seconds(void);
32extern time64_t ktime_get_real_seconds(void);
31 33
32extern int __getnstimeofday64(struct timespec64 *tv); 34extern int __getnstimeofday64(struct timespec64 *tv);
33extern void getnstimeofday64(struct timespec64 *tv); 35extern void getnstimeofday64(struct timespec64 *tv);
34 36
35#if BITS_PER_LONG == 64 37#if BITS_PER_LONG == 64
38/**
39 * Deprecated. Use do_settimeofday64().
40 */
41static inline int do_settimeofday(const struct timespec *ts)
42{
43 return do_settimeofday64(ts);
44}
45
36static inline int __getnstimeofday(struct timespec *ts) 46static inline int __getnstimeofday(struct timespec *ts)
37{ 47{
38 return __getnstimeofday64(ts); 48 return __getnstimeofday64(ts);
@@ -53,7 +63,27 @@ static inline void ktime_get_real_ts(struct timespec *ts)
53 getnstimeofday64(ts); 63 getnstimeofday64(ts);
54} 64}
55 65
66static inline void getrawmonotonic(struct timespec *ts)
67{
68 getrawmonotonic64(ts);
69}
70
71static inline struct timespec get_monotonic_coarse(void)
72{
73 return get_monotonic_coarse64();
74}
56#else 75#else
76/**
77 * Deprecated. Use do_settimeofday64().
78 */
79static inline int do_settimeofday(const struct timespec *ts)
80{
81 struct timespec64 ts64;
82
83 ts64 = timespec_to_timespec64(*ts);
84 return do_settimeofday64(&ts64);
85}
86
57static inline int __getnstimeofday(struct timespec *ts) 87static inline int __getnstimeofday(struct timespec *ts)
58{ 88{
59 struct timespec64 ts64; 89 struct timespec64 ts64;
@@ -86,6 +116,19 @@ static inline void ktime_get_real_ts(struct timespec *ts)
86 getnstimeofday64(&ts64); 116 getnstimeofday64(&ts64);
87 *ts = timespec64_to_timespec(ts64); 117 *ts = timespec64_to_timespec(ts64);
88} 118}
119
120static inline void getrawmonotonic(struct timespec *ts)
121{
122 struct timespec64 ts64;
123
124 getrawmonotonic64(&ts64);
125 *ts = timespec64_to_timespec(ts64);
126}
127
128static inline struct timespec get_monotonic_coarse(void)
129{
130 return timespec64_to_timespec(get_monotonic_coarse64());
131}
89#endif 132#endif
90 133
91extern void getboottime(struct timespec *ts); 134extern void getboottime(struct timespec *ts);
@@ -182,7 +225,7 @@ static inline void timekeeping_clocktai(struct timespec *ts)
182/* 225/*
183 * RTC specific 226 * RTC specific
184 */ 227 */
185extern void timekeeping_inject_sleeptime(struct timespec *delta); 228extern void timekeeping_inject_sleeptime64(struct timespec64 *delta);
186 229
187/* 230/*
188 * PPS accessor 231 * PPS accessor
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
index ea6c9dea79e3..cfaf5a1d4bad 100644
--- a/include/linux/trace_seq.h
+++ b/include/linux/trace_seq.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX_TRACE_SEQ_H 1#ifndef _LINUX_TRACE_SEQ_H
2#define _LINUX_TRACE_SEQ_H 2#define _LINUX_TRACE_SEQ_H
3 3
4#include <linux/fs.h> 4#include <linux/seq_buf.h>
5 5
6#include <asm/page.h> 6#include <asm/page.h>
7 7
@@ -12,20 +12,36 @@
12 12
13struct trace_seq { 13struct trace_seq {
14 unsigned char buffer[PAGE_SIZE]; 14 unsigned char buffer[PAGE_SIZE];
15 unsigned int len; 15 struct seq_buf seq;
16 unsigned int readpos;
17 int full; 16 int full;
18}; 17};
19 18
20static inline void 19static inline void
21trace_seq_init(struct trace_seq *s) 20trace_seq_init(struct trace_seq *s)
22{ 21{
23 s->len = 0; 22 seq_buf_init(&s->seq, s->buffer, PAGE_SIZE);
24 s->readpos = 0;
25 s->full = 0; 23 s->full = 0;
26} 24}
27 25
28/** 26/**
27 * trace_seq_used - amount of actual data written to buffer
28 * @s: trace sequence descriptor
29 *
30 * Returns the amount of data written to the buffer.
31 *
32 * IMPORTANT!
33 *
34 * Use this instead of @s->seq.len if you need to pass the amount
35 * of data from the buffer to another buffer (userspace, or what not).
36 * The @s->seq.len on overflow is bigger than the buffer size and
37 * using it can cause access to undefined memory.
38 */
39static inline int trace_seq_used(struct trace_seq *s)
40{
41 return seq_buf_used(&s->seq);
42}
43
44/**
29 * trace_seq_buffer_ptr - return pointer to next location in buffer 45 * trace_seq_buffer_ptr - return pointer to next location in buffer
30 * @s: trace sequence descriptor 46 * @s: trace sequence descriptor
31 * 47 *
@@ -37,7 +53,19 @@ trace_seq_init(struct trace_seq *s)
37static inline unsigned char * 53static inline unsigned char *
38trace_seq_buffer_ptr(struct trace_seq *s) 54trace_seq_buffer_ptr(struct trace_seq *s)
39{ 55{
40 return s->buffer + s->len; 56 return s->buffer + seq_buf_used(&s->seq);
57}
58
59/**
60 * trace_seq_has_overflowed - return true if the trace_seq took too much
61 * @s: trace sequence descriptor
62 *
63 * Returns true if too much data was added to the trace_seq and it is
64 * now full and will not take anymore.
65 */
66static inline bool trace_seq_has_overflowed(struct trace_seq *s)
67{
68 return s->full || seq_buf_has_overflowed(&s->seq);
41} 69}
42 70
43/* 71/*
@@ -45,40 +73,37 @@ trace_seq_buffer_ptr(struct trace_seq *s)
45 */ 73 */
46#ifdef CONFIG_TRACING 74#ifdef CONFIG_TRACING
47extern __printf(2, 3) 75extern __printf(2, 3)
48int trace_seq_printf(struct trace_seq *s, const char *fmt, ...); 76void trace_seq_printf(struct trace_seq *s, const char *fmt, ...);
49extern __printf(2, 0) 77extern __printf(2, 0)
50int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args); 78void trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args);
51extern int 79extern void
52trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary); 80trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary);
53extern int trace_print_seq(struct seq_file *m, struct trace_seq *s); 81extern int trace_print_seq(struct seq_file *m, struct trace_seq *s);
54extern int trace_seq_to_user(struct trace_seq *s, char __user *ubuf, 82extern int trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
55 int cnt); 83 int cnt);
56extern int trace_seq_puts(struct trace_seq *s, const char *str); 84extern void trace_seq_puts(struct trace_seq *s, const char *str);
57extern int trace_seq_putc(struct trace_seq *s, unsigned char c); 85extern void trace_seq_putc(struct trace_seq *s, unsigned char c);
58extern int trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len); 86extern void trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len);
59extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, 87extern void trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
60 unsigned int len); 88 unsigned int len);
61extern int trace_seq_path(struct trace_seq *s, const struct path *path); 89extern int trace_seq_path(struct trace_seq *s, const struct path *path);
62 90
63extern int trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp, 91extern void trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
64 int nmaskbits); 92 int nmaskbits);
65 93
66#else /* CONFIG_TRACING */ 94#else /* CONFIG_TRACING */
67static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...) 95static inline void trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
68{ 96{
69 return 0;
70} 97}
71static inline int 98static inline void
72trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary) 99trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)
73{ 100{
74 return 0;
75} 101}
76 102
77static inline int 103static inline void
78trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp, 104trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
79 int nmaskbits) 105 int nmaskbits)
80{ 106{
81 return 0;
82} 107}
83 108
84static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s) 109static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s)
@@ -90,23 +115,19 @@ static inline int trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
90{ 115{
91 return 0; 116 return 0;
92} 117}
93static inline int trace_seq_puts(struct trace_seq *s, const char *str) 118static inline void trace_seq_puts(struct trace_seq *s, const char *str)
94{ 119{
95 return 0;
96} 120}
97static inline int trace_seq_putc(struct trace_seq *s, unsigned char c) 121static inline void trace_seq_putc(struct trace_seq *s, unsigned char c)
98{ 122{
99 return 0;
100} 123}
101static inline int 124static inline void
102trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len) 125trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len)
103{ 126{
104 return 0;
105} 127}
106static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, 128static inline void trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
107 unsigned int len) 129 unsigned int len)
108{ 130{
109 return 0;
110} 131}
111static inline int trace_seq_path(struct trace_seq *s, const struct path *path) 132static inline int trace_seq_path(struct trace_seq *s, const struct path *path)
112{ 133{
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 5171ef8f7b85..7d66ae508e5c 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -284,7 +284,7 @@ struct tty_struct {
284 284
285#define N_TTY_BUF_SIZE 4096 285#define N_TTY_BUF_SIZE 4096
286 286
287 unsigned char closing:1; 287 int closing;
288 unsigned char *write_buf; 288 unsigned char *write_buf;
289 int write_cnt; 289 int write_cnt;
290 /* If the tty has a pending do_SAK, queue it here - akpm */ 290 /* If the tty has a pending do_SAK, queue it here - akpm */
@@ -316,12 +316,10 @@ struct tty_file_private {
316#define TTY_EXCLUSIVE 3 /* Exclusive open mode */ 316#define TTY_EXCLUSIVE 3 /* Exclusive open mode */
317#define TTY_DEBUG 4 /* Debugging */ 317#define TTY_DEBUG 4 /* Debugging */
318#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ 318#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */
319#define TTY_CLOSING 7 /* ->close() in progress */
320#define TTY_LDISC_OPEN 11 /* Line discipline is open */ 319#define TTY_LDISC_OPEN 11 /* Line discipline is open */
321#define TTY_PTY_LOCK 16 /* pty private */ 320#define TTY_PTY_LOCK 16 /* pty private */
322#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 321#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
323#define TTY_HUPPED 18 /* Post driver->hangup() */ 322#define TTY_HUPPED 18 /* Post driver->hangup() */
324#define TTY_HUPPING 21 /* ->hangup() in progress */
325#define TTY_LDISC_HALTED 22 /* Line discipline is halted */ 323#define TTY_LDISC_HALTED 22 /* Line discipline is halted */
326 324
327#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) 325#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
@@ -437,14 +435,13 @@ extern int is_ignored(int sig);
437extern int tty_signal(int sig, struct tty_struct *tty); 435extern int tty_signal(int sig, struct tty_struct *tty);
438extern void tty_hangup(struct tty_struct *tty); 436extern void tty_hangup(struct tty_struct *tty);
439extern void tty_vhangup(struct tty_struct *tty); 437extern void tty_vhangup(struct tty_struct *tty);
440extern void tty_unhangup(struct file *filp);
441extern int tty_hung_up_p(struct file *filp); 438extern int tty_hung_up_p(struct file *filp);
442extern void do_SAK(struct tty_struct *tty); 439extern void do_SAK(struct tty_struct *tty);
443extern void __do_SAK(struct tty_struct *tty); 440extern void __do_SAK(struct tty_struct *tty);
444extern void no_tty(void); 441extern void no_tty(void);
445extern void tty_flush_to_ldisc(struct tty_struct *tty); 442extern void tty_flush_to_ldisc(struct tty_struct *tty);
446extern void tty_buffer_free_all(struct tty_port *port); 443extern void tty_buffer_free_all(struct tty_port *port);
447extern void tty_buffer_flush(struct tty_struct *tty); 444extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld);
448extern void tty_buffer_init(struct tty_port *port); 445extern void tty_buffer_init(struct tty_port *port);
449extern speed_t tty_termios_baud_rate(struct ktermios *termios); 446extern speed_t tty_termios_baud_rate(struct ktermios *termios);
450extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 447extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
@@ -498,9 +495,6 @@ extern int tty_init_termios(struct tty_struct *tty);
498extern int tty_standard_install(struct tty_driver *driver, 495extern int tty_standard_install(struct tty_driver *driver,
499 struct tty_struct *tty); 496 struct tty_struct *tty);
500 497
501extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty);
502extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty);
503
504extern struct mutex tty_mutex; 498extern struct mutex tty_mutex;
505extern spinlock_t tty_files_lock; 499extern spinlock_t tty_files_lock;
506 500
@@ -562,7 +556,7 @@ extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
562extern int tty_unregister_ldisc(int disc); 556extern int tty_unregister_ldisc(int disc);
563extern int tty_set_ldisc(struct tty_struct *tty, int ldisc); 557extern int tty_set_ldisc(struct tty_struct *tty, int ldisc);
564extern int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty); 558extern int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty);
565extern void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty); 559extern void tty_ldisc_release(struct tty_struct *tty);
566extern void tty_ldisc_init(struct tty_struct *tty); 560extern void tty_ldisc_init(struct tty_struct *tty);
567extern void tty_ldisc_deinit(struct tty_struct *tty); 561extern void tty_ldisc_deinit(struct tty_struct *tty);
568extern void tty_ldisc_begin(void); 562extern void tty_ldisc_begin(void);
@@ -623,14 +617,6 @@ extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
623extern long n_tty_compat_ioctl_helper(struct tty_struct *tty, struct file *file, 617extern long n_tty_compat_ioctl_helper(struct tty_struct *tty, struct file *file,
624 unsigned int cmd, unsigned long arg); 618 unsigned int cmd, unsigned long arg);
625 619
626/* serial.c */
627
628extern void serial_console_init(void);
629
630/* pcxx.c */
631
632extern int pcxe_open(struct tty_struct *tty, struct file *filp);
633
634/* vt.c */ 620/* vt.c */
635 621
636extern int vt_ioctl(struct tty_struct *tty, 622extern int vt_ioctl(struct tty_struct *tty,
@@ -643,11 +629,9 @@ extern long vt_compat_ioctl(struct tty_struct *tty,
643/* functions for preparation of BKL removal */ 629/* functions for preparation of BKL removal */
644extern void __lockfunc tty_lock(struct tty_struct *tty); 630extern void __lockfunc tty_lock(struct tty_struct *tty);
645extern void __lockfunc tty_unlock(struct tty_struct *tty); 631extern void __lockfunc tty_unlock(struct tty_struct *tty);
646extern void __lockfunc tty_lock_pair(struct tty_struct *tty, 632extern void __lockfunc tty_lock_slave(struct tty_struct *tty);
647 struct tty_struct *tty2); 633extern void __lockfunc tty_unlock_slave(struct tty_struct *tty);
648extern void __lockfunc tty_unlock_pair(struct tty_struct *tty, 634extern void tty_set_lock_subclass(struct tty_struct *tty);
649 struct tty_struct *tty2);
650
651/* 635/*
652 * this shall be called only from where BTM is held (like close) 636 * this shall be called only from where BTM is held (like close)
653 * 637 *
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 9b1581414cd4..a41e252396c0 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -31,6 +31,7 @@ struct iov_iter {
31 size_t count; 31 size_t count;
32 union { 32 union {
33 const struct iovec *iov; 33 const struct iovec *iov;
34 const struct kvec *kvec;
34 const struct bio_vec *bvec; 35 const struct bio_vec *bvec;
35 }; 36 };
36 unsigned long nr_segs; 37 unsigned long nr_segs;
@@ -82,10 +83,13 @@ size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes,
82 struct iov_iter *i); 83 struct iov_iter *i);
83size_t copy_to_iter(void *addr, size_t bytes, struct iov_iter *i); 84size_t copy_to_iter(void *addr, size_t bytes, struct iov_iter *i);
84size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i); 85size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i);
86size_t copy_from_iter_nocache(void *addr, size_t bytes, struct iov_iter *i);
85size_t iov_iter_zero(size_t bytes, struct iov_iter *); 87size_t iov_iter_zero(size_t bytes, struct iov_iter *);
86unsigned long iov_iter_alignment(const struct iov_iter *i); 88unsigned long iov_iter_alignment(const struct iov_iter *i);
87void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, 89void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov,
88 unsigned long nr_segs, size_t count); 90 unsigned long nr_segs, size_t count);
91void iov_iter_kvec(struct iov_iter *i, int direction, const struct kvec *iov,
92 unsigned long nr_segs, size_t count);
89ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, 93ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
90 size_t maxsize, unsigned maxpages, size_t *start); 94 size_t maxsize, unsigned maxpages, size_t *start);
91ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, 95ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages,
@@ -123,9 +127,10 @@ static inline void iov_iter_reexpand(struct iov_iter *i, size_t count)
123{ 127{
124 i->count = count; 128 i->count = count;
125} 129}
130size_t csum_and_copy_to_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
131size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
126 132
127int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); 133int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
128int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len);
129int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, 134int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
130 int offset, int len); 135 int offset, int len);
131int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, 136int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index baa81718d985..32c0e83d6239 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -35,7 +35,7 @@ struct uio_map;
35struct uio_mem { 35struct uio_mem {
36 const char *name; 36 const char *name;
37 phys_addr_t addr; 37 phys_addr_t addr;
38 unsigned long size; 38 resource_size_t size;
39 int memtype; 39 int memtype;
40 void __iomem *internal_addr; 40 void __iomem *internal_addr;
41 struct uio_map *map; 41 struct uio_map *map;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 447a7e2fc19b..f89c24a03bd9 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -637,7 +637,7 @@ static inline bool usb_acpi_power_manageable(struct usb_device *hdev, int index)
637#endif 637#endif
638 638
639/* USB autosuspend and autoresume */ 639/* USB autosuspend and autoresume */
640#ifdef CONFIG_PM_RUNTIME 640#ifdef CONFIG_PM
641extern void usb_enable_autosuspend(struct usb_device *udev); 641extern void usb_enable_autosuspend(struct usb_device *udev);
642extern void usb_disable_autosuspend(struct usb_device *udev); 642extern void usb_disable_autosuspend(struct usb_device *udev);
643 643
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index e14c09a45c5a..535997a6681b 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -13,11 +13,12 @@ struct ci_hdrc_platform_data {
13 /* offset of the capability registers */ 13 /* offset of the capability registers */
14 uintptr_t capoffset; 14 uintptr_t capoffset;
15 unsigned power_budget; 15 unsigned power_budget;
16 struct usb_phy *phy; 16 struct phy *phy;
17 /* old usb_phy interface */
18 struct usb_phy *usb_phy;
17 enum usb_phy_interface phy_mode; 19 enum usb_phy_interface phy_mode;
18 unsigned long flags; 20 unsigned long flags;
19#define CI_HDRC_REGS_SHARED BIT(0) 21#define CI_HDRC_REGS_SHARED BIT(0)
20#define CI_HDRC_REQUIRE_TRANSCEIVER BIT(1)
21#define CI_HDRC_DISABLE_STREAMING BIT(3) 22#define CI_HDRC_DISABLE_STREAMING BIT(3)
22 /* 23 /*
23 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1, 24 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1,
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index c330f5ef42cf..3d87defcc527 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -427,6 +427,8 @@ static inline struct usb_composite_driver *to_cdriver(
427 * @b_vendor_code: bMS_VendorCode part of the OS string 427 * @b_vendor_code: bMS_VendorCode part of the OS string
428 * @use_os_string: false by default, interested gadgets set it 428 * @use_os_string: false by default, interested gadgets set it
429 * @os_desc_config: the configuration to be used with OS descriptors 429 * @os_desc_config: the configuration to be used with OS descriptors
430 * @setup_pending: true when setup request is queued but not completed
431 * @os_desc_pending: true when os_desc request is queued but not completed
430 * 432 *
431 * One of these devices is allocated and initialized before the 433 * One of these devices is allocated and initialized before the
432 * associated device driver's bind() is called. 434 * associated device driver's bind() is called.
@@ -488,6 +490,9 @@ struct usb_composite_dev {
488 490
489 /* protects deactivations and delayed_status counts*/ 491 /* protects deactivations and delayed_status counts*/
490 spinlock_t lock; 492 spinlock_t lock;
493
494 unsigned setup_pending:1;
495 unsigned os_desc_pending:1;
491}; 496};
492 497
493extern int usb_string_id(struct usb_composite_dev *c); 498extern int usb_string_id(struct usb_composite_dev *c);
@@ -501,6 +506,8 @@ extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n);
501extern void composite_disconnect(struct usb_gadget *gadget); 506extern void composite_disconnect(struct usb_gadget *gadget);
502extern int composite_setup(struct usb_gadget *gadget, 507extern int composite_setup(struct usb_gadget *gadget,
503 const struct usb_ctrlrequest *ctrl); 508 const struct usb_ctrlrequest *ctrl);
509extern void composite_suspend(struct usb_gadget *gadget);
510extern void composite_resume(struct usb_gadget *gadget);
504 511
505/* 512/*
506 * Some systems will need runtime overrides for the product identifiers 513 * Some systems will need runtime overrides for the product identifiers
diff --git a/include/linux/usb/ehci-dbgp.h b/include/linux/usb/ehci-dbgp.h
new file mode 100644
index 000000000000..7344d9e591cc
--- /dev/null
+++ b/include/linux/usb/ehci-dbgp.h
@@ -0,0 +1,83 @@
1/*
2 * Standalone EHCI usb debug driver
3 *
4 * Originally written by:
5 * Eric W. Biederman" <ebiederm@xmission.com> and
6 * Yinghai Lu <yhlu.kernel@gmail.com>
7 *
8 * Changes for early/late printk and HW errata:
9 * Jason Wessel <jason.wessel@windriver.com>
10 * Copyright (C) 2009 Wind River Systems, Inc.
11 *
12 */
13
14#ifndef __LINUX_USB_EHCI_DBGP_H
15#define __LINUX_USB_EHCI_DBGP_H
16
17#include <linux/console.h>
18#include <linux/types.h>
19
20/* Appendix C, Debug port ... intended for use with special "debug devices"
21 * that can help if there's no serial console. (nonstandard enumeration.)
22 */
23struct ehci_dbg_port {
24 u32 control;
25#define DBGP_OWNER (1<<30)
26#define DBGP_ENABLED (1<<28)
27#define DBGP_DONE (1<<16)
28#define DBGP_INUSE (1<<10)
29#define DBGP_ERRCODE(x) (((x)>>7)&0x07)
30# define DBGP_ERR_BAD 1
31# define DBGP_ERR_SIGNAL 2
32#define DBGP_ERROR (1<<6)
33#define DBGP_GO (1<<5)
34#define DBGP_OUT (1<<4)
35#define DBGP_LEN(x) (((x)>>0)&0x0f)
36 u32 pids;
37#define DBGP_PID_GET(x) (((x)>>16)&0xff)
38#define DBGP_PID_SET(data, tok) (((data)<<8)|(tok))
39 u32 data03;
40 u32 data47;
41 u32 address;
42#define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep))
43};
44
45#ifdef CONFIG_EARLY_PRINTK_DBGP
46extern int early_dbgp_init(char *s);
47extern struct console early_dbgp_console;
48#endif /* CONFIG_EARLY_PRINTK_DBGP */
49
50struct usb_hcd;
51
52#ifdef CONFIG_XEN_DOM0
53extern int xen_dbgp_reset_prep(struct usb_hcd *);
54extern int xen_dbgp_external_startup(struct usb_hcd *);
55#else
56static inline int xen_dbgp_reset_prep(struct usb_hcd *hcd)
57{
58 return 1; /* Shouldn't this be 0? */
59}
60
61static inline int xen_dbgp_external_startup(struct usb_hcd *hcd)
62{
63 return -1;
64}
65#endif
66
67#ifdef CONFIG_EARLY_PRINTK_DBGP
68/* Call backs from ehci host driver to ehci debug driver */
69extern int dbgp_external_startup(struct usb_hcd *);
70extern int dbgp_reset_prep(struct usb_hcd *);
71#else
72static inline int dbgp_reset_prep(struct usb_hcd *hcd)
73{
74 return xen_dbgp_reset_prep(hcd);
75}
76
77static inline int dbgp_external_startup(struct usb_hcd *hcd)
78{
79 return xen_dbgp_external_startup(hcd);
80}
81#endif
82
83#endif /* __LINUX_USB_EHCI_DBGP_H */
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index daec99af5d54..966889a20ea3 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -19,6 +19,8 @@
19#ifndef __LINUX_USB_EHCI_DEF_H 19#ifndef __LINUX_USB_EHCI_DEF_H
20#define __LINUX_USB_EHCI_DEF_H 20#define __LINUX_USB_EHCI_DEF_H
21 21
22#include <linux/usb/ehci-dbgp.h>
23
22/* EHCI register interface, corresponds to EHCI Revision 0.95 specification */ 24/* EHCI register interface, corresponds to EHCI Revision 0.95 specification */
23 25
24/* Section 2.2 Host Controller Capability Registers */ 26/* Section 2.2 Host Controller Capability Registers */
@@ -190,67 +192,4 @@ struct ehci_regs {
190#define USBMODE_EX_HC (3<<0) /* host controller mode */ 192#define USBMODE_EX_HC (3<<0) /* host controller mode */
191}; 193};
192 194
193/* Appendix C, Debug port ... intended for use with special "debug devices"
194 * that can help if there's no serial console. (nonstandard enumeration.)
195 */
196struct ehci_dbg_port {
197 u32 control;
198#define DBGP_OWNER (1<<30)
199#define DBGP_ENABLED (1<<28)
200#define DBGP_DONE (1<<16)
201#define DBGP_INUSE (1<<10)
202#define DBGP_ERRCODE(x) (((x)>>7)&0x07)
203# define DBGP_ERR_BAD 1
204# define DBGP_ERR_SIGNAL 2
205#define DBGP_ERROR (1<<6)
206#define DBGP_GO (1<<5)
207#define DBGP_OUT (1<<4)
208#define DBGP_LEN(x) (((x)>>0)&0x0f)
209 u32 pids;
210#define DBGP_PID_GET(x) (((x)>>16)&0xff)
211#define DBGP_PID_SET(data, tok) (((data)<<8)|(tok))
212 u32 data03;
213 u32 data47;
214 u32 address;
215#define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep))
216};
217
218#ifdef CONFIG_EARLY_PRINTK_DBGP
219#include <linux/init.h>
220extern int __init early_dbgp_init(char *s);
221extern struct console early_dbgp_console;
222#endif /* CONFIG_EARLY_PRINTK_DBGP */
223
224struct usb_hcd;
225
226#ifdef CONFIG_XEN_DOM0
227extern int xen_dbgp_reset_prep(struct usb_hcd *);
228extern int xen_dbgp_external_startup(struct usb_hcd *);
229#else
230static inline int xen_dbgp_reset_prep(struct usb_hcd *hcd)
231{
232 return 1; /* Shouldn't this be 0? */
233}
234
235static inline int xen_dbgp_external_startup(struct usb_hcd *hcd)
236{
237 return -1;
238}
239#endif
240
241#ifdef CONFIG_EARLY_PRINTK_DBGP
242/* Call backs from ehci host driver to ehci debug driver */
243extern int dbgp_external_startup(struct usb_hcd *);
244extern int dbgp_reset_prep(struct usb_hcd *hcd);
245#else
246static inline int dbgp_reset_prep(struct usb_hcd *hcd)
247{
248 return xen_dbgp_reset_prep(hcd);
249}
250static inline int dbgp_external_startup(struct usb_hcd *hcd)
251{
252 return xen_dbgp_external_startup(hcd);
253}
254#endif
255
256#endif /* __LINUX_USB_EHCI_DEF_H */ 195#endif /* __LINUX_USB_EHCI_DEF_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 522cafe26790..70ddb3943b62 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -490,8 +490,7 @@ struct usb_gadget_ops {
490 void (*get_config_params)(struct usb_dcd_config_params *); 490 void (*get_config_params)(struct usb_dcd_config_params *);
491 int (*udc_start)(struct usb_gadget *, 491 int (*udc_start)(struct usb_gadget *,
492 struct usb_gadget_driver *); 492 struct usb_gadget_driver *);
493 int (*udc_stop)(struct usb_gadget *, 493 int (*udc_stop)(struct usb_gadget *);
494 struct usb_gadget_driver *);
495}; 494};
496 495
497/** 496/**
@@ -925,7 +924,7 @@ extern int usb_add_gadget_udc_release(struct device *parent,
925 struct usb_gadget *gadget, void (*release)(struct device *dev)); 924 struct usb_gadget *gadget, void (*release)(struct device *dev));
926extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget); 925extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
927extern void usb_del_gadget_udc(struct usb_gadget *gadget); 926extern void usb_del_gadget_udc(struct usb_gadget *gadget);
928extern int udc_attach_driver(const char *name, 927extern int usb_udc_attach_driver(const char *name,
929 struct usb_gadget_driver *driver); 928 struct usb_gadget_driver *driver);
930 929
931/*-------------------------------------------------------------------------*/ 930/*-------------------------------------------------------------------------*/
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index cd96a2bc3388..086bf13307e6 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -93,7 +93,7 @@ struct usb_hcd {
93 93
94 struct timer_list rh_timer; /* drives root-hub polling */ 94 struct timer_list rh_timer; /* drives root-hub polling */
95 struct urb *status_urb; /* the current status urb */ 95 struct urb *status_urb; /* the current status urb */
96#ifdef CONFIG_PM_RUNTIME 96#ifdef CONFIG_PM
97 struct work_struct wakeup_work; /* for remote wakeup */ 97 struct work_struct wakeup_work; /* for remote wakeup */
98#endif 98#endif
99 99
@@ -379,6 +379,9 @@ struct hc_driver {
379 int (*disable_usb3_lpm_timeout)(struct usb_hcd *, 379 int (*disable_usb3_lpm_timeout)(struct usb_hcd *,
380 struct usb_device *, enum usb3_link_state state); 380 struct usb_device *, enum usb3_link_state state);
381 int (*find_raw_port_number)(struct usb_hcd *, int); 381 int (*find_raw_port_number)(struct usb_hcd *, int);
382 /* Call for power on/off the port if necessary */
383 int (*port_power)(struct usb_hcd *hcd, int portnum, bool enable);
384
382}; 385};
383 386
384static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd) 387static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
@@ -625,16 +628,13 @@ extern int usb_find_interface_driver(struct usb_device *dev,
625extern void usb_root_hub_lost_power(struct usb_device *rhdev); 628extern void usb_root_hub_lost_power(struct usb_device *rhdev);
626extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg); 629extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg);
627extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg); 630extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg);
628#endif /* CONFIG_PM */
629
630#ifdef CONFIG_PM_RUNTIME
631extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd); 631extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd);
632#else 632#else
633static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd) 633static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd)
634{ 634{
635 return; 635 return;
636} 636}
637#endif /* CONFIG_PM_RUNTIME */ 637#endif /* CONFIG_PM */
638 638
639/*-------------------------------------------------------------------------*/ 639/*-------------------------------------------------------------------------*/
640 640
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 154332b7c8c0..52661c5da690 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -9,15 +9,20 @@
9#ifndef __LINUX_USB_OTG_H 9#ifndef __LINUX_USB_OTG_H
10#define __LINUX_USB_OTG_H 10#define __LINUX_USB_OTG_H
11 11
12#include <linux/phy/phy.h>
12#include <linux/usb/phy.h> 13#include <linux/usb/phy.h>
13 14
14struct usb_otg { 15struct usb_otg {
15 u8 default_a; 16 u8 default_a;
16 17
17 struct usb_phy *phy; 18 struct phy *phy;
19 /* old usb_phy interface */
20 struct usb_phy *usb_phy;
18 struct usb_bus *host; 21 struct usb_bus *host;
19 struct usb_gadget *gadget; 22 struct usb_gadget *gadget;
20 23
24 enum usb_otg_state state;
25
21 /* bind/unbind the host controller */ 26 /* bind/unbind the host controller */
22 int (*set_host)(struct usb_otg *otg, struct usb_bus *host); 27 int (*set_host)(struct usb_otg *otg, struct usb_bus *host);
23 28
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 353053a33f21..f499c23e6342 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -77,7 +77,6 @@ struct usb_phy {
77 unsigned int flags; 77 unsigned int flags;
78 78
79 enum usb_phy_type type; 79 enum usb_phy_type type;
80 enum usb_otg_state state;
81 enum usb_phy_events last_event; 80 enum usb_phy_events last_event;
82 81
83 struct usb_otg *otg; 82 struct usb_otg *otg;
@@ -210,6 +209,7 @@ extern void usb_put_phy(struct usb_phy *);
210extern void devm_usb_put_phy(struct device *dev, struct usb_phy *x); 209extern void devm_usb_put_phy(struct device *dev, struct usb_phy *x);
211extern int usb_bind_phy(const char *dev_name, u8 index, 210extern int usb_bind_phy(const char *dev_name, u8 index,
212 const char *phy_dev_name); 211 const char *phy_dev_name);
212extern void usb_phy_set_event(struct usb_phy *x, unsigned long event);
213#else 213#else
214static inline struct usb_phy *usb_get_phy(enum usb_phy_type type) 214static inline struct usb_phy *usb_get_phy(enum usb_phy_type type)
215{ 215{
@@ -251,6 +251,10 @@ static inline int usb_bind_phy(const char *dev_name, u8 index,
251{ 251{
252 return -EOPNOTSUPP; 252 return -EOPNOTSUPP;
253} 253}
254
255static inline void usb_phy_set_event(struct usb_phy *x, unsigned long event)
256{
257}
254#endif 258#endif
255 259
256static inline int 260static inline int
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index d5952bb66752..9fd9e481ea98 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -145,6 +145,10 @@ struct renesas_usbhs_driver_param {
145 int d0_rx_id; 145 int d0_rx_id;
146 int d1_tx_id; 146 int d1_tx_id;
147 int d1_rx_id; 147 int d1_rx_id;
148 int d2_tx_id;
149 int d2_rx_id;
150 int d3_tx_id;
151 int d3_rx_id;
148 152
149 /* 153 /*
150 * option: 154 * option:
diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h
index a4c9547aae64..f8e76e08ebe4 100644
--- a/include/linux/vexpress.h
+++ b/include/linux/vexpress.h
@@ -15,8 +15,6 @@
15#define _LINUX_VEXPRESS_H 15#define _LINUX_VEXPRESS_H
16 16
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/platform_device.h>
19#include <linux/reboot.h>
20#include <linux/regmap.h> 18#include <linux/regmap.h>
21 19
22#define VEXPRESS_SITE_MB 0 20#define VEXPRESS_SITE_MB 0
@@ -24,13 +22,6 @@
24#define VEXPRESS_SITE_DB2 2 22#define VEXPRESS_SITE_DB2 2
25#define VEXPRESS_SITE_MASTER 0xf 23#define VEXPRESS_SITE_MASTER 0xf
26 24
27#define VEXPRESS_RES_FUNC(_site, _func) \
28{ \
29 .start = (_site), \
30 .end = (_func), \
31 .flags = IORESOURCE_BUS, \
32}
33
34/* Config infrastructure */ 25/* Config infrastructure */
35 26
36void vexpress_config_set_master(u32 site); 27void vexpress_config_set_master(u32 site);
@@ -58,16 +49,6 @@ struct regmap *devm_regmap_init_vexpress_config(struct device *dev);
58 49
59/* Platform control */ 50/* Platform control */
60 51
61unsigned int vexpress_get_mci_cardin(struct device *dev);
62u32 vexpress_get_procid(int site);
63void *vexpress_get_24mhz_clock_base(void);
64void vexpress_flags_set(u32 data); 52void vexpress_flags_set(u32 data);
65 53
66void vexpress_sysreg_early_init(void __iomem *base);
67int vexpress_syscfg_device_register(struct platform_device *pdev);
68
69/* Clocks */
70
71void vexpress_clk_init(void __iomem *sp810_base);
72
73#endif 54#endif
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 65261a7244fc..d09e0938fd60 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -75,6 +75,9 @@ unsigned int virtqueue_get_vring_size(struct virtqueue *vq);
75 75
76bool virtqueue_is_broken(struct virtqueue *vq); 76bool virtqueue_is_broken(struct virtqueue *vq);
77 77
78void *virtqueue_get_avail(struct virtqueue *vq);
79void *virtqueue_get_used(struct virtqueue *vq);
80
78/** 81/**
79 * virtio_device - representation of a device using virtio 82 * virtio_device - representation of a device using virtio
80 * @index: unique position on the virtio bus 83 * @index: unique position on the virtio bus
@@ -101,11 +104,12 @@ struct virtio_device {
101 const struct virtio_config_ops *config; 104 const struct virtio_config_ops *config;
102 const struct vringh_config_ops *vringh_config; 105 const struct vringh_config_ops *vringh_config;
103 struct list_head vqs; 106 struct list_head vqs;
104 /* Note that this is a Linux set_bit-style bitmap. */ 107 u64 features;
105 unsigned long features[1];
106 void *priv; 108 void *priv;
107}; 109};
108 110
111bool virtio_device_is_legacy_only(struct virtio_device_id id);
112
109static inline struct virtio_device *dev_to_virtio(struct device *_dev) 113static inline struct virtio_device *dev_to_virtio(struct device *_dev)
110{ 114{
111 return container_of(_dev, struct virtio_device, dev); 115 return container_of(_dev, struct virtio_device, dev);
@@ -128,6 +132,8 @@ int virtio_device_restore(struct virtio_device *dev);
128 * @id_table: the ids serviced by this driver. 132 * @id_table: the ids serviced by this driver.
129 * @feature_table: an array of feature numbers supported by this driver. 133 * @feature_table: an array of feature numbers supported by this driver.
130 * @feature_table_size: number of entries in the feature table array. 134 * @feature_table_size: number of entries in the feature table array.
135 * @feature_table_legacy: same as feature_table but when working in legacy mode.
136 * @feature_table_size_legacy: number of entries in feature table legacy array.
131 * @probe: the function to call when a device is found. Returns 0 or -errno. 137 * @probe: the function to call when a device is found. Returns 0 or -errno.
132 * @remove: the function to call when a device is removed. 138 * @remove: the function to call when a device is removed.
133 * @config_changed: optional function to call when the device configuration 139 * @config_changed: optional function to call when the device configuration
@@ -138,6 +144,8 @@ struct virtio_driver {
138 const struct virtio_device_id *id_table; 144 const struct virtio_device_id *id_table;
139 const unsigned int *feature_table; 145 const unsigned int *feature_table;
140 unsigned int feature_table_size; 146 unsigned int feature_table_size;
147 const unsigned int *feature_table_legacy;
148 unsigned int feature_table_size_legacy;
141 int (*probe)(struct virtio_device *dev); 149 int (*probe)(struct virtio_device *dev);
142 void (*scan)(struct virtio_device *dev); 150 void (*scan)(struct virtio_device *dev);
143 void (*remove)(struct virtio_device *dev); 151 void (*remove)(struct virtio_device *dev);
diff --git a/include/linux/virtio_byteorder.h b/include/linux/virtio_byteorder.h
new file mode 100644
index 000000000000..51865d05b267
--- /dev/null
+++ b/include/linux/virtio_byteorder.h
@@ -0,0 +1,59 @@
1#ifndef _LINUX_VIRTIO_BYTEORDER_H
2#define _LINUX_VIRTIO_BYTEORDER_H
3#include <linux/types.h>
4#include <uapi/linux/virtio_types.h>
5
6/*
7 * Low-level memory accessors for handling virtio in modern little endian and in
8 * compatibility native endian format.
9 */
10
11static inline u16 __virtio16_to_cpu(bool little_endian, __virtio16 val)
12{
13 if (little_endian)
14 return le16_to_cpu((__force __le16)val);
15 else
16 return (__force u16)val;
17}
18
19static inline __virtio16 __cpu_to_virtio16(bool little_endian, u16 val)
20{
21 if (little_endian)
22 return (__force __virtio16)cpu_to_le16(val);
23 else
24 return (__force __virtio16)val;
25}
26
27static inline u32 __virtio32_to_cpu(bool little_endian, __virtio32 val)
28{
29 if (little_endian)
30 return le32_to_cpu((__force __le32)val);
31 else
32 return (__force u32)val;
33}
34
35static inline __virtio32 __cpu_to_virtio32(bool little_endian, u32 val)
36{
37 if (little_endian)
38 return (__force __virtio32)cpu_to_le32(val);
39 else
40 return (__force __virtio32)val;
41}
42
43static inline u64 __virtio64_to_cpu(bool little_endian, __virtio64 val)
44{
45 if (little_endian)
46 return le64_to_cpu((__force __le64)val);
47 else
48 return (__force u64)val;
49}
50
51static inline __virtio64 __cpu_to_virtio64(bool little_endian, u64 val)
52{
53 if (little_endian)
54 return (__force __virtio64)cpu_to_le64(val);
55 else
56 return (__force __virtio64)val;
57}
58
59#endif /* _LINUX_VIRTIO_BYTEORDER */
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 7f4ef66873ef..7979f850e7ac 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -4,6 +4,7 @@
4#include <linux/err.h> 4#include <linux/err.h>
5#include <linux/bug.h> 5#include <linux/bug.h>
6#include <linux/virtio.h> 6#include <linux/virtio.h>
7#include <linux/virtio_byteorder.h>
7#include <uapi/linux/virtio_config.h> 8#include <uapi/linux/virtio_config.h>
8 9
9/** 10/**
@@ -46,6 +47,7 @@
46 * vdev: the virtio_device 47 * vdev: the virtio_device
47 * This gives the final feature bits for the device: it can change 48 * This gives the final feature bits for the device: it can change
48 * the dev->feature bits if it wants. 49 * the dev->feature bits if it wants.
50 * Returns 0 on success or error status
49 * @bus_name: return the bus name associated with the device 51 * @bus_name: return the bus name associated with the device
50 * vdev: the virtio_device 52 * vdev: the virtio_device
51 * This returns a pointer to the bus name a la pci_name from which 53 * This returns a pointer to the bus name a la pci_name from which
@@ -66,8 +68,8 @@ struct virtio_config_ops {
66 vq_callback_t *callbacks[], 68 vq_callback_t *callbacks[],
67 const char *names[]); 69 const char *names[]);
68 void (*del_vqs)(struct virtio_device *); 70 void (*del_vqs)(struct virtio_device *);
69 u32 (*get_features)(struct virtio_device *vdev); 71 u64 (*get_features)(struct virtio_device *vdev);
70 void (*finalize_features)(struct virtio_device *vdev); 72 int (*finalize_features)(struct virtio_device *vdev);
71 const char *(*bus_name)(struct virtio_device *vdev); 73 const char *(*bus_name)(struct virtio_device *vdev);
72 int (*set_vq_affinity)(struct virtqueue *vq, int cpu); 74 int (*set_vq_affinity)(struct virtqueue *vq, int cpu);
73}; 75};
@@ -77,23 +79,70 @@ void virtio_check_driver_offered_feature(const struct virtio_device *vdev,
77 unsigned int fbit); 79 unsigned int fbit);
78 80
79/** 81/**
80 * virtio_has_feature - helper to determine if this device has this feature. 82 * __virtio_test_bit - helper to test feature bits. For use by transports.
83 * Devices should normally use virtio_has_feature,
84 * which includes more checks.
81 * @vdev: the device 85 * @vdev: the device
82 * @fbit: the feature bit 86 * @fbit: the feature bit
83 */ 87 */
84static inline bool virtio_has_feature(const struct virtio_device *vdev, 88static inline bool __virtio_test_bit(const struct virtio_device *vdev,
89 unsigned int fbit)
90{
91 /* Did you forget to fix assumptions on max features? */
92 if (__builtin_constant_p(fbit))
93 BUILD_BUG_ON(fbit >= 64);
94 else
95 BUG_ON(fbit >= 64);
96
97 return vdev->features & BIT_ULL(fbit);
98}
99
100/**
101 * __virtio_set_bit - helper to set feature bits. For use by transports.
102 * @vdev: the device
103 * @fbit: the feature bit
104 */
105static inline void __virtio_set_bit(struct virtio_device *vdev,
106 unsigned int fbit)
107{
108 /* Did you forget to fix assumptions on max features? */
109 if (__builtin_constant_p(fbit))
110 BUILD_BUG_ON(fbit >= 64);
111 else
112 BUG_ON(fbit >= 64);
113
114 vdev->features |= BIT_ULL(fbit);
115}
116
117/**
118 * __virtio_clear_bit - helper to clear feature bits. For use by transports.
119 * @vdev: the device
120 * @fbit: the feature bit
121 */
122static inline void __virtio_clear_bit(struct virtio_device *vdev,
85 unsigned int fbit) 123 unsigned int fbit)
86{ 124{
87 /* Did you forget to fix assumptions on max features? */ 125 /* Did you forget to fix assumptions on max features? */
88 if (__builtin_constant_p(fbit)) 126 if (__builtin_constant_p(fbit))
89 BUILD_BUG_ON(fbit >= 32); 127 BUILD_BUG_ON(fbit >= 64);
90 else 128 else
91 BUG_ON(fbit >= 32); 129 BUG_ON(fbit >= 64);
92 130
131 vdev->features &= ~BIT_ULL(fbit);
132}
133
134/**
135 * virtio_has_feature - helper to determine if this device has this feature.
136 * @vdev: the device
137 * @fbit: the feature bit
138 */
139static inline bool virtio_has_feature(const struct virtio_device *vdev,
140 unsigned int fbit)
141{
93 if (fbit < VIRTIO_TRANSPORT_F_START) 142 if (fbit < VIRTIO_TRANSPORT_F_START)
94 virtio_check_driver_offered_feature(vdev, fbit); 143 virtio_check_driver_offered_feature(vdev, fbit);
95 144
96 return test_bit(fbit, vdev->features); 145 return __virtio_test_bit(vdev, fbit);
97} 146}
98 147
99static inline 148static inline
@@ -152,6 +201,37 @@ int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
152 return 0; 201 return 0;
153} 202}
154 203
204/* Memory accessors */
205static inline u16 virtio16_to_cpu(struct virtio_device *vdev, __virtio16 val)
206{
207 return __virtio16_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val);
208}
209
210static inline __virtio16 cpu_to_virtio16(struct virtio_device *vdev, u16 val)
211{
212 return __cpu_to_virtio16(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val);
213}
214
215static inline u32 virtio32_to_cpu(struct virtio_device *vdev, __virtio32 val)
216{
217 return __virtio32_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val);
218}
219
220static inline __virtio32 cpu_to_virtio32(struct virtio_device *vdev, u32 val)
221{
222 return __cpu_to_virtio32(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val);
223}
224
225static inline u64 virtio64_to_cpu(struct virtio_device *vdev, __virtio64 val)
226{
227 return __virtio64_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val);
228}
229
230static inline __virtio64 cpu_to_virtio64(struct virtio_device *vdev, u64 val)
231{
232 return __cpu_to_virtio64(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val);
233}
234
155/* Config space accessors. */ 235/* Config space accessors. */
156#define virtio_cread(vdev, structname, member, ptr) \ 236#define virtio_cread(vdev, structname, member, ptr) \
157 do { \ 237 do { \
@@ -239,12 +319,13 @@ static inline u16 virtio_cread16(struct virtio_device *vdev,
239{ 319{
240 u16 ret; 320 u16 ret;
241 vdev->config->get(vdev, offset, &ret, sizeof(ret)); 321 vdev->config->get(vdev, offset, &ret, sizeof(ret));
242 return ret; 322 return virtio16_to_cpu(vdev, (__force __virtio16)ret);
243} 323}
244 324
245static inline void virtio_cwrite16(struct virtio_device *vdev, 325static inline void virtio_cwrite16(struct virtio_device *vdev,
246 unsigned int offset, u16 val) 326 unsigned int offset, u16 val)
247{ 327{
328 val = (__force u16)cpu_to_virtio16(vdev, val);
248 vdev->config->set(vdev, offset, &val, sizeof(val)); 329 vdev->config->set(vdev, offset, &val, sizeof(val));
249} 330}
250 331
@@ -253,12 +334,13 @@ static inline u32 virtio_cread32(struct virtio_device *vdev,
253{ 334{
254 u32 ret; 335 u32 ret;
255 vdev->config->get(vdev, offset, &ret, sizeof(ret)); 336 vdev->config->get(vdev, offset, &ret, sizeof(ret));
256 return ret; 337 return virtio32_to_cpu(vdev, (__force __virtio32)ret);
257} 338}
258 339
259static inline void virtio_cwrite32(struct virtio_device *vdev, 340static inline void virtio_cwrite32(struct virtio_device *vdev,
260 unsigned int offset, u32 val) 341 unsigned int offset, u32 val)
261{ 342{
343 val = (__force u32)cpu_to_virtio32(vdev, val);
262 vdev->config->set(vdev, offset, &val, sizeof(val)); 344 vdev->config->set(vdev, offset, &val, sizeof(val));
263} 345}
264 346
@@ -267,12 +349,13 @@ static inline u64 virtio_cread64(struct virtio_device *vdev,
267{ 349{
268 u64 ret; 350 u64 ret;
269 vdev->config->get(vdev, offset, &ret, sizeof(ret)); 351 vdev->config->get(vdev, offset, &ret, sizeof(ret));
270 return ret; 352 return virtio64_to_cpu(vdev, (__force __virtio64)ret);
271} 353}
272 354
273static inline void virtio_cwrite64(struct virtio_device *vdev, 355static inline void virtio_cwrite64(struct virtio_device *vdev,
274 unsigned int offset, u64 val) 356 unsigned int offset, u64 val)
275{ 357{
358 val = (__force u64)cpu_to_virtio64(vdev, val);
276 vdev->config->set(vdev, offset, &val, sizeof(val)); 359 vdev->config->set(vdev, offset, &val, sizeof(val));
277} 360}
278 361
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 730334cdf037..9246d32dc973 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -90,6 +90,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
90#ifdef CONFIG_DEBUG_VM_VMACACHE 90#ifdef CONFIG_DEBUG_VM_VMACACHE
91 VMACACHE_FIND_CALLS, 91 VMACACHE_FIND_CALLS,
92 VMACACHE_FIND_HITS, 92 VMACACHE_FIND_HITS,
93 VMACACHE_FULL_FLUSHES,
93#endif 94#endif
94 NR_VM_EVENT_ITEMS 95 NR_VM_EVENT_ITEMS
95}; 96};
diff --git a/include/linux/vmw_vmci_api.h b/include/linux/vmw_vmci_api.h
index 023430e265fe..5691f752ce8f 100644
--- a/include/linux/vmw_vmci_api.h
+++ b/include/linux/vmw_vmci_api.h
@@ -24,6 +24,7 @@
24#define VMCI_KERNEL_API_VERSION_2 2 24#define VMCI_KERNEL_API_VERSION_2 2
25#define VMCI_KERNEL_API_VERSION VMCI_KERNEL_API_VERSION_2 25#define VMCI_KERNEL_API_VERSION VMCI_KERNEL_API_VERSION_2
26 26
27struct msghdr;
27typedef void (vmci_device_shutdown_fn) (void *device_registration, 28typedef void (vmci_device_shutdown_fn) (void *device_registration,
28 void *user_data); 29 void *user_data);
29 30
@@ -75,8 +76,8 @@ ssize_t vmci_qpair_peek(struct vmci_qp *qpair, void *buf, size_t buf_size,
75ssize_t vmci_qpair_enquev(struct vmci_qp *qpair, 76ssize_t vmci_qpair_enquev(struct vmci_qp *qpair,
76 void *iov, size_t iov_size, int mode); 77 void *iov, size_t iov_size, int mode);
77ssize_t vmci_qpair_dequev(struct vmci_qp *qpair, 78ssize_t vmci_qpair_dequev(struct vmci_qp *qpair,
78 void *iov, size_t iov_size, int mode); 79 struct msghdr *msg, size_t iov_size, int mode);
79ssize_t vmci_qpair_peekv(struct vmci_qp *qpair, void *iov, size_t iov_size, 80ssize_t vmci_qpair_peekv(struct vmci_qp *qpair, struct msghdr *msg, size_t iov_size,
80 int mode); 81 int mode);
81 82
82#endif /* !__VMW_VMCI_API_H__ */ 83#endif /* !__VMW_VMCI_API_H__ */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index e4a8eb9312ea..2232ed16635a 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -13,9 +13,12 @@ typedef struct __wait_queue wait_queue_t;
13typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, void *key); 13typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, void *key);
14int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key); 14int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key);
15 15
16/* __wait_queue::flags */
17#define WQ_FLAG_EXCLUSIVE 0x01
18#define WQ_FLAG_WOKEN 0x02
19
16struct __wait_queue { 20struct __wait_queue {
17 unsigned int flags; 21 unsigned int flags;
18#define WQ_FLAG_EXCLUSIVE 0x01
19 void *private; 22 void *private;
20 wait_queue_func_t func; 23 wait_queue_func_t func;
21 struct list_head task_list; 24 struct list_head task_list;
@@ -258,11 +261,37 @@ __out: __ret; \
258 */ 261 */
259#define wait_event(wq, condition) \ 262#define wait_event(wq, condition) \
260do { \ 263do { \
264 might_sleep(); \
261 if (condition) \ 265 if (condition) \
262 break; \ 266 break; \
263 __wait_event(wq, condition); \ 267 __wait_event(wq, condition); \
264} while (0) 268} while (0)
265 269
270#define __wait_event_freezable(wq, condition) \
271 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
272 schedule(); try_to_freeze())
273
274/**
275 * wait_event - sleep (or freeze) until a condition gets true
276 * @wq: the waitqueue to wait on
277 * @condition: a C expression for the event to wait for
278 *
279 * The process is put to sleep (TASK_INTERRUPTIBLE -- so as not to contribute
280 * to system load) until the @condition evaluates to true. The
281 * @condition is checked each time the waitqueue @wq is woken up.
282 *
283 * wake_up() has to be called after changing any variable that could
284 * change the result of the wait condition.
285 */
286#define wait_event_freezable(wq, condition) \
287({ \
288 int __ret = 0; \
289 might_sleep(); \
290 if (!(condition)) \
291 __ret = __wait_event_freezable(wq, condition); \
292 __ret; \
293})
294
266#define __wait_event_timeout(wq, condition, timeout) \ 295#define __wait_event_timeout(wq, condition, timeout) \
267 ___wait_event(wq, ___wait_cond_timeout(condition), \ 296 ___wait_event(wq, ___wait_cond_timeout(condition), \
268 TASK_UNINTERRUPTIBLE, 0, timeout, \ 297 TASK_UNINTERRUPTIBLE, 0, timeout, \
@@ -290,11 +319,30 @@ do { \
290#define wait_event_timeout(wq, condition, timeout) \ 319#define wait_event_timeout(wq, condition, timeout) \
291({ \ 320({ \
292 long __ret = timeout; \ 321 long __ret = timeout; \
322 might_sleep(); \
293 if (!___wait_cond_timeout(condition)) \ 323 if (!___wait_cond_timeout(condition)) \
294 __ret = __wait_event_timeout(wq, condition, timeout); \ 324 __ret = __wait_event_timeout(wq, condition, timeout); \
295 __ret; \ 325 __ret; \
296}) 326})
297 327
328#define __wait_event_freezable_timeout(wq, condition, timeout) \
329 ___wait_event(wq, ___wait_cond_timeout(condition), \
330 TASK_INTERRUPTIBLE, 0, timeout, \
331 __ret = schedule_timeout(__ret); try_to_freeze())
332
333/*
334 * like wait_event_timeout() -- except it uses TASK_INTERRUPTIBLE to avoid
335 * increasing load and is freezable.
336 */
337#define wait_event_freezable_timeout(wq, condition, timeout) \
338({ \
339 long __ret = timeout; \
340 might_sleep(); \
341 if (!___wait_cond_timeout(condition)) \
342 __ret = __wait_event_freezable_timeout(wq, condition, timeout); \
343 __ret; \
344})
345
298#define __wait_event_cmd(wq, condition, cmd1, cmd2) \ 346#define __wait_event_cmd(wq, condition, cmd1, cmd2) \
299 (void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0, \ 347 (void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
300 cmd1; schedule(); cmd2) 348 cmd1; schedule(); cmd2)
@@ -315,6 +363,7 @@ do { \
315 */ 363 */
316#define wait_event_cmd(wq, condition, cmd1, cmd2) \ 364#define wait_event_cmd(wq, condition, cmd1, cmd2) \
317do { \ 365do { \
366 might_sleep(); \
318 if (condition) \ 367 if (condition) \
319 break; \ 368 break; \
320 __wait_event_cmd(wq, condition, cmd1, cmd2); \ 369 __wait_event_cmd(wq, condition, cmd1, cmd2); \
@@ -342,6 +391,7 @@ do { \
342#define wait_event_interruptible(wq, condition) \ 391#define wait_event_interruptible(wq, condition) \
343({ \ 392({ \
344 int __ret = 0; \ 393 int __ret = 0; \
394 might_sleep(); \
345 if (!(condition)) \ 395 if (!(condition)) \
346 __ret = __wait_event_interruptible(wq, condition); \ 396 __ret = __wait_event_interruptible(wq, condition); \
347 __ret; \ 397 __ret; \
@@ -375,6 +425,7 @@ do { \
375#define wait_event_interruptible_timeout(wq, condition, timeout) \ 425#define wait_event_interruptible_timeout(wq, condition, timeout) \
376({ \ 426({ \
377 long __ret = timeout; \ 427 long __ret = timeout; \
428 might_sleep(); \
378 if (!___wait_cond_timeout(condition)) \ 429 if (!___wait_cond_timeout(condition)) \
379 __ret = __wait_event_interruptible_timeout(wq, \ 430 __ret = __wait_event_interruptible_timeout(wq, \
380 condition, timeout); \ 431 condition, timeout); \
@@ -425,6 +476,7 @@ do { \
425#define wait_event_hrtimeout(wq, condition, timeout) \ 476#define wait_event_hrtimeout(wq, condition, timeout) \
426({ \ 477({ \
427 int __ret = 0; \ 478 int __ret = 0; \
479 might_sleep(); \
428 if (!(condition)) \ 480 if (!(condition)) \
429 __ret = __wait_event_hrtimeout(wq, condition, timeout, \ 481 __ret = __wait_event_hrtimeout(wq, condition, timeout, \
430 TASK_UNINTERRUPTIBLE); \ 482 TASK_UNINTERRUPTIBLE); \
@@ -450,6 +502,7 @@ do { \
450#define wait_event_interruptible_hrtimeout(wq, condition, timeout) \ 502#define wait_event_interruptible_hrtimeout(wq, condition, timeout) \
451({ \ 503({ \
452 long __ret = 0; \ 504 long __ret = 0; \
505 might_sleep(); \
453 if (!(condition)) \ 506 if (!(condition)) \
454 __ret = __wait_event_hrtimeout(wq, condition, timeout, \ 507 __ret = __wait_event_hrtimeout(wq, condition, timeout, \
455 TASK_INTERRUPTIBLE); \ 508 TASK_INTERRUPTIBLE); \
@@ -463,12 +516,27 @@ do { \
463#define wait_event_interruptible_exclusive(wq, condition) \ 516#define wait_event_interruptible_exclusive(wq, condition) \
464({ \ 517({ \
465 int __ret = 0; \ 518 int __ret = 0; \
519 might_sleep(); \
466 if (!(condition)) \ 520 if (!(condition)) \
467 __ret = __wait_event_interruptible_exclusive(wq, condition);\ 521 __ret = __wait_event_interruptible_exclusive(wq, condition);\
468 __ret; \ 522 __ret; \
469}) 523})
470 524
471 525
526#define __wait_event_freezable_exclusive(wq, condition) \
527 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 1, 0, \
528 schedule(); try_to_freeze())
529
530#define wait_event_freezable_exclusive(wq, condition) \
531({ \
532 int __ret = 0; \
533 might_sleep(); \
534 if (!(condition)) \
535 __ret = __wait_event_freezable_exclusive(wq, condition);\
536 __ret; \
537})
538
539
472#define __wait_event_interruptible_locked(wq, condition, exclusive, irq) \ 540#define __wait_event_interruptible_locked(wq, condition, exclusive, irq) \
473({ \ 541({ \
474 int __ret = 0; \ 542 int __ret = 0; \
@@ -637,6 +705,7 @@ do { \
637#define wait_event_killable(wq, condition) \ 705#define wait_event_killable(wq, condition) \
638({ \ 706({ \
639 int __ret = 0; \ 707 int __ret = 0; \
708 might_sleep(); \
640 if (!(condition)) \ 709 if (!(condition)) \
641 __ret = __wait_event_killable(wq, condition); \ 710 __ret = __wait_event_killable(wq, condition); \
642 __ret; \ 711 __ret; \
@@ -830,6 +899,8 @@ void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int sta
830long prepare_to_wait_event(wait_queue_head_t *q, wait_queue_t *wait, int state); 899long prepare_to_wait_event(wait_queue_head_t *q, wait_queue_t *wait, int state);
831void finish_wait(wait_queue_head_t *q, wait_queue_t *wait); 900void finish_wait(wait_queue_head_t *q, wait_queue_t *wait);
832void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait, unsigned int mode, void *key); 901void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait, unsigned int mode, void *key);
902long wait_woken(wait_queue_t *wait, unsigned mode, long timeout);
903int woken_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
833int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); 904int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
834int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); 905int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
835 906
@@ -886,6 +957,7 @@ extern int bit_wait_io_timeout(struct wait_bit_key *);
886static inline int 957static inline int
887wait_on_bit(void *word, int bit, unsigned mode) 958wait_on_bit(void *word, int bit, unsigned mode)
888{ 959{
960 might_sleep();
889 if (!test_bit(bit, word)) 961 if (!test_bit(bit, word))
890 return 0; 962 return 0;
891 return out_of_line_wait_on_bit(word, bit, 963 return out_of_line_wait_on_bit(word, bit,
@@ -910,6 +982,7 @@ wait_on_bit(void *word, int bit, unsigned mode)
910static inline int 982static inline int
911wait_on_bit_io(void *word, int bit, unsigned mode) 983wait_on_bit_io(void *word, int bit, unsigned mode)
912{ 984{
985 might_sleep();
913 if (!test_bit(bit, word)) 986 if (!test_bit(bit, word))
914 return 0; 987 return 0;
915 return out_of_line_wait_on_bit(word, bit, 988 return out_of_line_wait_on_bit(word, bit,
@@ -936,6 +1009,7 @@ wait_on_bit_io(void *word, int bit, unsigned mode)
936static inline int 1009static inline int
937wait_on_bit_action(void *word, int bit, wait_bit_action_f *action, unsigned mode) 1010wait_on_bit_action(void *word, int bit, wait_bit_action_f *action, unsigned mode)
938{ 1011{
1012 might_sleep();
939 if (!test_bit(bit, word)) 1013 if (!test_bit(bit, word))
940 return 0; 1014 return 0;
941 return out_of_line_wait_on_bit(word, bit, action, mode); 1015 return out_of_line_wait_on_bit(word, bit, action, mode);
@@ -963,6 +1037,7 @@ wait_on_bit_action(void *word, int bit, wait_bit_action_f *action, unsigned mode
963static inline int 1037static inline int
964wait_on_bit_lock(void *word, int bit, unsigned mode) 1038wait_on_bit_lock(void *word, int bit, unsigned mode)
965{ 1039{
1040 might_sleep();
966 if (!test_and_set_bit(bit, word)) 1041 if (!test_and_set_bit(bit, word))
967 return 0; 1042 return 0;
968 return out_of_line_wait_on_bit_lock(word, bit, bit_wait, mode); 1043 return out_of_line_wait_on_bit_lock(word, bit, bit_wait, mode);
@@ -986,6 +1061,7 @@ wait_on_bit_lock(void *word, int bit, unsigned mode)
986static inline int 1061static inline int
987wait_on_bit_lock_io(void *word, int bit, unsigned mode) 1062wait_on_bit_lock_io(void *word, int bit, unsigned mode)
988{ 1063{
1064 might_sleep();
989 if (!test_and_set_bit(bit, word)) 1065 if (!test_and_set_bit(bit, word))
990 return 0; 1066 return 0;
991 return out_of_line_wait_on_bit_lock(word, bit, bit_wait_io, mode); 1067 return out_of_line_wait_on_bit_lock(word, bit, bit_wait_io, mode);
@@ -1011,6 +1087,7 @@ wait_on_bit_lock_io(void *word, int bit, unsigned mode)
1011static inline int 1087static inline int
1012wait_on_bit_lock_action(void *word, int bit, wait_bit_action_f *action, unsigned mode) 1088wait_on_bit_lock_action(void *word, int bit, wait_bit_action_f *action, unsigned mode)
1013{ 1089{
1090 might_sleep();
1014 if (!test_and_set_bit(bit, word)) 1091 if (!test_and_set_bit(bit, word))
1015 return 0; 1092 return 0;
1016 return out_of_line_wait_on_bit_lock(word, bit, action, mode); 1093 return out_of_line_wait_on_bit_lock(word, bit, action, mode);
@@ -1029,6 +1106,7 @@ wait_on_bit_lock_action(void *word, int bit, wait_bit_action_f *action, unsigned
1029static inline 1106static inline
1030int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode) 1107int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode)
1031{ 1108{
1109 might_sleep();
1032 if (atomic_read(val) == 0) 1110 if (atomic_read(val) == 0)
1033 return 0; 1111 return 0;
1034 return out_of_line_wait_on_atomic_t(val, action, mode); 1112 return out_of_line_wait_on_atomic_t(val, action, mode);
diff --git a/include/media/davinci/vpbe.h b/include/media/davinci/vpbe.h
index 57585c7004a4..4376beeb28c2 100644
--- a/include/media/davinci/vpbe.h
+++ b/include/media/davinci/vpbe.h
@@ -63,7 +63,7 @@ struct vpbe_output {
63 * output basis. If per mode is needed, we may have to move this to 63 * output basis. If per mode is needed, we may have to move this to
64 * mode_info structure 64 * mode_info structure
65 */ 65 */
66 enum v4l2_mbus_pixelcode if_params; 66 u32 if_params;
67}; 67};
68 68
69/* encoder configuration info */ 69/* encoder configuration info */
diff --git a/include/media/davinci/vpbe_display.h b/include/media/davinci/vpbe_display.h
index 637749a91432..fa0247ad815f 100644
--- a/include/media/davinci/vpbe_display.h
+++ b/include/media/davinci/vpbe_display.h
@@ -70,8 +70,6 @@ struct vpbe_disp_buffer {
70 70
71/* vpbe display object structure */ 71/* vpbe display object structure */
72struct vpbe_layer { 72struct vpbe_layer {
73 /* number of buffers in fbuffers */
74 unsigned int numbuffers;
75 /* Pointer to the vpbe_display */ 73 /* Pointer to the vpbe_display */
76 struct vpbe_display *disp_dev; 74 struct vpbe_display *disp_dev;
77 /* Pointer pointing to current v4l2_buffer */ 75 /* Pointer pointing to current v4l2_buffer */
@@ -91,10 +89,6 @@ struct vpbe_layer {
91 /* V4l2 specific parameters */ 89 /* V4l2 specific parameters */
92 /* Identifies video device for this layer */ 90 /* Identifies video device for this layer */
93 struct video_device video_dev; 91 struct video_device video_dev;
94 /* This field keeps track of type of buffer exchange mechanism user
95 * has selected
96 */
97 enum v4l2_memory memory;
98 /* Used to store pixel format */ 92 /* Used to store pixel format */
99 struct v4l2_pix_format pix_fmt; 93 struct v4l2_pix_format pix_fmt;
100 enum v4l2_field buf_field; 94 enum v4l2_field buf_field;
@@ -106,12 +100,8 @@ struct vpbe_layer {
106 unsigned char window_enable; 100 unsigned char window_enable;
107 /* number of open instances of the layer */ 101 /* number of open instances of the layer */
108 unsigned int usrs; 102 unsigned int usrs;
109 /* number of users performing IO */
110 unsigned int io_usrs;
111 /* Indicates id of the field which is being displayed */ 103 /* Indicates id of the field which is being displayed */
112 unsigned int field_id; 104 unsigned int field_id;
113 /* Indicates whether streaming started */
114 unsigned char started;
115 /* Identifies device object */ 105 /* Identifies device object */
116 enum vpbe_display_device_id device_id; 106 enum vpbe_display_device_id device_id;
117 /* facilitation of ioctl ops lock by v4l2*/ 107 /* facilitation of ioctl ops lock by v4l2*/
@@ -131,17 +121,6 @@ struct vpbe_display {
131 struct osd_state *osd_device; 121 struct osd_state *osd_device;
132}; 122};
133 123
134/* File handle structure */
135struct vpbe_fh {
136 struct v4l2_fh fh;
137 /* vpbe device structure */
138 struct vpbe_display *disp_dev;
139 /* pointer to layer object for opened device */
140 struct vpbe_layer *layer;
141 /* Indicates whether this file handle is doing IO */
142 unsigned char io_allowed;
143};
144
145struct buf_config_params { 124struct buf_config_params {
146 unsigned char min_numbuffers; 125 unsigned char min_numbuffers;
147 unsigned char numbuffers[VPBE_DISPLAY_MAX_DEVICES]; 126 unsigned char numbuffers[VPBE_DISPLAY_MAX_DEVICES];
diff --git a/include/media/davinci/vpbe_venc.h b/include/media/davinci/vpbe_venc.h
index 476fafc2f522..3dbd20026107 100644
--- a/include/media/davinci/vpbe_venc.h
+++ b/include/media/davinci/vpbe_venc.h
@@ -30,11 +30,10 @@
30#define VENC_SECOND_FIELD BIT(2) 30#define VENC_SECOND_FIELD BIT(2)
31 31
32struct venc_platform_data { 32struct venc_platform_data {
33 int (*setup_pinmux)(enum v4l2_mbus_pixelcode if_type, 33 int (*setup_pinmux)(u32 if_type, int field);
34 int field);
35 int (*setup_clock)(enum vpbe_enc_timings_type type, 34 int (*setup_clock)(enum vpbe_enc_timings_type type,
36 unsigned int pixclock); 35 unsigned int pixclock);
37 int (*setup_if_config)(enum v4l2_mbus_pixelcode pixcode); 36 int (*setup_if_config)(u32 pixcode);
38 /* Number of LCD outputs supported */ 37 /* Number of LCD outputs supported */
39 int num_lcd_outputs; 38 int num_lcd_outputs;
40 struct vpbe_if_params *lcd_if_params; 39 struct vpbe_if_params *lcd_if_params;
diff --git a/include/media/exynos-fimc.h b/include/media/exynos-fimc.h
index aa44660e2041..69bcd2a07d5c 100644
--- a/include/media/exynos-fimc.h
+++ b/include/media/exynos-fimc.h
@@ -101,7 +101,7 @@ struct fimc_source_info {
101 * @flags: flags indicating which operation mode format applies to 101 * @flags: flags indicating which operation mode format applies to
102 */ 102 */
103struct fimc_fmt { 103struct fimc_fmt {
104 enum v4l2_mbus_pixelcode mbus_code; 104 u32 mbus_code;
105 char *name; 105 char *name;
106 u32 fourcc; 106 u32 fourcc;
107 u32 color; 107 u32 color;
diff --git a/include/media/lirc_dev.h b/include/media/lirc_dev.h
index 78f0637ca68d..05e7ad5d2c8b 100644
--- a/include/media/lirc_dev.h
+++ b/include/media/lirc_dev.h
@@ -29,14 +29,13 @@ struct lirc_buffer {
29 /* Using chunks instead of bytes pretends to simplify boundary checking 29 /* Using chunks instead of bytes pretends to simplify boundary checking
30 * And should allow for some performance fine tunning later */ 30 * And should allow for some performance fine tunning later */
31 struct kfifo fifo; 31 struct kfifo fifo;
32 u8 fifo_initialized;
33}; 32};
34 33
35static inline void lirc_buffer_clear(struct lirc_buffer *buf) 34static inline void lirc_buffer_clear(struct lirc_buffer *buf)
36{ 35{
37 unsigned long flags; 36 unsigned long flags;
38 37
39 if (buf->fifo_initialized) { 38 if (kfifo_initialized(&buf->fifo)) {
40 spin_lock_irqsave(&buf->fifo_lock, flags); 39 spin_lock_irqsave(&buf->fifo_lock, flags);
41 kfifo_reset(&buf->fifo); 40 kfifo_reset(&buf->fifo);
42 spin_unlock_irqrestore(&buf->fifo_lock, flags); 41 spin_unlock_irqrestore(&buf->fifo_lock, flags);
@@ -56,17 +55,14 @@ static inline int lirc_buffer_init(struct lirc_buffer *buf,
56 buf->chunk_size = chunk_size; 55 buf->chunk_size = chunk_size;
57 buf->size = size; 56 buf->size = size;
58 ret = kfifo_alloc(&buf->fifo, size * chunk_size, GFP_KERNEL); 57 ret = kfifo_alloc(&buf->fifo, size * chunk_size, GFP_KERNEL);
59 if (ret == 0)
60 buf->fifo_initialized = 1;
61 58
62 return ret; 59 return ret;
63} 60}
64 61
65static inline void lirc_buffer_free(struct lirc_buffer *buf) 62static inline void lirc_buffer_free(struct lirc_buffer *buf)
66{ 63{
67 if (buf->fifo_initialized) { 64 if (kfifo_initialized(&buf->fifo)) {
68 kfifo_free(&buf->fifo); 65 kfifo_free(&buf->fifo);
69 buf->fifo_initialized = 0;
70 } else 66 } else
71 WARN(1, "calling %s on an uninitialized lirc_buffer\n", 67 WARN(1, "calling %s on an uninitialized lirc_buffer\n",
72 __func__); 68 __func__);
diff --git a/include/media/radio-si4713.h b/include/media/radio-si4713.h
deleted file mode 100644
index f6aae29c7741..000000000000
--- a/include/media/radio-si4713.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * include/media/radio-si4713.h
3 *
4 * Board related data definitions for Si4713 radio transmitter chip.
5 *
6 * Copyright (c) 2009 Nokia Corporation
7 * Contact: Eduardo Valentin <eduardo.valentin@nokia.com>
8 *
9 * This file is licensed under the terms of the GNU General Public License
10 * version 2. This program is licensed "as is" without any warranty of any
11 * kind, whether express or implied.
12 *
13 */
14
15#ifndef RADIO_SI4713_H
16#define RADIO_SI4713_H
17
18#include <linux/i2c.h>
19
20#define SI4713_NAME "radio-si4713"
21
22/*
23 * Platform dependent definition
24 */
25struct radio_si4713_platform_data {
26 int i2c_bus;
27 struct i2c_board_info *subdev_board_info;
28};
29
30#endif /* ifndef RADIO_SI4713_H*/
diff --git a/include/media/si4713.h b/include/media/si4713.h
index f98a0a7af61c..be4f58e2440b 100644
--- a/include/media/si4713.h
+++ b/include/media/si4713.h
@@ -23,9 +23,7 @@
23 * Platform dependent definition 23 * Platform dependent definition
24 */ 24 */
25struct si4713_platform_data { 25struct si4713_platform_data {
26 const char * const *supply_names; 26 bool is_platform_device;
27 unsigned supplies;
28 int gpio_reset; /* < 0 if not used */
29}; 27};
30 28
31/* 29/*
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 865246b00127..2f6261f3e570 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -296,7 +296,7 @@ const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc(
296 * format setup. 296 * format setup.
297 */ 297 */
298struct soc_camera_format_xlate { 298struct soc_camera_format_xlate {
299 enum v4l2_mbus_pixelcode code; 299 u32 code;
300 const struct soc_mbus_pixelfmt *host_fmt; 300 const struct soc_mbus_pixelfmt *host_fmt;
301}; 301};
302 302
diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h
index d33f6d059692..2ff773785fb6 100644
--- a/include/media/soc_mediabus.h
+++ b/include/media/soc_mediabus.h
@@ -91,16 +91,16 @@ struct soc_mbus_pixelfmt {
91 * @fmt: pixel format description 91 * @fmt: pixel format description
92 */ 92 */
93struct soc_mbus_lookup { 93struct soc_mbus_lookup {
94 enum v4l2_mbus_pixelcode code; 94 u32 code;
95 struct soc_mbus_pixelfmt fmt; 95 struct soc_mbus_pixelfmt fmt;
96}; 96};
97 97
98const struct soc_mbus_pixelfmt *soc_mbus_find_fmtdesc( 98const struct soc_mbus_pixelfmt *soc_mbus_find_fmtdesc(
99 enum v4l2_mbus_pixelcode code, 99 u32 code,
100 const struct soc_mbus_lookup *lookup, 100 const struct soc_mbus_lookup *lookup,
101 int n); 101 int n);
102const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc( 102const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
103 enum v4l2_mbus_pixelcode code); 103 u32 code);
104s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf); 104s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf);
105s32 soc_mbus_image_size(const struct soc_mbus_pixelfmt *mf, 105s32 soc_mbus_image_size(const struct soc_mbus_pixelfmt *mf,
106 u32 bytes_per_line, u32 height); 106 u32 bytes_per_line, u32 height);
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 48f974866f13..1cc0c5ba16b3 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -80,24 +80,9 @@
80 80
81/* ------------------------------------------------------------------------- */ 81/* ------------------------------------------------------------------------- */
82 82
83/* Control helper functions */ 83/* Control helper function */
84 84
85int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
86 const char * const *menu_items);
87const char *v4l2_ctrl_get_name(u32 id);
88const char * const *v4l2_ctrl_get_menu(u32 id);
89const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len);
90int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def); 85int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def);
91int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu,
92 struct v4l2_queryctrl *qctrl, const char * const *menu_items);
93#define V4L2_CTRL_MENU_IDS_END (0xffffffff)
94int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids);
95
96/* Note: ctrl_classes points to an array of u32 pointers. Each u32 array is a
97 0-terminated array of control IDs. Each array must be sorted low to high
98 and belong to the same control class. The array of u32 pointers must also
99 be sorted, from low class IDs to high class IDs. */
100u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
101 86
102/* ------------------------------------------------------------------------- */ 87/* ------------------------------------------------------------------------- */
103 88
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index b7cd7a665e35..911f3e542834 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -670,6 +670,31 @@ static inline int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
670 */ 670 */
671void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify, void *priv); 671void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify, void *priv);
672 672
673/** v4l2_ctrl_get_name() - Get the name of the control
674 * @id: The control ID.
675 *
676 * This function returns the name of the given control ID or NULL if it isn't
677 * a known control.
678 */
679const char *v4l2_ctrl_get_name(u32 id);
680
681/** v4l2_ctrl_get_menu() - Get the menu string array of the control
682 * @id: The control ID.
683 *
684 * This function returns the NULL-terminated menu string array name of the
685 * given control ID or NULL if it isn't a known menu control.
686 */
687const char * const *v4l2_ctrl_get_menu(u32 id);
688
689/** v4l2_ctrl_get_int_menu() - Get the integer menu array of the control
690 * @id: The control ID.
691 * @len: The size of the integer array.
692 *
693 * This function returns the integer array of the given control ID or NULL if it
694 * if it isn't a known integer menu control.
695 */
696const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len);
697
673/** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver. 698/** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver.
674 * @ctrl: The control. 699 * @ctrl: The control.
675 * 700 *
diff --git a/include/media/v4l2-image-sizes.h b/include/media/v4l2-image-sizes.h
index 10daf92ff1ab..a07d7a683bd9 100644
--- a/include/media/v4l2-image-sizes.h
+++ b/include/media/v4l2-image-sizes.h
@@ -25,10 +25,19 @@
25#define QVGA_WIDTH 320 25#define QVGA_WIDTH 320
26#define QVGA_HEIGHT 240 26#define QVGA_HEIGHT 240
27 27
28#define SVGA_WIDTH 800
29#define SVGA_HEIGHT 600
30
28#define SXGA_WIDTH 1280 31#define SXGA_WIDTH 1280
29#define SXGA_HEIGHT 1024 32#define SXGA_HEIGHT 1024
30 33
31#define VGA_WIDTH 640 34#define VGA_WIDTH 640
32#define VGA_HEIGHT 480 35#define VGA_HEIGHT 480
33 36
37#define UXGA_WIDTH 1600
38#define UXGA_HEIGHT 1200
39
40#define XGA_WIDTH 1024
41#define XGA_HEIGHT 768
42
34#endif /* _IMAGE_SIZES_H */ 43#endif /* _IMAGE_SIZES_H */
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
index 395c4a95a42a..38d960d8dccd 100644
--- a/include/media/v4l2-mediabus.h
+++ b/include/media/v4l2-mediabus.h
@@ -94,16 +94,20 @@ static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt,
94 pix_fmt->height = mbus_fmt->height; 94 pix_fmt->height = mbus_fmt->height;
95 pix_fmt->field = mbus_fmt->field; 95 pix_fmt->field = mbus_fmt->field;
96 pix_fmt->colorspace = mbus_fmt->colorspace; 96 pix_fmt->colorspace = mbus_fmt->colorspace;
97 pix_fmt->ycbcr_enc = mbus_fmt->ycbcr_enc;
98 pix_fmt->quantization = mbus_fmt->quantization;
97} 99}
98 100
99static inline void v4l2_fill_mbus_format(struct v4l2_mbus_framefmt *mbus_fmt, 101static inline void v4l2_fill_mbus_format(struct v4l2_mbus_framefmt *mbus_fmt,
100 const struct v4l2_pix_format *pix_fmt, 102 const struct v4l2_pix_format *pix_fmt,
101 enum v4l2_mbus_pixelcode code) 103 u32 code)
102{ 104{
103 mbus_fmt->width = pix_fmt->width; 105 mbus_fmt->width = pix_fmt->width;
104 mbus_fmt->height = pix_fmt->height; 106 mbus_fmt->height = pix_fmt->height;
105 mbus_fmt->field = pix_fmt->field; 107 mbus_fmt->field = pix_fmt->field;
106 mbus_fmt->colorspace = pix_fmt->colorspace; 108 mbus_fmt->colorspace = pix_fmt->colorspace;
109 mbus_fmt->ycbcr_enc = pix_fmt->ycbcr_enc;
110 mbus_fmt->quantization = pix_fmt->quantization;
107 mbus_fmt->code = code; 111 mbus_fmt->code = code;
108} 112}
109 113
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index d7465725773d..5860292d42eb 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -341,7 +341,7 @@ struct v4l2_subdev_video_ops {
341 int (*query_dv_timings)(struct v4l2_subdev *sd, 341 int (*query_dv_timings)(struct v4l2_subdev *sd,
342 struct v4l2_dv_timings *timings); 342 struct v4l2_dv_timings *timings);
343 int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index, 343 int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,
344 enum v4l2_mbus_pixelcode *code); 344 u32 *code);
345 int (*enum_mbus_fsizes)(struct v4l2_subdev *sd, 345 int (*enum_mbus_fsizes)(struct v4l2_subdev *sd,
346 struct v4l2_frmsizeenum *fsize); 346 struct v4l2_frmsizeenum *fsize);
347 int (*g_mbus_fmt)(struct v4l2_subdev *sd, 347 int (*g_mbus_fmt)(struct v4l2_subdev *sd,
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 6ef2d01197da..bd2cec2d6c3d 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -82,19 +82,23 @@ struct vb2_threadio_data;
82 * unmap_dmabuf. 82 * unmap_dmabuf.
83 */ 83 */
84struct vb2_mem_ops { 84struct vb2_mem_ops {
85 void *(*alloc)(void *alloc_ctx, unsigned long size, gfp_t gfp_flags); 85 void *(*alloc)(void *alloc_ctx, unsigned long size,
86 enum dma_data_direction dma_dir,
87 gfp_t gfp_flags);
86 void (*put)(void *buf_priv); 88 void (*put)(void *buf_priv);
87 struct dma_buf *(*get_dmabuf)(void *buf_priv, unsigned long flags); 89 struct dma_buf *(*get_dmabuf)(void *buf_priv, unsigned long flags);
88 90
89 void *(*get_userptr)(void *alloc_ctx, unsigned long vaddr, 91 void *(*get_userptr)(void *alloc_ctx, unsigned long vaddr,
90 unsigned long size, int write); 92 unsigned long size,
93 enum dma_data_direction dma_dir);
91 void (*put_userptr)(void *buf_priv); 94 void (*put_userptr)(void *buf_priv);
92 95
93 void (*prepare)(void *buf_priv); 96 void (*prepare)(void *buf_priv);
94 void (*finish)(void *buf_priv); 97 void (*finish)(void *buf_priv);
95 98
96 void *(*attach_dmabuf)(void *alloc_ctx, struct dma_buf *dbuf, 99 void *(*attach_dmabuf)(void *alloc_ctx, struct dma_buf *dbuf,
97 unsigned long size, int write); 100 unsigned long size,
101 enum dma_data_direction dma_dir);
98 void (*detach_dmabuf)(void *buf_priv); 102 void (*detach_dmabuf)(void *buf_priv);
99 int (*map_dmabuf)(void *buf_priv); 103 int (*map_dmabuf)(void *buf_priv);
100 void (*unmap_dmabuf)(void *buf_priv); 104 void (*unmap_dmabuf)(void *buf_priv);
@@ -270,22 +274,24 @@ struct vb2_buffer {
270 * queue setup from completing successfully; optional. 274 * queue setup from completing successfully; optional.
271 * @buf_prepare: called every time the buffer is queued from userspace 275 * @buf_prepare: called every time the buffer is queued from userspace
272 * and from the VIDIOC_PREPARE_BUF ioctl; drivers may 276 * and from the VIDIOC_PREPARE_BUF ioctl; drivers may
273 * perform any initialization required before each hardware 277 * perform any initialization required before each
274 * operation in this callback; drivers that support 278 * hardware operation in this callback; drivers can
275 * VIDIOC_CREATE_BUFS must also validate the buffer size; 279 * access/modify the buffer here as it is still synced for
276 * if an error is returned, the buffer will not be queued 280 * the CPU; drivers that support VIDIOC_CREATE_BUFS must
277 * in driver; optional. 281 * also validate the buffer size; if an error is returned,
282 * the buffer will not be queued in driver; optional.
278 * @buf_finish: called before every dequeue of the buffer back to 283 * @buf_finish: called before every dequeue of the buffer back to
279 * userspace; drivers may perform any operations required 284 * userspace; the buffer is synced for the CPU, so drivers
280 * before userspace accesses the buffer; optional. The 285 * can access/modify the buffer contents; drivers may
281 * buffer state can be one of the following: DONE and 286 * perform any operations required before userspace
282 * ERROR occur while streaming is in progress, and the 287 * accesses the buffer; optional. The buffer state can be
283 * PREPARED state occurs when the queue has been canceled 288 * one of the following: DONE and ERROR occur while
284 * and all pending buffers are being returned to their 289 * streaming is in progress, and the PREPARED state occurs
285 * default DEQUEUED state. Typically you only have to do 290 * when the queue has been canceled and all pending
286 * something if the state is VB2_BUF_STATE_DONE, since in 291 * buffers are being returned to their default DEQUEUED
287 * all other cases the buffer contents will be ignored 292 * state. Typically you only have to do something if the
288 * anyway. 293 * state is VB2_BUF_STATE_DONE, since in all other cases
294 * the buffer contents will be ignored anyway.
289 * @buf_cleanup: called once before the buffer is freed; drivers may 295 * @buf_cleanup: called once before the buffer is freed; drivers may
290 * perform any additional cleanup; optional. 296 * perform any additional cleanup; optional.
291 * @start_streaming: called once to enter 'streaming' state; the driver may 297 * @start_streaming: called once to enter 'streaming' state; the driver may
diff --git a/include/media/videobuf2-dma-sg.h b/include/media/videobuf2-dma-sg.h
index 7b89852779af..14ce3068b642 100644
--- a/include/media/videobuf2-dma-sg.h
+++ b/include/media/videobuf2-dma-sg.h
@@ -21,6 +21,9 @@ static inline struct sg_table *vb2_dma_sg_plane_desc(
21 return (struct sg_table *)vb2_plane_cookie(vb, plane_no); 21 return (struct sg_table *)vb2_plane_cookie(vb, plane_no);
22} 22}
23 23
24void *vb2_dma_sg_init_ctx(struct device *dev);
25void vb2_dma_sg_cleanup_ctx(void *alloc_ctx);
26
24extern const struct vb2_mem_ops vb2_dma_sg_memops; 27extern const struct vb2_mem_ops vb2_dma_sg_memops;
25 28
26#endif 29#endif
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
index d184df1d0d41..dc03d77ad23b 100644
--- a/include/net/6lowpan.h
+++ b/include/net/6lowpan.h
@@ -372,12 +372,12 @@ lowpan_uncompress_size(const struct sk_buff *skb, u16 *dgram_offset)
372 return skb->len + uncomp_header - ret; 372 return skb->len + uncomp_header - ret;
373} 373}
374 374
375typedef int (*skb_delivery_cb)(struct sk_buff *skb, struct net_device *dev); 375int
376 376lowpan_header_decompress(struct sk_buff *skb, struct net_device *dev,
377int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, 377 const u8 *saddr, const u8 saddr_type,
378 const u8 *saddr, const u8 saddr_type, const u8 saddr_len, 378 const u8 saddr_len, const u8 *daddr,
379 const u8 *daddr, const u8 daddr_type, const u8 daddr_len, 379 const u8 daddr_type, const u8 daddr_len,
380 u8 iphc0, u8 iphc1, skb_delivery_cb skb_deliver); 380 u8 iphc0, u8 iphc1);
381int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev, 381int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
382 unsigned short type, const void *_daddr, 382 unsigned short type, const void *_daddr,
383 const void *_saddr, unsigned int len); 383 const void *_saddr, unsigned int len);
diff --git a/include/net/af_ieee802154.h b/include/net/af_ieee802154.h
index 085940f7eeec..7d38e2ffd256 100644
--- a/include/net/af_ieee802154.h
+++ b/include/net/af_ieee802154.h
@@ -12,10 +12,6 @@
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Written by: 15 * Written by:
20 * Sergey Lapin <slapin@ossfans.org> 16 * Sergey Lapin <slapin@ossfans.org>
21 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 17 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h
index 428277869400..0d87674fb775 100644
--- a/include/net/af_vsock.h
+++ b/include/net/af_vsock.h
@@ -103,14 +103,14 @@ struct vsock_transport {
103 int (*dgram_dequeue)(struct kiocb *kiocb, struct vsock_sock *vsk, 103 int (*dgram_dequeue)(struct kiocb *kiocb, struct vsock_sock *vsk,
104 struct msghdr *msg, size_t len, int flags); 104 struct msghdr *msg, size_t len, int flags);
105 int (*dgram_enqueue)(struct vsock_sock *, struct sockaddr_vm *, 105 int (*dgram_enqueue)(struct vsock_sock *, struct sockaddr_vm *,
106 struct iovec *, size_t len); 106 struct msghdr *, size_t len);
107 bool (*dgram_allow)(u32 cid, u32 port); 107 bool (*dgram_allow)(u32 cid, u32 port);
108 108
109 /* STREAM. */ 109 /* STREAM. */
110 /* TODO: stream_bind() */ 110 /* TODO: stream_bind() */
111 ssize_t (*stream_dequeue)(struct vsock_sock *, struct iovec *, 111 ssize_t (*stream_dequeue)(struct vsock_sock *, struct msghdr *,
112 size_t len, int flags); 112 size_t len, int flags);
113 ssize_t (*stream_enqueue)(struct vsock_sock *, struct iovec *, 113 ssize_t (*stream_enqueue)(struct vsock_sock *, struct msghdr *,
114 size_t len); 114 size_t len);
115 s64 (*stream_has_data)(struct vsock_sock *); 115 s64 (*stream_has_data)(struct vsock_sock *);
116 s64 (*stream_has_space)(struct vsock_sock *); 116 s64 (*stream_has_space)(struct vsock_sock *);
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 6e8f24967308..40129b3838b2 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -129,6 +129,15 @@ enum {
129 * during the hdev->setup vendor callback. 129 * during the hdev->setup vendor callback.
130 */ 130 */
131 HCI_QUIRK_INVALID_BDADDR, 131 HCI_QUIRK_INVALID_BDADDR,
132
133 /* When this quirk is set, the duplicate filtering during
134 * scanning is based on Bluetooth devices addresses. To allow
135 * RSSI based updates, restart scanning if needed.
136 *
137 * This quirk can be set before hci_register_dev is called or
138 * during the hdev->setup vendor callback.
139 */
140 HCI_QUIRK_STRICT_DUPLICATE_FILTER,
132}; 141};
133 142
134/* HCI device flags */ 143/* HCI device flags */
@@ -154,6 +163,7 @@ enum {
154enum { 163enum {
155 HCI_DUT_MODE, 164 HCI_DUT_MODE,
156 HCI_FORCE_SC, 165 HCI_FORCE_SC,
166 HCI_FORCE_LESC,
157 HCI_FORCE_STATIC_ADDR, 167 HCI_FORCE_STATIC_ADDR,
158}; 168};
159 169
@@ -265,6 +275,7 @@ enum {
265/* Low Energy links do not have defined link type. Use invented one */ 275/* Low Energy links do not have defined link type. Use invented one */
266#define LE_LINK 0x80 276#define LE_LINK 0x80
267#define AMP_LINK 0x81 277#define AMP_LINK 0x81
278#define INVALID_LINK 0xff
268 279
269/* LMP features */ 280/* LMP features */
270#define LMP_3SLOT 0x01 281#define LMP_3SLOT 0x01
@@ -332,6 +343,7 @@ enum {
332#define HCI_LE_ENCRYPTION 0x01 343#define HCI_LE_ENCRYPTION 0x01
333#define HCI_LE_CONN_PARAM_REQ_PROC 0x02 344#define HCI_LE_CONN_PARAM_REQ_PROC 0x02
334#define HCI_LE_PING 0x10 345#define HCI_LE_PING 0x10
346#define HCI_LE_EXT_SCAN_POLICY 0x80
335 347
336/* Connection modes */ 348/* Connection modes */
337#define HCI_CM_ACTIVE 0x0000 349#define HCI_CM_ACTIVE 0x0000
@@ -401,6 +413,7 @@ enum {
401 413
402/* The core spec defines 127 as the "not available" value */ 414/* The core spec defines 127 as the "not available" value */
403#define HCI_TX_POWER_INVALID 127 415#define HCI_TX_POWER_INVALID 127
416#define HCI_RSSI_INVALID 127
404 417
405#define HCI_ROLE_MASTER 0x00 418#define HCI_ROLE_MASTER 0x00
406#define HCI_ROLE_SLAVE 0x01 419#define HCI_ROLE_SLAVE 0x01
@@ -629,7 +642,7 @@ struct hci_cp_user_passkey_reply {
629struct hci_cp_remote_oob_data_reply { 642struct hci_cp_remote_oob_data_reply {
630 bdaddr_t bdaddr; 643 bdaddr_t bdaddr;
631 __u8 hash[16]; 644 __u8 hash[16];
632 __u8 randomizer[16]; 645 __u8 rand[16];
633} __packed; 646} __packed;
634 647
635#define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433 648#define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433
@@ -721,9 +734,9 @@ struct hci_rp_set_csb {
721struct hci_cp_remote_oob_ext_data_reply { 734struct hci_cp_remote_oob_ext_data_reply {
722 bdaddr_t bdaddr; 735 bdaddr_t bdaddr;
723 __u8 hash192[16]; 736 __u8 hash192[16];
724 __u8 randomizer192[16]; 737 __u8 rand192[16];
725 __u8 hash256[16]; 738 __u8 hash256[16];
726 __u8 randomizer256[16]; 739 __u8 rand256[16];
727} __packed; 740} __packed;
728 741
729#define HCI_OP_SNIFF_MODE 0x0803 742#define HCI_OP_SNIFF_MODE 0x0803
@@ -930,7 +943,7 @@ struct hci_cp_write_ssp_mode {
930struct hci_rp_read_local_oob_data { 943struct hci_rp_read_local_oob_data {
931 __u8 status; 944 __u8 status;
932 __u8 hash[16]; 945 __u8 hash[16];
933 __u8 randomizer[16]; 946 __u8 rand[16];
934} __packed; 947} __packed;
935 948
936#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 949#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
@@ -1014,9 +1027,9 @@ struct hci_cp_write_sc_support {
1014struct hci_rp_read_local_oob_ext_data { 1027struct hci_rp_read_local_oob_ext_data {
1015 __u8 status; 1028 __u8 status;
1016 __u8 hash192[16]; 1029 __u8 hash192[16];
1017 __u8 randomizer192[16]; 1030 __u8 rand192[16];
1018 __u8 hash256[16]; 1031 __u8 hash256[16];
1019 __u8 randomizer256[16]; 1032 __u8 rand256[16];
1020} __packed; 1033} __packed;
1021 1034
1022#define HCI_OP_READ_LOCAL_VERSION 0x1001 1035#define HCI_OP_READ_LOCAL_VERSION 0x1001
@@ -1463,6 +1476,11 @@ struct hci_ev_cmd_status {
1463 __le16 opcode; 1476 __le16 opcode;
1464} __packed; 1477} __packed;
1465 1478
1479#define HCI_EV_HARDWARE_ERROR 0x10
1480struct hci_ev_hardware_error {
1481 __u8 code;
1482} __packed;
1483
1466#define HCI_EV_ROLE_CHANGE 0x12 1484#define HCI_EV_ROLE_CHANGE 0x12
1467struct hci_ev_role_change { 1485struct hci_ev_role_change {
1468 __u8 status; 1486 __u8 status;
@@ -1734,6 +1752,25 @@ struct hci_ev_le_conn_complete {
1734 __u8 clk_accurancy; 1752 __u8 clk_accurancy;
1735} __packed; 1753} __packed;
1736 1754
1755/* Advertising report event types */
1756#define LE_ADV_IND 0x00
1757#define LE_ADV_DIRECT_IND 0x01
1758#define LE_ADV_SCAN_IND 0x02
1759#define LE_ADV_NONCONN_IND 0x03
1760#define LE_ADV_SCAN_RSP 0x04
1761
1762#define ADDR_LE_DEV_PUBLIC 0x00
1763#define ADDR_LE_DEV_RANDOM 0x01
1764
1765#define HCI_EV_LE_ADVERTISING_REPORT 0x02
1766struct hci_ev_le_advertising_info {
1767 __u8 evt_type;
1768 __u8 bdaddr_type;
1769 bdaddr_t bdaddr;
1770 __u8 length;
1771 __u8 data[0];
1772} __packed;
1773
1737#define HCI_EV_LE_CONN_UPDATE_COMPLETE 0x03 1774#define HCI_EV_LE_CONN_UPDATE_COMPLETE 0x03
1738struct hci_ev_le_conn_update_complete { 1775struct hci_ev_le_conn_update_complete {
1739 __u8 status; 1776 __u8 status;
@@ -1759,23 +1796,14 @@ struct hci_ev_le_remote_conn_param_req {
1759 __le16 timeout; 1796 __le16 timeout;
1760} __packed; 1797} __packed;
1761 1798
1762/* Advertising report event types */ 1799#define HCI_EV_LE_DIRECT_ADV_REPORT 0x0B
1763#define LE_ADV_IND 0x00 1800struct hci_ev_le_direct_adv_info {
1764#define LE_ADV_DIRECT_IND 0x01
1765#define LE_ADV_SCAN_IND 0x02
1766#define LE_ADV_NONCONN_IND 0x03
1767#define LE_ADV_SCAN_RSP 0x04
1768
1769#define ADDR_LE_DEV_PUBLIC 0x00
1770#define ADDR_LE_DEV_RANDOM 0x01
1771
1772#define HCI_EV_LE_ADVERTISING_REPORT 0x02
1773struct hci_ev_le_advertising_info {
1774 __u8 evt_type; 1801 __u8 evt_type;
1775 __u8 bdaddr_type; 1802 __u8 bdaddr_type;
1776 bdaddr_t bdaddr; 1803 bdaddr_t bdaddr;
1777 __u8 length; 1804 __u8 direct_addr_type;
1778 __u8 data[0]; 1805 bdaddr_t direct_addr;
1806 __s8 rssi;
1779} __packed; 1807} __packed;
1780 1808
1781/* Internal events generated by Bluetooth stack */ 1809/* Internal events generated by Bluetooth stack */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 37ff1aef0845..3c7827005c25 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -75,6 +75,10 @@ struct discovery_state {
75 u32 last_adv_flags; 75 u32 last_adv_flags;
76 u8 last_adv_data[HCI_MAX_AD_LENGTH]; 76 u8 last_adv_data[HCI_MAX_AD_LENGTH];
77 u8 last_adv_data_len; 77 u8 last_adv_data_len;
78 bool report_invalid_rssi;
79 s8 rssi;
80 u16 uuid_count;
81 u8 (*uuids)[16];
78}; 82};
79 83
80struct hci_conn_hash { 84struct hci_conn_hash {
@@ -108,6 +112,7 @@ struct smp_csrk {
108 112
109struct smp_ltk { 113struct smp_ltk {
110 struct list_head list; 114 struct list_head list;
115 struct rcu_head rcu;
111 bdaddr_t bdaddr; 116 bdaddr_t bdaddr;
112 u8 bdaddr_type; 117 u8 bdaddr_type;
113 u8 authenticated; 118 u8 authenticated;
@@ -120,6 +125,7 @@ struct smp_ltk {
120 125
121struct smp_irk { 126struct smp_irk {
122 struct list_head list; 127 struct list_head list;
128 struct rcu_head rcu;
123 bdaddr_t rpa; 129 bdaddr_t rpa;
124 bdaddr_t bdaddr; 130 bdaddr_t bdaddr;
125 u8 addr_type; 131 u8 addr_type;
@@ -128,6 +134,7 @@ struct smp_irk {
128 134
129struct link_key { 135struct link_key {
130 struct list_head list; 136 struct list_head list;
137 struct rcu_head rcu;
131 bdaddr_t bdaddr; 138 bdaddr_t bdaddr;
132 u8 type; 139 u8 type;
133 u8 val[HCI_LINK_KEY_SIZE]; 140 u8 val[HCI_LINK_KEY_SIZE];
@@ -137,10 +144,11 @@ struct link_key {
137struct oob_data { 144struct oob_data {
138 struct list_head list; 145 struct list_head list;
139 bdaddr_t bdaddr; 146 bdaddr_t bdaddr;
147 u8 bdaddr_type;
140 u8 hash192[16]; 148 u8 hash192[16];
141 u8 randomizer192[16]; 149 u8 rand192[16];
142 u8 hash256[16]; 150 u8 hash256[16];
143 u8 randomizer256[16]; 151 u8 rand256[16];
144}; 152};
145 153
146#define HCI_MAX_SHORT_NAME_LENGTH 10 154#define HCI_MAX_SHORT_NAME_LENGTH 10
@@ -303,6 +311,7 @@ struct hci_dev {
303 __u32 req_result; 311 __u32 req_result;
304 312
305 void *smp_data; 313 void *smp_data;
314 void *smp_bredr_data;
306 315
307 struct discovery_state discovery; 316 struct discovery_state discovery;
308 struct hci_conn_hash conn_hash; 317 struct hci_conn_hash conn_hash;
@@ -398,6 +407,8 @@ struct hci_conn {
398 __u16 le_conn_interval; 407 __u16 le_conn_interval;
399 __u16 le_conn_latency; 408 __u16 le_conn_latency;
400 __u16 le_supv_timeout; 409 __u16 le_supv_timeout;
410 __u8 le_adv_data[HCI_MAX_AD_LENGTH];
411 __u8 le_adv_data_len;
401 __s8 rssi; 412 __s8 rssi;
402 __s8 tx_power; 413 __s8 tx_power;
403 __s8 max_tx_power; 414 __s8 max_tx_power;
@@ -496,6 +507,17 @@ static inline void discovery_init(struct hci_dev *hdev)
496 INIT_LIST_HEAD(&hdev->discovery.all); 507 INIT_LIST_HEAD(&hdev->discovery.all);
497 INIT_LIST_HEAD(&hdev->discovery.unknown); 508 INIT_LIST_HEAD(&hdev->discovery.unknown);
498 INIT_LIST_HEAD(&hdev->discovery.resolve); 509 INIT_LIST_HEAD(&hdev->discovery.resolve);
510 hdev->discovery.report_invalid_rssi = true;
511 hdev->discovery.rssi = HCI_RSSI_INVALID;
512}
513
514static inline void hci_discovery_filter_clear(struct hci_dev *hdev)
515{
516 hdev->discovery.report_invalid_rssi = true;
517 hdev->discovery.rssi = HCI_RSSI_INVALID;
518 hdev->discovery.uuid_count = 0;
519 kfree(hdev->discovery.uuids);
520 hdev->discovery.uuids = NULL;
499} 521}
500 522
501bool hci_discovery_active(struct hci_dev *hdev); 523bool hci_discovery_active(struct hci_dev *hdev);
@@ -553,6 +575,8 @@ enum {
553 HCI_CONN_STK_ENCRYPT, 575 HCI_CONN_STK_ENCRYPT,
554 HCI_CONN_AUTH_INITIATOR, 576 HCI_CONN_AUTH_INITIATOR,
555 HCI_CONN_DROP, 577 HCI_CONN_DROP,
578 HCI_CONN_PARAM_REMOVAL_PEND,
579 HCI_CONN_NEW_LINK_KEY,
556}; 580};
557 581
558static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) 582static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
@@ -643,6 +667,26 @@ static inline unsigned int hci_conn_count(struct hci_dev *hdev)
643 return c->acl_num + c->amp_num + c->sco_num + c->le_num; 667 return c->acl_num + c->amp_num + c->sco_num + c->le_num;
644} 668}
645 669
670static inline __u8 hci_conn_lookup_type(struct hci_dev *hdev, __u16 handle)
671{
672 struct hci_conn_hash *h = &hdev->conn_hash;
673 struct hci_conn *c;
674 __u8 type = INVALID_LINK;
675
676 rcu_read_lock();
677
678 list_for_each_entry_rcu(c, &h->list, list) {
679 if (c->handle == handle) {
680 type = c->type;
681 break;
682 }
683 }
684
685 rcu_read_unlock();
686
687 return type;
688}
689
646static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, 690static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
647 __u16 handle) 691 __u16 handle)
648{ 692{
@@ -853,6 +897,7 @@ int hci_register_dev(struct hci_dev *hdev);
853void hci_unregister_dev(struct hci_dev *hdev); 897void hci_unregister_dev(struct hci_dev *hdev);
854int hci_suspend_dev(struct hci_dev *hdev); 898int hci_suspend_dev(struct hci_dev *hdev);
855int hci_resume_dev(struct hci_dev *hdev); 899int hci_resume_dev(struct hci_dev *hdev);
900int hci_reset_dev(struct hci_dev *hdev);
856int hci_dev_open(__u16 dev); 901int hci_dev_open(__u16 dev);
857int hci_dev_close(__u16 dev); 902int hci_dev_close(__u16 dev);
858int hci_dev_reset(__u16 dev); 903int hci_dev_reset(__u16 dev);
@@ -894,13 +939,11 @@ struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
894struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, 939struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
895 bdaddr_t *bdaddr, u8 *val, u8 type, 940 bdaddr_t *bdaddr, u8 *val, u8 type,
896 u8 pin_len, bool *persistent); 941 u8 pin_len, bool *persistent);
897struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, __le64 rand,
898 u8 role);
899struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, 942struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
900 u8 addr_type, u8 type, u8 authenticated, 943 u8 addr_type, u8 type, u8 authenticated,
901 u8 tk[16], u8 enc_size, __le16 ediv, __le64 rand); 944 u8 tk[16], u8 enc_size, __le16 ediv, __le64 rand);
902struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, 945struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
903 u8 addr_type, u8 role); 946 u8 addr_type, u8 role);
904int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type); 947int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type);
905void hci_smp_ltks_clear(struct hci_dev *hdev); 948void hci_smp_ltks_clear(struct hci_dev *hdev);
906int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 949int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
@@ -915,13 +958,12 @@ void hci_smp_irks_clear(struct hci_dev *hdev);
915 958
916void hci_remote_oob_data_clear(struct hci_dev *hdev); 959void hci_remote_oob_data_clear(struct hci_dev *hdev);
917struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, 960struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev,
918 bdaddr_t *bdaddr); 961 bdaddr_t *bdaddr, u8 bdaddr_type);
919int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, 962int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
920 u8 *hash, u8 *randomizer); 963 u8 bdaddr_type, u8 *hash192, u8 *rand192,
921int hci_add_remote_oob_ext_data(struct hci_dev *hdev, bdaddr_t *bdaddr, 964 u8 *hash256, u8 *rand256);
922 u8 *hash192, u8 *randomizer192, 965int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
923 u8 *hash256, u8 *randomizer256); 966 u8 bdaddr_type);
924int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
925 967
926void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 968void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
927 969
@@ -972,6 +1014,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
972 1014
973#define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \ 1015#define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \
974 !test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) 1016 !test_bit(HCI_AUTO_OFF, &hdev->dev_flags))
1017#define bredr_sc_enabled(dev) ((lmp_sc_capable(dev) || \
1018 test_bit(HCI_FORCE_SC, &(dev)->dbg_flags)) && \
1019 test_bit(HCI_SC_ENABLED, &(dev)->dev_flags))
975 1020
976/* ----- HCI protocols ----- */ 1021/* ----- HCI protocols ----- */
977#define HCI_PROTO_DEFER 0x01 1022#define HCI_PROTO_DEFER 0x01
@@ -1310,9 +1355,8 @@ int mgmt_update_adv_data(struct hci_dev *hdev);
1310void mgmt_discoverable_timeout(struct hci_dev *hdev); 1355void mgmt_discoverable_timeout(struct hci_dev *hdev);
1311void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 1356void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
1312 bool persistent); 1357 bool persistent);
1313void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1358void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,
1314 u8 addr_type, u32 flags, u8 *name, u8 name_len, 1359 u32 flags, u8 *name, u8 name_len);
1315 u8 *dev_class);
1316void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, 1360void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
1317 u8 link_type, u8 addr_type, u8 reason, 1361 u8 link_type, u8 addr_type, u8 reason,
1318 bool mgmt_connected); 1362 bool mgmt_connected);
@@ -1349,8 +1393,8 @@ void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1349 u8 status); 1393 u8 status);
1350void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1394void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
1351void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192, 1395void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
1352 u8 *randomizer192, u8 *hash256, 1396 u8 *rand192, u8 *hash256, u8 *rand256,
1353 u8 *randomizer256, u8 status); 1397 u8 status);
1354void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1398void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1355 u8 addr_type, u8 *dev_class, s8 rssi, u32 flags, 1399 u8 addr_type, u8 *dev_class, s8 rssi, u32 flags,
1356 u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len); 1400 u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len);
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index ead99f032f7a..d1bb342d083f 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -28,6 +28,7 @@
28#define __L2CAP_H 28#define __L2CAP_H
29 29
30#include <asm/unaligned.h> 30#include <asm/unaligned.h>
31#include <linux/atomic.h>
31 32
32/* L2CAP defaults */ 33/* L2CAP defaults */
33#define L2CAP_DEFAULT_MTU 672 34#define L2CAP_DEFAULT_MTU 672
@@ -140,6 +141,7 @@ struct l2cap_conninfo {
140#define L2CAP_FC_ATT 0x10 141#define L2CAP_FC_ATT 0x10
141#define L2CAP_FC_SIG_LE 0x20 142#define L2CAP_FC_SIG_LE 0x20
142#define L2CAP_FC_SMP_LE 0x40 143#define L2CAP_FC_SMP_LE 0x40
144#define L2CAP_FC_SMP_BREDR 0x80
143 145
144/* L2CAP Control Field bit masks */ 146/* L2CAP Control Field bit masks */
145#define L2CAP_CTRL_SAR 0xC000 147#define L2CAP_CTRL_SAR 0xC000
@@ -254,6 +256,7 @@ struct l2cap_conn_rsp {
254#define L2CAP_CID_ATT 0x0004 256#define L2CAP_CID_ATT 0x0004
255#define L2CAP_CID_LE_SIGNALING 0x0005 257#define L2CAP_CID_LE_SIGNALING 0x0005
256#define L2CAP_CID_SMP 0x0006 258#define L2CAP_CID_SMP 0x0006
259#define L2CAP_CID_SMP_BREDR 0x0007
257#define L2CAP_CID_DYN_START 0x0040 260#define L2CAP_CID_DYN_START 0x0040
258#define L2CAP_CID_DYN_END 0xffff 261#define L2CAP_CID_DYN_END 0xffff
259#define L2CAP_CID_LE_DYN_END 0x007f 262#define L2CAP_CID_LE_DYN_END 0x007f
@@ -481,6 +484,7 @@ struct l2cap_chan {
481 struct hci_conn *hs_hcon; 484 struct hci_conn *hs_hcon;
482 struct hci_chan *hs_hchan; 485 struct hci_chan *hs_hchan;
483 struct kref kref; 486 struct kref kref;
487 atomic_t nesting;
484 488
485 __u8 state; 489 __u8 state;
486 490
@@ -604,10 +608,6 @@ struct l2cap_ops {
604 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, 608 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
605 unsigned long hdr_len, 609 unsigned long hdr_len,
606 unsigned long len, int nb); 610 unsigned long len, int nb);
607 int (*memcpy_fromiovec) (struct l2cap_chan *chan,
608 unsigned char *kdata,
609 struct iovec *iov,
610 int len);
611}; 611};
612 612
613struct l2cap_conn { 613struct l2cap_conn {
@@ -617,8 +617,8 @@ struct l2cap_conn {
617 unsigned int mtu; 617 unsigned int mtu;
618 618
619 __u32 feat_mask; 619 __u32 feat_mask;
620 __u8 fixed_chan_mask; 620 __u8 remote_fixed_chan;
621 bool hs_enabled; 621 __u8 local_fixed_chan;
622 622
623 __u8 info_state; 623 __u8 info_state;
624 __u8 info_ident; 624 __u8 info_ident;
@@ -713,6 +713,17 @@ enum {
713 FLAG_HOLD_HCI_CONN, 713 FLAG_HOLD_HCI_CONN,
714}; 714};
715 715
716/* Lock nesting levels for L2CAP channels. We need these because lockdep
717 * otherwise considers all channels equal and will e.g. complain about a
718 * connection oriented channel triggering SMP procedures or a listening
719 * channel creating and locking a child channel.
720 */
721enum {
722 L2CAP_NESTING_SMP,
723 L2CAP_NESTING_NORMAL,
724 L2CAP_NESTING_PARENT,
725};
726
716enum { 727enum {
717 L2CAP_TX_STATE_XMIT, 728 L2CAP_TX_STATE_XMIT,
718 L2CAP_TX_STATE_WAIT_F, 729 L2CAP_TX_STATE_WAIT_F,
@@ -778,7 +789,7 @@ void l2cap_chan_put(struct l2cap_chan *c);
778 789
779static inline void l2cap_chan_lock(struct l2cap_chan *chan) 790static inline void l2cap_chan_lock(struct l2cap_chan *chan)
780{ 791{
781 mutex_lock(&chan->lock); 792 mutex_lock_nested(&chan->lock, atomic_read(&chan->nesting));
782} 793}
783 794
784static inline void l2cap_chan_unlock(struct l2cap_chan *chan) 795static inline void l2cap_chan_unlock(struct l2cap_chan *chan)
@@ -890,31 +901,6 @@ static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan)
890 return 0; 901 return 0;
891} 902}
892 903
893static inline int l2cap_chan_no_memcpy_fromiovec(struct l2cap_chan *chan,
894 unsigned char *kdata,
895 struct iovec *iov,
896 int len)
897{
898 /* Following is safe since for compiler definitions of kvec and
899 * iovec are identical, yielding the same in-core layout and alignment
900 */
901 struct kvec *vec = (struct kvec *)iov;
902
903 while (len > 0) {
904 if (vec->iov_len) {
905 int copy = min_t(unsigned int, len, vec->iov_len);
906 memcpy(kdata, vec->iov_base, copy);
907 len -= copy;
908 kdata += copy;
909 vec->iov_base += copy;
910 vec->iov_len -= copy;
911 }
912 vec++;
913 }
914
915 return 0;
916}
917
918extern bool disable_ertm; 904extern bool disable_ertm;
919 905
920int l2cap_init_sockets(void); 906int l2cap_init_sockets(void);
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 414cd2f9a437..95c34d5180fa 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -184,6 +184,9 @@ struct mgmt_cp_load_link_keys {
184 184
185#define MGMT_LTK_UNAUTHENTICATED 0x00 185#define MGMT_LTK_UNAUTHENTICATED 0x00
186#define MGMT_LTK_AUTHENTICATED 0x01 186#define MGMT_LTK_AUTHENTICATED 0x01
187#define MGMT_LTK_P256_UNAUTH 0x02
188#define MGMT_LTK_P256_AUTH 0x03
189#define MGMT_LTK_P256_DEBUG 0x04
187 190
188struct mgmt_ltk_info { 191struct mgmt_ltk_info {
189 struct mgmt_addr_info addr; 192 struct mgmt_addr_info addr;
@@ -299,28 +302,28 @@ struct mgmt_cp_user_passkey_neg_reply {
299#define MGMT_READ_LOCAL_OOB_DATA_SIZE 0 302#define MGMT_READ_LOCAL_OOB_DATA_SIZE 0
300struct mgmt_rp_read_local_oob_data { 303struct mgmt_rp_read_local_oob_data {
301 __u8 hash[16]; 304 __u8 hash[16];
302 __u8 randomizer[16]; 305 __u8 rand[16];
303} __packed; 306} __packed;
304struct mgmt_rp_read_local_oob_ext_data { 307struct mgmt_rp_read_local_oob_ext_data {
305 __u8 hash192[16]; 308 __u8 hash192[16];
306 __u8 randomizer192[16]; 309 __u8 rand192[16];
307 __u8 hash256[16]; 310 __u8 hash256[16];
308 __u8 randomizer256[16]; 311 __u8 rand256[16];
309} __packed; 312} __packed;
310 313
311#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021 314#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021
312struct mgmt_cp_add_remote_oob_data { 315struct mgmt_cp_add_remote_oob_data {
313 struct mgmt_addr_info addr; 316 struct mgmt_addr_info addr;
314 __u8 hash[16]; 317 __u8 hash[16];
315 __u8 randomizer[16]; 318 __u8 rand[16];
316} __packed; 319} __packed;
317#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32) 320#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32)
318struct mgmt_cp_add_remote_oob_ext_data { 321struct mgmt_cp_add_remote_oob_ext_data {
319 struct mgmt_addr_info addr; 322 struct mgmt_addr_info addr;
320 __u8 hash192[16]; 323 __u8 hash192[16];
321 __u8 randomizer192[16]; 324 __u8 rand192[16];
322 __u8 hash256[16]; 325 __u8 hash256[16];
323 __u8 randomizer256[16]; 326 __u8 rand256[16];
324} __packed; 327} __packed;
325#define MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 64) 328#define MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 64)
326 329
@@ -495,6 +498,15 @@ struct mgmt_cp_set_public_address {
495} __packed; 498} __packed;
496#define MGMT_SET_PUBLIC_ADDRESS_SIZE 6 499#define MGMT_SET_PUBLIC_ADDRESS_SIZE 6
497 500
501#define MGMT_OP_START_SERVICE_DISCOVERY 0x003A
502struct mgmt_cp_start_service_discovery {
503 __u8 type;
504 __s8 rssi;
505 __le16 uuid_count;
506 __u8 uuids[0][16];
507} __packed;
508#define MGMT_START_SERVICE_DISCOVERY_SIZE 4
509
498#define MGMT_EV_CMD_COMPLETE 0x0001 510#define MGMT_EV_CMD_COMPLETE 0x0001
499struct mgmt_ev_cmd_complete { 511struct mgmt_ev_cmd_complete {
500 __le16 opcode; 512 __le16 opcode;
diff --git a/include/net/bond_3ad.h b/include/net/bond_3ad.h
new file mode 100644
index 000000000000..e01d903633ef
--- /dev/null
+++ b/include/net/bond_3ad.h
@@ -0,0 +1,283 @@
1/*
2 * Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
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 as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
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., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
20 *
21 */
22
23#ifndef _NET_BOND_3AD_H
24#define _NET_BOND_3AD_H
25
26#include <asm/byteorder.h>
27#include <linux/skbuff.h>
28#include <linux/netdevice.h>
29#include <linux/if_ether.h>
30
31/* General definitions */
32#define PKT_TYPE_LACPDU cpu_to_be16(ETH_P_SLOW)
33#define AD_TIMER_INTERVAL 100 /*msec*/
34
35#define MULTICAST_LACPDU_ADDR {0x01, 0x80, 0xC2, 0x00, 0x00, 0x02}
36
37#define AD_LACP_SLOW 0
38#define AD_LACP_FAST 1
39
40typedef struct mac_addr {
41 u8 mac_addr_value[ETH_ALEN];
42} __packed mac_addr_t;
43
44enum {
45 BOND_AD_STABLE = 0,
46 BOND_AD_BANDWIDTH = 1,
47 BOND_AD_COUNT = 2,
48};
49
50/* rx machine states(43.4.11 in the 802.3ad standard) */
51typedef enum {
52 AD_RX_DUMMY,
53 AD_RX_INITIALIZE, /* rx Machine */
54 AD_RX_PORT_DISABLED, /* rx Machine */
55 AD_RX_LACP_DISABLED, /* rx Machine */
56 AD_RX_EXPIRED, /* rx Machine */
57 AD_RX_DEFAULTED, /* rx Machine */
58 AD_RX_CURRENT /* rx Machine */
59} rx_states_t;
60
61/* periodic machine states(43.4.12 in the 802.3ad standard) */
62typedef enum {
63 AD_PERIODIC_DUMMY,
64 AD_NO_PERIODIC, /* periodic machine */
65 AD_FAST_PERIODIC, /* periodic machine */
66 AD_SLOW_PERIODIC, /* periodic machine */
67 AD_PERIODIC_TX /* periodic machine */
68} periodic_states_t;
69
70/* mux machine states(43.4.13 in the 802.3ad standard) */
71typedef enum {
72 AD_MUX_DUMMY,
73 AD_MUX_DETACHED, /* mux machine */
74 AD_MUX_WAITING, /* mux machine */
75 AD_MUX_ATTACHED, /* mux machine */
76 AD_MUX_COLLECTING_DISTRIBUTING /* mux machine */
77} mux_states_t;
78
79/* tx machine states(43.4.15 in the 802.3ad standard) */
80typedef enum {
81 AD_TX_DUMMY,
82 AD_TRANSMIT /* tx Machine */
83} tx_states_t;
84
85/* rx indication types */
86typedef enum {
87 AD_TYPE_LACPDU = 1, /* type lacpdu */
88 AD_TYPE_MARKER /* type marker */
89} pdu_type_t;
90
91/* rx marker indication types */
92typedef enum {
93 AD_MARKER_INFORMATION_SUBTYPE = 1, /* marker imformation subtype */
94 AD_MARKER_RESPONSE_SUBTYPE /* marker response subtype */
95} bond_marker_subtype_t;
96
97/* timers types(43.4.9 in the 802.3ad standard) */
98typedef enum {
99 AD_CURRENT_WHILE_TIMER,
100 AD_ACTOR_CHURN_TIMER,
101 AD_PERIODIC_TIMER,
102 AD_PARTNER_CHURN_TIMER,
103 AD_WAIT_WHILE_TIMER
104} ad_timers_t;
105
106#pragma pack(1)
107
108/* Link Aggregation Control Protocol(LACP) data unit structure(43.4.2.2 in the 802.3ad standard) */
109typedef struct lacpdu {
110 u8 subtype; /* = LACP(= 0x01) */
111 u8 version_number;
112 u8 tlv_type_actor_info; /* = actor information(type/length/value) */
113 u8 actor_information_length; /* = 20 */
114 __be16 actor_system_priority;
115 struct mac_addr actor_system;
116 __be16 actor_key;
117 __be16 actor_port_priority;
118 __be16 actor_port;
119 u8 actor_state;
120 u8 reserved_3_1[3]; /* = 0 */
121 u8 tlv_type_partner_info; /* = partner information */
122 u8 partner_information_length; /* = 20 */
123 __be16 partner_system_priority;
124 struct mac_addr partner_system;
125 __be16 partner_key;
126 __be16 partner_port_priority;
127 __be16 partner_port;
128 u8 partner_state;
129 u8 reserved_3_2[3]; /* = 0 */
130 u8 tlv_type_collector_info; /* = collector information */
131 u8 collector_information_length;/* = 16 */
132 __be16 collector_max_delay;
133 u8 reserved_12[12];
134 u8 tlv_type_terminator; /* = terminator */
135 u8 terminator_length; /* = 0 */
136 u8 reserved_50[50]; /* = 0 */
137} __packed lacpdu_t;
138
139typedef struct lacpdu_header {
140 struct ethhdr hdr;
141 struct lacpdu lacpdu;
142} __packed lacpdu_header_t;
143
144/* Marker Protocol Data Unit(PDU) structure(43.5.3.2 in the 802.3ad standard) */
145typedef struct bond_marker {
146 u8 subtype; /* = 0x02 (marker PDU) */
147 u8 version_number; /* = 0x01 */
148 u8 tlv_type; /* = 0x01 (marker information) */
149 /* = 0x02 (marker response information) */
150 u8 marker_length; /* = 0x16 */
151 u16 requester_port; /* The number assigned to the port by the requester */
152 struct mac_addr requester_system; /* The requester's system id */
153 u32 requester_transaction_id; /* The transaction id allocated by the requester, */
154 u16 pad; /* = 0 */
155 u8 tlv_type_terminator; /* = 0x00 */
156 u8 terminator_length; /* = 0x00 */
157 u8 reserved_90[90]; /* = 0 */
158} __packed bond_marker_t;
159
160typedef struct bond_marker_header {
161 struct ethhdr hdr;
162 struct bond_marker marker;
163} __packed bond_marker_header_t;
164
165#pragma pack()
166
167struct slave;
168struct bonding;
169struct ad_info;
170struct port;
171
172#ifdef __ia64__
173#pragma pack(8)
174#endif
175
176/* aggregator structure(43.4.5 in the 802.3ad standard) */
177typedef struct aggregator {
178 struct mac_addr aggregator_mac_address;
179 u16 aggregator_identifier;
180 bool is_individual;
181 u16 actor_admin_aggregator_key;
182 u16 actor_oper_aggregator_key;
183 struct mac_addr partner_system;
184 u16 partner_system_priority;
185 u16 partner_oper_aggregator_key;
186 u16 receive_state; /* BOOLEAN */
187 u16 transmit_state; /* BOOLEAN */
188 struct port *lag_ports;
189 /* ****** PRIVATE PARAMETERS ****** */
190 struct slave *slave; /* pointer to the bond slave that this aggregator belongs to */
191 u16 is_active; /* BOOLEAN. Indicates if this aggregator is active */
192 u16 num_of_ports;
193} aggregator_t;
194
195struct port_params {
196 struct mac_addr system;
197 u16 system_priority;
198 u16 key;
199 u16 port_number;
200 u16 port_priority;
201 u16 port_state;
202};
203
204/* port structure(43.4.6 in the 802.3ad standard) */
205typedef struct port {
206 u16 actor_port_number;
207 u16 actor_port_priority;
208 struct mac_addr actor_system; /* This parameter is added here although it is not specified in the standard, just for simplification */
209 u16 actor_system_priority; /* This parameter is added here although it is not specified in the standard, just for simplification */
210 u16 actor_port_aggregator_identifier;
211 bool ntt;
212 u16 actor_admin_port_key;
213 u16 actor_oper_port_key;
214 u8 actor_admin_port_state;
215 u8 actor_oper_port_state;
216
217 struct port_params partner_admin;
218 struct port_params partner_oper;
219
220 bool is_enabled;
221
222 /* ****** PRIVATE PARAMETERS ****** */
223 u16 sm_vars; /* all state machines variables for this port */
224 rx_states_t sm_rx_state; /* state machine rx state */
225 u16 sm_rx_timer_counter; /* state machine rx timer counter */
226 periodic_states_t sm_periodic_state; /* state machine periodic state */
227 u16 sm_periodic_timer_counter; /* state machine periodic timer counter */
228 mux_states_t sm_mux_state; /* state machine mux state */
229 u16 sm_mux_timer_counter; /* state machine mux timer counter */
230 tx_states_t sm_tx_state; /* state machine tx state */
231 u16 sm_tx_timer_counter; /* state machine tx timer counter(allways on - enter to transmit state 3 time per second) */
232 struct slave *slave; /* pointer to the bond slave that this port belongs to */
233 struct aggregator *aggregator; /* pointer to an aggregator that this port related to */
234 struct port *next_port_in_aggregator; /* Next port on the linked list of the parent aggregator */
235 u32 transaction_id; /* continuous number for identification of Marker PDU's; */
236 struct lacpdu lacpdu; /* the lacpdu that will be sent for this port */
237} port_t;
238
239/* system structure */
240struct ad_system {
241 u16 sys_priority;
242 struct mac_addr sys_mac_addr;
243};
244
245#ifdef __ia64__
246#pragma pack()
247#endif
248
249/* ========== AD Exported structures to the main bonding code ========== */
250#define BOND_AD_INFO(bond) ((bond)->ad_info)
251#define SLAVE_AD_INFO(slave) ((slave)->ad_info)
252
253struct ad_bond_info {
254 struct ad_system system; /* 802.3ad system structure */
255 u32 agg_select_timer; /* Timer to select aggregator after all adapter's hand shakes */
256 u16 aggregator_identifier;
257};
258
259struct ad_slave_info {
260 struct aggregator aggregator; /* 802.3ad aggregator structure */
261 struct port port; /* 802.3ad port structure */
262 u16 id;
263};
264
265/* ========== AD Exported functions to the main bonding code ========== */
266void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution);
267void bond_3ad_bind_slave(struct slave *slave);
268void bond_3ad_unbind_slave(struct slave *slave);
269void bond_3ad_state_machine_handler(struct work_struct *);
270void bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout);
271void bond_3ad_adapter_speed_changed(struct slave *slave);
272void bond_3ad_adapter_duplex_changed(struct slave *slave);
273void bond_3ad_handle_link_change(struct slave *slave, char link);
274int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info);
275int __bond_3ad_get_active_agg_info(struct bonding *bond,
276 struct ad_info *ad_info);
277int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev);
278int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,
279 struct slave *slave);
280int bond_3ad_set_carrier(struct bonding *bond);
281void bond_3ad_update_lacp_rate(struct bonding *bond);
282#endif /* _NET_BOND_3AD_H */
283
diff --git a/include/net/bond_alb.h b/include/net/bond_alb.h
new file mode 100644
index 000000000000..313a8d3b3069
--- /dev/null
+++ b/include/net/bond_alb.h
@@ -0,0 +1,181 @@
1/*
2 * Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
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 as published by the
6 * 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, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, see <http://www.gnu.org/licenses/>.
16 *
17 * The full GNU General Public License is included in this distribution in the
18 * file called LICENSE.
19 *
20 */
21
22#ifndef _NET_BOND_ALB_H
23#define _NET_BOND_ALB_H
24
25#include <linux/if_ether.h>
26
27struct bonding;
28struct slave;
29
30#define BOND_ALB_INFO(bond) ((bond)->alb_info)
31#define SLAVE_TLB_INFO(slave) ((slave)->tlb_info)
32
33#define ALB_TIMER_TICKS_PER_SEC 10 /* should be a divisor of HZ */
34#define BOND_TLB_REBALANCE_INTERVAL 10 /* In seconds, periodic re-balancing.
35 * Used for division - never set
36 * to zero !!!
37 */
38#define BOND_ALB_DEFAULT_LP_INTERVAL 1
39#define BOND_ALB_LP_INTERVAL(bond) (bond->params.lp_interval) /* In seconds, periodic send of
40 * learning packets to the switch
41 */
42
43#define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \
44 * ALB_TIMER_TICKS_PER_SEC)
45
46#define BOND_ALB_LP_TICKS(bond) (BOND_ALB_LP_INTERVAL(bond) \
47 * ALB_TIMER_TICKS_PER_SEC)
48
49#define TLB_HASH_TABLE_SIZE 256 /* The size of the clients hash table.
50 * Note that this value MUST NOT be smaller
51 * because the key hash table is BYTE wide !
52 */
53
54
55#define TLB_NULL_INDEX 0xffffffff
56
57/* rlb defs */
58#define RLB_HASH_TABLE_SIZE 256
59#define RLB_NULL_INDEX 0xffffffff
60#define RLB_UPDATE_DELAY (2*ALB_TIMER_TICKS_PER_SEC) /* 2 seconds */
61#define RLB_ARP_BURST_SIZE 2
62#define RLB_UPDATE_RETRY 3 /* 3-ticks - must be smaller than the rlb
63 * rebalance interval (5 min).
64 */
65/* RLB_PROMISC_TIMEOUT = 10 sec equals the time that the current slave is
66 * promiscuous after failover
67 */
68#define RLB_PROMISC_TIMEOUT (10*ALB_TIMER_TICKS_PER_SEC)
69
70
71struct tlb_client_info {
72 struct slave *tx_slave; /* A pointer to slave used for transmiting
73 * packets to a Client that the Hash function
74 * gave this entry index.
75 */
76 u32 tx_bytes; /* Each Client accumulates the BytesTx that
77 * were transmitted to it, and after each
78 * CallBack the LoadHistory is divided
79 * by the balance interval
80 */
81 u32 load_history; /* This field contains the amount of Bytes
82 * that were transmitted to this client by
83 * the server on the previous balance
84 * interval in Bps.
85 */
86 u32 next; /* The next Hash table entry index, assigned
87 * to use the same adapter for transmit.
88 */
89 u32 prev; /* The previous Hash table entry index,
90 * assigned to use the same
91 */
92};
93
94/* -------------------------------------------------------------------------
95 * struct rlb_client_info contains all info related to a specific rx client
96 * connection. This is the Clients Hash Table entry struct.
97 * Note that this is not a proper hash table; if a new client's IP address
98 * hash collides with an existing client entry, the old entry is replaced.
99 *
100 * There is a linked list (linked by the used_next and used_prev members)
101 * linking all the used entries of the hash table. This allows updating
102 * all the clients without walking over all the unused elements of the table.
103 *
104 * There are also linked lists of entries with identical hash(ip_src). These
105 * allow cleaning up the table from ip_src<->mac_src associations that have
106 * become outdated and would cause sending out invalid ARP updates to the
107 * network. These are linked by the (src_next and src_prev members).
108 * -------------------------------------------------------------------------
109 */
110struct rlb_client_info {
111 __be32 ip_src; /* the server IP address */
112 __be32 ip_dst; /* the client IP address */
113 u8 mac_src[ETH_ALEN]; /* the server MAC address */
114 u8 mac_dst[ETH_ALEN]; /* the client MAC address */
115
116 /* list of used hash table entries, starting at rx_hashtbl_used_head */
117 u32 used_next;
118 u32 used_prev;
119
120 /* ip_src based hashing */
121 u32 src_next; /* next entry with same hash(ip_src) */
122 u32 src_prev; /* prev entry with same hash(ip_src) */
123 u32 src_first; /* first entry with hash(ip_src) == this entry's index */
124
125 u8 assigned; /* checking whether this entry is assigned */
126 u8 ntt; /* flag - need to transmit client info */
127 struct slave *slave; /* the slave assigned to this client */
128 unsigned short vlan_id; /* VLAN tag associated with IP address */
129};
130
131struct tlb_slave_info {
132 u32 head; /* Index to the head of the bi-directional clients
133 * hash table entries list. The entries in the list
134 * are the entries that were assigned to use this
135 * slave for transmit.
136 */
137 u32 load; /* Each slave sums the loadHistory of all clients
138 * assigned to it
139 */
140};
141
142struct alb_bond_info {
143 struct tlb_client_info *tx_hashtbl; /* Dynamically allocated */
144 u32 unbalanced_load;
145 int tx_rebalance_counter;
146 int lp_counter;
147 /* -------- rlb parameters -------- */
148 int rlb_enabled;
149 struct rlb_client_info *rx_hashtbl; /* Receive hash table */
150 u32 rx_hashtbl_used_head;
151 u8 rx_ntt; /* flag - need to transmit
152 * to all rx clients
153 */
154 struct slave *rx_slave;/* last slave to xmit from */
155 u8 primary_is_promisc; /* boolean */
156 u32 rlb_promisc_timeout_counter;/* counts primary
157 * promiscuity time
158 */
159 u32 rlb_update_delay_counter;
160 u32 rlb_update_retry_counter;/* counter of retries
161 * of client update
162 */
163 u8 rlb_rebalance; /* flag - indicates that the
164 * rx traffic should be
165 * rebalanced
166 */
167};
168
169int bond_alb_initialize(struct bonding *bond, int rlb_enabled);
170void bond_alb_deinitialize(struct bonding *bond);
171int bond_alb_init_slave(struct bonding *bond, struct slave *slave);
172void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave);
173void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char link);
174void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave);
175int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev);
176int bond_tlb_xmit(struct sk_buff *skb, struct net_device *bond_dev);
177void bond_alb_monitor(struct work_struct *);
178int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr);
179void bond_alb_clear_vlan(struct bonding *bond, unsigned short vlan_id);
180#endif /* _NET_BOND_ALB_H */
181
diff --git a/include/net/bond_options.h b/include/net/bond_options.h
new file mode 100644
index 000000000000..ea6546d2c946
--- /dev/null
+++ b/include/net/bond_options.h
@@ -0,0 +1,130 @@
1/*
2 * drivers/net/bond/bond_options.h - bonding options
3 * Copyright (c) 2013 Nikolay Aleksandrov <nikolay@redhat.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 as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 */
10
11#ifndef _NET_BOND_OPTIONS_H
12#define _NET_BOND_OPTIONS_H
13
14#define BOND_OPT_MAX_NAMELEN 32
15#define BOND_OPT_VALID(opt) ((opt) < BOND_OPT_LAST)
16#define BOND_MODE_ALL_EX(x) (~(x))
17
18/* Option flags:
19 * BOND_OPTFLAG_NOSLAVES - check if the bond device is empty before setting
20 * BOND_OPTFLAG_IFDOWN - check if the bond device is down before setting
21 * BOND_OPTFLAG_RAWVAL - the option parses the value itself
22 */
23enum {
24 BOND_OPTFLAG_NOSLAVES = BIT(0),
25 BOND_OPTFLAG_IFDOWN = BIT(1),
26 BOND_OPTFLAG_RAWVAL = BIT(2)
27};
28
29/* Value type flags:
30 * BOND_VALFLAG_DEFAULT - mark the value as default
31 * BOND_VALFLAG_(MIN|MAX) - mark the value as min/max
32 */
33enum {
34 BOND_VALFLAG_DEFAULT = BIT(0),
35 BOND_VALFLAG_MIN = BIT(1),
36 BOND_VALFLAG_MAX = BIT(2)
37};
38
39/* Option IDs, their bit positions correspond to their IDs */
40enum {
41 BOND_OPT_MODE,
42 BOND_OPT_PACKETS_PER_SLAVE,
43 BOND_OPT_XMIT_HASH,
44 BOND_OPT_ARP_VALIDATE,
45 BOND_OPT_ARP_ALL_TARGETS,
46 BOND_OPT_FAIL_OVER_MAC,
47 BOND_OPT_ARP_INTERVAL,
48 BOND_OPT_ARP_TARGETS,
49 BOND_OPT_DOWNDELAY,
50 BOND_OPT_UPDELAY,
51 BOND_OPT_LACP_RATE,
52 BOND_OPT_MINLINKS,
53 BOND_OPT_AD_SELECT,
54 BOND_OPT_NUM_PEER_NOTIF,
55 BOND_OPT_MIIMON,
56 BOND_OPT_PRIMARY,
57 BOND_OPT_PRIMARY_RESELECT,
58 BOND_OPT_USE_CARRIER,
59 BOND_OPT_ACTIVE_SLAVE,
60 BOND_OPT_QUEUE_ID,
61 BOND_OPT_ALL_SLAVES_ACTIVE,
62 BOND_OPT_RESEND_IGMP,
63 BOND_OPT_LP_INTERVAL,
64 BOND_OPT_SLAVES,
65 BOND_OPT_TLB_DYNAMIC_LB,
66 BOND_OPT_LAST
67};
68
69/* This structure is used for storing option values and for passing option
70 * values when changing an option. The logic when used as an arg is as follows:
71 * - if string != NULL -> parse it, if the opt is RAW type then return it, else
72 * return the parse result
73 * - if string == NULL -> parse value
74 */
75struct bond_opt_value {
76 char *string;
77 u64 value;
78 u32 flags;
79};
80
81struct bonding;
82
83struct bond_option {
84 int id;
85 const char *name;
86 const char *desc;
87 u32 flags;
88
89 /* unsuppmodes is used to denote modes in which the option isn't
90 * supported.
91 */
92 unsigned long unsuppmodes;
93 /* supported values which this option can have, can be a subset of
94 * BOND_OPTVAL_RANGE's value range
95 */
96 const struct bond_opt_value *values;
97
98 int (*set)(struct bonding *bond, const struct bond_opt_value *val);
99};
100
101int __bond_opt_set(struct bonding *bond, unsigned int option,
102 struct bond_opt_value *val);
103int bond_opt_tryset_rtnl(struct bonding *bond, unsigned int option, char *buf);
104
105const struct bond_opt_value *bond_opt_parse(const struct bond_option *opt,
106 struct bond_opt_value *val);
107const struct bond_option *bond_opt_get(unsigned int option);
108const struct bond_option *bond_opt_get_by_name(const char *name);
109const struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val);
110
111/* This helper is used to initialize a bond_opt_value structure for parameter
112 * passing. There should be either a valid string or value, but not both.
113 * When value is ULLONG_MAX then string will be used.
114 */
115static inline void __bond_opt_init(struct bond_opt_value *optval,
116 char *string, u64 value)
117{
118 memset(optval, 0, sizeof(*optval));
119 optval->value = ULLONG_MAX;
120 if (value == ULLONG_MAX)
121 optval->string = string;
122 else
123 optval->value = value;
124}
125#define bond_opt_initval(optval, value) __bond_opt_init(optval, NULL, value)
126#define bond_opt_initstr(optval, str) __bond_opt_init(optval, str, ULLONG_MAX)
127
128void bond_option_arp_ip_targets_clear(struct bonding *bond);
129
130#endif /* _NET_BOND_OPTIONS_H */
diff --git a/include/net/bonding.h b/include/net/bonding.h
new file mode 100644
index 000000000000..983a94b86b95
--- /dev/null
+++ b/include/net/bonding.h
@@ -0,0 +1,654 @@
1/*
2 * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'.
3 *
4 * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes
5 * NCM: Network and Communications Management, Inc.
6 *
7 * BUT, I'm the one who modified it for ethernet, so:
8 * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov
9 *
10 * This software may be used and distributed according to the terms
11 * of the GNU Public License, incorporated herein by reference.
12 *
13 */
14
15#ifndef _NET_BONDING_H
16#define _NET_BONDING_H
17
18#include <linux/timer.h>
19#include <linux/proc_fs.h>
20#include <linux/if_bonding.h>
21#include <linux/cpumask.h>
22#include <linux/in6.h>
23#include <linux/netpoll.h>
24#include <linux/inetdevice.h>
25#include <linux/etherdevice.h>
26#include <linux/reciprocal_div.h>
27#include <linux/if_link.h>
28
29#include <net/bond_3ad.h>
30#include <net/bond_alb.h>
31#include <net/bond_options.h>
32
33#define DRV_VERSION "3.7.1"
34#define DRV_RELDATE "April 27, 2011"
35#define DRV_NAME "bonding"
36#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver"
37
38#define bond_version DRV_DESCRIPTION ": v" DRV_VERSION " (" DRV_RELDATE ")\n"
39
40#define BOND_MAX_ARP_TARGETS 16
41
42#define BOND_DEFAULT_MIIMON 100
43
44/*
45 * Less bad way to call ioctl from within the kernel; this needs to be
46 * done some other way to get the call out of interrupt context.
47 * Needs "ioctl" variable to be supplied by calling context.
48 */
49#define IOCTL(dev, arg, cmd) ({ \
50 int res = 0; \
51 mm_segment_t fs = get_fs(); \
52 set_fs(get_ds()); \
53 res = ioctl(dev, arg, cmd); \
54 set_fs(fs); \
55 res; })
56
57#define BOND_MODE(bond) ((bond)->params.mode)
58
59/* slave list primitives */
60#define bond_slave_list(bond) (&(bond)->dev->adj_list.lower)
61
62#define bond_has_slaves(bond) !list_empty(bond_slave_list(bond))
63
64/* IMPORTANT: bond_first/last_slave can return NULL in case of an empty list */
65#define bond_first_slave(bond) \
66 (bond_has_slaves(bond) ? \
67 netdev_adjacent_get_private(bond_slave_list(bond)->next) : \
68 NULL)
69#define bond_last_slave(bond) \
70 (bond_has_slaves(bond) ? \
71 netdev_adjacent_get_private(bond_slave_list(bond)->prev) : \
72 NULL)
73
74/* Caller must have rcu_read_lock */
75#define bond_first_slave_rcu(bond) \
76 netdev_lower_get_first_private_rcu(bond->dev)
77
78#define bond_is_first_slave(bond, pos) (pos == bond_first_slave(bond))
79#define bond_is_last_slave(bond, pos) (pos == bond_last_slave(bond))
80
81/**
82 * bond_for_each_slave - iterate over all slaves
83 * @bond: the bond holding this list
84 * @pos: current slave
85 * @iter: list_head * iterator
86 *
87 * Caller must hold RTNL
88 */
89#define bond_for_each_slave(bond, pos, iter) \
90 netdev_for_each_lower_private((bond)->dev, pos, iter)
91
92/* Caller must have rcu_read_lock */
93#define bond_for_each_slave_rcu(bond, pos, iter) \
94 netdev_for_each_lower_private_rcu((bond)->dev, pos, iter)
95
96#ifdef CONFIG_NET_POLL_CONTROLLER
97extern atomic_t netpoll_block_tx;
98
99static inline void block_netpoll_tx(void)
100{
101 atomic_inc(&netpoll_block_tx);
102}
103
104static inline void unblock_netpoll_tx(void)
105{
106 atomic_dec(&netpoll_block_tx);
107}
108
109static inline int is_netpoll_tx_blocked(struct net_device *dev)
110{
111 if (unlikely(netpoll_tx_running(dev)))
112 return atomic_read(&netpoll_block_tx);
113 return 0;
114}
115#else
116#define block_netpoll_tx()
117#define unblock_netpoll_tx()
118#define is_netpoll_tx_blocked(dev) (0)
119#endif
120
121struct bond_params {
122 int mode;
123 int xmit_policy;
124 int miimon;
125 u8 num_peer_notif;
126 int arp_interval;
127 int arp_validate;
128 int arp_all_targets;
129 int use_carrier;
130 int fail_over_mac;
131 int updelay;
132 int downdelay;
133 int lacp_fast;
134 unsigned int min_links;
135 int ad_select;
136 char primary[IFNAMSIZ];
137 int primary_reselect;
138 __be32 arp_targets[BOND_MAX_ARP_TARGETS];
139 int tx_queues;
140 int all_slaves_active;
141 int resend_igmp;
142 int lp_interval;
143 int packets_per_slave;
144 int tlb_dynamic_lb;
145 struct reciprocal_value reciprocal_packets_per_slave;
146};
147
148struct bond_parm_tbl {
149 char *modename;
150 int mode;
151};
152
153struct slave {
154 struct net_device *dev; /* first - useful for panic debug */
155 struct bonding *bond; /* our master */
156 int delay;
157 /* all three in jiffies */
158 unsigned long last_link_up;
159 unsigned long last_rx;
160 unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS];
161 s8 link; /* one of BOND_LINK_XXXX */
162 s8 new_link;
163 u8 backup:1, /* indicates backup slave. Value corresponds with
164 BOND_STATE_ACTIVE and BOND_STATE_BACKUP */
165 inactive:1, /* indicates inactive slave */
166 should_notify:1; /* indicateds whether the state changed */
167 u8 duplex;
168 u32 original_mtu;
169 u32 link_failure_count;
170 u32 speed;
171 u16 queue_id;
172 u8 perm_hwaddr[ETH_ALEN];
173 struct ad_slave_info *ad_info;
174 struct tlb_slave_info tlb_info;
175#ifdef CONFIG_NET_POLL_CONTROLLER
176 struct netpoll *np;
177#endif
178 struct kobject kobj;
179 struct rtnl_link_stats64 slave_stats;
180};
181
182struct bond_up_slave {
183 unsigned int count;
184 struct rcu_head rcu;
185 struct slave *arr[0];
186};
187
188/*
189 * Link pseudo-state only used internally by monitors
190 */
191#define BOND_LINK_NOCHANGE -1
192
193/*
194 * Here are the locking policies for the two bonding locks:
195 * Get rcu_read_lock when reading or RTNL when writing slave list.
196 */
197struct bonding {
198 struct net_device *dev; /* first - useful for panic debug */
199 struct slave __rcu *curr_active_slave;
200 struct slave __rcu *current_arp_slave;
201 struct slave __rcu *primary_slave;
202 struct bond_up_slave __rcu *slave_arr; /* Array of usable slaves */
203 bool force_primary;
204 s32 slave_cnt; /* never change this value outside the attach/detach wrappers */
205 int (*recv_probe)(const struct sk_buff *, struct bonding *,
206 struct slave *);
207 /* mode_lock is used for mode-specific locking needs, currently used by:
208 * 3ad mode (4) - protect against running bond_3ad_unbind_slave() and
209 * bond_3ad_state_machine_handler() concurrently and also
210 * the access to the state machine shared variables.
211 * TLB mode (5) - to sync the use and modifications of its hash table
212 * ALB mode (6) - to sync the use and modifications of its hash table
213 */
214 spinlock_t mode_lock;
215 u8 send_peer_notif;
216 u8 igmp_retrans;
217#ifdef CONFIG_PROC_FS
218 struct proc_dir_entry *proc_entry;
219 char proc_file_name[IFNAMSIZ];
220#endif /* CONFIG_PROC_FS */
221 struct list_head bond_list;
222 u32 rr_tx_counter;
223 struct ad_bond_info ad_info;
224 struct alb_bond_info alb_info;
225 struct bond_params params;
226 struct workqueue_struct *wq;
227 struct delayed_work mii_work;
228 struct delayed_work arp_work;
229 struct delayed_work alb_work;
230 struct delayed_work ad_work;
231 struct delayed_work mcast_work;
232 struct delayed_work slave_arr_work;
233#ifdef CONFIG_DEBUG_FS
234 /* debugging support via debugfs */
235 struct dentry *debug_dir;
236#endif /* CONFIG_DEBUG_FS */
237 struct rtnl_link_stats64 bond_stats;
238};
239
240#define bond_slave_get_rcu(dev) \
241 ((struct slave *) rcu_dereference(dev->rx_handler_data))
242
243#define bond_slave_get_rtnl(dev) \
244 ((struct slave *) rtnl_dereference(dev->rx_handler_data))
245
246struct bond_vlan_tag {
247 __be16 vlan_proto;
248 unsigned short vlan_id;
249};
250
251/**
252 * Returns NULL if the net_device does not belong to any of the bond's slaves
253 *
254 * Caller must hold bond lock for read
255 */
256static inline struct slave *bond_get_slave_by_dev(struct bonding *bond,
257 struct net_device *slave_dev)
258{
259 return netdev_lower_dev_get_private(bond->dev, slave_dev);
260}
261
262static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
263{
264 return slave->bond;
265}
266
267static inline bool bond_should_override_tx_queue(struct bonding *bond)
268{
269 return BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP ||
270 BOND_MODE(bond) == BOND_MODE_ROUNDROBIN;
271}
272
273static inline bool bond_is_lb(const struct bonding *bond)
274{
275 return BOND_MODE(bond) == BOND_MODE_TLB ||
276 BOND_MODE(bond) == BOND_MODE_ALB;
277}
278
279static inline bool bond_is_nondyn_tlb(const struct bonding *bond)
280{
281 return (BOND_MODE(bond) == BOND_MODE_TLB) &&
282 (bond->params.tlb_dynamic_lb == 0);
283}
284
285static inline bool bond_mode_uses_xmit_hash(const struct bonding *bond)
286{
287 return (BOND_MODE(bond) == BOND_MODE_8023AD ||
288 BOND_MODE(bond) == BOND_MODE_XOR ||
289 bond_is_nondyn_tlb(bond));
290}
291
292static inline bool bond_mode_uses_arp(int mode)
293{
294 return mode != BOND_MODE_8023AD && mode != BOND_MODE_TLB &&
295 mode != BOND_MODE_ALB;
296}
297
298static inline bool bond_mode_uses_primary(int mode)
299{
300 return mode == BOND_MODE_ACTIVEBACKUP || mode == BOND_MODE_TLB ||
301 mode == BOND_MODE_ALB;
302}
303
304static inline bool bond_uses_primary(struct bonding *bond)
305{
306 return bond_mode_uses_primary(BOND_MODE(bond));
307}
308
309static inline bool bond_slave_is_up(struct slave *slave)
310{
311 return netif_running(slave->dev) && netif_carrier_ok(slave->dev);
312}
313
314static inline void bond_set_active_slave(struct slave *slave)
315{
316 if (slave->backup) {
317 slave->backup = 0;
318 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
319 }
320}
321
322static inline void bond_set_backup_slave(struct slave *slave)
323{
324 if (!slave->backup) {
325 slave->backup = 1;
326 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
327 }
328}
329
330static inline void bond_set_slave_state(struct slave *slave,
331 int slave_state, bool notify)
332{
333 if (slave->backup == slave_state)
334 return;
335
336 slave->backup = slave_state;
337 if (notify) {
338 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
339 slave->should_notify = 0;
340 } else {
341 if (slave->should_notify)
342 slave->should_notify = 0;
343 else
344 slave->should_notify = 1;
345 }
346}
347
348static inline void bond_slave_state_change(struct bonding *bond)
349{
350 struct list_head *iter;
351 struct slave *tmp;
352
353 bond_for_each_slave(bond, tmp, iter) {
354 if (tmp->link == BOND_LINK_UP)
355 bond_set_active_slave(tmp);
356 else if (tmp->link == BOND_LINK_DOWN)
357 bond_set_backup_slave(tmp);
358 }
359}
360
361static inline void bond_slave_state_notify(struct bonding *bond)
362{
363 struct list_head *iter;
364 struct slave *tmp;
365
366 bond_for_each_slave(bond, tmp, iter) {
367 if (tmp->should_notify) {
368 rtmsg_ifinfo(RTM_NEWLINK, tmp->dev, 0, GFP_ATOMIC);
369 tmp->should_notify = 0;
370 }
371 }
372}
373
374static inline int bond_slave_state(struct slave *slave)
375{
376 return slave->backup;
377}
378
379static inline bool bond_is_active_slave(struct slave *slave)
380{
381 return !bond_slave_state(slave);
382}
383
384static inline bool bond_slave_can_tx(struct slave *slave)
385{
386 return bond_slave_is_up(slave) && slave->link == BOND_LINK_UP &&
387 bond_is_active_slave(slave);
388}
389
390#define BOND_PRI_RESELECT_ALWAYS 0
391#define BOND_PRI_RESELECT_BETTER 1
392#define BOND_PRI_RESELECT_FAILURE 2
393
394#define BOND_FOM_NONE 0
395#define BOND_FOM_ACTIVE 1
396#define BOND_FOM_FOLLOW 2
397
398#define BOND_ARP_TARGETS_ANY 0
399#define BOND_ARP_TARGETS_ALL 1
400
401#define BOND_ARP_VALIDATE_NONE 0
402#define BOND_ARP_VALIDATE_ACTIVE (1 << BOND_STATE_ACTIVE)
403#define BOND_ARP_VALIDATE_BACKUP (1 << BOND_STATE_BACKUP)
404#define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \
405 BOND_ARP_VALIDATE_BACKUP)
406#define BOND_ARP_FILTER (BOND_ARP_VALIDATE_ALL + 1)
407#define BOND_ARP_FILTER_ACTIVE (BOND_ARP_VALIDATE_ACTIVE | \
408 BOND_ARP_FILTER)
409#define BOND_ARP_FILTER_BACKUP (BOND_ARP_VALIDATE_BACKUP | \
410 BOND_ARP_FILTER)
411
412#define BOND_SLAVE_NOTIFY_NOW true
413#define BOND_SLAVE_NOTIFY_LATER false
414
415static inline int slave_do_arp_validate(struct bonding *bond,
416 struct slave *slave)
417{
418 return bond->params.arp_validate & (1 << bond_slave_state(slave));
419}
420
421static inline int slave_do_arp_validate_only(struct bonding *bond)
422{
423 return bond->params.arp_validate & BOND_ARP_FILTER;
424}
425
426static inline int bond_is_ip_target_ok(__be32 addr)
427{
428 return !ipv4_is_lbcast(addr) && !ipv4_is_zeronet(addr);
429}
430
431/* Get the oldest arp which we've received on this slave for bond's
432 * arp_targets.
433 */
434static inline unsigned long slave_oldest_target_arp_rx(struct bonding *bond,
435 struct slave *slave)
436{
437 int i = 1;
438 unsigned long ret = slave->target_last_arp_rx[0];
439
440 for (; (i < BOND_MAX_ARP_TARGETS) && bond->params.arp_targets[i]; i++)
441 if (time_before(slave->target_last_arp_rx[i], ret))
442 ret = slave->target_last_arp_rx[i];
443
444 return ret;
445}
446
447static inline unsigned long slave_last_rx(struct bonding *bond,
448 struct slave *slave)
449{
450 if (bond->params.arp_all_targets == BOND_ARP_TARGETS_ALL)
451 return slave_oldest_target_arp_rx(bond, slave);
452
453 return slave->last_rx;
454}
455
456#ifdef CONFIG_NET_POLL_CONTROLLER
457static inline void bond_netpoll_send_skb(const struct slave *slave,
458 struct sk_buff *skb)
459{
460 struct netpoll *np = slave->np;
461
462 if (np)
463 netpoll_send_skb(np, skb);
464}
465#else
466static inline void bond_netpoll_send_skb(const struct slave *slave,
467 struct sk_buff *skb)
468{
469}
470#endif
471
472static inline void bond_set_slave_inactive_flags(struct slave *slave,
473 bool notify)
474{
475 if (!bond_is_lb(slave->bond))
476 bond_set_slave_state(slave, BOND_STATE_BACKUP, notify);
477 if (!slave->bond->params.all_slaves_active)
478 slave->inactive = 1;
479}
480
481static inline void bond_set_slave_active_flags(struct slave *slave,
482 bool notify)
483{
484 bond_set_slave_state(slave, BOND_STATE_ACTIVE, notify);
485 slave->inactive = 0;
486}
487
488static inline bool bond_is_slave_inactive(struct slave *slave)
489{
490 return slave->inactive;
491}
492
493static inline __be32 bond_confirm_addr(struct net_device *dev, __be32 dst, __be32 local)
494{
495 struct in_device *in_dev;
496 __be32 addr = 0;
497
498 rcu_read_lock();
499 in_dev = __in_dev_get_rcu(dev);
500
501 if (in_dev)
502 addr = inet_confirm_addr(dev_net(dev), in_dev, dst, local,
503 RT_SCOPE_HOST);
504 rcu_read_unlock();
505 return addr;
506}
507
508struct bond_net {
509 struct net *net; /* Associated network namespace */
510 struct list_head dev_list;
511#ifdef CONFIG_PROC_FS
512 struct proc_dir_entry *proc_dir;
513#endif
514 struct class_attribute class_attr_bonding_masters;
515};
516
517int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct slave *slave);
518void bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev);
519int bond_create(struct net *net, const char *name);
520int bond_create_sysfs(struct bond_net *net);
521void bond_destroy_sysfs(struct bond_net *net);
522void bond_prepare_sysfs_group(struct bonding *bond);
523int bond_sysfs_slave_add(struct slave *slave);
524void bond_sysfs_slave_del(struct slave *slave);
525int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev);
526int bond_release(struct net_device *bond_dev, struct net_device *slave_dev);
527u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb);
528void bond_select_active_slave(struct bonding *bond);
529void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
530void bond_create_debugfs(void);
531void bond_destroy_debugfs(void);
532void bond_debug_register(struct bonding *bond);
533void bond_debug_unregister(struct bonding *bond);
534void bond_debug_reregister(struct bonding *bond);
535const char *bond_mode_name(int mode);
536void bond_setup(struct net_device *bond_dev);
537unsigned int bond_get_num_tx_queues(void);
538int bond_netlink_init(void);
539void bond_netlink_fini(void);
540struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond);
541const char *bond_slave_link_status(s8 link);
542struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev,
543 struct net_device *end_dev,
544 int level);
545int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave);
546void bond_slave_arr_work_rearm(struct bonding *bond, unsigned long delay);
547
548#ifdef CONFIG_PROC_FS
549void bond_create_proc_entry(struct bonding *bond);
550void bond_remove_proc_entry(struct bonding *bond);
551void bond_create_proc_dir(struct bond_net *bn);
552void bond_destroy_proc_dir(struct bond_net *bn);
553#else
554static inline void bond_create_proc_entry(struct bonding *bond)
555{
556}
557
558static inline void bond_remove_proc_entry(struct bonding *bond)
559{
560}
561
562static inline void bond_create_proc_dir(struct bond_net *bn)
563{
564}
565
566static inline void bond_destroy_proc_dir(struct bond_net *bn)
567{
568}
569#endif
570
571static inline struct slave *bond_slave_has_mac(struct bonding *bond,
572 const u8 *mac)
573{
574 struct list_head *iter;
575 struct slave *tmp;
576
577 bond_for_each_slave(bond, tmp, iter)
578 if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr))
579 return tmp;
580
581 return NULL;
582}
583
584/* Caller must hold rcu_read_lock() for read */
585static inline struct slave *bond_slave_has_mac_rcu(struct bonding *bond,
586 const u8 *mac)
587{
588 struct list_head *iter;
589 struct slave *tmp;
590
591 bond_for_each_slave_rcu(bond, tmp, iter)
592 if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr))
593 return tmp;
594
595 return NULL;
596}
597
598/* Caller must hold rcu_read_lock() for read */
599static inline bool bond_slave_has_mac_rx(struct bonding *bond, const u8 *mac)
600{
601 struct list_head *iter;
602 struct slave *tmp;
603 struct netdev_hw_addr *ha;
604
605 bond_for_each_slave_rcu(bond, tmp, iter)
606 if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr))
607 return true;
608
609 if (netdev_uc_empty(bond->dev))
610 return false;
611
612 netdev_for_each_uc_addr(ha, bond->dev)
613 if (ether_addr_equal_64bits(mac, ha->addr))
614 return true;
615
616 return false;
617}
618
619/* Check if the ip is present in arp ip list, or first free slot if ip == 0
620 * Returns -1 if not found, index if found
621 */
622static inline int bond_get_targets_ip(__be32 *targets, __be32 ip)
623{
624 int i;
625
626 for (i = 0; i < BOND_MAX_ARP_TARGETS; i++)
627 if (targets[i] == ip)
628 return i;
629 else if (targets[i] == 0)
630 break;
631
632 return -1;
633}
634
635/* exported from bond_main.c */
636extern int bond_net_id;
637extern const struct bond_parm_tbl bond_lacp_tbl[];
638extern const struct bond_parm_tbl xmit_hashtype_tbl[];
639extern const struct bond_parm_tbl arp_validate_tbl[];
640extern const struct bond_parm_tbl arp_all_targets_tbl[];
641extern const struct bond_parm_tbl fail_over_mac_tbl[];
642extern const struct bond_parm_tbl pri_reselect_tbl[];
643extern struct bond_parm_tbl ad_select_tbl[];
644
645/* exported from bond_netlink.c */
646extern struct rtnl_link_ops bond_link_ops;
647
648static inline void bond_tx_drop(struct net_device *dev, struct sk_buff *skb)
649{
650 atomic_long_inc(&dev->tx_dropped);
651 dev_kfree_skb_any(skb);
652}
653
654#endif /* _NET_BONDING_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index a2ddcf2398fd..4ebb816241fa 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -319,9 +319,12 @@ struct ieee80211_supported_band {
319/** 319/**
320 * struct vif_params - describes virtual interface parameters 320 * struct vif_params - describes virtual interface parameters
321 * @use_4addr: use 4-address frames 321 * @use_4addr: use 4-address frames
322 * @macaddr: address to use for this virtual interface. This will only 322 * @macaddr: address to use for this virtual interface.
323 * be used for non-netdevice interfaces. If this parameter is set 323 * If this parameter is set to zero address the driver may
324 * to zero address the driver may determine the address as needed. 324 * determine the address as needed.
325 * This feature is only fully supported by drivers that enable the
326 * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating
327 ** only p2p devices with specified MAC.
325 */ 328 */
326struct vif_params { 329struct vif_params {
327 int use_4addr; 330 int use_4addr;
@@ -799,6 +802,22 @@ struct station_parameters {
799}; 802};
800 803
801/** 804/**
805 * struct station_del_parameters - station deletion parameters
806 *
807 * Used to delete a station entry (or all stations).
808 *
809 * @mac: MAC address of the station to remove or NULL to remove all stations
810 * @subtype: Management frame subtype to use for indicating removal
811 * (10 = Disassociation, 12 = Deauthentication)
812 * @reason_code: Reason code for the Disassociation/Deauthentication frame
813 */
814struct station_del_parameters {
815 const u8 *mac;
816 u8 subtype;
817 u16 reason_code;
818};
819
820/**
802 * enum cfg80211_station_type - the type of station being modified 821 * enum cfg80211_station_type - the type of station being modified
803 * @CFG80211_STA_AP_CLIENT: client of an AP interface 822 * @CFG80211_STA_AP_CLIENT: client of an AP interface
804 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has 823 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
@@ -1340,6 +1359,16 @@ struct mesh_setup {
1340}; 1359};
1341 1360
1342/** 1361/**
1362 * struct ocb_setup - 802.11p OCB mode setup configuration
1363 * @chandef: defines the channel to use
1364 *
1365 * These parameters are fixed when connecting to the network
1366 */
1367struct ocb_setup {
1368 struct cfg80211_chan_def chandef;
1369};
1370
1371/**
1343 * struct ieee80211_txq_params - TX queue parameters 1372 * struct ieee80211_txq_params - TX queue parameters
1344 * @ac: AC identifier 1373 * @ac: AC identifier
1345 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 1374 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
@@ -1408,6 +1437,10 @@ struct cfg80211_ssid {
1408 * @aborted: (internal) scan request was notified as aborted 1437 * @aborted: (internal) scan request was notified as aborted
1409 * @notified: (internal) scan request was notified as done or aborted 1438 * @notified: (internal) scan request was notified as done or aborted
1410 * @no_cck: used to send probe requests at non CCK rate in 2GHz band 1439 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
1440 * @mac_addr: MAC address used with randomisation
1441 * @mac_addr_mask: MAC address mask used with randomisation, bits that
1442 * are 0 in the mask should be randomised, bits that are 1 should
1443 * be taken from the @mac_addr
1411 */ 1444 */
1412struct cfg80211_scan_request { 1445struct cfg80211_scan_request {
1413 struct cfg80211_ssid *ssids; 1446 struct cfg80211_ssid *ssids;
@@ -1422,6 +1455,9 @@ struct cfg80211_scan_request {
1422 1455
1423 struct wireless_dev *wdev; 1456 struct wireless_dev *wdev;
1424 1457
1458 u8 mac_addr[ETH_ALEN] __aligned(2);
1459 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
1460
1425 /* internal */ 1461 /* internal */
1426 struct wiphy *wiphy; 1462 struct wiphy *wiphy;
1427 unsigned long scan_start; 1463 unsigned long scan_start;
@@ -1432,6 +1468,17 @@ struct cfg80211_scan_request {
1432 struct ieee80211_channel *channels[0]; 1468 struct ieee80211_channel *channels[0];
1433}; 1469};
1434 1470
1471static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
1472{
1473 int i;
1474
1475 get_random_bytes(buf, ETH_ALEN);
1476 for (i = 0; i < ETH_ALEN; i++) {
1477 buf[i] &= ~mask[i];
1478 buf[i] |= addr[i] & mask[i];
1479 }
1480}
1481
1435/** 1482/**
1436 * struct cfg80211_match_set - sets of attributes to match 1483 * struct cfg80211_match_set - sets of attributes to match
1437 * 1484 *
@@ -1465,6 +1512,10 @@ struct cfg80211_match_set {
1465 * @channels: channels to scan 1512 * @channels: channels to scan
1466 * @min_rssi_thold: for drivers only supporting a single threshold, this 1513 * @min_rssi_thold: for drivers only supporting a single threshold, this
1467 * contains the minimum over all matchsets 1514 * contains the minimum over all matchsets
1515 * @mac_addr: MAC address used with randomisation
1516 * @mac_addr_mask: MAC address mask used with randomisation, bits that
1517 * are 0 in the mask should be randomised, bits that are 1 should
1518 * be taken from the @mac_addr
1468 */ 1519 */
1469struct cfg80211_sched_scan_request { 1520struct cfg80211_sched_scan_request {
1470 struct cfg80211_ssid *ssids; 1521 struct cfg80211_ssid *ssids;
@@ -1479,6 +1530,9 @@ struct cfg80211_sched_scan_request {
1479 int n_match_sets; 1530 int n_match_sets;
1480 s32 min_rssi_thold; 1531 s32 min_rssi_thold;
1481 1532
1533 u8 mac_addr[ETH_ALEN] __aligned(2);
1534 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
1535
1482 /* internal */ 1536 /* internal */
1483 struct wiphy *wiphy; 1537 struct wiphy *wiphy;
1484 struct net_device *dev; 1538 struct net_device *dev;
@@ -1911,6 +1965,7 @@ struct cfg80211_wowlan_tcp {
1911 * @rfkill_release: wake up when rfkill is released 1965 * @rfkill_release: wake up when rfkill is released
1912 * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. 1966 * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
1913 * NULL if not configured. 1967 * NULL if not configured.
1968 * @nd_config: configuration for the scan to be used for net detect wake.
1914 */ 1969 */
1915struct cfg80211_wowlan { 1970struct cfg80211_wowlan {
1916 bool any, disconnect, magic_pkt, gtk_rekey_failure, 1971 bool any, disconnect, magic_pkt, gtk_rekey_failure,
@@ -1919,6 +1974,7 @@ struct cfg80211_wowlan {
1919 struct cfg80211_pkt_pattern *patterns; 1974 struct cfg80211_pkt_pattern *patterns;
1920 struct cfg80211_wowlan_tcp *tcp; 1975 struct cfg80211_wowlan_tcp *tcp;
1921 int n_patterns; 1976 int n_patterns;
1977 struct cfg80211_sched_scan_request *nd_config;
1922}; 1978};
1923 1979
1924/** 1980/**
@@ -1951,6 +2007,35 @@ struct cfg80211_coalesce {
1951}; 2007};
1952 2008
1953/** 2009/**
2010 * struct cfg80211_wowlan_nd_match - information about the match
2011 *
2012 * @ssid: SSID of the match that triggered the wake up
2013 * @n_channels: Number of channels where the match occurred. This
2014 * value may be zero if the driver can't report the channels.
2015 * @channels: center frequencies of the channels where a match
2016 * occurred (in MHz)
2017 */
2018struct cfg80211_wowlan_nd_match {
2019 struct cfg80211_ssid ssid;
2020 int n_channels;
2021 u32 channels[];
2022};
2023
2024/**
2025 * struct cfg80211_wowlan_nd_info - net detect wake up information
2026 *
2027 * @n_matches: Number of match information instances provided in
2028 * @matches. This value may be zero if the driver can't provide
2029 * match information.
2030 * @matches: Array of pointers to matches containing information about
2031 * the matches that triggered the wake up.
2032 */
2033struct cfg80211_wowlan_nd_info {
2034 int n_matches;
2035 struct cfg80211_wowlan_nd_match *matches[];
2036};
2037
2038/**
1954 * struct cfg80211_wowlan_wakeup - wakeup report 2039 * struct cfg80211_wowlan_wakeup - wakeup report
1955 * @disconnect: woke up by getting disconnected 2040 * @disconnect: woke up by getting disconnected
1956 * @magic_pkt: woke up by receiving magic packet 2041 * @magic_pkt: woke up by receiving magic packet
@@ -1969,6 +2054,7 @@ struct cfg80211_coalesce {
1969 * @tcp_match: TCP wakeup packet received 2054 * @tcp_match: TCP wakeup packet received
1970 * @tcp_connlost: TCP connection lost or failed to establish 2055 * @tcp_connlost: TCP connection lost or failed to establish
1971 * @tcp_nomoretokens: TCP data ran out of tokens 2056 * @tcp_nomoretokens: TCP data ran out of tokens
2057 * @net_detect: if not %NULL, woke up because of net detect
1972 */ 2058 */
1973struct cfg80211_wowlan_wakeup { 2059struct cfg80211_wowlan_wakeup {
1974 bool disconnect, magic_pkt, gtk_rekey_failure, 2060 bool disconnect, magic_pkt, gtk_rekey_failure,
@@ -1978,6 +2064,7 @@ struct cfg80211_wowlan_wakeup {
1978 s32 pattern_idx; 2064 s32 pattern_idx;
1979 u32 packet_present_len, packet_len; 2065 u32 packet_present_len, packet_len;
1980 const void *packet; 2066 const void *packet;
2067 struct cfg80211_wowlan_nd_info *net_detect;
1981}; 2068};
1982 2069
1983/** 2070/**
@@ -2132,7 +2219,7 @@ struct cfg80211_qos_map {
2132 * @stop_ap: Stop being an AP, including stopping beaconing. 2219 * @stop_ap: Stop being an AP, including stopping beaconing.
2133 * 2220 *
2134 * @add_station: Add a new station. 2221 * @add_station: Add a new station.
2135 * @del_station: Remove a station; @mac may be NULL to remove all stations. 2222 * @del_station: Remove a station
2136 * @change_station: Modify a given station. Note that flags changes are not much 2223 * @change_station: Modify a given station. Note that flags changes are not much
2137 * validated in cfg80211, in particular the auth/assoc/authorized flags 2224 * validated in cfg80211, in particular the auth/assoc/authorized flags
2138 * might come to the driver in invalid combinations -- make sure to check 2225 * might come to the driver in invalid combinations -- make sure to check
@@ -2146,6 +2233,8 @@ struct cfg80211_qos_map {
2146 * @change_mpath: change a given mesh path 2233 * @change_mpath: change a given mesh path
2147 * @get_mpath: get a mesh path for the given parameters 2234 * @get_mpath: get a mesh path for the given parameters
2148 * @dump_mpath: dump mesh path callback -- resume dump at index @idx 2235 * @dump_mpath: dump mesh path callback -- resume dump at index @idx
2236 * @get_mpp: get a mesh proxy path for the given parameters
2237 * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
2149 * @join_mesh: join the mesh network with the specified parameters 2238 * @join_mesh: join the mesh network with the specified parameters
2150 * (invoked with the wireless_dev mutex held) 2239 * (invoked with the wireless_dev mutex held)
2151 * @leave_mesh: leave the current mesh network 2240 * @leave_mesh: leave the current mesh network
@@ -2331,6 +2420,17 @@ struct cfg80211_qos_map {
2331 * with the peer followed by immediate teardown when the addition is later 2420 * with the peer followed by immediate teardown when the addition is later
2332 * rejected) 2421 * rejected)
2333 * @del_tx_ts: remove an existing TX TS 2422 * @del_tx_ts: remove an existing TX TS
2423 *
2424 * @join_ocb: join the OCB network with the specified parameters
2425 * (invoked with the wireless_dev mutex held)
2426 * @leave_ocb: leave the current OCB network
2427 * (invoked with the wireless_dev mutex held)
2428 *
2429 * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
2430 * is responsible for continually initiating channel-switching operations
2431 * and returning to the base channel for communication with the AP.
2432 * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
2433 * peers must be on the base channel when the call completes.
2334 */ 2434 */
2335struct cfg80211_ops { 2435struct cfg80211_ops {
2336 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 2436 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -2376,7 +2476,7 @@ struct cfg80211_ops {
2376 const u8 *mac, 2476 const u8 *mac,
2377 struct station_parameters *params); 2477 struct station_parameters *params);
2378 int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 2478 int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
2379 const u8 *mac); 2479 struct station_del_parameters *params);
2380 int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 2480 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
2381 const u8 *mac, 2481 const u8 *mac,
2382 struct station_parameters *params); 2482 struct station_parameters *params);
@@ -2396,6 +2496,11 @@ struct cfg80211_ops {
2396 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 2496 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
2397 int idx, u8 *dst, u8 *next_hop, 2497 int idx, u8 *dst, u8 *next_hop,
2398 struct mpath_info *pinfo); 2498 struct mpath_info *pinfo);
2499 int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
2500 u8 *dst, u8 *mpp, struct mpath_info *pinfo);
2501 int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
2502 int idx, u8 *dst, u8 *mpp,
2503 struct mpath_info *pinfo);
2399 int (*get_mesh_config)(struct wiphy *wiphy, 2504 int (*get_mesh_config)(struct wiphy *wiphy,
2400 struct net_device *dev, 2505 struct net_device *dev,
2401 struct mesh_config *conf); 2506 struct mesh_config *conf);
@@ -2407,6 +2512,10 @@ struct cfg80211_ops {
2407 const struct mesh_setup *setup); 2512 const struct mesh_setup *setup);
2408 int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 2513 int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
2409 2514
2515 int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
2516 struct ocb_setup *setup);
2517 int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
2518
2410 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 2519 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
2411 struct bss_parameters *params); 2520 struct bss_parameters *params);
2412 2521
@@ -2577,6 +2686,14 @@ struct cfg80211_ops {
2577 u16 admitted_time); 2686 u16 admitted_time);
2578 int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, 2687 int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
2579 u8 tsid, const u8 *peer); 2688 u8 tsid, const u8 *peer);
2689
2690 int (*tdls_channel_switch)(struct wiphy *wiphy,
2691 struct net_device *dev,
2692 const u8 *addr, u8 oper_class,
2693 struct cfg80211_chan_def *chandef);
2694 void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,
2695 struct net_device *dev,
2696 const u8 *addr);
2580}; 2697};
2581 2698
2582/* 2699/*
@@ -2623,13 +2740,9 @@ struct cfg80211_ops {
2623 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 2740 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
2624 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 2741 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
2625 * beaconing mode (AP, IBSS, Mesh, ...). 2742 * beaconing mode (AP, IBSS, Mesh, ...).
2626 * @WIPHY_FLAG_SUPPORTS_WMM_ADMISSION: the device supports setting up WMM
2627 * TSPEC sessions (TID aka TSID 0-7) with the NL80211_CMD_ADD_TX_TS
2628 * command. Standard IEEE 802.11 TSPEC setup is not yet supported, it
2629 * needs to be able to handle Block-Ack agreements and other things.
2630 */ 2743 */
2631enum wiphy_flags { 2744enum wiphy_flags {
2632 WIPHY_FLAG_SUPPORTS_WMM_ADMISSION = BIT(0), 2745 /* use hole at 0 */
2633 /* use hole at 1 */ 2746 /* use hole at 1 */
2634 /* use hole at 2 */ 2747 /* use hole at 2 */
2635 WIPHY_FLAG_NETNS_OK = BIT(3), 2748 WIPHY_FLAG_NETNS_OK = BIT(3),
@@ -2755,6 +2868,7 @@ struct ieee80211_txrx_stypes {
2755 * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request 2868 * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
2756 * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure 2869 * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
2757 * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release 2870 * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
2871 * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
2758 */ 2872 */
2759enum wiphy_wowlan_support_flags { 2873enum wiphy_wowlan_support_flags {
2760 WIPHY_WOWLAN_ANY = BIT(0), 2874 WIPHY_WOWLAN_ANY = BIT(0),
@@ -2765,6 +2879,7 @@ enum wiphy_wowlan_support_flags {
2765 WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), 2879 WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),
2766 WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), 2880 WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),
2767 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), 2881 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),
2882 WIPHY_WOWLAN_NET_DETECT = BIT(8),
2768}; 2883};
2769 2884
2770struct wiphy_wowlan_tcp_support { 2885struct wiphy_wowlan_tcp_support {
@@ -2783,6 +2898,11 @@ struct wiphy_wowlan_tcp_support {
2783 * @pattern_max_len: maximum length of each pattern 2898 * @pattern_max_len: maximum length of each pattern
2784 * @pattern_min_len: minimum length of each pattern 2899 * @pattern_min_len: minimum length of each pattern
2785 * @max_pkt_offset: maximum Rx packet offset 2900 * @max_pkt_offset: maximum Rx packet offset
2901 * @max_nd_match_sets: maximum number of matchsets for net-detect,
2902 * similar, but not necessarily identical, to max_match_sets for
2903 * scheduled scans.
2904 * See &struct cfg80211_sched_scan_request.@match_sets for more
2905 * details.
2786 * @tcp: TCP wakeup support information 2906 * @tcp: TCP wakeup support information
2787 */ 2907 */
2788struct wiphy_wowlan_support { 2908struct wiphy_wowlan_support {
@@ -2791,6 +2911,7 @@ struct wiphy_wowlan_support {
2791 int pattern_max_len; 2911 int pattern_max_len;
2792 int pattern_min_len; 2912 int pattern_min_len;
2793 int max_pkt_offset; 2913 int max_pkt_offset;
2914 int max_nd_match_sets;
2794 const struct wiphy_wowlan_tcp_support *tcp; 2915 const struct wiphy_wowlan_tcp_support *tcp;
2795}; 2916};
2796 2917
@@ -3166,6 +3287,23 @@ static inline const char *wiphy_name(const struct wiphy *wiphy)
3166} 3287}
3167 3288
3168/** 3289/**
3290 * wiphy_new_nm - create a new wiphy for use with cfg80211
3291 *
3292 * @ops: The configuration operations for this device
3293 * @sizeof_priv: The size of the private area to allocate
3294 * @requested_name: Request a particular name.
3295 * NULL is valid value, and means use the default phy%d naming.
3296 *
3297 * Create a new wiphy and associate the given operations with it.
3298 * @sizeof_priv bytes are allocated for private use.
3299 *
3300 * Return: A pointer to the new wiphy. This pointer must be
3301 * assigned to each netdev's ieee80211_ptr for proper operation.
3302 */
3303struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
3304 const char *requested_name);
3305
3306/**
3169 * wiphy_new - create a new wiphy for use with cfg80211 3307 * wiphy_new - create a new wiphy for use with cfg80211
3170 * 3308 *
3171 * @ops: The configuration operations for this device 3309 * @ops: The configuration operations for this device
@@ -3177,7 +3315,11 @@ static inline const char *wiphy_name(const struct wiphy *wiphy)
3177 * Return: A pointer to the new wiphy. This pointer must be 3315 * Return: A pointer to the new wiphy. This pointer must be
3178 * assigned to each netdev's ieee80211_ptr for proper operation. 3316 * assigned to each netdev's ieee80211_ptr for proper operation.
3179 */ 3317 */
3180struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); 3318static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
3319 int sizeof_priv)
3320{
3321 return wiphy_new_nm(ops, sizeof_priv, NULL);
3322}
3181 3323
3182/** 3324/**
3183 * wiphy_register - register a wiphy with cfg80211 3325 * wiphy_register - register a wiphy with cfg80211
@@ -4501,33 +4643,6 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
4501 gfp_t gfp); 4643 gfp_t gfp);
4502 4644
4503/** 4645/**
4504 * cfg80211_radar_event - radar detection event
4505 * @wiphy: the wiphy
4506 * @chandef: chandef for the current channel
4507 * @gfp: context flags
4508 *
4509 * This function is called when a radar is detected on the current chanenl.
4510 */
4511void cfg80211_radar_event(struct wiphy *wiphy,
4512 struct cfg80211_chan_def *chandef, gfp_t gfp);
4513
4514/**
4515 * cfg80211_cac_event - Channel availability check (CAC) event
4516 * @netdev: network device
4517 * @chandef: chandef for the current channel
4518 * @event: type of event
4519 * @gfp: context flags
4520 *
4521 * This function is called when a Channel availability check (CAC) is finished
4522 * or aborted. This must be called to notify the completion of a CAC process,
4523 * also by full-MAC drivers.
4524 */
4525void cfg80211_cac_event(struct net_device *netdev,
4526 const struct cfg80211_chan_def *chandef,
4527 enum nl80211_radar_event event, gfp_t gfp);
4528
4529
4530/**
4531 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer 4646 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
4532 * @dev: network device 4647 * @dev: network device
4533 * @peer: peer's MAC address 4648 * @peer: peer's MAC address
@@ -4555,6 +4670,42 @@ void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
4555 u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); 4670 u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
4556 4671
4557/** 4672/**
4673 * cfg80211_cqm_beacon_loss_notify - beacon loss event
4674 * @dev: network device
4675 * @gfp: context flags
4676 *
4677 * Notify userspace about beacon loss from the connected AP.
4678 */
4679void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
4680
4681/**
4682 * cfg80211_radar_event - radar detection event
4683 * @wiphy: the wiphy
4684 * @chandef: chandef for the current channel
4685 * @gfp: context flags
4686 *
4687 * This function is called when a radar is detected on the current chanenl.
4688 */
4689void cfg80211_radar_event(struct wiphy *wiphy,
4690 struct cfg80211_chan_def *chandef, gfp_t gfp);
4691
4692/**
4693 * cfg80211_cac_event - Channel availability check (CAC) event
4694 * @netdev: network device
4695 * @chandef: chandef for the current channel
4696 * @event: type of event
4697 * @gfp: context flags
4698 *
4699 * This function is called when a Channel availability check (CAC) is finished
4700 * or aborted. This must be called to notify the completion of a CAC process,
4701 * also by full-MAC drivers.
4702 */
4703void cfg80211_cac_event(struct net_device *netdev,
4704 const struct cfg80211_chan_def *chandef,
4705 enum nl80211_radar_event event, gfp_t gfp);
4706
4707
4708/**
4558 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying 4709 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
4559 * @dev: network device 4710 * @dev: network device
4560 * @bssid: BSSID of AP (to avoid races) 4711 * @bssid: BSSID of AP (to avoid races)
@@ -4657,6 +4808,20 @@ bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
4657void cfg80211_ch_switch_notify(struct net_device *dev, 4808void cfg80211_ch_switch_notify(struct net_device *dev,
4658 struct cfg80211_chan_def *chandef); 4809 struct cfg80211_chan_def *chandef);
4659 4810
4811/*
4812 * cfg80211_ch_switch_started_notify - notify channel switch start
4813 * @dev: the device on which the channel switch started
4814 * @chandef: the future channel definition
4815 * @count: the number of TBTTs until the channel switch happens
4816 *
4817 * Inform the userspace about the channel switch that has just
4818 * started, so that it can take appropriate actions (eg. starting
4819 * channel switch on other vifs), if necessary.
4820 */
4821void cfg80211_ch_switch_started_notify(struct net_device *dev,
4822 struct cfg80211_chan_def *chandef,
4823 u8 count);
4824
4660/** 4825/**
4661 * ieee80211_operating_class_to_band - convert operating class to band 4826 * ieee80211_operating_class_to_band - convert operating class to band
4662 * 4827 *
diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h
new file mode 100644
index 000000000000..7f713acfa106
--- /dev/null
+++ b/include/net/cfg802154.h
@@ -0,0 +1,161 @@
1/*
2 * Copyright (C) 2007, 2008, 2009 Siemens AG
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
6 * as published by the Free Software Foundation.
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 * Written by:
14 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
15 */
16
17#ifndef __NET_CFG802154_H
18#define __NET_CFG802154_H
19
20#include <linux/ieee802154.h>
21#include <linux/netdevice.h>
22#include <linux/mutex.h>
23#include <linux/bug.h>
24
25#include <net/nl802154.h>
26
27struct wpan_phy;
28
29struct cfg802154_ops {
30 struct net_device * (*add_virtual_intf_deprecated)(struct wpan_phy *wpan_phy,
31 const char *name,
32 int type);
33 void (*del_virtual_intf_deprecated)(struct wpan_phy *wpan_phy,
34 struct net_device *dev);
35 int (*add_virtual_intf)(struct wpan_phy *wpan_phy,
36 const char *name,
37 enum nl802154_iftype type,
38 __le64 extended_addr);
39 int (*del_virtual_intf)(struct wpan_phy *wpan_phy,
40 struct wpan_dev *wpan_dev);
41 int (*set_channel)(struct wpan_phy *wpan_phy, u8 page, u8 channel);
42 int (*set_pan_id)(struct wpan_phy *wpan_phy,
43 struct wpan_dev *wpan_dev, __le16 pan_id);
44 int (*set_short_addr)(struct wpan_phy *wpan_phy,
45 struct wpan_dev *wpan_dev, __le16 short_addr);
46 int (*set_backoff_exponent)(struct wpan_phy *wpan_phy,
47 struct wpan_dev *wpan_dev, u8 min_be,
48 u8 max_be);
49 int (*set_max_csma_backoffs)(struct wpan_phy *wpan_phy,
50 struct wpan_dev *wpan_dev,
51 u8 max_csma_backoffs);
52 int (*set_max_frame_retries)(struct wpan_phy *wpan_phy,
53 struct wpan_dev *wpan_dev,
54 s8 max_frame_retries);
55 int (*set_lbt_mode)(struct wpan_phy *wpan_phy,
56 struct wpan_dev *wpan_dev, bool mode);
57};
58
59struct wpan_phy {
60 struct mutex pib_lock;
61
62 /* If multiple wpan_phys are registered and you're handed e.g.
63 * a regular netdev with assigned ieee802154_ptr, you won't
64 * know whether it points to a wpan_phy your driver has registered
65 * or not. Assign this to something global to your driver to
66 * help determine whether you own this wpan_phy or not.
67 */
68 const void *privid;
69
70 /*
71 * This is a PIB according to 802.15.4-2011.
72 * We do not provide timing-related variables, as they
73 * aren't used outside of driver
74 */
75 u8 current_channel;
76 u8 current_page;
77 u32 channels_supported[IEEE802154_MAX_PAGE + 1];
78 s8 transmit_power;
79 u8 cca_mode;
80
81 __le64 perm_extended_addr;
82
83 s32 cca_ed_level;
84
85 /* PHY depended MAC PIB values */
86
87 /* 802.15.4 acronym: Tdsym in usec */
88 u8 symbol_duration;
89 /* lifs and sifs periods timing */
90 u16 lifs_period;
91 u16 sifs_period;
92
93 struct device dev;
94
95 char priv[0] __aligned(NETDEV_ALIGN);
96};
97
98struct wpan_dev {
99 struct wpan_phy *wpan_phy;
100 int iftype;
101
102 /* the remainder of this struct should be private to cfg802154 */
103 struct list_head list;
104 struct net_device *netdev;
105
106 u32 identifier;
107
108 /* MAC PIB */
109 __le16 pan_id;
110 __le16 short_addr;
111 __le64 extended_addr;
112
113 /* MAC BSN field */
114 u8 bsn;
115 /* MAC DSN field */
116 u8 dsn;
117
118 u8 min_be;
119 u8 max_be;
120 u8 csma_retries;
121 s8 frame_retries;
122
123 bool lbt;
124
125 bool promiscuous_mode;
126};
127
128#define to_phy(_dev) container_of(_dev, struct wpan_phy, dev)
129
130struct wpan_phy *
131wpan_phy_new(const struct cfg802154_ops *ops, size_t priv_size);
132static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev)
133{
134 phy->dev.parent = dev;
135}
136
137int wpan_phy_register(struct wpan_phy *phy);
138void wpan_phy_unregister(struct wpan_phy *phy);
139void wpan_phy_free(struct wpan_phy *phy);
140/* Same semantics as for class_for_each_device */
141int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data);
142
143static inline void *wpan_phy_priv(struct wpan_phy *phy)
144{
145 BUG_ON(!phy);
146 return &phy->priv;
147}
148
149struct wpan_phy *wpan_phy_find(const char *str);
150
151static inline void wpan_phy_put(struct wpan_phy *phy)
152{
153 put_device(&phy->dev);
154}
155
156static inline const char *wpan_phy_name(struct wpan_phy *phy)
157{
158 return dev_name(&phy->dev);
159}
160
161#endif /* __NET_CFG802154_H */
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 6465bae80a4f..e339a9513e29 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -151,4 +151,20 @@ static inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
151 (__force __be32)to, pseudohdr); 151 (__force __be32)to, pseudohdr);
152} 152}
153 153
154static inline __wsum remcsum_adjust(void *ptr, __wsum csum,
155 int start, int offset)
156{
157 __sum16 *psum = (__sum16 *)(ptr + offset);
158 __wsum delta;
159
160 /* Subtract out checksum up to start */
161 csum = csum_sub(csum, csum_partial(ptr, start, 0));
162
163 /* Set derived checksum in packet */
164 delta = csum_sub(csum_fold(csum), *psum);
165 *psum = csum_fold(csum);
166
167 return delta;
168}
169
154#endif 170#endif
diff --git a/include/net/compat.h b/include/net/compat.h
index 3b603b199c01..42a9c8431177 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -40,9 +40,8 @@ int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
40#define compat_mmsghdr mmsghdr 40#define compat_mmsghdr mmsghdr
41#endif /* defined(CONFIG_COMPAT) */ 41#endif /* defined(CONFIG_COMPAT) */
42 42
43int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); 43ssize_t get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *,
44int verify_compat_iovec(struct msghdr *, struct iovec *, 44 struct sockaddr __user **, struct iovec **);
45 struct sockaddr_storage *, int);
46asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *, 45asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *,
47 unsigned int); 46 unsigned int);
48asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, 47asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *,
diff --git a/include/net/dsa.h b/include/net/dsa.h
index b76559293535..ed3c34bbb67a 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -38,6 +38,9 @@ struct dsa_chip_data {
38 struct device *host_dev; 38 struct device *host_dev;
39 int sw_addr; 39 int sw_addr;
40 40
41 /* set to size of eeprom if supported by the switch */
42 int eeprom_len;
43
41 /* Device tree node pointer for this specific switch chip 44 /* Device tree node pointer for this specific switch chip
42 * used during switch setup in case additional properties 45 * used during switch setup in case additional properties
43 * and resources needs to be used 46 * and resources needs to be used
@@ -139,6 +142,14 @@ struct dsa_switch {
139 */ 142 */
140 struct device *master_dev; 143 struct device *master_dev;
141 144
145#ifdef CONFIG_NET_DSA_HWMON
146 /*
147 * Hardware monitoring information
148 */
149 char hwmon_name[IFNAMSIZ + 8];
150 struct device *hwmon_dev;
151#endif
152
142 /* 153 /*
143 * Slave mii_bus and devices for the individual ports. 154 * Slave mii_bus and devices for the individual ports.
144 */ 155 */
@@ -242,6 +253,28 @@ struct dsa_switch_driver {
242 struct ethtool_eee *e); 253 struct ethtool_eee *e);
243 int (*get_eee)(struct dsa_switch *ds, int port, 254 int (*get_eee)(struct dsa_switch *ds, int port,
244 struct ethtool_eee *e); 255 struct ethtool_eee *e);
256
257#ifdef CONFIG_NET_DSA_HWMON
258 /* Hardware monitoring */
259 int (*get_temp)(struct dsa_switch *ds, int *temp);
260 int (*get_temp_limit)(struct dsa_switch *ds, int *temp);
261 int (*set_temp_limit)(struct dsa_switch *ds, int temp);
262 int (*get_temp_alarm)(struct dsa_switch *ds, bool *alarm);
263#endif
264
265 /* EEPROM access */
266 int (*get_eeprom_len)(struct dsa_switch *ds);
267 int (*get_eeprom)(struct dsa_switch *ds,
268 struct ethtool_eeprom *eeprom, u8 *data);
269 int (*set_eeprom)(struct dsa_switch *ds,
270 struct ethtool_eeprom *eeprom, u8 *data);
271
272 /*
273 * Register access.
274 */
275 int (*get_regs_len)(struct dsa_switch *ds, int port);
276 void (*get_regs)(struct dsa_switch *ds, int port,
277 struct ethtool_regs *regs, void *p);
245}; 278};
246 279
247void register_switch_driver(struct dsa_switch_driver *type); 280void register_switch_driver(struct dsa_switch_driver *type);
diff --git a/include/net/fou.h b/include/net/fou.h
new file mode 100644
index 000000000000..19b8a0c62a98
--- /dev/null
+++ b/include/net/fou.h
@@ -0,0 +1,19 @@
1#ifndef __NET_FOU_H
2#define __NET_FOU_H
3
4#include <linux/skbuff.h>
5
6#include <net/flow.h>
7#include <net/gue.h>
8#include <net/ip_tunnels.h>
9#include <net/udp.h>
10
11size_t fou_encap_hlen(struct ip_tunnel_encap *e);
12static size_t gue_encap_hlen(struct ip_tunnel_encap *e);
13
14int fou_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
15 u8 *protocol, struct flowi4 *fl4);
16int gue_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
17 u8 *protocol, struct flowi4 *fl4);
18
19#endif
diff --git a/include/net/gue.h b/include/net/gue.h
index b6c332788084..3f28ec7f1c7f 100644
--- a/include/net/gue.h
+++ b/include/net/gue.h
@@ -1,23 +1,116 @@
1#ifndef __NET_GUE_H 1#ifndef __NET_GUE_H
2#define __NET_GUE_H 2#define __NET_GUE_H
3 3
4/* Definitions for the GUE header, standard and private flags, lengths
5 * of optional fields are below.
6 *
7 * Diagram of GUE header:
8 *
9 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
10 * |Ver|C| Hlen | Proto/ctype | Standard flags |P|
11 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
12 * | |
13 * ~ Fields (optional) ~
14 * | |
15 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
16 * | Private flags (optional, P bit is set) |
17 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
18 * | |
19 * ~ Private fields (optional) ~
20 * | |
21 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
22 *
23 * C bit indicates contol message when set, data message when unset.
24 * For a control message, proto/ctype is interpreted as a type of
25 * control message. For data messages, proto/ctype is the IP protocol
26 * of the next header.
27 *
28 * P bit indicates private flags field is present. The private flags
29 * may refer to options placed after this field.
30 */
31
4struct guehdr { 32struct guehdr {
5 union { 33 union {
6 struct { 34 struct {
7#if defined(__LITTLE_ENDIAN_BITFIELD) 35#if defined(__LITTLE_ENDIAN_BITFIELD)
8 __u8 hlen:4, 36 __u8 hlen:5,
9 version:4; 37 control:1,
38 version:2;
10#elif defined (__BIG_ENDIAN_BITFIELD) 39#elif defined (__BIG_ENDIAN_BITFIELD)
11 __u8 version:4, 40 __u8 version:2,
12 hlen:4; 41 control:1,
42 hlen:5;
13#else 43#else
14#error "Please fix <asm/byteorder.h>" 44#error "Please fix <asm/byteorder.h>"
15#endif 45#endif
16 __u8 next_hdr; 46 __u8 proto_ctype;
17 __u16 flags; 47 __u16 flags;
18 }; 48 };
19 __u32 word; 49 __u32 word;
20 }; 50 };
21}; 51};
22 52
53/* Standard flags in GUE header */
54
55#define GUE_FLAG_PRIV htons(1<<0) /* Private flags are in options */
56#define GUE_LEN_PRIV 4
57
58#define GUE_FLAGS_ALL (GUE_FLAG_PRIV)
59
60/* Private flags in the private option extension */
61
62#define GUE_PFLAG_REMCSUM htonl(1 << 31)
63#define GUE_PLEN_REMCSUM 4
64
65#define GUE_PFLAGS_ALL (GUE_PFLAG_REMCSUM)
66
67/* Functions to compute options length corresponding to flags.
68 * If we ever have a lot of flags this can be potentially be
69 * converted to a more optimized algorithm (table lookup
70 * for instance).
71 */
72static inline size_t guehdr_flags_len(__be16 flags)
73{
74 return ((flags & GUE_FLAG_PRIV) ? GUE_LEN_PRIV : 0);
75}
76
77static inline size_t guehdr_priv_flags_len(__be32 flags)
78{
79 return 0;
80}
81
82/* Validate standard and private flags. Returns non-zero (meaning invalid)
83 * if there is an unknown standard or private flags, or the options length for
84 * the flags exceeds the options length specific in hlen of the GUE header.
85 */
86static inline int validate_gue_flags(struct guehdr *guehdr,
87 size_t optlen)
88{
89 size_t len;
90 __be32 flags = guehdr->flags;
91
92 if (flags & ~GUE_FLAGS_ALL)
93 return 1;
94
95 len = guehdr_flags_len(flags);
96 if (len > optlen)
97 return 1;
98
99 if (flags & GUE_FLAG_PRIV) {
100 /* Private flags are last four bytes accounted in
101 * guehdr_flags_len
102 */
103 flags = *(__be32 *)((void *)&guehdr[1] + len - GUE_LEN_PRIV);
104
105 if (flags & ~GUE_PFLAGS_ALL)
106 return 1;
107
108 len += guehdr_priv_flags_len(flags);
109 if (len > optlen)
110 return 1;
111 }
112
113 return 0;
114}
115
23#endif 116#endif
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index 3b53c8e405e4..83bb8a73d23c 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -12,10 +12,6 @@
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Written by: 15 * Written by:
20 * Pavel Smolenskiy <pavel.smolenskiy@gmail.com> 16 * Pavel Smolenskiy <pavel.smolenskiy@gmail.com>
21 * Maxim Gorbachyov <maxim.gorbachev@siemens.com> 17 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
@@ -27,10 +23,10 @@
27#ifndef IEEE802154_NETDEVICE_H 23#ifndef IEEE802154_NETDEVICE_H
28#define IEEE802154_NETDEVICE_H 24#define IEEE802154_NETDEVICE_H
29 25
30#include <net/ieee802154.h>
31#include <net/af_ieee802154.h> 26#include <net/af_ieee802154.h>
32#include <linux/netdevice.h> 27#include <linux/netdevice.h>
33#include <linux/skbuff.h> 28#include <linux/skbuff.h>
29#include <linux/ieee802154.h>
34 30
35struct ieee802154_sechdr { 31struct ieee802154_sechdr {
36#if defined(__LITTLE_ENDIAN_BITFIELD) 32#if defined(__LITTLE_ENDIAN_BITFIELD)
@@ -427,8 +423,6 @@ struct ieee802154_mlme_ops {
427 423
428 /* The fields below are required. */ 424 /* The fields below are required. */
429 425
430 struct wpan_phy *(*get_phy)(const struct net_device *dev);
431
432 /* 426 /*
433 * FIXME: these should become the part of PIB/MIB interface. 427 * FIXME: these should become the part of PIB/MIB interface.
434 * However we still don't have IB interface of any kind 428 * However we still don't have IB interface of any kind
@@ -438,16 +432,6 @@ struct ieee802154_mlme_ops {
438 u8 (*get_dsn)(const struct net_device *dev); 432 u8 (*get_dsn)(const struct net_device *dev);
439}; 433};
440 434
441/* The IEEE 802.15.4 standard defines 2 type of the devices:
442 * - FFD - full functionality device
443 * - RFD - reduce functionality device
444 *
445 * So 2 sets of mlme operations are needed
446 */
447struct ieee802154_reduced_mlme_ops {
448 struct wpan_phy *(*get_phy)(const struct net_device *dev);
449};
450
451static inline struct ieee802154_mlme_ops * 435static inline struct ieee802154_mlme_ops *
452ieee802154_mlme_ops(const struct net_device *dev) 436ieee802154_mlme_ops(const struct net_device *dev)
453{ 437{
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index d1d272843b3b..9201afe083fa 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -99,4 +99,14 @@ struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
99 const struct in6_addr *daddr, const __be16 dport, 99 const struct in6_addr *daddr, const __be16 dport,
100 const int dif); 100 const int dif);
101#endif /* IS_ENABLED(CONFIG_IPV6) */ 101#endif /* IS_ENABLED(CONFIG_IPV6) */
102
103#define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \
104 (((__sk)->sk_portpair == (__ports)) && \
105 ((__sk)->sk_family == AF_INET6) && \
106 ipv6_addr_equal(&(__sk)->sk_v6_daddr, (__saddr)) && \
107 ipv6_addr_equal(&(__sk)->sk_v6_rcv_saddr, (__daddr)) && \
108 (!(__sk)->sk_bound_dev_if || \
109 ((__sk)->sk_bound_dev_if == (__dif))) && \
110 net_eq(sock_net(__sk), (__net)))
111
102#endif /* _INET6_HASHTABLES_H */ 112#endif /* _INET6_HASHTABLES_H */
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index fe7994c48b75..b2828a06a5a6 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -37,6 +37,8 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
37int inet_ctl_sock_create(struct sock **sk, unsigned short family, 37int inet_ctl_sock_create(struct sock **sk, unsigned short family,
38 unsigned short type, unsigned char protocol, 38 unsigned short type, unsigned char protocol,
39 struct net *net); 39 struct net *net);
40int inet_recv_error(struct sock *sk, struct msghdr *msg, int len,
41 int *addr_len);
40 42
41static inline void inet_ctl_sock_destroy(struct sock *sk) 43static inline void inet_ctl_sock_destroy(struct sock *sk)
42{ 44{
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index a5593dab6af7..9326c41c2d7f 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -65,7 +65,8 @@ void ip6_tnl_dst_reset(struct ip6_tnl *t);
65void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst); 65void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst);
66int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr, 66int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
67 const struct in6_addr *raddr); 67 const struct in6_addr *raddr);
68int ip6_tnl_xmit_ctl(struct ip6_tnl *t); 68int ip6_tnl_xmit_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
69 const struct in6_addr *raddr);
69__u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw); 70__u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw);
70__u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr, 71__u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,
71 const struct in6_addr *raddr); 72 const struct in6_addr *raddr);
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index dc9d2a27c315..09a819ee2151 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -201,8 +201,8 @@ void fib_free_table(struct fib_table *tb);
201 201
202#ifndef CONFIG_IP_MULTIPLE_TABLES 202#ifndef CONFIG_IP_MULTIPLE_TABLES
203 203
204#define TABLE_LOCAL_INDEX 0 204#define TABLE_LOCAL_INDEX (RT_TABLE_LOCAL & (FIB_TABLE_HASHSZ - 1))
205#define TABLE_MAIN_INDEX 1 205#define TABLE_MAIN_INDEX (RT_TABLE_MAIN & (FIB_TABLE_HASHSZ - 1))
206 206
207static inline struct fib_table *fib_get_table(struct net *net, u32 id) 207static inline struct fib_table *fib_get_table(struct net *net, u32 id)
208{ 208{
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 5bc6edeb7143..25a59eb388a6 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -117,6 +117,22 @@ struct ip_tunnel_net {
117 struct hlist_head tunnels[IP_TNL_HASH_SIZE]; 117 struct hlist_head tunnels[IP_TNL_HASH_SIZE];
118}; 118};
119 119
120struct ip_tunnel_encap_ops {
121 size_t (*encap_hlen)(struct ip_tunnel_encap *e);
122 int (*build_header)(struct sk_buff *skb, struct ip_tunnel_encap *e,
123 u8 *protocol, struct flowi4 *fl4);
124};
125
126#define MAX_IPTUN_ENCAP_OPS 8
127
128extern const struct ip_tunnel_encap_ops __rcu *
129 iptun_encaps[MAX_IPTUN_ENCAP_OPS];
130
131int ip_tunnel_encap_add_ops(const struct ip_tunnel_encap_ops *op,
132 unsigned int num);
133int ip_tunnel_encap_del_ops(const struct ip_tunnel_encap_ops *op,
134 unsigned int num);
135
120#ifdef CONFIG_INET 136#ifdef CONFIG_INET
121 137
122int ip_tunnel_init(struct net_device *dev); 138int ip_tunnel_init(struct net_device *dev);
diff --git a/include/net/ipx.h b/include/net/ipx.h
index 0143180fecc9..e5cff6811b30 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -42,6 +42,9 @@ struct ipxhdr {
42 struct ipx_address ipx_source __packed; 42 struct ipx_address ipx_source __packed;
43}; 43};
44 44
45/* From af_ipx.c */
46extern int sysctl_ipx_pprop_broadcasting;
47
45static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) 48static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
46{ 49{
47 return (struct ipxhdr *)skb_transport_header(skb); 50 return (struct ipxhdr *)skb_transport_header(skb);
@@ -147,7 +150,7 @@ int ipxrtr_add_route(__be32 network, struct ipx_interface *intrfc,
147 unsigned char *node); 150 unsigned char *node);
148void ipxrtr_del_routes(struct ipx_interface *intrfc); 151void ipxrtr_del_routes(struct ipx_interface *intrfc);
149int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, 152int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
150 struct iovec *iov, size_t len, int noblock); 153 struct msghdr *msg, size_t len, int noblock);
151int ipxrtr_route_skb(struct sk_buff *skb); 154int ipxrtr_route_skb(struct sk_buff *skb);
152struct ipx_route *ipxrtr_lookup(__be32 net); 155struct ipx_route *ipxrtr_lookup(__be32 net);
153int ipxrtr_ioctl(unsigned int cmd, void __user *arg); 156int ipxrtr_ioctl(unsigned int cmd, void __user *arg);
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h
index a059465101ff..92c8fb575213 100644
--- a/include/net/irda/irda.h
+++ b/include/net/irda/irda.h
@@ -55,16 +55,6 @@ typedef __u32 magic_t;
55#endif 55#endif
56 56
57#ifdef CONFIG_IRDA_DEBUG 57#ifdef CONFIG_IRDA_DEBUG
58
59extern unsigned int irda_debug;
60
61/* use 0 for production, 1 for verification, >2 for debug */
62#define IRDA_DEBUG_LEVEL 0
63
64#define IRDA_DEBUG(n, args...) \
65do { if (irda_debug >= (n)) \
66 printk(KERN_DEBUG args); \
67} while (0)
68#define IRDA_ASSERT(expr, func) \ 58#define IRDA_ASSERT(expr, func) \
69do { if(!(expr)) { \ 59do { if(!(expr)) { \
70 printk( "Assertion failed! %s:%s:%d %s\n", \ 60 printk( "Assertion failed! %s:%s:%d %s\n", \
@@ -72,15 +62,10 @@ do { if(!(expr)) { \
72 func } } while (0) 62 func } } while (0)
73#define IRDA_ASSERT_LABEL(label) label 63#define IRDA_ASSERT_LABEL(label) label
74#else 64#else
75#define IRDA_DEBUG(n, args...) do { } while (0)
76#define IRDA_ASSERT(expr, func) do { (void)(expr); } while (0) 65#define IRDA_ASSERT(expr, func) do { (void)(expr); } while (0)
77#define IRDA_ASSERT_LABEL(label) 66#define IRDA_ASSERT_LABEL(label)
78#endif /* CONFIG_IRDA_DEBUG */ 67#endif /* CONFIG_IRDA_DEBUG */
79 68
80#define IRDA_WARNING(args...) do { if (net_ratelimit()) printk(KERN_WARNING args); } while (0)
81#define IRDA_MESSAGE(args...) do { if (net_ratelimit()) printk(KERN_INFO args); } while (0)
82#define IRDA_ERROR(args...) do { if (net_ratelimit()) printk(KERN_ERR args); } while (0)
83
84/* 69/*
85 * Magic numbers used by Linux-IrDA. Random numbers which must be unique to 70 * Magic numbers used by Linux-IrDA. Random numbers which must be unique to
86 * give the best protection 71 * give the best protection
diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h
index fb4b76d5d7f1..6f23e820618c 100644
--- a/include/net/irda/irlap.h
+++ b/include/net/irda/irlap.h
@@ -303,7 +303,7 @@ static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state)
303 if (!self || self->magic != LAP_MAGIC) 303 if (!self || self->magic != LAP_MAGIC)
304 return; 304 return;
305 305
306 IRDA_DEBUG(4, "next LAP state = %s\n", irlap_state[state]); 306 pr_debug("next LAP state = %s\n", irlap_state[state]);
307 */ 307 */
308 self->state = state; 308 self->state = state;
309} 309}
diff --git a/include/net/irda/parameters.h b/include/net/irda/parameters.h
index 42713c931d1f..2d9cd0007cba 100644
--- a/include/net/irda/parameters.h
+++ b/include/net/irda/parameters.h
@@ -71,17 +71,17 @@ typedef int (*PV_HANDLER)(void *self, __u8 *buf, int len, __u8 pi,
71 PV_TYPE type, PI_HANDLER func); 71 PV_TYPE type, PI_HANDLER func);
72 72
73typedef struct { 73typedef struct {
74 PI_HANDLER func; /* Handler for this parameter identifier */ 74 const PI_HANDLER func; /* Handler for this parameter identifier */
75 PV_TYPE type; /* Data type for this parameter */ 75 PV_TYPE type; /* Data type for this parameter */
76} pi_minor_info_t; 76} pi_minor_info_t;
77 77
78typedef struct { 78typedef struct {
79 pi_minor_info_t *pi_minor_call_table; 79 const pi_minor_info_t *pi_minor_call_table;
80 int len; 80 int len;
81} pi_major_info_t; 81} pi_major_info_t;
82 82
83typedef struct { 83typedef struct {
84 pi_major_info_t *tables; 84 const pi_major_info_t *tables;
85 int len; 85 int len;
86 __u8 pi_mask; 86 __u8 pi_mask;
87 int pi_major_offset; 87 int pi_major_offset;
diff --git a/include/net/llc_c_st.h b/include/net/llc_c_st.h
index 0e79cfba4b3b..48f3f891b2f9 100644
--- a/include/net/llc_c_st.h
+++ b/include/net/llc_c_st.h
@@ -35,8 +35,8 @@
35struct llc_conn_state_trans { 35struct llc_conn_state_trans {
36 llc_conn_ev_t ev; 36 llc_conn_ev_t ev;
37 u8 next_state; 37 u8 next_state;
38 llc_conn_ev_qfyr_t *ev_qualifiers; 38 const llc_conn_ev_qfyr_t *ev_qualifiers;
39 llc_conn_action_t *ev_actions; 39 const llc_conn_action_t *ev_actions;
40}; 40};
41 41
42struct llc_conn_state { 42struct llc_conn_state {
diff --git a/include/net/llc_s_st.h b/include/net/llc_s_st.h
index 567c681f1f3e..c4359e203013 100644
--- a/include/net/llc_s_st.h
+++ b/include/net/llc_s_st.h
@@ -19,7 +19,7 @@
19struct llc_sap_state_trans { 19struct llc_sap_state_trans {
20 llc_sap_ev_t ev; 20 llc_sap_ev_t ev;
21 u8 next_state; 21 u8 next_state;
22 llc_sap_action_t *ev_actions; 22 const llc_sap_action_t *ev_actions;
23}; 23};
24 24
25struct llc_sap_state { 25struct llc_sap_state {
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 0ad1f47d2dc7..58d719ddaa60 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -263,6 +263,7 @@ struct ieee80211_vif_chanctx_switch {
263 * @BSS_CHANGED_BANDWIDTH: The bandwidth used by this interface changed, 263 * @BSS_CHANGED_BANDWIDTH: The bandwidth used by this interface changed,
264 * note that this is only called when it changes after the channel 264 * note that this is only called when it changes after the channel
265 * context had been assigned. 265 * context had been assigned.
266 * @BSS_CHANGED_OCB: OCB join status changed
266 */ 267 */
267enum ieee80211_bss_change { 268enum ieee80211_bss_change {
268 BSS_CHANGED_ASSOC = 1<<0, 269 BSS_CHANGED_ASSOC = 1<<0,
@@ -287,6 +288,7 @@ enum ieee80211_bss_change {
287 BSS_CHANGED_P2P_PS = 1<<19, 288 BSS_CHANGED_P2P_PS = 1<<19,
288 BSS_CHANGED_BEACON_INFO = 1<<20, 289 BSS_CHANGED_BEACON_INFO = 1<<20,
289 BSS_CHANGED_BANDWIDTH = 1<<21, 290 BSS_CHANGED_BANDWIDTH = 1<<21,
291 BSS_CHANGED_OCB = 1<<22,
290 292
291 /* when adding here, make sure to change ieee80211_reconfig */ 293 /* when adding here, make sure to change ieee80211_reconfig */
292}; 294};
@@ -739,7 +741,8 @@ struct ieee80211_tx_info {
739 u8 ampdu_ack_len; 741 u8 ampdu_ack_len;
740 u8 ampdu_len; 742 u8 ampdu_len;
741 u8 antenna; 743 u8 antenna;
742 void *status_driver_data[21 / sizeof(void *)]; 744 u16 tx_time;
745 void *status_driver_data[19 / sizeof(void *)];
743 } status; 746 } status;
744 struct { 747 struct {
745 struct ieee80211_tx_rate driver_rates[ 748 struct ieee80211_tx_rate driver_rates[
@@ -879,6 +882,9 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
879 * subframes share the same sequence number. Reported subframes can be 882 * subframes share the same sequence number. Reported subframes can be
880 * either regular MSDU or singly A-MSDUs. Subframes must not be 883 * either regular MSDU or singly A-MSDUs. Subframes must not be
881 * interleaved with other frames. 884 * interleaved with other frames.
885 * @RX_FLAG_RADIOTAP_VENDOR_DATA: This frame contains vendor-specific
886 * radiotap data in the skb->data (before the frame) as described by
887 * the &struct ieee80211_vendor_radiotap.
882 */ 888 */
883enum mac80211_rx_flags { 889enum mac80211_rx_flags {
884 RX_FLAG_MMIC_ERROR = BIT(0), 890 RX_FLAG_MMIC_ERROR = BIT(0),
@@ -908,6 +914,7 @@ enum mac80211_rx_flags {
908 RX_FLAG_10MHZ = BIT(28), 914 RX_FLAG_10MHZ = BIT(28),
909 RX_FLAG_5MHZ = BIT(29), 915 RX_FLAG_5MHZ = BIT(29),
910 RX_FLAG_AMSDU_MORE = BIT(30), 916 RX_FLAG_AMSDU_MORE = BIT(30),
917 RX_FLAG_RADIOTAP_VENDOR_DATA = BIT(31),
911}; 918};
912 919
913#define RX_FLAG_STBC_SHIFT 26 920#define RX_FLAG_STBC_SHIFT 26
@@ -979,6 +986,39 @@ struct ieee80211_rx_status {
979}; 986};
980 987
981/** 988/**
989 * struct ieee80211_vendor_radiotap - vendor radiotap data information
990 * @present: presence bitmap for this vendor namespace
991 * (this could be extended in the future if any vendor needs more
992 * bits, the radiotap spec does allow for that)
993 * @align: radiotap vendor namespace alignment. This defines the needed
994 * alignment for the @data field below, not for the vendor namespace
995 * description itself (which has a fixed 2-byte alignment)
996 * Must be a power of two, and be set to at least 1!
997 * @oui: radiotap vendor namespace OUI
998 * @subns: radiotap vendor sub namespace
999 * @len: radiotap vendor sub namespace skip length, if alignment is done
1000 * then that's added to this, i.e. this is only the length of the
1001 * @data field.
1002 * @pad: number of bytes of padding after the @data, this exists so that
1003 * the skb data alignment can be preserved even if the data has odd
1004 * length
1005 * @data: the actual vendor namespace data
1006 *
1007 * This struct, including the vendor data, goes into the skb->data before
1008 * the 802.11 header. It's split up in mac80211 using the align/oui/subns
1009 * data.
1010 */
1011struct ieee80211_vendor_radiotap {
1012 u32 present;
1013 u8 align;
1014 u8 oui[3];
1015 u8 subns;
1016 u8 pad;
1017 u16 len;
1018 u8 data[];
1019} __packed;
1020
1021/**
982 * enum ieee80211_conf_flags - configuration flags 1022 * enum ieee80211_conf_flags - configuration flags
983 * 1023 *
984 * Flags to define PHY configuration options 1024 * Flags to define PHY configuration options
@@ -1117,6 +1157,8 @@ struct ieee80211_conf {
1117 * Function (TSF) timer when the frame containing the channel switch 1157 * Function (TSF) timer when the frame containing the channel switch
1118 * announcement was received. This is simply the rx.mactime parameter 1158 * announcement was received. This is simply the rx.mactime parameter
1119 * the driver passed into mac80211. 1159 * the driver passed into mac80211.
1160 * @device_timestamp: arbitrary timestamp for the device, this is the
1161 * rx.device_timestamp parameter the driver passed to mac80211.
1120 * @block_tx: Indicates whether transmission must be blocked before the 1162 * @block_tx: Indicates whether transmission must be blocked before the
1121 * scheduled channel switch, as indicated by the AP. 1163 * scheduled channel switch, as indicated by the AP.
1122 * @chandef: the new channel to switch to 1164 * @chandef: the new channel to switch to
@@ -1124,6 +1166,7 @@ struct ieee80211_conf {
1124 */ 1166 */
1125struct ieee80211_channel_switch { 1167struct ieee80211_channel_switch {
1126 u64 timestamp; 1168 u64 timestamp;
1169 u32 device_timestamp;
1127 bool block_tx; 1170 bool block_tx;
1128 struct cfg80211_chan_def chandef; 1171 struct cfg80211_chan_def chandef;
1129 u8 count; 1172 u8 count;
@@ -1423,6 +1466,8 @@ struct ieee80211_sta_rates {
1423 * @smps_mode: current SMPS mode (off, static or dynamic) 1466 * @smps_mode: current SMPS mode (off, static or dynamic)
1424 * @rates: rate control selection table 1467 * @rates: rate control selection table
1425 * @tdls: indicates whether the STA is a TDLS peer 1468 * @tdls: indicates whether the STA is a TDLS peer
1469 * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
1470 * valid if the STA is a TDLS peer in the first place.
1426 */ 1471 */
1427struct ieee80211_sta { 1472struct ieee80211_sta {
1428 u32 supp_rates[IEEE80211_NUM_BANDS]; 1473 u32 supp_rates[IEEE80211_NUM_BANDS];
@@ -1438,6 +1483,7 @@ struct ieee80211_sta {
1438 enum ieee80211_smps_mode smps_mode; 1483 enum ieee80211_smps_mode smps_mode;
1439 struct ieee80211_sta_rates __rcu *rates; 1484 struct ieee80211_sta_rates __rcu *rates;
1440 bool tdls; 1485 bool tdls;
1486 bool tdls_initiator;
1441 1487
1442 /* must be last */ 1488 /* must be last */
1443 u8 drv_priv[0] __aligned(sizeof(void *)); 1489 u8 drv_priv[0] __aligned(sizeof(void *));
@@ -1576,6 +1622,10 @@ struct ieee80211_tx_control {
1576 * a virtual monitor interface when monitor interfaces are the only 1622 * a virtual monitor interface when monitor interfaces are the only
1577 * active interfaces. 1623 * active interfaces.
1578 * 1624 *
1625 * @IEEE80211_HW_NO_AUTO_VIF: The driver would like for no wlanX to
1626 * be created. It is expected user-space will create vifs as
1627 * desired (and thus have them named as desired).
1628 *
1579 * @IEEE80211_HW_QUEUE_CONTROL: The driver wants to control per-interface 1629 * @IEEE80211_HW_QUEUE_CONTROL: The driver wants to control per-interface
1580 * queue mapping in order to use different queues (not just one per AC) 1630 * queue mapping in order to use different queues (not just one per AC)
1581 * for different virtual interfaces. See the doc section on HW queue 1631 * for different virtual interfaces. See the doc section on HW queue
@@ -1622,7 +1672,8 @@ enum ieee80211_hw_flags {
1622 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, 1672 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
1623 IEEE80211_HW_MFP_CAPABLE = 1<<13, 1673 IEEE80211_HW_MFP_CAPABLE = 1<<13,
1624 IEEE80211_HW_WANT_MONITOR_VIF = 1<<14, 1674 IEEE80211_HW_WANT_MONITOR_VIF = 1<<14,
1625 /* free slots */ 1675 IEEE80211_HW_NO_AUTO_VIF = 1<<15,
1676 /* free slot */
1626 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, 1677 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17,
1627 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, 1678 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
1628 IEEE80211_HW_CONNECTION_MONITOR = 1<<19, 1679 IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
@@ -1776,6 +1827,31 @@ struct ieee80211_scan_request {
1776}; 1827};
1777 1828
1778/** 1829/**
1830 * struct ieee80211_tdls_ch_sw_params - TDLS channel switch parameters
1831 *
1832 * @sta: peer this TDLS channel-switch request/response came from
1833 * @chandef: channel referenced in a TDLS channel-switch request
1834 * @action_code: see &enum ieee80211_tdls_actioncode
1835 * @status: channel-switch response status
1836 * @timestamp: time at which the frame was received
1837 * @switch_time: switch-timing parameter received in the frame
1838 * @switch_timeout: switch-timing parameter received in the frame
1839 * @tmpl_skb: TDLS switch-channel response template
1840 * @ch_sw_tm_ie: offset of the channel-switch timing IE inside @tmpl_skb
1841 */
1842struct ieee80211_tdls_ch_sw_params {
1843 struct ieee80211_sta *sta;
1844 struct cfg80211_chan_def *chandef;
1845 u8 action_code;
1846 u32 status;
1847 u32 timestamp;
1848 u16 switch_time;
1849 u16 switch_timeout;
1850 struct sk_buff *tmpl_skb;
1851 u32 ch_sw_tm_ie;
1852};
1853
1854/**
1779 * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy 1855 * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy
1780 * 1856 *
1781 * @wiphy: the &struct wiphy which we want to query 1857 * @wiphy: the &struct wiphy which we want to query
@@ -2375,6 +2451,22 @@ enum ieee80211_roc_type {
2375}; 2451};
2376 2452
2377/** 2453/**
2454 * enum ieee80211_reconfig_complete_type - reconfig type
2455 *
2456 * This enum is used by the reconfig_complete() callback to indicate what
2457 * reconfiguration type was completed.
2458 *
2459 * @IEEE80211_RECONFIG_TYPE_RESTART: hw restart type
2460 * (also due to resume() callback returning 1)
2461 * @IEEE80211_RECONFIG_TYPE_SUSPEND: suspend type (regardless
2462 * of wowlan configuration)
2463 */
2464enum ieee80211_reconfig_type {
2465 IEEE80211_RECONFIG_TYPE_RESTART,
2466 IEEE80211_RECONFIG_TYPE_SUSPEND,
2467};
2468
2469/**
2378 * struct ieee80211_ops - callbacks from mac80211 to the driver 2470 * struct ieee80211_ops - callbacks from mac80211 to the driver
2379 * 2471 *
2380 * This structure contains various callbacks that the driver may 2472 * This structure contains various callbacks that the driver may
@@ -2530,7 +2622,9 @@ enum ieee80211_roc_type {
2530 * 2622 *
2531 * @sw_scan_start: Notifier function that is called just before a software scan 2623 * @sw_scan_start: Notifier function that is called just before a software scan
2532 * is started. Can be NULL, if the driver doesn't need this notification. 2624 * is started. Can be NULL, if the driver doesn't need this notification.
2533 * The callback can sleep. 2625 * The mac_addr parameter allows supporting NL80211_SCAN_FLAG_RANDOM_ADDR,
2626 * the driver may set the NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR flag if it
2627 * can use this parameter. The callback can sleep.
2534 * 2628 *
2535 * @sw_scan_complete: Notifier function that is called just after a 2629 * @sw_scan_complete: Notifier function that is called just after a
2536 * software scan finished. Can be NULL, if the driver doesn't need 2630 * software scan finished. Can be NULL, if the driver doesn't need
@@ -2601,6 +2695,9 @@ enum ieee80211_roc_type {
2601 * uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL) since 2695 * uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL) since
2602 * otherwise the rate control algorithm is notified directly. 2696 * otherwise the rate control algorithm is notified directly.
2603 * Must be atomic. 2697 * Must be atomic.
2698 * @sta_rate_tbl_update: Notifies the driver that the rate table changed. This
2699 * is only used if the configured rate control algorithm actually uses
2700 * the new rate table API, and is therefore optional. Must be atomic.
2604 * 2701 *
2605 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 2702 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
2606 * bursting) for a hardware TX queue. 2703 * bursting) for a hardware TX queue.
@@ -2809,11 +2906,11 @@ enum ieee80211_roc_type {
2809 * disabled/enabled via @bss_info_changed. 2906 * disabled/enabled via @bss_info_changed.
2810 * @stop_ap: Stop operation on the AP interface. 2907 * @stop_ap: Stop operation on the AP interface.
2811 * 2908 *
2812 * @restart_complete: Called after a call to ieee80211_restart_hw(), when the 2909 * @reconfig_complete: Called after a call to ieee80211_restart_hw() and
2813 * reconfiguration has completed. This can help the driver implement the 2910 * during resume, when the reconfiguration has completed.
2814 * reconfiguration step. Also called when reconfiguring because the 2911 * This can help the driver implement the reconfiguration step (and
2815 * driver's resume function returned 1, as this is just like an "inline" 2912 * indicate mac80211 is ready to receive frames).
2816 * hardware restart. This callback may sleep. 2913 * This callback may sleep.
2817 * 2914 *
2818 * @ipv6_addr_change: IPv6 address assignment on the given interface changed. 2915 * @ipv6_addr_change: IPv6 address assignment on the given interface changed.
2819 * Currently, this is only called for managed or P2P client interfaces. 2916 * Currently, this is only called for managed or P2P client interfaces.
@@ -2829,6 +2926,13 @@ enum ieee80211_roc_type {
2829 * transmitted and then call ieee80211_csa_finish(). 2926 * transmitted and then call ieee80211_csa_finish().
2830 * If the CSA count starts as zero or 1, this function will not be called, 2927 * If the CSA count starts as zero or 1, this function will not be called,
2831 * since there won't be any time to beacon before the switch anyway. 2928 * since there won't be any time to beacon before the switch anyway.
2929 * @pre_channel_switch: This is an optional callback that is called
2930 * before a channel switch procedure is started (ie. when a STA
2931 * gets a CSA or an userspace initiated channel-switch), allowing
2932 * the driver to prepare for the channel switch.
2933 * @post_channel_switch: This is an optional callback that is called
2934 * after a channel switch procedure is completed, allowing the
2935 * driver to go back to a normal configuration.
2832 * 2936 *
2833 * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all 2937 * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all
2834 * information in bss_conf is set up and the beacon can be retrieved. A 2938 * information in bss_conf is set up and the beacon can be retrieved. A
@@ -2838,6 +2942,26 @@ enum ieee80211_roc_type {
2838 * @get_expected_throughput: extract the expected throughput towards the 2942 * @get_expected_throughput: extract the expected throughput towards the
2839 * specified station. The returned value is expressed in Kbps. It returns 0 2943 * specified station. The returned value is expressed in Kbps. It returns 0
2840 * if the RC algorithm does not have proper data to provide. 2944 * if the RC algorithm does not have proper data to provide.
2945 *
2946 * @get_txpower: get current maximum tx power (in dBm) based on configuration
2947 * and hardware limits.
2948 *
2949 * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
2950 * is responsible for continually initiating channel-switching operations
2951 * and returning to the base channel for communication with the AP. The
2952 * driver receives a channel-switch request template and the location of
2953 * the switch-timing IE within the template as part of the invocation.
2954 * The template is valid only within the call, and the driver can
2955 * optionally copy the skb for further re-use.
2956 * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
2957 * peers must be on the base channel when the call completes.
2958 * @tdls_recv_channel_switch: a TDLS channel-switch related frame (request or
2959 * response) has been received from a remote peer. The driver gets
2960 * parameters parsed from the incoming frame and may use them to continue
2961 * an ongoing channel-switch operation. In addition, a channel-switch
2962 * response template is provided, together with the location of the
2963 * switch-timing IE within the template. The skb can only be used within
2964 * the function call.
2841 */ 2965 */
2842struct ieee80211_ops { 2966struct ieee80211_ops {
2843 void (*tx)(struct ieee80211_hw *hw, 2967 void (*tx)(struct ieee80211_hw *hw,
@@ -2897,8 +3021,11 @@ struct ieee80211_ops {
2897 struct ieee80211_scan_ies *ies); 3021 struct ieee80211_scan_ies *ies);
2898 int (*sched_scan_stop)(struct ieee80211_hw *hw, 3022 int (*sched_scan_stop)(struct ieee80211_hw *hw,
2899 struct ieee80211_vif *vif); 3023 struct ieee80211_vif *vif);
2900 void (*sw_scan_start)(struct ieee80211_hw *hw); 3024 void (*sw_scan_start)(struct ieee80211_hw *hw,
2901 void (*sw_scan_complete)(struct ieee80211_hw *hw); 3025 struct ieee80211_vif *vif,
3026 const u8 *mac_addr);
3027 void (*sw_scan_complete)(struct ieee80211_hw *hw,
3028 struct ieee80211_vif *vif);
2902 int (*get_stats)(struct ieee80211_hw *hw, 3029 int (*get_stats)(struct ieee80211_hw *hw,
2903 struct ieee80211_low_level_stats *stats); 3030 struct ieee80211_low_level_stats *stats);
2904 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, 3031 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
@@ -2932,6 +3059,9 @@ struct ieee80211_ops {
2932 struct ieee80211_vif *vif, 3059 struct ieee80211_vif *vif,
2933 struct ieee80211_sta *sta, 3060 struct ieee80211_sta *sta,
2934 u32 changed); 3061 u32 changed);
3062 void (*sta_rate_tbl_update)(struct ieee80211_hw *hw,
3063 struct ieee80211_vif *vif,
3064 struct ieee80211_sta *sta);
2935 int (*conf_tx)(struct ieee80211_hw *hw, 3065 int (*conf_tx)(struct ieee80211_hw *hw,
2936 struct ieee80211_vif *vif, u16 ac, 3066 struct ieee80211_vif *vif, u16 ac,
2937 const struct ieee80211_tx_queue_params *params); 3067 const struct ieee80211_tx_queue_params *params);
@@ -2959,6 +3089,7 @@ struct ieee80211_ops {
2959 void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 3089 void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2960 u32 queues, bool drop); 3090 u32 queues, bool drop);
2961 void (*channel_switch)(struct ieee80211_hw *hw, 3091 void (*channel_switch)(struct ieee80211_hw *hw,
3092 struct ieee80211_vif *vif,
2962 struct ieee80211_channel_switch *ch_switch); 3093 struct ieee80211_channel_switch *ch_switch);
2963 int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); 3094 int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
2964 int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); 3095 int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
@@ -3025,7 +3156,8 @@ struct ieee80211_ops {
3025 int n_vifs, 3156 int n_vifs,
3026 enum ieee80211_chanctx_switch_mode mode); 3157 enum ieee80211_chanctx_switch_mode mode);
3027 3158
3028 void (*restart_complete)(struct ieee80211_hw *hw); 3159 void (*reconfig_complete)(struct ieee80211_hw *hw,
3160 enum ieee80211_reconfig_type reconfig_type);
3029 3161
3030#if IS_ENABLED(CONFIG_IPV6) 3162#if IS_ENABLED(CONFIG_IPV6)
3031 void (*ipv6_addr_change)(struct ieee80211_hw *hw, 3163 void (*ipv6_addr_change)(struct ieee80211_hw *hw,
@@ -3035,14 +3167,54 @@ struct ieee80211_ops {
3035 void (*channel_switch_beacon)(struct ieee80211_hw *hw, 3167 void (*channel_switch_beacon)(struct ieee80211_hw *hw,
3036 struct ieee80211_vif *vif, 3168 struct ieee80211_vif *vif,
3037 struct cfg80211_chan_def *chandef); 3169 struct cfg80211_chan_def *chandef);
3170 int (*pre_channel_switch)(struct ieee80211_hw *hw,
3171 struct ieee80211_vif *vif,
3172 struct ieee80211_channel_switch *ch_switch);
3173
3174 int (*post_channel_switch)(struct ieee80211_hw *hw,
3175 struct ieee80211_vif *vif);
3038 3176
3039 int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 3177 int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
3040 void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 3178 void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
3041 u32 (*get_expected_throughput)(struct ieee80211_sta *sta); 3179 u32 (*get_expected_throughput)(struct ieee80211_sta *sta);
3180 int (*get_txpower)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
3181 int *dbm);
3182
3183 int (*tdls_channel_switch)(struct ieee80211_hw *hw,
3184 struct ieee80211_vif *vif,
3185 struct ieee80211_sta *sta, u8 oper_class,
3186 struct cfg80211_chan_def *chandef,
3187 struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie);
3188 void (*tdls_cancel_channel_switch)(struct ieee80211_hw *hw,
3189 struct ieee80211_vif *vif,
3190 struct ieee80211_sta *sta);
3191 void (*tdls_recv_channel_switch)(struct ieee80211_hw *hw,
3192 struct ieee80211_vif *vif,
3193 struct ieee80211_tdls_ch_sw_params *params);
3042}; 3194};
3043 3195
3044/** 3196/**
3045 * ieee80211_alloc_hw - Allocate a new hardware device 3197 * ieee80211_alloc_hw_nm - Allocate a new hardware device
3198 *
3199 * This must be called once for each hardware device. The returned pointer
3200 * must be used to refer to this device when calling other functions.
3201 * mac80211 allocates a private data area for the driver pointed to by
3202 * @priv in &struct ieee80211_hw, the size of this area is given as
3203 * @priv_data_len.
3204 *
3205 * @priv_data_len: length of private data
3206 * @ops: callbacks for this device
3207 * @requested_name: Requested name for this device.
3208 * NULL is valid value, and means use the default naming (phy%d)
3209 *
3210 * Return: A pointer to the new hardware device, or %NULL on error.
3211 */
3212struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
3213 const struct ieee80211_ops *ops,
3214 const char *requested_name);
3215
3216/**
3217 * ieee80211_alloc_hw - Allocate a new hardware device
3046 * 3218 *
3047 * This must be called once for each hardware device. The returned pointer 3219 * This must be called once for each hardware device. The returned pointer
3048 * must be used to refer to this device when calling other functions. 3220 * must be used to refer to this device when calling other functions.
@@ -3055,8 +3227,12 @@ struct ieee80211_ops {
3055 * 3227 *
3056 * Return: A pointer to the new hardware device, or %NULL on error. 3228 * Return: A pointer to the new hardware device, or %NULL on error.
3057 */ 3229 */
3230static inline
3058struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, 3231struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
3059 const struct ieee80211_ops *ops); 3232 const struct ieee80211_ops *ops)
3233{
3234 return ieee80211_alloc_hw_nm(priv_data_len, ops, NULL);
3235}
3060 3236
3061/** 3237/**
3062 * ieee80211_register_hw - Register hardware device 3238 * ieee80211_register_hw - Register hardware device
@@ -3443,6 +3619,26 @@ void ieee80211_tx_status(struct ieee80211_hw *hw,
3443 struct sk_buff *skb); 3619 struct sk_buff *skb);
3444 3620
3445/** 3621/**
3622 * ieee80211_tx_status_noskb - transmit status callback without skb
3623 *
3624 * This function can be used as a replacement for ieee80211_tx_status
3625 * in drivers that cannot reliably map tx status information back to
3626 * specific skbs.
3627 *
3628 * Calls to this function for a single hardware must be synchronized
3629 * against each other. Calls to this function, ieee80211_tx_status_ni()
3630 * and ieee80211_tx_status_irqsafe() may not be mixed for a single hardware.
3631 *
3632 * @hw: the hardware the frame was transmitted by
3633 * @sta: the receiver station to which this packet is sent
3634 * (NULL for multicast packets)
3635 * @info: tx status information
3636 */
3637void ieee80211_tx_status_noskb(struct ieee80211_hw *hw,
3638 struct ieee80211_sta *sta,
3639 struct ieee80211_tx_info *info);
3640
3641/**
3446 * ieee80211_tx_status_ni - transmit status callback (in process context) 3642 * ieee80211_tx_status_ni - transmit status callback (in process context)
3447 * 3643 *
3448 * Like ieee80211_tx_status() but can be called in process context. 3644 * Like ieee80211_tx_status() but can be called in process context.
@@ -3655,7 +3851,7 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
3655/** 3851/**
3656 * ieee80211_probereq_get - retrieve a Probe Request template 3852 * ieee80211_probereq_get - retrieve a Probe Request template
3657 * @hw: pointer obtained from ieee80211_alloc_hw(). 3853 * @hw: pointer obtained from ieee80211_alloc_hw().
3658 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3854 * @src_addr: source MAC address
3659 * @ssid: SSID buffer 3855 * @ssid: SSID buffer
3660 * @ssid_len: length of SSID 3856 * @ssid_len: length of SSID
3661 * @tailroom: tailroom to reserve at end of SKB for IEs 3857 * @tailroom: tailroom to reserve at end of SKB for IEs
@@ -3666,7 +3862,7 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
3666 * Return: The Probe Request template. %NULL on error. 3862 * Return: The Probe Request template. %NULL on error.
3667 */ 3863 */
3668struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, 3864struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
3669 struct ieee80211_vif *vif, 3865 const u8 *src_addr,
3670 const u8 *ssid, size_t ssid_len, 3866 const u8 *ssid, size_t ssid_len,
3671 size_t tailroom); 3867 size_t tailroom);
3672 3868
@@ -4172,6 +4368,22 @@ void ieee80211_iterate_active_interfaces_rtnl(struct ieee80211_hw *hw,
4172 void *data); 4368 void *data);
4173 4369
4174/** 4370/**
4371 * ieee80211_iterate_stations_atomic - iterate stations
4372 *
4373 * This function iterates over all stations associated with a given
4374 * hardware that are currently uploaded to the driver and calls the callback
4375 * function for them.
4376 * This function requires the iterator callback function to be atomic,
4377 *
4378 * @hw: the hardware struct of which the interfaces should be iterated over
4379 * @iterator: the iterator function to call, cannot sleep
4380 * @data: first argument of the iterator function
4381 */
4382void ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw,
4383 void (*iterator)(void *data,
4384 struct ieee80211_sta *sta),
4385 void *data);
4386/**
4175 * ieee80211_queue_work - add work onto the mac80211 workqueue 4387 * ieee80211_queue_work - add work onto the mac80211 workqueue
4176 * 4388 *
4177 * Drivers and mac80211 use this to add work onto the mac80211 workqueue. 4389 * Drivers and mac80211 use this to add work onto the mac80211 workqueue.
@@ -4480,6 +4692,14 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
4480 gfp_t gfp); 4692 gfp_t gfp);
4481 4693
4482/** 4694/**
4695 * ieee80211_cqm_beacon_loss_notify - inform CQM of beacon loss
4696 *
4697 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
4698 * @gfp: context flags
4699 */
4700void ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp);
4701
4702/**
4483 * ieee80211_radar_detected - inform that a radar was detected 4703 * ieee80211_radar_detected - inform that a radar was detected
4484 * 4704 *
4485 * @hw: pointer as obtained from ieee80211_alloc_hw() 4705 * @hw: pointer as obtained from ieee80211_alloc_hw()
@@ -4637,6 +4857,10 @@ struct rate_control_ops {
4637 void (*free_sta)(void *priv, struct ieee80211_sta *sta, 4857 void (*free_sta)(void *priv, struct ieee80211_sta *sta,
4638 void *priv_sta); 4858 void *priv_sta);
4639 4859
4860 void (*tx_status_noskb)(void *priv,
4861 struct ieee80211_supported_band *sband,
4862 struct ieee80211_sta *sta, void *priv_sta,
4863 struct ieee80211_tx_info *info);
4640 void (*tx_status)(void *priv, struct ieee80211_supported_band *sband, 4864 void (*tx_status)(void *priv, struct ieee80211_supported_band *sband,
4641 struct ieee80211_sta *sta, void *priv_sta, 4865 struct ieee80211_sta *sta, void *priv_sta,
4642 struct sk_buff *skb); 4866 struct sk_buff *skb);
@@ -4888,4 +5112,69 @@ void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf);
4888void ieee80211_tdls_oper_request(struct ieee80211_vif *vif, const u8 *peer, 5112void ieee80211_tdls_oper_request(struct ieee80211_vif *vif, const u8 *peer,
4889 enum nl80211_tdls_operation oper, 5113 enum nl80211_tdls_operation oper,
4890 u16 reason_code, gfp_t gfp); 5114 u16 reason_code, gfp_t gfp);
5115
5116/**
5117 * ieee80211_reserve_tid - request to reserve a specific TID
5118 *
5119 * There is sometimes a need (such as in TDLS) for blocking the driver from
5120 * using a specific TID so that the FW can use it for certain operations such
5121 * as sending PTI requests. To make sure that the driver doesn't use that TID,
5122 * this function must be called as it flushes out packets on this TID and marks
5123 * it as blocked, so that any transmit for the station on this TID will be
5124 * redirected to the alternative TID in the same AC.
5125 *
5126 * Note that this function blocks and may call back into the driver, so it
5127 * should be called without driver locks held. Also note this function should
5128 * only be called from the driver's @sta_state callback.
5129 *
5130 * @sta: the station to reserve the TID for
5131 * @tid: the TID to reserve
5132 *
5133 * Returns: 0 on success, else on failure
5134 */
5135int ieee80211_reserve_tid(struct ieee80211_sta *sta, u8 tid);
5136
5137/**
5138 * ieee80211_unreserve_tid - request to unreserve a specific TID
5139 *
5140 * Once there is no longer any need for reserving a certain TID, this function
5141 * should be called, and no longer will packets have their TID modified for
5142 * preventing use of this TID in the driver.
5143 *
5144 * Note that this function blocks and acquires a lock, so it should be called
5145 * without driver locks held. Also note this function should only be called
5146 * from the driver's @sta_state callback.
5147 *
5148 * @sta: the station
5149 * @tid: the TID to unreserve
5150 */
5151void ieee80211_unreserve_tid(struct ieee80211_sta *sta, u8 tid);
5152
5153/**
5154 * ieee80211_ie_split - split an IE buffer according to ordering
5155 *
5156 * @ies: the IE buffer
5157 * @ielen: the length of the IE buffer
5158 * @ids: an array with element IDs that are allowed before
5159 * the split
5160 * @n_ids: the size of the element ID array
5161 * @offset: offset where to start splitting in the buffer
5162 *
5163 * This function splits an IE buffer by updating the @offset
5164 * variable to point to the location where the buffer should be
5165 * split.
5166 *
5167 * It assumes that the given IE buffer is well-formed, this
5168 * has to be guaranteed by the caller!
5169 *
5170 * It also assumes that the IEs in the buffer are ordered
5171 * correctly, if not the result of using this function will not
5172 * be ordered correctly either, i.e. it does no reordering.
5173 *
5174 * The function returns the offset where the next part of the
5175 * buffer starts, which may be @ielen if the entire (remainder)
5176 * of the buffer should be used.
5177 */
5178size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
5179 const u8 *ids, int n_ids, size_t offset);
4891#endif /* MAC80211_H */ 5180#endif /* MAC80211_H */
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index 2e67cdd19cdc..c823d910b46c 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -12,14 +12,12 @@
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */ 15 */
19#ifndef NET_MAC802154_H 16#ifndef NET_MAC802154_H
20#define NET_MAC802154_H 17#define NET_MAC802154_H
21 18
22#include <net/af_ieee802154.h> 19#include <net/af_ieee802154.h>
20#include <linux/ieee802154.h>
23#include <linux/skbuff.h> 21#include <linux/skbuff.h>
24 22
25/* General MAC frame format: 23/* General MAC frame format:
@@ -35,13 +33,13 @@
35 */ 33 */
36 34
37/* indicates that the Short Address changed */ 35/* indicates that the Short Address changed */
38#define IEEE802515_AFILT_SADDR_CHANGED 0x00000001 36#define IEEE802154_AFILT_SADDR_CHANGED 0x00000001
39/* indicates that the IEEE Address changed */ 37/* indicates that the IEEE Address changed */
40#define IEEE802515_AFILT_IEEEADDR_CHANGED 0x00000002 38#define IEEE802154_AFILT_IEEEADDR_CHANGED 0x00000002
41/* indicates that the PAN ID changed */ 39/* indicates that the PAN ID changed */
42#define IEEE802515_AFILT_PANID_CHANGED 0x00000004 40#define IEEE802154_AFILT_PANID_CHANGED 0x00000004
43/* indicates that PAN Coordinator status changed */ 41/* indicates that PAN Coordinator status changed */
44#define IEEE802515_AFILT_PANC_CHANGED 0x00000008 42#define IEEE802154_AFILT_PANC_CHANGED 0x00000008
45 43
46struct ieee802154_hw_addr_filt { 44struct ieee802154_hw_addr_filt {
47 __le16 pan_id; /* Each independent PAN selects a unique 45 __le16 pan_id; /* Each independent PAN selects a unique
@@ -55,7 +53,14 @@ struct ieee802154_hw_addr_filt {
55 u8 pan_coord; 53 u8 pan_coord;
56}; 54};
57 55
58struct ieee802154_dev { 56struct ieee802154_vif {
57 int type;
58
59 /* must be last */
60 u8 drv_priv[0] __aligned(sizeof(void *));
61};
62
63struct ieee802154_hw {
59 /* filled by the driver */ 64 /* filled by the driver */
60 int extra_tx_headroom; 65 int extra_tx_headroom;
61 u32 flags; 66 u32 flags;
@@ -65,6 +70,7 @@ struct ieee802154_dev {
65 struct ieee802154_hw_addr_filt hw_filt; 70 struct ieee802154_hw_addr_filt hw_filt;
66 void *priv; 71 void *priv;
67 struct wpan_phy *phy; 72 struct wpan_phy *phy;
73 size_t vif_data_size;
68}; 74};
69 75
70/* Checksum is in hardware and is omitted from a packet 76/* Checksum is in hardware and is omitted from a packet
@@ -76,28 +82,43 @@ struct ieee802154_dev {
76 * however, so you are advised to review these flags carefully. 82 * however, so you are advised to review these flags carefully.
77 */ 83 */
78 84
79/* Indicates that receiver omits FCS and xmitter will add FCS on it's own. */ 85/* Indicates that xmitter will add FCS on it's own. */
80#define IEEE802154_HW_OMIT_CKSUM 0x00000001 86#define IEEE802154_HW_TX_OMIT_CKSUM 0x00000001
81/* Indicates that receiver will autorespond with ACK frames. */ 87/* Indicates that receiver will autorespond with ACK frames. */
82#define IEEE802154_HW_AACK 0x00000002 88#define IEEE802154_HW_AACK 0x00000002
83/* Indicates that transceiver will support transmit power setting. */ 89/* Indicates that transceiver will support transmit power setting. */
84#define IEEE802154_HW_TXPOWER 0x00000004 90#define IEEE802154_HW_TXPOWER 0x00000004
85/* Indicates that transceiver will support listen before transmit. */ 91/* Indicates that transceiver will support listen before transmit. */
86#define IEEE802154_HW_LBT 0x00000008 92#define IEEE802154_HW_LBT 0x00000008
87/* Indicates that transceiver will support cca mode setting. */ 93/* Indicates that transceiver will support cca mode setting. */
88#define IEEE802154_HW_CCA_MODE 0x00000010 94#define IEEE802154_HW_CCA_MODE 0x00000010
89/* Indicates that transceiver will support cca ed level setting. */ 95/* Indicates that transceiver will support cca ed level setting. */
90#define IEEE802154_HW_CCA_ED_LEVEL 0x00000020 96#define IEEE802154_HW_CCA_ED_LEVEL 0x00000020
91/* Indicates that transceiver will support csma (max_be, min_be, csma retries) 97/* Indicates that transceiver will support csma (max_be, min_be, csma retries)
92 * settings. */ 98 * settings. */
93#define IEEE802154_HW_CSMA_PARAMS 0x00000040 99#define IEEE802154_HW_CSMA_PARAMS 0x00000040
94/* Indicates that transceiver will support ARET frame retries setting. */ 100/* Indicates that transceiver will support ARET frame retries setting. */
95#define IEEE802154_HW_FRAME_RETRIES 0x00000080 101#define IEEE802154_HW_FRAME_RETRIES 0x00000080
102/* Indicates that transceiver will support hardware address filter setting. */
103#define IEEE802154_HW_AFILT 0x00000100
104/* Indicates that transceiver will support promiscuous mode setting. */
105#define IEEE802154_HW_PROMISCUOUS 0x00000200
106/* Indicates that receiver omits FCS. */
107#define IEEE802154_HW_RX_OMIT_CKSUM 0x00000400
108/* Indicates that receiver will not filter frames with bad checksum. */
109#define IEEE802154_HW_RX_DROP_BAD_CKSUM 0x00000800
110
111/* Indicates that receiver omits FCS and xmitter will add FCS on it's own. */
112#define IEEE802154_HW_OMIT_CKSUM (IEEE802154_HW_TX_OMIT_CKSUM | \
113 IEEE802154_HW_RX_OMIT_CKSUM)
96 114
97/* This groups the most common CSMA support fields into one. */ 115/* This groups the most common CSMA support fields into one. */
98#define IEEE802154_HW_CSMA (IEEE802154_HW_CCA_MODE | \ 116#define IEEE802154_HW_CSMA (IEEE802154_HW_CCA_MODE | \
99 IEEE802154_HW_CCA_ED_LEVEL | \ 117 IEEE802154_HW_CCA_ED_LEVEL | \
100 IEEE802154_HW_CSMA_PARAMS | \ 118 IEEE802154_HW_CSMA_PARAMS)
119
120/* This groups the most common ARET support fields into one. */
121#define IEEE802154_HW_ARET (IEEE802154_HW_CSMA | \
101 IEEE802154_HW_FRAME_RETRIES) 122 IEEE802154_HW_FRAME_RETRIES)
102 123
103/* struct ieee802154_ops - callbacks from mac802154 to the driver 124/* struct ieee802154_ops - callbacks from mac802154 to the driver
@@ -112,12 +133,24 @@ struct ieee802154_dev {
112 * stop: Handler that 802.15.4 module calls for device cleanup. 133 * stop: Handler that 802.15.4 module calls for device cleanup.
113 * This function is called after the last interface is removed. 134 * This function is called after the last interface is removed.
114 * 135 *
115 * xmit: Handler that 802.15.4 module calls for each transmitted frame. 136 * xmit_sync:
137 * Handler that 802.15.4 module calls for each transmitted frame.
138 * skb cntains the buffer starting from the IEEE 802.15.4 header.
139 * The low-level driver should send the frame based on available
140 * configuration. This is called by a workqueue and useful for
141 * synchronous 802.15.4 drivers.
142 * This function should return zero or negative errno.
143 *
144 * WARNING:
145 * This will be deprecated soon. We don't accept synced xmit callbacks
146 * drivers anymore.
147 *
148 * xmit_async:
149 * Handler that 802.15.4 module calls for each transmitted frame.
116 * skb cntains the buffer starting from the IEEE 802.15.4 header. 150 * skb cntains the buffer starting from the IEEE 802.15.4 header.
117 * The low-level driver should send the frame based on available 151 * The low-level driver should send the frame based on available
118 * configuration. 152 * configuration.
119 * This function should return zero or negative errno. Called with 153 * This function should return zero or negative errno.
120 * pib_lock held.
121 * 154 *
122 * ed: Handler that 802.15.4 module calls for Energy Detection. 155 * ed: Handler that 802.15.4 module calls for Energy Detection.
123 * This function should place the value for detected energy 156 * This function should place the value for detected energy
@@ -159,40 +192,75 @@ struct ieee802154_dev {
159 * set_frame_retries 192 * set_frame_retries
160 * Sets the retransmission attempt limit. Called with pib_lock held. 193 * Sets the retransmission attempt limit. Called with pib_lock held.
161 * Returns either zero, or negative errno. 194 * Returns either zero, or negative errno.
195 *
196 * set_promiscuous_mode
197 * Enables or disable promiscuous mode.
162 */ 198 */
163struct ieee802154_ops { 199struct ieee802154_ops {
164 struct module *owner; 200 struct module *owner;
165 int (*start)(struct ieee802154_dev *dev); 201 int (*start)(struct ieee802154_hw *hw);
166 void (*stop)(struct ieee802154_dev *dev); 202 void (*stop)(struct ieee802154_hw *hw);
167 int (*xmit)(struct ieee802154_dev *dev, 203 int (*xmit_sync)(struct ieee802154_hw *hw,
168 struct sk_buff *skb); 204 struct sk_buff *skb);
169 int (*ed)(struct ieee802154_dev *dev, u8 *level); 205 int (*xmit_async)(struct ieee802154_hw *hw,
170 int (*set_channel)(struct ieee802154_dev *dev, 206 struct sk_buff *skb);
171 int page, 207 int (*ed)(struct ieee802154_hw *hw, u8 *level);
172 int channel); 208 int (*set_channel)(struct ieee802154_hw *hw, u8 page,
173 int (*set_hw_addr_filt)(struct ieee802154_dev *dev, 209 u8 channel);
174 struct ieee802154_hw_addr_filt *filt, 210 int (*set_hw_addr_filt)(struct ieee802154_hw *hw,
211 struct ieee802154_hw_addr_filt *filt,
175 unsigned long changed); 212 unsigned long changed);
176 int (*ieee_addr)(struct ieee802154_dev *dev, __le64 addr); 213 int (*set_txpower)(struct ieee802154_hw *hw, int db);
177 int (*set_txpower)(struct ieee802154_dev *dev, int db); 214 int (*set_lbt)(struct ieee802154_hw *hw, bool on);
178 int (*set_lbt)(struct ieee802154_dev *dev, bool on); 215 int (*set_cca_mode)(struct ieee802154_hw *hw, u8 mode);
179 int (*set_cca_mode)(struct ieee802154_dev *dev, u8 mode); 216 int (*set_cca_ed_level)(struct ieee802154_hw *hw,
180 int (*set_cca_ed_level)(struct ieee802154_dev *dev,
181 s32 level); 217 s32 level);
182 int (*set_csma_params)(struct ieee802154_dev *dev, 218 int (*set_csma_params)(struct ieee802154_hw *hw,
183 u8 min_be, u8 max_be, u8 retries); 219 u8 min_be, u8 max_be, u8 retries);
184 int (*set_frame_retries)(struct ieee802154_dev *dev, 220 int (*set_frame_retries)(struct ieee802154_hw *hw,
185 s8 retries); 221 s8 retries);
222 int (*set_promiscuous_mode)(struct ieee802154_hw *hw,
223 const bool on);
186}; 224};
187 225
188/* Basic interface to register ieee802154 device */ 226/**
189struct ieee802154_dev * 227 * ieee802154_be64_to_le64 - copies and convert be64 to le64
190ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops); 228 * @le64_dst: le64 destination pointer
191void ieee802154_free_device(struct ieee802154_dev *dev); 229 * @be64_src: be64 source pointer
192int ieee802154_register_device(struct ieee802154_dev *dev); 230 */
193void ieee802154_unregister_device(struct ieee802154_dev *dev); 231static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src)
232{
233 __le64 tmp = (__force __le64)swab64p(be64_src);
234
235 memcpy(le64_dst, &tmp, IEEE802154_EXTENDED_ADDR_LEN);
236}
194 237
195void ieee802154_rx_irqsafe(struct ieee802154_dev *dev, struct sk_buff *skb, 238/**
239 * ieee802154_le64_to_be64 - copies and convert le64 to be64
240 * @be64_dst: be64 destination pointer
241 * @le64_src: le64 source pointer
242 */
243static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src)
244{
245 __be64 tmp = (__force __be64)swab64p(le64_src);
246
247 memcpy(be64_dst, &tmp, IEEE802154_EXTENDED_ADDR_LEN);
248}
249
250/* Basic interface to register ieee802154 hwice */
251struct ieee802154_hw *
252ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops);
253void ieee802154_free_hw(struct ieee802154_hw *hw);
254int ieee802154_register_hw(struct ieee802154_hw *hw);
255void ieee802154_unregister_hw(struct ieee802154_hw *hw);
256
257void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb);
258void ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb,
196 u8 lqi); 259 u8 lqi);
197 260
261void ieee802154_wake_queue(struct ieee802154_hw *hw);
262void ieee802154_stop_queue(struct ieee802154_hw *hw);
263void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
264 bool ifs_handling);
265
198#endif /* NET_MAC802154_H */ 266#endif /* NET_MAC802154_H */
diff --git a/include/net/mpls.h b/include/net/mpls.h
new file mode 100644
index 000000000000..5b3b5addfb08
--- /dev/null
+++ b/include/net/mpls.h
@@ -0,0 +1,39 @@
1/*
2 * Copyright (c) 2014 Nicira, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 */
13
14#ifndef _NET_MPLS_H
15#define _NET_MPLS_H 1
16
17#include <linux/if_ether.h>
18#include <linux/netdevice.h>
19
20#define MPLS_HLEN 4
21
22static inline bool eth_p_mpls(__be16 eth_type)
23{
24 return eth_type == htons(ETH_P_MPLS_UC) ||
25 eth_type == htons(ETH_P_MPLS_MC);
26}
27
28/*
29 * For non-MPLS skbs this will correspond to the network header.
30 * For MPLS skbs it will be before the network_header as the MPLS
31 * label stack lies between the end of the mac header and the network
32 * header. That is, for MPLS skbs the end of the mac header
33 * is the top of the MPLS label stack.
34 */
35static inline unsigned char *skb_mpls_header(struct sk_buff *skb)
36{
37 return skb_mac_header(skb) + skb->mac_len;
38}
39#endif
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index f60558d0254c..eb070b3674a1 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -69,7 +69,7 @@ struct neigh_parms {
69 struct net *net; 69 struct net *net;
70#endif 70#endif
71 struct net_device *dev; 71 struct net_device *dev;
72 struct neigh_parms *next; 72 struct list_head list;
73 int (*neigh_setup)(struct neighbour *); 73 int (*neigh_setup)(struct neighbour *);
74 void (*neigh_cleanup)(struct neighbour *); 74 void (*neigh_cleanup)(struct neighbour *);
75 struct neigh_table *tbl; 75 struct neigh_table *tbl;
@@ -203,6 +203,7 @@ 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 struct list_head parms_list;
206 int gc_interval; 207 int gc_interval;
207 int gc_thresh1; 208 int gc_thresh1;
208 int gc_thresh2; 209 int gc_thresh2;
@@ -219,6 +220,13 @@ struct neigh_table {
219 struct pneigh_entry **phash_buckets; 220 struct pneigh_entry **phash_buckets;
220}; 221};
221 222
223enum {
224 NEIGH_ARP_TABLE = 0,
225 NEIGH_ND_TABLE = 1,
226 NEIGH_DN_TABLE = 2,
227 NEIGH_NR_TABLES,
228};
229
222static inline int neigh_parms_family(struct neigh_parms *p) 230static inline int neigh_parms_family(struct neigh_parms *p)
223{ 231{
224 return p->tbl->family; 232 return p->tbl->family;
@@ -239,8 +247,8 @@ static inline void *neighbour_priv(const struct neighbour *n)
239#define NEIGH_UPDATE_F_ISROUTER 0x40000000 247#define NEIGH_UPDATE_F_ISROUTER 0x40000000
240#define NEIGH_UPDATE_F_ADMIN 0x80000000 248#define NEIGH_UPDATE_F_ADMIN 0x80000000
241 249
242void neigh_table_init(struct neigh_table *tbl); 250void neigh_table_init(int index, struct neigh_table *tbl);
243int neigh_table_clear(struct neigh_table *tbl); 251int neigh_table_clear(int index, struct neigh_table *tbl);
244struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey, 252struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey,
245 struct net_device *dev); 253 struct net_device *dev);
246struct neighbour *neigh_lookup_nodev(struct neigh_table *tbl, struct net *net, 254struct neighbour *neigh_lookup_nodev(struct neigh_table *tbl, struct net *net,
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index c8a7db605e03..f0daed2b54d1 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -92,12 +92,18 @@ struct nf_conn {
92 /* Have we seen traffic both ways yet? (bitset) */ 92 /* Have we seen traffic both ways yet? (bitset) */
93 unsigned long status; 93 unsigned long status;
94 94
95 /* If we were expected by an expectation, this will be it */
96 struct nf_conn *master;
97
98 /* Timer function; drops refcnt when it goes off. */ 95 /* Timer function; drops refcnt when it goes off. */
99 struct timer_list timeout; 96 struct timer_list timeout;
100 97
98#ifdef CONFIG_NET_NS
99 struct net *ct_net;
100#endif
101 /* all members below initialized via memset */
102 u8 __nfct_init_offset[0];
103
104 /* If we were expected by an expectation, this will be it */
105 struct nf_conn *master;
106
101#if defined(CONFIG_NF_CONNTRACK_MARK) 107#if defined(CONFIG_NF_CONNTRACK_MARK)
102 u_int32_t mark; 108 u_int32_t mark;
103#endif 109#endif
@@ -108,9 +114,6 @@ struct nf_conn {
108 114
109 /* Extensions */ 115 /* Extensions */
110 struct nf_ct_ext *ext; 116 struct nf_ct_ext *ext;
111#ifdef CONFIG_NET_NS
112 struct net *ct_net;
113#endif
114 117
115 /* Storage reserved for other modules, must be the last member */ 118 /* Storage reserved for other modules, must be the last member */
116 union nf_conntrack_proto proto; 119 union nf_conntrack_proto proto;
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index cc0c18827602..f2f0fa3bb150 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -72,7 +72,7 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
72 return ret; 72 return ret;
73} 73}
74 74
75int 75void
76print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, 76print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
77 const struct nf_conntrack_l3proto *l3proto, 77 const struct nf_conntrack_l3proto *l3proto,
78 const struct nf_conntrack_l4proto *proto); 78 const struct nf_conntrack_l4proto *proto);
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index adc1fa3dd7ab..cdc920b4c4c2 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -38,8 +38,8 @@ struct nf_conntrack_l3proto {
38 const struct nf_conntrack_tuple *orig); 38 const struct nf_conntrack_tuple *orig);
39 39
40 /* Print out the per-protocol part of the tuple. */ 40 /* Print out the per-protocol part of the tuple. */
41 int (*print_tuple)(struct seq_file *s, 41 void (*print_tuple)(struct seq_file *s,
42 const struct nf_conntrack_tuple *); 42 const struct nf_conntrack_tuple *);
43 43
44 /* 44 /*
45 * Called before tracking. 45 * Called before tracking.
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index 4c8d573830b7..1f7061313d54 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -56,11 +56,11 @@ struct nf_conntrack_l4proto {
56 u_int8_t pf, unsigned int hooknum); 56 u_int8_t pf, unsigned int hooknum);
57 57
58 /* Print out the per-protocol part of the tuple. Return like seq_* */ 58 /* Print out the per-protocol part of the tuple. Return like seq_* */
59 int (*print_tuple)(struct seq_file *s, 59 void (*print_tuple)(struct seq_file *s,
60 const struct nf_conntrack_tuple *); 60 const struct nf_conntrack_tuple *);
61 61
62 /* Print out the private part of the conntrack. */ 62 /* Print out the private part of the conntrack. */
63 int (*print_conntrack)(struct seq_file *s, struct nf_conn *); 63 void (*print_conntrack)(struct seq_file *s, struct nf_conn *);
64 64
65 /* Return the array of timeouts for this protocol. */ 65 /* Return the array of timeouts for this protocol. */
66 unsigned int *(*get_timeouts)(struct net *net); 66 unsigned int *(*get_timeouts)(struct net *net);
diff --git a/include/net/netfilter/nf_nat_redirect.h b/include/net/netfilter/nf_nat_redirect.h
new file mode 100644
index 000000000000..73b729543309
--- /dev/null
+++ b/include/net/netfilter/nf_nat_redirect.h
@@ -0,0 +1,12 @@
1#ifndef _NF_NAT_REDIRECT_H_
2#define _NF_NAT_REDIRECT_H_
3
4unsigned int
5nf_nat_redirect_ipv4(struct sk_buff *skb,
6 const struct nf_nat_ipv4_multi_range_compat *mr,
7 unsigned int hooknum);
8unsigned int
9nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range *range,
10 unsigned int hooknum);
11
12#endif /* _NF_NAT_REDIRECT_H_ */
diff --git a/include/net/netfilter/nf_tables_bridge.h b/include/net/netfilter/nf_tables_bridge.h
new file mode 100644
index 000000000000..511fb79f6dad
--- /dev/null
+++ b/include/net/netfilter/nf_tables_bridge.h
@@ -0,0 +1,7 @@
1#ifndef _NET_NF_TABLES_BRIDGE_H
2#define _NET_NF_TABLES_BRIDGE_H
3
4int nft_bridge_iphdr_validate(struct sk_buff *skb);
5int nft_bridge_ip6hdr_validate(struct sk_buff *skb);
6
7#endif /* _NET_NF_TABLES_BRIDGE_H */
diff --git a/include/net/netfilter/nft_redir.h b/include/net/netfilter/nft_redir.h
new file mode 100644
index 000000000000..a2d67546afab
--- /dev/null
+++ b/include/net/netfilter/nft_redir.h
@@ -0,0 +1,21 @@
1#ifndef _NFT_REDIR_H_
2#define _NFT_REDIR_H_
3
4struct nft_redir {
5 enum nft_registers sreg_proto_min:8;
6 enum nft_registers sreg_proto_max:8;
7 u16 flags;
8};
9
10extern const struct nla_policy nft_redir_policy[];
11
12int nft_redir_init(const struct nft_ctx *ctx,
13 const struct nft_expr *expr,
14 const struct nlattr * const tb[]);
15
16int nft_redir_dump(struct sk_buff *skb, const struct nft_expr *expr);
17
18int nft_redir_validate(const struct nft_ctx *ctx, const struct nft_expr *expr,
19 const struct nft_data **data);
20
21#endif /* _NFT_REDIR_H_ */
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 7b903e1bdbbb..64158353ecb2 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -1185,4 +1185,14 @@ static inline int nla_validate_nested(const struct nlattr *start, int maxtype,
1185#define nla_for_each_nested(pos, nla, rem) \ 1185#define nla_for_each_nested(pos, nla, rem) \
1186 nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem) 1186 nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem)
1187 1187
1188/**
1189 * nla_is_last - Test if attribute is last in stream
1190 * @nla: attribute to test
1191 * @rem: bytes remaining in stream
1192 */
1193static inline bool nla_is_last(const struct nlattr *nla, int rem)
1194{
1195 return nla->nla_len == rem;
1196}
1197
1188#endif 1198#endif
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index 9da798256f0e..730d82ad6ee5 100644
--- a/include/net/netns/xfrm.h
+++ b/include/net/netns/xfrm.h
@@ -50,8 +50,8 @@ struct netns_xfrm {
50 struct list_head policy_all; 50 struct list_head policy_all;
51 struct hlist_head *policy_byidx; 51 struct hlist_head *policy_byidx;
52 unsigned int policy_idx_hmask; 52 unsigned int policy_idx_hmask;
53 struct hlist_head policy_inexact[XFRM_POLICY_MAX * 2]; 53 struct hlist_head policy_inexact[XFRM_POLICY_MAX];
54 struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX * 2]; 54 struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX];
55 unsigned int policy_count[XFRM_POLICY_MAX * 2]; 55 unsigned int policy_count[XFRM_POLICY_MAX * 2];
56 struct work_struct policy_hash_work; 56 struct work_struct policy_hash_work;
57 struct xfrm_policy_hthresh policy_hthresh; 57 struct xfrm_policy_hthresh policy_hthresh;
diff --git a/include/net/nfc/digital.h b/include/net/nfc/digital.h
index d9a5cf7ac1c4..0ae101eef0f4 100644
--- a/include/net/nfc/digital.h
+++ b/include/net/nfc/digital.h
@@ -225,6 +225,19 @@ struct nfc_digital_dev {
225 u8 curr_protocol; 225 u8 curr_protocol;
226 u8 curr_rf_tech; 226 u8 curr_rf_tech;
227 u8 curr_nfc_dep_pni; 227 u8 curr_nfc_dep_pni;
228 u8 did;
229
230 u8 local_payload_max;
231 u8 remote_payload_max;
232
233 struct sk_buff *chaining_skb;
234 struct digital_data_exch *data_exch;
235
236 int atn_count;
237 int nack_count;
238
239 struct sk_buff *saved_skb;
240 unsigned int saved_skb_len;
228 241
229 u16 target_fsc; 242 u16 target_fsc;
230 243
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index 7ee8f4cc610b..14bd0e1c47fa 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -57,10 +57,14 @@ struct nfc_hci_ops {
57 int (*discover_se)(struct nfc_hci_dev *dev); 57 int (*discover_se)(struct nfc_hci_dev *dev);
58 int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx); 58 int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx);
59 int (*disable_se)(struct nfc_hci_dev *dev, u32 se_idx); 59 int (*disable_se)(struct nfc_hci_dev *dev, u32 se_idx);
60 int (*se_io)(struct nfc_hci_dev *dev, u32 se_idx,
61 u8 *apdu, size_t apdu_length,
62 se_io_cb_t cb, void *cb_context);
60}; 63};
61 64
62/* Pipes */ 65/* Pipes */
63#define NFC_HCI_INVALID_PIPE 0x80 66#define NFC_HCI_INVALID_PIPE 0x80
67#define NFC_HCI_DO_NOT_CREATE_PIPE 0x81
64#define NFC_HCI_LINK_MGMT_PIPE 0x00 68#define NFC_HCI_LINK_MGMT_PIPE 0x00
65#define NFC_HCI_ADMIN_PIPE 0x01 69#define NFC_HCI_ADMIN_PIPE 0x01
66 70
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 9eca9ae2280c..e7257a4653b4 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -28,6 +28,8 @@
28#ifndef __NCI_H 28#ifndef __NCI_H
29#define __NCI_H 29#define __NCI_H
30 30
31#include <net/nfc/nfc.h>
32
31/* NCI constants */ 33/* NCI constants */
32#define NCI_MAX_NUM_MAPPING_CONFIGS 10 34#define NCI_MAX_NUM_MAPPING_CONFIGS 10
33#define NCI_MAX_NUM_RF_CONFIGS 10 35#define NCI_MAX_NUM_RF_CONFIGS 10
@@ -73,6 +75,8 @@
73#define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83 75#define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83
74#define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85 76#define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85
75 77
78#define NCI_RF_TECH_MODE_LISTEN_MASK 0x80
79
76/* NCI RF Technologies */ 80/* NCI RF Technologies */
77#define NCI_NFC_RF_TECHNOLOGY_A 0x00 81#define NCI_NFC_RF_TECHNOLOGY_A 0x00
78#define NCI_NFC_RF_TECHNOLOGY_B 0x01 82#define NCI_NFC_RF_TECHNOLOGY_B 0x01
@@ -106,6 +110,17 @@
106 110
107/* NCI Configuration Parameter Tags */ 111/* NCI Configuration Parameter Tags */
108#define NCI_PN_ATR_REQ_GEN_BYTES 0x29 112#define NCI_PN_ATR_REQ_GEN_BYTES 0x29
113#define NCI_LN_ATR_RES_GEN_BYTES 0x61
114#define NCI_LA_SEL_INFO 0x32
115#define NCI_LF_PROTOCOL_TYPE 0x50
116#define NCI_LF_CON_BITR_F 0x54
117
118/* NCI Configuration Parameters masks */
119#define NCI_LA_SEL_INFO_ISO_DEP_MASK 0x20
120#define NCI_LA_SEL_INFO_NFC_DEP_MASK 0x40
121#define NCI_LF_PROTOCOL_TYPE_NFC_DEP_MASK 0x02
122#define NCI_LF_CON_BITR_F_212 0x02
123#define NCI_LF_CON_BITR_F_424 0x04
109 124
110/* NCI Reset types */ 125/* NCI Reset types */
111#define NCI_RESET_TYPE_KEEP_CONFIG 0x00 126#define NCI_RESET_TYPE_KEEP_CONFIG 0x00
@@ -314,26 +329,31 @@ struct nci_core_intf_error_ntf {
314struct rf_tech_specific_params_nfca_poll { 329struct rf_tech_specific_params_nfca_poll {
315 __u16 sens_res; 330 __u16 sens_res;
316 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ 331 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */
317 __u8 nfcid1[10]; 332 __u8 nfcid1[NFC_NFCID1_MAXSIZE];
318 __u8 sel_res_len; /* 0 or 1 Bytes */ 333 __u8 sel_res_len; /* 0 or 1 Bytes */
319 __u8 sel_res; 334 __u8 sel_res;
320} __packed; 335} __packed;
321 336
322struct rf_tech_specific_params_nfcb_poll { 337struct rf_tech_specific_params_nfcb_poll {
323 __u8 sensb_res_len; 338 __u8 sensb_res_len;
324 __u8 sensb_res[12]; /* 11 or 12 Bytes */ 339 __u8 sensb_res[NFC_SENSB_RES_MAXSIZE]; /* 11 or 12 Bytes */
325} __packed; 340} __packed;
326 341
327struct rf_tech_specific_params_nfcf_poll { 342struct rf_tech_specific_params_nfcf_poll {
328 __u8 bit_rate; 343 __u8 bit_rate;
329 __u8 sensf_res_len; 344 __u8 sensf_res_len;
330 __u8 sensf_res[18]; /* 16 or 18 Bytes */ 345 __u8 sensf_res[NFC_SENSF_RES_MAXSIZE]; /* 16 or 18 Bytes */
331} __packed; 346} __packed;
332 347
333struct rf_tech_specific_params_nfcv_poll { 348struct rf_tech_specific_params_nfcv_poll {
334 __u8 res_flags; 349 __u8 res_flags;
335 __u8 dsfid; 350 __u8 dsfid;
336 __u8 uid[8]; /* 8 Bytes */ 351 __u8 uid[NFC_ISO15693_UID_MAXSIZE]; /* 8 Bytes */
352} __packed;
353
354struct rf_tech_specific_params_nfcf_listen {
355 __u8 local_nfcid2_len;
356 __u8 local_nfcid2[NFC_NFCID2_MAXSIZE]; /* 0 or 8 Bytes */
337} __packed; 357} __packed;
338 358
339struct nci_rf_discover_ntf { 359struct nci_rf_discover_ntf {
@@ -365,7 +385,12 @@ struct activation_params_nfcb_poll_iso_dep {
365 385
366struct activation_params_poll_nfc_dep { 386struct activation_params_poll_nfc_dep {
367 __u8 atr_res_len; 387 __u8 atr_res_len;
368 __u8 atr_res[63]; 388 __u8 atr_res[NFC_ATR_RES_MAXSIZE - 2]; /* ATR_RES from byte 3 */
389};
390
391struct activation_params_listen_nfc_dep {
392 __u8 atr_req_len;
393 __u8 atr_req[NFC_ATR_REQ_MAXSIZE - 2]; /* ATR_REQ from byte 3 */
369}; 394};
370 395
371struct nci_rf_intf_activated_ntf { 396struct nci_rf_intf_activated_ntf {
@@ -382,6 +407,7 @@ struct nci_rf_intf_activated_ntf {
382 struct rf_tech_specific_params_nfcb_poll nfcb_poll; 407 struct rf_tech_specific_params_nfcb_poll nfcb_poll;
383 struct rf_tech_specific_params_nfcf_poll nfcf_poll; 408 struct rf_tech_specific_params_nfcf_poll nfcf_poll;
384 struct rf_tech_specific_params_nfcv_poll nfcv_poll; 409 struct rf_tech_specific_params_nfcv_poll nfcv_poll;
410 struct rf_tech_specific_params_nfcf_listen nfcf_listen;
385 } rf_tech_specific_params; 411 } rf_tech_specific_params;
386 412
387 __u8 data_exch_rf_tech_and_mode; 413 __u8 data_exch_rf_tech_and_mode;
@@ -393,6 +419,7 @@ struct nci_rf_intf_activated_ntf {
393 struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep; 419 struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep;
394 struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep; 420 struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep;
395 struct activation_params_poll_nfc_dep poll_nfc_dep; 421 struct activation_params_poll_nfc_dep poll_nfc_dep;
422 struct activation_params_listen_nfc_dep listen_nfc_dep;
396 } activation_params; 423 } activation_params;
397 424
398} __packed; 425} __packed;
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 75d10e625c49..9e51bb4d841e 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -4,6 +4,7 @@
4 * 4 *
5 * Copyright (C) 2011 Texas Instruments, Inc. 5 * Copyright (C) 2011 Texas Instruments, Inc.
6 * Copyright (C) 2013 Intel Corporation. All rights reserved. 6 * Copyright (C) 2013 Intel Corporation. All rights reserved.
7 * Copyright (C) 2014 Marvell International Ltd.
7 * 8 *
8 * Written by Ilan Elias <ilane@ti.com> 9 * Written by Ilan Elias <ilane@ti.com>
9 * 10 *
@@ -49,6 +50,8 @@ enum nci_state {
49 NCI_W4_ALL_DISCOVERIES, 50 NCI_W4_ALL_DISCOVERIES,
50 NCI_W4_HOST_SELECT, 51 NCI_W4_HOST_SELECT,
51 NCI_POLL_ACTIVE, 52 NCI_POLL_ACTIVE,
53 NCI_LISTEN_ACTIVE,
54 NCI_LISTEN_SLEEP,
52}; 55};
53 56
54/* NCI timeouts */ 57/* NCI timeouts */
@@ -69,6 +72,12 @@ struct nci_ops {
69 int (*send)(struct nci_dev *ndev, struct sk_buff *skb); 72 int (*send)(struct nci_dev *ndev, struct sk_buff *skb);
70 int (*setup)(struct nci_dev *ndev); 73 int (*setup)(struct nci_dev *ndev);
71 __u32 (*get_rfprotocol)(struct nci_dev *ndev, __u8 rf_protocol); 74 __u32 (*get_rfprotocol)(struct nci_dev *ndev, __u8 rf_protocol);
75 int (*discover_se)(struct nci_dev *ndev);
76 int (*disable_se)(struct nci_dev *ndev, u32 se_idx);
77 int (*enable_se)(struct nci_dev *ndev, u32 se_idx);
78 int (*se_io)(struct nci_dev *ndev, u32 se_idx,
79 u8 *apdu, size_t apdu_length,
80 se_io_cb_t cb, void *cb_context);
72}; 81};
73 82
74#define NCI_MAX_SUPPORTED_RF_INTERFACES 4 83#define NCI_MAX_SUPPORTED_RF_INTERFACES 4
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 6c583e244de2..12adb817c27a 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (C) 2011 Instituto Nokia de Tecnologia 2 * Copyright (C) 2011 Instituto Nokia de Tecnologia
3 * Copyright (C) 2014 Marvell International Ltd.
3 * 4 *
4 * Authors: 5 * Authors:
5 * Lauro Ramos Venancio <lauro.venancio@openbossa.org> 6 * Lauro Ramos Venancio <lauro.venancio@openbossa.org>
@@ -87,6 +88,7 @@ struct nfc_ops {
87#define NFC_TARGET_IDX_ANY -1 88#define NFC_TARGET_IDX_ANY -1
88#define NFC_MAX_GT_LEN 48 89#define NFC_MAX_GT_LEN 48
89#define NFC_ATR_RES_GT_OFFSET 15 90#define NFC_ATR_RES_GT_OFFSET 15
91#define NFC_ATR_REQ_GT_OFFSET 14
90 92
91/** 93/**
92 * struct nfc_target - NFC target descriptiom 94 * struct nfc_target - NFC target descriptiom
diff --git a/include/net/nl802154.h b/include/net/nl802154.h
index b23548e04098..6dbd406ca41b 100644
--- a/include/net/nl802154.h
+++ b/include/net/nl802154.h
@@ -1,126 +1,122 @@
1#ifndef __NL802154_H
2#define __NL802154_H
1/* 3/*
2 * nl802154.h 4 * 802.15.4 netlink interface public header
3 * 5 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG 6 * Copyright 2014 Alexander Aring <aar@pengutronix.de>
5 * 7 *
6 * This program is free software; you can redistribute it and/or modify 8 * Permission to use, copy, modify, and/or distribute this software for any
7 * it under the terms of the GNU General Public License version 2 9 * purpose with or without fee is hereby granted, provided that the above
8 * as published by the Free Software Foundation. 10 * copyright notice and this permission notice appear in all copies.
9 * 11 *
10 * This program is distributed in the hope that it will be useful, 12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * GNU General Public License for more details. 15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * 16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * You should have received a copy of the GNU General Public License along 17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * with this program; if not, write to the Free Software Foundation, Inc., 18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 * 19 *
19 */ 20 */
20 21
21#ifndef IEEE802154_NL_H 22#define NL802154_GENL_NAME "nl802154"
22#define IEEE802154_NL_H
23 23
24struct net_device; 24enum nl802154_commands {
25struct ieee802154_addr; 25/* don't change the order or add anything between, this is ABI! */
26/* currently we don't shipping this file via uapi, ignore the above one */
27 NL802154_CMD_UNSPEC,
26 28
27/** 29 NL802154_CMD_GET_WPAN_PHY, /* can dump */
28 * ieee802154_nl_assoc_indic - Notify userland of an association request. 30 NL802154_CMD_SET_WPAN_PHY,
29 * @dev: The network device on which this association request was 31 NL802154_CMD_NEW_WPAN_PHY,
30 * received. 32 NL802154_CMD_DEL_WPAN_PHY,
31 * @addr: The address of the device requesting association.
32 * @cap: The capability information field from the device.
33 *
34 * This informs a userland coordinator of a device requesting to
35 * associate with the PAN controlled by the coordinator.
36 *
37 * Note: This is in section 7.3.1 of the IEEE 802.15.4-2006 document.
38 */
39int ieee802154_nl_assoc_indic(struct net_device *dev,
40 struct ieee802154_addr *addr, u8 cap);
41
42/**
43 * ieee802154_nl_assoc_confirm - Notify userland of association.
44 * @dev: The device which has completed association.
45 * @short_addr: The short address assigned to the device.
46 * @status: The status of the association.
47 *
48 * Inform userland of the result of an association request. If the
49 * association request included asking the coordinator to allocate
50 * a short address then it is returned in @short_addr.
51 *
52 * Note: This is in section 7.3.2 of the IEEE 802.15.4 document.
53 */
54int ieee802154_nl_assoc_confirm(struct net_device *dev,
55 __le16 short_addr, u8 status);
56
57/**
58 * ieee802154_nl_disassoc_indic - Notify userland of disassociation.
59 * @dev: The device on which disassociation was indicated.
60 * @addr: The device which is disassociating.
61 * @reason: The reason for the disassociation.
62 *
63 * Inform userland that a device has disassociated from the network.
64 *
65 * Note: This is in section 7.3.3 of the IEEE 802.15.4 document.
66 */
67int ieee802154_nl_disassoc_indic(struct net_device *dev,
68 struct ieee802154_addr *addr, u8 reason);
69
70/**
71 * ieee802154_nl_disassoc_confirm - Notify userland of disassociation
72 * completion.
73 * @dev: The device on which disassociation was ordered.
74 * @status: The result of the disassociation.
75 *
76 * Inform userland of the result of requesting that a device
77 * disassociate, or the result of requesting that we disassociate from
78 * a PAN managed by another coordinator.
79 *
80 * Note: This is in section 7.1.4.3 of the IEEE 802.15.4 document.
81 */
82int ieee802154_nl_disassoc_confirm(struct net_device *dev,
83 u8 status);
84
85/**
86 * ieee802154_nl_scan_confirm - Notify userland of completion of scan.
87 * @dev: The device which was instructed to scan.
88 * @status: The status of the scan operation.
89 * @scan_type: What type of scan was performed.
90 * @unscanned: Any channels that the device was unable to scan.
91 * @edl: The energy levels (if a passive scan).
92 *
93 *
94 * Note: This is in section 7.1.11 of the IEEE 802.15.4 document.
95 * Note: This API does not permit the return of an active scan result.
96 */
97int ieee802154_nl_scan_confirm(struct net_device *dev,
98 u8 status, u8 scan_type, u32 unscanned, u8 page,
99 u8 *edl/*, struct list_head *pan_desc_list */);
100
101/**
102 * ieee802154_nl_beacon_indic - Notify userland of a received beacon.
103 * @dev: The device on which a beacon was received.
104 * @panid: The PAN of the coordinator.
105 * @coord_addr: The short address of the coordinator on that PAN.
106 *
107 * Note: This is in section 7.1.5 of the IEEE 802.15.4 document.
108 * Note: This API does not provide extended information such as what
109 * channel the PAN is on or what the LQI of the beacon frame was on
110 * receipt.
111 * Note: This API cannot indicate a beacon frame for a coordinator
112 * operating in long addressing mode.
113 */
114int ieee802154_nl_beacon_indic(struct net_device *dev, __le16 panid,
115 __le16 coord_addr);
116 33
117/** 34 NL802154_CMD_GET_INTERFACE, /* can dump */
118 * ieee802154_nl_start_confirm - Notify userland of completion of start. 35 NL802154_CMD_SET_INTERFACE,
119 * @dev: The device which was instructed to scan. 36 NL802154_CMD_NEW_INTERFACE,
120 * @status: The status of the scan operation. 37 NL802154_CMD_DEL_INTERFACE,
121 * 38
122 * Note: This is in section 7.1.14 of the IEEE 802.15.4 document. 39 NL802154_CMD_SET_CHANNEL,
123 */ 40
124int ieee802154_nl_start_confirm(struct net_device *dev, u8 status); 41 NL802154_CMD_SET_PAN_ID,
42 NL802154_CMD_SET_SHORT_ADDR,
43
44 NL802154_CMD_SET_TX_POWER,
45 NL802154_CMD_SET_CCA_MODE,
46 NL802154_CMD_SET_CCA_ED_LEVEL,
47
48 NL802154_CMD_SET_MAX_FRAME_RETRIES,
49
50 NL802154_CMD_SET_BACKOFF_EXPONENT,
51 NL802154_CMD_SET_MAX_CSMA_BACKOFFS,
52
53 NL802154_CMD_SET_LBT_MODE,
54
55 /* add new commands above here */
56
57 /* used to define NL802154_CMD_MAX below */
58 __NL802154_CMD_AFTER_LAST,
59 NL802154_CMD_MAX = __NL802154_CMD_AFTER_LAST - 1
60};
61
62enum nl802154_attrs {
63/* don't change the order or add anything between, this is ABI! */
64/* currently we don't shipping this file via uapi, ignore the above one */
65 NL802154_ATTR_UNSPEC,
66
67 NL802154_ATTR_WPAN_PHY,
68 NL802154_ATTR_WPAN_PHY_NAME,
69
70 NL802154_ATTR_IFINDEX,
71 NL802154_ATTR_IFNAME,
72 NL802154_ATTR_IFTYPE,
73
74 NL802154_ATTR_WPAN_DEV,
75
76 NL802154_ATTR_PAGE,
77 NL802154_ATTR_CHANNEL,
78
79 NL802154_ATTR_PAN_ID,
80 NL802154_ATTR_SHORT_ADDR,
81
82 NL802154_ATTR_TX_POWER,
83
84 NL802154_ATTR_CCA_MODE,
85 NL802154_ATTR_CCA_MODE3_AND,
86 NL802154_ATTR_CCA_ED_LEVEL,
87
88 NL802154_ATTR_MAX_FRAME_RETRIES,
89
90 NL802154_ATTR_MAX_BE,
91 NL802154_ATTR_MIN_BE,
92 NL802154_ATTR_MAX_CSMA_BACKOFFS,
93
94 NL802154_ATTR_LBT_MODE,
95
96 NL802154_ATTR_GENERATION,
97
98 NL802154_ATTR_CHANNELS_SUPPORTED,
99 NL802154_ATTR_SUPPORTED_CHANNEL,
100
101 NL802154_ATTR_EXTENDED_ADDR,
102
103 /* add attributes here, update the policy in nl802154.c */
104
105 __NL802154_ATTR_AFTER_LAST,
106 NL802154_ATTR_MAX = __NL802154_ATTR_AFTER_LAST - 1
107};
108
109enum nl802154_iftype {
110 /* for backwards compatibility TODO */
111 NL802154_IFTYPE_UNSPEC = -1,
112
113 NL802154_IFTYPE_NODE,
114 NL802154_IFTYPE_MONITOR,
115 NL802154_IFTYPE_COORD,
116
117 /* keep last */
118 NUM_NL802154_IFTYPES,
119 NL802154_IFTYPE_MAX = NUM_NL802154_IFTYPES - 1
120};
125 121
126#endif 122#endif /* __NL802154_H */
diff --git a/include/net/ping.h b/include/net/ping.h
index 026479b61a2d..f074060bc5de 100644
--- a/include/net/ping.h
+++ b/include/net/ping.h
@@ -82,7 +82,7 @@ int ping_common_sendmsg(int family, struct msghdr *msg, size_t len,
82int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 82int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
83 size_t len); 83 size_t len);
84int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); 84int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
85void ping_rcv(struct sk_buff *skb); 85bool ping_rcv(struct sk_buff *skb);
86 86
87#ifdef CONFIG_PROC_FS 87#ifdef CONFIG_PROC_FS
88struct ping_seq_afinfo { 88struct ping_seq_afinfo {
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index dad7ab20a8cb..b776d72d84be 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -136,6 +136,17 @@ struct regulatory_request {
136 * otherwise initiating radiation is not allowed. This will enable the 136 * otherwise initiating radiation is not allowed. This will enable the
137 * relaxations enabled under the CFG80211_REG_RELAX_NO_IR configuration 137 * relaxations enabled under the CFG80211_REG_RELAX_NO_IR configuration
138 * option 138 * option
139 * @REGULATORY_IGNORE_STALE_KICKOFF: the regulatory core will _not_ make sure
140 * all interfaces on this wiphy reside on allowed channels. If this flag
141 * is not set, upon a regdomain change, the interfaces are given a grace
142 * period (currently 60 seconds) to disconnect or move to an allowed
143 * channel. Interfaces on forbidden channels are forcibly disconnected.
144 * Currently these types of interfaces are supported for enforcement:
145 * NL80211_IFTYPE_ADHOC, NL80211_IFTYPE_STATION, NL80211_IFTYPE_AP,
146 * NL80211_IFTYPE_AP_VLAN, NL80211_IFTYPE_MONITOR,
147 * NL80211_IFTYPE_P2P_CLIENT, NL80211_IFTYPE_P2P_GO,
148 * NL80211_IFTYPE_P2P_DEVICE. The flag will be set by default if a device
149 * includes any modes unsupported for enforcement checking.
139 */ 150 */
140enum ieee80211_regulatory_flags { 151enum ieee80211_regulatory_flags {
141 REGULATORY_CUSTOM_REG = BIT(0), 152 REGULATORY_CUSTOM_REG = BIT(0),
@@ -144,6 +155,7 @@ enum ieee80211_regulatory_flags {
144 REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3), 155 REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3),
145 REGULATORY_COUNTRY_IE_IGNORE = BIT(4), 156 REGULATORY_COUNTRY_IE_IGNORE = BIT(4),
146 REGULATORY_ENABLE_RELAX_NO_IR = BIT(5), 157 REGULATORY_ENABLE_RELAX_NO_IR = BIT(5),
158 REGULATORY_IGNORE_STALE_KICKOFF = BIT(6),
147}; 159};
148 160
149struct ieee80211_freq_range { 161struct ieee80211_freq_range {
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index d17ed6fb2f70..3d282cbb66bf 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -219,7 +219,6 @@ struct tcf_proto_ops {
219 void (*destroy)(struct tcf_proto*); 219 void (*destroy)(struct tcf_proto*);
220 220
221 unsigned long (*get)(struct tcf_proto*, u32 handle); 221 unsigned long (*get)(struct tcf_proto*, u32 handle);
222 void (*put)(struct tcf_proto*, unsigned long);
223 int (*change)(struct net *net, struct sk_buff *, 222 int (*change)(struct net *net, struct sk_buff *,
224 struct tcf_proto*, unsigned long, 223 struct tcf_proto*, unsigned long,
225 u32 handle, struct nlattr **, 224 u32 handle, struct nlattr **,
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 72a31db47ded..487ef34bbd63 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -219,7 +219,7 @@ struct sctp_chunk *sctp_make_abort_no_data(const struct sctp_association *,
219 const struct sctp_chunk *, 219 const struct sctp_chunk *,
220 __u32 tsn); 220 __u32 tsn);
221struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *, 221struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *,
222 const struct msghdr *, size_t msg_len); 222 struct msghdr *, size_t msg_len);
223struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *, 223struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *,
224 const struct sctp_chunk *, 224 const struct sctp_chunk *,
225 const __u8 *, 225 const __u8 *,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 4ff3f67be62c..2bb2fcf5b11f 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -531,7 +531,7 @@ struct sctp_datamsg {
531 531
532struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, 532struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
533 struct sctp_sndrcvinfo *, 533 struct sctp_sndrcvinfo *,
534 struct msghdr *, int len); 534 struct iov_iter *);
535void sctp_datamsg_free(struct sctp_datamsg *); 535void sctp_datamsg_free(struct sctp_datamsg *);
536void sctp_datamsg_put(struct sctp_datamsg *); 536void sctp_datamsg_put(struct sctp_datamsg *);
537void sctp_chunk_fail(struct sctp_chunk *, int error); 537void sctp_chunk_fail(struct sctp_chunk *, int error);
@@ -647,8 +647,8 @@ struct sctp_chunk {
647 647
648void sctp_chunk_hold(struct sctp_chunk *); 648void sctp_chunk_hold(struct sctp_chunk *);
649void sctp_chunk_put(struct sctp_chunk *); 649void sctp_chunk_put(struct sctp_chunk *);
650int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len, 650int sctp_user_addto_chunk(struct sctp_chunk *chunk, int len,
651 struct iovec *data); 651 struct iov_iter *from);
652void sctp_chunk_free(struct sctp_chunk *); 652void sctp_chunk_free(struct sctp_chunk *);
653void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); 653void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data);
654struct sctp_chunk *sctp_chunkify(struct sk_buff *, 654struct sctp_chunk *sctp_chunkify(struct sk_buff *,
@@ -1116,7 +1116,6 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len,
1116sctp_scope_t sctp_scope(const union sctp_addr *); 1116sctp_scope_t sctp_scope(const union sctp_addr *);
1117int sctp_in_scope(struct net *net, const union sctp_addr *addr, const sctp_scope_t scope); 1117int sctp_in_scope(struct net *net, const union sctp_addr *addr, const sctp_scope_t scope);
1118int sctp_is_any(struct sock *sk, const union sctp_addr *addr); 1118int sctp_is_any(struct sock *sk, const union sctp_addr *addr);
1119int sctp_addr_is_valid(const union sctp_addr *addr);
1120int sctp_is_ep_boundall(struct sock *sk); 1119int sctp_is_ep_boundall(struct sock *sk);
1121 1120
1122 1121
diff --git a/include/net/sock.h b/include/net/sock.h
index 7db3db112baa..2210fec65669 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -54,8 +54,8 @@
54#include <linux/security.h> 54#include <linux/security.h>
55#include <linux/slab.h> 55#include <linux/slab.h>
56#include <linux/uaccess.h> 56#include <linux/uaccess.h>
57#include <linux/page_counter.h>
57#include <linux/memcontrol.h> 58#include <linux/memcontrol.h>
58#include <linux/res_counter.h>
59#include <linux/static_key.h> 59#include <linux/static_key.h>
60#include <linux/aio.h> 60#include <linux/aio.h>
61#include <linux/sched.h> 61#include <linux/sched.h>
@@ -273,6 +273,7 @@ struct cg_proto;
273 * @sk_rcvtimeo: %SO_RCVTIMEO setting 273 * @sk_rcvtimeo: %SO_RCVTIMEO setting
274 * @sk_sndtimeo: %SO_SNDTIMEO setting 274 * @sk_sndtimeo: %SO_SNDTIMEO setting
275 * @sk_rxhash: flow hash received from netif layer 275 * @sk_rxhash: flow hash received from netif layer
276 * @sk_incoming_cpu: record cpu processing incoming packets
276 * @sk_txhash: computed flow hash for use on transmit 277 * @sk_txhash: computed flow hash for use on transmit
277 * @sk_filter: socket filtering instructions 278 * @sk_filter: socket filtering instructions
278 * @sk_protinfo: private area, net family specific, when not using slab 279 * @sk_protinfo: private area, net family specific, when not using slab
@@ -350,6 +351,12 @@ struct sock {
350#ifdef CONFIG_RPS 351#ifdef CONFIG_RPS
351 __u32 sk_rxhash; 352 __u32 sk_rxhash;
352#endif 353#endif
354 u16 sk_incoming_cpu;
355 /* 16bit hole
356 * Warned : sk_incoming_cpu can be set from softirq,
357 * Do not use this hole without fully understanding possible issues.
358 */
359
353 __u32 sk_txhash; 360 __u32 sk_txhash;
354#ifdef CONFIG_NET_RX_BUSY_POLL 361#ifdef CONFIG_NET_RX_BUSY_POLL
355 unsigned int sk_napi_id; 362 unsigned int sk_napi_id;
@@ -833,6 +840,11 @@ static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
833 return sk->sk_backlog_rcv(sk, skb); 840 return sk->sk_backlog_rcv(sk, skb);
834} 841}
835 842
843static inline void sk_incoming_cpu_update(struct sock *sk)
844{
845 sk->sk_incoming_cpu = raw_smp_processor_id();
846}
847
836static inline void sock_rps_record_flow_hash(__u32 hash) 848static inline void sock_rps_record_flow_hash(__u32 hash)
837{ 849{
838#ifdef CONFIG_RPS 850#ifdef CONFIG_RPS
@@ -897,6 +909,7 @@ static inline void sock_rps_reset_rxhash(struct sock *sk)
897 if (!__rc) { \ 909 if (!__rc) { \
898 *(__timeo) = schedule_timeout(*(__timeo)); \ 910 *(__timeo) = schedule_timeout(*(__timeo)); \
899 } \ 911 } \
912 sched_annotate_sleep(); \
900 lock_sock(__sk); \ 913 lock_sock(__sk); \
901 __rc = __condition; \ 914 __rc = __condition; \
902 __rc; \ 915 __rc; \
@@ -1061,7 +1074,7 @@ enum cg_proto_flags {
1061}; 1074};
1062 1075
1063struct cg_proto { 1076struct cg_proto {
1064 struct res_counter memory_allocated; /* Current allocated memory. */ 1077 struct page_counter memory_allocated; /* Current allocated memory. */
1065 struct percpu_counter sockets_allocated; /* Current number of sockets. */ 1078 struct percpu_counter sockets_allocated; /* Current number of sockets. */
1066 int memory_pressure; 1079 int memory_pressure;
1067 long sysctl_mem[3]; 1080 long sysctl_mem[3];
@@ -1213,34 +1226,26 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot,
1213 unsigned long amt, 1226 unsigned long amt,
1214 int *parent_status) 1227 int *parent_status)
1215{ 1228{
1216 struct res_counter *fail; 1229 page_counter_charge(&prot->memory_allocated, amt);
1217 int ret;
1218 1230
1219 ret = res_counter_charge_nofail(&prot->memory_allocated, 1231 if (page_counter_read(&prot->memory_allocated) >
1220 amt << PAGE_SHIFT, &fail); 1232 prot->memory_allocated.limit)
1221 if (ret < 0)
1222 *parent_status = OVER_LIMIT; 1233 *parent_status = OVER_LIMIT;
1223} 1234}
1224 1235
1225static inline void memcg_memory_allocated_sub(struct cg_proto *prot, 1236static inline void memcg_memory_allocated_sub(struct cg_proto *prot,
1226 unsigned long amt) 1237 unsigned long amt)
1227{ 1238{
1228 res_counter_uncharge(&prot->memory_allocated, amt << PAGE_SHIFT); 1239 page_counter_uncharge(&prot->memory_allocated, amt);
1229}
1230
1231static inline u64 memcg_memory_allocated_read(struct cg_proto *prot)
1232{
1233 u64 ret;
1234 ret = res_counter_read_u64(&prot->memory_allocated, RES_USAGE);
1235 return ret >> PAGE_SHIFT;
1236} 1240}
1237 1241
1238static inline long 1242static inline long
1239sk_memory_allocated(const struct sock *sk) 1243sk_memory_allocated(const struct sock *sk)
1240{ 1244{
1241 struct proto *prot = sk->sk_prot; 1245 struct proto *prot = sk->sk_prot;
1246
1242 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) 1247 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1243 return memcg_memory_allocated_read(sk->sk_cgrp); 1248 return page_counter_read(&sk->sk_cgrp->memory_allocated);
1244 1249
1245 return atomic_long_read(prot->memory_allocated); 1250 return atomic_long_read(prot->memory_allocated);
1246} 1251}
@@ -1254,7 +1259,7 @@ sk_memory_allocated_add(struct sock *sk, int amt, int *parent_status)
1254 memcg_memory_allocated_add(sk->sk_cgrp, amt, parent_status); 1259 memcg_memory_allocated_add(sk->sk_cgrp, amt, parent_status);
1255 /* update the root cgroup regardless */ 1260 /* update the root cgroup regardless */
1256 atomic_long_add_return(amt, prot->memory_allocated); 1261 atomic_long_add_return(amt, prot->memory_allocated);
1257 return memcg_memory_allocated_read(sk->sk_cgrp); 1262 return page_counter_read(&sk->sk_cgrp->memory_allocated);
1258 } 1263 }
1259 1264
1260 return atomic_long_add_return(amt, prot->memory_allocated); 1265 return atomic_long_add_return(amt, prot->memory_allocated);
@@ -1588,6 +1593,7 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
1588 int *errcode, int max_page_order); 1593 int *errcode, int max_page_order);
1589void *sock_kmalloc(struct sock *sk, int size, gfp_t priority); 1594void *sock_kmalloc(struct sock *sk, int size, gfp_t priority);
1590void sock_kfree_s(struct sock *sk, void *mem, int size); 1595void sock_kfree_s(struct sock *sk, void *mem, int size);
1596void sock_kzfree_s(struct sock *sk, void *mem, int size);
1591void sk_send_sigurg(struct sock *sk); 1597void sk_send_sigurg(struct sock *sk);
1592 1598
1593/* 1599/*
@@ -1872,29 +1878,6 @@ static inline int skb_copy_to_page_nocache(struct sock *sk, char __user *from,
1872 return 0; 1878 return 0;
1873} 1879}
1874 1880
1875static inline int skb_copy_to_page(struct sock *sk, char __user *from,
1876 struct sk_buff *skb, struct page *page,
1877 int off, int copy)
1878{
1879 if (skb->ip_summed == CHECKSUM_NONE) {
1880 int err = 0;
1881 __wsum csum = csum_and_copy_from_user(from,
1882 page_address(page) + off,
1883 copy, 0, &err);
1884 if (err)
1885 return err;
1886 skb->csum = csum_block_add(skb->csum, csum, skb->len);
1887 } else if (copy_from_user(page_address(page) + off, from, copy))
1888 return -EFAULT;
1889
1890 skb->len += copy;
1891 skb->data_len += copy;
1892 skb->truesize += copy;
1893 sk->sk_wmem_queued += copy;
1894 sk_mem_charge(sk, copy);
1895 return 0;
1896}
1897
1898/** 1881/**
1899 * sk_wmem_alloc_get - returns write allocations 1882 * sk_wmem_alloc_get - returns write allocations
1900 * @sk: socket 1883 * @sk: socket
@@ -2276,16 +2259,6 @@ bool sk_ns_capable(const struct sock *sk,
2276bool sk_capable(const struct sock *sk, int cap); 2259bool sk_capable(const struct sock *sk, int cap);
2277bool sk_net_capable(const struct sock *sk, int cap); 2260bool sk_net_capable(const struct sock *sk, int cap);
2278 2261
2279/*
2280 * Enable debug/info messages
2281 */
2282extern int net_msg_warn;
2283#define NETDEBUG(fmt, args...) \
2284 do { if (net_msg_warn) printk(fmt,##args); } while (0)
2285
2286#define LIMIT_NETDEBUG(fmt, args...) \
2287 do { if (net_msg_warn && net_ratelimit()) printk(fmt,##args); } while(0)
2288
2289extern __u32 sysctl_wmem_max; 2262extern __u32 sysctl_wmem_max;
2290extern __u32 sysctl_rmem_max; 2263extern __u32 sysctl_rmem_max;
2291 2264
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
new file mode 100644
index 000000000000..8a6d1641fd9b
--- /dev/null
+++ b/include/net/switchdev.h
@@ -0,0 +1,37 @@
1/*
2 * include/net/switchdev.h - Switch device API
3 * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us>
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#ifndef _LINUX_SWITCHDEV_H_
11#define _LINUX_SWITCHDEV_H_
12
13#include <linux/netdevice.h>
14
15#ifdef CONFIG_NET_SWITCHDEV
16
17int netdev_switch_parent_id_get(struct net_device *dev,
18 struct netdev_phys_item_id *psid);
19int netdev_switch_port_stp_update(struct net_device *dev, u8 state);
20
21#else
22
23static inline int netdev_switch_parent_id_get(struct net_device *dev,
24 struct netdev_phys_item_id *psid)
25{
26 return -EOPNOTSUPP;
27}
28
29static inline int netdev_switch_port_stp_update(struct net_device *dev,
30 u8 state)
31{
32 return -EOPNOTSUPP;
33}
34
35#endif
36
37#endif /* _LINUX_SWITCHDEV_H_ */
diff --git a/include/net/tc_act/tc_vlan.h b/include/net/tc_act/tc_vlan.h
new file mode 100644
index 000000000000..93b70ade1ff3
--- /dev/null
+++ b/include/net/tc_act/tc_vlan.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us>
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 __NET_TC_VLAN_H
11#define __NET_TC_VLAN_H
12
13#include <net/act_api.h>
14
15#define VLAN_F_POP 0x1
16#define VLAN_F_PUSH 0x2
17
18struct tcf_vlan {
19 struct tcf_common common;
20 int tcfv_action;
21 u16 tcfv_push_vid;
22 __be16 tcfv_push_proto;
23};
24#define to_vlan(a) \
25 container_of(a->priv, struct tcf_vlan, common)
26
27#endif /* __NET_TC_VLAN_H */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 4062b4f0d121..f50f29faf76f 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -55,9 +55,9 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
55#define MAX_TCP_HEADER (128 + MAX_HEADER) 55#define MAX_TCP_HEADER (128 + MAX_HEADER)
56#define MAX_TCP_OPTION_SPACE 40 56#define MAX_TCP_OPTION_SPACE 40
57 57
58/* 58/*
59 * Never offer a window over 32767 without using window scaling. Some 59 * Never offer a window over 32767 without using window scaling. Some
60 * poor stacks do signed 16bit maths! 60 * poor stacks do signed 16bit maths!
61 */ 61 */
62#define MAX_TCP_WINDOW 32767U 62#define MAX_TCP_WINDOW 32767U
63 63
@@ -70,9 +70,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
70/* After receiving this amount of duplicate ACKs fast retransmit starts. */ 70/* After receiving this amount of duplicate ACKs fast retransmit starts. */
71#define TCP_FASTRETRANS_THRESH 3 71#define TCP_FASTRETRANS_THRESH 3
72 72
73/* Maximal reordering. */
74#define TCP_MAX_REORDERING 127
75
76/* Maximal number of ACKs sent quickly to accelerate slow-start. */ 73/* Maximal number of ACKs sent quickly to accelerate slow-start. */
77#define TCP_MAX_QUICKACKS 16U 74#define TCP_MAX_QUICKACKS 16U
78 75
@@ -167,7 +164,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
167/* 164/*
168 * TCP option 165 * TCP option
169 */ 166 */
170 167
171#define TCPOPT_NOP 1 /* Padding */ 168#define TCPOPT_NOP 1 /* Padding */
172#define TCPOPT_EOL 0 /* End of options */ 169#define TCPOPT_EOL 0 /* End of options */
173#define TCPOPT_MSS 2 /* Segment size negotiating */ 170#define TCPOPT_MSS 2 /* Segment size negotiating */
@@ -252,6 +249,7 @@ extern int sysctl_tcp_abort_on_overflow;
252extern int sysctl_tcp_max_orphans; 249extern int sysctl_tcp_max_orphans;
253extern int sysctl_tcp_fack; 250extern int sysctl_tcp_fack;
254extern int sysctl_tcp_reordering; 251extern int sysctl_tcp_reordering;
252extern int sysctl_tcp_max_reordering;
255extern int sysctl_tcp_dsack; 253extern int sysctl_tcp_dsack;
256extern long sysctl_tcp_mem[3]; 254extern long sysctl_tcp_mem[3];
257extern int sysctl_tcp_wmem[3]; 255extern int sysctl_tcp_wmem[3];
@@ -492,17 +490,16 @@ u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th,
492 u16 *mssp); 490 u16 *mssp);
493__u32 cookie_v4_init_sequence(struct sock *sk, const struct sk_buff *skb, 491__u32 cookie_v4_init_sequence(struct sock *sk, const struct sk_buff *skb,
494 __u16 *mss); 492 __u16 *mss);
495#endif
496
497__u32 cookie_init_timestamp(struct request_sock *req); 493__u32 cookie_init_timestamp(struct request_sock *req);
498bool cookie_check_timestamp(struct tcp_options_received *opt, struct net *net, 494bool cookie_timestamp_decode(struct tcp_options_received *opt);
499 bool *ecn_ok); 495bool cookie_ecn_ok(const struct tcp_options_received *opt,
496 const struct net *net, const struct dst_entry *dst);
500 497
501/* From net/ipv6/syncookies.c */ 498/* From net/ipv6/syncookies.c */
502int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th, 499int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th,
503 u32 cookie); 500 u32 cookie);
504struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); 501struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb);
505#ifdef CONFIG_SYN_COOKIES 502
506u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph, 503u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph,
507 const struct tcphdr *th, u16 *mssp); 504 const struct tcphdr *th, u16 *mssp);
508__u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb, 505__u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb,
@@ -1104,16 +1101,16 @@ static inline int tcp_win_from_space(int space)
1104 space - (space>>sysctl_tcp_adv_win_scale); 1101 space - (space>>sysctl_tcp_adv_win_scale);
1105} 1102}
1106 1103
1107/* Note: caller must be prepared to deal with negative returns */ 1104/* Note: caller must be prepared to deal with negative returns */
1108static inline int tcp_space(const struct sock *sk) 1105static inline int tcp_space(const struct sock *sk)
1109{ 1106{
1110 return tcp_win_from_space(sk->sk_rcvbuf - 1107 return tcp_win_from_space(sk->sk_rcvbuf -
1111 atomic_read(&sk->sk_rmem_alloc)); 1108 atomic_read(&sk->sk_rmem_alloc));
1112} 1109}
1113 1110
1114static inline int tcp_full_space(const struct sock *sk) 1111static inline int tcp_full_space(const struct sock *sk)
1115{ 1112{
1116 return tcp_win_from_space(sk->sk_rcvbuf); 1113 return tcp_win_from_space(sk->sk_rcvbuf);
1117} 1114}
1118 1115
1119static inline void tcp_openreq_init(struct request_sock *req, 1116static inline void tcp_openreq_init(struct request_sock *req,
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 2caadabcd07b..ae7c8d1fbcad 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -19,7 +19,9 @@ extern struct udp_table udplite_table;
19static __inline__ int udplite_getfrag(void *from, char *to, int offset, 19static __inline__ int udplite_getfrag(void *from, char *to, int offset,
20 int len, int odd, struct sk_buff *skb) 20 int len, int odd, struct sk_buff *skb)
21{ 21{
22 return memcpy_fromiovecend(to, (struct iovec *) from, offset, len); 22 struct msghdr *msg = from;
23 /* XXX: stripping const */
24 return memcpy_fromiovecend(to, (struct iovec *)msg->msg_iter.iov, offset, len);
23} 25}
24 26
25/* Designate sk as UDP-Lite socket */ 27/* Designate sk as UDP-Lite socket */
@@ -40,7 +42,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
40 * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets 42 * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets
41 * with a zero checksum field are illegal. */ 43 * with a zero checksum field are illegal. */
42 if (uh->check == 0) { 44 if (uh->check == 0) {
43 LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: zeroed checksum field\n"); 45 net_dbg_ratelimited("UDPLite: zeroed checksum field\n");
44 return 1; 46 return 1;
45 } 47 }
46 48
@@ -52,8 +54,8 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
52 /* 54 /*
53 * Coverage length violates RFC 3828: log and discard silently. 55 * Coverage length violates RFC 3828: log and discard silently.
54 */ 56 */
55 LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: bad csum coverage %d/%d\n", 57 net_dbg_ratelimited("UDPLite: bad csum coverage %d/%d\n",
56 cscov, skb->len); 58 cscov, skb->len);
57 return 1; 59 return 1;
58 60
59 } else if (cscov < skb->len) { 61 } else if (cscov < skb->len) {
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
deleted file mode 100644
index 10ab0fc6d4f7..000000000000
--- a/include/net/wpan-phy.h
+++ /dev/null
@@ -1,105 +0,0 @@
1/*
2 * Copyright (C) 2007, 2008, 2009 Siemens AG
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
6 * as published by the Free Software Foundation.
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 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Written by:
18 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
19 */
20
21#ifndef WPAN_PHY_H
22#define WPAN_PHY_H
23
24#include <linux/netdevice.h>
25#include <linux/mutex.h>
26#include <linux/bug.h>
27
28/* According to the IEEE 802.15.4 stadard the upper most significant bits of
29 * the 32-bit channel bitmaps shall be used as an integer value to specify 32
30 * possible channel pages. The lower 27 bits of the channel bit map shall be
31 * used as a bit mask to specify channel numbers within a channel page.
32 */
33#define WPAN_NUM_CHANNELS 27
34#define WPAN_NUM_PAGES 32
35
36struct wpan_phy {
37 struct mutex pib_lock;
38
39 /*
40 * This is a PIB according to 802.15.4-2011.
41 * We do not provide timing-related variables, as they
42 * aren't used outside of driver
43 */
44 u8 current_channel;
45 u8 current_page;
46 u32 channels_supported[32];
47 s8 transmit_power;
48 u8 cca_mode;
49 u8 min_be;
50 u8 max_be;
51 u8 csma_retries;
52 s8 frame_retries;
53
54 bool lbt;
55 s32 cca_ed_level;
56
57 struct device dev;
58 int idx;
59
60 struct net_device *(*add_iface)(struct wpan_phy *phy,
61 const char *name, int type);
62 void (*del_iface)(struct wpan_phy *phy, struct net_device *dev);
63
64 int (*set_txpower)(struct wpan_phy *phy, int db);
65 int (*set_lbt)(struct wpan_phy *phy, bool on);
66 int (*set_cca_mode)(struct wpan_phy *phy, u8 cca_mode);
67 int (*set_cca_ed_level)(struct wpan_phy *phy, int level);
68 int (*set_csma_params)(struct wpan_phy *phy, u8 min_be, u8 max_be,
69 u8 retries);
70 int (*set_frame_retries)(struct wpan_phy *phy, s8 retries);
71
72 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
73};
74
75#define to_phy(_dev) container_of(_dev, struct wpan_phy, dev)
76
77struct wpan_phy *wpan_phy_alloc(size_t priv_size);
78static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev)
79{
80 phy->dev.parent = dev;
81}
82int wpan_phy_register(struct wpan_phy *phy);
83void wpan_phy_unregister(struct wpan_phy *phy);
84void wpan_phy_free(struct wpan_phy *phy);
85/* Same semantics as for class_for_each_device */
86int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data);
87
88static inline void *wpan_phy_priv(struct wpan_phy *phy)
89{
90 BUG_ON(!phy);
91 return &phy->priv;
92}
93
94struct wpan_phy *wpan_phy_find(const char *str);
95
96static inline void wpan_phy_put(struct wpan_phy *phy)
97{
98 put_device(&phy->dev);
99}
100
101static inline const char *wpan_phy_name(struct wpan_phy *phy)
102{
103 return dev_name(&phy->dev);
104}
105#endif
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 52beadf9a29b..93d14daf0994 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -1105,8 +1105,6 @@ int fc_eh_abort(struct scsi_cmnd *);
1105int fc_eh_device_reset(struct scsi_cmnd *); 1105int fc_eh_device_reset(struct scsi_cmnd *);
1106int fc_eh_host_reset(struct scsi_cmnd *); 1106int fc_eh_host_reset(struct scsi_cmnd *);
1107int fc_slave_alloc(struct scsi_device *); 1107int fc_slave_alloc(struct scsi_device *);
1108int fc_change_queue_depth(struct scsi_device *, int qdepth, int reason);
1109int fc_change_queue_type(struct scsi_device *, int tag_type);
1110 1108
1111/* 1109/*
1112 * ELS/CT interface 1110 * ELS/CT interface
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 728c9ad9feb0..4d1c46aac331 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -378,8 +378,6 @@ struct iscsi_host {
378/* 378/*
379 * scsi host template 379 * scsi host template
380 */ 380 */
381extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth,
382 int reason);
383extern int iscsi_eh_abort(struct scsi_cmnd *sc); 381extern int iscsi_eh_abort(struct scsi_cmnd *sc);
384extern int iscsi_eh_recover_target(struct scsi_cmnd *sc); 382extern int iscsi_eh_recover_target(struct scsi_cmnd *sc);
385extern int iscsi_eh_session_reset(struct scsi_cmnd *sc); 383extern int iscsi_eh_session_reset(struct scsi_cmnd *sc);
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index ef7872c20da9..9d87a37aecad 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -161,17 +161,12 @@ struct expander_device {
161}; 161};
162 162
163/* ---------- SATA device ---------- */ 163/* ---------- SATA device ---------- */
164enum ata_command_set {
165 ATA_COMMAND_SET = 0,
166 ATAPI_COMMAND_SET = 1,
167};
168
169#define ATA_RESP_FIS_SIZE 24 164#define ATA_RESP_FIS_SIZE 24
170 165
171struct sata_device { 166struct sata_device {
172 enum ata_command_set command_set; 167 unsigned int class;
173 struct smp_resp rps_resp; /* report_phy_sata_resp */ 168 struct smp_resp rps_resp; /* report_phy_sata_resp */
174 u8 port_no; /* port number, if this is a PM (Port) */ 169 u8 port_no; /* port number, if this is a PM (Port) */
175 170
176 struct ata_port *ap; 171 struct ata_port *ap;
177 struct ata_host ata_host; 172 struct ata_host ata_host;
@@ -365,12 +360,6 @@ struct asd_sas_phy {
365struct scsi_core { 360struct scsi_core {
366 struct Scsi_Host *shost; 361 struct Scsi_Host *shost;
367 362
368 struct mutex task_queue_flush;
369 spinlock_t task_queue_lock;
370 struct list_head task_queue;
371 int task_queue_size;
372
373 struct task_struct *queue_thread;
374}; 363};
375 364
376struct sas_ha_event { 365struct sas_ha_event {
@@ -422,9 +411,6 @@ struct sas_ha_struct {
422 struct asd_sas_port **sas_port; /* array of valid pointers, must be set */ 411 struct asd_sas_port **sas_port; /* array of valid pointers, must be set */
423 int num_phys; /* must be set, gt 0, static */ 412 int num_phys; /* must be set, gt 0, static */
424 413
425 /* The class calls this to send a task for execution. */
426 int lldd_max_execute_num;
427 int lldd_queue_size;
428 int strict_wide_ports; /* both sas_addr and attached_sas_addr must match 414 int strict_wide_ports; /* both sas_addr and attached_sas_addr must match
429 * their siblings when forming wide ports */ 415 * their siblings when forming wide ports */
430 416
@@ -612,7 +598,6 @@ struct sas_ssp_task {
612 598
613struct sas_task { 599struct sas_task {
614 struct domain_device *dev; 600 struct domain_device *dev;
615 struct list_head list;
616 601
617 spinlock_t task_state_lock; 602 spinlock_t task_state_lock;
618 unsigned task_state_flags; 603 unsigned task_state_flags;
@@ -665,8 +650,7 @@ struct sas_domain_function_template {
665 int (*lldd_dev_found)(struct domain_device *); 650 int (*lldd_dev_found)(struct domain_device *);
666 void (*lldd_dev_gone)(struct domain_device *); 651 void (*lldd_dev_gone)(struct domain_device *);
667 652
668 int (*lldd_execute_task)(struct sas_task *, int num, 653 int (*lldd_execute_task)(struct sas_task *, gfp_t gfp_flags);
669 gfp_t gfp_flags);
670 654
671 /* Task Management Functions. Must be called from process context. */ 655 /* Task Management Functions. Must be called from process context. */
672 int (*lldd_abort_task)(struct sas_task *); 656 int (*lldd_abort_task)(struct sas_task *);
@@ -700,12 +684,10 @@ extern void sas_suspend_ha(struct sas_ha_struct *sas_ha);
700int sas_set_phy_speed(struct sas_phy *phy, 684int sas_set_phy_speed(struct sas_phy *phy,
701 struct sas_phy_linkrates *rates); 685 struct sas_phy_linkrates *rates);
702int sas_phy_reset(struct sas_phy *phy, int hard_reset); 686int sas_phy_reset(struct sas_phy *phy, int hard_reset);
703int sas_queue_up(struct sas_task *task);
704extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *); 687extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *);
705extern int sas_target_alloc(struct scsi_target *); 688extern int sas_target_alloc(struct scsi_target *);
706extern int sas_slave_configure(struct scsi_device *); 689extern int sas_slave_configure(struct scsi_device *);
707extern int sas_change_queue_depth(struct scsi_device *, int new_depth, 690extern int sas_change_queue_depth(struct scsi_device *, int new_depth);
708 int reason);
709extern int sas_change_queue_type(struct scsi_device *, int qt); 691extern int sas_change_queue_type(struct scsi_device *, int qt);
710extern int sas_bios_param(struct scsi_device *, 692extern int sas_bios_param(struct scsi_device *,
711 struct block_device *, 693 struct block_device *,
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index d17178e6fcdd..8a7f8ad58aac 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -128,8 +128,10 @@ enum scsi_timeouts {
128#define MOVE_MEDIUM 0xa5 128#define MOVE_MEDIUM 0xa5
129#define EXCHANGE_MEDIUM 0xa6 129#define EXCHANGE_MEDIUM 0xa6
130#define READ_12 0xa8 130#define READ_12 0xa8
131#define SERVICE_ACTION_OUT_12 0xa9
131#define WRITE_12 0xaa 132#define WRITE_12 0xaa
132#define READ_MEDIA_SERIAL_NUMBER 0xab 133#define READ_MEDIA_SERIAL_NUMBER 0xab /* Obsolete with SPC-2 */
134#define SERVICE_ACTION_IN_12 0xab
133#define WRITE_VERIFY_12 0xae 135#define WRITE_VERIFY_12 0xae
134#define VERIFY_12 0xaf 136#define VERIFY_12 0xaf
135#define SEARCH_HIGH_12 0xb0 137#define SEARCH_HIGH_12 0xb0
@@ -151,7 +153,9 @@ enum scsi_timeouts {
151#define VERIFY_16 0x8f 153#define VERIFY_16 0x8f
152#define SYNCHRONIZE_CACHE_16 0x91 154#define SYNCHRONIZE_CACHE_16 0x91
153#define WRITE_SAME_16 0x93 155#define WRITE_SAME_16 0x93
154#define SERVICE_ACTION_IN 0x9e 156#define SERVICE_ACTION_BIDIRECTIONAL 0x9d
157#define SERVICE_ACTION_IN_16 0x9e
158#define SERVICE_ACTION_OUT_16 0x9f
155/* values for service action in */ 159/* values for service action in */
156#define SAI_READ_CAPACITY_16 0x10 160#define SAI_READ_CAPACITY_16 0x10
157#define SAI_GET_LBA_STATUS 0x12 161#define SAI_GET_LBA_STATUS 0x12
@@ -165,8 +169,8 @@ enum scsi_timeouts {
165#define MI_REPORT_ALIASES 0x0b 169#define MI_REPORT_ALIASES 0x0b
166#define MI_REPORT_SUPPORTED_OPERATION_CODES 0x0c 170#define MI_REPORT_SUPPORTED_OPERATION_CODES 0x0c
167#define MI_REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS 0x0d 171#define MI_REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS 0x0d
168#define MI_REPORT_PRIORITY 0x0e 172#define MI_REPORT_PRIORITY 0x0e
169#define MI_REPORT_TIMESTAMP 0x0f 173#define MI_REPORT_TIMESTAMP 0x0f
170#define MI_MANAGEMENT_PROTOCOL_IN 0x10 174#define MI_MANAGEMENT_PROTOCOL_IN 0x10
171/* value for MI_REPORT_TARGET_PGS ext header */ 175/* value for MI_REPORT_TARGET_PGS ext header */
172#define MI_EXT_HDR_PARAM_FMT 0x20 176#define MI_EXT_HDR_PARAM_FMT 0x20
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 522a5f27f553..9fc1aecfc813 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -53,6 +53,9 @@ struct scsi_pointer {
53 volatile int phase; 53 volatile int phase;
54}; 54};
55 55
56/* for scmd->flags */
57#define SCMD_TAGGED (1 << 0)
58
56struct scsi_cmnd { 59struct scsi_cmnd {
57 struct scsi_device *device; 60 struct scsi_device *device;
58 struct list_head list; /* scsi_cmnd participates in queue lists */ 61 struct list_head list; /* scsi_cmnd participates in queue lists */
@@ -132,6 +135,7 @@ struct scsi_cmnd {
132 * to be at an address < 16Mb). */ 135 * to be at an address < 16Mb). */
133 136
134 int result; /* Status code from lower level driver */ 137 int result; /* Status code from lower level driver */
138 int flags; /* Command flags */
135 139
136 unsigned char tag; /* SCSI-II queued command tag */ 140 unsigned char tag; /* SCSI-II queued command tag */
137}; 141};
@@ -159,7 +163,7 @@ extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count,
159 size_t *offset, size_t *len); 163 size_t *offset, size_t *len);
160extern void scsi_kunmap_atomic_sg(void *virt); 164extern void scsi_kunmap_atomic_sg(void *virt);
161 165
162extern int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask); 166extern int scsi_init_io(struct scsi_cmnd *cmd);
163 167
164extern int scsi_dma_map(struct scsi_cmnd *cmd); 168extern int scsi_dma_map(struct scsi_cmnd *cmd);
165extern void scsi_dma_unmap(struct scsi_cmnd *cmd); 169extern void scsi_dma_unmap(struct scsi_cmnd *cmd);
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index e89844cc2cd3..7982795df595 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -2,23 +2,27 @@
2#define _SCSI_SCSI_DBG_H 2#define _SCSI_SCSI_DBG_H
3 3
4struct scsi_cmnd; 4struct scsi_cmnd;
5struct scsi_device;
5struct scsi_sense_hdr; 6struct scsi_sense_hdr;
6 7
7extern void scsi_print_command(struct scsi_cmnd *); 8extern void scsi_print_command(struct scsi_cmnd *);
8extern void __scsi_print_command(unsigned char *); 9extern void __scsi_print_command(const unsigned char *, size_t);
9extern void scsi_show_extd_sense(unsigned char, unsigned char); 10extern void scsi_show_extd_sense(const struct scsi_device *, const char *,
10extern void scsi_show_sense_hdr(struct scsi_sense_hdr *); 11 unsigned char, unsigned char);
11extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *); 12extern void scsi_show_sense_hdr(const struct scsi_device *, const char *,
12extern void scsi_cmd_print_sense_hdr(struct scsi_cmnd *, const char *, 13 const struct scsi_sense_hdr *);
13 struct scsi_sense_hdr *); 14extern void scsi_print_sense_hdr(const struct scsi_device *, const char *,
14extern void scsi_print_sense(char *, struct scsi_cmnd *); 15 const struct scsi_sense_hdr *);
15extern void __scsi_print_sense(const char *name, 16extern void scsi_print_sense(const struct scsi_cmnd *);
17extern void __scsi_print_sense(const struct scsi_device *, const char *name,
16 const unsigned char *sense_buffer, 18 const unsigned char *sense_buffer,
17 int sense_len); 19 int sense_len);
18extern void scsi_show_result(int); 20extern void scsi_print_result(struct scsi_cmnd *, const char *, int);
19extern void scsi_print_result(struct scsi_cmnd *); 21extern const char *scsi_hostbyte_string(int);
20extern void scsi_print_status(unsigned char); 22extern const char *scsi_driverbyte_string(int);
23extern const char *scsi_mlreturn_string(int);
21extern const char *scsi_sense_key_string(unsigned char); 24extern const char *scsi_sense_key_string(unsigned char);
22extern const char *scsi_extd_sense_format(unsigned char, unsigned char); 25extern const char *scsi_extd_sense_format(unsigned char, unsigned char,
26 const char **);
23 27
24#endif /* _SCSI_SCSI_DBG_H */ 28#endif /* _SCSI_SCSI_DBG_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 27ecee73bd72..6364e23454dd 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -141,7 +141,6 @@ struct scsi_device {
141 unsigned ppr:1; /* Device supports PPR messages */ 141 unsigned ppr:1; /* Device supports PPR messages */
142 unsigned tagged_supported:1; /* Supports SCSI-II tagged queuing */ 142 unsigned tagged_supported:1; /* Supports SCSI-II tagged queuing */
143 unsigned simple_tags:1; /* simple queue tag messages are enabled */ 143 unsigned simple_tags:1; /* simple queue tag messages are enabled */
144 unsigned ordered_tags:1;/* ordered queue tag messages are enabled */
145 unsigned was_reset:1; /* There was a bus reset on the bus for 144 unsigned was_reset:1; /* There was a bus reset on the bus for
146 * this device */ 145 * this device */
147 unsigned expecting_cc_ua:1; /* Expecting a CHECK_CONDITION/UNIT_ATTN 146 unsigned expecting_cc_ua:1; /* Expecting a CHECK_CONDITION/UNIT_ATTN
@@ -201,11 +200,6 @@ struct scsi_device {
201 unsigned long sdev_data[0]; 200 unsigned long sdev_data[0];
202} __attribute__((aligned(sizeof(unsigned long)))); 201} __attribute__((aligned(sizeof(unsigned long))));
203 202
204struct scsi_dh_devlist {
205 char *vendor;
206 char *model;
207};
208
209typedef void (*activate_complete)(void *, int); 203typedef void (*activate_complete)(void *, int);
210struct scsi_device_handler { 204struct scsi_device_handler {
211 /* Used by the infrastructure */ 205 /* Used by the infrastructure */
@@ -214,9 +208,8 @@ struct scsi_device_handler {
214 /* Filled by the hardware handler */ 208 /* Filled by the hardware handler */
215 struct module *module; 209 struct module *module;
216 const char *name; 210 const char *name;
217 const struct scsi_dh_devlist *devlist;
218 int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *); 211 int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *);
219 int (*attach)(struct scsi_device *); 212 struct scsi_dh_data *(*attach)(struct scsi_device *);
220 void (*detach)(struct scsi_device *); 213 void (*detach)(struct scsi_device *);
221 int (*activate)(struct scsi_device *, activate_complete, void *); 214 int (*activate)(struct scsi_device *, activate_complete, void *);
222 int (*prep_fn)(struct scsi_device *, struct request *); 215 int (*prep_fn)(struct scsi_device *, struct request *);
@@ -228,7 +221,6 @@ struct scsi_dh_data {
228 struct scsi_device_handler *scsi_dh; 221 struct scsi_device_handler *scsi_dh;
229 struct scsi_device *sdev; 222 struct scsi_device *sdev;
230 struct kref kref; 223 struct kref kref;
231 char buf[0];
232}; 224};
233 225
234#define to_scsi_device(d) \ 226#define to_scsi_device(d) \
@@ -244,6 +236,15 @@ struct scsi_dh_data {
244#define sdev_dbg(sdev, fmt, a...) \ 236#define sdev_dbg(sdev, fmt, a...) \
245 dev_dbg(&(sdev)->sdev_gendev, fmt, ##a) 237 dev_dbg(&(sdev)->sdev_gendev, fmt, ##a)
246 238
239/*
240 * like scmd_printk, but the device name is passed in
241 * as a string pointer
242 */
243#define sdev_prefix_printk(l, sdev, p, fmt, a...) \
244 (p) ? \
245 sdev_printk(l, sdev, "[%s] " fmt, p, ##a) : \
246 sdev_printk(l, sdev, fmt, ##a)
247
247#define scmd_printk(prefix, scmd, fmt, a...) \ 248#define scmd_printk(prefix, scmd, fmt, a...) \
248 (scmd)->request->rq_disk ? \ 249 (scmd)->request->rq_disk ? \
249 sdev_printk(prefix, (scmd)->device, "[%s] " fmt, \ 250 sdev_printk(prefix, (scmd)->device, "[%s] " fmt, \
@@ -379,7 +380,7 @@ extern struct scsi_device *__scsi_iterate_devices(struct Scsi_Host *,
379#define __shost_for_each_device(sdev, shost) \ 380#define __shost_for_each_device(sdev, shost) \
380 list_for_each_entry((sdev), &((shost)->__devices), siblings) 381 list_for_each_entry((sdev), &((shost)->__devices), siblings)
381 382
382extern void scsi_adjust_queue_depth(struct scsi_device *, int, int); 383extern int scsi_change_queue_depth(struct scsi_device *, int);
383extern int scsi_track_queue_full(struct scsi_device *, int); 384extern int scsi_track_queue_full(struct scsi_device *, int);
384 385
385extern int scsi_set_medium_removal(struct scsi_device *, char); 386extern int scsi_set_medium_removal(struct scsi_device *, char);
diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h
index c2b759809d8a..891a658aa867 100644
--- a/include/scsi/scsi_driver.h
+++ b/include/scsi/scsi_driver.h
@@ -9,7 +9,6 @@ struct scsi_cmnd;
9struct scsi_device; 9struct scsi_device;
10 10
11struct scsi_driver { 11struct scsi_driver {
12 struct module *owner;
13 struct device_driver gendrv; 12 struct device_driver gendrv;
14 13
15 void (*rescan)(struct device *); 14 void (*rescan)(struct device *);
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
index 06a8790893ef..1e1421b06565 100644
--- a/include/scsi/scsi_eh.h
+++ b/include/scsi/scsi_eh.h
@@ -27,10 +27,10 @@ struct scsi_sense_hdr { /* See SPC-3 section 4.5 */
27 u8 additional_length; /* always 0 for fixed sense format */ 27 u8 additional_length; /* always 0 for fixed sense format */
28}; 28};
29 29
30static inline int scsi_sense_valid(struct scsi_sense_hdr *sshdr) 30static inline bool scsi_sense_valid(const struct scsi_sense_hdr *sshdr)
31{ 31{
32 if (!sshdr) 32 if (!sshdr)
33 return 0; 33 return false;
34 34
35 return (sshdr->response_code & 0x70) == 0x70; 35 return (sshdr->response_code & 0x70) == 0x70;
36} 36}
@@ -42,12 +42,12 @@ extern void scsi_eh_flush_done_q(struct list_head *done_q);
42extern void scsi_report_bus_reset(struct Scsi_Host *, int); 42extern void scsi_report_bus_reset(struct Scsi_Host *, int);
43extern void scsi_report_device_reset(struct Scsi_Host *, int, int); 43extern void scsi_report_device_reset(struct Scsi_Host *, int, int);
44extern int scsi_block_when_processing_errors(struct scsi_device *); 44extern int scsi_block_when_processing_errors(struct scsi_device *);
45extern int scsi_normalize_sense(const u8 *sense_buffer, int sb_len, 45extern bool scsi_normalize_sense(const u8 *sense_buffer, int sb_len,
46 struct scsi_sense_hdr *sshdr); 46 struct scsi_sense_hdr *sshdr);
47extern int scsi_command_normalize_sense(struct scsi_cmnd *cmd, 47extern bool scsi_command_normalize_sense(const struct scsi_cmnd *cmd,
48 struct scsi_sense_hdr *sshdr); 48 struct scsi_sense_hdr *sshdr);
49 49
50static inline int scsi_sense_is_deferred(struct scsi_sense_hdr *sshdr) 50static inline bool scsi_sense_is_deferred(const struct scsi_sense_hdr *sshdr)
51{ 51{
52 return ((sshdr->response_code >= 0x70) && (sshdr->response_code & 1)); 52 return ((sshdr->response_code >= 0x70) && (sshdr->response_code & 1));
53} 53}
@@ -60,15 +60,7 @@ extern int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len,
60 60
61extern void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq); 61extern void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq);
62 62
63/* 63extern int scsi_ioctl_reset(struct scsi_device *, int __user *);
64 * Reset request from external source
65 */
66#define SCSI_TRY_RESET_DEVICE 1
67#define SCSI_TRY_RESET_BUS 2
68#define SCSI_TRY_RESET_HOST 3
69#define SCSI_TRY_RESET_TARGET 4
70
71extern int scsi_reset_provider(struct scsi_device *, int);
72 64
73struct scsi_eh_save { 65struct scsi_eh_save {
74 /* saved state */ 66 /* saved state */
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 5e362489ee88..e939d2b3757a 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -46,12 +46,6 @@ struct blk_queue_tags;
46#define DISABLE_CLUSTERING 0 46#define DISABLE_CLUSTERING 0
47#define ENABLE_CLUSTERING 1 47#define ENABLE_CLUSTERING 1
48 48
49enum {
50 SCSI_QDEPTH_DEFAULT, /* default requested change, e.g. from sysfs */
51 SCSI_QDEPTH_QFULL, /* scsi-ml requested due to queue full */
52 SCSI_QDEPTH_RAMP_UP, /* scsi-ml requested due to threshold event */
53};
54
55struct scsi_host_template { 49struct scsi_host_template {
56 struct module *module; 50 struct module *module;
57 const char *name; 51 const char *name;
@@ -195,7 +189,7 @@ struct scsi_host_template {
195 * Things currently recommended to be handled at this time include: 189 * Things currently recommended to be handled at this time include:
196 * 190 *
197 * 1. Setting the device queue depth. Proper setting of this is 191 * 1. Setting the device queue depth. Proper setting of this is
198 * described in the comments for scsi_adjust_queue_depth. 192 * described in the comments for scsi_change_queue_depth.
199 * 2. Determining if the device supports the various synchronous 193 * 2. Determining if the device supports the various synchronous
200 * negotiation protocols. The device struct will already have 194 * negotiation protocols. The device struct will already have
201 * responded to INQUIRY and the results of the standard items 195 * responded to INQUIRY and the results of the standard items
@@ -281,7 +275,7 @@ struct scsi_host_template {
281 * 275 *
282 * Status: OPTIONAL 276 * Status: OPTIONAL
283 */ 277 */
284 int (* change_queue_depth)(struct scsi_device *, int, int); 278 int (* change_queue_depth)(struct scsi_device *, int);
285 279
286 /* 280 /*
287 * Fill in this function to allow the changing of tag types 281 * Fill in this function to allow the changing of tag types
@@ -422,6 +416,16 @@ struct scsi_host_template {
422 unsigned char present; 416 unsigned char present;
423 417
424 /* 418 /*
419 * Let the block layer assigns tags to all commands.
420 */
421 unsigned use_blk_tags:1;
422
423 /*
424 * Track QUEUE_FULL events and reduce queue depth on demand.
425 */
426 unsigned track_queue_depth:1;
427
428 /*
425 * This specifies the mode that a LLD supports. 429 * This specifies the mode that a LLD supports.
426 */ 430 */
427 unsigned supported_mode:2; 431 unsigned supported_mode:2;
@@ -451,11 +455,6 @@ struct scsi_host_template {
451 */ 455 */
452 unsigned skip_settle_delay:1; 456 unsigned skip_settle_delay:1;
453 457
454 /*
455 * True if we are using ordered write support.
456 */
457 unsigned ordered_tag:1;
458
459 /* True if the controller does not support WRITE SAME */ 458 /* True if the controller does not support WRITE SAME */
460 unsigned no_write_same:1; 459 unsigned no_write_same:1;
461 460
@@ -555,7 +554,7 @@ struct Scsi_Host {
555 * __devices is protected by the host_lock, but you should 554 * __devices is protected by the host_lock, but you should
556 * usually use scsi_device_lookup / shost_for_each_device 555 * usually use scsi_device_lookup / shost_for_each_device
557 * to access it and don't care about locking yourself. 556 * to access it and don't care about locking yourself.
558 * In the rare case of beeing in irq context you can use 557 * In the rare case of being in irq context you can use
559 * their __ prefixed variants with the lock held. NEVER 558 * their __ prefixed variants with the lock held. NEVER
560 * access this list directly from a driver. 559 * access this list directly from a driver.
561 */ 560 */
@@ -638,6 +637,14 @@ struct Scsi_Host {
638 short unsigned int sg_prot_tablesize; 637 short unsigned int sg_prot_tablesize;
639 unsigned int max_sectors; 638 unsigned int max_sectors;
640 unsigned long dma_boundary; 639 unsigned long dma_boundary;
640 /*
641 * In scsi-mq mode, the number of hardware queues supported by the LLD.
642 *
643 * Note: it is assumed that each hardware queue has a queue depth of
644 * can_queue. In other words, the total queue depth per host
645 * is nr_hw_queues * can_queue.
646 */
647 unsigned nr_hw_queues;
641 /* 648 /*
642 * Used to assign serial numbers to the cmds. 649 * Used to assign serial numbers to the cmds.
643 * Protected by the host lock. 650 * Protected by the host lock.
@@ -647,7 +654,6 @@ struct Scsi_Host {
647 unsigned active_mode:2; 654 unsigned active_mode:2;
648 unsigned unchecked_isa_dma:1; 655 unsigned unchecked_isa_dma:1;
649 unsigned use_clustering:1; 656 unsigned use_clustering:1;
650 unsigned use_blk_tcq:1;
651 657
652 /* 658 /*
653 * Host has requested that no further requests come through for the 659 * Host has requested that no further requests come through for the
@@ -662,11 +668,6 @@ struct Scsi_Host {
662 */ 668 */
663 unsigned reverse_ordering:1; 669 unsigned reverse_ordering:1;
664 670
665 /*
666 * Ordered write support
667 */
668 unsigned ordered_tag:1;
669
670 /* Task mgmt function in progress */ 671 /* Task mgmt function in progress */
671 unsigned tmf_in_progress:1; 672 unsigned tmf_in_progress:1;
672 673
diff --git a/include/scsi/scsi_ioctl.h b/include/scsi/scsi_ioctl.h
index b9006848b813..8d19d1d233c3 100644
--- a/include/scsi/scsi_ioctl.h
+++ b/include/scsi/scsi_ioctl.h
@@ -40,9 +40,9 @@ typedef struct scsi_fctargaddress {
40 unsigned char host_wwn[8]; // include NULL term. 40 unsigned char host_wwn[8]; // include NULL term.
41} Scsi_FCTargAddress; 41} Scsi_FCTargAddress;
42 42
43int scsi_ioctl_block_when_processing_errors(struct scsi_device *sdev,
44 int cmd, bool ndelay);
43extern int scsi_ioctl(struct scsi_device *, int, void __user *); 45extern int scsi_ioctl(struct scsi_device *, int, void __user *);
44extern int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd,
45 void __user *arg, int ndelay);
46 46
47#endif /* __KERNEL__ */ 47#endif /* __KERNEL__ */
48#endif /* _SCSI_IOCTL_H */ 48#endif /* _SCSI_IOCTL_H */
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index 56ed843969ca..fe4a70299419 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -16,20 +16,16 @@
16 16
17#ifdef CONFIG_BLOCK 17#ifdef CONFIG_BLOCK
18 18
19int scsi_change_queue_type(struct scsi_device *sdev, int tag_type);
20
19/** 21/**
20 * scsi_get_tag_type - get the type of tag the device supports 22 * scsi_get_tag_type - get the type of tag the device supports
21 * @sdev: the scsi device 23 * @sdev: the scsi device
22 *
23 * Notes:
24 * If the drive only supports simple tags, returns MSG_SIMPLE_TAG
25 * if it supports all tag types, returns MSG_ORDERED_TAG.
26 */ 24 */
27static inline int scsi_get_tag_type(struct scsi_device *sdev) 25static inline int scsi_get_tag_type(struct scsi_device *sdev)
28{ 26{
29 if (!sdev->tagged_supported) 27 if (!sdev->tagged_supported)
30 return 0; 28 return 0;
31 if (sdev->ordered_tags)
32 return MSG_ORDERED_TAG;
33 if (sdev->simple_tags) 29 if (sdev->simple_tags)
34 return MSG_SIMPLE_TAG; 30 return MSG_SIMPLE_TAG;
35 return 0; 31 return 0;
@@ -39,90 +35,33 @@ static inline void scsi_set_tag_type(struct scsi_device *sdev, int tag)
39{ 35{
40 switch (tag) { 36 switch (tag) {
41 case MSG_ORDERED_TAG: 37 case MSG_ORDERED_TAG:
42 sdev->ordered_tags = 1;
43 /* fall through */
44 case MSG_SIMPLE_TAG: 38 case MSG_SIMPLE_TAG:
45 sdev->simple_tags = 1; 39 sdev->simple_tags = 1;
46 break; 40 break;
47 case 0: 41 case 0:
48 /* fall through */ 42 /* fall through */
49 default: 43 default:
50 sdev->ordered_tags = 0;
51 sdev->simple_tags = 0; 44 sdev->simple_tags = 0;
52 break; 45 break;
53 } 46 }
54} 47}
55/**
56 * scsi_activate_tcq - turn on tag command queueing
57 * @SDpnt: device to turn on TCQ for
58 * @depth: queue depth
59 *
60 * Notes:
61 * Eventually, I hope depth would be the maximum depth
62 * the device could cope with and the real queue depth
63 * would be adjustable from 0 to depth.
64 **/
65static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
66{
67 if (!sdev->tagged_supported)
68 return;
69
70 if (shost_use_blk_mq(sdev->host))
71 queue_flag_set_unlocked(QUEUE_FLAG_QUEUED, sdev->request_queue);
72 else if (!blk_queue_tagged(sdev->request_queue))
73 blk_queue_init_tags(sdev->request_queue, depth,
74 sdev->host->bqt);
75
76 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
77}
78
79/**
80 * scsi_deactivate_tcq - turn off tag command queueing
81 * @SDpnt: device to turn off TCQ for
82 **/
83static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth)
84{
85 if (blk_queue_tagged(sdev->request_queue))
86 blk_queue_free_tags(sdev->request_queue);
87 scsi_adjust_queue_depth(sdev, 0, depth);
88}
89
90/**
91 * scsi_populate_tag_msg - place a tag message in a buffer
92 * @SCpnt: pointer to the Scsi_Cmnd for the tag
93 * @msg: pointer to the area to place the tag
94 *
95 * Notes:
96 * designed to create the correct type of tag message for the
97 * particular request. Returns the size of the tag message.
98 * May return 0 if TCQ is disabled for this device.
99 **/
100static inline int scsi_populate_tag_msg(struct scsi_cmnd *cmd, char *msg)
101{
102 struct request *req = cmd->request;
103
104 if (blk_rq_tagged(req)) {
105 *msg++ = MSG_SIMPLE_TAG;
106 *msg++ = req->tag;
107 return 2;
108 }
109
110 return 0;
111}
112 48
113static inline struct scsi_cmnd *scsi_mq_find_tag(struct Scsi_Host *shost, 49static inline struct scsi_cmnd *scsi_mq_find_tag(struct Scsi_Host *shost,
114 unsigned int hw_ctx, int tag) 50 int unique_tag)
115{ 51{
116 struct request *req; 52 u16 hwq = blk_mq_unique_tag_to_hwq(unique_tag);
53 struct request *req = NULL;
117 54
118 req = blk_mq_tag_to_rq(shost->tag_set.tags[hw_ctx], tag); 55 if (hwq < shost->tag_set.nr_hw_queues)
56 req = blk_mq_tag_to_rq(shost->tag_set.tags[hwq],
57 blk_mq_unique_tag_to_tag(unique_tag));
119 return req ? (struct scsi_cmnd *)req->special : NULL; 58 return req ? (struct scsi_cmnd *)req->special : NULL;
120} 59}
121 60
122/** 61/**
123 * scsi_find_tag - find a tagged command by device 62 * scsi_find_tag - find a tagged command by device
124 * @SDpnt: pointer to the ScSI device 63 * @SDpnt: pointer to the ScSI device
125 * @tag: the tag number 64 * @tag: tag generated by blk_mq_unique_tag()
126 * 65 *
127 * Notes: 66 * Notes:
128 * Only works with tags allocated by the generic blk layer. 67 * Only works with tags allocated by the generic blk layer.
@@ -133,9 +72,9 @@ static inline struct scsi_cmnd *scsi_find_tag(struct scsi_device *sdev, int tag)
133 72
134 if (tag != SCSI_NO_TAG) { 73 if (tag != SCSI_NO_TAG) {
135 if (shost_use_blk_mq(sdev->host)) 74 if (shost_use_blk_mq(sdev->host))
136 return scsi_mq_find_tag(sdev->host, 0, tag); 75 return scsi_mq_find_tag(sdev->host, tag);
137 76
138 req = blk_queue_find_tag(sdev->request_queue, tag); 77 req = blk_queue_find_tag(sdev->request_queue, tag);
139 return req ? (struct scsi_cmnd *)req->special : NULL; 78 return req ? (struct scsi_cmnd *)req->special : NULL;
140 } 79 }
141 80
@@ -174,7 +113,7 @@ static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth)
174/** 113/**
175 * scsi_host_find_tag - find the tagged command by host 114 * scsi_host_find_tag - find the tagged command by host
176 * @shost: pointer to scsi_host 115 * @shost: pointer to scsi_host
177 * @tag: tag of the scsi_cmnd 116 * @tag: tag generated by blk_mq_unique_tag()
178 * 117 *
179 * Notes: 118 * Notes:
180 * Only works with tags allocated by the generic blk layer. 119 * Only works with tags allocated by the generic blk layer.
@@ -186,7 +125,7 @@ static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost,
186 125
187 if (tag != SCSI_NO_TAG) { 126 if (tag != SCSI_NO_TAG) {
188 if (shost_use_blk_mq(shost)) 127 if (shost_use_blk_mq(shost))
189 return scsi_mq_find_tag(shost, 0, tag); 128 return scsi_mq_find_tag(shost, tag);
190 req = blk_map_queue_find_tag(shost->bqt, tag); 129 req = blk_map_queue_find_tag(shost->bqt, tag);
191 return req ? (struct scsi_cmnd *)req->special : NULL; 130 return req ? (struct scsi_cmnd *)req->special : NULL;
192 } 131 }
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
index 7497a383b1a4..a4fa52b4d5c5 100644
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -157,5 +157,6 @@ int spi_populate_width_msg(unsigned char *msg, int width);
157int spi_populate_sync_msg(unsigned char *msg, int period, int offset); 157int spi_populate_sync_msg(unsigned char *msg, int period, int offset);
158int spi_populate_ppr_msg(unsigned char *msg, int period, int offset, int width, 158int spi_populate_ppr_msg(unsigned char *msg, int period, int offset, int width,
159 int options); 159 int options);
160int spi_populate_tag_msg(unsigned char *msg, struct scsi_cmnd *cmd);
160 161
161#endif /* SCSI_TRANSPORT_SPI_H */ 162#endif /* SCSI_TRANSPORT_SPI_H */
diff --git a/include/scsi/sg.h b/include/scsi/sg.h
index 750e5db7c6bf..3afec7032448 100644
--- a/include/scsi/sg.h
+++ b/include/scsi/sg.h
@@ -164,12 +164,15 @@ typedef struct sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */
164 164
165/* Returns -EBUSY if occupied. 3rd argument pointer to int (see next) */ 165/* Returns -EBUSY if occupied. 3rd argument pointer to int (see next) */
166#define SG_SCSI_RESET 0x2284 166#define SG_SCSI_RESET 0x2284
167/* Associated values that can be given to SG_SCSI_RESET follow */ 167/* Associated values that can be given to SG_SCSI_RESET follow.
168 * SG_SCSI_RESET_NO_ESCALATE may be OR-ed to the _DEVICE, _TARGET, _BUS
169 * or _HOST reset value so only that action is attempted. */
168#define SG_SCSI_RESET_NOTHING 0 170#define SG_SCSI_RESET_NOTHING 0
169#define SG_SCSI_RESET_DEVICE 1 171#define SG_SCSI_RESET_DEVICE 1
170#define SG_SCSI_RESET_BUS 2 172#define SG_SCSI_RESET_BUS 2
171#define SG_SCSI_RESET_HOST 3 173#define SG_SCSI_RESET_HOST 3
172#define SG_SCSI_RESET_TARGET 4 174#define SG_SCSI_RESET_TARGET 4
175#define SG_SCSI_RESET_NO_ESCALATE 0x100
173 176
174/* synchronous SCSI command ioctl, (only in version 3 interface) */ 177/* synchronous SCSI command ioctl, (only in version 3 interface) */
175#define SG_IO 0x2285 /* similar effect as write() followed by read() */ 178#define SG_IO 0x2285 /* similar effect as write() followed by read() */
diff --git a/include/soc/at91/at91rm9200_sdramc.h b/include/soc/at91/at91rm9200_sdramc.h
new file mode 100644
index 000000000000..aa047f458f1b
--- /dev/null
+++ b/include/soc/at91/at91rm9200_sdramc.h
@@ -0,0 +1,63 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91rm9200_sdramc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Memory Controllers (SDRAMC only) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_SDRAMC_H
17#define AT91RM9200_SDRAMC_H
18
19/* SDRAM Controller registers */
20#define AT91RM9200_SDRAMC_MR 0x90 /* Mode Register */
21#define AT91RM9200_SDRAMC_MODE (0xf << 0) /* Command Mode */
22#define AT91RM9200_SDRAMC_MODE_NORMAL (0 << 0)
23#define AT91RM9200_SDRAMC_MODE_NOP (1 << 0)
24#define AT91RM9200_SDRAMC_MODE_PRECHARGE (2 << 0)
25#define AT91RM9200_SDRAMC_MODE_LMR (3 << 0)
26#define AT91RM9200_SDRAMC_MODE_REFRESH (4 << 0)
27#define AT91RM9200_SDRAMC_DBW (1 << 4) /* Data Bus Width */
28#define AT91RM9200_SDRAMC_DBW_32 (0 << 4)
29#define AT91RM9200_SDRAMC_DBW_16 (1 << 4)
30
31#define AT91RM9200_SDRAMC_TR 0x94 /* Refresh Timer Register */
32#define AT91RM9200_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Count */
33
34#define AT91RM9200_SDRAMC_CR 0x98 /* Configuration Register */
35#define AT91RM9200_SDRAMC_NC (3 << 0) /* Number of Column Bits */
36#define AT91RM9200_SDRAMC_NC_8 (0 << 0)
37#define AT91RM9200_SDRAMC_NC_9 (1 << 0)
38#define AT91RM9200_SDRAMC_NC_10 (2 << 0)
39#define AT91RM9200_SDRAMC_NC_11 (3 << 0)
40#define AT91RM9200_SDRAMC_NR (3 << 2) /* Number of Row Bits */
41#define AT91RM9200_SDRAMC_NR_11 (0 << 2)
42#define AT91RM9200_SDRAMC_NR_12 (1 << 2)
43#define AT91RM9200_SDRAMC_NR_13 (2 << 2)
44#define AT91RM9200_SDRAMC_NB (1 << 4) /* Number of Banks */
45#define AT91RM9200_SDRAMC_NB_2 (0 << 4)
46#define AT91RM9200_SDRAMC_NB_4 (1 << 4)
47#define AT91RM9200_SDRAMC_CAS (3 << 5) /* CAS Latency */
48#define AT91RM9200_SDRAMC_CAS_2 (2 << 5)
49#define AT91RM9200_SDRAMC_TWR (0xf << 7) /* Write Recovery Delay */
50#define AT91RM9200_SDRAMC_TRC (0xf << 11) /* Row Cycle Delay */
51#define AT91RM9200_SDRAMC_TRP (0xf << 15) /* Row Precharge Delay */
52#define AT91RM9200_SDRAMC_TRCD (0xf << 19) /* Row to Column Delay */
53#define AT91RM9200_SDRAMC_TRAS (0xf << 23) /* Active to Precharge Delay */
54#define AT91RM9200_SDRAMC_TXSR (0xf << 27) /* Exit Self Refresh to Active Delay */
55
56#define AT91RM9200_SDRAMC_SRR 0x9c /* Self Refresh Register */
57#define AT91RM9200_SDRAMC_LPR 0xa0 /* Low Power Register */
58#define AT91RM9200_SDRAMC_IER 0xa4 /* Interrupt Enable Register */
59#define AT91RM9200_SDRAMC_IDR 0xa8 /* Interrupt Disable Register */
60#define AT91RM9200_SDRAMC_IMR 0xac /* Interrupt Mask Register */
61#define AT91RM9200_SDRAMC_ISR 0xb0 /* Interrupt Status Register */
62
63#endif
diff --git a/include/soc/at91/at91sam9_ddrsdr.h b/include/soc/at91/at91sam9_ddrsdr.h
new file mode 100644
index 000000000000..0210797abf2e
--- /dev/null
+++ b/include/soc/at91/at91sam9_ddrsdr.h
@@ -0,0 +1,124 @@
1/*
2 * Header file for the Atmel DDR/SDR SDRAM Controller
3 *
4 * Copyright (C) 2010 Atmel Corporation
5 * Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12#ifndef AT91SAM9_DDRSDR_H
13#define AT91SAM9_DDRSDR_H
14
15#define AT91_DDRSDRC_MR 0x00 /* Mode Register */
16#define AT91_DDRSDRC_MODE (0x7 << 0) /* Command Mode */
17#define AT91_DDRSDRC_MODE_NORMAL 0
18#define AT91_DDRSDRC_MODE_NOP 1
19#define AT91_DDRSDRC_MODE_PRECHARGE 2
20#define AT91_DDRSDRC_MODE_LMR 3
21#define AT91_DDRSDRC_MODE_REFRESH 4
22#define AT91_DDRSDRC_MODE_EXT_LMR 5
23#define AT91_DDRSDRC_MODE_DEEP 6
24
25#define AT91_DDRSDRC_RTR 0x04 /* Refresh Timer Register */
26#define AT91_DDRSDRC_COUNT (0xfff << 0) /* Refresh Timer Counter */
27
28#define AT91_DDRSDRC_CR 0x08 /* Configuration Register */
29#define AT91_DDRSDRC_NC (3 << 0) /* Number of Column Bits */
30#define AT91_DDRSDRC_NC_SDR8 (0 << 0)
31#define AT91_DDRSDRC_NC_SDR9 (1 << 0)
32#define AT91_DDRSDRC_NC_SDR10 (2 << 0)
33#define AT91_DDRSDRC_NC_SDR11 (3 << 0)
34#define AT91_DDRSDRC_NC_DDR9 (0 << 0)
35#define AT91_DDRSDRC_NC_DDR10 (1 << 0)
36#define AT91_DDRSDRC_NC_DDR11 (2 << 0)
37#define AT91_DDRSDRC_NC_DDR12 (3 << 0)
38#define AT91_DDRSDRC_NR (3 << 2) /* Number of Row Bits */
39#define AT91_DDRSDRC_NR_11 (0 << 2)
40#define AT91_DDRSDRC_NR_12 (1 << 2)
41#define AT91_DDRSDRC_NR_13 (2 << 2)
42#define AT91_DDRSDRC_NR_14 (3 << 2)
43#define AT91_DDRSDRC_CAS (7 << 4) /* CAS Latency */
44#define AT91_DDRSDRC_CAS_2 (2 << 4)
45#define AT91_DDRSDRC_CAS_3 (3 << 4)
46#define AT91_DDRSDRC_CAS_25 (6 << 4)
47#define AT91_DDRSDRC_RST_DLL (1 << 7) /* Reset DLL */
48#define AT91_DDRSDRC_DICDS (1 << 8) /* Output impedance control */
49#define AT91_DDRSDRC_DIS_DLL (1 << 9) /* Disable DLL [SAM9 Only] */
50#define AT91_DDRSDRC_OCD (1 << 12) /* Off-Chip Driver [SAM9 Only] */
51#define AT91_DDRSDRC_DQMS (1 << 16) /* Mask Data is Shared [SAM9 Only] */
52#define AT91_DDRSDRC_ACTBST (1 << 18) /* Active Bank X to Burst Stop Read Access Bank Y [SAM9 Only] */
53
54#define AT91_DDRSDRC_T0PR 0x0C /* Timing 0 Register */
55#define AT91_DDRSDRC_TRAS (0xf << 0) /* Active to Precharge delay */
56#define AT91_DDRSDRC_TRCD (0xf << 4) /* Row to Column delay */
57#define AT91_DDRSDRC_TWR (0xf << 8) /* Write recovery delay */
58#define AT91_DDRSDRC_TRC (0xf << 12) /* Row cycle delay */
59#define AT91_DDRSDRC_TRP (0xf << 16) /* Row precharge delay */
60#define AT91_DDRSDRC_TRRD (0xf << 20) /* Active BankA to BankB */
61#define AT91_DDRSDRC_TWTR (0x7 << 24) /* Internal Write to Read delay */
62#define AT91_DDRSDRC_RED_WRRD (0x1 << 27) /* Reduce Write to Read Delay [SAM9 Only] */
63#define AT91_DDRSDRC_TMRD (0xf << 28) /* Load mode to active/refresh delay */
64
65#define AT91_DDRSDRC_T1PR 0x10 /* Timing 1 Register */
66#define AT91_DDRSDRC_TRFC (0x1f << 0) /* Row Cycle Delay */
67#define AT91_DDRSDRC_TXSNR (0xff << 8) /* Exit self-refresh to non-read */
68#define AT91_DDRSDRC_TXSRD (0xff << 16) /* Exit self-refresh to read */
69#define AT91_DDRSDRC_TXP (0xf << 24) /* Exit power-down delay */
70
71#define AT91_DDRSDRC_T2PR 0x14 /* Timing 2 Register [SAM9 Only] */
72#define AT91_DDRSDRC_TXARD (0xf << 0) /* Exit active power down delay to read command in mode "Fast Exit" */
73#define AT91_DDRSDRC_TXARDS (0xf << 4) /* Exit active power down delay to read command in mode "Slow Exit" */
74#define AT91_DDRSDRC_TRPA (0xf << 8) /* Row Precharge All delay */
75#define AT91_DDRSDRC_TRTP (0x7 << 12) /* Read to Precharge delay */
76
77#define AT91_DDRSDRC_LPR 0x1C /* Low Power Register */
78#define AT91_DDRSDRC_LPCB (3 << 0) /* Low-power Configurations */
79#define AT91_DDRSDRC_LPCB_DISABLE 0
80#define AT91_DDRSDRC_LPCB_SELF_REFRESH 1
81#define AT91_DDRSDRC_LPCB_POWER_DOWN 2
82#define AT91_DDRSDRC_LPCB_DEEP_POWER_DOWN 3
83#define AT91_DDRSDRC_CLKFR (1 << 2) /* Clock Frozen */
84#define AT91_DDRSDRC_PASR (7 << 4) /* Partial Array Self Refresh */
85#define AT91_DDRSDRC_TCSR (3 << 8) /* Temperature Compensated Self Refresh */
86#define AT91_DDRSDRC_DS (3 << 10) /* Drive Strength */
87#define AT91_DDRSDRC_TIMEOUT (3 << 12) /* Time to define when Low Power Mode is enabled */
88#define AT91_DDRSDRC_TIMEOUT_0_CLK_CYCLES (0 << 12)
89#define AT91_DDRSDRC_TIMEOUT_64_CLK_CYCLES (1 << 12)
90#define AT91_DDRSDRC_TIMEOUT_128_CLK_CYCLES (2 << 12)
91#define AT91_DDRSDRC_APDE (1 << 16) /* Active power down exit time */
92#define AT91_DDRSDRC_UPD_MR (3 << 20) /* Update load mode register and extended mode register */
93
94#define AT91_DDRSDRC_MDR 0x20 /* Memory Device Register */
95#define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */
96#define AT91_DDRSDRC_MD_SDR 0
97#define AT91_DDRSDRC_MD_LOW_POWER_SDR 1
98#define AT91_DDRSDRC_MD_LOW_POWER_DDR 3
99#define AT91_DDRSDRC_MD_DDR2 6 /* [SAM9 Only] */
100#define AT91_DDRSDRC_DBW (1 << 4) /* Data Bus Width */
101#define AT91_DDRSDRC_DBW_32BITS (0 << 4)
102#define AT91_DDRSDRC_DBW_16BITS (1 << 4)
103
104#define AT91_DDRSDRC_DLL 0x24 /* DLL Information Register */
105#define AT91_DDRSDRC_MDINC (1 << 0) /* Master Delay increment */
106#define AT91_DDRSDRC_MDDEC (1 << 1) /* Master Delay decrement */
107#define AT91_DDRSDRC_MDOVF (1 << 2) /* Master Delay Overflow */
108#define AT91_DDRSDRC_MDVAL (0xff << 8) /* Master Delay value */
109
110#define AT91_DDRSDRC_HS 0x2C /* High Speed Register [SAM9 Only] */
111#define AT91_DDRSDRC_DIS_ATCP_RD (1 << 2) /* Anticip read access is disabled */
112
113#define AT91_DDRSDRC_DELAY(n) (0x30 + (0x4 * (n))) /* Delay I/O Register n */
114
115#define AT91_DDRSDRC_WPMR 0xE4 /* Write Protect Mode Register [SAM9 Only] */
116#define AT91_DDRSDRC_WP (1 << 0) /* Write protect enable */
117#define AT91_DDRSDRC_WPKEY (0xffffff << 8) /* Write protect key */
118#define AT91_DDRSDRC_KEY (0x444452 << 8) /* Write protect key = "DDR" */
119
120#define AT91_DDRSDRC_WPSR 0xE8 /* Write Protect Status Register [SAM9 Only] */
121#define AT91_DDRSDRC_WPVS (1 << 0) /* Write protect violation status */
122#define AT91_DDRSDRC_WPVSRC (0xffff << 8) /* Write protect violation source */
123
124#endif
diff --git a/include/soc/at91/at91sam9_sdramc.h b/include/soc/at91/at91sam9_sdramc.h
new file mode 100644
index 000000000000..3d085a9a7450
--- /dev/null
+++ b/include/soc/at91/at91sam9_sdramc.h
@@ -0,0 +1,85 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
3 *
4 * Copyright (C) 2007 Andrew Victor
5 * Copyright (C) 2007 Atmel Corporation.
6 *
7 * SDRAM Controllers (SDRAMC) - System peripherals registers.
8 * Based on AT91SAM9261 datasheet revision D.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91SAM9_SDRAMC_H
17#define AT91SAM9_SDRAMC_H
18
19/* SDRAM Controller (SDRAMC) registers */
20#define AT91_SDRAMC_MR 0x00 /* SDRAM Controller Mode Register */
21#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */
22#define AT91_SDRAMC_MODE_NORMAL 0
23#define AT91_SDRAMC_MODE_NOP 1
24#define AT91_SDRAMC_MODE_PRECHARGE 2
25#define AT91_SDRAMC_MODE_LMR 3
26#define AT91_SDRAMC_MODE_REFRESH 4
27#define AT91_SDRAMC_MODE_EXT_LMR 5
28#define AT91_SDRAMC_MODE_DEEP 6
29
30#define AT91_SDRAMC_TR 0x04 /* SDRAM Controller Refresh Timer Register */
31#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Counter */
32
33#define AT91_SDRAMC_CR 0x08 /* SDRAM Controller Configuration Register */
34#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */
35#define AT91_SDRAMC_NC_8 (0 << 0)
36#define AT91_SDRAMC_NC_9 (1 << 0)
37#define AT91_SDRAMC_NC_10 (2 << 0)
38#define AT91_SDRAMC_NC_11 (3 << 0)
39#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */
40#define AT91_SDRAMC_NR_11 (0 << 2)
41#define AT91_SDRAMC_NR_12 (1 << 2)
42#define AT91_SDRAMC_NR_13 (2 << 2)
43#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */
44#define AT91_SDRAMC_NB_2 (0 << 4)
45#define AT91_SDRAMC_NB_4 (1 << 4)
46#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */
47#define AT91_SDRAMC_CAS_1 (1 << 5)
48#define AT91_SDRAMC_CAS_2 (2 << 5)
49#define AT91_SDRAMC_CAS_3 (3 << 5)
50#define AT91_SDRAMC_DBW (1 << 7) /* Data Bus Width */
51#define AT91_SDRAMC_DBW_32 (0 << 7)
52#define AT91_SDRAMC_DBW_16 (1 << 7)
53#define AT91_SDRAMC_TWR (0xf << 8) /* Write Recovery Delay */
54#define AT91_SDRAMC_TRC (0xf << 12) /* Row Cycle Delay */
55#define AT91_SDRAMC_TRP (0xf << 16) /* Row Precharge Delay */
56#define AT91_SDRAMC_TRCD (0xf << 20) /* Row to Column Delay */
57#define AT91_SDRAMC_TRAS (0xf << 24) /* Active to Precharge Delay */
58#define AT91_SDRAMC_TXSR (0xf << 28) /* Exit Self Refresh to Active Delay */
59
60#define AT91_SDRAMC_LPR 0x10 /* SDRAM Controller Low Power Register */
61#define AT91_SDRAMC_LPCB (3 << 0) /* Low-power Configurations */
62#define AT91_SDRAMC_LPCB_DISABLE 0
63#define AT91_SDRAMC_LPCB_SELF_REFRESH 1
64#define AT91_SDRAMC_LPCB_POWER_DOWN 2
65#define AT91_SDRAMC_LPCB_DEEP_POWER_DOWN 3
66#define AT91_SDRAMC_PASR (7 << 4) /* Partial Array Self Refresh */
67#define AT91_SDRAMC_TCSR (3 << 8) /* Temperature Compensated Self Refresh */
68#define AT91_SDRAMC_DS (3 << 10) /* Drive Strength */
69#define AT91_SDRAMC_TIMEOUT (3 << 12) /* Time to define when Low Power Mode is enabled */
70#define AT91_SDRAMC_TIMEOUT_0_CLK_CYCLES (0 << 12)
71#define AT91_SDRAMC_TIMEOUT_64_CLK_CYCLES (1 << 12)
72#define AT91_SDRAMC_TIMEOUT_128_CLK_CYCLES (2 << 12)
73
74#define AT91_SDRAMC_IER 0x14 /* SDRAM Controller Interrupt Enable Register */
75#define AT91_SDRAMC_IDR 0x18 /* SDRAM Controller Interrupt Disable Register */
76#define AT91_SDRAMC_IMR 0x1C /* SDRAM Controller Interrupt Mask Register */
77#define AT91_SDRAMC_ISR 0x20 /* SDRAM Controller Interrupt Status Register */
78#define AT91_SDRAMC_RES (1 << 0) /* Refresh Error Status */
79
80#define AT91_SDRAMC_MDR 0x24 /* SDRAM Memory Device Register */
81#define AT91_SDRAMC_MD (3 << 0) /* Memory Device Type */
82#define AT91_SDRAMC_MD_SDRAM 0
83#define AT91_SDRAMC_MD_LOW_POWER_SDRAM 1
84
85#endif
diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h
new file mode 100644
index 000000000000..63deb8d9f82a
--- /dev/null
+++ b/include/soc/tegra/mc.h
@@ -0,0 +1,107 @@
1/*
2 * Copyright (C) 2014 NVIDIA Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __SOC_TEGRA_MC_H__
10#define __SOC_TEGRA_MC_H__
11
12#include <linux/types.h>
13
14struct clk;
15struct device;
16struct page;
17
18struct tegra_smmu_enable {
19 unsigned int reg;
20 unsigned int bit;
21};
22
23/* latency allowance */
24struct tegra_mc_la {
25 unsigned int reg;
26 unsigned int shift;
27 unsigned int mask;
28 unsigned int def;
29};
30
31struct tegra_mc_client {
32 unsigned int id;
33 const char *name;
34 unsigned int swgroup;
35
36 unsigned int fifo_size;
37
38 struct tegra_smmu_enable smmu;
39 struct tegra_mc_la la;
40};
41
42struct tegra_smmu_swgroup {
43 unsigned int swgroup;
44 unsigned int reg;
45};
46
47struct tegra_smmu_ops {
48 void (*flush_dcache)(struct page *page, unsigned long offset,
49 size_t size);
50};
51
52struct tegra_smmu_soc {
53 const struct tegra_mc_client *clients;
54 unsigned int num_clients;
55
56 const struct tegra_smmu_swgroup *swgroups;
57 unsigned int num_swgroups;
58
59 bool supports_round_robin_arbitration;
60 bool supports_request_limit;
61
62 unsigned int num_asids;
63
64 const struct tegra_smmu_ops *ops;
65};
66
67struct tegra_mc;
68struct tegra_smmu;
69
70#ifdef CONFIG_TEGRA_IOMMU_SMMU
71struct tegra_smmu *tegra_smmu_probe(struct device *dev,
72 const struct tegra_smmu_soc *soc,
73 struct tegra_mc *mc);
74#else
75static inline struct tegra_smmu *
76tegra_smmu_probe(struct device *dev, const struct tegra_smmu_soc *soc,
77 struct tegra_mc *mc)
78{
79 return NULL;
80}
81#endif
82
83struct tegra_mc_soc {
84 const struct tegra_mc_client *clients;
85 unsigned int num_clients;
86
87 const unsigned int *emem_regs;
88 unsigned int num_emem_regs;
89
90 unsigned int num_address_bits;
91 unsigned int atom_size;
92
93 const struct tegra_smmu_soc *smmu;
94};
95
96struct tegra_mc {
97 struct device *dev;
98 struct tegra_smmu *smmu;
99 void __iomem *regs;
100 struct clk *clk;
101 int irq;
102
103 const struct tegra_mc_soc *soc;
104 unsigned long tick;
105};
106
107#endif /* __SOC_TEGRA_MC_H__ */
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index ae6c3b8ed2f5..396e8f73670a 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -42,12 +42,11 @@ struct snd_compr_ops;
42 * @buffer_size: size of the above buffer 42 * @buffer_size: size of the above buffer
43 * @fragment_size: size of buffer fragment in bytes 43 * @fragment_size: size of buffer fragment in bytes
44 * @fragments: number of such fragments 44 * @fragments: number of such fragments
45 * @hw_pointer: offset of last location in buffer where DSP copied data
46 * @app_pointer: offset of last location in buffer where app wrote data
47 * @total_bytes_available: cumulative number of bytes made available in 45 * @total_bytes_available: cumulative number of bytes made available in
48 * the ring buffer 46 * the ring buffer
49 * @total_bytes_transferred: cumulative bytes transferred by offload DSP 47 * @total_bytes_transferred: cumulative bytes transferred by offload DSP
50 * @sleep: poll sleep 48 * @sleep: poll sleep
49 * @private_data: driver private data pointer
51 */ 50 */
52struct snd_compr_runtime { 51struct snd_compr_runtime {
53 snd_pcm_state_t state; 52 snd_pcm_state_t state;
@@ -94,6 +93,8 @@ struct snd_compr_stream {
94 * This can be called in during stream creation only to set codec params 93 * This can be called in during stream creation only to set codec params
95 * and the stream properties 94 * and the stream properties
96 * @get_params: retrieve the codec parameters, mandatory 95 * @get_params: retrieve the codec parameters, mandatory
96 * @set_metadata: Set the metadata values for a stream
97 * @get_metadata: retreives the requested metadata values from stream
97 * @trigger: Trigger operations like start, pause, resume, drain, stop. 98 * @trigger: Trigger operations like start, pause, resume, drain, stop.
98 * This callback is mandatory 99 * This callback is mandatory
99 * @pointer: Retrieve current h/w pointer information. Mandatory 100 * @pointer: Retrieve current h/w pointer information. Mandatory
diff --git a/include/sound/jack.h b/include/sound/jack.h
index 58916573db58..218235030ebc 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -28,8 +28,23 @@
28struct input_dev; 28struct input_dev;
29 29
30/** 30/**
31 * Jack types which can be reported. These values are used as a 31 * enum snd_jack_types - Jack types which can be reported
32 * bitmask. 32 * @SND_JACK_HEADPHONE: Headphone
33 * @SND_JACK_MICROPHONE: Microphone
34 * @SND_JACK_HEADSET: Headset
35 * @SND_JACK_LINEOUT: Line out
36 * @SND_JACK_MECHANICAL: Mechanical switch
37 * @SND_JACK_VIDEOOUT: Video out
38 * @SND_JACK_AVOUT: AV (Audio Video) out
39 * @SND_JACK_LINEIN: Line in
40 * @SND_JACK_BTN_0: Button 0
41 * @SND_JACK_BTN_1: Button 1
42 * @SND_JACK_BTN_2: Button 2
43 * @SND_JACK_BTN_3: Button 3
44 * @SND_JACK_BTN_4: Button 4
45 * @SND_JACK_BTN_5: Button 5
46 *
47 * These values are used as a bitmask.
33 * 48 *
34 * Note that this must be kept in sync with the lookup table in 49 * Note that this must be kept in sync with the lookup table in
35 * sound/core/jack.c. 50 * sound/core/jack.c.
@@ -90,6 +105,13 @@ static inline void snd_jack_set_parent(struct snd_jack *jack,
90{ 105{
91} 106}
92 107
108static inline int snd_jack_set_key(struct snd_jack *jack,
109 enum snd_jack_types type,
110 int keytype)
111{
112 return 0;
113}
114
93static inline void snd_jack_report(struct snd_jack *jack, int status) 115static inline void snd_jack_report(struct snd_jack *jack, int status)
94{ 116{
95} 117}
diff --git a/include/sound/omap-hdmi-audio.h b/include/sound/omap-hdmi-audio.h
new file mode 100644
index 000000000000..afdb416898e0
--- /dev/null
+++ b/include/sound/omap-hdmi-audio.h
@@ -0,0 +1,43 @@
1/*
2 * hdmi-audio.c -- OMAP4+ DSS HDMI audio support library
3 *
4 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Author: Jyri Sarha <jsarha@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 */
18
19#include <video/omapdss.h>
20
21#ifndef __OMAP_HDMI_AUDIO_H__
22#define __OMAP_HDMI_AUDIO_H__
23
24struct omap_hdmi_audio_ops {
25 int (*audio_startup)(struct device *dev,
26 void (*abort_cb)(struct device *dev));
27 int (*audio_shutdown)(struct device *dev);
28 int (*audio_start)(struct device *dev);
29 void (*audio_stop)(struct device *dev);
30 int (*audio_config)(struct device *dev,
31 struct omap_dss_audio *dss_audio);
32};
33
34/* HDMI audio initalization data */
35struct omap_hdmi_audio_pdata {
36 struct device *dev;
37 enum omapdss_version dss_version;
38 phys_addr_t audio_dma_addr;
39
40 const struct omap_hdmi_audio_ops *ops;
41};
42
43#endif /* __OMAP_HDMI_AUDIO_H__ */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index e862497f7556..1e7f74acc2ec 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -184,6 +184,8 @@ struct snd_pcm_ops {
184#define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8) 184#define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8)
185#define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE) 185#define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE)
186#define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE) 186#define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE)
187#define SNDRV_PCM_FMTBIT_DSD_U16_BE _SNDRV_PCM_FMTBIT(DSD_U16_BE)
188#define SNDRV_PCM_FMTBIT_DSD_U32_BE _SNDRV_PCM_FMTBIT(DSD_U32_BE)
187 189
188#ifdef SNDRV_LITTLE_ENDIAN 190#ifdef SNDRV_LITTLE_ENDIAN
189#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE 191#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE
@@ -416,7 +418,10 @@ struct snd_pcm_substream {
416 struct snd_info_entry *proc_status_entry; 418 struct snd_info_entry *proc_status_entry;
417 struct snd_info_entry *proc_prealloc_entry; 419 struct snd_info_entry *proc_prealloc_entry;
418 struct snd_info_entry *proc_prealloc_max_entry; 420 struct snd_info_entry *proc_prealloc_max_entry;
421#ifdef CONFIG_SND_PCM_XRUN_DEBUG
422 struct snd_info_entry *proc_xrun_injection_entry;
419#endif 423#endif
424#endif /* CONFIG_SND_VERBOSE_PROCFS */
420 /* misc flags */ 425 /* misc flags */
421 unsigned int hw_opened: 1; 426 unsigned int hw_opened: 1;
422}; 427};
@@ -503,6 +508,7 @@ int snd_pcm_status(struct snd_pcm_substream *substream,
503int snd_pcm_start(struct snd_pcm_substream *substream); 508int snd_pcm_start(struct snd_pcm_substream *substream);
504int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t status); 509int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t status);
505int snd_pcm_drain_done(struct snd_pcm_substream *substream); 510int snd_pcm_drain_done(struct snd_pcm_substream *substream);
511int snd_pcm_stop_xrun(struct snd_pcm_substream *substream);
506#ifdef CONFIG_PM 512#ifdef CONFIG_PM
507int snd_pcm_suspend(struct snd_pcm_substream *substream); 513int snd_pcm_suspend(struct snd_pcm_substream *substream);
508int snd_pcm_suspend_all(struct snd_pcm *pcm); 514int snd_pcm_suspend_all(struct snd_pcm *pcm);
@@ -533,6 +539,12 @@ snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size)
533 * PCM library 539 * PCM library
534 */ 540 */
535 541
542/**
543 * snd_pcm_stream_linked - Check whether the substream is linked with others
544 * @substream: substream to check
545 *
546 * Returns true if the given substream is being linked with others.
547 */
536static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream) 548static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream)
537{ 549{
538 return substream->group != &substream->self_group; 550 return substream->group != &substream->self_group;
@@ -543,6 +555,16 @@ void snd_pcm_stream_unlock(struct snd_pcm_substream *substream);
543void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream); 555void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream);
544void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream); 556void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream);
545unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream); 557unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
558
559/**
560 * snd_pcm_stream_lock_irqsave - Lock the PCM stream
561 * @substream: PCM substream
562 * @flags: irq flags
563 *
564 * This locks the PCM stream like snd_pcm_stream_lock() but with the local
565 * IRQ (only when nonatomic is false). In nonatomic case, this is identical
566 * as snd_pcm_stream_lock().
567 */
546#define snd_pcm_stream_lock_irqsave(substream, flags) \ 568#define snd_pcm_stream_lock_irqsave(substream, flags) \
547 do { \ 569 do { \
548 typecheck(unsigned long, flags); \ 570 typecheck(unsigned long, flags); \
@@ -551,9 +573,25 @@ unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
551void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, 573void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream,
552 unsigned long flags); 574 unsigned long flags);
553 575
576/**
577 * snd_pcm_group_for_each_entry - iterate over the linked substreams
578 * @s: the iterator
579 * @substream: the substream
580 *
581 * Iterate over the all linked substreams to the given @substream.
582 * When @substream isn't linked with any others, this gives returns @substream
583 * itself once.
584 */
554#define snd_pcm_group_for_each_entry(s, substream) \ 585#define snd_pcm_group_for_each_entry(s, substream) \
555 list_for_each_entry(s, &substream->group->substreams, link_list) 586 list_for_each_entry(s, &substream->group->substreams, link_list)
556 587
588/**
589 * snd_pcm_running - Check whether the substream is in a running state
590 * @substream: substream to check
591 *
592 * Returns true if the given substream is in the state RUNNING, or in the
593 * state DRAINING for playback.
594 */
557static inline int snd_pcm_running(struct snd_pcm_substream *substream) 595static inline int snd_pcm_running(struct snd_pcm_substream *substream)
558{ 596{
559 return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING || 597 return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING ||
@@ -561,45 +599,81 @@ static inline int snd_pcm_running(struct snd_pcm_substream *substream)
561 substream->stream == SNDRV_PCM_STREAM_PLAYBACK)); 599 substream->stream == SNDRV_PCM_STREAM_PLAYBACK));
562} 600}
563 601
602/**
603 * bytes_to_samples - Unit conversion of the size from bytes to samples
604 * @runtime: PCM runtime instance
605 * @size: size in bytes
606 */
564static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size) 607static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size)
565{ 608{
566 return size * 8 / runtime->sample_bits; 609 return size * 8 / runtime->sample_bits;
567} 610}
568 611
612/**
613 * bytes_to_frames - Unit conversion of the size from bytes to frames
614 * @runtime: PCM runtime instance
615 * @size: size in bytes
616 */
569static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size) 617static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size)
570{ 618{
571 return size * 8 / runtime->frame_bits; 619 return size * 8 / runtime->frame_bits;
572} 620}
573 621
622/**
623 * samples_to_bytes - Unit conversion of the size from samples to bytes
624 * @runtime: PCM runtime instance
625 * @size: size in samples
626 */
574static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size) 627static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size)
575{ 628{
576 return size * runtime->sample_bits / 8; 629 return size * runtime->sample_bits / 8;
577} 630}
578 631
632/**
633 * frames_to_bytes - Unit conversion of the size from frames to bytes
634 * @runtime: PCM runtime instance
635 * @size: size in frames
636 */
579static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size) 637static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size)
580{ 638{
581 return size * runtime->frame_bits / 8; 639 return size * runtime->frame_bits / 8;
582} 640}
583 641
642/**
643 * frame_aligned - Check whether the byte size is aligned to frames
644 * @runtime: PCM runtime instance
645 * @bytes: size in bytes
646 */
584static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes) 647static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes)
585{ 648{
586 return bytes % runtime->byte_align == 0; 649 return bytes % runtime->byte_align == 0;
587} 650}
588 651
652/**
653 * snd_pcm_lib_buffer_bytes - Get the buffer size of the current PCM in bytes
654 * @substream: PCM substream
655 */
589static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream) 656static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream)
590{ 657{
591 struct snd_pcm_runtime *runtime = substream->runtime; 658 struct snd_pcm_runtime *runtime = substream->runtime;
592 return frames_to_bytes(runtime, runtime->buffer_size); 659 return frames_to_bytes(runtime, runtime->buffer_size);
593} 660}
594 661
662/**
663 * snd_pcm_lib_period_bytes - Get the period size of the current PCM in bytes
664 * @substream: PCM substream
665 */
595static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream) 666static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream)
596{ 667{
597 struct snd_pcm_runtime *runtime = substream->runtime; 668 struct snd_pcm_runtime *runtime = substream->runtime;
598 return frames_to_bytes(runtime, runtime->period_size); 669 return frames_to_bytes(runtime, runtime->period_size);
599} 670}
600 671
601/* 672/**
602 * result is: 0 ... (boundary - 1) 673 * snd_pcm_playback_avail - Get the available (writable) space for playback
674 * @runtime: PCM runtime instance
675 *
676 * Result is between 0 ... (boundary - 1)
603 */ 677 */
604static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime) 678static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime)
605{ 679{
@@ -611,8 +685,11 @@ static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *r
611 return avail; 685 return avail;
612} 686}
613 687
614/* 688/**
615 * result is: 0 ... (boundary - 1) 689 * snd_pcm_playback_avail - Get the available (readable) space for capture
690 * @runtime: PCM runtime instance
691 *
692 * Result is between 0 ... (boundary - 1)
616 */ 693 */
617static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime) 694static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime)
618{ 695{
@@ -622,11 +699,19 @@ static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *ru
622 return avail; 699 return avail;
623} 700}
624 701
702/**
703 * snd_pcm_playback_hw_avail - Get the queued space for playback
704 * @runtime: PCM runtime instance
705 */
625static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime) 706static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime)
626{ 707{
627 return runtime->buffer_size - snd_pcm_playback_avail(runtime); 708 return runtime->buffer_size - snd_pcm_playback_avail(runtime);
628} 709}
629 710
711/**
712 * snd_pcm_capture_hw_avail - Get the free space for capture
713 * @runtime: PCM runtime instance
714 */
630static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime) 715static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime)
631{ 716{
632 return runtime->buffer_size - snd_pcm_capture_avail(runtime); 717 return runtime->buffer_size - snd_pcm_capture_avail(runtime);
@@ -706,6 +791,20 @@ static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream)
706 return snd_pcm_capture_avail(runtime) == 0; 791 return snd_pcm_capture_avail(runtime) == 0;
707} 792}
708 793
794/**
795 * snd_pcm_trigger_done - Mark the master substream
796 * @substream: the pcm substream instance
797 * @master: the linked master substream
798 *
799 * When multiple substreams of the same card are linked and the hardware
800 * supports the single-shot operation, the driver calls this in the loop
801 * in snd_pcm_group_for_each_entry() for marking the substream as "done".
802 * Then most of trigger operations are performed only to the given master
803 * substream.
804 *
805 * The trigger_master mark is cleared at timestamp updates at the end
806 * of trigger operations.
807 */
709static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream, 808static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream,
710 struct snd_pcm_substream *master) 809 struct snd_pcm_substream *master)
711{ 810{
@@ -748,18 +847,59 @@ static inline const struct snd_interval *hw_param_interval_c(const struct snd_pc
748 return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; 847 return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
749} 848}
750 849
751#define params_channels(p) \ 850/**
752 (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_CHANNELS)->min) 851 * params_channels - Get the number of channels from the hw params
753#define params_rate(p) \ 852 * @p: hw params
754 (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_RATE)->min) 853 */
755#define params_period_size(p) \ 854static inline unsigned int params_channels(const struct snd_pcm_hw_params *p)
756 (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min) 855{
757#define params_periods(p) \ 856 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_CHANNELS)->min;
758 (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_PERIODS)->min) 857}
759#define params_buffer_size(p) \ 858
760 (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min) 859/**
761#define params_buffer_bytes(p) \ 860 * params_channels - Get the sample rate from the hw params
762 (hw_param_interval_c((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min) 861 * @p: hw params
862 */
863static inline unsigned int params_rate(const struct snd_pcm_hw_params *p)
864{
865 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_RATE)->min;
866}
867
868/**
869 * params_channels - Get the period size (in frames) from the hw params
870 * @p: hw params
871 */
872static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p)
873{
874 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min;
875}
876
877/**
878 * params_channels - Get the number of periods from the hw params
879 * @p: hw params
880 */
881static inline unsigned int params_periods(const struct snd_pcm_hw_params *p)
882{
883 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIODS)->min;
884}
885
886/**
887 * params_channels - Get the buffer size (in frames) from the hw params
888 * @p: hw params
889 */
890static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p)
891{
892 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min;
893}
894
895/**
896 * params_channels - Get the buffer size (in bytes) from the hw params
897 * @p: hw params
898 */
899static inline unsigned int params_buffer_bytes(const struct snd_pcm_hw_params *p)
900{
901 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min;
902}
763 903
764int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v); 904int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v);
765void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c); 905void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
@@ -881,6 +1021,14 @@ unsigned int snd_pcm_rate_bit_to_rate(unsigned int rate_bit);
881unsigned int snd_pcm_rate_mask_intersect(unsigned int rates_a, 1021unsigned int snd_pcm_rate_mask_intersect(unsigned int rates_a,
882 unsigned int rates_b); 1022 unsigned int rates_b);
883 1023
1024/**
1025 * snd_pcm_set_runtime_buffer - Set the PCM runtime buffer
1026 * @substream: PCM substream to set
1027 * @bufp: the buffer information, NULL to clear
1028 *
1029 * Copy the buffer information to runtime->dma_buffer when @bufp is non-NULL.
1030 * Otherwise it clears the current buffer information.
1031 */
884static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream, 1032static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream,
885 struct snd_dma_buffer *bufp) 1033 struct snd_dma_buffer *bufp)
886{ 1034{
@@ -906,6 +1054,11 @@ void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);
906void snd_pcm_timer_init(struct snd_pcm_substream *substream); 1054void snd_pcm_timer_init(struct snd_pcm_substream *substream);
907void snd_pcm_timer_done(struct snd_pcm_substream *substream); 1055void snd_pcm_timer_done(struct snd_pcm_substream *substream);
908 1056
1057/**
1058 * snd_pcm_gettime - Fill the timespec depending on the timestamp mode
1059 * @runtime: PCM runtime instance
1060 * @tv: timespec to fill
1061 */
909static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime, 1062static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime,
910 struct timespec *tv) 1063 struct timespec *tv)
911{ 1064{
@@ -942,7 +1095,6 @@ int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream,
942int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream); 1095int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream);
943struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream, 1096struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream,
944 unsigned long offset); 1097 unsigned long offset);
945#if 0 /* for kernel-doc */
946/** 1098/**
947 * snd_pcm_lib_alloc_vmalloc_buffer - allocate virtual DMA buffer 1099 * snd_pcm_lib_alloc_vmalloc_buffer - allocate virtual DMA buffer
948 * @substream: the substream to allocate the buffer to 1100 * @substream: the substream to allocate the buffer to
@@ -955,8 +1107,13 @@ struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream,
955 * Return: 1 if the buffer was changed, 0 if not changed, or a negative error 1107 * Return: 1 if the buffer was changed, 0 if not changed, or a negative error
956 * code. 1108 * code.
957 */ 1109 */
958static int snd_pcm_lib_alloc_vmalloc_buffer 1110static inline int snd_pcm_lib_alloc_vmalloc_buffer
959 (struct snd_pcm_substream *substream, size_t size); 1111 (struct snd_pcm_substream *substream, size_t size)
1112{
1113 return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size,
1114 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO);
1115}
1116
960/** 1117/**
961 * snd_pcm_lib_alloc_vmalloc_32_buffer - allocate 32-bit-addressable buffer 1118 * snd_pcm_lib_alloc_vmalloc_32_buffer - allocate 32-bit-addressable buffer
962 * @substream: the substream to allocate the buffer to 1119 * @substream: the substream to allocate the buffer to
@@ -968,15 +1125,12 @@ static int snd_pcm_lib_alloc_vmalloc_buffer
968 * Return: 1 if the buffer was changed, 0 if not changed, or a negative error 1125 * Return: 1 if the buffer was changed, 0 if not changed, or a negative error
969 * code. 1126 * code.
970 */ 1127 */
971static int snd_pcm_lib_alloc_vmalloc_32_buffer 1128static inline int snd_pcm_lib_alloc_vmalloc_32_buffer
972 (struct snd_pcm_substream *substream, size_t size); 1129 (struct snd_pcm_substream *substream, size_t size)
973#endif 1130{
974#define snd_pcm_lib_alloc_vmalloc_buffer(subs, size) \ 1131 return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size,
975 _snd_pcm_lib_alloc_vmalloc_buffer \ 1132 GFP_KERNEL | GFP_DMA32 | __GFP_ZERO);
976 (subs, size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO) 1133}
977#define snd_pcm_lib_alloc_vmalloc_32_buffer(subs, size) \
978 _snd_pcm_lib_alloc_vmalloc_buffer \
979 (subs, size, GFP_KERNEL | GFP_DMA32 | __GFP_ZERO)
980 1134
981#define snd_pcm_get_dma_buf(substream) ((substream)->runtime->dma_buffer_p) 1135#define snd_pcm_get_dma_buf(substream) ((substream)->runtime->dma_buffer_p)
982 1136
@@ -996,18 +1150,35 @@ struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream,
996#define snd_pcm_sgbuf_ops_page NULL 1150#define snd_pcm_sgbuf_ops_page NULL
997#endif /* SND_DMA_SGBUF */ 1151#endif /* SND_DMA_SGBUF */
998 1152
1153/**
1154 * snd_pcm_sgbuf_get_addr - Get the DMA address at the corresponding offset
1155 * @substream: PCM substream
1156 * @ofs: byte offset
1157 */
999static inline dma_addr_t 1158static inline dma_addr_t
1000snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs) 1159snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs)
1001{ 1160{
1002 return snd_sgbuf_get_addr(snd_pcm_get_dma_buf(substream), ofs); 1161 return snd_sgbuf_get_addr(snd_pcm_get_dma_buf(substream), ofs);
1003} 1162}
1004 1163
1164/**
1165 * snd_pcm_sgbuf_get_ptr - Get the virtual address at the corresponding offset
1166 * @substream: PCM substream
1167 * @ofs: byte offset
1168 */
1005static inline void * 1169static inline void *
1006snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) 1170snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs)
1007{ 1171{
1008 return snd_sgbuf_get_ptr(snd_pcm_get_dma_buf(substream), ofs); 1172 return snd_sgbuf_get_ptr(snd_pcm_get_dma_buf(substream), ofs);
1009} 1173}
1010 1174
1175/**
1176 * snd_pcm_sgbuf_chunk_size - Compute the max size that fits within the contig.
1177 * page from the given size
1178 * @substream: PCM substream
1179 * @ofs: byte offset
1180 * @size: byte size to examine
1181 */
1011static inline unsigned int 1182static inline unsigned int
1012snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, 1183snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream,
1013 unsigned int ofs, unsigned int size) 1184 unsigned int ofs, unsigned int size)
@@ -1015,13 +1186,24 @@ snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream,
1015 return snd_sgbuf_get_chunk_size(snd_pcm_get_dma_buf(substream), ofs, size); 1186 return snd_sgbuf_get_chunk_size(snd_pcm_get_dma_buf(substream), ofs, size);
1016} 1187}
1017 1188
1018/* handle mmap counter - PCM mmap callback should handle this counter properly */ 1189/**
1190 * snd_pcm_mmap_data_open - increase the mmap counter
1191 * @area: VMA
1192 *
1193 * PCM mmap callback should handle this counter properly
1194 */
1019static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) 1195static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
1020{ 1196{
1021 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data; 1197 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
1022 atomic_inc(&substream->mmap_count); 1198 atomic_inc(&substream->mmap_count);
1023} 1199}
1024 1200
1201/**
1202 * snd_pcm_mmap_data_close - decrease the mmap counter
1203 * @area: VMA
1204 *
1205 * PCM mmap callback should handle this counter properly
1206 */
1025static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area) 1207static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area)
1026{ 1208{
1027 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data; 1209 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
@@ -1041,6 +1223,11 @@ int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_s
1041 1223
1042#define snd_pcm_lib_mmap_vmalloc NULL 1224#define snd_pcm_lib_mmap_vmalloc NULL
1043 1225
1226/**
1227 * snd_pcm_limit_isa_dma_size - Get the max size fitting with ISA DMA transfer
1228 * @dma: DMA number
1229 * @max: pointer to store the max size
1230 */
1044static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) 1231static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
1045{ 1232{
1046 *max = dma < 4 ? 64 * 1024 : 128 * 1024; 1233 *max = dma < 4 ? 64 * 1024 : 128 * 1024;
@@ -1093,7 +1280,11 @@ struct snd_pcm_chmap {
1093 void *private_data; /* optional: private data pointer */ 1280 void *private_data; /* optional: private data pointer */
1094}; 1281};
1095 1282
1096/* get the PCM substream assigned to the given chmap info */ 1283/**
1284 * snd_pcm_chmap_substream - get the PCM substream assigned to the given chmap info
1285 * @info: chmap information
1286 * @idx: the substream number index
1287 */
1097static inline struct snd_pcm_substream * 1288static inline struct snd_pcm_substream *
1098snd_pcm_chmap_substream(struct snd_pcm_chmap *info, unsigned int idx) 1289snd_pcm_chmap_substream(struct snd_pcm_chmap *info, unsigned int idx)
1099{ 1290{
@@ -1120,7 +1311,10 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream,
1120 unsigned long private_value, 1311 unsigned long private_value,
1121 struct snd_pcm_chmap **info_ret); 1312 struct snd_pcm_chmap **info_ret);
1122 1313
1123/* Strong-typed conversion of pcm_format to bitwise */ 1314/**
1315 * pcm_format_to_bits - Strong-typed conversion of pcm_format to bitwise
1316 * @pcm_format: PCM format
1317 */
1124static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format) 1318static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format)
1125{ 1319{
1126 return 1ULL << (__force int) pcm_format; 1320 return 1ULL << (__force int) pcm_format;
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index d76412b84b48..83284cae464c 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -36,14 +36,14 @@
36#define RSND_SSI_CLK_PIN_SHARE (1 << 31) 36#define RSND_SSI_CLK_PIN_SHARE (1 << 31)
37#define RSND_SSI_NO_BUSIF (1 << 30) /* SSI+DMA without BUSIF */ 37#define RSND_SSI_NO_BUSIF (1 << 30) /* SSI+DMA without BUSIF */
38 38
39#define RSND_SSI(_dma_id, _pio_irq, _flags) \ 39#define RSND_SSI(_dma_id, _irq, _flags) \
40{ .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags } 40{ .dma_id = _dma_id, .irq = _irq, .flags = _flags }
41#define RSND_SSI_UNUSED \ 41#define RSND_SSI_UNUSED \
42{ .dma_id = -1, .pio_irq = -1, .flags = 0 } 42{ .dma_id = -1, .irq = -1, .flags = 0 }
43 43
44struct rsnd_ssi_platform_info { 44struct rsnd_ssi_platform_info {
45 int dma_id; 45 int dma_id;
46 int pio_irq; 46 int irq;
47 u32 flags; 47 u32 flags;
48}; 48};
49 49
diff --git a/include/sound/rt5645.h b/include/sound/rt5645.h
index a5352712194b..120d9610054e 100644
--- a/include/sound/rt5645.h
+++ b/include/sound/rt5645.h
@@ -23,6 +23,10 @@ struct rt5645_platform_data {
23 23
24 unsigned int hp_det_gpio; 24 unsigned int hp_det_gpio;
25 bool gpio_hp_det_active_high; 25 bool gpio_hp_det_active_high;
26
27 /* true if codec's jd function is used */
28 bool en_jd_func;
29 unsigned int jd_mode;
26}; 30};
27 31
28#endif 32#endif
diff --git a/include/sound/rt5677.h b/include/sound/rt5677.h
index 082670e3a353..d9eb7d861cd0 100644
--- a/include/sound/rt5677.h
+++ b/include/sound/rt5677.h
@@ -27,6 +27,16 @@ struct rt5677_platform_data {
27 bool lout3_diff; 27 bool lout3_diff;
28 /* DMIC2 clock source selection */ 28 /* DMIC2 clock source selection */
29 enum rt5677_dmic2_clk dmic2_clk_pin; 29 enum rt5677_dmic2_clk dmic2_clk_pin;
30
31 /* configures GPIO, 0 - floating, 1 - pulldown, 2 - pullup */
32 u8 gpio_config[6];
33
34 /* jd1 can select 0 ~ 3 as OFF, GPIO1, GPIO2 and GPIO3 respectively */
35 unsigned int jd1_gpio;
36 /* jd2 and jd3 can select 0 ~ 3 as
37 OFF, GPIO4, GPIO5 and GPIO6 respectively */
38 unsigned int jd2_gpio;
39 unsigned int jd3_gpio;
30}; 40};
31 41
32#endif 42#endif
diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h
index 2398521f0998..eea5400fe373 100644
--- a/include/sound/seq_kernel.h
+++ b/include/sound/seq_kernel.h
@@ -108,9 +108,13 @@ int snd_seq_event_port_detach(int client, int port);
108#ifdef CONFIG_MODULES 108#ifdef CONFIG_MODULES
109void snd_seq_autoload_lock(void); 109void snd_seq_autoload_lock(void);
110void snd_seq_autoload_unlock(void); 110void snd_seq_autoload_unlock(void);
111void snd_seq_autoload_init(void);
112#define snd_seq_autoload_exit() snd_seq_autoload_lock()
111#else 113#else
112#define snd_seq_autoload_lock() 114#define snd_seq_autoload_lock()
113#define snd_seq_autoload_unlock() 115#define snd_seq_autoload_unlock()
116#define snd_seq_autoload_init()
117#define snd_seq_autoload_exit()
114#endif 118#endif
115 119
116#endif /* __SOUND_SEQ_KERNEL_H */ 120#endif /* __SOUND_SEQ_KERNEL_H */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index e8b3080d196a..2df96b1384c7 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -206,7 +206,6 @@ struct snd_soc_dai_driver {
206 /* DAI description */ 206 /* DAI description */
207 const char *name; 207 const char *name;
208 unsigned int id; 208 unsigned int id;
209 int ac97_control;
210 unsigned int base; 209 unsigned int base;
211 210
212 /* DAI driver callbacks */ 211 /* DAI driver callbacks */
@@ -216,6 +215,8 @@ struct snd_soc_dai_driver {
216 int (*resume)(struct snd_soc_dai *dai); 215 int (*resume)(struct snd_soc_dai *dai);
217 /* compress dai */ 216 /* compress dai */
218 bool compress_dai; 217 bool compress_dai;
218 /* DAI is also used for the control bus */
219 bool bus_control;
219 220
220 /* ops */ 221 /* ops */
221 const struct snd_soc_dai_ops *ops; 222 const struct snd_soc_dai_ops *ops;
@@ -241,7 +242,6 @@ struct snd_soc_dai {
241 const char *name; 242 const char *name;
242 int id; 243 int id;
243 struct device *dev; 244 struct device *dev;
244 void *ac97_pdata; /* platform_data for the ac97 codec */
245 245
246 /* driver ops */ 246 /* driver ops */
247 struct snd_soc_dai_driver *driver; 247 struct snd_soc_dai_driver *driver;
@@ -268,7 +268,6 @@ struct snd_soc_dai {
268 unsigned int sample_bits; 268 unsigned int sample_bits;
269 269
270 /* parent platform/codec */ 270 /* parent platform/codec */
271 struct snd_soc_platform *platform;
272 struct snd_soc_codec *codec; 271 struct snd_soc_codec *codec;
273 struct snd_soc_component *component; 272 struct snd_soc_component *component;
274 273
@@ -276,8 +275,6 @@ struct snd_soc_dai {
276 unsigned int tx_mask; 275 unsigned int tx_mask;
277 unsigned int rx_mask; 276 unsigned int rx_mask;
278 277
279 struct snd_soc_card *card;
280
281 struct list_head list; 278 struct list_head list;
282}; 279};
283 280
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 3a4d7da67b8d..89823cfe6f04 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -435,7 +435,7 @@ void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card);
435unsigned int dapm_kcontrol_get_value(const struct snd_kcontrol *kcontrol); 435unsigned int dapm_kcontrol_get_value(const struct snd_kcontrol *kcontrol);
436 436
437/* Mostly internal - should not normally be used */ 437/* Mostly internal - should not normally be used */
438void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm); 438void dapm_mark_endpoints_dirty(struct snd_soc_card *card);
439 439
440/* dapm path query */ 440/* dapm path query */
441int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, 441int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
@@ -508,9 +508,9 @@ struct snd_soc_dapm_path {
508 508
509 /* status */ 509 /* status */
510 u32 connect:1; /* source and sink widgets are connected */ 510 u32 connect:1; /* source and sink widgets are connected */
511 u32 walked:1; /* path has been walked */
512 u32 walking:1; /* path is in the process of being walked */ 511 u32 walking:1; /* path is in the process of being walked */
513 u32 weak:1; /* path ignored for power management */ 512 u32 weak:1; /* path ignored for power management */
513 u32 is_supply:1; /* At least one of the connected widgets is a supply */
514 514
515 int (*connected)(struct snd_soc_dapm_widget *source, 515 int (*connected)(struct snd_soc_dapm_widget *source,
516 struct snd_soc_dapm_widget *sink); 516 struct snd_soc_dapm_widget *sink);
@@ -544,11 +544,13 @@ struct snd_soc_dapm_widget {
544 unsigned char active:1; /* active stream on DAC, ADC's */ 544 unsigned char active:1; /* active stream on DAC, ADC's */
545 unsigned char connected:1; /* connected codec pin */ 545 unsigned char connected:1; /* connected codec pin */
546 unsigned char new:1; /* cnew complete */ 546 unsigned char new:1; /* cnew complete */
547 unsigned char ext:1; /* has external widgets */
548 unsigned char force:1; /* force state */ 547 unsigned char force:1; /* force state */
549 unsigned char ignore_suspend:1; /* kept enabled over suspend */ 548 unsigned char ignore_suspend:1; /* kept enabled over suspend */
550 unsigned char new_power:1; /* power from this run */ 549 unsigned char new_power:1; /* power from this run */
551 unsigned char power_checked:1; /* power checked this run */ 550 unsigned char power_checked:1; /* power checked this run */
551 unsigned char is_supply:1; /* Widget is a supply type widget */
552 unsigned char is_sink:1; /* Widget is a sink type widget */
553 unsigned char is_source:1; /* Widget is a source type widget */
552 int subseq; /* sort within widget type */ 554 int subseq; /* sort within widget type */
553 555
554 int (*power_check)(struct snd_soc_dapm_widget *w); 556 int (*power_check)(struct snd_soc_dapm_widget *w);
@@ -567,6 +569,7 @@ struct snd_soc_dapm_widget {
567 struct list_head sinks; 569 struct list_head sinks;
568 570
569 /* used during DAPM updates */ 571 /* used during DAPM updates */
572 struct list_head work_list;
570 struct list_head power_list; 573 struct list_head power_list;
571 struct list_head dirty; 574 struct list_head dirty;
572 int inputs; 575 int inputs;
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 7ba7130037a0..b4fca9aed2a2 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -36,6 +36,11 @@
36 {.reg = xreg, .rreg = xreg, .shift = shift_left, \ 36 {.reg = xreg, .rreg = xreg, .shift = shift_left, \
37 .rshift = shift_right, .max = xmax, .platform_max = xmax, \ 37 .rshift = shift_right, .max = xmax, .platform_max = xmax, \
38 .invert = xinvert, .autodisable = xautodisable}) 38 .invert = xinvert, .autodisable = xautodisable})
39#define SOC_DOUBLE_S_VALUE(xreg, shift_left, shift_right, xmin, xmax, xsign_bit, xinvert, xautodisable) \
40 ((unsigned long)&(struct soc_mixer_control) \
41 {.reg = xreg, .rreg = xreg, .shift = shift_left, \
42 .rshift = shift_right, .min = xmin, .max = xmax, .platform_max = xmax, \
43 .sign_bit = xsign_bit, .invert = xinvert, .autodisable = xautodisable})
39#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, xautodisable) \ 44#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, xautodisable) \
40 SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert, xautodisable) 45 SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert, xautodisable)
41#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ 46#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
@@ -171,11 +176,9 @@
171 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 176 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
172 SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 177 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
173 .tlv.p = (tlv_array), \ 178 .tlv.p = (tlv_array), \
174 .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \ 179 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
175 .put = snd_soc_put_volsw_s8, \ 180 .put = snd_soc_put_volsw, \
176 .private_value = (unsigned long)&(struct soc_mixer_control) \ 181 .private_value = SOC_DOUBLE_S_VALUE(xreg, 0, 8, xmin, xmax, 7, 0, 0) }
177 {.reg = xreg, .min = xmin, .max = xmax, \
178 .platform_max = xmax} }
179#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xitems, xtexts) \ 182#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xitems, xtexts) \
180{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 183{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
181 .items = xitems, .texts = xtexts, \ 184 .items = xitems, .texts = xtexts, \
@@ -366,8 +369,6 @@ struct snd_soc_jack_gpio;
366 369
367typedef int (*hw_write_t)(void *,const char* ,int); 370typedef int (*hw_write_t)(void *,const char* ,int);
368 371
369extern struct snd_ac97_bus_ops *soc_ac97_ops;
370
371enum snd_soc_pcm_subclass { 372enum snd_soc_pcm_subclass {
372 SND_SOC_PCM_CLASS_PCM = 0, 373 SND_SOC_PCM_CLASS_PCM = 0,
373 SND_SOC_PCM_CLASS_BE = 1, 374 SND_SOC_PCM_CLASS_BE = 1,
@@ -409,13 +410,9 @@ int devm_snd_soc_register_component(struct device *dev,
409 const struct snd_soc_component_driver *cmpnt_drv, 410 const struct snd_soc_component_driver *cmpnt_drv,
410 struct snd_soc_dai_driver *dai_drv, int num_dai); 411 struct snd_soc_dai_driver *dai_drv, int num_dai);
411void snd_soc_unregister_component(struct device *dev); 412void snd_soc_unregister_component(struct device *dev);
412int snd_soc_cache_sync(struct snd_soc_codec *codec);
413int snd_soc_cache_init(struct snd_soc_codec *codec); 413int snd_soc_cache_init(struct snd_soc_codec *codec);
414int snd_soc_cache_exit(struct snd_soc_codec *codec); 414int snd_soc_cache_exit(struct snd_soc_codec *codec);
415int snd_soc_cache_write(struct snd_soc_codec *codec, 415
416 unsigned int reg, unsigned int value);
417int snd_soc_cache_read(struct snd_soc_codec *codec,
418 unsigned int reg, unsigned int *value);
419int snd_soc_platform_read(struct snd_soc_platform *platform, 416int snd_soc_platform_read(struct snd_soc_platform *platform,
420 unsigned int reg); 417 unsigned int reg);
421int snd_soc_platform_write(struct snd_soc_platform *platform, 418int snd_soc_platform_write(struct snd_soc_platform *platform,
@@ -500,14 +497,28 @@ int snd_soc_update_bits_locked(struct snd_soc_codec *codec,
500int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg, 497int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg,
501 unsigned int mask, unsigned int value); 498 unsigned int mask, unsigned int value);
502 499
503int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, 500#ifdef CONFIG_SND_SOC_AC97_BUS
504 struct snd_ac97_bus_ops *ops, int num); 501struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec);
505void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); 502void snd_soc_free_ac97_codec(struct snd_ac97 *ac97);
506 503
507int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops); 504int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops);
508int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops, 505int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops,
509 struct platform_device *pdev); 506 struct platform_device *pdev);
510 507
508extern struct snd_ac97_bus_ops *soc_ac97_ops;
509#else
510static inline int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops,
511 struct platform_device *pdev)
512{
513 return 0;
514}
515
516static inline int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops)
517{
518 return 0;
519}
520#endif
521
511/* 522/*
512 *Controls 523 *Controls
513 */ 524 */
@@ -545,12 +556,6 @@ int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol,
545 struct snd_ctl_elem_value *ucontrol); 556 struct snd_ctl_elem_value *ucontrol);
546int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, 557int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
547 struct snd_ctl_elem_value *ucontrol); 558 struct snd_ctl_elem_value *ucontrol);
548int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol,
549 struct snd_ctl_elem_info *uinfo);
550int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
551 struct snd_ctl_elem_value *ucontrol);
552int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
553 struct snd_ctl_elem_value *ucontrol);
554int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol, 559int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol,
555 struct snd_ctl_elem_info *uinfo); 560 struct snd_ctl_elem_info *uinfo);
556int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, 561int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
@@ -780,24 +785,18 @@ struct snd_soc_codec {
780 struct device *dev; 785 struct device *dev;
781 const struct snd_soc_codec_driver *driver; 786 const struct snd_soc_codec_driver *driver;
782 787
783 struct mutex mutex;
784 struct list_head list; 788 struct list_head list;
785 struct list_head card_list; 789 struct list_head card_list;
786 790
787 /* runtime */ 791 /* runtime */
788 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
789 unsigned int cache_bypass:1; /* Suppress access to the cache */ 792 unsigned int cache_bypass:1; /* Suppress access to the cache */
790 unsigned int suspended:1; /* Codec is in suspend PM state */ 793 unsigned int suspended:1; /* Codec is in suspend PM state */
791 unsigned int ac97_registered:1; /* Codec has been AC97 registered */
792 unsigned int ac97_created:1; /* Codec has been created by SoC */
793 unsigned int cache_init:1; /* codec cache has been initialized */ 794 unsigned int cache_init:1; /* codec cache has been initialized */
794 u32 cache_sync; /* Cache needs to be synced to hardware */
795 795
796 /* codec IO */ 796 /* codec IO */
797 void *control_data; /* codec control (i2c/3wire) data */ 797 void *control_data; /* codec control (i2c/3wire) data */
798 hw_write_t hw_write; 798 hw_write_t hw_write;
799 void *reg_cache; 799 void *reg_cache;
800 struct mutex cache_rw_mutex;
801 800
802 /* component */ 801 /* component */
803 struct snd_soc_component component; 802 struct snd_soc_component component;
@@ -860,8 +859,6 @@ struct snd_soc_platform_driver {
860 859
861 int (*probe)(struct snd_soc_platform *); 860 int (*probe)(struct snd_soc_platform *);
862 int (*remove)(struct snd_soc_platform *); 861 int (*remove)(struct snd_soc_platform *);
863 int (*suspend)(struct snd_soc_dai *dai);
864 int (*resume)(struct snd_soc_dai *dai);
865 struct snd_soc_component_driver component_driver; 862 struct snd_soc_component_driver component_driver;
866 863
867 /* pcm creation and destruction */ 864 /* pcm creation and destruction */
@@ -886,7 +883,7 @@ struct snd_soc_platform_driver {
886 883
887struct snd_soc_dai_link_component { 884struct snd_soc_dai_link_component {
888 const char *name; 885 const char *name;
889 const struct device_node *of_node; 886 struct device_node *of_node;
890 const char *dai_name; 887 const char *dai_name;
891}; 888};
892 889
@@ -894,8 +891,6 @@ struct snd_soc_platform {
894 struct device *dev; 891 struct device *dev;
895 const struct snd_soc_platform_driver *driver; 892 const struct snd_soc_platform_driver *driver;
896 893
897 unsigned int suspended:1; /* platform is suspended */
898
899 struct list_head list; 894 struct list_head list;
900 895
901 struct snd_soc_component component; 896 struct snd_soc_component component;
@@ -990,7 +985,7 @@ struct snd_soc_codec_conf {
990 * DT/OF node, but not both. 985 * DT/OF node, but not both.
991 */ 986 */
992 const char *dev_name; 987 const char *dev_name;
993 const struct device_node *of_node; 988 struct device_node *of_node;
994 989
995 /* 990 /*
996 * optional map of kcontrol, widget and path name prefixes that are 991 * optional map of kcontrol, widget and path name prefixes that are
@@ -1007,7 +1002,7 @@ struct snd_soc_aux_dev {
1007 * DT/OF node, but not both. 1002 * DT/OF node, but not both.
1008 */ 1003 */
1009 const char *codec_name; 1004 const char *codec_name;
1010 const struct device_node *codec_of_node; 1005 struct device_node *codec_of_node;
1011 1006
1012 /* codec/machine specific init - e.g. add machine controls */ 1007 /* codec/machine specific init - e.g. add machine controls */
1013 int (*init)(struct snd_soc_component *component); 1008 int (*init)(struct snd_soc_component *component);
@@ -1264,6 +1259,17 @@ unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
1264int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg, 1259int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
1265 unsigned int val); 1260 unsigned int val);
1266 1261
1262/**
1263 * snd_soc_cache_sync() - Sync the register cache with the hardware
1264 * @codec: CODEC to sync
1265 *
1266 * Note: This function will call regcache_sync()
1267 */
1268static inline int snd_soc_cache_sync(struct snd_soc_codec *codec)
1269{
1270 return regcache_sync(codec->component.regmap);
1271}
1272
1267/* component IO */ 1273/* component IO */
1268int snd_soc_component_read(struct snd_soc_component *component, 1274int snd_soc_component_read(struct snd_soc_component *component,
1269 unsigned int reg, unsigned int *val); 1275 unsigned int reg, unsigned int *val);
@@ -1277,6 +1283,45 @@ void snd_soc_component_async_complete(struct snd_soc_component *component);
1277int snd_soc_component_test_bits(struct snd_soc_component *component, 1283int snd_soc_component_test_bits(struct snd_soc_component *component,
1278 unsigned int reg, unsigned int mask, unsigned int value); 1284 unsigned int reg, unsigned int mask, unsigned int value);
1279 1285
1286#ifdef CONFIG_REGMAP
1287
1288void snd_soc_component_init_regmap(struct snd_soc_component *component,
1289 struct regmap *regmap);
1290void snd_soc_component_exit_regmap(struct snd_soc_component *component);
1291
1292/**
1293 * snd_soc_codec_init_regmap() - Initialize regmap instance for the CODEC
1294 * @codec: The CODEC for which to initialize the regmap instance
1295 * @regmap: The regmap instance that should be used by the CODEC
1296 *
1297 * This function allows deferred assignment of the regmap instance that is
1298 * associated with the CODEC. Only use this if the regmap instance is not yet
1299 * ready when the CODEC is registered. The function must also be called before
1300 * the first IO attempt of the CODEC.
1301 */
1302static inline void snd_soc_codec_init_regmap(struct snd_soc_codec *codec,
1303 struct regmap *regmap)
1304{
1305 snd_soc_component_init_regmap(&codec->component, regmap);
1306}
1307
1308/**
1309 * snd_soc_codec_exit_regmap() - De-initialize regmap instance for the CODEC
1310 * @codec: The CODEC for which to de-initialize the regmap instance
1311 *
1312 * Calls regmap_exit() on the regmap instance associated to the CODEC and
1313 * removes the regmap instance from the CODEC.
1314 *
1315 * This function should only be used if snd_soc_codec_init_regmap() was used to
1316 * initialize the regmap instance.
1317 */
1318static inline void snd_soc_codec_exit_regmap(struct snd_soc_codec *codec)
1319{
1320 snd_soc_component_exit_regmap(&codec->component);
1321}
1322
1323#endif
1324
1280/* device driver data */ 1325/* device driver data */
1281 1326
1282static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card, 1327static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
@@ -1451,6 +1496,9 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
1451 struct device_node **framemaster); 1496 struct device_node **framemaster);
1452int snd_soc_of_get_dai_name(struct device_node *of_node, 1497int snd_soc_of_get_dai_name(struct device_node *of_node,
1453 const char **dai_name); 1498 const char **dai_name);
1499int snd_soc_of_get_dai_link_codecs(struct device *dev,
1500 struct device_node *of_node,
1501 struct snd_soc_dai_link *dai_link);
1454 1502
1455#include <sound/soc-dai.h> 1503#include <sound/soc-dai.h>
1456 1504
diff --git a/include/sound/uda134x.h b/include/sound/uda134x.h
index e475659bd3be..509efb050176 100644
--- a/include/sound/uda134x.h
+++ b/include/sound/uda134x.h
@@ -18,18 +18,6 @@ struct uda134x_platform_data {
18 struct l3_pins l3; 18 struct l3_pins l3;
19 void (*power) (int); 19 void (*power) (int);
20 int model; 20 int model;
21 /*
22 ALSA SOC usually puts the device in standby mode when it's not used
23 for sometime. If you unset is_powered_on_standby the driver will
24 turn off the ADC/DAC when this callback is invoked and turn it back
25 on when needed. Unfortunately this will result in a very light bump
26 (it can be audible only with good earphones). If this bothers you
27 set is_powered_on_standby, you will have slightly higher power
28 consumption. Please note that sending the L3 command for ADC is
29 enough to make the bump, so it doesn't make difference if you
30 completely take off power from the codec.
31 */
32 int is_powered_on_standby;
33#define UDA134X_UDA1340 1 21#define UDA134X_UDA1340 1
34#define UDA134X_UDA1341 2 22#define UDA134X_UDA1341 2
35#define UDA134X_UDA1344 3 23#define UDA134X_UDA1344 3
diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h
index b04ee7e5a466..88cf39d96d0f 100644
--- a/include/trace/events/asoc.h
+++ b/include/trace/events/asoc.h
@@ -288,31 +288,6 @@ TRACE_EVENT(snd_soc_jack_notify,
288 TP_printk("jack=%s %x", __get_str(name), (int)__entry->val) 288 TP_printk("jack=%s %x", __get_str(name), (int)__entry->val)
289); 289);
290 290
291TRACE_EVENT(snd_soc_cache_sync,
292
293 TP_PROTO(struct snd_soc_codec *codec, const char *type,
294 const char *status),
295
296 TP_ARGS(codec, type, status),
297
298 TP_STRUCT__entry(
299 __string( name, codec->component.name)
300 __string( status, status )
301 __string( type, type )
302 __field( int, id )
303 ),
304
305 TP_fast_assign(
306 __assign_str(name, codec->component.name);
307 __assign_str(status, status);
308 __assign_str(type, type);
309 __entry->id = codec->component.id;
310 ),
311
312 TP_printk("codec=%s.%d type=%s status=%s", __get_str(name),
313 (int)__entry->id, __get_str(type), __get_str(status))
314);
315
316#endif /* _TRACE_ASOC_H */ 291#endif /* _TRACE_ASOC_H */
317 292
318/* This part must be outside protection */ 293/* This part must be outside protection */
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index ff4bd1b35246..6cfb841fea7c 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -43,15 +43,13 @@ struct extent_status;
43 { EXT4_GET_BLOCKS_METADATA_NOFAIL, "METADATA_NOFAIL" }, \ 43 { EXT4_GET_BLOCKS_METADATA_NOFAIL, "METADATA_NOFAIL" }, \
44 { EXT4_GET_BLOCKS_NO_NORMALIZE, "NO_NORMALIZE" }, \ 44 { EXT4_GET_BLOCKS_NO_NORMALIZE, "NO_NORMALIZE" }, \
45 { EXT4_GET_BLOCKS_KEEP_SIZE, "KEEP_SIZE" }, \ 45 { EXT4_GET_BLOCKS_KEEP_SIZE, "KEEP_SIZE" }, \
46 { EXT4_GET_BLOCKS_NO_LOCK, "NO_LOCK" }, \ 46 { EXT4_GET_BLOCKS_NO_LOCK, "NO_LOCK" })
47 { EXT4_GET_BLOCKS_NO_PUT_HOLE, "NO_PUT_HOLE" })
48 47
49#define show_mflags(flags) __print_flags(flags, "", \ 48#define show_mflags(flags) __print_flags(flags, "", \
50 { EXT4_MAP_NEW, "N" }, \ 49 { EXT4_MAP_NEW, "N" }, \
51 { EXT4_MAP_MAPPED, "M" }, \ 50 { EXT4_MAP_MAPPED, "M" }, \
52 { EXT4_MAP_UNWRITTEN, "U" }, \ 51 { EXT4_MAP_UNWRITTEN, "U" }, \
53 { EXT4_MAP_BOUNDARY, "B" }, \ 52 { EXT4_MAP_BOUNDARY, "B" })
54 { EXT4_MAP_FROM_CLUSTER, "C" })
55 53
56#define show_free_flags(flags) __print_flags(flags, "|", \ 54#define show_free_flags(flags) __print_flags(flags, "|", \
57 { EXT4_FREE_BLOCKS_METADATA, "METADATA" }, \ 55 { EXT4_FREE_BLOCKS_METADATA, "METADATA" }, \
@@ -2452,15 +2450,14 @@ TRACE_EVENT(ext4_collapse_range,
2452 2450
2453TRACE_EVENT(ext4_es_shrink, 2451TRACE_EVENT(ext4_es_shrink,
2454 TP_PROTO(struct super_block *sb, int nr_shrunk, u64 scan_time, 2452 TP_PROTO(struct super_block *sb, int nr_shrunk, u64 scan_time,
2455 int skip_precached, int nr_skipped, int retried), 2453 int nr_skipped, int retried),
2456 2454
2457 TP_ARGS(sb, nr_shrunk, scan_time, skip_precached, nr_skipped, retried), 2455 TP_ARGS(sb, nr_shrunk, scan_time, nr_skipped, retried),
2458 2456
2459 TP_STRUCT__entry( 2457 TP_STRUCT__entry(
2460 __field( dev_t, dev ) 2458 __field( dev_t, dev )
2461 __field( int, nr_shrunk ) 2459 __field( int, nr_shrunk )
2462 __field( unsigned long long, scan_time ) 2460 __field( unsigned long long, scan_time )
2463 __field( int, skip_precached )
2464 __field( int, nr_skipped ) 2461 __field( int, nr_skipped )
2465 __field( int, retried ) 2462 __field( int, retried )
2466 ), 2463 ),
@@ -2469,16 +2466,14 @@ TRACE_EVENT(ext4_es_shrink,
2469 __entry->dev = sb->s_dev; 2466 __entry->dev = sb->s_dev;
2470 __entry->nr_shrunk = nr_shrunk; 2467 __entry->nr_shrunk = nr_shrunk;
2471 __entry->scan_time = div_u64(scan_time, 1000); 2468 __entry->scan_time = div_u64(scan_time, 1000);
2472 __entry->skip_precached = skip_precached;
2473 __entry->nr_skipped = nr_skipped; 2469 __entry->nr_skipped = nr_skipped;
2474 __entry->retried = retried; 2470 __entry->retried = retried;
2475 ), 2471 ),
2476 2472
2477 TP_printk("dev %d,%d nr_shrunk %d, scan_time %llu skip_precached %d " 2473 TP_printk("dev %d,%d nr_shrunk %d, scan_time %llu "
2478 "nr_skipped %d retried %d", 2474 "nr_skipped %d retried %d",
2479 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->nr_shrunk, 2475 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->nr_shrunk,
2480 __entry->scan_time, __entry->skip_precached, 2476 __entry->scan_time, __entry->nr_skipped, __entry->retried)
2481 __entry->nr_skipped, __entry->retried)
2482); 2477);
2483 2478
2484#endif /* _TRACE_EXT4_H */ 2479#endif /* _TRACE_EXT4_H */
diff --git a/include/trace/events/host1x.h b/include/trace/events/host1x.h
index 94db6a2c3540..63116362543c 100644
--- a/include/trace/events/host1x.h
+++ b/include/trace/events/host1x.h
@@ -29,6 +29,8 @@
29#include <linux/ktime.h> 29#include <linux/ktime.h>
30#include <linux/tracepoint.h> 30#include <linux/tracepoint.h>
31 31
32struct host1x_bo;
33
32DECLARE_EVENT_CLASS(host1x, 34DECLARE_EVENT_CLASS(host1x,
33 TP_PROTO(const char *name), 35 TP_PROTO(const char *name),
34 TP_ARGS(name), 36 TP_ARGS(name),
@@ -79,14 +81,14 @@ TRACE_EVENT(host1x_cdma_push,
79); 81);
80 82
81TRACE_EVENT(host1x_cdma_push_gather, 83TRACE_EVENT(host1x_cdma_push_gather,
82 TP_PROTO(const char *name, u32 mem_id, 84 TP_PROTO(const char *name, struct host1x_bo *bo,
83 u32 words, u32 offset, void *cmdbuf), 85 u32 words, u32 offset, void *cmdbuf),
84 86
85 TP_ARGS(name, mem_id, words, offset, cmdbuf), 87 TP_ARGS(name, bo, words, offset, cmdbuf),
86 88
87 TP_STRUCT__entry( 89 TP_STRUCT__entry(
88 __field(const char *, name) 90 __field(const char *, name)
89 __field(u32, mem_id) 91 __field(struct host1x_bo *, bo)
90 __field(u32, words) 92 __field(u32, words)
91 __field(u32, offset) 93 __field(u32, offset)
92 __field(bool, cmdbuf) 94 __field(bool, cmdbuf)
@@ -100,13 +102,13 @@ TRACE_EVENT(host1x_cdma_push_gather,
100 } 102 }
101 __entry->cmdbuf = cmdbuf; 103 __entry->cmdbuf = cmdbuf;
102 __entry->name = name; 104 __entry->name = name;
103 __entry->mem_id = mem_id; 105 __entry->bo = bo;
104 __entry->words = words; 106 __entry->words = words;
105 __entry->offset = offset; 107 __entry->offset = offset;
106 ), 108 ),
107 109
108 TP_printk("name=%s, mem_id=%08x, words=%u, offset=%d, contents=[%s]", 110 TP_printk("name=%s, bo=%p, words=%u, offset=%d, contents=[%s]",
109 __entry->name, __entry->mem_id, 111 __entry->name, __entry->bo,
110 __entry->words, __entry->offset, 112 __entry->words, __entry->offset,
111 __print_hex(__get_dynamic_array(cmdbuf), 113 __print_hex(__get_dynamic_array(cmdbuf),
112 __entry->cmdbuf ? __entry->words * 4 : 0)) 114 __entry->cmdbuf ? __entry->words * 4 : 0))
@@ -221,12 +223,13 @@ TRACE_EVENT(host1x_syncpt_load_min,
221); 223);
222 224
223TRACE_EVENT(host1x_syncpt_wait_check, 225TRACE_EVENT(host1x_syncpt_wait_check,
224 TP_PROTO(void *mem_id, u32 offset, u32 syncpt_id, u32 thresh, u32 min), 226 TP_PROTO(struct host1x_bo *bo, u32 offset, u32 syncpt_id, u32 thresh,
227 u32 min),
225 228
226 TP_ARGS(mem_id, offset, syncpt_id, thresh, min), 229 TP_ARGS(bo, offset, syncpt_id, thresh, min),
227 230
228 TP_STRUCT__entry( 231 TP_STRUCT__entry(
229 __field(void *, mem_id) 232 __field(struct host1x_bo *, bo)
230 __field(u32, offset) 233 __field(u32, offset)
231 __field(u32, syncpt_id) 234 __field(u32, syncpt_id)
232 __field(u32, thresh) 235 __field(u32, thresh)
@@ -234,15 +237,15 @@ TRACE_EVENT(host1x_syncpt_wait_check,
234 ), 237 ),
235 238
236 TP_fast_assign( 239 TP_fast_assign(
237 __entry->mem_id = mem_id; 240 __entry->bo = bo;
238 __entry->offset = offset; 241 __entry->offset = offset;
239 __entry->syncpt_id = syncpt_id; 242 __entry->syncpt_id = syncpt_id;
240 __entry->thresh = thresh; 243 __entry->thresh = thresh;
241 __entry->min = min; 244 __entry->min = min;
242 ), 245 ),
243 246
244 TP_printk("mem_id=%p, offset=%05x, id=%d, thresh=%d, current=%d", 247 TP_printk("bo=%p, offset=%05x, id=%d, thresh=%d, current=%d",
245 __entry->mem_id, __entry->offset, 248 __entry->bo, __entry->offset,
246 __entry->syncpt_id, __entry->thresh, 249 __entry->syncpt_id, __entry->thresh,
247 __entry->min) 250 __entry->min)
248); 251);
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index e335e7d8c6c2..c78e88ce5ea3 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -36,7 +36,7 @@ TRACE_EVENT(rcu_utilization,
36 36
37#ifdef CONFIG_RCU_TRACE 37#ifdef CONFIG_RCU_TRACE
38 38
39#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 39#if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
40 40
41/* 41/*
42 * Tracepoint for grace-period events. Takes a string identifying the 42 * Tracepoint for grace-period events. Takes a string identifying the
@@ -345,7 +345,7 @@ TRACE_EVENT(rcu_fqs,
345 __entry->cpu, __entry->qsevent) 345 __entry->cpu, __entry->qsevent)
346); 346);
347 347
348#endif /* #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) */ 348#endif /* #if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU) */
349 349
350/* 350/*
351 * Tracepoint for dyntick-idle entry/exit events. These take a string 351 * Tracepoint for dyntick-idle entry/exit events. These take a string
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 0a68d5ae584e..30fedaf3e56a 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -97,16 +97,19 @@ static inline long __trace_sched_switch_state(struct task_struct *p)
97 long state = p->state; 97 long state = p->state;
98 98
99#ifdef CONFIG_PREEMPT 99#ifdef CONFIG_PREEMPT
100#ifdef CONFIG_SCHED_DEBUG
101 BUG_ON(p != current);
102#endif /* CONFIG_SCHED_DEBUG */
100 /* 103 /*
101 * For all intents and purposes a preempted task is a running task. 104 * For all intents and purposes a preempted task is a running task.
102 */ 105 */
103 if (task_preempt_count(p) & PREEMPT_ACTIVE) 106 if (preempt_count() & PREEMPT_ACTIVE)
104 state = TASK_RUNNING | TASK_STATE_MAX; 107 state = TASK_RUNNING | TASK_STATE_MAX;
105#endif 108#endif /* CONFIG_PREEMPT */
106 109
107 return state; 110 return state;
108} 111}
109#endif 112#endif /* CREATE_TRACE_POINTS */
110 113
111/* 114/*
112 * Tracepoint for task switches, performed by the scheduler: 115 * Tracepoint for task switches, performed by the scheduler:
diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h
index db6c93510f74..079bd10a01b4 100644
--- a/include/trace/events/scsi.h
+++ b/include/trace/events/scsi.h
@@ -94,7 +94,7 @@
94 scsi_opcode_name(WRITE_16), \ 94 scsi_opcode_name(WRITE_16), \
95 scsi_opcode_name(VERIFY_16), \ 95 scsi_opcode_name(VERIFY_16), \
96 scsi_opcode_name(WRITE_SAME_16), \ 96 scsi_opcode_name(WRITE_SAME_16), \
97 scsi_opcode_name(SERVICE_ACTION_IN), \ 97 scsi_opcode_name(SERVICE_ACTION_IN_16), \
98 scsi_opcode_name(SAI_READ_CAPACITY_16), \ 98 scsi_opcode_name(SAI_READ_CAPACITY_16), \
99 scsi_opcode_name(SAI_GET_LBA_STATUS), \ 99 scsi_opcode_name(SAI_GET_LBA_STATUS), \
100 scsi_opcode_name(MI_REPORT_TARGET_PGS), \ 100 scsi_opcode_name(MI_REPORT_TARGET_PGS), \
diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
index 1fef3e6e9436..171ca4ff6d99 100644
--- a/include/trace/events/sunrpc.h
+++ b/include/trace/events/sunrpc.h
@@ -6,6 +6,8 @@
6 6
7#include <linux/sunrpc/sched.h> 7#include <linux/sunrpc/sched.h>
8#include <linux/sunrpc/clnt.h> 8#include <linux/sunrpc/clnt.h>
9#include <linux/sunrpc/svc.h>
10#include <linux/sunrpc/xprtsock.h>
9#include <net/tcp_states.h> 11#include <net/tcp_states.h>
10#include <linux/net.h> 12#include <linux/net.h>
11#include <linux/tracepoint.h> 13#include <linux/tracepoint.h>
@@ -306,6 +308,164 @@ DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
306DEFINE_RPC_SOCKET_EVENT(rpc_socket_close); 308DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
307DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown); 309DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
308 310
311DECLARE_EVENT_CLASS(rpc_xprt_event,
312 TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
313
314 TP_ARGS(xprt, xid, status),
315
316 TP_STRUCT__entry(
317 __field(__be32, xid)
318 __field(int, status)
319 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
320 __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
321 ),
322
323 TP_fast_assign(
324 __entry->xid = xid;
325 __entry->status = status;
326 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
327 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
328 ),
329
330 TP_printk("peer=[%s]:%s xid=0x%x status=%d", __get_str(addr),
331 __get_str(port), be32_to_cpu(__entry->xid),
332 __entry->status)
333);
334
335DEFINE_EVENT(rpc_xprt_event, xprt_lookup_rqst,
336 TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
337 TP_ARGS(xprt, xid, status));
338
339DEFINE_EVENT(rpc_xprt_event, xprt_transmit,
340 TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
341 TP_ARGS(xprt, xid, status));
342
343DEFINE_EVENT(rpc_xprt_event, xprt_complete_rqst,
344 TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
345 TP_ARGS(xprt, xid, status));
346
347TRACE_EVENT(xs_tcp_data_ready,
348 TP_PROTO(struct rpc_xprt *xprt, int err, unsigned int total),
349
350 TP_ARGS(xprt, err, total),
351
352 TP_STRUCT__entry(
353 __field(int, err)
354 __field(unsigned int, total)
355 __string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
356 "(null)")
357 __string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
358 "(null)")
359 ),
360
361 TP_fast_assign(
362 __entry->err = err;
363 __entry->total = total;
364 __assign_str(addr, xprt ?
365 xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)");
366 __assign_str(port, xprt ?
367 xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
368 ),
369
370 TP_printk("peer=[%s]:%s err=%d total=%u", __get_str(addr),
371 __get_str(port), __entry->err, __entry->total)
372);
373
374#define rpc_show_sock_xprt_flags(flags) \
375 __print_flags(flags, "|", \
376 { TCP_RCV_LAST_FRAG, "TCP_RCV_LAST_FRAG" }, \
377 { TCP_RCV_COPY_FRAGHDR, "TCP_RCV_COPY_FRAGHDR" }, \
378 { TCP_RCV_COPY_XID, "TCP_RCV_COPY_XID" }, \
379 { TCP_RCV_COPY_DATA, "TCP_RCV_COPY_DATA" }, \
380 { TCP_RCV_READ_CALLDIR, "TCP_RCV_READ_CALLDIR" }, \
381 { TCP_RCV_COPY_CALLDIR, "TCP_RCV_COPY_CALLDIR" }, \
382 { TCP_RPC_REPLY, "TCP_RPC_REPLY" })
383
384TRACE_EVENT(xs_tcp_data_recv,
385 TP_PROTO(struct sock_xprt *xs),
386
387 TP_ARGS(xs),
388
389 TP_STRUCT__entry(
390 __string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
391 __string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
392 __field(__be32, xid)
393 __field(unsigned long, flags)
394 __field(unsigned long, copied)
395 __field(unsigned int, reclen)
396 __field(unsigned long, offset)
397 ),
398
399 TP_fast_assign(
400 __assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
401 __assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
402 __entry->xid = xs->tcp_xid;
403 __entry->flags = xs->tcp_flags;
404 __entry->copied = xs->tcp_copied;
405 __entry->reclen = xs->tcp_reclen;
406 __entry->offset = xs->tcp_offset;
407 ),
408
409 TP_printk("peer=[%s]:%s xid=0x%x flags=%s copied=%lu reclen=%u offset=%lu",
410 __get_str(addr), __get_str(port), be32_to_cpu(__entry->xid),
411 rpc_show_sock_xprt_flags(__entry->flags),
412 __entry->copied, __entry->reclen, __entry->offset)
413);
414
415TRACE_EVENT(svc_recv,
416 TP_PROTO(struct svc_rqst *rqst, int status),
417
418 TP_ARGS(rqst, status),
419
420 TP_STRUCT__entry(
421 __field(struct sockaddr *, addr)
422 __field(__be32, xid)
423 __field(int, status)
424 ),
425
426 TP_fast_assign(
427 __entry->addr = (struct sockaddr *)&rqst->rq_addr;
428 __entry->xid = status > 0 ? rqst->rq_xid : 0;
429 __entry->status = status;
430 ),
431
432 TP_printk("addr=%pIScp xid=0x%x status=%d", __entry->addr,
433 be32_to_cpu(__entry->xid), __entry->status)
434);
435
436DECLARE_EVENT_CLASS(svc_rqst_status,
437
438 TP_PROTO(struct svc_rqst *rqst, int status),
439
440 TP_ARGS(rqst, status),
441
442 TP_STRUCT__entry(
443 __field(struct sockaddr *, addr)
444 __field(__be32, xid)
445 __field(int, dropme)
446 __field(int, status)
447 ),
448
449 TP_fast_assign(
450 __entry->addr = (struct sockaddr *)&rqst->rq_addr;
451 __entry->xid = rqst->rq_xid;
452 __entry->dropme = (int)rqst->rq_dropme;
453 __entry->status = status;
454 ),
455
456 TP_printk("addr=%pIScp rq_xid=0x%x dropme=%d status=%d",
457 __entry->addr, be32_to_cpu(__entry->xid), __entry->dropme,
458 __entry->status)
459);
460
461DEFINE_EVENT(svc_rqst_status, svc_process,
462 TP_PROTO(struct svc_rqst *rqst, int status),
463 TP_ARGS(rqst, status));
464
465DEFINE_EVENT(svc_rqst_status, svc_send,
466 TP_PROTO(struct svc_rqst *rqst, int status),
467 TP_ARGS(rqst, status));
468
309#endif /* _TRACE_SUNRPC_H */ 469#endif /* _TRACE_SUNRPC_H */
310 470
311#include <trace/define_trace.h> 471#include <trace/define_trace.h>
diff --git a/include/trace/events/target.h b/include/trace/events/target.h
index da9cc0f05c93..45403443dd82 100644
--- a/include/trace/events/target.h
+++ b/include/trace/events/target.h
@@ -96,7 +96,7 @@
96 scsi_opcode_name(WRITE_16), \ 96 scsi_opcode_name(WRITE_16), \
97 scsi_opcode_name(VERIFY_16), \ 97 scsi_opcode_name(VERIFY_16), \
98 scsi_opcode_name(WRITE_SAME_16), \ 98 scsi_opcode_name(WRITE_SAME_16), \
99 scsi_opcode_name(SERVICE_ACTION_IN), \ 99 scsi_opcode_name(SERVICE_ACTION_IN_16), \
100 scsi_opcode_name(SAI_READ_CAPACITY_16), \ 100 scsi_opcode_name(SAI_READ_CAPACITY_16), \
101 scsi_opcode_name(SAI_GET_LBA_STATUS), \ 101 scsi_opcode_name(SAI_GET_LBA_STATUS), \
102 scsi_opcode_name(MI_REPORT_TARGET_PGS), \ 102 scsi_opcode_name(MI_REPORT_TARGET_PGS), \
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 26b4f2e13275..139b5067345b 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -277,14 +277,12 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
277 field = (typeof(field))iter->ent; \ 277 field = (typeof(field))iter->ent; \
278 \ 278 \
279 ret = ftrace_raw_output_prep(iter, trace_event); \ 279 ret = ftrace_raw_output_prep(iter, trace_event); \
280 if (ret) \ 280 if (ret != TRACE_TYPE_HANDLED) \
281 return ret; \ 281 return ret; \
282 \ 282 \
283 ret = trace_seq_printf(s, print); \ 283 trace_seq_printf(s, print); \
284 if (!ret) \
285 return TRACE_TYPE_PARTIAL_LINE; \
286 \ 284 \
287 return TRACE_TYPE_HANDLED; \ 285 return trace_handle_return(s); \
288} \ 286} \
289static struct trace_event_functions ftrace_event_type_funcs_##call = { \ 287static struct trace_event_functions ftrace_event_type_funcs_##call = { \
290 .trace = ftrace_raw_output_##call, \ 288 .trace = ftrace_raw_output_##call, \
diff --git a/include/uapi/asm-generic/siginfo.h b/include/uapi/asm-generic/siginfo.h
index ba5be7fdbdfe..1e3552037a5a 100644
--- a/include/uapi/asm-generic/siginfo.h
+++ b/include/uapi/asm-generic/siginfo.h
@@ -91,6 +91,10 @@ typedef struct siginfo {
91 int _trapno; /* TRAP # which caused the signal */ 91 int _trapno; /* TRAP # which caused the signal */
92#endif 92#endif
93 short _addr_lsb; /* LSB of the reported address */ 93 short _addr_lsb; /* LSB of the reported address */
94 struct {
95 void __user *_lower;
96 void __user *_upper;
97 } _addr_bnd;
94 } _sigfault; 98 } _sigfault;
95 99
96 /* SIGPOLL */ 100 /* SIGPOLL */
@@ -131,6 +135,8 @@ typedef struct siginfo {
131#define si_trapno _sifields._sigfault._trapno 135#define si_trapno _sifields._sigfault._trapno
132#endif 136#endif
133#define si_addr_lsb _sifields._sigfault._addr_lsb 137#define si_addr_lsb _sifields._sigfault._addr_lsb
138#define si_lower _sifields._sigfault._addr_bnd._lower
139#define si_upper _sifields._sigfault._addr_bnd._upper
134#define si_band _sifields._sigpoll._band 140#define si_band _sifields._sigpoll._band
135#define si_fd _sifields._sigpoll._fd 141#define si_fd _sifields._sigpoll._fd
136#ifdef __ARCH_SIGSYS 142#ifdef __ARCH_SIGSYS
@@ -199,7 +205,8 @@ typedef struct siginfo {
199 */ 205 */
200#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */ 206#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */
201#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */ 207#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */
202#define NSIGSEGV 2 208#define SEGV_BNDERR (__SI_FAULT|3) /* failed address bound checks */
209#define NSIGSEGV 3
203 210
204/* 211/*
205 * SIGBUS si_codes 212 * SIGBUS si_codes
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index ea0796bdcf88..5c15c2a5c123 100644
--- a/include/uapi/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
@@ -82,4 +82,9 @@
82 82
83#define SO_BPF_EXTENSIONS 48 83#define SO_BPF_EXTENSIONS 48
84 84
85#define SO_INCOMING_CPU 49
86
87#define SO_ATTACH_BPF 50
88#define SO_DETACH_BPF SO_DETACH_FILTER
89
85#endif /* __ASM_GENERIC_SOCKET_H */ 90#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 22749c134117..e016bd9b1a04 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -707,9 +707,11 @@ __SYSCALL(__NR_getrandom, sys_getrandom)
707__SYSCALL(__NR_memfd_create, sys_memfd_create) 707__SYSCALL(__NR_memfd_create, sys_memfd_create)
708#define __NR_bpf 280 708#define __NR_bpf 280
709__SYSCALL(__NR_bpf, sys_bpf) 709__SYSCALL(__NR_bpf, sys_bpf)
710#define __NR_execveat 281
711__SC_COMP(__NR_execveat, sys_execveat, compat_sys_execveat)
710 712
711#undef __NR_syscalls 713#undef __NR_syscalls
712#define __NR_syscalls 281 714#define __NR_syscalls 282
713 715
714/* 716/*
715 * All syscalls below here should go away really, 717 * All syscalls below here should go away really,
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index a0db2d4aa5f0..86574b0005ff 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -286,6 +286,8 @@ struct drm_mode_get_property {
286 char name[DRM_PROP_NAME_LEN]; 286 char name[DRM_PROP_NAME_LEN];
287 287
288 __u32 count_values; 288 __u32 count_values;
289 /* This is only used to count enum values, not blobs. The _blobs is
290 * simply because of a historical reason, i.e. backwards compat. */
289 __u32 count_enum_blobs; 291 __u32 count_enum_blobs;
290}; 292};
291 293
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index ff57f07c3249..250262265ee3 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -340,6 +340,7 @@ typedef struct drm_i915_irq_wait {
340#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 340#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26
341#define I915_PARAM_HAS_WT 27 341#define I915_PARAM_HAS_WT 27
342#define I915_PARAM_CMD_PARSER_VERSION 28 342#define I915_PARAM_CMD_PARSER_VERSION 28
343#define I915_PARAM_HAS_COHERENT_PHYS_GTT 29
343 344
344typedef struct drm_i915_getparam { 345typedef struct drm_i915_getparam {
345 int param; 346 int param;
@@ -876,6 +877,12 @@ struct drm_i915_gem_get_tiling {
876 * mmap mapping. 877 * mmap mapping.
877 */ 878 */
878 __u32 swizzle_mode; 879 __u32 swizzle_mode;
880
881 /**
882 * Returned address bit 6 swizzling required for CPU access through
883 * mmap mapping whilst bound.
884 */
885 __u32 phys_swizzle_mode;
879}; 886};
880 887
881struct drm_i915_gem_get_aperture { 888struct drm_i915_gem_get_aperture {
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 4c94f31a8c99..259d31fc9073 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -1,4 +1,5 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += android/
2header-y += byteorder/ 3header-y += byteorder/
3header-y += can/ 4header-y += can/
4header-y += caif/ 5header-y += caif/
@@ -37,27 +38,27 @@ header-y += aio_abi.h
37header-y += apm_bios.h 38header-y += apm_bios.h
38header-y += arcfb.h 39header-y += arcfb.h
39header-y += atalk.h 40header-y += atalk.h
40header-y += atm.h
41header-y += atm_eni.h
42header-y += atm_he.h
43header-y += atm_idt77105.h
44header-y += atm_nicstar.h
45header-y += atm_tcp.h
46header-y += atm_zatm.h
47header-y += atmapi.h 41header-y += atmapi.h
48header-y += atmarp.h 42header-y += atmarp.h
49header-y += atmbr2684.h 43header-y += atmbr2684.h
50header-y += atmclip.h 44header-y += atmclip.h
51header-y += atmdev.h 45header-y += atmdev.h
46header-y += atm_eni.h
47header-y += atm.h
48header-y += atm_he.h
49header-y += atm_idt77105.h
52header-y += atmioc.h 50header-y += atmioc.h
53header-y += atmlec.h 51header-y += atmlec.h
54header-y += atmmpc.h 52header-y += atmmpc.h
53header-y += atm_nicstar.h
55header-y += atmppp.h 54header-y += atmppp.h
56header-y += atmsap.h 55header-y += atmsap.h
57header-y += atmsvc.h 56header-y += atmsvc.h
57header-y += atm_tcp.h
58header-y += atm_zatm.h
58header-y += audit.h 59header-y += audit.h
59header-y += auto_fs.h
60header-y += auto_fs4.h 60header-y += auto_fs4.h
61header-y += auto_fs.h
61header-y += auxvec.h 62header-y += auxvec.h
62header-y += ax25.h 63header-y += ax25.h
63header-y += b1lli.h 64header-y += b1lli.h
@@ -67,8 +68,8 @@ header-y += bfs_fs.h
67header-y += binfmts.h 68header-y += binfmts.h
68header-y += blkpg.h 69header-y += blkpg.h
69header-y += blktrace_api.h 70header-y += blktrace_api.h
70header-y += bpf.h
71header-y += bpf_common.h 71header-y += bpf_common.h
72header-y += bpf.h
72header-y += bpqether.h 73header-y += bpqether.h
73header-y += bsg.h 74header-y += bsg.h
74header-y += btrfs.h 75header-y += btrfs.h
@@ -93,21 +94,21 @@ header-y += cyclades.h
93header-y += cycx_cfm.h 94header-y += cycx_cfm.h
94header-y += dcbnl.h 95header-y += dcbnl.h
95header-y += dccp.h 96header-y += dccp.h
96header-y += dlm.h 97header-y += dlmconstants.h
97header-y += dlm_device.h 98header-y += dlm_device.h
99header-y += dlm.h
98header-y += dlm_netlink.h 100header-y += dlm_netlink.h
99header-y += dlm_plock.h 101header-y += dlm_plock.h
100header-y += dlmconstants.h
101header-y += dm-ioctl.h 102header-y += dm-ioctl.h
102header-y += dm-log-userspace.h 103header-y += dm-log-userspace.h
103header-y += dn.h 104header-y += dn.h
104header-y += dqblk_xfs.h 105header-y += dqblk_xfs.h
105header-y += edd.h 106header-y += edd.h
106header-y += efs_fs_sb.h 107header-y += efs_fs_sb.h
108header-y += elfcore.h
107header-y += elf-em.h 109header-y += elf-em.h
108header-y += elf-fdpic.h 110header-y += elf-fdpic.h
109header-y += elf.h 111header-y += elf.h
110header-y += elfcore.h
111header-y += errno.h 112header-y += errno.h
112header-y += errqueue.h 113header-y += errqueue.h
113header-y += ethtool.h 114header-y += ethtool.h
@@ -131,15 +132,15 @@ header-y += fsl_hypervisor.h
131header-y += fuse.h 132header-y += fuse.h
132header-y += futex.h 133header-y += futex.h
133header-y += gameport.h 134header-y += gameport.h
134header-y += gen_stats.h
135header-y += genetlink.h 135header-y += genetlink.h
136header-y += gen_stats.h
136header-y += gfs2_ondisk.h 137header-y += gfs2_ondisk.h
137header-y += gigaset_dev.h 138header-y += gigaset_dev.h
138header-y += hdlc.h
139header-y += hdlcdrv.h 139header-y += hdlcdrv.h
140header-y += hdlc.h
140header-y += hdreg.h 141header-y += hdreg.h
141header-y += hid.h
142header-y += hiddev.h 142header-y += hiddev.h
143header-y += hid.h
143header-y += hidraw.h 144header-y += hidraw.h
144header-y += hpet.h 145header-y += hpet.h
145header-y += hsr_netlink.h 146header-y += hsr_netlink.h
@@ -151,7 +152,6 @@ header-y += i2o-dev.h
151header-y += i8k.h 152header-y += i8k.h
152header-y += icmp.h 153header-y += icmp.h
153header-y += icmpv6.h 154header-y += icmpv6.h
154header-y += if.h
155header-y += if_addr.h 155header-y += if_addr.h
156header-y += if_addrlabel.h 156header-y += if_addrlabel.h
157header-y += if_alg.h 157header-y += if_alg.h
@@ -165,6 +165,7 @@ header-y += if_ether.h
165header-y += if_fc.h 165header-y += if_fc.h
166header-y += if_fddi.h 166header-y += if_fddi.h
167header-y += if_frad.h 167header-y += if_frad.h
168header-y += if.h
168header-y += if_hippi.h 169header-y += if_hippi.h
169header-y += if_infiniband.h 170header-y += if_infiniband.h
170header-y += if_link.h 171header-y += if_link.h
@@ -182,40 +183,41 @@ header-y += if_tunnel.h
182header-y += if_vlan.h 183header-y += if_vlan.h
183header-y += if_x25.h 184header-y += if_x25.h
184header-y += igmp.h 185header-y += igmp.h
185header-y += in.h
186header-y += in6.h 186header-y += in6.h
187header-y += in_route.h
188header-y += inet_diag.h 187header-y += inet_diag.h
188header-y += in.h
189header-y += inotify.h 189header-y += inotify.h
190header-y += input.h 190header-y += input.h
191header-y += in_route.h
191header-y += ioctl.h 192header-y += ioctl.h
192header-y += ip.h
193header-y += ip6_tunnel.h 193header-y += ip6_tunnel.h
194header-y += ip_vs.h
195header-y += ipc.h 194header-y += ipc.h
195header-y += ip.h
196header-y += ipmi.h 196header-y += ipmi.h
197header-y += ipmi_msgdefs.h 197header-y += ipmi_msgdefs.h
198header-y += ipsec.h 198header-y += ipsec.h
199header-y += ipv6.h 199header-y += ipv6.h
200header-y += ipv6_route.h 200header-y += ipv6_route.h
201header-y += ip_vs.h
201header-y += ipx.h 202header-y += ipx.h
202header-y += irda.h 203header-y += irda.h
203header-y += irqnr.h 204header-y += irqnr.h
204header-y += isdn.h
205header-y += isdn_divertif.h 205header-y += isdn_divertif.h
206header-y += isdn_ppp.h 206header-y += isdn.h
207header-y += isdnif.h 207header-y += isdnif.h
208header-y += isdn_ppp.h
208header-y += iso_fs.h 209header-y += iso_fs.h
209header-y += ivtv.h
210header-y += ivtvfb.h 210header-y += ivtvfb.h
211header-y += ivtv.h
211header-y += ixjuser.h 212header-y += ixjuser.h
212header-y += jffs2.h 213header-y += jffs2.h
213header-y += joystick.h 214header-y += joystick.h
214header-y += kd.h 215header-y += kcmp.h
215header-y += kdev_t.h 216header-y += kdev_t.h
216header-y += kernel-page-flags.h 217header-y += kd.h
217header-y += kernel.h
218header-y += kernelcapi.h 218header-y += kernelcapi.h
219header-y += kernel.h
220header-y += kernel-page-flags.h
219header-y += kexec.h 221header-y += kexec.h
220header-y += keyboard.h 222header-y += keyboard.h
221header-y += keyctl.h 223header-y += keyctl.h
@@ -231,6 +233,7 @@ ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h \
231header-y += kvm_para.h 233header-y += kvm_para.h
232endif 234endif
233 235
236header-y += hw_breakpoint.h
234header-y += l2tp.h 237header-y += l2tp.h
235header-y += libc-compat.h 238header-y += libc-compat.h
236header-y += limits.h 239header-y += limits.h
@@ -243,6 +246,7 @@ header-y += map_to_7segment.h
243header-y += matroxfb.h 246header-y += matroxfb.h
244header-y += mdio.h 247header-y += mdio.h
245header-y += media.h 248header-y += media.h
249header-y += media-bus-format.h
246header-y += mei.h 250header-y += mei.h
247header-y += memfd.h 251header-y += memfd.h
248header-y += mempolicy.h 252header-y += mempolicy.h
@@ -255,43 +259,43 @@ header-y += mman.h
255header-y += mmtimer.h 259header-y += mmtimer.h
256header-y += mpls.h 260header-y += mpls.h
257header-y += mqueue.h 261header-y += mqueue.h
258header-y += mroute.h
259header-y += mroute6.h 262header-y += mroute6.h
263header-y += mroute.h
260header-y += msdos_fs.h 264header-y += msdos_fs.h
261header-y += msg.h 265header-y += msg.h
262header-y += mtio.h 266header-y += mtio.h
263header-y += n_r3964.h
264header-y += nbd.h 267header-y += nbd.h
265header-y += ncp.h
266header-y += ncp_fs.h 268header-y += ncp_fs.h
269header-y += ncp.h
267header-y += ncp_mount.h 270header-y += ncp_mount.h
268header-y += ncp_no.h 271header-y += ncp_no.h
269header-y += neighbour.h 272header-y += neighbour.h
270header-y += net.h
271header-y += net_dropmon.h
272header-y += net_tstamp.h
273header-y += netconf.h 273header-y += netconf.h
274header-y += netdevice.h 274header-y += netdevice.h
275header-y += netlink_diag.h 275header-y += net_dropmon.h
276header-y += netfilter.h
277header-y += netfilter_arp.h 276header-y += netfilter_arp.h
278header-y += netfilter_bridge.h 277header-y += netfilter_bridge.h
279header-y += netfilter_decnet.h 278header-y += netfilter_decnet.h
279header-y += netfilter.h
280header-y += netfilter_ipv4.h 280header-y += netfilter_ipv4.h
281header-y += netfilter_ipv6.h 281header-y += netfilter_ipv6.h
282header-y += net.h
283header-y += netlink_diag.h
282header-y += netlink.h 284header-y += netlink.h
283header-y += netrom.h 285header-y += netrom.h
286header-y += net_tstamp.h
284header-y += nfc.h 287header-y += nfc.h
285header-y += nfs.h
286header-y += nfs2.h 288header-y += nfs2.h
287header-y += nfs3.h 289header-y += nfs3.h
288header-y += nfs4.h 290header-y += nfs4.h
289header-y += nfs4_mount.h 291header-y += nfs4_mount.h
292header-y += nfsacl.h
290header-y += nfs_fs.h 293header-y += nfs_fs.h
294header-y += nfs.h
291header-y += nfs_idmap.h 295header-y += nfs_idmap.h
292header-y += nfs_mount.h 296header-y += nfs_mount.h
293header-y += nfsacl.h
294header-y += nl80211.h 297header-y += nl80211.h
298header-y += n_r3964.h
295header-y += nubus.h 299header-y += nubus.h
296header-y += nvme.h 300header-y += nvme.h
297header-y += nvram.h 301header-y += nvram.h
@@ -311,16 +315,16 @@ header-y += pfkeyv2.h
311header-y += pg.h 315header-y += pg.h
312header-y += phantom.h 316header-y += phantom.h
313header-y += phonet.h 317header-y += phonet.h
318header-y += pktcdvd.h
314header-y += pkt_cls.h 319header-y += pkt_cls.h
315header-y += pkt_sched.h 320header-y += pkt_sched.h
316header-y += pktcdvd.h
317header-y += pmu.h 321header-y += pmu.h
318header-y += poll.h 322header-y += poll.h
319header-y += posix_types.h 323header-y += posix_types.h
320header-y += ppdev.h 324header-y += ppdev.h
321header-y += ppp-comp.h 325header-y += ppp-comp.h
322header-y += ppp-ioctl.h
323header-y += ppp_defs.h 326header-y += ppp_defs.h
327header-y += ppp-ioctl.h
324header-y += pps.h 328header-y += pps.h
325header-y += prctl.h 329header-y += prctl.h
326header-y += psci.h 330header-y += psci.h
@@ -352,13 +356,13 @@ header-y += seccomp.h
352header-y += securebits.h 356header-y += securebits.h
353header-y += selinux_netlink.h 357header-y += selinux_netlink.h
354header-y += sem.h 358header-y += sem.h
355header-y += serial.h
356header-y += serial_core.h 359header-y += serial_core.h
360header-y += serial.h
357header-y += serial_reg.h 361header-y += serial_reg.h
358header-y += serio.h 362header-y += serio.h
359header-y += shm.h 363header-y += shm.h
360header-y += signal.h
361header-y += signalfd.h 364header-y += signalfd.h
365header-y += signal.h
362header-y += smiapp.h 366header-y += smiapp.h
363header-y += snmp.h 367header-y += snmp.h
364header-y += sock_diag.h 368header-y += sock_diag.h
@@ -367,8 +371,8 @@ header-y += sockios.h
367header-y += som.h 371header-y += som.h
368header-y += sonet.h 372header-y += sonet.h
369header-y += sonypi.h 373header-y += sonypi.h
370header-y += sound.h
371header-y += soundcard.h 374header-y += soundcard.h
375header-y += sound.h
372header-y += stat.h 376header-y += stat.h
373header-y += stddef.h 377header-y += stddef.h
374header-y += string.h 378header-y += string.h
@@ -387,11 +391,12 @@ header-y += time.h
387header-y += times.h 391header-y += times.h
388header-y += timex.h 392header-y += timex.h
389header-y += tiocl.h 393header-y += tiocl.h
390header-y += tipc.h
391header-y += tipc_config.h 394header-y += tipc_config.h
395header-y += tipc_netlink.h
396header-y += tipc.h
392header-y += toshiba.h 397header-y += toshiba.h
393header-y += tty.h
394header-y += tty_flags.h 398header-y += tty_flags.h
399header-y += tty.h
395header-y += types.h 400header-y += types.h
396header-y += udf_fs_i.h 401header-y += udf_fs_i.h
397header-y += udp.h 402header-y += udp.h
@@ -427,7 +432,9 @@ header-y += virtio_net.h
427header-y += virtio_pci.h 432header-y += virtio_pci.h
428header-y += virtio_ring.h 433header-y += virtio_ring.h
429header-y += virtio_rng.h 434header-y += virtio_rng.h
430header=y += vm_sockets.h 435header-y += virtio_scsi.h
436header-y += virtio_types.h
437header-y += vm_sockets.h
431header-y += vt.h 438header-y += vt.h
432header-y += wait.h 439header-y += wait.h
433header-y += wanrouter.h 440header-y += wanrouter.h
@@ -437,6 +444,5 @@ header-y += wireless.h
437header-y += x25.h 444header-y += x25.h
438header-y += xattr.h 445header-y += xattr.h
439header-y += xfrm.h 446header-y += xfrm.h
440header-y += hw_breakpoint.h
441header-y += zorro.h 447header-y += zorro.h
442header-y += zorro_ids.h 448header-y += zorro_ids.h
diff --git a/include/uapi/linux/android/Kbuild b/include/uapi/linux/android/Kbuild
new file mode 100644
index 000000000000..ca011eec252a
--- /dev/null
+++ b/include/uapi/linux/android/Kbuild
@@ -0,0 +1,2 @@
1# UAPI Header export list
2header-y += binder.h
diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h
new file mode 100644
index 000000000000..41420e341e75
--- /dev/null
+++ b/include/uapi/linux/android/binder.h
@@ -0,0 +1,352 @@
1/*
2 * Copyright (C) 2008 Google, Inc.
3 *
4 * Based on, but no longer compatible with, the original
5 * OpenBinder.org binder driver interface, which is:
6 *
7 * Copyright (c) 2005 Palmsource, Inc.
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 */
19
20#ifndef _UAPI_LINUX_BINDER_H
21#define _UAPI_LINUX_BINDER_H
22
23#include <linux/types.h>
24#include <linux/ioctl.h>
25
26#define B_PACK_CHARS(c1, c2, c3, c4) \
27 ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4))
28#define B_TYPE_LARGE 0x85
29
30enum {
31 BINDER_TYPE_BINDER = B_PACK_CHARS('s', 'b', '*', B_TYPE_LARGE),
32 BINDER_TYPE_WEAK_BINDER = B_PACK_CHARS('w', 'b', '*', B_TYPE_LARGE),
33 BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE),
34 BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE),
35 BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE),
36};
37
38enum {
39 FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff,
40 FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100,
41};
42
43#ifdef BINDER_IPC_32BIT
44typedef __u32 binder_size_t;
45typedef __u32 binder_uintptr_t;
46#else
47typedef __u64 binder_size_t;
48typedef __u64 binder_uintptr_t;
49#endif
50
51/*
52 * This is the flattened representation of a Binder object for transfer
53 * between processes. The 'offsets' supplied as part of a binder transaction
54 * contains offsets into the data where these structures occur. The Binder
55 * driver takes care of re-writing the structure type and data as it moves
56 * between processes.
57 */
58struct flat_binder_object {
59 /* 8 bytes for large_flat_header. */
60 __u32 type;
61 __u32 flags;
62
63 /* 8 bytes of data. */
64 union {
65 binder_uintptr_t binder; /* local object */
66 __u32 handle; /* remote object */
67 };
68
69 /* extra data associated with local object */
70 binder_uintptr_t cookie;
71};
72
73/*
74 * On 64-bit platforms where user code may run in 32-bits the driver must
75 * translate the buffer (and local binder) addresses appropriately.
76 */
77
78struct binder_write_read {
79 binder_size_t write_size; /* bytes to write */
80 binder_size_t write_consumed; /* bytes consumed by driver */
81 binder_uintptr_t write_buffer;
82 binder_size_t read_size; /* bytes to read */
83 binder_size_t read_consumed; /* bytes consumed by driver */
84 binder_uintptr_t read_buffer;
85};
86
87/* Use with BINDER_VERSION, driver fills in fields. */
88struct binder_version {
89 /* driver protocol version -- increment with incompatible change */
90 __s32 protocol_version;
91};
92
93/* This is the current protocol version. */
94#ifdef BINDER_IPC_32BIT
95#define BINDER_CURRENT_PROTOCOL_VERSION 7
96#else
97#define BINDER_CURRENT_PROTOCOL_VERSION 8
98#endif
99
100#define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read)
101#define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64)
102#define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32)
103#define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32)
104#define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32)
105#define BINDER_THREAD_EXIT _IOW('b', 8, __s32)
106#define BINDER_VERSION _IOWR('b', 9, struct binder_version)
107
108/*
109 * NOTE: Two special error codes you should check for when calling
110 * in to the driver are:
111 *
112 * EINTR -- The operation has been interupted. This should be
113 * handled by retrying the ioctl() until a different error code
114 * is returned.
115 *
116 * ECONNREFUSED -- The driver is no longer accepting operations
117 * from your process. That is, the process is being destroyed.
118 * You should handle this by exiting from your process. Note
119 * that once this error code is returned, all further calls to
120 * the driver from any thread will return this same code.
121 */
122
123enum transaction_flags {
124 TF_ONE_WAY = 0x01, /* this is a one-way call: async, no return */
125 TF_ROOT_OBJECT = 0x04, /* contents are the component's root object */
126 TF_STATUS_CODE = 0x08, /* contents are a 32-bit status code */
127 TF_ACCEPT_FDS = 0x10, /* allow replies with file descriptors */
128};
129
130struct binder_transaction_data {
131 /* The first two are only used for bcTRANSACTION and brTRANSACTION,
132 * identifying the target and contents of the transaction.
133 */
134 union {
135 /* target descriptor of command transaction */
136 __u32 handle;
137 /* target descriptor of return transaction */
138 binder_uintptr_t ptr;
139 } target;
140 binder_uintptr_t cookie; /* target object cookie */
141 __u32 code; /* transaction command */
142
143 /* General information about the transaction. */
144 __u32 flags;
145 pid_t sender_pid;
146 uid_t sender_euid;
147 binder_size_t data_size; /* number of bytes of data */
148 binder_size_t offsets_size; /* number of bytes of offsets */
149
150 /* If this transaction is inline, the data immediately
151 * follows here; otherwise, it ends with a pointer to
152 * the data buffer.
153 */
154 union {
155 struct {
156 /* transaction data */
157 binder_uintptr_t buffer;
158 /* offsets from buffer to flat_binder_object structs */
159 binder_uintptr_t offsets;
160 } ptr;
161 __u8 buf[8];
162 } data;
163};
164
165struct binder_ptr_cookie {
166 binder_uintptr_t ptr;
167 binder_uintptr_t cookie;
168};
169
170struct binder_handle_cookie {
171 __u32 handle;
172 binder_uintptr_t cookie;
173} __packed;
174
175struct binder_pri_desc {
176 __s32 priority;
177 __u32 desc;
178};
179
180struct binder_pri_ptr_cookie {
181 __s32 priority;
182 binder_uintptr_t ptr;
183 binder_uintptr_t cookie;
184};
185
186enum binder_driver_return_protocol {
187 BR_ERROR = _IOR('r', 0, __s32),
188 /*
189 * int: error code
190 */
191
192 BR_OK = _IO('r', 1),
193 /* No parameters! */
194
195 BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data),
196 BR_REPLY = _IOR('r', 3, struct binder_transaction_data),
197 /*
198 * binder_transaction_data: the received command.
199 */
200
201 BR_ACQUIRE_RESULT = _IOR('r', 4, __s32),
202 /*
203 * not currently supported
204 * int: 0 if the last bcATTEMPT_ACQUIRE was not successful.
205 * Else the remote object has acquired a primary reference.
206 */
207
208 BR_DEAD_REPLY = _IO('r', 5),
209 /*
210 * The target of the last transaction (either a bcTRANSACTION or
211 * a bcATTEMPT_ACQUIRE) is no longer with us. No parameters.
212 */
213
214 BR_TRANSACTION_COMPLETE = _IO('r', 6),
215 /*
216 * No parameters... always refers to the last transaction requested
217 * (including replies). Note that this will be sent even for
218 * asynchronous transactions.
219 */
220
221 BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie),
222 BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie),
223 BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie),
224 BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie),
225 /*
226 * void *: ptr to binder
227 * void *: cookie for binder
228 */
229
230 BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie),
231 /*
232 * not currently supported
233 * int: priority
234 * void *: ptr to binder
235 * void *: cookie for binder
236 */
237
238 BR_NOOP = _IO('r', 12),
239 /*
240 * No parameters. Do nothing and examine the next command. It exists
241 * primarily so that we can replace it with a BR_SPAWN_LOOPER command.
242 */
243
244 BR_SPAWN_LOOPER = _IO('r', 13),
245 /*
246 * No parameters. The driver has determined that a process has no
247 * threads waiting to service incoming transactions. When a process
248 * receives this command, it must spawn a new service thread and
249 * register it via bcENTER_LOOPER.
250 */
251
252 BR_FINISHED = _IO('r', 14),
253 /*
254 * not currently supported
255 * stop threadpool thread
256 */
257
258 BR_DEAD_BINDER = _IOR('r', 15, binder_uintptr_t),
259 /*
260 * void *: cookie
261 */
262 BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, binder_uintptr_t),
263 /*
264 * void *: cookie
265 */
266
267 BR_FAILED_REPLY = _IO('r', 17),
268 /*
269 * The the last transaction (either a bcTRANSACTION or
270 * a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters.
271 */
272};
273
274enum binder_driver_command_protocol {
275 BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data),
276 BC_REPLY = _IOW('c', 1, struct binder_transaction_data),
277 /*
278 * binder_transaction_data: the sent command.
279 */
280
281 BC_ACQUIRE_RESULT = _IOW('c', 2, __s32),
282 /*
283 * not currently supported
284 * int: 0 if the last BR_ATTEMPT_ACQUIRE was not successful.
285 * Else you have acquired a primary reference on the object.
286 */
287
288 BC_FREE_BUFFER = _IOW('c', 3, binder_uintptr_t),
289 /*
290 * void *: ptr to transaction data received on a read
291 */
292
293 BC_INCREFS = _IOW('c', 4, __u32),
294 BC_ACQUIRE = _IOW('c', 5, __u32),
295 BC_RELEASE = _IOW('c', 6, __u32),
296 BC_DECREFS = _IOW('c', 7, __u32),
297 /*
298 * int: descriptor
299 */
300
301 BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie),
302 BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie),
303 /*
304 * void *: ptr to binder
305 * void *: cookie for binder
306 */
307
308 BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc),
309 /*
310 * not currently supported
311 * int: priority
312 * int: descriptor
313 */
314
315 BC_REGISTER_LOOPER = _IO('c', 11),
316 /*
317 * No parameters.
318 * Register a spawned looper thread with the device.
319 */
320
321 BC_ENTER_LOOPER = _IO('c', 12),
322 BC_EXIT_LOOPER = _IO('c', 13),
323 /*
324 * No parameters.
325 * These two commands are sent as an application-level thread
326 * enters and exits the binder loop, respectively. They are
327 * used so the binder can have an accurate count of the number
328 * of looping threads it has available.
329 */
330
331 BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14,
332 struct binder_handle_cookie),
333 /*
334 * int: handle
335 * void *: cookie
336 */
337
338 BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15,
339 struct binder_handle_cookie),
340 /*
341 * int: handle
342 * void *: cookie
343 */
344
345 BC_DEAD_BINDER_DONE = _IOW('c', 16, binder_uintptr_t),
346 /*
347 * void *: cookie
348 */
349};
350
351#endif /* _UAPI_LINUX_BINDER_H */
352
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index d4dbef14d4df..12e26683c706 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -322,9 +322,15 @@ enum {
322#define AUDIT_STATUS_BACKLOG_LIMIT 0x0010 322#define AUDIT_STATUS_BACKLOG_LIMIT 0x0010
323#define AUDIT_STATUS_BACKLOG_WAIT_TIME 0x0020 323#define AUDIT_STATUS_BACKLOG_WAIT_TIME 0x0020
324 324
325#define AUDIT_VERSION_BACKLOG_LIMIT 1 325#define AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT 0x00000001
326#define AUDIT_VERSION_BACKLOG_WAIT_TIME 2 326#define AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME 0x00000002
327#define AUDIT_VERSION_LATEST AUDIT_VERSION_BACKLOG_WAIT_TIME 327#define AUDIT_FEATURE_BITMAP_ALL (AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT | \
328 AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME)
329
330/* deprecated: AUDIT_VERSION_* */
331#define AUDIT_VERSION_LATEST AUDIT_FEATURE_BITMAP_ALL
332#define AUDIT_VERSION_BACKLOG_LIMIT AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT
333#define AUDIT_VERSION_BACKLOG_WAIT_TIME AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME
328 334
329 /* Failure-to-log actions */ 335 /* Failure-to-log actions */
330#define AUDIT_FAIL_SILENT 0 336#define AUDIT_FAIL_SILENT 0
@@ -404,7 +410,10 @@ struct audit_status {
404 __u32 backlog_limit; /* waiting messages limit */ 410 __u32 backlog_limit; /* waiting messages limit */
405 __u32 lost; /* messages lost */ 411 __u32 lost; /* messages lost */
406 __u32 backlog; /* messages waiting in queue */ 412 __u32 backlog; /* messages waiting in queue */
407 __u32 version; /* audit api version number */ 413 union {
414 __u32 version; /* deprecated: audit api version num */
415 __u32 feature_bitmap; /* bitmap of kernel audit features */
416 };
408 __u32 backlog_wait_time;/* message queue wait timeout */ 417 __u32 backlog_wait_time;/* message queue wait timeout */
409}; 418};
410 419
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index d18316f9e9c4..45da7ec7d274 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -82,7 +82,7 @@ enum bpf_cmd {
82 82
83 /* create or update key/value pair in a given map 83 /* create or update key/value pair in a given map
84 * err = bpf(BPF_MAP_UPDATE_ELEM, union bpf_attr *attr, u32 size) 84 * err = bpf(BPF_MAP_UPDATE_ELEM, union bpf_attr *attr, u32 size)
85 * Using attr->map_fd, attr->key, attr->value 85 * Using attr->map_fd, attr->key, attr->value, attr->flags
86 * returns zero or negative error 86 * returns zero or negative error
87 */ 87 */
88 BPF_MAP_UPDATE_ELEM, 88 BPF_MAP_UPDATE_ELEM,
@@ -111,12 +111,20 @@ enum bpf_cmd {
111 111
112enum bpf_map_type { 112enum bpf_map_type {
113 BPF_MAP_TYPE_UNSPEC, 113 BPF_MAP_TYPE_UNSPEC,
114 BPF_MAP_TYPE_HASH,
115 BPF_MAP_TYPE_ARRAY,
114}; 116};
115 117
116enum bpf_prog_type { 118enum bpf_prog_type {
117 BPF_PROG_TYPE_UNSPEC, 119 BPF_PROG_TYPE_UNSPEC,
120 BPF_PROG_TYPE_SOCKET_FILTER,
118}; 121};
119 122
123/* flags for BPF_MAP_UPDATE_ELEM command */
124#define BPF_ANY 0 /* create new element or update existing */
125#define BPF_NOEXIST 1 /* create new element if it didn't exist */
126#define BPF_EXIST 2 /* update existing element */
127
120union bpf_attr { 128union bpf_attr {
121 struct { /* anonymous struct used by BPF_MAP_CREATE command */ 129 struct { /* anonymous struct used by BPF_MAP_CREATE command */
122 __u32 map_type; /* one of enum bpf_map_type */ 130 __u32 map_type; /* one of enum bpf_map_type */
@@ -132,6 +140,7 @@ union bpf_attr {
132 __aligned_u64 value; 140 __aligned_u64 value;
133 __aligned_u64 next_key; 141 __aligned_u64 next_key;
134 }; 142 };
143 __u64 flags;
135 }; 144 };
136 145
137 struct { /* anonymous struct used by BPF_PROG_LOAD command */ 146 struct { /* anonymous struct used by BPF_PROG_LOAD command */
@@ -150,6 +159,9 @@ union bpf_attr {
150 */ 159 */
151enum bpf_func_id { 160enum bpf_func_id {
152 BPF_FUNC_unspec, 161 BPF_FUNC_unspec,
162 BPF_FUNC_map_lookup_elem, /* void *map_lookup_elem(&map, &key) */
163 BPF_FUNC_map_update_elem, /* int map_update_elem(&map, &key, &value, flags) */
164 BPF_FUNC_map_delete_elem, /* int map_delete_elem(&map, &key) */
153 __BPF_FUNC_MAX_ID, 165 __BPF_FUNC_MAX_ID,
154}; 166};
155 167
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
index 2f47824e7a36..611e1c5893b4 100644
--- a/include/uapi/linux/btrfs.h
+++ b/include/uapi/linux/btrfs.h
@@ -157,6 +157,7 @@ struct btrfs_ioctl_dev_replace_status_params {
157#define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR 0 157#define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR 0
158#define BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED 1 158#define BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED 1
159#define BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED 2 159#define BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED 2
160#define BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS 3
160struct btrfs_ioctl_dev_replace_args { 161struct btrfs_ioctl_dev_replace_args {
161 __u64 cmd; /* in */ 162 __u64 cmd; /* in */
162 __u64 result; /* out */ 163 __u64 result; /* out */
diff --git a/include/uapi/linux/can/error.h b/include/uapi/linux/can/error.h
index c247446ab25a..1c508be9687f 100644
--- a/include/uapi/linux/can/error.h
+++ b/include/uapi/linux/can/error.h
@@ -71,6 +71,7 @@
71#define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */ 71#define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */
72 /* (at least one error counter exceeds */ 72 /* (at least one error counter exceeds */
73 /* the protocol-defined level of 127) */ 73 /* the protocol-defined level of 127) */
74#define CAN_ERR_CRTL_ACTIVE 0x40 /* recovered to error active state */
74 75
75/* error in CAN protocol (type) / data[2] */ 76/* error in CAN protocol (type) / data[2] */
76#define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */ 77#define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */
diff --git a/include/uapi/linux/dlmconstants.h b/include/uapi/linux/dlmconstants.h
index 47bf08dc7566..2857bdc5b27b 100644
--- a/include/uapi/linux/dlmconstants.h
+++ b/include/uapi/linux/dlmconstants.h
@@ -114,7 +114,7 @@
114 * 114 *
115 * DLM_LKF_ORPHAN 115 * DLM_LKF_ORPHAN
116 * 116 *
117 * not yet implemented 117 * Acquire an orphan lock.
118 * 118 *
119 * DLM_LKF_ALTPR 119 * DLM_LKF_ALTPR
120 * 120 *
diff --git a/include/uapi/linux/dm-ioctl.h b/include/uapi/linux/dm-ioctl.h
index 3315ab21f728..a570d7b5796c 100644
--- a/include/uapi/linux/dm-ioctl.h
+++ b/include/uapi/linux/dm-ioctl.h
@@ -267,9 +267,9 @@ enum {
267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
268 268
269#define DM_VERSION_MAJOR 4 269#define DM_VERSION_MAJOR 4
270#define DM_VERSION_MINOR 28 270#define DM_VERSION_MINOR 29
271#define DM_VERSION_PATCHLEVEL 0 271#define DM_VERSION_PATCHLEVEL 0
272#define DM_VERSION_EXTRA "-ioctl (2014-09-17)" 272#define DM_VERSION_EXTRA "-ioctl (2014-10-28)"
273 273
274/* Status bits */ 274/* Status bits */
275#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 275#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -352,4 +352,9 @@ enum {
352 */ 352 */
353#define DM_DEFERRED_REMOVE (1 << 17) /* In/Out */ 353#define DM_DEFERRED_REMOVE (1 << 17) /* In/Out */
354 354
355/*
356 * If set, the device is suspended internally.
357 */
358#define DM_INTERNAL_SUSPEND_FLAG (1 << 18) /* Out */
359
355#endif /* _LINUX_DM_IOCTL_H */ 360#endif /* _LINUX_DM_IOCTL_H */
diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index aa90bc98b6e2..ae99f7743cf4 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -34,6 +34,7 @@
34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ 34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */
35#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */ 35#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
36#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ 36#define EM_BLACKFIN 106 /* ADI Blackfin Processor */
37#define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */
37#define EM_TI_C6000 140 /* TI C6X DSPs */ 38#define EM_TI_C6000 140 /* TI C6X DSPs */
38#define EM_AARCH64 183 /* ARM 64 bit */ 39#define EM_AARCH64 183 /* ARM 64 bit */
39#define EM_FRV 0x5441 /* Fujitsu FR-V */ 40#define EM_FRV 0x5441 /* Fujitsu FR-V */
diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
index ea9bf2561b9e..71e1d0ed92f7 100644
--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -397,6 +397,7 @@ typedef struct elf64_shdr {
397#define NT_ARM_TLS 0x401 /* ARM TLS register */ 397#define NT_ARM_TLS 0x401 /* ARM TLS register */
398#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */ 398#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
399#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */ 399#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */
400#define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */
400#define NT_METAG_CBUF 0x500 /* Metag catch buffer registers */ 401#define NT_METAG_CBUF 0x500 /* Metag catch buffer registers */
401#define NT_METAG_RPIPE 0x501 /* Metag read pipeline state */ 402#define NT_METAG_RPIPE 0x501 /* Metag read pipeline state */
402#define NT_METAG_TLS 0x502 /* Metag TLS pointer */ 403#define NT_METAG_TLS 0x502 /* Metag TLS pointer */
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 99b43056a6fe..5f66d9c2889d 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -534,6 +534,7 @@ struct ethtool_pauseparam {
534 * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE; 534 * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE;
535 * now deprecated 535 * now deprecated
536 * @ETH_SS_FEATURES: Device feature names 536 * @ETH_SS_FEATURES: Device feature names
537 * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names
537 */ 538 */
538enum ethtool_stringset { 539enum ethtool_stringset {
539 ETH_SS_TEST = 0, 540 ETH_SS_TEST = 0,
@@ -541,6 +542,7 @@ enum ethtool_stringset {
541 ETH_SS_PRIV_FLAGS, 542 ETH_SS_PRIV_FLAGS,
542 ETH_SS_NTUPLE_FILTERS, 543 ETH_SS_NTUPLE_FILTERS,
543 ETH_SS_FEATURES, 544 ETH_SS_FEATURES,
545 ETH_SS_RSS_HASH_FUNCS,
544}; 546};
545 547
546/** 548/**
@@ -884,6 +886,8 @@ struct ethtool_rxfh_indir {
884 * @key_size: On entry, the array size of the user buffer for the hash key, 886 * @key_size: On entry, the array size of the user buffer for the hash key,
885 * which may be zero. On return from %ETHTOOL_GRSSH, the size of the 887 * which may be zero. On return from %ETHTOOL_GRSSH, the size of the
886 * hardware hash key. 888 * hardware hash key.
889 * @hfunc: Defines the current RSS hash function used by HW (or to be set to).
890 * Valid values are one of the %ETH_RSS_HASH_*.
887 * @rsvd: Reserved for future extensions. 891 * @rsvd: Reserved for future extensions.
888 * @rss_config: RX ring/queue index for each hash value i.e., indirection table 892 * @rss_config: RX ring/queue index for each hash value i.e., indirection table
889 * of @indir_size __u32 elements, followed by hash key of @key_size 893 * of @indir_size __u32 elements, followed by hash key of @key_size
@@ -893,14 +897,16 @@ struct ethtool_rxfh_indir {
893 * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of 897 * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of
894 * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested 898 * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested
895 * and a @indir_size of zero means the indir table should be reset to default 899 * and a @indir_size of zero means the indir table should be reset to default
896 * values. 900 * values. An hfunc of zero means that hash function setting is not requested.
897 */ 901 */
898struct ethtool_rxfh { 902struct ethtool_rxfh {
899 __u32 cmd; 903 __u32 cmd;
900 __u32 rss_context; 904 __u32 rss_context;
901 __u32 indir_size; 905 __u32 indir_size;
902 __u32 key_size; 906 __u32 key_size;
903 __u32 rsvd[2]; 907 __u8 hfunc;
908 __u8 rsvd8[3];
909 __u32 rsvd32;
904 __u32 rss_config[0]; 910 __u32 rss_config[0];
905}; 911};
906#define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff 912#define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff
@@ -1213,6 +1219,10 @@ enum ethtool_sfeatures_retval_bits {
1213#define SUPPORTED_40000baseCR4_Full (1 << 24) 1219#define SUPPORTED_40000baseCR4_Full (1 << 24)
1214#define SUPPORTED_40000baseSR4_Full (1 << 25) 1220#define SUPPORTED_40000baseSR4_Full (1 << 25)
1215#define SUPPORTED_40000baseLR4_Full (1 << 26) 1221#define SUPPORTED_40000baseLR4_Full (1 << 26)
1222#define SUPPORTED_56000baseKR4_Full (1 << 27)
1223#define SUPPORTED_56000baseCR4_Full (1 << 28)
1224#define SUPPORTED_56000baseSR4_Full (1 << 29)
1225#define SUPPORTED_56000baseLR4_Full (1 << 30)
1216 1226
1217#define ADVERTISED_10baseT_Half (1 << 0) 1227#define ADVERTISED_10baseT_Half (1 << 0)
1218#define ADVERTISED_10baseT_Full (1 << 1) 1228#define ADVERTISED_10baseT_Full (1 << 1)
@@ -1241,6 +1251,10 @@ enum ethtool_sfeatures_retval_bits {
1241#define ADVERTISED_40000baseCR4_Full (1 << 24) 1251#define ADVERTISED_40000baseCR4_Full (1 << 24)
1242#define ADVERTISED_40000baseSR4_Full (1 << 25) 1252#define ADVERTISED_40000baseSR4_Full (1 << 25)
1243#define ADVERTISED_40000baseLR4_Full (1 << 26) 1253#define ADVERTISED_40000baseLR4_Full (1 << 26)
1254#define ADVERTISED_56000baseKR4_Full (1 << 27)
1255#define ADVERTISED_56000baseCR4_Full (1 << 28)
1256#define ADVERTISED_56000baseSR4_Full (1 << 29)
1257#define ADVERTISED_56000baseLR4_Full (1 << 30)
1244 1258
1245/* The following are all involved in forcing a particular link 1259/* The following are all involved in forcing a particular link
1246 * mode for the device for setting things. When getting the 1260 * mode for the device for setting things. When getting the
@@ -1248,12 +1262,16 @@ enum ethtool_sfeatures_retval_bits {
1248 * it was forced up into this mode or autonegotiated. 1262 * it was forced up into this mode or autonegotiated.
1249 */ 1263 */
1250 1264
1251/* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */ 1265/* The forced speed, 10Mb, 100Mb, gigabit, [2.5|10|20|40|56]GbE. */
1252#define SPEED_10 10 1266#define SPEED_10 10
1253#define SPEED_100 100 1267#define SPEED_100 100
1254#define SPEED_1000 1000 1268#define SPEED_1000 1000
1255#define SPEED_2500 2500 1269#define SPEED_2500 2500
1256#define SPEED_10000 10000 1270#define SPEED_10000 10000
1271#define SPEED_20000 20000
1272#define SPEED_40000 40000
1273#define SPEED_56000 56000
1274
1257#define SPEED_UNKNOWN -1 1275#define SPEED_UNKNOWN -1
1258 1276
1259/* Duplex, half or full. */ 1277/* Duplex, half or full. */
@@ -1343,6 +1361,10 @@ enum ethtool_sfeatures_retval_bits {
1343#define ETH_MODULE_SFF_8079_LEN 256 1361#define ETH_MODULE_SFF_8079_LEN 256
1344#define ETH_MODULE_SFF_8472 0x2 1362#define ETH_MODULE_SFF_8472 0x2
1345#define ETH_MODULE_SFF_8472_LEN 512 1363#define ETH_MODULE_SFF_8472_LEN 512
1364#define ETH_MODULE_SFF_8636 0x3
1365#define ETH_MODULE_SFF_8636_LEN 256
1366#define ETH_MODULE_SFF_8436 0x4
1367#define ETH_MODULE_SFF_8436_LEN 256
1346 1368
1347/* Reset flags */ 1369/* Reset flags */
1348/* The reset() operation must clear the flags for the components which 1370/* The reset() operation must clear the flags for the components which
diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h
index 0a8e6badb29b..bb1cb73c927a 100644
--- a/include/uapi/linux/hyperv.h
+++ b/include/uapi/linux/hyperv.h
@@ -134,6 +134,7 @@ struct hv_start_fcopy {
134 134
135struct hv_do_fcopy { 135struct hv_do_fcopy {
136 struct hv_fcopy_hdr hdr; 136 struct hv_fcopy_hdr hdr;
137 __u32 pad;
137 __u64 offset; 138 __u64 offset;
138 __u32 size; 139 __u32 size;
139 __u8 data[DATA_FRAGMENT]; 140 __u8 data[DATA_FRAGMENT];
diff --git a/include/uapi/linux/if_alg.h b/include/uapi/linux/if_alg.h
index 0f9acce5b1ff..f2acd2fde1f3 100644
--- a/include/uapi/linux/if_alg.h
+++ b/include/uapi/linux/if_alg.h
@@ -32,6 +32,8 @@ struct af_alg_iv {
32#define ALG_SET_KEY 1 32#define ALG_SET_KEY 1
33#define ALG_SET_IV 2 33#define ALG_SET_IV 2
34#define ALG_SET_OP 3 34#define ALG_SET_OP 3
35#define ALG_SET_AEAD_ASSOCLEN 4
36#define ALG_SET_AEAD_AUTHSIZE 5
35 37
36/* Operations */ 38/* Operations */
37#define ALG_OP_DECRYPT 0 39#define ALG_OP_DECRYPT 0
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
index da17e456908d..b03ee8f62d3c 100644
--- a/include/uapi/linux/if_bridge.h
+++ b/include/uapi/linux/if_bridge.h
@@ -105,6 +105,7 @@ struct __fdb_entry {
105 105
106#define BRIDGE_MODE_VEB 0 /* Default loopback mode */ 106#define BRIDGE_MODE_VEB 0 /* Default loopback mode */
107#define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */ 107#define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */
108#define BRIDGE_MODE_UNDEF 0xFFFF /* mode undefined */
108 109
109/* Bridge management nested attributes 110/* Bridge management nested attributes
110 * [IFLA_AF_SPEC] = { 111 * [IFLA_AF_SPEC] = {
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 0bdb77e16875..f7d0d2d7173a 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -145,6 +145,7 @@ enum {
145 IFLA_CARRIER, 145 IFLA_CARRIER,
146 IFLA_PHYS_PORT_ID, 146 IFLA_PHYS_PORT_ID,
147 IFLA_CARRIER_CHANGES, 147 IFLA_CARRIER_CHANGES,
148 IFLA_PHYS_SWITCH_ID,
148 __IFLA_MAX 149 __IFLA_MAX
149}; 150};
150 151
@@ -243,6 +244,8 @@ enum {
243 IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */ 244 IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */
244 IFLA_BRPORT_LEARNING, /* mac learning */ 245 IFLA_BRPORT_LEARNING, /* mac learning */
245 IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */ 246 IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */
247 IFLA_BRPORT_PROXYARP, /* proxy ARP */
248 IFLA_BRPORT_LEARNING_SYNC, /* mac learning sync from device */
246 __IFLA_BRPORT_MAX 249 __IFLA_BRPORT_MAX
247}; 250};
248#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) 251#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
@@ -329,6 +332,21 @@ enum macvlan_macaddr_mode {
329 332
330#define MACVLAN_FLAG_NOPROMISC 1 333#define MACVLAN_FLAG_NOPROMISC 1
331 334
335/* IPVLAN section */
336enum {
337 IFLA_IPVLAN_UNSPEC,
338 IFLA_IPVLAN_MODE,
339 __IFLA_IPVLAN_MAX
340};
341
342#define IFLA_IPVLAN_MAX (__IFLA_IPVLAN_MAX - 1)
343
344enum ipvlan_mode {
345 IPVLAN_MODE_L2 = 0,
346 IPVLAN_MODE_L3,
347 IPVLAN_MODE_MAX
348};
349
332/* VXLAN section */ 350/* VXLAN section */
333enum { 351enum {
334 IFLA_VXLAN_UNSPEC, 352 IFLA_VXLAN_UNSPEC,
diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h
index e9502dd1ee2c..18b2403982f9 100644
--- a/include/uapi/linux/if_tun.h
+++ b/include/uapi/linux/if_tun.h
@@ -22,21 +22,11 @@
22 22
23/* Read queue size */ 23/* Read queue size */
24#define TUN_READQ_SIZE 500 24#define TUN_READQ_SIZE 500
25 25/* TUN device type flags: deprecated. Use IFF_TUN/IFF_TAP instead. */
26/* TUN device flags */ 26#define TUN_TUN_DEV IFF_TUN
27#define TUN_TUN_DEV 0x0001 27#define TUN_TAP_DEV IFF_TAP
28#define TUN_TAP_DEV 0x0002
29#define TUN_TYPE_MASK 0x000f 28#define TUN_TYPE_MASK 0x000f
30 29
31#define TUN_FASYNC 0x0010
32#define TUN_NOCHECKSUM 0x0020
33#define TUN_NO_PI 0x0040
34/* This flag has no real effect */
35#define TUN_ONE_QUEUE 0x0080
36#define TUN_PERSIST 0x0100
37#define TUN_VNET_HDR 0x0200
38#define TUN_TAP_MQ 0x0400
39
40/* Ioctl defines */ 30/* Ioctl defines */
41#define TUNSETNOCSUM _IOW('T', 200, int) 31#define TUNSETNOCSUM _IOW('T', 200, int)
42#define TUNSETDEBUG _IOW('T', 201, int) 32#define TUNSETDEBUG _IOW('T', 201, int)
@@ -67,6 +57,7 @@
67#define IFF_ONE_QUEUE 0x2000 57#define IFF_ONE_QUEUE 0x2000
68#define IFF_VNET_HDR 0x4000 58#define IFF_VNET_HDR 0x4000
69#define IFF_TUN_EXCL 0x8000 59#define IFF_TUN_EXCL 0x8000
60#define IFF_VNET_LE 0x10000
70#define IFF_MULTI_QUEUE 0x0100 61#define IFF_MULTI_QUEUE 0x0100
71#define IFF_ATTACH_QUEUE 0x0200 62#define IFF_ATTACH_QUEUE 0x0200
72#define IFF_DETACH_QUEUE 0x0400 63#define IFF_DETACH_QUEUE 0x0400
diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index 280d9e092283..bd3cc11a431f 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -69,6 +69,7 @@ enum tunnel_encap_types {
69 69
70#define TUNNEL_ENCAP_FLAG_CSUM (1<<0) 70#define TUNNEL_ENCAP_FLAG_CSUM (1<<0)
71#define TUNNEL_ENCAP_FLAG_CSUM6 (1<<1) 71#define TUNNEL_ENCAP_FLAG_CSUM6 (1<<1)
72#define TUNNEL_ENCAP_FLAG_REMCSUM (1<<2)
72 73
73/* SIT-mode i_flags */ 74/* SIT-mode i_flags */
74#define SIT_ISATAP 0x0001 75#define SIT_ISATAP 0x0001
diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
index efa2666f4b8a..e863d088b9a5 100644
--- a/include/uapi/linux/ipv6.h
+++ b/include/uapi/linux/ipv6.h
@@ -164,6 +164,7 @@ enum {
164 DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL, 164 DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL,
165 DEVCONF_SUPPRESS_FRAG_NDISC, 165 DEVCONF_SUPPRESS_FRAG_NDISC,
166 DEVCONF_ACCEPT_RA_FROM_LOCAL, 166 DEVCONF_ACCEPT_RA_FROM_LOCAL,
167 DEVCONF_USE_OPTIMISTIC,
167 DEVCONF_MAX 168 DEVCONF_MAX
168}; 169};
169 170
diff --git a/include/linux/kcmp.h b/include/uapi/linux/kcmp.h
index 2dcd1b3aafc8..84df14b37360 100644
--- a/include/linux/kcmp.h
+++ b/include/uapi/linux/kcmp.h
@@ -1,5 +1,5 @@
1#ifndef _LINUX_KCMP_H 1#ifndef _UAPI_LINUX_KCMP_H
2#define _LINUX_KCMP_H 2#define _UAPI_LINUX_KCMP_H
3 3
4/* Comparison type */ 4/* Comparison type */
5enum kcmp_type { 5enum kcmp_type {
@@ -14,4 +14,4 @@ enum kcmp_type {
14 KCMP_TYPES, 14 KCMP_TYPES,
15}; 15};
16 16
17#endif /* _LINUX_KCMP_H */ 17#endif /* _UAPI_LINUX_KCMP_H */
diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
new file mode 100644
index 000000000000..7acef41fc209
--- /dev/null
+++ b/include/uapi/linux/kfd_ioctl.h
@@ -0,0 +1,154 @@
1/*
2 * Copyright 2014 Advanced Micro Devices, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef KFD_IOCTL_H_INCLUDED
24#define KFD_IOCTL_H_INCLUDED
25
26#include <linux/types.h>
27#include <linux/ioctl.h>
28
29#define KFD_IOCTL_MAJOR_VERSION 1
30#define KFD_IOCTL_MINOR_VERSION 0
31
32struct kfd_ioctl_get_version_args {
33 uint32_t major_version; /* from KFD */
34 uint32_t minor_version; /* from KFD */
35};
36
37/* For kfd_ioctl_create_queue_args.queue_type. */
38#define KFD_IOC_QUEUE_TYPE_COMPUTE 0
39#define KFD_IOC_QUEUE_TYPE_SDMA 1
40#define KFD_IOC_QUEUE_TYPE_COMPUTE_AQL 2
41
42#define KFD_MAX_QUEUE_PERCENTAGE 100
43#define KFD_MAX_QUEUE_PRIORITY 15
44
45struct kfd_ioctl_create_queue_args {
46 uint64_t ring_base_address; /* to KFD */
47 uint64_t write_pointer_address; /* from KFD */
48 uint64_t read_pointer_address; /* from KFD */
49 uint64_t doorbell_offset; /* from KFD */
50
51 uint32_t ring_size; /* to KFD */
52 uint32_t gpu_id; /* to KFD */
53 uint32_t queue_type; /* to KFD */
54 uint32_t queue_percentage; /* to KFD */
55 uint32_t queue_priority; /* to KFD */
56 uint32_t queue_id; /* from KFD */
57
58 uint64_t eop_buffer_address; /* to KFD */
59 uint64_t eop_buffer_size; /* to KFD */
60 uint64_t ctx_save_restore_address; /* to KFD */
61 uint64_t ctx_save_restore_size; /* to KFD */
62};
63
64struct kfd_ioctl_destroy_queue_args {
65 uint32_t queue_id; /* to KFD */
66 uint32_t pad;
67};
68
69struct kfd_ioctl_update_queue_args {
70 uint64_t ring_base_address; /* to KFD */
71
72 uint32_t queue_id; /* to KFD */
73 uint32_t ring_size; /* to KFD */
74 uint32_t queue_percentage; /* to KFD */
75 uint32_t queue_priority; /* to KFD */
76};
77
78/* For kfd_ioctl_set_memory_policy_args.default_policy and alternate_policy */
79#define KFD_IOC_CACHE_POLICY_COHERENT 0
80#define KFD_IOC_CACHE_POLICY_NONCOHERENT 1
81
82struct kfd_ioctl_set_memory_policy_args {
83 uint64_t alternate_aperture_base; /* to KFD */
84 uint64_t alternate_aperture_size; /* to KFD */
85
86 uint32_t gpu_id; /* to KFD */
87 uint32_t default_policy; /* to KFD */
88 uint32_t alternate_policy; /* to KFD */
89 uint32_t pad;
90};
91
92/*
93 * All counters are monotonic. They are used for profiling of compute jobs.
94 * The profiling is done by userspace.
95 *
96 * In case of GPU reset, the counter should not be affected.
97 */
98
99struct kfd_ioctl_get_clock_counters_args {
100 uint64_t gpu_clock_counter; /* from KFD */
101 uint64_t cpu_clock_counter; /* from KFD */
102 uint64_t system_clock_counter; /* from KFD */
103 uint64_t system_clock_freq; /* from KFD */
104
105 uint32_t gpu_id; /* to KFD */
106 uint32_t pad;
107};
108
109#define NUM_OF_SUPPORTED_GPUS 7
110
111struct kfd_process_device_apertures {
112 uint64_t lds_base; /* from KFD */
113 uint64_t lds_limit; /* from KFD */
114 uint64_t scratch_base; /* from KFD */
115 uint64_t scratch_limit; /* from KFD */
116 uint64_t gpuvm_base; /* from KFD */
117 uint64_t gpuvm_limit; /* from KFD */
118 uint32_t gpu_id; /* from KFD */
119 uint32_t pad;
120};
121
122struct kfd_ioctl_get_process_apertures_args {
123 struct kfd_process_device_apertures
124 process_apertures[NUM_OF_SUPPORTED_GPUS];/* from KFD */
125
126 /* from KFD, should be in the range [1 - NUM_OF_SUPPORTED_GPUS] */
127 uint32_t num_of_nodes;
128 uint32_t pad;
129};
130
131#define KFD_IOC_MAGIC 'K'
132
133#define KFD_IOC_GET_VERSION \
134 _IOR(KFD_IOC_MAGIC, 1, struct kfd_ioctl_get_version_args)
135
136#define KFD_IOC_CREATE_QUEUE \
137 _IOWR(KFD_IOC_MAGIC, 2, struct kfd_ioctl_create_queue_args)
138
139#define KFD_IOC_DESTROY_QUEUE \
140 _IOWR(KFD_IOC_MAGIC, 3, struct kfd_ioctl_destroy_queue_args)
141
142#define KFD_IOC_SET_MEMORY_POLICY \
143 _IOW(KFD_IOC_MAGIC, 4, struct kfd_ioctl_set_memory_policy_args)
144
145#define KFD_IOC_GET_CLOCK_COUNTERS \
146 _IOWR(KFD_IOC_MAGIC, 5, struct kfd_ioctl_get_clock_counters_args)
147
148#define KFD_IOC_GET_PROCESS_APERTURES \
149 _IOR(KFD_IOC_MAGIC, 6, struct kfd_ioctl_get_process_apertures_args)
150
151#define KFD_IOC_UPDATE_QUEUE \
152 _IOW(KFD_IOC_MAGIC, 7, struct kfd_ioctl_update_queue_args)
153
154#endif
diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h
new file mode 100644
index 000000000000..23b40908be30
--- /dev/null
+++ b/include/uapi/linux/media-bus-format.h
@@ -0,0 +1,125 @@
1/*
2 * Media Bus API header
3 *
4 * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_MEDIA_BUS_FORMAT_H
12#define __LINUX_MEDIA_BUS_FORMAT_H
13
14/*
15 * These bus formats uniquely identify data formats on the data bus. Format 0
16 * is reserved, MEDIA_BUS_FMT_FIXED shall be used by host-client pairs, where
17 * the data format is fixed. Additionally, "2X8" means that one pixel is
18 * transferred in two 8-bit samples, "BE" or "LE" specify in which order those
19 * samples are transferred over the bus: "LE" means that the least significant
20 * bits are transferred first, "BE" means that the most significant bits are
21 * transferred first, and "PADHI" and "PADLO" define which bits - low or high,
22 * in the incomplete high byte, are filled with padding bits.
23 *
24 * The bus formats are grouped by type, bus_width, bits per component, samples
25 * per pixel and order of subsamples. Numerical values are sorted using generic
26 * numerical sort order (8 thus comes before 10).
27 *
28 * As their value can't change when a new bus format is inserted in the
29 * enumeration, the bus formats are explicitly given a numerical value. The next
30 * free values for each category are listed below, update them when inserting
31 * new pixel codes.
32 */
33
34#define MEDIA_BUS_FMT_FIXED 0x0001
35
36/* RGB - next is 0x100e */
37#define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE 0x1001
38#define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE 0x1002
39#define MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE 0x1003
40#define MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE 0x1004
41#define MEDIA_BUS_FMT_BGR565_2X8_BE 0x1005
42#define MEDIA_BUS_FMT_BGR565_2X8_LE 0x1006
43#define MEDIA_BUS_FMT_RGB565_2X8_BE 0x1007
44#define MEDIA_BUS_FMT_RGB565_2X8_LE 0x1008
45#define MEDIA_BUS_FMT_RGB666_1X18 0x1009
46#define MEDIA_BUS_FMT_RGB888_1X24 0x100a
47#define MEDIA_BUS_FMT_RGB888_2X12_BE 0x100b
48#define MEDIA_BUS_FMT_RGB888_2X12_LE 0x100c
49#define MEDIA_BUS_FMT_ARGB8888_1X32 0x100d
50
51/* YUV (including grey) - next is 0x2024 */
52#define MEDIA_BUS_FMT_Y8_1X8 0x2001
53#define MEDIA_BUS_FMT_UV8_1X8 0x2015
54#define MEDIA_BUS_FMT_UYVY8_1_5X8 0x2002
55#define MEDIA_BUS_FMT_VYUY8_1_5X8 0x2003
56#define MEDIA_BUS_FMT_YUYV8_1_5X8 0x2004
57#define MEDIA_BUS_FMT_YVYU8_1_5X8 0x2005
58#define MEDIA_BUS_FMT_UYVY8_2X8 0x2006
59#define MEDIA_BUS_FMT_VYUY8_2X8 0x2007
60#define MEDIA_BUS_FMT_YUYV8_2X8 0x2008
61#define MEDIA_BUS_FMT_YVYU8_2X8 0x2009
62#define MEDIA_BUS_FMT_Y10_1X10 0x200a
63#define MEDIA_BUS_FMT_UYVY10_2X10 0x2018
64#define MEDIA_BUS_FMT_VYUY10_2X10 0x2019
65#define MEDIA_BUS_FMT_YUYV10_2X10 0x200b
66#define MEDIA_BUS_FMT_YVYU10_2X10 0x200c
67#define MEDIA_BUS_FMT_Y12_1X12 0x2013
68#define MEDIA_BUS_FMT_UYVY8_1X16 0x200f
69#define MEDIA_BUS_FMT_VYUY8_1X16 0x2010
70#define MEDIA_BUS_FMT_YUYV8_1X16 0x2011
71#define MEDIA_BUS_FMT_YVYU8_1X16 0x2012
72#define MEDIA_BUS_FMT_YDYUYDYV8_1X16 0x2014
73#define MEDIA_BUS_FMT_UYVY10_1X20 0x201a
74#define MEDIA_BUS_FMT_VYUY10_1X20 0x201b
75#define MEDIA_BUS_FMT_YUYV10_1X20 0x200d
76#define MEDIA_BUS_FMT_YVYU10_1X20 0x200e
77#define MEDIA_BUS_FMT_YUV10_1X30 0x2016
78#define MEDIA_BUS_FMT_AYUV8_1X32 0x2017
79#define MEDIA_BUS_FMT_UYVY12_2X12 0x201c
80#define MEDIA_BUS_FMT_VYUY12_2X12 0x201d
81#define MEDIA_BUS_FMT_YUYV12_2X12 0x201e
82#define MEDIA_BUS_FMT_YVYU12_2X12 0x201f
83#define MEDIA_BUS_FMT_UYVY12_1X24 0x2020
84#define MEDIA_BUS_FMT_VYUY12_1X24 0x2021
85#define MEDIA_BUS_FMT_YUYV12_1X24 0x2022
86#define MEDIA_BUS_FMT_YVYU12_1X24 0x2023
87
88/* Bayer - next is 0x3019 */
89#define MEDIA_BUS_FMT_SBGGR8_1X8 0x3001
90#define MEDIA_BUS_FMT_SGBRG8_1X8 0x3013
91#define MEDIA_BUS_FMT_SGRBG8_1X8 0x3002
92#define MEDIA_BUS_FMT_SRGGB8_1X8 0x3014
93#define MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8 0x3015
94#define MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8 0x3016
95#define MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8 0x3017
96#define MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8 0x3018
97#define MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8 0x300b
98#define MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8 0x300c
99#define MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8 0x3009
100#define MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8 0x300d
101#define MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE 0x3003
102#define MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE 0x3004
103#define MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE 0x3005
104#define MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE 0x3006
105#define MEDIA_BUS_FMT_SBGGR10_1X10 0x3007
106#define MEDIA_BUS_FMT_SGBRG10_1X10 0x300e
107#define MEDIA_BUS_FMT_SGRBG10_1X10 0x300a
108#define MEDIA_BUS_FMT_SRGGB10_1X10 0x300f
109#define MEDIA_BUS_FMT_SBGGR12_1X12 0x3008
110#define MEDIA_BUS_FMT_SGBRG12_1X12 0x3010
111#define MEDIA_BUS_FMT_SGRBG12_1X12 0x3011
112#define MEDIA_BUS_FMT_SRGGB12_1X12 0x3012
113
114/* JPEG compressed formats - next is 0x4002 */
115#define MEDIA_BUS_FMT_JPEG_1X8 0x4001
116
117/* Vendor specific formats - next is 0x5002 */
118
119/* S5C73M3 sensor specific interleaved UYVY and JPEG */
120#define MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8 0x5001
121
122/* HSV - next is 0x6002 */
123#define MEDIA_BUS_FMT_AHSV8888_1X32 0x6001
124
125#endif /* __LINUX_MEDIA_BUS_FORMAT_H */
diff --git a/include/uapi/linux/msg.h b/include/uapi/linux/msg.h
index a70375526578..f51c8001dbe5 100644
--- a/include/uapi/linux/msg.h
+++ b/include/uapi/linux/msg.h
@@ -51,16 +51,28 @@ struct msginfo {
51}; 51};
52 52
53/* 53/*
54 * Scaling factor to compute msgmni: 54 * MSGMNI, MSGMAX and MSGMNB are default values which can be
55 * the memory dedicated to msg queues (msgmni * msgmnb) should occupy 55 * modified by sysctl.
56 * at most 1/MSG_MEM_SCALE of the lowmem (see the formula in ipc/msg.c): 56 *
57 * up to 8MB : msgmni = 16 (MSGMNI) 57 * MSGMNI is the upper limit for the number of messages queues per
58 * 4 GB : msgmni = 8K 58 * namespace.
59 * more than 16 GB : msgmni = 32K (IPCMNI) 59 * It has been chosen to be as large possible without facilitating
60 * scenarios where userspace causes overflows when adjusting the limits via
61 * operations of the form retrieve current limit; add X; update limit".
62 *
63 * MSGMNB is the default size of a new message queue. Non-root tasks can
64 * decrease the size with msgctl(IPC_SET), root tasks
65 * (actually: CAP_SYS_RESOURCE) can both increase and decrease the queue
66 * size. The optimal value is application dependent.
67 * 16384 is used because it was always used (since 0.99.10)
68 *
69 * MAXMAX is the maximum size of an individual message, it's a global
70 * (per-namespace) limit that applies for all message queues.
71 * It's set to 1/2 of MSGMNB, to ensure that at least two messages fit into
72 * the queue. This is also an arbitrary choice (since 2.6.0).
60 */ 73 */
61#define MSG_MEM_SCALE 32
62 74
63#define MSGMNI 16 /* <= IPCMNI */ /* max # of msg queue identifiers */ 75#define MSGMNI 32000 /* <= IPCMNI */ /* max # of msg queue identifiers */
64#define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */ 76#define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */
65#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */ 77#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */
66 78
diff --git a/include/uapi/linux/neighbour.h b/include/uapi/linux/neighbour.h
index 4a1d7e96dfe3..f3d77f9f1e0b 100644
--- a/include/uapi/linux/neighbour.h
+++ b/include/uapi/linux/neighbour.h
@@ -35,11 +35,11 @@ enum {
35 */ 35 */
36 36
37#define NTF_USE 0x01 37#define NTF_USE 0x01
38#define NTF_PROXY 0x08 /* == ATF_PUBL */
39#define NTF_ROUTER 0x80
40
41#define NTF_SELF 0x02 38#define NTF_SELF 0x02
42#define NTF_MASTER 0x04 39#define NTF_MASTER 0x04
40#define NTF_PROXY 0x08 /* == ATF_PUBL */
41#define NTF_EXT_LEARNED 0x10
42#define NTF_ROUTER 0x80
43 43
44/* 44/*
45 * Neighbor Cache Entry States. 45 * Neighbor Cache Entry States.
diff --git a/include/uapi/linux/net_tstamp.h b/include/uapi/linux/net_tstamp.h
index ff354021bb69..edbc888ceb51 100644
--- a/include/uapi/linux/net_tstamp.h
+++ b/include/uapi/linux/net_tstamp.h
@@ -23,8 +23,9 @@ enum {
23 SOF_TIMESTAMPING_OPT_ID = (1<<7), 23 SOF_TIMESTAMPING_OPT_ID = (1<<7),
24 SOF_TIMESTAMPING_TX_SCHED = (1<<8), 24 SOF_TIMESTAMPING_TX_SCHED = (1<<8),
25 SOF_TIMESTAMPING_TX_ACK = (1<<9), 25 SOF_TIMESTAMPING_TX_ACK = (1<<9),
26 SOF_TIMESTAMPING_OPT_CMSG = (1<<10),
26 27
27 SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_TX_ACK, 28 SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_CMSG,
28 SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) | 29 SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) |
29 SOF_TIMESTAMPING_LAST 30 SOF_TIMESTAMPING_LAST
30}; 31};
diff --git a/include/uapi/linux/netfilter/ipset/ip_set.h b/include/uapi/linux/netfilter/ipset/ip_set.h
index ca03119111a2..5ab4e60894cf 100644
--- a/include/uapi/linux/netfilter/ipset/ip_set.h
+++ b/include/uapi/linux/netfilter/ipset/ip_set.h
@@ -256,11 +256,17 @@ enum {
256 IPSET_COUNTER_GT, 256 IPSET_COUNTER_GT,
257}; 257};
258 258
259struct ip_set_counter_match { 259/* Backward compatibility for set match v3 */
260struct ip_set_counter_match0 {
260 __u8 op; 261 __u8 op;
261 __u64 value; 262 __u64 value;
262}; 263};
263 264
265struct ip_set_counter_match {
266 __aligned_u64 value;
267 __u8 op;
268};
269
264/* Interface to iptables/ip6tables */ 270/* Interface to iptables/ip6tables */
265 271
266#define SO_IP_SET 83 272#define SO_IP_SET 83
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index f31fe7b660a5..832bc46db78b 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -579,6 +579,7 @@ enum nft_exthdr_attributes {
579 * @NFT_META_CPU: cpu id through smp_processor_id() 579 * @NFT_META_CPU: cpu id through smp_processor_id()
580 * @NFT_META_IIFGROUP: packet input interface group 580 * @NFT_META_IIFGROUP: packet input interface group
581 * @NFT_META_OIFGROUP: packet output interface group 581 * @NFT_META_OIFGROUP: packet output interface group
582 * @NFT_META_CGROUP: socket control group (skb->sk->sk_classid)
582 */ 583 */
583enum nft_meta_keys { 584enum nft_meta_keys {
584 NFT_META_LEN, 585 NFT_META_LEN,
@@ -604,6 +605,7 @@ enum nft_meta_keys {
604 NFT_META_CPU, 605 NFT_META_CPU,
605 NFT_META_IIFGROUP, 606 NFT_META_IIFGROUP,
606 NFT_META_OIFGROUP, 607 NFT_META_OIFGROUP,
608 NFT_META_CGROUP,
607}; 609};
608 610
609/** 611/**
@@ -838,6 +840,22 @@ enum nft_masq_attributes {
838#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1) 840#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1)
839 841
840/** 842/**
843 * enum nft_redir_attributes - nf_tables redirect expression netlink attributes
844 *
845 * @NFTA_REDIR_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
846 * @NFTA_REDIR_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
847 * @NFTA_REDIR_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
848 */
849enum nft_redir_attributes {
850 NFTA_REDIR_UNSPEC,
851 NFTA_REDIR_REG_PROTO_MIN,
852 NFTA_REDIR_REG_PROTO_MAX,
853 NFTA_REDIR_FLAGS,
854 __NFTA_REDIR_MAX
855};
856#define NFTA_REDIR_MAX (__NFTA_REDIR_MAX - 1)
857
858/**
841 * enum nft_gen_attributes - nf_tables ruleset generation attributes 859 * enum nft_gen_attributes - nf_tables ruleset generation attributes
842 * 860 *
843 * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32) 861 * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32)
diff --git a/include/uapi/linux/netfilter/xt_set.h b/include/uapi/linux/netfilter/xt_set.h
index d6a1df1f2947..d4e02348384c 100644
--- a/include/uapi/linux/netfilter/xt_set.h
+++ b/include/uapi/linux/netfilter/xt_set.h
@@ -66,8 +66,8 @@ struct xt_set_info_target_v2 {
66 66
67struct xt_set_info_match_v3 { 67struct xt_set_info_match_v3 {
68 struct xt_set_info match_set; 68 struct xt_set_info match_set;
69 struct ip_set_counter_match packets; 69 struct ip_set_counter_match0 packets;
70 struct ip_set_counter_match bytes; 70 struct ip_set_counter_match0 bytes;
71 __u32 flags; 71 __u32 flags;
72}; 72};
73 73
@@ -81,4 +81,13 @@ struct xt_set_info_target_v3 {
81 __u32 timeout; 81 __u32 timeout;
82}; 82};
83 83
84/* Revision 4 match */
85
86struct xt_set_info_match_v4 {
87 struct xt_set_info match_set;
88 struct ip_set_counter_match packets;
89 struct ip_set_counter_match bytes;
90 __u32 flags;
91};
92
84#endif /*_XT_SET_H*/ 93#endif /*_XT_SET_H*/
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 9b19b4461928..8119255feae4 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -116,6 +116,7 @@ enum nfc_commands {
116 NFC_EVENT_SE_TRANSACTION, 116 NFC_EVENT_SE_TRANSACTION,
117 NFC_CMD_GET_SE, 117 NFC_CMD_GET_SE,
118 NFC_CMD_SE_IO, 118 NFC_CMD_SE_IO,
119 NFC_CMD_ACTIVATE_TARGET,
119/* private: internal use only */ 120/* private: internal use only */
120 __NFC_CMD_AFTER_LAST 121 __NFC_CMD_AFTER_LAST
121}; 122};
@@ -196,15 +197,19 @@ enum nfc_sdp_attr {
196}; 197};
197#define NFC_SDP_ATTR_MAX (__NFC_SDP_ATTR_AFTER_LAST - 1) 198#define NFC_SDP_ATTR_MAX (__NFC_SDP_ATTR_AFTER_LAST - 1)
198 199
199#define NFC_DEVICE_NAME_MAXSIZE 8 200#define NFC_DEVICE_NAME_MAXSIZE 8
200#define NFC_NFCID1_MAXSIZE 10 201#define NFC_NFCID1_MAXSIZE 10
201#define NFC_NFCID2_MAXSIZE 8 202#define NFC_NFCID2_MAXSIZE 8
202#define NFC_NFCID3_MAXSIZE 10 203#define NFC_NFCID3_MAXSIZE 10
203#define NFC_SENSB_RES_MAXSIZE 12 204#define NFC_SENSB_RES_MAXSIZE 12
204#define NFC_SENSF_RES_MAXSIZE 18 205#define NFC_SENSF_RES_MAXSIZE 18
205#define NFC_GB_MAXSIZE 48 206#define NFC_ATR_REQ_MAXSIZE 64
206#define NFC_FIRMWARE_NAME_MAXSIZE 32 207#define NFC_ATR_RES_MAXSIZE 64
207#define NFC_ISO15693_UID_MAXSIZE 8 208#define NFC_ATR_REQ_GB_MAXSIZE 48
209#define NFC_ATR_RES_GB_MAXSIZE 47
210#define NFC_GB_MAXSIZE 48
211#define NFC_FIRMWARE_NAME_MAXSIZE 32
212#define NFC_ISO15693_UID_MAXSIZE 8
208 213
209/* NFC protocols */ 214/* NFC protocols */
210#define NFC_PROTO_JEWEL 1 215#define NFC_PROTO_JEWEL 1
diff --git a/include/uapi/linux/nfsd/debug.h b/include/uapi/linux/nfsd/debug.h
index a6f453c740b8..1fdc95bb2375 100644
--- a/include/uapi/linux/nfsd/debug.h
+++ b/include/uapi/linux/nfsd/debug.h
@@ -15,7 +15,7 @@
15 * Enable debugging for nfsd. 15 * Enable debugging for nfsd.
16 * Requires RPC_DEBUG. 16 * Requires RPC_DEBUG.
17 */ 17 */
18#ifdef RPC_DEBUG 18#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
19# define NFSD_DEBUG 1 19# define NFSD_DEBUG 1
20#endif 20#endif
21 21
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 4b28dc07bcb1..b37bd5a1cb82 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -227,7 +227,11 @@
227 * the interface identified by %NL80211_ATTR_IFINDEX. 227 * the interface identified by %NL80211_ATTR_IFINDEX.
228 * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC 228 * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC
229 * or, if no MAC address given, all stations, on the interface identified 229 * or, if no MAC address given, all stations, on the interface identified
230 * by %NL80211_ATTR_IFINDEX. 230 * by %NL80211_ATTR_IFINDEX. %NL80211_ATTR_MGMT_SUBTYPE and
231 * %NL80211_ATTR_REASON_CODE can optionally be used to specify which type
232 * of disconnection indication should be sent to the station
233 * (Deauthentication or Disassociation frame and reason code for that
234 * frame).
231 * 235 *
232 * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to 236 * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to
233 * destination %NL80211_ATTR_MAC on the interface identified by 237 * destination %NL80211_ATTR_MAC on the interface identified by
@@ -639,7 +643,18 @@
639 * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels 643 * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels
640 * independently of the userspace SME, send this event indicating 644 * independently of the userspace SME, send this event indicating
641 * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the 645 * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the
642 * attributes determining channel width. 646 * attributes determining channel width. This indication may also be
647 * sent when a remotely-initiated switch (e.g., when a STA receives a CSA
648 * from the remote AP) is completed;
649 *
650 * @NL80211_CMD_CH_SWITCH_STARTED_NOTIFY: Notify that a channel switch
651 * has been started on an interface, regardless of the initiator
652 * (ie. whether it was requested from a remote device or
653 * initiated on our own). It indicates that
654 * %NL80211_ATTR_IFINDEX will be on %NL80211_ATTR_WIPHY_FREQ
655 * after %NL80211_ATTR_CH_SWITCH_COUNT TBTT's. The userspace may
656 * decide to react to this indication by requesting other
657 * interfaces to change channel as well.
643 * 658 *
644 * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by 659 * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by
645 * its %NL80211_ATTR_WDEV identifier. It must have been created with 660 * its %NL80211_ATTR_WDEV identifier. It must have been created with
@@ -738,6 +753,27 @@
738 * before removing a station entry entirely, or before disassociating 753 * before removing a station entry entirely, or before disassociating
739 * or similar, cleanup will happen in the driver/device in this case. 754 * or similar, cleanup will happen in the driver/device in this case.
740 * 755 *
756 * @NL80211_CMD_GET_MPP: Get mesh path attributes for mesh proxy path to
757 * destination %NL80211_ATTR_MAC on the interface identified by
758 * %NL80211_ATTR_IFINDEX.
759 *
760 * @NL80211_CMD_JOIN_OCB: Join the OCB network. The center frequency and
761 * bandwidth of a channel must be given.
762 * @NL80211_CMD_LEAVE_OCB: Leave the OCB network -- no special arguments, the
763 * network is determined by the network interface.
764 *
765 * @NL80211_CMD_TDLS_CHANNEL_SWITCH: Start channel-switching with a TDLS peer,
766 * identified by the %NL80211_ATTR_MAC parameter. A target channel is
767 * provided via %NL80211_ATTR_WIPHY_FREQ and other attributes determining
768 * channel width/type. The target operating class is given via
769 * %NL80211_ATTR_OPER_CLASS.
770 * The driver is responsible for continually initiating channel-switching
771 * operations and returning to the base channel for communication with the
772 * AP.
773 * @NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH: Stop channel-switching with a TDLS
774 * peer given by %NL80211_ATTR_MAC. Both peers must be on the base channel
775 * when this command completes.
776 *
741 * @NL80211_CMD_MAX: highest used command number 777 * @NL80211_CMD_MAX: highest used command number
742 * @__NL80211_CMD_AFTER_LAST: internal use 778 * @__NL80211_CMD_AFTER_LAST: internal use
743 */ 779 */
@@ -912,6 +948,16 @@ enum nl80211_commands {
912 NL80211_CMD_ADD_TX_TS, 948 NL80211_CMD_ADD_TX_TS,
913 NL80211_CMD_DEL_TX_TS, 949 NL80211_CMD_DEL_TX_TS,
914 950
951 NL80211_CMD_GET_MPP,
952
953 NL80211_CMD_JOIN_OCB,
954 NL80211_CMD_LEAVE_OCB,
955
956 NL80211_CMD_CH_SWITCH_STARTED_NOTIFY,
957
958 NL80211_CMD_TDLS_CHANNEL_SWITCH,
959 NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH,
960
915 /* add new commands above here */ 961 /* add new commands above here */
916 962
917 /* used to define NL80211_CMD_MAX below */ 963 /* used to define NL80211_CMD_MAX below */
@@ -1606,9 +1652,9 @@ enum nl80211_commands {
1606 * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32. 1652 * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32.
1607 * As specified in the &enum nl80211_tdls_peer_capability. 1653 * As specified in the &enum nl80211_tdls_peer_capability.
1608 * 1654 *
1609 * @NL80211_ATTR_IFACE_SOCKET_OWNER: flag attribute, if set during interface 1655 * @NL80211_ATTR_SOCKET_OWNER: Flag attribute, if set during interface
1610 * creation then the new interface will be owned by the netlink socket 1656 * creation then the new interface will be owned by the netlink socket
1611 * that created it and will be destroyed when the socket is closed 1657 * that created it and will be destroyed when the socket is closed.
1612 * 1658 *
1613 * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is 1659 * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
1614 * the TDLS link initiator. 1660 * the TDLS link initiator.
@@ -1638,6 +1684,11 @@ enum nl80211_commands {
1638 * @NL80211_ATTR_SMPS_MODE: SMPS mode to use (ap mode). see 1684 * @NL80211_ATTR_SMPS_MODE: SMPS mode to use (ap mode). see
1639 * &enum nl80211_smps_mode. 1685 * &enum nl80211_smps_mode.
1640 * 1686 *
1687 * @NL80211_ATTR_OPER_CLASS: operating class
1688 *
1689 * @NL80211_ATTR_MAC_MASK: MAC address mask
1690 *
1691 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
1641 * @NL80211_ATTR_MAX: highest attribute number currently defined 1692 * @NL80211_ATTR_MAX: highest attribute number currently defined
1642 * @__NL80211_ATTR_AFTER_LAST: internal use 1693 * @__NL80211_ATTR_AFTER_LAST: internal use
1643 */ 1694 */
@@ -1973,7 +2024,7 @@ enum nl80211_attrs {
1973 2024
1974 NL80211_ATTR_TDLS_PEER_CAPABILITY, 2025 NL80211_ATTR_TDLS_PEER_CAPABILITY,
1975 2026
1976 NL80211_ATTR_IFACE_SOCKET_OWNER, 2027 NL80211_ATTR_SOCKET_OWNER,
1977 2028
1978 NL80211_ATTR_CSA_C_OFFSETS_TX, 2029 NL80211_ATTR_CSA_C_OFFSETS_TX,
1979 NL80211_ATTR_MAX_CSA_COUNTERS, 2030 NL80211_ATTR_MAX_CSA_COUNTERS,
@@ -1990,15 +2041,21 @@ enum nl80211_attrs {
1990 2041
1991 NL80211_ATTR_SMPS_MODE, 2042 NL80211_ATTR_SMPS_MODE,
1992 2043
2044 NL80211_ATTR_OPER_CLASS,
2045
2046 NL80211_ATTR_MAC_MASK,
2047
1993 /* add attributes here, update the policy in nl80211.c */ 2048 /* add attributes here, update the policy in nl80211.c */
1994 2049
1995 __NL80211_ATTR_AFTER_LAST, 2050 __NL80211_ATTR_AFTER_LAST,
2051 NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST,
1996 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 2052 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
1997}; 2053};
1998 2054
1999/* source-level API compatibility */ 2055/* source-level API compatibility */
2000#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION 2056#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
2001#define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG 2057#define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG
2058#define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
2002 2059
2003/* 2060/*
2004 * Allow user space programs to use #ifdef on new attributes by defining them 2061 * Allow user space programs to use #ifdef on new attributes by defining them
@@ -2064,6 +2121,8 @@ enum nl80211_attrs {
2064 * and therefore can't be created in the normal ways, use the 2121 * and therefore can't be created in the normal ways, use the
2065 * %NL80211_CMD_START_P2P_DEVICE and %NL80211_CMD_STOP_P2P_DEVICE 2122 * %NL80211_CMD_START_P2P_DEVICE and %NL80211_CMD_STOP_P2P_DEVICE
2066 * commands to create and destroy one 2123 * commands to create and destroy one
2124 * @NL80211_IF_TYPE_OCB: Outside Context of a BSS
2125 * This mode corresponds to the MIB variable dot11OCBActivated=true
2067 * @NL80211_IFTYPE_MAX: highest interface type number currently defined 2126 * @NL80211_IFTYPE_MAX: highest interface type number currently defined
2068 * @NUM_NL80211_IFTYPES: number of defined interface types 2127 * @NUM_NL80211_IFTYPES: number of defined interface types
2069 * 2128 *
@@ -2083,6 +2142,7 @@ enum nl80211_iftype {
2083 NL80211_IFTYPE_P2P_CLIENT, 2142 NL80211_IFTYPE_P2P_CLIENT,
2084 NL80211_IFTYPE_P2P_GO, 2143 NL80211_IFTYPE_P2P_GO,
2085 NL80211_IFTYPE_P2P_DEVICE, 2144 NL80211_IFTYPE_P2P_DEVICE,
2145 NL80211_IFTYPE_OCB,
2086 2146
2087 /* keep last */ 2147 /* keep last */
2088 NUM_NL80211_IFTYPES, 2148 NUM_NL80211_IFTYPES,
@@ -2631,6 +2691,11 @@ enum nl80211_sched_scan_match_attr {
2631 * @NL80211_RRF_AUTO_BW: maximum available bandwidth should be calculated 2691 * @NL80211_RRF_AUTO_BW: maximum available bandwidth should be calculated
2632 * base on contiguous rules and wider channels will be allowed to cross 2692 * base on contiguous rules and wider channels will be allowed to cross
2633 * multiple contiguous/overlapping frequency ranges. 2693 * multiple contiguous/overlapping frequency ranges.
2694 * @NL80211_RRF_GO_CONCURRENT: See &NL80211_FREQUENCY_ATTR_GO_CONCURRENT
2695 * @NL80211_RRF_NO_HT40MINUS: channels can't be used in HT40- operation
2696 * @NL80211_RRF_NO_HT40PLUS: channels can't be used in HT40+ operation
2697 * @NL80211_RRF_NO_80MHZ: 80MHz operation not allowed
2698 * @NL80211_RRF_NO_160MHZ: 160MHz operation not allowed
2634 */ 2699 */
2635enum nl80211_reg_rule_flags { 2700enum nl80211_reg_rule_flags {
2636 NL80211_RRF_NO_OFDM = 1<<0, 2701 NL80211_RRF_NO_OFDM = 1<<0,
@@ -2643,11 +2708,18 @@ enum nl80211_reg_rule_flags {
2643 NL80211_RRF_NO_IR = 1<<7, 2708 NL80211_RRF_NO_IR = 1<<7,
2644 __NL80211_RRF_NO_IBSS = 1<<8, 2709 __NL80211_RRF_NO_IBSS = 1<<8,
2645 NL80211_RRF_AUTO_BW = 1<<11, 2710 NL80211_RRF_AUTO_BW = 1<<11,
2711 NL80211_RRF_GO_CONCURRENT = 1<<12,
2712 NL80211_RRF_NO_HT40MINUS = 1<<13,
2713 NL80211_RRF_NO_HT40PLUS = 1<<14,
2714 NL80211_RRF_NO_80MHZ = 1<<15,
2715 NL80211_RRF_NO_160MHZ = 1<<16,
2646}; 2716};
2647 2717
2648#define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR 2718#define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR
2649#define NL80211_RRF_NO_IBSS NL80211_RRF_NO_IR 2719#define NL80211_RRF_NO_IBSS NL80211_RRF_NO_IR
2650#define NL80211_RRF_NO_IR NL80211_RRF_NO_IR 2720#define NL80211_RRF_NO_IR NL80211_RRF_NO_IR
2721#define NL80211_RRF_NO_HT40 (NL80211_RRF_NO_HT40MINUS |\
2722 NL80211_RRF_NO_HT40PLUS)
2651 2723
2652/* For backport compatibility with older userspace */ 2724/* For backport compatibility with older userspace */
2653#define NL80211_RRF_NO_IR_ALL (NL80211_RRF_NO_IR | __NL80211_RRF_NO_IBSS) 2725#define NL80211_RRF_NO_IR_ALL (NL80211_RRF_NO_IR | __NL80211_RRF_NO_IBSS)
@@ -3379,6 +3451,8 @@ enum nl80211_ps_state {
3379 * interval in which %NL80211_ATTR_CQM_TXE_PKTS and 3451 * interval in which %NL80211_ATTR_CQM_TXE_PKTS and
3380 * %NL80211_ATTR_CQM_TXE_RATE must be satisfied before generating an 3452 * %NL80211_ATTR_CQM_TXE_RATE must be satisfied before generating an
3381 * %NL80211_CMD_NOTIFY_CQM. Set to 0 to turn off TX error reporting. 3453 * %NL80211_CMD_NOTIFY_CQM. Set to 0 to turn off TX error reporting.
3454 * @NL80211_ATTR_CQM_BEACON_LOSS_EVENT: flag attribute that's set in a beacon
3455 * loss event
3382 * @__NL80211_ATTR_CQM_AFTER_LAST: internal 3456 * @__NL80211_ATTR_CQM_AFTER_LAST: internal
3383 * @NL80211_ATTR_CQM_MAX: highest key attribute 3457 * @NL80211_ATTR_CQM_MAX: highest key attribute
3384 */ 3458 */
@@ -3391,6 +3465,7 @@ enum nl80211_attr_cqm {
3391 NL80211_ATTR_CQM_TXE_RATE, 3465 NL80211_ATTR_CQM_TXE_RATE,
3392 NL80211_ATTR_CQM_TXE_PKTS, 3466 NL80211_ATTR_CQM_TXE_PKTS,
3393 NL80211_ATTR_CQM_TXE_INTVL, 3467 NL80211_ATTR_CQM_TXE_INTVL,
3468 NL80211_ATTR_CQM_BEACON_LOSS_EVENT,
3394 3469
3395 /* keep last */ 3470 /* keep last */
3396 __NL80211_ATTR_CQM_AFTER_LAST, 3471 __NL80211_ATTR_CQM_AFTER_LAST,
@@ -3403,9 +3478,7 @@ enum nl80211_attr_cqm {
3403 * configured threshold 3478 * configured threshold
3404 * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH: The RSSI is higher than the 3479 * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH: The RSSI is higher than the
3405 * configured threshold 3480 * configured threshold
3406 * @NL80211_CQM_RSSI_BEACON_LOSS_EVENT: The device experienced beacon loss. 3481 * @NL80211_CQM_RSSI_BEACON_LOSS_EVENT: (reserved, never sent)
3407 * (Note that deauth/disassoc will still follow if the AP is not
3408 * available. This event might get used as roaming event, etc.)
3409 */ 3482 */
3410enum nl80211_cqm_rssi_threshold_event { 3483enum nl80211_cqm_rssi_threshold_event {
3411 NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, 3484 NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
@@ -3545,6 +3618,25 @@ struct nl80211_pattern_support {
3545 * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS: For wakeup reporting only, 3618 * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS: For wakeup reporting only,
3546 * the TCP connection ran out of tokens to use for data to send to the 3619 * the TCP connection ran out of tokens to use for data to send to the
3547 * service 3620 * service
3621 * @NL80211_WOWLAN_TRIG_NET_DETECT: wake up when a configured network
3622 * is detected. This is a nested attribute that contains the
3623 * same attributes used with @NL80211_CMD_START_SCHED_SCAN. It
3624 * specifies how the scan is performed (e.g. the interval and the
3625 * channels to scan) as well as the scan results that will
3626 * trigger a wake (i.e. the matchsets).
3627 * @NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS: nested attribute
3628 * containing an array with information about what triggered the
3629 * wake up. If no elements are present in the array, it means
3630 * that the information is not available. If more than one
3631 * element is present, it means that more than one match
3632 * occurred.
3633 * Each element in the array is a nested attribute that contains
3634 * one optional %NL80211_ATTR_SSID attribute and one optional
3635 * %NL80211_ATTR_SCAN_FREQUENCIES attribute. At least one of
3636 * these attributes must be present. If
3637 * %NL80211_ATTR_SCAN_FREQUENCIES contains more than one
3638 * frequency, it means that the match occurred in more than one
3639 * channel.
3548 * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers 3640 * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers
3549 * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number 3641 * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number
3550 * 3642 *
@@ -3570,6 +3662,8 @@ enum nl80211_wowlan_triggers {
3570 NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH, 3662 NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH,
3571 NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST, 3663 NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST,
3572 NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS, 3664 NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS,
3665 NL80211_WOWLAN_TRIG_NET_DETECT,
3666 NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS,
3573 3667
3574 /* keep last */ 3668 /* keep last */
3575 NUM_NL80211_WOWLAN_TRIG, 3669 NUM_NL80211_WOWLAN_TRIG,
@@ -4042,6 +4136,27 @@ enum nl80211_ap_sme_features {
4042 * multiplexing powersave, ie. can turn off all but one chain 4136 * multiplexing powersave, ie. can turn off all but one chain
4043 * and then wake the rest up as required after, for example, 4137 * and then wake the rest up as required after, for example,
4044 * rts/cts handshake. 4138 * rts/cts handshake.
4139 * @NL80211_FEATURE_SUPPORTS_WMM_ADMISSION: the device supports setting up WMM
4140 * TSPEC sessions (TID aka TSID 0-7) with the %NL80211_CMD_ADD_TX_TS
4141 * command. Standard IEEE 802.11 TSPEC setup is not yet supported, it
4142 * needs to be able to handle Block-Ack agreements and other things.
4143 * @NL80211_FEATURE_MAC_ON_CREATE: Device supports configuring
4144 * the vif's MAC address upon creation.
4145 * See 'macaddr' field in the vif_params (cfg80211.h).
4146 * @NL80211_FEATURE_TDLS_CHANNEL_SWITCH: Driver supports channel switching when
4147 * operating as a TDLS peer.
4148 * @NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR: This device/driver supports using a
4149 * random MAC address during scan (if the device is unassociated); the
4150 * %NL80211_SCAN_FLAG_RANDOM_ADDR flag may be set for scans and the MAC
4151 * address mask/value will be used.
4152 * @NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR: This device/driver supports
4153 * using a random MAC address for every scan iteration during scheduled
4154 * scan (while not associated), the %NL80211_SCAN_FLAG_RANDOM_ADDR may
4155 * be set for scheduled scan and the MAC address mask/value will be used.
4156 * @NL80211_FEATURE_ND_RANDOM_MAC_ADDR: This device/driver supports using a
4157 * random MAC address for every scan iteration during "net detect", i.e.
4158 * scan in unassociated WoWLAN, the %NL80211_SCAN_FLAG_RANDOM_ADDR may
4159 * be set for scheduled scan and the MAC address mask/value will be used.
4045 */ 4160 */
4046enum nl80211_feature_flags { 4161enum nl80211_feature_flags {
4047 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 4162 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
@@ -4070,6 +4185,12 @@ enum nl80211_feature_flags {
4070 NL80211_FEATURE_ACKTO_ESTIMATION = 1 << 23, 4185 NL80211_FEATURE_ACKTO_ESTIMATION = 1 << 23,
4071 NL80211_FEATURE_STATIC_SMPS = 1 << 24, 4186 NL80211_FEATURE_STATIC_SMPS = 1 << 24,
4072 NL80211_FEATURE_DYNAMIC_SMPS = 1 << 25, 4187 NL80211_FEATURE_DYNAMIC_SMPS = 1 << 25,
4188 NL80211_FEATURE_SUPPORTS_WMM_ADMISSION = 1 << 26,
4189 NL80211_FEATURE_MAC_ON_CREATE = 1 << 27,
4190 NL80211_FEATURE_TDLS_CHANNEL_SWITCH = 1 << 28,
4191 NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR = 1 << 29,
4192 NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR = 1 << 30,
4193 NL80211_FEATURE_ND_RANDOM_MAC_ADDR = 1 << 31,
4073}; 4194};
4074 4195
4075/** 4196/**
@@ -4118,11 +4239,21 @@ enum nl80211_connect_failed_reason {
4118 * dangerous because will destroy stations performance as a lot of frames 4239 * dangerous because will destroy stations performance as a lot of frames
4119 * will be lost while scanning off-channel, therefore it must be used only 4240 * will be lost while scanning off-channel, therefore it must be used only
4120 * when really needed 4241 * when really needed
4242 * @NL80211_SCAN_FLAG_RANDOM_ADDR: use a random MAC address for this scan (or
4243 * for scheduled scan: a different one for every scan iteration). When the
4244 * flag is set, depending on device capabilities the @NL80211_ATTR_MAC and
4245 * @NL80211_ATTR_MAC_MASK attributes may also be given in which case only
4246 * the masked bits will be preserved from the MAC address and the remainder
4247 * randomised. If the attributes are not given full randomisation (46 bits,
4248 * locally administered 1, multicast 0) is assumed.
4249 * This flag must not be requested when the feature isn't supported, check
4250 * the nl80211 feature flags for the device.
4121 */ 4251 */
4122enum nl80211_scan_flags { 4252enum nl80211_scan_flags {
4123 NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0, 4253 NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0,
4124 NL80211_SCAN_FLAG_FLUSH = 1<<1, 4254 NL80211_SCAN_FLAG_FLUSH = 1<<1,
4125 NL80211_SCAN_FLAG_AP = 1<<2, 4255 NL80211_SCAN_FLAG_AP = 1<<2,
4256 NL80211_SCAN_FLAG_RANDOM_ADDR = 1<<3,
4126}; 4257};
4127 4258
4128/** 4259/**
diff --git a/include/uapi/linux/nvme.h b/include/uapi/linux/nvme.h
index 29a7d8619d8d..26386cf3db44 100644
--- a/include/uapi/linux/nvme.h
+++ b/include/uapi/linux/nvme.h
@@ -181,6 +181,22 @@ enum {
181 NVME_LBART_ATTRIB_HIDE = 1 << 1, 181 NVME_LBART_ATTRIB_HIDE = 1 << 1,
182}; 182};
183 183
184struct nvme_reservation_status {
185 __le32 gen;
186 __u8 rtype;
187 __u8 regctl[2];
188 __u8 resv5[2];
189 __u8 ptpls;
190 __u8 resv10[13];
191 struct {
192 __le16 cntlid;
193 __u8 rcsts;
194 __u8 resv3[5];
195 __le64 hostid;
196 __le64 rkey;
197 } regctl_ds[];
198};
199
184/* I/O commands */ 200/* I/O commands */
185 201
186enum nvme_opcode { 202enum nvme_opcode {
@@ -189,7 +205,12 @@ enum nvme_opcode {
189 nvme_cmd_read = 0x02, 205 nvme_cmd_read = 0x02,
190 nvme_cmd_write_uncor = 0x04, 206 nvme_cmd_write_uncor = 0x04,
191 nvme_cmd_compare = 0x05, 207 nvme_cmd_compare = 0x05,
208 nvme_cmd_write_zeroes = 0x08,
192 nvme_cmd_dsm = 0x09, 209 nvme_cmd_dsm = 0x09,
210 nvme_cmd_resv_register = 0x0d,
211 nvme_cmd_resv_report = 0x0e,
212 nvme_cmd_resv_acquire = 0x11,
213 nvme_cmd_resv_release = 0x15,
193}; 214};
194 215
195struct nvme_common_command { 216struct nvme_common_command {
@@ -305,7 +326,11 @@ enum {
305 NVME_FEAT_IRQ_CONFIG = 0x09, 326 NVME_FEAT_IRQ_CONFIG = 0x09,
306 NVME_FEAT_WRITE_ATOMIC = 0x0a, 327 NVME_FEAT_WRITE_ATOMIC = 0x0a,
307 NVME_FEAT_ASYNC_EVENT = 0x0b, 328 NVME_FEAT_ASYNC_EVENT = 0x0b,
308 NVME_FEAT_SW_PROGRESS = 0x0c, 329 NVME_FEAT_AUTO_PST = 0x0c,
330 NVME_FEAT_SW_PROGRESS = 0x80,
331 NVME_FEAT_HOST_ID = 0x81,
332 NVME_FEAT_RESV_MASK = 0x82,
333 NVME_FEAT_RESV_PERSIST = 0x83,
309 NVME_LOG_ERROR = 0x01, 334 NVME_LOG_ERROR = 0x01,
310 NVME_LOG_SMART = 0x02, 335 NVME_LOG_SMART = 0x02,
311 NVME_LOG_FW_SLOT = 0x03, 336 NVME_LOG_FW_SLOT = 0x03,
@@ -440,9 +465,15 @@ enum {
440 NVME_SC_FUSED_MISSING = 0xa, 465 NVME_SC_FUSED_MISSING = 0xa,
441 NVME_SC_INVALID_NS = 0xb, 466 NVME_SC_INVALID_NS = 0xb,
442 NVME_SC_CMD_SEQ_ERROR = 0xc, 467 NVME_SC_CMD_SEQ_ERROR = 0xc,
468 NVME_SC_SGL_INVALID_LAST = 0xd,
469 NVME_SC_SGL_INVALID_COUNT = 0xe,
470 NVME_SC_SGL_INVALID_DATA = 0xf,
471 NVME_SC_SGL_INVALID_METADATA = 0x10,
472 NVME_SC_SGL_INVALID_TYPE = 0x11,
443 NVME_SC_LBA_RANGE = 0x80, 473 NVME_SC_LBA_RANGE = 0x80,
444 NVME_SC_CAP_EXCEEDED = 0x81, 474 NVME_SC_CAP_EXCEEDED = 0x81,
445 NVME_SC_NS_NOT_READY = 0x82, 475 NVME_SC_NS_NOT_READY = 0x82,
476 NVME_SC_RESERVATION_CONFLICT = 0x83,
446 NVME_SC_CQ_INVALID = 0x100, 477 NVME_SC_CQ_INVALID = 0x100,
447 NVME_SC_QID_INVALID = 0x101, 478 NVME_SC_QID_INVALID = 0x101,
448 NVME_SC_QUEUE_SIZE = 0x102, 479 NVME_SC_QUEUE_SIZE = 0x102,
@@ -454,7 +485,15 @@ enum {
454 NVME_SC_INVALID_VECTOR = 0x108, 485 NVME_SC_INVALID_VECTOR = 0x108,
455 NVME_SC_INVALID_LOG_PAGE = 0x109, 486 NVME_SC_INVALID_LOG_PAGE = 0x109,
456 NVME_SC_INVALID_FORMAT = 0x10a, 487 NVME_SC_INVALID_FORMAT = 0x10a,
488 NVME_SC_FIRMWARE_NEEDS_RESET = 0x10b,
489 NVME_SC_INVALID_QUEUE = 0x10c,
490 NVME_SC_FEATURE_NOT_SAVEABLE = 0x10d,
491 NVME_SC_FEATURE_NOT_CHANGEABLE = 0x10e,
492 NVME_SC_FEATURE_NOT_PER_NS = 0x10f,
493 NVME_SC_FW_NEEDS_RESET_SUBSYS = 0x110,
457 NVME_SC_BAD_ATTRIBUTES = 0x180, 494 NVME_SC_BAD_ATTRIBUTES = 0x180,
495 NVME_SC_INVALID_PI = 0x181,
496 NVME_SC_READ_ONLY = 0x182,
458 NVME_SC_WRITE_FAULT = 0x280, 497 NVME_SC_WRITE_FAULT = 0x280,
459 NVME_SC_READ_ERROR = 0x281, 498 NVME_SC_READ_ERROR = 0x281,
460 NVME_SC_GUARD_CHECK = 0x282, 499 NVME_SC_GUARD_CHECK = 0x282,
@@ -489,7 +528,7 @@ struct nvme_user_io {
489 __u16 appmask; 528 __u16 appmask;
490}; 529};
491 530
492struct nvme_admin_cmd { 531struct nvme_passthru_cmd {
493 __u8 opcode; 532 __u8 opcode;
494 __u8 flags; 533 __u8 flags;
495 __u16 rsvd1; 534 __u16 rsvd1;
@@ -510,8 +549,11 @@ struct nvme_admin_cmd {
510 __u32 result; 549 __u32 result;
511}; 550};
512 551
552#define nvme_admin_cmd nvme_passthru_cmd
553
513#define NVME_IOCTL_ID _IO('N', 0x40) 554#define NVME_IOCTL_ID _IO('N', 0x40)
514#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd) 555#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd)
515#define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io) 556#define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io)
557#define NVME_IOCTL_IO_CMD _IOWR('N', 0x43, struct nvme_passthru_cmd)
516 558
517#endif /* _UAPI_LINUX_NVME_H */ 559#endif /* _UAPI_LINUX_NVME_H */
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 435eabc5ffaa..3a6dcaa359b7 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -157,6 +157,11 @@ enum ovs_packet_cmd {
157 * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an 157 * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an
158 * %OVS_USERSPACE_ATTR_USERDATA attribute, with the same length and content 158 * %OVS_USERSPACE_ATTR_USERDATA attribute, with the same length and content
159 * specified there. 159 * specified there.
160 * @OVS_PACKET_ATTR_EGRESS_TUN_KEY: Present for an %OVS_PACKET_CMD_ACTION
161 * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an
162 * %OVS_USERSPACE_ATTR_EGRESS_TUN_PORT attribute, which is sent only if the
163 * output port is actually a tunnel port. Contains the output tunnel key
164 * extracted from the packet as nested %OVS_TUNNEL_KEY_ATTR_* attributes.
160 * 165 *
161 * These attributes follow the &struct ovs_header within the Generic Netlink 166 * These attributes follow the &struct ovs_header within the Generic Netlink
162 * payload for %OVS_PACKET_* commands. 167 * payload for %OVS_PACKET_* commands.
@@ -167,6 +172,8 @@ enum ovs_packet_attr {
167 OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */ 172 OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */
168 OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ 173 OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
169 OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */ 174 OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */
175 OVS_PACKET_ATTR_EGRESS_TUN_KEY, /* Nested OVS_TUNNEL_KEY_ATTR_*
176 attributes. */
170 __OVS_PACKET_ATTR_MAX 177 __OVS_PACKET_ATTR_MAX
171}; 178};
172 179
@@ -293,6 +300,9 @@ enum ovs_key_attr {
293 OVS_KEY_ATTR_DP_HASH, /* u32 hash value. Value 0 indicates the hash 300 OVS_KEY_ATTR_DP_HASH, /* u32 hash value. Value 0 indicates the hash
294 is not computed by the datapath. */ 301 is not computed by the datapath. */
295 OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */ 302 OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */
303 OVS_KEY_ATTR_MPLS, /* array of struct ovs_key_mpls.
304 * The implementation may restrict
305 * the accepted length of the array. */
296 306
297#ifdef __KERNEL__ 307#ifdef __KERNEL__
298 OVS_KEY_ATTR_TUNNEL_INFO, /* struct ovs_tunnel_info */ 308 OVS_KEY_ATTR_TUNNEL_INFO, /* struct ovs_tunnel_info */
@@ -312,6 +322,8 @@ enum ovs_tunnel_key_attr {
312 OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */ 322 OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */
313 OVS_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */ 323 OVS_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */
314 OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS, /* Array of Geneve options. */ 324 OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS, /* Array of Geneve options. */
325 OVS_TUNNEL_KEY_ATTR_TP_SRC, /* be16 src Transport Port. */
326 OVS_TUNNEL_KEY_ATTR_TP_DST, /* be16 dst Transport Port. */
315 __OVS_TUNNEL_KEY_ATTR_MAX 327 __OVS_TUNNEL_KEY_ATTR_MAX
316}; 328};
317 329
@@ -340,6 +352,10 @@ struct ovs_key_ethernet {
340 __u8 eth_dst[ETH_ALEN]; 352 __u8 eth_dst[ETH_ALEN];
341}; 353};
342 354
355struct ovs_key_mpls {
356 __be32 mpls_lse;
357};
358
343struct ovs_key_ipv4 { 359struct ovs_key_ipv4 {
344 __be32 ipv4_src; 360 __be32 ipv4_src;
345 __be32 ipv4_dst; 361 __be32 ipv4_dst;
@@ -393,9 +409,9 @@ struct ovs_key_arp {
393}; 409};
394 410
395struct ovs_key_nd { 411struct ovs_key_nd {
396 __u32 nd_target[4]; 412 __be32 nd_target[4];
397 __u8 nd_sll[ETH_ALEN]; 413 __u8 nd_sll[ETH_ALEN];
398 __u8 nd_tll[ETH_ALEN]; 414 __u8 nd_tll[ETH_ALEN];
399}; 415};
400 416
401/** 417/**
@@ -441,6 +457,8 @@ enum ovs_flow_attr {
441 OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */ 457 OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */
442 OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */ 458 OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */
443 OVS_FLOW_ATTR_MASK, /* Sequence of OVS_KEY_ATTR_* attributes. */ 459 OVS_FLOW_ATTR_MASK, /* Sequence of OVS_KEY_ATTR_* attributes. */
460 OVS_FLOW_ATTR_PROBE, /* Flow operation is a feature probe, error
461 * logging should be suppressed. */
444 __OVS_FLOW_ATTR_MAX 462 __OVS_FLOW_ATTR_MAX
445}; 463};
446 464
@@ -473,17 +491,34 @@ enum ovs_sample_attr {
473 * message should be sent. Required. 491 * message should be sent. Required.
474 * @OVS_USERSPACE_ATTR_USERDATA: If present, its variable-length argument is 492 * @OVS_USERSPACE_ATTR_USERDATA: If present, its variable-length argument is
475 * copied to the %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA. 493 * copied to the %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA.
494 * @OVS_USERSPACE_ATTR_EGRESS_TUN_PORT: If present, u32 output port to get
495 * tunnel info.
476 */ 496 */
477enum ovs_userspace_attr { 497enum ovs_userspace_attr {
478 OVS_USERSPACE_ATTR_UNSPEC, 498 OVS_USERSPACE_ATTR_UNSPEC,
479 OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */ 499 OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */
480 OVS_USERSPACE_ATTR_USERDATA, /* Optional user-specified cookie. */ 500 OVS_USERSPACE_ATTR_USERDATA, /* Optional user-specified cookie. */
501 OVS_USERSPACE_ATTR_EGRESS_TUN_PORT, /* Optional, u32 output port
502 * to get tunnel info. */
481 __OVS_USERSPACE_ATTR_MAX 503 __OVS_USERSPACE_ATTR_MAX
482}; 504};
483 505
484#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) 506#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1)
485 507
486/** 508/**
509 * struct ovs_action_push_mpls - %OVS_ACTION_ATTR_PUSH_MPLS action argument.
510 * @mpls_lse: MPLS label stack entry to push.
511 * @mpls_ethertype: Ethertype to set in the encapsulating ethernet frame.
512 *
513 * The only values @mpls_ethertype should ever be given are %ETH_P_MPLS_UC and
514 * %ETH_P_MPLS_MC, indicating MPLS unicast or multicast. Other are rejected.
515 */
516struct ovs_action_push_mpls {
517 __be32 mpls_lse;
518 __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */
519};
520
521/**
487 * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument. 522 * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument.
488 * @vlan_tpid: Tag protocol identifier (TPID) to push. 523 * @vlan_tpid: Tag protocol identifier (TPID) to push.
489 * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set 524 * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set
@@ -534,6 +569,15 @@ struct ovs_action_hash {
534 * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet. 569 * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet.
535 * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in 570 * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in
536 * the nested %OVS_SAMPLE_ATTR_* attributes. 571 * the nested %OVS_SAMPLE_ATTR_* attributes.
572 * @OVS_ACTION_ATTR_PUSH_MPLS: Push a new MPLS label stack entry onto the
573 * top of the packets MPLS label stack. Set the ethertype of the
574 * encapsulating frame to either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC to
575 * indicate the new packet contents.
576 * @OVS_ACTION_ATTR_POP_MPLS: Pop an MPLS label stack entry off of the
577 * packet's MPLS label stack. Set the encapsulating frame's ethertype to
578 * indicate the new packet contents. This could potentially still be
579 * %ETH_P_MPLS if the resulting MPLS label stack is not empty. If there
580 * is no MPLS label stack, as determined by ethertype, no action is taken.
537 * 581 *
538 * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all 582 * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all
539 * fields within a header are modifiable, e.g. the IPv4 protocol and fragment 583 * fields within a header are modifiable, e.g. the IPv4 protocol and fragment
@@ -550,6 +594,9 @@ enum ovs_action_attr {
550 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */ 594 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */
551 OVS_ACTION_ATTR_RECIRC, /* u32 recirc_id. */ 595 OVS_ACTION_ATTR_RECIRC, /* u32 recirc_id. */
552 OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */ 596 OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */
597 OVS_ACTION_ATTR_PUSH_MPLS, /* struct ovs_action_push_mpls. */
598 OVS_ACTION_ATTR_POP_MPLS, /* __be16 ethertype. */
599
553 __OVS_ACTION_ATTR_MAX 600 __OVS_ACTION_ATTR_MAX
554}; 601};
555 602
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 9d845404d875..9b79abbd1ab8 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -137,8 +137,9 @@ enum perf_event_sample_format {
137 PERF_SAMPLE_DATA_SRC = 1U << 15, 137 PERF_SAMPLE_DATA_SRC = 1U << 15,
138 PERF_SAMPLE_IDENTIFIER = 1U << 16, 138 PERF_SAMPLE_IDENTIFIER = 1U << 16,
139 PERF_SAMPLE_TRANSACTION = 1U << 17, 139 PERF_SAMPLE_TRANSACTION = 1U << 17,
140 PERF_SAMPLE_REGS_INTR = 1U << 18,
140 141
141 PERF_SAMPLE_MAX = 1U << 18, /* non-ABI */ 142 PERF_SAMPLE_MAX = 1U << 19, /* non-ABI */
142}; 143};
143 144
144/* 145/*
@@ -238,6 +239,7 @@ enum perf_event_read_format {
238#define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */ 239#define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */
239#define PERF_ATTR_SIZE_VER3 96 /* add: sample_regs_user */ 240#define PERF_ATTR_SIZE_VER3 96 /* add: sample_regs_user */
240 /* add: sample_stack_user */ 241 /* add: sample_stack_user */
242#define PERF_ATTR_SIZE_VER4 104 /* add: sample_regs_intr */
241 243
242/* 244/*
243 * Hardware event_id to monitor via a performance monitoring event: 245 * Hardware event_id to monitor via a performance monitoring event:
@@ -334,6 +336,15 @@ struct perf_event_attr {
334 336
335 /* Align to u64. */ 337 /* Align to u64. */
336 __u32 __reserved_2; 338 __u32 __reserved_2;
339 /*
340 * Defines set of regs to dump for each sample
341 * state captured on:
342 * - precise = 0: PMU interrupt
343 * - precise > 0: sampled instruction
344 *
345 * See asm/perf_regs.h for details.
346 */
347 __u64 sample_regs_intr;
337}; 348};
338 349
339#define perf_flags(attr) (*(&(attr)->read_format + 1)) 350#define perf_flags(attr) (*(&(attr)->read_format + 1))
@@ -686,6 +697,8 @@ enum perf_event_type {
686 * { u64 weight; } && PERF_SAMPLE_WEIGHT 697 * { u64 weight; } && PERF_SAMPLE_WEIGHT
687 * { u64 data_src; } && PERF_SAMPLE_DATA_SRC 698 * { u64 data_src; } && PERF_SAMPLE_DATA_SRC
688 * { u64 transaction; } && PERF_SAMPLE_TRANSACTION 699 * { u64 transaction; } && PERF_SAMPLE_TRANSACTION
700 * { u64 abi; # enum perf_sample_regs_abi
701 * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_INTR
689 * }; 702 * };
690 */ 703 */
691 PERF_RECORD_SAMPLE = 9, 704 PERF_RECORD_SAMPLE = 9,
diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h
index 513df75d0fc9..89f63503f903 100644
--- a/include/uapi/linux/prctl.h
+++ b/include/uapi/linux/prctl.h
@@ -179,4 +179,10 @@ struct prctl_mm_map {
179#define PR_SET_THP_DISABLE 41 179#define PR_SET_THP_DISABLE 41
180#define PR_GET_THP_DISABLE 42 180#define PR_GET_THP_DISABLE 42
181 181
182/*
183 * Tell the kernel to start/stop helping userspace manage bounds tables.
184 */
185#define PR_MPX_ENABLE_MANAGEMENT 43
186#define PR_MPX_DISABLE_MANAGEMENT 44
187
182#endif /* _LINUX_PRCTL_H */ 188#endif /* _LINUX_PRCTL_H */
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index eb0f1a554d7b..9c9b8b4480cd 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -235,6 +235,7 @@ enum {
235#define RTPROT_NTK 15 /* Netsukuku */ 235#define RTPROT_NTK 15 /* Netsukuku */
236#define RTPROT_DHCP 16 /* DHCP client */ 236#define RTPROT_DHCP 16 /* DHCP client */
237#define RTPROT_MROUTED 17 /* Multicast daemon */ 237#define RTPROT_MROUTED 17 /* Multicast daemon */
238#define RTPROT_BABEL 42 /* Babel daemon */
238 239
239/* rtm_scope 240/* rtm_scope
240 241
diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h
index b932be9f5c5b..cc89ddefa926 100644
--- a/include/uapi/linux/sched.h
+++ b/include/uapi/linux/sched.h
@@ -23,8 +23,8 @@
23#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */ 23#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
24/* 0x02000000 was previously the unused CLONE_STOPPED (Start in stopped state) 24/* 0x02000000 was previously the unused CLONE_STOPPED (Start in stopped state)
25 and is now available for re-use. */ 25 and is now available for re-use. */
26#define CLONE_NEWUTS 0x04000000 /* New utsname group? */ 26#define CLONE_NEWUTS 0x04000000 /* New utsname namespace */
27#define CLONE_NEWIPC 0x08000000 /* New ipcs */ 27#define CLONE_NEWIPC 0x08000000 /* New ipc namespace */
28#define CLONE_NEWUSER 0x10000000 /* New user namespace */ 28#define CLONE_NEWUSER 0x10000000 /* New user namespace */
29#define CLONE_NEWPID 0x20000000 /* New pid namespace */ 29#define CLONE_NEWPID 0x20000000 /* New pid namespace */
30#define CLONE_NEWNET 0x40000000 /* New network namespace */ 30#define CLONE_NEWNET 0x40000000 /* New network namespace */
diff --git a/include/uapi/linux/sem.h b/include/uapi/linux/sem.h
index 541fce03b50c..dd73b908b2f3 100644
--- a/include/uapi/linux/sem.h
+++ b/include/uapi/linux/sem.h
@@ -63,10 +63,22 @@ struct seminfo {
63 int semaem; 63 int semaem;
64}; 64};
65 65
66#define SEMMNI 128 /* <= IPCMNI max # of semaphore identifiers */ 66/*
67#define SEMMSL 250 /* <= 8 000 max num of semaphores per id */ 67 * SEMMNI, SEMMSL and SEMMNS are default values which can be
68 * modified by sysctl.
69 * The values has been chosen to be larger than necessary for any
70 * known configuration.
71 *
72 * SEMOPM should not be increased beyond 1000, otherwise there is the
73 * risk that semop()/semtimedop() fails due to kernel memory fragmentation when
74 * allocating the sop array.
75 */
76
77
78#define SEMMNI 32000 /* <= IPCMNI max # of semaphore identifiers */
79#define SEMMSL 32000 /* <= INT_MAX max num of semaphores per id */
68#define SEMMNS (SEMMNI*SEMMSL) /* <= INT_MAX max # of semaphores in system */ 80#define SEMMNS (SEMMNI*SEMMSL) /* <= INT_MAX max # of semaphores in system */
69#define SEMOPM 32 /* <= 1 000 max num of ops per semop call */ 81#define SEMOPM 500 /* <= 1 000 max num of ops per semop call */
70#define SEMVMX 32767 /* <= 32767 semaphore maximum value */ 82#define SEMVMX 32767 /* <= 32767 semaphore maximum value */
71#define SEMAEM SEMVMX /* adjust on exit max value */ 83#define SEMAEM SEMVMX /* adjust on exit max value */
72 84
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
index 16ad8521af6a..c17218094f18 100644
--- a/include/uapi/linux/serial_core.h
+++ b/include/uapi/linux/serial_core.h
@@ -54,7 +54,8 @@
54#define PORT_ALTR_16550_F32 26 /* Altera 16550 UART with 32 FIFOs */ 54#define PORT_ALTR_16550_F32 26 /* Altera 16550 UART with 32 FIFOs */
55#define PORT_ALTR_16550_F64 27 /* Altera 16550 UART with 64 FIFOs */ 55#define PORT_ALTR_16550_F64 27 /* Altera 16550 UART with 64 FIFOs */
56#define PORT_ALTR_16550_F128 28 /* Altera 16550 UART with 128 FIFOs */ 56#define PORT_ALTR_16550_F128 28 /* Altera 16550 UART with 128 FIFOs */
57#define PORT_MAX_8250 28 /* max port ID */ 57#define PORT_RT2880 29 /* Ralink RT2880 internal UART */
58#define PORT_MAX_8250 29 /* max port ID */
58 59
59/* 60/*
60 * ARM specific type numbers. These are not currently guaranteed 61 * ARM specific type numbers. These are not currently guaranteed
diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h
index df6c9ab6b0cd..53af3b790129 100644
--- a/include/uapi/linux/serial_reg.h
+++ b/include/uapi/linux/serial_reg.h
@@ -359,6 +359,7 @@
359#define UART_OMAP_SYSC 0x15 /* System configuration register */ 359#define UART_OMAP_SYSC 0x15 /* System configuration register */
360#define UART_OMAP_SYSS 0x16 /* System status register */ 360#define UART_OMAP_SYSS 0x16 /* System status register */
361#define UART_OMAP_WER 0x17 /* Wake-up enable register */ 361#define UART_OMAP_WER 0x17 /* Wake-up enable register */
362#define UART_OMAP_TX_LVL 0x1a /* TX FIFO level register */
362 363
363/* 364/*
364 * These are the definitions for the MDR1 register 365 * These are the definitions for the MDR1 register
diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h
index df40137f33dd..b22224100011 100644
--- a/include/uapi/linux/snmp.h
+++ b/include/uapi/linux/snmp.h
@@ -156,6 +156,7 @@ enum
156 UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */ 156 UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */
157 UDP_MIB_SNDBUFERRORS, /* SndbufErrors */ 157 UDP_MIB_SNDBUFERRORS, /* SndbufErrors */
158 UDP_MIB_CSUMERRORS, /* InCsumErrors */ 158 UDP_MIB_CSUMERRORS, /* InCsumErrors */
159 UDP_MIB_IGNOREDMULTI, /* IgnoredMulti */
159 __UDP_MIB_MAX 160 __UDP_MIB_MAX
160}; 161};
161 162
@@ -265,6 +266,10 @@ enum
265 LINUX_MIB_TCPWANTZEROWINDOWADV, /* TCPWantZeroWindowAdv */ 266 LINUX_MIB_TCPWANTZEROWINDOWADV, /* TCPWantZeroWindowAdv */
266 LINUX_MIB_TCPSYNRETRANS, /* TCPSynRetrans */ 267 LINUX_MIB_TCPSYNRETRANS, /* TCPSynRetrans */
267 LINUX_MIB_TCPORIGDATASENT, /* TCPOrigDataSent */ 268 LINUX_MIB_TCPORIGDATASENT, /* TCPOrigDataSent */
269 LINUX_MIB_TCPHYSTARTTRAINDETECT, /* TCPHystartTrainDetect */
270 LINUX_MIB_TCPHYSTARTTRAINCWND, /* TCPHystartTrainCwnd */
271 LINUX_MIB_TCPHYSTARTDELAYDETECT, /* TCPHystartDelayDetect */
272 LINUX_MIB_TCPHYSTARTDELAYCWND, /* TCPHystartDelayCwnd */
268 __LINUX_MIB_MAX 273 __LINUX_MIB_MAX
269}; 274};
270 275
diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h
index 43aaba1cc037..0956373b56db 100644
--- a/include/uapi/linux/sysctl.h
+++ b/include/uapi/linux/sysctl.h
@@ -153,6 +153,7 @@ enum
153 KERN_MAX_LOCK_DEPTH=74, /* int: rtmutex's maximum lock depth */ 153 KERN_MAX_LOCK_DEPTH=74, /* int: rtmutex's maximum lock depth */
154 KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */ 154 KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */
155 KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */ 155 KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
156 KERN_PANIC_ON_WARN=77, /* int: call panic() in WARN() functions */
156}; 157};
157 158
158 159
diff --git a/include/uapi/linux/tc_act/Kbuild b/include/uapi/linux/tc_act/Kbuild
index 56f121605c99..b057da2b87a4 100644
--- a/include/uapi/linux/tc_act/Kbuild
+++ b/include/uapi/linux/tc_act/Kbuild
@@ -7,3 +7,4 @@ header-y += tc_mirred.h
7header-y += tc_nat.h 7header-y += tc_nat.h
8header-y += tc_pedit.h 8header-y += tc_pedit.h
9header-y += tc_skbedit.h 9header-y += tc_skbedit.h
10header-y += tc_vlan.h
diff --git a/include/uapi/linux/tc_act/tc_vlan.h b/include/uapi/linux/tc_act/tc_vlan.h
new file mode 100644
index 000000000000..f7b8d448b960
--- /dev/null
+++ b/include/uapi/linux/tc_act/tc_vlan.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us>
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_TC_VLAN_H
11#define __LINUX_TC_VLAN_H
12
13#include <linux/pkt_cls.h>
14
15#define TCA_ACT_VLAN 12
16
17#define TCA_VLAN_ACT_POP 1
18#define TCA_VLAN_ACT_PUSH 2
19
20struct tc_vlan {
21 tc_gen;
22 int v_action;
23};
24
25enum {
26 TCA_VLAN_UNSPEC,
27 TCA_VLAN_TM,
28 TCA_VLAN_PARMS,
29 TCA_VLAN_PUSH_VLAN_ID,
30 TCA_VLAN_PUSH_VLAN_PROTOCOL,
31 __TCA_VLAN_MAX,
32};
33#define TCA_VLAN_MAX (__TCA_VLAN_MAX - 1)
34
35#endif
diff --git a/include/uapi/linux/tipc_netlink.h b/include/uapi/linux/tipc_netlink.h
new file mode 100644
index 000000000000..8d723824ad69
--- /dev/null
+++ b/include/uapi/linux/tipc_netlink.h
@@ -0,0 +1,244 @@
1/*
2 * Copyright (c) 2014, Ericsson AB
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the names of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * Alternatively, this software may be distributed under the terms of the
18 * GNU General Public License ("GPL") version 2 as published by the Free
19 * Software Foundation.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#ifndef _LINUX_TIPC_NETLINK_H_
35#define _LINUX_TIPC_NETLINK_H_
36
37#define TIPC_GENL_V2_NAME "TIPCv2"
38#define TIPC_GENL_V2_VERSION 0x1
39
40/* Netlink commands */
41enum {
42 TIPC_NL_UNSPEC,
43 TIPC_NL_LEGACY,
44 TIPC_NL_BEARER_DISABLE,
45 TIPC_NL_BEARER_ENABLE,
46 TIPC_NL_BEARER_GET,
47 TIPC_NL_BEARER_SET,
48 TIPC_NL_SOCK_GET,
49 TIPC_NL_PUBL_GET,
50 TIPC_NL_LINK_GET,
51 TIPC_NL_LINK_SET,
52 TIPC_NL_LINK_RESET_STATS,
53 TIPC_NL_MEDIA_GET,
54 TIPC_NL_MEDIA_SET,
55 TIPC_NL_NODE_GET,
56 TIPC_NL_NET_GET,
57 TIPC_NL_NET_SET,
58 TIPC_NL_NAME_TABLE_GET,
59
60 __TIPC_NL_CMD_MAX,
61 TIPC_NL_CMD_MAX = __TIPC_NL_CMD_MAX - 1
62};
63
64/* Top level netlink attributes */
65enum {
66 TIPC_NLA_UNSPEC,
67 TIPC_NLA_BEARER, /* nest */
68 TIPC_NLA_SOCK, /* nest */
69 TIPC_NLA_PUBL, /* nest */
70 TIPC_NLA_LINK, /* nest */
71 TIPC_NLA_MEDIA, /* nest */
72 TIPC_NLA_NODE, /* nest */
73 TIPC_NLA_NET, /* nest */
74 TIPC_NLA_NAME_TABLE, /* nest */
75
76 __TIPC_NLA_MAX,
77 TIPC_NLA_MAX = __TIPC_NLA_MAX - 1
78};
79
80/* Bearer info */
81enum {
82 TIPC_NLA_BEARER_UNSPEC,
83 TIPC_NLA_BEARER_NAME, /* string */
84 TIPC_NLA_BEARER_PROP, /* nest */
85 TIPC_NLA_BEARER_DOMAIN, /* u32 */
86
87 __TIPC_NLA_BEARER_MAX,
88 TIPC_NLA_BEARER_MAX = __TIPC_NLA_BEARER_MAX - 1
89};
90
91/* Socket info */
92enum {
93 TIPC_NLA_SOCK_UNSPEC,
94 TIPC_NLA_SOCK_ADDR, /* u32 */
95 TIPC_NLA_SOCK_REF, /* u32 */
96 TIPC_NLA_SOCK_CON, /* nest */
97 TIPC_NLA_SOCK_HAS_PUBL, /* flag */
98
99 __TIPC_NLA_SOCK_MAX,
100 TIPC_NLA_SOCK_MAX = __TIPC_NLA_SOCK_MAX - 1
101};
102
103/* Link info */
104enum {
105 TIPC_NLA_LINK_UNSPEC,
106 TIPC_NLA_LINK_NAME, /* string */
107 TIPC_NLA_LINK_DEST, /* u32 */
108 TIPC_NLA_LINK_MTU, /* u32 */
109 TIPC_NLA_LINK_BROADCAST, /* flag */
110 TIPC_NLA_LINK_UP, /* flag */
111 TIPC_NLA_LINK_ACTIVE, /* flag */
112 TIPC_NLA_LINK_PROP, /* nest */
113 TIPC_NLA_LINK_STATS, /* nest */
114 TIPC_NLA_LINK_RX, /* u32 */
115 TIPC_NLA_LINK_TX, /* u32 */
116
117 __TIPC_NLA_LINK_MAX,
118 TIPC_NLA_LINK_MAX = __TIPC_NLA_LINK_MAX - 1
119};
120
121/* Media info */
122enum {
123 TIPC_NLA_MEDIA_UNSPEC,
124 TIPC_NLA_MEDIA_NAME, /* string */
125 TIPC_NLA_MEDIA_PROP, /* nest */
126
127 __TIPC_NLA_MEDIA_MAX,
128 TIPC_NLA_MEDIA_MAX = __TIPC_NLA_MEDIA_MAX - 1
129};
130
131/* Node info */
132enum {
133 TIPC_NLA_NODE_UNSPEC,
134 TIPC_NLA_NODE_ADDR, /* u32 */
135 TIPC_NLA_NODE_UP, /* flag */
136
137 __TIPC_NLA_NODE_MAX,
138 TIPC_NLA_NODE_MAX = __TIPC_NLA_NODE_MAX - 1
139};
140
141/* Net info */
142enum {
143 TIPC_NLA_NET_UNSPEC,
144 TIPC_NLA_NET_ID, /* u32 */
145 TIPC_NLA_NET_ADDR, /* u32 */
146
147 __TIPC_NLA_NET_MAX,
148 TIPC_NLA_NET_MAX = __TIPC_NLA_NET_MAX - 1
149};
150
151/* Name table info */
152enum {
153 TIPC_NLA_NAME_TABLE_UNSPEC,
154 TIPC_NLA_NAME_TABLE_PUBL, /* nest */
155
156 __TIPC_NLA_NAME_TABLE_MAX,
157 TIPC_NLA_NAME_TABLE_MAX = __TIPC_NLA_NAME_TABLE_MAX - 1
158};
159
160/* Publication info */
161enum {
162 TIPC_NLA_PUBL_UNSPEC,
163
164 TIPC_NLA_PUBL_TYPE, /* u32 */
165 TIPC_NLA_PUBL_LOWER, /* u32 */
166 TIPC_NLA_PUBL_UPPER, /* u32 */
167 TIPC_NLA_PUBL_SCOPE, /* u32 */
168 TIPC_NLA_PUBL_NODE, /* u32 */
169 TIPC_NLA_PUBL_REF, /* u32 */
170 TIPC_NLA_PUBL_KEY, /* u32 */
171
172 __TIPC_NLA_PUBL_MAX,
173 TIPC_NLA_PUBL_MAX = __TIPC_NLA_PUBL_MAX - 1
174};
175
176/* Nest, connection info */
177enum {
178 TIPC_NLA_CON_UNSPEC,
179
180 TIPC_NLA_CON_FLAG, /* flag */
181 TIPC_NLA_CON_NODE, /* u32 */
182 TIPC_NLA_CON_SOCK, /* u32 */
183 TIPC_NLA_CON_TYPE, /* u32 */
184 TIPC_NLA_CON_INST, /* u32 */
185
186 __TIPC_NLA_CON_MAX,
187 TIPC_NLA_CON_MAX = __TIPC_NLA_CON_MAX - 1
188};
189
190/* Nest, link propreties. Valid for link, media and bearer */
191enum {
192 TIPC_NLA_PROP_UNSPEC,
193
194 TIPC_NLA_PROP_PRIO, /* u32 */
195 TIPC_NLA_PROP_TOL, /* u32 */
196 TIPC_NLA_PROP_WIN, /* u32 */
197
198 __TIPC_NLA_PROP_MAX,
199 TIPC_NLA_PROP_MAX = __TIPC_NLA_PROP_MAX - 1
200};
201
202/* Nest, statistics info */
203enum {
204 TIPC_NLA_STATS_UNSPEC,
205
206 TIPC_NLA_STATS_RX_INFO, /* u32 */
207 TIPC_NLA_STATS_RX_FRAGMENTS, /* u32 */
208 TIPC_NLA_STATS_RX_FRAGMENTED, /* u32 */
209 TIPC_NLA_STATS_RX_BUNDLES, /* u32 */
210 TIPC_NLA_STATS_RX_BUNDLED, /* u32 */
211 TIPC_NLA_STATS_TX_INFO, /* u32 */
212 TIPC_NLA_STATS_TX_FRAGMENTS, /* u32 */
213 TIPC_NLA_STATS_TX_FRAGMENTED, /* u32 */
214 TIPC_NLA_STATS_TX_BUNDLES, /* u32 */
215 TIPC_NLA_STATS_TX_BUNDLED, /* u32 */
216 TIPC_NLA_STATS_MSG_PROF_TOT, /* u32 */
217 TIPC_NLA_STATS_MSG_LEN_CNT, /* u32 */
218 TIPC_NLA_STATS_MSG_LEN_TOT, /* u32 */
219 TIPC_NLA_STATS_MSG_LEN_P0, /* u32 */
220 TIPC_NLA_STATS_MSG_LEN_P1, /* u32 */
221 TIPC_NLA_STATS_MSG_LEN_P2, /* u32 */
222 TIPC_NLA_STATS_MSG_LEN_P3, /* u32 */
223 TIPC_NLA_STATS_MSG_LEN_P4, /* u32 */
224 TIPC_NLA_STATS_MSG_LEN_P5, /* u32 */
225 TIPC_NLA_STATS_MSG_LEN_P6, /* u32 */
226 TIPC_NLA_STATS_RX_STATES, /* u32 */
227 TIPC_NLA_STATS_RX_PROBES, /* u32 */
228 TIPC_NLA_STATS_RX_NACKS, /* u32 */
229 TIPC_NLA_STATS_RX_DEFERRED, /* u32 */
230 TIPC_NLA_STATS_TX_STATES, /* u32 */
231 TIPC_NLA_STATS_TX_PROBES, /* u32 */
232 TIPC_NLA_STATS_TX_NACKS, /* u32 */
233 TIPC_NLA_STATS_TX_ACKS, /* u32 */
234 TIPC_NLA_STATS_RETRANSMITTED, /* u32 */
235 TIPC_NLA_STATS_DUPLICATES, /* u32 */
236 TIPC_NLA_STATS_LINK_CONGS, /* u32 */
237 TIPC_NLA_STATS_MAX_QUEUE, /* u32 */
238 TIPC_NLA_STATS_AVG_QUEUE, /* u32 */
239
240 __TIPC_NLA_STATS_MAX,
241 TIPC_NLA_STATS_MAX = __TIPC_NLA_STATS_MAX - 1
242};
243
244#endif
diff --git a/include/uapi/linux/tty_flags.h b/include/uapi/linux/tty_flags.h
index eefcb483a2c0..fae4864737fa 100644
--- a/include/uapi/linux/tty_flags.h
+++ b/include/uapi/linux/tty_flags.h
@@ -6,27 +6,31 @@
6 * shared by the tty_port flags structures. 6 * shared by the tty_port flags structures.
7 * 7 *
8 * Define ASYNCB_* for convenient use with {test,set,clear}_bit. 8 * Define ASYNCB_* for convenient use with {test,set,clear}_bit.
9 *
10 * Bits [0..ASYNCB_LAST_USER] are userspace defined/visible/changeable
11 * [x] in the bit comments indicates the flag is defunct and no longer used.
9 */ 12 */
10#define ASYNCB_HUP_NOTIFY 0 /* Notify getty on hangups and closes 13#define ASYNCB_HUP_NOTIFY 0 /* Notify getty on hangups and closes
11 * on the callout port */ 14 * on the callout port */
12#define ASYNCB_FOURPORT 1 /* Set OU1, OUT2 per AST Fourport settings */ 15#define ASYNCB_FOURPORT 1 /* Set OU1, OUT2 per AST Fourport settings */
13#define ASYNCB_SAK 2 /* Secure Attention Key (Orange book) */ 16#define ASYNCB_SAK 2 /* Secure Attention Key (Orange book) */
14#define ASYNCB_SPLIT_TERMIOS 3 /* Separate termios for dialin/callout */ 17#define ASYNCB_SPLIT_TERMIOS 3 /* [x] Separate termios for dialin/callout */
15#define ASYNCB_SPD_HI 4 /* Use 56000 instead of 38400 bps */ 18#define ASYNCB_SPD_HI 4 /* Use 56000 instead of 38400 bps */
16#define ASYNCB_SPD_VHI 5 /* Use 115200 instead of 38400 bps */ 19#define ASYNCB_SPD_VHI 5 /* Use 115200 instead of 38400 bps */
17#define ASYNCB_SKIP_TEST 6 /* Skip UART test during autoconfiguration */ 20#define ASYNCB_SKIP_TEST 6 /* Skip UART test during autoconfiguration */
18#define ASYNCB_AUTO_IRQ 7 /* Do automatic IRQ during 21#define ASYNCB_AUTO_IRQ 7 /* Do automatic IRQ during
19 * autoconfiguration */ 22 * autoconfiguration */
20#define ASYNCB_SESSION_LOCKOUT 8 /* Lock out cua opens based on session */ 23#define ASYNCB_SESSION_LOCKOUT 8 /* [x] Lock out cua opens based on session */
21#define ASYNCB_PGRP_LOCKOUT 9 /* Lock out cua opens based on pgrp */ 24#define ASYNCB_PGRP_LOCKOUT 9 /* [x] Lock out cua opens based on pgrp */
22#define ASYNCB_CALLOUT_NOHUP 10 /* Don't do hangups for cua device */ 25#define ASYNCB_CALLOUT_NOHUP 10 /* [x] Don't do hangups for cua device */
23#define ASYNCB_HARDPPS_CD 11 /* Call hardpps when CD goes high */ 26#define ASYNCB_HARDPPS_CD 11 /* Call hardpps when CD goes high */
24#define ASYNCB_SPD_SHI 12 /* Use 230400 instead of 38400 bps */ 27#define ASYNCB_SPD_SHI 12 /* Use 230400 instead of 38400 bps */
25#define ASYNCB_LOW_LATENCY 13 /* Request low latency behaviour */ 28#define ASYNCB_LOW_LATENCY 13 /* Request low latency behaviour */
26#define ASYNCB_BUGGY_UART 14 /* This is a buggy UART, skip some safety 29#define ASYNCB_BUGGY_UART 14 /* This is a buggy UART, skip some safety
27 * checks. Note: can be dangerous! */ 30 * checks. Note: can be dangerous! */
28#define ASYNCB_AUTOPROBE 15 /* Port was autoprobed by PCI or PNP code */ 31#define ASYNCB_AUTOPROBE 15 /* [x] Port was autoprobed by PCI/PNP code */
29#define ASYNCB_LAST_USER 15 32#define ASYNCB_MAGIC_MULTIPLIER 16 /* Use special CLK or divisor */
33#define ASYNCB_LAST_USER 16
30 34
31/* Internal flags used only by kernel */ 35/* Internal flags used only by kernel */
32#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */ 36#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */
@@ -57,8 +61,11 @@
57#define ASYNC_LOW_LATENCY (1U << ASYNCB_LOW_LATENCY) 61#define ASYNC_LOW_LATENCY (1U << ASYNCB_LOW_LATENCY)
58#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART) 62#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART)
59#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) 63#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE)
64#define ASYNC_MAGIC_MULTIPLIER (1U << ASYNCB_MAGIC_MULTIPLIER)
60 65
61#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1) 66#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1)
67#define ASYNC_DEPRECATED (ASYNC_SESSION_LOCKOUT | ASYNC_PGRP_LOCKOUT | \
68 ASYNC_CALLOUT_NOHUP | ASYNC_AUTOPROBE)
62#define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \ 69#define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \
63 ASYNC_LOW_LATENCY) 70 ASYNC_LOW_LATENCY)
64#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) 71#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI)
diff --git a/include/uapi/linux/v4l2-common.h b/include/uapi/linux/v4l2-common.h
index 2f6f8cafe773..15273987093e 100644
--- a/include/uapi/linux/v4l2-common.h
+++ b/include/uapi/linux/v4l2-common.h
@@ -43,6 +43,8 @@
43#define V4L2_SEL_TGT_CROP_DEFAULT 0x0001 43#define V4L2_SEL_TGT_CROP_DEFAULT 0x0001
44/* Cropping bounds */ 44/* Cropping bounds */
45#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002 45#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002
46/* Native frame size */
47#define V4L2_SEL_TGT_NATIVE_SIZE 0x0003
46/* Current composing area */ 48/* Current composing area */
47#define V4L2_SEL_TGT_COMPOSE 0x0100 49#define V4L2_SEL_TGT_COMPOSE 0x0100
48/* Default composing area */ 50/* Default composing area */
diff --git a/include/uapi/linux/v4l2-mediabus.h b/include/uapi/linux/v4l2-mediabus.h
index 1445e858854f..5a86d8ede09c 100644
--- a/include/uapi/linux/v4l2-mediabus.h
+++ b/include/uapi/linux/v4l2-mediabus.h
@@ -11,122 +11,10 @@
11#ifndef __LINUX_V4L2_MEDIABUS_H 11#ifndef __LINUX_V4L2_MEDIABUS_H
12#define __LINUX_V4L2_MEDIABUS_H 12#define __LINUX_V4L2_MEDIABUS_H
13 13
14#include <linux/media-bus-format.h>
14#include <linux/types.h> 15#include <linux/types.h>
15#include <linux/videodev2.h> 16#include <linux/videodev2.h>
16 17
17/*
18 * These pixel codes uniquely identify data formats on the media bus. Mostly
19 * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
20 * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
21 * data format is fixed. Additionally, "2X8" means that one pixel is transferred
22 * in two 8-bit samples, "BE" or "LE" specify in which order those samples are
23 * transferred over the bus: "LE" means that the least significant bits are
24 * transferred first, "BE" means that the most significant bits are transferred
25 * first, and "PADHI" and "PADLO" define which bits - low or high, in the
26 * incomplete high byte, are filled with padding bits.
27 *
28 * The pixel codes are grouped by type, bus_width, bits per component, samples
29 * per pixel and order of subsamples. Numerical values are sorted using generic
30 * numerical sort order (8 thus comes before 10).
31 *
32 * As their value can't change when a new pixel code is inserted in the
33 * enumeration, the pixel codes are explicitly given a numerical value. The next
34 * free values for each category are listed below, update them when inserting
35 * new pixel codes.
36 */
37enum v4l2_mbus_pixelcode {
38 V4L2_MBUS_FMT_FIXED = 0x0001,
39
40 /* RGB - next is 0x100e */
41 V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,
42 V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,
43 V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003,
44 V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 0x1004,
45 V4L2_MBUS_FMT_BGR565_2X8_BE = 0x1005,
46 V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
47 V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
48 V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
49 V4L2_MBUS_FMT_RGB666_1X18 = 0x1009,
50 V4L2_MBUS_FMT_RGB888_1X24 = 0x100a,
51 V4L2_MBUS_FMT_RGB888_2X12_BE = 0x100b,
52 V4L2_MBUS_FMT_RGB888_2X12_LE = 0x100c,
53 V4L2_MBUS_FMT_ARGB8888_1X32 = 0x100d,
54
55 /* YUV (including grey) - next is 0x2024 */
56 V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
57 V4L2_MBUS_FMT_UV8_1X8 = 0x2015,
58 V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002,
59 V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003,
60 V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004,
61 V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005,
62 V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006,
63 V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007,
64 V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008,
65 V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009,
66 V4L2_MBUS_FMT_Y10_1X10 = 0x200a,
67 V4L2_MBUS_FMT_UYVY10_2X10 = 0x2018,
68 V4L2_MBUS_FMT_VYUY10_2X10 = 0x2019,
69 V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b,
70 V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c,
71 V4L2_MBUS_FMT_Y12_1X12 = 0x2013,
72 V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f,
73 V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010,
74 V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011,
75 V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012,
76 V4L2_MBUS_FMT_YDYUYDYV8_1X16 = 0x2014,
77 V4L2_MBUS_FMT_UYVY10_1X20 = 0x201a,
78 V4L2_MBUS_FMT_VYUY10_1X20 = 0x201b,
79 V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
80 V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
81 V4L2_MBUS_FMT_YUV10_1X30 = 0x2016,
82 V4L2_MBUS_FMT_AYUV8_1X32 = 0x2017,
83 V4L2_MBUS_FMT_UYVY12_2X12 = 0x201c,
84 V4L2_MBUS_FMT_VYUY12_2X12 = 0x201d,
85 V4L2_MBUS_FMT_YUYV12_2X12 = 0x201e,
86 V4L2_MBUS_FMT_YVYU12_2X12 = 0x201f,
87 V4L2_MBUS_FMT_UYVY12_1X24 = 0x2020,
88 V4L2_MBUS_FMT_VYUY12_1X24 = 0x2021,
89 V4L2_MBUS_FMT_YUYV12_1X24 = 0x2022,
90 V4L2_MBUS_FMT_YVYU12_1X24 = 0x2023,
91
92 /* Bayer - next is 0x3019 */
93 V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001,
94 V4L2_MBUS_FMT_SGBRG8_1X8 = 0x3013,
95 V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
96 V4L2_MBUS_FMT_SRGGB8_1X8 = 0x3014,
97 V4L2_MBUS_FMT_SBGGR10_ALAW8_1X8 = 0x3015,
98 V4L2_MBUS_FMT_SGBRG10_ALAW8_1X8 = 0x3016,
99 V4L2_MBUS_FMT_SGRBG10_ALAW8_1X8 = 0x3017,
100 V4L2_MBUS_FMT_SRGGB10_ALAW8_1X8 = 0x3018,
101 V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b,
102 V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c,
103 V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009,
104 V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 0x300d,
105 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003,
106 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004,
107 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005,
108 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006,
109 V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007,
110 V4L2_MBUS_FMT_SGBRG10_1X10 = 0x300e,
111 V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a,
112 V4L2_MBUS_FMT_SRGGB10_1X10 = 0x300f,
113 V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008,
114 V4L2_MBUS_FMT_SGBRG12_1X12 = 0x3010,
115 V4L2_MBUS_FMT_SGRBG12_1X12 = 0x3011,
116 V4L2_MBUS_FMT_SRGGB12_1X12 = 0x3012,
117
118 /* JPEG compressed formats - next is 0x4002 */
119 V4L2_MBUS_FMT_JPEG_1X8 = 0x4001,
120
121 /* Vendor specific formats - next is 0x5002 */
122
123 /* S5C73M3 sensor specific interleaved UYVY and JPEG */
124 V4L2_MBUS_FMT_S5C_UYVY_JPEG_1X8 = 0x5001,
125
126 /* HSV - next is 0x6002 */
127 V4L2_MBUS_FMT_AHSV8888_1X32 = 0x6001,
128};
129
130/** 18/**
131 * struct v4l2_mbus_framefmt - frame format on the media bus 19 * struct v4l2_mbus_framefmt - frame format on the media bus
132 * @width: frame width 20 * @width: frame width
@@ -134,6 +22,8 @@ enum v4l2_mbus_pixelcode {
134 * @code: data format code (from enum v4l2_mbus_pixelcode) 22 * @code: data format code (from enum v4l2_mbus_pixelcode)
135 * @field: used interlacing type (from enum v4l2_field) 23 * @field: used interlacing type (from enum v4l2_field)
136 * @colorspace: colorspace of the data (from enum v4l2_colorspace) 24 * @colorspace: colorspace of the data (from enum v4l2_colorspace)
25 * @ycbcr_enc: YCbCr encoding of the data (from enum v4l2_ycbcr_encoding)
26 * @quantization: quantization of the data (from enum v4l2_quantization)
137 */ 27 */
138struct v4l2_mbus_framefmt { 28struct v4l2_mbus_framefmt {
139 __u32 width; 29 __u32 width;
@@ -141,7 +31,108 @@ struct v4l2_mbus_framefmt {
141 __u32 code; 31 __u32 code;
142 __u32 field; 32 __u32 field;
143 __u32 colorspace; 33 __u32 colorspace;
144 __u32 reserved[7]; 34 __u32 ycbcr_enc;
35 __u32 quantization;
36 __u32 reserved[5];
37};
38
39#ifndef __KERNEL__
40/*
41 * enum v4l2_mbus_pixelcode and its definitions are now deprecated, and
42 * MEDIA_BUS_FMT_ definitions (defined in media-bus-format.h) should be
43 * used instead.
44 *
45 * New defines should only be added to media-bus-format.h. The
46 * v4l2_mbus_pixelcode enum is frozen.
47 */
48
49#define V4L2_MBUS_FROM_MEDIA_BUS_FMT(name) \
50 V4L2_MBUS_FMT_ ## name = MEDIA_BUS_FMT_ ## name
51
52enum v4l2_mbus_pixelcode {
53 V4L2_MBUS_FROM_MEDIA_BUS_FMT(FIXED),
54
55 V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB444_2X8_PADHI_BE),
56 V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB444_2X8_PADHI_LE),
57 V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB555_2X8_PADHI_BE),
58 V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB555_2X8_PADHI_LE),
59 V4L2_MBUS_FROM_MEDIA_BUS_FMT(BGR565_2X8_BE),
60 V4L2_MBUS_FROM_MEDIA_BUS_FMT(BGR565_2X8_LE),
61 V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB565_2X8_BE),
62 V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB565_2X8_LE),
63 V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB666_1X18),
64 V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB888_1X24),
65 V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB888_2X12_BE),
66 V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB888_2X12_LE),
67 V4L2_MBUS_FROM_MEDIA_BUS_FMT(ARGB8888_1X32),
68
69 V4L2_MBUS_FROM_MEDIA_BUS_FMT(Y8_1X8),
70 V4L2_MBUS_FROM_MEDIA_BUS_FMT(UV8_1X8),
71 V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY8_1_5X8),
72 V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY8_1_5X8),
73 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV8_1_5X8),
74 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU8_1_5X8),
75 V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY8_2X8),
76 V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY8_2X8),
77 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV8_2X8),
78 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU8_2X8),
79 V4L2_MBUS_FROM_MEDIA_BUS_FMT(Y10_1X10),
80 V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY10_2X10),
81 V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY10_2X10),
82 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV10_2X10),
83 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU10_2X10),
84 V4L2_MBUS_FROM_MEDIA_BUS_FMT(Y12_1X12),
85 V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY8_1X16),
86 V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY8_1X16),
87 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV8_1X16),
88 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU8_1X16),
89 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YDYUYDYV8_1X16),
90 V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY10_1X20),
91 V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY10_1X20),
92 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV10_1X20),
93 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU10_1X20),
94 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUV10_1X30),
95 V4L2_MBUS_FROM_MEDIA_BUS_FMT(AYUV8_1X32),
96 V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY12_2X12),
97 V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY12_2X12),
98 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV12_2X12),
99 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU12_2X12),
100 V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY12_1X24),
101 V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY12_1X24),
102 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV12_1X24),
103 V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU12_1X24),
104
105 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR8_1X8),
106 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG8_1X8),
107 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG8_1X8),
108 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB8_1X8),
109 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_ALAW8_1X8),
110 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG10_ALAW8_1X8),
111 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG10_ALAW8_1X8),
112 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB10_ALAW8_1X8),
113 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_DPCM8_1X8),
114 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG10_DPCM8_1X8),
115 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG10_DPCM8_1X8),
116 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB10_DPCM8_1X8),
117 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADHI_BE),
118 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADHI_LE),
119 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADLO_BE),
120 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADLO_LE),
121 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_1X10),
122 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG10_1X10),
123 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG10_1X10),
124 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB10_1X10),
125 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR12_1X12),
126 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG12_1X12),
127 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG12_1X12),
128 V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB12_1X12),
129
130 V4L2_MBUS_FROM_MEDIA_BUS_FMT(JPEG_1X8),
131
132 V4L2_MBUS_FROM_MEDIA_BUS_FMT(S5C_UYVY_JPEG_1X8),
133
134 V4L2_MBUS_FROM_MEDIA_BUS_FMT(AHSV8888_1X32),
145}; 135};
136#endif /* __KERNEL__ */
146 137
147#endif 138#endif
diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h
index a619cdd300ac..e0a7e3da498a 100644
--- a/include/uapi/linux/v4l2-subdev.h
+++ b/include/uapi/linux/v4l2-subdev.h
@@ -68,7 +68,7 @@ struct v4l2_subdev_crop {
68 * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration 68 * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
69 * @pad: pad number, as reported by the media API 69 * @pad: pad number, as reported by the media API
70 * @index: format index during enumeration 70 * @index: format index during enumeration
71 * @code: format code (from enum v4l2_mbus_pixelcode) 71 * @code: format code (MEDIA_BUS_FMT_ definitions)
72 */ 72 */
73struct v4l2_subdev_mbus_code_enum { 73struct v4l2_subdev_mbus_code_enum {
74 __u32 pad; 74 __u32 pad;
@@ -81,7 +81,7 @@ struct v4l2_subdev_mbus_code_enum {
81 * struct v4l2_subdev_frame_size_enum - Media bus format enumeration 81 * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
82 * @pad: pad number, as reported by the media API 82 * @pad: pad number, as reported by the media API
83 * @index: format index during enumeration 83 * @index: format index during enumeration
84 * @code: format code (from enum v4l2_mbus_pixelcode) 84 * @code: format code (MEDIA_BUS_FMT_ definitions)
85 */ 85 */
86struct v4l2_subdev_frame_size_enum { 86struct v4l2_subdev_frame_size_enum {
87 __u32 index; 87 __u32 index;
@@ -109,7 +109,7 @@ struct v4l2_subdev_frame_interval {
109 * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration 109 * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
110 * @pad: pad number, as reported by the media API 110 * @pad: pad number, as reported by the media API
111 * @index: frame interval index during enumeration 111 * @index: frame interval index during enumeration
112 * @code: format code (from enum v4l2_mbus_pixelcode) 112 * @code: format code (MEDIA_BUS_FMT_ definitions)
113 * @width: frame width in pixels 113 * @width: frame width in pixels
114 * @height: frame height in pixels 114 * @height: frame height in pixels
115 * @interval: frame interval in seconds 115 * @interval: frame interval in seconds
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 1c2f84fd4d99..d279c1b75cf7 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -178,30 +178,103 @@ enum v4l2_memory {
178 178
179/* see also http://vektor.theorem.ca/graphics/ycbcr/ */ 179/* see also http://vektor.theorem.ca/graphics/ycbcr/ */
180enum v4l2_colorspace { 180enum v4l2_colorspace {
181 /* ITU-R 601 -- broadcast NTSC/PAL */ 181 /* SMPTE 170M: used for broadcast NTSC/PAL SDTV */
182 V4L2_COLORSPACE_SMPTE170M = 1, 182 V4L2_COLORSPACE_SMPTE170M = 1,
183 183
184 /* 1125-Line (US) HDTV */ 184 /* Obsolete pre-1998 SMPTE 240M HDTV standard, superseded by Rec 709 */
185 V4L2_COLORSPACE_SMPTE240M = 2, 185 V4L2_COLORSPACE_SMPTE240M = 2,
186 186
187 /* HD and modern captures. */ 187 /* Rec.709: used for HDTV */
188 V4L2_COLORSPACE_REC709 = 3, 188 V4L2_COLORSPACE_REC709 = 3,
189 189
190 /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */ 190 /*
191 * Deprecated, do not use. No driver will ever return this. This was
192 * based on a misunderstanding of the bt878 datasheet.
193 */
191 V4L2_COLORSPACE_BT878 = 4, 194 V4L2_COLORSPACE_BT878 = 4,
192 195
193 /* These should be useful. Assume 601 extents. */ 196 /*
197 * NTSC 1953 colorspace. This only makes sense when dealing with
198 * really, really old NTSC recordings. Superseded by SMPTE 170M.
199 */
194 V4L2_COLORSPACE_470_SYSTEM_M = 5, 200 V4L2_COLORSPACE_470_SYSTEM_M = 5,
201
202 /*
203 * EBU Tech 3213 PAL/SECAM colorspace. This only makes sense when
204 * dealing with really old PAL/SECAM recordings. Superseded by
205 * SMPTE 170M.
206 */
195 V4L2_COLORSPACE_470_SYSTEM_BG = 6, 207 V4L2_COLORSPACE_470_SYSTEM_BG = 6,
196 208
197 /* I know there will be cameras that send this. So, this is 209 /*
198 * unspecified chromaticities and full 0-255 on each of the 210 * Effectively shorthand for V4L2_COLORSPACE_SRGB, V4L2_YCBCR_ENC_601
199 * Y'CbCr components 211 * and V4L2_QUANTIZATION_FULL_RANGE. To be used for (Motion-)JPEG.
200 */ 212 */
201 V4L2_COLORSPACE_JPEG = 7, 213 V4L2_COLORSPACE_JPEG = 7,
202 214
203 /* For RGB colourspaces, this is probably a good start. */ 215 /* For RGB colorspaces such as produces by most webcams. */
204 V4L2_COLORSPACE_SRGB = 8, 216 V4L2_COLORSPACE_SRGB = 8,
217
218 /* AdobeRGB colorspace */
219 V4L2_COLORSPACE_ADOBERGB = 9,
220
221 /* BT.2020 colorspace, used for UHDTV. */
222 V4L2_COLORSPACE_BT2020 = 10,
223};
224
225enum v4l2_ycbcr_encoding {
226 /*
227 * Mapping of V4L2_YCBCR_ENC_DEFAULT to actual encodings for the
228 * various colorspaces:
229 *
230 * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M,
231 * V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_ADOBERGB and
232 * V4L2_COLORSPACE_JPEG: V4L2_YCBCR_ENC_601
233 *
234 * V4L2_COLORSPACE_REC709: V4L2_YCBCR_ENC_709
235 *
236 * V4L2_COLORSPACE_SRGB: V4L2_YCBCR_ENC_SYCC
237 *
238 * V4L2_COLORSPACE_BT2020: V4L2_YCBCR_ENC_BT2020
239 *
240 * V4L2_COLORSPACE_SMPTE240M: V4L2_YCBCR_ENC_SMPTE240M
241 */
242 V4L2_YCBCR_ENC_DEFAULT = 0,
243
244 /* ITU-R 601 -- SDTV */
245 V4L2_YCBCR_ENC_601 = 1,
246
247 /* Rec. 709 -- HDTV */
248 V4L2_YCBCR_ENC_709 = 2,
249
250 /* ITU-R 601/EN 61966-2-4 Extended Gamut -- SDTV */
251 V4L2_YCBCR_ENC_XV601 = 3,
252
253 /* Rec. 709/EN 61966-2-4 Extended Gamut -- HDTV */
254 V4L2_YCBCR_ENC_XV709 = 4,
255
256 /* sYCC (Y'CbCr encoding of sRGB) */
257 V4L2_YCBCR_ENC_SYCC = 5,
258
259 /* BT.2020 Non-constant Luminance Y'CbCr */
260 V4L2_YCBCR_ENC_BT2020 = 6,
261
262 /* BT.2020 Constant Luminance Y'CbcCrc */
263 V4L2_YCBCR_ENC_BT2020_CONST_LUM = 7,
264
265 /* SMPTE 240M -- Obsolete HDTV */
266 V4L2_YCBCR_ENC_SMPTE240M = 8,
267};
268
269enum v4l2_quantization {
270 /*
271 * The default for R'G'B' quantization is always full range. For
272 * Y'CbCr the quantization is always limited range, except for
273 * SYCC, XV601, XV709 or JPEG: those are full range.
274 */
275 V4L2_QUANTIZATION_DEFAULT = 0,
276 V4L2_QUANTIZATION_FULL_RANGE = 1,
277 V4L2_QUANTIZATION_LIM_RANGE = 2,
205}; 278};
206 279
207enum v4l2_priority { 280enum v4l2_priority {
@@ -294,6 +367,8 @@ struct v4l2_pix_format {
294 __u32 colorspace; /* enum v4l2_colorspace */ 367 __u32 colorspace; /* enum v4l2_colorspace */
295 __u32 priv; /* private data, depends on pixelformat */ 368 __u32 priv; /* private data, depends on pixelformat */
296 __u32 flags; /* format flags (V4L2_PIX_FMT_FLAG_*) */ 369 __u32 flags; /* format flags (V4L2_PIX_FMT_FLAG_*) */
370 __u32 ycbcr_enc; /* enum v4l2_ycbcr_encoding */
371 __u32 quantization; /* enum v4l2_quantization */
297}; 372};
298 373
299/* Pixel format FOURCC depth Description */ 374/* Pixel format FOURCC depth Description */
@@ -1249,6 +1324,7 @@ struct v4l2_input {
1249#define V4L2_IN_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ 1324#define V4L2_IN_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
1250#define V4L2_IN_CAP_CUSTOM_TIMINGS V4L2_IN_CAP_DV_TIMINGS /* For compatibility */ 1325#define V4L2_IN_CAP_CUSTOM_TIMINGS V4L2_IN_CAP_DV_TIMINGS /* For compatibility */
1251#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */ 1326#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */
1327#define V4L2_IN_CAP_NATIVE_SIZE 0x00000008 /* Supports setting native size */
1252 1328
1253/* 1329/*
1254 * V I D E O O U T P U T S 1330 * V I D E O O U T P U T S
@@ -1272,6 +1348,7 @@ struct v4l2_output {
1272#define V4L2_OUT_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ 1348#define V4L2_OUT_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
1273#define V4L2_OUT_CAP_CUSTOM_TIMINGS V4L2_OUT_CAP_DV_TIMINGS /* For compatibility */ 1349#define V4L2_OUT_CAP_CUSTOM_TIMINGS V4L2_OUT_CAP_DV_TIMINGS /* For compatibility */
1274#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */ 1350#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */
1351#define V4L2_OUT_CAP_NATIVE_SIZE 0x00000008 /* Supports setting native size */
1275 1352
1276/* 1353/*
1277 * C O N T R O L S 1354 * C O N T R O L S
@@ -1777,6 +1854,8 @@ struct v4l2_plane_pix_format {
1777 * @plane_fmt: per-plane information 1854 * @plane_fmt: per-plane information
1778 * @num_planes: number of planes for this format 1855 * @num_planes: number of planes for this format
1779 * @flags: format flags (V4L2_PIX_FMT_FLAG_*) 1856 * @flags: format flags (V4L2_PIX_FMT_FLAG_*)
1857 * @ycbcr_enc: enum v4l2_ycbcr_encoding, Y'CbCr encoding
1858 * @quantization: enum v4l2_quantization, colorspace quantization
1780 */ 1859 */
1781struct v4l2_pix_format_mplane { 1860struct v4l2_pix_format_mplane {
1782 __u32 width; 1861 __u32 width;
@@ -1788,7 +1867,9 @@ struct v4l2_pix_format_mplane {
1788 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; 1867 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
1789 __u8 num_planes; 1868 __u8 num_planes;
1790 __u8 flags; 1869 __u8 flags;
1791 __u8 reserved[10]; 1870 __u8 ycbcr_enc;
1871 __u8 quantization;
1872 __u8 reserved[8];
1792} __attribute__ ((packed)); 1873} __attribute__ ((packed));
1793 1874
1794/** 1875/**
diff --git a/include/uapi/linux/virtio_blk.h b/include/uapi/linux/virtio_blk.h
index 9ad67b267584..247c8ba8544a 100644
--- a/include/uapi/linux/virtio_blk.h
+++ b/include/uapi/linux/virtio_blk.h
@@ -28,6 +28,7 @@
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/virtio_ids.h> 29#include <linux/virtio_ids.h>
30#include <linux/virtio_config.h> 30#include <linux/virtio_config.h>
31#include <linux/virtio_types.h>
31 32
32/* Feature bits */ 33/* Feature bits */
33#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ 34#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
@@ -114,18 +115,18 @@ struct virtio_blk_config {
114/* This is the first element of the read scatter-gather list. */ 115/* This is the first element of the read scatter-gather list. */
115struct virtio_blk_outhdr { 116struct virtio_blk_outhdr {
116 /* VIRTIO_BLK_T* */ 117 /* VIRTIO_BLK_T* */
117 __u32 type; 118 __virtio32 type;
118 /* io priority. */ 119 /* io priority. */
119 __u32 ioprio; 120 __virtio32 ioprio;
120 /* Sector (ie. 512 byte offset) */ 121 /* Sector (ie. 512 byte offset) */
121 __u64 sector; 122 __virtio64 sector;
122}; 123};
123 124
124struct virtio_scsi_inhdr { 125struct virtio_scsi_inhdr {
125 __u32 errors; 126 __virtio32 errors;
126 __u32 data_len; 127 __virtio32 data_len;
127 __u32 sense_len; 128 __virtio32 sense_len;
128 __u32 residual; 129 __virtio32 residual;
129}; 130};
130 131
131/* And this is the final byte of the write scatter-gather list. */ 132/* And this is the final byte of the write scatter-gather list. */
diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
index 3ce768c6910d..a6d0cdeaacd4 100644
--- a/include/uapi/linux/virtio_config.h
+++ b/include/uapi/linux/virtio_config.h
@@ -38,14 +38,16 @@
38#define VIRTIO_CONFIG_S_DRIVER 2 38#define VIRTIO_CONFIG_S_DRIVER 2
39/* Driver has used its parts of the config, and is happy */ 39/* Driver has used its parts of the config, and is happy */
40#define VIRTIO_CONFIG_S_DRIVER_OK 4 40#define VIRTIO_CONFIG_S_DRIVER_OK 4
41/* Driver has finished configuring features */
42#define VIRTIO_CONFIG_S_FEATURES_OK 8
41/* We've given up on this device. */ 43/* We've given up on this device. */
42#define VIRTIO_CONFIG_S_FAILED 0x80 44#define VIRTIO_CONFIG_S_FAILED 0x80
43 45
44/* Some virtio feature bits (currently bits 28 through 31) are reserved for the 46/* Some virtio feature bits (currently bits 28 through 32) are reserved for the
45 * transport being used (eg. virtio_ring), the rest are per-device feature 47 * transport being used (eg. virtio_ring), the rest are per-device feature
46 * bits. */ 48 * bits. */
47#define VIRTIO_TRANSPORT_F_START 28 49#define VIRTIO_TRANSPORT_F_START 28
48#define VIRTIO_TRANSPORT_F_END 32 50#define VIRTIO_TRANSPORT_F_END 33
49 51
50/* Do we get callbacks when the ring is completely used, even if we've 52/* Do we get callbacks when the ring is completely used, even if we've
51 * suppressed them? */ 53 * suppressed them? */
@@ -54,4 +56,7 @@
54/* Can the device handle any descriptor layout? */ 56/* Can the device handle any descriptor layout? */
55#define VIRTIO_F_ANY_LAYOUT 27 57#define VIRTIO_F_ANY_LAYOUT 27
56 58
59/* v1.0 compliant. */
60#define VIRTIO_F_VERSION_1 32
61
57#endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */ 62#endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */
diff --git a/include/uapi/linux/virtio_console.h b/include/uapi/linux/virtio_console.h
index ba260dd0b33a..b7fb108c9310 100644
--- a/include/uapi/linux/virtio_console.h
+++ b/include/uapi/linux/virtio_console.h
@@ -32,6 +32,7 @@
32#ifndef _UAPI_LINUX_VIRTIO_CONSOLE_H 32#ifndef _UAPI_LINUX_VIRTIO_CONSOLE_H
33#define _UAPI_LINUX_VIRTIO_CONSOLE_H 33#define _UAPI_LINUX_VIRTIO_CONSOLE_H
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/virtio_types.h>
35#include <linux/virtio_ids.h> 36#include <linux/virtio_ids.h>
36#include <linux/virtio_config.h> 37#include <linux/virtio_config.h>
37 38
@@ -58,9 +59,9 @@ struct virtio_console_config {
58 * particular port. 59 * particular port.
59 */ 60 */
60struct virtio_console_control { 61struct virtio_console_control {
61 __u32 id; /* Port number */ 62 __virtio32 id; /* Port number */
62 __u16 event; /* The kind of control event (see below) */ 63 __virtio16 event; /* The kind of control event (see below) */
63 __u16 value; /* Extra information for the key */ 64 __virtio16 value; /* Extra information for the key */
64}; 65};
65 66
66/* Some events for control messages */ 67/* Some events for control messages */
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index 172a7f00780c..b5f1677b291c 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -28,6 +28,7 @@
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/virtio_ids.h> 29#include <linux/virtio_ids.h>
30#include <linux/virtio_config.h> 30#include <linux/virtio_config.h>
31#include <linux/virtio_types.h>
31#include <linux/if_ether.h> 32#include <linux/if_ether.h>
32 33
33/* The feature bitmap for virtio net */ 34/* The feature bitmap for virtio net */
@@ -84,17 +85,17 @@ struct virtio_net_hdr {
84#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP 85#define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP
85#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set 86#define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set
86 __u8 gso_type; 87 __u8 gso_type;
87 __u16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ 88 __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */
88 __u16 gso_size; /* Bytes to append to hdr_len per frame */ 89 __virtio16 gso_size; /* Bytes to append to hdr_len per frame */
89 __u16 csum_start; /* Position to start checksumming from */ 90 __virtio16 csum_start; /* Position to start checksumming from */
90 __u16 csum_offset; /* Offset after that to place checksum */ 91 __virtio16 csum_offset; /* Offset after that to place checksum */
91}; 92};
92 93
93/* This is the version of the header to use when the MRG_RXBUF 94/* This is the version of the header to use when the MRG_RXBUF
94 * feature has been negotiated. */ 95 * feature has been negotiated. */
95struct virtio_net_hdr_mrg_rxbuf { 96struct virtio_net_hdr_mrg_rxbuf {
96 struct virtio_net_hdr hdr; 97 struct virtio_net_hdr hdr;
97 __u16 num_buffers; /* Number of merged rx buffers */ 98 __virtio16 num_buffers; /* Number of merged rx buffers */
98}; 99};
99 100
100/* 101/*
@@ -149,7 +150,7 @@ typedef __u8 virtio_net_ctrl_ack;
149 * VIRTIO_NET_F_CTRL_MAC_ADDR feature is available. 150 * VIRTIO_NET_F_CTRL_MAC_ADDR feature is available.
150 */ 151 */
151struct virtio_net_ctrl_mac { 152struct virtio_net_ctrl_mac {
152 __u32 entries; 153 __virtio32 entries;
153 __u8 macs[][ETH_ALEN]; 154 __u8 macs[][ETH_ALEN];
154} __attribute__((packed)); 155} __attribute__((packed));
155 156
@@ -193,7 +194,7 @@ struct virtio_net_ctrl_mac {
193 * specified. 194 * specified.
194 */ 195 */
195struct virtio_net_ctrl_mq { 196struct virtio_net_ctrl_mq {
196 __u16 virtqueue_pairs; 197 __virtio16 virtqueue_pairs;
197}; 198};
198 199
199#define VIRTIO_NET_CTRL_MQ 4 200#define VIRTIO_NET_CTRL_MQ 4
diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h
index a99f9b7caa67..61c818a7fe70 100644
--- a/include/uapi/linux/virtio_ring.h
+++ b/include/uapi/linux/virtio_ring.h
@@ -32,6 +32,7 @@
32 * 32 *
33 * Copyright Rusty Russell IBM Corporation 2007. */ 33 * Copyright Rusty Russell IBM Corporation 2007. */
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/virtio_types.h>
35 36
36/* This marks a buffer as continuing via the next field. */ 37/* This marks a buffer as continuing via the next field. */
37#define VRING_DESC_F_NEXT 1 38#define VRING_DESC_F_NEXT 1
@@ -61,32 +62,32 @@
61/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ 62/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */
62struct vring_desc { 63struct vring_desc {
63 /* Address (guest-physical). */ 64 /* Address (guest-physical). */
64 __u64 addr; 65 __virtio64 addr;
65 /* Length. */ 66 /* Length. */
66 __u32 len; 67 __virtio32 len;
67 /* The flags as indicated above. */ 68 /* The flags as indicated above. */
68 __u16 flags; 69 __virtio16 flags;
69 /* We chain unused descriptors via this, too */ 70 /* We chain unused descriptors via this, too */
70 __u16 next; 71 __virtio16 next;
71}; 72};
72 73
73struct vring_avail { 74struct vring_avail {
74 __u16 flags; 75 __virtio16 flags;
75 __u16 idx; 76 __virtio16 idx;
76 __u16 ring[]; 77 __virtio16 ring[];
77}; 78};
78 79
79/* u32 is used here for ids for padding reasons. */ 80/* u32 is used here for ids for padding reasons. */
80struct vring_used_elem { 81struct vring_used_elem {
81 /* Index of start of used descriptor chain. */ 82 /* Index of start of used descriptor chain. */
82 __u32 id; 83 __virtio32 id;
83 /* Total length of the descriptor chain which was used (written to) */ 84 /* Total length of the descriptor chain which was used (written to) */
84 __u32 len; 85 __virtio32 len;
85}; 86};
86 87
87struct vring_used { 88struct vring_used {
88 __u16 flags; 89 __virtio16 flags;
89 __u16 idx; 90 __virtio16 idx;
90 struct vring_used_elem ring[]; 91 struct vring_used_elem ring[];
91}; 92};
92 93
@@ -109,25 +110,25 @@ struct vring {
109 * struct vring_desc desc[num]; 110 * struct vring_desc desc[num];
110 * 111 *
111 * // A ring of available descriptor heads with free-running index. 112 * // A ring of available descriptor heads with free-running index.
112 * __u16 avail_flags; 113 * __virtio16 avail_flags;
113 * __u16 avail_idx; 114 * __virtio16 avail_idx;
114 * __u16 available[num]; 115 * __virtio16 available[num];
115 * __u16 used_event_idx; 116 * __virtio16 used_event_idx;
116 * 117 *
117 * // Padding to the next align boundary. 118 * // Padding to the next align boundary.
118 * char pad[]; 119 * char pad[];
119 * 120 *
120 * // A ring of used descriptor heads with free-running index. 121 * // A ring of used descriptor heads with free-running index.
121 * __u16 used_flags; 122 * __virtio16 used_flags;
122 * __u16 used_idx; 123 * __virtio16 used_idx;
123 * struct vring_used_elem used[num]; 124 * struct vring_used_elem used[num];
124 * __u16 avail_event_idx; 125 * __virtio16 avail_event_idx;
125 * }; 126 * };
126 */ 127 */
127/* We publish the used event index at the end of the available ring, and vice 128/* We publish the used event index at the end of the available ring, and vice
128 * versa. They are at the end for backwards compatibility. */ 129 * versa. They are at the end for backwards compatibility. */
129#define vring_used_event(vr) ((vr)->avail->ring[(vr)->num]) 130#define vring_used_event(vr) ((vr)->avail->ring[(vr)->num])
130#define vring_avail_event(vr) (*(__u16 *)&(vr)->used->ring[(vr)->num]) 131#define vring_avail_event(vr) (*(__virtio16 *)&(vr)->used->ring[(vr)->num])
131 132
132static inline void vring_init(struct vring *vr, unsigned int num, void *p, 133static inline void vring_init(struct vring *vr, unsigned int num, void *p,
133 unsigned long align) 134 unsigned long align)
@@ -135,15 +136,15 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p,
135 vr->num = num; 136 vr->num = num;
136 vr->desc = p; 137 vr->desc = p;
137 vr->avail = p + num*sizeof(struct vring_desc); 138 vr->avail = p + num*sizeof(struct vring_desc);
138 vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + sizeof(__u16) 139 vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + sizeof(__virtio16)
139 + align-1) & ~(align - 1)); 140 + align-1) & ~(align - 1));
140} 141}
141 142
142static inline unsigned vring_size(unsigned int num, unsigned long align) 143static inline unsigned vring_size(unsigned int num, unsigned long align)
143{ 144{
144 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (3 + num) 145 return ((sizeof(struct vring_desc) * num + sizeof(__virtio16) * (3 + num)
145 + align - 1) & ~(align - 1)) 146 + align - 1) & ~(align - 1))
146 + sizeof(__u16) * 3 + sizeof(struct vring_used_elem) * num; 147 + sizeof(__virtio16) * 3 + sizeof(struct vring_used_elem) * num;
147} 148}
148 149
149/* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */ 150/* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */
diff --git a/include/linux/virtio_scsi.h b/include/uapi/linux/virtio_scsi.h
index de429d1f4357..42b9370771b0 100644
--- a/include/linux/virtio_scsi.h
+++ b/include/uapi/linux/virtio_scsi.h
@@ -27,83 +27,85 @@
27#ifndef _LINUX_VIRTIO_SCSI_H 27#ifndef _LINUX_VIRTIO_SCSI_H
28#define _LINUX_VIRTIO_SCSI_H 28#define _LINUX_VIRTIO_SCSI_H
29 29
30#include <linux/virtio_types.h>
31
30#define VIRTIO_SCSI_CDB_SIZE 32 32#define VIRTIO_SCSI_CDB_SIZE 32
31#define VIRTIO_SCSI_SENSE_SIZE 96 33#define VIRTIO_SCSI_SENSE_SIZE 96
32 34
33/* SCSI command request, followed by data-out */ 35/* SCSI command request, followed by data-out */
34struct virtio_scsi_cmd_req { 36struct virtio_scsi_cmd_req {
35 u8 lun[8]; /* Logical Unit Number */ 37 __u8 lun[8]; /* Logical Unit Number */
36 u64 tag; /* Command identifier */ 38 __virtio64 tag; /* Command identifier */
37 u8 task_attr; /* Task attribute */ 39 __u8 task_attr; /* Task attribute */
38 u8 prio; /* SAM command priority field */ 40 __u8 prio; /* SAM command priority field */
39 u8 crn; 41 __u8 crn;
40 u8 cdb[VIRTIO_SCSI_CDB_SIZE]; 42 __u8 cdb[VIRTIO_SCSI_CDB_SIZE];
41} __packed; 43} __attribute__((packed));
42 44
43/* SCSI command request, followed by protection information */ 45/* SCSI command request, followed by protection information */
44struct virtio_scsi_cmd_req_pi { 46struct virtio_scsi_cmd_req_pi {
45 u8 lun[8]; /* Logical Unit Number */ 47 __u8 lun[8]; /* Logical Unit Number */
46 u64 tag; /* Command identifier */ 48 __virtio64 tag; /* Command identifier */
47 u8 task_attr; /* Task attribute */ 49 __u8 task_attr; /* Task attribute */
48 u8 prio; /* SAM command priority field */ 50 __u8 prio; /* SAM command priority field */
49 u8 crn; 51 __u8 crn;
50 u32 pi_bytesout; /* DataOUT PI Number of bytes */ 52 __virtio32 pi_bytesout; /* DataOUT PI Number of bytes */
51 u32 pi_bytesin; /* DataIN PI Number of bytes */ 53 __virtio32 pi_bytesin; /* DataIN PI Number of bytes */
52 u8 cdb[VIRTIO_SCSI_CDB_SIZE]; 54 __u8 cdb[VIRTIO_SCSI_CDB_SIZE];
53} __packed; 55} __attribute__((packed));
54 56
55/* Response, followed by sense data and data-in */ 57/* Response, followed by sense data and data-in */
56struct virtio_scsi_cmd_resp { 58struct virtio_scsi_cmd_resp {
57 u32 sense_len; /* Sense data length */ 59 __virtio32 sense_len; /* Sense data length */
58 u32 resid; /* Residual bytes in data buffer */ 60 __virtio32 resid; /* Residual bytes in data buffer */
59 u16 status_qualifier; /* Status qualifier */ 61 __virtio16 status_qualifier; /* Status qualifier */
60 u8 status; /* Command completion status */ 62 __u8 status; /* Command completion status */
61 u8 response; /* Response values */ 63 __u8 response; /* Response values */
62 u8 sense[VIRTIO_SCSI_SENSE_SIZE]; 64 __u8 sense[VIRTIO_SCSI_SENSE_SIZE];
63} __packed; 65} __attribute__((packed));
64 66
65/* Task Management Request */ 67/* Task Management Request */
66struct virtio_scsi_ctrl_tmf_req { 68struct virtio_scsi_ctrl_tmf_req {
67 u32 type; 69 __virtio32 type;
68 u32 subtype; 70 __virtio32 subtype;
69 u8 lun[8]; 71 __u8 lun[8];
70 u64 tag; 72 __virtio64 tag;
71} __packed; 73} __attribute__((packed));
72 74
73struct virtio_scsi_ctrl_tmf_resp { 75struct virtio_scsi_ctrl_tmf_resp {
74 u8 response; 76 __u8 response;
75} __packed; 77} __attribute__((packed));
76 78
77/* Asynchronous notification query/subscription */ 79/* Asynchronous notification query/subscription */
78struct virtio_scsi_ctrl_an_req { 80struct virtio_scsi_ctrl_an_req {
79 u32 type; 81 __virtio32 type;
80 u8 lun[8]; 82 __u8 lun[8];
81 u32 event_requested; 83 __virtio32 event_requested;
82} __packed; 84} __attribute__((packed));
83 85
84struct virtio_scsi_ctrl_an_resp { 86struct virtio_scsi_ctrl_an_resp {
85 u32 event_actual; 87 __virtio32 event_actual;
86 u8 response; 88 __u8 response;
87} __packed; 89} __attribute__((packed));
88 90
89struct virtio_scsi_event { 91struct virtio_scsi_event {
90 u32 event; 92 __virtio32 event;
91 u8 lun[8]; 93 __u8 lun[8];
92 u32 reason; 94 __virtio32 reason;
93} __packed; 95} __attribute__((packed));
94 96
95struct virtio_scsi_config { 97struct virtio_scsi_config {
96 u32 num_queues; 98 __u32 num_queues;
97 u32 seg_max; 99 __u32 seg_max;
98 u32 max_sectors; 100 __u32 max_sectors;
99 u32 cmd_per_lun; 101 __u32 cmd_per_lun;
100 u32 event_info_size; 102 __u32 event_info_size;
101 u32 sense_size; 103 __u32 sense_size;
102 u32 cdb_size; 104 __u32 cdb_size;
103 u16 max_channel; 105 __u16 max_channel;
104 u16 max_target; 106 __u16 max_target;
105 u32 max_lun; 107 __u32 max_lun;
106} __packed; 108} __attribute__((packed));
107 109
108/* Feature Bits */ 110/* Feature Bits */
109#define VIRTIO_SCSI_F_INOUT 0 111#define VIRTIO_SCSI_F_INOUT 0
diff --git a/include/uapi/linux/virtio_types.h b/include/uapi/linux/virtio_types.h
new file mode 100644
index 000000000000..e845e8c4cbee
--- /dev/null
+++ b/include/uapi/linux/virtio_types.h
@@ -0,0 +1,46 @@
1#ifndef _UAPI_LINUX_VIRTIO_TYPES_H
2#define _UAPI_LINUX_VIRTIO_TYPES_H
3/* Type definitions for virtio implementations.
4 *
5 * This header is BSD licensed so anyone can use the definitions to implement
6 * compatible drivers/servers.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of IBM nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * Copyright (C) 2014 Red Hat, Inc.
32 * Author: Michael S. Tsirkin <mst@redhat.com>
33 */
34#include <linux/types.h>
35
36/*
37 * __virtio{16,32,64} have the following meaning:
38 * - __u{16,32,64} for virtio devices in legacy mode, accessed in native endian
39 * - __le{16,32,64} for standard-compliant virtio devices
40 */
41
42typedef __u16 __bitwise__ __virtio16;
43typedef __u32 __bitwise__ __virtio32;
44typedef __u64 __bitwise__ __virtio64;
45
46#endif /* _UAPI_LINUX_VIRTIO_TYPES_H */
diff --git a/include/uapi/linux/vt.h b/include/uapi/linux/vt.h
index 4b59a26799a3..978578bd1895 100644
--- a/include/uapi/linux/vt.h
+++ b/include/uapi/linux/vt.h
@@ -84,7 +84,4 @@ struct vt_setactivate {
84 84
85#define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */ 85#define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */
86 86
87
88#define vt_get_kmsg_redirect() vt_kmsg_redirect(-1)
89
90#endif /* _UAPI_LINUX_VT_H */ 87#endif /* _UAPI_LINUX_VT_H */
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index 6ee586728df9..1f23cd635957 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -96,9 +96,10 @@ enum {
96 SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */ 96 SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */
97 SNDRV_HWDEP_IFACE_FW_FIREWORKS, /* Echo Audio Fireworks based device */ 97 SNDRV_HWDEP_IFACE_FW_FIREWORKS, /* Echo Audio Fireworks based device */
98 SNDRV_HWDEP_IFACE_FW_BEBOB, /* BridgeCo BeBoB based device */ 98 SNDRV_HWDEP_IFACE_FW_BEBOB, /* BridgeCo BeBoB based device */
99 SNDRV_HWDEP_IFACE_FW_OXFW, /* Oxford OXFW970/971 based device */
99 100
100 /* Don't forget to change the following: */ 101 /* Don't forget to change the following: */
101 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_BEBOB 102 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_OXFW
102}; 103};
103 104
104struct snd_hwdep_info { 105struct snd_hwdep_info {
@@ -220,7 +221,9 @@ typedef int __bitwise snd_pcm_format_t;
220#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ 221#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
221#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ 222#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
222#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ 223#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
223#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_LE 224#define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */
225#define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */
226#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE
224 227
225#ifdef SNDRV_LITTLE_ENDIAN 228#ifdef SNDRV_LITTLE_ENDIAN
226#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE 229#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h
index 1964026b5e09..22ed8cb7800b 100644
--- a/include/uapi/sound/compress_offload.h
+++ b/include/uapi/sound/compress_offload.h
@@ -32,7 +32,7 @@
32 32
33#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2) 33#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2)
34/** 34/**
35 * struct snd_compressed_buffer: compressed buffer 35 * struct snd_compressed_buffer - compressed buffer
36 * @fragment_size: size of buffer fragment in bytes 36 * @fragment_size: size of buffer fragment in bytes
37 * @fragments: number of such fragments 37 * @fragments: number of such fragments
38 */ 38 */
@@ -42,7 +42,7 @@ struct snd_compressed_buffer {
42} __attribute__((packed, aligned(4))); 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
46 * @buffer: buffer description 46 * @buffer: buffer description
47 * @codec: codec parameters 47 * @codec: codec parameters
48 * @no_wake_mode: dont wake on fragment elapsed 48 * @no_wake_mode: dont wake on fragment elapsed
@@ -54,7 +54,7 @@ struct snd_compr_params {
54} __attribute__((packed, aligned(4))); 54} __attribute__((packed, aligned(4)));
55 55
56/** 56/**
57 * struct snd_compr_tstamp: timestamp descriptor 57 * struct snd_compr_tstamp - timestamp descriptor
58 * @byte_offset: Byte offset in ring buffer to DSP 58 * @byte_offset: Byte offset in ring buffer to DSP
59 * @copied_total: Total number of bytes copied from/to ring buffer to/by DSP 59 * @copied_total: Total number of bytes copied from/to ring buffer to/by DSP
60 * @pcm_frames: Frames decoded or encoded by DSP. This field will evolve by 60 * @pcm_frames: Frames decoded or encoded by DSP. This field will evolve by
@@ -73,7 +73,7 @@ struct snd_compr_tstamp {
73} __attribute__((packed, aligned(4))); 73} __attribute__((packed, aligned(4)));
74 74
75/** 75/**
76 * struct snd_compr_avail: avail descriptor 76 * struct snd_compr_avail - avail descriptor
77 * @avail: Number of bytes available in ring buffer for writing/reading 77 * @avail: Number of bytes available in ring buffer for writing/reading
78 * @tstamp: timestamp infomation 78 * @tstamp: timestamp infomation
79 */ 79 */
@@ -88,7 +88,7 @@ enum snd_compr_direction {
88}; 88};
89 89
90/** 90/**
91 * struct snd_compr_caps: caps descriptor 91 * struct snd_compr_caps - caps descriptor
92 * @codecs: pointer to array of codecs 92 * @codecs: pointer to array of codecs
93 * @direction: direction supported. Of type snd_compr_direction 93 * @direction: direction supported. Of type snd_compr_direction
94 * @min_fragment_size: minimum fragment supported by DSP 94 * @min_fragment_size: minimum fragment supported by DSP
@@ -110,7 +110,7 @@ struct snd_compr_caps {
110} __attribute__((packed, aligned(4))); 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
114 * @codec: codec for which capability is queried 114 * @codec: codec for which capability is queried
115 * @num_descriptors: number of codec descriptors 115 * @num_descriptors: number of codec descriptors
116 * @descriptor: array of codec capability descriptor 116 * @descriptor: array of codec capability descriptor
@@ -122,18 +122,19 @@ struct snd_compr_codec_caps {
122} __attribute__((packed, aligned(4))); 122} __attribute__((packed, aligned(4)));
123 123
124/** 124/**
125 * enum sndrv_compress_encoder
125 * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the 126 * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the
126 * end of the track 127 * end of the track
127 * @SNDRV_COMPRESS_ENCODER_DELAY: no of samples inserted by the encoder at the 128 * @SNDRV_COMPRESS_ENCODER_DELAY: no of samples inserted by the encoder at the
128 * beginning of the track 129 * beginning of the track
129 */ 130 */
130enum { 131enum sndrv_compress_encoder {
131 SNDRV_COMPRESS_ENCODER_PADDING = 1, 132 SNDRV_COMPRESS_ENCODER_PADDING = 1,
132 SNDRV_COMPRESS_ENCODER_DELAY = 2, 133 SNDRV_COMPRESS_ENCODER_DELAY = 2,
133}; 134};
134 135
135/** 136/**
136 * struct snd_compr_metadata: compressed stream metadata 137 * struct snd_compr_metadata - compressed stream metadata
137 * @key: key id 138 * @key: key id
138 * @value: key value 139 * @value: key value
139 */ 140 */
diff --git a/include/uapi/sound/firewire.h b/include/uapi/sound/firewire.h
index af4bd136c75d..49122df3b56b 100644
--- a/include/uapi/sound/firewire.h
+++ b/include/uapi/sound/firewire.h
@@ -55,7 +55,8 @@ union snd_firewire_event {
55#define SNDRV_FIREWIRE_TYPE_DICE 1 55#define SNDRV_FIREWIRE_TYPE_DICE 1
56#define SNDRV_FIREWIRE_TYPE_FIREWORKS 2 56#define SNDRV_FIREWIRE_TYPE_FIREWORKS 2
57#define SNDRV_FIREWIRE_TYPE_BEBOB 3 57#define SNDRV_FIREWIRE_TYPE_BEBOB 3
58/* AV/C, RME, MOTU, ... */ 58#define SNDRV_FIREWIRE_TYPE_OXFW 4
59/* RME, MOTU, ... */
59 60
60struct snd_firewire_get_info { 61struct snd_firewire_get_info {
61 unsigned int type; /* SNDRV_FIREWIRE_TYPE_xxx */ 62 unsigned int type; /* SNDRV_FIREWIRE_TYPE_xxx */
diff --git a/include/uapi/sound/hdspm.h b/include/uapi/sound/hdspm.h
index d956c3593f65..b357f1a5e29c 100644
--- a/include/uapi/sound/hdspm.h
+++ b/include/uapi/sound/hdspm.h
@@ -74,14 +74,14 @@ struct hdspm_config {
74#define SNDRV_HDSPM_IOCTL_GET_CONFIG \ 74#define SNDRV_HDSPM_IOCTL_GET_CONFIG \
75 _IOR('H', 0x41, struct hdspm_config) 75 _IOR('H', 0x41, struct hdspm_config)
76 76
77/** 77/*
78 * If there's a TCO (TimeCode Option) board installed, 78 * If there's a TCO (TimeCode Option) board installed,
79 * there are further options and status data available. 79 * there are further options and status data available.
80 * The hdspm_ltc structure contains the current SMPTE 80 * The hdspm_ltc structure contains the current SMPTE
81 * timecode and some status information and can be 81 * timecode and some status information and can be
82 * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the 82 * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the
83 * hdspm_status struct. 83 * hdspm_status struct.
84 **/ 84 */
85 85
86enum hdspm_ltc_format { 86enum hdspm_ltc_format {
87 format_invalid, 87 format_invalid,
@@ -113,11 +113,11 @@ struct hdspm_ltc {
113 113
114#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc) 114#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc)
115 115
116/** 116/*
117 * The status data reflects the device's current state 117 * The status data reflects the device's current state
118 * as determined by the card's configuration and 118 * as determined by the card's configuration and
119 * connection status. 119 * connection status.
120 **/ 120 */
121 121
122enum hdspm_sync { 122enum hdspm_sync {
123 hdspm_sync_no_lock = 0, 123 hdspm_sync_no_lock = 0,
@@ -171,9 +171,9 @@ struct hdspm_status {
171#define SNDRV_HDSPM_IOCTL_GET_STATUS \ 171#define SNDRV_HDSPM_IOCTL_GET_STATUS \
172 _IOR('H', 0x47, struct hdspm_status) 172 _IOR('H', 0x47, struct hdspm_status)
173 173
174/** 174/*
175 * Get information about the card and its add-ons. 175 * Get information about the card and its add-ons.
176 **/ 176 */
177 177
178#define HDSPM_ADDON_TCO 1 178#define HDSPM_ADDON_TCO 1
179 179
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 069dfca9549a..6a84498ea513 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -166,13 +166,6 @@ enum omap_dss_display_state {
166 OMAP_DSS_DISPLAY_ACTIVE, 166 OMAP_DSS_DISPLAY_ACTIVE,
167}; 167};
168 168
169enum omap_dss_audio_state {
170 OMAP_DSS_AUDIO_DISABLED = 0,
171 OMAP_DSS_AUDIO_ENABLED,
172 OMAP_DSS_AUDIO_CONFIGURED,
173 OMAP_DSS_AUDIO_PLAYING,
174};
175
176struct omap_dss_audio { 169struct omap_dss_audio {
177 struct snd_aes_iec958 *iec; 170 struct snd_aes_iec958 *iec;
178 struct snd_cea_861_aud_if *cea; 171 struct snd_cea_861_aud_if *cea;
@@ -635,19 +628,6 @@ struct omapdss_hdmi_ops {
635 int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode); 628 int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
636 int (*set_infoframe)(struct omap_dss_device *dssdev, 629 int (*set_infoframe)(struct omap_dss_device *dssdev,
637 const struct hdmi_avi_infoframe *avi); 630 const struct hdmi_avi_infoframe *avi);
638
639 /*
640 * Note: These functions might sleep. Do not call while
641 * holding a spinlock/readlock.
642 */
643 int (*audio_enable)(struct omap_dss_device *dssdev);
644 void (*audio_disable)(struct omap_dss_device *dssdev);
645 bool (*audio_supported)(struct omap_dss_device *dssdev);
646 int (*audio_config)(struct omap_dss_device *dssdev,
647 struct omap_dss_audio *audio);
648 /* Note: These functions may not sleep */
649 int (*audio_start)(struct omap_dss_device *dssdev);
650 void (*audio_stop)(struct omap_dss_device *dssdev);
651}; 631};
652 632
653struct omapdss_dsi_ops { 633struct omapdss_dsi_ops {
@@ -783,8 +763,6 @@ struct omap_dss_device {
783 763
784 enum omap_dss_display_state state; 764 enum omap_dss_display_state state;
785 765
786 enum omap_dss_audio_state audio_state;
787
788 /* OMAP DSS output specific fields */ 766 /* OMAP DSS output specific fields */
789 767
790 struct list_head list; 768 struct list_head list;
@@ -795,6 +773,9 @@ struct omap_dss_device {
795 /* output instance */ 773 /* output instance */
796 enum omap_dss_output_id id; 774 enum omap_dss_output_id id;
797 775
776 /* the port number in the DT node */
777 int port_num;
778
798 /* dynamic fields */ 779 /* dynamic fields */
799 struct omap_overlay_manager *manager; 780 struct omap_overlay_manager *manager;
800 781
@@ -858,24 +839,6 @@ struct omap_dss_driver {
858 int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode); 839 int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
859 int (*set_hdmi_infoframe)(struct omap_dss_device *dssdev, 840 int (*set_hdmi_infoframe)(struct omap_dss_device *dssdev,
860 const struct hdmi_avi_infoframe *avi); 841 const struct hdmi_avi_infoframe *avi);
861
862 /*
863 * For display drivers that support audio. This encompasses
864 * HDMI and DisplayPort at the moment.
865 */
866 /*
867 * Note: These functions might sleep. Do not call while
868 * holding a spinlock/readlock.
869 */
870 int (*audio_enable)(struct omap_dss_device *dssdev);
871 void (*audio_disable)(struct omap_dss_device *dssdev);
872 bool (*audio_supported)(struct omap_dss_device *dssdev);
873 int (*audio_config)(struct omap_dss_device *dssdev,
874 struct omap_dss_audio *audio);
875 /* Note: These functions may not sleep */
876 int (*audio_start)(struct omap_dss_device *dssdev);
877 void (*audio_stop)(struct omap_dss_device *dssdev);
878
879}; 842};
880 843
881enum omapdss_version omapdss_get_version(void); 844enum omapdss_version omapdss_get_version(void);
@@ -918,7 +881,7 @@ int omapdss_register_output(struct omap_dss_device *output);
918void omapdss_unregister_output(struct omap_dss_device *output); 881void omapdss_unregister_output(struct omap_dss_device *output);
919struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id); 882struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id);
920struct omap_dss_device *omap_dss_find_output(const char *name); 883struct omap_dss_device *omap_dss_find_output(const char *name);
921struct omap_dss_device *omap_dss_find_output_by_node(struct device_node *node); 884struct omap_dss_device *omap_dss_find_output_by_port_node(struct device_node *port);
922int omapdss_output_set_device(struct omap_dss_device *out, 885int omapdss_output_set_device(struct omap_dss_device *out,
923 struct omap_dss_device *dssdev); 886 struct omap_dss_device *dssdev);
924int omapdss_output_unset_device(struct omap_dss_device *out); 887int omapdss_output_unset_device(struct omap_dss_device *out);
diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h
index 14334d0161d5..131a6ccdba25 100644
--- a/include/xen/interface/features.h
+++ b/include/xen/interface/features.h
@@ -53,9 +53,6 @@
53/* operation as Dom0 is supported */ 53/* operation as Dom0 is supported */
54#define XENFEAT_dom0 11 54#define XENFEAT_dom0 11
55 55
56/* Xen also maps grant references at pfn = mfn */
57#define XENFEAT_grant_map_identity 12
58
59#define XENFEAT_NR_SUBMAPS 1 56#define XENFEAT_NR_SUBMAPS 1
60 57
61#endif /* __XEN_PUBLIC_FEATURES_H__ */ 58#endif /* __XEN_PUBLIC_FEATURES_H__ */
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
index e40fae9bf11a..bcce56439d64 100644
--- a/include/xen/interface/grant_table.h
+++ b/include/xen/interface/grant_table.h
@@ -479,6 +479,25 @@ struct gnttab_get_version {
479DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_version); 479DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_version);
480 480
481/* 481/*
482 * Issue one or more cache maintenance operations on a portion of a
483 * page granted to the calling domain by a foreign domain.
484 */
485#define GNTTABOP_cache_flush 12
486struct gnttab_cache_flush {
487 union {
488 uint64_t dev_bus_addr;
489 grant_ref_t ref;
490 } a;
491 uint16_t offset; /* offset from start of grant */
492 uint16_t length; /* size within the grant */
493#define GNTTAB_CACHE_CLEAN (1<<0)
494#define GNTTAB_CACHE_INVAL (1<<1)
495#define GNTTAB_CACHE_SOURCE_GREF (1<<31)
496 uint32_t op;
497};
498DEFINE_GUEST_HANDLE_STRUCT(gnttab_cache_flush);
499
500/*
482 * Bitfield values for update_pin_status.flags. 501 * Bitfield values for update_pin_status.flags.
483 */ 502 */
484 /* Map the grant entry for access by I/O devices. */ 503 /* Map the grant entry for access by I/O devices. */