aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_bus.h4
-rw-r--r--include/acpi/acpi_io.h4
-rw-r--r--include/acpi/acpixf.h14
-rw-r--r--include/acpi/actbl2.h70
-rw-r--r--include/acpi/actypes.h50
-rw-r--r--include/acpi/platform/acenv.h1
-rw-r--r--include/acpi/processor.h6
-rw-r--r--include/asm-generic/dma-mapping-common.h5
-rw-r--r--include/asm-generic/gpio.h48
-rw-r--r--include/asm-generic/pgtable.h30
-rw-r--r--include/asm-generic/seccomp.h2
-rw-r--r--include/asm-generic/vmlinux.lds.h18
-rw-r--r--include/crypto/algapi.h2
-rw-r--r--include/crypto/if_alg.h4
-rw-r--r--include/crypto/rng.h3
-rw-r--r--include/crypto/sha.h15
-rw-r--r--include/crypto/sha1_base.h106
-rw-r--r--include/crypto/sha256_base.h128
-rw-r--r--include/crypto/sha512_base.h131
-rw-r--r--include/drm/bridge/dw_hdmi.h5
-rw-r--r--include/drm/drmP.h20
-rw-r--r--include/drm/drm_atomic.h24
-rw-r--r--include/drm/drm_atomic_helper.h20
-rw-r--r--include/drm/drm_crtc.h21
-rw-r--r--include/drm/drm_crtc_helper.h9
-rw-r--r--include/drm/drm_dp_helper.h176
-rw-r--r--include/drm/drm_dp_mst_helper.h2
-rw-r--r--include/drm/drm_edid.h2
-rw-r--r--include/drm/drm_fb_helper.h19
-rw-r--r--include/drm/drm_gem.h14
-rw-r--r--include/drm/drm_mm.h52
-rw-r--r--include/drm/drm_modes.h2
-rw-r--r--include/drm/drm_panel.h5
-rw-r--r--include/drm/drm_plane_helper.h12
-rw-r--r--include/drm/i915_pciids.h77
-rw-r--r--include/drm/ttm/ttm_bo_api.h2
-rw-r--r--include/drm/ttm/ttm_bo_driver.h2
-rw-r--r--include/dt-bindings/clock/exynos3250.h61
-rw-r--r--include/dt-bindings/clock/exynos5433.h1403
-rw-r--r--include/dt-bindings/clock/imx6qdl-clock.h5
-rw-r--r--include/dt-bindings/clock/pistachio-clk.h183
-rw-r--r--include/dt-bindings/clock/qcom,gcc-ipq806x.h1
-rw-r--r--include/dt-bindings/clock/qcom,gcc-msm8916.h156
-rw-r--r--include/dt-bindings/clock/r8a73a4-clock.h62
-rw-r--r--include/dt-bindings/clock/r8a7778-clock.h71
-rw-r--r--include/dt-bindings/clock/r8a7790-clock.h3
-rw-r--r--include/dt-bindings/clock/r8a7791-clock.h3
-rw-r--r--include/dt-bindings/clock/sh73a0-clock.h3
-rw-r--r--include/dt-bindings/clock/tegra124-car-common.h2
-rw-r--r--include/dt-bindings/dma/jz4780-dma.h49
-rw-r--r--include/dt-bindings/gpio/meson8b-gpio.h32
-rw-r--r--include/dt-bindings/interrupt-controller/irq-st.h30
-rw-r--r--include/dt-bindings/leds/common.h21
-rw-r--r--include/dt-bindings/media/omap3-isp.h22
-rw-r--r--include/dt-bindings/media/xilinx-vip.h39
-rw-r--r--include/dt-bindings/mfd/arizona.h (renamed from include/linux/mfd/arizona/gpio.h)67
-rw-r--r--include/dt-bindings/mfd/qcom-rpm.h6
-rw-r--r--include/dt-bindings/phy/phy-miphy365x.h14
-rw-r--r--include/dt-bindings/pinctrl/am33xx.h3
-rw-r--r--include/dt-bindings/pinctrl/am43xx.h3
-rw-r--r--include/dt-bindings/pinctrl/mt65xx.h40
-rw-r--r--include/dt-bindings/pinctrl/qcom,pmic-gpio.h15
-rw-r--r--include/dt-bindings/pinctrl/qcom,pmic-mpp.h4
-rw-r--r--include/dt-bindings/reset/qcom,gcc-msm8916.h108
-rw-r--r--include/kvm/arm_arch_timer.h31
-rw-r--r--include/kvm/arm_vgic.h118
-rw-r--r--include/kvm/iodev.h76
-rw-r--r--include/linux/a.out.h67
-rw-r--r--include/linux/acpi.h23
-rw-r--r--include/linux/acpi_irq.h10
-rw-r--r--include/linux/aio.h70
-rw-r--r--include/linux/arm-cci.h9
-rw-r--r--include/linux/async_tx.h3
-rw-r--r--include/linux/ata.h29
-rw-r--r--include/linux/bcm47xx_nvram.h34
-rw-r--r--include/linux/bcma/bcma.h21
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h11
-rw-r--r--include/linux/bcma/bcma_driver_gmac_cmn.h6
-rw-r--r--include/linux/bcma/bcma_driver_mips.h15
-rw-r--r--include/linux/bcma/bcma_driver_pci.h12
-rw-r--r--include/linux/bcma/bcma_driver_pcie2.h4
-rw-r--r--include/linux/bitmap.h16
-rw-r--r--include/linux/bitops.h4
-rw-r--r--include/linux/blk-mq.h9
-rw-r--r--include/linux/blk_types.h4
-rw-r--r--include/linux/bpf.h63
-rw-r--r--include/linux/brcmphy.h2
-rw-r--r--include/linux/can/dev.h2
-rw-r--r--include/linux/can/led.h6
-rw-r--r--include/linux/can/skb.h7
-rw-r--r--include/linux/capability.h29
-rw-r--r--include/linux/ceph/ceph_features.h16
-rw-r--r--include/linux/ceph/ceph_fs.h1
-rw-r--r--include/linux/ceph/debugfs.h8
-rw-r--r--include/linux/ceph/libceph.h2
-rw-r--r--include/linux/ceph/osdmap.h5
-rw-r--r--include/linux/cleancache.h13
-rw-r--r--include/linux/clk-provider.h2
-rw-r--r--include/linux/clk.h18
-rw-r--r--include/linux/clk/at91_pmc.h4
-rw-r--r--include/linux/clk/shmobile.h1
-rw-r--r--include/linux/clk/ti.h6
-rw-r--r--include/linux/clockchips.h154
-rw-r--r--include/linux/clocksource.h31
-rw-r--r--include/linux/cma.h12
-rw-r--r--include/linux/compaction.h1
-rw-r--r--include/linux/compiler.h16
-rw-r--r--include/linux/console.h3
-rw-r--r--include/linux/context_tracking.h15
-rw-r--r--include/linux/context_tracking_state.h9
-rw-r--r--include/linux/cpu.h20
-rw-r--r--include/linux/cpuidle.h18
-rw-r--r--include/linux/cpumask.h176
-rw-r--r--include/linux/cred.h23
-rw-r--r--include/linux/crush/crush.h12
-rw-r--r--include/linux/crypto.h6
-rw-r--r--include/linux/dcache.h59
-rw-r--r--include/linux/dccp.h4
-rw-r--r--include/linux/devfreq-event.h2
-rw-r--r--include/linux/device-mapper.h6
-rw-r--r--include/linux/device.h23
-rw-r--r--include/linux/dma-buf.h34
-rw-r--r--include/linux/dma-mapping.h4
-rw-r--r--include/linux/dma/hsu.h48
-rw-r--r--include/linux/dma/xilinx_dma.h (renamed from include/linux/amba/xilinx_dma.h)0
-rw-r--r--include/linux/dmaengine.h36
-rw-r--r--include/linux/dmapool.h2
-rw-r--r--include/linux/efi.h1
-rw-r--r--include/linux/elf-randomize.h22
-rw-r--r--include/linux/etherdevice.h1
-rw-r--r--include/linux/f2fs_fs.h3
-rw-r--r--include/linux/falloc.h6
-rw-r--r--include/linux/filter.h7
-rw-r--r--include/linux/fixp-arith.h145
-rw-r--r--include/linux/fs.h120
-rw-r--r--include/linux/fs_pin.h2
-rw-r--r--include/linux/ftrace_event.h18
-rw-r--r--include/linux/fwnode.h27
-rw-r--r--include/linux/gfp.h16
-rw-r--r--include/linux/gpio/consumer.h77
-rw-r--r--include/linux/gpio/driver.h48
-rw-r--r--include/linux/hardirq.h2
-rw-r--r--include/linux/hid-sensor-hub.h60
-rw-r--r--include/linux/hid-sensor-ids.h2
-rw-r--r--include/linux/hid.h8
-rw-r--r--include/linux/host1x.h1
-rw-r--r--include/linux/hsi/hsi.h6
-rw-r--r--include/linux/hugetlb.h20
-rw-r--r--include/linux/hw_random.h4
-rw-r--r--include/linux/hyperv.h37
-rw-r--r--include/linux/i2c.h59
-rw-r--r--include/linux/ieee802154.h14
-rw-r--r--include/linux/if_bridge.h1
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_pppox.h2
-rw-r--r--include/linux/if_vlan.h67
-rw-r--r--include/linux/iio/buffer.h8
-rw-r--r--include/linux/iio/dac/max517.h2
-rw-r--r--include/linux/iio/events.h30
-rw-r--r--include/linux/iio/iio.h13
-rw-r--r--include/linux/iio/types.h78
-rw-r--r--include/linux/inet_diag.h43
-rw-r--r--include/linux/init.h38
-rw-r--r--include/linux/intel-iommu.h18
-rw-r--r--include/linux/intel_mid_dma.h76
-rw-r--r--include/linux/interrupt.h27
-rw-r--r--include/linux/io.h10
-rw-r--r--include/linux/iommu-common.h51
-rw-r--r--include/linux/iommu.h33
-rw-r--r--include/linux/ioport.h8
-rw-r--r--include/linux/ipv6.h4
-rw-r--r--include/linux/irq.h7
-rw-r--r--include/linux/irq_work.h3
-rw-r--r--include/linux/irqchip/arm-gic-acpi.h31
-rw-r--r--include/linux/irqchip/arm-gic-v3.h22
-rw-r--r--include/linux/irqchip/arm-gic.h7
-rw-r--r--include/linux/irqchip/irq-crossbar.h11
-rw-r--r--include/linux/irqchip/mips-gic.h9
-rw-r--r--include/linux/irqdesc.h1
-rw-r--r--include/linux/irqflags.h43
-rw-r--r--include/linux/jhash.h17
-rw-r--r--include/linux/jump_label.h21
-rw-r--r--include/linux/jz4780-nemc.h43
-rw-r--r--include/linux/kasan.h11
-rw-r--r--include/linux/kconfig.h24
-rw-r--r--include/linux/kernel.h12
-rw-r--r--include/linux/ksm.h17
-rw-r--r--include/linux/kvm_host.h35
-rw-r--r--include/linux/lcm.h1
-rw-r--r--include/linux/led-class-flash.h19
-rw-r--r--include/linux/leds.h5
-rw-r--r--include/linux/lguest.h4
-rw-r--r--include/linux/libata.h2
-rw-r--r--include/linux/livepatch.h8
-rw-r--r--include/linux/lockdep.h7
-rw-r--r--include/linux/memblock.h8
-rw-r--r--include/linux/memory_hotplug.h6
-rw-r--r--include/linux/mempool.h5
-rw-r--r--include/linux/mfd/abx500/ux500_chargalg.h11
-rw-r--r--include/linux/mfd/arizona/core.h3
-rw-r--r--include/linux/mfd/arizona/pdata.h24
-rw-r--r--include/linux/mfd/cros_ec.h23
-rw-r--r--include/linux/mfd/max77693-private.h5
-rw-r--r--include/linux/mfd/max77693.h25
-rw-r--r--include/linux/mfd/max77843-private.h454
-rw-r--r--include/linux/mfd/menelaus.h7
-rw-r--r--include/linux/mfd/mt6397/core.h64
-rw-r--r--include/linux/mfd/mt6397/registers.h362
-rw-r--r--include/linux/mfd/palmas.h4
-rw-r--r--include/linux/mfd/rk808.h3
-rw-r--r--include/linux/mfd/rt5033.h2
-rw-r--r--include/linux/mfd/rtsx_pci.h1116
-rw-r--r--include/linux/mfd/samsung/core.h9
-rw-r--r--include/linux/mfd/samsung/irq.h2
-rw-r--r--include/linux/mfd/samsung/rtc.h2
-rw-r--r--include/linux/mfd/sky81452.h31
-rw-r--r--include/linux/mfd/stw481x.h4
-rw-r--r--include/linux/mfd/syscon/atmel-st.h49
-rw-r--r--include/linux/mfd/syscon/exynos5-pmu.h3
-rw-r--r--include/linux/mfd/syscon/imx6q-iomuxc-gpr.h1
-rw-r--r--include/linux/mfd/tc3589x.h23
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h1
-rw-r--r--include/linux/mfd/tmio.h2
-rw-r--r--include/linux/mfd/wm8350/supply.h6
-rw-r--r--include/linux/migrate.h5
-rw-r--r--include/linux/miscdevice.h2
-rw-r--r--include/linux/mlx4/cmd.h26
-rw-r--r--include/linux/mlx4/device.h44
-rw-r--r--include/linux/mlx4/qp.h20
-rw-r--r--include/linux/mlx5/cmd.h2
-rw-r--r--include/linux/mlx5/cq.h7
-rw-r--r--include/linux/mlx5/device.h2
-rw-r--r--include/linux/mlx5/doorbell.h2
-rw-r--r--include/linux/mlx5/driver.h16
-rw-r--r--include/linux/mlx5/mlx5_ifc.h2
-rw-r--r--include/linux/mlx5/qp.h2
-rw-r--r--include/linux/mlx5/srq.h2
-rw-r--r--include/linux/mm.h102
-rw-r--r--include/linux/mm_types.h4
-rw-r--r--include/linux/mmc/card.h14
-rw-r--r--include/linux/mmc/core.h4
-rw-r--r--include/linux/mmc/dw_mmc.h6
-rw-r--r--include/linux/mmc/host.h6
-rw-r--r--include/linux/mmc/sdhci-spear.h34
-rw-r--r--include/linux/mmc/sdhci.h218
-rw-r--r--include/linux/mmc/sdio_ids.h2
-rw-r--r--include/linux/mmc/sh_mobile_sdhi.h10
-rw-r--r--include/linux/mmzone.h15
-rw-r--r--include/linux/mod_devicetable.h8
-rw-r--r--include/linux/module.h6
-rw-r--r--include/linux/moduleloader.h8
-rw-r--r--include/linux/mount.h3
-rw-r--r--include/linux/mtd/map.h54
-rw-r--r--include/linux/mtd/spi-nor.h5
-rw-r--r--include/linux/nbd.h46
-rw-r--r--include/linux/net.h12
-rw-r--r--include/linux/netdevice.h154
-rw-r--r--include/linux/netfilter.h103
-rw-r--r--include/linux/netfilter/ipset/ip_set.h5
-rw-r--r--include/linux/netfilter_arp/arp_tables.h3
-rw-r--r--include/linux/netfilter_bridge.h100
-rw-r--r--include/linux/netfilter_bridge/ebtables.h3
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h3
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h3
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/nfs4.h7
-rw-r--r--include/linux/nfs_fs.h11
-rw-r--r--include/linux/nfs_idmap.h79
-rw-r--r--include/linux/nfs_xdr.h6
-rw-r--r--include/linux/nmi.h21
-rw-r--r--include/linux/nvme.h5
-rw-r--r--include/linux/of.h44
-rw-r--r--include/linux/of_device.h3
-rw-r--r--include/linux/of_fdt.h2
-rw-r--r--include/linux/of_graph.h20
-rw-r--r--include/linux/of_iommu.h6
-rw-r--r--include/linux/of_irq.h9
-rw-r--r--include/linux/of_mdio.h7
-rw-r--r--include/linux/of_net.h8
-rw-r--r--include/linux/of_pci.h3
-rw-r--r--include/linux/of_platform.h2
-rw-r--r--include/linux/omap-gpmc.h3
-rw-r--r--include/linux/oom.h3
-rw-r--r--include/linux/page-flags.h105
-rw-r--r--include/linux/pci-acpi.h5
-rw-r--r--include/linux/pci-aspm.h4
-rw-r--r--include/linux/pci.h19
-rw-r--r--include/linux/pci_ids.h2
-rw-r--r--include/linux/perf_event.h121
-rw-r--r--include/linux/personality.h40
-rw-r--r--include/linux/phy_fixed.h9
-rw-r--r--include/linux/pinctrl/consumer.h6
-rw-r--r--include/linux/platform_data/dma-hsu.h25
-rw-r--r--include/linux/platform_data/dma-imx-sdma.h3
-rw-r--r--include/linux/platform_data/hsmmc-omap.h6
-rw-r--r--include/linux/platform_data/i2c-davinci.h1
-rw-r--r--include/linux/platform_data/mmc-msm_sdcc.h27
-rw-r--r--include/linux/platform_data/msm_serial_hs.h49
-rw-r--r--include/linux/platform_data/nxp-nci.h27
-rw-r--r--include/linux/platform_data/serial-imx.h5
-rw-r--r--include/linux/platform_data/sky81452-backlight.h46
-rw-r--r--include/linux/platform_data/st33zp24.h (renamed from include/linux/platform_data/tpm_stm_st33.h)21
-rw-r--r--include/linux/platform_device.h2
-rw-r--r--include/linux/pm-trace.h (renamed from include/linux/resume-trace.h)9
-rw-r--r--include/linux/pm.h8
-rw-r--r--include/linux/pm_domain.h6
-rw-r--r--include/linux/pnp.h12
-rw-r--r--include/linux/power/charger-manager.h3
-rw-r--r--include/linux/power/max17042_battery.h9
-rw-r--r--include/linux/power_supply.h78
-rw-r--r--include/linux/printk.h5
-rw-r--r--include/linux/property.h44
-rw-r--r--include/linux/pstore.h1
-rw-r--r--include/linux/ptp_clock_kernel.h12
-rw-r--r--include/linux/qcom_scm.h28
-rw-r--r--include/linux/quota.h90
-rw-r--r--include/linux/quotaops.h14
-rw-r--r--include/linux/raid/pq.h1
-rw-r--r--include/linux/rcupdate.h40
-rw-r--r--include/linux/reboot.h3
-rw-r--r--include/linux/regulator/act8865.h14
-rw-r--r--include/linux/regulator/consumer.h23
-rw-r--r--include/linux/regulator/driver.h6
-rw-r--r--include/linux/remoteproc.h2
-rw-r--r--include/linux/rhashtable.h547
-rw-r--r--include/linux/rmap.h8
-rw-r--r--include/linux/rtc.h1
-rw-r--r--include/linux/rtnetlink.h15
-rw-r--r--include/linux/sched.h46
-rw-r--r--include/linux/security.h15
-rw-r--r--include/linux/seqlock.h6
-rw-r--r--include/linux/serial_8250.h20
-rw-r--r--include/linux/serial_core.h37
-rw-r--r--include/linux/serial_mfd.h47
-rw-r--r--include/linux/shdma-base.h1
-rw-r--r--include/linux/skbuff.h32
-rw-r--r--include/linux/slab.h2
-rw-r--r--include/linux/smp.h2
-rw-r--r--include/linux/smpboot.h1
-rw-r--r--include/linux/sock_diag.h4
-rw-r--r--include/linux/socket.h8
-rw-r--r--include/linux/spi/at86rf230.h1
-rw-r--r--include/linux/spi/cc2520.h1
-rw-r--r--include/linux/spi/spi.h10
-rw-r--r--include/linux/srcu.h2
-rw-r--r--include/linux/stacktrace.h2
-rw-r--r--include/linux/stddef.h9
-rw-r--r--include/linux/stmmac.h2
-rw-r--r--include/linux/string_helpers.h10
-rw-r--r--include/linux/sunrpc/debug.h18
-rw-r--r--include/linux/sunrpc/msg_prot.h8
-rw-r--r--include/linux/sunrpc/xprtrdma.h5
-rw-r--r--include/linux/swap.h2
-rw-r--r--include/linux/sysctl.h3
-rw-r--r--include/linux/sysfs.h15
-rw-r--r--include/linux/tcp.h5
-rw-r--r--include/linux/thermal.h56
-rw-r--r--include/linux/tick.h190
-rw-r--r--include/linux/timekeeper_internal.h16
-rw-r--r--include/linux/timekeeping.h18
-rw-r--r--include/linux/tracefs.h45
-rw-r--r--include/linux/tracepoint.h8
-rw-r--r--include/linux/types.h6
-rw-r--r--include/linux/udp.h2
-rw-r--r--include/linux/uidgid.h12
-rw-r--r--include/linux/uio.h25
-rw-r--r--include/linux/usb.h26
-rw-r--r--include/linux/usb/chipidea.h2
-rw-r--r--include/linux/usb/composite.h3
-rw-r--r--include/linux/usb/gadget.h9
-rw-r--r--include/linux/usb/msm_hsusb.h4
-rw-r--r--include/linux/usb/otg-fsm.h2
-rw-r--r--include/linux/usb/renesas_usbhs.h2
-rw-r--r--include/linux/usb/serial.h3
-rw-r--r--include/linux/usb/usbnet.h16
-rw-r--r--include/linux/util_macros.h40
-rw-r--r--include/linux/uwb/umc.h2
-rw-r--r--include/linux/vfio.h38
-rw-r--r--include/linux/vgaarb.h5
-rw-r--r--include/linux/virtio.h2
-rw-r--r--include/linux/virtio_config.h16
-rw-r--r--include/linux/virtio_ring.h23
-rw-r--r--include/linux/vmalloc.h1
-rw-r--r--include/linux/vme.h1
-rw-r--r--include/linux/watchdog.h8
-rw-r--r--include/linux/wl12xx.h49
-rw-r--r--include/linux/workqueue.h4
-rw-r--r--include/linux/writeback.h3
-rw-r--r--include/linux/zsmalloc.h1
-rw-r--r--include/media/adv7604.h83
-rw-r--r--include/media/atmel-isi.h4
-rw-r--r--include/media/davinci/vpfe_capture.h2
-rw-r--r--include/media/media-entity.h21
-rw-r--r--include/media/mt9p031.h2
-rw-r--r--include/media/omap3isp.h38
-rw-r--r--include/media/ov2659.h34
-rw-r--r--include/media/saa7146_vv.h4
-rw-r--r--include/media/v4l2-clk.h10
-rw-r--r--include/media/v4l2-dev.h1
-rw-r--r--include/media/v4l2-device.h2
-rw-r--r--include/media/v4l2-ioctl.h6
-rw-r--r--include/media/v4l2-of.h30
-rw-r--r--include/media/v4l2-subdev.h55
-rw-r--r--include/media/videobuf2-core.h20
-rw-r--r--include/net/9p/client.h8
-rw-r--r--include/net/9p/transport.h2
-rw-r--r--include/net/af_vsock.h4
-rw-r--r--include/net/arp.h20
-rw-r--r--include/net/ax25.h5
-rw-r--r--include/net/bluetooth/bluetooth.h45
-rw-r--r--include/net/bluetooth/hci.h59
-rw-r--r--include/net/bluetooth/hci_core.h233
-rw-r--r--include/net/bluetooth/mgmt.h101
-rw-r--r--include/net/bond_3ad.h29
-rw-r--r--include/net/caif/cfpkt.h2
-rw-r--r--include/net/cfg80211.h127
-rw-r--r--include/net/compat.h2
-rw-r--r--include/net/dcbnl.h3
-rw-r--r--include/net/dn_neigh.h5
-rw-r--r--include/net/dsa.h27
-rw-r--r--include/net/dst.h1
-rw-r--r--include/net/dst_ops.h1
-rw-r--r--include/net/fib_rules.h11
-rw-r--r--include/net/genetlink.h4
-rw-r--r--include/net/if_inet6.h4
-rw-r--r--include/net/inet6_connection_sock.h3
-rw-r--r--include/net/inet6_hashtables.h2
-rw-r--r--include/net/inet_common.h7
-rw-r--r--include/net/inet_connection_sock.h28
-rw-r--r--include/net/inet_hashtables.h36
-rw-r--r--include/net/inet_sock.h30
-rw-r--r--include/net/inet_timewait_sock.h108
-rw-r--r--include/net/inetpeer.h3
-rw-r--r--include/net/ip.h31
-rw-r--r--include/net/ip6_route.h6
-rw-r--r--include/net/ip6_tunnel.h6
-rw-r--r--include/net/ip_fib.h70
-rw-r--r--include/net/ip_tunnels.h1
-rw-r--r--include/net/ip_vs.h69
-rw-r--r--include/net/ipv6.h14
-rw-r--r--include/net/iw_handler.h22
-rw-r--r--include/net/mac80211.h251
-rw-r--r--include/net/mac802154.h13
-rw-r--r--include/net/ndisc.h19
-rw-r--r--include/net/neighbour.h67
-rw-r--r--include/net/net_namespace.h58
-rw-r--r--include/net/netfilter/ipv4/nf_reject.h8
-rw-r--r--include/net/netfilter/ipv6/nf_reject.h13
-rw-r--r--include/net/netfilter/nf_conntrack.h5
-rw-r--r--include/net/netfilter/nf_log.h10
-rw-r--r--include/net/netfilter/nf_nat_l3proto.h48
-rw-r--r--include/net/netfilter/nf_queue.h6
-rw-r--r--include/net/netfilter/nf_tables.h643
-rw-r--r--include/net/netfilter/nf_tables_core.h3
-rw-r--r--include/net/netfilter/nf_tables_ipv4.h5
-rw-r--r--include/net/netfilter/nf_tables_ipv6.h5
-rw-r--r--include/net/netfilter/nft_meta.h4
-rw-r--r--include/net/netlink.h50
-rw-r--r--include/net/netns/generic.h2
-rw-r--r--include/net/netns/hash.h4
-rw-r--r--include/net/netns/ipv4.h13
-rw-r--r--include/net/netns/ipv6.h3
-rw-r--r--include/net/netns/mpls.h17
-rw-r--r--include/net/netns/x_tables.h1
-rw-r--r--include/net/nfc/hci.h4
-rw-r--r--include/net/nfc/nci_core.h5
-rw-r--r--include/net/nfc/nfc.h2
-rw-r--r--include/net/ping.h7
-rw-r--r--include/net/request_sock.h140
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--include/net/sch_generic.h4
-rw-r--r--include/net/sctp/sctp.h3
-rw-r--r--include/net/sock.h66
-rw-r--r--include/net/switchdev.h55
-rw-r--r--include/net/tc_act/tc_bpf.h6
-rw-r--r--include/net/tcp.h124
-rw-r--r--include/net/tcp_states.h4
-rw-r--r--include/net/udp.h24
-rw-r--r--include/net/udp_tunnel.h5
-rw-r--r--include/net/vxlan.h5
-rw-r--r--include/net/xfrm.h22
-rw-r--r--include/rxrpc/packet.h3
-rw-r--r--include/scsi/scsi_eh.h1
-rw-r--r--include/scsi/scsi_transport_fc.h1
-rw-r--r--include/soc/at91/at91sam9_ddrsdr.h2
-rw-r--r--include/sound/ac97_codec.h4
-rw-r--r--include/sound/compress_driver.h4
-rw-r--r--include/sound/control.h2
-rw-r--r--include/sound/core.h3
-rw-r--r--include/sound/designware_i2s.h2
-rw-r--r--include/sound/hda_regmap.h217
-rw-r--r--include/sound/hdaudio.h247
-rw-r--r--include/sound/pcm.h66
-rw-r--r--include/sound/pcm_params.h7
-rw-r--r--include/sound/rt5670.h1
-rw-r--r--include/sound/seq_device.h46
-rw-r--r--include/sound/seq_kernel.h6
-rw-r--r--include/sound/simple_card.h1
-rw-r--r--include/sound/soc-dapm.h8
-rw-r--r--include/sound/soc-dpcm.h2
-rw-r--r--include/sound/soc.h32
-rw-r--r--include/sound/spear_dma.h2
-rw-r--r--include/target/iscsi/iscsi_target_core.h15
-rw-r--r--include/target/target_core_backend.h1
-rw-r--r--include/target/target_core_base.h10
-rw-r--r--include/target/target_core_configfs.h6
-rw-r--r--include/target/target_core_fabric.h33
-rw-r--r--include/target/target_core_fabric_configfs.h5
-rw-r--r--include/trace/events/9p.h157
-rw-r--r--include/trace/events/btrfs.h8
-rw-r--r--include/trace/events/clk.h198
-rw-r--r--include/trace/events/cma.h66
-rw-r--r--include/trace/events/ext3.h18
-rw-r--r--include/trace/events/ext4.h22
-rw-r--r--include/trace/events/f2fs.h192
-rw-r--r--include/trace/events/filemap.h8
-rw-r--r--include/trace/events/intel-sst.h7
-rw-r--r--include/trace/events/irq.h39
-rw-r--r--include/trace/events/kmem.h42
-rw-r--r--include/trace/events/libata.h325
-rw-r--r--include/trace/events/migrate.h42
-rw-r--r--include/trace/events/module.h4
-rw-r--r--include/trace/events/random.h10
-rw-r--r--include/trace/events/regmap.h252
-rw-r--r--include/trace/events/sunrpc.h62
-rw-r--r--include/trace/events/tlb.h30
-rw-r--r--include/trace/events/v4l2.h75
-rw-r--r--include/trace/events/vmscan.h8
-rw-r--r--include/trace/events/writeback.h33
-rw-r--r--include/trace/events/xen.h2
-rw-r--r--include/trace/ftrace.h41
-rw-r--r--include/uapi/asm-generic/errno.h11
-rw-r--r--include/uapi/drm/drm.h1
-rw-r--r--include/uapi/drm/drm_fourcc.h78
-rw-r--r--include/uapi/drm/drm_mode.h9
-rw-r--r--include/uapi/drm/i915_drm.h5
-rw-r--r--include/uapi/drm/nouveau_drm.h1
-rw-r--r--include/uapi/drm/radeon_drm.h4
-rw-r--r--include/uapi/drm/tegra_drm.h3
-rw-r--r--include/uapi/linux/Kbuild3
-rw-r--r--include/uapi/linux/am437x-vpfe.h2
-rw-r--r--include/uapi/linux/bpf.h63
-rw-r--r--include/uapi/linux/can/raw.h1
-rw-r--r--include/uapi/linux/dcbnl.h66
-rw-r--r--include/uapi/linux/dm-ioctl.h4
-rw-r--r--include/uapi/linux/falloc.h17
-rw-r--r--include/uapi/linux/filter.h10
-rw-r--r--include/uapi/linux/fou.h1
-rw-r--r--include/uapi/linux/hsi/Kbuild2
-rw-r--r--include/uapi/linux/hsi/cs-protocol.h113
-rw-r--r--include/uapi/linux/if_addr.h2
-rw-r--r--include/uapi/linux/if_link.h14
-rw-r--r--include/uapi/linux/if_packet.h1
-rw-r--r--include/uapi/linux/iio/Kbuild3
-rw-r--r--include/uapi/linux/iio/events.h42
-rw-r--r--include/uapi/linux/iio/types.h92
-rw-r--r--include/uapi/linux/input.h10
-rw-r--r--include/uapi/linux/ip_vs.h7
-rw-r--r--include/uapi/linux/ipv6.h1
-rw-r--r--include/uapi/linux/kvm.h66
-rw-r--r--include/uapi/linux/magic.h2
-rw-r--r--include/uapi/linux/media-bus-format.h28
-rw-r--r--include/uapi/linux/media.h52
-rw-r--r--include/uapi/linux/neighbour.h1
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h80
-rw-r--r--include/uapi/linux/netfilter_bridge/ebtables.h2
-rw-r--r--include/uapi/linux/nfs4.h7
-rw-r--r--include/uapi/linux/nfs_idmap.h2
-rw-r--r--include/uapi/linux/nfsd/debug.h8
-rw-r--r--include/uapi/linux/nfsd/export.h5
-rw-r--r--include/uapi/linux/nl80211.h34
-rw-r--r--include/uapi/linux/perf_event.h115
-rw-r--r--include/uapi/linux/pkt_cls.h2
-rw-r--r--include/uapi/linux/quota.h6
-rw-r--r--include/uapi/linux/raid/md_p.h7
-rw-r--r--include/uapi/linux/raid/md_u.h1
-rw-r--r--include/uapi/linux/rtnetlink.h16
-rw-r--r--include/uapi/linux/serial.h4
-rw-r--r--include/uapi/linux/serial_reg.h19
-rw-r--r--include/uapi/linux/target_core_user.h44
-rw-r--r--include/uapi/linux/tc_act/Kbuild1
-rw-r--r--include/uapi/linux/tc_act/tc_bpf.h2
-rw-r--r--include/uapi/linux/tipc_netlink.h9
-rw-r--r--include/uapi/linux/v4l2-dv-timings.h64
-rw-r--r--include/uapi/linux/v4l2-subdev.h12
-rw-r--r--include/uapi/linux/vfio.h2
-rw-r--r--include/uapi/linux/videodev2.h18
-rw-r--r--include/uapi/linux/virtio_balloon.h32
-rw-r--r--include/uapi/linux/virtio_blk.h8
-rw-r--r--include/uapi/linux/virtio_ids.h1
-rw-r--r--include/uapi/linux/virtio_input.h76
-rw-r--r--include/uapi/linux/virtio_scsi.h12
-rw-r--r--include/uapi/linux/xfrm.h2
-rw-r--r--include/uapi/linux/xilinx-v4l2-controls.h73
-rw-r--r--include/uapi/sound/asequencer.h1
-rw-r--r--include/uapi/sound/asound.h41
-rw-r--r--include/uapi/sound/compress_offload.h2
-rw-r--r--include/uapi/sound/emu10k1.h3
-rw-r--r--include/uapi/sound/hdspm.h6
-rw-r--r--include/video/imx-ipu-v3.h2
-rw-r--r--include/video/omapdss.h8
-rw-r--r--include/video/samsung_fimd.h11
-rw-r--r--include/xen/interface/xen.h6
-rw-r--r--include/xen/xen-ops.h73
-rw-r--r--include/xen/xenbus.h24
605 files changed, 14305 insertions, 5357 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 61e32ec1fc4d..8de4fa90e8c4 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -252,6 +252,7 @@ struct acpi_device_pnp {
252#define acpi_device_bid(d) ((d)->pnp.bus_id) 252#define acpi_device_bid(d) ((d)->pnp.bus_id)
253#define acpi_device_adr(d) ((d)->pnp.bus_address) 253#define acpi_device_adr(d) ((d)->pnp.bus_address)
254const char *acpi_device_hid(struct acpi_device *device); 254const char *acpi_device_hid(struct acpi_device *device);
255#define acpi_device_uid(d) ((d)->pnp.unique_id)
255#define acpi_device_name(d) ((d)->pnp.device_name) 256#define acpi_device_name(d) ((d)->pnp.device_name)
256#define acpi_device_class(d) ((d)->pnp.device_class) 257#define acpi_device_class(d) ((d)->pnp.device_class)
257 258
@@ -386,7 +387,8 @@ static inline bool is_acpi_node(struct fwnode_handle *fwnode)
386 387
387static inline struct acpi_device *acpi_node(struct fwnode_handle *fwnode) 388static inline struct acpi_device *acpi_node(struct fwnode_handle *fwnode)
388{ 389{
389 return fwnode ? container_of(fwnode, struct acpi_device, fwnode) : NULL; 390 return is_acpi_node(fwnode) ?
391 container_of(fwnode, struct acpi_device, fwnode) : NULL;
390} 392}
391 393
392static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev) 394static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h
index 444671e9c65d..dd86c5fc102d 100644
--- a/include/acpi/acpi_io.h
+++ b/include/acpi/acpi_io.h
@@ -3,11 +3,15 @@
3 3
4#include <linux/io.h> 4#include <linux/io.h>
5 5
6#include <asm/acpi.h>
7
8#ifndef acpi_os_ioremap
6static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, 9static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
7 acpi_size size) 10 acpi_size size)
8{ 11{
9 return ioremap_cache(phys, size); 12 return ioremap_cache(phys, size);
10} 13}
14#endif
11 15
12void __iomem *__init_refok 16void __iomem *__init_refok
13acpi_os_map_iomem(acpi_physical_address phys, acpi_size size); 17acpi_os_map_iomem(acpi_physical_address phys, acpi_size size);
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index d56f5d722138..08ef57bc8d63 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 0x20150204 49#define ACPI_CA_VERSION 0x20150410
50 50
51#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
52#include <acpi/actypes.h> 52#include <acpi/actypes.h>
@@ -431,13 +431,13 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_load_tables(void))
431ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_reallocate_root_table(void)) 431ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_reallocate_root_table(void))
432 432
433ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init 433ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
434 acpi_find_root_pointer(acpi_size * rsdp_address)) 434 acpi_find_root_pointer(acpi_physical_address *
435 435 rsdp_address))
436ACPI_EXTERNAL_RETURN_STATUS(acpi_status 436ACPI_EXTERNAL_RETURN_STATUS(acpi_status
437 acpi_get_table_header(acpi_string signature, 437 acpi_get_table_header(acpi_string signature,
438 u32 instance, 438 u32 instance,
439 struct acpi_table_header 439 struct acpi_table_header
440 *out_table_header)) 440 *out_table_header))
441ACPI_EXTERNAL_RETURN_STATUS(acpi_status 441ACPI_EXTERNAL_RETURN_STATUS(acpi_status
442 acpi_get_table(acpi_string signature, u32 instance, 442 acpi_get_table(acpi_string signature, u32 instance,
443 struct acpi_table_header 443 struct acpi_table_header
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index f06d75e5fa54..cafdeb50fbdf 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -73,6 +73,7 @@
73#define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */ 73#define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */
74#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ 74#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
75#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */ 75#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */
76#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */
76#define ACPI_SIG_MTMR "MTMR" /* MID Timer table */ 77#define ACPI_SIG_MTMR "MTMR" /* MID Timer table */
77#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */ 78#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */
78#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ 79#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
@@ -845,7 +846,8 @@ struct acpi_lpit_header {
845 846
846enum acpi_lpit_type { 847enum acpi_lpit_type {
847 ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00, 848 ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00,
848 ACPI_LPIT_TYPE_SIMPLE_IO = 0x01 849 ACPI_LPIT_TYPE_SIMPLE_IO = 0x01,
850 ACPI_LPIT_TYPE_RESERVED = 0x02 /* 2 and above are reserved */
849}; 851};
850 852
851/* Masks for Flags field above */ 853/* Masks for Flags field above */
@@ -935,6 +937,21 @@ struct acpi_table_mchi {
935 937
936/******************************************************************************* 938/*******************************************************************************
937 * 939 *
940 * MSDM - Microsoft Data Management table
941 *
942 * Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)",
943 * November 29, 2011. Copyright 2011 Microsoft
944 *
945 ******************************************************************************/
946
947/* Basic MSDM table is only the common ACPI header */
948
949struct acpi_table_msdm {
950 struct acpi_table_header header; /* Common ACPI table header */
951};
952
953/*******************************************************************************
954 *
938 * MTMR - MID Timer Table 955 * MTMR - MID Timer Table
939 * Version 1 956 * Version 1
940 * 957 *
@@ -959,10 +976,9 @@ struct acpi_mtmr_entry {
959/******************************************************************************* 976/*******************************************************************************
960 * 977 *
961 * SLIC - Software Licensing Description Table 978 * SLIC - Software Licensing Description Table
962 * Version 1
963 * 979 *
964 * Conforms to "OEM Activation 2.0 for Windows Vista Operating Systems", 980 * Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)",
965 * Copyright 2006 981 * November 29, 2011. Copyright 2011 Microsoft
966 * 982 *
967 ******************************************************************************/ 983 ******************************************************************************/
968 984
@@ -972,52 +988,6 @@ struct acpi_table_slic {
972 struct acpi_table_header header; /* Common ACPI table header */ 988 struct acpi_table_header header; /* Common ACPI table header */
973}; 989};
974 990
975/* Common SLIC subtable header */
976
977struct acpi_slic_header {
978 u32 type;
979 u32 length;
980};
981
982/* Values for Type field above */
983
984enum acpi_slic_type {
985 ACPI_SLIC_TYPE_PUBLIC_KEY = 0,
986 ACPI_SLIC_TYPE_WINDOWS_MARKER = 1,
987 ACPI_SLIC_TYPE_RESERVED = 2 /* 2 and greater are reserved */
988};
989
990/*
991 * SLIC Subtables, correspond to Type in struct acpi_slic_header
992 */
993
994/* 0: Public Key Structure */
995
996struct acpi_slic_key {
997 struct acpi_slic_header header;
998 u8 key_type;
999 u8 version;
1000 u16 reserved;
1001 u32 algorithm;
1002 char magic[4];
1003 u32 bit_length;
1004 u32 exponent;
1005 u8 modulus[128];
1006};
1007
1008/* 1: Windows Marker Structure */
1009
1010struct acpi_slic_marker {
1011 struct acpi_slic_header header;
1012 u32 version;
1013 char oem_id[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */
1014 char oem_table_id[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */
1015 char windows_flag[8];
1016 u32 slic_version;
1017 u8 reserved[16];
1018 u8 signature[128];
1019};
1020
1021/******************************************************************************* 991/*******************************************************************************
1022 * 992 *
1023 * SPCR - Serial Port Console Redirection table 993 * SPCR - Serial Port Console Redirection table
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index b034f1068dfe..f5ca0e989bba 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -199,9 +199,29 @@ typedef int s32;
199typedef s32 acpi_native_int; 199typedef s32 acpi_native_int;
200 200
201typedef u32 acpi_size; 201typedef u32 acpi_size;
202
203#ifdef ACPI_32BIT_PHYSICAL_ADDRESS
204
205/*
206 * OSPMs can define this to shrink the size of the structures for 32-bit
207 * none PAE environment. ASL compiler may always define this to generate
208 * 32-bit OSPM compliant tables.
209 */
202typedef u32 acpi_io_address; 210typedef u32 acpi_io_address;
203typedef u32 acpi_physical_address; 211typedef u32 acpi_physical_address;
204 212
213#else /* ACPI_32BIT_PHYSICAL_ADDRESS */
214
215/*
216 * It is reported that, after some calculations, the physical addresses can
217 * wrap over the 32-bit boundary on 32-bit PAE environment.
218 * https://bugzilla.kernel.org/show_bug.cgi?id=87971
219 */
220typedef u64 acpi_io_address;
221typedef u64 acpi_physical_address;
222
223#endif /* ACPI_32BIT_PHYSICAL_ADDRESS */
224
205#define ACPI_MAX_PTR ACPI_UINT32_MAX 225#define ACPI_MAX_PTR ACPI_UINT32_MAX
206#define ACPI_SIZE_MAX ACPI_UINT32_MAX 226#define ACPI_SIZE_MAX ACPI_UINT32_MAX
207 227
@@ -713,33 +733,32 @@ typedef u32 acpi_event_type;
713 * The encoding of acpi_event_status is illustrated below. 733 * The encoding of acpi_event_status is illustrated below.
714 * Note that a set bit (1) indicates the property is TRUE 734 * Note that a set bit (1) indicates the property is TRUE
715 * (e.g. if bit 0 is set then the event is enabled). 735 * (e.g. if bit 0 is set then the event is enabled).
716 * +-------------+-+-+-+-+ 736 * +-------------+-+-+-+-+-+
717 * | Bits 31:4 |3|2|1|0| 737 * | Bits 31:5 |4|3|2|1|0|
718 * +-------------+-+-+-+-+ 738 * +-------------+-+-+-+-+-+
719 * | | | | | 739 * | | | | | |
720 * | | | | +- Enabled? 740 * | | | | | +- Enabled?
721 * | | | +--- Enabled for wake? 741 * | | | | +--- Enabled for wake?
722 * | | +----- Set? 742 * | | | +----- Status bit set?
723 * | +------- Has a handler? 743 * | | +------- Enable bit set?
724 * +------------- <Reserved> 744 * | +--------- Has a handler?
745 * +--------------- <Reserved>
725 */ 746 */
726typedef u32 acpi_event_status; 747typedef u32 acpi_event_status;
727 748
728#define ACPI_EVENT_FLAG_DISABLED (acpi_event_status) 0x00 749#define ACPI_EVENT_FLAG_DISABLED (acpi_event_status) 0x00
729#define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01 750#define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01
730#define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02 751#define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02
731#define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04 752#define ACPI_EVENT_FLAG_STATUS_SET (acpi_event_status) 0x04
732#define ACPI_EVENT_FLAG_HAS_HANDLER (acpi_event_status) 0x08 753#define ACPI_EVENT_FLAG_ENABLE_SET (acpi_event_status) 0x08
754#define ACPI_EVENT_FLAG_HAS_HANDLER (acpi_event_status) 0x10
755#define ACPI_EVENT_FLAG_SET ACPI_EVENT_FLAG_STATUS_SET
733 756
734/* Actions for acpi_set_gpe, acpi_gpe_wakeup, acpi_hw_low_set_gpe */ 757/* Actions for acpi_set_gpe, acpi_gpe_wakeup, acpi_hw_low_set_gpe */
735 758
736#define ACPI_GPE_ENABLE 0 759#define ACPI_GPE_ENABLE 0
737#define ACPI_GPE_DISABLE 1 760#define ACPI_GPE_DISABLE 1
738#define ACPI_GPE_CONDITIONAL_ENABLE 2 761#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)
743 762
744/* 763/*
745 * GPE info flags - Per GPE 764 * GPE info flags - Per GPE
@@ -1251,6 +1270,7 @@ struct acpi_memory_list {
1251#define ACPI_OSI_WIN_VISTA_SP2 0x0A 1270#define ACPI_OSI_WIN_VISTA_SP2 0x0A
1252#define ACPI_OSI_WIN_7 0x0B 1271#define ACPI_OSI_WIN_7 0x0B
1253#define ACPI_OSI_WIN_8 0x0C 1272#define ACPI_OSI_WIN_8 0x0C
1273#define ACPI_OSI_WIN_10 0x0D
1254 1274
1255/* Definitions of file IO */ 1275/* Definitions of file IO */
1256 1276
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index ad74dc51d5b7..ecdf9405dd3a 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -76,6 +76,7 @@
76#define ACPI_LARGE_NAMESPACE_NODE 76#define ACPI_LARGE_NAMESPACE_NODE
77#define ACPI_DATA_TABLE_DISASSEMBLY 77#define ACPI_DATA_TABLE_DISASSEMBLY
78#define ACPI_SINGLE_THREADED 78#define ACPI_SINGLE_THREADED
79#define ACPI_32BIT_PHYSICAL_ADDRESS
79#endif 80#endif
80 81
81/* acpi_exec configuration. Multithreaded with full AML debugger */ 82/* acpi_exec configuration. Multithreaded with full AML debugger */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index b95dc32a6e6b..4188a4d3b597 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -196,7 +196,7 @@ struct acpi_processor_flags {
196struct acpi_processor { 196struct acpi_processor {
197 acpi_handle handle; 197 acpi_handle handle;
198 u32 acpi_id; 198 u32 acpi_id;
199 u32 phys_id; /* CPU hardware ID such as APIC ID for x86 */ 199 phys_cpuid_t phys_id; /* CPU hardware ID such as APIC ID for x86 */
200 u32 id; /* CPU logical ID allocated by OS */ 200 u32 id; /* CPU logical ID allocated by OS */
201 u32 pblk; 201 u32 pblk;
202 int performance_platform_limit; 202 int performance_platform_limit;
@@ -310,8 +310,8 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
310#endif /* CONFIG_CPU_FREQ */ 310#endif /* CONFIG_CPU_FREQ */
311 311
312/* in processor_core.c */ 312/* in processor_core.c */
313int acpi_get_phys_id(acpi_handle, int type, u32 acpi_id); 313phys_cpuid_t acpi_get_phys_id(acpi_handle, int type, u32 acpi_id);
314int acpi_map_cpuid(int phys_id, u32 acpi_id); 314int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id);
315int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id); 315int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
316 316
317/* in processor_pdc.c */ 317/* in processor_pdc.c */
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
index 3378dcf4c31e..940d5ec122c9 100644
--- a/include/asm-generic/dma-mapping-common.h
+++ b/include/asm-generic/dma-mapping-common.h
@@ -39,6 +39,10 @@ static inline void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr,
39 debug_dma_unmap_page(dev, addr, size, dir, true); 39 debug_dma_unmap_page(dev, addr, size, dir, true);
40} 40}
41 41
42/*
43 * dma_maps_sg_attrs returns 0 on error and > 0 on success.
44 * It should never return a value < 0.
45 */
42static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, 46static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
43 int nents, enum dma_data_direction dir, 47 int nents, enum dma_data_direction dir,
44 struct dma_attrs *attrs) 48 struct dma_attrs *attrs)
@@ -51,6 +55,7 @@ static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
51 kmemcheck_mark_initialized(sg_virt(s), s->length); 55 kmemcheck_mark_initialized(sg_virt(s), s->length);
52 BUG_ON(!valid_dma_direction(dir)); 56 BUG_ON(!valid_dma_direction(dir));
53 ents = ops->map_sg(dev, sg, nents, dir, attrs); 57 ents = ops->map_sg(dev, sg, nents, dir, attrs);
58 BUG_ON(ents < 0);
54 debug_dma_map_sg(dev, sg, nents, ents, dir); 59 debug_dma_map_sg(dev, sg, nents, ents, dir);
55 60
56 return ents; 61 return ents;
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 383ade1a211b..9bb0d11729c9 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -5,7 +5,6 @@
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/errno.h> 6#include <linux/errno.h>
7#include <linux/of.h> 7#include <linux/of.h>
8#include <linux/pinctrl/pinctrl.h>
9 8
10#ifdef CONFIG_GPIOLIB 9#ifdef CONFIG_GPIOLIB
11 10
@@ -139,53 +138,6 @@ static inline void gpio_unexport(unsigned gpio)
139 gpiod_unexport(gpio_to_desc(gpio)); 138 gpiod_unexport(gpio_to_desc(gpio));
140} 139}
141 140
142#ifdef CONFIG_PINCTRL
143
144/**
145 * struct gpio_pin_range - pin range controlled by a gpio chip
146 * @head: list for maintaining set of pin ranges, used internally
147 * @pctldev: pinctrl device which handles corresponding pins
148 * @range: actual range of pins controlled by a gpio controller
149 */
150
151struct gpio_pin_range {
152 struct list_head node;
153 struct pinctrl_dev *pctldev;
154 struct pinctrl_gpio_range range;
155};
156
157int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
158 unsigned int gpio_offset, unsigned int pin_offset,
159 unsigned int npins);
160int gpiochip_add_pingroup_range(struct gpio_chip *chip,
161 struct pinctrl_dev *pctldev,
162 unsigned int gpio_offset, const char *pin_group);
163void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
164
165#else
166
167static inline int
168gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
169 unsigned int gpio_offset, unsigned int pin_offset,
170 unsigned int npins)
171{
172 return 0;
173}
174static inline int
175gpiochip_add_pingroup_range(struct gpio_chip *chip,
176 struct pinctrl_dev *pctldev,
177 unsigned int gpio_offset, const char *pin_group)
178{
179 return 0;
180}
181
182static inline void
183gpiochip_remove_pin_ranges(struct gpio_chip *chip)
184{
185}
186
187#endif /* CONFIG_PINCTRL */
188
189#else /* !CONFIG_GPIOLIB */ 141#else /* !CONFIG_GPIOLIB */
190 142
191static inline bool gpio_is_valid(int number) 143static inline bool gpio_is_valid(int number)
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 4d46085c1b90..39f1d6a2b04d 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -6,6 +6,12 @@
6 6
7#include <linux/mm_types.h> 7#include <linux/mm_types.h>
8#include <linux/bug.h> 8#include <linux/bug.h>
9#include <linux/errno.h>
10
11#if 4 - defined(__PAGETABLE_PUD_FOLDED) - defined(__PAGETABLE_PMD_FOLDED) != \
12 CONFIG_PGTABLE_LEVELS
13#error CONFIG_PGTABLE_LEVELS is not consistent with __PAGETABLE_{PUD,PMD}_FOLDED
14#endif
9 15
10/* 16/*
11 * On almost all architectures and configurations, 0 can be used as the 17 * On almost all architectures and configurations, 0 can be used as the
@@ -691,6 +697,30 @@ static inline int pmd_protnone(pmd_t pmd)
691 697
692#endif /* CONFIG_MMU */ 698#endif /* CONFIG_MMU */
693 699
700#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
701int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot);
702int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot);
703int pud_clear_huge(pud_t *pud);
704int pmd_clear_huge(pmd_t *pmd);
705#else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
706static inline int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot)
707{
708 return 0;
709}
710static inline int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot)
711{
712 return 0;
713}
714static inline int pud_clear_huge(pud_t *pud)
715{
716 return 0;
717}
718static inline int pmd_clear_huge(pmd_t *pmd)
719{
720 return 0;
721}
722#endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
723
694#endif /* !__ASSEMBLY__ */ 724#endif /* !__ASSEMBLY__ */
695 725
696#ifndef io_remap_pfn_range 726#ifndef io_remap_pfn_range
diff --git a/include/asm-generic/seccomp.h b/include/asm-generic/seccomp.h
index 9fa1f653ed3b..c9ccafa0d99a 100644
--- a/include/asm-generic/seccomp.h
+++ b/include/asm-generic/seccomp.h
@@ -17,7 +17,9 @@
17#define __NR_seccomp_read_32 __NR_read 17#define __NR_seccomp_read_32 __NR_read
18#define __NR_seccomp_write_32 __NR_write 18#define __NR_seccomp_write_32 __NR_write
19#define __NR_seccomp_exit_32 __NR_exit 19#define __NR_seccomp_exit_32 __NR_exit
20#ifndef __NR_seccomp_sigreturn_32
20#define __NR_seccomp_sigreturn_32 __NR_rt_sigreturn 21#define __NR_seccomp_sigreturn_32 __NR_rt_sigreturn
22#endif
21#endif /* CONFIG_COMPAT && ! already defined */ 23#endif /* CONFIG_COMPAT && ! already defined */
22 24
23#define __NR_seccomp_read __NR_read 25#define __NR_seccomp_read __NR_read
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index ac78910d7416..8bd374d3cf21 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -124,7 +124,10 @@
124#define FTRACE_EVENTS() . = ALIGN(8); \ 124#define FTRACE_EVENTS() . = ALIGN(8); \
125 VMLINUX_SYMBOL(__start_ftrace_events) = .; \ 125 VMLINUX_SYMBOL(__start_ftrace_events) = .; \
126 *(_ftrace_events) \ 126 *(_ftrace_events) \
127 VMLINUX_SYMBOL(__stop_ftrace_events) = .; 127 VMLINUX_SYMBOL(__stop_ftrace_events) = .; \
128 VMLINUX_SYMBOL(__start_ftrace_enum_maps) = .; \
129 *(_ftrace_enum_map) \
130 VMLINUX_SYMBOL(__stop_ftrace_enum_maps) = .;
128#else 131#else
129#define FTRACE_EVENTS() 132#define FTRACE_EVENTS()
130#endif 133#endif
@@ -150,6 +153,14 @@
150#define TRACE_SYSCALLS() 153#define TRACE_SYSCALLS()
151#endif 154#endif
152 155
156#ifdef CONFIG_SERIAL_EARLYCON
157#define EARLYCON_TABLE() STRUCT_ALIGN(); \
158 VMLINUX_SYMBOL(__earlycon_table) = .; \
159 *(__earlycon_table) \
160 *(__earlycon_table_end)
161#else
162#define EARLYCON_TABLE()
163#endif
153 164
154#define ___OF_TABLE(cfg, name) _OF_TABLE_##cfg(name) 165#define ___OF_TABLE(cfg, name) _OF_TABLE_##cfg(name)
155#define __OF_TABLE(cfg, name) ___OF_TABLE(cfg, name) 166#define __OF_TABLE(cfg, name) ___OF_TABLE(cfg, name)
@@ -167,6 +178,7 @@
167#define IOMMU_OF_TABLES() OF_TABLE(CONFIG_OF_IOMMU, iommu) 178#define IOMMU_OF_TABLES() OF_TABLE(CONFIG_OF_IOMMU, iommu)
168#define RESERVEDMEM_OF_TABLES() OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem) 179#define RESERVEDMEM_OF_TABLES() OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem)
169#define CPU_METHOD_OF_TABLES() OF_TABLE(CONFIG_SMP, cpu_method) 180#define CPU_METHOD_OF_TABLES() OF_TABLE(CONFIG_SMP, cpu_method)
181#define CPUIDLE_METHOD_OF_TABLES() OF_TABLE(CONFIG_CPU_IDLE, cpuidle_method)
170#define EARLYCON_OF_TABLES() OF_TABLE(CONFIG_SERIAL_EARLYCON, earlycon) 182#define EARLYCON_OF_TABLES() OF_TABLE(CONFIG_SERIAL_EARLYCON, earlycon)
171 183
172#define KERNEL_DTB() \ 184#define KERNEL_DTB() \
@@ -401,7 +413,7 @@
401#define TEXT_TEXT \ 413#define TEXT_TEXT \
402 ALIGN_FUNCTION(); \ 414 ALIGN_FUNCTION(); \
403 *(.text.hot) \ 415 *(.text.hot) \
404 *(.text) \ 416 *(.text .text.fixup) \
405 *(.ref.text) \ 417 *(.ref.text) \
406 MEM_KEEP(init.text) \ 418 MEM_KEEP(init.text) \
407 MEM_KEEP(exit.text) \ 419 MEM_KEEP(exit.text) \
@@ -501,8 +513,10 @@
501 CLKSRC_OF_TABLES() \ 513 CLKSRC_OF_TABLES() \
502 IOMMU_OF_TABLES() \ 514 IOMMU_OF_TABLES() \
503 CPU_METHOD_OF_TABLES() \ 515 CPU_METHOD_OF_TABLES() \
516 CPUIDLE_METHOD_OF_TABLES() \
504 KERNEL_DTB() \ 517 KERNEL_DTB() \
505 IRQCHIP_OF_MATCH_TABLE() \ 518 IRQCHIP_OF_MATCH_TABLE() \
519 EARLYCON_TABLE() \
506 EARLYCON_OF_TABLES() 520 EARLYCON_OF_TABLES()
507 521
508#define INIT_TEXT \ 522#define INIT_TEXT \
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 623a59c1ff5a..0ecb7688af71 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -137,7 +137,7 @@ struct crypto_template *crypto_lookup_template(const char *name);
137 137
138int crypto_register_instance(struct crypto_template *tmpl, 138int crypto_register_instance(struct crypto_template *tmpl,
139 struct crypto_instance *inst); 139 struct crypto_instance *inst);
140int crypto_unregister_instance(struct crypto_alg *alg); 140int crypto_unregister_instance(struct crypto_instance *inst);
141 141
142int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, 142int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg,
143 struct crypto_instance *inst, u32 mask); 143 struct crypto_instance *inst, u32 mask);
diff --git a/include/crypto/if_alg.h b/include/crypto/if_alg.h
index 178525e5f430..018afb264ac2 100644
--- a/include/crypto/if_alg.h
+++ b/include/crypto/if_alg.h
@@ -58,8 +58,9 @@ struct af_alg_type {
58}; 58};
59 59
60struct af_alg_sgl { 60struct af_alg_sgl {
61 struct scatterlist sg[ALG_MAX_PAGES]; 61 struct scatterlist sg[ALG_MAX_PAGES + 1];
62 struct page *pages[ALG_MAX_PAGES]; 62 struct page *pages[ALG_MAX_PAGES];
63 unsigned int npages;
63}; 64};
64 65
65int af_alg_register_type(const struct af_alg_type *type); 66int af_alg_register_type(const struct af_alg_type *type);
@@ -70,6 +71,7 @@ int af_alg_accept(struct sock *sk, struct socket *newsock);
70 71
71int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len); 72int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len);
72void af_alg_free_sg(struct af_alg_sgl *sgl); 73void af_alg_free_sg(struct af_alg_sgl *sgl);
74void af_alg_link_sg(struct af_alg_sgl *sgl_prev, struct af_alg_sgl *sgl_new);
73 75
74int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con); 76int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con);
75 77
diff --git a/include/crypto/rng.h b/include/crypto/rng.h
index a16fb10142bf..6e28ea5be9f1 100644
--- a/include/crypto/rng.h
+++ b/include/crypto/rng.h
@@ -103,8 +103,7 @@ static inline void crypto_free_rng(struct crypto_rng *tfm)
103 * This function fills the caller-allocated buffer with random numbers using the 103 * This function fills the caller-allocated buffer with random numbers using the
104 * random number generator referenced by the cipher handle. 104 * random number generator referenced by the cipher handle.
105 * 105 *
106 * Return: > 0 function was successful and returns the number of generated 106 * Return: 0 function was successful; < 0 if an error occurred
107 * bytes; < 0 if an error occurred
108 */ 107 */
109static inline int crypto_rng_get_bytes(struct crypto_rng *tfm, 108static inline int crypto_rng_get_bytes(struct crypto_rng *tfm,
110 u8 *rdata, unsigned int dlen) 109 u8 *rdata, unsigned int dlen)
diff --git a/include/crypto/sha.h b/include/crypto/sha.h
index 190f8a0e0242..dd7905a3c22e 100644
--- a/include/crypto/sha.h
+++ b/include/crypto/sha.h
@@ -65,20 +65,20 @@
65#define SHA512_H7 0x5be0cd19137e2179ULL 65#define SHA512_H7 0x5be0cd19137e2179ULL
66 66
67struct sha1_state { 67struct sha1_state {
68 u64 count;
69 u32 state[SHA1_DIGEST_SIZE / 4]; 68 u32 state[SHA1_DIGEST_SIZE / 4];
69 u64 count;
70 u8 buffer[SHA1_BLOCK_SIZE]; 70 u8 buffer[SHA1_BLOCK_SIZE];
71}; 71};
72 72
73struct sha256_state { 73struct sha256_state {
74 u64 count;
75 u32 state[SHA256_DIGEST_SIZE / 4]; 74 u32 state[SHA256_DIGEST_SIZE / 4];
75 u64 count;
76 u8 buf[SHA256_BLOCK_SIZE]; 76 u8 buf[SHA256_BLOCK_SIZE];
77}; 77};
78 78
79struct sha512_state { 79struct sha512_state {
80 u64 count[2];
81 u64 state[SHA512_DIGEST_SIZE / 8]; 80 u64 state[SHA512_DIGEST_SIZE / 8];
81 u64 count[2];
82 u8 buf[SHA512_BLOCK_SIZE]; 82 u8 buf[SHA512_BLOCK_SIZE];
83}; 83};
84 84
@@ -87,9 +87,18 @@ struct shash_desc;
87extern int crypto_sha1_update(struct shash_desc *desc, const u8 *data, 87extern int crypto_sha1_update(struct shash_desc *desc, const u8 *data,
88 unsigned int len); 88 unsigned int len);
89 89
90extern int crypto_sha1_finup(struct shash_desc *desc, const u8 *data,
91 unsigned int len, u8 *hash);
92
90extern int crypto_sha256_update(struct shash_desc *desc, const u8 *data, 93extern int crypto_sha256_update(struct shash_desc *desc, const u8 *data,
91 unsigned int len); 94 unsigned int len);
92 95
96extern int crypto_sha256_finup(struct shash_desc *desc, const u8 *data,
97 unsigned int len, u8 *hash);
98
93extern int crypto_sha512_update(struct shash_desc *desc, const u8 *data, 99extern int crypto_sha512_update(struct shash_desc *desc, const u8 *data,
94 unsigned int len); 100 unsigned int len);
101
102extern int crypto_sha512_finup(struct shash_desc *desc, const u8 *data,
103 unsigned int len, u8 *hash);
95#endif 104#endif
diff --git a/include/crypto/sha1_base.h b/include/crypto/sha1_base.h
new file mode 100644
index 000000000000..d0df431f9a97
--- /dev/null
+++ b/include/crypto/sha1_base.h
@@ -0,0 +1,106 @@
1/*
2 * sha1_base.h - core logic for SHA-1 implementations
3 *
4 * Copyright (C) 2015 Linaro Ltd <ard.biesheuvel@linaro.org>
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#include <crypto/internal/hash.h>
12#include <crypto/sha.h>
13#include <linux/crypto.h>
14#include <linux/module.h>
15
16#include <asm/unaligned.h>
17
18typedef void (sha1_block_fn)(struct sha1_state *sst, u8 const *src, int blocks);
19
20static inline int sha1_base_init(struct shash_desc *desc)
21{
22 struct sha1_state *sctx = shash_desc_ctx(desc);
23
24 sctx->state[0] = SHA1_H0;
25 sctx->state[1] = SHA1_H1;
26 sctx->state[2] = SHA1_H2;
27 sctx->state[3] = SHA1_H3;
28 sctx->state[4] = SHA1_H4;
29 sctx->count = 0;
30
31 return 0;
32}
33
34static inline int sha1_base_do_update(struct shash_desc *desc,
35 const u8 *data,
36 unsigned int len,
37 sha1_block_fn *block_fn)
38{
39 struct sha1_state *sctx = shash_desc_ctx(desc);
40 unsigned int partial = sctx->count % SHA1_BLOCK_SIZE;
41
42 sctx->count += len;
43
44 if (unlikely((partial + len) >= SHA1_BLOCK_SIZE)) {
45 int blocks;
46
47 if (partial) {
48 int p = SHA1_BLOCK_SIZE - partial;
49
50 memcpy(sctx->buffer + partial, data, p);
51 data += p;
52 len -= p;
53
54 block_fn(sctx, sctx->buffer, 1);
55 }
56
57 blocks = len / SHA1_BLOCK_SIZE;
58 len %= SHA1_BLOCK_SIZE;
59
60 if (blocks) {
61 block_fn(sctx, data, blocks);
62 data += blocks * SHA1_BLOCK_SIZE;
63 }
64 partial = 0;
65 }
66 if (len)
67 memcpy(sctx->buffer + partial, data, len);
68
69 return 0;
70}
71
72static inline int sha1_base_do_finalize(struct shash_desc *desc,
73 sha1_block_fn *block_fn)
74{
75 const int bit_offset = SHA1_BLOCK_SIZE - sizeof(__be64);
76 struct sha1_state *sctx = shash_desc_ctx(desc);
77 __be64 *bits = (__be64 *)(sctx->buffer + bit_offset);
78 unsigned int partial = sctx->count % SHA1_BLOCK_SIZE;
79
80 sctx->buffer[partial++] = 0x80;
81 if (partial > bit_offset) {
82 memset(sctx->buffer + partial, 0x0, SHA1_BLOCK_SIZE - partial);
83 partial = 0;
84
85 block_fn(sctx, sctx->buffer, 1);
86 }
87
88 memset(sctx->buffer + partial, 0x0, bit_offset - partial);
89 *bits = cpu_to_be64(sctx->count << 3);
90 block_fn(sctx, sctx->buffer, 1);
91
92 return 0;
93}
94
95static inline int sha1_base_finish(struct shash_desc *desc, u8 *out)
96{
97 struct sha1_state *sctx = shash_desc_ctx(desc);
98 __be32 *digest = (__be32 *)out;
99 int i;
100
101 for (i = 0; i < SHA1_DIGEST_SIZE / sizeof(__be32); i++)
102 put_unaligned_be32(sctx->state[i], digest++);
103
104 *sctx = (struct sha1_state){};
105 return 0;
106}
diff --git a/include/crypto/sha256_base.h b/include/crypto/sha256_base.h
new file mode 100644
index 000000000000..d1f2195bb7de
--- /dev/null
+++ b/include/crypto/sha256_base.h
@@ -0,0 +1,128 @@
1/*
2 * sha256_base.h - core logic for SHA-256 implementations
3 *
4 * Copyright (C) 2015 Linaro Ltd <ard.biesheuvel@linaro.org>
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#include <crypto/internal/hash.h>
12#include <crypto/sha.h>
13#include <linux/crypto.h>
14#include <linux/module.h>
15
16#include <asm/unaligned.h>
17
18typedef void (sha256_block_fn)(struct sha256_state *sst, u8 const *src,
19 int blocks);
20
21static inline int sha224_base_init(struct shash_desc *desc)
22{
23 struct sha256_state *sctx = shash_desc_ctx(desc);
24
25 sctx->state[0] = SHA224_H0;
26 sctx->state[1] = SHA224_H1;
27 sctx->state[2] = SHA224_H2;
28 sctx->state[3] = SHA224_H3;
29 sctx->state[4] = SHA224_H4;
30 sctx->state[5] = SHA224_H5;
31 sctx->state[6] = SHA224_H6;
32 sctx->state[7] = SHA224_H7;
33 sctx->count = 0;
34
35 return 0;
36}
37
38static inline int sha256_base_init(struct shash_desc *desc)
39{
40 struct sha256_state *sctx = shash_desc_ctx(desc);
41
42 sctx->state[0] = SHA256_H0;
43 sctx->state[1] = SHA256_H1;
44 sctx->state[2] = SHA256_H2;
45 sctx->state[3] = SHA256_H3;
46 sctx->state[4] = SHA256_H4;
47 sctx->state[5] = SHA256_H5;
48 sctx->state[6] = SHA256_H6;
49 sctx->state[7] = SHA256_H7;
50 sctx->count = 0;
51
52 return 0;
53}
54
55static inline int sha256_base_do_update(struct shash_desc *desc,
56 const u8 *data,
57 unsigned int len,
58 sha256_block_fn *block_fn)
59{
60 struct sha256_state *sctx = shash_desc_ctx(desc);
61 unsigned int partial = sctx->count % SHA256_BLOCK_SIZE;
62
63 sctx->count += len;
64
65 if (unlikely((partial + len) >= SHA256_BLOCK_SIZE)) {
66 int blocks;
67
68 if (partial) {
69 int p = SHA256_BLOCK_SIZE - partial;
70
71 memcpy(sctx->buf + partial, data, p);
72 data += p;
73 len -= p;
74
75 block_fn(sctx, sctx->buf, 1);
76 }
77
78 blocks = len / SHA256_BLOCK_SIZE;
79 len %= SHA256_BLOCK_SIZE;
80
81 if (blocks) {
82 block_fn(sctx, data, blocks);
83 data += blocks * SHA256_BLOCK_SIZE;
84 }
85 partial = 0;
86 }
87 if (len)
88 memcpy(sctx->buf + partial, data, len);
89
90 return 0;
91}
92
93static inline int sha256_base_do_finalize(struct shash_desc *desc,
94 sha256_block_fn *block_fn)
95{
96 const int bit_offset = SHA256_BLOCK_SIZE - sizeof(__be64);
97 struct sha256_state *sctx = shash_desc_ctx(desc);
98 __be64 *bits = (__be64 *)(sctx->buf + bit_offset);
99 unsigned int partial = sctx->count % SHA256_BLOCK_SIZE;
100
101 sctx->buf[partial++] = 0x80;
102 if (partial > bit_offset) {
103 memset(sctx->buf + partial, 0x0, SHA256_BLOCK_SIZE - partial);
104 partial = 0;
105
106 block_fn(sctx, sctx->buf, 1);
107 }
108
109 memset(sctx->buf + partial, 0x0, bit_offset - partial);
110 *bits = cpu_to_be64(sctx->count << 3);
111 block_fn(sctx, sctx->buf, 1);
112
113 return 0;
114}
115
116static inline int sha256_base_finish(struct shash_desc *desc, u8 *out)
117{
118 unsigned int digest_size = crypto_shash_digestsize(desc->tfm);
119 struct sha256_state *sctx = shash_desc_ctx(desc);
120 __be32 *digest = (__be32 *)out;
121 int i;
122
123 for (i = 0; digest_size > 0; i++, digest_size -= sizeof(__be32))
124 put_unaligned_be32(sctx->state[i], digest++);
125
126 *sctx = (struct sha256_state){};
127 return 0;
128}
diff --git a/include/crypto/sha512_base.h b/include/crypto/sha512_base.h
new file mode 100644
index 000000000000..6c5341e005ea
--- /dev/null
+++ b/include/crypto/sha512_base.h
@@ -0,0 +1,131 @@
1/*
2 * sha512_base.h - core logic for SHA-512 implementations
3 *
4 * Copyright (C) 2015 Linaro Ltd <ard.biesheuvel@linaro.org>
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#include <crypto/internal/hash.h>
12#include <crypto/sha.h>
13#include <linux/crypto.h>
14#include <linux/module.h>
15
16#include <asm/unaligned.h>
17
18typedef void (sha512_block_fn)(struct sha512_state *sst, u8 const *src,
19 int blocks);
20
21static inline int sha384_base_init(struct shash_desc *desc)
22{
23 struct sha512_state *sctx = shash_desc_ctx(desc);
24
25 sctx->state[0] = SHA384_H0;
26 sctx->state[1] = SHA384_H1;
27 sctx->state[2] = SHA384_H2;
28 sctx->state[3] = SHA384_H3;
29 sctx->state[4] = SHA384_H4;
30 sctx->state[5] = SHA384_H5;
31 sctx->state[6] = SHA384_H6;
32 sctx->state[7] = SHA384_H7;
33 sctx->count[0] = sctx->count[1] = 0;
34
35 return 0;
36}
37
38static inline int sha512_base_init(struct shash_desc *desc)
39{
40 struct sha512_state *sctx = shash_desc_ctx(desc);
41
42 sctx->state[0] = SHA512_H0;
43 sctx->state[1] = SHA512_H1;
44 sctx->state[2] = SHA512_H2;
45 sctx->state[3] = SHA512_H3;
46 sctx->state[4] = SHA512_H4;
47 sctx->state[5] = SHA512_H5;
48 sctx->state[6] = SHA512_H6;
49 sctx->state[7] = SHA512_H7;
50 sctx->count[0] = sctx->count[1] = 0;
51
52 return 0;
53}
54
55static inline int sha512_base_do_update(struct shash_desc *desc,
56 const u8 *data,
57 unsigned int len,
58 sha512_block_fn *block_fn)
59{
60 struct sha512_state *sctx = shash_desc_ctx(desc);
61 unsigned int partial = sctx->count[0] % SHA512_BLOCK_SIZE;
62
63 sctx->count[0] += len;
64 if (sctx->count[0] < len)
65 sctx->count[1]++;
66
67 if (unlikely((partial + len) >= SHA512_BLOCK_SIZE)) {
68 int blocks;
69
70 if (partial) {
71 int p = SHA512_BLOCK_SIZE - partial;
72
73 memcpy(sctx->buf + partial, data, p);
74 data += p;
75 len -= p;
76
77 block_fn(sctx, sctx->buf, 1);
78 }
79
80 blocks = len / SHA512_BLOCK_SIZE;
81 len %= SHA512_BLOCK_SIZE;
82
83 if (blocks) {
84 block_fn(sctx, data, blocks);
85 data += blocks * SHA512_BLOCK_SIZE;
86 }
87 partial = 0;
88 }
89 if (len)
90 memcpy(sctx->buf + partial, data, len);
91
92 return 0;
93}
94
95static inline int sha512_base_do_finalize(struct shash_desc *desc,
96 sha512_block_fn *block_fn)
97{
98 const int bit_offset = SHA512_BLOCK_SIZE - sizeof(__be64[2]);
99 struct sha512_state *sctx = shash_desc_ctx(desc);
100 __be64 *bits = (__be64 *)(sctx->buf + bit_offset);
101 unsigned int partial = sctx->count[0] % SHA512_BLOCK_SIZE;
102
103 sctx->buf[partial++] = 0x80;
104 if (partial > bit_offset) {
105 memset(sctx->buf + partial, 0x0, SHA512_BLOCK_SIZE - partial);
106 partial = 0;
107
108 block_fn(sctx, sctx->buf, 1);
109 }
110
111 memset(sctx->buf + partial, 0x0, bit_offset - partial);
112 bits[0] = cpu_to_be64(sctx->count[1] << 3 | sctx->count[0] >> 61);
113 bits[1] = cpu_to_be64(sctx->count[0] << 3);
114 block_fn(sctx, sctx->buf, 1);
115
116 return 0;
117}
118
119static inline int sha512_base_finish(struct shash_desc *desc, u8 *out)
120{
121 unsigned int digest_size = crypto_shash_digestsize(desc->tfm);
122 struct sha512_state *sctx = shash_desc_ctx(desc);
123 __be64 *digest = (__be64 *)out;
124 int i;
125
126 for (i = 0; digest_size > 0; i++, digest_size -= sizeof(__be64))
127 put_unaligned_be64(sctx->state[i], digest++);
128
129 *sctx = (struct sha512_state){};
130 return 0;
131}
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
index 5a4f49005169..de13bfc35634 100644
--- a/include/drm/bridge/dw_hdmi.h
+++ b/include/drm/bridge/dw_hdmi.h
@@ -38,17 +38,18 @@ struct dw_hdmi_curr_ctrl {
38 u16 curr[DW_HDMI_RES_MAX]; 38 u16 curr[DW_HDMI_RES_MAX];
39}; 39};
40 40
41struct dw_hdmi_sym_term { 41struct dw_hdmi_phy_config {
42 unsigned long mpixelclock; 42 unsigned long mpixelclock;
43 u16 sym_ctr; /*clock symbol and transmitter control*/ 43 u16 sym_ctr; /*clock symbol and transmitter control*/
44 u16 term; /*transmission termination value*/ 44 u16 term; /*transmission termination value*/
45 u16 vlev_ctr; /* voltage level control */
45}; 46};
46 47
47struct dw_hdmi_plat_data { 48struct dw_hdmi_plat_data {
48 enum dw_hdmi_devtype dev_type; 49 enum dw_hdmi_devtype dev_type;
49 const struct dw_hdmi_mpll_config *mpll_cfg; 50 const struct dw_hdmi_mpll_config *mpll_cfg;
50 const struct dw_hdmi_curr_ctrl *cur_ctr; 51 const struct dw_hdmi_curr_ctrl *cur_ctr;
51 const struct dw_hdmi_sym_term *sym_term; 52 const struct dw_hdmi_phy_config *phy_config;
52 enum drm_mode_status (*mode_valid)(struct drm_connector *connector, 53 enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
53 struct drm_display_mode *mode); 54 struct drm_display_mode *mode);
54}; 55};
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e928625a9da0..62c40777c009 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -104,6 +104,9 @@ struct dma_buf_attachment;
104 * PRIME: used in the prime code. 104 * PRIME: used in the prime code.
105 * This is the category used by the DRM_DEBUG_PRIME() macro. 105 * This is the category used by the DRM_DEBUG_PRIME() macro.
106 * 106 *
107 * ATOMIC: used in the atomic code.
108 * This is the category used by the DRM_DEBUG_ATOMIC() macro.
109 *
107 * Enabling verbose debug messages is done through the drm.debug parameter, 110 * Enabling verbose debug messages is done through the drm.debug parameter,
108 * each category being enabled by a bit. 111 * each category being enabled by a bit.
109 * 112 *
@@ -121,6 +124,7 @@ struct dma_buf_attachment;
121#define DRM_UT_DRIVER 0x02 124#define DRM_UT_DRIVER 0x02
122#define DRM_UT_KMS 0x04 125#define DRM_UT_KMS 0x04
123#define DRM_UT_PRIME 0x08 126#define DRM_UT_PRIME 0x08
127#define DRM_UT_ATOMIC 0x10
124 128
125extern __printf(2, 3) 129extern __printf(2, 3)
126void drm_ut_debug_printk(const char *function_name, 130void drm_ut_debug_printk(const char *function_name,
@@ -207,6 +211,11 @@ void drm_err(const char *format, ...);
207 if (unlikely(drm_debug & DRM_UT_PRIME)) \ 211 if (unlikely(drm_debug & DRM_UT_PRIME)) \
208 drm_ut_debug_printk(__func__, fmt, ##args); \ 212 drm_ut_debug_printk(__func__, fmt, ##args); \
209 } while (0) 213 } while (0)
214#define DRM_DEBUG_ATOMIC(fmt, args...) \
215 do { \
216 if (unlikely(drm_debug & DRM_UT_ATOMIC)) \
217 drm_ut_debug_printk(__func__, fmt, ##args); \
218 } while (0)
210 219
211/*@}*/ 220/*@}*/
212 221
@@ -244,7 +253,6 @@ struct drm_ioctl_desc {
244 unsigned int cmd; 253 unsigned int cmd;
245 int flags; 254 int flags;
246 drm_ioctl_t *func; 255 drm_ioctl_t *func;
247 unsigned int cmd_drv;
248 const char *name; 256 const char *name;
249}; 257};
250 258
@@ -253,8 +261,13 @@ struct drm_ioctl_desc {
253 * ioctl, for use by drm_ioctl(). 261 * ioctl, for use by drm_ioctl().
254 */ 262 */
255 263
256#define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \ 264#define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \
257 [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl} 265 [DRM_IOCTL_NR(DRM_IOCTL_##ioctl) - DRM_COMMAND_BASE] = { \
266 .cmd = DRM_IOCTL_##ioctl, \
267 .func = _func, \
268 .flags = _flags, \
269 .name = #ioctl \
270 }
258 271
259/* Event queued up for userspace to read */ 272/* Event queued up for userspace to read */
260struct drm_pending_event { 273struct drm_pending_event {
@@ -922,6 +935,7 @@ extern void drm_crtc_wait_one_vblank(struct drm_crtc *crtc);
922extern void drm_vblank_off(struct drm_device *dev, int crtc); 935extern void drm_vblank_off(struct drm_device *dev, int crtc);
923extern void drm_vblank_on(struct drm_device *dev, int crtc); 936extern void drm_vblank_on(struct drm_device *dev, int crtc);
924extern void drm_crtc_vblank_off(struct drm_crtc *crtc); 937extern void drm_crtc_vblank_off(struct drm_crtc *crtc);
938extern void drm_crtc_vblank_reset(struct drm_crtc *crtc);
925extern void drm_crtc_vblank_on(struct drm_crtc *crtc); 939extern void drm_crtc_vblank_on(struct drm_crtc *crtc);
926extern void drm_vblank_cleanup(struct drm_device *dev); 940extern void drm_vblank_cleanup(struct drm_device *dev);
927 941
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 51168a8b723a..c157103492b0 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -75,4 +75,28 @@ int __must_check drm_atomic_check_only(struct drm_atomic_state *state);
75int __must_check drm_atomic_commit(struct drm_atomic_state *state); 75int __must_check drm_atomic_commit(struct drm_atomic_state *state);
76int __must_check drm_atomic_async_commit(struct drm_atomic_state *state); 76int __must_check drm_atomic_async_commit(struct drm_atomic_state *state);
77 77
78#define for_each_connector_in_state(state, connector, connector_state, __i) \
79 for ((__i) = 0; \
80 (connector) = (state)->connectors[__i], \
81 (connector_state) = (state)->connector_states[__i], \
82 (__i) < (state)->num_connector; \
83 (__i)++) \
84 if (connector)
85
86#define for_each_crtc_in_state(state, crtc, crtc_state, __i) \
87 for ((__i) = 0; \
88 (crtc) = (state)->crtcs[__i], \
89 (crtc_state) = (state)->crtc_states[__i], \
90 (__i) < (state)->dev->mode_config.num_crtc; \
91 (__i)++) \
92 if (crtc_state)
93
94#define for_each_plane_in_state(state, plane, plane_state, __i) \
95 for ((__i) = 0; \
96 (plane) = (state)->planes[__i], \
97 (plane_state) = (state)->plane_states[__i], \
98 (__i) < (state)->dev->mode_config.num_total_plane; \
99 (__i)++) \
100 if (plane_state)
101
78#endif /* DRM_ATOMIC_H_ */ 102#endif /* DRM_ATOMIC_H_ */
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index 8039d54a7441..d665781eb542 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -43,9 +43,9 @@ int drm_atomic_helper_commit(struct drm_device *dev,
43void drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, 43void drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
44 struct drm_atomic_state *old_state); 44 struct drm_atomic_state *old_state);
45 45
46void drm_atomic_helper_commit_pre_planes(struct drm_device *dev, 46void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev,
47 struct drm_atomic_state *state); 47 struct drm_atomic_state *state);
48void drm_atomic_helper_commit_post_planes(struct drm_device *dev, 48void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
49 struct drm_atomic_state *old_state); 49 struct drm_atomic_state *old_state);
50 50
51int drm_atomic_helper_prepare_planes(struct drm_device *dev, 51int drm_atomic_helper_prepare_planes(struct drm_device *dev,
@@ -87,20 +87,34 @@ void drm_atomic_helper_connector_dpms(struct drm_connector *connector,
87 87
88/* default implementations for state handling */ 88/* default implementations for state handling */
89void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc); 89void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc);
90void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc,
91 struct drm_crtc_state *state);
90struct drm_crtc_state * 92struct drm_crtc_state *
91drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc); 93drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc);
94void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
95 struct drm_crtc_state *state);
92void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc, 96void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
93 struct drm_crtc_state *state); 97 struct drm_crtc_state *state);
94 98
95void drm_atomic_helper_plane_reset(struct drm_plane *plane); 99void drm_atomic_helper_plane_reset(struct drm_plane *plane);
100void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane,
101 struct drm_plane_state *state);
96struct drm_plane_state * 102struct drm_plane_state *
97drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane); 103drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane);
104void __drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
105 struct drm_plane_state *state);
98void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane, 106void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
99 struct drm_plane_state *state); 107 struct drm_plane_state *state);
100 108
101void drm_atomic_helper_connector_reset(struct drm_connector *connector); 109void drm_atomic_helper_connector_reset(struct drm_connector *connector);
110void
111__drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector,
112 struct drm_connector_state *state);
102struct drm_connector_state * 113struct drm_connector_state *
103drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector); 114drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector);
115void
116__drm_atomic_helper_connector_destroy_state(struct drm_connector *connector,
117 struct drm_connector_state *state);
104void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, 118void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector,
105 struct drm_connector_state *state); 119 struct drm_connector_state *state);
106 120
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 920e21a8f3fd..ca71c03143d1 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -53,7 +53,6 @@ struct fence;
53#define DRM_MODE_OBJECT_FB 0xfbfbfbfb 53#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
54#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb 54#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
55#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee 55#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
56#define DRM_MODE_OBJECT_BRIDGE 0xbdbdbdbd
57#define DRM_MODE_OBJECT_ANY 0 56#define DRM_MODE_OBJECT_ANY 0
58 57
59struct drm_mode_object { 58struct drm_mode_object {
@@ -202,6 +201,7 @@ struct drm_framebuffer {
202 const struct drm_framebuffer_funcs *funcs; 201 const struct drm_framebuffer_funcs *funcs;
203 unsigned int pitches[4]; 202 unsigned int pitches[4];
204 unsigned int offsets[4]; 203 unsigned int offsets[4];
204 uint64_t modifier[4];
205 unsigned int width; 205 unsigned int width;
206 unsigned int height; 206 unsigned int height;
207 /* depth can be 15 or 16 */ 207 /* depth can be 15 or 16 */
@@ -466,7 +466,7 @@ struct drm_crtc {
466 int framedur_ns, linedur_ns, pixeldur_ns; 466 int framedur_ns, linedur_ns, pixeldur_ns;
467 467
468 /* if you are using the helper */ 468 /* if you are using the helper */
469 void *helper_private; 469 const void *helper_private;
470 470
471 struct drm_object_properties properties; 471 struct drm_object_properties properties;
472 472
@@ -596,7 +596,7 @@ struct drm_encoder {
596 struct drm_crtc *crtc; 596 struct drm_crtc *crtc;
597 struct drm_bridge *bridge; 597 struct drm_bridge *bridge;
598 const struct drm_encoder_funcs *funcs; 598 const struct drm_encoder_funcs *funcs;
599 void *helper_private; 599 const void *helper_private;
600}; 600};
601 601
602/* should we poll this connector for connects and disconnects */ 602/* should we poll this connector for connects and disconnects */
@@ -700,7 +700,7 @@ struct drm_connector {
700 /* requested DPMS state */ 700 /* requested DPMS state */
701 int dpms; 701 int dpms;
702 702
703 void *helper_private; 703 const void *helper_private;
704 704
705 /* forced on connector */ 705 /* forced on connector */
706 struct drm_cmdline_mode cmdline_mode; 706 struct drm_cmdline_mode cmdline_mode;
@@ -829,6 +829,7 @@ enum drm_plane_type {
829 * @possible_crtcs: pipes this plane can be bound to 829 * @possible_crtcs: pipes this plane can be bound to
830 * @format_types: array of formats supported by this plane 830 * @format_types: array of formats supported by this plane
831 * @format_count: number of formats supported 831 * @format_count: number of formats supported
832 * @format_default: driver hasn't supplied supported formats for the plane
832 * @crtc: currently bound CRTC 833 * @crtc: currently bound CRTC
833 * @fb: currently bound fb 834 * @fb: currently bound fb
834 * @old_fb: Temporary tracking of the old fb while a modeset is ongoing. Used by 835 * @old_fb: Temporary tracking of the old fb while a modeset is ongoing. Used by
@@ -849,6 +850,7 @@ struct drm_plane {
849 uint32_t possible_crtcs; 850 uint32_t possible_crtcs;
850 uint32_t *format_types; 851 uint32_t *format_types;
851 uint32_t format_count; 852 uint32_t format_count;
853 bool format_default;
852 854
853 struct drm_crtc *crtc; 855 struct drm_crtc *crtc;
854 struct drm_framebuffer *fb; 856 struct drm_framebuffer *fb;
@@ -861,7 +863,7 @@ struct drm_plane {
861 863
862 enum drm_plane_type type; 864 enum drm_plane_type type;
863 865
864 void *helper_private; 866 const void *helper_private;
865 867
866 struct drm_plane_state *state; 868 struct drm_plane_state *state;
867}; 869};
@@ -912,7 +914,7 @@ struct drm_bridge {
912}; 914};
913 915
914/** 916/**
915 * struct struct drm_atomic_state - the global state object for atomic updates 917 * struct drm_atomic_state - the global state object for atomic updates
916 * @dev: parent DRM device 918 * @dev: parent DRM device
917 * @allow_modeset: allow full modeset 919 * @allow_modeset: allow full modeset
918 * @legacy_cursor_update: hint to enforce legacy cursor ioctl semantics 920 * @legacy_cursor_update: hint to enforce legacy cursor ioctl semantics
@@ -972,7 +974,7 @@ struct drm_mode_set {
972 * struct drm_mode_config_funcs - basic driver provided mode setting functions 974 * struct drm_mode_config_funcs - basic driver provided mode setting functions
973 * @fb_create: create a new framebuffer object 975 * @fb_create: create a new framebuffer object
974 * @output_poll_changed: function to handle output configuration changes 976 * @output_poll_changed: function to handle output configuration changes
975 * @atomic_check: check whether a give atomic state update is possible 977 * @atomic_check: check whether a given atomic state update is possible
976 * @atomic_commit: commit an atomic state update previously verified with 978 * @atomic_commit: commit an atomic state update previously verified with
977 * atomic_check() 979 * atomic_check()
978 * 980 *
@@ -1155,6 +1157,9 @@ struct drm_mode_config {
1155 /* whether async page flip is supported or not */ 1157 /* whether async page flip is supported or not */
1156 bool async_page_flip; 1158 bool async_page_flip;
1157 1159
1160 /* whether the driver supports fb modifiers */
1161 bool allow_fb_modifiers;
1162
1158 /* cursor size */ 1163 /* cursor size */
1159 uint32_t cursor_width, cursor_height; 1164 uint32_t cursor_width, cursor_height;
1160}; 1165};
@@ -1259,6 +1264,8 @@ extern int drm_plane_init(struct drm_device *dev,
1259extern void drm_plane_cleanup(struct drm_plane *plane); 1264extern void drm_plane_cleanup(struct drm_plane *plane);
1260extern unsigned int drm_plane_index(struct drm_plane *plane); 1265extern unsigned int drm_plane_index(struct drm_plane *plane);
1261extern void drm_plane_force_disable(struct drm_plane *plane); 1266extern void drm_plane_force_disable(struct drm_plane *plane);
1267extern int drm_plane_check_pixel_format(const struct drm_plane *plane,
1268 u32 format);
1262extern void drm_crtc_get_hv_timing(const struct drm_display_mode *mode, 1269extern void drm_crtc_get_hv_timing(const struct drm_display_mode *mode,
1263 int *hdisplay, int *vdisplay); 1270 int *hdisplay, int *vdisplay);
1264extern int drm_crtc_check_viewport(const struct drm_crtc *crtc, 1271extern int drm_crtc_check_viewport(const struct drm_crtc *crtc,
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index c250a22b39ab..c8fc187061de 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -89,6 +89,7 @@ struct drm_crtc_helper_funcs {
89 int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode, 89 int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode,
90 struct drm_display_mode *adjusted_mode, int x, int y, 90 struct drm_display_mode *adjusted_mode, int x, int y,
91 struct drm_framebuffer *old_fb); 91 struct drm_framebuffer *old_fb);
92 /* Actually set the mode for atomic helpers, optional */
92 void (*mode_set_nofb)(struct drm_crtc *crtc); 93 void (*mode_set_nofb)(struct drm_crtc *crtc);
93 94
94 /* Move the crtc on the current fb to the given position *optional* */ 95 /* Move the crtc on the current fb to the given position *optional* */
@@ -119,7 +120,7 @@ struct drm_crtc_helper_funcs {
119 * @mode_fixup: try to fixup proposed mode for this connector 120 * @mode_fixup: try to fixup proposed mode for this connector
120 * @prepare: part of the disable sequence, called before the CRTC modeset 121 * @prepare: part of the disable sequence, called before the CRTC modeset
121 * @commit: called after the CRTC modeset 122 * @commit: called after the CRTC modeset
122 * @mode_set: set this mode 123 * @mode_set: set this mode, optional for atomic helpers
123 * @get_crtc: return CRTC that the encoder is currently attached to 124 * @get_crtc: return CRTC that the encoder is currently attached to
124 * @detect: connection status detection 125 * @detect: connection status detection
125 * @disable: disable encoder when not in use (overrides DPMS off) 126 * @disable: disable encoder when not in use (overrides DPMS off)
@@ -196,19 +197,19 @@ extern void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
196static inline void drm_crtc_helper_add(struct drm_crtc *crtc, 197static inline void drm_crtc_helper_add(struct drm_crtc *crtc,
197 const struct drm_crtc_helper_funcs *funcs) 198 const struct drm_crtc_helper_funcs *funcs)
198{ 199{
199 crtc->helper_private = (void *)funcs; 200 crtc->helper_private = funcs;
200} 201}
201 202
202static inline void drm_encoder_helper_add(struct drm_encoder *encoder, 203static inline void drm_encoder_helper_add(struct drm_encoder *encoder,
203 const struct drm_encoder_helper_funcs *funcs) 204 const struct drm_encoder_helper_funcs *funcs)
204{ 205{
205 encoder->helper_private = (void *)funcs; 206 encoder->helper_private = funcs;
206} 207}
207 208
208static inline void drm_connector_helper_add(struct drm_connector *connector, 209static inline void drm_connector_helper_add(struct drm_connector *connector,
209 const struct drm_connector_helper_funcs *funcs) 210 const struct drm_connector_helper_funcs *funcs)
210{ 211{
211 connector->helper_private = (void *)funcs; 212 connector->helper_private = funcs;
212} 213}
213 214
214extern void drm_helper_resume_force_mode(struct drm_device *dev); 215extern void drm_helper_resume_force_mode(struct drm_device *dev);
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 7e25030a6aa2..523f04c90dea 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -42,6 +42,8 @@
42 * 1.2 formally includes both eDP and DPI definitions. 42 * 1.2 formally includes both eDP and DPI definitions.
43 */ 43 */
44 44
45#define DP_AUX_MAX_PAYLOAD_BYTES 16
46
45#define DP_AUX_I2C_WRITE 0x0 47#define DP_AUX_I2C_WRITE 0x0
46#define DP_AUX_I2C_READ 0x1 48#define DP_AUX_I2C_READ 0x1
47#define DP_AUX_I2C_STATUS 0x2 49#define DP_AUX_I2C_STATUS 0x2
@@ -92,6 +94,15 @@
92# define DP_MSA_TIMING_PAR_IGNORED (1 << 6) /* eDP */ 94# define DP_MSA_TIMING_PAR_IGNORED (1 << 6) /* eDP */
93# define DP_OUI_SUPPORT (1 << 7) 95# define DP_OUI_SUPPORT (1 << 7)
94 96
97#define DP_RECEIVE_PORT_0_CAP_0 0x008
98# define DP_LOCAL_EDID_PRESENT (1 << 1)
99# define DP_ASSOCIATED_TO_PRECEDING_PORT (1 << 2)
100
101#define DP_RECEIVE_PORT_0_BUFFER_SIZE 0x009
102
103#define DP_RECEIVE_PORT_1_CAP_0 0x00a
104#define DP_RECEIVE_PORT_1_BUFFER_SIZE 0x00b
105
95#define DP_I2C_SPEED_CAP 0x00c /* DPI */ 106#define DP_I2C_SPEED_CAP 0x00c /* DPI */
96# define DP_I2C_SPEED_1K 0x01 107# define DP_I2C_SPEED_1K 0x01
97# define DP_I2C_SPEED_5K 0x02 108# define DP_I2C_SPEED_5K 0x02
@@ -101,8 +112,19 @@
101# define DP_I2C_SPEED_1M 0x20 112# define DP_I2C_SPEED_1M 0x20
102 113
103#define DP_EDP_CONFIGURATION_CAP 0x00d /* XXX 1.2? */ 114#define DP_EDP_CONFIGURATION_CAP 0x00d /* XXX 1.2? */
115# define DP_ALTERNATE_SCRAMBLER_RESET_CAP (1 << 0)
116# define DP_FRAMING_CHANGE_CAP (1 << 1)
117# define DP_DPCD_DISPLAY_CONTROL_CAPABLE (1 << 3) /* edp v1.2 or higher */
118
104#define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */ 119#define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */
105 120
121#define DP_ADAPTER_CAP 0x00f /* 1.2 */
122# define DP_FORCE_LOAD_SENSE_CAP (1 << 0)
123# define DP_ALTERNATE_I2C_PATTERN_CAP (1 << 1)
124
125#define DP_SUPPORTED_LINK_RATES 0x010 /* eDP 1.4 */
126# define DP_MAX_SUPPORTED_RATES 8 /* 16-bit little-endian */
127
106/* Multiple stream transport */ 128/* Multiple stream transport */
107#define DP_FAUX_CAP 0x020 /* 1.2 */ 129#define DP_FAUX_CAP 0x020 /* 1.2 */
108# define DP_FAUX_CAP_1 (1 << 0) 130# define DP_FAUX_CAP_1 (1 << 0)
@@ -110,10 +132,56 @@
110#define DP_MSTM_CAP 0x021 /* 1.2 */ 132#define DP_MSTM_CAP 0x021 /* 1.2 */
111# define DP_MST_CAP (1 << 0) 133# define DP_MST_CAP (1 << 0)
112 134
135#define DP_NUMBER_OF_AUDIO_ENDPOINTS 0x022 /* 1.2 */
136
137/* AV_SYNC_DATA_BLOCK 1.2 */
138#define DP_AV_GRANULARITY 0x023
139# define DP_AG_FACTOR_MASK (0xf << 0)
140# define DP_AG_FACTOR_3MS (0 << 0)
141# define DP_AG_FACTOR_2MS (1 << 0)
142# define DP_AG_FACTOR_1MS (2 << 0)
143# define DP_AG_FACTOR_500US (3 << 0)
144# define DP_AG_FACTOR_200US (4 << 0)
145# define DP_AG_FACTOR_100US (5 << 0)
146# define DP_AG_FACTOR_10US (6 << 0)
147# define DP_AG_FACTOR_1US (7 << 0)
148# define DP_VG_FACTOR_MASK (0xf << 4)
149# define DP_VG_FACTOR_3MS (0 << 4)
150# define DP_VG_FACTOR_2MS (1 << 4)
151# define DP_VG_FACTOR_1MS (2 << 4)
152# define DP_VG_FACTOR_500US (3 << 4)
153# define DP_VG_FACTOR_200US (4 << 4)
154# define DP_VG_FACTOR_100US (5 << 4)
155
156#define DP_AUD_DEC_LAT0 0x024
157#define DP_AUD_DEC_LAT1 0x025
158
159#define DP_AUD_PP_LAT0 0x026
160#define DP_AUD_PP_LAT1 0x027
161
162#define DP_VID_INTER_LAT 0x028
163
164#define DP_VID_PROG_LAT 0x029
165
166#define DP_REP_LAT 0x02a
167
168#define DP_AUD_DEL_INS0 0x02b
169#define DP_AUD_DEL_INS1 0x02c
170#define DP_AUD_DEL_INS2 0x02d
171/* End of AV_SYNC_DATA_BLOCK */
172
173#define DP_RECEIVER_ALPM_CAP 0x02e /* eDP 1.4 */
174# define DP_ALPM_CAP (1 << 0)
175
176#define DP_SINK_DEVICE_AUX_FRAME_SYNC_CAP 0x02f /* eDP 1.4 */
177# define DP_AUX_FRAME_SYNC_CAP (1 << 0)
178
113#define DP_GUID 0x030 /* 1.2 */ 179#define DP_GUID 0x030 /* 1.2 */
114 180
115#define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */ 181#define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */
116# define DP_PSR_IS_SUPPORTED 1 182# define DP_PSR_IS_SUPPORTED 1
183# define DP_PSR2_IS_SUPPORTED 2 /* eDP 1.4 */
184
117#define DP_PSR_CAPS 0x071 /* XXX 1.2? */ 185#define DP_PSR_CAPS 0x071 /* XXX 1.2? */
118# define DP_PSR_NO_TRAIN_ON_EXIT 1 186# define DP_PSR_NO_TRAIN_ON_EXIT 1
119# define DP_PSR_SETUP_TIME_330 (0 << 1) 187# define DP_PSR_SETUP_TIME_330 (0 << 1)
@@ -153,6 +221,7 @@
153 221
154/* link configuration */ 222/* link configuration */
155#define DP_LINK_BW_SET 0x100 223#define DP_LINK_BW_SET 0x100
224# define DP_LINK_RATE_TABLE 0x00 /* eDP 1.4 */
156# define DP_LINK_BW_1_62 0x06 225# define DP_LINK_BW_1_62 0x06
157# define DP_LINK_BW_2_7 0x0a 226# define DP_LINK_BW_2_7 0x0a
158# define DP_LINK_BW_5_4 0x14 /* 1.2 */ 227# define DP_LINK_BW_5_4 0x14 /* 1.2 */
@@ -168,11 +237,12 @@
168# define DP_TRAINING_PATTERN_3 3 /* 1.2 */ 237# define DP_TRAINING_PATTERN_3 3 /* 1.2 */
169# define DP_TRAINING_PATTERN_MASK 0x3 238# define DP_TRAINING_PATTERN_MASK 0x3
170 239
171# define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2) 240/* DPCD 1.1 only. For DPCD >= 1.2 see per-lane DP_LINK_QUAL_LANEn_SET */
172# define DP_LINK_QUAL_PATTERN_D10_2 (1 << 2) 241# define DP_LINK_QUAL_PATTERN_11_DISABLE (0 << 2)
173# define DP_LINK_QUAL_PATTERN_ERROR_RATE (2 << 2) 242# define DP_LINK_QUAL_PATTERN_11_D10_2 (1 << 2)
174# define DP_LINK_QUAL_PATTERN_PRBS7 (3 << 2) 243# define DP_LINK_QUAL_PATTERN_11_ERROR_RATE (2 << 2)
175# define DP_LINK_QUAL_PATTERN_MASK (3 << 2) 244# define DP_LINK_QUAL_PATTERN_11_PRBS7 (3 << 2)
245# define DP_LINK_QUAL_PATTERN_11_MASK (3 << 2)
176 246
177# define DP_RECOVERED_CLOCK_OUT_EN (1 << 4) 247# define DP_RECOVERED_CLOCK_OUT_EN (1 << 4)
178# define DP_LINK_SCRAMBLING_DISABLE (1 << 5) 248# define DP_LINK_SCRAMBLING_DISABLE (1 << 5)
@@ -215,17 +285,63 @@
215/* bitmask as for DP_I2C_SPEED_CAP */ 285/* bitmask as for DP_I2C_SPEED_CAP */
216 286
217#define DP_EDP_CONFIGURATION_SET 0x10a /* XXX 1.2? */ 287#define DP_EDP_CONFIGURATION_SET 0x10a /* XXX 1.2? */
288# define DP_ALTERNATE_SCRAMBLER_RESET_ENABLE (1 << 0)
289# define DP_FRAMING_CHANGE_ENABLE (1 << 1)
290# define DP_PANEL_SELF_TEST_ENABLE (1 << 7)
291
292#define DP_LINK_QUAL_LANE0_SET 0x10b /* DPCD >= 1.2 */
293#define DP_LINK_QUAL_LANE1_SET 0x10c
294#define DP_LINK_QUAL_LANE2_SET 0x10d
295#define DP_LINK_QUAL_LANE3_SET 0x10e
296# define DP_LINK_QUAL_PATTERN_DISABLE 0
297# define DP_LINK_QUAL_PATTERN_D10_2 1
298# define DP_LINK_QUAL_PATTERN_ERROR_RATE 2
299# define DP_LINK_QUAL_PATTERN_PRBS7 3
300# define DP_LINK_QUAL_PATTERN_80BIT_CUSTOM 4
301# define DP_LINK_QUAL_PATTERN_HBR2_EYE 5
302# define DP_LINK_QUAL_PATTERN_MASK 7
303
304#define DP_TRAINING_LANE0_1_SET2 0x10f
305#define DP_TRAINING_LANE2_3_SET2 0x110
306# define DP_LANE02_POST_CURSOR2_SET_MASK (3 << 0)
307# define DP_LANE02_MAX_POST_CURSOR2_REACHED (1 << 2)
308# define DP_LANE13_POST_CURSOR2_SET_MASK (3 << 4)
309# define DP_LANE13_MAX_POST_CURSOR2_REACHED (1 << 6)
218 310
219#define DP_MSTM_CTRL 0x111 /* 1.2 */ 311#define DP_MSTM_CTRL 0x111 /* 1.2 */
220# define DP_MST_EN (1 << 0) 312# define DP_MST_EN (1 << 0)
221# define DP_UP_REQ_EN (1 << 1) 313# define DP_UP_REQ_EN (1 << 1)
222# define DP_UPSTREAM_IS_SRC (1 << 2) 314# define DP_UPSTREAM_IS_SRC (1 << 2)
223 315
316#define DP_AUDIO_DELAY0 0x112 /* 1.2 */
317#define DP_AUDIO_DELAY1 0x113
318#define DP_AUDIO_DELAY2 0x114
319
320#define DP_LINK_RATE_SET 0x115 /* eDP 1.4 */
321# define DP_LINK_RATE_SET_SHIFT 0
322# define DP_LINK_RATE_SET_MASK (7 << 0)
323
324#define DP_RECEIVER_ALPM_CONFIG 0x116 /* eDP 1.4 */
325# define DP_ALPM_ENABLE (1 << 0)
326# define DP_ALPM_LOCK_ERROR_IRQ_HPD_ENABLE (1 << 1)
327
328#define DP_SINK_DEVICE_AUX_FRAME_SYNC_CONF 0x117 /* eDP 1.4 */
329# define DP_AUX_FRAME_SYNC_ENABLE (1 << 0)
330# define DP_IRQ_HPD_ENABLE (1 << 1)
331
332#define DP_UPSTREAM_DEVICE_DP_PWR_NEED 0x118 /* 1.2 */
333# define DP_PWR_NOT_NEEDED (1 << 0)
334
335#define DP_AUX_FRAME_SYNC_VALUE 0x15c /* eDP 1.4 */
336# define DP_AUX_FRAME_SYNC_VALID (1 << 0)
337
224#define DP_PSR_EN_CFG 0x170 /* XXX 1.2? */ 338#define DP_PSR_EN_CFG 0x170 /* XXX 1.2? */
225# define DP_PSR_ENABLE (1 << 0) 339# define DP_PSR_ENABLE (1 << 0)
226# define DP_PSR_MAIN_LINK_ACTIVE (1 << 1) 340# define DP_PSR_MAIN_LINK_ACTIVE (1 << 1)
227# define DP_PSR_CRC_VERIFICATION (1 << 2) 341# define DP_PSR_CRC_VERIFICATION (1 << 2)
228# define DP_PSR_FRAME_CAPTURE (1 << 3) 342# define DP_PSR_FRAME_CAPTURE (1 << 3)
343# define DP_PSR_SELECTIVE_UPDATE (1 << 4)
344# define DP_PSR_IRQ_HPD_WITH_CRC_ERRORS (1 << 5)
229 345
230#define DP_ADAPTER_CTRL 0x1a0 346#define DP_ADAPTER_CTRL 0x1a0
231# define DP_ADAPTER_CTRL_FORCE_LOAD_SENSE (1 << 0) 347# define DP_ADAPTER_CTRL_FORCE_LOAD_SENSE (1 << 0)
@@ -332,6 +448,49 @@
332# define DP_SET_POWER_D3 0x2 448# define DP_SET_POWER_D3 0x2
333# define DP_SET_POWER_MASK 0x3 449# define DP_SET_POWER_MASK 0x3
334 450
451#define DP_EDP_DPCD_REV 0x700 /* eDP 1.2 */
452# define DP_EDP_11 0x00
453# define DP_EDP_12 0x01
454# define DP_EDP_13 0x02
455# define DP_EDP_14 0x03
456
457#define DP_EDP_GENERAL_CAP_1 0x701
458
459#define DP_EDP_BACKLIGHT_ADJUSTMENT_CAP 0x702
460
461#define DP_EDP_GENERAL_CAP_2 0x703
462
463#define DP_EDP_GENERAL_CAP_3 0x704 /* eDP 1.4 */
464
465#define DP_EDP_DISPLAY_CONTROL_REGISTER 0x720
466
467#define DP_EDP_BACKLIGHT_MODE_SET_REGISTER 0x721
468
469#define DP_EDP_BACKLIGHT_BRIGHTNESS_MSB 0x722
470#define DP_EDP_BACKLIGHT_BRIGHTNESS_LSB 0x723
471
472#define DP_EDP_PWMGEN_BIT_COUNT 0x724
473#define DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN 0x725
474#define DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX 0x726
475
476#define DP_EDP_BACKLIGHT_CONTROL_STATUS 0x727
477
478#define DP_EDP_BACKLIGHT_FREQ_SET 0x728
479
480#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_MSB 0x72a
481#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_MID 0x72b
482#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_LSB 0x72c
483
484#define DP_EDP_BACKLIGHT_FREQ_CAP_MAX_MSB 0x72d
485#define DP_EDP_BACKLIGHT_FREQ_CAP_MAX_MID 0x72e
486#define DP_EDP_BACKLIGHT_FREQ_CAP_MAX_LSB 0x72f
487
488#define DP_EDP_DBC_MINIMUM_BRIGHTNESS_SET 0x732
489#define DP_EDP_DBC_MAXIMUM_BRIGHTNESS_SET 0x733
490
491#define DP_EDP_REGIONAL_BACKLIGHT_BASE 0x740 /* eDP 1.4 */
492#define DP_EDP_REGIONAL_BACKLIGHT_0 0x741 /* eDP 1.4 */
493
335#define DP_SIDEBAND_MSG_DOWN_REQ_BASE 0x1000 /* 1.2 MST */ 494#define DP_SIDEBAND_MSG_DOWN_REQ_BASE 0x1000 /* 1.2 MST */
336#define DP_SIDEBAND_MSG_UP_REP_BASE 0x1200 /* 1.2 MST */ 495#define DP_SIDEBAND_MSG_UP_REP_BASE 0x1200 /* 1.2 MST */
337#define DP_SIDEBAND_MSG_DOWN_REP_BASE 0x1400 /* 1.2 MST */ 496#define DP_SIDEBAND_MSG_DOWN_REP_BASE 0x1400 /* 1.2 MST */
@@ -350,6 +509,7 @@
350#define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */ 509#define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */
351# define DP_PSR_LINK_CRC_ERROR (1 << 0) 510# define DP_PSR_LINK_CRC_ERROR (1 << 0)
352# define DP_PSR_RFB_STORAGE_ERROR (1 << 1) 511# define DP_PSR_RFB_STORAGE_ERROR (1 << 1)
512# define DP_PSR_VSC_SDP_UNCORRECTABLE_ERROR (1 << 2) /* eDP 1.4 */
353 513
354#define DP_PSR_ESI 0x2007 /* XXX 1.2? */ 514#define DP_PSR_ESI 0x2007 /* XXX 1.2? */
355# define DP_PSR_CAPS_CHANGE (1 << 0) 515# define DP_PSR_CAPS_CHANGE (1 << 0)
@@ -363,6 +523,9 @@
363# define DP_PSR_SINK_INTERNAL_ERROR 7 523# define DP_PSR_SINK_INTERNAL_ERROR 7
364# define DP_PSR_SINK_STATE_MASK 0x07 524# define DP_PSR_SINK_STATE_MASK 0x07
365 525
526#define DP_RECEIVER_ALPM_STATUS 0x200b /* eDP 1.4 */
527# define DP_ALPM_LOCK_TIMEOUT_ERROR (1 << 0)
528
366/* DP 1.2 Sideband message defines */ 529/* DP 1.2 Sideband message defines */
367/* peer device type - DP 1.2a Table 2-92 */ 530/* peer device type - DP 1.2a Table 2-92 */
368#define DP_PEER_DEVICE_NONE 0x0 531#define DP_PEER_DEVICE_NONE 0x0
@@ -519,6 +682,9 @@ struct drm_dp_aux_msg {
519 * transactions. The drm_dp_aux_register_i2c_bus() function registers an 682 * transactions. The drm_dp_aux_register_i2c_bus() function registers an
520 * I2C adapter that can be passed to drm_probe_ddc(). Upon removal, drivers 683 * I2C adapter that can be passed to drm_probe_ddc(). Upon removal, drivers
521 * should call drm_dp_aux_unregister_i2c_bus() to remove the I2C adapter. 684 * should call drm_dp_aux_unregister_i2c_bus() to remove the I2C adapter.
685 * The I2C adapter uses long transfers by default; if a partial response is
686 * received, the adapter will drop down to the size given by the partial
687 * response for this transaction only.
522 * 688 *
523 * Note that the aux helper code assumes that the .transfer() function 689 * Note that the aux helper code assumes that the .transfer() function
524 * only modifies the reply field of the drm_dp_aux_msg structure. The 690 * only modifies the reply field of the drm_dp_aux_msg structure. The
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
index 00c1da927245..a2507817be41 100644
--- a/include/drm/drm_dp_mst_helper.h
+++ b/include/drm/drm_dp_mst_helper.h
@@ -486,6 +486,8 @@ int drm_dp_calc_pbn_mode(int clock, int bpp);
486 486
487bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int *slots); 487bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int *slots);
488 488
489int drm_dp_mst_get_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
490
489 491
490void drm_dp_mst_reset_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); 492void drm_dp_mst_reset_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
491 493
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 87d85e81d3a7..799050198323 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -215,6 +215,8 @@ struct detailed_timing {
215#define DRM_ELD_VER 0 215#define DRM_ELD_VER 0
216# define DRM_ELD_VER_SHIFT 3 216# define DRM_ELD_VER_SHIFT 3
217# define DRM_ELD_VER_MASK (0x1f << 3) 217# define DRM_ELD_VER_MASK (0x1f << 3)
218# define DRM_ELD_VER_CEA861D (2 << 3) /* supports 861D or below */
219# define DRM_ELD_VER_CANNED (0x1f << 3)
218 220
219#define DRM_ELD_BASELINE_ELD_LEN 2 /* in dwords! */ 221#define DRM_ELD_BASELINE_ELD_LEN 2 /* in dwords! */
220 222
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 21b944c456f6..0dfd94def593 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -44,6 +44,25 @@ struct drm_fb_helper_crtc {
44 int x, y; 44 int x, y;
45}; 45};
46 46
47/**
48 * struct drm_fb_helper_surface_size - describes fbdev size and scanout surface size
49 * @fb_width: fbdev width
50 * @fb_height: fbdev height
51 * @surface_width: scanout buffer width
52 * @surface_height: scanout buffer height
53 * @surface_bpp: scanout buffer bpp
54 * @surface_depth: scanout buffer depth
55 *
56 * Note that the scanout surface width/height may be larger than the fbdev
57 * width/height. In case of multiple displays, the scanout surface is sized
58 * according to the largest width/height (so it is large enough for all CRTCs
59 * to scanout). But the fbdev width/height is sized to the minimum width/
60 * height of all the displays. This ensures that fbcon fits on the smallest
61 * of the attached displays.
62 *
63 * So what is passed to drm_fb_helper_fill_var() should be fb_width/fb_height,
64 * rather than the surface size.
65 */
47struct drm_fb_helper_surface_size { 66struct drm_fb_helper_surface_size {
48 u32 fb_width; 67 u32 fb_width;
49 u32 fb_height; 68 u32 fb_height;
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index 1e6ae1458f7a..7a592d7e398b 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -149,14 +149,16 @@ drm_gem_object_unreference(struct drm_gem_object *obj)
149static inline void 149static inline void
150drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) 150drm_gem_object_unreference_unlocked(struct drm_gem_object *obj)
151{ 151{
152 if (obj && !atomic_add_unless(&obj->refcount.refcount, -1, 1)) { 152 struct drm_device *dev;
153 struct drm_device *dev = obj->dev; 153
154 if (!obj)
155 return;
154 156
155 mutex_lock(&dev->struct_mutex); 157 dev = obj->dev;
156 if (likely(atomic_dec_and_test(&obj->refcount.refcount))) 158 if (kref_put_mutex(&obj->refcount, drm_gem_object_free, &dev->struct_mutex))
157 drm_gem_object_free(&obj->refcount);
158 mutex_unlock(&dev->struct_mutex); 159 mutex_unlock(&dev->struct_mutex);
159 } 160 else
161 might_lock(&dev->struct_mutex);
160} 162}
161 163
162int drm_gem_handle_create(struct drm_file *file_priv, 164int drm_gem_handle_create(struct drm_file *file_priv,
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index a24addfdfcec..0de6290df4da 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -68,8 +68,8 @@ struct drm_mm_node {
68 unsigned scanned_preceeds_hole : 1; 68 unsigned scanned_preceeds_hole : 1;
69 unsigned allocated : 1; 69 unsigned allocated : 1;
70 unsigned long color; 70 unsigned long color;
71 unsigned long start; 71 u64 start;
72 unsigned long size; 72 u64 size;
73 struct drm_mm *mm; 73 struct drm_mm *mm;
74}; 74};
75 75
@@ -82,16 +82,16 @@ struct drm_mm {
82 unsigned int scan_check_range : 1; 82 unsigned int scan_check_range : 1;
83 unsigned scan_alignment; 83 unsigned scan_alignment;
84 unsigned long scan_color; 84 unsigned long scan_color;
85 unsigned long scan_size; 85 u64 scan_size;
86 unsigned long scan_hit_start; 86 u64 scan_hit_start;
87 unsigned long scan_hit_end; 87 u64 scan_hit_end;
88 unsigned scanned_blocks; 88 unsigned scanned_blocks;
89 unsigned long scan_start; 89 u64 scan_start;
90 unsigned long scan_end; 90 u64 scan_end;
91 struct drm_mm_node *prev_scanned_node; 91 struct drm_mm_node *prev_scanned_node;
92 92
93 void (*color_adjust)(struct drm_mm_node *node, unsigned long color, 93 void (*color_adjust)(struct drm_mm_node *node, unsigned long color,
94 unsigned long *start, unsigned long *end); 94 u64 *start, u64 *end);
95}; 95};
96 96
97/** 97/**
@@ -124,7 +124,7 @@ static inline bool drm_mm_initialized(struct drm_mm *mm)
124 return mm->hole_stack.next; 124 return mm->hole_stack.next;
125} 125}
126 126
127static inline unsigned long __drm_mm_hole_node_start(struct drm_mm_node *hole_node) 127static inline u64 __drm_mm_hole_node_start(struct drm_mm_node *hole_node)
128{ 128{
129 return hole_node->start + hole_node->size; 129 return hole_node->start + hole_node->size;
130} 130}
@@ -140,13 +140,13 @@ static inline unsigned long __drm_mm_hole_node_start(struct drm_mm_node *hole_no
140 * Returns: 140 * Returns:
141 * Start of the subsequent hole. 141 * Start of the subsequent hole.
142 */ 142 */
143static inline unsigned long drm_mm_hole_node_start(struct drm_mm_node *hole_node) 143static inline u64 drm_mm_hole_node_start(struct drm_mm_node *hole_node)
144{ 144{
145 BUG_ON(!hole_node->hole_follows); 145 BUG_ON(!hole_node->hole_follows);
146 return __drm_mm_hole_node_start(hole_node); 146 return __drm_mm_hole_node_start(hole_node);
147} 147}
148 148
149static inline unsigned long __drm_mm_hole_node_end(struct drm_mm_node *hole_node) 149static inline u64 __drm_mm_hole_node_end(struct drm_mm_node *hole_node)
150{ 150{
151 return list_entry(hole_node->node_list.next, 151 return list_entry(hole_node->node_list.next,
152 struct drm_mm_node, node_list)->start; 152 struct drm_mm_node, node_list)->start;
@@ -163,7 +163,7 @@ static inline unsigned long __drm_mm_hole_node_end(struct drm_mm_node *hole_node
163 * Returns: 163 * Returns:
164 * End of the subsequent hole. 164 * End of the subsequent hole.
165 */ 165 */
166static inline unsigned long drm_mm_hole_node_end(struct drm_mm_node *hole_node) 166static inline u64 drm_mm_hole_node_end(struct drm_mm_node *hole_node)
167{ 167{
168 return __drm_mm_hole_node_end(hole_node); 168 return __drm_mm_hole_node_end(hole_node);
169} 169}
@@ -222,7 +222,7 @@ int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node);
222 222
223int drm_mm_insert_node_generic(struct drm_mm *mm, 223int drm_mm_insert_node_generic(struct drm_mm *mm,
224 struct drm_mm_node *node, 224 struct drm_mm_node *node,
225 unsigned long size, 225 u64 size,
226 unsigned alignment, 226 unsigned alignment,
227 unsigned long color, 227 unsigned long color,
228 enum drm_mm_search_flags sflags, 228 enum drm_mm_search_flags sflags,
@@ -245,7 +245,7 @@ int drm_mm_insert_node_generic(struct drm_mm *mm,
245 */ 245 */
246static inline int drm_mm_insert_node(struct drm_mm *mm, 246static inline int drm_mm_insert_node(struct drm_mm *mm,
247 struct drm_mm_node *node, 247 struct drm_mm_node *node,
248 unsigned long size, 248 u64 size,
249 unsigned alignment, 249 unsigned alignment,
250 enum drm_mm_search_flags flags) 250 enum drm_mm_search_flags flags)
251{ 251{
@@ -255,11 +255,11 @@ static inline int drm_mm_insert_node(struct drm_mm *mm,
255 255
256int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, 256int drm_mm_insert_node_in_range_generic(struct drm_mm *mm,
257 struct drm_mm_node *node, 257 struct drm_mm_node *node,
258 unsigned long size, 258 u64 size,
259 unsigned alignment, 259 unsigned alignment,
260 unsigned long color, 260 unsigned long color,
261 unsigned long start, 261 u64 start,
262 unsigned long end, 262 u64 end,
263 enum drm_mm_search_flags sflags, 263 enum drm_mm_search_flags sflags,
264 enum drm_mm_allocator_flags aflags); 264 enum drm_mm_allocator_flags aflags);
265/** 265/**
@@ -282,10 +282,10 @@ int drm_mm_insert_node_in_range_generic(struct drm_mm *mm,
282 */ 282 */
283static inline int drm_mm_insert_node_in_range(struct drm_mm *mm, 283static inline int drm_mm_insert_node_in_range(struct drm_mm *mm,
284 struct drm_mm_node *node, 284 struct drm_mm_node *node,
285 unsigned long size, 285 u64 size,
286 unsigned alignment, 286 unsigned alignment,
287 unsigned long start, 287 u64 start,
288 unsigned long end, 288 u64 end,
289 enum drm_mm_search_flags flags) 289 enum drm_mm_search_flags flags)
290{ 290{
291 return drm_mm_insert_node_in_range_generic(mm, node, size, alignment, 291 return drm_mm_insert_node_in_range_generic(mm, node, size, alignment,
@@ -296,21 +296,21 @@ static inline int drm_mm_insert_node_in_range(struct drm_mm *mm,
296void drm_mm_remove_node(struct drm_mm_node *node); 296void drm_mm_remove_node(struct drm_mm_node *node);
297void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); 297void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new);
298void drm_mm_init(struct drm_mm *mm, 298void drm_mm_init(struct drm_mm *mm,
299 unsigned long start, 299 u64 start,
300 unsigned long size); 300 u64 size);
301void drm_mm_takedown(struct drm_mm *mm); 301void drm_mm_takedown(struct drm_mm *mm);
302bool drm_mm_clean(struct drm_mm *mm); 302bool drm_mm_clean(struct drm_mm *mm);
303 303
304void drm_mm_init_scan(struct drm_mm *mm, 304void drm_mm_init_scan(struct drm_mm *mm,
305 unsigned long size, 305 u64 size,
306 unsigned alignment, 306 unsigned alignment,
307 unsigned long color); 307 unsigned long color);
308void drm_mm_init_scan_with_range(struct drm_mm *mm, 308void drm_mm_init_scan_with_range(struct drm_mm *mm,
309 unsigned long size, 309 u64 size,
310 unsigned alignment, 310 unsigned alignment,
311 unsigned long color, 311 unsigned long color,
312 unsigned long start, 312 u64 start,
313 unsigned long end); 313 u64 end);
314bool drm_mm_scan_add_block(struct drm_mm_node *node); 314bool drm_mm_scan_add_block(struct drm_mm_node *node);
315bool drm_mm_scan_remove_block(struct drm_mm_node *node); 315bool drm_mm_scan_remove_block(struct drm_mm_node *node);
316 316
diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
index d92f6dd1fb11..0616188c7801 100644
--- a/include/drm/drm_modes.h
+++ b/include/drm/drm_modes.h
@@ -92,7 +92,7 @@ enum drm_mode_status {
92#define CRTC_STEREO_DOUBLE (1 << 1) /* adjust timings for stereo modes */ 92#define CRTC_STEREO_DOUBLE (1 << 1) /* adjust timings for stereo modes */
93#define CRTC_NO_DBLSCAN (1 << 2) /* don't adjust doublescan */ 93#define CRTC_NO_DBLSCAN (1 << 2) /* don't adjust doublescan */
94#define CRTC_NO_VSCAN (1 << 3) /* don't adjust doublescan */ 94#define CRTC_NO_VSCAN (1 << 3) /* don't adjust doublescan */
95#define CRTC_STEREO_DOUBLE_ONLY (CRTC_NO_DBLSCAN | CRTC_NO_VSCAN) 95#define CRTC_STEREO_DOUBLE_ONLY (CRTC_STEREO_DOUBLE | CRTC_NO_DBLSCAN | CRTC_NO_VSCAN)
96 96
97#define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF 97#define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
98 98
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 1fbcc96063a7..13ff44b28893 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -29,6 +29,7 @@
29struct drm_connector; 29struct drm_connector;
30struct drm_device; 30struct drm_device;
31struct drm_panel; 31struct drm_panel;
32struct display_timing;
32 33
33/** 34/**
34 * struct drm_panel_funcs - perform operations on a given panel 35 * struct drm_panel_funcs - perform operations on a given panel
@@ -38,6 +39,8 @@ struct drm_panel;
38 * @enable: enable panel (turn on back light, etc.) 39 * @enable: enable panel (turn on back light, etc.)
39 * @get_modes: add modes to the connector that the panel is attached to and 40 * @get_modes: add modes to the connector that the panel is attached to and
40 * return the number of modes added 41 * return the number of modes added
42 * @get_timings: copy display timings into the provided array and return
43 * the number of display timings available
41 * 44 *
42 * The .prepare() function is typically called before the display controller 45 * The .prepare() function is typically called before the display controller
43 * starts to transmit video data. Panel drivers can use this to turn the panel 46 * starts to transmit video data. Panel drivers can use this to turn the panel
@@ -68,6 +71,8 @@ struct drm_panel_funcs {
68 int (*prepare)(struct drm_panel *panel); 71 int (*prepare)(struct drm_panel *panel);
69 int (*enable)(struct drm_panel *panel); 72 int (*enable)(struct drm_panel *panel);
70 int (*get_modes)(struct drm_panel *panel); 73 int (*get_modes)(struct drm_panel *panel);
74 int (*get_timings)(struct drm_panel *panel, unsigned int num_timings,
75 struct display_timing *timings);
71}; 76};
72 77
73struct drm_panel { 78struct drm_panel {
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
index 31c11d36fae6..96e16283afb9 100644
--- a/include/drm/drm_plane_helper.h
+++ b/include/drm/drm_plane_helper.h
@@ -59,9 +59,11 @@ extern int drm_crtc_init(struct drm_device *dev,
59 */ 59 */
60struct drm_plane_helper_funcs { 60struct drm_plane_helper_funcs {
61 int (*prepare_fb)(struct drm_plane *plane, 61 int (*prepare_fb)(struct drm_plane *plane,
62 struct drm_framebuffer *fb); 62 struct drm_framebuffer *fb,
63 const struct drm_plane_state *new_state);
63 void (*cleanup_fb)(struct drm_plane *plane, 64 void (*cleanup_fb)(struct drm_plane *plane,
64 struct drm_framebuffer *fb); 65 struct drm_framebuffer *fb,
66 const struct drm_plane_state *old_state);
65 67
66 int (*atomic_check)(struct drm_plane *plane, 68 int (*atomic_check)(struct drm_plane *plane,
67 struct drm_plane_state *state); 69 struct drm_plane_state *state);
@@ -74,7 +76,7 @@ struct drm_plane_helper_funcs {
74static inline void drm_plane_helper_add(struct drm_plane *plane, 76static inline void drm_plane_helper_add(struct drm_plane *plane,
75 const struct drm_plane_helper_funcs *funcs) 77 const struct drm_plane_helper_funcs *funcs)
76{ 78{
77 plane->helper_private = (void *)funcs; 79 plane->helper_private = funcs;
78} 80}
79 81
80extern int drm_plane_helper_check_update(struct drm_plane *plane, 82extern int drm_plane_helper_check_update(struct drm_plane *plane,
@@ -98,10 +100,6 @@ extern int drm_primary_helper_update(struct drm_plane *plane,
98extern int drm_primary_helper_disable(struct drm_plane *plane); 100extern int drm_primary_helper_disable(struct drm_plane *plane);
99extern void drm_primary_helper_destroy(struct drm_plane *plane); 101extern void drm_primary_helper_destroy(struct drm_plane *plane);
100extern const struct drm_plane_funcs drm_primary_helper_funcs; 102extern const struct drm_plane_funcs drm_primary_helper_funcs;
101extern struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,
102 const uint32_t *formats,
103 int num_formats);
104
105 103
106int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, 104int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
107 struct drm_framebuffer *fb, 105 struct drm_framebuffer *fb,
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h
index 180ad0e6de21..613372375ada 100644
--- a/include/drm/i915_pciids.h
+++ b/include/drm/i915_pciids.h
@@ -208,40 +208,41 @@
208#define INTEL_VLV_D_IDS(info) \ 208#define INTEL_VLV_D_IDS(info) \
209 INTEL_VGA_DEVICE(0x0155, info) 209 INTEL_VGA_DEVICE(0x0155, info)
210 210
211#define _INTEL_BDW_M(gt, id, info) \ 211#define INTEL_BDW_GT12M_IDS(info) \
212 INTEL_VGA_DEVICE((((gt) - 1) << 4) | (id), info) 212 INTEL_VGA_DEVICE(0x1602, info), /* GT1 ULT */ \
213#define _INTEL_BDW_D(gt, id, info) \ 213 INTEL_VGA_DEVICE(0x1606, info), /* GT1 ULT */ \
214 INTEL_VGA_DEVICE((((gt) - 1) << 4) | (id), info) 214 INTEL_VGA_DEVICE(0x160B, info), /* GT1 Iris */ \
215 215 INTEL_VGA_DEVICE(0x160E, info), /* GT1 ULX */ \
216#define _INTEL_BDW_M_IDS(gt, info) \ 216 INTEL_VGA_DEVICE(0x1612, info), /* GT2 Halo */ \
217 _INTEL_BDW_M(gt, 0x1602, info), /* ULT */ \ 217 INTEL_VGA_DEVICE(0x1616, info), /* GT2 ULT */ \
218 _INTEL_BDW_M(gt, 0x1606, info), /* ULT */ \ 218 INTEL_VGA_DEVICE(0x161B, info), /* GT2 ULT */ \
219 _INTEL_BDW_M(gt, 0x160B, info), /* Iris */ \ 219 INTEL_VGA_DEVICE(0x161E, info) /* GT2 ULX */
220 _INTEL_BDW_M(gt, 0x160E, info) /* ULX */
221
222#define _INTEL_BDW_D_IDS(gt, info) \
223 _INTEL_BDW_D(gt, 0x160A, info), /* Server */ \
224 _INTEL_BDW_D(gt, 0x160D, info) /* Workstation */
225
226#define INTEL_BDW_GT12M_IDS(info) \
227 _INTEL_BDW_M_IDS(1, info), \
228 _INTEL_BDW_M_IDS(2, info)
229 220
230#define INTEL_BDW_GT12D_IDS(info) \ 221#define INTEL_BDW_GT12D_IDS(info) \
231 _INTEL_BDW_D_IDS(1, info), \ 222 INTEL_VGA_DEVICE(0x160A, info), /* GT1 Server */ \
232 _INTEL_BDW_D_IDS(2, info) 223 INTEL_VGA_DEVICE(0x160D, info), /* GT1 Workstation */ \
224 INTEL_VGA_DEVICE(0x161A, info), /* GT2 Server */ \
225 INTEL_VGA_DEVICE(0x161D, info) /* GT2 Workstation */
233 226
234#define INTEL_BDW_GT3M_IDS(info) \ 227#define INTEL_BDW_GT3M_IDS(info) \
235 _INTEL_BDW_M_IDS(3, info) 228 INTEL_VGA_DEVICE(0x1622, info), /* ULT */ \
229 INTEL_VGA_DEVICE(0x1626, info), /* ULT */ \
230 INTEL_VGA_DEVICE(0x162B, info), /* Iris */ \
231 INTEL_VGA_DEVICE(0x162E, info) /* ULX */
236 232
237#define INTEL_BDW_GT3D_IDS(info) \ 233#define INTEL_BDW_GT3D_IDS(info) \
238 _INTEL_BDW_D_IDS(3, info) 234 INTEL_VGA_DEVICE(0x162A, info), /* Server */ \
235 INTEL_VGA_DEVICE(0x162D, info) /* Workstation */
239 236
240#define INTEL_BDW_RSVDM_IDS(info) \ 237#define INTEL_BDW_RSVDM_IDS(info) \
241 _INTEL_BDW_M_IDS(4, info) 238 INTEL_VGA_DEVICE(0x1632, info), /* ULT */ \
239 INTEL_VGA_DEVICE(0x1636, info), /* ULT */ \
240 INTEL_VGA_DEVICE(0x163B, info), /* Iris */ \
241 INTEL_VGA_DEVICE(0x163E, info) /* ULX */
242 242
243#define INTEL_BDW_RSVDD_IDS(info) \ 243#define INTEL_BDW_RSVDD_IDS(info) \
244 _INTEL_BDW_D_IDS(4, info) 244 INTEL_VGA_DEVICE(0x163A, info), /* Server */ \
245 INTEL_VGA_DEVICE(0x163D, info) /* Workstation */
245 246
246#define INTEL_BDW_M_IDS(info) \ 247#define INTEL_BDW_M_IDS(info) \
247 INTEL_BDW_GT12M_IDS(info), \ 248 INTEL_BDW_GT12M_IDS(info), \
@@ -259,21 +260,31 @@
259 INTEL_VGA_DEVICE(0x22b2, info), \ 260 INTEL_VGA_DEVICE(0x22b2, info), \
260 INTEL_VGA_DEVICE(0x22b3, info) 261 INTEL_VGA_DEVICE(0x22b3, info)
261 262
262#define INTEL_SKL_IDS(info) \ 263#define INTEL_SKL_GT1_IDS(info) \
263 INTEL_VGA_DEVICE(0x1916, info), /* ULT GT2 */ \
264 INTEL_VGA_DEVICE(0x1906, info), /* ULT GT1 */ \ 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 */ \ 265 INTEL_VGA_DEVICE(0x190E, info), /* ULX GT1 */ \
266 INTEL_VGA_DEVICE(0x1902, info), /* DT GT1 */ \
267 INTEL_VGA_DEVICE(0x190B, info), /* Halo GT1 */ \
268 INTEL_VGA_DEVICE(0x190A, info) /* SRV GT1 */
269
270#define INTEL_SKL_GT2_IDS(info) \
271 INTEL_VGA_DEVICE(0x1916, info), /* ULT GT2 */ \
272 INTEL_VGA_DEVICE(0x1921, info), /* ULT GT2F */ \
268 INTEL_VGA_DEVICE(0x191E, info), /* ULX GT2 */ \ 273 INTEL_VGA_DEVICE(0x191E, info), /* ULX GT2 */ \
269 INTEL_VGA_DEVICE(0x1912, info), /* DT GT2 */ \ 274 INTEL_VGA_DEVICE(0x1912, info), /* DT GT2 */ \
270 INTEL_VGA_DEVICE(0x1902, info), /* DT GT1 */ \
271 INTEL_VGA_DEVICE(0x191B, info), /* Halo GT2 */ \ 275 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 */ \ 276 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 */ 277 INTEL_VGA_DEVICE(0x191D, info) /* WKS GT2 */
278 278
279#define INTEL_SKL_GT3_IDS(info) \
280 INTEL_VGA_DEVICE(0x1926, info), /* ULT GT3 */ \
281 INTEL_VGA_DEVICE(0x192B, info), /* Halo GT3 */ \
282 INTEL_VGA_DEVICE(0x192A, info) /* SRV GT3 */ \
283
284#define INTEL_SKL_IDS(info) \
285 INTEL_SKL_GT1_IDS(info), \
286 INTEL_SKL_GT2_IDS(info), \
287 INTEL_SKL_GT3_IDS(info)
288
289
279#endif /* _I915_PCIIDS_H */ 290#endif /* _I915_PCIIDS_H */
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 0ccf7f267ff9..c768ddfbe53c 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -249,7 +249,7 @@ struct ttm_buffer_object {
249 * either of these locks held. 249 * either of these locks held.
250 */ 250 */
251 251
252 unsigned long offset; 252 uint64_t offset; /* GPU address space is independent of CPU word size */
253 uint32_t cur_placement; 253 uint32_t cur_placement;
254 254
255 struct sg_table *sg; 255 struct sg_table *sg;
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 142d752fc450..813042cede57 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -277,7 +277,7 @@ struct ttm_mem_type_manager {
277 bool has_type; 277 bool has_type;
278 bool use_type; 278 bool use_type;
279 uint32_t flags; 279 uint32_t flags;
280 unsigned long gpu_offset; 280 uint64_t gpu_offset; /* GPU address space is independent of CPU word size */
281 uint64_t size; 281 uint64_t size;
282 uint32_t available_caching; 282 uint32_t available_caching;
283 uint32_t default_caching; 283 uint32_t default_caching;
diff --git a/include/dt-bindings/clock/exynos3250.h b/include/dt-bindings/clock/exynos3250.h
index 961b9c130ea9..aab088d30199 100644
--- a/include/dt-bindings/clock/exynos3250.h
+++ b/include/dt-bindings/clock/exynos3250.h
@@ -282,4 +282,65 @@
282 */ 282 */
283#define NR_CLKS_DMC 21 283#define NR_CLKS_DMC 21
284 284
285/*
286 * CMU ISP
287 */
288
289/* Dividers */
290
291#define CLK_DIV_ISP1 1
292#define CLK_DIV_ISP0 2
293#define CLK_DIV_MCUISP1 3
294#define CLK_DIV_MCUISP0 4
295#define CLK_DIV_MPWM 5
296
297/* Gates */
298
299#define CLK_UART_ISP 8
300#define CLK_WDT_ISP 9
301#define CLK_PWM_ISP 10
302#define CLK_I2C1_ISP 11
303#define CLK_I2C0_ISP 12
304#define CLK_MPWM_ISP 13
305#define CLK_MCUCTL_ISP 14
306#define CLK_PPMUISPX 15
307#define CLK_PPMUISPMX 16
308#define CLK_QE_LITE1 17
309#define CLK_QE_LITE0 18
310#define CLK_QE_FD 19
311#define CLK_QE_DRC 20
312#define CLK_QE_ISP 21
313#define CLK_CSIS1 22
314#define CLK_SMMU_LITE1 23
315#define CLK_SMMU_LITE0 24
316#define CLK_SMMU_FD 25
317#define CLK_SMMU_DRC 26
318#define CLK_SMMU_ISP 27
319#define CLK_GICISP 28
320#define CLK_CSIS0 29
321#define CLK_MCUISP 30
322#define CLK_LITE1 31
323#define CLK_LITE0 32
324#define CLK_FD 33
325#define CLK_DRC 34
326#define CLK_ISP 35
327#define CLK_QE_ISPCX 36
328#define CLK_QE_SCALERP 37
329#define CLK_QE_SCALERC 38
330#define CLK_SMMU_SCALERP 39
331#define CLK_SMMU_SCALERC 40
332#define CLK_SCALERP 41
333#define CLK_SCALERC 42
334#define CLK_SPI1_ISP 43
335#define CLK_SPI0_ISP 44
336#define CLK_SMMU_ISPCX 45
337#define CLK_ASYNCAXIM 46
338#define CLK_SCLK_MPWM_ISP 47
339
340/*
341 * Total number of clocks of CMU_ISP.
342 * NOTE: Must be equal to last clock ID increased by one.
343 */
344#define NR_CLKS_ISP 48
345
285#endif /* _DT_BINDINGS_CLOCK_SAMSUNG_EXYNOS3250_CLOCK_H */ 346#endif /* _DT_BINDINGS_CLOCK_SAMSUNG_EXYNOS3250_CLOCK_H */
diff --git a/include/dt-bindings/clock/exynos5433.h b/include/dt-bindings/clock/exynos5433.h
new file mode 100644
index 000000000000..5bd80d5ecd0f
--- /dev/null
+++ b/include/dt-bindings/clock/exynos5433.h
@@ -0,0 +1,1403 @@
1/*
2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 * Author: Chanwoo Choi <cw00.choi@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef _DT_BINDINGS_CLOCK_EXYNOS5433_H
11#define _DT_BINDINGS_CLOCK_EXYNOS5433_H
12
13/* CMU_TOP */
14#define CLK_FOUT_ISP_PLL 1
15#define CLK_FOUT_AUD_PLL 2
16
17#define CLK_MOUT_AUD_PLL 10
18#define CLK_MOUT_ISP_PLL 11
19#define CLK_MOUT_AUD_PLL_USER_T 12
20#define CLK_MOUT_MPHY_PLL_USER 13
21#define CLK_MOUT_MFC_PLL_USER 14
22#define CLK_MOUT_BUS_PLL_USER 15
23#define CLK_MOUT_ACLK_HEVC_400 16
24#define CLK_MOUT_ACLK_CAM1_333 17
25#define CLK_MOUT_ACLK_CAM1_552_B 18
26#define CLK_MOUT_ACLK_CAM1_552_A 19
27#define CLK_MOUT_ACLK_ISP_DIS_400 20
28#define CLK_MOUT_ACLK_ISP_400 21
29#define CLK_MOUT_ACLK_BUS0_400 22
30#define CLK_MOUT_ACLK_MSCL_400_B 23
31#define CLK_MOUT_ACLK_MSCL_400_A 24
32#define CLK_MOUT_ACLK_GSCL_333 25
33#define CLK_MOUT_ACLK_G2D_400_B 26
34#define CLK_MOUT_ACLK_G2D_400_A 27
35#define CLK_MOUT_SCLK_JPEG_C 28
36#define CLK_MOUT_SCLK_JPEG_B 29
37#define CLK_MOUT_SCLK_JPEG_A 30
38#define CLK_MOUT_SCLK_MMC2_B 31
39#define CLK_MOUT_SCLK_MMC2_A 32
40#define CLK_MOUT_SCLK_MMC1_B 33
41#define CLK_MOUT_SCLK_MMC1_A 34
42#define CLK_MOUT_SCLK_MMC0_D 35
43#define CLK_MOUT_SCLK_MMC0_C 36
44#define CLK_MOUT_SCLK_MMC0_B 37
45#define CLK_MOUT_SCLK_MMC0_A 38
46#define CLK_MOUT_SCLK_SPI4 39
47#define CLK_MOUT_SCLK_SPI3 40
48#define CLK_MOUT_SCLK_UART2 41
49#define CLK_MOUT_SCLK_UART1 42
50#define CLK_MOUT_SCLK_UART0 43
51#define CLK_MOUT_SCLK_SPI2 44
52#define CLK_MOUT_SCLK_SPI1 45
53#define CLK_MOUT_SCLK_SPI0 46
54#define CLK_MOUT_ACLK_MFC_400_C 47
55#define CLK_MOUT_ACLK_MFC_400_B 48
56#define CLK_MOUT_ACLK_MFC_400_A 49
57#define CLK_MOUT_SCLK_ISP_SENSOR2 50
58#define CLK_MOUT_SCLK_ISP_SENSOR1 51
59#define CLK_MOUT_SCLK_ISP_SENSOR0 52
60#define CLK_MOUT_SCLK_ISP_UART 53
61#define CLK_MOUT_SCLK_ISP_SPI1 54
62#define CLK_MOUT_SCLK_ISP_SPI0 55
63#define CLK_MOUT_SCLK_PCIE_100 56
64#define CLK_MOUT_SCLK_UFSUNIPRO 57
65#define CLK_MOUT_SCLK_USBHOST30 58
66#define CLK_MOUT_SCLK_USBDRD30 59
67#define CLK_MOUT_SCLK_SLIMBUS 60
68#define CLK_MOUT_SCLK_SPDIF 61
69#define CLK_MOUT_SCLK_AUDIO1 62
70#define CLK_MOUT_SCLK_AUDIO0 63
71#define CLK_MOUT_SCLK_HDMI_SPDIF 64
72
73#define CLK_DIV_ACLK_FSYS_200 100
74#define CLK_DIV_ACLK_IMEM_SSSX_266 101
75#define CLK_DIV_ACLK_IMEM_200 102
76#define CLK_DIV_ACLK_IMEM_266 103
77#define CLK_DIV_ACLK_PERIC_66_B 104
78#define CLK_DIV_ACLK_PERIC_66_A 105
79#define CLK_DIV_ACLK_PERIS_66_B 106
80#define CLK_DIV_ACLK_PERIS_66_A 107
81#define CLK_DIV_SCLK_MMC1_B 108
82#define CLK_DIV_SCLK_MMC1_A 109
83#define CLK_DIV_SCLK_MMC0_B 110
84#define CLK_DIV_SCLK_MMC0_A 111
85#define CLK_DIV_SCLK_MMC2_B 112
86#define CLK_DIV_SCLK_MMC2_A 113
87#define CLK_DIV_SCLK_SPI1_B 114
88#define CLK_DIV_SCLK_SPI1_A 115
89#define CLK_DIV_SCLK_SPI0_B 116
90#define CLK_DIV_SCLK_SPI0_A 117
91#define CLK_DIV_SCLK_SPI2_B 118
92#define CLK_DIV_SCLK_SPI2_A 119
93#define CLK_DIV_SCLK_UART2 120
94#define CLK_DIV_SCLK_UART1 121
95#define CLK_DIV_SCLK_UART0 122
96#define CLK_DIV_SCLK_SPI4_B 123
97#define CLK_DIV_SCLK_SPI4_A 124
98#define CLK_DIV_SCLK_SPI3_B 125
99#define CLK_DIV_SCLK_SPI3_A 126
100#define CLK_DIV_SCLK_I2S1 127
101#define CLK_DIV_SCLK_PCM1 128
102#define CLK_DIV_SCLK_AUDIO1 129
103#define CLK_DIV_SCLK_AUDIO0 130
104#define CLK_DIV_ACLK_GSCL_111 131
105#define CLK_DIV_ACLK_GSCL_333 132
106#define CLK_DIV_ACLK_HEVC_400 133
107#define CLK_DIV_ACLK_MFC_400 134
108#define CLK_DIV_ACLK_G2D_266 135
109#define CLK_DIV_ACLK_G2D_400 136
110#define CLK_DIV_ACLK_G3D_400 137
111#define CLK_DIV_ACLK_BUS0_400 138
112#define CLK_DIV_ACLK_BUS1_400 139
113#define CLK_DIV_SCLK_PCIE_100 140
114#define CLK_DIV_SCLK_USBHOST30 141
115#define CLK_DIV_SCLK_UFSUNIPRO 142
116#define CLK_DIV_SCLK_USBDRD30 143
117#define CLK_DIV_SCLK_JPEG 144
118#define CLK_DIV_ACLK_MSCL_400 145
119#define CLK_DIV_ACLK_ISP_DIS_400 146
120#define CLK_DIV_ACLK_ISP_400 147
121#define CLK_DIV_ACLK_CAM0_333 148
122#define CLK_DIV_ACLK_CAM0_400 149
123#define CLK_DIV_ACLK_CAM0_552 150
124#define CLK_DIV_ACLK_CAM1_333 151
125#define CLK_DIV_ACLK_CAM1_400 152
126#define CLK_DIV_ACLK_CAM1_552 153
127#define CLK_DIV_SCLK_ISP_UART 154
128#define CLK_DIV_SCLK_ISP_SPI1_B 155
129#define CLK_DIV_SCLK_ISP_SPI1_A 156
130#define CLK_DIV_SCLK_ISP_SPI0_B 157
131#define CLK_DIV_SCLK_ISP_SPI0_A 158
132#define CLK_DIV_SCLK_ISP_SENSOR2_B 159
133#define CLK_DIV_SCLK_ISP_SENSOR2_A 160
134#define CLK_DIV_SCLK_ISP_SENSOR1_B 161
135#define CLK_DIV_SCLK_ISP_SENSOR1_A 162
136#define CLK_DIV_SCLK_ISP_SENSOR0_B 163
137#define CLK_DIV_SCLK_ISP_SENSOR0_A 164
138
139#define CLK_ACLK_PERIC_66 200
140#define CLK_ACLK_PERIS_66 201
141#define CLK_ACLK_FSYS_200 202
142#define CLK_SCLK_MMC2_FSYS 203
143#define CLK_SCLK_MMC1_FSYS 204
144#define CLK_SCLK_MMC0_FSYS 205
145#define CLK_SCLK_SPI4_PERIC 206
146#define CLK_SCLK_SPI3_PERIC 207
147#define CLK_SCLK_UART2_PERIC 208
148#define CLK_SCLK_UART1_PERIC 209
149#define CLK_SCLK_UART0_PERIC 210
150#define CLK_SCLK_SPI2_PERIC 211
151#define CLK_SCLK_SPI1_PERIC 212
152#define CLK_SCLK_SPI0_PERIC 213
153#define CLK_SCLK_SPDIF_PERIC 214
154#define CLK_SCLK_I2S1_PERIC 215
155#define CLK_SCLK_PCM1_PERIC 216
156#define CLK_SCLK_SLIMBUS 217
157#define CLK_SCLK_AUDIO1 218
158#define CLK_SCLK_AUDIO0 219
159#define CLK_ACLK_G2D_266 220
160#define CLK_ACLK_G2D_400 221
161#define CLK_ACLK_G3D_400 222
162#define CLK_ACLK_IMEM_SSX_266 223
163#define CLK_ACLK_BUS0_400 224
164#define CLK_ACLK_BUS1_400 225
165#define CLK_ACLK_IMEM_200 226
166#define CLK_ACLK_IMEM_266 227
167#define CLK_SCLK_PCIE_100_FSYS 228
168#define CLK_SCLK_UFSUNIPRO_FSYS 229
169#define CLK_SCLK_USBHOST30_FSYS 230
170#define CLK_SCLK_USBDRD30_FSYS 231
171#define CLK_ACLK_GSCL_111 232
172#define CLK_ACLK_GSCL_333 233
173#define CLK_SCLK_JPEG_MSCL 234
174#define CLK_ACLK_MSCL_400 235
175#define CLK_ACLK_MFC_400 236
176#define CLK_ACLK_HEVC_400 237
177#define CLK_ACLK_ISP_DIS_400 238
178#define CLK_ACLK_ISP_400 239
179#define CLK_ACLK_CAM0_333 240
180#define CLK_ACLK_CAM0_400 241
181#define CLK_ACLK_CAM0_552 242
182#define CLK_ACLK_CAM1_333 243
183#define CLK_ACLK_CAM1_400 244
184#define CLK_ACLK_CAM1_552 245
185#define CLK_SCLK_ISP_SENSOR2 246
186#define CLK_SCLK_ISP_SENSOR1 247
187#define CLK_SCLK_ISP_SENSOR0 248
188#define CLK_SCLK_ISP_MCTADC_CAM1 249
189#define CLK_SCLK_ISP_UART_CAM1 250
190#define CLK_SCLK_ISP_SPI1_CAM1 251
191#define CLK_SCLK_ISP_SPI0_CAM1 252
192#define CLK_SCLK_HDMI_SPDIF_DISP 253
193
194#define TOP_NR_CLK 254
195
196/* CMU_CPIF */
197#define CLK_FOUT_MPHY_PLL 1
198
199#define CLK_MOUT_MPHY_PLL 2
200
201#define CLK_DIV_SCLK_MPHY 10
202
203#define CLK_SCLK_MPHY_PLL 11
204#define CLK_SCLK_UFS_MPHY 11
205
206#define CPIF_NR_CLK 12
207
208/* CMU_MIF */
209#define CLK_FOUT_MEM0_PLL 1
210#define CLK_FOUT_MEM1_PLL 2
211#define CLK_FOUT_BUS_PLL 3
212#define CLK_FOUT_MFC_PLL 4
213#define CLK_DOUT_MFC_PLL 5
214#define CLK_DOUT_BUS_PLL 6
215#define CLK_DOUT_MEM1_PLL 7
216#define CLK_DOUT_MEM0_PLL 8
217
218#define CLK_MOUT_MFC_PLL_DIV2 10
219#define CLK_MOUT_BUS_PLL_DIV2 11
220#define CLK_MOUT_MEM1_PLL_DIV2 12
221#define CLK_MOUT_MEM0_PLL_DIV2 13
222#define CLK_MOUT_MFC_PLL 14
223#define CLK_MOUT_BUS_PLL 15
224#define CLK_MOUT_MEM1_PLL 16
225#define CLK_MOUT_MEM0_PLL 17
226#define CLK_MOUT_CLK2X_PHY_C 18
227#define CLK_MOUT_CLK2X_PHY_B 19
228#define CLK_MOUT_CLK2X_PHY_A 20
229#define CLK_MOUT_CLKM_PHY_C 21
230#define CLK_MOUT_CLKM_PHY_B 22
231#define CLK_MOUT_CLKM_PHY_A 23
232#define CLK_MOUT_ACLK_MIFNM_200 24
233#define CLK_MOUT_ACLK_MIFNM_400 25
234#define CLK_MOUT_ACLK_DISP_333_B 26
235#define CLK_MOUT_ACLK_DISP_333_A 27
236#define CLK_MOUT_SCLK_DECON_VCLK_C 28
237#define CLK_MOUT_SCLK_DECON_VCLK_B 29
238#define CLK_MOUT_SCLK_DECON_VCLK_A 30
239#define CLK_MOUT_SCLK_DECON_ECLK_C 31
240#define CLK_MOUT_SCLK_DECON_ECLK_B 32
241#define CLK_MOUT_SCLK_DECON_ECLK_A 33
242#define CLK_MOUT_SCLK_DECON_TV_ECLK_C 34
243#define CLK_MOUT_SCLK_DECON_TV_ECLK_B 35
244#define CLK_MOUT_SCLK_DECON_TV_ECLK_A 36
245#define CLK_MOUT_SCLK_DSD_C 37
246#define CLK_MOUT_SCLK_DSD_B 38
247#define CLK_MOUT_SCLK_DSD_A 39
248#define CLK_MOUT_SCLK_DSIM0_C 40
249#define CLK_MOUT_SCLK_DSIM0_B 41
250#define CLK_MOUT_SCLK_DSIM0_A 42
251#define CLK_MOUT_SCLK_DECON_TV_VCLK_C 46
252#define CLK_MOUT_SCLK_DECON_TV_VCLK_B 47
253#define CLK_MOUT_SCLK_DECON_TV_VCLK_A 48
254#define CLK_MOUT_SCLK_DSIM1_C 49
255#define CLK_MOUT_SCLK_DSIM1_B 50
256#define CLK_MOUT_SCLK_DSIM1_A 51
257
258#define CLK_DIV_SCLK_HPM_MIF 55
259#define CLK_DIV_ACLK_DREX1 56
260#define CLK_DIV_ACLK_DREX0 57
261#define CLK_DIV_CLK2XPHY 58
262#define CLK_DIV_ACLK_MIF_266 59
263#define CLK_DIV_ACLK_MIFND_133 60
264#define CLK_DIV_ACLK_MIF_133 61
265#define CLK_DIV_ACLK_MIFNM_200 62
266#define CLK_DIV_ACLK_MIF_200 63
267#define CLK_DIV_ACLK_MIF_400 64
268#define CLK_DIV_ACLK_BUS2_400 65
269#define CLK_DIV_ACLK_DISP_333 66
270#define CLK_DIV_ACLK_CPIF_200 67
271#define CLK_DIV_SCLK_DSIM1 68
272#define CLK_DIV_SCLK_DECON_TV_VCLK 69
273#define CLK_DIV_SCLK_DSIM0 70
274#define CLK_DIV_SCLK_DSD 71
275#define CLK_DIV_SCLK_DECON_TV_ECLK 72
276#define CLK_DIV_SCLK_DECON_VCLK 73
277#define CLK_DIV_SCLK_DECON_ECLK 74
278#define CLK_DIV_MIF_PRE 75
279
280#define CLK_CLK2X_PHY1 80
281#define CLK_CLK2X_PHY0 81
282#define CLK_CLKM_PHY1 82
283#define CLK_CLKM_PHY0 83
284#define CLK_RCLK_DREX1 84
285#define CLK_RCLK_DREX0 85
286#define CLK_ACLK_DREX1_TZ 86
287#define CLK_ACLK_DREX0_TZ 87
288#define CLK_ACLK_DREX1_PEREV 88
289#define CLK_ACLK_DREX0_PEREV 89
290#define CLK_ACLK_DREX1_MEMIF 90
291#define CLK_ACLK_DREX0_MEMIF 91
292#define CLK_ACLK_DREX1_SCH 92
293#define CLK_ACLK_DREX0_SCH 93
294#define CLK_ACLK_DREX1_BUSIF 94
295#define CLK_ACLK_DREX0_BUSIF 95
296#define CLK_ACLK_DREX1_BUSIF_RD 96
297#define CLK_ACLK_DREX0_BUSIF_RD 97
298#define CLK_ACLK_DREX1 98
299#define CLK_ACLK_DREX0 99
300#define CLK_ACLK_ASYNCAXIM_ATLAS_CCIX 100
301#define CLK_ACLK_ASYNCAXIS_ATLAS_MIF 101
302#define CLK_ACLK_ASYNCAXIM_ATLAS_MIF 102
303#define CLK_ACLK_ASYNCAXIS_MIF_IMEM 103
304#define CLK_ACLK_ASYNCAXIS_NOC_P_CCI 104
305#define CLK_ACLK_ASYNCAXIM_NOC_P_CCI 105
306#define CLK_ACLK_ASYNCAXIS_CP1 106
307#define CLK_ACLK_ASYNCAXIM_CP1 107
308#define CLK_ACLK_ASYNCAXIS_CP0 108
309#define CLK_ACLK_ASYNCAXIM_CP0 109
310#define CLK_ACLK_ASYNCAXIS_DREX1_3 110
311#define CLK_ACLK_ASYNCAXIM_DREX1_3 111
312#define CLK_ACLK_ASYNCAXIS_DREX1_1 112
313#define CLK_ACLK_ASYNCAXIM_DREX1_1 113
314#define CLK_ACLK_ASYNCAXIS_DREX1_0 114
315#define CLK_ACLK_ASYNCAXIM_DREX1_0 115
316#define CLK_ACLK_ASYNCAXIS_DREX0_3 116
317#define CLK_ACLK_ASYNCAXIM_DREX0_3 117
318#define CLK_ACLK_ASYNCAXIS_DREX0_1 118
319#define CLK_ACLK_ASYNCAXIM_DREX0_1 119
320#define CLK_ACLK_ASYNCAXIS_DREX0_0 120
321#define CLK_ACLK_ASYNCAXIM_DREX0_0 121
322#define CLK_ACLK_AHB2APB_MIF2P 122
323#define CLK_ACLK_AHB2APB_MIF1P 123
324#define CLK_ACLK_AHB2APB_MIF0P 124
325#define CLK_ACLK_IXIU_CCI 125
326#define CLK_ACLK_XIU_MIFSFRX 126
327#define CLK_ACLK_MIFNP_133 127
328#define CLK_ACLK_MIFNM_200 128
329#define CLK_ACLK_MIFND_133 129
330#define CLK_ACLK_MIFND_400 130
331#define CLK_ACLK_CCI 131
332#define CLK_ACLK_MIFND_266 132
333#define CLK_ACLK_PPMU_DREX1S3 133
334#define CLK_ACLK_PPMU_DREX1S1 134
335#define CLK_ACLK_PPMU_DREX1S0 135
336#define CLK_ACLK_PPMU_DREX0S3 136
337#define CLK_ACLK_PPMU_DREX0S1 137
338#define CLK_ACLK_PPMU_DREX0S0 138
339#define CLK_ACLK_BTS_APOLLO 139
340#define CLK_ACLK_BTS_ATLAS 140
341#define CLK_ACLK_ACE_SEL_APOLL 141
342#define CLK_ACLK_ACE_SEL_ATLAS 142
343#define CLK_ACLK_AXIDS_CCI_MIFSFRX 143
344#define CLK_ACLK_AXIUS_ATLAS_CCI 144
345#define CLK_ACLK_AXISYNCDNS_CCI 145
346#define CLK_ACLK_AXISYNCDN_CCI 146
347#define CLK_ACLK_AXISYNCDN_NOC_D 147
348#define CLK_ACLK_ASYNCACEM_APOLLO_CCI 148
349#define CLK_ACLK_ASYNCACEM_ATLAS_CCI 149
350#define CLK_ACLK_ASYNCAPBS_MIF_CSSYS 150
351#define CLK_ACLK_BUS2_400 151
352#define CLK_ACLK_DISP_333 152
353#define CLK_ACLK_CPIF_200 153
354#define CLK_PCLK_PPMU_DREX1S3 154
355#define CLK_PCLK_PPMU_DREX1S1 155
356#define CLK_PCLK_PPMU_DREX1S0 156
357#define CLK_PCLK_PPMU_DREX0S3 157
358#define CLK_PCLK_PPMU_DREX0S1 158
359#define CLK_PCLK_PPMU_DREX0S0 159
360#define CLK_PCLK_BTS_APOLLO 160
361#define CLK_PCLK_BTS_ATLAS 161
362#define CLK_PCLK_ASYNCAXI_NOC_P_CCI 162
363#define CLK_PCLK_ASYNCAXI_CP1 163
364#define CLK_PCLK_ASYNCAXI_CP0 164
365#define CLK_PCLK_ASYNCAXI_DREX1_3 165
366#define CLK_PCLK_ASYNCAXI_DREX1_1 166
367#define CLK_PCLK_ASYNCAXI_DREX1_0 167
368#define CLK_PCLK_ASYNCAXI_DREX0_3 168
369#define CLK_PCLK_ASYNCAXI_DREX0_1 169
370#define CLK_PCLK_ASYNCAXI_DREX0_0 170
371#define CLK_PCLK_MIFSRVND_133 171
372#define CLK_PCLK_PMU_MIF 172
373#define CLK_PCLK_SYSREG_MIF 173
374#define CLK_PCLK_GPIO_ALIVE 174
375#define CLK_PCLK_ABB 175
376#define CLK_PCLK_PMU_APBIF 176
377#define CLK_PCLK_DDR_PHY1 177
378#define CLK_PCLK_DREX1 178
379#define CLK_PCLK_DDR_PHY0 179
380#define CLK_PCLK_DREX0 180
381#define CLK_PCLK_DREX0_TZ 181
382#define CLK_PCLK_DREX1_TZ 182
383#define CLK_PCLK_MONOTONIC_CNT 183
384#define CLK_PCLK_RTC 184
385#define CLK_SCLK_DSIM1_DISP 185
386#define CLK_SCLK_DECON_TV_VCLK_DISP 186
387#define CLK_SCLK_FREQ_DET_BUS_PLL 187
388#define CLK_SCLK_FREQ_DET_MFC_PLL 188
389#define CLK_SCLK_FREQ_DET_MEM0_PLL 189
390#define CLK_SCLK_FREQ_DET_MEM1_PLL 190
391#define CLK_SCLK_DSIM0_DISP 191
392#define CLK_SCLK_DSD_DISP 192
393#define CLK_SCLK_DECON_TV_ECLK_DISP 193
394#define CLK_SCLK_DECON_VCLK_DISP 194
395#define CLK_SCLK_DECON_ECLK_DISP 195
396#define CLK_SCLK_HPM_MIF 196
397#define CLK_SCLK_MFC_PLL 197
398#define CLK_SCLK_BUS_PLL 198
399#define CLK_SCLK_BUS_PLL_APOLLO 199
400#define CLK_SCLK_BUS_PLL_ATLAS 200
401
402#define MIF_NR_CLK 201
403
404/* CMU_PERIC */
405#define CLK_PCLK_SPI2 1
406#define CLK_PCLK_SPI1 2
407#define CLK_PCLK_SPI0 3
408#define CLK_PCLK_UART2 4
409#define CLK_PCLK_UART1 5
410#define CLK_PCLK_UART0 6
411#define CLK_PCLK_HSI2C3 7
412#define CLK_PCLK_HSI2C2 8
413#define CLK_PCLK_HSI2C1 9
414#define CLK_PCLK_HSI2C0 10
415#define CLK_PCLK_I2C7 11
416#define CLK_PCLK_I2C6 12
417#define CLK_PCLK_I2C5 13
418#define CLK_PCLK_I2C4 14
419#define CLK_PCLK_I2C3 15
420#define CLK_PCLK_I2C2 16
421#define CLK_PCLK_I2C1 17
422#define CLK_PCLK_I2C0 18
423#define CLK_PCLK_SPI4 19
424#define CLK_PCLK_SPI3 20
425#define CLK_PCLK_HSI2C11 21
426#define CLK_PCLK_HSI2C10 22
427#define CLK_PCLK_HSI2C9 23
428#define CLK_PCLK_HSI2C8 24
429#define CLK_PCLK_HSI2C7 25
430#define CLK_PCLK_HSI2C6 26
431#define CLK_PCLK_HSI2C5 27
432#define CLK_PCLK_HSI2C4 28
433#define CLK_SCLK_SPI4 29
434#define CLK_SCLK_SPI3 30
435#define CLK_SCLK_SPI2 31
436#define CLK_SCLK_SPI1 32
437#define CLK_SCLK_SPI0 33
438#define CLK_SCLK_UART2 34
439#define CLK_SCLK_UART1 35
440#define CLK_SCLK_UART0 36
441#define CLK_ACLK_AHB2APB_PERIC2P 37
442#define CLK_ACLK_AHB2APB_PERIC1P 38
443#define CLK_ACLK_AHB2APB_PERIC0P 39
444#define CLK_ACLK_PERICNP_66 40
445#define CLK_PCLK_SCI 41
446#define CLK_PCLK_GPIO_FINGER 42
447#define CLK_PCLK_GPIO_ESE 43
448#define CLK_PCLK_PWM 44
449#define CLK_PCLK_SPDIF 45
450#define CLK_PCLK_PCM1 46
451#define CLK_PCLK_I2S1 47
452#define CLK_PCLK_ADCIF 48
453#define CLK_PCLK_GPIO_TOUCH 49
454#define CLK_PCLK_GPIO_NFC 50
455#define CLK_PCLK_GPIO_PERIC 51
456#define CLK_PCLK_PMU_PERIC 52
457#define CLK_PCLK_SYSREG_PERIC 53
458#define CLK_SCLK_IOCLK_SPI4 54
459#define CLK_SCLK_IOCLK_SPI3 55
460#define CLK_SCLK_SCI 56
461#define CLK_SCLK_SC_IN 57
462#define CLK_SCLK_PWM 58
463#define CLK_SCLK_IOCLK_SPI2 59
464#define CLK_SCLK_IOCLK_SPI1 60
465#define CLK_SCLK_IOCLK_SPI0 61
466#define CLK_SCLK_IOCLK_I2S1_BCLK 62
467#define CLK_SCLK_SPDIF 63
468#define CLK_SCLK_PCM1 64
469#define CLK_SCLK_I2S1 65
470
471#define CLK_DIV_SCLK_SCI 70
472#define CLK_DIV_SCLK_SC_IN 71
473
474#define PERIC_NR_CLK 72
475
476/* CMU_PERIS */
477#define CLK_PCLK_HPM_APBIF 1
478#define CLK_PCLK_TMU1_APBIF 2
479#define CLK_PCLK_TMU0_APBIF 3
480#define CLK_PCLK_PMU_PERIS 4
481#define CLK_PCLK_SYSREG_PERIS 5
482#define CLK_PCLK_CMU_TOP_APBIF 6
483#define CLK_PCLK_WDT_APOLLO 7
484#define CLK_PCLK_WDT_ATLAS 8
485#define CLK_PCLK_MCT 9
486#define CLK_PCLK_HDMI_CEC 10
487#define CLK_ACLK_AHB2APB_PERIS1P 11
488#define CLK_ACLK_AHB2APB_PERIS0P 12
489#define CLK_ACLK_PERISNP_66 13
490#define CLK_PCLK_TZPC12 14
491#define CLK_PCLK_TZPC11 15
492#define CLK_PCLK_TZPC10 16
493#define CLK_PCLK_TZPC9 17
494#define CLK_PCLK_TZPC8 18
495#define CLK_PCLK_TZPC7 19
496#define CLK_PCLK_TZPC6 20
497#define CLK_PCLK_TZPC5 21
498#define CLK_PCLK_TZPC4 22
499#define CLK_PCLK_TZPC3 23
500#define CLK_PCLK_TZPC2 24
501#define CLK_PCLK_TZPC1 25
502#define CLK_PCLK_TZPC0 26
503#define CLK_PCLK_SECKEY_APBIF 27
504#define CLK_PCLK_CHIPID_APBIF 28
505#define CLK_PCLK_TOPRTC 29
506#define CLK_PCLK_CUSTOM_EFUSE_APBIF 30
507#define CLK_PCLK_ANTIRBK_CNT_APBIF 31
508#define CLK_PCLK_OTP_CON_APBIF 32
509#define CLK_SCLK_ASV_TB 33
510#define CLK_SCLK_TMU1 34
511#define CLK_SCLK_TMU0 35
512#define CLK_SCLK_SECKEY 36
513#define CLK_SCLK_CHIPID 37
514#define CLK_SCLK_TOPRTC 38
515#define CLK_SCLK_CUSTOM_EFUSE 39
516#define CLK_SCLK_ANTIRBK_CNT 40
517#define CLK_SCLK_OTP_CON 41
518
519#define PERIS_NR_CLK 42
520
521/* CMU_FSYS */
522#define CLK_MOUT_ACLK_FSYS_200_USER 1
523#define CLK_MOUT_SCLK_MMC2_USER 2
524#define CLK_MOUT_SCLK_MMC1_USER 3
525#define CLK_MOUT_SCLK_MMC0_USER 4
526#define CLK_MOUT_SCLK_UFS_MPHY_USER 5
527#define CLK_MOUT_SCLK_PCIE_100_USER 6
528#define CLK_MOUT_SCLK_UFSUNIPRO_USER 7
529#define CLK_MOUT_SCLK_USBHOST30_USER 8
530#define CLK_MOUT_SCLK_USBDRD30_USER 9
531#define CLK_MOUT_PHYCLK_USBHOST30_UHOST30_PIPE_PCLK_USER 10
532#define CLK_MOUT_PHYCLK_USBHOST30_UHOST30_PHYCLOCK_USER 11
533#define CLK_MOUT_PHYCLK_USBHOST20_PHY_HSIC1_USER 12
534#define CLK_MOUT_PHYCLK_USBHOST20_PHY_CLK48MOHCI_USER 13
535#define CLK_MOUT_PHYCLK_USBHOST20_PHY_PHYCLOCK_USER 14
536#define CLK_MOUT_PHYCLK_USBHOST20_PHY_PHY_FREECLK_USER 15
537#define CLK_MOUT_PHYCLK_USBDRD30_UDRD30_PIPE_PCLK_USER 16
538#define CLK_MOUT_PHYCLK_USBDRD30_UDRD30_PHYCLOCK_USER 17
539#define CLK_MOUT_PHYCLK_UFS_RX1_SYMBOL_USER 18
540#define CLK_MOUT_PHYCLK_UFS_RX0_SYMBOL_USER 19
541#define CLK_MOUT_PHYCLK_UFS_TX1_SYMBOL_USER 20
542#define CLK_MOUT_PHYCLK_UFS_TX0_SYMBOL_USER 21
543#define CLK_MOUT_PHYCLK_LLI_MPHY_TO_UFS_USER 22
544#define CLK_MOUT_SCLK_MPHY 23
545
546#define CLK_PHYCLK_USBDRD30_UDRD30_PHYCLOCK_PHY 25
547#define CLK_PHYCLK_USBDRD30_UDRD30_PIPE_PCLK_PHY 26
548#define CLK_PHYCLK_USBHOST30_UHOST30_PHYCLOCK_PHY 27
549#define CLK_PHYCLK_USBHOST30_UHOST30_PIPE_PCLK_PHY 28
550#define CLK_PHYCLK_USBHOST20_PHY_FREECLK_PHY 29
551#define CLK_PHYCLK_USBHOST20_PHY_PHYCLOCK_PHY 30
552#define CLK_PHYCLK_USBHOST20_PHY_CLK48MOHCI_PHY 31
553#define CLK_PHYCLK_USBHOST20_PHY_HSIC1_PHY 32
554#define CLK_PHYCLK_UFS_TX0_SYMBOL_PHY 33
555#define CLK_PHYCLK_UFS_RX0_SYMBOL_PHY 34
556#define CLK_PHYCLK_UFS_TX1_SYMBOL_PHY 35
557#define CLK_PHYCLK_UFS_RX1_SYMBOL_PHY 36
558#define CLK_PHYCLK_LLI_MPHY_TO_UFS_PHY 37
559
560#define CLK_ACLK_PCIE 50
561#define CLK_ACLK_PDMA1 51
562#define CLK_ACLK_TSI 52
563#define CLK_ACLK_MMC2 53
564#define CLK_ACLK_MMC1 54
565#define CLK_ACLK_MMC0 55
566#define CLK_ACLK_UFS 56
567#define CLK_ACLK_USBHOST20 57
568#define CLK_ACLK_USBHOST30 58
569#define CLK_ACLK_USBDRD30 59
570#define CLK_ACLK_PDMA0 60
571#define CLK_SCLK_MMC2 61
572#define CLK_SCLK_MMC1 62
573#define CLK_SCLK_MMC0 63
574#define CLK_PDMA1 64
575#define CLK_PDMA0 65
576#define CLK_ACLK_XIU_FSYSPX 66
577#define CLK_ACLK_AHB_USBLINKH1 67
578#define CLK_ACLK_SMMU_PDMA1 68
579#define CLK_ACLK_BTS_PCIE 69
580#define CLK_ACLK_AXIUS_PDMA1 70
581#define CLK_ACLK_SMMU_PDMA0 71
582#define CLK_ACLK_BTS_UFS 72
583#define CLK_ACLK_BTS_USBHOST30 73
584#define CLK_ACLK_BTS_USBDRD30 74
585#define CLK_ACLK_AXIUS_PDMA0 75
586#define CLK_ACLK_AXIUS_USBHS 76
587#define CLK_ACLK_AXIUS_FSYSSX 77
588#define CLK_ACLK_AHB2APB_FSYSP 78
589#define CLK_ACLK_AHB2AXI_USBHS 79
590#define CLK_ACLK_AHB_USBLINKH0 80
591#define CLK_ACLK_AHB_USBHS 81
592#define CLK_ACLK_AHB_FSYSH 82
593#define CLK_ACLK_XIU_FSYSX 83
594#define CLK_ACLK_XIU_FSYSSX 84
595#define CLK_ACLK_FSYSNP_200 85
596#define CLK_ACLK_FSYSND_200 86
597#define CLK_PCLK_PCIE_CTRL 87
598#define CLK_PCLK_SMMU_PDMA1 88
599#define CLK_PCLK_PCIE_PHY 89
600#define CLK_PCLK_BTS_PCIE 90
601#define CLK_PCLK_SMMU_PDMA0 91
602#define CLK_PCLK_BTS_UFS 92
603#define CLK_PCLK_BTS_USBHOST30 93
604#define CLK_PCLK_BTS_USBDRD30 94
605#define CLK_PCLK_GPIO_FSYS 95
606#define CLK_PCLK_PMU_FSYS 96
607#define CLK_PCLK_SYSREG_FSYS 97
608#define CLK_SCLK_PCIE_100 98
609#define CLK_PHYCLK_USBHOST30_UHOST30_PIPE_PCLK 99
610#define CLK_PHYCLK_USBHOST30_UHOST30_PHYCLOCK 100
611#define CLK_PHYCLK_UFS_RX1_SYMBOL 101
612#define CLK_PHYCLK_UFS_RX0_SYMBOL 102
613#define CLK_PHYCLK_UFS_TX1_SYMBOL 103
614#define CLK_PHYCLK_UFS_TX0_SYMBOL 104
615#define CLK_PHYCLK_USBHOST20_PHY_HSIC1 105
616#define CLK_PHYCLK_USBHOST20_PHY_CLK48MOHCI 106
617#define CLK_PHYCLK_USBHOST20_PHY_PHYCLOCK 107
618#define CLK_PHYCLK_USBHOST20_PHY_FREECLK 108
619#define CLK_PHYCLK_USBDRD30_UDRD30_PIPE_PCLK 109
620#define CLK_PHYCLK_USBDRD30_UDRD30_PHYCLOCK 110
621#define CLK_SCLK_MPHY 111
622#define CLK_SCLK_UFSUNIPRO 112
623#define CLK_SCLK_USBHOST30 113
624#define CLK_SCLK_USBDRD30 114
625
626#define FSYS_NR_CLK 115
627
628/* CMU_G2D */
629#define CLK_MUX_ACLK_G2D_266_USER 1
630#define CLK_MUX_ACLK_G2D_400_USER 2
631
632#define CLK_DIV_PCLK_G2D 3
633
634#define CLK_ACLK_SMMU_MDMA1 4
635#define CLK_ACLK_BTS_MDMA1 5
636#define CLK_ACLK_BTS_G2D 6
637#define CLK_ACLK_ALB_G2D 7
638#define CLK_ACLK_AXIUS_G2DX 8
639#define CLK_ACLK_ASYNCAXI_SYSX 9
640#define CLK_ACLK_AHB2APB_G2D1P 10
641#define CLK_ACLK_AHB2APB_G2D0P 11
642#define CLK_ACLK_XIU_G2DX 12
643#define CLK_ACLK_G2DNP_133 13
644#define CLK_ACLK_G2DND_400 14
645#define CLK_ACLK_MDMA1 15
646#define CLK_ACLK_G2D 16
647#define CLK_ACLK_SMMU_G2D 17
648#define CLK_PCLK_SMMU_MDMA1 18
649#define CLK_PCLK_BTS_MDMA1 19
650#define CLK_PCLK_BTS_G2D 20
651#define CLK_PCLK_ALB_G2D 21
652#define CLK_PCLK_ASYNCAXI_SYSX 22
653#define CLK_PCLK_PMU_G2D 23
654#define CLK_PCLK_SYSREG_G2D 24
655#define CLK_PCLK_G2D 25
656#define CLK_PCLK_SMMU_G2D 26
657
658#define G2D_NR_CLK 27
659
660/* CMU_DISP */
661#define CLK_FOUT_DISP_PLL 1
662
663#define CLK_MOUT_DISP_PLL 2
664#define CLK_MOUT_SCLK_DSIM1_USER 3
665#define CLK_MOUT_SCLK_DSIM0_USER 4
666#define CLK_MOUT_SCLK_DSD_USER 5
667#define CLK_MOUT_SCLK_DECON_TV_ECLK_USER 6
668#define CLK_MOUT_SCLK_DECON_VCLK_USER 7
669#define CLK_MOUT_SCLK_DECON_ECLK_USER 8
670#define CLK_MOUT_SCLK_DECON_TV_VCLK_USER 9
671#define CLK_MOUT_ACLK_DISP_333_USER 10
672#define CLK_MOUT_PHYCLK_MIPIDPHY1_BITCLKDIV8_USER 11
673#define CLK_MOUT_PHYCLK_MIPIDPHY1_RXCLKESC0_USER 12
674#define CLK_MOUT_PHYCLK_MIPIDPHY0_BITCLKDIV8_USER 13
675#define CLK_MOUT_PHYCLK_MIPIDPHY0_RXCLKESC0_USER 14
676#define CLK_MOUT_PHYCLK_HDMIPHY_TMDS_CLKO_USER 15
677#define CLK_MOUT_PHYCLK_HDMIPHY_PIXEL_CLKO_USER 16
678#define CLK_MOUT_SCLK_DSIM0 17
679#define CLK_MOUT_SCLK_DECON_TV_ECLK 18
680#define CLK_MOUT_SCLK_DECON_VCLK 19
681#define CLK_MOUT_SCLK_DECON_ECLK 20
682#define CLK_MOUT_SCLK_DSIM1_B_DISP 21
683#define CLK_MOUT_SCLK_DSIM1_A_DISP 22
684#define CLK_MOUT_SCLK_DECON_TV_VCLK_C_DISP 23
685#define CLK_MOUT_SCLK_DECON_TV_VCLK_B_DISP 24
686#define CLK_MOUT_SCLK_DECON_TV_VCLK_A_DISP 25
687
688#define CLK_DIV_SCLK_DSIM1_DISP 30
689#define CLK_DIV_SCLK_DECON_TV_VCLK_DISP 31
690#define CLK_DIV_SCLK_DSIM0_DISP 32
691#define CLK_DIV_SCLK_DECON_TV_ECLK_DISP 33
692#define CLK_DIV_SCLK_DECON_VCLK_DISP 34
693#define CLK_DIV_SCLK_DECON_ECLK_DISP 35
694#define CLK_DIV_PCLK_DISP 36
695
696#define CLK_ACLK_DECON_TV 40
697#define CLK_ACLK_DECON 41
698#define CLK_ACLK_SMMU_TV1X 42
699#define CLK_ACLK_SMMU_TV0X 43
700#define CLK_ACLK_SMMU_DECON1X 44
701#define CLK_ACLK_SMMU_DECON0X 45
702#define CLK_ACLK_BTS_DECON_TV_M3 46
703#define CLK_ACLK_BTS_DECON_TV_M2 47
704#define CLK_ACLK_BTS_DECON_TV_M1 48
705#define CLK_ACLK_BTS_DECON_TV_M0 49
706#define CLK_ACLK_BTS_DECON_NM4 50
707#define CLK_ACLK_BTS_DECON_NM3 51
708#define CLK_ACLK_BTS_DECON_NM2 52
709#define CLK_ACLK_BTS_DECON_NM1 53
710#define CLK_ACLK_BTS_DECON_NM0 54
711#define CLK_ACLK_AHB2APB_DISPSFR2P 55
712#define CLK_ACLK_AHB2APB_DISPSFR1P 56
713#define CLK_ACLK_AHB2APB_DISPSFR0P 57
714#define CLK_ACLK_AHB_DISPH 58
715#define CLK_ACLK_XIU_TV1X 59
716#define CLK_ACLK_XIU_TV0X 60
717#define CLK_ACLK_XIU_DECON1X 61
718#define CLK_ACLK_XIU_DECON0X 62
719#define CLK_ACLK_XIU_DISP1X 63
720#define CLK_ACLK_XIU_DISPNP_100 64
721#define CLK_ACLK_DISP1ND_333 65
722#define CLK_ACLK_DISP0ND_333 66
723#define CLK_PCLK_SMMU_TV1X 67
724#define CLK_PCLK_SMMU_TV0X 68
725#define CLK_PCLK_SMMU_DECON1X 69
726#define CLK_PCLK_SMMU_DECON0X 70
727#define CLK_PCLK_BTS_DECON_TV_M3 71
728#define CLK_PCLK_BTS_DECON_TV_M2 72
729#define CLK_PCLK_BTS_DECON_TV_M1 73
730#define CLK_PCLK_BTS_DECON_TV_M0 74
731#define CLK_PCLK_BTS_DECONM4 75
732#define CLK_PCLK_BTS_DECONM3 76
733#define CLK_PCLK_BTS_DECONM2 77
734#define CLK_PCLK_BTS_DECONM1 78
735#define CLK_PCLK_BTS_DECONM0 79
736#define CLK_PCLK_MIC1 80
737#define CLK_PCLK_PMU_DISP 81
738#define CLK_PCLK_SYSREG_DISP 82
739#define CLK_PCLK_HDMIPHY 83
740#define CLK_PCLK_HDMI 84
741#define CLK_PCLK_MIC0 85
742#define CLK_PCLK_DSIM1 86
743#define CLK_PCLK_DSIM0 87
744#define CLK_PCLK_DECON_TV 88
745#define CLK_PHYCLK_MIPIDPHY1_BITCLKDIV8 89
746#define CLK_PHYCLK_MIPIDPHY1_RXCLKESC0 90
747#define CLK_SCLK_RGB_TV_VCLK_TO_DSIM1 91
748#define CLK_SCLK_RGB_TV_VCLK_TO_MIC1 92
749#define CLK_SCLK_DSIM1 93
750#define CLK_SCLK_DECON_TV_VCLK 94
751#define CLK_PHYCLK_MIPIDPHY0_BITCLKDIV8 95
752#define CLK_PHYCLK_MIPIDPHY0_RXCLKESC0 96
753#define CLK_PHYCLK_HDMIPHY_TMDS_CLKO 97
754#define CLK_PHYCLK_HDMI_PIXEL 98
755#define CLK_SCLK_RGB_VCLK_TO_SMIES 99
756#define CLK_SCLK_FREQ_DET_DISP_PLL 100
757#define CLK_SCLK_RGB_VCLK_TO_DSIM0 101
758#define CLK_SCLK_RGB_VCLK_TO_MIC0 102
759#define CLK_SCLK_DSD 103
760#define CLK_SCLK_HDMI_SPDIF 104
761#define CLK_SCLK_DSIM0 105
762#define CLK_SCLK_DECON_TV_ECLK 106
763#define CLK_SCLK_DECON_VCLK 107
764#define CLK_SCLK_DECON_ECLK 108
765#define CLK_SCLK_RGB_VCLK 109
766#define CLK_SCLK_RGB_TV_VCLK 110
767
768#define DISP_NR_CLK 111
769
770/* CMU_AUD */
771#define CLK_MOUT_AUD_PLL_USER 1
772#define CLK_MOUT_SCLK_AUD_PCM 2
773#define CLK_MOUT_SCLK_AUD_I2S 3
774
775#define CLK_DIV_ATCLK_AUD 4
776#define CLK_DIV_PCLK_DBG_AUD 5
777#define CLK_DIV_ACLK_AUD 6
778#define CLK_DIV_AUD_CA5 7
779#define CLK_DIV_SCLK_AUD_SLIMBUS 8
780#define CLK_DIV_SCLK_AUD_UART 9
781#define CLK_DIV_SCLK_AUD_PCM 10
782#define CLK_DIV_SCLK_AUD_I2S 11
783
784#define CLK_ACLK_INTR_CTRL 12
785#define CLK_ACLK_AXIDS2_LPASSP 13
786#define CLK_ACLK_AXIDS1_LPASSP 14
787#define CLK_ACLK_AXI2APB1_LPASSP 15
788#define CLK_ACLK_AXI2APH_LPASSP 16
789#define CLK_ACLK_SMMU_LPASSX 17
790#define CLK_ACLK_AXIDS0_LPASSP 18
791#define CLK_ACLK_AXI2APB0_LPASSP 19
792#define CLK_ACLK_XIU_LPASSX 20
793#define CLK_ACLK_AUDNP_133 21
794#define CLK_ACLK_AUDND_133 22
795#define CLK_ACLK_SRAMC 23
796#define CLK_ACLK_DMAC 24
797#define CLK_PCLK_WDT1 25
798#define CLK_PCLK_WDT0 26
799#define CLK_PCLK_SFR1 27
800#define CLK_PCLK_SMMU_LPASSX 28
801#define CLK_PCLK_GPIO_AUD 29
802#define CLK_PCLK_PMU_AUD 30
803#define CLK_PCLK_SYSREG_AUD 31
804#define CLK_PCLK_AUD_SLIMBUS 32
805#define CLK_PCLK_AUD_UART 33
806#define CLK_PCLK_AUD_PCM 34
807#define CLK_PCLK_AUD_I2S 35
808#define CLK_PCLK_TIMER 36
809#define CLK_PCLK_SFR0_CTRL 37
810#define CLK_ATCLK_AUD 38
811#define CLK_PCLK_DBG_AUD 39
812#define CLK_SCLK_AUD_CA5 40
813#define CLK_SCLK_JTAG_TCK 41
814#define CLK_SCLK_SLIMBUS_CLKIN 42
815#define CLK_SCLK_AUD_SLIMBUS 43
816#define CLK_SCLK_AUD_UART 44
817#define CLK_SCLK_AUD_PCM 45
818#define CLK_SCLK_I2S_BCLK 46
819#define CLK_SCLK_AUD_I2S 47
820
821#define AUD_NR_CLK 48
822
823/* CMU_BUS{0|1|2} */
824#define CLK_DIV_PCLK_BUS_133 1
825
826#define CLK_ACLK_AHB2APB_BUSP 2
827#define CLK_ACLK_BUSNP_133 3
828#define CLK_ACLK_BUSND_400 4
829#define CLK_PCLK_BUSSRVND_133 5
830#define CLK_PCLK_PMU_BUS 6
831#define CLK_PCLK_SYSREG_BUS 7
832
833#define CLK_MOUT_ACLK_BUS2_400_USER 8 /* Only CMU_BUS2 */
834#define CLK_ACLK_BUS2BEND_400 9 /* Only CMU_BUS2 */
835#define CLK_ACLK_BUS2RTND_400 10 /* Only CMU_BUS2 */
836
837#define BUSx_NR_CLK 11
838
839/* CMU_G3D */
840#define CLK_FOUT_G3D_PLL 1
841
842#define CLK_MOUT_ACLK_G3D_400 2
843#define CLK_MOUT_G3D_PLL 3
844
845#define CLK_DIV_SCLK_HPM_G3D 4
846#define CLK_DIV_PCLK_G3D 5
847#define CLK_DIV_ACLK_G3D 6
848#define CLK_ACLK_BTS_G3D1 7
849#define CLK_ACLK_BTS_G3D0 8
850#define CLK_ACLK_ASYNCAPBS_G3D 9
851#define CLK_ACLK_ASYNCAPBM_G3D 10
852#define CLK_ACLK_AHB2APB_G3DP 11
853#define CLK_ACLK_G3DNP_150 12
854#define CLK_ACLK_G3DND_600 13
855#define CLK_ACLK_G3D 14
856#define CLK_PCLK_BTS_G3D1 15
857#define CLK_PCLK_BTS_G3D0 16
858#define CLK_PCLK_PMU_G3D 17
859#define CLK_PCLK_SYSREG_G3D 18
860#define CLK_SCLK_HPM_G3D 19
861
862#define G3D_NR_CLK 20
863
864/* CMU_GSCL */
865#define CLK_MOUT_ACLK_GSCL_111_USER 1
866#define CLK_MOUT_ACLK_GSCL_333_USER 2
867
868#define CLK_ACLK_BTS_GSCL2 3
869#define CLK_ACLK_BTS_GSCL1 4
870#define CLK_ACLK_BTS_GSCL0 5
871#define CLK_ACLK_AHB2APB_GSCLP 6
872#define CLK_ACLK_XIU_GSCLX 7
873#define CLK_ACLK_GSCLNP_111 8
874#define CLK_ACLK_GSCLRTND_333 9
875#define CLK_ACLK_GSCLBEND_333 10
876#define CLK_ACLK_GSD 11
877#define CLK_ACLK_GSCL2 12
878#define CLK_ACLK_GSCL1 13
879#define CLK_ACLK_GSCL0 14
880#define CLK_ACLK_SMMU_GSCL0 15
881#define CLK_ACLK_SMMU_GSCL1 16
882#define CLK_ACLK_SMMU_GSCL2 17
883#define CLK_PCLK_BTS_GSCL2 18
884#define CLK_PCLK_BTS_GSCL1 19
885#define CLK_PCLK_BTS_GSCL0 20
886#define CLK_PCLK_PMU_GSCL 21
887#define CLK_PCLK_SYSREG_GSCL 22
888#define CLK_PCLK_GSCL2 23
889#define CLK_PCLK_GSCL1 24
890#define CLK_PCLK_GSCL0 25
891#define CLK_PCLK_SMMU_GSCL0 26
892#define CLK_PCLK_SMMU_GSCL1 27
893#define CLK_PCLK_SMMU_GSCL2 28
894
895#define GSCL_NR_CLK 29
896
897/* CMU_APOLLO */
898#define CLK_FOUT_APOLLO_PLL 1
899
900#define CLK_MOUT_APOLLO_PLL 2
901#define CLK_MOUT_BUS_PLL_APOLLO_USER 3
902#define CLK_MOUT_APOLLO 4
903
904#define CLK_DIV_CNTCLK_APOLLO 5
905#define CLK_DIV_PCLK_DBG_APOLLO 6
906#define CLK_DIV_ATCLK_APOLLO 7
907#define CLK_DIV_PCLK_APOLLO 8
908#define CLK_DIV_ACLK_APOLLO 9
909#define CLK_DIV_APOLLO2 10
910#define CLK_DIV_APOLLO1 11
911#define CLK_DIV_SCLK_HPM_APOLLO 12
912#define CLK_DIV_APOLLO_PLL 13
913
914#define CLK_ACLK_ATBDS_APOLLO_3 14
915#define CLK_ACLK_ATBDS_APOLLO_2 15
916#define CLK_ACLK_ATBDS_APOLLO_1 16
917#define CLK_ACLK_ATBDS_APOLLO_0 17
918#define CLK_ACLK_ASATBSLV_APOLLO_3_CSSYS 18
919#define CLK_ACLK_ASATBSLV_APOLLO_2_CSSYS 19
920#define CLK_ACLK_ASATBSLV_APOLLO_1_CSSYS 20
921#define CLK_ACLK_ASATBSLV_APOLLO_0_CSSYS 21
922#define CLK_ACLK_ASYNCACES_APOLLO_CCI 22
923#define CLK_ACLK_AHB2APB_APOLLOP 23
924#define CLK_ACLK_APOLLONP_200 24
925#define CLK_PCLK_ASAPBMST_CSSYS_APOLLO 25
926#define CLK_PCLK_PMU_APOLLO 26
927#define CLK_PCLK_SYSREG_APOLLO 27
928#define CLK_CNTCLK_APOLLO 28
929#define CLK_SCLK_HPM_APOLLO 29
930#define CLK_SCLK_APOLLO 30
931
932#define APOLLO_NR_CLK 31
933
934/* CMU_ATLAS */
935#define CLK_FOUT_ATLAS_PLL 1
936
937#define CLK_MOUT_ATLAS_PLL 2
938#define CLK_MOUT_BUS_PLL_ATLAS_USER 3
939#define CLK_MOUT_ATLAS 4
940
941#define CLK_DIV_CNTCLK_ATLAS 5
942#define CLK_DIV_PCLK_DBG_ATLAS 6
943#define CLK_DIV_ATCLK_ATLASO 7
944#define CLK_DIV_PCLK_ATLAS 8
945#define CLK_DIV_ACLK_ATLAS 9
946#define CLK_DIV_ATLAS2 10
947#define CLK_DIV_ATLAS1 11
948#define CLK_DIV_SCLK_HPM_ATLAS 12
949#define CLK_DIV_ATLAS_PLL 13
950
951#define CLK_ACLK_ATB_AUD_CSSYS 14
952#define CLK_ACLK_ATB_APOLLO3_CSSYS 15
953#define CLK_ACLK_ATB_APOLLO2_CSSYS 16
954#define CLK_ACLK_ATB_APOLLO1_CSSYS 17
955#define CLK_ACLK_ATB_APOLLO0_CSSYS 18
956#define CLK_ACLK_ASYNCAHBS_CSSYS_SSS 19
957#define CLK_ACLK_ASYNCAXIS_CSSYS_CCIX 20
958#define CLK_ACLK_ASYNCACES_ATLAS_CCI 21
959#define CLK_ACLK_AHB2APB_ATLASP 22
960#define CLK_ACLK_ATLASNP_200 23
961#define CLK_PCLK_ASYNCAPB_AUD_CSSYS 24
962#define CLK_PCLK_ASYNCAPB_ISP_CSSYS 25
963#define CLK_PCLK_ASYNCAPB_APOLLO_CSSYS 26
964#define CLK_PCLK_PMU_ATLAS 27
965#define CLK_PCLK_SYSREG_ATLAS 28
966#define CLK_PCLK_SECJTAG 29
967#define CLK_CNTCLK_ATLAS 30
968#define CLK_SCLK_FREQ_DET_ATLAS_PLL 31
969#define CLK_SCLK_HPM_ATLAS 32
970#define CLK_TRACECLK 33
971#define CLK_CTMCLK 34
972#define CLK_HCLK_CSSYS 35
973#define CLK_PCLK_DBG_CSSYS 36
974#define CLK_PCLK_DBG 37
975#define CLK_ATCLK 38
976#define CLK_SCLK_ATLAS 39
977
978#define ATLAS_NR_CLK 40
979
980/* CMU_MSCL */
981#define CLK_MOUT_SCLK_JPEG_USER 1
982#define CLK_MOUT_ACLK_MSCL_400_USER 2
983#define CLK_MOUT_SCLK_JPEG 3
984
985#define CLK_DIV_PCLK_MSCL 4
986
987#define CLK_ACLK_BTS_JPEG 5
988#define CLK_ACLK_BTS_M2MSCALER1 6
989#define CLK_ACLK_BTS_M2MSCALER0 7
990#define CLK_ACLK_AHB2APB_MSCL0P 8
991#define CLK_ACLK_XIU_MSCLX 9
992#define CLK_ACLK_MSCLNP_100 10
993#define CLK_ACLK_MSCLND_400 11
994#define CLK_ACLK_JPEG 12
995#define CLK_ACLK_M2MSCALER1 13
996#define CLK_ACLK_M2MSCALER0 14
997#define CLK_ACLK_SMMU_M2MSCALER0 15
998#define CLK_ACLK_SMMU_M2MSCALER1 16
999#define CLK_ACLK_SMMU_JPEG 17
1000#define CLK_PCLK_BTS_JPEG 18
1001#define CLK_PCLK_BTS_M2MSCALER1 19
1002#define CLK_PCLK_BTS_M2MSCALER0 20
1003#define CLK_PCLK_PMU_MSCL 21
1004#define CLK_PCLK_SYSREG_MSCL 22
1005#define CLK_PCLK_JPEG 23
1006#define CLK_PCLK_M2MSCALER1 24
1007#define CLK_PCLK_M2MSCALER0 25
1008#define CLK_PCLK_SMMU_M2MSCALER0 26
1009#define CLK_PCLK_SMMU_M2MSCALER1 27
1010#define CLK_PCLK_SMMU_JPEG 28
1011#define CLK_SCLK_JPEG 29
1012
1013#define MSCL_NR_CLK 30
1014
1015/* CMU_MFC */
1016#define CLK_MOUT_ACLK_MFC_400_USER 1
1017
1018#define CLK_DIV_PCLK_MFC 2
1019
1020#define CLK_ACLK_BTS_MFC_1 3
1021#define CLK_ACLK_BTS_MFC_0 4
1022#define CLK_ACLK_AHB2APB_MFCP 5
1023#define CLK_ACLK_XIU_MFCX 6
1024#define CLK_ACLK_MFCNP_100 7
1025#define CLK_ACLK_MFCND_400 8
1026#define CLK_ACLK_MFC 9
1027#define CLK_ACLK_SMMU_MFC_1 10
1028#define CLK_ACLK_SMMU_MFC_0 11
1029#define CLK_PCLK_BTS_MFC_1 12
1030#define CLK_PCLK_BTS_MFC_0 13
1031#define CLK_PCLK_PMU_MFC 14
1032#define CLK_PCLK_SYSREG_MFC 15
1033#define CLK_PCLK_MFC 16
1034#define CLK_PCLK_SMMU_MFC_1 17
1035#define CLK_PCLK_SMMU_MFC_0 18
1036
1037#define MFC_NR_CLK 19
1038
1039/* CMU_HEVC */
1040#define CLK_MOUT_ACLK_HEVC_400_USER 1
1041
1042#define CLK_DIV_PCLK_HEVC 2
1043
1044#define CLK_ACLK_BTS_HEVC_1 3
1045#define CLK_ACLK_BTS_HEVC_0 4
1046#define CLK_ACLK_AHB2APB_HEVCP 5
1047#define CLK_ACLK_XIU_HEVCX 6
1048#define CLK_ACLK_HEVCNP_100 7
1049#define CLK_ACLK_HEVCND_400 8
1050#define CLK_ACLK_HEVC 9
1051#define CLK_ACLK_SMMU_HEVC_1 10
1052#define CLK_ACLK_SMMU_HEVC_0 11
1053#define CLK_PCLK_BTS_HEVC_1 12
1054#define CLK_PCLK_BTS_HEVC_0 13
1055#define CLK_PCLK_PMU_HEVC 14
1056#define CLK_PCLK_SYSREG_HEVC 15
1057#define CLK_PCLK_HEVC 16
1058#define CLK_PCLK_SMMU_HEVC_1 17
1059#define CLK_PCLK_SMMU_HEVC_0 18
1060
1061#define HEVC_NR_CLK 19
1062
1063/* CMU_ISP */
1064#define CLK_MOUT_ACLK_ISP_DIS_400_USER 1
1065#define CLK_MOUT_ACLK_ISP_400_USER 2
1066
1067#define CLK_DIV_PCLK_ISP_DIS 3
1068#define CLK_DIV_PCLK_ISP 4
1069#define CLK_DIV_ACLK_ISP_D_200 5
1070#define CLK_DIV_ACLK_ISP_C_200 6
1071
1072#define CLK_ACLK_ISP_D_GLUE 7
1073#define CLK_ACLK_SCALERP 8
1074#define CLK_ACLK_3DNR 9
1075#define CLK_ACLK_DIS 10
1076#define CLK_ACLK_SCALERC 11
1077#define CLK_ACLK_DRC 12
1078#define CLK_ACLK_ISP 13
1079#define CLK_ACLK_AXIUS_SCALERP 14
1080#define CLK_ACLK_AXIUS_SCALERC 15
1081#define CLK_ACLK_AXIUS_DRC 16
1082#define CLK_ACLK_ASYNCAHBM_ISP2P 17
1083#define CLK_ACLK_ASYNCAHBM_ISP1P 18
1084#define CLK_ACLK_ASYNCAXIS_DIS1 19
1085#define CLK_ACLK_ASYNCAXIS_DIS0 20
1086#define CLK_ACLK_ASYNCAXIM_DIS1 21
1087#define CLK_ACLK_ASYNCAXIM_DIS0 22
1088#define CLK_ACLK_ASYNCAXIM_ISP2P 23
1089#define CLK_ACLK_ASYNCAXIM_ISP1P 24
1090#define CLK_ACLK_AHB2APB_ISP2P 25
1091#define CLK_ACLK_AHB2APB_ISP1P 26
1092#define CLK_ACLK_AXI2APB_ISP2P 27
1093#define CLK_ACLK_AXI2APB_ISP1P 28
1094#define CLK_ACLK_XIU_ISPEX1 29
1095#define CLK_ACLK_XIU_ISPEX0 30
1096#define CLK_ACLK_ISPND_400 31
1097#define CLK_ACLK_SMMU_SCALERP 32
1098#define CLK_ACLK_SMMU_3DNR 33
1099#define CLK_ACLK_SMMU_DIS1 34
1100#define CLK_ACLK_SMMU_DIS0 35
1101#define CLK_ACLK_SMMU_SCALERC 36
1102#define CLK_ACLK_SMMU_DRC 37
1103#define CLK_ACLK_SMMU_ISP 38
1104#define CLK_ACLK_BTS_SCALERP 39
1105#define CLK_ACLK_BTS_3DR 40
1106#define CLK_ACLK_BTS_DIS1 41
1107#define CLK_ACLK_BTS_DIS0 42
1108#define CLK_ACLK_BTS_SCALERC 43
1109#define CLK_ACLK_BTS_DRC 44
1110#define CLK_ACLK_BTS_ISP 45
1111#define CLK_PCLK_SMMU_SCALERP 46
1112#define CLK_PCLK_SMMU_3DNR 47
1113#define CLK_PCLK_SMMU_DIS1 48
1114#define CLK_PCLK_SMMU_DIS0 49
1115#define CLK_PCLK_SMMU_SCALERC 50
1116#define CLK_PCLK_SMMU_DRC 51
1117#define CLK_PCLK_SMMU_ISP 52
1118#define CLK_PCLK_BTS_SCALERP 53
1119#define CLK_PCLK_BTS_3DNR 54
1120#define CLK_PCLK_BTS_DIS1 55
1121#define CLK_PCLK_BTS_DIS0 56
1122#define CLK_PCLK_BTS_SCALERC 57
1123#define CLK_PCLK_BTS_DRC 58
1124#define CLK_PCLK_BTS_ISP 59
1125#define CLK_PCLK_ASYNCAXI_DIS1 60
1126#define CLK_PCLK_ASYNCAXI_DIS0 61
1127#define CLK_PCLK_PMU_ISP 62
1128#define CLK_PCLK_SYSREG_ISP 63
1129#define CLK_PCLK_CMU_ISP_LOCAL 64
1130#define CLK_PCLK_SCALERP 65
1131#define CLK_PCLK_3DNR 66
1132#define CLK_PCLK_DIS_CORE 67
1133#define CLK_PCLK_DIS 68
1134#define CLK_PCLK_SCALERC 69
1135#define CLK_PCLK_DRC 70
1136#define CLK_PCLK_ISP 71
1137#define CLK_SCLK_PIXELASYNCS_DIS 72
1138#define CLK_SCLK_PIXELASYNCM_DIS 73
1139#define CLK_SCLK_PIXELASYNCS_SCALERP 74
1140#define CLK_SCLK_PIXELASYNCM_ISPD 75
1141#define CLK_SCLK_PIXELASYNCS_ISPC 76
1142#define CLK_SCLK_PIXELASYNCM_ISPC 77
1143
1144#define ISP_NR_CLK 78
1145
1146/* CMU_CAM0 */
1147#define CLK_PHYCLK_RXBYTEECLKHS0_S4_PHY 1
1148#define CLK_PHYCLK_RXBYTEECLKHS0_S2A_PHY 2
1149
1150#define CLK_MOUT_ACLK_CAM0_333_USER 3
1151#define CLK_MOUT_ACLK_CAM0_400_USER 4
1152#define CLK_MOUT_ACLK_CAM0_552_USER 5
1153#define CLK_MOUT_PHYCLK_RXBYTECLKHS0_S4_USER 6
1154#define CLK_MOUT_PHYCLK_RXBYTECLKHS0_S2A_USER 7
1155#define CLK_MOUT_ACLK_LITE_D_B 8
1156#define CLK_MOUT_ACLK_LITE_D_A 9
1157#define CLK_MOUT_ACLK_LITE_B_B 10
1158#define CLK_MOUT_ACLK_LITE_B_A 11
1159#define CLK_MOUT_ACLK_LITE_A_B 12
1160#define CLK_MOUT_ACLK_LITE_A_A 13
1161#define CLK_MOUT_ACLK_CAM0_400 14
1162#define CLK_MOUT_ACLK_CSIS1_B 15
1163#define CLK_MOUT_ACLK_CSIS1_A 16
1164#define CLK_MOUT_ACLK_CSIS0_B 17
1165#define CLK_MOUT_ACLK_CSIS0_A 18
1166#define CLK_MOUT_ACLK_3AA1_B 19
1167#define CLK_MOUT_ACLK_3AA1_A 20
1168#define CLK_MOUT_ACLK_3AA0_B 21
1169#define CLK_MOUT_ACLK_3AA0_A 22
1170#define CLK_MOUT_SCLK_LITE_FREECNT_C 23
1171#define CLK_MOUT_SCLK_LITE_FREECNT_B 24
1172#define CLK_MOUT_SCLK_LITE_FREECNT_A 25
1173#define CLK_MOUT_SCLK_PIXELASYNC_LITE_C_B 26
1174#define CLK_MOUT_SCLK_PIXELASYNC_LITE_C_A 27
1175#define CLK_MOUT_SCLK_PIXELASYNC_LITE_C_INIT_B 28
1176#define CLK_MOUT_SCLK_PIXELASYNC_LITE_C_INIT_A 29
1177
1178#define CLK_DIV_PCLK_CAM0_50 30
1179#define CLK_DIV_ACLK_CAM0_200 31
1180#define CLK_DIV_ACLK_CAM0_BUS_400 32
1181#define CLK_DIV_PCLK_LITE_D 33
1182#define CLK_DIV_ACLK_LITE_D 34
1183#define CLK_DIV_PCLK_LITE_B 35
1184#define CLK_DIV_ACLK_LITE_B 36
1185#define CLK_DIV_PCLK_LITE_A 37
1186#define CLK_DIV_ACLK_LITE_A 38
1187#define CLK_DIV_ACLK_CSIS1 39
1188#define CLK_DIV_ACLK_CSIS0 40
1189#define CLK_DIV_PCLK_3AA1 41
1190#define CLK_DIV_ACLK_3AA1 42
1191#define CLK_DIV_PCLK_3AA0 43
1192#define CLK_DIV_ACLK_3AA0 44
1193#define CLK_DIV_SCLK_PIXELASYNC_LITE_C 45
1194#define CLK_DIV_PCLK_PIXELASYNC_LITE_C 46
1195#define CLK_DIV_SCLK_PIXELASYNC_LITE_C_INIT 47
1196
1197#define CLK_ACLK_CSIS1 50
1198#define CLK_ACLK_CSIS0 51
1199#define CLK_ACLK_3AA1 52
1200#define CLK_ACLK_3AA0 53
1201#define CLK_ACLK_LITE_D 54
1202#define CLK_ACLK_LITE_B 55
1203#define CLK_ACLK_LITE_A 56
1204#define CLK_ACLK_AHBSYNCDN 57
1205#define CLK_ACLK_AXIUS_LITE_D 58
1206#define CLK_ACLK_AXIUS_LITE_B 59
1207#define CLK_ACLK_AXIUS_LITE_A 60
1208#define CLK_ACLK_ASYNCAPBM_3AA1 61
1209#define CLK_ACLK_ASYNCAPBS_3AA1 62
1210#define CLK_ACLK_ASYNCAPBM_3AA0 63
1211#define CLK_ACLK_ASYNCAPBS_3AA0 64
1212#define CLK_ACLK_ASYNCAPBM_LITE_D 65
1213#define CLK_ACLK_ASYNCAPBS_LITE_D 66
1214#define CLK_ACLK_ASYNCAPBM_LITE_B 67
1215#define CLK_ACLK_ASYNCAPBS_LITE_B 68
1216#define CLK_ACLK_ASYNCAPBM_LITE_A 69
1217#define CLK_ACLK_ASYNCAPBS_LITE_A 70
1218#define CLK_ACLK_ASYNCAXIM_ISP0P 71
1219#define CLK_ACLK_ASYNCAXIM_3AA1 72
1220#define CLK_ACLK_ASYNCAXIS_3AA1 73
1221#define CLK_ACLK_ASYNCAXIM_3AA0 74
1222#define CLK_ACLK_ASYNCAXIS_3AA0 75
1223#define CLK_ACLK_ASYNCAXIM_LITE_D 76
1224#define CLK_ACLK_ASYNCAXIS_LITE_D 77
1225#define CLK_ACLK_ASYNCAXIM_LITE_B 78
1226#define CLK_ACLK_ASYNCAXIS_LITE_B 79
1227#define CLK_ACLK_ASYNCAXIM_LITE_A 80
1228#define CLK_ACLK_ASYNCAXIS_LITE_A 81
1229#define CLK_ACLK_AHB2APB_ISPSFRP 82
1230#define CLK_ACLK_AXI2APB_ISP0P 83
1231#define CLK_ACLK_AXI2AHB_ISP0P 84
1232#define CLK_ACLK_XIU_IS0X 85
1233#define CLK_ACLK_XIU_ISP0EX 86
1234#define CLK_ACLK_CAM0NP_276 87
1235#define CLK_ACLK_CAM0ND_400 88
1236#define CLK_ACLK_SMMU_3AA1 89
1237#define CLK_ACLK_SMMU_3AA0 90
1238#define CLK_ACLK_SMMU_LITE_D 91
1239#define CLK_ACLK_SMMU_LITE_B 92
1240#define CLK_ACLK_SMMU_LITE_A 93
1241#define CLK_ACLK_BTS_3AA1 94
1242#define CLK_ACLK_BTS_3AA0 95
1243#define CLK_ACLK_BTS_LITE_D 96
1244#define CLK_ACLK_BTS_LITE_B 97
1245#define CLK_ACLK_BTS_LITE_A 98
1246#define CLK_PCLK_SMMU_3AA1 99
1247#define CLK_PCLK_SMMU_3AA0 100
1248#define CLK_PCLK_SMMU_LITE_D 101
1249#define CLK_PCLK_SMMU_LITE_B 102
1250#define CLK_PCLK_SMMU_LITE_A 103
1251#define CLK_PCLK_BTS_3AA1 104
1252#define CLK_PCLK_BTS_3AA0 105
1253#define CLK_PCLK_BTS_LITE_D 106
1254#define CLK_PCLK_BTS_LITE_B 107
1255#define CLK_PCLK_BTS_LITE_A 108
1256#define CLK_PCLK_ASYNCAXI_CAM1 109
1257#define CLK_PCLK_ASYNCAXI_3AA1 110
1258#define CLK_PCLK_ASYNCAXI_3AA0 111
1259#define CLK_PCLK_ASYNCAXI_LITE_D 112
1260#define CLK_PCLK_ASYNCAXI_LITE_B 113
1261#define CLK_PCLK_ASYNCAXI_LITE_A 114
1262#define CLK_PCLK_PMU_CAM0 115
1263#define CLK_PCLK_SYSREG_CAM0 116
1264#define CLK_PCLK_CMU_CAM0_LOCAL 117
1265#define CLK_PCLK_CSIS1 118
1266#define CLK_PCLK_CSIS0 119
1267#define CLK_PCLK_3AA1 120
1268#define CLK_PCLK_3AA0 121
1269#define CLK_PCLK_LITE_D 122
1270#define CLK_PCLK_LITE_B 123
1271#define CLK_PCLK_LITE_A 124
1272#define CLK_PHYCLK_RXBYTECLKHS0_S4 125
1273#define CLK_PHYCLK_RXBYTECLKHS0_S2A 126
1274#define CLK_SCLK_LITE_FREECNT 127
1275#define CLK_SCLK_PIXELASYNCM_3AA1 128
1276#define CLK_SCLK_PIXELASYNCM_3AA0 129
1277#define CLK_SCLK_PIXELASYNCS_3AA0 130
1278#define CLK_SCLK_PIXELASYNCM_LITE_C 131
1279#define CLK_SCLK_PIXELASYNCM_LITE_C_INIT 132
1280#define CLK_SCLK_PIXELASYNCS_LITE_C_INIT 133
1281
1282#define CAM0_NR_CLK 134
1283
1284/* CMU_CAM1 */
1285#define CLK_PHYCLK_RXBYTEECLKHS0_S2B 1
1286
1287#define CLK_MOUT_SCLK_ISP_UART_USER 2
1288#define CLK_MOUT_SCLK_ISP_SPI1_USER 3
1289#define CLK_MOUT_SCLK_ISP_SPI0_USER 4
1290#define CLK_MOUT_ACLK_CAM1_333_USER 5
1291#define CLK_MOUT_ACLK_CAM1_400_USER 6
1292#define CLK_MOUT_ACLK_CAM1_552_USER 7
1293#define CLK_MOUT_PHYCLK_RXBYTECLKHS0_S2B_USER 8
1294#define CLK_MOUT_ACLK_CSIS2_B 9
1295#define CLK_MOUT_ACLK_CSIS2_A 10
1296#define CLK_MOUT_ACLK_FD_B 11
1297#define CLK_MOUT_ACLK_FD_A 12
1298#define CLK_MOUT_ACLK_LITE_C_B 13
1299#define CLK_MOUT_ACLK_LITE_C_A 14
1300
1301#define CLK_DIV_SCLK_ISP_WPWM 15
1302#define CLK_DIV_PCLK_CAM1_83 16
1303#define CLK_DIV_PCLK_CAM1_166 17
1304#define CLK_DIV_PCLK_DBG_CAM1 18
1305#define CLK_DIV_ATCLK_CAM1 19
1306#define CLK_DIV_ACLK_CSIS2 20
1307#define CLK_DIV_PCLK_FD 21
1308#define CLK_DIV_ACLK_FD 22
1309#define CLK_DIV_PCLK_LITE_C 23
1310#define CLK_DIV_ACLK_LITE_C 24
1311
1312#define CLK_ACLK_ISP_GIC 25
1313#define CLK_ACLK_FD 26
1314#define CLK_ACLK_LITE_C 27
1315#define CLK_ACLK_CSIS2 28
1316#define CLK_ACLK_ASYNCAPBM_FD 29
1317#define CLK_ACLK_ASYNCAPBS_FD 30
1318#define CLK_ACLK_ASYNCAPBM_LITE_C 31
1319#define CLK_ACLK_ASYNCAPBS_LITE_C 32
1320#define CLK_ACLK_ASYNCAHBS_SFRISP2H2 33
1321#define CLK_ACLK_ASYNCAHBS_SFRISP2H1 34
1322#define CLK_ACLK_ASYNCAXIM_CA5 35
1323#define CLK_ACLK_ASYNCAXIS_CA5 36
1324#define CLK_ACLK_ASYNCAXIS_ISPX2 37
1325#define CLK_ACLK_ASYNCAXIS_ISPX1 38
1326#define CLK_ACLK_ASYNCAXIS_ISPX0 39
1327#define CLK_ACLK_ASYNCAXIM_ISPEX 40
1328#define CLK_ACLK_ASYNCAXIM_ISP3P 41
1329#define CLK_ACLK_ASYNCAXIS_ISP3P 42
1330#define CLK_ACLK_ASYNCAXIM_FD 43
1331#define CLK_ACLK_ASYNCAXIS_FD 44
1332#define CLK_ACLK_ASYNCAXIM_LITE_C 45
1333#define CLK_ACLK_ASYNCAXIS_LITE_C 46
1334#define CLK_ACLK_AHB2APB_ISP5P 47
1335#define CLK_ACLK_AHB2APB_ISP3P 48
1336#define CLK_ACLK_AXI2APB_ISP3P 49
1337#define CLK_ACLK_AHB_SFRISP2H 50
1338#define CLK_ACLK_AXI_ISP_HX_R 51
1339#define CLK_ACLK_AXI_ISP_CX_R 52
1340#define CLK_ACLK_AXI_ISP_HX 53
1341#define CLK_ACLK_AXI_ISP_CX 54
1342#define CLK_ACLK_XIU_ISPX 55
1343#define CLK_ACLK_XIU_ISPEX 56
1344#define CLK_ACLK_CAM1NP_333 57
1345#define CLK_ACLK_CAM1ND_400 58
1346#define CLK_ACLK_SMMU_ISPCPU 59
1347#define CLK_ACLK_SMMU_FD 60
1348#define CLK_ACLK_SMMU_LITE_C 61
1349#define CLK_ACLK_BTS_ISP3P 62
1350#define CLK_ACLK_BTS_FD 63
1351#define CLK_ACLK_BTS_LITE_C 64
1352#define CLK_ACLK_AHBDN_SFRISP2H 65
1353#define CLK_ACLK_AHBDN_ISP5P 66
1354#define CLK_ACLK_AXIUS_ISP3P 67
1355#define CLK_ACLK_AXIUS_FD 68
1356#define CLK_ACLK_AXIUS_LITE_C 69
1357#define CLK_PCLK_SMMU_ISPCPU 70
1358#define CLK_PCLK_SMMU_FD 71
1359#define CLK_PCLK_SMMU_LITE_C 72
1360#define CLK_PCLK_BTS_ISP3P 73
1361#define CLK_PCLK_BTS_FD 74
1362#define CLK_PCLK_BTS_LITE_C 75
1363#define CLK_PCLK_ASYNCAXIM_CA5 76
1364#define CLK_PCLK_ASYNCAXIM_ISPEX 77
1365#define CLK_PCLK_ASYNCAXIM_ISP3P 78
1366#define CLK_PCLK_ASYNCAXIM_FD 79
1367#define CLK_PCLK_ASYNCAXIM_LITE_C 80
1368#define CLK_PCLK_PMU_CAM1 81
1369#define CLK_PCLK_SYSREG_CAM1 82
1370#define CLK_PCLK_CMU_CAM1_LOCAL 83
1371#define CLK_PCLK_ISP_MCTADC 84
1372#define CLK_PCLK_ISP_WDT 85
1373#define CLK_PCLK_ISP_PWM 86
1374#define CLK_PCLK_ISP_UART 87
1375#define CLK_PCLK_ISP_MCUCTL 88
1376#define CLK_PCLK_ISP_SPI1 89
1377#define CLK_PCLK_ISP_SPI0 90
1378#define CLK_PCLK_ISP_I2C2 91
1379#define CLK_PCLK_ISP_I2C1 92
1380#define CLK_PCLK_ISP_I2C0 93
1381#define CLK_PCLK_ISP_MPWM 94
1382#define CLK_PCLK_FD 95
1383#define CLK_PCLK_LITE_C 96
1384#define CLK_PCLK_CSIS2 97
1385#define CLK_SCLK_ISP_I2C2 98
1386#define CLK_SCLK_ISP_I2C1 99
1387#define CLK_SCLK_ISP_I2C0 100
1388#define CLK_SCLK_ISP_PWM 101
1389#define CLK_PHYCLK_RXBYTECLKHS0_S2B 102
1390#define CLK_SCLK_LITE_C_FREECNT 103
1391#define CLK_SCLK_PIXELASYNCM_FD 104
1392#define CLK_SCLK_ISP_MCTADC 105
1393#define CLK_SCLK_ISP_UART 106
1394#define CLK_SCLK_ISP_SPI1 107
1395#define CLK_SCLK_ISP_SPI0 108
1396#define CLK_SCLK_ISP_MPWM 109
1397#define CLK_PCLK_DBG_ISP 110
1398#define CLK_ATCLK_ISP 111
1399#define CLK_SCLK_ISP_CA5 112
1400
1401#define CAM1_NR_CLK 113
1402
1403#endif /* _DT_BINDINGS_CLOCK_EXYNOS5433_H */
diff --git a/include/dt-bindings/clock/imx6qdl-clock.h b/include/dt-bindings/clock/imx6qdl-clock.h
index b690cdba163b..8780868458a0 100644
--- a/include/dt-bindings/clock/imx6qdl-clock.h
+++ b/include/dt-bindings/clock/imx6qdl-clock.h
@@ -248,6 +248,9 @@
248#define IMX6QDL_PLL6_BYPASS 235 248#define IMX6QDL_PLL6_BYPASS 235
249#define IMX6QDL_PLL7_BYPASS 236 249#define IMX6QDL_PLL7_BYPASS 236
250#define IMX6QDL_CLK_GPT_3M 237 250#define IMX6QDL_CLK_GPT_3M 237
251#define IMX6QDL_CLK_END 238 251#define IMX6QDL_CLK_VIDEO_27M 238
252#define IMX6QDL_CLK_MIPI_CORE_CFG 239
253#define IMX6QDL_CLK_MIPI_IPG 240
254#define IMX6QDL_CLK_END 241
252 255
253#endif /* __DT_BINDINGS_CLOCK_IMX6QDL_H */ 256#endif /* __DT_BINDINGS_CLOCK_IMX6QDL_H */
diff --git a/include/dt-bindings/clock/pistachio-clk.h b/include/dt-bindings/clock/pistachio-clk.h
new file mode 100644
index 000000000000..039f83facb68
--- /dev/null
+++ b/include/dt-bindings/clock/pistachio-clk.h
@@ -0,0 +1,183 @@
1/*
2 * Copyright (C) 2014 Google, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 */
8
9#ifndef _DT_BINDINGS_CLOCK_PISTACHIO_H
10#define _DT_BINDINGS_CLOCK_PISTACHIO_H
11
12/* PLLs */
13#define CLK_MIPS_PLL 0
14#define CLK_AUDIO_PLL 1
15#define CLK_RPU_V_PLL 2
16#define CLK_RPU_L_PLL 3
17#define CLK_SYS_PLL 4
18#define CLK_WIFI_PLL 5
19#define CLK_BT_PLL 6
20
21/* Fixed-factor clocks */
22#define CLK_WIFI_DIV4 16
23#define CLK_WIFI_DIV8 17
24
25/* Gate clocks */
26#define CLK_MIPS 32
27#define CLK_AUDIO_IN 33
28#define CLK_AUDIO 34
29#define CLK_I2S 35
30#define CLK_SPDIF 36
31#define CLK_AUDIO_DAC 37
32#define CLK_RPU_V 38
33#define CLK_RPU_L 39
34#define CLK_RPU_SLEEP 40
35#define CLK_WIFI_PLL_GATE 41
36#define CLK_RPU_CORE 42
37#define CLK_WIFI_ADC 43
38#define CLK_WIFI_DAC 44
39#define CLK_USB_PHY 45
40#define CLK_ENET_IN 46
41#define CLK_ENET 47
42#define CLK_UART0 48
43#define CLK_UART1 49
44#define CLK_PERIPH_SYS 50
45#define CLK_SPI0 51
46#define CLK_SPI1 52
47#define CLK_EVENT_TIMER 53
48#define CLK_AUX_ADC_INTERNAL 54
49#define CLK_AUX_ADC 55
50#define CLK_SD_HOST 56
51#define CLK_BT 57
52#define CLK_BT_DIV4 58
53#define CLK_BT_DIV8 59
54#define CLK_BT_1MHZ 60
55
56/* Divider clocks */
57#define CLK_MIPS_INTERNAL_DIV 64
58#define CLK_MIPS_DIV 65
59#define CLK_AUDIO_DIV 66
60#define CLK_I2S_DIV 67
61#define CLK_SPDIF_DIV 68
62#define CLK_AUDIO_DAC_DIV 69
63#define CLK_RPU_V_DIV 70
64#define CLK_RPU_L_DIV 71
65#define CLK_RPU_SLEEP_DIV 72
66#define CLK_RPU_CORE_DIV 73
67#define CLK_USB_PHY_DIV 74
68#define CLK_ENET_DIV 75
69#define CLK_UART0_INTERNAL_DIV 76
70#define CLK_UART0_DIV 77
71#define CLK_UART1_INTERNAL_DIV 78
72#define CLK_UART1_DIV 79
73#define CLK_SYS_INTERNAL_DIV 80
74#define CLK_SPI0_INTERNAL_DIV 81
75#define CLK_SPI0_DIV 82
76#define CLK_SPI1_INTERNAL_DIV 83
77#define CLK_SPI1_DIV 84
78#define CLK_EVENT_TIMER_INTERNAL_DIV 85
79#define CLK_EVENT_TIMER_DIV 86
80#define CLK_AUX_ADC_INTERNAL_DIV 87
81#define CLK_AUX_ADC_DIV 88
82#define CLK_SD_HOST_DIV 89
83#define CLK_BT_DIV 90
84#define CLK_BT_DIV4_DIV 91
85#define CLK_BT_DIV8_DIV 92
86#define CLK_BT_1MHZ_INTERNAL_DIV 93
87#define CLK_BT_1MHZ_DIV 94
88
89/* Mux clocks */
90#define CLK_AUDIO_REF_MUX 96
91#define CLK_MIPS_PLL_MUX 97
92#define CLK_AUDIO_PLL_MUX 98
93#define CLK_AUDIO_MUX 99
94#define CLK_RPU_V_PLL_MUX 100
95#define CLK_RPU_L_PLL_MUX 101
96#define CLK_RPU_L_MUX 102
97#define CLK_WIFI_PLL_MUX 103
98#define CLK_WIFI_DIV4_MUX 104
99#define CLK_WIFI_DIV8_MUX 105
100#define CLK_RPU_CORE_MUX 106
101#define CLK_SYS_PLL_MUX 107
102#define CLK_ENET_MUX 108
103#define CLK_EVENT_TIMER_MUX 109
104#define CLK_SD_HOST_MUX 110
105#define CLK_BT_PLL_MUX 111
106#define CLK_DEBUG_MUX 112
107
108#define CLK_NR_CLKS 113
109
110/* Peripheral gate clocks */
111#define PERIPH_CLK_SYS 0
112#define PERIPH_CLK_SYS_BUS 1
113#define PERIPH_CLK_DDR 2
114#define PERIPH_CLK_ROM 3
115#define PERIPH_CLK_COUNTER_FAST 4
116#define PERIPH_CLK_COUNTER_SLOW 5
117#define PERIPH_CLK_IR 6
118#define PERIPH_CLK_WD 7
119#define PERIPH_CLK_PDM 8
120#define PERIPH_CLK_PWM 9
121#define PERIPH_CLK_I2C0 10
122#define PERIPH_CLK_I2C1 11
123#define PERIPH_CLK_I2C2 12
124#define PERIPH_CLK_I2C3 13
125
126/* Peripheral divider clocks */
127#define PERIPH_CLK_ROM_DIV 32
128#define PERIPH_CLK_COUNTER_FAST_DIV 33
129#define PERIPH_CLK_COUNTER_SLOW_PRE_DIV 34
130#define PERIPH_CLK_COUNTER_SLOW_DIV 35
131#define PERIPH_CLK_IR_PRE_DIV 36
132#define PERIPH_CLK_IR_DIV 37
133#define PERIPH_CLK_WD_PRE_DIV 38
134#define PERIPH_CLK_WD_DIV 39
135#define PERIPH_CLK_PDM_PRE_DIV 40
136#define PERIPH_CLK_PDM_DIV 41
137#define PERIPH_CLK_PWM_PRE_DIV 42
138#define PERIPH_CLK_PWM_DIV 43
139#define PERIPH_CLK_I2C0_PRE_DIV 44
140#define PERIPH_CLK_I2C0_DIV 45
141#define PERIPH_CLK_I2C1_PRE_DIV 46
142#define PERIPH_CLK_I2C1_DIV 47
143#define PERIPH_CLK_I2C2_PRE_DIV 48
144#define PERIPH_CLK_I2C2_DIV 49
145#define PERIPH_CLK_I2C3_PRE_DIV 50
146#define PERIPH_CLK_I2C3_DIV 51
147
148#define PERIPH_CLK_NR_CLKS 52
149
150/* System gate clocks */
151#define SYS_CLK_I2C0 0
152#define SYS_CLK_I2C1 1
153#define SYS_CLK_I2C2 2
154#define SYS_CLK_I2C3 3
155#define SYS_CLK_I2S_IN 4
156#define SYS_CLK_PAUD_OUT 5
157#define SYS_CLK_SPDIF_OUT 6
158#define SYS_CLK_SPI0_MASTER 7
159#define SYS_CLK_SPI0_SLAVE 8
160#define SYS_CLK_PWM 9
161#define SYS_CLK_UART0 10
162#define SYS_CLK_UART1 11
163#define SYS_CLK_SPI1 12
164#define SYS_CLK_MDC 13
165#define SYS_CLK_SD_HOST 14
166#define SYS_CLK_ENET 15
167#define SYS_CLK_IR 16
168#define SYS_CLK_WD 17
169#define SYS_CLK_TIMER 18
170#define SYS_CLK_I2S_OUT 24
171#define SYS_CLK_SPDIF_IN 25
172#define SYS_CLK_EVENT_TIMER 26
173#define SYS_CLK_HASH 27
174
175#define SYS_CLK_NR_CLKS 28
176
177/* Gates for external input clocks */
178#define EXT_CLK_AUDIO_IN 0
179#define EXT_CLK_ENET_IN 1
180
181#define EXT_CLK_NR_CLKS 2
182
183#endif /* _DT_BINDINGS_CLOCK_PISTACHIO_H */
diff --git a/include/dt-bindings/clock/qcom,gcc-ipq806x.h b/include/dt-bindings/clock/qcom,gcc-ipq806x.h
index 04fb29ae30e6..ebd63fd05649 100644
--- a/include/dt-bindings/clock/qcom,gcc-ipq806x.h
+++ b/include/dt-bindings/clock/qcom,gcc-ipq806x.h
@@ -288,5 +288,6 @@
288#define UBI32_CORE2_CLK_SRC 278 288#define UBI32_CORE2_CLK_SRC 278
289#define UBI32_CORE1_CLK 279 289#define UBI32_CORE1_CLK 279
290#define UBI32_CORE2_CLK 280 290#define UBI32_CORE2_CLK 280
291#define EBI2_AON_CLK 281
291 292
292#endif 293#endif
diff --git a/include/dt-bindings/clock/qcom,gcc-msm8916.h b/include/dt-bindings/clock/qcom,gcc-msm8916.h
new file mode 100644
index 000000000000..e430f644dd6c
--- /dev/null
+++ b/include/dt-bindings/clock/qcom,gcc-msm8916.h
@@ -0,0 +1,156 @@
1/*
2 * Copyright 2015 Linaro Limited
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _DT_BINDINGS_CLK_MSM_GCC_8916_H
15#define _DT_BINDINGS_CLK_MSM_GCC_8916_H
16
17#define GPLL0 0
18#define GPLL0_VOTE 1
19#define BIMC_PLL 2
20#define BIMC_PLL_VOTE 3
21#define GPLL1 4
22#define GPLL1_VOTE 5
23#define GPLL2 6
24#define GPLL2_VOTE 7
25#define PCNOC_BFDCD_CLK_SRC 8
26#define SYSTEM_NOC_BFDCD_CLK_SRC 9
27#define CAMSS_AHB_CLK_SRC 10
28#define APSS_AHB_CLK_SRC 11
29#define CSI0_CLK_SRC 12
30#define CSI1_CLK_SRC 13
31#define GFX3D_CLK_SRC 14
32#define VFE0_CLK_SRC 15
33#define BLSP1_QUP1_I2C_APPS_CLK_SRC 16
34#define BLSP1_QUP1_SPI_APPS_CLK_SRC 17
35#define BLSP1_QUP2_I2C_APPS_CLK_SRC 18
36#define BLSP1_QUP2_SPI_APPS_CLK_SRC 19
37#define BLSP1_QUP3_I2C_APPS_CLK_SRC 20
38#define BLSP1_QUP3_SPI_APPS_CLK_SRC 21
39#define BLSP1_QUP4_I2C_APPS_CLK_SRC 22
40#define BLSP1_QUP4_SPI_APPS_CLK_SRC 23
41#define BLSP1_QUP5_I2C_APPS_CLK_SRC 24
42#define BLSP1_QUP5_SPI_APPS_CLK_SRC 25
43#define BLSP1_QUP6_I2C_APPS_CLK_SRC 26
44#define BLSP1_QUP6_SPI_APPS_CLK_SRC 27
45#define BLSP1_UART1_APPS_CLK_SRC 28
46#define BLSP1_UART2_APPS_CLK_SRC 29
47#define CCI_CLK_SRC 30
48#define CAMSS_GP0_CLK_SRC 31
49#define CAMSS_GP1_CLK_SRC 32
50#define JPEG0_CLK_SRC 33
51#define MCLK0_CLK_SRC 34
52#define MCLK1_CLK_SRC 35
53#define CSI0PHYTIMER_CLK_SRC 36
54#define CSI1PHYTIMER_CLK_SRC 37
55#define CPP_CLK_SRC 38
56#define CRYPTO_CLK_SRC 39
57#define GP1_CLK_SRC 40
58#define GP2_CLK_SRC 41
59#define GP3_CLK_SRC 42
60#define BYTE0_CLK_SRC 43
61#define ESC0_CLK_SRC 44
62#define MDP_CLK_SRC 45
63#define PCLK0_CLK_SRC 46
64#define VSYNC_CLK_SRC 47
65#define PDM2_CLK_SRC 48
66#define SDCC1_APPS_CLK_SRC 49
67#define SDCC2_APPS_CLK_SRC 50
68#define APSS_TCU_CLK_SRC 51
69#define USB_HS_SYSTEM_CLK_SRC 52
70#define VCODEC0_CLK_SRC 53
71#define GCC_BLSP1_AHB_CLK 54
72#define GCC_BLSP1_SLEEP_CLK 55
73#define GCC_BLSP1_QUP1_I2C_APPS_CLK 56
74#define GCC_BLSP1_QUP1_SPI_APPS_CLK 57
75#define GCC_BLSP1_QUP2_I2C_APPS_CLK 58
76#define GCC_BLSP1_QUP2_SPI_APPS_CLK 59
77#define GCC_BLSP1_QUP3_I2C_APPS_CLK 60
78#define GCC_BLSP1_QUP3_SPI_APPS_CLK 61
79#define GCC_BLSP1_QUP4_I2C_APPS_CLK 62
80#define GCC_BLSP1_QUP4_SPI_APPS_CLK 63
81#define GCC_BLSP1_QUP5_I2C_APPS_CLK 64
82#define GCC_BLSP1_QUP5_SPI_APPS_CLK 65
83#define GCC_BLSP1_QUP6_I2C_APPS_CLK 66
84#define GCC_BLSP1_QUP6_SPI_APPS_CLK 67
85#define GCC_BLSP1_UART1_APPS_CLK 68
86#define GCC_BLSP1_UART2_APPS_CLK 69
87#define GCC_BOOT_ROM_AHB_CLK 70
88#define GCC_CAMSS_CCI_AHB_CLK 71
89#define GCC_CAMSS_CCI_CLK 72
90#define GCC_CAMSS_CSI0_AHB_CLK 73
91#define GCC_CAMSS_CSI0_CLK 74
92#define GCC_CAMSS_CSI0PHY_CLK 75
93#define GCC_CAMSS_CSI0PIX_CLK 76
94#define GCC_CAMSS_CSI0RDI_CLK 77
95#define GCC_CAMSS_CSI1_AHB_CLK 78
96#define GCC_CAMSS_CSI1_CLK 79
97#define GCC_CAMSS_CSI1PHY_CLK 80
98#define GCC_CAMSS_CSI1PIX_CLK 81
99#define GCC_CAMSS_CSI1RDI_CLK 82
100#define GCC_CAMSS_CSI_VFE0_CLK 83
101#define GCC_CAMSS_GP0_CLK 84
102#define GCC_CAMSS_GP1_CLK 85
103#define GCC_CAMSS_ISPIF_AHB_CLK 86
104#define GCC_CAMSS_JPEG0_CLK 87
105#define GCC_CAMSS_JPEG_AHB_CLK 88
106#define GCC_CAMSS_JPEG_AXI_CLK 89
107#define GCC_CAMSS_MCLK0_CLK 90
108#define GCC_CAMSS_MCLK1_CLK 91
109#define GCC_CAMSS_MICRO_AHB_CLK 92
110#define GCC_CAMSS_CSI0PHYTIMER_CLK 93
111#define GCC_CAMSS_CSI1PHYTIMER_CLK 94
112#define GCC_CAMSS_AHB_CLK 95
113#define GCC_CAMSS_TOP_AHB_CLK 96
114#define GCC_CAMSS_CPP_AHB_CLK 97
115#define GCC_CAMSS_CPP_CLK 98
116#define GCC_CAMSS_VFE0_CLK 99
117#define GCC_CAMSS_VFE_AHB_CLK 100
118#define GCC_CAMSS_VFE_AXI_CLK 101
119#define GCC_CRYPTO_AHB_CLK 102
120#define GCC_CRYPTO_AXI_CLK 103
121#define GCC_CRYPTO_CLK 104
122#define GCC_OXILI_GMEM_CLK 105
123#define GCC_GP1_CLK 106
124#define GCC_GP2_CLK 107
125#define GCC_GP3_CLK 108
126#define GCC_MDSS_AHB_CLK 109
127#define GCC_MDSS_AXI_CLK 110
128#define GCC_MDSS_BYTE0_CLK 111
129#define GCC_MDSS_ESC0_CLK 112
130#define GCC_MDSS_MDP_CLK 113
131#define GCC_MDSS_PCLK0_CLK 114
132#define GCC_MDSS_VSYNC_CLK 115
133#define GCC_MSS_CFG_AHB_CLK 116
134#define GCC_OXILI_AHB_CLK 117
135#define GCC_OXILI_GFX3D_CLK 118
136#define GCC_PDM2_CLK 119
137#define GCC_PDM_AHB_CLK 120
138#define GCC_PRNG_AHB_CLK 121
139#define GCC_SDCC1_AHB_CLK 122
140#define GCC_SDCC1_APPS_CLK 123
141#define GCC_SDCC2_AHB_CLK 124
142#define GCC_SDCC2_APPS_CLK 125
143#define GCC_GTCU_AHB_CLK 126
144#define GCC_JPEG_TBU_CLK 127
145#define GCC_MDP_TBU_CLK 128
146#define GCC_SMMU_CFG_CLK 129
147#define GCC_VENUS_TBU_CLK 130
148#define GCC_VFE_TBU_CLK 131
149#define GCC_USB2A_PHY_SLEEP_CLK 132
150#define GCC_USB_HS_AHB_CLK 133
151#define GCC_USB_HS_SYSTEM_CLK 134
152#define GCC_VENUS0_AHB_CLK 135
153#define GCC_VENUS0_AXI_CLK 136
154#define GCC_VENUS0_VCODEC0_CLK 137
155
156#endif
diff --git a/include/dt-bindings/clock/r8a73a4-clock.h b/include/dt-bindings/clock/r8a73a4-clock.h
new file mode 100644
index 000000000000..9a4b4c9ca44a
--- /dev/null
+++ b/include/dt-bindings/clock/r8a73a4-clock.h
@@ -0,0 +1,62 @@
1/*
2 * Copyright 2014 Ulrich Hecht
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 __DT_BINDINGS_CLOCK_R8A73A4_H__
11#define __DT_BINDINGS_CLOCK_R8A73A4_H__
12
13/* CPG */
14#define R8A73A4_CLK_MAIN 0
15#define R8A73A4_CLK_PLL0 1
16#define R8A73A4_CLK_PLL1 2
17#define R8A73A4_CLK_PLL2 3
18#define R8A73A4_CLK_PLL2S 4
19#define R8A73A4_CLK_PLL2H 5
20#define R8A73A4_CLK_Z 6
21#define R8A73A4_CLK_Z2 7
22#define R8A73A4_CLK_I 8
23#define R8A73A4_CLK_M3 9
24#define R8A73A4_CLK_B 10
25#define R8A73A4_CLK_M1 11
26#define R8A73A4_CLK_M2 12
27#define R8A73A4_CLK_ZX 13
28#define R8A73A4_CLK_ZS 14
29#define R8A73A4_CLK_HP 15
30
31/* MSTP2 */
32#define R8A73A4_CLK_DMAC 18
33#define R8A73A4_CLK_SCIFB3 17
34#define R8A73A4_CLK_SCIFB2 16
35#define R8A73A4_CLK_SCIFB1 7
36#define R8A73A4_CLK_SCIFB0 6
37#define R8A73A4_CLK_SCIFA0 4
38#define R8A73A4_CLK_SCIFA1 3
39
40/* MSTP3 */
41#define R8A73A4_CLK_CMT1 29
42#define R8A73A4_CLK_IIC1 23
43#define R8A73A4_CLK_IIC0 18
44#define R8A73A4_CLK_IIC7 17
45#define R8A73A4_CLK_IIC6 16
46#define R8A73A4_CLK_MMCIF0 15
47#define R8A73A4_CLK_SDHI0 14
48#define R8A73A4_CLK_SDHI1 13
49#define R8A73A4_CLK_SDHI2 12
50#define R8A73A4_CLK_MMCIF1 5
51#define R8A73A4_CLK_IIC2 0
52
53/* MSTP4 */
54#define R8A73A4_CLK_IIC3 11
55#define R8A73A4_CLK_IIC4 10
56#define R8A73A4_CLK_IIC5 9
57
58/* MSTP5 */
59#define R8A73A4_CLK_THERMAL 22
60#define R8A73A4_CLK_IIC8 15
61
62#endif /* __DT_BINDINGS_CLOCK_R8A73A4_H__ */
diff --git a/include/dt-bindings/clock/r8a7778-clock.h b/include/dt-bindings/clock/r8a7778-clock.h
new file mode 100644
index 000000000000..f6b07c5399de
--- /dev/null
+++ b/include/dt-bindings/clock/r8a7778-clock.h
@@ -0,0 +1,71 @@
1/*
2 * Copyright (C) 2014 Ulrich Hecht
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 __DT_BINDINGS_CLOCK_R8A7778_H__
11#define __DT_BINDINGS_CLOCK_R8A7778_H__
12
13/* CPG */
14#define R8A7778_CLK_PLLA 0
15#define R8A7778_CLK_PLLB 1
16#define R8A7778_CLK_B 2
17#define R8A7778_CLK_OUT 3
18#define R8A7778_CLK_P 4
19#define R8A7778_CLK_S 5
20#define R8A7778_CLK_S1 6
21
22/* MSTP0 */
23#define R8A7778_CLK_I2C0 30
24#define R8A7778_CLK_I2C1 29
25#define R8A7778_CLK_I2C2 28
26#define R8A7778_CLK_I2C3 27
27#define R8A7778_CLK_SCIF0 26
28#define R8A7778_CLK_SCIF1 25
29#define R8A7778_CLK_SCIF2 24
30#define R8A7778_CLK_SCIF3 23
31#define R8A7778_CLK_SCIF4 22
32#define R8A7778_CLK_SCIF5 21
33#define R8A7778_CLK_TMU0 16
34#define R8A7778_CLK_TMU1 15
35#define R8A7778_CLK_TMU2 14
36#define R8A7778_CLK_SSI0 12
37#define R8A7778_CLK_SSI1 11
38#define R8A7778_CLK_SSI2 10
39#define R8A7778_CLK_SSI3 9
40#define R8A7778_CLK_SRU 8
41#define R8A7778_CLK_HSPI 7
42
43/* MSTP1 */
44#define R8A7778_CLK_ETHER 14
45#define R8A7778_CLK_VIN0 10
46#define R8A7778_CLK_VIN1 9
47#define R8A7778_CLK_USB 0
48
49/* MSTP3 */
50#define R8A7778_CLK_MMC 31
51#define R8A7778_CLK_SDHI0 23
52#define R8A7778_CLK_SDHI1 22
53#define R8A7778_CLK_SDHI2 21
54#define R8A7778_CLK_SSI4 11
55#define R8A7778_CLK_SSI5 10
56#define R8A7778_CLK_SSI6 9
57#define R8A7778_CLK_SSI7 8
58#define R8A7778_CLK_SSI8 7
59
60/* MSTP5 */
61#define R8A7778_CLK_SRU_SRC0 31
62#define R8A7778_CLK_SRU_SRC1 30
63#define R8A7778_CLK_SRU_SRC2 29
64#define R8A7778_CLK_SRU_SRC3 28
65#define R8A7778_CLK_SRU_SRC4 27
66#define R8A7778_CLK_SRU_SRC5 26
67#define R8A7778_CLK_SRU_SRC6 25
68#define R8A7778_CLK_SRU_SRC7 24
69#define R8A7778_CLK_SRU_SRC8 23
70
71#endif /* __DT_BINDINGS_CLOCK_R8A7778_H__ */
diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
index 91940271cf83..3f2c6b198d4a 100644
--- a/include/dt-bindings/clock/r8a7790-clock.h
+++ b/include/dt-bindings/clock/r8a7790-clock.h
@@ -21,6 +21,8 @@
21#define R8A7790_CLK_SD0 7 21#define R8A7790_CLK_SD0 7
22#define R8A7790_CLK_SD1 8 22#define R8A7790_CLK_SD1 8
23#define R8A7790_CLK_Z 9 23#define R8A7790_CLK_Z 9
24#define R8A7790_CLK_RCAN 10
25#define R8A7790_CLK_ADSP 11
24 26
25/* MSTP0 */ 27/* MSTP0 */
26#define R8A7790_CLK_MSIOF0 0 28#define R8A7790_CLK_MSIOF0 0
@@ -80,6 +82,7 @@
80/* MSTP5 */ 82/* MSTP5 */
81#define R8A7790_CLK_AUDIO_DMAC1 1 83#define R8A7790_CLK_AUDIO_DMAC1 1
82#define R8A7790_CLK_AUDIO_DMAC0 2 84#define R8A7790_CLK_AUDIO_DMAC0 2
85#define R8A7790_CLK_ADSP_MOD 6
83#define R8A7790_CLK_THERMAL 22 86#define R8A7790_CLK_THERMAL 22
84#define R8A7790_CLK_PWM 23 87#define R8A7790_CLK_PWM 23
85 88
diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h
index f096f3f6c16a..8fc5dc8faeea 100644
--- a/include/dt-bindings/clock/r8a7791-clock.h
+++ b/include/dt-bindings/clock/r8a7791-clock.h
@@ -20,6 +20,8 @@
20#define R8A7791_CLK_SDH 6 20#define R8A7791_CLK_SDH 6
21#define R8A7791_CLK_SD0 7 21#define R8A7791_CLK_SD0 7
22#define R8A7791_CLK_Z 8 22#define R8A7791_CLK_Z 8
23#define R8A7791_CLK_RCAN 9
24#define R8A7791_CLK_ADSP 10
23 25
24/* MSTP0 */ 26/* MSTP0 */
25#define R8A7791_CLK_MSIOF0 0 27#define R8A7791_CLK_MSIOF0 0
@@ -71,6 +73,7 @@
71/* MSTP5 */ 73/* MSTP5 */
72#define R8A7791_CLK_AUDIO_DMAC1 1 74#define R8A7791_CLK_AUDIO_DMAC1 1
73#define R8A7791_CLK_AUDIO_DMAC0 2 75#define R8A7791_CLK_AUDIO_DMAC0 2
76#define R8A7791_CLK_ADSP_MOD 6
74#define R8A7791_CLK_THERMAL 22 77#define R8A7791_CLK_THERMAL 22
75#define R8A7791_CLK_PWM 23 78#define R8A7791_CLK_PWM 23
76 79
diff --git a/include/dt-bindings/clock/sh73a0-clock.h b/include/dt-bindings/clock/sh73a0-clock.h
index 1dd3eb2b7d90..53369568c24c 100644
--- a/include/dt-bindings/clock/sh73a0-clock.h
+++ b/include/dt-bindings/clock/sh73a0-clock.h
@@ -76,4 +76,7 @@
76#define SH73A0_CLK_IIC4 10 76#define SH73A0_CLK_IIC4 10
77#define SH73A0_CLK_KEYSC 3 77#define SH73A0_CLK_KEYSC 3
78 78
79/* MSTP5 */
80#define SH73A0_CLK_INTCA0 8
81
79#endif 82#endif
diff --git a/include/dt-bindings/clock/tegra124-car-common.h b/include/dt-bindings/clock/tegra124-car-common.h
index ae2eb17a1658..a2156090563f 100644
--- a/include/dt-bindings/clock/tegra124-car-common.h
+++ b/include/dt-bindings/clock/tegra124-car-common.h
@@ -297,7 +297,7 @@
297#define TEGRA124_CLK_PLL_C4 270 297#define TEGRA124_CLK_PLL_C4 270
298#define TEGRA124_CLK_PLL_DP 271 298#define TEGRA124_CLK_PLL_DP 271
299#define TEGRA124_CLK_PLL_E_MUX 272 299#define TEGRA124_CLK_PLL_E_MUX 272
300#define TEGRA124_CLK_PLLD_DSI 273 300#define TEGRA124_CLK_PLL_D_DSI_OUT 273
301/* 274 */ 301/* 274 */
302/* 275 */ 302/* 275 */
303/* 276 */ 303/* 276 */
diff --git a/include/dt-bindings/dma/jz4780-dma.h b/include/dt-bindings/dma/jz4780-dma.h
new file mode 100644
index 000000000000..df017fdfb44e
--- /dev/null
+++ b/include/dt-bindings/dma/jz4780-dma.h
@@ -0,0 +1,49 @@
1#ifndef __DT_BINDINGS_DMA_JZ4780_DMA_H__
2#define __DT_BINDINGS_DMA_JZ4780_DMA_H__
3
4/*
5 * Request type numbers for the JZ4780 DMA controller (written to the DRTn
6 * register for the channel).
7 */
8#define JZ4780_DMA_I2S1_TX 0x4
9#define JZ4780_DMA_I2S1_RX 0x5
10#define JZ4780_DMA_I2S0_TX 0x6
11#define JZ4780_DMA_I2S0_RX 0x7
12#define JZ4780_DMA_AUTO 0x8
13#define JZ4780_DMA_SADC_RX 0x9
14#define JZ4780_DMA_UART4_TX 0xc
15#define JZ4780_DMA_UART4_RX 0xd
16#define JZ4780_DMA_UART3_TX 0xe
17#define JZ4780_DMA_UART3_RX 0xf
18#define JZ4780_DMA_UART2_TX 0x10
19#define JZ4780_DMA_UART2_RX 0x11
20#define JZ4780_DMA_UART1_TX 0x12
21#define JZ4780_DMA_UART1_RX 0x13
22#define JZ4780_DMA_UART0_TX 0x14
23#define JZ4780_DMA_UART0_RX 0x15
24#define JZ4780_DMA_SSI0_TX 0x16
25#define JZ4780_DMA_SSI0_RX 0x17
26#define JZ4780_DMA_SSI1_TX 0x18
27#define JZ4780_DMA_SSI1_RX 0x19
28#define JZ4780_DMA_MSC0_TX 0x1a
29#define JZ4780_DMA_MSC0_RX 0x1b
30#define JZ4780_DMA_MSC1_TX 0x1c
31#define JZ4780_DMA_MSC1_RX 0x1d
32#define JZ4780_DMA_MSC2_TX 0x1e
33#define JZ4780_DMA_MSC2_RX 0x1f
34#define JZ4780_DMA_PCM0_TX 0x20
35#define JZ4780_DMA_PCM0_RX 0x21
36#define JZ4780_DMA_SMB0_TX 0x24
37#define JZ4780_DMA_SMB0_RX 0x25
38#define JZ4780_DMA_SMB1_TX 0x26
39#define JZ4780_DMA_SMB1_RX 0x27
40#define JZ4780_DMA_SMB2_TX 0x28
41#define JZ4780_DMA_SMB2_RX 0x29
42#define JZ4780_DMA_SMB3_TX 0x2a
43#define JZ4780_DMA_SMB3_RX 0x2b
44#define JZ4780_DMA_SMB4_TX 0x2c
45#define JZ4780_DMA_SMB4_RX 0x2d
46#define JZ4780_DMA_DES_TX 0x2e
47#define JZ4780_DMA_DES_RX 0x2f
48
49#endif /* __DT_BINDINGS_DMA_JZ4780_DMA_H__ */
diff --git a/include/dt-bindings/gpio/meson8b-gpio.h b/include/dt-bindings/gpio/meson8b-gpio.h
new file mode 100644
index 000000000000..c38cb20d7182
--- /dev/null
+++ b/include/dt-bindings/gpio/meson8b-gpio.h
@@ -0,0 +1,32 @@
1/*
2 * GPIO definitions for Amlogic Meson8b SoCs
3 *
4 * Copyright (C) 2015 Endless Mobile, Inc.
5 * Author: Carlo Caione <carlo@endlessm.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program. If not, see <http://www.gnu.org/licenses/>.
13 */
14
15#ifndef _DT_BINDINGS_MESON8B_GPIO_H
16#define _DT_BINDINGS_MESON8B_GPIO_H
17
18#include <dt-bindings/gpio/meson8-gpio.h>
19
20/* GPIO Bank DIF */
21#define DIF_0_P 120
22#define DIF_0_N 121
23#define DIF_1_P 122
24#define DIF_1_N 123
25#define DIF_2_P 124
26#define DIF_2_N 125
27#define DIF_3_P 126
28#define DIF_3_N 127
29#define DIF_4_P 128
30#define DIF_4_N 129
31
32#endif /* _DT_BINDINGS_MESON8B_GPIO_H */
diff --git a/include/dt-bindings/interrupt-controller/irq-st.h b/include/dt-bindings/interrupt-controller/irq-st.h
new file mode 100644
index 000000000000..4c59aceb9be0
--- /dev/null
+++ b/include/dt-bindings/interrupt-controller/irq-st.h
@@ -0,0 +1,30 @@
1/*
2 * include/linux/irqchip/irq-st.h
3 *
4 * Copyright (C) 2014 STMicroelectronics – All Rights Reserved
5 *
6 * Author: Lee Jones <lee.jones@linaro.org>
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 _DT_BINDINGS_INTERRUPT_CONTROLLER_ST_H
14#define _DT_BINDINGS_INTERRUPT_CONTROLLER_ST_H
15
16#define ST_IRQ_SYSCFG_EXT_0 0
17#define ST_IRQ_SYSCFG_EXT_1 1
18#define ST_IRQ_SYSCFG_EXT_2 2
19#define ST_IRQ_SYSCFG_CTI_0 3
20#define ST_IRQ_SYSCFG_CTI_1 4
21#define ST_IRQ_SYSCFG_PMU_0 5
22#define ST_IRQ_SYSCFG_PMU_1 6
23#define ST_IRQ_SYSCFG_pl310_L2 7
24#define ST_IRQ_SYSCFG_DISABLED 0xFFFFFFFF
25
26#define ST_IRQ_SYSCFG_EXT_1_INV 0x1
27#define ST_IRQ_SYSCFG_EXT_2_INV 0x2
28#define ST_IRQ_SYSCFG_EXT_3_INV 0x4
29
30#endif
diff --git a/include/dt-bindings/leds/common.h b/include/dt-bindings/leds/common.h
new file mode 100644
index 000000000000..79fcef72ef57
--- /dev/null
+++ b/include/dt-bindings/leds/common.h
@@ -0,0 +1,21 @@
1/*
2 * This header provides macros for the common LEDs device tree bindings.
3 *
4 * Copyright (C) 2015, Samsung Electronics Co., Ltd.
5 *
6 * Author: Jacek Anaszewski <j.anaszewski@samsung.com>
7 */
8
9#ifndef __DT_BINDINGS_LEDS_H__
10#define __DT_BINDINGS_LEDS_H
11
12/* External trigger type */
13#define LEDS_TRIG_TYPE_EDGE 0
14#define LEDS_TRIG_TYPE_LEVEL 1
15
16/* Boost modes */
17#define LEDS_BOOST_OFF 0
18#define LEDS_BOOST_ADAPTIVE 1
19#define LEDS_BOOST_FIXED 2
20
21#endif /* __DT_BINDINGS_LEDS_H */
diff --git a/include/dt-bindings/media/omap3-isp.h b/include/dt-bindings/media/omap3-isp.h
new file mode 100644
index 000000000000..b18c60e468c7
--- /dev/null
+++ b/include/dt-bindings/media/omap3-isp.h
@@ -0,0 +1,22 @@
1/*
2 * include/dt-bindings/media/omap3-isp.h
3 *
4 * Copyright (C) 2015 Sakari Ailus
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 */
15
16#ifndef __DT_BINDINGS_OMAP3_ISP_H__
17#define __DT_BINDINGS_OMAP3_ISP_H__
18
19#define OMAP3ISP_PHY_TYPE_COMPLEX_IO 0
20#define OMAP3ISP_PHY_TYPE_CSIPHY 1
21
22#endif /* __DT_BINDINGS_OMAP3_ISP_H__ */
diff --git a/include/dt-bindings/media/xilinx-vip.h b/include/dt-bindings/media/xilinx-vip.h
new file mode 100644
index 000000000000..6298fec00685
--- /dev/null
+++ b/include/dt-bindings/media/xilinx-vip.h
@@ -0,0 +1,39 @@
1/*
2 * Xilinx Video IP Core
3 *
4 * Copyright (C) 2013-2015 Ideas on Board
5 * Copyright (C) 2013-2015 Xilinx, Inc.
6 *
7 * Contacts: Hyun Kwon <hyun.kwon@xilinx.com>
8 * Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __DT_BINDINGS_MEDIA_XILINX_VIP_H__
16#define __DT_BINDINGS_MEDIA_XILINX_VIP_H__
17
18/*
19 * Video format codes as defined in "AXI4-Stream Video IP and System Design
20 * Guide".
21 */
22#define XVIP_VF_YUV_422 0
23#define XVIP_VF_YUV_444 1
24#define XVIP_VF_RBG 2
25#define XVIP_VF_YUV_420 3
26#define XVIP_VF_YUVA_422 4
27#define XVIP_VF_YUVA_444 5
28#define XVIP_VF_RGBA 6
29#define XVIP_VF_YUVA_420 7
30#define XVIP_VF_YUVD_422 8
31#define XVIP_VF_YUVD_444 9
32#define XVIP_VF_RGBD 10
33#define XVIP_VF_YUVD_420 11
34#define XVIP_VF_MONO_SENSOR 12
35#define XVIP_VF_CUSTOM2 13
36#define XVIP_VF_CUSTOM3 14
37#define XVIP_VF_CUSTOM4 15
38
39#endif /* __DT_BINDINGS_MEDIA_XILINX_VIP_H__ */
diff --git a/include/linux/mfd/arizona/gpio.h b/include/dt-bindings/mfd/arizona.h
index d2146bb74f89..c7af7c7ef793 100644
--- a/include/linux/mfd/arizona/gpio.h
+++ b/include/dt-bindings/mfd/arizona.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * GPIO configuration for Arizona devices 2 * Device Tree defines for Arizona devices
3 * 3 *
4 * Copyright 2013 Wolfson Microelectronics. PLC. 4 * Copyright 2015 Cirrus Logic Inc.
5 * 5 *
6 * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> 6 * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
7 * 7 *
@@ -10,9 +10,10 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12 12
13#ifndef _ARIZONA_GPIO_H 13#ifndef _DT_BINDINGS_MFD_ARIZONA_H
14#define _ARIZONA_GPIO_H 14#define _DT_BINDINGS_MFD_ARIZONA_H
15 15
16/* GPIO Function Definitions */
16#define ARIZONA_GP_FN_TXLRCLK 0x00 17#define ARIZONA_GP_FN_TXLRCLK 0x00
17#define ARIZONA_GP_FN_GPIO 0x01 18#define ARIZONA_GP_FN_GPIO 0x01
18#define ARIZONA_GP_FN_IRQ1 0x02 19#define ARIZONA_GP_FN_IRQ1 0x02
@@ -61,36 +62,32 @@
61#define ARIZONA_GP_FN_SYSCLK_ENA_STATUS 0x4B 62#define ARIZONA_GP_FN_SYSCLK_ENA_STATUS 0x4B
62#define ARIZONA_GP_FN_ASYNCCLK_ENA_STATUS 0x4C 63#define ARIZONA_GP_FN_ASYNCCLK_ENA_STATUS 0x4C
63 64
64#define ARIZONA_GPN_DIR 0x8000 /* GPN_DIR */ 65/* GPIO Configuration Bits */
65#define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */ 66#define ARIZONA_GPN_DIR 0x8000
66#define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */ 67#define ARIZONA_GPN_PU 0x4000
67#define ARIZONA_GPN_DIR_WIDTH 1 /* GPN_DIR */ 68#define ARIZONA_GPN_PD 0x2000
68#define ARIZONA_GPN_PU 0x4000 /* GPN_PU */ 69#define ARIZONA_GPN_LVL 0x0800
69#define ARIZONA_GPN_PU_MASK 0x4000 /* GPN_PU */ 70#define ARIZONA_GPN_POL 0x0400
70#define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */ 71#define ARIZONA_GPN_OP_CFG 0x0200
71#define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */ 72#define ARIZONA_GPN_DB 0x0100
72#define ARIZONA_GPN_PD 0x2000 /* GPN_PD */ 73
73#define ARIZONA_GPN_PD_MASK 0x2000 /* GPN_PD */ 74/* Provide some defines for the most common configs */
74#define ARIZONA_GPN_PD_SHIFT 13 /* GPN_PD */ 75#define ARIZONA_GP_DEFAULT 0xffffffff
75#define ARIZONA_GPN_PD_WIDTH 1 /* GPN_PD */ 76#define ARIZONA_GP_OUTPUT (ARIZONA_GP_FN_GPIO)
76#define ARIZONA_GPN_LVL 0x0800 /* GPN_LVL */ 77#define ARIZONA_GP_INPUT (ARIZONA_GP_FN_GPIO | \
77#define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */ 78 ARIZONA_GPN_DIR)
78#define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */ 79
79#define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */ 80#define ARIZONA_32KZ_MCLK1 1
80#define ARIZONA_GPN_POL 0x0400 /* GPN_POL */ 81#define ARIZONA_32KZ_MCLK2 2
81#define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */ 82#define ARIZONA_32KZ_NONE 3
82#define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */ 83
83#define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */ 84#define ARIZONA_DMIC_MICVDD 0
84#define ARIZONA_GPN_OP_CFG 0x0200 /* GPN_OP_CFG */ 85#define ARIZONA_DMIC_MICBIAS1 1
85#define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */ 86#define ARIZONA_DMIC_MICBIAS2 2
86#define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */ 87#define ARIZONA_DMIC_MICBIAS3 3
87#define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */ 88
88#define ARIZONA_GPN_DB 0x0100 /* GPN_DB */ 89#define ARIZONA_INMODE_DIFF 0
89#define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */ 90#define ARIZONA_INMODE_SE 1
90#define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */ 91#define ARIZONA_INMODE_DMIC 2
91#define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */
92#define ARIZONA_GPN_FN_MASK 0x007F /* GPN_DB */
93#define ARIZONA_GPN_FN_SHIFT 0 /* GPN_DB */
94#define ARIZONA_GPN_FN_WIDTH 7 /* GPN_DB */
95 92
96#endif 93#endif
diff --git a/include/dt-bindings/mfd/qcom-rpm.h b/include/dt-bindings/mfd/qcom-rpm.h
index 388a6f3d6165..13a9d4bf2662 100644
--- a/include/dt-bindings/mfd/qcom-rpm.h
+++ b/include/dt-bindings/mfd/qcom-rpm.h
@@ -141,6 +141,12 @@
141#define QCOM_RPM_SYS_FABRIC_MODE 131 141#define QCOM_RPM_SYS_FABRIC_MODE 131
142#define QCOM_RPM_USB_OTG_SWITCH 132 142#define QCOM_RPM_USB_OTG_SWITCH 132
143#define QCOM_RPM_VDDMIN_GPIO 133 143#define QCOM_RPM_VDDMIN_GPIO 133
144#define QCOM_RPM_NSS_FABRIC_0_CLK 134
145#define QCOM_RPM_NSS_FABRIC_1_CLK 135
146#define QCOM_RPM_SMB208_S1a 136
147#define QCOM_RPM_SMB208_S1b 137
148#define QCOM_RPM_SMB208_S2a 138
149#define QCOM_RPM_SMB208_S2b 139
144 150
145/* 151/*
146 * Constants used to select force mode for regulators. 152 * Constants used to select force mode for regulators.
diff --git a/include/dt-bindings/phy/phy-miphy365x.h b/include/dt-bindings/phy/phy-miphy365x.h
deleted file mode 100644
index 8ef8aba6edd6..000000000000
--- a/include/dt-bindings/phy/phy-miphy365x.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * This header provides constants for the phy framework
3 * based on the STMicroelectronics MiPHY365x.
4 *
5 * Author: Lee Jones <lee.jones@linaro.org>
6 */
7#ifndef _DT_BINDINGS_PHY_MIPHY
8#define _DT_BINDINGS_PHY_MIPHY
9
10#define MIPHY_TYPE_SATA 1
11#define MIPHY_TYPE_PCIE 2
12#define MIPHY_TYPE_USB 3
13
14#endif /* _DT_BINDINGS_PHY_MIPHY */
diff --git a/include/dt-bindings/pinctrl/am33xx.h b/include/dt-bindings/pinctrl/am33xx.h
index 2fbc804e1a45..226f77246a70 100644
--- a/include/dt-bindings/pinctrl/am33xx.h
+++ b/include/dt-bindings/pinctrl/am33xx.h
@@ -13,7 +13,8 @@
13 13
14#define PULL_DISABLE (1 << 3) 14#define PULL_DISABLE (1 << 3)
15#define INPUT_EN (1 << 5) 15#define INPUT_EN (1 << 5)
16#define SLEWCTRL_FAST (1 << 6) 16#define SLEWCTRL_SLOW (1 << 6)
17#define SLEWCTRL_FAST 0
17 18
18/* update macro depending on INPUT_EN and PULL_ENA */ 19/* update macro depending on INPUT_EN and PULL_ENA */
19#undef PIN_OUTPUT 20#undef PIN_OUTPUT
diff --git a/include/dt-bindings/pinctrl/am43xx.h b/include/dt-bindings/pinctrl/am43xx.h
index 9c2e4f82381e..5f4d01898c9c 100644
--- a/include/dt-bindings/pinctrl/am43xx.h
+++ b/include/dt-bindings/pinctrl/am43xx.h
@@ -18,7 +18,8 @@
18#define PULL_DISABLE (1 << 16) 18#define PULL_DISABLE (1 << 16)
19#define PULL_UP (1 << 17) 19#define PULL_UP (1 << 17)
20#define INPUT_EN (1 << 18) 20#define INPUT_EN (1 << 18)
21#define SLEWCTRL_FAST (1 << 19) 21#define SLEWCTRL_SLOW (1 << 19)
22#define SLEWCTRL_FAST 0
22#define DS0_PULL_UP_DOWN_EN (1 << 27) 23#define DS0_PULL_UP_DOWN_EN (1 << 27)
23 24
24#define PIN_OUTPUT (PULL_DISABLE) 25#define PIN_OUTPUT (PULL_DISABLE)
diff --git a/include/dt-bindings/pinctrl/mt65xx.h b/include/dt-bindings/pinctrl/mt65xx.h
new file mode 100644
index 000000000000..1198f4541327
--- /dev/null
+++ b/include/dt-bindings/pinctrl/mt65xx.h
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Hongzhou.Yang <hongzhou.yang@mediatek.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef _DT_BINDINGS_PINCTRL_MT65XX_H
16#define _DT_BINDINGS_PINCTRL_MT65XX_H
17
18#define MTK_PIN_NO(x) ((x) << 8)
19#define MTK_GET_PIN_NO(x) ((x) >> 8)
20#define MTK_GET_PIN_FUNC(x) ((x) & 0xf)
21
22#define MTK_PUPD_SET_R1R0_00 100
23#define MTK_PUPD_SET_R1R0_01 101
24#define MTK_PUPD_SET_R1R0_10 102
25#define MTK_PUPD_SET_R1R0_11 103
26
27#define MTK_DRIVE_2mA 2
28#define MTK_DRIVE_4mA 4
29#define MTK_DRIVE_6mA 6
30#define MTK_DRIVE_8mA 8
31#define MTK_DRIVE_10mA 10
32#define MTK_DRIVE_12mA 12
33#define MTK_DRIVE_14mA 14
34#define MTK_DRIVE_16mA 16
35#define MTK_DRIVE_20mA 20
36#define MTK_DRIVE_24mA 24
37#define MTK_DRIVE_28mA 28
38#define MTK_DRIVE_32mA 32
39
40#endif /* _DT_BINDINGS_PINCTRL_MT65XX_H */
diff --git a/include/dt-bindings/pinctrl/qcom,pmic-gpio.h b/include/dt-bindings/pinctrl/qcom,pmic-gpio.h
index fa74d7cc960c..aafa76cb569d 100644
--- a/include/dt-bindings/pinctrl/qcom,pmic-gpio.h
+++ b/include/dt-bindings/pinctrl/qcom,pmic-gpio.h
@@ -48,6 +48,14 @@
48#define PM8058_GPIO_L5 6 48#define PM8058_GPIO_L5 6
49#define PM8058_GPIO_L2 7 49#define PM8058_GPIO_L2 7
50 50
51/*
52 * Note: PM8916 GPIO1 and GPIO2 are supporting
53 * only L2(1.15V) and L5(1.8V) options
54 */
55#define PM8916_GPIO_VPH 0
56#define PM8916_GPIO_L2 2
57#define PM8916_GPIO_L5 3
58
51#define PM8917_GPIO_VPH 0 59#define PM8917_GPIO_VPH 0
52#define PM8917_GPIO_S4 2 60#define PM8917_GPIO_S4 2
53#define PM8917_GPIO_L15 3 61#define PM8917_GPIO_L15 3
@@ -115,6 +123,13 @@
115#define PM8058_GPIO39_MP3_CLK PMIC_GPIO_FUNC_FUNC1 123#define PM8058_GPIO39_MP3_CLK PMIC_GPIO_FUNC_FUNC1
116#define PM8058_GPIO40_EXT_BB_EN PMIC_GPIO_FUNC_FUNC1 124#define PM8058_GPIO40_EXT_BB_EN PMIC_GPIO_FUNC_FUNC1
117 125
126#define PM8916_GPIO1_BAT_ALRM_OUT PMIC_GPIO_FUNC_FUNC1
127#define PM8916_GPIO1_KEYP_DRV PMIC_GPIO_FUNC_FUNC2
128#define PM8916_GPIO2_DIV_CLK PMIC_GPIO_FUNC_FUNC1
129#define PM8916_GPIO2_SLEEP_CLK PMIC_GPIO_FUNC_FUNC2
130#define PM8916_GPIO3_KEYP_DRV PMIC_GPIO_FUNC_FUNC1
131#define PM8916_GPIO4_KEYP_DRV PMIC_GPIO_FUNC_FUNC2
132
118#define PM8917_GPIO9_18_KEYP_DRV PMIC_GPIO_FUNC_FUNC1 133#define PM8917_GPIO9_18_KEYP_DRV PMIC_GPIO_FUNC_FUNC1
119#define PM8917_GPIO20_BAT_ALRM_OUT PMIC_GPIO_FUNC_FUNC1 134#define PM8917_GPIO20_BAT_ALRM_OUT PMIC_GPIO_FUNC_FUNC1
120#define PM8917_GPIO21_23_UART_TX PMIC_GPIO_FUNC_FUNC2 135#define PM8917_GPIO21_23_UART_TX PMIC_GPIO_FUNC_FUNC2
diff --git a/include/dt-bindings/pinctrl/qcom,pmic-mpp.h b/include/dt-bindings/pinctrl/qcom,pmic-mpp.h
index d2c7dabe3223..c10205491f8d 100644
--- a/include/dt-bindings/pinctrl/qcom,pmic-mpp.h
+++ b/include/dt-bindings/pinctrl/qcom,pmic-mpp.h
@@ -10,6 +10,10 @@
10#define PM8841_MPP_VPH 0 10#define PM8841_MPP_VPH 0
11#define PM8841_MPP_S3 2 11#define PM8841_MPP_S3 2
12 12
13#define PM8916_MPP_VPH 0
14#define PM8916_MPP_L2 2
15#define PM8916_MPP_L5 3
16
13#define PM8941_MPP_VPH 0 17#define PM8941_MPP_VPH 0
14#define PM8941_MPP_L1 1 18#define PM8941_MPP_L1 1
15#define PM8941_MPP_S3 2 19#define PM8941_MPP_S3 2
diff --git a/include/dt-bindings/reset/qcom,gcc-msm8916.h b/include/dt-bindings/reset/qcom,gcc-msm8916.h
new file mode 100644
index 000000000000..3d90410f09c7
--- /dev/null
+++ b/include/dt-bindings/reset/qcom,gcc-msm8916.h
@@ -0,0 +1,108 @@
1/*
2 * Copyright 2015 Linaro Limited
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _DT_BINDINGS_RESET_MSM_GCC_8916_H
15#define _DT_BINDINGS_RESET_MSM_GCC_8916_H
16
17#define GCC_BLSP1_BCR 0
18#define GCC_BLSP1_QUP1_BCR 1
19#define GCC_BLSP1_UART1_BCR 2
20#define GCC_BLSP1_QUP2_BCR 3
21#define GCC_BLSP1_UART2_BCR 4
22#define GCC_BLSP1_QUP3_BCR 5
23#define GCC_BLSP1_QUP4_BCR 6
24#define GCC_BLSP1_QUP5_BCR 7
25#define GCC_BLSP1_QUP6_BCR 8
26#define GCC_IMEM_BCR 9
27#define GCC_SMMU_BCR 10
28#define GCC_APSS_TCU_BCR 11
29#define GCC_SMMU_XPU_BCR 12
30#define GCC_PCNOC_TBU_BCR 13
31#define GCC_PRNG_BCR 14
32#define GCC_BOOT_ROM_BCR 15
33#define GCC_CRYPTO_BCR 16
34#define GCC_SEC_CTRL_BCR 17
35#define GCC_AUDIO_CORE_BCR 18
36#define GCC_ULT_AUDIO_BCR 19
37#define GCC_DEHR_BCR 20
38#define GCC_SYSTEM_NOC_BCR 21
39#define GCC_PCNOC_BCR 22
40#define GCC_TCSR_BCR 23
41#define GCC_QDSS_BCR 24
42#define GCC_DCD_BCR 25
43#define GCC_MSG_RAM_BCR 26
44#define GCC_MPM_BCR 27
45#define GCC_SPMI_BCR 28
46#define GCC_SPDM_BCR 29
47#define GCC_MM_SPDM_BCR 30
48#define GCC_BIMC_BCR 31
49#define GCC_RBCPR_BCR 32
50#define GCC_TLMM_BCR 33
51#define GCC_USB_HS_BCR 34
52#define GCC_USB2A_PHY_BCR 35
53#define GCC_SDCC1_BCR 36
54#define GCC_SDCC2_BCR 37
55#define GCC_PDM_BCR 38
56#define GCC_SNOC_BUS_TIMEOUT0_BCR 39
57#define GCC_PCNOC_BUS_TIMEOUT0_BCR 40
58#define GCC_PCNOC_BUS_TIMEOUT1_BCR 41
59#define GCC_PCNOC_BUS_TIMEOUT2_BCR 42
60#define GCC_PCNOC_BUS_TIMEOUT3_BCR 43
61#define GCC_PCNOC_BUS_TIMEOUT4_BCR 44
62#define GCC_PCNOC_BUS_TIMEOUT5_BCR 45
63#define GCC_PCNOC_BUS_TIMEOUT6_BCR 46
64#define GCC_PCNOC_BUS_TIMEOUT7_BCR 47
65#define GCC_PCNOC_BUS_TIMEOUT8_BCR 48
66#define GCC_PCNOC_BUS_TIMEOUT9_BCR 49
67#define GCC_MMSS_BCR 50
68#define GCC_VENUS0_BCR 51
69#define GCC_MDSS_BCR 52
70#define GCC_CAMSS_PHY0_BCR 53
71#define GCC_CAMSS_CSI0_BCR 54
72#define GCC_CAMSS_CSI0PHY_BCR 55
73#define GCC_CAMSS_CSI0RDI_BCR 56
74#define GCC_CAMSS_CSI0PIX_BCR 57
75#define GCC_CAMSS_PHY1_BCR 58
76#define GCC_CAMSS_CSI1_BCR 59
77#define GCC_CAMSS_CSI1PHY_BCR 60
78#define GCC_CAMSS_CSI1RDI_BCR 61
79#define GCC_CAMSS_CSI1PIX_BCR 62
80#define GCC_CAMSS_ISPIF_BCR 63
81#define GCC_CAMSS_CCI_BCR 64
82#define GCC_CAMSS_MCLK0_BCR 65
83#define GCC_CAMSS_MCLK1_BCR 66
84#define GCC_CAMSS_GP0_BCR 67
85#define GCC_CAMSS_GP1_BCR 68
86#define GCC_CAMSS_TOP_BCR 69
87#define GCC_CAMSS_MICRO_BCR 70
88#define GCC_CAMSS_JPEG_BCR 71
89#define GCC_CAMSS_VFE_BCR 72
90#define GCC_CAMSS_CSI_VFE0_BCR 73
91#define GCC_OXILI_BCR 74
92#define GCC_GMEM_BCR 75
93#define GCC_CAMSS_AHB_BCR 76
94#define GCC_MDP_TBU_BCR 77
95#define GCC_GFX_TBU_BCR 78
96#define GCC_GFX_TCU_BCR 79
97#define GCC_MSS_TBU_AXI_BCR 80
98#define GCC_MSS_TBU_GSS_AXI_BCR 81
99#define GCC_MSS_TBU_Q6_AXI_BCR 82
100#define GCC_GTCU_AHB_BCR 83
101#define GCC_SMMU_CFG_BCR 84
102#define GCC_VFE_TBU_BCR 85
103#define GCC_VENUS_TBU_BCR 86
104#define GCC_JPEG_TBU_BCR 87
105#define GCC_PRONTO_TBU_BCR 88
106#define GCC_SMMU_CATS_BCR 89
107
108#endif
diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h
index b3f45a578344..e5966758c093 100644
--- a/include/kvm/arm_arch_timer.h
+++ b/include/kvm/arm_arch_timer.h
@@ -24,17 +24,14 @@
24#include <linux/workqueue.h> 24#include <linux/workqueue.h>
25 25
26struct arch_timer_kvm { 26struct arch_timer_kvm {
27#ifdef CONFIG_KVM_ARM_TIMER
28 /* Is the timer enabled */ 27 /* Is the timer enabled */
29 bool enabled; 28 bool enabled;
30 29
31 /* Virtual offset */ 30 /* Virtual offset */
32 cycle_t cntvoff; 31 cycle_t cntvoff;
33#endif
34}; 32};
35 33
36struct arch_timer_cpu { 34struct arch_timer_cpu {
37#ifdef CONFIG_KVM_ARM_TIMER
38 /* Registers: control register, timer value */ 35 /* Registers: control register, timer value */
39 u32 cntv_ctl; /* Saved/restored */ 36 u32 cntv_ctl; /* Saved/restored */
40 cycle_t cntv_cval; /* Saved/restored */ 37 cycle_t cntv_cval; /* Saved/restored */
@@ -55,10 +52,8 @@ struct arch_timer_cpu {
55 52
56 /* Timer IRQ */ 53 /* Timer IRQ */
57 const struct kvm_irq_level *irq; 54 const struct kvm_irq_level *irq;
58#endif
59}; 55};
60 56
61#ifdef CONFIG_KVM_ARM_TIMER
62int kvm_timer_hyp_init(void); 57int kvm_timer_hyp_init(void);
63void kvm_timer_enable(struct kvm *kvm); 58void kvm_timer_enable(struct kvm *kvm);
64void kvm_timer_init(struct kvm *kvm); 59void kvm_timer_init(struct kvm *kvm);
@@ -72,30 +67,6 @@ void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu);
72u64 kvm_arm_timer_get_reg(struct kvm_vcpu *, u64 regid); 67u64 kvm_arm_timer_get_reg(struct kvm_vcpu *, u64 regid);
73int kvm_arm_timer_set_reg(struct kvm_vcpu *, u64 regid, u64 value); 68int kvm_arm_timer_set_reg(struct kvm_vcpu *, u64 regid, u64 value);
74 69
75#else 70bool kvm_timer_should_fire(struct kvm_vcpu *vcpu);
76static inline int kvm_timer_hyp_init(void)
77{
78 return 0;
79};
80
81static inline void kvm_timer_enable(struct kvm *kvm) {}
82static inline void kvm_timer_init(struct kvm *kvm) {}
83static inline void kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu,
84 const struct kvm_irq_level *irq) {}
85static inline void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu) {}
86static inline void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu) {}
87static inline void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu) {}
88static inline void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu) {}
89
90static inline int kvm_arm_timer_set_reg(struct kvm_vcpu *vcpu, u64 regid, u64 value)
91{
92 return 0;
93}
94
95static inline u64 kvm_arm_timer_get_reg(struct kvm_vcpu *vcpu, u64 regid)
96{
97 return 0;
98}
99#endif
100 71
101#endif 72#endif
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index 7c55dd5dd2c9..133ea00aa83b 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -24,6 +24,7 @@
24#include <linux/irqreturn.h> 24#include <linux/irqreturn.h>
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/types.h> 26#include <linux/types.h>
27#include <kvm/iodev.h>
27 28
28#define VGIC_NR_IRQS_LEGACY 256 29#define VGIC_NR_IRQS_LEGACY 256
29#define VGIC_NR_SGIS 16 30#define VGIC_NR_SGIS 16
@@ -114,6 +115,7 @@ struct vgic_ops {
114 void (*sync_lr_elrsr)(struct kvm_vcpu *, int, struct vgic_lr); 115 void (*sync_lr_elrsr)(struct kvm_vcpu *, int, struct vgic_lr);
115 u64 (*get_elrsr)(const struct kvm_vcpu *vcpu); 116 u64 (*get_elrsr)(const struct kvm_vcpu *vcpu);
116 u64 (*get_eisr)(const struct kvm_vcpu *vcpu); 117 u64 (*get_eisr)(const struct kvm_vcpu *vcpu);
118 void (*clear_eisr)(struct kvm_vcpu *vcpu);
117 u32 (*get_interrupt_status)(const struct kvm_vcpu *vcpu); 119 u32 (*get_interrupt_status)(const struct kvm_vcpu *vcpu);
118 void (*enable_underflow)(struct kvm_vcpu *vcpu); 120 void (*enable_underflow)(struct kvm_vcpu *vcpu);
119 void (*disable_underflow)(struct kvm_vcpu *vcpu); 121 void (*disable_underflow)(struct kvm_vcpu *vcpu);
@@ -139,16 +141,21 @@ struct vgic_params {
139}; 141};
140 142
141struct vgic_vm_ops { 143struct vgic_vm_ops {
142 bool (*handle_mmio)(struct kvm_vcpu *, struct kvm_run *,
143 struct kvm_exit_mmio *);
144 bool (*queue_sgi)(struct kvm_vcpu *, int irq); 144 bool (*queue_sgi)(struct kvm_vcpu *, int irq);
145 void (*add_sgi_source)(struct kvm_vcpu *, int irq, int source); 145 void (*add_sgi_source)(struct kvm_vcpu *, int irq, int source);
146 int (*init_model)(struct kvm *); 146 int (*init_model)(struct kvm *);
147 int (*map_resources)(struct kvm *, const struct vgic_params *); 147 int (*map_resources)(struct kvm *, const struct vgic_params *);
148}; 148};
149 149
150struct vgic_io_device {
151 gpa_t addr;
152 int len;
153 const struct vgic_io_range *reg_ranges;
154 struct kvm_vcpu *redist_vcpu;
155 struct kvm_io_device dev;
156};
157
150struct vgic_dist { 158struct vgic_dist {
151#ifdef CONFIG_KVM_ARM_VGIC
152 spinlock_t lock; 159 spinlock_t lock;
153 bool in_kernel; 160 bool in_kernel;
154 bool ready; 161 bool ready;
@@ -196,6 +203,9 @@ struct vgic_dist {
196 /* Level-triggered interrupt queued on VCPU interface */ 203 /* Level-triggered interrupt queued on VCPU interface */
197 struct vgic_bitmap irq_queued; 204 struct vgic_bitmap irq_queued;
198 205
206 /* Interrupt was active when unqueue from VCPU interface */
207 struct vgic_bitmap irq_active;
208
199 /* Interrupt priority. Not used yet. */ 209 /* Interrupt priority. Not used yet. */
200 struct vgic_bytemap irq_priority; 210 struct vgic_bytemap irq_priority;
201 211
@@ -236,8 +246,12 @@ struct vgic_dist {
236 /* Bitmap indicating which CPU has something pending */ 246 /* Bitmap indicating which CPU has something pending */
237 unsigned long *irq_pending_on_cpu; 247 unsigned long *irq_pending_on_cpu;
238 248
249 /* Bitmap indicating which CPU has active IRQs */
250 unsigned long *irq_active_on_cpu;
251
239 struct vgic_vm_ops vm_ops; 252 struct vgic_vm_ops vm_ops;
240#endif 253 struct vgic_io_device dist_iodev;
254 struct vgic_io_device *redist_iodevs;
241}; 255};
242 256
243struct vgic_v2_cpu_if { 257struct vgic_v2_cpu_if {
@@ -265,13 +279,18 @@ struct vgic_v3_cpu_if {
265}; 279};
266 280
267struct vgic_cpu { 281struct vgic_cpu {
268#ifdef CONFIG_KVM_ARM_VGIC
269 /* per IRQ to LR mapping */ 282 /* per IRQ to LR mapping */
270 u8 *vgic_irq_lr_map; 283 u8 *vgic_irq_lr_map;
271 284
272 /* Pending interrupts on this VCPU */ 285 /* Pending/active/both interrupts on this VCPU */
273 DECLARE_BITMAP( pending_percpu, VGIC_NR_PRIVATE_IRQS); 286 DECLARE_BITMAP( pending_percpu, VGIC_NR_PRIVATE_IRQS);
287 DECLARE_BITMAP( active_percpu, VGIC_NR_PRIVATE_IRQS);
288 DECLARE_BITMAP( pend_act_percpu, VGIC_NR_PRIVATE_IRQS);
289
290 /* Pending/active/both shared interrupts, dynamically sized */
274 unsigned long *pending_shared; 291 unsigned long *pending_shared;
292 unsigned long *active_shared;
293 unsigned long *pend_act_shared;
275 294
276 /* Bitmap of used/free list registers */ 295 /* Bitmap of used/free list registers */
277 DECLARE_BITMAP( lr_used, VGIC_V2_MAX_LRS); 296 DECLARE_BITMAP( lr_used, VGIC_V2_MAX_LRS);
@@ -284,7 +303,6 @@ struct vgic_cpu {
284 struct vgic_v2_cpu_if vgic_v2; 303 struct vgic_v2_cpu_if vgic_v2;
285 struct vgic_v3_cpu_if vgic_v3; 304 struct vgic_v3_cpu_if vgic_v3;
286 }; 305 };
287#endif
288}; 306};
289 307
290#define LR_EMPTY 0xff 308#define LR_EMPTY 0xff
@@ -294,10 +312,7 @@ struct vgic_cpu {
294 312
295struct kvm; 313struct kvm;
296struct kvm_vcpu; 314struct kvm_vcpu;
297struct kvm_run;
298struct kvm_exit_mmio;
299 315
300#ifdef CONFIG_KVM_ARM_VGIC
301int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write); 316int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write);
302int kvm_vgic_hyp_init(void); 317int kvm_vgic_hyp_init(void);
303int kvm_vgic_map_resources(struct kvm *kvm); 318int kvm_vgic_map_resources(struct kvm *kvm);
@@ -311,8 +326,7 @@ int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num,
311 bool level); 326 bool level);
312void vgic_v3_dispatch_sgi(struct kvm_vcpu *vcpu, u64 reg); 327void vgic_v3_dispatch_sgi(struct kvm_vcpu *vcpu, u64 reg);
313int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu); 328int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu);
314bool vgic_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run, 329int kvm_vgic_vcpu_active_irq(struct kvm_vcpu *vcpu);
315 struct kvm_exit_mmio *mmio);
316 330
317#define irqchip_in_kernel(k) (!!((k)->arch.vgic.in_kernel)) 331#define irqchip_in_kernel(k) (!!((k)->arch.vgic.in_kernel))
318#define vgic_initialized(k) (!!((k)->arch.vgic.nr_cpus)) 332#define vgic_initialized(k) (!!((k)->arch.vgic.nr_cpus))
@@ -334,84 +348,4 @@ static inline int vgic_v3_probe(struct device_node *vgic_node,
334} 348}
335#endif 349#endif
336 350
337#else
338static inline int kvm_vgic_hyp_init(void)
339{
340 return 0;
341}
342
343static inline int kvm_vgic_set_addr(struct kvm *kvm, unsigned long type, u64 addr)
344{
345 return 0;
346}
347
348static inline int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write)
349{
350 return -ENXIO;
351}
352
353static inline int kvm_vgic_map_resources(struct kvm *kvm)
354{
355 return 0;
356}
357
358static inline int kvm_vgic_create(struct kvm *kvm, u32 type)
359{
360 return 0;
361}
362
363static inline void kvm_vgic_destroy(struct kvm *kvm)
364{
365}
366
367static inline void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)
368{
369}
370
371static inline int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu)
372{
373 return 0;
374}
375
376static inline void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu) {}
377static inline void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) {}
378
379static inline int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid,
380 unsigned int irq_num, bool level)
381{
382 return 0;
383}
384
385static inline int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu)
386{
387 return 0;
388}
389
390static inline bool vgic_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run,
391 struct kvm_exit_mmio *mmio)
392{
393 return false;
394}
395
396static inline int irqchip_in_kernel(struct kvm *kvm)
397{
398 return 0;
399}
400
401static inline bool vgic_initialized(struct kvm *kvm)
402{
403 return true;
404}
405
406static inline bool vgic_ready(struct kvm *kvm)
407{
408 return true;
409}
410
411static inline int kvm_vgic_get_max_vcpus(void)
412{
413 return KVM_MAX_VCPUS;
414}
415#endif
416
417#endif 351#endif
diff --git a/include/kvm/iodev.h b/include/kvm/iodev.h
new file mode 100644
index 000000000000..a6d208b916f5
--- /dev/null
+++ b/include/kvm/iodev.h
@@ -0,0 +1,76 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program. If not, see <http://www.gnu.org/licenses/>.
13 */
14
15#ifndef __KVM_IODEV_H__
16#define __KVM_IODEV_H__
17
18#include <linux/kvm_types.h>
19#include <linux/errno.h>
20
21struct kvm_io_device;
22struct kvm_vcpu;
23
24/**
25 * kvm_io_device_ops are called under kvm slots_lock.
26 * read and write handlers return 0 if the transaction has been handled,
27 * or non-zero to have it passed to the next device.
28 **/
29struct kvm_io_device_ops {
30 int (*read)(struct kvm_vcpu *vcpu,
31 struct kvm_io_device *this,
32 gpa_t addr,
33 int len,
34 void *val);
35 int (*write)(struct kvm_vcpu *vcpu,
36 struct kvm_io_device *this,
37 gpa_t addr,
38 int len,
39 const void *val);
40 void (*destructor)(struct kvm_io_device *this);
41};
42
43
44struct kvm_io_device {
45 const struct kvm_io_device_ops *ops;
46};
47
48static inline void kvm_iodevice_init(struct kvm_io_device *dev,
49 const struct kvm_io_device_ops *ops)
50{
51 dev->ops = ops;
52}
53
54static inline int kvm_iodevice_read(struct kvm_vcpu *vcpu,
55 struct kvm_io_device *dev, gpa_t addr,
56 int l, void *v)
57{
58 return dev->ops->read ? dev->ops->read(vcpu, dev, addr, l, v)
59 : -EOPNOTSUPP;
60}
61
62static inline int kvm_iodevice_write(struct kvm_vcpu *vcpu,
63 struct kvm_io_device *dev, gpa_t addr,
64 int l, const void *v)
65{
66 return dev->ops->write ? dev->ops->write(vcpu, dev, addr, l, v)
67 : -EOPNOTSUPP;
68}
69
70static inline void kvm_iodevice_destructor(struct kvm_io_device *dev)
71{
72 if (dev->ops->destructor)
73 dev->ops->destructor(dev);
74}
75
76#endif /* __KVM_IODEV_H__ */
diff --git a/include/linux/a.out.h b/include/linux/a.out.h
index 220f14338895..ee884168989f 100644
--- a/include/linux/a.out.h
+++ b/include/linux/a.out.h
@@ -4,44 +4,6 @@
4#include <uapi/linux/a.out.h> 4#include <uapi/linux/a.out.h>
5 5
6#ifndef __ASSEMBLY__ 6#ifndef __ASSEMBLY__
7#if defined (M_OLDSUN2)
8#else
9#endif
10#if defined (M_68010)
11#else
12#endif
13#if defined (M_68020)
14#else
15#endif
16#if defined (M_SPARC)
17#else
18#endif
19#if !defined (N_MAGIC)
20#endif
21#if !defined (N_BADMAG)
22#endif
23#if !defined (N_TXTOFF)
24#endif
25#if !defined (N_DATOFF)
26#endif
27#if !defined (N_TRELOFF)
28#endif
29#if !defined (N_DRELOFF)
30#endif
31#if !defined (N_SYMOFF)
32#endif
33#if !defined (N_STROFF)
34#endif
35#if !defined (N_TXTADDR)
36#endif
37#if defined(vax) || defined(hp300) || defined(pyr)
38#endif
39#ifdef sony
40#endif /* Sony. */
41#ifdef is68k
42#endif
43#if defined(m68k) && defined(PORTAR)
44#endif
45#ifdef linux 7#ifdef linux
46#include <asm/page.h> 8#include <asm/page.h>
47#if defined(__i386__) || defined(__mc68000__) 9#if defined(__i386__) || defined(__mc68000__)
@@ -51,34 +13,5 @@
51#endif 13#endif
52#endif 14#endif
53#endif 15#endif
54#ifndef N_DATADDR
55#endif
56#if !defined (N_BSSADDR)
57#endif
58#if !defined (N_NLIST_DECLARED)
59#endif /* no N_NLIST_DECLARED. */
60#if !defined (N_UNDF)
61#endif
62#if !defined (N_ABS)
63#endif
64#if !defined (N_TEXT)
65#endif
66#if !defined (N_DATA)
67#endif
68#if !defined (N_BSS)
69#endif
70#if !defined (N_FN)
71#endif
72#if !defined (N_EXT)
73#endif
74#if !defined (N_TYPE)
75#endif
76#if !defined (N_STAB)
77#endif
78#if !defined (N_RELOCATION_INFO_DECLARED)
79#ifdef NS32K
80#else
81#endif
82#endif /* no N_RELOCATION_INFO_DECLARED. */
83#endif /*__ASSEMBLY__ */ 16#endif /*__ASSEMBLY__ */
84#endif /* __A_OUT_GNU_H__ */ 17#endif /* __A_OUT_GNU_H__ */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 24c7aa8b1d20..e4da5e35e29c 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -53,10 +53,16 @@ static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
53 return adev ? adev->handle : NULL; 53 return adev ? adev->handle : NULL;
54} 54}
55 55
56#define ACPI_COMPANION(dev) ((dev)->acpi_node.companion) 56#define ACPI_COMPANION(dev) acpi_node((dev)->fwnode)
57#define ACPI_COMPANION_SET(dev, adev) ACPI_COMPANION(dev) = (adev) 57#define ACPI_COMPANION_SET(dev, adev) set_primary_fwnode(dev, (adev) ? \
58 acpi_fwnode_handle(adev) : NULL)
58#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev)) 59#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
59 60
61static inline bool has_acpi_companion(struct device *dev)
62{
63 return is_acpi_node(dev->fwnode);
64}
65
60static inline void acpi_preset_companion(struct device *dev, 66static inline void acpi_preset_companion(struct device *dev,
61 struct acpi_device *parent, u64 addr) 67 struct acpi_device *parent, u64 addr)
62{ 68{
@@ -73,6 +79,7 @@ enum acpi_irq_model_id {
73 ACPI_IRQ_MODEL_IOAPIC, 79 ACPI_IRQ_MODEL_IOAPIC,
74 ACPI_IRQ_MODEL_IOSAPIC, 80 ACPI_IRQ_MODEL_IOSAPIC,
75 ACPI_IRQ_MODEL_PLATFORM, 81 ACPI_IRQ_MODEL_PLATFORM,
82 ACPI_IRQ_MODEL_GIC,
76 ACPI_IRQ_MODEL_COUNT 83 ACPI_IRQ_MODEL_COUNT
77}; 84};
78 85
@@ -146,9 +153,14 @@ void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa);
146int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); 153int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
147void acpi_numa_arch_fixup(void); 154void acpi_numa_arch_fixup(void);
148 155
156#ifndef PHYS_CPUID_INVALID
157typedef u32 phys_cpuid_t;
158#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1)
159#endif
160
149#ifdef CONFIG_ACPI_HOTPLUG_CPU 161#ifdef CONFIG_ACPI_HOTPLUG_CPU
150/* Arch dependent functions for cpu hotplug support */ 162/* Arch dependent functions for cpu hotplug support */
151int acpi_map_cpu(acpi_handle handle, int physid, int *pcpu); 163int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu);
152int acpi_unmap_cpu(int cpu); 164int acpi_unmap_cpu(int cpu);
153#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 165#endif /* CONFIG_ACPI_HOTPLUG_CPU */
154 166
@@ -471,6 +483,11 @@ static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
471 return NULL; 483 return NULL;
472} 484}
473 485
486static inline bool has_acpi_companion(struct device *dev)
487{
488 return false;
489}
490
474static inline const char *acpi_dev_name(struct acpi_device *adev) 491static inline const char *acpi_dev_name(struct acpi_device *adev)
475{ 492{
476 return NULL; 493 return NULL;
diff --git a/include/linux/acpi_irq.h b/include/linux/acpi_irq.h
new file mode 100644
index 000000000000..f10c87265855
--- /dev/null
+++ b/include/linux/acpi_irq.h
@@ -0,0 +1,10 @@
1#ifndef _LINUX_ACPI_IRQ_H
2#define _LINUX_ACPI_IRQ_H
3
4#include <linux/irq.h>
5
6#ifndef acpi_irq_init
7static inline void acpi_irq_init(void) { }
8#endif
9
10#endif /* _LINUX_ACPI_IRQ_H */
diff --git a/include/linux/aio.h b/include/linux/aio.h
index d9c92daa3944..9eb42dbc5582 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -1,86 +1,23 @@
1#ifndef __LINUX__AIO_H 1#ifndef __LINUX__AIO_H
2#define __LINUX__AIO_H 2#define __LINUX__AIO_H
3 3
4#include <linux/list.h>
5#include <linux/workqueue.h>
6#include <linux/aio_abi.h> 4#include <linux/aio_abi.h>
7#include <linux/uio.h>
8#include <linux/rcupdate.h>
9
10#include <linux/atomic.h>
11 5
12struct kioctx; 6struct kioctx;
13struct kiocb; 7struct kiocb;
8struct mm_struct;
14 9
15#define KIOCB_KEY 0 10#define KIOCB_KEY 0
16 11
17/*
18 * We use ki_cancel == KIOCB_CANCELLED to indicate that a kiocb has been either
19 * cancelled or completed (this makes a certain amount of sense because
20 * successful cancellation - io_cancel() - does deliver the completion to
21 * userspace).
22 *
23 * And since most things don't implement kiocb cancellation and we'd really like
24 * kiocb completion to be lockless when possible, we use ki_cancel to
25 * synchronize cancellation and completion - we only set it to KIOCB_CANCELLED
26 * with xchg() or cmpxchg(), see batch_complete_aio() and kiocb_cancel().
27 */
28#define KIOCB_CANCELLED ((void *) (~0ULL))
29
30typedef int (kiocb_cancel_fn)(struct kiocb *); 12typedef int (kiocb_cancel_fn)(struct kiocb *);
31 13
32struct kiocb {
33 struct file *ki_filp;
34 struct kioctx *ki_ctx; /* NULL for sync ops */
35 kiocb_cancel_fn *ki_cancel;
36 void *private;
37
38 union {
39 void __user *user;
40 struct task_struct *tsk;
41 } ki_obj;
42
43 __u64 ki_user_data; /* user's data for completion */
44 loff_t ki_pos;
45 size_t ki_nbytes; /* copy of iocb->aio_nbytes */
46
47 struct list_head ki_list; /* the aio core uses this
48 * for cancellation */
49
50 /*
51 * If the aio_resfd field of the userspace iocb is not zero,
52 * this is the underlying eventfd context to deliver events to.
53 */
54 struct eventfd_ctx *ki_eventfd;
55};
56
57static inline bool is_sync_kiocb(struct kiocb *kiocb)
58{
59 return kiocb->ki_ctx == NULL;
60}
61
62static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
63{
64 *kiocb = (struct kiocb) {
65 .ki_ctx = NULL,
66 .ki_filp = filp,
67 .ki_obj.tsk = current,
68 };
69}
70
71/* prototypes */ 14/* prototypes */
72#ifdef CONFIG_AIO 15#ifdef CONFIG_AIO
73extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);
74extern void aio_complete(struct kiocb *iocb, long res, long res2);
75struct mm_struct;
76extern void exit_aio(struct mm_struct *mm); 16extern void exit_aio(struct mm_struct *mm);
77extern long do_io_submit(aio_context_t ctx_id, long nr, 17extern long do_io_submit(aio_context_t ctx_id, long nr,
78 struct iocb __user *__user *iocbpp, bool compat); 18 struct iocb __user *__user *iocbpp, bool compat);
79void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel); 19void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel);
80#else 20#else
81static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }
82static inline void aio_complete(struct kiocb *iocb, long res, long res2) { }
83struct mm_struct;
84static inline void exit_aio(struct mm_struct *mm) { } 21static inline void exit_aio(struct mm_struct *mm) { }
85static inline long do_io_submit(aio_context_t ctx_id, long nr, 22static inline long do_io_submit(aio_context_t ctx_id, long nr,
86 struct iocb __user * __user *iocbpp, 23 struct iocb __user * __user *iocbpp,
@@ -89,11 +26,6 @@ static inline void kiocb_set_cancel_fn(struct kiocb *req,
89 kiocb_cancel_fn *cancel) { } 26 kiocb_cancel_fn *cancel) { }
90#endif /* CONFIG_AIO */ 27#endif /* CONFIG_AIO */
91 28
92static inline struct kiocb *list_kiocb(struct list_head *h)
93{
94 return list_entry(h, struct kiocb, ki_list);
95}
96
97/* for sysctl: */ 29/* for sysctl: */
98extern unsigned long aio_nr; 30extern unsigned long aio_nr;
99extern unsigned long aio_max_nr; 31extern unsigned long aio_max_nr;
diff --git a/include/linux/arm-cci.h b/include/linux/arm-cci.h
index 79d6edf446d5..521ec1f2e6bc 100644
--- a/include/linux/arm-cci.h
+++ b/include/linux/arm-cci.h
@@ -24,16 +24,22 @@
24#include <linux/errno.h> 24#include <linux/errno.h>
25#include <linux/types.h> 25#include <linux/types.h>
26 26
27#include <asm/arm-cci.h>
28
27struct device_node; 29struct device_node;
28 30
29#ifdef CONFIG_ARM_CCI 31#ifdef CONFIG_ARM_CCI
30extern bool cci_probed(void); 32extern bool cci_probed(void);
33#else
34static inline bool cci_probed(void) { return false; }
35#endif
36
37#ifdef CONFIG_ARM_CCI400_PORT_CTRL
31extern int cci_ace_get_port(struct device_node *dn); 38extern int cci_ace_get_port(struct device_node *dn);
32extern int cci_disable_port_by_cpu(u64 mpidr); 39extern int cci_disable_port_by_cpu(u64 mpidr);
33extern int __cci_control_port_by_device(struct device_node *dn, bool enable); 40extern int __cci_control_port_by_device(struct device_node *dn, bool enable);
34extern int __cci_control_port_by_index(u32 port, bool enable); 41extern int __cci_control_port_by_index(u32 port, bool enable);
35#else 42#else
36static inline bool cci_probed(void) { return false; }
37static inline int cci_ace_get_port(struct device_node *dn) 43static inline int cci_ace_get_port(struct device_node *dn)
38{ 44{
39 return -ENODEV; 45 return -ENODEV;
@@ -49,6 +55,7 @@ static inline int __cci_control_port_by_index(u32 port, bool enable)
49 return -ENODEV; 55 return -ENODEV;
50} 56}
51#endif 57#endif
58
52#define cci_disable_port_by_device(dev) \ 59#define cci_disable_port_by_device(dev) \
53 __cci_control_port_by_device(dev, false) 60 __cci_control_port_by_device(dev, false)
54#define cci_enable_port_by_device(dev) \ 61#define cci_enable_port_by_device(dev) \
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index 179b38ffd351..388574ea38ed 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -60,12 +60,15 @@ struct dma_chan_ref {
60 * dependency chain 60 * dependency chain
61 * @ASYNC_TX_FENCE: specify that the next operation in the dependency 61 * @ASYNC_TX_FENCE: specify that the next operation in the dependency
62 * chain uses this operation's result as an input 62 * chain uses this operation's result as an input
63 * @ASYNC_TX_PQ_XOR_DST: do not overwrite the syndrome but XOR it with the
64 * input data. Required for rmw case.
63 */ 65 */
64enum async_tx_flags { 66enum async_tx_flags {
65 ASYNC_TX_XOR_ZERO_DST = (1 << 0), 67 ASYNC_TX_XOR_ZERO_DST = (1 << 0),
66 ASYNC_TX_XOR_DROP_DST = (1 << 1), 68 ASYNC_TX_XOR_DROP_DST = (1 << 1),
67 ASYNC_TX_ACK = (1 << 2), 69 ASYNC_TX_ACK = (1 << 2),
68 ASYNC_TX_FENCE = (1 << 3), 70 ASYNC_TX_FENCE = (1 << 3),
71 ASYNC_TX_PQ_XOR_DST = (1 << 4),
69}; 72};
70 73
71/** 74/**
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 1648026e06b4..b666b773e111 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -94,6 +94,8 @@ enum {
94 ATA_ID_SECTOR_SIZE = 106, 94 ATA_ID_SECTOR_SIZE = 106,
95 ATA_ID_WWN = 108, 95 ATA_ID_WWN = 108,
96 ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */ 96 ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */
97 ATA_ID_COMMAND_SET_3 = 119,
98 ATA_ID_COMMAND_SET_4 = 120,
97 ATA_ID_LAST_LUN = 126, 99 ATA_ID_LAST_LUN = 126,
98 ATA_ID_DLF = 128, 100 ATA_ID_DLF = 128,
99 ATA_ID_CSFO = 129, 101 ATA_ID_CSFO = 129,
@@ -177,7 +179,7 @@ enum {
177 ATA_DSC = (1 << 4), /* drive seek complete */ 179 ATA_DSC = (1 << 4), /* drive seek complete */
178 ATA_DRQ = (1 << 3), /* data request i/o */ 180 ATA_DRQ = (1 << 3), /* data request i/o */
179 ATA_CORR = (1 << 2), /* corrected data error */ 181 ATA_CORR = (1 << 2), /* corrected data error */
180 ATA_IDX = (1 << 1), /* index */ 182 ATA_SENSE = (1 << 1), /* sense code available */
181 ATA_ERR = (1 << 0), /* have an error */ 183 ATA_ERR = (1 << 0), /* have an error */
182 ATA_SRST = (1 << 2), /* software reset */ 184 ATA_SRST = (1 << 2), /* software reset */
183 ATA_ICRC = (1 << 7), /* interface CRC error */ 185 ATA_ICRC = (1 << 7), /* interface CRC error */
@@ -382,6 +384,8 @@ enum {
382 SATA_SSP = 0x06, /* Software Settings Preservation */ 384 SATA_SSP = 0x06, /* Software Settings Preservation */
383 SATA_DEVSLP = 0x09, /* Device Sleep */ 385 SATA_DEVSLP = 0x09, /* Device Sleep */
384 386
387 SETFEATURE_SENSE_DATA = 0xC3, /* Sense Data Reporting feature */
388
385 /* feature values for SET_MAX */ 389 /* feature values for SET_MAX */
386 ATA_SET_MAX_ADDR = 0x00, 390 ATA_SET_MAX_ADDR = 0x00,
387 ATA_SET_MAX_PASSWD = 0x01, 391 ATA_SET_MAX_PASSWD = 0x01,
@@ -525,6 +529,8 @@ struct ata_bmdma_prd {
525#define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) 529#define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20)
526#define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) 530#define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4))
527#define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8)) 531#define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))
532#define ata_id_has_ncq_autosense(id) \
533 ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))
528 534
529static inline bool ata_id_has_hipm(const u16 *id) 535static inline bool ata_id_has_hipm(const u16 *id)
530{ 536{
@@ -696,6 +702,27 @@ static inline bool ata_id_wcache_enabled(const u16 *id)
696 return id[ATA_ID_CFS_ENABLE_1] & (1 << 5); 702 return id[ATA_ID_CFS_ENABLE_1] & (1 << 5);
697} 703}
698 704
705static inline bool ata_id_has_read_log_dma_ext(const u16 *id)
706{
707 if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
708 return false;
709 return id[ATA_ID_COMMAND_SET_3] & (1 << 3);
710}
711
712static inline bool ata_id_has_sense_reporting(const u16 *id)
713{
714 if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
715 return false;
716 return id[ATA_ID_COMMAND_SET_3] & (1 << 6);
717}
718
719static inline bool ata_id_sense_reporting_enabled(const u16 *id)
720{
721 if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
722 return false;
723 return id[ATA_ID_COMMAND_SET_4] & (1 << 6);
724}
725
699/** 726/**
700 * ata_id_major_version - get ATA level of drive 727 * ata_id_major_version - get ATA level of drive
701 * @id: Identify data 728 * @id: Identify data
diff --git a/include/linux/bcm47xx_nvram.h b/include/linux/bcm47xx_nvram.h
new file mode 100644
index 000000000000..b12b07e75929
--- /dev/null
+++ b/include/linux/bcm47xx_nvram.h
@@ -0,0 +1,34 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 */
7
8#ifndef __BCM47XX_NVRAM_H
9#define __BCM47XX_NVRAM_H
10
11#include <linux/types.h>
12#include <linux/kernel.h>
13
14#ifdef CONFIG_BCM47XX
15int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
16int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
17int bcm47xx_nvram_gpio_pin(const char *name);
18#else
19static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
20{
21 return -ENOTSUPP;
22};
23static inline int bcm47xx_nvram_getenv(const char *name, char *val,
24 size_t val_len)
25{
26 return -ENOTSUPP;
27};
28static inline int bcm47xx_nvram_gpio_pin(const char *name)
29{
30 return -ENOTSUPP;
31};
32#endif
33
34#endif /* __BCM47XX_NVRAM_H */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 994739da827f..e34f906647d3 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -434,6 +434,27 @@ static inline struct bcma_device *bcma_find_core(struct bcma_bus *bus,
434 return bcma_find_core_unit(bus, coreid, 0); 434 return bcma_find_core_unit(bus, coreid, 0);
435} 435}
436 436
437#ifdef CONFIG_BCMA_HOST_PCI
438extern void bcma_host_pci_up(struct bcma_bus *bus);
439extern void bcma_host_pci_down(struct bcma_bus *bus);
440extern int bcma_host_pci_irq_ctl(struct bcma_bus *bus,
441 struct bcma_device *core, bool enable);
442#else
443static inline void bcma_host_pci_up(struct bcma_bus *bus)
444{
445}
446static inline void bcma_host_pci_down(struct bcma_bus *bus)
447{
448}
449static inline int bcma_host_pci_irq_ctl(struct bcma_bus *bus,
450 struct bcma_device *core, bool enable)
451{
452 if (bus->hosttype == BCMA_HOSTTYPE_PCI)
453 return -ENOTSUPP;
454 return 0;
455}
456#endif
457
437extern bool bcma_core_is_enabled(struct bcma_device *core); 458extern bool bcma_core_is_enabled(struct bcma_device *core);
438extern void bcma_core_disable(struct bcma_device *core, u32 flags); 459extern void bcma_core_disable(struct bcma_device *core, u32 flags);
439extern int bcma_core_enable(struct bcma_device *core, u32 flags); 460extern int bcma_core_enable(struct bcma_device *core, u32 flags);
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index db6fa217f98b..6cceedf65ca2 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -663,14 +663,6 @@ struct bcma_drv_cc_b {
663#define bcma_cc_maskset32(cc, offset, mask, set) \ 663#define bcma_cc_maskset32(cc, offset, mask, set) \
664 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set)) 664 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
665 665
666extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
667extern void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
668
669extern void bcma_chipco_suspend(struct bcma_drv_cc *cc);
670extern void bcma_chipco_resume(struct bcma_drv_cc *cc);
671
672void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
673
674extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); 666extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks);
675 667
676extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc); 668extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc);
@@ -690,9 +682,6 @@ u32 bcma_chipco_gpio_pullup(struct bcma_drv_cc *cc, u32 mask, u32 value);
690u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value); 682u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value);
691 683
692/* PMU support */ 684/* PMU support */
693extern void bcma_pmu_init(struct bcma_drv_cc *cc);
694extern void bcma_pmu_early_init(struct bcma_drv_cc *cc);
695
696extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, 685extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset,
697 u32 value); 686 u32 value);
698extern void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset, 687extern void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset,
diff --git a/include/linux/bcma/bcma_driver_gmac_cmn.h b/include/linux/bcma/bcma_driver_gmac_cmn.h
index 4dd1f33e36a2..4354d4ea6713 100644
--- a/include/linux/bcma/bcma_driver_gmac_cmn.h
+++ b/include/linux/bcma/bcma_driver_gmac_cmn.h
@@ -91,10 +91,4 @@ struct bcma_drv_gmac_cmn {
91#define gmac_cmn_write16(gc, offset, val) bcma_write16((gc)->core, offset, val) 91#define gmac_cmn_write16(gc, offset, val) bcma_write16((gc)->core, offset, val)
92#define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val) 92#define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val)
93 93
94#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
95extern void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
96#else
97static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { }
98#endif
99
100#endif /* LINUX_BCMA_DRIVER_GMAC_CMN_H_ */ 94#endif /* LINUX_BCMA_DRIVER_GMAC_CMN_H_ */
diff --git a/include/linux/bcma/bcma_driver_mips.h b/include/linux/bcma/bcma_driver_mips.h
index 0b3b32aeeb8a..8eea7f9e33b4 100644
--- a/include/linux/bcma/bcma_driver_mips.h
+++ b/include/linux/bcma/bcma_driver_mips.h
@@ -39,21 +39,6 @@ struct bcma_drv_mips {
39 u8 early_setup_done:1; 39 u8 early_setup_done:1;
40}; 40};
41 41
42#ifdef CONFIG_BCMA_DRIVER_MIPS
43extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
44extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
45
46extern unsigned int bcma_core_mips_irq(struct bcma_device *dev);
47#else
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) { }
50
51static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
52{
53 return 0;
54}
55#endif
56
57extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore); 42extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
58 43
59#endif /* LINUX_BCMA_DRIVER_MIPS_H_ */ 44#endif /* LINUX_BCMA_DRIVER_MIPS_H_ */
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 3f809ae372c4..5ba6918ca20b 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -238,13 +238,13 @@ struct bcma_drv_pci {
238#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) 238#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val)
239#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) 239#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
240 240
241extern void bcma_core_pci_early_init(struct bcma_drv_pci *pc); 241#ifdef CONFIG_BCMA_DRIVER_PCI
242extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
243extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
244 struct bcma_device *core, bool enable);
245extern void bcma_core_pci_up(struct bcma_bus *bus);
246extern void bcma_core_pci_down(struct bcma_bus *bus);
247extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up); 242extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
243#else
244static inline void bcma_core_pci_power_save(struct bcma_bus *bus, bool up)
245{
246}
247#endif
248 248
249extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); 249extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
250extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); 250extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
diff --git a/include/linux/bcma/bcma_driver_pcie2.h b/include/linux/bcma/bcma_driver_pcie2.h
index 5988b05781c3..31e6d17ab798 100644
--- a/include/linux/bcma/bcma_driver_pcie2.h
+++ b/include/linux/bcma/bcma_driver_pcie2.h
@@ -143,6 +143,8 @@
143 143
144struct bcma_drv_pcie2 { 144struct bcma_drv_pcie2 {
145 struct bcma_device *core; 145 struct bcma_device *core;
146
147 u16 reqsize;
146}; 148};
147 149
148#define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset) 150#define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset)
@@ -153,6 +155,4 @@ struct bcma_drv_pcie2 {
153#define pcie2_set32(pcie2, offset, set) bcma_set32((pcie2)->core, offset, set) 155#define pcie2_set32(pcie2, offset, set) bcma_set32((pcie2)->core, offset, set)
154#define pcie2_mask32(pcie2, offset, mask) bcma_mask32((pcie2)->core, offset, mask) 156#define pcie2_mask32(pcie2, offset, mask) bcma_mask32((pcie2)->core, offset, mask)
155 157
156void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2);
157
158#endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */ 158#endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index dbfbf4990005..ea17cca9e685 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -172,12 +172,8 @@ extern unsigned int bitmap_ord_to_pos(const unsigned long *bitmap, unsigned int
172extern int bitmap_print_to_pagebuf(bool list, char *buf, 172extern int bitmap_print_to_pagebuf(bool list, char *buf,
173 const unsigned long *maskp, int nmaskbits); 173 const unsigned long *maskp, int nmaskbits);
174 174
175#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG)) 175#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1)))
176#define BITMAP_LAST_WORD_MASK(nbits) \ 176#define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1)))
177( \
178 ((nbits) % BITS_PER_LONG) ? \
179 (1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \
180)
181 177
182#define small_const_nbits(nbits) \ 178#define small_const_nbits(nbits) \
183 (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) 179 (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
@@ -287,16 +283,16 @@ static inline int bitmap_empty(const unsigned long *src, unsigned nbits)
287{ 283{
288 if (small_const_nbits(nbits)) 284 if (small_const_nbits(nbits))
289 return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); 285 return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
290 else 286
291 return __bitmap_empty(src, nbits); 287 return find_first_bit(src, nbits) == nbits;
292} 288}
293 289
294static inline int bitmap_full(const unsigned long *src, unsigned int nbits) 290static inline int bitmap_full(const unsigned long *src, unsigned int nbits)
295{ 291{
296 if (small_const_nbits(nbits)) 292 if (small_const_nbits(nbits))
297 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); 293 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
298 else 294
299 return __bitmap_full(src, nbits); 295 return find_first_zero_bit(src, nbits) == nbits;
300} 296}
301 297
302static inline int bitmap_weight(const unsigned long *src, unsigned int nbits) 298static inline int bitmap_weight(const unsigned long *src, unsigned int nbits)
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 5d858e02997f..297f5bda4fdf 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -218,9 +218,9 @@ static inline unsigned long __ffs64(u64 word)
218/** 218/**
219 * find_last_bit - find the last set bit in a memory region 219 * find_last_bit - find the last set bit in a memory region
220 * @addr: The address to start the search at 220 * @addr: The address to start the search at
221 * @size: The maximum size to search 221 * @size: The number of bits to search
222 * 222 *
223 * Returns the bit number of the first set bit, or size. 223 * Returns the bit number of the last set bit, or size.
224 */ 224 */
225extern unsigned long find_last_bit(const unsigned long *addr, 225extern unsigned long find_last_bit(const unsigned long *addr,
226 unsigned long size); 226 unsigned long size);
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 7aec86127335..2056a99b92f8 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -13,7 +13,7 @@ struct blk_mq_cpu_notifier {
13}; 13};
14 14
15struct blk_mq_ctxmap { 15struct blk_mq_ctxmap {
16 unsigned int map_size; 16 unsigned int size;
17 unsigned int bits_per_word; 17 unsigned int bits_per_word;
18 struct blk_align_bitmap *map; 18 struct blk_align_bitmap *map;
19}; 19};
@@ -164,6 +164,8 @@ enum {
164 << BLK_MQ_F_ALLOC_POLICY_START_BIT) 164 << BLK_MQ_F_ALLOC_POLICY_START_BIT)
165 165
166struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *); 166struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *);
167struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
168 struct request_queue *q);
167void blk_mq_finish_init(struct request_queue *q); 169void blk_mq_finish_init(struct request_queue *q);
168int blk_mq_register_disk(struct gendisk *); 170int blk_mq_register_disk(struct gendisk *);
169void blk_mq_unregister_disk(struct gendisk *); 171void blk_mq_unregister_disk(struct gendisk *);
@@ -218,6 +220,7 @@ void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx);
218void blk_mq_stop_hw_queues(struct request_queue *q); 220void blk_mq_stop_hw_queues(struct request_queue *q);
219void blk_mq_start_hw_queues(struct request_queue *q); 221void blk_mq_start_hw_queues(struct request_queue *q);
220void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async); 222void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async);
223void blk_mq_run_hw_queues(struct request_queue *q, bool async);
221void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); 224void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
222void blk_mq_tag_busy_iter(struct blk_mq_hw_ctx *hctx, busy_iter_fn *fn, 225void blk_mq_tag_busy_iter(struct blk_mq_hw_ctx *hctx, busy_iter_fn *fn,
223 void *priv); 226 void *priv);
@@ -227,7 +230,7 @@ void blk_mq_freeze_queue_start(struct request_queue *q);
227 230
228/* 231/*
229 * Driver command data is immediately after the request. So subtract request 232 * Driver command data is immediately after the request. So subtract request
230 * size to get back to the original request. 233 * size to get back to the original request, add request size to get the PDU.
231 */ 234 */
232static inline struct request *blk_mq_rq_from_pdu(void *pdu) 235static inline struct request *blk_mq_rq_from_pdu(void *pdu)
233{ 236{
@@ -235,7 +238,7 @@ static inline struct request *blk_mq_rq_from_pdu(void *pdu)
235} 238}
236static inline void *blk_mq_rq_to_pdu(struct request *rq) 239static inline void *blk_mq_rq_to_pdu(struct request *rq)
237{ 240{
238 return (void *) rq + sizeof(*rq); 241 return rq + 1;
239} 242}
240 243
241#define queue_for_each_hw_ctx(q, hctx, i) \ 244#define queue_for_each_hw_ctx(q, hctx, i) \
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index c294e3e25e37..a1b25e35ea5f 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -181,7 +181,9 @@ enum rq_flag_bits {
181 __REQ_ELVPRIV, /* elevator private data attached */ 181 __REQ_ELVPRIV, /* elevator private data attached */
182 __REQ_FAILED, /* set if the request failed */ 182 __REQ_FAILED, /* set if the request failed */
183 __REQ_QUIET, /* don't worry about errors */ 183 __REQ_QUIET, /* don't worry about errors */
184 __REQ_PREEMPT, /* set for "ide_preempt" requests */ 184 __REQ_PREEMPT, /* set for "ide_preempt" requests and also
185 for requests for which the SCSI "quiesce"
186 state must be ignored. */
185 __REQ_ALLOCED, /* request came from our alloc pool */ 187 __REQ_ALLOCED, /* request came from our alloc pool */
186 __REQ_COPY_USER, /* contains copies of user pages */ 188 __REQ_COPY_USER, /* contains copies of user pages */
187 __REQ_FLUSH_SEQ, /* request for flush sequence */ 189 __REQ_FLUSH_SEQ, /* request for flush sequence */
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index bbfceb756452..d5cda067115a 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -32,23 +32,19 @@ struct bpf_map {
32 u32 key_size; 32 u32 key_size;
33 u32 value_size; 33 u32 value_size;
34 u32 max_entries; 34 u32 max_entries;
35 struct bpf_map_ops *ops; 35 const struct bpf_map_ops *ops;
36 struct work_struct work; 36 struct work_struct work;
37}; 37};
38 38
39struct bpf_map_type_list { 39struct bpf_map_type_list {
40 struct list_head list_node; 40 struct list_head list_node;
41 struct bpf_map_ops *ops; 41 const struct bpf_map_ops *ops;
42 enum bpf_map_type type; 42 enum bpf_map_type type;
43}; 43};
44 44
45void bpf_register_map_type(struct bpf_map_type_list *tl);
46void bpf_map_put(struct bpf_map *map);
47struct bpf_map *bpf_map_get(struct fd f);
48
49/* function argument constraints */ 45/* function argument constraints */
50enum bpf_arg_type { 46enum bpf_arg_type {
51 ARG_ANYTHING = 0, /* any argument is ok */ 47 ARG_DONTCARE = 0, /* unused argument in helper function */
52 48
53 /* the following constraints used to prototype 49 /* the following constraints used to prototype
54 * bpf_map_lookup/update/delete_elem() functions 50 * bpf_map_lookup/update/delete_elem() functions
@@ -62,6 +58,9 @@ enum bpf_arg_type {
62 */ 58 */
63 ARG_PTR_TO_STACK, /* any pointer to eBPF program stack */ 59 ARG_PTR_TO_STACK, /* any pointer to eBPF program stack */
64 ARG_CONST_STACK_SIZE, /* number of bytes accessed from stack */ 60 ARG_CONST_STACK_SIZE, /* number of bytes accessed from stack */
61
62 ARG_PTR_TO_CTX, /* pointer to context */
63 ARG_ANYTHING, /* any (initialized) argument is ok */
65}; 64};
66 65
67/* type of values returned from helper functions */ 66/* type of values returned from helper functions */
@@ -105,41 +104,61 @@ struct bpf_verifier_ops {
105 * with 'type' (read or write) is allowed 104 * with 'type' (read or write) is allowed
106 */ 105 */
107 bool (*is_valid_access)(int off, int size, enum bpf_access_type type); 106 bool (*is_valid_access)(int off, int size, enum bpf_access_type type);
107
108 u32 (*convert_ctx_access)(int dst_reg, int src_reg, int ctx_off,
109 struct bpf_insn *insn);
108}; 110};
109 111
110struct bpf_prog_type_list { 112struct bpf_prog_type_list {
111 struct list_head list_node; 113 struct list_head list_node;
112 struct bpf_verifier_ops *ops; 114 const struct bpf_verifier_ops *ops;
113 enum bpf_prog_type type; 115 enum bpf_prog_type type;
114}; 116};
115 117
116void bpf_register_prog_type(struct bpf_prog_type_list *tl);
117
118struct bpf_prog; 118struct bpf_prog;
119 119
120struct bpf_prog_aux { 120struct bpf_prog_aux {
121 atomic_t refcnt; 121 atomic_t refcnt;
122 bool is_gpl_compatible;
123 enum bpf_prog_type prog_type;
124 struct bpf_verifier_ops *ops;
125 struct bpf_map **used_maps;
126 u32 used_map_cnt; 122 u32 used_map_cnt;
123 const struct bpf_verifier_ops *ops;
124 struct bpf_map **used_maps;
127 struct bpf_prog *prog; 125 struct bpf_prog *prog;
128 struct work_struct work; 126 struct work_struct work;
129}; 127};
130 128
131#ifdef CONFIG_BPF_SYSCALL 129#ifdef CONFIG_BPF_SYSCALL
132void bpf_prog_put(struct bpf_prog *prog); 130void bpf_register_prog_type(struct bpf_prog_type_list *tl);
133#else 131void bpf_register_map_type(struct bpf_map_type_list *tl);
134static inline void bpf_prog_put(struct bpf_prog *prog) {} 132
135#endif
136struct bpf_prog *bpf_prog_get(u32 ufd); 133struct bpf_prog *bpf_prog_get(u32 ufd);
134void bpf_prog_put(struct bpf_prog *prog);
135
136struct bpf_map *bpf_map_get(struct fd f);
137void bpf_map_put(struct bpf_map *map);
138
137/* verify correctness of eBPF program */ 139/* verify correctness of eBPF program */
138int bpf_check(struct bpf_prog *fp, union bpf_attr *attr); 140int bpf_check(struct bpf_prog **fp, union bpf_attr *attr);
141#else
142static inline void bpf_register_prog_type(struct bpf_prog_type_list *tl)
143{
144}
145
146static inline struct bpf_prog *bpf_prog_get(u32 ufd)
147{
148 return ERR_PTR(-EOPNOTSUPP);
149}
150
151static inline void bpf_prog_put(struct bpf_prog *prog)
152{
153}
154#endif /* CONFIG_BPF_SYSCALL */
139 155
140/* verifier prototypes for helper functions called from eBPF programs */ 156/* verifier prototypes for helper functions called from eBPF programs */
141extern struct bpf_func_proto bpf_map_lookup_elem_proto; 157extern const struct bpf_func_proto bpf_map_lookup_elem_proto;
142extern struct bpf_func_proto bpf_map_update_elem_proto; 158extern const struct bpf_func_proto bpf_map_update_elem_proto;
143extern struct bpf_func_proto bpf_map_delete_elem_proto; 159extern const struct bpf_func_proto bpf_map_delete_elem_proto;
160
161extern const struct bpf_func_proto bpf_get_prandom_u32_proto;
162extern const struct bpf_func_proto bpf_get_smp_processor_id_proto;
144 163
145#endif /* _LINUX_BPF_H */ 164#endif /* _LINUX_BPF_H */
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 7ccd928cc1f2..ae2982c0f7a6 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -11,6 +11,7 @@
11#define PHY_ID_BCM5421 0x002060e0 11#define PHY_ID_BCM5421 0x002060e0
12#define PHY_ID_BCM5464 0x002060b0 12#define PHY_ID_BCM5464 0x002060b0
13#define PHY_ID_BCM5461 0x002060c0 13#define PHY_ID_BCM5461 0x002060c0
14#define PHY_ID_BCM54616S 0x03625d10
14#define PHY_ID_BCM57780 0x03625d90 15#define PHY_ID_BCM57780 0x03625d90
15 16
16#define PHY_ID_BCM7250 0xae025280 17#define PHY_ID_BCM7250 0xae025280
@@ -19,6 +20,7 @@
19#define PHY_ID_BCM7425 0x03625e60 20#define PHY_ID_BCM7425 0x03625e60
20#define PHY_ID_BCM7429 0x600d8730 21#define PHY_ID_BCM7429 0x600d8730
21#define PHY_ID_BCM7439 0x600d8480 22#define PHY_ID_BCM7439 0x600d8480
23#define PHY_ID_BCM7439_2 0xae025080
22#define PHY_ID_BCM7445 0x600d8510 24#define PHY_ID_BCM7445 0x600d8510
23 25
24#define PHY_BCM_OUI_MASK 0xfffffc00 26#define PHY_BCM_OUI_MASK 0xfffffc00
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index c05ff0f9f9a5..c3a9c8fc60fa 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -61,6 +61,8 @@ struct can_priv {
61 char tx_led_trig_name[CAN_LED_NAME_SZ]; 61 char tx_led_trig_name[CAN_LED_NAME_SZ];
62 struct led_trigger *rx_led_trig; 62 struct led_trigger *rx_led_trig;
63 char rx_led_trig_name[CAN_LED_NAME_SZ]; 63 char rx_led_trig_name[CAN_LED_NAME_SZ];
64 struct led_trigger *rxtx_led_trig;
65 char rxtx_led_trig_name[CAN_LED_NAME_SZ];
64#endif 66#endif
65}; 67};
66 68
diff --git a/include/linux/can/led.h b/include/linux/can/led.h
index e0475c5cbb92..146de4506d21 100644
--- a/include/linux/can/led.h
+++ b/include/linux/can/led.h
@@ -21,8 +21,10 @@ enum can_led_event {
21 21
22#ifdef CONFIG_CAN_LEDS 22#ifdef CONFIG_CAN_LEDS
23 23
24/* keep space for interface name + "-tx"/"-rx" suffix and null terminator */ 24/* keep space for interface name + "-tx"/"-rx"/"-rxtx"
25#define CAN_LED_NAME_SZ (IFNAMSIZ + 4) 25 * suffix and null terminator
26 */
27#define CAN_LED_NAME_SZ (IFNAMSIZ + 6)
26 28
27void can_led_event(struct net_device *netdev, enum can_led_event event); 29void can_led_event(struct net_device *netdev, enum can_led_event event);
28void devm_can_led_init(struct net_device *netdev); 30void devm_can_led_init(struct net_device *netdev);
diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h
index cc00d15c6107..b6a52a4b457a 100644
--- a/include/linux/can/skb.h
+++ b/include/linux/can/skb.h
@@ -44,16 +44,11 @@ static inline void can_skb_reserve(struct sk_buff *skb)
44 skb_reserve(skb, sizeof(struct can_skb_priv)); 44 skb_reserve(skb, sizeof(struct can_skb_priv));
45} 45}
46 46
47static inline void can_skb_destructor(struct sk_buff *skb)
48{
49 sock_put(skb->sk);
50}
51
52static inline void can_skb_set_owner(struct sk_buff *skb, struct sock *sk) 47static inline void can_skb_set_owner(struct sk_buff *skb, struct sock *sk)
53{ 48{
54 if (sk) { 49 if (sk) {
55 sock_hold(sk); 50 sock_hold(sk);
56 skb->destructor = can_skb_destructor; 51 skb->destructor = sock_efree;
57 skb->sk = sk; 52 skb->sk = sk;
58 } 53 }
59} 54}
diff --git a/include/linux/capability.h b/include/linux/capability.h
index aa93e5ef594c..af9f0b9e80e6 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -205,6 +205,7 @@ static inline kernel_cap_t cap_raise_nfsd_set(const kernel_cap_t a,
205 cap_intersect(permitted, __cap_nfsd_set)); 205 cap_intersect(permitted, __cap_nfsd_set));
206} 206}
207 207
208#ifdef CONFIG_MULTIUSER
208extern bool has_capability(struct task_struct *t, int cap); 209extern bool has_capability(struct task_struct *t, int cap);
209extern bool has_ns_capability(struct task_struct *t, 210extern bool has_ns_capability(struct task_struct *t,
210 struct user_namespace *ns, int cap); 211 struct user_namespace *ns, int cap);
@@ -213,6 +214,34 @@ extern bool has_ns_capability_noaudit(struct task_struct *t,
213 struct user_namespace *ns, int cap); 214 struct user_namespace *ns, int cap);
214extern bool capable(int cap); 215extern bool capable(int cap);
215extern bool ns_capable(struct user_namespace *ns, int cap); 216extern bool ns_capable(struct user_namespace *ns, int cap);
217#else
218static inline bool has_capability(struct task_struct *t, int cap)
219{
220 return true;
221}
222static inline bool has_ns_capability(struct task_struct *t,
223 struct user_namespace *ns, int cap)
224{
225 return true;
226}
227static inline bool has_capability_noaudit(struct task_struct *t, int cap)
228{
229 return true;
230}
231static inline bool has_ns_capability_noaudit(struct task_struct *t,
232 struct user_namespace *ns, int cap)
233{
234 return true;
235}
236static inline bool capable(int cap)
237{
238 return true;
239}
240static inline bool ns_capable(struct user_namespace *ns, int cap)
241{
242 return true;
243}
244#endif /* CONFIG_MULTIUSER */
216extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap); 245extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap);
217extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap); 246extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap);
218 247
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h
index 71e05bbf8ceb..4763ad64e832 100644
--- a/include/linux/ceph/ceph_features.h
+++ b/include/linux/ceph/ceph_features.h
@@ -50,6 +50,19 @@
50#define CEPH_FEATURE_MDS_INLINE_DATA (1ULL<<40) 50#define CEPH_FEATURE_MDS_INLINE_DATA (1ULL<<40)
51#define CEPH_FEATURE_CRUSH_TUNABLES3 (1ULL<<41) 51#define CEPH_FEATURE_CRUSH_TUNABLES3 (1ULL<<41)
52#define CEPH_FEATURE_OSD_PRIMARY_AFFINITY (1ULL<<41) /* overlap w/ tunables3 */ 52#define CEPH_FEATURE_OSD_PRIMARY_AFFINITY (1ULL<<41) /* overlap w/ tunables3 */
53#define CEPH_FEATURE_MSGR_KEEPALIVE2 (1ULL<<42)
54#define CEPH_FEATURE_OSD_POOLRESEND (1ULL<<43)
55#define CEPH_FEATURE_ERASURE_CODE_PLUGINS_V2 (1ULL<<44)
56#define CEPH_FEATURE_OSD_SET_ALLOC_HINT (1ULL<<45)
57#define CEPH_FEATURE_OSD_FADVISE_FLAGS (1ULL<<46)
58#define CEPH_FEATURE_OSD_REPOP (1ULL<<46) /* overlap with fadvise */
59#define CEPH_FEATURE_OSD_OBJECT_DIGEST (1ULL<<46) /* overlap with fadvise */
60#define CEPH_FEATURE_OSD_TRANSACTION_MAY_LAYOUT (1ULL<<46) /* overlap w/ fadvise */
61#define CEPH_FEATURE_MDS_QUOTA (1ULL<<47)
62#define CEPH_FEATURE_CRUSH_V4 (1ULL<<48) /* straw2 buckets */
63#define CEPH_FEATURE_OSD_MIN_SIZE_RECOVERY (1ULL<<49)
64// duplicated since it was introduced at the same time as MIN_SIZE_RECOVERY
65#define CEPH_FEATURE_OSD_PROXY_FEATURES (1ULL<<49) /* overlap w/ above */
53 66
54/* 67/*
55 * The introduction of CEPH_FEATURE_OSD_SNAPMAPPER caused the feature 68 * The introduction of CEPH_FEATURE_OSD_SNAPMAPPER caused the feature
@@ -93,7 +106,8 @@ static inline u64 ceph_sanitize_features(u64 features)
93 CEPH_FEATURE_EXPORT_PEER | \ 106 CEPH_FEATURE_EXPORT_PEER | \
94 CEPH_FEATURE_OSDMAP_ENC | \ 107 CEPH_FEATURE_OSDMAP_ENC | \
95 CEPH_FEATURE_CRUSH_TUNABLES3 | \ 108 CEPH_FEATURE_CRUSH_TUNABLES3 | \
96 CEPH_FEATURE_OSD_PRIMARY_AFFINITY) 109 CEPH_FEATURE_OSD_PRIMARY_AFFINITY | \
110 CEPH_FEATURE_CRUSH_V4)
97 111
98#define CEPH_FEATURES_REQUIRED_DEFAULT \ 112#define CEPH_FEATURES_REQUIRED_DEFAULT \
99 (CEPH_FEATURE_NOSRCADDR | \ 113 (CEPH_FEATURE_NOSRCADDR | \
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index 31eb03d0c766..d7d072a25c27 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -323,6 +323,7 @@ enum {
323 CEPH_MDS_OP_MKSNAP = 0x01400, 323 CEPH_MDS_OP_MKSNAP = 0x01400,
324 CEPH_MDS_OP_RMSNAP = 0x01401, 324 CEPH_MDS_OP_RMSNAP = 0x01401,
325 CEPH_MDS_OP_LSSNAP = 0x00402, 325 CEPH_MDS_OP_LSSNAP = 0x00402,
326 CEPH_MDS_OP_RENAMESNAP = 0x01403,
326}; 327};
327 328
328extern const char *ceph_mds_op_name(int op); 329extern const char *ceph_mds_op_name(int op);
diff --git a/include/linux/ceph/debugfs.h b/include/linux/ceph/debugfs.h
index 1df086d7882d..29cf897cc5cd 100644
--- a/include/linux/ceph/debugfs.h
+++ b/include/linux/ceph/debugfs.h
@@ -7,13 +7,7 @@
7#define CEPH_DEFINE_SHOW_FUNC(name) \ 7#define CEPH_DEFINE_SHOW_FUNC(name) \
8static int name##_open(struct inode *inode, struct file *file) \ 8static int name##_open(struct inode *inode, struct file *file) \
9{ \ 9{ \
10 struct seq_file *sf; \ 10 return single_open(file, name, inode->i_private); \
11 int ret; \
12 \
13 ret = single_open(file, name, NULL); \
14 sf = file->private_data; \
15 sf->private = inode->i_private; \
16 return ret; \
17} \ 11} \
18 \ 12 \
19static const struct file_operations name##_fops = { \ 13static const struct file_operations name##_fops = { \
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 16fff9608848..30f92cefaa72 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -135,6 +135,7 @@ struct ceph_client {
135 struct dentry *debugfs_dir; 135 struct dentry *debugfs_dir;
136 struct dentry *debugfs_monmap; 136 struct dentry *debugfs_monmap;
137 struct dentry *debugfs_osdmap; 137 struct dentry *debugfs_osdmap;
138 struct dentry *debugfs_options;
138#endif 139#endif
139}; 140};
140 141
@@ -191,6 +192,7 @@ extern struct ceph_options *ceph_parse_options(char *options,
191 const char *dev_name, const char *dev_name_end, 192 const char *dev_name, const char *dev_name_end,
192 int (*parse_extra_token)(char *c, void *private), 193 int (*parse_extra_token)(char *c, void *private),
193 void *private); 194 void *private);
195int ceph_print_client_options(struct seq_file *m, struct ceph_client *client);
194extern void ceph_destroy_options(struct ceph_options *opt); 196extern void ceph_destroy_options(struct ceph_options *opt);
195extern int ceph_compare_options(struct ceph_options *new_opt, 197extern int ceph_compare_options(struct ceph_options *new_opt,
196 struct ceph_client *client); 198 struct ceph_client *client);
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 561ea896c657..e55c08bc3a96 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -175,13 +175,12 @@ static inline int ceph_decode_pgid(void **p, void *end, struct ceph_pg *pgid)
175 __u8 version; 175 __u8 version;
176 176
177 if (!ceph_has_room(p, end, 1 + 8 + 4 + 4)) { 177 if (!ceph_has_room(p, end, 1 + 8 + 4 + 4)) {
178 pr_warning("incomplete pg encoding"); 178 pr_warn("incomplete pg encoding\n");
179
180 return -EINVAL; 179 return -EINVAL;
181 } 180 }
182 version = ceph_decode_8(p); 181 version = ceph_decode_8(p);
183 if (version > 1) { 182 if (version > 1) {
184 pr_warning("do not understand pg encoding %d > 1", 183 pr_warn("do not understand pg encoding %d > 1\n",
185 (int)version); 184 (int)version);
186 return -EINVAL; 185 return -EINVAL;
187 } 186 }
diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
index 4ce9056b31a8..bda5ec0b4b4d 100644
--- a/include/linux/cleancache.h
+++ b/include/linux/cleancache.h
@@ -5,6 +5,10 @@
5#include <linux/exportfs.h> 5#include <linux/exportfs.h>
6#include <linux/mm.h> 6#include <linux/mm.h>
7 7
8#define CLEANCACHE_NO_POOL -1
9#define CLEANCACHE_NO_BACKEND -2
10#define CLEANCACHE_NO_BACKEND_SHARED -3
11
8#define CLEANCACHE_KEY_MAX 6 12#define CLEANCACHE_KEY_MAX 6
9 13
10/* 14/*
@@ -33,10 +37,9 @@ struct cleancache_ops {
33 void (*invalidate_fs)(int); 37 void (*invalidate_fs)(int);
34}; 38};
35 39
36extern struct cleancache_ops * 40extern int cleancache_register_ops(struct cleancache_ops *ops);
37 cleancache_register_ops(struct cleancache_ops *ops);
38extern void __cleancache_init_fs(struct super_block *); 41extern void __cleancache_init_fs(struct super_block *);
39extern void __cleancache_init_shared_fs(char *, struct super_block *); 42extern void __cleancache_init_shared_fs(struct super_block *);
40extern int __cleancache_get_page(struct page *); 43extern int __cleancache_get_page(struct page *);
41extern void __cleancache_put_page(struct page *); 44extern void __cleancache_put_page(struct page *);
42extern void __cleancache_invalidate_page(struct address_space *, struct page *); 45extern void __cleancache_invalidate_page(struct address_space *, struct page *);
@@ -78,10 +81,10 @@ static inline void cleancache_init_fs(struct super_block *sb)
78 __cleancache_init_fs(sb); 81 __cleancache_init_fs(sb);
79} 82}
80 83
81static inline void cleancache_init_shared_fs(char *uuid, struct super_block *sb) 84static inline void cleancache_init_shared_fs(struct super_block *sb)
82{ 85{
83 if (cleancache_enabled) 86 if (cleancache_enabled)
84 __cleancache_init_shared_fs(uuid, sb); 87 __cleancache_init_shared_fs(sb);
85} 88}
86 89
87static inline int cleancache_get_page(struct page *page) 90static inline int cleancache_get_page(struct page *page)
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 5591ea71a8d1..df695313f975 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -541,7 +541,7 @@ struct clk_gpio {
541 541
542extern const struct clk_ops clk_gpio_gate_ops; 542extern const struct clk_ops clk_gpio_gate_ops;
543struct clk *clk_register_gpio_gate(struct device *dev, const char *name, 543struct clk *clk_register_gpio_gate(struct device *dev, const char *name,
544 const char *parent_name, struct gpio_desc *gpio, 544 const char *parent_name, unsigned gpio, bool active_low,
545 unsigned long flags); 545 unsigned long flags);
546 546
547void of_gpio_clk_gate_setup(struct device_node *node); 547void of_gpio_clk_gate_setup(struct device_node *node);
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 8381bbfbc308..68c16a6bedb3 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -125,6 +125,19 @@ int clk_set_phase(struct clk *clk, int degrees);
125 */ 125 */
126int clk_get_phase(struct clk *clk); 126int clk_get_phase(struct clk *clk);
127 127
128/**
129 * clk_is_match - check if two clk's point to the same hardware clock
130 * @p: clk compared against q
131 * @q: clk compared against p
132 *
133 * Returns true if the two struct clk pointers both point to the same hardware
134 * clock node. Put differently, returns true if struct clk *p and struct clk *q
135 * share the same struct clk_core object.
136 *
137 * Returns false otherwise. Note that two NULL clks are treated as matching.
138 */
139bool clk_is_match(const struct clk *p, const struct clk *q);
140
128#else 141#else
129 142
130static inline long clk_get_accuracy(struct clk *clk) 143static inline long clk_get_accuracy(struct clk *clk)
@@ -142,6 +155,11 @@ static inline long clk_get_phase(struct clk *clk)
142 return -ENOTSUPP; 155 return -ENOTSUPP;
143} 156}
144 157
158static inline bool clk_is_match(const struct clk *p, const struct clk *q)
159{
160 return p == q;
161}
162
145#endif 163#endif
146 164
147/** 165/**
diff --git a/include/linux/clk/at91_pmc.h b/include/linux/clk/at91_pmc.h
index c8e3b3d1eded..7669f7618f39 100644
--- a/include/linux/clk/at91_pmc.h
+++ b/include/linux/clk/at91_pmc.h
@@ -20,10 +20,10 @@
20extern void __iomem *at91_pmc_base; 20extern void __iomem *at91_pmc_base;
21 21
22#define at91_pmc_read(field) \ 22#define at91_pmc_read(field) \
23 __raw_readl(at91_pmc_base + field) 23 readl_relaxed(at91_pmc_base + field)
24 24
25#define at91_pmc_write(field, value) \ 25#define at91_pmc_write(field, value) \
26 __raw_writel(value, at91_pmc_base + field) 26 writel_relaxed(value, at91_pmc_base + field)
27#else 27#else
28.extern at91_pmc_base 28.extern at91_pmc_base
29#endif 29#endif
diff --git a/include/linux/clk/shmobile.h b/include/linux/clk/shmobile.h
index 9f8a14041dd5..63a8159c4e64 100644
--- a/include/linux/clk/shmobile.h
+++ b/include/linux/clk/shmobile.h
@@ -16,6 +16,7 @@
16 16
17#include <linux/types.h> 17#include <linux/types.h>
18 18
19void r8a7778_clocks_init(u32 mode);
19void r8a7779_clocks_init(u32 mode); 20void r8a7779_clocks_init(u32 mode);
20void rcar_gen2_clocks_init(u32 mode); 21void rcar_gen2_clocks_init(u32 mode);
21 22
diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h
index 67844003493d..79b76e13d904 100644
--- a/include/linux/clk/ti.h
+++ b/include/linux/clk/ti.h
@@ -215,14 +215,14 @@ struct ti_dt_clk {
215 .node_name = name, \ 215 .node_name = name, \
216 } 216 }
217 217
218/* Maximum number of clock memmaps */
219#define CLK_MAX_MEMMAPS 4
220
221/* Static memmap indices */ 218/* Static memmap indices */
222enum { 219enum {
223 TI_CLKM_CM = 0, 220 TI_CLKM_CM = 0,
221 TI_CLKM_CM2,
224 TI_CLKM_PRM, 222 TI_CLKM_PRM,
225 TI_CLKM_SCRM, 223 TI_CLKM_SCRM,
224 TI_CLKM_CTRL,
225 CLK_MAX_MEMMAPS
226}; 226};
227 227
228typedef void (*ti_of_clk_init_cb_t)(struct clk_hw *, struct device_node *); 228typedef void (*ti_of_clk_init_cb_t)(struct clk_hw *, struct device_node *);
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 2e4cb67f6e56..96c280b2c263 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -8,33 +8,19 @@
8#ifndef _LINUX_CLOCKCHIPS_H 8#ifndef _LINUX_CLOCKCHIPS_H
9#define _LINUX_CLOCKCHIPS_H 9#define _LINUX_CLOCKCHIPS_H
10 10
11/* Clock event notification values */ 11#ifdef CONFIG_GENERIC_CLOCKEVENTS
12enum clock_event_nofitiers {
13 CLOCK_EVT_NOTIFY_ADD,
14 CLOCK_EVT_NOTIFY_BROADCAST_ON,
15 CLOCK_EVT_NOTIFY_BROADCAST_OFF,
16 CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
17 CLOCK_EVT_NOTIFY_BROADCAST_ENTER,
18 CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
19 CLOCK_EVT_NOTIFY_SUSPEND,
20 CLOCK_EVT_NOTIFY_RESUME,
21 CLOCK_EVT_NOTIFY_CPU_DYING,
22 CLOCK_EVT_NOTIFY_CPU_DEAD,
23};
24
25#ifdef CONFIG_GENERIC_CLOCKEVENTS_BUILD
26 12
27#include <linux/clocksource.h> 13# include <linux/clocksource.h>
28#include <linux/cpumask.h> 14# include <linux/cpumask.h>
29#include <linux/ktime.h> 15# include <linux/ktime.h>
30#include <linux/notifier.h> 16# include <linux/notifier.h>
31 17
32struct clock_event_device; 18struct clock_event_device;
33struct module; 19struct module;
34 20
35/* Clock event mode commands */ 21/* Clock event mode commands for legacy ->set_mode(): OBSOLETE */
36enum clock_event_mode { 22enum clock_event_mode {
37 CLOCK_EVT_MODE_UNUSED = 0, 23 CLOCK_EVT_MODE_UNUSED,
38 CLOCK_EVT_MODE_SHUTDOWN, 24 CLOCK_EVT_MODE_SHUTDOWN,
39 CLOCK_EVT_MODE_PERIODIC, 25 CLOCK_EVT_MODE_PERIODIC,
40 CLOCK_EVT_MODE_ONESHOT, 26 CLOCK_EVT_MODE_ONESHOT,
@@ -42,30 +28,49 @@ enum clock_event_mode {
42}; 28};
43 29
44/* 30/*
31 * Possible states of a clock event device.
32 *
33 * DETACHED: Device is not used by clockevents core. Initial state or can be
34 * reached from SHUTDOWN.
35 * SHUTDOWN: Device is powered-off. Can be reached from PERIODIC or ONESHOT.
36 * PERIODIC: Device is programmed to generate events periodically. Can be
37 * reached from DETACHED or SHUTDOWN.
38 * ONESHOT: Device is programmed to generate event only once. Can be reached
39 * from DETACHED or SHUTDOWN.
40 */
41enum clock_event_state {
42 CLOCK_EVT_STATE_DETACHED,
43 CLOCK_EVT_STATE_SHUTDOWN,
44 CLOCK_EVT_STATE_PERIODIC,
45 CLOCK_EVT_STATE_ONESHOT,
46};
47
48/*
45 * Clock event features 49 * Clock event features
46 */ 50 */
47#define CLOCK_EVT_FEAT_PERIODIC 0x000001 51# define CLOCK_EVT_FEAT_PERIODIC 0x000001
48#define CLOCK_EVT_FEAT_ONESHOT 0x000002 52# define CLOCK_EVT_FEAT_ONESHOT 0x000002
49#define CLOCK_EVT_FEAT_KTIME 0x000004 53# define CLOCK_EVT_FEAT_KTIME 0x000004
54
50/* 55/*
51 * x86(64) specific misfeatures: 56 * x86(64) specific (mis)features:
52 * 57 *
53 * - Clockevent source stops in C3 State and needs broadcast support. 58 * - Clockevent source stops in C3 State and needs broadcast support.
54 * - Local APIC timer is used as a dummy device. 59 * - Local APIC timer is used as a dummy device.
55 */ 60 */
56#define CLOCK_EVT_FEAT_C3STOP 0x000008 61# define CLOCK_EVT_FEAT_C3STOP 0x000008
57#define CLOCK_EVT_FEAT_DUMMY 0x000010 62# define CLOCK_EVT_FEAT_DUMMY 0x000010
58 63
59/* 64/*
60 * Core shall set the interrupt affinity dynamically in broadcast mode 65 * Core shall set the interrupt affinity dynamically in broadcast mode
61 */ 66 */
62#define CLOCK_EVT_FEAT_DYNIRQ 0x000020 67# define CLOCK_EVT_FEAT_DYNIRQ 0x000020
63#define CLOCK_EVT_FEAT_PERCPU 0x000040 68# define CLOCK_EVT_FEAT_PERCPU 0x000040
64 69
65/* 70/*
66 * Clockevent device is based on a hrtimer for broadcast 71 * Clockevent device is based on a hrtimer for broadcast
67 */ 72 */
68#define CLOCK_EVT_FEAT_HRTIMER 0x000080 73# define CLOCK_EVT_FEAT_HRTIMER 0x000080
69 74
70/** 75/**
71 * struct clock_event_device - clock event device descriptor 76 * struct clock_event_device - clock event device descriptor
@@ -78,10 +83,15 @@ enum clock_event_mode {
78 * @min_delta_ns: minimum delta value in ns 83 * @min_delta_ns: minimum delta value in ns
79 * @mult: nanosecond to cycles multiplier 84 * @mult: nanosecond to cycles multiplier
80 * @shift: nanoseconds to cycles divisor (power of two) 85 * @shift: nanoseconds to cycles divisor (power of two)
81 * @mode: operating mode assigned by the management code 86 * @mode: operating mode, relevant only to ->set_mode(), OBSOLETE
87 * @state: current state of the device, assigned by the core code
82 * @features: features 88 * @features: features
83 * @retries: number of forced programming retries 89 * @retries: number of forced programming retries
84 * @set_mode: set mode function 90 * @set_mode: legacy set mode function, only for modes <= CLOCK_EVT_MODE_RESUME.
91 * @set_state_periodic: switch state to periodic, if !set_mode
92 * @set_state_oneshot: switch state to oneshot, if !set_mode
93 * @set_state_shutdown: switch state to shutdown, if !set_mode
94 * @tick_resume: resume clkevt device, if !set_mode
85 * @broadcast: function to broadcast events 95 * @broadcast: function to broadcast events
86 * @min_delta_ticks: minimum delta value in ticks stored for reconfiguration 96 * @min_delta_ticks: minimum delta value in ticks stored for reconfiguration
87 * @max_delta_ticks: maximum delta value in ticks stored for reconfiguration 97 * @max_delta_ticks: maximum delta value in ticks stored for reconfiguration
@@ -95,22 +105,31 @@ enum clock_event_mode {
95 */ 105 */
96struct clock_event_device { 106struct clock_event_device {
97 void (*event_handler)(struct clock_event_device *); 107 void (*event_handler)(struct clock_event_device *);
98 int (*set_next_event)(unsigned long evt, 108 int (*set_next_event)(unsigned long evt, struct clock_event_device *);
99 struct clock_event_device *); 109 int (*set_next_ktime)(ktime_t expires, struct clock_event_device *);
100 int (*set_next_ktime)(ktime_t expires,
101 struct clock_event_device *);
102 ktime_t next_event; 110 ktime_t next_event;
103 u64 max_delta_ns; 111 u64 max_delta_ns;
104 u64 min_delta_ns; 112 u64 min_delta_ns;
105 u32 mult; 113 u32 mult;
106 u32 shift; 114 u32 shift;
107 enum clock_event_mode mode; 115 enum clock_event_mode mode;
116 enum clock_event_state state;
108 unsigned int features; 117 unsigned int features;
109 unsigned long retries; 118 unsigned long retries;
110 119
120 /*
121 * State transition callback(s): Only one of the two groups should be
122 * defined:
123 * - set_mode(), only for modes <= CLOCK_EVT_MODE_RESUME.
124 * - set_state_{shutdown|periodic|oneshot}(), tick_resume().
125 */
126 void (*set_mode)(enum clock_event_mode mode, struct clock_event_device *);
127 int (*set_state_periodic)(struct clock_event_device *);
128 int (*set_state_oneshot)(struct clock_event_device *);
129 int (*set_state_shutdown)(struct clock_event_device *);
130 int (*tick_resume)(struct clock_event_device *);
131
111 void (*broadcast)(const struct cpumask *mask); 132 void (*broadcast)(const struct cpumask *mask);
112 void (*set_mode)(enum clock_event_mode mode,
113 struct clock_event_device *);
114 void (*suspend)(struct clock_event_device *); 133 void (*suspend)(struct clock_event_device *);
115 void (*resume)(struct clock_event_device *); 134 void (*resume)(struct clock_event_device *);
116 unsigned long min_delta_ticks; 135 unsigned long min_delta_ticks;
@@ -136,18 +155,18 @@ struct clock_event_device {
136 * 155 *
137 * factor = (clock_ticks << shift) / nanoseconds 156 * factor = (clock_ticks << shift) / nanoseconds
138 */ 157 */
139static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec, 158static inline unsigned long
140 int shift) 159div_sc(unsigned long ticks, unsigned long nsec, int shift)
141{ 160{
142 uint64_t tmp = ((uint64_t)ticks) << shift; 161 u64 tmp = ((u64)ticks) << shift;
143 162
144 do_div(tmp, nsec); 163 do_div(tmp, nsec);
164
145 return (unsigned long) tmp; 165 return (unsigned long) tmp;
146} 166}
147 167
148/* Clock event layer functions */ 168/* Clock event layer functions */
149extern u64 clockevent_delta2ns(unsigned long latch, 169extern u64 clockevent_delta2ns(unsigned long latch, struct clock_event_device *evt);
150 struct clock_event_device *evt);
151extern void clockevents_register_device(struct clock_event_device *dev); 170extern void clockevents_register_device(struct clock_event_device *dev);
152extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu); 171extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu);
153 172
@@ -158,57 +177,42 @@ extern void clockevents_config_and_register(struct clock_event_device *dev,
158 177
159extern int clockevents_update_freq(struct clock_event_device *ce, u32 freq); 178extern int clockevents_update_freq(struct clock_event_device *ce, u32 freq);
160 179
161extern void clockevents_exchange_device(struct clock_event_device *old,
162 struct clock_event_device *new);
163extern void clockevents_set_mode(struct clock_event_device *dev,
164 enum clock_event_mode mode);
165extern int clockevents_program_event(struct clock_event_device *dev,
166 ktime_t expires, bool force);
167
168extern void clockevents_handle_noop(struct clock_event_device *dev);
169
170static inline void 180static inline void
171clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec) 181clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec)
172{ 182{
173 return clocks_calc_mult_shift(&ce->mult, &ce->shift, NSEC_PER_SEC, 183 return clocks_calc_mult_shift(&ce->mult, &ce->shift, NSEC_PER_SEC, freq, minsec);
174 freq, minsec);
175} 184}
176 185
177extern void clockevents_suspend(void); 186extern void clockevents_suspend(void);
178extern void clockevents_resume(void); 187extern void clockevents_resume(void);
179 188
180#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 189# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
181#ifdef CONFIG_ARCH_HAS_TICK_BROADCAST 190# ifdef CONFIG_ARCH_HAS_TICK_BROADCAST
182extern void tick_broadcast(const struct cpumask *mask); 191extern void tick_broadcast(const struct cpumask *mask);
183#else 192# else
184#define tick_broadcast NULL 193# define tick_broadcast NULL
185#endif 194# endif
186extern int tick_receive_broadcast(void); 195extern int tick_receive_broadcast(void);
187#endif 196# endif
188 197
189#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) 198# if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
190extern void tick_setup_hrtimer_broadcast(void); 199extern void tick_setup_hrtimer_broadcast(void);
191extern int tick_check_broadcast_expired(void); 200extern int tick_check_broadcast_expired(void);
192#else 201# else
193static inline int tick_check_broadcast_expired(void) { return 0; } 202static inline int tick_check_broadcast_expired(void) { return 0; }
194static inline void tick_setup_hrtimer_broadcast(void) {}; 203static inline void tick_setup_hrtimer_broadcast(void) { }
195#endif 204# endif
196 205
197#ifdef CONFIG_GENERIC_CLOCKEVENTS
198extern int clockevents_notify(unsigned long reason, void *arg); 206extern int clockevents_notify(unsigned long reason, void *arg);
199#else
200static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; }
201#endif
202
203#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */
204 207
205static inline void clockevents_suspend(void) {} 208#else /* !CONFIG_GENERIC_CLOCKEVENTS: */
206static inline void clockevents_resume(void) {}
207 209
210static inline void clockevents_suspend(void) { }
211static inline void clockevents_resume(void) { }
208static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; } 212static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; }
209static inline int tick_check_broadcast_expired(void) { return 0; } 213static inline int tick_check_broadcast_expired(void) { return 0; }
210static inline void tick_setup_hrtimer_broadcast(void) {}; 214static inline void tick_setup_hrtimer_broadcast(void) { }
211 215
212#endif 216#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
213 217
214#endif 218#endif /* _LINUX_CLOCKCHIPS_H */
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 9c78d15d33e4..d27d0152271f 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -56,6 +56,7 @@ struct module;
56 * @shift: cycle to nanosecond divisor (power of two) 56 * @shift: cycle to nanosecond divisor (power of two)
57 * @max_idle_ns: max idle time permitted by the clocksource (nsecs) 57 * @max_idle_ns: max idle time permitted by the clocksource (nsecs)
58 * @maxadj: maximum adjustment value to mult (~11%) 58 * @maxadj: maximum adjustment value to mult (~11%)
59 * @max_cycles: maximum safe cycle value which won't overflow on multiplication
59 * @flags: flags describing special properties 60 * @flags: flags describing special properties
60 * @archdata: arch-specific data 61 * @archdata: arch-specific data
61 * @suspend: suspend function for the clocksource, if necessary 62 * @suspend: suspend function for the clocksource, if necessary
@@ -76,7 +77,7 @@ struct clocksource {
76#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA 77#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA
77 struct arch_clocksource_data archdata; 78 struct arch_clocksource_data archdata;
78#endif 79#endif
79 80 u64 max_cycles;
80 const char *name; 81 const char *name;
81 struct list_head list; 82 struct list_head list;
82 int rating; 83 int rating;
@@ -178,7 +179,6 @@ static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
178} 179}
179 180
180 181
181extern int clocksource_register(struct clocksource*);
182extern int clocksource_unregister(struct clocksource*); 182extern int clocksource_unregister(struct clocksource*);
183extern void clocksource_touch_watchdog(void); 183extern void clocksource_touch_watchdog(void);
184extern struct clocksource* clocksource_get_next(void); 184extern struct clocksource* clocksource_get_next(void);
@@ -189,7 +189,7 @@ extern struct clocksource * __init clocksource_default_clock(void);
189extern void clocksource_mark_unstable(struct clocksource *cs); 189extern void clocksource_mark_unstable(struct clocksource *cs);
190 190
191extern u64 191extern u64
192clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask); 192clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask, u64 *max_cycles);
193extern void 193extern void
194clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec); 194clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
195 195
@@ -200,7 +200,16 @@ clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
200extern int 200extern int
201__clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq); 201__clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq);
202extern void 202extern void
203__clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq); 203__clocksource_update_freq_scale(struct clocksource *cs, u32 scale, u32 freq);
204
205/*
206 * Don't call this unless you are a default clocksource
207 * (AKA: jiffies) and absolutely have to.
208 */
209static inline int __clocksource_register(struct clocksource *cs)
210{
211 return __clocksource_register_scale(cs, 1, 0);
212}
204 213
205static inline int clocksource_register_hz(struct clocksource *cs, u32 hz) 214static inline int clocksource_register_hz(struct clocksource *cs, u32 hz)
206{ 215{
@@ -212,14 +221,14 @@ static inline int clocksource_register_khz(struct clocksource *cs, u32 khz)
212 return __clocksource_register_scale(cs, 1000, khz); 221 return __clocksource_register_scale(cs, 1000, khz);
213} 222}
214 223
215static inline void __clocksource_updatefreq_hz(struct clocksource *cs, u32 hz) 224static inline void __clocksource_update_freq_hz(struct clocksource *cs, u32 hz)
216{ 225{
217 __clocksource_updatefreq_scale(cs, 1, hz); 226 __clocksource_update_freq_scale(cs, 1, hz);
218} 227}
219 228
220static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz) 229static inline void __clocksource_update_freq_khz(struct clocksource *cs, u32 khz)
221{ 230{
222 __clocksource_updatefreq_scale(cs, 1000, khz); 231 __clocksource_update_freq_scale(cs, 1000, khz);
223} 232}
224 233
225 234
@@ -244,4 +253,10 @@ extern void clocksource_of_init(void);
244static inline void clocksource_of_init(void) {} 253static inline void clocksource_of_init(void) {}
245#endif 254#endif
246 255
256#ifdef CONFIG_ACPI
257void acpi_generic_timer_init(void);
258#else
259static inline void acpi_generic_timer_init(void) { }
260#endif
261
247#endif /* _LINUX_CLOCKSOURCE_H */ 262#endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/cma.h b/include/linux/cma.h
index 9384ba66e975..f7ef093ec49a 100644
--- a/include/linux/cma.h
+++ b/include/linux/cma.h
@@ -16,16 +16,16 @@
16struct cma; 16struct cma;
17 17
18extern unsigned long totalcma_pages; 18extern unsigned long totalcma_pages;
19extern phys_addr_t cma_get_base(struct cma *cma); 19extern phys_addr_t cma_get_base(const struct cma *cma);
20extern unsigned long cma_get_size(struct cma *cma); 20extern unsigned long cma_get_size(const struct cma *cma);
21 21
22extern int __init cma_declare_contiguous(phys_addr_t base, 22extern int __init cma_declare_contiguous(phys_addr_t base,
23 phys_addr_t size, phys_addr_t limit, 23 phys_addr_t size, phys_addr_t limit,
24 phys_addr_t alignment, unsigned int order_per_bit, 24 phys_addr_t alignment, unsigned int order_per_bit,
25 bool fixed, struct cma **res_cma); 25 bool fixed, struct cma **res_cma);
26extern int cma_init_reserved_mem(phys_addr_t base, 26extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,
27 phys_addr_t size, int order_per_bit, 27 unsigned int order_per_bit,
28 struct cma **res_cma); 28 struct cma **res_cma);
29extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align); 29extern struct page *cma_alloc(struct cma *cma, unsigned int count, unsigned int align);
30extern bool cma_release(struct cma *cma, struct page *pages, int count); 30extern bool cma_release(struct cma *cma, const struct page *pages, unsigned int count);
31#endif 31#endif
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index a014559e4a49..aa8f61cf3a19 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -34,6 +34,7 @@ extern int sysctl_compaction_handler(struct ctl_table *table, int write,
34extern int sysctl_extfrag_threshold; 34extern int sysctl_extfrag_threshold;
35extern int sysctl_extfrag_handler(struct ctl_table *table, int write, 35extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
36 void __user *buffer, size_t *length, loff_t *ppos); 36 void __user *buffer, size_t *length, loff_t *ppos);
37extern int sysctl_compact_unevictable_allowed;
37 38
38extern int fragmentation_index(struct zone *zone, unsigned int order); 39extern int fragmentation_index(struct zone *zone, unsigned int order);
39extern unsigned long try_to_compact_pages(gfp_t gfp_mask, unsigned int order, 40extern unsigned long try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 1b45e4a0519b..0e41ca0e5927 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -192,29 +192,16 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
192 192
193#include <uapi/linux/types.h> 193#include <uapi/linux/types.h>
194 194
195static __always_inline void data_access_exceeds_word_size(void)
196#ifdef __compiletime_warning
197__compiletime_warning("data access exceeds word size and won't be atomic")
198#endif
199;
200
201static __always_inline void data_access_exceeds_word_size(void)
202{
203}
204
205static __always_inline void __read_once_size(const volatile void *p, void *res, int size) 195static __always_inline void __read_once_size(const volatile void *p, void *res, int size)
206{ 196{
207 switch (size) { 197 switch (size) {
208 case 1: *(__u8 *)res = *(volatile __u8 *)p; break; 198 case 1: *(__u8 *)res = *(volatile __u8 *)p; break;
209 case 2: *(__u16 *)res = *(volatile __u16 *)p; break; 199 case 2: *(__u16 *)res = *(volatile __u16 *)p; break;
210 case 4: *(__u32 *)res = *(volatile __u32 *)p; break; 200 case 4: *(__u32 *)res = *(volatile __u32 *)p; break;
211#ifdef CONFIG_64BIT
212 case 8: *(__u64 *)res = *(volatile __u64 *)p; break; 201 case 8: *(__u64 *)res = *(volatile __u64 *)p; break;
213#endif
214 default: 202 default:
215 barrier(); 203 barrier();
216 __builtin_memcpy((void *)res, (const void *)p, size); 204 __builtin_memcpy((void *)res, (const void *)p, size);
217 data_access_exceeds_word_size();
218 barrier(); 205 barrier();
219 } 206 }
220} 207}
@@ -225,13 +212,10 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
225 case 1: *(volatile __u8 *)p = *(__u8 *)res; break; 212 case 1: *(volatile __u8 *)p = *(__u8 *)res; break;
226 case 2: *(volatile __u16 *)p = *(__u16 *)res; break; 213 case 2: *(volatile __u16 *)p = *(__u16 *)res; break;
227 case 4: *(volatile __u32 *)p = *(__u32 *)res; break; 214 case 4: *(volatile __u32 *)p = *(__u32 *)res; break;
228#ifdef CONFIG_64BIT
229 case 8: *(volatile __u64 *)p = *(__u64 *)res; break; 215 case 8: *(volatile __u64 *)p = *(__u64 *)res; break;
230#endif
231 default: 216 default:
232 barrier(); 217 barrier();
233 __builtin_memcpy((void *)p, (const void *)res, size); 218 __builtin_memcpy((void *)p, (const void *)res, size);
234 data_access_exceeds_word_size();
235 barrier(); 219 barrier();
236 } 220 }
237} 221}
diff --git a/include/linux/console.h b/include/linux/console.h
index 7571a16bd653..9f50fb413c11 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -123,7 +123,7 @@ struct console {
123 struct tty_driver *(*device)(struct console *, int *); 123 struct tty_driver *(*device)(struct console *, int *);
124 void (*unblank)(void); 124 void (*unblank)(void);
125 int (*setup)(struct console *, char *); 125 int (*setup)(struct console *, char *);
126 int (*early_setup)(void); 126 int (*match)(struct console *, char *name, int idx, char *options);
127 short flags; 127 short flags;
128 short index; 128 short index;
129 int cflag; 129 int cflag;
@@ -141,7 +141,6 @@ extern int console_set_on_cmdline;
141extern struct console *early_console; 141extern struct console *early_console;
142 142
143extern int add_preferred_console(char *name, int idx, char *options); 143extern int add_preferred_console(char *name, int idx, char *options);
144extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options);
145extern void register_console(struct console *); 144extern void register_console(struct console *);
146extern int unregister_console(struct console *); 145extern int unregister_console(struct console *);
147extern struct console *console_drivers; 146extern struct console *console_drivers;
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 37b81bd51ec0..2821838256b4 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -10,6 +10,8 @@
10#ifdef CONFIG_CONTEXT_TRACKING 10#ifdef CONFIG_CONTEXT_TRACKING
11extern void context_tracking_cpu_set(int cpu); 11extern void context_tracking_cpu_set(int cpu);
12 12
13extern void context_tracking_enter(enum ctx_state state);
14extern void context_tracking_exit(enum ctx_state state);
13extern void context_tracking_user_enter(void); 15extern void context_tracking_user_enter(void);
14extern void context_tracking_user_exit(void); 16extern void context_tracking_user_exit(void);
15extern void __context_tracking_task_switch(struct task_struct *prev, 17extern void __context_tracking_task_switch(struct task_struct *prev,
@@ -35,7 +37,8 @@ static inline enum ctx_state exception_enter(void)
35 return 0; 37 return 0;
36 38
37 prev_ctx = this_cpu_read(context_tracking.state); 39 prev_ctx = this_cpu_read(context_tracking.state);
38 context_tracking_user_exit(); 40 if (prev_ctx != CONTEXT_KERNEL)
41 context_tracking_exit(prev_ctx);
39 42
40 return prev_ctx; 43 return prev_ctx;
41} 44}
@@ -43,8 +46,8 @@ static inline enum ctx_state exception_enter(void)
43static inline void exception_exit(enum ctx_state prev_ctx) 46static inline void exception_exit(enum ctx_state prev_ctx)
44{ 47{
45 if (context_tracking_is_enabled()) { 48 if (context_tracking_is_enabled()) {
46 if (prev_ctx == IN_USER) 49 if (prev_ctx != CONTEXT_KERNEL)
47 context_tracking_user_enter(); 50 context_tracking_enter(prev_ctx);
48 } 51 }
49} 52}
50 53
@@ -78,10 +81,16 @@ static inline void guest_enter(void)
78 vtime_guest_enter(current); 81 vtime_guest_enter(current);
79 else 82 else
80 current->flags |= PF_VCPU; 83 current->flags |= PF_VCPU;
84
85 if (context_tracking_is_enabled())
86 context_tracking_enter(CONTEXT_GUEST);
81} 87}
82 88
83static inline void guest_exit(void) 89static inline void guest_exit(void)
84{ 90{
91 if (context_tracking_is_enabled())
92 context_tracking_exit(CONTEXT_GUEST);
93
85 if (vtime_accounting_enabled()) 94 if (vtime_accounting_enabled())
86 vtime_guest_exit(current); 95 vtime_guest_exit(current);
87 else 96 else
diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
index 97a81225d037..6b7b96a32b75 100644
--- a/include/linux/context_tracking_state.h
+++ b/include/linux/context_tracking_state.h
@@ -13,8 +13,9 @@ struct context_tracking {
13 */ 13 */
14 bool active; 14 bool active;
15 enum ctx_state { 15 enum ctx_state {
16 IN_KERNEL = 0, 16 CONTEXT_KERNEL = 0,
17 IN_USER, 17 CONTEXT_USER,
18 CONTEXT_GUEST,
18 } state; 19 } state;
19}; 20};
20 21
@@ -34,11 +35,13 @@ static inline bool context_tracking_cpu_is_enabled(void)
34 35
35static inline bool context_tracking_in_user(void) 36static inline bool context_tracking_in_user(void)
36{ 37{
37 return __this_cpu_read(context_tracking.state) == IN_USER; 38 return __this_cpu_read(context_tracking.state) == CONTEXT_USER;
38} 39}
39#else 40#else
40static inline bool context_tracking_in_user(void) { return false; } 41static inline bool context_tracking_in_user(void) { return false; }
41static inline bool context_tracking_active(void) { return false; } 42static inline bool context_tracking_active(void) { return false; }
43static inline bool context_tracking_is_enabled(void) { return false; }
44static inline bool context_tracking_cpu_is_enabled(void) { return false; }
42#endif /* CONFIG_CONTEXT_TRACKING */ 45#endif /* CONFIG_CONTEXT_TRACKING */
43 46
44#endif 47#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 4260e8594bd7..c0fb6b1b4712 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -73,6 +73,7 @@ enum {
73 /* migration should happen before other stuff but after perf */ 73 /* migration should happen before other stuff but after perf */
74 CPU_PRI_PERF = 20, 74 CPU_PRI_PERF = 20,
75 CPU_PRI_MIGRATION = 10, 75 CPU_PRI_MIGRATION = 10,
76 CPU_PRI_SMPBOOT = 9,
76 /* bring up workqueues before normal notifiers and down after */ 77 /* bring up workqueues before normal notifiers and down after */
77 CPU_PRI_WORKQUEUE_UP = 5, 78 CPU_PRI_WORKQUEUE_UP = 5,
78 CPU_PRI_WORKQUEUE_DOWN = -5, 79 CPU_PRI_WORKQUEUE_DOWN = -5,
@@ -95,6 +96,10 @@ enum {
95 * Called on the new cpu, just before 96 * Called on the new cpu, just before
96 * enabling interrupts. Must not sleep, 97 * enabling interrupts. Must not sleep,
97 * must not fail */ 98 * must not fail */
99#define CPU_DYING_IDLE 0x000B /* CPU (unsigned)v dying, reached
100 * idle loop. */
101#define CPU_BROKEN 0x000C /* CPU (unsigned)v did not die properly,
102 * perhaps due to preemption. */
98 103
99/* Used for CPU hotplug events occurring while tasks are frozen due to a suspend 104/* Used for CPU hotplug events occurring while tasks are frozen due to a suspend
100 * operation in progress 105 * operation in progress
@@ -161,6 +166,7 @@ static inline void __unregister_cpu_notifier(struct notifier_block *nb)
161} 166}
162#endif 167#endif
163 168
169void smpboot_thread_init(void);
164int cpu_up(unsigned int cpu); 170int cpu_up(unsigned int cpu);
165void notify_cpu_starting(unsigned int cpu); 171void notify_cpu_starting(unsigned int cpu);
166extern void cpu_maps_update_begin(void); 172extern void cpu_maps_update_begin(void);
@@ -208,6 +214,10 @@ static inline void cpu_notifier_register_done(void)
208{ 214{
209} 215}
210 216
217static inline void smpboot_thread_init(void)
218{
219}
220
211#endif /* CONFIG_SMP */ 221#endif /* CONFIG_SMP */
212extern struct bus_type cpu_subsys; 222extern struct bus_type cpu_subsys;
213 223
@@ -271,4 +281,14 @@ void arch_cpu_idle_enter(void);
271void arch_cpu_idle_exit(void); 281void arch_cpu_idle_exit(void);
272void arch_cpu_idle_dead(void); 282void arch_cpu_idle_dead(void);
273 283
284DECLARE_PER_CPU(bool, cpu_dead_idle);
285
286int cpu_report_state(int cpu);
287int cpu_check_up_prepare(int cpu);
288void cpu_set_state_online(int cpu);
289#ifdef CONFIG_HOTPLUG_CPU
290bool cpu_wait_death(unsigned int cpu, int seconds);
291bool cpu_report_death(void);
292#endif /* #ifdef CONFIG_HOTPLUG_CPU */
293
274#endif /* _LINUX_CPU_H_ */ 294#endif /* _LINUX_CPU_H_ */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index f551a9299ac9..9c5e89254796 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -77,7 +77,6 @@ struct cpuidle_device {
77 unsigned int cpu; 77 unsigned int cpu;
78 78
79 int last_residency; 79 int last_residency;
80 int state_count;
81 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; 80 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX];
82 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; 81 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
83 struct cpuidle_driver_kobj *kobj_driver; 82 struct cpuidle_driver_kobj *kobj_driver;
@@ -126,6 +125,8 @@ struct cpuidle_driver {
126 125
127#ifdef CONFIG_CPU_IDLE 126#ifdef CONFIG_CPU_IDLE
128extern void disable_cpuidle(void); 127extern void disable_cpuidle(void);
128extern bool cpuidle_not_available(struct cpuidle_driver *drv,
129 struct cpuidle_device *dev);
129 130
130extern int cpuidle_select(struct cpuidle_driver *drv, 131extern int cpuidle_select(struct cpuidle_driver *drv,
131 struct cpuidle_device *dev); 132 struct cpuidle_device *dev);
@@ -150,11 +151,17 @@ extern void cpuidle_resume(void);
150extern int cpuidle_enable_device(struct cpuidle_device *dev); 151extern int cpuidle_enable_device(struct cpuidle_device *dev);
151extern void cpuidle_disable_device(struct cpuidle_device *dev); 152extern void cpuidle_disable_device(struct cpuidle_device *dev);
152extern int cpuidle_play_dead(void); 153extern int cpuidle_play_dead(void);
153extern void cpuidle_enter_freeze(void); 154extern int cpuidle_find_deepest_state(struct cpuidle_driver *drv,
155 struct cpuidle_device *dev);
156extern int cpuidle_enter_freeze(struct cpuidle_driver *drv,
157 struct cpuidle_device *dev);
154 158
155extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); 159extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
156#else 160#else
157static inline void disable_cpuidle(void) { } 161static inline void disable_cpuidle(void) { }
162static inline bool cpuidle_not_available(struct cpuidle_driver *drv,
163 struct cpuidle_device *dev)
164{return true; }
158static inline int cpuidle_select(struct cpuidle_driver *drv, 165static inline int cpuidle_select(struct cpuidle_driver *drv,
159 struct cpuidle_device *dev) 166 struct cpuidle_device *dev)
160{return -ENODEV; } 167{return -ENODEV; }
@@ -183,7 +190,12 @@ static inline int cpuidle_enable_device(struct cpuidle_device *dev)
183{return -ENODEV; } 190{return -ENODEV; }
184static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } 191static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
185static inline int cpuidle_play_dead(void) {return -ENODEV; } 192static inline int cpuidle_play_dead(void) {return -ENODEV; }
186static inline void cpuidle_enter_freeze(void) { } 193static inline int cpuidle_find_deepest_state(struct cpuidle_driver *drv,
194 struct cpuidle_device *dev)
195{return -ENODEV; }
196static inline int cpuidle_enter_freeze(struct cpuidle_driver *drv,
197 struct cpuidle_device *dev)
198{return -ENODEV; }
187static inline struct cpuidle_driver *cpuidle_get_cpu_driver( 199static inline struct cpuidle_driver *cpuidle_get_cpu_driver(
188 struct cpuidle_device *dev) {return NULL; } 200 struct cpuidle_device *dev) {return NULL; }
189#endif 201#endif
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 086549a665e2..27e285b92b5f 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -11,6 +11,7 @@
11#include <linux/bitmap.h> 11#include <linux/bitmap.h>
12#include <linux/bug.h> 12#include <linux/bug.h>
13 13
14/* Don't assign or return these: may not be this big! */
14typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; 15typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
15 16
16/** 17/**
@@ -289,11 +290,11 @@ static inline void cpumask_clear_cpu(int cpu, struct cpumask *dstp)
289 * @cpumask: the cpumask pointer 290 * @cpumask: the cpumask pointer
290 * 291 *
291 * Returns 1 if @cpu is set in @cpumask, else returns 0 292 * Returns 1 if @cpu is set in @cpumask, else returns 0
292 *
293 * No static inline type checking - see Subtlety (1) above.
294 */ 293 */
295#define cpumask_test_cpu(cpu, cpumask) \ 294static inline int cpumask_test_cpu(int cpu, const struct cpumask *cpumask)
296 test_bit(cpumask_check(cpu), cpumask_bits((cpumask))) 295{
296 return test_bit(cpumask_check(cpu), cpumask_bits((cpumask)));
297}
297 298
298/** 299/**
299 * cpumask_test_and_set_cpu - atomically test and set a cpu in a cpumask 300 * cpumask_test_and_set_cpu - atomically test and set a cpu in a cpumask
@@ -609,9 +610,7 @@ static inline int cpulist_parse(const char *buf, struct cpumask *dstp)
609 */ 610 */
610static inline size_t cpumask_size(void) 611static inline size_t cpumask_size(void)
611{ 612{
612 /* FIXME: Once all cpumask assignments are eliminated, this 613 return BITS_TO_LONGS(nr_cpumask_bits) * sizeof(long);
613 * can be nr_cpumask_bits */
614 return BITS_TO_LONGS(NR_CPUS) * sizeof(long);
615} 614}
616 615
617/* 616/*
@@ -768,7 +767,7 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
768#if NR_CPUS <= BITS_PER_LONG 767#if NR_CPUS <= BITS_PER_LONG
769#define CPU_BITS_ALL \ 768#define CPU_BITS_ALL \
770{ \ 769{ \
771 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \ 770 [BITS_TO_LONGS(NR_CPUS)-1] = BITMAP_LAST_WORD_MASK(NR_CPUS) \
772} 771}
773 772
774#else /* NR_CPUS > BITS_PER_LONG */ 773#else /* NR_CPUS > BITS_PER_LONG */
@@ -776,7 +775,7 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
776#define CPU_BITS_ALL \ 775#define CPU_BITS_ALL \
777{ \ 776{ \
778 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \ 777 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
779 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \ 778 [BITS_TO_LONGS(NR_CPUS)-1] = BITMAP_LAST_WORD_MASK(NR_CPUS) \
780} 779}
781#endif /* NR_CPUS > BITS_PER_LONG */ 780#endif /* NR_CPUS > BITS_PER_LONG */
782 781
@@ -797,32 +796,18 @@ cpumap_print_to_pagebuf(bool list, char *buf, const struct cpumask *mask)
797 nr_cpu_ids); 796 nr_cpu_ids);
798} 797}
799 798
800/*
801 *
802 * From here down, all obsolete. Use cpumask_ variants!
803 *
804 */
805#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
806#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu))
807
808#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
809
810#if NR_CPUS <= BITS_PER_LONG 799#if NR_CPUS <= BITS_PER_LONG
811
812#define CPU_MASK_ALL \ 800#define CPU_MASK_ALL \
813(cpumask_t) { { \ 801(cpumask_t) { { \
814 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \ 802 [BITS_TO_LONGS(NR_CPUS)-1] = BITMAP_LAST_WORD_MASK(NR_CPUS) \
815} } 803} }
816
817#else 804#else
818
819#define CPU_MASK_ALL \ 805#define CPU_MASK_ALL \
820(cpumask_t) { { \ 806(cpumask_t) { { \
821 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \ 807 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
822 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \ 808 [BITS_TO_LONGS(NR_CPUS)-1] = BITMAP_LAST_WORD_MASK(NR_CPUS) \
823} } 809} }
824 810#endif /* NR_CPUS > BITS_PER_LONG */
825#endif
826 811
827#define CPU_MASK_NONE \ 812#define CPU_MASK_NONE \
828(cpumask_t) { { \ 813(cpumask_t) { { \
@@ -834,143 +819,4 @@ cpumap_print_to_pagebuf(bool list, char *buf, const struct cpumask *mask)
834 [0] = 1UL \ 819 [0] = 1UL \
835} } 820} }
836 821
837#if NR_CPUS == 1
838#define first_cpu(src) ({ (void)(src); 0; })
839#define next_cpu(n, src) ({ (void)(src); 1; })
840#define any_online_cpu(mask) 0
841#define for_each_cpu_mask(cpu, mask) \
842 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
843#else /* NR_CPUS > 1 */
844int __first_cpu(const cpumask_t *srcp);
845int __next_cpu(int n, const cpumask_t *srcp);
846
847#define first_cpu(src) __first_cpu(&(src))
848#define next_cpu(n, src) __next_cpu((n), &(src))
849#define any_online_cpu(mask) cpumask_any_and(&mask, cpu_online_mask)
850#define for_each_cpu_mask(cpu, mask) \
851 for ((cpu) = -1; \
852 (cpu) = next_cpu((cpu), (mask)), \
853 (cpu) < NR_CPUS; )
854#endif /* SMP */
855
856#if NR_CPUS <= 64
857
858#define for_each_cpu_mask_nr(cpu, mask) for_each_cpu_mask(cpu, mask)
859
860#else /* NR_CPUS > 64 */
861
862int __next_cpu_nr(int n, const cpumask_t *srcp);
863#define for_each_cpu_mask_nr(cpu, mask) \
864 for ((cpu) = -1; \
865 (cpu) = __next_cpu_nr((cpu), &(mask)), \
866 (cpu) < nr_cpu_ids; )
867
868#endif /* NR_CPUS > 64 */
869
870#define cpus_addr(src) ((src).bits)
871
872#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
873static inline void __cpu_set(int cpu, volatile cpumask_t *dstp)
874{
875 set_bit(cpu, dstp->bits);
876}
877
878#define cpu_clear(cpu, dst) __cpu_clear((cpu), &(dst))
879static inline void __cpu_clear(int cpu, volatile cpumask_t *dstp)
880{
881 clear_bit(cpu, dstp->bits);
882}
883
884#define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS)
885static inline void __cpus_setall(cpumask_t *dstp, unsigned int nbits)
886{
887 bitmap_fill(dstp->bits, nbits);
888}
889
890#define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS)
891static inline void __cpus_clear(cpumask_t *dstp, unsigned int nbits)
892{
893 bitmap_zero(dstp->bits, nbits);
894}
895
896/* No static inline type checking - see Subtlety (1) above. */
897#define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits)
898
899#define cpu_test_and_set(cpu, cpumask) __cpu_test_and_set((cpu), &(cpumask))
900static inline int __cpu_test_and_set(int cpu, cpumask_t *addr)
901{
902 return test_and_set_bit(cpu, addr->bits);
903}
904
905#define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
906static inline int __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
907 const cpumask_t *src2p, unsigned int nbits)
908{
909 return bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
910}
911
912#define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
913static inline void __cpus_or(cpumask_t *dstp, const cpumask_t *src1p,
914 const cpumask_t *src2p, unsigned int nbits)
915{
916 bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits);
917}
918
919#define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS)
920static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,
921 const cpumask_t *src2p, unsigned int nbits)
922{
923 bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits);
924}
925
926#define cpus_andnot(dst, src1, src2) \
927 __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
928static inline int __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p,
929 const cpumask_t *src2p, unsigned int nbits)
930{
931 return bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
932}
933
934#define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), NR_CPUS)
935static inline int __cpus_equal(const cpumask_t *src1p,
936 const cpumask_t *src2p, unsigned int nbits)
937{
938 return bitmap_equal(src1p->bits, src2p->bits, nbits);
939}
940
941#define cpus_intersects(src1, src2) __cpus_intersects(&(src1), &(src2), NR_CPUS)
942static inline int __cpus_intersects(const cpumask_t *src1p,
943 const cpumask_t *src2p, unsigned int nbits)
944{
945 return bitmap_intersects(src1p->bits, src2p->bits, nbits);
946}
947
948#define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), NR_CPUS)
949static inline int __cpus_subset(const cpumask_t *src1p,
950 const cpumask_t *src2p, unsigned int nbits)
951{
952 return bitmap_subset(src1p->bits, src2p->bits, nbits);
953}
954
955#define cpus_empty(src) __cpus_empty(&(src), NR_CPUS)
956static inline int __cpus_empty(const cpumask_t *srcp, unsigned int nbits)
957{
958 return bitmap_empty(srcp->bits, nbits);
959}
960
961#define cpus_weight(cpumask) __cpus_weight(&(cpumask), NR_CPUS)
962static inline int __cpus_weight(const cpumask_t *srcp, unsigned int nbits)
963{
964 return bitmap_weight(srcp->bits, nbits);
965}
966
967#define cpus_shift_left(dst, src, n) \
968 __cpus_shift_left(&(dst), &(src), (n), NR_CPUS)
969static inline void __cpus_shift_left(cpumask_t *dstp,
970 const cpumask_t *srcp, int n, int nbits)
971{
972 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
973}
974#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
975
976#endif /* __LINUX_CPUMASK_H */ 822#endif /* __LINUX_CPUMASK_H */
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 2fb2ca2127ed..8b6c083e68a7 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -62,9 +62,27 @@ do { \
62 groups_free(group_info); \ 62 groups_free(group_info); \
63} while (0) 63} while (0)
64 64
65extern struct group_info *groups_alloc(int);
66extern struct group_info init_groups; 65extern struct group_info init_groups;
66#ifdef CONFIG_MULTIUSER
67extern struct group_info *groups_alloc(int);
67extern void groups_free(struct group_info *); 68extern void groups_free(struct group_info *);
69
70extern int in_group_p(kgid_t);
71extern int in_egroup_p(kgid_t);
72#else
73static inline void groups_free(struct group_info *group_info)
74{
75}
76
77static inline int in_group_p(kgid_t grp)
78{
79 return 1;
80}
81static inline int in_egroup_p(kgid_t grp)
82{
83 return 1;
84}
85#endif
68extern int set_current_groups(struct group_info *); 86extern int set_current_groups(struct group_info *);
69extern void set_groups(struct cred *, struct group_info *); 87extern void set_groups(struct cred *, struct group_info *);
70extern int groups_search(const struct group_info *, kgid_t); 88extern int groups_search(const struct group_info *, kgid_t);
@@ -74,9 +92,6 @@ extern bool may_setgroups(void);
74#define GROUP_AT(gi, i) \ 92#define GROUP_AT(gi, i) \
75 ((gi)->blocks[(i) / NGROUPS_PER_BLOCK][(i) % NGROUPS_PER_BLOCK]) 93 ((gi)->blocks[(i) / NGROUPS_PER_BLOCK][(i) % NGROUPS_PER_BLOCK])
76 94
77extern int in_group_p(kgid_t);
78extern int in_egroup_p(kgid_t);
79
80/* 95/*
81 * The security context of a task 96 * The security context of a task
82 * 97 *
diff --git a/include/linux/crush/crush.h b/include/linux/crush/crush.h
index 4fad5f8ee01d..48a1a7d100f1 100644
--- a/include/linux/crush/crush.h
+++ b/include/linux/crush/crush.h
@@ -96,13 +96,15 @@ struct crush_rule {
96 * uniform O(1) poor poor 96 * uniform O(1) poor poor
97 * list O(n) optimal poor 97 * list O(n) optimal poor
98 * tree O(log n) good good 98 * tree O(log n) good good
99 * straw O(n) optimal optimal 99 * straw O(n) better better
100 * straw2 O(n) optimal optimal
100 */ 101 */
101enum { 102enum {
102 CRUSH_BUCKET_UNIFORM = 1, 103 CRUSH_BUCKET_UNIFORM = 1,
103 CRUSH_BUCKET_LIST = 2, 104 CRUSH_BUCKET_LIST = 2,
104 CRUSH_BUCKET_TREE = 3, 105 CRUSH_BUCKET_TREE = 3,
105 CRUSH_BUCKET_STRAW = 4 106 CRUSH_BUCKET_STRAW = 4,
107 CRUSH_BUCKET_STRAW2 = 5,
106}; 108};
107extern const char *crush_bucket_alg_name(int alg); 109extern const char *crush_bucket_alg_name(int alg);
108 110
@@ -149,6 +151,11 @@ struct crush_bucket_straw {
149 __u32 *straws; /* 16-bit fixed point */ 151 __u32 *straws; /* 16-bit fixed point */
150}; 152};
151 153
154struct crush_bucket_straw2 {
155 struct crush_bucket h;
156 __u32 *item_weights; /* 16-bit fixed point */
157};
158
152 159
153 160
154/* 161/*
@@ -189,6 +196,7 @@ extern void crush_destroy_bucket_uniform(struct crush_bucket_uniform *b);
189extern void crush_destroy_bucket_list(struct crush_bucket_list *b); 196extern void crush_destroy_bucket_list(struct crush_bucket_list *b);
190extern void crush_destroy_bucket_tree(struct crush_bucket_tree *b); 197extern void crush_destroy_bucket_tree(struct crush_bucket_tree *b);
191extern void crush_destroy_bucket_straw(struct crush_bucket_straw *b); 198extern void crush_destroy_bucket_straw(struct crush_bucket_straw *b);
199extern void crush_destroy_bucket_straw2(struct crush_bucket_straw2 *b);
192extern void crush_destroy_bucket(struct crush_bucket *b); 200extern void crush_destroy_bucket(struct crush_bucket *b);
193extern void crush_destroy_rule(struct crush_rule *r); 201extern void crush_destroy_rule(struct crush_rule *r);
194extern void crush_destroy(struct crush_map *map); 202extern void crush_destroy(struct crush_map *map);
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index fb5ef16d6a12..10df5d2d093a 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -95,6 +95,12 @@
95#define CRYPTO_ALG_KERN_DRIVER_ONLY 0x00001000 95#define CRYPTO_ALG_KERN_DRIVER_ONLY 0x00001000
96 96
97/* 97/*
98 * Mark a cipher as a service implementation only usable by another
99 * cipher and never by a normal user of the kernel crypto API
100 */
101#define CRYPTO_ALG_INTERNAL 0x00002000
102
103/*
98 * Transform masks and values (for crt_flags). 104 * Transform masks and values (for crt_flags).
99 */ 105 */
100#define CRYPTO_TFM_REQ_MASK 0x000fff00 106#define CRYPTO_TFM_REQ_MASK 0x000fff00
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index d8358799c594..df334cbacc6d 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -404,26 +404,11 @@ static inline bool d_mountpoint(const struct dentry *dentry)
404/* 404/*
405 * Directory cache entry type accessor functions. 405 * Directory cache entry type accessor functions.
406 */ 406 */
407static inline void __d_set_type(struct dentry *dentry, unsigned type)
408{
409 dentry->d_flags = (dentry->d_flags & ~DCACHE_ENTRY_TYPE) | type;
410}
411
412static inline void __d_clear_type(struct dentry *dentry)
413{
414 __d_set_type(dentry, DCACHE_MISS_TYPE);
415}
416
417static inline void d_set_type(struct dentry *dentry, unsigned type)
418{
419 spin_lock(&dentry->d_lock);
420 __d_set_type(dentry, type);
421 spin_unlock(&dentry->d_lock);
422}
423
424static inline unsigned __d_entry_type(const struct dentry *dentry) 407static inline unsigned __d_entry_type(const struct dentry *dentry)
425{ 408{
426 return dentry->d_flags & DCACHE_ENTRY_TYPE; 409 unsigned type = READ_ONCE(dentry->d_flags);
410 smp_rmb();
411 return type & DCACHE_ENTRY_TYPE;
427} 412}
428 413
429static inline bool d_is_miss(const struct dentry *dentry) 414static inline bool d_is_miss(const struct dentry *dentry)
@@ -482,6 +467,44 @@ static inline bool d_is_positive(const struct dentry *dentry)
482 return !d_is_negative(dentry); 467 return !d_is_negative(dentry);
483} 468}
484 469
470/**
471 * d_really_is_negative - Determine if a dentry is really negative (ignoring fallthroughs)
472 * @dentry: The dentry in question
473 *
474 * Returns true if the dentry represents either an absent name or a name that
475 * doesn't map to an inode (ie. ->d_inode is NULL). The dentry could represent
476 * a true miss, a whiteout that isn't represented by a 0,0 chardev or a
477 * fallthrough marker in an opaque directory.
478 *
479 * Note! (1) This should be used *only* by a filesystem to examine its own
480 * dentries. It should not be used to look at some other filesystem's
481 * dentries. (2) It should also be used in combination with d_inode() to get
482 * the inode. (3) The dentry may have something attached to ->d_lower and the
483 * type field of the flags may be set to something other than miss or whiteout.
484 */
485static inline bool d_really_is_negative(const struct dentry *dentry)
486{
487 return dentry->d_inode == NULL;
488}
489
490/**
491 * d_really_is_positive - Determine if a dentry is really positive (ignoring fallthroughs)
492 * @dentry: The dentry in question
493 *
494 * Returns true if the dentry represents a name that maps to an inode
495 * (ie. ->d_inode is not NULL). The dentry might still represent a whiteout if
496 * that is represented on medium as a 0,0 chardev.
497 *
498 * Note! (1) This should be used *only* by a filesystem to examine its own
499 * dentries. It should not be used to look at some other filesystem's
500 * dentries. (2) It should also be used in combination with d_inode() to get
501 * the inode.
502 */
503static inline bool d_really_is_positive(const struct dentry *dentry)
504{
505 return dentry->d_inode != NULL;
506}
507
485extern void d_set_fallthru(struct dentry *dentry); 508extern void d_set_fallthru(struct dentry *dentry);
486 509
487static inline bool d_is_fallthru(const struct dentry *dentry) 510static inline bool d_is_fallthru(const struct dentry *dentry)
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 439ff698000a..221025423e6c 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -43,6 +43,7 @@ enum dccp_state {
43 DCCP_CLOSING = TCP_CLOSING, 43 DCCP_CLOSING = TCP_CLOSING,
44 DCCP_TIME_WAIT = TCP_TIME_WAIT, 44 DCCP_TIME_WAIT = TCP_TIME_WAIT,
45 DCCP_CLOSED = TCP_CLOSE, 45 DCCP_CLOSED = TCP_CLOSE,
46 DCCP_NEW_SYN_RECV = TCP_NEW_SYN_RECV,
46 DCCP_PARTOPEN = TCP_MAX_STATES, 47 DCCP_PARTOPEN = TCP_MAX_STATES,
47 DCCP_PASSIVE_CLOSEREQ, /* clients receiving CloseReq */ 48 DCCP_PASSIVE_CLOSEREQ, /* clients receiving CloseReq */
48 DCCP_MAX_STATES 49 DCCP_MAX_STATES
@@ -57,6 +58,7 @@ enum {
57 DCCPF_CLOSING = TCPF_CLOSING, 58 DCCPF_CLOSING = TCPF_CLOSING,
58 DCCPF_TIME_WAIT = TCPF_TIME_WAIT, 59 DCCPF_TIME_WAIT = TCPF_TIME_WAIT,
59 DCCPF_CLOSED = TCPF_CLOSE, 60 DCCPF_CLOSED = TCPF_CLOSE,
61 DCCPF_NEW_SYN_RECV = TCPF_NEW_SYN_RECV,
60 DCCPF_PARTOPEN = (1 << DCCP_PARTOPEN), 62 DCCPF_PARTOPEN = (1 << DCCP_PARTOPEN),
61}; 63};
62 64
@@ -317,6 +319,6 @@ static inline const char *dccp_role(const struct sock *sk)
317 return NULL; 319 return NULL;
318} 320}
319 321
320extern void dccp_syn_ack_timeout(struct sock *sk, struct request_sock *req); 322extern void dccp_syn_ack_timeout(const struct request_sock *req);
321 323
322#endif /* _LINUX_DCCP_H */ 324#endif /* _LINUX_DCCP_H */
diff --git a/include/linux/devfreq-event.h b/include/linux/devfreq-event.h
index 602fbbfcfeed..0a83a1e648b0 100644
--- a/include/linux/devfreq-event.h
+++ b/include/linux/devfreq-event.h
@@ -91,7 +91,7 @@ struct devfreq_event_desc {
91 const char *name; 91 const char *name;
92 void *driver_data; 92 void *driver_data;
93 93
94 struct devfreq_event_ops *ops; 94 const struct devfreq_event_ops *ops;
95}; 95};
96 96
97#if defined(CONFIG_PM_DEVFREQ_EVENT) 97#if defined(CONFIG_PM_DEVFREQ_EVENT)
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 2646aed1d3fe..51cc1deb7af3 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -375,6 +375,7 @@ int dm_create(int minor, struct mapped_device **md);
375 */ 375 */
376struct mapped_device *dm_get_md(dev_t dev); 376struct mapped_device *dm_get_md(dev_t dev);
377void dm_get(struct mapped_device *md); 377void dm_get(struct mapped_device *md);
378int dm_hold(struct mapped_device *md);
378void dm_put(struct mapped_device *md); 379void dm_put(struct mapped_device *md);
379 380
380/* 381/*
@@ -604,9 +605,4 @@ static inline unsigned long to_bytes(sector_t n)
604 return (n << SECTOR_SHIFT); 605 return (n << SECTOR_SHIFT);
605} 606}
606 607
607/*-----------------------------------------------------------------
608 * Helper for block layer and dm core operations
609 *---------------------------------------------------------------*/
610int dm_underlying_device_busy(struct request_queue *q);
611
612#endif /* _LINUX_DEVICE_MAPPER_H */ 608#endif /* _LINUX_DEVICE_MAPPER_H */
diff --git a/include/linux/device.h b/include/linux/device.h
index 0eb8ee2dc6d1..6558af90c8fe 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -38,6 +38,7 @@ struct class;
38struct subsys_private; 38struct subsys_private;
39struct bus_type; 39struct bus_type;
40struct device_node; 40struct device_node;
41struct fwnode_handle;
41struct iommu_ops; 42struct iommu_ops;
42struct iommu_group; 43struct iommu_group;
43 44
@@ -650,14 +651,6 @@ struct device_dma_parameters {
650 unsigned long segment_boundary_mask; 651 unsigned long segment_boundary_mask;
651}; 652};
652 653
653struct acpi_device;
654
655struct acpi_dev_node {
656#ifdef CONFIG_ACPI
657 struct acpi_device *companion;
658#endif
659};
660
661/** 654/**
662 * struct device - The basic device structure 655 * struct device - The basic device structure
663 * @parent: The device's "parent" device, the device to which it is attached. 656 * @parent: The device's "parent" device, the device to which it is attached.
@@ -703,7 +696,7 @@ struct acpi_dev_node {
703 * @cma_area: Contiguous memory area for dma allocations 696 * @cma_area: Contiguous memory area for dma allocations
704 * @archdata: For arch-specific additions. 697 * @archdata: For arch-specific additions.
705 * @of_node: Associated device tree node. 698 * @of_node: Associated device tree node.
706 * @acpi_node: Associated ACPI device node. 699 * @fwnode: Associated device node supplied by platform firmware.
707 * @devt: For creating the sysfs "dev". 700 * @devt: For creating the sysfs "dev".
708 * @id: device instance 701 * @id: device instance
709 * @devres_lock: Spinlock to protect the resource of the device. 702 * @devres_lock: Spinlock to protect the resource of the device.
@@ -779,7 +772,7 @@ struct device {
779 struct dev_archdata archdata; 772 struct dev_archdata archdata;
780 773
781 struct device_node *of_node; /* associated device tree node */ 774 struct device_node *of_node; /* associated device tree node */
782 struct acpi_dev_node acpi_node; /* associated ACPI device node */ 775 struct fwnode_handle *fwnode; /* firmware device node */
783 776
784 dev_t devt; /* dev_t, creates the sysfs "dev" */ 777 dev_t devt; /* dev_t, creates the sysfs "dev" */
785 u32 id; /* device instance */ 778 u32 id; /* device instance */
@@ -916,6 +909,13 @@ static inline void device_lock_assert(struct device *dev)
916 lockdep_assert_held(&dev->mutex); 909 lockdep_assert_held(&dev->mutex);
917} 910}
918 911
912static inline struct device_node *dev_of_node(struct device *dev)
913{
914 if (!IS_ENABLED(CONFIG_OF))
915 return NULL;
916 return dev->of_node;
917}
918
919void driver_init(void); 919void driver_init(void);
920 920
921/* 921/*
@@ -947,6 +947,9 @@ extern void unlock_device_hotplug(void);
947extern int lock_device_hotplug_sysfs(void); 947extern int lock_device_hotplug_sysfs(void);
948extern int device_offline(struct device *dev); 948extern int device_offline(struct device *dev);
949extern int device_online(struct device *dev); 949extern int device_online(struct device *dev);
950extern void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
951extern void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
952
950/* 953/*
951 * Root device objects for grouping under /sys/devices 954 * Root device objects for grouping under /sys/devices
952 */ 955 */
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index 694e1fe1c4b4..2f0b431b73e0 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -163,6 +163,33 @@ struct dma_buf_attachment {
163}; 163};
164 164
165/** 165/**
166 * struct dma_buf_export_info - holds information needed to export a dma_buf
167 * @exp_name: name of the exporting module - useful for debugging.
168 * @ops: Attach allocator-defined dma buf ops to the new buffer
169 * @size: Size of the buffer
170 * @flags: mode flags for the file
171 * @resv: reservation-object, NULL to allocate default one
172 * @priv: Attach private data of allocator to this buffer
173 *
174 * This structure holds the information required to export the buffer. Used
175 * with dma_buf_export() only.
176 */
177struct dma_buf_export_info {
178 const char *exp_name;
179 const struct dma_buf_ops *ops;
180 size_t size;
181 int flags;
182 struct reservation_object *resv;
183 void *priv;
184};
185
186/**
187 * helper macro for exporters; zeros and fills in most common values
188 */
189#define DEFINE_DMA_BUF_EXPORT_INFO(a) \
190 struct dma_buf_export_info a = { .exp_name = KBUILD_MODNAME }
191
192/**
166 * get_dma_buf - convenience wrapper for get_file. 193 * get_dma_buf - convenience wrapper for get_file.
167 * @dmabuf: [in] pointer to dma_buf 194 * @dmabuf: [in] pointer to dma_buf
168 * 195 *
@@ -181,12 +208,7 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
181void dma_buf_detach(struct dma_buf *dmabuf, 208void dma_buf_detach(struct dma_buf *dmabuf,
182 struct dma_buf_attachment *dmabuf_attach); 209 struct dma_buf_attachment *dmabuf_attach);
183 210
184struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, 211struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info);
185 size_t size, int flags, const char *,
186 struct reservation_object *);
187
188#define dma_buf_export(priv, ops, size, flags, resv) \
189 dma_buf_export_named(priv, ops, size, flags, KBUILD_MODNAME, resv)
190 212
191int dma_buf_fd(struct dma_buf *dmabuf, int flags); 213int dma_buf_fd(struct dma_buf *dmabuf, int flags);
192struct dma_buf *dma_buf_get(int fd); 214struct dma_buf *dma_buf_get(int fd);
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index c3007cb4bfa6..ac07ff090919 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -34,6 +34,10 @@ struct dma_map_ops {
34 void (*unmap_page)(struct device *dev, dma_addr_t dma_handle, 34 void (*unmap_page)(struct device *dev, dma_addr_t dma_handle,
35 size_t size, enum dma_data_direction dir, 35 size_t size, enum dma_data_direction dir,
36 struct dma_attrs *attrs); 36 struct dma_attrs *attrs);
37 /*
38 * map_sg returns 0 on error and a value > 0 on success.
39 * It should never return a value < 0.
40 */
37 int (*map_sg)(struct device *dev, struct scatterlist *sg, 41 int (*map_sg)(struct device *dev, struct scatterlist *sg,
38 int nents, enum dma_data_direction dir, 42 int nents, enum dma_data_direction dir,
39 struct dma_attrs *attrs); 43 struct dma_attrs *attrs);
diff --git a/include/linux/dma/hsu.h b/include/linux/dma/hsu.h
new file mode 100644
index 000000000000..234393a6997b
--- /dev/null
+++ b/include/linux/dma/hsu.h
@@ -0,0 +1,48 @@
1/*
2 * Driver for the High Speed UART DMA
3 *
4 * Copyright (C) 2015 Intel 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#ifndef _DMA_HSU_H
12#define _DMA_HSU_H
13
14#include <linux/device.h>
15#include <linux/interrupt.h>
16
17#include <linux/platform_data/dma-hsu.h>
18
19struct hsu_dma;
20
21/**
22 * struct hsu_dma_chip - representation of HSU DMA hardware
23 * @dev: struct device of the DMA controller
24 * @irq: irq line
25 * @regs: memory mapped I/O space
26 * @length: I/O space length
27 * @offset: offset of the I/O space where registers are located
28 * @hsu: struct hsu_dma that is filed by ->probe()
29 * @pdata: platform data for the DMA controller if provided
30 */
31struct hsu_dma_chip {
32 struct device *dev;
33 int irq;
34 void __iomem *regs;
35 unsigned int length;
36 unsigned int offset;
37 struct hsu_dma *hsu;
38 struct hsu_dma_platform_data *pdata;
39};
40
41/* Export to the internal users */
42irqreturn_t hsu_dma_irq(struct hsu_dma_chip *chip, unsigned short nr);
43
44/* Export to the platform drivers */
45int hsu_dma_probe(struct hsu_dma_chip *chip);
46int hsu_dma_remove(struct hsu_dma_chip *chip);
47
48#endif /* _DMA_HSU_H */
diff --git a/include/linux/amba/xilinx_dma.h b/include/linux/dma/xilinx_dma.h
index 34b98f276ed0..34b98f276ed0 100644
--- a/include/linux/amba/xilinx_dma.h
+++ b/include/linux/dma/xilinx_dma.h
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index b6997a0cb528..ad419757241f 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -11,10 +11,6 @@
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details. 12 * more details.
13 * 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 14 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING. 15 * file called COPYING.
20 */ 16 */
@@ -574,7 +570,6 @@ struct dma_tx_state {
574 * @copy_align: alignment shift for memcpy operations 570 * @copy_align: alignment shift for memcpy operations
575 * @xor_align: alignment shift for xor operations 571 * @xor_align: alignment shift for xor operations
576 * @pq_align: alignment shift for pq operations 572 * @pq_align: alignment shift for pq operations
577 * @fill_align: alignment shift for memset operations
578 * @dev_id: unique device ID 573 * @dev_id: unique device ID
579 * @dev: struct device reference for dma mapping api 574 * @dev: struct device reference for dma mapping api
580 * @src_addr_widths: bit mask of src addr widths the device supports 575 * @src_addr_widths: bit mask of src addr widths the device supports
@@ -625,7 +620,6 @@ struct dma_device {
625 u8 copy_align; 620 u8 copy_align;
626 u8 xor_align; 621 u8 xor_align;
627 u8 pq_align; 622 u8 pq_align;
628 u8 fill_align;
629 #define DMA_HAS_PQ_CONTINUE (1 << 15) 623 #define DMA_HAS_PQ_CONTINUE (1 << 15)
630 624
631 int dev_id; 625 int dev_id;
@@ -826,12 +820,6 @@ static inline bool is_dma_pq_aligned(struct dma_device *dev, size_t off1,
826 return dmaengine_check_align(dev->pq_align, off1, off2, len); 820 return dmaengine_check_align(dev->pq_align, off1, off2, len);
827} 821}
828 822
829static inline bool is_dma_fill_aligned(struct dma_device *dev, size_t off1,
830 size_t off2, size_t len)
831{
832 return dmaengine_check_align(dev->fill_align, off1, off2, len);
833}
834
835static inline void 823static inline void
836dma_set_maxpq(struct dma_device *dma, int maxpq, int has_pq_continue) 824dma_set_maxpq(struct dma_device *dma, int maxpq, int has_pq_continue)
837{ 825{
@@ -1098,7 +1086,6 @@ void dma_async_device_unregister(struct dma_device *device);
1098void dma_run_dependencies(struct dma_async_tx_descriptor *tx); 1086void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
1099struct dma_chan *dma_get_slave_channel(struct dma_chan *chan); 1087struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
1100struct dma_chan *dma_get_any_slave_channel(struct dma_device *device); 1088struct dma_chan *dma_get_any_slave_channel(struct dma_device *device);
1101struct dma_chan *net_dma_find_channel(void);
1102#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) 1089#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
1103#define dma_request_slave_channel_compat(mask, x, y, dev, name) \ 1090#define dma_request_slave_channel_compat(mask, x, y, dev, name) \
1104 __dma_request_slave_channel_compat(&(mask), x, y, dev, name) 1091 __dma_request_slave_channel_compat(&(mask), x, y, dev, name)
@@ -1116,27 +1103,4 @@ static inline struct dma_chan
1116 1103
1117 return __dma_request_channel(mask, fn, fn_param); 1104 return __dma_request_channel(mask, fn, fn_param);
1118} 1105}
1119
1120/* --- Helper iov-locking functions --- */
1121
1122struct dma_page_list {
1123 char __user *base_address;
1124 int nr_pages;
1125 struct page **pages;
1126};
1127
1128struct dma_pinned_list {
1129 int nr_iovecs;
1130 struct dma_page_list page_list[0];
1131};
1132
1133struct dma_pinned_list *dma_pin_iovec_pages(struct iovec *iov, size_t len);
1134void dma_unpin_iovec_pages(struct dma_pinned_list* pinned_list);
1135
1136dma_cookie_t dma_memcpy_to_iovec(struct dma_chan *chan, struct iovec *iov,
1137 struct dma_pinned_list *pinned_list, unsigned char *kdata, size_t len);
1138dma_cookie_t dma_memcpy_pg_to_iovec(struct dma_chan *chan, struct iovec *iov,
1139 struct dma_pinned_list *pinned_list, struct page *page,
1140 unsigned int offset, size_t len);
1141
1142#endif /* DMAENGINE_H */ 1106#endif /* DMAENGINE_H */
diff --git a/include/linux/dmapool.h b/include/linux/dmapool.h
index 022e34fcbd1b..52456aa566a0 100644
--- a/include/linux/dmapool.h
+++ b/include/linux/dmapool.h
@@ -14,6 +14,8 @@
14#include <asm/io.h> 14#include <asm/io.h>
15#include <asm/scatterlist.h> 15#include <asm/scatterlist.h>
16 16
17struct device;
18
17struct dma_pool *dma_pool_create(const char *name, struct device *dev, 19struct dma_pool *dma_pool_create(const char *name, struct device *dev,
18 size_t size, size_t align, size_t allocation); 20 size_t size, size_t align, size_t allocation);
19 21
diff --git a/include/linux/efi.h b/include/linux/efi.h
index cf7e431cbc73..af5be0368dec 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -942,6 +942,7 @@ extern int __init efi_setup_pcdp_console(char *);
942#define EFI_64BIT 5 /* Is the firmware 64-bit? */ 942#define EFI_64BIT 5 /* Is the firmware 64-bit? */
943#define EFI_PARAVIRT 6 /* Access is via a paravirt interface */ 943#define EFI_PARAVIRT 6 /* Access is via a paravirt interface */
944#define EFI_ARCH_1 7 /* First arch-specific bit */ 944#define EFI_ARCH_1 7 /* First arch-specific bit */
945#define EFI_DBG 8 /* Print additional debug info at runtime */
945 946
946#ifdef CONFIG_EFI 947#ifdef CONFIG_EFI
947/* 948/*
diff --git a/include/linux/elf-randomize.h b/include/linux/elf-randomize.h
new file mode 100644
index 000000000000..b5f0bda9472e
--- /dev/null
+++ b/include/linux/elf-randomize.h
@@ -0,0 +1,22 @@
1#ifndef _ELF_RANDOMIZE_H
2#define _ELF_RANDOMIZE_H
3
4struct mm_struct;
5
6#ifndef CONFIG_ARCH_HAS_ELF_RANDOMIZE
7static inline unsigned long arch_mmap_rnd(void) { return 0; }
8# if defined(arch_randomize_brk) && defined(CONFIG_COMPAT_BRK)
9# define compat_brk_randomized
10# endif
11# ifndef arch_randomize_brk
12# define arch_randomize_brk(mm) (mm->brk)
13# endif
14#else
15extern unsigned long arch_mmap_rnd(void);
16extern unsigned long arch_randomize_brk(struct mm_struct *mm);
17# ifdef CONFIG_COMPAT_BRK
18# define compat_brk_randomized
19# endif
20#endif
21
22#endif
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 1d869d185a0d..606563ef8a72 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -35,7 +35,6 @@ extern const struct header_ops eth_header_ops;
35 35
36int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, 36int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
37 const void *daddr, const void *saddr, unsigned len); 37 const void *daddr, const void *saddr, unsigned len);
38int eth_rebuild_header(struct sk_buff *skb);
39int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); 38int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
40int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, 39int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh,
41 __be16 type); 40 __be16 type);
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index a23556c32703..591f8c3ef410 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -153,7 +153,7 @@ struct f2fs_orphan_block {
153 */ 153 */
154struct f2fs_extent { 154struct f2fs_extent {
155 __le32 fofs; /* start file offset of the extent */ 155 __le32 fofs; /* start file offset of the extent */
156 __le32 blk_addr; /* start block address of the extent */ 156 __le32 blk; /* start block address of the extent */
157 __le32 len; /* lengh of the extent */ 157 __le32 len; /* lengh of the extent */
158} __packed; 158} __packed;
159 159
@@ -178,6 +178,7 @@ struct f2fs_extent {
178#define F2FS_INLINE_DATA 0x02 /* file inline data flag */ 178#define F2FS_INLINE_DATA 0x02 /* file inline data flag */
179#define F2FS_INLINE_DENTRY 0x04 /* file inline dentry flag */ 179#define F2FS_INLINE_DENTRY 0x04 /* file inline dentry flag */
180#define F2FS_DATA_EXIST 0x08 /* file inline data exist flag */ 180#define F2FS_DATA_EXIST 0x08 /* file inline data exist flag */
181#define F2FS_INLINE_DOTS 0x10 /* file having implicit dot dentries */
181 182
182#define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \ 183#define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \
183 F2FS_INLINE_XATTR_ADDRS - 1)) 184 F2FS_INLINE_XATTR_ADDRS - 1))
diff --git a/include/linux/falloc.h b/include/linux/falloc.h
index 31591686ac2d..996111000a8c 100644
--- a/include/linux/falloc.h
+++ b/include/linux/falloc.h
@@ -21,4 +21,10 @@ struct space_resv {
21#define FS_IOC_RESVSP _IOW('X', 40, struct space_resv) 21#define FS_IOC_RESVSP _IOW('X', 40, struct space_resv)
22#define FS_IOC_RESVSP64 _IOW('X', 42, struct space_resv) 22#define FS_IOC_RESVSP64 _IOW('X', 42, struct space_resv)
23 23
24#define FALLOC_FL_SUPPORTED_MASK (FALLOC_FL_KEEP_SIZE | \
25 FALLOC_FL_PUNCH_HOLE | \
26 FALLOC_FL_COLLAPSE_RANGE | \
27 FALLOC_FL_ZERO_RANGE | \
28 FALLOC_FL_INSERT_RANGE)
29
24#endif /* _FALLOC_H_ */ 30#endif /* _FALLOC_H_ */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index caac2087a4d5..fa11b3a367be 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -145,8 +145,6 @@ struct bpf_prog_aux;
145 .off = 0, \ 145 .off = 0, \
146 .imm = ((__u64) (IMM)) >> 32 }) 146 .imm = ((__u64) (IMM)) >> 32 })
147 147
148#define BPF_PSEUDO_MAP_FD 1
149
150/* pseudo BPF_LD_IMM64 insn used to refer to process-local map_fd */ 148/* pseudo BPF_LD_IMM64 insn used to refer to process-local map_fd */
151#define BPF_LD_MAP_FD(DST, MAP_FD) \ 149#define BPF_LD_MAP_FD(DST, MAP_FD) \
152 BPF_LD_IMM64_RAW(DST, BPF_PSEUDO_MAP_FD, MAP_FD) 150 BPF_LD_IMM64_RAW(DST, BPF_PSEUDO_MAP_FD, MAP_FD)
@@ -310,9 +308,11 @@ struct bpf_binary_header {
310struct bpf_prog { 308struct bpf_prog {
311 u16 pages; /* Number of allocated pages */ 309 u16 pages; /* Number of allocated pages */
312 bool jited; /* Is our filter JIT'ed? */ 310 bool jited; /* Is our filter JIT'ed? */
311 bool gpl_compatible; /* Is our filter GPL compatible? */
313 u32 len; /* Number of filter blocks */ 312 u32 len; /* Number of filter blocks */
314 struct sock_fprog_kern *orig_prog; /* Original BPF program */ 313 enum bpf_prog_type type; /* Type of BPF program */
315 struct bpf_prog_aux *aux; /* Auxiliary fields */ 314 struct bpf_prog_aux *aux; /* Auxiliary fields */
315 struct sock_fprog_kern *orig_prog; /* Original BPF program */
316 unsigned int (*bpf_func)(const struct sk_buff *skb, 316 unsigned int (*bpf_func)(const struct sk_buff *skb,
317 const struct bpf_insn *filter); 317 const struct bpf_insn *filter);
318 /* Instructions for interpreter */ 318 /* Instructions for interpreter */
@@ -454,6 +454,7 @@ static inline u16 bpf_anc_helper(const struct sock_filter *ftest)
454 BPF_ANCILLARY(VLAN_TAG_PRESENT); 454 BPF_ANCILLARY(VLAN_TAG_PRESENT);
455 BPF_ANCILLARY(PAY_OFFSET); 455 BPF_ANCILLARY(PAY_OFFSET);
456 BPF_ANCILLARY(RANDOM); 456 BPF_ANCILLARY(RANDOM);
457 BPF_ANCILLARY(VLAN_TPID);
457 } 458 }
458 /* Fallthrough. */ 459 /* Fallthrough. */
459 default: 460 default:
diff --git a/include/linux/fixp-arith.h b/include/linux/fixp-arith.h
index 3089d7382325..d4686fe1cac7 100644
--- a/include/linux/fixp-arith.h
+++ b/include/linux/fixp-arith.h
@@ -1,6 +1,8 @@
1#ifndef _FIXP_ARITH_H 1#ifndef _FIXP_ARITH_H
2#define _FIXP_ARITH_H 2#define _FIXP_ARITH_H
3 3
4#include <linux/math64.h>
5
4/* 6/*
5 * Simplistic fixed-point arithmetics. 7 * Simplistic fixed-point arithmetics.
6 * Hmm, I'm probably duplicating some code :( 8 * Hmm, I'm probably duplicating some code :(
@@ -29,59 +31,126 @@
29 31
30#include <linux/types.h> 32#include <linux/types.h>
31 33
32/* The type representing fixed-point values */ 34static const s32 sin_table[] = {
33typedef s16 fixp_t; 35 0x00000000, 0x023be165, 0x04779632, 0x06b2f1d2, 0x08edc7b6, 0x0b27eb5c,
36 0x0d61304d, 0x0f996a26, 0x11d06c96, 0x14060b67, 0x163a1a7d, 0x186c6ddd,
37 0x1a9cd9ac, 0x1ccb3236, 0x1ef74bf2, 0x2120fb82, 0x234815ba, 0x256c6f9e,
38 0x278dde6e, 0x29ac379f, 0x2bc750e8, 0x2ddf003f, 0x2ff31bdd, 0x32037a44,
39 0x340ff241, 0x36185aee, 0x381c8bb5, 0x3a1c5c56, 0x3c17a4e7, 0x3e0e3ddb,
40 0x3fffffff, 0x41ecc483, 0x43d464fa, 0x45b6bb5d, 0x4793a20f, 0x496af3e1,
41 0x4b3c8c11, 0x4d084650, 0x4ecdfec6, 0x508d9210, 0x5246dd48, 0x53f9be04,
42 0x55a6125a, 0x574bb8e5, 0x58ea90c2, 0x5a827999, 0x5c135399, 0x5d9cff82,
43 0x5f1f5ea0, 0x609a52d1, 0x620dbe8a, 0x637984d3, 0x64dd894f, 0x6639b039,
44 0x678dde6d, 0x68d9f963, 0x6a1de735, 0x6b598ea1, 0x6c8cd70a, 0x6db7a879,
45 0x6ed9eba0, 0x6ff389de, 0x71046d3c, 0x720c8074, 0x730baeec, 0x7401e4bf,
46 0x74ef0ebb, 0x75d31a5f, 0x76adf5e5, 0x777f903b, 0x7847d908, 0x7906c0af,
47 0x79bc384c, 0x7a6831b8, 0x7b0a9f8c, 0x7ba3751c, 0x7c32a67c, 0x7cb82884,
48 0x7d33f0c8, 0x7da5f5a3, 0x7e0e2e31, 0x7e6c924f, 0x7ec11aa3, 0x7f0bc095,
49 0x7f4c7e52, 0x7f834ecf, 0x7fb02dc4, 0x7fd317b3, 0x7fec09e1, 0x7ffb025e,
50 0x7fffffff
51};
34 52
35#define FRAC_N 8 53/**
36#define FRAC_MASK ((1<<FRAC_N)-1) 54 * __fixp_sin32() returns the sin of an angle in degrees
55 *
56 * @degrees: angle, in degrees, from 0 to 360.
57 *
58 * The returned value ranges from -0x7fffffff to +0x7fffffff.
59 */
60static inline s32 __fixp_sin32(int degrees)
61{
62 s32 ret;
63 bool negative = false;
37 64
38/* Not to be used directly. Use fixp_{cos,sin} */ 65 if (degrees > 180) {
39static const fixp_t cos_table[46] = { 66 negative = true;
40 0x0100, 0x00FF, 0x00FF, 0x00FE, 0x00FD, 0x00FC, 0x00FA, 0x00F8, 67 degrees -= 180;
41 0x00F6, 0x00F3, 0x00F0, 0x00ED, 0x00E9, 0x00E6, 0x00E2, 0x00DD, 68 }
42 0x00D9, 0x00D4, 0x00CF, 0x00C9, 0x00C4, 0x00BE, 0x00B8, 0x00B1, 69 if (degrees > 90)
43 0x00AB, 0x00A4, 0x009D, 0x0096, 0x008F, 0x0087, 0x0080, 0x0078, 70 degrees = 180 - degrees;
44 0x0070, 0x0068, 0x005F, 0x0057, 0x004F, 0x0046, 0x003D, 0x0035,
45 0x002C, 0x0023, 0x001A, 0x0011, 0x0008, 0x0000
46};
47 71
72 ret = sin_table[degrees];
48 73
49/* a: 123 -> 123.0 */ 74 return negative ? -ret : ret;
50static inline fixp_t fixp_new(s16 a)
51{
52 return a<<FRAC_N;
53} 75}
54 76
55/* a: 0xFFFF -> -1.0 77/**
56 0x8000 -> 1.0 78 * fixp_sin32() returns the sin of an angle in degrees
57 0x0000 -> 0.0 79 *
58*/ 80 * @degrees: angle, in degrees. The angle can be positive or negative
59static inline fixp_t fixp_new16(s16 a) 81 *
82 * The returned value ranges from -0x7fffffff to +0x7fffffff.
83 */
84static inline s32 fixp_sin32(int degrees)
60{ 85{
61 return ((s32)a)>>(16-FRAC_N); 86 degrees = (degrees % 360 + 360) % 360;
87
88 return __fixp_sin32(degrees);
62} 89}
63 90
64static inline fixp_t fixp_cos(unsigned int degrees) 91/* cos(x) = sin(x + 90 degrees) */
92#define fixp_cos32(v) fixp_sin32((v) + 90)
93
94/*
95 * 16 bits variants
96 *
97 * The returned value ranges from -0x7fff to 0x7fff
98 */
99
100#define fixp_sin16(v) (fixp_sin32(v) >> 16)
101#define fixp_cos16(v) (fixp_cos32(v) >> 16)
102
103/**
104 * fixp_sin32_rad() - calculates the sin of an angle in radians
105 *
106 * @radians: angle, in radians
107 * @twopi: value to be used for 2*pi
108 *
109 * Provides a variant for the cases where just 360
110 * values is not enough. This function uses linear
111 * interpolation to a wider range of values given by
112 * twopi var.
113 *
114 * Experimental tests gave a maximum difference of
115 * 0.000038 between the value calculated by sin() and
116 * the one produced by this function, when twopi is
117 * equal to 360000. That seems to be enough precision
118 * for practical purposes.
119 *
120 * Please notice that two high numbers for twopi could cause
121 * overflows, so the routine will not allow values of twopi
122 * bigger than 1^18.
123 */
124static inline s32 fixp_sin32_rad(u32 radians, u32 twopi)
65{ 125{
66 int quadrant = (degrees / 90) & 3; 126 int degrees;
67 unsigned int i = degrees % 90; 127 s32 v1, v2, dx, dy;
128 s64 tmp;
68 129
69 if (quadrant == 1 || quadrant == 3) 130 /*
70 i = 90 - i; 131 * Avoid too large values for twopi, as we don't want overflows.
132 */
133 BUG_ON(twopi > 1 << 18);
71 134
72 i >>= 1; 135 degrees = (radians * 360) / twopi;
136 tmp = radians - (degrees * twopi) / 360;
73 137
74 return (quadrant == 1 || quadrant == 2)? -cos_table[i] : cos_table[i]; 138 degrees = (degrees % 360 + 360) % 360;
75} 139 v1 = __fixp_sin32(degrees);
76 140
77static inline fixp_t fixp_sin(unsigned int degrees) 141 v2 = fixp_sin32(degrees + 1);
78{
79 return -fixp_cos(degrees + 90);
80}
81 142
82static inline fixp_t fixp_mult(fixp_t a, fixp_t b) 143 dx = twopi / 360;
83{ 144 dy = v2 - v1;
84 return ((s32)(a*b))>>FRAC_N; 145
146 tmp *= dy;
147
148 return v1 + div_s64(tmp, dx);
85} 149}
86 150
151/* cos(x) = sin(x + pi/2 radians) */
152
153#define fixp_cos32_rad(rad, twopi) \
154 fixp_sin32_rad(rad + twopi / 4, twopi)
155
87#endif 156#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b4d71b5e1ff2..35ec87e490b1 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -314,6 +314,33 @@ struct page;
314struct address_space; 314struct address_space;
315struct writeback_control; 315struct writeback_control;
316 316
317#define IOCB_EVENTFD (1 << 0)
318#define IOCB_APPEND (1 << 1)
319#define IOCB_DIRECT (1 << 2)
320
321struct kiocb {
322 struct file *ki_filp;
323 loff_t ki_pos;
324 void (*ki_complete)(struct kiocb *iocb, long ret, long ret2);
325 void *private;
326 int ki_flags;
327};
328
329static inline bool is_sync_kiocb(struct kiocb *kiocb)
330{
331 return kiocb->ki_complete == NULL;
332}
333
334static inline int iocb_flags(struct file *file);
335
336static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
337{
338 *kiocb = (struct kiocb) {
339 .ki_filp = filp,
340 .ki_flags = iocb_flags(filp),
341 };
342}
343
317/* 344/*
318 * "descriptor" for what we're up to with a read. 345 * "descriptor" for what we're up to with a read.
319 * This allows us to use the same read code yet 346 * This allows us to use the same read code yet
@@ -361,7 +388,7 @@ struct address_space_operations {
361 void (*invalidatepage) (struct page *, unsigned int, unsigned int); 388 void (*invalidatepage) (struct page *, unsigned int, unsigned int);
362 int (*releasepage) (struct page *, gfp_t); 389 int (*releasepage) (struct page *, gfp_t);
363 void (*freepage)(struct page *); 390 void (*freepage)(struct page *);
364 ssize_t (*direct_IO)(int, struct kiocb *, struct iov_iter *iter, loff_t offset); 391 ssize_t (*direct_IO)(struct kiocb *, struct iov_iter *iter, loff_t offset);
365 /* 392 /*
366 * migrate the contents of a page to the specified target. If 393 * migrate the contents of a page to the specified target. If
367 * migrate_mode is MIGRATE_ASYNC, it must not block. 394 * migrate_mode is MIGRATE_ASYNC, it must not block.
@@ -604,6 +631,7 @@ struct inode {
604 struct mutex i_mutex; 631 struct mutex i_mutex;
605 632
606 unsigned long dirtied_when; /* jiffies of first dirtying */ 633 unsigned long dirtied_when; /* jiffies of first dirtying */
634 unsigned long dirtied_time_when;
607 635
608 struct hlist_node i_hash; 636 struct hlist_node i_hash;
609 struct list_head i_wb_list; /* backing dev IO list */ 637 struct list_head i_wb_list; /* backing dev IO list */
@@ -847,6 +875,7 @@ static inline struct file *get_file(struct file *f)
847 atomic_long_inc(&f->f_count); 875 atomic_long_inc(&f->f_count);
848 return f; 876 return f;
849} 877}
878#define get_file_rcu(x) atomic_long_inc_not_zero(&(x)->f_count)
850#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) 879#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
851#define file_count(x) atomic_long_read(&(x)->f_count) 880#define file_count(x) atomic_long_read(&(x)->f_count)
852 881
@@ -892,8 +921,8 @@ struct file_lock_operations {
892struct lock_manager_operations { 921struct lock_manager_operations {
893 int (*lm_compare_owner)(struct file_lock *, struct file_lock *); 922 int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
894 unsigned long (*lm_owner_key)(struct file_lock *); 923 unsigned long (*lm_owner_key)(struct file_lock *);
895 void (*lm_get_owner)(struct file_lock *, struct file_lock *); 924 fl_owner_t (*lm_get_owner)(fl_owner_t);
896 void (*lm_put_owner)(struct file_lock *); 925 void (*lm_put_owner)(fl_owner_t);
897 void (*lm_notify)(struct file_lock *); /* unblock callback */ 926 void (*lm_notify)(struct file_lock *); /* unblock callback */
898 int (*lm_grant)(struct file_lock *, int); 927 int (*lm_grant)(struct file_lock *, int);
899 bool (*lm_break)(struct file_lock *); 928 bool (*lm_break)(struct file_lock *);
@@ -1018,6 +1047,9 @@ extern void lease_get_mtime(struct inode *, struct timespec *time);
1018extern int generic_setlease(struct file *, long, struct file_lock **, void **priv); 1047extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
1019extern int vfs_setlease(struct file *, long, struct file_lock **, void **); 1048extern int vfs_setlease(struct file *, long, struct file_lock **, void **);
1020extern int lease_modify(struct file_lock *, int, struct list_head *); 1049extern int lease_modify(struct file_lock *, int, struct list_head *);
1050struct files_struct;
1051extern void show_fd_locks(struct seq_file *f,
1052 struct file *filp, struct files_struct *files);
1021#else /* !CONFIG_FILE_LOCKING */ 1053#else /* !CONFIG_FILE_LOCKING */
1022static inline int fcntl_getlk(struct file *file, unsigned int cmd, 1054static inline int fcntl_getlk(struct file *file, unsigned int cmd,
1023 struct flock __user *user) 1055 struct flock __user *user)
@@ -1154,6 +1186,10 @@ static inline int lease_modify(struct file_lock *fl, int arg,
1154{ 1186{
1155 return -EINVAL; 1187 return -EINVAL;
1156} 1188}
1189
1190struct files_struct;
1191static inline void show_fd_locks(struct seq_file *f,
1192 struct file *filp, struct files_struct *files) {}
1157#endif /* !CONFIG_FILE_LOCKING */ 1193#endif /* !CONFIG_FILE_LOCKING */
1158 1194
1159 1195
@@ -1539,8 +1575,6 @@ struct file_operations {
1539 loff_t (*llseek) (struct file *, loff_t, int); 1575 loff_t (*llseek) (struct file *, loff_t, int);
1540 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); 1576 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
1541 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); 1577 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
1542 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1543 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1544 ssize_t (*read_iter) (struct kiocb *, struct iov_iter *); 1578 ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
1545 ssize_t (*write_iter) (struct kiocb *, struct iov_iter *); 1579 ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
1546 int (*iterate) (struct file *, struct dir_context *); 1580 int (*iterate) (struct file *, struct dir_context *);
@@ -1548,7 +1582,7 @@ struct file_operations {
1548 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 1582 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
1549 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 1583 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
1550 int (*mmap) (struct file *, struct vm_area_struct *); 1584 int (*mmap) (struct file *, struct vm_area_struct *);
1551 void (*mremap)(struct file *, struct vm_area_struct *); 1585 int (*mremap)(struct file *, struct vm_area_struct *);
1552 int (*open) (struct inode *, struct file *); 1586 int (*open) (struct inode *, struct file *);
1553 int (*flush) (struct file *, fl_owner_t id); 1587 int (*flush) (struct file *, fl_owner_t id);
1554 int (*release) (struct inode *, struct file *); 1588 int (*release) (struct inode *, struct file *);
@@ -1616,6 +1650,7 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
1616 struct iovec **ret_pointer); 1650 struct iovec **ret_pointer);
1617 1651
1618extern ssize_t __vfs_read(struct file *, char __user *, size_t, loff_t *); 1652extern ssize_t __vfs_read(struct file *, char __user *, size_t, loff_t *);
1653extern ssize_t __vfs_write(struct file *, const char __user *, size_t, loff_t *);
1619extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *); 1654extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
1620extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *); 1655extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);
1621extern ssize_t vfs_readv(struct file *, const struct iovec __user *, 1656extern ssize_t vfs_readv(struct file *, const struct iovec __user *,
@@ -1785,7 +1820,7 @@ struct super_operations {
1785#define I_SYNC (1 << __I_SYNC) 1820#define I_SYNC (1 << __I_SYNC)
1786#define I_REFERENCED (1 << 8) 1821#define I_REFERENCED (1 << 8)
1787#define __I_DIO_WAKEUP 9 1822#define __I_DIO_WAKEUP 9
1788#define I_DIO_WAKEUP (1 << I_DIO_WAKEUP) 1823#define I_DIO_WAKEUP (1 << __I_DIO_WAKEUP)
1789#define I_LINKABLE (1 << 10) 1824#define I_LINKABLE (1 << 10)
1790#define I_DIRTY_TIME (1 << 11) 1825#define I_DIRTY_TIME (1 << 11)
1791#define __I_DIRTY_TIME_EXPIRED 12 1826#define __I_DIRTY_TIME_EXPIRED 12
@@ -2144,7 +2179,7 @@ struct filename {
2144 const __user char *uptr; /* original userland pointer */ 2179 const __user char *uptr; /* original userland pointer */
2145 struct audit_names *aname; 2180 struct audit_names *aname;
2146 int refcnt; 2181 int refcnt;
2147 bool separate; /* should "name" be freed? */ 2182 const char iname[];
2148}; 2183};
2149 2184
2150extern long vfs_truncate(struct path *, loff_t); 2185extern long vfs_truncate(struct path *, loff_t);
@@ -2544,16 +2579,12 @@ extern int sb_min_blocksize(struct super_block *, int);
2544 2579
2545extern int generic_file_mmap(struct file *, struct vm_area_struct *); 2580extern int generic_file_mmap(struct file *, struct vm_area_struct *);
2546extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 2581extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
2547int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 2582extern ssize_t generic_write_checks(struct kiocb *, struct iov_iter *);
2548extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); 2583extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *);
2549extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *); 2584extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *);
2550extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *); 2585extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *);
2551extern ssize_t generic_file_direct_write(struct kiocb *, struct iov_iter *, loff_t); 2586extern ssize_t generic_file_direct_write(struct kiocb *, struct iov_iter *, loff_t);
2552extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t); 2587extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t);
2553extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
2554extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2555extern ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
2556extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2557 2588
2558ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos); 2589ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos);
2559ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos); 2590ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos);
@@ -2591,12 +2622,13 @@ extern loff_t fixed_size_llseek(struct file *file, loff_t offset,
2591extern int generic_file_open(struct inode * inode, struct file * filp); 2622extern int generic_file_open(struct inode * inode, struct file * filp);
2592extern int nonseekable_open(struct inode * inode, struct file * filp); 2623extern int nonseekable_open(struct inode * inode, struct file * filp);
2593 2624
2594ssize_t dax_do_io(int rw, struct kiocb *, struct inode *, struct iov_iter *, 2625ssize_t dax_do_io(struct kiocb *, struct inode *, struct iov_iter *, loff_t,
2595 loff_t, get_block_t, dio_iodone_t, int flags); 2626 get_block_t, dio_iodone_t, int flags);
2596int dax_clear_blocks(struct inode *, sector_t block, long size); 2627int dax_clear_blocks(struct inode *, sector_t block, long size);
2597int dax_zero_page_range(struct inode *, loff_t from, unsigned len, get_block_t); 2628int dax_zero_page_range(struct inode *, loff_t from, unsigned len, get_block_t);
2598int dax_truncate_page(struct inode *, loff_t from, get_block_t); 2629int dax_truncate_page(struct inode *, loff_t from, get_block_t);
2599int dax_fault(struct vm_area_struct *, struct vm_fault *, get_block_t); 2630int dax_fault(struct vm_area_struct *, struct vm_fault *, get_block_t);
2631int dax_pfn_mkwrite(struct vm_area_struct *, struct vm_fault *);
2600#define dax_mkwrite(vma, vmf, gb) dax_fault(vma, vmf, gb) 2632#define dax_mkwrite(vma, vmf, gb) dax_fault(vma, vmf, gb)
2601 2633
2602#ifdef CONFIG_BLOCK 2634#ifdef CONFIG_BLOCK
@@ -2612,27 +2644,56 @@ enum {
2612 2644
2613 /* filesystem can handle aio writes beyond i_size */ 2645 /* filesystem can handle aio writes beyond i_size */
2614 DIO_ASYNC_EXTEND = 0x04, 2646 DIO_ASYNC_EXTEND = 0x04,
2647
2648 /* inode/fs/bdev does not need truncate protection */
2649 DIO_SKIP_DIO_COUNT = 0x08,
2615}; 2650};
2616 2651
2617void dio_end_io(struct bio *bio, int error); 2652void dio_end_io(struct bio *bio, int error);
2618 2653
2619ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 2654ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
2620 struct block_device *bdev, struct iov_iter *iter, loff_t offset, 2655 struct block_device *bdev, struct iov_iter *iter,
2621 get_block_t get_block, dio_iodone_t end_io, 2656 loff_t offset, get_block_t get_block,
2622 dio_submit_t submit_io, int flags); 2657 dio_iodone_t end_io, dio_submit_t submit_io,
2658 int flags);
2623 2659
2624static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2660static inline ssize_t blockdev_direct_IO(struct kiocb *iocb,
2625 struct inode *inode, struct iov_iter *iter, loff_t offset, 2661 struct inode *inode,
2626 get_block_t get_block) 2662 struct iov_iter *iter, loff_t offset,
2663 get_block_t get_block)
2627{ 2664{
2628 return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iter, 2665 return __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter,
2629 offset, get_block, NULL, NULL, 2666 offset, get_block, NULL, NULL,
2630 DIO_LOCKING | DIO_SKIP_HOLES); 2667 DIO_LOCKING | DIO_SKIP_HOLES);
2631} 2668}
2632#endif 2669#endif
2633 2670
2634void inode_dio_wait(struct inode *inode); 2671void inode_dio_wait(struct inode *inode);
2635void inode_dio_done(struct inode *inode); 2672
2673/*
2674 * inode_dio_begin - signal start of a direct I/O requests
2675 * @inode: inode the direct I/O happens on
2676 *
2677 * This is called once we've finished processing a direct I/O request,
2678 * and is used to wake up callers waiting for direct I/O to be quiesced.
2679 */
2680static inline void inode_dio_begin(struct inode *inode)
2681{
2682 atomic_inc(&inode->i_dio_count);
2683}
2684
2685/*
2686 * inode_dio_end - signal finish of a direct I/O requests
2687 * @inode: inode the direct I/O happens on
2688 *
2689 * This is called once we've finished processing a direct I/O request,
2690 * and is used to wake up callers waiting for direct I/O to be quiesced.
2691 */
2692static inline void inode_dio_end(struct inode *inode)
2693{
2694 if (atomic_dec_and_test(&inode->i_dio_count))
2695 wake_up_bit(&inode->i_state, __I_DIO_WAKEUP);
2696}
2636 2697
2637extern void inode_set_flags(struct inode *inode, unsigned int flags, 2698extern void inode_set_flags(struct inode *inode, unsigned int flags,
2638 unsigned int mask); 2699 unsigned int mask);
@@ -2661,7 +2722,6 @@ void inode_sub_bytes(struct inode *inode, loff_t bytes);
2661loff_t inode_get_bytes(struct inode *inode); 2722loff_t inode_get_bytes(struct inode *inode);
2662void inode_set_bytes(struct inode *inode, loff_t bytes); 2723void inode_set_bytes(struct inode *inode, loff_t bytes);
2663 2724
2664extern int vfs_readdir(struct file *, filldir_t, void *);
2665extern int iterate_dir(struct file *, struct dir_context *); 2725extern int iterate_dir(struct file *, struct dir_context *);
2666 2726
2667extern int vfs_stat(const char __user *, struct kstat *); 2727extern int vfs_stat(const char __user *, struct kstat *);
@@ -2759,6 +2819,16 @@ static inline bool io_is_direct(struct file *filp)
2759 return (filp->f_flags & O_DIRECT) || IS_DAX(file_inode(filp)); 2819 return (filp->f_flags & O_DIRECT) || IS_DAX(file_inode(filp));
2760} 2820}
2761 2821
2822static inline int iocb_flags(struct file *file)
2823{
2824 int res = 0;
2825 if (file->f_flags & O_APPEND)
2826 res |= IOCB_APPEND;
2827 if (io_is_direct(file))
2828 res |= IOCB_DIRECT;
2829 return res;
2830}
2831
2762static inline ino_t parent_ino(struct dentry *dentry) 2832static inline ino_t parent_ino(struct dentry *dentry)
2763{ 2833{
2764 ino_t res; 2834 ino_t res;
diff --git a/include/linux/fs_pin.h b/include/linux/fs_pin.h
index 9dc4e0384bfb..3886b3bffd7f 100644
--- a/include/linux/fs_pin.h
+++ b/include/linux/fs_pin.h
@@ -13,6 +13,8 @@ struct vfsmount;
13static inline void init_fs_pin(struct fs_pin *p, void (*kill)(struct fs_pin *)) 13static inline void init_fs_pin(struct fs_pin *p, void (*kill)(struct fs_pin *))
14{ 14{
15 init_waitqueue_head(&p->wait); 15 init_waitqueue_head(&p->wait);
16 INIT_HLIST_NODE(&p->s_list);
17 INIT_HLIST_NODE(&p->m_list);
16 p->kill = kill; 18 p->kill = kill;
17} 19}
18 20
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index c674ee8f7fca..46e83c2156c6 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -13,6 +13,7 @@ struct trace_array;
13struct trace_buffer; 13struct trace_buffer;
14struct tracer; 14struct tracer;
15struct dentry; 15struct dentry;
16struct bpf_prog;
16 17
17struct trace_print_flags { 18struct trace_print_flags {
18 unsigned long mask; 19 unsigned long mask;
@@ -202,7 +203,7 @@ enum trace_reg {
202struct ftrace_event_call; 203struct ftrace_event_call;
203 204
204struct ftrace_event_class { 205struct ftrace_event_class {
205 char *system; 206 const char *system;
206 void *probe; 207 void *probe;
207#ifdef CONFIG_PERF_EVENTS 208#ifdef CONFIG_PERF_EVENTS
208 void *perf_probe; 209 void *perf_probe;
@@ -252,6 +253,7 @@ enum {
252 TRACE_EVENT_FL_WAS_ENABLED_BIT, 253 TRACE_EVENT_FL_WAS_ENABLED_BIT,
253 TRACE_EVENT_FL_USE_CALL_FILTER_BIT, 254 TRACE_EVENT_FL_USE_CALL_FILTER_BIT,
254 TRACE_EVENT_FL_TRACEPOINT_BIT, 255 TRACE_EVENT_FL_TRACEPOINT_BIT,
256 TRACE_EVENT_FL_KPROBE_BIT,
255}; 257};
256 258
257/* 259/*
@@ -265,6 +267,7 @@ enum {
265 * it is best to clear the buffers that used it). 267 * it is best to clear the buffers that used it).
266 * USE_CALL_FILTER - For ftrace internal events, don't use file filter 268 * USE_CALL_FILTER - For ftrace internal events, don't use file filter
267 * TRACEPOINT - Event is a tracepoint 269 * TRACEPOINT - Event is a tracepoint
270 * KPROBE - Event is a kprobe
268 */ 271 */
269enum { 272enum {
270 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), 273 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
@@ -274,6 +277,7 @@ enum {
274 TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT), 277 TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT),
275 TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT), 278 TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT),
276 TRACE_EVENT_FL_TRACEPOINT = (1 << TRACE_EVENT_FL_TRACEPOINT_BIT), 279 TRACE_EVENT_FL_TRACEPOINT = (1 << TRACE_EVENT_FL_TRACEPOINT_BIT),
280 TRACE_EVENT_FL_KPROBE = (1 << TRACE_EVENT_FL_KPROBE_BIT),
277}; 281};
278 282
279struct ftrace_event_call { 283struct ftrace_event_call {
@@ -285,7 +289,7 @@ struct ftrace_event_call {
285 struct tracepoint *tp; 289 struct tracepoint *tp;
286 }; 290 };
287 struct trace_event event; 291 struct trace_event event;
288 const char *print_fmt; 292 char *print_fmt;
289 struct event_filter *filter; 293 struct event_filter *filter;
290 void *mod; 294 void *mod;
291 void *data; 295 void *data;
@@ -303,6 +307,7 @@ struct ftrace_event_call {
303#ifdef CONFIG_PERF_EVENTS 307#ifdef CONFIG_PERF_EVENTS
304 int perf_refcount; 308 int perf_refcount;
305 struct hlist_head __percpu *perf_events; 309 struct hlist_head __percpu *perf_events;
310 struct bpf_prog *prog;
306 311
307 int (*perf_perm)(struct ftrace_event_call *, 312 int (*perf_perm)(struct ftrace_event_call *,
308 struct perf_event *); 313 struct perf_event *);
@@ -548,6 +553,15 @@ event_trigger_unlock_commit_regs(struct ftrace_event_file *file,
548 event_triggers_post_call(file, tt); 553 event_triggers_post_call(file, tt);
549} 554}
550 555
556#ifdef CONFIG_BPF_SYSCALL
557unsigned int trace_call_bpf(struct bpf_prog *prog, void *ctx);
558#else
559static inline unsigned int trace_call_bpf(struct bpf_prog *prog, void *ctx)
560{
561 return 1;
562}
563#endif
564
551enum { 565enum {
552 FILTER_OTHER = 0, 566 FILTER_OTHER = 0,
553 FILTER_STATIC_STRING, 567 FILTER_STATIC_STRING,
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
new file mode 100644
index 000000000000..0408545bce42
--- /dev/null
+++ b/include/linux/fwnode.h
@@ -0,0 +1,27 @@
1/*
2 * fwnode.h - Firmware device node object handle type definition.
3 *
4 * Copyright (C) 2015, Intel Corporation
5 * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _LINUX_FWNODE_H_
13#define _LINUX_FWNODE_H_
14
15enum fwnode_type {
16 FWNODE_INVALID = 0,
17 FWNODE_OF,
18 FWNODE_ACPI,
19 FWNODE_PDATA,
20};
21
22struct fwnode_handle {
23 enum fwnode_type type;
24 struct fwnode_handle *secondary;
25};
26
27#endif
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 51bd1e72a917..97a9373e61e8 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -57,8 +57,10 @@ struct vm_area_struct;
57 * _might_ fail. This depends upon the particular VM implementation. 57 * _might_ fail. This depends upon the particular VM implementation.
58 * 58 *
59 * __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller 59 * __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller
60 * cannot handle allocation failures. This modifier is deprecated and no new 60 * cannot handle allocation failures. New users should be evaluated carefully
61 * users should be added. 61 * (and the flag should be used only when there is no reasonable failure policy)
62 * but it is definitely preferable to use the flag rather than opencode endless
63 * loop around allocator.
62 * 64 *
63 * __GFP_NORETRY: The VM implementation must not retry indefinitely. 65 * __GFP_NORETRY: The VM implementation must not retry indefinitely.
64 * 66 *
@@ -117,16 +119,6 @@ struct vm_area_struct;
117 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \ 119 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \
118 __GFP_NO_KSWAPD) 120 __GFP_NO_KSWAPD)
119 121
120/*
121 * GFP_THISNODE does not perform any reclaim, you most likely want to
122 * use __GFP_THISNODE to allocate from a given node without fallback!
123 */
124#ifdef CONFIG_NUMA
125#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
126#else
127#define GFP_THISNODE ((__force gfp_t)0)
128#endif
129
130/* This mask makes up all the page movable related flags */ 122/* This mask makes up all the page movable related flags */
131#define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE|__GFP_MOVABLE) 123#define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE|__GFP_MOVABLE)
132 124
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 45afc2dee560..3a7c9ffd5ab9 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -16,6 +16,15 @@ struct device;
16 */ 16 */
17struct gpio_desc; 17struct gpio_desc;
18 18
19/**
20 * Struct containing an array of descriptors that can be obtained using
21 * gpiod_get_array().
22 */
23struct gpio_descs {
24 unsigned int ndescs;
25 struct gpio_desc *desc[];
26};
27
19#define GPIOD_FLAGS_BIT_DIR_SET BIT(0) 28#define GPIOD_FLAGS_BIT_DIR_SET BIT(0)
20#define GPIOD_FLAGS_BIT_DIR_OUT BIT(1) 29#define GPIOD_FLAGS_BIT_DIR_OUT BIT(1)
21#define GPIOD_FLAGS_BIT_DIR_VAL BIT(2) 30#define GPIOD_FLAGS_BIT_DIR_VAL BIT(2)
@@ -34,6 +43,9 @@ enum gpiod_flags {
34 43
35#ifdef CONFIG_GPIOLIB 44#ifdef CONFIG_GPIOLIB
36 45
46/* Return the number of GPIOs associated with a device / function */
47int gpiod_count(struct device *dev, const char *con_id);
48
37/* Acquire and dispose GPIOs */ 49/* Acquire and dispose GPIOs */
38struct gpio_desc *__must_check __gpiod_get(struct device *dev, 50struct gpio_desc *__must_check __gpiod_get(struct device *dev,
39 const char *con_id, 51 const char *con_id,
@@ -49,7 +61,14 @@ struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev,
49 const char *con_id, 61 const char *con_id,
50 unsigned int index, 62 unsigned int index,
51 enum gpiod_flags flags); 63 enum gpiod_flags flags);
64struct gpio_descs *__must_check gpiod_get_array(struct device *dev,
65 const char *con_id,
66 enum gpiod_flags flags);
67struct gpio_descs *__must_check gpiod_get_array_optional(struct device *dev,
68 const char *con_id,
69 enum gpiod_flags flags);
52void gpiod_put(struct gpio_desc *desc); 70void gpiod_put(struct gpio_desc *desc);
71void gpiod_put_array(struct gpio_descs *descs);
53 72
54struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev, 73struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev,
55 const char *con_id, 74 const char *con_id,
@@ -64,7 +83,14 @@ struct gpio_desc *__must_check __devm_gpiod_get_optional(struct device *dev,
64struct gpio_desc *__must_check 83struct gpio_desc *__must_check
65__devm_gpiod_get_index_optional(struct device *dev, const char *con_id, 84__devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
66 unsigned int index, enum gpiod_flags flags); 85 unsigned int index, enum gpiod_flags flags);
86struct gpio_descs *__must_check devm_gpiod_get_array(struct device *dev,
87 const char *con_id,
88 enum gpiod_flags flags);
89struct gpio_descs *__must_check
90devm_gpiod_get_array_optional(struct device *dev, const char *con_id,
91 enum gpiod_flags flags);
67void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); 92void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
93void devm_gpiod_put_array(struct device *dev, struct gpio_descs *descs);
68 94
69int gpiod_get_direction(struct gpio_desc *desc); 95int gpiod_get_direction(struct gpio_desc *desc);
70int gpiod_direction_input(struct gpio_desc *desc); 96int gpiod_direction_input(struct gpio_desc *desc);
@@ -110,9 +136,15 @@ struct fwnode_handle;
110struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, 136struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
111 const char *propname); 137 const char *propname);
112struct gpio_desc *devm_get_gpiod_from_child(struct device *dev, 138struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
139 const char *con_id,
113 struct fwnode_handle *child); 140 struct fwnode_handle *child);
114#else /* CONFIG_GPIOLIB */ 141#else /* CONFIG_GPIOLIB */
115 142
143static inline int gpiod_count(struct device *dev, const char *con_id)
144{
145 return 0;
146}
147
116static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev, 148static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev,
117 const char *con_id, 149 const char *con_id,
118 enum gpiod_flags flags) 150 enum gpiod_flags flags)
@@ -142,6 +174,20 @@ __gpiod_get_index_optional(struct device *dev, const char *con_id,
142 return ERR_PTR(-ENOSYS); 174 return ERR_PTR(-ENOSYS);
143} 175}
144 176
177static inline struct gpio_descs *__must_check
178gpiod_get_array(struct device *dev, const char *con_id,
179 enum gpiod_flags flags)
180{
181 return ERR_PTR(-ENOSYS);
182}
183
184static inline struct gpio_descs *__must_check
185gpiod_get_array_optional(struct device *dev, const char *con_id,
186 enum gpiod_flags flags)
187{
188 return ERR_PTR(-ENOSYS);
189}
190
145static inline void gpiod_put(struct gpio_desc *desc) 191static inline void gpiod_put(struct gpio_desc *desc)
146{ 192{
147 might_sleep(); 193 might_sleep();
@@ -150,6 +196,14 @@ static inline void gpiod_put(struct gpio_desc *desc)
150 WARN_ON(1); 196 WARN_ON(1);
151} 197}
152 198
199static inline void gpiod_put_array(struct gpio_descs *descs)
200{
201 might_sleep();
202
203 /* GPIO can never have been requested */
204 WARN_ON(1);
205}
206
153static inline struct gpio_desc *__must_check 207static inline struct gpio_desc *__must_check
154__devm_gpiod_get(struct device *dev, 208__devm_gpiod_get(struct device *dev,
155 const char *con_id, 209 const char *con_id,
@@ -181,6 +235,20 @@ __devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
181 return ERR_PTR(-ENOSYS); 235 return ERR_PTR(-ENOSYS);
182} 236}
183 237
238static inline struct gpio_descs *__must_check
239devm_gpiod_get_array(struct device *dev, const char *con_id,
240 enum gpiod_flags flags)
241{
242 return ERR_PTR(-ENOSYS);
243}
244
245static inline struct gpio_descs *__must_check
246devm_gpiod_get_array_optional(struct device *dev, const char *con_id,
247 enum gpiod_flags flags)
248{
249 return ERR_PTR(-ENOSYS);
250}
251
184static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) 252static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
185{ 253{
186 might_sleep(); 254 might_sleep();
@@ -189,6 +257,15 @@ static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
189 WARN_ON(1); 257 WARN_ON(1);
190} 258}
191 259
260static inline void devm_gpiod_put_array(struct device *dev,
261 struct gpio_descs *descs)
262{
263 might_sleep();
264
265 /* GPIO can never have been requested */
266 WARN_ON(1);
267}
268
192 269
193static inline int gpiod_get_direction(const struct gpio_desc *desc) 270static inline int gpiod_get_direction(const struct gpio_desc *desc)
194{ 271{
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index c497c62889d1..f1b36593ec9f 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -6,6 +6,7 @@
6#include <linux/irq.h> 6#include <linux/irq.h>
7#include <linux/irqchip/chained_irq.h> 7#include <linux/irqchip/chained_irq.h>
8#include <linux/irqdomain.h> 8#include <linux/irqdomain.h>
9#include <linux/pinctrl/pinctrl.h>
9 10
10struct device; 11struct device;
11struct gpio_desc; 12struct gpio_desc;
@@ -173,6 +174,53 @@ int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
173 174
174#endif /* CONFIG_GPIOLIB_IRQCHIP */ 175#endif /* CONFIG_GPIOLIB_IRQCHIP */
175 176
177#ifdef CONFIG_PINCTRL
178
179/**
180 * struct gpio_pin_range - pin range controlled by a gpio chip
181 * @head: list for maintaining set of pin ranges, used internally
182 * @pctldev: pinctrl device which handles corresponding pins
183 * @range: actual range of pins controlled by a gpio controller
184 */
185
186struct gpio_pin_range {
187 struct list_head node;
188 struct pinctrl_dev *pctldev;
189 struct pinctrl_gpio_range range;
190};
191
192int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
193 unsigned int gpio_offset, unsigned int pin_offset,
194 unsigned int npins);
195int gpiochip_add_pingroup_range(struct gpio_chip *chip,
196 struct pinctrl_dev *pctldev,
197 unsigned int gpio_offset, const char *pin_group);
198void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
199
200#else
201
202static inline int
203gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
204 unsigned int gpio_offset, unsigned int pin_offset,
205 unsigned int npins)
206{
207 return 0;
208}
209static inline int
210gpiochip_add_pingroup_range(struct gpio_chip *chip,
211 struct pinctrl_dev *pctldev,
212 unsigned int gpio_offset, const char *pin_group)
213{
214 return 0;
215}
216
217static inline void
218gpiochip_remove_pin_ranges(struct gpio_chip *chip)
219{
220}
221
222#endif /* CONFIG_PINCTRL */
223
176struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum, 224struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum,
177 const char *label); 225 const char *label);
178void gpiochip_free_own_desc(struct gpio_desc *desc); 226void gpiochip_free_own_desc(struct gpio_desc *desc);
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index cba442ec3c66..f4af03404b97 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -9,7 +9,7 @@
9 9
10 10
11extern void synchronize_irq(unsigned int irq); 11extern void synchronize_irq(unsigned int irq);
12extern void synchronize_hardirq(unsigned int irq); 12extern bool synchronize_hardirq(unsigned int irq);
13 13
14#if defined(CONFIG_TINY_RCU) 14#if defined(CONFIG_TINY_RCU)
15 15
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index 51f7ccadf923..0408421d885f 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -33,6 +33,8 @@
33 * @units: Measurment unit for this attribute. 33 * @units: Measurment unit for this attribute.
34 * @unit_expo: Exponent used in the data. 34 * @unit_expo: Exponent used in the data.
35 * @size: Size in bytes for data size. 35 * @size: Size in bytes for data size.
36 * @logical_minimum: Logical minimum value for this attribute.
37 * @logical_maximum: Logical maximum value for this attribute.
36 */ 38 */
37struct hid_sensor_hub_attribute_info { 39struct hid_sensor_hub_attribute_info {
38 u32 usage_id; 40 u32 usage_id;
@@ -47,19 +49,43 @@ struct hid_sensor_hub_attribute_info {
47}; 49};
48 50
49/** 51/**
52 * struct sensor_hub_pending - Synchronous read pending information
53 * @status: Pending status true/false.
54 * @ready: Completion synchronization data.
55 * @usage_id: Usage id for physical device, E.g. Gyro usage id.
56 * @attr_usage_id: Usage Id of a field, E.g. X-AXIS for a gyro.
57 * @raw_size: Response size for a read request.
58 * @raw_data: Place holder for received response.
59 */
60struct sensor_hub_pending {
61 bool status;
62 struct completion ready;
63 u32 usage_id;
64 u32 attr_usage_id;
65 int raw_size;
66 u8 *raw_data;
67};
68
69/**
50 * struct hid_sensor_hub_device - Stores the hub instance data 70 * struct hid_sensor_hub_device - Stores the hub instance data
51 * @hdev: Stores the hid instance. 71 * @hdev: Stores the hid instance.
52 * @vendor_id: Vendor id of hub device. 72 * @vendor_id: Vendor id of hub device.
53 * @product_id: Product id of hub device. 73 * @product_id: Product id of hub device.
74 * @usage: Usage id for this hub device instance.
54 * @start_collection_index: Starting index for a phy type collection 75 * @start_collection_index: Starting index for a phy type collection
55 * @end_collection_index: Last index for a phy type collection 76 * @end_collection_index: Last index for a phy type collection
77 * @mutex: synchronizing mutex.
78 * @pending: Holds information of pending sync read request.
56 */ 79 */
57struct hid_sensor_hub_device { 80struct hid_sensor_hub_device {
58 struct hid_device *hdev; 81 struct hid_device *hdev;
59 u32 vendor_id; 82 u32 vendor_id;
60 u32 product_id; 83 u32 product_id;
84 u32 usage;
61 int start_collection_index; 85 int start_collection_index;
62 int end_collection_index; 86 int end_collection_index;
87 struct mutex mutex;
88 struct sensor_hub_pending pending;
63}; 89};
64 90
65/** 91/**
@@ -146,41 +172,55 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
146 172
147/** 173/**
148* sensor_hub_input_attr_get_raw_value() - Synchronous read request 174* sensor_hub_input_attr_get_raw_value() - Synchronous read request
175* @hsdev: Hub device instance.
149* @usage_id: Attribute usage id of parent physical device as per spec 176* @usage_id: Attribute usage id of parent physical device as per spec
150* @attr_usage_id: Attribute usage id as per spec 177* @attr_usage_id: Attribute usage id as per spec
151* @report_id: Report id to look for 178* @report_id: Report id to look for
179* @flag: Synchronous or asynchronous read
152* 180*
153* Issues a synchronous read request for an input attribute. Returns 181* Issues a synchronous or asynchronous read request for an input attribute.
154* data upto 32 bits. Since client can get events, so this call should 182* Returns data upto 32 bits.
155* not be used for data paths, this will impact performance.
156*/ 183*/
157 184
185enum sensor_hub_read_flags {
186 SENSOR_HUB_SYNC,
187 SENSOR_HUB_ASYNC,
188};
189
158int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, 190int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
159 u32 usage_id, 191 u32 usage_id,
160 u32 attr_usage_id, u32 report_id); 192 u32 attr_usage_id, u32 report_id,
193 enum sensor_hub_read_flags flag
194);
195
161/** 196/**
162* sensor_hub_set_feature() - Feature set request 197* sensor_hub_set_feature() - Feature set request
198* @hsdev: Hub device instance.
163* @report_id: Report id to look for 199* @report_id: Report id to look for
164* @field_index: Field index inside a report 200* @field_index: Field index inside a report
165* @value: Value to set 201* @buffer_size: size of the buffer
202* @buffer: buffer to use in the feature set
166* 203*
167* Used to set a field in feature report. For example this can set polling 204* Used to set a field in feature report. For example this can set polling
168* interval, sensitivity, activate/deactivate state. 205* interval, sensitivity, activate/deactivate state.
169*/ 206*/
170int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, 207int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
171 u32 field_index, s32 value); 208 u32 field_index, int buffer_size, void *buffer);
172 209
173/** 210/**
174* sensor_hub_get_feature() - Feature get request 211* sensor_hub_get_feature() - Feature get request
212* @hsdev: Hub device instance.
175* @report_id: Report id to look for 213* @report_id: Report id to look for
176* @field_index: Field index inside a report 214* @field_index: Field index inside a report
177* @value: Place holder for return value 215* @buffer_size: size of the buffer
216* @buffer: buffer to copy output
178* 217*
179* Used to get a field in feature report. For example this can get polling 218* Used to get a field in feature report. For example this can get polling
180* interval, sensitivity, activate/deactivate state. 219* interval, sensitivity, activate/deactivate state. On success it returns
220* number of bytes copied to buffer. On failure, it returns value < 0.
181*/ 221*/
182int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, 222int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
183 u32 field_index, s32 *value); 223 u32 field_index, int buffer_size, void *buffer);
184 224
185/* hid-sensor-attributes */ 225/* hid-sensor-attributes */
186 226
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 109f0e633e01..f2ee90aed0c2 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -21,6 +21,8 @@
21 21
22#define HID_MAX_PHY_DEVICES 0xFF 22#define HID_MAX_PHY_DEVICES 0xFF
23 23
24#define HID_USAGE_SENSOR_COLLECTION 0x200001
25
24/* Accel 3D (200073) */ 26/* Accel 3D (200073) */
25#define HID_USAGE_SENSOR_ACCEL_3D 0x200073 27#define HID_USAGE_SENSOR_ACCEL_3D 0x200073
26#define HID_USAGE_SENSOR_DATA_ACCELERATION 0x200452 28#define HID_USAGE_SENSOR_DATA_ACCELERATION 0x200452
diff --git a/include/linux/hid.h b/include/linux/hid.h
index efc7787a41a8..176b43670e5d 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -159,6 +159,7 @@ struct hid_item {
159#define HID_UP_LED 0x00080000 159#define HID_UP_LED 0x00080000
160#define HID_UP_BUTTON 0x00090000 160#define HID_UP_BUTTON 0x00090000
161#define HID_UP_ORDINAL 0x000a0000 161#define HID_UP_ORDINAL 0x000a0000
162#define HID_UP_TELEPHONY 0x000b0000
162#define HID_UP_CONSUMER 0x000c0000 163#define HID_UP_CONSUMER 0x000c0000
163#define HID_UP_DIGITIZER 0x000d0000 164#define HID_UP_DIGITIZER 0x000d0000
164#define HID_UP_PID 0x000f0000 165#define HID_UP_PID 0x000f0000
@@ -269,6 +270,7 @@ struct hid_item {
269#define HID_DG_DEVICEINDEX 0x000d0053 270#define HID_DG_DEVICEINDEX 0x000d0053
270#define HID_DG_CONTACTCOUNT 0x000d0054 271#define HID_DG_CONTACTCOUNT 0x000d0054
271#define HID_DG_CONTACTMAX 0x000d0055 272#define HID_DG_CONTACTMAX 0x000d0055
273#define HID_DG_BUTTONTYPE 0x000d0059
272#define HID_DG_BARRELSWITCH2 0x000d005a 274#define HID_DG_BARRELSWITCH2 0x000d005a
273#define HID_DG_TOOLSERIALNUMBER 0x000d005b 275#define HID_DG_TOOLSERIALNUMBER 0x000d005b
274 276
@@ -514,10 +516,10 @@ struct hid_device { /* device report descriptor */
514#ifdef CONFIG_HID_BATTERY_STRENGTH 516#ifdef CONFIG_HID_BATTERY_STRENGTH
515 /* 517 /*
516 * Power supply information for HID devices which report 518 * Power supply information for HID devices which report
517 * battery strength. power_supply is registered iff 519 * battery strength. power_supply was successfully registered if
518 * battery.name is non-NULL. 520 * battery is non-NULL.
519 */ 521 */
520 struct power_supply battery; 522 struct power_supply *battery;
521 __s32 battery_min; 523 __s32 battery_min;
522 __s32 battery_max; 524 __s32 battery_max;
523 __s32 battery_report_type; 525 __s32 battery_report_type;
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index 464f33814a94..d2ba7d334039 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -135,6 +135,7 @@ struct host1x_syncpt *host1x_syncpt_get(struct host1x *host, u32 id);
135u32 host1x_syncpt_id(struct host1x_syncpt *sp); 135u32 host1x_syncpt_id(struct host1x_syncpt *sp);
136u32 host1x_syncpt_read_min(struct host1x_syncpt *sp); 136u32 host1x_syncpt_read_min(struct host1x_syncpt *sp);
137u32 host1x_syncpt_read_max(struct host1x_syncpt *sp); 137u32 host1x_syncpt_read_max(struct host1x_syncpt *sp);
138u32 host1x_syncpt_read(struct host1x_syncpt *sp);
138int host1x_syncpt_incr(struct host1x_syncpt *sp); 139int host1x_syncpt_incr(struct host1x_syncpt *sp);
139u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs); 140u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs);
140int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout, 141int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h
index 3ec06300d535..5dd60c2e120f 100644
--- a/include/linux/hsi/hsi.h
+++ b/include/linux/hsi/hsi.h
@@ -135,9 +135,9 @@ static inline int hsi_register_board_info(struct hsi_board_info const *info,
135 * @device: Driver model representation of the device 135 * @device: Driver model representation of the device
136 * @tx_cfg: HSI TX configuration 136 * @tx_cfg: HSI TX configuration
137 * @rx_cfg: HSI RX configuration 137 * @rx_cfg: HSI RX configuration
138 * e_handler: Callback for handling port events (RX Wake High/Low) 138 * @e_handler: Callback for handling port events (RX Wake High/Low)
139 * pclaimed: Keeps tracks if the clients claimed its associated HSI port 139 * @pclaimed: Keeps tracks if the clients claimed its associated HSI port
140 * nb: Notifier block for port events 140 * @nb: Notifier block for port events
141 */ 141 */
142struct hsi_client { 142struct hsi_client {
143 struct device device; 143 struct device device;
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 7b5785032049..205026175c42 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -22,7 +22,13 @@ struct mmu_gather;
22struct hugepage_subpool { 22struct hugepage_subpool {
23 spinlock_t lock; 23 spinlock_t lock;
24 long count; 24 long count;
25 long max_hpages, used_hpages; 25 long max_hpages; /* Maximum huge pages or -1 if no maximum. */
26 long used_hpages; /* Used count against maximum, includes */
27 /* both alloced and reserved pages. */
28 struct hstate *hstate;
29 long min_hpages; /* Minimum huge pages or -1 if no minimum. */
30 long rsv_hpages; /* Pages reserved against global pool to */
31 /* sasitfy minimum size. */
26}; 32};
27 33
28struct resv_map { 34struct resv_map {
@@ -38,11 +44,10 @@ extern int hugetlb_max_hstate __read_mostly;
38#define for_each_hstate(h) \ 44#define for_each_hstate(h) \
39 for ((h) = hstates; (h) < &hstates[hugetlb_max_hstate]; (h)++) 45 for ((h) = hstates; (h) < &hstates[hugetlb_max_hstate]; (h)++)
40 46
41struct hugepage_subpool *hugepage_new_subpool(long nr_blocks); 47struct hugepage_subpool *hugepage_new_subpool(struct hstate *h, long max_hpages,
48 long min_hpages);
42void hugepage_put_subpool(struct hugepage_subpool *spool); 49void hugepage_put_subpool(struct hugepage_subpool *spool);
43 50
44int PageHuge(struct page *page);
45
46void reset_vma_resv_huge_pages(struct vm_area_struct *vma); 51void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
47int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); 52int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
48int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); 53int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
@@ -79,7 +84,6 @@ void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
79int dequeue_hwpoisoned_huge_page(struct page *page); 84int dequeue_hwpoisoned_huge_page(struct page *page);
80bool isolate_huge_page(struct page *page, struct list_head *list); 85bool isolate_huge_page(struct page *page, struct list_head *list);
81void putback_active_hugepage(struct page *page); 86void putback_active_hugepage(struct page *page);
82bool is_hugepage_active(struct page *page);
83void free_huge_page(struct page *page); 87void free_huge_page(struct page *page);
84 88
85#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE 89#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
@@ -109,11 +113,6 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
109 113
110#else /* !CONFIG_HUGETLB_PAGE */ 114#else /* !CONFIG_HUGETLB_PAGE */
111 115
112static inline int PageHuge(struct page *page)
113{
114 return 0;
115}
116
117static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma) 116static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma)
118{ 117{
119} 118}
@@ -152,7 +151,6 @@ static inline bool isolate_huge_page(struct page *page, struct list_head *list)
152 return false; 151 return false;
153} 152}
154#define putback_active_hugepage(p) do {} while (0) 153#define putback_active_hugepage(p) do {} while (0)
155#define is_hugepage_active(x) false
156 154
157static inline unsigned long hugetlb_change_protection(struct vm_area_struct *vma, 155static inline unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
158 unsigned long address, unsigned long end, pgprot_t newprot) 156 unsigned long address, unsigned long end, pgprot_t newprot)
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index eb7b414d232b..4f7d8f4b1e9a 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -50,10 +50,14 @@ struct hwrng {
50 struct completion cleanup_done; 50 struct completion cleanup_done;
51}; 51};
52 52
53struct device;
54
53/** Register a new Hardware Random Number Generator driver. */ 55/** Register a new Hardware Random Number Generator driver. */
54extern int hwrng_register(struct hwrng *rng); 56extern int hwrng_register(struct hwrng *rng);
57extern int devm_hwrng_register(struct device *dev, struct hwrng *rng);
55/** Unregister a Hardware Random Number Generator driver. */ 58/** Unregister a Hardware Random Number Generator driver. */
56extern void hwrng_unregister(struct hwrng *rng); 59extern void hwrng_unregister(struct hwrng *rng);
60extern void devm_hwrng_unregister(struct device *dve, struct hwrng *rng);
57/** Feed random bits into the pool. */ 61/** Feed random bits into the pool. */
58extern void add_hwgenerator_randomness(const char *buffer, size_t count, size_t entropy); 62extern void add_hwgenerator_randomness(const char *buffer, size_t count, size_t entropy);
59 63
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 5a2ba674795e..902c37aef67e 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -646,12 +646,13 @@ struct hv_input_signal_event_buffer {
646}; 646};
647 647
648struct vmbus_channel { 648struct vmbus_channel {
649 /* Unique channel id */
650 int id;
651
649 struct list_head listentry; 652 struct list_head listentry;
650 653
651 struct hv_device *device_obj; 654 struct hv_device *device_obj;
652 655
653 struct work_struct work;
654
655 enum vmbus_channel_state state; 656 enum vmbus_channel_state state;
656 657
657 struct vmbus_channel_offer_channel offermsg; 658 struct vmbus_channel_offer_channel offermsg;
@@ -672,7 +673,6 @@ struct vmbus_channel {
672 struct hv_ring_buffer_info outbound; /* send to parent */ 673 struct hv_ring_buffer_info outbound; /* send to parent */
673 struct hv_ring_buffer_info inbound; /* receive from parent */ 674 struct hv_ring_buffer_info inbound; /* receive from parent */
674 spinlock_t inbound_lock; 675 spinlock_t inbound_lock;
675 struct workqueue_struct *controlwq;
676 676
677 struct vmbus_close_msg close_msg; 677 struct vmbus_close_msg close_msg;
678 678
@@ -758,6 +758,9 @@ struct vmbus_channel {
758 * link up channels based on their CPU affinity. 758 * link up channels based on their CPU affinity.
759 */ 759 */
760 struct list_head percpu_list; 760 struct list_head percpu_list;
761
762 int num_sc;
763 int next_oc;
761}; 764};
762 765
763static inline void set_channel_read_state(struct vmbus_channel *c, bool state) 766static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
@@ -861,6 +864,14 @@ extern int vmbus_sendpacket(struct vmbus_channel *channel,
861 enum vmbus_packet_type type, 864 enum vmbus_packet_type type,
862 u32 flags); 865 u32 flags);
863 866
867extern int vmbus_sendpacket_ctl(struct vmbus_channel *channel,
868 void *buffer,
869 u32 bufferLen,
870 u64 requestid,
871 enum vmbus_packet_type type,
872 u32 flags,
873 bool kick_q);
874
864extern int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel, 875extern int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
865 struct hv_page_buffer pagebuffers[], 876 struct hv_page_buffer pagebuffers[],
866 u32 pagecount, 877 u32 pagecount,
@@ -868,6 +879,15 @@ extern int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
868 u32 bufferlen, 879 u32 bufferlen,
869 u64 requestid); 880 u64 requestid);
870 881
882extern int vmbus_sendpacket_pagebuffer_ctl(struct vmbus_channel *channel,
883 struct hv_page_buffer pagebuffers[],
884 u32 pagecount,
885 void *buffer,
886 u32 bufferlen,
887 u64 requestid,
888 u32 flags,
889 bool kick_q);
890
871extern int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel, 891extern int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
872 struct hv_multipage_buffer *mpb, 892 struct hv_multipage_buffer *mpb,
873 void *buffer, 893 void *buffer,
@@ -1107,6 +1127,16 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
1107 } 1127 }
1108 1128
1109/* 1129/*
1130 * NetworkDirect. This is the guest RDMA service.
1131 * {8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}
1132 */
1133#define HV_ND_GUID \
1134 .guid = { \
1135 0x3d, 0xaf, 0x2e, 0x8c, 0xa7, 0x32, 0x09, 0x4b, \
1136 0xab, 0x99, 0xbd, 0x1f, 0x1c, 0x86, 0xb5, 0x01 \
1137 }
1138
1139/*
1110 * Common header for Hyper-V ICs 1140 * Common header for Hyper-V ICs
1111 */ 1141 */
1112 1142
@@ -1213,6 +1243,7 @@ void hv_kvp_onchannelcallback(void *);
1213int hv_vss_init(struct hv_util_service *); 1243int hv_vss_init(struct hv_util_service *);
1214void hv_vss_deinit(void); 1244void hv_vss_deinit(void);
1215void hv_vss_onchannelcallback(void *); 1245void hv_vss_onchannelcallback(void *);
1246void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid);
1216 1247
1217extern struct resource hyperv_mmio; 1248extern struct resource hyperv_mmio;
1218 1249
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index f17da50402a4..e83a738a3b87 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -253,10 +253,10 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
253 253
254#if IS_ENABLED(CONFIG_I2C_SLAVE) 254#if IS_ENABLED(CONFIG_I2C_SLAVE)
255enum i2c_slave_event { 255enum i2c_slave_event {
256 I2C_SLAVE_REQ_READ_START, 256 I2C_SLAVE_READ_REQUESTED,
257 I2C_SLAVE_REQ_READ_END, 257 I2C_SLAVE_WRITE_REQUESTED,
258 I2C_SLAVE_REQ_WRITE_START, 258 I2C_SLAVE_READ_PROCESSED,
259 I2C_SLAVE_REQ_WRITE_END, 259 I2C_SLAVE_WRITE_RECEIVED,
260 I2C_SLAVE_STOP, 260 I2C_SLAVE_STOP,
261}; 261};
262 262
@@ -278,7 +278,7 @@ static inline int i2c_slave_event(struct i2c_client *client,
278 * @platform_data: stored in i2c_client.dev.platform_data 278 * @platform_data: stored in i2c_client.dev.platform_data
279 * @archdata: copied into i2c_client.dev.archdata 279 * @archdata: copied into i2c_client.dev.archdata
280 * @of_node: pointer to OpenFirmware device node 280 * @of_node: pointer to OpenFirmware device node
281 * @acpi_node: ACPI device node 281 * @fwnode: device node supplied by the platform firmware
282 * @irq: stored in i2c_client.irq 282 * @irq: stored in i2c_client.irq
283 * 283 *
284 * I2C doesn't actually support hardware probing, although controllers and 284 * I2C doesn't actually support hardware probing, although controllers and
@@ -299,7 +299,7 @@ struct i2c_board_info {
299 void *platform_data; 299 void *platform_data;
300 struct dev_archdata *archdata; 300 struct dev_archdata *archdata;
301 struct device_node *of_node; 301 struct device_node *of_node;
302 struct acpi_dev_node acpi_node; 302 struct fwnode_handle *fwnode;
303 int irq; 303 int irq;
304}; 304};
305 305
@@ -435,8 +435,8 @@ struct i2c_bus_recovery_info {
435 void (*set_scl)(struct i2c_adapter *, int val); 435 void (*set_scl)(struct i2c_adapter *, int val);
436 int (*get_sda)(struct i2c_adapter *); 436 int (*get_sda)(struct i2c_adapter *);
437 437
438 void (*prepare_recovery)(struct i2c_bus_recovery_info *bri); 438 void (*prepare_recovery)(struct i2c_adapter *);
439 void (*unprepare_recovery)(struct i2c_bus_recovery_info *bri); 439 void (*unprepare_recovery)(struct i2c_adapter *);
440 440
441 /* gpio recovery */ 441 /* gpio recovery */
442 int scl_gpio; 442 int scl_gpio;
@@ -449,6 +449,48 @@ int i2c_recover_bus(struct i2c_adapter *adap);
449int i2c_generic_gpio_recovery(struct i2c_adapter *adap); 449int i2c_generic_gpio_recovery(struct i2c_adapter *adap);
450int i2c_generic_scl_recovery(struct i2c_adapter *adap); 450int i2c_generic_scl_recovery(struct i2c_adapter *adap);
451 451
452/**
453 * struct i2c_adapter_quirks - describe flaws of an i2c adapter
454 * @flags: see I2C_AQ_* for possible flags and read below
455 * @max_num_msgs: maximum number of messages per transfer
456 * @max_write_len: maximum length of a write message
457 * @max_read_len: maximum length of a read message
458 * @max_comb_1st_msg_len: maximum length of the first msg in a combined message
459 * @max_comb_2nd_msg_len: maximum length of the second msg in a combined message
460 *
461 * Note about combined messages: Some I2C controllers can only send one message
462 * per transfer, plus something called combined message or write-then-read.
463 * This is (usually) a small write message followed by a read message and
464 * barely enough to access register based devices like EEPROMs. There is a flag
465 * to support this mode. It implies max_num_msg = 2 and does the length checks
466 * with max_comb_*_len because combined message mode usually has its own
467 * limitations. Because of HW implementations, some controllers can actually do
468 * write-then-anything or other variants. To support that, write-then-read has
469 * been broken out into smaller bits like write-first and read-second which can
470 * be combined as needed.
471 */
472
473struct i2c_adapter_quirks {
474 u64 flags;
475 int max_num_msgs;
476 u16 max_write_len;
477 u16 max_read_len;
478 u16 max_comb_1st_msg_len;
479 u16 max_comb_2nd_msg_len;
480};
481
482/* enforce max_num_msgs = 2 and use max_comb_*_len for length checks */
483#define I2C_AQ_COMB BIT(0)
484/* first combined message must be write */
485#define I2C_AQ_COMB_WRITE_FIRST BIT(1)
486/* second combined message must be read */
487#define I2C_AQ_COMB_READ_SECOND BIT(2)
488/* both combined messages must have the same target address */
489#define I2C_AQ_COMB_SAME_ADDR BIT(3)
490/* convenience macro for typical write-then read case */
491#define I2C_AQ_COMB_WRITE_THEN_READ (I2C_AQ_COMB | I2C_AQ_COMB_WRITE_FIRST | \
492 I2C_AQ_COMB_READ_SECOND | I2C_AQ_COMB_SAME_ADDR)
493
452/* 494/*
453 * i2c_adapter is the structure used to identify a physical i2c bus along 495 * i2c_adapter is the structure used to identify a physical i2c bus along
454 * with the access algorithms necessary to access it. 496 * with the access algorithms necessary to access it.
@@ -474,6 +516,7 @@ struct i2c_adapter {
474 struct list_head userspace_clients; 516 struct list_head userspace_clients;
475 517
476 struct i2c_bus_recovery_info *bus_recovery_info; 518 struct i2c_bus_recovery_info *bus_recovery_info;
519 const struct i2c_adapter_quirks *quirks;
477}; 520};
478#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) 521#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
479 522
diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h
index 6e82d888287c..8872ca103d06 100644
--- a/include/linux/ieee802154.h
+++ b/include/linux/ieee802154.h
@@ -28,7 +28,9 @@
28#include <asm/byteorder.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 31#define IEEE802154_ACK_PSDU_LEN 5
32#define IEEE802154_MIN_PSDU_LEN 9
33#define IEEE802154_FCS_LEN 2
32 34
33#define IEEE802154_PAN_ID_BROADCAST 0xffff 35#define IEEE802154_PAN_ID_BROADCAST 0xffff
34#define IEEE802154_ADDR_SHORT_BROADCAST 0xffff 36#define IEEE802154_ADDR_SHORT_BROADCAST 0xffff
@@ -38,6 +40,7 @@
38 40
39#define IEEE802154_LIFS_PERIOD 40 41#define IEEE802154_LIFS_PERIOD 40
40#define IEEE802154_SIFS_PERIOD 12 42#define IEEE802154_SIFS_PERIOD 12
43#define IEEE802154_MAX_SIFS_FRAME_SIZE 18
41 44
42#define IEEE802154_MAX_CHANNEL 26 45#define IEEE802154_MAX_CHANNEL 26
43#define IEEE802154_MAX_PAGE 31 46#define IEEE802154_MAX_PAGE 31
@@ -204,11 +207,18 @@ enum {
204 207
205/** 208/**
206 * ieee802154_is_valid_psdu_len - check if psdu len is valid 209 * ieee802154_is_valid_psdu_len - check if psdu len is valid
210 * available lengths:
211 * 0-4 Reserved
212 * 5 MPDU (Acknowledgment)
213 * 6-8 Reserved
214 * 9-127 MPDU
215 *
207 * @len: psdu len with (MHR + payload + MFR) 216 * @len: psdu len with (MHR + payload + MFR)
208 */ 217 */
209static inline bool ieee802154_is_valid_psdu_len(const u8 len) 218static inline bool ieee802154_is_valid_psdu_len(const u8 len)
210{ 219{
211 return (len >= IEEE802154_MIN_PSDU_LEN && len <= IEEE802154_MTU); 220 return (len == IEEE802154_ACK_PSDU_LEN ||
221 (len >= IEEE802154_MIN_PSDU_LEN && len <= IEEE802154_MTU));
212} 222}
213 223
214/** 224/**
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index a57bca2ea97e..dad8b00beed2 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -44,6 +44,7 @@ struct br_ip_list {
44#define BR_PROMISC BIT(7) 44#define BR_PROMISC BIT(7)
45#define BR_PROXYARP BIT(8) 45#define BR_PROXYARP BIT(8)
46#define BR_LEARNING_SYNC BIT(9) 46#define BR_LEARNING_SYNC BIT(9)
47#define BR_PROXYARP_WIFI BIT(10)
47 48
48extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); 49extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
49 50
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 119130e9298b..da4929927f69 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -14,5 +14,6 @@ struct ifla_vf_info {
14 __u32 linkstate; 14 __u32 linkstate;
15 __u32 min_tx_rate; 15 __u32 min_tx_rate;
16 __u32 max_tx_rate; 16 __u32 max_tx_rate;
17 __u32 rss_query_en;
17}; 18};
18#endif /* _LINUX_IF_LINK_H */ 19#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index aff7ad8a4ea3..66a7d7600f43 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -19,6 +19,7 @@
19#include <linux/netdevice.h> 19#include <linux/netdevice.h>
20#include <linux/ppp_channel.h> 20#include <linux/ppp_channel.h>
21#include <linux/skbuff.h> 21#include <linux/skbuff.h>
22#include <linux/workqueue.h>
22#include <uapi/linux/if_pppox.h> 23#include <uapi/linux/if_pppox.h>
23 24
24static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb) 25static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
@@ -32,6 +33,7 @@ struct pppoe_opt {
32 struct pppoe_addr pa; /* what this socket is bound to*/ 33 struct pppoe_addr pa; /* what this socket is bound to*/
33 struct sockaddr_pppox relay; /* what socket data will be 34 struct sockaddr_pppox relay; /* what socket data will be
34 relayed to (PPPoE relaying) */ 35 relayed to (PPPoE relaying) */
36 struct work_struct padt_work;/* Work item for handling PADT */
35}; 37};
36 38
37struct pptp_opt { 39struct pptp_opt {
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index b11b28a30b9e..920e4457ce6e 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -561,4 +561,71 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
561 skb->protocol = htons(ETH_P_802_2); 561 skb->protocol = htons(ETH_P_802_2);
562} 562}
563 563
564/**
565 * skb_vlan_tagged - check if skb is vlan tagged.
566 * @skb: skbuff to query
567 *
568 * Returns true if the skb is tagged, regardless of whether it is hardware
569 * accelerated or not.
570 */
571static inline bool skb_vlan_tagged(const struct sk_buff *skb)
572{
573 if (!skb_vlan_tag_present(skb) &&
574 likely(skb->protocol != htons(ETH_P_8021Q) &&
575 skb->protocol != htons(ETH_P_8021AD)))
576 return false;
577
578 return true;
579}
580
581/**
582 * skb_vlan_tagged_multi - check if skb is vlan tagged with multiple headers.
583 * @skb: skbuff to query
584 *
585 * Returns true if the skb is tagged with multiple vlan headers, regardless
586 * of whether it is hardware accelerated or not.
587 */
588static inline bool skb_vlan_tagged_multi(const struct sk_buff *skb)
589{
590 __be16 protocol = skb->protocol;
591
592 if (!skb_vlan_tag_present(skb)) {
593 struct vlan_ethhdr *veh;
594
595 if (likely(protocol != htons(ETH_P_8021Q) &&
596 protocol != htons(ETH_P_8021AD)))
597 return false;
598
599 veh = (struct vlan_ethhdr *)skb->data;
600 protocol = veh->h_vlan_encapsulated_proto;
601 }
602
603 if (protocol != htons(ETH_P_8021Q) && protocol != htons(ETH_P_8021AD))
604 return false;
605
606 return true;
607}
608
609/**
610 * vlan_features_check - drop unsafe features for skb with multiple tags.
611 * @skb: skbuff to query
612 * @features: features to be checked
613 *
614 * Returns features without unsafe ones if the skb has multiple tags.
615 */
616static inline netdev_features_t vlan_features_check(const struct sk_buff *skb,
617 netdev_features_t features)
618{
619 if (skb_vlan_tagged_multi(skb))
620 features = netdev_intersect_features(features,
621 NETIF_F_SG |
622 NETIF_F_HIGHDMA |
623 NETIF_F_FRAGLIST |
624 NETIF_F_GEN_CSUM |
625 NETIF_F_HW_VLAN_CTAG_TX |
626 NETIF_F_HW_VLAN_STAG_TX);
627
628 return features;
629}
630
564#endif /* !(_LINUX_IF_VLAN_H_) */ 631#endif /* !(_LINUX_IF_VLAN_H_) */
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index b65850a41127..eb8622b78ec9 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -21,8 +21,8 @@ struct iio_buffer;
21 * struct iio_buffer_access_funcs - access functions for buffers. 21 * struct iio_buffer_access_funcs - access functions for buffers.
22 * @store_to: actually store stuff to the buffer 22 * @store_to: actually store stuff to the buffer
23 * @read_first_n: try to get a specified number of bytes (must exist) 23 * @read_first_n: try to get a specified number of bytes (must exist)
24 * @data_available: indicates whether data for reading from the buffer is 24 * @data_available: indicates how much data is available for reading from
25 * available. 25 * the buffer.
26 * @request_update: if a parameter change has been marked, update underlying 26 * @request_update: if a parameter change has been marked, update underlying
27 * storage. 27 * storage.
28 * @set_bytes_per_datum:set number of bytes per datum 28 * @set_bytes_per_datum:set number of bytes per datum
@@ -43,7 +43,7 @@ struct iio_buffer_access_funcs {
43 int (*read_first_n)(struct iio_buffer *buffer, 43 int (*read_first_n)(struct iio_buffer *buffer,
44 size_t n, 44 size_t n,
45 char __user *buf); 45 char __user *buf);
46 bool (*data_available)(struct iio_buffer *buffer); 46 size_t (*data_available)(struct iio_buffer *buffer);
47 47
48 int (*request_update)(struct iio_buffer *buffer); 48 int (*request_update)(struct iio_buffer *buffer);
49 49
@@ -72,6 +72,7 @@ struct iio_buffer_access_funcs {
72 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan. 72 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan.
73 * @buffer_list: [INTERN] entry in the devices list of current buffers. 73 * @buffer_list: [INTERN] entry in the devices list of current buffers.
74 * @ref: [INTERN] reference count of the buffer. 74 * @ref: [INTERN] reference count of the buffer.
75 * @watermark: [INTERN] number of datums to wait for poll/read.
75 */ 76 */
76struct iio_buffer { 77struct iio_buffer {
77 int length; 78 int length;
@@ -90,6 +91,7 @@ struct iio_buffer {
90 void *demux_bounce; 91 void *demux_bounce;
91 struct list_head buffer_list; 92 struct list_head buffer_list;
92 struct kref ref; 93 struct kref ref;
94 unsigned int watermark;
93}; 95};
94 96
95/** 97/**
diff --git a/include/linux/iio/dac/max517.h b/include/linux/iio/dac/max517.h
index f6d1d252f08d..7668716cd73c 100644
--- a/include/linux/iio/dac/max517.h
+++ b/include/linux/iio/dac/max517.h
@@ -9,7 +9,7 @@
9#define IIO_DAC_MAX517_H_ 9#define IIO_DAC_MAX517_H_
10 10
11struct max517_platform_data { 11struct max517_platform_data {
12 u16 vref_mv[2]; 12 u16 vref_mv[8];
13}; 13};
14 14
15#endif /* IIO_DAC_MAX517_H_ */ 15#endif /* IIO_DAC_MAX517_H_ */
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
index 03fa332ad2a8..8ad87d1c5340 100644
--- a/include/linux/iio/events.h
+++ b/include/linux/iio/events.h
@@ -9,22 +9,8 @@
9#ifndef _IIO_EVENTS_H_ 9#ifndef _IIO_EVENTS_H_
10#define _IIO_EVENTS_H_ 10#define _IIO_EVENTS_H_
11 11
12#include <linux/ioctl.h>
13#include <linux/types.h>
14#include <linux/iio/types.h> 12#include <linux/iio/types.h>
15 13#include <uapi/linux/iio/events.h>
16/**
17 * struct iio_event_data - The actual event being pushed to userspace
18 * @id: event identifier
19 * @timestamp: best estimate of time of event occurrence (often from
20 * the interrupt handler)
21 */
22struct iio_event_data {
23 __u64 id;
24 __s64 timestamp;
25};
26
27#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
28 14
29/** 15/**
30 * IIO_EVENT_CODE() - create event identifier 16 * IIO_EVENT_CODE() - create event identifier
@@ -70,18 +56,4 @@ struct iio_event_data {
70#define IIO_UNMOD_EVENT_CODE(chan_type, number, type, direction) \ 56#define IIO_UNMOD_EVENT_CODE(chan_type, number, type, direction) \
71 IIO_EVENT_CODE(chan_type, 0, 0, direction, type, number, 0, 0) 57 IIO_EVENT_CODE(chan_type, 0, 0, direction, type, number, 0, 0)
72 58
73#define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
74
75#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F)
76
77#define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
78
79/* Event code number extraction depends on which type of event we have.
80 * Perhaps review this function in the future*/
81#define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF))
82#define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((__s16)(((mask) >> 16) & 0xFFFF))
83
84#define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF)
85#define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1)
86
87#endif 59#endif
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 80d855061064..d86b753e9b30 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -338,6 +338,16 @@ struct iio_dev;
338 * provide a custom of_xlate function that reads the 338 * provide a custom of_xlate function that reads the
339 * *args* and returns the appropriate index in registered 339 * *args* and returns the appropriate index in registered
340 * IIO channels array. 340 * IIO channels array.
341 * @hwfifo_set_watermark: function pointer to set the current hardware
342 * fifo watermark level; see hwfifo_* entries in
343 * Documentation/ABI/testing/sysfs-bus-iio for details on
344 * how the hardware fifo operates
345 * @hwfifo_flush_to_buffer: function pointer to flush the samples stored
346 * in the hardware fifo to the device buffer. The driver
347 * should not flush more than count samples. The function
348 * must return the number of samples flushed, 0 if no
349 * samples were flushed or a negative integer if no samples
350 * were flushed and there was an error.
341 **/ 351 **/
342struct iio_info { 352struct iio_info {
343 struct module *driver_module; 353 struct module *driver_module;
@@ -399,6 +409,9 @@ struct iio_info {
399 unsigned *readval); 409 unsigned *readval);
400 int (*of_xlate)(struct iio_dev *indio_dev, 410 int (*of_xlate)(struct iio_dev *indio_dev,
401 const struct of_phandle_args *iiospec); 411 const struct of_phandle_args *iiospec);
412 int (*hwfifo_set_watermark)(struct iio_dev *indio_dev, unsigned val);
413 int (*hwfifo_flush_to_buffer)(struct iio_dev *indio_dev,
414 unsigned count);
402}; 415};
403 416
404/** 417/**
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 580ed5bdb3fa..942b6de68e2f 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -10,76 +10,7 @@
10#ifndef _IIO_TYPES_H_ 10#ifndef _IIO_TYPES_H_
11#define _IIO_TYPES_H_ 11#define _IIO_TYPES_H_
12 12
13enum iio_chan_type { 13#include <uapi/linux/iio/types.h>
14 IIO_VOLTAGE,
15 IIO_CURRENT,
16 IIO_POWER,
17 IIO_ACCEL,
18 IIO_ANGL_VEL,
19 IIO_MAGN,
20 IIO_LIGHT,
21 IIO_INTENSITY,
22 IIO_PROXIMITY,
23 IIO_TEMP,
24 IIO_INCLI,
25 IIO_ROT,
26 IIO_ANGL,
27 IIO_TIMESTAMP,
28 IIO_CAPACITANCE,
29 IIO_ALTVOLTAGE,
30 IIO_CCT,
31 IIO_PRESSURE,
32 IIO_HUMIDITYRELATIVE,
33 IIO_ACTIVITY,
34 IIO_STEPS,
35 IIO_ENERGY,
36 IIO_DISTANCE,
37 IIO_VELOCITY,
38};
39
40enum iio_modifier {
41 IIO_NO_MOD,
42 IIO_MOD_X,
43 IIO_MOD_Y,
44 IIO_MOD_Z,
45 IIO_MOD_X_AND_Y,
46 IIO_MOD_X_AND_Z,
47 IIO_MOD_Y_AND_Z,
48 IIO_MOD_X_AND_Y_AND_Z,
49 IIO_MOD_X_OR_Y,
50 IIO_MOD_X_OR_Z,
51 IIO_MOD_Y_OR_Z,
52 IIO_MOD_X_OR_Y_OR_Z,
53 IIO_MOD_LIGHT_BOTH,
54 IIO_MOD_LIGHT_IR,
55 IIO_MOD_ROOT_SUM_SQUARED_X_Y,
56 IIO_MOD_SUM_SQUARED_X_Y_Z,
57 IIO_MOD_LIGHT_CLEAR,
58 IIO_MOD_LIGHT_RED,
59 IIO_MOD_LIGHT_GREEN,
60 IIO_MOD_LIGHT_BLUE,
61 IIO_MOD_QUATERNION,
62 IIO_MOD_TEMP_AMBIENT,
63 IIO_MOD_TEMP_OBJECT,
64 IIO_MOD_NORTH_MAGN,
65 IIO_MOD_NORTH_TRUE,
66 IIO_MOD_NORTH_MAGN_TILT_COMP,
67 IIO_MOD_NORTH_TRUE_TILT_COMP,
68 IIO_MOD_RUNNING,
69 IIO_MOD_JOGGING,
70 IIO_MOD_WALKING,
71 IIO_MOD_STILL,
72 IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z,
73};
74
75enum iio_event_type {
76 IIO_EV_TYPE_THRESH,
77 IIO_EV_TYPE_MAG,
78 IIO_EV_TYPE_ROC,
79 IIO_EV_TYPE_THRESH_ADAPTIVE,
80 IIO_EV_TYPE_MAG_ADAPTIVE,
81 IIO_EV_TYPE_CHANGE,
82};
83 14
84enum iio_event_info { 15enum iio_event_info {
85 IIO_EV_INFO_ENABLE, 16 IIO_EV_INFO_ENABLE,
@@ -88,13 +19,6 @@ enum iio_event_info {
88 IIO_EV_INFO_PERIOD, 19 IIO_EV_INFO_PERIOD,
89}; 20};
90 21
91enum iio_event_direction {
92 IIO_EV_DIR_EITHER,
93 IIO_EV_DIR_RISING,
94 IIO_EV_DIR_FALLING,
95 IIO_EV_DIR_NONE,
96};
97
98#define IIO_VAL_INT 1 22#define IIO_VAL_INT 1
99#define IIO_VAL_INT_PLUS_MICRO 2 23#define IIO_VAL_INT_PLUS_MICRO 2
100#define IIO_VAL_INT_PLUS_NANO 3 24#define IIO_VAL_INT_PLUS_NANO 3
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index 46da02410a09..ac48b10c9395 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -11,33 +11,34 @@ struct sk_buff;
11struct netlink_callback; 11struct netlink_callback;
12 12
13struct inet_diag_handler { 13struct inet_diag_handler {
14 void (*dump)(struct sk_buff *skb, 14 void (*dump)(struct sk_buff *skb,
15 struct netlink_callback *cb, 15 struct netlink_callback *cb,
16 struct inet_diag_req_v2 *r, 16 const struct inet_diag_req_v2 *r,
17 struct nlattr *bc); 17 struct nlattr *bc);
18 18
19 int (*dump_one)(struct sk_buff *in_skb, 19 int (*dump_one)(struct sk_buff *in_skb,
20 const struct nlmsghdr *nlh, 20 const struct nlmsghdr *nlh,
21 struct inet_diag_req_v2 *req); 21 const struct inet_diag_req_v2 *req);
22 22
23 void (*idiag_get_info)(struct sock *sk, 23 void (*idiag_get_info)(struct sock *sk,
24 struct inet_diag_msg *r, 24 struct inet_diag_msg *r,
25 void *info); 25 void *info);
26 __u16 idiag_type; 26 __u16 idiag_type;
27}; 27};
28 28
29struct inet_connection_sock; 29struct inet_connection_sock;
30int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, 30int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
31 struct sk_buff *skb, struct inet_diag_req_v2 *req, 31 struct sk_buff *skb, const struct inet_diag_req_v2 *req,
32 struct user_namespace *user_ns, 32 struct user_namespace *user_ns,
33 u32 pid, u32 seq, u16 nlmsg_flags, 33 u32 pid, u32 seq, u16 nlmsg_flags,
34 const struct nlmsghdr *unlh); 34 const struct nlmsghdr *unlh);
35void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb, 35void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
36 struct netlink_callback *cb, struct inet_diag_req_v2 *r, 36 struct netlink_callback *cb,
37 struct nlattr *bc); 37 const struct inet_diag_req_v2 *r,
38 struct nlattr *bc);
38int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, 39int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
39 struct sk_buff *in_skb, const struct nlmsghdr *nlh, 40 struct sk_buff *in_skb, const struct nlmsghdr *nlh,
40 struct inet_diag_req_v2 *req); 41 const struct inet_diag_req_v2 *req);
41 42
42int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk); 43int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
43 44
diff --git a/include/linux/init.h b/include/linux/init.h
index 2df8e8dd10a4..21b6d768edd7 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -253,21 +253,41 @@ struct obs_kernel_param {
253 * obs_kernel_param "array" too far apart in .init.setup. 253 * obs_kernel_param "array" too far apart in .init.setup.
254 */ 254 */
255#define __setup_param(str, unique_id, fn, early) \ 255#define __setup_param(str, unique_id, fn, early) \
256 static const char __setup_str_##unique_id[] __initconst \ 256 static const char __setup_str_##unique_id[] __initconst \
257 __aligned(1) = str; \ 257 __aligned(1) = str; \
258 static struct obs_kernel_param __setup_##unique_id \ 258 static struct obs_kernel_param __setup_##unique_id \
259 __used __section(.init.setup) \ 259 __used __section(.init.setup) \
260 __attribute__((aligned((sizeof(long))))) \ 260 __attribute__((aligned((sizeof(long))))) \
261 = { __setup_str_##unique_id, fn, early } 261 = { __setup_str_##unique_id, fn, early }
262 262
263#define __setup(str, fn) \ 263#define __setup(str, fn) \
264 __setup_param(str, fn, fn, 0) 264 __setup_param(str, fn, fn, 0)
265 265
266/* NOTE: fn is as per module_param, not __setup! Emits warning if fn 266/*
267 * returns non-zero. */ 267 * NOTE: fn is as per module_param, not __setup!
268#define early_param(str, fn) \ 268 * Emits warning if fn returns non-zero.
269 */
270#define early_param(str, fn) \
269 __setup_param(str, fn, fn, 1) 271 __setup_param(str, fn, fn, 1)
270 272
273#define early_param_on_off(str_on, str_off, var, config) \
274 \
275 int var = IS_ENABLED(config); \
276 \
277 static int __init parse_##var##_on(char *arg) \
278 { \
279 var = 1; \
280 return 0; \
281 } \
282 __setup_param(str_on, parse_##var##_on, parse_##var##_on, 1); \
283 \
284 static int __init parse_##var##_off(char *arg) \
285 { \
286 var = 0; \
287 return 0; \
288 } \
289 __setup_param(str_off, parse_##var##_off, parse_##var##_off, 1)
290
271/* Relies on boot_command_line being set */ 291/* Relies on boot_command_line being set */
272void __init parse_early_param(void); 292void __init parse_early_param(void);
273void __init parse_early_options(char *cmdline); 293void __init parse_early_options(char *cmdline);
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index a65208a8fe18..796ef9645827 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -115,10 +115,19 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
115 * Extended Capability Register 115 * Extended Capability Register
116 */ 116 */
117 117
118#define ecap_niotlb_iunits(e) ((((e) >> 24) & 0xff) + 1) 118#define ecap_pss(e) ((e >> 35) & 0x1f)
119#define ecap_eafs(e) ((e >> 34) & 0x1)
120#define ecap_nwfs(e) ((e >> 33) & 0x1)
121#define ecap_srs(e) ((e >> 31) & 0x1)
122#define ecap_ers(e) ((e >> 30) & 0x1)
123#define ecap_prs(e) ((e >> 29) & 0x1)
124#define ecap_pasid(e) ((e >> 28) & 0x1)
125#define ecap_dis(e) ((e >> 27) & 0x1)
126#define ecap_nest(e) ((e >> 26) & 0x1)
127#define ecap_mts(e) ((e >> 25) & 0x1)
128#define ecap_ecs(e) ((e >> 24) & 0x1)
119#define ecap_iotlb_offset(e) ((((e) >> 8) & 0x3ff) * 16) 129#define ecap_iotlb_offset(e) ((((e) >> 8) & 0x3ff) * 16)
120#define ecap_max_iotlb_offset(e) \ 130#define ecap_max_iotlb_offset(e) (ecap_iotlb_offset(e) + 16)
121 (ecap_iotlb_offset(e) + ecap_niotlb_iunits(e) * 16)
122#define ecap_coherent(e) ((e) & 0x1) 131#define ecap_coherent(e) ((e) & 0x1)
123#define ecap_qis(e) ((e) & 0x2) 132#define ecap_qis(e) ((e) & 0x2)
124#define ecap_pass_through(e) ((e >> 6) & 0x1) 133#define ecap_pass_through(e) ((e >> 6) & 0x1)
@@ -180,6 +189,9 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
180#define DMA_GSTS_IRES (((u32)1) << 25) 189#define DMA_GSTS_IRES (((u32)1) << 25)
181#define DMA_GSTS_CFIS (((u32)1) << 23) 190#define DMA_GSTS_CFIS (((u32)1) << 23)
182 191
192/* DMA_RTADDR_REG */
193#define DMA_RTADDR_RTT (((u64)1) << 11)
194
183/* CCMD_REG */ 195/* CCMD_REG */
184#define DMA_CCMD_ICC (((u64)1) << 63) 196#define DMA_CCMD_ICC (((u64)1) << 63)
185#define DMA_CCMD_GLOBAL_INVL (((u64)1) << 61) 197#define DMA_CCMD_GLOBAL_INVL (((u64)1) << 61)
diff --git a/include/linux/intel_mid_dma.h b/include/linux/intel_mid_dma.h
deleted file mode 100644
index 10496bd24c5c..000000000000
--- a/include/linux/intel_mid_dma.h
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * intel_mid_dma.h - Intel MID DMA Drivers
3 *
4 * Copyright (C) 2008-10 Intel Corp
5 * Author: Vinod Koul <vinod.koul@intel.com>
6 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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; version 2 of the License.
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 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20 *
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 *
23 *
24 */
25#ifndef __INTEL_MID_DMA_H__
26#define __INTEL_MID_DMA_H__
27
28#include <linux/dmaengine.h>
29
30#define DMA_PREP_CIRCULAR_LIST (1 << 10)
31
32/*DMA mode configurations*/
33enum intel_mid_dma_mode {
34 LNW_DMA_PER_TO_MEM = 0, /*periphral to memory configuration*/
35 LNW_DMA_MEM_TO_PER, /*memory to periphral configuration*/
36 LNW_DMA_MEM_TO_MEM, /*mem to mem confg (testing only)*/
37};
38
39/*DMA handshaking*/
40enum intel_mid_dma_hs_mode {
41 LNW_DMA_HW_HS = 0, /*HW Handshaking only*/
42 LNW_DMA_SW_HS = 1, /*SW Handshaking not recommended*/
43};
44
45/*Burst size configuration*/
46enum intel_mid_dma_msize {
47 LNW_DMA_MSIZE_1 = 0x0,
48 LNW_DMA_MSIZE_4 = 0x1,
49 LNW_DMA_MSIZE_8 = 0x2,
50 LNW_DMA_MSIZE_16 = 0x3,
51 LNW_DMA_MSIZE_32 = 0x4,
52 LNW_DMA_MSIZE_64 = 0x5,
53};
54
55/**
56 * struct intel_mid_dma_slave - DMA slave structure
57 *
58 * @dirn: DMA trf direction
59 * @src_width: tx register width
60 * @dst_width: rx register width
61 * @hs_mode: HW/SW handshaking mode
62 * @cfg_mode: DMA data transfer mode (per-per/mem-per/mem-mem)
63 * @src_msize: Source DMA burst size
64 * @dst_msize: Dst DMA burst size
65 * @per_addr: Periphral address
66 * @device_instance: DMA peripheral device instance, we can have multiple
67 * peripheral device connected to single DMAC
68 */
69struct intel_mid_dma_slave {
70 enum intel_mid_dma_hs_mode hs_mode; /*handshaking*/
71 enum intel_mid_dma_mode cfg_mode; /*mode configuration*/
72 unsigned int device_instance; /*0, 1 for periphral instance*/
73 struct dma_slave_config dma_slave;
74};
75
76#endif /*__INTEL_MID_DMA_H__*/
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index d9b05b5bf8c7..950ae4501826 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -39,8 +39,6 @@
39 * These flags used only by the kernel as part of the 39 * These flags used only by the kernel as part of the
40 * irq handling routines. 40 * irq handling routines.
41 * 41 *
42 * IRQF_DISABLED - keep irqs disabled when calling the action handler.
43 * DEPRECATED. This flag is a NOOP and scheduled to be removed
44 * IRQF_SHARED - allow sharing the irq among several devices 42 * IRQF_SHARED - allow sharing the irq among several devices
45 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur 43 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur
46 * IRQF_TIMER - Flag to mark this interrupt as timer interrupt 44 * IRQF_TIMER - Flag to mark this interrupt as timer interrupt
@@ -52,13 +50,18 @@
52 * IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished. 50 * IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished.
53 * Used by threaded interrupts which need to keep the 51 * Used by threaded interrupts which need to keep the
54 * irq line disabled until the threaded handler has been run. 52 * irq line disabled until the threaded handler has been run.
55 * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend 53 * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend. Does not guarantee
54 * that this interrupt will wake the system from a suspended
55 * state. See Documentation/power/suspend-and-interrupts.txt
56 * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set 56 * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set
57 * IRQF_NO_THREAD - Interrupt cannot be threaded 57 * IRQF_NO_THREAD - Interrupt cannot be threaded
58 * IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device 58 * IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device
59 * resume time. 59 * resume time.
60 * IRQF_COND_SUSPEND - If the IRQ is shared with a NO_SUSPEND user, execute this
61 * interrupt handler after suspending interrupts. For system
62 * wakeup devices users need to implement wakeup detection in
63 * their interrupt handlers.
60 */ 64 */
61#define IRQF_DISABLED 0x00000020
62#define IRQF_SHARED 0x00000080 65#define IRQF_SHARED 0x00000080
63#define IRQF_PROBE_SHARED 0x00000100 66#define IRQF_PROBE_SHARED 0x00000100
64#define __IRQF_TIMER 0x00000200 67#define __IRQF_TIMER 0x00000200
@@ -70,6 +73,7 @@
70#define IRQF_FORCE_RESUME 0x00008000 73#define IRQF_FORCE_RESUME 0x00008000
71#define IRQF_NO_THREAD 0x00010000 74#define IRQF_NO_THREAD 0x00010000
72#define IRQF_EARLY_RESUME 0x00020000 75#define IRQF_EARLY_RESUME 0x00020000
76#define IRQF_COND_SUSPEND 0x00040000
73 77
74#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD) 78#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD)
75 79
@@ -184,6 +188,7 @@ extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id);
184#endif 188#endif
185 189
186extern void disable_irq_nosync(unsigned int irq); 190extern void disable_irq_nosync(unsigned int irq);
191extern bool disable_hardirq(unsigned int irq);
187extern void disable_irq(unsigned int irq); 192extern void disable_irq(unsigned int irq);
188extern void disable_percpu_irq(unsigned int irq); 193extern void disable_percpu_irq(unsigned int irq);
189extern void enable_irq(unsigned int irq); 194extern void enable_irq(unsigned int irq);
@@ -356,6 +361,20 @@ static inline int disable_irq_wake(unsigned int irq)
356 return irq_set_irq_wake(irq, 0); 361 return irq_set_irq_wake(irq, 0);
357} 362}
358 363
364/*
365 * irq_get_irqchip_state/irq_set_irqchip_state specific flags
366 */
367enum irqchip_irq_state {
368 IRQCHIP_STATE_PENDING, /* Is interrupt pending? */
369 IRQCHIP_STATE_ACTIVE, /* Is interrupt in progress? */
370 IRQCHIP_STATE_MASKED, /* Is interrupt masked? */
371 IRQCHIP_STATE_LINE_LEVEL, /* Is IRQ line high? */
372};
373
374extern int irq_get_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
375 bool *state);
376extern int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
377 bool state);
359 378
360#ifdef CONFIG_IRQ_FORCED_THREADING 379#ifdef CONFIG_IRQ_FORCED_THREADING
361extern bool force_irqthreads; 380extern bool force_irqthreads;
diff --git a/include/linux/io.h b/include/linux/io.h
index fa02e55e5a2e..986f2bffea1e 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -38,6 +38,14 @@ static inline int ioremap_page_range(unsigned long addr, unsigned long end,
38} 38}
39#endif 39#endif
40 40
41#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
42void __init ioremap_huge_init(void);
43int arch_ioremap_pud_supported(void);
44int arch_ioremap_pmd_supported(void);
45#else
46static inline void ioremap_huge_init(void) { }
47#endif
48
41/* 49/*
42 * Managed iomap interface 50 * Managed iomap interface
43 */ 51 */
@@ -64,6 +72,8 @@ void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
64 resource_size_t size); 72 resource_size_t size);
65void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, 73void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
66 resource_size_t size); 74 resource_size_t size);
75void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset,
76 resource_size_t size);
67void devm_iounmap(struct device *dev, void __iomem *addr); 77void devm_iounmap(struct device *dev, void __iomem *addr);
68int check_signature(const volatile void __iomem *io_addr, 78int check_signature(const volatile void __iomem *io_addr,
69 const unsigned char *signature, int length); 79 const unsigned char *signature, int length);
diff --git a/include/linux/iommu-common.h b/include/linux/iommu-common.h
new file mode 100644
index 000000000000..bbced83b32ee
--- /dev/null
+++ b/include/linux/iommu-common.h
@@ -0,0 +1,51 @@
1#ifndef _LINUX_IOMMU_COMMON_H
2#define _LINUX_IOMMU_COMMON_H
3
4#include <linux/spinlock_types.h>
5#include <linux/device.h>
6#include <asm/page.h>
7
8#define IOMMU_POOL_HASHBITS 4
9#define IOMMU_NR_POOLS (1 << IOMMU_POOL_HASHBITS)
10
11struct iommu_pool {
12 unsigned long start;
13 unsigned long end;
14 unsigned long hint;
15 spinlock_t lock;
16};
17
18struct iommu_map_table {
19 unsigned long table_map_base;
20 unsigned long table_shift;
21 unsigned long nr_pools;
22 void (*lazy_flush)(struct iommu_map_table *);
23 unsigned long poolsize;
24 struct iommu_pool pools[IOMMU_NR_POOLS];
25 u32 flags;
26#define IOMMU_HAS_LARGE_POOL 0x00000001
27#define IOMMU_NO_SPAN_BOUND 0x00000002
28#define IOMMU_NEED_FLUSH 0x00000004
29 struct iommu_pool large_pool;
30 unsigned long *map;
31};
32
33extern void iommu_tbl_pool_init(struct iommu_map_table *iommu,
34 unsigned long num_entries,
35 u32 table_shift,
36 void (*lazy_flush)(struct iommu_map_table *),
37 bool large_pool, u32 npools,
38 bool skip_span_boundary_check);
39
40extern unsigned long iommu_tbl_range_alloc(struct device *dev,
41 struct iommu_map_table *iommu,
42 unsigned long npages,
43 unsigned long *handle,
44 unsigned long mask,
45 unsigned int align_order);
46
47extern void iommu_tbl_range_free(struct iommu_map_table *iommu,
48 u64 dma_addr, unsigned long npages,
49 unsigned long entry);
50
51#endif
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 38daa453f2e5..0546b8710ce3 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -51,9 +51,33 @@ struct iommu_domain_geometry {
51 bool force_aperture; /* DMA only allowed in mappable range? */ 51 bool force_aperture; /* DMA only allowed in mappable range? */
52}; 52};
53 53
54/* Domain feature flags */
55#define __IOMMU_DOMAIN_PAGING (1U << 0) /* Support for iommu_map/unmap */
56#define __IOMMU_DOMAIN_DMA_API (1U << 1) /* Domain for use in DMA-API
57 implementation */
58#define __IOMMU_DOMAIN_PT (1U << 2) /* Domain is identity mapped */
59
60/*
61 * This are the possible domain-types
62 *
63 * IOMMU_DOMAIN_BLOCKED - All DMA is blocked, can be used to isolate
64 * devices
65 * IOMMU_DOMAIN_IDENTITY - DMA addresses are system physical addresses
66 * IOMMU_DOMAIN_UNMANAGED - DMA mappings managed by IOMMU-API user, used
67 * for VMs
68 * IOMMU_DOMAIN_DMA - Internally used for DMA-API implementations.
69 * This flag allows IOMMU drivers to implement
70 * certain optimizations for these domains
71 */
72#define IOMMU_DOMAIN_BLOCKED (0U)
73#define IOMMU_DOMAIN_IDENTITY (__IOMMU_DOMAIN_PT)
74#define IOMMU_DOMAIN_UNMANAGED (__IOMMU_DOMAIN_PAGING)
75#define IOMMU_DOMAIN_DMA (__IOMMU_DOMAIN_PAGING | \
76 __IOMMU_DOMAIN_DMA_API)
77
54struct iommu_domain { 78struct iommu_domain {
79 unsigned type;
55 const struct iommu_ops *ops; 80 const struct iommu_ops *ops;
56 void *priv;
57 iommu_fault_handler_t handler; 81 iommu_fault_handler_t handler;
58 void *handler_token; 82 void *handler_token;
59 struct iommu_domain_geometry geometry; 83 struct iommu_domain_geometry geometry;
@@ -113,8 +137,11 @@ enum iommu_attr {
113 */ 137 */
114struct iommu_ops { 138struct iommu_ops {
115 bool (*capable)(enum iommu_cap); 139 bool (*capable)(enum iommu_cap);
116 int (*domain_init)(struct iommu_domain *domain); 140
117 void (*domain_destroy)(struct iommu_domain *domain); 141 /* Domain allocation and freeing by the iommu driver */
142 struct iommu_domain *(*domain_alloc)(unsigned iommu_domain_type);
143 void (*domain_free)(struct iommu_domain *);
144
118 int (*attach_dev)(struct iommu_domain *domain, struct device *dev); 145 int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
119 void (*detach_dev)(struct iommu_domain *domain, struct device *dev); 146 void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
120 int (*map)(struct iommu_domain *domain, unsigned long iova, 147 int (*map)(struct iommu_domain *domain, unsigned long iova,
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 2c5250222278..388e3ae94f7a 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -196,10 +196,8 @@ extern struct resource * __request_region(struct resource *,
196 196
197/* Compatibility cruft */ 197/* Compatibility cruft */
198#define release_region(start,n) __release_region(&ioport_resource, (start), (n)) 198#define release_region(start,n) __release_region(&ioport_resource, (start), (n))
199#define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n))
200#define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n)) 199#define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n))
201 200
202extern int __check_region(struct resource *, resource_size_t, resource_size_t);
203extern void __release_region(struct resource *, resource_size_t, 201extern void __release_region(struct resource *, resource_size_t,
204 resource_size_t); 202 resource_size_t);
205#ifdef CONFIG_MEMORY_HOTREMOVE 203#ifdef CONFIG_MEMORY_HOTREMOVE
@@ -207,12 +205,6 @@ extern int release_mem_region_adjustable(struct resource *, resource_size_t,
207 resource_size_t); 205 resource_size_t);
208#endif 206#endif
209 207
210static inline int __deprecated check_region(resource_size_t s,
211 resource_size_t n)
212{
213 return __check_region(&ioport_resource, s, n);
214}
215
216/* Wrappers for managed devices */ 208/* Wrappers for managed devices */
217struct device; 209struct device;
218 210
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 4d5169f5d7d1..82806c60aa42 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -53,6 +53,10 @@ struct ipv6_devconf {
53 __s32 ndisc_notify; 53 __s32 ndisc_notify;
54 __s32 suppress_frag_ndisc; 54 __s32 suppress_frag_ndisc;
55 __s32 accept_ra_mtu; 55 __s32 accept_ra_mtu;
56 struct ipv6_stable_secret {
57 bool initialized;
58 struct in6_addr secret;
59 } stable_secret;
56 void *sysctl; 60 void *sysctl;
57}; 61};
58 62
diff --git a/include/linux/irq.h b/include/linux/irq.h
index d09ec7a1243e..62c6901cab55 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -30,6 +30,7 @@
30struct seq_file; 30struct seq_file;
31struct module; 31struct module;
32struct msi_msg; 32struct msi_msg;
33enum irqchip_irq_state;
33 34
34/* 35/*
35 * IRQ line status. 36 * IRQ line status.
@@ -324,6 +325,8 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
324 * irq_request_resources 325 * irq_request_resources
325 * @irq_compose_msi_msg: optional to compose message content for MSI 326 * @irq_compose_msi_msg: optional to compose message content for MSI
326 * @irq_write_msi_msg: optional to write message content for MSI 327 * @irq_write_msi_msg: optional to write message content for MSI
328 * @irq_get_irqchip_state: return the internal state of an interrupt
329 * @irq_set_irqchip_state: set the internal state of a interrupt
327 * @flags: chip specific flags 330 * @flags: chip specific flags
328 */ 331 */
329struct irq_chip { 332struct irq_chip {
@@ -363,6 +366,9 @@ struct irq_chip {
363 void (*irq_compose_msi_msg)(struct irq_data *data, struct msi_msg *msg); 366 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); 367 void (*irq_write_msi_msg)(struct irq_data *data, struct msi_msg *msg);
365 368
369 int (*irq_get_irqchip_state)(struct irq_data *data, enum irqchip_irq_state which, bool *state);
370 int (*irq_set_irqchip_state)(struct irq_data *data, enum irqchip_irq_state which, bool state);
371
366 unsigned long flags; 372 unsigned long flags;
367}; 373};
368 374
@@ -460,6 +466,7 @@ extern void irq_chip_eoi_parent(struct irq_data *data);
460extern int irq_chip_set_affinity_parent(struct irq_data *data, 466extern int irq_chip_set_affinity_parent(struct irq_data *data,
461 const struct cpumask *dest, 467 const struct cpumask *dest,
462 bool force); 468 bool force);
469extern int irq_chip_set_wake_parent(struct irq_data *data, unsigned int on);
463#endif 470#endif
464 471
465/* Handling of unhandled and spurious interrupts: */ 472/* Handling of unhandled and spurious interrupts: */
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index bf3fe719c7ce..47b9ebd4a74f 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -38,16 +38,17 @@ bool irq_work_queue(struct irq_work *work);
38bool irq_work_queue_on(struct irq_work *work, int cpu); 38bool irq_work_queue_on(struct irq_work *work, int cpu);
39#endif 39#endif
40 40
41void irq_work_run(void);
42void irq_work_tick(void); 41void irq_work_tick(void);
43void irq_work_sync(struct irq_work *work); 42void irq_work_sync(struct irq_work *work);
44 43
45#ifdef CONFIG_IRQ_WORK 44#ifdef CONFIG_IRQ_WORK
46#include <asm/irq_work.h> 45#include <asm/irq_work.h>
47 46
47void irq_work_run(void);
48bool irq_work_needs_cpu(void); 48bool irq_work_needs_cpu(void);
49#else 49#else
50static inline bool irq_work_needs_cpu(void) { return false; } 50static inline bool irq_work_needs_cpu(void) { return false; }
51static inline void irq_work_run(void) { }
51#endif 52#endif
52 53
53#endif /* _LINUX_IRQ_WORK_H */ 54#endif /* _LINUX_IRQ_WORK_H */
diff --git a/include/linux/irqchip/arm-gic-acpi.h b/include/linux/irqchip/arm-gic-acpi.h
new file mode 100644
index 000000000000..de3419ed3937
--- /dev/null
+++ b/include/linux/irqchip/arm-gic-acpi.h
@@ -0,0 +1,31 @@
1/*
2 * Copyright (C) 2014, Linaro Ltd.
3 * Author: Tomasz Nowicki <tomasz.nowicki@linaro.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef ARM_GIC_ACPI_H_
11#define ARM_GIC_ACPI_H_
12
13#ifdef CONFIG_ACPI
14
15/*
16 * Hard code here, we can not get memory size from MADT (but FDT does),
17 * Actually no need to do that, because this size can be inferred
18 * from GIC spec.
19 */
20#define ACPI_GICV2_DIST_MEM_SIZE (SZ_4K)
21#define ACPI_GIC_CPU_IF_MEM_SIZE (SZ_8K)
22
23struct acpi_table_header;
24
25int gic_v2_acpi_init(struct acpi_table_header *table);
26void acpi_gic_init(void);
27#else
28static inline void acpi_gic_init(void) { }
29#endif
30
31#endif /* ARM_GIC_ACPI_H_ */
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h
index 800544bc7bfd..ffbc034c8810 100644
--- a/include/linux/irqchip/arm-gic-v3.h
+++ b/include/linux/irqchip/arm-gic-v3.h
@@ -126,8 +126,23 @@
126#define GICR_PROPBASER_WaWb (5U << 7) 126#define GICR_PROPBASER_WaWb (5U << 7)
127#define GICR_PROPBASER_RaWaWt (6U << 7) 127#define GICR_PROPBASER_RaWaWt (6U << 7)
128#define GICR_PROPBASER_RaWaWb (7U << 7) 128#define GICR_PROPBASER_RaWaWb (7U << 7)
129#define GICR_PROPBASER_CACHEABILITY_MASK (7U << 7)
129#define GICR_PROPBASER_IDBITS_MASK (0x1f) 130#define GICR_PROPBASER_IDBITS_MASK (0x1f)
130 131
132#define GICR_PENDBASER_NonShareable (0U << 10)
133#define GICR_PENDBASER_InnerShareable (1U << 10)
134#define GICR_PENDBASER_OuterShareable (2U << 10)
135#define GICR_PENDBASER_SHAREABILITY_MASK (3UL << 10)
136#define GICR_PENDBASER_nCnB (0U << 7)
137#define GICR_PENDBASER_nC (1U << 7)
138#define GICR_PENDBASER_RaWt (2U << 7)
139#define GICR_PENDBASER_RaWb (3U << 7)
140#define GICR_PENDBASER_WaWt (4U << 7)
141#define GICR_PENDBASER_WaWb (5U << 7)
142#define GICR_PENDBASER_RaWaWt (6U << 7)
143#define GICR_PENDBASER_RaWaWb (7U << 7)
144#define GICR_PENDBASER_CACHEABILITY_MASK (7U << 7)
145
131/* 146/*
132 * Re-Distributor registers, offsets from SGI_base 147 * Re-Distributor registers, offsets from SGI_base
133 */ 148 */
@@ -166,6 +181,11 @@
166 181
167#define GITS_TRANSLATER 0x10040 182#define GITS_TRANSLATER 0x10040
168 183
184#define GITS_CTLR_ENABLE (1U << 0)
185#define GITS_CTLR_QUIESCENT (1U << 31)
186
187#define GITS_TYPER_DEVBITS_SHIFT 13
188#define GITS_TYPER_DEVBITS(r) ((((r) >> GITS_TYPER_DEVBITS_SHIFT) & 0x1f) + 1)
169#define GITS_TYPER_PTA (1UL << 19) 189#define GITS_TYPER_PTA (1UL << 19)
170 190
171#define GITS_CBASER_VALID (1UL << 63) 191#define GITS_CBASER_VALID (1UL << 63)
@@ -177,6 +197,7 @@
177#define GITS_CBASER_WaWb (5UL << 59) 197#define GITS_CBASER_WaWb (5UL << 59)
178#define GITS_CBASER_RaWaWt (6UL << 59) 198#define GITS_CBASER_RaWaWt (6UL << 59)
179#define GITS_CBASER_RaWaWb (7UL << 59) 199#define GITS_CBASER_RaWaWb (7UL << 59)
200#define GITS_CBASER_CACHEABILITY_MASK (7UL << 59)
180#define GITS_CBASER_NonShareable (0UL << 10) 201#define GITS_CBASER_NonShareable (0UL << 10)
181#define GITS_CBASER_InnerShareable (1UL << 10) 202#define GITS_CBASER_InnerShareable (1UL << 10)
182#define GITS_CBASER_OuterShareable (2UL << 10) 203#define GITS_CBASER_OuterShareable (2UL << 10)
@@ -193,6 +214,7 @@
193#define GITS_BASER_WaWb (5UL << 59) 214#define GITS_BASER_WaWb (5UL << 59)
194#define GITS_BASER_RaWaWt (6UL << 59) 215#define GITS_BASER_RaWaWt (6UL << 59)
195#define GITS_BASER_RaWaWb (7UL << 59) 216#define GITS_BASER_RaWaWb (7UL << 59)
217#define GITS_BASER_CACHEABILITY_MASK (7UL << 59)
196#define GITS_BASER_TYPE_SHIFT (56) 218#define GITS_BASER_TYPE_SHIFT (56)
197#define GITS_BASER_TYPE(r) (((r) >> GITS_BASER_TYPE_SHIFT) & 7) 219#define GITS_BASER_TYPE(r) (((r) >> GITS_BASER_TYPE_SHIFT) & 7)
198#define GITS_BASER_ENTRY_SIZE_SHIFT (48) 220#define GITS_BASER_ENTRY_SIZE_SHIFT (48)
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 71d706d5f169..36ec4ae74634 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -97,6 +97,7 @@ struct device_node;
97 97
98extern struct irq_chip gic_arch_extn; 98extern struct irq_chip gic_arch_extn;
99 99
100void gic_set_irqchip_flags(unsigned long flags);
100void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *, 101void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *,
101 u32 offset, struct device_node *); 102 u32 offset, struct device_node *);
102void gic_cascade_irq(unsigned int gic_nr, unsigned int irq); 103void gic_cascade_irq(unsigned int gic_nr, unsigned int irq);
@@ -115,11 +116,5 @@ int gic_get_cpu_id(unsigned int cpu);
115void gic_migrate_target(unsigned int new_cpu_id); 116void gic_migrate_target(unsigned int new_cpu_id);
116unsigned long gic_get_sgir_physaddr(void); 117unsigned long gic_get_sgir_physaddr(void);
117 118
118extern const struct irq_domain_ops *gic_routable_irq_domain_ops;
119static inline void __init register_routable_domain_ops
120 (const struct irq_domain_ops *ops)
121{
122 gic_routable_irq_domain_ops = ops;
123}
124#endif /* __ASSEMBLY */ 119#endif /* __ASSEMBLY */
125#endif 120#endif
diff --git a/include/linux/irqchip/irq-crossbar.h b/include/linux/irqchip/irq-crossbar.h
deleted file mode 100644
index e5537b81df8d..000000000000
--- a/include/linux/irqchip/irq-crossbar.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/*
2 * drivers/irqchip/irq-crossbar.h
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11int irqcrossbar_init(void);
diff --git a/include/linux/irqchip/mips-gic.h b/include/linux/irqchip/mips-gic.h
index e6a6aac451db..9b1ad3734911 100644
--- a/include/linux/irqchip/mips-gic.h
+++ b/include/linux/irqchip/mips-gic.h
@@ -165,6 +165,8 @@
165#define GIC_VPE_PEND_SWINT0_MSK (MSK(1) << GIC_VPE_PEND_SWINT0_SHF) 165#define GIC_VPE_PEND_SWINT0_MSK (MSK(1) << GIC_VPE_PEND_SWINT0_SHF)
166#define GIC_VPE_PEND_SWINT1_SHF 5 166#define GIC_VPE_PEND_SWINT1_SHF 5
167#define GIC_VPE_PEND_SWINT1_MSK (MSK(1) << GIC_VPE_PEND_SWINT1_SHF) 167#define GIC_VPE_PEND_SWINT1_MSK (MSK(1) << GIC_VPE_PEND_SWINT1_SHF)
168#define GIC_VPE_PEND_FDC_SHF 6
169#define GIC_VPE_PEND_FDC_MSK (MSK(1) << GIC_VPE_PEND_FDC_SHF)
168 170
169/* GIC_VPE_RMASK Masks */ 171/* GIC_VPE_RMASK Masks */
170#define GIC_VPE_RMASK_WD_SHF 0 172#define GIC_VPE_RMASK_WD_SHF 0
@@ -179,6 +181,8 @@
179#define GIC_VPE_RMASK_SWINT0_MSK (MSK(1) << GIC_VPE_RMASK_SWINT0_SHF) 181#define GIC_VPE_RMASK_SWINT0_MSK (MSK(1) << GIC_VPE_RMASK_SWINT0_SHF)
180#define GIC_VPE_RMASK_SWINT1_SHF 5 182#define GIC_VPE_RMASK_SWINT1_SHF 5
181#define GIC_VPE_RMASK_SWINT1_MSK (MSK(1) << GIC_VPE_RMASK_SWINT1_SHF) 183#define GIC_VPE_RMASK_SWINT1_MSK (MSK(1) << GIC_VPE_RMASK_SWINT1_SHF)
184#define GIC_VPE_RMASK_FDC_SHF 6
185#define GIC_VPE_RMASK_FDC_MSK (MSK(1) << GIC_VPE_RMASK_FDC_SHF)
182 186
183/* GIC_VPE_SMASK Masks */ 187/* GIC_VPE_SMASK Masks */
184#define GIC_VPE_SMASK_WD_SHF 0 188#define GIC_VPE_SMASK_WD_SHF 0
@@ -193,6 +197,8 @@
193#define GIC_VPE_SMASK_SWINT0_MSK (MSK(1) << GIC_VPE_SMASK_SWINT0_SHF) 197#define GIC_VPE_SMASK_SWINT0_MSK (MSK(1) << GIC_VPE_SMASK_SWINT0_SHF)
194#define GIC_VPE_SMASK_SWINT1_SHF 5 198#define GIC_VPE_SMASK_SWINT1_SHF 5
195#define GIC_VPE_SMASK_SWINT1_MSK (MSK(1) << GIC_VPE_SMASK_SWINT1_SHF) 199#define GIC_VPE_SMASK_SWINT1_MSK (MSK(1) << GIC_VPE_SMASK_SWINT1_SHF)
200#define GIC_VPE_SMASK_FDC_SHF 6
201#define GIC_VPE_SMASK_FDC_MSK (MSK(1) << GIC_VPE_SMASK_FDC_SHF)
196 202
197/* GIC nomenclature for Core Interrupt Pins. */ 203/* GIC nomenclature for Core Interrupt Pins. */
198#define GIC_CPU_INT0 0 /* Core Interrupt 2 */ 204#define GIC_CPU_INT0 0 /* Core Interrupt 2 */
@@ -240,9 +246,12 @@ extern unsigned int gic_get_count_width(void);
240extern cycle_t gic_read_compare(void); 246extern cycle_t gic_read_compare(void);
241extern void gic_write_compare(cycle_t cnt); 247extern void gic_write_compare(cycle_t cnt);
242extern void gic_write_cpu_compare(cycle_t cnt, int cpu); 248extern void gic_write_cpu_compare(cycle_t cnt, int cpu);
249extern void gic_start_count(void);
250extern void gic_stop_count(void);
243extern void gic_send_ipi(unsigned int intr); 251extern void gic_send_ipi(unsigned int intr);
244extern unsigned int plat_ipi_call_int_xlate(unsigned int); 252extern unsigned int plat_ipi_call_int_xlate(unsigned int);
245extern unsigned int plat_ipi_resched_int_xlate(unsigned int); 253extern unsigned int plat_ipi_resched_int_xlate(unsigned int);
246extern int gic_get_c0_compare_int(void); 254extern int gic_get_c0_compare_int(void);
247extern int gic_get_c0_perfcount_int(void); 255extern int gic_get_c0_perfcount_int(void);
256extern int gic_get_c0_fdc_int(void);
248#endif /* __LINUX_IRQCHIP_MIPS_GIC_H */ 257#endif /* __LINUX_IRQCHIP_MIPS_GIC_H */
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index faf433af425e..dd1109fb241e 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -78,6 +78,7 @@ struct irq_desc {
78#ifdef CONFIG_PM_SLEEP 78#ifdef CONFIG_PM_SLEEP
79 unsigned int nr_actions; 79 unsigned int nr_actions;
80 unsigned int no_suspend_depth; 80 unsigned int no_suspend_depth;
81 unsigned int cond_suspend_depth;
81 unsigned int force_resume_depth; 82 unsigned int force_resume_depth;
82#endif 83#endif
83#ifdef CONFIG_PROC_FS 84#ifdef CONFIG_PROC_FS
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
index d176d658fe25..5dd1272d1ab2 100644
--- a/include/linux/irqflags.h
+++ b/include/linux/irqflags.h
@@ -85,7 +85,7 @@
85 * The local_irq_*() APIs are equal to the raw_local_irq*() 85 * The local_irq_*() APIs are equal to the raw_local_irq*()
86 * if !TRACE_IRQFLAGS. 86 * if !TRACE_IRQFLAGS.
87 */ 87 */
88#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT 88#ifdef CONFIG_TRACE_IRQFLAGS
89#define local_irq_enable() \ 89#define local_irq_enable() \
90 do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0) 90 do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)
91#define local_irq_disable() \ 91#define local_irq_disable() \
@@ -107,22 +107,6 @@
107 raw_local_irq_restore(flags); \ 107 raw_local_irq_restore(flags); \
108 } \ 108 } \
109 } while (0) 109 } while (0)
110#define local_save_flags(flags) \
111 do { \
112 raw_local_save_flags(flags); \
113 } while (0)
114
115#define irqs_disabled_flags(flags) \
116 ({ \
117 raw_irqs_disabled_flags(flags); \
118 })
119
120#define irqs_disabled() \
121 ({ \
122 unsigned long _flags; \
123 raw_local_save_flags(_flags); \
124 raw_irqs_disabled_flags(_flags); \
125 })
126 110
127#define safe_halt() \ 111#define safe_halt() \
128 do { \ 112 do { \
@@ -131,7 +115,7 @@
131 } while (0) 115 } while (0)
132 116
133 117
134#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */ 118#else /* !CONFIG_TRACE_IRQFLAGS */
135 119
136#define local_irq_enable() do { raw_local_irq_enable(); } while (0) 120#define local_irq_enable() do { raw_local_irq_enable(); } while (0)
137#define local_irq_disable() do { raw_local_irq_disable(); } while (0) 121#define local_irq_disable() do { raw_local_irq_disable(); } while (0)
@@ -140,11 +124,28 @@
140 raw_local_irq_save(flags); \ 124 raw_local_irq_save(flags); \
141 } while (0) 125 } while (0)
142#define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0) 126#define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0)
143#define local_save_flags(flags) do { raw_local_save_flags(flags); } while (0)
144#define irqs_disabled() (raw_irqs_disabled())
145#define irqs_disabled_flags(flags) (raw_irqs_disabled_flags(flags))
146#define safe_halt() do { raw_safe_halt(); } while (0) 127#define safe_halt() do { raw_safe_halt(); } while (0)
147 128
129#endif /* CONFIG_TRACE_IRQFLAGS */
130
131#define local_save_flags(flags) raw_local_save_flags(flags)
132
133/*
134 * Some architectures don't define arch_irqs_disabled(), so even if either
135 * definition would be fine we need to use different ones for the time being
136 * to avoid build issues.
137 */
138#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
139#define irqs_disabled() \
140 ({ \
141 unsigned long _flags; \
142 raw_local_save_flags(_flags); \
143 raw_irqs_disabled_flags(_flags); \
144 })
145#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */
146#define irqs_disabled() raw_irqs_disabled()
148#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ 147#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */
149 148
149#define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags)
150
150#endif 151#endif
diff --git a/include/linux/jhash.h b/include/linux/jhash.h
index 47cb09edec1a..348c6f47e4cc 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -145,11 +145,11 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
145} 145}
146 146
147 147
148/* jhash_3words - hash exactly 3, 2 or 1 word(s) */ 148/* __jhash_nwords - hash exactly 3, 2 or 1 word(s) */
149static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval) 149static inline u32 __jhash_nwords(u32 a, u32 b, u32 c, u32 initval)
150{ 150{
151 a += JHASH_INITVAL; 151 a += initval;
152 b += JHASH_INITVAL; 152 b += initval;
153 c += initval; 153 c += initval;
154 154
155 __jhash_final(a, b, c); 155 __jhash_final(a, b, c);
@@ -157,14 +157,19 @@ static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval)
157 return c; 157 return c;
158} 158}
159 159
160static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval)
161{
162 return __jhash_nwords(a, b, c, initval + JHASH_INITVAL + (3 << 2));
163}
164
160static inline u32 jhash_2words(u32 a, u32 b, u32 initval) 165static inline u32 jhash_2words(u32 a, u32 b, u32 initval)
161{ 166{
162 return jhash_3words(a, b, 0, initval); 167 return __jhash_nwords(a, b, 0, initval + JHASH_INITVAL + (2 << 2));
163} 168}
164 169
165static inline u32 jhash_1word(u32 a, u32 initval) 170static inline u32 jhash_1word(u32 a, u32 initval)
166{ 171{
167 return jhash_3words(a, 0, 0, initval); 172 return __jhash_nwords(a, 0, 0, initval + JHASH_INITVAL + (1 << 2));
168} 173}
169 174
170#endif /* _LINUX_JHASH_H */ 175#endif /* _LINUX_JHASH_H */
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 98f923b6a0ea..f4de473f226b 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -45,6 +45,12 @@
45 * same as using STATIC_KEY_INIT_FALSE. 45 * same as using STATIC_KEY_INIT_FALSE.
46 */ 46 */
47 47
48#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
49# define HAVE_JUMP_LABEL
50#endif
51
52#ifndef __ASSEMBLY__
53
48#include <linux/types.h> 54#include <linux/types.h>
49#include <linux/compiler.h> 55#include <linux/compiler.h>
50#include <linux/bug.h> 56#include <linux/bug.h>
@@ -55,7 +61,7 @@ extern bool static_key_initialized;
55 "%s used before call to jump_label_init", \ 61 "%s used before call to jump_label_init", \
56 __func__) 62 __func__)
57 63
58#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) 64#ifdef HAVE_JUMP_LABEL
59 65
60struct static_key { 66struct static_key {
61 atomic_t enabled; 67 atomic_t enabled;
@@ -66,13 +72,18 @@ struct static_key {
66#endif 72#endif
67}; 73};
68 74
69# include <asm/jump_label.h>
70# define HAVE_JUMP_LABEL
71#else 75#else
72struct static_key { 76struct static_key {
73 atomic_t enabled; 77 atomic_t enabled;
74}; 78};
75#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */ 79#endif /* HAVE_JUMP_LABEL */
80#endif /* __ASSEMBLY__ */
81
82#ifdef HAVE_JUMP_LABEL
83#include <asm/jump_label.h>
84#endif
85
86#ifndef __ASSEMBLY__
76 87
77enum jump_label_type { 88enum jump_label_type {
78 JUMP_LABEL_DISABLE = 0, 89 JUMP_LABEL_DISABLE = 0,
@@ -203,3 +214,5 @@ static inline bool static_key_enabled(struct static_key *key)
203} 214}
204 215
205#endif /* _LINUX_JUMP_LABEL_H */ 216#endif /* _LINUX_JUMP_LABEL_H */
217
218#endif /* __ASSEMBLY__ */
diff --git a/include/linux/jz4780-nemc.h b/include/linux/jz4780-nemc.h
new file mode 100644
index 000000000000..e7f1cc7a2284
--- /dev/null
+++ b/include/linux/jz4780-nemc.h
@@ -0,0 +1,43 @@
1/*
2 * JZ4780 NAND/external memory controller (NEMC)
3 *
4 * Copyright (c) 2015 Imagination Technologies
5 * Author: Alex Smith <alex@alex-smith.me.uk>
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
13#ifndef __LINUX_JZ4780_NEMC_H__
14#define __LINUX_JZ4780_NEMC_H__
15
16#include <linux/types.h>
17
18struct device;
19
20/*
21 * Number of NEMC banks. Note that there are actually 6, but they are numbered
22 * from 1.
23 */
24#define JZ4780_NEMC_NUM_BANKS 7
25
26/**
27 * enum jz4780_nemc_bank_type - device types which can be connected to a bank
28 * @JZ4780_NEMC_BANK_SRAM: SRAM
29 * @JZ4780_NEMC_BANK_NAND: NAND
30 */
31enum jz4780_nemc_bank_type {
32 JZ4780_NEMC_BANK_SRAM,
33 JZ4780_NEMC_BANK_NAND,
34};
35
36extern unsigned int jz4780_nemc_num_banks(struct device *dev);
37
38extern void jz4780_nemc_set_type(struct device *dev, unsigned int bank,
39 enum jz4780_nemc_bank_type type);
40extern void jz4780_nemc_assert(struct device *dev, unsigned int bank,
41 bool assert);
42
43#endif /* __LINUX_JZ4780_NEMC_H__ */
diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index 72ba725ddf9c..5486d777b706 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -5,6 +5,7 @@
5 5
6struct kmem_cache; 6struct kmem_cache;
7struct page; 7struct page;
8struct vm_struct;
8 9
9#ifdef CONFIG_KASAN 10#ifdef CONFIG_KASAN
10 11
@@ -43,21 +44,18 @@ void kasan_poison_object_data(struct kmem_cache *cache, void *object);
43 44
44void kasan_kmalloc_large(const void *ptr, size_t size); 45void kasan_kmalloc_large(const void *ptr, size_t size);
45void kasan_kfree_large(const void *ptr); 46void kasan_kfree_large(const void *ptr);
47void kasan_kfree(void *ptr);
46void kasan_kmalloc(struct kmem_cache *s, const void *object, size_t size); 48void kasan_kmalloc(struct kmem_cache *s, const void *object, size_t size);
47void kasan_krealloc(const void *object, size_t new_size); 49void kasan_krealloc(const void *object, size_t new_size);
48 50
49void kasan_slab_alloc(struct kmem_cache *s, void *object); 51void kasan_slab_alloc(struct kmem_cache *s, void *object);
50void kasan_slab_free(struct kmem_cache *s, void *object); 52void kasan_slab_free(struct kmem_cache *s, void *object);
51 53
52#define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT)
53
54int kasan_module_alloc(void *addr, size_t size); 54int kasan_module_alloc(void *addr, size_t size);
55void kasan_module_free(void *addr); 55void kasan_free_shadow(const struct vm_struct *vm);
56 56
57#else /* CONFIG_KASAN */ 57#else /* CONFIG_KASAN */
58 58
59#define MODULE_ALIGN 1
60
61static inline void kasan_unpoison_shadow(const void *address, size_t size) {} 59static inline void kasan_unpoison_shadow(const void *address, size_t size) {}
62 60
63static inline void kasan_enable_current(void) {} 61static inline void kasan_enable_current(void) {}
@@ -74,6 +72,7 @@ static inline void kasan_poison_object_data(struct kmem_cache *cache,
74 72
75static inline void kasan_kmalloc_large(void *ptr, size_t size) {} 73static inline void kasan_kmalloc_large(void *ptr, size_t size) {}
76static inline void kasan_kfree_large(const void *ptr) {} 74static inline void kasan_kfree_large(const void *ptr) {}
75static inline void kasan_kfree(void *ptr) {}
77static inline void kasan_kmalloc(struct kmem_cache *s, const void *object, 76static inline void kasan_kmalloc(struct kmem_cache *s, const void *object,
78 size_t size) {} 77 size_t size) {}
79static inline void kasan_krealloc(const void *object, size_t new_size) {} 78static inline void kasan_krealloc(const void *object, size_t new_size) {}
@@ -82,7 +81,7 @@ static inline void kasan_slab_alloc(struct kmem_cache *s, void *object) {}
82static inline void kasan_slab_free(struct kmem_cache *s, void *object) {} 81static inline void kasan_slab_free(struct kmem_cache *s, void *object) {}
83 82
84static inline int kasan_module_alloc(void *addr, size_t size) { return 0; } 83static inline int kasan_module_alloc(void *addr, size_t size) { return 0; }
85static inline void kasan_module_free(void *addr) {} 84static inline void kasan_free_shadow(const struct vm_struct *vm) {}
86 85
87#endif /* CONFIG_KASAN */ 86#endif /* CONFIG_KASAN */
88 87
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
index be342b94c640..b33c7797eb57 100644
--- a/include/linux/kconfig.h
+++ b/include/linux/kconfig.h
@@ -23,14 +23,6 @@
23#define ___config_enabled(__ignored, val, ...) val 23#define ___config_enabled(__ignored, val, ...) val
24 24
25/* 25/*
26 * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',
27 * 0 otherwise.
28 *
29 */
30#define IS_ENABLED(option) \
31 (config_enabled(option) || config_enabled(option##_MODULE))
32
33/*
34 * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0 26 * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0
35 * otherwise. For boolean options, this is equivalent to 27 * otherwise. For boolean options, this is equivalent to
36 * IS_ENABLED(CONFIG_FOO). 28 * IS_ENABLED(CONFIG_FOO).
@@ -43,4 +35,20 @@
43 */ 35 */
44#define IS_MODULE(option) config_enabled(option##_MODULE) 36#define IS_MODULE(option) config_enabled(option##_MODULE)
45 37
38/*
39 * IS_REACHABLE(CONFIG_FOO) evaluates to 1 if the currently compiled
40 * code can call a function defined in code compiled based on CONFIG_FOO.
41 * This is similar to IS_ENABLED(), but returns false when invoked from
42 * built-in code when CONFIG_FOO is set to 'm'.
43 */
44#define IS_REACHABLE(option) (config_enabled(option) || \
45 (config_enabled(option##_MODULE) && config_enabled(MODULE)))
46
47/*
48 * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',
49 * 0 otherwise.
50 */
51#define IS_ENABLED(option) \
52 (IS_BUILTIN(option) || IS_MODULE(option))
53
46#endif /* __LINUX_KCONFIG_H */ 54#endif /* __LINUX_KCONFIG_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d6d630d31ef3..3a5b48e52a9e 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -103,6 +103,18 @@
103 (((__x) - ((__d) / 2)) / (__d)); \ 103 (((__x) - ((__d) / 2)) / (__d)); \
104} \ 104} \
105) 105)
106/*
107 * Same as above but for u64 dividends. divisor must be a 32-bit
108 * number.
109 */
110#define DIV_ROUND_CLOSEST_ULL(x, divisor)( \
111{ \
112 typeof(divisor) __d = divisor; \
113 unsigned long long _tmp = (x) + (__d) / 2; \
114 do_div(_tmp, __d); \
115 _tmp; \
116} \
117)
106 118
107/* 119/*
108 * Multiplies an integer by a fraction, while avoiding unnecessary 120 * Multiplies an integer by a fraction, while avoiding unnecessary
diff --git a/include/linux/ksm.h b/include/linux/ksm.h
index 3be6bb18562d..7ae216a39c9e 100644
--- a/include/linux/ksm.h
+++ b/include/linux/ksm.h
@@ -35,18 +35,6 @@ static inline void ksm_exit(struct mm_struct *mm)
35 __ksm_exit(mm); 35 __ksm_exit(mm);
36} 36}
37 37
38/*
39 * A KSM page is one of those write-protected "shared pages" or "merged pages"
40 * which KSM maps into multiple mms, wherever identical anonymous page content
41 * is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to any
42 * anon_vma, but to that page's node of the stable tree.
43 */
44static inline int PageKsm(struct page *page)
45{
46 return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==
47 (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
48}
49
50static inline struct stable_node *page_stable_node(struct page *page) 38static inline struct stable_node *page_stable_node(struct page *page)
51{ 39{
52 return PageKsm(page) ? page_rmapping(page) : NULL; 40 return PageKsm(page) ? page_rmapping(page) : NULL;
@@ -87,11 +75,6 @@ static inline void ksm_exit(struct mm_struct *mm)
87{ 75{
88} 76}
89 77
90static inline int PageKsm(struct page *page)
91{
92 return 0;
93}
94
95#ifdef CONFIG_MMU 78#ifdef CONFIG_MMU
96static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start, 79static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
97 unsigned long end, int advice, unsigned long *vm_flags) 80 unsigned long end, int advice, unsigned long *vm_flags)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index d12b2104d19b..ad45054309a0 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -165,12 +165,12 @@ enum kvm_bus {
165 KVM_NR_BUSES 165 KVM_NR_BUSES
166}; 166};
167 167
168int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, 168int kvm_io_bus_write(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr,
169 int len, const void *val); 169 int len, const void *val);
170int kvm_io_bus_write_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, 170int kvm_io_bus_write_cookie(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx,
171 int len, const void *val, long cookie); 171 gpa_t addr, int len, const void *val, long cookie);
172int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len, 172int kvm_io_bus_read(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr,
173 void *val); 173 int len, void *val);
174int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, 174int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
175 int len, struct kvm_io_device *dev); 175 int len, struct kvm_io_device *dev);
176int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, 176int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
@@ -658,7 +658,6 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
658int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu); 658int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu);
659 659
660void *kvm_kvzalloc(unsigned long size); 660void *kvm_kvzalloc(unsigned long size);
661void kvm_kvfree(const void *addr);
662 661
663#ifndef __KVM_HAVE_ARCH_VM_ALLOC 662#ifndef __KVM_HAVE_ARCH_VM_ALLOC
664static inline struct kvm *kvm_arch_alloc_vm(void) 663static inline struct kvm *kvm_arch_alloc_vm(void)
@@ -700,6 +699,20 @@ static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu)
700#endif 699#endif
701} 700}
702 701
702#ifdef __KVM_HAVE_ARCH_INTC_INITIALIZED
703/*
704 * returns true if the virtual interrupt controller is initialized and
705 * ready to accept virtual IRQ. On some architectures the virtual interrupt
706 * controller is dynamically instantiated and this is not always true.
707 */
708bool kvm_arch_intc_initialized(struct kvm *kvm);
709#else
710static inline bool kvm_arch_intc_initialized(struct kvm *kvm)
711{
712 return true;
713}
714#endif
715
703int kvm_arch_init_vm(struct kvm *kvm, unsigned long type); 716int kvm_arch_init_vm(struct kvm *kvm, unsigned long type);
704void kvm_arch_destroy_vm(struct kvm *kvm); 717void kvm_arch_destroy_vm(struct kvm *kvm);
705void kvm_arch_sync_events(struct kvm *kvm); 718void kvm_arch_sync_events(struct kvm *kvm);
@@ -766,7 +779,8 @@ static inline void kvm_guest_enter(void)
766 * one time slice). Lets treat guest mode as quiescent state, just like 779 * one time slice). Lets treat guest mode as quiescent state, just like
767 * we do with user-mode execution. 780 * we do with user-mode execution.
768 */ 781 */
769 rcu_virt_note_context_switch(smp_processor_id()); 782 if (!context_tracking_cpu_is_enabled())
783 rcu_virt_note_context_switch(smp_processor_id());
770} 784}
771 785
772static inline void kvm_guest_exit(void) 786static inline void kvm_guest_exit(void)
@@ -969,11 +983,16 @@ static inline int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
969#endif /* CONFIG_HAVE_KVM_EVENTFD */ 983#endif /* CONFIG_HAVE_KVM_EVENTFD */
970 984
971#ifdef CONFIG_KVM_APIC_ARCHITECTURE 985#ifdef CONFIG_KVM_APIC_ARCHITECTURE
972static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu) 986static inline bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
973{ 987{
974 return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id; 988 return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id;
975} 989}
976 990
991static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
992{
993 return (vcpu->arch.apic_base & MSR_IA32_APICBASE_BSP) != 0;
994}
995
977bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu); 996bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu);
978 997
979#else 998#else
diff --git a/include/linux/lcm.h b/include/linux/lcm.h
index 7bf01d779b45..1ce79a7f1daa 100644
--- a/include/linux/lcm.h
+++ b/include/linux/lcm.h
@@ -4,5 +4,6 @@
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5 5
6unsigned long lcm(unsigned long a, unsigned long b) __attribute_const__; 6unsigned long lcm(unsigned long a, unsigned long b) __attribute_const__;
7unsigned long lcm_not_zero(unsigned long a, unsigned long b) __attribute_const__;
7 8
8#endif /* _LCM_H */ 9#endif /* _LCM_H */
diff --git a/include/linux/led-class-flash.h b/include/linux/led-class-flash.h
index 5ba2facd7a51..e97966d1fb8d 100644
--- a/include/linux/led-class-flash.h
+++ b/include/linux/led-class-flash.h
@@ -13,7 +13,6 @@
13#define __LINUX_FLASH_LEDS_H_INCLUDED 13#define __LINUX_FLASH_LEDS_H_INCLUDED
14 14
15#include <linux/leds.h> 15#include <linux/leds.h>
16#include <uapi/linux/v4l2-controls.h>
17 16
18struct device_node; 17struct device_node;
19struct led_classdev_flash; 18struct led_classdev_flash;
@@ -33,7 +32,7 @@ struct led_classdev_flash;
33#define LED_FAULT_LED_OVER_TEMPERATURE (1 << 8) 32#define LED_FAULT_LED_OVER_TEMPERATURE (1 << 8)
34#define LED_NUM_FLASH_FAULTS 9 33#define LED_NUM_FLASH_FAULTS 9
35 34
36#define LED_FLASH_MAX_SYSFS_GROUPS 7 35#define LED_FLASH_SYSFS_GROUPS_SIZE 5
37 36
38struct led_flash_ops { 37struct led_flash_ops {
39 /* set flash brightness */ 38 /* set flash brightness */
@@ -81,21 +80,7 @@ struct led_classdev_flash {
81 struct led_flash_setting timeout; 80 struct led_flash_setting timeout;
82 81
83 /* LED Flash class sysfs groups */ 82 /* LED Flash class sysfs groups */
84 const struct attribute_group *sysfs_groups[LED_FLASH_MAX_SYSFS_GROUPS]; 83 const struct attribute_group *sysfs_groups[LED_FLASH_SYSFS_GROUPS_SIZE];
85
86 /* LEDs available for flash strobe synchronization */
87 struct led_classdev_flash **sync_leds;
88
89 /* Number of LEDs available for flash strobe synchronization */
90 int num_sync_leds;
91
92 /*
93 * The identifier of the sub-led to synchronize the flash strobe with.
94 * Identifiers start from 1, which reflects the first element from the
95 * sync_leds array. 0 means that the flash strobe should not be
96 * synchronized.
97 */
98 u32 sync_led_id;
99}; 84};
100 85
101static inline struct led_classdev_flash *lcdev_to_flcdev( 86static inline struct led_classdev_flash *lcdev_to_flcdev(
diff --git a/include/linux/leds.h b/include/linux/leds.h
index f70f84f35674..9a2b000094cf 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -47,7 +47,6 @@ struct led_classdev {
47#define SET_BRIGHTNESS_ASYNC (1 << 21) 47#define SET_BRIGHTNESS_ASYNC (1 << 21)
48#define SET_BRIGHTNESS_SYNC (1 << 22) 48#define SET_BRIGHTNESS_SYNC (1 << 22)
49#define LED_DEV_CAP_FLASH (1 << 23) 49#define LED_DEV_CAP_FLASH (1 << 23)
50#define LED_DEV_CAP_SYNC_STROBE (1 << 24)
51 50
52 /* Set LED brightness level */ 51 /* Set LED brightness level */
53 /* Must not sleep, use a workqueue if needed */ 52 /* Must not sleep, use a workqueue if needed */
@@ -105,7 +104,11 @@ struct led_classdev {
105 104
106extern int led_classdev_register(struct device *parent, 105extern int led_classdev_register(struct device *parent,
107 struct led_classdev *led_cdev); 106 struct led_classdev *led_cdev);
107extern int devm_led_classdev_register(struct device *parent,
108 struct led_classdev *led_cdev);
108extern void led_classdev_unregister(struct led_classdev *led_cdev); 109extern void led_classdev_unregister(struct led_classdev *led_cdev);
110extern void devm_led_classdev_unregister(struct device *parent,
111 struct led_classdev *led_cdev);
109extern void led_classdev_suspend(struct led_classdev *led_cdev); 112extern void led_classdev_suspend(struct led_classdev *led_cdev);
110extern void led_classdev_resume(struct led_classdev *led_cdev); 113extern void led_classdev_resume(struct led_classdev *led_cdev);
111 114
diff --git a/include/linux/lguest.h b/include/linux/lguest.h
index 9962c6bb1311..6db19f35f7c5 100644
--- a/include/linux/lguest.h
+++ b/include/linux/lguest.h
@@ -61,8 +61,8 @@ struct lguest_data {
61 u32 tsc_khz; 61 u32 tsc_khz;
62 62
63/* Fields initialized by the Guest at boot: */ 63/* Fields initialized by the Guest at boot: */
64 /* Instruction range to suppress interrupts even if enabled */ 64 /* Instruction to suppress interrupts even if enabled */
65 unsigned long noirq_start, noirq_end; 65 unsigned long noirq_iret;
66 /* Address above which page tables are all identical. */ 66 /* Address above which page tables are all identical. */
67 unsigned long kernel_address; 67 unsigned long kernel_address;
68 /* The vector to try to use for system calls (0x40 or 0x80). */ 68 /* The vector to try to use for system calls (0x40 or 0x80). */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index fc03efa64ffe..8dad4a307bb8 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -231,7 +231,7 @@ enum {
231 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity 231 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
232 * led */ 232 * led */
233 ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */ 233 ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */
234 ATA_FLAG_LOWTAG = (1 << 24), /* host wants lowest available tag */ 234 ATA_FLAG_SAS_HOST = (1 << 24), /* SAS host */
235 235
236 /* bits 24:31 of ap->flags are reserved for LLD specific flags */ 236 /* bits 24:31 of ap->flags are reserved for LLD specific flags */
237 237
diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
index 95023fd8b00d..ee6dbb39a809 100644
--- a/include/linux/livepatch.h
+++ b/include/linux/livepatch.h
@@ -123,10 +123,10 @@ struct klp_patch {
123 enum klp_state state; 123 enum klp_state state;
124}; 124};
125 125
126extern int klp_register_patch(struct klp_patch *); 126int klp_register_patch(struct klp_patch *);
127extern int klp_unregister_patch(struct klp_patch *); 127int klp_unregister_patch(struct klp_patch *);
128extern int klp_enable_patch(struct klp_patch *); 128int klp_enable_patch(struct klp_patch *);
129extern int klp_disable_patch(struct klp_patch *); 129int klp_disable_patch(struct klp_patch *);
130 130
131#endif /* CONFIG_LIVEPATCH */ 131#endif /* CONFIG_LIVEPATCH */
132 132
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 74ab23176e9b..066ba4157541 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -531,8 +531,13 @@ do { \
531# define might_lock_read(lock) do { } while (0) 531# define might_lock_read(lock) do { } while (0)
532#endif 532#endif
533 533
534#ifdef CONFIG_PROVE_RCU 534#ifdef CONFIG_LOCKDEP
535void lockdep_rcu_suspicious(const char *file, const int line, const char *s); 535void lockdep_rcu_suspicious(const char *file, const int line, const char *s);
536#else
537static inline void
538lockdep_rcu_suspicious(const char *file, const int line, const char *s)
539{
540}
536#endif 541#endif
537 542
538#endif /* __LINUX_LOCKDEP_H */ 543#endif /* __LINUX_LOCKDEP_H */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index e8cc45307f8f..9497ec7c77ea 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -365,6 +365,14 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
365#define __initdata_memblock 365#define __initdata_memblock
366#endif 366#endif
367 367
368#ifdef CONFIG_MEMTEST
369extern void early_memtest(phys_addr_t start, phys_addr_t end);
370#else
371static inline void early_memtest(phys_addr_t start, phys_addr_t end)
372{
373}
374#endif
375
368#else 376#else
369static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align) 377static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align)
370{ 378{
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 8f1a41951df9..6ffa0ac7f7d6 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -192,6 +192,9 @@ extern void get_page_bootmem(unsigned long ingo, struct page *page,
192void get_online_mems(void); 192void get_online_mems(void);
193void put_online_mems(void); 193void put_online_mems(void);
194 194
195void mem_hotplug_begin(void);
196void mem_hotplug_done(void);
197
195#else /* ! CONFIG_MEMORY_HOTPLUG */ 198#else /* ! CONFIG_MEMORY_HOTPLUG */
196/* 199/*
197 * Stub functions for when hotplug is off 200 * Stub functions for when hotplug is off
@@ -231,6 +234,9 @@ static inline int try_online_node(int nid)
231static inline void get_online_mems(void) {} 234static inline void get_online_mems(void) {}
232static inline void put_online_mems(void) {} 235static inline void put_online_mems(void) {}
233 236
237static inline void mem_hotplug_begin(void) {}
238static inline void mem_hotplug_done(void) {}
239
234#endif /* ! CONFIG_MEMORY_HOTPLUG */ 240#endif /* ! CONFIG_MEMORY_HOTPLUG */
235 241
236#ifdef CONFIG_MEMORY_HOTREMOVE 242#ifdef CONFIG_MEMORY_HOTREMOVE
diff --git a/include/linux/mempool.h b/include/linux/mempool.h
index 39ed62ab5b8a..69b6951e8fd2 100644
--- a/include/linux/mempool.h
+++ b/include/linux/mempool.h
@@ -29,14 +29,15 @@ extern mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn,
29 mempool_free_t *free_fn, void *pool_data, 29 mempool_free_t *free_fn, void *pool_data,
30 gfp_t gfp_mask, int nid); 30 gfp_t gfp_mask, int nid);
31 31
32extern int mempool_resize(mempool_t *pool, int new_min_nr, gfp_t gfp_mask); 32extern int mempool_resize(mempool_t *pool, int new_min_nr);
33extern void mempool_destroy(mempool_t *pool); 33extern void mempool_destroy(mempool_t *pool);
34extern void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask); 34extern void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask);
35extern void mempool_free(void *element, mempool_t *pool); 35extern void mempool_free(void *element, mempool_t *pool);
36 36
37/* 37/*
38 * A mempool_alloc_t and mempool_free_t that get the memory from 38 * A mempool_alloc_t and mempool_free_t that get the memory from
39 * a slab that is passed in through pool_data. 39 * a slab cache that is passed in through pool_data.
40 * Note: the slab cache may not have a ctor function.
40 */ 41 */
41void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data); 42void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data);
42void mempool_free_slab(void *element, void *pool_data); 43void mempool_free_slab(void *element, void *pool_data);
diff --git a/include/linux/mfd/abx500/ux500_chargalg.h b/include/linux/mfd/abx500/ux500_chargalg.h
index 234c99143bf7..67703f23e7ba 100644
--- a/include/linux/mfd/abx500/ux500_chargalg.h
+++ b/include/linux/mfd/abx500/ux500_chargalg.h
@@ -9,8 +9,13 @@
9 9
10#include <linux/power_supply.h> 10#include <linux/power_supply.h>
11 11
12#define psy_to_ux500_charger(x) container_of((x), \ 12/*
13 struct ux500_charger, psy) 13 * Valid only for supplies of type:
14 * - POWER_SUPPLY_TYPE_MAINS,
15 * - POWER_SUPPLY_TYPE_USB,
16 * because only them store as drv_data pointer to struct ux500_charger.
17 */
18#define psy_to_ux500_charger(x) power_supply_get_drvdata(psy)
14 19
15/* Forward declaration */ 20/* Forward declaration */
16struct ux500_charger; 21struct ux500_charger;
@@ -35,7 +40,7 @@ struct ux500_charger_ops {
35 * @power_path USB power path support 40 * @power_path USB power path support
36 */ 41 */
37struct ux500_charger { 42struct ux500_charger {
38 struct power_supply psy; 43 struct power_supply *psy;
39 struct ux500_charger_ops ops; 44 struct ux500_charger_ops ops;
40 int max_out_volt; 45 int max_out_volt;
41 int max_out_curr; 46 int max_out_curr;
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index 910e3aa1e965..16a498f48169 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -24,6 +24,7 @@ enum arizona_type {
24 WM5102 = 1, 24 WM5102 = 1,
25 WM5110 = 2, 25 WM5110 = 2,
26 WM8997 = 3, 26 WM8997 = 3,
27 WM8280 = 4,
27}; 28};
28 29
29#define ARIZONA_IRQ_GP1 0 30#define ARIZONA_IRQ_GP1 0
@@ -126,7 +127,7 @@ struct arizona {
126 struct regmap_irq_chip_data *aod_irq_chip; 127 struct regmap_irq_chip_data *aod_irq_chip;
127 struct regmap_irq_chip_data *irq_chip; 128 struct regmap_irq_chip_data *irq_chip;
128 129
129 bool hpdet_magic; 130 bool hpdet_clamp;
130 unsigned int hp_ena; 131 unsigned int hp_ena;
131 132
132 struct mutex clk_lock; 133 struct mutex clk_lock;
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 4578c72c9b86..1789cb0f4f17 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -11,31 +11,26 @@
11#ifndef _ARIZONA_PDATA_H 11#ifndef _ARIZONA_PDATA_H
12#define _ARIZONA_PDATA_H 12#define _ARIZONA_PDATA_H
13 13
14#define ARIZONA_GPN_DIR 0x8000 /* GPN_DIR */ 14#include <dt-bindings/mfd/arizona.h>
15
15#define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */ 16#define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */
16#define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */ 17#define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */
17#define ARIZONA_GPN_DIR_WIDTH 1 /* GPN_DIR */ 18#define ARIZONA_GPN_DIR_WIDTH 1 /* GPN_DIR */
18#define ARIZONA_GPN_PU 0x4000 /* GPN_PU */
19#define ARIZONA_GPN_PU_MASK 0x4000 /* GPN_PU */ 19#define ARIZONA_GPN_PU_MASK 0x4000 /* GPN_PU */
20#define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */ 20#define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */
21#define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */ 21#define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */
22#define ARIZONA_GPN_PD 0x2000 /* GPN_PD */
23#define ARIZONA_GPN_PD_MASK 0x2000 /* GPN_PD */ 22#define ARIZONA_GPN_PD_MASK 0x2000 /* GPN_PD */
24#define ARIZONA_GPN_PD_SHIFT 13 /* GPN_PD */ 23#define ARIZONA_GPN_PD_SHIFT 13 /* GPN_PD */
25#define ARIZONA_GPN_PD_WIDTH 1 /* GPN_PD */ 24#define ARIZONA_GPN_PD_WIDTH 1 /* GPN_PD */
26#define ARIZONA_GPN_LVL 0x0800 /* GPN_LVL */
27#define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */ 25#define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */
28#define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */ 26#define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */
29#define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */ 27#define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */
30#define ARIZONA_GPN_POL 0x0400 /* GPN_POL */
31#define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */ 28#define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */
32#define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */ 29#define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */
33#define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */ 30#define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */
34#define ARIZONA_GPN_OP_CFG 0x0200 /* GPN_OP_CFG */
35#define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */ 31#define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */
36#define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */ 32#define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */
37#define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */ 33#define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */
38#define ARIZONA_GPN_DB 0x0100 /* GPN_DB */
39#define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */ 34#define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */
40#define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */ 35#define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */
41#define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */ 36#define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */
@@ -45,23 +40,10 @@
45 40
46#define ARIZONA_MAX_GPIO 5 41#define ARIZONA_MAX_GPIO 5
47 42
48#define ARIZONA_32KZ_MCLK1 1
49#define ARIZONA_32KZ_MCLK2 2
50#define ARIZONA_32KZ_NONE 3
51
52#define ARIZONA_MAX_INPUT 4 43#define ARIZONA_MAX_INPUT 4
53 44
54#define ARIZONA_DMIC_MICVDD 0
55#define ARIZONA_DMIC_MICBIAS1 1
56#define ARIZONA_DMIC_MICBIAS2 2
57#define ARIZONA_DMIC_MICBIAS3 3
58
59#define ARIZONA_MAX_MICBIAS 3 45#define ARIZONA_MAX_MICBIAS 3
60 46
61#define ARIZONA_INMODE_DIFF 0
62#define ARIZONA_INMODE_SE 1
63#define ARIZONA_INMODE_DMIC 2
64
65#define ARIZONA_MAX_OUTPUT 6 47#define ARIZONA_MAX_OUTPUT 6
66 48
67#define ARIZONA_MAX_AIF 3 49#define ARIZONA_MAX_AIF 3
@@ -112,7 +94,7 @@ struct arizona_pdata {
112 int gpio_base; 94 int gpio_base;
113 95
114 /** Pin state for GPIO pins */ 96 /** Pin state for GPIO pins */
115 int gpio_defaults[ARIZONA_MAX_GPIO]; 97 unsigned int gpio_defaults[ARIZONA_MAX_GPIO];
116 98
117 /** 99 /**
118 * Maximum number of channels clocks will be generated for, 100 * Maximum number of channels clocks will be generated for,
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 0e166b92f5b4..324a34683971 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -16,6 +16,7 @@
16#ifndef __LINUX_MFD_CROS_EC_H 16#ifndef __LINUX_MFD_CROS_EC_H
17#define __LINUX_MFD_CROS_EC_H 17#define __LINUX_MFD_CROS_EC_H
18 18
19#include <linux/cdev.h>
19#include <linux/notifier.h> 20#include <linux/notifier.h>
20#include <linux/mfd/cros_ec_commands.h> 21#include <linux/mfd/cros_ec_commands.h>
21#include <linux/mutex.h> 22#include <linux/mutex.h>
@@ -38,20 +39,20 @@ enum {
38/* 39/*
39 * @version: Command version number (often 0) 40 * @version: Command version number (often 0)
40 * @command: Command to send (EC_CMD_...) 41 * @command: Command to send (EC_CMD_...)
41 * @outdata: Outgoing data to EC
42 * @outsize: Outgoing length in bytes 42 * @outsize: Outgoing length in bytes
43 * @indata: Where to put the incoming data from EC
44 * @insize: Max number of bytes to accept from EC 43 * @insize: Max number of bytes to accept from EC
45 * @result: EC's response to the command (separate from communication failure) 44 * @result: EC's response to the command (separate from communication failure)
45 * @outdata: Outgoing data to EC
46 * @indata: Where to put the incoming data from EC
46 */ 47 */
47struct cros_ec_command { 48struct cros_ec_command {
48 uint32_t version; 49 uint32_t version;
49 uint32_t command; 50 uint32_t command;
50 uint8_t *outdata;
51 uint32_t outsize; 51 uint32_t outsize;
52 uint8_t *indata;
53 uint32_t insize; 52 uint32_t insize;
54 uint32_t result; 53 uint32_t result;
54 uint8_t outdata[EC_PROTO2_MAX_PARAM_SIZE];
55 uint8_t indata[EC_PROTO2_MAX_PARAM_SIZE];
55}; 56};
56 57
57/** 58/**
@@ -59,9 +60,17 @@ struct cros_ec_command {
59 * 60 *
60 * @ec_name: name of EC device (e.g. 'chromeos-ec') 61 * @ec_name: name of EC device (e.g. 'chromeos-ec')
61 * @phys_name: name of physical comms layer (e.g. 'i2c-4') 62 * @phys_name: name of physical comms layer (e.g. 'i2c-4')
62 * @dev: Device pointer 63 * @dev: Device pointer for physical comms device
64 * @vdev: Device pointer for virtual comms device
65 * @cdev: Character device structure for virtual comms device
63 * @was_wake_device: true if this device was set to wake the system from 66 * @was_wake_device: true if this device was set to wake the system from
64 * sleep at the last suspend 67 * sleep at the last suspend
68 * @cmd_readmem: direct read of the EC memory-mapped region, if supported
69 * @offset is within EC_LPC_ADDR_MEMMAP region.
70 * @bytes: number of bytes to read. zero means "read a string" (including
71 * the trailing '\0'). At most only EC_MEMMAP_SIZE bytes can be read.
72 * Caller must ensure that the buffer is large enough for the result when
73 * reading a string.
65 * 74 *
66 * @priv: Private data 75 * @priv: Private data
67 * @irq: Interrupt to use 76 * @irq: Interrupt to use
@@ -90,8 +99,12 @@ struct cros_ec_device {
90 const char *ec_name; 99 const char *ec_name;
91 const char *phys_name; 100 const char *phys_name;
92 struct device *dev; 101 struct device *dev;
102 struct device *vdev;
103 struct cdev cdev;
93 bool was_wake_device; 104 bool was_wake_device;
94 struct class *cros_class; 105 struct class *cros_class;
106 int (*cmd_readmem)(struct cros_ec_device *ec, unsigned int offset,
107 unsigned int bytes, void *dest);
95 108
96 /* These are used to implement the platform-specific interface */ 109 /* These are used to implement the platform-specific interface */
97 void *priv; 110 void *priv;
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 955dd990beaf..51633ea6f910 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -87,6 +87,7 @@ enum max77693_pmic_reg {
87/* MAX77693 ITORCH register */ 87/* MAX77693 ITORCH register */
88#define TORCH_IOUT1_SHIFT 0 88#define TORCH_IOUT1_SHIFT 0
89#define TORCH_IOUT2_SHIFT 4 89#define TORCH_IOUT2_SHIFT 4
90#define TORCH_IOUT_MASK(x) (0xf << (x))
90#define TORCH_IOUT_MIN 15625 91#define TORCH_IOUT_MIN 15625
91#define TORCH_IOUT_MAX 250000 92#define TORCH_IOUT_MAX 250000
92#define TORCH_IOUT_STEP 15625 93#define TORCH_IOUT_STEP 15625
@@ -113,8 +114,8 @@ enum max77693_pmic_reg {
113#define FLASH_EN_FLASH 0x1 114#define FLASH_EN_FLASH 0x1
114#define FLASH_EN_TORCH 0x2 115#define FLASH_EN_TORCH 0x2
115#define FLASH_EN_ON 0x3 116#define FLASH_EN_ON 0x3
116#define FLASH_EN_SHIFT(x) (6 - ((x) - 1) * 2) 117#define FLASH_EN_SHIFT(x) (6 - (x) * 2)
117#define TORCH_EN_SHIFT(x) (2 - ((x) - 1) * 2) 118#define TORCH_EN_SHIFT(x) (2 - (x) * 2)
118 119
119/* MAX77693 MAX_FLASH1 register */ 120/* MAX77693 MAX_FLASH1 register */
120#define MAX_FLASH1_MAX_FL_EN 0x80 121#define MAX_FLASH1_MAX_FL_EN 0x80
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index f0b6585cd874..d450f687301b 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -30,7 +30,7 @@
30#ifndef __LINUX_MFD_MAX77693_H 30#ifndef __LINUX_MFD_MAX77693_H
31#define __LINUX_MFD_MAX77693_H 31#define __LINUX_MFD_MAX77693_H
32 32
33/* MAX77686 regulator IDs */ 33/* MAX77693 regulator IDs */
34enum max77693_regulators { 34enum max77693_regulators {
35 MAX77693_ESAFEOUT1 = 0, 35 MAX77693_ESAFEOUT1 = 0,
36 MAX77693_ESAFEOUT2, 36 MAX77693_ESAFEOUT2,
@@ -38,12 +38,6 @@ enum max77693_regulators {
38 MAX77693_REG_MAX, 38 MAX77693_REG_MAX,
39}; 39};
40 40
41struct max77693_regulator_data {
42 int id;
43 struct regulator_init_data *initdata;
44 struct device_node *of_node;
45};
46
47struct max77693_reg_data { 41struct max77693_reg_data {
48 u8 addr; 42 u8 addr;
49 u8 data; 43 u8 data;
@@ -87,26 +81,9 @@ enum max77693_led_boost_mode {
87 MAX77693_LED_BOOST_FIXED, 81 MAX77693_LED_BOOST_FIXED,
88}; 82};
89 83
90struct max77693_led_platform_data {
91 u32 fleds[2];
92 u32 iout_torch[2];
93 u32 iout_flash[2];
94 u32 trigger[2];
95 u32 trigger_type[2];
96 u32 num_leds;
97 u32 boost_mode;
98 u32 flash_timeout;
99 u32 boost_vout;
100 u32 low_vsys;
101};
102
103/* MAX77693 */ 84/* MAX77693 */
104 85
105struct max77693_platform_data { 86struct max77693_platform_data {
106 /* regulator data */
107 struct max77693_regulator_data *regulators;
108 int num_regulators;
109
110 /* muic data */ 87 /* muic data */
111 struct max77693_muic_platform_data *muic_data; 88 struct max77693_muic_platform_data *muic_data;
112 struct max77693_led_platform_data *led_data; 89 struct max77693_led_platform_data *led_data;
diff --git a/include/linux/mfd/max77843-private.h b/include/linux/mfd/max77843-private.h
new file mode 100644
index 000000000000..7178ace8379e
--- /dev/null
+++ b/include/linux/mfd/max77843-private.h
@@ -0,0 +1,454 @@
1/*
2 * Common variables for the Maxim MAX77843 driver
3 *
4 * Copyright (C) 2015 Samsung Electronics
5 * Author: Jaewon Kim <jaewon02.kim@samsung.com>
6 * Author: Beomho Seo <beomho.seo@samsung.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 __MAX77843_PRIVATE_H_
15#define __MAX77843_PRIVATE_H_
16
17#include <linux/i2c.h>
18#include <linux/regmap.h>
19
20#define I2C_ADDR_TOPSYS (0xCC >> 1)
21#define I2C_ADDR_CHG (0xD2 >> 1)
22#define I2C_ADDR_FG (0x6C >> 1)
23#define I2C_ADDR_MUIC (0x4A >> 1)
24
25/* Topsys, Haptic and LED registers */
26enum max77843_sys_reg {
27 MAX77843_SYS_REG_PMICID = 0x00,
28 MAX77843_SYS_REG_PMICREV = 0x01,
29 MAX77843_SYS_REG_MAINCTRL1 = 0x02,
30 MAX77843_SYS_REG_INTSRC = 0x22,
31 MAX77843_SYS_REG_INTSRCMASK = 0x23,
32 MAX77843_SYS_REG_SYSINTSRC = 0x24,
33 MAX77843_SYS_REG_SYSINTMASK = 0x26,
34 MAX77843_SYS_REG_TOPSYS_STAT = 0x28,
35 MAX77843_SYS_REG_SAFEOUTCTRL = 0xC6,
36
37 MAX77843_SYS_REG_END,
38};
39
40enum max77843_haptic_reg {
41 MAX77843_HAP_REG_MCONFIG = 0x10,
42
43 MAX77843_HAP_REG_END,
44};
45
46enum max77843_led_reg {
47 MAX77843_LED_REG_LEDEN = 0x30,
48 MAX77843_LED_REG_LED0BRT = 0x31,
49 MAX77843_LED_REG_LED1BRT = 0x32,
50 MAX77843_LED_REG_LED2BRT = 0x33,
51 MAX77843_LED_REG_LED3BRT = 0x34,
52 MAX77843_LED_REG_LEDBLNK = 0x38,
53 MAX77843_LED_REG_LEDRAMP = 0x36,
54
55 MAX77843_LED_REG_END,
56};
57
58/* Charger registers */
59enum max77843_charger_reg {
60 MAX77843_CHG_REG_CHG_INT = 0xB0,
61 MAX77843_CHG_REG_CHG_INT_MASK = 0xB1,
62 MAX77843_CHG_REG_CHG_INT_OK = 0xB2,
63 MAX77843_CHG_REG_CHG_DTLS_00 = 0xB3,
64 MAX77843_CHG_REG_CHG_DTLS_01 = 0xB4,
65 MAX77843_CHG_REG_CHG_DTLS_02 = 0xB5,
66 MAX77843_CHG_REG_CHG_CNFG_00 = 0xB7,
67 MAX77843_CHG_REG_CHG_CNFG_01 = 0xB8,
68 MAX77843_CHG_REG_CHG_CNFG_02 = 0xB9,
69 MAX77843_CHG_REG_CHG_CNFG_03 = 0xBA,
70 MAX77843_CHG_REG_CHG_CNFG_04 = 0xBB,
71 MAX77843_CHG_REG_CHG_CNFG_06 = 0xBD,
72 MAX77843_CHG_REG_CHG_CNFG_07 = 0xBE,
73 MAX77843_CHG_REG_CHG_CNFG_09 = 0xC0,
74 MAX77843_CHG_REG_CHG_CNFG_10 = 0xC1,
75 MAX77843_CHG_REG_CHG_CNFG_11 = 0xC2,
76 MAX77843_CHG_REG_CHG_CNFG_12 = 0xC3,
77
78 MAX77843_CHG_REG_END,
79};
80
81/* Fuel gauge registers */
82enum max77843_fuelgauge {
83 MAX77843_FG_REG_STATUS = 0x00,
84 MAX77843_FG_REG_VALRT_TH = 0x01,
85 MAX77843_FG_REG_TALRT_TH = 0x02,
86 MAX77843_FG_REG_SALRT_TH = 0x03,
87 MAX77843_FG_RATE_AT_RATE = 0x04,
88 MAX77843_FG_REG_REMCAP_REP = 0x05,
89 MAX77843_FG_REG_SOCREP = 0x06,
90 MAX77843_FG_REG_AGE = 0x07,
91 MAX77843_FG_REG_TEMP = 0x08,
92 MAX77843_FG_REG_VCELL = 0x09,
93 MAX77843_FG_REG_CURRENT = 0x0A,
94 MAX77843_FG_REG_AVG_CURRENT = 0x0B,
95 MAX77843_FG_REG_SOCMIX = 0x0D,
96 MAX77843_FG_REG_SOCAV = 0x0E,
97 MAX77843_FG_REG_REMCAP_MIX = 0x0F,
98 MAX77843_FG_REG_FULLCAP = 0x10,
99 MAX77843_FG_REG_AVG_TEMP = 0x16,
100 MAX77843_FG_REG_CYCLES = 0x17,
101 MAX77843_FG_REG_AVG_VCELL = 0x19,
102 MAX77843_FG_REG_CONFIG = 0x1D,
103 MAX77843_FG_REG_REMCAP_AV = 0x1F,
104 MAX77843_FG_REG_FULLCAP_NOM = 0x23,
105 MAX77843_FG_REG_MISCCFG = 0x2B,
106 MAX77843_FG_REG_RCOMP = 0x38,
107 MAX77843_FG_REG_FSTAT = 0x3D,
108 MAX77843_FG_REG_DQACC = 0x45,
109 MAX77843_FG_REG_DPACC = 0x46,
110 MAX77843_FG_REG_OCV = 0xEE,
111 MAX77843_FG_REG_VFOCV = 0xFB,
112 MAX77843_FG_SOCVF = 0xFF,
113
114 MAX77843_FG_END,
115};
116
117/* MUIC registers */
118enum max77843_muic_reg {
119 MAX77843_MUIC_REG_ID = 0x00,
120 MAX77843_MUIC_REG_INT1 = 0x01,
121 MAX77843_MUIC_REG_INT2 = 0x02,
122 MAX77843_MUIC_REG_INT3 = 0x03,
123 MAX77843_MUIC_REG_STATUS1 = 0x04,
124 MAX77843_MUIC_REG_STATUS2 = 0x05,
125 MAX77843_MUIC_REG_STATUS3 = 0x06,
126 MAX77843_MUIC_REG_INTMASK1 = 0x07,
127 MAX77843_MUIC_REG_INTMASK2 = 0x08,
128 MAX77843_MUIC_REG_INTMASK3 = 0x09,
129 MAX77843_MUIC_REG_CDETCTRL1 = 0x0A,
130 MAX77843_MUIC_REG_CDETCTRL2 = 0x0B,
131 MAX77843_MUIC_REG_CONTROL1 = 0x0C,
132 MAX77843_MUIC_REG_CONTROL2 = 0x0D,
133 MAX77843_MUIC_REG_CONTROL3 = 0x0E,
134 MAX77843_MUIC_REG_CONTROL4 = 0x16,
135 MAX77843_MUIC_REG_HVCONTROL1 = 0x17,
136 MAX77843_MUIC_REG_HVCONTROL2 = 0x18,
137
138 MAX77843_MUIC_REG_END,
139};
140
141enum max77843_irq {
142 /* Topsys: SYSTEM */
143 MAX77843_SYS_IRQ_SYSINTSRC_SYSUVLO_INT,
144 MAX77843_SYS_IRQ_SYSINTSRC_SYSOVLO_INT,
145 MAX77843_SYS_IRQ_SYSINTSRC_TSHDN_INT,
146 MAX77843_SYS_IRQ_SYSINTSRC_TM_INT,
147
148 /* Charger: CHG_INT */
149 MAX77843_CHG_IRQ_CHG_INT_BYP_I,
150 MAX77843_CHG_IRQ_CHG_INT_BATP_I,
151 MAX77843_CHG_IRQ_CHG_INT_BAT_I,
152 MAX77843_CHG_IRQ_CHG_INT_CHG_I,
153 MAX77843_CHG_IRQ_CHG_INT_WCIN_I,
154 MAX77843_CHG_IRQ_CHG_INT_CHGIN_I,
155 MAX77843_CHG_IRQ_CHG_INT_AICL_I,
156
157 MAX77843_IRQ_NUM,
158};
159
160enum max77843_irq_muic {
161 /* MUIC: INT1 */
162 MAX77843_MUIC_IRQ_INT1_ADC,
163 MAX77843_MUIC_IRQ_INT1_ADCERROR,
164 MAX77843_MUIC_IRQ_INT1_ADC1K,
165
166 /* MUIC: INT2 */
167 MAX77843_MUIC_IRQ_INT2_CHGTYP,
168 MAX77843_MUIC_IRQ_INT2_CHGDETRUN,
169 MAX77843_MUIC_IRQ_INT2_DCDTMR,
170 MAX77843_MUIC_IRQ_INT2_DXOVP,
171 MAX77843_MUIC_IRQ_INT2_VBVOLT,
172
173 /* MUIC: INT3 */
174 MAX77843_MUIC_IRQ_INT3_VBADC,
175 MAX77843_MUIC_IRQ_INT3_VDNMON,
176 MAX77843_MUIC_IRQ_INT3_DNRES,
177 MAX77843_MUIC_IRQ_INT3_MPNACK,
178 MAX77843_MUIC_IRQ_INT3_MRXBUFOW,
179 MAX77843_MUIC_IRQ_INT3_MRXTRF,
180 MAX77843_MUIC_IRQ_INT3_MRXPERR,
181 MAX77843_MUIC_IRQ_INT3_MRXRDY,
182
183 MAX77843_MUIC_IRQ_NUM,
184};
185
186/* MAX77843 interrupts */
187#define MAX77843_SYS_IRQ_SYSUVLO_INT BIT(0)
188#define MAX77843_SYS_IRQ_SYSOVLO_INT BIT(1)
189#define MAX77843_SYS_IRQ_TSHDN_INT BIT(2)
190#define MAX77843_SYS_IRQ_TM_INT BIT(3)
191
192/* MAX77843 MAINCTRL1 register */
193#define MAINCTRL1_BIASEN_SHIFT 7
194#define MAX77843_MAINCTRL1_BIASEN_MASK BIT(MAINCTRL1_BIASEN_SHIFT)
195
196/* MAX77843 MCONFIG register */
197#define MCONFIG_MODE_SHIFT 7
198#define MCONFIG_MEN_SHIFT 6
199#define MCONFIG_PDIV_SHIFT 0
200
201#define MAX77843_MCONFIG_MODE_MASK BIT(MCONFIG_MODE_SHIFT)
202#define MAX77843_MCONFIG_MEN_MASK BIT(MCONFIG_MEN_SHIFT)
203#define MAX77843_MCONFIG_PDIV_MASK (0x3 << MCONFIG_PDIV_SHIFT)
204
205/* Max77843 charger insterrupts */
206#define MAX77843_CHG_BYP_I BIT(0)
207#define MAX77843_CHG_BATP_I BIT(2)
208#define MAX77843_CHG_BAT_I BIT(3)
209#define MAX77843_CHG_CHG_I BIT(4)
210#define MAX77843_CHG_WCIN_I BIT(5)
211#define MAX77843_CHG_CHGIN_I BIT(6)
212#define MAX77843_CHG_AICL_I BIT(7)
213
214/* MAX77843 CHG_INT_OK register */
215#define MAX77843_CHG_BYP_OK BIT(0)
216#define MAX77843_CHG_BATP_OK BIT(2)
217#define MAX77843_CHG_BAT_OK BIT(3)
218#define MAX77843_CHG_CHG_OK BIT(4)
219#define MAX77843_CHG_WCIN_OK BIT(5)
220#define MAX77843_CHG_CHGIN_OK BIT(6)
221#define MAX77843_CHG_AICL_OK BIT(7)
222
223/* MAX77843 CHG_DETAILS_00 register */
224#define MAX77843_CHG_BAT_DTLS BIT(0)
225
226/* MAX77843 CHG_DETAILS_01 register */
227#define MAX77843_CHG_DTLS_MASK 0x0f
228#define MAX77843_CHG_PQ_MODE 0x00
229#define MAX77843_CHG_CC_MODE 0x01
230#define MAX77843_CHG_CV_MODE 0x02
231#define MAX77843_CHG_TO_MODE 0x03
232#define MAX77843_CHG_DO_MODE 0x04
233#define MAX77843_CHG_HT_MODE 0x05
234#define MAX77843_CHG_TF_MODE 0x06
235#define MAX77843_CHG_TS_MODE 0x07
236#define MAX77843_CHG_OFF_MODE 0x08
237
238#define MAX77843_CHG_BAT_DTLS_MASK 0xf0
239#define MAX77843_CHG_NO_BAT (0x00 << 4)
240#define MAX77843_CHG_LOW_VOLT_BAT (0x01 << 4)
241#define MAX77843_CHG_LONG_BAT_TIME (0x02 << 4)
242#define MAX77843_CHG_OK_BAT (0x03 << 4)
243#define MAX77843_CHG_OK_LOW_VOLT_BAT (0x04 << 4)
244#define MAX77843_CHG_OVER_VOLT_BAT (0x05 << 4)
245#define MAX77843_CHG_OVER_CURRENT_BAT (0x06 << 4)
246
247/* MAX77843 CHG_CNFG_00 register */
248#define MAX77843_CHG_DISABLE 0x00
249#define MAX77843_CHG_ENABLE 0x05
250#define MAX77843_CHG_MASK 0x01
251#define MAX77843_CHG_BUCK_MASK 0x04
252
253/* MAX77843 CHG_CNFG_01 register */
254#define MAX77843_CHG_RESTART_THRESHOLD_100 0x00
255#define MAX77843_CHG_RESTART_THRESHOLD_150 0x10
256#define MAX77843_CHG_RESTART_THRESHOLD_200 0x20
257#define MAX77843_CHG_RESTART_THRESHOLD_DISABLE 0x30
258
259/* MAX77843 CHG_CNFG_02 register */
260#define MAX77843_CHG_FAST_CHG_CURRENT_MIN 100000
261#define MAX77843_CHG_FAST_CHG_CURRENT_MAX 3150000
262#define MAX77843_CHG_FAST_CHG_CURRENT_STEP 50000
263#define MAX77843_CHG_FAST_CHG_CURRENT_MASK 0x3f
264#define MAX77843_CHG_OTG_ILIMIT_500 (0x00 << 6)
265#define MAX77843_CHG_OTG_ILIMIT_900 (0x01 << 6)
266#define MAX77843_CHG_OTG_ILIMIT_1200 (0x02 << 6)
267#define MAX77843_CHG_OTG_ILIMIT_1500 (0x03 << 6)
268#define MAX77843_CHG_OTG_ILIMIT_MASK 0xc0
269
270/* MAX77843 CHG_CNFG_03 register */
271#define MAX77843_CHG_TOP_OFF_CURRENT_MIN 125000
272#define MAX77843_CHG_TOP_OFF_CURRENT_MAX 650000
273#define MAX77843_CHG_TOP_OFF_CURRENT_STEP 75000
274#define MAX77843_CHG_TOP_OFF_CURRENT_MASK 0x07
275
276/* MAX77843 CHG_CNFG_06 register */
277#define MAX77843_CHG_WRITE_CAP_BLOCK 0x10
278#define MAX77843_CHG_WRITE_CAP_UNBLOCK 0x0C
279
280/* MAX77843_CHG_CNFG_09_register */
281#define MAX77843_CHG_INPUT_CURRENT_LIMIT_MIN 100000
282#define MAX77843_CHG_INPUT_CURRENT_LIMIT_MAX 4000000
283#define MAX77843_CHG_INPUT_CURRENT_LIMIT_REF 3367000
284#define MAX77843_CHG_INPUT_CURRENT_LIMIT_STEP 33000
285
286#define MAX77843_MUIC_ADC BIT(0)
287#define MAX77843_MUIC_ADCERROR BIT(2)
288#define MAX77843_MUIC_ADC1K BIT(3)
289
290#define MAX77843_MUIC_CHGTYP BIT(0)
291#define MAX77843_MUIC_CHGDETRUN BIT(1)
292#define MAX77843_MUIC_DCDTMR BIT(2)
293#define MAX77843_MUIC_DXOVP BIT(3)
294#define MAX77843_MUIC_VBVOLT BIT(4)
295
296#define MAX77843_MUIC_VBADC BIT(0)
297#define MAX77843_MUIC_VDNMON BIT(1)
298#define MAX77843_MUIC_DNRES BIT(2)
299#define MAX77843_MUIC_MPNACK BIT(3)
300#define MAX77843_MUIC_MRXBUFOW BIT(4)
301#define MAX77843_MUIC_MRXTRF BIT(5)
302#define MAX77843_MUIC_MRXPERR BIT(6)
303#define MAX77843_MUIC_MRXRDY BIT(7)
304
305/* MAX77843 INTSRCMASK register */
306#define MAX77843_INTSRCMASK_CHGR 0
307#define MAX77843_INTSRCMASK_SYS 1
308#define MAX77843_INTSRCMASK_FG 2
309#define MAX77843_INTSRCMASK_MUIC 3
310
311#define MAX77843_INTSRCMASK_CHGR_MASK BIT(MAX77843_INTSRCMASK_CHGR)
312#define MAX77843_INTSRCMASK_SYS_MASK BIT(MAX77843_INTSRCMASK_SYS)
313#define MAX77843_INTSRCMASK_FG_MASK BIT(MAX77843_INTSRCMASK_FG)
314#define MAX77843_INTSRCMASK_MUIC_MASK BIT(MAX77843_INTSRCMASK_MUIC)
315
316#define MAX77843_INTSRC_MASK_MASK \
317 (MAX77843_INTSRCMASK_MUIC_MASK | MAX77843_INTSRCMASK_FG_MASK | \
318 MAX77843_INTSRCMASK_SYS_MASK | MAX77843_INTSRCMASK_CHGR_MASK)
319
320/* MAX77843 STATUS register*/
321#define STATUS1_ADC_SHIFT 0
322#define STATUS1_ADCERROR_SHIFT 6
323#define STATUS1_ADC1K_SHIFT 7
324#define STATUS2_CHGTYP_SHIFT 0
325#define STATUS2_CHGDETRUN_SHIFT 3
326#define STATUS2_DCDTMR_SHIFT 4
327#define STATUS2_DXOVP_SHIFT 5
328#define STATUS2_VBVOLT_SHIFT 6
329#define STATUS3_VBADC_SHIFT 0
330#define STATUS3_VDNMON_SHIFT 4
331#define STATUS3_DNRES_SHIFT 5
332#define STATUS3_MPNACK_SHIFT 6
333
334#define MAX77843_MUIC_STATUS1_ADC_MASK (0x1f << STATUS1_ADC_SHIFT)
335#define MAX77843_MUIC_STATUS1_ADCERROR_MASK BIT(STATUS1_ADCERROR_SHIFT)
336#define MAX77843_MUIC_STATUS1_ADC1K_MASK BIT(STATUS1_ADC1K_SHIFT)
337#define MAX77843_MUIC_STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT)
338#define MAX77843_MUIC_STATUS2_CHGDETRUN_MASK BIT(STATUS2_CHGDETRUN_SHIFT)
339#define MAX77843_MUIC_STATUS2_DCDTMR_MASK BIT(STATUS2_DCDTMR_SHIFT)
340#define MAX77843_MUIC_STATUS2_DXOVP_MASK BIT(STATUS2_DXOVP_SHIFT)
341#define MAX77843_MUIC_STATUS2_VBVOLT_MASK BIT(STATUS2_VBVOLT_SHIFT)
342#define MAX77843_MUIC_STATUS3_VBADC_MASK (0xf << STATUS3_VBADC_SHIFT)
343#define MAX77843_MUIC_STATUS3_VDNMON_MASK BIT(STATUS3_VDNMON_SHIFT)
344#define MAX77843_MUIC_STATUS3_DNRES_MASK BIT(STATUS3_DNRES_SHIFT)
345#define MAX77843_MUIC_STATUS3_MPNACK_MASK BIT(STATUS3_MPNACK_SHIFT)
346
347/* MAX77843 CONTROL register */
348#define CONTROL1_COMP1SW_SHIFT 0
349#define CONTROL1_COMP2SW_SHIFT 3
350#define CONTROL1_IDBEN_SHIFT 7
351#define CONTROL2_LOWPWR_SHIFT 0
352#define CONTROL2_ADCEN_SHIFT 1
353#define CONTROL2_CPEN_SHIFT 2
354#define CONTROL2_ACC_DET_SHIFT 5
355#define CONTROL2_USBCPINT_SHIFT 6
356#define CONTROL2_RCPS_SHIFT 7
357#define CONTROL3_JIGSET_SHIFT 0
358#define CONTROL4_ADCDBSET_SHIFT 0
359#define CONTROL4_USBAUTO_SHIFT 4
360#define CONTROL4_FCTAUTO_SHIFT 5
361#define CONTROL4_ADCMODE_SHIFT 6
362
363#define MAX77843_MUIC_CONTROL1_COMP1SW_MASK (0x7 << CONTROL1_COMP1SW_SHIFT)
364#define MAX77843_MUIC_CONTROL1_COMP2SW_MASK (0x7 << CONTROL1_COMP2SW_SHIFT)
365#define MAX77843_MUIC_CONTROL1_IDBEN_MASK BIT(CONTROL1_IDBEN_SHIFT)
366#define MAX77843_MUIC_CONTROL2_LOWPWR_MASK BIT(CONTROL2_LOWPWR_SHIFT)
367#define MAX77843_MUIC_CONTROL2_ADCEN_MASK BIT(CONTROL2_ADCEN_SHIFT)
368#define MAX77843_MUIC_CONTROL2_CPEN_MASK BIT(CONTROL2_CPEN_SHIFT)
369#define MAX77843_MUIC_CONTROL2_ACC_DET_MASK BIT(CONTROL2_ACC_DET_SHIFT)
370#define MAX77843_MUIC_CONTROL2_USBCPINT_MASK BIT(CONTROL2_USBCPINT_SHIFT)
371#define MAX77843_MUIC_CONTROL2_RCPS_MASK BIT(CONTROL2_RCPS_SHIFT)
372#define MAX77843_MUIC_CONTROL3_JIGSET_MASK (0x3 << CONTROL3_JIGSET_SHIFT)
373#define MAX77843_MUIC_CONTROL4_ADCDBSET_MASK (0x3 << CONTROL4_ADCDBSET_SHIFT)
374#define MAX77843_MUIC_CONTROL4_USBAUTO_MASK BIT(CONTROL4_USBAUTO_SHIFT)
375#define MAX77843_MUIC_CONTROL4_FCTAUTO_MASK BIT(CONTROL4_FCTAUTO_SHIFT)
376#define MAX77843_MUIC_CONTROL4_ADCMODE_MASK (0x3 << CONTROL4_ADCMODE_SHIFT)
377
378/* MAX77843 switch port */
379#define COM_OPEN 0
380#define COM_USB 1
381#define COM_AUDIO 2
382#define COM_UART 3
383#define COM_AUX_USB 4
384#define COM_AUX_UART 5
385
386#define CONTROL1_COM_SW \
387 ((MAX77843_MUIC_CONTROL1_COMP1SW_MASK | \
388 MAX77843_MUIC_CONTROL1_COMP2SW_MASK))
389
390#define CONTROL1_SW_OPEN \
391 ((COM_OPEN << CONTROL1_COMP1SW_SHIFT | \
392 COM_OPEN << CONTROL1_COMP2SW_SHIFT))
393#define CONTROL1_SW_USB \
394 ((COM_USB << CONTROL1_COMP1SW_SHIFT | \
395 COM_USB << CONTROL1_COMP2SW_SHIFT))
396#define CONTROL1_SW_AUDIO \
397 ((COM_AUDIO << CONTROL1_COMP1SW_SHIFT | \
398 COM_AUDIO << CONTROL1_COMP2SW_SHIFT))
399#define CONTROL1_SW_UART \
400 ((COM_UART << CONTROL1_COMP1SW_SHIFT | \
401 COM_UART << CONTROL1_COMP2SW_SHIFT))
402#define CONTROL1_SW_AUX_USB \
403 ((COM_AUX_USB << CONTROL1_COMP1SW_SHIFT | \
404 COM_AUX_USB << CONTROL1_COMP2SW_SHIFT))
405#define CONTROL1_SW_AUX_UART \
406 ((COM_AUX_UART << CONTROL1_COMP1SW_SHIFT | \
407 COM_AUX_UART << CONTROL1_COMP2SW_SHIFT))
408
409#define MAX77843_DISABLE 0
410#define MAX77843_ENABLE 1
411
412#define CONTROL4_AUTO_DISABLE \
413 ((MAX77843_DISABLE << CONTROL4_USBAUTO_SHIFT) | \
414 (MAX77843_DISABLE << CONTROL4_FCTAUTO_SHIFT))
415#define CONTROL4_AUTO_ENABLE \
416 ((MAX77843_ENABLE << CONTROL4_USBAUTO_SHIFT) | \
417 (MAX77843_ENABLE << CONTROL4_FCTAUTO_SHIFT))
418
419/* MAX77843 SAFEOUT LDO Control register */
420#define SAFEOUTCTRL_SAFEOUT1_SHIFT 0
421#define SAFEOUTCTRL_SAFEOUT2_SHIFT 2
422#define SAFEOUTCTRL_ENSAFEOUT1_SHIFT 6
423#define SAFEOUTCTRL_ENSAFEOUT2_SHIFT 7
424
425#define MAX77843_REG_SAFEOUTCTRL_ENSAFEOUT1 \
426 BIT(SAFEOUTCTRL_ENSAFEOUT1_SHIFT)
427#define MAX77843_REG_SAFEOUTCTRL_ENSAFEOUT2 \
428 BIT(SAFEOUTCTRL_ENSAFEOUT2_SHIFT)
429#define MAX77843_REG_SAFEOUTCTRL_SAFEOUT1_MASK \
430 (0x3 << SAFEOUTCTRL_SAFEOUT1_SHIFT)
431#define MAX77843_REG_SAFEOUTCTRL_SAFEOUT2_MASK \
432 (0x3 << SAFEOUTCTRL_SAFEOUT2_SHIFT)
433
434struct max77843 {
435 struct device *dev;
436
437 struct i2c_client *i2c;
438 struct i2c_client *i2c_chg;
439 struct i2c_client *i2c_fuel;
440 struct i2c_client *i2c_muic;
441
442 struct regmap *regmap;
443 struct regmap *regmap_chg;
444 struct regmap *regmap_fuel;
445 struct regmap *regmap_muic;
446
447 struct regmap_irq_chip_data *irq_data;
448 struct regmap_irq_chip_data *irq_data_chg;
449 struct regmap_irq_chip_data *irq_data_fuel;
450 struct regmap_irq_chip_data *irq_data_muic;
451
452 int irq;
453};
454#endif /* __MAX77843_H__ */
diff --git a/include/linux/mfd/menelaus.h b/include/linux/mfd/menelaus.h
index f097e89134cb..9e85ac06da89 100644
--- a/include/linux/mfd/menelaus.h
+++ b/include/linux/mfd/menelaus.h
@@ -24,7 +24,6 @@ extern int menelaus_set_vaux(unsigned int mV);
24extern int menelaus_set_vdcdc(int dcdc, unsigned int mV); 24extern int menelaus_set_vdcdc(int dcdc, unsigned int mV);
25extern int menelaus_set_slot_sel(int enable); 25extern int menelaus_set_slot_sel(int enable);
26extern int menelaus_get_slot_pin_states(void); 26extern int menelaus_get_slot_pin_states(void);
27extern int menelaus_set_vcore_sw(unsigned int mV);
28extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV); 27extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
29 28
30#define EN_VPLL_SLEEP (1 << 7) 29#define EN_VPLL_SLEEP (1 << 7)
@@ -38,10 +37,4 @@ extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
38 37
39extern int menelaus_set_regulator_sleep(int enable, u32 val); 38extern int menelaus_set_regulator_sleep(int enable, u32 val);
40 39
41#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_MENELAUS)
42#define omap_has_menelaus() 1
43#else
44#define omap_has_menelaus() 0
45#endif
46
47#endif 40#endif
diff --git a/include/linux/mfd/mt6397/core.h b/include/linux/mfd/mt6397/core.h
new file mode 100644
index 000000000000..cf5265b0d1c1
--- /dev/null
+++ b/include/linux/mfd/mt6397/core.h
@@ -0,0 +1,64 @@
1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Flora Fu, MediaTek
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MFD_MT6397_CORE_H__
16#define __MFD_MT6397_CORE_H__
17
18enum mt6397_irq_numbers {
19 MT6397_IRQ_SPKL_AB = 0,
20 MT6397_IRQ_SPKR_AB,
21 MT6397_IRQ_SPKL,
22 MT6397_IRQ_SPKR,
23 MT6397_IRQ_BAT_L,
24 MT6397_IRQ_BAT_H,
25 MT6397_IRQ_FG_BAT_L,
26 MT6397_IRQ_FG_BAT_H,
27 MT6397_IRQ_WATCHDOG,
28 MT6397_IRQ_PWRKEY,
29 MT6397_IRQ_THR_L,
30 MT6397_IRQ_THR_H,
31 MT6397_IRQ_VBATON_UNDET,
32 MT6397_IRQ_BVALID_DET,
33 MT6397_IRQ_CHRDET,
34 MT6397_IRQ_OV,
35 MT6397_IRQ_LDO,
36 MT6397_IRQ_HOMEKEY,
37 MT6397_IRQ_ACCDET,
38 MT6397_IRQ_AUDIO,
39 MT6397_IRQ_RTC,
40 MT6397_IRQ_PWRKEY_RSTB,
41 MT6397_IRQ_HDMI_SIFM,
42 MT6397_IRQ_HDMI_CEC,
43 MT6397_IRQ_VCA15,
44 MT6397_IRQ_VSRMCA15,
45 MT6397_IRQ_VCORE,
46 MT6397_IRQ_VGPU,
47 MT6397_IRQ_VIO18,
48 MT6397_IRQ_VPCA7,
49 MT6397_IRQ_VSRMCA7,
50 MT6397_IRQ_VDRM,
51 MT6397_IRQ_NR,
52};
53
54struct mt6397_chip {
55 struct device *dev;
56 struct regmap *regmap;
57 int irq;
58 struct irq_domain *irq_domain;
59 struct mutex irqlock;
60 u16 irq_masks_cur[2];
61 u16 irq_masks_cache[2];
62};
63
64#endif /* __MFD_MT6397_CORE_H__ */
diff --git a/include/linux/mfd/mt6397/registers.h b/include/linux/mfd/mt6397/registers.h
new file mode 100644
index 000000000000..f23a0a60a877
--- /dev/null
+++ b/include/linux/mfd/mt6397/registers.h
@@ -0,0 +1,362 @@
1/*
2 * Copyright (c) 2014 MediaTek Inc.
3 * Author: Flora Fu, MediaTek
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MFD_MT6397_REGISTERS_H__
16#define __MFD_MT6397_REGISTERS_H__
17
18/* PMIC Registers */
19#define MT6397_CID 0x0100
20#define MT6397_TOP_CKPDN 0x0102
21#define MT6397_TOP_CKPDN_SET 0x0104
22#define MT6397_TOP_CKPDN_CLR 0x0106
23#define MT6397_TOP_CKPDN2 0x0108
24#define MT6397_TOP_CKPDN2_SET 0x010A
25#define MT6397_TOP_CKPDN2_CLR 0x010C
26#define MT6397_TOP_GPIO_CKPDN 0x010E
27#define MT6397_TOP_RST_CON 0x0114
28#define MT6397_WRP_CKPDN 0x011A
29#define MT6397_WRP_RST_CON 0x0120
30#define MT6397_TOP_RST_MISC 0x0126
31#define MT6397_TOP_CKCON1 0x0128
32#define MT6397_TOP_CKCON2 0x012A
33#define MT6397_TOP_CKTST1 0x012C
34#define MT6397_TOP_CKTST2 0x012E
35#define MT6397_OC_DEG_EN 0x0130
36#define MT6397_OC_CTL0 0x0132
37#define MT6397_OC_CTL1 0x0134
38#define MT6397_OC_CTL2 0x0136
39#define MT6397_INT_RSV 0x0138
40#define MT6397_TEST_CON0 0x013A
41#define MT6397_TEST_CON1 0x013C
42#define MT6397_STATUS0 0x013E
43#define MT6397_STATUS1 0x0140
44#define MT6397_PGSTATUS 0x0142
45#define MT6397_CHRSTATUS 0x0144
46#define MT6397_OCSTATUS0 0x0146
47#define MT6397_OCSTATUS1 0x0148
48#define MT6397_OCSTATUS2 0x014A
49#define MT6397_HDMI_PAD_IE 0x014C
50#define MT6397_TEST_OUT_L 0x014E
51#define MT6397_TEST_OUT_H 0x0150
52#define MT6397_TDSEL_CON 0x0152
53#define MT6397_RDSEL_CON 0x0154
54#define MT6397_GPIO_SMT_CON0 0x0156
55#define MT6397_GPIO_SMT_CON1 0x0158
56#define MT6397_GPIO_SMT_CON2 0x015A
57#define MT6397_GPIO_SMT_CON3 0x015C
58#define MT6397_DRV_CON0 0x015E
59#define MT6397_DRV_CON1 0x0160
60#define MT6397_DRV_CON2 0x0162
61#define MT6397_DRV_CON3 0x0164
62#define MT6397_DRV_CON4 0x0166
63#define MT6397_DRV_CON5 0x0168
64#define MT6397_DRV_CON6 0x016A
65#define MT6397_DRV_CON7 0x016C
66#define MT6397_DRV_CON8 0x016E
67#define MT6397_DRV_CON9 0x0170
68#define MT6397_DRV_CON10 0x0172
69#define MT6397_DRV_CON11 0x0174
70#define MT6397_DRV_CON12 0x0176
71#define MT6397_INT_CON0 0x0178
72#define MT6397_INT_CON1 0x017E
73#define MT6397_INT_STATUS0 0x0184
74#define MT6397_INT_STATUS1 0x0186
75#define MT6397_FQMTR_CON0 0x0188
76#define MT6397_FQMTR_CON1 0x018A
77#define MT6397_FQMTR_CON2 0x018C
78#define MT6397_EFUSE_DOUT_0_15 0x01C4
79#define MT6397_EFUSE_DOUT_16_31 0x01C6
80#define MT6397_EFUSE_DOUT_32_47 0x01C8
81#define MT6397_EFUSE_DOUT_48_63 0x01CA
82#define MT6397_SPI_CON 0x01CC
83#define MT6397_TOP_CKPDN3 0x01CE
84#define MT6397_TOP_CKCON3 0x01D4
85#define MT6397_EFUSE_DOUT_64_79 0x01D6
86#define MT6397_EFUSE_DOUT_80_95 0x01D8
87#define MT6397_EFUSE_DOUT_96_111 0x01DA
88#define MT6397_EFUSE_DOUT_112_127 0x01DC
89#define MT6397_EFUSE_DOUT_128_143 0x01DE
90#define MT6397_EFUSE_DOUT_144_159 0x01E0
91#define MT6397_EFUSE_DOUT_160_175 0x01E2
92#define MT6397_EFUSE_DOUT_176_191 0x01E4
93#define MT6397_EFUSE_DOUT_192_207 0x01E6
94#define MT6397_EFUSE_DOUT_208_223 0x01E8
95#define MT6397_EFUSE_DOUT_224_239 0x01EA
96#define MT6397_EFUSE_DOUT_240_255 0x01EC
97#define MT6397_EFUSE_DOUT_256_271 0x01EE
98#define MT6397_EFUSE_DOUT_272_287 0x01F0
99#define MT6397_EFUSE_DOUT_288_300 0x01F2
100#define MT6397_EFUSE_DOUT_304_319 0x01F4
101#define MT6397_BUCK_CON0 0x0200
102#define MT6397_BUCK_CON1 0x0202
103#define MT6397_BUCK_CON2 0x0204
104#define MT6397_BUCK_CON3 0x0206
105#define MT6397_BUCK_CON4 0x0208
106#define MT6397_BUCK_CON5 0x020A
107#define MT6397_BUCK_CON6 0x020C
108#define MT6397_BUCK_CON7 0x020E
109#define MT6397_BUCK_CON8 0x0210
110#define MT6397_BUCK_CON9 0x0212
111#define MT6397_VCA15_CON0 0x0214
112#define MT6397_VCA15_CON1 0x0216
113#define MT6397_VCA15_CON2 0x0218
114#define MT6397_VCA15_CON3 0x021A
115#define MT6397_VCA15_CON4 0x021C
116#define MT6397_VCA15_CON5 0x021E
117#define MT6397_VCA15_CON6 0x0220
118#define MT6397_VCA15_CON7 0x0222
119#define MT6397_VCA15_CON8 0x0224
120#define MT6397_VCA15_CON9 0x0226
121#define MT6397_VCA15_CON10 0x0228
122#define MT6397_VCA15_CON11 0x022A
123#define MT6397_VCA15_CON12 0x022C
124#define MT6397_VCA15_CON13 0x022E
125#define MT6397_VCA15_CON14 0x0230
126#define MT6397_VCA15_CON15 0x0232
127#define MT6397_VCA15_CON16 0x0234
128#define MT6397_VCA15_CON17 0x0236
129#define MT6397_VCA15_CON18 0x0238
130#define MT6397_VSRMCA15_CON0 0x023A
131#define MT6397_VSRMCA15_CON1 0x023C
132#define MT6397_VSRMCA15_CON2 0x023E
133#define MT6397_VSRMCA15_CON3 0x0240
134#define MT6397_VSRMCA15_CON4 0x0242
135#define MT6397_VSRMCA15_CON5 0x0244
136#define MT6397_VSRMCA15_CON6 0x0246
137#define MT6397_VSRMCA15_CON7 0x0248
138#define MT6397_VSRMCA15_CON8 0x024A
139#define MT6397_VSRMCA15_CON9 0x024C
140#define MT6397_VSRMCA15_CON10 0x024E
141#define MT6397_VSRMCA15_CON11 0x0250
142#define MT6397_VSRMCA15_CON12 0x0252
143#define MT6397_VSRMCA15_CON13 0x0254
144#define MT6397_VSRMCA15_CON14 0x0256
145#define MT6397_VSRMCA15_CON15 0x0258
146#define MT6397_VSRMCA15_CON16 0x025A
147#define MT6397_VSRMCA15_CON17 0x025C
148#define MT6397_VSRMCA15_CON18 0x025E
149#define MT6397_VSRMCA15_CON19 0x0260
150#define MT6397_VSRMCA15_CON20 0x0262
151#define MT6397_VSRMCA15_CON21 0x0264
152#define MT6397_VCORE_CON0 0x0266
153#define MT6397_VCORE_CON1 0x0268
154#define MT6397_VCORE_CON2 0x026A
155#define MT6397_VCORE_CON3 0x026C
156#define MT6397_VCORE_CON4 0x026E
157#define MT6397_VCORE_CON5 0x0270
158#define MT6397_VCORE_CON6 0x0272
159#define MT6397_VCORE_CON7 0x0274
160#define MT6397_VCORE_CON8 0x0276
161#define MT6397_VCORE_CON9 0x0278
162#define MT6397_VCORE_CON10 0x027A
163#define MT6397_VCORE_CON11 0x027C
164#define MT6397_VCORE_CON12 0x027E
165#define MT6397_VCORE_CON13 0x0280
166#define MT6397_VCORE_CON14 0x0282
167#define MT6397_VCORE_CON15 0x0284
168#define MT6397_VCORE_CON16 0x0286
169#define MT6397_VCORE_CON17 0x0288
170#define MT6397_VCORE_CON18 0x028A
171#define MT6397_VGPU_CON0 0x028C
172#define MT6397_VGPU_CON1 0x028E
173#define MT6397_VGPU_CON2 0x0290
174#define MT6397_VGPU_CON3 0x0292
175#define MT6397_VGPU_CON4 0x0294
176#define MT6397_VGPU_CON5 0x0296
177#define MT6397_VGPU_CON6 0x0298
178#define MT6397_VGPU_CON7 0x029A
179#define MT6397_VGPU_CON8 0x029C
180#define MT6397_VGPU_CON9 0x029E
181#define MT6397_VGPU_CON10 0x02A0
182#define MT6397_VGPU_CON11 0x02A2
183#define MT6397_VGPU_CON12 0x02A4
184#define MT6397_VGPU_CON13 0x02A6
185#define MT6397_VGPU_CON14 0x02A8
186#define MT6397_VGPU_CON15 0x02AA
187#define MT6397_VGPU_CON16 0x02AC
188#define MT6397_VGPU_CON17 0x02AE
189#define MT6397_VGPU_CON18 0x02B0
190#define MT6397_VIO18_CON0 0x0300
191#define MT6397_VIO18_CON1 0x0302
192#define MT6397_VIO18_CON2 0x0304
193#define MT6397_VIO18_CON3 0x0306
194#define MT6397_VIO18_CON4 0x0308
195#define MT6397_VIO18_CON5 0x030A
196#define MT6397_VIO18_CON6 0x030C
197#define MT6397_VIO18_CON7 0x030E
198#define MT6397_VIO18_CON8 0x0310
199#define MT6397_VIO18_CON9 0x0312
200#define MT6397_VIO18_CON10 0x0314
201#define MT6397_VIO18_CON11 0x0316
202#define MT6397_VIO18_CON12 0x0318
203#define MT6397_VIO18_CON13 0x031A
204#define MT6397_VIO18_CON14 0x031C
205#define MT6397_VIO18_CON15 0x031E
206#define MT6397_VIO18_CON16 0x0320
207#define MT6397_VIO18_CON17 0x0322
208#define MT6397_VIO18_CON18 0x0324
209#define MT6397_VPCA7_CON0 0x0326
210#define MT6397_VPCA7_CON1 0x0328
211#define MT6397_VPCA7_CON2 0x032A
212#define MT6397_VPCA7_CON3 0x032C
213#define MT6397_VPCA7_CON4 0x032E
214#define MT6397_VPCA7_CON5 0x0330
215#define MT6397_VPCA7_CON6 0x0332
216#define MT6397_VPCA7_CON7 0x0334
217#define MT6397_VPCA7_CON8 0x0336
218#define MT6397_VPCA7_CON9 0x0338
219#define MT6397_VPCA7_CON10 0x033A
220#define MT6397_VPCA7_CON11 0x033C
221#define MT6397_VPCA7_CON12 0x033E
222#define MT6397_VPCA7_CON13 0x0340
223#define MT6397_VPCA7_CON14 0x0342
224#define MT6397_VPCA7_CON15 0x0344
225#define MT6397_VPCA7_CON16 0x0346
226#define MT6397_VPCA7_CON17 0x0348
227#define MT6397_VPCA7_CON18 0x034A
228#define MT6397_VSRMCA7_CON0 0x034C
229#define MT6397_VSRMCA7_CON1 0x034E
230#define MT6397_VSRMCA7_CON2 0x0350
231#define MT6397_VSRMCA7_CON3 0x0352
232#define MT6397_VSRMCA7_CON4 0x0354
233#define MT6397_VSRMCA7_CON5 0x0356
234#define MT6397_VSRMCA7_CON6 0x0358
235#define MT6397_VSRMCA7_CON7 0x035A
236#define MT6397_VSRMCA7_CON8 0x035C
237#define MT6397_VSRMCA7_CON9 0x035E
238#define MT6397_VSRMCA7_CON10 0x0360
239#define MT6397_VSRMCA7_CON11 0x0362
240#define MT6397_VSRMCA7_CON12 0x0364
241#define MT6397_VSRMCA7_CON13 0x0366
242#define MT6397_VSRMCA7_CON14 0x0368
243#define MT6397_VSRMCA7_CON15 0x036A
244#define MT6397_VSRMCA7_CON16 0x036C
245#define MT6397_VSRMCA7_CON17 0x036E
246#define MT6397_VSRMCA7_CON18 0x0370
247#define MT6397_VSRMCA7_CON19 0x0372
248#define MT6397_VSRMCA7_CON20 0x0374
249#define MT6397_VSRMCA7_CON21 0x0376
250#define MT6397_VDRM_CON0 0x0378
251#define MT6397_VDRM_CON1 0x037A
252#define MT6397_VDRM_CON2 0x037C
253#define MT6397_VDRM_CON3 0x037E
254#define MT6397_VDRM_CON4 0x0380
255#define MT6397_VDRM_CON5 0x0382
256#define MT6397_VDRM_CON6 0x0384
257#define MT6397_VDRM_CON7 0x0386
258#define MT6397_VDRM_CON8 0x0388
259#define MT6397_VDRM_CON9 0x038A
260#define MT6397_VDRM_CON10 0x038C
261#define MT6397_VDRM_CON11 0x038E
262#define MT6397_VDRM_CON12 0x0390
263#define MT6397_VDRM_CON13 0x0392
264#define MT6397_VDRM_CON14 0x0394
265#define MT6397_VDRM_CON15 0x0396
266#define MT6397_VDRM_CON16 0x0398
267#define MT6397_VDRM_CON17 0x039A
268#define MT6397_VDRM_CON18 0x039C
269#define MT6397_BUCK_K_CON0 0x039E
270#define MT6397_BUCK_K_CON1 0x03A0
271#define MT6397_ANALDO_CON0 0x0400
272#define MT6397_ANALDO_CON1 0x0402
273#define MT6397_ANALDO_CON2 0x0404
274#define MT6397_ANALDO_CON3 0x0406
275#define MT6397_ANALDO_CON4 0x0408
276#define MT6397_ANALDO_CON5 0x040A
277#define MT6397_ANALDO_CON6 0x040C
278#define MT6397_ANALDO_CON7 0x040E
279#define MT6397_DIGLDO_CON0 0x0410
280#define MT6397_DIGLDO_CON1 0x0412
281#define MT6397_DIGLDO_CON2 0x0414
282#define MT6397_DIGLDO_CON3 0x0416
283#define MT6397_DIGLDO_CON4 0x0418
284#define MT6397_DIGLDO_CON5 0x041A
285#define MT6397_DIGLDO_CON6 0x041C
286#define MT6397_DIGLDO_CON7 0x041E
287#define MT6397_DIGLDO_CON8 0x0420
288#define MT6397_DIGLDO_CON9 0x0422
289#define MT6397_DIGLDO_CON10 0x0424
290#define MT6397_DIGLDO_CON11 0x0426
291#define MT6397_DIGLDO_CON12 0x0428
292#define MT6397_DIGLDO_CON13 0x042A
293#define MT6397_DIGLDO_CON14 0x042C
294#define MT6397_DIGLDO_CON15 0x042E
295#define MT6397_DIGLDO_CON16 0x0430
296#define MT6397_DIGLDO_CON17 0x0432
297#define MT6397_DIGLDO_CON18 0x0434
298#define MT6397_DIGLDO_CON19 0x0436
299#define MT6397_DIGLDO_CON20 0x0438
300#define MT6397_DIGLDO_CON21 0x043A
301#define MT6397_DIGLDO_CON22 0x043C
302#define MT6397_DIGLDO_CON23 0x043E
303#define MT6397_DIGLDO_CON24 0x0440
304#define MT6397_DIGLDO_CON25 0x0442
305#define MT6397_DIGLDO_CON26 0x0444
306#define MT6397_DIGLDO_CON27 0x0446
307#define MT6397_DIGLDO_CON28 0x0448
308#define MT6397_DIGLDO_CON29 0x044A
309#define MT6397_DIGLDO_CON30 0x044C
310#define MT6397_DIGLDO_CON31 0x044E
311#define MT6397_DIGLDO_CON32 0x0450
312#define MT6397_DIGLDO_CON33 0x045A
313#define MT6397_SPK_CON0 0x0600
314#define MT6397_SPK_CON1 0x0602
315#define MT6397_SPK_CON2 0x0604
316#define MT6397_SPK_CON3 0x0606
317#define MT6397_SPK_CON4 0x0608
318#define MT6397_SPK_CON5 0x060A
319#define MT6397_SPK_CON6 0x060C
320#define MT6397_SPK_CON7 0x060E
321#define MT6397_SPK_CON8 0x0610
322#define MT6397_SPK_CON9 0x0612
323#define MT6397_SPK_CON10 0x0614
324#define MT6397_SPK_CON11 0x0616
325#define MT6397_AUDDAC_CON0 0x0700
326#define MT6397_AUDBUF_CFG0 0x0702
327#define MT6397_AUDBUF_CFG1 0x0704
328#define MT6397_AUDBUF_CFG2 0x0706
329#define MT6397_AUDBUF_CFG3 0x0708
330#define MT6397_AUDBUF_CFG4 0x070A
331#define MT6397_IBIASDIST_CFG0 0x070C
332#define MT6397_AUDACCDEPOP_CFG0 0x070E
333#define MT6397_AUD_IV_CFG0 0x0710
334#define MT6397_AUDCLKGEN_CFG0 0x0712
335#define MT6397_AUDLDO_CFG0 0x0714
336#define MT6397_AUDLDO_CFG1 0x0716
337#define MT6397_AUDNVREGGLB_CFG0 0x0718
338#define MT6397_AUD_NCP0 0x071A
339#define MT6397_AUDPREAMP_CON0 0x071C
340#define MT6397_AUDADC_CON0 0x071E
341#define MT6397_AUDADC_CON1 0x0720
342#define MT6397_AUDADC_CON2 0x0722
343#define MT6397_AUDADC_CON3 0x0724
344#define MT6397_AUDADC_CON4 0x0726
345#define MT6397_AUDADC_CON5 0x0728
346#define MT6397_AUDADC_CON6 0x072A
347#define MT6397_AUDDIGMI_CON0 0x072C
348#define MT6397_AUDLSBUF_CON0 0x072E
349#define MT6397_AUDLSBUF_CON1 0x0730
350#define MT6397_AUDENCSPARE_CON0 0x0732
351#define MT6397_AUDENCCLKSQ_CON0 0x0734
352#define MT6397_AUDPREAMPGAIN_CON0 0x0736
353#define MT6397_ZCD_CON0 0x0738
354#define MT6397_ZCD_CON1 0x073A
355#define MT6397_ZCD_CON2 0x073C
356#define MT6397_ZCD_CON3 0x073E
357#define MT6397_ZCD_CON4 0x0740
358#define MT6397_ZCD_CON5 0x0742
359#define MT6397_NCP_CLKDIV_CON0 0x0744
360#define MT6397_NCP_CLKDIV_CON1 0x0746
361
362#endif /* __MFD_MT6397_REGISTERS_H__ */
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index fb0390a1a498..bb270bd03eed 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -117,6 +117,7 @@ struct palmas_pmic_driver_data {
117 int ldo_begin; 117 int ldo_begin;
118 int ldo_end; 118 int ldo_end;
119 int max_reg; 119 int max_reg;
120 bool has_regen3;
120 struct palmas_regs_info *palmas_regs_info; 121 struct palmas_regs_info *palmas_regs_info;
121 struct of_regulator_match *palmas_matches; 122 struct of_regulator_match *palmas_matches;
122 struct palmas_sleep_requestor_info *sleep_req_info; 123 struct palmas_sleep_requestor_info *sleep_req_info;
@@ -2999,6 +3000,9 @@ enum usb_irq_events {
2999#define PALMAS_GPADC_TRIM15 0x0E 3000#define PALMAS_GPADC_TRIM15 0x0E
3000#define PALMAS_GPADC_TRIM16 0x0F 3001#define PALMAS_GPADC_TRIM16 0x0F
3001 3002
3003/* TPS659038 regen2_ctrl offset iss different from palmas */
3004#define TPS659038_REGEN2_CTRL 0x12
3005
3002/* TPS65917 Interrupt registers */ 3006/* TPS65917 Interrupt registers */
3003 3007
3004/* Registers for function INTERRUPT */ 3008/* Registers for function INTERRUPT */
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index fb09312d854b..441b6ee72691 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -156,6 +156,9 @@ enum rk808_reg {
156#define BUCK2_RATE_MASK (3 << 3) 156#define BUCK2_RATE_MASK (3 << 3)
157#define MASK_ALL 0xff 157#define MASK_ALL 0xff
158 158
159#define BUCK_UV_ACT_MASK 0x0f
160#define BUCK_UV_ACT_DISABLE 0
161
159#define SWITCH2_EN BIT(6) 162#define SWITCH2_EN BIT(6)
160#define SWITCH1_EN BIT(5) 163#define SWITCH1_EN BIT(5)
161#define DEV_OFF_RST BIT(3) 164#define DEV_OFF_RST BIT(3)
diff --git a/include/linux/mfd/rt5033.h b/include/linux/mfd/rt5033.h
index 010cff49a98e..6cff5cf458d2 100644
--- a/include/linux/mfd/rt5033.h
+++ b/include/linux/mfd/rt5033.h
@@ -39,7 +39,7 @@ struct rt5033_battery {
39 struct i2c_client *client; 39 struct i2c_client *client;
40 struct rt5033_dev *rt5033; 40 struct rt5033_dev *rt5033;
41 struct regmap *regmap; 41 struct regmap *regmap;
42 struct power_supply psy; 42 struct power_supply *psy;
43}; 43};
44 44
45/* RT5033 charger platform data */ 45/* RT5033 charger platform data */
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 0c12628e91c6..ff843e7ca23d 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -28,74 +28,72 @@
28 28
29#define MAX_RW_REG_CNT 1024 29#define MAX_RW_REG_CNT 1024
30 30
31/* PCI Operation Register Address */
32#define RTSX_HCBAR 0x00 31#define RTSX_HCBAR 0x00
33#define RTSX_HCBCTLR 0x04 32#define RTSX_HCBCTLR 0x04
33#define STOP_CMD (0x01 << 28)
34#define READ_REG_CMD 0
35#define WRITE_REG_CMD 1
36#define CHECK_REG_CMD 2
37
34#define RTSX_HDBAR 0x08 38#define RTSX_HDBAR 0x08
39#define SG_INT 0x04
40#define SG_END 0x02
41#define SG_VALID 0x01
42#define SG_NO_OP 0x00
43#define SG_TRANS_DATA (0x02 << 4)
44#define SG_LINK_DESC (0x03 << 4)
35#define RTSX_HDBCTLR 0x0C 45#define RTSX_HDBCTLR 0x0C
46#define SDMA_MODE 0x00
47#define ADMA_MODE (0x02 << 26)
48#define STOP_DMA (0x01 << 28)
49#define TRIG_DMA (0x01 << 31)
50
36#define RTSX_HAIMR 0x10 51#define RTSX_HAIMR 0x10
37#define RTSX_BIPR 0x14 52#define HAIMR_TRANS_START (0x01 << 31)
38#define RTSX_BIER 0x18 53#define HAIMR_READ 0x00
54#define HAIMR_WRITE (0x01 << 30)
55#define HAIMR_READ_START (HAIMR_TRANS_START | HAIMR_READ)
56#define HAIMR_WRITE_START (HAIMR_TRANS_START | HAIMR_WRITE)
57#define HAIMR_TRANS_END (HAIMR_TRANS_START)
39 58
40/* Host command buffer control register */ 59#define RTSX_BIPR 0x14
41#define STOP_CMD (0x01 << 28) 60#define CMD_DONE_INT (1 << 31)
42 61#define DATA_DONE_INT (1 << 30)
43/* Host data buffer control register */ 62#define TRANS_OK_INT (1 << 29)
44#define SDMA_MODE 0x00 63#define TRANS_FAIL_INT (1 << 28)
45#define ADMA_MODE (0x02 << 26) 64#define XD_INT (1 << 27)
46#define STOP_DMA (0x01 << 28) 65#define MS_INT (1 << 26)
47#define TRIG_DMA (0x01 << 31) 66#define SD_INT (1 << 25)
48 67#define GPIO0_INT (1 << 24)
49/* Host access internal memory register */ 68#define OC_INT (1 << 23)
50#define HAIMR_TRANS_START (0x01 << 31) 69#define SD_WRITE_PROTECT (1 << 19)
51#define HAIMR_READ 0x00 70#define XD_EXIST (1 << 18)
52#define HAIMR_WRITE (0x01 << 30) 71#define MS_EXIST (1 << 17)
53#define HAIMR_READ_START (HAIMR_TRANS_START | HAIMR_READ) 72#define SD_EXIST (1 << 16)
54#define HAIMR_WRITE_START (HAIMR_TRANS_START | HAIMR_WRITE) 73#define DELINK_INT GPIO0_INT
55#define HAIMR_TRANS_END (HAIMR_TRANS_START) 74#define MS_OC_INT (1 << 23)
56 75#define SD_OC_INT (1 << 22)
57/* Bus interrupt pending register */
58#define CMD_DONE_INT (1 << 31)
59#define DATA_DONE_INT (1 << 30)
60#define TRANS_OK_INT (1 << 29)
61#define TRANS_FAIL_INT (1 << 28)
62#define XD_INT (1 << 27)
63#define MS_INT (1 << 26)
64#define SD_INT (1 << 25)
65#define GPIO0_INT (1 << 24)
66#define OC_INT (1 << 23)
67#define SD_WRITE_PROTECT (1 << 19)
68#define XD_EXIST (1 << 18)
69#define MS_EXIST (1 << 17)
70#define SD_EXIST (1 << 16)
71#define DELINK_INT GPIO0_INT
72#define MS_OC_INT (1 << 23)
73#define SD_OC_INT (1 << 22)
74 76
75#define CARD_INT (XD_INT | MS_INT | SD_INT) 77#define CARD_INT (XD_INT | MS_INT | SD_INT)
76#define NEED_COMPLETE_INT (DATA_DONE_INT | TRANS_OK_INT | TRANS_FAIL_INT) 78#define NEED_COMPLETE_INT (DATA_DONE_INT | TRANS_OK_INT | TRANS_FAIL_INT)
77#define RTSX_INT (CMD_DONE_INT | NEED_COMPLETE_INT | \ 79#define RTSX_INT (CMD_DONE_INT | NEED_COMPLETE_INT | \
78 CARD_INT | GPIO0_INT | OC_INT) 80 CARD_INT | GPIO0_INT | OC_INT)
79
80#define CARD_EXIST (XD_EXIST | MS_EXIST | SD_EXIST) 81#define CARD_EXIST (XD_EXIST | MS_EXIST | SD_EXIST)
81 82
82/* Bus interrupt enable register */ 83#define RTSX_BIER 0x18
83#define CMD_DONE_INT_EN (1 << 31) 84#define CMD_DONE_INT_EN (1 << 31)
84#define DATA_DONE_INT_EN (1 << 30) 85#define DATA_DONE_INT_EN (1 << 30)
85#define TRANS_OK_INT_EN (1 << 29) 86#define TRANS_OK_INT_EN (1 << 29)
86#define TRANS_FAIL_INT_EN (1 << 28) 87#define TRANS_FAIL_INT_EN (1 << 28)
87#define XD_INT_EN (1 << 27) 88#define XD_INT_EN (1 << 27)
88#define MS_INT_EN (1 << 26) 89#define MS_INT_EN (1 << 26)
89#define SD_INT_EN (1 << 25) 90#define SD_INT_EN (1 << 25)
90#define GPIO0_INT_EN (1 << 24) 91#define GPIO0_INT_EN (1 << 24)
91#define OC_INT_EN (1 << 23) 92#define OC_INT_EN (1 << 23)
92#define DELINK_INT_EN GPIO0_INT_EN 93#define DELINK_INT_EN GPIO0_INT_EN
93#define MS_OC_INT_EN (1 << 23) 94#define MS_OC_INT_EN (1 << 23)
94#define SD_OC_INT_EN (1 << 22) 95#define SD_OC_INT_EN (1 << 22)
95 96
96#define READ_REG_CMD 0
97#define WRITE_REG_CMD 1
98#define CHECK_REG_CMD 2
99 97
100/* 98/*
101 * macros for easy use 99 * macros for easy use
@@ -125,423 +123,68 @@
125#define rtsx_pci_write_config_dword(pcr, where, val) \ 123#define rtsx_pci_write_config_dword(pcr, where, val) \
126 pci_write_config_dword((pcr)->pci, where, val) 124 pci_write_config_dword((pcr)->pci, where, val)
127 125
128#define STATE_TRANS_NONE 0 126#define STATE_TRANS_NONE 0
129#define STATE_TRANS_CMD 1 127#define STATE_TRANS_CMD 1
130#define STATE_TRANS_BUF 2 128#define STATE_TRANS_BUF 2
131#define STATE_TRANS_SG 3 129#define STATE_TRANS_SG 3
132
133#define TRANS_NOT_READY 0
134#define TRANS_RESULT_OK 1
135#define TRANS_RESULT_FAIL 2
136#define TRANS_NO_DEVICE 3
137
138#define RTSX_RESV_BUF_LEN 4096
139#define HOST_CMDS_BUF_LEN 1024
140#define HOST_SG_TBL_BUF_LEN (RTSX_RESV_BUF_LEN - HOST_CMDS_BUF_LEN)
141#define HOST_SG_TBL_ITEMS (HOST_SG_TBL_BUF_LEN / 8)
142#define MAX_SG_ITEM_LEN 0x80000
143
144#define HOST_TO_DEVICE 0
145#define DEVICE_TO_HOST 1
146
147#define RTSX_PHASE_MAX 32
148#define RX_TUNING_CNT 3
149
150/* SG descriptor */
151#define SG_INT 0x04
152#define SG_END 0x02
153#define SG_VALID 0x01
154
155#define SG_NO_OP 0x00
156#define SG_TRANS_DATA (0x02 << 4)
157#define SG_LINK_DESC (0x03 << 4)
158
159/* Output voltage */
160#define OUTPUT_3V3 0
161#define OUTPUT_1V8 1
162
163/* Card Clock Enable Register */
164#define SD_CLK_EN 0x04
165#define MS_CLK_EN 0x08
166
167/* Card Select Register */
168#define SD_MOD_SEL 2
169#define MS_MOD_SEL 3
170
171/* Card Output Enable Register */
172#define SD_OUTPUT_EN 0x04
173#define MS_OUTPUT_EN 0x08
174
175/* CARD_SHARE_MODE */
176#define CARD_SHARE_MASK 0x0F
177#define CARD_SHARE_MULTI_LUN 0x00
178#define CARD_SHARE_NORMAL 0x00
179#define CARD_SHARE_48_SD 0x04
180#define CARD_SHARE_48_MS 0x08
181/* CARD_SHARE_MODE for barossa */
182#define CARD_SHARE_BAROSSA_SD 0x01
183#define CARD_SHARE_BAROSSA_MS 0x02
184
185/* CARD_DRIVE_SEL */
186#define MS_DRIVE_8mA (0x01 << 6)
187#define MMC_DRIVE_8mA (0x01 << 4)
188#define XD_DRIVE_8mA (0x01 << 2)
189#define GPIO_DRIVE_8mA 0x01
190#define RTS5209_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
191 XD_DRIVE_8mA | GPIO_DRIVE_8mA)
192#define RTL8411_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
193 XD_DRIVE_8mA)
194#define RTSX_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | GPIO_DRIVE_8mA)
195 130
196/* SD30_DRIVE_SEL */ 131#define TRANS_NOT_READY 0
197#define DRIVER_TYPE_A 0x05 132#define TRANS_RESULT_OK 1
198#define DRIVER_TYPE_B 0x03 133#define TRANS_RESULT_FAIL 2
199#define DRIVER_TYPE_C 0x02 134#define TRANS_NO_DEVICE 3
200#define DRIVER_TYPE_D 0x01
201#define CFG_DRIVER_TYPE_A 0x02
202#define CFG_DRIVER_TYPE_B 0x03
203#define CFG_DRIVER_TYPE_C 0x01
204#define CFG_DRIVER_TYPE_D 0x00
205
206/* FPDCTL */
207#define SSC_POWER_DOWN 0x01
208#define SD_OC_POWER_DOWN 0x02
209#define ALL_POWER_DOWN 0x07
210#define OC_POWER_DOWN 0x06
211
212/* CLK_CTL */
213#define CHANGE_CLK 0x01
214
215/* LDO_CTL */
216#define BPP_ASIC_1V7 0x00
217#define BPP_ASIC_1V8 0x01
218#define BPP_ASIC_1V9 0x02
219#define BPP_ASIC_2V0 0x03
220#define BPP_ASIC_2V7 0x04
221#define BPP_ASIC_2V8 0x05
222#define BPP_ASIC_3V2 0x06
223#define BPP_ASIC_3V3 0x07
224#define BPP_REG_TUNED18 0x07
225#define BPP_TUNED18_SHIFT_8402 5
226#define BPP_TUNED18_SHIFT_8411 4
227#define BPP_PAD_MASK 0x04
228#define BPP_PAD_3V3 0x04
229#define BPP_PAD_1V8 0x00
230#define BPP_LDO_POWB 0x03
231#define BPP_LDO_ON 0x00
232#define BPP_LDO_SUSPEND 0x02
233#define BPP_LDO_OFF 0x03
234
235/* CD_PAD_CTL */
236#define CD_DISABLE_MASK 0x07
237#define MS_CD_DISABLE 0x04
238#define SD_CD_DISABLE 0x02
239#define XD_CD_DISABLE 0x01
240#define CD_DISABLE 0x07
241#define CD_ENABLE 0x00
242#define MS_CD_EN_ONLY 0x03
243#define SD_CD_EN_ONLY 0x05
244#define XD_CD_EN_ONLY 0x06
245#define FORCE_CD_LOW_MASK 0x38
246#define FORCE_CD_XD_LOW 0x08
247#define FORCE_CD_SD_LOW 0x10
248#define FORCE_CD_MS_LOW 0x20
249#define CD_AUTO_DISABLE 0x40
250
251/* SD_STAT1 */
252#define SD_CRC7_ERR 0x80
253#define SD_CRC16_ERR 0x40
254#define SD_CRC_WRITE_ERR 0x20
255#define SD_CRC_WRITE_ERR_MASK 0x1C
256#define GET_CRC_TIME_OUT 0x02
257#define SD_TUNING_COMPARE_ERR 0x01
258
259/* SD_STAT2 */
260#define SD_RSP_80CLK_TIMEOUT 0x01
261
262/* SD_BUS_STAT */
263#define SD_CLK_TOGGLE_EN 0x80
264#define SD_CLK_FORCE_STOP 0x40
265#define SD_DAT3_STATUS 0x10
266#define SD_DAT2_STATUS 0x08
267#define SD_DAT1_STATUS 0x04
268#define SD_DAT0_STATUS 0x02
269#define SD_CMD_STATUS 0x01
270
271/* SD_PAD_CTL */
272#define SD_IO_USING_1V8 0x80
273#define SD_IO_USING_3V3 0x7F
274#define TYPE_A_DRIVING 0x00
275#define TYPE_B_DRIVING 0x01
276#define TYPE_C_DRIVING 0x02
277#define TYPE_D_DRIVING 0x03
278
279/* SD_SAMPLE_POINT_CTL */
280#define DDR_FIX_RX_DAT 0x00
281#define DDR_VAR_RX_DAT 0x80
282#define DDR_FIX_RX_DAT_EDGE 0x00
283#define DDR_FIX_RX_DAT_14_DELAY 0x40
284#define DDR_FIX_RX_CMD 0x00
285#define DDR_VAR_RX_CMD 0x20
286#define DDR_FIX_RX_CMD_POS_EDGE 0x00
287#define DDR_FIX_RX_CMD_14_DELAY 0x10
288#define SD20_RX_POS_EDGE 0x00
289#define SD20_RX_14_DELAY 0x08
290#define SD20_RX_SEL_MASK 0x08
291 135
292/* SD_PUSH_POINT_CTL */ 136#define RTSX_RESV_BUF_LEN 4096
293#define DDR_FIX_TX_CMD_DAT 0x00 137#define HOST_CMDS_BUF_LEN 1024
294#define DDR_VAR_TX_CMD_DAT 0x80 138#define HOST_SG_TBL_BUF_LEN (RTSX_RESV_BUF_LEN - HOST_CMDS_BUF_LEN)
295#define DDR_FIX_TX_DAT_14_TSU 0x00 139#define HOST_SG_TBL_ITEMS (HOST_SG_TBL_BUF_LEN / 8)
296#define DDR_FIX_TX_DAT_12_TSU 0x40 140#define MAX_SG_ITEM_LEN 0x80000
297#define DDR_FIX_TX_CMD_NEG_EDGE 0x00 141#define HOST_TO_DEVICE 0
298#define DDR_FIX_TX_CMD_14_AHEAD 0x20 142#define DEVICE_TO_HOST 1
299#define SD20_TX_NEG_EDGE 0x00
300#define SD20_TX_14_AHEAD 0x10
301#define SD20_TX_SEL_MASK 0x10
302#define DDR_VAR_SDCLK_POL_SWAP 0x01
303
304/* SD_TRANSFER */
305#define SD_TRANSFER_START 0x80
306#define SD_TRANSFER_END 0x40
307#define SD_STAT_IDLE 0x20
308#define SD_TRANSFER_ERR 0x10
309/* SD Transfer Mode definition */
310#define SD_TM_NORMAL_WRITE 0x00
311#define SD_TM_AUTO_WRITE_3 0x01
312#define SD_TM_AUTO_WRITE_4 0x02
313#define SD_TM_AUTO_READ_3 0x05
314#define SD_TM_AUTO_READ_4 0x06
315#define SD_TM_CMD_RSP 0x08
316#define SD_TM_AUTO_WRITE_1 0x09
317#define SD_TM_AUTO_WRITE_2 0x0A
318#define SD_TM_NORMAL_READ 0x0C
319#define SD_TM_AUTO_READ_1 0x0D
320#define SD_TM_AUTO_READ_2 0x0E
321#define SD_TM_AUTO_TUNING 0x0F
322
323/* SD_VPTX_CTL / SD_VPRX_CTL */
324#define PHASE_CHANGE 0x80
325#define PHASE_NOT_RESET 0x40
326
327/* SD_DCMPS_TX_CTL / SD_DCMPS_RX_CTL */
328#define DCMPS_CHANGE 0x80
329#define DCMPS_CHANGE_DONE 0x40
330#define DCMPS_ERROR 0x20
331#define DCMPS_CURRENT_PHASE 0x1F
332
333/* SD Configure 1 Register */
334#define SD_CLK_DIVIDE_0 0x00
335#define SD_CLK_DIVIDE_256 0xC0
336#define SD_CLK_DIVIDE_128 0x80
337#define SD_BUS_WIDTH_1BIT 0x00
338#define SD_BUS_WIDTH_4BIT 0x01
339#define SD_BUS_WIDTH_8BIT 0x02
340#define SD_ASYNC_FIFO_NOT_RST 0x10
341#define SD_20_MODE 0x00
342#define SD_DDR_MODE 0x04
343#define SD_30_MODE 0x08
344
345#define SD_CLK_DIVIDE_MASK 0xC0
346
347/* SD_CMD_STATE */
348#define SD_CMD_IDLE 0x80
349
350/* SD_DATA_STATE */
351#define SD_DATA_IDLE 0x80
352
353/* DCM_DRP_CTL */
354#define DCM_RESET 0x08
355#define DCM_LOCKED 0x04
356#define DCM_208M 0x00
357#define DCM_TX 0x01
358#define DCM_RX 0x02
359
360/* DCM_DRP_TRIG */
361#define DRP_START 0x80
362#define DRP_DONE 0x40
363
364/* DCM_DRP_CFG */
365#define DRP_WRITE 0x80
366#define DRP_READ 0x00
367#define DCM_WRITE_ADDRESS_50 0x50
368#define DCM_WRITE_ADDRESS_51 0x51
369#define DCM_READ_ADDRESS_00 0x00
370#define DCM_READ_ADDRESS_51 0x51
371
372/* IRQSTAT0 */
373#define DMA_DONE_INT 0x80
374#define SUSPEND_INT 0x40
375#define LINK_RDY_INT 0x20
376#define LINK_DOWN_INT 0x10
377
378/* DMACTL */
379#define DMA_RST 0x80
380#define DMA_BUSY 0x04
381#define DMA_DIR_TO_CARD 0x00
382#define DMA_DIR_FROM_CARD 0x02
383#define DMA_EN 0x01
384#define DMA_128 (0 << 4)
385#define DMA_256 (1 << 4)
386#define DMA_512 (2 << 4)
387#define DMA_1024 (3 << 4)
388#define DMA_PACK_SIZE_MASK 0x30
389
390/* SSC_CTL1 */
391#define SSC_RSTB 0x80
392#define SSC_8X_EN 0x40
393#define SSC_FIX_FRAC 0x20
394#define SSC_SEL_1M 0x00
395#define SSC_SEL_2M 0x08
396#define SSC_SEL_4M 0x10
397#define SSC_SEL_8M 0x18
398
399/* SSC_CTL2 */
400#define SSC_DEPTH_MASK 0x07
401#define SSC_DEPTH_DISALBE 0x00
402#define SSC_DEPTH_4M 0x01
403#define SSC_DEPTH_2M 0x02
404#define SSC_DEPTH_1M 0x03
405#define SSC_DEPTH_500K 0x04
406#define SSC_DEPTH_250K 0x05
407
408/* System Clock Control Register */
409#define CLK_LOW_FREQ 0x01
410
411/* System Clock Divider Register */
412#define CLK_DIV_1 0x01
413#define CLK_DIV_2 0x02
414#define CLK_DIV_4 0x03
415#define CLK_DIV_8 0x04
416
417/* MS_CFG */
418#define SAMPLE_TIME_RISING 0x00
419#define SAMPLE_TIME_FALLING 0x80
420#define PUSH_TIME_DEFAULT 0x00
421#define PUSH_TIME_ODD 0x40
422#define NO_EXTEND_TOGGLE 0x00
423#define EXTEND_TOGGLE_CHK 0x20
424#define MS_BUS_WIDTH_1 0x00
425#define MS_BUS_WIDTH_4 0x10
426#define MS_BUS_WIDTH_8 0x18
427#define MS_2K_SECTOR_MODE 0x04
428#define MS_512_SECTOR_MODE 0x00
429#define MS_TOGGLE_TIMEOUT_EN 0x00
430#define MS_TOGGLE_TIMEOUT_DISEN 0x01
431#define MS_NO_CHECK_INT 0x02
432 143
433/* MS_TRANS_CFG */ 144#define OUTPUT_3V3 0
434#define WAIT_INT 0x80 145#define OUTPUT_1V8 1
435#define NO_WAIT_INT 0x00 146
436#define NO_AUTO_READ_INT_REG 0x00 147#define RTSX_PHASE_MAX 32
437#define AUTO_READ_INT_REG 0x40 148#define RX_TUNING_CNT 3
438#define MS_CRC16_ERR 0x20
439#define MS_RDY_TIMEOUT 0x10
440#define MS_INT_CMDNK 0x08
441#define MS_INT_BREQ 0x04
442#define MS_INT_ERR 0x02
443#define MS_INT_CED 0x01
444
445/* MS_TRANSFER */
446#define MS_TRANSFER_START 0x80
447#define MS_TRANSFER_END 0x40
448#define MS_TRANSFER_ERR 0x20
449#define MS_BS_STATE 0x10
450#define MS_TM_READ_BYTES 0x00
451#define MS_TM_NORMAL_READ 0x01
452#define MS_TM_WRITE_BYTES 0x04
453#define MS_TM_NORMAL_WRITE 0x05
454#define MS_TM_AUTO_READ 0x08
455#define MS_TM_AUTO_WRITE 0x0C
456
457/* SD Configure 2 Register */
458#define SD_CALCULATE_CRC7 0x00
459#define SD_NO_CALCULATE_CRC7 0x80
460#define SD_CHECK_CRC16 0x00
461#define SD_NO_CHECK_CRC16 0x40
462#define SD_NO_CHECK_WAIT_CRC_TO 0x20
463#define SD_WAIT_BUSY_END 0x08
464#define SD_NO_WAIT_BUSY_END 0x00
465#define SD_CHECK_CRC7 0x00
466#define SD_NO_CHECK_CRC7 0x04
467#define SD_RSP_LEN_0 0x00
468#define SD_RSP_LEN_6 0x01
469#define SD_RSP_LEN_17 0x02
470/* SD/MMC Response Type Definition */
471#define SD_RSP_TYPE_R0 0x04
472#define SD_RSP_TYPE_R1 0x01
473#define SD_RSP_TYPE_R1b 0x09
474#define SD_RSP_TYPE_R2 0x02
475#define SD_RSP_TYPE_R3 0x05
476#define SD_RSP_TYPE_R4 0x05
477#define SD_RSP_TYPE_R5 0x01
478#define SD_RSP_TYPE_R6 0x01
479#define SD_RSP_TYPE_R7 0x01
480
481/* SD_CONFIGURE3 */
482#define SD_RSP_80CLK_TIMEOUT_EN 0x01
483
484/* Card Transfer Reset Register */
485#define SPI_STOP 0x01
486#define XD_STOP 0x02
487#define SD_STOP 0x04
488#define MS_STOP 0x08
489#define SPI_CLR_ERR 0x10
490#define XD_CLR_ERR 0x20
491#define SD_CLR_ERR 0x40
492#define MS_CLR_ERR 0x80
493
494/* Card Data Source Register */
495#define PINGPONG_BUFFER 0x01
496#define RING_BUFFER 0x00
497
498/* Card Power Control Register */
499#define PMOS_STRG_MASK 0x10
500#define PMOS_STRG_800mA 0x10
501#define PMOS_STRG_400mA 0x00
502#define SD_POWER_OFF 0x03
503#define SD_PARTIAL_POWER_ON 0x01
504#define SD_POWER_ON 0x00
505#define SD_POWER_MASK 0x03
506#define MS_POWER_OFF 0x0C
507#define MS_PARTIAL_POWER_ON 0x04
508#define MS_POWER_ON 0x00
509#define MS_POWER_MASK 0x0C
510#define BPP_POWER_OFF 0x0F
511#define BPP_POWER_5_PERCENT_ON 0x0E
512#define BPP_POWER_10_PERCENT_ON 0x0C
513#define BPP_POWER_15_PERCENT_ON 0x08
514#define BPP_POWER_ON 0x00
515#define BPP_POWER_MASK 0x0F
516#define SD_VCC_PARTIAL_POWER_ON 0x02
517#define SD_VCC_POWER_ON 0x00
518
519/* PWR_GATE_CTRL */
520#define PWR_GATE_EN 0x01
521#define LDO3318_PWR_MASK 0x06
522#define LDO_ON 0x00
523#define LDO_SUSPEND 0x04
524#define LDO_OFF 0x06
525
526/* CARD_CLK_SOURCE */
527#define CRC_FIX_CLK (0x00 << 0)
528#define CRC_VAR_CLK0 (0x01 << 0)
529#define CRC_VAR_CLK1 (0x02 << 0)
530#define SD30_FIX_CLK (0x00 << 2)
531#define SD30_VAR_CLK0 (0x01 << 2)
532#define SD30_VAR_CLK1 (0x02 << 2)
533#define SAMPLE_FIX_CLK (0x00 << 4)
534#define SAMPLE_VAR_CLK0 (0x01 << 4)
535#define SAMPLE_VAR_CLK1 (0x02 << 4)
536
537/* HOST_SLEEP_STATE */
538#define HOST_ENTER_S1 1
539#define HOST_ENTER_S3 2
540 149
541#define MS_CFG 0xFD40 150#define MS_CFG 0xFD40
151#define SAMPLE_TIME_RISING 0x00
152#define SAMPLE_TIME_FALLING 0x80
153#define PUSH_TIME_DEFAULT 0x00
154#define PUSH_TIME_ODD 0x40
155#define NO_EXTEND_TOGGLE 0x00
156#define EXTEND_TOGGLE_CHK 0x20
157#define MS_BUS_WIDTH_1 0x00
158#define MS_BUS_WIDTH_4 0x10
159#define MS_BUS_WIDTH_8 0x18
160#define MS_2K_SECTOR_MODE 0x04
161#define MS_512_SECTOR_MODE 0x00
162#define MS_TOGGLE_TIMEOUT_EN 0x00
163#define MS_TOGGLE_TIMEOUT_DISEN 0x01
164#define MS_NO_CHECK_INT 0x02
542#define MS_TPC 0xFD41 165#define MS_TPC 0xFD41
543#define MS_TRANS_CFG 0xFD42 166#define MS_TRANS_CFG 0xFD42
167#define WAIT_INT 0x80
168#define NO_WAIT_INT 0x00
169#define NO_AUTO_READ_INT_REG 0x00
170#define AUTO_READ_INT_REG 0x40
171#define MS_CRC16_ERR 0x20
172#define MS_RDY_TIMEOUT 0x10
173#define MS_INT_CMDNK 0x08
174#define MS_INT_BREQ 0x04
175#define MS_INT_ERR 0x02
176#define MS_INT_CED 0x01
544#define MS_TRANSFER 0xFD43 177#define MS_TRANSFER 0xFD43
178#define MS_TRANSFER_START 0x80
179#define MS_TRANSFER_END 0x40
180#define MS_TRANSFER_ERR 0x20
181#define MS_BS_STATE 0x10
182#define MS_TM_READ_BYTES 0x00
183#define MS_TM_NORMAL_READ 0x01
184#define MS_TM_WRITE_BYTES 0x04
185#define MS_TM_NORMAL_WRITE 0x05
186#define MS_TM_AUTO_READ 0x08
187#define MS_TM_AUTO_WRITE 0x0C
545#define MS_INT_REG 0xFD44 188#define MS_INT_REG 0xFD44
546#define MS_BYTE_CNT 0xFD45 189#define MS_BYTE_CNT 0xFD45
547#define MS_SECTOR_CNT_L 0xFD46 190#define MS_SECTOR_CNT_L 0xFD46
@@ -549,14 +192,90 @@
549#define MS_DBUS_H 0xFD48 192#define MS_DBUS_H 0xFD48
550 193
551#define SD_CFG1 0xFDA0 194#define SD_CFG1 0xFDA0
195#define SD_CLK_DIVIDE_0 0x00
196#define SD_CLK_DIVIDE_256 0xC0
197#define SD_CLK_DIVIDE_128 0x80
198#define SD_BUS_WIDTH_1BIT 0x00
199#define SD_BUS_WIDTH_4BIT 0x01
200#define SD_BUS_WIDTH_8BIT 0x02
201#define SD_ASYNC_FIFO_NOT_RST 0x10
202#define SD_20_MODE 0x00
203#define SD_DDR_MODE 0x04
204#define SD_30_MODE 0x08
205#define SD_CLK_DIVIDE_MASK 0xC0
552#define SD_CFG2 0xFDA1 206#define SD_CFG2 0xFDA1
207#define SD_CALCULATE_CRC7 0x00
208#define SD_NO_CALCULATE_CRC7 0x80
209#define SD_CHECK_CRC16 0x00
210#define SD_NO_CHECK_CRC16 0x40
211#define SD_NO_CHECK_WAIT_CRC_TO 0x20
212#define SD_WAIT_BUSY_END 0x08
213#define SD_NO_WAIT_BUSY_END 0x00
214#define SD_CHECK_CRC7 0x00
215#define SD_NO_CHECK_CRC7 0x04
216#define SD_RSP_LEN_0 0x00
217#define SD_RSP_LEN_6 0x01
218#define SD_RSP_LEN_17 0x02
219#define SD_RSP_TYPE_R0 0x04
220#define SD_RSP_TYPE_R1 0x01
221#define SD_RSP_TYPE_R1b 0x09
222#define SD_RSP_TYPE_R2 0x02
223#define SD_RSP_TYPE_R3 0x05
224#define SD_RSP_TYPE_R4 0x05
225#define SD_RSP_TYPE_R5 0x01
226#define SD_RSP_TYPE_R6 0x01
227#define SD_RSP_TYPE_R7 0x01
553#define SD_CFG3 0xFDA2 228#define SD_CFG3 0xFDA2
229#define SD_RSP_80CLK_TIMEOUT_EN 0x01
230
554#define SD_STAT1 0xFDA3 231#define SD_STAT1 0xFDA3
232#define SD_CRC7_ERR 0x80
233#define SD_CRC16_ERR 0x40
234#define SD_CRC_WRITE_ERR 0x20
235#define SD_CRC_WRITE_ERR_MASK 0x1C
236#define GET_CRC_TIME_OUT 0x02
237#define SD_TUNING_COMPARE_ERR 0x01
555#define SD_STAT2 0xFDA4 238#define SD_STAT2 0xFDA4
239#define SD_RSP_80CLK_TIMEOUT 0x01
240
556#define SD_BUS_STAT 0xFDA5 241#define SD_BUS_STAT 0xFDA5
242#define SD_CLK_TOGGLE_EN 0x80
243#define SD_CLK_FORCE_STOP 0x40
244#define SD_DAT3_STATUS 0x10
245#define SD_DAT2_STATUS 0x08
246#define SD_DAT1_STATUS 0x04
247#define SD_DAT0_STATUS 0x02
248#define SD_CMD_STATUS 0x01
557#define SD_PAD_CTL 0xFDA6 249#define SD_PAD_CTL 0xFDA6
250#define SD_IO_USING_1V8 0x80
251#define SD_IO_USING_3V3 0x7F
252#define TYPE_A_DRIVING 0x00
253#define TYPE_B_DRIVING 0x01
254#define TYPE_C_DRIVING 0x02
255#define TYPE_D_DRIVING 0x03
558#define SD_SAMPLE_POINT_CTL 0xFDA7 256#define SD_SAMPLE_POINT_CTL 0xFDA7
257#define DDR_FIX_RX_DAT 0x00
258#define DDR_VAR_RX_DAT 0x80
259#define DDR_FIX_RX_DAT_EDGE 0x00
260#define DDR_FIX_RX_DAT_14_DELAY 0x40
261#define DDR_FIX_RX_CMD 0x00
262#define DDR_VAR_RX_CMD 0x20
263#define DDR_FIX_RX_CMD_POS_EDGE 0x00
264#define DDR_FIX_RX_CMD_14_DELAY 0x10
265#define SD20_RX_POS_EDGE 0x00
266#define SD20_RX_14_DELAY 0x08
267#define SD20_RX_SEL_MASK 0x08
559#define SD_PUSH_POINT_CTL 0xFDA8 268#define SD_PUSH_POINT_CTL 0xFDA8
269#define DDR_FIX_TX_CMD_DAT 0x00
270#define DDR_VAR_TX_CMD_DAT 0x80
271#define DDR_FIX_TX_DAT_14_TSU 0x00
272#define DDR_FIX_TX_DAT_12_TSU 0x40
273#define DDR_FIX_TX_CMD_NEG_EDGE 0x00
274#define DDR_FIX_TX_CMD_14_AHEAD 0x20
275#define SD20_TX_NEG_EDGE 0x00
276#define SD20_TX_14_AHEAD 0x10
277#define SD20_TX_SEL_MASK 0x10
278#define DDR_VAR_SDCLK_POL_SWAP 0x01
560#define SD_CMD0 0xFDA9 279#define SD_CMD0 0xFDA9
561#define SD_CMD_START 0x40 280#define SD_CMD_START 0x40
562#define SD_CMD1 0xFDAA 281#define SD_CMD1 0xFDAA
@@ -569,60 +288,203 @@
569#define SD_BLOCK_CNT_L 0xFDB1 288#define SD_BLOCK_CNT_L 0xFDB1
570#define SD_BLOCK_CNT_H 0xFDB2 289#define SD_BLOCK_CNT_H 0xFDB2
571#define SD_TRANSFER 0xFDB3 290#define SD_TRANSFER 0xFDB3
291#define SD_TRANSFER_START 0x80
292#define SD_TRANSFER_END 0x40
293#define SD_STAT_IDLE 0x20
294#define SD_TRANSFER_ERR 0x10
295#define SD_TM_NORMAL_WRITE 0x00
296#define SD_TM_AUTO_WRITE_3 0x01
297#define SD_TM_AUTO_WRITE_4 0x02
298#define SD_TM_AUTO_READ_3 0x05
299#define SD_TM_AUTO_READ_4 0x06
300#define SD_TM_CMD_RSP 0x08
301#define SD_TM_AUTO_WRITE_1 0x09
302#define SD_TM_AUTO_WRITE_2 0x0A
303#define SD_TM_NORMAL_READ 0x0C
304#define SD_TM_AUTO_READ_1 0x0D
305#define SD_TM_AUTO_READ_2 0x0E
306#define SD_TM_AUTO_TUNING 0x0F
572#define SD_CMD_STATE 0xFDB5 307#define SD_CMD_STATE 0xFDB5
308#define SD_CMD_IDLE 0x80
309
573#define SD_DATA_STATE 0xFDB6 310#define SD_DATA_STATE 0xFDB6
311#define SD_DATA_IDLE 0x80
574 312
575#define SRCTL 0xFC13 313#define SRCTL 0xFC13
576 314
577#define DCM_DRP_CTL 0xFC23 315#define DCM_DRP_CTL 0xFC23
578#define DCM_DRP_TRIG 0xFC24 316#define DCM_RESET 0x08
579#define DCM_DRP_CFG 0xFC25 317#define DCM_LOCKED 0x04
580#define DCM_DRP_WR_DATA_L 0xFC26 318#define DCM_208M 0x00
581#define DCM_DRP_WR_DATA_H 0xFC27 319#define DCM_TX 0x01
582#define DCM_DRP_RD_DATA_L 0xFC28 320#define DCM_RX 0x02
583#define DCM_DRP_RD_DATA_H 0xFC29 321#define DCM_DRP_TRIG 0xFC24
322#define DRP_START 0x80
323#define DRP_DONE 0x40
324#define DCM_DRP_CFG 0xFC25
325#define DRP_WRITE 0x80
326#define DRP_READ 0x00
327#define DCM_WRITE_ADDRESS_50 0x50
328#define DCM_WRITE_ADDRESS_51 0x51
329#define DCM_READ_ADDRESS_00 0x00
330#define DCM_READ_ADDRESS_51 0x51
331#define DCM_DRP_WR_DATA_L 0xFC26
332#define DCM_DRP_WR_DATA_H 0xFC27
333#define DCM_DRP_RD_DATA_L 0xFC28
334#define DCM_DRP_RD_DATA_H 0xFC29
584#define SD_VPCLK0_CTL 0xFC2A 335#define SD_VPCLK0_CTL 0xFC2A
585#define SD_VPCLK1_CTL 0xFC2B 336#define SD_VPCLK1_CTL 0xFC2B
586#define SD_DCMPS0_CTL 0xFC2C 337#define SD_DCMPS0_CTL 0xFC2C
587#define SD_DCMPS1_CTL 0xFC2D 338#define SD_DCMPS1_CTL 0xFC2D
588#define SD_VPTX_CTL SD_VPCLK0_CTL 339#define SD_VPTX_CTL SD_VPCLK0_CTL
589#define SD_VPRX_CTL SD_VPCLK1_CTL 340#define SD_VPRX_CTL SD_VPCLK1_CTL
341#define PHASE_CHANGE 0x80
342#define PHASE_NOT_RESET 0x40
590#define SD_DCMPS_TX_CTL SD_DCMPS0_CTL 343#define SD_DCMPS_TX_CTL SD_DCMPS0_CTL
591#define SD_DCMPS_RX_CTL SD_DCMPS1_CTL 344#define SD_DCMPS_RX_CTL SD_DCMPS1_CTL
345#define DCMPS_CHANGE 0x80
346#define DCMPS_CHANGE_DONE 0x40
347#define DCMPS_ERROR 0x20
348#define DCMPS_CURRENT_PHASE 0x1F
592#define CARD_CLK_SOURCE 0xFC2E 349#define CARD_CLK_SOURCE 0xFC2E
593 350#define CRC_FIX_CLK (0x00 << 0)
351#define CRC_VAR_CLK0 (0x01 << 0)
352#define CRC_VAR_CLK1 (0x02 << 0)
353#define SD30_FIX_CLK (0x00 << 2)
354#define SD30_VAR_CLK0 (0x01 << 2)
355#define SD30_VAR_CLK1 (0x02 << 2)
356#define SAMPLE_FIX_CLK (0x00 << 4)
357#define SAMPLE_VAR_CLK0 (0x01 << 4)
358#define SAMPLE_VAR_CLK1 (0x02 << 4)
594#define CARD_PWR_CTL 0xFD50 359#define CARD_PWR_CTL 0xFD50
360#define PMOS_STRG_MASK 0x10
361#define PMOS_STRG_800mA 0x10
362#define PMOS_STRG_400mA 0x00
363#define SD_POWER_OFF 0x03
364#define SD_PARTIAL_POWER_ON 0x01
365#define SD_POWER_ON 0x00
366#define SD_POWER_MASK 0x03
367#define MS_POWER_OFF 0x0C
368#define MS_PARTIAL_POWER_ON 0x04
369#define MS_POWER_ON 0x00
370#define MS_POWER_MASK 0x0C
371#define BPP_POWER_OFF 0x0F
372#define BPP_POWER_5_PERCENT_ON 0x0E
373#define BPP_POWER_10_PERCENT_ON 0x0C
374#define BPP_POWER_15_PERCENT_ON 0x08
375#define BPP_POWER_ON 0x00
376#define BPP_POWER_MASK 0x0F
377#define SD_VCC_PARTIAL_POWER_ON 0x02
378#define SD_VCC_POWER_ON 0x00
595#define CARD_CLK_SWITCH 0xFD51 379#define CARD_CLK_SWITCH 0xFD51
596#define RTL8411B_PACKAGE_MODE 0xFD51 380#define RTL8411B_PACKAGE_MODE 0xFD51
597#define CARD_SHARE_MODE 0xFD52 381#define CARD_SHARE_MODE 0xFD52
382#define CARD_SHARE_MASK 0x0F
383#define CARD_SHARE_MULTI_LUN 0x00
384#define CARD_SHARE_NORMAL 0x00
385#define CARD_SHARE_48_SD 0x04
386#define CARD_SHARE_48_MS 0x08
387#define CARD_SHARE_BAROSSA_SD 0x01
388#define CARD_SHARE_BAROSSA_MS 0x02
598#define CARD_DRIVE_SEL 0xFD53 389#define CARD_DRIVE_SEL 0xFD53
390#define MS_DRIVE_8mA (0x01 << 6)
391#define MMC_DRIVE_8mA (0x01 << 4)
392#define XD_DRIVE_8mA (0x01 << 2)
393#define GPIO_DRIVE_8mA 0x01
394#define RTS5209_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
395 XD_DRIVE_8mA | GPIO_DRIVE_8mA)
396#define RTL8411_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
397 XD_DRIVE_8mA)
398#define RTSX_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | GPIO_DRIVE_8mA)
399
599#define CARD_STOP 0xFD54 400#define CARD_STOP 0xFD54
401#define SPI_STOP 0x01
402#define XD_STOP 0x02
403#define SD_STOP 0x04
404#define MS_STOP 0x08
405#define SPI_CLR_ERR 0x10
406#define XD_CLR_ERR 0x20
407#define SD_CLR_ERR 0x40
408#define MS_CLR_ERR 0x80
600#define CARD_OE 0xFD55 409#define CARD_OE 0xFD55
410#define SD_OUTPUT_EN 0x04
411#define MS_OUTPUT_EN 0x08
601#define CARD_AUTO_BLINK 0xFD56 412#define CARD_AUTO_BLINK 0xFD56
602#define CARD_GPIO_DIR 0xFD57 413#define CARD_GPIO_DIR 0xFD57
603#define CARD_GPIO 0xFD58 414#define CARD_GPIO 0xFD58
604#define CARD_DATA_SOURCE 0xFD5B 415#define CARD_DATA_SOURCE 0xFD5B
416#define PINGPONG_BUFFER 0x01
417#define RING_BUFFER 0x00
605#define SD30_CLK_DRIVE_SEL 0xFD5A 418#define SD30_CLK_DRIVE_SEL 0xFD5A
419#define DRIVER_TYPE_A 0x05
420#define DRIVER_TYPE_B 0x03
421#define DRIVER_TYPE_C 0x02
422#define DRIVER_TYPE_D 0x01
606#define CARD_SELECT 0xFD5C 423#define CARD_SELECT 0xFD5C
424#define SD_MOD_SEL 2
425#define MS_MOD_SEL 3
607#define SD30_DRIVE_SEL 0xFD5E 426#define SD30_DRIVE_SEL 0xFD5E
427#define CFG_DRIVER_TYPE_A 0x02
428#define CFG_DRIVER_TYPE_B 0x03
429#define CFG_DRIVER_TYPE_C 0x01
430#define CFG_DRIVER_TYPE_D 0x00
608#define SD30_CMD_DRIVE_SEL 0xFD5E 431#define SD30_CMD_DRIVE_SEL 0xFD5E
609#define SD30_DAT_DRIVE_SEL 0xFD5F 432#define SD30_DAT_DRIVE_SEL 0xFD5F
610#define CARD_CLK_EN 0xFD69 433#define CARD_CLK_EN 0xFD69
434#define SD_CLK_EN 0x04
435#define MS_CLK_EN 0x08
611#define SDIO_CTRL 0xFD6B 436#define SDIO_CTRL 0xFD6B
612#define CD_PAD_CTL 0xFD73 437#define CD_PAD_CTL 0xFD73
613 438#define CD_DISABLE_MASK 0x07
439#define MS_CD_DISABLE 0x04
440#define SD_CD_DISABLE 0x02
441#define XD_CD_DISABLE 0x01
442#define CD_DISABLE 0x07
443#define CD_ENABLE 0x00
444#define MS_CD_EN_ONLY 0x03
445#define SD_CD_EN_ONLY 0x05
446#define XD_CD_EN_ONLY 0x06
447#define FORCE_CD_LOW_MASK 0x38
448#define FORCE_CD_XD_LOW 0x08
449#define FORCE_CD_SD_LOW 0x10
450#define FORCE_CD_MS_LOW 0x20
451#define CD_AUTO_DISABLE 0x40
614#define FPDCTL 0xFC00 452#define FPDCTL 0xFC00
453#define SSC_POWER_DOWN 0x01
454#define SD_OC_POWER_DOWN 0x02
455#define ALL_POWER_DOWN 0x07
456#define OC_POWER_DOWN 0x06
615#define PDINFO 0xFC01 457#define PDINFO 0xFC01
616 458
617#define CLK_CTL 0xFC02 459#define CLK_CTL 0xFC02
460#define CHANGE_CLK 0x01
461#define CLK_LOW_FREQ 0x01
462
618#define CLK_DIV 0xFC03 463#define CLK_DIV 0xFC03
464#define CLK_DIV_1 0x01
465#define CLK_DIV_2 0x02
466#define CLK_DIV_4 0x03
467#define CLK_DIV_8 0x04
619#define CLK_SEL 0xFC04 468#define CLK_SEL 0xFC04
620 469
621#define SSC_DIV_N_0 0xFC0F 470#define SSC_DIV_N_0 0xFC0F
622#define SSC_DIV_N_1 0xFC10 471#define SSC_DIV_N_1 0xFC10
623#define SSC_CTL1 0xFC11 472#define SSC_CTL1 0xFC11
473#define SSC_RSTB 0x80
474#define SSC_8X_EN 0x40
475#define SSC_FIX_FRAC 0x20
476#define SSC_SEL_1M 0x00
477#define SSC_SEL_2M 0x08
478#define SSC_SEL_4M 0x10
479#define SSC_SEL_8M 0x18
624#define SSC_CTL2 0xFC12 480#define SSC_CTL2 0xFC12
625 481#define SSC_DEPTH_MASK 0x07
482#define SSC_DEPTH_DISALBE 0x00
483#define SSC_DEPTH_4M 0x01
484#define SSC_DEPTH_2M 0x02
485#define SSC_DEPTH_1M 0x03
486#define SSC_DEPTH_500K 0x04
487#define SSC_DEPTH_250K 0x05
626#define RCCTL 0xFC14 488#define RCCTL 0xFC14
627 489
628#define FPGA_PULL_CTL 0xFC1D 490#define FPGA_PULL_CTL 0xFC1D
@@ -630,6 +492,24 @@
630#define GPIO_CTL 0xFC1F 492#define GPIO_CTL 0xFC1F
631 493
632#define LDO_CTL 0xFC1E 494#define LDO_CTL 0xFC1E
495#define BPP_ASIC_1V7 0x00
496#define BPP_ASIC_1V8 0x01
497#define BPP_ASIC_1V9 0x02
498#define BPP_ASIC_2V0 0x03
499#define BPP_ASIC_2V7 0x04
500#define BPP_ASIC_2V8 0x05
501#define BPP_ASIC_3V2 0x06
502#define BPP_ASIC_3V3 0x07
503#define BPP_REG_TUNED18 0x07
504#define BPP_TUNED18_SHIFT_8402 5
505#define BPP_TUNED18_SHIFT_8411 4
506#define BPP_PAD_MASK 0x04
507#define BPP_PAD_3V3 0x04
508#define BPP_PAD_1V8 0x00
509#define BPP_LDO_POWB 0x03
510#define BPP_LDO_ON 0x00
511#define BPP_LDO_SUSPEND 0x02
512#define BPP_LDO_OFF 0x03
633#define SYS_VER 0xFC32 513#define SYS_VER 0xFC32
634 514
635#define CARD_PULL_CTL1 0xFD60 515#define CARD_PULL_CTL1 0xFD60
@@ -642,6 +522,10 @@
642/* PCI Express Related Registers */ 522/* PCI Express Related Registers */
643#define IRQEN0 0xFE20 523#define IRQEN0 0xFE20
644#define IRQSTAT0 0xFE21 524#define IRQSTAT0 0xFE21
525#define DMA_DONE_INT 0x80
526#define SUSPEND_INT 0x40
527#define LINK_RDY_INT 0x20
528#define LINK_DOWN_INT 0x10
645#define IRQEN1 0xFE22 529#define IRQEN1 0xFE22
646#define IRQSTAT1 0xFE23 530#define IRQSTAT1 0xFE23
647#define TLPRIEN 0xFE24 531#define TLPRIEN 0xFE24
@@ -653,6 +537,16 @@
653#define DMATC2 0xFE2A 537#define DMATC2 0xFE2A
654#define DMATC3 0xFE2B 538#define DMATC3 0xFE2B
655#define DMACTL 0xFE2C 539#define DMACTL 0xFE2C
540#define DMA_RST 0x80
541#define DMA_BUSY 0x04
542#define DMA_DIR_TO_CARD 0x00
543#define DMA_DIR_FROM_CARD 0x02
544#define DMA_EN 0x01
545#define DMA_128 (0 << 4)
546#define DMA_256 (1 << 4)
547#define DMA_512 (2 << 4)
548#define DMA_1024 (3 << 4)
549#define DMA_PACK_SIZE_MASK 0x30
656#define BCTL 0xFE2D 550#define BCTL 0xFE2D
657#define RBBC0 0xFE2E 551#define RBBC0 0xFE2E
658#define RBBC1 0xFE2F 552#define RBBC1 0xFE2F
@@ -678,14 +572,21 @@
678#define MSGTXDATA2 0xFE46 572#define MSGTXDATA2 0xFE46
679#define MSGTXDATA3 0xFE47 573#define MSGTXDATA3 0xFE47
680#define MSGTXCTL 0xFE48 574#define MSGTXCTL 0xFE48
681#define PETXCFG 0xFE49
682#define LTR_CTL 0xFE4A 575#define LTR_CTL 0xFE4A
683#define OBFF_CFG 0xFE4C 576#define OBFF_CFG 0xFE4C
684 577
685#define CDRESUMECTL 0xFE52 578#define CDRESUMECTL 0xFE52
686#define WAKE_SEL_CTL 0xFE54 579#define WAKE_SEL_CTL 0xFE54
580#define PCLK_CTL 0xFE55
581#define PCLK_MODE_SEL 0x20
687#define PME_FORCE_CTL 0xFE56 582#define PME_FORCE_CTL 0xFE56
583
688#define ASPM_FORCE_CTL 0xFE57 584#define ASPM_FORCE_CTL 0xFE57
585#define FORCE_ASPM_CTL0 0x10
586#define FORCE_ASPM_VAL_MASK 0x03
587#define FORCE_ASPM_L1_EN 0x02
588#define FORCE_ASPM_L0_EN 0x01
589#define FORCE_ASPM_NO_ASPM 0x00
689#define PM_CLK_FORCE_CTL 0xFE58 590#define PM_CLK_FORCE_CTL 0xFE58
690#define FUNC_FORCE_CTL 0xFE59 591#define FUNC_FORCE_CTL 0xFE59
691#define PERST_GLITCH_WIDTH 0xFE5C 592#define PERST_GLITCH_WIDTH 0xFE5C
@@ -693,19 +594,36 @@
693#define RESET_LOAD_REG 0xFE5E 594#define RESET_LOAD_REG 0xFE5E
694#define EFUSE_CONTENT 0xFE5F 595#define EFUSE_CONTENT 0xFE5F
695#define HOST_SLEEP_STATE 0xFE60 596#define HOST_SLEEP_STATE 0xFE60
696#define SDIO_CFG 0xFE70 597#define HOST_ENTER_S1 1
598#define HOST_ENTER_S3 2
697 599
600#define SDIO_CFG 0xFE70
601#define PM_EVENT_DEBUG 0xFE71
602#define PME_DEBUG_0 0x08
698#define NFTS_TX_CTRL 0xFE72 603#define NFTS_TX_CTRL 0xFE72
699 604
700#define PWR_GATE_CTRL 0xFE75 605#define PWR_GATE_CTRL 0xFE75
606#define PWR_GATE_EN 0x01
607#define LDO3318_PWR_MASK 0x06
608#define LDO_ON 0x00
609#define LDO_SUSPEND 0x04
610#define LDO_OFF 0x06
701#define PWD_SUSPEND_EN 0xFE76 611#define PWD_SUSPEND_EN 0xFE76
702#define LDO_PWR_SEL 0xFE78 612#define LDO_PWR_SEL 0xFE78
703 613
614#define L1SUB_CONFIG1 0xFE8D
615#define L1SUB_CONFIG2 0xFE8E
616#define L1SUB_AUTO_CFG 0x02
617#define L1SUB_CONFIG3 0xFE8F
618
704#define DUMMY_REG_RESET_0 0xFE90 619#define DUMMY_REG_RESET_0 0xFE90
705 620
706#define AUTOLOAD_CFG_BASE 0xFF00 621#define AUTOLOAD_CFG_BASE 0xFF00
622#define PETXCFG 0xFF03
707 623
708#define PM_CTRL1 0xFF44 624#define PM_CTRL1 0xFF44
625#define CD_RESUME_EN_MASK 0xF0
626
709#define PM_CTRL2 0xFF45 627#define PM_CTRL2 0xFF45
710#define PM_CTRL3 0xFF46 628#define PM_CTRL3 0xFF46
711#define SDIO_SEND_PME_EN 0x80 629#define SDIO_SEND_PME_EN 0x80
@@ -726,18 +644,125 @@
726#define IMAGE_FLAG_ADDR0 0xCE80 644#define IMAGE_FLAG_ADDR0 0xCE80
727#define IMAGE_FLAG_ADDR1 0xCE81 645#define IMAGE_FLAG_ADDR1 0xCE81
728 646
647#define RREF_CFG 0xFF6C
648#define RREF_VBGSEL_MASK 0x38
649#define RREF_VBGSEL_1V25 0x28
650
651#define OOBS_CONFIG 0xFF6E
652#define OOBS_AUTOK_DIS 0x80
653#define OOBS_VAL_MASK 0x1F
654
655#define LDO_DV18_CFG 0xFF70
656#define LDO_DV18_SR_MASK 0xC0
657#define LDO_DV18_SR_DF 0x40
658
659#define LDO_CONFIG2 0xFF71
660#define LDO_D3318_MASK 0x07
661#define LDO_D3318_33V 0x07
662#define LDO_D3318_18V 0x02
663
664#define LDO_VCC_CFG0 0xFF72
665#define LDO_VCC_LMTVTH_MASK 0x30
666#define LDO_VCC_LMTVTH_2A 0x10
667
668#define LDO_VCC_CFG1 0xFF73
669#define LDO_VCC_REF_TUNE_MASK 0x30
670#define LDO_VCC_REF_1V2 0x20
671#define LDO_VCC_TUNE_MASK 0x07
672#define LDO_VCC_1V8 0x04
673#define LDO_VCC_3V3 0x07
674#define LDO_VCC_LMT_EN 0x08
675
676#define LDO_VIO_CFG 0xFF75
677#define LDO_VIO_SR_MASK 0xC0
678#define LDO_VIO_SR_DF 0x40
679#define LDO_VIO_REF_TUNE_MASK 0x30
680#define LDO_VIO_REF_1V2 0x20
681#define LDO_VIO_TUNE_MASK 0x07
682#define LDO_VIO_1V7 0x03
683#define LDO_VIO_1V8 0x04
684#define LDO_VIO_3V3 0x07
685
686#define LDO_DV12S_CFG 0xFF76
687#define LDO_REF12_TUNE_MASK 0x18
688#define LDO_REF12_TUNE_DF 0x10
689#define LDO_D12_TUNE_MASK 0x07
690#define LDO_D12_TUNE_DF 0x04
691
692#define LDO_AV12S_CFG 0xFF77
693#define LDO_AV12S_TUNE_MASK 0x07
694#define LDO_AV12S_TUNE_DF 0x04
695
696#define SD40_LDO_CTL1 0xFE7D
697#define SD40_VIO_TUNE_MASK 0x70
698#define SD40_VIO_TUNE_1V7 0x30
699#define SD_VIO_LDO_1V8 0x40
700#define SD_VIO_LDO_3V3 0x70
701
729/* Phy register */ 702/* Phy register */
730#define PHY_PCR 0x00 703#define PHY_PCR 0x00
704#define PHY_PCR_FORCE_CODE 0xB000
705#define PHY_PCR_OOBS_CALI_50 0x0800
706#define PHY_PCR_OOBS_VCM_08 0x0200
707#define PHY_PCR_OOBS_SEN_90 0x0040
708#define PHY_PCR_RSSI_EN 0x0002
709#define PHY_PCR_RX10K 0x0001
710
731#define PHY_RCR0 0x01 711#define PHY_RCR0 0x01
732#define PHY_RCR1 0x02 712#define PHY_RCR1 0x02
713#define PHY_RCR1_ADP_TIME_4 0x0400
714#define PHY_RCR1_VCO_COARSE 0x001F
715#define PHY_SSCCR2 0x02
716#define PHY_SSCCR2_PLL_NCODE 0x0A00
717#define PHY_SSCCR2_TIME0 0x001C
718#define PHY_SSCCR2_TIME2_WIDTH 0x0003
719
733#define PHY_RCR2 0x03 720#define PHY_RCR2 0x03
721#define PHY_RCR2_EMPHASE_EN 0x8000
722#define PHY_RCR2_NADJR 0x4000
723#define PHY_RCR2_CDR_SR_2 0x0100
724#define PHY_RCR2_FREQSEL_12 0x0040
725#define PHY_RCR2_CDR_SC_12P 0x0010
726#define PHY_RCR2_CALIB_LATE 0x0002
727#define PHY_SSCCR3 0x03
728#define PHY_SSCCR3_STEP_IN 0x2740
729#define PHY_SSCCR3_CHECK_DELAY 0x0008
730#define _PHY_ANA03 0x03
731#define _PHY_ANA03_TIMER_MAX 0x2700
732#define _PHY_ANA03_OOBS_DEB_EN 0x0040
733#define _PHY_CMU_DEBUG_EN 0x0008
734
734#define PHY_RTCR 0x04 735#define PHY_RTCR 0x04
735#define PHY_RDR 0x05 736#define PHY_RDR 0x05
737#define PHY_RDR_RXDSEL_1_9 0x4000
738#define PHY_SSC_AUTO_PWD 0x0600
736#define PHY_TCR0 0x06 739#define PHY_TCR0 0x06
737#define PHY_TCR1 0x07 740#define PHY_TCR1 0x07
738#define PHY_TUNE 0x08 741#define PHY_TUNE 0x08
742#define PHY_TUNE_TUNEREF_1_0 0x4000
743#define PHY_TUNE_VBGSEL_1252 0x0C00
744#define PHY_TUNE_SDBUS_33 0x0200
745#define PHY_TUNE_TUNED18 0x01C0
746#define PHY_TUNE_TUNED12 0X0020
747#define PHY_TUNE_TUNEA12 0x0004
748#define PHY_TUNE_VOLTAGE_MASK 0xFC3F
749#define PHY_TUNE_VOLTAGE_3V3 0x03C0
750#define PHY_TUNE_D18_1V8 0x0100
751#define PHY_TUNE_D18_1V7 0x0080
752#define PHY_ANA08 0x08
753#define PHY_ANA08_RX_EQ_DCGAIN 0x5000
754#define PHY_ANA08_SEL_RX_EN 0x0400
755#define PHY_ANA08_RX_EQ_VAL 0x03C0
756#define PHY_ANA08_SCP 0x0020
757#define PHY_ANA08_SEL_IPI 0x0004
758
739#define PHY_IMR 0x09 759#define PHY_IMR 0x09
740#define PHY_BPCR 0x0A 760#define PHY_BPCR 0x0A
761#define PHY_BPCR_IBRXSEL 0x0400
762#define PHY_BPCR_IBTXSEL 0x0100
763#define PHY_BPCR_IB_FILTER 0x0080
764#define PHY_BPCR_CMIRROR_EN 0x0040
765
741#define PHY_BIST 0x0B 766#define PHY_BIST 0x0B
742#define PHY_RAW_L 0x0C 767#define PHY_RAW_L 0x0C
743#define PHY_RAW_H 0x0D 768#define PHY_RAW_H 0x0D
@@ -745,6 +770,7 @@
745#define PHY_HOST_CLK_CTRL 0x0F 770#define PHY_HOST_CLK_CTRL 0x0F
746#define PHY_DMR 0x10 771#define PHY_DMR 0x10
747#define PHY_BACR 0x11 772#define PHY_BACR 0x11
773#define PHY_BACR_BASIC_MASK 0xFFF3
748#define PHY_IER 0x12 774#define PHY_IER 0x12
749#define PHY_BCSR 0x13 775#define PHY_BCSR 0x13
750#define PHY_BPR 0x14 776#define PHY_BPR 0x14
@@ -752,80 +778,70 @@
752#define PHY_BPNR 0x16 778#define PHY_BPNR 0x16
753#define PHY_BRNR2 0x17 779#define PHY_BRNR2 0x17
754#define PHY_BENR 0x18 780#define PHY_BENR 0x18
755#define PHY_REG_REV 0x19 781#define PHY_REV 0x19
782#define PHY_REV_RESV 0xE000
783#define PHY_REV_RXIDLE_LATCHED 0x1000
784#define PHY_REV_P1_EN 0x0800
785#define PHY_REV_RXIDLE_EN 0x0400
786#define PHY_REV_CLKREQ_TX_EN 0x0200
787#define PHY_REV_CLKREQ_RX_EN 0x0100
788#define PHY_REV_CLKREQ_DT_1_0 0x0040
789#define PHY_REV_STOP_CLKRD 0x0020
790#define PHY_REV_RX_PWST 0x0008
791#define PHY_REV_STOP_CLKWR 0x0004
792#define _PHY_REV0 0x19
793#define _PHY_REV0_FILTER_OUT 0x3800
794#define _PHY_REV0_CDR_BYPASS_PFD 0x0100
795#define _PHY_REV0_CDR_RX_IDLE_BYPASS 0x0002
796
756#define PHY_FLD0 0x1A 797#define PHY_FLD0 0x1A
798#define PHY_ANA1A 0x1A
799#define PHY_ANA1A_TXR_LOOPBACK 0x2000
800#define PHY_ANA1A_RXT_BIST 0x0500
801#define PHY_ANA1A_TXR_BIST 0x0040
802#define PHY_ANA1A_REV 0x0006
757#define PHY_FLD1 0x1B 803#define PHY_FLD1 0x1B
758#define PHY_FLD2 0x1C 804#define PHY_FLD2 0x1C
759#define PHY_FLD3 0x1D 805#define PHY_FLD3 0x1D
806#define PHY_FLD3_TIMER_4 0x0800
807#define PHY_FLD3_TIMER_6 0x0020
808#define PHY_FLD3_RXDELINK 0x0004
809#define PHY_ANA1D 0x1D
810#define PHY_ANA1D_DEBUG_ADDR 0x0004
811#define _PHY_FLD0 0x1D
812#define _PHY_FLD0_CLK_REQ_20C 0x8000
813#define _PHY_FLD0_RX_IDLE_EN 0x1000
814#define _PHY_FLD0_BIT_ERR_RSTN 0x0800
815#define _PHY_FLD0_BER_COUNT 0x01E0
816#define _PHY_FLD0_BER_TIMER 0x001E
817#define _PHY_FLD0_CHECK_EN 0x0001
818
760#define PHY_FLD4 0x1E 819#define PHY_FLD4 0x1E
820#define PHY_FLD4_FLDEN_SEL 0x4000
821#define PHY_FLD4_REQ_REF 0x2000
822#define PHY_FLD4_RXAMP_OFF 0x1000
823#define PHY_FLD4_REQ_ADDA 0x0800
824#define PHY_FLD4_BER_COUNT 0x00E0
825#define PHY_FLD4_BER_TIMER 0x000A
826#define PHY_FLD4_BER_CHK_EN 0x0001
827#define PHY_DIG1E 0x1E
828#define PHY_DIG1E_REV 0x4000
829#define PHY_DIG1E_D0_X_D1 0x1000
830#define PHY_DIG1E_RX_ON_HOST 0x0800
831#define PHY_DIG1E_RCLK_REF_HOST 0x0400
832#define PHY_DIG1E_RCLK_TX_EN_KEEP 0x0040
833#define PHY_DIG1E_RCLK_TX_TERM_KEEP 0x0020
834#define PHY_DIG1E_RCLK_RX_EIDLE_ON 0x0010
835#define PHY_DIG1E_TX_TERM_KEEP 0x0008
836#define PHY_DIG1E_RX_TERM_KEEP 0x0004
837#define PHY_DIG1E_TX_EN_KEEP 0x0002
838#define PHY_DIG1E_RX_EN_KEEP 0x0001
761#define PHY_DUM_REG 0x1F 839#define PHY_DUM_REG 0x1F
762 840
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
772#define PCR_SETTING_REG1 0x724 841#define PCR_SETTING_REG1 0x724
773#define PCR_SETTING_REG2 0x814 842#define PCR_SETTING_REG2 0x814
774#define PCR_SETTING_REG3 0x747 843#define PCR_SETTING_REG3 0x747
775 844
776/* Phy bits */
777#define PHY_PCR_FORCE_CODE 0xB000
778#define PHY_PCR_OOBS_CALI_50 0x0800
779#define PHY_PCR_OOBS_VCM_08 0x0200
780#define PHY_PCR_OOBS_SEN_90 0x0040
781#define PHY_PCR_RSSI_EN 0x0002
782
783#define PHY_RCR1_ADP_TIME 0x0100
784#define PHY_RCR1_VCO_COARSE 0x001F
785
786#define PHY_RCR2_EMPHASE_EN 0x8000
787#define PHY_RCR2_NADJR 0x4000
788#define PHY_RCR2_CDR_CP_10 0x0400
789#define PHY_RCR2_CDR_SR_2 0x0100
790#define PHY_RCR2_FREQSEL_12 0x0040
791#define PHY_RCR2_CPADJEN 0x0020
792#define PHY_RCR2_CDR_SC_8 0x0008
793#define PHY_RCR2_CALIB_LATE 0x0002
794
795#define PHY_RDR_RXDSEL_1_9 0x4000
796
797#define PHY_TUNE_TUNEREF_1_0 0x4000
798#define PHY_TUNE_VBGSEL_1252 0x0C00
799#define PHY_TUNE_SDBUS_33 0x0200
800#define PHY_TUNE_TUNED18 0x01C0
801#define PHY_TUNE_TUNED12 0X0020
802
803#define PHY_BPCR_IBRXSEL 0x0400
804#define PHY_BPCR_IBTXSEL 0x0100
805#define PHY_BPCR_IB_FILTER 0x0080
806#define PHY_BPCR_CMIRROR_EN 0x0040
807
808#define PHY_REG_REV_RESV 0xE000
809#define PHY_REG_REV_RXIDLE_LATCHED 0x1000
810#define PHY_REG_REV_P1_EN 0x0800
811#define PHY_REG_REV_RXIDLE_EN 0x0400
812#define PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 0x0040
813#define PHY_REG_REV_STOP_CLKRD 0x0020
814#define PHY_REG_REV_RX_PWST 0x0008
815#define PHY_REG_REV_STOP_CLKWR 0x0004
816
817#define PHY_FLD3_TIMER_4 0x7800
818#define PHY_FLD3_TIMER_6 0x00E0
819#define PHY_FLD3_RXDELINK 0x0004
820
821#define PHY_FLD4_FLDEN_SEL 0x4000
822#define PHY_FLD4_REQ_REF 0x2000
823#define PHY_FLD4_RXAMP_OFF 0x1000
824#define PHY_FLD4_REQ_ADDA 0x0800
825#define PHY_FLD4_BER_COUNT 0x00E0
826#define PHY_FLD4_BER_TIMER 0x000A
827#define PHY_FLD4_BER_CHK_EN 0x0001
828
829#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) 845#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0)
830 846
831struct rtsx_pcr; 847struct rtsx_pcr;
@@ -835,6 +851,8 @@ struct pcr_handle {
835}; 851};
836 852
837struct pcr_ops { 853struct pcr_ops {
854 int (*write_phy)(struct rtsx_pcr *pcr, u8 addr, u16 val);
855 int (*read_phy)(struct rtsx_pcr *pcr, u8 addr, u16 *val);
838 int (*extra_init_hw)(struct rtsx_pcr *pcr); 856 int (*extra_init_hw)(struct rtsx_pcr *pcr);
839 int (*optimize_phy)(struct rtsx_pcr *pcr); 857 int (*optimize_phy)(struct rtsx_pcr *pcr);
840 int (*turn_on_led)(struct rtsx_pcr *pcr); 858 int (*turn_on_led)(struct rtsx_pcr *pcr);
@@ -856,6 +874,7 @@ enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
856struct rtsx_pcr { 874struct rtsx_pcr {
857 struct pci_dev *pci; 875 struct pci_dev *pci;
858 unsigned int id; 876 unsigned int id;
877 int pcie_cap;
859 878
860 /* pci resources */ 879 /* pci resources */
861 unsigned long addr; 880 unsigned long addr;
@@ -928,6 +947,8 @@ struct rtsx_pcr {
928 const struct pcr_ops *ops; 947 const struct pcr_ops *ops;
929 enum PDEV_STAT state; 948 enum PDEV_STAT state;
930 949
950 u16 reg_pm_ctrl3;
951
931 int num_slots; 952 int num_slots;
932 struct rtsx_slot *slots; 953 struct rtsx_slot *slots;
933}; 954};
@@ -935,6 +956,10 @@ struct rtsx_pcr {
935#define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid)) 956#define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid))
936#define PCI_VID(pcr) ((pcr)->pci->vendor) 957#define PCI_VID(pcr) ((pcr)->pci->vendor)
937#define PCI_PID(pcr) ((pcr)->pci->device) 958#define PCI_PID(pcr) ((pcr)->pci->device)
959#define is_version(pcr, pid, ver) \
960 (CHK_PCI_PID(pcr, pid) && (pcr)->ic_version == (ver))
961#define pcr_dbg(pcr, fmt, arg...) \
962 dev_dbg(&(pcr)->pci->dev, fmt, ##arg)
938 963
939#define SDR104_PHASE(val) ((val) & 0xFF) 964#define SDR104_PHASE(val) ((val) & 0xFF)
940#define SDR50_PHASE(val) (((val) >> 8) & 0xFF) 965#define SDR50_PHASE(val) (((val) >> 8) & 0xFF)
@@ -1004,4 +1029,17 @@ static inline void rtsx_pci_write_be32(struct rtsx_pcr *pcr, u16 reg, u32 val)
1004 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 3, 0xFF, val); 1029 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 3, 0xFF, val);
1005} 1030}
1006 1031
1032static inline int rtsx_pci_update_phy(struct rtsx_pcr *pcr, u8 addr,
1033 u16 mask, u16 append)
1034{
1035 int err;
1036 u16 val;
1037
1038 err = rtsx_pci_read_phy_register(pcr, addr, &val);
1039 if (err < 0)
1040 return err;
1041
1042 return rtsx_pci_write_phy_register(pcr, addr, (val & mask) | append);
1043}
1044
1007#endif 1045#endif
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 3fdb7cfbffb3..75115384f3fc 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -58,13 +58,7 @@ enum sec_device_type {
58 * @irq_base: Base IRQ number for device, required for IRQs 58 * @irq_base: Base IRQ number for device, required for IRQs
59 * @irq: Generic IRQ number for device 59 * @irq: Generic IRQ number for device
60 * @irq_data: Runtime data structure for IRQ controller 60 * @irq_data: Runtime data structure for IRQ controller
61 * @ono: Power onoff IRQ number for s5m87xx
62 * @wakeup: Whether or not this is a wakeup device 61 * @wakeup: Whether or not this is a wakeup device
63 * @wtsr_smpl: Whether or not to enable in RTC driver the Watchdog
64 * Timer Software Reset (registers set to default value
65 * after PWRHOLD falling) and Sudden Momentary Power Loss
66 * (PMIC will enter power on sequence after short drop in
67 * VBATT voltage).
68 */ 62 */
69struct sec_pmic_dev { 63struct sec_pmic_dev {
70 struct device *dev; 64 struct device *dev;
@@ -77,9 +71,7 @@ struct sec_pmic_dev {
77 int irq; 71 int irq;
78 struct regmap_irq_chip_data *irq_data; 72 struct regmap_irq_chip_data *irq_data;
79 73
80 int ono;
81 bool wakeup; 74 bool wakeup;
82 bool wtsr_smpl;
83}; 75};
84 76
85int sec_irq_init(struct sec_pmic_dev *sec_pmic); 77int sec_irq_init(struct sec_pmic_dev *sec_pmic);
@@ -95,7 +87,6 @@ struct sec_platform_data {
95 int irq_base; 87 int irq_base;
96 int (*cfg_pmic_irq)(void); 88 int (*cfg_pmic_irq)(void);
97 89
98 int ono;
99 bool wakeup; 90 bool wakeup;
100 bool buck_voltage_lock; 91 bool buck_voltage_lock;
101 92
diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/irq.h
index f35af7361b60..667aa40486dd 100644
--- a/include/linux/mfd/samsung/irq.h
+++ b/include/linux/mfd/samsung/irq.h
@@ -74,8 +74,8 @@ enum s2mps11_irq {
74 S2MPS11_IRQ_MRB, 74 S2MPS11_IRQ_MRB,
75 75
76 S2MPS11_IRQ_RTC60S, 76 S2MPS11_IRQ_RTC60S,
77 S2MPS11_IRQ_RTCA0,
78 S2MPS11_IRQ_RTCA1, 77 S2MPS11_IRQ_RTCA1,
78 S2MPS11_IRQ_RTCA0,
79 S2MPS11_IRQ_SMPL, 79 S2MPS11_IRQ_SMPL,
80 S2MPS11_IRQ_RTC1S, 80 S2MPS11_IRQ_RTC1S,
81 S2MPS11_IRQ_WTSR, 81 S2MPS11_IRQ_WTSR,
diff --git a/include/linux/mfd/samsung/rtc.h b/include/linux/mfd/samsung/rtc.h
index b6401e7661c7..29c30ac36020 100644
--- a/include/linux/mfd/samsung/rtc.h
+++ b/include/linux/mfd/samsung/rtc.h
@@ -105,6 +105,8 @@ enum s2mps_rtc_reg {
105#define S5M_RTC_UDR_MASK (1 << S5M_RTC_UDR_SHIFT) 105#define S5M_RTC_UDR_MASK (1 << S5M_RTC_UDR_SHIFT)
106#define S2MPS_RTC_WUDR_SHIFT 4 106#define S2MPS_RTC_WUDR_SHIFT 4
107#define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT) 107#define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT)
108#define S2MPS13_RTC_AUDR_SHIFT 1
109#define S2MPS13_RTC_AUDR_MASK (1 << S2MPS13_RTC_AUDR_SHIFT)
108#define S2MPS_RTC_RUDR_SHIFT 0 110#define S2MPS_RTC_RUDR_SHIFT 0
109#define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT) 111#define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT)
110#define RTC_TCON_SHIFT 1 112#define RTC_TCON_SHIFT 1
diff --git a/include/linux/mfd/sky81452.h b/include/linux/mfd/sky81452.h
new file mode 100644
index 000000000000..b0925fa3e9ef
--- /dev/null
+++ b/include/linux/mfd/sky81452.h
@@ -0,0 +1,31 @@
1/*
2 * sky81452.h SKY81452 MFD driver
3 *
4 * Copyright 2014 Skyworks Solutions Inc.
5 * Author : Gyungoh Yoo <jack.yoo@skyworksinc.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
9 * as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _SKY81452_H
21#define _SKY81452_H
22
23#include <linux/platform_data/sky81452-backlight.h>
24#include <linux/regulator/machine.h>
25
26struct sky81452_platform_data {
27 struct sky81452_bl_platform_data *bl_pdata;
28 struct regulator_init_data *regulator_init_data;
29};
30
31#endif
diff --git a/include/linux/mfd/stw481x.h b/include/linux/mfd/stw481x.h
index eda121556e5d..833074b766bd 100644
--- a/include/linux/mfd/stw481x.h
+++ b/include/linux/mfd/stw481x.h
@@ -41,15 +41,11 @@
41 41
42/** 42/**
43 * struct stw481x - state holder for the Stw481x drivers 43 * struct stw481x - state holder for the Stw481x drivers
44 * @mutex: mutex to serialize I2C accesses
45 * @i2c_client: corresponding I2C client 44 * @i2c_client: corresponding I2C client
46 * @regulator: regulator device for regulator children
47 * @map: regmap handle to access device registers 45 * @map: regmap handle to access device registers
48 */ 46 */
49struct stw481x { 47struct stw481x {
50 struct mutex lock;
51 struct i2c_client *client; 48 struct i2c_client *client;
52 struct regulator_dev *vmmc_regulator;
53 struct regmap *map; 49 struct regmap *map;
54}; 50};
55 51
diff --git a/include/linux/mfd/syscon/atmel-st.h b/include/linux/mfd/syscon/atmel-st.h
new file mode 100644
index 000000000000..8acf1ec1fa32
--- /dev/null
+++ b/include/linux/mfd/syscon/atmel-st.h
@@ -0,0 +1,49 @@
1/*
2 * Copyright (C) 2005 Ivan Kokshaysky
3 * Copyright (C) SAN People
4 *
5 * System Timer (ST) - System peripherals registers.
6 * Based on AT91RM9200 datasheet revision E.
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 _LINUX_MFD_SYSCON_ATMEL_ST_H
15#define _LINUX_MFD_SYSCON_ATMEL_ST_H
16
17#include <linux/bitops.h>
18
19#define AT91_ST_CR 0x00 /* Control Register */
20#define AT91_ST_WDRST BIT(0) /* Watchdog Timer Restart */
21
22#define AT91_ST_PIMR 0x04 /* Period Interval Mode Register */
23#define AT91_ST_PIV 0xffff /* Period Interval Value */
24
25#define AT91_ST_WDMR 0x08 /* Watchdog Mode Register */
26#define AT91_ST_WDV 0xffff /* Watchdog Counter Value */
27#define AT91_ST_RSTEN BIT(16) /* Reset Enable */
28#define AT91_ST_EXTEN BIT(17) /* External Signal Assertion Enable */
29
30#define AT91_ST_RTMR 0x0c /* Real-time Mode Register */
31#define AT91_ST_RTPRES 0xffff /* Real-time Prescalar Value */
32
33#define AT91_ST_SR 0x10 /* Status Register */
34#define AT91_ST_PITS BIT(0) /* Period Interval Timer Status */
35#define AT91_ST_WDOVF BIT(1) /* Watchdog Overflow */
36#define AT91_ST_RTTINC BIT(2) /* Real-time Timer Increment */
37#define AT91_ST_ALMS BIT(3) /* Alarm Status */
38
39#define AT91_ST_IER 0x14 /* Interrupt Enable Register */
40#define AT91_ST_IDR 0x18 /* Interrupt Disable Register */
41#define AT91_ST_IMR 0x1c /* Interrupt Mask Register */
42
43#define AT91_ST_RTAR 0x20 /* Real-time Alarm Register */
44#define AT91_ST_ALMV 0xfffff /* Alarm Value */
45
46#define AT91_ST_CRTR 0x24 /* Current Real-time Register */
47#define AT91_ST_CRTV 0xfffff /* Current Real-Time Value */
48
49#endif /* _LINUX_MFD_SYSCON_ATMEL_ST_H */
diff --git a/include/linux/mfd/syscon/exynos5-pmu.h b/include/linux/mfd/syscon/exynos5-pmu.h
index 00ef24bf6ede..9352adc95de6 100644
--- a/include/linux/mfd/syscon/exynos5-pmu.h
+++ b/include/linux/mfd/syscon/exynos5-pmu.h
@@ -36,6 +36,9 @@
36#define EXYNOS5420_MTCADC_PHY_CONTROL (0x724) 36#define EXYNOS5420_MTCADC_PHY_CONTROL (0x724)
37#define EXYNOS5420_DPTX_PHY_CONTROL (0x728) 37#define EXYNOS5420_DPTX_PHY_CONTROL (0x728)
38 38
39/* Exynos5433 specific register definitions */
40#define EXYNOS5433_USBHOST30_PHY_CONTROL (0x728)
41
39#define EXYNOS5_PHY_ENABLE BIT(0) 42#define EXYNOS5_PHY_ENABLE BIT(0)
40 43
41#define EXYNOS5_MIPI_PHY_S_RESETN BIT(1) 44#define EXYNOS5_MIPI_PHY_S_RESETN BIT(1)
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
index c877cad61a13..d16f4c82c568 100644
--- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -207,6 +207,7 @@
207#define IMX6Q_GPR3_LVDS0_MUX_CTL_IPU1_DI1 (0x1 << 6) 207#define IMX6Q_GPR3_LVDS0_MUX_CTL_IPU1_DI1 (0x1 << 6)
208#define IMX6Q_GPR3_LVDS0_MUX_CTL_IPU2_DI0 (0x2 << 6) 208#define IMX6Q_GPR3_LVDS0_MUX_CTL_IPU2_DI0 (0x2 << 6)
209#define IMX6Q_GPR3_LVDS0_MUX_CTL_IPU2_DI1 (0x3 << 6) 209#define IMX6Q_GPR3_LVDS0_MUX_CTL_IPU2_DI1 (0x3 << 6)
210#define IMX6Q_GPR3_MIPI_MUX_CTL_SHIFT 4
210#define IMX6Q_GPR3_MIPI_MUX_CTL_MASK (0x3 << 4) 211#define IMX6Q_GPR3_MIPI_MUX_CTL_MASK (0x3 << 4)
211#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU1_DI0 (0x0 << 4) 212#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU1_DI0 (0x0 << 4)
212#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU1_DI1 (0x1 << 4) 213#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU1_DI1 (0x1 << 4)
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index c203c9c56776..468c31a27fcf 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -140,36 +140,13 @@ extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
140#define TC_KPD_DEBOUNCE_PERIOD 0xA3 140#define TC_KPD_DEBOUNCE_PERIOD 0xA3
141#define TC_KPD_SETTLE_TIME 0xA3 141#define TC_KPD_SETTLE_TIME 0xA3
142 142
143/**
144 * struct tc35893_platform_data - data structure for platform specific data
145 * @keymap_data: matrix scan code table for keycodes
146 * @krow: mask for available rows, value is 0xFF
147 * @kcol: mask for available columns, value is 0xFF
148 * @debounce_period: platform specific debounce time
149 * @settle_time: platform specific settle down time
150 * @irqtype: type of interrupt, falling or rising edge
151 * @enable_wakeup: specifies if keypad event can wake up system from sleep
152 * @no_autorepeat: flag for auto repetition
153 */
154struct tc3589x_keypad_platform_data {
155 const struct matrix_keymap_data *keymap_data;
156 u8 krow;
157 u8 kcol;
158 u8 debounce_period;
159 u8 settle_time;
160 unsigned long irqtype;
161 bool enable_wakeup;
162 bool no_autorepeat;
163};
164 143
165/** 144/**
166 * struct tc3589x_platform_data - TC3589x platform data 145 * struct tc3589x_platform_data - TC3589x platform data
167 * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*) 146 * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
168 * @keypad: keypad-specific platform data
169 */ 147 */
170struct tc3589x_platform_data { 148struct tc3589x_platform_data {
171 unsigned int block; 149 unsigned int block;
172 const struct tc3589x_keypad_platform_data *keypad;
173}; 150};
174 151
175#endif 152#endif
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index 3f4e994ace2b..1fd50dcfe47c 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -128,6 +128,7 @@
128 128
129/* Sequencer Status */ 129/* Sequencer Status */
130#define SEQ_STATUS BIT(5) 130#define SEQ_STATUS BIT(5)
131#define CHARGE_STEP 0x11
131 132
132#define ADC_CLK 3000000 133#define ADC_CLK 3000000
133#define TOTAL_STEPS 16 134#define TOTAL_STEPS 16
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 605812820e48..24b86d538e88 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -111,6 +111,8 @@ struct dma_chan;
111 * data for the MMC controller 111 * data for the MMC controller
112 */ 112 */
113struct tmio_mmc_data { 113struct tmio_mmc_data {
114 void *chan_priv_tx;
115 void *chan_priv_rx;
114 unsigned int hclk; 116 unsigned int hclk;
115 unsigned long capabilities; 117 unsigned long capabilities;
116 unsigned long capabilities2; 118 unsigned long capabilities2;
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h
index 2b9479310bbd..8dc93673e34a 100644
--- a/include/linux/mfd/wm8350/supply.h
+++ b/include/linux/mfd/wm8350/supply.h
@@ -123,9 +123,9 @@ struct wm8350_charger_policy {
123 123
124struct wm8350_power { 124struct wm8350_power {
125 struct platform_device *pdev; 125 struct platform_device *pdev;
126 struct power_supply battery; 126 struct power_supply *battery;
127 struct power_supply usb; 127 struct power_supply *usb;
128 struct power_supply ac; 128 struct power_supply *ac;
129 struct wm8350_charger_policy *policy; 129 struct wm8350_charger_policy *policy;
130 130
131 int rev_g_coeff; 131 int rev_g_coeff;
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 78baed5f2952..cac1c0904d5f 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -69,7 +69,6 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
69extern bool pmd_trans_migrating(pmd_t pmd); 69extern bool pmd_trans_migrating(pmd_t pmd);
70extern int migrate_misplaced_page(struct page *page, 70extern int migrate_misplaced_page(struct page *page,
71 struct vm_area_struct *vma, int node); 71 struct vm_area_struct *vma, int node);
72extern bool migrate_ratelimited(int node);
73#else 72#else
74static inline bool pmd_trans_migrating(pmd_t pmd) 73static inline bool pmd_trans_migrating(pmd_t pmd)
75{ 74{
@@ -80,10 +79,6 @@ static inline int migrate_misplaced_page(struct page *page,
80{ 79{
81 return -EAGAIN; /* can't migrate now */ 80 return -EAGAIN; /* can't migrate now */
82} 81}
83static inline bool migrate_ratelimited(int node)
84{
85 return false;
86}
87#endif /* CONFIG_NUMA_BALANCING */ 82#endif /* CONFIG_NUMA_BALANCING */
88 83
89#if defined(CONFIG_NUMA_BALANCING) && defined(CONFIG_TRANSPARENT_HUGEPAGE) 84#if defined(CONFIG_NUMA_BALANCING) && defined(CONFIG_TRANSPARENT_HUGEPAGE)
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index ee80dd7d9f60..819077c32690 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -52,6 +52,7 @@
52#define MISC_DYNAMIC_MINOR 255 52#define MISC_DYNAMIC_MINOR 255
53 53
54struct device; 54struct device;
55struct attribute_group;
55 56
56struct miscdevice { 57struct miscdevice {
57 int minor; 58 int minor;
@@ -60,6 +61,7 @@ struct miscdevice {
60 struct list_head list; 61 struct list_head list;
61 struct device *parent; 62 struct device *parent;
62 struct device *this_device; 63 struct device *this_device;
64 const struct attribute_group **groups;
63 const char *nodename; 65 const char *nodename;
64 umode_t mode; 66 umode_t mode;
65}; 67};
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 7b6d4e9ff603..f62e7cf227c6 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -68,6 +68,8 @@ enum {
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, 70 MLX4_CMD_ACCESS_REG = 0x3b,
71 MLX4_CMD_ALLOCATE_VPP = 0x80,
72 MLX4_CMD_SET_VPORT_QOS = 0x81,
71 73
72 /*master notify fw on finish for slave's flr*/ 74 /*master notify fw on finish for slave's flr*/
73 MLX4_CMD_INFORM_FLR_DONE = 0x5b, 75 MLX4_CMD_INFORM_FLR_DONE = 0x5b,
@@ -163,6 +165,9 @@ enum {
163 MLX4_QP_FLOW_STEERING_ATTACH = 0x65, 165 MLX4_QP_FLOW_STEERING_ATTACH = 0x65,
164 MLX4_QP_FLOW_STEERING_DETACH = 0x66, 166 MLX4_QP_FLOW_STEERING_DETACH = 0x66,
165 MLX4_FLOW_STEERING_IB_UC_QP_RANGE = 0x64, 167 MLX4_FLOW_STEERING_IB_UC_QP_RANGE = 0x64,
168
169 /* Update and read QCN parameters */
170 MLX4_CMD_CONGESTION_CTRL_OPCODE = 0x68,
166}; 171};
167 172
168enum { 173enum {
@@ -183,7 +188,14 @@ enum {
183}; 188};
184 189
185enum { 190enum {
186 /* set port opcode modifiers */ 191 /* Set port opcode modifiers */
192 MLX4_SET_PORT_IB_OPCODE = 0x0,
193 MLX4_SET_PORT_ETH_OPCODE = 0x1,
194 MLX4_SET_PORT_BEACON_OPCODE = 0x4,
195};
196
197enum {
198 /* Set port Ethernet input modifiers */
187 MLX4_SET_PORT_GENERAL = 0x0, 199 MLX4_SET_PORT_GENERAL = 0x0,
188 MLX4_SET_PORT_RQP_CALC = 0x1, 200 MLX4_SET_PORT_RQP_CALC = 0x1,
189 MLX4_SET_PORT_MAC_TABLE = 0x2, 201 MLX4_SET_PORT_MAC_TABLE = 0x2,
@@ -233,6 +245,16 @@ struct mlx4_config_dev_params {
233 u8 rx_csum_flags_port_2; 245 u8 rx_csum_flags_port_2;
234}; 246};
235 247
248enum mlx4_en_congestion_control_algorithm {
249 MLX4_CTRL_ALGO_802_1_QAU_REACTION_POINT = 0,
250};
251
252enum mlx4_en_congestion_control_opmod {
253 MLX4_CONGESTION_CONTROL_GET_PARAMS,
254 MLX4_CONGESTION_CONTROL_GET_STATISTICS,
255 MLX4_CONGESTION_CONTROL_SET_PARAMS = 4,
256};
257
236struct mlx4_dev; 258struct mlx4_dev;
237 259
238struct mlx4_cmd_mailbox { 260struct mlx4_cmd_mailbox {
@@ -281,6 +303,8 @@ void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbo
281u32 mlx4_comm_get_version(void); 303u32 mlx4_comm_get_version(void);
282int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac); 304int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac);
283int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos); 305int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
306int mlx4_set_vf_rate(struct mlx4_dev *dev, int port, int vf, int min_tx_rate,
307 int max_tx_rate);
284int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); 308int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
285int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); 309int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf);
286int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state); 310int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state);
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index e4ebff7e9d02..83e80ab94500 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -49,8 +49,6 @@
49#define MSIX_LEGACY_SZ 4 49#define MSIX_LEGACY_SZ 4
50#define MIN_MSIX_P_PORT 5 50#define MIN_MSIX_P_PORT 5
51 51
52#define MLX4_NUM_UP 8
53#define MLX4_NUM_TC 8
54#define MLX4_MAX_100M_UNITS_VAL 255 /* 52#define MLX4_MAX_100M_UNITS_VAL 255 /*
55 * work around: can't set values 53 * work around: can't set values
56 * greater then this value when 54 * greater then this value when
@@ -174,6 +172,7 @@ enum {
174 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, 172 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41,
175 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, 173 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42,
176 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, 174 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48,
175 MLX4_DEV_CAP_FLAG_RSS_IP_FRAG = 1LL << 52,
177 MLX4_DEV_CAP_FLAG_SET_ETH_SCHED = 1LL << 53, 176 MLX4_DEV_CAP_FLAG_SET_ETH_SCHED = 1LL << 53,
178 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55, 177 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55,
179 MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59, 178 MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59,
@@ -203,7 +202,14 @@ enum {
203 MLX4_DEV_CAP_FLAG2_80_VFS = 1LL << 18, 202 MLX4_DEV_CAP_FLAG2_80_VFS = 1LL << 18,
204 MLX4_DEV_CAP_FLAG2_FS_A0 = 1LL << 19, 203 MLX4_DEV_CAP_FLAG2_FS_A0 = 1LL << 19,
205 MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT = 1LL << 20, 204 MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT = 1LL << 20,
206 MLX4_DEV_CAP_FLAG2_PORT_REMAP = 1LL << 21 205 MLX4_DEV_CAP_FLAG2_PORT_REMAP = 1LL << 21,
206 MLX4_DEV_CAP_FLAG2_QCN = 1LL << 22,
207 MLX4_DEV_CAP_FLAG2_QP_RATE_LIMIT = 1LL << 23,
208 MLX4_DEV_CAP_FLAG2_FLOWSTATS_EN = 1LL << 24,
209 MLX4_DEV_CAP_FLAG2_QOS_VPP = 1LL << 25,
210 MLX4_DEV_CAP_FLAG2_ETS_CFG = 1LL << 26,
211 MLX4_DEV_CAP_FLAG2_PORT_BEACON = 1LL << 27,
212 MLX4_DEV_CAP_FLAG2_IGNORE_FCS = 1LL << 28,
207}; 213};
208 214
209enum { 215enum {
@@ -449,6 +455,21 @@ enum mlx4_module_id {
449 MLX4_MODULE_ID_QSFP28 = 0x11, 455 MLX4_MODULE_ID_QSFP28 = 0x11,
450}; 456};
451 457
458enum { /* rl */
459 MLX4_QP_RATE_LIMIT_NONE = 0,
460 MLX4_QP_RATE_LIMIT_KBS = 1,
461 MLX4_QP_RATE_LIMIT_MBS = 2,
462 MLX4_QP_RATE_LIMIT_GBS = 3
463};
464
465struct mlx4_rate_limit_caps {
466 u16 num_rates; /* Number of different rates */
467 u8 min_unit;
468 u16 min_val;
469 u8 max_unit;
470 u16 max_val;
471};
472
452static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) 473static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
453{ 474{
454 return (major << 32) | (minor << 16) | subminor; 475 return (major << 32) | (minor << 16) | subminor;
@@ -564,6 +585,7 @@ struct mlx4_caps {
564 u32 dmfs_high_rate_qpn_base; 585 u32 dmfs_high_rate_qpn_base;
565 u32 dmfs_high_rate_qpn_range; 586 u32 dmfs_high_rate_qpn_range;
566 u32 vf_caps; 587 u32 vf_caps;
588 struct mlx4_rate_limit_caps rl_caps;
567}; 589};
568 590
569struct mlx4_buf_list { 591struct mlx4_buf_list {
@@ -982,6 +1004,11 @@ static inline int mlx4_is_slave(struct mlx4_dev *dev)
982 return dev->flags & MLX4_FLAG_SLAVE; 1004 return dev->flags & MLX4_FLAG_SLAVE;
983} 1005}
984 1006
1007static inline int mlx4_is_eth(struct mlx4_dev *dev, int port)
1008{
1009 return dev->caps.port_type[port] == MLX4_PORT_TYPE_IB ? 0 : 1;
1010}
1011
985int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 1012int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
986 struct mlx4_buf *buf, gfp_t gfp); 1013 struct mlx4_buf *buf, gfp_t gfp);
987void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); 1014void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf);
@@ -1282,14 +1309,13 @@ int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac);
1282void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac); 1309void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac);
1283int mlx4_get_base_qpn(struct mlx4_dev *dev, u8 port); 1310int mlx4_get_base_qpn(struct mlx4_dev *dev, u8 port);
1284int __mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac); 1311int __mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac);
1285void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap);
1286int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu, 1312int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu,
1287 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); 1313 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx);
1288int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, 1314int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
1289 u8 promisc); 1315 u8 promisc);
1290int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc); 1316int mlx4_SET_PORT_BEACON(struct mlx4_dev *dev, u8 port, u16 time);
1291int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw, 1317int mlx4_SET_PORT_fcs_check(struct mlx4_dev *dev, u8 port,
1292 u8 *pg, u16 *ratelimit); 1318 u8 ignore_fcs_value);
1293int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering, int enable); 1319int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering, int enable);
1294int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx); 1320int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx);
1295int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 1321int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
@@ -1319,6 +1345,10 @@ int mlx4_wol_write(struct mlx4_dev *dev, u64 config, int port);
1319int mlx4_counter_alloc(struct mlx4_dev *dev, u32 *idx); 1345int mlx4_counter_alloc(struct mlx4_dev *dev, u32 *idx);
1320void mlx4_counter_free(struct mlx4_dev *dev, u32 idx); 1346void mlx4_counter_free(struct mlx4_dev *dev, u32 idx);
1321 1347
1348void mlx4_set_admin_guid(struct mlx4_dev *dev, __be64 guid, int entry,
1349 int port);
1350__be64 mlx4_get_admin_guid(struct mlx4_dev *dev, int entry, int port);
1351void mlx4_set_random_admin_guid(struct mlx4_dev *dev, int entry, int port);
1322int mlx4_flow_attach(struct mlx4_dev *dev, 1352int mlx4_flow_attach(struct mlx4_dev *dev,
1323 struct mlx4_net_trans_rule *rule, u64 *reg_id); 1353 struct mlx4_net_trans_rule *rule, u64 *reg_id);
1324int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id); 1354int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id);
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 2bbc62aa818a..6fed539e5456 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -207,14 +207,17 @@ struct mlx4_qp_context {
207 __be32 msn; 207 __be32 msn;
208 __be16 rq_wqe_counter; 208 __be16 rq_wqe_counter;
209 __be16 sq_wqe_counter; 209 __be16 sq_wqe_counter;
210 u32 reserved3[2]; 210 u32 reserved3;
211 __be16 rate_limit_params;
212 u8 reserved4;
213 u8 qos_vport;
211 __be32 param3; 214 __be32 param3;
212 __be32 nummmcpeers_basemkey; 215 __be32 nummmcpeers_basemkey;
213 u8 log_page_size; 216 u8 log_page_size;
214 u8 reserved4[2]; 217 u8 reserved5[2];
215 u8 mtt_base_addr_h; 218 u8 mtt_base_addr_h;
216 __be32 mtt_base_addr_l; 219 __be32 mtt_base_addr_l;
217 u32 reserved5[10]; 220 u32 reserved6[10];
218}; 221};
219 222
220struct mlx4_update_qp_context { 223struct mlx4_update_qp_context {
@@ -229,6 +232,8 @@ struct mlx4_update_qp_context {
229enum { 232enum {
230 MLX4_UPD_QP_MASK_PM_STATE = 32, 233 MLX4_UPD_QP_MASK_PM_STATE = 32,
231 MLX4_UPD_QP_MASK_VSD = 33, 234 MLX4_UPD_QP_MASK_VSD = 33,
235 MLX4_UPD_QP_MASK_QOS_VPP = 34,
236 MLX4_UPD_QP_MASK_RATE_LIMIT = 35,
232}; 237};
233 238
234enum { 239enum {
@@ -427,8 +432,10 @@ struct mlx4_wqe_inline_seg {
427 432
428enum mlx4_update_qp_attr { 433enum mlx4_update_qp_attr {
429 MLX4_UPDATE_QP_SMAC = 1 << 0, 434 MLX4_UPDATE_QP_SMAC = 1 << 0,
430 MLX4_UPDATE_QP_VSD = 1 << 2, 435 MLX4_UPDATE_QP_VSD = 1 << 1,
431 MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 2) - 1 436 MLX4_UPDATE_QP_RATE_LIMIT = 1 << 2,
437 MLX4_UPDATE_QP_QOS_VPORT = 1 << 3,
438 MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 4) - 1
432}; 439};
433 440
434enum mlx4_update_qp_params_flags { 441enum mlx4_update_qp_params_flags {
@@ -437,7 +444,10 @@ enum mlx4_update_qp_params_flags {
437 444
438struct mlx4_update_qp_params { 445struct mlx4_update_qp_params {
439 u8 smac_index; 446 u8 smac_index;
447 u8 qos_vport;
440 u32 flags; 448 u32 flags;
449 u16 rate_unit;
450 u16 rate_val;
441}; 451};
442 452
443int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, 453int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,
diff --git a/include/linux/mlx5/cmd.h b/include/linux/mlx5/cmd.h
index 2826a4b6071e..68cd08f02c2f 100644
--- a/include/linux/mlx5/cmd.h
+++ b/include/linux/mlx5/cmd.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h
index f6b17ac601bd..2695ced222df 100644
--- a/include/linux/mlx5/cq.h
+++ b/include/linux/mlx5/cq.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
@@ -137,14 +137,15 @@ enum {
137 137
138static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd, 138static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd,
139 void __iomem *uar_page, 139 void __iomem *uar_page,
140 spinlock_t *doorbell_lock) 140 spinlock_t *doorbell_lock,
141 u32 cons_index)
141{ 142{
142 __be32 doorbell[2]; 143 __be32 doorbell[2];
143 u32 sn; 144 u32 sn;
144 u32 ci; 145 u32 ci;
145 146
146 sn = cq->arm_sn & 3; 147 sn = cq->arm_sn & 3;
147 ci = cq->cons_index & 0xffffff; 148 ci = cons_index & 0xffffff;
148 149
149 *cq->arm_db = cpu_to_be32(sn << 28 | cmd | ci); 150 *cq->arm_db = cpu_to_be32(sn << 28 | cmd | ci);
150 151
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 4e5bd813bb9a..abf65c790421 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/doorbell.h b/include/linux/mlx5/doorbell.h
index 163a818411e7..afc78a3f4462 100644
--- a/include/linux/mlx5/doorbell.h
+++ b/include/linux/mlx5/doorbell.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 166d9315fe4b..9a90e7523dc2 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
@@ -232,6 +232,9 @@ struct mlx5_cmd_stats {
232}; 232};
233 233
234struct mlx5_cmd { 234struct mlx5_cmd {
235 void *cmd_alloc_buf;
236 dma_addr_t alloc_dma;
237 int alloc_size;
235 void *cmd_buf; 238 void *cmd_buf;
236 dma_addr_t dma; 239 dma_addr_t dma;
237 u16 cmdif_rev; 240 u16 cmdif_rev;
@@ -407,7 +410,7 @@ struct mlx5_core_srq {
407struct mlx5_eq_table { 410struct mlx5_eq_table {
408 void __iomem *update_ci; 411 void __iomem *update_ci;
409 void __iomem *update_arm_ci; 412 void __iomem *update_arm_ci;
410 struct list_head *comp_eq_head; 413 struct list_head comp_eqs_list;
411 struct mlx5_eq pages_eq; 414 struct mlx5_eq pages_eq;
412 struct mlx5_eq async_eq; 415 struct mlx5_eq async_eq;
413 struct mlx5_eq cmd_eq; 416 struct mlx5_eq cmd_eq;
@@ -722,6 +725,7 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
722int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq); 725int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
723int mlx5_start_eqs(struct mlx5_core_dev *dev); 726int mlx5_start_eqs(struct mlx5_core_dev *dev);
724int mlx5_stop_eqs(struct mlx5_core_dev *dev); 727int mlx5_stop_eqs(struct mlx5_core_dev *dev);
728int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn, int *irqn);
725int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); 729int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
726int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); 730int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
727 731
@@ -777,14 +781,22 @@ enum {
777 MAX_MR_CACHE_ENTRIES = 16, 781 MAX_MR_CACHE_ENTRIES = 16,
778}; 782};
779 783
784enum {
785 MLX5_INTERFACE_PROTOCOL_IB = 0,
786 MLX5_INTERFACE_PROTOCOL_ETH = 1,
787};
788
780struct mlx5_interface { 789struct mlx5_interface {
781 void * (*add)(struct mlx5_core_dev *dev); 790 void * (*add)(struct mlx5_core_dev *dev);
782 void (*remove)(struct mlx5_core_dev *dev, void *context); 791 void (*remove)(struct mlx5_core_dev *dev, void *context);
783 void (*event)(struct mlx5_core_dev *dev, void *context, 792 void (*event)(struct mlx5_core_dev *dev, void *context,
784 enum mlx5_dev_event event, unsigned long param); 793 enum mlx5_dev_event event, unsigned long param);
794 void * (*get_dev)(void *context);
795 int protocol;
785 struct list_head list; 796 struct list_head list;
786}; 797};
787 798
799void *mlx5_get_protocol_dev(struct mlx5_core_dev *mdev, int protocol);
788int mlx5_register_interface(struct mlx5_interface *intf); 800int mlx5_register_interface(struct mlx5_interface *intf);
789void mlx5_unregister_interface(struct mlx5_interface *intf); 801void mlx5_unregister_interface(struct mlx5_interface *intf);
790 802
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 5f48b8f592c5..cb3ad17edd1f 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2014, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index 61f7a342d1bf..310b5f7fd6ae 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/srq.h b/include/linux/mlx5/srq.h
index e1a363a33663..f43ed054a3e0 100644
--- a/include/linux/mlx5/srq.h
+++ b/include/linux/mlx5/srq.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 47a93928b90f..0755b9fd03a7 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -251,6 +251,9 @@ struct vm_operations_struct {
251 * writable, if an error is returned it will cause a SIGBUS */ 251 * writable, if an error is returned it will cause a SIGBUS */
252 int (*page_mkwrite)(struct vm_area_struct *vma, struct vm_fault *vmf); 252 int (*page_mkwrite)(struct vm_area_struct *vma, struct vm_fault *vmf);
253 253
254 /* same as page_mkwrite when using VM_PFNMAP|VM_MIXEDMAP */
255 int (*pfn_mkwrite)(struct vm_area_struct *vma, struct vm_fault *vmf);
256
254 /* called by access_process_vm when get_user_pages() fails, typically 257 /* called by access_process_vm when get_user_pages() fails, typically
255 * for use by special VMAs that can switch between memory and hardware 258 * for use by special VMAs that can switch between memory and hardware
256 */ 259 */
@@ -494,15 +497,6 @@ static inline int page_count(struct page *page)
494 return atomic_read(&compound_head(page)->_count); 497 return atomic_read(&compound_head(page)->_count);
495} 498}
496 499
497#ifdef CONFIG_HUGETLB_PAGE
498extern int PageHeadHuge(struct page *page_head);
499#else /* CONFIG_HUGETLB_PAGE */
500static inline int PageHeadHuge(struct page *page_head)
501{
502 return 0;
503}
504#endif /* CONFIG_HUGETLB_PAGE */
505
506static inline bool __compound_tail_refcounted(struct page *page) 500static inline bool __compound_tail_refcounted(struct page *page)
507{ 501{
508 return !PageSlab(page) && !PageHeadHuge(page); 502 return !PageSlab(page) && !PageHeadHuge(page);
@@ -571,53 +565,6 @@ static inline void init_page_count(struct page *page)
571 atomic_set(&page->_count, 1); 565 atomic_set(&page->_count, 1);
572} 566}
573 567
574/*
575 * PageBuddy() indicate that the page is free and in the buddy system
576 * (see mm/page_alloc.c).
577 *
578 * PAGE_BUDDY_MAPCOUNT_VALUE must be <= -2 but better not too close to
579 * -2 so that an underflow of the page_mapcount() won't be mistaken
580 * for a genuine PAGE_BUDDY_MAPCOUNT_VALUE. -128 can be created very
581 * efficiently by most CPU architectures.
582 */
583#define PAGE_BUDDY_MAPCOUNT_VALUE (-128)
584
585static inline int PageBuddy(struct page *page)
586{
587 return atomic_read(&page->_mapcount) == PAGE_BUDDY_MAPCOUNT_VALUE;
588}
589
590static inline void __SetPageBuddy(struct page *page)
591{
592 VM_BUG_ON_PAGE(atomic_read(&page->_mapcount) != -1, page);
593 atomic_set(&page->_mapcount, PAGE_BUDDY_MAPCOUNT_VALUE);
594}
595
596static inline void __ClearPageBuddy(struct page *page)
597{
598 VM_BUG_ON_PAGE(!PageBuddy(page), page);
599 atomic_set(&page->_mapcount, -1);
600}
601
602#define PAGE_BALLOON_MAPCOUNT_VALUE (-256)
603
604static inline int PageBalloon(struct page *page)
605{
606 return atomic_read(&page->_mapcount) == PAGE_BALLOON_MAPCOUNT_VALUE;
607}
608
609static inline void __SetPageBalloon(struct page *page)
610{
611 VM_BUG_ON_PAGE(atomic_read(&page->_mapcount) != -1, page);
612 atomic_set(&page->_mapcount, PAGE_BALLOON_MAPCOUNT_VALUE);
613}
614
615static inline void __ClearPageBalloon(struct page *page)
616{
617 VM_BUG_ON_PAGE(!PageBalloon(page), page);
618 atomic_set(&page->_mapcount, -1);
619}
620
621void put_page(struct page *page); 568void put_page(struct page *page);
622void put_pages_list(struct list_head *pages); 569void put_pages_list(struct list_head *pages);
623 570
@@ -1006,34 +953,10 @@ void page_address_init(void);
1006#define page_address_init() do { } while(0) 953#define page_address_init() do { } while(0)
1007#endif 954#endif
1008 955
1009/* 956extern void *page_rmapping(struct page *page);
1010 * On an anonymous page mapped into a user virtual memory area, 957extern struct anon_vma *page_anon_vma(struct page *page);
1011 * page->mapping points to its anon_vma, not to a struct address_space;
1012 * with the PAGE_MAPPING_ANON bit set to distinguish it. See rmap.h.
1013 *
1014 * On an anonymous page in a VM_MERGEABLE area, if CONFIG_KSM is enabled,
1015 * the PAGE_MAPPING_KSM bit may be set along with the PAGE_MAPPING_ANON bit;
1016 * and then page->mapping points, not to an anon_vma, but to a private
1017 * structure which KSM associates with that merged page. See ksm.h.
1018 *
1019 * PAGE_MAPPING_KSM without PAGE_MAPPING_ANON is currently never used.
1020 *
1021 * Please note that, confusingly, "page_mapping" refers to the inode
1022 * address_space which maps the page from disk; whereas "page_mapped"
1023 * refers to user virtual address space into which the page is mapped.
1024 */
1025#define PAGE_MAPPING_ANON 1
1026#define PAGE_MAPPING_KSM 2
1027#define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM)
1028
1029extern struct address_space *page_mapping(struct page *page); 958extern struct address_space *page_mapping(struct page *page);
1030 959
1031/* Neutral page->mapping pointer to address_space or anon_vma or other */
1032static inline void *page_rmapping(struct page *page)
1033{
1034 return (void *)((unsigned long)page->mapping & ~PAGE_MAPPING_FLAGS);
1035}
1036
1037extern struct address_space *__page_file_mapping(struct page *); 960extern struct address_space *__page_file_mapping(struct page *);
1038 961
1039static inline 962static inline
@@ -1045,11 +968,6 @@ struct address_space *page_file_mapping(struct page *page)
1045 return page->mapping; 968 return page->mapping;
1046} 969}
1047 970
1048static inline int PageAnon(struct page *page)
1049{
1050 return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
1051}
1052
1053/* 971/*
1054 * Return the pagecache index of the passed page. Regular pagecache pages 972 * Return the pagecache index of the passed page. Regular pagecache pages
1055 * use ->index whereas swapcache pages use ->private 973 * use ->index whereas swapcache pages use ->private
@@ -1294,9 +1212,11 @@ int __set_page_dirty_no_writeback(struct page *page);
1294int redirty_page_for_writepage(struct writeback_control *wbc, 1212int redirty_page_for_writepage(struct writeback_control *wbc,
1295 struct page *page); 1213 struct page *page);
1296void account_page_dirtied(struct page *page, struct address_space *mapping); 1214void account_page_dirtied(struct page *page, struct address_space *mapping);
1215void account_page_cleaned(struct page *page, struct address_space *mapping);
1297int set_page_dirty(struct page *page); 1216int set_page_dirty(struct page *page);
1298int set_page_dirty_lock(struct page *page); 1217int set_page_dirty_lock(struct page *page);
1299int clear_page_dirty_for_io(struct page *page); 1218int clear_page_dirty_for_io(struct page *page);
1219
1300int get_cmdline(struct task_struct *task, char *buffer, int buflen); 1220int get_cmdline(struct task_struct *task, char *buffer, int buflen);
1301 1221
1302/* Is the vma a continuation of the stack vma above it? */ 1222/* Is the vma a continuation of the stack vma above it? */
@@ -1973,10 +1893,10 @@ extern unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info);
1973static inline unsigned long 1893static inline unsigned long
1974vm_unmapped_area(struct vm_unmapped_area_info *info) 1894vm_unmapped_area(struct vm_unmapped_area_info *info)
1975{ 1895{
1976 if (!(info->flags & VM_UNMAPPED_AREA_TOPDOWN)) 1896 if (info->flags & VM_UNMAPPED_AREA_TOPDOWN)
1977 return unmapped_area(info);
1978 else
1979 return unmapped_area_topdown(info); 1897 return unmapped_area_topdown(info);
1898 else
1899 return unmapped_area(info);
1980} 1900}
1981 1901
1982/* truncate.c */ 1902/* truncate.c */
@@ -2109,7 +2029,7 @@ static inline struct page *follow_page(struct vm_area_struct *vma,
2109#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */ 2029#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */
2110#define FOLL_NOWAIT 0x20 /* if a disk transfer is needed, start the IO 2030#define FOLL_NOWAIT 0x20 /* if a disk transfer is needed, start the IO
2111 * and return without waiting upon it */ 2031 * and return without waiting upon it */
2112#define FOLL_MLOCK 0x40 /* mark page as mlocked */ 2032#define FOLL_POPULATE 0x40 /* fault in page */
2113#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */ 2033#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */
2114#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ 2034#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */
2115#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */ 2035#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 199a03aab8dc..8d37e26a1007 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -364,7 +364,9 @@ struct mm_struct {
364 atomic_t mm_users; /* How many users with user space? */ 364 atomic_t mm_users; /* How many users with user space? */
365 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 365 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
366 atomic_long_t nr_ptes; /* PTE page table pages */ 366 atomic_long_t nr_ptes; /* PTE page table pages */
367#if CONFIG_PGTABLE_LEVELS > 2
367 atomic_long_t nr_pmds; /* PMD page table pages */ 368 atomic_long_t nr_pmds; /* PMD page table pages */
369#endif
368 int map_count; /* number of VMAs */ 370 int map_count; /* number of VMAs */
369 371
370 spinlock_t page_table_lock; /* Protects page tables and some counters */ 372 spinlock_t page_table_lock; /* Protects page tables and some counters */
@@ -427,7 +429,7 @@ struct mm_struct {
427#endif 429#endif
428 430
429 /* store ref to file /proc/<pid>/exe symlink points to */ 431 /* store ref to file /proc/<pid>/exe symlink points to */
430 struct file *exe_file; 432 struct file __rcu *exe_file;
431#ifdef CONFIG_MMU_NOTIFIER 433#ifdef CONFIG_MMU_NOTIFIER
432 struct mmu_notifier_mm *mmu_notifier_mm; 434 struct mmu_notifier_mm *mmu_notifier_mm;
433#endif 435#endif
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index a6cf4c063e4e..19f0175c0afa 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -512,8 +512,18 @@ static inline int mmc_card_broken_irq_polling(const struct mmc_card *c)
512 512
513#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)
514 514
515extern int mmc_register_driver(struct device_driver *); 515/*
516extern void mmc_unregister_driver(struct device_driver *); 516 * MMC device driver (e.g., Flash card, I/O card...)
517 */
518struct mmc_driver {
519 struct device_driver drv;
520 int (*probe)(struct mmc_card *);
521 void (*remove)(struct mmc_card *);
522 void (*shutdown)(struct mmc_card *);
523};
524
525extern int mmc_register_driver(struct mmc_driver *);
526extern void mmc_unregister_driver(struct mmc_driver *);
517 527
518extern void mmc_fixup_device(struct mmc_card *card, 528extern void mmc_fixup_device(struct mmc_card *card,
519 const struct mmc_fixup *table); 529 const struct mmc_fixup *table);
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 160448f920ac..de722d4e9d61 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -79,7 +79,7 @@ struct mmc_command {
79#define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK) 79#define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK)
80 80
81 unsigned int retries; /* max number of retries */ 81 unsigned int retries; /* max number of retries */
82 unsigned int error; /* command error */ 82 int error; /* command error */
83 83
84/* 84/*
85 * Standard errno values are used for errors, but some have specific 85 * Standard errno values are used for errors, but some have specific
@@ -108,7 +108,7 @@ struct mmc_data {
108 unsigned int timeout_clks; /* data timeout (in clocks) */ 108 unsigned int timeout_clks; /* data timeout (in clocks) */
109 unsigned int blksz; /* data block size */ 109 unsigned int blksz; /* data block size */
110 unsigned int blocks; /* number of blocks */ 110 unsigned int blocks; /* number of blocks */
111 unsigned int error; /* data error */ 111 int error; /* data error */
112 unsigned int flags; 112 unsigned int flags;
113 113
114#define MMC_DATA_WRITE (1 << 8) 114#define MMC_DATA_WRITE (1 << 8)
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 471fb3116dbe..12111993a317 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -44,6 +44,7 @@ struct mmc_data;
44 * struct dw_mci - MMC controller state shared between all slots 44 * struct dw_mci - MMC controller state shared between all slots
45 * @lock: Spinlock protecting the queue and associated data. 45 * @lock: Spinlock protecting the queue and associated data.
46 * @regs: Pointer to MMIO registers. 46 * @regs: Pointer to MMIO registers.
47 * @fifo_reg: Pointer to MMIO registers for data FIFO
47 * @sg: Scatterlist entry currently being processed by PIO code, if any. 48 * @sg: Scatterlist entry currently being processed by PIO code, if any.
48 * @sg_miter: PIO mapping scatterlist iterator. 49 * @sg_miter: PIO mapping scatterlist iterator.
49 * @cur_slot: The slot which is currently using the controller. 50 * @cur_slot: The slot which is currently using the controller.
@@ -79,7 +80,6 @@ struct mmc_data;
79 * @current_speed: Configured rate of the controller. 80 * @current_speed: Configured rate of the controller.
80 * @num_slots: Number of slots available. 81 * @num_slots: Number of slots available.
81 * @verid: Denote Version ID. 82 * @verid: Denote Version ID.
82 * @data_offset: Set the offset of DATA register according to VERID.
83 * @dev: Device associated with the MMC controller. 83 * @dev: Device associated with the MMC controller.
84 * @pdata: Platform data associated with the MMC controller. 84 * @pdata: Platform data associated with the MMC controller.
85 * @drv_data: Driver specific data for identified variant of the controller 85 * @drv_data: Driver specific data for identified variant of the controller
@@ -132,6 +132,7 @@ struct dw_mci {
132 spinlock_t lock; 132 spinlock_t lock;
133 spinlock_t irq_lock; 133 spinlock_t irq_lock;
134 void __iomem *regs; 134 void __iomem *regs;
135 void __iomem *fifo_reg;
135 136
136 struct scatterlist *sg; 137 struct scatterlist *sg;
137 struct sg_mapping_iter sg_miter; 138 struct sg_mapping_iter sg_miter;
@@ -172,7 +173,6 @@ struct dw_mci {
172 u32 num_slots; 173 u32 num_slots;
173 u32 fifoth_val; 174 u32 fifoth_val;
174 u16 verid; 175 u16 verid;
175 u16 data_offset;
176 struct device *dev; 176 struct device *dev;
177 struct dw_mci_board *pdata; 177 struct dw_mci_board *pdata;
178 const struct dw_mci_drv_data *drv_data; 178 const struct dw_mci_drv_data *drv_data;
@@ -202,6 +202,8 @@ struct dw_mci {
202 int irq; 202 int irq;
203 203
204 int sdio_id0; 204 int sdio_id0;
205
206 struct timer_list cmd11_timer;
205}; 207};
206 208
207/* DMA ops for Internal/External DMAC interface */ 209/* DMA ops for Internal/External DMAC interface */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 0c8cbe5d1550..b5bedaec6223 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -80,12 +80,6 @@ struct mmc_ios {
80 80
81struct mmc_host_ops { 81struct mmc_host_ops {
82 /* 82 /*
83 * 'enable' is called when the host is claimed and 'disable' is called
84 * when the host is released. 'enable' and 'disable' are deprecated.
85 */
86 int (*enable)(struct mmc_host *host);
87 int (*disable)(struct mmc_host *host);
88 /*
89 * It is optional for the host to implement pre_req and post_req in 83 * It is optional for the host to implement pre_req and post_req in
90 * order to support double buffering of requests (prepare one 84 * order to support double buffering of requests (prepare one
91 * request while another request is active). 85 * request while another request is active).
diff --git a/include/linux/mmc/sdhci-spear.h b/include/linux/mmc/sdhci-spear.h
deleted file mode 100644
index 8cc095a76cf8..000000000000
--- a/include/linux/mmc/sdhci-spear.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * include/linux/mmc/sdhci-spear.h
3 *
4 * SDHCI declarations specific to ST SPEAr platform
5 *
6 * Copyright (C) 2010 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef LINUX_MMC_SDHCI_SPEAR_H
15#define LINUX_MMC_SDHCI_SPEAR_H
16
17#include <linux/platform_device.h>
18/*
19 * struct sdhci_plat_data: spear sdhci platform data structure
20 *
21 * card_int_gpio: gpio pin used for card detection
22 */
23struct sdhci_plat_data {
24 int card_int_gpio;
25};
26
27/* This function is used to set platform_data field of pdev->dev */
28static inline void
29sdhci_set_plat_data(struct platform_device *pdev, struct sdhci_plat_data *data)
30{
31 pdev->dev.platform_data = data;
32}
33
34#endif /* LINUX_MMC_SDHCI_SPEAR_H */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
deleted file mode 100644
index c3e3db196738..000000000000
--- a/include/linux/mmc/sdhci.h
+++ /dev/null
@@ -1,218 +0,0 @@
1/*
2 * linux/include/linux/mmc/sdhci.h - Secure Digital Host Controller Interface
3 *
4 * Copyright (C) 2005-2008 Pierre Ossman, All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11#ifndef LINUX_MMC_SDHCI_H
12#define LINUX_MMC_SDHCI_H
13
14#include <linux/scatterlist.h>
15#include <linux/compiler.h>
16#include <linux/types.h>
17#include <linux/io.h>
18#include <linux/mmc/host.h>
19
20struct sdhci_host_next {
21 unsigned int sg_count;
22 s32 cookie;
23};
24
25struct sdhci_host {
26 /* Data set by hardware interface driver */
27 const char *hw_name; /* Hardware bus name */
28
29 unsigned int quirks; /* Deviations from spec. */
30
31/* Controller doesn't honor resets unless we touch the clock register */
32#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0)
33/* Controller has bad caps bits, but really supports DMA */
34#define SDHCI_QUIRK_FORCE_DMA (1<<1)
35/* Controller doesn't like to be reset when there is no card inserted. */
36#define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2)
37/* Controller doesn't like clearing the power reg before a change */
38#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1<<3)
39/* Controller has flaky internal state so reset it on each ios change */
40#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1<<4)
41/* Controller has an unusable DMA engine */
42#define SDHCI_QUIRK_BROKEN_DMA (1<<5)
43/* Controller has an unusable ADMA engine */
44#define SDHCI_QUIRK_BROKEN_ADMA (1<<6)
45/* Controller can only DMA from 32-bit aligned addresses */
46#define SDHCI_QUIRK_32BIT_DMA_ADDR (1<<7)
47/* Controller can only DMA chunk sizes that are a multiple of 32 bits */
48#define SDHCI_QUIRK_32BIT_DMA_SIZE (1<<8)
49/* Controller can only ADMA chunks that are a multiple of 32 bits */
50#define SDHCI_QUIRK_32BIT_ADMA_SIZE (1<<9)
51/* Controller needs to be reset after each request to stay stable */
52#define SDHCI_QUIRK_RESET_AFTER_REQUEST (1<<10)
53/* Controller needs voltage and power writes to happen separately */
54#define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1<<11)
55/* Controller provides an incorrect timeout value for transfers */
56#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12)
57/* Controller has an issue with buffer bits for small transfers */
58#define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13)
59/* Controller does not provide transfer-complete interrupt when not busy */
60#define SDHCI_QUIRK_NO_BUSY_IRQ (1<<14)
61/* Controller has unreliable card detection */
62#define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15)
63/* Controller reports inverted write-protect state */
64#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16)
65/* Controller does not like fast PIO transfers */
66#define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18)
67/* Controller has to be forced to use block size of 2048 bytes */
68#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20)
69/* Controller cannot do multi-block transfers */
70#define SDHCI_QUIRK_NO_MULTIBLOCK (1<<21)
71/* Controller can only handle 1-bit data transfers */
72#define SDHCI_QUIRK_FORCE_1_BIT_DATA (1<<22)
73/* Controller needs 10ms delay between applying power and clock */
74#define SDHCI_QUIRK_DELAY_AFTER_POWER (1<<23)
75/* Controller uses SDCLK instead of TMCLK for data timeouts */
76#define SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK (1<<24)
77/* Controller reports wrong base clock capability */
78#define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN (1<<25)
79/* Controller cannot support End Attribute in NOP ADMA descriptor */
80#define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1<<26)
81/* Controller is missing device caps. Use caps provided by host */
82#define SDHCI_QUIRK_MISSING_CAPS (1<<27)
83/* Controller uses Auto CMD12 command to stop the transfer */
84#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<28)
85/* Controller doesn't have HISPD bit field in HI-SPEED SD card */
86#define SDHCI_QUIRK_NO_HISPD_BIT (1<<29)
87/* Controller treats ADMA descriptors with length 0000h incorrectly */
88#define SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC (1<<30)
89/* The read-only detection via SDHCI_PRESENT_STATE register is unstable */
90#define SDHCI_QUIRK_UNSTABLE_RO_DETECT (1<<31)
91
92 unsigned int quirks2; /* More deviations from spec. */
93
94#define SDHCI_QUIRK2_HOST_OFF_CARD_ON (1<<0)
95#define SDHCI_QUIRK2_HOST_NO_CMD23 (1<<1)
96/* The system physically doesn't support 1.8v, even if the host does */
97#define SDHCI_QUIRK2_NO_1_8_V (1<<2)
98#define SDHCI_QUIRK2_PRESET_VALUE_BROKEN (1<<3)
99#define SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON (1<<4)
100/* Controller has a non-standard host control register */
101#define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1<<5)
102/* Controller does not support HS200 */
103#define SDHCI_QUIRK2_BROKEN_HS200 (1<<6)
104/* Controller does not support DDR50 */
105#define SDHCI_QUIRK2_BROKEN_DDR50 (1<<7)
106/* Stop command (CMD12) can set Transfer Complete when not using MMC_RSP_BUSY */
107#define SDHCI_QUIRK2_STOP_WITH_TC (1<<8)
108/* Controller does not support 64-bit DMA */
109#define SDHCI_QUIRK2_BROKEN_64_BIT_DMA (1<<9)
110/* need clear transfer mode register before send cmd */
111#define SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD (1<<10)
112/* Capability register bit-63 indicates HS400 support */
113#define SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 (1<<11)
114/* forced tuned clock */
115#define SDHCI_QUIRK2_TUNING_WORK_AROUND (1<<12)
116/* disable the block count for single block transactions */
117#define SDHCI_QUIRK2_SUPPORT_SINGLE (1<<13)
118
119 int irq; /* Device IRQ */
120 void __iomem *ioaddr; /* Mapped address */
121
122 const struct sdhci_ops *ops; /* Low level hw interface */
123
124 /* Internal data */
125 struct mmc_host *mmc; /* MMC structure */
126 u64 dma_mask; /* custom DMA mask */
127
128#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
129 struct led_classdev led; /* LED control */
130 char led_name[32];
131#endif
132
133 spinlock_t lock; /* Mutex */
134
135 int flags; /* Host attributes */
136#define SDHCI_USE_SDMA (1<<0) /* Host is SDMA capable */
137#define SDHCI_USE_ADMA (1<<1) /* Host is ADMA capable */
138#define SDHCI_REQ_USE_DMA (1<<2) /* Use DMA for this req. */
139#define SDHCI_DEVICE_DEAD (1<<3) /* Device unresponsive */
140#define SDHCI_SDR50_NEEDS_TUNING (1<<4) /* SDR50 needs tuning */
141#define SDHCI_NEEDS_RETUNING (1<<5) /* Host needs retuning */
142#define SDHCI_AUTO_CMD12 (1<<6) /* Auto CMD12 support */
143#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */
144#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */
145#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */
146#define SDHCI_SDR104_NEEDS_TUNING (1<<10) /* SDR104/HS200 needs tuning */
147#define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */
148#define SDHCI_USE_64_BIT_DMA (1<<12) /* Use 64-bit DMA */
149#define SDHCI_HS400_TUNING (1<<13) /* Tuning for HS400 */
150
151 unsigned int version; /* SDHCI spec. version */
152
153 unsigned int max_clk; /* Max possible freq (MHz) */
154 unsigned int timeout_clk; /* Timeout freq (KHz) */
155 unsigned int clk_mul; /* Clock Muliplier value */
156
157 unsigned int clock; /* Current clock (MHz) */
158 u8 pwr; /* Current voltage */
159
160 bool runtime_suspended; /* Host is runtime suspended */
161 bool bus_on; /* Bus power prevents runtime suspend */
162 bool preset_enabled; /* Preset is enabled */
163
164 struct mmc_request *mrq; /* Current request */
165 struct mmc_command *cmd; /* Current command */
166 struct mmc_data *data; /* Current data request */
167 unsigned int data_early:1; /* Data finished before cmd */
168 unsigned int busy_handle:1; /* Handling the order of Busy-end */
169
170 struct sg_mapping_iter sg_miter; /* SG state for PIO */
171 unsigned int blocks; /* remaining PIO blocks */
172
173 int sg_count; /* Mapped sg entries */
174
175 void *adma_table; /* ADMA descriptor table */
176 void *align_buffer; /* Bounce buffer */
177
178 size_t adma_table_sz; /* ADMA descriptor table size */
179 size_t align_buffer_sz; /* Bounce buffer size */
180
181 dma_addr_t adma_addr; /* Mapped ADMA descr. table */
182 dma_addr_t align_addr; /* Mapped bounce buffer */
183
184 unsigned int desc_sz; /* ADMA descriptor size */
185 unsigned int align_sz; /* ADMA alignment */
186 unsigned int align_mask; /* ADMA alignment mask */
187
188 struct tasklet_struct finish_tasklet; /* Tasklet structures */
189
190 struct timer_list timer; /* Timer for timeouts */
191
192 u32 caps; /* Alternative CAPABILITY_0 */
193 u32 caps1; /* Alternative CAPABILITY_1 */
194
195 unsigned int ocr_avail_sdio; /* OCR bit masks */
196 unsigned int ocr_avail_sd;
197 unsigned int ocr_avail_mmc;
198 u32 ocr_mask; /* available voltages */
199
200 unsigned timing; /* Current timing */
201
202 u32 thread_isr;
203
204 /* cached registers */
205 u32 ier;
206
207 wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */
208 unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */
209
210 unsigned int tuning_count; /* Timer count for re-tuning */
211 unsigned int tuning_mode; /* Re-tuning mode supported by host */
212#define SDHCI_TUNING_MODE_1 0
213 struct timer_list tuning_timer; /* Timer for tuning */
214
215 struct sdhci_host_next next_data;
216 unsigned long private[0] ____cacheline_aligned;
217};
218#endif /* LINUX_MMC_SDHCI_H */
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index 996807963716..83430f2ea757 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -33,6 +33,8 @@
33#define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d 33#define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
34#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335 34#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
35#define SDIO_DEVICE_ID_BROADCOM_43362 0xa962 35#define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
36#define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
37#define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
36#define SDIO_DEVICE_ID_BROADCOM_4354 0x4354 38#define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
37 39
38#define SDIO_VENDOR_ID_INTEL 0x0089 40#define SDIO_VENDOR_ID_INTEL 0x0089
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index da77e5e2041d..95d6f0314a7d 100644
--- a/include/linux/mmc/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
@@ -7,14 +7,4 @@
7#define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard" 7#define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard"
8#define SH_MOBILE_SDHI_IRQ_SDIO "sdio" 8#define SH_MOBILE_SDHI_IRQ_SDIO "sdio"
9 9
10struct sh_mobile_sdhi_info {
11 int dma_slave_tx;
12 int dma_slave_rx;
13 unsigned long tmio_flags;
14 unsigned long tmio_caps;
15 unsigned long tmio_caps2;
16 u32 tmio_ocr_mask; /* available MMC voltages */
17 unsigned int cd_gpio;
18};
19
20#endif /* LINUX_MMC_SH_MOBILE_SDHI_H */ 10#endif /* LINUX_MMC_SH_MOBILE_SDHI_H */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index f279d9c158cd..54d74f6eb233 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -474,16 +474,15 @@ struct zone {
474 unsigned long wait_table_bits; 474 unsigned long wait_table_bits;
475 475
476 ZONE_PADDING(_pad1_) 476 ZONE_PADDING(_pad1_)
477
478 /* Write-intensive fields used from the page allocator */
479 spinlock_t lock;
480
481 /* free areas of different sizes */ 477 /* free areas of different sizes */
482 struct free_area free_area[MAX_ORDER]; 478 struct free_area free_area[MAX_ORDER];
483 479
484 /* zone flags, see below */ 480 /* zone flags, see below */
485 unsigned long flags; 481 unsigned long flags;
486 482
483 /* Write-intensive fields used from the page allocator */
484 spinlock_t lock;
485
487 ZONE_PADDING(_pad2_) 486 ZONE_PADDING(_pad2_)
488 487
489 /* Write-intensive fields used by page reclaim */ 488 /* Write-intensive fields used by page reclaim */
@@ -843,16 +842,16 @@ static inline int populated_zone(struct zone *zone)
843 842
844extern int movable_zone; 843extern int movable_zone;
845 844
845#ifdef CONFIG_HIGHMEM
846static inline int zone_movable_is_highmem(void) 846static inline int zone_movable_is_highmem(void)
847{ 847{
848#if defined(CONFIG_HIGHMEM) && defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) 848#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
849 return movable_zone == ZONE_HIGHMEM; 849 return movable_zone == ZONE_HIGHMEM;
850#elif defined(CONFIG_HIGHMEM)
851 return (ZONE_MOVABLE - 1) == ZONE_HIGHMEM;
852#else 850#else
853 return 0; 851 return (ZONE_MOVABLE - 1) == ZONE_HIGHMEM;
854#endif 852#endif
855} 853}
854#endif
856 855
857static inline int is_highmem_idx(enum zone_type idx) 856static inline int is_highmem_idx(enum zone_type idx)
858{ 857{
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index e530533b94be..3bfd56778c29 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -546,6 +546,14 @@ struct amba_id {
546 void *data; 546 void *data;
547}; 547};
548 548
549/**
550 * struct mips_cdmm_device_id - identifies devices in MIPS CDMM bus
551 * @type: Device type identifier.
552 */
553struct mips_cdmm_device_id {
554 __u8 type;
555};
556
549/* 557/*
550 * Match x86 CPUs for CPU specific drivers. 558 * Match x86 CPUs for CPU specific drivers.
551 * See documentation of "x86_match_cpu" for details. 559 * See documentation of "x86_match_cpu" for details.
diff --git a/include/linux/module.h b/include/linux/module.h
index 42999fe2dbd0..c883b86ea964 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -338,12 +338,18 @@ struct module {
338#ifdef CONFIG_EVENT_TRACING 338#ifdef CONFIG_EVENT_TRACING
339 struct ftrace_event_call **trace_events; 339 struct ftrace_event_call **trace_events;
340 unsigned int num_trace_events; 340 unsigned int num_trace_events;
341 struct trace_enum_map **trace_enums;
342 unsigned int num_trace_enums;
341#endif 343#endif
342#ifdef CONFIG_FTRACE_MCOUNT_RECORD 344#ifdef CONFIG_FTRACE_MCOUNT_RECORD
343 unsigned int num_ftrace_callsites; 345 unsigned int num_ftrace_callsites;
344 unsigned long *ftrace_callsites; 346 unsigned long *ftrace_callsites;
345#endif 347#endif
346 348
349#ifdef CONFIG_LIVEPATCH
350 bool klp_alive;
351#endif
352
347#ifdef CONFIG_MODULE_UNLOAD 353#ifdef CONFIG_MODULE_UNLOAD
348 /* What modules depend on me? */ 354 /* What modules depend on me? */
349 struct list_head source_list; 355 struct list_head source_list;
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index f7556261fe3c..4d0cb9bba93e 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -84,4 +84,12 @@ void module_arch_cleanup(struct module *mod);
84 84
85/* Any cleanup before freeing mod->module_init */ 85/* Any cleanup before freeing mod->module_init */
86void module_arch_freeing_init(struct module *mod); 86void module_arch_freeing_init(struct module *mod);
87
88#ifdef CONFIG_KASAN
89#include <linux/kasan.h>
90#define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT)
91#else
92#define MODULE_ALIGN PAGE_SIZE
93#endif
94
87#endif 95#endif
diff --git a/include/linux/mount.h b/include/linux/mount.h
index c2c561dc0114..f822c3c11377 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -61,6 +61,7 @@ struct mnt_namespace;
61#define MNT_DOOMED 0x1000000 61#define MNT_DOOMED 0x1000000
62#define MNT_SYNC_UMOUNT 0x2000000 62#define MNT_SYNC_UMOUNT 0x2000000
63#define MNT_MARKED 0x4000000 63#define MNT_MARKED 0x4000000
64#define MNT_UMOUNT 0x8000000
64 65
65struct vfsmount { 66struct vfsmount {
66 struct dentry *mnt_root; /* root of the mounted tree */ 67 struct dentry *mnt_root; /* root of the mounted tree */
@@ -92,6 +93,6 @@ extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
92extern void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list); 93extern void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list);
93extern void mark_mounts_for_expiry(struct list_head *mounts); 94extern void mark_mounts_for_expiry(struct list_head *mounts);
94 95
95extern dev_t name_to_dev_t(char *name); 96extern dev_t name_to_dev_t(const char *name);
96 97
97#endif /* _LINUX_MOUNT_H */ 98#endif /* _LINUX_MOUNT_H */
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index 5f487d776411..29975c73a953 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -77,7 +77,7 @@
77/* ensure we never evaluate anything shorted than an unsigned long 77/* ensure we never evaluate anything shorted than an unsigned long
78 * to zero, and ensure we'll never miss the end of an comparison (bjd) */ 78 * to zero, and ensure we'll never miss the end of an comparison (bjd) */
79 79
80#define map_calc_words(map) ((map_bankwidth(map) + (sizeof(unsigned long)-1))/ sizeof(unsigned long)) 80#define map_calc_words(map) ((map_bankwidth(map) + (sizeof(unsigned long)-1)) / sizeof(unsigned long))
81 81
82#ifdef CONFIG_MTD_MAP_BANK_WIDTH_8 82#ifdef CONFIG_MTD_MAP_BANK_WIDTH_8
83# ifdef map_bankwidth 83# ifdef map_bankwidth
@@ -181,7 +181,7 @@ static inline int map_bankwidth_supported(int w)
181 } 181 }
182} 182}
183 183
184#define MAX_MAP_LONGS ( ((MAX_MAP_BANKWIDTH*8) + BITS_PER_LONG - 1) / BITS_PER_LONG ) 184#define MAX_MAP_LONGS (((MAX_MAP_BANKWIDTH * 8) + BITS_PER_LONG - 1) / BITS_PER_LONG)
185 185
186typedef union { 186typedef union {
187 unsigned long x[MAX_MAP_LONGS]; 187 unsigned long x[MAX_MAP_LONGS];
@@ -264,20 +264,22 @@ void unregister_mtd_chip_driver(struct mtd_chip_driver *);
264struct mtd_info *do_map_probe(const char *name, struct map_info *map); 264struct mtd_info *do_map_probe(const char *name, struct map_info *map);
265void map_destroy(struct mtd_info *mtd); 265void map_destroy(struct mtd_info *mtd);
266 266
267#define ENABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(map, 1); } while(0) 267#define ENABLE_VPP(map) do { if (map->set_vpp) map->set_vpp(map, 1); } while (0)
268#define DISABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(map, 0); } while(0) 268#define DISABLE_VPP(map) do { if (map->set_vpp) map->set_vpp(map, 0); } while (0)
269 269
270#define INVALIDATE_CACHED_RANGE(map, from, size) \ 270#define INVALIDATE_CACHED_RANGE(map, from, size) \
271 do { if(map->inval_cache) map->inval_cache(map, from, size); } while(0) 271 do { if (map->inval_cache) map->inval_cache(map, from, size); } while (0)
272 272
273 273
274static inline int map_word_equal(struct map_info *map, map_word val1, map_word val2) 274static inline int map_word_equal(struct map_info *map, map_word val1, map_word val2)
275{ 275{
276 int i; 276 int i;
277 for (i=0; i<map_words(map); i++) { 277
278 for (i = 0; i < map_words(map); i++) {
278 if (val1.x[i] != val2.x[i]) 279 if (val1.x[i] != val2.x[i])
279 return 0; 280 return 0;
280 } 281 }
282
281 return 1; 283 return 1;
282} 284}
283 285
@@ -286,9 +288,9 @@ static inline map_word map_word_and(struct map_info *map, map_word val1, map_wor
286 map_word r; 288 map_word r;
287 int i; 289 int i;
288 290
289 for (i=0; i<map_words(map); i++) { 291 for (i = 0; i < map_words(map); i++)
290 r.x[i] = val1.x[i] & val2.x[i]; 292 r.x[i] = val1.x[i] & val2.x[i];
291 } 293
292 return r; 294 return r;
293} 295}
294 296
@@ -297,9 +299,9 @@ static inline map_word map_word_clr(struct map_info *map, map_word val1, map_wor
297 map_word r; 299 map_word r;
298 int i; 300 int i;
299 301
300 for (i=0; i<map_words(map); i++) { 302 for (i = 0; i < map_words(map); i++)
301 r.x[i] = val1.x[i] & ~val2.x[i]; 303 r.x[i] = val1.x[i] & ~val2.x[i];
302 } 304
303 return r; 305 return r;
304} 306}
305 307
@@ -308,22 +310,33 @@ static inline map_word map_word_or(struct map_info *map, map_word val1, map_word
308 map_word r; 310 map_word r;
309 int i; 311 int i;
310 312
311 for (i=0; i<map_words(map); i++) { 313 for (i = 0; i < map_words(map); i++)
312 r.x[i] = val1.x[i] | val2.x[i]; 314 r.x[i] = val1.x[i] | val2.x[i];
313 } 315
314 return r; 316 return r;
315} 317}
316 318
317#define map_word_andequal(m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b)) 319static inline int map_word_andequal(struct map_info *map, map_word val1, map_word val2, map_word val3)
320{
321 int i;
322
323 for (i = 0; i < map_words(map); i++) {
324 if ((val1.x[i] & val2.x[i]) != val3.x[i])
325 return 0;
326 }
327
328 return 1;
329}
318 330
319static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2) 331static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2)
320{ 332{
321 int i; 333 int i;
322 334
323 for (i=0; i<map_words(map); i++) { 335 for (i = 0; i < map_words(map); i++) {
324 if (val1.x[i] & val2.x[i]) 336 if (val1.x[i] & val2.x[i])
325 return 1; 337 return 1;
326 } 338 }
339
327 return 0; 340 return 0;
328} 341}
329 342
@@ -355,14 +368,16 @@ static inline map_word map_word_load_partial(struct map_info *map, map_word orig
355 368
356 if (map_bankwidth_is_large(map)) { 369 if (map_bankwidth_is_large(map)) {
357 char *dest = (char *)&orig; 370 char *dest = (char *)&orig;
371
358 memcpy(dest+start, buf, len); 372 memcpy(dest+start, buf, len);
359 } else { 373 } else {
360 for (i=start; i < start+len; i++) { 374 for (i = start; i < start+len; i++) {
361 int bitpos; 375 int bitpos;
376
362#ifdef __LITTLE_ENDIAN 377#ifdef __LITTLE_ENDIAN
363 bitpos = i*8; 378 bitpos = i * 8;
364#else /* __BIG_ENDIAN */ 379#else /* __BIG_ENDIAN */
365 bitpos = (map_bankwidth(map)-1-i)*8; 380 bitpos = (map_bankwidth(map) - 1 - i) * 8;
366#endif 381#endif
367 orig.x[0] &= ~(0xff << bitpos); 382 orig.x[0] &= ~(0xff << bitpos);
368 orig.x[0] |= (unsigned long)buf[i-start] << bitpos; 383 orig.x[0] |= (unsigned long)buf[i-start] << bitpos;
@@ -384,9 +399,10 @@ static inline map_word map_word_ff(struct map_info *map)
384 399
385 if (map_bankwidth(map) < MAP_FF_LIMIT) { 400 if (map_bankwidth(map) < MAP_FF_LIMIT) {
386 int bw = 8 * map_bankwidth(map); 401 int bw = 8 * map_bankwidth(map);
402
387 r.x[0] = (1UL << bw) - 1; 403 r.x[0] = (1UL << bw) - 1;
388 } else { 404 } else {
389 for (i=0; i<map_words(map); i++) 405 for (i = 0; i < map_words(map); i++)
390 r.x[i] = ~0UL; 406 r.x[i] = ~0UL;
391 } 407 }
392 return r; 408 return r;
@@ -407,7 +423,7 @@ static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
407 r.x[0] = __raw_readq(map->virt + ofs); 423 r.x[0] = __raw_readq(map->virt + ofs);
408#endif 424#endif
409 else if (map_bankwidth_is_large(map)) 425 else if (map_bankwidth_is_large(map))
410 memcpy_fromio(r.x, map->virt+ofs, map->bankwidth); 426 memcpy_fromio(r.x, map->virt + ofs, map->bankwidth);
411 else 427 else
412 BUG(); 428 BUG();
413 429
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 4720b86ee73d..e5409524bb0a 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -155,6 +155,8 @@ enum spi_nor_option_flags {
155 * @write: [DRIVER-SPECIFIC] write data to the SPI NOR 155 * @write: [DRIVER-SPECIFIC] write data to the SPI NOR
156 * @erase: [DRIVER-SPECIFIC] erase a sector of the SPI NOR 156 * @erase: [DRIVER-SPECIFIC] erase a sector of the SPI NOR
157 * at the offset @offs 157 * at the offset @offs
158 * @lock: [FLASH-SPECIFIC] lock a region of the SPI NOR
159 * @unlock: [FLASH-SPECIFIC] unlock a region of the SPI NOR
158 * @priv: the private data 160 * @priv: the private data
159 */ 161 */
160struct spi_nor { 162struct spi_nor {
@@ -189,6 +191,9 @@ struct spi_nor {
189 size_t len, size_t *retlen, const u_char *write_buf); 191 size_t len, size_t *retlen, const u_char *write_buf);
190 int (*erase)(struct spi_nor *nor, loff_t offs); 192 int (*erase)(struct spi_nor *nor, loff_t offs);
191 193
194 int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
195 int (*flash_unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
196
192 void *priv; 197 void *priv;
193}; 198};
194 199
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
deleted file mode 100644
index f62f78aef4ac..000000000000
--- a/include/linux/nbd.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * 1999 Copyright (C) Pavel Machek, pavel@ucw.cz. This code is GPL.
3 * 1999/11/04 Copyright (C) 1999 VMware, Inc. (Regis "HPReg" Duchesne)
4 * Made nbd_end_request() use the io_request_lock
5 * 2001 Copyright (C) Steven Whitehouse
6 * New nbd_end_request() for compatibility with new linux block
7 * layer code.
8 * 2003/06/24 Louis D. Langholtz <ldl@aros.net>
9 * Removed unneeded blksize_bits field from nbd_device struct.
10 * Cleanup PARANOIA usage & code.
11 * 2004/02/19 Paul Clements
12 * Removed PARANOIA, plus various cleanup and comments
13 */
14#ifndef LINUX_NBD_H
15#define LINUX_NBD_H
16
17
18#include <linux/wait.h>
19#include <linux/mutex.h>
20#include <uapi/linux/nbd.h>
21
22struct request;
23
24struct nbd_device {
25 int flags;
26 int harderror; /* Code of hard error */
27 struct socket * sock; /* If == NULL, device is not ready, yet */
28 int magic;
29
30 spinlock_t queue_lock;
31 struct list_head queue_head; /* Requests waiting result */
32 struct request *active_req;
33 wait_queue_head_t active_wq;
34 struct list_head waiting_queue; /* Requests to be sent */
35 wait_queue_head_t waiting_wq;
36
37 struct mutex tx_lock;
38 struct gendisk *disk;
39 int blksize;
40 u64 bytesize;
41 pid_t pid; /* pid of nbd-client, if attached */
42 int xmit_timeout;
43 int disconnect; /* a disconnect has been requested by user */
44};
45
46#endif
diff --git a/include/linux/net.h b/include/linux/net.h
index 17d83393afcc..738ea48be889 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -120,7 +120,6 @@ struct socket {
120 120
121struct vm_area_struct; 121struct vm_area_struct;
122struct page; 122struct page;
123struct kiocb;
124struct sockaddr; 123struct sockaddr;
125struct msghdr; 124struct msghdr;
126struct module; 125struct module;
@@ -162,8 +161,8 @@ struct proto_ops {
162 int (*compat_getsockopt)(struct socket *sock, int level, 161 int (*compat_getsockopt)(struct socket *sock, int level,
163 int optname, char __user *optval, int __user *optlen); 162 int optname, char __user *optval, int __user *optlen);
164#endif 163#endif
165 int (*sendmsg) (struct kiocb *iocb, struct socket *sock, 164 int (*sendmsg) (struct socket *sock, struct msghdr *m,
166 struct msghdr *m, size_t total_len); 165 size_t total_len);
167 /* Notes for implementing recvmsg: 166 /* Notes for implementing recvmsg:
168 * =============================== 167 * ===============================
169 * msg->msg_namelen should get updated by the recvmsg handlers 168 * msg->msg_namelen should get updated by the recvmsg handlers
@@ -172,9 +171,8 @@ struct proto_ops {
172 * handlers can assume that msg.msg_name is either NULL or has 171 * handlers can assume that msg.msg_name is either NULL or has
173 * a minimum size of sizeof(struct sockaddr_storage). 172 * a minimum size of sizeof(struct sockaddr_storage).
174 */ 173 */
175 int (*recvmsg) (struct kiocb *iocb, struct socket *sock, 174 int (*recvmsg) (struct socket *sock, struct msghdr *m,
176 struct msghdr *m, size_t total_len, 175 size_t total_len, int flags);
177 int flags);
178 int (*mmap) (struct file *file, struct socket *sock, 176 int (*mmap) (struct file *file, struct socket *sock,
179 struct vm_area_struct * vma); 177 struct vm_area_struct * vma);
180 ssize_t (*sendpage) (struct socket *sock, struct page *page, 178 ssize_t (*sendpage) (struct socket *sock, struct page *page,
@@ -213,7 +211,7 @@ int sock_create(int family, int type, int proto, struct socket **res);
213int sock_create_kern(int family, int type, int proto, struct socket **res); 211int sock_create_kern(int family, int type, int proto, struct socket **res);
214int sock_create_lite(int family, int type, int proto, struct socket **res); 212int sock_create_lite(int family, int type, int proto, struct socket **res);
215void sock_release(struct socket *sock); 213void sock_release(struct socket *sock);
216int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len); 214int sock_sendmsg(struct socket *sock, struct msghdr *msg);
217int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, 215int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
218 int flags); 216 int flags);
219struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname); 217struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5897b4ea5a3f..bcbde799ec69 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -261,7 +261,6 @@ struct header_ops {
261 unsigned short type, const void *daddr, 261 unsigned short type, const void *daddr,
262 const void *saddr, unsigned int len); 262 const void *saddr, unsigned int len);
263 int (*parse)(const struct sk_buff *skb, unsigned char *haddr); 263 int (*parse)(const struct sk_buff *skb, unsigned char *haddr);
264 int (*rebuild)(struct sk_buff *skb);
265 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); 264 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
266 void (*cache_update)(struct hh_cache *hh, 265 void (*cache_update)(struct hh_cache *hh,
267 const struct net_device *dev, 266 const struct net_device *dev,
@@ -588,6 +587,7 @@ struct netdev_queue {
588#ifdef CONFIG_BQL 587#ifdef CONFIG_BQL
589 struct dql dql; 588 struct dql dql;
590#endif 589#endif
590 unsigned long tx_maxrate;
591} ____cacheline_aligned_in_smp; 591} ____cacheline_aligned_in_smp;
592 592
593static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) 593static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
@@ -795,7 +795,10 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
795 * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, 795 * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb,
796 * struct net_device *dev); 796 * struct net_device *dev);
797 * Called when a packet needs to be transmitted. 797 * Called when a packet needs to be transmitted.
798 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY. 798 * Returns NETDEV_TX_OK. Can return NETDEV_TX_BUSY, but you should stop
799 * the queue before that can happen; it's for obsolete devices and weird
800 * corner cases, but the stack really does a non-trivial amount
801 * of useless work if you return NETDEV_TX_BUSY.
799 * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX) 802 * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX)
800 * Required can not be NULL. 803 * Required can not be NULL.
801 * 804 *
@@ -875,6 +878,11 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
875 * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state); 878 * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state);
876 * int (*ndo_set_vf_port)(struct net_device *dev, int vf, 879 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
877 * struct nlattr *port[]); 880 * struct nlattr *port[]);
881 *
882 * Enable or disable the VF ability to query its RSS Redirection Table and
883 * Hash Key. This is needed since on some devices VF share this information
884 * with PF and querying it may adduce a theoretical security risk.
885 * int (*ndo_set_vf_rss_query_en)(struct net_device *dev, int vf, bool setting);
878 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); 886 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
879 * int (*ndo_setup_tc)(struct net_device *dev, u8 tc) 887 * int (*ndo_setup_tc)(struct net_device *dev, u8 tc)
880 * Called to setup 'tc' number of traffic classes in the net device. This 888 * Called to setup 'tc' number of traffic classes in the net device. This
@@ -965,9 +973,12 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
965 * Used to add FDB entries to dump requests. Implementers should add 973 * Used to add FDB entries to dump requests. Implementers should add
966 * entries to skb and update idx with the number of entries. 974 * entries to skb and update idx with the number of entries.
967 * 975 *
968 * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh) 976 * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh,
977 * u16 flags)
969 * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, 978 * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq,
970 * struct net_device *dev, u32 filter_mask) 979 * struct net_device *dev, u32 filter_mask)
980 * int (*ndo_bridge_dellink)(struct net_device *dev, struct nlmsghdr *nlh,
981 * u16 flags);
971 * 982 *
972 * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier); 983 * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier);
973 * Called to change device carrier. Soft-devices (like dummy, team, etc) 984 * Called to change device carrier. Soft-devices (like dummy, team, etc)
@@ -1023,15 +1034,12 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
1023 * be otherwise expressed by feature flags. The check is called with 1034 * be otherwise expressed by feature flags. The check is called with
1024 * the set of features that the stack has calculated and it returns 1035 * the set of features that the stack has calculated and it returns
1025 * those the driver believes to be appropriate. 1036 * those the driver believes to be appropriate.
1026 * 1037 * int (*ndo_set_tx_maxrate)(struct net_device *dev,
1027 * int (*ndo_switch_parent_id_get)(struct net_device *dev, 1038 * int queue_index, u32 maxrate);
1028 * struct netdev_phys_item_id *psid); 1039 * Called when a user wants to set a max-rate limitation of specific
1029 * Called to get an ID of the switch chip this port is part of. 1040 * TX queue.
1030 * If driver implements this, it indicates that it represents a port 1041 * int (*ndo_get_iflink)(const struct net_device *dev);
1031 * of a switch chip. 1042 * Called to get the iflink value of this device.
1032 * int (*ndo_switch_port_stp_update)(struct net_device *dev, u8 state);
1033 * Called to notify switch device port of bridge port STP
1034 * state change.
1035 */ 1043 */
1036struct net_device_ops { 1044struct net_device_ops {
1037 int (*ndo_init)(struct net_device *dev); 1045 int (*ndo_init)(struct net_device *dev);
@@ -1096,6 +1104,9 @@ struct net_device_ops {
1096 struct nlattr *port[]); 1104 struct nlattr *port[]);
1097 int (*ndo_get_vf_port)(struct net_device *dev, 1105 int (*ndo_get_vf_port)(struct net_device *dev,
1098 int vf, struct sk_buff *skb); 1106 int vf, struct sk_buff *skb);
1107 int (*ndo_set_vf_rss_query_en)(
1108 struct net_device *dev,
1109 int vf, bool setting);
1099 int (*ndo_setup_tc)(struct net_device *dev, u8 tc); 1110 int (*ndo_setup_tc)(struct net_device *dev, u8 tc);
1100#if IS_ENABLED(CONFIG_FCOE) 1111#if IS_ENABLED(CONFIG_FCOE)
1101 int (*ndo_fcoe_enable)(struct net_device *dev); 1112 int (*ndo_fcoe_enable)(struct net_device *dev);
@@ -1169,6 +1180,8 @@ struct net_device_ops {
1169 bool new_carrier); 1180 bool new_carrier);
1170 int (*ndo_get_phys_port_id)(struct net_device *dev, 1181 int (*ndo_get_phys_port_id)(struct net_device *dev,
1171 struct netdev_phys_item_id *ppid); 1182 struct netdev_phys_item_id *ppid);
1183 int (*ndo_get_phys_port_name)(struct net_device *dev,
1184 char *name, size_t len);
1172 void (*ndo_add_vxlan_port)(struct net_device *dev, 1185 void (*ndo_add_vxlan_port)(struct net_device *dev,
1173 sa_family_t sa_family, 1186 sa_family_t sa_family,
1174 __be16 port); 1187 __be16 port);
@@ -1188,12 +1201,10 @@ struct net_device_ops {
1188 netdev_features_t (*ndo_features_check) (struct sk_buff *skb, 1201 netdev_features_t (*ndo_features_check) (struct sk_buff *skb,
1189 struct net_device *dev, 1202 struct net_device *dev,
1190 netdev_features_t features); 1203 netdev_features_t features);
1191#ifdef CONFIG_NET_SWITCHDEV 1204 int (*ndo_set_tx_maxrate)(struct net_device *dev,
1192 int (*ndo_switch_parent_id_get)(struct net_device *dev, 1205 int queue_index,
1193 struct netdev_phys_item_id *psid); 1206 u32 maxrate);
1194 int (*ndo_switch_port_stp_update)(struct net_device *dev, 1207 int (*ndo_get_iflink)(const struct net_device *dev);
1195 u8 state);
1196#endif
1197}; 1208};
1198 1209
1199/** 1210/**
@@ -1302,6 +1313,8 @@ enum netdev_priv_flags {
1302 * @base_addr: Device I/O address 1313 * @base_addr: Device I/O address
1303 * @irq: Device IRQ number 1314 * @irq: Device IRQ number
1304 * 1315 *
1316 * @carrier_changes: Stats to monitor carrier on<->off transitions
1317 *
1305 * @state: Generic network queuing layer state, see netdev_state_t 1318 * @state: Generic network queuing layer state, see netdev_state_t
1306 * @dev_list: The global list of network devices 1319 * @dev_list: The global list of network devices
1307 * @napi_list: List entry, that is used for polling napi devices 1320 * @napi_list: List entry, that is used for polling napi devices
@@ -1325,7 +1338,7 @@ enum netdev_priv_flags {
1325 * @mpls_features: Mask of features inheritable by MPLS 1338 * @mpls_features: Mask of features inheritable by MPLS
1326 * 1339 *
1327 * @ifindex: interface index 1340 * @ifindex: interface index
1328 * @iflink: unique device identifier 1341 * @group: The group, that the device belongs to
1329 * 1342 *
1330 * @stats: Statistics struct, which was left as a legacy, use 1343 * @stats: Statistics struct, which was left as a legacy, use
1331 * rtnl_link_stats64 instead 1344 * rtnl_link_stats64 instead
@@ -1335,8 +1348,6 @@ enum netdev_priv_flags {
1335 * @tx_dropped: Dropped packets by core network, 1348 * @tx_dropped: Dropped packets by core network,
1336 * do not use this in drivers 1349 * do not use this in drivers
1337 * 1350 *
1338 * @carrier_changes: Stats to monitor carrier on<->off transitions
1339 *
1340 * @wireless_handlers: List of functions to handle Wireless Extensions, 1351 * @wireless_handlers: List of functions to handle Wireless Extensions,
1341 * instead of ioctl, 1352 * instead of ioctl,
1342 * see <net/iw_handler.h> for details. 1353 * see <net/iw_handler.h> for details.
@@ -1345,8 +1356,7 @@ enum netdev_priv_flags {
1345 * @netdev_ops: Includes several pointers to callbacks, 1356 * @netdev_ops: Includes several pointers to callbacks,
1346 * if one wants to override the ndo_*() functions 1357 * if one wants to override the ndo_*() functions
1347 * @ethtool_ops: Management operations 1358 * @ethtool_ops: Management operations
1348 * @fwd_ops: Management operations 1359 * @header_ops: Includes callbacks for creating,parsing,caching,etc
1349 * @header_ops: Includes callbacks for creating,parsing,rebuilding,etc
1350 * of Layer 2 headers. 1360 * of Layer 2 headers.
1351 * 1361 *
1352 * @flags: Interface flags (a la BSD) 1362 * @flags: Interface flags (a la BSD)
@@ -1380,14 +1390,14 @@ enum netdev_priv_flags {
1380 * @dev_port: Used to differentiate devices that share 1390 * @dev_port: Used to differentiate devices that share
1381 * the same function 1391 * the same function
1382 * @addr_list_lock: XXX: need comments on this one 1392 * @addr_list_lock: XXX: need comments on this one
1383 * @uc: unicast mac addresses
1384 * @mc: multicast mac addresses
1385 * @dev_addrs: list of device hw addresses
1386 * @queues_kset: Group of all Kobjects in the Tx and RX queues
1387 * @uc_promisc: Counter, that indicates, that promiscuous mode 1393 * @uc_promisc: Counter, that indicates, that promiscuous mode
1388 * has been enabled due to the need to listen to 1394 * has been enabled due to the need to listen to
1389 * additional unicast addresses in a device that 1395 * additional unicast addresses in a device that
1390 * does not implement ndo_set_rx_mode() 1396 * does not implement ndo_set_rx_mode()
1397 * @uc: unicast mac addresses
1398 * @mc: multicast mac addresses
1399 * @dev_addrs: list of device hw addresses
1400 * @queues_kset: Group of all Kobjects in the Tx and RX queues
1391 * @promiscuity: Number of times, the NIC is told to work in 1401 * @promiscuity: Number of times, the NIC is told to work in
1392 * Promiscuous mode, if it becomes 0 the NIC will 1402 * Promiscuous mode, if it becomes 0 the NIC will
1393 * exit from working in Promiscuous mode 1403 * exit from working in Promiscuous mode
@@ -1417,6 +1427,12 @@ enum netdev_priv_flags {
1417 * @ingress_queue: XXX: need comments on this one 1427 * @ingress_queue: XXX: need comments on this one
1418 * @broadcast: hw bcast address 1428 * @broadcast: hw bcast address
1419 * 1429 *
1430 * @rx_cpu_rmap: CPU reverse-mapping for RX completion interrupts,
1431 * indexed by RX queue number. Assigned by driver.
1432 * This must only be set if the ndo_rx_flow_steer
1433 * operation is defined
1434 * @index_hlist: Device index hash chain
1435 *
1420 * @_tx: Array of TX queues 1436 * @_tx: Array of TX queues
1421 * @num_tx_queues: Number of TX queues allocated at alloc_netdev_mq() time 1437 * @num_tx_queues: Number of TX queues allocated at alloc_netdev_mq() time
1422 * @real_num_tx_queues: Number of TX queues currently active in device 1438 * @real_num_tx_queues: Number of TX queues currently active in device
@@ -1426,11 +1442,6 @@ enum netdev_priv_flags {
1426 * 1442 *
1427 * @xps_maps: XXX: need comments on this one 1443 * @xps_maps: XXX: need comments on this one
1428 * 1444 *
1429 * @rx_cpu_rmap: CPU reverse-mapping for RX completion interrupts,
1430 * indexed by RX queue number. Assigned by driver.
1431 * This must only be set if the ndo_rx_flow_steer
1432 * operation is defined
1433 *
1434 * @trans_start: Time (in jiffies) of last Tx 1445 * @trans_start: Time (in jiffies) of last Tx
1435 * @watchdog_timeo: Represents the timeout that is used by 1446 * @watchdog_timeo: Represents the timeout that is used by
1436 * the watchdog ( see dev_watchdog() ) 1447 * the watchdog ( see dev_watchdog() )
@@ -1438,7 +1449,6 @@ enum netdev_priv_flags {
1438 * 1449 *
1439 * @pcpu_refcnt: Number of references to this device 1450 * @pcpu_refcnt: Number of references to this device
1440 * @todo_list: Delayed register/unregister 1451 * @todo_list: Delayed register/unregister
1441 * @index_hlist: Device index hash chain
1442 * @link_watch_list: XXX: need comments on this one 1452 * @link_watch_list: XXX: need comments on this one
1443 * 1453 *
1444 * @reg_state: Register/unregister state machine 1454 * @reg_state: Register/unregister state machine
@@ -1486,7 +1496,6 @@ enum netdev_priv_flags {
1486 * 1496 *
1487 * @qdisc_tx_busylock: XXX: need comments on this one 1497 * @qdisc_tx_busylock: XXX: need comments on this one
1488 * 1498 *
1489 * @group: The group, that the device belongs to
1490 * @pm_qos_req: Power Management QoS object 1499 * @pm_qos_req: Power Management QoS object
1491 * 1500 *
1492 * FIXME: cleanup struct net_device such that network protocol info 1501 * FIXME: cleanup struct net_device such that network protocol info
@@ -1506,6 +1515,8 @@ struct net_device {
1506 unsigned long base_addr; 1515 unsigned long base_addr;
1507 int irq; 1516 int irq;
1508 1517
1518 atomic_t carrier_changes;
1519
1509 /* 1520 /*
1510 * Some hardware also needs these fields (state,dev_list, 1521 * Some hardware also needs these fields (state,dev_list,
1511 * napi_list,unreg_list,close_list) but they are not 1522 * napi_list,unreg_list,close_list) but they are not
@@ -1539,22 +1550,22 @@ struct net_device {
1539 netdev_features_t mpls_features; 1550 netdev_features_t mpls_features;
1540 1551
1541 int ifindex; 1552 int ifindex;
1542 int iflink; 1553 int group;
1543 1554
1544 struct net_device_stats stats; 1555 struct net_device_stats stats;
1545 1556
1546 atomic_long_t rx_dropped; 1557 atomic_long_t rx_dropped;
1547 atomic_long_t tx_dropped; 1558 atomic_long_t tx_dropped;
1548 1559
1549 atomic_t carrier_changes;
1550
1551#ifdef CONFIG_WIRELESS_EXT 1560#ifdef CONFIG_WIRELESS_EXT
1552 const struct iw_handler_def * wireless_handlers; 1561 const struct iw_handler_def * wireless_handlers;
1553 struct iw_public_data * wireless_data; 1562 struct iw_public_data * wireless_data;
1554#endif 1563#endif
1555 const struct net_device_ops *netdev_ops; 1564 const struct net_device_ops *netdev_ops;
1556 const struct ethtool_ops *ethtool_ops; 1565 const struct ethtool_ops *ethtool_ops;
1557 const struct forwarding_accel_ops *fwd_ops; 1566#ifdef CONFIG_NET_SWITCHDEV
1567 const struct swdev_ops *swdev_ops;
1568#endif
1558 1569
1559 const struct header_ops *header_ops; 1570 const struct header_ops *header_ops;
1560 1571
@@ -1585,6 +1596,8 @@ struct net_device {
1585 unsigned short dev_id; 1596 unsigned short dev_id;
1586 unsigned short dev_port; 1597 unsigned short dev_port;
1587 spinlock_t addr_list_lock; 1598 spinlock_t addr_list_lock;
1599 unsigned char name_assign_type;
1600 bool uc_promisc;
1588 struct netdev_hw_addr_list uc; 1601 struct netdev_hw_addr_list uc;
1589 struct netdev_hw_addr_list mc; 1602 struct netdev_hw_addr_list mc;
1590 struct netdev_hw_addr_list dev_addrs; 1603 struct netdev_hw_addr_list dev_addrs;
@@ -1592,10 +1605,6 @@ struct net_device {
1592#ifdef CONFIG_SYSFS 1605#ifdef CONFIG_SYSFS
1593 struct kset *queues_kset; 1606 struct kset *queues_kset;
1594#endif 1607#endif
1595
1596 unsigned char name_assign_type;
1597
1598 bool uc_promisc;
1599 unsigned int promiscuity; 1608 unsigned int promiscuity;
1600 unsigned int allmulti; 1609 unsigned int allmulti;
1601 1610
@@ -1642,7 +1651,10 @@ struct net_device {
1642 1651
1643 struct netdev_queue __rcu *ingress_queue; 1652 struct netdev_queue __rcu *ingress_queue;
1644 unsigned char broadcast[MAX_ADDR_LEN]; 1653 unsigned char broadcast[MAX_ADDR_LEN];
1645 1654#ifdef CONFIG_RFS_ACCEL
1655 struct cpu_rmap *rx_cpu_rmap;
1656#endif
1657 struct hlist_node index_hlist;
1646 1658
1647/* 1659/*
1648 * Cache lines mostly used on transmit path 1660 * Cache lines mostly used on transmit path
@@ -1653,13 +1665,11 @@ struct net_device {
1653 struct Qdisc *qdisc; 1665 struct Qdisc *qdisc;
1654 unsigned long tx_queue_len; 1666 unsigned long tx_queue_len;
1655 spinlock_t tx_global_lock; 1667 spinlock_t tx_global_lock;
1668 int watchdog_timeo;
1656 1669
1657#ifdef CONFIG_XPS 1670#ifdef CONFIG_XPS
1658 struct xps_dev_maps __rcu *xps_maps; 1671 struct xps_dev_maps __rcu *xps_maps;
1659#endif 1672#endif
1660#ifdef CONFIG_RFS_ACCEL
1661 struct cpu_rmap *rx_cpu_rmap;
1662#endif
1663 1673
1664 /* These may be needed for future network-power-down code. */ 1674 /* These may be needed for future network-power-down code. */
1665 1675
@@ -1669,13 +1679,11 @@ struct net_device {
1669 */ 1679 */
1670 unsigned long trans_start; 1680 unsigned long trans_start;
1671 1681
1672 int watchdog_timeo;
1673 struct timer_list watchdog_timer; 1682 struct timer_list watchdog_timer;
1674 1683
1675 int __percpu *pcpu_refcnt; 1684 int __percpu *pcpu_refcnt;
1676 struct list_head todo_list; 1685 struct list_head todo_list;
1677 1686
1678 struct hlist_node index_hlist;
1679 struct list_head link_watch_list; 1687 struct list_head link_watch_list;
1680 1688
1681 enum { NETREG_UNINITIALIZED=0, 1689 enum { NETREG_UNINITIALIZED=0,
@@ -1699,9 +1707,7 @@ struct net_device {
1699 struct netpoll_info __rcu *npinfo; 1707 struct netpoll_info __rcu *npinfo;
1700#endif 1708#endif
1701 1709
1702#ifdef CONFIG_NET_NS 1710 possible_net_t nd_net;
1703 struct net *nd_net;
1704#endif
1705 1711
1706 /* mid-layer private */ 1712 /* mid-layer private */
1707 union { 1713 union {
@@ -1742,8 +1748,6 @@ struct net_device {
1742#endif 1748#endif
1743 struct phy_device *phydev; 1749 struct phy_device *phydev;
1744 struct lock_class_key *qdisc_tx_busylock; 1750 struct lock_class_key *qdisc_tx_busylock;
1745 int group;
1746 struct pm_qos_request pm_qos_req;
1747}; 1751};
1748#define to_net_dev(d) container_of(d, struct net_device, dev) 1752#define to_net_dev(d) container_of(d, struct net_device, dev)
1749 1753
@@ -1841,10 +1845,7 @@ struct net *dev_net(const struct net_device *dev)
1841static inline 1845static inline
1842void dev_net_set(struct net_device *dev, struct net *net) 1846void dev_net_set(struct net_device *dev, struct net *net)
1843{ 1847{
1844#ifdef CONFIG_NET_NS 1848 write_pnet(&dev->nd_net, net);
1845 release_net(dev->nd_net);
1846 dev->nd_net = hold_net(net);
1847#endif
1848} 1849}
1849 1850
1850static inline bool netdev_uses_dsa(struct net_device *dev) 1851static inline bool netdev_uses_dsa(struct net_device *dev)
@@ -2156,6 +2157,7 @@ void __dev_remove_pack(struct packet_type *pt);
2156void dev_add_offload(struct packet_offload *po); 2157void dev_add_offload(struct packet_offload *po);
2157void dev_remove_offload(struct packet_offload *po); 2158void dev_remove_offload(struct packet_offload *po);
2158 2159
2160int dev_get_iflink(const struct net_device *dev);
2159struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags, 2161struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags,
2160 unsigned short mask); 2162 unsigned short mask);
2161struct net_device *dev_get_by_name(struct net *net, const char *name); 2163struct net_device *dev_get_by_name(struct net *net, const char *name);
@@ -2164,9 +2166,14 @@ struct net_device *__dev_get_by_name(struct net *net, const char *name);
2164int dev_alloc_name(struct net_device *dev, const char *name); 2166int dev_alloc_name(struct net_device *dev, const char *name);
2165int dev_open(struct net_device *dev); 2167int dev_open(struct net_device *dev);
2166int dev_close(struct net_device *dev); 2168int dev_close(struct net_device *dev);
2169int dev_close_many(struct list_head *head, bool unlink);
2167void dev_disable_lro(struct net_device *dev); 2170void dev_disable_lro(struct net_device *dev);
2168int dev_loopback_xmit(struct sk_buff *newskb); 2171int dev_loopback_xmit(struct sock *sk, struct sk_buff *newskb);
2169int dev_queue_xmit(struct sk_buff *skb); 2172int dev_queue_xmit_sk(struct sock *sk, struct sk_buff *skb);
2173static inline int dev_queue_xmit(struct sk_buff *skb)
2174{
2175 return dev_queue_xmit_sk(skb->sk, skb);
2176}
2170int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv); 2177int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv);
2171int register_netdevice(struct net_device *dev); 2178int register_netdevice(struct net_device *dev);
2172void unregister_netdevice_queue(struct net_device *dev, struct list_head *head); 2179void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
@@ -2182,6 +2189,12 @@ void netdev_freemem(struct net_device *dev);
2182void synchronize_net(void); 2189void synchronize_net(void);
2183int init_dummy_netdev(struct net_device *dev); 2190int init_dummy_netdev(struct net_device *dev);
2184 2191
2192DECLARE_PER_CPU(int, xmit_recursion);
2193static inline int dev_recursion_level(void)
2194{
2195 return this_cpu_read(xmit_recursion);
2196}
2197
2185struct net_device *dev_get_by_index(struct net *net, int ifindex); 2198struct net_device *dev_get_by_index(struct net *net, int ifindex);
2186struct net_device *__dev_get_by_index(struct net *net, int ifindex); 2199struct net_device *__dev_get_by_index(struct net *net, int ifindex);
2187struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); 2200struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
@@ -2342,6 +2355,7 @@ struct gro_remcsum {
2342 2355
2343static inline void skb_gro_remcsum_init(struct gro_remcsum *grc) 2356static inline void skb_gro_remcsum_init(struct gro_remcsum *grc)
2344{ 2357{
2358 grc->offset = 0;
2345 grc->delta = 0; 2359 grc->delta = 0;
2346} 2360}
2347 2361
@@ -2399,15 +2413,6 @@ static inline int dev_parse_header(const struct sk_buff *skb,
2399 return dev->header_ops->parse(skb, haddr); 2413 return dev->header_ops->parse(skb, haddr);
2400} 2414}
2401 2415
2402static inline int dev_rebuild_header(struct sk_buff *skb)
2403{
2404 const struct net_device *dev = skb->dev;
2405
2406 if (!dev->header_ops || !dev->header_ops->rebuild)
2407 return 0;
2408 return dev->header_ops->rebuild(skb);
2409}
2410
2411typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); 2416typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
2412int register_gifconf(unsigned int family, gifconf_func_t *gifconf); 2417int register_gifconf(unsigned int family, gifconf_func_t *gifconf);
2413static inline int unregister_gifconf(unsigned int family) 2418static inline int unregister_gifconf(unsigned int family)
@@ -2929,7 +2934,11 @@ static inline void dev_consume_skb_any(struct sk_buff *skb)
2929 2934
2930int netif_rx(struct sk_buff *skb); 2935int netif_rx(struct sk_buff *skb);
2931int netif_rx_ni(struct sk_buff *skb); 2936int netif_rx_ni(struct sk_buff *skb);
2932int netif_receive_skb(struct sk_buff *skb); 2937int netif_receive_skb_sk(struct sock *sk, struct sk_buff *skb);
2938static inline int netif_receive_skb(struct sk_buff *skb)
2939{
2940 return netif_receive_skb_sk(skb->sk, skb);
2941}
2933gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb); 2942gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
2934void napi_gro_flush(struct napi_struct *napi, bool flush_old); 2943void napi_gro_flush(struct napi_struct *napi, bool flush_old);
2935struct sk_buff *napi_get_frags(struct napi_struct *napi); 2944struct sk_buff *napi_get_frags(struct napi_struct *napi);
@@ -2965,6 +2974,8 @@ int dev_set_mac_address(struct net_device *, struct sockaddr *);
2965int dev_change_carrier(struct net_device *, bool new_carrier); 2974int dev_change_carrier(struct net_device *, bool new_carrier);
2966int dev_get_phys_port_id(struct net_device *dev, 2975int dev_get_phys_port_id(struct net_device *dev,
2967 struct netdev_phys_item_id *ppid); 2976 struct netdev_phys_item_id *ppid);
2977int dev_get_phys_port_name(struct net_device *dev,
2978 char *name, size_t len);
2968struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev); 2979struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
2969struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2980struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2970 struct netdev_queue *txq, int *ret); 2981 struct netdev_queue *txq, int *ret);
@@ -3669,6 +3680,9 @@ void netdev_change_features(struct net_device *dev);
3669void netif_stacked_transfer_operstate(const struct net_device *rootdev, 3680void netif_stacked_transfer_operstate(const struct net_device *rootdev,
3670 struct net_device *dev); 3681 struct net_device *dev);
3671 3682
3683netdev_features_t passthru_features_check(struct sk_buff *skb,
3684 struct net_device *dev,
3685 netdev_features_t features);
3672netdev_features_t netif_skb_features(struct sk_buff *skb); 3686netdev_features_t netif_skb_features(struct sk_buff *skb);
3673 3687
3674static inline bool net_gso_ok(netdev_features_t features, int gso_type) 3688static inline bool net_gso_ok(netdev_features_t features, int gso_type)
@@ -3699,7 +3713,7 @@ static inline bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features)
3699 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 3713 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
3700} 3714}
3701 3715
3702static inline bool netif_needs_gso(struct net_device *dev, struct sk_buff *skb, 3716static inline bool netif_needs_gso(struct sk_buff *skb,
3703 netdev_features_t features) 3717 netdev_features_t features)
3704{ 3718{
3705 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || 3719 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 2517ece98820..63560d0a8dfe 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -44,11 +44,39 @@ int netfilter_init(void);
44struct sk_buff; 44struct sk_buff;
45 45
46struct nf_hook_ops; 46struct nf_hook_ops;
47
48struct sock;
49
50struct nf_hook_state {
51 unsigned int hook;
52 int thresh;
53 u_int8_t pf;
54 struct net_device *in;
55 struct net_device *out;
56 struct sock *sk;
57 int (*okfn)(struct sock *, struct sk_buff *);
58};
59
60static inline void nf_hook_state_init(struct nf_hook_state *p,
61 unsigned int hook,
62 int thresh, u_int8_t pf,
63 struct net_device *indev,
64 struct net_device *outdev,
65 struct sock *sk,
66 int (*okfn)(struct sock *, struct sk_buff *))
67{
68 p->hook = hook;
69 p->thresh = thresh;
70 p->pf = pf;
71 p->in = indev;
72 p->out = outdev;
73 p->sk = sk;
74 p->okfn = okfn;
75}
76
47typedef unsigned int nf_hookfn(const struct nf_hook_ops *ops, 77typedef unsigned int nf_hookfn(const struct nf_hook_ops *ops,
48 struct sk_buff *skb, 78 struct sk_buff *skb,
49 const struct net_device *in, 79 const struct nf_hook_state *state);
50 const struct net_device *out,
51 int (*okfn)(struct sk_buff *));
52 80
53struct nf_hook_ops { 81struct nf_hook_ops {
54 struct list_head list; 82 struct list_head list;
@@ -118,9 +146,7 @@ static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
118} 146}
119#endif 147#endif
120 148
121int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 149int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state);
122 struct net_device *indev, struct net_device *outdev,
123 int (*okfn)(struct sk_buff *), int thresh);
124 150
125/** 151/**
126 * nf_hook_thresh - call a netfilter hook 152 * nf_hook_thresh - call a netfilter hook
@@ -130,21 +156,29 @@ int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
130 * value indicates the packet has been consumed by the hook. 156 * value indicates the packet has been consumed by the hook.
131 */ 157 */
132static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, 158static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
159 struct sock *sk,
133 struct sk_buff *skb, 160 struct sk_buff *skb,
134 struct net_device *indev, 161 struct net_device *indev,
135 struct net_device *outdev, 162 struct net_device *outdev,
136 int (*okfn)(struct sk_buff *), int thresh) 163 int (*okfn)(struct sock *, struct sk_buff *),
164 int thresh)
137{ 165{
138 if (nf_hooks_active(pf, hook)) 166 if (nf_hooks_active(pf, hook)) {
139 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh); 167 struct nf_hook_state state;
168
169 nf_hook_state_init(&state, hook, thresh, pf,
170 indev, outdev, sk, okfn);
171 return nf_hook_slow(skb, &state);
172 }
140 return 1; 173 return 1;
141} 174}
142 175
143static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 176static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sock *sk,
144 struct net_device *indev, struct net_device *outdev, 177 struct sk_buff *skb, struct net_device *indev,
145 int (*okfn)(struct sk_buff *)) 178 struct net_device *outdev,
179 int (*okfn)(struct sock *, struct sk_buff *))
146{ 180{
147 return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, INT_MIN); 181 return nf_hook_thresh(pf, hook, sk, skb, indev, outdev, okfn, INT_MIN);
148} 182}
149 183
150/* Activate hook; either okfn or kfree_skb called, unless a hook 184/* Activate hook; either okfn or kfree_skb called, unless a hook
@@ -165,35 +199,36 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
165*/ 199*/
166 200
167static inline int 201static inline int
168NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb, 202NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sock *sk,
169 struct net_device *in, struct net_device *out, 203 struct sk_buff *skb, struct net_device *in,
170 int (*okfn)(struct sk_buff *), int thresh) 204 struct net_device *out,
205 int (*okfn)(struct sock *, struct sk_buff *), int thresh)
171{ 206{
172 int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh); 207 int ret = nf_hook_thresh(pf, hook, sk, skb, in, out, okfn, thresh);
173 if (ret == 1) 208 if (ret == 1)
174 ret = okfn(skb); 209 ret = okfn(sk, skb);
175 return ret; 210 return ret;
176} 211}
177 212
178static inline int 213static inline int
179NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb, 214NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sock *sk,
180 struct net_device *in, struct net_device *out, 215 struct sk_buff *skb, struct net_device *in, struct net_device *out,
181 int (*okfn)(struct sk_buff *), bool cond) 216 int (*okfn)(struct sock *, struct sk_buff *), bool cond)
182{ 217{
183 int ret; 218 int ret;
184 219
185 if (!cond || 220 if (!cond ||
186 ((ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN)) == 1)) 221 ((ret = nf_hook_thresh(pf, hook, sk, skb, in, out, okfn, INT_MIN)) == 1))
187 ret = okfn(skb); 222 ret = okfn(sk, skb);
188 return ret; 223 return ret;
189} 224}
190 225
191static inline int 226static inline int
192NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb, 227NF_HOOK(uint8_t pf, unsigned int hook, struct sock *sk, struct sk_buff *skb,
193 struct net_device *in, struct net_device *out, 228 struct net_device *in, struct net_device *out,
194 int (*okfn)(struct sk_buff *)) 229 int (*okfn)(struct sock *, struct sk_buff *))
195{ 230{
196 return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, INT_MIN); 231 return NF_HOOK_THRESH(pf, hook, sk, skb, in, out, okfn, INT_MIN);
197} 232}
198 233
199/* Call setsockopt() */ 234/* Call setsockopt() */
@@ -293,19 +328,21 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
293} 328}
294 329
295#else /* !CONFIG_NETFILTER */ 330#else /* !CONFIG_NETFILTER */
296#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) 331#define NF_HOOK(pf, hook, sk, skb, indev, outdev, okfn) (okfn)(sk, skb)
297#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) 332#define NF_HOOK_COND(pf, hook, sk, skb, indev, outdev, okfn, cond) (okfn)(sk, skb)
298static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, 333static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
334 struct sock *sk,
299 struct sk_buff *skb, 335 struct sk_buff *skb,
300 struct net_device *indev, 336 struct net_device *indev,
301 struct net_device *outdev, 337 struct net_device *outdev,
302 int (*okfn)(struct sk_buff *), int thresh) 338 int (*okfn)(struct sock *sk, struct sk_buff *), int thresh)
303{ 339{
304 return okfn(skb); 340 return okfn(sk, skb);
305} 341}
306static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 342static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sock *sk,
307 struct net_device *indev, struct net_device *outdev, 343 struct sk_buff *skb, struct net_device *indev,
308 int (*okfn)(struct sk_buff *)) 344 struct net_device *outdev,
345 int (*okfn)(struct sock *, struct sk_buff *))
309{ 346{
310 return 1; 347 return 1;
311} 348}
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index f1606fa6132d..34b172301558 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -483,7 +483,7 @@ static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr)
483 483
484 if (!__nested) 484 if (!__nested)
485 return -EMSGSIZE; 485 return -EMSGSIZE;
486 ret = nla_put_net32(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr); 486 ret = nla_put_in_addr(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr);
487 if (!ret) 487 if (!ret)
488 ipset_nest_end(skb, __nested); 488 ipset_nest_end(skb, __nested);
489 return ret; 489 return ret;
@@ -497,8 +497,7 @@ static inline int nla_put_ipaddr6(struct sk_buff *skb, int type,
497 497
498 if (!__nested) 498 if (!__nested)
499 return -EMSGSIZE; 499 return -EMSGSIZE;
500 ret = nla_put(skb, IPSET_ATTR_IPADDR_IPV6, 500 ret = nla_put_in6_addr(skb, IPSET_ATTR_IPADDR_IPV6, ipaddrptr);
501 sizeof(struct in6_addr), ipaddrptr);
502 if (!ret) 501 if (!ret)
503 ipset_nest_end(skb, __nested); 502 ipset_nest_end(skb, __nested);
504 return ret; 503 return ret;
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index cfb7191e6efa..c22a7fb8d0df 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -54,8 +54,7 @@ extern struct xt_table *arpt_register_table(struct net *net,
54extern void arpt_unregister_table(struct xt_table *table); 54extern void arpt_unregister_table(struct xt_table *table);
55extern unsigned int arpt_do_table(struct sk_buff *skb, 55extern unsigned int arpt_do_table(struct sk_buff *skb,
56 unsigned int hook, 56 unsigned int hook,
57 const struct net_device *in, 57 const struct nf_hook_state *state,
58 const struct net_device *out,
59 struct xt_table *table); 58 struct xt_table *table);
60 59
61#ifdef CONFIG_COMPAT 60#ifdef CONFIG_COMPAT
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index c755e4971fa3..ab8f76dba668 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -2,7 +2,7 @@
2#define __LINUX_BRIDGE_NETFILTER_H 2#define __LINUX_BRIDGE_NETFILTER_H
3 3
4#include <uapi/linux/netfilter_bridge.h> 4#include <uapi/linux/netfilter_bridge.h>
5 5#include <linux/skbuff.h>
6 6
7enum nf_br_hook_priorities { 7enum nf_br_hook_priorities {
8 NF_BR_PRI_FIRST = INT_MIN, 8 NF_BR_PRI_FIRST = INT_MIN,
@@ -17,110 +17,48 @@ enum nf_br_hook_priorities {
17 17
18#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) 18#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
19 19
20#define BRNF_PKT_TYPE 0x01
21#define BRNF_BRIDGED_DNAT 0x02 20#define BRNF_BRIDGED_DNAT 0x02
22#define BRNF_BRIDGED 0x04
23#define BRNF_NF_BRIDGE_PREROUTING 0x08 21#define BRNF_NF_BRIDGE_PREROUTING 0x08
24#define BRNF_8021Q 0x10
25#define BRNF_PPPoE 0x20
26 22
27static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb) 23static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
28{ 24{
29 switch (skb->protocol) { 25 if (skb->nf_bridge->orig_proto == BRNF_PROTO_PPPOE)
30 case __cpu_to_be16(ETH_P_8021Q):
31 return VLAN_HLEN;
32 case __cpu_to_be16(ETH_P_PPP_SES):
33 return PPPOE_SES_HLEN; 26 return PPPOE_SES_HLEN;
34 default: 27 return 0;
35 return 0;
36 }
37} 28}
38 29
39static inline void nf_bridge_update_protocol(struct sk_buff *skb) 30int br_handle_frame_finish(struct sock *sk, struct sk_buff *skb);
40{
41 if (skb->nf_bridge->mask & BRNF_8021Q)
42 skb->protocol = htons(ETH_P_8021Q);
43 else if (skb->nf_bridge->mask & BRNF_PPPoE)
44 skb->protocol = htons(ETH_P_PPP_SES);
45}
46 31
47/* Fill in the header for fragmented IP packets handled by 32static inline void br_drop_fake_rtable(struct sk_buff *skb)
48 * the IPv4 connection tracking code.
49 *
50 * Only used in br_forward.c
51 */
52static inline int nf_bridge_copy_header(struct sk_buff *skb)
53{ 33{
54 int err; 34 struct dst_entry *dst = skb_dst(skb);
55 unsigned int header_size;
56
57 nf_bridge_update_protocol(skb);
58 header_size = ETH_HLEN + nf_bridge_encap_header_len(skb);
59 err = skb_cow_head(skb, header_size);
60 if (err)
61 return err;
62 35
63 skb_copy_to_linear_data_offset(skb, -header_size, 36 if (dst && (dst->flags & DST_FAKE_RTABLE))
64 skb->nf_bridge->data, header_size); 37 skb_dst_drop(skb);
65 __skb_push(skb, nf_bridge_encap_header_len(skb));
66 return 0;
67} 38}
68 39
69static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb) 40static inline int nf_bridge_get_physinif(const struct sk_buff *skb)
70{ 41{
71 if (skb->nf_bridge && 42 return skb->nf_bridge ? skb->nf_bridge->physindev->ifindex : 0;
72 skb->nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT))
73 return nf_bridge_copy_header(skb);
74 return 0;
75} 43}
76 44
77static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb) 45static inline int nf_bridge_get_physoutif(const struct sk_buff *skb)
78{ 46{
79 if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE)) 47 return skb->nf_bridge ? skb->nf_bridge->physoutdev->ifindex : 0;
80 return PPPOE_SES_HLEN;
81 return 0;
82} 48}
83 49
84int br_handle_frame_finish(struct sk_buff *skb); 50static inline struct net_device *
85/* Only used in br_device.c */ 51nf_bridge_get_physindev(const struct sk_buff *skb)
86static inline int br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb)
87{ 52{
88 struct nf_bridge_info *nf_bridge = skb->nf_bridge; 53 return skb->nf_bridge ? skb->nf_bridge->physindev : NULL;
89
90 skb_pull(skb, ETH_HLEN);
91 nf_bridge->mask ^= BRNF_BRIDGED_DNAT;
92 skb_copy_to_linear_data_offset(skb, -(ETH_HLEN-ETH_ALEN),
93 skb->nf_bridge->data, ETH_HLEN-ETH_ALEN);
94 skb->dev = nf_bridge->physindev;
95 return br_handle_frame_finish(skb);
96} 54}
97 55
98/* This is called by the IP fragmenting code and it ensures there is 56static inline struct net_device *
99 * enough room for the encapsulating header (if there is one). */ 57nf_bridge_get_physoutdev(const struct sk_buff *skb)
100static inline unsigned int nf_bridge_pad(const struct sk_buff *skb)
101{ 58{
102 if (skb->nf_bridge) 59 return skb->nf_bridge ? skb->nf_bridge->physoutdev : NULL;
103 return nf_bridge_encap_header_len(skb);
104 return 0;
105} 60}
106
107struct bridge_skb_cb {
108 union {
109 __be32 ipv4;
110 } daddr;
111};
112
113static inline void br_drop_fake_rtable(struct sk_buff *skb)
114{
115 struct dst_entry *dst = skb_dst(skb);
116
117 if (dst && (dst->flags & DST_FAKE_RTABLE))
118 skb_dst_drop(skb);
119}
120
121#else 61#else
122#define nf_bridge_maybe_copy_header(skb) (0)
123#define nf_bridge_pad(skb) (0)
124#define br_drop_fake_rtable(skb) do { } while (0) 62#define br_drop_fake_rtable(skb) do { } while (0)
125#endif /* CONFIG_BRIDGE_NETFILTER */ 63#endif /* CONFIG_BRIDGE_NETFILTER */
126 64
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 34e7a2b7f867..f1bd3962e6b6 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -12,9 +12,10 @@
12#ifndef __LINUX_BRIDGE_EFF_H 12#ifndef __LINUX_BRIDGE_EFF_H
13#define __LINUX_BRIDGE_EFF_H 13#define __LINUX_BRIDGE_EFF_H
14 14
15#include <linux/if.h>
16#include <linux/if_ether.h>
15#include <uapi/linux/netfilter_bridge/ebtables.h> 17#include <uapi/linux/netfilter_bridge/ebtables.h>
16 18
17
18/* return values for match() functions */ 19/* return values for match() functions */
19#define EBT_MATCH 0 20#define EBT_MATCH 0
20#define EBT_NOMATCH 1 21#define EBT_NOMATCH 1
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 901e84db847d..4073510da485 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -65,8 +65,7 @@ struct ipt_error {
65extern void *ipt_alloc_initial_table(const struct xt_table *); 65extern void *ipt_alloc_initial_table(const struct xt_table *);
66extern unsigned int ipt_do_table(struct sk_buff *skb, 66extern unsigned int ipt_do_table(struct sk_buff *skb,
67 unsigned int hook, 67 unsigned int hook,
68 const struct net_device *in, 68 const struct nf_hook_state *state,
69 const struct net_device *out,
70 struct xt_table *table); 69 struct xt_table *table);
71 70
72#ifdef CONFIG_COMPAT 71#ifdef CONFIG_COMPAT
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 610208b18c05..b40d2b635778 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -31,8 +31,7 @@ extern struct xt_table *ip6t_register_table(struct net *net,
31extern void ip6t_unregister_table(struct net *net, struct xt_table *table); 31extern void ip6t_unregister_table(struct net *net, struct xt_table *table);
32extern unsigned int ip6t_do_table(struct sk_buff *skb, 32extern unsigned int ip6t_do_table(struct sk_buff *skb,
33 unsigned int hook, 33 unsigned int hook,
34 const struct net_device *in, 34 const struct nf_hook_state *state,
35 const struct net_device *out,
36 struct xt_table *table); 35 struct xt_table *table);
37 36
38/* Check for an extension */ 37/* Check for an extension */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 02fc86d2348e..6835c1279df7 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -134,7 +134,7 @@ struct netlink_callback {
134 134
135struct netlink_notify { 135struct netlink_notify {
136 struct net *net; 136 struct net *net;
137 int portid; 137 u32 portid;
138 int protocol; 138 int protocol;
139}; 139};
140 140
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index ed43cb74b11d..32201c269890 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -16,6 +16,13 @@
16#include <linux/uidgid.h> 16#include <linux/uidgid.h>
17#include <uapi/linux/nfs4.h> 17#include <uapi/linux/nfs4.h>
18 18
19enum nfs4_acl_whotype {
20 NFS4_ACL_WHO_NAMED = 0,
21 NFS4_ACL_WHO_OWNER,
22 NFS4_ACL_WHO_GROUP,
23 NFS4_ACL_WHO_EVERYONE,
24};
25
19struct nfs4_ace { 26struct nfs4_ace {
20 uint32_t type; 27 uint32_t type;
21 uint32_t flag; 28 uint32_t flag;
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 2f77e0c651c8..b95f914ce083 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -343,6 +343,7 @@ extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,
343extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); 343extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
344extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); 344extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr);
345extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); 345extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr);
346extern int nfs_post_op_update_inode_force_wcc_locked(struct inode *inode, struct nfs_fattr *fattr);
346extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 347extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
347extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *); 348extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *);
348extern void nfs_access_set_mask(struct nfs_access_entry *, u32); 349extern void nfs_access_set_mask(struct nfs_access_entry *, u32);
@@ -355,8 +356,9 @@ extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
355extern int nfs_revalidate_inode_rcu(struct nfs_server *server, struct inode *inode); 356extern int nfs_revalidate_inode_rcu(struct nfs_server *server, struct inode *inode);
356extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 357extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
357extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 358extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
359extern int nfs_revalidate_mapping_protected(struct inode *inode, struct address_space *mapping);
358extern int nfs_setattr(struct dentry *, struct iattr *); 360extern int nfs_setattr(struct dentry *, struct iattr *);
359extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 361extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr, struct nfs_fattr *);
360extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, 362extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr,
361 struct nfs4_label *label); 363 struct nfs4_label *label);
362extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 364extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
@@ -369,6 +371,7 @@ extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ct
369extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); 371extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx);
370extern u64 nfs_compat_user_ino64(u64 fileid); 372extern u64 nfs_compat_user_ino64(u64 fileid);
371extern void nfs_fattr_init(struct nfs_fattr *fattr); 373extern void nfs_fattr_init(struct nfs_fattr *fattr);
374extern void nfs_fattr_set_barrier(struct nfs_fattr *fattr);
372extern unsigned long nfs_inc_attr_generation_counter(void); 375extern unsigned long nfs_inc_attr_generation_counter(void);
373 376
374extern struct nfs_fattr *nfs_alloc_fattr(void); 377extern struct nfs_fattr *nfs_alloc_fattr(void);
@@ -444,13 +447,12 @@ static inline struct rpc_cred *nfs_file_cred(struct file *file)
444/* 447/*
445 * linux/fs/nfs/direct.c 448 * linux/fs/nfs/direct.c
446 */ 449 */
447extern ssize_t nfs_direct_IO(int, struct kiocb *, struct iov_iter *, loff_t); 450extern ssize_t nfs_direct_IO(struct kiocb *, struct iov_iter *, loff_t);
448extern ssize_t nfs_file_direct_read(struct kiocb *iocb, 451extern ssize_t nfs_file_direct_read(struct kiocb *iocb,
449 struct iov_iter *iter, 452 struct iov_iter *iter,
450 loff_t pos); 453 loff_t pos);
451extern ssize_t nfs_file_direct_write(struct kiocb *iocb, 454extern ssize_t nfs_file_direct_write(struct kiocb *iocb,
452 struct iov_iter *iter, 455 struct iov_iter *iter);
453 loff_t pos);
454 456
455/* 457/*
456 * linux/fs/nfs/dir.c 458 * linux/fs/nfs/dir.c
@@ -509,6 +511,7 @@ extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned
509 * Try to write back everything synchronously (but check the 511 * Try to write back everything synchronously (but check the
510 * return value!) 512 * return value!)
511 */ 513 */
514extern int nfs_sync_inode(struct inode *inode);
512extern int nfs_wb_all(struct inode *inode); 515extern int nfs_wb_all(struct inode *inode);
513extern int nfs_wb_page(struct inode *inode, struct page* page); 516extern int nfs_wb_page(struct inode *inode, struct page* page);
514extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 517extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
deleted file mode 100644
index 333844e38f66..000000000000
--- a/include/linux/nfs_idmap.h
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * include/linux/nfs_idmap.h
3 *
4 * UID and GID to name mapping for clients.
5 *
6 * Copyright (c) 2002 The Regents of the University of Michigan.
7 * All rights reserved.
8 *
9 * Marius Aamodt Eriksen <marius@umich.edu>
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
25 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36#ifndef NFS_IDMAP_H
37#define NFS_IDMAP_H
38
39#include <linux/uidgid.h>
40#include <uapi/linux/nfs_idmap.h>
41
42
43/* Forward declaration to make this header independent of others */
44struct nfs_client;
45struct nfs_server;
46struct nfs_fattr;
47struct nfs4_string;
48
49#if IS_ENABLED(CONFIG_NFS_V4)
50int nfs_idmap_init(void);
51void nfs_idmap_quit(void);
52#else
53static inline int nfs_idmap_init(void)
54{
55 return 0;
56}
57
58static inline void nfs_idmap_quit(void)
59{}
60#endif
61
62int nfs_idmap_new(struct nfs_client *);
63void nfs_idmap_delete(struct nfs_client *);
64
65void nfs_fattr_init_names(struct nfs_fattr *fattr,
66 struct nfs4_string *owner_name,
67 struct nfs4_string *group_name);
68void nfs_fattr_free_names(struct nfs_fattr *);
69void nfs_fattr_map_and_free_names(struct nfs_server *, struct nfs_fattr *);
70
71int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, kuid_t *);
72int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, kgid_t *);
73int nfs_map_uid_to_name(const struct nfs_server *, kuid_t, char *, size_t);
74int nfs_map_gid_to_group(const struct nfs_server *, kgid_t, char *, size_t);
75
76int nfs_map_string_to_numeric(const char *name, size_t namelen, __u32 *res);
77
78extern unsigned int nfs_idmap_cache_timeout;
79#endif /* NFS_IDMAP_H */
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 4cb3eaa89cf7..93ab6071bbe9 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -255,11 +255,13 @@ struct nfs4_layoutget {
255struct nfs4_getdeviceinfo_args { 255struct nfs4_getdeviceinfo_args {
256 struct nfs4_sequence_args seq_args; 256 struct nfs4_sequence_args seq_args;
257 struct pnfs_device *pdev; 257 struct pnfs_device *pdev;
258 __u32 notify_types;
258}; 259};
259 260
260struct nfs4_getdeviceinfo_res { 261struct nfs4_getdeviceinfo_res {
261 struct nfs4_sequence_res seq_res; 262 struct nfs4_sequence_res seq_res;
262 struct pnfs_device *pdev; 263 struct pnfs_device *pdev;
264 __u32 notification;
263}; 265};
264 266
265struct nfs4_layoutcommit_args { 267struct nfs4_layoutcommit_args {
@@ -1271,11 +1273,15 @@ struct nfs42_falloc_args {
1271 nfs4_stateid falloc_stateid; 1273 nfs4_stateid falloc_stateid;
1272 u64 falloc_offset; 1274 u64 falloc_offset;
1273 u64 falloc_length; 1275 u64 falloc_length;
1276 const u32 *falloc_bitmask;
1274}; 1277};
1275 1278
1276struct nfs42_falloc_res { 1279struct nfs42_falloc_res {
1277 struct nfs4_sequence_res seq_res; 1280 struct nfs4_sequence_res seq_res;
1278 unsigned int status; 1281 unsigned int status;
1282
1283 struct nfs_fattr *falloc_fattr;
1284 const struct nfs_server *falloc_server;
1279}; 1285};
1280 1286
1281struct nfs42_seek_args { 1287struct nfs42_seek_args {
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 9b2022ab4d85..3d46fb4708e0 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -25,16 +25,11 @@ static inline void touch_nmi_watchdog(void)
25#endif 25#endif
26 26
27#if defined(CONFIG_HARDLOCKUP_DETECTOR) 27#if defined(CONFIG_HARDLOCKUP_DETECTOR)
28extern void watchdog_enable_hardlockup_detector(bool val); 28extern void hardlockup_detector_disable(void);
29extern bool watchdog_hardlockup_detector_is_enabled(void);
30#else 29#else
31static inline void watchdog_enable_hardlockup_detector(bool val) 30static inline void hardlockup_detector_disable(void)
32{ 31{
33} 32}
34static inline bool watchdog_hardlockup_detector_is_enabled(void)
35{
36 return true;
37}
38#endif 33#endif
39 34
40/* 35/*
@@ -68,12 +63,20 @@ static inline bool trigger_allbutself_cpu_backtrace(void)
68#ifdef CONFIG_LOCKUP_DETECTOR 63#ifdef CONFIG_LOCKUP_DETECTOR
69int hw_nmi_is_cpu_stuck(struct pt_regs *); 64int hw_nmi_is_cpu_stuck(struct pt_regs *);
70u64 hw_nmi_get_sample_period(int watchdog_thresh); 65u64 hw_nmi_get_sample_period(int watchdog_thresh);
66extern int nmi_watchdog_enabled;
67extern int soft_watchdog_enabled;
71extern int watchdog_user_enabled; 68extern int watchdog_user_enabled;
72extern int watchdog_thresh; 69extern int watchdog_thresh;
73extern int sysctl_softlockup_all_cpu_backtrace; 70extern int sysctl_softlockup_all_cpu_backtrace;
74struct ctl_table; 71struct ctl_table;
75extern int proc_dowatchdog(struct ctl_table *, int , 72extern int proc_watchdog(struct ctl_table *, int ,
76 void __user *, size_t *, loff_t *); 73 void __user *, size_t *, loff_t *);
74extern int proc_nmi_watchdog(struct ctl_table *, int ,
75 void __user *, size_t *, loff_t *);
76extern int proc_soft_watchdog(struct ctl_table *, int ,
77 void __user *, size_t *, loff_t *);
78extern int proc_watchdog_thresh(struct ctl_table *, int ,
79 void __user *, size_t *, loff_t *);
77#endif 80#endif
78 81
79#ifdef CONFIG_HAVE_ACPI_APEI_NMI 82#ifdef CONFIG_HAVE_ACPI_APEI_NMI
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 0adad4a5419b..8dbd05e70f09 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -117,8 +117,9 @@ struct nvme_ns {
117 117
118 unsigned ns_id; 118 unsigned ns_id;
119 int lba_shift; 119 int lba_shift;
120 int ms; 120 u16 ms;
121 int pi_type; 121 bool ext;
122 u8 pi_type;
122 u64 mode_select_num_blocks; 123 u64 mode_select_num_blocks;
123 u32 mode_select_block_len; 124 u32 mode_select_block_len;
124}; 125};
diff --git a/include/linux/of.h b/include/linux/of.h
index dfde07e77a63..ddeaae6d2083 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -305,6 +305,7 @@ extern int of_property_read_string_helper(struct device_node *np,
305extern int of_device_is_compatible(const struct device_node *device, 305extern int of_device_is_compatible(const struct device_node *device,
306 const char *); 306 const char *);
307extern bool of_device_is_available(const struct device_node *device); 307extern bool of_device_is_available(const struct device_node *device);
308extern bool of_device_is_big_endian(const struct device_node *device);
308extern const void *of_get_property(const struct device_node *node, 309extern const void *of_get_property(const struct device_node *node,
309 const char *name, 310 const char *name,
310 int *lenp); 311 int *lenp);
@@ -332,6 +333,7 @@ extern int of_count_phandle_with_args(const struct device_node *np,
332 333
333extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); 334extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
334extern int of_alias_get_id(struct device_node *np, const char *stem); 335extern int of_alias_get_id(struct device_node *np, const char *stem);
336extern int of_alias_get_highest_id(const char *stem);
335 337
336extern int of_machine_is_compatible(const char *compat); 338extern int of_machine_is_compatible(const char *compat);
337 339
@@ -466,6 +468,11 @@ static inline bool of_device_is_available(const struct device_node *device)
466 return false; 468 return false;
467} 469}
468 470
471static inline bool of_device_is_big_endian(const struct device_node *device)
472{
473 return false;
474}
475
469static inline struct property *of_find_property(const struct device_node *np, 476static inline struct property *of_find_property(const struct device_node *np,
470 const char *name, 477 const char *name,
471 int *lenp) 478 int *lenp)
@@ -594,6 +601,11 @@ static inline int of_alias_get_id(struct device_node *np, const char *stem)
594 return -ENOSYS; 601 return -ENOSYS;
595} 602}
596 603
604static inline int of_alias_get_highest_id(const char *stem)
605{
606 return -ENOSYS;
607}
608
597static inline int of_machine_is_compatible(const char *compat) 609static inline int of_machine_is_compatible(const char *compat)
598{ 610{
599 return 0; 611 return 0;
@@ -616,6 +628,38 @@ static inline const char *of_prop_next_string(struct property *prop,
616 return NULL; 628 return NULL;
617} 629}
618 630
631static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
632{
633 return 0;
634}
635
636static inline int of_node_test_and_set_flag(struct device_node *n,
637 unsigned long flag)
638{
639 return 0;
640}
641
642static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
643{
644}
645
646static inline void of_node_clear_flag(struct device_node *n, unsigned long flag)
647{
648}
649
650static inline int of_property_check_flag(struct property *p, unsigned long flag)
651{
652 return 0;
653}
654
655static inline void of_property_set_flag(struct property *p, unsigned long flag)
656{
657}
658
659static inline void of_property_clear_flag(struct property *p, unsigned long flag)
660{
661}
662
619#define of_match_ptr(_ptr) NULL 663#define of_match_ptr(_ptr) NULL
620#define of_match_node(_matches, _node) NULL 664#define of_match_node(_matches, _node) NULL
621#endif /* CONFIG_OF */ 665#endif /* CONFIG_OF */
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index ef370210ffb2..22801b10cef5 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -53,6 +53,7 @@ static inline struct device_node *of_cpu_device_node_get(int cpu)
53 return of_node_get(cpu_dev->of_node); 53 return of_node_get(cpu_dev->of_node);
54} 54}
55 55
56void of_dma_configure(struct device *dev, struct device_node *np);
56#else /* CONFIG_OF */ 57#else /* CONFIG_OF */
57 58
58static inline int of_driver_match_device(struct device *dev, 59static inline int of_driver_match_device(struct device *dev,
@@ -90,6 +91,8 @@ static inline struct device_node *of_cpu_device_node_get(int cpu)
90{ 91{
91 return NULL; 92 return NULL;
92} 93}
94static inline void of_dma_configure(struct device *dev, struct device_node *np)
95{}
93#endif /* CONFIG_OF */ 96#endif /* CONFIG_OF */
94 97
95#endif /* _LINUX_OF_DEVICE_H */ 98#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 0ff360d5b3b3..587ee507965d 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -33,6 +33,8 @@ extern void *of_fdt_get_property(const void *blob,
33extern int of_fdt_is_compatible(const void *blob, 33extern int of_fdt_is_compatible(const void *blob,
34 unsigned long node, 34 unsigned long node,
35 const char *compat); 35 const char *compat);
36extern bool of_fdt_is_big_endian(const void *blob,
37 unsigned long node);
36extern int of_fdt_match(const void *blob, unsigned long node, 38extern int of_fdt_match(const void *blob, unsigned long node,
37 const char *const *compat); 39 const char *const *compat);
38extern void of_fdt_unflatten_tree(unsigned long *blob, 40extern void of_fdt_unflatten_tree(unsigned long *blob,
diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h
index befef42e015b..7bc92e050608 100644
--- a/include/linux/of_graph.h
+++ b/include/linux/of_graph.h
@@ -14,6 +14,8 @@
14#ifndef __LINUX_OF_GRAPH_H 14#ifndef __LINUX_OF_GRAPH_H
15#define __LINUX_OF_GRAPH_H 15#define __LINUX_OF_GRAPH_H
16 16
17#include <linux/types.h>
18
17/** 19/**
18 * struct of_endpoint - the OF graph endpoint data structure 20 * struct of_endpoint - the OF graph endpoint data structure
19 * @port: identifier (value of reg property) of a port this endpoint belongs to 21 * @port: identifier (value of reg property) of a port this endpoint belongs to
@@ -26,9 +28,21 @@ struct of_endpoint {
26 const struct device_node *local_node; 28 const struct device_node *local_node;
27}; 29};
28 30
31/**
32 * for_each_endpoint_of_node - iterate over every endpoint in a device node
33 * @parent: parent device node containing ports and endpoints
34 * @child: loop variable pointing to the current endpoint node
35 *
36 * When breaking out of the loop, of_node_put(child) has to be called manually.
37 */
38#define for_each_endpoint_of_node(parent, child) \
39 for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \
40 child = of_graph_get_next_endpoint(parent, child))
41
29#ifdef CONFIG_OF 42#ifdef CONFIG_OF
30int of_graph_parse_endpoint(const struct device_node *node, 43int of_graph_parse_endpoint(const struct device_node *node,
31 struct of_endpoint *endpoint); 44 struct of_endpoint *endpoint);
45struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id);
32struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, 46struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
33 struct device_node *previous); 47 struct device_node *previous);
34struct device_node *of_graph_get_remote_port_parent( 48struct device_node *of_graph_get_remote_port_parent(
@@ -42,6 +56,12 @@ static inline int of_graph_parse_endpoint(const struct device_node *node,
42 return -ENOSYS; 56 return -ENOSYS;
43} 57}
44 58
59static inline struct device_node *of_graph_get_port_by_id(
60 struct device_node *node, u32 id)
61{
62 return NULL;
63}
64
45static inline struct device_node *of_graph_get_next_endpoint( 65static inline struct device_node *of_graph_get_next_endpoint(
46 const struct device_node *parent, 66 const struct device_node *parent,
47 struct device_node *previous) 67 struct device_node *previous)
diff --git a/include/linux/of_iommu.h b/include/linux/of_iommu.h
index 16c75547d725..ffbe4707d4aa 100644
--- a/include/linux/of_iommu.h
+++ b/include/linux/of_iommu.h
@@ -12,7 +12,8 @@ extern int of_get_dma_window(struct device_node *dn, const char *prefix,
12 size_t *size); 12 size_t *size);
13 13
14extern void of_iommu_init(void); 14extern void of_iommu_init(void);
15extern struct iommu_ops *of_iommu_configure(struct device *dev); 15extern struct iommu_ops *of_iommu_configure(struct device *dev,
16 struct device_node *master_np);
16 17
17#else 18#else
18 19
@@ -24,7 +25,8 @@ static inline int of_get_dma_window(struct device_node *dn, const char *prefix,
24} 25}
25 26
26static inline void of_iommu_init(void) { } 27static inline void of_iommu_init(void) { }
27static inline struct iommu_ops *of_iommu_configure(struct device *dev) 28static inline struct iommu_ops *of_iommu_configure(struct device *dev,
29 struct device_node *master_np)
28{ 30{
29 return NULL; 31 return NULL;
30} 32}
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index bfec136a6d1e..d884929a7747 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -37,8 +37,6 @@ extern int of_irq_parse_one(struct device_node *device, int index,
37extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data); 37extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data);
38extern int of_irq_to_resource(struct device_node *dev, int index, 38extern int of_irq_to_resource(struct device_node *dev, int index,
39 struct resource *r); 39 struct resource *r);
40extern int of_irq_to_resource_table(struct device_node *dev,
41 struct resource *res, int nr_irqs);
42 40
43extern void of_irq_init(const struct of_device_id *matches); 41extern void of_irq_init(const struct of_device_id *matches);
44 42
@@ -46,6 +44,8 @@ extern void of_irq_init(const struct of_device_id *matches);
46extern int of_irq_count(struct device_node *dev); 44extern int of_irq_count(struct device_node *dev);
47extern int of_irq_get(struct device_node *dev, int index); 45extern int of_irq_get(struct device_node *dev, int index);
48extern int of_irq_get_byname(struct device_node *dev, const char *name); 46extern int of_irq_get_byname(struct device_node *dev, const char *name);
47extern int of_irq_to_resource_table(struct device_node *dev,
48 struct resource *res, int nr_irqs);
49#else 49#else
50static inline int of_irq_count(struct device_node *dev) 50static inline int of_irq_count(struct device_node *dev)
51{ 51{
@@ -59,6 +59,11 @@ static inline int of_irq_get_byname(struct device_node *dev, const char *name)
59{ 59{
60 return 0; 60 return 0;
61} 61}
62static inline int of_irq_to_resource_table(struct device_node *dev,
63 struct resource *res, int nr_irqs)
64{
65 return 0;
66}
62#endif 67#endif
63 68
64#if defined(CONFIG_OF) 69#if defined(CONFIG_OF)
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index d449018d0726..8f2237eb3485 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -24,6 +24,7 @@ struct phy_device *of_phy_attach(struct net_device *dev,
24 phy_interface_t iface); 24 phy_interface_t iface);
25 25
26extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); 26extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
27extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np);
27 28
28#else /* CONFIG_OF */ 29#else /* CONFIG_OF */
29static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) 30static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
@@ -60,6 +61,12 @@ static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np)
60{ 61{
61 return NULL; 62 return NULL;
62} 63}
64
65static inline int of_mdio_parse_addr(struct device *dev,
66 const struct device_node *np)
67{
68 return -ENOSYS;
69}
63#endif /* CONFIG_OF */ 70#endif /* CONFIG_OF */
64 71
65#if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY) 72#if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY)
diff --git a/include/linux/of_net.h b/include/linux/of_net.h
index 34597c8c1a4c..9cd72aab76fe 100644
--- a/include/linux/of_net.h
+++ b/include/linux/of_net.h
@@ -9,8 +9,11 @@
9 9
10#ifdef CONFIG_OF_NET 10#ifdef CONFIG_OF_NET
11#include <linux/of.h> 11#include <linux/of.h>
12
13struct net_device;
12extern int of_get_phy_mode(struct device_node *np); 14extern int of_get_phy_mode(struct device_node *np);
13extern const void *of_get_mac_address(struct device_node *np); 15extern const void *of_get_mac_address(struct device_node *np);
16extern struct net_device *of_find_net_device_by_node(struct device_node *np);
14#else 17#else
15static inline int of_get_phy_mode(struct device_node *np) 18static inline int of_get_phy_mode(struct device_node *np)
16{ 19{
@@ -21,6 +24,11 @@ static inline const void *of_get_mac_address(struct device_node *np)
21{ 24{
22 return NULL; 25 return NULL;
23} 26}
27
28static inline struct net_device *of_find_net_device_by_node(struct device_node *np)
29{
30 return NULL;
31}
24#endif 32#endif
25 33
26#endif /* __LINUX_OF_NET_H */ 34#endif /* __LINUX_OF_NET_H */
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index ce0e5abeb454..29fd3fe1c035 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -16,6 +16,7 @@ int of_pci_get_devfn(struct device_node *np);
16int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin); 16int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin);
17int of_pci_parse_bus_range(struct device_node *node, struct resource *res); 17int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
18int of_get_pci_domain_nr(struct device_node *node); 18int of_get_pci_domain_nr(struct device_node *node);
19void of_pci_dma_configure(struct pci_dev *pci_dev);
19#else 20#else
20static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) 21static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
21{ 22{
@@ -50,6 +51,8 @@ of_get_pci_domain_nr(struct device_node *node)
50{ 51{
51 return -1; 52 return -1;
52} 53}
54
55static inline void of_pci_dma_configure(struct pci_dev *pci_dev) { }
53#endif 56#endif
54 57
55#if defined(CONFIG_OF_ADDRESS) 58#if defined(CONFIG_OF_ADDRESS)
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 8a860f096c35..611a691145c4 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -84,7 +84,7 @@ 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 87#if defined(CONFIG_OF_DYNAMIC) && defined(CONFIG_OF_ADDRESS)
88extern void of_platform_register_reconfig_notifier(void); 88extern void of_platform_register_reconfig_notifier(void);
89#else 89#else
90static inline void of_platform_register_reconfig_notifier(void) { } 90static inline void of_platform_register_reconfig_notifier(void) { }
diff --git a/include/linux/omap-gpmc.h b/include/linux/omap-gpmc.h
index c2080eebbb47..7dee00143afd 100644
--- a/include/linux/omap-gpmc.h
+++ b/include/linux/omap-gpmc.h
@@ -163,7 +163,8 @@ extern unsigned int gpmc_ticks_to_ns(unsigned int ticks);
163 163
164extern void gpmc_cs_write_reg(int cs, int idx, u32 val); 164extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
165extern int gpmc_calc_divider(unsigned int sync_clk); 165extern int gpmc_calc_divider(unsigned int sync_clk);
166extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t); 166extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t,
167 const struct gpmc_settings *s);
167extern int gpmc_cs_program_settings(int cs, struct gpmc_settings *p); 168extern 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 int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
169extern void gpmc_cs_free(int cs); 170extern void gpmc_cs_free(int cs);
diff --git a/include/linux/oom.h b/include/linux/oom.h
index d5771bed59c9..44b2f6f7bbd8 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -66,7 +66,8 @@ extern bool oom_zonelist_trylock(struct zonelist *zonelist, gfp_t gfp_flags);
66extern void oom_zonelist_unlock(struct zonelist *zonelist, gfp_t gfp_flags); 66extern void oom_zonelist_unlock(struct zonelist *zonelist, gfp_t gfp_flags);
67 67
68extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask, 68extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask,
69 int order, const nodemask_t *nodemask); 69 int order, const nodemask_t *nodemask,
70 struct mem_cgroup *memcg);
70 71
71extern enum oom_scan_t oom_scan_process_thread(struct task_struct *task, 72extern enum oom_scan_t oom_scan_process_thread(struct task_struct *task,
72 unsigned long totalpages, const nodemask_t *nodemask, 73 unsigned long totalpages, const nodemask_t *nodemask,
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 5ed7bdaf22d5..f34e040b34e9 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -289,6 +289,47 @@ PAGEFLAG_FALSE(HWPoison)
289#define __PG_HWPOISON 0 289#define __PG_HWPOISON 0
290#endif 290#endif
291 291
292/*
293 * On an anonymous page mapped into a user virtual memory area,
294 * page->mapping points to its anon_vma, not to a struct address_space;
295 * with the PAGE_MAPPING_ANON bit set to distinguish it. See rmap.h.
296 *
297 * On an anonymous page in a VM_MERGEABLE area, if CONFIG_KSM is enabled,
298 * the PAGE_MAPPING_KSM bit may be set along with the PAGE_MAPPING_ANON bit;
299 * and then page->mapping points, not to an anon_vma, but to a private
300 * structure which KSM associates with that merged page. See ksm.h.
301 *
302 * PAGE_MAPPING_KSM without PAGE_MAPPING_ANON is currently never used.
303 *
304 * Please note that, confusingly, "page_mapping" refers to the inode
305 * address_space which maps the page from disk; whereas "page_mapped"
306 * refers to user virtual address space into which the page is mapped.
307 */
308#define PAGE_MAPPING_ANON 1
309#define PAGE_MAPPING_KSM 2
310#define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM)
311
312static inline int PageAnon(struct page *page)
313{
314 return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
315}
316
317#ifdef CONFIG_KSM
318/*
319 * A KSM page is one of those write-protected "shared pages" or "merged pages"
320 * which KSM maps into multiple mms, wherever identical anonymous page content
321 * is found in VM_MERGEABLE vmas. It's a PageAnon page, pointing not to any
322 * anon_vma, but to that page's node of the stable tree.
323 */
324static inline int PageKsm(struct page *page)
325{
326 return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) ==
327 (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
328}
329#else
330TESTPAGEFLAG_FALSE(Ksm)
331#endif
332
292u64 stable_page_flags(struct page *page); 333u64 stable_page_flags(struct page *page);
293 334
294static inline int PageUptodate(struct page *page) 335static inline int PageUptodate(struct page *page)
@@ -328,8 +369,6 @@ static inline void SetPageUptodate(struct page *page)
328 369
329CLEARPAGEFLAG(Uptodate, uptodate) 370CLEARPAGEFLAG(Uptodate, uptodate)
330 371
331extern void cancel_dirty_page(struct page *page, unsigned int account_size);
332
333int test_clear_page_writeback(struct page *page); 372int test_clear_page_writeback(struct page *page);
334int __test_set_page_writeback(struct page *page, bool keep_write); 373int __test_set_page_writeback(struct page *page, bool keep_write);
335 374
@@ -428,6 +467,21 @@ static inline void ClearPageCompound(struct page *page)
428 467
429#endif /* !PAGEFLAGS_EXTENDED */ 468#endif /* !PAGEFLAGS_EXTENDED */
430 469
470#ifdef CONFIG_HUGETLB_PAGE
471int PageHuge(struct page *page);
472int PageHeadHuge(struct page *page);
473bool page_huge_active(struct page *page);
474#else
475TESTPAGEFLAG_FALSE(Huge)
476TESTPAGEFLAG_FALSE(HeadHuge)
477
478static inline bool page_huge_active(struct page *page)
479{
480 return 0;
481}
482#endif
483
484
431#ifdef CONFIG_TRANSPARENT_HUGEPAGE 485#ifdef CONFIG_TRANSPARENT_HUGEPAGE
432/* 486/*
433 * PageHuge() only returns true for hugetlbfs pages, but not for 487 * PageHuge() only returns true for hugetlbfs pages, but not for
@@ -482,6 +536,53 @@ static inline int PageTransTail(struct page *page)
482#endif 536#endif
483 537
484/* 538/*
539 * PageBuddy() indicate that the page is free and in the buddy system
540 * (see mm/page_alloc.c).
541 *
542 * PAGE_BUDDY_MAPCOUNT_VALUE must be <= -2 but better not too close to
543 * -2 so that an underflow of the page_mapcount() won't be mistaken
544 * for a genuine PAGE_BUDDY_MAPCOUNT_VALUE. -128 can be created very
545 * efficiently by most CPU architectures.
546 */
547#define PAGE_BUDDY_MAPCOUNT_VALUE (-128)
548
549static inline int PageBuddy(struct page *page)
550{
551 return atomic_read(&page->_mapcount) == PAGE_BUDDY_MAPCOUNT_VALUE;
552}
553
554static inline void __SetPageBuddy(struct page *page)
555{
556 VM_BUG_ON_PAGE(atomic_read(&page->_mapcount) != -1, page);
557 atomic_set(&page->_mapcount, PAGE_BUDDY_MAPCOUNT_VALUE);
558}
559
560static inline void __ClearPageBuddy(struct page *page)
561{
562 VM_BUG_ON_PAGE(!PageBuddy(page), page);
563 atomic_set(&page->_mapcount, -1);
564}
565
566#define PAGE_BALLOON_MAPCOUNT_VALUE (-256)
567
568static inline int PageBalloon(struct page *page)
569{
570 return atomic_read(&page->_mapcount) == PAGE_BALLOON_MAPCOUNT_VALUE;
571}
572
573static inline void __SetPageBalloon(struct page *page)
574{
575 VM_BUG_ON_PAGE(atomic_read(&page->_mapcount) != -1, page);
576 atomic_set(&page->_mapcount, PAGE_BALLOON_MAPCOUNT_VALUE);
577}
578
579static inline void __ClearPageBalloon(struct page *page)
580{
581 VM_BUG_ON_PAGE(!PageBalloon(page), page);
582 atomic_set(&page->_mapcount, -1);
583}
584
585/*
485 * If network-based swap is enabled, sl*b must keep track of whether pages 586 * If network-based swap is enabled, sl*b must keep track of whether pages
486 * were allocated from pfmemalloc reserves. 587 * were allocated from pfmemalloc reserves.
487 */ 588 */
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 24c7728ca681..a965efa52152 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -77,6 +77,11 @@ static inline void acpiphp_remove_slots(struct pci_bus *bus) { }
77static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { } 77static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
78#endif 78#endif
79 79
80extern const u8 pci_acpi_dsm_uuid[];
81#define DEVICE_LABEL_DSM 0x07
82#define RESET_DELAY_DSM 0x08
83#define FUNCTION_DELAY_DSM 0x09
84
80#else /* CONFIG_ACPI */ 85#else /* CONFIG_ACPI */
81static inline void acpi_pci_add_bus(struct pci_bus *bus) { } 86static inline void acpi_pci_add_bus(struct pci_bus *bus) { }
82static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } 87static inline void acpi_pci_remove_bus(struct pci_bus *bus) { }
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index 8af4610c2e41..207c561fb40e 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -29,7 +29,6 @@ void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29void pcie_aspm_powersave_config_link(struct pci_dev *pdev); 29void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
30void pci_disable_link_state(struct pci_dev *pdev, int state); 30void pci_disable_link_state(struct pci_dev *pdev, int state);
31void pci_disable_link_state_locked(struct pci_dev *pdev, int state); 31void pci_disable_link_state_locked(struct pci_dev *pdev, int state);
32void pcie_clear_aspm(struct pci_bus *bus);
33void pcie_no_aspm(void); 32void pcie_no_aspm(void);
34#else 33#else
35static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) 34static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
@@ -47,9 +46,6 @@ static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
47static inline void pci_disable_link_state(struct pci_dev *pdev, int state) 46static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
48{ 47{
49} 48}
50static inline void pcie_clear_aspm(struct pci_bus *bus)
51{
52}
53static inline void pcie_no_aspm(void) 49static inline void pcie_no_aspm(void)
54{ 50{
55} 51}
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 211e9da8a7d7..353db8dc4c6e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -406,6 +406,7 @@ struct pci_host_bridge {
406 struct list_head windows; /* resource_entry */ 406 struct list_head windows; /* resource_entry */
407 void (*release_fn)(struct pci_host_bridge *); 407 void (*release_fn)(struct pci_host_bridge *);
408 void *release_data; 408 void *release_data;
409 unsigned int ignore_reset_delay:1; /* for entire hierarchy */
409}; 410};
410 411
411#define to_pci_host_bridge(n) container_of(n, struct pci_host_bridge, dev) 412#define to_pci_host_bridge(n) container_of(n, struct pci_host_bridge, dev)
@@ -510,6 +511,9 @@ static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev)
510 return dev->bus->self; 511 return dev->bus->self;
511} 512}
512 513
514struct device *pci_get_host_bridge_device(struct pci_dev *dev);
515void pci_put_host_bridge_device(struct device *dev);
516
513#ifdef CONFIG_PCI_MSI 517#ifdef CONFIG_PCI_MSI
514static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) 518static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
515{ 519{
@@ -1174,6 +1178,7 @@ unsigned char pci_bus_max_busnr(struct pci_bus *bus);
1174void pci_setup_bridge(struct pci_bus *bus); 1178void pci_setup_bridge(struct pci_bus *bus);
1175resource_size_t pcibios_window_alignment(struct pci_bus *bus, 1179resource_size_t pcibios_window_alignment(struct pci_bus *bus,
1176 unsigned long type); 1180 unsigned long type);
1181resource_size_t pcibios_iov_resource_alignment(struct pci_dev *dev, int resno);
1177 1182
1178#define PCI_VGA_STATE_CHANGE_BRIDGE (1 << 0) 1183#define PCI_VGA_STATE_CHANGE_BRIDGE (1 << 0)
1179#define PCI_VGA_STATE_CHANGE_DECODES (1 << 1) 1184#define PCI_VGA_STATE_CHANGE_DECODES (1 << 1)
@@ -1669,13 +1674,25 @@ int pci_ext_cfg_avail(void);
1669void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); 1674void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1670 1675
1671#ifdef CONFIG_PCI_IOV 1676#ifdef CONFIG_PCI_IOV
1677int pci_iov_virtfn_bus(struct pci_dev *dev, int id);
1678int pci_iov_virtfn_devfn(struct pci_dev *dev, int id);
1679
1672int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); 1680int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1673void pci_disable_sriov(struct pci_dev *dev); 1681void pci_disable_sriov(struct pci_dev *dev);
1674int pci_num_vf(struct pci_dev *dev); 1682int pci_num_vf(struct pci_dev *dev);
1675int pci_vfs_assigned(struct pci_dev *dev); 1683int pci_vfs_assigned(struct pci_dev *dev);
1676int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); 1684int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
1677int pci_sriov_get_totalvfs(struct pci_dev *dev); 1685int pci_sriov_get_totalvfs(struct pci_dev *dev);
1686resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno);
1678#else 1687#else
1688static inline int pci_iov_virtfn_bus(struct pci_dev *dev, int id)
1689{
1690 return -ENOSYS;
1691}
1692static inline int pci_iov_virtfn_devfn(struct pci_dev *dev, int id)
1693{
1694 return -ENOSYS;
1695}
1679static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) 1696static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1680{ return -ENODEV; } 1697{ return -ENODEV; }
1681static inline void pci_disable_sriov(struct pci_dev *dev) { } 1698static inline void pci_disable_sriov(struct pci_dev *dev) { }
@@ -1686,6 +1703,8 @@ static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
1686{ return 0; } 1703{ return 0; }
1687static inline int pci_sriov_get_totalvfs(struct pci_dev *dev) 1704static inline int pci_sriov_get_totalvfs(struct pci_dev *dev)
1688{ return 0; } 1705{ return 0; }
1706static inline resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno)
1707{ return 0; }
1689#endif 1708#endif
1690 1709
1691#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) 1710#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index e63c02a93f6b..38cff8f6716d 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2315,6 +2315,8 @@
2315#define PCI_VENDOR_ID_CENATEK 0x16CA 2315#define PCI_VENDOR_ID_CENATEK 0x16CA
2316#define PCI_DEVICE_ID_CENATEK_IDE 0x0001 2316#define PCI_DEVICE_ID_CENATEK_IDE 0x0001
2317 2317
2318#define PCI_VENDOR_ID_SYNOPSYS 0x16c3
2319
2318#define PCI_VENDOR_ID_VITESSE 0x1725 2320#define PCI_VENDOR_ID_VITESSE 0x1725
2319#define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174 2321#define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174
2320 2322
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 2b621982938d..61992cf2e977 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -53,6 +53,7 @@ struct perf_guest_info_callbacks {
53#include <linux/sysfs.h> 53#include <linux/sysfs.h>
54#include <linux/perf_regs.h> 54#include <linux/perf_regs.h>
55#include <linux/workqueue.h> 55#include <linux/workqueue.h>
56#include <linux/cgroup.h>
56#include <asm/local.h> 57#include <asm/local.h>
57 58
58struct perf_callchain_entry { 59struct perf_callchain_entry {
@@ -118,10 +119,19 @@ struct hw_perf_event {
118 struct hrtimer hrtimer; 119 struct hrtimer hrtimer;
119 }; 120 };
120 struct { /* tracepoint */ 121 struct { /* tracepoint */
121 struct task_struct *tp_target;
122 /* for tp_event->class */ 122 /* for tp_event->class */
123 struct list_head tp_list; 123 struct list_head tp_list;
124 }; 124 };
125 struct { /* intel_cqm */
126 int cqm_state;
127 int cqm_rmid;
128 struct list_head cqm_events_entry;
129 struct list_head cqm_groups_entry;
130 struct list_head cqm_group_entry;
131 };
132 struct { /* itrace */
133 int itrace_started;
134 };
125#ifdef CONFIG_HAVE_HW_BREAKPOINT 135#ifdef CONFIG_HAVE_HW_BREAKPOINT
126 struct { /* breakpoint */ 136 struct { /* breakpoint */
127 /* 137 /*
@@ -129,12 +139,12 @@ struct hw_perf_event {
129 * problem hw_breakpoint has with context 139 * problem hw_breakpoint has with context
130 * creation and event initalization. 140 * creation and event initalization.
131 */ 141 */
132 struct task_struct *bp_target;
133 struct arch_hw_breakpoint info; 142 struct arch_hw_breakpoint info;
134 struct list_head bp_list; 143 struct list_head bp_list;
135 }; 144 };
136#endif 145#endif
137 }; 146 };
147 struct task_struct *target;
138 int state; 148 int state;
139 local64_t prev_count; 149 local64_t prev_count;
140 u64 sample_period; 150 u64 sample_period;
@@ -166,6 +176,11 @@ struct perf_event;
166 * pmu::capabilities flags 176 * pmu::capabilities flags
167 */ 177 */
168#define PERF_PMU_CAP_NO_INTERRUPT 0x01 178#define PERF_PMU_CAP_NO_INTERRUPT 0x01
179#define PERF_PMU_CAP_NO_NMI 0x02
180#define PERF_PMU_CAP_AUX_NO_SG 0x04
181#define PERF_PMU_CAP_AUX_SW_DOUBLEBUF 0x08
182#define PERF_PMU_CAP_EXCLUSIVE 0x10
183#define PERF_PMU_CAP_ITRACE 0x20
169 184
170/** 185/**
171 * struct pmu - generic performance monitoring unit 186 * struct pmu - generic performance monitoring unit
@@ -186,6 +201,7 @@ struct pmu {
186 201
187 int * __percpu pmu_disable_count; 202 int * __percpu pmu_disable_count;
188 struct perf_cpu_context * __percpu pmu_cpu_context; 203 struct perf_cpu_context * __percpu pmu_cpu_context;
204 atomic_t exclusive_cnt; /* < 0: cpu; > 0: tsk */
189 int task_ctx_nr; 205 int task_ctx_nr;
190 int hrtimer_interval_ms; 206 int hrtimer_interval_ms;
191 207
@@ -262,9 +278,32 @@ struct pmu {
262 int (*event_idx) (struct perf_event *event); /*optional */ 278 int (*event_idx) (struct perf_event *event); /*optional */
263 279
264 /* 280 /*
265 * flush branch stack on context-switches (needed in cpu-wide mode) 281 * context-switches callback
282 */
283 void (*sched_task) (struct perf_event_context *ctx,
284 bool sched_in);
285 /*
286 * PMU specific data size
287 */
288 size_t task_ctx_size;
289
290
291 /*
292 * Return the count value for a counter.
293 */
294 u64 (*count) (struct perf_event *event); /*optional*/
295
296 /*
297 * Set up pmu-private data structures for an AUX area
266 */ 298 */
267 void (*flush_branch_stack) (void); 299 void *(*setup_aux) (int cpu, void **pages,
300 int nr_pages, bool overwrite);
301 /* optional */
302
303 /*
304 * Free pmu-private AUX data structures
305 */
306 void (*free_aux) (void *aux); /* optional */
268}; 307};
269 308
270/** 309/**
@@ -300,6 +339,7 @@ struct swevent_hlist {
300#define PERF_ATTACH_CONTEXT 0x01 339#define PERF_ATTACH_CONTEXT 0x01
301#define PERF_ATTACH_GROUP 0x02 340#define PERF_ATTACH_GROUP 0x02
302#define PERF_ATTACH_TASK 0x04 341#define PERF_ATTACH_TASK 0x04
342#define PERF_ATTACH_TASK_DATA 0x08
303 343
304struct perf_cgroup; 344struct perf_cgroup;
305struct ring_buffer; 345struct ring_buffer;
@@ -438,6 +478,7 @@ struct perf_event {
438 struct pid_namespace *ns; 478 struct pid_namespace *ns;
439 u64 id; 479 u64 id;
440 480
481 u64 (*clock)(void);
441 perf_overflow_handler_t overflow_handler; 482 perf_overflow_handler_t overflow_handler;
442 void *overflow_handler_context; 483 void *overflow_handler_context;
443 484
@@ -504,7 +545,7 @@ struct perf_event_context {
504 u64 generation; 545 u64 generation;
505 int pin_count; 546 int pin_count;
506 int nr_cgroups; /* cgroup evts */ 547 int nr_cgroups; /* cgroup evts */
507 int nr_branch_stack; /* branch_stack evt */ 548 void *task_ctx_data; /* pmu specific data */
508 struct rcu_head rcu_head; 549 struct rcu_head rcu_head;
509 550
510 struct delayed_work orphans_remove; 551 struct delayed_work orphans_remove;
@@ -536,12 +577,52 @@ struct perf_output_handle {
536 struct ring_buffer *rb; 577 struct ring_buffer *rb;
537 unsigned long wakeup; 578 unsigned long wakeup;
538 unsigned long size; 579 unsigned long size;
539 void *addr; 580 union {
581 void *addr;
582 unsigned long head;
583 };
540 int page; 584 int page;
541}; 585};
542 586
587#ifdef CONFIG_CGROUP_PERF
588
589/*
590 * perf_cgroup_info keeps track of time_enabled for a cgroup.
591 * This is a per-cpu dynamically allocated data structure.
592 */
593struct perf_cgroup_info {
594 u64 time;
595 u64 timestamp;
596};
597
598struct perf_cgroup {
599 struct cgroup_subsys_state css;
600 struct perf_cgroup_info __percpu *info;
601};
602
603/*
604 * Must ensure cgroup is pinned (css_get) before calling
605 * this function. In other words, we cannot call this function
606 * if there is no cgroup event for the current CPU context.
607 */
608static inline struct perf_cgroup *
609perf_cgroup_from_task(struct task_struct *task)
610{
611 return container_of(task_css(task, perf_event_cgrp_id),
612 struct perf_cgroup, css);
613}
614#endif /* CONFIG_CGROUP_PERF */
615
543#ifdef CONFIG_PERF_EVENTS 616#ifdef CONFIG_PERF_EVENTS
544 617
618extern void *perf_aux_output_begin(struct perf_output_handle *handle,
619 struct perf_event *event);
620extern void perf_aux_output_end(struct perf_output_handle *handle,
621 unsigned long size, bool truncated);
622extern int perf_aux_output_skip(struct perf_output_handle *handle,
623 unsigned long size);
624extern void *perf_get_aux(struct perf_output_handle *handle);
625
545extern int perf_pmu_register(struct pmu *pmu, const char *name, int type); 626extern int perf_pmu_register(struct pmu *pmu, const char *name, int type);
546extern void perf_pmu_unregister(struct pmu *pmu); 627extern void perf_pmu_unregister(struct pmu *pmu);
547 628
@@ -558,6 +639,8 @@ extern void perf_event_delayed_put(struct task_struct *task);
558extern void perf_event_print_debug(void); 639extern void perf_event_print_debug(void);
559extern void perf_pmu_disable(struct pmu *pmu); 640extern void perf_pmu_disable(struct pmu *pmu);
560extern void perf_pmu_enable(struct pmu *pmu); 641extern void perf_pmu_enable(struct pmu *pmu);
642extern void perf_sched_cb_dec(struct pmu *pmu);
643extern void perf_sched_cb_inc(struct pmu *pmu);
561extern int perf_event_task_disable(void); 644extern int perf_event_task_disable(void);
562extern int perf_event_task_enable(void); 645extern int perf_event_task_enable(void);
563extern int perf_event_refresh(struct perf_event *event, int refresh); 646extern int perf_event_refresh(struct perf_event *event, int refresh);
@@ -731,6 +814,11 @@ static inline void perf_event_task_sched_out(struct task_struct *prev,
731 __perf_event_task_sched_out(prev, next); 814 __perf_event_task_sched_out(prev, next);
732} 815}
733 816
817static inline u64 __perf_event_count(struct perf_event *event)
818{
819 return local64_read(&event->count) + atomic64_read(&event->child_count);
820}
821
734extern void perf_event_mmap(struct vm_area_struct *vma); 822extern void perf_event_mmap(struct vm_area_struct *vma);
735extern struct perf_guest_info_callbacks *perf_guest_cbs; 823extern struct perf_guest_info_callbacks *perf_guest_cbs;
736extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); 824extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
@@ -800,6 +888,16 @@ static inline bool has_branch_stack(struct perf_event *event)
800 return event->attr.sample_type & PERF_SAMPLE_BRANCH_STACK; 888 return event->attr.sample_type & PERF_SAMPLE_BRANCH_STACK;
801} 889}
802 890
891static inline bool needs_branch_stack(struct perf_event *event)
892{
893 return event->attr.branch_sample_type != 0;
894}
895
896static inline bool has_aux(struct perf_event *event)
897{
898 return event->pmu->setup_aux;
899}
900
803extern int perf_output_begin(struct perf_output_handle *handle, 901extern int perf_output_begin(struct perf_output_handle *handle,
804 struct perf_event *event, unsigned int size); 902 struct perf_event *event, unsigned int size);
805extern void perf_output_end(struct perf_output_handle *handle); 903extern void perf_output_end(struct perf_output_handle *handle);
@@ -815,6 +913,17 @@ extern void perf_event_disable(struct perf_event *event);
815extern int __perf_event_disable(void *info); 913extern int __perf_event_disable(void *info);
816extern void perf_event_task_tick(void); 914extern void perf_event_task_tick(void);
817#else /* !CONFIG_PERF_EVENTS: */ 915#else /* !CONFIG_PERF_EVENTS: */
916static inline void *
917perf_aux_output_begin(struct perf_output_handle *handle,
918 struct perf_event *event) { return NULL; }
919static inline void
920perf_aux_output_end(struct perf_output_handle *handle, unsigned long size,
921 bool truncated) { }
922static inline int
923perf_aux_output_skip(struct perf_output_handle *handle,
924 unsigned long size) { return -EINVAL; }
925static inline void *
926perf_get_aux(struct perf_output_handle *handle) { return NULL; }
818static inline void 927static inline void
819perf_event_task_sched_in(struct task_struct *prev, 928perf_event_task_sched_in(struct task_struct *prev,
820 struct task_struct *task) { } 929 struct task_struct *task) { }
diff --git a/include/linux/personality.h b/include/linux/personality.h
index 646c0a7d50fa..aeb7892b2468 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -3,52 +3,14 @@
3 3
4#include <uapi/linux/personality.h> 4#include <uapi/linux/personality.h>
5 5
6
7/*
8 * Handling of different ABIs (personalities).
9 */
10
11struct exec_domain;
12struct pt_regs;
13
14extern int register_exec_domain(struct exec_domain *);
15extern int unregister_exec_domain(struct exec_domain *);
16extern int __set_personality(unsigned int);
17
18
19/*
20 * Description of an execution domain.
21 *
22 * The first two members are refernced from assembly source
23 * and should stay where they are unless explicitly needed.
24 */
25typedef void (*handler_t)(int, struct pt_regs *);
26
27struct exec_domain {
28 const char *name; /* name of the execdomain */
29 handler_t handler; /* handler for syscalls */
30 unsigned char pers_low; /* lowest personality */
31 unsigned char pers_high; /* highest personality */
32 unsigned long *signal_map; /* signal mapping */
33 unsigned long *signal_invmap; /* reverse signal mapping */
34 struct map_segment *err_map; /* error mapping */
35 struct map_segment *socktype_map; /* socket type mapping */
36 struct map_segment *sockopt_map; /* socket option mapping */
37 struct map_segment *af_map; /* address family mapping */
38 struct module *module; /* module context of the ed. */
39 struct exec_domain *next; /* linked list (internal) */
40};
41
42/* 6/*
43 * Return the base personality without flags. 7 * Return the base personality without flags.
44 */ 8 */
45#define personality(pers) (pers & PER_MASK) 9#define personality(pers) (pers & PER_MASK)
46 10
47
48/* 11/*
49 * Change personality of the currently running process. 12 * Change personality of the currently running process.
50 */ 13 */
51#define set_personality(pers) \ 14#define set_personality(pers) (current->personality = (pers))
52 ((current->personality == (pers)) ? 0 : __set_personality(pers))
53 15
54#endif /* _LINUX_PERSONALITY_H */ 16#endif /* _LINUX_PERSONALITY_H */
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index 7e75bfe37cc7..fe5732d53eda 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -21,6 +21,9 @@ extern void fixed_phy_del(int phy_addr);
21extern int fixed_phy_set_link_update(struct phy_device *phydev, 21extern int fixed_phy_set_link_update(struct phy_device *phydev,
22 int (*link_update)(struct net_device *, 22 int (*link_update)(struct net_device *,
23 struct fixed_phy_status *)); 23 struct fixed_phy_status *));
24extern int fixed_phy_update_state(struct phy_device *phydev,
25 const struct fixed_phy_status *status,
26 const struct fixed_phy_status *changed);
24#else 27#else
25static inline int fixed_phy_add(unsigned int irq, int phy_id, 28static inline int fixed_phy_add(unsigned int irq, int phy_id,
26 struct fixed_phy_status *status) 29 struct fixed_phy_status *status)
@@ -43,6 +46,12 @@ static inline int fixed_phy_set_link_update(struct phy_device *phydev,
43{ 46{
44 return -ENODEV; 47 return -ENODEV;
45} 48}
49static inline int fixed_phy_update_state(struct phy_device *phydev,
50 const struct fixed_phy_status *status,
51 const struct fixed_phy_status *changed)
52{
53 return -ENODEV;
54}
46#endif /* CONFIG_FIXED_PHY */ 55#endif /* CONFIG_FIXED_PHY */
47 56
48#endif /* __PHY_FIXED_H */ 57#endif /* __PHY_FIXED_H */
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 72c0415d6c21..18eccefea06e 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -82,7 +82,7 @@ static inline int pinctrl_gpio_direction_output(unsigned gpio)
82 82
83static inline struct pinctrl * __must_check pinctrl_get(struct device *dev) 83static inline struct pinctrl * __must_check pinctrl_get(struct device *dev)
84{ 84{
85 return ERR_PTR(-ENOSYS); 85 return NULL;
86} 86}
87 87
88static inline void pinctrl_put(struct pinctrl *p) 88static inline void pinctrl_put(struct pinctrl *p)
@@ -93,7 +93,7 @@ static inline struct pinctrl_state * __must_check pinctrl_lookup_state(
93 struct pinctrl *p, 93 struct pinctrl *p,
94 const char *name) 94 const char *name)
95{ 95{
96 return ERR_PTR(-ENOSYS); 96 return NULL;
97} 97}
98 98
99static inline int pinctrl_select_state(struct pinctrl *p, 99static inline int pinctrl_select_state(struct pinctrl *p,
@@ -104,7 +104,7 @@ static inline int pinctrl_select_state(struct pinctrl *p,
104 104
105static inline struct pinctrl * __must_check devm_pinctrl_get(struct device *dev) 105static inline struct pinctrl * __must_check devm_pinctrl_get(struct device *dev)
106{ 106{
107 return ERR_PTR(-ENOSYS); 107 return NULL;
108} 108}
109 109
110static inline void devm_pinctrl_put(struct pinctrl *p) 110static inline void devm_pinctrl_put(struct pinctrl *p)
diff --git a/include/linux/platform_data/dma-hsu.h b/include/linux/platform_data/dma-hsu.h
new file mode 100644
index 000000000000..8a1f6a4920b2
--- /dev/null
+++ b/include/linux/platform_data/dma-hsu.h
@@ -0,0 +1,25 @@
1/*
2 * Driver for the High Speed UART DMA
3 *
4 * Copyright (C) 2015 Intel 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#ifndef _PLATFORM_DATA_DMA_HSU_H
12#define _PLATFORM_DATA_DMA_HSU_H
13
14#include <linux/device.h>
15
16struct hsu_dma_slave {
17 struct device *dma_dev;
18 int chan_id;
19};
20
21struct hsu_dma_platform_data {
22 unsigned short nr_channels;
23};
24
25#endif /* _PLATFORM_DATA_DMA_HSU_H */
diff --git a/include/linux/platform_data/dma-imx-sdma.h b/include/linux/platform_data/dma-imx-sdma.h
index eabac4e2fc99..2d08816720f6 100644
--- a/include/linux/platform_data/dma-imx-sdma.h
+++ b/include/linux/platform_data/dma-imx-sdma.h
@@ -48,6 +48,9 @@ struct sdma_script_start_addrs {
48 s32 ssish_2_mcu_addr; 48 s32 ssish_2_mcu_addr;
49 s32 hdmi_dma_addr; 49 s32 hdmi_dma_addr;
50 /* End of v2 array */ 50 /* End of v2 array */
51 s32 zcanfd_2_mcu_addr;
52 s32 zqspi_2_mcu_addr;
53 /* End of v3 array */
51}; 54};
52 55
53/** 56/**
diff --git a/include/linux/platform_data/hsmmc-omap.h b/include/linux/platform_data/hsmmc-omap.h
index 67bbcf0785f6..8e981be2e2c2 100644
--- a/include/linux/platform_data/hsmmc-omap.h
+++ b/include/linux/platform_data/hsmmc-omap.h
@@ -55,9 +55,6 @@ struct omap_hsmmc_platform_data {
55 u32 caps; /* Used for the MMC driver on 2430 and later */ 55 u32 caps; /* Used for the MMC driver on 2430 and later */
56 u32 pm_caps; /* PM capabilities of the mmc */ 56 u32 pm_caps; /* PM capabilities of the mmc */
57 57
58 /* switch pin can be for card detect (default) or card cover */
59 unsigned cover:1;
60
61 /* use the internal clock */ 58 /* use the internal clock */
62 unsigned internal_clock:1; 59 unsigned internal_clock:1;
63 60
@@ -73,7 +70,8 @@ struct omap_hsmmc_platform_data {
73#define HSMMC_HAS_HSPE_SUPPORT (1 << 2) 70#define HSMMC_HAS_HSPE_SUPPORT (1 << 2)
74 unsigned features; 71 unsigned features;
75 72
76 int switch_pin; /* gpio (card detect) */ 73 int gpio_cd; /* gpio (card detect) */
74 int gpio_cod; /* gpio (cover detect) */
77 int gpio_wp; /* gpio (write protect) */ 75 int gpio_wp; /* gpio (write protect) */
78 76
79 int (*set_power)(struct device *dev, int power_on, int vdd); 77 int (*set_power)(struct device *dev, int power_on, int vdd);
diff --git a/include/linux/platform_data/i2c-davinci.h b/include/linux/platform_data/i2c-davinci.h
index 2312d197dfb7..89fd34727a24 100644
--- a/include/linux/platform_data/i2c-davinci.h
+++ b/include/linux/platform_data/i2c-davinci.h
@@ -18,6 +18,7 @@ struct davinci_i2c_platform_data {
18 unsigned int bus_delay; /* post-transaction delay (usec) */ 18 unsigned int bus_delay; /* post-transaction delay (usec) */
19 unsigned int sda_pin; /* GPIO pin ID to use for SDA */ 19 unsigned int sda_pin; /* GPIO pin ID to use for SDA */
20 unsigned int scl_pin; /* GPIO pin ID to use for SCL */ 20 unsigned int scl_pin; /* GPIO pin ID to use for SCL */
21 bool has_pfunc; /*chip has a ICPFUNC register */
21}; 22};
22 23
23/* for board setup code */ 24/* for board setup code */
diff --git a/include/linux/platform_data/mmc-msm_sdcc.h b/include/linux/platform_data/mmc-msm_sdcc.h
deleted file mode 100644
index 55aa873c9396..000000000000
--- a/include/linux/platform_data/mmc-msm_sdcc.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef __MMC_MSM_SDCC_H
2#define __MMC_MSM_SDCC_H
3
4#include <linux/mmc/host.h>
5#include <linux/mmc/card.h>
6#include <linux/mmc/sdio_func.h>
7
8struct msm_mmc_gpio {
9 unsigned no;
10 const char *name;
11};
12
13struct msm_mmc_gpio_data {
14 struct msm_mmc_gpio *gpio;
15 u8 size;
16};
17
18struct msm_mmc_platform_data {
19 unsigned int ocr_mask; /* available voltages */
20 u32 (*translate_vdd)(struct device *, unsigned int);
21 unsigned int (*status)(struct device *);
22 int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
23 struct msm_mmc_gpio_data *gpio_data;
24 void (*init_card)(struct mmc_card *card);
25};
26
27#endif
diff --git a/include/linux/platform_data/msm_serial_hs.h b/include/linux/platform_data/msm_serial_hs.h
deleted file mode 100644
index 98a2046f8b31..000000000000
--- a/include/linux/platform_data/msm_serial_hs.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * Copyright (C) 2008 Google, Inc.
3 * Author: Nick Pelly <npelly@google.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __ASM_ARCH_MSM_SERIAL_HS_H
16#define __ASM_ARCH_MSM_SERIAL_HS_H
17
18#include <linux/serial_core.h>
19
20/* API to request the uart clock off or on for low power management
21 * Clients should call request_clock_off() when no uart data is expected,
22 * and must call request_clock_on() before any further uart data can be
23 * received. */
24extern void msm_hs_request_clock_off(struct uart_port *uport);
25extern void msm_hs_request_clock_on(struct uart_port *uport);
26
27/**
28 * struct msm_serial_hs_platform_data
29 * @rx_wakeup_irq: Rx activity irq
30 * @rx_to_inject: extra character to be inserted to Rx tty on wakeup
31 * @inject_rx: 1 = insert rx_to_inject. 0 = do not insert extra character
32 * @exit_lpm_cb: function called before every Tx transaction
33 *
34 * This is an optional structure required for UART Rx GPIO IRQ based
35 * wakeup from low power state. UART wakeup can be triggered by RX activity
36 * (using a wakeup GPIO on the UART RX pin). This should only be used if
37 * there is not a wakeup GPIO on the UART CTS, and the first RX byte is
38 * known (eg., with the Bluetooth Texas Instruments HCILL protocol),
39 * since the first RX byte will always be lost. RTS will be asserted even
40 * while the UART is clocked off in this mode of operation.
41 */
42struct msm_serial_hs_platform_data {
43 int rx_wakeup_irq;
44 unsigned char inject_rx_on_wakeup;
45 char rx_to_inject;
46 void (*exit_lpm_cb)(struct uart_port *);
47};
48
49#endif
diff --git a/include/linux/platform_data/nxp-nci.h b/include/linux/platform_data/nxp-nci.h
new file mode 100644
index 000000000000..d6ed28679bb2
--- /dev/null
+++ b/include/linux/platform_data/nxp-nci.h
@@ -0,0 +1,27 @@
1/*
2 * Generic platform data for the NXP NCI NFC chips.
3 *
4 * Copyright (C) 2014 NXP Semiconductors All rights reserved.
5 *
6 * Authors: Clément Perrochaud <clement.perrochaud@nxp.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions 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,
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#ifndef _NXP_NCI_H_
19#define _NXP_NCI_H_
20
21struct nxp_nci_nfc_platform_data {
22 unsigned int gpio_en;
23 unsigned int gpio_fw;
24 unsigned int irq;
25};
26
27#endif /* _NXP_NCI_H_ */
diff --git a/include/linux/platform_data/serial-imx.h b/include/linux/platform_data/serial-imx.h
index 3cc2e3c40914..a938eba2f18e 100644
--- a/include/linux/platform_data/serial-imx.h
+++ b/include/linux/platform_data/serial-imx.h
@@ -20,14 +20,9 @@
20#define ASMARM_ARCH_UART_H 20#define ASMARM_ARCH_UART_H
21 21
22#define IMXUART_HAVE_RTSCTS (1<<0) 22#define IMXUART_HAVE_RTSCTS (1<<0)
23#define IMXUART_IRDA (1<<1)
24 23
25struct imxuart_platform_data { 24struct imxuart_platform_data {
26 unsigned int flags; 25 unsigned int flags;
27 void (*irda_enable)(int enable);
28 unsigned int irda_inv_rx:1;
29 unsigned int irda_inv_tx:1;
30 unsigned short transceiver_delay;
31}; 26};
32 27
33#endif 28#endif
diff --git a/include/linux/platform_data/sky81452-backlight.h b/include/linux/platform_data/sky81452-backlight.h
new file mode 100644
index 000000000000..1231e9bb00f1
--- /dev/null
+++ b/include/linux/platform_data/sky81452-backlight.h
@@ -0,0 +1,46 @@
1/*
2 * sky81452.h SKY81452 backlight driver
3 *
4 * Copyright 2014 Skyworks Solutions Inc.
5 * Author : Gyungoh Yoo <jack.yoo@skyworksinc.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
9 * as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _SKY81452_BACKLIGHT_H
21#define _SKY81452_BACKLIGHT_H
22
23/**
24 * struct sky81452_platform_data
25 * @name: backlight driver name.
26 If it is not defined, default name is lcd-backlight.
27 * @gpio_enable:GPIO number which control EN pin
28 * @enable: Enable mask for current sink channel 1, 2, 3, 4, 5 and 6.
29 * @ignore_pwm: true if DPWMI should be ignored.
30 * @dpwm_mode: true is DPWM dimming mode, otherwise Analog dimming mode.
31 * @phase_shift:true is phase shift mode.
32 * @short_detecion_threshold: It should be one of 4, 5, 6 and 7V.
33 * @boost_current_limit: It should be one of 2300, 2750mA.
34 */
35struct sky81452_bl_platform_data {
36 const char *name;
37 int gpio_enable;
38 unsigned int enable;
39 bool ignore_pwm;
40 bool dpwm_mode;
41 bool phase_shift;
42 unsigned int short_detection_threshold;
43 unsigned int boost_current_limit;
44};
45
46#endif
diff --git a/include/linux/platform_data/tpm_stm_st33.h b/include/linux/platform_data/st33zp24.h
index ff75310c0f47..817dfdb37885 100644
--- a/include/linux/platform_data/tpm_stm_st33.h
+++ b/include/linux/platform_data/st33zp24.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * STMicroelectronics TPM I2C Linux driver for TPM ST33ZP24 2 * STMicroelectronics TPM Linux driver for TPM 1.2 ST33ZP24
3 * Copyright (C) 2009, 2010 STMicroelectronics 3 * Copyright (C) 2009 - 2015 STMicroelectronics
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -14,20 +14,9 @@
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>. 16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 *
18 * STMicroelectronics version 1.2.0, Copyright (C) 2010
19 * STMicroelectronics comes with ABSOLUTELY NO WARRANTY.
20 * This is free software, and you are welcome to redistribute it
21 * under certain conditions.
22 *
23 * @Author: Christophe RICARD tpmsupport@st.com
24 *
25 * @File: stm_st33_tpm.h
26 *
27 * @Date: 09/15/2010
28 */ 17 */
29#ifndef __STM_ST33_TPM_H__ 18#ifndef __ST33ZP24_H__
30#define __STM_ST33_TPM_H__ 19#define __ST33ZP24_H__
31 20
32#define TPM_ST33_I2C "st33zp24-i2c" 21#define TPM_ST33_I2C "st33zp24-i2c"
33#define TPM_ST33_SPI "st33zp24-spi" 22#define TPM_ST33_SPI "st33zp24-spi"
@@ -36,4 +25,4 @@ struct st33zp24_platform_data {
36 int io_lpcpd; 25 int io_lpcpd;
37}; 26};
38 27
39#endif /* __STM_ST33_TPM_H__ */ 28#endif /* __ST33ZP24_H__ */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index ae4882ca4a64..58f1e75ba105 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -59,7 +59,7 @@ extern int platform_add_devices(struct platform_device **, int);
59 59
60struct platform_device_info { 60struct platform_device_info {
61 struct device *parent; 61 struct device *parent;
62 struct acpi_dev_node acpi_node; 62 struct fwnode_handle *fwnode;
63 63
64 const char *name; 64 const char *name;
65 int id; 65 int id;
diff --git a/include/linux/resume-trace.h b/include/linux/pm-trace.h
index f31db2368782..ecbde7a5548e 100644
--- a/include/linux/resume-trace.h
+++ b/include/linux/pm-trace.h
@@ -1,8 +1,8 @@
1#ifndef RESUME_TRACE_H 1#ifndef PM_TRACE_H
2#define RESUME_TRACE_H 2#define PM_TRACE_H
3 3
4#ifdef CONFIG_PM_TRACE 4#ifdef CONFIG_PM_TRACE
5#include <asm/resume-trace.h> 5#include <asm/pm-trace.h>
6#include <linux/types.h> 6#include <linux/types.h>
7 7
8extern int pm_trace_enabled; 8extern int pm_trace_enabled;
@@ -14,7 +14,7 @@ static inline int pm_trace_is_enabled(void)
14 14
15struct device; 15struct device;
16extern void set_trace_device(struct device *); 16extern void set_trace_device(struct device *);
17extern void generate_resume_trace(const void *tracedata, unsigned int user); 17extern void generate_pm_trace(const void *tracedata, unsigned int user);
18extern int show_trace_dev_match(char *buf, size_t size); 18extern int show_trace_dev_match(char *buf, size_t size);
19 19
20#define TRACE_DEVICE(dev) do { \ 20#define TRACE_DEVICE(dev) do { \
@@ -28,6 +28,7 @@ static inline int pm_trace_is_enabled(void) { return 0; }
28 28
29#define TRACE_DEVICE(dev) do { } while (0) 29#define TRACE_DEVICE(dev) do { } while (0)
30#define TRACE_RESUME(dev) do { } while (0) 30#define TRACE_RESUME(dev) do { } while (0)
31#define TRACE_SUSPEND(dev) do { } while (0)
31 32
32#endif 33#endif
33 34
diff --git a/include/linux/pm.h b/include/linux/pm.h
index e2f1be6dd9dd..2d29c64f8fb1 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -603,10 +603,18 @@ extern void dev_pm_put_subsys_data(struct device *dev);
603 * Power domains provide callbacks that are executed during system suspend, 603 * Power domains provide callbacks that are executed during system suspend,
604 * hibernation, system resume and during runtime PM transitions along with 604 * hibernation, system resume and during runtime PM transitions along with
605 * subsystem-level and driver-level callbacks. 605 * subsystem-level and driver-level callbacks.
606 *
607 * @detach: Called when removing a device from the domain.
608 * @activate: Called before executing probe routines for bus types and drivers.
609 * @sync: Called after successful driver probe.
610 * @dismiss: Called after unsuccessful driver probe and after driver removal.
606 */ 611 */
607struct dev_pm_domain { 612struct dev_pm_domain {
608 struct dev_pm_ops ops; 613 struct dev_pm_ops ops;
609 void (*detach)(struct device *dev, bool power_off); 614 void (*detach)(struct device *dev, bool power_off);
615 int (*activate)(struct device *dev);
616 void (*sync)(struct device *dev);
617 void (*dismiss)(struct device *dev);
610}; 618};
611 619
612/* 620/*
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 080e778118ba..681ccb053f72 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -127,7 +127,7 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
127 return to_gpd_data(dev->power.subsys_data->domain_data); 127 return to_gpd_data(dev->power.subsys_data->domain_data);
128} 128}
129 129
130extern struct generic_pm_domain *dev_to_genpd(struct device *dev); 130extern struct generic_pm_domain *pm_genpd_lookup_dev(struct device *dev);
131extern int __pm_genpd_add_device(struct generic_pm_domain *genpd, 131extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
132 struct device *dev, 132 struct device *dev,
133 struct gpd_timing_data *td); 133 struct gpd_timing_data *td);
@@ -163,9 +163,9 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
163{ 163{
164 return ERR_PTR(-ENOSYS); 164 return ERR_PTR(-ENOSYS);
165} 165}
166static inline struct generic_pm_domain *dev_to_genpd(struct device *dev) 166static inline struct generic_pm_domain *pm_genpd_lookup_dev(struct device *dev)
167{ 167{
168 return ERR_PTR(-ENOSYS); 168 return NULL;
169} 169}
170static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd, 170static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
171 struct device *dev, 171 struct device *dev,
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 6512e9cbc6d5..5df733b8f704 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -510,4 +510,16 @@ static inline void pnp_unregister_driver(struct pnp_driver *drv) { }
510 510
511#endif /* CONFIG_PNP */ 511#endif /* CONFIG_PNP */
512 512
513/**
514 * module_pnp_driver() - Helper macro for registering a PnP driver
515 * @__pnp_driver: pnp_driver struct
516 *
517 * Helper macro for PnP drivers which do not do anything special in module
518 * init/exit. This eliminates a lot of boilerplate. Each module may only
519 * use this macro once, and calling it replaces module_init() and module_exit()
520 */
521#define module_pnp_driver(__pnp_driver) \
522 module_driver(__pnp_driver, pnp_register_driver, \
523 pnp_unregister_driver)
524
513#endif /* _LINUX_PNP_H */ 525#endif /* _LINUX_PNP_H */
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h
index 416ebeb6ee1e..eadf28cb2fc9 100644
--- a/include/linux/power/charger-manager.h
+++ b/include/linux/power/charger-manager.h
@@ -242,7 +242,8 @@ struct charger_manager {
242 int emergency_stop; 242 int emergency_stop;
243 243
244 char psy_name_buf[PSY_NAME_MAX + 1]; 244 char psy_name_buf[PSY_NAME_MAX + 1];
245 struct power_supply charger_psy; 245 struct power_supply_desc charger_psy_desc;
246 struct power_supply *charger_psy;
246 247
247 u64 charging_start_time; 248 u64 charging_start_time;
248 u64 charging_end_time; 249 u64 charging_end_time;
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h
index 89dd84f47c6e..cf112b4075c8 100644
--- a/include/linux/power/max17042_battery.h
+++ b/include/linux/power/max17042_battery.h
@@ -126,7 +126,14 @@ enum max17047_register {
126 MAX17047_QRTbl30 = 0x42, 126 MAX17047_QRTbl30 = 0x42,
127}; 127};
128 128
129enum max170xx_chip_type {MAX17042, MAX17047}; 129enum max170xx_chip_type {
130 MAXIM_DEVICE_TYPE_UNKNOWN = 0,
131 MAXIM_DEVICE_TYPE_MAX17042,
132 MAXIM_DEVICE_TYPE_MAX17047,
133 MAXIM_DEVICE_TYPE_MAX17050,
134
135 MAXIM_DEVICE_TYPE_NUM
136};
130 137
131/* 138/*
132 * used for setting a register to a desired value 139 * used for setting a register to a desired value
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 096dbced02ac..75a1dd8dc56e 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -13,6 +13,7 @@
13#ifndef __LINUX_POWER_SUPPLY_H__ 13#ifndef __LINUX_POWER_SUPPLY_H__
14#define __LINUX_POWER_SUPPLY_H__ 14#define __LINUX_POWER_SUPPLY_H__
15 15
16#include <linux/device.h>
16#include <linux/workqueue.h> 17#include <linux/workqueue.h>
17#include <linux/leds.h> 18#include <linux/leds.h>
18#include <linux/spinlock.h> 19#include <linux/spinlock.h>
@@ -173,22 +174,32 @@ union power_supply_propval {
173 const char *strval; 174 const char *strval;
174}; 175};
175 176
176struct device;
177struct device_node; 177struct device_node;
178struct power_supply;
178 179
179struct power_supply { 180/* Run-time specific power supply configuration */
180 const char *name; 181struct power_supply_config {
181 enum power_supply_type type; 182 struct device_node *of_node;
182 enum power_supply_property *properties; 183 /* Driver private data */
183 size_t num_properties; 184 void *drv_data;
184 185
185 char **supplied_to; 186 char **supplied_to;
186 size_t num_supplicants; 187 size_t num_supplicants;
188};
187 189
188 char **supplied_from; 190/* Description of power supply */
189 size_t num_supplies; 191struct power_supply_desc {
190 struct device_node *of_node; 192 const char *name;
193 enum power_supply_type type;
194 enum power_supply_property *properties;
195 size_t num_properties;
191 196
197 /*
198 * Functions for drivers implementing power supply class.
199 * These shouldn't be called directly by other drivers for accessing
200 * this power supply. Instead use power_supply_*() functions (for
201 * example power_supply_get_property()).
202 */
192 int (*get_property)(struct power_supply *psy, 203 int (*get_property)(struct power_supply *psy,
193 enum power_supply_property psp, 204 enum power_supply_property psp,
194 union power_supply_propval *val); 205 union power_supply_propval *val);
@@ -208,12 +219,27 @@ struct power_supply {
208 bool no_thermal; 219 bool no_thermal;
209 /* For APM emulation, think legacy userspace. */ 220 /* For APM emulation, think legacy userspace. */
210 int use_for_apm; 221 int use_for_apm;
222};
223
224struct power_supply {
225 const struct power_supply_desc *desc;
226
227 char **supplied_to;
228 size_t num_supplicants;
229
230 char **supplied_from;
231 size_t num_supplies;
232 struct device_node *of_node;
233
234 /* Driver private data */
235 void *drv_data;
211 236
212 /* private */ 237 /* private */
213 struct device *dev; 238 struct device dev;
214 struct work_struct changed_work; 239 struct work_struct changed_work;
215 spinlock_t changed_lock; 240 spinlock_t changed_lock;
216 bool changed; 241 bool changed;
242 atomic_t use_cnt;
217#ifdef CONFIG_THERMAL 243#ifdef CONFIG_THERMAL
218 struct thermal_zone_device *tzd; 244 struct thermal_zone_device *tzd;
219 struct thermal_cooling_device *tcd; 245 struct thermal_cooling_device *tcd;
@@ -256,6 +282,7 @@ extern struct atomic_notifier_head power_supply_notifier;
256extern int power_supply_reg_notifier(struct notifier_block *nb); 282extern int power_supply_reg_notifier(struct notifier_block *nb);
257extern void power_supply_unreg_notifier(struct notifier_block *nb); 283extern void power_supply_unreg_notifier(struct notifier_block *nb);
258extern struct power_supply *power_supply_get_by_name(const char *name); 284extern struct power_supply *power_supply_get_by_name(const char *name);
285extern void power_supply_put(struct power_supply *psy);
259#ifdef CONFIG_OF 286#ifdef CONFIG_OF
260extern struct power_supply *power_supply_get_by_phandle(struct device_node *np, 287extern struct power_supply *power_supply_get_by_phandle(struct device_node *np,
261 const char *property); 288 const char *property);
@@ -274,13 +301,36 @@ extern int power_supply_is_system_supplied(void);
274static inline int power_supply_is_system_supplied(void) { return -ENOSYS; } 301static inline int power_supply_is_system_supplied(void) { return -ENOSYS; }
275#endif 302#endif
276 303
277extern int power_supply_register(struct device *parent, 304extern int power_supply_get_property(struct power_supply *psy,
278 struct power_supply *psy); 305 enum power_supply_property psp,
279extern int power_supply_register_no_ws(struct device *parent, 306 union power_supply_propval *val);
280 struct power_supply *psy); 307extern int power_supply_set_property(struct power_supply *psy,
308 enum power_supply_property psp,
309 const union power_supply_propval *val);
310extern int power_supply_property_is_writeable(struct power_supply *psy,
311 enum power_supply_property psp);
312extern void power_supply_external_power_changed(struct power_supply *psy);
313
314extern struct power_supply *__must_check
315power_supply_register(struct device *parent,
316 const struct power_supply_desc *desc,
317 const struct power_supply_config *cfg);
318extern struct power_supply *__must_check
319power_supply_register_no_ws(struct device *parent,
320 const struct power_supply_desc *desc,
321 const struct power_supply_config *cfg);
322extern struct power_supply *__must_check
323devm_power_supply_register(struct device *parent,
324 const struct power_supply_desc *desc,
325 const struct power_supply_config *cfg);
326extern struct power_supply *__must_check
327devm_power_supply_register_no_ws(struct device *parent,
328 const struct power_supply_desc *desc,
329 const struct power_supply_config *cfg);
281extern void power_supply_unregister(struct power_supply *psy); 330extern void power_supply_unregister(struct power_supply *psy);
282extern int power_supply_powers(struct power_supply *psy, struct device *dev); 331extern int power_supply_powers(struct power_supply *psy, struct device *dev);
283 332
333extern void *power_supply_get_drvdata(struct power_supply *psy);
284/* For APM emulation, think legacy userspace. */ 334/* For APM emulation, think legacy userspace. */
285extern struct class *power_supply_class; 335extern struct class *power_supply_class;
286 336
diff --git a/include/linux/printk.h b/include/linux/printk.h
index baa3f97d8ce8..9b30871c9149 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -255,6 +255,11 @@ extern asmlinkage void dump_stack(void) __cold;
255 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) 255 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
256#define pr_info(fmt, ...) \ 256#define pr_info(fmt, ...) \
257 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 257 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
258/*
259 * Like KERN_CONT, pr_cont() should only be used when continuing
260 * a line with no newline ('\n') enclosed. Otherwise it defaults
261 * back to KERN_DEFAULT.
262 */
258#define pr_cont(fmt, ...) \ 263#define pr_cont(fmt, ...) \
259 printk(KERN_CONT fmt, ##__VA_ARGS__) 264 printk(KERN_CONT fmt, ##__VA_ARGS__)
260 265
diff --git a/include/linux/property.h b/include/linux/property.h
index a6a3d98bd7e9..de8bdf417a35 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -13,6 +13,7 @@
13#ifndef _LINUX_PROPERTY_H_ 13#ifndef _LINUX_PROPERTY_H_
14#define _LINUX_PROPERTY_H_ 14#define _LINUX_PROPERTY_H_
15 15
16#include <linux/fwnode.h>
16#include <linux/types.h> 17#include <linux/types.h>
17 18
18struct device; 19struct device;
@@ -40,16 +41,6 @@ int device_property_read_string_array(struct device *dev, const char *propname,
40int device_property_read_string(struct device *dev, const char *propname, 41int device_property_read_string(struct device *dev, const char *propname,
41 const char **val); 42 const char **val);
42 43
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); 44bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname);
54int fwnode_property_read_u8_array(struct fwnode_handle *fwnode, 45int fwnode_property_read_u8_array(struct fwnode_handle *fwnode,
55 const char *propname, u8 *val, 46 const char *propname, u8 *val,
@@ -140,4 +131,37 @@ static inline int fwnode_property_read_u64(struct fwnode_handle *fwnode,
140 return fwnode_property_read_u64_array(fwnode, propname, val, 1); 131 return fwnode_property_read_u64_array(fwnode, propname, val, 1);
141} 132}
142 133
134/**
135 * struct property_entry - "Built-in" device property representation.
136 * @name: Name of the property.
137 * @type: Type of the property.
138 * @nval: Number of items of type @type making up the value.
139 * @value: Value of the property (an array of @nval items of type @type).
140 */
141struct property_entry {
142 const char *name;
143 enum dev_prop_type type;
144 size_t nval;
145 union {
146 void *raw_data;
147 u8 *u8_data;
148 u16 *u16_data;
149 u32 *u32_data;
150 u64 *u64_data;
151 const char **str;
152 } value;
153};
154
155/**
156 * struct property_set - Collection of "built-in" device properties.
157 * @fwnode: Handle to be pointed to by the fwnode field of struct device.
158 * @properties: Array of properties terminated with a null entry.
159 */
160struct property_set {
161 struct fwnode_handle fwnode;
162 struct property_entry *properties;
163};
164
165void device_add_property_set(struct device *dev, struct property_set *pset);
166
143#endif /* _LINUX_PROPERTY_H_ */ 167#endif /* _LINUX_PROPERTY_H_ */
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 8884f6e507f7..8e7a25b068b0 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -40,6 +40,7 @@ enum pstore_type_id {
40 PSTORE_TYPE_PPC_OF = 5, 40 PSTORE_TYPE_PPC_OF = 5,
41 PSTORE_TYPE_PPC_COMMON = 6, 41 PSTORE_TYPE_PPC_COMMON = 6,
42 PSTORE_TYPE_PMSG = 7, 42 PSTORE_TYPE_PMSG = 7,
43 PSTORE_TYPE_PPC_OPAL = 8,
43 PSTORE_TYPE_UNKNOWN = 255 44 PSTORE_TYPE_UNKNOWN = 255
44}; 45};
45 46
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index 0d8ff3fb84ba..b8b73066d137 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -64,11 +64,11 @@ struct ptp_clock_request {
64 * @adjtime: Shifts the time of the hardware clock. 64 * @adjtime: Shifts the time of the hardware clock.
65 * parameter delta: Desired change in nanoseconds. 65 * parameter delta: Desired change in nanoseconds.
66 * 66 *
67 * @gettime: Reads the current time from the hardware clock. 67 * @gettime64: Reads the current time from the hardware clock.
68 * parameter ts: Holds the result. 68 * parameter ts: Holds the result.
69 * 69 *
70 * @settime: Set the current time on the hardware clock. 70 * @settime64: Set the current time on the hardware clock.
71 * parameter ts: Time value to set. 71 * parameter ts: Time value to set.
72 * 72 *
73 * @enable: Request driver to enable or disable an ancillary feature. 73 * @enable: Request driver to enable or disable an ancillary feature.
74 * parameter request: Desired resource to enable or disable. 74 * parameter request: Desired resource to enable or disable.
@@ -104,8 +104,8 @@ struct ptp_clock_info {
104 struct ptp_pin_desc *pin_config; 104 struct ptp_pin_desc *pin_config;
105 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta); 105 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta);
106 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta); 106 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta);
107 int (*gettime)(struct ptp_clock_info *ptp, struct timespec *ts); 107 int (*gettime64)(struct ptp_clock_info *ptp, struct timespec64 *ts);
108 int (*settime)(struct ptp_clock_info *ptp, const struct timespec *ts); 108 int (*settime64)(struct ptp_clock_info *p, const struct timespec64 *ts);
109 int (*enable)(struct ptp_clock_info *ptp, 109 int (*enable)(struct ptp_clock_info *ptp,
110 struct ptp_clock_request *request, int on); 110 struct ptp_clock_request *request, int on);
111 int (*verify)(struct ptp_clock_info *ptp, unsigned int pin, 111 int (*verify)(struct ptp_clock_info *ptp, unsigned int pin,
diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h
new file mode 100644
index 000000000000..d7a974d5f57c
--- /dev/null
+++ b/include/linux/qcom_scm.h
@@ -0,0 +1,28 @@
1/* Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
2 * Copyright (C) 2015 Linaro Ltd.
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 and
6 * only version 2 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#ifndef __QCOM_SCM_H
14#define __QCOM_SCM_H
15
16extern int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus);
17extern int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus);
18
19#define QCOM_SCM_CPU_PWR_DOWN_L2_ON 0x0
20#define QCOM_SCM_CPU_PWR_DOWN_L2_OFF 0x1
21
22extern void qcom_scm_cpu_power_down(u32 flags);
23
24#define QCOM_SCM_VERSION(major, minor) (((major) << 16) | ((minor) & 0xFF))
25
26extern u32 qcom_scm_get_version(void);
27
28#endif
diff --git a/include/linux/quota.h b/include/linux/quota.h
index d534e8ed308a..b2505acfd3c0 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -50,6 +50,7 @@
50 50
51#undef USRQUOTA 51#undef USRQUOTA
52#undef GRPQUOTA 52#undef GRPQUOTA
53#undef PRJQUOTA
53enum quota_type { 54enum quota_type {
54 USRQUOTA = 0, /* element used for user quotas */ 55 USRQUOTA = 0, /* element used for user quotas */
55 GRPQUOTA = 1, /* element used for group quotas */ 56 GRPQUOTA = 1, /* element used for group quotas */
@@ -319,6 +320,7 @@ struct dquot_operations {
319 /* get reserved quota for delayed alloc, value returned is managed by 320 /* get reserved quota for delayed alloc, value returned is managed by
320 * quota code only */ 321 * quota code only */
321 qsize_t *(*get_reserved_space) (struct inode *); 322 qsize_t *(*get_reserved_space) (struct inode *);
323 int (*get_projid) (struct inode *, kprojid_t *);/* Get project ID */
322}; 324};
323 325
324struct path; 326struct path;
@@ -344,7 +346,10 @@ struct qc_dqblk {
344 int d_rt_spc_warns; /* # warnings issued wrt RT space */ 346 int d_rt_spc_warns; /* # warnings issued wrt RT space */
345}; 347};
346 348
347/* Field specifiers for ->set_dqblk() in struct qc_dqblk */ 349/*
350 * Field specifiers for ->set_dqblk() in struct qc_dqblk and also for
351 * ->set_info() in struct qc_info
352 */
348#define QC_INO_SOFT (1<<0) 353#define QC_INO_SOFT (1<<0)
349#define QC_INO_HARD (1<<1) 354#define QC_INO_HARD (1<<1)
350#define QC_SPC_SOFT (1<<2) 355#define QC_SPC_SOFT (1<<2)
@@ -365,6 +370,51 @@ struct qc_dqblk {
365#define QC_INO_COUNT (1<<13) 370#define QC_INO_COUNT (1<<13)
366#define QC_RT_SPACE (1<<14) 371#define QC_RT_SPACE (1<<14)
367#define QC_ACCT_MASK (QC_SPACE | QC_INO_COUNT | QC_RT_SPACE) 372#define QC_ACCT_MASK (QC_SPACE | QC_INO_COUNT | QC_RT_SPACE)
373#define QC_FLAGS (1<<15)
374
375#define QCI_SYSFILE (1 << 0) /* Quota file is hidden from userspace */
376#define QCI_ROOT_SQUASH (1 << 1) /* Root squash turned on */
377#define QCI_ACCT_ENABLED (1 << 2) /* Quota accounting enabled */
378#define QCI_LIMITS_ENFORCED (1 << 3) /* Quota limits enforced */
379
380/* Structures for communicating via ->get_state */
381struct qc_type_state {
382 unsigned int flags; /* Flags QCI_* */
383 unsigned int spc_timelimit; /* Time after which space softlimit is
384 * enforced */
385 unsigned int ino_timelimit; /* Ditto for inode softlimit */
386 unsigned int rt_spc_timelimit; /* Ditto for real-time space */
387 unsigned int spc_warnlimit; /* Limit for number of space warnings */
388 unsigned int ino_warnlimit; /* Ditto for inodes */
389 unsigned int rt_spc_warnlimit; /* Ditto for real-time space */
390 unsigned long long ino; /* Inode number of quota file */
391 blkcnt_t blocks; /* Number of 512-byte blocks in the file */
392 blkcnt_t nextents; /* Number of extents in the file */
393};
394
395struct qc_state {
396 unsigned int s_incoredqs; /* Number of dquots in core */
397 /*
398 * Per quota type information. The array should really have
399 * max(MAXQUOTAS, XQM_MAXQUOTAS) entries. BUILD_BUG_ON in
400 * quota_getinfo() makes sure XQM_MAXQUOTAS is large enough. Once VFS
401 * supports project quotas, this can be changed to MAXQUOTAS
402 */
403 struct qc_type_state s_state[XQM_MAXQUOTAS];
404};
405
406/* Structure for communicating via ->set_info */
407struct qc_info {
408 int i_fieldmask; /* mask of fields to change in ->set_info() */
409 unsigned int i_flags; /* Flags QCI_* */
410 unsigned int i_spc_timelimit; /* Time after which space softlimit is
411 * enforced */
412 unsigned int i_ino_timelimit; /* Ditto for inode softlimit */
413 unsigned int i_rt_spc_timelimit;/* Ditto for real-time space */
414 unsigned int i_spc_warnlimit; /* Limit for number of space warnings */
415 unsigned int i_ino_warnlimit; /* Limit for number of inode warnings */
416 unsigned int i_rt_spc_warnlimit; /* Ditto for real-time space */
417};
368 418
369/* Operations handling requests from userspace */ 419/* Operations handling requests from userspace */
370struct quotactl_ops { 420struct quotactl_ops {
@@ -373,12 +423,10 @@ struct quotactl_ops {
373 int (*quota_enable)(struct super_block *, unsigned int); 423 int (*quota_enable)(struct super_block *, unsigned int);
374 int (*quota_disable)(struct super_block *, unsigned int); 424 int (*quota_disable)(struct super_block *, unsigned int);
375 int (*quota_sync)(struct super_block *, int); 425 int (*quota_sync)(struct super_block *, int);
376 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 426 int (*set_info)(struct super_block *, int, struct qc_info *);
377 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
378 int (*get_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *); 427 int (*get_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *);
379 int (*set_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *); 428 int (*set_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *);
380 int (*get_xstate)(struct super_block *, struct fs_quota_stat *); 429 int (*get_state)(struct super_block *, struct qc_state *);
381 int (*get_xstatev)(struct super_block *, struct fs_quota_statv *);
382 int (*rm_xquota)(struct super_block *, unsigned int); 430 int (*rm_xquota)(struct super_block *, unsigned int);
383}; 431};
384 432
@@ -389,7 +437,19 @@ struct quota_format_type {
389 struct quota_format_type *qf_next; 437 struct quota_format_type *qf_next;
390}; 438};
391 439
392/* Quota state flags - they actually come in two flavors - for users and groups */ 440/**
441 * Quota state flags - they actually come in two flavors - for users and groups.
442 *
443 * Actual typed flags layout:
444 * USRQUOTA GRPQUOTA
445 * DQUOT_USAGE_ENABLED 0x0001 0x0002
446 * DQUOT_LIMITS_ENABLED 0x0004 0x0008
447 * DQUOT_SUSPENDED 0x0010 0x0020
448 *
449 * Following bits are used for non-typed flags:
450 * DQUOT_QUOTA_SYS_FILE 0x0040
451 * DQUOT_NEGATIVE_USAGE 0x0080
452 */
393enum { 453enum {
394 _DQUOT_USAGE_ENABLED = 0, /* Track disk usage for users */ 454 _DQUOT_USAGE_ENABLED = 0, /* Track disk usage for users */
395 _DQUOT_LIMITS_ENABLED, /* Enforce quota limits for users */ 455 _DQUOT_LIMITS_ENABLED, /* Enforce quota limits for users */
@@ -398,9 +458,9 @@ enum {
398 * memory to turn them on */ 458 * memory to turn them on */
399 _DQUOT_STATE_FLAGS 459 _DQUOT_STATE_FLAGS
400}; 460};
401#define DQUOT_USAGE_ENABLED (1 << _DQUOT_USAGE_ENABLED) 461#define DQUOT_USAGE_ENABLED (1 << _DQUOT_USAGE_ENABLED * MAXQUOTAS)
402#define DQUOT_LIMITS_ENABLED (1 << _DQUOT_LIMITS_ENABLED) 462#define DQUOT_LIMITS_ENABLED (1 << _DQUOT_LIMITS_ENABLED * MAXQUOTAS)
403#define DQUOT_SUSPENDED (1 << _DQUOT_SUSPENDED) 463#define DQUOT_SUSPENDED (1 << _DQUOT_SUSPENDED * MAXQUOTAS)
404#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \ 464#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \
405 DQUOT_SUSPENDED) 465 DQUOT_SUSPENDED)
406/* Other quota flags */ 466/* Other quota flags */
@@ -414,15 +474,21 @@ enum {
414 */ 474 */
415#define DQUOT_NEGATIVE_USAGE (1 << (DQUOT_STATE_LAST + 1)) 475#define DQUOT_NEGATIVE_USAGE (1 << (DQUOT_STATE_LAST + 1))
416 /* Allow negative quota usage */ 476 /* Allow negative quota usage */
417
418static inline unsigned int dquot_state_flag(unsigned int flags, int type) 477static inline unsigned int dquot_state_flag(unsigned int flags, int type)
419{ 478{
420 return flags << _DQUOT_STATE_FLAGS * type; 479 return flags << type;
421} 480}
422 481
423static inline unsigned int dquot_generic_flag(unsigned int flags, int type) 482static inline unsigned int dquot_generic_flag(unsigned int flags, int type)
424{ 483{
425 return (flags >> _DQUOT_STATE_FLAGS * type) & DQUOT_STATE_FLAGS; 484 return (flags >> type) & DQUOT_STATE_FLAGS;
485}
486
487/* Bitmap of quota types where flag is set in flags */
488static __always_inline unsigned dquot_state_types(unsigned flags, unsigned flag)
489{
490 BUILD_BUG_ON_NOT_POWER_OF_2(flag);
491 return (flags / flag) & ((1 << MAXQUOTAS) - 1);
426} 492}
427 493
428#ifdef CONFIG_QUOTA_NETLINK_INTERFACE 494#ifdef CONFIG_QUOTA_NETLINK_INTERFACE
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index df73258cca47..77ca6601ff25 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -95,8 +95,8 @@ int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
95int dquot_quota_off(struct super_block *sb, int type); 95int dquot_quota_off(struct super_block *sb, int type);
96int dquot_writeback_dquots(struct super_block *sb, int type); 96int dquot_writeback_dquots(struct super_block *sb, int type);
97int dquot_quota_sync(struct super_block *sb, int type); 97int dquot_quota_sync(struct super_block *sb, int type);
98int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 98int dquot_get_state(struct super_block *sb, struct qc_state *state);
99int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 99int dquot_set_dqinfo(struct super_block *sb, int type, struct qc_info *ii);
100int dquot_get_dqblk(struct super_block *sb, struct kqid id, 100int dquot_get_dqblk(struct super_block *sb, struct kqid id,
101 struct qc_dqblk *di); 101 struct qc_dqblk *di);
102int dquot_set_dqblk(struct super_block *sb, struct kqid id, 102int dquot_set_dqblk(struct super_block *sb, struct kqid id,
@@ -134,10 +134,7 @@ static inline bool sb_has_quota_suspended(struct super_block *sb, int type)
134 134
135static inline unsigned sb_any_quota_suspended(struct super_block *sb) 135static inline unsigned sb_any_quota_suspended(struct super_block *sb)
136{ 136{
137 unsigned type, tmsk = 0; 137 return dquot_state_types(sb_dqopt(sb)->flags, DQUOT_SUSPENDED);
138 for (type = 0; type < MAXQUOTAS; type++)
139 tmsk |= sb_has_quota_suspended(sb, type) << type;
140 return tmsk;
141} 138}
142 139
143/* Does kernel know about any quota information for given sb + type? */ 140/* Does kernel know about any quota information for given sb + type? */
@@ -149,10 +146,7 @@ static inline bool sb_has_quota_loaded(struct super_block *sb, int type)
149 146
150static inline unsigned sb_any_quota_loaded(struct super_block *sb) 147static inline unsigned sb_any_quota_loaded(struct super_block *sb)
151{ 148{
152 unsigned type, tmsk = 0; 149 return dquot_state_types(sb_dqopt(sb)->flags, DQUOT_USAGE_ENABLED);
153 for (type = 0; type < MAXQUOTAS; type++)
154 tmsk |= sb_has_quota_loaded(sb, type) << type;
155 return tmsk;
156} 150}
157 151
158static inline bool sb_has_quota_active(struct super_block *sb, int type) 152static inline bool sb_has_quota_active(struct super_block *sb, int type)
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 73069cb6c54a..a7a06d1dcf9c 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -72,6 +72,7 @@ extern const char raid6_empty_zero_page[PAGE_SIZE];
72/* Routine choices */ 72/* Routine choices */
73struct raid6_calls { 73struct raid6_calls {
74 void (*gen_syndrome)(int, size_t, void **); 74 void (*gen_syndrome)(int, size_t, void **);
75 void (*xor_syndrome)(int, int, int, size_t, void **);
75 int (*valid)(void); /* Returns 1 if this routine set is usable */ 76 int (*valid)(void); /* Returns 1 if this routine set is usable */
76 const char *name; /* Name of this routine set */ 77 const char *name; /* Name of this routine set */
77 int prefer; /* Has special performance attribute */ 78 int prefer; /* Has special performance attribute */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 78097491cd99..573a5afd5ed8 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -48,6 +48,26 @@
48 48
49extern int rcu_expedited; /* for sysctl */ 49extern int rcu_expedited; /* for sysctl */
50 50
51#ifdef CONFIG_TINY_RCU
52/* Tiny RCU doesn't expedite, as its purpose in life is instead to be tiny. */
53static inline bool rcu_gp_is_expedited(void) /* Internal RCU use. */
54{
55 return false;
56}
57
58static inline void rcu_expedite_gp(void)
59{
60}
61
62static inline void rcu_unexpedite_gp(void)
63{
64}
65#else /* #ifdef CONFIG_TINY_RCU */
66bool rcu_gp_is_expedited(void); /* Internal RCU use. */
67void rcu_expedite_gp(void);
68void rcu_unexpedite_gp(void);
69#endif /* #else #ifdef CONFIG_TINY_RCU */
70
51enum rcutorture_type { 71enum rcutorture_type {
52 RCU_FLAVOR, 72 RCU_FLAVOR,
53 RCU_BH_FLAVOR, 73 RCU_BH_FLAVOR,
@@ -195,6 +215,15 @@ void call_rcu_sched(struct rcu_head *head,
195 215
196void synchronize_sched(void); 216void synchronize_sched(void);
197 217
218/*
219 * Structure allowing asynchronous waiting on RCU.
220 */
221struct rcu_synchronize {
222 struct rcu_head head;
223 struct completion completion;
224};
225void wakeme_after_rcu(struct rcu_head *head);
226
198/** 227/**
199 * call_rcu_tasks() - Queue an RCU for invocation task-based grace period 228 * call_rcu_tasks() - Queue an RCU for invocation task-based grace period
200 * @head: structure to be used for queueing the RCU updates. 229 * @head: structure to be used for queueing the RCU updates.
@@ -258,6 +287,7 @@ static inline int rcu_preempt_depth(void)
258 287
259/* Internal to kernel */ 288/* Internal to kernel */
260void rcu_init(void); 289void rcu_init(void);
290void rcu_end_inkernel_boot(void);
261void rcu_sched_qs(void); 291void rcu_sched_qs(void);
262void rcu_bh_qs(void); 292void rcu_bh_qs(void);
263void rcu_check_callbacks(int user); 293void rcu_check_callbacks(int user);
@@ -266,6 +296,8 @@ void rcu_idle_enter(void);
266void rcu_idle_exit(void); 296void rcu_idle_exit(void);
267void rcu_irq_enter(void); 297void rcu_irq_enter(void);
268void rcu_irq_exit(void); 298void rcu_irq_exit(void);
299int rcu_cpu_notify(struct notifier_block *self,
300 unsigned long action, void *hcpu);
269 301
270#ifdef CONFIG_RCU_STALL_COMMON 302#ifdef CONFIG_RCU_STALL_COMMON
271void rcu_sysrq_start(void); 303void rcu_sysrq_start(void);
@@ -720,7 +752,7 @@ static inline void rcu_preempt_sleep_check(void)
720 * annotated as __rcu. 752 * annotated as __rcu.
721 */ 753 */
722#define rcu_dereference_check(p, c) \ 754#define rcu_dereference_check(p, c) \
723 __rcu_dereference_check((p), rcu_read_lock_held() || (c), __rcu) 755 __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
724 756
725/** 757/**
726 * rcu_dereference_bh_check() - rcu_dereference_bh with debug checking 758 * rcu_dereference_bh_check() - rcu_dereference_bh with debug checking
@@ -730,7 +762,7 @@ static inline void rcu_preempt_sleep_check(void)
730 * This is the RCU-bh counterpart to rcu_dereference_check(). 762 * This is the RCU-bh counterpart to rcu_dereference_check().
731 */ 763 */
732#define rcu_dereference_bh_check(p, c) \ 764#define rcu_dereference_bh_check(p, c) \
733 __rcu_dereference_check((p), rcu_read_lock_bh_held() || (c), __rcu) 765 __rcu_dereference_check((p), (c) || rcu_read_lock_bh_held(), __rcu)
734 766
735/** 767/**
736 * rcu_dereference_sched_check() - rcu_dereference_sched with debug checking 768 * rcu_dereference_sched_check() - rcu_dereference_sched with debug checking
@@ -740,7 +772,7 @@ static inline void rcu_preempt_sleep_check(void)
740 * This is the RCU-sched counterpart to rcu_dereference_check(). 772 * This is the RCU-sched counterpart to rcu_dereference_check().
741 */ 773 */
742#define rcu_dereference_sched_check(p, c) \ 774#define rcu_dereference_sched_check(p, c) \
743 __rcu_dereference_check((p), rcu_read_lock_sched_held() || (c), \ 775 __rcu_dereference_check((p), (c) || rcu_read_lock_sched_held(), \
744 __rcu) 776 __rcu)
745 777
746#define rcu_dereference_raw(p) rcu_dereference_check(p, 1) /*@@@ needed? @@@*/ 778#define rcu_dereference_raw(p) rcu_dereference_check(p, 1) /*@@@ needed? @@@*/
@@ -933,9 +965,9 @@ static inline void rcu_read_unlock(void)
933{ 965{
934 rcu_lockdep_assert(rcu_is_watching(), 966 rcu_lockdep_assert(rcu_is_watching(),
935 "rcu_read_unlock() used illegally while idle"); 967 "rcu_read_unlock() used illegally while idle");
936 rcu_lock_release(&rcu_lock_map);
937 __release(RCU); 968 __release(RCU);
938 __rcu_read_unlock(); 969 __rcu_read_unlock();
970 rcu_lock_release(&rcu_lock_map); /* Keep acq info for rls diags. */
939} 971}
940 972
941/** 973/**
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 67fc8fcdc4b0..a7ff409f386d 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -70,7 +70,8 @@ void ctrl_alt_del(void);
70#define POWEROFF_CMD_PATH_LEN 256 70#define POWEROFF_CMD_PATH_LEN 256
71extern char poweroff_cmd[POWEROFF_CMD_PATH_LEN]; 71extern char poweroff_cmd[POWEROFF_CMD_PATH_LEN];
72 72
73extern int orderly_poweroff(bool force); 73extern void orderly_poweroff(bool force);
74extern void orderly_reboot(void);
74 75
75/* 76/*
76 * Emergency restart, callable from an interrupt handler. 77 * Emergency restart, callable from an interrupt handler.
diff --git a/include/linux/regulator/act8865.h b/include/linux/regulator/act8865.h
index b6c4909b33af..15fa8f2d35c9 100644
--- a/include/linux/regulator/act8865.h
+++ b/include/linux/regulator/act8865.h
@@ -19,6 +19,19 @@
19#include <linux/regulator/machine.h> 19#include <linux/regulator/machine.h>
20 20
21enum { 21enum {
22 ACT8600_ID_DCDC1,
23 ACT8600_ID_DCDC2,
24 ACT8600_ID_DCDC3,
25 ACT8600_ID_SUDCDC4,
26 ACT8600_ID_LDO5,
27 ACT8600_ID_LDO6,
28 ACT8600_ID_LDO7,
29 ACT8600_ID_LDO8,
30 ACT8600_ID_LDO9,
31 ACT8600_ID_LDO10,
32};
33
34enum {
22 ACT8865_ID_DCDC1, 35 ACT8865_ID_DCDC1,
23 ACT8865_ID_DCDC2, 36 ACT8865_ID_DCDC2,
24 ACT8865_ID_DCDC3, 37 ACT8865_ID_DCDC3,
@@ -46,6 +59,7 @@ enum {
46}; 59};
47 60
48enum { 61enum {
62 ACT8600,
49 ACT8865, 63 ACT8865,
50 ACT8846, 64 ACT8846,
51}; 65};
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index d17e1ff7ad01..f8a689ed62a5 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -114,7 +114,7 @@ struct regmap;
114#define REGULATOR_EVENT_OVER_TEMP 0x10 114#define REGULATOR_EVENT_OVER_TEMP 0x10
115#define REGULATOR_EVENT_FORCE_DISABLE 0x20 115#define REGULATOR_EVENT_FORCE_DISABLE 0x20
116#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40 116#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40
117#define REGULATOR_EVENT_DISABLE 0x80 117#define REGULATOR_EVENT_DISABLE 0x80
118#define REGULATOR_EVENT_PRE_VOLTAGE_CHANGE 0x100 118#define REGULATOR_EVENT_PRE_VOLTAGE_CHANGE 0x100
119#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x200 119#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x200
120#define REGULATOR_EVENT_PRE_DISABLE 0x400 120#define REGULATOR_EVENT_PRE_DISABLE 0x400
@@ -238,7 +238,7 @@ int regulator_get_current_limit(struct regulator *regulator);
238 238
239int regulator_set_mode(struct regulator *regulator, unsigned int mode); 239int regulator_set_mode(struct regulator *regulator, unsigned int mode);
240unsigned int regulator_get_mode(struct regulator *regulator); 240unsigned int regulator_get_mode(struct regulator *regulator);
241int regulator_set_optimum_mode(struct regulator *regulator, int load_uA); 241int regulator_set_load(struct regulator *regulator, int load_uA);
242 242
243int regulator_allow_bypass(struct regulator *regulator, bool allow); 243int regulator_allow_bypass(struct regulator *regulator, bool allow);
244 244
@@ -252,8 +252,12 @@ int regulator_list_hardware_vsel(struct regulator *regulator,
252/* regulator notifier block */ 252/* regulator notifier block */
253int regulator_register_notifier(struct regulator *regulator, 253int regulator_register_notifier(struct regulator *regulator,
254 struct notifier_block *nb); 254 struct notifier_block *nb);
255int devm_regulator_register_notifier(struct regulator *regulator,
256 struct notifier_block *nb);
255int regulator_unregister_notifier(struct regulator *regulator, 257int regulator_unregister_notifier(struct regulator *regulator,
256 struct notifier_block *nb); 258 struct notifier_block *nb);
259void devm_regulator_unregister_notifier(struct regulator *regulator,
260 struct notifier_block *nb);
257 261
258/* driver data - core doesn't touch */ 262/* driver data - core doesn't touch */
259void *regulator_get_drvdata(struct regulator *regulator); 263void *regulator_get_drvdata(struct regulator *regulator);
@@ -479,8 +483,7 @@ static inline unsigned int regulator_get_mode(struct regulator *regulator)
479 return REGULATOR_MODE_NORMAL; 483 return REGULATOR_MODE_NORMAL;
480} 484}
481 485
482static inline int regulator_set_optimum_mode(struct regulator *regulator, 486static inline int regulator_set_load(struct regulator *regulator, int load_uA)
483 int load_uA)
484{ 487{
485 return REGULATOR_MODE_NORMAL; 488 return REGULATOR_MODE_NORMAL;
486} 489}
@@ -515,12 +518,24 @@ static inline int regulator_register_notifier(struct regulator *regulator,
515 return 0; 518 return 0;
516} 519}
517 520
521static inline int devm_regulator_register_notifier(struct regulator *regulator,
522 struct notifier_block *nb)
523{
524 return 0;
525}
526
518static inline int regulator_unregister_notifier(struct regulator *regulator, 527static inline int regulator_unregister_notifier(struct regulator *regulator,
519 struct notifier_block *nb) 528 struct notifier_block *nb)
520{ 529{
521 return 0; 530 return 0;
522} 531}
523 532
533static inline int devm_regulator_unregister_notifier(struct regulator *regulator,
534 struct notifier_block *nb)
535{
536 return 0;
537}
538
524static inline void *regulator_get_drvdata(struct regulator *regulator) 539static inline void *regulator_get_drvdata(struct regulator *regulator)
525{ 540{
526 return NULL; 541 return NULL;
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index d4ad5b5a02bb..fffa688ac3a7 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -98,6 +98,7 @@ struct regulator_linear_range {
98 * REGULATOR_STATUS value (or negative errno) 98 * REGULATOR_STATUS value (or negative errno)
99 * @get_optimum_mode: Get the most efficient operating mode for the regulator 99 * @get_optimum_mode: Get the most efficient operating mode for the regulator
100 * when running with the specified parameters. 100 * when running with the specified parameters.
101 * @set_load: Set the load for the regulator.
101 * 102 *
102 * @set_bypass: Set the regulator in bypass mode. 103 * @set_bypass: Set the regulator in bypass mode.
103 * @get_bypass: Get the regulator bypass mode state. 104 * @get_bypass: Get the regulator bypass mode state.
@@ -167,6 +168,8 @@ struct regulator_ops {
167 /* get most efficient regulator operating mode for load */ 168 /* get most efficient regulator operating mode for load */
168 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV, 169 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV,
169 int output_uV, int load_uA); 170 int output_uV, int load_uA);
171 /* set the load on the regulator */
172 int (*set_load)(struct regulator_dev *, int load_uA);
170 173
171 /* control and report on bypass mode */ 174 /* control and report on bypass mode */
172 int (*set_bypass)(struct regulator_dev *dev, bool enable); 175 int (*set_bypass)(struct regulator_dev *dev, bool enable);
@@ -316,7 +319,7 @@ struct regulator_desc {
316 * @driver_data: private regulator data 319 * @driver_data: private regulator data
317 * @of_node: OpenFirmware node to parse for device tree bindings (may be 320 * @of_node: OpenFirmware node to parse for device tree bindings (may be
318 * NULL). 321 * NULL).
319 * @regmap: regmap to use for core regmap helpers if dev_get_regulator() is 322 * @regmap: regmap to use for core regmap helpers if dev_get_regmap() is
320 * insufficient. 323 * insufficient.
321 * @ena_gpio_initialized: GPIO controlling regulator enable was properly 324 * @ena_gpio_initialized: GPIO controlling regulator enable was properly
322 * initialized, meaning that >= 0 is a valid gpio 325 * initialized, meaning that >= 0 is a valid gpio
@@ -367,6 +370,7 @@ struct regulator_dev {
367 struct device dev; 370 struct device dev;
368 struct regulation_constraints *constraints; 371 struct regulation_constraints *constraints;
369 struct regulator *supply; /* for tree */ 372 struct regulator *supply; /* for tree */
373 const char *supply_name;
370 struct regmap *regmap; 374 struct regmap *regmap;
371 375
372 struct delayed_work disable_work; 376 struct delayed_work disable_work;
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index 9e7e745dac55..78b8a9b9d40a 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -404,6 +404,7 @@ enum rproc_crash_type {
404 * @table_ptr: pointer to the resource table in effect 404 * @table_ptr: pointer to the resource table in effect
405 * @cached_table: copy of the resource table 405 * @cached_table: copy of the resource table
406 * @table_csum: checksum of the resource table 406 * @table_csum: checksum of the resource table
407 * @has_iommu: flag to indicate if remote processor is behind an MMU
407 */ 408 */
408struct rproc { 409struct rproc {
409 struct klist_node node; 410 struct klist_node node;
@@ -435,6 +436,7 @@ struct rproc {
435 struct resource_table *table_ptr; 436 struct resource_table *table_ptr;
436 struct resource_table *cached_table; 437 struct resource_table *cached_table;
437 u32 table_csum; 438 u32 table_csum;
439 bool has_iommu;
438}; 440};
439 441
440/* we currently support only two vrings per rvdev */ 442/* we currently support only two vrings per rvdev */
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 58851275fed9..e23d242d1230 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -1,14 +1,13 @@
1/* 1/*
2 * Resizable, Scalable, Concurrent Hash Table 2 * Resizable, Scalable, Concurrent Hash Table
3 * 3 *
4 * Copyright (c) 2014 Thomas Graf <tgraf@suug.ch> 4 * Copyright (c) 2015 Herbert Xu <herbert@gondor.apana.org.au>
5 * Copyright (c) 2014-2015 Thomas Graf <tgraf@suug.ch>
5 * Copyright (c) 2008-2014 Patrick McHardy <kaber@trash.net> 6 * Copyright (c) 2008-2014 Patrick McHardy <kaber@trash.net>
6 * 7 *
7 * Based on the following paper by Josh Triplett, Paul E. McKenney
8 * and Jonathan Walpole:
9 * https://www.usenix.org/legacy/event/atc11/tech/final_files/Triplett.pdf
10 *
11 * Code partially derived from nft_hash 8 * Code partially derived from nft_hash
9 * Rewritten with rehash code from br_multicast plus single list
10 * pointer as suggested by Josh Triplett
12 * 11 *
13 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
@@ -19,9 +18,12 @@
19#define _LINUX_RHASHTABLE_H 18#define _LINUX_RHASHTABLE_H
20 19
21#include <linux/compiler.h> 20#include <linux/compiler.h>
21#include <linux/errno.h>
22#include <linux/jhash.h>
22#include <linux/list_nulls.h> 23#include <linux/list_nulls.h>
23#include <linux/workqueue.h> 24#include <linux/workqueue.h>
24#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/rcupdate.h>
25 27
26/* 28/*
27 * The end of the chain is marked with a special nulls marks which has 29 * The end of the chain is marked with a special nulls marks which has
@@ -42,6 +44,9 @@
42#define RHT_HASH_BITS 27 44#define RHT_HASH_BITS 27
43#define RHT_BASE_SHIFT RHT_HASH_BITS 45#define RHT_BASE_SHIFT RHT_HASH_BITS
44 46
47/* Base bits plus 1 bit for nulls marker */
48#define RHT_HASH_RESERVED_SPACE (RHT_BASE_BITS + 1)
49
45struct rhash_head { 50struct rhash_head {
46 struct rhash_head __rcu *next; 51 struct rhash_head __rcu *next;
47}; 52};
@@ -49,19 +54,43 @@ struct rhash_head {
49/** 54/**
50 * struct bucket_table - Table of hash buckets 55 * struct bucket_table - Table of hash buckets
51 * @size: Number of hash buckets 56 * @size: Number of hash buckets
57 * @rehash: Current bucket being rehashed
58 * @hash_rnd: Random seed to fold into hash
52 * @locks_mask: Mask to apply before accessing locks[] 59 * @locks_mask: Mask to apply before accessing locks[]
53 * @locks: Array of spinlocks protecting individual buckets 60 * @locks: Array of spinlocks protecting individual buckets
61 * @walkers: List of active walkers
62 * @rcu: RCU structure for freeing the table
63 * @future_tbl: Table under construction during rehashing
54 * @buckets: size * hash buckets 64 * @buckets: size * hash buckets
55 */ 65 */
56struct bucket_table { 66struct bucket_table {
57 size_t size; 67 unsigned int size;
58 unsigned int locks_mask; 68 unsigned int rehash;
59 spinlock_t *locks; 69 u32 hash_rnd;
60 struct rhash_head __rcu *buckets[]; 70 unsigned int locks_mask;
71 spinlock_t *locks;
72 struct list_head walkers;
73 struct rcu_head rcu;
74
75 struct bucket_table __rcu *future_tbl;
76
77 struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp;
78};
79
80/**
81 * struct rhashtable_compare_arg - Key for the function rhashtable_compare
82 * @ht: Hash table
83 * @key: Key to compare against
84 */
85struct rhashtable_compare_arg {
86 struct rhashtable *ht;
87 const void *key;
61}; 88};
62 89
63typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed); 90typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed);
64typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 seed); 91typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 len, u32 seed);
92typedef int (*rht_obj_cmpfn_t)(struct rhashtable_compare_arg *arg,
93 const void *obj);
65 94
66struct rhashtable; 95struct rhashtable;
67 96
@@ -71,70 +100,62 @@ struct rhashtable;
71 * @key_len: Length of key 100 * @key_len: Length of key
72 * @key_offset: Offset of key in struct to be hashed 101 * @key_offset: Offset of key in struct to be hashed
73 * @head_offset: Offset of rhash_head in struct to be hashed 102 * @head_offset: Offset of rhash_head in struct to be hashed
74 * @hash_rnd: Seed to use while hashing 103 * @max_size: Maximum size while expanding
75 * @max_shift: Maximum number of shifts while expanding 104 * @min_size: Minimum size while shrinking
76 * @min_shift: Minimum number of shifts while shrinking
77 * @nulls_base: Base value to generate nulls marker 105 * @nulls_base: Base value to generate nulls marker
106 * @insecure_elasticity: Set to true to disable chain length checks
107 * @automatic_shrinking: Enable automatic shrinking of tables
78 * @locks_mul: Number of bucket locks to allocate per cpu (default: 128) 108 * @locks_mul: Number of bucket locks to allocate per cpu (default: 128)
79 * @hashfn: Function to hash key 109 * @hashfn: Hash function (default: jhash2 if !(key_len % 4), or jhash)
80 * @obj_hashfn: Function to hash object 110 * @obj_hashfn: Function to hash object
81 * @grow_decision: If defined, may return true if table should expand 111 * @obj_cmpfn: Function to compare key with object
82 * @shrink_decision: If defined, may return true if table should shrink
83 *
84 * Note: when implementing the grow and shrink decision function, min/max
85 * shift must be enforced, otherwise, resizing watermarks they set may be
86 * useless.
87 */ 112 */
88struct rhashtable_params { 113struct rhashtable_params {
89 size_t nelem_hint; 114 size_t nelem_hint;
90 size_t key_len; 115 size_t key_len;
91 size_t key_offset; 116 size_t key_offset;
92 size_t head_offset; 117 size_t head_offset;
93 u32 hash_rnd; 118 unsigned int max_size;
94 size_t max_shift; 119 unsigned int min_size;
95 size_t min_shift;
96 u32 nulls_base; 120 u32 nulls_base;
121 bool insecure_elasticity;
122 bool automatic_shrinking;
97 size_t locks_mul; 123 size_t locks_mul;
98 rht_hashfn_t hashfn; 124 rht_hashfn_t hashfn;
99 rht_obj_hashfn_t obj_hashfn; 125 rht_obj_hashfn_t obj_hashfn;
100 bool (*grow_decision)(const struct rhashtable *ht, 126 rht_obj_cmpfn_t obj_cmpfn;
101 size_t new_size);
102 bool (*shrink_decision)(const struct rhashtable *ht,
103 size_t new_size);
104}; 127};
105 128
106/** 129/**
107 * struct rhashtable - Hash table handle 130 * struct rhashtable - Hash table handle
108 * @tbl: Bucket table 131 * @tbl: Bucket table
109 * @future_tbl: Table under construction during expansion/shrinking
110 * @nelems: Number of elements in table 132 * @nelems: Number of elements in table
111 * @shift: Current size (1 << shift) 133 * @key_len: Key length for hashfn
134 * @elasticity: Maximum chain length before rehash
112 * @p: Configuration parameters 135 * @p: Configuration parameters
113 * @run_work: Deferred worker to expand/shrink asynchronously 136 * @run_work: Deferred worker to expand/shrink asynchronously
114 * @mutex: Mutex to protect current/future table swapping 137 * @mutex: Mutex to protect current/future table swapping
115 * @walkers: List of active walkers 138 * @lock: Spin lock to protect walker list
116 * @being_destroyed: True if table is set up for destruction
117 */ 139 */
118struct rhashtable { 140struct rhashtable {
119 struct bucket_table __rcu *tbl; 141 struct bucket_table __rcu *tbl;
120 struct bucket_table __rcu *future_tbl;
121 atomic_t nelems; 142 atomic_t nelems;
122 atomic_t shift; 143 unsigned int key_len;
144 unsigned int elasticity;
123 struct rhashtable_params p; 145 struct rhashtable_params p;
124 struct work_struct run_work; 146 struct work_struct run_work;
125 struct mutex mutex; 147 struct mutex mutex;
126 struct list_head walkers; 148 spinlock_t lock;
127 bool being_destroyed;
128}; 149};
129 150
130/** 151/**
131 * struct rhashtable_walker - Hash table walker 152 * struct rhashtable_walker - Hash table walker
132 * @list: List entry on list of walkers 153 * @list: List entry on list of walkers
133 * @resize: Resize event occured 154 * @tbl: The table that we were walking over
134 */ 155 */
135struct rhashtable_walker { 156struct rhashtable_walker {
136 struct list_head list; 157 struct list_head list;
137 bool resize; 158 struct bucket_table *tbl;
138}; 159};
139 160
140/** 161/**
@@ -171,6 +192,118 @@ static inline unsigned long rht_get_nulls_value(const struct rhash_head *ptr)
171 return ((unsigned long) ptr) >> 1; 192 return ((unsigned long) ptr) >> 1;
172} 193}
173 194
195static inline void *rht_obj(const struct rhashtable *ht,
196 const struct rhash_head *he)
197{
198 return (char *)he - ht->p.head_offset;
199}
200
201static inline unsigned int rht_bucket_index(const struct bucket_table *tbl,
202 unsigned int hash)
203{
204 return (hash >> RHT_HASH_RESERVED_SPACE) & (tbl->size - 1);
205}
206
207static inline unsigned int rht_key_hashfn(
208 struct rhashtable *ht, const struct bucket_table *tbl,
209 const void *key, const struct rhashtable_params params)
210{
211 unsigned int hash;
212
213 /* params must be equal to ht->p if it isn't constant. */
214 if (!__builtin_constant_p(params.key_len))
215 hash = ht->p.hashfn(key, ht->key_len, tbl->hash_rnd);
216 else if (params.key_len) {
217 unsigned int key_len = params.key_len;
218
219 if (params.hashfn)
220 hash = params.hashfn(key, key_len, tbl->hash_rnd);
221 else if (key_len & (sizeof(u32) - 1))
222 hash = jhash(key, key_len, tbl->hash_rnd);
223 else
224 hash = jhash2(key, key_len / sizeof(u32),
225 tbl->hash_rnd);
226 } else {
227 unsigned int key_len = ht->p.key_len;
228
229 if (params.hashfn)
230 hash = params.hashfn(key, key_len, tbl->hash_rnd);
231 else
232 hash = jhash(key, key_len, tbl->hash_rnd);
233 }
234
235 return rht_bucket_index(tbl, hash);
236}
237
238static inline unsigned int rht_head_hashfn(
239 struct rhashtable *ht, const struct bucket_table *tbl,
240 const struct rhash_head *he, const struct rhashtable_params params)
241{
242 const char *ptr = rht_obj(ht, he);
243
244 return likely(params.obj_hashfn) ?
245 rht_bucket_index(tbl, params.obj_hashfn(ptr, params.key_len ?:
246 ht->p.key_len,
247 tbl->hash_rnd)) :
248 rht_key_hashfn(ht, tbl, ptr + params.key_offset, params);
249}
250
251/**
252 * rht_grow_above_75 - returns true if nelems > 0.75 * table-size
253 * @ht: hash table
254 * @tbl: current table
255 */
256static inline bool rht_grow_above_75(const struct rhashtable *ht,
257 const struct bucket_table *tbl)
258{
259 /* Expand table when exceeding 75% load */
260 return atomic_read(&ht->nelems) > (tbl->size / 4 * 3) &&
261 (!ht->p.max_size || tbl->size < ht->p.max_size);
262}
263
264/**
265 * rht_shrink_below_30 - returns true if nelems < 0.3 * table-size
266 * @ht: hash table
267 * @tbl: current table
268 */
269static inline bool rht_shrink_below_30(const struct rhashtable *ht,
270 const struct bucket_table *tbl)
271{
272 /* Shrink table beneath 30% load */
273 return atomic_read(&ht->nelems) < (tbl->size * 3 / 10) &&
274 tbl->size > ht->p.min_size;
275}
276
277/**
278 * rht_grow_above_100 - returns true if nelems > table-size
279 * @ht: hash table
280 * @tbl: current table
281 */
282static inline bool rht_grow_above_100(const struct rhashtable *ht,
283 const struct bucket_table *tbl)
284{
285 return atomic_read(&ht->nelems) > tbl->size;
286}
287
288/* The bucket lock is selected based on the hash and protects mutations
289 * on a group of hash buckets.
290 *
291 * A maximum of tbl->size/2 bucket locks is allocated. This ensures that
292 * a single lock always covers both buckets which may both contains
293 * entries which link to the same bucket of the old table during resizing.
294 * This allows to simplify the locking as locking the bucket in both
295 * tables during resize always guarantee protection.
296 *
297 * IMPORTANT: When holding the bucket lock of both the old and new table
298 * during expansions and shrinking, the old bucket lock must always be
299 * acquired first.
300 */
301static inline spinlock_t *rht_bucket_lock(const struct bucket_table *tbl,
302 unsigned int hash)
303{
304 return &tbl->locks[hash & tbl->locks_mask];
305}
306
174#ifdef CONFIG_PROVE_LOCKING 307#ifdef CONFIG_PROVE_LOCKING
175int lockdep_rht_mutex_is_held(struct rhashtable *ht); 308int lockdep_rht_mutex_is_held(struct rhashtable *ht);
176int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash); 309int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash);
@@ -187,26 +320,13 @@ static inline int lockdep_rht_bucket_is_held(const struct bucket_table *tbl,
187} 320}
188#endif /* CONFIG_PROVE_LOCKING */ 321#endif /* CONFIG_PROVE_LOCKING */
189 322
190int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params); 323int rhashtable_init(struct rhashtable *ht,
191 324 const struct rhashtable_params *params);
192void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node);
193bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node);
194 325
195bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size); 326int rhashtable_insert_slow(struct rhashtable *ht, const void *key,
196bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size); 327 struct rhash_head *obj,
197 328 struct bucket_table *old_tbl);
198int rhashtable_expand(struct rhashtable *ht); 329int rhashtable_insert_rehash(struct rhashtable *ht);
199int rhashtable_shrink(struct rhashtable *ht);
200
201void *rhashtable_lookup(struct rhashtable *ht, const void *key);
202void *rhashtable_lookup_compare(struct rhashtable *ht, const void *key,
203 bool (*compare)(void *, void *), void *arg);
204
205bool rhashtable_lookup_insert(struct rhashtable *ht, struct rhash_head *obj);
206bool rhashtable_lookup_compare_insert(struct rhashtable *ht,
207 struct rhash_head *obj,
208 bool (*compare)(void *, void *),
209 void *arg);
210 330
211int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter); 331int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter);
212void rhashtable_walk_exit(struct rhashtable_iter *iter); 332void rhashtable_walk_exit(struct rhashtable_iter *iter);
@@ -214,6 +334,9 @@ int rhashtable_walk_start(struct rhashtable_iter *iter) __acquires(RCU);
214void *rhashtable_walk_next(struct rhashtable_iter *iter); 334void *rhashtable_walk_next(struct rhashtable_iter *iter);
215void rhashtable_walk_stop(struct rhashtable_iter *iter) __releases(RCU); 335void rhashtable_walk_stop(struct rhashtable_iter *iter) __releases(RCU);
216 336
337void rhashtable_free_and_destroy(struct rhashtable *ht,
338 void (*free_fn)(void *ptr, void *arg),
339 void *arg);
217void rhashtable_destroy(struct rhashtable *ht); 340void rhashtable_destroy(struct rhashtable *ht);
218 341
219#define rht_dereference(p, ht) \ 342#define rht_dereference(p, ht) \
@@ -364,4 +487,316 @@ void rhashtable_destroy(struct rhashtable *ht);
364 rht_for_each_entry_rcu_continue(tpos, pos, (tbl)->buckets[hash],\ 487 rht_for_each_entry_rcu_continue(tpos, pos, (tbl)->buckets[hash],\
365 tbl, hash, member) 488 tbl, hash, member)
366 489
490static inline int rhashtable_compare(struct rhashtable_compare_arg *arg,
491 const void *obj)
492{
493 struct rhashtable *ht = arg->ht;
494 const char *ptr = obj;
495
496 return memcmp(ptr + ht->p.key_offset, arg->key, ht->p.key_len);
497}
498
499/**
500 * rhashtable_lookup_fast - search hash table, inlined version
501 * @ht: hash table
502 * @key: the pointer to the key
503 * @params: hash table parameters
504 *
505 * Computes the hash value for the key and traverses the bucket chain looking
506 * for a entry with an identical key. The first matching entry is returned.
507 *
508 * Returns the first entry on which the compare function returned true.
509 */
510static inline void *rhashtable_lookup_fast(
511 struct rhashtable *ht, const void *key,
512 const struct rhashtable_params params)
513{
514 struct rhashtable_compare_arg arg = {
515 .ht = ht,
516 .key = key,
517 };
518 const struct bucket_table *tbl;
519 struct rhash_head *he;
520 unsigned int hash;
521
522 rcu_read_lock();
523
524 tbl = rht_dereference_rcu(ht->tbl, ht);
525restart:
526 hash = rht_key_hashfn(ht, tbl, key, params);
527 rht_for_each_rcu(he, tbl, hash) {
528 if (params.obj_cmpfn ?
529 params.obj_cmpfn(&arg, rht_obj(ht, he)) :
530 rhashtable_compare(&arg, rht_obj(ht, he)))
531 continue;
532 rcu_read_unlock();
533 return rht_obj(ht, he);
534 }
535
536 /* Ensure we see any new tables. */
537 smp_rmb();
538
539 tbl = rht_dereference_rcu(tbl->future_tbl, ht);
540 if (unlikely(tbl))
541 goto restart;
542 rcu_read_unlock();
543
544 return NULL;
545}
546
547/* Internal function, please use rhashtable_insert_fast() instead */
548static inline int __rhashtable_insert_fast(
549 struct rhashtable *ht, const void *key, struct rhash_head *obj,
550 const struct rhashtable_params params)
551{
552 struct rhashtable_compare_arg arg = {
553 .ht = ht,
554 .key = key,
555 };
556 struct bucket_table *tbl, *new_tbl;
557 struct rhash_head *head;
558 spinlock_t *lock;
559 unsigned int elasticity;
560 unsigned int hash;
561 int err;
562
563restart:
564 rcu_read_lock();
565
566 tbl = rht_dereference_rcu(ht->tbl, ht);
567
568 /* All insertions must grab the oldest table containing
569 * the hashed bucket that is yet to be rehashed.
570 */
571 for (;;) {
572 hash = rht_head_hashfn(ht, tbl, obj, params);
573 lock = rht_bucket_lock(tbl, hash);
574 spin_lock_bh(lock);
575
576 if (tbl->rehash <= hash)
577 break;
578
579 spin_unlock_bh(lock);
580 tbl = rht_dereference_rcu(tbl->future_tbl, ht);
581 }
582
583 new_tbl = rht_dereference_rcu(tbl->future_tbl, ht);
584 if (unlikely(new_tbl)) {
585 err = rhashtable_insert_slow(ht, key, obj, new_tbl);
586 if (err == -EAGAIN)
587 goto slow_path;
588 goto out;
589 }
590
591 if (unlikely(rht_grow_above_100(ht, tbl))) {
592slow_path:
593 spin_unlock_bh(lock);
594 err = rhashtable_insert_rehash(ht);
595 rcu_read_unlock();
596 if (err)
597 return err;
598
599 goto restart;
600 }
601
602 err = -EEXIST;
603 elasticity = ht->elasticity;
604 rht_for_each(head, tbl, hash) {
605 if (key &&
606 unlikely(!(params.obj_cmpfn ?
607 params.obj_cmpfn(&arg, rht_obj(ht, head)) :
608 rhashtable_compare(&arg, rht_obj(ht, head)))))
609 goto out;
610 if (!--elasticity)
611 goto slow_path;
612 }
613
614 err = 0;
615
616 head = rht_dereference_bucket(tbl->buckets[hash], tbl, hash);
617
618 RCU_INIT_POINTER(obj->next, head);
619
620 rcu_assign_pointer(tbl->buckets[hash], obj);
621
622 atomic_inc(&ht->nelems);
623 if (rht_grow_above_75(ht, tbl))
624 schedule_work(&ht->run_work);
625
626out:
627 spin_unlock_bh(lock);
628 rcu_read_unlock();
629
630 return err;
631}
632
633/**
634 * rhashtable_insert_fast - insert object into hash table
635 * @ht: hash table
636 * @obj: pointer to hash head inside object
637 * @params: hash table parameters
638 *
639 * Will take a per bucket spinlock to protect against mutual mutations
640 * on the same bucket. Multiple insertions may occur in parallel unless
641 * they map to the same bucket lock.
642 *
643 * It is safe to call this function from atomic context.
644 *
645 * Will trigger an automatic deferred table resizing if the size grows
646 * beyond the watermark indicated by grow_decision() which can be passed
647 * to rhashtable_init().
648 */
649static inline int rhashtable_insert_fast(
650 struct rhashtable *ht, struct rhash_head *obj,
651 const struct rhashtable_params params)
652{
653 return __rhashtable_insert_fast(ht, NULL, obj, params);
654}
655
656/**
657 * rhashtable_lookup_insert_fast - lookup and insert object into hash table
658 * @ht: hash table
659 * @obj: pointer to hash head inside object
660 * @params: hash table parameters
661 *
662 * Locks down the bucket chain in both the old and new table if a resize
663 * is in progress to ensure that writers can't remove from the old table
664 * and can't insert to the new table during the atomic operation of search
665 * and insertion. Searches for duplicates in both the old and new table if
666 * a resize is in progress.
667 *
668 * This lookup function may only be used for fixed key hash table (key_len
669 * parameter set). It will BUG() if used inappropriately.
670 *
671 * It is safe to call this function from atomic context.
672 *
673 * Will trigger an automatic deferred table resizing if the size grows
674 * beyond the watermark indicated by grow_decision() which can be passed
675 * to rhashtable_init().
676 */
677static inline int rhashtable_lookup_insert_fast(
678 struct rhashtable *ht, struct rhash_head *obj,
679 const struct rhashtable_params params)
680{
681 const char *key = rht_obj(ht, obj);
682
683 BUG_ON(ht->p.obj_hashfn);
684
685 return __rhashtable_insert_fast(ht, key + ht->p.key_offset, obj,
686 params);
687}
688
689/**
690 * rhashtable_lookup_insert_key - search and insert object to hash table
691 * with explicit key
692 * @ht: hash table
693 * @key: key
694 * @obj: pointer to hash head inside object
695 * @params: hash table parameters
696 *
697 * Locks down the bucket chain in both the old and new table if a resize
698 * is in progress to ensure that writers can't remove from the old table
699 * and can't insert to the new table during the atomic operation of search
700 * and insertion. Searches for duplicates in both the old and new table if
701 * a resize is in progress.
702 *
703 * Lookups may occur in parallel with hashtable mutations and resizing.
704 *
705 * Will trigger an automatic deferred table resizing if the size grows
706 * beyond the watermark indicated by grow_decision() which can be passed
707 * to rhashtable_init().
708 *
709 * Returns zero on success.
710 */
711static inline int rhashtable_lookup_insert_key(
712 struct rhashtable *ht, const void *key, struct rhash_head *obj,
713 const struct rhashtable_params params)
714{
715 BUG_ON(!ht->p.obj_hashfn || !key);
716
717 return __rhashtable_insert_fast(ht, key, obj, params);
718}
719
720/* Internal function, please use rhashtable_remove_fast() instead */
721static inline int __rhashtable_remove_fast(
722 struct rhashtable *ht, struct bucket_table *tbl,
723 struct rhash_head *obj, const struct rhashtable_params params)
724{
725 struct rhash_head __rcu **pprev;
726 struct rhash_head *he;
727 spinlock_t * lock;
728 unsigned int hash;
729 int err = -ENOENT;
730
731 hash = rht_head_hashfn(ht, tbl, obj, params);
732 lock = rht_bucket_lock(tbl, hash);
733
734 spin_lock_bh(lock);
735
736 pprev = &tbl->buckets[hash];
737 rht_for_each(he, tbl, hash) {
738 if (he != obj) {
739 pprev = &he->next;
740 continue;
741 }
742
743 rcu_assign_pointer(*pprev, obj->next);
744 err = 0;
745 break;
746 }
747
748 spin_unlock_bh(lock);
749
750 return err;
751}
752
753/**
754 * rhashtable_remove_fast - remove object from hash table
755 * @ht: hash table
756 * @obj: pointer to hash head inside object
757 * @params: hash table parameters
758 *
759 * Since the hash chain is single linked, the removal operation needs to
760 * walk the bucket chain upon removal. The removal operation is thus
761 * considerable slow if the hash table is not correctly sized.
762 *
763 * Will automatically shrink the table via rhashtable_expand() if the
764 * shrink_decision function specified at rhashtable_init() returns true.
765 *
766 * Returns zero on success, -ENOENT if the entry could not be found.
767 */
768static inline int rhashtable_remove_fast(
769 struct rhashtable *ht, struct rhash_head *obj,
770 const struct rhashtable_params params)
771{
772 struct bucket_table *tbl;
773 int err;
774
775 rcu_read_lock();
776
777 tbl = rht_dereference_rcu(ht->tbl, ht);
778
779 /* Because we have already taken (and released) the bucket
780 * lock in old_tbl, if we find that future_tbl is not yet
781 * visible then that guarantees the entry to still be in
782 * the old tbl if it exists.
783 */
784 while ((err = __rhashtable_remove_fast(ht, tbl, obj, params)) &&
785 (tbl = rht_dereference_rcu(tbl->future_tbl, ht)))
786 ;
787
788 if (err)
789 goto out;
790
791 atomic_dec(&ht->nelems);
792 if (unlikely(ht->p.automatic_shrinking &&
793 rht_shrink_below_30(ht, tbl)))
794 schedule_work(&ht->run_work);
795
796out:
797 rcu_read_unlock();
798
799 return err;
800}
801
367#endif /* _LINUX_RHASHTABLE_H */ 802#endif /* _LINUX_RHASHTABLE_H */
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index c4c559a45dc8..c89c53a113a8 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -105,14 +105,6 @@ static inline void put_anon_vma(struct anon_vma *anon_vma)
105 __put_anon_vma(anon_vma); 105 __put_anon_vma(anon_vma);
106} 106}
107 107
108static inline struct anon_vma *page_anon_vma(struct page *page)
109{
110 if (((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) !=
111 PAGE_MAPPING_ANON)
112 return NULL;
113 return page_rmapping(page);
114}
115
116static inline void vma_lock_anon_vma(struct vm_area_struct *vma) 108static inline void vma_lock_anon_vma(struct vm_area_struct *vma)
117{ 109{
118 struct anon_vma *anon_vma = vma->anon_vma; 110 struct anon_vma *anon_vma = vma->anon_vma;
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index dcad7ee0d746..8dcf6825fa88 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -77,6 +77,7 @@ struct rtc_class_ops {
77 int (*read_alarm)(struct device *, struct rtc_wkalrm *); 77 int (*read_alarm)(struct device *, struct rtc_wkalrm *);
78 int (*set_alarm)(struct device *, struct rtc_wkalrm *); 78 int (*set_alarm)(struct device *, struct rtc_wkalrm *);
79 int (*proc)(struct device *, struct seq_file *); 79 int (*proc)(struct device *, struct seq_file *);
80 int (*set_mmss64)(struct device *, time64_t secs);
80 int (*set_mmss)(struct device *, unsigned long secs); 81 int (*set_mmss)(struct device *, unsigned long secs);
81 int (*read_callback)(struct device *, int data); 82 int (*read_callback)(struct device *, int data);
82 int (*alarm_irq_enable)(struct device *, unsigned int enabled); 83 int (*alarm_irq_enable)(struct device *, unsigned int enabled);
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 5db76a32fcab..2da5d1081ad9 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -77,7 +77,20 @@ static inline struct netdev_queue *dev_ingress_queue(struct net_device *dev)
77 return rtnl_dereference(dev->ingress_queue); 77 return rtnl_dereference(dev->ingress_queue);
78} 78}
79 79
80extern struct netdev_queue *dev_ingress_queue_create(struct net_device *dev); 80struct netdev_queue *dev_ingress_queue_create(struct net_device *dev);
81
82#ifdef CONFIG_NET_CLS_ACT
83void net_inc_ingress_queue(void);
84void net_dec_ingress_queue(void);
85#else
86static inline void net_inc_ingress_queue(void)
87{
88}
89
90static inline void net_dec_ingress_queue(void)
91{
92}
93#endif
81 94
82extern void rtnetlink_init(void); 95extern void rtnetlink_init(void);
83extern void __rtnl_unlock(void); 96extern void __rtnl_unlock(void);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 6d77432e14ff..8222ae40ecb0 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -125,7 +125,6 @@ struct sched_attr {
125 u64 sched_period; 125 u64 sched_period;
126}; 126};
127 127
128struct exec_domain;
129struct futex_pi_state; 128struct futex_pi_state;
130struct robust_list_head; 129struct robust_list_head;
131struct bio_list; 130struct bio_list;
@@ -176,6 +175,14 @@ extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load);
176extern void calc_global_load(unsigned long ticks); 175extern void calc_global_load(unsigned long ticks);
177extern void update_cpu_load_nohz(void); 176extern void update_cpu_load_nohz(void);
178 177
178/* Notifier for when a task gets migrated to a new CPU */
179struct task_migration_notifier {
180 struct task_struct *task;
181 int from_cpu;
182 int to_cpu;
183};
184extern void register_task_migration_notifier(struct notifier_block *n);
185
179extern unsigned long get_parent_ip(unsigned long addr); 186extern unsigned long get_parent_ip(unsigned long addr);
180 187
181extern void dump_cpu_task(int cpu); 188extern void dump_cpu_task(int cpu);
@@ -329,6 +336,8 @@ extern asmlinkage void schedule_tail(struct task_struct *prev);
329extern void init_idle(struct task_struct *idle, int cpu); 336extern void init_idle(struct task_struct *idle, int cpu);
330extern void init_idle_bootup_task(struct task_struct *idle); 337extern void init_idle_bootup_task(struct task_struct *idle);
331 338
339extern cpumask_var_t cpu_isolated_map;
340
332extern int runqueue_is_locked(int cpu); 341extern int runqueue_is_locked(int cpu);
333 342
334#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) 343#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
@@ -1115,15 +1124,28 @@ struct load_weight {
1115}; 1124};
1116 1125
1117struct sched_avg { 1126struct sched_avg {
1127 u64 last_runnable_update;
1128 s64 decay_count;
1129 /*
1130 * utilization_avg_contrib describes the amount of time that a
1131 * sched_entity is running on a CPU. It is based on running_avg_sum
1132 * and is scaled in the range [0..SCHED_LOAD_SCALE].
1133 * load_avg_contrib described the amount of time that a sched_entity
1134 * is runnable on a rq. It is based on both runnable_avg_sum and the
1135 * weight of the task.
1136 */
1137 unsigned long load_avg_contrib, utilization_avg_contrib;
1118 /* 1138 /*
1119 * These sums represent an infinite geometric series and so are bound 1139 * These sums represent an infinite geometric series and so are bound
1120 * above by 1024/(1-y). Thus we only need a u32 to store them for all 1140 * above by 1024/(1-y). Thus we only need a u32 to store them for all
1121 * choices of y < 1-2^(-32)*1024. 1141 * choices of y < 1-2^(-32)*1024.
1142 * running_avg_sum reflects the time that the sched_entity is
1143 * effectively running on the CPU.
1144 * runnable_avg_sum represents the amount of time a sched_entity is on
1145 * a runqueue which includes the running time that is monitored by
1146 * running_avg_sum.
1122 */ 1147 */
1123 u32 runnable_avg_sum, runnable_avg_period; 1148 u32 runnable_avg_sum, avg_period, running_avg_sum;
1124 u64 last_runnable_update;
1125 s64 decay_count;
1126 unsigned long load_avg_contrib;
1127}; 1149};
1128 1150
1129#ifdef CONFIG_SCHEDSTATS 1151#ifdef CONFIG_SCHEDSTATS
@@ -1625,11 +1647,11 @@ struct task_struct {
1625 1647
1626 /* 1648 /*
1627 * numa_faults_locality tracks if faults recorded during the last 1649 * numa_faults_locality tracks if faults recorded during the last
1628 * scan window were remote/local. The task scan period is adapted 1650 * scan window were remote/local or failed to migrate. The task scan
1629 * based on the locality of the faults with different weights 1651 * period is adapted based on the locality of the faults with different
1630 * depending on whether they were shared or private faults 1652 * weights depending on whether they were shared or private faults
1631 */ 1653 */
1632 unsigned long numa_faults_locality[2]; 1654 unsigned long numa_faults_locality[3];
1633 1655
1634 unsigned long numa_pages_migrated; 1656 unsigned long numa_pages_migrated;
1635#endif /* CONFIG_NUMA_BALANCING */ 1657#endif /* CONFIG_NUMA_BALANCING */
@@ -1719,6 +1741,7 @@ struct task_struct {
1719#define TNF_NO_GROUP 0x02 1741#define TNF_NO_GROUP 0x02
1720#define TNF_SHARED 0x04 1742#define TNF_SHARED 0x04
1721#define TNF_FAULT_LOCAL 0x08 1743#define TNF_FAULT_LOCAL 0x08
1744#define TNF_MIGRATE_FAIL 0x10
1722 1745
1723#ifdef CONFIG_NUMA_BALANCING 1746#ifdef CONFIG_NUMA_BALANCING
1724extern void task_numa_fault(int last_node, int node, int pages, int flags); 1747extern void task_numa_fault(int last_node, int node, int pages, int flags);
@@ -2287,11 +2310,6 @@ extern void set_curr_task(int cpu, struct task_struct *p);
2287 2310
2288void yield(void); 2311void yield(void);
2289 2312
2290/*
2291 * The default (Linux) execution domain.
2292 */
2293extern struct exec_domain default_exec_domain;
2294
2295union thread_union { 2313union thread_union {
2296 struct thread_info thread_info; 2314 struct thread_info thread_info;
2297 unsigned long stack[THREAD_SIZE/sizeof(long)]; 2315 unsigned long stack[THREAD_SIZE/sizeof(long)];
diff --git a/include/linux/security.h b/include/linux/security.h
index a1b7dbd127ff..18264ea9e314 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1556,7 +1556,7 @@ struct security_operations {
1556 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); 1556 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
1557 int (*inode_permission) (struct inode *inode, int mask); 1557 int (*inode_permission) (struct inode *inode, int mask);
1558 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); 1558 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1559 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); 1559 int (*inode_getattr) (const struct path *path);
1560 int (*inode_setxattr) (struct dentry *dentry, const char *name, 1560 int (*inode_setxattr) (struct dentry *dentry, const char *name,
1561 const void *value, size_t size, int flags); 1561 const void *value, size_t size, int flags);
1562 void (*inode_post_setxattr) (struct dentry *dentry, const char *name, 1562 void (*inode_post_setxattr) (struct dentry *dentry, const char *name,
@@ -1716,7 +1716,6 @@ struct security_operations {
1716 int (*tun_dev_attach_queue) (void *security); 1716 int (*tun_dev_attach_queue) (void *security);
1717 int (*tun_dev_attach) (struct sock *sk, void *security); 1717 int (*tun_dev_attach) (struct sock *sk, void *security);
1718 int (*tun_dev_open) (void *security); 1718 int (*tun_dev_open) (void *security);
1719 void (*skb_owned_by) (struct sk_buff *skb, struct sock *sk);
1720#endif /* CONFIG_SECURITY_NETWORK */ 1719#endif /* CONFIG_SECURITY_NETWORK */
1721 1720
1722#ifdef CONFIG_SECURITY_NETWORK_XFRM 1721#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -1843,7 +1842,7 @@ int security_inode_readlink(struct dentry *dentry);
1843int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); 1842int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1844int security_inode_permission(struct inode *inode, int mask); 1843int security_inode_permission(struct inode *inode, int mask);
1845int security_inode_setattr(struct dentry *dentry, struct iattr *attr); 1844int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1846int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 1845int security_inode_getattr(const struct path *path);
1847int security_inode_setxattr(struct dentry *dentry, const char *name, 1846int security_inode_setxattr(struct dentry *dentry, const char *name,
1848 const void *value, size_t size, int flags); 1847 const void *value, size_t size, int flags);
1849void security_inode_post_setxattr(struct dentry *dentry, const char *name, 1848void security_inode_post_setxattr(struct dentry *dentry, const char *name,
@@ -2259,8 +2258,7 @@ static inline int security_inode_setattr(struct dentry *dentry,
2259 return 0; 2258 return 0;
2260} 2259}
2261 2260
2262static inline int security_inode_getattr(struct vfsmount *mnt, 2261static inline int security_inode_getattr(const struct path *path)
2263 struct dentry *dentry)
2264{ 2262{
2265 return 0; 2263 return 0;
2266} 2264}
@@ -2735,8 +2733,6 @@ int security_tun_dev_attach_queue(void *security);
2735int security_tun_dev_attach(struct sock *sk, void *security); 2733int security_tun_dev_attach(struct sock *sk, void *security);
2736int security_tun_dev_open(void *security); 2734int security_tun_dev_open(void *security);
2737 2735
2738void security_skb_owned_by(struct sk_buff *skb, struct sock *sk);
2739
2740#else /* CONFIG_SECURITY_NETWORK */ 2736#else /* CONFIG_SECURITY_NETWORK */
2741static inline int security_unix_stream_connect(struct sock *sock, 2737static inline int security_unix_stream_connect(struct sock *sock,
2742 struct sock *other, 2738 struct sock *other,
@@ -2928,11 +2924,6 @@ static inline int security_tun_dev_open(void *security)
2928{ 2924{
2929 return 0; 2925 return 0;
2930} 2926}
2931
2932static inline void security_skb_owned_by(struct sk_buff *skb, struct sock *sk)
2933{
2934}
2935
2936#endif /* CONFIG_SECURITY_NETWORK */ 2927#endif /* CONFIG_SECURITY_NETWORK */
2937 2928
2938#ifdef CONFIG_SECURITY_NETWORK_XFRM 2929#ifdef CONFIG_SECURITY_NETWORK_XFRM
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index f5df8f687b4d..5f68d0a391ce 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -108,7 +108,7 @@ static inline unsigned __read_seqcount_begin(const seqcount_t *s)
108 unsigned ret; 108 unsigned ret;
109 109
110repeat: 110repeat:
111 ret = ACCESS_ONCE(s->sequence); 111 ret = READ_ONCE(s->sequence);
112 if (unlikely(ret & 1)) { 112 if (unlikely(ret & 1)) {
113 cpu_relax(); 113 cpu_relax();
114 goto repeat; 114 goto repeat;
@@ -127,7 +127,7 @@ repeat:
127 */ 127 */
128static inline unsigned raw_read_seqcount(const seqcount_t *s) 128static inline unsigned raw_read_seqcount(const seqcount_t *s)
129{ 129{
130 unsigned ret = ACCESS_ONCE(s->sequence); 130 unsigned ret = READ_ONCE(s->sequence);
131 smp_rmb(); 131 smp_rmb();
132 return ret; 132 return ret;
133} 133}
@@ -179,7 +179,7 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s)
179 */ 179 */
180static inline unsigned raw_seqcount_begin(const seqcount_t *s) 180static inline unsigned raw_seqcount_begin(const seqcount_t *s)
181{ 181{
182 unsigned ret = ACCESS_ONCE(s->sequence); 182 unsigned ret = READ_ONCE(s->sequence);
183 smp_rmb(); 183 smp_rmb();
184 return ret & ~1; 184 return ret & ~1;
185} 185}
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index a8efa235b7c1..78097e7a330a 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -60,6 +60,20 @@ enum {
60}; 60};
61 61
62struct uart_8250_dma; 62struct uart_8250_dma;
63struct uart_8250_port;
64
65/**
66 * 8250 core driver operations
67 *
68 * @setup_irq() Setup irq handling. The universal 8250 driver links this
69 * port to the irq chain. Other drivers may @request_irq().
70 * @release_irq() Undo irq handling. The universal 8250 driver unlinks
71 * the port from the irq chain.
72 */
73struct uart_8250_ops {
74 int (*setup_irq)(struct uart_8250_port *);
75 void (*release_irq)(struct uart_8250_port *);
76};
63 77
64/* 78/*
65 * This should be used by drivers which want to register 79 * This should be used by drivers which want to register
@@ -88,6 +102,8 @@ struct uart_8250_port {
88 unsigned char canary; /* non-zero during system sleep 102 unsigned char canary; /* non-zero during system sleep
89 * if no_console_suspend 103 * if no_console_suspend
90 */ 104 */
105 unsigned char probe;
106#define UART_PROBE_RSA (1 << 0)
91 107
92 /* 108 /*
93 * Some bits in registers are cleared on a read, so they must 109 * Some bits in registers are cleared on a read, so they must
@@ -100,6 +116,7 @@ struct uart_8250_port {
100 unsigned char msr_saved_flags; 116 unsigned char msr_saved_flags;
101 117
102 struct uart_8250_dma *dma; 118 struct uart_8250_dma *dma;
119 const struct uart_8250_ops *ops;
103 120
104 /* 8250 specific callbacks */ 121 /* 8250 specific callbacks */
105 int (*dl_read)(struct uart_8250_port *); 122 int (*dl_read)(struct uart_8250_port *);
@@ -118,11 +135,8 @@ void serial8250_resume_port(int line);
118 135
119extern int early_serial_setup(struct uart_port *port); 136extern int early_serial_setup(struct uart_port *port);
120 137
121extern int serial8250_find_port(struct uart_port *p);
122extern int serial8250_find_port_for_earlycon(void);
123extern unsigned int serial8250_early_in(struct uart_port *port, int offset); 138extern unsigned int serial8250_early_in(struct uart_port *port, int offset);
124extern void serial8250_early_out(struct uart_port *port, int offset, int value); 139extern void serial8250_early_out(struct uart_port *port, int offset, int value);
125extern int setup_early_serial8250_console(char *cmdline);
126extern void serial8250_do_set_termios(struct uart_port *port, 140extern void serial8250_do_set_termios(struct uart_port *port,
127 struct ktermios *termios, struct ktermios *old); 141 struct ktermios *termios, struct ktermios *old);
128extern int serial8250_do_startup(struct uart_port *port); 142extern int serial8250_do_startup(struct uart_port *port);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index baf3e1d08416..025dad9dcde4 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -143,13 +143,13 @@ struct uart_port {
143 unsigned char iotype; /* io access style */ 143 unsigned char iotype; /* io access style */
144 unsigned char unused1; 144 unsigned char unused1;
145 145
146#define UPIO_PORT (0) /* 8b I/O port access */ 146#define UPIO_PORT (SERIAL_IO_PORT) /* 8b I/O port access */
147#define UPIO_HUB6 (1) /* Hub6 ISA card */ 147#define UPIO_HUB6 (SERIAL_IO_HUB6) /* Hub6 ISA card */
148#define UPIO_MEM (2) /* 8b MMIO access */ 148#define UPIO_MEM (SERIAL_IO_MEM) /* 8b MMIO access */
149#define UPIO_MEM32 (3) /* 32b little endian */ 149#define UPIO_MEM32 (SERIAL_IO_MEM32) /* 32b little endian */
150#define UPIO_MEM32BE (4) /* 32b big endian */ 150#define UPIO_AU (SERIAL_IO_AU) /* Au1x00 and RT288x type IO */
151#define UPIO_AU (5) /* Au1x00 and RT288x type IO */ 151#define UPIO_TSI (SERIAL_IO_TSI) /* Tsi108/109 type IO */
152#define UPIO_TSI (6) /* Tsi108/109 type IO */ 152#define UPIO_MEM32BE (SERIAL_IO_MEM32BE) /* 32b big endian */
153 153
154 unsigned int read_status_mask; /* driver specific */ 154 unsigned int read_status_mask; /* driver specific */
155 unsigned int ignore_status_mask; /* driver specific */ 155 unsigned int ignore_status_mask; /* driver specific */
@@ -235,7 +235,9 @@ struct uart_port {
235 const struct uart_ops *ops; 235 const struct uart_ops *ops;
236 unsigned int custom_divisor; 236 unsigned int custom_divisor;
237 unsigned int line; /* port index */ 237 unsigned int line; /* port index */
238 unsigned int minor;
238 resource_size_t mapbase; /* for ioremap */ 239 resource_size_t mapbase; /* for ioremap */
240 resource_size_t mapsize;
239 struct device *dev; /* parent device */ 241 struct device *dev; /* parent device */
240 unsigned char hub6; /* this should be in the 8250 driver */ 242 unsigned char hub6; /* this should be in the 8250 driver */
241 unsigned char suspended; 243 unsigned char suspended;
@@ -336,24 +338,29 @@ struct earlycon_device {
336 char options[16]; /* e.g., 115200n8 */ 338 char options[16]; /* e.g., 115200n8 */
337 unsigned int baud; 339 unsigned int baud;
338}; 340};
339int setup_earlycon(char *buf, const char *match,
340 int (*setup)(struct earlycon_device *, const char *));
341 341
342struct earlycon_id {
343 char name[16];
344 int (*setup)(struct earlycon_device *, const char *options);
345} __aligned(32);
346
347extern int setup_earlycon(char *buf);
342extern int of_setup_earlycon(unsigned long addr, 348extern int of_setup_earlycon(unsigned long addr,
343 int (*setup)(struct earlycon_device *, const char *)); 349 int (*setup)(struct earlycon_device *, const char *));
344 350
345#define EARLYCON_DECLARE(name, func) \ 351#define EARLYCON_DECLARE(_name, func) \
346static int __init name ## _setup_earlycon(char *buf) \ 352 static const struct earlycon_id __earlycon_##_name \
347{ \ 353 __used __section(__earlycon_table) \
348 return setup_earlycon(buf, __stringify(name), func); \ 354 = { .name = __stringify(_name), \
349} \ 355 .setup = func }
350early_param("earlycon", name ## _setup_earlycon);
351 356
352#define OF_EARLYCON_DECLARE(name, compat, fn) \ 357#define OF_EARLYCON_DECLARE(name, compat, fn) \
353 _OF_DECLARE(earlycon, name, compat, fn, void *) 358 _OF_DECLARE(earlycon, name, compat, fn, void *)
354 359
355struct uart_port *uart_get_console(struct uart_port *ports, int nr, 360struct uart_port *uart_get_console(struct uart_port *ports, int nr,
356 struct console *c); 361 struct console *c);
362int uart_parse_earlycon(char *p, unsigned char *iotype, unsigned long *addr,
363 char **options);
357void uart_parse_options(char *options, int *baud, int *parity, int *bits, 364void uart_parse_options(char *options, int *baud, int *parity, int *bits,
358 int *flow); 365 int *flow);
359int uart_set_options(struct uart_port *port, struct console *co, int baud, 366int uart_set_options(struct uart_port *port, struct console *co, int baud,
diff --git a/include/linux/serial_mfd.h b/include/linux/serial_mfd.h
deleted file mode 100644
index 2b071e0b034d..000000000000
--- a/include/linux/serial_mfd.h
+++ /dev/null
@@ -1,47 +0,0 @@
1#ifndef _SERIAL_MFD_H_
2#define _SERIAL_MFD_H_
3
4/* HW register offset definition */
5#define UART_FOR 0x08
6#define UART_PS 0x0C
7#define UART_MUL 0x0D
8#define UART_DIV 0x0E
9
10#define HSU_GBL_IEN 0x0
11#define HSU_GBL_IST 0x4
12
13#define HSU_GBL_INT_BIT_PORT0 0x0
14#define HSU_GBL_INT_BIT_PORT1 0x1
15#define HSU_GBL_INT_BIT_PORT2 0x2
16#define HSU_GBL_INT_BIT_IRI 0x3
17#define HSU_GBL_INT_BIT_HDLC 0x4
18#define HSU_GBL_INT_BIT_DMA 0x5
19
20#define HSU_GBL_ISR 0x8
21#define HSU_GBL_DMASR 0x400
22#define HSU_GBL_DMAISR 0x404
23
24#define HSU_PORT_REG_OFFSET 0x80
25#define HSU_PORT0_REG_OFFSET 0x80
26#define HSU_PORT1_REG_OFFSET 0x100
27#define HSU_PORT2_REG_OFFSET 0x180
28#define HSU_PORT_REG_LENGTH 0x80
29
30#define HSU_DMA_CHANS_REG_OFFSET 0x500
31#define HSU_DMA_CHANS_REG_LENGTH 0x40
32
33#define HSU_CH_SR 0x0 /* channel status reg */
34#define HSU_CH_CR 0x4 /* control reg */
35#define HSU_CH_DCR 0x8 /* descriptor control reg */
36#define HSU_CH_BSR 0x10 /* max fifo buffer size reg */
37#define HSU_CH_MOTSR 0x14 /* minimum ocp transfer size */
38#define HSU_CH_D0SAR 0x20 /* desc 0 start addr */
39#define HSU_CH_D0TSR 0x24 /* desc 0 transfer size */
40#define HSU_CH_D1SAR 0x28
41#define HSU_CH_D1TSR 0x2C
42#define HSU_CH_D2SAR 0x30
43#define HSU_CH_D2TSR 0x34
44#define HSU_CH_D3SAR 0x38
45#define HSU_CH_D3TSR 0x3C
46
47#endif
diff --git a/include/linux/shdma-base.h b/include/linux/shdma-base.h
index abdf1f229dc3..dd0ba502ccb3 100644
--- a/include/linux/shdma-base.h
+++ b/include/linux/shdma-base.h
@@ -69,6 +69,7 @@ struct shdma_chan {
69 int id; /* Raw id of this channel */ 69 int id; /* Raw id of this channel */
70 int irq; /* Channel IRQ */ 70 int irq; /* Channel IRQ */
71 int slave_id; /* Client ID for slave DMA */ 71 int slave_id; /* Client ID for slave DMA */
72 int real_slave_id; /* argument passed to filter function */
72 int hw_req; /* DMA request line for slave DMA - same 73 int hw_req; /* DMA request line for slave DMA - same
73 * as MID/RID, used with DT */ 74 * as MID/RID, used with DT */
74 enum shdma_pm_state pm_state; 75 enum shdma_pm_state pm_state;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 30007afe70b3..06793b598f44 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -166,10 +166,16 @@ struct nf_conntrack {
166#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) 166#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
167struct nf_bridge_info { 167struct nf_bridge_info {
168 atomic_t use; 168 atomic_t use;
169 enum {
170 BRNF_PROTO_UNCHANGED,
171 BRNF_PROTO_8021Q,
172 BRNF_PROTO_PPPOE
173 } orig_proto;
174 bool pkt_otherhost;
169 unsigned int mask; 175 unsigned int mask;
170 struct net_device *physindev; 176 struct net_device *physindev;
171 struct net_device *physoutdev; 177 struct net_device *physoutdev;
172 unsigned long data[32 / sizeof(unsigned long)]; 178 char neigh_header[8];
173}; 179};
174#endif 180#endif
175 181
@@ -492,7 +498,6 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
492 * @napi_id: id of the NAPI struct this skb came from 498 * @napi_id: id of the NAPI struct this skb came from
493 * @secmark: security marking 499 * @secmark: security marking
494 * @mark: Generic packet mark 500 * @mark: Generic packet mark
495 * @dropcount: total number of sk_receive_queue overflows
496 * @vlan_proto: vlan encapsulation protocol 501 * @vlan_proto: vlan encapsulation protocol
497 * @vlan_tci: vlan tag control information 502 * @vlan_tci: vlan tag control information
498 * @inner_protocol: Protocol (encapsulation) 503 * @inner_protocol: Protocol (encapsulation)
@@ -641,7 +646,6 @@ struct sk_buff {
641#endif 646#endif
642 union { 647 union {
643 __u32 mark; 648 __u32 mark;
644 __u32 dropcount;
645 __u32 reserved_tailroom; 649 __u32 reserved_tailroom;
646 }; 650 };
647 651
@@ -870,8 +874,7 @@ unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
870void skb_abort_seq_read(struct skb_seq_state *st); 874void skb_abort_seq_read(struct skb_seq_state *st);
871 875
872unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, 876unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
873 unsigned int to, struct ts_config *config, 877 unsigned int to, struct ts_config *config);
874 struct ts_state *state);
875 878
876/* 879/*
877 * Packet hash types specify the type of hash in skb_set_hash. 880 * Packet hash types specify the type of hash in skb_set_hash.
@@ -948,6 +951,13 @@ static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from)
948 to->l4_hash = from->l4_hash; 951 to->l4_hash = from->l4_hash;
949}; 952};
950 953
954static inline void skb_sender_cpu_clear(struct sk_buff *skb)
955{
956#ifdef CONFIG_XPS
957 skb->sender_cpu = 0;
958#endif
959}
960
951#ifdef NET_SKBUFF_DATA_USES_OFFSET 961#ifdef NET_SKBUFF_DATA_USES_OFFSET
952static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) 962static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
953{ 963{
@@ -3006,6 +3016,18 @@ static inline bool __skb_checksum_validate_needed(struct sk_buff *skb,
3006 */ 3016 */
3007#define CHECKSUM_BREAK 76 3017#define CHECKSUM_BREAK 76
3008 3018
3019/* Unset checksum-complete
3020 *
3021 * Unset checksum complete can be done when packet is being modified
3022 * (uncompressed for instance) and checksum-complete value is
3023 * invalidated.
3024 */
3025static inline void skb_checksum_complete_unset(struct sk_buff *skb)
3026{
3027 if (skb->ip_summed == CHECKSUM_COMPLETE)
3028 skb->ip_summed = CHECKSUM_NONE;
3029}
3030
3009/* Validate (init) checksum based on checksum complete. 3031/* Validate (init) checksum based on checksum complete.
3010 * 3032 *
3011 * Return values: 3033 * Return values:
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 76f1feeabd38..ffd24c830151 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -18,7 +18,7 @@
18 18
19/* 19/*
20 * Flags to pass to kmem_cache_create(). 20 * Flags to pass to kmem_cache_create().
21 * The ones marked DEBUG are only valid if CONFIG_SLAB_DEBUG is set. 21 * The ones marked DEBUG are only valid if CONFIG_DEBUG_SLAB is set.
22 */ 22 */
23#define SLAB_DEBUG_FREE 0x00000100UL /* DEBUG: Perform (expensive) checks on free */ 23#define SLAB_DEBUG_FREE 0x00000100UL /* DEBUG: Perform (expensive) checks on free */
24#define SLAB_RED_ZONE 0x00000400UL /* DEBUG: Red zone objs in a cache */ 24#define SLAB_RED_ZONE 0x00000400UL /* DEBUG: Red zone objs in a cache */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index be91db2a7017..c4414074bd88 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -18,7 +18,7 @@ struct call_single_data {
18 struct llist_node llist; 18 struct llist_node llist;
19 smp_call_func_t func; 19 smp_call_func_t func;
20 void *info; 20 void *info;
21 u16 flags; 21 unsigned int flags;
22}; 22};
23 23
24/* total number of cpus in this system (may exceed NR_CPUS) */ 24/* total number of cpus in this system (may exceed NR_CPUS) */
diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h
index 13e929679550..d600afb21926 100644
--- a/include/linux/smpboot.h
+++ b/include/linux/smpboot.h
@@ -47,6 +47,5 @@ struct smp_hotplug_thread {
47 47
48int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread); 48int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread);
49void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread); 49void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread);
50int smpboot_thread_schedule(void);
51 50
52#endif 51#endif
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
index 46cca4c06848..083ac388098e 100644
--- a/include/linux/sock_diag.h
+++ b/include/linux/sock_diag.h
@@ -19,8 +19,8 @@ void sock_diag_unregister(const struct sock_diag_handler *h);
19void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); 19void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
20void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); 20void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
21 21
22int sock_diag_check_cookie(void *sk, __u32 *cookie); 22int sock_diag_check_cookie(struct sock *sk, const __u32 *cookie);
23void sock_diag_save_cookie(void *sk, __u32 *cookie); 23void sock_diag_save_cookie(struct sock *sk, __u32 *cookie);
24 24
25int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr); 25int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr);
26int sock_diag_put_filterinfo(bool may_report_filterinfo, struct sock *sk, 26int sock_diag_put_filterinfo(bool may_report_filterinfo, struct sock *sk,
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 5c19cba34dce..5bf59c8493b7 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -51,6 +51,7 @@ struct msghdr {
51 void *msg_control; /* ancillary data */ 51 void *msg_control; /* ancillary data */
52 __kernel_size_t msg_controllen; /* ancillary data buffer length */ 52 __kernel_size_t msg_controllen; /* ancillary data buffer length */
53 unsigned int msg_flags; /* flags on received message */ 53 unsigned int msg_flags; /* flags on received message */
54 struct kiocb *msg_iocb; /* ptr to iocb for async requests */
54}; 55};
55 56
56struct user_msghdr { 57struct user_msghdr {
@@ -138,6 +139,11 @@ static inline struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr
138 return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg); 139 return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
139} 140}
140 141
142static inline size_t msg_data_left(struct msghdr *msg)
143{
144 return iov_iter_count(&msg->msg_iter);
145}
146
141/* "Socket"-level control message types: */ 147/* "Socket"-level control message types: */
142 148
143#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */ 149#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */
@@ -181,6 +187,7 @@ struct ucred {
181#define AF_WANPIPE 25 /* Wanpipe API Sockets */ 187#define AF_WANPIPE 25 /* Wanpipe API Sockets */
182#define AF_LLC 26 /* Linux LLC */ 188#define AF_LLC 26 /* Linux LLC */
183#define AF_IB 27 /* Native InfiniBand address */ 189#define AF_IB 27 /* Native InfiniBand address */
190#define AF_MPLS 28 /* MPLS */
184#define AF_CAN 29 /* Controller Area Network */ 191#define AF_CAN 29 /* Controller Area Network */
185#define AF_TIPC 30 /* TIPC sockets */ 192#define AF_TIPC 30 /* TIPC sockets */
186#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 193#define AF_BLUETOOTH 31 /* Bluetooth sockets */
@@ -226,6 +233,7 @@ struct ucred {
226#define PF_WANPIPE AF_WANPIPE 233#define PF_WANPIPE AF_WANPIPE
227#define PF_LLC AF_LLC 234#define PF_LLC AF_LLC
228#define PF_IB AF_IB 235#define PF_IB AF_IB
236#define PF_MPLS AF_MPLS
229#define PF_CAN AF_CAN 237#define PF_CAN AF_CAN
230#define PF_TIPC AF_TIPC 238#define PF_TIPC AF_TIPC
231#define PF_BLUETOOTH AF_BLUETOOTH 239#define PF_BLUETOOTH AF_BLUETOOTH
diff --git a/include/linux/spi/at86rf230.h b/include/linux/spi/at86rf230.h
index cd519a11c2c6..b63fe6f5fdc8 100644
--- a/include/linux/spi/at86rf230.h
+++ b/include/linux/spi/at86rf230.h
@@ -22,6 +22,7 @@ struct at86rf230_platform_data {
22 int rstn; 22 int rstn;
23 int slp_tr; 23 int slp_tr;
24 int dig2; 24 int dig2;
25 u8 xtal_trim;
25}; 26};
26 27
27#endif 28#endif
diff --git a/include/linux/spi/cc2520.h b/include/linux/spi/cc2520.h
index 85b8ee67e937..e741e8baad92 100644
--- a/include/linux/spi/cc2520.h
+++ b/include/linux/spi/cc2520.h
@@ -21,6 +21,7 @@ struct cc2520_platform_data {
21 int sfd; 21 int sfd;
22 int reset; 22 int reset;
23 int vreg; 23 int vreg;
24 bool amplified;
24}; 25};
25 26
26#endif 27#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index ed9489d893a4..d673072346f2 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -162,8 +162,6 @@ struct spi_transfer;
162 * @remove: Unbinds this driver from the spi device 162 * @remove: Unbinds this driver from the spi device
163 * @shutdown: Standard shutdown callback used during system state 163 * @shutdown: Standard shutdown callback used during system state
164 * transitions such as powerdown/halt and kexec 164 * transitions such as powerdown/halt and kexec
165 * @suspend: Standard suspend callback used during system state transitions
166 * @resume: Standard resume callback used during system state transitions
167 * @driver: SPI device drivers should initialize the name and owner 165 * @driver: SPI device drivers should initialize the name and owner
168 * field of this structure. 166 * field of this structure.
169 * 167 *
@@ -184,8 +182,6 @@ struct spi_driver {
184 int (*probe)(struct spi_device *spi); 182 int (*probe)(struct spi_device *spi);
185 int (*remove)(struct spi_device *spi); 183 int (*remove)(struct spi_device *spi);
186 void (*shutdown)(struct spi_device *spi); 184 void (*shutdown)(struct spi_device *spi);
187 int (*suspend)(struct spi_device *spi, pm_message_t mesg);
188 int (*resume)(struct spi_device *spi);
189 struct device_driver driver; 185 struct device_driver driver;
190}; 186};
191 187
@@ -294,6 +290,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
294 * transfer_one_message are mutually exclusive; when both 290 * transfer_one_message are mutually exclusive; when both
295 * are set, the generic subsystem does not call your 291 * are set, the generic subsystem does not call your
296 * transfer_one callback. 292 * transfer_one callback.
293 * @handle_err: the subsystem calls the driver to handle an error that occurs
294 * in the generic implementation of transfer_one_message().
297 * @unprepare_message: undo any work done by prepare_message(). 295 * @unprepare_message: undo any work done by prepare_message().
298 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS 296 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
299 * number. Any individual value may be -ENOENT for CS lines that 297 * number. Any individual value may be -ENOENT for CS lines that
@@ -448,6 +446,8 @@ struct spi_master {
448 void (*set_cs)(struct spi_device *spi, bool enable); 446 void (*set_cs)(struct spi_device *spi, bool enable);
449 int (*transfer_one)(struct spi_master *master, struct spi_device *spi, 447 int (*transfer_one)(struct spi_master *master, struct spi_device *spi,
450 struct spi_transfer *transfer); 448 struct spi_transfer *transfer);
449 void (*handle_err)(struct spi_master *master,
450 struct spi_message *message);
451 451
452 /* gpio chip select */ 452 /* gpio chip select */
453 int *cs_gpios; 453 int *cs_gpios;
@@ -649,7 +649,7 @@ struct spi_transfer {
649 * sequence completes. On some systems, many such sequences can execute as 649 * sequence completes. On some systems, many such sequences can execute as
650 * as single programmed DMA transfer. On all systems, these messages are 650 * as single programmed DMA transfer. On all systems, these messages are
651 * queued, and might complete after transactions to other devices. Messages 651 * queued, and might complete after transactions to other devices. Messages
652 * sent to a given spi_device are alway executed in FIFO order. 652 * sent to a given spi_device are always executed in FIFO order.
653 * 653 *
654 * The code that submits an spi_message (and its spi_transfers) 654 * The code that submits an spi_message (and its spi_transfers)
655 * to the lower layers is responsible for managing its memory. 655 * to the lower layers is responsible for managing its memory.
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 9cfd9623fb03..bdeb4567b71e 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -182,7 +182,7 @@ static inline int srcu_read_lock_held(struct srcu_struct *sp)
182 * lockdep_is_held() calls. 182 * lockdep_is_held() calls.
183 */ 183 */
184#define srcu_dereference_check(p, sp, c) \ 184#define srcu_dereference_check(p, sp, c) \
185 __rcu_dereference_check((p), srcu_read_lock_held(sp) || (c), __rcu) 185 __rcu_dereference_check((p), (c) || srcu_read_lock_held(sp), __rcu)
186 186
187/** 187/**
188 * srcu_dereference - fetch SRCU-protected pointer for later dereferencing 188 * srcu_dereference - fetch SRCU-protected pointer for later dereferencing
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 669045ab73f3..0a34489a46b6 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -7,8 +7,6 @@ struct task_struct;
7struct pt_regs; 7struct pt_regs;
8 8
9#ifdef CONFIG_STACKTRACE 9#ifdef CONFIG_STACKTRACE
10struct task_struct;
11
12struct stack_trace { 10struct stack_trace {
13 unsigned int nr_entries, max_entries; 11 unsigned int nr_entries, max_entries;
14 unsigned long *entries; 12 unsigned long *entries;
diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index f4aec0e75c3a..076af437284d 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -19,3 +19,12 @@ enum {
19#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 19#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
20#endif 20#endif
21#endif 21#endif
22
23/**
24 * offsetofend(TYPE, MEMBER)
25 *
26 * @TYPE: The type of the structure
27 * @MEMBER: The member within the structure to get the end offset of
28 */
29#define offsetofend(TYPE, MEMBER) \
30 (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER))
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index cd63851b57f2..7f484a239f53 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -114,6 +114,8 @@ struct plat_stmmacenet_data {
114 int maxmtu; 114 int maxmtu;
115 int multicast_filter_bins; 115 int multicast_filter_bins;
116 int unicast_filter_entries; 116 int unicast_filter_entries;
117 int tx_fifo_size;
118 int rx_fifo_size;
117 void (*fix_mac_speed)(void *priv, unsigned int speed); 119 void (*fix_mac_speed)(void *priv, unsigned int speed);
118 void (*bus_setup)(void __iomem *ioaddr); 120 void (*bus_setup)(void __iomem *ioaddr);
119 void *(*setup)(struct platform_device *pdev); 121 void *(*setup)(struct platform_device *pdev);
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index 657571817260..71f711db4500 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -10,7 +10,7 @@ enum string_size_units {
10 STRING_UNITS_2, /* use binary powers of 2^10 */ 10 STRING_UNITS_2, /* use binary powers of 2^10 */
11}; 11};
12 12
13void string_get_size(u64 size, enum string_size_units units, 13void string_get_size(u64 size, u64 blk_size, enum string_size_units units,
14 char *buf, int len); 14 char *buf, int len);
15 15
16#define UNESCAPE_SPACE 0x01 16#define UNESCAPE_SPACE 0x01
@@ -47,22 +47,22 @@ static inline int string_unescape_any_inplace(char *buf)
47#define ESCAPE_ANY_NP (ESCAPE_ANY | ESCAPE_NP) 47#define ESCAPE_ANY_NP (ESCAPE_ANY | ESCAPE_NP)
48#define ESCAPE_HEX 0x20 48#define ESCAPE_HEX 0x20
49 49
50int string_escape_mem(const char *src, size_t isz, char **dst, size_t osz, 50int string_escape_mem(const char *src, size_t isz, char *dst, size_t osz,
51 unsigned int flags, const char *esc); 51 unsigned int flags, const char *esc);
52 52
53static inline int string_escape_mem_any_np(const char *src, size_t isz, 53static inline int string_escape_mem_any_np(const char *src, size_t isz,
54 char **dst, size_t osz, const char *esc) 54 char *dst, size_t osz, const char *esc)
55{ 55{
56 return string_escape_mem(src, isz, dst, osz, ESCAPE_ANY_NP, esc); 56 return string_escape_mem(src, isz, dst, osz, ESCAPE_ANY_NP, esc);
57} 57}
58 58
59static inline int string_escape_str(const char *src, char **dst, size_t sz, 59static inline int string_escape_str(const char *src, char *dst, size_t sz,
60 unsigned int flags, const char *esc) 60 unsigned int flags, const char *esc)
61{ 61{
62 return string_escape_mem(src, strlen(src), dst, sz, flags, esc); 62 return string_escape_mem(src, strlen(src), dst, sz, flags, esc);
63} 63}
64 64
65static inline int string_escape_str_any_np(const char *src, char **dst, 65static inline int string_escape_str_any_np(const char *src, char *dst,
66 size_t sz, const char *esc) 66 size_t sz, const char *esc)
67{ 67{
68 return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, esc); 68 return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, esc);
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index c57d8ea0716c..59a7889e15db 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -60,17 +60,17 @@ struct rpc_xprt;
60#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) 60#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
61void rpc_register_sysctl(void); 61void rpc_register_sysctl(void);
62void rpc_unregister_sysctl(void); 62void rpc_unregister_sysctl(void);
63int sunrpc_debugfs_init(void); 63void sunrpc_debugfs_init(void);
64void sunrpc_debugfs_exit(void); 64void sunrpc_debugfs_exit(void);
65int rpc_clnt_debugfs_register(struct rpc_clnt *); 65void rpc_clnt_debugfs_register(struct rpc_clnt *);
66void rpc_clnt_debugfs_unregister(struct rpc_clnt *); 66void rpc_clnt_debugfs_unregister(struct rpc_clnt *);
67int rpc_xprt_debugfs_register(struct rpc_xprt *); 67void rpc_xprt_debugfs_register(struct rpc_xprt *);
68void rpc_xprt_debugfs_unregister(struct rpc_xprt *); 68void rpc_xprt_debugfs_unregister(struct rpc_xprt *);
69#else 69#else
70static inline int 70static inline void
71sunrpc_debugfs_init(void) 71sunrpc_debugfs_init(void)
72{ 72{
73 return 0; 73 return;
74} 74}
75 75
76static inline void 76static inline void
@@ -79,10 +79,10 @@ sunrpc_debugfs_exit(void)
79 return; 79 return;
80} 80}
81 81
82static inline int 82static inline void
83rpc_clnt_debugfs_register(struct rpc_clnt *clnt) 83rpc_clnt_debugfs_register(struct rpc_clnt *clnt)
84{ 84{
85 return 0; 85 return;
86} 86}
87 87
88static inline void 88static inline void
@@ -91,10 +91,10 @@ rpc_clnt_debugfs_unregister(struct rpc_clnt *clnt)
91 return; 91 return;
92} 92}
93 93
94static inline int 94static inline void
95rpc_xprt_debugfs_register(struct rpc_xprt *xprt) 95rpc_xprt_debugfs_register(struct rpc_xprt *xprt)
96{ 96{
97 return 0; 97 return;
98} 98}
99 99
100static inline void 100static inline void
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index aadc6a04e1ac..807371357160 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -142,12 +142,18 @@ typedef __be32 rpc_fraghdr;
142 (RPC_REPHDRSIZE + (2 + RPC_MAX_AUTH_SIZE/4)) 142 (RPC_REPHDRSIZE + (2 + RPC_MAX_AUTH_SIZE/4))
143 143
144/* 144/*
145 * RFC1833/RFC3530 rpcbind (v3+) well-known netid's. 145 * Well-known netids. See:
146 *
147 * http://www.iana.org/assignments/rpc-netids/rpc-netids.xhtml
146 */ 148 */
147#define RPCBIND_NETID_UDP "udp" 149#define RPCBIND_NETID_UDP "udp"
148#define RPCBIND_NETID_TCP "tcp" 150#define RPCBIND_NETID_TCP "tcp"
151#define RPCBIND_NETID_RDMA "rdma"
152#define RPCBIND_NETID_SCTP "sctp"
149#define RPCBIND_NETID_UDP6 "udp6" 153#define RPCBIND_NETID_UDP6 "udp6"
150#define RPCBIND_NETID_TCP6 "tcp6" 154#define RPCBIND_NETID_TCP6 "tcp6"
155#define RPCBIND_NETID_RDMA6 "rdma6"
156#define RPCBIND_NETID_SCTP6 "sctp6"
151#define RPCBIND_NETID_LOCAL "local" 157#define RPCBIND_NETID_LOCAL "local"
152 158
153/* 159/*
diff --git a/include/linux/sunrpc/xprtrdma.h b/include/linux/sunrpc/xprtrdma.h
index 64a0a0a97b23..c984c85981ea 100644
--- a/include/linux/sunrpc/xprtrdma.h
+++ b/include/linux/sunrpc/xprtrdma.h
@@ -41,11 +41,6 @@
41#define _LINUX_SUNRPC_XPRTRDMA_H 41#define _LINUX_SUNRPC_XPRTRDMA_H
42 42
43/* 43/*
44 * rpcbind (v3+) RDMA netid.
45 */
46#define RPCBIND_NETID_RDMA "rdma"
47
48/*
49 * Constants. Max RPC/NFS header is big enough to account for 44 * Constants. Max RPC/NFS header is big enough to account for
50 * additional marshaling buffers passed down by Linux client. 45 * additional marshaling buffers passed down by Linux client.
51 * 46 *
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 7067eca501e2..cee108cbe2d5 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -307,7 +307,7 @@ extern void lru_add_drain(void);
307extern void lru_add_drain_cpu(int cpu); 307extern void lru_add_drain_cpu(int cpu);
308extern void lru_add_drain_all(void); 308extern void lru_add_drain_all(void);
309extern void rotate_reclaimable_page(struct page *page); 309extern void rotate_reclaimable_page(struct page *page);
310extern void deactivate_page(struct page *page); 310extern void deactivate_file_page(struct page *page);
311extern void swap_setup(void); 311extern void swap_setup(void);
312 312
313extern void add_page_to_unevictable_list(struct page *page); 313extern void add_page_to_unevictable_list(struct page *page);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index b7361f831226..795d5fea5697 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -212,4 +212,7 @@ static inline void setup_sysctl_set(struct ctl_table_set *p,
212 212
213#endif /* CONFIG_SYSCTL */ 213#endif /* CONFIG_SYSCTL */
214 214
215int sysctl_max_threads(struct ctl_table *table, int write,
216 void __user *buffer, size_t *lenp, loff_t *ppos);
217
215#endif /* _LINUX_SYSCTL_H */ 218#endif /* _LINUX_SYSCTL_H */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index ddad16148bd6..99382c0df17e 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -57,6 +57,21 @@ do { \
57#define sysfs_attr_init(attr) do {} while (0) 57#define sysfs_attr_init(attr) do {} while (0)
58#endif 58#endif
59 59
60/**
61 * struct attribute_group - data structure used to declare an attribute group.
62 * @name: Optional: Attribute group name
63 * If specified, the attribute group will be created in
64 * a new subdirectory with this name.
65 * @is_visible: Optional: Function to return permissions associated with an
66 * attribute of the group. Will be called repeatedly for each
67 * attribute in the group. Only read/write permissions as well as
68 * SYSFS_PREALLOC are accepted. Must return 0 if an attribute is
69 * not visible. The returned value will replace static permissions
70 * defined in struct attribute or struct bin_attribute.
71 * @attrs: Pointer to NULL terminated list of attributes.
72 * @bin_attrs: Pointer to NULL terminated list of binary attributes.
73 * Either attrs or bin_attrs or both must be provided.
74 */
60struct attribute_group { 75struct attribute_group {
61 const char *name; 76 const char *name;
62 umode_t (*is_visible)(struct kobject *, 77 umode_t (*is_visible)(struct kobject *,
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 1a7adb411647..0caa3a2d4106 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -58,6 +58,7 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb)
58struct tcp_fastopen_cookie { 58struct tcp_fastopen_cookie {
59 s8 len; 59 s8 len;
60 u8 val[TCP_FASTOPEN_COOKIE_MAX]; 60 u8 val[TCP_FASTOPEN_COOKIE_MAX];
61 bool exp; /* In RFC6994 experimental option format */
61}; 62};
62 63
63/* This defines a selective acknowledgement block. */ 64/* This defines a selective acknowledgement block. */
@@ -111,7 +112,7 @@ struct tcp_request_sock_ops;
111struct tcp_request_sock { 112struct tcp_request_sock {
112 struct inet_request_sock req; 113 struct inet_request_sock req;
113 const struct tcp_request_sock_ops *af_specific; 114 const struct tcp_request_sock_ops *af_specific;
114 struct sock *listener; /* needed for TFO */ 115 bool tfo_listener;
115 u32 rcv_isn; 116 u32 rcv_isn;
116 u32 snt_isn; 117 u32 snt_isn;
117 u32 snt_synack; /* synack sent time */ 118 u32 snt_synack; /* synack sent time */
@@ -188,6 +189,7 @@ struct tcp_sock {
188 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */ 189 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */
189 syn_data:1, /* SYN includes data */ 190 syn_data:1, /* SYN includes data */
190 syn_fastopen:1, /* SYN includes Fast Open option */ 191 syn_fastopen:1, /* SYN includes Fast Open option */
192 syn_fastopen_exp:1,/* SYN includes Fast Open exp. option */
191 syn_data_acked:1,/* data in SYN is acked by SYN-ACK */ 193 syn_data_acked:1,/* data in SYN is acked by SYN-ACK */
192 is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */ 194 is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */
193 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ 195 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */
@@ -236,7 +238,6 @@ struct tcp_sock {
236 u32 lost_out; /* Lost packets */ 238 u32 lost_out; /* Lost packets */
237 u32 sacked_out; /* SACK'd packets */ 239 u32 sacked_out; /* SACK'd packets */
238 u32 fackets_out; /* FACK'd packets */ 240 u32 fackets_out; /* FACK'd packets */
239 u32 tso_deferred;
240 241
241 /* from STCP, retrans queue hinting */ 242 /* from STCP, retrans queue hinting */
242 struct sk_buff* lost_skb_hint; 243 struct sk_buff* lost_skb_hint;
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index fc52e307efab..5eac316490ea 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -314,6 +314,8 @@ void thermal_zone_of_sensor_unregister(struct device *dev,
314} 314}
315 315
316#endif 316#endif
317
318#if IS_ENABLED(CONFIG_THERMAL)
317struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, 319struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
318 void *, struct thermal_zone_device_ops *, 320 void *, struct thermal_zone_device_ops *,
319 const struct thermal_zone_params *, int, int); 321 const struct thermal_zone_params *, int, int);
@@ -340,8 +342,58 @@ struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
340 struct thermal_cooling_device *, int); 342 struct thermal_cooling_device *, int);
341void thermal_cdev_update(struct thermal_cooling_device *); 343void thermal_cdev_update(struct thermal_cooling_device *);
342void thermal_notify_framework(struct thermal_zone_device *, int); 344void thermal_notify_framework(struct thermal_zone_device *, int);
343 345#else
344#ifdef CONFIG_NET 346static inline struct thermal_zone_device *thermal_zone_device_register(
347 const char *type, int trips, int mask, void *devdata,
348 struct thermal_zone_device_ops *ops,
349 const struct thermal_zone_params *tzp,
350 int passive_delay, int polling_delay)
351{ return ERR_PTR(-ENODEV); }
352static inline void thermal_zone_device_unregister(
353 struct thermal_zone_device *tz)
354{ }
355static inline int thermal_zone_bind_cooling_device(
356 struct thermal_zone_device *tz, int trip,
357 struct thermal_cooling_device *cdev,
358 unsigned long upper, unsigned long lower)
359{ return -ENODEV; }
360static inline int thermal_zone_unbind_cooling_device(
361 struct thermal_zone_device *tz, int trip,
362 struct thermal_cooling_device *cdev)
363{ return -ENODEV; }
364static inline void thermal_zone_device_update(struct thermal_zone_device *tz)
365{ }
366static inline struct thermal_cooling_device *
367thermal_cooling_device_register(char *type, void *devdata,
368 const struct thermal_cooling_device_ops *ops)
369{ return ERR_PTR(-ENODEV); }
370static inline struct thermal_cooling_device *
371thermal_of_cooling_device_register(struct device_node *np,
372 char *type, void *devdata, const struct thermal_cooling_device_ops *ops)
373{ return ERR_PTR(-ENODEV); }
374static inline void thermal_cooling_device_unregister(
375 struct thermal_cooling_device *cdev)
376{ }
377static inline struct thermal_zone_device *thermal_zone_get_zone_by_name(
378 const char *name)
379{ return ERR_PTR(-ENODEV); }
380static inline int thermal_zone_get_temp(
381 struct thermal_zone_device *tz, unsigned long *temp)
382{ return -ENODEV; }
383static inline int get_tz_trend(struct thermal_zone_device *tz, int trip)
384{ return -ENODEV; }
385static inline struct thermal_instance *
386get_thermal_instance(struct thermal_zone_device *tz,
387 struct thermal_cooling_device *cdev, int trip)
388{ return ERR_PTR(-ENODEV); }
389static inline void thermal_cdev_update(struct thermal_cooling_device *cdev)
390{ }
391static inline void thermal_notify_framework(struct thermal_zone_device *tz,
392 int trip)
393{ }
394#endif /* CONFIG_THERMAL */
395
396#if defined(CONFIG_NET) && IS_ENABLED(CONFIG_THERMAL)
345extern int thermal_generate_netlink_event(struct thermal_zone_device *tz, 397extern int thermal_generate_netlink_event(struct thermal_zone_device *tz,
346 enum events event); 398 enum events event);
347#else 399#else
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 9c085dc12ae9..f8492da57ad3 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -1,7 +1,5 @@
1/* linux/include/linux/tick.h 1/*
2 * 2 * Tick related global functions
3 * This file contains the structure definitions for tick related functions
4 *
5 */ 3 */
6#ifndef _LINUX_TICK_H 4#ifndef _LINUX_TICK_H
7#define _LINUX_TICK_H 5#define _LINUX_TICK_H
@@ -9,149 +7,99 @@
9#include <linux/clockchips.h> 7#include <linux/clockchips.h>
10#include <linux/irqflags.h> 8#include <linux/irqflags.h>
11#include <linux/percpu.h> 9#include <linux/percpu.h>
12#include <linux/hrtimer.h>
13#include <linux/context_tracking_state.h> 10#include <linux/context_tracking_state.h>
14#include <linux/cpumask.h> 11#include <linux/cpumask.h>
15#include <linux/sched.h> 12#include <linux/sched.h>
16 13
17#ifdef CONFIG_GENERIC_CLOCKEVENTS 14#ifdef CONFIG_GENERIC_CLOCKEVENTS
18
19enum tick_device_mode {
20 TICKDEV_MODE_PERIODIC,
21 TICKDEV_MODE_ONESHOT,
22};
23
24struct tick_device {
25 struct clock_event_device *evtdev;
26 enum tick_device_mode mode;
27};
28
29enum tick_nohz_mode {
30 NOHZ_MODE_INACTIVE,
31 NOHZ_MODE_LOWRES,
32 NOHZ_MODE_HIGHRES,
33};
34
35/**
36 * struct tick_sched - sched tick emulation and no idle tick control/stats
37 * @sched_timer: hrtimer to schedule the periodic tick in high
38 * resolution mode
39 * @last_tick: Store the last tick expiry time when the tick
40 * timer is modified for nohz sleeps. This is necessary
41 * to resume the tick timer operation in the timeline
42 * when the CPU returns from nohz sleep.
43 * @tick_stopped: Indicator that the idle tick has been stopped
44 * @idle_jiffies: jiffies at the entry to idle for idle time accounting
45 * @idle_calls: Total number of idle calls
46 * @idle_sleeps: Number of idle calls, where the sched tick was stopped
47 * @idle_entrytime: Time when the idle call was entered
48 * @idle_waketime: Time when the idle was interrupted
49 * @idle_exittime: Time when the idle state was left
50 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped
51 * @iowait_sleeptime: Sum of the time slept in idle with sched tick stopped, with IO outstanding
52 * @sleep_length: Duration of the current idle sleep
53 * @do_timer_lst: CPU was the last one doing do_timer before going idle
54 */
55struct tick_sched {
56 struct hrtimer sched_timer;
57 unsigned long check_clocks;
58 enum tick_nohz_mode nohz_mode;
59 ktime_t last_tick;
60 int inidle;
61 int tick_stopped;
62 unsigned long idle_jiffies;
63 unsigned long idle_calls;
64 unsigned long idle_sleeps;
65 int idle_active;
66 ktime_t idle_entrytime;
67 ktime_t idle_waketime;
68 ktime_t idle_exittime;
69 ktime_t idle_sleeptime;
70 ktime_t iowait_sleeptime;
71 ktime_t sleep_length;
72 unsigned long last_jiffies;
73 unsigned long next_jiffies;
74 ktime_t idle_expires;
75 int do_timer_last;
76};
77
78extern void __init tick_init(void); 15extern void __init tick_init(void);
79extern int tick_is_oneshot_available(void);
80extern struct tick_device *tick_get_device(int cpu);
81
82extern void tick_freeze(void); 16extern void tick_freeze(void);
83extern void tick_unfreeze(void); 17extern void tick_unfreeze(void);
18/* Should be core only, but ARM BL switcher requires it */
19extern void tick_suspend_local(void);
20/* Should be core only, but XEN resume magic and ARM BL switcher require it */
21extern void tick_resume_local(void);
22extern void tick_handover_do_timer(void);
23extern void tick_cleanup_dead_cpu(int cpu);
24#else /* CONFIG_GENERIC_CLOCKEVENTS */
25static inline void tick_init(void) { }
26static inline void tick_freeze(void) { }
27static inline void tick_unfreeze(void) { }
28static inline void tick_suspend_local(void) { }
29static inline void tick_resume_local(void) { }
30static inline void tick_handover_do_timer(void) { }
31static inline void tick_cleanup_dead_cpu(int cpu) { }
32#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
84 33
85# ifdef CONFIG_HIGH_RES_TIMERS 34#ifdef CONFIG_TICK_ONESHOT
86extern int tick_init_highres(void);
87extern int tick_program_event(ktime_t expires, int force);
88extern void tick_setup_sched_timer(void);
89# endif
90
91# if defined CONFIG_NO_HZ_COMMON || defined CONFIG_HIGH_RES_TIMERS
92extern void tick_cancel_sched_timer(int cpu);
93# else
94static inline void tick_cancel_sched_timer(int cpu) { }
95# endif
96
97# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
98extern struct tick_device *tick_get_broadcast_device(void);
99extern struct cpumask *tick_get_broadcast_mask(void);
100
101# ifdef CONFIG_TICK_ONESHOT
102extern struct cpumask *tick_get_broadcast_oneshot_mask(void);
103# endif
104
105# endif /* BROADCAST */
106
107# ifdef CONFIG_TICK_ONESHOT
108extern void tick_clock_notify(void);
109extern int tick_check_oneshot_change(int allow_nohz);
110extern struct tick_sched *tick_get_tick_sched(int cpu);
111extern void tick_irq_enter(void); 35extern void tick_irq_enter(void);
112extern int tick_oneshot_mode_active(void);
113# ifndef arch_needs_cpu 36# ifndef arch_needs_cpu
114# define arch_needs_cpu() (0) 37# define arch_needs_cpu() (0)
115# endif 38# endif
116# else 39# else
117static inline void tick_clock_notify(void) { }
118static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
119static inline void tick_irq_enter(void) { } 40static inline void tick_irq_enter(void) { }
120static inline int tick_oneshot_mode_active(void) { return 0; } 41#endif
121# endif
122 42
123#else /* CONFIG_GENERIC_CLOCKEVENTS */ 43#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
124static inline void tick_init(void) { } 44extern void hotplug_cpu__broadcast_tick_pull(int dead_cpu);
125static inline void tick_freeze(void) { } 45#else
126static inline void tick_unfreeze(void) { } 46static inline void hotplug_cpu__broadcast_tick_pull(int dead_cpu) { }
127static inline void tick_cancel_sched_timer(int cpu) { } 47#endif
128static inline void tick_clock_notify(void) { }
129static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
130static inline void tick_irq_enter(void) { }
131static inline int tick_oneshot_mode_active(void) { return 0; }
132#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
133 48
134# ifdef CONFIG_NO_HZ_COMMON 49enum tick_broadcast_mode {
135DECLARE_PER_CPU(struct tick_sched, tick_cpu_sched); 50 TICK_BROADCAST_OFF,
51 TICK_BROADCAST_ON,
52 TICK_BROADCAST_FORCE,
53};
54
55enum tick_broadcast_state {
56 TICK_BROADCAST_EXIT,
57 TICK_BROADCAST_ENTER,
58};
59
60#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
61extern void tick_broadcast_control(enum tick_broadcast_mode mode);
62#else
63static inline void tick_broadcast_control(enum tick_broadcast_mode mode) { }
64#endif /* BROADCAST */
65
66#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
67extern int tick_broadcast_oneshot_control(enum tick_broadcast_state state);
68#else
69static inline int tick_broadcast_oneshot_control(enum tick_broadcast_state state) { return 0; }
70#endif
136 71
137static inline int tick_nohz_tick_stopped(void) 72static inline void tick_broadcast_enable(void)
73{
74 tick_broadcast_control(TICK_BROADCAST_ON);
75}
76static inline void tick_broadcast_disable(void)
77{
78 tick_broadcast_control(TICK_BROADCAST_OFF);
79}
80static inline void tick_broadcast_force(void)
81{
82 tick_broadcast_control(TICK_BROADCAST_FORCE);
83}
84static inline int tick_broadcast_enter(void)
138{ 85{
139 return __this_cpu_read(tick_cpu_sched.tick_stopped); 86 return tick_broadcast_oneshot_control(TICK_BROADCAST_ENTER);
87}
88static inline void tick_broadcast_exit(void)
89{
90 tick_broadcast_oneshot_control(TICK_BROADCAST_EXIT);
140} 91}
141 92
93#ifdef CONFIG_NO_HZ_COMMON
94extern int tick_nohz_tick_stopped(void);
142extern void tick_nohz_idle_enter(void); 95extern void tick_nohz_idle_enter(void);
143extern void tick_nohz_idle_exit(void); 96extern void tick_nohz_idle_exit(void);
144extern void tick_nohz_irq_exit(void); 97extern void tick_nohz_irq_exit(void);
145extern ktime_t tick_nohz_get_sleep_length(void); 98extern ktime_t tick_nohz_get_sleep_length(void);
146extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 99extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
147extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time); 100extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
148 101#else /* !CONFIG_NO_HZ_COMMON */
149# else /* !CONFIG_NO_HZ_COMMON */ 102static inline int tick_nohz_tick_stopped(void) { return 0; }
150static inline int tick_nohz_tick_stopped(void)
151{
152 return 0;
153}
154
155static inline void tick_nohz_idle_enter(void) { } 103static inline void tick_nohz_idle_enter(void) { }
156static inline void tick_nohz_idle_exit(void) { } 104static inline void tick_nohz_idle_exit(void) { }
157 105
@@ -163,7 +111,7 @@ static inline ktime_t tick_nohz_get_sleep_length(void)
163} 111}
164static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } 112static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
165static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; } 113static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
166# endif /* !CONFIG_NO_HZ_COMMON */ 114#endif /* !CONFIG_NO_HZ_COMMON */
167 115
168#ifdef CONFIG_NO_HZ_FULL 116#ifdef CONFIG_NO_HZ_FULL
169extern bool tick_nohz_full_running; 117extern bool tick_nohz_full_running;
diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h
index 05af9a334893..fb86963859c7 100644
--- a/include/linux/timekeeper_internal.h
+++ b/include/linux/timekeeper_internal.h
@@ -16,16 +16,16 @@
16 * @read: Read function of @clock 16 * @read: Read function of @clock
17 * @mask: Bitmask for two's complement subtraction of non 64bit clocks 17 * @mask: Bitmask for two's complement subtraction of non 64bit clocks
18 * @cycle_last: @clock cycle value at last update 18 * @cycle_last: @clock cycle value at last update
19 * @mult: NTP adjusted multiplier for scaled math conversion 19 * @mult: (NTP adjusted) multiplier for scaled math conversion
20 * @shift: Shift value for scaled math conversion 20 * @shift: Shift value for scaled math conversion
21 * @xtime_nsec: Shifted (fractional) nano seconds offset for readout 21 * @xtime_nsec: Shifted (fractional) nano seconds offset for readout
22 * @base_mono: ktime_t (nanoseconds) base time for readout 22 * @base: ktime_t (nanoseconds) base time for readout
23 * 23 *
24 * This struct has size 56 byte on 64 bit. Together with a seqcount it 24 * This struct has size 56 byte on 64 bit. Together with a seqcount it
25 * occupies a single 64byte cache line. 25 * occupies a single 64byte cache line.
26 * 26 *
27 * The struct is separate from struct timekeeper as it is also used 27 * The struct is separate from struct timekeeper as it is also used
28 * for a fast NMI safe accessor to clock monotonic. 28 * for a fast NMI safe accessors.
29 */ 29 */
30struct tk_read_base { 30struct tk_read_base {
31 struct clocksource *clock; 31 struct clocksource *clock;
@@ -35,12 +35,13 @@ struct tk_read_base {
35 u32 mult; 35 u32 mult;
36 u32 shift; 36 u32 shift;
37 u64 xtime_nsec; 37 u64 xtime_nsec;
38 ktime_t base_mono; 38 ktime_t base;
39}; 39};
40 40
41/** 41/**
42 * struct timekeeper - Structure holding internal timekeeping values. 42 * struct timekeeper - Structure holding internal timekeeping values.
43 * @tkr: The readout base structure 43 * @tkr_mono: The readout base structure for CLOCK_MONOTONIC
44 * @tkr_raw: The readout base structure for CLOCK_MONOTONIC_RAW
44 * @xtime_sec: Current CLOCK_REALTIME time in seconds 45 * @xtime_sec: Current CLOCK_REALTIME time in seconds
45 * @ktime_sec: Current CLOCK_MONOTONIC time in seconds 46 * @ktime_sec: Current CLOCK_MONOTONIC time in seconds
46 * @wall_to_monotonic: CLOCK_REALTIME to CLOCK_MONOTONIC offset 47 * @wall_to_monotonic: CLOCK_REALTIME to CLOCK_MONOTONIC offset
@@ -48,7 +49,6 @@ struct tk_read_base {
48 * @offs_boot: Offset clock monotonic -> clock boottime 49 * @offs_boot: Offset clock monotonic -> clock boottime
49 * @offs_tai: Offset clock monotonic -> clock tai 50 * @offs_tai: Offset clock monotonic -> clock tai
50 * @tai_offset: The current UTC to TAI offset in seconds 51 * @tai_offset: The current UTC to TAI offset in seconds
51 * @base_raw: Monotonic raw base time in ktime_t format
52 * @raw_time: Monotonic raw base time in timespec64 format 52 * @raw_time: Monotonic raw base time in timespec64 format
53 * @cycle_interval: Number of clock cycles in one NTP interval 53 * @cycle_interval: Number of clock cycles in one NTP interval
54 * @xtime_interval: Number of clock shifted nano seconds in one NTP 54 * @xtime_interval: Number of clock shifted nano seconds in one NTP
@@ -76,7 +76,8 @@ struct tk_read_base {
76 * used instead. 76 * used instead.
77 */ 77 */
78struct timekeeper { 78struct timekeeper {
79 struct tk_read_base tkr; 79 struct tk_read_base tkr_mono;
80 struct tk_read_base tkr_raw;
80 u64 xtime_sec; 81 u64 xtime_sec;
81 unsigned long ktime_sec; 82 unsigned long ktime_sec;
82 struct timespec64 wall_to_monotonic; 83 struct timespec64 wall_to_monotonic;
@@ -84,7 +85,6 @@ struct timekeeper {
84 ktime_t offs_boot; 85 ktime_t offs_boot;
85 ktime_t offs_tai; 86 ktime_t offs_tai;
86 s32 tai_offset; 87 s32 tai_offset;
87 ktime_t base_raw;
88 struct timespec64 raw_time; 88 struct timespec64 raw_time;
89 89
90 /* The following members are for timekeeping internal use */ 90 /* The following members are for timekeeping internal use */
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 3eaae4754275..99176af216af 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -214,12 +214,18 @@ static inline u64 ktime_get_boot_ns(void)
214 return ktime_to_ns(ktime_get_boottime()); 214 return ktime_to_ns(ktime_get_boottime());
215} 215}
216 216
217static inline u64 ktime_get_tai_ns(void)
218{
219 return ktime_to_ns(ktime_get_clocktai());
220}
221
217static inline u64 ktime_get_raw_ns(void) 222static inline u64 ktime_get_raw_ns(void)
218{ 223{
219 return ktime_to_ns(ktime_get_raw()); 224 return ktime_to_ns(ktime_get_raw());
220} 225}
221 226
222extern u64 ktime_get_mono_fast_ns(void); 227extern u64 ktime_get_mono_fast_ns(void);
228extern u64 ktime_get_raw_fast_ns(void);
223 229
224/* 230/*
225 * Timespec interfaces utilizing the ktime based ones 231 * Timespec interfaces utilizing the ktime based ones
@@ -242,6 +248,9 @@ static inline void timekeeping_clocktai(struct timespec *ts)
242/* 248/*
243 * RTC specific 249 * RTC specific
244 */ 250 */
251extern bool timekeeping_rtc_skipsuspend(void);
252extern bool timekeeping_rtc_skipresume(void);
253
245extern void timekeeping_inject_sleeptime64(struct timespec64 *delta); 254extern void timekeeping_inject_sleeptime64(struct timespec64 *delta);
246 255
247/* 256/*
@@ -253,17 +262,14 @@ extern void getnstime_raw_and_real(struct timespec *ts_raw,
253/* 262/*
254 * Persistent clock related interfaces 263 * Persistent clock related interfaces
255 */ 264 */
256extern bool persistent_clock_exist;
257extern int persistent_clock_is_local; 265extern int persistent_clock_is_local;
258 266
259static inline bool has_persistent_clock(void)
260{
261 return persistent_clock_exist;
262}
263
264extern void read_persistent_clock(struct timespec *ts); 267extern void read_persistent_clock(struct timespec *ts);
268extern void read_persistent_clock64(struct timespec64 *ts);
265extern void read_boot_clock(struct timespec *ts); 269extern void read_boot_clock(struct timespec *ts);
270extern void read_boot_clock64(struct timespec64 *ts);
266extern int update_persistent_clock(struct timespec now); 271extern int update_persistent_clock(struct timespec now);
272extern int update_persistent_clock64(struct timespec64 now);
267 273
268 274
269#endif 275#endif
diff --git a/include/linux/tracefs.h b/include/linux/tracefs.h
new file mode 100644
index 000000000000..5b727a17beee
--- /dev/null
+++ b/include/linux/tracefs.h
@@ -0,0 +1,45 @@
1/*
2 * tracefs.h - a pseudo file system for activating tracing
3 *
4 * Based on debugfs by: 2004 Greg Kroah-Hartman <greg@kroah.com>
5 *
6 * Copyright (C) 2014 Red Hat Inc, author: Steven Rostedt <srostedt@redhat.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 version
10 * 2 as published by the Free Software Foundation.
11 *
12 * tracefs is the file system that is used by the tracing infrastructure.
13 *
14 */
15
16#ifndef _TRACEFS_H_
17#define _TRACEFS_H_
18
19#include <linux/fs.h>
20#include <linux/seq_file.h>
21
22#include <linux/types.h>
23
24struct file_operations;
25
26#ifdef CONFIG_TRACING
27
28struct dentry *tracefs_create_file(const char *name, umode_t mode,
29 struct dentry *parent, void *data,
30 const struct file_operations *fops);
31
32struct dentry *tracefs_create_dir(const char *name, struct dentry *parent);
33
34void tracefs_remove(struct dentry *dentry);
35void tracefs_remove_recursive(struct dentry *dentry);
36
37struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *parent,
38 int (*mkdir)(const char *name),
39 int (*rmdir)(const char *name));
40
41bool tracefs_initialized(void);
42
43#endif /* CONFIG_TRACING */
44
45#endif
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index c72851328ca9..a5f7f3ecafa3 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -36,6 +36,12 @@ struct tracepoint {
36 struct tracepoint_func __rcu *funcs; 36 struct tracepoint_func __rcu *funcs;
37}; 37};
38 38
39struct trace_enum_map {
40 const char *system;
41 const char *enum_string;
42 unsigned long enum_value;
43};
44
39extern int 45extern int
40tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data); 46tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data);
41extern int 47extern int
@@ -87,6 +93,8 @@ extern void syscall_unregfunc(void);
87 93
88#define PARAMS(args...) args 94#define PARAMS(args...) args
89 95
96#define TRACE_DEFINE_ENUM(x)
97
90#endif /* _LINUX_TRACEPOINT_H */ 98#endif /* _LINUX_TRACEPOINT_H */
91 99
92/* 100/*
diff --git a/include/linux/types.h b/include/linux/types.h
index 6747247e3f9f..59698be03490 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -146,12 +146,6 @@ typedef u64 dma_addr_t;
146typedef u32 dma_addr_t; 146typedef u32 dma_addr_t;
147#endif /* dma_addr_t */ 147#endif /* dma_addr_t */
148 148
149#ifdef __CHECKER__
150#else
151#endif
152#ifdef __CHECK_ENDIAN__
153#else
154#endif
155typedef unsigned __bitwise__ gfp_t; 149typedef unsigned __bitwise__ gfp_t;
156typedef unsigned __bitwise__ fmode_t; 150typedef unsigned __bitwise__ fmode_t;
157typedef unsigned __bitwise__ oom_flags_t; 151typedef unsigned __bitwise__ oom_flags_t;
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 247cfdcc4b08..87c094961bd5 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -34,7 +34,7 @@ static inline struct udphdr *inner_udp_hdr(const struct sk_buff *skb)
34 34
35#define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256) 35#define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256)
36 36
37static inline int udp_hashfn(struct net *net, unsigned num, unsigned mask) 37static inline u32 udp_hashfn(const struct net *net, u32 num, u32 mask)
38{ 38{
39 return (num + net_hash_mix(net)) & mask; 39 return (num + net_hash_mix(net)) & mask;
40} 40}
diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h
index 2d1f9b627f91..0ee05da38899 100644
--- a/include/linux/uidgid.h
+++ b/include/linux/uidgid.h
@@ -29,6 +29,7 @@ typedef struct {
29#define KUIDT_INIT(value) (kuid_t){ value } 29#define KUIDT_INIT(value) (kuid_t){ value }
30#define KGIDT_INIT(value) (kgid_t){ value } 30#define KGIDT_INIT(value) (kgid_t){ value }
31 31
32#ifdef CONFIG_MULTIUSER
32static inline uid_t __kuid_val(kuid_t uid) 33static inline uid_t __kuid_val(kuid_t uid)
33{ 34{
34 return uid.val; 35 return uid.val;
@@ -38,6 +39,17 @@ static inline gid_t __kgid_val(kgid_t gid)
38{ 39{
39 return gid.val; 40 return gid.val;
40} 41}
42#else
43static inline uid_t __kuid_val(kuid_t uid)
44{
45 return 0;
46}
47
48static inline gid_t __kgid_val(kgid_t gid)
49{
50 return 0;
51}
52#endif
41 53
42#define GLOBAL_ROOT_UID KUIDT_INIT(0) 54#define GLOBAL_ROOT_UID KUIDT_INIT(0)
43#define GLOBAL_ROOT_GID KGIDT_INIT(0) 55#define GLOBAL_ROOT_GID KGIDT_INIT(0)
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 07a022641996..8b01e1c3c614 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -76,6 +76,7 @@ size_t iov_iter_copy_from_user_atomic(struct page *page,
76 struct iov_iter *i, unsigned long offset, size_t bytes); 76 struct iov_iter *i, unsigned long offset, size_t bytes);
77void iov_iter_advance(struct iov_iter *i, size_t bytes); 77void iov_iter_advance(struct iov_iter *i, size_t bytes);
78int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); 78int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
79int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes);
79size_t iov_iter_single_seg_count(const struct iov_iter *i); 80size_t iov_iter_single_seg_count(const struct iov_iter *i);
80size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, 81size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
81 struct iov_iter *i); 82 struct iov_iter *i);
@@ -98,6 +99,8 @@ ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages,
98 size_t maxsize, size_t *start); 99 size_t maxsize, size_t *start);
99int iov_iter_npages(const struct iov_iter *i, int maxpages); 100int iov_iter_npages(const struct iov_iter *i, int maxpages);
100 101
102const void *dup_iter(struct iov_iter *new, struct iov_iter *old, gfp_t flags);
103
101static inline size_t iov_iter_count(struct iov_iter *i) 104static inline size_t iov_iter_count(struct iov_iter *i)
102{ 105{
103 return i->count; 106 return i->count;
@@ -109,6 +112,14 @@ static inline bool iter_is_iovec(struct iov_iter *i)
109} 112}
110 113
111/* 114/*
115 * Get one of READ or WRITE out of iter->type without any other flags OR'd in
116 * with it.
117 *
118 * The ?: is just for type safety.
119 */
120#define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & RW_MASK)
121
122/*
112 * Cap the iov_iter by given limit; note that the second argument is 123 * Cap the iov_iter by given limit; note that the second argument is
113 * *not* the new size - it's upper limit for such. Passing it a value 124 * *not* the new size - it's upper limit for such. Passing it a value
114 * greater than the amount of data in iov_iter is fine - it'll just do 125 * greater than the amount of data in iov_iter is fine - it'll just do
@@ -137,4 +148,18 @@ static inline void iov_iter_reexpand(struct iov_iter *i, size_t count)
137size_t csum_and_copy_to_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i); 148size_t csum_and_copy_to_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
138size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i); 149size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
139 150
151int import_iovec(int type, const struct iovec __user * uvector,
152 unsigned nr_segs, unsigned fast_segs,
153 struct iovec **iov, struct iov_iter *i);
154
155#ifdef CONFIG_COMPAT
156struct compat_iovec;
157int compat_import_iovec(int type, const struct compat_iovec __user * uvector,
158 unsigned nr_segs, unsigned fast_segs,
159 struct iovec **iov, struct iov_iter *i);
160#endif
161
162int import_single_range(int type, void __user *buf, size_t len,
163 struct iovec *iov, struct iov_iter *i);
164
140#endif 165#endif
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 7ee1b5c3b4cb..447fe29b55b4 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -205,6 +205,32 @@ void usb_put_intf(struct usb_interface *intf);
205#define USB_MAXINTERFACES 32 205#define USB_MAXINTERFACES 32
206#define USB_MAXIADS (USB_MAXINTERFACES/2) 206#define USB_MAXIADS (USB_MAXINTERFACES/2)
207 207
208/*
209 * USB Resume Timer: Every Host controller driver should drive the resume
210 * signalling on the bus for the amount of time defined by this macro.
211 *
212 * That way we will have a 'stable' behavior among all HCDs supported by Linux.
213 *
214 * Note that the USB Specification states we should drive resume for *at least*
215 * 20 ms, but it doesn't give an upper bound. This creates two possible
216 * situations which we want to avoid:
217 *
218 * (a) sometimes an msleep(20) might expire slightly before 20 ms, which causes
219 * us to fail USB Electrical Tests, thus failing Certification
220 *
221 * (b) Some (many) devices actually need more than 20 ms of resume signalling,
222 * and while we can argue that's against the USB Specification, we don't have
223 * control over which devices a certification laboratory will be using for
224 * certification. If CertLab uses a device which was tested against Windows and
225 * that happens to have relaxed resume signalling rules, we might fall into
226 * situations where we fail interoperability and electrical tests.
227 *
228 * In order to avoid both conditions, we're using a 40 ms resume timeout, which
229 * should cope with both LPJ calibration errors and devices not following every
230 * detail of the USB Specification.
231 */
232#define USB_RESUME_TIMEOUT 40 /* ms */
233
208/** 234/**
209 * struct usb_interface_cache - long-term representation of a device interface 235 * struct usb_interface_cache - long-term representation of a device interface
210 * @num_altsetting: number of altsettings defined. 236 * @num_altsetting: number of altsettings defined.
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 535997a6681b..ab94f78c4dd1 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -19,6 +19,7 @@ struct ci_hdrc_platform_data {
19 enum usb_phy_interface phy_mode; 19 enum usb_phy_interface phy_mode;
20 unsigned long flags; 20 unsigned long flags;
21#define CI_HDRC_REGS_SHARED BIT(0) 21#define CI_HDRC_REGS_SHARED BIT(0)
22#define CI_HDRC_SUPPORTS_RUNTIME_PM BIT(2)
22#define CI_HDRC_DISABLE_STREAMING BIT(3) 23#define CI_HDRC_DISABLE_STREAMING BIT(3)
23 /* 24 /*
24 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1, 25 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1,
@@ -27,6 +28,7 @@ struct ci_hdrc_platform_data {
27#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4) 28#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4)
28#define CI_HDRC_IMX28_WRITE_FIX BIT(5) 29#define CI_HDRC_IMX28_WRITE_FIX BIT(5)
29#define CI_HDRC_FORCE_FULLSPEED BIT(6) 30#define CI_HDRC_FORCE_FULLSPEED BIT(6)
31#define CI_HDRC_TURN_VBUS_EARLY_ON BIT(7)
30 enum usb_dr_mode dr_mode; 32 enum usb_dr_mode dr_mode;
31#define CI_HDRC_CONTROLLER_RESET_EVENT 0 33#define CI_HDRC_CONTROLLER_RESET_EVENT 0
32#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 34#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 3d87defcc527..2511469a9904 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -148,6 +148,7 @@ struct usb_os_desc_table {
148 * @disable: (REQUIRED) Indicates the function should be disabled. Reasons 148 * @disable: (REQUIRED) Indicates the function should be disabled. Reasons
149 * include host resetting or reconfiguring the gadget, and disconnection. 149 * include host resetting or reconfiguring the gadget, and disconnection.
150 * @setup: Used for interface-specific control requests. 150 * @setup: Used for interface-specific control requests.
151 * @req_match: Tests if a given class request can be handled by this function.
151 * @suspend: Notifies functions when the host stops sending USB traffic. 152 * @suspend: Notifies functions when the host stops sending USB traffic.
152 * @resume: Notifies functions when the host restarts USB traffic. 153 * @resume: Notifies functions when the host restarts USB traffic.
153 * @get_status: Returns function status as a reply to 154 * @get_status: Returns function status as a reply to
@@ -213,6 +214,8 @@ struct usb_function {
213 void (*disable)(struct usb_function *); 214 void (*disable)(struct usb_function *);
214 int (*setup)(struct usb_function *, 215 int (*setup)(struct usb_function *,
215 const struct usb_ctrlrequest *); 216 const struct usb_ctrlrequest *);
217 bool (*req_match)(struct usb_function *,
218 const struct usb_ctrlrequest *);
216 void (*suspend)(struct usb_function *); 219 void (*suspend)(struct usb_function *);
217 void (*resume)(struct usb_function *); 220 void (*resume)(struct usb_function *);
218 221
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index e2f00fd8cd47..4f3dfb7d0654 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -190,7 +190,7 @@ struct usb_ep {
190 * @ep:the endpoint being configured 190 * @ep:the endpoint being configured
191 * @maxpacket_limit:value of maximum packet size limit 191 * @maxpacket_limit:value of maximum packet size limit
192 * 192 *
193 * This function shoud be used only in UDC drivers to initialize endpoint 193 * This function should be used only in UDC drivers to initialize endpoint
194 * (usually in probe function). 194 * (usually in probe function).
195 */ 195 */
196static inline void usb_ep_set_maxpacket_limit(struct usb_ep *ep, 196static inline void usb_ep_set_maxpacket_limit(struct usb_ep *ep,
@@ -474,6 +474,7 @@ struct usb_dcd_config_params {
474 474
475struct usb_gadget; 475struct usb_gadget;
476struct usb_gadget_driver; 476struct usb_gadget_driver;
477struct usb_udc;
477 478
478/* the rest of the api to the controller hardware: device operations, 479/* the rest of the api to the controller hardware: device operations,
479 * which don't involve endpoints (or i/o). 480 * which don't involve endpoints (or i/o).
@@ -496,6 +497,7 @@ struct usb_gadget_ops {
496/** 497/**
497 * struct usb_gadget - represents a usb slave device 498 * struct usb_gadget - represents a usb slave device
498 * @work: (internal use) Workqueue to be used for sysfs_notify() 499 * @work: (internal use) Workqueue to be used for sysfs_notify()
500 * @udc: struct usb_udc pointer for this gadget
499 * @ops: Function pointers used to access hardware-specific operations. 501 * @ops: Function pointers used to access hardware-specific operations.
500 * @ep0: Endpoint zero, used when reading or writing responses to 502 * @ep0: Endpoint zero, used when reading or writing responses to
501 * driver setup() requests 503 * driver setup() requests
@@ -545,6 +547,7 @@ struct usb_gadget_ops {
545 */ 547 */
546struct usb_gadget { 548struct usb_gadget {
547 struct work_struct work; 549 struct work_struct work;
550 struct usb_udc *udc;
548 /* readonly to gadget driver */ 551 /* readonly to gadget driver */
549 const struct usb_gadget_ops *ops; 552 const struct usb_gadget_ops *ops;
550 struct usb_ep *ep0; 553 struct usb_ep *ep0;
@@ -1029,6 +1032,10 @@ extern void usb_gadget_udc_reset(struct usb_gadget *gadget,
1029extern void usb_gadget_giveback_request(struct usb_ep *ep, 1032extern void usb_gadget_giveback_request(struct usb_ep *ep,
1030 struct usb_request *req); 1033 struct usb_request *req);
1031 1034
1035/*-------------------------------------------------------------------------*/
1036
1037/* utility to update vbus status for udc core, it may be scheduled */
1038extern void usb_udc_vbus_handler(struct usb_gadget *gadget, bool status);
1032 1039
1033/*-------------------------------------------------------------------------*/ 1040/*-------------------------------------------------------------------------*/
1034 1041
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index b0a39243295a..7dbecf9a4656 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -117,8 +117,6 @@ struct msm_otg_platform_data {
117 enum otg_control_type otg_control; 117 enum otg_control_type otg_control;
118 enum msm_usb_phy_type phy_type; 118 enum msm_usb_phy_type phy_type;
119 void (*setup_gpio)(enum usb_otg_state state); 119 void (*setup_gpio)(enum usb_otg_state state);
120 int (*link_clk_reset)(struct clk *link_clk, bool assert);
121 int (*phy_clk_reset)(struct clk *phy_clk);
122}; 120};
123 121
124/** 122/**
@@ -128,7 +126,6 @@ struct msm_otg_platform_data {
128 * @irq: IRQ number assigned for HSUSB controller. 126 * @irq: IRQ number assigned for HSUSB controller.
129 * @clk: clock struct of usb_hs_clk. 127 * @clk: clock struct of usb_hs_clk.
130 * @pclk: clock struct of usb_hs_pclk. 128 * @pclk: clock struct of usb_hs_pclk.
131 * @phy_reset_clk: clock struct of usb_phy_clk.
132 * @core_clk: clock struct of usb_hs_core_clk. 129 * @core_clk: clock struct of usb_hs_core_clk.
133 * @regs: ioremapped register base address. 130 * @regs: ioremapped register base address.
134 * @inputs: OTG state machine inputs(Id, SessValid etc). 131 * @inputs: OTG state machine inputs(Id, SessValid etc).
@@ -148,7 +145,6 @@ struct msm_otg {
148 int irq; 145 int irq;
149 struct clk *clk; 146 struct clk *clk;
150 struct clk *pclk; 147 struct clk *pclk;
151 struct clk *phy_reset_clk;
152 struct clk *core_clk; 148 struct clk *core_clk;
153 void __iomem *regs; 149 void __iomem *regs;
154#define ID 0 150#define ID 0
diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h
index b6ba1bfb86f2..f728f1854829 100644
--- a/include/linux/usb/otg-fsm.h
+++ b/include/linux/usb/otg-fsm.h
@@ -53,6 +53,8 @@ enum otg_fsm_timer {
53 B_SE0_SRP, 53 B_SE0_SRP,
54 B_SRP_FAIL, 54 B_SRP_FAIL,
55 A_WAIT_ENUM, 55 A_WAIT_ENUM,
56 B_DATA_PLS,
57 B_SSEND_SRP,
56 58
57 NUM_OTG_FSM_TIMERS, 59 NUM_OTG_FSM_TIMERS,
58}; 60};
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index 9fd9e481ea98..f06529c14141 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -165,6 +165,8 @@ struct renesas_usbhs_driver_param {
165 */ 165 */
166 u32 has_otg:1; /* for controlling PWEN/EXTLP */ 166 u32 has_otg:1; /* for controlling PWEN/EXTLP */
167 u32 has_sudmac:1; /* for SUDMAC */ 167 u32 has_sudmac:1; /* for SUDMAC */
168 u32 has_usb_dmac:1; /* for USB-DMAC */
169#define USBHS_USB_DMAC_XFER_SIZE 32 /* hardcode the xfer size */
168}; 170};
169 171
170#define USBHS_TYPE_R8A7790 1 172#define USBHS_TYPE_R8A7790 1
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 9bb547c7bce7..704a1ab8240c 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -190,8 +190,7 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
190 * @num_ports: the number of different ports this device will have. 190 * @num_ports: the number of different ports this device will have.
191 * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer 191 * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer
192 * (0 = end-point size) 192 * (0 = end-point size)
193 * @bulk_out_size: minimum number of bytes to allocate for bulk-out buffer 193 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size)
194 * (0 = end-point size)
195 * @calc_num_ports: pointer to a function to determine how many ports this 194 * @calc_num_ports: pointer to a function to determine how many ports this
196 * device has dynamically. It will be called after the probe() 195 * device has dynamically. It will be called after the probe()
197 * callback is called, but before attach() 196 * callback is called, but before attach()
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index d9a4905e01d0..6e0ce8c7b8cb 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -227,9 +227,23 @@ struct skb_data { /* skb->cb is one of these */
227 struct urb *urb; 227 struct urb *urb;
228 struct usbnet *dev; 228 struct usbnet *dev;
229 enum skb_state state; 229 enum skb_state state;
230 size_t length; 230 long length;
231 unsigned long packets;
231}; 232};
232 233
234/* Drivers that set FLAG_MULTI_PACKET must call this in their
235 * tx_fixup method before returning an skb.
236 */
237static inline void
238usbnet_set_skb_tx_stats(struct sk_buff *skb,
239 unsigned long packets, long bytes_delta)
240{
241 struct skb_data *entry = (struct skb_data *) skb->cb;
242
243 entry->packets = packets;
244 entry->length = bytes_delta;
245}
246
233extern int usbnet_open(struct net_device *net); 247extern int usbnet_open(struct net_device *net);
234extern int usbnet_stop(struct net_device *net); 248extern int usbnet_stop(struct net_device *net);
235extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb, 249extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb,
diff --git a/include/linux/util_macros.h b/include/linux/util_macros.h
new file mode 100644
index 000000000000..d5f4fb69dba3
--- /dev/null
+++ b/include/linux/util_macros.h
@@ -0,0 +1,40 @@
1#ifndef _LINUX_HELPER_MACROS_H_
2#define _LINUX_HELPER_MACROS_H_
3
4#define __find_closest(x, a, as, op) \
5({ \
6 typeof(as) __fc_i, __fc_as = (as) - 1; \
7 typeof(x) __fc_x = (x); \
8 typeof(*a) *__fc_a = (a); \
9 for (__fc_i = 0; __fc_i < __fc_as; __fc_i++) { \
10 if (__fc_x op DIV_ROUND_CLOSEST(__fc_a[__fc_i] + \
11 __fc_a[__fc_i + 1], 2)) \
12 break; \
13 } \
14 (__fc_i); \
15})
16
17/**
18 * find_closest - locate the closest element in a sorted array
19 * @x: The reference value.
20 * @a: The array in which to look for the closest element. Must be sorted
21 * in ascending order.
22 * @as: Size of 'a'.
23 *
24 * Returns the index of the element closest to 'x'.
25 */
26#define find_closest(x, a, as) __find_closest(x, a, as, <=)
27
28/**
29 * find_closest_descending - locate the closest element in a sorted array
30 * @x: The reference value.
31 * @a: The array in which to look for the closest element. Must be sorted
32 * in descending order.
33 * @as: Size of 'a'.
34 *
35 * Similar to find_closest() but 'a' is expected to be sorted in descending
36 * order.
37 */
38#define find_closest_descending(x, a, as) __find_closest(x, a, as, >=)
39
40#endif
diff --git a/include/linux/uwb/umc.h b/include/linux/uwb/umc.h
index ba82f03d8287..02112299a1d3 100644
--- a/include/linux/uwb/umc.h
+++ b/include/linux/uwb/umc.h
@@ -87,8 +87,6 @@ struct umc_driver {
87 87
88 int (*probe)(struct umc_dev *); 88 int (*probe)(struct umc_dev *);
89 void (*remove)(struct umc_dev *); 89 void (*remove)(struct umc_dev *);
90 int (*suspend)(struct umc_dev *, pm_message_t state);
91 int (*resume)(struct umc_dev *);
92 int (*pre_reset)(struct umc_dev *); 90 int (*pre_reset)(struct umc_dev *);
93 int (*post_reset)(struct umc_dev *); 91 int (*post_reset)(struct umc_dev *);
94 92
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 2d67b8998fd8..ddb440975382 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -14,6 +14,8 @@
14 14
15#include <linux/iommu.h> 15#include <linux/iommu.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/workqueue.h>
18#include <linux/poll.h>
17#include <uapi/linux/vfio.h> 19#include <uapi/linux/vfio.h>
18 20
19/** 21/**
@@ -78,19 +80,6 @@ extern int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops);
78extern void vfio_unregister_iommu_driver( 80extern void vfio_unregister_iommu_driver(
79 const struct vfio_iommu_driver_ops *ops); 81 const struct vfio_iommu_driver_ops *ops);
80 82
81/**
82 * offsetofend(TYPE, MEMBER)
83 *
84 * @TYPE: The type of the structure
85 * @MEMBER: The member within the structure to get the end offset of
86 *
87 * Simple helper macro for dealing with variable sized structures passed
88 * from user space. This allows us to easily determine if the provided
89 * structure is sized to include various fields.
90 */
91#define offsetofend(TYPE, MEMBER) \
92 (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER))
93
94/* 83/*
95 * External user API 84 * External user API
96 */ 85 */
@@ -123,4 +112,27 @@ static inline long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
123 return -ENOTTY; 112 return -ENOTTY;
124} 113}
125#endif /* CONFIG_EEH */ 114#endif /* CONFIG_EEH */
115
116/*
117 * IRQfd - generic
118 */
119struct virqfd {
120 void *opaque;
121 struct eventfd_ctx *eventfd;
122 int (*handler)(void *, void *);
123 void (*thread)(void *, void *);
124 void *data;
125 struct work_struct inject;
126 wait_queue_t wait;
127 poll_table pt;
128 struct work_struct shutdown;
129 struct virqfd **pvirqfd;
130};
131
132extern int vfio_virqfd_enable(void *opaque,
133 int (*handler)(void *, void *),
134 void (*thread)(void *, void *),
135 void *data, struct virqfd **pvirqfd, int fd);
136extern void vfio_virqfd_disable(struct virqfd **pvirqfd);
137
126#endif /* VFIO_H */ 138#endif /* VFIO_H */
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index c37bd4d06739..8c3b412d84df 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -65,8 +65,13 @@ struct pci_dev;
65 * out of the arbitration process (and can be safe to take 65 * out of the arbitration process (and can be safe to take
66 * interrupts at any time. 66 * interrupts at any time.
67 */ 67 */
68#if defined(CONFIG_VGA_ARB)
68extern void vga_set_legacy_decoding(struct pci_dev *pdev, 69extern void vga_set_legacy_decoding(struct pci_dev *pdev,
69 unsigned int decodes); 70 unsigned int decodes);
71#else
72static inline void vga_set_legacy_decoding(struct pci_dev *pdev,
73 unsigned int decodes) { };
74#endif
70 75
71/** 76/**
72 * vga_get - acquire & locks VGA resources 77 * vga_get - acquire & locks VGA resources
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 28f0e65b9a11..8f4d4bfa6d46 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -108,8 +108,6 @@ struct virtio_device {
108 void *priv; 108 void *priv;
109}; 109};
110 110
111bool virtio_device_is_legacy_only(struct virtio_device_id id);
112
113static inline struct virtio_device *dev_to_virtio(struct device *_dev) 111static inline struct virtio_device *dev_to_virtio(struct device *_dev)
114{ 112{
115 return container_of(_dev, struct virtio_device, dev); 113 return container_of(_dev, struct virtio_device, dev);
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index ca3ed78e5ec7..1e306f727edc 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -298,13 +298,6 @@ static inline __virtio64 cpu_to_virtio64(struct virtio_device *vdev, u64 val)
298 } \ 298 } \
299 } while(0) 299 } while(0)
300 300
301static inline u8 virtio_cread8(struct virtio_device *vdev, unsigned int offset)
302{
303 u8 ret;
304 vdev->config->get(vdev, offset, &ret, sizeof(ret));
305 return ret;
306}
307
308/* Read @count fields, @bytes each. */ 301/* Read @count fields, @bytes each. */
309static inline void __virtio_cread_many(struct virtio_device *vdev, 302static inline void __virtio_cread_many(struct virtio_device *vdev,
310 unsigned int offset, 303 unsigned int offset,
@@ -326,7 +319,6 @@ static inline void __virtio_cread_many(struct virtio_device *vdev,
326 } while (gen != old); 319 } while (gen != old);
327} 320}
328 321
329
330static inline void virtio_cread_bytes(struct virtio_device *vdev, 322static inline void virtio_cread_bytes(struct virtio_device *vdev,
331 unsigned int offset, 323 unsigned int offset,
332 void *buf, size_t len) 324 void *buf, size_t len)
@@ -334,6 +326,13 @@ static inline void virtio_cread_bytes(struct virtio_device *vdev,
334 __virtio_cread_many(vdev, offset, buf, len, 1); 326 __virtio_cread_many(vdev, offset, buf, len, 1);
335} 327}
336 328
329static inline u8 virtio_cread8(struct virtio_device *vdev, unsigned int offset)
330{
331 u8 ret;
332 vdev->config->get(vdev, offset, &ret, sizeof(ret));
333 return ret;
334}
335
337static inline void virtio_cwrite8(struct virtio_device *vdev, 336static inline void virtio_cwrite8(struct virtio_device *vdev,
338 unsigned int offset, u8 val) 337 unsigned int offset, u8 val)
339{ 338{
@@ -374,7 +373,6 @@ static inline u64 virtio_cread64(struct virtio_device *vdev,
374 unsigned int offset) 373 unsigned int offset)
375{ 374{
376 u64 ret; 375 u64 ret;
377 vdev->config->get(vdev, offset, &ret, sizeof(ret));
378 __virtio_cread_many(vdev, offset, &ret, 1, sizeof(ret)); 376 __virtio_cread_many(vdev, offset, &ret, 1, sizeof(ret));
379 return virtio64_to_cpu(vdev, (__force __virtio64)ret); 377 return virtio64_to_cpu(vdev, (__force __virtio64)ret);
380} 378}
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 67e06fe18c03..8e50888a6d59 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -21,19 +21,20 @@
21 * actually quite cheap. 21 * actually quite cheap.
22 */ 22 */
23 23
24#ifdef CONFIG_SMP
25static inline void virtio_mb(bool weak_barriers) 24static inline void virtio_mb(bool weak_barriers)
26{ 25{
26#ifdef CONFIG_SMP
27 if (weak_barriers) 27 if (weak_barriers)
28 smp_mb(); 28 smp_mb();
29 else 29 else
30#endif
30 mb(); 31 mb();
31} 32}
32 33
33static inline void virtio_rmb(bool weak_barriers) 34static inline void virtio_rmb(bool weak_barriers)
34{ 35{
35 if (weak_barriers) 36 if (weak_barriers)
36 smp_rmb(); 37 dma_rmb();
37 else 38 else
38 rmb(); 39 rmb();
39} 40}
@@ -41,26 +42,10 @@ static inline void virtio_rmb(bool weak_barriers)
41static inline void virtio_wmb(bool weak_barriers) 42static inline void virtio_wmb(bool weak_barriers)
42{ 43{
43 if (weak_barriers) 44 if (weak_barriers)
44 smp_wmb(); 45 dma_wmb();
45 else 46 else
46 wmb(); 47 wmb();
47} 48}
48#else
49static inline void virtio_mb(bool weak_barriers)
50{
51 mb();
52}
53
54static inline void virtio_rmb(bool weak_barriers)
55{
56 rmb();
57}
58
59static inline void virtio_wmb(bool weak_barriers)
60{
61 wmb();
62}
63#endif
64 49
65struct virtio_device; 50struct virtio_device;
66struct virtqueue; 51struct virtqueue;
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 7d7acb35603d..0ec598381f97 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -17,6 +17,7 @@ struct vm_area_struct; /* vma defining user mapping in mm_types.h */
17#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */ 17#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */
18#define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */ 18#define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */
19#define VM_NO_GUARD 0x00000040 /* don't add guard page */ 19#define VM_NO_GUARD 0x00000040 /* don't add guard page */
20#define VM_KASAN 0x00000080 /* has allocated kasan shadow memory */
20/* bits [20..32] reserved for arch specific ioremap internals */ 21/* bits [20..32] reserved for arch specific ioremap internals */
21 22
22/* 23/*
diff --git a/include/linux/vme.h b/include/linux/vme.h
index 8cd6f19ca518..79242e9c06b8 100644
--- a/include/linux/vme.h
+++ b/include/linux/vme.h
@@ -137,6 +137,7 @@ ssize_t vme_master_read(struct vme_resource *, void *, size_t, loff_t);
137ssize_t vme_master_write(struct vme_resource *, void *, size_t, loff_t); 137ssize_t vme_master_write(struct vme_resource *, void *, size_t, loff_t);
138unsigned int vme_master_rmw(struct vme_resource *, unsigned int, unsigned int, 138unsigned int vme_master_rmw(struct vme_resource *, unsigned int, unsigned int,
139 unsigned int, loff_t); 139 unsigned int, loff_t);
140int vme_master_mmap(struct vme_resource *resource, struct vm_area_struct *vma);
140void vme_master_free(struct vme_resource *); 141void vme_master_free(struct vme_resource *);
141 142
142struct vme_resource *vme_dma_request(struct vme_dev *, u32); 143struct vme_resource *vme_dma_request(struct vme_dev *, u32);
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 395b70e0eccf..a746bf5216f8 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -137,4 +137,12 @@ extern int watchdog_init_timeout(struct watchdog_device *wdd,
137extern int watchdog_register_device(struct watchdog_device *); 137extern int watchdog_register_device(struct watchdog_device *);
138extern void watchdog_unregister_device(struct watchdog_device *); 138extern void watchdog_unregister_device(struct watchdog_device *);
139 139
140#ifdef CONFIG_HARDLOCKUP_DETECTOR
141void watchdog_nmi_disable_all(void);
142void watchdog_nmi_enable_all(void);
143#else
144static inline void watchdog_nmi_disable_all(void) {}
145static inline void watchdog_nmi_enable_all(void) {}
146#endif
147
140#endif /* ifndef _LINUX_WATCHDOG_H */ 148#endif /* ifndef _LINUX_WATCHDOG_H */
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index a9c723be1acf..95704cd4cfab 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -26,28 +26,6 @@
26 26
27#include <linux/err.h> 27#include <linux/err.h>
28 28
29/* Reference clock values */
30enum {
31 WL12XX_REFCLOCK_19 = 0, /* 19.2 MHz */
32 WL12XX_REFCLOCK_26 = 1, /* 26 MHz */
33 WL12XX_REFCLOCK_38 = 2, /* 38.4 MHz */
34 WL12XX_REFCLOCK_52 = 3, /* 52 MHz */
35 WL12XX_REFCLOCK_38_XTAL = 4, /* 38.4 MHz, XTAL */
36 WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */
37};
38
39/* TCXO clock values */
40enum {
41 WL12XX_TCXOCLOCK_19_2 = 0, /* 19.2MHz */
42 WL12XX_TCXOCLOCK_26 = 1, /* 26 MHz */
43 WL12XX_TCXOCLOCK_38_4 = 2, /* 38.4MHz */
44 WL12XX_TCXOCLOCK_52 = 3, /* 52 MHz */
45 WL12XX_TCXOCLOCK_16_368 = 4, /* 16.368 MHz */
46 WL12XX_TCXOCLOCK_32_736 = 5, /* 32.736 MHz */
47 WL12XX_TCXOCLOCK_16_8 = 6, /* 16.8 MHz */
48 WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */
49};
50
51struct wl1251_platform_data { 29struct wl1251_platform_data {
52 int power_gpio; 30 int power_gpio;
53 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ 31 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
@@ -55,23 +33,8 @@ struct wl1251_platform_data {
55 bool use_eeprom; 33 bool use_eeprom;
56}; 34};
57 35
58struct wl12xx_platform_data {
59 int irq;
60 int board_ref_clock;
61 int board_tcxo_clock;
62 unsigned long platform_quirks;
63 bool pwr_in_suspend;
64};
65
66/* Platform does not support level trigger interrupts */
67#define WL12XX_PLATFORM_QUIRK_EDGE_IRQ BIT(0)
68
69#ifdef CONFIG_WILINK_PLATFORM_DATA 36#ifdef CONFIG_WILINK_PLATFORM_DATA
70 37
71int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
72
73struct wl12xx_platform_data *wl12xx_get_platform_data(void);
74
75int wl1251_set_platform_data(const struct wl1251_platform_data *data); 38int wl1251_set_platform_data(const struct wl1251_platform_data *data);
76 39
77struct wl1251_platform_data *wl1251_get_platform_data(void); 40struct wl1251_platform_data *wl1251_get_platform_data(void);
@@ -79,18 +42,6 @@ struct wl1251_platform_data *wl1251_get_platform_data(void);
79#else 42#else
80 43
81static inline 44static inline
82int wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
83{
84 return -ENOSYS;
85}
86
87static inline
88struct wl12xx_platform_data *wl12xx_get_platform_data(void)
89{
90 return ERR_PTR(-ENODATA);
91}
92
93static inline
94int wl1251_set_platform_data(const struct wl1251_platform_data *data) 45int wl1251_set_platform_data(const struct wl1251_platform_data *data)
95{ 46{
96 return -ENOSYS; 47 return -ENOSYS;
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 74db135f9957..deee212af8e0 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -70,7 +70,8 @@ enum {
70 /* data contains off-queue information when !WORK_STRUCT_PWQ */ 70 /* data contains off-queue information when !WORK_STRUCT_PWQ */
71 WORK_OFFQ_FLAG_BASE = WORK_STRUCT_COLOR_SHIFT, 71 WORK_OFFQ_FLAG_BASE = WORK_STRUCT_COLOR_SHIFT,
72 72
73 WORK_OFFQ_CANCELING = (1 << WORK_OFFQ_FLAG_BASE), 73 __WORK_OFFQ_CANCELING = WORK_OFFQ_FLAG_BASE,
74 WORK_OFFQ_CANCELING = (1 << __WORK_OFFQ_CANCELING),
74 75
75 /* 76 /*
76 * When a work item is off queue, its high bits point to the last 77 * When a work item is off queue, its high bits point to the last
@@ -453,6 +454,7 @@ extern bool workqueue_congested(int cpu, struct workqueue_struct *wq);
453extern unsigned int work_busy(struct work_struct *work); 454extern unsigned int work_busy(struct work_struct *work);
454extern __printf(1, 2) void set_worker_desc(const char *fmt, ...); 455extern __printf(1, 2) void set_worker_desc(const char *fmt, ...);
455extern void print_worker_info(const char *log_lvl, struct task_struct *task); 456extern void print_worker_info(const char *log_lvl, struct task_struct *task);
457extern void show_workqueue_state(void);
456 458
457/** 459/**
458 * queue_work - queue work on a workqueue 460 * queue_work - queue work on a workqueue
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 00048339c23e..b2dd371ec0ca 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -130,6 +130,7 @@ extern int vm_dirty_ratio;
130extern unsigned long vm_dirty_bytes; 130extern unsigned long vm_dirty_bytes;
131extern unsigned int dirty_writeback_interval; 131extern unsigned int dirty_writeback_interval;
132extern unsigned int dirty_expire_interval; 132extern unsigned int dirty_expire_interval;
133extern unsigned int dirtytime_expire_interval;
133extern int vm_highmem_is_dirtyable; 134extern int vm_highmem_is_dirtyable;
134extern int block_dump; 135extern int block_dump;
135extern int laptop_mode; 136extern int laptop_mode;
@@ -146,6 +147,8 @@ extern int dirty_ratio_handler(struct ctl_table *table, int write,
146extern int dirty_bytes_handler(struct ctl_table *table, int write, 147extern int dirty_bytes_handler(struct ctl_table *table, int write,
147 void __user *buffer, size_t *lenp, 148 void __user *buffer, size_t *lenp,
148 loff_t *ppos); 149 loff_t *ppos);
150int dirtytime_interval_handler(struct ctl_table *table, int write,
151 void __user *buffer, size_t *lenp, loff_t *ppos);
149 152
150struct ctl_table; 153struct ctl_table;
151int dirty_writeback_centisecs_handler(struct ctl_table *, int, 154int dirty_writeback_centisecs_handler(struct ctl_table *, int,
diff --git a/include/linux/zsmalloc.h b/include/linux/zsmalloc.h
index 3283c6a55425..1338190b5478 100644
--- a/include/linux/zsmalloc.h
+++ b/include/linux/zsmalloc.h
@@ -47,5 +47,6 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle,
47void zs_unmap_object(struct zs_pool *pool, unsigned long handle); 47void zs_unmap_object(struct zs_pool *pool, unsigned long handle);
48 48
49unsigned long zs_get_total_pages(struct zs_pool *pool); 49unsigned long zs_get_total_pages(struct zs_pool *pool);
50unsigned long zs_compact(struct zs_pool *pool);
50 51
51#endif 52#endif
diff --git a/include/media/adv7604.h b/include/media/adv7604.h
index aa1c4477722d..9ecf353160c1 100644
--- a/include/media/adv7604.h
+++ b/include/media/adv7604.h
@@ -47,16 +47,16 @@ enum adv7604_bus_order {
47}; 47};
48 48
49/* Input Color Space (IO register 0x02, [7:4]) */ 49/* Input Color Space (IO register 0x02, [7:4]) */
50enum adv7604_inp_color_space { 50enum adv76xx_inp_color_space {
51 ADV7604_INP_COLOR_SPACE_LIM_RGB = 0, 51 ADV76XX_INP_COLOR_SPACE_LIM_RGB = 0,
52 ADV7604_INP_COLOR_SPACE_FULL_RGB = 1, 52 ADV76XX_INP_COLOR_SPACE_FULL_RGB = 1,
53 ADV7604_INP_COLOR_SPACE_LIM_YCbCr_601 = 2, 53 ADV76XX_INP_COLOR_SPACE_LIM_YCbCr_601 = 2,
54 ADV7604_INP_COLOR_SPACE_LIM_YCbCr_709 = 3, 54 ADV76XX_INP_COLOR_SPACE_LIM_YCbCr_709 = 3,
55 ADV7604_INP_COLOR_SPACE_XVYCC_601 = 4, 55 ADV76XX_INP_COLOR_SPACE_XVYCC_601 = 4,
56 ADV7604_INP_COLOR_SPACE_XVYCC_709 = 5, 56 ADV76XX_INP_COLOR_SPACE_XVYCC_709 = 5,
57 ADV7604_INP_COLOR_SPACE_FULL_YCbCr_601 = 6, 57 ADV76XX_INP_COLOR_SPACE_FULL_YCbCr_601 = 6,
58 ADV7604_INP_COLOR_SPACE_FULL_YCbCr_709 = 7, 58 ADV76XX_INP_COLOR_SPACE_FULL_YCbCr_709 = 7,
59 ADV7604_INP_COLOR_SPACE_AUTO = 0xf, 59 ADV76XX_INP_COLOR_SPACE_AUTO = 0xf,
60}; 60};
61 61
62/* Select output format (IO register 0x03, [4:2]) */ 62/* Select output format (IO register 0x03, [4:2]) */
@@ -66,38 +66,39 @@ enum adv7604_op_format_mode_sel {
66 ADV7604_OP_FORMAT_MODE2 = 0x08, 66 ADV7604_OP_FORMAT_MODE2 = 0x08,
67}; 67};
68 68
69enum adv7604_drive_strength { 69enum adv76xx_drive_strength {
70 ADV7604_DR_STR_MEDIUM_LOW = 1, 70 ADV76XX_DR_STR_MEDIUM_LOW = 1,
71 ADV7604_DR_STR_MEDIUM_HIGH = 2, 71 ADV76XX_DR_STR_MEDIUM_HIGH = 2,
72 ADV7604_DR_STR_HIGH = 3, 72 ADV76XX_DR_STR_HIGH = 3,
73}; 73};
74 74
75enum adv7604_int1_config { 75/* INT1 Configuration (IO register 0x40, [1:0]) */
76 ADV7604_INT1_CONFIG_OPEN_DRAIN, 76enum adv76xx_int1_config {
77 ADV7604_INT1_CONFIG_ACTIVE_LOW, 77 ADV76XX_INT1_CONFIG_OPEN_DRAIN,
78 ADV7604_INT1_CONFIG_ACTIVE_HIGH, 78 ADV76XX_INT1_CONFIG_ACTIVE_LOW,
79 ADV7604_INT1_CONFIG_DISABLED, 79 ADV76XX_INT1_CONFIG_ACTIVE_HIGH,
80 ADV76XX_INT1_CONFIG_DISABLED,
80}; 81};
81 82
82enum adv7604_page { 83enum adv76xx_page {
83 ADV7604_PAGE_IO, 84 ADV76XX_PAGE_IO,
84 ADV7604_PAGE_AVLINK, 85 ADV7604_PAGE_AVLINK,
85 ADV7604_PAGE_CEC, 86 ADV76XX_PAGE_CEC,
86 ADV7604_PAGE_INFOFRAME, 87 ADV76XX_PAGE_INFOFRAME,
87 ADV7604_PAGE_ESDP, 88 ADV7604_PAGE_ESDP,
88 ADV7604_PAGE_DPP, 89 ADV7604_PAGE_DPP,
89 ADV7604_PAGE_AFE, 90 ADV76XX_PAGE_AFE,
90 ADV7604_PAGE_REP, 91 ADV76XX_PAGE_REP,
91 ADV7604_PAGE_EDID, 92 ADV76XX_PAGE_EDID,
92 ADV7604_PAGE_HDMI, 93 ADV76XX_PAGE_HDMI,
93 ADV7604_PAGE_TEST, 94 ADV76XX_PAGE_TEST,
94 ADV7604_PAGE_CP, 95 ADV76XX_PAGE_CP,
95 ADV7604_PAGE_VDP, 96 ADV7604_PAGE_VDP,
96 ADV7604_PAGE_MAX, 97 ADV76XX_PAGE_MAX,
97}; 98};
98 99
99/* Platform dependent definition */ 100/* Platform dependent definition */
100struct adv7604_platform_data { 101struct adv76xx_platform_data {
101 /* DIS_PWRDNB: 1 if the PWRDNB pin is unused and unconnected */ 102 /* DIS_PWRDNB: 1 if the PWRDNB pin is unused and unconnected */
102 unsigned disable_pwrdnb:1; 103 unsigned disable_pwrdnb:1;
103 104
@@ -116,7 +117,7 @@ struct adv7604_platform_data {
116 enum adv7604_op_format_mode_sel op_format_mode_sel; 117 enum adv7604_op_format_mode_sel op_format_mode_sel;
117 118
118 /* Configuration of the INT1 pin */ 119 /* Configuration of the INT1 pin */
119 enum adv7604_int1_config int1_config; 120 enum adv76xx_int1_config int1_config;
120 121
121 /* IO register 0x02 */ 122 /* IO register 0x02 */
122 unsigned alt_gamma:1; 123 unsigned alt_gamma:1;
@@ -134,9 +135,9 @@ struct adv7604_platform_data {
134 unsigned inv_llc_pol:1; 135 unsigned inv_llc_pol:1;
135 136
136 /* IO register 0x14 */ 137 /* IO register 0x14 */
137 enum adv7604_drive_strength dr_str_data; 138 enum adv76xx_drive_strength dr_str_data;
138 enum adv7604_drive_strength dr_str_clk; 139 enum adv76xx_drive_strength dr_str_clk;
139 enum adv7604_drive_strength dr_str_sync; 140 enum adv76xx_drive_strength dr_str_sync;
140 141
141 /* IO register 0x30 */ 142 /* IO register 0x30 */
142 unsigned output_bus_lsb_to_msb:1; 143 unsigned output_bus_lsb_to_msb:1;
@@ -145,11 +146,11 @@ struct adv7604_platform_data {
145 unsigned hdmi_free_run_mode; 146 unsigned hdmi_free_run_mode;
146 147
147 /* i2c addresses: 0 == use default */ 148 /* i2c addresses: 0 == use default */
148 u8 i2c_addresses[ADV7604_PAGE_MAX]; 149 u8 i2c_addresses[ADV76XX_PAGE_MAX];
149}; 150};
150 151
151enum adv7604_pad { 152enum adv76xx_pad {
152 ADV7604_PAD_HDMI_PORT_A = 0, 153 ADV76XX_PAD_HDMI_PORT_A = 0,
153 ADV7604_PAD_HDMI_PORT_B = 1, 154 ADV7604_PAD_HDMI_PORT_B = 1,
154 ADV7604_PAD_HDMI_PORT_C = 2, 155 ADV7604_PAD_HDMI_PORT_C = 2,
155 ADV7604_PAD_HDMI_PORT_D = 3, 156 ADV7604_PAD_HDMI_PORT_D = 3,
@@ -158,7 +159,7 @@ enum adv7604_pad {
158 /* The source pad is either 1 (ADV7611) or 6 (ADV7604) */ 159 /* The source pad is either 1 (ADV7611) or 6 (ADV7604) */
159 ADV7604_PAD_SOURCE = 6, 160 ADV7604_PAD_SOURCE = 6,
160 ADV7611_PAD_SOURCE = 1, 161 ADV7611_PAD_SOURCE = 1,
161 ADV7604_PAD_MAX = 7, 162 ADV76XX_PAD_MAX = 7,
162}; 163};
163 164
164#define V4L2_CID_ADV_RX_ANALOG_SAMPLING_PHASE (V4L2_CID_DV_CLASS_BASE + 0x1000) 165#define V4L2_CID_ADV_RX_ANALOG_SAMPLING_PHASE (V4L2_CID_DV_CLASS_BASE + 0x1000)
@@ -166,7 +167,7 @@ enum adv7604_pad {
166#define V4L2_CID_ADV_RX_FREE_RUN_COLOR (V4L2_CID_DV_CLASS_BASE + 0x1002) 167#define V4L2_CID_ADV_RX_FREE_RUN_COLOR (V4L2_CID_DV_CLASS_BASE + 0x1002)
167 168
168/* notify events */ 169/* notify events */
169#define ADV7604_HOTPLUG 1 170#define ADV76XX_HOTPLUG 1
170#define ADV7604_FMT_CHANGE 2 171#define ADV76XX_FMT_CHANGE 2
171 172
172#endif 173#endif
diff --git a/include/media/atmel-isi.h b/include/media/atmel-isi.h
index c2e570336269..6008b0985b7b 100644
--- a/include/media/atmel-isi.h
+++ b/include/media/atmel-isi.h
@@ -59,6 +59,10 @@
59#define ISI_CFG1_FRATE_DIV_MASK (7 << 8) 59#define ISI_CFG1_FRATE_DIV_MASK (7 << 8)
60#define ISI_CFG1_DISCR (1 << 11) 60#define ISI_CFG1_DISCR (1 << 11)
61#define ISI_CFG1_FULL_MODE (1 << 12) 61#define ISI_CFG1_FULL_MODE (1 << 12)
62/* Definition for THMASK(ISI_V2) */
63#define ISI_CFG1_THMASK_BEATS_4 (0 << 13)
64#define ISI_CFG1_THMASK_BEATS_8 (1 << 13)
65#define ISI_CFG1_THMASK_BEATS_16 (2 << 13)
62 66
63/* Bitfields in CFG2 */ 67/* Bitfields in CFG2 */
64#define ISI_CFG2_GRAYSCALE (1 << 13) 68#define ISI_CFG2_GRAYSCALE (1 << 13)
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h
index 288772e6900a..28bcd71cdd26 100644
--- a/include/media/davinci/vpfe_capture.h
+++ b/include/media/davinci/vpfe_capture.h
@@ -102,7 +102,7 @@ struct vpfe_config {
102struct vpfe_device { 102struct vpfe_device {
103 /* V4l2 specific parameters */ 103 /* V4l2 specific parameters */
104 /* Identifies video device for this channel */ 104 /* Identifies video device for this channel */
105 struct video_device *video_dev; 105 struct video_device video_dev;
106 /* sub devices */ 106 /* sub devices */
107 struct v4l2_subdev **sd; 107 struct v4l2_subdev **sd;
108 /* vpfe cfg */ 108 /* vpfe cfg */
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index e00459185d20..0c003d817493 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -44,6 +44,15 @@ struct media_pad {
44 unsigned long flags; /* Pad flags (MEDIA_PAD_FL_*) */ 44 unsigned long flags; /* Pad flags (MEDIA_PAD_FL_*) */
45}; 45};
46 46
47/**
48 * struct media_entity_operations - Media entity operations
49 * @link_setup: Notify the entity of link changes. The operation can
50 * return an error, in which case link setup will be
51 * cancelled. Optional.
52 * @link_validate: Return whether a link is valid from the entity point of
53 * view. The media_entity_pipeline_start() function
54 * validates all links by calling this operation. Optional.
55 */
47struct media_entity_operations { 56struct media_entity_operations {
48 int (*link_setup)(struct media_entity *entity, 57 int (*link_setup)(struct media_entity *entity,
49 const struct media_pad *local, 58 const struct media_pad *local,
@@ -87,17 +96,7 @@ struct media_entity {
87 struct { 96 struct {
88 u32 major; 97 u32 major;
89 u32 minor; 98 u32 minor;
90 } v4l; 99 } dev;
91 struct {
92 u32 major;
93 u32 minor;
94 } fb;
95 struct {
96 u32 card;
97 u32 device;
98 u32 subdevice;
99 } alsa;
100 int dvb;
101 100
102 /* Sub-device specifications */ 101 /* Sub-device specifications */
103 /* Nothing needed yet */ 102 /* Nothing needed yet */
diff --git a/include/media/mt9p031.h b/include/media/mt9p031.h
index b1e63f2b72bd..1ba361205af1 100644
--- a/include/media/mt9p031.h
+++ b/include/media/mt9p031.h
@@ -5,12 +5,10 @@ struct v4l2_subdev;
5 5
6/* 6/*
7 * struct mt9p031_platform_data - MT9P031 platform data 7 * struct mt9p031_platform_data - MT9P031 platform data
8 * @reset: Chip reset GPIO (set to -1 if not used)
9 * @ext_freq: Input clock frequency 8 * @ext_freq: Input clock frequency
10 * @target_freq: Pixel clock frequency 9 * @target_freq: Pixel clock frequency
11 */ 10 */
12struct mt9p031_platform_data { 11struct mt9p031_platform_data {
13 int reset;
14 int ext_freq; 12 int ext_freq;
15 int target_freq; 13 int target_freq;
16}; 14};
diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h
index 398279dd1922..048f8f9117ef 100644
--- a/include/media/omap3isp.h
+++ b/include/media/omap3isp.h
@@ -45,7 +45,7 @@ enum {
45}; 45};
46 46
47/** 47/**
48 * struct isp_parallel_platform_data - Parallel interface platform data 48 * struct isp_parallel_cfg - Parallel interface configuration
49 * @data_lane_shift: Data lane shifter 49 * @data_lane_shift: Data lane shifter
50 * ISP_LANE_SHIFT_0 - CAMEXT[13:0] -> CAM[13:0] 50 * ISP_LANE_SHIFT_0 - CAMEXT[13:0] -> CAM[13:0]
51 * ISP_LANE_SHIFT_2 - CAMEXT[13:2] -> CAM[11:0] 51 * ISP_LANE_SHIFT_2 - CAMEXT[13:2] -> CAM[11:0]
@@ -62,7 +62,7 @@ enum {
62 * @data_pol: Data polarity 62 * @data_pol: Data polarity
63 * 0 - Normal, 1 - One's complement 63 * 0 - Normal, 1 - One's complement
64 */ 64 */
65struct isp_parallel_platform_data { 65struct isp_parallel_cfg {
66 unsigned int data_lane_shift:2; 66 unsigned int data_lane_shift:2;
67 unsigned int clk_pol:1; 67 unsigned int clk_pol:1;
68 unsigned int hs_pol:1; 68 unsigned int hs_pol:1;
@@ -105,7 +105,7 @@ struct isp_csiphy_lanes_cfg {
105}; 105};
106 106
107/** 107/**
108 * struct isp_ccp2_platform_data - CCP2 interface platform data 108 * struct isp_ccp2_cfg - CCP2 interface configuration
109 * @strobe_clk_pol: Strobe/clock polarity 109 * @strobe_clk_pol: Strobe/clock polarity
110 * 0 - Non Inverted, 1 - Inverted 110 * 0 - Non Inverted, 1 - Inverted
111 * @crc: Enable the cyclic redundancy check 111 * @crc: Enable the cyclic redundancy check
@@ -117,7 +117,7 @@ struct isp_csiphy_lanes_cfg {
117 * ISP_CCP2_PHY_DATA_STROBE - Data/strobe physical layer 117 * ISP_CCP2_PHY_DATA_STROBE - Data/strobe physical layer
118 * @vpclk_div: Video port output clock control 118 * @vpclk_div: Video port output clock control
119 */ 119 */
120struct isp_ccp2_platform_data { 120struct isp_ccp2_cfg {
121 unsigned int strobe_clk_pol:1; 121 unsigned int strobe_clk_pol:1;
122 unsigned int crc:1; 122 unsigned int crc:1;
123 unsigned int ccp2_mode:1; 123 unsigned int ccp2_mode:1;
@@ -127,39 +127,31 @@ struct isp_ccp2_platform_data {
127}; 127};
128 128
129/** 129/**
130 * struct isp_csi2_platform_data - CSI2 interface platform data 130 * struct isp_csi2_cfg - CSI2 interface configuration
131 * @crc: Enable the cyclic redundancy check 131 * @crc: Enable the cyclic redundancy check
132 * @vpclk_div: Video port output clock control
133 */ 132 */
134struct isp_csi2_platform_data { 133struct isp_csi2_cfg {
135 unsigned crc:1; 134 unsigned crc:1;
136 unsigned vpclk_div:2;
137 struct isp_csiphy_lanes_cfg lanecfg; 135 struct isp_csiphy_lanes_cfg lanecfg;
138}; 136};
139 137
140struct isp_subdev_i2c_board_info { 138struct isp_bus_cfg {
141 struct i2c_board_info *board_info;
142 int i2c_adapter_id;
143};
144
145struct isp_v4l2_subdevs_group {
146 struct isp_subdev_i2c_board_info *subdevs;
147 enum isp_interface_type interface; 139 enum isp_interface_type interface;
148 union { 140 union {
149 struct isp_parallel_platform_data parallel; 141 struct isp_parallel_cfg parallel;
150 struct isp_ccp2_platform_data ccp2; 142 struct isp_ccp2_cfg ccp2;
151 struct isp_csi2_platform_data csi2; 143 struct isp_csi2_cfg csi2;
152 } bus; /* gcc < 4.6.0 chokes on anonymous union initializers */ 144 } bus; /* gcc < 4.6.0 chokes on anonymous union initializers */
153}; 145};
154 146
155struct isp_platform_xclk { 147struct isp_platform_subdev {
156 const char *dev_id; 148 struct i2c_board_info *board_info;
157 const char *con_id; 149 int i2c_adapter_id;
150 struct isp_bus_cfg *bus;
158}; 151};
159 152
160struct isp_platform_data { 153struct isp_platform_data {
161 struct isp_platform_xclk xclks[2]; 154 struct isp_platform_subdev *subdevs;
162 struct isp_v4l2_subdevs_group *subdevs;
163 void (*set_constraints)(struct isp_device *isp, bool enable); 155 void (*set_constraints)(struct isp_device *isp, bool enable);
164}; 156};
165 157
diff --git a/include/media/ov2659.h b/include/media/ov2659.h
new file mode 100644
index 000000000000..4216adc1ede2
--- /dev/null
+++ b/include/media/ov2659.h
@@ -0,0 +1,34 @@
1/*
2 * Omnivision OV2659 CMOS Image Sensor driver
3 *
4 * Copyright (C) 2015 Texas Instruments, Inc.
5 *
6 * Benoit Parrot <bparrot@ti.com>
7 * Lad, Prabhakar <prabhakar.csengg@gmail.com>
8 *
9 * This program is free software; you may redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
17 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
18 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22
23#ifndef OV2659_H
24#define OV2659_H
25
26/**
27 * struct ov2659_platform_data - ov2659 driver platform data
28 * @link_frequency: target pixel clock frequency
29 */
30struct ov2659_platform_data {
31 s64 link_frequency;
32};
33
34#endif /* OV2659_H */
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index 944ecdf3530f..92766f77a5de 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -178,8 +178,8 @@ struct saa7146_use_ops {
178}; 178};
179 179
180/* from saa7146_fops.c */ 180/* from saa7146_fops.c */
181int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, char *name, int type); 181int saa7146_register_device(struct video_device *vid, struct saa7146_dev *dev, char *name, int type);
182int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev); 182int saa7146_unregister_device(struct video_device *vid, struct saa7146_dev *dev);
183void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, int state); 183void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, int state);
184void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi); 184void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi);
185int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf); 185int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf);
diff --git a/include/media/v4l2-clk.h b/include/media/v4l2-clk.h
index 0b36cc138304..3ef6e3d5ed6c 100644
--- a/include/media/v4l2-clk.h
+++ b/include/media/v4l2-clk.h
@@ -22,14 +22,15 @@
22struct module; 22struct module;
23struct device; 23struct device;
24 24
25struct clk;
25struct v4l2_clk { 26struct v4l2_clk {
26 struct list_head list; 27 struct list_head list;
27 const struct v4l2_clk_ops *ops; 28 const struct v4l2_clk_ops *ops;
28 const char *dev_id; 29 const char *dev_id;
29 const char *id;
30 int enable; 30 int enable;
31 struct mutex lock; /* Protect the enable count */ 31 struct mutex lock; /* Protect the enable count */
32 atomic_t use_count; 32 atomic_t use_count;
33 struct clk *clk;
33 void *priv; 34 void *priv;
34}; 35};
35 36
@@ -43,7 +44,7 @@ struct v4l2_clk_ops {
43 44
44struct v4l2_clk *v4l2_clk_register(const struct v4l2_clk_ops *ops, 45struct v4l2_clk *v4l2_clk_register(const struct v4l2_clk_ops *ops,
45 const char *dev_name, 46 const char *dev_name,
46 const char *name, void *priv); 47 void *priv);
47void v4l2_clk_unregister(struct v4l2_clk *clk); 48void v4l2_clk_unregister(struct v4l2_clk *clk);
48struct v4l2_clk *v4l2_clk_get(struct device *dev, const char *id); 49struct v4l2_clk *v4l2_clk_get(struct device *dev, const char *id);
49void v4l2_clk_put(struct v4l2_clk *clk); 50void v4l2_clk_put(struct v4l2_clk *clk);
@@ -55,14 +56,13 @@ int v4l2_clk_set_rate(struct v4l2_clk *clk, unsigned long rate);
55struct module; 56struct module;
56 57
57struct v4l2_clk *__v4l2_clk_register_fixed(const char *dev_id, 58struct v4l2_clk *__v4l2_clk_register_fixed(const char *dev_id,
58 const char *id, unsigned long rate, struct module *owner); 59 unsigned long rate, struct module *owner);
59void v4l2_clk_unregister_fixed(struct v4l2_clk *clk); 60void v4l2_clk_unregister_fixed(struct v4l2_clk *clk);
60 61
61static inline struct v4l2_clk *v4l2_clk_register_fixed(const char *dev_id, 62static inline struct v4l2_clk *v4l2_clk_register_fixed(const char *dev_id,
62 const char *id,
63 unsigned long rate) 63 unsigned long rate)
64{ 64{
65 return __v4l2_clk_register_fixed(dev_id, id, rate, THIS_MODULE); 65 return __v4l2_clk_register_fixed(dev_id, rate, THIS_MODULE);
66} 66}
67 67
68#define v4l2_clk_name_i2c(name, size, adap, client) snprintf(name, size, \ 68#define v4l2_clk_name_i2c(name, size, adap, client) snprintf(name, size, \
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 3e4fddfc840c..acbcd2f5fe7f 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -65,7 +65,6 @@ struct v4l2_file_operations {
65 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); 65 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
66 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); 66 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
67 unsigned int (*poll) (struct file *, struct poll_table_struct *); 67 unsigned int (*poll) (struct file *, struct poll_table_struct *);
68 long (*ioctl) (struct file *, unsigned int, unsigned long);
69 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 68 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
70#ifdef CONFIG_COMPAT 69#ifdef CONFIG_COMPAT
71 long (*compat_ioctl32) (struct file *, unsigned int, unsigned long); 70 long (*compat_ioctl32) (struct file *, unsigned int, unsigned long);
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index ffb69da3ce9e..9c581578783f 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -58,8 +58,6 @@ struct v4l2_device {
58 struct v4l2_ctrl_handler *ctrl_handler; 58 struct v4l2_ctrl_handler *ctrl_handler;
59 /* Device's priority state */ 59 /* Device's priority state */
60 struct v4l2_prio_state prio; 60 struct v4l2_prio_state prio;
61 /* BKL replacement mutex. Temporary solution only. */
62 struct mutex ioctl_lock;
63 /* Keep track of the references to this struct. */ 61 /* Keep track of the references to this struct. */
64 struct kref ref; 62 struct kref ref;
65 /* Release function that is called when the ref count goes to 0. */ 63 /* Release function that is called when the ref count goes to 0. */
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 8537983b9b22..8fbbd76d78e8 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -23,12 +23,6 @@ struct v4l2_ioctl_ops {
23 /* VIDIOC_QUERYCAP handler */ 23 /* VIDIOC_QUERYCAP handler */
24 int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap); 24 int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap);
25 25
26 /* Priority handling */
27 int (*vidioc_g_priority) (struct file *file, void *fh,
28 enum v4l2_priority *p);
29 int (*vidioc_s_priority) (struct file *file, void *fh,
30 enum v4l2_priority p);
31
32 /* VIDIOC_ENUM_FMT handlers */ 26 /* VIDIOC_ENUM_FMT handlers */
33 int (*vidioc_enum_fmt_vid_cap) (struct file *file, void *fh, 27 int (*vidioc_enum_fmt_vid_cap) (struct file *file, void *fh,
34 struct v4l2_fmtdesc *f); 28 struct v4l2_fmtdesc *f);
diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
index 70fa7b7b0487..f831c9c225b6 100644
--- a/include/media/v4l2-of.h
+++ b/include/media/v4l2-of.h
@@ -29,12 +29,15 @@ struct device_node;
29 * @data_lanes: an array of physical data lane indexes 29 * @data_lanes: an array of physical data lane indexes
30 * @clock_lane: physical lane index of the clock lane 30 * @clock_lane: physical lane index of the clock lane
31 * @num_data_lanes: number of data lanes 31 * @num_data_lanes: number of data lanes
32 * @lane_polarities: polarity of the lanes. The order is the same of
33 * the physical lanes.
32 */ 34 */
33struct v4l2_of_bus_mipi_csi2 { 35struct v4l2_of_bus_mipi_csi2 {
34 unsigned int flags; 36 unsigned int flags;
35 unsigned char data_lanes[4]; 37 unsigned char data_lanes[4];
36 unsigned char clock_lane; 38 unsigned char clock_lane;
37 unsigned short num_data_lanes; 39 unsigned short num_data_lanes;
40 bool lane_polarities[5];
38}; 41};
39 42
40/** 43/**
@@ -66,9 +69,26 @@ struct v4l2_of_endpoint {
66 struct list_head head; 69 struct list_head head;
67}; 70};
68 71
72/**
73 * struct v4l2_of_link - a link between two endpoints
74 * @local_node: pointer to device_node of this endpoint
75 * @local_port: identifier of the port this endpoint belongs to
76 * @remote_node: pointer to device_node of the remote endpoint
77 * @remote_port: identifier of the port the remote endpoint belongs to
78 */
79struct v4l2_of_link {
80 struct device_node *local_node;
81 unsigned int local_port;
82 struct device_node *remote_node;
83 unsigned int remote_port;
84};
85
69#ifdef CONFIG_OF 86#ifdef CONFIG_OF
70int v4l2_of_parse_endpoint(const struct device_node *node, 87int v4l2_of_parse_endpoint(const struct device_node *node,
71 struct v4l2_of_endpoint *endpoint); 88 struct v4l2_of_endpoint *endpoint);
89int v4l2_of_parse_link(const struct device_node *node,
90 struct v4l2_of_link *link);
91void v4l2_of_put_link(struct v4l2_of_link *link);
72#else /* CONFIG_OF */ 92#else /* CONFIG_OF */
73 93
74static inline int v4l2_of_parse_endpoint(const struct device_node *node, 94static inline int v4l2_of_parse_endpoint(const struct device_node *node,
@@ -77,6 +97,16 @@ static inline int v4l2_of_parse_endpoint(const struct device_node *node,
77 return -ENOSYS; 97 return -ENOSYS;
78} 98}
79 99
100static inline int v4l2_of_parse_link(const struct device_node *node,
101 struct v4l2_of_link *link)
102{
103 return -ENOSYS;
104}
105
106static inline void v4l2_of_put_link(struct v4l2_of_link *link)
107{
108}
109
80#endif /* CONFIG_OF */ 110#endif /* CONFIG_OF */
81 111
82#endif /* _V4L2_OF_H */ 112#endif /* _V4L2_OF_H */
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 5beeb8744fd1..2f0a345a7fed 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -332,8 +332,6 @@ struct v4l2_subdev_video_ops {
332 struct v4l2_subdev_frame_interval *interval); 332 struct v4l2_subdev_frame_interval *interval);
333 int (*s_frame_interval)(struct v4l2_subdev *sd, 333 int (*s_frame_interval)(struct v4l2_subdev *sd,
334 struct v4l2_subdev_frame_interval *interval); 334 struct v4l2_subdev_frame_interval *interval);
335 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
336 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
337 int (*s_dv_timings)(struct v4l2_subdev *sd, 335 int (*s_dv_timings)(struct v4l2_subdev *sd,
338 struct v4l2_dv_timings *timings); 336 struct v4l2_dv_timings *timings);
339 int (*g_dv_timings)(struct v4l2_subdev *sd, 337 int (*g_dv_timings)(struct v4l2_subdev *sd,
@@ -482,6 +480,18 @@ struct v4l2_subdev_ir_ops {
482 struct v4l2_subdev_ir_parameters *params); 480 struct v4l2_subdev_ir_parameters *params);
483}; 481};
484 482
483/*
484 * Used for storing subdev pad information. This structure only needs
485 * to be passed to the pad op if the 'which' field of the main argument
486 * is set to V4L2_SUBDEV_FORMAT_TRY. For V4L2_SUBDEV_FORMAT_ACTIVE it is
487 * safe to pass NULL.
488 */
489struct v4l2_subdev_pad_config {
490 struct v4l2_mbus_framefmt try_fmt;
491 struct v4l2_rect try_crop;
492 struct v4l2_rect try_compose;
493};
494
485/** 495/**
486 * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations 496 * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations
487 * @get_frame_desc: get the current low level media bus frame parameters. 497 * @get_frame_desc: get the current low level media bus frame parameters.
@@ -489,21 +499,26 @@ struct v4l2_subdev_ir_ops {
489 * may be adjusted by the subdev driver to device capabilities. 499 * may be adjusted by the subdev driver to device capabilities.
490 */ 500 */
491struct v4l2_subdev_pad_ops { 501struct v4l2_subdev_pad_ops {
492 int (*enum_mbus_code)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 502 int (*enum_mbus_code)(struct v4l2_subdev *sd,
503 struct v4l2_subdev_pad_config *cfg,
493 struct v4l2_subdev_mbus_code_enum *code); 504 struct v4l2_subdev_mbus_code_enum *code);
494 int (*enum_frame_size)(struct v4l2_subdev *sd, 505 int (*enum_frame_size)(struct v4l2_subdev *sd,
495 struct v4l2_subdev_fh *fh, 506 struct v4l2_subdev_pad_config *cfg,
496 struct v4l2_subdev_frame_size_enum *fse); 507 struct v4l2_subdev_frame_size_enum *fse);
497 int (*enum_frame_interval)(struct v4l2_subdev *sd, 508 int (*enum_frame_interval)(struct v4l2_subdev *sd,
498 struct v4l2_subdev_fh *fh, 509 struct v4l2_subdev_pad_config *cfg,
499 struct v4l2_subdev_frame_interval_enum *fie); 510 struct v4l2_subdev_frame_interval_enum *fie);
500 int (*get_fmt)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 511 int (*get_fmt)(struct v4l2_subdev *sd,
512 struct v4l2_subdev_pad_config *cfg,
501 struct v4l2_subdev_format *format); 513 struct v4l2_subdev_format *format);
502 int (*set_fmt)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 514 int (*set_fmt)(struct v4l2_subdev *sd,
515 struct v4l2_subdev_pad_config *cfg,
503 struct v4l2_subdev_format *format); 516 struct v4l2_subdev_format *format);
504 int (*get_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 517 int (*get_selection)(struct v4l2_subdev *sd,
518 struct v4l2_subdev_pad_config *cfg,
505 struct v4l2_subdev_selection *sel); 519 struct v4l2_subdev_selection *sel);
506 int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 520 int (*set_selection)(struct v4l2_subdev *sd,
521 struct v4l2_subdev_pad_config *cfg,
507 struct v4l2_subdev_selection *sel); 522 struct v4l2_subdev_selection *sel);
508 int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid); 523 int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid);
509 int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid); 524 int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid);
@@ -625,11 +640,7 @@ struct v4l2_subdev {
625struct v4l2_subdev_fh { 640struct v4l2_subdev_fh {
626 struct v4l2_fh vfh; 641 struct v4l2_fh vfh;
627#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) 642#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
628 struct { 643 struct v4l2_subdev_pad_config *pad;
629 struct v4l2_mbus_framefmt try_fmt;
630 struct v4l2_rect try_crop;
631 struct v4l2_rect try_compose;
632 } *pad;
633#endif 644#endif
634}; 645};
635 646
@@ -639,17 +650,17 @@ struct v4l2_subdev_fh {
639#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) 650#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
640#define __V4L2_SUBDEV_MK_GET_TRY(rtype, fun_name, field_name) \ 651#define __V4L2_SUBDEV_MK_GET_TRY(rtype, fun_name, field_name) \
641 static inline struct rtype * \ 652 static inline struct rtype * \
642 v4l2_subdev_get_try_##fun_name(struct v4l2_subdev_fh *fh, \ 653 fun_name(struct v4l2_subdev *sd, \
643 unsigned int pad) \ 654 struct v4l2_subdev_pad_config *cfg, \
655 unsigned int pad) \
644 { \ 656 { \
645 BUG_ON(pad >= vdev_to_v4l2_subdev( \ 657 BUG_ON(pad >= sd->entity.num_pads); \
646 fh->vfh.vdev)->entity.num_pads); \ 658 return &cfg[pad].field_name; \
647 return &fh->pad[pad].field_name; \
648 } 659 }
649 660
650__V4L2_SUBDEV_MK_GET_TRY(v4l2_mbus_framefmt, format, try_fmt) 661__V4L2_SUBDEV_MK_GET_TRY(v4l2_mbus_framefmt, v4l2_subdev_get_try_format, try_fmt)
651__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, crop, try_crop) 662__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, v4l2_subdev_get_try_crop, try_crop)
652__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, compose, try_compose) 663__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, v4l2_subdev_get_try_compose, try_compose)
653#endif 664#endif
654 665
655extern const struct v4l2_file_operations v4l2_subdev_fops; 666extern const struct v4l2_file_operations v4l2_subdev_fops;
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index bd2cec2d6c3d..a5790fd5d125 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -134,17 +134,6 @@ enum vb2_io_modes {
134}; 134};
135 135
136/** 136/**
137 * enum vb2_fileio_flags - flags for selecting a mode of the file io emulator,
138 * by default the 'streaming' style is used by the file io emulator
139 * @VB2_FILEIO_READ_ONCE: report EOF after reading the first buffer
140 * @VB2_FILEIO_WRITE_IMMEDIATELY: queue buffer after each write() call
141 */
142enum vb2_fileio_flags {
143 VB2_FILEIO_READ_ONCE = (1 << 0),
144 VB2_FILEIO_WRITE_IMMEDIATELY = (1 << 1),
145};
146
147/**
148 * enum vb2_buffer_state - current video buffer state 137 * enum vb2_buffer_state - current video buffer state
149 * @VB2_BUF_STATE_DEQUEUED: buffer under userspace control 138 * @VB2_BUF_STATE_DEQUEUED: buffer under userspace control
150 * @VB2_BUF_STATE_PREPARING: buffer is being prepared in videobuf 139 * @VB2_BUF_STATE_PREPARING: buffer is being prepared in videobuf
@@ -346,7 +335,9 @@ struct v4l2_fh;
346 * 335 *
347 * @type: queue type (see V4L2_BUF_TYPE_* in linux/videodev2.h 336 * @type: queue type (see V4L2_BUF_TYPE_* in linux/videodev2.h
348 * @io_modes: supported io methods (see vb2_io_modes enum) 337 * @io_modes: supported io methods (see vb2_io_modes enum)
349 * @io_flags: additional io flags (see vb2_fileio_flags enum) 338 * @fileio_read_once: report EOF after reading the first buffer
339 * @fileio_write_immediately: queue buffer after each write() call
340 * @allow_zero_bytesused: allow bytesused == 0 to be passed to the driver
350 * @lock: pointer to a mutex that protects the vb2_queue struct. The 341 * @lock: pointer to a mutex that protects the vb2_queue struct. The
351 * driver can set this to a mutex to let the v4l2 core serialize 342 * driver can set this to a mutex to let the v4l2 core serialize
352 * the queuing ioctls. If the driver wants to handle locking 343 * the queuing ioctls. If the driver wants to handle locking
@@ -396,7 +387,10 @@ struct v4l2_fh;
396struct vb2_queue { 387struct vb2_queue {
397 enum v4l2_buf_type type; 388 enum v4l2_buf_type type;
398 unsigned int io_modes; 389 unsigned int io_modes;
399 unsigned int io_flags; 390 unsigned fileio_read_once:1;
391 unsigned fileio_write_immediately:1;
392 unsigned allow_zero_bytesused:1;
393
400 struct mutex *lock; 394 struct mutex *lock;
401 struct v4l2_fh *owner; 395 struct v4l2_fh *owner;
402 396
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 6fab66c5c5af..c6b97e58cf84 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -211,6 +211,8 @@ struct p9_dirent {
211 char d_name[256]; 211 char d_name[256];
212}; 212};
213 213
214struct iov_iter;
215
214int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); 216int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb);
215int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, 217int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid,
216 const char *name); 218 const char *name);
@@ -236,10 +238,8 @@ int p9_client_clunk(struct p9_fid *fid);
236int p9_client_fsync(struct p9_fid *fid, int datasync); 238int p9_client_fsync(struct p9_fid *fid, int datasync);
237int p9_client_remove(struct p9_fid *fid); 239int p9_client_remove(struct p9_fid *fid);
238int p9_client_unlinkat(struct p9_fid *dfid, const char *name, int flags); 240int p9_client_unlinkat(struct p9_fid *dfid, const char *name, int flags);
239int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, 241int p9_client_read(struct p9_fid *fid, u64 offset, struct iov_iter *to, int *err);
240 u64 offset, u32 count); 242int p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err);
241int p9_client_write(struct p9_fid *fid, char *data, const char __user *udata,
242 u64 offset, u32 count);
243int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset); 243int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset);
244int p9dirent_read(struct p9_client *clnt, char *buf, int len, 244int p9dirent_read(struct p9_client *clnt, char *buf, int len,
245 struct p9_dirent *dirent); 245 struct p9_dirent *dirent);
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index 2a25dec30211..5122b5e40f78 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -61,7 +61,7 @@ struct p9_trans_module {
61 int (*cancel) (struct p9_client *, struct p9_req_t *req); 61 int (*cancel) (struct p9_client *, struct p9_req_t *req);
62 int (*cancelled)(struct p9_client *, struct p9_req_t *req); 62 int (*cancelled)(struct p9_client *, struct p9_req_t *req);
63 int (*zc_request)(struct p9_client *, struct p9_req_t *, 63 int (*zc_request)(struct p9_client *, struct p9_req_t *,
64 char *, char *, int , int, int, int); 64 struct iov_iter *, struct iov_iter *, int , int, int);
65}; 65};
66 66
67void v9fs_register_trans(struct p9_trans_module *m); 67void v9fs_register_trans(struct p9_trans_module *m);
diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h
index 0d87674fb775..172632dd9930 100644
--- a/include/net/af_vsock.h
+++ b/include/net/af_vsock.h
@@ -100,8 +100,8 @@ struct vsock_transport {
100 100
101 /* DGRAM. */ 101 /* DGRAM. */
102 int (*dgram_bind)(struct vsock_sock *, struct sockaddr_vm *); 102 int (*dgram_bind)(struct vsock_sock *, struct sockaddr_vm *);
103 int (*dgram_dequeue)(struct kiocb *kiocb, struct vsock_sock *vsk, 103 int (*dgram_dequeue)(struct vsock_sock *vsk, struct msghdr *msg,
104 struct msghdr *msg, size_t len, int flags); 104 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 msghdr *, 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);
diff --git a/include/net/arp.h b/include/net/arp.h
index 73c49864076b..5e0f891d476c 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -9,28 +9,17 @@
9 9
10extern struct neigh_table arp_tbl; 10extern struct neigh_table arp_tbl;
11 11
12static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd) 12static inline u32 arp_hashfn(const void *pkey, const struct net_device *dev, u32 *hash_rnd)
13{ 13{
14 u32 key = *(const u32 *)pkey;
14 u32 val = key ^ hash32_ptr(dev); 15 u32 val = key ^ hash32_ptr(dev);
15 16
16 return val * hash_rnd; 17 return val * hash_rnd[0];
17} 18}
18 19
19static inline struct neighbour *__ipv4_neigh_lookup_noref(struct net_device *dev, u32 key) 20static inline struct neighbour *__ipv4_neigh_lookup_noref(struct net_device *dev, u32 key)
20{ 21{
21 struct neigh_hash_table *nht = rcu_dereference_bh(arp_tbl.nht); 22 return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, arp_hashfn, &key, dev);
22 struct neighbour *n;
23 u32 hash_val;
24
25 hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift);
26 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]);
27 n != NULL;
28 n = rcu_dereference_bh(n->next)) {
29 if (n->dev == dev && *(u32 *)n->primary_key == key)
30 return n;
31 }
32
33 return NULL;
34} 23}
35 24
36static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32 key) 25static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32 key)
@@ -47,7 +36,6 @@ static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32
47} 36}
48 37
49void arp_init(void); 38void arp_init(void);
50int arp_find(unsigned char *haddr, struct sk_buff *skb);
51int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg); 39int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg);
52void arp_send(int type, int ptype, __be32 dest_ip, 40void arp_send(int type, int ptype, __be32 dest_ip,
53 struct net_device *dev, __be32 src_ip, 41 struct net_device *dev, __be32 src_ip,
diff --git a/include/net/ax25.h b/include/net/ax25.h
index bf0396e9a5d3..16a923a3a43a 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -12,6 +12,7 @@
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/atomic.h> 14#include <linux/atomic.h>
15#include <net/neighbour.h>
15 16
16#define AX25_T1CLAMPLO 1 17#define AX25_T1CLAMPLO 1
17#define AX25_T1CLAMPHI (30 * HZ) 18#define AX25_T1CLAMPHI (30 * HZ)
@@ -366,9 +367,7 @@ int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *,
366 struct net_device *); 367 struct net_device *);
367 368
368/* ax25_ip.c */ 369/* ax25_ip.c */
369int ax25_hard_header(struct sk_buff *, struct net_device *, unsigned short, 370netdev_tx_t ax25_ip_xmit(struct sk_buff *skb);
370 const void *, const void *, unsigned int);
371int ax25_rebuild_header(struct sk_buff *);
372extern const struct header_ops ax25_header_ops; 371extern const struct header_ops ax25_header_ops;
373 372
374/* ax25_out.c */ 373/* ax25_out.c */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index e00455aab18c..7dba80546f16 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -245,10 +245,10 @@ int bt_sock_register(int proto, const struct net_proto_family *ops);
245void bt_sock_unregister(int proto); 245void bt_sock_unregister(int proto);
246void bt_sock_link(struct bt_sock_list *l, struct sock *s); 246void bt_sock_link(struct bt_sock_list *l, struct sock *s);
247void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); 247void bt_sock_unlink(struct bt_sock_list *l, struct sock *s);
248int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, 248int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
249 struct msghdr *msg, size_t len, int flags); 249 int flags);
250int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock, 250int bt_sock_stream_recvmsg(struct socket *sock, struct msghdr *msg,
251 struct msghdr *msg, size_t len, int flags); 251 size_t len, int flags);
252uint bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait); 252uint bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait);
253int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 253int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
254int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); 254int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
@@ -269,29 +269,34 @@ struct l2cap_ctrl {
269 __u16 reqseq; 269 __u16 reqseq;
270 __u16 txseq; 270 __u16 txseq;
271 __u8 retries; 271 __u8 retries;
272 __le16 psm;
273 bdaddr_t bdaddr;
274 struct l2cap_chan *chan;
272}; 275};
273 276
274struct hci_dev; 277struct hci_dev;
275 278
276typedef void (*hci_req_complete_t)(struct hci_dev *hdev, u8 status, u16 opcode); 279typedef void (*hci_req_complete_t)(struct hci_dev *hdev, u8 status, u16 opcode);
277 280typedef void (*hci_req_complete_skb_t)(struct hci_dev *hdev, u8 status,
278struct hci_req_ctrl { 281 u16 opcode, struct sk_buff *skb);
279 bool start; 282
280 u8 event; 283struct req_ctrl {
281 hci_req_complete_t complete; 284 bool start;
285 u8 event;
286 hci_req_complete_t complete;
287 hci_req_complete_skb_t complete_skb;
282}; 288};
283 289
284struct bt_skb_cb { 290struct bt_skb_cb {
285 __u8 pkt_type; 291 __u8 pkt_type;
286 __u8 incoming; 292 __u8 force_active;
287 __u16 opcode; 293 __u16 opcode;
288 __u16 expect; 294 __u16 expect;
289 __u8 force_active; 295 __u8 incoming:1;
290 struct l2cap_chan *chan; 296 union {
291 struct l2cap_ctrl control; 297 struct l2cap_ctrl l2cap;
292 struct hci_req_ctrl req; 298 struct req_ctrl req;
293 bdaddr_t bdaddr; 299 };
294 __le16 psm;
295}; 300};
296#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) 301#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
297 302
@@ -339,6 +344,11 @@ out:
339 344
340int bt_to_errno(__u16 code); 345int bt_to_errno(__u16 code);
341 346
347void hci_sock_set_flag(struct sock *sk, int nr);
348void hci_sock_clear_flag(struct sock *sk, int nr);
349int hci_sock_test_flag(struct sock *sk, int nr);
350unsigned short hci_sock_get_channel(struct sock *sk);
351
342int hci_sock_init(void); 352int hci_sock_init(void);
343void hci_sock_cleanup(void); 353void hci_sock_cleanup(void);
344 354
@@ -358,6 +368,9 @@ void l2cap_exit(void);
358int sco_init(void); 368int sco_init(void);
359void sco_exit(void); 369void sco_exit(void);
360 370
371int mgmt_init(void);
372void mgmt_exit(void);
373
361void bt_sock_reclassify_lock(struct sock *sk, int proto); 374void bt_sock_reclassify_lock(struct sock *sk, int proto);
362 375
363#endif /* __BLUETOOTH_H */ 376#endif /* __BLUETOOTH_H */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 8e54f825153c..d95da83cb1b0 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -160,6 +160,14 @@ enum {
160 * during the hdev->setup vendor callback. 160 * during the hdev->setup vendor callback.
161 */ 161 */
162 HCI_QUIRK_STRICT_DUPLICATE_FILTER, 162 HCI_QUIRK_STRICT_DUPLICATE_FILTER,
163
164 /* When this quirk is set, LE scan and BR/EDR inquiry is done
165 * simultaneously, otherwise it's interleaved.
166 *
167 * This quirk can be set before hci_register_dev is called or
168 * during the hdev->setup vendor callback.
169 */
170 HCI_QUIRK_SIMULTANEOUS_DISCOVERY,
163}; 171};
164 172
165/* HCI device flags */ 173/* HCI device flags */
@@ -179,13 +187,14 @@ enum {
179 HCI_RESET, 187 HCI_RESET,
180}; 188};
181 189
182/* BR/EDR and/or LE controller flags: the flags defined here should represent 190/* HCI socket flags */
183 * states configured via debugfs for debugging and testing purposes only.
184 */
185enum { 191enum {
186 HCI_DUT_MODE, 192 HCI_SOCK_TRUSTED,
187 HCI_FORCE_BREDR_SMP, 193 HCI_MGMT_INDEX_EVENTS,
188 HCI_FORCE_STATIC_ADDR, 194 HCI_MGMT_UNCONF_INDEX_EVENTS,
195 HCI_MGMT_EXT_INDEX_EVENTS,
196 HCI_MGMT_GENERIC_EVENTS,
197 HCI_MGMT_OOB_DATA_EVENTS,
189}; 198};
190 199
191/* 200/*
@@ -217,6 +226,8 @@ enum {
217 HCI_HS_ENABLED, 226 HCI_HS_ENABLED,
218 HCI_LE_ENABLED, 227 HCI_LE_ENABLED,
219 HCI_ADVERTISING, 228 HCI_ADVERTISING,
229 HCI_ADVERTISING_CONNECTABLE,
230 HCI_ADVERTISING_INSTANCE,
220 HCI_CONNECTABLE, 231 HCI_CONNECTABLE,
221 HCI_DISCOVERABLE, 232 HCI_DISCOVERABLE,
222 HCI_LIMITED_DISCOVERABLE, 233 HCI_LIMITED_DISCOVERABLE,
@@ -225,13 +236,13 @@ enum {
225 HCI_FAST_CONNECTABLE, 236 HCI_FAST_CONNECTABLE,
226 HCI_BREDR_ENABLED, 237 HCI_BREDR_ENABLED,
227 HCI_LE_SCAN_INTERRUPTED, 238 HCI_LE_SCAN_INTERRUPTED,
228};
229 239
230/* A mask for the flags that are supposed to remain when a reset happens 240 HCI_DUT_MODE,
231 * or the HCI device is closed. 241 HCI_FORCE_BREDR_SMP,
232 */ 242 HCI_FORCE_STATIC_ADDR,
233#define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \ 243
234 BIT(HCI_FAST_CONNECTABLE) | BIT(HCI_LE_ADV)) 244 __HCI_NUM_FLAGS,
245};
235 246
236/* HCI timeouts */ 247/* HCI timeouts */
237#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 248#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
@@ -363,6 +374,7 @@ enum {
363/* LE features */ 374/* LE features */
364#define HCI_LE_ENCRYPTION 0x01 375#define HCI_LE_ENCRYPTION 0x01
365#define HCI_LE_CONN_PARAM_REQ_PROC 0x02 376#define HCI_LE_CONN_PARAM_REQ_PROC 0x02
377#define HCI_LE_SLAVE_FEATURES 0x08
366#define HCI_LE_PING 0x10 378#define HCI_LE_PING 0x10
367#define HCI_LE_DATA_LEN_EXT 0x20 379#define HCI_LE_DATA_LEN_EXT 0x20
368#define HCI_LE_EXT_SCAN_POLICY 0x80 380#define HCI_LE_EXT_SCAN_POLICY 0x80
@@ -452,9 +464,16 @@ enum {
452#define EIR_NAME_COMPLETE 0x09 /* complete local name */ 464#define EIR_NAME_COMPLETE 0x09 /* complete local name */
453#define EIR_TX_POWER 0x0A /* transmit power level */ 465#define EIR_TX_POWER 0x0A /* transmit power level */
454#define EIR_CLASS_OF_DEV 0x0D /* Class of Device */ 466#define EIR_CLASS_OF_DEV 0x0D /* Class of Device */
455#define EIR_SSP_HASH_C 0x0E /* Simple Pairing Hash C */ 467#define EIR_SSP_HASH_C192 0x0E /* Simple Pairing Hash C-192 */
456#define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */ 468#define EIR_SSP_RAND_R192 0x0F /* Simple Pairing Randomizer R-192 */
457#define EIR_DEVICE_ID 0x10 /* device ID */ 469#define EIR_DEVICE_ID 0x10 /* device ID */
470#define EIR_APPEARANCE 0x19 /* Device appearance */
471#define EIR_LE_BDADDR 0x1B /* LE Bluetooth device address */
472#define EIR_LE_ROLE 0x1C /* LE role */
473#define EIR_SSP_HASH_C256 0x1D /* Simple Pairing Hash C-256 */
474#define EIR_SSP_RAND_R256 0x1E /* Simple Pairing Rand R-256 */
475#define EIR_LE_SC_CONFIRM 0x22 /* LE SC Confirmation Value */
476#define EIR_LE_SC_RANDOM 0x23 /* LE SC Random Value */
458 477
459/* Low Energy Advertising Flags */ 478/* Low Energy Advertising Flags */
460#define LE_AD_LIMITED 0x01 /* Limited Discoverable */ 479#define LE_AD_LIMITED 0x01 /* Limited Discoverable */
@@ -1358,6 +1377,11 @@ struct hci_cp_le_conn_update {
1358 __le16 max_ce_len; 1377 __le16 max_ce_len;
1359} __packed; 1378} __packed;
1360 1379
1380#define HCI_OP_LE_READ_REMOTE_FEATURES 0x2016
1381struct hci_cp_le_read_remote_features {
1382 __le16 handle;
1383} __packed;
1384
1361#define HCI_OP_LE_START_ENC 0x2019 1385#define HCI_OP_LE_START_ENC 0x2019
1362struct hci_cp_le_start_enc { 1386struct hci_cp_le_start_enc {
1363 __le16 handle; 1387 __le16 handle;
@@ -1850,6 +1874,13 @@ struct hci_ev_le_conn_update_complete {
1850 __le16 supervision_timeout; 1874 __le16 supervision_timeout;
1851} __packed; 1875} __packed;
1852 1876
1877#define HCI_EV_LE_REMOTE_FEAT_COMPLETE 0x04
1878struct hci_ev_le_remote_feat_complete {
1879 __u8 status;
1880 __le16 handle;
1881 __u8 features[8];
1882} __packed;
1883
1853#define HCI_EV_LE_LTK_REQ 0x05 1884#define HCI_EV_LE_LTK_REQ 0x05
1854struct hci_ev_le_ltk_req { 1885struct hci_ev_le_ltk_req {
1855 __le16 handle; 1886 __le16 handle;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 52863c3e0b13..a056c2bfeb81 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -76,6 +76,7 @@ struct discovery_state {
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; 78 bool report_invalid_rssi;
79 bool result_filtering;
79 s8 rssi; 80 s8 rssi;
80 u16 uuid_count; 81 u16 uuid_count;
81 u8 (*uuids)[16]; 82 u8 (*uuids)[16];
@@ -108,7 +109,7 @@ struct bt_uuid {
108struct smp_csrk { 109struct smp_csrk {
109 bdaddr_t bdaddr; 110 bdaddr_t bdaddr;
110 u8 bdaddr_type; 111 u8 bdaddr_type;
111 u8 master; 112 u8 type;
112 u8 val[16]; 113 u8 val[16];
113}; 114};
114 115
@@ -154,6 +155,17 @@ struct oob_data {
154 u8 rand256[16]; 155 u8 rand256[16];
155}; 156};
156 157
158struct adv_info {
159 struct delayed_work timeout_exp;
160 __u8 instance;
161 __u32 flags;
162 __u16 timeout;
163 __u16 adv_data_len;
164 __u8 adv_data[HCI_MAX_AD_LENGTH];
165 __u16 scan_rsp_len;
166 __u8 scan_rsp_data[HCI_MAX_AD_LENGTH];
167};
168
157#define HCI_MAX_SHORT_NAME_LENGTH 10 169#define HCI_MAX_SHORT_NAME_LENGTH 10
158 170
159/* Default LE RPA expiry time, 15 minutes */ 171/* Default LE RPA expiry time, 15 minutes */
@@ -173,7 +185,6 @@ struct amp_assoc {
173 185
174#define HCI_MAX_PAGES 3 186#define HCI_MAX_PAGES 3
175 187
176#define NUM_REASSEMBLY 4
177struct hci_dev { 188struct hci_dev {
178 struct list_head list; 189 struct list_head list;
179 struct mutex lock; 190 struct mutex lock;
@@ -314,14 +325,13 @@ struct hci_dev {
314 struct sk_buff_head raw_q; 325 struct sk_buff_head raw_q;
315 struct sk_buff_head cmd_q; 326 struct sk_buff_head cmd_q;
316 327
317 struct sk_buff *recv_evt;
318 struct sk_buff *sent_cmd; 328 struct sk_buff *sent_cmd;
319 struct sk_buff *reassembly[NUM_REASSEMBLY];
320 329
321 struct mutex req_lock; 330 struct mutex req_lock;
322 wait_queue_head_t req_wait_q; 331 wait_queue_head_t req_wait_q;
323 __u32 req_status; 332 __u32 req_status;
324 __u32 req_result; 333 __u32 req_result;
334 struct sk_buff *req_skb;
325 335
326 void *smp_data; 336 void *smp_data;
327 void *smp_bredr_data; 337 void *smp_bredr_data;
@@ -352,8 +362,7 @@ struct hci_dev {
352 362
353 struct rfkill *rfkill; 363 struct rfkill *rfkill;
354 364
355 unsigned long dbg_flags; 365 DECLARE_BITMAP(dev_flags, __HCI_NUM_FLAGS);
356 unsigned long dev_flags;
357 366
358 struct delayed_work le_scan_disable; 367 struct delayed_work le_scan_disable;
359 struct delayed_work le_scan_restart; 368 struct delayed_work le_scan_restart;
@@ -364,6 +373,8 @@ struct hci_dev {
364 __u8 scan_rsp_data[HCI_MAX_AD_LENGTH]; 373 __u8 scan_rsp_data[HCI_MAX_AD_LENGTH];
365 __u8 scan_rsp_data_len; 374 __u8 scan_rsp_data_len;
366 375
376 struct adv_info adv_instance;
377
367 __u8 irk[16]; 378 __u8 irk[16];
368 __u32 rpa_timeout; 379 __u32 rpa_timeout;
369 struct delayed_work rpa_expired; 380 struct delayed_work rpa_expired;
@@ -373,6 +384,7 @@ struct hci_dev {
373 int (*close)(struct hci_dev *hdev); 384 int (*close)(struct hci_dev *hdev);
374 int (*flush)(struct hci_dev *hdev); 385 int (*flush)(struct hci_dev *hdev);
375 int (*setup)(struct hci_dev *hdev); 386 int (*setup)(struct hci_dev *hdev);
387 int (*shutdown)(struct hci_dev *hdev);
376 int (*send)(struct hci_dev *hdev, struct sk_buff *skb); 388 int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
377 void (*notify)(struct hci_dev *hdev, unsigned int evt); 389 void (*notify)(struct hci_dev *hdev, unsigned int evt);
378 void (*hw_error)(struct hci_dev *hdev, u8 code); 390 void (*hw_error)(struct hci_dev *hdev, u8 code);
@@ -498,19 +510,29 @@ struct hci_conn_params {
498extern struct list_head hci_dev_list; 510extern struct list_head hci_dev_list;
499extern struct list_head hci_cb_list; 511extern struct list_head hci_cb_list;
500extern rwlock_t hci_dev_list_lock; 512extern rwlock_t hci_dev_list_lock;
501extern rwlock_t hci_cb_list_lock; 513extern struct mutex hci_cb_list_lock;
514
515#define hci_dev_set_flag(hdev, nr) set_bit((nr), (hdev)->dev_flags)
516#define hci_dev_clear_flag(hdev, nr) clear_bit((nr), (hdev)->dev_flags)
517#define hci_dev_change_flag(hdev, nr) change_bit((nr), (hdev)->dev_flags)
518#define hci_dev_test_flag(hdev, nr) test_bit((nr), (hdev)->dev_flags)
519#define hci_dev_test_and_set_flag(hdev, nr) test_and_set_bit((nr), (hdev)->dev_flags)
520#define hci_dev_test_and_clear_flag(hdev, nr) test_and_clear_bit((nr), (hdev)->dev_flags)
521#define hci_dev_test_and_change_flag(hdev, nr) test_and_change_bit((nr), (hdev)->dev_flags)
522
523#define hci_dev_clear_volatile_flags(hdev) \
524 do { \
525 hci_dev_clear_flag(hdev, HCI_LE_SCAN); \
526 hci_dev_clear_flag(hdev, HCI_LE_ADV); \
527 hci_dev_clear_flag(hdev, HCI_PERIODIC_INQ); \
528 } while (0)
502 529
503/* ----- HCI interface to upper protocols ----- */ 530/* ----- HCI interface to upper protocols ----- */
504int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); 531int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
505void l2cap_connect_cfm(struct hci_conn *hcon, u8 status);
506int l2cap_disconn_ind(struct hci_conn *hcon); 532int l2cap_disconn_ind(struct hci_conn *hcon);
507void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason);
508int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt);
509int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags); 533int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags);
510 534
511int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags); 535int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
512void sco_connect_cfm(struct hci_conn *hcon, __u8 status);
513void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason);
514int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb); 536int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
515 537
516/* ----- Inquiry cache ----- */ 538/* ----- Inquiry cache ----- */
@@ -529,6 +551,7 @@ static inline void discovery_init(struct hci_dev *hdev)
529 551
530static inline void hci_discovery_filter_clear(struct hci_dev *hdev) 552static inline void hci_discovery_filter_clear(struct hci_dev *hdev)
531{ 553{
554 hdev->discovery.result_filtering = false;
532 hdev->discovery.report_invalid_rssi = true; 555 hdev->discovery.report_invalid_rssi = true;
533 hdev->discovery.rssi = HCI_RSSI_INVALID; 556 hdev->discovery.rssi = HCI_RSSI_INVALID;
534 hdev->discovery.uuid_count = 0; 557 hdev->discovery.uuid_count = 0;
@@ -538,6 +561,11 @@ static inline void hci_discovery_filter_clear(struct hci_dev *hdev)
538 hdev->discovery.scan_duration = 0; 561 hdev->discovery.scan_duration = 0;
539} 562}
540 563
564static inline void adv_info_init(struct hci_dev *hdev)
565{
566 memset(&hdev->adv_instance, 0, sizeof(struct adv_info));
567}
568
541bool hci_discovery_active(struct hci_dev *hdev); 569bool hci_discovery_active(struct hci_dev *hdev);
542 570
543void hci_discovery_set_state(struct hci_dev *hdev, int state); 571void hci_discovery_set_state(struct hci_dev *hdev, int state);
@@ -584,7 +612,6 @@ enum {
584 HCI_CONN_SC_ENABLED, 612 HCI_CONN_SC_ENABLED,
585 HCI_CONN_AES_CCM, 613 HCI_CONN_AES_CCM,
586 HCI_CONN_POWER_SAVE, 614 HCI_CONN_POWER_SAVE,
587 HCI_CONN_REMOTE_OOB,
588 HCI_CONN_FLUSH_KEY, 615 HCI_CONN_FLUSH_KEY,
589 HCI_CONN_ENCRYPT, 616 HCI_CONN_ENCRYPT,
590 HCI_CONN_AUTH, 617 HCI_CONN_AUTH,
@@ -600,14 +627,14 @@ enum {
600static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) 627static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
601{ 628{
602 struct hci_dev *hdev = conn->hdev; 629 struct hci_dev *hdev = conn->hdev;
603 return test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) && 630 return hci_dev_test_flag(hdev, HCI_SSP_ENABLED) &&
604 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags); 631 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags);
605} 632}
606 633
607static inline bool hci_conn_sc_enabled(struct hci_conn *conn) 634static inline bool hci_conn_sc_enabled(struct hci_conn *conn)
608{ 635{
609 struct hci_dev *hdev = conn->hdev; 636 struct hci_dev *hdev = conn->hdev;
610 return test_bit(HCI_SC_ENABLED, &hdev->dev_flags) && 637 return hci_dev_test_flag(hdev, HCI_SC_ENABLED) &&
611 test_bit(HCI_CONN_SC_ENABLED, &conn->flags); 638 test_bit(HCI_CONN_SC_ENABLED, &conn->flags);
612} 639}
613 640
@@ -969,6 +996,8 @@ struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr,
969void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type); 996void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type);
970void hci_smp_irks_clear(struct hci_dev *hdev); 997void hci_smp_irks_clear(struct hci_dev *hdev);
971 998
999bool hci_bdaddr_is_paired(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1000
972void hci_remote_oob_data_clear(struct hci_dev *hdev); 1001void hci_remote_oob_data_clear(struct hci_dev *hdev);
973struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, 1002struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev,
974 bdaddr_t *bdaddr, u8 bdaddr_type); 1003 bdaddr_t *bdaddr, u8 bdaddr_type);
@@ -981,7 +1010,6 @@ int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
981void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 1010void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
982 1011
983int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb); 1012int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb);
984int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count);
985 1013
986void hci_init_sysfs(struct hci_dev *hdev); 1014void hci_init_sysfs(struct hci_dev *hdev);
987void hci_conn_init_sysfs(struct hci_conn *conn); 1015void hci_conn_init_sysfs(struct hci_conn *conn);
@@ -1025,10 +1053,10 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
1025#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) 1053#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE))
1026#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) 1054#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR))
1027 1055
1028#define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \ 1056#define hdev_is_powered(dev) (test_bit(HCI_UP, &(dev)->flags) && \
1029 !test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) 1057 !hci_dev_test_flag(dev, HCI_AUTO_OFF))
1030#define bredr_sc_enabled(dev) (lmp_sc_capable(dev) && \ 1058#define bredr_sc_enabled(dev) (lmp_sc_capable(dev) && \
1031 test_bit(HCI_SC_ENABLED, &(dev)->dev_flags)) 1059 hci_dev_test_flag(dev, HCI_SC_ENABLED))
1032 1060
1033/* ----- HCI protocols ----- */ 1061/* ----- HCI protocols ----- */
1034#define HCI_PROTO_DEFER 0x01 1062#define HCI_PROTO_DEFER 0x01
@@ -1050,28 +1078,6 @@ static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
1050 } 1078 }
1051} 1079}
1052 1080
1053static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status)
1054{
1055 switch (conn->type) {
1056 case ACL_LINK:
1057 case LE_LINK:
1058 l2cap_connect_cfm(conn, status);
1059 break;
1060
1061 case SCO_LINK:
1062 case ESCO_LINK:
1063 sco_connect_cfm(conn, status);
1064 break;
1065
1066 default:
1067 BT_ERR("unknown link type %d", conn->type);
1068 break;
1069 }
1070
1071 if (conn->connect_cfm_cb)
1072 conn->connect_cfm_cb(conn, status);
1073}
1074
1075static inline int hci_proto_disconn_ind(struct hci_conn *conn) 1081static inline int hci_proto_disconn_ind(struct hci_conn *conn)
1076{ 1082{
1077 if (conn->type != ACL_LINK && conn->type != LE_LINK) 1083 if (conn->type != ACL_LINK && conn->type != LE_LINK)
@@ -1080,91 +1086,69 @@ static inline int hci_proto_disconn_ind(struct hci_conn *conn)
1080 return l2cap_disconn_ind(conn); 1086 return l2cap_disconn_ind(conn);
1081} 1087}
1082 1088
1083static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason) 1089/* ----- HCI callbacks ----- */
1084{ 1090struct hci_cb {
1085 switch (conn->type) { 1091 struct list_head list;
1086 case ACL_LINK:
1087 case LE_LINK:
1088 l2cap_disconn_cfm(conn, reason);
1089 break;
1090
1091 case SCO_LINK:
1092 case ESCO_LINK:
1093 sco_disconn_cfm(conn, reason);
1094 break;
1095
1096 /* L2CAP would be handled for BREDR chan */
1097 case AMP_LINK:
1098 break;
1099 1092
1100 default: 1093 char *name;
1101 BT_ERR("unknown link type %d", conn->type);
1102 break;
1103 }
1104 1094
1105 if (conn->disconn_cfm_cb) 1095 void (*connect_cfm) (struct hci_conn *conn, __u8 status);
1106 conn->disconn_cfm_cb(conn, reason); 1096 void (*disconn_cfm) (struct hci_conn *conn, __u8 status);
1107} 1097 void (*security_cfm) (struct hci_conn *conn, __u8 status,
1098 __u8 encrypt);
1099 void (*key_change_cfm) (struct hci_conn *conn, __u8 status);
1100 void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role);
1101};
1108 1102
1109static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) 1103static inline void hci_connect_cfm(struct hci_conn *conn, __u8 status)
1110{ 1104{
1111 __u8 encrypt; 1105 struct hci_cb *cb;
1112
1113 if (conn->type != ACL_LINK && conn->type != LE_LINK)
1114 return;
1115
1116 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
1117 return;
1118 1106
1119 encrypt = test_bit(HCI_CONN_ENCRYPT, &conn->flags) ? 0x01 : 0x00; 1107 mutex_lock(&hci_cb_list_lock);
1120 l2cap_security_cfm(conn, status, encrypt); 1108 list_for_each_entry(cb, &hci_cb_list, list) {
1109 if (cb->connect_cfm)
1110 cb->connect_cfm(conn, status);
1111 }
1112 mutex_unlock(&hci_cb_list_lock);
1121 1113
1122 if (conn->security_cfm_cb) 1114 if (conn->connect_cfm_cb)
1123 conn->security_cfm_cb(conn, status); 1115 conn->connect_cfm_cb(conn, status);
1124} 1116}
1125 1117
1126static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, 1118static inline void hci_disconn_cfm(struct hci_conn *conn, __u8 reason)
1127 __u8 encrypt)
1128{ 1119{
1129 if (conn->type != ACL_LINK && conn->type != LE_LINK) 1120 struct hci_cb *cb;
1130 return;
1131 1121
1132 l2cap_security_cfm(conn, status, encrypt); 1122 mutex_lock(&hci_cb_list_lock);
1123 list_for_each_entry(cb, &hci_cb_list, list) {
1124 if (cb->disconn_cfm)
1125 cb->disconn_cfm(conn, reason);
1126 }
1127 mutex_unlock(&hci_cb_list_lock);
1133 1128
1134 if (conn->security_cfm_cb) 1129 if (conn->disconn_cfm_cb)
1135 conn->security_cfm_cb(conn, status); 1130 conn->disconn_cfm_cb(conn, reason);
1136} 1131}
1137 1132
1138/* ----- HCI callbacks ----- */
1139struct hci_cb {
1140 struct list_head list;
1141
1142 char *name;
1143
1144 void (*security_cfm) (struct hci_conn *conn, __u8 status,
1145 __u8 encrypt);
1146 void (*key_change_cfm) (struct hci_conn *conn, __u8 status);
1147 void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role);
1148};
1149
1150static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) 1133static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
1151{ 1134{
1152 struct hci_cb *cb; 1135 struct hci_cb *cb;
1153 __u8 encrypt; 1136 __u8 encrypt;
1154 1137
1155 hci_proto_auth_cfm(conn, status);
1156
1157 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) 1138 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
1158 return; 1139 return;
1159 1140
1160 encrypt = test_bit(HCI_CONN_ENCRYPT, &conn->flags) ? 0x01 : 0x00; 1141 encrypt = test_bit(HCI_CONN_ENCRYPT, &conn->flags) ? 0x01 : 0x00;
1161 1142
1162 read_lock(&hci_cb_list_lock); 1143 mutex_lock(&hci_cb_list_lock);
1163 list_for_each_entry(cb, &hci_cb_list, list) { 1144 list_for_each_entry(cb, &hci_cb_list, list) {
1164 if (cb->security_cfm) 1145 if (cb->security_cfm)
1165 cb->security_cfm(conn, status, encrypt); 1146 cb->security_cfm(conn, status, encrypt);
1166 } 1147 }
1167 read_unlock(&hci_cb_list_lock); 1148 mutex_unlock(&hci_cb_list_lock);
1149
1150 if (conn->security_cfm_cb)
1151 conn->security_cfm_cb(conn, status);
1168} 1152}
1169 1153
1170static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, 1154static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
@@ -1178,26 +1162,27 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
1178 if (conn->pending_sec_level > conn->sec_level) 1162 if (conn->pending_sec_level > conn->sec_level)
1179 conn->sec_level = conn->pending_sec_level; 1163 conn->sec_level = conn->pending_sec_level;
1180 1164
1181 hci_proto_encrypt_cfm(conn, status, encrypt); 1165 mutex_lock(&hci_cb_list_lock);
1182
1183 read_lock(&hci_cb_list_lock);
1184 list_for_each_entry(cb, &hci_cb_list, list) { 1166 list_for_each_entry(cb, &hci_cb_list, list) {
1185 if (cb->security_cfm) 1167 if (cb->security_cfm)
1186 cb->security_cfm(conn, status, encrypt); 1168 cb->security_cfm(conn, status, encrypt);
1187 } 1169 }
1188 read_unlock(&hci_cb_list_lock); 1170 mutex_unlock(&hci_cb_list_lock);
1171
1172 if (conn->security_cfm_cb)
1173 conn->security_cfm_cb(conn, status);
1189} 1174}
1190 1175
1191static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status) 1176static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status)
1192{ 1177{
1193 struct hci_cb *cb; 1178 struct hci_cb *cb;
1194 1179
1195 read_lock(&hci_cb_list_lock); 1180 mutex_lock(&hci_cb_list_lock);
1196 list_for_each_entry(cb, &hci_cb_list, list) { 1181 list_for_each_entry(cb, &hci_cb_list, list) {
1197 if (cb->key_change_cfm) 1182 if (cb->key_change_cfm)
1198 cb->key_change_cfm(conn, status); 1183 cb->key_change_cfm(conn, status);
1199 } 1184 }
1200 read_unlock(&hci_cb_list_lock); 1185 mutex_unlock(&hci_cb_list_lock);
1201} 1186}
1202 1187
1203static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, 1188static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status,
@@ -1205,12 +1190,12 @@ static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status,
1205{ 1190{
1206 struct hci_cb *cb; 1191 struct hci_cb *cb;
1207 1192
1208 read_lock(&hci_cb_list_lock); 1193 mutex_lock(&hci_cb_list_lock);
1209 list_for_each_entry(cb, &hci_cb_list, list) { 1194 list_for_each_entry(cb, &hci_cb_list, list) {
1210 if (cb->role_switch_cfm) 1195 if (cb->role_switch_cfm)
1211 cb->role_switch_cfm(conn, status, role); 1196 cb->role_switch_cfm(conn, status, role);
1212 } 1197 }
1213 read_unlock(&hci_cb_list_lock); 1198 mutex_unlock(&hci_cb_list_lock);
1214} 1199}
1215 1200
1216static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type) 1201static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
@@ -1296,8 +1281,6 @@ static inline int hci_check_conn_params(u16 min, u16 max, u16 latency,
1296int hci_register_cb(struct hci_cb *hcb); 1281int hci_register_cb(struct hci_cb *hcb);
1297int hci_unregister_cb(struct hci_cb *hcb); 1282int hci_unregister_cb(struct hci_cb *hcb);
1298 1283
1299bool hci_req_pending(struct hci_dev *hdev);
1300
1301struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, 1284struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen,
1302 const void *param, u32 timeout); 1285 const void *param, u32 timeout);
1303struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, 1286struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen,
@@ -1312,11 +1295,35 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
1312 1295
1313/* ----- HCI Sockets ----- */ 1296/* ----- HCI Sockets ----- */
1314void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb); 1297void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb);
1315void hci_send_to_control(struct sk_buff *skb, struct sock *skip_sk); 1298void hci_send_to_channel(unsigned short channel, struct sk_buff *skb,
1299 int flag, struct sock *skip_sk);
1316void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb); 1300void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb);
1317 1301
1318void hci_sock_dev_event(struct hci_dev *hdev, int event); 1302void hci_sock_dev_event(struct hci_dev *hdev, int event);
1319 1303
1304#define HCI_MGMT_VAR_LEN BIT(0)
1305#define HCI_MGMT_NO_HDEV BIT(1)
1306#define HCI_MGMT_UNTRUSTED BIT(2)
1307#define HCI_MGMT_UNCONFIGURED BIT(3)
1308
1309struct hci_mgmt_handler {
1310 int (*func) (struct sock *sk, struct hci_dev *hdev, void *data,
1311 u16 data_len);
1312 size_t data_len;
1313 unsigned long flags;
1314};
1315
1316struct hci_mgmt_chan {
1317 struct list_head list;
1318 unsigned short channel;
1319 size_t handler_count;
1320 const struct hci_mgmt_handler *handlers;
1321 void (*hdev_init) (struct sock *sk, struct hci_dev *hdev);
1322};
1323
1324int hci_mgmt_chan_register(struct hci_mgmt_chan *c);
1325void hci_mgmt_chan_unregister(struct hci_mgmt_chan *c);
1326
1320/* Management interface */ 1327/* Management interface */
1321#define DISCOV_TYPE_BREDR (BIT(BDADDR_BREDR)) 1328#define DISCOV_TYPE_BREDR (BIT(BDADDR_BREDR))
1322#define DISCOV_TYPE_LE (BIT(BDADDR_LE_PUBLIC) | \ 1329#define DISCOV_TYPE_LE (BIT(BDADDR_LE_PUBLIC) | \
@@ -1336,7 +1343,6 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
1336#define DISCOV_BREDR_INQUIRY_LEN 0x08 1343#define DISCOV_BREDR_INQUIRY_LEN 0x08
1337#define DISCOV_LE_RESTART_DELAY msecs_to_jiffies(200) /* msec */ 1344#define DISCOV_LE_RESTART_DELAY msecs_to_jiffies(200) /* msec */
1338 1345
1339int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
1340int mgmt_new_settings(struct hci_dev *hdev); 1346int mgmt_new_settings(struct hci_dev *hdev);
1341void mgmt_index_added(struct hci_dev *hdev); 1347void mgmt_index_added(struct hci_dev *hdev);
1342void mgmt_index_removed(struct hci_dev *hdev); 1348void mgmt_index_removed(struct hci_dev *hdev);
@@ -1382,9 +1388,6 @@ void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1382void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, 1388void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1383 u8 status); 1389 u8 status);
1384void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1390void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
1385void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
1386 u8 *rand192, u8 *hash256, u8 *rand256,
1387 u8 status);
1388void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1391void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1389 u8 addr_type, u8 *dev_class, s8 rssi, u32 flags, 1392 u8 addr_type, u8 *dev_class, s8 rssi, u32 flags,
1390 u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len); 1393 u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len);
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index e218a30f2061..b831242d48a4 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -43,6 +43,8 @@
43#define MGMT_STATUS_CANCELLED 0x10 43#define MGMT_STATUS_CANCELLED 0x10
44#define MGMT_STATUS_INVALID_INDEX 0x11 44#define MGMT_STATUS_INVALID_INDEX 0x11
45#define MGMT_STATUS_RFKILLED 0x12 45#define MGMT_STATUS_RFKILLED 0x12
46#define MGMT_STATUS_ALREADY_PAIRED 0x13
47#define MGMT_STATUS_PERMISSION_DENIED 0x14
46 48
47struct mgmt_hdr { 49struct mgmt_hdr {
48 __le16 opcode; 50 __le16 opcode;
@@ -98,6 +100,7 @@ struct mgmt_rp_read_index_list {
98#define MGMT_SETTING_DEBUG_KEYS 0x00001000 100#define MGMT_SETTING_DEBUG_KEYS 0x00001000
99#define MGMT_SETTING_PRIVACY 0x00002000 101#define MGMT_SETTING_PRIVACY 0x00002000
100#define MGMT_SETTING_CONFIGURATION 0x00004000 102#define MGMT_SETTING_CONFIGURATION 0x00004000
103#define MGMT_SETTING_STATIC_ADDRESS 0x00008000
101 104
102#define MGMT_OP_READ_INFO 0x0004 105#define MGMT_OP_READ_INFO 0x0004
103#define MGMT_READ_INFO_SIZE 0 106#define MGMT_READ_INFO_SIZE 0
@@ -503,6 +506,71 @@ struct mgmt_cp_start_service_discovery {
503} __packed; 506} __packed;
504#define MGMT_START_SERVICE_DISCOVERY_SIZE 4 507#define MGMT_START_SERVICE_DISCOVERY_SIZE 4
505 508
509#define MGMT_OP_READ_LOCAL_OOB_EXT_DATA 0x003B
510struct mgmt_cp_read_local_oob_ext_data {
511 __u8 type;
512} __packed;
513#define MGMT_READ_LOCAL_OOB_EXT_DATA_SIZE 1
514struct mgmt_rp_read_local_oob_ext_data {
515 __u8 type;
516 __le16 eir_len;
517 __u8 eir[0];
518} __packed;
519
520#define MGMT_OP_READ_EXT_INDEX_LIST 0x003C
521#define MGMT_READ_EXT_INDEX_LIST_SIZE 0
522struct mgmt_rp_read_ext_index_list {
523 __le16 num_controllers;
524 struct {
525 __le16 index;
526 __u8 type;
527 __u8 bus;
528 } entry[0];
529} __packed;
530
531#define MGMT_OP_READ_ADV_FEATURES 0x0003D
532#define MGMT_READ_ADV_FEATURES_SIZE 0
533struct mgmt_rp_read_adv_features {
534 __le32 supported_flags;
535 __u8 max_adv_data_len;
536 __u8 max_scan_rsp_len;
537 __u8 max_instances;
538 __u8 num_instances;
539 __u8 instance[0];
540} __packed;
541
542#define MGMT_OP_ADD_ADVERTISING 0x003E
543struct mgmt_cp_add_advertising {
544 __u8 instance;
545 __le32 flags;
546 __le16 duration;
547 __le16 timeout;
548 __u8 adv_data_len;
549 __u8 scan_rsp_len;
550 __u8 data[0];
551} __packed;
552#define MGMT_ADD_ADVERTISING_SIZE 11
553struct mgmt_rp_add_advertising {
554 __u8 instance;
555} __packed;
556
557#define MGMT_ADV_FLAG_CONNECTABLE BIT(0)
558#define MGMT_ADV_FLAG_DISCOV BIT(1)
559#define MGMT_ADV_FLAG_LIMITED_DISCOV BIT(2)
560#define MGMT_ADV_FLAG_MANAGED_FLAGS BIT(3)
561#define MGMT_ADV_FLAG_TX_POWER BIT(4)
562#define MGMT_ADV_FLAG_APPEARANCE BIT(5)
563#define MGMT_ADV_FLAG_LOCAL_NAME BIT(6)
564
565#define MGMT_OP_REMOVE_ADVERTISING 0x003F
566struct mgmt_cp_remove_advertising {
567 __u8 instance;
568} __packed;
569#define MGMT_REMOVE_ADVERTISING_SIZE 1
570struct mgmt_rp_remove_advertising {
571 __u8 instance;
572} __packed;
573
506#define MGMT_EV_CMD_COMPLETE 0x0001 574#define MGMT_EV_CMD_COMPLETE 0x0001
507struct mgmt_ev_cmd_complete { 575struct mgmt_ev_cmd_complete {
508 __le16 opcode; 576 __le16 opcode;
@@ -647,9 +715,14 @@ struct mgmt_ev_new_irk {
647 struct mgmt_irk_info irk; 715 struct mgmt_irk_info irk;
648} __packed; 716} __packed;
649 717
718#define MGMT_CSRK_LOCAL_UNAUTHENTICATED 0x00
719#define MGMT_CSRK_REMOTE_UNAUTHENTICATED 0x01
720#define MGMT_CSRK_LOCAL_AUTHENTICATED 0x02
721#define MGMT_CSRK_REMOTE_AUTHENTICATED 0x03
722
650struct mgmt_csrk_info { 723struct mgmt_csrk_info {
651 struct mgmt_addr_info addr; 724 struct mgmt_addr_info addr;
652 __u8 master; 725 __u8 type;
653 __u8 val[16]; 726 __u8 val[16];
654} __packed; 727} __packed;
655 728
@@ -685,3 +758,29 @@ struct mgmt_ev_new_conn_param {
685#define MGMT_EV_UNCONF_INDEX_REMOVED 0x001e 758#define MGMT_EV_UNCONF_INDEX_REMOVED 0x001e
686 759
687#define MGMT_EV_NEW_CONFIG_OPTIONS 0x001f 760#define MGMT_EV_NEW_CONFIG_OPTIONS 0x001f
761
762struct mgmt_ev_ext_index {
763 __u8 type;
764 __u8 bus;
765} __packed;
766
767#define MGMT_EV_EXT_INDEX_ADDED 0x0020
768
769#define MGMT_EV_EXT_INDEX_REMOVED 0x0021
770
771#define MGMT_EV_LOCAL_OOB_DATA_UPDATED 0x0022
772struct mgmt_ev_local_oob_data_updated {
773 __u8 type;
774 __le16 eir_len;
775 __u8 eir[0];
776} __packed;
777
778#define MGMT_EV_ADVERTISING_ADDED 0x0023
779struct mgmt_ev_advertising_added {
780 __u8 instance;
781} __packed;
782
783#define MGMT_EV_ADVERTISING_REMOVED 0x0024
784struct mgmt_ev_advertising_removed {
785 __u8 instance;
786} __packed;
diff --git a/include/net/bond_3ad.h b/include/net/bond_3ad.h
index f04cdbb7848e..c2a40a172fcd 100644
--- a/include/net/bond_3ad.h
+++ b/include/net/bond_3ad.h
@@ -82,6 +82,13 @@ typedef enum {
82 AD_TRANSMIT /* tx Machine */ 82 AD_TRANSMIT /* tx Machine */
83} tx_states_t; 83} tx_states_t;
84 84
85/* churn machine states(43.4.17 in the 802.3ad standard) */
86typedef enum {
87 AD_CHURN_MONITOR, /* monitoring for churn */
88 AD_CHURN, /* churn detected (error) */
89 AD_NO_CHURN /* no churn (no error) */
90} churn_state_t;
91
85/* rx indication types */ 92/* rx indication types */
86typedef enum { 93typedef enum {
87 AD_TYPE_LACPDU = 1, /* type lacpdu */ 94 AD_TYPE_LACPDU = 1, /* type lacpdu */
@@ -229,6 +236,12 @@ typedef struct port {
229 u16 sm_mux_timer_counter; /* state machine mux timer counter */ 236 u16 sm_mux_timer_counter; /* state machine mux timer counter */
230 tx_states_t sm_tx_state; /* state machine tx state */ 237 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) */ 238 u16 sm_tx_timer_counter; /* state machine tx timer counter(allways on - enter to transmit state 3 time per second) */
239 u16 sm_churn_actor_timer_counter;
240 u16 sm_churn_partner_timer_counter;
241 u32 churn_actor_count;
242 u32 churn_partner_count;
243 churn_state_t sm_churn_actor_state;
244 churn_state_t sm_churn_partner_state;
232 struct slave *slave; /* pointer to the bond slave that this port belongs to */ 245 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 */ 246 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 */ 247 struct port *next_port_in_aggregator; /* Next port on the linked list of the parent aggregator */
@@ -262,6 +275,22 @@ struct ad_slave_info {
262 u16 id; 275 u16 id;
263}; 276};
264 277
278static inline const char *bond_3ad_churn_desc(churn_state_t state)
279{
280 static const char *const churn_description[] = {
281 "monitoring",
282 "churned",
283 "none",
284 "unknown"
285 };
286 int max_size = sizeof(churn_description) / sizeof(churn_description[0]);
287
288 if (state >= max_size)
289 state = max_size - 1;
290
291 return churn_description[state];
292}
293
265/* ========== AD Exported functions to the main bonding code ========== */ 294/* ========== AD Exported functions to the main bonding code ========== */
266void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution); 295void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution);
267void bond_3ad_bind_slave(struct slave *slave); 296void bond_3ad_bind_slave(struct slave *slave);
diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h
index 1c1ad46250d5..fe328c52c46b 100644
--- a/include/net/caif/cfpkt.h
+++ b/include/net/caif/cfpkt.h
@@ -171,7 +171,7 @@ struct cfpkt *cfpkt_split(struct cfpkt *pkt, u16 pos);
171 * @return Checksum of buffer. 171 * @return Checksum of buffer.
172 */ 172 */
173 173
174u16 cfpkt_iterate(struct cfpkt *pkt, 174int cfpkt_iterate(struct cfpkt *pkt,
175 u16 (*iter_func)(u16 chks, void *buf, u16 len), 175 u16 (*iter_func)(u16 chks, void *buf, u16 len),
176 u16 data); 176 u16 data);
177 177
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 64e09e1e8099..f8d6813cd5b2 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -215,6 +215,39 @@ enum ieee80211_rate_flags {
215}; 215};
216 216
217/** 217/**
218 * enum ieee80211_bss_type - BSS type filter
219 *
220 * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
221 * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
222 * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
223 * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
224 * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
225 */
226enum ieee80211_bss_type {
227 IEEE80211_BSS_TYPE_ESS,
228 IEEE80211_BSS_TYPE_PBSS,
229 IEEE80211_BSS_TYPE_IBSS,
230 IEEE80211_BSS_TYPE_MBSS,
231 IEEE80211_BSS_TYPE_ANY
232};
233
234/**
235 * enum ieee80211_privacy - BSS privacy filter
236 *
237 * @IEEE80211_PRIVACY_ON: privacy bit set
238 * @IEEE80211_PRIVACY_OFF: privacy bit clear
239 * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
240 */
241enum ieee80211_privacy {
242 IEEE80211_PRIVACY_ON,
243 IEEE80211_PRIVACY_OFF,
244 IEEE80211_PRIVACY_ANY
245};
246
247#define IEEE80211_PRIVACY(x) \
248 ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
249
250/**
218 * struct ieee80211_rate - bitrate definition 251 * struct ieee80211_rate - bitrate definition
219 * 252 *
220 * This structure describes a bitrate that an 802.11 PHY can 253 * This structure describes a bitrate that an 802.11 PHY can
@@ -2423,6 +2456,7 @@ struct cfg80211_ops {
2423 2456
2424 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 2457 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
2425 const char *name, 2458 const char *name,
2459 unsigned char name_assign_type,
2426 enum nl80211_iftype type, 2460 enum nl80211_iftype type,
2427 u32 *flags, 2461 u32 *flags,
2428 struct vif_params *params); 2462 struct vif_params *params);
@@ -3183,10 +3217,8 @@ struct wiphy {
3183 const struct ieee80211_ht_cap *ht_capa_mod_mask; 3217 const struct ieee80211_ht_cap *ht_capa_mod_mask;
3184 const struct ieee80211_vht_cap *vht_capa_mod_mask; 3218 const struct ieee80211_vht_cap *vht_capa_mod_mask;
3185 3219
3186#ifdef CONFIG_NET_NS
3187 /* the network namespace this phy lives in currently */ 3220 /* the network namespace this phy lives in currently */
3188 struct net *_net; 3221 possible_net_t _net;
3189#endif
3190 3222
3191#ifdef CONFIG_CFG80211_WEXT 3223#ifdef CONFIG_CFG80211_WEXT
3192 const struct iw_handler_def *wext; 3224 const struct iw_handler_def *wext;
@@ -4012,14 +4044,16 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
4012 struct ieee80211_channel *channel, 4044 struct ieee80211_channel *channel,
4013 const u8 *bssid, 4045 const u8 *bssid,
4014 const u8 *ssid, size_t ssid_len, 4046 const u8 *ssid, size_t ssid_len,
4015 u16 capa_mask, u16 capa_val); 4047 enum ieee80211_bss_type bss_type,
4048 enum ieee80211_privacy);
4016static inline struct cfg80211_bss * 4049static inline struct cfg80211_bss *
4017cfg80211_get_ibss(struct wiphy *wiphy, 4050cfg80211_get_ibss(struct wiphy *wiphy,
4018 struct ieee80211_channel *channel, 4051 struct ieee80211_channel *channel,
4019 const u8 *ssid, size_t ssid_len) 4052 const u8 *ssid, size_t ssid_len)
4020{ 4053{
4021 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 4054 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
4022 WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); 4055 IEEE80211_BSS_TYPE_IBSS,
4056 IEEE80211_PRIVACY_ANY);
4023} 4057}
4024 4058
4025/** 4059/**
@@ -4260,6 +4294,7 @@ struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
4260 int approxlen); 4294 int approxlen);
4261 4295
4262struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy, 4296struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
4297 struct wireless_dev *wdev,
4263 enum nl80211_commands cmd, 4298 enum nl80211_commands cmd,
4264 enum nl80211_attrs attr, 4299 enum nl80211_attrs attr,
4265 int vendor_event_idx, 4300 int vendor_event_idx,
@@ -4314,6 +4349,7 @@ int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
4314/** 4349/**
4315 * cfg80211_vendor_event_alloc - allocate vendor-specific event skb 4350 * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
4316 * @wiphy: the wiphy 4351 * @wiphy: the wiphy
4352 * @wdev: the wireless device
4317 * @event_idx: index of the vendor event in the wiphy's vendor_events 4353 * @event_idx: index of the vendor event in the wiphy's vendor_events
4318 * @approxlen: an upper bound of the length of the data that will 4354 * @approxlen: an upper bound of the length of the data that will
4319 * be put into the skb 4355 * be put into the skb
@@ -4322,16 +4358,20 @@ int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
4322 * This function allocates and pre-fills an skb for an event on the 4358 * This function allocates and pre-fills an skb for an event on the
4323 * vendor-specific multicast group. 4359 * vendor-specific multicast group.
4324 * 4360 *
4361 * If wdev != NULL, both the ifindex and identifier of the specified
4362 * wireless device are added to the event message before the vendor data
4363 * attribute.
4364 *
4325 * When done filling the skb, call cfg80211_vendor_event() with the 4365 * When done filling the skb, call cfg80211_vendor_event() with the
4326 * skb to send the event. 4366 * skb to send the event.
4327 * 4367 *
4328 * Return: An allocated and pre-filled skb. %NULL if any errors happen. 4368 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
4329 */ 4369 */
4330static inline struct sk_buff * 4370static inline struct sk_buff *
4331cfg80211_vendor_event_alloc(struct wiphy *wiphy, int approxlen, 4371cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
4332 int event_idx, gfp_t gfp) 4372 int approxlen, int event_idx, gfp_t gfp)
4333{ 4373{
4334 return __cfg80211_alloc_event_skb(wiphy, NL80211_CMD_VENDOR, 4374 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
4335 NL80211_ATTR_VENDOR_DATA, 4375 NL80211_ATTR_VENDOR_DATA,
4336 event_idx, approxlen, gfp); 4376 event_idx, approxlen, gfp);
4337} 4377}
@@ -4432,7 +4472,7 @@ static inline int cfg80211_testmode_reply(struct sk_buff *skb)
4432static inline struct sk_buff * 4472static inline struct sk_buff *
4433cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp) 4473cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
4434{ 4474{
4435 return __cfg80211_alloc_event_skb(wiphy, NL80211_CMD_TESTMODE, 4475 return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
4436 NL80211_ATTR_TESTDATA, -1, 4476 NL80211_ATTR_TESTDATA, -1,
4437 approxlen, gfp); 4477 approxlen, gfp);
4438} 4478}
@@ -4862,6 +4902,17 @@ void cfg80211_ch_switch_started_notify(struct net_device *dev,
4862bool ieee80211_operating_class_to_band(u8 operating_class, 4902bool ieee80211_operating_class_to_band(u8 operating_class,
4863 enum ieee80211_band *band); 4903 enum ieee80211_band *band);
4864 4904
4905/**
4906 * ieee80211_chandef_to_operating_class - convert chandef to operation class
4907 *
4908 * @chandef: the chandef to convert
4909 * @op_class: a pointer to the resulting operating class
4910 *
4911 * Returns %true if the conversion was successful, %false otherwise.
4912 */
4913bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
4914 u8 *op_class);
4915
4865/* 4916/*
4866 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation 4917 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
4867 * @dev: the device on which the operation is requested 4918 * @dev: the device on which the operation is requested
@@ -4950,6 +5001,64 @@ int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
4950 u8 *buf, unsigned int bufsize); 5001 u8 *buf, unsigned int bufsize);
4951 5002
4952/** 5003/**
5004 * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
5005 * @ies: the IE buffer
5006 * @ielen: the length of the IE buffer
5007 * @ids: an array with element IDs that are allowed before
5008 * the split
5009 * @n_ids: the size of the element ID array
5010 * @after_ric: array IE types that come after the RIC element
5011 * @n_after_ric: size of the @after_ric array
5012 * @offset: offset where to start splitting in the buffer
5013 *
5014 * This function splits an IE buffer by updating the @offset
5015 * variable to point to the location where the buffer should be
5016 * split.
5017 *
5018 * It assumes that the given IE buffer is well-formed, this
5019 * has to be guaranteed by the caller!
5020 *
5021 * It also assumes that the IEs in the buffer are ordered
5022 * correctly, if not the result of using this function will not
5023 * be ordered correctly either, i.e. it does no reordering.
5024 *
5025 * The function returns the offset where the next part of the
5026 * buffer starts, which may be @ielen if the entire (remainder)
5027 * of the buffer should be used.
5028 */
5029size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
5030 const u8 *ids, int n_ids,
5031 const u8 *after_ric, int n_after_ric,
5032 size_t offset);
5033
5034/**
5035 * ieee80211_ie_split - split an IE buffer according to ordering
5036 * @ies: the IE buffer
5037 * @ielen: the length of the IE buffer
5038 * @ids: an array with element IDs that are allowed before
5039 * the split
5040 * @n_ids: the size of the element ID array
5041 * @offset: offset where to start splitting in the buffer
5042 *
5043 * This function splits an IE buffer by updating the @offset
5044 * variable to point to the location where the buffer should be
5045 * split.
5046 *
5047 * It assumes that the given IE buffer is well-formed, this
5048 * has to be guaranteed by the caller!
5049 *
5050 * It also assumes that the IEs in the buffer are ordered
5051 * correctly, if not the result of using this function will not
5052 * be ordered correctly either, i.e. it does no reordering.
5053 *
5054 * The function returns the offset where the next part of the
5055 * buffer starts, which may be @ielen if the entire (remainder)
5056 * of the buffer should be used.
5057 */
5058size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
5059 const u8 *ids, int n_ids, size_t offset);
5060
5061/**
4953 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN 5062 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
4954 * @wdev: the wireless device reporting the wakeup 5063 * @wdev: the wireless device reporting the wakeup
4955 * @wakeup: the wakeup report 5064 * @wakeup: the wakeup report
diff --git a/include/net/compat.h b/include/net/compat.h
index 42a9c8431177..48103cf94e97 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -40,7 +40,7 @@ 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
43ssize_t get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *, 43int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *,
44 struct sockaddr __user **, struct iovec **); 44 struct sockaddr __user **, struct iovec **);
45asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *, 45asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *,
46 unsigned int); 46 unsigned int);
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index 597b88a94332..207d9ba1f92c 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -49,6 +49,9 @@ struct dcbnl_rtnl_ops {
49 int (*ieee_setets) (struct net_device *, struct ieee_ets *); 49 int (*ieee_setets) (struct net_device *, struct ieee_ets *);
50 int (*ieee_getmaxrate) (struct net_device *, struct ieee_maxrate *); 50 int (*ieee_getmaxrate) (struct net_device *, struct ieee_maxrate *);
51 int (*ieee_setmaxrate) (struct net_device *, struct ieee_maxrate *); 51 int (*ieee_setmaxrate) (struct net_device *, struct ieee_maxrate *);
52 int (*ieee_getqcn) (struct net_device *, struct ieee_qcn *);
53 int (*ieee_setqcn) (struct net_device *, struct ieee_qcn *);
54 int (*ieee_getqcnstats) (struct net_device *, struct ieee_qcn_stats *);
52 int (*ieee_getpfc) (struct net_device *, struct ieee_pfc *); 55 int (*ieee_getpfc) (struct net_device *, struct ieee_pfc *);
53 int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *); 56 int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *);
54 int (*ieee_getapp) (struct net_device *, struct dcb_app *); 57 int (*ieee_getapp) (struct net_device *, struct dcb_app *);
diff --git a/include/net/dn_neigh.h b/include/net/dn_neigh.h
index fac4e3f4a6d3..d0424269313f 100644
--- a/include/net/dn_neigh.h
+++ b/include/net/dn_neigh.h
@@ -18,10 +18,11 @@ struct dn_neigh {
18 18
19void dn_neigh_init(void); 19void dn_neigh_init(void);
20void dn_neigh_cleanup(void); 20void dn_neigh_cleanup(void);
21int dn_neigh_router_hello(struct sk_buff *skb); 21int dn_neigh_router_hello(struct sock *sk, struct sk_buff *skb);
22int dn_neigh_endnode_hello(struct sk_buff *skb); 22int dn_neigh_endnode_hello(struct sock *sk, struct sk_buff *skb);
23void dn_neigh_pointopoint_hello(struct sk_buff *skb); 23void dn_neigh_pointopoint_hello(struct sk_buff *skb);
24int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n); 24int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n);
25int dn_to_neigh_output(struct sock *sk, struct sk_buff *skb);
25 26
26extern struct neigh_table dn_neigh_table; 27extern struct neigh_table dn_neigh_table;
27 28
diff --git a/include/net/dsa.h b/include/net/dsa.h
index ed3c34bbb67a..fbca63ba8f73 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -72,6 +72,7 @@ struct dsa_platform_data {
72 * to the root switch chip of the tree. 72 * to the root switch chip of the tree.
73 */ 73 */
74 struct device *netdev; 74 struct device *netdev;
75 struct net_device *of_netdev;
75 76
76 /* 77 /*
77 * Info structs describing each of the switch chips 78 * Info structs describing each of the switch chips
@@ -128,6 +129,11 @@ struct dsa_switch {
128 int index; 129 int index;
129 130
130 /* 131 /*
132 * Tagging protocol understood by this switch
133 */
134 enum dsa_tag_protocol tag_protocol;
135
136 /*
131 * Configuration data for this switch. 137 * Configuration data for this switch.
132 */ 138 */
133 struct dsa_chip_data *pd; 139 struct dsa_chip_data *pd;
@@ -165,6 +171,11 @@ static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p)
165 return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port); 171 return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port);
166} 172}
167 173
174static inline bool dsa_is_port_initialized(struct dsa_switch *ds, int p)
175{
176 return ds->phys_port_mask & (1 << p) && ds->ports[p];
177}
178
168static inline u8 dsa_upstream_port(struct dsa_switch *ds) 179static inline u8 dsa_upstream_port(struct dsa_switch *ds)
169{ 180{
170 struct dsa_switch_tree *dst = ds->dst; 181 struct dsa_switch_tree *dst = ds->dst;
@@ -275,6 +286,22 @@ struct dsa_switch_driver {
275 int (*get_regs_len)(struct dsa_switch *ds, int port); 286 int (*get_regs_len)(struct dsa_switch *ds, int port);
276 void (*get_regs)(struct dsa_switch *ds, int port, 287 void (*get_regs)(struct dsa_switch *ds, int port,
277 struct ethtool_regs *regs, void *p); 288 struct ethtool_regs *regs, void *p);
289
290 /*
291 * Bridge integration
292 */
293 int (*port_join_bridge)(struct dsa_switch *ds, int port,
294 u32 br_port_mask);
295 int (*port_leave_bridge)(struct dsa_switch *ds, int port,
296 u32 br_port_mask);
297 int (*port_stp_update)(struct dsa_switch *ds, int port,
298 u8 state);
299 int (*fdb_add)(struct dsa_switch *ds, int port,
300 const unsigned char *addr, u16 vid);
301 int (*fdb_del)(struct dsa_switch *ds, int port,
302 const unsigned char *addr, u16 vid);
303 int (*fdb_getnext)(struct dsa_switch *ds, int port,
304 unsigned char *addr, bool *is_static);
278}; 305};
279 306
280void register_switch_driver(struct dsa_switch_driver *type); 307void register_switch_driver(struct dsa_switch_driver *type);
diff --git a/include/net/dst.h b/include/net/dst.h
index a8ae4e760778..0fb99a26e973 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -481,6 +481,7 @@ void dst_init(void);
481enum { 481enum {
482 XFRM_LOOKUP_ICMP = 1 << 0, 482 XFRM_LOOKUP_ICMP = 1 << 0,
483 XFRM_LOOKUP_QUEUE = 1 << 1, 483 XFRM_LOOKUP_QUEUE = 1 << 1,
484 XFRM_LOOKUP_KEEP_DST_REF = 1 << 2,
484}; 485};
485 486
486struct flowi; 487struct flowi;
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
index 1f99a1de0e4f..d64253914a6a 100644
--- a/include/net/dst_ops.h
+++ b/include/net/dst_ops.h
@@ -12,7 +12,6 @@ struct sock;
12 12
13struct dst_ops { 13struct dst_ops {
14 unsigned short family; 14 unsigned short family;
15 __be16 protocol;
16 unsigned int gc_thresh; 15 unsigned int gc_thresh;
17 16
18 int (*gc)(struct dst_ops *ops); 17 int (*gc)(struct dst_ops *ops);
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index e584de16e4c3..6d67383a5114 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -58,7 +58,7 @@ struct fib_rules_ops {
58 struct sk_buff *, 58 struct sk_buff *,
59 struct fib_rule_hdr *, 59 struct fib_rule_hdr *,
60 struct nlattr **); 60 struct nlattr **);
61 void (*delete)(struct fib_rule *); 61 int (*delete)(struct fib_rule *);
62 int (*compare)(struct fib_rule *, 62 int (*compare)(struct fib_rule *,
63 struct fib_rule_hdr *, 63 struct fib_rule_hdr *,
64 struct nlattr **); 64 struct nlattr **);
@@ -95,17 +95,10 @@ static inline void fib_rule_get(struct fib_rule *rule)
95 atomic_inc(&rule->refcnt); 95 atomic_inc(&rule->refcnt);
96} 96}
97 97
98static inline void fib_rule_put_rcu(struct rcu_head *head)
99{
100 struct fib_rule *rule = container_of(head, struct fib_rule, rcu);
101 release_net(rule->fr_net);
102 kfree(rule);
103}
104
105static inline void fib_rule_put(struct fib_rule *rule) 98static inline void fib_rule_put(struct fib_rule *rule)
106{ 99{
107 if (atomic_dec_and_test(&rule->refcnt)) 100 if (atomic_dec_and_test(&rule->refcnt))
108 call_rcu(&rule->rcu, fib_rule_put_rcu); 101 kfree_rcu(rule, rcu);
109} 102}
110 103
111static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla) 104static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla)
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 0574abd3db86..a9af1cc8c1bc 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -92,9 +92,7 @@ struct genl_info {
92 struct genlmsghdr * genlhdr; 92 struct genlmsghdr * genlhdr;
93 void * userhdr; 93 void * userhdr;
94 struct nlattr ** attrs; 94 struct nlattr ** attrs;
95#ifdef CONFIG_NET_NS 95 possible_net_t _net;
96 struct net * _net;
97#endif
98 void * user_ptr[2]; 96 void * user_ptr[2];
99 struct sock * dst_sk; 97 struct sock * dst_sk;
100}; 98};
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 98e5f9578f86..1c8b6820b694 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -41,18 +41,18 @@ enum {
41struct inet6_ifaddr { 41struct inet6_ifaddr {
42 struct in6_addr addr; 42 struct in6_addr addr;
43 __u32 prefix_len; 43 __u32 prefix_len;
44 44
45 /* In seconds, relative to tstamp. Expiry is at tstamp + HZ * lft. */ 45 /* In seconds, relative to tstamp. Expiry is at tstamp + HZ * lft. */
46 __u32 valid_lft; 46 __u32 valid_lft;
47 __u32 prefered_lft; 47 __u32 prefered_lft;
48 atomic_t refcnt; 48 atomic_t refcnt;
49 spinlock_t lock; 49 spinlock_t lock;
50 spinlock_t state_lock;
51 50
52 int state; 51 int state;
53 52
54 __u32 flags; 53 __u32 flags;
55 __u8 dad_probes; 54 __u8 dad_probes;
55 __u8 stable_privacy_retry;
56 56
57 __u16 scope; 57 __u16 scope;
58 58
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index 74af137304be..6d539e4e5ba7 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -28,8 +28,7 @@ int inet6_csk_bind_conflict(const struct sock *sk,
28struct dst_entry *inet6_csk_route_req(struct sock *sk, struct flowi6 *fl6, 28struct dst_entry *inet6_csk_route_req(struct sock *sk, struct flowi6 *fl6,
29 const struct request_sock *req); 29 const struct request_sock *req);
30 30
31struct request_sock *inet6_csk_search_req(const struct sock *sk, 31struct request_sock *inet6_csk_search_req(struct sock *sk,
32 struct request_sock ***prevp,
33 const __be16 rport, 32 const __be16 rport,
34 const struct in6_addr *raddr, 33 const struct in6_addr *raddr,
35 const struct in6_addr *laddr, 34 const struct in6_addr *laddr,
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 9201afe083fa..7ff588ca6817 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -38,8 +38,6 @@ static inline unsigned int __inet6_ehashfn(const u32 lhash,
38 return jhash_3words(lhash, fhash, ports, initval); 38 return jhash_3words(lhash, fhash, ports, initval);
39} 39}
40 40
41int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp);
42
43/* 41/*
44 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so 42 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
45 * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM 43 * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index b2828a06a5a6..4a92423eefa5 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -21,12 +21,11 @@ int __inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
21int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr, 21int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr,
22 int addr_len, int flags); 22 int addr_len, int flags);
23int inet_accept(struct socket *sock, struct socket *newsock, int flags); 23int inet_accept(struct socket *sock, struct socket *newsock, int flags);
24int inet_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, 24int inet_sendmsg(struct socket *sock, struct msghdr *msg, size_t size);
25 size_t size);
26ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, 25ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
27 size_t size, int flags); 26 size_t size, int flags);
28int inet_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, 27int inet_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
29 size_t size, int flags); 28 int flags);
30int inet_shutdown(struct socket *sock, int how); 29int inet_shutdown(struct socket *sock, int how);
31int inet_listen(struct socket *sock, int backlog); 30int inet_listen(struct socket *sock, int backlog);
32void inet_sock_destruct(struct sock *sk); 31void inet_sock_destruct(struct sock *sk);
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 5976bdecf58b..7b5887cd1172 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -126,6 +126,8 @@ struct inet_connection_sock {
126 126
127 /* Information on the current probe. */ 127 /* Information on the current probe. */
128 int probe_size; 128 int probe_size;
129
130 u32 probe_timestamp;
129 } icsk_mtup; 131 } icsk_mtup;
130 u32 icsk_ca_priv[16]; 132 u32 icsk_ca_priv[16];
131 u32 icsk_user_timeout; 133 u32 icsk_user_timeout;
@@ -254,8 +256,7 @@ inet_csk_rto_backoff(const struct inet_connection_sock *icsk,
254 256
255struct sock *inet_csk_accept(struct sock *sk, int flags, int *err); 257struct sock *inet_csk_accept(struct sock *sk, int flags, int *err);
256 258
257struct request_sock *inet_csk_search_req(const struct sock *sk, 259struct request_sock *inet_csk_search_req(struct sock *sk,
258 struct request_sock ***prevp,
259 const __be16 rport, 260 const __be16 rport,
260 const __be32 raddr, 261 const __be32 raddr,
261 const __be32 laddr); 262 const __be32 laddr);
@@ -281,15 +282,13 @@ void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req,
281static inline void inet_csk_reqsk_queue_removed(struct sock *sk, 282static inline void inet_csk_reqsk_queue_removed(struct sock *sk,
282 struct request_sock *req) 283 struct request_sock *req)
283{ 284{
284 if (reqsk_queue_removed(&inet_csk(sk)->icsk_accept_queue, req) == 0) 285 reqsk_queue_removed(&inet_csk(sk)->icsk_accept_queue, req);
285 inet_csk_delete_keepalive_timer(sk);
286} 286}
287 287
288static inline void inet_csk_reqsk_queue_added(struct sock *sk, 288static inline void inet_csk_reqsk_queue_added(struct sock *sk,
289 const unsigned long timeout) 289 const unsigned long timeout)
290{ 290{
291 if (reqsk_queue_added(&inet_csk(sk)->icsk_accept_queue) == 0) 291 reqsk_queue_added(&inet_csk(sk)->icsk_accept_queue);
292 inet_csk_reset_keepalive_timer(sk, timeout);
293} 292}
294 293
295static inline int inet_csk_reqsk_queue_len(const struct sock *sk) 294static inline int inet_csk_reqsk_queue_len(const struct sock *sk)
@@ -308,26 +307,19 @@ static inline int inet_csk_reqsk_queue_is_full(const struct sock *sk)
308} 307}
309 308
310static inline void inet_csk_reqsk_queue_unlink(struct sock *sk, 309static inline void inet_csk_reqsk_queue_unlink(struct sock *sk,
311 struct request_sock *req, 310 struct request_sock *req)
312 struct request_sock **prev)
313{ 311{
314 reqsk_queue_unlink(&inet_csk(sk)->icsk_accept_queue, req, prev); 312 reqsk_queue_unlink(&inet_csk(sk)->icsk_accept_queue, req);
315} 313}
316 314
317static inline void inet_csk_reqsk_queue_drop(struct sock *sk, 315static inline void inet_csk_reqsk_queue_drop(struct sock *sk,
318 struct request_sock *req, 316 struct request_sock *req)
319 struct request_sock **prev)
320{ 317{
321 inet_csk_reqsk_queue_unlink(sk, req, prev); 318 inet_csk_reqsk_queue_unlink(sk, req);
322 inet_csk_reqsk_queue_removed(sk, req); 319 inet_csk_reqsk_queue_removed(sk, req);
323 reqsk_free(req); 320 reqsk_put(req);
324} 321}
325 322
326void inet_csk_reqsk_queue_prune(struct sock *parent,
327 const unsigned long interval,
328 const unsigned long timeout,
329 const unsigned long max_rto);
330
331void inet_csk_destroy_sock(struct sock *sk); 323void inet_csk_destroy_sock(struct sock *sk);
332void inet_csk_prepare_forced_close(struct sock *sk); 324void inet_csk_prepare_forced_close(struct sock *sk);
333 325
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index dd1950a7e273..73fe0f9525d9 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -76,9 +76,7 @@ struct inet_ehash_bucket {
76 * ports are created in O(1) time? I thought so. ;-) -DaveM 76 * ports are created in O(1) time? I thought so. ;-) -DaveM
77 */ 77 */
78struct inet_bind_bucket { 78struct inet_bind_bucket {
79#ifdef CONFIG_NET_NS 79 possible_net_t ib_net;
80 struct net *ib_net;
81#endif
82 unsigned short port; 80 unsigned short port;
83 signed char fastreuse; 81 signed char fastreuse;
84 signed char fastreuseport; 82 signed char fastreuseport;
@@ -223,8 +221,8 @@ inet_bind_bucket_create(struct kmem_cache *cachep, struct net *net,
223void inet_bind_bucket_destroy(struct kmem_cache *cachep, 221void inet_bind_bucket_destroy(struct kmem_cache *cachep,
224 struct inet_bind_bucket *tb); 222 struct inet_bind_bucket *tb);
225 223
226static inline int inet_bhashfn(struct net *net, const __u16 lport, 224static inline u32 inet_bhashfn(const struct net *net, const __u16 lport,
227 const int bhash_size) 225 const u32 bhash_size)
228{ 226{
229 return (lport + net_hash_mix(net)) & (bhash_size - 1); 227 return (lport + net_hash_mix(net)) & (bhash_size - 1);
230} 228}
@@ -233,7 +231,7 @@ void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
233 const unsigned short snum); 231 const unsigned short snum);
234 232
235/* These can have wildcards, don't try too hard. */ 233/* These can have wildcards, don't try too hard. */
236static inline int inet_lhashfn(struct net *net, const unsigned short num) 234static inline u32 inet_lhashfn(const struct net *net, const unsigned short num)
237{ 235{
238 return (num + net_hash_mix(net)) & (INET_LHTABLE_SIZE - 1); 236 return (num + net_hash_mix(net)) & (INET_LHTABLE_SIZE - 1);
239} 237}
@@ -251,6 +249,7 @@ void inet_put_port(struct sock *sk);
251void inet_hashinfo_init(struct inet_hashinfo *h); 249void inet_hashinfo_init(struct inet_hashinfo *h);
252 250
253int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw); 251int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw);
252int __inet_hash(struct sock *sk, struct inet_timewait_sock *tw);
254void inet_hash(struct sock *sk); 253void inet_hash(struct sock *sk);
255void inet_unhash(struct sock *sk); 254void inet_unhash(struct sock *sk);
256 255
@@ -385,13 +384,32 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
385 iph->daddr, dport, inet_iif(skb)); 384 iph->daddr, dport, inet_iif(skb));
386} 385}
387 386
387u32 sk_ehashfn(const struct sock *sk);
388u32 inet6_ehashfn(const struct net *net,
389 const struct in6_addr *laddr, const u16 lport,
390 const struct in6_addr *faddr, const __be16 fport);
391
392static inline void sk_daddr_set(struct sock *sk, __be32 addr)
393{
394 sk->sk_daddr = addr; /* alias of inet_daddr */
395#if IS_ENABLED(CONFIG_IPV6)
396 ipv6_addr_set_v4mapped(addr, &sk->sk_v6_daddr);
397#endif
398}
399
400static inline void sk_rcv_saddr_set(struct sock *sk, __be32 addr)
401{
402 sk->sk_rcv_saddr = addr; /* alias of inet_rcv_saddr */
403#if IS_ENABLED(CONFIG_IPV6)
404 ipv6_addr_set_v4mapped(addr, &sk->sk_v6_rcv_saddr);
405#endif
406}
407
388int __inet_hash_connect(struct inet_timewait_death_row *death_row, 408int __inet_hash_connect(struct inet_timewait_death_row *death_row,
389 struct sock *sk, u32 port_offset, 409 struct sock *sk, u32 port_offset,
390 int (*check_established)(struct inet_timewait_death_row *, 410 int (*check_established)(struct inet_timewait_death_row *,
391 struct sock *, __u16, 411 struct sock *, __u16,
392 struct inet_timewait_sock **), 412 struct inet_timewait_sock **));
393 int (*hash)(struct sock *sk,
394 struct inet_timewait_sock *twp));
395 413
396int inet_hash_connect(struct inet_timewait_death_row *death_row, 414int inet_hash_connect(struct inet_timewait_death_row *death_row,
397 struct sock *sk); 415 struct sock *sk);
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index eb16c7beed1e..b6c3737da4e9 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -27,6 +27,7 @@
27#include <net/sock.h> 27#include <net/sock.h>
28#include <net/request_sock.h> 28#include <net/request_sock.h>
29#include <net/netns/hash.h> 29#include <net/netns/hash.h>
30#include <net/tcp_states.h>
30 31
31/** struct ip_options - IP Options 32/** struct ip_options - IP Options
32 * 33 *
@@ -77,6 +78,10 @@ struct inet_request_sock {
77#define ir_v6_rmt_addr req.__req_common.skc_v6_daddr 78#define ir_v6_rmt_addr req.__req_common.skc_v6_daddr
78#define ir_v6_loc_addr req.__req_common.skc_v6_rcv_saddr 79#define ir_v6_loc_addr req.__req_common.skc_v6_rcv_saddr
79#define ir_iif req.__req_common.skc_bound_dev_if 80#define ir_iif req.__req_common.skc_bound_dev_if
81#define ir_cookie req.__req_common.skc_cookie
82#define ireq_net req.__req_common.skc_net
83#define ireq_state req.__req_common.skc_state
84#define ireq_family req.__req_common.skc_family
80 85
81 kmemcheck_bitfield_begin(flags); 86 kmemcheck_bitfield_begin(flags);
82 u16 snd_wscale : 4, 87 u16 snd_wscale : 4,
@@ -88,11 +93,11 @@ struct inet_request_sock {
88 acked : 1, 93 acked : 1,
89 no_srccheck: 1; 94 no_srccheck: 1;
90 kmemcheck_bitfield_end(flags); 95 kmemcheck_bitfield_end(flags);
96 u32 ir_mark;
91 union { 97 union {
92 struct ip_options_rcu *opt; 98 struct ip_options_rcu *opt;
93 struct sk_buff *pktopts; 99 struct sk_buff *pktopts;
94 }; 100 };
95 u32 ir_mark;
96}; 101};
97 102
98static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) 103static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
@@ -100,13 +105,12 @@ static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
100 return (struct inet_request_sock *)sk; 105 return (struct inet_request_sock *)sk;
101} 106}
102 107
103static inline u32 inet_request_mark(struct sock *sk, struct sk_buff *skb) 108static inline u32 inet_request_mark(const struct sock *sk, struct sk_buff *skb)
104{ 109{
105 if (!sk->sk_mark && sock_net(sk)->ipv4.sysctl_tcp_fwmark_accept) { 110 if (!sk->sk_mark && sock_net(sk)->ipv4.sysctl_tcp_fwmark_accept)
106 return skb->mark; 111 return skb->mark;
107 } else { 112
108 return sk->sk_mark; 113 return sk->sk_mark;
109 }
110} 114}
111 115
112struct inet_cork { 116struct inet_cork {
@@ -239,18 +243,8 @@ static inline unsigned int __inet_ehashfn(const __be32 laddr,
239 initval); 243 initval);
240} 244}
241 245
242static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) 246struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops,
243{ 247 struct sock *sk_listener);
244 struct request_sock *req = reqsk_alloc(ops);
245 struct inet_request_sock *ireq = inet_rsk(req);
246
247 if (req != NULL) {
248 kmemcheck_annotate_bitfield(ireq, flags);
249 ireq->opt = NULL;
250 }
251
252 return req;
253}
254 248
255static inline __u8 inet_sk_flowi_flags(const struct sock *sk) 249static inline __u8 inet_sk_flowi_flags(const struct sock *sk)
256{ 250{
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 6c566034e26d..360c4802288d 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -31,67 +31,14 @@
31 31
32struct inet_hashinfo; 32struct inet_hashinfo;
33 33
34#define INET_TWDR_RECYCLE_SLOTS_LOG 5
35#define INET_TWDR_RECYCLE_SLOTS (1 << INET_TWDR_RECYCLE_SLOTS_LOG)
36
37/*
38 * If time > 4sec, it is "slow" path, no recycling is required,
39 * so that we select tick to get range about 4 seconds.
40 */
41#if HZ <= 16 || HZ > 4096
42# error Unsupported: HZ <= 16 or HZ > 4096
43#elif HZ <= 32
44# define INET_TWDR_RECYCLE_TICK (5 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
45#elif HZ <= 64
46# define INET_TWDR_RECYCLE_TICK (6 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
47#elif HZ <= 128
48# define INET_TWDR_RECYCLE_TICK (7 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
49#elif HZ <= 256
50# define INET_TWDR_RECYCLE_TICK (8 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
51#elif HZ <= 512
52# define INET_TWDR_RECYCLE_TICK (9 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
53#elif HZ <= 1024
54# define INET_TWDR_RECYCLE_TICK (10 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
55#elif HZ <= 2048
56# define INET_TWDR_RECYCLE_TICK (11 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
57#else
58# define INET_TWDR_RECYCLE_TICK (12 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
59#endif
60
61static inline u32 inet_tw_time_stamp(void)
62{
63 return jiffies;
64}
65
66/* TIME_WAIT reaping mechanism. */
67#define INET_TWDR_TWKILL_SLOTS 8 /* Please keep this a power of 2. */
68
69#define INET_TWDR_TWKILL_QUOTA 100
70
71struct inet_timewait_death_row { 34struct inet_timewait_death_row {
72 /* Short-time timewait calendar */ 35 atomic_t tw_count;
73 int twcal_hand; 36
74 unsigned long twcal_jiffie; 37 struct inet_hashinfo *hashinfo ____cacheline_aligned_in_smp;
75 struct timer_list twcal_timer;
76 struct hlist_head twcal_row[INET_TWDR_RECYCLE_SLOTS];
77
78 spinlock_t death_lock;
79 int tw_count;
80 int period;
81 u32 thread_slots;
82 struct work_struct twkill_work;
83 struct timer_list tw_timer;
84 int slot;
85 struct hlist_head cells[INET_TWDR_TWKILL_SLOTS];
86 struct inet_hashinfo *hashinfo;
87 int sysctl_tw_recycle; 38 int sysctl_tw_recycle;
88 int sysctl_max_tw_buckets; 39 int sysctl_max_tw_buckets;
89}; 40};
90 41
91void inet_twdr_hangman(unsigned long data);
92void inet_twdr_twkill_work(struct work_struct *work);
93void inet_twdr_twcal_tick(unsigned long data);
94
95struct inet_bind_bucket; 42struct inet_bind_bucket;
96 43
97/* 44/*
@@ -122,6 +69,7 @@ struct inet_timewait_sock {
122#define tw_v6_rcv_saddr __tw_common.skc_v6_rcv_saddr 69#define tw_v6_rcv_saddr __tw_common.skc_v6_rcv_saddr
123#define tw_dport __tw_common.skc_dport 70#define tw_dport __tw_common.skc_dport
124#define tw_num __tw_common.skc_num 71#define tw_num __tw_common.skc_num
72#define tw_cookie __tw_common.skc_cookie
125 73
126 int tw_timeout; 74 int tw_timeout;
127 volatile unsigned char tw_substate; 75 volatile unsigned char tw_substate;
@@ -132,52 +80,18 @@ struct inet_timewait_sock {
132 __be16 tw_sport; 80 __be16 tw_sport;
133 kmemcheck_bitfield_begin(flags); 81 kmemcheck_bitfield_begin(flags);
134 /* And these are ours. */ 82 /* And these are ours. */
135 unsigned int tw_pad0 : 1, /* 1 bit hole */ 83 unsigned int tw_kill : 1,
136 tw_transparent : 1, 84 tw_transparent : 1,
137 tw_flowlabel : 20, 85 tw_flowlabel : 20,
138 tw_pad : 2, /* 2 bits hole */ 86 tw_pad : 2, /* 2 bits hole */
139 tw_tos : 8; 87 tw_tos : 8;
140 kmemcheck_bitfield_end(flags); 88 kmemcheck_bitfield_end(flags);
141 u32 tw_ttd; 89 struct timer_list tw_timer;
142 struct inet_bind_bucket *tw_tb; 90 struct inet_bind_bucket *tw_tb;
143 struct hlist_node tw_death_node; 91 struct inet_timewait_death_row *tw_dr;
144}; 92};
145#define tw_tclass tw_tos 93#define tw_tclass tw_tos
146 94
147static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw)
148{
149 return !hlist_unhashed(&tw->tw_death_node);
150}
151
152static inline void inet_twsk_dead_node_init(struct inet_timewait_sock *tw)
153{
154 tw->tw_death_node.pprev = NULL;
155}
156
157static inline void __inet_twsk_del_dead_node(struct inet_timewait_sock *tw)
158{
159 __hlist_del(&tw->tw_death_node);
160 inet_twsk_dead_node_init(tw);
161}
162
163static inline int inet_twsk_del_dead_node(struct inet_timewait_sock *tw)
164{
165 if (inet_twsk_dead_hashed(tw)) {
166 __inet_twsk_del_dead_node(tw);
167 return 1;
168 }
169 return 0;
170}
171
172#define inet_twsk_for_each(tw, node, head) \
173 hlist_nulls_for_each_entry(tw, node, head, tw_node)
174
175#define inet_twsk_for_each_inmate(tw, jail) \
176 hlist_for_each_entry(tw, jail, tw_death_node)
177
178#define inet_twsk_for_each_inmate_safe(tw, safe, jail) \
179 hlist_for_each_entry_safe(tw, safe, jail, tw_death_node)
180
181static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk) 95static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
182{ 96{
183 return (struct inet_timewait_sock *)sk; 97 return (struct inet_timewait_sock *)sk;
@@ -192,16 +106,14 @@ int inet_twsk_bind_unhash(struct inet_timewait_sock *tw,
192 struct inet_hashinfo *hashinfo); 106 struct inet_hashinfo *hashinfo);
193 107
194struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, 108struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
109 struct inet_timewait_death_row *dr,
195 const int state); 110 const int state);
196 111
197void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk, 112void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
198 struct inet_hashinfo *hashinfo); 113 struct inet_hashinfo *hashinfo);
199 114
200void inet_twsk_schedule(struct inet_timewait_sock *tw, 115void inet_twsk_schedule(struct inet_timewait_sock *tw, const int timeo);
201 struct inet_timewait_death_row *twdr, 116void inet_twsk_deschedule(struct inet_timewait_sock *tw);
202 const int timeo, const int timewait_len);
203void inet_twsk_deschedule(struct inet_timewait_sock *tw,
204 struct inet_timewait_death_row *twdr);
205 117
206void inet_twsk_purge(struct inet_hashinfo *hashinfo, 118void inet_twsk_purge(struct inet_hashinfo *hashinfo,
207 struct inet_timewait_death_row *twdr, int family); 119 struct inet_timewait_death_row *twdr, int family);
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 80479abddf73..d5332ddcea3f 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -19,6 +19,7 @@ struct inetpeer_addr_base {
19 union { 19 union {
20 __be32 a4; 20 __be32 a4;
21 __be32 a6[4]; 21 __be32 a6[4];
22 struct in6_addr in6;
22 }; 23 };
23}; 24};
24 25
@@ -151,7 +152,7 @@ static inline struct inet_peer *inet_getpeer_v6(struct inet_peer_base *base,
151{ 152{
152 struct inetpeer_addr daddr; 153 struct inetpeer_addr daddr;
153 154
154 *(struct in6_addr *)daddr.addr.a6 = *v6daddr; 155 daddr.addr.in6 = *v6daddr;
155 daddr.family = AF_INET6; 156 daddr.family = AF_INET6;
156 return inet_getpeer(base, &daddr, create); 157 return inet_getpeer(base, &daddr, create);
157} 158}
diff --git a/include/net/ip.h b/include/net/ip.h
index 025c61c0dffb..d14af7edd197 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -108,7 +108,8 @@ int ip_local_deliver(struct sk_buff *skb);
108int ip_mr_input(struct sk_buff *skb); 108int ip_mr_input(struct sk_buff *skb);
109int ip_output(struct sock *sk, struct sk_buff *skb); 109int ip_output(struct sock *sk, struct sk_buff *skb);
110int ip_mc_output(struct sock *sk, struct sk_buff *skb); 110int ip_mc_output(struct sock *sk, struct sk_buff *skb);
111int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); 111int ip_fragment(struct sock *sk, struct sk_buff *skb,
112 int (*output)(struct sock *, struct sk_buff *));
112int ip_do_nat(struct sk_buff *skb); 113int ip_do_nat(struct sk_buff *skb);
113void ip_send_check(struct iphdr *ip); 114void ip_send_check(struct iphdr *ip);
114int __ip_local_out(struct sk_buff *skb); 115int __ip_local_out(struct sk_buff *skb);
@@ -318,9 +319,10 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
318} 319}
319 320
320u32 ip_idents_reserve(u32 hash, int segs); 321u32 ip_idents_reserve(u32 hash, int segs);
321void __ip_select_ident(struct iphdr *iph, int segs); 322void __ip_select_ident(struct net *net, struct iphdr *iph, int segs);
322 323
323static inline void ip_select_ident_segs(struct sk_buff *skb, struct sock *sk, int segs) 324static inline void ip_select_ident_segs(struct net *net, struct sk_buff *skb,
325 struct sock *sk, int segs)
324{ 326{
325 struct iphdr *iph = ip_hdr(skb); 327 struct iphdr *iph = ip_hdr(skb);
326 328
@@ -337,13 +339,14 @@ static inline void ip_select_ident_segs(struct sk_buff *skb, struct sock *sk, in
337 iph->id = 0; 339 iph->id = 0;
338 } 340 }
339 } else { 341 } else {
340 __ip_select_ident(iph, segs); 342 __ip_select_ident(net, iph, segs);
341 } 343 }
342} 344}
343 345
344static inline void ip_select_ident(struct sk_buff *skb, struct sock *sk) 346static inline void ip_select_ident(struct net *net, struct sk_buff *skb,
347 struct sock *sk)
345{ 348{
346 ip_select_ident_segs(skb, sk, 1); 349 ip_select_ident_segs(net, skb, sk, 1);
347} 350}
348 351
349static inline __wsum inet_compute_pseudo(struct sk_buff *skb, int proto) 352static inline __wsum inet_compute_pseudo(struct sk_buff *skb, int proto)
@@ -453,22 +456,6 @@ static __inline__ void inet_reset_saddr(struct sock *sk)
453 456
454#endif 457#endif
455 458
456static inline int sk_mc_loop(struct sock *sk)
457{
458 if (!sk)
459 return 1;
460 switch (sk->sk_family) {
461 case AF_INET:
462 return inet_sk(sk)->mc_loop;
463#if IS_ENABLED(CONFIG_IPV6)
464 case AF_INET6:
465 return inet6_sk(sk)->mc_loop;
466#endif
467 }
468 WARN_ON(1);
469 return 1;
470}
471
472bool ip_call_ra_chain(struct sk_buff *skb); 459bool ip_call_ra_chain(struct sk_buff *skb);
473 460
474/* 461/*
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 1d09b46c1e48..5e192068e6cb 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -170,11 +170,13 @@ static inline bool ipv6_anycast_destination(const struct sk_buff *skb)
170 return rt->rt6i_flags & RTF_ANYCAST; 170 return rt->rt6i_flags & RTF_ANYCAST;
171} 171}
172 172
173int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); 173int ip6_fragment(struct sock *sk, struct sk_buff *skb,
174 int (*output)(struct sock *, struct sk_buff *));
174 175
175static inline int ip6_skb_dst_mtu(struct sk_buff *skb) 176static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
176{ 177{
177 struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL; 178 struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ?
179 inet6_sk(skb->sk) : NULL;
178 180
179 return (np && np->pmtudisc >= IPV6_PMTUDISC_PROBE) ? 181 return (np && np->pmtudisc >= IPV6_PMTUDISC_PROBE) ?
180 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb)); 182 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb));
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index 76c091b53dae..b8529aa1dae7 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -71,14 +71,16 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw);
71__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,
72 const struct in6_addr *raddr); 72 const struct in6_addr *raddr);
73struct net *ip6_tnl_get_link_net(const struct net_device *dev); 73struct net *ip6_tnl_get_link_net(const struct net_device *dev);
74int ip6_tnl_get_iflink(const struct net_device *dev);
74 75
75static inline void ip6tunnel_xmit(struct sk_buff *skb, struct net_device *dev) 76static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
77 struct net_device *dev)
76{ 78{
77 struct net_device_stats *stats = &dev->stats; 79 struct net_device_stats *stats = &dev->stats;
78 int pkt_len, err; 80 int pkt_len, err;
79 81
80 pkt_len = skb->len; 82 pkt_len = skb->len;
81 err = ip6_local_out(skb); 83 err = ip6_local_out_sk(sk, skb);
82 84
83 if (net_xmit_eval(err) == 0) { 85 if (net_xmit_eval(err) == 0) {
84 struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); 86 struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 5bd120e4bc0a..54271ed0ed45 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -136,7 +136,7 @@ struct fib_result {
136 u32 tclassid; 136 u32 tclassid;
137 struct fib_info *fi; 137 struct fib_info *fi;
138 struct fib_table *table; 138 struct fib_table *table;
139 struct list_head *fa_head; 139 struct hlist_head *fa_head;
140}; 140};
141 141
142struct fib_result_nl { 142struct fib_result_nl {
@@ -185,7 +185,9 @@ struct fib_table {
185 u32 tb_id; 185 u32 tb_id;
186 int tb_default; 186 int tb_default;
187 int tb_num_default; 187 int tb_num_default;
188 unsigned long tb_data[0]; 188 struct rcu_head rcu;
189 unsigned long *tb_data;
190 unsigned long __data[0];
189}; 191};
190 192
191int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, 193int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
@@ -195,10 +197,10 @@ int fib_table_delete(struct fib_table *, struct fib_config *);
195int fib_table_dump(struct fib_table *table, struct sk_buff *skb, 197int fib_table_dump(struct fib_table *table, struct sk_buff *skb,
196 struct netlink_callback *cb); 198 struct netlink_callback *cb);
197int fib_table_flush(struct fib_table *table); 199int fib_table_flush(struct fib_table *table);
200struct fib_table *fib_trie_unmerge(struct fib_table *main_tb);
201void fib_table_flush_external(struct fib_table *table);
198void fib_free_table(struct fib_table *tb); 202void fib_free_table(struct fib_table *tb);
199 203
200
201
202#ifndef CONFIG_IP_MULTIPLE_TABLES 204#ifndef CONFIG_IP_MULTIPLE_TABLES
203 205
204#define TABLE_LOCAL_INDEX (RT_TABLE_LOCAL & (FIB_TABLE_HASHSZ - 1)) 206#define TABLE_LOCAL_INDEX (RT_TABLE_LOCAL & (FIB_TABLE_HASHSZ - 1))
@@ -206,12 +208,16 @@ void fib_free_table(struct fib_table *tb);
206 208
207static inline struct fib_table *fib_get_table(struct net *net, u32 id) 209static inline struct fib_table *fib_get_table(struct net *net, u32 id)
208{ 210{
211 struct hlist_node *tb_hlist;
209 struct hlist_head *ptr; 212 struct hlist_head *ptr;
210 213
211 ptr = id == RT_TABLE_LOCAL ? 214 ptr = id == RT_TABLE_LOCAL ?
212 &net->ipv4.fib_table_hash[TABLE_LOCAL_INDEX] : 215 &net->ipv4.fib_table_hash[TABLE_LOCAL_INDEX] :
213 &net->ipv4.fib_table_hash[TABLE_MAIN_INDEX]; 216 &net->ipv4.fib_table_hash[TABLE_MAIN_INDEX];
214 return hlist_entry(ptr->first, struct fib_table, tb_hlist); 217
218 tb_hlist = rcu_dereference_rtnl(hlist_first_rcu(ptr));
219
220 return hlist_entry(tb_hlist, struct fib_table, tb_hlist);
215} 221}
216 222
217static inline struct fib_table *fib_new_table(struct net *net, u32 id) 223static inline struct fib_table *fib_new_table(struct net *net, u32 id)
@@ -222,14 +228,13 @@ static inline struct fib_table *fib_new_table(struct net *net, u32 id)
222static inline int fib_lookup(struct net *net, const struct flowi4 *flp, 228static inline int fib_lookup(struct net *net, const struct flowi4 *flp,
223 struct fib_result *res) 229 struct fib_result *res)
224{ 230{
231 struct fib_table *tb;
225 int err = -ENETUNREACH; 232 int err = -ENETUNREACH;
226 233
227 rcu_read_lock(); 234 rcu_read_lock();
228 235
229 if (!fib_table_lookup(fib_get_table(net, RT_TABLE_LOCAL), flp, res, 236 tb = fib_get_table(net, RT_TABLE_MAIN);
230 FIB_LOOKUP_NOREF) || 237 if (tb && !fib_table_lookup(tb, flp, res, FIB_LOOKUP_NOREF))
231 !fib_table_lookup(fib_get_table(net, RT_TABLE_MAIN), flp, res,
232 FIB_LOOKUP_NOREF))
233 err = 0; 238 err = 0;
234 239
235 rcu_read_unlock(); 240 rcu_read_unlock();
@@ -249,28 +254,29 @@ int __fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res);
249static inline int fib_lookup(struct net *net, struct flowi4 *flp, 254static inline int fib_lookup(struct net *net, struct flowi4 *flp,
250 struct fib_result *res) 255 struct fib_result *res)
251{ 256{
252 if (!net->ipv4.fib_has_custom_rules) { 257 struct fib_table *tb;
253 int err = -ENETUNREACH; 258 int err;
254 259
255 rcu_read_lock(); 260 if (net->ipv4.fib_has_custom_rules)
256 261 return __fib_lookup(net, flp, res);
257 res->tclassid = 0; 262
258 if ((net->ipv4.fib_local && 263 rcu_read_lock();
259 !fib_table_lookup(net->ipv4.fib_local, flp, res, 264
260 FIB_LOOKUP_NOREF)) || 265 res->tclassid = 0;
261 (net->ipv4.fib_main && 266
262 !fib_table_lookup(net->ipv4.fib_main, flp, res, 267 for (err = 0; !err; err = -ENETUNREACH) {
263 FIB_LOOKUP_NOREF)) || 268 tb = rcu_dereference_rtnl(net->ipv4.fib_main);
264 (net->ipv4.fib_default && 269 if (tb && !fib_table_lookup(tb, flp, res, FIB_LOOKUP_NOREF))
265 !fib_table_lookup(net->ipv4.fib_default, flp, res, 270 break;
266 FIB_LOOKUP_NOREF))) 271
267 err = 0; 272 tb = rcu_dereference_rtnl(net->ipv4.fib_default);
268 273 if (tb && !fib_table_lookup(tb, flp, res, FIB_LOOKUP_NOREF))
269 rcu_read_unlock(); 274 break;
270
271 return err;
272 } 275 }
273 return __fib_lookup(net, flp, res); 276
277 rcu_read_unlock();
278
279 return err;
274} 280}
275 281
276#endif /* CONFIG_IP_MULTIPLE_TABLES */ 282#endif /* CONFIG_IP_MULTIPLE_TABLES */
@@ -294,6 +300,8 @@ static inline int fib_num_tclassid_users(struct net *net)
294 return 0; 300 return 0;
295} 301}
296#endif 302#endif
303int fib_unmerge(struct net *net);
304void fib_flush_external(struct net *net);
297 305
298/* Exported by fib_semantics.c */ 306/* Exported by fib_semantics.c */
299int ip_fib_check_default(__be32 gw, struct net_device *dev); 307int ip_fib_check_default(__be32 gw, struct net_device *dev);
@@ -304,7 +312,7 @@ void fib_select_multipath(struct fib_result *res);
304 312
305/* Exported by fib_trie.c */ 313/* Exported by fib_trie.c */
306void fib_trie_init(void); 314void fib_trie_init(void);
307struct fib_table *fib_trie_table(u32 id); 315struct fib_table *fib_trie_table(u32 id, struct fib_table *alias);
308 316
309static inline void fib_combine_itag(u32 *itag, const struct fib_result *res) 317static inline void fib_combine_itag(u32 *itag, const struct fib_result *res)
310{ 318{
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 2c47061a6954..d8214cb88bbc 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -142,6 +142,7 @@ int ip_tunnel_init(struct net_device *dev);
142void ip_tunnel_uninit(struct net_device *dev); 142void ip_tunnel_uninit(struct net_device *dev);
143void ip_tunnel_dellink(struct net_device *dev, struct list_head *head); 143void ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
144struct net *ip_tunnel_get_link_net(const struct net_device *dev); 144struct net *ip_tunnel_get_link_net(const struct net_device *dev);
145int ip_tunnel_get_iflink(const struct net_device *dev);
145int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id, 146int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
146 struct rtnl_link_ops *ops, char *devname); 147 struct rtnl_link_ops *ops, char *devname);
147 148
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 615b20b58545..4e3731ee4eac 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -47,13 +47,13 @@ static inline struct net *skb_net(const struct sk_buff *skb)
47 * Start with the most likely hit 47 * Start with the most likely hit
48 * End with BUG 48 * End with BUG
49 */ 49 */
50 if (likely(skb->dev && skb->dev->nd_net)) 50 if (likely(skb->dev && dev_net(skb->dev)))
51 return dev_net(skb->dev); 51 return dev_net(skb->dev);
52 if (skb_dst(skb) && skb_dst(skb)->dev) 52 if (skb_dst(skb) && skb_dst(skb)->dev)
53 return dev_net(skb_dst(skb)->dev); 53 return dev_net(skb_dst(skb)->dev);
54 WARN(skb->sk, "Maybe skb_sknet should be used in %s() at line:%d\n", 54 WARN(skb->sk, "Maybe skb_sknet should be used in %s() at line:%d\n",
55 __func__, __LINE__); 55 __func__, __LINE__);
56 if (likely(skb->sk && skb->sk->sk_net)) 56 if (likely(skb->sk && sock_net(skb->sk)))
57 return sock_net(skb->sk); 57 return sock_net(skb->sk);
58 pr_err("There is no net ptr to find in the skb in %s() line:%d\n", 58 pr_err("There is no net ptr to find in the skb in %s() line:%d\n",
59 __func__, __LINE__); 59 __func__, __LINE__);
@@ -71,11 +71,11 @@ static inline struct net *skb_sknet(const struct sk_buff *skb)
71#ifdef CONFIG_NET_NS 71#ifdef CONFIG_NET_NS
72#ifdef CONFIG_IP_VS_DEBUG 72#ifdef CONFIG_IP_VS_DEBUG
73 /* Start with the most likely hit */ 73 /* Start with the most likely hit */
74 if (likely(skb->sk && skb->sk->sk_net)) 74 if (likely(skb->sk && sock_net(skb->sk)))
75 return sock_net(skb->sk); 75 return sock_net(skb->sk);
76 WARN(skb->dev, "Maybe skb_net should be used instead in %s() line:%d\n", 76 WARN(skb->dev, "Maybe skb_net should be used instead in %s() line:%d\n",
77 __func__, __LINE__); 77 __func__, __LINE__);
78 if (likely(skb->dev && skb->dev->nd_net)) 78 if (likely(skb->dev && dev_net(skb->dev)))
79 return dev_net(skb->dev); 79 return dev_net(skb->dev);
80 pr_err("There is no net ptr to find in the skb in %s() line:%d\n", 80 pr_err("There is no net ptr to find in the skb in %s() line:%d\n",
81 __func__, __LINE__); 81 __func__, __LINE__);
@@ -365,15 +365,15 @@ struct ip_vs_seq {
365 365
366/* counters per cpu */ 366/* counters per cpu */
367struct ip_vs_counters { 367struct ip_vs_counters {
368 __u32 conns; /* connections scheduled */ 368 __u64 conns; /* connections scheduled */
369 __u32 inpkts; /* incoming packets */ 369 __u64 inpkts; /* incoming packets */
370 __u32 outpkts; /* outgoing packets */ 370 __u64 outpkts; /* outgoing packets */
371 __u64 inbytes; /* incoming bytes */ 371 __u64 inbytes; /* incoming bytes */
372 __u64 outbytes; /* outgoing bytes */ 372 __u64 outbytes; /* outgoing bytes */
373}; 373};
374/* Stats per cpu */ 374/* Stats per cpu */
375struct ip_vs_cpu_stats { 375struct ip_vs_cpu_stats {
376 struct ip_vs_counters ustats; 376 struct ip_vs_counters cnt;
377 struct u64_stats_sync syncp; 377 struct u64_stats_sync syncp;
378}; 378};
379 379
@@ -383,23 +383,40 @@ struct ip_vs_estimator {
383 383
384 u64 last_inbytes; 384 u64 last_inbytes;
385 u64 last_outbytes; 385 u64 last_outbytes;
386 u32 last_conns; 386 u64 last_conns;
387 u32 last_inpkts; 387 u64 last_inpkts;
388 u32 last_outpkts; 388 u64 last_outpkts;
389 389
390 u32 cps; 390 u64 cps;
391 u32 inpps; 391 u64 inpps;
392 u32 outpps; 392 u64 outpps;
393 u32 inbps; 393 u64 inbps;
394 u32 outbps; 394 u64 outbps;
395};
396
397/*
398 * IPVS statistics object, 64-bit kernel version of struct ip_vs_stats_user
399 */
400struct ip_vs_kstats {
401 u64 conns; /* connections scheduled */
402 u64 inpkts; /* incoming packets */
403 u64 outpkts; /* outgoing packets */
404 u64 inbytes; /* incoming bytes */
405 u64 outbytes; /* outgoing bytes */
406
407 u64 cps; /* current connection rate */
408 u64 inpps; /* current in packet rate */
409 u64 outpps; /* current out packet rate */
410 u64 inbps; /* current in byte rate */
411 u64 outbps; /* current out byte rate */
395}; 412};
396 413
397struct ip_vs_stats { 414struct ip_vs_stats {
398 struct ip_vs_stats_user ustats; /* statistics */ 415 struct ip_vs_kstats kstats; /* kernel statistics */
399 struct ip_vs_estimator est; /* estimator */ 416 struct ip_vs_estimator est; /* estimator */
400 struct ip_vs_cpu_stats __percpu *cpustats; /* per cpu counters */ 417 struct ip_vs_cpu_stats __percpu *cpustats; /* per cpu counters */
401 spinlock_t lock; /* spin lock */ 418 spinlock_t lock; /* spin lock */
402 struct ip_vs_stats_user ustats0; /* reset values */ 419 struct ip_vs_kstats kstats0; /* reset values */
403}; 420};
404 421
405struct dst_entry; 422struct dst_entry;
@@ -924,6 +941,7 @@ struct netns_ipvs {
924 int sysctl_nat_icmp_send; 941 int sysctl_nat_icmp_send;
925 int sysctl_pmtu_disc; 942 int sysctl_pmtu_disc;
926 int sysctl_backup_only; 943 int sysctl_backup_only;
944 int sysctl_conn_reuse_mode;
927 945
928 /* ip_vs_lblc */ 946 /* ip_vs_lblc */
929 int sysctl_lblc_expiration; 947 int sysctl_lblc_expiration;
@@ -1042,6 +1060,11 @@ static inline int sysctl_backup_only(struct netns_ipvs *ipvs)
1042 ipvs->sysctl_backup_only; 1060 ipvs->sysctl_backup_only;
1043} 1061}
1044 1062
1063static inline int sysctl_conn_reuse_mode(struct netns_ipvs *ipvs)
1064{
1065 return ipvs->sysctl_conn_reuse_mode;
1066}
1067
1045#else 1068#else
1046 1069
1047static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs) 1070static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs)
@@ -1109,6 +1132,11 @@ static inline int sysctl_backup_only(struct netns_ipvs *ipvs)
1109 return 0; 1132 return 0;
1110} 1133}
1111 1134
1135static inline int sysctl_conn_reuse_mode(struct netns_ipvs *ipvs)
1136{
1137 return 1;
1138}
1139
1112#endif 1140#endif
1113 1141
1114/* IPVS core functions 1142/* IPVS core functions
@@ -1388,8 +1416,7 @@ void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
1388void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats); 1416void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats);
1389void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats); 1417void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats);
1390void ip_vs_zero_estimator(struct ip_vs_stats *stats); 1418void ip_vs_zero_estimator(struct ip_vs_stats *stats);
1391void ip_vs_read_estimator(struct ip_vs_stats_user *dst, 1419void ip_vs_read_estimator(struct ip_vs_kstats *dst, struct ip_vs_stats *stats);
1392 struct ip_vs_stats *stats);
1393 1420
1394/* Various IPVS packet transmitters (from ip_vs_xmit.c) */ 1421/* Various IPVS packet transmitters (from ip_vs_xmit.c) */
1395int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1422int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 4c9fe224d73b..eec8ad3c9843 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -47,8 +47,6 @@
47 47
48#define NEXTHDR_MAX 255 48#define NEXTHDR_MAX 255
49 49
50
51
52#define IPV6_DEFAULT_HOPLIMIT 64 50#define IPV6_DEFAULT_HOPLIMIT 64
53#define IPV6_DEFAULT_MCASTHOPS 1 51#define IPV6_DEFAULT_MCASTHOPS 1
54 52
@@ -671,8 +669,9 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add
671 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); 669 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
672} 670}
673 671
674void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); 672void ipv6_select_ident(struct net *net, struct frag_hdr *fhdr,
675void ipv6_proxy_select_ident(struct sk_buff *skb); 673 struct rt6_info *rt);
674void ipv6_proxy_select_ident(struct net *net, struct sk_buff *skb);
676 675
677int ip6_dst_hoplimit(struct dst_entry *dst); 676int ip6_dst_hoplimit(struct dst_entry *dst);
678 677
@@ -768,7 +767,7 @@ static inline u8 ip6_tclass(__be32 flowinfo)
768int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, 767int ipv6_rcv(struct sk_buff *skb, struct net_device *dev,
769 struct packet_type *pt, struct net_device *orig_dev); 768 struct packet_type *pt, struct net_device *orig_dev);
770 769
771int ip6_rcv_finish(struct sk_buff *skb); 770int ip6_rcv_finish(struct sock *sk, struct sk_buff *skb);
772 771
773/* 772/*
774 * upper-layer output functions 773 * upper-layer output functions
@@ -826,6 +825,7 @@ int ip6_input(struct sk_buff *skb);
826int ip6_mc_input(struct sk_buff *skb); 825int ip6_mc_input(struct sk_buff *skb);
827 826
828int __ip6_local_out(struct sk_buff *skb); 827int __ip6_local_out(struct sk_buff *skb);
828int ip6_local_out_sk(struct sock *sk, struct sk_buff *skb);
829int ip6_local_out(struct sk_buff *skb); 829int ip6_local_out(struct sk_buff *skb);
830 830
831/* 831/*
@@ -940,4 +940,8 @@ int ipv6_sysctl_register(void);
940void ipv6_sysctl_unregister(void); 940void ipv6_sysctl_unregister(void);
941#endif 941#endif
942 942
943int ipv6_sock_mc_join(struct sock *sk, int ifindex,
944 const struct in6_addr *addr);
945int ipv6_sock_mc_drop(struct sock *sk, int ifindex,
946 const struct in6_addr *addr);
943#endif /* _NET_IPV6_H */ 947#endif /* _NET_IPV6_H */
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index a830b01baba4..8f81bbbc38fc 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -519,6 +519,17 @@ iwe_stream_add_event(struct iw_request_info *info, char *stream, char *ends,
519 return stream; 519 return stream;
520} 520}
521 521
522static inline char *
523iwe_stream_add_event_check(struct iw_request_info *info, char *stream,
524 char *ends, struct iw_event *iwe, int event_len)
525{
526 char *res = iwe_stream_add_event(info, stream, ends, iwe, event_len);
527
528 if (res == stream)
529 return ERR_PTR(-E2BIG);
530 return res;
531}
532
522/*------------------------------------------------------------------*/ 533/*------------------------------------------------------------------*/
523/* 534/*
524 * Wrapper to add an short Wireless Event containing a pointer to a 535 * Wrapper to add an short Wireless Event containing a pointer to a
@@ -545,6 +556,17 @@ iwe_stream_add_point(struct iw_request_info *info, char *stream, char *ends,
545 return stream; 556 return stream;
546} 557}
547 558
559static inline char *
560iwe_stream_add_point_check(struct iw_request_info *info, char *stream,
561 char *ends, struct iw_event *iwe, char *extra)
562{
563 char *res = iwe_stream_add_point(info, stream, ends, iwe, extra);
564
565 if (res == stream)
566 return ERR_PTR(-E2BIG);
567 return res;
568}
569
548/*------------------------------------------------------------------*/ 570/*------------------------------------------------------------------*/
549/* 571/*
550 * Wrapper to add a value to a Wireless Event in a stream of events. 572 * Wrapper to add a value to a Wireless Event in a stream of events.
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d52914b75331..b4bef1152c05 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -84,6 +84,39 @@
84 * 84 *
85 */ 85 */
86 86
87/**
88 * DOC: mac80211 software tx queueing
89 *
90 * mac80211 provides an optional intermediate queueing implementation designed
91 * to allow the driver to keep hardware queues short and provide some fairness
92 * between different stations/interfaces.
93 * In this model, the driver pulls data frames from the mac80211 queue instead
94 * of letting mac80211 push them via drv_tx().
95 * Other frames (e.g. control or management) are still pushed using drv_tx().
96 *
97 * Drivers indicate that they use this model by implementing the .wake_tx_queue
98 * driver operation.
99 *
100 * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with a
101 * single per-vif queue for multicast data frames.
102 *
103 * The driver is expected to initialize its private per-queue data for stations
104 * and interfaces in the .add_interface and .sta_add ops.
105 *
106 * The driver can't access the queue directly. To dequeue a frame, it calls
107 * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it
108 * calls the .wake_tx_queue driver op.
109 *
110 * For AP powersave TIM handling, the driver only needs to indicate if it has
111 * buffered packets in the driver specific data structures by calling
112 * ieee80211_sta_set_buffered(). For frames buffered in the ieee80211_txq
113 * struct, mac80211 sets the appropriate TIM PVB bits and calls
114 * .release_buffered_frames().
115 * In that callback the driver is therefore expected to release its own
116 * buffered frames and afterwards also frames from the ieee80211_txq (obtained
117 * via the usual ieee80211_tx_dequeue).
118 */
119
87struct device; 120struct device;
88 121
89/** 122/**
@@ -301,17 +334,86 @@ enum ieee80211_bss_change {
301#define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4 334#define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4
302 335
303/** 336/**
304 * enum ieee80211_rssi_event - RSSI threshold event 337 * enum ieee80211_event_type - event to be notified to the low level driver
305 * An indicator for when RSSI goes below/above a certain threshold. 338 * @RSSI_EVENT: AP's rssi crossed the a threshold set by the driver.
306 * @RSSI_EVENT_HIGH: AP's rssi crossed the high threshold set by the driver. 339 * @MLME_EVENT: event related to MLME
307 * @RSSI_EVENT_LOW: AP's rssi crossed the low threshold set by the driver.
308 */ 340 */
309enum ieee80211_rssi_event { 341enum ieee80211_event_type {
342 RSSI_EVENT,
343 MLME_EVENT,
344};
345
346/**
347 * enum ieee80211_rssi_event_data - relevant when event type is %RSSI_EVENT
348 * @RSSI_EVENT_HIGH: AP's rssi went below the threshold set by the driver.
349 * @RSSI_EVENT_LOW: AP's rssi went above the threshold set by the driver.
350 */
351enum ieee80211_rssi_event_data {
310 RSSI_EVENT_HIGH, 352 RSSI_EVENT_HIGH,
311 RSSI_EVENT_LOW, 353 RSSI_EVENT_LOW,
312}; 354};
313 355
314/** 356/**
357 * enum ieee80211_rssi_event - data attached to an %RSSI_EVENT
358 * @data: See &enum ieee80211_rssi_event_data
359 */
360struct ieee80211_rssi_event {
361 enum ieee80211_rssi_event_data data;
362};
363
364/**
365 * enum ieee80211_mlme_event_data - relevant when event type is %MLME_EVENT
366 * @AUTH_EVENT: the MLME operation is authentication
367 * @ASSOC_EVENT: the MLME operation is association
368 * @DEAUTH_RX_EVENT: deauth received..
369 * @DEAUTH_TX_EVENT: deauth sent.
370 */
371enum ieee80211_mlme_event_data {
372 AUTH_EVENT,
373 ASSOC_EVENT,
374 DEAUTH_RX_EVENT,
375 DEAUTH_TX_EVENT,
376};
377
378/**
379 * enum ieee80211_mlme_event_status - relevant when event type is %MLME_EVENT
380 * @MLME_SUCCESS: the MLME operation completed successfully.
381 * @MLME_DENIED: the MLME operation was denied by the peer.
382 * @MLME_TIMEOUT: the MLME operation timed out.
383 */
384enum ieee80211_mlme_event_status {
385 MLME_SUCCESS,
386 MLME_DENIED,
387 MLME_TIMEOUT,
388};
389
390/**
391 * enum ieee80211_mlme_event - data attached to an %MLME_EVENT
392 * @data: See &enum ieee80211_mlme_event_data
393 * @status: See &enum ieee80211_mlme_event_status
394 * @reason: the reason code if applicable
395 */
396struct ieee80211_mlme_event {
397 enum ieee80211_mlme_event_data data;
398 enum ieee80211_mlme_event_status status;
399 u16 reason;
400};
401
402/**
403 * struct ieee80211_event - event to be sent to the driver
404 * @type The event itself. See &enum ieee80211_event_type.
405 * @rssi: relevant if &type is %RSSI_EVENT
406 * @mlme: relevant if &type is %AUTH_EVENT
407 */
408struct ieee80211_event {
409 enum ieee80211_event_type type;
410 union {
411 struct ieee80211_rssi_event rssi;
412 struct ieee80211_mlme_event mlme;
413 } u;
414};
415
416/**
315 * struct ieee80211_bss_conf - holds the BSS's changing parameters 417 * struct ieee80211_bss_conf - holds the BSS's changing parameters
316 * 418 *
317 * This structure keeps information about a BSS (and an association 419 * This structure keeps information about a BSS (and an association
@@ -337,12 +439,15 @@ enum ieee80211_rssi_event {
337 * HW flag %IEEE80211_HW_TIMING_BEACON_ONLY is set, then this can 439 * HW flag %IEEE80211_HW_TIMING_BEACON_ONLY is set, then this can
338 * only come from a beacon, but might not become valid until after 440 * only come from a beacon, but might not become valid until after
339 * association when a beacon is received (which is notified with the 441 * association when a beacon is received (which is notified with the
340 * %BSS_CHANGED_DTIM flag.) 442 * %BSS_CHANGED_DTIM flag.). See also sync_dtim_count important notice.
341 * @sync_device_ts: the device timestamp corresponding to the sync_tsf, 443 * @sync_device_ts: the device timestamp corresponding to the sync_tsf,
342 * the driver/device can use this to calculate synchronisation 444 * the driver/device can use this to calculate synchronisation
343 * (see @sync_tsf) 445 * (see @sync_tsf). See also sync_dtim_count important notice.
344 * @sync_dtim_count: Only valid when %IEEE80211_HW_TIMING_BEACON_ONLY 446 * @sync_dtim_count: Only valid when %IEEE80211_HW_TIMING_BEACON_ONLY
345 * is requested, see @sync_tsf/@sync_device_ts. 447 * is requested, see @sync_tsf/@sync_device_ts.
448 * IMPORTANT: These three sync_* parameters would possibly be out of sync
449 * by the time the driver will use them. The synchronized view is currently
450 * guaranteed only in certain callbacks.
346 * @beacon_int: beacon interval 451 * @beacon_int: beacon interval
347 * @assoc_capability: capabilities taken from assoc resp 452 * @assoc_capability: capabilities taken from assoc resp
348 * @basic_rates: bitmap of basic rates, each bit stands for an 453 * @basic_rates: bitmap of basic rates, each bit stands for an
@@ -1234,6 +1339,7 @@ enum ieee80211_vif_flags {
1234 * monitor interface (if that is requested.) 1339 * monitor interface (if that is requested.)
1235 * @drv_priv: data area for driver use, will always be aligned to 1340 * @drv_priv: data area for driver use, will always be aligned to
1236 * sizeof(void *). 1341 * sizeof(void *).
1342 * @txq: the multicast data TX queue (if driver uses the TXQ abstraction)
1237 */ 1343 */
1238struct ieee80211_vif { 1344struct ieee80211_vif {
1239 enum nl80211_iftype type; 1345 enum nl80211_iftype type;
@@ -1245,6 +1351,8 @@ struct ieee80211_vif {
1245 u8 cab_queue; 1351 u8 cab_queue;
1246 u8 hw_queue[IEEE80211_NUM_ACS]; 1352 u8 hw_queue[IEEE80211_NUM_ACS];
1247 1353
1354 struct ieee80211_txq *txq;
1355
1248 struct ieee80211_chanctx_conf __rcu *chanctx_conf; 1356 struct ieee80211_chanctx_conf __rcu *chanctx_conf;
1249 1357
1250 u32 driver_flags; 1358 u32 driver_flags;
@@ -1279,6 +1387,19 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
1279struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev); 1387struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
1280 1388
1281/** 1389/**
1390 * ieee80211_vif_to_wdev - return a wdev struct from a vif
1391 * @vif: the vif to get the wdev for
1392 *
1393 * This can be used by mac80211 drivers with direct cfg80211 APIs
1394 * (like the vendor commands) that needs to get the wdev for a vif.
1395 *
1396 * Note that this function may return %NULL if the given wdev isn't
1397 * associated with a vif that the driver knows about (e.g. monitor
1398 * or AP_VLAN interfaces.)
1399 */
1400struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif);
1401
1402/**
1282 * enum ieee80211_key_flags - key flags 1403 * enum ieee80211_key_flags - key flags
1283 * 1404 *
1284 * These flags are used for communication about keys between the driver 1405 * These flags are used for communication about keys between the driver
@@ -1472,7 +1593,8 @@ struct ieee80211_sta_rates {
1472 * @supp_rates: Bitmap of supported rates (per band) 1593 * @supp_rates: Bitmap of supported rates (per band)
1473 * @ht_cap: HT capabilities of this STA; restricted to our own capabilities 1594 * @ht_cap: HT capabilities of this STA; restricted to our own capabilities
1474 * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities 1595 * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities
1475 * @wme: indicates whether the STA supports QoS/WME. 1596 * @wme: indicates whether the STA supports QoS/WME (if local devices does,
1597 * otherwise always false)
1476 * @drv_priv: data area for driver use, will always be aligned to 1598 * @drv_priv: data area for driver use, will always be aligned to
1477 * sizeof(void *), size is determined in hw information. 1599 * sizeof(void *), size is determined in hw information.
1478 * @uapsd_queues: bitmap of queues configured for uapsd. Only valid 1600 * @uapsd_queues: bitmap of queues configured for uapsd. Only valid
@@ -1488,6 +1610,8 @@ struct ieee80211_sta_rates {
1488 * @tdls: indicates whether the STA is a TDLS peer 1610 * @tdls: indicates whether the STA is a TDLS peer
1489 * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only 1611 * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
1490 * valid if the STA is a TDLS peer in the first place. 1612 * valid if the STA is a TDLS peer in the first place.
1613 * @mfp: indicates whether the STA uses management frame protection or not.
1614 * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
1491 */ 1615 */
1492struct ieee80211_sta { 1616struct ieee80211_sta {
1493 u32 supp_rates[IEEE80211_NUM_BANDS]; 1617 u32 supp_rates[IEEE80211_NUM_BANDS];
@@ -1504,6 +1628,9 @@ struct ieee80211_sta {
1504 struct ieee80211_sta_rates __rcu *rates; 1628 struct ieee80211_sta_rates __rcu *rates;
1505 bool tdls; 1629 bool tdls;
1506 bool tdls_initiator; 1630 bool tdls_initiator;
1631 bool mfp;
1632
1633 struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
1507 1634
1508 /* must be last */ 1635 /* must be last */
1509 u8 drv_priv[0] __aligned(sizeof(void *)); 1636 u8 drv_priv[0] __aligned(sizeof(void *));
@@ -1533,6 +1660,27 @@ struct ieee80211_tx_control {
1533}; 1660};
1534 1661
1535/** 1662/**
1663 * struct ieee80211_txq - Software intermediate tx queue
1664 *
1665 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1666 * @sta: station table entry, %NULL for per-vif queue
1667 * @tid: the TID for this queue (unused for per-vif queue)
1668 * @ac: the AC for this queue
1669 *
1670 * The driver can obtain packets from this queue by calling
1671 * ieee80211_tx_dequeue().
1672 */
1673struct ieee80211_txq {
1674 struct ieee80211_vif *vif;
1675 struct ieee80211_sta *sta;
1676 u8 tid;
1677 u8 ac;
1678
1679 /* must be last */
1680 u8 drv_priv[0] __aligned(sizeof(void *));
1681};
1682
1683/**
1536 * enum ieee80211_hw_flags - hardware flags 1684 * enum ieee80211_hw_flags - hardware flags
1537 * 1685 *
1538 * These flags are used to indicate hardware capabilities to 1686 * These flags are used to indicate hardware capabilities to
@@ -1756,6 +1904,8 @@ enum ieee80211_hw_flags {
1756 * within &struct ieee80211_sta. 1904 * within &struct ieee80211_sta.
1757 * @chanctx_data_size: size (in bytes) of the drv_priv data area 1905 * @chanctx_data_size: size (in bytes) of the drv_priv data area
1758 * within &struct ieee80211_chanctx_conf. 1906 * within &struct ieee80211_chanctx_conf.
1907 * @txq_data_size: size (in bytes) of the drv_priv data area
1908 * within @struct ieee80211_txq.
1759 * 1909 *
1760 * @max_rates: maximum number of alternate rate retry stages the hw 1910 * @max_rates: maximum number of alternate rate retry stages the hw
1761 * can handle. 1911 * can handle.
@@ -1804,6 +1954,9 @@ enum ieee80211_hw_flags {
1804 * @n_cipher_schemes: a size of an array of cipher schemes definitions. 1954 * @n_cipher_schemes: a size of an array of cipher schemes definitions.
1805 * @cipher_schemes: a pointer to an array of cipher scheme definitions 1955 * @cipher_schemes: a pointer to an array of cipher scheme definitions
1806 * supported by HW. 1956 * supported by HW.
1957 *
1958 * @txq_ac_max_pending: maximum number of frames per AC pending in all txq
1959 * entries for a vif.
1807 */ 1960 */
1808struct ieee80211_hw { 1961struct ieee80211_hw {
1809 struct ieee80211_conf conf; 1962 struct ieee80211_conf conf;
@@ -1816,6 +1969,7 @@ struct ieee80211_hw {
1816 int vif_data_size; 1969 int vif_data_size;
1817 int sta_data_size; 1970 int sta_data_size;
1818 int chanctx_data_size; 1971 int chanctx_data_size;
1972 int txq_data_size;
1819 u16 queues; 1973 u16 queues;
1820 u16 max_listen_interval; 1974 u16 max_listen_interval;
1821 s8 max_signal; 1975 s8 max_signal;
@@ -1832,6 +1986,7 @@ struct ieee80211_hw {
1832 u8 uapsd_max_sp_len; 1986 u8 uapsd_max_sp_len;
1833 u8 n_cipher_schemes; 1987 u8 n_cipher_schemes;
1834 const struct ieee80211_cipher_scheme *cipher_schemes; 1988 const struct ieee80211_cipher_scheme *cipher_schemes;
1989 int txq_ac_max_pending;
1835}; 1990};
1836 1991
1837/** 1992/**
@@ -2844,8 +2999,9 @@ enum ieee80211_reconfig_type {
2844 * @set_bitrate_mask: Set a mask of rates to be used for rate control selection 2999 * @set_bitrate_mask: Set a mask of rates to be used for rate control selection
2845 * when transmitting a frame. Currently only legacy rates are handled. 3000 * when transmitting a frame. Currently only legacy rates are handled.
2846 * The callback can sleep. 3001 * The callback can sleep.
2847 * @rssi_callback: Notify driver when the average RSSI goes above/below 3002 * @event_callback: Notify driver about any event in mac80211. See
2848 * thresholds that were registered previously. The callback can sleep. 3003 * &enum ieee80211_event_type for the different types.
3004 * The callback can sleep.
2849 * 3005 *
2850 * @release_buffered_frames: Release buffered frames according to the given 3006 * @release_buffered_frames: Release buffered frames according to the given
2851 * parameters. In the case where the driver buffers some frames for 3007 * parameters. In the case where the driver buffers some frames for
@@ -2993,6 +3149,8 @@ enum ieee80211_reconfig_type {
2993 * response template is provided, together with the location of the 3149 * response template is provided, together with the location of the
2994 * switch-timing IE within the template. The skb can only be used within 3150 * switch-timing IE within the template. The skb can only be used within
2995 * the function call. 3151 * the function call.
3152 *
3153 * @wake_tx_queue: Called when new packets have been added to the queue.
2996 */ 3154 */
2997struct ieee80211_ops { 3155struct ieee80211_ops {
2998 void (*tx)(struct ieee80211_hw *hw, 3156 void (*tx)(struct ieee80211_hw *hw,
@@ -3141,9 +3299,9 @@ struct ieee80211_ops {
3141 bool (*tx_frames_pending)(struct ieee80211_hw *hw); 3299 bool (*tx_frames_pending)(struct ieee80211_hw *hw);
3142 int (*set_bitrate_mask)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 3300 int (*set_bitrate_mask)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
3143 const struct cfg80211_bitrate_mask *mask); 3301 const struct cfg80211_bitrate_mask *mask);
3144 void (*rssi_callback)(struct ieee80211_hw *hw, 3302 void (*event_callback)(struct ieee80211_hw *hw,
3145 struct ieee80211_vif *vif, 3303 struct ieee80211_vif *vif,
3146 enum ieee80211_rssi_event rssi_event); 3304 const struct ieee80211_event *event);
3147 3305
3148 void (*allow_buffered_frames)(struct ieee80211_hw *hw, 3306 void (*allow_buffered_frames)(struct ieee80211_hw *hw,
3149 struct ieee80211_sta *sta, 3307 struct ieee80211_sta *sta,
@@ -3224,6 +3382,9 @@ struct ieee80211_ops {
3224 void (*tdls_recv_channel_switch)(struct ieee80211_hw *hw, 3382 void (*tdls_recv_channel_switch)(struct ieee80211_hw *hw,
3225 struct ieee80211_vif *vif, 3383 struct ieee80211_vif *vif,
3226 struct ieee80211_tdls_ch_sw_params *params); 3384 struct ieee80211_tdls_ch_sw_params *params);
3385
3386 void (*wake_tx_queue)(struct ieee80211_hw *hw,
3387 struct ieee80211_txq *txq);
3227}; 3388};
3228 3389
3229/** 3390/**
@@ -4343,13 +4504,33 @@ void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw);
4343 * haven't been re-added to the driver yet. 4504 * haven't been re-added to the driver yet.
4344 * @IEEE80211_IFACE_ITER_RESUME_ALL: During resume, iterate over all 4505 * @IEEE80211_IFACE_ITER_RESUME_ALL: During resume, iterate over all
4345 * interfaces, even if they haven't been re-added to the driver yet. 4506 * interfaces, even if they haven't been re-added to the driver yet.
4507 * @IEEE80211_IFACE_ITER_ACTIVE: Iterate only active interfaces (netdev is up).
4346 */ 4508 */
4347enum ieee80211_interface_iteration_flags { 4509enum ieee80211_interface_iteration_flags {
4348 IEEE80211_IFACE_ITER_NORMAL = 0, 4510 IEEE80211_IFACE_ITER_NORMAL = 0,
4349 IEEE80211_IFACE_ITER_RESUME_ALL = BIT(0), 4511 IEEE80211_IFACE_ITER_RESUME_ALL = BIT(0),
4512 IEEE80211_IFACE_ITER_ACTIVE = BIT(1),
4350}; 4513};
4351 4514
4352/** 4515/**
4516 * ieee80211_iterate_interfaces - iterate interfaces
4517 *
4518 * This function iterates over the interfaces associated with a given
4519 * hardware and calls the callback for them. This includes active as well as
4520 * inactive interfaces. This function allows the iterator function to sleep.
4521 * Will iterate over a new interface during add_interface().
4522 *
4523 * @hw: the hardware struct of which the interfaces should be iterated over
4524 * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
4525 * @iterator: the iterator function to call
4526 * @data: first argument of the iterator function
4527 */
4528void ieee80211_iterate_interfaces(struct ieee80211_hw *hw, u32 iter_flags,
4529 void (*iterator)(void *data, u8 *mac,
4530 struct ieee80211_vif *vif),
4531 void *data);
4532
4533/**
4353 * ieee80211_iterate_active_interfaces - iterate active interfaces 4534 * ieee80211_iterate_active_interfaces - iterate active interfaces
4354 * 4535 *
4355 * This function iterates over the interfaces associated with a given 4536 * This function iterates over the interfaces associated with a given
@@ -4364,11 +4545,16 @@ enum ieee80211_interface_iteration_flags {
4364 * @iterator: the iterator function to call 4545 * @iterator: the iterator function to call
4365 * @data: first argument of the iterator function 4546 * @data: first argument of the iterator function
4366 */ 4547 */
4367void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, 4548static inline void
4368 u32 iter_flags, 4549ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, u32 iter_flags,
4369 void (*iterator)(void *data, u8 *mac, 4550 void (*iterator)(void *data, u8 *mac,
4370 struct ieee80211_vif *vif), 4551 struct ieee80211_vif *vif),
4371 void *data); 4552 void *data)
4553{
4554 ieee80211_iterate_interfaces(hw,
4555 iter_flags | IEEE80211_IFACE_ITER_ACTIVE,
4556 iterator, data);
4557}
4372 4558
4373/** 4559/**
4374 * ieee80211_iterate_active_interfaces_atomic - iterate active interfaces 4560 * ieee80211_iterate_active_interfaces_atomic - iterate active interfaces
@@ -5194,30 +5380,13 @@ int ieee80211_reserve_tid(struct ieee80211_sta *sta, u8 tid);
5194void ieee80211_unreserve_tid(struct ieee80211_sta *sta, u8 tid); 5380void ieee80211_unreserve_tid(struct ieee80211_sta *sta, u8 tid);
5195 5381
5196/** 5382/**
5197 * ieee80211_ie_split - split an IE buffer according to ordering 5383 * ieee80211_tx_dequeue - dequeue a packet from a software tx queue
5198 *
5199 * @ies: the IE buffer
5200 * @ielen: the length of the IE buffer
5201 * @ids: an array with element IDs that are allowed before
5202 * the split
5203 * @n_ids: the size of the element ID array
5204 * @offset: offset where to start splitting in the buffer
5205 *
5206 * This function splits an IE buffer by updating the @offset
5207 * variable to point to the location where the buffer should be
5208 * split.
5209 * 5384 *
5210 * It assumes that the given IE buffer is well-formed, this 5385 * @hw: pointer as obtained from ieee80211_alloc_hw()
5211 * has to be guaranteed by the caller! 5386 * @txq: pointer obtained from station or virtual interface
5212 *
5213 * It also assumes that the IEs in the buffer are ordered
5214 * correctly, if not the result of using this function will not
5215 * be ordered correctly either, i.e. it does no reordering.
5216 * 5387 *
5217 * The function returns the offset where the next part of the 5388 * Returns the skb if successful, %NULL if no frame was available.
5218 * buffer starts, which may be @ielen if the entire (remainder)
5219 * of the buffer should be used.
5220 */ 5389 */
5221size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 5390struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
5222 const u8 *ids, int n_ids, size_t offset); 5391 struct ieee80211_txq *txq);
5223#endif /* MAC80211_H */ 5392#endif /* MAC80211_H */
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index 850647811749..e18e7fd43f47 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -19,6 +19,7 @@
19#include <net/af_ieee802154.h> 19#include <net/af_ieee802154.h>
20#include <linux/ieee802154.h> 20#include <linux/ieee802154.h>
21#include <linux/skbuff.h> 21#include <linux/skbuff.h>
22#include <linux/unaligned/memmove.h>
22 23
23#include <net/cfg802154.h> 24#include <net/cfg802154.h>
24 25
@@ -212,7 +213,7 @@ struct ieee802154_ops {
212 int (*set_hw_addr_filt)(struct ieee802154_hw *hw, 213 int (*set_hw_addr_filt)(struct ieee802154_hw *hw,
213 struct ieee802154_hw_addr_filt *filt, 214 struct ieee802154_hw_addr_filt *filt,
214 unsigned long changed); 215 unsigned long changed);
215 int (*set_txpower)(struct ieee802154_hw *hw, int db); 216 int (*set_txpower)(struct ieee802154_hw *hw, s8 dbm);
216 int (*set_lbt)(struct ieee802154_hw *hw, bool on); 217 int (*set_lbt)(struct ieee802154_hw *hw, bool on);
217 int (*set_cca_mode)(struct ieee802154_hw *hw, 218 int (*set_cca_mode)(struct ieee802154_hw *hw,
218 const struct wpan_phy_cca *cca); 219 const struct wpan_phy_cca *cca);
@@ -233,9 +234,7 @@ struct ieee802154_ops {
233 */ 234 */
234static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src) 235static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src)
235{ 236{
236 __le64 tmp = (__force __le64)swab64p(be64_src); 237 __put_unaligned_memmove64(swab64p(be64_src), le64_dst);
237
238 memcpy(le64_dst, &tmp, IEEE802154_EXTENDED_ADDR_LEN);
239} 238}
240 239
241/** 240/**
@@ -245,12 +244,10 @@ static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src)
245 */ 244 */
246static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src) 245static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src)
247{ 246{
248 __be64 tmp = (__force __be64)swab64p(le64_src); 247 __put_unaligned_memmove64(swab64p(le64_src), be64_dst);
249
250 memcpy(be64_dst, &tmp, IEEE802154_EXTENDED_ADDR_LEN);
251} 248}
252 249
253/* Basic interface to register ieee802154 hwice */ 250/* Basic interface to register ieee802154 device */
254struct ieee802154_hw * 251struct ieee802154_hw *
255ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops); 252ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops);
256void ieee802154_free_hw(struct ieee802154_hw *hw); 253void ieee802154_free_hw(struct ieee802154_hw *hw);
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 6bbda34d5e59..b3a7751251b4 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -156,24 +156,7 @@ static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, _
156 156
157static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey) 157static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey)
158{ 158{
159 struct neigh_hash_table *nht; 159 return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, ndisc_hashfn, pkey, dev);
160 const u32 *p32 = pkey;
161 struct neighbour *n;
162 u32 hash_val;
163
164 nht = rcu_dereference_bh(nd_tbl.nht);
165 hash_val = ndisc_hashfn(pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift);
166 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]);
167 n != NULL;
168 n = rcu_dereference_bh(n->next)) {
169 u32 *n32 = (u32 *) n->primary_key;
170 if (n->dev == dev &&
171 ((n32[0] ^ p32[0]) | (n32[1] ^ p32[1]) |
172 (n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0)
173 return n;
174 }
175
176 return NULL;
177} 160}
178 161
179static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, const void *pkey) 162static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, const void *pkey)
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 76f708486aae..bd33e66f49aa 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -42,6 +42,7 @@ enum {
42 NEIGH_VAR_MCAST_PROBES, 42 NEIGH_VAR_MCAST_PROBES,
43 NEIGH_VAR_UCAST_PROBES, 43 NEIGH_VAR_UCAST_PROBES,
44 NEIGH_VAR_APP_PROBES, 44 NEIGH_VAR_APP_PROBES,
45 NEIGH_VAR_MCAST_REPROBES,
45 NEIGH_VAR_RETRANS_TIME, 46 NEIGH_VAR_RETRANS_TIME,
46 NEIGH_VAR_BASE_REACHABLE_TIME, 47 NEIGH_VAR_BASE_REACHABLE_TIME,
47 NEIGH_VAR_DELAY_PROBE_TIME, 48 NEIGH_VAR_DELAY_PROBE_TIME,
@@ -65,9 +66,7 @@ enum {
65}; 66};
66 67
67struct neigh_parms { 68struct neigh_parms {
68#ifdef CONFIG_NET_NS 69 possible_net_t net;
69 struct net *net;
70#endif
71 struct net_device *dev; 70 struct net_device *dev;
72 struct list_head list; 71 struct list_head list;
73 int (*neigh_setup)(struct neighbour *); 72 int (*neigh_setup)(struct neighbour *);
@@ -167,9 +166,7 @@ struct neigh_ops {
167 166
168struct pneigh_entry { 167struct pneigh_entry {
169 struct pneigh_entry *next; 168 struct pneigh_entry *next;
170#ifdef CONFIG_NET_NS 169 possible_net_t net;
171 struct net *net;
172#endif
173 struct net_device *dev; 170 struct net_device *dev;
174 u8 flags; 171 u8 flags;
175 u8 key[0]; 172 u8 key[0];
@@ -193,9 +190,11 @@ struct neigh_table {
193 int family; 190 int family;
194 int entry_size; 191 int entry_size;
195 int key_len; 192 int key_len;
193 __be16 protocol;
196 __u32 (*hash)(const void *pkey, 194 __u32 (*hash)(const void *pkey,
197 const struct net_device *dev, 195 const struct net_device *dev,
198 __u32 *hash_rnd); 196 __u32 *hash_rnd);
197 bool (*key_eq)(const struct neighbour *, const void *pkey);
199 int (*constructor)(struct neighbour *); 198 int (*constructor)(struct neighbour *);
200 int (*pconstructor)(struct pneigh_entry *); 199 int (*pconstructor)(struct pneigh_entry *);
201 void (*pdestructor)(struct pneigh_entry *); 200 void (*pdestructor)(struct pneigh_entry *);
@@ -224,6 +223,7 @@ enum {
224 NEIGH_ND_TABLE = 1, 223 NEIGH_ND_TABLE = 1,
225 NEIGH_DN_TABLE = 2, 224 NEIGH_DN_TABLE = 2,
226 NEIGH_NR_TABLES, 225 NEIGH_NR_TABLES,
226 NEIGH_LINK_TABLE = NEIGH_NR_TABLES /* Pseudo table for neigh_xmit */
227}; 227};
228 228
229static inline int neigh_parms_family(struct neigh_parms *p) 229static inline int neigh_parms_family(struct neigh_parms *p)
@@ -246,6 +246,57 @@ static inline void *neighbour_priv(const struct neighbour *n)
246#define NEIGH_UPDATE_F_ISROUTER 0x40000000 246#define NEIGH_UPDATE_F_ISROUTER 0x40000000
247#define NEIGH_UPDATE_F_ADMIN 0x80000000 247#define NEIGH_UPDATE_F_ADMIN 0x80000000
248 248
249
250static inline bool neigh_key_eq16(const struct neighbour *n, const void *pkey)
251{
252 return *(const u16 *)n->primary_key == *(const u16 *)pkey;
253}
254
255static inline bool neigh_key_eq32(const struct neighbour *n, const void *pkey)
256{
257 return *(const u32 *)n->primary_key == *(const u32 *)pkey;
258}
259
260static inline bool neigh_key_eq128(const struct neighbour *n, const void *pkey)
261{
262 const u32 *n32 = (const u32 *)n->primary_key;
263 const u32 *p32 = pkey;
264
265 return ((n32[0] ^ p32[0]) | (n32[1] ^ p32[1]) |
266 (n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0;
267}
268
269static inline struct neighbour *___neigh_lookup_noref(
270 struct neigh_table *tbl,
271 bool (*key_eq)(const struct neighbour *n, const void *pkey),
272 __u32 (*hash)(const void *pkey,
273 const struct net_device *dev,
274 __u32 *hash_rnd),
275 const void *pkey,
276 struct net_device *dev)
277{
278 struct neigh_hash_table *nht = rcu_dereference_bh(tbl->nht);
279 struct neighbour *n;
280 u32 hash_val;
281
282 hash_val = hash(pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift);
283 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]);
284 n != NULL;
285 n = rcu_dereference_bh(n->next)) {
286 if (n->dev == dev && key_eq(n, pkey))
287 return n;
288 }
289
290 return NULL;
291}
292
293static inline struct neighbour *__neigh_lookup_noref(struct neigh_table *tbl,
294 const void *pkey,
295 struct net_device *dev)
296{
297 return ___neigh_lookup_noref(tbl, tbl->key_eq, tbl->hash, pkey, dev);
298}
299
249void neigh_table_init(int index, struct neigh_table *tbl); 300void neigh_table_init(int index, struct neigh_table *tbl);
250int neigh_table_clear(int index, struct neigh_table *tbl); 301int neigh_table_clear(int index, struct neigh_table *tbl);
251struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey, 302struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey,
@@ -268,7 +319,6 @@ void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev);
268int neigh_ifdown(struct neigh_table *tbl, struct net_device *dev); 319int neigh_ifdown(struct neigh_table *tbl, struct net_device *dev);
269int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb); 320int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb);
270int neigh_connected_output(struct neighbour *neigh, struct sk_buff *skb); 321int neigh_connected_output(struct neighbour *neigh, struct sk_buff *skb);
271int neigh_compat_output(struct neighbour *neigh, struct sk_buff *skb);
272int neigh_direct_output(struct neighbour *neigh, struct sk_buff *skb); 322int neigh_direct_output(struct neighbour *neigh, struct sk_buff *skb);
273struct neighbour *neigh_event_ns(struct neigh_table *tbl, 323struct neighbour *neigh_event_ns(struct neigh_table *tbl,
274 u8 *lladdr, void *saddr, 324 u8 *lladdr, void *saddr,
@@ -306,6 +356,7 @@ void neigh_for_each(struct neigh_table *tbl,
306 void (*cb)(struct neighbour *, void *), void *cookie); 356 void (*cb)(struct neighbour *, void *), void *cookie);
307void __neigh_for_each_release(struct neigh_table *tbl, 357void __neigh_for_each_release(struct neigh_table *tbl,
308 int (*cb)(struct neighbour *)); 358 int (*cb)(struct neighbour *));
359int neigh_xmit(int fam, struct net_device *, const void *, struct sk_buff *);
309void pneigh_for_each(struct neigh_table *tbl, 360void pneigh_for_each(struct neigh_table *tbl,
310 void (*cb)(struct pneigh_entry *)); 361 void (*cb)(struct pneigh_entry *));
311 362
@@ -459,4 +510,6 @@ static inline void neigh_ha_snapshot(char *dst, const struct neighbour *n,
459 memcpy(dst, n->ha, dev->addr_len); 510 memcpy(dst, n->ha, dev->addr_len);
460 } while (read_seqretry(&n->ha_lock, seq)); 511 } while (read_seqretry(&n->ha_lock, seq));
461} 512}
513
514
462#endif 515#endif
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 36faf4990c4b..f733656404de 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -26,6 +26,7 @@
26#endif 26#endif
27#include <net/netns/nftables.h> 27#include <net/netns/nftables.h>
28#include <net/netns/xfrm.h> 28#include <net/netns/xfrm.h>
29#include <net/netns/mpls.h>
29#include <linux/ns_common.h> 30#include <linux/ns_common.h>
30 31
31struct user_namespace; 32struct user_namespace;
@@ -48,13 +49,10 @@ struct net {
48 atomic_t count; /* To decided when the network 49 atomic_t count; /* To decided when the network
49 * namespace should be shut down. 50 * namespace should be shut down.
50 */ 51 */
51#ifdef NETNS_REFCNT_DEBUG
52 atomic_t use_count; /* To track references we
53 * destroy on demand
54 */
55#endif
56 spinlock_t rules_mod_lock; 52 spinlock_t rules_mod_lock;
57 53
54 atomic64_t cookie_gen;
55
58 struct list_head list; /* list of network namespaces */ 56 struct list_head list; /* list of network namespaces */
59 struct list_head cleanup_list; /* namespaces on death row */ 57 struct list_head cleanup_list; /* namespaces on death row */
60 struct list_head exit_list; /* Use only net_mutex */ 58 struct list_head exit_list; /* Use only net_mutex */
@@ -130,6 +128,9 @@ struct net {
130#if IS_ENABLED(CONFIG_IP_VS) 128#if IS_ENABLED(CONFIG_IP_VS)
131 struct netns_ipvs *ipvs; 129 struct netns_ipvs *ipvs;
132#endif 130#endif
131#if IS_ENABLED(CONFIG_MPLS)
132 struct netns_mpls mpls;
133#endif
133 struct sock *diag_nlsk; 134 struct sock *diag_nlsk;
134 atomic_t fnhe_genid; 135 atomic_t fnhe_genid;
135}; 136};
@@ -230,48 +231,27 @@ int net_eq(const struct net *net1, const struct net *net2)
230#endif 231#endif
231 232
232 233
233#ifdef NETNS_REFCNT_DEBUG 234typedef struct {
234static inline struct net *hold_net(struct net *net)
235{
236 if (net)
237 atomic_inc(&net->use_count);
238 return net;
239}
240
241static inline void release_net(struct net *net)
242{
243 if (net)
244 atomic_dec(&net->use_count);
245}
246#else
247static inline struct net *hold_net(struct net *net)
248{
249 return net;
250}
251
252static inline void release_net(struct net *net)
253{
254}
255#endif
256
257#ifdef CONFIG_NET_NS 235#ifdef CONFIG_NET_NS
236 struct net *net;
237#endif
238} possible_net_t;
258 239
259static inline void write_pnet(struct net **pnet, struct net *net) 240static inline void write_pnet(possible_net_t *pnet, struct net *net)
260{ 241{
261 *pnet = net; 242#ifdef CONFIG_NET_NS
243 pnet->net = net;
244#endif
262} 245}
263 246
264static inline struct net *read_pnet(struct net * const *pnet) 247static inline struct net *read_pnet(const possible_net_t *pnet)
265{ 248{
266 return *pnet; 249#ifdef CONFIG_NET_NS
267} 250 return pnet->net;
268
269#else 251#else
270 252 return &init_net;
271#define write_pnet(pnet, net) do { (void)(net);} while (0)
272#define read_pnet(pnet) (&init_net)
273
274#endif 253#endif
254}
275 255
276#define for_each_net(VAR) \ 256#define for_each_net(VAR) \
277 list_for_each_entry(VAR, &net_namespace_list, list) 257 list_for_each_entry(VAR, &net_namespace_list, list)
diff --git a/include/net/netfilter/ipv4/nf_reject.h b/include/net/netfilter/ipv4/nf_reject.h
index 03e928a55229..77862c3645f0 100644
--- a/include/net/netfilter/ipv4/nf_reject.h
+++ b/include/net/netfilter/ipv4/nf_reject.h
@@ -5,18 +5,14 @@
5#include <net/ip.h> 5#include <net/ip.h>
6#include <net/icmp.h> 6#include <net/icmp.h>
7 7
8static inline void nf_send_unreach(struct sk_buff *skb_in, int code) 8void nf_send_unreach(struct sk_buff *skb_in, int code, int hook);
9{
10 icmp_send(skb_in, ICMP_DEST_UNREACH, code, 0);
11}
12
13void nf_send_reset(struct sk_buff *oldskb, int hook); 9void nf_send_reset(struct sk_buff *oldskb, int hook);
14 10
15const struct tcphdr *nf_reject_ip_tcphdr_get(struct sk_buff *oldskb, 11const struct tcphdr *nf_reject_ip_tcphdr_get(struct sk_buff *oldskb,
16 struct tcphdr *_oth, int hook); 12 struct tcphdr *_oth, int hook);
17struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb, 13struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb,
18 const struct sk_buff *oldskb, 14 const struct sk_buff *oldskb,
19 __be16 protocol, int ttl); 15 __u8 protocol, int ttl);
20void nf_reject_ip_tcphdr_put(struct sk_buff *nskb, const struct sk_buff *oldskb, 16void nf_reject_ip_tcphdr_put(struct sk_buff *nskb, const struct sk_buff *oldskb,
21 const struct tcphdr *oth); 17 const struct tcphdr *oth);
22 18
diff --git a/include/net/netfilter/ipv6/nf_reject.h b/include/net/netfilter/ipv6/nf_reject.h
index 23216d48abf9..0ea4fa37db16 100644
--- a/include/net/netfilter/ipv6/nf_reject.h
+++ b/include/net/netfilter/ipv6/nf_reject.h
@@ -3,15 +3,8 @@
3 3
4#include <linux/icmpv6.h> 4#include <linux/icmpv6.h>
5 5
6static inline void 6void nf_send_unreach6(struct net *net, struct sk_buff *skb_in, unsigned char code,
7nf_send_unreach6(struct net *net, struct sk_buff *skb_in, unsigned char code, 7 unsigned int hooknum);
8 unsigned int hooknum)
9{
10 if (hooknum == NF_INET_LOCAL_OUT && skb_in->dev == NULL)
11 skb_in->dev = net->loopback_dev;
12
13 icmpv6_send(skb_in, ICMPV6_DEST_UNREACH, code, 0);
14}
15 8
16void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook); 9void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook);
17 10
@@ -20,7 +13,7 @@ const struct tcphdr *nf_reject_ip6_tcphdr_get(struct sk_buff *oldskb,
20 unsigned int *otcplen, int hook); 13 unsigned int *otcplen, int hook);
21struct ipv6hdr *nf_reject_ip6hdr_put(struct sk_buff *nskb, 14struct ipv6hdr *nf_reject_ip6hdr_put(struct sk_buff *nskb,
22 const struct sk_buff *oldskb, 15 const struct sk_buff *oldskb,
23 __be16 protocol, int hoplimit); 16 __u8 protocol, int hoplimit);
24void nf_reject_ip6_tcphdr_put(struct sk_buff *nskb, 17void nf_reject_ip6_tcphdr_put(struct sk_buff *nskb,
25 const struct sk_buff *oldskb, 18 const struct sk_buff *oldskb,
26 const struct tcphdr *oth, unsigned int otcplen); 19 const struct tcphdr *oth, unsigned int otcplen);
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 74f271a172dd..095433b8a8b0 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -95,9 +95,8 @@ struct nf_conn {
95 /* Timer function; drops refcnt when it goes off. */ 95 /* Timer function; drops refcnt when it goes off. */
96 struct timer_list timeout; 96 struct timer_list timeout;
97 97
98#ifdef CONFIG_NET_NS 98 possible_net_t ct_net;
99 struct net *ct_net; 99
100#endif
101 /* all members below initialized via memset */ 100 /* all members below initialized via memset */
102 u8 __nfct_init_offset[0]; 101 u8 __nfct_init_offset[0];
103 102
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h
index 534e1f2ac4fc..57639fca223a 100644
--- a/include/net/netfilter/nf_log.h
+++ b/include/net/netfilter/nf_log.h
@@ -79,6 +79,16 @@ void nf_log_packet(struct net *net,
79 const struct nf_loginfo *li, 79 const struct nf_loginfo *li,
80 const char *fmt, ...); 80 const char *fmt, ...);
81 81
82__printf(8, 9)
83void nf_log_trace(struct net *net,
84 u_int8_t pf,
85 unsigned int hooknum,
86 const struct sk_buff *skb,
87 const struct net_device *in,
88 const struct net_device *out,
89 const struct nf_loginfo *li,
90 const char *fmt, ...);
91
82struct nf_log_buf; 92struct nf_log_buf;
83 93
84struct nf_log_buf *nf_log_buf_open(void); 94struct nf_log_buf *nf_log_buf_open(void);
diff --git a/include/net/netfilter/nf_nat_l3proto.h b/include/net/netfilter/nf_nat_l3proto.h
index 340c013795a4..a3127325f624 100644
--- a/include/net/netfilter/nf_nat_l3proto.h
+++ b/include/net/netfilter/nf_nat_l3proto.h
@@ -44,40 +44,32 @@ int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
44 unsigned int hooknum); 44 unsigned int hooknum);
45 45
46unsigned int nf_nat_ipv4_in(const struct nf_hook_ops *ops, struct sk_buff *skb, 46unsigned int nf_nat_ipv4_in(const struct nf_hook_ops *ops, struct sk_buff *skb,
47 const struct net_device *in, 47 const struct nf_hook_state *state,
48 const struct net_device *out,
49 unsigned int (*do_chain)(const struct nf_hook_ops *ops, 48 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
50 struct sk_buff *skb, 49 struct sk_buff *skb,
51 const struct net_device *in, 50 const struct nf_hook_state *state,
52 const struct net_device *out,
53 struct nf_conn *ct)); 51 struct nf_conn *ct));
54 52
55unsigned int nf_nat_ipv4_out(const struct nf_hook_ops *ops, struct sk_buff *skb, 53unsigned int nf_nat_ipv4_out(const struct nf_hook_ops *ops, struct sk_buff *skb,
56 const struct net_device *in, 54 const struct nf_hook_state *state,
57 const struct net_device *out,
58 unsigned int (*do_chain)(const struct nf_hook_ops *ops, 55 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
59 struct sk_buff *skb, 56 struct sk_buff *skb,
60 const struct net_device *in, 57 const struct nf_hook_state *state,
61 const struct net_device *out,
62 struct nf_conn *ct)); 58 struct nf_conn *ct));
63 59
64unsigned int nf_nat_ipv4_local_fn(const struct nf_hook_ops *ops, 60unsigned int nf_nat_ipv4_local_fn(const struct nf_hook_ops *ops,
65 struct sk_buff *skb, 61 struct sk_buff *skb,
66 const struct net_device *in, 62 const struct nf_hook_state *state,
67 const struct net_device *out,
68 unsigned int (*do_chain)(const struct nf_hook_ops *ops, 63 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
69 struct sk_buff *skb, 64 struct sk_buff *skb,
70 const struct net_device *in, 65 const struct nf_hook_state *state,
71 const struct net_device *out,
72 struct nf_conn *ct)); 66 struct nf_conn *ct));
73 67
74unsigned int nf_nat_ipv4_fn(const struct nf_hook_ops *ops, struct sk_buff *skb, 68unsigned int nf_nat_ipv4_fn(const struct nf_hook_ops *ops, struct sk_buff *skb,
75 const struct net_device *in, 69 const struct nf_hook_state *state,
76 const struct net_device *out,
77 unsigned int (*do_chain)(const struct nf_hook_ops *ops, 70 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
78 struct sk_buff *skb, 71 struct sk_buff *skb,
79 const struct net_device *in, 72 const struct nf_hook_state *state,
80 const struct net_device *out,
81 struct nf_conn *ct)); 73 struct nf_conn *ct));
82 74
83int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct, 75int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
@@ -85,40 +77,32 @@ int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
85 unsigned int hooknum, unsigned int hdrlen); 77 unsigned int hooknum, unsigned int hdrlen);
86 78
87unsigned int nf_nat_ipv6_in(const struct nf_hook_ops *ops, struct sk_buff *skb, 79unsigned int nf_nat_ipv6_in(const struct nf_hook_ops *ops, struct sk_buff *skb,
88 const struct net_device *in, 80 const struct nf_hook_state *state,
89 const struct net_device *out,
90 unsigned int (*do_chain)(const struct nf_hook_ops *ops, 81 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
91 struct sk_buff *skb, 82 struct sk_buff *skb,
92 const struct net_device *in, 83 const struct nf_hook_state *state,
93 const struct net_device *out,
94 struct nf_conn *ct)); 84 struct nf_conn *ct));
95 85
96unsigned int nf_nat_ipv6_out(const struct nf_hook_ops *ops, struct sk_buff *skb, 86unsigned int nf_nat_ipv6_out(const struct nf_hook_ops *ops, struct sk_buff *skb,
97 const struct net_device *in, 87 const struct nf_hook_state *state,
98 const struct net_device *out,
99 unsigned int (*do_chain)(const struct nf_hook_ops *ops, 88 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
100 struct sk_buff *skb, 89 struct sk_buff *skb,
101 const struct net_device *in, 90 const struct nf_hook_state *state,
102 const struct net_device *out,
103 struct nf_conn *ct)); 91 struct nf_conn *ct));
104 92
105unsigned int nf_nat_ipv6_local_fn(const struct nf_hook_ops *ops, 93unsigned int nf_nat_ipv6_local_fn(const struct nf_hook_ops *ops,
106 struct sk_buff *skb, 94 struct sk_buff *skb,
107 const struct net_device *in, 95 const struct nf_hook_state *state,
108 const struct net_device *out,
109 unsigned int (*do_chain)(const struct nf_hook_ops *ops, 96 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
110 struct sk_buff *skb, 97 struct sk_buff *skb,
111 const struct net_device *in, 98 const struct nf_hook_state *state,
112 const struct net_device *out,
113 struct nf_conn *ct)); 99 struct nf_conn *ct));
114 100
115unsigned int nf_nat_ipv6_fn(const struct nf_hook_ops *ops, struct sk_buff *skb, 101unsigned int nf_nat_ipv6_fn(const struct nf_hook_ops *ops, struct sk_buff *skb,
116 const struct net_device *in, 102 const struct nf_hook_state *state,
117 const struct net_device *out,
118 unsigned int (*do_chain)(const struct nf_hook_ops *ops, 103 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
119 struct sk_buff *skb, 104 struct sk_buff *skb,
120 const struct net_device *in, 105 const struct nf_hook_state *state,
121 const struct net_device *out,
122 struct nf_conn *ct)); 106 struct nf_conn *ct));
123 107
124#endif /* _NF_NAT_L3PROTO_H */ 108#endif /* _NF_NAT_L3PROTO_H */
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h
index 84a53d780306..d81d584157e1 100644
--- a/include/net/netfilter/nf_queue.h
+++ b/include/net/netfilter/nf_queue.h
@@ -12,12 +12,8 @@ struct nf_queue_entry {
12 unsigned int id; 12 unsigned int id;
13 13
14 struct nf_hook_ops *elem; 14 struct nf_hook_ops *elem;
15 u_int8_t pf; 15 struct nf_hook_state state;
16 u16 size; /* sizeof(entry) + saved route keys */ 16 u16 size; /* sizeof(entry) + saved route keys */
17 unsigned int hook;
18 struct net_device *indev;
19 struct net_device *outdev;
20 int (*okfn)(struct sk_buff *);
21 17
22 /* extra space to store route keys */ 18 /* extra space to store route keys */
23}; 19};
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 9eaaa7884586..e6bcf55dcf20 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -1,6 +1,7 @@
1#ifndef _NET_NF_TABLES_H 1#ifndef _NET_NF_TABLES_H
2#define _NET_NF_TABLES_H 2#define _NET_NF_TABLES_H
3 3
4#include <linux/module.h>
4#include <linux/list.h> 5#include <linux/list.h>
5#include <linux/netfilter.h> 6#include <linux/netfilter.h>
6#include <linux/netfilter/nfnetlink.h> 7#include <linux/netfilter/nfnetlink.h>
@@ -26,40 +27,53 @@ struct nft_pktinfo {
26static inline void nft_set_pktinfo(struct nft_pktinfo *pkt, 27static inline void nft_set_pktinfo(struct nft_pktinfo *pkt,
27 const struct nf_hook_ops *ops, 28 const struct nf_hook_ops *ops,
28 struct sk_buff *skb, 29 struct sk_buff *skb,
29 const struct net_device *in, 30 const struct nf_hook_state *state)
30 const struct net_device *out)
31{ 31{
32 pkt->skb = skb; 32 pkt->skb = skb;
33 pkt->in = pkt->xt.in = in; 33 pkt->in = pkt->xt.in = state->in;
34 pkt->out = pkt->xt.out = out; 34 pkt->out = pkt->xt.out = state->out;
35 pkt->ops = ops; 35 pkt->ops = ops;
36 pkt->xt.hooknum = ops->hooknum; 36 pkt->xt.hooknum = ops->hooknum;
37 pkt->xt.family = ops->pf; 37 pkt->xt.family = ops->pf;
38} 38}
39 39
40/**
41 * struct nft_verdict - nf_tables verdict
42 *
43 * @code: nf_tables/netfilter verdict code
44 * @chain: destination chain for NFT_JUMP/NFT_GOTO
45 */
46struct nft_verdict {
47 u32 code;
48 struct nft_chain *chain;
49};
50
40struct nft_data { 51struct nft_data {
41 union { 52 union {
42 u32 data[4]; 53 u32 data[4];
43 struct { 54 struct nft_verdict verdict;
44 u32 verdict;
45 struct nft_chain *chain;
46 };
47 }; 55 };
48} __attribute__((aligned(__alignof__(u64)))); 56} __attribute__((aligned(__alignof__(u64))));
49 57
50static inline int nft_data_cmp(const struct nft_data *d1, 58/**
51 const struct nft_data *d2, 59 * struct nft_regs - nf_tables register set
52 unsigned int len) 60 *
53{ 61 * @data: data registers
54 return memcmp(d1->data, d2->data, len); 62 * @verdict: verdict register
55} 63 *
64 * The first four data registers alias to the verdict register.
65 */
66struct nft_regs {
67 union {
68 u32 data[20];
69 struct nft_verdict verdict;
70 };
71};
56 72
57static inline void nft_data_copy(struct nft_data *dst, 73static inline void nft_data_copy(u32 *dst, const struct nft_data *src,
58 const struct nft_data *src) 74 unsigned int len)
59{ 75{
60 BUILD_BUG_ON(__alignof__(*dst) != __alignof__(u64)); 76 memcpy(dst, src, len);
61 *(u64 *)&dst->data[0] = *(u64 *)&src->data[0];
62 *(u64 *)&dst->data[2] = *(u64 *)&src->data[2];
63} 77}
64 78
65static inline void nft_data_debug(const struct nft_data *data) 79static inline void nft_data_debug(const struct nft_data *data)
@@ -97,7 +111,8 @@ struct nft_data_desc {
97 unsigned int len; 111 unsigned int len;
98}; 112};
99 113
100int nft_data_init(const struct nft_ctx *ctx, struct nft_data *data, 114int nft_data_init(const struct nft_ctx *ctx,
115 struct nft_data *data, unsigned int size,
101 struct nft_data_desc *desc, const struct nlattr *nla); 116 struct nft_data_desc *desc, const struct nlattr *nla);
102void nft_data_uninit(const struct nft_data *data, enum nft_data_types type); 117void nft_data_uninit(const struct nft_data *data, enum nft_data_types type);
103int nft_data_dump(struct sk_buff *skb, int attr, const struct nft_data *data, 118int nft_data_dump(struct sk_buff *skb, int attr, const struct nft_data *data,
@@ -113,28 +128,42 @@ static inline enum nft_registers nft_type_to_reg(enum nft_data_types type)
113 return type == NFT_DATA_VERDICT ? NFT_REG_VERDICT : NFT_REG_1; 128 return type == NFT_DATA_VERDICT ? NFT_REG_VERDICT : NFT_REG_1;
114} 129}
115 130
116int nft_validate_input_register(enum nft_registers reg); 131unsigned int nft_parse_register(const struct nlattr *attr);
117int nft_validate_output_register(enum nft_registers reg); 132int nft_dump_register(struct sk_buff *skb, unsigned int attr, unsigned int reg);
118int nft_validate_data_load(const struct nft_ctx *ctx, enum nft_registers reg, 133
119 const struct nft_data *data, 134int nft_validate_register_load(enum nft_registers reg, unsigned int len);
120 enum nft_data_types type); 135int nft_validate_register_store(const struct nft_ctx *ctx,
136 enum nft_registers reg,
137 const struct nft_data *data,
138 enum nft_data_types type, unsigned int len);
139
140/**
141 * struct nft_userdata - user defined data associated with an object
142 *
143 * @len: length of the data
144 * @data: content
145 *
146 * The presence of user data is indicated in an object specific fashion,
147 * so a length of zero can't occur and the value "len" indicates data
148 * of length len + 1.
149 */
150struct nft_userdata {
151 u8 len;
152 unsigned char data[0];
153};
121 154
122/** 155/**
123 * struct nft_set_elem - generic representation of set elements 156 * struct nft_set_elem - generic representation of set elements
124 * 157 *
125 * @cookie: implementation specific element cookie
126 * @key: element key 158 * @key: element key
127 * @data: element data (maps only) 159 * @priv: element private data and extensions
128 * @flags: element flags (end of interval)
129 *
130 * The cookie can be used to store a handle to the element for subsequent
131 * removal.
132 */ 160 */
133struct nft_set_elem { 161struct nft_set_elem {
134 void *cookie; 162 union {
135 struct nft_data key; 163 u32 buf[NFT_DATA_VALUE_MAXLEN / sizeof(u32)];
136 struct nft_data data; 164 struct nft_data val;
137 u32 flags; 165 } key;
166 void *priv;
138}; 167};
139 168
140struct nft_set; 169struct nft_set;
@@ -186,11 +215,16 @@ struct nft_set_estimate {
186 enum nft_set_class class; 215 enum nft_set_class class;
187}; 216};
188 217
218struct nft_set_ext;
219struct nft_expr;
220
189/** 221/**
190 * struct nft_set_ops - nf_tables set operations 222 * struct nft_set_ops - nf_tables set operations
191 * 223 *
192 * @lookup: look up an element within the set 224 * @lookup: look up an element within the set
193 * @insert: insert new element into set 225 * @insert: insert new element into set
226 * @activate: activate new element in the next generation
227 * @deactivate: deactivate element in the next generation
194 * @remove: remove element from set 228 * @remove: remove element from set
195 * @walk: iterate over all set elemeennts 229 * @walk: iterate over all set elemeennts
196 * @privsize: function to return size of set private data 230 * @privsize: function to return size of set private data
@@ -198,16 +232,28 @@ struct nft_set_estimate {
198 * @destroy: destroy private data of set instance 232 * @destroy: destroy private data of set instance
199 * @list: nf_tables_set_ops list node 233 * @list: nf_tables_set_ops list node
200 * @owner: module reference 234 * @owner: module reference
235 * @elemsize: element private size
201 * @features: features supported by the implementation 236 * @features: features supported by the implementation
202 */ 237 */
203struct nft_set_ops { 238struct nft_set_ops {
204 bool (*lookup)(const struct nft_set *set, 239 bool (*lookup)(const struct nft_set *set,
205 const struct nft_data *key, 240 const u32 *key,
206 struct nft_data *data); 241 const struct nft_set_ext **ext);
207 int (*get)(const struct nft_set *set, 242 bool (*update)(struct nft_set *set,
208 struct nft_set_elem *elem); 243 const u32 *key,
244 void *(*new)(struct nft_set *,
245 const struct nft_expr *,
246 struct nft_regs *),
247 const struct nft_expr *expr,
248 struct nft_regs *regs,
249 const struct nft_set_ext **ext);
250
209 int (*insert)(const struct nft_set *set, 251 int (*insert)(const struct nft_set *set,
210 const struct nft_set_elem *elem); 252 const struct nft_set_elem *elem);
253 void (*activate)(const struct nft_set *set,
254 const struct nft_set_elem *elem);
255 void * (*deactivate)(const struct nft_set *set,
256 const struct nft_set_elem *elem);
211 void (*remove)(const struct nft_set *set, 257 void (*remove)(const struct nft_set *set,
212 const struct nft_set_elem *elem); 258 const struct nft_set_elem *elem);
213 void (*walk)(const struct nft_ctx *ctx, 259 void (*walk)(const struct nft_ctx *ctx,
@@ -225,6 +271,7 @@ struct nft_set_ops {
225 271
226 struct list_head list; 272 struct list_head list;
227 struct module *owner; 273 struct module *owner;
274 unsigned int elemsize;
228 u32 features; 275 u32 features;
229}; 276};
230 277
@@ -241,8 +288,12 @@ void nft_unregister_set(struct nft_set_ops *ops);
241 * @dtype: data type (verdict or numeric type defined by userspace) 288 * @dtype: data type (verdict or numeric type defined by userspace)
242 * @size: maximum set size 289 * @size: maximum set size
243 * @nelems: number of elements 290 * @nelems: number of elements
291 * @ndeact: number of deactivated elements queued for removal
292 * @timeout: default timeout value in msecs
293 * @gc_int: garbage collection interval in msecs
244 * @policy: set parameterization (see enum nft_set_policies) 294 * @policy: set parameterization (see enum nft_set_policies)
245 * @ops: set ops 295 * @ops: set ops
296 * @pnet: network namespace
246 * @flags: set flags 297 * @flags: set flags
247 * @klen: key length 298 * @klen: key length
248 * @dlen: data length 299 * @dlen: data length
@@ -255,10 +306,14 @@ struct nft_set {
255 u32 ktype; 306 u32 ktype;
256 u32 dtype; 307 u32 dtype;
257 u32 size; 308 u32 size;
258 u32 nelems; 309 atomic_t nelems;
310 u32 ndeact;
311 u64 timeout;
312 u32 gc_int;
259 u16 policy; 313 u16 policy;
260 /* runtime data below here */ 314 /* runtime data below here */
261 const struct nft_set_ops *ops ____cacheline_aligned; 315 const struct nft_set_ops *ops ____cacheline_aligned;
316 possible_net_t pnet;
262 u16 flags; 317 u16 flags;
263 u8 klen; 318 u8 klen;
264 u8 dlen; 319 u8 dlen;
@@ -271,16 +326,27 @@ static inline void *nft_set_priv(const struct nft_set *set)
271 return (void *)set->data; 326 return (void *)set->data;
272} 327}
273 328
329static inline struct nft_set *nft_set_container_of(const void *priv)
330{
331 return (void *)priv - offsetof(struct nft_set, data);
332}
333
274struct nft_set *nf_tables_set_lookup(const struct nft_table *table, 334struct nft_set *nf_tables_set_lookup(const struct nft_table *table,
275 const struct nlattr *nla); 335 const struct nlattr *nla);
276struct nft_set *nf_tables_set_lookup_byid(const struct net *net, 336struct nft_set *nf_tables_set_lookup_byid(const struct net *net,
277 const struct nlattr *nla); 337 const struct nlattr *nla);
278 338
339static inline unsigned long nft_set_gc_interval(const struct nft_set *set)
340{
341 return set->gc_int ? msecs_to_jiffies(set->gc_int) : HZ;
342}
343
279/** 344/**
280 * struct nft_set_binding - nf_tables set binding 345 * struct nft_set_binding - nf_tables set binding
281 * 346 *
282 * @list: set bindings list node 347 * @list: set bindings list node
283 * @chain: chain containing the rule bound to the set 348 * @chain: chain containing the rule bound to the set
349 * @flags: set action flags
284 * 350 *
285 * A set binding contains all information necessary for validation 351 * A set binding contains all information necessary for validation
286 * of new elements added to a bound set. 352 * of new elements added to a bound set.
@@ -288,6 +354,7 @@ struct nft_set *nf_tables_set_lookup_byid(const struct net *net,
288struct nft_set_binding { 354struct nft_set_binding {
289 struct list_head list; 355 struct list_head list;
290 const struct nft_chain *chain; 356 const struct nft_chain *chain;
357 u32 flags;
291}; 358};
292 359
293int nf_tables_bind_set(const struct nft_ctx *ctx, struct nft_set *set, 360int nf_tables_bind_set(const struct nft_ctx *ctx, struct nft_set *set,
@@ -295,6 +362,215 @@ int nf_tables_bind_set(const struct nft_ctx *ctx, struct nft_set *set,
295void nf_tables_unbind_set(const struct nft_ctx *ctx, struct nft_set *set, 362void nf_tables_unbind_set(const struct nft_ctx *ctx, struct nft_set *set,
296 struct nft_set_binding *binding); 363 struct nft_set_binding *binding);
297 364
365/**
366 * enum nft_set_extensions - set extension type IDs
367 *
368 * @NFT_SET_EXT_KEY: element key
369 * @NFT_SET_EXT_DATA: mapping data
370 * @NFT_SET_EXT_FLAGS: element flags
371 * @NFT_SET_EXT_TIMEOUT: element timeout
372 * @NFT_SET_EXT_EXPIRATION: element expiration time
373 * @NFT_SET_EXT_USERDATA: user data associated with the element
374 * @NFT_SET_EXT_EXPR: expression assiociated with the element
375 * @NFT_SET_EXT_NUM: number of extension types
376 */
377enum nft_set_extensions {
378 NFT_SET_EXT_KEY,
379 NFT_SET_EXT_DATA,
380 NFT_SET_EXT_FLAGS,
381 NFT_SET_EXT_TIMEOUT,
382 NFT_SET_EXT_EXPIRATION,
383 NFT_SET_EXT_USERDATA,
384 NFT_SET_EXT_EXPR,
385 NFT_SET_EXT_NUM
386};
387
388/**
389 * struct nft_set_ext_type - set extension type
390 *
391 * @len: fixed part length of the extension
392 * @align: alignment requirements of the extension
393 */
394struct nft_set_ext_type {
395 u8 len;
396 u8 align;
397};
398
399extern const struct nft_set_ext_type nft_set_ext_types[];
400
401/**
402 * struct nft_set_ext_tmpl - set extension template
403 *
404 * @len: length of extension area
405 * @offset: offsets of individual extension types
406 */
407struct nft_set_ext_tmpl {
408 u16 len;
409 u8 offset[NFT_SET_EXT_NUM];
410};
411
412/**
413 * struct nft_set_ext - set extensions
414 *
415 * @genmask: generation mask
416 * @offset: offsets of individual extension types
417 * @data: beginning of extension data
418 */
419struct nft_set_ext {
420 u8 genmask;
421 u8 offset[NFT_SET_EXT_NUM];
422 char data[0];
423};
424
425static inline void nft_set_ext_prepare(struct nft_set_ext_tmpl *tmpl)
426{
427 memset(tmpl, 0, sizeof(*tmpl));
428 tmpl->len = sizeof(struct nft_set_ext);
429}
430
431static inline void nft_set_ext_add_length(struct nft_set_ext_tmpl *tmpl, u8 id,
432 unsigned int len)
433{
434 tmpl->len = ALIGN(tmpl->len, nft_set_ext_types[id].align);
435 BUG_ON(tmpl->len > U8_MAX);
436 tmpl->offset[id] = tmpl->len;
437 tmpl->len += nft_set_ext_types[id].len + len;
438}
439
440static inline void nft_set_ext_add(struct nft_set_ext_tmpl *tmpl, u8 id)
441{
442 nft_set_ext_add_length(tmpl, id, 0);
443}
444
445static inline void nft_set_ext_init(struct nft_set_ext *ext,
446 const struct nft_set_ext_tmpl *tmpl)
447{
448 memcpy(ext->offset, tmpl->offset, sizeof(ext->offset));
449}
450
451static inline bool __nft_set_ext_exists(const struct nft_set_ext *ext, u8 id)
452{
453 return !!ext->offset[id];
454}
455
456static inline bool nft_set_ext_exists(const struct nft_set_ext *ext, u8 id)
457{
458 return ext && __nft_set_ext_exists(ext, id);
459}
460
461static inline void *nft_set_ext(const struct nft_set_ext *ext, u8 id)
462{
463 return (void *)ext + ext->offset[id];
464}
465
466static inline struct nft_data *nft_set_ext_key(const struct nft_set_ext *ext)
467{
468 return nft_set_ext(ext, NFT_SET_EXT_KEY);
469}
470
471static inline struct nft_data *nft_set_ext_data(const struct nft_set_ext *ext)
472{
473 return nft_set_ext(ext, NFT_SET_EXT_DATA);
474}
475
476static inline u8 *nft_set_ext_flags(const struct nft_set_ext *ext)
477{
478 return nft_set_ext(ext, NFT_SET_EXT_FLAGS);
479}
480
481static inline u64 *nft_set_ext_timeout(const struct nft_set_ext *ext)
482{
483 return nft_set_ext(ext, NFT_SET_EXT_TIMEOUT);
484}
485
486static inline unsigned long *nft_set_ext_expiration(const struct nft_set_ext *ext)
487{
488 return nft_set_ext(ext, NFT_SET_EXT_EXPIRATION);
489}
490
491static inline struct nft_userdata *nft_set_ext_userdata(const struct nft_set_ext *ext)
492{
493 return nft_set_ext(ext, NFT_SET_EXT_USERDATA);
494}
495
496static inline struct nft_expr *nft_set_ext_expr(const struct nft_set_ext *ext)
497{
498 return nft_set_ext(ext, NFT_SET_EXT_EXPR);
499}
500
501static inline bool nft_set_elem_expired(const struct nft_set_ext *ext)
502{
503 return nft_set_ext_exists(ext, NFT_SET_EXT_EXPIRATION) &&
504 time_is_before_eq_jiffies(*nft_set_ext_expiration(ext));
505}
506
507static inline struct nft_set_ext *nft_set_elem_ext(const struct nft_set *set,
508 void *elem)
509{
510 return elem + set->ops->elemsize;
511}
512
513void *nft_set_elem_init(const struct nft_set *set,
514 const struct nft_set_ext_tmpl *tmpl,
515 const u32 *key, const u32 *data,
516 u64 timeout, gfp_t gfp);
517void nft_set_elem_destroy(const struct nft_set *set, void *elem);
518
519/**
520 * struct nft_set_gc_batch_head - nf_tables set garbage collection batch
521 *
522 * @rcu: rcu head
523 * @set: set the elements belong to
524 * @cnt: count of elements
525 */
526struct nft_set_gc_batch_head {
527 struct rcu_head rcu;
528 const struct nft_set *set;
529 unsigned int cnt;
530};
531
532#define NFT_SET_GC_BATCH_SIZE ((PAGE_SIZE - \
533 sizeof(struct nft_set_gc_batch_head)) / \
534 sizeof(void *))
535
536/**
537 * struct nft_set_gc_batch - nf_tables set garbage collection batch
538 *
539 * @head: GC batch head
540 * @elems: garbage collection elements
541 */
542struct nft_set_gc_batch {
543 struct nft_set_gc_batch_head head;
544 void *elems[NFT_SET_GC_BATCH_SIZE];
545};
546
547struct nft_set_gc_batch *nft_set_gc_batch_alloc(const struct nft_set *set,
548 gfp_t gfp);
549void nft_set_gc_batch_release(struct rcu_head *rcu);
550
551static inline void nft_set_gc_batch_complete(struct nft_set_gc_batch *gcb)
552{
553 if (gcb != NULL)
554 call_rcu(&gcb->head.rcu, nft_set_gc_batch_release);
555}
556
557static inline struct nft_set_gc_batch *
558nft_set_gc_batch_check(const struct nft_set *set, struct nft_set_gc_batch *gcb,
559 gfp_t gfp)
560{
561 if (gcb != NULL) {
562 if (gcb->head.cnt + 1 < ARRAY_SIZE(gcb->elems))
563 return gcb;
564 nft_set_gc_batch_complete(gcb);
565 }
566 return nft_set_gc_batch_alloc(set, gfp);
567}
568
569static inline void nft_set_gc_batch_add(struct nft_set_gc_batch *gcb,
570 void *elem)
571{
572 gcb->elems[gcb->head.cnt++] = elem;
573}
298 574
299/** 575/**
300 * struct nft_expr_type - nf_tables expression type 576 * struct nft_expr_type - nf_tables expression type
@@ -307,6 +583,7 @@ void nf_tables_unbind_set(const struct nft_ctx *ctx, struct nft_set *set,
307 * @policy: netlink attribute policy 583 * @policy: netlink attribute policy
308 * @maxattr: highest netlink attribute number 584 * @maxattr: highest netlink attribute number
309 * @family: address family for AF-specific types 585 * @family: address family for AF-specific types
586 * @flags: expression type flags
310 */ 587 */
311struct nft_expr_type { 588struct nft_expr_type {
312 const struct nft_expr_ops *(*select_ops)(const struct nft_ctx *, 589 const struct nft_expr_ops *(*select_ops)(const struct nft_ctx *,
@@ -318,8 +595,11 @@ struct nft_expr_type {
318 const struct nla_policy *policy; 595 const struct nla_policy *policy;
319 unsigned int maxattr; 596 unsigned int maxattr;
320 u8 family; 597 u8 family;
598 u8 flags;
321}; 599};
322 600
601#define NFT_EXPR_STATEFUL 0x1
602
323/** 603/**
324 * struct nft_expr_ops - nf_tables expression operations 604 * struct nft_expr_ops - nf_tables expression operations
325 * 605 *
@@ -335,7 +615,7 @@ struct nft_expr_type {
335struct nft_expr; 615struct nft_expr;
336struct nft_expr_ops { 616struct nft_expr_ops {
337 void (*eval)(const struct nft_expr *expr, 617 void (*eval)(const struct nft_expr *expr,
338 struct nft_data data[NFT_REG_MAX + 1], 618 struct nft_regs *regs,
339 const struct nft_pktinfo *pkt); 619 const struct nft_pktinfo *pkt);
340 unsigned int size; 620 unsigned int size;
341 621
@@ -373,6 +653,18 @@ static inline void *nft_expr_priv(const struct nft_expr *expr)
373 return (void *)expr->data; 653 return (void *)expr->data;
374} 654}
375 655
656struct nft_expr *nft_expr_init(const struct nft_ctx *ctx,
657 const struct nlattr *nla);
658void nft_expr_destroy(const struct nft_ctx *ctx, struct nft_expr *expr);
659int nft_expr_dump(struct sk_buff *skb, unsigned int attr,
660 const struct nft_expr *expr);
661
662static inline void nft_expr_clone(struct nft_expr *dst, struct nft_expr *src)
663{
664 __module_get(src->ops->type->owner);
665 memcpy(dst, src, src->ops->size);
666}
667
376/** 668/**
377 * struct nft_rule - nf_tables rule 669 * struct nft_rule - nf_tables rule
378 * 670 *
@@ -380,7 +672,7 @@ static inline void *nft_expr_priv(const struct nft_expr *expr)
380 * @handle: rule handle 672 * @handle: rule handle
381 * @genmask: generation mask 673 * @genmask: generation mask
382 * @dlen: length of expression data 674 * @dlen: length of expression data
383 * @ulen: length of user data (used for comments) 675 * @udata: user data is appended to the rule
384 * @data: expression data 676 * @data: expression data
385 */ 677 */
386struct nft_rule { 678struct nft_rule {
@@ -388,79 +680,11 @@ struct nft_rule {
388 u64 handle:42, 680 u64 handle:42,
389 genmask:2, 681 genmask:2,
390 dlen:12, 682 dlen:12,
391 ulen:8; 683 udata:1;
392 unsigned char data[] 684 unsigned char data[]
393 __attribute__((aligned(__alignof__(struct nft_expr)))); 685 __attribute__((aligned(__alignof__(struct nft_expr))));
394}; 686};
395 687
396/**
397 * struct nft_trans - nf_tables object update in transaction
398 *
399 * @list: used internally
400 * @msg_type: message type
401 * @ctx: transaction context
402 * @data: internal information related to the transaction
403 */
404struct nft_trans {
405 struct list_head list;
406 int msg_type;
407 struct nft_ctx ctx;
408 char data[0];
409};
410
411struct nft_trans_rule {
412 struct nft_rule *rule;
413};
414
415#define nft_trans_rule(trans) \
416 (((struct nft_trans_rule *)trans->data)->rule)
417
418struct nft_trans_set {
419 struct nft_set *set;
420 u32 set_id;
421};
422
423#define nft_trans_set(trans) \
424 (((struct nft_trans_set *)trans->data)->set)
425#define nft_trans_set_id(trans) \
426 (((struct nft_trans_set *)trans->data)->set_id)
427
428struct nft_trans_chain {
429 bool update;
430 char name[NFT_CHAIN_MAXNAMELEN];
431 struct nft_stats __percpu *stats;
432 u8 policy;
433};
434
435#define nft_trans_chain_update(trans) \
436 (((struct nft_trans_chain *)trans->data)->update)
437#define nft_trans_chain_name(trans) \
438 (((struct nft_trans_chain *)trans->data)->name)
439#define nft_trans_chain_stats(trans) \
440 (((struct nft_trans_chain *)trans->data)->stats)
441#define nft_trans_chain_policy(trans) \
442 (((struct nft_trans_chain *)trans->data)->policy)
443
444struct nft_trans_table {
445 bool update;
446 bool enable;
447};
448
449#define nft_trans_table_update(trans) \
450 (((struct nft_trans_table *)trans->data)->update)
451#define nft_trans_table_enable(trans) \
452 (((struct nft_trans_table *)trans->data)->enable)
453
454struct nft_trans_elem {
455 struct nft_set *set;
456 struct nft_set_elem elem;
457};
458
459#define nft_trans_elem_set(trans) \
460 (((struct nft_trans_elem *)trans->data)->set)
461#define nft_trans_elem(trans) \
462 (((struct nft_trans_elem *)trans->data)->elem)
463
464static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule) 688static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule)
465{ 689{
466 return (struct nft_expr *)&rule->data[0]; 690 return (struct nft_expr *)&rule->data[0];
@@ -476,7 +700,7 @@ static inline struct nft_expr *nft_expr_last(const struct nft_rule *rule)
476 return (struct nft_expr *)&rule->data[rule->dlen]; 700 return (struct nft_expr *)&rule->data[rule->dlen];
477} 701}
478 702
479static inline void *nft_userdata(const struct nft_rule *rule) 703static inline struct nft_userdata *nft_userdata(const struct nft_rule *rule)
480{ 704{
481 return (void *)&rule->data[rule->dlen]; 705 return (void *)&rule->data[rule->dlen];
482} 706}
@@ -501,7 +725,6 @@ enum nft_chain_flags {
501 * 725 *
502 * @rules: list of rules in the chain 726 * @rules: list of rules in the chain
503 * @list: used internally 727 * @list: used internally
504 * @net: net namespace that this chain belongs to
505 * @table: table that this chain belongs to 728 * @table: table that this chain belongs to
506 * @handle: chain handle 729 * @handle: chain handle
507 * @use: number of jump references to this chain 730 * @use: number of jump references to this chain
@@ -512,7 +735,6 @@ enum nft_chain_flags {
512struct nft_chain { 735struct nft_chain {
513 struct list_head rules; 736 struct list_head rules;
514 struct list_head list; 737 struct list_head list;
515 struct net *net;
516 struct nft_table *table; 738 struct nft_table *table;
517 u64 handle; 739 u64 handle;
518 u32 use; 740 u32 use;
@@ -528,6 +750,25 @@ enum nft_chain_type {
528 NFT_CHAIN_T_MAX 750 NFT_CHAIN_T_MAX
529}; 751};
530 752
753/**
754 * struct nf_chain_type - nf_tables chain type info
755 *
756 * @name: name of the type
757 * @type: numeric identifier
758 * @family: address family
759 * @owner: module owner
760 * @hook_mask: mask of valid hooks
761 * @hooks: hookfn overrides
762 */
763struct nf_chain_type {
764 const char *name;
765 enum nft_chain_type type;
766 int family;
767 struct module *owner;
768 unsigned int hook_mask;
769 nf_hookfn *hooks[NF_MAX_HOOKS];
770};
771
531int nft_chain_validate_dependency(const struct nft_chain *chain, 772int nft_chain_validate_dependency(const struct nft_chain *chain,
532 enum nft_chain_type type); 773 enum nft_chain_type type);
533int nft_chain_validate_hooks(const struct nft_chain *chain, 774int nft_chain_validate_hooks(const struct nft_chain *chain,
@@ -545,6 +786,7 @@ struct nft_stats {
545 * struct nft_base_chain - nf_tables base chain 786 * struct nft_base_chain - nf_tables base chain
546 * 787 *
547 * @ops: netfilter hook ops 788 * @ops: netfilter hook ops
789 * @pnet: net namespace that this chain belongs to
548 * @type: chain type 790 * @type: chain type
549 * @policy: default policy 791 * @policy: default policy
550 * @stats: per-cpu chain stats 792 * @stats: per-cpu chain stats
@@ -552,6 +794,7 @@ struct nft_stats {
552 */ 794 */
553struct nft_base_chain { 795struct nft_base_chain {
554 struct nf_hook_ops ops[NFT_HOOK_OPS_MAX]; 796 struct nf_hook_ops ops[NFT_HOOK_OPS_MAX];
797 possible_net_t pnet;
555 const struct nf_chain_type *type; 798 const struct nf_chain_type *type;
556 u8 policy; 799 u8 policy;
557 struct nft_stats __percpu *stats; 800 struct nft_stats __percpu *stats;
@@ -584,7 +827,7 @@ struct nft_table {
584 u64 hgenerator; 827 u64 hgenerator;
585 u32 use; 828 u32 use;
586 u16 flags; 829 u16 flags;
587 char name[]; 830 char name[NFT_TABLE_MAXNAMELEN];
588}; 831};
589 832
590/** 833/**
@@ -614,25 +857,6 @@ struct nft_af_info {
614int nft_register_afinfo(struct net *, struct nft_af_info *); 857int nft_register_afinfo(struct net *, struct nft_af_info *);
615void nft_unregister_afinfo(struct nft_af_info *); 858void nft_unregister_afinfo(struct nft_af_info *);
616 859
617/**
618 * struct nf_chain_type - nf_tables chain type info
619 *
620 * @name: name of the type
621 * @type: numeric identifier
622 * @family: address family
623 * @owner: module owner
624 * @hook_mask: mask of valid hooks
625 * @hooks: hookfn overrides
626 */
627struct nf_chain_type {
628 const char *name;
629 enum nft_chain_type type;
630 int family;
631 struct module *owner;
632 unsigned int hook_mask;
633 nf_hookfn *hooks[NF_MAX_HOOKS];
634};
635
636int nft_register_chain_type(const struct nf_chain_type *); 860int nft_register_chain_type(const struct nf_chain_type *);
637void nft_unregister_chain_type(const struct nf_chain_type *); 861void nft_unregister_chain_type(const struct nf_chain_type *);
638 862
@@ -657,4 +881,153 @@ void nft_unregister_expr(struct nft_expr_type *);
657#define MODULE_ALIAS_NFT_SET() \ 881#define MODULE_ALIAS_NFT_SET() \
658 MODULE_ALIAS("nft-set") 882 MODULE_ALIAS("nft-set")
659 883
884/*
885 * The gencursor defines two generations, the currently active and the
886 * next one. Objects contain a bitmask of 2 bits specifying the generations
887 * they're active in. A set bit means they're inactive in the generation
888 * represented by that bit.
889 *
890 * New objects start out as inactive in the current and active in the
891 * next generation. When committing the ruleset the bitmask is cleared,
892 * meaning they're active in all generations. When removing an object,
893 * it is set inactive in the next generation. After committing the ruleset,
894 * the objects are removed.
895 */
896static inline unsigned int nft_gencursor_next(const struct net *net)
897{
898 return net->nft.gencursor + 1 == 1 ? 1 : 0;
899}
900
901static inline u8 nft_genmask_next(const struct net *net)
902{
903 return 1 << nft_gencursor_next(net);
904}
905
906static inline u8 nft_genmask_cur(const struct net *net)
907{
908 /* Use ACCESS_ONCE() to prevent refetching the value for atomicity */
909 return 1 << ACCESS_ONCE(net->nft.gencursor);
910}
911
912#define NFT_GENMASK_ANY ((1 << 0) | (1 << 1))
913
914/*
915 * Set element transaction helpers
916 */
917
918static inline bool nft_set_elem_active(const struct nft_set_ext *ext,
919 u8 genmask)
920{
921 return !(ext->genmask & genmask);
922}
923
924static inline void nft_set_elem_change_active(const struct nft_set *set,
925 struct nft_set_ext *ext)
926{
927 ext->genmask ^= nft_genmask_next(read_pnet(&set->pnet));
928}
929
930/*
931 * We use a free bit in the genmask field to indicate the element
932 * is busy, meaning it is currently being processed either by
933 * the netlink API or GC.
934 *
935 * Even though the genmask is only a single byte wide, this works
936 * because the extension structure if fully constant once initialized,
937 * so there are no non-atomic write accesses unless it is already
938 * marked busy.
939 */
940#define NFT_SET_ELEM_BUSY_MASK (1 << 2)
941
942#if defined(__LITTLE_ENDIAN_BITFIELD)
943#define NFT_SET_ELEM_BUSY_BIT 2
944#elif defined(__BIG_ENDIAN_BITFIELD)
945#define NFT_SET_ELEM_BUSY_BIT (BITS_PER_LONG - BITS_PER_BYTE + 2)
946#else
947#error
948#endif
949
950static inline int nft_set_elem_mark_busy(struct nft_set_ext *ext)
951{
952 unsigned long *word = (unsigned long *)ext;
953
954 BUILD_BUG_ON(offsetof(struct nft_set_ext, genmask) != 0);
955 return test_and_set_bit(NFT_SET_ELEM_BUSY_BIT, word);
956}
957
958static inline void nft_set_elem_clear_busy(struct nft_set_ext *ext)
959{
960 unsigned long *word = (unsigned long *)ext;
961
962 clear_bit(NFT_SET_ELEM_BUSY_BIT, word);
963}
964
965/**
966 * struct nft_trans - nf_tables object update in transaction
967 *
968 * @list: used internally
969 * @msg_type: message type
970 * @ctx: transaction context
971 * @data: internal information related to the transaction
972 */
973struct nft_trans {
974 struct list_head list;
975 int msg_type;
976 struct nft_ctx ctx;
977 char data[0];
978};
979
980struct nft_trans_rule {
981 struct nft_rule *rule;
982};
983
984#define nft_trans_rule(trans) \
985 (((struct nft_trans_rule *)trans->data)->rule)
986
987struct nft_trans_set {
988 struct nft_set *set;
989 u32 set_id;
990};
991
992#define nft_trans_set(trans) \
993 (((struct nft_trans_set *)trans->data)->set)
994#define nft_trans_set_id(trans) \
995 (((struct nft_trans_set *)trans->data)->set_id)
996
997struct nft_trans_chain {
998 bool update;
999 char name[NFT_CHAIN_MAXNAMELEN];
1000 struct nft_stats __percpu *stats;
1001 u8 policy;
1002};
1003
1004#define nft_trans_chain_update(trans) \
1005 (((struct nft_trans_chain *)trans->data)->update)
1006#define nft_trans_chain_name(trans) \
1007 (((struct nft_trans_chain *)trans->data)->name)
1008#define nft_trans_chain_stats(trans) \
1009 (((struct nft_trans_chain *)trans->data)->stats)
1010#define nft_trans_chain_policy(trans) \
1011 (((struct nft_trans_chain *)trans->data)->policy)
1012
1013struct nft_trans_table {
1014 bool update;
1015 bool enable;
1016};
1017
1018#define nft_trans_table_update(trans) \
1019 (((struct nft_trans_table *)trans->data)->update)
1020#define nft_trans_table_enable(trans) \
1021 (((struct nft_trans_table *)trans->data)->enable)
1022
1023struct nft_trans_elem {
1024 struct nft_set *set;
1025 struct nft_set_elem elem;
1026};
1027
1028#define nft_trans_elem_set(trans) \
1029 (((struct nft_trans_elem *)trans->data)->set)
1030#define nft_trans_elem(trans) \
1031 (((struct nft_trans_elem *)trans->data)->elem)
1032
660#endif /* _NET_NF_TABLES_H */ 1033#endif /* _NET_NF_TABLES_H */
diff --git a/include/net/netfilter/nf_tables_core.h b/include/net/netfilter/nf_tables_core.h
index a75fc8e27cd6..c6f400cfaac8 100644
--- a/include/net/netfilter/nf_tables_core.h
+++ b/include/net/netfilter/nf_tables_core.h
@@ -31,6 +31,9 @@ void nft_cmp_module_exit(void);
31int nft_lookup_module_init(void); 31int nft_lookup_module_init(void);
32void nft_lookup_module_exit(void); 32void nft_lookup_module_exit(void);
33 33
34int nft_dynset_module_init(void);
35void nft_dynset_module_exit(void);
36
34int nft_bitwise_module_init(void); 37int nft_bitwise_module_init(void);
35void nft_bitwise_module_exit(void); 38void nft_bitwise_module_exit(void);
36 39
diff --git a/include/net/netfilter/nf_tables_ipv4.h b/include/net/netfilter/nf_tables_ipv4.h
index cba143fbd2e4..2df7f96902ee 100644
--- a/include/net/netfilter/nf_tables_ipv4.h
+++ b/include/net/netfilter/nf_tables_ipv4.h
@@ -8,12 +8,11 @@ static inline void
8nft_set_pktinfo_ipv4(struct nft_pktinfo *pkt, 8nft_set_pktinfo_ipv4(struct nft_pktinfo *pkt,
9 const struct nf_hook_ops *ops, 9 const struct nf_hook_ops *ops,
10 struct sk_buff *skb, 10 struct sk_buff *skb,
11 const struct net_device *in, 11 const struct nf_hook_state *state)
12 const struct net_device *out)
13{ 12{
14 struct iphdr *ip; 13 struct iphdr *ip;
15 14
16 nft_set_pktinfo(pkt, ops, skb, in, out); 15 nft_set_pktinfo(pkt, ops, skb, state);
17 16
18 ip = ip_hdr(pkt->skb); 17 ip = ip_hdr(pkt->skb);
19 pkt->tprot = ip->protocol; 18 pkt->tprot = ip->protocol;
diff --git a/include/net/netfilter/nf_tables_ipv6.h b/include/net/netfilter/nf_tables_ipv6.h
index 74d976137658..97db2e3a5e65 100644
--- a/include/net/netfilter/nf_tables_ipv6.h
+++ b/include/net/netfilter/nf_tables_ipv6.h
@@ -8,13 +8,12 @@ static inline int
8nft_set_pktinfo_ipv6(struct nft_pktinfo *pkt, 8nft_set_pktinfo_ipv6(struct nft_pktinfo *pkt,
9 const struct nf_hook_ops *ops, 9 const struct nf_hook_ops *ops,
10 struct sk_buff *skb, 10 struct sk_buff *skb,
11 const struct net_device *in, 11 const struct nf_hook_state *state)
12 const struct net_device *out)
13{ 12{
14 int protohdr, thoff = 0; 13 int protohdr, thoff = 0;
15 unsigned short frag_off; 14 unsigned short frag_off;
16 15
17 nft_set_pktinfo(pkt, ops, skb, in, out); 16 nft_set_pktinfo(pkt, ops, skb, state);
18 17
19 protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, NULL); 18 protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, NULL);
20 /* If malformed, drop it */ 19 /* If malformed, drop it */
diff --git a/include/net/netfilter/nft_meta.h b/include/net/netfilter/nft_meta.h
index 0ee47c3e2e31..711887a09e91 100644
--- a/include/net/netfilter/nft_meta.h
+++ b/include/net/netfilter/nft_meta.h
@@ -26,11 +26,11 @@ int nft_meta_set_dump(struct sk_buff *skb,
26 const struct nft_expr *expr); 26 const struct nft_expr *expr);
27 27
28void nft_meta_get_eval(const struct nft_expr *expr, 28void nft_meta_get_eval(const struct nft_expr *expr,
29 struct nft_data data[NFT_REG_MAX + 1], 29 struct nft_regs *regs,
30 const struct nft_pktinfo *pkt); 30 const struct nft_pktinfo *pkt);
31 31
32void nft_meta_set_eval(const struct nft_expr *expr, 32void nft_meta_set_eval(const struct nft_expr *expr,
33 struct nft_data data[NFT_REG_MAX + 1], 33 struct nft_regs *regs,
34 const struct nft_pktinfo *pkt); 34 const struct nft_pktinfo *pkt);
35 35
36#endif 36#endif
diff --git a/include/net/netlink.h b/include/net/netlink.h
index e010ee8da41d..2a5dbcc90d1c 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -4,6 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/netlink.h> 5#include <linux/netlink.h>
6#include <linux/jiffies.h> 6#include <linux/jiffies.h>
7#include <linux/in6.h>
7 8
8/* ======================================================================== 9/* ========================================================================
9 * Netlink Messages and Attributes Interface (As Seen On TV) 10 * Netlink Messages and Attributes Interface (As Seen On TV)
@@ -105,6 +106,8 @@
105 * nla_put_string(skb, type, str) add string attribute to skb 106 * nla_put_string(skb, type, str) add string attribute to skb
106 * nla_put_flag(skb, type) add flag attribute to skb 107 * nla_put_flag(skb, type) add flag attribute to skb
107 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb 108 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb
109 * nla_put_in_addr(skb, type, addr) add IPv4 address attribute to skb
110 * nla_put_in6_addr(skb, type, addr) add IPv6 address attribute to skb
108 * 111 *
109 * Nested Attributes Construction: 112 * Nested Attributes Construction:
110 * nla_nest_start(skb, type) start a nested attribute 113 * nla_nest_start(skb, type) start a nested attribute
@@ -957,6 +960,32 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
957} 960}
958 961
959/** 962/**
963 * nla_put_in_addr - Add an IPv4 address netlink attribute to a socket
964 * buffer
965 * @skb: socket buffer to add attribute to
966 * @attrtype: attribute type
967 * @addr: IPv4 address
968 */
969static inline int nla_put_in_addr(struct sk_buff *skb, int attrtype,
970 __be32 addr)
971{
972 return nla_put_be32(skb, attrtype, addr);
973}
974
975/**
976 * nla_put_in6_addr - Add an IPv6 address netlink attribute to a socket
977 * buffer
978 * @skb: socket buffer to add attribute to
979 * @attrtype: attribute type
980 * @addr: IPv6 address
981 */
982static inline int nla_put_in6_addr(struct sk_buff *skb, int attrtype,
983 const struct in6_addr *addr)
984{
985 return nla_put(skb, attrtype, sizeof(*addr), addr);
986}
987
988/**
960 * nla_get_u32 - return payload of u32 attribute 989 * nla_get_u32 - return payload of u32 attribute
961 * @nla: u32 netlink attribute 990 * @nla: u32 netlink attribute
962 */ 991 */
@@ -1099,6 +1128,27 @@ static inline unsigned long nla_get_msecs(const struct nlattr *nla)
1099} 1128}
1100 1129
1101/** 1130/**
1131 * nla_get_in_addr - return payload of IPv4 address attribute
1132 * @nla: IPv4 address netlink attribute
1133 */
1134static inline __be32 nla_get_in_addr(const struct nlattr *nla)
1135{
1136 return *(__be32 *) nla_data(nla);
1137}
1138
1139/**
1140 * nla_get_in6_addr - return payload of IPv6 address attribute
1141 * @nla: IPv6 address netlink attribute
1142 */
1143static inline struct in6_addr nla_get_in6_addr(const struct nlattr *nla)
1144{
1145 struct in6_addr tmp;
1146
1147 nla_memcpy(&tmp, nla, sizeof(tmp));
1148 return tmp;
1149}
1150
1151/**
1102 * nla_nest_start - Start a new level of nested attributes 1152 * nla_nest_start - Start a new level of nested attributes
1103 * @skb: socket buffer to add attributes to 1153 * @skb: socket buffer to add attributes to
1104 * @attrtype: attribute type of container 1154 * @attrtype: attribute type of container
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
index 0931618c0f7f..70e158551704 100644
--- a/include/net/netns/generic.h
+++ b/include/net/netns/generic.h
@@ -38,11 +38,9 @@ static inline void *net_generic(const struct net *net, int id)
38 38
39 rcu_read_lock(); 39 rcu_read_lock();
40 ng = rcu_dereference(net->gen); 40 ng = rcu_dereference(net->gen);
41 BUG_ON(id == 0 || id > ng->len);
42 ptr = ng->ptr[id - 1]; 41 ptr = ng->ptr[id - 1];
43 rcu_read_unlock(); 42 rcu_read_unlock();
44 43
45 BUG_ON(!ptr);
46 return ptr; 44 return ptr;
47} 45}
48#endif 46#endif
diff --git a/include/net/netns/hash.h b/include/net/netns/hash.h
index c06ac58ca107..69a6715d9f3f 100644
--- a/include/net/netns/hash.h
+++ b/include/net/netns/hash.h
@@ -5,7 +5,7 @@
5 5
6struct net; 6struct net;
7 7
8static inline unsigned int net_hash_mix(struct net *net) 8static inline u32 net_hash_mix(const struct net *net)
9{ 9{
10#ifdef CONFIG_NET_NS 10#ifdef CONFIG_NET_NS
11 /* 11 /*
@@ -13,7 +13,7 @@ static inline unsigned int net_hash_mix(struct net *net)
13 * always zeroed 13 * always zeroed
14 */ 14 */
15 15
16 return (unsigned)(((unsigned long)net) >> L1_CACHE_SHIFT); 16 return (u32)(((unsigned long)net) >> L1_CACHE_SHIFT);
17#else 17#else
18 return 0; 18 return 0;
19#endif 19#endif
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index dbe225478adb..614a49be68a9 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -7,6 +7,7 @@
7 7
8#include <linux/uidgid.h> 8#include <linux/uidgid.h>
9#include <net/inet_frag.h> 9#include <net/inet_frag.h>
10#include <linux/rcupdate.h>
10 11
11struct tcpm_hash_bucket; 12struct tcpm_hash_bucket;
12struct ctl_table_header; 13struct ctl_table_header;
@@ -38,21 +39,21 @@ struct netns_ipv4 {
38#ifdef CONFIG_IP_MULTIPLE_TABLES 39#ifdef CONFIG_IP_MULTIPLE_TABLES
39 struct fib_rules_ops *rules_ops; 40 struct fib_rules_ops *rules_ops;
40 bool fib_has_custom_rules; 41 bool fib_has_custom_rules;
41 struct fib_table *fib_local; 42 struct fib_table __rcu *fib_local;
42 struct fib_table *fib_main; 43 struct fib_table __rcu *fib_main;
43 struct fib_table *fib_default; 44 struct fib_table __rcu *fib_default;
44#endif 45#endif
45#ifdef CONFIG_IP_ROUTE_CLASSID 46#ifdef CONFIG_IP_ROUTE_CLASSID
46 int fib_num_tclassid_users; 47 int fib_num_tclassid_users;
47#endif 48#endif
48 struct hlist_head *fib_table_hash; 49 struct hlist_head *fib_table_hash;
50 bool fib_offload_disabled;
49 struct sock *fibnl; 51 struct sock *fibnl;
50 52
51 struct sock * __percpu *icmp_sk; 53 struct sock * __percpu *icmp_sk;
54 struct sock *mc_autojoin_sk;
52 55
53 struct inet_peer_base *peers; 56 struct inet_peer_base *peers;
54 struct tcpm_hash_bucket *tcp_metrics_hash;
55 unsigned int tcp_metrics_hash_log;
56 struct sock * __percpu *tcp_sk; 57 struct sock * __percpu *tcp_sk;
57 struct netns_frags frags; 58 struct netns_frags frags;
58#ifdef CONFIG_NETFILTER 59#ifdef CONFIG_NETFILTER
@@ -84,6 +85,8 @@ struct netns_ipv4 {
84 int sysctl_tcp_fwmark_accept; 85 int sysctl_tcp_fwmark_accept;
85 int sysctl_tcp_mtu_probing; 86 int sysctl_tcp_mtu_probing;
86 int sysctl_tcp_base_mss; 87 int sysctl_tcp_base_mss;
88 int sysctl_tcp_probe_threshold;
89 u32 sysctl_tcp_probe_interval;
87 90
88 struct ping_group_range ping_group_range; 91 struct ping_group_range ping_group_range;
89 92
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 69ae41f2098c..d2527bf81142 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -32,6 +32,8 @@ struct netns_sysctl_ipv6 {
32 int icmpv6_time; 32 int icmpv6_time;
33 int anycast_src_echo_reply; 33 int anycast_src_echo_reply;
34 int fwmark_reflect; 34 int fwmark_reflect;
35 int idgen_retries;
36 int idgen_delay;
35}; 37};
36 38
37struct netns_ipv6 { 39struct netns_ipv6 {
@@ -67,6 +69,7 @@ struct netns_ipv6 {
67 struct sock *ndisc_sk; 69 struct sock *ndisc_sk;
68 struct sock *tcp_sk; 70 struct sock *tcp_sk;
69 struct sock *igmp_sk; 71 struct sock *igmp_sk;
72 struct sock *mc_autojoin_sk;
70#ifdef CONFIG_IPV6_MROUTE 73#ifdef CONFIG_IPV6_MROUTE
71#ifndef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES 74#ifndef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES
72 struct mr6_table *mrt6; 75 struct mr6_table *mrt6;
diff --git a/include/net/netns/mpls.h b/include/net/netns/mpls.h
new file mode 100644
index 000000000000..d29203651c01
--- /dev/null
+++ b/include/net/netns/mpls.h
@@ -0,0 +1,17 @@
1/*
2 * mpls in net namespaces
3 */
4
5#ifndef __NETNS_MPLS_H__
6#define __NETNS_MPLS_H__
7
8struct mpls_route;
9struct ctl_table_header;
10
11struct netns_mpls {
12 size_t platform_labels;
13 struct mpls_route __rcu * __rcu *platform_label;
14 struct ctl_table_header *ctl;
15};
16
17#endif /* __NETNS_MPLS_H__ */
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
index c24060ee411e..4d6597ad6067 100644
--- a/include/net/netns/x_tables.h
+++ b/include/net/netns/x_tables.h
@@ -9,6 +9,7 @@ struct ebt_table;
9struct netns_xt { 9struct netns_xt {
10 struct list_head tables[NFPROTO_NUMPROTO]; 10 struct list_head tables[NFPROTO_NUMPROTO];
11 bool notrack_deprecated_warning; 11 bool notrack_deprecated_warning;
12 bool clusterip_deprecated_warning;
12#if defined(CONFIG_BRIDGE_NF_EBTABLES) || \ 13#if defined(CONFIG_BRIDGE_NF_EBTABLES) || \
13 defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE) 14 defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE)
14 struct ebt_table *broute_table; 15 struct ebt_table *broute_table;
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index ab672b537dd4..020a814bc8ed 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -83,6 +83,10 @@ struct nfc_hci_pipe {
83}; 83};
84 84
85#define NFC_HCI_MAX_CUSTOM_GATES 50 85#define NFC_HCI_MAX_CUSTOM_GATES 50
86/*
87 * According to specification 102 622 chapter 4.4 Pipes,
88 * the pipe identifier is 7 bits long.
89 */
86#define NFC_HCI_MAX_PIPES 127 90#define NFC_HCI_MAX_PIPES 127
87struct nfc_hci_init_data { 91struct nfc_hci_init_data {
88 u8 gate_count; 92 u8 gate_count;
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index ff87f8611fa3..d4dcc7199fd7 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -71,6 +71,7 @@ struct nci_ops {
71 int (*close)(struct nci_dev *ndev); 71 int (*close)(struct nci_dev *ndev);
72 int (*send)(struct nci_dev *ndev, struct sk_buff *skb); 72 int (*send)(struct nci_dev *ndev, struct sk_buff *skb);
73 int (*setup)(struct nci_dev *ndev); 73 int (*setup)(struct nci_dev *ndev);
74 int (*fw_download)(struct nci_dev *ndev, const char *firmware_name);
74 __u32 (*get_rfprotocol)(struct nci_dev *ndev, __u8 rf_protocol); 75 __u32 (*get_rfprotocol)(struct nci_dev *ndev, __u8 rf_protocol);
75 int (*discover_se)(struct nci_dev *ndev); 76 int (*discover_se)(struct nci_dev *ndev);
76 int (*disable_se)(struct nci_dev *ndev, u32 se_idx); 77 int (*disable_se)(struct nci_dev *ndev, u32 se_idx);
@@ -137,6 +138,10 @@ struct nci_conn_info {
137#define NCI_HCI_INVALID_HOST 0x80 138#define NCI_HCI_INVALID_HOST 0x80
138 139
139#define NCI_HCI_MAX_CUSTOM_GATES 50 140#define NCI_HCI_MAX_CUSTOM_GATES 50
141/*
142 * According to specification 102 622 chapter 4.4 Pipes,
143 * the pipe identifier is 7 bits long.
144 */
140#define NCI_HCI_MAX_PIPES 127 145#define NCI_HCI_MAX_PIPES 127
141 146
142struct nci_hci_gate { 147struct nci_hci_gate {
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 73190e65d5c1..7ac029c07546 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -157,7 +157,7 @@ struct nfc_evt_transaction {
157 u32 aid_len; 157 u32 aid_len;
158 u8 aid[NFC_MAX_AID_LENGTH]; 158 u8 aid[NFC_MAX_AID_LENGTH];
159 u8 params_len; 159 u8 params_len;
160 u8 params[NFC_MAX_PARAMS_LENGTH]; 160 u8 params[0];
161} __packed; 161} __packed;
162 162
163struct nfc_genl_data { 163struct nfc_genl_data {
diff --git a/include/net/ping.h b/include/net/ping.h
index cc16d413f681..ac80cb45e630 100644
--- a/include/net/ping.h
+++ b/include/net/ping.h
@@ -75,12 +75,11 @@ void ping_err(struct sk_buff *skb, int offset, u32 info);
75int ping_getfrag(void *from, char *to, int offset, int fraglen, int odd, 75int ping_getfrag(void *from, char *to, int offset, int fraglen, int odd,
76 struct sk_buff *); 76 struct sk_buff *);
77 77
78int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 78int ping_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock,
79 size_t len, int noblock, int flags, int *addr_len); 79 int flags, int *addr_len);
80int ping_common_sendmsg(int family, struct msghdr *msg, size_t len, 80int ping_common_sendmsg(int family, struct msghdr *msg, size_t len,
81 void *user_icmph, size_t icmph_len); 81 void *user_icmph, size_t icmph_len);
82int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 82int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len);
83 size_t len);
84int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); 83int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
85bool ping_rcv(struct sk_buff *skb); 84bool ping_rcv(struct sk_buff *skb);
86 85
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 7f830ff67f08..fe41f3ceb008 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -39,8 +39,7 @@ struct request_sock_ops {
39 void (*send_reset)(struct sock *sk, 39 void (*send_reset)(struct sock *sk,
40 struct sk_buff *skb); 40 struct sk_buff *skb);
41 void (*destructor)(struct request_sock *req); 41 void (*destructor)(struct request_sock *req);
42 void (*syn_ack_timeout)(struct sock *sk, 42 void (*syn_ack_timeout)(const struct request_sock *req);
43 struct request_sock *req);
44}; 43};
45 44
46int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req); 45int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req);
@@ -49,7 +48,11 @@ int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req);
49 */ 48 */
50struct request_sock { 49struct request_sock {
51 struct sock_common __req_common; 50 struct sock_common __req_common;
51#define rsk_refcnt __req_common.skc_refcnt
52#define rsk_hash __req_common.skc_hash
53
52 struct request_sock *dl_next; 54 struct request_sock *dl_next;
55 struct sock *rsk_listener;
53 u16 mss; 56 u16 mss;
54 u8 num_retrans; /* number of retransmits */ 57 u8 num_retrans; /* number of retransmits */
55 u8 cookie_ts:1; /* syncookie: encode tcpopts in timestamp */ 58 u8 cookie_ts:1; /* syncookie: encode tcpopts in timestamp */
@@ -58,32 +61,56 @@ struct request_sock {
58 u32 window_clamp; /* window clamp at creation time */ 61 u32 window_clamp; /* window clamp at creation time */
59 u32 rcv_wnd; /* rcv_wnd offered first time */ 62 u32 rcv_wnd; /* rcv_wnd offered first time */
60 u32 ts_recent; 63 u32 ts_recent;
61 unsigned long expires; 64 struct timer_list rsk_timer;
62 const struct request_sock_ops *rsk_ops; 65 const struct request_sock_ops *rsk_ops;
63 struct sock *sk; 66 struct sock *sk;
64 u32 secid; 67 u32 secid;
65 u32 peer_secid; 68 u32 peer_secid;
66}; 69};
67 70
68static inline struct request_sock *reqsk_alloc(const struct request_sock_ops *ops) 71static inline struct request_sock *
72reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener)
69{ 73{
70 struct request_sock *req = kmem_cache_alloc(ops->slab, GFP_ATOMIC); 74 struct request_sock *req = kmem_cache_alloc(ops->slab, GFP_ATOMIC);
71 75
72 if (req != NULL) 76 if (req) {
73 req->rsk_ops = ops; 77 req->rsk_ops = ops;
74 78 sock_hold(sk_listener);
79 req->rsk_listener = sk_listener;
80
81 /* Following is temporary. It is coupled with debugging
82 * helpers in reqsk_put() & reqsk_free()
83 */
84 atomic_set(&req->rsk_refcnt, 0);
85 }
75 return req; 86 return req;
76} 87}
77 88
78static inline void __reqsk_free(struct request_sock *req) 89static inline struct request_sock *inet_reqsk(struct sock *sk)
79{ 90{
80 kmem_cache_free(req->rsk_ops->slab, req); 91 return (struct request_sock *)sk;
92}
93
94static inline struct sock *req_to_sk(struct request_sock *req)
95{
96 return (struct sock *)req;
81} 97}
82 98
83static inline void reqsk_free(struct request_sock *req) 99static inline void reqsk_free(struct request_sock *req)
84{ 100{
101 /* temporary debugging */
102 WARN_ON_ONCE(atomic_read(&req->rsk_refcnt) != 0);
103
85 req->rsk_ops->destructor(req); 104 req->rsk_ops->destructor(req);
86 __reqsk_free(req); 105 if (req->rsk_listener)
106 sock_put(req->rsk_listener);
107 kmem_cache_free(req->rsk_ops->slab, req);
108}
109
110static inline void reqsk_put(struct request_sock *req)
111{
112 if (atomic_dec_and_test(&req->rsk_refcnt))
113 reqsk_free(req);
87} 114}
88 115
89extern int sysctl_max_syn_backlog; 116extern int sysctl_max_syn_backlog;
@@ -93,12 +120,16 @@ extern int sysctl_max_syn_backlog;
93 * @max_qlen_log - log_2 of maximal queued SYNs/REQUESTs 120 * @max_qlen_log - log_2 of maximal queued SYNs/REQUESTs
94 */ 121 */
95struct listen_sock { 122struct listen_sock {
96 u8 max_qlen_log; 123 int qlen_inc; /* protected by listener lock */
124 int young_inc;/* protected by listener lock */
125
126 /* following fields can be updated by timer */
127 atomic_t qlen_dec; /* qlen = qlen_inc - qlen_dec */
128 atomic_t young_dec;
129
130 u8 max_qlen_log ____cacheline_aligned_in_smp;
97 u8 synflood_warned; 131 u8 synflood_warned;
98 /* 2 bytes hole, try to use */ 132 /* 2 bytes hole, try to use */
99 int qlen;
100 int qlen_young;
101 int clock_hand;
102 u32 hash_rnd; 133 u32 hash_rnd;
103 u32 nr_table_entries; 134 u32 nr_table_entries;
104 struct request_sock *syn_table[0]; 135 struct request_sock *syn_table[0];
@@ -142,18 +173,11 @@ struct fastopen_queue {
142 * %syn_wait_lock is necessary only to avoid proc interface having to grab the main 173 * %syn_wait_lock is necessary only to avoid proc interface having to grab the main
143 * lock sock while browsing the listening hash (otherwise it's deadlock prone). 174 * lock sock while browsing the listening hash (otherwise it's deadlock prone).
144 * 175 *
145 * This lock is acquired in read mode only from listening_get_next() seq_file
146 * op and it's acquired in write mode _only_ from code that is actively
147 * changing rskq_accept_head. All readers that are holding the master sock lock
148 * don't need to grab this lock in read mode too as rskq_accept_head. writes
149 * are always protected from the main sock lock.
150 */ 176 */
151struct request_sock_queue { 177struct request_sock_queue {
152 struct request_sock *rskq_accept_head; 178 struct request_sock *rskq_accept_head;
153 struct request_sock *rskq_accept_tail; 179 struct request_sock *rskq_accept_tail;
154 rwlock_t syn_wait_lock;
155 u8 rskq_defer_accept; 180 u8 rskq_defer_accept;
156 /* 3 bytes hole, try to pack */
157 struct listen_sock *listen_opt; 181 struct listen_sock *listen_opt;
158 struct fastopen_queue *fastopenq; /* This is non-NULL iff TFO has been 182 struct fastopen_queue *fastopenq; /* This is non-NULL iff TFO has been
159 * enabled on this listener. Check 183 * enabled on this listener. Check
@@ -161,6 +185,9 @@ struct request_sock_queue {
161 * to determine if TFO is enabled 185 * to determine if TFO is enabled
162 * right at this moment. 186 * right at this moment.
163 */ 187 */
188
189 /* temporary alignment, our goal is to get rid of this lock */
190 spinlock_t syn_wait_lock ____cacheline_aligned_in_smp;
164}; 191};
165 192
166int reqsk_queue_alloc(struct request_sock_queue *queue, 193int reqsk_queue_alloc(struct request_sock_queue *queue,
@@ -186,12 +213,21 @@ static inline int reqsk_queue_empty(struct request_sock_queue *queue)
186} 213}
187 214
188static inline void reqsk_queue_unlink(struct request_sock_queue *queue, 215static inline void reqsk_queue_unlink(struct request_sock_queue *queue,
189 struct request_sock *req, 216 struct request_sock *req)
190 struct request_sock **prev_req)
191{ 217{
192 write_lock(&queue->syn_wait_lock); 218 struct listen_sock *lopt = queue->listen_opt;
193 *prev_req = req->dl_next; 219 struct request_sock **prev;
194 write_unlock(&queue->syn_wait_lock); 220
221 spin_lock(&queue->syn_wait_lock);
222
223 prev = &lopt->syn_table[req->rsk_hash];
224 while (*prev != req)
225 prev = &(*prev)->dl_next;
226 *prev = req->dl_next;
227
228 spin_unlock(&queue->syn_wait_lock);
229 if (del_timer(&req->rsk_timer))
230 reqsk_put(req);
195} 231}
196 232
197static inline void reqsk_queue_add(struct request_sock_queue *queue, 233static inline void reqsk_queue_add(struct request_sock_queue *queue,
@@ -224,57 +260,53 @@ static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue
224 return req; 260 return req;
225} 261}
226 262
227static inline int reqsk_queue_removed(struct request_sock_queue *queue, 263static inline void reqsk_queue_removed(struct request_sock_queue *queue,
228 struct request_sock *req) 264 const struct request_sock *req)
229{ 265{
230 struct listen_sock *lopt = queue->listen_opt; 266 struct listen_sock *lopt = queue->listen_opt;
231 267
232 if (req->num_timeout == 0) 268 if (req->num_timeout == 0)
233 --lopt->qlen_young; 269 atomic_inc(&lopt->young_dec);
234 270 atomic_inc(&lopt->qlen_dec);
235 return --lopt->qlen;
236} 271}
237 272
238static inline int reqsk_queue_added(struct request_sock_queue *queue) 273static inline void reqsk_queue_added(struct request_sock_queue *queue)
239{ 274{
240 struct listen_sock *lopt = queue->listen_opt; 275 struct listen_sock *lopt = queue->listen_opt;
241 const int prev_qlen = lopt->qlen;
242 276
243 lopt->qlen_young++; 277 lopt->young_inc++;
244 lopt->qlen++; 278 lopt->qlen_inc++;
245 return prev_qlen;
246} 279}
247 280
248static inline int reqsk_queue_len(const struct request_sock_queue *queue) 281static inline int listen_sock_qlen(const struct listen_sock *lopt)
249{ 282{
250 return queue->listen_opt != NULL ? queue->listen_opt->qlen : 0; 283 return lopt->qlen_inc - atomic_read(&lopt->qlen_dec);
251} 284}
252 285
253static inline int reqsk_queue_len_young(const struct request_sock_queue *queue) 286static inline int listen_sock_young(const struct listen_sock *lopt)
254{ 287{
255 return queue->listen_opt->qlen_young; 288 return lopt->young_inc - atomic_read(&lopt->young_dec);
256} 289}
257 290
258static inline int reqsk_queue_is_full(const struct request_sock_queue *queue) 291static inline int reqsk_queue_len(const struct request_sock_queue *queue)
259{ 292{
260 return queue->listen_opt->qlen >> queue->listen_opt->max_qlen_log; 293 const struct listen_sock *lopt = queue->listen_opt;
294
295 return lopt ? listen_sock_qlen(lopt) : 0;
261} 296}
262 297
263static inline void reqsk_queue_hash_req(struct request_sock_queue *queue, 298static inline int reqsk_queue_len_young(const struct request_sock_queue *queue)
264 u32 hash, struct request_sock *req,
265 unsigned long timeout)
266{ 299{
267 struct listen_sock *lopt = queue->listen_opt; 300 return listen_sock_young(queue->listen_opt);
268 301}
269 req->expires = jiffies + timeout;
270 req->num_retrans = 0;
271 req->num_timeout = 0;
272 req->sk = NULL;
273 req->dl_next = lopt->syn_table[hash];
274 302
275 write_lock(&queue->syn_wait_lock); 303static inline int reqsk_queue_is_full(const struct request_sock_queue *queue)
276 lopt->syn_table[hash] = req; 304{
277 write_unlock(&queue->syn_wait_lock); 305 return reqsk_queue_len(queue) >> queue->listen_opt->max_qlen_log;
278} 306}
279 307
308void reqsk_queue_hash_req(struct request_sock_queue *queue,
309 u32 hash, struct request_sock *req,
310 unsigned long timeout);
311
280#endif /* _REQUEST_SOCK_H */ 312#endif /* _REQUEST_SOCK_H */
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 6c6d5393fc34..343d922d15c2 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -137,7 +137,7 @@ void rtnl_af_register(struct rtnl_af_ops *ops);
137void rtnl_af_unregister(struct rtnl_af_ops *ops); 137void rtnl_af_unregister(struct rtnl_af_ops *ops);
138 138
139struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]); 139struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
140struct net_device *rtnl_create_link(struct net *net, char *ifname, 140struct net_device *rtnl_create_link(struct net *net, const char *ifname,
141 unsigned char name_assign_type, 141 unsigned char name_assign_type,
142 const struct rtnl_link_ops *ops, 142 const struct rtnl_link_ops *ops,
143 struct nlattr *tb[]); 143 struct nlattr *tb[]);
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index c605d305c577..6d778efcfdfd 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -213,7 +213,7 @@ struct tcf_proto_ops {
213 const struct tcf_proto *, 213 const struct tcf_proto *,
214 struct tcf_result *); 214 struct tcf_result *);
215 int (*init)(struct tcf_proto*); 215 int (*init)(struct tcf_proto*);
216 void (*destroy)(struct tcf_proto*); 216 bool (*destroy)(struct tcf_proto*, bool);
217 217
218 unsigned long (*get)(struct tcf_proto*, u32 handle); 218 unsigned long (*get)(struct tcf_proto*, u32 handle);
219 int (*change)(struct net *net, struct sk_buff *, 219 int (*change)(struct net *net, struct sk_buff *,
@@ -399,7 +399,7 @@ struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
399 const struct Qdisc_ops *ops, u32 parentid); 399 const struct Qdisc_ops *ops, u32 parentid);
400void __qdisc_calculate_pkt_len(struct sk_buff *skb, 400void __qdisc_calculate_pkt_len(struct sk_buff *skb,
401 const struct qdisc_size_table *stab); 401 const struct qdisc_size_table *stab);
402void tcf_destroy(struct tcf_proto *tp); 402bool tcf_destroy(struct tcf_proto *tp, bool force);
403void tcf_destroy_chain(struct tcf_proto __rcu **fl); 403void tcf_destroy_chain(struct tcf_proto __rcu **fl);
404 404
405/* Reset all TX qdiscs greater then index of a device. */ 405/* Reset all TX qdiscs greater then index of a device. */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 856f01cb51dd..c56a438c3a1e 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -166,6 +166,9 @@ void sctp_remaddr_proc_exit(struct net *net);
166 */ 166 */
167extern struct kmem_cache *sctp_chunk_cachep __read_mostly; 167extern struct kmem_cache *sctp_chunk_cachep __read_mostly;
168extern struct kmem_cache *sctp_bucket_cachep __read_mostly; 168extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
169extern long sysctl_sctp_mem[3];
170extern int sysctl_sctp_rmem[3];
171extern int sysctl_sctp_wmem[3];
169 172
170/* 173/*
171 * Section: Macros, externs, and inlines 174 * Section: Macros, externs, and inlines
diff --git a/include/net/sock.h b/include/net/sock.h
index ab186b1d31ff..3a4898ec8c67 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -57,7 +57,6 @@
57#include <linux/page_counter.h> 57#include <linux/page_counter.h>
58#include <linux/memcontrol.h> 58#include <linux/memcontrol.h>
59#include <linux/static_key.h> 59#include <linux/static_key.h>
60#include <linux/aio.h>
61#include <linux/sched.h> 60#include <linux/sched.h>
62 61
63#include <linux/filter.h> 62#include <linux/filter.h>
@@ -67,6 +66,7 @@
67#include <linux/atomic.h> 66#include <linux/atomic.h>
68#include <net/dst.h> 67#include <net/dst.h>
69#include <net/checksum.h> 68#include <net/checksum.h>
69#include <net/tcp_states.h>
70#include <linux/net_tstamp.h> 70#include <linux/net_tstamp.h>
71 71
72struct cgroup; 72struct cgroup;
@@ -190,15 +190,15 @@ struct sock_common {
190 struct hlist_nulls_node skc_portaddr_node; 190 struct hlist_nulls_node skc_portaddr_node;
191 }; 191 };
192 struct proto *skc_prot; 192 struct proto *skc_prot;
193#ifdef CONFIG_NET_NS 193 possible_net_t skc_net;
194 struct net *skc_net;
195#endif
196 194
197#if IS_ENABLED(CONFIG_IPV6) 195#if IS_ENABLED(CONFIG_IPV6)
198 struct in6_addr skc_v6_daddr; 196 struct in6_addr skc_v6_daddr;
199 struct in6_addr skc_v6_rcv_saddr; 197 struct in6_addr skc_v6_rcv_saddr;
200#endif 198#endif
201 199
200 atomic64_t skc_cookie;
201
202 /* 202 /*
203 * fields between dontcopy_begin/dontcopy_end 203 * fields between dontcopy_begin/dontcopy_end
204 * are not copied in sock_copy() 204 * are not copied in sock_copy()
@@ -329,6 +329,7 @@ struct sock {
329#define sk_net __sk_common.skc_net 329#define sk_net __sk_common.skc_net
330#define sk_v6_daddr __sk_common.skc_v6_daddr 330#define sk_v6_daddr __sk_common.skc_v6_daddr
331#define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr 331#define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
332#define sk_cookie __sk_common.skc_cookie
332 333
333 socket_lock_t sk_lock; 334 socket_lock_t sk_lock;
334 struct sk_buff_head sk_receive_queue; 335 struct sk_buff_head sk_receive_queue;
@@ -403,8 +404,8 @@ struct sock {
403 rwlock_t sk_callback_lock; 404 rwlock_t sk_callback_lock;
404 int sk_err, 405 int sk_err,
405 sk_err_soft; 406 sk_err_soft;
406 unsigned short sk_ack_backlog; 407 u32 sk_ack_backlog;
407 unsigned short sk_max_ack_backlog; 408 u32 sk_max_ack_backlog;
408 __u32 sk_priority; 409 __u32 sk_priority;
409#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO) 410#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
410 __u32 sk_cgrp_prioidx; 411 __u32 sk_cgrp_prioidx;
@@ -958,10 +959,9 @@ struct proto {
958 int (*compat_ioctl)(struct sock *sk, 959 int (*compat_ioctl)(struct sock *sk,
959 unsigned int cmd, unsigned long arg); 960 unsigned int cmd, unsigned long arg);
960#endif 961#endif
961 int (*sendmsg)(struct kiocb *iocb, struct sock *sk, 962 int (*sendmsg)(struct sock *sk, struct msghdr *msg,
962 struct msghdr *msg, size_t len); 963 size_t len);
963 int (*recvmsg)(struct kiocb *iocb, struct sock *sk, 964 int (*recvmsg)(struct sock *sk, struct msghdr *msg,
964 struct msghdr *msg,
965 size_t len, int noblock, int flags, 965 size_t len, int noblock, int flags,
966 int *addr_len); 966 int *addr_len);
967 int (*sendpage)(struct sock *sk, struct page *page, 967 int (*sendpage)(struct sock *sk, struct page *page,
@@ -1562,9 +1562,8 @@ int sock_no_listen(struct socket *, int);
1562int sock_no_shutdown(struct socket *, int); 1562int sock_no_shutdown(struct socket *, int);
1563int sock_no_getsockopt(struct socket *, int , int, char __user *, int __user *); 1563int sock_no_getsockopt(struct socket *, int , int, char __user *, int __user *);
1564int sock_no_setsockopt(struct socket *, int, int, char __user *, unsigned int); 1564int sock_no_setsockopt(struct socket *, int, int, char __user *, unsigned int);
1565int sock_no_sendmsg(struct kiocb *, struct socket *, struct msghdr *, size_t); 1565int sock_no_sendmsg(struct socket *, struct msghdr *, size_t);
1566int sock_no_recvmsg(struct kiocb *, struct socket *, struct msghdr *, size_t, 1566int sock_no_recvmsg(struct socket *, struct msghdr *, size_t, int);
1567 int);
1568int sock_no_mmap(struct file *file, struct socket *sock, 1567int sock_no_mmap(struct file *file, struct socket *sock,
1569 struct vm_area_struct *vma); 1568 struct vm_area_struct *vma);
1570ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset, 1569ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset,
@@ -1576,8 +1575,8 @@ ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset,
1576 */ 1575 */
1577int sock_common_getsockopt(struct socket *sock, int level, int optname, 1576int sock_common_getsockopt(struct socket *sock, int level, int optname,
1578 char __user *optval, int __user *optlen); 1577 char __user *optval, int __user *optlen);
1579int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock, 1578int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
1580 struct msghdr *msg, size_t size, int flags); 1579 int flags);
1581int sock_common_setsockopt(struct socket *sock, int level, int optname, 1580int sock_common_setsockopt(struct socket *sock, int level, int optname,
1582 char __user *optval, unsigned int optlen); 1581 char __user *optval, unsigned int optlen);
1583int compat_sock_common_getsockopt(struct socket *sock, int level, 1582int compat_sock_common_getsockopt(struct socket *sock, int level,
@@ -1626,7 +1625,7 @@ static inline void sock_put(struct sock *sk)
1626 sk_free(sk); 1625 sk_free(sk);
1627} 1626}
1628/* Generic version of sock_put(), dealing with all sockets 1627/* Generic version of sock_put(), dealing with all sockets
1629 * (TCP_TIMEWAIT, ESTABLISHED...) 1628 * (TCP_TIMEWAIT, TCP_NEW_SYN_RECV, ESTABLISHED...)
1630 */ 1629 */
1631void sock_gen_put(struct sock *sk); 1630void sock_gen_put(struct sock *sk);
1632 1631
@@ -1762,6 +1761,8 @@ struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
1762 1761
1763struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); 1762struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
1764 1763
1764bool sk_mc_loop(struct sock *sk);
1765
1765static inline bool sk_can_gso(const struct sock *sk) 1766static inline bool sk_can_gso(const struct sock *sk)
1766{ 1767{
1767 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); 1768 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
@@ -2078,6 +2079,29 @@ static inline int sock_intr_errno(long timeo)
2078 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; 2079 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR;
2079} 2080}
2080 2081
2082struct sock_skb_cb {
2083 u32 dropcount;
2084};
2085
2086/* Store sock_skb_cb at the end of skb->cb[] so protocol families
2087 * using skb->cb[] would keep using it directly and utilize its
2088 * alignement guarantee.
2089 */
2090#define SOCK_SKB_CB_OFFSET ((FIELD_SIZEOF(struct sk_buff, cb) - \
2091 sizeof(struct sock_skb_cb)))
2092
2093#define SOCK_SKB_CB(__skb) ((struct sock_skb_cb *)((__skb)->cb + \
2094 SOCK_SKB_CB_OFFSET))
2095
2096#define sock_skb_cb_check_size(size) \
2097 BUILD_BUG_ON((size) > SOCK_SKB_CB_OFFSET)
2098
2099static inline void
2100sock_skb_set_dropcount(const struct sock *sk, struct sk_buff *skb)
2101{
2102 SOCK_SKB_CB(skb)->dropcount = atomic_read(&sk->sk_drops);
2103}
2104
2081void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, 2105void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
2082 struct sk_buff *skb); 2106 struct sk_buff *skb);
2083void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk, 2107void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
@@ -2180,7 +2204,7 @@ static inline void sk_change_net(struct sock *sk, struct net *net)
2180 2204
2181 if (!net_eq(current_net, net)) { 2205 if (!net_eq(current_net, net)) {
2182 put_net(current_net); 2206 put_net(current_net);
2183 sock_net_set(sk, hold_net(net)); 2207 sock_net_set(sk, net);
2184 } 2208 }
2185} 2209}
2186 2210
@@ -2196,6 +2220,14 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb)
2196 return NULL; 2220 return NULL;
2197} 2221}
2198 2222
2223/* This helper checks if a socket is a full socket,
2224 * ie _not_ a timewait or request socket.
2225 */
2226static inline bool sk_fullsock(const struct sock *sk)
2227{
2228 return (1 << sk->sk_state) & ~(TCPF_TIME_WAIT | TCPF_NEW_SYN_RECV);
2229}
2230
2199void sock_enable_timestamp(struct sock *sk, int flag); 2231void sock_enable_timestamp(struct sock *sk, int flag);
2200int sock_get_timestamp(struct sock *, struct timeval __user *); 2232int sock_get_timestamp(struct sock *, struct timeval __user *);
2201int sock_get_timestampns(struct sock *, struct timespec __user *); 2233int sock_get_timestampns(struct sock *, struct timespec __user *);
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index cfcdac2e5d25..d2e69ee3019a 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -1,6 +1,7 @@
1/* 1/*
2 * include/net/switchdev.h - Switch device API 2 * include/net/switchdev.h - Switch device API
3 * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us> 3 * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us>
4 * Copyright (c) 2014-2015 Scott Feldman <sfeldma@gmail.com>
4 * 5 *
5 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -13,6 +14,35 @@
13#include <linux/netdevice.h> 14#include <linux/netdevice.h>
14#include <linux/notifier.h> 15#include <linux/notifier.h>
15 16
17struct fib_info;
18
19/**
20 * struct switchdev_ops - switchdev operations
21 *
22 * @swdev_parent_id_get: Called to get an ID of the switch chip this port
23 * is part of. If driver implements this, it indicates that it
24 * represents a port of a switch chip.
25 *
26 * @swdev_port_stp_update: Called to notify switch device port of bridge
27 * port STP state change.
28 *
29 * @swdev_fib_ipv4_add: Called to add/modify IPv4 route to switch device.
30 *
31 * @swdev_fib_ipv4_del: Called to delete IPv4 route from switch device.
32 */
33struct swdev_ops {
34 int (*swdev_parent_id_get)(struct net_device *dev,
35 struct netdev_phys_item_id *psid);
36 int (*swdev_port_stp_update)(struct net_device *dev, u8 state);
37 int (*swdev_fib_ipv4_add)(struct net_device *dev, __be32 dst,
38 int dst_len, struct fib_info *fi,
39 u8 tos, u8 type, u32 nlflags,
40 u32 tb_id);
41 int (*swdev_fib_ipv4_del)(struct net_device *dev, __be32 dst,
42 int dst_len, struct fib_info *fi,
43 u8 tos, u8 type, u32 tb_id);
44};
45
16enum netdev_switch_notifier_type { 46enum netdev_switch_notifier_type {
17 NETDEV_SWITCH_FDB_ADD = 1, 47 NETDEV_SWITCH_FDB_ADD = 1,
18 NETDEV_SWITCH_FDB_DEL, 48 NETDEV_SWITCH_FDB_DEL,
@@ -51,6 +81,12 @@ int ndo_dflt_netdev_switch_port_bridge_dellink(struct net_device *dev,
51 struct nlmsghdr *nlh, u16 flags); 81 struct nlmsghdr *nlh, u16 flags);
52int ndo_dflt_netdev_switch_port_bridge_setlink(struct net_device *dev, 82int ndo_dflt_netdev_switch_port_bridge_setlink(struct net_device *dev,
53 struct nlmsghdr *nlh, u16 flags); 83 struct nlmsghdr *nlh, u16 flags);
84int netdev_switch_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi,
85 u8 tos, u8 type, u32 nlflags, u32 tb_id);
86int netdev_switch_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi,
87 u8 tos, u8 type, u32 tb_id);
88void netdev_switch_fib_ipv4_abort(struct fib_info *fi);
89
54#else 90#else
55 91
56static inline int netdev_switch_parent_id_get(struct net_device *dev, 92static inline int netdev_switch_parent_id_get(struct net_device *dev,
@@ -109,6 +145,25 @@ static inline int ndo_dflt_netdev_switch_port_bridge_setlink(struct net_device *
109 return 0; 145 return 0;
110} 146}
111 147
148static inline int netdev_switch_fib_ipv4_add(u32 dst, int dst_len,
149 struct fib_info *fi,
150 u8 tos, u8 type,
151 u32 nlflags, u32 tb_id)
152{
153 return 0;
154}
155
156static inline int netdev_switch_fib_ipv4_del(u32 dst, int dst_len,
157 struct fib_info *fi,
158 u8 tos, u8 type, u32 tb_id)
159{
160 return 0;
161}
162
163static inline void netdev_switch_fib_ipv4_abort(struct fib_info *fi)
164{
165}
166
112#endif 167#endif
113 168
114#endif /* _LINUX_SWITCHDEV_H_ */ 169#endif /* _LINUX_SWITCHDEV_H_ */
diff --git a/include/net/tc_act/tc_bpf.h b/include/net/tc_act/tc_bpf.h
index 86a070ffc930..a152e9858b2c 100644
--- a/include/net/tc_act/tc_bpf.h
+++ b/include/net/tc_act/tc_bpf.h
@@ -16,8 +16,12 @@
16struct tcf_bpf { 16struct tcf_bpf {
17 struct tcf_common common; 17 struct tcf_common common;
18 struct bpf_prog *filter; 18 struct bpf_prog *filter;
19 union {
20 u32 bpf_fd;
21 u16 bpf_num_ops;
22 };
19 struct sock_filter *bpf_ops; 23 struct sock_filter *bpf_ops;
20 u16 bpf_num_ops; 24 const char *bpf_name;
21}; 25};
22#define to_bpf(a) \ 26#define to_bpf(a) \
23 container_of(a->priv, struct tcf_bpf, common) 27 container_of(a->priv, struct tcf_bpf, common)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 8d6b983d5099..051dc5c2802d 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -65,7 +65,13 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
65#define TCP_MIN_MSS 88U 65#define TCP_MIN_MSS 88U
66 66
67/* The least MTU to use for probing */ 67/* The least MTU to use for probing */
68#define TCP_BASE_MSS 512 68#define TCP_BASE_MSS 1024
69
70/* probing interval, default to 10 minutes as per RFC4821 */
71#define TCP_PROBE_INTERVAL 600
72
73/* Specify interval when tcp mtu probing will stop */
74#define TCP_PROBE_THRESHOLD 8
69 75
70/* After receiving this amount of duplicate ACKs fast retransmit starts. */ 76/* After receiving this amount of duplicate ACKs fast retransmit starts. */
71#define TCP_FASTRETRANS_THRESH 3 77#define TCP_FASTRETRANS_THRESH 3
@@ -173,6 +179,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
173#define TCPOPT_SACK 5 /* SACK Block */ 179#define TCPOPT_SACK 5 /* SACK Block */
174#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ 180#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */
175#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */ 181#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */
182#define TCPOPT_FASTOPEN 34 /* Fast open (RFC7413) */
176#define TCPOPT_EXP 254 /* Experimental */ 183#define TCPOPT_EXP 254 /* Experimental */
177/* Magic number to be after the option value for sharing TCP 184/* Magic number to be after the option value for sharing TCP
178 * experimental options. See draft-ietf-tcpm-experimental-options-00.txt 185 * experimental options. See draft-ietf-tcpm-experimental-options-00.txt
@@ -188,6 +195,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
188#define TCPOLEN_SACK_PERM 2 195#define TCPOLEN_SACK_PERM 2
189#define TCPOLEN_TIMESTAMP 10 196#define TCPOLEN_TIMESTAMP 10
190#define TCPOLEN_MD5SIG 18 197#define TCPOLEN_MD5SIG 18
198#define TCPOLEN_FASTOPEN_BASE 2
191#define TCPOLEN_EXP_FASTOPEN_BASE 4 199#define TCPOLEN_EXP_FASTOPEN_BASE 4
192 200
193/* But this is what stacks really send out. */ 201/* But this is what stacks really send out. */
@@ -349,8 +357,7 @@ void tcp_v4_early_demux(struct sk_buff *skb);
349int tcp_v4_rcv(struct sk_buff *skb); 357int tcp_v4_rcv(struct sk_buff *skb);
350 358
351int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); 359int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
352int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 360int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size);
353 size_t size);
354int tcp_sendpage(struct sock *sk, struct page *page, int offset, size_t size, 361int tcp_sendpage(struct sock *sk, struct page *page, int offset, size_t size,
355 int flags); 362 int flags);
356void tcp_release_cb(struct sock *sk); 363void tcp_release_cb(struct sock *sk);
@@ -401,8 +408,7 @@ enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw,
401 struct sk_buff *skb, 408 struct sk_buff *skb,
402 const struct tcphdr *th); 409 const struct tcphdr *th);
403struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, 410struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
404 struct request_sock *req, struct request_sock **prev, 411 struct request_sock *req, bool fastopen);
405 bool fastopen);
406int tcp_child_process(struct sock *parent, struct sock *child, 412int tcp_child_process(struct sock *parent, struct sock *child,
407 struct sk_buff *skb); 413 struct sk_buff *skb);
408void tcp_enter_loss(struct sock *sk); 414void tcp_enter_loss(struct sock *sk);
@@ -429,9 +435,9 @@ int compat_tcp_getsockopt(struct sock *sk, int level, int optname,
429int compat_tcp_setsockopt(struct sock *sk, int level, int optname, 435int compat_tcp_setsockopt(struct sock *sk, int level, int optname,
430 char __user *optval, unsigned int optlen); 436 char __user *optval, unsigned int optlen);
431void tcp_set_keepalive(struct sock *sk, int val); 437void tcp_set_keepalive(struct sock *sk, int val);
432void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req); 438void tcp_syn_ack_timeout(const struct request_sock *req);
433int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 439int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
434 size_t len, int nonblock, int flags, int *addr_len); 440 int flags, int *addr_len);
435void tcp_parse_options(const struct sk_buff *skb, 441void tcp_parse_options(const struct sk_buff *skb,
436 struct tcp_options_received *opt_rx, 442 struct tcp_options_received *opt_rx,
437 int estab, struct tcp_fastopen_cookie *foc); 443 int estab, struct tcp_fastopen_cookie *foc);
@@ -443,6 +449,7 @@ const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
443 449
444void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb); 450void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
445void tcp_v4_mtu_reduced(struct sock *sk); 451void tcp_v4_mtu_reduced(struct sock *sk);
452void tcp_req_err(struct sock *sk, u32 seq);
446int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); 453int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb);
447struct sock *tcp_create_openreq_child(struct sock *sk, 454struct sock *tcp_create_openreq_child(struct sock *sk,
448 struct request_sock *req, 455 struct request_sock *req,
@@ -524,8 +531,6 @@ int tcp_write_wakeup(struct sock *);
524void tcp_send_fin(struct sock *sk); 531void tcp_send_fin(struct sock *sk);
525void tcp_send_active_reset(struct sock *sk, gfp_t priority); 532void tcp_send_active_reset(struct sock *sk, gfp_t priority);
526int tcp_send_synack(struct sock *); 533int tcp_send_synack(struct sock *);
527bool tcp_syn_flood_action(struct sock *sk, const struct sk_buff *skb,
528 const char *proto);
529void tcp_push_one(struct sock *, unsigned int mss_now); 534void tcp_push_one(struct sock *, unsigned int mss_now);
530void tcp_send_ack(struct sock *sk); 535void tcp_send_ack(struct sock *sk);
531void tcp_send_delayed_ack(struct sock *sk); 536void tcp_send_delayed_ack(struct sock *sk);
@@ -824,7 +829,7 @@ struct tcp_congestion_ops {
824 /* hook for packet ack accounting (optional) */ 829 /* hook for packet ack accounting (optional) */
825 void (*pkts_acked)(struct sock *sk, u32 num_acked, s32 rtt_us); 830 void (*pkts_acked)(struct sock *sk, u32 num_acked, s32 rtt_us);
826 /* get info for inet_diag (optional) */ 831 /* get info for inet_diag (optional) */
827 void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb); 832 int (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb);
828 833
829 char name[TCP_CA_NAME_MAX]; 834 char name[TCP_CA_NAME_MAX];
830 struct module *owner; 835 struct module *owner;
@@ -1132,31 +1137,6 @@ static inline int tcp_full_space(const struct sock *sk)
1132 return tcp_win_from_space(sk->sk_rcvbuf); 1137 return tcp_win_from_space(sk->sk_rcvbuf);
1133} 1138}
1134 1139
1135static inline void tcp_openreq_init(struct request_sock *req,
1136 struct tcp_options_received *rx_opt,
1137 struct sk_buff *skb, struct sock *sk)
1138{
1139 struct inet_request_sock *ireq = inet_rsk(req);
1140
1141 req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */
1142 req->cookie_ts = 0;
1143 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq;
1144 tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
1145 tcp_rsk(req)->snt_synack = tcp_time_stamp;
1146 tcp_rsk(req)->last_oow_ack_time = 0;
1147 req->mss = rx_opt->mss_clamp;
1148 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0;
1149 ireq->tstamp_ok = rx_opt->tstamp_ok;
1150 ireq->sack_ok = rx_opt->sack_ok;
1151 ireq->snd_wscale = rx_opt->snd_wscale;
1152 ireq->wscale_ok = rx_opt->wscale_ok;
1153 ireq->acked = 0;
1154 ireq->ecn_ok = 0;
1155 ireq->ir_rmt_port = tcp_hdr(skb)->source;
1156 ireq->ir_num = ntohs(tcp_hdr(skb)->dest);
1157 ireq->ir_mark = inet_request_mark(sk, skb);
1158}
1159
1160extern void tcp_openreq_init_rwin(struct request_sock *req, 1140extern void tcp_openreq_init_rwin(struct request_sock *req,
1161 struct sock *sk, struct dst_entry *dst); 1141 struct sock *sk, struct dst_entry *dst);
1162 1142
@@ -1236,36 +1216,8 @@ static inline bool tcp_paws_reject(const struct tcp_options_received *rx_opt,
1236 return true; 1216 return true;
1237} 1217}
1238 1218
1239/* Return true if we're currently rate-limiting out-of-window ACKs and 1219bool tcp_oow_rate_limited(struct net *net, const struct sk_buff *skb,
1240 * thus shouldn't send a dupack right now. We rate-limit dupacks in 1220 int mib_idx, u32 *last_oow_ack_time);
1241 * response to out-of-window SYNs or ACKs to mitigate ACK loops or DoS
1242 * attacks that send repeated SYNs or ACKs for the same connection. To
1243 * do this, we do not send a duplicate SYNACK or ACK if the remote
1244 * endpoint is sending out-of-window SYNs or pure ACKs at a high rate.
1245 */
1246static inline bool tcp_oow_rate_limited(struct net *net,
1247 const struct sk_buff *skb,
1248 int mib_idx, u32 *last_oow_ack_time)
1249{
1250 /* Data packets without SYNs are not likely part of an ACK loop. */
1251 if ((TCP_SKB_CB(skb)->seq != TCP_SKB_CB(skb)->end_seq) &&
1252 !tcp_hdr(skb)->syn)
1253 goto not_rate_limited;
1254
1255 if (*last_oow_ack_time) {
1256 s32 elapsed = (s32)(tcp_time_stamp - *last_oow_ack_time);
1257
1258 if (0 <= elapsed && elapsed < sysctl_tcp_invalid_ratelimit) {
1259 NET_INC_STATS_BH(net, mib_idx);
1260 return true; /* rate-limited: don't send yet! */
1261 }
1262 }
1263
1264 *last_oow_ack_time = tcp_time_stamp;
1265
1266not_rate_limited:
1267 return false; /* not rate-limited: go ahead, send dupack now! */
1268}
1269 1221
1270static inline void tcp_mib_init(struct net *net) 1222static inline void tcp_mib_init(struct net *net)
1271{ 1223{
@@ -1344,15 +1296,14 @@ struct tcp_md5sig_pool {
1344}; 1296};
1345 1297
1346/* - functions */ 1298/* - functions */
1347int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, 1299int tcp_v4_md5_hash_skb(char *md5_hash, const struct tcp_md5sig_key *key,
1348 const struct sock *sk, const struct request_sock *req, 1300 const struct sock *sk, const struct sk_buff *skb);
1349 const struct sk_buff *skb);
1350int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr, 1301int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
1351 int family, const u8 *newkey, u8 newkeylen, gfp_t gfp); 1302 int family, const u8 *newkey, u8 newkeylen, gfp_t gfp);
1352int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr, 1303int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr,
1353 int family); 1304 int family);
1354struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, 1305struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
1355 struct sock *addr_sk); 1306 const struct sock *addr_sk);
1356 1307
1357#ifdef CONFIG_TCP_MD5SIG 1308#ifdef CONFIG_TCP_MD5SIG
1358struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk, 1309struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
@@ -1388,7 +1339,8 @@ void tcp_fastopen_cache_get(struct sock *sk, u16 *mss,
1388 struct tcp_fastopen_cookie *cookie, int *syn_loss, 1339 struct tcp_fastopen_cookie *cookie, int *syn_loss,
1389 unsigned long *last_syn_loss); 1340 unsigned long *last_syn_loss);
1390void tcp_fastopen_cache_set(struct sock *sk, u16 mss, 1341void tcp_fastopen_cache_set(struct sock *sk, u16 mss,
1391 struct tcp_fastopen_cookie *cookie, bool syn_lost); 1342 struct tcp_fastopen_cookie *cookie, bool syn_lost,
1343 u16 try_exp);
1392struct tcp_fastopen_request { 1344struct tcp_fastopen_request {
1393 /* Fast Open cookie. Size 0 means a cookie request */ 1345 /* Fast Open cookie. Size 0 means a cookie request */
1394 struct tcp_fastopen_cookie cookie; 1346 struct tcp_fastopen_cookie cookie;
@@ -1663,28 +1615,26 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
1663struct tcp_sock_af_ops { 1615struct tcp_sock_af_ops {
1664#ifdef CONFIG_TCP_MD5SIG 1616#ifdef CONFIG_TCP_MD5SIG
1665 struct tcp_md5sig_key *(*md5_lookup) (struct sock *sk, 1617 struct tcp_md5sig_key *(*md5_lookup) (struct sock *sk,
1666 struct sock *addr_sk); 1618 const struct sock *addr_sk);
1667 int (*calc_md5_hash) (char *location, 1619 int (*calc_md5_hash)(char *location,
1668 struct tcp_md5sig_key *md5, 1620 const struct tcp_md5sig_key *md5,
1669 const struct sock *sk, 1621 const struct sock *sk,
1670 const struct request_sock *req, 1622 const struct sk_buff *skb);
1671 const struct sk_buff *skb); 1623 int (*md5_parse)(struct sock *sk,
1672 int (*md5_parse) (struct sock *sk, 1624 char __user *optval,
1673 char __user *optval, 1625 int optlen);
1674 int optlen);
1675#endif 1626#endif
1676}; 1627};
1677 1628
1678struct tcp_request_sock_ops { 1629struct tcp_request_sock_ops {
1679 u16 mss_clamp; 1630 u16 mss_clamp;
1680#ifdef CONFIG_TCP_MD5SIG 1631#ifdef CONFIG_TCP_MD5SIG
1681 struct tcp_md5sig_key *(*md5_lookup) (struct sock *sk, 1632 struct tcp_md5sig_key *(*req_md5_lookup)(struct sock *sk,
1682 struct request_sock *req); 1633 const struct sock *addr_sk);
1683 int (*calc_md5_hash) (char *location, 1634 int (*calc_md5_hash) (char *location,
1684 struct tcp_md5sig_key *md5, 1635 const struct tcp_md5sig_key *md5,
1685 const struct sock *sk, 1636 const struct sock *sk,
1686 const struct request_sock *req, 1637 const struct sk_buff *skb);
1687 const struct sk_buff *skb);
1688#endif 1638#endif
1689 void (*init_req)(struct request_sock *req, struct sock *sk, 1639 void (*init_req)(struct request_sock *req, struct sock *sk,
1690 struct sk_buff *skb); 1640 struct sk_buff *skb);
diff --git a/include/net/tcp_states.h b/include/net/tcp_states.h
index b0b645988bd8..50e78a74d0df 100644
--- a/include/net/tcp_states.h
+++ b/include/net/tcp_states.h
@@ -25,6 +25,7 @@ enum {
25 TCP_LAST_ACK, 25 TCP_LAST_ACK,
26 TCP_LISTEN, 26 TCP_LISTEN,
27 TCP_CLOSING, /* Now a valid state */ 27 TCP_CLOSING, /* Now a valid state */
28 TCP_NEW_SYN_RECV,
28 29
29 TCP_MAX_STATES /* Leave at the end! */ 30 TCP_MAX_STATES /* Leave at the end! */
30}; 31};
@@ -44,7 +45,8 @@ enum {
44 TCPF_CLOSE_WAIT = (1 << 8), 45 TCPF_CLOSE_WAIT = (1 << 8),
45 TCPF_LAST_ACK = (1 << 9), 46 TCPF_LAST_ACK = (1 << 9),
46 TCPF_LISTEN = (1 << 10), 47 TCPF_LISTEN = (1 << 10),
47 TCPF_CLOSING = (1 << 11) 48 TCPF_CLOSING = (1 << 11),
49 TCPF_NEW_SYN_RECV = (1 << 12),
48}; 50};
49 51
50#endif /* _LINUX_TCP_STATES_H */ 52#endif /* _LINUX_TCP_STATES_H */
diff --git a/include/net/udp.h b/include/net/udp.h
index 07f9b70962f6..6d4ed18e1427 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -194,6 +194,8 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
194 int (*)(const struct sock *, const struct sock *), 194 int (*)(const struct sock *, const struct sock *),
195 unsigned int hash2_nulladdr); 195 unsigned int hash2_nulladdr);
196 196
197u32 udp_flow_hashrnd(void);
198
197static inline __be16 udp_flow_src_port(struct net *net, struct sk_buff *skb, 199static inline __be16 udp_flow_src_port(struct net *net, struct sk_buff *skb,
198 int min, int max, bool use_eth) 200 int min, int max, bool use_eth)
199{ 201{
@@ -205,12 +207,19 @@ static inline __be16 udp_flow_src_port(struct net *net, struct sk_buff *skb,
205 } 207 }
206 208
207 hash = skb_get_hash(skb); 209 hash = skb_get_hash(skb);
208 if (unlikely(!hash) && use_eth) { 210 if (unlikely(!hash)) {
209 /* Can't find a normal hash, caller has indicated an Ethernet 211 if (use_eth) {
210 * packet so use that to compute a hash. 212 /* Can't find a normal hash, caller has indicated an
211 */ 213 * Ethernet packet so use that to compute a hash.
212 hash = jhash(skb->data, 2 * ETH_ALEN, 214 */
213 (__force u32) skb->protocol); 215 hash = jhash(skb->data, 2 * ETH_ALEN,
216 (__force u32) skb->protocol);
217 } else {
218 /* Can't derive any sort of hash for the packet, set
219 * to some consistent random value.
220 */
221 hash = udp_flow_hashrnd();
222 }
214 } 223 }
215 224
216 /* Since this is being sent on the wire obfuscate hash a bit 225 /* Since this is being sent on the wire obfuscate hash a bit
@@ -229,8 +238,7 @@ int udp_get_port(struct sock *sk, unsigned short snum,
229 int (*saddr_cmp)(const struct sock *, 238 int (*saddr_cmp)(const struct sock *,
230 const struct sock *)); 239 const struct sock *));
231void udp_err(struct sk_buff *, u32); 240void udp_err(struct sk_buff *, u32);
232int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 241int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len);
233 size_t len);
234int udp_push_pending_frames(struct sock *sk); 242int udp_push_pending_frames(struct sock *sk);
235void udp_flush_pending_frames(struct sock *sk); 243void udp_flush_pending_frames(struct sock *sk);
236void udp4_hwcsum(struct sk_buff *skb, __be32 src, __be32 dst); 244void udp4_hwcsum(struct sk_buff *skb, __be32 src, __be32 dst);
diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h
index 1a20d33d56bc..c491c1221606 100644
--- a/include/net/udp_tunnel.h
+++ b/include/net/udp_tunnel.h
@@ -77,13 +77,14 @@ void setup_udp_tunnel_sock(struct net *net, struct socket *sock,
77 struct udp_tunnel_sock_cfg *sock_cfg); 77 struct udp_tunnel_sock_cfg *sock_cfg);
78 78
79/* Transmit the skb using UDP encapsulation. */ 79/* Transmit the skb using UDP encapsulation. */
80int udp_tunnel_xmit_skb(struct rtable *rt, struct sk_buff *skb, 80int udp_tunnel_xmit_skb(struct rtable *rt, struct sock *sk, struct sk_buff *skb,
81 __be32 src, __be32 dst, __u8 tos, __u8 ttl, 81 __be32 src, __be32 dst, __u8 tos, __u8 ttl,
82 __be16 df, __be16 src_port, __be16 dst_port, 82 __be16 df, __be16 src_port, __be16 dst_port,
83 bool xnet, bool nocheck); 83 bool xnet, bool nocheck);
84 84
85#if IS_ENABLED(CONFIG_IPV6) 85#if IS_ENABLED(CONFIG_IPV6)
86int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sk_buff *skb, 86int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sock *sk,
87 struct sk_buff *skb,
87 struct net_device *dev, struct in6_addr *saddr, 88 struct net_device *dev, struct in6_addr *saddr,
88 struct in6_addr *daddr, 89 struct in6_addr *daddr,
89 __u8 prio, __u8 ttl, __be16 src_port, 90 __u8 prio, __u8 ttl, __be16 src_port,
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index eabd3a038674..0082b5d33d7d 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -91,6 +91,7 @@ struct vxlanhdr {
91 91
92#define VXLAN_N_VID (1u << 24) 92#define VXLAN_N_VID (1u << 24)
93#define VXLAN_VID_MASK (VXLAN_N_VID - 1) 93#define VXLAN_VID_MASK (VXLAN_N_VID - 1)
94#define VXLAN_VNI_MASK (VXLAN_VID_MASK << 8)
94#define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr)) 95#define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr))
95 96
96struct vxlan_metadata { 97struct vxlan_metadata {
@@ -130,7 +131,7 @@ struct vxlan_sock {
130#define VXLAN_F_GBP 0x800 131#define VXLAN_F_GBP 0x800
131#define VXLAN_F_REMCSUM_NOPARTIAL 0x1000 132#define VXLAN_F_REMCSUM_NOPARTIAL 0x1000
132 133
133/* Flags that are used in the receive patch. These flags must match in 134/* Flags that are used in the receive path. These flags must match in
134 * order for a socket to be shareable 135 * order for a socket to be shareable
135 */ 136 */
136#define VXLAN_F_RCV_FLAGS (VXLAN_F_GBP | \ 137#define VXLAN_F_RCV_FLAGS (VXLAN_F_GBP | \
@@ -144,7 +145,7 @@ struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port,
144 145
145void vxlan_sock_release(struct vxlan_sock *vs); 146void vxlan_sock_release(struct vxlan_sock *vs);
146 147
147int vxlan_xmit_skb(struct rtable *rt, struct sk_buff *skb, 148int vxlan_xmit_skb(struct rtable *rt, struct sock *sk, struct sk_buff *skb,
148 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, 149 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df,
149 __be16 src_port, __be16 dst_port, struct vxlan_metadata *md, 150 __be16 src_port, __be16 dst_port, struct vxlan_metadata *md,
150 bool xnet, u32 vxflags); 151 bool xnet, u32 vxflags);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index dc4865e90fe4..36ac102c97c7 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -126,9 +126,7 @@ struct xfrm_state_walk {
126 126
127/* Full description of state of transformer. */ 127/* Full description of state of transformer. */
128struct xfrm_state { 128struct xfrm_state {
129#ifdef CONFIG_NET_NS 129 possible_net_t xs_net;
130 struct net *xs_net;
131#endif
132 union { 130 union {
133 struct hlist_node gclist; 131 struct hlist_node gclist;
134 struct hlist_node bydst; 132 struct hlist_node bydst;
@@ -334,7 +332,7 @@ struct xfrm_state_afinfo {
334 int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); 332 int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n);
335 int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); 333 int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n);
336 int (*output)(struct sock *sk, struct sk_buff *skb); 334 int (*output)(struct sock *sk, struct sk_buff *skb);
337 int (*output_finish)(struct sk_buff *skb); 335 int (*output_finish)(struct sock *sk, struct sk_buff *skb);
338 int (*extract_input)(struct xfrm_state *x, 336 int (*extract_input)(struct xfrm_state *x,
339 struct sk_buff *skb); 337 struct sk_buff *skb);
340 int (*extract_output)(struct xfrm_state *x, 338 int (*extract_output)(struct xfrm_state *x,
@@ -522,9 +520,7 @@ struct xfrm_policy_queue {
522}; 520};
523 521
524struct xfrm_policy { 522struct xfrm_policy {
525#ifdef CONFIG_NET_NS 523 possible_net_t xp_net;
526 struct net *xp_net;
527#endif
528 struct hlist_node bydst; 524 struct hlist_node bydst;
529 struct hlist_node byidx; 525 struct hlist_node byidx;
530 526
@@ -1029,7 +1025,7 @@ xfrm_addr_any(const xfrm_address_t *addr, unsigned short family)
1029 case AF_INET: 1025 case AF_INET:
1030 return addr->a4 == 0; 1026 return addr->a4 == 0;
1031 case AF_INET6: 1027 case AF_INET6:
1032 return ipv6_addr_any((struct in6_addr *)&addr->a6); 1028 return ipv6_addr_any(&addr->in6);
1033 } 1029 }
1034 return 0; 1030 return 0;
1035} 1031}
@@ -1242,8 +1238,8 @@ void xfrm_flowi_addr_get(const struct flowi *fl,
1242 memcpy(&daddr->a4, &fl->u.ip4.daddr, sizeof(daddr->a4)); 1238 memcpy(&daddr->a4, &fl->u.ip4.daddr, sizeof(daddr->a4));
1243 break; 1239 break;
1244 case AF_INET6: 1240 case AF_INET6:
1245 *(struct in6_addr *)saddr->a6 = fl->u.ip6.saddr; 1241 saddr->in6 = fl->u.ip6.saddr;
1246 *(struct in6_addr *)daddr->a6 = fl->u.ip6.daddr; 1242 daddr->in6 = fl->u.ip6.daddr;
1247 break; 1243 break;
1248 } 1244 }
1249} 1245}
@@ -1507,7 +1503,7 @@ int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb);
1507int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type); 1503int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type);
1508int xfrm_input_resume(struct sk_buff *skb, int nexthdr); 1504int xfrm_input_resume(struct sk_buff *skb, int nexthdr);
1509int xfrm_output_resume(struct sk_buff *skb, int err); 1505int xfrm_output_resume(struct sk_buff *skb, int err);
1510int xfrm_output(struct sk_buff *skb); 1506int xfrm_output(struct sock *sk, struct sk_buff *skb);
1511int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1507int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1512void xfrm_local_error(struct sk_buff *skb, int mtu); 1508void xfrm_local_error(struct sk_buff *skb, int mtu);
1513int xfrm4_extract_header(struct sk_buff *skb); 1509int xfrm4_extract_header(struct sk_buff *skb);
@@ -1528,7 +1524,7 @@ static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
1528int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1524int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1529int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1525int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1530int xfrm4_output(struct sock *sk, struct sk_buff *skb); 1526int xfrm4_output(struct sock *sk, struct sk_buff *skb);
1531int xfrm4_output_finish(struct sk_buff *skb); 1527int xfrm4_output_finish(struct sock *sk, struct sk_buff *skb);
1532int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err); 1528int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
1533int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol); 1529int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol);
1534int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char protocol); 1530int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char protocol);
@@ -1553,7 +1549,7 @@ __be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr);
1553int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1549int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1554int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1550int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1555int xfrm6_output(struct sock *sk, struct sk_buff *skb); 1551int xfrm6_output(struct sock *sk, struct sk_buff *skb);
1556int xfrm6_output_finish(struct sk_buff *skb); 1552int xfrm6_output_finish(struct sock *sk, struct sk_buff *skb);
1557int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, 1553int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
1558 u8 **prevhdr); 1554 u8 **prevhdr);
1559 1555
diff --git a/include/rxrpc/packet.h b/include/rxrpc/packet.h
index f2902ef7ab75..4dce116bfd80 100644
--- a/include/rxrpc/packet.h
+++ b/include/rxrpc/packet.h
@@ -47,7 +47,8 @@ struct rxrpc_header {
47#define RXRPC_PACKET_TYPE_CHALLENGE 6 /* connection security challenge (SRVR->CLNT) */ 47#define RXRPC_PACKET_TYPE_CHALLENGE 6 /* connection security challenge (SRVR->CLNT) */
48#define RXRPC_PACKET_TYPE_RESPONSE 7 /* connection secutity response (CLNT->SRVR) */ 48#define RXRPC_PACKET_TYPE_RESPONSE 7 /* connection secutity response (CLNT->SRVR) */
49#define RXRPC_PACKET_TYPE_DEBUG 8 /* debug info request */ 49#define RXRPC_PACKET_TYPE_DEBUG 8 /* debug info request */
50#define RXRPC_N_PACKET_TYPES 9 /* number of packet types (incl type 0) */ 50#define RXRPC_PACKET_TYPE_VERSION 13 /* version string request */
51#define RXRPC_N_PACKET_TYPES 14 /* number of packet types (incl type 0) */
51 52
52 uint8_t flags; /* packet flags */ 53 uint8_t flags; /* packet flags */
53#define RXRPC_CLIENT_INITIATED 0x01 /* signifies a packet generated by a client */ 54#define RXRPC_CLIENT_INITIATED 0x01 /* signifies a packet generated by a client */
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
index 1e1421b06565..5a4bb5bb66b3 100644
--- a/include/scsi/scsi_eh.h
+++ b/include/scsi/scsi_eh.h
@@ -59,6 +59,7 @@ extern int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len,
59 u64 * info_out); 59 u64 * info_out);
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);
62extern void scsi_set_sense_information(u8 *buf, u64 info);
62 63
63extern int scsi_ioctl_reset(struct scsi_device *, int __user *); 64extern int scsi_ioctl_reset(struct scsi_device *, int __user *);
64 65
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 007a0bc01b74..784bc2c0929f 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -135,6 +135,7 @@ enum fc_vport_state {
135#define FC_PORTSPEED_40GBIT 0x100 135#define FC_PORTSPEED_40GBIT 0x100
136#define FC_PORTSPEED_50GBIT 0x200 136#define FC_PORTSPEED_50GBIT 0x200
137#define FC_PORTSPEED_100GBIT 0x400 137#define FC_PORTSPEED_100GBIT 0x400
138#define FC_PORTSPEED_25GBIT 0x800
138#define FC_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */ 139#define FC_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */
139 140
140/* 141/*
diff --git a/include/soc/at91/at91sam9_ddrsdr.h b/include/soc/at91/at91sam9_ddrsdr.h
index 0210797abf2e..dc10c52e0e91 100644
--- a/include/soc/at91/at91sam9_ddrsdr.h
+++ b/include/soc/at91/at91sam9_ddrsdr.h
@@ -92,7 +92,7 @@
92#define AT91_DDRSDRC_UPD_MR (3 << 20) /* Update load mode register and extended mode register */ 92#define AT91_DDRSDRC_UPD_MR (3 << 20) /* Update load mode register and extended mode register */
93 93
94#define AT91_DDRSDRC_MDR 0x20 /* Memory Device Register */ 94#define AT91_DDRSDRC_MDR 0x20 /* Memory Device Register */
95#define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */ 95#define AT91_DDRSDRC_MD (7 << 0) /* Memory Device Type */
96#define AT91_DDRSDRC_MD_SDR 0 96#define AT91_DDRSDRC_MD_SDR 0
97#define AT91_DDRSDRC_MD_LOW_POWER_SDR 1 97#define AT91_DDRSDRC_MD_LOW_POWER_SDR 1
98#define AT91_DDRSDRC_MD_LOW_POWER_DDR 3 98#define AT91_DDRSDRC_MD_LOW_POWER_DDR 3
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index d315a08d6c6d..0e9d75b49bed 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -608,7 +608,9 @@ struct ac97_quirk {
608 int type; /* quirk type above */ 608 int type; /* quirk type above */
609}; 609};
610 610
611int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, const char *override); 611int snd_ac97_tune_hardware(struct snd_ac97 *ac97,
612 const struct ac97_quirk *quirk,
613 const char *override);
612int snd_ac97_set_rate(struct snd_ac97 *ac97, int reg, unsigned int rate); 614int snd_ac97_set_rate(struct snd_ac97 *ac97, int reg, unsigned int rate);
613 615
614/* 616/*
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index f48089d364c5..fa1d05512c09 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -70,7 +70,7 @@ struct snd_compr_runtime {
70 * @device: device pointer 70 * @device: device pointer
71 * @direction: stream direction, playback/recording 71 * @direction: stream direction, playback/recording
72 * @metadata_set: metadata set flag, true when set 72 * @metadata_set: metadata set flag, true when set
73 * @next_track: has userspace signall next track transistion, true when set 73 * @next_track: has userspace signal next track transition, true when set
74 * @private_data: pointer to DSP private data 74 * @private_data: pointer to DSP private data
75 */ 75 */
76struct snd_compr_stream { 76struct snd_compr_stream {
@@ -95,7 +95,7 @@ struct snd_compr_stream {
95 * and the stream properties 95 * and the stream properties
96 * @get_params: retrieve the codec parameters, mandatory 96 * @get_params: retrieve the codec parameters, mandatory
97 * @set_metadata: Set the metadata values for a stream 97 * @set_metadata: Set the metadata values for a stream
98 * @get_metadata: retreives the requested metadata values from stream 98 * @get_metadata: retrieves the requested metadata values from stream
99 * @trigger: Trigger operations like start, pause, resume, drain, stop. 99 * @trigger: Trigger operations like start, pause, resume, drain, stop.
100 * This callback is mandatory 100 * This callback is mandatory
101 * @pointer: Retrieve current h/w pointer information. Mandatory 101 * @pointer: Retrieve current h/w pointer information. Mandatory
diff --git a/include/sound/control.h b/include/sound/control.h
index 75f3054023f7..95aad6d3fd1a 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -227,7 +227,7 @@ snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave)
227 * Add a virtual slave control to the given master. 227 * Add a virtual slave control to the given master.
228 * Unlike snd_ctl_add_slave(), the element added via this function 228 * Unlike snd_ctl_add_slave(), the element added via this function
229 * is supposed to have volatile values, and get callback is called 229 * is supposed to have volatile values, and get callback is called
230 * at each time quried from the master. 230 * at each time queried from the master.
231 * 231 *
232 * When the control peeks the hardware values directly and the value 232 * When the control peeks the hardware values directly and the value
233 * can be changed by other means than the put callback of the element, 233 * can be changed by other means than the put callback of the element,
diff --git a/include/sound/core.h b/include/sound/core.h
index da5748289968..b12931f513f4 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -278,7 +278,8 @@ int snd_device_new(struct snd_card *card, enum snd_device_type type,
278 void *device_data, struct snd_device_ops *ops); 278 void *device_data, struct snd_device_ops *ops);
279int snd_device_register(struct snd_card *card, void *device_data); 279int snd_device_register(struct snd_card *card, void *device_data);
280int snd_device_register_all(struct snd_card *card); 280int snd_device_register_all(struct snd_card *card);
281int snd_device_disconnect_all(struct snd_card *card); 281void snd_device_disconnect(struct snd_card *card, void *device_data);
282void snd_device_disconnect_all(struct snd_card *card);
282void snd_device_free(struct snd_card *card, void *device_data); 283void snd_device_free(struct snd_card *card, void *device_data);
283void snd_device_free_all(struct snd_card *card); 284void snd_device_free_all(struct snd_card *card);
284 285
diff --git a/include/sound/designware_i2s.h b/include/sound/designware_i2s.h
index 26f406e0f673..3a8fca9409a7 100644
--- a/include/sound/designware_i2s.h
+++ b/include/sound/designware_i2s.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (ST) 2012 Rajeev Kumar (rajeev-dlh.kumar@st.com) 2 * Copyright (ST) 2012 Rajeev Kumar (rajeevkumar.linux@gmail.com)
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 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 5 * it under the terms of the GNU General Public License as published by
diff --git a/include/sound/hda_regmap.h b/include/sound/hda_regmap.h
new file mode 100644
index 000000000000..53a18b3635e2
--- /dev/null
+++ b/include/sound/hda_regmap.h
@@ -0,0 +1,217 @@
1/*
2 * HD-audio regmap helpers
3 */
4
5#ifndef __SOUND_HDA_REGMAP_H
6#define __SOUND_HDA_REGMAP_H
7
8#include <linux/regmap.h>
9#include <sound/core.h>
10#include <sound/hdaudio.h>
11
12int snd_hdac_regmap_init(struct hdac_device *codec);
13void snd_hdac_regmap_exit(struct hdac_device *codec);
14int snd_hdac_regmap_add_vendor_verb(struct hdac_device *codec,
15 unsigned int verb);
16int snd_hdac_regmap_read_raw(struct hdac_device *codec, unsigned int reg,
17 unsigned int *val);
18int snd_hdac_regmap_write_raw(struct hdac_device *codec, unsigned int reg,
19 unsigned int val);
20int snd_hdac_regmap_update_raw(struct hdac_device *codec, unsigned int reg,
21 unsigned int mask, unsigned int val);
22
23/**
24 * snd_hdac_regmap_encode_verb - encode the verb to a pseudo register
25 * @nid: widget NID
26 * @verb: codec verb
27 *
28 * Returns an encoded pseudo register.
29 */
30#define snd_hdac_regmap_encode_verb(nid, verb) \
31 (((verb) << 8) | 0x80000 | ((unsigned int)(nid) << 20))
32
33/**
34 * snd_hdac_regmap_encode_amp - encode the AMP verb to a pseudo register
35 * @nid: widget NID
36 * @ch: channel (left = 0, right = 1)
37 * @dir: direction (#HDA_INPUT, #HDA_OUTPUT)
38 * @idx: input index value
39 *
40 * Returns an encoded pseudo register.
41 */
42#define snd_hdac_regmap_encode_amp(nid, ch, dir, idx) \
43 (snd_hdac_regmap_encode_verb(nid, AC_VERB_GET_AMP_GAIN_MUTE) | \
44 ((ch) ? AC_AMP_GET_RIGHT : AC_AMP_GET_LEFT) | \
45 ((dir) == HDA_OUTPUT ? AC_AMP_GET_OUTPUT : AC_AMP_GET_INPUT) | \
46 (idx))
47
48/**
49 * snd_hdac_regmap_encode_amp_stereo - encode a pseudo register for stereo AMPs
50 * @nid: widget NID
51 * @dir: direction (#HDA_INPUT, #HDA_OUTPUT)
52 * @idx: input index value
53 *
54 * Returns an encoded pseudo register.
55 */
56#define snd_hdac_regmap_encode_amp_stereo(nid, dir, idx) \
57 (snd_hdac_regmap_encode_verb(nid, AC_VERB_GET_AMP_GAIN_MUTE) | \
58 AC_AMP_SET_LEFT | AC_AMP_SET_RIGHT | /* both bits set! */ \
59 ((dir) == HDA_OUTPUT ? AC_AMP_GET_OUTPUT : AC_AMP_GET_INPUT) | \
60 (idx))
61
62/**
63 * snd_hdac_regmap_write - Write a verb with caching
64 * @nid: codec NID
65 * @reg: verb to write
66 * @val: value to write
67 *
68 * For writing an amp value, use snd_hda_regmap_amp_update().
69 */
70static inline int
71snd_hdac_regmap_write(struct hdac_device *codec, hda_nid_t nid,
72 unsigned int verb, unsigned int val)
73{
74 unsigned int cmd = snd_hdac_regmap_encode_verb(nid, verb);
75
76 return snd_hdac_regmap_write_raw(codec, cmd, val);
77}
78
79/**
80 * snd_hda_regmap_update - Update a verb value with caching
81 * @nid: codec NID
82 * @verb: verb to update
83 * @mask: bit mask to update
84 * @val: value to update
85 *
86 * For updating an amp value, use snd_hda_regmap_amp_update().
87 */
88static inline int
89snd_hdac_regmap_update(struct hdac_device *codec, hda_nid_t nid,
90 unsigned int verb, unsigned int mask,
91 unsigned int val)
92{
93 unsigned int cmd = snd_hdac_regmap_encode_verb(nid, verb);
94
95 return snd_hdac_regmap_update_raw(codec, cmd, mask, val);
96}
97
98/**
99 * snd_hda_regmap_read - Read a verb with caching
100 * @nid: codec NID
101 * @verb: verb to read
102 * @val: pointer to store the value
103 *
104 * For reading an amp value, use snd_hda_regmap_get_amp().
105 */
106static inline int
107snd_hdac_regmap_read(struct hdac_device *codec, hda_nid_t nid,
108 unsigned int verb, unsigned int *val)
109{
110 unsigned int cmd = snd_hdac_regmap_encode_verb(nid, verb);
111
112 return snd_hdac_regmap_read_raw(codec, cmd, val);
113}
114
115/**
116 * snd_hdac_regmap_get_amp - Read AMP value
117 * @codec: HD-audio codec
118 * @nid: NID to read the AMP value
119 * @ch: channel (left=0 or right=1)
120 * @direction: #HDA_INPUT or #HDA_OUTPUT
121 * @index: the index value (only for input direction)
122 * @val: the pointer to store the value
123 *
124 * Read AMP value. The volume is between 0 to 0x7f, 0x80 = mute bit.
125 * Returns the value or a negative error.
126 */
127static inline int
128snd_hdac_regmap_get_amp(struct hdac_device *codec, hda_nid_t nid,
129 int ch, int dir, int idx)
130{
131 unsigned int cmd = snd_hdac_regmap_encode_amp(nid, ch, dir, idx);
132 int err, val;
133
134 err = snd_hdac_regmap_read_raw(codec, cmd, &val);
135 return err < 0 ? err : val;
136}
137
138/**
139 * snd_hdac_regmap_update_amp - update the AMP value
140 * @codec: HD-audio codec
141 * @nid: NID to read the AMP value
142 * @ch: channel (left=0 or right=1)
143 * @direction: #HDA_INPUT or #HDA_OUTPUT
144 * @idx: the index value (only for input direction)
145 * @mask: bit mask to set
146 * @val: the bits value to set
147 *
148 * Update the AMP value with a bit mask.
149 * Returns 0 if the value is unchanged, 1 if changed, or a negative error.
150 */
151static inline int
152snd_hdac_regmap_update_amp(struct hdac_device *codec, hda_nid_t nid,
153 int ch, int dir, int idx, int mask, int val)
154{
155 unsigned int cmd = snd_hdac_regmap_encode_amp(nid, ch, dir, idx);
156
157 return snd_hdac_regmap_update_raw(codec, cmd, mask, val);
158}
159
160/**
161 * snd_hdac_regmap_get_amp_stereo - Read stereo AMP values
162 * @codec: HD-audio codec
163 * @nid: NID to read the AMP value
164 * @ch: channel (left=0 or right=1)
165 * @direction: #HDA_INPUT or #HDA_OUTPUT
166 * @index: the index value (only for input direction)
167 * @val: the pointer to store the value
168 *
169 * Read stereo AMP values. The lower byte is left, the upper byte is right.
170 * Returns the value or a negative error.
171 */
172static inline int
173snd_hdac_regmap_get_amp_stereo(struct hdac_device *codec, hda_nid_t nid,
174 int dir, int idx)
175{
176 unsigned int cmd = snd_hdac_regmap_encode_amp_stereo(nid, dir, idx);
177 int err, val;
178
179 err = snd_hdac_regmap_read_raw(codec, cmd, &val);
180 return err < 0 ? err : val;
181}
182
183/**
184 * snd_hdac_regmap_update_amp_stereo - update the stereo AMP value
185 * @codec: HD-audio codec
186 * @nid: NID to read the AMP value
187 * @direction: #HDA_INPUT or #HDA_OUTPUT
188 * @idx: the index value (only for input direction)
189 * @mask: bit mask to set
190 * @val: the bits value to set
191 *
192 * Update the stereo AMP value with a bit mask.
193 * The lower byte is left, the upper byte is right.
194 * Returns 0 if the value is unchanged, 1 if changed, or a negative error.
195 */
196static inline int
197snd_hdac_regmap_update_amp_stereo(struct hdac_device *codec, hda_nid_t nid,
198 int dir, int idx, int mask, int val)
199{
200 unsigned int cmd = snd_hdac_regmap_encode_amp_stereo(nid, dir, idx);
201
202 return snd_hdac_regmap_update_raw(codec, cmd, mask, val);
203}
204
205/**
206 * snd_hdac_regmap_sync_node - sync the widget node attributes
207 * @codec: HD-audio codec
208 * @nid: NID to sync
209 */
210static inline void
211snd_hdac_regmap_sync_node(struct hdac_device *codec, hda_nid_t nid)
212{
213 regcache_mark_dirty(codec->regmap);
214 regcache_sync_region(codec->regmap, nid << 20, ((nid + 1) << 20) - 1);
215}
216
217#endif /* __SOUND_HDA_REGMAP_H */
diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
new file mode 100644
index 000000000000..2a8aa9dfb83d
--- /dev/null
+++ b/include/sound/hdaudio.h
@@ -0,0 +1,247 @@
1/*
2 * HD-audio core stuff
3 */
4
5#ifndef __SOUND_HDAUDIO_H
6#define __SOUND_HDAUDIO_H
7
8#include <linux/device.h>
9#include <sound/hda_verbs.h>
10
11/* codec node id */
12typedef u16 hda_nid_t;
13
14struct hdac_bus;
15struct hdac_device;
16struct hdac_driver;
17struct hdac_widget_tree;
18
19/*
20 * exported bus type
21 */
22extern struct bus_type snd_hda_bus_type;
23
24/*
25 * generic arrays
26 */
27struct snd_array {
28 unsigned int used;
29 unsigned int alloced;
30 unsigned int elem_size;
31 unsigned int alloc_align;
32 void *list;
33};
34
35/*
36 * HD-audio codec base device
37 */
38struct hdac_device {
39 struct device dev;
40 int type;
41 struct hdac_bus *bus;
42 unsigned int addr; /* codec address */
43 struct list_head list; /* list point for bus codec_list */
44
45 hda_nid_t afg; /* AFG node id */
46 hda_nid_t mfg; /* MFG node id */
47
48 /* ids */
49 unsigned int vendor_id;
50 unsigned int subsystem_id;
51 unsigned int revision_id;
52 unsigned int afg_function_id;
53 unsigned int mfg_function_id;
54 unsigned int afg_unsol:1;
55 unsigned int mfg_unsol:1;
56
57 unsigned int power_caps; /* FG power caps */
58
59 const char *vendor_name; /* codec vendor name */
60 const char *chip_name; /* codec chip name */
61
62 /* verb exec op override */
63 int (*exec_verb)(struct hdac_device *dev, unsigned int cmd,
64 unsigned int flags, unsigned int *res);
65
66 /* widgets */
67 unsigned int num_nodes;
68 hda_nid_t start_nid, end_nid;
69
70 /* misc flags */
71 atomic_t in_pm; /* suspend/resume being performed */
72
73 /* sysfs */
74 struct hdac_widget_tree *widgets;
75
76 /* regmap */
77 struct regmap *regmap;
78 struct snd_array vendor_verbs;
79 bool lazy_cache:1; /* don't wake up for writes */
80 bool caps_overwriting:1; /* caps overwrite being in process */
81 bool cache_coef:1; /* cache COEF read/write too */
82};
83
84/* device/driver type used for matching */
85enum {
86 HDA_DEV_CORE,
87 HDA_DEV_LEGACY,
88};
89
90/* direction */
91enum {
92 HDA_INPUT, HDA_OUTPUT
93};
94
95#define dev_to_hdac_dev(_dev) container_of(_dev, struct hdac_device, dev)
96
97int snd_hdac_device_init(struct hdac_device *dev, struct hdac_bus *bus,
98 const char *name, unsigned int addr);
99void snd_hdac_device_exit(struct hdac_device *dev);
100int snd_hdac_device_register(struct hdac_device *codec);
101void snd_hdac_device_unregister(struct hdac_device *codec);
102
103int snd_hdac_refresh_widgets(struct hdac_device *codec);
104
105unsigned int snd_hdac_make_cmd(struct hdac_device *codec, hda_nid_t nid,
106 unsigned int verb, unsigned int parm);
107int snd_hdac_exec_verb(struct hdac_device *codec, unsigned int cmd,
108 unsigned int flags, unsigned int *res);
109int snd_hdac_read(struct hdac_device *codec, hda_nid_t nid,
110 unsigned int verb, unsigned int parm, unsigned int *res);
111int _snd_hdac_read_parm(struct hdac_device *codec, hda_nid_t nid, int parm,
112 unsigned int *res);
113int snd_hdac_read_parm_uncached(struct hdac_device *codec, hda_nid_t nid,
114 int parm);
115int snd_hdac_override_parm(struct hdac_device *codec, hda_nid_t nid,
116 unsigned int parm, unsigned int val);
117int snd_hdac_get_connections(struct hdac_device *codec, hda_nid_t nid,
118 hda_nid_t *conn_list, int max_conns);
119int snd_hdac_get_sub_nodes(struct hdac_device *codec, hda_nid_t nid,
120 hda_nid_t *start_id);
121
122/**
123 * snd_hdac_read_parm - read a codec parameter
124 * @codec: the codec object
125 * @nid: NID to read a parameter
126 * @parm: parameter to read
127 *
128 * Returns -1 for error. If you need to distinguish the error more
129 * strictly, use _snd_hdac_read_parm() directly.
130 */
131static inline int snd_hdac_read_parm(struct hdac_device *codec, hda_nid_t nid,
132 int parm)
133{
134 unsigned int val;
135
136 return _snd_hdac_read_parm(codec, nid, parm, &val) < 0 ? -1 : val;
137}
138
139#ifdef CONFIG_PM
140void snd_hdac_power_up(struct hdac_device *codec);
141void snd_hdac_power_down(struct hdac_device *codec);
142void snd_hdac_power_up_pm(struct hdac_device *codec);
143void snd_hdac_power_down_pm(struct hdac_device *codec);
144#else
145static inline void snd_hdac_power_up(struct hdac_device *codec) {}
146static inline void snd_hdac_power_down(struct hdac_device *codec) {}
147static inline void snd_hdac_power_up_pm(struct hdac_device *codec) {}
148static inline void snd_hdac_power_down_pm(struct hdac_device *codec) {}
149#endif
150
151/*
152 * HD-audio codec base driver
153 */
154struct hdac_driver {
155 struct device_driver driver;
156 int type;
157 int (*match)(struct hdac_device *dev, struct hdac_driver *drv);
158 void (*unsol_event)(struct hdac_device *dev, unsigned int event);
159};
160
161#define drv_to_hdac_driver(_drv) container_of(_drv, struct hdac_driver, driver)
162
163/*
164 * HD-audio bus base driver
165 */
166struct hdac_bus_ops {
167 /* send a single command */
168 int (*command)(struct hdac_bus *bus, unsigned int cmd);
169 /* get a response from the last command */
170 int (*get_response)(struct hdac_bus *bus, unsigned int addr,
171 unsigned int *res);
172};
173
174#define HDA_UNSOL_QUEUE_SIZE 64
175
176struct hdac_bus {
177 struct device *dev;
178 const struct hdac_bus_ops *ops;
179
180 /* codec linked list */
181 struct list_head codec_list;
182 unsigned int num_codecs;
183
184 /* link caddr -> codec */
185 struct hdac_device *caddr_tbl[HDA_MAX_CODEC_ADDRESS + 1];
186
187 /* unsolicited event queue */
188 u32 unsol_queue[HDA_UNSOL_QUEUE_SIZE * 2]; /* ring buffer */
189 unsigned int unsol_rp, unsol_wp;
190 struct work_struct unsol_work;
191
192 /* bit flags of powered codecs */
193 unsigned long codec_powered;
194
195 /* flags */
196 bool sync_write:1; /* sync after verb write */
197
198 /* locks */
199 struct mutex cmd_mutex;
200};
201
202int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
203 const struct hdac_bus_ops *ops);
204void snd_hdac_bus_exit(struct hdac_bus *bus);
205int snd_hdac_bus_exec_verb(struct hdac_bus *bus, unsigned int addr,
206 unsigned int cmd, unsigned int *res);
207int snd_hdac_bus_exec_verb_unlocked(struct hdac_bus *bus, unsigned int addr,
208 unsigned int cmd, unsigned int *res);
209void snd_hdac_bus_queue_event(struct hdac_bus *bus, u32 res, u32 res_ex);
210
211int snd_hdac_bus_add_device(struct hdac_bus *bus, struct hdac_device *codec);
212void snd_hdac_bus_remove_device(struct hdac_bus *bus,
213 struct hdac_device *codec);
214
215static inline void snd_hdac_codec_link_up(struct hdac_device *codec)
216{
217 set_bit(codec->addr, &codec->bus->codec_powered);
218}
219
220static inline void snd_hdac_codec_link_down(struct hdac_device *codec)
221{
222 clear_bit(codec->addr, &codec->bus->codec_powered);
223}
224
225/*
226 * generic array helpers
227 */
228void *snd_array_new(struct snd_array *array);
229void snd_array_free(struct snd_array *array);
230static inline void snd_array_init(struct snd_array *array, unsigned int size,
231 unsigned int align)
232{
233 array->elem_size = size;
234 array->alloc_align = align;
235}
236
237static inline void *snd_array_elem(struct snd_array *array, unsigned int idx)
238{
239 return array->list + idx * array->elem_size;
240}
241
242static inline unsigned int snd_array_index(struct snd_array *array, void *ptr)
243{
244 return (unsigned long)(ptr - array->list) / array->elem_size;
245}
246
247#endif /* __SOUND_HDAUDIO_H */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index c0ddb7e69c28..0cb7f3f5df7b 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -60,6 +60,9 @@ struct snd_pcm_hardware {
60 60
61struct snd_pcm_substream; 61struct snd_pcm_substream;
62 62
63struct snd_pcm_audio_tstamp_config; /* definitions further down */
64struct snd_pcm_audio_tstamp_report;
65
63struct snd_pcm_ops { 66struct snd_pcm_ops {
64 int (*open)(struct snd_pcm_substream *substream); 67 int (*open)(struct snd_pcm_substream *substream);
65 int (*close)(struct snd_pcm_substream *substream); 68 int (*close)(struct snd_pcm_substream *substream);
@@ -71,8 +74,10 @@ struct snd_pcm_ops {
71 int (*prepare)(struct snd_pcm_substream *substream); 74 int (*prepare)(struct snd_pcm_substream *substream);
72 int (*trigger)(struct snd_pcm_substream *substream, int cmd); 75 int (*trigger)(struct snd_pcm_substream *substream, int cmd);
73 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream); 76 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream);
74 int (*wall_clock)(struct snd_pcm_substream *substream, 77 int (*get_time_info)(struct snd_pcm_substream *substream,
75 struct timespec *audio_ts); 78 struct timespec *system_ts, struct timespec *audio_ts,
79 struct snd_pcm_audio_tstamp_config *audio_tstamp_config,
80 struct snd_pcm_audio_tstamp_report *audio_tstamp_report);
76 int (*copy)(struct snd_pcm_substream *substream, int channel, 81 int (*copy)(struct snd_pcm_substream *substream, int channel,
77 snd_pcm_uframes_t pos, 82 snd_pcm_uframes_t pos,
78 void __user *buf, snd_pcm_uframes_t count); 83 void __user *buf, snd_pcm_uframes_t count);
@@ -281,6 +286,58 @@ struct snd_pcm_hw_constraint_ranges {
281 286
282struct snd_pcm_hwptr_log; 287struct snd_pcm_hwptr_log;
283 288
289/*
290 * userspace-provided audio timestamp config to kernel,
291 * structure is for internal use only and filled with dedicated unpack routine
292 */
293struct snd_pcm_audio_tstamp_config {
294 /* 5 of max 16 bits used */
295 u32 type_requested:4;
296 u32 report_delay:1; /* add total delay to A/D or D/A */
297};
298
299static inline void snd_pcm_unpack_audio_tstamp_config(__u32 data,
300 struct snd_pcm_audio_tstamp_config *config)
301{
302 config->type_requested = data & 0xF;
303 config->report_delay = (data >> 4) & 1;
304}
305
306/*
307 * kernel-provided audio timestamp report to user-space
308 * structure is for internal use only and read by dedicated pack routine
309 */
310struct snd_pcm_audio_tstamp_report {
311 /* 6 of max 16 bits used for bit-fields */
312
313 /* for backwards compatibility */
314 u32 valid:1;
315
316 /* actual type if hardware could not support requested timestamp */
317 u32 actual_type:4;
318
319 /* accuracy represented in ns units */
320 u32 accuracy_report:1; /* 0 if accuracy unknown, 1 if accuracy field is valid */
321 u32 accuracy; /* up to 4.29s, will be packed in separate field */
322};
323
324static inline void snd_pcm_pack_audio_tstamp_report(__u32 *data, __u32 *accuracy,
325 const struct snd_pcm_audio_tstamp_report *report)
326{
327 u32 tmp;
328
329 tmp = report->accuracy_report;
330 tmp <<= 4;
331 tmp |= report->actual_type;
332 tmp <<= 1;
333 tmp |= report->valid;
334
335 *data &= 0xffff; /* zero-clear MSBs */
336 *data |= (tmp << 16);
337 *accuracy = report->accuracy;
338}
339
340
284struct snd_pcm_runtime { 341struct snd_pcm_runtime {
285 /* -- Status -- */ 342 /* -- Status -- */
286 struct snd_pcm_substream *trigger_master; 343 struct snd_pcm_substream *trigger_master;
@@ -361,6 +418,11 @@ struct snd_pcm_runtime {
361 418
362 struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */ 419 struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */
363 420
421 /* -- audio timestamp config -- */
422 struct snd_pcm_audio_tstamp_config audio_tstamp_config;
423 struct snd_pcm_audio_tstamp_report audio_tstamp_report;
424 struct timespec driver_tstamp;
425
364#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 426#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
365 /* -- OSS things -- */ 427 /* -- OSS things -- */
366 struct snd_pcm_oss_runtime oss; 428 struct snd_pcm_oss_runtime oss;
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
index 3c45f3924ba7..c704357775fc 100644
--- a/include/sound/pcm_params.h
+++ b/include/sound/pcm_params.h
@@ -366,4 +366,11 @@ static inline int params_physical_width(const struct snd_pcm_hw_params *p)
366 return snd_pcm_format_physical_width(params_format(p)); 366 return snd_pcm_format_physical_width(params_format(p));
367} 367}
368 368
369static inline void
370params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt)
371{
372 snd_mask_set(hw_param_mask(p, SNDRV_PCM_HW_PARAM_FORMAT),
373 (__force int)fmt);
374}
375
369#endif /* __SOUND_PCM_PARAMS_H */ 376#endif /* __SOUND_PCM_PARAMS_H */
diff --git a/include/sound/rt5670.h b/include/sound/rt5670.h
index bd311197a3b5..b7d60510819b 100644
--- a/include/sound/rt5670.h
+++ b/include/sound/rt5670.h
@@ -14,6 +14,7 @@
14struct rt5670_platform_data { 14struct rt5670_platform_data {
15 int jd_mode; 15 int jd_mode;
16 bool in2_diff; 16 bool in2_diff;
17 bool dev_gpio;
17 18
18 bool dmic_en; 19 bool dmic_en;
19 unsigned int dmic1_data_pin; 20 unsigned int dmic1_data_pin;
diff --git a/include/sound/seq_device.h b/include/sound/seq_device.h
index 2b5f24cc7548..ddc0d504cf39 100644
--- a/include/sound/seq_device.h
+++ b/include/sound/seq_device.h
@@ -25,29 +25,26 @@
25 * registered device information 25 * registered device information
26 */ 26 */
27 27
28#define ID_LEN 32
29
30/* status flag */
31#define SNDRV_SEQ_DEVICE_FREE 0
32#define SNDRV_SEQ_DEVICE_REGISTERED 1
33
34struct snd_seq_device { 28struct snd_seq_device {
35 /* device info */ 29 /* device info */
36 struct snd_card *card; /* sound card */ 30 struct snd_card *card; /* sound card */
37 int device; /* device number */ 31 int device; /* device number */
38 char id[ID_LEN]; /* driver id */ 32 const char *id; /* driver id */
39 char name[80]; /* device name */ 33 char name[80]; /* device name */
40 int argsize; /* size of the argument */ 34 int argsize; /* size of the argument */
41 void *driver_data; /* private data for driver */ 35 void *driver_data; /* private data for driver */
42 int status; /* flag - read only */
43 void *private_data; /* private data for the caller */ 36 void *private_data; /* private data for the caller */
44 void (*private_free)(struct snd_seq_device *device); 37 void (*private_free)(struct snd_seq_device *device);
45 struct list_head list; /* link to next device */ 38 struct device dev;
46}; 39};
47 40
41#define to_seq_dev(_dev) \
42 container_of(_dev, struct snd_seq_device, dev)
43
44/* sequencer driver */
48 45
49/* driver operators 46/* driver operators
50 * init_device: 47 * probe:
51 * Initialize the device with given parameters. 48 * Initialize the device with given parameters.
52 * Typically, 49 * Typically,
53 * 1. call snd_hwdep_new 50 * 1. call snd_hwdep_new
@@ -55,25 +52,40 @@ struct snd_seq_device {
55 * 3. call snd_hwdep_register 52 * 3. call snd_hwdep_register
56 * 4. store the instance to dev->driver_data pointer. 53 * 4. store the instance to dev->driver_data pointer.
57 * 54 *
58 * free_device: 55 * remove:
59 * Release the private data. 56 * Release the private data.
60 * Typically, call snd_device_free(dev->card, dev->driver_data) 57 * Typically, call snd_device_free(dev->card, dev->driver_data)
61 */ 58 */
62struct snd_seq_dev_ops { 59struct snd_seq_driver {
63 int (*init_device)(struct snd_seq_device *dev); 60 struct device_driver driver;
64 int (*free_device)(struct snd_seq_device *dev); 61 char *id;
62 int argsize;
65}; 63};
66 64
65#define to_seq_drv(_drv) \
66 container_of(_drv, struct snd_seq_driver, driver)
67
67/* 68/*
68 * prototypes 69 * prototypes
69 */ 70 */
71#ifdef CONFIG_MODULES
70void snd_seq_device_load_drivers(void); 72void snd_seq_device_load_drivers(void);
71int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result); 73#else
72int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize); 74#define snd_seq_device_load_drivers()
73int snd_seq_device_unregister_driver(char *id); 75#endif
76int snd_seq_device_new(struct snd_card *card, int device, const char *id,
77 int argsize, struct snd_seq_device **result);
74 78
75#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device)) 79#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device))
76 80
81int __must_check __snd_seq_driver_register(struct snd_seq_driver *drv,
82 struct module *mod);
83#define snd_seq_driver_register(drv) \
84 __snd_seq_driver_register(drv, THIS_MODULE)
85void snd_seq_driver_unregister(struct snd_seq_driver *drv);
86
87#define module_snd_seq_driver(drv) \
88 module_driver(drv, snd_seq_driver_register, snd_seq_driver_unregister)
77 89
78/* 90/*
79 * id strings for generic devices 91 * id strings for generic devices
diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h
index 18a2ac58b88f..feb58d455560 100644
--- a/include/sound/seq_kernel.h
+++ b/include/sound/seq_kernel.h
@@ -99,13 +99,9 @@ int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,
99int snd_seq_event_port_detach(int client, int port); 99int snd_seq_event_port_detach(int client, int port);
100 100
101#ifdef CONFIG_MODULES 101#ifdef CONFIG_MODULES
102void snd_seq_autoload_lock(void);
103void snd_seq_autoload_unlock(void);
104void snd_seq_autoload_init(void); 102void snd_seq_autoload_init(void);
105#define snd_seq_autoload_exit() snd_seq_autoload_lock() 103void snd_seq_autoload_exit(void);
106#else 104#else
107#define snd_seq_autoload_lock()
108#define snd_seq_autoload_unlock()
109#define snd_seq_autoload_init() 105#define snd_seq_autoload_init()
110#define snd_seq_autoload_exit() 106#define snd_seq_autoload_exit()
111#endif 107#endif
diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index 1255ddb1d3e2..b9b4f289fe6b 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -16,7 +16,6 @@
16 16
17struct asoc_simple_dai { 17struct asoc_simple_dai {
18 const char *name; 18 const char *name;
19 unsigned int fmt;
20 unsigned int sysclk; 19 unsigned int sysclk;
21 int slots; 20 int slots;
22 int slot_width; 21 int slot_width;
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 8d7416e46861..1065095c6973 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -287,7 +287,7 @@ struct device;
287 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 287 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
288 .tlv.p = (tlv_array), \ 288 .tlv.p = (tlv_array), \
289 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 289 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
290 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) } 290 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) }
291#define SOC_DAPM_SINGLE_TLV_VIRT(xname, max, tlv_array) \ 291#define SOC_DAPM_SINGLE_TLV_VIRT(xname, max, tlv_array) \
292 SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0, tlv_array) 292 SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0, tlv_array)
293#define SOC_DAPM_ENUM(xname, xenum) \ 293#define SOC_DAPM_ENUM(xname, xenum) \
@@ -378,6 +378,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card);
378void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card); 378void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card);
379int snd_soc_dapm_new_pcm(struct snd_soc_card *card, 379int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
380 const struct snd_soc_pcm_stream *params, 380 const struct snd_soc_pcm_stream *params,
381 unsigned int num_params,
381 struct snd_soc_dapm_widget *source, 382 struct snd_soc_dapm_widget *source,
382 struct snd_soc_dapm_widget *sink); 383 struct snd_soc_dapm_widget *sink);
383 384
@@ -440,7 +441,6 @@ void dapm_mark_endpoints_dirty(struct snd_soc_card *card);
440int 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,
441 struct snd_soc_dapm_widget_list **list); 442 struct snd_soc_dapm_widget_list **list);
442 443
443struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(struct snd_kcontrol *kcontrol);
444struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm( 444struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm(
445 struct snd_kcontrol *kcontrol); 445 struct snd_kcontrol *kcontrol);
446 446
@@ -531,6 +531,8 @@ struct snd_soc_dapm_widget {
531 void *priv; /* widget specific data */ 531 void *priv; /* widget specific data */
532 struct regulator *regulator; /* attached regulator */ 532 struct regulator *regulator; /* attached regulator */
533 const struct snd_soc_pcm_stream *params; /* params for dai links */ 533 const struct snd_soc_pcm_stream *params; /* params for dai links */
534 unsigned int num_params; /* number of params for dai links */
535 unsigned int params_select; /* currently selected param for dai link */
534 536
535 /* dapm control */ 537 /* dapm control */
536 int reg; /* negative reg = no direct dapm */ 538 int reg; /* negative reg = no direct dapm */
@@ -586,8 +588,6 @@ struct snd_soc_dapm_update {
586/* DAPM context */ 588/* DAPM context */
587struct snd_soc_dapm_context { 589struct snd_soc_dapm_context {
588 enum snd_soc_bias_level bias_level; 590 enum snd_soc_bias_level bias_level;
589 enum snd_soc_bias_level suspend_bias_level;
590 struct delayed_work delayed_work;
591 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */ 591 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
592 /* Go to BIAS_OFF in suspend if the DAPM context is idle */ 592 /* Go to BIAS_OFF in suspend if the DAPM context is idle */
593 unsigned int suspend_bias_off:1; 593 unsigned int suspend_bias_off:1;
diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h
index 98f2ade0266e..806059052bfc 100644
--- a/include/sound/soc-dpcm.h
+++ b/include/sound/soc-dpcm.h
@@ -135,7 +135,7 @@ void snd_soc_dpcm_be_set_state(struct snd_soc_pcm_runtime *be, int stream,
135 135
136/* internal use only */ 136/* internal use only */
137int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute); 137int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute);
138int soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd); 138void soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd);
139int soc_dpcm_runtime_update(struct snd_soc_card *); 139int soc_dpcm_runtime_update(struct snd_soc_card *);
140 140
141int dpcm_path_get(struct snd_soc_pcm_runtime *fe, 141int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
diff --git a/include/sound/soc.h b/include/sound/soc.h
index cd8a12508f16..f6226914acfe 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -462,8 +462,10 @@ int soc_dai_hw_params(struct snd_pcm_substream *substream,
462 struct snd_soc_dai *dai); 462 struct snd_soc_dai *dai);
463 463
464/* Jack reporting */ 464/* Jack reporting */
465int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type, 465int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
466 struct snd_soc_jack *jack); 466 struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins,
467 unsigned int num_pins);
468
467void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask); 469void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
468int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, 470int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
469 struct snd_soc_jack_pin *pins); 471 struct snd_soc_jack_pin *pins);
@@ -671,7 +673,7 @@ struct snd_soc_jack_gpio {
671struct snd_soc_jack { 673struct snd_soc_jack {
672 struct mutex mutex; 674 struct mutex mutex;
673 struct snd_jack *jack; 675 struct snd_jack *jack;
674 struct snd_soc_codec *codec; 676 struct snd_soc_card *card;
675 struct list_head pins; 677 struct list_head pins;
676 int status; 678 int status;
677 struct blocking_notifier_head notifier; 679 struct blocking_notifier_head notifier;
@@ -953,6 +955,7 @@ struct snd_soc_dai_link {
953 int be_id; /* optional ID for machine driver BE identification */ 955 int be_id; /* optional ID for machine driver BE identification */
954 956
955 const struct snd_soc_pcm_stream *params; 957 const struct snd_soc_pcm_stream *params;
958 unsigned int num_params;
956 959
957 unsigned int dai_fmt; /* format to set on init */ 960 unsigned int dai_fmt; /* format to set on init */
958 961
@@ -966,6 +969,9 @@ struct snd_soc_dai_link {
966 unsigned int symmetric_channels:1; 969 unsigned int symmetric_channels:1;
967 unsigned int symmetric_samplebits:1; 970 unsigned int symmetric_samplebits:1;
968 971
972 /* Mark this pcm with non atomic ops */
973 bool nonatomic;
974
969 /* Do not create a PCM for this DAI link (Backend link) */ 975 /* Do not create a PCM for this DAI link (Backend link) */
970 unsigned int no_pcm:1; 976 unsigned int no_pcm:1;
971 977
@@ -1083,11 +1089,16 @@ struct snd_soc_card {
1083 1089
1084 /* 1090 /*
1085 * Card-specific routes and widgets. 1091 * Card-specific routes and widgets.
1092 * Note: of_dapm_xxx for Device Tree; Otherwise for driver build-in.
1086 */ 1093 */
1087 const struct snd_soc_dapm_widget *dapm_widgets; 1094 const struct snd_soc_dapm_widget *dapm_widgets;
1088 int num_dapm_widgets; 1095 int num_dapm_widgets;
1089 const struct snd_soc_dapm_route *dapm_routes; 1096 const struct snd_soc_dapm_route *dapm_routes;
1090 int num_dapm_routes; 1097 int num_dapm_routes;
1098 const struct snd_soc_dapm_widget *of_dapm_widgets;
1099 int num_of_dapm_widgets;
1100 const struct snd_soc_dapm_route *of_dapm_routes;
1101 int num_of_dapm_routes;
1091 bool fully_routed; 1102 bool fully_routed;
1092 1103
1093 struct work_struct deferred_resume_work; 1104 struct work_struct deferred_resume_work;
@@ -1270,6 +1281,19 @@ static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
1270 return component->dapm_ptr; 1281 return component->dapm_ptr;
1271} 1282}
1272 1283
1284/**
1285 * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol
1286 * @kcontrol: The kcontrol
1287 *
1288 * This function must only be used on DAPM contexts that are known to be part of
1289 * a CODEC (e.g. in a CODEC driver). Otherwise the behavior is undefined.
1290 */
1291static inline struct snd_soc_codec *snd_soc_dapm_kcontrol_codec(
1292 struct snd_kcontrol *kcontrol)
1293{
1294 return snd_soc_dapm_to_codec(snd_soc_dapm_kcontrol_dapm(kcontrol));
1295}
1296
1273/* codec IO */ 1297/* codec IO */
1274unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); 1298unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
1275int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg, 1299int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
@@ -1481,7 +1505,7 @@ static inline struct snd_soc_codec *snd_soc_kcontrol_codec(
1481} 1505}
1482 1506
1483/** 1507/**
1484 * snd_soc_kcontrol_platform() - Returns the platform that registerd the control 1508 * snd_soc_kcontrol_platform() - Returns the platform that registered the control
1485 * @kcontrol: The control for which to get the platform 1509 * @kcontrol: The control for which to get the platform
1486 * 1510 *
1487 * Note: This function will only work correctly if the control has been 1511 * Note: This function will only work correctly if the control has been
diff --git a/include/sound/spear_dma.h b/include/sound/spear_dma.h
index 65aca51fe255..e290de4e7e82 100644
--- a/include/sound/spear_dma.h
+++ b/include/sound/spear_dma.h
@@ -1,7 +1,7 @@
1/* 1/*
2* linux/spear_dma.h 2* linux/spear_dma.h
3* 3*
4* Copyright (ST) 2012 Rajeev Kumar (rajeev-dlh.kumar@st.com) 4* Copyright (ST) 2012 Rajeev Kumar (rajeevkumar.linux@gmail.com)
5* 5*
6* This program is free software; you can redistribute it and/or modify 6* This program is free software; you can redistribute it and/or modify
7* it under the terms of the GNU General Public License as published by 7* it under the terms of the GNU General Public License as published by
diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h
index d3583d3ee193..54e7af301888 100644
--- a/include/target/iscsi/iscsi_target_core.h
+++ b/include/target/iscsi/iscsi_target_core.h
@@ -20,6 +20,8 @@
20#define ISCSIT_MIN_TAGS 16 20#define ISCSIT_MIN_TAGS 16
21#define ISCSIT_EXTRA_TAGS 8 21#define ISCSIT_EXTRA_TAGS 8
22#define ISCSIT_TCP_BACKLOG 256 22#define ISCSIT_TCP_BACKLOG 256
23#define ISCSI_RX_THREAD_NAME "iscsi_trx"
24#define ISCSI_TX_THREAD_NAME "iscsi_ttx"
23 25
24/* struct iscsi_node_attrib sanity values */ 26/* struct iscsi_node_attrib sanity values */
25#define NA_DATAOUT_TIMEOUT 3 27#define NA_DATAOUT_TIMEOUT 3
@@ -60,6 +62,7 @@
60#define TA_CACHE_CORE_NPS 0 62#define TA_CACHE_CORE_NPS 0
61/* T10 protection information disabled by default */ 63/* T10 protection information disabled by default */
62#define TA_DEFAULT_T10_PI 0 64#define TA_DEFAULT_T10_PI 0
65#define TA_DEFAULT_FABRIC_PROT_TYPE 0
63 66
64#define ISCSI_IOV_DATA_BUFFER 5 67#define ISCSI_IOV_DATA_BUFFER 5
65 68
@@ -600,8 +603,11 @@ struct iscsi_conn {
600 struct iscsi_tpg_np *tpg_np; 603 struct iscsi_tpg_np *tpg_np;
601 /* Pointer to parent session */ 604 /* Pointer to parent session */
602 struct iscsi_session *sess; 605 struct iscsi_session *sess;
603 /* Pointer to thread_set in use for this conn's threads */ 606 int bitmap_id;
604 struct iscsi_thread_set *thread_set; 607 int rx_thread_active;
608 struct task_struct *rx_thread;
609 int tx_thread_active;
610 struct task_struct *tx_thread;
605 /* list_head for session connection list */ 611 /* list_head for session connection list */
606 struct list_head conn_list; 612 struct list_head conn_list;
607} ____cacheline_aligned; 613} ____cacheline_aligned;
@@ -767,6 +773,7 @@ struct iscsi_tpg_attrib {
767 u32 demo_mode_discovery; 773 u32 demo_mode_discovery;
768 u32 default_erl; 774 u32 default_erl;
769 u8 t10_pi; 775 u8 t10_pi;
776 u32 fabric_prot_type;
770 struct iscsi_portal_group *tpg; 777 struct iscsi_portal_group *tpg;
771}; 778};
772 779
@@ -871,10 +878,10 @@ struct iscsit_global {
871 /* Unique identifier used for the authentication daemon */ 878 /* Unique identifier used for the authentication daemon */
872 u32 auth_id; 879 u32 auth_id;
873 u32 inactive_ts; 880 u32 inactive_ts;
874 /* Thread Set bitmap count */ 881#define ISCSIT_BITMAP_BITS 262144
875 int ts_bitmap_count;
876 /* Thread Set bitmap pointer */ 882 /* Thread Set bitmap pointer */
877 unsigned long *ts_bitmap; 883 unsigned long *ts_bitmap;
884 spinlock_t ts_bitmap_lock;
878 /* Used for iSCSI discovery session authentication */ 885 /* Used for iSCSI discovery session authentication */
879 struct iscsi_node_acl discovery_acl; 886 struct iscsi_node_acl discovery_acl;
880 struct iscsi_portal_group *discovery_tpg; 887 struct iscsi_portal_group *discovery_tpg;
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index db81c65b8f48..d61be7297b2c 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -111,6 +111,7 @@ void array_free(void *array, int n);
111void target_core_setup_sub_cits(struct se_subsystem_api *); 111void target_core_setup_sub_cits(struct se_subsystem_api *);
112 112
113/* attribute helpers from target_core_device.c for backend drivers */ 113/* attribute helpers from target_core_device.c for backend drivers */
114bool se_dev_check_wce(struct se_device *);
114int se_dev_set_max_unmap_lba_count(struct se_device *, u32); 115int se_dev_set_max_unmap_lba_count(struct se_device *, u32);
115int se_dev_set_max_unmap_block_desc_count(struct se_device *, u32); 116int se_dev_set_max_unmap_block_desc_count(struct se_device *, u32);
116int se_dev_set_unmap_granularity(struct se_device *, u32); 117int se_dev_set_unmap_granularity(struct se_device *, u32);
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 672150b6aaf5..480e9f82dfea 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -165,10 +165,8 @@ enum se_cmd_flags_table {
165 SCF_SEND_DELAYED_TAS = 0x00004000, 165 SCF_SEND_DELAYED_TAS = 0x00004000,
166 SCF_ALUA_NON_OPTIMIZED = 0x00008000, 166 SCF_ALUA_NON_OPTIMIZED = 0x00008000,
167 SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000, 167 SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000,
168 SCF_ACK_KREF = 0x00040000,
169 SCF_COMPARE_AND_WRITE = 0x00080000, 168 SCF_COMPARE_AND_WRITE = 0x00080000,
170 SCF_COMPARE_AND_WRITE_POST = 0x00100000, 169 SCF_COMPARE_AND_WRITE_POST = 0x00100000,
171 SCF_CMD_XCOPY_PASSTHROUGH = 0x00200000,
172}; 170};
173 171
174/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ 172/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */
@@ -520,11 +518,11 @@ struct se_cmd {
520 struct list_head se_cmd_list; 518 struct list_head se_cmd_list;
521 struct completion cmd_wait_comp; 519 struct completion cmd_wait_comp;
522 struct kref cmd_kref; 520 struct kref cmd_kref;
523 struct target_core_fabric_ops *se_tfo; 521 const struct target_core_fabric_ops *se_tfo;
524 sense_reason_t (*execute_cmd)(struct se_cmd *); 522 sense_reason_t (*execute_cmd)(struct se_cmd *);
525 sense_reason_t (*execute_rw)(struct se_cmd *, struct scatterlist *, 523 sense_reason_t (*execute_rw)(struct se_cmd *, struct scatterlist *,
526 u32, enum dma_data_direction); 524 u32, enum dma_data_direction);
527 sense_reason_t (*transport_complete_callback)(struct se_cmd *); 525 sense_reason_t (*transport_complete_callback)(struct se_cmd *, bool);
528 526
529 unsigned char *t_task_cdb; 527 unsigned char *t_task_cdb;
530 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; 528 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
@@ -591,6 +589,7 @@ struct se_node_acl {
591 bool acl_stop:1; 589 bool acl_stop:1;
592 u32 queue_depth; 590 u32 queue_depth;
593 u32 acl_index; 591 u32 acl_index;
592 enum target_prot_type saved_prot_type;
594#define MAX_ACL_TAG_SIZE 64 593#define MAX_ACL_TAG_SIZE 64
595 char acl_tag[MAX_ACL_TAG_SIZE]; 594 char acl_tag[MAX_ACL_TAG_SIZE];
596 /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */ 595 /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */
@@ -616,6 +615,7 @@ struct se_session {
616 unsigned sess_tearing_down:1; 615 unsigned sess_tearing_down:1;
617 u64 sess_bin_isid; 616 u64 sess_bin_isid;
618 enum target_prot_op sup_prot_ops; 617 enum target_prot_op sup_prot_ops;
618 enum target_prot_type sess_prot_type;
619 struct se_node_acl *se_node_acl; 619 struct se_node_acl *se_node_acl;
620 struct se_portal_group *se_tpg; 620 struct se_portal_group *se_tpg;
621 void *fabric_sess_ptr; 621 void *fabric_sess_ptr;
@@ -890,7 +890,7 @@ struct se_portal_group {
890 /* List of TCM sessions associated wth this TPG */ 890 /* List of TCM sessions associated wth this TPG */
891 struct list_head tpg_sess_list; 891 struct list_head tpg_sess_list;
892 /* Pointer to $FABRIC_MOD dependent code */ 892 /* Pointer to $FABRIC_MOD dependent code */
893 struct target_core_fabric_ops *se_tpg_tfo; 893 const struct target_core_fabric_ops *se_tpg_tfo;
894 struct se_wwn *se_tpg_wwn; 894 struct se_wwn *se_tpg_wwn;
895 struct config_group tpg_group; 895 struct config_group tpg_group;
896 struct config_group *tpg_default_groups[7]; 896 struct config_group *tpg_default_groups[7];
diff --git a/include/target/target_core_configfs.h b/include/target/target_core_configfs.h
index e0801386e4dc..25bb04c4209e 100644
--- a/include/target/target_core_configfs.h
+++ b/include/target/target_core_configfs.h
@@ -5,12 +5,6 @@
5#define TARGET_CORE_NAME_MAX_LEN 64 5#define TARGET_CORE_NAME_MAX_LEN 64
6#define TARGET_FABRIC_NAME_SIZE 32 6#define TARGET_FABRIC_NAME_SIZE 32
7 7
8extern struct target_fabric_configfs *target_fabric_configfs_init(
9 struct module *, const char *);
10extern void target_fabric_configfs_free(struct target_fabric_configfs *);
11extern int target_fabric_configfs_register(struct target_fabric_configfs *);
12extern void target_fabric_configfs_deregister(struct target_fabric_configfs *);
13
14struct target_fabric_configfs_template { 8struct target_fabric_configfs_template {
15 struct config_item_type tfc_discovery_cit; 9 struct config_item_type tfc_discovery_cit;
16 struct config_item_type tfc_wwn_cit; 10 struct config_item_type tfc_wwn_cit;
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 22a4e98eec80..17c7f5ac7ea0 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -2,6 +2,8 @@
2#define TARGET_CORE_FABRIC_H 2#define TARGET_CORE_FABRIC_H
3 3
4struct target_core_fabric_ops { 4struct target_core_fabric_ops {
5 struct module *module;
6 const char *name;
5 struct configfs_subsystem *tf_subsys; 7 struct configfs_subsystem *tf_subsys;
6 char *(*get_fabric_name)(void); 8 char *(*get_fabric_name)(void);
7 u8 (*get_fabric_proto_ident)(struct se_portal_group *); 9 u8 (*get_fabric_proto_ident)(struct se_portal_group *);
@@ -27,6 +29,14 @@ struct target_core_fabric_ops {
27 * inquiry response 29 * inquiry response
28 */ 30 */
29 int (*tpg_check_demo_mode_login_only)(struct se_portal_group *); 31 int (*tpg_check_demo_mode_login_only)(struct se_portal_group *);
32 /*
33 * Optionally used as a configfs tunable to determine when
34 * target-core should signal the PROTECT=1 feature bit for
35 * backends that don't support T10-PI, so that either fabric
36 * HW offload or target-core emulation performs the associated
37 * WRITE_STRIP and READ_INSERT operations.
38 */
39 int (*tpg_check_prot_fabric_only)(struct se_portal_group *);
30 struct se_node_acl *(*tpg_alloc_fabric_acl)( 40 struct se_node_acl *(*tpg_alloc_fabric_acl)(
31 struct se_portal_group *); 41 struct se_portal_group *);
32 void (*tpg_release_fabric_acl)(struct se_portal_group *, 42 void (*tpg_release_fabric_acl)(struct se_portal_group *,
@@ -82,8 +92,23 @@ struct target_core_fabric_ops {
82 struct se_node_acl *(*fabric_make_nodeacl)(struct se_portal_group *, 92 struct se_node_acl *(*fabric_make_nodeacl)(struct se_portal_group *,
83 struct config_group *, const char *); 93 struct config_group *, const char *);
84 void (*fabric_drop_nodeacl)(struct se_node_acl *); 94 void (*fabric_drop_nodeacl)(struct se_node_acl *);
95
96 struct configfs_attribute **tfc_discovery_attrs;
97 struct configfs_attribute **tfc_wwn_attrs;
98 struct configfs_attribute **tfc_tpg_base_attrs;
99 struct configfs_attribute **tfc_tpg_np_base_attrs;
100 struct configfs_attribute **tfc_tpg_attrib_attrs;
101 struct configfs_attribute **tfc_tpg_auth_attrs;
102 struct configfs_attribute **tfc_tpg_param_attrs;
103 struct configfs_attribute **tfc_tpg_nacl_base_attrs;
104 struct configfs_attribute **tfc_tpg_nacl_attrib_attrs;
105 struct configfs_attribute **tfc_tpg_nacl_auth_attrs;
106 struct configfs_attribute **tfc_tpg_nacl_param_attrs;
85}; 107};
86 108
109int target_register_template(const struct target_core_fabric_ops *fo);
110void target_unregister_template(const struct target_core_fabric_ops *fo);
111
87struct se_session *transport_init_session(enum target_prot_op); 112struct se_session *transport_init_session(enum target_prot_op);
88int transport_alloc_session_tags(struct se_session *, unsigned int, 113int transport_alloc_session_tags(struct se_session *, unsigned int,
89 unsigned int); 114 unsigned int);
@@ -95,13 +120,15 @@ void transport_register_session(struct se_portal_group *,
95 struct se_node_acl *, struct se_session *, void *); 120 struct se_node_acl *, struct se_session *, void *);
96void target_get_session(struct se_session *); 121void target_get_session(struct se_session *);
97void target_put_session(struct se_session *); 122void target_put_session(struct se_session *);
123ssize_t target_show_dynamic_sessions(struct se_portal_group *, char *);
98void transport_free_session(struct se_session *); 124void transport_free_session(struct se_session *);
99void target_put_nacl(struct se_node_acl *); 125void target_put_nacl(struct se_node_acl *);
100void transport_deregister_session_configfs(struct se_session *); 126void transport_deregister_session_configfs(struct se_session *);
101void transport_deregister_session(struct se_session *); 127void transport_deregister_session(struct se_session *);
102 128
103 129
104void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *, 130void transport_init_se_cmd(struct se_cmd *,
131 const struct target_core_fabric_ops *,
105 struct se_session *, u32, int, int, unsigned char *); 132 struct se_session *, u32, int, int, unsigned char *);
106sense_reason_t transport_lookup_cmd_lun(struct se_cmd *, u32); 133sense_reason_t transport_lookup_cmd_lun(struct se_cmd *, u32);
107sense_reason_t target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *); 134sense_reason_t target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *);
@@ -153,8 +180,8 @@ int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *,
153 unsigned char *, u32, int); 180 unsigned char *, u32, int);
154int core_tpg_set_initiator_node_tag(struct se_portal_group *, 181int core_tpg_set_initiator_node_tag(struct se_portal_group *,
155 struct se_node_acl *, const char *); 182 struct se_node_acl *, const char *);
156int core_tpg_register(struct target_core_fabric_ops *, struct se_wwn *, 183int core_tpg_register(const struct target_core_fabric_ops *,
157 struct se_portal_group *, void *, int); 184 struct se_wwn *, struct se_portal_group *, void *, int);
158int core_tpg_deregister(struct se_portal_group *); 185int core_tpg_deregister(struct se_portal_group *);
159 186
160/* SAS helpers */ 187/* SAS helpers */
diff --git a/include/target/target_core_fabric_configfs.h b/include/target/target_core_fabric_configfs.h
index b32a14905cfa..7a0649c09e79 100644
--- a/include/target/target_core_fabric_configfs.h
+++ b/include/target/target_core_fabric_configfs.h
@@ -90,6 +90,11 @@ static struct target_fabric_tpg_attribute _fabric##_tpg_##_name = \
90 _fabric##_tpg_store_##_name); 90 _fabric##_tpg_store_##_name);
91 91
92 92
93#define TF_TPG_BASE_ATTR_RO(_fabric, _name) \
94static struct target_fabric_tpg_attribute _fabric##_tpg_##_name = \
95 __CONFIGFS_EATTR_RO(_name, \
96 _fabric##_tpg_show_##_name);
97
93CONFIGFS_EATTR_STRUCT(target_fabric_wwn, target_fabric_configfs); 98CONFIGFS_EATTR_STRUCT(target_fabric_wwn, target_fabric_configfs);
94#define TF_WWN_ATTR(_fabric, _name, _mode) \ 99#define TF_WWN_ATTR(_fabric, _name, _mode) \
95static struct target_fabric_wwn_attribute _fabric##_wwn_##_name = \ 100static struct target_fabric_wwn_attribute _fabric##_wwn_##_name = \
diff --git a/include/trace/events/9p.h b/include/trace/events/9p.h
index a0666362c111..633ee9ee9778 100644
--- a/include/trace/events/9p.h
+++ b/include/trace/events/9p.h
@@ -6,76 +6,95 @@
6 6
7#include <linux/tracepoint.h> 7#include <linux/tracepoint.h>
8 8
9#define P9_MSG_T \
10 EM( P9_TLERROR, "P9_TLERROR" ) \
11 EM( P9_RLERROR, "P9_RLERROR" ) \
12 EM( P9_TSTATFS, "P9_TSTATFS" ) \
13 EM( P9_RSTATFS, "P9_RSTATFS" ) \
14 EM( P9_TLOPEN, "P9_TLOPEN" ) \
15 EM( P9_RLOPEN, "P9_RLOPEN" ) \
16 EM( P9_TLCREATE, "P9_TLCREATE" ) \
17 EM( P9_RLCREATE, "P9_RLCREATE" ) \
18 EM( P9_TSYMLINK, "P9_TSYMLINK" ) \
19 EM( P9_RSYMLINK, "P9_RSYMLINK" ) \
20 EM( P9_TMKNOD, "P9_TMKNOD" ) \
21 EM( P9_RMKNOD, "P9_RMKNOD" ) \
22 EM( P9_TRENAME, "P9_TRENAME" ) \
23 EM( P9_RRENAME, "P9_RRENAME" ) \
24 EM( P9_TREADLINK, "P9_TREADLINK" ) \
25 EM( P9_RREADLINK, "P9_RREADLINK" ) \
26 EM( P9_TGETATTR, "P9_TGETATTR" ) \
27 EM( P9_RGETATTR, "P9_RGETATTR" ) \
28 EM( P9_TSETATTR, "P9_TSETATTR" ) \
29 EM( P9_RSETATTR, "P9_RSETATTR" ) \
30 EM( P9_TXATTRWALK, "P9_TXATTRWALK" ) \
31 EM( P9_RXATTRWALK, "P9_RXATTRWALK" ) \
32 EM( P9_TXATTRCREATE, "P9_TXATTRCREATE" ) \
33 EM( P9_RXATTRCREATE, "P9_RXATTRCREATE" ) \
34 EM( P9_TREADDIR, "P9_TREADDIR" ) \
35 EM( P9_RREADDIR, "P9_RREADDIR" ) \
36 EM( P9_TFSYNC, "P9_TFSYNC" ) \
37 EM( P9_RFSYNC, "P9_RFSYNC" ) \
38 EM( P9_TLOCK, "P9_TLOCK" ) \
39 EM( P9_RLOCK, "P9_RLOCK" ) \
40 EM( P9_TGETLOCK, "P9_TGETLOCK" ) \
41 EM( P9_RGETLOCK, "P9_RGETLOCK" ) \
42 EM( P9_TLINK, "P9_TLINK" ) \
43 EM( P9_RLINK, "P9_RLINK" ) \
44 EM( P9_TMKDIR, "P9_TMKDIR" ) \
45 EM( P9_RMKDIR, "P9_RMKDIR" ) \
46 EM( P9_TRENAMEAT, "P9_TRENAMEAT" ) \
47 EM( P9_RRENAMEAT, "P9_RRENAMEAT" ) \
48 EM( P9_TUNLINKAT, "P9_TUNLINKAT" ) \
49 EM( P9_RUNLINKAT, "P9_RUNLINKAT" ) \
50 EM( P9_TVERSION, "P9_TVERSION" ) \
51 EM( P9_RVERSION, "P9_RVERSION" ) \
52 EM( P9_TAUTH, "P9_TAUTH" ) \
53 EM( P9_RAUTH, "P9_RAUTH" ) \
54 EM( P9_TATTACH, "P9_TATTACH" ) \
55 EM( P9_RATTACH, "P9_RATTACH" ) \
56 EM( P9_TERROR, "P9_TERROR" ) \
57 EM( P9_RERROR, "P9_RERROR" ) \
58 EM( P9_TFLUSH, "P9_TFLUSH" ) \
59 EM( P9_RFLUSH, "P9_RFLUSH" ) \
60 EM( P9_TWALK, "P9_TWALK" ) \
61 EM( P9_RWALK, "P9_RWALK" ) \
62 EM( P9_TOPEN, "P9_TOPEN" ) \
63 EM( P9_ROPEN, "P9_ROPEN" ) \
64 EM( P9_TCREATE, "P9_TCREATE" ) \
65 EM( P9_RCREATE, "P9_RCREATE" ) \
66 EM( P9_TREAD, "P9_TREAD" ) \
67 EM( P9_RREAD, "P9_RREAD" ) \
68 EM( P9_TWRITE, "P9_TWRITE" ) \
69 EM( P9_RWRITE, "P9_RWRITE" ) \
70 EM( P9_TCLUNK, "P9_TCLUNK" ) \
71 EM( P9_RCLUNK, "P9_RCLUNK" ) \
72 EM( P9_TREMOVE, "P9_TREMOVE" ) \
73 EM( P9_RREMOVE, "P9_RREMOVE" ) \
74 EM( P9_TSTAT, "P9_TSTAT" ) \
75 EM( P9_RSTAT, "P9_RSTAT" ) \
76 EM( P9_TWSTAT, "P9_TWSTAT" ) \
77 EMe(P9_RWSTAT, "P9_RWSTAT" )
78
79/* Define EM() to export the enums to userspace via TRACE_DEFINE_ENUM() */
80#undef EM
81#undef EMe
82#define EM(a, b) TRACE_DEFINE_ENUM(a);
83#define EMe(a, b) TRACE_DEFINE_ENUM(a);
84
85P9_MSG_T
86
87/*
88 * Now redefine the EM() and EMe() macros to map the enums to the strings
89 * that will be printed in the output.
90 */
91#undef EM
92#undef EMe
93#define EM(a, b) { a, b },
94#define EMe(a, b) { a, b }
95
9#define show_9p_op(type) \ 96#define show_9p_op(type) \
10 __print_symbolic(type, \ 97 __print_symbolic(type, P9_MSG_T)
11 { P9_TLERROR, "P9_TLERROR" }, \
12 { P9_RLERROR, "P9_RLERROR" }, \
13 { P9_TSTATFS, "P9_TSTATFS" }, \
14 { P9_RSTATFS, "P9_RSTATFS" }, \
15 { P9_TLOPEN, "P9_TLOPEN" }, \
16 { P9_RLOPEN, "P9_RLOPEN" }, \
17 { P9_TLCREATE, "P9_TLCREATE" }, \
18 { P9_RLCREATE, "P9_RLCREATE" }, \
19 { P9_TSYMLINK, "P9_TSYMLINK" }, \
20 { P9_RSYMLINK, "P9_RSYMLINK" }, \
21 { P9_TMKNOD, "P9_TMKNOD" }, \
22 { P9_RMKNOD, "P9_RMKNOD" }, \
23 { P9_TRENAME, "P9_TRENAME" }, \
24 { P9_RRENAME, "P9_RRENAME" }, \
25 { P9_TREADLINK, "P9_TREADLINK" }, \
26 { P9_RREADLINK, "P9_RREADLINK" }, \
27 { P9_TGETATTR, "P9_TGETATTR" }, \
28 { P9_RGETATTR, "P9_RGETATTR" }, \
29 { P9_TSETATTR, "P9_TSETATTR" }, \
30 { P9_RSETATTR, "P9_RSETATTR" }, \
31 { P9_TXATTRWALK, "P9_TXATTRWALK" }, \
32 { P9_RXATTRWALK, "P9_RXATTRWALK" }, \
33 { P9_TXATTRCREATE, "P9_TXATTRCREATE" }, \
34 { P9_RXATTRCREATE, "P9_RXATTRCREATE" }, \
35 { P9_TREADDIR, "P9_TREADDIR" }, \
36 { P9_RREADDIR, "P9_RREADDIR" }, \
37 { P9_TFSYNC, "P9_TFSYNC" }, \
38 { P9_RFSYNC, "P9_RFSYNC" }, \
39 { P9_TLOCK, "P9_TLOCK" }, \
40 { P9_RLOCK, "P9_RLOCK" }, \
41 { P9_TGETLOCK, "P9_TGETLOCK" }, \
42 { P9_RGETLOCK, "P9_RGETLOCK" }, \
43 { P9_TLINK, "P9_TLINK" }, \
44 { P9_RLINK, "P9_RLINK" }, \
45 { P9_TMKDIR, "P9_TMKDIR" }, \
46 { P9_RMKDIR, "P9_RMKDIR" }, \
47 { P9_TRENAMEAT, "P9_TRENAMEAT" }, \
48 { P9_RRENAMEAT, "P9_RRENAMEAT" }, \
49 { P9_TUNLINKAT, "P9_TUNLINKAT" }, \
50 { P9_RUNLINKAT, "P9_RUNLINKAT" }, \
51 { P9_TVERSION, "P9_TVERSION" }, \
52 { P9_RVERSION, "P9_RVERSION" }, \
53 { P9_TAUTH, "P9_TAUTH" }, \
54 { P9_RAUTH, "P9_RAUTH" }, \
55 { P9_TATTACH, "P9_TATTACH" }, \
56 { P9_RATTACH, "P9_RATTACH" }, \
57 { P9_TERROR, "P9_TERROR" }, \
58 { P9_RERROR, "P9_RERROR" }, \
59 { P9_TFLUSH, "P9_TFLUSH" }, \
60 { P9_RFLUSH, "P9_RFLUSH" }, \
61 { P9_TWALK, "P9_TWALK" }, \
62 { P9_RWALK, "P9_RWALK" }, \
63 { P9_TOPEN, "P9_TOPEN" }, \
64 { P9_ROPEN, "P9_ROPEN" }, \
65 { P9_TCREATE, "P9_TCREATE" }, \
66 { P9_RCREATE, "P9_RCREATE" }, \
67 { P9_TREAD, "P9_TREAD" }, \
68 { P9_RREAD, "P9_RREAD" }, \
69 { P9_TWRITE, "P9_TWRITE" }, \
70 { P9_RWRITE, "P9_RWRITE" }, \
71 { P9_TCLUNK, "P9_TCLUNK" }, \
72 { P9_RCLUNK, "P9_RCLUNK" }, \
73 { P9_TREMOVE, "P9_TREMOVE" }, \
74 { P9_RREMOVE, "P9_RREMOVE" }, \
75 { P9_TSTAT, "P9_TSTAT" }, \
76 { P9_RSTAT, "P9_RSTAT" }, \
77 { P9_TWSTAT, "P9_TWSTAT" }, \
78 { P9_RWSTAT, "P9_RWSTAT" })
79 98
80TRACE_EVENT(9p_client_req, 99TRACE_EVENT(9p_client_req,
81 TP_PROTO(struct p9_client *clnt, int8_t type, int tag), 100 TP_PROTO(struct p9_client *clnt, int8_t type, int tag),
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 1faecea101f3..7f79cf459591 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -407,10 +407,10 @@ TRACE_EVENT(btrfs_sync_file,
407 407
408 TP_fast_assign( 408 TP_fast_assign(
409 struct dentry *dentry = file->f_path.dentry; 409 struct dentry *dentry = file->f_path.dentry;
410 struct inode *inode = dentry->d_inode; 410 struct inode *inode = d_inode(dentry);
411 411
412 __entry->ino = inode->i_ino; 412 __entry->ino = inode->i_ino;
413 __entry->parent = dentry->d_parent->d_inode->i_ino; 413 __entry->parent = d_inode(dentry->d_parent)->i_ino;
414 __entry->datasync = datasync; 414 __entry->datasync = datasync;
415 __entry->root_objectid = 415 __entry->root_objectid =
416 BTRFS_I(inode)->root->root_key.objectid; 416 BTRFS_I(inode)->root->root_key.objectid;
@@ -962,7 +962,7 @@ TRACE_EVENT(alloc_extent_state,
962 __entry->ip = IP 962 __entry->ip = IP
963 ), 963 ),
964 964
965 TP_printk("state=%p; mask = %s; caller = %pF", __entry->state, 965 TP_printk("state=%p; mask = %s; caller = %pS", __entry->state,
966 show_gfp_flags(__entry->mask), (void *)__entry->ip) 966 show_gfp_flags(__entry->mask), (void *)__entry->ip)
967); 967);
968 968
@@ -982,7 +982,7 @@ TRACE_EVENT(free_extent_state,
982 __entry->ip = IP 982 __entry->ip = IP
983 ), 983 ),
984 984
985 TP_printk(" state=%p; caller = %pF", __entry->state, 985 TP_printk(" state=%p; caller = %pS", __entry->state,
986 (void *)__entry->ip) 986 (void *)__entry->ip)
987); 987);
988 988
diff --git a/include/trace/events/clk.h b/include/trace/events/clk.h
new file mode 100644
index 000000000000..758607226bfd
--- /dev/null
+++ b/include/trace/events/clk.h
@@ -0,0 +1,198 @@
1/*
2 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13#undef TRACE_SYSTEM
14#define TRACE_SYSTEM clk
15
16#if !defined(_TRACE_CLK_H) || defined(TRACE_HEADER_MULTI_READ)
17#define _TRACE_CLK_H
18
19#include <linux/tracepoint.h>
20
21struct clk_core;
22
23DECLARE_EVENT_CLASS(clk,
24
25 TP_PROTO(struct clk_core *core),
26
27 TP_ARGS(core),
28
29 TP_STRUCT__entry(
30 __string( name, core->name )
31 ),
32
33 TP_fast_assign(
34 __assign_str(name, core->name);
35 ),
36
37 TP_printk("%s", __get_str(name))
38);
39
40DEFINE_EVENT(clk, clk_enable,
41
42 TP_PROTO(struct clk_core *core),
43
44 TP_ARGS(core)
45);
46
47DEFINE_EVENT(clk, clk_enable_complete,
48
49 TP_PROTO(struct clk_core *core),
50
51 TP_ARGS(core)
52);
53
54DEFINE_EVENT(clk, clk_disable,
55
56 TP_PROTO(struct clk_core *core),
57
58 TP_ARGS(core)
59);
60
61DEFINE_EVENT(clk, clk_disable_complete,
62
63 TP_PROTO(struct clk_core *core),
64
65 TP_ARGS(core)
66);
67
68DEFINE_EVENT(clk, clk_prepare,
69
70 TP_PROTO(struct clk_core *core),
71
72 TP_ARGS(core)
73);
74
75DEFINE_EVENT(clk, clk_prepare_complete,
76
77 TP_PROTO(struct clk_core *core),
78
79 TP_ARGS(core)
80);
81
82DEFINE_EVENT(clk, clk_unprepare,
83
84 TP_PROTO(struct clk_core *core),
85
86 TP_ARGS(core)
87);
88
89DEFINE_EVENT(clk, clk_unprepare_complete,
90
91 TP_PROTO(struct clk_core *core),
92
93 TP_ARGS(core)
94);
95
96DECLARE_EVENT_CLASS(clk_rate,
97
98 TP_PROTO(struct clk_core *core, unsigned long rate),
99
100 TP_ARGS(core, rate),
101
102 TP_STRUCT__entry(
103 __string( name, core->name )
104 __field(unsigned long, rate )
105 ),
106
107 TP_fast_assign(
108 __assign_str(name, core->name);
109 __entry->rate = rate;
110 ),
111
112 TP_printk("%s %lu", __get_str(name), (unsigned long)__entry->rate)
113);
114
115DEFINE_EVENT(clk_rate, clk_set_rate,
116
117 TP_PROTO(struct clk_core *core, unsigned long rate),
118
119 TP_ARGS(core, rate)
120);
121
122DEFINE_EVENT(clk_rate, clk_set_rate_complete,
123
124 TP_PROTO(struct clk_core *core, unsigned long rate),
125
126 TP_ARGS(core, rate)
127);
128
129DECLARE_EVENT_CLASS(clk_parent,
130
131 TP_PROTO(struct clk_core *core, struct clk_core *parent),
132
133 TP_ARGS(core, parent),
134
135 TP_STRUCT__entry(
136 __string( name, core->name )
137 __string( pname, parent->name )
138 ),
139
140 TP_fast_assign(
141 __assign_str(name, core->name);
142 __assign_str(pname, parent->name);
143 ),
144
145 TP_printk("%s %s", __get_str(name), __get_str(pname))
146);
147
148DEFINE_EVENT(clk_parent, clk_set_parent,
149
150 TP_PROTO(struct clk_core *core, struct clk_core *parent),
151
152 TP_ARGS(core, parent)
153);
154
155DEFINE_EVENT(clk_parent, clk_set_parent_complete,
156
157 TP_PROTO(struct clk_core *core, struct clk_core *parent),
158
159 TP_ARGS(core, parent)
160);
161
162DECLARE_EVENT_CLASS(clk_phase,
163
164 TP_PROTO(struct clk_core *core, int phase),
165
166 TP_ARGS(core, phase),
167
168 TP_STRUCT__entry(
169 __string( name, core->name )
170 __field( int, phase )
171 ),
172
173 TP_fast_assign(
174 __assign_str(name, core->name);
175 __entry->phase = phase;
176 ),
177
178 TP_printk("%s %d", __get_str(name), (int)__entry->phase)
179);
180
181DEFINE_EVENT(clk_phase, clk_set_phase,
182
183 TP_PROTO(struct clk_core *core, int phase),
184
185 TP_ARGS(core, phase)
186);
187
188DEFINE_EVENT(clk_phase, clk_set_phase_complete,
189
190 TP_PROTO(struct clk_core *core, int phase),
191
192 TP_ARGS(core, phase)
193);
194
195#endif /* _TRACE_CLK_H */
196
197/* This part must be outside protection */
198#include <trace/define_trace.h>
diff --git a/include/trace/events/cma.h b/include/trace/events/cma.h
new file mode 100644
index 000000000000..d7cd961720a7
--- /dev/null
+++ b/include/trace/events/cma.h
@@ -0,0 +1,66 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM cma
3
4#if !defined(_TRACE_CMA_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_CMA_H
6
7#include <linux/types.h>
8#include <linux/tracepoint.h>
9
10TRACE_EVENT(cma_alloc,
11
12 TP_PROTO(unsigned long pfn, const struct page *page,
13 unsigned int count, unsigned int align),
14
15 TP_ARGS(pfn, page, count, align),
16
17 TP_STRUCT__entry(
18 __field(unsigned long, pfn)
19 __field(const struct page *, page)
20 __field(unsigned int, count)
21 __field(unsigned int, align)
22 ),
23
24 TP_fast_assign(
25 __entry->pfn = pfn;
26 __entry->page = page;
27 __entry->count = count;
28 __entry->align = align;
29 ),
30
31 TP_printk("pfn=%lx page=%p count=%u align=%u",
32 __entry->pfn,
33 __entry->page,
34 __entry->count,
35 __entry->align)
36);
37
38TRACE_EVENT(cma_release,
39
40 TP_PROTO(unsigned long pfn, const struct page *page,
41 unsigned int count),
42
43 TP_ARGS(pfn, page, count),
44
45 TP_STRUCT__entry(
46 __field(unsigned long, pfn)
47 __field(const struct page *, page)
48 __field(unsigned int, count)
49 ),
50
51 TP_fast_assign(
52 __entry->pfn = pfn;
53 __entry->page = page;
54 __entry->count = count;
55 ),
56
57 TP_printk("pfn=%lx page=%p count=%u",
58 __entry->pfn,
59 __entry->page,
60 __entry->count)
61);
62
63#endif /* _TRACE_CMA_H */
64
65/* This part must be outside protection */
66#include <trace/define_trace.h>
diff --git a/include/trace/events/ext3.h b/include/trace/events/ext3.h
index 6797b9de90ed..fc733d28117a 100644
--- a/include/trace/events/ext3.h
+++ b/include/trace/events/ext3.h
@@ -144,7 +144,7 @@ TRACE_EVENT(ext3_mark_inode_dirty,
144 __entry->ip = IP; 144 __entry->ip = IP;
145 ), 145 ),
146 146
147 TP_printk("dev %d,%d ino %lu caller %pF", 147 TP_printk("dev %d,%d ino %lu caller %pS",
148 MAJOR(__entry->dev), MINOR(__entry->dev), 148 MAJOR(__entry->dev), MINOR(__entry->dev),
149 (unsigned long) __entry->ino, (void *)__entry->ip) 149 (unsigned long) __entry->ino, (void *)__entry->ip)
150); 150);
@@ -439,10 +439,10 @@ TRACE_EVENT(ext3_sync_file_enter,
439 TP_fast_assign( 439 TP_fast_assign(
440 struct dentry *dentry = file->f_path.dentry; 440 struct dentry *dentry = file->f_path.dentry;
441 441
442 __entry->dev = dentry->d_inode->i_sb->s_dev; 442 __entry->dev = d_inode(dentry)->i_sb->s_dev;
443 __entry->ino = dentry->d_inode->i_ino; 443 __entry->ino = d_inode(dentry)->i_ino;
444 __entry->datasync = datasync; 444 __entry->datasync = datasync;
445 __entry->parent = dentry->d_parent->d_inode->i_ino; 445 __entry->parent = d_inode(dentry->d_parent)->i_ino;
446 ), 446 ),
447 447
448 TP_printk("dev %d,%d ino %lu parent %ld datasync %d ", 448 TP_printk("dev %d,%d ino %lu parent %ld datasync %d ",
@@ -710,9 +710,9 @@ TRACE_EVENT(ext3_unlink_enter,
710 710
711 TP_fast_assign( 711 TP_fast_assign(
712 __entry->parent = parent->i_ino; 712 __entry->parent = parent->i_ino;
713 __entry->ino = dentry->d_inode->i_ino; 713 __entry->ino = d_inode(dentry)->i_ino;
714 __entry->size = dentry->d_inode->i_size; 714 __entry->size = d_inode(dentry)->i_size;
715 __entry->dev = dentry->d_inode->i_sb->s_dev; 715 __entry->dev = d_inode(dentry)->i_sb->s_dev;
716 ), 716 ),
717 717
718 TP_printk("dev %d,%d ino %lu size %lld parent %ld", 718 TP_printk("dev %d,%d ino %lu size %lld parent %ld",
@@ -734,8 +734,8 @@ TRACE_EVENT(ext3_unlink_exit,
734 ), 734 ),
735 735
736 TP_fast_assign( 736 TP_fast_assign(
737 __entry->ino = dentry->d_inode->i_ino; 737 __entry->ino = d_inode(dentry)->i_ino;
738 __entry->dev = dentry->d_inode->i_sb->s_dev; 738 __entry->dev = d_inode(dentry)->i_sb->s_dev;
739 __entry->ret = ret; 739 __entry->ret = ret;
740 ), 740 ),
741 741
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 6e5abd6d38a2..08ec3dd27630 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -240,7 +240,7 @@ TRACE_EVENT(ext4_mark_inode_dirty,
240 __entry->ip = IP; 240 __entry->ip = IP;
241 ), 241 ),
242 242
243 TP_printk("dev %d,%d ino %lu caller %pF", 243 TP_printk("dev %d,%d ino %lu caller %pS",
244 MAJOR(__entry->dev), MINOR(__entry->dev), 244 MAJOR(__entry->dev), MINOR(__entry->dev),
245 (unsigned long) __entry->ino, (void *)__entry->ip) 245 (unsigned long) __entry->ino, (void *)__entry->ip)
246); 246);
@@ -872,10 +872,10 @@ TRACE_EVENT(ext4_sync_file_enter,
872 TP_fast_assign( 872 TP_fast_assign(
873 struct dentry *dentry = file->f_path.dentry; 873 struct dentry *dentry = file->f_path.dentry;
874 874
875 __entry->dev = dentry->d_inode->i_sb->s_dev; 875 __entry->dev = d_inode(dentry)->i_sb->s_dev;
876 __entry->ino = dentry->d_inode->i_ino; 876 __entry->ino = d_inode(dentry)->i_ino;
877 __entry->datasync = datasync; 877 __entry->datasync = datasync;
878 __entry->parent = dentry->d_parent->d_inode->i_ino; 878 __entry->parent = d_inode(dentry->d_parent)->i_ino;
879 ), 879 ),
880 880
881 TP_printk("dev %d,%d ino %lu parent %lu datasync %d ", 881 TP_printk("dev %d,%d ino %lu parent %lu datasync %d ",
@@ -1453,10 +1453,10 @@ TRACE_EVENT(ext4_unlink_enter,
1453 ), 1453 ),
1454 1454
1455 TP_fast_assign( 1455 TP_fast_assign(
1456 __entry->dev = dentry->d_inode->i_sb->s_dev; 1456 __entry->dev = d_inode(dentry)->i_sb->s_dev;
1457 __entry->ino = dentry->d_inode->i_ino; 1457 __entry->ino = d_inode(dentry)->i_ino;
1458 __entry->parent = parent->i_ino; 1458 __entry->parent = parent->i_ino;
1459 __entry->size = dentry->d_inode->i_size; 1459 __entry->size = d_inode(dentry)->i_size;
1460 ), 1460 ),
1461 1461
1462 TP_printk("dev %d,%d ino %lu size %lld parent %lu", 1462 TP_printk("dev %d,%d ino %lu size %lld parent %lu",
@@ -1477,8 +1477,8 @@ TRACE_EVENT(ext4_unlink_exit,
1477 ), 1477 ),
1478 1478
1479 TP_fast_assign( 1479 TP_fast_assign(
1480 __entry->dev = dentry->d_inode->i_sb->s_dev; 1480 __entry->dev = d_inode(dentry)->i_sb->s_dev;
1481 __entry->ino = dentry->d_inode->i_ino; 1481 __entry->ino = d_inode(dentry)->i_ino;
1482 __entry->ret = ret; 1482 __entry->ret = ret;
1483 ), 1483 ),
1484 1484
@@ -1762,7 +1762,7 @@ TRACE_EVENT(ext4_journal_start,
1762 __entry->rsv_blocks = rsv_blocks; 1762 __entry->rsv_blocks = rsv_blocks;
1763 ), 1763 ),
1764 1764
1765 TP_printk("dev %d,%d blocks, %d rsv_blocks, %d caller %pF", 1765 TP_printk("dev %d,%d blocks, %d rsv_blocks, %d caller %pS",
1766 MAJOR(__entry->dev), MINOR(__entry->dev), 1766 MAJOR(__entry->dev), MINOR(__entry->dev),
1767 __entry->blocks, __entry->rsv_blocks, (void *)__entry->ip) 1767 __entry->blocks, __entry->rsv_blocks, (void *)__entry->ip)
1768); 1768);
@@ -1784,7 +1784,7 @@ TRACE_EVENT(ext4_journal_start_reserved,
1784 __entry->blocks = blocks; 1784 __entry->blocks = blocks;
1785 ), 1785 ),
1786 1786
1787 TP_printk("dev %d,%d blocks, %d caller %pF", 1787 TP_printk("dev %d,%d blocks, %d caller %pS",
1788 MAJOR(__entry->dev), MINOR(__entry->dev), 1788 MAJOR(__entry->dev), MINOR(__entry->dev),
1789 __entry->blocks, (void *)__entry->ip) 1789 __entry->blocks, (void *)__entry->ip)
1790); 1790);
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index 5422dbfaf97d..e202dec22e1d 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -9,12 +9,46 @@
9#define show_dev(entry) MAJOR(entry->dev), MINOR(entry->dev) 9#define show_dev(entry) MAJOR(entry->dev), MINOR(entry->dev)
10#define show_dev_ino(entry) show_dev(entry), (unsigned long)entry->ino 10#define show_dev_ino(entry) show_dev(entry), (unsigned long)entry->ino
11 11
12TRACE_DEFINE_ENUM(NODE);
13TRACE_DEFINE_ENUM(DATA);
14TRACE_DEFINE_ENUM(META);
15TRACE_DEFINE_ENUM(META_FLUSH);
16TRACE_DEFINE_ENUM(CURSEG_HOT_DATA);
17TRACE_DEFINE_ENUM(CURSEG_WARM_DATA);
18TRACE_DEFINE_ENUM(CURSEG_COLD_DATA);
19TRACE_DEFINE_ENUM(CURSEG_HOT_NODE);
20TRACE_DEFINE_ENUM(CURSEG_WARM_NODE);
21TRACE_DEFINE_ENUM(CURSEG_COLD_NODE);
22TRACE_DEFINE_ENUM(NO_CHECK_TYPE);
23TRACE_DEFINE_ENUM(GC_GREEDY);
24TRACE_DEFINE_ENUM(GC_CB);
25TRACE_DEFINE_ENUM(FG_GC);
26TRACE_DEFINE_ENUM(BG_GC);
27TRACE_DEFINE_ENUM(LFS);
28TRACE_DEFINE_ENUM(SSR);
29TRACE_DEFINE_ENUM(__REQ_RAHEAD);
30TRACE_DEFINE_ENUM(__REQ_WRITE);
31TRACE_DEFINE_ENUM(__REQ_SYNC);
32TRACE_DEFINE_ENUM(__REQ_NOIDLE);
33TRACE_DEFINE_ENUM(__REQ_FLUSH);
34TRACE_DEFINE_ENUM(__REQ_FUA);
35TRACE_DEFINE_ENUM(__REQ_PRIO);
36TRACE_DEFINE_ENUM(__REQ_META);
37TRACE_DEFINE_ENUM(CP_UMOUNT);
38TRACE_DEFINE_ENUM(CP_FASTBOOT);
39TRACE_DEFINE_ENUM(CP_SYNC);
40TRACE_DEFINE_ENUM(CP_DISCARD);
41
12#define show_block_type(type) \ 42#define show_block_type(type) \
13 __print_symbolic(type, \ 43 __print_symbolic(type, \
14 { NODE, "NODE" }, \ 44 { NODE, "NODE" }, \
15 { DATA, "DATA" }, \ 45 { DATA, "DATA" }, \
16 { META, "META" }, \ 46 { META, "META" }, \
17 { META_FLUSH, "META_FLUSH" }) 47 { META_FLUSH, "META_FLUSH" }, \
48 { INMEM, "INMEM" }, \
49 { INMEM_DROP, "INMEM_DROP" }, \
50 { IPU, "IN-PLACE" }, \
51 { OPU, "OUT-OF-PLACE" })
18 52
19#define F2FS_BIO_MASK(t) (t & (READA | WRITE_FLUSH_FUA)) 53#define F2FS_BIO_MASK(t) (t & (READA | WRITE_FLUSH_FUA))
20#define F2FS_BIO_EXTRA_MASK(t) (t & (REQ_META | REQ_PRIO)) 54#define F2FS_BIO_EXTRA_MASK(t) (t & (REQ_META | REQ_PRIO))
@@ -74,6 +108,7 @@
74 { CP_UMOUNT, "Umount" }, \ 108 { CP_UMOUNT, "Umount" }, \
75 { CP_FASTBOOT, "Fastboot" }, \ 109 { CP_FASTBOOT, "Fastboot" }, \
76 { CP_SYNC, "Sync" }, \ 110 { CP_SYNC, "Sync" }, \
111 { CP_RECOVERY, "Recovery" }, \
77 { CP_DISCARD, "Discard" }) 112 { CP_DISCARD, "Discard" })
78 113
79struct victim_sel_policy; 114struct victim_sel_policy;
@@ -854,6 +889,13 @@ DEFINE_EVENT(f2fs__page, f2fs_writepage,
854 TP_ARGS(page, type) 889 TP_ARGS(page, type)
855); 890);
856 891
892DEFINE_EVENT(f2fs__page, f2fs_do_write_data_page,
893
894 TP_PROTO(struct page *page, int type),
895
896 TP_ARGS(page, type)
897);
898
857DEFINE_EVENT(f2fs__page, f2fs_readpage, 899DEFINE_EVENT(f2fs__page, f2fs_readpage,
858 900
859 TP_PROTO(struct page *page, int type), 901 TP_PROTO(struct page *page, int type),
@@ -875,6 +917,20 @@ DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
875 TP_ARGS(page, type) 917 TP_ARGS(page, type)
876); 918);
877 919
920DEFINE_EVENT(f2fs__page, f2fs_register_inmem_page,
921
922 TP_PROTO(struct page *page, int type),
923
924 TP_ARGS(page, type)
925);
926
927DEFINE_EVENT(f2fs__page, f2fs_commit_inmem_page,
928
929 TP_PROTO(struct page *page, int type),
930
931 TP_ARGS(page, type)
932);
933
878TRACE_EVENT(f2fs_writepages, 934TRACE_EVENT(f2fs_writepages,
879 935
880 TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type), 936 TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
@@ -1011,6 +1067,140 @@ TRACE_EVENT(f2fs_issue_flush,
1011 __entry->nobarrier ? "skip (nobarrier)" : "issue", 1067 __entry->nobarrier ? "skip (nobarrier)" : "issue",
1012 __entry->flush_merge ? " with flush_merge" : "") 1068 __entry->flush_merge ? " with flush_merge" : "")
1013); 1069);
1070
1071TRACE_EVENT(f2fs_lookup_extent_tree_start,
1072
1073 TP_PROTO(struct inode *inode, unsigned int pgofs),
1074
1075 TP_ARGS(inode, pgofs),
1076
1077 TP_STRUCT__entry(
1078 __field(dev_t, dev)
1079 __field(ino_t, ino)
1080 __field(unsigned int, pgofs)
1081 ),
1082
1083 TP_fast_assign(
1084 __entry->dev = inode->i_sb->s_dev;
1085 __entry->ino = inode->i_ino;
1086 __entry->pgofs = pgofs;
1087 ),
1088
1089 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u",
1090 show_dev_ino(__entry),
1091 __entry->pgofs)
1092);
1093
1094TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end,
1095
1096 TP_PROTO(struct inode *inode, unsigned int pgofs,
1097 struct extent_node *en),
1098
1099 TP_ARGS(inode, pgofs, en),
1100
1101 TP_CONDITION(en),
1102
1103 TP_STRUCT__entry(
1104 __field(dev_t, dev)
1105 __field(ino_t, ino)
1106 __field(unsigned int, pgofs)
1107 __field(unsigned int, fofs)
1108 __field(u32, blk)
1109 __field(unsigned int, len)
1110 ),
1111
1112 TP_fast_assign(
1113 __entry->dev = inode->i_sb->s_dev;
1114 __entry->ino = inode->i_ino;
1115 __entry->pgofs = pgofs;
1116 __entry->fofs = en->ei.fofs;
1117 __entry->blk = en->ei.blk;
1118 __entry->len = en->ei.len;
1119 ),
1120
1121 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, "
1122 "ext_info(fofs: %u, blk: %u, len: %u)",
1123 show_dev_ino(__entry),
1124 __entry->pgofs,
1125 __entry->fofs,
1126 __entry->blk,
1127 __entry->len)
1128);
1129
1130TRACE_EVENT(f2fs_update_extent_tree,
1131
1132 TP_PROTO(struct inode *inode, unsigned int pgofs, block_t blkaddr),
1133
1134 TP_ARGS(inode, pgofs, blkaddr),
1135
1136 TP_STRUCT__entry(
1137 __field(dev_t, dev)
1138 __field(ino_t, ino)
1139 __field(unsigned int, pgofs)
1140 __field(u32, blk)
1141 ),
1142
1143 TP_fast_assign(
1144 __entry->dev = inode->i_sb->s_dev;
1145 __entry->ino = inode->i_ino;
1146 __entry->pgofs = pgofs;
1147 __entry->blk = blkaddr;
1148 ),
1149
1150 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, blkaddr = %u",
1151 show_dev_ino(__entry),
1152 __entry->pgofs,
1153 __entry->blk)
1154);
1155
1156TRACE_EVENT(f2fs_shrink_extent_tree,
1157
1158 TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt,
1159 unsigned int tree_cnt),
1160
1161 TP_ARGS(sbi, node_cnt, tree_cnt),
1162
1163 TP_STRUCT__entry(
1164 __field(dev_t, dev)
1165 __field(unsigned int, node_cnt)
1166 __field(unsigned int, tree_cnt)
1167 ),
1168
1169 TP_fast_assign(
1170 __entry->dev = sbi->sb->s_dev;
1171 __entry->node_cnt = node_cnt;
1172 __entry->tree_cnt = tree_cnt;
1173 ),
1174
1175 TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u",
1176 show_dev(__entry),
1177 __entry->node_cnt,
1178 __entry->tree_cnt)
1179);
1180
1181TRACE_EVENT(f2fs_destroy_extent_tree,
1182
1183 TP_PROTO(struct inode *inode, unsigned int node_cnt),
1184
1185 TP_ARGS(inode, node_cnt),
1186
1187 TP_STRUCT__entry(
1188 __field(dev_t, dev)
1189 __field(ino_t, ino)
1190 __field(unsigned int, node_cnt)
1191 ),
1192
1193 TP_fast_assign(
1194 __entry->dev = inode->i_sb->s_dev;
1195 __entry->ino = inode->i_ino;
1196 __entry->node_cnt = node_cnt;
1197 ),
1198
1199 TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u",
1200 show_dev_ino(__entry),
1201 __entry->node_cnt)
1202);
1203
1014#endif /* _TRACE_F2FS_H */ 1204#endif /* _TRACE_F2FS_H */
1015 1205
1016 /* This part must be outside protection */ 1206 /* This part must be outside protection */
diff --git a/include/trace/events/filemap.h b/include/trace/events/filemap.h
index 0421f49a20f7..42febb6bc1d5 100644
--- a/include/trace/events/filemap.h
+++ b/include/trace/events/filemap.h
@@ -18,14 +18,14 @@ DECLARE_EVENT_CLASS(mm_filemap_op_page_cache,
18 TP_ARGS(page), 18 TP_ARGS(page),
19 19
20 TP_STRUCT__entry( 20 TP_STRUCT__entry(
21 __field(struct page *, page) 21 __field(unsigned long, pfn)
22 __field(unsigned long, i_ino) 22 __field(unsigned long, i_ino)
23 __field(unsigned long, index) 23 __field(unsigned long, index)
24 __field(dev_t, s_dev) 24 __field(dev_t, s_dev)
25 ), 25 ),
26 26
27 TP_fast_assign( 27 TP_fast_assign(
28 __entry->page = page; 28 __entry->pfn = page_to_pfn(page);
29 __entry->i_ino = page->mapping->host->i_ino; 29 __entry->i_ino = page->mapping->host->i_ino;
30 __entry->index = page->index; 30 __entry->index = page->index;
31 if (page->mapping->host->i_sb) 31 if (page->mapping->host->i_sb)
@@ -37,8 +37,8 @@ DECLARE_EVENT_CLASS(mm_filemap_op_page_cache,
37 TP_printk("dev %d:%d ino %lx page=%p pfn=%lu ofs=%lu", 37 TP_printk("dev %d:%d ino %lx page=%p pfn=%lu ofs=%lu",
38 MAJOR(__entry->s_dev), MINOR(__entry->s_dev), 38 MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
39 __entry->i_ino, 39 __entry->i_ino,
40 __entry->page, 40 pfn_to_page(__entry->pfn),
41 page_to_pfn(__entry->page), 41 __entry->pfn,
42 __entry->index << PAGE_SHIFT) 42 __entry->index << PAGE_SHIFT)
43); 43);
44 44
diff --git a/include/trace/events/intel-sst.h b/include/trace/events/intel-sst.h
index 76c72d3f1902..edc24e6dea1b 100644
--- a/include/trace/events/intel-sst.h
+++ b/include/trace/events/intel-sst.h
@@ -1,6 +1,13 @@
1#undef TRACE_SYSTEM 1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM intel-sst 2#define TRACE_SYSTEM intel-sst
3 3
4/*
5 * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a
6 * legitimate C variable. It is not exported to user space.
7 */
8#undef TRACE_SYSTEM_VAR
9#define TRACE_SYSTEM_VAR intel_sst
10
4#if !defined(_TRACE_INTEL_SST_H) || defined(TRACE_HEADER_MULTI_READ) 11#if !defined(_TRACE_INTEL_SST_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_INTEL_SST_H 12#define _TRACE_INTEL_SST_H
6 13
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index 3608bebd3d9c..ff8f6c091a15 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -9,19 +9,34 @@
9struct irqaction; 9struct irqaction;
10struct softirq_action; 10struct softirq_action;
11 11
12#define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq } 12#define SOFTIRQ_NAME_LIST \
13 softirq_name(HI) \
14 softirq_name(TIMER) \
15 softirq_name(NET_TX) \
16 softirq_name(NET_RX) \
17 softirq_name(BLOCK) \
18 softirq_name(BLOCK_IOPOLL) \
19 softirq_name(TASKLET) \
20 softirq_name(SCHED) \
21 softirq_name(HRTIMER) \
22 softirq_name_end(RCU)
23
24#undef softirq_name
25#undef softirq_name_end
26
27#define softirq_name(sirq) TRACE_DEFINE_ENUM(sirq##_SOFTIRQ);
28#define softirq_name_end(sirq) TRACE_DEFINE_ENUM(sirq##_SOFTIRQ);
29
30SOFTIRQ_NAME_LIST
31
32#undef softirq_name
33#undef softirq_name_end
34
35#define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq },
36#define softirq_name_end(sirq) { sirq##_SOFTIRQ, #sirq }
37
13#define show_softirq_name(val) \ 38#define show_softirq_name(val) \
14 __print_symbolic(val, \ 39 __print_symbolic(val, SOFTIRQ_NAME_LIST)
15 softirq_name(HI), \
16 softirq_name(TIMER), \
17 softirq_name(NET_TX), \
18 softirq_name(NET_RX), \
19 softirq_name(BLOCK), \
20 softirq_name(BLOCK_IOPOLL), \
21 softirq_name(TASKLET), \
22 softirq_name(SCHED), \
23 softirq_name(HRTIMER), \
24 softirq_name(RCU))
25 40
26/** 41/**
27 * irq_handler_entry - called immediately before the irq action handler 42 * irq_handler_entry - called immediately before the irq action handler
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index 4ad10baecd4d..81ea59812117 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -154,18 +154,18 @@ TRACE_EVENT(mm_page_free,
154 TP_ARGS(page, order), 154 TP_ARGS(page, order),
155 155
156 TP_STRUCT__entry( 156 TP_STRUCT__entry(
157 __field( struct page *, page ) 157 __field( unsigned long, pfn )
158 __field( unsigned int, order ) 158 __field( unsigned int, order )
159 ), 159 ),
160 160
161 TP_fast_assign( 161 TP_fast_assign(
162 __entry->page = page; 162 __entry->pfn = page_to_pfn(page);
163 __entry->order = order; 163 __entry->order = order;
164 ), 164 ),
165 165
166 TP_printk("page=%p pfn=%lu order=%d", 166 TP_printk("page=%p pfn=%lu order=%d",
167 __entry->page, 167 pfn_to_page(__entry->pfn),
168 page_to_pfn(__entry->page), 168 __entry->pfn,
169 __entry->order) 169 __entry->order)
170); 170);
171 171
@@ -176,18 +176,18 @@ TRACE_EVENT(mm_page_free_batched,
176 TP_ARGS(page, cold), 176 TP_ARGS(page, cold),
177 177
178 TP_STRUCT__entry( 178 TP_STRUCT__entry(
179 __field( struct page *, page ) 179 __field( unsigned long, pfn )
180 __field( int, cold ) 180 __field( int, cold )
181 ), 181 ),
182 182
183 TP_fast_assign( 183 TP_fast_assign(
184 __entry->page = page; 184 __entry->pfn = page_to_pfn(page);
185 __entry->cold = cold; 185 __entry->cold = cold;
186 ), 186 ),
187 187
188 TP_printk("page=%p pfn=%lu order=0 cold=%d", 188 TP_printk("page=%p pfn=%lu order=0 cold=%d",
189 __entry->page, 189 pfn_to_page(__entry->pfn),
190 page_to_pfn(__entry->page), 190 __entry->pfn,
191 __entry->cold) 191 __entry->cold)
192); 192);
193 193
@@ -199,22 +199,22 @@ TRACE_EVENT(mm_page_alloc,
199 TP_ARGS(page, order, gfp_flags, migratetype), 199 TP_ARGS(page, order, gfp_flags, migratetype),
200 200
201 TP_STRUCT__entry( 201 TP_STRUCT__entry(
202 __field( struct page *, page ) 202 __field( unsigned long, pfn )
203 __field( unsigned int, order ) 203 __field( unsigned int, order )
204 __field( gfp_t, gfp_flags ) 204 __field( gfp_t, gfp_flags )
205 __field( int, migratetype ) 205 __field( int, migratetype )
206 ), 206 ),
207 207
208 TP_fast_assign( 208 TP_fast_assign(
209 __entry->page = page; 209 __entry->pfn = page ? page_to_pfn(page) : -1UL;
210 __entry->order = order; 210 __entry->order = order;
211 __entry->gfp_flags = gfp_flags; 211 __entry->gfp_flags = gfp_flags;
212 __entry->migratetype = migratetype; 212 __entry->migratetype = migratetype;
213 ), 213 ),
214 214
215 TP_printk("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s", 215 TP_printk("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s",
216 __entry->page, 216 __entry->pfn != -1UL ? pfn_to_page(__entry->pfn) : NULL,
217 __entry->page ? page_to_pfn(__entry->page) : 0, 217 __entry->pfn != -1UL ? __entry->pfn : 0,
218 __entry->order, 218 __entry->order,
219 __entry->migratetype, 219 __entry->migratetype,
220 show_gfp_flags(__entry->gfp_flags)) 220 show_gfp_flags(__entry->gfp_flags))
@@ -227,20 +227,20 @@ DECLARE_EVENT_CLASS(mm_page,
227 TP_ARGS(page, order, migratetype), 227 TP_ARGS(page, order, migratetype),
228 228
229 TP_STRUCT__entry( 229 TP_STRUCT__entry(
230 __field( struct page *, page ) 230 __field( unsigned long, pfn )
231 __field( unsigned int, order ) 231 __field( unsigned int, order )
232 __field( int, migratetype ) 232 __field( int, migratetype )
233 ), 233 ),
234 234
235 TP_fast_assign( 235 TP_fast_assign(
236 __entry->page = page; 236 __entry->pfn = page ? page_to_pfn(page) : -1UL;
237 __entry->order = order; 237 __entry->order = order;
238 __entry->migratetype = migratetype; 238 __entry->migratetype = migratetype;
239 ), 239 ),
240 240
241 TP_printk("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d", 241 TP_printk("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d",
242 __entry->page, 242 __entry->pfn != -1UL ? pfn_to_page(__entry->pfn) : NULL,
243 __entry->page ? page_to_pfn(__entry->page) : 0, 243 __entry->pfn != -1UL ? __entry->pfn : 0,
244 __entry->order, 244 __entry->order,
245 __entry->migratetype, 245 __entry->migratetype,
246 __entry->order == 0) 246 __entry->order == 0)
@@ -260,7 +260,7 @@ DEFINE_EVENT_PRINT(mm_page, mm_page_pcpu_drain,
260 TP_ARGS(page, order, migratetype), 260 TP_ARGS(page, order, migratetype),
261 261
262 TP_printk("page=%p pfn=%lu order=%d migratetype=%d", 262 TP_printk("page=%p pfn=%lu order=%d migratetype=%d",
263 __entry->page, page_to_pfn(__entry->page), 263 pfn_to_page(__entry->pfn), __entry->pfn,
264 __entry->order, __entry->migratetype) 264 __entry->order, __entry->migratetype)
265); 265);
266 266
@@ -275,7 +275,7 @@ TRACE_EVENT(mm_page_alloc_extfrag,
275 alloc_migratetype, fallback_migratetype), 275 alloc_migratetype, fallback_migratetype),
276 276
277 TP_STRUCT__entry( 277 TP_STRUCT__entry(
278 __field( struct page *, page ) 278 __field( unsigned long, pfn )
279 __field( int, alloc_order ) 279 __field( int, alloc_order )
280 __field( int, fallback_order ) 280 __field( int, fallback_order )
281 __field( int, alloc_migratetype ) 281 __field( int, alloc_migratetype )
@@ -284,7 +284,7 @@ TRACE_EVENT(mm_page_alloc_extfrag,
284 ), 284 ),
285 285
286 TP_fast_assign( 286 TP_fast_assign(
287 __entry->page = page; 287 __entry->pfn = page_to_pfn(page);
288 __entry->alloc_order = alloc_order; 288 __entry->alloc_order = alloc_order;
289 __entry->fallback_order = fallback_order; 289 __entry->fallback_order = fallback_order;
290 __entry->alloc_migratetype = alloc_migratetype; 290 __entry->alloc_migratetype = alloc_migratetype;
@@ -294,8 +294,8 @@ TRACE_EVENT(mm_page_alloc_extfrag,
294 ), 294 ),
295 295
296 TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d", 296 TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d",
297 __entry->page, 297 pfn_to_page(__entry->pfn),
298 page_to_pfn(__entry->page), 298 __entry->pfn,
299 __entry->alloc_order, 299 __entry->alloc_order,
300 __entry->fallback_order, 300 __entry->fallback_order,
301 pageblock_order, 301 pageblock_order,
diff --git a/include/trace/events/libata.h b/include/trace/events/libata.h
new file mode 100644
index 000000000000..8b0fbd93082c
--- /dev/null
+++ b/include/trace/events/libata.h
@@ -0,0 +1,325 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM libata
3
4#if !defined(_TRACE_LIBATA_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_LIBATA_H
6
7#include <linux/ata.h>
8#include <linux/libata.h>
9#include <linux/tracepoint.h>
10#include <linux/trace_seq.h>
11
12#define ata_opcode_name(opcode) { opcode, #opcode }
13#define show_opcode_name(val) \
14 __print_symbolic(val, \
15 ata_opcode_name(ATA_CMD_DEV_RESET), \
16 ata_opcode_name(ATA_CMD_CHK_POWER), \
17 ata_opcode_name(ATA_CMD_STANDBY), \
18 ata_opcode_name(ATA_CMD_IDLE), \
19 ata_opcode_name(ATA_CMD_EDD), \
20 ata_opcode_name(ATA_CMD_DOWNLOAD_MICRO), \
21 ata_opcode_name(ATA_CMD_DOWNLOAD_MICRO_DMA), \
22 ata_opcode_name(ATA_CMD_NOP), \
23 ata_opcode_name(ATA_CMD_FLUSH), \
24 ata_opcode_name(ATA_CMD_FLUSH_EXT), \
25 ata_opcode_name(ATA_CMD_ID_ATA), \
26 ata_opcode_name(ATA_CMD_ID_ATAPI), \
27 ata_opcode_name(ATA_CMD_SERVICE), \
28 ata_opcode_name(ATA_CMD_READ), \
29 ata_opcode_name(ATA_CMD_READ_EXT), \
30 ata_opcode_name(ATA_CMD_READ_QUEUED), \
31 ata_opcode_name(ATA_CMD_READ_STREAM_EXT), \
32 ata_opcode_name(ATA_CMD_READ_STREAM_DMA_EXT), \
33 ata_opcode_name(ATA_CMD_WRITE), \
34 ata_opcode_name(ATA_CMD_WRITE_EXT), \
35 ata_opcode_name(ATA_CMD_WRITE_QUEUED), \
36 ata_opcode_name(ATA_CMD_WRITE_STREAM_EXT), \
37 ata_opcode_name(ATA_CMD_WRITE_STREAM_DMA_EXT), \
38 ata_opcode_name(ATA_CMD_WRITE_FUA_EXT), \
39 ata_opcode_name(ATA_CMD_WRITE_QUEUED_FUA_EXT), \
40 ata_opcode_name(ATA_CMD_FPDMA_READ), \
41 ata_opcode_name(ATA_CMD_FPDMA_WRITE), \
42 ata_opcode_name(ATA_CMD_FPDMA_SEND), \
43 ata_opcode_name(ATA_CMD_FPDMA_RECV), \
44 ata_opcode_name(ATA_CMD_PIO_READ), \
45 ata_opcode_name(ATA_CMD_PIO_READ_EXT), \
46 ata_opcode_name(ATA_CMD_PIO_WRITE), \
47 ata_opcode_name(ATA_CMD_PIO_WRITE_EXT), \
48 ata_opcode_name(ATA_CMD_READ_MULTI), \
49 ata_opcode_name(ATA_CMD_READ_MULTI_EXT), \
50 ata_opcode_name(ATA_CMD_WRITE_MULTI), \
51 ata_opcode_name(ATA_CMD_WRITE_MULTI_EXT), \
52 ata_opcode_name(ATA_CMD_WRITE_MULTI_FUA_EXT), \
53 ata_opcode_name(ATA_CMD_SET_FEATURES), \
54 ata_opcode_name(ATA_CMD_SET_MULTI), \
55 ata_opcode_name(ATA_CMD_PACKET), \
56 ata_opcode_name(ATA_CMD_VERIFY), \
57 ata_opcode_name(ATA_CMD_VERIFY_EXT), \
58 ata_opcode_name(ATA_CMD_WRITE_UNCORR_EXT), \
59 ata_opcode_name(ATA_CMD_STANDBYNOW1), \
60 ata_opcode_name(ATA_CMD_IDLEIMMEDIATE), \
61 ata_opcode_name(ATA_CMD_SLEEP), \
62 ata_opcode_name(ATA_CMD_INIT_DEV_PARAMS), \
63 ata_opcode_name(ATA_CMD_READ_NATIVE_MAX), \
64 ata_opcode_name(ATA_CMD_READ_NATIVE_MAX_EXT), \
65 ata_opcode_name(ATA_CMD_SET_MAX), \
66 ata_opcode_name(ATA_CMD_SET_MAX_EXT), \
67 ata_opcode_name(ATA_CMD_READ_LOG_EXT), \
68 ata_opcode_name(ATA_CMD_WRITE_LOG_EXT), \
69 ata_opcode_name(ATA_CMD_READ_LOG_DMA_EXT), \
70 ata_opcode_name(ATA_CMD_WRITE_LOG_DMA_EXT), \
71 ata_opcode_name(ATA_CMD_TRUSTED_NONDATA), \
72 ata_opcode_name(ATA_CMD_TRUSTED_RCV), \
73 ata_opcode_name(ATA_CMD_TRUSTED_RCV_DMA), \
74 ata_opcode_name(ATA_CMD_TRUSTED_SND), \
75 ata_opcode_name(ATA_CMD_TRUSTED_SND_DMA), \
76 ata_opcode_name(ATA_CMD_PMP_READ), \
77 ata_opcode_name(ATA_CMD_PMP_READ_DMA), \
78 ata_opcode_name(ATA_CMD_PMP_WRITE), \
79 ata_opcode_name(ATA_CMD_PMP_WRITE_DMA), \
80 ata_opcode_name(ATA_CMD_CONF_OVERLAY), \
81 ata_opcode_name(ATA_CMD_SEC_SET_PASS), \
82 ata_opcode_name(ATA_CMD_SEC_UNLOCK), \
83 ata_opcode_name(ATA_CMD_SEC_ERASE_PREP), \
84 ata_opcode_name(ATA_CMD_SEC_ERASE_UNIT), \
85 ata_opcode_name(ATA_CMD_SEC_FREEZE_LOCK), \
86 ata_opcode_name(ATA_CMD_SEC_DISABLE_PASS), \
87 ata_opcode_name(ATA_CMD_CONFIG_STREAM), \
88 ata_opcode_name(ATA_CMD_SMART), \
89 ata_opcode_name(ATA_CMD_MEDIA_LOCK), \
90 ata_opcode_name(ATA_CMD_MEDIA_UNLOCK), \
91 ata_opcode_name(ATA_CMD_DSM), \
92 ata_opcode_name(ATA_CMD_CHK_MED_CRD_TYP), \
93 ata_opcode_name(ATA_CMD_CFA_REQ_EXT_ERR), \
94 ata_opcode_name(ATA_CMD_CFA_WRITE_NE), \
95 ata_opcode_name(ATA_CMD_CFA_TRANS_SECT), \
96 ata_opcode_name(ATA_CMD_CFA_ERASE), \
97 ata_opcode_name(ATA_CMD_CFA_WRITE_MULT_NE), \
98 ata_opcode_name(ATA_CMD_REQ_SENSE_DATA), \
99 ata_opcode_name(ATA_CMD_SANITIZE_DEVICE), \
100 ata_opcode_name(ATA_CMD_RESTORE), \
101 ata_opcode_name(ATA_CMD_READ_LONG), \
102 ata_opcode_name(ATA_CMD_READ_LONG_ONCE), \
103 ata_opcode_name(ATA_CMD_WRITE_LONG), \
104 ata_opcode_name(ATA_CMD_WRITE_LONG_ONCE))
105
106#define ata_error_name(result) { result, #result }
107#define show_error_name(val) \
108 __print_symbolic(val, \
109 ata_error_name(ATA_ICRC), \
110 ata_error_name(ATA_UNC), \
111 ata_error_name(ATA_MC), \
112 ata_error_name(ATA_IDNF), \
113 ata_error_name(ATA_MCR), \
114 ata_error_name(ATA_ABORTED), \
115 ata_error_name(ATA_TRK0NF), \
116 ata_error_name(ATA_AMNF))
117
118#define ata_protocol_name(proto) { proto, #proto }
119#define show_protocol_name(val) \
120 __print_symbolic(val, \
121 ata_protocol_name(ATA_PROT_UNKNOWN), \
122 ata_protocol_name(ATA_PROT_NODATA), \
123 ata_protocol_name(ATA_PROT_PIO), \
124 ata_protocol_name(ATA_PROT_DMA), \
125 ata_protocol_name(ATA_PROT_NCQ), \
126 ata_protocol_name(ATAPI_PROT_NODATA), \
127 ata_protocol_name(ATAPI_PROT_PIO), \
128 ata_protocol_name(ATAPI_PROT_DMA))
129
130const char *libata_trace_parse_status(struct trace_seq*, unsigned char);
131#define __parse_status(s) libata_trace_parse_status(p, s)
132
133const char *libata_trace_parse_eh_action(struct trace_seq *, unsigned int);
134#define __parse_eh_action(a) libata_trace_parse_eh_action(p, a)
135
136const char *libata_trace_parse_eh_err_mask(struct trace_seq *, unsigned int);
137#define __parse_eh_err_mask(m) libata_trace_parse_eh_err_mask(p, m)
138
139const char *libata_trace_parse_qc_flags(struct trace_seq *, unsigned int);
140#define __parse_qc_flags(f) libata_trace_parse_qc_flags(p, f)
141
142TRACE_EVENT(ata_qc_issue,
143
144 TP_PROTO(struct ata_queued_cmd *qc),
145
146 TP_ARGS(qc),
147
148 TP_STRUCT__entry(
149 __field( unsigned int, ata_port )
150 __field( unsigned int, ata_dev )
151 __field( unsigned int, tag )
152 __field( unsigned char, cmd )
153 __field( unsigned char, dev )
154 __field( unsigned char, lbal )
155 __field( unsigned char, lbam )
156 __field( unsigned char, lbah )
157 __field( unsigned char, nsect )
158 __field( unsigned char, feature )
159 __field( unsigned char, hob_lbal )
160 __field( unsigned char, hob_lbam )
161 __field( unsigned char, hob_lbah )
162 __field( unsigned char, hob_nsect )
163 __field( unsigned char, hob_feature )
164 __field( unsigned char, ctl )
165 __field( unsigned char, proto )
166 __field( unsigned long, flags )
167 ),
168
169 TP_fast_assign(
170 __entry->ata_port = qc->ap->print_id;
171 __entry->ata_dev = qc->dev->link->pmp + qc->dev->devno;
172 __entry->tag = qc->tag;
173 __entry->proto = qc->tf.protocol;
174 __entry->cmd = qc->tf.command;
175 __entry->dev = qc->tf.device;
176 __entry->lbal = qc->tf.lbal;
177 __entry->lbam = qc->tf.lbam;
178 __entry->lbah = qc->tf.lbah;
179 __entry->hob_lbal = qc->tf.hob_lbal;
180 __entry->hob_lbam = qc->tf.hob_lbam;
181 __entry->hob_lbah = qc->tf.hob_lbah;
182 __entry->feature = qc->tf.feature;
183 __entry->hob_feature = qc->tf.hob_feature;
184 __entry->nsect = qc->tf.nsect;
185 __entry->hob_nsect = qc->tf.hob_nsect;
186 ),
187
188 TP_printk("ata_port=%u ata_dev=%u tag=%d proto=%s cmd=%s " \
189 " tf=(%02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x)",
190 __entry->ata_port, __entry->ata_dev, __entry->tag,
191 show_protocol_name(__entry->proto),
192 show_opcode_name(__entry->cmd),
193 __entry->cmd, __entry->feature, __entry->nsect,
194 __entry->lbal, __entry->lbam, __entry->lbah,
195 __entry->hob_feature, __entry->hob_nsect,
196 __entry->hob_lbal, __entry->hob_lbam, __entry->hob_lbah,
197 __entry->dev)
198);
199
200DECLARE_EVENT_CLASS(ata_qc_complete_template,
201
202 TP_PROTO(struct ata_queued_cmd *qc),
203
204 TP_ARGS(qc),
205
206 TP_STRUCT__entry(
207 __field( unsigned int, ata_port )
208 __field( unsigned int, ata_dev )
209 __field( unsigned int, tag )
210 __field( unsigned char, status )
211 __field( unsigned char, dev )
212 __field( unsigned char, lbal )
213 __field( unsigned char, lbam )
214 __field( unsigned char, lbah )
215 __field( unsigned char, nsect )
216 __field( unsigned char, error )
217 __field( unsigned char, hob_lbal )
218 __field( unsigned char, hob_lbam )
219 __field( unsigned char, hob_lbah )
220 __field( unsigned char, hob_nsect )
221 __field( unsigned char, hob_feature )
222 __field( unsigned char, ctl )
223 __field( unsigned long, flags )
224 ),
225
226 TP_fast_assign(
227 __entry->ata_port = qc->ap->print_id;
228 __entry->ata_dev = qc->dev->link->pmp + qc->dev->devno;
229 __entry->tag = qc->tag;
230 __entry->status = qc->result_tf.command;
231 __entry->dev = qc->result_tf.device;
232 __entry->lbal = qc->result_tf.lbal;
233 __entry->lbam = qc->result_tf.lbam;
234 __entry->lbah = qc->result_tf.lbah;
235 __entry->hob_lbal = qc->result_tf.hob_lbal;
236 __entry->hob_lbam = qc->result_tf.hob_lbam;
237 __entry->hob_lbah = qc->result_tf.hob_lbah;
238 __entry->error = qc->result_tf.feature;
239 __entry->hob_feature = qc->result_tf.hob_feature;
240 __entry->nsect = qc->result_tf.nsect;
241 __entry->hob_nsect = qc->result_tf.hob_nsect;
242 ),
243
244 TP_printk("ata_port=%u ata_dev=%u tag=%d flags=%s status=%s " \
245 " res=(%02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x)",
246 __entry->ata_port, __entry->ata_dev, __entry->tag,
247 __parse_qc_flags(__entry->flags),
248 __parse_status(__entry->status),
249 __entry->status, __entry->error, __entry->nsect,
250 __entry->lbal, __entry->lbam, __entry->lbah,
251 __entry->hob_feature, __entry->hob_nsect,
252 __entry->hob_lbal, __entry->hob_lbam, __entry->hob_lbah,
253 __entry->dev)
254);
255
256DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_internal,
257 TP_PROTO(struct ata_queued_cmd *qc),
258 TP_ARGS(qc));
259
260DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_failed,
261 TP_PROTO(struct ata_queued_cmd *qc),
262 TP_ARGS(qc));
263
264DEFINE_EVENT(ata_qc_complete_template, ata_qc_complete_done,
265 TP_PROTO(struct ata_queued_cmd *qc),
266 TP_ARGS(qc));
267
268TRACE_EVENT(ata_eh_link_autopsy,
269
270 TP_PROTO(struct ata_device *dev, unsigned int eh_action, unsigned int eh_err_mask),
271
272 TP_ARGS(dev, eh_action, eh_err_mask),
273
274 TP_STRUCT__entry(
275 __field( unsigned int, ata_port )
276 __field( unsigned int, ata_dev )
277 __field( unsigned int, eh_action )
278 __field( unsigned int, eh_err_mask)
279 ),
280
281 TP_fast_assign(
282 __entry->ata_port = dev->link->ap->print_id;
283 __entry->ata_dev = dev->link->pmp + dev->devno;
284 __entry->eh_action = eh_action;
285 __entry->eh_err_mask = eh_err_mask;
286 ),
287
288 TP_printk("ata_port=%u ata_dev=%u eh_action=%s err_mask=%s",
289 __entry->ata_port, __entry->ata_dev,
290 __parse_eh_action(__entry->eh_action),
291 __parse_eh_err_mask(__entry->eh_err_mask))
292);
293
294TRACE_EVENT(ata_eh_link_autopsy_qc,
295
296 TP_PROTO(struct ata_queued_cmd *qc),
297
298 TP_ARGS(qc),
299
300 TP_STRUCT__entry(
301 __field( unsigned int, ata_port )
302 __field( unsigned int, ata_dev )
303 __field( unsigned int, tag )
304 __field( unsigned int, qc_flags )
305 __field( unsigned int, eh_err_mask)
306 ),
307
308 TP_fast_assign(
309 __entry->ata_port = qc->ap->print_id;
310 __entry->ata_dev = qc->dev->link->pmp + qc->dev->devno;
311 __entry->tag = qc->tag;
312 __entry->qc_flags = qc->flags;
313 __entry->eh_err_mask = qc->err_mask;
314 ),
315
316 TP_printk("ata_port=%u ata_dev=%u tag=%d flags=%s err_mask=%s",
317 __entry->ata_port, __entry->ata_dev, __entry->tag,
318 __parse_qc_flags(__entry->qc_flags),
319 __parse_eh_err_mask(__entry->eh_err_mask))
320);
321
322#endif /* _TRACE_LIBATA_H */
323
324/* This part must be outside protection */
325#include <trace/define_trace.h>
diff --git a/include/trace/events/migrate.h b/include/trace/events/migrate.h
index dd2b5467d905..539b25a76111 100644
--- a/include/trace/events/migrate.h
+++ b/include/trace/events/migrate.h
@@ -7,18 +7,40 @@
7#include <linux/tracepoint.h> 7#include <linux/tracepoint.h>
8 8
9#define MIGRATE_MODE \ 9#define MIGRATE_MODE \
10 {MIGRATE_ASYNC, "MIGRATE_ASYNC"}, \ 10 EM( MIGRATE_ASYNC, "MIGRATE_ASYNC") \
11 {MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT"}, \ 11 EM( MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT") \
12 {MIGRATE_SYNC, "MIGRATE_SYNC"} 12 EMe(MIGRATE_SYNC, "MIGRATE_SYNC")
13
13 14
14#define MIGRATE_REASON \ 15#define MIGRATE_REASON \
15 {MR_COMPACTION, "compaction"}, \ 16 EM( MR_COMPACTION, "compaction") \
16 {MR_MEMORY_FAILURE, "memory_failure"}, \ 17 EM( MR_MEMORY_FAILURE, "memory_failure") \
17 {MR_MEMORY_HOTPLUG, "memory_hotplug"}, \ 18 EM( MR_MEMORY_HOTPLUG, "memory_hotplug") \
18 {MR_SYSCALL, "syscall_or_cpuset"}, \ 19 EM( MR_SYSCALL, "syscall_or_cpuset") \
19 {MR_MEMPOLICY_MBIND, "mempolicy_mbind"}, \ 20 EM( MR_MEMPOLICY_MBIND, "mempolicy_mbind") \
20 {MR_NUMA_MISPLACED, "numa_misplaced"}, \ 21 EM( MR_NUMA_MISPLACED, "numa_misplaced") \
21 {MR_CMA, "cma"} 22 EMe(MR_CMA, "cma")
23
24/*
25 * First define the enums in the above macros to be exported to userspace
26 * via TRACE_DEFINE_ENUM().
27 */
28#undef EM
29#undef EMe
30#define EM(a, b) TRACE_DEFINE_ENUM(a);
31#define EMe(a, b) TRACE_DEFINE_ENUM(a);
32
33MIGRATE_MODE
34MIGRATE_REASON
35
36/*
37 * Now redefine the EM() and EMe() macros to map the enums to the strings
38 * that will be printed in the output.
39 */
40#undef EM
41#undef EMe
42#define EM(a, b) {a, b},
43#define EMe(a, b) {a, b}
22 44
23TRACE_EVENT(mm_migrate_pages, 45TRACE_EVENT(mm_migrate_pages,
24 46
diff --git a/include/trace/events/module.h b/include/trace/events/module.h
index 81c4c183d348..28c45997e451 100644
--- a/include/trace/events/module.h
+++ b/include/trace/events/module.h
@@ -84,7 +84,7 @@ DECLARE_EVENT_CLASS(module_refcnt,
84 __assign_str(name, mod->name); 84 __assign_str(name, mod->name);
85 ), 85 ),
86 86
87 TP_printk("%s call_site=%pf refcnt=%d", 87 TP_printk("%s call_site=%ps refcnt=%d",
88 __get_str(name), (void *)__entry->ip, __entry->refcnt) 88 __get_str(name), (void *)__entry->ip, __entry->refcnt)
89); 89);
90 90
@@ -121,7 +121,7 @@ TRACE_EVENT(module_request,
121 __assign_str(name, name); 121 __assign_str(name, name);
122 ), 122 ),
123 123
124 TP_printk("%s wait=%d call_site=%pf", 124 TP_printk("%s wait=%d call_site=%ps",
125 __get_str(name), (int)__entry->wait, (void *)__entry->ip) 125 __get_str(name), (int)__entry->wait, (void *)__entry->ip)
126); 126);
127 127
diff --git a/include/trace/events/random.h b/include/trace/events/random.h
index 805af6db41cc..4684de344c5d 100644
--- a/include/trace/events/random.h
+++ b/include/trace/events/random.h
@@ -22,7 +22,7 @@ TRACE_EVENT(add_device_randomness,
22 __entry->IP = IP; 22 __entry->IP = IP;
23 ), 23 ),
24 24
25 TP_printk("bytes %d caller %pF", 25 TP_printk("bytes %d caller %pS",
26 __entry->bytes, (void *)__entry->IP) 26 __entry->bytes, (void *)__entry->IP)
27); 27);
28 28
@@ -43,7 +43,7 @@ DECLARE_EVENT_CLASS(random__mix_pool_bytes,
43 __entry->IP = IP; 43 __entry->IP = IP;
44 ), 44 ),
45 45
46 TP_printk("%s pool: bytes %d caller %pF", 46 TP_printk("%s pool: bytes %d caller %pS",
47 __entry->pool_name, __entry->bytes, (void *)__entry->IP) 47 __entry->pool_name, __entry->bytes, (void *)__entry->IP)
48); 48);
49 49
@@ -82,7 +82,7 @@ TRACE_EVENT(credit_entropy_bits,
82 ), 82 ),
83 83
84 TP_printk("%s pool: bits %d entropy_count %d entropy_total %d " 84 TP_printk("%s pool: bits %d entropy_count %d entropy_total %d "
85 "caller %pF", __entry->pool_name, __entry->bits, 85 "caller %pS", __entry->pool_name, __entry->bits,
86 __entry->entropy_count, __entry->entropy_total, 86 __entry->entropy_count, __entry->entropy_total,
87 (void *)__entry->IP) 87 (void *)__entry->IP)
88); 88);
@@ -207,7 +207,7 @@ DECLARE_EVENT_CLASS(random__get_random_bytes,
207 __entry->IP = IP; 207 __entry->IP = IP;
208 ), 208 ),
209 209
210 TP_printk("nbytes %d caller %pF", __entry->nbytes, (void *)__entry->IP) 210 TP_printk("nbytes %d caller %pS", __entry->nbytes, (void *)__entry->IP)
211); 211);
212 212
213DEFINE_EVENT(random__get_random_bytes, get_random_bytes, 213DEFINE_EVENT(random__get_random_bytes, get_random_bytes,
@@ -242,7 +242,7 @@ DECLARE_EVENT_CLASS(random__extract_entropy,
242 __entry->IP = IP; 242 __entry->IP = IP;
243 ), 243 ),
244 244
245 TP_printk("%s pool: nbytes %d entropy_count %d caller %pF", 245 TP_printk("%s pool: nbytes %d entropy_count %d caller %pS",
246 __entry->pool_name, __entry->nbytes, __entry->entropy_count, 246 __entry->pool_name, __entry->nbytes, __entry->entropy_count,
247 (void *)__entry->IP) 247 (void *)__entry->IP)
248); 248);
diff --git a/include/trace/events/regmap.h b/include/trace/events/regmap.h
deleted file mode 100644
index 23d561512f64..000000000000
--- a/include/trace/events/regmap.h
+++ /dev/null
@@ -1,252 +0,0 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM regmap
3
4#if !defined(_TRACE_REGMAP_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_REGMAP_H
6
7#include <linux/ktime.h>
8#include <linux/tracepoint.h>
9
10struct device;
11struct regmap;
12
13/*
14 * Log register events
15 */
16DECLARE_EVENT_CLASS(regmap_reg,
17
18 TP_PROTO(struct device *dev, unsigned int reg,
19 unsigned int val),
20
21 TP_ARGS(dev, reg, val),
22
23 TP_STRUCT__entry(
24 __string( name, dev_name(dev) )
25 __field( unsigned int, reg )
26 __field( unsigned int, val )
27 ),
28
29 TP_fast_assign(
30 __assign_str(name, dev_name(dev));
31 __entry->reg = reg;
32 __entry->val = val;
33 ),
34
35 TP_printk("%s reg=%x val=%x", __get_str(name),
36 (unsigned int)__entry->reg,
37 (unsigned int)__entry->val)
38);
39
40DEFINE_EVENT(regmap_reg, regmap_reg_write,
41
42 TP_PROTO(struct device *dev, unsigned int reg,
43 unsigned int val),
44
45 TP_ARGS(dev, reg, val)
46
47);
48
49DEFINE_EVENT(regmap_reg, regmap_reg_read,
50
51 TP_PROTO(struct device *dev, unsigned int reg,
52 unsigned int val),
53
54 TP_ARGS(dev, reg, val)
55
56);
57
58DEFINE_EVENT(regmap_reg, regmap_reg_read_cache,
59
60 TP_PROTO(struct device *dev, unsigned int reg,
61 unsigned int val),
62
63 TP_ARGS(dev, reg, val)
64
65);
66
67DECLARE_EVENT_CLASS(regmap_block,
68
69 TP_PROTO(struct device *dev, unsigned int reg, int count),
70
71 TP_ARGS(dev, reg, count),
72
73 TP_STRUCT__entry(
74 __string( name, dev_name(dev) )
75 __field( unsigned int, reg )
76 __field( int, count )
77 ),
78
79 TP_fast_assign(
80 __assign_str(name, dev_name(dev));
81 __entry->reg = reg;
82 __entry->count = count;
83 ),
84
85 TP_printk("%s reg=%x count=%d", __get_str(name),
86 (unsigned int)__entry->reg,
87 (int)__entry->count)
88);
89
90DEFINE_EVENT(regmap_block, regmap_hw_read_start,
91
92 TP_PROTO(struct device *dev, unsigned int reg, int count),
93
94 TP_ARGS(dev, reg, count)
95);
96
97DEFINE_EVENT(regmap_block, regmap_hw_read_done,
98
99 TP_PROTO(struct device *dev, unsigned int reg, int count),
100
101 TP_ARGS(dev, reg, count)
102);
103
104DEFINE_EVENT(regmap_block, regmap_hw_write_start,
105
106 TP_PROTO(struct device *dev, unsigned int reg, int count),
107
108 TP_ARGS(dev, reg, count)
109);
110
111DEFINE_EVENT(regmap_block, regmap_hw_write_done,
112
113 TP_PROTO(struct device *dev, unsigned int reg, int count),
114
115 TP_ARGS(dev, reg, count)
116);
117
118TRACE_EVENT(regcache_sync,
119
120 TP_PROTO(struct device *dev, const char *type,
121 const char *status),
122
123 TP_ARGS(dev, type, status),
124
125 TP_STRUCT__entry(
126 __string( name, dev_name(dev) )
127 __string( status, status )
128 __string( type, type )
129 __field( int, type )
130 ),
131
132 TP_fast_assign(
133 __assign_str(name, dev_name(dev));
134 __assign_str(status, status);
135 __assign_str(type, type);
136 ),
137
138 TP_printk("%s type=%s status=%s", __get_str(name),
139 __get_str(type), __get_str(status))
140);
141
142DECLARE_EVENT_CLASS(regmap_bool,
143
144 TP_PROTO(struct device *dev, bool flag),
145
146 TP_ARGS(dev, flag),
147
148 TP_STRUCT__entry(
149 __string( name, dev_name(dev) )
150 __field( int, flag )
151 ),
152
153 TP_fast_assign(
154 __assign_str(name, dev_name(dev));
155 __entry->flag = flag;
156 ),
157
158 TP_printk("%s flag=%d", __get_str(name),
159 (int)__entry->flag)
160);
161
162DEFINE_EVENT(regmap_bool, regmap_cache_only,
163
164 TP_PROTO(struct device *dev, bool flag),
165
166 TP_ARGS(dev, flag)
167
168);
169
170DEFINE_EVENT(regmap_bool, regmap_cache_bypass,
171
172 TP_PROTO(struct device *dev, bool flag),
173
174 TP_ARGS(dev, flag)
175
176);
177
178DECLARE_EVENT_CLASS(regmap_async,
179
180 TP_PROTO(struct device *dev),
181
182 TP_ARGS(dev),
183
184 TP_STRUCT__entry(
185 __string( name, dev_name(dev) )
186 ),
187
188 TP_fast_assign(
189 __assign_str(name, dev_name(dev));
190 ),
191
192 TP_printk("%s", __get_str(name))
193);
194
195DEFINE_EVENT(regmap_block, regmap_async_write_start,
196
197 TP_PROTO(struct device *dev, unsigned int reg, int count),
198
199 TP_ARGS(dev, reg, count)
200);
201
202DEFINE_EVENT(regmap_async, regmap_async_io_complete,
203
204 TP_PROTO(struct device *dev),
205
206 TP_ARGS(dev)
207
208);
209
210DEFINE_EVENT(regmap_async, regmap_async_complete_start,
211
212 TP_PROTO(struct device *dev),
213
214 TP_ARGS(dev)
215
216);
217
218DEFINE_EVENT(regmap_async, regmap_async_complete_done,
219
220 TP_PROTO(struct device *dev),
221
222 TP_ARGS(dev)
223
224);
225
226TRACE_EVENT(regcache_drop_region,
227
228 TP_PROTO(struct device *dev, unsigned int from,
229 unsigned int to),
230
231 TP_ARGS(dev, from, to),
232
233 TP_STRUCT__entry(
234 __string( name, dev_name(dev) )
235 __field( unsigned int, from )
236 __field( unsigned int, to )
237 ),
238
239 TP_fast_assign(
240 __assign_str(name, dev_name(dev));
241 __entry->from = from;
242 __entry->to = to;
243 ),
244
245 TP_printk("%s %u-%u", __get_str(name), (unsigned int)__entry->from,
246 (unsigned int)__entry->to)
247);
248
249#endif /* _TRACE_REGMAP_H */
250
251/* This part must be outside protection */
252#include <trace/define_trace.h>
diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
index b9c1dc6c825a..fd1a02cb3c82 100644
--- a/include/trace/events/sunrpc.h
+++ b/include/trace/events/sunrpc.h
@@ -179,27 +179,53 @@ DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup,
179 179
180); 180);
181 181
182/*
183 * First define the enums in the below macros to be exported to userspace
184 * via TRACE_DEFINE_ENUM().
185 */
186#undef EM
187#undef EMe
188#define EM(a, b) TRACE_DEFINE_ENUM(a);
189#define EMe(a, b) TRACE_DEFINE_ENUM(a);
190
191#define RPC_SHOW_SOCKET \
192 EM( SS_FREE, "FREE" ) \
193 EM( SS_UNCONNECTED, "UNCONNECTED" ) \
194 EM( SS_CONNECTING, "CONNECTING," ) \
195 EM( SS_CONNECTED, "CONNECTED," ) \
196 EMe(SS_DISCONNECTING, "DISCONNECTING" )
197
182#define rpc_show_socket_state(state) \ 198#define rpc_show_socket_state(state) \
183 __print_symbolic(state, \ 199 __print_symbolic(state, RPC_SHOW_SOCKET)
184 { SS_FREE, "FREE" }, \ 200
185 { SS_UNCONNECTED, "UNCONNECTED" }, \ 201RPC_SHOW_SOCKET
186 { SS_CONNECTING, "CONNECTING," }, \ 202
187 { SS_CONNECTED, "CONNECTED," }, \ 203#define RPC_SHOW_SOCK \
188 { SS_DISCONNECTING, "DISCONNECTING" }) 204 EM( TCP_ESTABLISHED, "ESTABLISHED" ) \
205 EM( TCP_SYN_SENT, "SYN_SENT" ) \
206 EM( TCP_SYN_RECV, "SYN_RECV" ) \
207 EM( TCP_FIN_WAIT1, "FIN_WAIT1" ) \
208 EM( TCP_FIN_WAIT2, "FIN_WAIT2" ) \
209 EM( TCP_TIME_WAIT, "TIME_WAIT" ) \
210 EM( TCP_CLOSE, "CLOSE" ) \
211 EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" ) \
212 EM( TCP_LAST_ACK, "LAST_ACK" ) \
213 EM( TCP_LISTEN, "LISTEN" ) \
214 EMe( TCP_CLOSING, "CLOSING" )
189 215
190#define rpc_show_sock_state(state) \ 216#define rpc_show_sock_state(state) \
191 __print_symbolic(state, \ 217 __print_symbolic(state, RPC_SHOW_SOCK)
192 { TCP_ESTABLISHED, "ESTABLISHED" }, \ 218
193 { TCP_SYN_SENT, "SYN_SENT" }, \ 219RPC_SHOW_SOCK
194 { TCP_SYN_RECV, "SYN_RECV" }, \ 220
195 { TCP_FIN_WAIT1, "FIN_WAIT1" }, \ 221/*
196 { TCP_FIN_WAIT2, "FIN_WAIT2" }, \ 222 * Now redefine the EM() and EMe() macros to map the enums to the strings
197 { TCP_TIME_WAIT, "TIME_WAIT" }, \ 223 * that will be printed in the output.
198 { TCP_CLOSE, "CLOSE" }, \ 224 */
199 { TCP_CLOSE_WAIT, "CLOSE_WAIT" }, \ 225#undef EM
200 { TCP_LAST_ACK, "LAST_ACK" }, \ 226#undef EMe
201 { TCP_LISTEN, "LISTEN" }, \ 227#define EM(a, b) {a, b},
202 { TCP_CLOSING, "CLOSING" }) 228#define EMe(a, b) {a, b}
203 229
204DECLARE_EVENT_CLASS(xs_socket_event, 230DECLARE_EVENT_CLASS(xs_socket_event,
205 231
diff --git a/include/trace/events/tlb.h b/include/trace/events/tlb.h
index 0e7635765153..4250f364a6ca 100644
--- a/include/trace/events/tlb.h
+++ b/include/trace/events/tlb.h
@@ -7,11 +7,31 @@
7#include <linux/mm_types.h> 7#include <linux/mm_types.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9 9
10#define TLB_FLUSH_REASON \ 10#define TLB_FLUSH_REASON \
11 { TLB_FLUSH_ON_TASK_SWITCH, "flush on task switch" }, \ 11 EM( TLB_FLUSH_ON_TASK_SWITCH, "flush on task switch" ) \
12 { TLB_REMOTE_SHOOTDOWN, "remote shootdown" }, \ 12 EM( TLB_REMOTE_SHOOTDOWN, "remote shootdown" ) \
13 { TLB_LOCAL_SHOOTDOWN, "local shootdown" }, \ 13 EM( TLB_LOCAL_SHOOTDOWN, "local shootdown" ) \
14 { TLB_LOCAL_MM_SHOOTDOWN, "local mm shootdown" } 14 EMe( TLB_LOCAL_MM_SHOOTDOWN, "local mm shootdown" )
15
16/*
17 * First define the enums in TLB_FLUSH_REASON to be exported to userspace
18 * via TRACE_DEFINE_ENUM().
19 */
20#undef EM
21#undef EMe
22#define EM(a,b) TRACE_DEFINE_ENUM(a);
23#define EMe(a,b) TRACE_DEFINE_ENUM(a);
24
25TLB_FLUSH_REASON
26
27/*
28 * Now redefine the EM() and EMe() macros to map the enums to the strings
29 * that will be printed in the output.
30 */
31#undef EM
32#undef EMe
33#define EM(a,b) { a, b },
34#define EMe(a,b) { a, b }
15 35
16TRACE_EVENT_CONDITION(tlb_flush, 36TRACE_EVENT_CONDITION(tlb_flush,
17 37
diff --git a/include/trace/events/v4l2.h b/include/trace/events/v4l2.h
index b9bb1f204693..20112170ff11 100644
--- a/include/trace/events/v4l2.h
+++ b/include/trace/events/v4l2.h
@@ -6,33 +6,58 @@
6 6
7#include <linux/tracepoint.h> 7#include <linux/tracepoint.h>
8 8
9#define show_type(type) \ 9/* Enums require being exported to userspace, for user tool parsing */
10 __print_symbolic(type, \ 10#undef EM
11 { V4L2_BUF_TYPE_VIDEO_CAPTURE, "VIDEO_CAPTURE" }, \ 11#undef EMe
12 { V4L2_BUF_TYPE_VIDEO_OUTPUT, "VIDEO_OUTPUT" }, \ 12#define EM(a, b) TRACE_DEFINE_ENUM(a);
13 { V4L2_BUF_TYPE_VIDEO_OVERLAY, "VIDEO_OVERLAY" }, \ 13#define EMe(a, b) TRACE_DEFINE_ENUM(a);
14 { V4L2_BUF_TYPE_VBI_CAPTURE, "VBI_CAPTURE" }, \ 14
15 { V4L2_BUF_TYPE_VBI_OUTPUT, "VBI_OUTPUT" }, \ 15#define show_type(type) \
16 { V4L2_BUF_TYPE_SLICED_VBI_CAPTURE, "SLICED_VBI_CAPTURE" }, \ 16 __print_symbolic(type, SHOW_TYPE)
17 { V4L2_BUF_TYPE_SLICED_VBI_OUTPUT, "SLICED_VBI_OUTPUT" }, \ 17
18 { V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" },\ 18#define SHOW_TYPE \
19 { V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" },\ 19 EM( V4L2_BUF_TYPE_VIDEO_CAPTURE, "VIDEO_CAPTURE" ) \
20 { V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, "VIDEO_OUTPUT_MPLANE" }, \ 20 EM( V4L2_BUF_TYPE_VIDEO_OUTPUT, "VIDEO_OUTPUT" ) \
21 { V4L2_BUF_TYPE_SDR_CAPTURE, "SDR_CAPTURE" }, \ 21 EM( V4L2_BUF_TYPE_VIDEO_OVERLAY, "VIDEO_OVERLAY" ) \
22 { V4L2_BUF_TYPE_PRIVATE, "PRIVATE" }) 22 EM( V4L2_BUF_TYPE_VBI_CAPTURE, "VBI_CAPTURE" ) \
23 EM( V4L2_BUF_TYPE_VBI_OUTPUT, "VBI_OUTPUT" ) \
24 EM( V4L2_BUF_TYPE_SLICED_VBI_CAPTURE, "SLICED_VBI_CAPTURE" ) \
25 EM( V4L2_BUF_TYPE_SLICED_VBI_OUTPUT, "SLICED_VBI_OUTPUT" ) \
26 EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" ) \
27 EM( V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" ) \
28 EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, "VIDEO_OUTPUT_MPLANE" ) \
29 EM( V4L2_BUF_TYPE_SDR_CAPTURE, "SDR_CAPTURE" ) \
30 EMe(V4L2_BUF_TYPE_PRIVATE, "PRIVATE" )
31
32SHOW_TYPE
23 33
24#define show_field(field) \ 34#define show_field(field) \
25 __print_symbolic(field, \ 35 __print_symbolic(field, SHOW_FIELD)
26 { V4L2_FIELD_ANY, "ANY" }, \ 36
27 { V4L2_FIELD_NONE, "NONE" }, \ 37#define SHOW_FIELD \
28 { V4L2_FIELD_TOP, "TOP" }, \ 38 EM( V4L2_FIELD_ANY, "ANY" ) \
29 { V4L2_FIELD_BOTTOM, "BOTTOM" }, \ 39 EM( V4L2_FIELD_NONE, "NONE" ) \
30 { V4L2_FIELD_INTERLACED, "INTERLACED" }, \ 40 EM( V4L2_FIELD_TOP, "TOP" ) \
31 { V4L2_FIELD_SEQ_TB, "SEQ_TB" }, \ 41 EM( V4L2_FIELD_BOTTOM, "BOTTOM" ) \
32 { V4L2_FIELD_SEQ_BT, "SEQ_BT" }, \ 42 EM( V4L2_FIELD_INTERLACED, "INTERLACED" ) \
33 { V4L2_FIELD_ALTERNATE, "ALTERNATE" }, \ 43 EM( V4L2_FIELD_SEQ_TB, "SEQ_TB" ) \
34 { V4L2_FIELD_INTERLACED_TB, "INTERLACED_TB" }, \ 44 EM( V4L2_FIELD_SEQ_BT, "SEQ_BT" ) \
35 { V4L2_FIELD_INTERLACED_BT, "INTERLACED_BT" }) 45 EM( V4L2_FIELD_ALTERNATE, "ALTERNATE" ) \
46 EM( V4L2_FIELD_INTERLACED_TB, "INTERLACED_TB" ) \
47 EMe( V4L2_FIELD_INTERLACED_BT, "INTERLACED_BT" )
48
49SHOW_FIELD
50
51/*
52 * Now redefine the EM() and EMe() macros to map the enums to the strings
53 * that will be printed in the output.
54 */
55#undef EM
56#undef EMe
57#define EM(a, b) {a, b},
58#define EMe(a, b) {a, b}
59
60/* V4L2_TC_TYPE_* are macros, not defines, they do not need processing */
36 61
37#define show_timecode_type(type) \ 62#define show_timecode_type(type) \
38 __print_symbolic(type, \ 63 __print_symbolic(type, \
diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
index 69590b6ffc09..f66476b96264 100644
--- a/include/trace/events/vmscan.h
+++ b/include/trace/events/vmscan.h
@@ -336,18 +336,18 @@ TRACE_EVENT(mm_vmscan_writepage,
336 TP_ARGS(page, reclaim_flags), 336 TP_ARGS(page, reclaim_flags),
337 337
338 TP_STRUCT__entry( 338 TP_STRUCT__entry(
339 __field(struct page *, page) 339 __field(unsigned long, pfn)
340 __field(int, reclaim_flags) 340 __field(int, reclaim_flags)
341 ), 341 ),
342 342
343 TP_fast_assign( 343 TP_fast_assign(
344 __entry->page = page; 344 __entry->pfn = page_to_pfn(page);
345 __entry->reclaim_flags = reclaim_flags; 345 __entry->reclaim_flags = reclaim_flags;
346 ), 346 ),
347 347
348 TP_printk("page=%p pfn=%lu flags=%s", 348 TP_printk("page=%p pfn=%lu flags=%s",
349 __entry->page, 349 pfn_to_page(__entry->pfn),
350 page_to_pfn(__entry->page), 350 __entry->pfn,
351 show_reclaim_flags(__entry->reclaim_flags)) 351 show_reclaim_flags(__entry->reclaim_flags))
352); 352);
353 353
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index 5a14ead59696..880dd7437172 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -23,15 +23,32 @@
23 {I_REFERENCED, "I_REFERENCED"} \ 23 {I_REFERENCED, "I_REFERENCED"} \
24 ) 24 )
25 25
26/* enums need to be exported to user space */
27#undef EM
28#undef EMe
29#define EM(a,b) TRACE_DEFINE_ENUM(a);
30#define EMe(a,b) TRACE_DEFINE_ENUM(a);
31
26#define WB_WORK_REASON \ 32#define WB_WORK_REASON \
27 {WB_REASON_BACKGROUND, "background"}, \ 33 EM( WB_REASON_BACKGROUND, "background") \
28 {WB_REASON_TRY_TO_FREE_PAGES, "try_to_free_pages"}, \ 34 EM( WB_REASON_TRY_TO_FREE_PAGES, "try_to_free_pages") \
29 {WB_REASON_SYNC, "sync"}, \ 35 EM( WB_REASON_SYNC, "sync") \
30 {WB_REASON_PERIODIC, "periodic"}, \ 36 EM( WB_REASON_PERIODIC, "periodic") \
31 {WB_REASON_LAPTOP_TIMER, "laptop_timer"}, \ 37 EM( WB_REASON_LAPTOP_TIMER, "laptop_timer") \
32 {WB_REASON_FREE_MORE_MEM, "free_more_memory"}, \ 38 EM( WB_REASON_FREE_MORE_MEM, "free_more_memory") \
33 {WB_REASON_FS_FREE_SPACE, "fs_free_space"}, \ 39 EM( WB_REASON_FS_FREE_SPACE, "fs_free_space") \
34 {WB_REASON_FORKER_THREAD, "forker_thread"} 40 EMe(WB_REASON_FORKER_THREAD, "forker_thread")
41
42WB_WORK_REASON
43
44/*
45 * Now redefine the EM() and EMe() macros to map the enums to the strings
46 * that will be printed in the output.
47 */
48#undef EM
49#undef EMe
50#define EM(a,b) { a, b },
51#define EMe(a,b) { a, b }
35 52
36struct wb_writeback_work; 53struct wb_writeback_work;
37 54
diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h
index d06b6da5c1e3..bce990f5a35d 100644
--- a/include/trace/events/xen.h
+++ b/include/trace/events/xen.h
@@ -224,7 +224,7 @@ TRACE_EVENT(xen_mmu_pmd_clear,
224 TP_printk("pmdp %p", __entry->pmdp) 224 TP_printk("pmdp %p", __entry->pmdp)
225 ); 225 );
226 226
227#if PAGETABLE_LEVELS >= 4 227#if CONFIG_PGTABLE_LEVELS >= 4
228 228
229TRACE_EVENT(xen_mmu_set_pud, 229TRACE_EVENT(xen_mmu_set_pud,
230 TP_PROTO(pud_t *pudp, pud_t pudval), 230 TP_PROTO(pud_t *pudp, pud_t pudval),
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 41bf65f04dd9..37d4b10b111d 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -18,6 +18,34 @@
18 18
19#include <linux/ftrace_event.h> 19#include <linux/ftrace_event.h>
20 20
21#ifndef TRACE_SYSTEM_VAR
22#define TRACE_SYSTEM_VAR TRACE_SYSTEM
23#endif
24
25#define __app__(x, y) str__##x##y
26#define __app(x, y) __app__(x, y)
27
28#define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
29
30#define TRACE_MAKE_SYSTEM_STR() \
31 static const char TRACE_SYSTEM_STRING[] = \
32 __stringify(TRACE_SYSTEM)
33
34TRACE_MAKE_SYSTEM_STR();
35
36#undef TRACE_DEFINE_ENUM
37#define TRACE_DEFINE_ENUM(a) \
38 static struct trace_enum_map __used __initdata \
39 __##TRACE_SYSTEM##_##a = \
40 { \
41 .system = TRACE_SYSTEM_STRING, \
42 .enum_string = #a, \
43 .enum_value = a \
44 }; \
45 static struct trace_enum_map __used \
46 __attribute__((section("_ftrace_enum_map"))) \
47 *TRACE_SYSTEM##_##a = &__##TRACE_SYSTEM##_##a
48
21/* 49/*
22 * DECLARE_EVENT_CLASS can be used to add a generic function 50 * DECLARE_EVENT_CLASS can be used to add a generic function
23 * handlers for events. That is, if all events have the same 51 * handlers for events. That is, if all events have the same
@@ -105,7 +133,6 @@
105 133
106#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 134#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
107 135
108
109/* 136/*
110 * Stage 2 of the trace events. 137 * Stage 2 of the trace events.
111 * 138 *
@@ -122,6 +149,9 @@
122 * The size of an array is also encoded, in the higher 16 bits of <item>. 149 * The size of an array is also encoded, in the higher 16 bits of <item>.
123 */ 150 */
124 151
152#undef TRACE_DEFINE_ENUM
153#define TRACE_DEFINE_ENUM(a)
154
125#undef __field 155#undef __field
126#define __field(type, item) 156#define __field(type, item)
127 157
@@ -539,7 +569,7 @@ static inline notrace int ftrace_get_offsets_##call( \
539 * .trace = ftrace_raw_output_<call>, <-- stage 2 569 * .trace = ftrace_raw_output_<call>, <-- stage 2
540 * }; 570 * };
541 * 571 *
542 * static const char print_fmt_<call>[] = <TP_printk>; 572 * static char print_fmt_<call>[] = <TP_printk>;
543 * 573 *
544 * static struct ftrace_event_class __used event_class_<template> = { 574 * static struct ftrace_event_class __used event_class_<template> = {
545 * .system = "<system>", 575 * .system = "<system>",
@@ -690,9 +720,9 @@ static inline void ftrace_test_probe_##call(void) \
690#undef DECLARE_EVENT_CLASS 720#undef DECLARE_EVENT_CLASS
691#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 721#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
692_TRACE_PERF_PROTO(call, PARAMS(proto)); \ 722_TRACE_PERF_PROTO(call, PARAMS(proto)); \
693static const char print_fmt_##call[] = print; \ 723static char print_fmt_##call[] = print; \
694static struct ftrace_event_class __used __refdata event_class_##call = { \ 724static struct ftrace_event_class __used __refdata event_class_##call = { \
695 .system = __stringify(TRACE_SYSTEM), \ 725 .system = TRACE_SYSTEM_STRING, \
696 .define_fields = ftrace_define_fields_##call, \ 726 .define_fields = ftrace_define_fields_##call, \
697 .fields = LIST_HEAD_INIT(event_class_##call.fields),\ 727 .fields = LIST_HEAD_INIT(event_class_##call.fields),\
698 .raw_init = trace_event_raw_init, \ 728 .raw_init = trace_event_raw_init, \
@@ -719,7 +749,7 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
719#undef DEFINE_EVENT_PRINT 749#undef DEFINE_EVENT_PRINT
720#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ 750#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
721 \ 751 \
722static const char print_fmt_##call[] = print; \ 752static char print_fmt_##call[] = print; \
723 \ 753 \
724static struct ftrace_event_call __used event_##call = { \ 754static struct ftrace_event_call __used event_##call = { \
725 .class = &event_class_##template, \ 755 .class = &event_class_##template, \
@@ -735,6 +765,7 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
735 765
736#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 766#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
737 767
768#undef TRACE_SYSTEM_VAR
738 769
739#ifdef CONFIG_PERF_EVENTS 770#ifdef CONFIG_PERF_EVENTS
740 771
diff --git a/include/uapi/asm-generic/errno.h b/include/uapi/asm-generic/errno.h
index 1e1ea6e6e7a5..88e0914cf2d9 100644
--- a/include/uapi/asm-generic/errno.h
+++ b/include/uapi/asm-generic/errno.h
@@ -6,7 +6,16 @@
6#define EDEADLK 35 /* Resource deadlock would occur */ 6#define EDEADLK 35 /* Resource deadlock would occur */
7#define ENAMETOOLONG 36 /* File name too long */ 7#define ENAMETOOLONG 36 /* File name too long */
8#define ENOLCK 37 /* No record locks available */ 8#define ENOLCK 37 /* No record locks available */
9#define ENOSYS 38 /* Function not implemented */ 9
10/*
11 * This error code is special: arch syscall entry code will return
12 * -ENOSYS if users try to call a syscall that doesn't exist. To keep
13 * failures of syscalls that really do exist distinguishable from
14 * failures due to attempts to use a nonexistent syscall, syscall
15 * implementations should refrain from returning -ENOSYS.
16 */
17#define ENOSYS 38 /* Invalid system call number */
18
10#define ENOTEMPTY 39 /* Directory not empty */ 19#define ENOTEMPTY 39 /* Directory not empty */
11#define ELOOP 40 /* Too many symbolic links encountered */ 20#define ELOOP 40 /* Too many symbolic links encountered */
12#define EWOULDBLOCK EAGAIN /* Operation would block */ 21#define EWOULDBLOCK EAGAIN /* Operation would block */
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 01b2d6d0e355..ff6ef62d084b 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -630,6 +630,7 @@ struct drm_gem_open {
630 */ 630 */
631#define DRM_CAP_CURSOR_WIDTH 0x8 631#define DRM_CAP_CURSOR_WIDTH 0x8
632#define DRM_CAP_CURSOR_HEIGHT 0x9 632#define DRM_CAP_CURSOR_HEIGHT 0x9
633#define DRM_CAP_ADDFB2_MODIFIERS 0x10
633 634
634/** DRM_IOCTL_GET_CAP ioctl argument type */ 635/** DRM_IOCTL_GET_CAP ioctl argument type */
635struct drm_get_cap { 636struct drm_get_cap {
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index a284f11a8ef5..07735822a28f 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -129,4 +129,82 @@
129#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ 129#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */
130#define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ 130#define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
131 131
132
133/*
134 * Format Modifiers:
135 *
136 * Format modifiers describe, typically, a re-ordering or modification
137 * of the data in a plane of an FB. This can be used to express tiled/
138 * swizzled formats, or compression, or a combination of the two.
139 *
140 * The upper 8 bits of the format modifier are a vendor-id as assigned
141 * below. The lower 56 bits are assigned as vendor sees fit.
142 */
143
144/* Vendor Ids: */
145#define DRM_FORMAT_MOD_NONE 0
146#define DRM_FORMAT_MOD_VENDOR_INTEL 0x01
147#define DRM_FORMAT_MOD_VENDOR_AMD 0x02
148#define DRM_FORMAT_MOD_VENDOR_NV 0x03
149#define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04
150#define DRM_FORMAT_MOD_VENDOR_QCOM 0x05
151/* add more to the end as needed */
152
153#define fourcc_mod_code(vendor, val) \
154 ((((u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | (val & 0x00ffffffffffffffULL))
155
156/*
157 * Format Modifier tokens:
158 *
159 * When adding a new token please document the layout with a code comment,
160 * similar to the fourcc codes above. drm_fourcc.h is considered the
161 * authoritative source for all of these.
162 */
163
164/* Intel framebuffer modifiers */
165
166/*
167 * Intel X-tiling layout
168 *
169 * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb)
170 * in row-major layout. Within the tile bytes are laid out row-major, with
171 * a platform-dependent stride. On top of that the memory can apply
172 * platform-depending swizzling of some higher address bits into bit6.
173 *
174 * This format is highly platforms specific and not useful for cross-driver
175 * sharing. It exists since on a given platform it does uniquely identify the
176 * layout in a simple way for i915-specific userspace.
177 */
178#define I915_FORMAT_MOD_X_TILED fourcc_mod_code(INTEL, 1)
179
180/*
181 * Intel Y-tiling layout
182 *
183 * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb)
184 * in row-major layout. Within the tile bytes are laid out in OWORD (16 bytes)
185 * chunks column-major, with a platform-dependent height. On top of that the
186 * memory can apply platform-depending swizzling of some higher address bits
187 * into bit6.
188 *
189 * This format is highly platforms specific and not useful for cross-driver
190 * sharing. It exists since on a given platform it does uniquely identify the
191 * layout in a simple way for i915-specific userspace.
192 */
193#define I915_FORMAT_MOD_Y_TILED fourcc_mod_code(INTEL, 2)
194
195/*
196 * Intel Yf-tiling layout
197 *
198 * This is a tiled layout using 4Kb tiles in row-major layout.
199 * Within the tile pixels are laid out in 16 256 byte units / sub-tiles which
200 * are arranged in four groups (two wide, two high) with column-major layout.
201 * Each group therefore consits out of four 256 byte units, which are also laid
202 * out as 2x2 column-major.
203 * 256 byte units are made out of four 64 byte blocks of pixels, producing
204 * either a square block or a 2:1 unit.
205 * 64 byte blocks of pixels contain four pixel rows of 16 bytes, where the width
206 * in pixel depends on the pixel depth.
207 */
208#define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3)
209
132#endif /* DRM_FOURCC_H */ 210#endif /* DRM_FOURCC_H */
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index ca788e01dab2..dbeba949462a 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -336,6 +336,7 @@ struct drm_mode_fb_cmd {
336}; 336};
337 337
338#define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */ 338#define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */
339#define DRM_MODE_FB_MODIFIERS (1<<1) /* enables ->modifer[] */
339 340
340struct drm_mode_fb_cmd2 { 341struct drm_mode_fb_cmd2 {
341 __u32 fb_id; 342 __u32 fb_id;
@@ -356,10 +357,18 @@ struct drm_mode_fb_cmd2 {
356 * So it would consist of Y as offsets[0] and UV as 357 * So it would consist of Y as offsets[0] and UV as
357 * offsets[1]. Note that offsets[0] will generally 358 * offsets[1]. Note that offsets[0] will generally
358 * be 0 (but this is not required). 359 * be 0 (but this is not required).
360 *
361 * To accommodate tiled, compressed, etc formats, a per-plane
362 * modifier can be specified. The default value of zero
363 * indicates "native" format as specified by the fourcc.
364 * Vendor specific modifier token. This allows, for example,
365 * different tiling/swizzling pattern on different planes.
366 * See discussion above of DRM_FORMAT_MOD_xxx.
359 */ 367 */
360 __u32 handles[4]; 368 __u32 handles[4];
361 __u32 pitches[4]; /* pitch for each plane */ 369 __u32 pitches[4]; /* pitch for each plane */
362 __u32 offsets[4]; /* offset of each plane */ 370 __u32 offsets[4]; /* offset of each plane */
371 __u64 modifier[4]; /* ie, tiling, compressed (per plane) */
363}; 372};
364 373
365#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01 374#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 6eed16b92a24..551b6737f5df 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -270,7 +270,7 @@ typedef struct _drm_i915_sarea {
270#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image) 270#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
271#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) 271#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
272#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) 272#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
273#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) 273#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
274#define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait) 274#define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait)
275#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create) 275#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create)
276#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy) 276#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)
@@ -347,6 +347,9 @@ typedef struct drm_i915_irq_wait {
347#define I915_PARAM_HAS_COHERENT_PHYS_GTT 29 347#define I915_PARAM_HAS_COHERENT_PHYS_GTT 29
348#define I915_PARAM_MMAP_VERSION 30 348#define I915_PARAM_MMAP_VERSION 30
349#define I915_PARAM_HAS_BSD2 31 349#define I915_PARAM_HAS_BSD2 31
350#define I915_PARAM_REVISION 32
351#define I915_PARAM_SUBSLICE_TOTAL 33
352#define I915_PARAM_EU_TOTAL 34
350 353
351typedef struct drm_i915_getparam { 354typedef struct drm_i915_getparam {
352 int param; 355 int param;
diff --git a/include/uapi/drm/nouveau_drm.h b/include/uapi/drm/nouveau_drm.h
index 0d7608dc1a34..5507eead5863 100644
--- a/include/uapi/drm/nouveau_drm.h
+++ b/include/uapi/drm/nouveau_drm.h
@@ -39,6 +39,7 @@
39#define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1) 39#define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1)
40#define NOUVEAU_GEM_DOMAIN_GART (1 << 2) 40#define NOUVEAU_GEM_DOMAIN_GART (1 << 2)
41#define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3) 41#define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3)
42#define NOUVEAU_GEM_DOMAIN_COHERENT (1 << 4)
42 43
43#define NOUVEAU_GEM_TILE_COMP 0x00030000 /* nv50-only */ 44#define NOUVEAU_GEM_TILE_COMP 0x00030000 /* nv50-only */
44#define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00 45#define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00
diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
index 50d0fb41a3bf..871e73f99a4d 100644
--- a/include/uapi/drm/radeon_drm.h
+++ b/include/uapi/drm/radeon_drm.h
@@ -1034,6 +1034,10 @@ struct drm_radeon_cs {
1034#define RADEON_INFO_VRAM_USAGE 0x1e 1034#define RADEON_INFO_VRAM_USAGE 0x1e
1035#define RADEON_INFO_GTT_USAGE 0x1f 1035#define RADEON_INFO_GTT_USAGE 0x1f
1036#define RADEON_INFO_ACTIVE_CU_COUNT 0x20 1036#define RADEON_INFO_ACTIVE_CU_COUNT 0x20
1037#define RADEON_INFO_CURRENT_GPU_TEMP 0x21
1038#define RADEON_INFO_CURRENT_GPU_SCLK 0x22
1039#define RADEON_INFO_CURRENT_GPU_MCLK 0x23
1040#define RADEON_INFO_READ_REG 0x24
1037 1041
1038struct drm_radeon_info { 1042struct drm_radeon_info {
1039 uint32_t request; 1043 uint32_t request;
diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h
index c15d781ecc0f..5391780c2b05 100644
--- a/include/uapi/drm/tegra_drm.h
+++ b/include/uapi/drm/tegra_drm.h
@@ -36,7 +36,8 @@ struct drm_tegra_gem_create {
36 36
37struct drm_tegra_gem_mmap { 37struct drm_tegra_gem_mmap {
38 __u32 handle; 38 __u32 handle;
39 __u32 offset; 39 __u32 pad;
40 __u64 offset;
40}; 41};
41 42
42struct drm_tegra_syncpt_read { 43struct drm_tegra_syncpt_read {
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 68ceb97c458c..1a0006a76b00 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -6,6 +6,7 @@ header-y += caif/
6header-y += dvb/ 6header-y += dvb/
7header-y += hdlc/ 7header-y += hdlc/
8header-y += hsi/ 8header-y += hsi/
9header-y += iio/
9header-y += isdn/ 10header-y += isdn/
10header-y += mmc/ 11header-y += mmc/
11header-y += nfsd/ 12header-y += nfsd/
@@ -430,6 +431,7 @@ header-y += virtio_blk.h
430header-y += virtio_config.h 431header-y += virtio_config.h
431header-y += virtio_console.h 432header-y += virtio_console.h
432header-y += virtio_ids.h 433header-y += virtio_ids.h
434header-y += virtio_input.h
433header-y += virtio_net.h 435header-y += virtio_net.h
434header-y += virtio_pci.h 436header-y += virtio_pci.h
435header-y += virtio_ring.h 437header-y += virtio_ring.h
@@ -446,5 +448,6 @@ header-y += wireless.h
446header-y += x25.h 448header-y += x25.h
447header-y += xattr.h 449header-y += xattr.h
448header-y += xfrm.h 450header-y += xfrm.h
451header-y += xilinx-v4l2-controls.h
449header-y += zorro.h 452header-y += zorro.h
450header-y += zorro_ids.h 453header-y += zorro_ids.h
diff --git a/include/uapi/linux/am437x-vpfe.h b/include/uapi/linux/am437x-vpfe.h
index 9b03033f9cd6..d75774317b9b 100644
--- a/include/uapi/linux/am437x-vpfe.h
+++ b/include/uapi/linux/am437x-vpfe.h
@@ -21,6 +21,8 @@
21#ifndef AM437X_VPFE_USER_H 21#ifndef AM437X_VPFE_USER_H
22#define AM437X_VPFE_USER_H 22#define AM437X_VPFE_USER_H
23 23
24#include <linux/videodev2.h>
25
24enum vpfe_ccdc_data_size { 26enum vpfe_ccdc_data_size {
25 VPFE_CCDC_DATA_16BITS = 0, 27 VPFE_CCDC_DATA_16BITS = 0,
26 VPFE_CCDC_DATA_15BITS, 28 VPFE_CCDC_DATA_15BITS,
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 45da7ec7d274..a9ebdf5701e8 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -118,8 +118,13 @@ enum bpf_map_type {
118enum bpf_prog_type { 118enum bpf_prog_type {
119 BPF_PROG_TYPE_UNSPEC, 119 BPF_PROG_TYPE_UNSPEC,
120 BPF_PROG_TYPE_SOCKET_FILTER, 120 BPF_PROG_TYPE_SOCKET_FILTER,
121 BPF_PROG_TYPE_KPROBE,
122 BPF_PROG_TYPE_SCHED_CLS,
123 BPF_PROG_TYPE_SCHED_ACT,
121}; 124};
122 125
126#define BPF_PSEUDO_MAP_FD 1
127
123/* flags for BPF_MAP_UPDATE_ELEM command */ 128/* flags for BPF_MAP_UPDATE_ELEM command */
124#define BPF_ANY 0 /* create new element or update existing */ 129#define BPF_ANY 0 /* create new element or update existing */
125#define BPF_NOEXIST 1 /* create new element if it didn't exist */ 130#define BPF_NOEXIST 1 /* create new element if it didn't exist */
@@ -151,6 +156,7 @@ union bpf_attr {
151 __u32 log_level; /* verbosity level of verifier */ 156 __u32 log_level; /* verbosity level of verifier */
152 __u32 log_size; /* size of user buffer */ 157 __u32 log_size; /* size of user buffer */
153 __aligned_u64 log_buf; /* user supplied buffer */ 158 __aligned_u64 log_buf; /* user supplied buffer */
159 __u32 kern_version; /* checked when prog_type=kprobe */
154 }; 160 };
155} __attribute__((aligned(8))); 161} __attribute__((aligned(8)));
156 162
@@ -162,7 +168,64 @@ enum bpf_func_id {
162 BPF_FUNC_map_lookup_elem, /* void *map_lookup_elem(&map, &key) */ 168 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) */ 169 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) */ 170 BPF_FUNC_map_delete_elem, /* int map_delete_elem(&map, &key) */
171 BPF_FUNC_probe_read, /* int bpf_probe_read(void *dst, int size, void *src) */
172 BPF_FUNC_ktime_get_ns, /* u64 bpf_ktime_get_ns(void) */
173 BPF_FUNC_trace_printk, /* int bpf_trace_printk(const char *fmt, int fmt_size, ...) */
174 BPF_FUNC_get_prandom_u32, /* u32 prandom_u32(void) */
175 BPF_FUNC_get_smp_processor_id, /* u32 raw_smp_processor_id(void) */
176
177 /**
178 * skb_store_bytes(skb, offset, from, len, flags) - store bytes into packet
179 * @skb: pointer to skb
180 * @offset: offset within packet from skb->mac_header
181 * @from: pointer where to copy bytes from
182 * @len: number of bytes to store into packet
183 * @flags: bit 0 - if true, recompute skb->csum
184 * other bits - reserved
185 * Return: 0 on success
186 */
187 BPF_FUNC_skb_store_bytes,
188
189 /**
190 * l3_csum_replace(skb, offset, from, to, flags) - recompute IP checksum
191 * @skb: pointer to skb
192 * @offset: offset within packet where IP checksum is located
193 * @from: old value of header field
194 * @to: new value of header field
195 * @flags: bits 0-3 - size of header field
196 * other bits - reserved
197 * Return: 0 on success
198 */
199 BPF_FUNC_l3_csum_replace,
200
201 /**
202 * l4_csum_replace(skb, offset, from, to, flags) - recompute TCP/UDP checksum
203 * @skb: pointer to skb
204 * @offset: offset within packet where TCP/UDP checksum is located
205 * @from: old value of header field
206 * @to: new value of header field
207 * @flags: bits 0-3 - size of header field
208 * bit 4 - is pseudo header
209 * other bits - reserved
210 * Return: 0 on success
211 */
212 BPF_FUNC_l4_csum_replace,
165 __BPF_FUNC_MAX_ID, 213 __BPF_FUNC_MAX_ID,
166}; 214};
167 215
216/* user accessible mirror of in-kernel sk_buff.
217 * new fields can only be added to the end of this structure
218 */
219struct __sk_buff {
220 __u32 len;
221 __u32 pkt_type;
222 __u32 mark;
223 __u32 queue_mapping;
224 __u32 protocol;
225 __u32 vlan_present;
226 __u32 vlan_tci;
227 __u32 vlan_proto;
228 __u32 priority;
229};
230
168#endif /* _UAPI__LINUX_BPF_H__ */ 231#endif /* _UAPI__LINUX_BPF_H__ */
diff --git a/include/uapi/linux/can/raw.h b/include/uapi/linux/can/raw.h
index 78ec76fd89a6..8735f1080385 100644
--- a/include/uapi/linux/can/raw.h
+++ b/include/uapi/linux/can/raw.h
@@ -57,6 +57,7 @@ enum {
57 CAN_RAW_LOOPBACK, /* local loopback (default:on) */ 57 CAN_RAW_LOOPBACK, /* local loopback (default:on) */
58 CAN_RAW_RECV_OWN_MSGS, /* receive my own msgs (default:off) */ 58 CAN_RAW_RECV_OWN_MSGS, /* receive my own msgs (default:off) */
59 CAN_RAW_FD_FRAMES, /* allow CAN FD frames (default:off) */ 59 CAN_RAW_FD_FRAMES, /* allow CAN FD frames (default:off) */
60 CAN_RAW_JOIN_FILTERS, /* all filters must match to trigger */
60}; 61};
61 62
62#endif /* !_UAPI_CAN_RAW_H */ 63#endif /* !_UAPI_CAN_RAW_H */
diff --git a/include/uapi/linux/dcbnl.h b/include/uapi/linux/dcbnl.h
index e711f20dc522..6497d7933d5b 100644
--- a/include/uapi/linux/dcbnl.h
+++ b/include/uapi/linux/dcbnl.h
@@ -78,6 +78,70 @@ struct ieee_maxrate {
78 __u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS]; 78 __u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS];
79}; 79};
80 80
81enum dcbnl_cndd_states {
82 DCB_CNDD_RESET = 0,
83 DCB_CNDD_EDGE,
84 DCB_CNDD_INTERIOR,
85 DCB_CNDD_INTERIOR_READY,
86};
87
88/* This structure contains the IEEE 802.1Qau QCN managed object.
89 *
90 *@rpg_enable: enable QCN RP
91 *@rppp_max_rps: maximum number of RPs allowed for this CNPV on this port
92 *@rpg_time_reset: time between rate increases if no CNMs received.
93 * given in u-seconds
94 *@rpg_byte_reset: transmitted data between rate increases if no CNMs received.
95 * given in Bytes
96 *@rpg_threshold: The number of times rpByteStage or rpTimeStage can count
97 * before RP rate control state machine advances states
98 *@rpg_max_rate: the maxinun rate, in Mbits per second,
99 * at which an RP can transmit
100 *@rpg_ai_rate: The rate, in Mbits per second,
101 * used to increase rpTargetRate in the RPR_ACTIVE_INCREASE
102 *@rpg_hai_rate: The rate, in Mbits per second,
103 * used to increase rpTargetRate in the RPR_HYPER_INCREASE state
104 *@rpg_gd: Upon CNM receive, flow rate is limited to (Fb/Gd)*CurrentRate.
105 * rpgGd is given as log2(Gd), where Gd may only be powers of 2
106 *@rpg_min_dec_fac: The minimum factor by which the current transmit rate
107 * can be changed by reception of a CNM.
108 * value is given as percentage (1-100)
109 *@rpg_min_rate: The minimum value, in bits per second, for rate to limit
110 *@cndd_state_machine: The state of the congestion notification domain
111 * defense state machine, as defined by IEEE 802.3Qau
112 * section 32.1.1. In the interior ready state,
113 * the QCN capable hardware may add CN-TAG TLV to the
114 * outgoing traffic, to specifically identify outgoing
115 * flows.
116 */
117
118struct ieee_qcn {
119 __u8 rpg_enable[IEEE_8021QAZ_MAX_TCS];
120 __u32 rppp_max_rps[IEEE_8021QAZ_MAX_TCS];
121 __u32 rpg_time_reset[IEEE_8021QAZ_MAX_TCS];
122 __u32 rpg_byte_reset[IEEE_8021QAZ_MAX_TCS];
123 __u32 rpg_threshold[IEEE_8021QAZ_MAX_TCS];
124 __u32 rpg_max_rate[IEEE_8021QAZ_MAX_TCS];
125 __u32 rpg_ai_rate[IEEE_8021QAZ_MAX_TCS];
126 __u32 rpg_hai_rate[IEEE_8021QAZ_MAX_TCS];
127 __u32 rpg_gd[IEEE_8021QAZ_MAX_TCS];
128 __u32 rpg_min_dec_fac[IEEE_8021QAZ_MAX_TCS];
129 __u32 rpg_min_rate[IEEE_8021QAZ_MAX_TCS];
130 __u32 cndd_state_machine[IEEE_8021QAZ_MAX_TCS];
131};
132
133/* This structure contains the IEEE 802.1Qau QCN statistics.
134 *
135 *@rppp_rp_centiseconds: the number of RP-centiseconds accumulated
136 * by RPs at this priority level on this Port
137 *@rppp_created_rps: number of active RPs(flows) that react to CNMs
138 */
139
140struct ieee_qcn_stats {
141 __u64 rppp_rp_centiseconds[IEEE_8021QAZ_MAX_TCS];
142 __u32 rppp_created_rps[IEEE_8021QAZ_MAX_TCS];
143};
144
81/* This structure contains the IEEE 802.1Qaz PFC managed object 145/* This structure contains the IEEE 802.1Qaz PFC managed object
82 * 146 *
83 * @pfc_cap: Indicates the number of traffic classes on the local device 147 * @pfc_cap: Indicates the number of traffic classes on the local device
@@ -334,6 +398,8 @@ enum ieee_attrs {
334 DCB_ATTR_IEEE_PEER_PFC, 398 DCB_ATTR_IEEE_PEER_PFC,
335 DCB_ATTR_IEEE_PEER_APP, 399 DCB_ATTR_IEEE_PEER_APP,
336 DCB_ATTR_IEEE_MAXRATE, 400 DCB_ATTR_IEEE_MAXRATE,
401 DCB_ATTR_IEEE_QCN,
402 DCB_ATTR_IEEE_QCN_STATS,
337 __DCB_ATTR_IEEE_MAX 403 __DCB_ATTR_IEEE_MAX
338}; 404};
339#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1) 405#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1)
diff --git a/include/uapi/linux/dm-ioctl.h b/include/uapi/linux/dm-ioctl.h
index 889f3a5b7b18..eac8c3641f39 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 30 270#define DM_VERSION_MINOR 31
271#define DM_VERSION_PATCHLEVEL 0 271#define DM_VERSION_PATCHLEVEL 0
272#define DM_VERSION_EXTRA "-ioctl (2014-12-22)" 272#define DM_VERSION_EXTRA "-ioctl (2015-3-12)"
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 */
diff --git a/include/uapi/linux/falloc.h b/include/uapi/linux/falloc.h
index d1197ae3723c..3e445a760f14 100644
--- a/include/uapi/linux/falloc.h
+++ b/include/uapi/linux/falloc.h
@@ -41,4 +41,21 @@
41 */ 41 */
42#define FALLOC_FL_ZERO_RANGE 0x10 42#define FALLOC_FL_ZERO_RANGE 0x10
43 43
44/*
45 * FALLOC_FL_INSERT_RANGE is use to insert space within the file size without
46 * overwriting any existing data. The contents of the file beyond offset are
47 * shifted towards right by len bytes to create a hole. As such, this
48 * operation will increase the size of the file by len bytes.
49 *
50 * Different filesystems may implement different limitations on the granularity
51 * of the operation. Most will limit operations to filesystem block size
52 * boundaries, but this boundary may be larger or smaller depending on
53 * the filesystem and/or the configuration of the filesystem or file.
54 *
55 * Attempting to insert space using this flag at OR beyond the end of
56 * the file is considered an illegal operation - just use ftruncate(2) or
57 * fallocate(2) with mode 0 for such type of operations.
58 */
59#define FALLOC_FL_INSERT_RANGE 0x20
60
44#endif /* _UAPI_FALLOC_H_ */ 61#endif /* _UAPI_FALLOC_H_ */
diff --git a/include/uapi/linux/filter.h b/include/uapi/linux/filter.h
index 47785d5ecf17..c97340e43dd6 100644
--- a/include/uapi/linux/filter.h
+++ b/include/uapi/linux/filter.h
@@ -77,9 +77,13 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
77#define SKF_AD_VLAN_TAG_PRESENT 48 77#define SKF_AD_VLAN_TAG_PRESENT 48
78#define SKF_AD_PAY_OFFSET 52 78#define SKF_AD_PAY_OFFSET 52
79#define SKF_AD_RANDOM 56 79#define SKF_AD_RANDOM 56
80#define SKF_AD_MAX 60 80#define SKF_AD_VLAN_TPID 60
81#define SKF_NET_OFF (-0x100000) 81#define SKF_AD_MAX 64
82#define SKF_LL_OFF (-0x200000)
83 82
83#define SKF_NET_OFF (-0x100000)
84#define SKF_LL_OFF (-0x200000)
85
86#define BPF_NET_OFF SKF_NET_OFF
87#define BPF_LL_OFF SKF_LL_OFF
84 88
85#endif /* _UAPI__LINUX_FILTER_H__ */ 89#endif /* _UAPI__LINUX_FILTER_H__ */
diff --git a/include/uapi/linux/fou.h b/include/uapi/linux/fou.h
index c303588bb767..d2947c52dc67 100644
--- a/include/uapi/linux/fou.h
+++ b/include/uapi/linux/fou.h
@@ -25,6 +25,7 @@ enum {
25 FOU_CMD_UNSPEC, 25 FOU_CMD_UNSPEC,
26 FOU_CMD_ADD, 26 FOU_CMD_ADD,
27 FOU_CMD_DEL, 27 FOU_CMD_DEL,
28 FOU_CMD_GET,
28 29
29 __FOU_CMD_MAX, 30 __FOU_CMD_MAX,
30}; 31};
diff --git a/include/uapi/linux/hsi/Kbuild b/include/uapi/linux/hsi/Kbuild
index 30ab3cd3b8a5..a16a00544258 100644
--- a/include/uapi/linux/hsi/Kbuild
+++ b/include/uapi/linux/hsi/Kbuild
@@ -1,2 +1,2 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += hsi_char.h 2header-y += hsi_char.h cs-protocol.h
diff --git a/include/uapi/linux/hsi/cs-protocol.h b/include/uapi/linux/hsi/cs-protocol.h
new file mode 100644
index 000000000000..4957bba57cbe
--- /dev/null
+++ b/include/uapi/linux/hsi/cs-protocol.h
@@ -0,0 +1,113 @@
1/*
2 * cmt-speech interface definitions
3 *
4 * Copyright (C) 2008,2009,2010 Nokia Corporation. All rights reserved.
5 *
6 * Contact: Kai Vehmanen <kai.vehmanen@nokia.com>
7 * Original author: Peter Ujfalusi <peter.ujfalusi@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
23
24#ifndef _CS_PROTOCOL_H
25#define _CS_PROTOCOL_H
26
27#include <linux/types.h>
28#include <linux/ioctl.h>
29
30/* chardev parameters */
31#define CS_DEV_FILE_NAME "/dev/cmt_speech"
32
33/* user-space API versioning */
34#define CS_IF_VERSION 2
35
36/* APE kernel <-> user space messages */
37#define CS_CMD_SHIFT 28
38#define CS_DOMAIN_SHIFT 24
39
40#define CS_CMD_MASK 0xff000000
41#define CS_PARAM_MASK 0xffffff
42
43#define CS_CMD(id, dom) \
44 (((id) << CS_CMD_SHIFT) | ((dom) << CS_DOMAIN_SHIFT))
45
46#define CS_ERROR CS_CMD(1, 0)
47#define CS_RX_DATA_RECEIVED CS_CMD(2, 0)
48#define CS_TX_DATA_READY CS_CMD(3, 0)
49#define CS_TX_DATA_SENT CS_CMD(4, 0)
50
51/* params to CS_ERROR indication */
52#define CS_ERR_PEER_RESET 0
53
54/* ioctl interface */
55
56/* parameters to CS_CONFIG_BUFS ioctl */
57#define CS_FEAT_TSTAMP_RX_CTRL (1 << 0)
58#define CS_FEAT_ROLLING_RX_COUNTER (2 << 0)
59
60/* parameters to CS_GET_STATE ioctl */
61#define CS_STATE_CLOSED 0
62#define CS_STATE_OPENED 1 /* resource allocated */
63#define CS_STATE_CONFIGURED 2 /* data path active */
64
65/* maximum number of TX/RX buffers */
66#define CS_MAX_BUFFERS_SHIFT 4
67#define CS_MAX_BUFFERS (1 << CS_MAX_BUFFERS_SHIFT)
68
69/* Parameters for setting up the data buffers */
70struct cs_buffer_config {
71 __u32 rx_bufs; /* number of RX buffer slots */
72 __u32 tx_bufs; /* number of TX buffer slots */
73 __u32 buf_size; /* bytes */
74 __u32 flags; /* see CS_FEAT_* */
75 __u32 reserved[4];
76};
77
78/*
79 * Struct describing the layout and contents of the driver mmap area.
80 * This information is meant as read-only information for the application.
81 */
82struct cs_mmap_config_block {
83 __u32 reserved1;
84 __u32 buf_size; /* 0=disabled, otherwise the transfer size */
85 __u32 rx_bufs; /* # of RX buffers */
86 __u32 tx_bufs; /* # of TX buffers */
87 __u32 reserved2;
88 /* array of offsets within the mmap area for each RX and TX buffer */
89 __u32 rx_offsets[CS_MAX_BUFFERS];
90 __u32 tx_offsets[CS_MAX_BUFFERS];
91 __u32 rx_ptr;
92 __u32 rx_ptr_boundary;
93 __u32 reserved3[2];
94 /*
95 * if enabled with CS_FEAT_TSTAMP_RX_CTRL, monotonic
96 * timestamp taken when the last control command was received
97 */
98 struct timespec tstamp_rx_ctrl;
99};
100
101#define CS_IO_MAGIC 'C'
102
103#define CS_IOW(num, dtype) _IOW(CS_IO_MAGIC, num, dtype)
104#define CS_IOR(num, dtype) _IOR(CS_IO_MAGIC, num, dtype)
105#define CS_IOWR(num, dtype) _IOWR(CS_IO_MAGIC, num, dtype)
106#define CS_IO(num) _IO(CS_IO_MAGIC, num)
107
108#define CS_GET_STATE CS_IOR(21, unsigned int)
109#define CS_SET_WAKELINE CS_IOW(23, unsigned int)
110#define CS_GET_IF_VERSION CS_IOR(30, unsigned int)
111#define CS_CONFIG_BUFS CS_IOW(31, struct cs_buffer_config)
112
113#endif /* _CS_PROTOCOL_H */
diff --git a/include/uapi/linux/if_addr.h b/include/uapi/linux/if_addr.h
index dea10a87dfd1..4318ab1635ce 100644
--- a/include/uapi/linux/if_addr.h
+++ b/include/uapi/linux/if_addr.h
@@ -50,6 +50,8 @@ enum {
50#define IFA_F_PERMANENT 0x80 50#define IFA_F_PERMANENT 0x80
51#define IFA_F_MANAGETEMPADDR 0x100 51#define IFA_F_MANAGETEMPADDR 0x100
52#define IFA_F_NOPREFIXROUTE 0x200 52#define IFA_F_NOPREFIXROUTE 0x200
53#define IFA_F_MCAUTOJOIN 0x400
54#define IFA_F_STABLE_PRIVACY 0x800
53 55
54struct ifa_cacheinfo { 56struct ifa_cacheinfo {
55 __u32 ifa_prefered; 57 __u32 ifa_prefered;
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index dfd0bb22e554..d9cd19214b98 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -147,6 +147,7 @@ enum {
147 IFLA_CARRIER_CHANGES, 147 IFLA_CARRIER_CHANGES,
148 IFLA_PHYS_SWITCH_ID, 148 IFLA_PHYS_SWITCH_ID,
149 IFLA_LINK_NETNSID, 149 IFLA_LINK_NETNSID,
150 IFLA_PHYS_PORT_NAME,
150 __IFLA_MAX 151 __IFLA_MAX
151}; 152};
152 153
@@ -215,6 +216,7 @@ enum {
215enum in6_addr_gen_mode { 216enum in6_addr_gen_mode {
216 IN6_ADDR_GEN_MODE_EUI64, 217 IN6_ADDR_GEN_MODE_EUI64,
217 IN6_ADDR_GEN_MODE_NONE, 218 IN6_ADDR_GEN_MODE_NONE,
219 IN6_ADDR_GEN_MODE_STABLE_PRIVACY,
218}; 220};
219 221
220/* Bridge section */ 222/* Bridge section */
@@ -224,6 +226,9 @@ enum {
224 IFLA_BR_FORWARD_DELAY, 226 IFLA_BR_FORWARD_DELAY,
225 IFLA_BR_HELLO_TIME, 227 IFLA_BR_HELLO_TIME,
226 IFLA_BR_MAX_AGE, 228 IFLA_BR_MAX_AGE,
229 IFLA_BR_AGEING_TIME,
230 IFLA_BR_STP_STATE,
231 IFLA_BR_PRIORITY,
227 __IFLA_BR_MAX, 232 __IFLA_BR_MAX,
228}; 233};
229 234
@@ -247,6 +252,7 @@ enum {
247 IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */ 252 IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */
248 IFLA_BRPORT_PROXYARP, /* proxy ARP */ 253 IFLA_BRPORT_PROXYARP, /* proxy ARP */
249 IFLA_BRPORT_LEARNING_SYNC, /* mac learning sync from device */ 254 IFLA_BRPORT_LEARNING_SYNC, /* mac learning sync from device */
255 IFLA_BRPORT_PROXYARP_WIFI, /* proxy ARP for Wi-Fi */
250 __IFLA_BRPORT_MAX 256 __IFLA_BRPORT_MAX
251}; 257};
252#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) 258#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
@@ -459,6 +465,9 @@ enum {
459 IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */ 465 IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */
460 IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */ 466 IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */
461 IFLA_VF_RATE, /* Min and Max TX Bandwidth Allocation */ 467 IFLA_VF_RATE, /* Min and Max TX Bandwidth Allocation */
468 IFLA_VF_RSS_QUERY_EN, /* RSS Redirection Table and Hash Key query
469 * on/off switch
470 */
462 __IFLA_VF_MAX, 471 __IFLA_VF_MAX,
463}; 472};
464 473
@@ -503,6 +512,11 @@ struct ifla_vf_link_state {
503 __u32 link_state; 512 __u32 link_state;
504}; 513};
505 514
515struct ifla_vf_rss_query_en {
516 __u32 vf;
517 __u32 setting;
518};
519
506/* VF ports management section 520/* VF ports management section
507 * 521 *
508 * Nested layout of set/get msg is: 522 * Nested layout of set/get msg is:
diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h
index da2d668b8cf1..053bd102fbe0 100644
--- a/include/uapi/linux/if_packet.h
+++ b/include/uapi/linux/if_packet.h
@@ -99,6 +99,7 @@ struct tpacket_auxdata {
99#define TP_STATUS_VLAN_VALID (1 << 4) /* auxdata has valid tp_vlan_tci */ 99#define TP_STATUS_VLAN_VALID (1 << 4) /* auxdata has valid tp_vlan_tci */
100#define TP_STATUS_BLK_TMO (1 << 5) 100#define TP_STATUS_BLK_TMO (1 << 5)
101#define TP_STATUS_VLAN_TPID_VALID (1 << 6) /* auxdata has valid tp_vlan_tpid */ 101#define TP_STATUS_VLAN_TPID_VALID (1 << 6) /* auxdata has valid tp_vlan_tpid */
102#define TP_STATUS_CSUM_VALID (1 << 7)
102 103
103/* Tx ring - header status */ 104/* Tx ring - header status */
104#define TP_STATUS_AVAILABLE 0 105#define TP_STATUS_AVAILABLE 0
diff --git a/include/uapi/linux/iio/Kbuild b/include/uapi/linux/iio/Kbuild
new file mode 100644
index 000000000000..86f76d84c44f
--- /dev/null
+++ b/include/uapi/linux/iio/Kbuild
@@ -0,0 +1,3 @@
1# UAPI Header export list
2header-y += events.h
3header-y += types.h
diff --git a/include/uapi/linux/iio/events.h b/include/uapi/linux/iio/events.h
new file mode 100644
index 000000000000..00bbdaed2f97
--- /dev/null
+++ b/include/uapi/linux/iio/events.h
@@ -0,0 +1,42 @@
1/* The industrial I/O - event passing to userspace
2 *
3 * Copyright (c) 2008-2011 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9#ifndef _UAPI_IIO_EVENTS_H_
10#define _UAPI_IIO_EVENTS_H_
11
12#include <linux/ioctl.h>
13#include <linux/types.h>
14
15/**
16 * struct iio_event_data - The actual event being pushed to userspace
17 * @id: event identifier
18 * @timestamp: best estimate of time of event occurrence (often from
19 * the interrupt handler)
20 */
21struct iio_event_data {
22 __u64 id;
23 __s64 timestamp;
24};
25
26#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
27
28#define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
29
30#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F)
31
32#define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
33
34/* Event code number extraction depends on which type of event we have.
35 * Perhaps review this function in the future*/
36#define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF))
37#define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((__s16)(((mask) >> 16) & 0xFFFF))
38
39#define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF)
40#define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1)
41
42#endif /* _UAPI_IIO_EVENTS_H_ */
diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
new file mode 100644
index 000000000000..5c4601935005
--- /dev/null
+++ b/include/uapi/linux/iio/types.h
@@ -0,0 +1,92 @@
1/* industrial I/O data types needed both in and out of kernel
2 *
3 * Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9
10#ifndef _UAPI_IIO_TYPES_H_
11#define _UAPI_IIO_TYPES_H_
12
13enum iio_chan_type {
14 IIO_VOLTAGE,
15 IIO_CURRENT,
16 IIO_POWER,
17 IIO_ACCEL,
18 IIO_ANGL_VEL,
19 IIO_MAGN,
20 IIO_LIGHT,
21 IIO_INTENSITY,
22 IIO_PROXIMITY,
23 IIO_TEMP,
24 IIO_INCLI,
25 IIO_ROT,
26 IIO_ANGL,
27 IIO_TIMESTAMP,
28 IIO_CAPACITANCE,
29 IIO_ALTVOLTAGE,
30 IIO_CCT,
31 IIO_PRESSURE,
32 IIO_HUMIDITYRELATIVE,
33 IIO_ACTIVITY,
34 IIO_STEPS,
35 IIO_ENERGY,
36 IIO_DISTANCE,
37 IIO_VELOCITY,
38};
39
40enum iio_modifier {
41 IIO_NO_MOD,
42 IIO_MOD_X,
43 IIO_MOD_Y,
44 IIO_MOD_Z,
45 IIO_MOD_X_AND_Y,
46 IIO_MOD_X_AND_Z,
47 IIO_MOD_Y_AND_Z,
48 IIO_MOD_X_AND_Y_AND_Z,
49 IIO_MOD_X_OR_Y,
50 IIO_MOD_X_OR_Z,
51 IIO_MOD_Y_OR_Z,
52 IIO_MOD_X_OR_Y_OR_Z,
53 IIO_MOD_LIGHT_BOTH,
54 IIO_MOD_LIGHT_IR,
55 IIO_MOD_ROOT_SUM_SQUARED_X_Y,
56 IIO_MOD_SUM_SQUARED_X_Y_Z,
57 IIO_MOD_LIGHT_CLEAR,
58 IIO_MOD_LIGHT_RED,
59 IIO_MOD_LIGHT_GREEN,
60 IIO_MOD_LIGHT_BLUE,
61 IIO_MOD_QUATERNION,
62 IIO_MOD_TEMP_AMBIENT,
63 IIO_MOD_TEMP_OBJECT,
64 IIO_MOD_NORTH_MAGN,
65 IIO_MOD_NORTH_TRUE,
66 IIO_MOD_NORTH_MAGN_TILT_COMP,
67 IIO_MOD_NORTH_TRUE_TILT_COMP,
68 IIO_MOD_RUNNING,
69 IIO_MOD_JOGGING,
70 IIO_MOD_WALKING,
71 IIO_MOD_STILL,
72 IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z,
73};
74
75enum iio_event_type {
76 IIO_EV_TYPE_THRESH,
77 IIO_EV_TYPE_MAG,
78 IIO_EV_TYPE_ROC,
79 IIO_EV_TYPE_THRESH_ADAPTIVE,
80 IIO_EV_TYPE_MAG_ADAPTIVE,
81 IIO_EV_TYPE_CHANGE,
82};
83
84enum iio_event_direction {
85 IIO_EV_DIR_EITHER,
86 IIO_EV_DIR_RISING,
87 IIO_EV_DIR_FALLING,
88 IIO_EV_DIR_NONE,
89};
90
91#endif /* _UAPI_IIO_TYPES_H_ */
92
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index b0a813079852..731417c025f6 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -369,7 +369,8 @@ struct input_keymap_entry {
369#define KEY_MSDOS 151 369#define KEY_MSDOS 151
370#define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */ 370#define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */
371#define KEY_SCREENLOCK KEY_COFFEE 371#define KEY_SCREENLOCK KEY_COFFEE
372#define KEY_DIRECTION 153 372#define KEY_ROTATE_DISPLAY 153 /* Display orientation for e.g. tablets */
373#define KEY_DIRECTION KEY_ROTATE_DISPLAY
373#define KEY_CYCLEWINDOWS 154 374#define KEY_CYCLEWINDOWS 154
374#define KEY_MAIL 155 375#define KEY_MAIL 155
375#define KEY_BOOKMARKS 156 /* AC Bookmarks */ 376#define KEY_BOOKMARKS 156 /* AC Bookmarks */
@@ -702,6 +703,10 @@ struct input_keymap_entry {
702#define KEY_NUMERIC_9 0x209 703#define KEY_NUMERIC_9 0x209
703#define KEY_NUMERIC_STAR 0x20a 704#define KEY_NUMERIC_STAR 0x20a
704#define KEY_NUMERIC_POUND 0x20b 705#define KEY_NUMERIC_POUND 0x20b
706#define KEY_NUMERIC_A 0x20c /* Phone key A - HUT Telephony 0xb9 */
707#define KEY_NUMERIC_B 0x20d
708#define KEY_NUMERIC_C 0x20e
709#define KEY_NUMERIC_D 0x20f
705 710
706#define KEY_CAMERA_FOCUS 0x210 711#define KEY_CAMERA_FOCUS 0x210
707#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ 712#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */
@@ -973,7 +978,8 @@ struct input_keymap_entry {
973 */ 978 */
974#define MT_TOOL_FINGER 0 979#define MT_TOOL_FINGER 0
975#define MT_TOOL_PEN 1 980#define MT_TOOL_PEN 1
976#define MT_TOOL_MAX 1 981#define MT_TOOL_PALM 2
982#define MT_TOOL_MAX 2
977 983
978/* 984/*
979 * Values describing the status of a force-feedback effect 985 * Values describing the status of a force-feedback effect
diff --git a/include/uapi/linux/ip_vs.h b/include/uapi/linux/ip_vs.h
index cabe95d5b461..3199243f2028 100644
--- a/include/uapi/linux/ip_vs.h
+++ b/include/uapi/linux/ip_vs.h
@@ -358,6 +358,8 @@ enum {
358 358
359 IPVS_SVC_ATTR_PE_NAME, /* name of ct retriever */ 359 IPVS_SVC_ATTR_PE_NAME, /* name of ct retriever */
360 360
361 IPVS_SVC_ATTR_STATS64, /* nested attribute for service stats */
362
361 __IPVS_SVC_ATTR_MAX, 363 __IPVS_SVC_ATTR_MAX,
362}; 364};
363 365
@@ -387,6 +389,8 @@ enum {
387 389
388 IPVS_DEST_ATTR_ADDR_FAMILY, /* Address family of address */ 390 IPVS_DEST_ATTR_ADDR_FAMILY, /* Address family of address */
389 391
392 IPVS_DEST_ATTR_STATS64, /* nested attribute for dest stats */
393
390 __IPVS_DEST_ATTR_MAX, 394 __IPVS_DEST_ATTR_MAX,
391}; 395};
392 396
@@ -410,7 +414,8 @@ enum {
410/* 414/*
411 * Attributes used to describe service or destination entry statistics 415 * Attributes used to describe service or destination entry statistics
412 * 416 *
413 * Used inside nested attributes IPVS_SVC_ATTR_STATS and IPVS_DEST_ATTR_STATS 417 * Used inside nested attributes IPVS_SVC_ATTR_STATS, IPVS_DEST_ATTR_STATS,
418 * IPVS_SVC_ATTR_STATS64 and IPVS_DEST_ATTR_STATS64.
414 */ 419 */
415enum { 420enum {
416 IPVS_STATS_ATTR_UNSPEC = 0, 421 IPVS_STATS_ATTR_UNSPEC = 0,
diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
index 437a6a4b125a..5efa54ae567c 100644
--- a/include/uapi/linux/ipv6.h
+++ b/include/uapi/linux/ipv6.h
@@ -170,6 +170,7 @@ enum {
170 DEVCONF_ACCEPT_RA_FROM_LOCAL, 170 DEVCONF_ACCEPT_RA_FROM_LOCAL,
171 DEVCONF_USE_OPTIMISTIC, 171 DEVCONF_USE_OPTIMISTIC,
172 DEVCONF_ACCEPT_RA_MTU, 172 DEVCONF_ACCEPT_RA_MTU,
173 DEVCONF_STABLE_SECRET,
173 DEVCONF_MAX 174 DEVCONF_MAX
174}; 175};
175 176
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 805570650062..4b60056776d1 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -147,6 +147,16 @@ struct kvm_pit_config {
147 147
148#define KVM_PIT_SPEAKER_DUMMY 1 148#define KVM_PIT_SPEAKER_DUMMY 1
149 149
150struct kvm_s390_skeys {
151 __u64 start_gfn;
152 __u64 count;
153 __u64 skeydata_addr;
154 __u32 flags;
155 __u32 reserved[9];
156};
157#define KVM_S390_GET_SKEYS_NONE 1
158#define KVM_S390_SKEYS_MAX 1048576
159
150#define KVM_EXIT_UNKNOWN 0 160#define KVM_EXIT_UNKNOWN 0
151#define KVM_EXIT_EXCEPTION 1 161#define KVM_EXIT_EXCEPTION 1
152#define KVM_EXIT_IO 2 162#define KVM_EXIT_IO 2
@@ -172,6 +182,7 @@ struct kvm_pit_config {
172#define KVM_EXIT_S390_TSCH 22 182#define KVM_EXIT_S390_TSCH 22
173#define KVM_EXIT_EPR 23 183#define KVM_EXIT_EPR 23
174#define KVM_EXIT_SYSTEM_EVENT 24 184#define KVM_EXIT_SYSTEM_EVENT 24
185#define KVM_EXIT_S390_STSI 25
175 186
176/* For KVM_EXIT_INTERNAL_ERROR */ 187/* For KVM_EXIT_INTERNAL_ERROR */
177/* Emulate instruction failed. */ 188/* Emulate instruction failed. */
@@ -309,6 +320,15 @@ struct kvm_run {
309 __u32 type; 320 __u32 type;
310 __u64 flags; 321 __u64 flags;
311 } system_event; 322 } system_event;
323 /* KVM_EXIT_S390_STSI */
324 struct {
325 __u64 addr;
326 __u8 ar;
327 __u8 reserved;
328 __u8 fc;
329 __u8 sel1;
330 __u16 sel2;
331 } s390_stsi;
312 /* Fix the size of the union. */ 332 /* Fix the size of the union. */
313 char padding[256]; 333 char padding[256];
314 }; 334 };
@@ -324,7 +344,7 @@ struct kvm_run {
324 __u64 kvm_dirty_regs; 344 __u64 kvm_dirty_regs;
325 union { 345 union {
326 struct kvm_sync_regs regs; 346 struct kvm_sync_regs regs;
327 char padding[1024]; 347 char padding[2048];
328 } s; 348 } s;
329}; 349};
330 350
@@ -365,6 +385,24 @@ struct kvm_translation {
365 __u8 pad[5]; 385 __u8 pad[5];
366}; 386};
367 387
388/* for KVM_S390_MEM_OP */
389struct kvm_s390_mem_op {
390 /* in */
391 __u64 gaddr; /* the guest address */
392 __u64 flags; /* flags */
393 __u32 size; /* amount of bytes */
394 __u32 op; /* type of operation */
395 __u64 buf; /* buffer in userspace */
396 __u8 ar; /* the access register number */
397 __u8 reserved[31]; /* should be set to 0 */
398};
399/* types for kvm_s390_mem_op->op */
400#define KVM_S390_MEMOP_LOGICAL_READ 0
401#define KVM_S390_MEMOP_LOGICAL_WRITE 1
402/* flags for kvm_s390_mem_op->flags */
403#define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0)
404#define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1)
405
368/* for KVM_INTERRUPT */ 406/* for KVM_INTERRUPT */
369struct kvm_interrupt { 407struct kvm_interrupt {
370 /* in */ 408 /* in */
@@ -520,6 +558,13 @@ struct kvm_s390_irq {
520 } u; 558 } u;
521}; 559};
522 560
561struct kvm_s390_irq_state {
562 __u64 buf;
563 __u32 flags;
564 __u32 len;
565 __u32 reserved[4];
566};
567
523/* for KVM_SET_GUEST_DEBUG */ 568/* for KVM_SET_GUEST_DEBUG */
524 569
525#define KVM_GUESTDBG_ENABLE 0x00000001 570#define KVM_GUESTDBG_ENABLE 0x00000001
@@ -760,6 +805,15 @@ struct kvm_ppc_smmu_info {
760#define KVM_CAP_PPC_ENABLE_HCALL 104 805#define KVM_CAP_PPC_ENABLE_HCALL 104
761#define KVM_CAP_CHECK_EXTENSION_VM 105 806#define KVM_CAP_CHECK_EXTENSION_VM 105
762#define KVM_CAP_S390_USER_SIGP 106 807#define KVM_CAP_S390_USER_SIGP 106
808#define KVM_CAP_S390_VECTOR_REGISTERS 107
809#define KVM_CAP_S390_MEM_OP 108
810#define KVM_CAP_S390_USER_STSI 109
811#define KVM_CAP_S390_SKEYS 110
812#define KVM_CAP_MIPS_FPU 111
813#define KVM_CAP_MIPS_MSA 112
814#define KVM_CAP_S390_INJECT_IRQ 113
815#define KVM_CAP_S390_IRQ_STATE 114
816#define KVM_CAP_PPC_HWRNG 115
763 817
764#ifdef KVM_CAP_IRQ_ROUTING 818#ifdef KVM_CAP_IRQ_ROUTING
765 819
@@ -1135,6 +1189,16 @@ struct kvm_s390_ucas_mapping {
1135#define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init) 1189#define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init)
1136#define KVM_ARM_PREFERRED_TARGET _IOR(KVMIO, 0xaf, struct kvm_vcpu_init) 1190#define KVM_ARM_PREFERRED_TARGET _IOR(KVMIO, 0xaf, struct kvm_vcpu_init)
1137#define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list) 1191#define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list)
1192/* Available with KVM_CAP_S390_MEM_OP */
1193#define KVM_S390_MEM_OP _IOW(KVMIO, 0xb1, struct kvm_s390_mem_op)
1194/* Available with KVM_CAP_S390_SKEYS */
1195#define KVM_S390_GET_SKEYS _IOW(KVMIO, 0xb2, struct kvm_s390_skeys)
1196#define KVM_S390_SET_SKEYS _IOW(KVMIO, 0xb3, struct kvm_s390_skeys)
1197/* Available with KVM_CAP_S390_INJECT_IRQ */
1198#define KVM_S390_IRQ _IOW(KVMIO, 0xb4, struct kvm_s390_irq)
1199/* Available with KVM_CAP_S390_IRQ_STATE */
1200#define KVM_S390_SET_IRQ_STATE _IOW(KVMIO, 0xb5, struct kvm_s390_irq_state)
1201#define KVM_S390_GET_IRQ_STATE _IOW(KVMIO, 0xb6, struct kvm_s390_irq_state)
1138 1202
1139#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 1203#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
1140#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1) 1204#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)
diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
index 7d664ea85ebd..7b1425a6b370 100644
--- a/include/uapi/linux/magic.h
+++ b/include/uapi/linux/magic.h
@@ -58,6 +58,8 @@
58 58
59#define STACK_END_MAGIC 0x57AC6E9D 59#define STACK_END_MAGIC 0x57AC6E9D
60 60
61#define TRACEFS_MAGIC 0x74726163
62
61#define V9FS_MAGIC 0x01021997 63#define V9FS_MAGIC 0x01021997
62 64
63#define BDEVFS_MAGIC 0x62646576 65#define BDEVFS_MAGIC 0x62646576
diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h
index 23b40908be30..190d491d5b13 100644
--- a/include/uapi/linux/media-bus-format.h
+++ b/include/uapi/linux/media-bus-format.h
@@ -33,22 +33,32 @@
33 33
34#define MEDIA_BUS_FMT_FIXED 0x0001 34#define MEDIA_BUS_FMT_FIXED 0x0001
35 35
36/* RGB - next is 0x100e */ 36/* RGB - next is 0x1018 */
37#define MEDIA_BUS_FMT_RGB444_1X12 0x1016
37#define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE 0x1001 38#define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE 0x1001
38#define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE 0x1002 39#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_BE 0x1003
40#define MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE 0x1004 41#define MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE 0x1004
42#define MEDIA_BUS_FMT_RGB565_1X16 0x1017
41#define MEDIA_BUS_FMT_BGR565_2X8_BE 0x1005 43#define MEDIA_BUS_FMT_BGR565_2X8_BE 0x1005
42#define MEDIA_BUS_FMT_BGR565_2X8_LE 0x1006 44#define MEDIA_BUS_FMT_BGR565_2X8_LE 0x1006
43#define MEDIA_BUS_FMT_RGB565_2X8_BE 0x1007 45#define MEDIA_BUS_FMT_RGB565_2X8_BE 0x1007
44#define MEDIA_BUS_FMT_RGB565_2X8_LE 0x1008 46#define MEDIA_BUS_FMT_RGB565_2X8_LE 0x1008
45#define MEDIA_BUS_FMT_RGB666_1X18 0x1009 47#define MEDIA_BUS_FMT_RGB666_1X18 0x1009
48#define MEDIA_BUS_FMT_RBG888_1X24 0x100e
49#define MEDIA_BUS_FMT_RGB666_1X24_CPADHI 0x1015
50#define MEDIA_BUS_FMT_RGB666_1X7X3_SPWG 0x1010
51#define MEDIA_BUS_FMT_BGR888_1X24 0x1013
52#define MEDIA_BUS_FMT_GBR888_1X24 0x1014
46#define MEDIA_BUS_FMT_RGB888_1X24 0x100a 53#define MEDIA_BUS_FMT_RGB888_1X24 0x100a
47#define MEDIA_BUS_FMT_RGB888_2X12_BE 0x100b 54#define MEDIA_BUS_FMT_RGB888_2X12_BE 0x100b
48#define MEDIA_BUS_FMT_RGB888_2X12_LE 0x100c 55#define MEDIA_BUS_FMT_RGB888_2X12_LE 0x100c
56#define MEDIA_BUS_FMT_RGB888_1X7X4_SPWG 0x1011
57#define MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA 0x1012
49#define MEDIA_BUS_FMT_ARGB8888_1X32 0x100d 58#define MEDIA_BUS_FMT_ARGB8888_1X32 0x100d
59#define MEDIA_BUS_FMT_RGB888_1X32_PADHI 0x100f
50 60
51/* YUV (including grey) - next is 0x2024 */ 61/* YUV (including grey) - next is 0x2026 */
52#define MEDIA_BUS_FMT_Y8_1X8 0x2001 62#define MEDIA_BUS_FMT_Y8_1X8 0x2001
53#define MEDIA_BUS_FMT_UV8_1X8 0x2015 63#define MEDIA_BUS_FMT_UV8_1X8 0x2015
54#define MEDIA_BUS_FMT_UYVY8_1_5X8 0x2002 64#define MEDIA_BUS_FMT_UYVY8_1_5X8 0x2002
@@ -65,6 +75,10 @@
65#define MEDIA_BUS_FMT_YUYV10_2X10 0x200b 75#define MEDIA_BUS_FMT_YUYV10_2X10 0x200b
66#define MEDIA_BUS_FMT_YVYU10_2X10 0x200c 76#define MEDIA_BUS_FMT_YVYU10_2X10 0x200c
67#define MEDIA_BUS_FMT_Y12_1X12 0x2013 77#define MEDIA_BUS_FMT_Y12_1X12 0x2013
78#define MEDIA_BUS_FMT_UYVY12_2X12 0x201c
79#define MEDIA_BUS_FMT_VYUY12_2X12 0x201d
80#define MEDIA_BUS_FMT_YUYV12_2X12 0x201e
81#define MEDIA_BUS_FMT_YVYU12_2X12 0x201f
68#define MEDIA_BUS_FMT_UYVY8_1X16 0x200f 82#define MEDIA_BUS_FMT_UYVY8_1X16 0x200f
69#define MEDIA_BUS_FMT_VYUY8_1X16 0x2010 83#define MEDIA_BUS_FMT_VYUY8_1X16 0x2010
70#define MEDIA_BUS_FMT_YUYV8_1X16 0x2011 84#define MEDIA_BUS_FMT_YUYV8_1X16 0x2011
@@ -74,16 +88,14 @@
74#define MEDIA_BUS_FMT_VYUY10_1X20 0x201b 88#define MEDIA_BUS_FMT_VYUY10_1X20 0x201b
75#define MEDIA_BUS_FMT_YUYV10_1X20 0x200d 89#define MEDIA_BUS_FMT_YUYV10_1X20 0x200d
76#define MEDIA_BUS_FMT_YVYU10_1X20 0x200e 90#define MEDIA_BUS_FMT_YVYU10_1X20 0x200e
77#define MEDIA_BUS_FMT_YUV10_1X30 0x2016 91#define MEDIA_BUS_FMT_VUY8_1X24 0x2024
78#define MEDIA_BUS_FMT_AYUV8_1X32 0x2017 92#define MEDIA_BUS_FMT_YUV8_1X24 0x2025
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 93#define MEDIA_BUS_FMT_UYVY12_1X24 0x2020
84#define MEDIA_BUS_FMT_VYUY12_1X24 0x2021 94#define MEDIA_BUS_FMT_VYUY12_1X24 0x2021
85#define MEDIA_BUS_FMT_YUYV12_1X24 0x2022 95#define MEDIA_BUS_FMT_YUYV12_1X24 0x2022
86#define MEDIA_BUS_FMT_YVYU12_1X24 0x2023 96#define MEDIA_BUS_FMT_YVYU12_1X24 0x2023
97#define MEDIA_BUS_FMT_YUV10_1X30 0x2016
98#define MEDIA_BUS_FMT_AYUV8_1X32 0x2017
87 99
88/* Bayer - next is 0x3019 */ 100/* Bayer - next is 0x3019 */
89#define MEDIA_BUS_FMT_SBGGR8_1X8 0x3001 101#define MEDIA_BUS_FMT_SBGGR8_1X8 0x3001
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index d847c760e8f0..4e816be3de39 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -50,7 +50,14 @@ struct media_device_info {
50#define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1) 50#define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1)
51#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2) 51#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)
52#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) 52#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3)
53#define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4) 53#define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_DEVNODE + 4)
54#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_DEVNODE + 5)
55#define MEDIA_ENT_T_DEVNODE_DVB_DVR (MEDIA_ENT_T_DEVNODE + 6)
56#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_DEVNODE + 7)
57#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_DEVNODE + 8)
58
59/* Legacy symbol. Use it to avoid userspace compilation breakages */
60#define MEDIA_ENT_T_DEVNODE_DVB MEDIA_ENT_T_DEVNODE_DVB_FE
54 61
55#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT) 62#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT)
56#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1) 63#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1)
@@ -59,6 +66,8 @@ struct media_device_info {
59/* A converter of analogue video to its digital representation. */ 66/* A converter of analogue video to its digital representation. */
60#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV + 4) 67#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER (MEDIA_ENT_T_V4L2_SUBDEV + 4)
61 68
69#define MEDIA_ENT_T_V4L2_SUBDEV_TUNER (MEDIA_ENT_T_V4L2_SUBDEV + 5)
70
62#define MEDIA_ENT_FL_DEFAULT (1 << 0) 71#define MEDIA_ENT_FL_DEFAULT (1 << 0)
63 72
64struct media_entity_desc { 73struct media_entity_desc {
@@ -78,17 +87,48 @@ struct media_entity_desc {
78 struct { 87 struct {
79 __u32 major; 88 __u32 major;
80 __u32 minor; 89 __u32 minor;
81 } v4l; 90 } dev;
82 struct { 91
83 __u32 major; 92#if 1
84 __u32 minor; 93 /*
85 } fb; 94 * TODO: this shouldn't have been added without
95 * actual drivers that use this. When the first real driver
96 * appears that sets this information, special attention
97 * should be given whether this information is 1) enough, and
98 * 2) can deal with udev rules that rename devices. The struct
99 * dev would not be sufficient for this since that does not
100 * contain the subdevice information. In addition, struct dev
101 * can only refer to a single device, and not to multiple (e.g.
102 * pcm and mixer devices).
103 *
104 * So for now mark this as a to do.
105 */
86 struct { 106 struct {
87 __u32 card; 107 __u32 card;
88 __u32 device; 108 __u32 device;
89 __u32 subdevice; 109 __u32 subdevice;
90 } alsa; 110 } alsa;
111#endif
112
113#if 1
114 /*
115 * DEPRECATED: previous node specifications. Kept just to
116 * avoid breaking compilation, but media_entity_desc.dev
117 * should be used instead. In particular, alsa and dvb
118 * fields below are wrong: for all devnodes, there should
119 * be just major/minor inside the struct, as this is enough
120 * to represent any devnode, no matter what type.
121 */
122 struct {
123 __u32 major;
124 __u32 minor;
125 } v4l;
126 struct {
127 __u32 major;
128 __u32 minor;
129 } fb;
91 int dvb; 130 int dvb;
131#endif
92 132
93 /* Sub-device specifications */ 133 /* Sub-device specifications */
94 /* Nothing needed yet */ 134 /* Nothing needed yet */
diff --git a/include/uapi/linux/neighbour.h b/include/uapi/linux/neighbour.h
index 3873a35509aa..2e35c61bbdd1 100644
--- a/include/uapi/linux/neighbour.h
+++ b/include/uapi/linux/neighbour.h
@@ -126,6 +126,7 @@ enum {
126 NDTPA_PROXY_QLEN, /* u32 */ 126 NDTPA_PROXY_QLEN, /* u32 */
127 NDTPA_LOCKTIME, /* u64, msecs */ 127 NDTPA_LOCKTIME, /* u64, msecs */
128 NDTPA_QUEUE_LENBYTES, /* u32 */ 128 NDTPA_QUEUE_LENBYTES, /* u32 */
129 NDTPA_MCAST_REPROBES, /* u32 */
129 __NDTPA_MAX 130 __NDTPA_MAX
130}; 131};
131#define NDTPA_MAX (__NDTPA_MAX - 1) 132#define NDTPA_MAX (__NDTPA_MAX - 1)
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index 832bc46db78b..5fa1cd04762e 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -1,19 +1,49 @@
1#ifndef _LINUX_NF_TABLES_H 1#ifndef _LINUX_NF_TABLES_H
2#define _LINUX_NF_TABLES_H 2#define _LINUX_NF_TABLES_H
3 3
4#define NFT_TABLE_MAXNAMELEN 32
4#define NFT_CHAIN_MAXNAMELEN 32 5#define NFT_CHAIN_MAXNAMELEN 32
5#define NFT_USERDATA_MAXLEN 256 6#define NFT_USERDATA_MAXLEN 256
6 7
8/**
9 * enum nft_registers - nf_tables registers
10 *
11 * nf_tables used to have five registers: a verdict register and four data
12 * registers of size 16. The data registers have been changed to 16 registers
13 * of size 4. For compatibility reasons, the NFT_REG_[1-4] registers still
14 * map to areas of size 16, the 4 byte registers are addressed using
15 * NFT_REG32_00 - NFT_REG32_15.
16 */
7enum nft_registers { 17enum nft_registers {
8 NFT_REG_VERDICT, 18 NFT_REG_VERDICT,
9 NFT_REG_1, 19 NFT_REG_1,
10 NFT_REG_2, 20 NFT_REG_2,
11 NFT_REG_3, 21 NFT_REG_3,
12 NFT_REG_4, 22 NFT_REG_4,
13 __NFT_REG_MAX 23 __NFT_REG_MAX,
24
25 NFT_REG32_00 = 8,
26 MFT_REG32_01,
27 NFT_REG32_02,
28 NFT_REG32_03,
29 NFT_REG32_04,
30 NFT_REG32_05,
31 NFT_REG32_06,
32 NFT_REG32_07,
33 NFT_REG32_08,
34 NFT_REG32_09,
35 NFT_REG32_10,
36 NFT_REG32_11,
37 NFT_REG32_12,
38 NFT_REG32_13,
39 NFT_REG32_14,
40 NFT_REG32_15,
14}; 41};
15#define NFT_REG_MAX (__NFT_REG_MAX - 1) 42#define NFT_REG_MAX (__NFT_REG_MAX - 1)
16 43
44#define NFT_REG_SIZE 16
45#define NFT_REG32_SIZE 4
46
17/** 47/**
18 * enum nft_verdicts - nf_tables internal verdicts 48 * enum nft_verdicts - nf_tables internal verdicts
19 * 49 *
@@ -207,12 +237,16 @@ enum nft_rule_compat_attributes {
207 * @NFT_SET_CONSTANT: set contents may not change while bound 237 * @NFT_SET_CONSTANT: set contents may not change while bound
208 * @NFT_SET_INTERVAL: set contains intervals 238 * @NFT_SET_INTERVAL: set contains intervals
209 * @NFT_SET_MAP: set is used as a dictionary 239 * @NFT_SET_MAP: set is used as a dictionary
240 * @NFT_SET_TIMEOUT: set uses timeouts
241 * @NFT_SET_EVAL: set contains expressions for evaluation
210 */ 242 */
211enum nft_set_flags { 243enum nft_set_flags {
212 NFT_SET_ANONYMOUS = 0x1, 244 NFT_SET_ANONYMOUS = 0x1,
213 NFT_SET_CONSTANT = 0x2, 245 NFT_SET_CONSTANT = 0x2,
214 NFT_SET_INTERVAL = 0x4, 246 NFT_SET_INTERVAL = 0x4,
215 NFT_SET_MAP = 0x8, 247 NFT_SET_MAP = 0x8,
248 NFT_SET_TIMEOUT = 0x10,
249 NFT_SET_EVAL = 0x20,
216}; 250};
217 251
218/** 252/**
@@ -251,6 +285,8 @@ enum nft_set_desc_attributes {
251 * @NFTA_SET_POLICY: selection policy (NLA_U32) 285 * @NFTA_SET_POLICY: selection policy (NLA_U32)
252 * @NFTA_SET_DESC: set description (NLA_NESTED) 286 * @NFTA_SET_DESC: set description (NLA_NESTED)
253 * @NFTA_SET_ID: uniquely identifies a set in a transaction (NLA_U32) 287 * @NFTA_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
288 * @NFTA_SET_TIMEOUT: default timeout value (NLA_U64)
289 * @NFTA_SET_GC_INTERVAL: garbage collection interval (NLA_U32)
254 */ 290 */
255enum nft_set_attributes { 291enum nft_set_attributes {
256 NFTA_SET_UNSPEC, 292 NFTA_SET_UNSPEC,
@@ -264,6 +300,8 @@ enum nft_set_attributes {
264 NFTA_SET_POLICY, 300 NFTA_SET_POLICY,
265 NFTA_SET_DESC, 301 NFTA_SET_DESC,
266 NFTA_SET_ID, 302 NFTA_SET_ID,
303 NFTA_SET_TIMEOUT,
304 NFTA_SET_GC_INTERVAL,
267 __NFTA_SET_MAX 305 __NFTA_SET_MAX
268}; 306};
269#define NFTA_SET_MAX (__NFTA_SET_MAX - 1) 307#define NFTA_SET_MAX (__NFTA_SET_MAX - 1)
@@ -283,12 +321,20 @@ enum nft_set_elem_flags {
283 * @NFTA_SET_ELEM_KEY: key value (NLA_NESTED: nft_data) 321 * @NFTA_SET_ELEM_KEY: key value (NLA_NESTED: nft_data)
284 * @NFTA_SET_ELEM_DATA: data value of mapping (NLA_NESTED: nft_data_attributes) 322 * @NFTA_SET_ELEM_DATA: data value of mapping (NLA_NESTED: nft_data_attributes)
285 * @NFTA_SET_ELEM_FLAGS: bitmask of nft_set_elem_flags (NLA_U32) 323 * @NFTA_SET_ELEM_FLAGS: bitmask of nft_set_elem_flags (NLA_U32)
324 * @NFTA_SET_ELEM_TIMEOUT: timeout value (NLA_U64)
325 * @NFTA_SET_ELEM_EXPIRATION: expiration time (NLA_U64)
326 * @NFTA_SET_ELEM_USERDATA: user data (NLA_BINARY)
327 * @NFTA_SET_ELEM_EXPR: expression (NLA_NESTED: nft_expr_attributes)
286 */ 328 */
287enum nft_set_elem_attributes { 329enum nft_set_elem_attributes {
288 NFTA_SET_ELEM_UNSPEC, 330 NFTA_SET_ELEM_UNSPEC,
289 NFTA_SET_ELEM_KEY, 331 NFTA_SET_ELEM_KEY,
290 NFTA_SET_ELEM_DATA, 332 NFTA_SET_ELEM_DATA,
291 NFTA_SET_ELEM_FLAGS, 333 NFTA_SET_ELEM_FLAGS,
334 NFTA_SET_ELEM_TIMEOUT,
335 NFTA_SET_ELEM_EXPIRATION,
336 NFTA_SET_ELEM_USERDATA,
337 NFTA_SET_ELEM_EXPR,
292 __NFTA_SET_ELEM_MAX 338 __NFTA_SET_ELEM_MAX
293}; 339};
294#define NFTA_SET_ELEM_MAX (__NFTA_SET_ELEM_MAX - 1) 340#define NFTA_SET_ELEM_MAX (__NFTA_SET_ELEM_MAX - 1)
@@ -346,6 +392,9 @@ enum nft_data_attributes {
346}; 392};
347#define NFTA_DATA_MAX (__NFTA_DATA_MAX - 1) 393#define NFTA_DATA_MAX (__NFTA_DATA_MAX - 1)
348 394
395/* Maximum length of a value */
396#define NFT_DATA_VALUE_MAXLEN 64
397
349/** 398/**
350 * enum nft_verdict_attributes - nf_tables verdict netlink attributes 399 * enum nft_verdict_attributes - nf_tables verdict netlink attributes
351 * 400 *
@@ -504,6 +553,35 @@ enum nft_lookup_attributes {
504}; 553};
505#define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1) 554#define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1)
506 555
556enum nft_dynset_ops {
557 NFT_DYNSET_OP_ADD,
558 NFT_DYNSET_OP_UPDATE,
559};
560
561/**
562 * enum nft_dynset_attributes - dynset expression attributes
563 *
564 * @NFTA_DYNSET_SET_NAME: name of set the to add data to (NLA_STRING)
565 * @NFTA_DYNSET_SET_ID: uniquely identifier of the set in the transaction (NLA_U32)
566 * @NFTA_DYNSET_OP: operation (NLA_U32)
567 * @NFTA_DYNSET_SREG_KEY: source register of the key (NLA_U32)
568 * @NFTA_DYNSET_SREG_DATA: source register of the data (NLA_U32)
569 * @NFTA_DYNSET_TIMEOUT: timeout value for the new element (NLA_U64)
570 * @NFTA_DYNSET_EXPR: expression (NLA_NESTED: nft_expr_attributes)
571 */
572enum nft_dynset_attributes {
573 NFTA_DYNSET_UNSPEC,
574 NFTA_DYNSET_SET_NAME,
575 NFTA_DYNSET_SET_ID,
576 NFTA_DYNSET_OP,
577 NFTA_DYNSET_SREG_KEY,
578 NFTA_DYNSET_SREG_DATA,
579 NFTA_DYNSET_TIMEOUT,
580 NFTA_DYNSET_EXPR,
581 __NFTA_DYNSET_MAX,
582};
583#define NFTA_DYNSET_MAX (__NFTA_DYNSET_MAX - 1)
584
507/** 585/**
508 * enum nft_payload_bases - nf_tables payload expression offset bases 586 * enum nft_payload_bases - nf_tables payload expression offset bases
509 * 587 *
diff --git a/include/uapi/linux/netfilter_bridge/ebtables.h b/include/uapi/linux/netfilter_bridge/ebtables.h
index ba993360dbe9..773dfe8924c7 100644
--- a/include/uapi/linux/netfilter_bridge/ebtables.h
+++ b/include/uapi/linux/netfilter_bridge/ebtables.h
@@ -12,9 +12,7 @@
12 12
13#ifndef _UAPI__LINUX_BRIDGE_EFF_H 13#ifndef _UAPI__LINUX_BRIDGE_EFF_H
14#define _UAPI__LINUX_BRIDGE_EFF_H 14#define _UAPI__LINUX_BRIDGE_EFF_H
15#include <linux/if.h>
16#include <linux/netfilter_bridge.h> 15#include <linux/netfilter_bridge.h>
17#include <linux/if_ether.h>
18 16
19#define EBT_TABLE_MAXNAMELEN 32 17#define EBT_TABLE_MAXNAMELEN 32
20#define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN 18#define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN
diff --git a/include/uapi/linux/nfs4.h b/include/uapi/linux/nfs4.h
index 35f5f4c6c260..adc0aff83fbb 100644
--- a/include/uapi/linux/nfs4.h
+++ b/include/uapi/linux/nfs4.h
@@ -162,13 +162,6 @@
162 */ 162 */
163#define NFS4_MAX_BACK_CHANNEL_OPS 2 163#define NFS4_MAX_BACK_CHANNEL_OPS 2
164 164
165enum nfs4_acl_whotype {
166 NFS4_ACL_WHO_NAMED = 0,
167 NFS4_ACL_WHO_OWNER,
168 NFS4_ACL_WHO_GROUP,
169 NFS4_ACL_WHO_EVERYONE,
170};
171
172#endif /* _UAPI_LINUX_NFS4_H */ 165#endif /* _UAPI_LINUX_NFS4_H */
173 166
174/* 167/*
diff --git a/include/uapi/linux/nfs_idmap.h b/include/uapi/linux/nfs_idmap.h
index 8d4b1c7b24d4..038e36c96669 100644
--- a/include/uapi/linux/nfs_idmap.h
+++ b/include/uapi/linux/nfs_idmap.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/linux/nfs_idmap.h 2 * include/uapi/linux/nfs_idmap.h
3 * 3 *
4 * UID and GID to name mapping for clients. 4 * UID and GID to name mapping for clients.
5 * 5 *
diff --git a/include/uapi/linux/nfsd/debug.h b/include/uapi/linux/nfsd/debug.h
index 0bf130a1c58d..28ec6c9c421a 100644
--- a/include/uapi/linux/nfsd/debug.h
+++ b/include/uapi/linux/nfsd/debug.h
@@ -12,14 +12,6 @@
12#include <linux/sunrpc/debug.h> 12#include <linux/sunrpc/debug.h>
13 13
14/* 14/*
15 * Enable debugging for nfsd.
16 * Requires RPC_DEBUG.
17 */
18#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
19# define NFSD_DEBUG 1
20#endif
21
22/*
23 * knfsd debug flags 15 * knfsd debug flags
24 */ 16 */
25#define NFSDDBG_SOCK 0x0001 17#define NFSDDBG_SOCK 0x0001
diff --git a/include/uapi/linux/nfsd/export.h b/include/uapi/linux/nfsd/export.h
index 4742f2cb42f2..0df7bd5d2fb1 100644
--- a/include/uapi/linux/nfsd/export.h
+++ b/include/uapi/linux/nfsd/export.h
@@ -21,6 +21,9 @@
21 21
22/* 22/*
23 * Export flags. 23 * Export flags.
24 *
25 * Please update the expflags[] array in fs/nfsd/export.c when adding
26 * a new flag.
24 */ 27 */
25#define NFSEXP_READONLY 0x0001 28#define NFSEXP_READONLY 0x0001
26#define NFSEXP_INSECURE_PORT 0x0002 29#define NFSEXP_INSECURE_PORT 0x0002
@@ -47,7 +50,7 @@
47 * exported filesystem. 50 * exported filesystem.
48 */ 51 */
49#define NFSEXP_V4ROOT 0x10000 52#define NFSEXP_V4ROOT 0x10000
50#define NFSEXP_NOPNFS 0x20000 53#define NFSEXP_PNFS 0x20000
51 54
52/* All flags that we claim to support. (Note we don't support NOACL.) */ 55/* All flags that we claim to support. (Note we don't support NOACL.) */
53#define NFSEXP_ALLFLAGS 0x3FE7F 56#define NFSEXP_ALLFLAGS 0x3FE7F
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 68b294e83944..241220c43e86 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -25,6 +25,19 @@
25 * 25 *
26 */ 26 */
27 27
28/*
29 * This header file defines the userspace API to the wireless stack. Please
30 * be careful not to break things - i.e. don't move anything around or so
31 * unless you can demonstrate that it breaks neither API nor ABI.
32 *
33 * Additions to the API should be accompanied by actual implementations in
34 * an upstream driver, so that example implementations exist in case there
35 * are ever concerns about the precise semantics of the API or changes are
36 * needed, and to ensure that code for dead (no longer implemented) API
37 * can actually be identified and removed.
38 * Nonetheless, semantics should also be documented carefully in this file.
39 */
40
28#include <linux/types.h> 41#include <linux/types.h>
29 42
30#define NL80211_GENL_NAME "nl80211" 43#define NL80211_GENL_NAME "nl80211"
@@ -1684,6 +1697,10 @@ enum nl80211_commands {
1684 * If set during scheduled scan start then the new scan req will be 1697 * If set during scheduled scan start then the new scan req will be
1685 * owned by the netlink socket that created it and the scheduled scan will 1698 * owned by the netlink socket that created it and the scheduled scan will
1686 * be stopped when the socket is closed. 1699 * be stopped when the socket is closed.
1700 * If set during configuration of regulatory indoor operation then the
1701 * regulatory indoor configuration would be owned by the netlink socket
1702 * that configured the indoor setting, and the indoor operation would be
1703 * cleared when the socket is closed.
1687 * 1704 *
1688 * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is 1705 * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
1689 * the TDLS link initiator. 1706 * the TDLS link initiator.
@@ -1737,8 +1754,12 @@ enum nl80211_commands {
1737 * should be contained in the result as the sum of the respective counters 1754 * should be contained in the result as the sum of the respective counters
1738 * over all channels. 1755 * over all channels.
1739 * 1756 *
1740 * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before a scheduled scan (or a 1757 * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a
1741 * WoWLAN net-detect scan) is started, u32 in seconds. 1758 * scheduled scan (or a WoWLAN net-detect scan) is started, u32
1759 * in seconds.
1760
1761 * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
1762 * is operating in an indoor environment.
1742 * 1763 *
1743 * @NUM_NL80211_ATTR: total number of nl80211_attrs available 1764 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
1744 * @NL80211_ATTR_MAX: highest attribute number currently defined 1765 * @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2107,6 +2128,8 @@ enum nl80211_attrs {
2107 2128
2108 NL80211_ATTR_SCHED_SCAN_DELAY, 2129 NL80211_ATTR_SCHED_SCAN_DELAY,
2109 2130
2131 NL80211_ATTR_REG_INDOOR,
2132
2110 /* add attributes here, update the policy in nl80211.c */ 2133 /* add attributes here, update the policy in nl80211.c */
2111 2134
2112 __NL80211_ATTR_AFTER_LAST, 2135 __NL80211_ATTR_AFTER_LAST,
@@ -3092,7 +3115,8 @@ enum nl80211_mesh_power_mode {
3092 * 3115 *
3093 * @NL80211_MESHCONF_PLINK_TIMEOUT: If no tx activity is seen from a STA we've 3116 * @NL80211_MESHCONF_PLINK_TIMEOUT: If no tx activity is seen from a STA we've
3094 * established peering with for longer than this time (in seconds), then 3117 * established peering with for longer than this time (in seconds), then
3095 * remove it from the STA's list of peers. Default is 30 minutes. 3118 * remove it from the STA's list of peers. You may set this to 0 to disable
3119 * the removal of the STA. Default is 30 minutes.
3096 * 3120 *
3097 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use 3121 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
3098 */ 3122 */
@@ -3694,6 +3718,8 @@ struct nl80211_pattern_support {
3694 * @NL80211_WOWLAN_TRIG_ANY: wake up on any activity, do not really put 3718 * @NL80211_WOWLAN_TRIG_ANY: wake up on any activity, do not really put
3695 * the chip into a special state -- works best with chips that have 3719 * the chip into a special state -- works best with chips that have
3696 * support for low-power operation already (flag) 3720 * support for low-power operation already (flag)
3721 * Note that this mode is incompatible with all of the others, if
3722 * any others are even supported by the device.
3697 * @NL80211_WOWLAN_TRIG_DISCONNECT: wake up on disconnect, the way disconnect 3723 * @NL80211_WOWLAN_TRIG_DISCONNECT: wake up on disconnect, the way disconnect
3698 * is detected is implementation-specific (flag) 3724 * is detected is implementation-specific (flag)
3699 * @NL80211_WOWLAN_TRIG_MAGIC_PKT: wake up on magic packet (6x 0xff, followed 3725 * @NL80211_WOWLAN_TRIG_MAGIC_PKT: wake up on magic packet (6x 0xff, followed
@@ -4327,11 +4353,13 @@ enum nl80211_feature_flags {
4327 4353
4328/** 4354/**
4329 * enum nl80211_ext_feature_index - bit index of extended features. 4355 * enum nl80211_ext_feature_index - bit index of extended features.
4356 * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates.
4330 * 4357 *
4331 * @NUM_NL80211_EXT_FEATURES: number of extended features. 4358 * @NUM_NL80211_EXT_FEATURES: number of extended features.
4332 * @MAX_NL80211_EXT_FEATURES: highest extended feature index. 4359 * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
4333 */ 4360 */
4334enum nl80211_ext_feature_index { 4361enum nl80211_ext_feature_index {
4362 NL80211_EXT_FEATURE_VHT_IBSS,
4335 4363
4336 /* add new features before the definition below */ 4364 /* add new features before the definition below */
4337 NUM_NL80211_EXT_FEATURES, 4365 NUM_NL80211_EXT_FEATURES,
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 9b79abbd1ab8..309211b3eb67 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -152,21 +152,42 @@ enum perf_event_sample_format {
152 * The branch types can be combined, however BRANCH_ANY covers all types 152 * The branch types can be combined, however BRANCH_ANY covers all types
153 * of branches and therefore it supersedes all the other types. 153 * of branches and therefore it supersedes all the other types.
154 */ 154 */
155enum perf_branch_sample_type_shift {
156 PERF_SAMPLE_BRANCH_USER_SHIFT = 0, /* user branches */
157 PERF_SAMPLE_BRANCH_KERNEL_SHIFT = 1, /* kernel branches */
158 PERF_SAMPLE_BRANCH_HV_SHIFT = 2, /* hypervisor branches */
159
160 PERF_SAMPLE_BRANCH_ANY_SHIFT = 3, /* any branch types */
161 PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT = 4, /* any call branch */
162 PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT = 5, /* any return branch */
163 PERF_SAMPLE_BRANCH_IND_CALL_SHIFT = 6, /* indirect calls */
164 PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT = 7, /* transaction aborts */
165 PERF_SAMPLE_BRANCH_IN_TX_SHIFT = 8, /* in transaction */
166 PERF_SAMPLE_BRANCH_NO_TX_SHIFT = 9, /* not in transaction */
167 PERF_SAMPLE_BRANCH_COND_SHIFT = 10, /* conditional branches */
168
169 PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT = 11, /* call/ret stack */
170
171 PERF_SAMPLE_BRANCH_MAX_SHIFT /* non-ABI */
172};
173
155enum perf_branch_sample_type { 174enum perf_branch_sample_type {
156 PERF_SAMPLE_BRANCH_USER = 1U << 0, /* user branches */ 175 PERF_SAMPLE_BRANCH_USER = 1U << PERF_SAMPLE_BRANCH_USER_SHIFT,
157 PERF_SAMPLE_BRANCH_KERNEL = 1U << 1, /* kernel branches */ 176 PERF_SAMPLE_BRANCH_KERNEL = 1U << PERF_SAMPLE_BRANCH_KERNEL_SHIFT,
158 PERF_SAMPLE_BRANCH_HV = 1U << 2, /* hypervisor branches */ 177 PERF_SAMPLE_BRANCH_HV = 1U << PERF_SAMPLE_BRANCH_HV_SHIFT,
159 178
160 PERF_SAMPLE_BRANCH_ANY = 1U << 3, /* any branch types */ 179 PERF_SAMPLE_BRANCH_ANY = 1U << PERF_SAMPLE_BRANCH_ANY_SHIFT,
161 PERF_SAMPLE_BRANCH_ANY_CALL = 1U << 4, /* any call branch */ 180 PERF_SAMPLE_BRANCH_ANY_CALL = 1U << PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT,
162 PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << 5, /* any return branch */ 181 PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT,
163 PERF_SAMPLE_BRANCH_IND_CALL = 1U << 6, /* indirect calls */ 182 PERF_SAMPLE_BRANCH_IND_CALL = 1U << PERF_SAMPLE_BRANCH_IND_CALL_SHIFT,
164 PERF_SAMPLE_BRANCH_ABORT_TX = 1U << 7, /* transaction aborts */ 183 PERF_SAMPLE_BRANCH_ABORT_TX = 1U << PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT,
165 PERF_SAMPLE_BRANCH_IN_TX = 1U << 8, /* in transaction */ 184 PERF_SAMPLE_BRANCH_IN_TX = 1U << PERF_SAMPLE_BRANCH_IN_TX_SHIFT,
166 PERF_SAMPLE_BRANCH_NO_TX = 1U << 9, /* not in transaction */ 185 PERF_SAMPLE_BRANCH_NO_TX = 1U << PERF_SAMPLE_BRANCH_NO_TX_SHIFT,
167 PERF_SAMPLE_BRANCH_COND = 1U << 10, /* conditional branches */ 186 PERF_SAMPLE_BRANCH_COND = 1U << PERF_SAMPLE_BRANCH_COND_SHIFT,
168 187
169 PERF_SAMPLE_BRANCH_MAX = 1U << 11, /* non-ABI */ 188 PERF_SAMPLE_BRANCH_CALL_STACK = 1U << PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT,
189
190 PERF_SAMPLE_BRANCH_MAX = 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT,
170}; 191};
171 192
172#define PERF_SAMPLE_BRANCH_PLM_ALL \ 193#define PERF_SAMPLE_BRANCH_PLM_ALL \
@@ -240,6 +261,7 @@ enum perf_event_read_format {
240#define PERF_ATTR_SIZE_VER3 96 /* add: sample_regs_user */ 261#define PERF_ATTR_SIZE_VER3 96 /* add: sample_regs_user */
241 /* add: sample_stack_user */ 262 /* add: sample_stack_user */
242#define PERF_ATTR_SIZE_VER4 104 /* add: sample_regs_intr */ 263#define PERF_ATTR_SIZE_VER4 104 /* add: sample_regs_intr */
264#define PERF_ATTR_SIZE_VER5 112 /* add: aux_watermark */
243 265
244/* 266/*
245 * Hardware event_id to monitor via a performance monitoring event: 267 * Hardware event_id to monitor via a performance monitoring event:
@@ -305,7 +327,8 @@ struct perf_event_attr {
305 exclude_callchain_user : 1, /* exclude user callchains */ 327 exclude_callchain_user : 1, /* exclude user callchains */
306 mmap2 : 1, /* include mmap with inode data */ 328 mmap2 : 1, /* include mmap with inode data */
307 comm_exec : 1, /* flag comm events that are due to an exec */ 329 comm_exec : 1, /* flag comm events that are due to an exec */
308 __reserved_1 : 39; 330 use_clockid : 1, /* use @clockid for time fields */
331 __reserved_1 : 38;
309 332
310 union { 333 union {
311 __u32 wakeup_events; /* wakeup every n events */ 334 __u32 wakeup_events; /* wakeup every n events */
@@ -334,8 +357,7 @@ struct perf_event_attr {
334 */ 357 */
335 __u32 sample_stack_user; 358 __u32 sample_stack_user;
336 359
337 /* Align to u64. */ 360 __s32 clockid;
338 __u32 __reserved_2;
339 /* 361 /*
340 * Defines set of regs to dump for each sample 362 * Defines set of regs to dump for each sample
341 * state captured on: 363 * state captured on:
@@ -345,6 +367,12 @@ struct perf_event_attr {
345 * See asm/perf_regs.h for details. 367 * See asm/perf_regs.h for details.
346 */ 368 */
347 __u64 sample_regs_intr; 369 __u64 sample_regs_intr;
370
371 /*
372 * Wakeup watermark for AUX area
373 */
374 __u32 aux_watermark;
375 __u32 __reserved_2; /* align to __u64 */
348}; 376};
349 377
350#define perf_flags(attr) (*(&(attr)->read_format + 1)) 378#define perf_flags(attr) (*(&(attr)->read_format + 1))
@@ -360,6 +388,7 @@ struct perf_event_attr {
360#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) 388#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5)
361#define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) 389#define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *)
362#define PERF_EVENT_IOC_ID _IOR('$', 7, __u64 *) 390#define PERF_EVENT_IOC_ID _IOR('$', 7, __u64 *)
391#define PERF_EVENT_IOC_SET_BPF _IOW('$', 8, __u32)
363 392
364enum perf_event_ioc_flags { 393enum perf_event_ioc_flags {
365 PERF_IOC_FLAG_GROUP = 1U << 0, 394 PERF_IOC_FLAG_GROUP = 1U << 0,
@@ -500,9 +529,30 @@ struct perf_event_mmap_page {
500 * In this case the kernel will not over-write unread data. 529 * In this case the kernel will not over-write unread data.
501 * 530 *
502 * See perf_output_put_handle() for the data ordering. 531 * See perf_output_put_handle() for the data ordering.
532 *
533 * data_{offset,size} indicate the location and size of the perf record
534 * buffer within the mmapped area.
503 */ 535 */
504 __u64 data_head; /* head in the data section */ 536 __u64 data_head; /* head in the data section */
505 __u64 data_tail; /* user-space written tail */ 537 __u64 data_tail; /* user-space written tail */
538 __u64 data_offset; /* where the buffer starts */
539 __u64 data_size; /* data buffer size */
540
541 /*
542 * AUX area is defined by aux_{offset,size} fields that should be set
543 * by the userspace, so that
544 *
545 * aux_offset >= data_offset + data_size
546 *
547 * prior to mmap()ing it. Size of the mmap()ed area should be aux_size.
548 *
549 * Ring buffer pointers aux_{head,tail} have the same semantics as
550 * data_{head,tail} and same ordering rules apply.
551 */
552 __u64 aux_head;
553 __u64 aux_tail;
554 __u64 aux_offset;
555 __u64 aux_size;
506}; 556};
507 557
508#define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0) 558#define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0)
@@ -725,6 +775,31 @@ enum perf_event_type {
725 */ 775 */
726 PERF_RECORD_MMAP2 = 10, 776 PERF_RECORD_MMAP2 = 10,
727 777
778 /*
779 * Records that new data landed in the AUX buffer part.
780 *
781 * struct {
782 * struct perf_event_header header;
783 *
784 * u64 aux_offset;
785 * u64 aux_size;
786 * u64 flags;
787 * struct sample_id sample_id;
788 * };
789 */
790 PERF_RECORD_AUX = 11,
791
792 /*
793 * Indicates that instruction trace has started
794 *
795 * struct {
796 * struct perf_event_header header;
797 * u32 pid;
798 * u32 tid;
799 * };
800 */
801 PERF_RECORD_ITRACE_START = 12,
802
728 PERF_RECORD_MAX, /* non-ABI */ 803 PERF_RECORD_MAX, /* non-ABI */
729}; 804};
730 805
@@ -742,6 +817,12 @@ enum perf_callchain_context {
742 PERF_CONTEXT_MAX = (__u64)-4095, 817 PERF_CONTEXT_MAX = (__u64)-4095,
743}; 818};
744 819
820/**
821 * PERF_RECORD_AUX::flags bits
822 */
823#define PERF_AUX_FLAG_TRUNCATED 0x01 /* record was truncated to fit */
824#define PERF_AUX_FLAG_OVERWRITE 0x02 /* snapshot from overwrite mode */
825
745#define PERF_FLAG_FD_NO_GROUP (1UL << 0) 826#define PERF_FLAG_FD_NO_GROUP (1UL << 0)
746#define PERF_FLAG_FD_OUTPUT (1UL << 1) 827#define PERF_FLAG_FD_OUTPUT (1UL << 1)
747#define PERF_FLAG_PID_CGROUP (1UL << 2) /* pid=cgroup id, per-cpu mode only */ 828#define PERF_FLAG_PID_CGROUP (1UL << 2) /* pid=cgroup id, per-cpu mode only */
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index 25731dfb3fcc..bf08e76bf505 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -397,6 +397,8 @@ enum {
397 TCA_BPF_CLASSID, 397 TCA_BPF_CLASSID,
398 TCA_BPF_OPS_LEN, 398 TCA_BPF_OPS_LEN,
399 TCA_BPF_OPS, 399 TCA_BPF_OPS,
400 TCA_BPF_FD,
401 TCA_BPF_NAME,
400 __TCA_BPF_MAX, 402 __TCA_BPF_MAX,
401}; 403};
402 404
diff --git a/include/uapi/linux/quota.h b/include/uapi/linux/quota.h
index 1f49b8341c99..9c95b2c1c88a 100644
--- a/include/uapi/linux/quota.h
+++ b/include/uapi/linux/quota.h
@@ -36,11 +36,12 @@
36#include <linux/errno.h> 36#include <linux/errno.h>
37#include <linux/types.h> 37#include <linux/types.h>
38 38
39#define __DQUOT_VERSION__ "dquot_6.5.2" 39#define __DQUOT_VERSION__ "dquot_6.6.0"
40 40
41#define MAXQUOTAS 2 41#define MAXQUOTAS 3
42#define USRQUOTA 0 /* element used for user quotas */ 42#define USRQUOTA 0 /* element used for user quotas */
43#define GRPQUOTA 1 /* element used for group quotas */ 43#define GRPQUOTA 1 /* element used for group quotas */
44#define PRJQUOTA 2 /* element used for project quotas */
44 45
45/* 46/*
46 * Definitions for the default names of the quotas files. 47 * Definitions for the default names of the quotas files.
@@ -48,6 +49,7 @@
48#define INITQFNAMES { \ 49#define INITQFNAMES { \
49 "user", /* USRQUOTA */ \ 50 "user", /* USRQUOTA */ \
50 "group", /* GRPQUOTA */ \ 51 "group", /* GRPQUOTA */ \
52 "project", /* PRJQUOTA */ \
51 "undefined", \ 53 "undefined", \
52}; 54};
53 55
diff --git a/include/uapi/linux/raid/md_p.h b/include/uapi/linux/raid/md_p.h
index 49f4210d4394..2ae6131e69a5 100644
--- a/include/uapi/linux/raid/md_p.h
+++ b/include/uapi/linux/raid/md_p.h
@@ -78,6 +78,12 @@
78#define MD_DISK_ACTIVE 1 /* disk is running or spare disk */ 78#define MD_DISK_ACTIVE 1 /* disk is running or spare disk */
79#define MD_DISK_SYNC 2 /* disk is in sync with the raid set */ 79#define MD_DISK_SYNC 2 /* disk is in sync with the raid set */
80#define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */ 80#define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */
81#define MD_DISK_CLUSTER_ADD 4 /* Initiate a disk add across the cluster
82 * For clustered enviroments only.
83 */
84#define MD_DISK_CANDIDATE 5 /* disk is added as spare (local) until confirmed
85 * For clustered enviroments only.
86 */
81 87
82#define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config. 88#define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config.
83 * read requests will only be sent here in 89 * read requests will only be sent here in
@@ -101,6 +107,7 @@ typedef struct mdp_device_descriptor_s {
101#define MD_SB_CLEAN 0 107#define MD_SB_CLEAN 0
102#define MD_SB_ERRORS 1 108#define MD_SB_ERRORS 1
103 109
110#define MD_SB_CLUSTERED 5 /* MD is clustered */
104#define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */ 111#define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */
105 112
106/* 113/*
diff --git a/include/uapi/linux/raid/md_u.h b/include/uapi/linux/raid/md_u.h
index 74e7c60c4716..1cb8aa6850b5 100644
--- a/include/uapi/linux/raid/md_u.h
+++ b/include/uapi/linux/raid/md_u.h
@@ -62,6 +62,7 @@
62#define STOP_ARRAY _IO (MD_MAJOR, 0x32) 62#define STOP_ARRAY _IO (MD_MAJOR, 0x32)
63#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33) 63#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
64#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34) 64#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
65#define CLUSTERED_DISK_NACK _IO (MD_MAJOR, 0x35)
65 66
66/* 63 partitions with the alternate major number (mdp) */ 67/* 63 partitions with the alternate major number (mdp) */
67#define MdpMinorShift 6 68#define MdpMinorShift 6
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index 5cc5d66bf519..974db03f7b1a 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -134,6 +134,8 @@ enum {
134 134
135 RTM_NEWNSID = 88, 135 RTM_NEWNSID = 88,
136#define RTM_NEWNSID RTM_NEWNSID 136#define RTM_NEWNSID RTM_NEWNSID
137 RTM_DELNSID = 89,
138#define RTM_DELNSID RTM_DELNSID
137 RTM_GETNSID = 90, 139 RTM_GETNSID = 90,
138#define RTM_GETNSID RTM_GETNSID 140#define RTM_GETNSID RTM_GETNSID
139 141
@@ -303,6 +305,9 @@ enum rtattr_type_t {
303 RTA_TABLE, 305 RTA_TABLE,
304 RTA_MARK, 306 RTA_MARK,
305 RTA_MFC_STATS, 307 RTA_MFC_STATS,
308 RTA_VIA,
309 RTA_NEWDST,
310 RTA_PREF,
306 __RTA_MAX 311 __RTA_MAX
307}; 312};
308 313
@@ -332,6 +337,7 @@ struct rtnexthop {
332#define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ 337#define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */
333#define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ 338#define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */
334#define RTNH_F_ONLINK 4 /* Gateway is forced on link */ 339#define RTNH_F_ONLINK 4 /* Gateway is forced on link */
340#define RTNH_F_EXTERNAL 8 /* Route installed externally */
335 341
336/* Macros to handle hexthops */ 342/* Macros to handle hexthops */
337 343
@@ -344,6 +350,12 @@ struct rtnexthop {
344#define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len)) 350#define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len))
345#define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0))) 351#define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0)))
346 352
353/* RTA_VIA */
354struct rtvia {
355 __kernel_sa_family_t rtvia_family;
356 __u8 rtvia_addr[0];
357};
358
347/* RTM_CACHEINFO */ 359/* RTM_CACHEINFO */
348 360
349struct rta_cacheinfo { 361struct rta_cacheinfo {
@@ -623,6 +635,10 @@ enum rtnetlink_groups {
623#define RTNLGRP_IPV6_NETCONF RTNLGRP_IPV6_NETCONF 635#define RTNLGRP_IPV6_NETCONF RTNLGRP_IPV6_NETCONF
624 RTNLGRP_MDB, 636 RTNLGRP_MDB,
625#define RTNLGRP_MDB RTNLGRP_MDB 637#define RTNLGRP_MDB RTNLGRP_MDB
638 RTNLGRP_MPLS_ROUTE,
639#define RTNLGRP_MPLS_ROUTE RTNLGRP_MPLS_ROUTE
640 RTNLGRP_NSID,
641#define RTNLGRP_NSID RTNLGRP_NSID
626 __RTNLGRP_MAX 642 __RTNLGRP_MAX
627}; 643};
628#define RTNLGRP_MAX (__RTNLGRP_MAX - 1) 644#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
diff --git a/include/uapi/linux/serial.h b/include/uapi/linux/serial.h
index 5e0d0ed61cf3..25331f9faa76 100644
--- a/include/uapi/linux/serial.h
+++ b/include/uapi/linux/serial.h
@@ -65,6 +65,10 @@ struct serial_struct {
65#define SERIAL_IO_PORT 0 65#define SERIAL_IO_PORT 0
66#define SERIAL_IO_HUB6 1 66#define SERIAL_IO_HUB6 1
67#define SERIAL_IO_MEM 2 67#define SERIAL_IO_MEM 2
68#define SERIAL_IO_MEM32 3
69#define SERIAL_IO_AU 4
70#define SERIAL_IO_TSI 5
71#define SERIAL_IO_MEM32BE 6
68 72
69#define UART_CLEAR_FIFO 0x01 73#define UART_CLEAR_FIFO 0x01
70#define UART_USE_FIFO 0x02 74#define UART_USE_FIFO 0x02
diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h
index 00adb01fa5f3..e9b4cb0cd7ed 100644
--- a/include/uapi/linux/serial_reg.h
+++ b/include/uapi/linux/serial_reg.h
@@ -242,25 +242,6 @@
242#define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */ 242#define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */
243 243
244/* 244/*
245 * Intel MID on-chip HSU (High Speed UART) defined bits
246 */
247#define UART_FCR_HSU_64_1B 0x00 /* receive FIFO treshold = 1 */
248#define UART_FCR_HSU_64_16B 0x40 /* receive FIFO treshold = 16 */
249#define UART_FCR_HSU_64_32B 0x80 /* receive FIFO treshold = 32 */
250#define UART_FCR_HSU_64_56B 0xc0 /* receive FIFO treshold = 56 */
251
252#define UART_FCR_HSU_16_1B 0x00 /* receive FIFO treshold = 1 */
253#define UART_FCR_HSU_16_4B 0x40 /* receive FIFO treshold = 4 */
254#define UART_FCR_HSU_16_8B 0x80 /* receive FIFO treshold = 8 */
255#define UART_FCR_HSU_16_14B 0xc0 /* receive FIFO treshold = 14 */
256
257#define UART_FCR_HSU_64B_FIFO 0x20 /* chose 64 bytes FIFO */
258#define UART_FCR_HSU_16B_FIFO 0x00 /* chose 16 bytes FIFO */
259
260#define UART_FCR_HALF_EMPT_TXI 0x00 /* trigger TX_EMPT IRQ for half empty */
261#define UART_FCR_FULL_EMPT_TXI 0x08 /* trigger TX_EMPT IRQ for full empty */
262
263/*
264 * These register definitions are for the 16C950 245 * These register definitions are for the 16C950
265 */ 246 */
266#define UART_ASR 0x01 /* Additional Status Register */ 247#define UART_ASR 0x01 /* Additional Status Register */
diff --git a/include/uapi/linux/target_core_user.h b/include/uapi/linux/target_core_user.h
index b483d1909d3e..b67f99d3c520 100644
--- a/include/uapi/linux/target_core_user.h
+++ b/include/uapi/linux/target_core_user.h
@@ -6,7 +6,7 @@
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/uio.h> 7#include <linux/uio.h>
8 8
9#define TCMU_VERSION "1.0" 9#define TCMU_VERSION "2.0"
10 10
11/* 11/*
12 * Ring Design 12 * Ring Design
@@ -39,9 +39,13 @@
39 * should process the next packet the same way, and so on. 39 * should process the next packet the same way, and so on.
40 */ 40 */
41 41
42#define TCMU_MAILBOX_VERSION 1 42#define TCMU_MAILBOX_VERSION 2
43#define ALIGN_SIZE 64 /* Should be enough for most CPUs */ 43#define ALIGN_SIZE 64 /* Should be enough for most CPUs */
44 44
45/* See https://gcc.gnu.org/onlinedocs/cpp/Stringification.html */
46#define xstr(s) str(s)
47#define str(s) #s
48
45struct tcmu_mailbox { 49struct tcmu_mailbox {
46 __u16 version; 50 __u16 version;
47 __u16 flags; 51 __u16 flags;
@@ -64,31 +68,36 @@ enum tcmu_opcode {
64 * Only a few opcodes, and length is 8-byte aligned, so use low bits for opcode. 68 * Only a few opcodes, and length is 8-byte aligned, so use low bits for opcode.
65 */ 69 */
66struct tcmu_cmd_entry_hdr { 70struct tcmu_cmd_entry_hdr {
67 __u32 len_op; 71 __u32 len_op;
72 __u16 cmd_id;
73 __u8 kflags;
74#define TCMU_UFLAG_UNKNOWN_OP 0x1
75 __u8 uflags;
76
68} __packed; 77} __packed;
69 78
70#define TCMU_OP_MASK 0x7 79#define TCMU_OP_MASK 0x7
71 80
72static inline enum tcmu_opcode tcmu_hdr_get_op(struct tcmu_cmd_entry_hdr *hdr) 81static inline enum tcmu_opcode tcmu_hdr_get_op(__u32 len_op)
73{ 82{
74 return hdr->len_op & TCMU_OP_MASK; 83 return len_op & TCMU_OP_MASK;
75} 84}
76 85
77static inline void tcmu_hdr_set_op(struct tcmu_cmd_entry_hdr *hdr, enum tcmu_opcode op) 86static inline void tcmu_hdr_set_op(__u32 *len_op, enum tcmu_opcode op)
78{ 87{
79 hdr->len_op &= ~TCMU_OP_MASK; 88 *len_op &= ~TCMU_OP_MASK;
80 hdr->len_op |= (op & TCMU_OP_MASK); 89 *len_op |= (op & TCMU_OP_MASK);
81} 90}
82 91
83static inline __u32 tcmu_hdr_get_len(struct tcmu_cmd_entry_hdr *hdr) 92static inline __u32 tcmu_hdr_get_len(__u32 len_op)
84{ 93{
85 return hdr->len_op & ~TCMU_OP_MASK; 94 return len_op & ~TCMU_OP_MASK;
86} 95}
87 96
88static inline void tcmu_hdr_set_len(struct tcmu_cmd_entry_hdr *hdr, __u32 len) 97static inline void tcmu_hdr_set_len(__u32 *len_op, __u32 len)
89{ 98{
90 hdr->len_op &= TCMU_OP_MASK; 99 *len_op &= TCMU_OP_MASK;
91 hdr->len_op |= len; 100 *len_op |= len;
92} 101}
93 102
94/* Currently the same as SCSI_SENSE_BUFFERSIZE */ 103/* Currently the same as SCSI_SENSE_BUFFERSIZE */
@@ -97,13 +106,14 @@ static inline void tcmu_hdr_set_len(struct tcmu_cmd_entry_hdr *hdr, __u32 len)
97struct tcmu_cmd_entry { 106struct tcmu_cmd_entry {
98 struct tcmu_cmd_entry_hdr hdr; 107 struct tcmu_cmd_entry_hdr hdr;
99 108
100 uint16_t cmd_id;
101 uint16_t __pad1;
102
103 union { 109 union {
104 struct { 110 struct {
111 uint32_t iov_cnt;
112 uint32_t iov_bidi_cnt;
113 uint32_t iov_dif_cnt;
105 uint64_t cdb_off; 114 uint64_t cdb_off;
106 uint64_t iov_cnt; 115 uint64_t __pad1;
116 uint64_t __pad2;
107 struct iovec iov[0]; 117 struct iovec iov[0];
108 } req; 118 } req;
109 struct { 119 struct {
diff --git a/include/uapi/linux/tc_act/Kbuild b/include/uapi/linux/tc_act/Kbuild
index 19d5219b0b99..242cf0c6e33d 100644
--- a/include/uapi/linux/tc_act/Kbuild
+++ b/include/uapi/linux/tc_act/Kbuild
@@ -9,3 +9,4 @@ header-y += tc_pedit.h
9header-y += tc_skbedit.h 9header-y += tc_skbedit.h
10header-y += tc_vlan.h 10header-y += tc_vlan.h
11header-y += tc_bpf.h 11header-y += tc_bpf.h
12header-y += tc_connmark.h
diff --git a/include/uapi/linux/tc_act/tc_bpf.h b/include/uapi/linux/tc_act/tc_bpf.h
index 5288bd77e63b..07f17cc70bb3 100644
--- a/include/uapi/linux/tc_act/tc_bpf.h
+++ b/include/uapi/linux/tc_act/tc_bpf.h
@@ -24,6 +24,8 @@ enum {
24 TCA_ACT_BPF_PARMS, 24 TCA_ACT_BPF_PARMS,
25 TCA_ACT_BPF_OPS_LEN, 25 TCA_ACT_BPF_OPS_LEN,
26 TCA_ACT_BPF_OPS, 26 TCA_ACT_BPF_OPS,
27 TCA_ACT_BPF_FD,
28 TCA_ACT_BPF_NAME,
27 __TCA_ACT_BPF_MAX, 29 __TCA_ACT_BPF_MAX,
28}; 30};
29#define TCA_ACT_BPF_MAX (__TCA_ACT_BPF_MAX - 1) 31#define TCA_ACT_BPF_MAX (__TCA_ACT_BPF_MAX - 1)
diff --git a/include/uapi/linux/tipc_netlink.h b/include/uapi/linux/tipc_netlink.h
index 8d723824ad69..d4c8f142ba63 100644
--- a/include/uapi/linux/tipc_netlink.h
+++ b/include/uapi/linux/tipc_netlink.h
@@ -83,11 +83,20 @@ enum {
83 TIPC_NLA_BEARER_NAME, /* string */ 83 TIPC_NLA_BEARER_NAME, /* string */
84 TIPC_NLA_BEARER_PROP, /* nest */ 84 TIPC_NLA_BEARER_PROP, /* nest */
85 TIPC_NLA_BEARER_DOMAIN, /* u32 */ 85 TIPC_NLA_BEARER_DOMAIN, /* u32 */
86 TIPC_NLA_BEARER_UDP_OPTS, /* nest */
86 87
87 __TIPC_NLA_BEARER_MAX, 88 __TIPC_NLA_BEARER_MAX,
88 TIPC_NLA_BEARER_MAX = __TIPC_NLA_BEARER_MAX - 1 89 TIPC_NLA_BEARER_MAX = __TIPC_NLA_BEARER_MAX - 1
89}; 90};
90 91
92enum {
93 TIPC_NLA_UDP_UNSPEC,
94 TIPC_NLA_UDP_LOCAL, /* sockaddr_storage */
95 TIPC_NLA_UDP_REMOTE, /* sockaddr_storage */
96
97 __TIPC_NLA_UDP_MAX,
98 TIPC_NLA_UDP_MAX = __TIPC_NLA_UDP_MAX - 1
99};
91/* Socket info */ 100/* Socket info */
92enum { 101enum {
93 TIPC_NLA_SOCK_UNSPEC, 102 TIPC_NLA_SOCK_UNSPEC,
diff --git a/include/uapi/linux/v4l2-dv-timings.h b/include/uapi/linux/v4l2-dv-timings.h
index 6c8f159e416e..c039f1d68a09 100644
--- a/include/uapi/linux/v4l2-dv-timings.h
+++ b/include/uapi/linux/v4l2-dv-timings.h
@@ -48,14 +48,15 @@
48 .type = V4L2_DV_BT_656_1120, \ 48 .type = V4L2_DV_BT_656_1120, \
49 V4L2_INIT_BT_TIMINGS(720, 480, 1, 0, \ 49 V4L2_INIT_BT_TIMINGS(720, 480, 1, 0, \
50 13500000, 19, 62, 57, 4, 3, 15, 4, 3, 16, \ 50 13500000, 19, 62, 57, 4, 3, 15, 4, 3, 16, \
51 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_HALF_LINE) \ 51 V4L2_DV_BT_STD_CEA861, \
52 V4L2_DV_FL_HALF_LINE | V4L2_DV_FL_IS_CE_VIDEO) \
52} 53}
53 54
54#define V4L2_DV_BT_CEA_720X480P59_94 { \ 55#define V4L2_DV_BT_CEA_720X480P59_94 { \
55 .type = V4L2_DV_BT_656_1120, \ 56 .type = V4L2_DV_BT_656_1120, \
56 V4L2_INIT_BT_TIMINGS(720, 480, 0, 0, \ 57 V4L2_INIT_BT_TIMINGS(720, 480, 0, 0, \
57 27000000, 16, 62, 60, 9, 6, 30, 0, 0, 0, \ 58 27000000, 16, 62, 60, 9, 6, 30, 0, 0, 0, \
58 V4L2_DV_BT_STD_CEA861, 0) \ 59 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_IS_CE_VIDEO) \
59} 60}
60 61
61/* Note: these are the nominal timings, for HDMI links this format is typically 62/* Note: these are the nominal timings, for HDMI links this format is typically
@@ -64,14 +65,15 @@
64 .type = V4L2_DV_BT_656_1120, \ 65 .type = V4L2_DV_BT_656_1120, \
65 V4L2_INIT_BT_TIMINGS(720, 576, 1, 0, \ 66 V4L2_INIT_BT_TIMINGS(720, 576, 1, 0, \
66 13500000, 12, 63, 69, 2, 3, 19, 2, 3, 20, \ 67 13500000, 12, 63, 69, 2, 3, 19, 2, 3, 20, \
67 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_HALF_LINE) \ 68 V4L2_DV_BT_STD_CEA861, \
69 V4L2_DV_FL_HALF_LINE | V4L2_DV_FL_IS_CE_VIDEO) \
68} 70}
69 71
70#define V4L2_DV_BT_CEA_720X576P50 { \ 72#define V4L2_DV_BT_CEA_720X576P50 { \
71 .type = V4L2_DV_BT_656_1120, \ 73 .type = V4L2_DV_BT_656_1120, \
72 V4L2_INIT_BT_TIMINGS(720, 576, 0, 0, \ 74 V4L2_INIT_BT_TIMINGS(720, 576, 0, 0, \
73 27000000, 12, 64, 68, 5, 5, 39, 0, 0, 0, \ 75 27000000, 12, 64, 68, 5, 5, 39, 0, 0, 0, \
74 V4L2_DV_BT_STD_CEA861, 0) \ 76 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_IS_CE_VIDEO) \
75} 77}
76 78
77#define V4L2_DV_BT_CEA_1280X720P24 { \ 79#define V4L2_DV_BT_CEA_1280X720P24 { \
@@ -88,7 +90,7 @@
88 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \ 90 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \
89 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 91 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
90 74250000, 2420, 40, 220, 5, 5, 20, 0, 0, 0, \ 92 74250000, 2420, 40, 220, 5, 5, 20, 0, 0, 0, \
91 V4L2_DV_BT_STD_CEA861, 0) \ 93 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_IS_CE_VIDEO) \
92} 94}
93 95
94#define V4L2_DV_BT_CEA_1280X720P30 { \ 96#define V4L2_DV_BT_CEA_1280X720P30 { \
@@ -96,7 +98,8 @@
96 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \ 98 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \
97 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 99 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
98 74250000, 1760, 40, 220, 5, 5, 20, 0, 0, 0, \ 100 74250000, 1760, 40, 220, 5, 5, 20, 0, 0, 0, \
99 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \ 101 V4L2_DV_BT_STD_CEA861, \
102 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
100} 103}
101 104
102#define V4L2_DV_BT_CEA_1280X720P50 { \ 105#define V4L2_DV_BT_CEA_1280X720P50 { \
@@ -104,7 +107,7 @@
104 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \ 107 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \
105 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 108 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
106 74250000, 440, 40, 220, 5, 5, 20, 0, 0, 0, \ 109 74250000, 440, 40, 220, 5, 5, 20, 0, 0, 0, \
107 V4L2_DV_BT_STD_CEA861, 0) \ 110 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_IS_CE_VIDEO) \
108} 111}
109 112
110#define V4L2_DV_BT_CEA_1280X720P60 { \ 113#define V4L2_DV_BT_CEA_1280X720P60 { \
@@ -112,7 +115,8 @@
112 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \ 115 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \
113 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 116 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
114 74250000, 110, 40, 220, 5, 5, 20, 0, 0, 0, \ 117 74250000, 110, 40, 220, 5, 5, 20, 0, 0, 0, \
115 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \ 118 V4L2_DV_BT_STD_CEA861, \
119 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
116} 120}
117 121
118#define V4L2_DV_BT_CEA_1920X1080P24 { \ 122#define V4L2_DV_BT_CEA_1920X1080P24 { \
@@ -120,7 +124,8 @@
120 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \ 124 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \
121 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 125 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
122 74250000, 638, 44, 148, 4, 5, 36, 0, 0, 0, \ 126 74250000, 638, 44, 148, 4, 5, 36, 0, 0, 0, \
123 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \ 127 V4L2_DV_BT_STD_CEA861, \
128 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
124} 129}
125 130
126#define V4L2_DV_BT_CEA_1920X1080P25 { \ 131#define V4L2_DV_BT_CEA_1920X1080P25 { \
@@ -128,7 +133,7 @@
128 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \ 133 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \
129 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 134 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
130 74250000, 528, 44, 148, 4, 5, 36, 0, 0, 0, \ 135 74250000, 528, 44, 148, 4, 5, 36, 0, 0, 0, \
131 V4L2_DV_BT_STD_CEA861, 0) \ 136 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_IS_CE_VIDEO) \
132} 137}
133 138
134#define V4L2_DV_BT_CEA_1920X1080P30 { \ 139#define V4L2_DV_BT_CEA_1920X1080P30 { \
@@ -136,7 +141,8 @@
136 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \ 141 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \
137 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 142 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
138 74250000, 88, 44, 148, 4, 5, 36, 0, 0, 0, \ 143 74250000, 88, 44, 148, 4, 5, 36, 0, 0, 0, \
139 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \ 144 V4L2_DV_BT_STD_CEA861, \
145 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
140} 146}
141 147
142#define V4L2_DV_BT_CEA_1920X1080I50 { \ 148#define V4L2_DV_BT_CEA_1920X1080I50 { \
@@ -144,7 +150,8 @@
144 V4L2_INIT_BT_TIMINGS(1920, 1080, 1, \ 150 V4L2_INIT_BT_TIMINGS(1920, 1080, 1, \
145 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 151 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
146 74250000, 528, 44, 148, 2, 5, 15, 2, 5, 16, \ 152 74250000, 528, 44, 148, 2, 5, 15, 2, 5, 16, \
147 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_HALF_LINE) \ 153 V4L2_DV_BT_STD_CEA861, \
154 V4L2_DV_FL_HALF_LINE | V4L2_DV_FL_IS_CE_VIDEO) \
148} 155}
149 156
150#define V4L2_DV_BT_CEA_1920X1080P50 { \ 157#define V4L2_DV_BT_CEA_1920X1080P50 { \
@@ -152,7 +159,7 @@
152 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \ 159 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \
153 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 160 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
154 148500000, 528, 44, 148, 4, 5, 36, 0, 0, 0, \ 161 148500000, 528, 44, 148, 4, 5, 36, 0, 0, 0, \
155 V4L2_DV_BT_STD_CEA861, 0) \ 162 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_IS_CE_VIDEO) \
156} 163}
157 164
158#define V4L2_DV_BT_CEA_1920X1080I60 { \ 165#define V4L2_DV_BT_CEA_1920X1080I60 { \
@@ -161,7 +168,8 @@
161 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 168 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
162 74250000, 88, 44, 148, 2, 5, 15, 2, 5, 16, \ 169 74250000, 88, 44, 148, 2, 5, 15, 2, 5, 16, \
163 V4L2_DV_BT_STD_CEA861, \ 170 V4L2_DV_BT_STD_CEA861, \
164 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_HALF_LINE) \ 171 V4L2_DV_FL_CAN_REDUCE_FPS | \
172 V4L2_DV_FL_HALF_LINE | V4L2_DV_FL_IS_CE_VIDEO) \
165} 173}
166 174
167#define V4L2_DV_BT_CEA_1920X1080P60 { \ 175#define V4L2_DV_BT_CEA_1920X1080P60 { \
@@ -170,77 +178,83 @@
170 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \ 178 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
171 148500000, 88, 44, 148, 4, 5, 36, 0, 0, 0, \ 179 148500000, 88, 44, 148, 4, 5, 36, 0, 0, 0, \
172 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, \ 180 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, \
173 V4L2_DV_FL_CAN_REDUCE_FPS) \ 181 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
174} 182}
175 183
176#define V4L2_DV_BT_CEA_3840X2160P24 { \ 184#define V4L2_DV_BT_CEA_3840X2160P24 { \
177 .type = V4L2_DV_BT_656_1120, \ 185 .type = V4L2_DV_BT_656_1120, \
178 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \ 186 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
179 297000000, 1276, 88, 296, 8, 10, 72, 0, 0, 0, \ 187 297000000, 1276, 88, 296, 8, 10, 72, 0, 0, 0, \
180 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \ 188 V4L2_DV_BT_STD_CEA861, \
189 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
181} 190}
182 191
183#define V4L2_DV_BT_CEA_3840X2160P25 { \ 192#define V4L2_DV_BT_CEA_3840X2160P25 { \
184 .type = V4L2_DV_BT_656_1120, \ 193 .type = V4L2_DV_BT_656_1120, \
185 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \ 194 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
186 297000000, 1056, 88, 296, 8, 10, 72, 0, 0, 0, \ 195 297000000, 1056, 88, 296, 8, 10, 72, 0, 0, 0, \
187 V4L2_DV_BT_STD_CEA861, 0) \ 196 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_IS_CE_VIDEO) \
188} 197}
189 198
190#define V4L2_DV_BT_CEA_3840X2160P30 { \ 199#define V4L2_DV_BT_CEA_3840X2160P30 { \
191 .type = V4L2_DV_BT_656_1120, \ 200 .type = V4L2_DV_BT_656_1120, \
192 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \ 201 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
193 297000000, 176, 88, 296, 8, 10, 72, 0, 0, 0, \ 202 297000000, 176, 88, 296, 8, 10, 72, 0, 0, 0, \
194 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \ 203 V4L2_DV_BT_STD_CEA861, \
204 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
195} 205}
196 206
197#define V4L2_DV_BT_CEA_3840X2160P50 { \ 207#define V4L2_DV_BT_CEA_3840X2160P50 { \
198 .type = V4L2_DV_BT_656_1120, \ 208 .type = V4L2_DV_BT_656_1120, \
199 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \ 209 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
200 594000000, 1056, 88, 296, 8, 10, 72, 0, 0, 0, \ 210 594000000, 1056, 88, 296, 8, 10, 72, 0, 0, 0, \
201 V4L2_DV_BT_STD_CEA861, 0) \ 211 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_IS_CE_VIDEO) \
202} 212}
203 213
204#define V4L2_DV_BT_CEA_3840X2160P60 { \ 214#define V4L2_DV_BT_CEA_3840X2160P60 { \
205 .type = V4L2_DV_BT_656_1120, \ 215 .type = V4L2_DV_BT_656_1120, \
206 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \ 216 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
207 594000000, 176, 88, 296, 8, 10, 72, 0, 0, 0, \ 217 594000000, 176, 88, 296, 8, 10, 72, 0, 0, 0, \
208 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \ 218 V4L2_DV_BT_STD_CEA861, \
219 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
209} 220}
210 221
211#define V4L2_DV_BT_CEA_4096X2160P24 { \ 222#define V4L2_DV_BT_CEA_4096X2160P24 { \
212 .type = V4L2_DV_BT_656_1120, \ 223 .type = V4L2_DV_BT_656_1120, \
213 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \ 224 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
214 297000000, 1020, 88, 296, 8, 10, 72, 0, 0, 0, \ 225 297000000, 1020, 88, 296, 8, 10, 72, 0, 0, 0, \
215 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \ 226 V4L2_DV_BT_STD_CEA861, \
227 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
216} 228}
217 229
218#define V4L2_DV_BT_CEA_4096X2160P25 { \ 230#define V4L2_DV_BT_CEA_4096X2160P25 { \
219 .type = V4L2_DV_BT_656_1120, \ 231 .type = V4L2_DV_BT_656_1120, \
220 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \ 232 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
221 297000000, 968, 88, 128, 8, 10, 72, 0, 0, 0, \ 233 297000000, 968, 88, 128, 8, 10, 72, 0, 0, 0, \
222 V4L2_DV_BT_STD_CEA861, 0) \ 234 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_IS_CE_VIDEO) \
223} 235}
224 236
225#define V4L2_DV_BT_CEA_4096X2160P30 { \ 237#define V4L2_DV_BT_CEA_4096X2160P30 { \
226 .type = V4L2_DV_BT_656_1120, \ 238 .type = V4L2_DV_BT_656_1120, \
227 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \ 239 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
228 297000000, 88, 88, 128, 8, 10, 72, 0, 0, 0, \ 240 297000000, 88, 88, 128, 8, 10, 72, 0, 0, 0, \
229 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \ 241 V4L2_DV_BT_STD_CEA861, \
242 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
230} 243}
231 244
232#define V4L2_DV_BT_CEA_4096X2160P50 { \ 245#define V4L2_DV_BT_CEA_4096X2160P50 { \
233 .type = V4L2_DV_BT_656_1120, \ 246 .type = V4L2_DV_BT_656_1120, \
234 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \ 247 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
235 594000000, 968, 88, 128, 8, 10, 72, 0, 0, 0, \ 248 594000000, 968, 88, 128, 8, 10, 72, 0, 0, 0, \
236 V4L2_DV_BT_STD_CEA861, 0) \ 249 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_IS_CE_VIDEO) \
237} 250}
238 251
239#define V4L2_DV_BT_CEA_4096X2160P60 { \ 252#define V4L2_DV_BT_CEA_4096X2160P60 { \
240 .type = V4L2_DV_BT_656_1120, \ 253 .type = V4L2_DV_BT_656_1120, \
241 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \ 254 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
242 594000000, 88, 88, 128, 8, 10, 72, 0, 0, 0, \ 255 594000000, 88, 88, 128, 8, 10, 72, 0, 0, 0, \
243 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \ 256 V4L2_DV_BT_STD_CEA861, \
257 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
244} 258}
245 259
246 260
diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h
index e0a7e3da498a..dbce2b554e02 100644
--- a/include/uapi/linux/v4l2-subdev.h
+++ b/include/uapi/linux/v4l2-subdev.h
@@ -69,12 +69,14 @@ struct v4l2_subdev_crop {
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 (MEDIA_BUS_FMT_ definitions) 71 * @code: format code (MEDIA_BUS_FMT_ definitions)
72 * @which: format type (from enum v4l2_subdev_format_whence)
72 */ 73 */
73struct v4l2_subdev_mbus_code_enum { 74struct v4l2_subdev_mbus_code_enum {
74 __u32 pad; 75 __u32 pad;
75 __u32 index; 76 __u32 index;
76 __u32 code; 77 __u32 code;
77 __u32 reserved[9]; 78 __u32 which;
79 __u32 reserved[8];
78}; 80};
79 81
80/** 82/**
@@ -82,6 +84,7 @@ struct v4l2_subdev_mbus_code_enum {
82 * @pad: pad number, as reported by the media API 84 * @pad: pad number, as reported by the media API
83 * @index: format index during enumeration 85 * @index: format index during enumeration
84 * @code: format code (MEDIA_BUS_FMT_ definitions) 86 * @code: format code (MEDIA_BUS_FMT_ definitions)
87 * @which: format type (from enum v4l2_subdev_format_whence)
85 */ 88 */
86struct v4l2_subdev_frame_size_enum { 89struct v4l2_subdev_frame_size_enum {
87 __u32 index; 90 __u32 index;
@@ -91,7 +94,8 @@ struct v4l2_subdev_frame_size_enum {
91 __u32 max_width; 94 __u32 max_width;
92 __u32 min_height; 95 __u32 min_height;
93 __u32 max_height; 96 __u32 max_height;
94 __u32 reserved[9]; 97 __u32 which;
98 __u32 reserved[8];
95}; 99};
96 100
97/** 101/**
@@ -113,6 +117,7 @@ struct v4l2_subdev_frame_interval {
113 * @width: frame width in pixels 117 * @width: frame width in pixels
114 * @height: frame height in pixels 118 * @height: frame height in pixels
115 * @interval: frame interval in seconds 119 * @interval: frame interval in seconds
120 * @which: format type (from enum v4l2_subdev_format_whence)
116 */ 121 */
117struct v4l2_subdev_frame_interval_enum { 122struct v4l2_subdev_frame_interval_enum {
118 __u32 index; 123 __u32 index;
@@ -121,7 +126,8 @@ struct v4l2_subdev_frame_interval_enum {
121 __u32 width; 126 __u32 width;
122 __u32 height; 127 __u32 height;
123 struct v4l2_fract interval; 128 struct v4l2_fract interval;
124 __u32 reserved[9]; 129 __u32 which;
130 __u32 reserved[8];
125}; 131};
126 132
127/** 133/**
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index 82889c30f4f5..b57b750c222f 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -160,6 +160,8 @@ struct vfio_device_info {
160 __u32 flags; 160 __u32 flags;
161#define VFIO_DEVICE_FLAGS_RESET (1 << 0) /* Device supports reset */ 161#define VFIO_DEVICE_FLAGS_RESET (1 << 0) /* Device supports reset */
162#define VFIO_DEVICE_FLAGS_PCI (1 << 1) /* vfio-pci device */ 162#define VFIO_DEVICE_FLAGS_PCI (1 << 1) /* vfio-pci device */
163#define VFIO_DEVICE_FLAGS_PLATFORM (1 << 2) /* vfio-platform device */
164#define VFIO_DEVICE_FLAGS_AMBA (1 << 3) /* vfio-amba device */
163 __u32 num_regions; /* Max region index + 1 */ 165 __u32 num_regions; /* Max region index + 1 */
164 __u32 num_irqs; /* Max IRQ index + 1 */ 166 __u32 num_irqs; /* Max IRQ index + 1 */
165}; 167};
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index fbdc3602ee27..fa376f7666ba 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -268,9 +268,10 @@ enum v4l2_ycbcr_encoding {
268 268
269enum v4l2_quantization { 269enum v4l2_quantization {
270 /* 270 /*
271 * The default for R'G'B' quantization is always full range. For 271 * The default for R'G'B' quantization is always full range, except
272 * Y'CbCr the quantization is always limited range, except for 272 * for the BT2020 colorspace. For Y'CbCr the quantization is always
273 * SYCC, XV601, XV709 or JPEG: those are full range. 273 * limited range, except for COLORSPACE_JPEG, SYCC, XV601 or XV709:
274 * those are full range.
274 */ 275 */
275 V4L2_QUANTIZATION_DEFAULT = 0, 276 V4L2_QUANTIZATION_DEFAULT = 0,
276 V4L2_QUANTIZATION_FULL_RANGE = 1, 277 V4L2_QUANTIZATION_FULL_RANGE = 1,
@@ -1187,6 +1188,12 @@ struct v4l2_bt_timings {
1187 exactly the same number of half-lines. Whether half-lines can be detected 1188 exactly the same number of half-lines. Whether half-lines can be detected
1188 or used depends on the hardware. */ 1189 or used depends on the hardware. */
1189#define V4L2_DV_FL_HALF_LINE (1 << 3) 1190#define V4L2_DV_FL_HALF_LINE (1 << 3)
1191/* If set, then this is a Consumer Electronics (CE) video format. Such formats
1192 * differ from other formats (commonly called IT formats) in that if RGB
1193 * encoding is used then by default the RGB values use limited range (i.e.
1194 * use the range 16-235) as opposed to 0-255. All formats defined in CEA-861
1195 * except for the 640x480 format are CE formats. */
1196#define V4L2_DV_FL_IS_CE_VIDEO (1 << 4)
1190 1197
1191/* A few useful defines to calculate the total blanking and frame sizes */ 1198/* A few useful defines to calculate the total blanking and frame sizes */
1192#define V4L2_DV_BT_BLANKING_WIDTH(bt) \ 1199#define V4L2_DV_BT_BLANKING_WIDTH(bt) \
@@ -1456,6 +1463,7 @@ struct v4l2_querymenu {
1456#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040 1463#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040
1457#define V4L2_CTRL_FLAG_VOLATILE 0x0080 1464#define V4L2_CTRL_FLAG_VOLATILE 0x0080
1458#define V4L2_CTRL_FLAG_HAS_PAYLOAD 0x0100 1465#define V4L2_CTRL_FLAG_HAS_PAYLOAD 0x0100
1466#define V4L2_CTRL_FLAG_EXECUTE_ON_WRITE 0x0200
1459 1467
1460/* Query flags, to be ORed with the control ID */ 1468/* Query flags, to be ORed with the control ID */
1461#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 1469#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
@@ -1841,8 +1849,8 @@ struct v4l2_mpeg_vbi_fmt_ivtv {
1841 */ 1849 */
1842struct v4l2_plane_pix_format { 1850struct v4l2_plane_pix_format {
1843 __u32 sizeimage; 1851 __u32 sizeimage;
1844 __u16 bytesperline; 1852 __u32 bytesperline;
1845 __u16 reserved[7]; 1853 __u16 reserved[6];
1846} __attribute__ ((packed)); 1854} __attribute__ ((packed));
1847 1855
1848/** 1856/**
diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h
index 4b0488f20b2e..984169a819ee 100644
--- a/include/uapi/linux/virtio_balloon.h
+++ b/include/uapi/linux/virtio_balloon.h
@@ -25,6 +25,7 @@
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. */ 27 * SUCH DAMAGE. */
28#include <linux/types.h>
28#include <linux/virtio_ids.h> 29#include <linux/virtio_ids.h>
29#include <linux/virtio_config.h> 30#include <linux/virtio_config.h>
30 31
@@ -38,9 +39,9 @@
38 39
39struct virtio_balloon_config { 40struct virtio_balloon_config {
40 /* Number of pages host wants Guest to give up. */ 41 /* Number of pages host wants Guest to give up. */
41 __le32 num_pages; 42 __u32 num_pages;
42 /* Number of pages we've actually got in balloon. */ 43 /* Number of pages we've actually got in balloon. */
43 __le32 actual; 44 __u32 actual;
44}; 45};
45 46
46#define VIRTIO_BALLOON_S_SWAP_IN 0 /* Amount of memory swapped in */ 47#define VIRTIO_BALLOON_S_SWAP_IN 0 /* Amount of memory swapped in */
@@ -51,9 +52,32 @@ struct virtio_balloon_config {
51#define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */ 52#define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */
52#define VIRTIO_BALLOON_S_NR 6 53#define VIRTIO_BALLOON_S_NR 6
53 54
55/*
56 * Memory statistics structure.
57 * Driver fills an array of these structures and passes to device.
58 *
59 * NOTE: fields are laid out in a way that would make compiler add padding
60 * between and after fields, so we have to use compiler-specific attributes to
61 * pack it, to disable this padding. This also often causes compiler to
62 * generate suboptimal code.
63 *
64 * We maintain this statistics structure format for backwards compatibility,
65 * but don't follow this example.
66 *
67 * If implementing a similar structure, do something like the below instead:
68 * struct virtio_balloon_stat {
69 * __virtio16 tag;
70 * __u8 reserved[6];
71 * __virtio64 val;
72 * };
73 *
74 * In other words, add explicit reserved fields to align field and
75 * structure boundaries at field size, avoiding compiler padding
76 * without the packed attribute.
77 */
54struct virtio_balloon_stat { 78struct virtio_balloon_stat {
55 __u16 tag; 79 __virtio16 tag;
56 __u64 val; 80 __virtio64 val;
57} __attribute__((packed)); 81} __attribute__((packed));
58 82
59#endif /* _LINUX_VIRTIO_BALLOON_H */ 83#endif /* _LINUX_VIRTIO_BALLOON_H */
diff --git a/include/uapi/linux/virtio_blk.h b/include/uapi/linux/virtio_blk.h
index 3c53eec4ae22..19c66fcbab8a 100644
--- a/include/uapi/linux/virtio_blk.h
+++ b/include/uapi/linux/virtio_blk.h
@@ -60,7 +60,7 @@ struct virtio_blk_config {
60 __u32 size_max; 60 __u32 size_max;
61 /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ 61 /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */
62 __u32 seg_max; 62 __u32 seg_max;
63 /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */ 63 /* geometry of the device (if VIRTIO_BLK_F_GEOMETRY) */
64 struct virtio_blk_geometry { 64 struct virtio_blk_geometry {
65 __u16 cylinders; 65 __u16 cylinders;
66 __u8 heads; 66 __u8 heads;
@@ -119,7 +119,11 @@ struct virtio_blk_config {
119#define VIRTIO_BLK_T_BARRIER 0x80000000 119#define VIRTIO_BLK_T_BARRIER 0x80000000
120#endif /* !VIRTIO_BLK_NO_LEGACY */ 120#endif /* !VIRTIO_BLK_NO_LEGACY */
121 121
122/* This is the first element of the read scatter-gather list. */ 122/*
123 * This comes first in the read scatter-gather list.
124 * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated,
125 * this is the first element of the read scatter-gather list.
126 */
123struct virtio_blk_outhdr { 127struct virtio_blk_outhdr {
124 /* VIRTIO_BLK_T* */ 128 /* VIRTIO_BLK_T* */
125 __virtio32 type; 129 __virtio32 type;
diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h
index 284fc3a05f7b..5f60aa4be50a 100644
--- a/include/uapi/linux/virtio_ids.h
+++ b/include/uapi/linux/virtio_ids.h
@@ -39,5 +39,6 @@
39#define VIRTIO_ID_9P 9 /* 9p virtio console */ 39#define VIRTIO_ID_9P 9 /* 9p virtio console */
40#define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */ 40#define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */
41#define VIRTIO_ID_CAIF 12 /* Virtio caif */ 41#define VIRTIO_ID_CAIF 12 /* Virtio caif */
42#define VIRTIO_ID_INPUT 18 /* virtio input */
42 43
43#endif /* _LINUX_VIRTIO_IDS_H */ 44#endif /* _LINUX_VIRTIO_IDS_H */
diff --git a/include/uapi/linux/virtio_input.h b/include/uapi/linux/virtio_input.h
new file mode 100644
index 000000000000..a7fe5c8fb135
--- /dev/null
+++ b/include/uapi/linux/virtio_input.h
@@ -0,0 +1,76 @@
1#ifndef _LINUX_VIRTIO_INPUT_H
2#define _LINUX_VIRTIO_INPUT_H
3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of IBM nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE. */
29
30#include <linux/types.h>
31
32enum virtio_input_config_select {
33 VIRTIO_INPUT_CFG_UNSET = 0x00,
34 VIRTIO_INPUT_CFG_ID_NAME = 0x01,
35 VIRTIO_INPUT_CFG_ID_SERIAL = 0x02,
36 VIRTIO_INPUT_CFG_ID_DEVIDS = 0x03,
37 VIRTIO_INPUT_CFG_PROP_BITS = 0x10,
38 VIRTIO_INPUT_CFG_EV_BITS = 0x11,
39 VIRTIO_INPUT_CFG_ABS_INFO = 0x12,
40};
41
42struct virtio_input_absinfo {
43 __u32 min;
44 __u32 max;
45 __u32 fuzz;
46 __u32 flat;
47 __u32 res;
48};
49
50struct virtio_input_devids {
51 __u16 bustype;
52 __u16 vendor;
53 __u16 product;
54 __u16 version;
55};
56
57struct virtio_input_config {
58 __u8 select;
59 __u8 subsel;
60 __u8 size;
61 __u8 reserved[5];
62 union {
63 char string[128];
64 __u8 bitmap[128];
65 struct virtio_input_absinfo abs;
66 struct virtio_input_devids ids;
67 } u;
68};
69
70struct virtio_input_event {
71 __le16 type;
72 __le16 code;
73 __le32 value;
74};
75
76#endif /* _LINUX_VIRTIO_INPUT_H */
diff --git a/include/uapi/linux/virtio_scsi.h b/include/uapi/linux/virtio_scsi.h
index 42b9370771b0..cc18ef8825c0 100644
--- a/include/uapi/linux/virtio_scsi.h
+++ b/include/uapi/linux/virtio_scsi.h
@@ -29,8 +29,16 @@
29 29
30#include <linux/virtio_types.h> 30#include <linux/virtio_types.h>
31 31
32#define VIRTIO_SCSI_CDB_SIZE 32 32/* Default values of the CDB and sense data size configuration fields */
33#define VIRTIO_SCSI_SENSE_SIZE 96 33#define VIRTIO_SCSI_CDB_DEFAULT_SIZE 32
34#define VIRTIO_SCSI_SENSE_DEFAULT_SIZE 96
35
36#ifndef VIRTIO_SCSI_CDB_SIZE
37#define VIRTIO_SCSI_CDB_SIZE VIRTIO_SCSI_CDB_DEFAULT_SIZE
38#endif
39#ifndef VIRTIO_SCSI_SENSE_SIZE
40#define VIRTIO_SCSI_SENSE_SIZE VIRTIO_SCSI_SENSE_DEFAULT_SIZE
41#endif
34 42
35/* SCSI command request, followed by data-out */ 43/* SCSI command request, followed by data-out */
36struct virtio_scsi_cmd_req { 44struct virtio_scsi_cmd_req {
diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h
index 02d5125a5ee8..2cd9e608d0d1 100644
--- a/include/uapi/linux/xfrm.h
+++ b/include/uapi/linux/xfrm.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_XFRM_H 1#ifndef _LINUX_XFRM_H
2#define _LINUX_XFRM_H 2#define _LINUX_XFRM_H
3 3
4#include <linux/in6.h>
4#include <linux/types.h> 5#include <linux/types.h>
5 6
6/* All of the structures in this file may not change size as they are 7/* All of the structures in this file may not change size as they are
@@ -13,6 +14,7 @@
13typedef union { 14typedef union {
14 __be32 a4; 15 __be32 a4;
15 __be32 a6[4]; 16 __be32 a6[4];
17 struct in6_addr in6;
16} xfrm_address_t; 18} xfrm_address_t;
17 19
18/* Ident of a specific xfrm_state. It is used on input to lookup 20/* Ident of a specific xfrm_state. It is used on input to lookup
diff --git a/include/uapi/linux/xilinx-v4l2-controls.h b/include/uapi/linux/xilinx-v4l2-controls.h
new file mode 100644
index 000000000000..fb495b91e800
--- /dev/null
+++ b/include/uapi/linux/xilinx-v4l2-controls.h
@@ -0,0 +1,73 @@
1/*
2 * Xilinx Controls Header
3 *
4 * Copyright (C) 2013-2015 Ideas on Board
5 * Copyright (C) 2013-2015 Xilinx, Inc.
6 *
7 * Contacts: Hyun Kwon <hyun.kwon@xilinx.com>
8 * Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 *
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 */
19
20#ifndef __UAPI_XILINX_V4L2_CONTROLS_H__
21#define __UAPI_XILINX_V4L2_CONTROLS_H__
22
23#include <linux/v4l2-controls.h>
24
25#define V4L2_CID_XILINX_OFFSET 0xc000
26#define V4L2_CID_XILINX_BASE (V4L2_CID_USER_BASE + V4L2_CID_XILINX_OFFSET)
27
28/*
29 * Private Controls for Xilinx Video IPs
30 */
31
32/*
33 * Xilinx TPG Video IP
34 */
35
36#define V4L2_CID_XILINX_TPG (V4L2_CID_USER_BASE + 0xc000)
37
38/* Draw cross hairs */
39#define V4L2_CID_XILINX_TPG_CROSS_HAIRS (V4L2_CID_XILINX_TPG + 1)
40/* Enable a moving box */
41#define V4L2_CID_XILINX_TPG_MOVING_BOX (V4L2_CID_XILINX_TPG + 2)
42/* Mask out a color component */
43#define V4L2_CID_XILINX_TPG_COLOR_MASK (V4L2_CID_XILINX_TPG + 3)
44/* Enable a stuck pixel feature */
45#define V4L2_CID_XILINX_TPG_STUCK_PIXEL (V4L2_CID_XILINX_TPG + 4)
46/* Enable a noisy output */
47#define V4L2_CID_XILINX_TPG_NOISE (V4L2_CID_XILINX_TPG + 5)
48/* Enable the motion feature */
49#define V4L2_CID_XILINX_TPG_MOTION (V4L2_CID_XILINX_TPG + 6)
50/* Configure the motion speed of moving patterns */
51#define V4L2_CID_XILINX_TPG_MOTION_SPEED (V4L2_CID_XILINX_TPG + 7)
52/* The row of horizontal cross hair location */
53#define V4L2_CID_XILINX_TPG_CROSS_HAIR_ROW (V4L2_CID_XILINX_TPG + 8)
54/* The colum of vertical cross hair location */
55#define V4L2_CID_XILINX_TPG_CROSS_HAIR_COLUMN (V4L2_CID_XILINX_TPG + 9)
56/* Set starting point of sine wave for horizontal component */
57#define V4L2_CID_XILINX_TPG_ZPLATE_HOR_START (V4L2_CID_XILINX_TPG + 10)
58/* Set speed of the horizontal component */
59#define V4L2_CID_XILINX_TPG_ZPLATE_HOR_SPEED (V4L2_CID_XILINX_TPG + 11)
60/* Set starting point of sine wave for vertical component */
61#define V4L2_CID_XILINX_TPG_ZPLATE_VER_START (V4L2_CID_XILINX_TPG + 12)
62/* Set speed of the vertical component */
63#define V4L2_CID_XILINX_TPG_ZPLATE_VER_SPEED (V4L2_CID_XILINX_TPG + 13)
64/* Moving box size */
65#define V4L2_CID_XILINX_TPG_BOX_SIZE (V4L2_CID_XILINX_TPG + 14)
66/* Moving box color */
67#define V4L2_CID_XILINX_TPG_BOX_COLOR (V4L2_CID_XILINX_TPG + 15)
68/* Upper limit count of generated stuck pixels */
69#define V4L2_CID_XILINX_TPG_STUCK_PIXEL_THRESH (V4L2_CID_XILINX_TPG + 16)
70/* Noise level */
71#define V4L2_CID_XILINX_TPG_NOISE_GAIN (V4L2_CID_XILINX_TPG + 17)
72
73#endif /* __UAPI_XILINX_V4L2_CONTROLS_H__ */
diff --git a/include/uapi/sound/asequencer.h b/include/uapi/sound/asequencer.h
index 09c8a00ea503..5a5fa4956ebd 100644
--- a/include/uapi/sound/asequencer.h
+++ b/include/uapi/sound/asequencer.h
@@ -22,6 +22,7 @@
22#ifndef _UAPI__SOUND_ASEQUENCER_H 22#ifndef _UAPI__SOUND_ASEQUENCER_H
23#define _UAPI__SOUND_ASEQUENCER_H 23#define _UAPI__SOUND_ASEQUENCER_H
24 24
25#include <sound/asound.h>
25 26
26/** version of the sequencer */ 27/** version of the sequencer */
27#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1) 28#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index 0e88e7a0f0eb..a45be6bdcf5b 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -25,6 +25,9 @@
25 25
26#include <linux/types.h> 26#include <linux/types.h>
27 27
28#ifndef __KERNEL__
29#include <stdlib.h>
30#endif
28 31
29/* 32/*
30 * protocol version 33 * protocol version
@@ -140,7 +143,7 @@ struct snd_hwdep_dsp_image {
140 * * 143 * *
141 *****************************************************************************/ 144 *****************************************************************************/
142 145
143#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 12) 146#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 13)
144 147
145typedef unsigned long snd_pcm_uframes_t; 148typedef unsigned long snd_pcm_uframes_t;
146typedef signed long snd_pcm_sframes_t; 149typedef signed long snd_pcm_sframes_t;
@@ -267,10 +270,17 @@ typedef int __bitwise snd_pcm_subformat_t;
267#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ 270#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
268#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ 271#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
269#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */ 272#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */
270#define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* has audio wall clock for audio/system time sync */ 273#define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* (Deprecated)has audio wall clock for audio/system time sync */
274#define SNDRV_PCM_INFO_HAS_LINK_ATIME 0x01000000 /* report hardware link audio time, reset on startup */
275#define SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME 0x02000000 /* report absolute hardware link audio time, not reset on startup */
276#define SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME 0x04000000 /* report estimated link audio time */
277#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000 /* report synchronized audio/system time */
278
271#define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */ 279#define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */
272#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */ 280#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
273 281
282
283
274typedef int __bitwise snd_pcm_state_t; 284typedef int __bitwise snd_pcm_state_t;
275#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */ 285#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
276#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */ 286#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */
@@ -408,6 +418,22 @@ struct snd_pcm_channel_info {
408 unsigned int step; /* samples distance in bits */ 418 unsigned int step; /* samples distance in bits */
409}; 419};
410 420
421enum {
422 /*
423 * first definition for backwards compatibility only,
424 * maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else
425 */
426 SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0,
427
428 /* timestamp definitions */
429 SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1, /* DMA time, reported as per hw_ptr */
430 SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK = 2, /* link time reported by sample or wallclock counter, reset on startup */
431 SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /* link time reported by sample or wallclock counter, not reset on startup */
432 SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /* link time estimated indirectly */
433 SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /* link time synchronized with system time */
434 SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
435};
436
411struct snd_pcm_status { 437struct snd_pcm_status {
412 snd_pcm_state_t state; /* stream state */ 438 snd_pcm_state_t state; /* stream state */
413 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ 439 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
@@ -419,9 +445,11 @@ struct snd_pcm_status {
419 snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ 445 snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */
420 snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ 446 snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
421 snd_pcm_state_t suspended_state; /* suspended stream state */ 447 snd_pcm_state_t suspended_state; /* suspended stream state */
422 __u32 reserved_alignment; /* must be filled with zero */ 448 __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */
423 struct timespec audio_tstamp; /* from sample counter or wall clock */ 449 struct timespec audio_tstamp; /* sample counter, wall clock, PHC or on-demand sync'ed */
424 unsigned char reserved[56-sizeof(struct timespec)]; /* must be filled with zero */ 450 struct timespec driver_tstamp; /* useful in case reference system tstamp is reported with delay */
451 __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */
452 unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */
425}; 453};
426 454
427struct snd_pcm_mmap_status { 455struct snd_pcm_mmap_status {
@@ -534,6 +562,7 @@ enum {
534#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t) 562#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
535#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22) 563#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
536#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr) 564#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
565#define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status)
537#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info) 566#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
538#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40) 567#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40)
539#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41) 568#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41)
@@ -835,7 +864,7 @@ struct snd_ctl_elem_id {
835 snd_ctl_elem_iface_t iface; /* interface identifier */ 864 snd_ctl_elem_iface_t iface; /* interface identifier */
836 unsigned int device; /* device/client number */ 865 unsigned int device; /* device/client number */
837 unsigned int subdevice; /* subdevice (substream) number */ 866 unsigned int subdevice; /* subdevice (substream) number */
838 unsigned char name[44]; /* ASCII name of item */ 867 unsigned char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* ASCII name of item */
839 unsigned int index; /* index of item */ 868 unsigned int index; /* index of item */
840}; 869};
841 870
diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h
index 22ed8cb7800b..e00d8cbfc628 100644
--- a/include/uapi/sound/compress_offload.h
+++ b/include/uapi/sound/compress_offload.h
@@ -75,7 +75,7 @@ struct snd_compr_tstamp {
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 information
79 */ 79 */
80struct snd_compr_avail { 80struct snd_compr_avail {
81 __u64 avail; 81 __u64 avail;
diff --git a/include/uapi/sound/emu10k1.h b/include/uapi/sound/emu10k1.h
index d1bbaf78457a..ec1535bb6aed 100644
--- a/include/uapi/sound/emu10k1.h
+++ b/include/uapi/sound/emu10k1.h
@@ -23,8 +23,7 @@
23#define _UAPI__SOUND_EMU10K1_H 23#define _UAPI__SOUND_EMU10K1_H
24 24
25#include <linux/types.h> 25#include <linux/types.h>
26 26#include <sound/asound.h>
27
28 27
29/* 28/*
30 * ---- FX8010 ---- 29 * ---- FX8010 ----
diff --git a/include/uapi/sound/hdspm.h b/include/uapi/sound/hdspm.h
index b357f1a5e29c..5737332d38f2 100644
--- a/include/uapi/sound/hdspm.h
+++ b/include/uapi/sound/hdspm.h
@@ -20,6 +20,12 @@
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */ 21 */
22 22
23#ifdef __KERNEL__
24#include <linux/types.h>
25#else
26#include <stdint.h>
27#endif
28
23/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ 29/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
24#define HDSPM_MAX_CHANNELS 64 30#define HDSPM_MAX_CHANNELS 64
25 31
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
index 73390c120cad..85dedca3dcfb 100644
--- a/include/video/imx-ipu-v3.h
+++ b/include/video/imx-ipu-v3.h
@@ -39,7 +39,7 @@ struct ipu_di_signal_cfg {
39 39
40 struct videomode mode; 40 struct videomode mode;
41 41
42 u32 pixel_fmt; 42 u32 bus_format;
43 u32 v_to_h_sync; 43 u32 v_to_h_sync;
44 44
45#define IPU_DI_CLKMODE_SYNC (1 << 0) 45#define IPU_DI_CLKMODE_SYNC (1 << 0)
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 60de61fea8e3..f001a356fd98 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -129,14 +129,13 @@ enum omap_rfbi_te_mode {
129}; 129};
130 130
131enum omap_dss_signal_level { 131enum omap_dss_signal_level {
132 OMAPDSS_SIG_ACTIVE_HIGH = 0, 132 OMAPDSS_SIG_ACTIVE_LOW,
133 OMAPDSS_SIG_ACTIVE_LOW = 1, 133 OMAPDSS_SIG_ACTIVE_HIGH,
134}; 134};
135 135
136enum omap_dss_signal_edge { 136enum omap_dss_signal_edge {
137 OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
138 OMAPDSS_DRIVE_SIG_RISING_EDGE,
139 OMAPDSS_DRIVE_SIG_FALLING_EDGE, 137 OMAPDSS_DRIVE_SIG_FALLING_EDGE,
138 OMAPDSS_DRIVE_SIG_RISING_EDGE,
140}; 139};
141 140
142enum omap_dss_venc_type { 141enum omap_dss_venc_type {
@@ -689,6 +688,7 @@ struct omapdss_dsi_ops {
689}; 688};
690 689
691struct omap_dss_device { 690struct omap_dss_device {
691 struct kobject kobj;
692 struct device *dev; 692 struct device *dev;
693 693
694 struct module *owner; 694 struct module *owner;
diff --git a/include/video/samsung_fimd.h b/include/video/samsung_fimd.h
index a20e4a3a8b15..0530e5a4c6b1 100644
--- a/include/video/samsung_fimd.h
+++ b/include/video/samsung_fimd.h
@@ -289,6 +289,11 @@
289#define VIDISD14C_ALPHA1_B_LIMIT 0xf 289#define VIDISD14C_ALPHA1_B_LIMIT 0xf
290#define VIDISD14C_ALPHA1_B(_x) ((_x) << 0) 290#define VIDISD14C_ALPHA1_B(_x) ((_x) << 0)
291 291
292#define VIDW_ALPHA 0x021c
293#define VIDW_ALPHA_R(_x) ((_x) << 16)
294#define VIDW_ALPHA_G(_x) ((_x) << 8)
295#define VIDW_ALPHA_B(_x) ((_x) << 0)
296
292/* Video buffer addresses */ 297/* Video buffer addresses */
293#define VIDW_BUF_START(_buff) (0xA0 + ((_buff) * 8)) 298#define VIDW_BUF_START(_buff) (0xA0 + ((_buff) * 8))
294#define VIDW_BUF_START1(_buff) (0xA4 + ((_buff) * 8)) 299#define VIDW_BUF_START1(_buff) (0xA4 + ((_buff) * 8))
@@ -436,6 +441,12 @@
436#define BLENDCON_NEW_8BIT_ALPHA_VALUE (1 << 0) 441#define BLENDCON_NEW_8BIT_ALPHA_VALUE (1 << 0)
437#define BLENDCON_NEW_4BIT_ALPHA_VALUE (0 << 0) 442#define BLENDCON_NEW_4BIT_ALPHA_VALUE (0 << 0)
438 443
444/* Display port clock control */
445#define DP_MIE_CLKCON 0x27c
446#define DP_MIE_CLK_DISABLE 0x0
447#define DP_MIE_CLK_DP_ENABLE 0x2
448#define DP_MIE_CLK_MIE_ENABLE 0x3
449
439/* Notes on per-window bpp settings 450/* Notes on per-window bpp settings
440 * 451 *
441 * Value Win0 Win1 Win2 Win3 Win 4 452 * Value Win0 Win1 Win2 Win3 Win 4
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index f68719f405af..a48378958062 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -67,7 +67,7 @@
67#define __HYPERVISOR_vcpu_op 24 67#define __HYPERVISOR_vcpu_op 24
68#define __HYPERVISOR_set_segment_base 25 /* x86/64 only */ 68#define __HYPERVISOR_set_segment_base 25 /* x86/64 only */
69#define __HYPERVISOR_mmuext_op 26 69#define __HYPERVISOR_mmuext_op 26
70#define __HYPERVISOR_acm_op 27 70#define __HYPERVISOR_xsm_op 27
71#define __HYPERVISOR_nmi_op 28 71#define __HYPERVISOR_nmi_op 28
72#define __HYPERVISOR_sched_op 29 72#define __HYPERVISOR_sched_op 29
73#define __HYPERVISOR_callback_op 30 73#define __HYPERVISOR_callback_op 30
@@ -75,7 +75,11 @@
75#define __HYPERVISOR_event_channel_op 32 75#define __HYPERVISOR_event_channel_op 32
76#define __HYPERVISOR_physdev_op 33 76#define __HYPERVISOR_physdev_op 33
77#define __HYPERVISOR_hvm_op 34 77#define __HYPERVISOR_hvm_op 34
78#define __HYPERVISOR_sysctl 35
79#define __HYPERVISOR_domctl 36
80#define __HYPERVISOR_kexec_op 37
78#define __HYPERVISOR_tmem_op 38 81#define __HYPERVISOR_tmem_op 38
82#define __HYPERVISOR_xc_reserved_op 39 /* reserved for XenClient */
79 83
80/* Architecture-specific hypercall definitions. */ 84/* Architecture-specific hypercall definitions. */
81#define __HYPERVISOR_arch_0 48 85#define __HYPERVISOR_arch_0 48
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index 7491ee5d8164..c643e6a94c9a 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -27,13 +27,58 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
27void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order); 27void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order);
28 28
29struct vm_area_struct; 29struct vm_area_struct;
30
31/*
32 * xen_remap_domain_mfn_array() - map an array of foreign frames
33 * @vma: VMA to map the pages into
34 * @addr: Address at which to map the pages
35 * @gfn: Array of GFNs to map
36 * @nr: Number entries in the GFN array
37 * @err_ptr: Returns per-GFN error status.
38 * @prot: page protection mask
39 * @domid: Domain owning the pages
40 * @pages: Array of pages if this domain has an auto-translated physmap
41 *
42 * @gfn and @err_ptr may point to the same buffer, the GFNs will be
43 * overwritten by the error codes after they are mapped.
44 *
45 * Returns the number of successfully mapped frames, or a -ve error
46 * code.
47 */
48int xen_remap_domain_mfn_array(struct vm_area_struct *vma,
49 unsigned long addr,
50 xen_pfn_t *gfn, int nr,
51 int *err_ptr, pgprot_t prot,
52 unsigned domid,
53 struct page **pages);
54
55/* xen_remap_domain_mfn_range() - map a range of foreign frames
56 * @vma: VMA to map the pages into
57 * @addr: Address at which to map the pages
58 * @gfn: First GFN to map.
59 * @nr: Number frames to map
60 * @prot: page protection mask
61 * @domid: Domain owning the pages
62 * @pages: Array of pages if this domain has an auto-translated physmap
63 *
64 * Returns the number of successfully mapped frames, or a -ve error
65 * code.
66 */
30int xen_remap_domain_mfn_range(struct vm_area_struct *vma, 67int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
31 unsigned long addr, 68 unsigned long addr,
32 xen_pfn_t mfn, int nr, 69 xen_pfn_t gfn, int nr,
33 pgprot_t prot, unsigned domid, 70 pgprot_t prot, unsigned domid,
34 struct page **pages); 71 struct page **pages);
35int xen_unmap_domain_mfn_range(struct vm_area_struct *vma, 72int xen_unmap_domain_mfn_range(struct vm_area_struct *vma,
36 int numpgs, struct page **pages); 73 int numpgs, struct page **pages);
74int xen_xlate_remap_gfn_array(struct vm_area_struct *vma,
75 unsigned long addr,
76 xen_pfn_t *gfn, int nr,
77 int *err_ptr, pgprot_t prot,
78 unsigned domid,
79 struct page **pages);
80int xen_xlate_unmap_gfn_range(struct vm_area_struct *vma,
81 int nr, struct page **pages);
37 82
38bool xen_running_on_version_or_later(unsigned int major, unsigned int minor); 83bool xen_running_on_version_or_later(unsigned int major, unsigned int minor);
39 84
@@ -46,4 +91,30 @@ static inline efi_system_table_t __init *xen_efi_probe(void)
46} 91}
47#endif 92#endif
48 93
94#ifdef CONFIG_PREEMPT
95
96static inline void xen_preemptible_hcall_begin(void)
97{
98}
99
100static inline void xen_preemptible_hcall_end(void)
101{
102}
103
104#else
105
106DECLARE_PER_CPU(bool, xen_in_preemptible_hcall);
107
108static inline void xen_preemptible_hcall_begin(void)
109{
110 __this_cpu_write(xen_in_preemptible_hcall, true);
111}
112
113static inline void xen_preemptible_hcall_end(void)
114{
115 __this_cpu_write(xen_in_preemptible_hcall, false);
116}
117
118#endif /* CONFIG_PREEMPT */
119
49#endif /* INCLUDE_XEN_OPS_H */ 120#endif /* INCLUDE_XEN_OPS_H */
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index b78f21caf55a..289c0b5f08fe 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -46,6 +46,10 @@
46#include <xen/interface/io/xenbus.h> 46#include <xen/interface/io/xenbus.h>
47#include <xen/interface/io/xs_wire.h> 47#include <xen/interface/io/xs_wire.h>
48 48
49#define XENBUS_MAX_RING_PAGE_ORDER 4
50#define XENBUS_MAX_RING_PAGES (1U << XENBUS_MAX_RING_PAGE_ORDER)
51#define INVALID_GRANT_HANDLE (~0U)
52
49/* Register callback to watch this node. */ 53/* Register callback to watch this node. */
50struct xenbus_watch 54struct xenbus_watch
51{ 55{
@@ -114,9 +118,9 @@ int __must_check __xenbus_register_backend(struct xenbus_driver *drv,
114 const char *mod_name); 118 const char *mod_name);
115 119
116#define xenbus_register_frontend(drv) \ 120#define xenbus_register_frontend(drv) \
117 __xenbus_register_frontend(drv, THIS_MODULE, KBUILD_MODNAME); 121 __xenbus_register_frontend(drv, THIS_MODULE, KBUILD_MODNAME)
118#define xenbus_register_backend(drv) \ 122#define xenbus_register_backend(drv) \
119 __xenbus_register_backend(drv, THIS_MODULE, KBUILD_MODNAME); 123 __xenbus_register_backend(drv, THIS_MODULE, KBUILD_MODNAME)
120 124
121void xenbus_unregister_driver(struct xenbus_driver *drv); 125void xenbus_unregister_driver(struct xenbus_driver *drv);
122 126
@@ -199,15 +203,19 @@ int xenbus_watch_pathfmt(struct xenbus_device *dev, struct xenbus_watch *watch,
199 const char *pathfmt, ...); 203 const char *pathfmt, ...);
200 204
201int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state new_state); 205int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state new_state);
202int xenbus_grant_ring(struct xenbus_device *dev, unsigned long ring_mfn); 206int xenbus_grant_ring(struct xenbus_device *dev, void *vaddr,
203int xenbus_map_ring_valloc(struct xenbus_device *dev, 207 unsigned int nr_pages, grant_ref_t *grefs);
204 int gnt_ref, void **vaddr); 208int xenbus_map_ring_valloc(struct xenbus_device *dev, grant_ref_t *gnt_refs,
205int xenbus_map_ring(struct xenbus_device *dev, int gnt_ref, 209 unsigned int nr_grefs, void **vaddr);
206 grant_handle_t *handle, void *vaddr); 210int xenbus_map_ring(struct xenbus_device *dev,
211 grant_ref_t *gnt_refs, unsigned int nr_grefs,
212 grant_handle_t *handles, unsigned long *vaddrs,
213 bool *leaked);
207 214
208int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr); 215int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr);
209int xenbus_unmap_ring(struct xenbus_device *dev, 216int xenbus_unmap_ring(struct xenbus_device *dev,
210 grant_handle_t handle, void *vaddr); 217 grant_handle_t *handles, unsigned int nr_handles,
218 unsigned long *vaddrs);
211 219
212int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port); 220int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port);
213int xenbus_free_evtchn(struct xenbus_device *dev, int port); 221int xenbus_free_evtchn(struct xenbus_device *dev, int port);