aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2014-11-20 08:42:02 -0500
committerJiri Kosina <jkosina@suse.cz>2014-11-20 08:42:02 -0500
commita02001086bbfb4da35d1228bebc2f1b442db455f (patch)
tree62ab47936cef06fd08657ca5b6cd1df98c19be57 /include
parenteff264efeeb0898408e8c9df72d8a32621035bed (diff)
parentfc14f9c1272f62c3e8d01300f52467c0d9af50f9 (diff)
Merge Linus' tree to be be to apply submitted patches to newer code than
current trivial.git base
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acnames.h5
-rw-r--r--include/acpi/acpi_bus.h7
-rw-r--r--include/acpi/acpixf.h3
-rw-r--r--include/acpi/actbl1.h19
-rw-r--r--include/acpi/actbl3.h9
-rw-r--r--include/acpi/actypes.h4
-rw-r--r--include/asm-generic/atomic.h194
-rw-r--r--include/asm-generic/atomic64.h20
-rw-r--r--include/asm-generic/clkdev.h2
-rw-r--r--include/asm-generic/cputime_jiffies.h2
-rw-r--r--include/asm-generic/cputime_nsecs.h2
-rw-r--r--include/asm-generic/dma-contiguous.h9
-rw-r--r--include/asm-generic/dma-mapping-common.h17
-rw-r--r--include/asm-generic/gpio.h5
-rw-r--r--include/asm-generic/io.h2
-rw-r--r--include/asm-generic/irq_work.h10
-rw-r--r--include/asm-generic/pci-dma-compat.h8
-rw-r--r--include/asm-generic/pgtable.h45
-rw-r--r--include/asm-generic/sections.h4
-rw-r--r--include/asm-generic/syscall.h2
-rw-r--r--include/asm-generic/vmlinux.lds.h2
-rw-r--r--include/crypto/drbg.h32
-rw-r--r--include/crypto/hash.h5
-rw-r--r--include/crypto/internal/hash.h9
-rw-r--r--include/crypto/mcryptd.h112
-rw-r--r--include/crypto/public_key.h6
-rw-r--r--include/drm/ati_pcigart.h30
-rw-r--r--include/drm/drmP.h780
-rw-r--r--include/drm/drm_agpsupport.h26
-rw-r--r--include/drm/drm_buffer.h148
-rw-r--r--include/drm/drm_crtc.h64
-rw-r--r--include/drm/drm_dp_helper.h16
-rw-r--r--include/drm/drm_dp_mst_helper.h511
-rw-r--r--include/drm/drm_fb_helper.h9
-rw-r--r--include/drm/drm_gem.h183
-rw-r--r--include/drm/drm_gem_cma_helper.h4
-rw-r--r--include/drm/drm_legacy.h203
-rw-r--r--include/drm/drm_memory.h59
-rw-r--r--include/drm/drm_mipi_dsi.h23
-rw-r--r--include/drm/drm_modeset_lock.h20
-rw-r--r--include/drm/drm_of.h18
-rw-r--r--include/drm/drm_panel.h58
-rw-r--r--include/drm/drm_pciids.h8
-rw-r--r--include/drm/drm_rect.h6
-rw-r--r--include/drm/drm_usb.h15
-rw-r--r--include/drm/ttm/ttm_bo_api.h49
-rw-r--r--include/drm/ttm/ttm_bo_driver.h46
-rw-r--r--include/drm/ttm/ttm_execbuf_util.h24
-rw-r--r--include/dt-bindings/clock/exynos3250.h27
-rw-r--r--include/dt-bindings/clock/exynos4.h12
-rw-r--r--include/dt-bindings/clock/hix5hd2-clock.h27
-rw-r--r--include/dt-bindings/clock/imx1-clock.h40
-rw-r--r--include/dt-bindings/clock/imx21-clock.h80
-rw-r--r--include/dt-bindings/clock/imx27-clock.h108
-rw-r--r--include/dt-bindings/clock/imx6qdl-clock.h253
-rw-r--r--include/dt-bindings/clock/imx6sl-clock.h30
-rw-r--r--include/dt-bindings/clock/imx6sx-clock.h25
-rw-r--r--include/dt-bindings/clock/maxim,max77686.h23
-rw-r--r--include/dt-bindings/clock/maxim,max77802.h22
-rw-r--r--include/dt-bindings/clock/pxa-clock.h77
-rw-r--r--include/dt-bindings/clock/r8a7740-clock.h77
-rw-r--r--include/dt-bindings/clock/r8a7790-clock.h28
-rw-r--r--include/dt-bindings/clock/r8a7791-clock.h28
-rw-r--r--include/dt-bindings/clock/r8a7794-clock.h80
-rw-r--r--include/dt-bindings/clock/rk3188-cru-common.h1
-rw-r--r--include/dt-bindings/clock/rk3288-cru.h82
-rw-r--r--include/dt-bindings/clock/rockchip,rk808.h11
-rw-r--r--include/dt-bindings/clock/s5pv210-audss.h34
-rw-r--r--include/dt-bindings/clock/s5pv210.h239
-rw-r--r--include/dt-bindings/clock/tegra124-car.h6
-rw-r--r--include/dt-bindings/clock/vf610-clock.h42
-rw-r--r--include/dt-bindings/dma/nbpfaxi.h20
-rw-r--r--include/dt-bindings/input/ti-drv260x.h36
-rw-r--r--include/dt-bindings/mfd/as3722.h2
-rw-r--r--include/dt-bindings/pinctrl/at91.h5
-rw-r--r--include/dt-bindings/pinctrl/dra.h4
-rw-r--r--include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h7
-rw-r--r--include/dt-bindings/pinctrl/rockchip.h2
-rw-r--r--include/dt-bindings/sound/cs35l32.h26
-rw-r--r--include/keys/asymmetric-type.h41
-rw-r--r--include/keys/user-type.h1
-rw-r--r--include/kvm/arm_arch_timer.h14
-rw-r--r--include/kvm/arm_vgic.h235
-rw-r--r--include/linux/acct.h4
-rw-r--r--include/linux/acpi.h14
-rw-r--r--include/linux/aer.h2
-rw-r--r--include/linux/ahci_platform.h13
-rw-r--r--include/linux/amba/bus.h5
-rw-r--r--include/linux/ata_platform.h5
-rw-r--r--include/linux/atmel-mci.h2
-rw-r--r--include/linux/atmel-pwm-bl.h43
-rw-r--r--include/linux/atmel_pwm.h70
-rw-r--r--include/linux/atmel_tc.h13
-rw-r--r--include/linux/atomic.h36
-rw-r--r--include/linux/audit.h27
-rw-r--r--include/linux/backing-dev.h4
-rw-r--r--include/linux/balloon_compaction.h169
-rw-r--r--include/linux/bcma/bcma.h6
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h8
-rw-r--r--include/linux/bcma/bcma_regs.h5
-rw-r--r--include/linux/bcma/bcma_soc.h1
-rw-r--r--include/linux/bio.h66
-rw-r--r--include/linux/bitmap.h62
-rw-r--r--include/linux/bitops.h20
-rw-r--r--include/linux/blk-mq.h30
-rw-r--r--include/linux/blk_types.h18
-rw-r--r--include/linux/blkdev.h84
-rw-r--r--include/linux/bootmem.h1
-rw-r--r--include/linux/bpf.h136
-rw-r--r--include/linux/brcmphy.h138
-rw-r--r--include/linux/buffer_head.h47
-rw-r--r--include/linux/byteorder/generic.h2
-rw-r--r--include/linux/ccp.h12
-rw-r--r--include/linux/ceph/libceph.h1
-rw-r--r--include/linux/ceph/messenger.h14
-rw-r--r--include/linux/ceph/osd_client.h18
-rw-r--r--include/linux/ceph/pagelist.h5
-rw-r--r--include/linux/ceph/rados.h225
-rw-r--r--include/linux/cgroup.h26
-rw-r--r--include/linux/clk-private.h2
-rw-r--r--include/linux/clk-provider.h33
-rw-r--r--include/linux/clk.h29
-rw-r--r--include/linux/clk/at91_pmc.h1
-rw-r--r--include/linux/clk/ti.h1
-rw-r--r--include/linux/clocksource.h2
-rw-r--r--include/linux/cma.h30
-rw-r--r--include/linux/com20020.h29
-rw-r--r--include/linux/compaction.h24
-rw-r--r--include/linux/compiler-gcc4.h1
-rw-r--r--include/linux/compiler-gcc5.h65
-rw-r--r--include/linux/cpu.h2
-rw-r--r--include/linux/cpufreq-dt.h22
-rw-r--r--include/linux/cpufreq.h5
-rw-r--r--include/linux/cpumask.h11
-rw-r--r--include/linux/cpuset.h7
-rw-r--r--include/linux/crash_dump.h15
-rw-r--r--include/linux/crc-t10dif.h5
-rw-r--r--include/linux/cred.h9
-rw-r--r--include/linux/cycx_x25.h125
-rw-r--r--include/linux/dcache.h11
-rw-r--r--include/linux/decompress/bunzip2.h8
-rw-r--r--include/linux/decompress/generic.h10
-rw-r--r--include/linux/decompress/inflate.h8
-rw-r--r--include/linux/decompress/unlz4.h8
-rw-r--r--include/linux/decompress/unlzma.h8
-rw-r--r--include/linux/decompress/unlzo.h8
-rw-r--r--include/linux/decompress/unxz.h8
-rw-r--r--include/linux/devcoredump.h35
-rw-r--r--include/linux/device.h15
-rw-r--r--include/linux/dma-contiguous.h11
-rw-r--r--include/linux/dma-mapping.h26
-rw-r--r--include/linux/dma/dw.h64
-rw-r--r--include/linux/dmaengine.h44
-rw-r--r--include/linux/dmar.h8
-rw-r--r--include/linux/drbd.h4
-rw-r--r--include/linux/drbd_genl.h4
-rw-r--r--include/linux/drbd_limits.h6
-rw-r--r--include/linux/dw_dmac.h111
-rw-r--r--include/linux/dynamic_debug.h12
-rw-r--r--include/linux/dynamic_queue_limits.h12
-rw-r--r--include/linux/edac.h5
-rw-r--r--include/linux/efi.h36
-rw-r--r--include/linux/etherdevice.h1
-rw-r--r--include/linux/ethtool.h4
-rw-r--r--include/linux/extcon/extcon-gpio.h4
-rw-r--r--include/linux/extcon/sm5502.h287
-rw-r--r--include/linux/f2fs_fs.h22
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/filter.h196
-rw-r--r--include/linux/flex_proportions.h5
-rw-r--r--include/linux/font.h4
-rw-r--r--include/linux/fs.h148
-rw-r--r--include/linux/fs_enet_pd.h1
-rw-r--r--include/linux/fs_pin.h17
-rw-r--r--include/linux/fsl_ifc.h6
-rw-r--r--include/linux/fsldma.h13
-rw-r--r--include/linux/fsnotify_backend.h14
-rw-r--r--include/linux/ftrace.h24
-rw-r--r--include/linux/ftrace_event.h34
-rw-r--r--include/linux/genalloc.h7
-rw-r--r--include/linux/genl_magic_func.h4
-rw-r--r--include/linux/gfp.h4
-rw-r--r--include/linux/glob.h9
-rw-r--r--include/linux/gpio/consumer.h134
-rw-r--r--include/linux/gpio/driver.h70
-rw-r--r--include/linux/gpio/machine.h61
-rw-r--r--include/linux/hash.h4
-rw-r--r--include/linux/hid.h8
-rw-r--r--include/linux/highmem.h2
-rw-r--r--include/linux/host1x.h15
-rw-r--r--include/linux/huge_mm.h6
-rw-r--r--include/linux/hugetlb.h1
-rw-r--r--include/linux/i2c/atmel_mxt_ts.h3
-rw-r--r--include/linux/i2c/s6000.h10
-rw-r--r--include/linux/i82593.h229
-rw-r--r--include/linux/ieee80211.h73
-rw-r--r--include/linux/if_macvlan.h1
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/linux/igmp.h1
-rw-r--r--include/linux/iio/trigger.h4
-rw-r--r--include/linux/ima.h4
-rw-r--r--include/linux/init_task.h12
-rw-r--r--include/linux/input/mt.h1
-rw-r--r--include/linux/input/pixcir_ts.h12
-rw-r--r--include/linux/interrupt.h5
-rw-r--r--include/linux/iommu.h26
-rw-r--r--include/linux/ioport.h11
-rw-r--r--include/linux/ipack.h24
-rw-r--r--include/linux/irq.h8
-rw-r--r--include/linux/irq_work.h3
-rw-r--r--include/linux/irqchip/arm-gic.h16
-rw-r--r--include/linux/irqchip/irq-omap-intc.h32
-rw-r--r--include/linux/irqdesc.h29
-rw-r--r--include/linux/jbd2.h32
-rw-r--r--include/linux/jiffies.h12
-rw-r--r--include/linux/jump_label.h17
-rw-r--r--include/linux/kernel.h70
-rw-r--r--include/linux/kernel_stat.h4
-rw-r--r--include/linux/kernelcapi.h2
-rw-r--r--include/linux/kexec.h105
-rw-r--r--include/linux/key-type.h34
-rw-r--r--include/linux/kgdb.h2
-rw-r--r--include/linux/khugepaged.h17
-rw-r--r--include/linux/klist.h2
-rw-r--r--include/linux/kvm_host.h77
-rw-r--r--include/linux/kvm_types.h14
-rw-r--r--include/linux/leds.h18
-rw-r--r--include/linux/libata.h12
-rw-r--r--include/linux/list.h15
-rw-r--r--include/linux/lockd/lockd.h1
-rw-r--r--include/linux/lockdep.h8
-rw-r--r--include/linux/mailbox_client.h46
-rw-r--r--include/linux/mailbox_controller.h133
-rw-r--r--include/linux/mei_cl_bus.h1
-rw-r--r--include/linux/memblock.h4
-rw-r--r--include/linux/memcontrol.h169
-rw-r--r--include/linux/memory.h2
-rw-r--r--include/linux/memory_hotplug.h11
-rw-r--r--include/linux/mempolicy.h7
-rw-r--r--include/linux/mfd/abx500/ab8500.h1
-rw-r--r--include/linux/mfd/arizona/core.h35
-rw-r--r--include/linux/mfd/arizona/registers.h814
-rw-r--r--include/linux/mfd/core.h3
-rw-r--r--include/linux/mfd/cros_ec.h122
-rw-r--r--include/linux/mfd/cros_ec_commands.h3
-rw-r--r--include/linux/mfd/da9052/da9052.h2
-rw-r--r--include/linux/mfd/da9063/core.h3
-rw-r--r--include/linux/mfd/da9063/registers.h129
-rw-r--r--include/linux/mfd/davinci_voicecodec.h2
-rw-r--r--include/linux/mfd/hi6421-pmic.h41
-rw-r--r--include/linux/mfd/intel_soc_pmic.h30
-rw-r--r--include/linux/mfd/max14577-private.h95
-rw-r--r--include/linux/mfd/max14577.h30
-rw-r--r--include/linux/mfd/max77686-private.h239
-rw-r--r--include/linux/mfd/max77686.h59
-rw-r--r--include/linux/mfd/max77693-private.h77
-rw-r--r--include/linux/mfd/max77693.h40
-rw-r--r--include/linux/mfd/mc13783.h1
-rw-r--r--include/linux/mfd/mc13xxx.h23
-rw-r--r--include/linux/mfd/rk808.h196
-rw-r--r--include/linux/mfd/rn5t618.h228
-rw-r--r--include/linux/mfd/rtsx_pci.h6
-rw-r--r--include/linux/mfd/samsung/core.h22
-rw-r--r--include/linux/mfd/samsung/irq.h24
-rw-r--r--include/linux/mfd/samsung/s2mpa01.h12
-rw-r--r--include/linux/mfd/samsung/s2mps11.h9
-rw-r--r--include/linux/mfd/samsung/s2mps14.h10
-rw-r--r--include/linux/mfd/samsung/s2mpu02.h201
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h1
-rw-r--r--include/linux/mfd/ti_ssp.h93
-rw-r--r--include/linux/mfd/tmio.h25
-rw-r--r--include/linux/mfd/tps65217.h2
-rw-r--r--include/linux/mfd/tps65910.h2
-rw-r--r--include/linux/micrel_phy.h1
-rw-r--r--include/linux/migrate.h14
-rw-r--r--include/linux/mlx4/cmd.h7
-rw-r--r--include/linux/mlx4/device.h38
-rw-r--r--include/linux/mlx4/qp.h12
-rw-r--r--include/linux/mlx5/device.h152
-rw-r--r--include/linux/mlx5/driver.h118
-rw-r--r--include/linux/mlx5/mlx5_ifc.h349
-rw-r--r--include/linux/mlx5/qp.h38
-rw-r--r--include/linux/mm.h64
-rw-r--r--include/linux/mm_types.h1
-rw-r--r--include/linux/mmc/card.h10
-rw-r--r--include/linux/mmc/dw_mmc.h6
-rw-r--r--include/linux/mmc/host.h12
-rw-r--r--include/linux/mmc/mmc.h7
-rw-r--r--include/linux/mmc/sdhci.h6
-rw-r--r--include/linux/mmc/slot-gpio.h5
-rw-r--r--include/linux/mmdebug.h22
-rw-r--r--include/linux/mmu_notifier.h30
-rw-r--r--include/linux/mmzone.h269
-rw-r--r--include/linux/module.h11
-rw-r--r--include/linux/moduleloader.h6
-rw-r--r--include/linux/moduleparam.h52
-rw-r--r--include/linux/mount.h16
-rw-r--r--include/linux/msi.h6
-rw-r--r--include/linux/mtd/cfi.h22
-rw-r--r--include/linux/mtd/mtd.h2
-rw-r--r--include/linux/mtd/nand.h65
-rw-r--r--include/linux/mtd/spi-nor.h25
-rw-r--r--include/linux/mutex.h4
-rw-r--r--include/linux/mvebu-pmsu.h20
-rw-r--r--include/linux/netdevice.h264
-rw-r--r--include/linux/netfilter.h5
-rw-r--r--include/linux/netfilter/ipset/ip_set.h60
-rw-r--r--include/linux/netfilter/ipset/ip_set_list.h1
-rw-r--r--include/linux/netfilter_bridge.h50
-rw-r--r--include/linux/nfs4.h29
-rw-r--r--include/linux/nfs_fs.h47
-rw-r--r--include/linux/nfs_fs_sb.h2
-rw-r--r--include/linux/nfs_page.h20
-rw-r--r--include/linux/nfs_xdr.h81
-rw-r--r--include/linux/nmi.h13
-rw-r--r--include/linux/nodemask.h11
-rw-r--r--include/linux/nsproxy.h16
-rw-r--r--include/linux/of.h174
-rw-r--r--include/linux/of_address.h27
-rw-r--r--include/linux/of_dma.h4
-rw-r--r--include/linux/of_pci.h13
-rw-r--r--include/linux/of_platform.h7
-rw-r--r--include/linux/of_reserved_mem.h12
-rw-r--r--include/linux/omap-dma.h38
-rw-r--r--include/linux/oom.h7
-rw-r--r--include/linux/page-flags.h21
-rw-r--r--include/linux/page-isolation.h8
-rw-r--r--include/linux/page_cgroup.h70
-rw-r--r--include/linux/pagemap.h33
-rw-r--r--include/linux/pci-acpi.h7
-rw-r--r--include/linux/pci.h66
-rw-r--r--include/linux/pci_hotplug.h2
-rw-r--r--include/linux/pci_ids.h20
-rw-r--r--include/linux/percpu-defs.h3
-rw-r--r--include/linux/percpu-refcount.h121
-rw-r--r--include/linux/percpu.h13
-rw-r--r--include/linux/percpu_counter.h10
-rw-r--r--include/linux/perf_event.h14
-rw-r--r--include/linux/phonedev.h25
-rw-r--r--include/linux/phy.h27
-rw-r--r--include/linux/phy_fixed.h31
-rw-r--r--include/linux/pid_namespace.h1
-rw-r--r--include/linux/pinctrl/pinconf-generic.h2
-rw-r--r--include/linux/pinctrl/pinmux.h9
-rw-r--r--include/linux/pl320-ipc.h (renamed from include/linux/mailbox.h)0
-rw-r--r--include/linux/platform_data/camera-mx1.h35
-rw-r--r--include/linux/platform_data/dma-dw.h59
-rw-r--r--include/linux/platform_data/dma-imx.h1
-rw-r--r--include/linux/platform_data/drv260x-pdata.h28
-rw-r--r--include/linux/platform_data/edma.h2
-rw-r--r--include/linux/platform_data/elm.h16
-rw-r--r--include/linux/platform_data/gpio-dwapb.h32
-rw-r--r--include/linux/platform_data/i2c-designware.h (renamed from include/linux/tegra-soc.h)15
-rw-r--r--include/linux/platform_data/isl9305.h30
-rw-r--r--include/linux/platform_data/mmc-omap.h1
-rw-r--r--include/linux/platform_data/mtd-nand-omap2.h14
-rw-r--r--include/linux/platform_data/rcar-du.h4
-rw-r--r--include/linux/platform_data/samsung-usbphy.h27
-rw-r--r--include/linux/platform_data/tegra_emc.h34
-rw-r--r--include/linux/platform_data/usb-ehci-mxc.h46
-rw-r--r--include/linux/platform_data/usb-imx_udc.h23
-rw-r--r--include/linux/platform_data/video-clcd-versatile.h27
-rw-r--r--include/linux/pm.h5
-rw-r--r--include/linux/pm_domain.h136
-rw-r--r--include/linux/pm_qos.h5
-rw-r--r--include/linux/pnfs_osd_xdr.h2
-rw-r--r--include/linux/power/charger-manager.h3
-rw-r--r--include/linux/power_supply.h14
-rw-r--r--include/linux/printk.h5
-rw-r--r--include/linux/prio_heap.h58
-rw-r--r--include/linux/proc_fs.h2
-rw-r--r--include/linux/proportions.h5
-rw-r--r--include/linux/quota.h1
-rw-r--r--include/linux/random.h4
-rw-r--r--include/linux/rbtree_augmented.h10
-rw-r--r--include/linux/rculist.h8
-rw-r--r--include/linux/rcupdate.h121
-rw-r--r--include/linux/rcutiny.h2
-rw-r--r--include/linux/reboot.h3
-rw-r--r--include/linux/regulator/consumer.h22
-rw-r--r--include/linux/regulator/da9211.h9
-rw-r--r--include/linux/regulator/driver.h14
-rw-r--r--include/linux/regulator/machine.h1
-rw-r--r--include/linux/regulator/max1586.h2
-rw-r--r--include/linux/rhashtable.h19
-rw-r--r--include/linux/ring_buffer.h2
-rw-r--r--include/linux/rio_drv.h5
-rw-r--r--include/linux/rmap.h2
-rw-r--r--include/linux/rtnetlink.h10
-rw-r--r--include/linux/rwsem.h2
-rw-r--r--include/linux/scatterlist.h2
-rw-r--r--include/linux/sched.h121
-rw-r--r--include/linux/screen_info.h8
-rw-r--r--include/linux/seccomp.h25
-rw-r--r--include/linux/security.h10
-rw-r--r--include/linux/seqlock.h19
-rw-r--r--include/linux/seqno-fence.h1
-rw-r--r--include/linux/serial_8250.h6
-rw-r--r--include/linux/serial_core.h20
-rw-r--r--include/linux/sh_dma.h24
-rw-r--r--include/linux/shm.h18
-rw-r--r--include/linux/shmem_fs.h17
-rw-r--r--include/linux/signal.h44
-rw-r--r--include/linux/skbuff.h363
-rw-r--r--include/linux/slab.h64
-rw-r--r--include/linux/slab_def.h20
-rw-r--r--include/linux/smp.h2
-rw-r--r--include/linux/soc/ti/knav_dma.h175
-rw-r--r--include/linux/soc/ti/knav_qmss.h90
-rw-r--r--include/linux/socket.h2
-rw-r--r--include/linux/spi/mcp23s08.h18
-rw-r--r--include/linux/spi/pxa2xx_spi.h9
-rw-r--r--include/linux/spi/spi.h7
-rw-r--r--include/linux/spinlock.h8
-rw-r--r--include/linux/string.h7
-rw-r--r--include/linux/string_helpers.h65
-rw-r--r--include/linux/sunrpc/auth.h4
-rw-r--r--include/linux/sunrpc/auth_gss.h3
-rw-r--r--include/linux/sunrpc/gss_krb5.h4
-rw-r--r--include/linux/sunrpc/svc.h5
-rw-r--r--include/linux/sunrpc/svc_rdma.h3
-rw-r--r--include/linux/sunrpc/svc_xprt.h2
-rw-r--r--include/linux/sunrpc/xprt.h1
-rw-r--r--include/linux/sunrpc/xprtrdma.h2
-rw-r--r--include/linux/suspend.h6
-rw-r--r--include/linux/swap.h38
-rw-r--r--include/linux/syscalls.h8
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/t10-pi.h22
-rw-r--r--include/linux/tcp.h10
-rw-r--r--include/linux/thermal.h50
-rw-r--r--include/linux/ti_wilink_st.h2
-rw-r--r--include/linux/tick.h11
-rw-r--r--include/linux/topology.h17
-rw-r--r--include/linux/torture.h5
-rw-r--r--include/linux/tracehook.h8
-rw-r--r--include/linux/tracepoint.h55
-rw-r--r--include/linux/tty.h15
-rw-r--r--include/linux/tty_driver.h4
-rw-r--r--include/linux/udp.h16
-rw-r--r--include/linux/uio.h5
-rw-r--r--include/linux/uio_driver.h12
-rw-r--r--include/linux/uprobes.h14
-rw-r--r--include/linux/usb.h12
-rw-r--r--include/linux/usb/chipidea.h1
-rw-r--r--include/linux/usb/gadget.h26
-rw-r--r--include/linux/usb/hcd.h4
-rw-r--r--include/linux/usb/of.h5
-rw-r--r--include/linux/usb/quirks.h22
-rw-r--r--include/linux/usb/usbnet.h4
-rw-r--r--include/linux/usb_usual.h4
-rw-r--r--include/linux/user_namespace.h6
-rw-r--r--include/linux/vfio.h23
-rw-r--r--include/linux/vga_switcheroo.h2
-rw-r--r--include/linux/vgaarb.h2
-rw-r--r--include/linux/virtio.h14
-rw-r--r--include/linux/virtio_config.h17
-rw-r--r--include/linux/vm_event_item.h7
-rw-r--r--include/linux/vmalloc.h2
-rw-r--r--include/linux/wait.h21
-rw-r--r--include/linux/watchdog.h9
-rw-r--r--include/linux/workqueue.h2
-rw-r--r--include/linux/zbud.h2
-rw-r--r--include/linux/zlib.h122
-rw-r--r--include/linux/zpool.h106
-rw-r--r--include/linux/zsmalloc.h2
-rw-r--r--include/media/davinci/dm644x_ccdc.h2
-rw-r--r--include/media/omap3isp.h3
-rw-r--r--include/media/rc-map.h1
-rw-r--r--include/media/videobuf2-core.h21
-rw-r--r--include/misc/cxl.h48
-rw-r--r--include/net/9p/transport.h1
-rw-r--r--include/net/addrconf.h3
-rw-r--r--include/net/ah.h3
-rw-r--r--include/net/bluetooth/bluetooth.h5
-rw-r--r--include/net/bluetooth/hci.h1
-rw-r--r--include/net/bluetooth/hci_core.h25
-rw-r--r--include/net/bluetooth/l2cap.h35
-rw-r--r--include/net/cfg80211.h69
-rw-r--r--include/net/checksum.h4
-rw-r--r--include/net/codel.h2
-rw-r--r--include/net/dsa.h96
-rw-r--r--include/net/dst.h16
-rw-r--r--include/net/dst_ops.h2
-rw-r--r--include/net/flow_keys.h16
-rw-r--r--include/net/gen_stats.h15
-rw-r--r--include/net/genetlink.h8
-rw-r--r--include/net/geneve.h97
-rw-r--r--include/net/gue.h23
-rw-r--r--include/net/if_inet6.h2
-rw-r--r--include/net/inet6_hashtables.h5
-rw-r--r--include/net/inet_connection_sock.h10
-rw-r--r--include/net/inet_frag.h2
-rw-r--r--include/net/inetpeer.h1
-rw-r--r--include/net/ip.h29
-rw-r--r--include/net/ip6_checksum.h8
-rw-r--r--include/net/ip6_fib.h25
-rw-r--r--include/net/ip_fib.h5
-rw-r--r--include/net/ip_tunnels.h38
-rw-r--r--include/net/ip_vs.h223
-rw-r--r--include/net/ipv6.h6
-rw-r--r--include/net/lib80211.h5
-rw-r--r--include/net/mac80211.h34
-rw-r--r--include/net/mld.h5
-rw-r--r--include/net/neighbour.h2
-rw-r--r--include/net/net_namespace.h20
-rw-r--r--include/net/netdma.h32
-rw-r--r--include/net/netfilter/br_netfilter.h6
-rw-r--r--include/net/netfilter/ipv4/nf_nat_masquerade.h14
-rw-r--r--include/net/netfilter/ipv4/nf_reject.h125
-rw-r--r--include/net/netfilter/ipv6/nf_nat_masquerade.h10
-rw-r--r--include/net/netfilter/ipv6/nf_reject.h167
-rw-r--r--include/net/netfilter/nf_conntrack.h2
-rw-r--r--include/net/netfilter/nf_nat.h10
-rw-r--r--include/net/netfilter/nf_nat_l3proto.h75
-rw-r--r--include/net/netfilter/nf_tables.h5
-rw-r--r--include/net/netfilter/nft_masq.h19
-rw-r--r--include/net/netfilter/nft_reject.h9
-rw-r--r--include/net/netlabel.h8
-rw-r--r--include/net/netlink.h2
-rw-r--r--include/net/netns/ieee802154_6lowpan.h1
-rw-r--r--include/net/netns/ipv4.h1
-rw-r--r--include/net/netns/ipv6.h2
-rw-r--r--include/net/netns/xfrm.h14
-rw-r--r--include/net/nfc/nci.h16
-rw-r--r--include/net/nfc/nci_core.h9
-rw-r--r--include/net/pkt_cls.h18
-rw-r--r--include/net/pkt_sched.h8
-rw-r--r--include/net/regulatory.h2
-rw-r--r--include/net/sch_generic.h122
-rw-r--r--include/net/sctp/command.h2
-rw-r--r--include/net/sctp/sctp.h18
-rw-r--r--include/net/sctp/sm.h6
-rw-r--r--include/net/snmp.h14
-rw-r--r--include/net/sock.h44
-rw-r--r--include/net/tcp.h129
-rw-r--r--include/net/udp.h21
-rw-r--r--include/net/udp_tunnel.h94
-rw-r--r--include/net/wimax.h2
-rw-r--r--include/net/xfrm.h1
-rw-r--r--include/ras/ras_event.h48
-rw-r--r--include/rdma/ib_mad.h18
-rw-r--r--include/rdma/ib_umem.h1
-rw-r--r--include/rdma/ib_verbs.h42
-rw-r--r--include/rxrpc/types.h41
-rw-r--r--include/scsi/iscsi_if.h1
-rw-r--r--include/scsi/osd_initiator.h2
-rw-r--r--include/scsi/osd_ore.h2
-rw-r--r--include/scsi/osd_protocol.h4
-rw-r--r--include/scsi/osd_sec.h2
-rw-r--r--include/scsi/osd_sense.h2
-rw-r--r--include/scsi/osd_types.h2
-rw-r--r--include/scsi/scsi.h3
-rw-r--r--include/scsi/scsi_cmnd.h36
-rw-r--r--include/scsi/scsi_device.h1
-rw-r--r--include/scsi/scsi_host.h6
-rw-r--r--include/scsi/scsi_tcq.h8
-rw-r--r--include/scsi/sg.h4
-rw-r--r--include/soc/tegra/ahb.h (renamed from include/linux/tegra-ahb.h)6
-rw-r--r--include/soc/tegra/common.h14
-rw-r--r--include/soc/tegra/cpuidle.h (renamed from include/linux/tegra-cpuidle.h)6
-rw-r--r--include/soc/tegra/fuse.h65
-rw-r--r--include/soc/tegra/pm.h38
-rw-r--r--include/soc/tegra/pmc.h (renamed from include/linux/tegra-powergate.h)31
-rw-r--r--include/sound/atmel-abdac.h2
-rw-r--r--include/sound/atmel-ac97c.h2
-rw-r--r--include/sound/pcm.h52
-rw-r--r--include/sound/rt5645.h3
-rw-r--r--include/sound/rt5677.h13
-rw-r--r--include/sound/soc-dapm.h5
-rw-r--r--include/sound/soc.h103
-rw-r--r--include/sound/vx_core.h7
-rw-r--r--include/target/target_core_base.h17
-rw-r--r--include/trace/events/asoc.h6
-rw-r--r--include/trace/events/bcache.h21
-rw-r--r--include/trace/events/btrfs.h85
-rw-r--r--include/trace/events/ext4.h59
-rw-r--r--include/trace/events/f2fs.h16
-rw-r--r--include/trace/events/filelock.h14
-rw-r--r--include/trace/events/ipi.h89
-rw-r--r--include/trace/events/irq.h4
-rw-r--r--include/trace/events/kvm.h44
-rw-r--r--include/trace/events/migrate.h1
-rw-r--r--include/trace/events/pagemap.h16
-rw-r--r--include/trace/events/rcu.h21
-rw-r--r--include/trace/events/thermal.h83
-rw-r--r--include/trace/events/thp.h88
-rw-r--r--include/uapi/Kbuild1
-rw-r--r--include/uapi/asm-generic/unistd.h6
-rw-r--r--include/uapi/drm/drm.h2
-rw-r--r--include/uapi/drm/drm_mode.h5
-rw-r--r--include/uapi/drm/exynos_drm.h40
-rw-r--r--include/uapi/drm/nouveau_drm.h11
-rw-r--r--include/uapi/drm/radeon_drm.h28
-rw-r--r--include/uapi/drm/tegra_drm.h46
-rw-r--r--include/uapi/drm/vmwgfx_drm.h2
-rw-r--r--include/uapi/linux/Kbuild10
-rw-r--r--include/uapi/linux/audit.h14
-rw-r--r--include/uapi/linux/bpf.h156
-rw-r--r--include/uapi/linux/bpf_common.h55
-rw-r--r--include/uapi/linux/bsg.h11
-rw-r--r--include/uapi/linux/dm-ioctl.h4
-rw-r--r--include/uapi/linux/elf-em.h1
-rw-r--r--include/uapi/linux/elf.h2
-rw-r--r--include/uapi/linux/ethtool.h29
-rw-r--r--include/uapi/linux/fcntl.h15
-rw-r--r--include/uapi/linux/filter.h56
-rw-r--r--include/uapi/linux/fou.h39
-rw-r--r--include/uapi/linux/fs.h1
-rw-r--r--include/uapi/linux/genwqe/genwqe_card.h2
-rw-r--r--include/uapi/linux/hyperv.h2
-rw-r--r--include/uapi/linux/if_bridge.h1
-rw-r--r--include/uapi/linux/if_ether.h1
-rw-r--r--include/uapi/linux/if_link.h24
-rw-r--r--include/uapi/linux/if_tunnel.h17
-rw-r--r--include/uapi/linux/in6.h2
-rw-r--r--include/uapi/linux/inet_diag.h13
-rw-r--r--include/uapi/linux/input.h8
-rw-r--r--include/uapi/linux/ip_vs.h3
-rw-r--r--include/uapi/linux/kernel-page-flags.h1
-rw-r--r--include/uapi/linux/kexec.h11
-rw-r--r--include/uapi/linux/kvm.h34
-rw-r--r--include/uapi/linux/memfd.h8
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set.h12
-rw-r--r--include/uapi/linux/netfilter/nf_nat.h5
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h59
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_acct.h8
-rw-r--r--include/uapi/linux/netfilter/xt_set.h10
-rw-r--r--include/uapi/linux/netfilter_arp/arpt_mangle.h2
-rw-r--r--include/uapi/linux/nfsd/export.h5
-rw-r--r--include/uapi/linux/nl80211.h116
-rw-r--r--include/uapi/linux/openvswitch.h31
-rw-r--r--include/uapi/linux/pci_regs.h3
-rw-r--r--include/uapi/linux/perf_event.h14
-rw-r--r--include/uapi/linux/prctl.h27
-rw-r--r--include/uapi/linux/raid/md_u.h1
-rw-r--r--include/uapi/linux/sched.h2
-rw-r--r--include/uapi/linux/serial_core.h3
-rw-r--r--include/uapi/linux/serio.h1
-rw-r--r--include/uapi/linux/smiapp.h29
-rw-r--r--include/uapi/linux/target_core_user.h142
-rw-r--r--include/uapi/linux/uhid.h120
-rw-r--r--include/uapi/linux/uinput.h9
-rw-r--r--include/uapi/linux/usb/functionfs.h19
-rw-r--r--include/uapi/linux/usbip.h26
-rw-r--r--include/uapi/linux/v4l2-controls.h6
-rw-r--r--include/uapi/linux/vfio.h37
-rw-r--r--include/uapi/linux/videodev2.h13
-rw-r--r--include/uapi/linux/virtio_blk.h5
-rw-r--r--include/uapi/linux/wil6210_uapi.h87
-rw-r--r--include/uapi/linux/xattr.h2
-rw-r--r--include/uapi/linux/xfrm.h7
-rw-r--r--include/uapi/misc/Kbuild2
-rw-r--r--include/uapi/misc/cxl.h88
-rw-r--r--include/uapi/rdma/ib_user_mad.h42
-rw-r--r--include/uapi/rdma/ib_user_verbs.h16
-rw-r--r--include/uapi/rdma/rdma_user_cm.h1
-rw-r--r--include/uapi/sound/asound.h3
-rw-r--r--include/video/imx-ipu-v3.h326
-rw-r--r--include/video/of_display_timing.h16
-rw-r--r--include/video/omapdss.h9
-rw-r--r--include/video/samsung_fimd.h5
-rw-r--r--include/xen/events.h2
-rw-r--r--include/xen/grant_table.h30
-rw-r--r--include/xen/interface/elfnote.h48
-rw-r--r--include/xen/interface/features.h3
-rw-r--r--include/xen/interface/io/vscsiif.h229
-rw-r--r--include/xen/interface/xen.h272
-rw-r--r--include/xen/xenbus.h21
669 files changed, 16013 insertions, 6928 deletions
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index c728113374f5..7461327e14e4 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -52,6 +52,7 @@
52#define METHOD_NAME__CBA "_CBA" 52#define METHOD_NAME__CBA "_CBA"
53#define METHOD_NAME__CID "_CID" 53#define METHOD_NAME__CID "_CID"
54#define METHOD_NAME__CRS "_CRS" 54#define METHOD_NAME__CRS "_CRS"
55#define METHOD_NAME__DDN "_DDN"
55#define METHOD_NAME__HID "_HID" 56#define METHOD_NAME__HID "_HID"
56#define METHOD_NAME__INI "_INI" 57#define METHOD_NAME__INI "_INI"
57#define METHOD_NAME__PLD "_PLD" 58#define METHOD_NAME__PLD "_PLD"
@@ -59,6 +60,10 @@
59#define METHOD_NAME__PRS "_PRS" 60#define METHOD_NAME__PRS "_PRS"
60#define METHOD_NAME__PRT "_PRT" 61#define METHOD_NAME__PRT "_PRT"
61#define METHOD_NAME__PRW "_PRW" 62#define METHOD_NAME__PRW "_PRW"
63#define METHOD_NAME__PS0 "_PS0"
64#define METHOD_NAME__PS1 "_PS1"
65#define METHOD_NAME__PS2 "_PS2"
66#define METHOD_NAME__PS3 "_PS3"
62#define METHOD_NAME__REG "_REG" 67#define METHOD_NAME__REG "_REG"
63#define METHOD_NAME__SB_ "_SB_" 68#define METHOD_NAME__SB_ "_SB_"
64#define METHOD_NAME__SEG "_SEG" 69#define METHOD_NAME__SEG "_SEG"
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index bcfd808b1098..f34a0835aa4f 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -118,6 +118,7 @@ struct acpi_device;
118struct acpi_hotplug_profile { 118struct acpi_hotplug_profile {
119 struct kobject kobj; 119 struct kobject kobj;
120 int (*scan_dependent)(struct acpi_device *adev); 120 int (*scan_dependent)(struct acpi_device *adev);
121 void (*notify_online)(struct acpi_device *adev);
121 bool enabled:1; 122 bool enabled:1;
122 bool demand_offline:1; 123 bool demand_offline:1;
123}; 124};
@@ -204,10 +205,9 @@ struct acpi_device_flags {
204 u32 match_driver:1; 205 u32 match_driver:1;
205 u32 initialized:1; 206 u32 initialized:1;
206 u32 visited:1; 207 u32 visited:1;
207 u32 no_hotplug:1;
208 u32 hotplug_notify:1; 208 u32 hotplug_notify:1;
209 u32 is_dock_station:1; 209 u32 is_dock_station:1;
210 u32 reserved:22; 210 u32 reserved:23;
211}; 211};
212 212
213/* File System */ 213/* File System */
@@ -246,7 +246,6 @@ struct acpi_device_pnp {
246 acpi_device_name device_name; /* Driver-determined */ 246 acpi_device_name device_name; /* Driver-determined */
247 acpi_device_class device_class; /* " */ 247 acpi_device_class device_class; /* " */
248 union acpi_object *str_obj; /* unicode string for _STR method */ 248 union acpi_object *str_obj; /* unicode string for _STR method */
249 unsigned long sun; /* _SUN */
250}; 249};
251 250
252#define acpi_device_bid(d) ((d)->pnp.bus_id) 251#define acpi_device_bid(d) ((d)->pnp.bus_id)
@@ -412,7 +411,6 @@ void acpi_bus_private_data_handler(acpi_handle, void *);
412int acpi_bus_get_private_data(acpi_handle, void **); 411int acpi_bus_get_private_data(acpi_handle, void **);
413int acpi_bus_attach_private_data(acpi_handle, void *); 412int acpi_bus_attach_private_data(acpi_handle, void *);
414void acpi_bus_detach_private_data(acpi_handle); 413void acpi_bus_detach_private_data(acpi_handle);
415void acpi_bus_no_hotplug(acpi_handle handle);
416extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); 414extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
417extern int register_acpi_notifier(struct notifier_block *); 415extern int register_acpi_notifier(struct notifier_block *);
418extern int unregister_acpi_notifier(struct notifier_block *); 416extern int unregister_acpi_notifier(struct notifier_block *);
@@ -435,6 +433,7 @@ int acpi_device_set_power(struct acpi_device *device, int state);
435int acpi_bus_init_power(struct acpi_device *device); 433int acpi_bus_init_power(struct acpi_device *device);
436int acpi_device_fix_up_power(struct acpi_device *device); 434int acpi_device_fix_up_power(struct acpi_device *device);
437int acpi_bus_update_power(acpi_handle handle, int *state_p); 435int acpi_bus_update_power(acpi_handle handle, int *state_p);
436int acpi_device_update_power(struct acpi_device *device, int *state_p);
438bool acpi_bus_power_manageable(acpi_handle handle); 437bool acpi_bus_power_manageable(acpi_handle handle);
439 438
440#ifdef CONFIG_PM 439#ifdef CONFIG_PM
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index b7c89d47efbe..ab2acf629a64 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 0x20140724 49#define ACPI_CA_VERSION 0x20140926
50 50
51#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
52#include <acpi/actypes.h> 52#include <acpi/actypes.h>
@@ -692,6 +692,7 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
692 *event_status)) 692 *event_status))
693ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable_all_gpes(void)) 693ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable_all_gpes(void))
694ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_runtime_gpes(void)) 694ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_runtime_gpes(void))
695ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_wakeup_gpes(void))
695 696
696ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 697ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
697 acpi_get_gpe_device(u32 gpe_index, 698 acpi_get_gpe_device(u32 gpe_index,
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 7626bfeac2cb..29e79370641d 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -952,7 +952,8 @@ enum acpi_srat_type {
952 ACPI_SRAT_TYPE_CPU_AFFINITY = 0, 952 ACPI_SRAT_TYPE_CPU_AFFINITY = 0,
953 ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1, 953 ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1,
954 ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2, 954 ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2,
955 ACPI_SRAT_TYPE_RESERVED = 3 /* 3 and greater are reserved */ 955 ACPI_SRAT_TYPE_GICC_AFFINITY = 3,
956 ACPI_SRAT_TYPE_RESERVED = 4 /* 4 and greater are reserved */
956}; 957};
957 958
958/* 959/*
@@ -968,7 +969,7 @@ struct acpi_srat_cpu_affinity {
968 u32 flags; 969 u32 flags;
969 u8 local_sapic_eid; 970 u8 local_sapic_eid;
970 u8 proximity_domain_hi[3]; 971 u8 proximity_domain_hi[3];
971 u32 reserved; /* Reserved, must be zero */ 972 u32 clock_domain;
972}; 973};
973 974
974/* Flags */ 975/* Flags */
@@ -1010,6 +1011,20 @@ struct acpi_srat_x2apic_cpu_affinity {
1010 1011
1011#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ 1012#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */
1012 1013
1014/* 3: GICC Affinity (ACPI 5.1) */
1015
1016struct acpi_srat_gicc_affinity {
1017 struct acpi_subtable_header header;
1018 u32 proximity_domain;
1019 u32 acpi_processor_uid;
1020 u32 flags;
1021 u32 clock_domain;
1022};
1023
1024/* Flags for struct acpi_srat_gicc_affinity */
1025
1026#define ACPI_SRAT_GICC_ENABLED (1) /* 00: Use affinity structure */
1027
1013/* Reset to default packing */ 1028/* Reset to default packing */
1014 1029
1015#pragma pack() 1030#pragma pack()
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
index 787bcc814463..5480cb2236bf 100644
--- a/include/acpi/actbl3.h
+++ b/include/acpi/actbl3.h
@@ -310,10 +310,15 @@ struct acpi_gtdt_timer_entry {
310 u32 common_flags; 310 u32 common_flags;
311}; 311};
312 312
313/* Flag Definitions: timer_flags and virtual_timer_flags above */
314
315#define ACPI_GTDT_GT_IRQ_MODE (1)
316#define ACPI_GTDT_GT_IRQ_POLARITY (1<<1)
317
313/* Flag Definitions: common_flags above */ 318/* Flag Definitions: common_flags above */
314 319
315#define ACPI_GTDT_GT_IS_SECURE_TIMER (1) 320#define ACPI_GTDT_GT_IS_SECURE_TIMER (1)
316#define ACPI_GTDT_GT_ALWAYS_ON (1<<1) 321#define ACPI_GTDT_GT_ALWAYS_ON (1<<1)
317 322
318/* 1: SBSA Generic Watchdog Structure */ 323/* 1: SBSA Generic Watchdog Structure */
319 324
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index ac03ec81d342..7000e66f768e 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -721,7 +721,7 @@ typedef u32 acpi_event_type;
721 * | | | +--- Enabled for wake? 721 * | | | +--- Enabled for wake?
722 * | | +----- Set? 722 * | | +----- Set?
723 * | +------- Has a handler? 723 * | +------- Has a handler?
724 * +----------- <Reserved> 724 * +------------- <Reserved>
725 */ 725 */
726typedef u32 acpi_event_status; 726typedef u32 acpi_event_status;
727 727
@@ -729,7 +729,7 @@ typedef u32 acpi_event_status;
729#define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01 729#define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01
730#define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02 730#define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02
731#define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04 731#define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04
732#define ACPI_EVENT_FLAG_HANDLE (acpi_event_status) 0x08 732#define ACPI_EVENT_FLAG_HAS_HANDLER (acpi_event_status) 0x08
733 733
734/* Actions for acpi_set_gpe, acpi_gpe_wakeup, acpi_hw_low_set_gpe */ 734/* Actions for acpi_set_gpe, acpi_gpe_wakeup, acpi_hw_low_set_gpe */
735 735
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 9c79e7603459..1973ad2b13f4 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -18,14 +18,100 @@
18#include <asm/cmpxchg.h> 18#include <asm/cmpxchg.h>
19#include <asm/barrier.h> 19#include <asm/barrier.h>
20 20
21/*
22 * atomic_$op() - $op integer to atomic variable
23 * @i: integer value to $op
24 * @v: pointer to the atomic variable
25 *
26 * Atomically $ops @i to @v. Does not strictly guarantee a memory-barrier, use
27 * smp_mb__{before,after}_atomic().
28 */
29
30/*
31 * atomic_$op_return() - $op interer to atomic variable and returns the result
32 * @i: integer value to $op
33 * @v: pointer to the atomic variable
34 *
35 * Atomically $ops @i to @v. Does imply a full memory barrier.
36 */
37
21#ifdef CONFIG_SMP 38#ifdef CONFIG_SMP
22/* Force people to define core atomics */ 39
23# if !defined(atomic_add_return) || !defined(atomic_sub_return) || \ 40/* we can build all atomic primitives from cmpxchg */
24 !defined(atomic_clear_mask) || !defined(atomic_set_mask) 41
25# error "SMP requires a little arch-specific magic" 42#define ATOMIC_OP(op, c_op) \
26# endif 43static inline void atomic_##op(int i, atomic_t *v) \
44{ \
45 int c, old; \
46 \
47 c = v->counter; \
48 while ((old = cmpxchg(&v->counter, c, c c_op i)) != c) \
49 c = old; \
50}
51
52#define ATOMIC_OP_RETURN(op, c_op) \
53static inline int atomic_##op##_return(int i, atomic_t *v) \
54{ \
55 int c, old; \
56 \
57 c = v->counter; \
58 while ((old = cmpxchg(&v->counter, c, c c_op i)) != c) \
59 c = old; \
60 \
61 return c c_op i; \
62}
63
64#else
65
66#include <linux/irqflags.h>
67
68#define ATOMIC_OP(op, c_op) \
69static inline void atomic_##op(int i, atomic_t *v) \
70{ \
71 unsigned long flags; \
72 \
73 raw_local_irq_save(flags); \
74 v->counter = v->counter c_op i; \
75 raw_local_irq_restore(flags); \
76}
77
78#define ATOMIC_OP_RETURN(op, c_op) \
79static inline int atomic_##op##_return(int i, atomic_t *v) \
80{ \
81 unsigned long flags; \
82 int ret; \
83 \
84 raw_local_irq_save(flags); \
85 ret = (v->counter = v->counter c_op i); \
86 raw_local_irq_restore(flags); \
87 \
88 return ret; \
89}
90
91#endif /* CONFIG_SMP */
92
93#ifndef atomic_add_return
94ATOMIC_OP_RETURN(add, +)
95#endif
96
97#ifndef atomic_sub_return
98ATOMIC_OP_RETURN(sub, -)
99#endif
100
101#ifndef atomic_clear_mask
102ATOMIC_OP(and, &)
103#define atomic_clear_mask(i, v) atomic_and(~(i), (v))
27#endif 104#endif
28 105
106#ifndef atomic_set_mask
107#define CONFIG_ARCH_HAS_ATOMIC_OR
108ATOMIC_OP(or, |)
109#define atomic_set_mask(i, v) atomic_or((i), (v))
110#endif
111
112#undef ATOMIC_OP_RETURN
113#undef ATOMIC_OP
114
29/* 115/*
30 * Atomic operations that C can't guarantee us. Useful for 116 * Atomic operations that C can't guarantee us. Useful for
31 * resource counting etc.. 117 * resource counting etc..
@@ -33,8 +119,6 @@
33 119
34#define ATOMIC_INIT(i) { (i) } 120#define ATOMIC_INIT(i) { (i) }
35 121
36#ifdef __KERNEL__
37
38/** 122/**
39 * atomic_read - read atomic variable 123 * atomic_read - read atomic variable
40 * @v: pointer of type atomic_t 124 * @v: pointer of type atomic_t
@@ -42,7 +126,7 @@
42 * Atomically reads the value of @v. 126 * Atomically reads the value of @v.
43 */ 127 */
44#ifndef atomic_read 128#ifndef atomic_read
45#define atomic_read(v) (*(volatile int *)&(v)->counter) 129#define atomic_read(v) ACCESS_ONCE((v)->counter)
46#endif 130#endif
47 131
48/** 132/**
@@ -56,52 +140,6 @@
56 140
57#include <linux/irqflags.h> 141#include <linux/irqflags.h>
58 142
59/**
60 * atomic_add_return - add integer to atomic variable
61 * @i: integer value to add
62 * @v: pointer of type atomic_t
63 *
64 * Atomically adds @i to @v and returns the result
65 */
66#ifndef atomic_add_return
67static inline int atomic_add_return(int i, atomic_t *v)
68{
69 unsigned long flags;
70 int temp;
71
72 raw_local_irq_save(flags); /* Don't trace it in an irqsoff handler */
73 temp = v->counter;
74 temp += i;
75 v->counter = temp;
76 raw_local_irq_restore(flags);
77
78 return temp;
79}
80#endif
81
82/**
83 * atomic_sub_return - subtract integer from atomic variable
84 * @i: integer value to subtract
85 * @v: pointer of type atomic_t
86 *
87 * Atomically subtracts @i from @v and returns the result
88 */
89#ifndef atomic_sub_return
90static inline int atomic_sub_return(int i, atomic_t *v)
91{
92 unsigned long flags;
93 int temp;
94
95 raw_local_irq_save(flags); /* Don't trace it in an irqsoff handler */
96 temp = v->counter;
97 temp -= i;
98 v->counter = temp;
99 raw_local_irq_restore(flags);
100
101 return temp;
102}
103#endif
104
105static inline int atomic_add_negative(int i, atomic_t *v) 143static inline int atomic_add_negative(int i, atomic_t *v)
106{ 144{
107 return atomic_add_return(i, v) < 0; 145 return atomic_add_return(i, v) < 0;
@@ -139,49 +177,11 @@ static inline void atomic_dec(atomic_t *v)
139 177
140static inline int __atomic_add_unless(atomic_t *v, int a, int u) 178static inline int __atomic_add_unless(atomic_t *v, int a, int u)
141{ 179{
142 int c, old; 180 int c, old;
143 c = atomic_read(v); 181 c = atomic_read(v);
144 while (c != u && (old = atomic_cmpxchg(v, c, c + a)) != c) 182 while (c != u && (old = atomic_cmpxchg(v, c, c + a)) != c)
145 c = old; 183 c = old;
146 return c; 184 return c;
147}
148
149/**
150 * atomic_clear_mask - Atomically clear bits in atomic variable
151 * @mask: Mask of the bits to be cleared
152 * @v: pointer of type atomic_t
153 *
154 * Atomically clears the bits set in @mask from @v
155 */
156#ifndef atomic_clear_mask
157static inline void atomic_clear_mask(unsigned long mask, atomic_t *v)
158{
159 unsigned long flags;
160
161 mask = ~mask;
162 raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
163 v->counter &= mask;
164 raw_local_irq_restore(flags);
165} 185}
166#endif
167
168/**
169 * atomic_set_mask - Atomically set bits in atomic variable
170 * @mask: Mask of the bits to be set
171 * @v: pointer of type atomic_t
172 *
173 * Atomically sets the bits set in @mask in @v
174 */
175#ifndef atomic_set_mask
176static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
177{
178 unsigned long flags;
179
180 raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
181 v->counter |= mask;
182 raw_local_irq_restore(flags);
183}
184#endif
185 186
186#endif /* __KERNEL__ */
187#endif /* __ASM_GENERIC_ATOMIC_H */ 187#endif /* __ASM_GENERIC_ATOMIC_H */
diff --git a/include/asm-generic/atomic64.h b/include/asm-generic/atomic64.h
index b18ce4f9ee3d..30ad9c86cebb 100644
--- a/include/asm-generic/atomic64.h
+++ b/include/asm-generic/atomic64.h
@@ -20,10 +20,22 @@ typedef struct {
20 20
21extern long long atomic64_read(const atomic64_t *v); 21extern long long atomic64_read(const atomic64_t *v);
22extern void atomic64_set(atomic64_t *v, long long i); 22extern void atomic64_set(atomic64_t *v, long long i);
23extern void atomic64_add(long long a, atomic64_t *v); 23
24extern long long atomic64_add_return(long long a, atomic64_t *v); 24#define ATOMIC64_OP(op) \
25extern void atomic64_sub(long long a, atomic64_t *v); 25extern void atomic64_##op(long long a, atomic64_t *v);
26extern long long atomic64_sub_return(long long a, atomic64_t *v); 26
27#define ATOMIC64_OP_RETURN(op) \
28extern long long atomic64_##op##_return(long long a, atomic64_t *v);
29
30#define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_OP_RETURN(op)
31
32ATOMIC64_OPS(add)
33ATOMIC64_OPS(sub)
34
35#undef ATOMIC64_OPS
36#undef ATOMIC64_OP_RETURN
37#undef ATOMIC64_OP
38
27extern long long atomic64_dec_if_positive(atomic64_t *v); 39extern long long atomic64_dec_if_positive(atomic64_t *v);
28extern long long atomic64_cmpxchg(atomic64_t *v, long long o, long long n); 40extern long long atomic64_cmpxchg(atomic64_t *v, long long o, long long n);
29extern long long atomic64_xchg(atomic64_t *v, long long new); 41extern long long atomic64_xchg(atomic64_t *v, long long new);
diff --git a/include/asm-generic/clkdev.h b/include/asm-generic/clkdev.h
index 90a32a61dd21..4ff334749ed5 100644
--- a/include/asm-generic/clkdev.h
+++ b/include/asm-generic/clkdev.h
@@ -15,10 +15,12 @@
15 15
16#include <linux/slab.h> 16#include <linux/slab.h>
17 17
18#ifndef CONFIG_COMMON_CLK
18struct clk; 19struct clk;
19 20
20static inline int __clk_get(struct clk *clk) { return 1; } 21static inline int __clk_get(struct clk *clk) { return 1; }
21static inline void __clk_put(struct clk *clk) { } 22static inline void __clk_put(struct clk *clk) { }
23#endif
22 24
23static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size) 25static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
24{ 26{
diff --git a/include/asm-generic/cputime_jiffies.h b/include/asm-generic/cputime_jiffies.h
index d5cb78f53986..fe386fc6e85e 100644
--- a/include/asm-generic/cputime_jiffies.h
+++ b/include/asm-generic/cputime_jiffies.h
@@ -3,6 +3,8 @@
3 3
4typedef unsigned long __nocast cputime_t; 4typedef unsigned long __nocast cputime_t;
5 5
6#define cmpxchg_cputime(ptr, old, new) cmpxchg(ptr, old, new)
7
6#define cputime_one_jiffy jiffies_to_cputime(1) 8#define cputime_one_jiffy jiffies_to_cputime(1)
7#define cputime_to_jiffies(__ct) (__force unsigned long)(__ct) 9#define cputime_to_jiffies(__ct) (__force unsigned long)(__ct)
8#define cputime_to_scaled(__ct) (__ct) 10#define cputime_to_scaled(__ct) (__ct)
diff --git a/include/asm-generic/cputime_nsecs.h b/include/asm-generic/cputime_nsecs.h
index 4e817606c549..0419485891f2 100644
--- a/include/asm-generic/cputime_nsecs.h
+++ b/include/asm-generic/cputime_nsecs.h
@@ -21,6 +21,8 @@
21typedef u64 __nocast cputime_t; 21typedef u64 __nocast cputime_t;
22typedef u64 __nocast cputime64_t; 22typedef u64 __nocast cputime64_t;
23 23
24#define cmpxchg_cputime(ptr, old, new) cmpxchg64(ptr, old, new)
25
24#define cputime_one_jiffy jiffies_to_cputime(1) 26#define cputime_one_jiffy jiffies_to_cputime(1)
25 27
26#define cputime_div(__ct, divisor) div_u64((__force u64)__ct, divisor) 28#define cputime_div(__ct, divisor) div_u64((__force u64)__ct, divisor)
diff --git a/include/asm-generic/dma-contiguous.h b/include/asm-generic/dma-contiguous.h
new file mode 100644
index 000000000000..292c571750f0
--- /dev/null
+++ b/include/asm-generic/dma-contiguous.h
@@ -0,0 +1,9 @@
1#ifndef _ASM_GENERIC_DMA_CONTIGUOUS_H
2#define _ASM_GENERIC_DMA_CONTIGUOUS_H
3
4#include <linux/types.h>
5
6static inline void
7dma_contiguous_early_fixup(phys_addr_t base, unsigned long size) { }
8
9#endif
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
index de8bf89940f8..3378dcf4c31e 100644
--- a/include/asm-generic/dma-mapping-common.h
+++ b/include/asm-generic/dma-mapping-common.h
@@ -179,6 +179,15 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
179extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, 179extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
180 void *cpu_addr, dma_addr_t dma_addr, size_t size); 180 void *cpu_addr, dma_addr_t dma_addr, size_t size);
181 181
182void *dma_common_contiguous_remap(struct page *page, size_t size,
183 unsigned long vm_flags,
184 pgprot_t prot, const void *caller);
185
186void *dma_common_pages_remap(struct page **pages, size_t size,
187 unsigned long vm_flags, pgprot_t prot,
188 const void *caller);
189void dma_common_free_remap(void *cpu_addr, size_t size, unsigned long vm_flags);
190
182/** 191/**
183 * dma_mmap_attrs - map a coherent DMA allocation into user space 192 * dma_mmap_attrs - map a coherent DMA allocation into user space
184 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices 193 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
@@ -205,14 +214,6 @@ dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void *cpu_addr,
205 214
206#define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL) 215#define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL)
207 216
208static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
209 void *cpu_addr, dma_addr_t dma_addr, size_t size)
210{
211 DEFINE_DMA_ATTRS(attrs);
212 dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
213 return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
214}
215
216int 217int
217dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, 218dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
218 void *cpu_addr, dma_addr_t dma_addr, size_t size); 219 void *cpu_addr, dma_addr_t dma_addr, size_t size);
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 23e364538ab5..383ade1a211b 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -27,7 +27,7 @@
27 */ 27 */
28 28
29#ifndef ARCH_NR_GPIOS 29#ifndef ARCH_NR_GPIOS
30#define ARCH_NR_GPIOS 256 30#define ARCH_NR_GPIOS 512
31#endif 31#endif
32 32
33/* 33/*
@@ -110,9 +110,6 @@ static inline int __gpio_to_irq(unsigned gpio)
110 return gpiod_to_irq(gpio_to_desc(gpio)); 110 return gpiod_to_irq(gpio_to_desc(gpio));
111} 111}
112 112
113extern int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
114extern void gpio_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
115
116extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label); 113extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
117extern int gpio_request_array(const struct gpio *array, size_t num); 114extern int gpio_request_array(const struct gpio *array, size_t num);
118extern void gpio_free_array(const struct gpio *array, size_t num); 115extern void gpio_free_array(const struct gpio *array, size_t num);
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 975e1cc75edb..b8fdc57a7335 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -331,7 +331,7 @@ static inline void iounmap(void __iomem *addr)
331#ifndef CONFIG_GENERIC_IOMAP 331#ifndef CONFIG_GENERIC_IOMAP
332static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) 332static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
333{ 333{
334 return (void __iomem *) port; 334 return PCI_IOBASE + (port & IO_SPACE_LIMIT);
335} 335}
336 336
337static inline void ioport_unmap(void __iomem *p) 337static inline void ioport_unmap(void __iomem *p)
diff --git a/include/asm-generic/irq_work.h b/include/asm-generic/irq_work.h
new file mode 100644
index 000000000000..a44f452c6590
--- /dev/null
+++ b/include/asm-generic/irq_work.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_IRQ_WORK_H
2#define __ASM_IRQ_WORK_H
3
4static inline bool arch_irq_work_has_interrupt(void)
5{
6 return false;
7}
8
9#endif /* __ASM_IRQ_WORK_H */
10
diff --git a/include/asm-generic/pci-dma-compat.h b/include/asm-generic/pci-dma-compat.h
index 1437b7da09b2..c110843fc53b 100644
--- a/include/asm-generic/pci-dma-compat.h
+++ b/include/asm-generic/pci-dma-compat.h
@@ -19,6 +19,14 @@ pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
19 return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC); 19 return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC);
20} 20}
21 21
22static inline void *
23pci_zalloc_consistent(struct pci_dev *hwdev, size_t size,
24 dma_addr_t *dma_handle)
25{
26 return dma_zalloc_coherent(hwdev == NULL ? NULL : &hwdev->dev,
27 size, dma_handle, GFP_ATOMIC);
28}
29
22static inline void 30static inline void
23pci_free_consistent(struct pci_dev *hwdev, size_t size, 31pci_free_consistent(struct pci_dev *hwdev, size_t size,
24 void *vaddr, dma_addr_t dma_handle) 32 void *vaddr, dma_addr_t dma_handle)
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 53b2acc38213..752e30d63904 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -249,6 +249,24 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
249#define pgprot_writecombine pgprot_noncached 249#define pgprot_writecombine pgprot_noncached
250#endif 250#endif
251 251
252#ifndef pgprot_device
253#define pgprot_device pgprot_noncached
254#endif
255
256#ifndef pgprot_modify
257#define pgprot_modify pgprot_modify
258static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
259{
260 if (pgprot_val(oldprot) == pgprot_val(pgprot_noncached(oldprot)))
261 newprot = pgprot_noncached(newprot);
262 if (pgprot_val(oldprot) == pgprot_val(pgprot_writecombine(oldprot)))
263 newprot = pgprot_writecombine(newprot);
264 if (pgprot_val(oldprot) == pgprot_val(pgprot_device(oldprot)))
265 newprot = pgprot_device(newprot);
266 return newprot;
267}
268#endif
269
252/* 270/*
253 * When walking page tables, get the address of the next boundary, 271 * When walking page tables, get the address of the next boundary,
254 * or the end address of the range if that comes earlier. Although no 272 * or the end address of the range if that comes earlier. Although no
@@ -660,11 +678,12 @@ static inline int pmd_trans_unstable(pmd_t *pmd)
660} 678}
661 679
662#ifdef CONFIG_NUMA_BALANCING 680#ifdef CONFIG_NUMA_BALANCING
663#ifdef CONFIG_ARCH_USES_NUMA_PROT_NONE
664/* 681/*
665 * _PAGE_NUMA works identical to _PAGE_PROTNONE (it's actually the 682 * _PAGE_NUMA distinguishes between an unmapped page table entry, an entry that
666 * same bit too). It's set only when _PAGE_PRESET is not set and it's 683 * is protected for PROT_NONE and a NUMA hinting fault entry. If the
667 * never set if _PAGE_PRESENT is set. 684 * architecture defines __PAGE_PROTNONE then it should take that into account
685 * but those that do not can rely on the fact that the NUMA hinting scanner
686 * skips inaccessible VMAs.
668 * 687 *
669 * pte/pmd_present() returns true if pte/pmd_numa returns true. Page 688 * pte/pmd_present() returns true if pte/pmd_numa returns true. Page
670 * fault triggers on those regions if pte/pmd_numa returns true 689 * fault triggers on those regions if pte/pmd_numa returns true
@@ -673,16 +692,14 @@ static inline int pmd_trans_unstable(pmd_t *pmd)
673#ifndef pte_numa 692#ifndef pte_numa
674static inline int pte_numa(pte_t pte) 693static inline int pte_numa(pte_t pte)
675{ 694{
676 return (pte_flags(pte) & 695 return ptenuma_flags(pte) == _PAGE_NUMA;
677 (_PAGE_NUMA|_PAGE_PROTNONE|_PAGE_PRESENT)) == _PAGE_NUMA;
678} 696}
679#endif 697#endif
680 698
681#ifndef pmd_numa 699#ifndef pmd_numa
682static inline int pmd_numa(pmd_t pmd) 700static inline int pmd_numa(pmd_t pmd)
683{ 701{
684 return (pmd_flags(pmd) & 702 return pmdnuma_flags(pmd) == _PAGE_NUMA;
685 (_PAGE_NUMA|_PAGE_PROTNONE|_PAGE_PRESENT)) == _PAGE_NUMA;
686} 703}
687#endif 704#endif
688 705
@@ -722,6 +739,8 @@ static inline pte_t pte_mknuma(pte_t pte)
722{ 739{
723 pteval_t val = pte_val(pte); 740 pteval_t val = pte_val(pte);
724 741
742 VM_BUG_ON(!(val & _PAGE_PRESENT));
743
725 val &= ~_PAGE_PRESENT; 744 val &= ~_PAGE_PRESENT;
726 val |= _PAGE_NUMA; 745 val |= _PAGE_NUMA;
727 746
@@ -765,16 +784,6 @@ static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr,
765} 784}
766#endif 785#endif
767#else 786#else
768extern int pte_numa(pte_t pte);
769extern int pmd_numa(pmd_t pmd);
770extern pte_t pte_mknonnuma(pte_t pte);
771extern pmd_t pmd_mknonnuma(pmd_t pmd);
772extern pte_t pte_mknuma(pte_t pte);
773extern pmd_t pmd_mknuma(pmd_t pmd);
774extern void ptep_set_numa(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
775extern void pmdp_set_numa(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp);
776#endif /* CONFIG_ARCH_USES_NUMA_PROT_NONE */
777#else
778static inline int pmd_numa(pmd_t pmd) 787static inline int pmd_numa(pmd_t pmd)
779{ 788{
780 return 0; 789 return 0;
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index f1a24b5c3b90..b58fd667f87b 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -3,6 +3,8 @@
3 3
4/* References to section boundaries */ 4/* References to section boundaries */
5 5
6#include <linux/compiler.h>
7
6/* 8/*
7 * Usage guidelines: 9 * Usage guidelines:
8 * _text, _data: architecture specific, don't use them in arch-independent code 10 * _text, _data: architecture specific, don't use them in arch-independent code
@@ -37,6 +39,8 @@ extern char __start_rodata[], __end_rodata[];
37/* Start and end of .ctors section - used for constructor calls. */ 39/* Start and end of .ctors section - used for constructor calls. */
38extern char __ctors_start[], __ctors_end[]; 40extern char __ctors_start[], __ctors_end[];
39 41
42extern __visible const void __nosave_begin, __nosave_end;
43
40/* function descriptor handling (if any). Override 44/* function descriptor handling (if any). Override
41 * in asm/sections.h */ 45 * in asm/sections.h */
42#ifndef dereference_function_descriptor 46#ifndef dereference_function_descriptor
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
index d401e5463fb0..0c938a4354f6 100644
--- a/include/asm-generic/syscall.h
+++ b/include/asm-generic/syscall.h
@@ -147,7 +147,7 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
147 * 147 *
148 * Returns the AUDIT_ARCH_* based on the system call convention in use. 148 * Returns the AUDIT_ARCH_* based on the system call convention in use.
149 * 149 *
150 * It's only valid to call this when @task is stopped on entry to a system 150 * It's only valid to call this when current is stopped on entry to a system
151 * call, due to %TIF_SYSCALL_TRACE, %TIF_SYSCALL_AUDIT, or %TIF_SECCOMP. 151 * call, due to %TIF_SYSCALL_TRACE, %TIF_SYSCALL_AUDIT, or %TIF_SECCOMP.
152 * 152 *
153 * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must 153 * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 5ba0360663a7..aa70cbda327c 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -40,6 +40,8 @@
40 * } 40 * }
41 * 41 *
42 * [__init_begin, __init_end] is the init section that may be freed after init 42 * [__init_begin, __init_end] is the init section that may be freed after init
43 * // __init_begin and __init_end should be page aligned, so that we can
44 * // free the whole .init memory
43 * [_stext, _etext] is the text section 45 * [_stext, _etext] is the text section
44 * [_sdata, _edata] is the data section 46 * [_sdata, _edata] is the data section
45 * 47 *
diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h
index 831d786976c5..5186f750c713 100644
--- a/include/crypto/drbg.h
+++ b/include/crypto/drbg.h
@@ -82,15 +82,6 @@ typedef uint32_t drbg_flag_t;
82struct drbg_core { 82struct drbg_core {
83 drbg_flag_t flags; /* flags for the cipher */ 83 drbg_flag_t flags; /* flags for the cipher */
84 __u8 statelen; /* maximum state length */ 84 __u8 statelen; /* maximum state length */
85 /*
86 * maximum length of personalization string or additional input
87 * string -- exponent for base 2
88 */
89 __u8 max_addtllen;
90 /* maximum bits per RNG request -- exponent for base 2*/
91 __u8 max_bits;
92 /* maximum number of requests -- exponent for base 2 */
93 __u8 max_req;
94 __u8 blocklen_bytes; /* block size of output in bytes */ 85 __u8 blocklen_bytes; /* block size of output in bytes */
95 char cra_name[CRYPTO_MAX_ALG_NAME]; /* mapping to kernel crypto API */ 86 char cra_name[CRYPTO_MAX_ALG_NAME]; /* mapping to kernel crypto API */
96 /* kernel crypto API backend cipher name */ 87 /* kernel crypto API backend cipher name */
@@ -156,18 +147,33 @@ static inline __u8 drbg_keylen(struct drbg_state *drbg)
156 147
157static inline size_t drbg_max_request_bytes(struct drbg_state *drbg) 148static inline size_t drbg_max_request_bytes(struct drbg_state *drbg)
158{ 149{
159 /* max_bits is in bits, but buflen is in bytes */ 150 /* SP800-90A requires the limit 2**19 bits, but we return bytes */
160 return (1 << (drbg->core->max_bits - 3)); 151 return (1 << 16);
161} 152}
162 153
163static inline size_t drbg_max_addtl(struct drbg_state *drbg) 154static inline size_t drbg_max_addtl(struct drbg_state *drbg)
164{ 155{
165 return (1UL<<(drbg->core->max_addtllen)); 156 /* SP800-90A requires 2**35 bytes additional info str / pers str */
157#if (__BITS_PER_LONG == 32)
158 /*
159 * SP800-90A allows smaller maximum numbers to be returned -- we
160 * return SIZE_MAX - 1 to allow the verification of the enforcement
161 * of this value in drbg_healthcheck_sanity.
162 */
163 return (SIZE_MAX - 1);
164#else
165 return (1UL<<35);
166#endif
166} 167}
167 168
168static inline size_t drbg_max_requests(struct drbg_state *drbg) 169static inline size_t drbg_max_requests(struct drbg_state *drbg)
169{ 170{
170 return (1UL<<(drbg->core->max_req)); 171 /* SP800-90A requires 2**48 maximum requests before reseeding */
172#if (__BITS_PER_LONG == 32)
173 return SIZE_MAX;
174#else
175 return (1UL<<48);
176#endif
171} 177}
172 178
173/* 179/*
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index a39195539601..74b13ec1ebd4 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -58,6 +58,11 @@ struct shash_desc {
58 void *__ctx[] CRYPTO_MINALIGN_ATTR; 58 void *__ctx[] CRYPTO_MINALIGN_ATTR;
59}; 59};
60 60
61#define SHASH_DESC_ON_STACK(shash, ctx) \
62 char __##shash##_desc[sizeof(struct shash_desc) + \
63 crypto_shash_descsize(ctx)] CRYPTO_MINALIGN_ATTR; \
64 struct shash_desc *shash = (struct shash_desc *)__##shash##_desc
65
61struct shash_alg { 66struct shash_alg {
62 int (*init)(struct shash_desc *desc); 67 int (*init)(struct shash_desc *desc);
63 int (*update)(struct shash_desc *desc, const u8 *data, 68 int (*update)(struct shash_desc *desc, const u8 *data,
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h
index 9b6f32a6cad1..3b4af1d7c7e9 100644
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -117,6 +117,15 @@ int shash_ahash_update(struct ahash_request *req, struct shash_desc *desc);
117int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc); 117int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc);
118int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc); 118int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc);
119 119
120int shash_ahash_mcryptd_update(struct ahash_request *req,
121 struct shash_desc *desc);
122int shash_ahash_mcryptd_final(struct ahash_request *req,
123 struct shash_desc *desc);
124int shash_ahash_mcryptd_finup(struct ahash_request *req,
125 struct shash_desc *desc);
126int shash_ahash_mcryptd_digest(struct ahash_request *req,
127 struct shash_desc *desc);
128
120int crypto_init_shash_ops_async(struct crypto_tfm *tfm); 129int crypto_init_shash_ops_async(struct crypto_tfm *tfm);
121 130
122static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm) 131static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm)
diff --git a/include/crypto/mcryptd.h b/include/crypto/mcryptd.h
new file mode 100644
index 000000000000..c23ee1f7ee80
--- /dev/null
+++ b/include/crypto/mcryptd.h
@@ -0,0 +1,112 @@
1/*
2 * Software async multibuffer crypto daemon headers
3 *
4 * Author:
5 * Tim Chen <tim.c.chen@linux.intel.com>
6 *
7 * Copyright (c) 2014, Intel Corporation.
8 */
9
10#ifndef _CRYPTO_MCRYPT_H
11#define _CRYPTO_MCRYPT_H
12
13#include <linux/crypto.h>
14#include <linux/kernel.h>
15#include <crypto/hash.h>
16
17struct mcryptd_ahash {
18 struct crypto_ahash base;
19};
20
21static inline struct mcryptd_ahash *__mcryptd_ahash_cast(
22 struct crypto_ahash *tfm)
23{
24 return (struct mcryptd_ahash *)tfm;
25}
26
27struct mcryptd_cpu_queue {
28 struct crypto_queue queue;
29 struct work_struct work;
30};
31
32struct mcryptd_queue {
33 struct mcryptd_cpu_queue __percpu *cpu_queue;
34};
35
36struct mcryptd_instance_ctx {
37 struct crypto_spawn spawn;
38 struct mcryptd_queue *queue;
39};
40
41struct mcryptd_hash_ctx {
42 struct crypto_shash *child;
43 struct mcryptd_alg_state *alg_state;
44};
45
46struct mcryptd_tag {
47 /* seq number of request */
48 unsigned seq_num;
49 /* arrival time of request */
50 unsigned long arrival;
51 unsigned long expire;
52 int cpu;
53};
54
55struct mcryptd_hash_request_ctx {
56 struct list_head waiter;
57 crypto_completion_t complete;
58 struct mcryptd_tag tag;
59 struct crypto_hash_walk walk;
60 u8 *out;
61 int flag;
62 struct shash_desc desc;
63};
64
65struct mcryptd_ahash *mcryptd_alloc_ahash(const char *alg_name,
66 u32 type, u32 mask);
67struct crypto_shash *mcryptd_ahash_child(struct mcryptd_ahash *tfm);
68struct shash_desc *mcryptd_shash_desc(struct ahash_request *req);
69void mcryptd_free_ahash(struct mcryptd_ahash *tfm);
70void mcryptd_flusher(struct work_struct *work);
71
72enum mcryptd_req_type {
73 MCRYPTD_NONE,
74 MCRYPTD_UPDATE,
75 MCRYPTD_FINUP,
76 MCRYPTD_DIGEST,
77 MCRYPTD_FINAL
78};
79
80struct mcryptd_alg_cstate {
81 unsigned long next_flush;
82 unsigned next_seq_num;
83 bool flusher_engaged;
84 struct delayed_work flush;
85 int cpu;
86 struct mcryptd_alg_state *alg_state;
87 void *mgr;
88 spinlock_t work_lock;
89 struct list_head work_list;
90 struct list_head flush_list;
91};
92
93struct mcryptd_alg_state {
94 struct mcryptd_alg_cstate __percpu *alg_cstate;
95 unsigned long (*flusher)(struct mcryptd_alg_cstate *cstate);
96};
97
98/* return delay in jiffies from current time */
99static inline unsigned long get_delay(unsigned long t)
100{
101 long delay;
102
103 delay = (long) t - (long) jiffies;
104 if (delay <= 0)
105 return 0;
106 else
107 return (unsigned long) delay;
108}
109
110void mcryptd_arm_flusher(struct mcryptd_alg_cstate *cstate, unsigned long delay);
111
112#endif
diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
index 0d164c6af539..54add2069901 100644
--- a/include/crypto/public_key.h
+++ b/include/crypto/public_key.h
@@ -15,6 +15,7 @@
15#define _LINUX_PUBLIC_KEY_H 15#define _LINUX_PUBLIC_KEY_H
16 16
17#include <linux/mpi.h> 17#include <linux/mpi.h>
18#include <keys/asymmetric-type.h>
18#include <crypto/hash_info.h> 19#include <crypto/hash_info.h>
19 20
20enum pkey_algo { 21enum pkey_algo {
@@ -98,8 +99,9 @@ struct key;
98extern int verify_signature(const struct key *key, 99extern int verify_signature(const struct key *key,
99 const struct public_key_signature *sig); 100 const struct public_key_signature *sig);
100 101
102struct asymmetric_key_id;
101extern struct key *x509_request_asymmetric_key(struct key *keyring, 103extern struct key *x509_request_asymmetric_key(struct key *keyring,
102 const char *issuer, 104 const struct asymmetric_key_id *kid,
103 const char *key_id); 105 bool partial);
104 106
105#endif /* _LINUX_PUBLIC_KEY_H */ 107#endif /* _LINUX_PUBLIC_KEY_H */
diff --git a/include/drm/ati_pcigart.h b/include/drm/ati_pcigart.h
new file mode 100644
index 000000000000..5765648b5ef7
--- /dev/null
+++ b/include/drm/ati_pcigart.h
@@ -0,0 +1,30 @@
1#ifndef DRM_ATI_PCIGART_H
2#define DRM_ATI_PCIGART_H
3
4#include <drm/drm_legacy.h>
5
6/* location of GART table */
7#define DRM_ATI_GART_MAIN 1
8#define DRM_ATI_GART_FB 2
9
10#define DRM_ATI_GART_PCI 1
11#define DRM_ATI_GART_PCIE 2
12#define DRM_ATI_GART_IGP 3
13
14struct drm_ati_pcigart_info {
15 int gart_table_location;
16 int gart_reg_if;
17 void *addr;
18 dma_addr_t bus_addr;
19 dma_addr_t table_mask;
20 struct drm_dma_handle *table_handle;
21 struct drm_local_map mapping;
22 int table_size;
23};
24
25extern int drm_ati_pcigart_init(struct drm_device *dev,
26 struct drm_ati_pcigart_info * gart_info);
27extern int drm_ati_pcigart_cleanup(struct drm_device *dev,
28 struct drm_ati_pcigart_info * gart_info);
29
30#endif
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e41f17ea1f13..53ed87698a74 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1,17 +1,14 @@
1/**
2 * \file drmP.h
3 * Private header for Direct Rendering Manager
4 *
5 * \author Rickard E. (Rik) Faith <faith@valinux.com>
6 * \author Gareth Hughes <gareth@valinux.com>
7 */
8
9/* 1/*
2 * Internal Header for the Direct Rendering Manager
3 *
10 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 4 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
11 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
12 * Copyright (c) 2009-2010, Code Aurora Forum. 6 * Copyright (c) 2009-2010, Code Aurora Forum.
13 * All rights reserved. 7 * All rights reserved.
14 * 8 *
9 * Author: Rickard E. (Rik) Faith <faith@valinux.com>
10 * Author: Gareth Hughes <gareth@valinux.com>
11 *
15 * Permission is hereby granted, free of charge, to any person obtaining a 12 * Permission is hereby granted, free of charge, to any person obtaining a
16 * copy of this software and associated documentation files (the "Software"), 13 * copy of this software and associated documentation files (the "Software"),
17 * to deal in the Software without restriction, including without limitation 14 * to deal in the Software without restriction, including without limitation
@@ -35,59 +32,62 @@
35#ifndef _DRM_P_H_ 32#ifndef _DRM_P_H_
36#define _DRM_P_H_ 33#define _DRM_P_H_
37 34
38#ifdef __KERNEL__ 35#include <linux/agp_backend.h>
39#ifdef __alpha__ 36#include <linux/cdev.h>
40/* add include of current.h so that "current" is defined 37#include <linux/dma-mapping.h>
41 * before static inline funcs in wait.h. Doing this so we 38#include <linux/file.h>
42 * can build the DRM (part of PI DRI). 4/21/2000 S + B */
43#include <asm/current.h>
44#endif /* __alpha__ */
45#include <linux/kernel.h>
46#include <linux/kref.h>
47#include <linux/miscdevice.h>
48#include <linux/fs.h> 39#include <linux/fs.h>
40#include <linux/highmem.h>
41#include <linux/idr.h>
49#include <linux/init.h> 42#include <linux/init.h>
50#include <linux/file.h> 43#include <linux/io.h>
51#include <linux/platform_device.h>
52#include <linux/pci.h>
53#include <linux/jiffies.h> 44#include <linux/jiffies.h>
54#include <linux/dma-mapping.h> 45#include <linux/kernel.h>
46#include <linux/kref.h>
47#include <linux/miscdevice.h>
55#include <linux/mm.h> 48#include <linux/mm.h>
56#include <linux/cdev.h>
57#include <linux/mutex.h> 49#include <linux/mutex.h>
58#include <linux/io.h> 50#include <linux/pci.h>
59#include <linux/slab.h> 51#include <linux/platform_device.h>
52#include <linux/poll.h>
60#include <linux/ratelimit.h> 53#include <linux/ratelimit.h>
61#if defined(__alpha__) || defined(__powerpc__) 54#include <linux/sched.h>
62#include <asm/pgtable.h> /* For pte_wrprotect */ 55#include <linux/slab.h>
63#endif
64#include <asm/mman.h>
65#include <asm/uaccess.h>
66#include <linux/types.h> 56#include <linux/types.h>
67#include <linux/agp_backend.h> 57#include <linux/vmalloc.h>
68#include <linux/workqueue.h> 58#include <linux/workqueue.h>
69#include <linux/poll.h> 59
60#include <asm/mman.h>
70#include <asm/pgalloc.h> 61#include <asm/pgalloc.h>
71#include <drm/drm.h> 62#include <asm/uaccess.h>
72#include <drm/drm_sarea.h>
73#include <drm/drm_vma_manager.h>
74 63
75#include <linux/idr.h> 64#include <uapi/drm/drm.h>
65#include <uapi/drm/drm_mode.h>
76 66
77#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) 67#include <drm/drm_agpsupport.h>
68#include <drm/drm_crtc.h>
69#include <drm/drm_global.h>
70#include <drm/drm_hashtab.h>
71#include <drm/drm_mem_util.h>
72#include <drm/drm_mm.h>
73#include <drm/drm_os_linux.h>
74#include <drm/drm_sarea.h>
75#include <drm/drm_vma_manager.h>
78 76
79struct module; 77struct module;
80 78
81struct drm_file; 79struct drm_file;
82struct drm_device; 80struct drm_device;
81struct drm_agp_head;
82struct drm_local_map;
83struct drm_device_dma;
84struct drm_dma_handle;
85struct drm_gem_object;
83 86
84struct device_node; 87struct device_node;
85struct videomode; 88struct videomode;
86struct reservation_object; 89struct reservation_object;
87 90struct dma_buf_attachment;
88#include <drm/drm_os_linux.h>
89#include <drm/drm_hashtab.h>
90#include <drm/drm_mm.h>
91 91
92/* 92/*
93 * 4 debug categories are defined: 93 * 4 debug categories are defined:
@@ -126,7 +126,7 @@ extern __printf(2, 3)
126void drm_ut_debug_printk(const char *function_name, 126void drm_ut_debug_printk(const char *function_name,
127 const char *format, ...); 127 const char *format, ...);
128extern __printf(2, 3) 128extern __printf(2, 3)
129int drm_err(const char *func, const char *format, ...); 129void drm_err(const char *func, const char *format, ...);
130 130
131/***********************************************************************/ 131/***********************************************************************/
132/** \name DRM template customization defaults */ 132/** \name DRM template customization defaults */
@@ -145,21 +145,6 @@ int drm_err(const char *func, const char *format, ...);
145#define DRIVER_RENDER 0x8000 145#define DRIVER_RENDER 0x8000
146 146
147/***********************************************************************/ 147/***********************************************************************/
148/** \name Begin the DRM... */
149/*@{*/
150
151#define DRM_DEBUG_CODE 2 /**< Include debugging code if > 1, then
152 also include looping detection. */
153
154#define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */
155#define DRM_KERNEL_CONTEXT 0 /**< Change drm_resctx if changed */
156#define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */
157
158#define DRM_MAP_HASH_OFFSET 0x10000000
159
160/*@}*/
161
162/***********************************************************************/
163/** \name Macros to make printk easier */ 148/** \name Macros to make printk easier */
164/*@{*/ 149/*@{*/
165 150
@@ -200,7 +185,6 @@ int drm_err(const char *func, const char *format, ...);
200 * \param fmt printf() like format string. 185 * \param fmt printf() like format string.
201 * \param arg arguments 186 * \param arg arguments
202 */ 187 */
203#if DRM_DEBUG_CODE
204#define DRM_DEBUG(fmt, args...) \ 188#define DRM_DEBUG(fmt, args...) \
205 do { \ 189 do { \
206 if (unlikely(drm_debug & DRM_UT_CORE)) \ 190 if (unlikely(drm_debug & DRM_UT_CORE)) \
@@ -222,12 +206,6 @@ int drm_err(const char *func, const char *format, ...);
222 if (unlikely(drm_debug & DRM_UT_PRIME)) \ 206 if (unlikely(drm_debug & DRM_UT_PRIME)) \
223 drm_ut_debug_printk(__func__, fmt, ##args); \ 207 drm_ut_debug_printk(__func__, fmt, ##args); \
224 } while (0) 208 } while (0)
225#else
226#define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0)
227#define DRM_DEBUG_KMS(fmt, args...) do { } while (0)
228#define DRM_DEBUG_PRIME(fmt, args...) do { } while (0)
229#define DRM_DEBUG(fmt, arg...) do { } while (0)
230#endif
231 209
232/*@}*/ 210/*@}*/
233 211
@@ -238,23 +216,6 @@ int drm_err(const char *func, const char *format, ...);
238#define DRM_IF_VERSION(maj, min) (maj << 16 | min) 216#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
239 217
240/** 218/**
241 * Test that the hardware lock is held by the caller, returning otherwise.
242 *
243 * \param dev DRM device.
244 * \param filp file pointer of the caller.
245 */
246#define LOCK_TEST_WITH_RETURN( dev, _file_priv ) \
247do { \
248 if (!_DRM_LOCK_IS_HELD(_file_priv->master->lock.hw_lock->lock) || \
249 _file_priv->master->lock.file_priv != _file_priv) { \
250 DRM_ERROR( "%s called without lock held, held %d owner %p %p\n",\
251 __func__, _DRM_LOCK_IS_HELD(_file_priv->master->lock.hw_lock->lock),\
252 _file_priv->master->lock.file_priv, _file_priv); \
253 return -EINVAL; \
254 } \
255} while (0)
256
257/**
258 * Ioctl function type. 219 * Ioctl function type.
259 * 220 *
260 * \param inode device inode. 221 * \param inode device inode.
@@ -294,91 +255,6 @@ struct drm_ioctl_desc {
294#define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \ 255#define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \
295 [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl} 256 [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl}
296 257
297struct drm_magic_entry {
298 struct list_head head;
299 struct drm_hash_item hash_item;
300 struct drm_file *priv;
301};
302
303struct drm_vma_entry {
304 struct list_head head;
305 struct vm_area_struct *vma;
306 pid_t pid;
307};
308
309/**
310 * DMA buffer.
311 */
312struct drm_buf {
313 int idx; /**< Index into master buflist */
314 int total; /**< Buffer size */
315 int order; /**< log-base-2(total) */
316 int used; /**< Amount of buffer in use (for DMA) */
317 unsigned long offset; /**< Byte offset (used internally) */
318 void *address; /**< Address of buffer */
319 unsigned long bus_address; /**< Bus address of buffer */
320 struct drm_buf *next; /**< Kernel-only: used for free list */
321 __volatile__ int waiting; /**< On kernel DMA queue */
322 __volatile__ int pending; /**< On hardware DMA queue */
323 struct drm_file *file_priv; /**< Private of holding file descr */
324 int context; /**< Kernel queue for this buffer */
325 int while_locked; /**< Dispatch this buffer while locked */
326 enum {
327 DRM_LIST_NONE = 0,
328 DRM_LIST_FREE = 1,
329 DRM_LIST_WAIT = 2,
330 DRM_LIST_PEND = 3,
331 DRM_LIST_PRIO = 4,
332 DRM_LIST_RECLAIM = 5
333 } list; /**< Which list we're on */
334
335 int dev_priv_size; /**< Size of buffer private storage */
336 void *dev_private; /**< Per-buffer private storage */
337};
338
339/** bufs is one longer than it has to be */
340struct drm_waitlist {
341 int count; /**< Number of possible buffers */
342 struct drm_buf **bufs; /**< List of pointers to buffers */
343 struct drm_buf **rp; /**< Read pointer */
344 struct drm_buf **wp; /**< Write pointer */
345 struct drm_buf **end; /**< End pointer */
346 spinlock_t read_lock;
347 spinlock_t write_lock;
348};
349
350struct drm_freelist {
351 int initialized; /**< Freelist in use */
352 atomic_t count; /**< Number of free buffers */
353 struct drm_buf *next; /**< End pointer */
354
355 wait_queue_head_t waiting; /**< Processes waiting on free bufs */
356 int low_mark; /**< Low water mark */
357 int high_mark; /**< High water mark */
358 atomic_t wfh; /**< If waiting for high mark */
359 spinlock_t lock;
360};
361
362typedef struct drm_dma_handle {
363 dma_addr_t busaddr;
364 void *vaddr;
365 size_t size;
366} drm_dma_handle_t;
367
368/**
369 * Buffer entry. There is one of this for each buffer size order.
370 */
371struct drm_buf_entry {
372 int buf_size; /**< size */
373 int buf_count; /**< number of buffers */
374 struct drm_buf *buflist; /**< buffer list */
375 int seg_count;
376 int page_order;
377 struct drm_dma_handle **seglist;
378
379 struct drm_freelist freelist;
380};
381
382/* Event queued up for userspace to read */ 258/* Event queued up for userspace to read */
383struct drm_pending_event { 259struct drm_pending_event {
384 struct drm_event *event; 260 struct drm_event *event;
@@ -397,7 +273,6 @@ struct drm_prime_file_private {
397 273
398/** File private data */ 274/** File private data */
399struct drm_file { 275struct drm_file {
400 unsigned always_authenticated :1;
401 unsigned authenticated :1; 276 unsigned authenticated :1;
402 /* Whether we're master for a minor. Protected by master_mutex */ 277 /* Whether we're master for a minor. Protected by master_mutex */
403 unsigned is_master :1; 278 unsigned is_master :1;
@@ -442,23 +317,6 @@ struct drm_file {
442 struct drm_prime_file_private prime; 317 struct drm_prime_file_private prime;
443}; 318};
444 319
445/** Wait queue */
446struct drm_queue {
447 atomic_t use_count; /**< Outstanding uses (+1) */
448 atomic_t finalization; /**< Finalization in progress */
449 atomic_t block_count; /**< Count of processes waiting */
450 atomic_t block_read; /**< Queue blocked for reads */
451 wait_queue_head_t read_queue; /**< Processes waiting on block_read */
452 atomic_t block_write; /**< Queue blocked for writes */
453 wait_queue_head_t write_queue; /**< Processes waiting on block_write */
454 atomic_t total_queued; /**< Total queued statistic */
455 atomic_t total_flushed; /**< Total flushes statistic */
456 atomic_t total_locks; /**< Total locks statistics */
457 enum drm_ctx_flags flags; /**< Context preserving and 2D-only */
458 struct drm_waitlist waitlist; /**< Pending buffers */
459 wait_queue_head_t flush_queue; /**< Processes waiting until flush */
460};
461
462/** 320/**
463 * Lock data. 321 * Lock data.
464 */ 322 */
@@ -475,223 +333,12 @@ struct drm_lock_data {
475}; 333};
476 334
477/** 335/**
478 * DMA data.
479 */
480struct drm_device_dma {
481
482 struct drm_buf_entry bufs[DRM_MAX_ORDER + 1]; /**< buffers, grouped by their size order */
483 int buf_count; /**< total number of buffers */
484 struct drm_buf **buflist; /**< Vector of pointers into drm_device_dma::bufs */
485 int seg_count;
486 int page_count; /**< number of pages */
487 unsigned long *pagelist; /**< page list */
488 unsigned long byte_count;
489 enum {
490 _DRM_DMA_USE_AGP = 0x01,
491 _DRM_DMA_USE_SG = 0x02,
492 _DRM_DMA_USE_FB = 0x04,
493 _DRM_DMA_USE_PCI_RO = 0x08
494 } flags;
495
496};
497
498/**
499 * AGP memory entry. Stored as a doubly linked list.
500 */
501struct drm_agp_mem {
502 unsigned long handle; /**< handle */
503 struct agp_memory *memory;
504 unsigned long bound; /**< address */
505 int pages;
506 struct list_head head;
507};
508
509/**
510 * AGP data.
511 *
512 * \sa drm_agp_init() and drm_device::agp.
513 */
514struct drm_agp_head {
515 struct agp_kern_info agp_info; /**< AGP device information */
516 struct list_head memory;
517 unsigned long mode; /**< AGP mode */
518 struct agp_bridge_data *bridge;
519 int enabled; /**< whether the AGP bus as been enabled */
520 int acquired; /**< whether the AGP device has been acquired */
521 unsigned long base;
522 int agp_mtrr;
523 int cant_use_aperture;
524 unsigned long page_mask;
525};
526
527/**
528 * Scatter-gather memory.
529 */
530struct drm_sg_mem {
531 unsigned long handle;
532 void *virtual;
533 int pages;
534 struct page **pagelist;
535 dma_addr_t *busaddr;
536};
537
538struct drm_sigdata {
539 int context;
540 struct drm_hw_lock *lock;
541};
542
543
544/**
545 * Kernel side of a mapping
546 */
547struct drm_local_map {
548 resource_size_t offset; /**< Requested physical address (0 for SAREA)*/
549 unsigned long size; /**< Requested physical size (bytes) */
550 enum drm_map_type type; /**< Type of memory to map */
551 enum drm_map_flags flags; /**< Flags */
552 void *handle; /**< User-space: "Handle" to pass to mmap() */
553 /**< Kernel-space: kernel-virtual address */
554 int mtrr; /**< MTRR slot used */
555};
556
557typedef struct drm_local_map drm_local_map_t;
558
559/**
560 * Mappings list
561 */
562struct drm_map_list {
563 struct list_head head; /**< list head */
564 struct drm_hash_item hash;
565 struct drm_local_map *map; /**< mapping */
566 uint64_t user_token;
567 struct drm_master *master;
568};
569
570/**
571 * Context handle list
572 */
573struct drm_ctx_list {
574 struct list_head head; /**< list head */
575 drm_context_t handle; /**< context handle */
576 struct drm_file *tag; /**< associated fd private data */
577};
578
579/* location of GART table */
580#define DRM_ATI_GART_MAIN 1
581#define DRM_ATI_GART_FB 2
582
583#define DRM_ATI_GART_PCI 1
584#define DRM_ATI_GART_PCIE 2
585#define DRM_ATI_GART_IGP 3
586
587struct drm_ati_pcigart_info {
588 int gart_table_location;
589 int gart_reg_if;
590 void *addr;
591 dma_addr_t bus_addr;
592 dma_addr_t table_mask;
593 struct drm_dma_handle *table_handle;
594 struct drm_local_map mapping;
595 int table_size;
596};
597
598/**
599 * This structure defines the drm_mm memory object, which will be used by the
600 * DRM for its buffer objects.
601 */
602struct drm_gem_object {
603 /** Reference count of this object */
604 struct kref refcount;
605
606 /**
607 * handle_count - gem file_priv handle count of this object
608 *
609 * Each handle also holds a reference. Note that when the handle_count
610 * drops to 0 any global names (e.g. the id in the flink namespace) will
611 * be cleared.
612 *
613 * Protected by dev->object_name_lock.
614 * */
615 unsigned handle_count;
616
617 /** Related drm device */
618 struct drm_device *dev;
619
620 /** File representing the shmem storage */
621 struct file *filp;
622
623 /* Mapping info for this object */
624 struct drm_vma_offset_node vma_node;
625
626 /**
627 * Size of the object, in bytes. Immutable over the object's
628 * lifetime.
629 */
630 size_t size;
631
632 /**
633 * Global name for this object, starts at 1. 0 means unnamed.
634 * Access is covered by the object_name_lock in the related drm_device
635 */
636 int name;
637
638 /**
639 * Memory domains. These monitor which caches contain read/write data
640 * related to the object. When transitioning from one set of domains
641 * to another, the driver is called to ensure that caches are suitably
642 * flushed and invalidated
643 */
644 uint32_t read_domains;
645 uint32_t write_domain;
646
647 /**
648 * While validating an exec operation, the
649 * new read/write domain values are computed here.
650 * They will be transferred to the above values
651 * at the point that any cache flushing occurs
652 */
653 uint32_t pending_read_domains;
654 uint32_t pending_write_domain;
655
656 /**
657 * dma_buf - dma buf associated with this GEM object
658 *
659 * Pointer to the dma-buf associated with this gem object (either
660 * through importing or exporting). We break the resulting reference
661 * loop when the last gem handle for this object is released.
662 *
663 * Protected by obj->object_name_lock
664 */
665 struct dma_buf *dma_buf;
666
667 /**
668 * import_attach - dma buf attachment backing this object
669 *
670 * Any foreign dma_buf imported as a gem object has this set to the
671 * attachment point for the device. This is invariant over the lifetime
672 * of a gem object.
673 *
674 * The driver's ->gem_free_object callback is responsible for cleaning
675 * up the dma_buf attachment and references acquired at import time.
676 *
677 * Note that the drm gem/prime core does not depend upon drivers setting
678 * this field any more. So for drivers where this doesn't make sense
679 * (e.g. virtual devices or a displaylink behind an usb bus) they can
680 * simply leave it as NULL.
681 */
682 struct dma_buf_attachment *import_attach;
683};
684
685#include <drm/drm_crtc.h>
686
687/**
688 * struct drm_master - drm master structure 336 * struct drm_master - drm master structure
689 * 337 *
690 * @refcount: Refcount for this master object. 338 * @refcount: Refcount for this master object.
691 * @minor: Link back to minor char device we are master for. Immutable. 339 * @minor: Link back to minor char device we are master for. Immutable.
692 * @unique: Unique identifier: e.g. busid. Protected by drm_global_mutex. 340 * @unique: Unique identifier: e.g. busid. Protected by drm_global_mutex.
693 * @unique_len: Length of unique field. Protected by drm_global_mutex. 341 * @unique_len: Length of unique field. Protected by drm_global_mutex.
694 * @unique_size: Amount allocated. Protected by drm_global_mutex.
695 * @magiclist: Hash of used authentication tokens. Protected by struct_mutex. 342 * @magiclist: Hash of used authentication tokens. Protected by struct_mutex.
696 * @magicfree: List of used authentication tokens. Protected by struct_mutex. 343 * @magicfree: List of used authentication tokens. Protected by struct_mutex.
697 * @lock: DRI lock information. 344 * @lock: DRI lock information.
@@ -702,7 +349,6 @@ struct drm_master {
702 struct drm_minor *minor; 349 struct drm_minor *minor;
703 char *unique; 350 char *unique;
704 int unique_len; 351 int unique_len;
705 int unique_size;
706 struct drm_open_hash magiclist; 352 struct drm_open_hash magiclist;
707 struct list_head magicfree; 353 struct list_head magicfree;
708 struct drm_lock_data lock; 354 struct drm_lock_data lock;
@@ -717,17 +363,13 @@ struct drm_master {
717/* Flags and return codes for get_vblank_timestamp() driver function. */ 363/* Flags and return codes for get_vblank_timestamp() driver function. */
718#define DRM_CALLED_FROM_VBLIRQ 1 364#define DRM_CALLED_FROM_VBLIRQ 1
719#define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0) 365#define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0)
720#define DRM_VBLANKTIME_INVBL (1 << 1) 366#define DRM_VBLANKTIME_IN_VBLANK (1 << 1)
721 367
722/* get_scanout_position() return flags */ 368/* get_scanout_position() return flags */
723#define DRM_SCANOUTPOS_VALID (1 << 0) 369#define DRM_SCANOUTPOS_VALID (1 << 0)
724#define DRM_SCANOUTPOS_INVBL (1 << 1) 370#define DRM_SCANOUTPOS_IN_VBLANK (1 << 1)
725#define DRM_SCANOUTPOS_ACCURATE (1 << 2) 371#define DRM_SCANOUTPOS_ACCURATE (1 << 2)
726 372
727struct drm_bus {
728 int (*set_busid)(struct drm_device *dev, struct drm_master *master);
729};
730
731/** 373/**
732 * DRM driver structure. This structure represent the common code for 374 * DRM driver structure. This structure represent the common code for
733 * a family of cards. There will one drm_device for each card present 375 * a family of cards. There will one drm_device for each card present
@@ -746,6 +388,7 @@ struct drm_driver {
746 int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); 388 int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
747 int (*dma_quiescent) (struct drm_device *); 389 int (*dma_quiescent) (struct drm_device *);
748 int (*context_dtor) (struct drm_device *dev, int context); 390 int (*context_dtor) (struct drm_device *dev, int context);
391 int (*set_busid)(struct drm_device *dev, struct drm_master *master);
749 392
750 /** 393 /**
751 * get_vblank_counter - get raw hardware vblank counter 394 * get_vblank_counter - get raw hardware vblank counter
@@ -928,7 +571,8 @@ struct drm_driver {
928 struct drm_gem_object *obj); 571 struct drm_gem_object *obj);
929 struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj); 572 struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj);
930 struct drm_gem_object *(*gem_prime_import_sg_table)( 573 struct drm_gem_object *(*gem_prime_import_sg_table)(
931 struct drm_device *dev, size_t size, 574 struct drm_device *dev,
575 struct dma_buf_attachment *attach,
932 struct sg_table *sgt); 576 struct sg_table *sgt);
933 void *(*gem_prime_vmap)(struct drm_gem_object *obj); 577 void *(*gem_prime_vmap)(struct drm_gem_object *obj);
934 void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr); 578 void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr);
@@ -964,7 +608,6 @@ struct drm_driver {
964 const struct drm_ioctl_desc *ioctls; 608 const struct drm_ioctl_desc *ioctls;
965 int num_ioctls; 609 int num_ioctls;
966 const struct file_operations *fops; 610 const struct file_operations *fops;
967 struct drm_bus *bus;
968 611
969 /* List of devices hanging off this driver with stealth attach. */ 612 /* List of devices hanging off this driver with stealth attach. */
970 struct list_head legacy_dev_list; 613 struct list_head legacy_dev_list;
@@ -1119,6 +762,16 @@ struct drm_device {
1119 */ 762 */
1120 bool vblank_disable_allowed; 763 bool vblank_disable_allowed;
1121 764
765 /*
766 * If true, vblank interrupt will be disabled immediately when the
767 * refcount drops to zero, as opposed to via the vblank disable
768 * timer.
769 * This can be set to true it the hardware has a working vblank
770 * counter and the driver uses drm_vblank_on() and drm_vblank_off()
771 * appropriately.
772 */
773 bool vblank_disable_immediate;
774
1122 /* array of size num_crtcs */ 775 /* array of size num_crtcs */
1123 struct drm_vblank_crtc *vblank; 776 struct drm_vblank_crtc *vblank;
1124 777
@@ -1143,13 +796,16 @@ struct drm_device {
1143#endif 796#endif
1144 797
1145 struct platform_device *platformdev; /**< Platform device struture */ 798 struct platform_device *platformdev; /**< Platform device struture */
1146 struct usb_device *usbdev;
1147 799
1148 struct drm_sg_mem *sg; /**< Scatter gather memory */ 800 struct drm_sg_mem *sg; /**< Scatter gather memory */
1149 unsigned int num_crtcs; /**< Number of CRTCs on this device */ 801 unsigned int num_crtcs; /**< Number of CRTCs on this device */
1150 struct drm_sigdata sigdata; /**< For block_all_signals */
1151 sigset_t sigmask; 802 sigset_t sigmask;
1152 803
804 struct {
805 int context;
806 struct drm_hw_lock *lock;
807 } sigdata;
808
1153 struct drm_local_map *agp_buffer_map; 809 struct drm_local_map *agp_buffer_map;
1154 unsigned int agp_buffer_token; 810 unsigned int agp_buffer_token;
1155 811
@@ -1212,136 +868,32 @@ extern long drm_ioctl(struct file *filp,
1212 unsigned int cmd, unsigned long arg); 868 unsigned int cmd, unsigned long arg);
1213extern long drm_compat_ioctl(struct file *filp, 869extern long drm_compat_ioctl(struct file *filp,
1214 unsigned int cmd, unsigned long arg); 870 unsigned int cmd, unsigned long arg);
1215extern int drm_lastclose(struct drm_device *dev);
1216extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags); 871extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags);
1217 872
1218 /* Device support (drm_fops.h) */ 873 /* Device support (drm_fops.h) */
1219extern struct mutex drm_global_mutex;
1220extern int drm_open(struct inode *inode, struct file *filp); 874extern int drm_open(struct inode *inode, struct file *filp);
1221extern int drm_stub_open(struct inode *inode, struct file *filp);
1222extern ssize_t drm_read(struct file *filp, char __user *buffer, 875extern ssize_t drm_read(struct file *filp, char __user *buffer,
1223 size_t count, loff_t *offset); 876 size_t count, loff_t *offset);
1224extern int drm_release(struct inode *inode, struct file *filp); 877extern int drm_release(struct inode *inode, struct file *filp);
1225 878
1226 /* Mapping support (drm_vm.h) */ 879 /* Mapping support (drm_vm.h) */
1227extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
1228extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma);
1229extern void drm_vm_open_locked(struct drm_device *dev, struct vm_area_struct *vma);
1230extern void drm_vm_close_locked(struct drm_device *dev, struct vm_area_struct *vma);
1231extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); 880extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1232 881
1233 /* Memory management support (drm_memory.h) */ 882/* Misc. IOCTL support (drm_ioctl.c) */
1234#include <drm/drm_memory.h> 883int drm_noop(struct drm_device *dev, void *data,
1235 884 struct drm_file *file_priv);
1236
1237 /* Misc. IOCTL support (drm_ioctl.h) */
1238extern int drm_irq_by_busid(struct drm_device *dev, void *data,
1239 struct drm_file *file_priv);
1240extern int drm_getunique(struct drm_device *dev, void *data,
1241 struct drm_file *file_priv);
1242extern int drm_setunique(struct drm_device *dev, void *data,
1243 struct drm_file *file_priv);
1244extern int drm_getmap(struct drm_device *dev, void *data,
1245 struct drm_file *file_priv);
1246extern int drm_getclient(struct drm_device *dev, void *data,
1247 struct drm_file *file_priv);
1248extern int drm_getstats(struct drm_device *dev, void *data,
1249 struct drm_file *file_priv);
1250extern int drm_getcap(struct drm_device *dev, void *data,
1251 struct drm_file *file_priv);
1252extern int drm_setclientcap(struct drm_device *dev, void *data,
1253 struct drm_file *file_priv);
1254extern int drm_setversion(struct drm_device *dev, void *data,
1255 struct drm_file *file_priv);
1256extern int drm_noop(struct drm_device *dev, void *data,
1257 struct drm_file *file_priv);
1258
1259 /* Context IOCTL support (drm_context.h) */
1260extern int drm_resctx(struct drm_device *dev, void *data,
1261 struct drm_file *file_priv);
1262extern int drm_addctx(struct drm_device *dev, void *data,
1263 struct drm_file *file_priv);
1264extern int drm_getctx(struct drm_device *dev, void *data,
1265 struct drm_file *file_priv);
1266extern int drm_switchctx(struct drm_device *dev, void *data,
1267 struct drm_file *file_priv);
1268extern int drm_newctx(struct drm_device *dev, void *data,
1269 struct drm_file *file_priv);
1270extern int drm_rmctx(struct drm_device *dev, void *data,
1271 struct drm_file *file_priv);
1272
1273extern int drm_ctxbitmap_init(struct drm_device *dev);
1274extern void drm_ctxbitmap_cleanup(struct drm_device *dev);
1275extern void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
1276
1277extern int drm_setsareactx(struct drm_device *dev, void *data,
1278 struct drm_file *file_priv);
1279extern int drm_getsareactx(struct drm_device *dev, void *data,
1280 struct drm_file *file_priv);
1281
1282 /* Authentication IOCTL support (drm_auth.h) */
1283extern int drm_getmagic(struct drm_device *dev, void *data,
1284 struct drm_file *file_priv);
1285extern int drm_authmagic(struct drm_device *dev, void *data,
1286 struct drm_file *file_priv);
1287extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic);
1288 885
1289/* Cache management (drm_cache.c) */ 886/* Cache management (drm_cache.c) */
1290void drm_clflush_pages(struct page *pages[], unsigned long num_pages); 887void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
1291void drm_clflush_sg(struct sg_table *st); 888void drm_clflush_sg(struct sg_table *st);
1292void drm_clflush_virt_range(void *addr, unsigned long length); 889void drm_clflush_virt_range(void *addr, unsigned long length);
1293 890
1294 /* Locking IOCTL support (drm_lock.h) */
1295extern int drm_lock(struct drm_device *dev, void *data,
1296 struct drm_file *file_priv);
1297extern int drm_unlock(struct drm_device *dev, void *data,
1298 struct drm_file *file_priv);
1299extern int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context);
1300extern void drm_idlelock_take(struct drm_lock_data *lock_data);
1301extern void drm_idlelock_release(struct drm_lock_data *lock_data);
1302
1303/* 891/*
1304 * These are exported to drivers so that they can implement fencing using 892 * These are exported to drivers so that they can implement fencing using
1305 * DMA quiscent + idle. DMA quiescent usually requires the hardware lock. 893 * DMA quiscent + idle. DMA quiescent usually requires the hardware lock.
1306 */ 894 */
1307 895
1308extern int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv);
1309
1310 /* Buffer management support (drm_bufs.h) */
1311extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request);
1312extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request);
1313extern int drm_addmap(struct drm_device *dev, resource_size_t offset,
1314 unsigned int size, enum drm_map_type type,
1315 enum drm_map_flags flags, struct drm_local_map **map_ptr);
1316extern int drm_addmap_ioctl(struct drm_device *dev, void *data,
1317 struct drm_file *file_priv);
1318extern int drm_rmmap(struct drm_device *dev, struct drm_local_map *map);
1319extern int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map);
1320extern int drm_rmmap_ioctl(struct drm_device *dev, void *data,
1321 struct drm_file *file_priv);
1322extern int drm_addbufs(struct drm_device *dev, void *data,
1323 struct drm_file *file_priv);
1324extern int drm_infobufs(struct drm_device *dev, void *data,
1325 struct drm_file *file_priv);
1326extern int drm_markbufs(struct drm_device *dev, void *data,
1327 struct drm_file *file_priv);
1328extern int drm_freebufs(struct drm_device *dev, void *data,
1329 struct drm_file *file_priv);
1330extern int drm_mapbufs(struct drm_device *dev, void *data,
1331 struct drm_file *file_priv);
1332extern int drm_dma_ioctl(struct drm_device *dev, void *data,
1333 struct drm_file *file_priv);
1334
1335 /* DMA support (drm_dma.h) */
1336extern int drm_legacy_dma_setup(struct drm_device *dev);
1337extern void drm_legacy_dma_takedown(struct drm_device *dev);
1338extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf);
1339extern void drm_core_reclaim_buffers(struct drm_device *dev,
1340 struct drm_file *filp);
1341
1342 /* IRQ support (drm_irq.h) */ 896 /* IRQ support (drm_irq.h) */
1343extern int drm_control(struct drm_device *dev, void *data,
1344 struct drm_file *file_priv);
1345extern int drm_irq_install(struct drm_device *dev, int irq); 897extern int drm_irq_install(struct drm_device *dev, int irq);
1346extern int drm_irq_uninstall(struct drm_device *dev); 898extern int drm_irq_uninstall(struct drm_device *dev);
1347 899
@@ -1358,14 +910,14 @@ extern int drm_vblank_get(struct drm_device *dev, int crtc);
1358extern void drm_vblank_put(struct drm_device *dev, int crtc); 910extern void drm_vblank_put(struct drm_device *dev, int crtc);
1359extern int drm_crtc_vblank_get(struct drm_crtc *crtc); 911extern int drm_crtc_vblank_get(struct drm_crtc *crtc);
1360extern void drm_crtc_vblank_put(struct drm_crtc *crtc); 912extern void drm_crtc_vblank_put(struct drm_crtc *crtc);
913extern void drm_wait_one_vblank(struct drm_device *dev, int crtc);
914extern void drm_crtc_wait_one_vblank(struct drm_crtc *crtc);
1361extern void drm_vblank_off(struct drm_device *dev, int crtc); 915extern void drm_vblank_off(struct drm_device *dev, int crtc);
1362extern void drm_vblank_on(struct drm_device *dev, int crtc); 916extern void drm_vblank_on(struct drm_device *dev, int crtc);
1363extern void drm_crtc_vblank_off(struct drm_crtc *crtc); 917extern void drm_crtc_vblank_off(struct drm_crtc *crtc);
1364extern void drm_crtc_vblank_on(struct drm_crtc *crtc); 918extern void drm_crtc_vblank_on(struct drm_crtc *crtc);
1365extern void drm_vblank_cleanup(struct drm_device *dev); 919extern void drm_vblank_cleanup(struct drm_device *dev);
1366 920
1367extern u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,
1368 struct timeval *tvblank, unsigned flags);
1369extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, 921extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
1370 int crtc, int *max_error, 922 int crtc, int *max_error,
1371 struct timeval *vblank_time, 923 struct timeval *vblank_time,
@@ -1375,60 +927,38 @@ extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
1375extern void drm_calc_timestamping_constants(struct drm_crtc *crtc, 927extern void drm_calc_timestamping_constants(struct drm_crtc *crtc,
1376 const struct drm_display_mode *mode); 928 const struct drm_display_mode *mode);
1377 929
930/**
931 * drm_crtc_vblank_waitqueue - get vblank waitqueue for the CRTC
932 * @crtc: which CRTC's vblank waitqueue to retrieve
933 *
934 * This function returns a pointer to the vblank waitqueue for the CRTC.
935 * Drivers can use this to implement vblank waits using wait_event() & co.
936 */
937static inline wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc)
938{
939 return &crtc->dev->vblank[drm_crtc_index(crtc)].queue;
940}
1378 941
1379/* Modesetting support */ 942/* Modesetting support */
1380extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); 943extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
1381extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); 944extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc);
1382extern int drm_modeset_ctl(struct drm_device *dev, void *data,
1383 struct drm_file *file_priv);
1384
1385 /* AGP/GART support (drm_agpsupport.h) */
1386
1387#include <drm/drm_agpsupport.h>
1388 945
1389 /* Stub support (drm_stub.h) */ 946 /* Stub support (drm_stub.h) */
1390extern int drm_setmaster_ioctl(struct drm_device *dev, void *data,
1391 struct drm_file *file_priv);
1392extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
1393 struct drm_file *file_priv);
1394struct drm_master *drm_master_create(struct drm_minor *minor);
1395extern struct drm_master *drm_master_get(struct drm_master *master); 947extern struct drm_master *drm_master_get(struct drm_master *master);
1396extern void drm_master_put(struct drm_master **master); 948extern void drm_master_put(struct drm_master **master);
1397 949
1398extern void drm_put_dev(struct drm_device *dev); 950extern void drm_put_dev(struct drm_device *dev);
1399extern void drm_unplug_dev(struct drm_device *dev); 951extern void drm_unplug_dev(struct drm_device *dev);
1400extern unsigned int drm_debug; 952extern unsigned int drm_debug;
1401extern unsigned int drm_rnodes;
1402extern unsigned int drm_universal_planes;
1403
1404extern unsigned int drm_vblank_offdelay;
1405extern unsigned int drm_timestamp_precision;
1406extern unsigned int drm_timestamp_monotonic;
1407
1408extern struct class *drm_class;
1409extern struct dentry *drm_debugfs_root;
1410
1411extern struct idr drm_minors_idr;
1412
1413extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
1414 953
1415 /* Debugfs support */ 954 /* Debugfs support */
1416#if defined(CONFIG_DEBUG_FS) 955#if defined(CONFIG_DEBUG_FS)
1417extern int drm_debugfs_init(struct drm_minor *minor, int minor_id,
1418 struct dentry *root);
1419extern int drm_debugfs_create_files(const struct drm_info_list *files, 956extern int drm_debugfs_create_files(const struct drm_info_list *files,
1420 int count, struct dentry *root, 957 int count, struct dentry *root,
1421 struct drm_minor *minor); 958 struct drm_minor *minor);
1422extern int drm_debugfs_remove_files(const struct drm_info_list *files, 959extern int drm_debugfs_remove_files(const struct drm_info_list *files,
1423 int count, struct drm_minor *minor); 960 int count, struct drm_minor *minor);
1424extern int drm_debugfs_cleanup(struct drm_minor *minor);
1425#else 961#else
1426static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id,
1427 struct dentry *root)
1428{
1429 return 0;
1430}
1431
1432static inline int drm_debugfs_create_files(const struct drm_info_list *files, 962static inline int drm_debugfs_create_files(const struct drm_info_list *files,
1433 int count, struct dentry *root, 963 int count, struct dentry *root,
1434 struct drm_minor *minor) 964 struct drm_minor *minor)
@@ -1441,22 +971,8 @@ static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
1441{ 971{
1442 return 0; 972 return 0;
1443} 973}
1444
1445static inline int drm_debugfs_cleanup(struct drm_minor *minor)
1446{
1447 return 0;
1448}
1449#endif 974#endif
1450 975
1451 /* Info file support */
1452extern int drm_name_info(struct seq_file *m, void *data);
1453extern int drm_vm_info(struct seq_file *m, void *data);
1454extern int drm_bufs_info(struct seq_file *m, void *data);
1455extern int drm_vblank_info(struct seq_file *m, void *data);
1456extern int drm_clients_info(struct seq_file *m, void* data);
1457extern int drm_gem_name_info(struct seq_file *m, void *data);
1458
1459
1460extern struct dma_buf *drm_gem_prime_export(struct drm_device *dev, 976extern struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
1461 struct drm_gem_object *obj, int flags); 977 struct drm_gem_object *obj, int flags);
1462extern int drm_gem_prime_handle_to_fd(struct drm_device *dev, 978extern int drm_gem_prime_handle_to_fd(struct drm_device *dev,
@@ -1468,151 +984,20 @@ extern int drm_gem_prime_fd_to_handle(struct drm_device *dev,
1468 struct drm_file *file_priv, int prime_fd, uint32_t *handle); 984 struct drm_file *file_priv, int prime_fd, uint32_t *handle);
1469extern void drm_gem_dmabuf_release(struct dma_buf *dma_buf); 985extern void drm_gem_dmabuf_release(struct dma_buf *dma_buf);
1470 986
1471extern int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
1472 struct drm_file *file_priv);
1473extern int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
1474 struct drm_file *file_priv);
1475
1476extern int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages, 987extern int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
1477 dma_addr_t *addrs, int max_pages); 988 dma_addr_t *addrs, int max_pages);
1478extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages); 989extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages);
1479extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg); 990extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg);
1480 991
1481int drm_gem_dumb_destroy(struct drm_file *file,
1482 struct drm_device *dev,
1483 uint32_t handle);
1484 992
1485void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv); 993extern struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size,
1486void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv); 994 size_t align);
1487void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf); 995extern void drm_pci_free(struct drm_device *dev, struct drm_dma_handle * dmah);
1488
1489#if DRM_DEBUG_CODE
1490extern int drm_vma_info(struct seq_file *m, void *data);
1491#endif
1492
1493 /* Scatter Gather Support (drm_scatter.h) */
1494extern void drm_legacy_sg_cleanup(struct drm_device *dev);
1495extern int drm_sg_alloc(struct drm_device *dev, void *data,
1496 struct drm_file *file_priv);
1497extern int drm_sg_free(struct drm_device *dev, void *data,
1498 struct drm_file *file_priv);
1499
1500 /* ATI PCIGART support (ati_pcigart.h) */
1501extern int drm_ati_pcigart_init(struct drm_device *dev,
1502 struct drm_ati_pcigart_info * gart_info);
1503extern int drm_ati_pcigart_cleanup(struct drm_device *dev,
1504 struct drm_ati_pcigart_info * gart_info);
1505
1506extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
1507 size_t align);
1508extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
1509extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
1510extern int drm_pci_set_unique(struct drm_device *dev,
1511 struct drm_master *master,
1512 struct drm_unique *u);
1513 996
1514 /* sysfs support (drm_sysfs.c) */ 997 /* sysfs support (drm_sysfs.c) */
1515struct drm_sysfs_class;
1516extern struct class *drm_sysfs_create(struct module *owner, char *name);
1517extern void drm_sysfs_destroy(void);
1518extern int drm_sysfs_device_add(struct drm_minor *minor);
1519extern void drm_sysfs_hotplug_event(struct drm_device *dev); 998extern void drm_sysfs_hotplug_event(struct drm_device *dev);
1520extern void drm_sysfs_device_remove(struct drm_minor *minor);
1521extern int drm_sysfs_connector_add(struct drm_connector *connector);
1522extern void drm_sysfs_connector_remove(struct drm_connector *connector);
1523
1524/* Graphics Execution Manager library functions (drm_gem.c) */
1525int drm_gem_init(struct drm_device *dev);
1526void drm_gem_destroy(struct drm_device *dev);
1527void drm_gem_object_release(struct drm_gem_object *obj);
1528void drm_gem_object_free(struct kref *kref);
1529int drm_gem_object_init(struct drm_device *dev,
1530 struct drm_gem_object *obj, size_t size);
1531void drm_gem_private_object_init(struct drm_device *dev,
1532 struct drm_gem_object *obj, size_t size);
1533void drm_gem_vm_open(struct vm_area_struct *vma);
1534void drm_gem_vm_close(struct vm_area_struct *vma);
1535int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
1536 struct vm_area_struct *vma);
1537int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
1538
1539#include <drm/drm_global.h>
1540
1541static inline void
1542drm_gem_object_reference(struct drm_gem_object *obj)
1543{
1544 kref_get(&obj->refcount);
1545}
1546
1547static inline void
1548drm_gem_object_unreference(struct drm_gem_object *obj)
1549{
1550 if (obj != NULL)
1551 kref_put(&obj->refcount, drm_gem_object_free);
1552}
1553
1554static inline void
1555drm_gem_object_unreference_unlocked(struct drm_gem_object *obj)
1556{
1557 if (obj && !atomic_add_unless(&obj->refcount.refcount, -1, 1)) {
1558 struct drm_device *dev = obj->dev;
1559
1560 mutex_lock(&dev->struct_mutex);
1561 if (likely(atomic_dec_and_test(&obj->refcount.refcount)))
1562 drm_gem_object_free(&obj->refcount);
1563 mutex_unlock(&dev->struct_mutex);
1564 }
1565}
1566
1567int drm_gem_handle_create_tail(struct drm_file *file_priv,
1568 struct drm_gem_object *obj,
1569 u32 *handlep);
1570int drm_gem_handle_create(struct drm_file *file_priv,
1571 struct drm_gem_object *obj,
1572 u32 *handlep);
1573int drm_gem_handle_delete(struct drm_file *filp, u32 handle);
1574 999
1575 1000
1576void drm_gem_free_mmap_offset(struct drm_gem_object *obj);
1577int drm_gem_create_mmap_offset(struct drm_gem_object *obj);
1578int drm_gem_create_mmap_offset_size(struct drm_gem_object *obj, size_t size);
1579
1580struct page **drm_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask);
1581void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages,
1582 bool dirty, bool accessed);
1583
1584struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev,
1585 struct drm_file *filp,
1586 u32 handle);
1587int drm_gem_close_ioctl(struct drm_device *dev, void *data,
1588 struct drm_file *file_priv);
1589int drm_gem_flink_ioctl(struct drm_device *dev, void *data,
1590 struct drm_file *file_priv);
1591int drm_gem_open_ioctl(struct drm_device *dev, void *data,
1592 struct drm_file *file_priv);
1593void drm_gem_open(struct drm_device *dev, struct drm_file *file_private);
1594void drm_gem_release(struct drm_device *dev, struct drm_file *file_private);
1595
1596extern void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev);
1597extern void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev);
1598extern void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev);
1599
1600static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1601 unsigned int token)
1602{
1603 struct drm_map_list *_entry;
1604 list_for_each_entry(_entry, &dev->maplist, head)
1605 if (_entry->user_token == token)
1606 return _entry->map;
1607 return NULL;
1608}
1609
1610static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1611{
1612}
1613
1614#include <drm/drm_mem_util.h>
1615
1616struct drm_device *drm_dev_alloc(struct drm_driver *driver, 1001struct drm_device *drm_dev_alloc(struct drm_driver *driver,
1617 struct device *parent); 1002 struct device *parent);
1618void drm_dev_ref(struct drm_device *dev); 1003void drm_dev_ref(struct drm_device *dev);
@@ -1646,6 +1031,7 @@ extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
1646extern int drm_get_pci_dev(struct pci_dev *pdev, 1031extern int drm_get_pci_dev(struct pci_dev *pdev,
1647 const struct pci_device_id *ent, 1032 const struct pci_device_id *ent,
1648 struct drm_driver *driver); 1033 struct drm_driver *driver);
1034extern int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master);
1649 1035
1650#define DRM_PCIE_SPEED_25 1 1036#define DRM_PCIE_SPEED_25 1
1651#define DRM_PCIE_SPEED_50 2 1037#define DRM_PCIE_SPEED_50 2
@@ -1655,6 +1041,7 @@ extern int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *speed_mask);
1655 1041
1656/* platform section */ 1042/* platform section */
1657extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device); 1043extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device);
1044extern int drm_platform_set_busid(struct drm_device *d, struct drm_master *m);
1658 1045
1659/* returns true if currently okay to sleep */ 1046/* returns true if currently okay to sleep */
1660static __inline__ bool drm_can_sleep(void) 1047static __inline__ bool drm_can_sleep(void)
@@ -1664,5 +1051,4 @@ static __inline__ bool drm_can_sleep(void)
1664 return true; 1051 return true;
1665} 1052}
1666 1053
1667#endif /* __KERNEL__ */
1668#endif 1054#endif
diff --git a/include/drm/drm_agpsupport.h b/include/drm/drm_agpsupport.h
index 86a02188074b..055dc058d147 100644
--- a/include/drm/drm_agpsupport.h
+++ b/include/drm/drm_agpsupport.h
@@ -1,12 +1,32 @@
1#ifndef _DRM_AGPSUPPORT_H_ 1#ifndef _DRM_AGPSUPPORT_H_
2#define _DRM_AGPSUPPORT_H_ 2#define _DRM_AGPSUPPORT_H_
3 3
4#include <linux/agp_backend.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/list.h>
5#include <linux/mm.h> 7#include <linux/mm.h>
6#include <linux/mutex.h> 8#include <linux/mutex.h>
7#include <linux/types.h> 9#include <linux/types.h>
8#include <linux/agp_backend.h> 10#include <uapi/drm/drm.h>
9#include <drm/drmP.h> 11
12struct drm_device;
13struct drm_file;
14
15#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && \
16 defined(MODULE)))
17
18struct drm_agp_head {
19 struct agp_kern_info agp_info;
20 struct list_head memory;
21 unsigned long mode;
22 struct agp_bridge_data *bridge;
23 int enabled;
24 int acquired;
25 unsigned long base;
26 int agp_mtrr;
27 int cant_use_aperture;
28 unsigned long page_mask;
29};
10 30
11#if __OS_HAS_AGP 31#if __OS_HAS_AGP
12 32
@@ -45,6 +65,7 @@ int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
45int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); 65int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
46int drm_agp_bind_ioctl(struct drm_device *dev, void *data, 66int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
47 struct drm_file *file_priv); 67 struct drm_file *file_priv);
68
48#else /* __OS_HAS_AGP */ 69#else /* __OS_HAS_AGP */
49 70
50static inline void drm_free_agp(struct agp_memory * handle, int pages) 71static inline void drm_free_agp(struct agp_memory * handle, int pages)
@@ -172,6 +193,7 @@ static inline int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
172{ 193{
173 return -ENODEV; 194 return -ENODEV;
174} 195}
196
175#endif /* __OS_HAS_AGP */ 197#endif /* __OS_HAS_AGP */
176 198
177#endif /* _DRM_AGPSUPPORT_H_ */ 199#endif /* _DRM_AGPSUPPORT_H_ */
diff --git a/include/drm/drm_buffer.h b/include/drm/drm_buffer.h
deleted file mode 100644
index c80d3a340b94..000000000000
--- a/include/drm/drm_buffer.h
+++ /dev/null
@@ -1,148 +0,0 @@
1/**************************************************************************
2 *
3 * Copyright 2010 Pauli Nieminen.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 *
27 **************************************************************************/
28/*
29 * Multipart buffer for coping data which is larger than the page size.
30 *
31 * Authors:
32 * Pauli Nieminen <suokkos-at-gmail-dot-com>
33 */
34
35#ifndef _DRM_BUFFER_H_
36#define _DRM_BUFFER_H_
37
38#include <drm/drmP.h>
39
40struct drm_buffer {
41 int iterator;
42 int size;
43 char *data[];
44};
45
46
47/**
48 * Return the index of page that buffer is currently pointing at.
49 */
50static inline int drm_buffer_page(struct drm_buffer *buf)
51{
52 return buf->iterator / PAGE_SIZE;
53}
54/**
55 * Return the index of the current byte in the page
56 */
57static inline int drm_buffer_index(struct drm_buffer *buf)
58{
59 return buf->iterator & (PAGE_SIZE - 1);
60}
61/**
62 * Return number of bytes that is left to process
63 */
64static inline int drm_buffer_unprocessed(struct drm_buffer *buf)
65{
66 return buf->size - buf->iterator;
67}
68
69/**
70 * Advance the buffer iterator number of bytes that is given.
71 */
72static inline void drm_buffer_advance(struct drm_buffer *buf, int bytes)
73{
74 buf->iterator += bytes;
75}
76
77/**
78 * Allocate the drm buffer object.
79 *
80 * buf: A pointer to a pointer where the object is stored.
81 * size: The number of bytes to allocate.
82 */
83extern int drm_buffer_alloc(struct drm_buffer **buf, int size);
84
85/**
86 * Copy the user data to the begin of the buffer and reset the processing
87 * iterator.
88 *
89 * user_data: A pointer the data that is copied to the buffer.
90 * size: The Number of bytes to copy.
91 */
92extern int drm_buffer_copy_from_user(struct drm_buffer *buf,
93 void __user *user_data, int size);
94
95/**
96 * Free the drm buffer object
97 */
98extern void drm_buffer_free(struct drm_buffer *buf);
99
100/**
101 * Read an object from buffer that may be split to multiple parts. If object
102 * is not split function just returns the pointer to object in buffer. But in
103 * case of split object data is copied to given stack object that is suplied
104 * by caller.
105 *
106 * The processing location of the buffer is also advanced to the next byte
107 * after the object.
108 *
109 * objsize: The size of the objet in bytes.
110 * stack_obj: A pointer to a memory location where object can be copied.
111 */
112extern void *drm_buffer_read_object(struct drm_buffer *buf,
113 int objsize, void *stack_obj);
114
115/**
116 * Returns the pointer to the dword which is offset number of elements from the
117 * current processing location.
118 *
119 * Caller must make sure that dword is not split in the buffer. This
120 * requirement is easily met if all the sizes of objects in buffer are
121 * multiples of dword and PAGE_SIZE is multiple dword.
122 *
123 * Call to this function doesn't change the processing location.
124 *
125 * offset: The index of the dword relative to the internat iterator.
126 */
127static inline void *drm_buffer_pointer_to_dword(struct drm_buffer *buffer,
128 int offset)
129{
130 int iter = buffer->iterator + offset * 4;
131 return &buffer->data[iter / PAGE_SIZE][iter & (PAGE_SIZE - 1)];
132}
133/**
134 * Returns the pointer to the dword which is offset number of elements from
135 * the current processing location.
136 *
137 * Call to this function doesn't change the processing location.
138 *
139 * offset: The index of the byte relative to the internat iterator.
140 */
141static inline void *drm_buffer_pointer_to_byte(struct drm_buffer *buffer,
142 int offset)
143{
144 int iter = buffer->iterator + offset;
145 return &buffer->data[iter / PAGE_SIZE][iter & (PAGE_SIZE - 1)];
146}
147
148#endif
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 251b75e6bf7a..c40070a92d6b 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -31,8 +31,8 @@
31#include <linux/idr.h> 31#include <linux/idr.h>
32#include <linux/fb.h> 32#include <linux/fb.h>
33#include <linux/hdmi.h> 33#include <linux/hdmi.h>
34#include <drm/drm_mode.h> 34#include <uapi/drm/drm_mode.h>
35#include <drm/drm_fourcc.h> 35#include <uapi/drm/drm_fourcc.h>
36#include <drm/drm_modeset_lock.h> 36#include <drm/drm_modeset_lock.h>
37 37
38struct drm_device; 38struct drm_device;
@@ -41,6 +41,7 @@ struct drm_framebuffer;
41struct drm_object_properties; 41struct drm_object_properties;
42struct drm_file; 42struct drm_file;
43struct drm_clip_rect; 43struct drm_clip_rect;
44struct device_node;
44 45
45#define DRM_MODE_OBJECT_CRTC 0xcccccccc 46#define DRM_MODE_OBJECT_CRTC 0xcccccccc
46#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 47#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
@@ -75,6 +76,14 @@ static inline uint64_t I642U64(int64_t val)
75 return (uint64_t)*((uint64_t *)&val); 76 return (uint64_t)*((uint64_t *)&val);
76} 77}
77 78
79/* rotation property bits */
80#define DRM_ROTATE_0 0
81#define DRM_ROTATE_90 1
82#define DRM_ROTATE_180 2
83#define DRM_ROTATE_270 3
84#define DRM_REFLECT_X 4
85#define DRM_REFLECT_Y 5
86
78enum drm_connector_force { 87enum drm_connector_force {
79 DRM_FORCE_UNSPECIFIED, 88 DRM_FORCE_UNSPECIFIED,
80 DRM_FORCE_OFF, 89 DRM_FORCE_OFF,
@@ -209,10 +218,6 @@ struct drm_property {
209 struct list_head enum_blob_list; 218 struct list_head enum_blob_list;
210}; 219};
211 220
212void drm_modeset_lock_all(struct drm_device *dev);
213void drm_modeset_unlock_all(struct drm_device *dev);
214void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
215
216struct drm_crtc; 221struct drm_crtc;
217struct drm_connector; 222struct drm_connector;
218struct drm_encoder; 223struct drm_encoder;
@@ -314,6 +319,7 @@ struct drm_crtc_funcs {
314 */ 319 */
315struct drm_crtc { 320struct drm_crtc {
316 struct drm_device *dev; 321 struct drm_device *dev;
322 struct device_node *port;
317 struct list_head head; 323 struct list_head head;
318 324
319 /** 325 /**
@@ -331,9 +337,9 @@ struct drm_crtc {
331 struct drm_plane *primary; 337 struct drm_plane *primary;
332 struct drm_plane *cursor; 338 struct drm_plane *cursor;
333 339
334 /* Temporary tracking of the old fb while a modeset is ongoing. Used 340 /* position of cursor plane on crtc */
335 * by drm_mode_set_config_internal to implement correct refcounting. */ 341 int cursor_x;
336 struct drm_framebuffer *old_fb; 342 int cursor_y;
337 343
338 bool enabled; 344 bool enabled;
339 345
@@ -361,6 +367,12 @@ struct drm_crtc {
361 void *helper_private; 367 void *helper_private;
362 368
363 struct drm_object_properties properties; 369 struct drm_object_properties properties;
370
371 /*
372 * For legacy crtc ioctls so that atomic drivers can get at the locking
373 * acquire context.
374 */
375 struct drm_modeset_acquire_ctx *acquire_ctx;
364}; 376};
365 377
366 378
@@ -524,6 +536,8 @@ struct drm_connector {
524 struct drm_property_blob *edid_blob_ptr; 536 struct drm_property_blob *edid_blob_ptr;
525 struct drm_object_properties properties; 537 struct drm_object_properties properties;
526 538
539 struct drm_property_blob *path_blob_ptr;
540
527 uint8_t polled; /* DRM_CONNECTOR_POLL_* */ 541 uint8_t polled; /* DRM_CONNECTOR_POLL_* */
528 542
529 /* requested DPMS state */ 543 /* requested DPMS state */
@@ -532,7 +546,9 @@ struct drm_connector {
532 void *helper_private; 546 void *helper_private;
533 547
534 /* forced on connector */ 548 /* forced on connector */
549 struct drm_cmdline_mode cmdline_mode;
535 enum drm_connector_force force; 550 enum drm_connector_force force;
551 bool override_edid;
536 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; 552 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
537 struct drm_encoder *encoder; /* currently active encoder */ 553 struct drm_encoder *encoder; /* currently active encoder */
538 554
@@ -545,6 +561,8 @@ struct drm_connector {
545 int audio_latency[2]; 561 int audio_latency[2];
546 int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */ 562 int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */
547 unsigned bad_edid_counter; 563 unsigned bad_edid_counter;
564
565 struct dentry *debugfs_entry;
548}; 566};
549 567
550/** 568/**
@@ -563,6 +581,7 @@ struct drm_plane_funcs {
563 uint32_t src_w, uint32_t src_h); 581 uint32_t src_w, uint32_t src_h);
564 int (*disable_plane)(struct drm_plane *plane); 582 int (*disable_plane)(struct drm_plane *plane);
565 void (*destroy)(struct drm_plane *plane); 583 void (*destroy)(struct drm_plane *plane);
584 void (*reset)(struct drm_plane *plane);
566 585
567 int (*set_property)(struct drm_plane *plane, 586 int (*set_property)(struct drm_plane *plane,
568 struct drm_property *property, uint64_t val); 587 struct drm_property *property, uint64_t val);
@@ -601,6 +620,10 @@ struct drm_plane {
601 struct drm_crtc *crtc; 620 struct drm_crtc *crtc;
602 struct drm_framebuffer *fb; 621 struct drm_framebuffer *fb;
603 622
623 /* Temporary tracking of the old fb while a modeset is ongoing. Used
624 * by drm_mode_set_config_internal to implement correct refcounting. */
625 struct drm_framebuffer *old_fb;
626
604 const struct drm_plane_funcs *funcs; 627 const struct drm_plane_funcs *funcs;
605 628
606 struct drm_object_properties properties; 629 struct drm_object_properties properties;
@@ -800,7 +823,9 @@ struct drm_mode_config {
800 struct list_head property_blob_list; 823 struct list_head property_blob_list;
801 struct drm_property *edid_property; 824 struct drm_property *edid_property;
802 struct drm_property *dpms_property; 825 struct drm_property *dpms_property;
826 struct drm_property *path_property;
803 struct drm_property *plane_type_property; 827 struct drm_property *plane_type_property;
828 struct drm_property *rotation_property;
804 829
805 /* DVI-I properties */ 830 /* DVI-I properties */
806 struct drm_property *dvi_i_subconnector_property; 831 struct drm_property *dvi_i_subconnector_property;
@@ -823,6 +848,7 @@ struct drm_mode_config {
823 848
824 /* Optional properties */ 849 /* Optional properties */
825 struct drm_property *scaling_mode_property; 850 struct drm_property *scaling_mode_property;
851 struct drm_property *aspect_ratio_property;
826 struct drm_property *dirty_info_property; 852 struct drm_property *dirty_info_property;
827 853
828 /* dumb ioctl parameters */ 854 /* dumb ioctl parameters */
@@ -852,7 +878,7 @@ struct drm_prop_enum_list {
852extern int drm_crtc_init_with_planes(struct drm_device *dev, 878extern int drm_crtc_init_with_planes(struct drm_device *dev,
853 struct drm_crtc *crtc, 879 struct drm_crtc *crtc,
854 struct drm_plane *primary, 880 struct drm_plane *primary,
855 void *cursor, 881 struct drm_plane *cursor,
856 const struct drm_crtc_funcs *funcs); 882 const struct drm_crtc_funcs *funcs);
857extern int drm_crtc_init(struct drm_device *dev, 883extern int drm_crtc_init(struct drm_device *dev,
858 struct drm_crtc *crtc, 884 struct drm_crtc *crtc,
@@ -878,8 +904,11 @@ extern int drm_connector_init(struct drm_device *dev,
878 struct drm_connector *connector, 904 struct drm_connector *connector,
879 const struct drm_connector_funcs *funcs, 905 const struct drm_connector_funcs *funcs,
880 int connector_type); 906 int connector_type);
907int drm_connector_register(struct drm_connector *connector);
908void drm_connector_unregister(struct drm_connector *connector);
881 909
882extern void drm_connector_cleanup(struct drm_connector *connector); 910extern void drm_connector_cleanup(struct drm_connector *connector);
911extern unsigned int drm_connector_index(struct drm_connector *connector);
883/* helper to unplug all connectors from sysfs for device */ 912/* helper to unplug all connectors from sysfs for device */
884extern void drm_connector_unplug_all(struct drm_device *dev); 913extern void drm_connector_unplug_all(struct drm_device *dev);
885 914
@@ -919,6 +948,7 @@ extern int drm_plane_init(struct drm_device *dev,
919 const uint32_t *formats, uint32_t format_count, 948 const uint32_t *formats, uint32_t format_count,
920 bool is_primary); 949 bool is_primary);
921extern void drm_plane_cleanup(struct drm_plane *plane); 950extern void drm_plane_cleanup(struct drm_plane *plane);
951extern unsigned int drm_plane_index(struct drm_plane *plane);
922extern void drm_plane_force_disable(struct drm_plane *plane); 952extern void drm_plane_force_disable(struct drm_plane *plane);
923extern int drm_crtc_check_viewport(const struct drm_crtc *crtc, 953extern int drm_crtc_check_viewport(const struct drm_crtc *crtc,
924 int x, int y, 954 int x, int y,
@@ -937,6 +967,7 @@ extern const char *drm_get_tv_select_name(int val);
937extern void drm_fb_release(struct drm_file *file_priv); 967extern void drm_fb_release(struct drm_file *file_priv);
938extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 968extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
939extern void drm_mode_group_destroy(struct drm_mode_group *group); 969extern void drm_mode_group_destroy(struct drm_mode_group *group);
970extern void drm_reinit_primary_mode_group(struct drm_device *dev);
940extern bool drm_probe_ddc(struct i2c_adapter *adapter); 971extern bool drm_probe_ddc(struct i2c_adapter *adapter);
941extern struct edid *drm_get_edid(struct drm_connector *connector, 972extern struct edid *drm_get_edid(struct drm_connector *connector,
942 struct i2c_adapter *adapter); 973 struct i2c_adapter *adapter);
@@ -946,6 +977,8 @@ extern void drm_mode_config_init(struct drm_device *dev);
946extern void drm_mode_config_reset(struct drm_device *dev); 977extern void drm_mode_config_reset(struct drm_device *dev);
947extern void drm_mode_config_cleanup(struct drm_device *dev); 978extern void drm_mode_config_cleanup(struct drm_device *dev);
948 979
980extern int drm_mode_connector_set_path_property(struct drm_connector *connector,
981 char *path);
949extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, 982extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
950 struct edid *edid); 983 struct edid *edid);
951 984
@@ -994,7 +1027,8 @@ extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int
994struct drm_property *drm_property_create_bitmask(struct drm_device *dev, 1027struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
995 int flags, const char *name, 1028 int flags, const char *name,
996 const struct drm_prop_enum_list *props, 1029 const struct drm_prop_enum_list *props,
997 int num_values); 1030 int num_props,
1031 uint64_t supported_bits);
998struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, 1032struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
999 const char *name, 1033 const char *name,
1000 uint64_t min, uint64_t max); 1034 uint64_t min, uint64_t max);
@@ -1010,6 +1044,7 @@ extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
1010extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats, 1044extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats,
1011 char *formats[]); 1045 char *formats[]);
1012extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); 1046extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
1047extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
1013extern int drm_mode_create_dirty_info_property(struct drm_device *dev); 1048extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
1014 1049
1015extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, 1050extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
@@ -1092,6 +1127,9 @@ extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
1092 struct drm_file *file_priv); 1127 struct drm_file *file_priv);
1093extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data, 1128extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
1094 struct drm_file *file_priv); 1129 struct drm_file *file_priv);
1130extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
1131 struct drm_property *property,
1132 uint64_t value);
1095 1133
1096extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, 1134extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
1097 int *bpp); 1135 int *bpp);
@@ -1100,6 +1138,10 @@ extern int drm_format_plane_cpp(uint32_t format, int plane);
1100extern int drm_format_horz_chroma_subsampling(uint32_t format); 1138extern int drm_format_horz_chroma_subsampling(uint32_t format);
1101extern int drm_format_vert_chroma_subsampling(uint32_t format); 1139extern int drm_format_vert_chroma_subsampling(uint32_t format);
1102extern const char *drm_get_format_name(uint32_t format); 1140extern const char *drm_get_format_name(uint32_t format);
1141extern struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
1142 unsigned int supported_rotations);
1143extern unsigned int drm_rotation_simplify(unsigned int rotation,
1144 unsigned int supported_rotations);
1103 1145
1104/* Helpers */ 1146/* Helpers */
1105 1147
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index a21568bf1514..9305c718d789 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -190,16 +190,16 @@
190# define DP_TRAIN_VOLTAGE_SWING_MASK 0x3 190# define DP_TRAIN_VOLTAGE_SWING_MASK 0x3
191# define DP_TRAIN_VOLTAGE_SWING_SHIFT 0 191# define DP_TRAIN_VOLTAGE_SWING_SHIFT 0
192# define DP_TRAIN_MAX_SWING_REACHED (1 << 2) 192# define DP_TRAIN_MAX_SWING_REACHED (1 << 2)
193# define DP_TRAIN_VOLTAGE_SWING_400 (0 << 0) 193# define DP_TRAIN_VOLTAGE_SWING_LEVEL_0 (0 << 0)
194# define DP_TRAIN_VOLTAGE_SWING_600 (1 << 0) 194# define DP_TRAIN_VOLTAGE_SWING_LEVEL_1 (1 << 0)
195# define DP_TRAIN_VOLTAGE_SWING_800 (2 << 0) 195# define DP_TRAIN_VOLTAGE_SWING_LEVEL_2 (2 << 0)
196# define DP_TRAIN_VOLTAGE_SWING_1200 (3 << 0) 196# define DP_TRAIN_VOLTAGE_SWING_LEVEL_3 (3 << 0)
197 197
198# define DP_TRAIN_PRE_EMPHASIS_MASK (3 << 3) 198# define DP_TRAIN_PRE_EMPHASIS_MASK (3 << 3)
199# define DP_TRAIN_PRE_EMPHASIS_0 (0 << 3) 199# define DP_TRAIN_PRE_EMPH_LEVEL_0 (0 << 3)
200# define DP_TRAIN_PRE_EMPHASIS_3_5 (1 << 3) 200# define DP_TRAIN_PRE_EMPH_LEVEL_1 (1 << 3)
201# define DP_TRAIN_PRE_EMPHASIS_6 (2 << 3) 201# define DP_TRAIN_PRE_EMPH_LEVEL_2 (2 << 3)
202# define DP_TRAIN_PRE_EMPHASIS_9_5 (3 << 3) 202# define DP_TRAIN_PRE_EMPH_LEVEL_3 (3 << 3)
203 203
204# define DP_TRAIN_PRE_EMPHASIS_SHIFT 3 204# define DP_TRAIN_PRE_EMPHASIS_SHIFT 3
205# define DP_TRAIN_MAX_PRE_EMPHASIS_REACHED (1 << 5) 205# define DP_TRAIN_MAX_PRE_EMPHASIS_REACHED (1 << 5)
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
new file mode 100644
index 000000000000..338fc1053835
--- /dev/null
+++ b/include/drm/drm_dp_mst_helper.h
@@ -0,0 +1,511 @@
1/*
2 * Copyright © 2014 Red Hat.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
21 */
22#ifndef _DRM_DP_MST_HELPER_H_
23#define _DRM_DP_MST_HELPER_H_
24
25#include <linux/types.h>
26#include <drm/drm_dp_helper.h>
27
28struct drm_dp_mst_branch;
29
30/**
31 * struct drm_dp_vcpi - Virtual Channel Payload Identifer
32 * @vcpi: Virtual channel ID.
33 * @pbn: Payload Bandwidth Number for this channel
34 * @aligned_pbn: PBN aligned with slot size
35 * @num_slots: number of slots for this PBN
36 */
37struct drm_dp_vcpi {
38 int vcpi;
39 int pbn;
40 int aligned_pbn;
41 int num_slots;
42};
43
44/**
45 * struct drm_dp_mst_port - MST port
46 * @kref: reference count for this port.
47 * @guid_valid: for DP 1.2 devices if we have validated the GUID.
48 * @guid: guid for DP 1.2 device on this port.
49 * @port_num: port number
50 * @input: if this port is an input port.
51 * @mcs: message capability status - DP 1.2 spec.
52 * @ddps: DisplayPort Device Plug Status - DP 1.2
53 * @pdt: Peer Device Type
54 * @ldps: Legacy Device Plug Status
55 * @dpcd_rev: DPCD revision of device on this port
56 * @num_sdp_streams: Number of simultaneous streams
57 * @num_sdp_stream_sinks: Number of stream sinks
58 * @available_pbn: Available bandwidth for this port.
59 * @next: link to next port on this branch device
60 * @mstb: branch device attach below this port
61 * @aux: i2c aux transport to talk to device connected to this port.
62 * @parent: branch device parent of this port
63 * @vcpi: Virtual Channel Payload info for this port.
64 * @connector: DRM connector this port is connected to.
65 * @mgr: topology manager this port lives under.
66 *
67 * This structure represents an MST port endpoint on a device somewhere
68 * in the MST topology.
69 */
70struct drm_dp_mst_port {
71 struct kref kref;
72
73 /* if dpcd 1.2 device is on this port - its GUID info */
74 bool guid_valid;
75 u8 guid[16];
76
77 u8 port_num;
78 bool input;
79 bool mcs;
80 bool ddps;
81 u8 pdt;
82 bool ldps;
83 u8 dpcd_rev;
84 u8 num_sdp_streams;
85 u8 num_sdp_stream_sinks;
86 uint16_t available_pbn;
87 struct list_head next;
88 struct drm_dp_mst_branch *mstb; /* pointer to an mstb if this port has one */
89 struct drm_dp_aux aux; /* i2c bus for this port? */
90 struct drm_dp_mst_branch *parent;
91
92 struct drm_dp_vcpi vcpi;
93 struct drm_connector *connector;
94 struct drm_dp_mst_topology_mgr *mgr;
95};
96
97/**
98 * struct drm_dp_mst_branch - MST branch device.
99 * @kref: reference count for this port.
100 * @rad: Relative Address to talk to this branch device.
101 * @lct: Link count total to talk to this branch device.
102 * @num_ports: number of ports on the branch.
103 * @msg_slots: one bit per transmitted msg slot.
104 * @ports: linked list of ports on this branch.
105 * @port_parent: pointer to the port parent, NULL if toplevel.
106 * @mgr: topology manager for this branch device.
107 * @tx_slots: transmission slots for this device.
108 * @last_seqno: last sequence number used to talk to this.
109 * @link_address_sent: if a link address message has been sent to this device yet.
110 *
111 * This structure represents an MST branch device, there is one
112 * primary branch device at the root, along with any others connected
113 * to downstream ports
114 */
115struct drm_dp_mst_branch {
116 struct kref kref;
117 u8 rad[8];
118 u8 lct;
119 int num_ports;
120
121 int msg_slots;
122 struct list_head ports;
123
124 /* list of tx ops queue for this port */
125 struct drm_dp_mst_port *port_parent;
126 struct drm_dp_mst_topology_mgr *mgr;
127
128 /* slots are protected by mstb->mgr->qlock */
129 struct drm_dp_sideband_msg_tx *tx_slots[2];
130 int last_seqno;
131 bool link_address_sent;
132};
133
134
135/* sideband msg header - not bit struct */
136struct drm_dp_sideband_msg_hdr {
137 u8 lct;
138 u8 lcr;
139 u8 rad[8];
140 bool broadcast;
141 bool path_msg;
142 u8 msg_len;
143 bool somt;
144 bool eomt;
145 bool seqno;
146};
147
148struct drm_dp_nak_reply {
149 u8 guid[16];
150 u8 reason;
151 u8 nak_data;
152};
153
154struct drm_dp_link_address_ack_reply {
155 u8 guid[16];
156 u8 nports;
157 struct drm_dp_link_addr_reply_port {
158 bool input_port;
159 u8 peer_device_type;
160 u8 port_number;
161 bool mcs;
162 bool ddps;
163 bool legacy_device_plug_status;
164 u8 dpcd_revision;
165 u8 peer_guid[16];
166 u8 num_sdp_streams;
167 u8 num_sdp_stream_sinks;
168 } ports[16];
169};
170
171struct drm_dp_remote_dpcd_read_ack_reply {
172 u8 port_number;
173 u8 num_bytes;
174 u8 bytes[255];
175};
176
177struct drm_dp_remote_dpcd_write_ack_reply {
178 u8 port_number;
179};
180
181struct drm_dp_remote_dpcd_write_nak_reply {
182 u8 port_number;
183 u8 reason;
184 u8 bytes_written_before_failure;
185};
186
187struct drm_dp_remote_i2c_read_ack_reply {
188 u8 port_number;
189 u8 num_bytes;
190 u8 bytes[255];
191};
192
193struct drm_dp_remote_i2c_read_nak_reply {
194 u8 port_number;
195 u8 nak_reason;
196 u8 i2c_nak_transaction;
197};
198
199struct drm_dp_remote_i2c_write_ack_reply {
200 u8 port_number;
201};
202
203
204struct drm_dp_sideband_msg_rx {
205 u8 chunk[48];
206 u8 msg[256];
207 u8 curchunk_len;
208 u8 curchunk_idx; /* chunk we are parsing now */
209 u8 curchunk_hdrlen;
210 u8 curlen; /* total length of the msg */
211 bool have_somt;
212 bool have_eomt;
213 struct drm_dp_sideband_msg_hdr initial_hdr;
214};
215
216
217struct drm_dp_allocate_payload {
218 u8 port_number;
219 u8 number_sdp_streams;
220 u8 vcpi;
221 u16 pbn;
222 u8 sdp_stream_sink[8];
223};
224
225struct drm_dp_allocate_payload_ack_reply {
226 u8 port_number;
227 u8 vcpi;
228 u16 allocated_pbn;
229};
230
231struct drm_dp_connection_status_notify {
232 u8 guid[16];
233 u8 port_number;
234 bool legacy_device_plug_status;
235 bool displayport_device_plug_status;
236 bool message_capability_status;
237 bool input_port;
238 u8 peer_device_type;
239};
240
241struct drm_dp_remote_dpcd_read {
242 u8 port_number;
243 u32 dpcd_address;
244 u8 num_bytes;
245};
246
247struct drm_dp_remote_dpcd_write {
248 u8 port_number;
249 u32 dpcd_address;
250 u8 num_bytes;
251 u8 *bytes;
252};
253
254struct drm_dp_remote_i2c_read {
255 u8 num_transactions;
256 u8 port_number;
257 struct {
258 u8 i2c_dev_id;
259 u8 num_bytes;
260 u8 *bytes;
261 u8 no_stop_bit;
262 u8 i2c_transaction_delay;
263 } transactions[4];
264 u8 read_i2c_device_id;
265 u8 num_bytes_read;
266};
267
268struct drm_dp_remote_i2c_write {
269 u8 port_number;
270 u8 write_i2c_device_id;
271 u8 num_bytes;
272 u8 *bytes;
273};
274
275/* this covers ENUM_RESOURCES, POWER_DOWN_PHY, POWER_UP_PHY */
276struct drm_dp_port_number_req {
277 u8 port_number;
278};
279
280struct drm_dp_enum_path_resources_ack_reply {
281 u8 port_number;
282 u16 full_payload_bw_number;
283 u16 avail_payload_bw_number;
284};
285
286/* covers POWER_DOWN_PHY, POWER_UP_PHY */
287struct drm_dp_port_number_rep {
288 u8 port_number;
289};
290
291struct drm_dp_query_payload {
292 u8 port_number;
293 u8 vcpi;
294};
295
296struct drm_dp_resource_status_notify {
297 u8 port_number;
298 u8 guid[16];
299 u16 available_pbn;
300};
301
302struct drm_dp_query_payload_ack_reply {
303 u8 port_number;
304 u8 allocated_pbn;
305};
306
307struct drm_dp_sideband_msg_req_body {
308 u8 req_type;
309 union ack_req {
310 struct drm_dp_connection_status_notify conn_stat;
311 struct drm_dp_port_number_req port_num;
312 struct drm_dp_resource_status_notify resource_stat;
313
314 struct drm_dp_query_payload query_payload;
315 struct drm_dp_allocate_payload allocate_payload;
316
317 struct drm_dp_remote_dpcd_read dpcd_read;
318 struct drm_dp_remote_dpcd_write dpcd_write;
319
320 struct drm_dp_remote_i2c_read i2c_read;
321 struct drm_dp_remote_i2c_write i2c_write;
322 } u;
323};
324
325struct drm_dp_sideband_msg_reply_body {
326 u8 reply_type;
327 u8 req_type;
328 union ack_replies {
329 struct drm_dp_nak_reply nak;
330 struct drm_dp_link_address_ack_reply link_addr;
331 struct drm_dp_port_number_rep port_number;
332
333 struct drm_dp_enum_path_resources_ack_reply path_resources;
334 struct drm_dp_allocate_payload_ack_reply allocate_payload;
335 struct drm_dp_query_payload_ack_reply query_payload;
336
337 struct drm_dp_remote_dpcd_read_ack_reply remote_dpcd_read_ack;
338 struct drm_dp_remote_dpcd_write_ack_reply remote_dpcd_write_ack;
339 struct drm_dp_remote_dpcd_write_nak_reply remote_dpcd_write_nack;
340
341 struct drm_dp_remote_i2c_read_ack_reply remote_i2c_read_ack;
342 struct drm_dp_remote_i2c_read_nak_reply remote_i2c_read_nack;
343 struct drm_dp_remote_i2c_write_ack_reply remote_i2c_write_ack;
344 } u;
345};
346
347/* msg is queued to be put into a slot */
348#define DRM_DP_SIDEBAND_TX_QUEUED 0
349/* msg has started transmitting on a slot - still on msgq */
350#define DRM_DP_SIDEBAND_TX_START_SEND 1
351/* msg has finished transmitting on a slot - removed from msgq only in slot */
352#define DRM_DP_SIDEBAND_TX_SENT 2
353/* msg has received a response - removed from slot */
354#define DRM_DP_SIDEBAND_TX_RX 3
355#define DRM_DP_SIDEBAND_TX_TIMEOUT 4
356
357struct drm_dp_sideband_msg_tx {
358 u8 msg[256];
359 u8 chunk[48];
360 u8 cur_offset;
361 u8 cur_len;
362 struct drm_dp_mst_branch *dst;
363 struct list_head next;
364 int seqno;
365 int state;
366 bool path_msg;
367 struct drm_dp_sideband_msg_reply_body reply;
368};
369
370/* sideband msg handler */
371struct drm_dp_mst_topology_mgr;
372struct drm_dp_mst_topology_cbs {
373 /* create a connector for a port */
374 struct drm_connector *(*add_connector)(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, char *path);
375 void (*destroy_connector)(struct drm_dp_mst_topology_mgr *mgr,
376 struct drm_connector *connector);
377 void (*hotplug)(struct drm_dp_mst_topology_mgr *mgr);
378
379};
380
381#define DP_MAX_PAYLOAD (sizeof(unsigned long) * 8)
382
383#define DP_PAYLOAD_LOCAL 1
384#define DP_PAYLOAD_REMOTE 2
385#define DP_PAYLOAD_DELETE_LOCAL 3
386
387struct drm_dp_payload {
388 int payload_state;
389 int start_slot;
390 int num_slots;
391 int vcpi;
392};
393
394/**
395 * struct drm_dp_mst_topology_mgr - DisplayPort MST manager
396 * @dev: device pointer for adding i2c devices etc.
397 * @cbs: callbacks for connector addition and destruction.
398 * @max_dpcd_transaction_bytes - maximum number of bytes to read/write in one go.
399 * @aux: aux channel for the DP connector.
400 * @max_payloads: maximum number of payloads the GPU can generate.
401 * @conn_base_id: DRM connector ID this mgr is connected to.
402 * @down_rep_recv: msg receiver state for down replies.
403 * @up_req_recv: msg receiver state for up requests.
404 * @lock: protects mst state, primary, guid, dpcd.
405 * @mst_state: if this manager is enabled for an MST capable port.
406 * @mst_primary: pointer to the primary branch device.
407 * @guid_valid: GUID valid for the primary branch device.
408 * @guid: GUID for primary port.
409 * @dpcd: cache of DPCD for primary port.
410 * @pbn_div: PBN to slots divisor.
411 *
412 * This struct represents the toplevel displayport MST topology manager.
413 * There should be one instance of this for every MST capable DP connector
414 * on the GPU.
415 */
416struct drm_dp_mst_topology_mgr {
417
418 struct device *dev;
419 struct drm_dp_mst_topology_cbs *cbs;
420 int max_dpcd_transaction_bytes;
421 struct drm_dp_aux *aux; /* auxch for this topology mgr to use */
422 int max_payloads;
423 int conn_base_id;
424
425 /* only ever accessed from the workqueue - which should be serialised */
426 struct drm_dp_sideband_msg_rx down_rep_recv;
427 struct drm_dp_sideband_msg_rx up_req_recv;
428
429 /* pointer to info about the initial MST device */
430 struct mutex lock; /* protects mst_state + primary + guid + dpcd */
431
432 bool mst_state;
433 struct drm_dp_mst_branch *mst_primary;
434 /* primary MST device GUID */
435 bool guid_valid;
436 u8 guid[16];
437 u8 dpcd[DP_RECEIVER_CAP_SIZE];
438 u8 sink_count;
439 int pbn_div;
440 int total_slots;
441 int avail_slots;
442 int total_pbn;
443
444 /* messages to be transmitted */
445 /* qlock protects the upq/downq and in_progress,
446 the mstb tx_slots and txmsg->state once they are queued */
447 struct mutex qlock;
448 struct list_head tx_msg_downq;
449 struct list_head tx_msg_upq;
450 bool tx_down_in_progress;
451 bool tx_up_in_progress;
452
453 /* payload info + lock for it */
454 struct mutex payload_lock;
455 struct drm_dp_vcpi **proposed_vcpis;
456 struct drm_dp_payload *payloads;
457 unsigned long payload_mask;
458 unsigned long vcpi_mask;
459
460 wait_queue_head_t tx_waitq;
461 struct work_struct work;
462
463 struct work_struct tx_work;
464};
465
466int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr, struct device *dev, struct drm_dp_aux *aux, int max_dpcd_transaction_bytes, int max_payloads, int conn_base_id);
467
468void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr);
469
470
471int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool mst_state);
472
473
474int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handled);
475
476
477enum drm_connector_status drm_dp_mst_detect_port(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
478
479struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
480
481
482int drm_dp_calc_pbn_mode(int clock, int bpp);
483
484
485bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int *slots);
486
487
488void drm_dp_mst_reset_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
489
490
491void drm_dp_mst_deallocate_vcpi(struct drm_dp_mst_topology_mgr *mgr,
492 struct drm_dp_mst_port *port);
493
494
495int drm_dp_find_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr,
496 int pbn);
497
498
499int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr);
500
501
502int drm_dp_update_payload_part2(struct drm_dp_mst_topology_mgr *mgr);
503
504int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr);
505
506void drm_dp_mst_dump_topology(struct seq_file *m,
507 struct drm_dp_mst_topology_mgr *mgr);
508
509void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr);
510int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr);
511#endif
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 7997246d4039..f4ad254e3488 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -77,7 +77,6 @@ struct drm_fb_helper_funcs {
77 77
78struct drm_fb_helper_connector { 78struct drm_fb_helper_connector {
79 struct drm_connector *connector; 79 struct drm_connector *connector;
80 struct drm_cmdline_mode cmdline_mode;
81}; 80};
82 81
83struct drm_fb_helper { 82struct drm_fb_helper {
@@ -86,8 +85,9 @@ struct drm_fb_helper {
86 int crtc_count; 85 int crtc_count;
87 struct drm_fb_helper_crtc *crtc_info; 86 struct drm_fb_helper_crtc *crtc_info;
88 int connector_count; 87 int connector_count;
88 int connector_info_alloc_count;
89 struct drm_fb_helper_connector **connector_info; 89 struct drm_fb_helper_connector **connector_info;
90 struct drm_fb_helper_funcs *funcs; 90 const struct drm_fb_helper_funcs *funcs;
91 struct fb_info *fbdev; 91 struct fb_info *fbdev;
92 u32 pseudo_palette[17]; 92 u32 pseudo_palette[17];
93 struct list_head kernel_fb_list; 93 struct list_head kernel_fb_list;
@@ -97,6 +97,8 @@ struct drm_fb_helper {
97 bool delayed_hotplug; 97 bool delayed_hotplug;
98}; 98};
99 99
100void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper,
101 const struct drm_fb_helper_funcs *funcs);
100int drm_fb_helper_init(struct drm_device *dev, 102int drm_fb_helper_init(struct drm_device *dev,
101 struct drm_fb_helper *helper, int crtc_count, 103 struct drm_fb_helper *helper, int crtc_count,
102 int max_conn); 104 int max_conn);
@@ -128,4 +130,7 @@ struct drm_display_mode *
128drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn, 130drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn,
129 int width, int height); 131 int width, int height);
130 132
133int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector);
134int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
135 struct drm_connector *connector);
131#endif 136#endif
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
new file mode 100644
index 000000000000..1e6ae1458f7a
--- /dev/null
+++ b/include/drm/drm_gem.h
@@ -0,0 +1,183 @@
1#ifndef __DRM_GEM_H__
2#define __DRM_GEM_H__
3
4/*
5 * GEM Graphics Execution Manager Driver Interfaces
6 *
7 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
8 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
9 * Copyright (c) 2009-2010, Code Aurora Forum.
10 * All rights reserved.
11 * Copyright © 2014 Intel Corporation
12 * Daniel Vetter <daniel.vetter@ffwll.ch>
13 *
14 * Author: Rickard E. (Rik) Faith <faith@valinux.com>
15 * Author: Gareth Hughes <gareth@valinux.com>
16 *
17 * Permission is hereby granted, free of charge, to any person obtaining a
18 * copy of this software and associated documentation files (the "Software"),
19 * to deal in the Software without restriction, including without limitation
20 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
21 * and/or sell copies of the Software, and to permit persons to whom the
22 * Software is furnished to do so, subject to the following conditions:
23 *
24 * The above copyright notice and this permission notice (including the next
25 * paragraph) shall be included in all copies or substantial portions of the
26 * Software.
27 *
28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
31 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
32 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
34 * OTHER DEALINGS IN THE SOFTWARE.
35 */
36
37/**
38 * This structure defines the drm_mm memory object, which will be used by the
39 * DRM for its buffer objects.
40 */
41struct drm_gem_object {
42 /** Reference count of this object */
43 struct kref refcount;
44
45 /**
46 * handle_count - gem file_priv handle count of this object
47 *
48 * Each handle also holds a reference. Note that when the handle_count
49 * drops to 0 any global names (e.g. the id in the flink namespace) will
50 * be cleared.
51 *
52 * Protected by dev->object_name_lock.
53 * */
54 unsigned handle_count;
55
56 /** Related drm device */
57 struct drm_device *dev;
58
59 /** File representing the shmem storage */
60 struct file *filp;
61
62 /* Mapping info for this object */
63 struct drm_vma_offset_node vma_node;
64
65 /**
66 * Size of the object, in bytes. Immutable over the object's
67 * lifetime.
68 */
69 size_t size;
70
71 /**
72 * Global name for this object, starts at 1. 0 means unnamed.
73 * Access is covered by the object_name_lock in the related drm_device
74 */
75 int name;
76
77 /**
78 * Memory domains. These monitor which caches contain read/write data
79 * related to the object. When transitioning from one set of domains
80 * to another, the driver is called to ensure that caches are suitably
81 * flushed and invalidated
82 */
83 uint32_t read_domains;
84 uint32_t write_domain;
85
86 /**
87 * While validating an exec operation, the
88 * new read/write domain values are computed here.
89 * They will be transferred to the above values
90 * at the point that any cache flushing occurs
91 */
92 uint32_t pending_read_domains;
93 uint32_t pending_write_domain;
94
95 /**
96 * dma_buf - dma buf associated with this GEM object
97 *
98 * Pointer to the dma-buf associated with this gem object (either
99 * through importing or exporting). We break the resulting reference
100 * loop when the last gem handle for this object is released.
101 *
102 * Protected by obj->object_name_lock
103 */
104 struct dma_buf *dma_buf;
105
106 /**
107 * import_attach - dma buf attachment backing this object
108 *
109 * Any foreign dma_buf imported as a gem object has this set to the
110 * attachment point for the device. This is invariant over the lifetime
111 * of a gem object.
112 *
113 * The driver's ->gem_free_object callback is responsible for cleaning
114 * up the dma_buf attachment and references acquired at import time.
115 *
116 * Note that the drm gem/prime core does not depend upon drivers setting
117 * this field any more. So for drivers where this doesn't make sense
118 * (e.g. virtual devices or a displaylink behind an usb bus) they can
119 * simply leave it as NULL.
120 */
121 struct dma_buf_attachment *import_attach;
122};
123
124void drm_gem_object_release(struct drm_gem_object *obj);
125void drm_gem_object_free(struct kref *kref);
126int drm_gem_object_init(struct drm_device *dev,
127 struct drm_gem_object *obj, size_t size);
128void drm_gem_private_object_init(struct drm_device *dev,
129 struct drm_gem_object *obj, size_t size);
130void drm_gem_vm_open(struct vm_area_struct *vma);
131void drm_gem_vm_close(struct vm_area_struct *vma);
132int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
133 struct vm_area_struct *vma);
134int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
135
136static inline void
137drm_gem_object_reference(struct drm_gem_object *obj)
138{
139 kref_get(&obj->refcount);
140}
141
142static inline void
143drm_gem_object_unreference(struct drm_gem_object *obj)
144{
145 if (obj != NULL)
146 kref_put(&obj->refcount, drm_gem_object_free);
147}
148
149static inline void
150drm_gem_object_unreference_unlocked(struct drm_gem_object *obj)
151{
152 if (obj && !atomic_add_unless(&obj->refcount.refcount, -1, 1)) {
153 struct drm_device *dev = obj->dev;
154
155 mutex_lock(&dev->struct_mutex);
156 if (likely(atomic_dec_and_test(&obj->refcount.refcount)))
157 drm_gem_object_free(&obj->refcount);
158 mutex_unlock(&dev->struct_mutex);
159 }
160}
161
162int drm_gem_handle_create(struct drm_file *file_priv,
163 struct drm_gem_object *obj,
164 u32 *handlep);
165int drm_gem_handle_delete(struct drm_file *filp, u32 handle);
166
167
168void drm_gem_free_mmap_offset(struct drm_gem_object *obj);
169int drm_gem_create_mmap_offset(struct drm_gem_object *obj);
170int drm_gem_create_mmap_offset_size(struct drm_gem_object *obj, size_t size);
171
172struct page **drm_gem_get_pages(struct drm_gem_object *obj);
173void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages,
174 bool dirty, bool accessed);
175
176struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev,
177 struct drm_file *filp,
178 u32 handle);
179int drm_gem_dumb_destroy(struct drm_file *file,
180 struct drm_device *dev,
181 uint32_t handle);
182
183#endif /* __DRM_GEM_H__ */
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
index 2a3cea91606d..2ff35f3de9c5 100644
--- a/include/drm/drm_gem_cma_helper.h
+++ b/include/drm/drm_gem_cma_helper.h
@@ -2,6 +2,7 @@
2#define __DRM_GEM_CMA_HELPER_H__ 2#define __DRM_GEM_CMA_HELPER_H__
3 3
4#include <drm/drmP.h> 4#include <drm/drmP.h>
5#include <drm/drm_gem.h>
5 6
6struct drm_gem_cma_object { 7struct drm_gem_cma_object {
7 struct drm_gem_object base; 8 struct drm_gem_object base;
@@ -44,7 +45,8 @@ void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m);
44 45
45struct sg_table *drm_gem_cma_prime_get_sg_table(struct drm_gem_object *obj); 46struct sg_table *drm_gem_cma_prime_get_sg_table(struct drm_gem_object *obj);
46struct drm_gem_object * 47struct drm_gem_object *
47drm_gem_cma_prime_import_sg_table(struct drm_device *dev, size_t size, 48drm_gem_cma_prime_import_sg_table(struct drm_device *dev,
49 struct dma_buf_attachment *attach,
48 struct sg_table *sgt); 50 struct sg_table *sgt);
49int drm_gem_cma_prime_mmap(struct drm_gem_object *obj, 51int drm_gem_cma_prime_mmap(struct drm_gem_object *obj,
50 struct vm_area_struct *vma); 52 struct vm_area_struct *vma);
diff --git a/include/drm/drm_legacy.h b/include/drm/drm_legacy.h
new file mode 100644
index 000000000000..3e698038dc7b
--- /dev/null
+++ b/include/drm/drm_legacy.h
@@ -0,0 +1,203 @@
1#ifndef __DRM_DRM_LEGACY_H__
2#define __DRM_DRM_LEGACY_H__
3
4/*
5 * Legacy driver interfaces for the Direct Rendering Manager
6 *
7 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
8 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
9 * Copyright (c) 2009-2010, Code Aurora Forum.
10 * All rights reserved.
11 * Copyright © 2014 Intel Corporation
12 * Daniel Vetter <daniel.vetter@ffwll.ch>
13 *
14 * Author: Rickard E. (Rik) Faith <faith@valinux.com>
15 * Author: Gareth Hughes <gareth@valinux.com>
16 *
17 * Permission is hereby granted, free of charge, to any person obtaining a
18 * copy of this software and associated documentation files (the "Software"),
19 * to deal in the Software without restriction, including without limitation
20 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
21 * and/or sell copies of the Software, and to permit persons to whom the
22 * Software is furnished to do so, subject to the following conditions:
23 *
24 * The above copyright notice and this permission notice (including the next
25 * paragraph) shall be included in all copies or substantial portions of the
26 * Software.
27 *
28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
31 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
32 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
33 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
34 * OTHER DEALINGS IN THE SOFTWARE.
35 */
36
37
38/*
39 * Legacy Support for palateontologic DRM drivers
40 *
41 * If you add a new driver and it uses any of these functions or structures,
42 * you're doing it terribly wrong.
43 */
44
45/**
46 * DMA buffer.
47 */
48struct drm_buf {
49 int idx; /**< Index into master buflist */
50 int total; /**< Buffer size */
51 int order; /**< log-base-2(total) */
52 int used; /**< Amount of buffer in use (for DMA) */
53 unsigned long offset; /**< Byte offset (used internally) */
54 void *address; /**< Address of buffer */
55 unsigned long bus_address; /**< Bus address of buffer */
56 struct drm_buf *next; /**< Kernel-only: used for free list */
57 __volatile__ int waiting; /**< On kernel DMA queue */
58 __volatile__ int pending; /**< On hardware DMA queue */
59 struct drm_file *file_priv; /**< Private of holding file descr */
60 int context; /**< Kernel queue for this buffer */
61 int while_locked; /**< Dispatch this buffer while locked */
62 enum {
63 DRM_LIST_NONE = 0,
64 DRM_LIST_FREE = 1,
65 DRM_LIST_WAIT = 2,
66 DRM_LIST_PEND = 3,
67 DRM_LIST_PRIO = 4,
68 DRM_LIST_RECLAIM = 5
69 } list; /**< Which list we're on */
70
71 int dev_priv_size; /**< Size of buffer private storage */
72 void *dev_private; /**< Per-buffer private storage */
73};
74
75typedef struct drm_dma_handle {
76 dma_addr_t busaddr;
77 void *vaddr;
78 size_t size;
79} drm_dma_handle_t;
80
81/**
82 * Buffer entry. There is one of this for each buffer size order.
83 */
84struct drm_buf_entry {
85 int buf_size; /**< size */
86 int buf_count; /**< number of buffers */
87 struct drm_buf *buflist; /**< buffer list */
88 int seg_count;
89 int page_order;
90 struct drm_dma_handle **seglist;
91
92 int low_mark; /**< Low water mark */
93 int high_mark; /**< High water mark */
94};
95
96/**
97 * DMA data.
98 */
99struct drm_device_dma {
100
101 struct drm_buf_entry bufs[DRM_MAX_ORDER + 1]; /**< buffers, grouped by their size order */
102 int buf_count; /**< total number of buffers */
103 struct drm_buf **buflist; /**< Vector of pointers into drm_device_dma::bufs */
104 int seg_count;
105 int page_count; /**< number of pages */
106 unsigned long *pagelist; /**< page list */
107 unsigned long byte_count;
108 enum {
109 _DRM_DMA_USE_AGP = 0x01,
110 _DRM_DMA_USE_SG = 0x02,
111 _DRM_DMA_USE_FB = 0x04,
112 _DRM_DMA_USE_PCI_RO = 0x08
113 } flags;
114
115};
116
117/**
118 * Scatter-gather memory.
119 */
120struct drm_sg_mem {
121 unsigned long handle;
122 void *virtual;
123 int pages;
124 struct page **pagelist;
125 dma_addr_t *busaddr;
126};
127
128/**
129 * Kernel side of a mapping
130 */
131struct drm_local_map {
132 resource_size_t offset; /**< Requested physical address (0 for SAREA)*/
133 unsigned long size; /**< Requested physical size (bytes) */
134 enum drm_map_type type; /**< Type of memory to map */
135 enum drm_map_flags flags; /**< Flags */
136 void *handle; /**< User-space: "Handle" to pass to mmap() */
137 /**< Kernel-space: kernel-virtual address */
138 int mtrr; /**< MTRR slot used */
139};
140
141typedef struct drm_local_map drm_local_map_t;
142
143/**
144 * Mappings list
145 */
146struct drm_map_list {
147 struct list_head head; /**< list head */
148 struct drm_hash_item hash;
149 struct drm_local_map *map; /**< mapping */
150 uint64_t user_token;
151 struct drm_master *master;
152};
153
154int drm_legacy_addmap(struct drm_device *d, resource_size_t offset,
155 unsigned int size, enum drm_map_type type,
156 enum drm_map_flags flags, struct drm_local_map **map_p);
157int drm_legacy_rmmap(struct drm_device *d, struct drm_local_map *map);
158int drm_legacy_rmmap_locked(struct drm_device *d, struct drm_local_map *map);
159struct drm_local_map *drm_legacy_getsarea(struct drm_device *dev);
160int drm_legacy_mmap(struct file *filp, struct vm_area_struct *vma);
161
162int drm_legacy_addbufs_agp(struct drm_device *d, struct drm_buf_desc *req);
163int drm_legacy_addbufs_pci(struct drm_device *d, struct drm_buf_desc *req);
164
165/**
166 * Test that the hardware lock is held by the caller, returning otherwise.
167 *
168 * \param dev DRM device.
169 * \param filp file pointer of the caller.
170 */
171#define LOCK_TEST_WITH_RETURN( dev, _file_priv ) \
172do { \
173 if (!_DRM_LOCK_IS_HELD(_file_priv->master->lock.hw_lock->lock) || \
174 _file_priv->master->lock.file_priv != _file_priv) { \
175 DRM_ERROR( "%s called without lock held, held %d owner %p %p\n",\
176 __func__, _DRM_LOCK_IS_HELD(_file_priv->master->lock.hw_lock->lock),\
177 _file_priv->master->lock.file_priv, _file_priv); \
178 return -EINVAL; \
179 } \
180} while (0)
181
182void drm_legacy_idlelock_take(struct drm_lock_data *lock);
183void drm_legacy_idlelock_release(struct drm_lock_data *lock);
184
185/* drm_pci.c dma alloc wrappers */
186void __drm_legacy_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
187
188/* drm_memory.c */
189void drm_legacy_ioremap(struct drm_local_map *map, struct drm_device *dev);
190void drm_legacy_ioremap_wc(struct drm_local_map *map, struct drm_device *dev);
191void drm_legacy_ioremapfree(struct drm_local_map *map, struct drm_device *dev);
192
193static __inline__ struct drm_local_map *drm_legacy_findmap(struct drm_device *dev,
194 unsigned int token)
195{
196 struct drm_map_list *_entry;
197 list_for_each_entry(_entry, &dev->maplist, head)
198 if (_entry->user_token == token)
199 return _entry->map;
200 return NULL;
201}
202
203#endif /* __DRM_DRM_LEGACY_H__ */
diff --git a/include/drm/drm_memory.h b/include/drm/drm_memory.h
deleted file mode 100644
index 4baf57a207e7..000000000000
--- a/include/drm/drm_memory.h
+++ /dev/null
@@ -1,59 +0,0 @@
1/**
2 * \file drm_memory.h
3 * Memory management wrappers for DRM
4 *
5 * \author Rickard E. (Rik) Faith <faith@valinux.com>
6 * \author Gareth Hughes <gareth@valinux.com>
7 */
8
9/*
10 * Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com
11 *
12 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
13 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
14 * All Rights Reserved.
15 *
16 * Permission is hereby granted, free of charge, to any person obtaining a
17 * copy of this software and associated documentation files (the "Software"),
18 * to deal in the Software without restriction, including without limitation
19 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
20 * and/or sell copies of the Software, and to permit persons to whom the
21 * Software is furnished to do so, subject to the following conditions:
22 *
23 * The above copyright notice and this permission notice (including the next
24 * paragraph) shall be included in all copies or substantial portions of the
25 * Software.
26 *
27 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
30 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
31 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
32 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33 * OTHER DEALINGS IN THE SOFTWARE.
34 */
35
36#include <linux/highmem.h>
37#include <linux/vmalloc.h>
38#include <drm/drmP.h>
39
40/**
41 * Cut down version of drm_memory_debug.h, which used to be called
42 * drm_memory.h.
43 */
44
45#if __OS_HAS_AGP
46
47#ifdef HAVE_PAGE_AGP
48#include <asm/agp.h>
49#else
50# ifdef __powerpc__
51# define PAGE_AGP __pgprot(_PAGE_KERNEL | _PAGE_NO_CACHE)
52# else
53# define PAGE_AGP PAGE_KERNEL
54# endif
55#endif
56
57#else /* __OS_HAS_AGP */
58
59#endif
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 944f33f8ba38..8569dc5a1026 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -94,6 +94,10 @@ void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
94#define MIPI_DSI_MODE_VSYNC_FLUSH BIT(8) 94#define MIPI_DSI_MODE_VSYNC_FLUSH BIT(8)
95/* disable EoT packets in HS mode */ 95/* disable EoT packets in HS mode */
96#define MIPI_DSI_MODE_EOT_PACKET BIT(9) 96#define MIPI_DSI_MODE_EOT_PACKET BIT(9)
97/* device supports non-continuous clock behavior (DSI spec 5.6.1) */
98#define MIPI_DSI_CLOCK_NON_CONTINUOUS BIT(10)
99/* transmit data in low power */
100#define MIPI_DSI_MODE_LPM BIT(11)
97 101
98enum mipi_dsi_pixel_format { 102enum mipi_dsi_pixel_format {
99 MIPI_DSI_FMT_RGB888, 103 MIPI_DSI_FMT_RGB888,
@@ -121,14 +125,17 @@ struct mipi_dsi_device {
121 unsigned long mode_flags; 125 unsigned long mode_flags;
122}; 126};
123 127
124#define to_mipi_dsi_device(d) container_of(d, struct mipi_dsi_device, dev) 128static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev)
129{
130 return container_of(dev, struct mipi_dsi_device, dev);
131}
125 132
126int mipi_dsi_attach(struct mipi_dsi_device *dsi); 133int mipi_dsi_attach(struct mipi_dsi_device *dsi);
127int mipi_dsi_detach(struct mipi_dsi_device *dsi); 134int mipi_dsi_detach(struct mipi_dsi_device *dsi);
128int mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, unsigned int channel, 135ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, const void *data,
129 const void *data, size_t len); 136 size_t len);
130ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel, 137ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data,
131 u8 cmd, void *data, size_t len); 138 size_t len);
132 139
133/** 140/**
134 * struct mipi_dsi_driver - DSI driver 141 * struct mipi_dsi_driver - DSI driver
@@ -144,7 +151,11 @@ struct mipi_dsi_driver {
144 void (*shutdown)(struct mipi_dsi_device *dsi); 151 void (*shutdown)(struct mipi_dsi_device *dsi);
145}; 152};
146 153
147#define to_mipi_dsi_driver(d) container_of(d, struct mipi_dsi_driver, driver) 154static inline struct mipi_dsi_driver *
155to_mipi_dsi_driver(struct device_driver *driver)
156{
157 return container_of(driver, struct mipi_dsi_driver, driver);
158}
148 159
149static inline void *mipi_dsi_get_drvdata(const struct mipi_dsi_device *dsi) 160static inline void *mipi_dsi_get_drvdata(const struct mipi_dsi_device *dsi)
150{ 161{
diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h
index 402aa7a6a058..75a5c45e21c7 100644
--- a/include/drm/drm_modeset_lock.h
+++ b/include/drm/drm_modeset_lock.h
@@ -29,7 +29,7 @@
29struct drm_modeset_lock; 29struct drm_modeset_lock;
30 30
31/** 31/**
32 * drm_modeset_acquire_ctx - locking context (see ww_acquire_ctx) 32 * struct drm_modeset_acquire_ctx - locking context (see ww_acquire_ctx)
33 * @ww_ctx: base acquire ctx 33 * @ww_ctx: base acquire ctx
34 * @contended: used internally for -EDEADLK handling 34 * @contended: used internally for -EDEADLK handling
35 * @locked: list of held locks 35 * @locked: list of held locks
@@ -53,10 +53,15 @@ struct drm_modeset_acquire_ctx {
53 * list of held locks (drm_modeset_lock) 53 * list of held locks (drm_modeset_lock)
54 */ 54 */
55 struct list_head locked; 55 struct list_head locked;
56
57 /**
58 * Trylock mode, use only for panic handlers!
59 */
60 bool trylock_only;
56}; 61};
57 62
58/** 63/**
59 * drm_modeset_lock - used for locking modeset resources. 64 * struct drm_modeset_lock - used for locking modeset resources.
60 * @mutex: resource locking 65 * @mutex: resource locking
61 * @head: used to hold it's place on state->locked list when 66 * @head: used to hold it's place on state->locked list when
62 * part of an atomic update 67 * part of an atomic update
@@ -120,6 +125,17 @@ int drm_modeset_lock_interruptible(struct drm_modeset_lock *lock,
120void drm_modeset_unlock(struct drm_modeset_lock *lock); 125void drm_modeset_unlock(struct drm_modeset_lock *lock);
121 126
122struct drm_device; 127struct drm_device;
128struct drm_crtc;
129
130void drm_modeset_lock_all(struct drm_device *dev);
131int __drm_modeset_lock_all(struct drm_device *dev, bool trylock);
132void drm_modeset_unlock_all(struct drm_device *dev);
133void drm_modeset_lock_crtc(struct drm_crtc *crtc);
134void drm_modeset_unlock_crtc(struct drm_crtc *crtc);
135void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
136struct drm_modeset_acquire_ctx *
137drm_modeset_legacy_acquire_ctx(struct drm_crtc *crtc);
138
123int drm_modeset_lock_all_crtcs(struct drm_device *dev, 139int drm_modeset_lock_all_crtcs(struct drm_device *dev,
124 struct drm_modeset_acquire_ctx *ctx); 140 struct drm_modeset_acquire_ctx *ctx);
125 141
diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
new file mode 100644
index 000000000000..2441f7112074
--- /dev/null
+++ b/include/drm/drm_of.h
@@ -0,0 +1,18 @@
1#ifndef __DRM_OF_H__
2#define __DRM_OF_H__
3
4struct drm_device;
5struct device_node;
6
7#ifdef CONFIG_OF
8extern uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
9 struct device_node *port);
10#else
11static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
12 struct device_node *port)
13{
14 return 0;
15}
16#endif
17
18#endif /* __DRM_OF_H__ */
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index c2ab77add67c..1fbcc96063a7 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -30,8 +30,42 @@ struct drm_connector;
30struct drm_device; 30struct drm_device;
31struct drm_panel; 31struct drm_panel;
32 32
33/**
34 * struct drm_panel_funcs - perform operations on a given panel
35 * @disable: disable panel (turn off back light, etc.)
36 * @unprepare: turn off panel
37 * @prepare: turn on panel and perform set up
38 * @enable: enable panel (turn on back light, etc.)
39 * @get_modes: add modes to the connector that the panel is attached to and
40 * return the number of modes added
41 *
42 * 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
44 * on and wait for it to become ready. If additional configuration is required
45 * (via a control bus such as I2C, SPI or DSI for example) this is a good time
46 * to do that.
47 *
48 * After the display controller has started transmitting video data, it's safe
49 * to call the .enable() function. This will typically enable the backlight to
50 * make the image on screen visible. Some panels require a certain amount of
51 * time or frames before the image is displayed. This function is responsible
52 * for taking this into account before enabling the backlight to avoid visual
53 * glitches.
54 *
55 * Before stopping video transmission from the display controller it can be
56 * necessary to turn off the panel to avoid visual glitches. This is done in
57 * the .disable() function. Analogously to .enable() this typically involves
58 * turning off the backlight and waiting for some time to make sure no image
59 * is visible on the panel. It is then safe for the display controller to
60 * cease transmission of video data.
61 *
62 * To save power when no video data is transmitted, a driver can power down
63 * the panel. This is the job of the .unprepare() function.
64 */
33struct drm_panel_funcs { 65struct drm_panel_funcs {
34 int (*disable)(struct drm_panel *panel); 66 int (*disable)(struct drm_panel *panel);
67 int (*unprepare)(struct drm_panel *panel);
68 int (*prepare)(struct drm_panel *panel);
35 int (*enable)(struct drm_panel *panel); 69 int (*enable)(struct drm_panel *panel);
36 int (*get_modes)(struct drm_panel *panel); 70 int (*get_modes)(struct drm_panel *panel);
37}; 71};
@@ -46,6 +80,14 @@ struct drm_panel {
46 struct list_head list; 80 struct list_head list;
47}; 81};
48 82
83static inline int drm_panel_unprepare(struct drm_panel *panel)
84{
85 if (panel && panel->funcs && panel->funcs->unprepare)
86 return panel->funcs->unprepare(panel);
87
88 return panel ? -ENOSYS : -EINVAL;
89}
90
49static inline int drm_panel_disable(struct drm_panel *panel) 91static inline int drm_panel_disable(struct drm_panel *panel)
50{ 92{
51 if (panel && panel->funcs && panel->funcs->disable) 93 if (panel && panel->funcs && panel->funcs->disable)
@@ -54,6 +96,14 @@ static inline int drm_panel_disable(struct drm_panel *panel)
54 return panel ? -ENOSYS : -EINVAL; 96 return panel ? -ENOSYS : -EINVAL;
55} 97}
56 98
99static inline int drm_panel_prepare(struct drm_panel *panel)
100{
101 if (panel && panel->funcs && panel->funcs->prepare)
102 return panel->funcs->prepare(panel);
103
104 return panel ? -ENOSYS : -EINVAL;
105}
106
57static inline int drm_panel_enable(struct drm_panel *panel) 107static inline int drm_panel_enable(struct drm_panel *panel)
58{ 108{
59 if (panel && panel->funcs && panel->funcs->enable) 109 if (panel && panel->funcs && panel->funcs->enable)
@@ -62,6 +112,14 @@ static inline int drm_panel_enable(struct drm_panel *panel)
62 return panel ? -ENOSYS : -EINVAL; 112 return panel ? -ENOSYS : -EINVAL;
63} 113}
64 114
115static inline int drm_panel_get_modes(struct drm_panel *panel)
116{
117 if (panel && panel->funcs && panel->funcs->get_modes)
118 return panel->funcs->get_modes(panel);
119
120 return panel ? -ENOSYS : -EINVAL;
121}
122
65void drm_panel_init(struct drm_panel *panel); 123void drm_panel_init(struct drm_panel *panel);
66 124
67int drm_panel_add(struct drm_panel *panel); 125int drm_panel_add(struct drm_panel *panel);
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 6dfd64b3a604..2dd405c9be78 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -17,6 +17,7 @@
17 {0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 17 {0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
18 {0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 18 {0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
19 {0x1002, 0x1317, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 19 {0x1002, 0x1317, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
20 {0x1002, 0x1318, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
20 {0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 21 {0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
21 {0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 22 {0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
22 {0x1002, 0x131D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 23 {0x1002, 0x131D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
@@ -73,7 +74,6 @@
73 {0x1002, 0x4C64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ 74 {0x1002, 0x4C64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \
74 {0x1002, 0x4C66, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ 75 {0x1002, 0x4C66, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \
75 {0x1002, 0x4C67, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ 76 {0x1002, 0x4C67, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \
76 {0x1002, 0x4C6E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|RADEON_IS_MOBILITY}, \
77 {0x1002, 0x4E44, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ 77 {0x1002, 0x4E44, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \
78 {0x1002, 0x4E45, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ 78 {0x1002, 0x4E45, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \
79 {0x1002, 0x4E46, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ 79 {0x1002, 0x4E46, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \
@@ -164,8 +164,11 @@
164 {0x1002, 0x6601, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 164 {0x1002, 0x6601, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
165 {0x1002, 0x6602, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 165 {0x1002, 0x6602, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
166 {0x1002, 0x6603, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 166 {0x1002, 0x6603, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
167 {0x1002, 0x6604, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
168 {0x1002, 0x6605, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
167 {0x1002, 0x6606, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 169 {0x1002, 0x6606, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
168 {0x1002, 0x6607, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 170 {0x1002, 0x6607, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
171 {0x1002, 0x6608, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
169 {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ 172 {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
170 {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ 173 {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
171 {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ 174 {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
@@ -175,6 +178,8 @@
175 {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ 178 {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
176 {0x1002, 0x6640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 179 {0x1002, 0x6640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
177 {0x1002, 0x6641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 180 {0x1002, 0x6641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
181 {0x1002, 0x6646, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
182 {0x1002, 0x6647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
178 {0x1002, 0x6649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ 183 {0x1002, 0x6649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
179 {0x1002, 0x6650, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ 184 {0x1002, 0x6650, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
180 {0x1002, 0x6651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ 185 {0x1002, 0x6651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
@@ -297,6 +302,7 @@
297 {0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ 302 {0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
298 {0x1002, 0x682A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 303 {0x1002, 0x682A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
299 {0x1002, 0x682B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 304 {0x1002, 0x682B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
305 {0x1002, 0x682C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
300 {0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 306 {0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
301 {0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 307 {0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
302 {0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 308 {0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index d1286297567b..26bb55e9e8b6 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -163,5 +163,11 @@ int drm_rect_calc_vscale_relaxed(struct drm_rect *src,
163 struct drm_rect *dst, 163 struct drm_rect *dst,
164 int min_vscale, int max_vscale); 164 int min_vscale, int max_vscale);
165void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point); 165void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point);
166void drm_rect_rotate(struct drm_rect *r,
167 int width, int height,
168 unsigned int rotation);
169void drm_rect_rotate_inv(struct drm_rect *r,
170 int width, int height,
171 unsigned int rotation);
166 172
167#endif 173#endif
diff --git a/include/drm/drm_usb.h b/include/drm/drm_usb.h
deleted file mode 100644
index 33506c11da8b..000000000000
--- a/include/drm/drm_usb.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef DRM_USB_H
2#define DRM_USB_H
3
4#include <drmP.h>
5
6#include <linux/usb.h>
7
8extern int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver);
9extern void drm_usb_exit(struct drm_driver *driver, struct usb_driver *udriver);
10
11int drm_get_usb_dev(struct usb_interface *interface,
12 const struct usb_device_id *id,
13 struct drm_driver *driver);
14
15#endif
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 7526c5bf5610..0ccf7f267ff9 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -45,12 +45,24 @@ struct ttm_bo_device;
45 45
46struct drm_mm_node; 46struct drm_mm_node;
47 47
48/**
49 * struct ttm_place
50 *
51 * @fpfn: first valid page frame number to put the object
52 * @lpfn: last valid page frame number to put the object
53 * @flags: memory domain and caching flags for the object
54 *
55 * Structure indicating a possible place to put an object.
56 */
57struct ttm_place {
58 unsigned fpfn;
59 unsigned lpfn;
60 uint32_t flags;
61};
48 62
49/** 63/**
50 * struct ttm_placement 64 * struct ttm_placement
51 * 65 *
52 * @fpfn: first valid page frame number to put the object
53 * @lpfn: last valid page frame number to put the object
54 * @num_placement: number of preferred placements 66 * @num_placement: number of preferred placements
55 * @placement: preferred placements 67 * @placement: preferred placements
56 * @num_busy_placement: number of preferred placements when need to evict buffer 68 * @num_busy_placement: number of preferred placements when need to evict buffer
@@ -59,12 +71,10 @@ struct drm_mm_node;
59 * Structure indicating the placement you request for an object. 71 * Structure indicating the placement you request for an object.
60 */ 72 */
61struct ttm_placement { 73struct ttm_placement {
62 unsigned fpfn; 74 unsigned num_placement;
63 unsigned lpfn; 75 const struct ttm_place *placement;
64 unsigned num_placement; 76 unsigned num_busy_placement;
65 const uint32_t *placement; 77 const struct ttm_place *busy_placement;
66 unsigned num_busy_placement;
67 const uint32_t *busy_placement;
68}; 78};
69 79
70/** 80/**
@@ -163,7 +173,6 @@ struct ttm_tt;
163 * @lru: List head for the lru list. 173 * @lru: List head for the lru list.
164 * @ddestroy: List head for the delayed destroy list. 174 * @ddestroy: List head for the delayed destroy list.
165 * @swap: List head for swap LRU list. 175 * @swap: List head for swap LRU list.
166 * @sync_obj: Pointer to a synchronization object.
167 * @priv_flags: Flags describing buffer object internal state. 176 * @priv_flags: Flags describing buffer object internal state.
168 * @vma_node: Address space manager node. 177 * @vma_node: Address space manager node.
169 * @offset: The current GPU offset, which can have different meanings 178 * @offset: The current GPU offset, which can have different meanings
@@ -227,13 +236,9 @@ struct ttm_buffer_object {
227 struct list_head io_reserve_lru; 236 struct list_head io_reserve_lru;
228 237
229 /** 238 /**
230 * Members protected by struct buffer_object_device::fence_lock 239 * Members protected by a bo reservation.
231 * In addition, setting sync_obj to anything else
232 * than NULL requires bo::reserved to be held. This allows for
233 * checking NULL while reserved but not holding the mentioned lock.
234 */ 240 */
235 241
236 void *sync_obj;
237 unsigned long priv_flags; 242 unsigned long priv_flags;
238 243
239 struct drm_vma_offset_node vma_node; 244 struct drm_vma_offset_node vma_node;
@@ -455,6 +460,7 @@ size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev,
455 * point to the shmem object backing a GEM object if TTM is used to back a 460 * point to the shmem object backing a GEM object if TTM is used to back a
456 * GEM user interface. 461 * GEM user interface.
457 * @acc_size: Accounted size for this object. 462 * @acc_size: Accounted size for this object.
463 * @resv: Pointer to a reservation_object, or NULL to let ttm allocate one.
458 * @destroy: Destroy function. Use NULL for kfree(). 464 * @destroy: Destroy function. Use NULL for kfree().
459 * 465 *
460 * This function initializes a pre-allocated struct ttm_buffer_object. 466 * This function initializes a pre-allocated struct ttm_buffer_object.
@@ -482,6 +488,7 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
482 struct file *persistent_swap_storage, 488 struct file *persistent_swap_storage,
483 size_t acc_size, 489 size_t acc_size,
484 struct sg_table *sg, 490 struct sg_table *sg,
491 struct reservation_object *resv,
485 void (*destroy) (struct ttm_buffer_object *)); 492 void (*destroy) (struct ttm_buffer_object *));
486 493
487/** 494/**
@@ -519,20 +526,6 @@ extern int ttm_bo_create(struct ttm_bo_device *bdev,
519 struct ttm_buffer_object **p_bo); 526 struct ttm_buffer_object **p_bo);
520 527
521/** 528/**
522 * ttm_bo_check_placement
523 *
524 * @bo: the buffer object.
525 * @placement: placements
526 *
527 * Performs minimal validity checking on an intended change of
528 * placement flags.
529 * Returns
530 * -EINVAL: Intended change is invalid or not allowed.
531 */
532extern int ttm_bo_check_placement(struct ttm_buffer_object *bo,
533 struct ttm_placement *placement);
534
535/**
536 * ttm_bo_init_mm 529 * ttm_bo_init_mm
537 * 530 *
538 * @bdev: Pointer to a ttm_bo_device struct. 531 * @bdev: Pointer to a ttm_bo_device struct.
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index a5183da3ef92..142d752fc450 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -133,6 +133,7 @@ struct ttm_tt {
133 * struct ttm_dma_tt 133 * struct ttm_dma_tt
134 * 134 *
135 * @ttm: Base ttm_tt struct. 135 * @ttm: Base ttm_tt struct.
136 * @cpu_address: The CPU address of the pages
136 * @dma_address: The DMA (bus) addresses of the pages 137 * @dma_address: The DMA (bus) addresses of the pages
137 * @pages_list: used by some page allocation backend 138 * @pages_list: used by some page allocation backend
138 * 139 *
@@ -142,6 +143,7 @@ struct ttm_tt {
142 */ 143 */
143struct ttm_dma_tt { 144struct ttm_dma_tt {
144 struct ttm_tt ttm; 145 struct ttm_tt ttm;
146 void **cpu_address;
145 dma_addr_t *dma_address; 147 dma_addr_t *dma_address;
146 struct list_head pages_list; 148 struct list_head pages_list;
147}; 149};
@@ -182,6 +184,7 @@ struct ttm_mem_type_manager_func {
182 * @man: Pointer to a memory type manager. 184 * @man: Pointer to a memory type manager.
183 * @bo: Pointer to the buffer object we're allocating space for. 185 * @bo: Pointer to the buffer object we're allocating space for.
184 * @placement: Placement details. 186 * @placement: Placement details.
187 * @flags: Additional placement flags.
185 * @mem: Pointer to a struct ttm_mem_reg to be filled in. 188 * @mem: Pointer to a struct ttm_mem_reg to be filled in.
186 * 189 *
187 * This function should allocate space in the memory type managed 190 * This function should allocate space in the memory type managed
@@ -205,7 +208,7 @@ struct ttm_mem_type_manager_func {
205 */ 208 */
206 int (*get_node)(struct ttm_mem_type_manager *man, 209 int (*get_node)(struct ttm_mem_type_manager *man,
207 struct ttm_buffer_object *bo, 210 struct ttm_buffer_object *bo,
208 struct ttm_placement *placement, 211 const struct ttm_place *place,
209 struct ttm_mem_reg *mem); 212 struct ttm_mem_reg *mem);
210 213
211 /** 214 /**
@@ -309,11 +312,6 @@ struct ttm_mem_type_manager {
309 * @move: Callback for a driver to hook in accelerated functions to 312 * @move: Callback for a driver to hook in accelerated functions to
310 * move a buffer. 313 * move a buffer.
311 * If set to NULL, a potentially slow memcpy() move is used. 314 * If set to NULL, a potentially slow memcpy() move is used.
312 * @sync_obj_signaled: See ttm_fence_api.h
313 * @sync_obj_wait: See ttm_fence_api.h
314 * @sync_obj_flush: See ttm_fence_api.h
315 * @sync_obj_unref: See ttm_fence_api.h
316 * @sync_obj_ref: See ttm_fence_api.h
317 */ 315 */
318 316
319struct ttm_bo_driver { 317struct ttm_bo_driver {
@@ -415,23 +413,6 @@ struct ttm_bo_driver {
415 int (*verify_access) (struct ttm_buffer_object *bo, 413 int (*verify_access) (struct ttm_buffer_object *bo,
416 struct file *filp); 414 struct file *filp);
417 415
418 /**
419 * In case a driver writer dislikes the TTM fence objects,
420 * the driver writer can replace those with sync objects of
421 * his / her own. If it turns out that no driver writer is
422 * using these. I suggest we remove these hooks and plug in
423 * fences directly. The bo driver needs the following functionality:
424 * See the corresponding functions in the fence object API
425 * documentation.
426 */
427
428 bool (*sync_obj_signaled) (void *sync_obj);
429 int (*sync_obj_wait) (void *sync_obj,
430 bool lazy, bool interruptible);
431 int (*sync_obj_flush) (void *sync_obj);
432 void (*sync_obj_unref) (void **sync_obj);
433 void *(*sync_obj_ref) (void *sync_obj);
434
435 /* hook to notify driver about a driver move so it 416 /* hook to notify driver about a driver move so it
436 * can do tiling things */ 417 * can do tiling things */
437 void (*move_notify)(struct ttm_buffer_object *bo, 418 void (*move_notify)(struct ttm_buffer_object *bo,
@@ -518,8 +499,6 @@ struct ttm_bo_global {
518 * 499 *
519 * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver. 500 * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver.
520 * @man: An array of mem_type_managers. 501 * @man: An array of mem_type_managers.
521 * @fence_lock: Protects the synchronizing members on *all* bos belonging
522 * to this device.
523 * @vma_manager: Address space manager 502 * @vma_manager: Address space manager
524 * lru_lock: Spinlock that protects the buffer+device lru lists and 503 * lru_lock: Spinlock that protects the buffer+device lru lists and
525 * ddestroy lists. 504 * ddestroy lists.
@@ -539,7 +518,6 @@ struct ttm_bo_device {
539 struct ttm_bo_global *glob; 518 struct ttm_bo_global *glob;
540 struct ttm_bo_driver *driver; 519 struct ttm_bo_driver *driver;
541 struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES]; 520 struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES];
542 spinlock_t fence_lock;
543 521
544 /* 522 /*
545 * Protected by internal locks. 523 * Protected by internal locks.
@@ -653,18 +631,6 @@ extern void ttm_tt_unbind(struct ttm_tt *ttm);
653extern int ttm_tt_swapin(struct ttm_tt *ttm); 631extern int ttm_tt_swapin(struct ttm_tt *ttm);
654 632
655/** 633/**
656 * ttm_tt_cache_flush:
657 *
658 * @pages: An array of pointers to struct page:s to flush.
659 * @num_pages: Number of pages to flush.
660 *
661 * Flush the data of the indicated pages from the cpu caches.
662 * This is used when changing caching attributes of the pages from
663 * cache-coherent.
664 */
665extern void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages);
666
667/**
668 * ttm_tt_set_placement_caching: 634 * ttm_tt_set_placement_caching:
669 * 635 *
670 * @ttm A struct ttm_tt the backing pages of which will change caching policy. 636 * @ttm A struct ttm_tt the backing pages of which will change caching policy.
@@ -1034,7 +1000,7 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
1034 * ttm_bo_move_accel_cleanup. 1000 * ttm_bo_move_accel_cleanup.
1035 * 1001 *
1036 * @bo: A pointer to a struct ttm_buffer_object. 1002 * @bo: A pointer to a struct ttm_buffer_object.
1037 * @sync_obj: A sync object that signals when moving is complete. 1003 * @fence: A fence object that signals when moving is complete.
1038 * @evict: This is an evict move. Don't return until the buffer is idle. 1004 * @evict: This is an evict move. Don't return until the buffer is idle.
1039 * @no_wait_gpu: Return immediately if the GPU is busy. 1005 * @no_wait_gpu: Return immediately if the GPU is busy.
1040 * @new_mem: struct ttm_mem_reg indicating where to move. 1006 * @new_mem: struct ttm_mem_reg indicating where to move.
@@ -1048,7 +1014,7 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
1048 */ 1014 */
1049 1015
1050extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, 1016extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
1051 void *sync_obj, 1017 struct fence *fence,
1052 bool evict, bool no_wait_gpu, 1018 bool evict, bool no_wait_gpu,
1053 struct ttm_mem_reg *new_mem); 1019 struct ttm_mem_reg *new_mem);
1054/** 1020/**
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h
index 16db7d01a336..460441714413 100644
--- a/include/drm/ttm/ttm_execbuf_util.h
+++ b/include/drm/ttm/ttm_execbuf_util.h
@@ -39,19 +39,13 @@
39 * 39 *
40 * @head: list head for thread-private list. 40 * @head: list head for thread-private list.
41 * @bo: refcounted buffer object pointer. 41 * @bo: refcounted buffer object pointer.
42 * @reserved: Indicates whether @bo has been reserved for validation. 42 * @shared: should the fence be added shared?
43 * @removed: Indicates whether @bo has been removed from lru lists.
44 * @put_count: Number of outstanding references on bo::list_kref.
45 * @old_sync_obj: Pointer to a sync object about to be unreferenced
46 */ 43 */
47 44
48struct ttm_validate_buffer { 45struct ttm_validate_buffer {
49 struct list_head head; 46 struct list_head head;
50 struct ttm_buffer_object *bo; 47 struct ttm_buffer_object *bo;
51 bool reserved; 48 bool shared;
52 bool removed;
53 int put_count;
54 void *old_sync_obj;
55}; 49};
56 50
57/** 51/**
@@ -73,6 +67,7 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
73 * @ticket: [out] ww_acquire_ctx filled in by call, or NULL if only 67 * @ticket: [out] ww_acquire_ctx filled in by call, or NULL if only
74 * non-blocking reserves should be tried. 68 * non-blocking reserves should be tried.
75 * @list: thread private list of ttm_validate_buffer structs. 69 * @list: thread private list of ttm_validate_buffer structs.
70 * @intr: should the wait be interruptible
76 * 71 *
77 * Tries to reserve bos pointed to by the list entries for validation. 72 * Tries to reserve bos pointed to by the list entries for validation.
78 * If the function returns 0, all buffers are marked as "unfenced", 73 * If the function returns 0, all buffers are marked as "unfenced",
@@ -84,9 +79,9 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
84 * CPU write reservations to be cleared, and for other threads to 79 * CPU write reservations to be cleared, and for other threads to
85 * unreserve their buffers. 80 * unreserve their buffers.
86 * 81 *
87 * This function may return -ERESTART or -EAGAIN if the calling process 82 * If intr is set to true, this function may return -ERESTARTSYS if the
88 * receives a signal while waiting. In that case, no buffers on the list 83 * calling process receives a signal while waiting. In that case, no
89 * will be reserved upon return. 84 * buffers on the list will be reserved upon return.
90 * 85 *
91 * Buffers reserved by this function should be unreserved by 86 * Buffers reserved by this function should be unreserved by
92 * a call to either ttm_eu_backoff_reservation() or 87 * a call to either ttm_eu_backoff_reservation() or
@@ -95,14 +90,14 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
95 */ 90 */
96 91
97extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, 92extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
98 struct list_head *list); 93 struct list_head *list, bool intr);
99 94
100/** 95/**
101 * function ttm_eu_fence_buffer_objects. 96 * function ttm_eu_fence_buffer_objects.
102 * 97 *
103 * @ticket: ww_acquire_ctx from reserve call 98 * @ticket: ww_acquire_ctx from reserve call
104 * @list: thread private list of ttm_validate_buffer structs. 99 * @list: thread private list of ttm_validate_buffer structs.
105 * @sync_obj: The new sync object for the buffers. 100 * @fence: The new exclusive fence for the buffers.
106 * 101 *
107 * This function should be called when command submission is complete, and 102 * This function should be called when command submission is complete, and
108 * it will add a new sync object to bos pointed to by entries on @list. 103 * it will add a new sync object to bos pointed to by entries on @list.
@@ -111,6 +106,7 @@ extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
111 */ 106 */
112 107
113extern void ttm_eu_fence_buffer_objects(struct ww_acquire_ctx *ticket, 108extern void ttm_eu_fence_buffer_objects(struct ww_acquire_ctx *ticket,
114 struct list_head *list, void *sync_obj); 109 struct list_head *list,
110 struct fence *fence);
115 111
116#endif 112#endif
diff --git a/include/dt-bindings/clock/exynos3250.h b/include/dt-bindings/clock/exynos3250.h
index b535e9da7de6..961b9c130ea9 100644
--- a/include/dt-bindings/clock/exynos3250.h
+++ b/include/dt-bindings/clock/exynos3250.h
@@ -255,4 +255,31 @@
255 */ 255 */
256#define CLK_NR_CLKS 248 256#define CLK_NR_CLKS 248
257 257
258/*
259 * CMU DMC
260 */
261
262#define CLK_FOUT_BPLL 1
263#define CLK_FOUT_EPLL 2
264
265/* Muxes */
266#define CLK_MOUT_MPLL_MIF 8
267#define CLK_MOUT_BPLL 9
268#define CLK_MOUT_DPHY 10
269#define CLK_MOUT_DMC_BUS 11
270#define CLK_MOUT_EPLL 12
271
272/* Dividers */
273#define CLK_DIV_DMC 16
274#define CLK_DIV_DPHY 17
275#define CLK_DIV_DMC_PRE 18
276#define CLK_DIV_DMCP 19
277#define CLK_DIV_DMCD 20
278
279/*
280 * Total number of clocks of main CMU.
281 * NOTE: Must be equal to last clock ID increased by one.
282 */
283#define NR_CLKS_DMC 21
284
258#endif /* _DT_BINDINGS_CLOCK_SAMSUNG_EXYNOS3250_CLOCK_H */ 285#endif /* _DT_BINDINGS_CLOCK_SAMSUNG_EXYNOS3250_CLOCK_H */
diff --git a/include/dt-bindings/clock/exynos4.h b/include/dt-bindings/clock/exynos4.h
index 459bd2bd411f..34fe28c622d0 100644
--- a/include/dt-bindings/clock/exynos4.h
+++ b/include/dt-bindings/clock/exynos4.h
@@ -115,11 +115,11 @@
115#define CLK_SMMU_MFCR 275 115#define CLK_SMMU_MFCR 275
116#define CLK_G3D 276 116#define CLK_G3D 276
117#define CLK_G2D 277 117#define CLK_G2D 277
118#define CLK_ROTATOR 278 /* Exynos4210 only */ 118#define CLK_ROTATOR 278
119#define CLK_MDMA 279 /* Exynos4210 only */ 119#define CLK_MDMA 279
120#define CLK_SMMU_G2D 280 /* Exynos4210 only */ 120#define CLK_SMMU_G2D 280
121#define CLK_SMMU_ROTATOR 281 /* Exynos4210 only */ 121#define CLK_SMMU_ROTATOR 281
122#define CLK_SMMU_MDMA 282 /* Exynos4210 only */ 122#define CLK_SMMU_MDMA 282
123#define CLK_FIMD0 283 123#define CLK_FIMD0 283
124#define CLK_MIE0 284 124#define CLK_MIE0 284
125#define CLK_MDNIE0 285 /* Exynos4412 only */ 125#define CLK_MDNIE0 285 /* Exynos4412 only */
@@ -234,6 +234,8 @@
234#define CLK_MOUT_G3D1 393 234#define CLK_MOUT_G3D1 393
235#define CLK_MOUT_G3D 394 235#define CLK_MOUT_G3D 394
236#define CLK_ACLK400_MCUISP 395 /* Exynos4x12 only */ 236#define CLK_ACLK400_MCUISP 395 /* Exynos4x12 only */
237#define CLK_MOUT_HDMI 396
238#define CLK_MOUT_MIXER 397
237 239
238/* gate clocks - ppmu */ 240/* gate clocks - ppmu */
239#define CLK_PPMULEFT 400 241#define CLK_PPMULEFT 400
diff --git a/include/dt-bindings/clock/hix5hd2-clock.h b/include/dt-bindings/clock/hix5hd2-clock.h
index aad579a75802..fd29c174ba63 100644
--- a/include/dt-bindings/clock/hix5hd2-clock.h
+++ b/include/dt-bindings/clock/hix5hd2-clock.h
@@ -46,6 +46,7 @@
46#define HIX5HD2_SFC_MUX 64 46#define HIX5HD2_SFC_MUX 64
47#define HIX5HD2_MMC_MUX 65 47#define HIX5HD2_MMC_MUX 65
48#define HIX5HD2_FEPHY_MUX 66 48#define HIX5HD2_FEPHY_MUX 66
49#define HIX5HD2_SD_MUX 67
49 50
50/* gate clocks */ 51/* gate clocks */
51#define HIX5HD2_SFC_RST 128 52#define HIX5HD2_SFC_RST 128
@@ -53,6 +54,32 @@
53#define HIX5HD2_MMC_CIU_CLK 130 54#define HIX5HD2_MMC_CIU_CLK 130
54#define HIX5HD2_MMC_BIU_CLK 131 55#define HIX5HD2_MMC_BIU_CLK 131
55#define HIX5HD2_MMC_CIU_RST 132 56#define HIX5HD2_MMC_CIU_RST 132
57#define HIX5HD2_FWD_BUS_CLK 133
58#define HIX5HD2_FWD_SYS_CLK 134
59#define HIX5HD2_MAC0_PHY_CLK 135
60#define HIX5HD2_SD_CIU_CLK 136
61#define HIX5HD2_SD_BIU_CLK 137
62#define HIX5HD2_SD_CIU_RST 138
63#define HIX5HD2_WDG0_CLK 139
64#define HIX5HD2_WDG0_RST 140
65#define HIX5HD2_I2C0_CLK 141
66#define HIX5HD2_I2C0_RST 142
67#define HIX5HD2_I2C1_CLK 143
68#define HIX5HD2_I2C1_RST 144
69#define HIX5HD2_I2C2_CLK 145
70#define HIX5HD2_I2C2_RST 146
71#define HIX5HD2_I2C3_CLK 147
72#define HIX5HD2_I2C3_RST 148
73#define HIX5HD2_I2C4_CLK 149
74#define HIX5HD2_I2C4_RST 150
75#define HIX5HD2_I2C5_CLK 151
76#define HIX5HD2_I2C5_RST 152
77
78/* complex */
79#define HIX5HD2_MAC0_CLK 192
80#define HIX5HD2_MAC1_CLK 193
81#define HIX5HD2_SATA_CLK 194
82#define HIX5HD2_USB_CLK 195
56 83
57#define HIX5HD2_NR_CLKS 256 84#define HIX5HD2_NR_CLKS 256
58#endif /* __DTS_HIX5HD2_CLOCK_H */ 85#endif /* __DTS_HIX5HD2_CLOCK_H */
diff --git a/include/dt-bindings/clock/imx1-clock.h b/include/dt-bindings/clock/imx1-clock.h
new file mode 100644
index 000000000000..607bf01a31dd
--- /dev/null
+++ b/include/dt-bindings/clock/imx1-clock.h
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 */
9
10#ifndef __DT_BINDINGS_CLOCK_IMX1_H
11#define __DT_BINDINGS_CLOCK_IMX1_H
12
13#define IMX1_CLK_DUMMY 0
14#define IMX1_CLK_CLK32 1
15#define IMX1_CLK_CLK16M_EXT 2
16#define IMX1_CLK_CLK16M 3
17#define IMX1_CLK_CLK32_PREMULT 4
18#define IMX1_CLK_PREM 5
19#define IMX1_CLK_MPLL 6
20#define IMX1_CLK_MPLL_GATE 7
21#define IMX1_CLK_SPLL 8
22#define IMX1_CLK_SPLL_GATE 9
23#define IMX1_CLK_MCU 10
24#define IMX1_CLK_FCLK 11
25#define IMX1_CLK_HCLK 12
26#define IMX1_CLK_CLK48M 13
27#define IMX1_CLK_PER1 14
28#define IMX1_CLK_PER2 15
29#define IMX1_CLK_PER3 16
30#define IMX1_CLK_CLKO 17
31#define IMX1_CLK_UART3_GATE 18
32#define IMX1_CLK_SSI2_GATE 19
33#define IMX1_CLK_BROM_GATE 20
34#define IMX1_CLK_DMA_GATE 21
35#define IMX1_CLK_CSI_GATE 22
36#define IMX1_CLK_MMA_GATE 23
37#define IMX1_CLK_USBD_GATE 24
38#define IMX1_CLK_MAX 25
39
40#endif
diff --git a/include/dt-bindings/clock/imx21-clock.h b/include/dt-bindings/clock/imx21-clock.h
new file mode 100644
index 000000000000..b13596cf51b2
--- /dev/null
+++ b/include/dt-bindings/clock/imx21-clock.h
@@ -0,0 +1,80 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 */
9
10#ifndef __DT_BINDINGS_CLOCK_IMX21_H
11#define __DT_BINDINGS_CLOCK_IMX21_H
12
13#define IMX21_CLK_DUMMY 0
14#define IMX21_CLK_CKIL 1
15#define IMX21_CLK_CKIH 2
16#define IMX21_CLK_FPM 3
17#define IMX21_CLK_CKIH_DIV1P5 4
18#define IMX21_CLK_MPLL_GATE 5
19#define IMX21_CLK_SPLL_GATE 6
20#define IMX21_CLK_FPM_GATE 7
21#define IMX21_CLK_CKIH_GATE 8
22#define IMX21_CLK_MPLL_OSC_SEL 9
23#define IMX21_CLK_IPG 10
24#define IMX21_CLK_HCLK 11
25#define IMX21_CLK_MPLL_SEL 12
26#define IMX21_CLK_SPLL_SEL 13
27#define IMX21_CLK_SSI1_SEL 14
28#define IMX21_CLK_SSI2_SEL 15
29#define IMX21_CLK_USB_DIV 16
30#define IMX21_CLK_FCLK 17
31#define IMX21_CLK_MPLL 18
32#define IMX21_CLK_SPLL 19
33#define IMX21_CLK_NFC_DIV 20
34#define IMX21_CLK_SSI1_DIV 21
35#define IMX21_CLK_SSI2_DIV 22
36#define IMX21_CLK_PER1 23
37#define IMX21_CLK_PER2 24
38#define IMX21_CLK_PER3 25
39#define IMX21_CLK_PER4 26
40#define IMX21_CLK_UART1_IPG_GATE 27
41#define IMX21_CLK_UART2_IPG_GATE 28
42#define IMX21_CLK_UART3_IPG_GATE 29
43#define IMX21_CLK_UART4_IPG_GATE 30
44#define IMX21_CLK_CSPI1_IPG_GATE 31
45#define IMX21_CLK_CSPI2_IPG_GATE 32
46#define IMX21_CLK_SSI1_GATE 33
47#define IMX21_CLK_SSI2_GATE 34
48#define IMX21_CLK_SDHC1_IPG_GATE 35
49#define IMX21_CLK_SDHC2_IPG_GATE 36
50#define IMX21_CLK_GPIO_GATE 37
51#define IMX21_CLK_I2C_GATE 38
52#define IMX21_CLK_DMA_GATE 39
53#define IMX21_CLK_USB_GATE 40
54#define IMX21_CLK_EMMA_GATE 41
55#define IMX21_CLK_SSI2_BAUD_GATE 42
56#define IMX21_CLK_SSI1_BAUD_GATE 43
57#define IMX21_CLK_LCDC_IPG_GATE 44
58#define IMX21_CLK_NFC_GATE 45
59#define IMX21_CLK_LCDC_HCLK_GATE 46
60#define IMX21_CLK_PER4_GATE 47
61#define IMX21_CLK_BMI_GATE 48
62#define IMX21_CLK_USB_HCLK_GATE 49
63#define IMX21_CLK_SLCDC_GATE 50
64#define IMX21_CLK_SLCDC_HCLK_GATE 51
65#define IMX21_CLK_EMMA_HCLK_GATE 52
66#define IMX21_CLK_BROM_GATE 53
67#define IMX21_CLK_DMA_HCLK_GATE 54
68#define IMX21_CLK_CSI_HCLK_GATE 55
69#define IMX21_CLK_CSPI3_IPG_GATE 56
70#define IMX21_CLK_WDOG_GATE 57
71#define IMX21_CLK_GPT1_IPG_GATE 58
72#define IMX21_CLK_GPT2_IPG_GATE 59
73#define IMX21_CLK_GPT3_IPG_GATE 60
74#define IMX21_CLK_PWM_IPG_GATE 61
75#define IMX21_CLK_RTC_GATE 62
76#define IMX21_CLK_KPP_GATE 63
77#define IMX21_CLK_OWIRE_GATE 64
78#define IMX21_CLK_MAX 65
79
80#endif
diff --git a/include/dt-bindings/clock/imx27-clock.h b/include/dt-bindings/clock/imx27-clock.h
new file mode 100644
index 000000000000..148b053e54ec
--- /dev/null
+++ b/include/dt-bindings/clock/imx27-clock.h
@@ -0,0 +1,108 @@
1/*
2 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 */
9
10#ifndef __DT_BINDINGS_CLOCK_IMX27_H
11#define __DT_BINDINGS_CLOCK_IMX27_H
12
13#define IMX27_CLK_DUMMY 0
14#define IMX27_CLK_CKIH 1
15#define IMX27_CLK_CKIL 2
16#define IMX27_CLK_MPLL 3
17#define IMX27_CLK_SPLL 4
18#define IMX27_CLK_MPLL_MAIN2 5
19#define IMX27_CLK_AHB 6
20#define IMX27_CLK_IPG 7
21#define IMX27_CLK_NFC_DIV 8
22#define IMX27_CLK_PER1_DIV 9
23#define IMX27_CLK_PER2_DIV 10
24#define IMX27_CLK_PER3_DIV 11
25#define IMX27_CLK_PER4_DIV 12
26#define IMX27_CLK_VPU_SEL 13
27#define IMX27_CLK_VPU_DIV 14
28#define IMX27_CLK_USB_DIV 15
29#define IMX27_CLK_CPU_SEL 16
30#define IMX27_CLK_CLKO_SEL 17
31#define IMX27_CLK_CPU_DIV 18
32#define IMX27_CLK_CLKO_DIV 19
33#define IMX27_CLK_SSI1_SEL 20
34#define IMX27_CLK_SSI2_SEL 21
35#define IMX27_CLK_SSI1_DIV 22
36#define IMX27_CLK_SSI2_DIV 23
37#define IMX27_CLK_CLKO_EN 24
38#define IMX27_CLK_SSI2_IPG_GATE 25
39#define IMX27_CLK_SSI1_IPG_GATE 26
40#define IMX27_CLK_SLCDC_IPG_GATE 27
41#define IMX27_CLK_SDHC3_IPG_GATE 28
42#define IMX27_CLK_SDHC2_IPG_GATE 29
43#define IMX27_CLK_SDHC1_IPG_GATE 30
44#define IMX27_CLK_SCC_IPG_GATE 31
45#define IMX27_CLK_SAHARA_IPG_GATE 32
46#define IMX27_CLK_RTC_IPG_GATE 33
47#define IMX27_CLK_PWM_IPG_GATE 34
48#define IMX27_CLK_OWIRE_IPG_GATE 35
49#define IMX27_CLK_LCDC_IPG_GATE 36
50#define IMX27_CLK_KPP_IPG_GATE 37
51#define IMX27_CLK_IIM_IPG_GATE 38
52#define IMX27_CLK_I2C2_IPG_GATE 39
53#define IMX27_CLK_I2C1_IPG_GATE 40
54#define IMX27_CLK_GPT6_IPG_GATE 41
55#define IMX27_CLK_GPT5_IPG_GATE 42
56#define IMX27_CLK_GPT4_IPG_GATE 43
57#define IMX27_CLK_GPT3_IPG_GATE 44
58#define IMX27_CLK_GPT2_IPG_GATE 45
59#define IMX27_CLK_GPT1_IPG_GATE 46
60#define IMX27_CLK_GPIO_IPG_GATE 47
61#define IMX27_CLK_FEC_IPG_GATE 48
62#define IMX27_CLK_EMMA_IPG_GATE 49
63#define IMX27_CLK_DMA_IPG_GATE 50
64#define IMX27_CLK_CSPI3_IPG_GATE 51
65#define IMX27_CLK_CSPI2_IPG_GATE 52
66#define IMX27_CLK_CSPI1_IPG_GATE 53
67#define IMX27_CLK_NFC_BAUD_GATE 54
68#define IMX27_CLK_SSI2_BAUD_GATE 55
69#define IMX27_CLK_SSI1_BAUD_GATE 56
70#define IMX27_CLK_VPU_BAUD_GATE 57
71#define IMX27_CLK_PER4_GATE 58
72#define IMX27_CLK_PER3_GATE 59
73#define IMX27_CLK_PER2_GATE 60
74#define IMX27_CLK_PER1_GATE 61
75#define IMX27_CLK_USB_AHB_GATE 62
76#define IMX27_CLK_SLCDC_AHB_GATE 63
77#define IMX27_CLK_SAHARA_AHB_GATE 64
78#define IMX27_CLK_LCDC_AHB_GATE 65
79#define IMX27_CLK_VPU_AHB_GATE 66
80#define IMX27_CLK_FEC_AHB_GATE 67
81#define IMX27_CLK_EMMA_AHB_GATE 68
82#define IMX27_CLK_EMI_AHB_GATE 69
83#define IMX27_CLK_DMA_AHB_GATE 70
84#define IMX27_CLK_CSI_AHB_GATE 71
85#define IMX27_CLK_BROM_AHB_GATE 72
86#define IMX27_CLK_ATA_AHB_GATE 73
87#define IMX27_CLK_WDOG_IPG_GATE 74
88#define IMX27_CLK_USB_IPG_GATE 75
89#define IMX27_CLK_UART6_IPG_GATE 76
90#define IMX27_CLK_UART5_IPG_GATE 77
91#define IMX27_CLK_UART4_IPG_GATE 78
92#define IMX27_CLK_UART3_IPG_GATE 79
93#define IMX27_CLK_UART2_IPG_GATE 80
94#define IMX27_CLK_UART1_IPG_GATE 81
95#define IMX27_CLK_CKIH_DIV1P5 82
96#define IMX27_CLK_FPM 83
97#define IMX27_CLK_MPLL_OSC_SEL 84
98#define IMX27_CLK_MPLL_SEL 85
99#define IMX27_CLK_SPLL_GATE 86
100#define IMX27_CLK_MSHC_DIV 87
101#define IMX27_CLK_RTIC_IPG_GATE 88
102#define IMX27_CLK_MSHC_IPG_GATE 89
103#define IMX27_CLK_RTIC_AHB_GATE 90
104#define IMX27_CLK_MSHC_BAUD_GATE 91
105#define IMX27_CLK_CKIH_GATE 92
106#define IMX27_CLK_MAX 93
107
108#endif
diff --git a/include/dt-bindings/clock/imx6qdl-clock.h b/include/dt-bindings/clock/imx6qdl-clock.h
new file mode 100644
index 000000000000..b690cdba163b
--- /dev/null
+++ b/include/dt-bindings/clock/imx6qdl-clock.h
@@ -0,0 +1,253 @@
1/*
2 * Copyright 2014 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __DT_BINDINGS_CLOCK_IMX6QDL_H
10#define __DT_BINDINGS_CLOCK_IMX6QDL_H
11
12#define IMX6QDL_CLK_DUMMY 0
13#define IMX6QDL_CLK_CKIL 1
14#define IMX6QDL_CLK_CKIH 2
15#define IMX6QDL_CLK_OSC 3
16#define IMX6QDL_CLK_PLL2_PFD0_352M 4
17#define IMX6QDL_CLK_PLL2_PFD1_594M 5
18#define IMX6QDL_CLK_PLL2_PFD2_396M 6
19#define IMX6QDL_CLK_PLL3_PFD0_720M 7
20#define IMX6QDL_CLK_PLL3_PFD1_540M 8
21#define IMX6QDL_CLK_PLL3_PFD2_508M 9
22#define IMX6QDL_CLK_PLL3_PFD3_454M 10
23#define IMX6QDL_CLK_PLL2_198M 11
24#define IMX6QDL_CLK_PLL3_120M 12
25#define IMX6QDL_CLK_PLL3_80M 13
26#define IMX6QDL_CLK_PLL3_60M 14
27#define IMX6QDL_CLK_TWD 15
28#define IMX6QDL_CLK_STEP 16
29#define IMX6QDL_CLK_PLL1_SW 17
30#define IMX6QDL_CLK_PERIPH_PRE 18
31#define IMX6QDL_CLK_PERIPH2_PRE 19
32#define IMX6QDL_CLK_PERIPH_CLK2_SEL 20
33#define IMX6QDL_CLK_PERIPH2_CLK2_SEL 21
34#define IMX6QDL_CLK_AXI_SEL 22
35#define IMX6QDL_CLK_ESAI_SEL 23
36#define IMX6QDL_CLK_ASRC_SEL 24
37#define IMX6QDL_CLK_SPDIF_SEL 25
38#define IMX6QDL_CLK_GPU2D_AXI 26
39#define IMX6QDL_CLK_GPU3D_AXI 27
40#define IMX6QDL_CLK_GPU2D_CORE_SEL 28
41#define IMX6QDL_CLK_GPU3D_CORE_SEL 29
42#define IMX6QDL_CLK_GPU3D_SHADER_SEL 30
43#define IMX6QDL_CLK_IPU1_SEL 31
44#define IMX6QDL_CLK_IPU2_SEL 32
45#define IMX6QDL_CLK_LDB_DI0_SEL 33
46#define IMX6QDL_CLK_LDB_DI1_SEL 34
47#define IMX6QDL_CLK_IPU1_DI0_PRE_SEL 35
48#define IMX6QDL_CLK_IPU1_DI1_PRE_SEL 36
49#define IMX6QDL_CLK_IPU2_DI0_PRE_SEL 37
50#define IMX6QDL_CLK_IPU2_DI1_PRE_SEL 38
51#define IMX6QDL_CLK_IPU1_DI0_SEL 39
52#define IMX6QDL_CLK_IPU1_DI1_SEL 40
53#define IMX6QDL_CLK_IPU2_DI0_SEL 41
54#define IMX6QDL_CLK_IPU2_DI1_SEL 42
55#define IMX6QDL_CLK_HSI_TX_SEL 43
56#define IMX6QDL_CLK_PCIE_AXI_SEL 44
57#define IMX6QDL_CLK_SSI1_SEL 45
58#define IMX6QDL_CLK_SSI2_SEL 46
59#define IMX6QDL_CLK_SSI3_SEL 47
60#define IMX6QDL_CLK_USDHC1_SEL 48
61#define IMX6QDL_CLK_USDHC2_SEL 49
62#define IMX6QDL_CLK_USDHC3_SEL 50
63#define IMX6QDL_CLK_USDHC4_SEL 51
64#define IMX6QDL_CLK_ENFC_SEL 52
65#define IMX6QDL_CLK_EIM_SEL 53
66#define IMX6QDL_CLK_EIM_SLOW_SEL 54
67#define IMX6QDL_CLK_VDO_AXI_SEL 55
68#define IMX6QDL_CLK_VPU_AXI_SEL 56
69#define IMX6QDL_CLK_CKO1_SEL 57
70#define IMX6QDL_CLK_PERIPH 58
71#define IMX6QDL_CLK_PERIPH2 59
72#define IMX6QDL_CLK_PERIPH_CLK2 60
73#define IMX6QDL_CLK_PERIPH2_CLK2 61
74#define IMX6QDL_CLK_IPG 62
75#define IMX6QDL_CLK_IPG_PER 63
76#define IMX6QDL_CLK_ESAI_PRED 64
77#define IMX6QDL_CLK_ESAI_PODF 65
78#define IMX6QDL_CLK_ASRC_PRED 66
79#define IMX6QDL_CLK_ASRC_PODF 67
80#define IMX6QDL_CLK_SPDIF_PRED 68
81#define IMX6QDL_CLK_SPDIF_PODF 69
82#define IMX6QDL_CLK_CAN_ROOT 70
83#define IMX6QDL_CLK_ECSPI_ROOT 71
84#define IMX6QDL_CLK_GPU2D_CORE_PODF 72
85#define IMX6QDL_CLK_GPU3D_CORE_PODF 73
86#define IMX6QDL_CLK_GPU3D_SHADER 74
87#define IMX6QDL_CLK_IPU1_PODF 75
88#define IMX6QDL_CLK_IPU2_PODF 76
89#define IMX6QDL_CLK_LDB_DI0_PODF 77
90#define IMX6QDL_CLK_LDB_DI1_PODF 78
91#define IMX6QDL_CLK_IPU1_DI0_PRE 79
92#define IMX6QDL_CLK_IPU1_DI1_PRE 80
93#define IMX6QDL_CLK_IPU2_DI0_PRE 81
94#define IMX6QDL_CLK_IPU2_DI1_PRE 82
95#define IMX6QDL_CLK_HSI_TX_PODF 83
96#define IMX6QDL_CLK_SSI1_PRED 84
97#define IMX6QDL_CLK_SSI1_PODF 85
98#define IMX6QDL_CLK_SSI2_PRED 86
99#define IMX6QDL_CLK_SSI2_PODF 87
100#define IMX6QDL_CLK_SSI3_PRED 88
101#define IMX6QDL_CLK_SSI3_PODF 89
102#define IMX6QDL_CLK_UART_SERIAL_PODF 90
103#define IMX6QDL_CLK_USDHC1_PODF 91
104#define IMX6QDL_CLK_USDHC2_PODF 92
105#define IMX6QDL_CLK_USDHC3_PODF 93
106#define IMX6QDL_CLK_USDHC4_PODF 94
107#define IMX6QDL_CLK_ENFC_PRED 95
108#define IMX6QDL_CLK_ENFC_PODF 96
109#define IMX6QDL_CLK_EIM_PODF 97
110#define IMX6QDL_CLK_EIM_SLOW_PODF 98
111#define IMX6QDL_CLK_VPU_AXI_PODF 99
112#define IMX6QDL_CLK_CKO1_PODF 100
113#define IMX6QDL_CLK_AXI 101
114#define IMX6QDL_CLK_MMDC_CH0_AXI_PODF 102
115#define IMX6QDL_CLK_MMDC_CH1_AXI_PODF 103
116#define IMX6QDL_CLK_ARM 104
117#define IMX6QDL_CLK_AHB 105
118#define IMX6QDL_CLK_APBH_DMA 106
119#define IMX6QDL_CLK_ASRC 107
120#define IMX6QDL_CLK_CAN1_IPG 108
121#define IMX6QDL_CLK_CAN1_SERIAL 109
122#define IMX6QDL_CLK_CAN2_IPG 110
123#define IMX6QDL_CLK_CAN2_SERIAL 111
124#define IMX6QDL_CLK_ECSPI1 112
125#define IMX6QDL_CLK_ECSPI2 113
126#define IMX6QDL_CLK_ECSPI3 114
127#define IMX6QDL_CLK_ECSPI4 115
128#define IMX6Q_CLK_ECSPI5 116
129#define IMX6DL_CLK_I2C4 116
130#define IMX6QDL_CLK_ENET 117
131#define IMX6QDL_CLK_ESAI_EXTAL 118
132#define IMX6QDL_CLK_GPT_IPG 119
133#define IMX6QDL_CLK_GPT_IPG_PER 120
134#define IMX6QDL_CLK_GPU2D_CORE 121
135#define IMX6QDL_CLK_GPU3D_CORE 122
136#define IMX6QDL_CLK_HDMI_IAHB 123
137#define IMX6QDL_CLK_HDMI_ISFR 124
138#define IMX6QDL_CLK_I2C1 125
139#define IMX6QDL_CLK_I2C2 126
140#define IMX6QDL_CLK_I2C3 127
141#define IMX6QDL_CLK_IIM 128
142#define IMX6QDL_CLK_ENFC 129
143#define IMX6QDL_CLK_IPU1 130
144#define IMX6QDL_CLK_IPU1_DI0 131
145#define IMX6QDL_CLK_IPU1_DI1 132
146#define IMX6QDL_CLK_IPU2 133
147#define IMX6QDL_CLK_IPU2_DI0 134
148#define IMX6QDL_CLK_LDB_DI0 135
149#define IMX6QDL_CLK_LDB_DI1 136
150#define IMX6QDL_CLK_IPU2_DI1 137
151#define IMX6QDL_CLK_HSI_TX 138
152#define IMX6QDL_CLK_MLB 139
153#define IMX6QDL_CLK_MMDC_CH0_AXI 140
154#define IMX6QDL_CLK_MMDC_CH1_AXI 141
155#define IMX6QDL_CLK_OCRAM 142
156#define IMX6QDL_CLK_OPENVG_AXI 143
157#define IMX6QDL_CLK_PCIE_AXI 144
158#define IMX6QDL_CLK_PWM1 145
159#define IMX6QDL_CLK_PWM2 146
160#define IMX6QDL_CLK_PWM3 147
161#define IMX6QDL_CLK_PWM4 148
162#define IMX6QDL_CLK_PER1_BCH 149
163#define IMX6QDL_CLK_GPMI_BCH_APB 150
164#define IMX6QDL_CLK_GPMI_BCH 151
165#define IMX6QDL_CLK_GPMI_IO 152
166#define IMX6QDL_CLK_GPMI_APB 153
167#define IMX6QDL_CLK_SATA 154
168#define IMX6QDL_CLK_SDMA 155
169#define IMX6QDL_CLK_SPBA 156
170#define IMX6QDL_CLK_SSI1 157
171#define IMX6QDL_CLK_SSI2 158
172#define IMX6QDL_CLK_SSI3 159
173#define IMX6QDL_CLK_UART_IPG 160
174#define IMX6QDL_CLK_UART_SERIAL 161
175#define IMX6QDL_CLK_USBOH3 162
176#define IMX6QDL_CLK_USDHC1 163
177#define IMX6QDL_CLK_USDHC2 164
178#define IMX6QDL_CLK_USDHC3 165
179#define IMX6QDL_CLK_USDHC4 166
180#define IMX6QDL_CLK_VDO_AXI 167
181#define IMX6QDL_CLK_VPU_AXI 168
182#define IMX6QDL_CLK_CKO1 169
183#define IMX6QDL_CLK_PLL1_SYS 170
184#define IMX6QDL_CLK_PLL2_BUS 171
185#define IMX6QDL_CLK_PLL3_USB_OTG 172
186#define IMX6QDL_CLK_PLL4_AUDIO 173
187#define IMX6QDL_CLK_PLL5_VIDEO 174
188#define IMX6QDL_CLK_PLL8_MLB 175
189#define IMX6QDL_CLK_PLL7_USB_HOST 176
190#define IMX6QDL_CLK_PLL6_ENET 177
191#define IMX6QDL_CLK_SSI1_IPG 178
192#define IMX6QDL_CLK_SSI2_IPG 179
193#define IMX6QDL_CLK_SSI3_IPG 180
194#define IMX6QDL_CLK_ROM 181
195#define IMX6QDL_CLK_USBPHY1 182
196#define IMX6QDL_CLK_USBPHY2 183
197#define IMX6QDL_CLK_LDB_DI0_DIV_3_5 184
198#define IMX6QDL_CLK_LDB_DI1_DIV_3_5 185
199#define IMX6QDL_CLK_SATA_REF 186
200#define IMX6QDL_CLK_SATA_REF_100M 187
201#define IMX6QDL_CLK_PCIE_REF 188
202#define IMX6QDL_CLK_PCIE_REF_125M 189
203#define IMX6QDL_CLK_ENET_REF 190
204#define IMX6QDL_CLK_USBPHY1_GATE 191
205#define IMX6QDL_CLK_USBPHY2_GATE 192
206#define IMX6QDL_CLK_PLL4_POST_DIV 193
207#define IMX6QDL_CLK_PLL5_POST_DIV 194
208#define IMX6QDL_CLK_PLL5_VIDEO_DIV 195
209#define IMX6QDL_CLK_EIM_SLOW 196
210#define IMX6QDL_CLK_SPDIF 197
211#define IMX6QDL_CLK_CKO2_SEL 198
212#define IMX6QDL_CLK_CKO2_PODF 199
213#define IMX6QDL_CLK_CKO2 200
214#define IMX6QDL_CLK_CKO 201
215#define IMX6QDL_CLK_VDOA 202
216#define IMX6QDL_CLK_PLL4_AUDIO_DIV 203
217#define IMX6QDL_CLK_LVDS1_SEL 204
218#define IMX6QDL_CLK_LVDS2_SEL 205
219#define IMX6QDL_CLK_LVDS1_GATE 206
220#define IMX6QDL_CLK_LVDS2_GATE 207
221#define IMX6QDL_CLK_ESAI_IPG 208
222#define IMX6QDL_CLK_ESAI_MEM 209
223#define IMX6QDL_CLK_ASRC_IPG 210
224#define IMX6QDL_CLK_ASRC_MEM 211
225#define IMX6QDL_CLK_LVDS1_IN 212
226#define IMX6QDL_CLK_LVDS2_IN 213
227#define IMX6QDL_CLK_ANACLK1 214
228#define IMX6QDL_CLK_ANACLK2 215
229#define IMX6QDL_PLL1_BYPASS_SRC 216
230#define IMX6QDL_PLL2_BYPASS_SRC 217
231#define IMX6QDL_PLL3_BYPASS_SRC 218
232#define IMX6QDL_PLL4_BYPASS_SRC 219
233#define IMX6QDL_PLL5_BYPASS_SRC 220
234#define IMX6QDL_PLL6_BYPASS_SRC 221
235#define IMX6QDL_PLL7_BYPASS_SRC 222
236#define IMX6QDL_CLK_PLL1 223
237#define IMX6QDL_CLK_PLL2 224
238#define IMX6QDL_CLK_PLL3 225
239#define IMX6QDL_CLK_PLL4 226
240#define IMX6QDL_CLK_PLL5 227
241#define IMX6QDL_CLK_PLL6 228
242#define IMX6QDL_CLK_PLL7 229
243#define IMX6QDL_PLL1_BYPASS 230
244#define IMX6QDL_PLL2_BYPASS 231
245#define IMX6QDL_PLL3_BYPASS 232
246#define IMX6QDL_PLL4_BYPASS 233
247#define IMX6QDL_PLL5_BYPASS 234
248#define IMX6QDL_PLL6_BYPASS 235
249#define IMX6QDL_PLL7_BYPASS 236
250#define IMX6QDL_CLK_GPT_3M 237
251#define IMX6QDL_CLK_END 238
252
253#endif /* __DT_BINDINGS_CLOCK_IMX6QDL_H */
diff --git a/include/dt-bindings/clock/imx6sl-clock.h b/include/dt-bindings/clock/imx6sl-clock.h
index b91dd462ba85..9ce4e421096f 100644
--- a/include/dt-bindings/clock/imx6sl-clock.h
+++ b/include/dt-bindings/clock/imx6sl-clock.h
@@ -146,6 +146,34 @@
146#define IMX6SL_CLK_PLL4_AUDIO_DIV 133 146#define IMX6SL_CLK_PLL4_AUDIO_DIV 133
147#define IMX6SL_CLK_SPBA 134 147#define IMX6SL_CLK_SPBA 134
148#define IMX6SL_CLK_ENET 135 148#define IMX6SL_CLK_ENET 135
149#define IMX6SL_CLK_END 136 149#define IMX6SL_CLK_LVDS1_SEL 136
150#define IMX6SL_CLK_LVDS1_OUT 137
151#define IMX6SL_CLK_LVDS1_IN 138
152#define IMX6SL_CLK_ANACLK1 139
153#define IMX6SL_PLL1_BYPASS_SRC 140
154#define IMX6SL_PLL2_BYPASS_SRC 141
155#define IMX6SL_PLL3_BYPASS_SRC 142
156#define IMX6SL_PLL4_BYPASS_SRC 143
157#define IMX6SL_PLL5_BYPASS_SRC 144
158#define IMX6SL_PLL6_BYPASS_SRC 145
159#define IMX6SL_PLL7_BYPASS_SRC 146
160#define IMX6SL_CLK_PLL1 147
161#define IMX6SL_CLK_PLL2 148
162#define IMX6SL_CLK_PLL3 149
163#define IMX6SL_CLK_PLL4 150
164#define IMX6SL_CLK_PLL5 151
165#define IMX6SL_CLK_PLL6 152
166#define IMX6SL_CLK_PLL7 153
167#define IMX6SL_PLL1_BYPASS 154
168#define IMX6SL_PLL2_BYPASS 155
169#define IMX6SL_PLL3_BYPASS 156
170#define IMX6SL_PLL4_BYPASS 157
171#define IMX6SL_PLL5_BYPASS 158
172#define IMX6SL_PLL6_BYPASS 159
173#define IMX6SL_PLL7_BYPASS 160
174#define IMX6SL_CLK_SSI1_IPG 161
175#define IMX6SL_CLK_SSI2_IPG 162
176#define IMX6SL_CLK_SSI3_IPG 163
177#define IMX6SL_CLK_END 164
150 178
151#endif /* __DT_BINDINGS_CLOCK_IMX6SL_H */ 179#endif /* __DT_BINDINGS_CLOCK_IMX6SL_H */
diff --git a/include/dt-bindings/clock/imx6sx-clock.h b/include/dt-bindings/clock/imx6sx-clock.h
index 421d8bb76f2f..995709119ec5 100644
--- a/include/dt-bindings/clock/imx6sx-clock.h
+++ b/include/dt-bindings/clock/imx6sx-clock.h
@@ -251,6 +251,29 @@
251#define IMX6SX_CLK_SAI2_IPG 238 251#define IMX6SX_CLK_SAI2_IPG 238
252#define IMX6SX_CLK_ESAI_IPG 239 252#define IMX6SX_CLK_ESAI_IPG 239
253#define IMX6SX_CLK_ESAI_MEM 240 253#define IMX6SX_CLK_ESAI_MEM 240
254#define IMX6SX_CLK_CLK_END 241 254#define IMX6SX_CLK_LVDS1_IN 241
255#define IMX6SX_CLK_ANACLK1 242
256#define IMX6SX_PLL1_BYPASS_SRC 243
257#define IMX6SX_PLL2_BYPASS_SRC 244
258#define IMX6SX_PLL3_BYPASS_SRC 245
259#define IMX6SX_PLL4_BYPASS_SRC 246
260#define IMX6SX_PLL5_BYPASS_SRC 247
261#define IMX6SX_PLL6_BYPASS_SRC 248
262#define IMX6SX_PLL7_BYPASS_SRC 249
263#define IMX6SX_CLK_PLL1 250
264#define IMX6SX_CLK_PLL2 251
265#define IMX6SX_CLK_PLL3 252
266#define IMX6SX_CLK_PLL4 253
267#define IMX6SX_CLK_PLL5 254
268#define IMX6SX_CLK_PLL6 255
269#define IMX6SX_CLK_PLL7 256
270#define IMX6SX_PLL1_BYPASS 257
271#define IMX6SX_PLL2_BYPASS 258
272#define IMX6SX_PLL3_BYPASS 259
273#define IMX6SX_PLL4_BYPASS 260
274#define IMX6SX_PLL5_BYPASS 261
275#define IMX6SX_PLL6_BYPASS 262
276#define IMX6SX_PLL7_BYPASS 263
277#define IMX6SX_CLK_CLK_END 264
255 278
256#endif /* __DT_BINDINGS_CLOCK_IMX6SX_H */ 279#endif /* __DT_BINDINGS_CLOCK_IMX6SX_H */
diff --git a/include/dt-bindings/clock/maxim,max77686.h b/include/dt-bindings/clock/maxim,max77686.h
new file mode 100644
index 000000000000..7b28b0905869
--- /dev/null
+++ b/include/dt-bindings/clock/maxim,max77686.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) 2014 Google, Inc
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Device Tree binding constants clocks for the Maxim 77686 PMIC.
9 */
10
11#ifndef _DT_BINDINGS_CLOCK_MAXIM_MAX77686_CLOCK_H
12#define _DT_BINDINGS_CLOCK_MAXIM_MAX77686_CLOCK_H
13
14/* Fixed rate clocks. */
15
16#define MAX77686_CLK_AP 0
17#define MAX77686_CLK_CP 1
18#define MAX77686_CLK_PMIC 2
19
20/* Total number of clocks. */
21#define MAX77686_CLKS_NUM (MAX77686_CLK_PMIC + 1)
22
23#endif /* _DT_BINDINGS_CLOCK_MAXIM_MAX77686_CLOCK_H */
diff --git a/include/dt-bindings/clock/maxim,max77802.h b/include/dt-bindings/clock/maxim,max77802.h
new file mode 100644
index 000000000000..997312edcbb5
--- /dev/null
+++ b/include/dt-bindings/clock/maxim,max77802.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2014 Google, Inc
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * Device Tree binding constants clocks for the Maxim 77802 PMIC.
9 */
10
11#ifndef _DT_BINDINGS_CLOCK_MAXIM_MAX77802_CLOCK_H
12#define _DT_BINDINGS_CLOCK_MAXIM_MAX77802_CLOCK_H
13
14/* Fixed rate clocks. */
15
16#define MAX77802_CLK_32K_AP 0
17#define MAX77802_CLK_32K_CP 1
18
19/* Total number of clocks. */
20#define MAX77802_CLKS_NUM (MAX77802_CLK_32K_CP + 1)
21
22#endif /* _DT_BINDINGS_CLOCK_MAXIM_MAX77802_CLOCK_H */
diff --git a/include/dt-bindings/clock/pxa-clock.h b/include/dt-bindings/clock/pxa-clock.h
new file mode 100644
index 000000000000..e65803b1dc7e
--- /dev/null
+++ b/include/dt-bindings/clock/pxa-clock.h
@@ -0,0 +1,77 @@
1/*
2 * Inspired by original work from pxa2xx-regs.h by Nicolas Pitre
3 * Copyright (C) 2014 Robert Jarzmik
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 */
10
11#ifndef __DT_BINDINGS_CLOCK_PXA2XX_H__
12#define __DT_BINDINGS_CLOCK_PXA2XX_H__
13
14#define CLK_NONE 0
15#define CLK_1WIRE 1
16#define CLK_AC97 2
17#define CLK_AC97CONF 3
18#define CLK_ASSP 4
19#define CLK_BOOT 5
20#define CLK_BTUART 6
21#define CLK_CAMERA 7
22#define CLK_CIR 8
23#define CLK_CORE 9
24#define CLK_DMC 10
25#define CLK_FFUART 11
26#define CLK_FICP 12
27#define CLK_GPIO 13
28#define CLK_HSIO2 14
29#define CLK_HWUART 15
30#define CLK_I2C 16
31#define CLK_I2S 17
32#define CLK_IM 18
33#define CLK_INC 19
34#define CLK_ISC 20
35#define CLK_KEYPAD 21
36#define CLK_LCD 22
37#define CLK_MEMC 23
38#define CLK_MEMSTK 24
39#define CLK_MINI_IM 25
40#define CLK_MINI_LCD 26
41#define CLK_MMC 27
42#define CLK_MMC1 28
43#define CLK_MMC2 29
44#define CLK_MMC3 30
45#define CLK_MSL 31
46#define CLK_MSL0 32
47#define CLK_MVED 33
48#define CLK_NAND 34
49#define CLK_NSSP 35
50#define CLK_OSTIMER 36
51#define CLK_PWM0 37
52#define CLK_PWM1 38
53#define CLK_PWM2 39
54#define CLK_PWM3 40
55#define CLK_PWRI2C 41
56#define CLK_PXA300_GCU 42
57#define CLK_PXA320_GCU 43
58#define CLK_SMC 44
59#define CLK_SSP 45
60#define CLK_SSP1 46
61#define CLK_SSP2 47
62#define CLK_SSP3 48
63#define CLK_SSP4 49
64#define CLK_STUART 50
65#define CLK_TOUCH 51
66#define CLK_TPM 52
67#define CLK_UDC 53
68#define CLK_USB 54
69#define CLK_USB2 55
70#define CLK_USBH 56
71#define CLK_USBHOST 57
72#define CLK_USIM 58
73#define CLK_USIM1 59
74#define CLK_USMI0 60
75#define CLK_MAX 61
76
77#endif
diff --git a/include/dt-bindings/clock/r8a7740-clock.h b/include/dt-bindings/clock/r8a7740-clock.h
new file mode 100644
index 000000000000..f6b4b0fe7a43
--- /dev/null
+++ b/include/dt-bindings/clock/r8a7740-clock.h
@@ -0,0 +1,77 @@
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_R8A7740_H__
11#define __DT_BINDINGS_CLOCK_R8A7740_H__
12
13/* CPG */
14#define R8A7740_CLK_SYSTEM 0
15#define R8A7740_CLK_PLLC0 1
16#define R8A7740_CLK_PLLC1 2
17#define R8A7740_CLK_PLLC2 3
18#define R8A7740_CLK_R 4
19#define R8A7740_CLK_USB24S 5
20#define R8A7740_CLK_I 6
21#define R8A7740_CLK_ZG 7
22#define R8A7740_CLK_B 8
23#define R8A7740_CLK_M1 9
24#define R8A7740_CLK_HP 10
25#define R8A7740_CLK_HPP 11
26#define R8A7740_CLK_USBP 12
27#define R8A7740_CLK_S 13
28#define R8A7740_CLK_ZB 14
29#define R8A7740_CLK_M3 15
30#define R8A7740_CLK_CP 16
31
32/* MSTP1 */
33#define R8A7740_CLK_CEU21 28
34#define R8A7740_CLK_CEU20 27
35#define R8A7740_CLK_TMU0 25
36#define R8A7740_CLK_LCDC1 17
37#define R8A7740_CLK_IIC0 16
38#define R8A7740_CLK_TMU1 11
39#define R8A7740_CLK_LCDC0 0
40
41/* MSTP2 */
42#define R8A7740_CLK_SCIFA6 30
43#define R8A7740_CLK_SCIFA7 22
44#define R8A7740_CLK_DMAC1 18
45#define R8A7740_CLK_DMAC2 17
46#define R8A7740_CLK_DMAC3 16
47#define R8A7740_CLK_USBDMAC 14
48#define R8A7740_CLK_SCIFA5 7
49#define R8A7740_CLK_SCIFB 6
50#define R8A7740_CLK_SCIFA0 4
51#define R8A7740_CLK_SCIFA1 3
52#define R8A7740_CLK_SCIFA2 2
53#define R8A7740_CLK_SCIFA3 1
54#define R8A7740_CLK_SCIFA4 0
55
56/* MSTP3 */
57#define R8A7740_CLK_CMT1 29
58#define R8A7740_CLK_FSI 28
59#define R8A7740_CLK_IIC1 23
60#define R8A7740_CLK_USBF 20
61#define R8A7740_CLK_SDHI0 14
62#define R8A7740_CLK_SDHI1 13
63#define R8A7740_CLK_MMC 12
64#define R8A7740_CLK_GETHER 9
65#define R8A7740_CLK_TPU0 4
66
67/* MSTP4 */
68#define R8A7740_CLK_USBH 16
69#define R8A7740_CLK_SDHI2 15
70#define R8A7740_CLK_USBFUNC 7
71#define R8A7740_CLK_USBPHY 6
72
73/* SUBCK* */
74#define R8A7740_CLK_SUBCK 9
75#define R8A7740_CLK_SUBCK2 10
76
77#endif /* __DT_BINDINGS_CLOCK_R8A7740_H__ */
diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
index 1118f7a4bca6..8ea7ab0346ad 100644
--- a/include/dt-bindings/clock/r8a7790-clock.h
+++ b/include/dt-bindings/clock/r8a7790-clock.h
@@ -26,6 +26,7 @@
26#define R8A7790_CLK_MSIOF0 0 26#define R8A7790_CLK_MSIOF0 0
27 27
28/* MSTP1 */ 28/* MSTP1 */
29#define R8A7790_CLK_JPU 6
29#define R8A7790_CLK_TMU1 11 30#define R8A7790_CLK_TMU1 11
30#define R8A7790_CLK_TMU3 21 31#define R8A7790_CLK_TMU3 21
31#define R8A7790_CLK_TMU2 22 32#define R8A7790_CLK_TMU2 22
@@ -59,6 +60,7 @@
59#define R8A7790_CLK_SDHI0 14 60#define R8A7790_CLK_SDHI0 14
60#define R8A7790_CLK_MMCIF0 15 61#define R8A7790_CLK_MMCIF0 15
61#define R8A7790_CLK_IIC0 18 62#define R8A7790_CLK_IIC0 18
63#define R8A7790_CLK_PCIEC 19
62#define R8A7790_CLK_IIC1 23 64#define R8A7790_CLK_IIC1 23
63#define R8A7790_CLK_SSUSB 28 65#define R8A7790_CLK_SSUSB 28
64#define R8A7790_CLK_CMT1 29 66#define R8A7790_CLK_CMT1 29
@@ -107,4 +109,30 @@
107#define R8A7790_CLK_I2C1 30 109#define R8A7790_CLK_I2C1 30
108#define R8A7790_CLK_I2C0 31 110#define R8A7790_CLK_I2C0 31
109 111
112/* MSTP10 */
113#define R8A7790_CLK_SSI_ALL 5
114#define R8A7790_CLK_SSI9 6
115#define R8A7790_CLK_SSI8 7
116#define R8A7790_CLK_SSI7 8
117#define R8A7790_CLK_SSI6 9
118#define R8A7790_CLK_SSI5 10
119#define R8A7790_CLK_SSI4 11
120#define R8A7790_CLK_SSI3 12
121#define R8A7790_CLK_SSI2 13
122#define R8A7790_CLK_SSI1 14
123#define R8A7790_CLK_SSI0 15
124#define R8A7790_CLK_SCU_ALL 17
125#define R8A7790_CLK_SCU_DVC1 18
126#define R8A7790_CLK_SCU_DVC0 19
127#define R8A7790_CLK_SCU_SRC9 22
128#define R8A7790_CLK_SCU_SRC8 23
129#define R8A7790_CLK_SCU_SRC7 24
130#define R8A7790_CLK_SCU_SRC6 25
131#define R8A7790_CLK_SCU_SRC5 26
132#define R8A7790_CLK_SCU_SRC4 27
133#define R8A7790_CLK_SCU_SRC3 28
134#define R8A7790_CLK_SCU_SRC2 29
135#define R8A7790_CLK_SCU_SRC1 30
136#define R8A7790_CLK_SCU_SRC0 31
137
110#endif /* __DT_BINDINGS_CLOCK_R8A7790_H__ */ 138#endif /* __DT_BINDINGS_CLOCK_R8A7790_H__ */
diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h
index b050d18437ce..58c3f49d068c 100644
--- a/include/dt-bindings/clock/r8a7791-clock.h
+++ b/include/dt-bindings/clock/r8a7791-clock.h
@@ -25,6 +25,7 @@
25#define R8A7791_CLK_MSIOF0 0 25#define R8A7791_CLK_MSIOF0 0
26 26
27/* MSTP1 */ 27/* MSTP1 */
28#define R8A7791_CLK_JPU 6
28#define R8A7791_CLK_TMU1 11 29#define R8A7791_CLK_TMU1 11
29#define R8A7791_CLK_TMU3 21 30#define R8A7791_CLK_TMU3 21
30#define R8A7791_CLK_TMU2 22 31#define R8A7791_CLK_TMU2 22
@@ -53,6 +54,7 @@
53#define R8A7791_CLK_SDHI0 14 54#define R8A7791_CLK_SDHI0 14
54#define R8A7791_CLK_MMCIF0 15 55#define R8A7791_CLK_MMCIF0 15
55#define R8A7791_CLK_IIC0 18 56#define R8A7791_CLK_IIC0 18
57#define R8A7791_CLK_PCIEC 19
56#define R8A7791_CLK_IIC1 23 58#define R8A7791_CLK_IIC1 23
57#define R8A7791_CLK_SSUSB 28 59#define R8A7791_CLK_SSUSB 28
58#define R8A7791_CLK_CMT1 29 60#define R8A7791_CLK_CMT1 29
@@ -107,6 +109,32 @@
107#define R8A7791_CLK_I2C1 30 109#define R8A7791_CLK_I2C1 30
108#define R8A7791_CLK_I2C0 31 110#define R8A7791_CLK_I2C0 31
109 111
112/* MSTP10 */
113#define R8A7791_CLK_SSI_ALL 5
114#define R8A7791_CLK_SSI9 6
115#define R8A7791_CLK_SSI8 7
116#define R8A7791_CLK_SSI7 8
117#define R8A7791_CLK_SSI6 9
118#define R8A7791_CLK_SSI5 10
119#define R8A7791_CLK_SSI4 11
120#define R8A7791_CLK_SSI3 12
121#define R8A7791_CLK_SSI2 13
122#define R8A7791_CLK_SSI1 14
123#define R8A7791_CLK_SSI0 15
124#define R8A7791_CLK_SCU_ALL 17
125#define R8A7791_CLK_SCU_DVC1 18
126#define R8A7791_CLK_SCU_DVC0 19
127#define R8A7791_CLK_SCU_SRC9 22
128#define R8A7791_CLK_SCU_SRC8 23
129#define R8A7791_CLK_SCU_SRC7 24
130#define R8A7791_CLK_SCU_SRC6 25
131#define R8A7791_CLK_SCU_SRC5 26
132#define R8A7791_CLK_SCU_SRC4 27
133#define R8A7791_CLK_SCU_SRC3 28
134#define R8A7791_CLK_SCU_SRC2 29
135#define R8A7791_CLK_SCU_SRC1 30
136#define R8A7791_CLK_SCU_SRC0 31
137
110/* MSTP11 */ 138/* MSTP11 */
111#define R8A7791_CLK_SCIFA3 6 139#define R8A7791_CLK_SCIFA3 6
112#define R8A7791_CLK_SCIFA4 7 140#define R8A7791_CLK_SCIFA4 7
diff --git a/include/dt-bindings/clock/r8a7794-clock.h b/include/dt-bindings/clock/r8a7794-clock.h
new file mode 100644
index 000000000000..9ac1043e25bc
--- /dev/null
+++ b/include/dt-bindings/clock/r8a7794-clock.h
@@ -0,0 +1,80 @@
1/*
2 * Copyright (C) 2014 Renesas Electronics Corporation
3 * Copyright 2013 Ideas On Board SPRL
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 */
10
11#ifndef __DT_BINDINGS_CLOCK_R8A7794_H__
12#define __DT_BINDINGS_CLOCK_R8A7794_H__
13
14/* CPG */
15#define R8A7794_CLK_MAIN 0
16#define R8A7794_CLK_PLL0 1
17#define R8A7794_CLK_PLL1 2
18#define R8A7794_CLK_PLL3 3
19#define R8A7794_CLK_LB 4
20#define R8A7794_CLK_QSPI 5
21#define R8A7794_CLK_SDH 6
22#define R8A7794_CLK_SD0 7
23#define R8A7794_CLK_Z 8
24
25/* MSTP0 */
26#define R8A7794_CLK_MSIOF0 0
27
28/* MSTP1 */
29#define R8A7794_CLK_TMU1 11
30#define R8A7794_CLK_TMU3 21
31#define R8A7794_CLK_TMU2 22
32#define R8A7794_CLK_CMT0 24
33#define R8A7794_CLK_TMU0 25
34
35/* MSTP2 */
36#define R8A7794_CLK_SCIFA2 2
37#define R8A7794_CLK_SCIFA1 3
38#define R8A7794_CLK_SCIFA0 4
39#define R8A7794_CLK_MSIOF2 5
40#define R8A7794_CLK_SCIFB0 6
41#define R8A7794_CLK_SCIFB1 7
42#define R8A7794_CLK_MSIOF1 8
43#define R8A7794_CLK_SCIFB2 16
44
45/* MSTP3 */
46#define R8A7794_CLK_CMT1 29
47
48/* MSTP5 */
49#define R8A7794_CLK_THERMAL 22
50#define R8A7794_CLK_PWM 23
51
52/* MSTP7 */
53#define R8A7794_CLK_HSCIF2 13
54#define R8A7794_CLK_SCIF5 14
55#define R8A7794_CLK_SCIF4 15
56#define R8A7794_CLK_HSCIF1 16
57#define R8A7794_CLK_HSCIF0 17
58#define R8A7794_CLK_SCIF3 18
59#define R8A7794_CLK_SCIF2 19
60#define R8A7794_CLK_SCIF1 20
61#define R8A7794_CLK_SCIF0 21
62
63/* MSTP8 */
64#define R8A7794_CLK_ETHER 13
65
66/* MSTP9 */
67#define R8A7794_CLK_GPIO6 5
68#define R8A7794_CLK_GPIO5 7
69#define R8A7794_CLK_GPIO4 8
70#define R8A7794_CLK_GPIO3 9
71#define R8A7794_CLK_GPIO2 10
72#define R8A7794_CLK_GPIO1 11
73#define R8A7794_CLK_GPIO0 12
74
75/* MSTP11 */
76#define R8A7794_CLK_SCIFA3 6
77#define R8A7794_CLK_SCIFA4 7
78#define R8A7794_CLK_SCIFA5 8
79
80#endif /* __DT_BINDINGS_CLOCK_R8A7794_H__ */
diff --git a/include/dt-bindings/clock/rk3188-cru-common.h b/include/dt-bindings/clock/rk3188-cru-common.h
index 750ee60e75fb..6a370503c954 100644
--- a/include/dt-bindings/clock/rk3188-cru-common.h
+++ b/include/dt-bindings/clock/rk3188-cru-common.h
@@ -20,6 +20,7 @@
20#define PLL_GPLL 4 20#define PLL_GPLL 4
21#define CORE_PERI 5 21#define CORE_PERI 5
22#define CORE_L2C 6 22#define CORE_L2C 6
23#define ARMCLK 7
23 24
24/* sclk gates (special clocks) */ 25/* sclk gates (special clocks) */
25#define SCLK_UART0 64 26#define SCLK_UART0 64
diff --git a/include/dt-bindings/clock/rk3288-cru.h b/include/dt-bindings/clock/rk3288-cru.h
index ebcb460ea4ad..100a08c47692 100644
--- a/include/dt-bindings/clock/rk3288-cru.h
+++ b/include/dt-bindings/clock/rk3288-cru.h
@@ -19,6 +19,7 @@
19#define PLL_CPLL 3 19#define PLL_CPLL 3
20#define PLL_GPLL 4 20#define PLL_GPLL 4
21#define PLL_NPLL 5 21#define PLL_NPLL 5
22#define ARMCLK 6
22 23
23/* sclk gates (special clocks) */ 24/* sclk gates (special clocks) */
24#define SCLK_GPU 64 25#define SCLK_GPU 64
@@ -61,6 +62,15 @@
61#define SCLK_LCDC_PWM1 101 62#define SCLK_LCDC_PWM1 101
62#define SCLK_MAC_RX 102 63#define SCLK_MAC_RX 102
63#define SCLK_MAC_TX 103 64#define SCLK_MAC_TX 103
65#define SCLK_EDP_24M 104
66#define SCLK_EDP 105
67#define SCLK_RGA 106
68#define SCLK_ISP 107
69#define SCLK_ISP_JPE 108
70#define SCLK_HDMI_HDCP 109
71#define SCLK_HDMI_CEC 110
72#define SCLK_HEVC_CABAC 111
73#define SCLK_HEVC_CORE 112
64 74
65#define DCLK_VOP0 190 75#define DCLK_VOP0 190
66#define DCLK_VOP1 191 76#define DCLK_VOP1 191
@@ -75,6 +85,16 @@
75#define ACLK_VOP1 198 85#define ACLK_VOP1 198
76#define ACLK_CRYPTO 199 86#define ACLK_CRYPTO 199
77#define ACLK_RGA 200 87#define ACLK_RGA 200
88#define ACLK_RGA_NIU 201
89#define ACLK_IEP 202
90#define ACLK_VIO0_NIU 203
91#define ACLK_VIP 204
92#define ACLK_ISP 205
93#define ACLK_VIO1_NIU 206
94#define ACLK_HEVC 207
95#define ACLK_VCODEC 208
96#define ACLK_CPU 209
97#define ACLK_PERI 210
78 98
79/* pclk gates */ 99/* pclk gates */
80#define PCLK_GPIO0 320 100#define PCLK_GPIO0 320
@@ -112,6 +132,15 @@
112#define PCLK_PS2C 352 132#define PCLK_PS2C 352
113#define PCLK_TIMER 353 133#define PCLK_TIMER 353
114#define PCLK_TZPC 354 134#define PCLK_TZPC 354
135#define PCLK_EDP_CTRL 355
136#define PCLK_MIPI_DSI0 356
137#define PCLK_MIPI_DSI1 357
138#define PCLK_MIPI_CSI 358
139#define PCLK_LVDS_PHY 359
140#define PCLK_HDMI_CTRL 360
141#define PCLK_VIO2_H2P 361
142#define PCLK_CPU 362
143#define PCLK_PERI 363
115 144
116/* hclk gates */ 145/* hclk gates */
117#define HCLK_GPS 448 146#define HCLK_GPS 448
@@ -137,8 +166,16 @@
137#define HCLK_IEP 468 166#define HCLK_IEP 468
138#define HCLK_ISP 469 167#define HCLK_ISP 469
139#define HCLK_RGA 470 168#define HCLK_RGA 470
169#define HCLK_VIO_AHB_ARBI 471
170#define HCLK_VIO_NIU 472
171#define HCLK_VIP 473
172#define HCLK_VIO2_H2P 474
173#define HCLK_HEVC 475
174#define HCLK_VCODEC 476
175#define HCLK_CPU 477
176#define HCLK_PERI 478
140 177
141#define CLK_NR_CLKS (HCLK_RGA + 1) 178#define CLK_NR_CLKS (HCLK_PERI + 1)
142 179
143/* soft-reset indices */ 180/* soft-reset indices */
144#define SRST_CORE0 0 181#define SRST_CORE0 0
@@ -276,3 +313,46 @@
276#define SRST_USBHOST1_CON 140 313#define SRST_USBHOST1_CON 140
277#define SRST_USB_ADP 141 314#define SRST_USB_ADP 141
278#define SRST_ACC_EFUSE 142 315#define SRST_ACC_EFUSE 142
316
317#define SRST_CORESIGHT 144
318#define SRST_PD_CORE_AHB_NOC 145
319#define SRST_PD_CORE_APB_NOC 146
320#define SRST_PD_CORE_MP_AXI 147
321#define SRST_GIC 148
322#define SRST_LCDC_PWM0 149
323#define SRST_LCDC_PWM1 150
324#define SRST_VIO0_H2P_BRG 151
325#define SRST_VIO1_H2P_BRG 152
326#define SRST_RGA_H2P_BRG 153
327#define SRST_HEVC 154
328#define SRST_TSADC 159
329
330#define SRST_DDRPHY0 160
331#define SRST_DDRPHY0_APB 161
332#define SRST_DDRCTRL0 162
333#define SRST_DDRCTRL0_APB 163
334#define SRST_DDRPHY0_CTRL 164
335#define SRST_DDRPHY1 165
336#define SRST_DDRPHY1_APB 166
337#define SRST_DDRCTRL1 167
338#define SRST_DDRCTRL1_APB 168
339#define SRST_DDRPHY1_CTRL 169
340#define SRST_DDRMSCH0 170
341#define SRST_DDRMSCH1 171
342#define SRST_CRYPTO 174
343#define SRST_C2C_HOST 175
344
345#define SRST_LCDC1_AXI 176
346#define SRST_LCDC1_AHB 177
347#define SRST_LCDC1_DCLK 178
348#define SRST_UART0 179
349#define SRST_UART1 180
350#define SRST_UART2 181
351#define SRST_UART3 182
352#define SRST_UART4 183
353#define SRST_SIMC 186
354#define SRST_PS2C 187
355#define SRST_TSP 188
356#define SRST_TSP_CLKIN0 189
357#define SRST_TSP_CLKIN1 190
358#define SRST_TSP_27M 191
diff --git a/include/dt-bindings/clock/rockchip,rk808.h b/include/dt-bindings/clock/rockchip,rk808.h
new file mode 100644
index 000000000000..1a873432f965
--- /dev/null
+++ b/include/dt-bindings/clock/rockchip,rk808.h
@@ -0,0 +1,11 @@
1/*
2 * This header provides constants clk index RK808 pmic clkout
3 */
4#ifndef _CLK_ROCKCHIP_RK808
5#define _CLK_ROCKCHIP_RK808
6
7/* CLOCKOUT index */
8#define RK808_CLKOUT0 0
9#define RK808_CLKOUT1 1
10
11#endif
diff --git a/include/dt-bindings/clock/s5pv210-audss.h b/include/dt-bindings/clock/s5pv210-audss.h
new file mode 100644
index 000000000000..fe57406e24de
--- /dev/null
+++ b/include/dt-bindings/clock/s5pv210-audss.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (c) 2014 Tomasz Figa <tomasz.figa@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This header provides constants for Samsung audio subsystem
9 * clock controller.
10 *
11 * The constants defined in this header are being used in dts
12 * and s5pv210 audss driver.
13 */
14
15#ifndef _DT_BINDINGS_CLOCK_S5PV210_AUDSS_H
16#define _DT_BINDINGS_CLOCK_S5PV210_AUDSS_H
17
18#define CLK_MOUT_AUDSS 0
19#define CLK_MOUT_I2S_A 1
20
21#define CLK_DOUT_AUD_BUS 2
22#define CLK_DOUT_I2S_A 3
23
24#define CLK_I2S 4
25#define CLK_HCLK_I2S 5
26#define CLK_HCLK_UART 6
27#define CLK_HCLK_HWA 7
28#define CLK_HCLK_DMA 8
29#define CLK_HCLK_BUF 9
30#define CLK_HCLK_RP 10
31
32#define AUDSS_MAX_CLKS 11
33
34#endif
diff --git a/include/dt-bindings/clock/s5pv210.h b/include/dt-bindings/clock/s5pv210.h
new file mode 100644
index 000000000000..e88986b7c677
--- /dev/null
+++ b/include/dt-bindings/clock/s5pv210.h
@@ -0,0 +1,239 @@
1/*
2 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 * Author: Mateusz Krawczuk <m.krawczuk@partner.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 * Device Tree binding constants for Samsung S5PV210 clock controller.
10 */
11
12#ifndef _DT_BINDINGS_CLOCK_S5PV210_H
13#define _DT_BINDINGS_CLOCK_S5PV210_H
14
15/* Core clocks. */
16#define FIN_PLL 1
17#define FOUT_APLL 2
18#define FOUT_MPLL 3
19#define FOUT_EPLL 4
20#define FOUT_VPLL 5
21
22/* Muxes. */
23#define MOUT_FLASH 6
24#define MOUT_PSYS 7
25#define MOUT_DSYS 8
26#define MOUT_MSYS 9
27#define MOUT_VPLL 10
28#define MOUT_EPLL 11
29#define MOUT_MPLL 12
30#define MOUT_APLL 13
31#define MOUT_VPLLSRC 14
32#define MOUT_CSIS 15
33#define MOUT_FIMD 16
34#define MOUT_CAM1 17
35#define MOUT_CAM0 18
36#define MOUT_DAC 19
37#define MOUT_MIXER 20
38#define MOUT_HDMI 21
39#define MOUT_G2D 22
40#define MOUT_MFC 23
41#define MOUT_G3D 24
42#define MOUT_FIMC2 25
43#define MOUT_FIMC1 26
44#define MOUT_FIMC0 27
45#define MOUT_UART3 28
46#define MOUT_UART2 29
47#define MOUT_UART1 30
48#define MOUT_UART0 31
49#define MOUT_MMC3 32
50#define MOUT_MMC2 33
51#define MOUT_MMC1 34
52#define MOUT_MMC0 35
53#define MOUT_PWM 36
54#define MOUT_SPI0 37
55#define MOUT_SPI1 38
56#define MOUT_DMC0 39
57#define MOUT_PWI 40
58#define MOUT_HPM 41
59#define MOUT_SPDIF 42
60#define MOUT_AUDIO2 43
61#define MOUT_AUDIO1 44
62#define MOUT_AUDIO0 45
63
64/* Dividers. */
65#define DOUT_PCLKP 46
66#define DOUT_HCLKP 47
67#define DOUT_PCLKD 48
68#define DOUT_HCLKD 49
69#define DOUT_PCLKM 50
70#define DOUT_HCLKM 51
71#define DOUT_A2M 52
72#define DOUT_APLL 53
73#define DOUT_CSIS 54
74#define DOUT_FIMD 55
75#define DOUT_CAM1 56
76#define DOUT_CAM0 57
77#define DOUT_TBLK 58
78#define DOUT_G2D 59
79#define DOUT_MFC 60
80#define DOUT_G3D 61
81#define DOUT_FIMC2 62
82#define DOUT_FIMC1 63
83#define DOUT_FIMC0 64
84#define DOUT_UART3 65
85#define DOUT_UART2 66
86#define DOUT_UART1 67
87#define DOUT_UART0 68
88#define DOUT_MMC3 69
89#define DOUT_MMC2 70
90#define DOUT_MMC1 71
91#define DOUT_MMC0 72
92#define DOUT_PWM 73
93#define DOUT_SPI1 74
94#define DOUT_SPI0 75
95#define DOUT_DMC0 76
96#define DOUT_PWI 77
97#define DOUT_HPM 78
98#define DOUT_COPY 79
99#define DOUT_FLASH 80
100#define DOUT_AUDIO2 81
101#define DOUT_AUDIO1 82
102#define DOUT_AUDIO0 83
103#define DOUT_DPM 84
104#define DOUT_DVSEM 85
105
106/* Gates */
107#define SCLK_FIMC 86
108#define CLK_CSIS 87
109#define CLK_ROTATOR 88
110#define CLK_FIMC2 89
111#define CLK_FIMC1 90
112#define CLK_FIMC0 91
113#define CLK_MFC 92
114#define CLK_G2D 93
115#define CLK_G3D 94
116#define CLK_IMEM 95
117#define CLK_PDMA1 96
118#define CLK_PDMA0 97
119#define CLK_MDMA 98
120#define CLK_DMC1 99
121#define CLK_DMC0 100
122#define CLK_NFCON 101
123#define CLK_SROMC 102
124#define CLK_CFCON 103
125#define CLK_NANDXL 104
126#define CLK_USB_HOST 105
127#define CLK_USB_OTG 106
128#define CLK_HDMI 107
129#define CLK_TVENC 108
130#define CLK_MIXER 109
131#define CLK_VP 110
132#define CLK_DSIM 111
133#define CLK_FIMD 112
134#define CLK_TZIC3 113
135#define CLK_TZIC2 114
136#define CLK_TZIC1 115
137#define CLK_TZIC0 116
138#define CLK_VIC3 117
139#define CLK_VIC2 118
140#define CLK_VIC1 119
141#define CLK_VIC0 120
142#define CLK_TSI 121
143#define CLK_HSMMC3 122
144#define CLK_HSMMC2 123
145#define CLK_HSMMC1 124
146#define CLK_HSMMC0 125
147#define CLK_JTAG 126
148#define CLK_MODEMIF 127
149#define CLK_CORESIGHT 128
150#define CLK_SDM 129
151#define CLK_SECSS 130
152#define CLK_PCM2 131
153#define CLK_PCM1 132
154#define CLK_PCM0 133
155#define CLK_SYSCON 134
156#define CLK_GPIO 135
157#define CLK_TSADC 136
158#define CLK_PWM 137
159#define CLK_WDT 138
160#define CLK_KEYIF 139
161#define CLK_UART3 140
162#define CLK_UART2 141
163#define CLK_UART1 142
164#define CLK_UART0 143
165#define CLK_SYSTIMER 144
166#define CLK_RTC 145
167#define CLK_SPI1 146
168#define CLK_SPI0 147
169#define CLK_I2C_HDMI_PHY 148
170#define CLK_I2C1 149
171#define CLK_I2C2 150
172#define CLK_I2C0 151
173#define CLK_I2S1 152
174#define CLK_I2S2 153
175#define CLK_I2S0 154
176#define CLK_AC97 155
177#define CLK_SPDIF 156
178#define CLK_TZPC3 157
179#define CLK_TZPC2 158
180#define CLK_TZPC1 159
181#define CLK_TZPC0 160
182#define CLK_SECKEY 161
183#define CLK_IEM_APC 162
184#define CLK_IEM_IEC 163
185#define CLK_CHIPID 164
186#define CLK_JPEG 163
187
188/* Special clocks*/
189#define SCLK_PWI 164
190#define SCLK_SPDIF 165
191#define SCLK_AUDIO2 166
192#define SCLK_AUDIO1 167
193#define SCLK_AUDIO0 168
194#define SCLK_PWM 169
195#define SCLK_SPI1 170
196#define SCLK_SPI0 171
197#define SCLK_UART3 172
198#define SCLK_UART2 173
199#define SCLK_UART1 174
200#define SCLK_UART0 175
201#define SCLK_MMC3 176
202#define SCLK_MMC2 177
203#define SCLK_MMC1 178
204#define SCLK_MMC0 179
205#define SCLK_FINVPLL 180
206#define SCLK_CSIS 181
207#define SCLK_FIMD 182
208#define SCLK_CAM1 183
209#define SCLK_CAM0 184
210#define SCLK_DAC 185
211#define SCLK_MIXER 186
212#define SCLK_HDMI 187
213#define SCLK_FIMC2 188
214#define SCLK_FIMC1 189
215#define SCLK_FIMC0 190
216#define SCLK_HDMI27M 191
217#define SCLK_HDMIPHY 192
218#define SCLK_USBPHY0 193
219#define SCLK_USBPHY1 194
220
221/* S5P6442-specific clocks */
222#define MOUT_D0SYNC 195
223#define MOUT_D1SYNC 196
224#define DOUT_MIXER 197
225#define CLK_ETB 198
226#define CLK_ETM 199
227
228/* CLKOUT */
229#define FOUT_APLL_CLKOUT 200
230#define FOUT_MPLL_CLKOUT 201
231#define DOUT_APLL_CLKOUT 202
232#define MOUT_CLKSEL 203
233#define DOUT_CLKOUT 204
234#define MOUT_CLKOUT 205
235
236/* Total number of clocks. */
237#define NR_CLKS 206
238
239#endif /* _DT_BINDINGS_CLOCK_S5PV210_H */
diff --git a/include/dt-bindings/clock/tegra124-car.h b/include/dt-bindings/clock/tegra124-car.h
index 8a4c5892890f..6bac637fd635 100644
--- a/include/dt-bindings/clock/tegra124-car.h
+++ b/include/dt-bindings/clock/tegra124-car.h
@@ -337,6 +337,10 @@
337#define TEGRA124_CLK_DSIB_MUX 310 337#define TEGRA124_CLK_DSIB_MUX 310
338#define TEGRA124_CLK_SOR0_LVDS 311 338#define TEGRA124_CLK_SOR0_LVDS 311
339#define TEGRA124_CLK_XUSB_SS_DIV2 312 339#define TEGRA124_CLK_XUSB_SS_DIV2 312
340#define TEGRA124_CLK_CLK_MAX 313 340
341#define TEGRA124_CLK_PLL_M_UD 313
342#define TEGRA124_CLK_PLL_C_UD 314
343
344#define TEGRA124_CLK_CLK_MAX 315
341 345
342#endif /* _DT_BINDINGS_CLOCK_TEGRA124_CAR_H */ 346#endif /* _DT_BINDINGS_CLOCK_TEGRA124_CAR_H */
diff --git a/include/dt-bindings/clock/vf610-clock.h b/include/dt-bindings/clock/vf610-clock.h
index a91602951d3d..801c0ac50c47 100644
--- a/include/dt-bindings/clock/vf610-clock.h
+++ b/include/dt-bindings/clock/vf610-clock.h
@@ -21,24 +21,24 @@
21#define VF610_CLK_FASK_CLK_SEL 8 21#define VF610_CLK_FASK_CLK_SEL 8
22#define VF610_CLK_AUDIO_EXT 9 22#define VF610_CLK_AUDIO_EXT 9
23#define VF610_CLK_ENET_EXT 10 23#define VF610_CLK_ENET_EXT 10
24#define VF610_CLK_PLL1_MAIN 11 24#define VF610_CLK_PLL1_SYS 11
25#define VF610_CLK_PLL1_PFD1 12 25#define VF610_CLK_PLL1_PFD1 12
26#define VF610_CLK_PLL1_PFD2 13 26#define VF610_CLK_PLL1_PFD2 13
27#define VF610_CLK_PLL1_PFD3 14 27#define VF610_CLK_PLL1_PFD3 14
28#define VF610_CLK_PLL1_PFD4 15 28#define VF610_CLK_PLL1_PFD4 15
29#define VF610_CLK_PLL2_MAIN 16 29#define VF610_CLK_PLL2_BUS 16
30#define VF610_CLK_PLL2_PFD1 17 30#define VF610_CLK_PLL2_PFD1 17
31#define VF610_CLK_PLL2_PFD2 18 31#define VF610_CLK_PLL2_PFD2 18
32#define VF610_CLK_PLL2_PFD3 19 32#define VF610_CLK_PLL2_PFD3 19
33#define VF610_CLK_PLL2_PFD4 20 33#define VF610_CLK_PLL2_PFD4 20
34#define VF610_CLK_PLL3_MAIN 21 34#define VF610_CLK_PLL3_USB_OTG 21
35#define VF610_CLK_PLL3_PFD1 22 35#define VF610_CLK_PLL3_PFD1 22
36#define VF610_CLK_PLL3_PFD2 23 36#define VF610_CLK_PLL3_PFD2 23
37#define VF610_CLK_PLL3_PFD3 24 37#define VF610_CLK_PLL3_PFD3 24
38#define VF610_CLK_PLL3_PFD4 25 38#define VF610_CLK_PLL3_PFD4 25
39#define VF610_CLK_PLL4_MAIN 26 39#define VF610_CLK_PLL4_AUDIO 26
40#define VF610_CLK_PLL5_MAIN 27 40#define VF610_CLK_PLL5_ENET 27
41#define VF610_CLK_PLL6_MAIN 28 41#define VF610_CLK_PLL6_VIDEO 28
42#define VF610_CLK_PLL3_MAIN_DIV 29 42#define VF610_CLK_PLL3_MAIN_DIV 29
43#define VF610_CLK_PLL4_MAIN_DIV 30 43#define VF610_CLK_PLL4_MAIN_DIV 30
44#define VF610_CLK_PLL6_MAIN_DIV 31 44#define VF610_CLK_PLL6_MAIN_DIV 31
@@ -164,6 +164,34 @@
164#define VF610_CLK_DMAMUX1 151 164#define VF610_CLK_DMAMUX1 151
165#define VF610_CLK_DMAMUX2 152 165#define VF610_CLK_DMAMUX2 152
166#define VF610_CLK_DMAMUX3 153 166#define VF610_CLK_DMAMUX3 153
167#define VF610_CLK_END 154 167#define VF610_CLK_FLEXCAN0_EN 154
168#define VF610_CLK_FLEXCAN1_EN 155
169#define VF610_CLK_PLL7_USB_HOST 156
170#define VF610_CLK_USBPHY0 157
171#define VF610_CLK_USBPHY1 158
172#define VF610_CLK_LVDS1_IN 159
173#define VF610_CLK_ANACLK1 160
174#define VF610_CLK_PLL1_BYPASS_SRC 161
175#define VF610_CLK_PLL2_BYPASS_SRC 162
176#define VF610_CLK_PLL3_BYPASS_SRC 163
177#define VF610_CLK_PLL4_BYPASS_SRC 164
178#define VF610_CLK_PLL5_BYPASS_SRC 165
179#define VF610_CLK_PLL6_BYPASS_SRC 166
180#define VF610_CLK_PLL7_BYPASS_SRC 167
181#define VF610_CLK_PLL1 168
182#define VF610_CLK_PLL2 169
183#define VF610_CLK_PLL3 170
184#define VF610_CLK_PLL4 171
185#define VF610_CLK_PLL5 172
186#define VF610_CLK_PLL6 173
187#define VF610_CLK_PLL7 174
188#define VF610_PLL1_BYPASS 175
189#define VF610_PLL2_BYPASS 176
190#define VF610_PLL3_BYPASS 177
191#define VF610_PLL4_BYPASS 178
192#define VF610_PLL5_BYPASS 179
193#define VF610_PLL6_BYPASS 180
194#define VF610_PLL7_BYPASS 181
195#define VF610_CLK_END 182
168 196
169#endif /* __DT_BINDINGS_CLOCK_VF610_H */ 197#endif /* __DT_BINDINGS_CLOCK_VF610_H */
diff --git a/include/dt-bindings/dma/nbpfaxi.h b/include/dt-bindings/dma/nbpfaxi.h
new file mode 100644
index 000000000000..c1a5b9e0d6a4
--- /dev/null
+++ b/include/dt-bindings/dma/nbpfaxi.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2013-2014 Renesas Electronics Europe Ltd.
3 * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef DT_BINDINGS_NBPFAXI_H
11#define DT_BINDINGS_NBPFAXI_H
12
13/**
14 * Use "#dma-cells = <2>;" with the second integer defining slave DMA flags:
15 */
16#define NBPF_SLAVE_RQ_HIGH 1
17#define NBPF_SLAVE_RQ_LOW 2
18#define NBPF_SLAVE_RQ_LEVEL 4
19
20#endif
diff --git a/include/dt-bindings/input/ti-drv260x.h b/include/dt-bindings/input/ti-drv260x.h
new file mode 100644
index 000000000000..2626e6d9f707
--- /dev/null
+++ b/include/dt-bindings/input/ti-drv260x.h
@@ -0,0 +1,36 @@
1/*
2 * DRV260X haptics driver family
3 *
4 * Author: Dan Murphy <dmurphy@ti.com>
5 *
6 * Copyright: (C) 2014 Texas Instruments, Inc.
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 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18#ifndef _DT_BINDINGS_TI_DRV260X_H
19#define _DT_BINDINGS_TI_DRV260X_H
20
21/* Calibration Types */
22#define DRV260X_LRA_MODE 0x00
23#define DRV260X_LRA_NO_CAL_MODE 0x01
24#define DRV260X_ERM_MODE 0x02
25
26/* Library Selection */
27#define DRV260X_LIB_EMPTY 0x00
28#define DRV260X_ERM_LIB_A 0x01
29#define DRV260X_ERM_LIB_B 0x02
30#define DRV260X_ERM_LIB_C 0x03
31#define DRV260X_ERM_LIB_D 0x04
32#define DRV260X_ERM_LIB_E 0x05
33#define DRV260X_LIB_LRA 0x06
34#define DRV260X_ERM_LIB_F 0x07
35
36#endif
diff --git a/include/dt-bindings/mfd/as3722.h b/include/dt-bindings/mfd/as3722.h
index 0e692562d77b..e66c0898c58e 100644
--- a/include/dt-bindings/mfd/as3722.h
+++ b/include/dt-bindings/mfd/as3722.h
@@ -13,7 +13,7 @@
13/* External control pins */ 13/* External control pins */
14#define AS3722_EXT_CONTROL_PIN_ENABLE1 1 14#define AS3722_EXT_CONTROL_PIN_ENABLE1 1
15#define AS3722_EXT_CONTROL_PIN_ENABLE2 2 15#define AS3722_EXT_CONTROL_PIN_ENABLE2 2
16#define AS3722_EXT_CONTROL_PIN_ENABLE2 3 16#define AS3722_EXT_CONTROL_PIN_ENABLE3 3
17 17
18/* Interrupt numbers for AS3722 */ 18/* Interrupt numbers for AS3722 */
19#define AS3722_IRQ_LID 0 19#define AS3722_IRQ_LID 0
diff --git a/include/dt-bindings/pinctrl/at91.h b/include/dt-bindings/pinctrl/at91.h
index 0fee6ff77ffc..bbca3d038900 100644
--- a/include/dt-bindings/pinctrl/at91.h
+++ b/include/dt-bindings/pinctrl/at91.h
@@ -20,6 +20,11 @@
20 20
21#define AT91_PINCTRL_PULL_UP_DEGLITCH (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DEGLITCH) 21#define AT91_PINCTRL_PULL_UP_DEGLITCH (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DEGLITCH)
22 22
23#define AT91_PINCTRL_DRIVE_STRENGTH_DEFAULT (0x0 << 5)
24#define AT91_PINCTRL_DRIVE_STRENGTH_LOW (0x1 << 5)
25#define AT91_PINCTRL_DRIVE_STRENGTH_MED (0x2 << 5)
26#define AT91_PINCTRL_DRIVE_STRENGTH_HI (0x3 << 5)
27
23#define AT91_PIOA 0 28#define AT91_PIOA 0
24#define AT91_PIOB 1 29#define AT91_PIOB 1
25#define AT91_PIOC 2 30#define AT91_PIOC 2
diff --git a/include/dt-bindings/pinctrl/dra.h b/include/dt-bindings/pinctrl/dra.h
index 3d33794e4f3e..7448edff4723 100644
--- a/include/dt-bindings/pinctrl/dra.h
+++ b/include/dt-bindings/pinctrl/dra.h
@@ -40,8 +40,8 @@
40 40
41/* Active pin states */ 41/* Active pin states */
42#define PIN_OUTPUT (0 | PULL_DIS) 42#define PIN_OUTPUT (0 | PULL_DIS)
43#define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP) 43#define PIN_OUTPUT_PULLUP (PULL_UP)
44#define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA) 44#define PIN_OUTPUT_PULLDOWN (0)
45#define PIN_INPUT (INPUT_EN | PULL_DIS) 45#define PIN_INPUT (INPUT_EN | PULL_DIS)
46#define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL) 46#define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL)
47#define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP) 47#define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP)
diff --git a/include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h b/include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h
new file mode 100644
index 000000000000..914d56da9324
--- /dev/null
+++ b/include/dt-bindings/pinctrl/pinctrl-tegra-xusb.h
@@ -0,0 +1,7 @@
1#ifndef _DT_BINDINGS_PINCTRL_TEGRA_XUSB_H
2#define _DT_BINDINGS_PINCTRL_TEGRA_XUSB_H 1
3
4#define TEGRA_XUSB_PADCTL_PCIE 0
5#define TEGRA_XUSB_PADCTL_SATA 1
6
7#endif /* _DT_BINDINGS_PINCTRL_TEGRA_XUSB_H */
diff --git a/include/dt-bindings/pinctrl/rockchip.h b/include/dt-bindings/pinctrl/rockchip.h
index cd5788be82ce..743e66a95e13 100644
--- a/include/dt-bindings/pinctrl/rockchip.h
+++ b/include/dt-bindings/pinctrl/rockchip.h
@@ -28,5 +28,7 @@
28#define RK_FUNC_GPIO 0 28#define RK_FUNC_GPIO 0
29#define RK_FUNC_1 1 29#define RK_FUNC_1 1
30#define RK_FUNC_2 2 30#define RK_FUNC_2 2
31#define RK_FUNC_3 3
32#define RK_FUNC_4 4
31 33
32#endif 34#endif
diff --git a/include/dt-bindings/sound/cs35l32.h b/include/dt-bindings/sound/cs35l32.h
new file mode 100644
index 000000000000..0c6d6a3c15a2
--- /dev/null
+++ b/include/dt-bindings/sound/cs35l32.h
@@ -0,0 +1,26 @@
1#ifndef __DT_CS35L32_H
2#define __DT_CS35L32_H
3
4#define CS35L32_BOOST_MGR_AUTO 0
5#define CS35L32_BOOST_MGR_AUTO_AUDIO 1
6#define CS35L32_BOOST_MGR_BYPASS 2
7#define CS35L32_BOOST_MGR_FIXED 3
8
9#define CS35L32_DATA_CFG_LR_VP 0
10#define CS35L32_DATA_CFG_LR_STAT 1
11#define CS35L32_DATA_CFG_LR 2
12#define CS35L32_DATA_CFG_LR_VPSTAT 3
13
14#define CS35L32_BATT_THRESH_3_1V 0
15#define CS35L32_BATT_THRESH_3_2V 1
16#define CS35L32_BATT_THRESH_3_3V 2
17#define CS35L32_BATT_THRESH_3_4V 3
18
19#define CS35L32_BATT_RECOV_3_1V 0
20#define CS35L32_BATT_RECOV_3_2V 1
21#define CS35L32_BATT_RECOV_3_3V 2
22#define CS35L32_BATT_RECOV_3_4V 3
23#define CS35L32_BATT_RECOV_3_5V 4
24#define CS35L32_BATT_RECOV_3_6V 5
25
26#endif /* __DT_CS35L32_H */
diff --git a/include/keys/asymmetric-type.h b/include/keys/asymmetric-type.h
index 7dd473496180..c0754abb2f56 100644
--- a/include/keys/asymmetric-type.h
+++ b/include/keys/asymmetric-type.h
@@ -19,6 +19,47 @@
19extern struct key_type key_type_asymmetric; 19extern struct key_type key_type_asymmetric;
20 20
21/* 21/*
22 * Identifiers for an asymmetric key ID. We have three ways of looking up a
23 * key derived from an X.509 certificate:
24 *
25 * (1) Serial Number & Issuer. Non-optional. This is the only valid way to
26 * map a PKCS#7 signature to an X.509 certificate.
27 *
28 * (2) Issuer & Subject Unique IDs. Optional. These were the original way to
29 * match X.509 certificates, but have fallen into disuse in favour of (3).
30 *
31 * (3) Auth & Subject Key Identifiers. Optional. SKIDs are only provided on
32 * CA keys that are intended to sign other keys, so don't appear in end
33 * user certificates unless forced.
34 *
35 * We could also support an PGP key identifier, which is just a SHA1 sum of the
36 * public key and certain parameters, but since we don't support PGP keys at
37 * the moment, we shall ignore those.
38 *
39 * What we actually do is provide a place where binary identifiers can be
40 * stashed and then compare against them when checking for an id match.
41 */
42struct asymmetric_key_id {
43 unsigned short len;
44 unsigned char data[];
45};
46
47struct asymmetric_key_ids {
48 void *id[2];
49};
50
51extern bool asymmetric_key_id_same(const struct asymmetric_key_id *kid1,
52 const struct asymmetric_key_id *kid2);
53
54extern bool asymmetric_key_id_partial(const struct asymmetric_key_id *kid1,
55 const struct asymmetric_key_id *kid2);
56
57extern struct asymmetric_key_id *asymmetric_key_generate_id(const void *val_1,
58 size_t len_1,
59 const void *val_2,
60 size_t len_2);
61
62/*
22 * The payload is at the discretion of the subtype. 63 * The payload is at the discretion of the subtype.
23 */ 64 */
24 65
diff --git a/include/keys/user-type.h b/include/keys/user-type.h
index 3ab1873a4bfa..cebefb069c44 100644
--- a/include/keys/user-type.h
+++ b/include/keys/user-type.h
@@ -40,7 +40,6 @@ struct key_preparsed_payload;
40extern int user_preparse(struct key_preparsed_payload *prep); 40extern int user_preparse(struct key_preparsed_payload *prep);
41extern void user_free_preparse(struct key_preparsed_payload *prep); 41extern void user_free_preparse(struct key_preparsed_payload *prep);
42extern int user_update(struct key *key, struct key_preparsed_payload *prep); 42extern int user_update(struct key *key, struct key_preparsed_payload *prep);
43extern int user_match(const struct key *key, const void *criterion);
44extern void user_revoke(struct key *key); 43extern void user_revoke(struct key *key);
45extern void user_destroy(struct key *key); 44extern void user_destroy(struct key *key);
46extern void user_describe(const struct key *user, struct seq_file *m); 45extern void user_describe(const struct key *user, struct seq_file *m);
diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h
index 6d9aeddc09bf..ad9db6045b2f 100644
--- a/include/kvm/arm_arch_timer.h
+++ b/include/kvm/arm_arch_timer.h
@@ -67,6 +67,10 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu);
67void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu); 67void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu);
68void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu); 68void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu);
69void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu); 69void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu);
70
71u64 kvm_arm_timer_get_reg(struct kvm_vcpu *, u64 regid);
72int kvm_arm_timer_set_reg(struct kvm_vcpu *, u64 regid, u64 value);
73
70#else 74#else
71static inline int kvm_timer_hyp_init(void) 75static inline int kvm_timer_hyp_init(void)
72{ 76{
@@ -84,6 +88,16 @@ static inline void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu) {}
84static inline void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu) {} 88static inline void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu) {}
85static inline void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu) {} 89static inline void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu) {}
86static inline void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu) {} 90static inline void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu) {}
91
92static inline int kvm_arm_timer_set_reg(struct kvm_vcpu *vcpu, u64 regid, u64 value)
93{
94 return 0;
95}
96
97static inline u64 kvm_arm_timer_get_reg(struct kvm_vcpu *vcpu, u64 regid)
98{
99 return 0;
100}
87#endif 101#endif
88 102
89#endif 103#endif
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index f27000f55a83..206dcc3b3f7a 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -24,26 +24,26 @@
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 <linux/irqchip/arm-gic.h>
28 27
29#define VGIC_NR_IRQS 256 28#define VGIC_NR_IRQS_LEGACY 256
30#define VGIC_NR_SGIS 16 29#define VGIC_NR_SGIS 16
31#define VGIC_NR_PPIS 16 30#define VGIC_NR_PPIS 16
32#define VGIC_NR_PRIVATE_IRQS (VGIC_NR_SGIS + VGIC_NR_PPIS) 31#define VGIC_NR_PRIVATE_IRQS (VGIC_NR_SGIS + VGIC_NR_PPIS)
33#define VGIC_NR_SHARED_IRQS (VGIC_NR_IRQS - VGIC_NR_PRIVATE_IRQS) 32
34#define VGIC_MAX_CPUS KVM_MAX_VCPUS 33#define VGIC_V2_MAX_LRS (1 << 6)
35#define VGIC_MAX_LRS (1 << 6) 34#define VGIC_V3_MAX_LRS 16
35#define VGIC_MAX_IRQS 1024
36 36
37/* Sanity checks... */ 37/* Sanity checks... */
38#if (VGIC_MAX_CPUS > 8) 38#if (KVM_MAX_VCPUS > 8)
39#error Invalid number of CPU interfaces 39#error Invalid number of CPU interfaces
40#endif 40#endif
41 41
42#if (VGIC_NR_IRQS & 31) 42#if (VGIC_NR_IRQS_LEGACY & 31)
43#error "VGIC_NR_IRQS must be a multiple of 32" 43#error "VGIC_NR_IRQS must be a multiple of 32"
44#endif 44#endif
45 45
46#if (VGIC_NR_IRQS > 1024) 46#if (VGIC_NR_IRQS_LEGACY > VGIC_MAX_IRQS)
47#error "VGIC_NR_IRQS must be <= 1024" 47#error "VGIC_NR_IRQS must be <= 1024"
48#endif 48#endif
49 49
@@ -53,26 +53,96 @@
53 * - a bunch of shared interrupts (SPI) 53 * - a bunch of shared interrupts (SPI)
54 */ 54 */
55struct vgic_bitmap { 55struct vgic_bitmap {
56 union { 56 /*
57 u32 reg[VGIC_NR_PRIVATE_IRQS / 32]; 57 * - One UL per VCPU for private interrupts (assumes UL is at
58 DECLARE_BITMAP(reg_ul, VGIC_NR_PRIVATE_IRQS); 58 * least 32 bits)
59 } percpu[VGIC_MAX_CPUS]; 59 * - As many UL as necessary for shared interrupts.
60 union { 60 *
61 u32 reg[VGIC_NR_SHARED_IRQS / 32]; 61 * The private interrupts are accessed via the "private"
62 DECLARE_BITMAP(reg_ul, VGIC_NR_SHARED_IRQS); 62 * field, one UL per vcpu (the state for vcpu n is in
63 } shared; 63 * private[n]). The shared interrupts are accessed via the
64 * "shared" pointer (IRQn state is at bit n-32 in the bitmap).
65 */
66 unsigned long *private;
67 unsigned long *shared;
64}; 68};
65 69
66struct vgic_bytemap { 70struct vgic_bytemap {
67 u32 percpu[VGIC_MAX_CPUS][VGIC_NR_PRIVATE_IRQS / 4]; 71 /*
68 u32 shared[VGIC_NR_SHARED_IRQS / 4]; 72 * - 8 u32 per VCPU for private interrupts
73 * - As many u32 as necessary for shared interrupts.
74 *
75 * The private interrupts are accessed via the "private"
76 * field, (the state for vcpu n is in private[n*8] to
77 * private[n*8 + 7]). The shared interrupts are accessed via
78 * the "shared" pointer (IRQn state is at byte (n-32)%4 of the
79 * shared[(n-32)/4] word).
80 */
81 u32 *private;
82 u32 *shared;
83};
84
85struct kvm_vcpu;
86
87enum vgic_type {
88 VGIC_V2, /* Good ol' GICv2 */
89 VGIC_V3, /* New fancy GICv3 */
90};
91
92#define LR_STATE_PENDING (1 << 0)
93#define LR_STATE_ACTIVE (1 << 1)
94#define LR_STATE_MASK (3 << 0)
95#define LR_EOI_INT (1 << 2)
96
97struct vgic_lr {
98 u16 irq;
99 u8 source;
100 u8 state;
101};
102
103struct vgic_vmcr {
104 u32 ctlr;
105 u32 abpr;
106 u32 bpr;
107 u32 pmr;
108};
109
110struct vgic_ops {
111 struct vgic_lr (*get_lr)(const struct kvm_vcpu *, int);
112 void (*set_lr)(struct kvm_vcpu *, int, struct vgic_lr);
113 void (*sync_lr_elrsr)(struct kvm_vcpu *, int, struct vgic_lr);
114 u64 (*get_elrsr)(const struct kvm_vcpu *vcpu);
115 u64 (*get_eisr)(const struct kvm_vcpu *vcpu);
116 u32 (*get_interrupt_status)(const struct kvm_vcpu *vcpu);
117 void (*enable_underflow)(struct kvm_vcpu *vcpu);
118 void (*disable_underflow)(struct kvm_vcpu *vcpu);
119 void (*get_vmcr)(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcr);
120 void (*set_vmcr)(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcr);
121 void (*enable)(struct kvm_vcpu *vcpu);
122};
123
124struct vgic_params {
125 /* vgic type */
126 enum vgic_type type;
127 /* Physical address of vgic virtual cpu interface */
128 phys_addr_t vcpu_base;
129 /* Number of list registers */
130 u32 nr_lr;
131 /* Interrupt number */
132 unsigned int maint_irq;
133 /* Virtual control interface base address */
134 void __iomem *vctrl_base;
69}; 135};
70 136
71struct vgic_dist { 137struct vgic_dist {
72#ifdef CONFIG_KVM_ARM_VGIC 138#ifdef CONFIG_KVM_ARM_VGIC
73 spinlock_t lock; 139 spinlock_t lock;
140 bool in_kernel;
74 bool ready; 141 bool ready;
75 142
143 int nr_cpus;
144 int nr_irqs;
145
76 /* Virtual control interface mapping */ 146 /* Virtual control interface mapping */
77 void __iomem *vctrl_base; 147 void __iomem *vctrl_base;
78 148
@@ -86,11 +156,25 @@ struct vgic_dist {
86 /* Interrupt enabled (one bit per IRQ) */ 156 /* Interrupt enabled (one bit per IRQ) */
87 struct vgic_bitmap irq_enabled; 157 struct vgic_bitmap irq_enabled;
88 158
89 /* Interrupt 'pin' level */ 159 /* Level-triggered interrupt external input is asserted */
90 struct vgic_bitmap irq_state; 160 struct vgic_bitmap irq_level;
161
162 /*
163 * Interrupt state is pending on the distributor
164 */
165 struct vgic_bitmap irq_pending;
166
167 /*
168 * Tracks writes to GICD_ISPENDRn and GICD_ICPENDRn for level-triggered
169 * interrupts. Essentially holds the state of the flip-flop in
170 * Figure 4-10 on page 4-101 in ARM IHI 0048B.b.
171 * Once set, it is only cleared for level-triggered interrupts on
172 * guest ACKs (when we queue it) or writes to GICD_ICPENDRn.
173 */
174 struct vgic_bitmap irq_soft_pend;
91 175
92 /* Level-triggered interrupt in progress */ 176 /* Level-triggered interrupt queued on VCPU interface */
93 struct vgic_bitmap irq_active; 177 struct vgic_bitmap irq_queued;
94 178
95 /* Interrupt priority. Not used yet. */ 179 /* Interrupt priority. Not used yet. */
96 struct vgic_bytemap irq_priority; 180 struct vgic_bytemap irq_priority;
@@ -98,46 +182,90 @@ struct vgic_dist {
98 /* Level/edge triggered */ 182 /* Level/edge triggered */
99 struct vgic_bitmap irq_cfg; 183 struct vgic_bitmap irq_cfg;
100 184
101 /* Source CPU per SGI and target CPU */ 185 /*
102 u8 irq_sgi_sources[VGIC_MAX_CPUS][VGIC_NR_SGIS]; 186 * Source CPU per SGI and target CPU:
103 187 *
104 /* Target CPU for each IRQ */ 188 * Each byte represent a SGI observable on a VCPU, each bit of
105 u8 irq_spi_cpu[VGIC_NR_SHARED_IRQS]; 189 * this byte indicating if the corresponding VCPU has
106 struct vgic_bitmap irq_spi_target[VGIC_MAX_CPUS]; 190 * generated this interrupt. This is a GICv2 feature only.
191 *
192 * For VCPUn (n < 8), irq_sgi_sources[n*16] to [n*16 + 15] are
193 * the SGIs observable on VCPUn.
194 */
195 u8 *irq_sgi_sources;
196
197 /*
198 * Target CPU for each SPI:
199 *
200 * Array of available SPI, each byte indicating the target
201 * VCPU for SPI. IRQn (n >=32) is at irq_spi_cpu[n-32].
202 */
203 u8 *irq_spi_cpu;
204
205 /*
206 * Reverse lookup of irq_spi_cpu for faster compute pending:
207 *
208 * Array of bitmaps, one per VCPU, describing if IRQn is
209 * routed to a particular VCPU.
210 */
211 struct vgic_bitmap *irq_spi_target;
107 212
108 /* Bitmap indicating which CPU has something pending */ 213 /* Bitmap indicating which CPU has something pending */
109 unsigned long irq_pending_on_cpu; 214 unsigned long *irq_pending_on_cpu;
215#endif
216};
217
218struct vgic_v2_cpu_if {
219 u32 vgic_hcr;
220 u32 vgic_vmcr;
221 u32 vgic_misr; /* Saved only */
222 u64 vgic_eisr; /* Saved only */
223 u64 vgic_elrsr; /* Saved only */
224 u32 vgic_apr;
225 u32 vgic_lr[VGIC_V2_MAX_LRS];
226};
227
228struct vgic_v3_cpu_if {
229#ifdef CONFIG_ARM_GIC_V3
230 u32 vgic_hcr;
231 u32 vgic_vmcr;
232 u32 vgic_misr; /* Saved only */
233 u32 vgic_eisr; /* Saved only */
234 u32 vgic_elrsr; /* Saved only */
235 u32 vgic_ap0r[4];
236 u32 vgic_ap1r[4];
237 u64 vgic_lr[VGIC_V3_MAX_LRS];
110#endif 238#endif
111}; 239};
112 240
113struct vgic_cpu { 241struct vgic_cpu {
114#ifdef CONFIG_KVM_ARM_VGIC 242#ifdef CONFIG_KVM_ARM_VGIC
115 /* per IRQ to LR mapping */ 243 /* per IRQ to LR mapping */
116 u8 vgic_irq_lr_map[VGIC_NR_IRQS]; 244 u8 *vgic_irq_lr_map;
117 245
118 /* Pending interrupts on this VCPU */ 246 /* Pending interrupts on this VCPU */
119 DECLARE_BITMAP( pending_percpu, VGIC_NR_PRIVATE_IRQS); 247 DECLARE_BITMAP( pending_percpu, VGIC_NR_PRIVATE_IRQS);
120 DECLARE_BITMAP( pending_shared, VGIC_NR_SHARED_IRQS); 248 unsigned long *pending_shared;
121 249
122 /* Bitmap of used/free list registers */ 250 /* Bitmap of used/free list registers */
123 DECLARE_BITMAP( lr_used, VGIC_MAX_LRS); 251 DECLARE_BITMAP( lr_used, VGIC_V2_MAX_LRS);
124 252
125 /* Number of list registers on this CPU */ 253 /* Number of list registers on this CPU */
126 int nr_lr; 254 int nr_lr;
127 255
128 /* CPU vif control registers for world switch */ 256 /* CPU vif control registers for world switch */
129 u32 vgic_hcr; 257 union {
130 u32 vgic_vmcr; 258 struct vgic_v2_cpu_if vgic_v2;
131 u32 vgic_misr; /* Saved only */ 259 struct vgic_v3_cpu_if vgic_v3;
132 u32 vgic_eisr[2]; /* Saved only */ 260 };
133 u32 vgic_elrsr[2]; /* Saved only */
134 u32 vgic_apr;
135 u32 vgic_lr[VGIC_MAX_LRS];
136#endif 261#endif
137}; 262};
138 263
139#define LR_EMPTY 0xff 264#define LR_EMPTY 0xff
140 265
266#define INT_STATUS_EOI (1 << 0)
267#define INT_STATUS_UNDERFLOW (1 << 1)
268
141struct kvm; 269struct kvm;
142struct kvm_vcpu; 270struct kvm_vcpu;
143struct kvm_run; 271struct kvm_run;
@@ -148,7 +276,8 @@ int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write);
148int kvm_vgic_hyp_init(void); 276int kvm_vgic_hyp_init(void);
149int kvm_vgic_init(struct kvm *kvm); 277int kvm_vgic_init(struct kvm *kvm);
150int kvm_vgic_create(struct kvm *kvm); 278int kvm_vgic_create(struct kvm *kvm);
151int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu); 279void kvm_vgic_destroy(struct kvm *kvm);
280void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu);
152void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu); 281void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu);
153void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu); 282void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu);
154int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num, 283int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num,
@@ -157,9 +286,25 @@ int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu);
157bool vgic_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run, 286bool vgic_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run,
158 struct kvm_exit_mmio *mmio); 287 struct kvm_exit_mmio *mmio);
159 288
160#define irqchip_in_kernel(k) (!!((k)->arch.vgic.vctrl_base)) 289#define irqchip_in_kernel(k) (!!((k)->arch.vgic.in_kernel))
161#define vgic_initialized(k) ((k)->arch.vgic.ready) 290#define vgic_initialized(k) ((k)->arch.vgic.ready)
162 291
292int vgic_v2_probe(struct device_node *vgic_node,
293 const struct vgic_ops **ops,
294 const struct vgic_params **params);
295#ifdef CONFIG_ARM_GIC_V3
296int vgic_v3_probe(struct device_node *vgic_node,
297 const struct vgic_ops **ops,
298 const struct vgic_params **params);
299#else
300static inline int vgic_v3_probe(struct device_node *vgic_node,
301 const struct vgic_ops **ops,
302 const struct vgic_params **params)
303{
304 return -ENODEV;
305}
306#endif
307
163#else 308#else
164static inline int kvm_vgic_hyp_init(void) 309static inline int kvm_vgic_hyp_init(void)
165{ 310{
@@ -186,6 +331,14 @@ static inline int kvm_vgic_create(struct kvm *kvm)
186 return 0; 331 return 0;
187} 332}
188 333
334static inline void kvm_vgic_destroy(struct kvm *kvm)
335{
336}
337
338static inline void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)
339{
340}
341
189static inline int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu) 342static inline int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu)
190{ 343{
191 return 0; 344 return 0;
diff --git a/include/linux/acct.h b/include/linux/acct.h
index 4a5b7cb56079..dccc2d4fe7de 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -24,14 +24,10 @@ struct super_block;
24struct pacct_struct; 24struct pacct_struct;
25struct pid_namespace; 25struct pid_namespace;
26extern int acct_parm[]; /* for sysctl */ 26extern int acct_parm[]; /* for sysctl */
27extern void acct_auto_close_mnt(struct vfsmount *m);
28extern void acct_auto_close(struct super_block *sb);
29extern void acct_collect(long exitcode, int group_dead); 27extern void acct_collect(long exitcode, int group_dead);
30extern void acct_process(void); 28extern void acct_process(void);
31extern void acct_exit_ns(struct pid_namespace *); 29extern void acct_exit_ns(struct pid_namespace *);
32#else 30#else
33#define acct_auto_close_mnt(x) do { } while (0)
34#define acct_auto_close(x) do { } while (0)
35#define acct_collect(x,y) do { } while (0) 31#define acct_collect(x,y) do { } while (0)
36#define acct_process() do { } while (0) 32#define acct_process() do { } while (0)
37#define acct_exit_ns(ns) do { } while (0) 33#define acct_exit_ns(ns) do { } while (0)
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 5320153c311b..407a12f663eb 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -364,6 +364,17 @@ extern bool osc_sb_apei_support_acked;
364#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010 364#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010
365#define OSC_PCI_CONTROL_MASKS 0x0000001f 365#define OSC_PCI_CONTROL_MASKS 0x0000001f
366 366
367#define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002
368#define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV 0x00000004
369#define ACPI_GSB_ACCESS_ATTRIB_BYTE 0x00000006
370#define ACPI_GSB_ACCESS_ATTRIB_WORD 0x00000008
371#define ACPI_GSB_ACCESS_ATTRIB_BLOCK 0x0000000A
372#define ACPI_GSB_ACCESS_ATTRIB_MULTIBYTE 0x0000000B
373#define ACPI_GSB_ACCESS_ATTRIB_WORD_CALL 0x0000000C
374#define ACPI_GSB_ACCESS_ATTRIB_BLOCK_CALL 0x0000000D
375#define ACPI_GSB_ACCESS_ATTRIB_RAW_BYTES 0x0000000E
376#define ACPI_GSB_ACCESS_ATTRIB_RAW_PROCESS 0x0000000F
377
367extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, 378extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
368 u32 *mask, u32 req); 379 u32 *mask, u32 req);
369 380
@@ -421,6 +432,7 @@ static inline bool acpi_driver_match_device(struct device *dev,
421int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); 432int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *);
422int acpi_device_modalias(struct device *, char *, int); 433int acpi_device_modalias(struct device *, char *, int);
423 434
435struct platform_device *acpi_create_platform_device(struct acpi_device *);
424#define ACPI_PTR(_ptr) (_ptr) 436#define ACPI_PTR(_ptr) (_ptr)
425 437
426#else /* !CONFIG_ACPI */ 438#else /* !CONFIG_ACPI */
@@ -576,7 +588,6 @@ static inline int acpi_subsys_freeze(struct device *dev) { return 0; }
576#if defined(CONFIG_ACPI) && defined(CONFIG_PM) 588#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
577struct acpi_device *acpi_dev_pm_get_node(struct device *dev); 589struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
578int acpi_dev_pm_attach(struct device *dev, bool power_on); 590int acpi_dev_pm_attach(struct device *dev, bool power_on);
579void acpi_dev_pm_detach(struct device *dev, bool power_off);
580#else 591#else
581static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev) 592static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
582{ 593{
@@ -586,7 +597,6 @@ static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
586{ 597{
587 return -ENODEV; 598 return -ENODEV;
588} 599}
589static inline void acpi_dev_pm_detach(struct device *dev, bool power_off) {}
590#endif 600#endif
591 601
592#ifdef CONFIG_ACPI 602#ifdef CONFIG_ACPI
diff --git a/include/linux/aer.h b/include/linux/aer.h
index c826d1c28f9c..4fef65e57023 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -7,6 +7,8 @@
7#ifndef _AER_H_ 7#ifndef _AER_H_
8#define _AER_H_ 8#define _AER_H_
9 9
10#include <linux/types.h>
11
10#define AER_NONFATAL 0 12#define AER_NONFATAL 0
11#define AER_FATAL 1 13#define AER_FATAL 1
12#define AER_CORRECTABLE 2 14#define AER_CORRECTABLE 2
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index 09a947e8bc87..642d6ae4030c 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -22,19 +22,6 @@ struct ata_port_info;
22struct ahci_host_priv; 22struct ahci_host_priv;
23struct platform_device; 23struct platform_device;
24 24
25/*
26 * Note ahci_platform_data is deprecated, it is only kept around for use
27 * by the old da850 and spear13xx ahci code.
28 * New drivers should instead declare their own platform_driver struct, and
29 * use ahci_platform* functions in their own probe, suspend and resume methods.
30 */
31struct ahci_platform_data {
32 int (*init)(struct device *dev, void __iomem *addr);
33 void (*exit)(struct device *dev);
34 int (*suspend)(struct device *dev);
35 int (*resume)(struct device *dev);
36};
37
38int ahci_platform_enable_clks(struct ahci_host_priv *hpriv); 25int ahci_platform_enable_clks(struct ahci_host_priv *hpriv);
39void ahci_platform_disable_clks(struct ahci_host_priv *hpriv); 26void ahci_platform_disable_clks(struct ahci_host_priv *hpriv);
40int ahci_platform_enable_resources(struct ahci_host_priv *hpriv); 27int ahci_platform_enable_resources(struct ahci_host_priv *hpriv);
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index fdd7e1b61f60..c324f5700d1a 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -44,10 +44,15 @@ struct amba_driver {
44 const struct amba_id *id_table; 44 const struct amba_id *id_table;
45}; 45};
46 46
47/*
48 * Constants for the designer field of the Peripheral ID register. When bit 7
49 * is set to '1', bits [6:0] should be the JEP106 manufacturer identity code.
50 */
47enum amba_vendor { 51enum amba_vendor {
48 AMBA_VENDOR_ARM = 0x41, 52 AMBA_VENDOR_ARM = 0x41,
49 AMBA_VENDOR_ST = 0x80, 53 AMBA_VENDOR_ST = 0x80,
50 AMBA_VENDOR_QCOM = 0x51, 54 AMBA_VENDOR_QCOM = 0x51,
55 AMBA_VENDOR_LSI = 0xb6,
51}; 56};
52 57
53extern struct bus_type amba_bustype; 58extern struct bus_type amba_bustype;
diff --git a/include/linux/ata_platform.h b/include/linux/ata_platform.h
index b9fde17f767c..5c618a084225 100644
--- a/include/linux/ata_platform.h
+++ b/include/linux/ata_platform.h
@@ -8,11 +8,6 @@ struct pata_platform_info {
8 * spacing used by ata_std_ports(). 8 * spacing used by ata_std_ports().
9 */ 9 */
10 unsigned int ioport_shift; 10 unsigned int ioport_shift;
11 /*
12 * Indicate platform specific irq types and initial
13 * IRQ flags when call request_irq()
14 */
15 unsigned int irq_flags;
16}; 11};
17 12
18extern int __pata_platform_probe(struct device *dev, 13extern int __pata_platform_probe(struct device *dev,
diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h
index 4c7a4b2104bf..91b77f8d495d 100644
--- a/include/linux/atmel-mci.h
+++ b/include/linux/atmel-mci.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_ATMEL_MCI_H 1#ifndef __LINUX_ATMEL_MCI_H
2#define __LINUX_ATMEL_MCI_H 2#define __LINUX_ATMEL_MCI_H
3 3
4#include <linux/types.h>
5
4#define ATMCI_MAX_NR_SLOTS 2 6#define ATMCI_MAX_NR_SLOTS 2
5 7
6/** 8/**
diff --git a/include/linux/atmel-pwm-bl.h b/include/linux/atmel-pwm-bl.h
deleted file mode 100644
index 0153a47806c2..000000000000
--- a/include/linux/atmel-pwm-bl.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * Copyright (C) 2007 Atmel Corporation
3 *
4 * Driver for the AT32AP700X PS/2 controller (PSIF).
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10
11#ifndef __INCLUDE_ATMEL_PWM_BL_H
12#define __INCLUDE_ATMEL_PWM_BL_H
13
14/**
15 * struct atmel_pwm_bl_platform_data
16 * @pwm_channel: which PWM channel in the PWM module to use.
17 * @pwm_frequency: PWM frequency to generate, the driver will try to be as
18 * close as the prescaler allows.
19 * @pwm_compare_max: value to use in the PWM channel compare register.
20 * @pwm_duty_max: maximum duty cycle value, must be less than or equal to
21 * pwm_compare_max.
22 * @pwm_duty_min: minimum duty cycle value, must be less than pwm_duty_max.
23 * @pwm_active_low: set to one if the low part of the PWM signal increases the
24 * brightness of the backlight.
25 * @gpio_on: GPIO line to control the backlight on/off, set to -1 if not used.
26 * @on_active_low: set to one if the on/off signal is on when GPIO is low.
27 *
28 * This struct must be added to the platform device in the board code. It is
29 * used by the atmel-pwm-bl driver to setup the GPIO to control on/off and the
30 * PWM device.
31 */
32struct atmel_pwm_bl_platform_data {
33 unsigned int pwm_channel;
34 unsigned int pwm_frequency;
35 unsigned int pwm_compare_max;
36 unsigned int pwm_duty_max;
37 unsigned int pwm_duty_min;
38 unsigned int pwm_active_low;
39 int gpio_on;
40 unsigned int on_active_low;
41};
42
43#endif /* __INCLUDE_ATMEL_PWM_BL_H */
diff --git a/include/linux/atmel_pwm.h b/include/linux/atmel_pwm.h
deleted file mode 100644
index ea04abb3db8e..000000000000
--- a/include/linux/atmel_pwm.h
+++ /dev/null
@@ -1,70 +0,0 @@
1#ifndef __LINUX_ATMEL_PWM_H
2#define __LINUX_ATMEL_PWM_H
3
4/**
5 * struct pwm_channel - driver handle to a PWM channel
6 * @regs: base of this channel's registers
7 * @index: number of this channel (0..31)
8 * @mck: base clock rate, which can be prescaled and maybe subdivided
9 *
10 * Drivers initialize a pwm_channel structure using pwm_channel_alloc().
11 * Then they configure its clock rate (derived from MCK), alignment,
12 * polarity, and duty cycle by writing directly to the channel registers,
13 * before enabling the channel by calling pwm_channel_enable().
14 *
15 * After emitting a PWM signal for the desired length of time, drivers
16 * may then pwm_channel_disable() or pwm_channel_free(). Both of these
17 * disable the channel, but when it's freed the IRQ is deconfigured and
18 * the channel must later be re-allocated and reconfigured.
19 *
20 * Note that if the period or duty cycle need to be changed while the
21 * PWM channel is operating, drivers must use the PWM_CUPD double buffer
22 * mechanism, either polling until they change or getting implicitly
23 * notified through a once-per-period interrupt handler.
24 */
25struct pwm_channel {
26 void __iomem *regs;
27 unsigned index;
28 unsigned long mck;
29};
30
31extern int pwm_channel_alloc(int index, struct pwm_channel *ch);
32extern int pwm_channel_free(struct pwm_channel *ch);
33
34extern int pwm_clk_alloc(unsigned prescale, unsigned div);
35extern void pwm_clk_free(unsigned clk);
36
37extern int __pwm_channel_onoff(struct pwm_channel *ch, int enabled);
38
39#define pwm_channel_enable(ch) __pwm_channel_onoff((ch), 1)
40#define pwm_channel_disable(ch) __pwm_channel_onoff((ch), 0)
41
42/* periodic interrupts, mostly for CUPD changes to period or cycle */
43extern int pwm_channel_handler(struct pwm_channel *ch,
44 void (*handler)(struct pwm_channel *ch));
45
46/* per-channel registers (banked at pwm_channel->regs) */
47#define PWM_CMR 0x00 /* mode register */
48#define PWM_CPR_CPD (1 << 10) /* set: CUPD modifies period */
49#define PWM_CPR_CPOL (1 << 9) /* set: idle high */
50#define PWM_CPR_CALG (1 << 8) /* set: center align */
51#define PWM_CPR_CPRE (0xf << 0) /* mask: rate is mck/(2^pre) */
52#define PWM_CPR_CLKA (0xb << 0) /* rate CLKA */
53#define PWM_CPR_CLKB (0xc << 0) /* rate CLKB */
54#define PWM_CDTY 0x04 /* duty cycle (max of CPRD) */
55#define PWM_CPRD 0x08 /* period (count up from zero) */
56#define PWM_CCNT 0x0c /* counter (20 bits?) */
57#define PWM_CUPD 0x10 /* update CPRD (or CDTY) next period */
58
59static inline void
60pwm_channel_writel(struct pwm_channel *pwmc, unsigned offset, u32 val)
61{
62 __raw_writel(val, pwmc->regs + offset);
63}
64
65static inline u32 pwm_channel_readl(struct pwm_channel *pwmc, unsigned offset)
66{
67 return __raw_readl(pwmc->regs + offset);
68}
69
70#endif /* __LINUX_ATMEL_PWM_H */
diff --git a/include/linux/atmel_tc.h b/include/linux/atmel_tc.h
index 89a931babecf..b87c1c7c242a 100644
--- a/include/linux/atmel_tc.h
+++ b/include/linux/atmel_tc.h
@@ -44,12 +44,13 @@ struct atmel_tcb_config {
44/** 44/**
45 * struct atmel_tc - information about a Timer/Counter Block 45 * struct atmel_tc - information about a Timer/Counter Block
46 * @pdev: physical device 46 * @pdev: physical device
47 * @iomem: resource associated with the I/O register
48 * @regs: mapping through which the I/O registers can be accessed 47 * @regs: mapping through which the I/O registers can be accessed
48 * @id: block id
49 * @tcb_config: configuration data from SoC 49 * @tcb_config: configuration data from SoC
50 * @irq: irq for each of the three channels 50 * @irq: irq for each of the three channels
51 * @clk: internal clock source for each of the three channels 51 * @clk: internal clock source for each of the three channels
52 * @node: list node, for tclib internal use 52 * @node: list node, for tclib internal use
53 * @allocated: if already used, for tclib internal use
53 * 54 *
54 * On some platforms, each TC channel has its own clocks and IRQs, 55 * On some platforms, each TC channel has its own clocks and IRQs,
55 * while on others, all TC channels share the same clock and IRQ. 56 * while on others, all TC channels share the same clock and IRQ.
@@ -61,15 +62,16 @@ struct atmel_tcb_config {
61 */ 62 */
62struct atmel_tc { 63struct atmel_tc {
63 struct platform_device *pdev; 64 struct platform_device *pdev;
64 struct resource *iomem;
65 void __iomem *regs; 65 void __iomem *regs;
66 int id;
66 const struct atmel_tcb_config *tcb_config; 67 const struct atmel_tcb_config *tcb_config;
67 int irq[3]; 68 int irq[3];
68 struct clk *clk[3]; 69 struct clk *clk[3];
69 struct list_head node; 70 struct list_head node;
71 bool allocated;
70}; 72};
71 73
72extern struct atmel_tc *atmel_tc_alloc(unsigned block, const char *name); 74extern struct atmel_tc *atmel_tc_alloc(unsigned block);
73extern void atmel_tc_free(struct atmel_tc *tc); 75extern void atmel_tc_free(struct atmel_tc *tc);
74 76
75/* platform-specific ATMEL_TC_TIMER_CLOCKx divisors (0 means 32KiHz) */ 77/* platform-specific ATMEL_TC_TIMER_CLOCKx divisors (0 means 32KiHz) */
@@ -258,5 +260,10 @@ extern const u8 atmel_tc_divisors[5];
258#define ATMEL_TC_LDRAS (1 << 5) /* RA loading */ 260#define ATMEL_TC_LDRAS (1 << 5) /* RA loading */
259#define ATMEL_TC_LDRBS (1 << 6) /* RB loading */ 261#define ATMEL_TC_LDRBS (1 << 6) /* RB loading */
260#define ATMEL_TC_ETRGS (1 << 7) /* external trigger */ 262#define ATMEL_TC_ETRGS (1 << 7) /* external trigger */
263#define ATMEL_TC_ALL_IRQ (ATMEL_TC_COVFS | ATMEL_TC_LOVRS | \
264 ATMEL_TC_CPAS | ATMEL_TC_CPBS | \
265 ATMEL_TC_CPCS | ATMEL_TC_LDRAS | \
266 ATMEL_TC_LDRBS | ATMEL_TC_ETRGS) \
267 /* all IRQs */
261 268
262#endif 269#endif
diff --git a/include/linux/atomic.h b/include/linux/atomic.h
index fef3a809e7cf..5b08a8540ecf 100644
--- a/include/linux/atomic.h
+++ b/include/linux/atomic.h
@@ -3,42 +3,6 @@
3#define _LINUX_ATOMIC_H 3#define _LINUX_ATOMIC_H
4#include <asm/atomic.h> 4#include <asm/atomic.h>
5 5
6/*
7 * Provide __deprecated wrappers for the new interface, avoid flag day changes.
8 * We need the ugly external functions to break header recursion hell.
9 */
10#ifndef smp_mb__before_atomic_inc
11static inline void __deprecated smp_mb__before_atomic_inc(void)
12{
13 extern void __smp_mb__before_atomic(void);
14 __smp_mb__before_atomic();
15}
16#endif
17
18#ifndef smp_mb__after_atomic_inc
19static inline void __deprecated smp_mb__after_atomic_inc(void)
20{
21 extern void __smp_mb__after_atomic(void);
22 __smp_mb__after_atomic();
23}
24#endif
25
26#ifndef smp_mb__before_atomic_dec
27static inline void __deprecated smp_mb__before_atomic_dec(void)
28{
29 extern void __smp_mb__before_atomic(void);
30 __smp_mb__before_atomic();
31}
32#endif
33
34#ifndef smp_mb__after_atomic_dec
35static inline void __deprecated smp_mb__after_atomic_dec(void)
36{
37 extern void __smp_mb__after_atomic(void);
38 __smp_mb__after_atomic();
39}
40#endif
41
42/** 6/**
43 * atomic_add_unless - add unless the number is already a given value 7 * atomic_add_unless - add unless the number is already a given value
44 * @v: pointer of type atomic_t 8 * @v: pointer of type atomic_t
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 22cfddb75566..e58fe7df8b9c 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -66,12 +66,16 @@ struct audit_krule {
66 66
67struct audit_field { 67struct audit_field {
68 u32 type; 68 u32 type;
69 u32 val; 69 union {
70 kuid_t uid; 70 u32 val;
71 kgid_t gid; 71 kuid_t uid;
72 kgid_t gid;
73 struct {
74 char *lsm_str;
75 void *lsm_rule;
76 };
77 };
72 u32 op; 78 u32 op;
73 char *lsm_str;
74 void *lsm_rule;
75}; 79};
76 80
77extern int is_audit_feature_set(int which); 81extern int is_audit_feature_set(int which);
@@ -86,7 +90,7 @@ extern unsigned compat_dir_class[];
86extern unsigned compat_chattr_class[]; 90extern unsigned compat_chattr_class[];
87extern unsigned compat_signal_class[]; 91extern unsigned compat_signal_class[];
88 92
89extern int __weak audit_classify_compat_syscall(int abi, unsigned syscall); 93extern int audit_classify_compat_syscall(int abi, unsigned syscall);
90 94
91/* audit_names->type values */ 95/* audit_names->type values */
92#define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */ 96#define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */
@@ -109,12 +113,13 @@ extern void audit_log_session_info(struct audit_buffer *ab);
109#endif 113#endif
110 114
111#ifdef CONFIG_AUDITSYSCALL 115#ifdef CONFIG_AUDITSYSCALL
116#include <asm/syscall.h> /* for syscall_get_arch() */
117
112/* These are defined in auditsc.c */ 118/* These are defined in auditsc.c */
113 /* Public API */ 119 /* Public API */
114extern int audit_alloc(struct task_struct *task); 120extern int audit_alloc(struct task_struct *task);
115extern void __audit_free(struct task_struct *task); 121extern void __audit_free(struct task_struct *task);
116extern void __audit_syscall_entry(int arch, 122extern void __audit_syscall_entry(int major, unsigned long a0, unsigned long a1,
117 int major, unsigned long a0, unsigned long a1,
118 unsigned long a2, unsigned long a3); 123 unsigned long a2, unsigned long a3);
119extern void __audit_syscall_exit(int ret_success, long ret_value); 124extern void __audit_syscall_exit(int ret_success, long ret_value);
120extern struct filename *__audit_reusename(const __user char *uptr); 125extern struct filename *__audit_reusename(const __user char *uptr);
@@ -141,12 +146,12 @@ static inline void audit_free(struct task_struct *task)
141 if (unlikely(task->audit_context)) 146 if (unlikely(task->audit_context))
142 __audit_free(task); 147 __audit_free(task);
143} 148}
144static inline void audit_syscall_entry(int arch, int major, unsigned long a0, 149static inline void audit_syscall_entry(int major, unsigned long a0,
145 unsigned long a1, unsigned long a2, 150 unsigned long a1, unsigned long a2,
146 unsigned long a3) 151 unsigned long a3)
147{ 152{
148 if (unlikely(current->audit_context)) 153 if (unlikely(current->audit_context))
149 __audit_syscall_entry(arch, major, a0, a1, a2, a3); 154 __audit_syscall_entry(major, a0, a1, a2, a3);
150} 155}
151static inline void audit_syscall_exit(void *pt_regs) 156static inline void audit_syscall_exit(void *pt_regs)
152{ 157{
@@ -322,7 +327,7 @@ static inline int audit_alloc(struct task_struct *task)
322} 327}
323static inline void audit_free(struct task_struct *task) 328static inline void audit_free(struct task_struct *task)
324{ } 329{ }
325static inline void audit_syscall_entry(int arch, int major, unsigned long a0, 330static inline void audit_syscall_entry(int major, unsigned long a0,
326 unsigned long a1, unsigned long a2, 331 unsigned long a1, unsigned long a2,
327 unsigned long a3) 332 unsigned long a3)
328{ } 333{ }
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index e488e9459a93..5da6012b7a14 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -28,12 +28,10 @@ struct dentry;
28 * Bits in backing_dev_info.state 28 * Bits in backing_dev_info.state
29 */ 29 */
30enum bdi_state { 30enum bdi_state {
31 BDI_wb_alloc, /* Default embedded wb allocated */
32 BDI_async_congested, /* The async (write) queue is getting full */ 31 BDI_async_congested, /* The async (write) queue is getting full */
33 BDI_sync_congested, /* The sync queue is getting full */ 32 BDI_sync_congested, /* The sync queue is getting full */
34 BDI_registered, /* bdi_register() was done */ 33 BDI_registered, /* bdi_register() was done */
35 BDI_writeback_running, /* Writeback is in progress */ 34 BDI_writeback_running, /* Writeback is in progress */
36 BDI_unused, /* Available bits start here */
37}; 35};
38 36
39typedef int (congested_fn)(void *, int); 37typedef int (congested_fn)(void *, int);
@@ -50,7 +48,6 @@ enum bdi_stat_item {
50 48
51struct bdi_writeback { 49struct bdi_writeback {
52 struct backing_dev_info *bdi; /* our parent bdi */ 50 struct backing_dev_info *bdi; /* our parent bdi */
53 unsigned int nr;
54 51
55 unsigned long last_old_flush; /* last old data flush */ 52 unsigned long last_old_flush; /* last old data flush */
56 53
@@ -124,7 +121,6 @@ void bdi_start_background_writeback(struct backing_dev_info *bdi);
124void bdi_writeback_workfn(struct work_struct *work); 121void bdi_writeback_workfn(struct work_struct *work);
125int bdi_has_dirty_io(struct backing_dev_info *bdi); 122int bdi_has_dirty_io(struct backing_dev_info *bdi);
126void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi); 123void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi);
127void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2);
128 124
129extern spinlock_t bdi_lock; 125extern spinlock_t bdi_lock;
130extern struct list_head bdi_list; 126extern struct list_head bdi_list;
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index 089743ade734..9b0a15d06a4f 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -27,10 +27,13 @@
27 * counter raised only while it is under our special handling; 27 * counter raised only while it is under our special handling;
28 * 28 *
29 * iii. after the lockless scan step have selected a potential balloon page for 29 * iii. after the lockless scan step have selected a potential balloon page for
30 * isolation, re-test the page->mapping flags and the page ref counter 30 * isolation, re-test the PageBalloon mark and the PagePrivate flag
31 * under the proper page lock, to ensure isolating a valid balloon page 31 * under the proper page lock, to ensure isolating a valid balloon page
32 * (not yet isolated, nor under release procedure) 32 * (not yet isolated, nor under release procedure)
33 * 33 *
34 * iv. isolation or dequeueing procedure must clear PagePrivate flag under
35 * page lock together with removing page from balloon device page list.
36 *
34 * The functions provided by this interface are placed to help on coping with 37 * The functions provided by this interface are placed to help on coping with
35 * the aforementioned balloon page corner case, as well as to ensure the simple 38 * the aforementioned balloon page corner case, as well as to ensure the simple
36 * set of exposed rules are satisfied while we are dealing with balloon pages 39 * set of exposed rules are satisfied while we are dealing with balloon pages
@@ -54,43 +57,22 @@
54 * balloon driver as a page book-keeper for its registered balloon devices. 57 * balloon driver as a page book-keeper for its registered balloon devices.
55 */ 58 */
56struct balloon_dev_info { 59struct balloon_dev_info {
57 void *balloon_device; /* balloon device descriptor */
58 struct address_space *mapping; /* balloon special page->mapping */
59 unsigned long isolated_pages; /* # of isolated pages for migration */ 60 unsigned long isolated_pages; /* # of isolated pages for migration */
60 spinlock_t pages_lock; /* Protection to pages list */ 61 spinlock_t pages_lock; /* Protection to pages list */
61 struct list_head pages; /* Pages enqueued & handled to Host */ 62 struct list_head pages; /* Pages enqueued & handled to Host */
63 int (*migratepage)(struct balloon_dev_info *, struct page *newpage,
64 struct page *page, enum migrate_mode mode);
62}; 65};
63 66
64extern struct page *balloon_page_enqueue(struct balloon_dev_info *b_dev_info); 67extern struct page *balloon_page_enqueue(struct balloon_dev_info *b_dev_info);
65extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info); 68extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info);
66extern struct balloon_dev_info *balloon_devinfo_alloc(
67 void *balloon_dev_descriptor);
68 69
69static inline void balloon_devinfo_free(struct balloon_dev_info *b_dev_info) 70static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
70{
71 kfree(b_dev_info);
72}
73
74/*
75 * balloon_page_free - release a balloon page back to the page free lists
76 * @page: ballooned page to be set free
77 *
78 * This function must be used to properly set free an isolated/dequeued balloon
79 * page at the end of a sucessful page migration, or at the balloon driver's
80 * page release procedure.
81 */
82static inline void balloon_page_free(struct page *page)
83{ 71{
84 /* 72 balloon->isolated_pages = 0;
85 * Balloon pages always get an extra refcount before being isolated 73 spin_lock_init(&balloon->pages_lock);
86 * and before being dequeued to help on sorting out fortuite colisions 74 INIT_LIST_HEAD(&balloon->pages);
87 * between a thread attempting to isolate and another thread attempting 75 balloon->migratepage = NULL;
88 * to release the very same balloon page.
89 *
90 * Before we handle the page back to Buddy, lets drop its extra refcnt.
91 */
92 put_page(page);
93 __free_page(page);
94} 76}
95 77
96#ifdef CONFIG_BALLOON_COMPACTION 78#ifdef CONFIG_BALLOON_COMPACTION
@@ -98,107 +80,58 @@ extern bool balloon_page_isolate(struct page *page);
98extern void balloon_page_putback(struct page *page); 80extern void balloon_page_putback(struct page *page);
99extern int balloon_page_migrate(struct page *newpage, 81extern int balloon_page_migrate(struct page *newpage,
100 struct page *page, enum migrate_mode mode); 82 struct page *page, enum migrate_mode mode);
101extern struct address_space
102*balloon_mapping_alloc(struct balloon_dev_info *b_dev_info,
103 const struct address_space_operations *a_ops);
104
105static inline void balloon_mapping_free(struct address_space *balloon_mapping)
106{
107 kfree(balloon_mapping);
108}
109 83
110/* 84/*
111 * page_flags_cleared - helper to perform balloon @page ->flags tests. 85 * __is_movable_balloon_page - helper to perform @page PageBalloon tests
112 *
113 * As balloon pages are obtained from buddy and we do not play with page->flags
114 * at driver level (exception made when we get the page lock for compaction),
115 * we can safely identify a ballooned page by checking if the
116 * PAGE_FLAGS_CHECK_AT_PREP page->flags are all cleared. This approach also
117 * helps us skip ballooned pages that are locked for compaction or release, thus
118 * mitigating their racy check at balloon_page_movable()
119 */
120static inline bool page_flags_cleared(struct page *page)
121{
122 return !(page->flags & PAGE_FLAGS_CHECK_AT_PREP);
123}
124
125/*
126 * __is_movable_balloon_page - helper to perform @page mapping->flags tests
127 */ 86 */
128static inline bool __is_movable_balloon_page(struct page *page) 87static inline bool __is_movable_balloon_page(struct page *page)
129{ 88{
130 struct address_space *mapping = page->mapping; 89 return PageBalloon(page);
131 return mapping_balloon(mapping);
132} 90}
133 91
134/* 92/*
135 * balloon_page_movable - test page->mapping->flags to identify balloon pages 93 * balloon_page_movable - test PageBalloon to identify balloon pages
136 * that can be moved by compaction/migration. 94 * and PagePrivate to check that the page is not
137 * 95 * isolated and can be moved by compaction/migration.
138 * This function is used at core compaction's page isolation scheme, therefore
139 * most pages exposed to it are not enlisted as balloon pages and so, to avoid
140 * undesired side effects like racing against __free_pages(), we cannot afford
141 * holding the page locked while testing page->mapping->flags here.
142 * 96 *
143 * As we might return false positives in the case of a balloon page being just 97 * As we might return false positives in the case of a balloon page being just
144 * released under us, the page->mapping->flags need to be re-tested later, 98 * released under us, this need to be re-tested later, under the page lock.
145 * under the proper page lock, at the functions that will be coping with the
146 * balloon page case.
147 */ 99 */
148static inline bool balloon_page_movable(struct page *page) 100static inline bool balloon_page_movable(struct page *page)
149{ 101{
150 /* 102 return PageBalloon(page) && PagePrivate(page);
151 * Before dereferencing and testing mapping->flags, let's make sure
152 * this is not a page that uses ->mapping in a different way
153 */
154 if (page_flags_cleared(page) && !page_mapped(page) &&
155 page_count(page) == 1)
156 return __is_movable_balloon_page(page);
157
158 return false;
159} 103}
160 104
161/* 105/*
162 * isolated_balloon_page - identify an isolated balloon page on private 106 * isolated_balloon_page - identify an isolated balloon page on private
163 * compaction/migration page lists. 107 * compaction/migration page lists.
164 *
165 * After a compaction thread isolates a balloon page for migration, it raises
166 * the page refcount to prevent concurrent compaction threads from re-isolating
167 * the same page. For that reason putback_movable_pages(), or other routines
168 * that need to identify isolated balloon pages on private pagelists, cannot
169 * rely on balloon_page_movable() to accomplish the task.
170 */ 108 */
171static inline bool isolated_balloon_page(struct page *page) 109static inline bool isolated_balloon_page(struct page *page)
172{ 110{
173 /* Already isolated balloon pages, by default, have a raised refcount */ 111 return PageBalloon(page);
174 if (page_flags_cleared(page) && !page_mapped(page) &&
175 page_count(page) >= 2)
176 return __is_movable_balloon_page(page);
177
178 return false;
179} 112}
180 113
181/* 114/*
182 * balloon_page_insert - insert a page into the balloon's page list and make 115 * balloon_page_insert - insert a page into the balloon's page list and make
183 * the page->mapping assignment accordingly. 116 * the page->private assignment accordingly.
117 * @balloon : pointer to balloon device
184 * @page : page to be assigned as a 'balloon page' 118 * @page : page to be assigned as a 'balloon page'
185 * @mapping : allocated special 'balloon_mapping'
186 * @head : balloon's device page list head
187 * 119 *
188 * Caller must ensure the page is locked and the spin_lock protecting balloon 120 * Caller must ensure the page is locked and the spin_lock protecting balloon
189 * pages list is held before inserting a page into the balloon device. 121 * pages list is held before inserting a page into the balloon device.
190 */ 122 */
191static inline void balloon_page_insert(struct page *page, 123static inline void balloon_page_insert(struct balloon_dev_info *balloon,
192 struct address_space *mapping, 124 struct page *page)
193 struct list_head *head)
194{ 125{
195 page->mapping = mapping; 126 __SetPageBalloon(page);
196 list_add(&page->lru, head); 127 SetPagePrivate(page);
128 set_page_private(page, (unsigned long)balloon);
129 list_add(&page->lru, &balloon->pages);
197} 130}
198 131
199/* 132/*
200 * balloon_page_delete - delete a page from balloon's page list and clear 133 * balloon_page_delete - delete a page from balloon's page list and clear
201 * the page->mapping assignement accordingly. 134 * the page->private assignement accordingly.
202 * @page : page to be released from balloon's page list 135 * @page : page to be released from balloon's page list
203 * 136 *
204 * Caller must ensure the page is locked and the spin_lock protecting balloon 137 * Caller must ensure the page is locked and the spin_lock protecting balloon
@@ -206,8 +139,12 @@ static inline void balloon_page_insert(struct page *page,
206 */ 139 */
207static inline void balloon_page_delete(struct page *page) 140static inline void balloon_page_delete(struct page *page)
208{ 141{
209 page->mapping = NULL; 142 __ClearPageBalloon(page);
210 list_del(&page->lru); 143 set_page_private(page, 0);
144 if (PagePrivate(page)) {
145 ClearPagePrivate(page);
146 list_del(&page->lru);
147 }
211} 148}
212 149
213/* 150/*
@@ -216,11 +153,7 @@ static inline void balloon_page_delete(struct page *page)
216 */ 153 */
217static inline struct balloon_dev_info *balloon_page_device(struct page *page) 154static inline struct balloon_dev_info *balloon_page_device(struct page *page)
218{ 155{
219 struct address_space *mapping = page->mapping; 156 return (struct balloon_dev_info *)page_private(page);
220 if (likely(mapping))
221 return mapping->private_data;
222
223 return NULL;
224} 157}
225 158
226static inline gfp_t balloon_mapping_gfp_mask(void) 159static inline gfp_t balloon_mapping_gfp_mask(void)
@@ -228,34 +161,24 @@ static inline gfp_t balloon_mapping_gfp_mask(void)
228 return GFP_HIGHUSER_MOVABLE; 161 return GFP_HIGHUSER_MOVABLE;
229} 162}
230 163
231static inline bool balloon_compaction_check(void)
232{
233 return true;
234}
235
236#else /* !CONFIG_BALLOON_COMPACTION */ 164#else /* !CONFIG_BALLOON_COMPACTION */
237 165
238static inline void *balloon_mapping_alloc(void *balloon_device, 166static inline void balloon_page_insert(struct balloon_dev_info *balloon,
239 const struct address_space_operations *a_ops) 167 struct page *page)
240{
241 return ERR_PTR(-EOPNOTSUPP);
242}
243
244static inline void balloon_mapping_free(struct address_space *balloon_mapping)
245{ 168{
246 return; 169 __SetPageBalloon(page);
170 list_add(&page->lru, &balloon->pages);
247} 171}
248 172
249static inline void balloon_page_insert(struct page *page, 173static inline void balloon_page_delete(struct page *page)
250 struct address_space *mapping,
251 struct list_head *head)
252{ 174{
253 list_add(&page->lru, head); 175 __ClearPageBalloon(page);
176 list_del(&page->lru);
254} 177}
255 178
256static inline void balloon_page_delete(struct page *page) 179static inline bool __is_movable_balloon_page(struct page *page)
257{ 180{
258 list_del(&page->lru); 181 return false;
259} 182}
260 183
261static inline bool balloon_page_movable(struct page *page) 184static inline bool balloon_page_movable(struct page *page)
@@ -289,9 +212,5 @@ static inline gfp_t balloon_mapping_gfp_mask(void)
289 return GFP_HIGHUSER; 212 return GFP_HIGHUSER;
290} 213}
291 214
292static inline bool balloon_compaction_check(void)
293{
294 return false;
295}
296#endif /* CONFIG_BALLOON_COMPACTION */ 215#endif /* CONFIG_BALLOON_COMPACTION */
297#endif /* _LINUX_BALLOON_COMPACTION_H */ 216#endif /* _LINUX_BALLOON_COMPACTION_H */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 0272e49135d0..729f48e6b20b 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -267,7 +267,7 @@ struct bcma_device {
267 u8 core_unit; 267 u8 core_unit;
268 268
269 u32 addr; 269 u32 addr;
270 u32 addr1; 270 u32 addr_s[8];
271 u32 wrap; 271 u32 wrap;
272 272
273 void __iomem *io_addr; 273 void __iomem *io_addr;
@@ -323,6 +323,8 @@ struct bcma_bus {
323 struct pci_dev *host_pci; 323 struct pci_dev *host_pci;
324 /* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */ 324 /* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */
325 struct sdio_func *host_sdio; 325 struct sdio_func *host_sdio;
326 /* Pointer to platform device (only for BCMA_HOSTTYPE_SOC) */
327 struct platform_device *host_pdev;
326 }; 328 };
327 329
328 struct bcma_chipinfo chipinfo; 330 struct bcma_chipinfo chipinfo;
@@ -332,10 +334,10 @@ struct bcma_bus {
332 struct bcma_device *mapped_core; 334 struct bcma_device *mapped_core;
333 struct list_head cores; 335 struct list_head cores;
334 u8 nr_cores; 336 u8 nr_cores;
335 u8 init_done:1;
336 u8 num; 337 u8 num;
337 338
338 struct bcma_drv_cc drv_cc; 339 struct bcma_drv_cc drv_cc;
340 struct bcma_drv_cc_b drv_cc_b;
339 struct bcma_drv_pci drv_pci[2]; 341 struct bcma_drv_pci drv_pci[2];
340 struct bcma_drv_pcie2 drv_pcie2; 342 struct bcma_drv_pcie2 drv_pcie2;
341 struct bcma_drv_mips drv_mips; 343 struct bcma_drv_mips drv_mips;
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 63d105cd14a3..db6fa217f98b 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -644,6 +644,12 @@ struct bcma_drv_cc {
644#endif 644#endif
645}; 645};
646 646
647struct bcma_drv_cc_b {
648 struct bcma_device *core;
649 u8 setup_done:1;
650 void __iomem *mii;
651};
652
647/* Register access */ 653/* Register access */
648#define bcma_cc_read32(cc, offset) \ 654#define bcma_cc_read32(cc, offset) \
649 bcma_read32((cc)->core, offset) 655 bcma_read32((cc)->core, offset)
@@ -699,4 +705,6 @@ extern void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid);
699 705
700extern u32 bcma_pmu_get_bus_clock(struct bcma_drv_cc *cc); 706extern u32 bcma_pmu_get_bus_clock(struct bcma_drv_cc *cc);
701 707
708void bcma_chipco_b_mii_write(struct bcma_drv_cc_b *ccb, u32 offset, u32 value);
709
702#endif /* LINUX_BCMA_DRIVER_CC_H_ */ 710#endif /* LINUX_BCMA_DRIVER_CC_H_ */
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h
index 917dcd7965e7..e64ae7bf80a1 100644
--- a/include/linux/bcma/bcma_regs.h
+++ b/include/linux/bcma/bcma_regs.h
@@ -39,6 +39,11 @@
39#define BCMA_RESET_CTL_RESET 0x0001 39#define BCMA_RESET_CTL_RESET 0x0001
40#define BCMA_RESET_ST 0x0804 40#define BCMA_RESET_ST 0x0804
41 41
42#define BCMA_NS_ROM_IOST_BOOT_DEV_MASK 0x0003
43#define BCMA_NS_ROM_IOST_BOOT_DEV_NOR 0x0000
44#define BCMA_NS_ROM_IOST_BOOT_DEV_NAND 0x0001
45#define BCMA_NS_ROM_IOST_BOOT_DEV_ROM 0x0002
46
42/* BCMA PCI config space registers. */ 47/* BCMA PCI config space registers. */
43#define BCMA_PCI_PMCSR 0x44 48#define BCMA_PCI_PMCSR 0x44
44#define BCMA_PCI_PE 0x100 49#define BCMA_PCI_PE 0x100
diff --git a/include/linux/bcma/bcma_soc.h b/include/linux/bcma/bcma_soc.h
index 4203c5593b9f..f24d245f8394 100644
--- a/include/linux/bcma/bcma_soc.h
+++ b/include/linux/bcma/bcma_soc.h
@@ -10,6 +10,7 @@ struct bcma_soc {
10}; 10};
11 11
12int __init bcma_host_soc_register(struct bcma_soc *soc); 12int __init bcma_host_soc_register(struct bcma_soc *soc);
13int __init bcma_host_soc_init(struct bcma_soc *soc);
13 14
14int bcma_bus_register(struct bcma_bus *bus); 15int bcma_bus_register(struct bcma_bus *bus);
15 16
diff --git a/include/linux/bio.h b/include/linux/bio.h
index d2633ee099d9..7347f486ceca 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -292,7 +292,24 @@ static inline unsigned bio_segments(struct bio *bio)
292 */ 292 */
293#define bio_get(bio) atomic_inc(&(bio)->bi_cnt) 293#define bio_get(bio) atomic_inc(&(bio)->bi_cnt)
294 294
295enum bip_flags {
296 BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */
297 BIP_MAPPED_INTEGRITY = 1 << 1, /* ref tag has been remapped */
298 BIP_CTRL_NOCHECK = 1 << 2, /* disable HBA integrity checking */
299 BIP_DISK_NOCHECK = 1 << 3, /* disable disk integrity checking */
300 BIP_IP_CHECKSUM = 1 << 4, /* IP checksum */
301};
302
295#if defined(CONFIG_BLK_DEV_INTEGRITY) 303#if defined(CONFIG_BLK_DEV_INTEGRITY)
304
305static inline struct bio_integrity_payload *bio_integrity(struct bio *bio)
306{
307 if (bio->bi_rw & REQ_INTEGRITY)
308 return bio->bi_integrity;
309
310 return NULL;
311}
312
296/* 313/*
297 * bio integrity payload 314 * bio integrity payload
298 */ 315 */
@@ -301,20 +318,40 @@ struct bio_integrity_payload {
301 318
302 struct bvec_iter bip_iter; 319 struct bvec_iter bip_iter;
303 320
304 /* kill - should just use bip_vec */
305 void *bip_buf; /* generated integrity data */
306
307 bio_end_io_t *bip_end_io; /* saved I/O completion fn */ 321 bio_end_io_t *bip_end_io; /* saved I/O completion fn */
308 322
309 unsigned short bip_slab; /* slab the bip came from */ 323 unsigned short bip_slab; /* slab the bip came from */
310 unsigned short bip_vcnt; /* # of integrity bio_vecs */ 324 unsigned short bip_vcnt; /* # of integrity bio_vecs */
311 unsigned bip_owns_buf:1; /* should free bip_buf */ 325 unsigned short bip_max_vcnt; /* integrity bio_vec slots */
326 unsigned short bip_flags; /* control flags */
312 327
313 struct work_struct bip_work; /* I/O completion */ 328 struct work_struct bip_work; /* I/O completion */
314 329
315 struct bio_vec *bip_vec; 330 struct bio_vec *bip_vec;
316 struct bio_vec bip_inline_vecs[0];/* embedded bvec array */ 331 struct bio_vec bip_inline_vecs[0];/* embedded bvec array */
317}; 332};
333
334static inline bool bio_integrity_flagged(struct bio *bio, enum bip_flags flag)
335{
336 struct bio_integrity_payload *bip = bio_integrity(bio);
337
338 if (bip)
339 return bip->bip_flags & flag;
340
341 return false;
342}
343
344static inline sector_t bip_get_seed(struct bio_integrity_payload *bip)
345{
346 return bip->bip_iter.bi_sector;
347}
348
349static inline void bip_set_seed(struct bio_integrity_payload *bip,
350 sector_t seed)
351{
352 bip->bip_iter.bi_sector = seed;
353}
354
318#endif /* CONFIG_BLK_DEV_INTEGRITY */ 355#endif /* CONFIG_BLK_DEV_INTEGRITY */
319 356
320extern void bio_trim(struct bio *bio, int offset, int size); 357extern void bio_trim(struct bio *bio, int offset, int size);
@@ -341,6 +378,7 @@ static inline struct bio *bio_next_split(struct bio *bio, int sectors,
341} 378}
342 379
343extern struct bio_set *bioset_create(unsigned int, unsigned int); 380extern struct bio_set *bioset_create(unsigned int, unsigned int);
381extern struct bio_set *bioset_create_nobvec(unsigned int, unsigned int);
344extern void bioset_free(struct bio_set *); 382extern void bioset_free(struct bio_set *);
345extern mempool_t *biovec_create_pool(int pool_entries); 383extern mempool_t *biovec_create_pool(int pool_entries);
346 384
@@ -352,7 +390,6 @@ extern struct bio *bio_clone_fast(struct bio *, gfp_t, struct bio_set *);
352extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs); 390extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs);
353 391
354extern struct bio_set *fs_bio_set; 392extern struct bio_set *fs_bio_set;
355unsigned int bio_integrity_tag_size(struct bio *bio);
356 393
357static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs) 394static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs)
358{ 395{
@@ -660,14 +697,10 @@ struct biovec_slab {
660 for_each_bio(_bio) \ 697 for_each_bio(_bio) \
661 bip_for_each_vec(_bvl, _bio->bi_integrity, _iter) 698 bip_for_each_vec(_bvl, _bio->bi_integrity, _iter)
662 699
663#define bio_integrity(bio) (bio->bi_integrity != NULL)
664
665extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); 700extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int);
666extern void bio_integrity_free(struct bio *); 701extern void bio_integrity_free(struct bio *);
667extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); 702extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int);
668extern int bio_integrity_enabled(struct bio *bio); 703extern bool bio_integrity_enabled(struct bio *bio);
669extern int bio_integrity_set_tag(struct bio *, void *, unsigned int);
670extern int bio_integrity_get_tag(struct bio *, void *, unsigned int);
671extern int bio_integrity_prep(struct bio *); 704extern int bio_integrity_prep(struct bio *);
672extern void bio_integrity_endio(struct bio *, int); 705extern void bio_integrity_endio(struct bio *, int);
673extern void bio_integrity_advance(struct bio *, unsigned int); 706extern void bio_integrity_advance(struct bio *, unsigned int);
@@ -679,14 +712,14 @@ extern void bio_integrity_init(void);
679 712
680#else /* CONFIG_BLK_DEV_INTEGRITY */ 713#else /* CONFIG_BLK_DEV_INTEGRITY */
681 714
682static inline int bio_integrity(struct bio *bio) 715static inline void *bio_integrity(struct bio *bio)
683{ 716{
684 return 0; 717 return NULL;
685} 718}
686 719
687static inline int bio_integrity_enabled(struct bio *bio) 720static inline bool bio_integrity_enabled(struct bio *bio)
688{ 721{
689 return 0; 722 return false;
690} 723}
691 724
692static inline int bioset_integrity_create(struct bio_set *bs, int pool_size) 725static inline int bioset_integrity_create(struct bio_set *bs, int pool_size)
@@ -732,6 +765,11 @@ static inline void bio_integrity_init(void)
732 return; 765 return;
733} 766}
734 767
768static inline bool bio_integrity_flagged(struct bio *bio, enum bip_flags flag)
769{
770 return false;
771}
772
735#endif /* CONFIG_BLK_DEV_INTEGRITY */ 773#endif /* CONFIG_BLK_DEV_INTEGRITY */
736 774
737#endif /* CONFIG_BLOCK */ 775#endif /* CONFIG_BLOCK */
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 7ad634501e48..e1c8d080c427 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -88,32 +88,32 @@
88 * lib/bitmap.c provides these functions: 88 * lib/bitmap.c provides these functions:
89 */ 89 */
90 90
91extern int __bitmap_empty(const unsigned long *bitmap, int bits); 91extern int __bitmap_empty(const unsigned long *bitmap, unsigned int nbits);
92extern int __bitmap_full(const unsigned long *bitmap, int bits); 92extern int __bitmap_full(const unsigned long *bitmap, unsigned int nbits);
93extern int __bitmap_equal(const unsigned long *bitmap1, 93extern int __bitmap_equal(const unsigned long *bitmap1,
94 const unsigned long *bitmap2, int bits); 94 const unsigned long *bitmap2, unsigned int nbits);
95extern void __bitmap_complement(unsigned long *dst, const unsigned long *src, 95extern void __bitmap_complement(unsigned long *dst, const unsigned long *src,
96 int bits); 96 unsigned int nbits);
97extern void __bitmap_shift_right(unsigned long *dst, 97extern void __bitmap_shift_right(unsigned long *dst,
98 const unsigned long *src, int shift, int bits); 98 const unsigned long *src, int shift, int bits);
99extern void __bitmap_shift_left(unsigned long *dst, 99extern void __bitmap_shift_left(unsigned long *dst,
100 const unsigned long *src, int shift, int bits); 100 const unsigned long *src, int shift, int bits);
101extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, 101extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
102 const unsigned long *bitmap2, int bits); 102 const unsigned long *bitmap2, unsigned int nbits);
103extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, 103extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
104 const unsigned long *bitmap2, int bits); 104 const unsigned long *bitmap2, unsigned int nbits);
105extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, 105extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
106 const unsigned long *bitmap2, int bits); 106 const unsigned long *bitmap2, unsigned int nbits);
107extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, 107extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
108 const unsigned long *bitmap2, int bits); 108 const unsigned long *bitmap2, unsigned int nbits);
109extern int __bitmap_intersects(const unsigned long *bitmap1, 109extern int __bitmap_intersects(const unsigned long *bitmap1,
110 const unsigned long *bitmap2, int bits); 110 const unsigned long *bitmap2, unsigned int nbits);
111extern int __bitmap_subset(const unsigned long *bitmap1, 111extern int __bitmap_subset(const unsigned long *bitmap1,
112 const unsigned long *bitmap2, int bits); 112 const unsigned long *bitmap2, unsigned int nbits);
113extern int __bitmap_weight(const unsigned long *bitmap, int bits); 113extern int __bitmap_weight(const unsigned long *bitmap, unsigned int nbits);
114 114
115extern void bitmap_set(unsigned long *map, int i, int len); 115extern void bitmap_set(unsigned long *map, unsigned int start, int len);
116extern void bitmap_clear(unsigned long *map, int start, int nr); 116extern void bitmap_clear(unsigned long *map, unsigned int start, int len);
117extern unsigned long bitmap_find_next_zero_area(unsigned long *map, 117extern unsigned long bitmap_find_next_zero_area(unsigned long *map,
118 unsigned long size, 118 unsigned long size,
119 unsigned long start, 119 unsigned long start,
@@ -140,9 +140,9 @@ extern void bitmap_onto(unsigned long *dst, const unsigned long *orig,
140 const unsigned long *relmap, int bits); 140 const unsigned long *relmap, int bits);
141extern void bitmap_fold(unsigned long *dst, const unsigned long *orig, 141extern void bitmap_fold(unsigned long *dst, const unsigned long *orig,
142 int sz, int bits); 142 int sz, int bits);
143extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); 143extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order);
144extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); 144extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order);
145extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); 145extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order);
146extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); 146extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits);
147extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits); 147extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits);
148 148
@@ -188,15 +188,15 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
188} 188}
189 189
190static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, 190static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
191 const unsigned long *src2, int nbits) 191 const unsigned long *src2, unsigned int nbits)
192{ 192{
193 if (small_const_nbits(nbits)) 193 if (small_const_nbits(nbits))
194 return (*dst = *src1 & *src2) != 0; 194 return (*dst = *src1 & *src2 & BITMAP_LAST_WORD_MASK(nbits)) != 0;
195 return __bitmap_and(dst, src1, src2, nbits); 195 return __bitmap_and(dst, src1, src2, nbits);
196} 196}
197 197
198static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, 198static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
199 const unsigned long *src2, int nbits) 199 const unsigned long *src2, unsigned int nbits)
200{ 200{
201 if (small_const_nbits(nbits)) 201 if (small_const_nbits(nbits))
202 *dst = *src1 | *src2; 202 *dst = *src1 | *src2;
@@ -205,7 +205,7 @@ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
205} 205}
206 206
207static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, 207static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
208 const unsigned long *src2, int nbits) 208 const unsigned long *src2, unsigned int nbits)
209{ 209{
210 if (small_const_nbits(nbits)) 210 if (small_const_nbits(nbits))
211 *dst = *src1 ^ *src2; 211 *dst = *src1 ^ *src2;
@@ -214,24 +214,24 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
214} 214}
215 215
216static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1, 216static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1,
217 const unsigned long *src2, int nbits) 217 const unsigned long *src2, unsigned int nbits)
218{ 218{
219 if (small_const_nbits(nbits)) 219 if (small_const_nbits(nbits))
220 return (*dst = *src1 & ~(*src2)) != 0; 220 return (*dst = *src1 & ~(*src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
221 return __bitmap_andnot(dst, src1, src2, nbits); 221 return __bitmap_andnot(dst, src1, src2, nbits);
222} 222}
223 223
224static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, 224static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
225 int nbits) 225 unsigned int nbits)
226{ 226{
227 if (small_const_nbits(nbits)) 227 if (small_const_nbits(nbits))
228 *dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits); 228 *dst = ~(*src);
229 else 229 else
230 __bitmap_complement(dst, src, nbits); 230 __bitmap_complement(dst, src, nbits);
231} 231}
232 232
233static inline int bitmap_equal(const unsigned long *src1, 233static inline int bitmap_equal(const unsigned long *src1,
234 const unsigned long *src2, int nbits) 234 const unsigned long *src2, unsigned int nbits)
235{ 235{
236 if (small_const_nbits(nbits)) 236 if (small_const_nbits(nbits))
237 return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits)); 237 return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
@@ -240,7 +240,7 @@ static inline int bitmap_equal(const unsigned long *src1,
240} 240}
241 241
242static inline int bitmap_intersects(const unsigned long *src1, 242static inline int bitmap_intersects(const unsigned long *src1,
243 const unsigned long *src2, int nbits) 243 const unsigned long *src2, unsigned int nbits)
244{ 244{
245 if (small_const_nbits(nbits)) 245 if (small_const_nbits(nbits))
246 return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0; 246 return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
@@ -249,7 +249,7 @@ static inline int bitmap_intersects(const unsigned long *src1,
249} 249}
250 250
251static inline int bitmap_subset(const unsigned long *src1, 251static inline int bitmap_subset(const unsigned long *src1,
252 const unsigned long *src2, int nbits) 252 const unsigned long *src2, unsigned int nbits)
253{ 253{
254 if (small_const_nbits(nbits)) 254 if (small_const_nbits(nbits))
255 return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits)); 255 return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits));
@@ -257,7 +257,7 @@ static inline int bitmap_subset(const unsigned long *src1,
257 return __bitmap_subset(src1, src2, nbits); 257 return __bitmap_subset(src1, src2, nbits);
258} 258}
259 259
260static inline int bitmap_empty(const unsigned long *src, int nbits) 260static inline int bitmap_empty(const unsigned long *src, unsigned nbits)
261{ 261{
262 if (small_const_nbits(nbits)) 262 if (small_const_nbits(nbits))
263 return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); 263 return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
@@ -265,7 +265,7 @@ static inline int bitmap_empty(const unsigned long *src, int nbits)
265 return __bitmap_empty(src, nbits); 265 return __bitmap_empty(src, nbits);
266} 266}
267 267
268static inline int bitmap_full(const unsigned long *src, int nbits) 268static inline int bitmap_full(const unsigned long *src, unsigned int nbits)
269{ 269{
270 if (small_const_nbits(nbits)) 270 if (small_const_nbits(nbits))
271 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); 271 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
@@ -273,7 +273,7 @@ static inline int bitmap_full(const unsigned long *src, int nbits)
273 return __bitmap_full(src, nbits); 273 return __bitmap_full(src, nbits);
274} 274}
275 275
276static inline int bitmap_weight(const unsigned long *src, int nbits) 276static inline int bitmap_weight(const unsigned long *src, unsigned int nbits)
277{ 277{
278 if (small_const_nbits(nbits)) 278 if (small_const_nbits(nbits))
279 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); 279 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits));
@@ -284,7 +284,7 @@ static inline void bitmap_shift_right(unsigned long *dst,
284 const unsigned long *src, int n, int nbits) 284 const unsigned long *src, int n, int nbits)
285{ 285{
286 if (small_const_nbits(nbits)) 286 if (small_const_nbits(nbits))
287 *dst = *src >> n; 287 *dst = (*src & BITMAP_LAST_WORD_MASK(nbits)) >> n;
288 else 288 else
289 __bitmap_shift_right(dst, src, n, nbits); 289 __bitmap_shift_right(dst, src, n, nbits);
290} 290}
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index cbc5833fb221..be5fd38bd5a0 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -32,26 +32,6 @@ extern unsigned long __sw_hweight64(__u64 w);
32 */ 32 */
33#include <asm/bitops.h> 33#include <asm/bitops.h>
34 34
35/*
36 * Provide __deprecated wrappers for the new interface, avoid flag day changes.
37 * We need the ugly external functions to break header recursion hell.
38 */
39#ifndef smp_mb__before_clear_bit
40static inline void __deprecated smp_mb__before_clear_bit(void)
41{
42 extern void __smp_mb__before_atomic(void);
43 __smp_mb__before_atomic();
44}
45#endif
46
47#ifndef smp_mb__after_clear_bit
48static inline void __deprecated smp_mb__after_clear_bit(void)
49{
50 extern void __smp_mb__after_atomic(void);
51 __smp_mb__after_atomic();
52}
53#endif
54
55#define for_each_set_bit(bit, addr, size) \ 35#define for_each_set_bit(bit, addr, size) \
56 for ((bit) = find_first_bit((addr), (size)); \ 36 for ((bit) = find_first_bit((addr), (size)); \
57 (bit) < (size); \ 37 (bit) < (size); \
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index eb726b9c5762..c9be1589415a 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -4,6 +4,7 @@
4#include <linux/blkdev.h> 4#include <linux/blkdev.h>
5 5
6struct blk_mq_tags; 6struct blk_mq_tags;
7struct blk_flush_queue;
7 8
8struct blk_mq_cpu_notifier { 9struct blk_mq_cpu_notifier {
9 struct list_head list; 10 struct list_head list;
@@ -34,6 +35,7 @@ struct blk_mq_hw_ctx {
34 35
35 struct request_queue *queue; 36 struct request_queue *queue;
36 unsigned int queue_num; 37 unsigned int queue_num;
38 struct blk_flush_queue *fq;
37 39
38 void *driver_data; 40 void *driver_data;
39 41
@@ -77,8 +79,9 @@ struct blk_mq_tag_set {
77 struct list_head tag_list; 79 struct list_head tag_list;
78}; 80};
79 81
80typedef int (queue_rq_fn)(struct blk_mq_hw_ctx *, struct request *); 82typedef int (queue_rq_fn)(struct blk_mq_hw_ctx *, struct request *, bool);
81typedef struct blk_mq_hw_ctx *(map_queue_fn)(struct request_queue *, const int); 83typedef struct blk_mq_hw_ctx *(map_queue_fn)(struct request_queue *, const int);
84typedef enum blk_eh_timer_return (timeout_fn)(struct request *, bool);
82typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int); 85typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int);
83typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int); 86typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int);
84typedef int (init_request_fn)(void *, struct request *, unsigned int, 87typedef int (init_request_fn)(void *, struct request *, unsigned int,
@@ -86,6 +89,9 @@ typedef int (init_request_fn)(void *, struct request *, unsigned int,
86typedef void (exit_request_fn)(void *, struct request *, unsigned int, 89typedef void (exit_request_fn)(void *, struct request *, unsigned int,
87 unsigned int); 90 unsigned int);
88 91
92typedef void (busy_iter_fn)(struct blk_mq_hw_ctx *, struct request *, void *,
93 bool);
94
89struct blk_mq_ops { 95struct blk_mq_ops {
90 /* 96 /*
91 * Queue request 97 * Queue request
@@ -100,7 +106,7 @@ struct blk_mq_ops {
100 /* 106 /*
101 * Called on request timeout 107 * Called on request timeout
102 */ 108 */
103 rq_timed_out_fn *timeout; 109 timeout_fn *timeout;
104 110
105 softirq_done_fn *complete; 111 softirq_done_fn *complete;
106 112
@@ -115,6 +121,10 @@ struct blk_mq_ops {
115 /* 121 /*
116 * Called for every command allocated by the block layer to allow 122 * Called for every command allocated by the block layer to allow
117 * the driver to set up driver specific data. 123 * the driver to set up driver specific data.
124 *
125 * Tag greater than or equal to queue_depth is for setting up
126 * flush request.
127 *
118 * Ditto for exit/teardown. 128 * Ditto for exit/teardown.
119 */ 129 */
120 init_request_fn *init_request; 130 init_request_fn *init_request;
@@ -127,10 +137,9 @@ enum {
127 BLK_MQ_RQ_QUEUE_ERROR = 2, /* end IO with error */ 137 BLK_MQ_RQ_QUEUE_ERROR = 2, /* end IO with error */
128 138
129 BLK_MQ_F_SHOULD_MERGE = 1 << 0, 139 BLK_MQ_F_SHOULD_MERGE = 1 << 0,
130 BLK_MQ_F_SHOULD_SORT = 1 << 1, 140 BLK_MQ_F_TAG_SHARED = 1 << 1,
131 BLK_MQ_F_TAG_SHARED = 1 << 2, 141 BLK_MQ_F_SG_MERGE = 1 << 2,
132 BLK_MQ_F_SG_MERGE = 1 << 3, 142 BLK_MQ_F_SYSFS_UP = 1 << 3,
133 BLK_MQ_F_SYSFS_UP = 1 << 4,
134 143
135 BLK_MQ_S_STOPPED = 0, 144 BLK_MQ_S_STOPPED = 0,
136 BLK_MQ_S_TAG_ACTIVE = 1, 145 BLK_MQ_S_TAG_ACTIVE = 1,
@@ -141,6 +150,7 @@ enum {
141}; 150};
142 151
143struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *); 152struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *);
153void blk_mq_finish_init(struct request_queue *q);
144int blk_mq_register_disk(struct gendisk *); 154int blk_mq_register_disk(struct gendisk *);
145void blk_mq_unregister_disk(struct gendisk *); 155void blk_mq_unregister_disk(struct gendisk *);
146 156
@@ -160,8 +170,9 @@ struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag);
160struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index); 170struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index);
161struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_tag_set *, unsigned int, int); 171struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_tag_set *, unsigned int, int);
162 172
163void blk_mq_end_io(struct request *rq, int error); 173void blk_mq_start_request(struct request *rq);
164void __blk_mq_end_io(struct request *rq, int error); 174void blk_mq_end_request(struct request *rq, int error);
175void __blk_mq_end_request(struct request *rq, int error);
165 176
166void blk_mq_requeue_request(struct request *rq); 177void blk_mq_requeue_request(struct request *rq);
167void blk_mq_add_to_requeue_list(struct request *rq, bool at_head); 178void blk_mq_add_to_requeue_list(struct request *rq, bool at_head);
@@ -174,7 +185,8 @@ void blk_mq_stop_hw_queues(struct request_queue *q);
174void blk_mq_start_hw_queues(struct request_queue *q); 185void blk_mq_start_hw_queues(struct request_queue *q);
175void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async); 186void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async);
176void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); 187void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
177void blk_mq_tag_busy_iter(struct blk_mq_tags *tags, void (*fn)(void *data, unsigned long *), void *data); 188void blk_mq_tag_busy_iter(struct blk_mq_hw_ctx *hctx, busy_iter_fn *fn,
189 void *priv);
178 190
179/* 191/*
180 * Driver command data is immediately after the request. So subtract request 192 * Driver command data is immediately after the request. So subtract request
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 66c2167f04a9..445d59231bc4 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -78,9 +78,11 @@ struct bio {
78 struct io_context *bi_ioc; 78 struct io_context *bi_ioc;
79 struct cgroup_subsys_state *bi_css; 79 struct cgroup_subsys_state *bi_css;
80#endif 80#endif
81 union {
81#if defined(CONFIG_BLK_DEV_INTEGRITY) 82#if defined(CONFIG_BLK_DEV_INTEGRITY)
82 struct bio_integrity_payload *bi_integrity; /* data integrity */ 83 struct bio_integrity_payload *bi_integrity; /* data integrity */
83#endif 84#endif
85 };
84 86
85 unsigned short bi_vcnt; /* how many bio_vec's */ 87 unsigned short bi_vcnt; /* how many bio_vec's */
86 88
@@ -118,10 +120,8 @@ struct bio {
118#define BIO_USER_MAPPED 6 /* contains user pages */ 120#define BIO_USER_MAPPED 6 /* contains user pages */
119#define BIO_EOPNOTSUPP 7 /* not supported */ 121#define BIO_EOPNOTSUPP 7 /* not supported */
120#define BIO_NULL_MAPPED 8 /* contains invalid user pages */ 122#define BIO_NULL_MAPPED 8 /* contains invalid user pages */
121#define BIO_FS_INTEGRITY 9 /* fs owns integrity data, not block layer */ 123#define BIO_QUIET 9 /* Make BIO Quiet */
122#define BIO_QUIET 10 /* Make BIO Quiet */ 124#define BIO_SNAP_STABLE 10 /* bio data must be snapshotted during write */
123#define BIO_MAPPED_INTEGRITY 11/* integrity metadata has been remapped */
124#define BIO_SNAP_STABLE 12 /* bio data must be snapshotted during write */
125 125
126/* 126/*
127 * Flags starting here get preserved by bio_reset() - this includes 127 * Flags starting here get preserved by bio_reset() - this includes
@@ -162,6 +162,7 @@ enum rq_flag_bits {
162 __REQ_WRITE_SAME, /* write same block many times */ 162 __REQ_WRITE_SAME, /* write same block many times */
163 163
164 __REQ_NOIDLE, /* don't anticipate more IO after this one */ 164 __REQ_NOIDLE, /* don't anticipate more IO after this one */
165 __REQ_INTEGRITY, /* I/O includes block integrity payload */
165 __REQ_FUA, /* forced unit access */ 166 __REQ_FUA, /* forced unit access */
166 __REQ_FLUSH, /* request for cache flush */ 167 __REQ_FLUSH, /* request for cache flush */
167 168
@@ -186,9 +187,7 @@ enum rq_flag_bits {
186 __REQ_FLUSH_SEQ, /* request for flush sequence */ 187 __REQ_FLUSH_SEQ, /* request for flush sequence */
187 __REQ_IO_STAT, /* account I/O stat */ 188 __REQ_IO_STAT, /* account I/O stat */
188 __REQ_MIXED_MERGE, /* merge of different types, fail separately */ 189 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
189 __REQ_KERNEL, /* direct IO to kernel pages */
190 __REQ_PM, /* runtime pm request */ 190 __REQ_PM, /* runtime pm request */
191 __REQ_END, /* last of chain of requests */
192 __REQ_HASHED, /* on IO scheduler merge hash */ 191 __REQ_HASHED, /* on IO scheduler merge hash */
193 __REQ_MQ_INFLIGHT, /* track inflight for MQ */ 192 __REQ_MQ_INFLIGHT, /* track inflight for MQ */
194 __REQ_NR_BITS, /* stops here */ 193 __REQ_NR_BITS, /* stops here */
@@ -204,13 +203,14 @@ enum rq_flag_bits {
204#define REQ_DISCARD (1ULL << __REQ_DISCARD) 203#define REQ_DISCARD (1ULL << __REQ_DISCARD)
205#define REQ_WRITE_SAME (1ULL << __REQ_WRITE_SAME) 204#define REQ_WRITE_SAME (1ULL << __REQ_WRITE_SAME)
206#define REQ_NOIDLE (1ULL << __REQ_NOIDLE) 205#define REQ_NOIDLE (1ULL << __REQ_NOIDLE)
206#define REQ_INTEGRITY (1ULL << __REQ_INTEGRITY)
207 207
208#define REQ_FAILFAST_MASK \ 208#define REQ_FAILFAST_MASK \
209 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) 209 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
210#define REQ_COMMON_MASK \ 210#define REQ_COMMON_MASK \
211 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | \ 211 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | \
212 REQ_DISCARD | REQ_WRITE_SAME | REQ_NOIDLE | REQ_FLUSH | REQ_FUA | \ 212 REQ_DISCARD | REQ_WRITE_SAME | REQ_NOIDLE | REQ_FLUSH | REQ_FUA | \
213 REQ_SECURE) 213 REQ_SECURE | REQ_INTEGRITY)
214#define REQ_CLONE_MASK REQ_COMMON_MASK 214#define REQ_CLONE_MASK REQ_COMMON_MASK
215 215
216#define BIO_NO_ADVANCE_ITER_MASK (REQ_DISCARD|REQ_WRITE_SAME) 216#define BIO_NO_ADVANCE_ITER_MASK (REQ_DISCARD|REQ_WRITE_SAME)
@@ -240,9 +240,7 @@ enum rq_flag_bits {
240#define REQ_IO_STAT (1ULL << __REQ_IO_STAT) 240#define REQ_IO_STAT (1ULL << __REQ_IO_STAT)
241#define REQ_MIXED_MERGE (1ULL << __REQ_MIXED_MERGE) 241#define REQ_MIXED_MERGE (1ULL << __REQ_MIXED_MERGE)
242#define REQ_SECURE (1ULL << __REQ_SECURE) 242#define REQ_SECURE (1ULL << __REQ_SECURE)
243#define REQ_KERNEL (1ULL << __REQ_KERNEL)
244#define REQ_PM (1ULL << __REQ_PM) 243#define REQ_PM (1ULL << __REQ_PM)
245#define REQ_END (1ULL << __REQ_END)
246#define REQ_HASHED (1ULL << __REQ_HASHED) 244#define REQ_HASHED (1ULL << __REQ_HASHED)
247#define REQ_MQ_INFLIGHT (1ULL << __REQ_MQ_INFLIGHT) 245#define REQ_MQ_INFLIGHT (1ULL << __REQ_MQ_INFLIGHT)
248 246
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 8699bcf5f099..aac0f9ea952a 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -21,6 +21,7 @@
21#include <linux/bsg.h> 21#include <linux/bsg.h>
22#include <linux/smp.h> 22#include <linux/smp.h>
23#include <linux/rcupdate.h> 23#include <linux/rcupdate.h>
24#include <linux/percpu-refcount.h>
24 25
25#include <asm/scatterlist.h> 26#include <asm/scatterlist.h>
26 27
@@ -35,6 +36,7 @@ struct request;
35struct sg_io_hdr; 36struct sg_io_hdr;
36struct bsg_job; 37struct bsg_job;
37struct blkcg_gq; 38struct blkcg_gq;
39struct blk_flush_queue;
38 40
39#define BLKDEV_MIN_RQ 4 41#define BLKDEV_MIN_RQ 4
40#define BLKDEV_MAX_RQ 128 /* Default maximum */ 42#define BLKDEV_MAX_RQ 128 /* Default maximum */
@@ -454,14 +456,7 @@ struct request_queue {
454 */ 456 */
455 unsigned int flush_flags; 457 unsigned int flush_flags;
456 unsigned int flush_not_queueable:1; 458 unsigned int flush_not_queueable:1;
457 unsigned int flush_queue_delayed:1; 459 struct blk_flush_queue *fq;
458 unsigned int flush_pending_idx:1;
459 unsigned int flush_running_idx:1;
460 unsigned long flush_pending_since;
461 struct list_head flush_queue[2];
462 struct list_head flush_data_in_flight;
463 struct request *flush_rq;
464 spinlock_t mq_flush_lock;
465 460
466 struct list_head requeue_list; 461 struct list_head requeue_list;
467 spinlock_t requeue_lock; 462 spinlock_t requeue_lock;
@@ -470,6 +465,7 @@ struct request_queue {
470 struct mutex sysfs_lock; 465 struct mutex sysfs_lock;
471 466
472 int bypass_depth; 467 int bypass_depth;
468 int mq_freeze_depth;
473 469
474#if defined(CONFIG_BLK_DEV_BSG) 470#if defined(CONFIG_BLK_DEV_BSG)
475 bsg_job_fn *bsg_job_fn; 471 bsg_job_fn *bsg_job_fn;
@@ -483,7 +479,7 @@ struct request_queue {
483#endif 479#endif
484 struct rcu_head rcu_head; 480 struct rcu_head rcu_head;
485 wait_queue_head_t mq_freeze_wq; 481 wait_queue_head_t mq_freeze_wq;
486 struct percpu_counter mq_usage_counter; 482 struct percpu_ref mq_usage_counter;
487 struct list_head all_q_node; 483 struct list_head all_q_node;
488 484
489 struct blk_mq_tag_set *tag_set; 485 struct blk_mq_tag_set *tag_set;
@@ -863,7 +859,7 @@ extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
863 859
864static inline struct request_queue *bdev_get_queue(struct block_device *bdev) 860static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
865{ 861{
866 return bdev->bd_disk->queue; 862 return bdev->bd_disk->queue; /* this is never NULL */
867} 863}
868 864
869/* 865/*
@@ -1140,8 +1136,7 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk)
1140/* 1136/*
1141 * tag stuff 1137 * tag stuff
1142 */ 1138 */
1143#define blk_rq_tagged(rq) \ 1139#define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED)
1144 ((rq)->mq_ctx || ((rq)->cmd_flags & REQ_QUEUED))
1145extern int blk_queue_start_tag(struct request_queue *, struct request *); 1140extern int blk_queue_start_tag(struct request_queue *, struct request *);
1146extern struct request *blk_queue_find_tag(struct request_queue *, int); 1141extern struct request *blk_queue_find_tag(struct request_queue *, int);
1147extern void blk_queue_end_tag(struct request_queue *, struct request *); 1142extern void blk_queue_end_tag(struct request_queue *, struct request *);
@@ -1283,10 +1278,9 @@ static inline int queue_alignment_offset(struct request_queue *q)
1283static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector) 1278static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector)
1284{ 1279{
1285 unsigned int granularity = max(lim->physical_block_size, lim->io_min); 1280 unsigned int granularity = max(lim->physical_block_size, lim->io_min);
1286 unsigned int alignment = (sector << 9) & (granularity - 1); 1281 unsigned int alignment = sector_div(sector, granularity >> 9) << 9;
1287 1282
1288 return (granularity + lim->alignment_offset - alignment) 1283 return (granularity + lim->alignment_offset - alignment) % granularity;
1289 & (granularity - 1);
1290} 1284}
1291 1285
1292static inline int bdev_alignment_offset(struct block_device *bdev) 1286static inline int bdev_alignment_offset(struct block_device *bdev)
@@ -1462,32 +1456,31 @@ static inline uint64_t rq_io_start_time_ns(struct request *req)
1462 1456
1463#if defined(CONFIG_BLK_DEV_INTEGRITY) 1457#if defined(CONFIG_BLK_DEV_INTEGRITY)
1464 1458
1465#define INTEGRITY_FLAG_READ 2 /* verify data integrity on read */ 1459enum blk_integrity_flags {
1466#define INTEGRITY_FLAG_WRITE 4 /* generate data integrity on write */ 1460 BLK_INTEGRITY_VERIFY = 1 << 0,
1461 BLK_INTEGRITY_GENERATE = 1 << 1,
1462 BLK_INTEGRITY_DEVICE_CAPABLE = 1 << 2,
1463 BLK_INTEGRITY_IP_CHECKSUM = 1 << 3,
1464};
1467 1465
1468struct blk_integrity_exchg { 1466struct blk_integrity_iter {
1469 void *prot_buf; 1467 void *prot_buf;
1470 void *data_buf; 1468 void *data_buf;
1471 sector_t sector; 1469 sector_t seed;
1472 unsigned int data_size; 1470 unsigned int data_size;
1473 unsigned short sector_size; 1471 unsigned short interval;
1474 const char *disk_name; 1472 const char *disk_name;
1475}; 1473};
1476 1474
1477typedef void (integrity_gen_fn) (struct blk_integrity_exchg *); 1475typedef int (integrity_processing_fn) (struct blk_integrity_iter *);
1478typedef int (integrity_vrfy_fn) (struct blk_integrity_exchg *);
1479typedef void (integrity_set_tag_fn) (void *, void *, unsigned int);
1480typedef void (integrity_get_tag_fn) (void *, void *, unsigned int);
1481 1476
1482struct blk_integrity { 1477struct blk_integrity {
1483 integrity_gen_fn *generate_fn; 1478 integrity_processing_fn *generate_fn;
1484 integrity_vrfy_fn *verify_fn; 1479 integrity_processing_fn *verify_fn;
1485 integrity_set_tag_fn *set_tag_fn;
1486 integrity_get_tag_fn *get_tag_fn;
1487 1480
1488 unsigned short flags; 1481 unsigned short flags;
1489 unsigned short tuple_size; 1482 unsigned short tuple_size;
1490 unsigned short sector_size; 1483 unsigned short interval;
1491 unsigned short tag_size; 1484 unsigned short tag_size;
1492 1485
1493 const char *name; 1486 const char *name;
@@ -1502,10 +1495,10 @@ extern int blk_integrity_compare(struct gendisk *, struct gendisk *);
1502extern int blk_rq_map_integrity_sg(struct request_queue *, struct bio *, 1495extern int blk_rq_map_integrity_sg(struct request_queue *, struct bio *,
1503 struct scatterlist *); 1496 struct scatterlist *);
1504extern int blk_rq_count_integrity_sg(struct request_queue *, struct bio *); 1497extern int blk_rq_count_integrity_sg(struct request_queue *, struct bio *);
1505extern int blk_integrity_merge_rq(struct request_queue *, struct request *, 1498extern bool blk_integrity_merge_rq(struct request_queue *, struct request *,
1506 struct request *); 1499 struct request *);
1507extern int blk_integrity_merge_bio(struct request_queue *, struct request *, 1500extern bool blk_integrity_merge_bio(struct request_queue *, struct request *,
1508 struct bio *); 1501 struct bio *);
1509 1502
1510static inline 1503static inline
1511struct blk_integrity *bdev_get_integrity(struct block_device *bdev) 1504struct blk_integrity *bdev_get_integrity(struct block_device *bdev)
@@ -1518,12 +1511,9 @@ static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk)
1518 return disk->integrity; 1511 return disk->integrity;
1519} 1512}
1520 1513
1521static inline int blk_integrity_rq(struct request *rq) 1514static inline bool blk_integrity_rq(struct request *rq)
1522{ 1515{
1523 if (rq->bio == NULL) 1516 return rq->cmd_flags & REQ_INTEGRITY;
1524 return 0;
1525
1526 return bio_integrity(rq->bio);
1527} 1517}
1528 1518
1529static inline void blk_queue_max_integrity_segments(struct request_queue *q, 1519static inline void blk_queue_max_integrity_segments(struct request_queue *q,
@@ -1562,7 +1552,7 @@ static inline int blk_rq_map_integrity_sg(struct request_queue *q,
1562} 1552}
1563static inline struct blk_integrity *bdev_get_integrity(struct block_device *b) 1553static inline struct blk_integrity *bdev_get_integrity(struct block_device *b)
1564{ 1554{
1565 return 0; 1555 return NULL;
1566} 1556}
1567static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk) 1557static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk)
1568{ 1558{
@@ -1588,17 +1578,17 @@ static inline unsigned short queue_max_integrity_segments(struct request_queue *
1588{ 1578{
1589 return 0; 1579 return 0;
1590} 1580}
1591static inline int blk_integrity_merge_rq(struct request_queue *rq, 1581static inline bool blk_integrity_merge_rq(struct request_queue *rq,
1592 struct request *r1, 1582 struct request *r1,
1593 struct request *r2) 1583 struct request *r2)
1594{ 1584{
1595 return 0; 1585 return true;
1596} 1586}
1597static inline int blk_integrity_merge_bio(struct request_queue *rq, 1587static inline bool blk_integrity_merge_bio(struct request_queue *rq,
1598 struct request *r, 1588 struct request *r,
1599 struct bio *b) 1589 struct bio *b)
1600{ 1590{
1601 return 0; 1591 return true;
1602} 1592}
1603static inline bool blk_integrity_is_initialized(struct gendisk *g) 1593static inline bool blk_integrity_is_initialized(struct gendisk *g)
1604{ 1594{
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 4e2bd4c95b66..0995c2de8162 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -46,6 +46,7 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
46extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); 46extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
47 47
48extern unsigned long free_all_bootmem(void); 48extern unsigned long free_all_bootmem(void);
49extern void reset_node_managed_pages(pg_data_t *pgdat);
49extern void reset_all_zones_managed_pages(void); 50extern void reset_all_zones_managed_pages(void);
50 51
51extern void free_bootmem_node(pg_data_t *pgdat, 52extern void free_bootmem_node(pg_data_t *pgdat,
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
new file mode 100644
index 000000000000..3cf91754a957
--- /dev/null
+++ b/include/linux/bpf.h
@@ -0,0 +1,136 @@
1/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
2 *
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of version 2 of the GNU General Public
5 * License as published by the Free Software Foundation.
6 */
7#ifndef _LINUX_BPF_H
8#define _LINUX_BPF_H 1
9
10#include <uapi/linux/bpf.h>
11#include <linux/workqueue.h>
12#include <linux/file.h>
13
14struct bpf_map;
15
16/* map is generic key/value storage optionally accesible by eBPF programs */
17struct bpf_map_ops {
18 /* funcs callable from userspace (via syscall) */
19 struct bpf_map *(*map_alloc)(union bpf_attr *attr);
20 void (*map_free)(struct bpf_map *);
21 int (*map_get_next_key)(struct bpf_map *map, void *key, void *next_key);
22
23 /* funcs callable from userspace and from eBPF programs */
24 void *(*map_lookup_elem)(struct bpf_map *map, void *key);
25 int (*map_update_elem)(struct bpf_map *map, void *key, void *value);
26 int (*map_delete_elem)(struct bpf_map *map, void *key);
27};
28
29struct bpf_map {
30 atomic_t refcnt;
31 enum bpf_map_type map_type;
32 u32 key_size;
33 u32 value_size;
34 u32 max_entries;
35 struct bpf_map_ops *ops;
36 struct work_struct work;
37};
38
39struct bpf_map_type_list {
40 struct list_head list_node;
41 struct bpf_map_ops *ops;
42 enum bpf_map_type type;
43};
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 */
50enum bpf_arg_type {
51 ARG_ANYTHING = 0, /* any argument is ok */
52
53 /* the following constraints used to prototype
54 * bpf_map_lookup/update/delete_elem() functions
55 */
56 ARG_CONST_MAP_PTR, /* const argument used as pointer to bpf_map */
57 ARG_PTR_TO_MAP_KEY, /* pointer to stack used as map key */
58 ARG_PTR_TO_MAP_VALUE, /* pointer to stack used as map value */
59
60 /* the following constraints used to prototype bpf_memcmp() and other
61 * functions that access data on eBPF program stack
62 */
63 ARG_PTR_TO_STACK, /* any pointer to eBPF program stack */
64 ARG_CONST_STACK_SIZE, /* number of bytes accessed from stack */
65};
66
67/* type of values returned from helper functions */
68enum bpf_return_type {
69 RET_INTEGER, /* function returns integer */
70 RET_VOID, /* function doesn't return anything */
71 RET_PTR_TO_MAP_VALUE_OR_NULL, /* returns a pointer to map elem value or NULL */
72};
73
74/* eBPF function prototype used by verifier to allow BPF_CALLs from eBPF programs
75 * to in-kernel helper functions and for adjusting imm32 field in BPF_CALL
76 * instructions after verifying
77 */
78struct bpf_func_proto {
79 u64 (*func)(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);
80 bool gpl_only;
81 enum bpf_return_type ret_type;
82 enum bpf_arg_type arg1_type;
83 enum bpf_arg_type arg2_type;
84 enum bpf_arg_type arg3_type;
85 enum bpf_arg_type arg4_type;
86 enum bpf_arg_type arg5_type;
87};
88
89/* bpf_context is intentionally undefined structure. Pointer to bpf_context is
90 * the first argument to eBPF programs.
91 * For socket filters: 'struct bpf_context *' == 'struct sk_buff *'
92 */
93struct bpf_context;
94
95enum bpf_access_type {
96 BPF_READ = 1,
97 BPF_WRITE = 2
98};
99
100struct bpf_verifier_ops {
101 /* return eBPF function prototype for verification */
102 const struct bpf_func_proto *(*get_func_proto)(enum bpf_func_id func_id);
103
104 /* return true if 'size' wide access at offset 'off' within bpf_context
105 * with 'type' (read or write) is allowed
106 */
107 bool (*is_valid_access)(int off, int size, enum bpf_access_type type);
108};
109
110struct bpf_prog_type_list {
111 struct list_head list_node;
112 struct bpf_verifier_ops *ops;
113 enum bpf_prog_type type;
114};
115
116void bpf_register_prog_type(struct bpf_prog_type_list *tl);
117
118struct bpf_prog;
119
120struct bpf_prog_aux {
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;
127 struct bpf_prog *prog;
128 struct work_struct work;
129};
130
131void bpf_prog_put(struct bpf_prog *prog);
132struct bpf_prog *bpf_prog_get(u32 ufd);
133/* verify correctness of eBPF program */
134int bpf_check(struct bpf_prog *fp, union bpf_attr *attr);
135
136#endif /* _LINUX_BPF_H */
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 6f76277baf39..7ccd928cc1f2 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -13,18 +13,21 @@
13#define PHY_ID_BCM5461 0x002060c0 13#define PHY_ID_BCM5461 0x002060c0
14#define PHY_ID_BCM57780 0x03625d90 14#define PHY_ID_BCM57780 0x03625d90
15 15
16#define PHY_ID_BCM7250 0xae025280
17#define PHY_ID_BCM7364 0xae025260
16#define PHY_ID_BCM7366 0x600d8490 18#define PHY_ID_BCM7366 0x600d8490
19#define PHY_ID_BCM7425 0x03625e60
20#define PHY_ID_BCM7429 0x600d8730
17#define PHY_ID_BCM7439 0x600d8480 21#define PHY_ID_BCM7439 0x600d8480
18#define PHY_ID_BCM7445 0x600d8510 22#define PHY_ID_BCM7445 0x600d8510
19#define PHY_ID_BCM7XXX_28 0x600d8400
20 23
21#define PHY_BCM_OUI_MASK 0xfffffc00 24#define PHY_BCM_OUI_MASK 0xfffffc00
22#define PHY_BCM_OUI_1 0x00206000 25#define PHY_BCM_OUI_1 0x00206000
23#define PHY_BCM_OUI_2 0x0143bc00 26#define PHY_BCM_OUI_2 0x0143bc00
24#define PHY_BCM_OUI_3 0x03625c00 27#define PHY_BCM_OUI_3 0x03625c00
25#define PHY_BCM_OUI_4 0x600d0000 28#define PHY_BCM_OUI_4 0x600d8400
26#define PHY_BCM_OUI_5 0x03625e00 29#define PHY_BCM_OUI_5 0x03625e00
27 30#define PHY_BCM_OUI_6 0xae025000
28 31
29#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001 32#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001
30#define PHY_BCM_FLAGS_MODE_1000BX 0x00000002 33#define PHY_BCM_FLAGS_MODE_1000BX 0x00000002
@@ -39,7 +42,8 @@
39#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 42#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000
40#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 43#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000
41/* Broadcom BCM7xxx specific workarounds */ 44/* Broadcom BCM7xxx specific workarounds */
42#define PHY_BRCM_100MBPS_WAR 0x00010000 45#define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff)
46#define PHY_BRCM_7XXX_PATCH(x) ((x) & 0xff)
43#define PHY_BCM_FLAGS_VALID 0x80000000 47#define PHY_BCM_FLAGS_VALID 0x80000000
44 48
45/* Broadcom BCM54XX register definitions, common to most Broadcom PHYs */ 49/* Broadcom BCM54XX register definitions, common to most Broadcom PHYs */
@@ -93,4 +97,130 @@
93 97
94#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000 98#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000
95 99
100/*
101 * Broadcom LED source encodings. These are used in BCM5461, BCM5481,
102 * BCM5482, and possibly some others.
103 */
104#define BCM_LED_SRC_LINKSPD1 0x0
105#define BCM_LED_SRC_LINKSPD2 0x1
106#define BCM_LED_SRC_XMITLED 0x2
107#define BCM_LED_SRC_ACTIVITYLED 0x3
108#define BCM_LED_SRC_FDXLED 0x4
109#define BCM_LED_SRC_SLAVE 0x5
110#define BCM_LED_SRC_INTR 0x6
111#define BCM_LED_SRC_QUALITY 0x7
112#define BCM_LED_SRC_RCVLED 0x8
113#define BCM_LED_SRC_MULTICOLOR1 0xa
114#define BCM_LED_SRC_OPENSHORT 0xb
115#define BCM_LED_SRC_OFF 0xe /* Tied high */
116#define BCM_LED_SRC_ON 0xf /* Tied low */
117
118
119/*
120 * BCM5482: Shadow registers
121 * Shadow values go into bits [14:10] of register 0x1c to select a shadow
122 * register to access.
123 */
124/* 00101: Spare Control Register 3 */
125#define BCM54XX_SHD_SCR3 0x05
126#define BCM54XX_SHD_SCR3_DEF_CLK125 0x0001
127#define BCM54XX_SHD_SCR3_DLLAPD_DIS 0x0002
128#define BCM54XX_SHD_SCR3_TRDDAPD 0x0004
129
130/* 01010: Auto Power-Down */
131#define BCM54XX_SHD_APD 0x0a
132#define BCM54XX_SHD_APD_EN 0x0020
133
134#define BCM5482_SHD_LEDS1 0x0d /* 01101: LED Selector 1 */
135 /* LED3 / ~LINKSPD[2] selector */
136#define BCM5482_SHD_LEDS1_LED3(src) ((src & 0xf) << 4)
137 /* LED1 / ~LINKSPD[1] selector */
138#define BCM5482_SHD_LEDS1_LED1(src) ((src & 0xf) << 0)
139#define BCM54XX_SHD_RGMII_MODE 0x0b /* 01011: RGMII Mode Selector */
140#define BCM5482_SHD_SSD 0x14 /* 10100: Secondary SerDes control */
141#define BCM5482_SHD_SSD_LEDM 0x0008 /* SSD LED Mode enable */
142#define BCM5482_SHD_SSD_EN 0x0001 /* SSD enable */
143#define BCM5482_SHD_MODE 0x1f /* 11111: Mode Control Register */
144#define BCM5482_SHD_MODE_1000BX 0x0001 /* Enable 1000BASE-X registers */
145
146
147/*
148 * EXPANSION SHADOW ACCESS REGISTERS. (PHY REG 0x15, 0x16, and 0x17)
149 */
150#define MII_BCM54XX_EXP_AADJ1CH0 0x001f
151#define MII_BCM54XX_EXP_AADJ1CH0_SWP_ABCD_OEN 0x0200
152#define MII_BCM54XX_EXP_AADJ1CH0_SWSEL_THPF 0x0100
153#define MII_BCM54XX_EXP_AADJ1CH3 0x601f
154#define MII_BCM54XX_EXP_AADJ1CH3_ADCCKADJ 0x0002
155#define MII_BCM54XX_EXP_EXP08 0x0F08
156#define MII_BCM54XX_EXP_EXP08_RJCT_2MHZ 0x0001
157#define MII_BCM54XX_EXP_EXP08_EARLY_DAC_WAKE 0x0200
158#define MII_BCM54XX_EXP_EXP75 0x0f75
159#define MII_BCM54XX_EXP_EXP75_VDACCTRL 0x003c
160#define MII_BCM54XX_EXP_EXP75_CM_OSC 0x0001
161#define MII_BCM54XX_EXP_EXP96 0x0f96
162#define MII_BCM54XX_EXP_EXP96_MYST 0x0010
163#define MII_BCM54XX_EXP_EXP97 0x0f97
164#define MII_BCM54XX_EXP_EXP97_MYST 0x0c0c
165
166/*
167 * BCM5482: Secondary SerDes registers
168 */
169#define BCM5482_SSD_1000BX_CTL 0x00 /* 1000BASE-X Control */
170#define BCM5482_SSD_1000BX_CTL_PWRDOWN 0x0800 /* Power-down SSD */
171#define BCM5482_SSD_SGMII_SLAVE 0x15 /* SGMII Slave Register */
172#define BCM5482_SSD_SGMII_SLAVE_EN 0x0002 /* Slave mode enable */
173#define BCM5482_SSD_SGMII_SLAVE_AD 0x0001 /* Slave auto-detection */
174
175
176/*****************************************************************************/
177/* Fast Ethernet Transceiver definitions. */
178/*****************************************************************************/
179
180#define MII_BRCM_FET_INTREG 0x1a /* Interrupt register */
181#define MII_BRCM_FET_IR_MASK 0x0100 /* Mask all interrupts */
182#define MII_BRCM_FET_IR_LINK_EN 0x0200 /* Link status change enable */
183#define MII_BRCM_FET_IR_SPEED_EN 0x0400 /* Link speed change enable */
184#define MII_BRCM_FET_IR_DUPLEX_EN 0x0800 /* Duplex mode change enable */
185#define MII_BRCM_FET_IR_ENABLE 0x4000 /* Interrupt enable */
186
187#define MII_BRCM_FET_BRCMTEST 0x1f /* Brcm test register */
188#define MII_BRCM_FET_BT_SRE 0x0080 /* Shadow register enable */
189
190
191/*** Shadow register definitions ***/
192
193#define MII_BRCM_FET_SHDW_MISCCTRL 0x10 /* Shadow misc ctrl */
194#define MII_BRCM_FET_SHDW_MC_FAME 0x4000 /* Force Auto MDIX enable */
195
196#define MII_BRCM_FET_SHDW_AUXMODE4 0x1a /* Auxiliary mode 4 */
197#define MII_BRCM_FET_SHDW_AM4_LED_MASK 0x0003
198#define MII_BRCM_FET_SHDW_AM4_LED_MODE1 0x0001
199
200#define MII_BRCM_FET_SHDW_AUXSTAT2 0x1b /* Auxiliary status 2 */
201#define MII_BRCM_FET_SHDW_AS2_APDE 0x0020 /* Auto power down enable */
202
203/*
204 * Indirect register access functions for the 1000BASE-T/100BASE-TX/10BASE-T
205 * 0x1c shadow registers.
206 */
207static inline int bcm54xx_shadow_read(struct phy_device *phydev, u16 shadow)
208{
209 phy_write(phydev, MII_BCM54XX_SHD, MII_BCM54XX_SHD_VAL(shadow));
210 return MII_BCM54XX_SHD_DATA(phy_read(phydev, MII_BCM54XX_SHD));
211}
212
213static inline int bcm54xx_shadow_write(struct phy_device *phydev, u16 shadow,
214 u16 val)
215{
216 return phy_write(phydev, MII_BCM54XX_SHD,
217 MII_BCM54XX_SHD_WRITE |
218 MII_BCM54XX_SHD_VAL(shadow) |
219 MII_BCM54XX_SHD_DATA(val));
220}
221
222#define BRCM_CL45VEN_EEE_CONTROL 0x803d
223#define LPI_FEATURE_EN 0x8000
224#define LPI_FEATURE_EN_DIG1000X 0x4000
225
96#endif /* _LINUX_BRCMPHY_H */ 226#endif /* _LINUX_BRCMPHY_H */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 324329ceea1e..73b45225a7ca 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -175,12 +175,13 @@ void __wait_on_buffer(struct buffer_head *);
175wait_queue_head_t *bh_waitq_head(struct buffer_head *bh); 175wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
176struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block, 176struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
177 unsigned size); 177 unsigned size);
178struct buffer_head *__getblk(struct block_device *bdev, sector_t block, 178struct buffer_head *__getblk_gfp(struct block_device *bdev, sector_t block,
179 unsigned size); 179 unsigned size, gfp_t gfp);
180void __brelse(struct buffer_head *); 180void __brelse(struct buffer_head *);
181void __bforget(struct buffer_head *); 181void __bforget(struct buffer_head *);
182void __breadahead(struct block_device *, sector_t block, unsigned int size); 182void __breadahead(struct block_device *, sector_t block, unsigned int size);
183struct buffer_head *__bread(struct block_device *, sector_t block, unsigned size); 183struct buffer_head *__bread_gfp(struct block_device *,
184 sector_t block, unsigned size, gfp_t gfp);
184void invalidate_bh_lrus(void); 185void invalidate_bh_lrus(void);
185struct buffer_head *alloc_buffer_head(gfp_t gfp_flags); 186struct buffer_head *alloc_buffer_head(gfp_t gfp_flags);
186void free_buffer_head(struct buffer_head * bh); 187void free_buffer_head(struct buffer_head * bh);
@@ -295,7 +296,13 @@ static inline void bforget(struct buffer_head *bh)
295static inline struct buffer_head * 296static inline struct buffer_head *
296sb_bread(struct super_block *sb, sector_t block) 297sb_bread(struct super_block *sb, sector_t block)
297{ 298{
298 return __bread(sb->s_bdev, block, sb->s_blocksize); 299 return __bread_gfp(sb->s_bdev, block, sb->s_blocksize, __GFP_MOVABLE);
300}
301
302static inline struct buffer_head *
303sb_bread_unmovable(struct super_block *sb, sector_t block)
304{
305 return __bread_gfp(sb->s_bdev, block, sb->s_blocksize, 0);
299} 306}
300 307
301static inline void 308static inline void
@@ -307,7 +314,7 @@ sb_breadahead(struct super_block *sb, sector_t block)
307static inline struct buffer_head * 314static inline struct buffer_head *
308sb_getblk(struct super_block *sb, sector_t block) 315sb_getblk(struct super_block *sb, sector_t block)
309{ 316{
310 return __getblk(sb->s_bdev, block, sb->s_blocksize); 317 return __getblk_gfp(sb->s_bdev, block, sb->s_blocksize, __GFP_MOVABLE);
311} 318}
312 319
313static inline struct buffer_head * 320static inline struct buffer_head *
@@ -344,6 +351,36 @@ static inline void lock_buffer(struct buffer_head *bh)
344 __lock_buffer(bh); 351 __lock_buffer(bh);
345} 352}
346 353
354static inline struct buffer_head *getblk_unmovable(struct block_device *bdev,
355 sector_t block,
356 unsigned size)
357{
358 return __getblk_gfp(bdev, block, size, 0);
359}
360
361static inline struct buffer_head *__getblk(struct block_device *bdev,
362 sector_t block,
363 unsigned size)
364{
365 return __getblk_gfp(bdev, block, size, __GFP_MOVABLE);
366}
367
368/**
369 * __bread() - reads a specified block and returns the bh
370 * @bdev: the block_device to read from
371 * @block: number of block
372 * @size: size (in bytes) to read
373 *
374 * Reads a specified block, and returns buffer head that contains it.
375 * The page cache is allocated from movable area so that it can be migrated.
376 * It returns NULL if the block was unreadable.
377 */
378static inline struct buffer_head *
379__bread(struct block_device *bdev, sector_t block, unsigned size)
380{
381 return __bread_gfp(bdev, block, size, __GFP_MOVABLE);
382}
383
347extern int __set_page_dirty_buffers(struct page *page); 384extern int __set_page_dirty_buffers(struct page *page);
348 385
349#else /* CONFIG_BLOCK */ 386#else /* CONFIG_BLOCK */
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index 0846e6b931ce..89f67c1c3160 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -2,7 +2,7 @@
2#define _LINUX_BYTEORDER_GENERIC_H 2#define _LINUX_BYTEORDER_GENERIC_H
3 3
4/* 4/*
5 * linux/byteorder_generic.h 5 * linux/byteorder/generic.h
6 * Generic Byte-reordering support 6 * Generic Byte-reordering support
7 * 7 *
8 * The "... p" macros, like le64_to_cpup, can be used with pointers 8 * The "... p" macros, like le64_to_cpup, can be used with pointers
diff --git a/include/linux/ccp.h b/include/linux/ccp.h
index ebcc9d146219..7f437036baa4 100644
--- a/include/linux/ccp.h
+++ b/include/linux/ccp.h
@@ -27,6 +27,13 @@ struct ccp_cmd;
27 defined(CONFIG_CRYPTO_DEV_CCP_DD_MODULE) 27 defined(CONFIG_CRYPTO_DEV_CCP_DD_MODULE)
28 28
29/** 29/**
30 * ccp_present - check if a CCP device is present
31 *
32 * Returns zero if a CCP device is present, -ENODEV otherwise.
33 */
34int ccp_present(void);
35
36/**
30 * ccp_enqueue_cmd - queue an operation for processing by the CCP 37 * ccp_enqueue_cmd - queue an operation for processing by the CCP
31 * 38 *
32 * @cmd: ccp_cmd struct to be processed 39 * @cmd: ccp_cmd struct to be processed
@@ -53,6 +60,11 @@ int ccp_enqueue_cmd(struct ccp_cmd *cmd);
53 60
54#else /* CONFIG_CRYPTO_DEV_CCP_DD is not enabled */ 61#else /* CONFIG_CRYPTO_DEV_CCP_DD is not enabled */
55 62
63static inline int ccp_present(void)
64{
65 return -ENODEV;
66}
67
56static inline int ccp_enqueue_cmd(struct ccp_cmd *cmd) 68static inline int ccp_enqueue_cmd(struct ccp_cmd *cmd)
57{ 69{
58 return -ENODEV; 70 return -ENODEV;
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 279b0afac1c1..07bc359b88ac 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -211,7 +211,6 @@ extern struct page **ceph_get_direct_page_vector(const void __user *data,
211 bool write_page); 211 bool write_page);
212extern void ceph_put_page_vector(struct page **pages, int num_pages, 212extern void ceph_put_page_vector(struct page **pages, int num_pages,
213 bool dirty); 213 bool dirty);
214extern void ceph_release_page_vector(struct page **pages, int num_pages);
215extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags); 214extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags);
216extern int ceph_copy_user_to_page_vector(struct page **pages, 215extern int ceph_copy_user_to_page_vector(struct page **pages,
217 const void __user *data, 216 const void __user *data,
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index d21f2dba0731..40ae58e3e9db 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -285,19 +285,9 @@ extern void ceph_msg_data_add_bio(struct ceph_msg *msg, struct bio *bio,
285 285
286extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, 286extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags,
287 bool can_fail); 287 bool can_fail);
288extern void ceph_msg_kfree(struct ceph_msg *m);
289 288
290 289extern struct ceph_msg *ceph_msg_get(struct ceph_msg *msg);
291static inline struct ceph_msg *ceph_msg_get(struct ceph_msg *msg) 290extern void ceph_msg_put(struct ceph_msg *msg);
292{
293 kref_get(&msg->kref);
294 return msg;
295}
296extern void ceph_msg_last_put(struct kref *kref);
297static inline void ceph_msg_put(struct ceph_msg *msg)
298{
299 kref_put(&msg->kref, ceph_msg_last_put);
300}
301 291
302extern void ceph_msg_dump(struct ceph_msg *msg); 292extern void ceph_msg_dump(struct ceph_msg *msg);
303 293
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 94ec69672164..03aeb27fcc69 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -117,7 +117,7 @@ struct ceph_osd_request {
117 struct list_head r_req_lru_item; 117 struct list_head r_req_lru_item;
118 struct list_head r_osd_item; 118 struct list_head r_osd_item;
119 struct list_head r_linger_item; 119 struct list_head r_linger_item;
120 struct list_head r_linger_osd; 120 struct list_head r_linger_osd_item;
121 struct ceph_osd *r_osd; 121 struct ceph_osd *r_osd;
122 struct ceph_pg r_pgid; 122 struct ceph_pg r_pgid;
123 int r_pg_osds[CEPH_PG_MAX_SIZE]; 123 int r_pg_osds[CEPH_PG_MAX_SIZE];
@@ -325,22 +325,14 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
325 325
326extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc, 326extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc,
327 struct ceph_osd_request *req); 327 struct ceph_osd_request *req);
328extern void ceph_osdc_unregister_linger_request(struct ceph_osd_client *osdc, 328
329 struct ceph_osd_request *req); 329extern void ceph_osdc_get_request(struct ceph_osd_request *req);
330 330extern void ceph_osdc_put_request(struct ceph_osd_request *req);
331static inline void ceph_osdc_get_request(struct ceph_osd_request *req)
332{
333 kref_get(&req->r_kref);
334}
335extern void ceph_osdc_release_request(struct kref *kref);
336static inline void ceph_osdc_put_request(struct ceph_osd_request *req)
337{
338 kref_put(&req->r_kref, ceph_osdc_release_request);
339}
340 331
341extern int ceph_osdc_start_request(struct ceph_osd_client *osdc, 332extern int ceph_osdc_start_request(struct ceph_osd_client *osdc,
342 struct ceph_osd_request *req, 333 struct ceph_osd_request *req,
343 bool nofail); 334 bool nofail);
335extern void ceph_osdc_cancel_request(struct ceph_osd_request *req);
344extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc, 336extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc,
345 struct ceph_osd_request *req); 337 struct ceph_osd_request *req);
346extern void ceph_osdc_sync(struct ceph_osd_client *osdc); 338extern void ceph_osdc_sync(struct ceph_osd_client *osdc);
diff --git a/include/linux/ceph/pagelist.h b/include/linux/ceph/pagelist.h
index 9660d6b0a35d..5f871d84ddce 100644
--- a/include/linux/ceph/pagelist.h
+++ b/include/linux/ceph/pagelist.h
@@ -2,6 +2,7 @@
2#define __FS_CEPH_PAGELIST_H 2#define __FS_CEPH_PAGELIST_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/atomic.h>
5 6
6struct ceph_pagelist { 7struct ceph_pagelist {
7 struct list_head head; 8 struct list_head head;
@@ -10,6 +11,7 @@ struct ceph_pagelist {
10 size_t room; 11 size_t room;
11 struct list_head free_list; 12 struct list_head free_list;
12 size_t num_pages_free; 13 size_t num_pages_free;
14 atomic_t refcnt;
13}; 15};
14 16
15struct ceph_pagelist_cursor { 17struct ceph_pagelist_cursor {
@@ -26,9 +28,10 @@ static inline void ceph_pagelist_init(struct ceph_pagelist *pl)
26 pl->room = 0; 28 pl->room = 0;
27 INIT_LIST_HEAD(&pl->free_list); 29 INIT_LIST_HEAD(&pl->free_list);
28 pl->num_pages_free = 0; 30 pl->num_pages_free = 0;
31 atomic_set(&pl->refcnt, 1);
29} 32}
30 33
31extern int ceph_pagelist_release(struct ceph_pagelist *pl); 34extern void ceph_pagelist_release(struct ceph_pagelist *pl);
32 35
33extern int ceph_pagelist_append(struct ceph_pagelist *pl, const void *d, size_t l); 36extern int ceph_pagelist_append(struct ceph_pagelist *pl, const void *d, size_t l);
34 37
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index f20e0d8a2155..2f822dca1046 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -172,6 +172,7 @@ extern const char *ceph_osd_state_name(int s);
172#define CEPH_OSD_OP_MODE_WR 0x2000 172#define CEPH_OSD_OP_MODE_WR 0x2000
173#define CEPH_OSD_OP_MODE_RMW 0x3000 173#define CEPH_OSD_OP_MODE_RMW 0x3000
174#define CEPH_OSD_OP_MODE_SUB 0x4000 174#define CEPH_OSD_OP_MODE_SUB 0x4000
175#define CEPH_OSD_OP_MODE_CACHE 0x8000
175 176
176#define CEPH_OSD_OP_TYPE 0x0f00 177#define CEPH_OSD_OP_TYPE 0x0f00
177#define CEPH_OSD_OP_TYPE_LOCK 0x0100 178#define CEPH_OSD_OP_TYPE_LOCK 0x0100
@@ -181,103 +182,135 @@ extern const char *ceph_osd_state_name(int s);
181#define CEPH_OSD_OP_TYPE_PG 0x0500 182#define CEPH_OSD_OP_TYPE_PG 0x0500
182#define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */ 183#define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */
183 184
185#define __CEPH_OSD_OP1(mode, nr) \
186 (CEPH_OSD_OP_MODE_##mode | (nr))
187
188#define __CEPH_OSD_OP(mode, type, nr) \
189 (CEPH_OSD_OP_MODE_##mode | CEPH_OSD_OP_TYPE_##type | (nr))
190
191#define __CEPH_FORALL_OSD_OPS(f) \
192 /** data **/ \
193 /* read */ \
194 f(READ, __CEPH_OSD_OP(RD, DATA, 1), "read") \
195 f(STAT, __CEPH_OSD_OP(RD, DATA, 2), "stat") \
196 f(MAPEXT, __CEPH_OSD_OP(RD, DATA, 3), "mapext") \
197 \
198 /* fancy read */ \
199 f(MASKTRUNC, __CEPH_OSD_OP(RD, DATA, 4), "masktrunc") \
200 f(SPARSE_READ, __CEPH_OSD_OP(RD, DATA, 5), "sparse-read") \
201 \
202 f(NOTIFY, __CEPH_OSD_OP(RD, DATA, 6), "notify") \
203 f(NOTIFY_ACK, __CEPH_OSD_OP(RD, DATA, 7), "notify-ack") \
204 \
205 /* versioning */ \
206 f(ASSERT_VER, __CEPH_OSD_OP(RD, DATA, 8), "assert-version") \
207 \
208 f(LIST_WATCHERS, __CEPH_OSD_OP(RD, DATA, 9), "list-watchers") \
209 \
210 f(LIST_SNAPS, __CEPH_OSD_OP(RD, DATA, 10), "list-snaps") \
211 \
212 /* sync */ \
213 f(SYNC_READ, __CEPH_OSD_OP(RD, DATA, 11), "sync_read") \
214 \
215 /* write */ \
216 f(WRITE, __CEPH_OSD_OP(WR, DATA, 1), "write") \
217 f(WRITEFULL, __CEPH_OSD_OP(WR, DATA, 2), "writefull") \
218 f(TRUNCATE, __CEPH_OSD_OP(WR, DATA, 3), "truncate") \
219 f(ZERO, __CEPH_OSD_OP(WR, DATA, 4), "zero") \
220 f(DELETE, __CEPH_OSD_OP(WR, DATA, 5), "delete") \
221 \
222 /* fancy write */ \
223 f(APPEND, __CEPH_OSD_OP(WR, DATA, 6), "append") \
224 f(STARTSYNC, __CEPH_OSD_OP(WR, DATA, 7), "startsync") \
225 f(SETTRUNC, __CEPH_OSD_OP(WR, DATA, 8), "settrunc") \
226 f(TRIMTRUNC, __CEPH_OSD_OP(WR, DATA, 9), "trimtrunc") \
227 \
228 f(TMAPUP, __CEPH_OSD_OP(RMW, DATA, 10), "tmapup") \
229 f(TMAPPUT, __CEPH_OSD_OP(WR, DATA, 11), "tmapput") \
230 f(TMAPGET, __CEPH_OSD_OP(RD, DATA, 12), "tmapget") \
231 \
232 f(CREATE, __CEPH_OSD_OP(WR, DATA, 13), "create") \
233 f(ROLLBACK, __CEPH_OSD_OP(WR, DATA, 14), "rollback") \
234 \
235 f(WATCH, __CEPH_OSD_OP(WR, DATA, 15), "watch") \
236 \
237 /* omap */ \
238 f(OMAPGETKEYS, __CEPH_OSD_OP(RD, DATA, 17), "omap-get-keys") \
239 f(OMAPGETVALS, __CEPH_OSD_OP(RD, DATA, 18), "omap-get-vals") \
240 f(OMAPGETHEADER, __CEPH_OSD_OP(RD, DATA, 19), "omap-get-header") \
241 f(OMAPGETVALSBYKEYS, __CEPH_OSD_OP(RD, DATA, 20), "omap-get-vals-by-keys") \
242 f(OMAPSETVALS, __CEPH_OSD_OP(WR, DATA, 21), "omap-set-vals") \
243 f(OMAPSETHEADER, __CEPH_OSD_OP(WR, DATA, 22), "omap-set-header") \
244 f(OMAPCLEAR, __CEPH_OSD_OP(WR, DATA, 23), "omap-clear") \
245 f(OMAPRMKEYS, __CEPH_OSD_OP(WR, DATA, 24), "omap-rm-keys") \
246 f(OMAP_CMP, __CEPH_OSD_OP(RD, DATA, 25), "omap-cmp") \
247 \
248 /* tiering */ \
249 f(COPY_FROM, __CEPH_OSD_OP(WR, DATA, 26), "copy-from") \
250 f(COPY_GET_CLASSIC, __CEPH_OSD_OP(RD, DATA, 27), "copy-get-classic") \
251 f(UNDIRTY, __CEPH_OSD_OP(WR, DATA, 28), "undirty") \
252 f(ISDIRTY, __CEPH_OSD_OP(RD, DATA, 29), "isdirty") \
253 f(COPY_GET, __CEPH_OSD_OP(RD, DATA, 30), "copy-get") \
254 f(CACHE_FLUSH, __CEPH_OSD_OP(CACHE, DATA, 31), "cache-flush") \
255 f(CACHE_EVICT, __CEPH_OSD_OP(CACHE, DATA, 32), "cache-evict") \
256 f(CACHE_TRY_FLUSH, __CEPH_OSD_OP(CACHE, DATA, 33), "cache-try-flush") \
257 \
258 /* convert tmap to omap */ \
259 f(TMAP2OMAP, __CEPH_OSD_OP(RMW, DATA, 34), "tmap2omap") \
260 \
261 /* hints */ \
262 f(SETALLOCHINT, __CEPH_OSD_OP(WR, DATA, 35), "set-alloc-hint") \
263 \
264 /** multi **/ \
265 f(CLONERANGE, __CEPH_OSD_OP(WR, MULTI, 1), "clonerange") \
266 f(ASSERT_SRC_VERSION, __CEPH_OSD_OP(RD, MULTI, 2), "assert-src-version") \
267 f(SRC_CMPXATTR, __CEPH_OSD_OP(RD, MULTI, 3), "src-cmpxattr") \
268 \
269 /** attrs **/ \
270 /* read */ \
271 f(GETXATTR, __CEPH_OSD_OP(RD, ATTR, 1), "getxattr") \
272 f(GETXATTRS, __CEPH_OSD_OP(RD, ATTR, 2), "getxattrs") \
273 f(CMPXATTR, __CEPH_OSD_OP(RD, ATTR, 3), "cmpxattr") \
274 \
275 /* write */ \
276 f(SETXATTR, __CEPH_OSD_OP(WR, ATTR, 1), "setxattr") \
277 f(SETXATTRS, __CEPH_OSD_OP(WR, ATTR, 2), "setxattrs") \
278 f(RESETXATTRS, __CEPH_OSD_OP(WR, ATTR, 3), "resetxattrs") \
279 f(RMXATTR, __CEPH_OSD_OP(WR, ATTR, 4), "rmxattr") \
280 \
281 /** subop **/ \
282 f(PULL, __CEPH_OSD_OP1(SUB, 1), "pull") \
283 f(PUSH, __CEPH_OSD_OP1(SUB, 2), "push") \
284 f(BALANCEREADS, __CEPH_OSD_OP1(SUB, 3), "balance-reads") \
285 f(UNBALANCEREADS, __CEPH_OSD_OP1(SUB, 4), "unbalance-reads") \
286 f(SCRUB, __CEPH_OSD_OP1(SUB, 5), "scrub") \
287 f(SCRUB_RESERVE, __CEPH_OSD_OP1(SUB, 6), "scrub-reserve") \
288 f(SCRUB_UNRESERVE, __CEPH_OSD_OP1(SUB, 7), "scrub-unreserve") \
289 f(SCRUB_STOP, __CEPH_OSD_OP1(SUB, 8), "scrub-stop") \
290 f(SCRUB_MAP, __CEPH_OSD_OP1(SUB, 9), "scrub-map") \
291 \
292 /** lock **/ \
293 f(WRLOCK, __CEPH_OSD_OP(WR, LOCK, 1), "wrlock") \
294 f(WRUNLOCK, __CEPH_OSD_OP(WR, LOCK, 2), "wrunlock") \
295 f(RDLOCK, __CEPH_OSD_OP(WR, LOCK, 3), "rdlock") \
296 f(RDUNLOCK, __CEPH_OSD_OP(WR, LOCK, 4), "rdunlock") \
297 f(UPLOCK, __CEPH_OSD_OP(WR, LOCK, 5), "uplock") \
298 f(DNLOCK, __CEPH_OSD_OP(WR, LOCK, 6), "dnlock") \
299 \
300 /** exec **/ \
301 /* note: the RD bit here is wrong; see special-case below in helper */ \
302 f(CALL, __CEPH_OSD_OP(RD, EXEC, 1), "call") \
303 \
304 /** pg **/ \
305 f(PGLS, __CEPH_OSD_OP(RD, PG, 1), "pgls") \
306 f(PGLS_FILTER, __CEPH_OSD_OP(RD, PG, 2), "pgls-filter") \
307 f(PG_HITSET_LS, __CEPH_OSD_OP(RD, PG, 3), "pg-hitset-ls") \
308 f(PG_HITSET_GET, __CEPH_OSD_OP(RD, PG, 4), "pg-hitset-get")
309
184enum { 310enum {
185 /** data **/ 311#define GENERATE_ENUM_ENTRY(op, opcode, str) CEPH_OSD_OP_##op = (opcode),
186 /* read */ 312__CEPH_FORALL_OSD_OPS(GENERATE_ENUM_ENTRY)
187 CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1, 313#undef GENERATE_ENUM_ENTRY
188 CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2,
189 CEPH_OSD_OP_MAPEXT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 3,
190
191 /* fancy read */
192 CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4,
193 CEPH_OSD_OP_SPARSE_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 5,
194
195 CEPH_OSD_OP_NOTIFY = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 6,
196 CEPH_OSD_OP_NOTIFY_ACK = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 7,
197
198 /* versioning */
199 CEPH_OSD_OP_ASSERT_VER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 8,
200
201 /* write */
202 CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1,
203 CEPH_OSD_OP_WRITEFULL = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 2,
204 CEPH_OSD_OP_TRUNCATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 3,
205 CEPH_OSD_OP_ZERO = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 4,
206 CEPH_OSD_OP_DELETE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 5,
207
208 /* fancy write */
209 CEPH_OSD_OP_APPEND = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 6,
210 CEPH_OSD_OP_STARTSYNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 7,
211 CEPH_OSD_OP_SETTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 8,
212 CEPH_OSD_OP_TRIMTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 9,
213
214 CEPH_OSD_OP_TMAPUP = CEPH_OSD_OP_MODE_RMW | CEPH_OSD_OP_TYPE_DATA | 10,
215 CEPH_OSD_OP_TMAPPUT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 11,
216 CEPH_OSD_OP_TMAPGET = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 12,
217
218 CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13,
219 CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14,
220
221 CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15,
222
223 /* omap */
224 CEPH_OSD_OP_OMAPGETKEYS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 17,
225 CEPH_OSD_OP_OMAPGETVALS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 18,
226 CEPH_OSD_OP_OMAPGETHEADER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 19,
227 CEPH_OSD_OP_OMAPGETVALSBYKEYS =
228 CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 20,
229 CEPH_OSD_OP_OMAPSETVALS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 21,
230 CEPH_OSD_OP_OMAPSETHEADER = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 22,
231 CEPH_OSD_OP_OMAPCLEAR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 23,
232 CEPH_OSD_OP_OMAPRMKEYS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 24,
233 CEPH_OSD_OP_OMAP_CMP = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 25,
234
235 /* hints */
236 CEPH_OSD_OP_SETALLOCHINT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 35,
237
238 /** multi **/
239 CEPH_OSD_OP_CLONERANGE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_MULTI | 1,
240 CEPH_OSD_OP_ASSERT_SRC_VERSION = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 2,
241 CEPH_OSD_OP_SRC_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 3,
242
243 /** attrs **/
244 /* read */
245 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
246 CEPH_OSD_OP_GETXATTRS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 2,
247 CEPH_OSD_OP_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 3,
248
249 /* write */
250 CEPH_OSD_OP_SETXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 1,
251 CEPH_OSD_OP_SETXATTRS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 2,
252 CEPH_OSD_OP_RESETXATTRS = CEPH_OSD_OP_MODE_WR|CEPH_OSD_OP_TYPE_ATTR | 3,
253 CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4,
254
255 /** subop **/
256 CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1,
257 CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2,
258 CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3,
259 CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4,
260 CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5,
261 CEPH_OSD_OP_SCRUB_RESERVE = CEPH_OSD_OP_MODE_SUB | 6,
262 CEPH_OSD_OP_SCRUB_UNRESERVE = CEPH_OSD_OP_MODE_SUB | 7,
263 CEPH_OSD_OP_SCRUB_STOP = CEPH_OSD_OP_MODE_SUB | 8,
264 CEPH_OSD_OP_SCRUB_MAP = CEPH_OSD_OP_MODE_SUB | 9,
265
266 /** lock **/
267 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1,
268 CEPH_OSD_OP_WRUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 2,
269 CEPH_OSD_OP_RDLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 3,
270 CEPH_OSD_OP_RDUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 4,
271 CEPH_OSD_OP_UPLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 5,
272 CEPH_OSD_OP_DNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 6,
273
274 /** exec **/
275 /* note: the RD bit here is wrong; see special-case below in helper */
276 CEPH_OSD_OP_CALL = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_EXEC | 1,
277
278 /** pg **/
279 CEPH_OSD_OP_PGLS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 1,
280 CEPH_OSD_OP_PGLS_FILTER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 2,
281}; 314};
282 315
283static inline int ceph_osd_op_type_lock(int op) 316static inline int ceph_osd_op_type_lock(int op)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index b5223c570eba..1d5196889048 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -27,7 +27,6 @@
27 27
28struct cgroup_root; 28struct cgroup_root;
29struct cgroup_subsys; 29struct cgroup_subsys;
30struct inode;
31struct cgroup; 30struct cgroup;
32 31
33extern int cgroup_init_early(void); 32extern int cgroup_init_early(void);
@@ -38,7 +37,8 @@ extern void cgroup_exit(struct task_struct *p);
38extern int cgroupstats_build(struct cgroupstats *stats, 37extern int cgroupstats_build(struct cgroupstats *stats,
39 struct dentry *dentry); 38 struct dentry *dentry);
40 39
41extern int proc_cgroup_show(struct seq_file *, void *); 40extern int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns,
41 struct pid *pid, struct task_struct *tsk);
42 42
43/* define the enumeration of all cgroup subsystems */ 43/* define the enumeration of all cgroup subsystems */
44#define SUBSYS(_x) _x ## _cgrp_id, 44#define SUBSYS(_x) _x ## _cgrp_id,
@@ -161,11 +161,6 @@ static inline void css_put(struct cgroup_subsys_state *css)
161 161
162/* bits in struct cgroup flags field */ 162/* bits in struct cgroup flags field */
163enum { 163enum {
164 /*
165 * Control Group has previously had a child cgroup or a task,
166 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
167 */
168 CGRP_RELEASABLE,
169 /* Control Group requires release notifications to userspace */ 164 /* Control Group requires release notifications to userspace */
170 CGRP_NOTIFY_ON_RELEASE, 165 CGRP_NOTIFY_ON_RELEASE,
171 /* 166 /*
@@ -235,13 +230,6 @@ struct cgroup {
235 struct list_head e_csets[CGROUP_SUBSYS_COUNT]; 230 struct list_head e_csets[CGROUP_SUBSYS_COUNT];
236 231
237 /* 232 /*
238 * Linked list running through all cgroups that can
239 * potentially be reaped by the release agent. Protected by
240 * release_list_lock
241 */
242 struct list_head release_list;
243
244 /*
245 * list of pidlists, up to two for each namespace (one for procs, one 233 * list of pidlists, up to two for each namespace (one for procs, one
246 * for tasks); created on demand. 234 * for tasks); created on demand.
247 */ 235 */
@@ -250,6 +238,9 @@ struct cgroup {
250 238
251 /* used to wait for offlining of csses */ 239 /* used to wait for offlining of csses */
252 wait_queue_head_t offline_waitq; 240 wait_queue_head_t offline_waitq;
241
242 /* used to schedule release agent */
243 struct work_struct release_agent_work;
253}; 244};
254 245
255#define MAX_CGROUP_ROOT_NAMELEN 64 246#define MAX_CGROUP_ROOT_NAMELEN 64
@@ -536,13 +527,10 @@ static inline bool cgroup_has_tasks(struct cgroup *cgrp)
536 return !list_empty(&cgrp->cset_links); 527 return !list_empty(&cgrp->cset_links);
537} 528}
538 529
539/* returns ino associated with a cgroup, 0 indicates unmounted root */ 530/* returns ino associated with a cgroup */
540static inline ino_t cgroup_ino(struct cgroup *cgrp) 531static inline ino_t cgroup_ino(struct cgroup *cgrp)
541{ 532{
542 if (cgrp->kn) 533 return cgrp->kn->ino;
543 return cgrp->kn->ino;
544 else
545 return 0;
546} 534}
547 535
548/* cft/css accessors for cftype->write() operation */ 536/* cft/css accessors for cftype->write() operation */
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
index efbf70b9fd84..0ca5f6046920 100644
--- a/include/linux/clk-private.h
+++ b/include/linux/clk-private.h
@@ -46,8 +46,10 @@ struct clk {
46 unsigned int enable_count; 46 unsigned int enable_count;
47 unsigned int prepare_count; 47 unsigned int prepare_count;
48 unsigned long accuracy; 48 unsigned long accuracy;
49 int phase;
49 struct hlist_head children; 50 struct hlist_head children;
50 struct hlist_node child_node; 51 struct hlist_node child_node;
52 struct hlist_node debug_node;
51 unsigned int notifier_count; 53 unsigned int notifier_count;
52#ifdef CONFIG_DEBUG_FS 54#ifdef CONFIG_DEBUG_FS
53 struct dentry *dentry; 55 struct dentry *dentry;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 411dd7eb2653..be21af149f11 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -13,6 +13,7 @@
13 13
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/of.h>
16 17
17#ifdef CONFIG_COMMON_CLK 18#ifdef CONFIG_COMMON_CLK
18 19
@@ -129,6 +130,14 @@ struct dentry;
129 * set then clock accuracy will be initialized to parent accuracy 130 * set then clock accuracy will be initialized to parent accuracy
130 * or 0 (perfect clock) if clock has no parent. 131 * or 0 (perfect clock) if clock has no parent.
131 * 132 *
133 * @get_phase: Queries the hardware to get the current phase of a clock.
134 * Returned values are 0-359 degrees on success, negative
135 * error codes on failure.
136 *
137 * @set_phase: Shift the phase this clock signal in degrees specified
138 * by the second argument. Valid values for degrees are
139 * 0-359. Return 0 on success, otherwise -EERROR.
140 *
132 * @init: Perform platform-specific initialization magic. 141 * @init: Perform platform-specific initialization magic.
133 * This is not not used by any of the basic clock types. 142 * This is not not used by any of the basic clock types.
134 * Please consider other ways of solving initialization problems 143 * Please consider other ways of solving initialization problems
@@ -177,6 +186,8 @@ struct clk_ops {
177 unsigned long parent_rate, u8 index); 186 unsigned long parent_rate, u8 index);
178 unsigned long (*recalc_accuracy)(struct clk_hw *hw, 187 unsigned long (*recalc_accuracy)(struct clk_hw *hw,
179 unsigned long parent_accuracy); 188 unsigned long parent_accuracy);
189 int (*get_phase)(struct clk_hw *hw);
190 int (*set_phase)(struct clk_hw *hw, int degrees);
180 void (*init)(struct clk_hw *hw); 191 void (*init)(struct clk_hw *hw);
181 int (*debug_init)(struct clk_hw *hw, struct dentry *dentry); 192 int (*debug_init)(struct clk_hw *hw, struct dentry *dentry);
182}; 193};
@@ -488,6 +499,28 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
488 struct clk_hw *gate_hw, const struct clk_ops *gate_ops, 499 struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
489 unsigned long flags); 500 unsigned long flags);
490 501
502/***
503 * struct clk_gpio_gate - gpio gated clock
504 *
505 * @hw: handle between common and hardware-specific interfaces
506 * @gpiod: gpio descriptor
507 *
508 * Clock with a gpio control for enabling and disabling the parent clock.
509 * Implements .enable, .disable and .is_enabled
510 */
511
512struct clk_gpio {
513 struct clk_hw hw;
514 struct gpio_desc *gpiod;
515};
516
517extern const struct clk_ops clk_gpio_gate_ops;
518struct clk *clk_register_gpio_gate(struct device *dev, const char *name,
519 const char *parent_name, struct gpio_desc *gpio,
520 unsigned long flags);
521
522void of_gpio_clk_gate_setup(struct device_node *node);
523
491/** 524/**
492 * clk_register - allocate a new clock, register it and return an opaque cookie 525 * clk_register - allocate a new clock, register it and return an opaque cookie
493 * @dev: device that is registering this clock 526 * @dev: device that is registering this clock
diff --git a/include/linux/clk.h b/include/linux/clk.h
index afb44bfaf8d1..c7f258a81761 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -106,6 +106,25 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
106 */ 106 */
107long clk_get_accuracy(struct clk *clk); 107long clk_get_accuracy(struct clk *clk);
108 108
109/**
110 * clk_set_phase - adjust the phase shift of a clock signal
111 * @clk: clock signal source
112 * @degrees: number of degrees the signal is shifted
113 *
114 * Shifts the phase of a clock signal by the specified degrees. Returns 0 on
115 * success, -EERROR otherwise.
116 */
117int clk_set_phase(struct clk *clk, int degrees);
118
119/**
120 * clk_get_phase - return the phase shift of a clock signal
121 * @clk: clock signal source
122 *
123 * Returns the phase shift of a clock node in degrees, otherwise returns
124 * -EERROR.
125 */
126int clk_get_phase(struct clk *clk);
127
109#else 128#else
110 129
111static inline long clk_get_accuracy(struct clk *clk) 130static inline long clk_get_accuracy(struct clk *clk)
@@ -113,6 +132,16 @@ static inline long clk_get_accuracy(struct clk *clk)
113 return -ENOTSUPP; 132 return -ENOTSUPP;
114} 133}
115 134
135static inline long clk_set_phase(struct clk *clk, int phase)
136{
137 return -ENOTSUPP;
138}
139
140static inline long clk_get_phase(struct clk *clk)
141{
142 return -ENOTSUPP;
143}
144
116#endif 145#endif
117 146
118/** 147/**
diff --git a/include/linux/clk/at91_pmc.h b/include/linux/clk/at91_pmc.h
index de4268d4987a..c8e3b3d1eded 100644
--- a/include/linux/clk/at91_pmc.h
+++ b/include/linux/clk/at91_pmc.h
@@ -125,6 +125,7 @@ extern void __iomem *at91_pmc_base;
125#define AT91_PMC_PLLADIV2 (1 << 12) /* PLLA divisor by 2 [some SAM9 only] */ 125#define AT91_PMC_PLLADIV2 (1 << 12) /* PLLA divisor by 2 [some SAM9 only] */
126#define AT91_PMC_PLLADIV2_OFF (0 << 12) 126#define AT91_PMC_PLLADIV2_OFF (0 << 12)
127#define AT91_PMC_PLLADIV2_ON (1 << 12) 127#define AT91_PMC_PLLADIV2_ON (1 << 12)
128#define AT91_PMC_H32MXDIV BIT(24)
128 129
129#define AT91_PMC_USB 0x38 /* USB Clock Register [some SAM9 only] */ 130#define AT91_PMC_USB 0x38 /* USB Clock Register [some SAM9 only] */
130#define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */ 131#define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */
diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h
index e8d8a35034a5..f75acbf70e96 100644
--- a/include/linux/clk/ti.h
+++ b/include/linux/clk/ti.h
@@ -292,6 +292,7 @@ void omap2xxx_clkt_vps_init(void);
292void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index); 292void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index);
293void ti_dt_clocks_register(struct ti_dt_clk *oclks); 293void ti_dt_clocks_register(struct ti_dt_clk *oclks);
294void ti_dt_clk_init_provider(struct device_node *np, int index); 294void ti_dt_clk_init_provider(struct device_node *np, int index);
295void ti_dt_clk_init_retry_clks(void);
295void ti_dt_clockdomains_setup(void); 296void ti_dt_clockdomains_setup(void);
296int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw, 297int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw,
297 ti_of_clk_init_cb_t func); 298 ti_of_clk_init_cb_t func);
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 653f0e2b6ca9..abcafaa20b86 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -287,7 +287,7 @@ extern struct clocksource* clocksource_get_next(void);
287extern void clocksource_change_rating(struct clocksource *cs, int rating); 287extern void clocksource_change_rating(struct clocksource *cs, int rating);
288extern void clocksource_suspend(void); 288extern void clocksource_suspend(void);
289extern void clocksource_resume(void); 289extern void clocksource_resume(void);
290extern struct clocksource * __init __weak clocksource_default_clock(void); 290extern struct clocksource * __init clocksource_default_clock(void);
291extern void clocksource_mark_unstable(struct clocksource *cs); 291extern void clocksource_mark_unstable(struct clocksource *cs);
292 292
293extern u64 293extern u64
diff --git a/include/linux/cma.h b/include/linux/cma.h
new file mode 100644
index 000000000000..a93438beb33c
--- /dev/null
+++ b/include/linux/cma.h
@@ -0,0 +1,30 @@
1#ifndef __CMA_H__
2#define __CMA_H__
3
4/*
5 * There is always at least global CMA area and a few optional
6 * areas configured in kernel .config.
7 */
8#ifdef CONFIG_CMA_AREAS
9#define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS)
10
11#else
12#define MAX_CMA_AREAS (0)
13
14#endif
15
16struct cma;
17
18extern phys_addr_t cma_get_base(struct cma *cma);
19extern unsigned long cma_get_size(struct cma *cma);
20
21extern int __init cma_declare_contiguous(phys_addr_t base,
22 phys_addr_t size, phys_addr_t limit,
23 phys_addr_t alignment, unsigned int order_per_bit,
24 bool fixed, struct cma **res_cma);
25extern int cma_init_reserved_mem(phys_addr_t base,
26 phys_addr_t size, int order_per_bit,
27 struct cma **res_cma);
28extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align);
29extern bool cma_release(struct cma *cma, struct page *pages, int count);
30#endif
diff --git a/include/linux/com20020.h b/include/linux/com20020.h
index 5dcfb944b6ce..85898995b234 100644
--- a/include/linux/com20020.h
+++ b/include/linux/com20020.h
@@ -41,6 +41,35 @@ extern const struct net_device_ops com20020_netdev_ops;
41#define BUS_ALIGN 1 41#define BUS_ALIGN 1
42#endif 42#endif
43 43
44#define PLX_PCI_MAX_CARDS 2
45
46struct com20020_pci_channel_map {
47 u32 bar;
48 u32 offset;
49 u32 size; /* 0x00 - auto, e.g. length of entire bar */
50};
51
52struct com20020_pci_card_info {
53 const char *name;
54 int devcount;
55
56 struct com20020_pci_channel_map chan_map_tbl[PLX_PCI_MAX_CARDS];
57
58 unsigned int flags;
59};
60
61struct com20020_priv {
62 struct com20020_pci_card_info *ci;
63 struct list_head list_dev;
64};
65
66struct com20020_dev {
67 struct list_head list;
68 struct net_device *dev;
69
70 struct com20020_priv *pci_priv;
71 int index;
72};
44 73
45#define _INTMASK (ioaddr+BUS_ALIGN*0) /* writable */ 74#define _INTMASK (ioaddr+BUS_ALIGN*0) /* writable */
46#define _STATUS (ioaddr+BUS_ALIGN*0) /* readable */ 75#define _STATUS (ioaddr+BUS_ALIGN*0) /* readable */
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 01e3132820da..60bdf8dc02a3 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -2,14 +2,24 @@
2#define _LINUX_COMPACTION_H 2#define _LINUX_COMPACTION_H
3 3
4/* Return values for compact_zone() and try_to_compact_pages() */ 4/* Return values for compact_zone() and try_to_compact_pages() */
5/* compaction didn't start as it was deferred due to past failures */
6#define COMPACT_DEFERRED 0
5/* compaction didn't start as it was not possible or direct reclaim was more suitable */ 7/* compaction didn't start as it was not possible or direct reclaim was more suitable */
6#define COMPACT_SKIPPED 0 8#define COMPACT_SKIPPED 1
7/* compaction should continue to another pageblock */ 9/* compaction should continue to another pageblock */
8#define COMPACT_CONTINUE 1 10#define COMPACT_CONTINUE 2
9/* direct compaction partially compacted a zone and there are suitable pages */ 11/* direct compaction partially compacted a zone and there are suitable pages */
10#define COMPACT_PARTIAL 2 12#define COMPACT_PARTIAL 3
11/* The full zone was compacted */ 13/* The full zone was compacted */
12#define COMPACT_COMPLETE 3 14#define COMPACT_COMPLETE 4
15
16/* Used to signal whether compaction detected need_sched() or lock contention */
17/* No contention detected */
18#define COMPACT_CONTENDED_NONE 0
19/* Either need_sched() was true or fatal signal pending */
20#define COMPACT_CONTENDED_SCHED 1
21/* Zone lock or lru_lock was contended in async compaction */
22#define COMPACT_CONTENDED_LOCK 2
13 23
14#ifdef CONFIG_COMPACTION 24#ifdef CONFIG_COMPACTION
15extern int sysctl_compact_memory; 25extern int sysctl_compact_memory;
@@ -22,7 +32,8 @@ extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
22extern int fragmentation_index(struct zone *zone, unsigned int order); 32extern int fragmentation_index(struct zone *zone, unsigned int order);
23extern unsigned long try_to_compact_pages(struct zonelist *zonelist, 33extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
24 int order, gfp_t gfp_mask, nodemask_t *mask, 34 int order, gfp_t gfp_mask, nodemask_t *mask,
25 enum migrate_mode mode, bool *contended); 35 enum migrate_mode mode, int *contended,
36 struct zone **candidate_zone);
26extern void compact_pgdat(pg_data_t *pgdat, int order); 37extern void compact_pgdat(pg_data_t *pgdat, int order);
27extern void reset_isolation_suitable(pg_data_t *pgdat); 38extern void reset_isolation_suitable(pg_data_t *pgdat);
28extern unsigned long compaction_suitable(struct zone *zone, int order); 39extern unsigned long compaction_suitable(struct zone *zone, int order);
@@ -91,7 +102,8 @@ static inline bool compaction_restarting(struct zone *zone, int order)
91#else 102#else
92static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, 103static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
93 int order, gfp_t gfp_mask, nodemask_t *nodemask, 104 int order, gfp_t gfp_mask, nodemask_t *nodemask,
94 enum migrate_mode mode, bool *contended) 105 enum migrate_mode mode, int *contended,
106 struct zone **candidate_zone)
95{ 107{
96 return COMPACT_CONTINUE; 108 return COMPACT_CONTINUE;
97} 109}
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 2507fd2a1eb4..d1a558239b1a 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -71,7 +71,6 @@
71 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 71 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
72 * 72 *
73 * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. 73 * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
74 * Fixed in GCC 4.8.2 and later versions.
75 * 74 *
76 * (asm goto is automatically volatile - the naming reflects this.) 75 * (asm goto is automatically volatile - the naming reflects this.)
77 */ 76 */
diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h
new file mode 100644
index 000000000000..c8c565952548
--- /dev/null
+++ b/include/linux/compiler-gcc5.h
@@ -0,0 +1,65 @@
1#ifndef __LINUX_COMPILER_H
2#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
3#endif
4
5#define __used __attribute__((__used__))
6#define __must_check __attribute__((warn_unused_result))
7#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
8
9/* Mark functions as cold. gcc will assume any path leading to a call
10 to them will be unlikely. This means a lot of manual unlikely()s
11 are unnecessary now for any paths leading to the usual suspects
12 like BUG(), printk(), panic() etc. [but let's keep them for now for
13 older compilers]
14
15 Early snapshots of gcc 4.3 don't support this and we can't detect this
16 in the preprocessor, but we can live with this because they're unreleased.
17 Maketime probing would be overkill here.
18
19 gcc also has a __attribute__((__hot__)) to move hot functions into
20 a special section, but I don't see any sense in this right now in
21 the kernel context */
22#define __cold __attribute__((__cold__))
23
24#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
25
26#ifndef __CHECKER__
27# define __compiletime_warning(message) __attribute__((warning(message)))
28# define __compiletime_error(message) __attribute__((error(message)))
29#endif /* __CHECKER__ */
30
31/*
32 * Mark a position in code as unreachable. This can be used to
33 * suppress control flow warnings after asm blocks that transfer
34 * control elsewhere.
35 *
36 * Early snapshots of gcc 4.5 don't support this and we can't detect
37 * this in the preprocessor, but we can live with this because they're
38 * unreleased. Really, we need to have autoconf for the kernel.
39 */
40#define unreachable() __builtin_unreachable()
41
42/* Mark a function definition as prohibited from being cloned. */
43#define __noclone __attribute__((__noclone__))
44
45/*
46 * Tell the optimizer that something else uses this function or variable.
47 */
48#define __visible __attribute__((externally_visible))
49
50/*
51 * GCC 'asm goto' miscompiles certain code sequences:
52 *
53 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
54 *
55 * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
56 *
57 * (asm goto is automatically volatile - the naming reflects this.)
58 */
59#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
60
61#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
62#define __HAVE_BUILTIN_BSWAP32__
63#define __HAVE_BUILTIN_BSWAP64__
64#define __HAVE_BUILTIN_BSWAP16__
65#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 95978ad7fcdd..b2d9a43012b2 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -213,6 +213,7 @@ extern struct bus_type cpu_subsys;
213extern void cpu_hotplug_begin(void); 213extern void cpu_hotplug_begin(void);
214extern void cpu_hotplug_done(void); 214extern void cpu_hotplug_done(void);
215extern void get_online_cpus(void); 215extern void get_online_cpus(void);
216extern bool try_get_online_cpus(void);
216extern void put_online_cpus(void); 217extern void put_online_cpus(void);
217extern void cpu_hotplug_disable(void); 218extern void cpu_hotplug_disable(void);
218extern void cpu_hotplug_enable(void); 219extern void cpu_hotplug_enable(void);
@@ -230,6 +231,7 @@ int cpu_down(unsigned int cpu);
230static inline void cpu_hotplug_begin(void) {} 231static inline void cpu_hotplug_begin(void) {}
231static inline void cpu_hotplug_done(void) {} 232static inline void cpu_hotplug_done(void) {}
232#define get_online_cpus() do { } while (0) 233#define get_online_cpus() do { } while (0)
234#define try_get_online_cpus() true
233#define put_online_cpus() do { } while (0) 235#define put_online_cpus() do { } while (0)
234#define cpu_hotplug_disable() do { } while (0) 236#define cpu_hotplug_disable() do { } while (0)
235#define cpu_hotplug_enable() do { } while (0) 237#define cpu_hotplug_enable() do { } while (0)
diff --git a/include/linux/cpufreq-dt.h b/include/linux/cpufreq-dt.h
new file mode 100644
index 000000000000..0414009e2c30
--- /dev/null
+++ b/include/linux/cpufreq-dt.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2014 Marvell
3 * Thomas Petazzoni <thomas.petazzoni@free-electrons.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 __CPUFREQ_DT_H__
11#define __CPUFREQ_DT_H__
12
13struct cpufreq_dt_platform_data {
14 /*
15 * True when each CPU has its own clock to control its
16 * frequency, false when all CPUs are controlled by a single
17 * clock.
18 */
19 bool independent_clocks;
20};
21
22#endif /* __CPUFREQ_DT_H__ */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 7d1955afa62c..503b085b7832 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -112,6 +112,9 @@ struct cpufreq_policy {
112 spinlock_t transition_lock; 112 spinlock_t transition_lock;
113 wait_queue_head_t transition_wait; 113 wait_queue_head_t transition_wait;
114 struct task_struct *transition_task; /* Task which is doing the transition */ 114 struct task_struct *transition_task; /* Task which is doing the transition */
115
116 /* For cpufreq driver's internal use */
117 void *driver_data;
115}; 118};
116 119
117/* Only for ACPI */ 120/* Only for ACPI */
@@ -216,6 +219,7 @@ __ATTR(_name, 0644, show_##_name, store_##_name)
216struct cpufreq_driver { 219struct cpufreq_driver {
217 char name[CPUFREQ_NAME_LEN]; 220 char name[CPUFREQ_NAME_LEN];
218 u8 flags; 221 u8 flags;
222 void *driver_data;
219 223
220 /* needed by all drivers */ 224 /* needed by all drivers */
221 int (*init) (struct cpufreq_policy *policy); 225 int (*init) (struct cpufreq_policy *policy);
@@ -309,6 +313,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data);
309int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); 313int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
310 314
311const char *cpufreq_get_current_driver(void); 315const char *cpufreq_get_current_driver(void);
316void *cpufreq_get_driver_data(void);
312 317
313static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, 318static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
314 unsigned int min, unsigned int max) 319 unsigned int min, unsigned int max)
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 2997af6d2ccd..0a9a6da21e74 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -666,10 +666,19 @@ static inline size_t cpumask_size(void)
666 * 666 *
667 * This code makes NR_CPUS length memcopy and brings to a memory corruption. 667 * This code makes NR_CPUS length memcopy and brings to a memory corruption.
668 * cpumask_copy() provide safe copy functionality. 668 * cpumask_copy() provide safe copy functionality.
669 *
670 * Note that there is another evil here: If you define a cpumask_var_t
671 * as a percpu variable then the way to obtain the address of the cpumask
672 * structure differently influences what this_cpu_* operation needs to be
673 * used. Please use this_cpu_cpumask_var_t in those cases. The direct use
674 * of this_cpu_ptr() or this_cpu_read() will lead to failures when the
675 * other type of cpumask_var_t implementation is configured.
669 */ 676 */
670#ifdef CONFIG_CPUMASK_OFFSTACK 677#ifdef CONFIG_CPUMASK_OFFSTACK
671typedef struct cpumask *cpumask_var_t; 678typedef struct cpumask *cpumask_var_t;
672 679
680#define this_cpu_cpumask_var_ptr(x) this_cpu_read(x)
681
673bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node); 682bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
674bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); 683bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
675bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node); 684bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
@@ -681,6 +690,8 @@ void free_bootmem_cpumask_var(cpumask_var_t mask);
681#else 690#else
682typedef struct cpumask cpumask_var_t[1]; 691typedef struct cpumask cpumask_var_t[1];
683 692
693#define this_cpu_cpumask_var_ptr(x) this_cpu_ptr(x)
694
684static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) 695static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
685{ 696{
686 return true; 697 return true;
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index ade2390ffe92..2f073db7392e 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -86,19 +86,20 @@ extern void __cpuset_memory_pressure_bump(void);
86 86
87extern void cpuset_task_status_allowed(struct seq_file *m, 87extern void cpuset_task_status_allowed(struct seq_file *m,
88 struct task_struct *task); 88 struct task_struct *task);
89extern int proc_cpuset_show(struct seq_file *, void *); 89extern int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns,
90 struct pid *pid, struct task_struct *tsk);
90 91
91extern int cpuset_mem_spread_node(void); 92extern int cpuset_mem_spread_node(void);
92extern int cpuset_slab_spread_node(void); 93extern int cpuset_slab_spread_node(void);
93 94
94static inline int cpuset_do_page_mem_spread(void) 95static inline int cpuset_do_page_mem_spread(void)
95{ 96{
96 return current->flags & PF_SPREAD_PAGE; 97 return task_spread_page(current);
97} 98}
98 99
99static inline int cpuset_do_slab_mem_spread(void) 100static inline int cpuset_do_slab_mem_spread(void)
100{ 101{
101 return current->flags & PF_SPREAD_SLAB; 102 return task_spread_slab(current);
102} 103}
103 104
104extern int current_cpuset_is_being_rebound(void); 105extern int current_cpuset_is_being_rebound(void);
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 72ab536ad3de..3849fce7ecfe 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -14,14 +14,13 @@
14extern unsigned long long elfcorehdr_addr; 14extern unsigned long long elfcorehdr_addr;
15extern unsigned long long elfcorehdr_size; 15extern unsigned long long elfcorehdr_size;
16 16
17extern int __weak elfcorehdr_alloc(unsigned long long *addr, 17extern int elfcorehdr_alloc(unsigned long long *addr, unsigned long long *size);
18 unsigned long long *size); 18extern void elfcorehdr_free(unsigned long long addr);
19extern void __weak elfcorehdr_free(unsigned long long addr); 19extern ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos);
20extern ssize_t __weak elfcorehdr_read(char *buf, size_t count, u64 *ppos); 20extern ssize_t elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos);
21extern ssize_t __weak elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos); 21extern int remap_oldmem_pfn_range(struct vm_area_struct *vma,
22extern int __weak remap_oldmem_pfn_range(struct vm_area_struct *vma, 22 unsigned long from, unsigned long pfn,
23 unsigned long from, unsigned long pfn, 23 unsigned long size, pgprot_t prot);
24 unsigned long size, pgprot_t prot);
25 24
26extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 25extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
27 unsigned long, int); 26 unsigned long, int);
diff --git a/include/linux/crc-t10dif.h b/include/linux/crc-t10dif.h
index b3cb71f0d3b0..cf53d0773ce3 100644
--- a/include/linux/crc-t10dif.h
+++ b/include/linux/crc-t10dif.h
@@ -6,7 +6,8 @@
6#define CRC_T10DIF_DIGEST_SIZE 2 6#define CRC_T10DIF_DIGEST_SIZE 2
7#define CRC_T10DIF_BLOCK_SIZE 1 7#define CRC_T10DIF_BLOCK_SIZE 1
8 8
9__u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer, size_t len); 9extern __u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer,
10__u16 crc_t10dif(unsigned char const *, size_t); 10 size_t len);
11extern __u16 crc_t10dif(unsigned char const *, size_t);
11 12
12#endif 13#endif
diff --git a/include/linux/cred.h b/include/linux/cred.h
index f61d6c8f5ef3..b2d0820837c4 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -259,6 +259,15 @@ static inline void put_cred(const struct cred *_cred)
259 rcu_dereference_protected(current->cred, 1) 259 rcu_dereference_protected(current->cred, 1)
260 260
261/** 261/**
262 * current_real_cred - Access the current task's objective credentials
263 *
264 * Access the objective credentials of the current task. RCU-safe,
265 * since nobody else can modify it.
266 */
267#define current_real_cred() \
268 rcu_dereference_protected(current->real_cred, 1)
269
270/**
262 * __task_cred - Access a task's objective credentials 271 * __task_cred - Access a task's objective credentials
263 * @task: The task to query 272 * @task: The task to query
264 * 273 *
diff --git a/include/linux/cycx_x25.h b/include/linux/cycx_x25.h
deleted file mode 100644
index 362bf19d6cf1..000000000000
--- a/include/linux/cycx_x25.h
+++ /dev/null
@@ -1,125 +0,0 @@
1#ifndef _CYCX_X25_H
2#define _CYCX_X25_H
3/*
4* cycx_x25.h Cyclom X.25 firmware API definitions.
5*
6* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
7*
8* Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
9*
10* Based on sdla_x25.h by Gene Kozin <74604.152@compuserve.com>
11*
12* This program is free software; you can redistribute it and/or
13* modify it under the terms of the GNU General Public License
14* as published by the Free Software Foundation; either version
15* 2 of the License, or (at your option) any later version.
16* ============================================================================
17* 2000/04/02 acme dprintk and cycx_debug
18* 1999/01/03 acme judicious use of data types
19* 1999/01/02 acme #define X25_ACK_N3 0x4411
20* 1998/12/28 acme cleanup: lot'o'things removed
21* commands listed,
22* TX25Cmd & TX25Config structs
23* typedef'ed
24*/
25#ifndef PACKED
26#define PACKED __attribute__((packed))
27#endif
28
29/* X.25 shared memory layout. */
30#define X25_MBOX_OFFS 0x300 /* general mailbox block */
31#define X25_RXMBOX_OFFS 0x340 /* receive mailbox */
32
33/* Debug */
34#define dprintk(level, format, a...) if (cycx_debug >= level) printk(format, ##a)
35
36extern unsigned int cycx_debug;
37
38/* Data Structures */
39/* X.25 Command Block. */
40struct cycx_x25_cmd {
41 u16 command;
42 u16 link; /* values: 0 or 1 */
43 u16 len; /* values: 0 thru 0x205 (517) */
44 u32 buf;
45} PACKED;
46
47/* Defines for the 'command' field. */
48#define X25_CONNECT_REQUEST 0x4401
49#define X25_CONNECT_RESPONSE 0x4402
50#define X25_DISCONNECT_REQUEST 0x4403
51#define X25_DISCONNECT_RESPONSE 0x4404
52#define X25_DATA_REQUEST 0x4405
53#define X25_ACK_TO_VC 0x4406
54#define X25_INTERRUPT_RESPONSE 0x4407
55#define X25_CONFIG 0x4408
56#define X25_CONNECT_INDICATION 0x4409
57#define X25_CONNECT_CONFIRM 0x440A
58#define X25_DISCONNECT_INDICATION 0x440B
59#define X25_DISCONNECT_CONFIRM 0x440C
60#define X25_DATA_INDICATION 0x440E
61#define X25_INTERRUPT_INDICATION 0x440F
62#define X25_ACK_FROM_VC 0x4410
63#define X25_ACK_N3 0x4411
64#define X25_CONNECT_COLLISION 0x4413
65#define X25_N3WIN 0x4414
66#define X25_LINE_ON 0x4415
67#define X25_LINE_OFF 0x4416
68#define X25_RESET_REQUEST 0x4417
69#define X25_LOG 0x4500
70#define X25_STATISTIC 0x4600
71#define X25_TRACE 0x4700
72#define X25_N2TRACEXC 0x4702
73#define X25_N3TRACEXC 0x4703
74
75/**
76 * struct cycx_x25_config - cyclom2x x25 firmware configuration
77 * @link - link number
78 * @speed - line speed
79 * @clock - internal/external
80 * @n2 - # of level 2 retransm.(values: 1 thru FF)
81 * @n2win - level 2 window (values: 1 thru 7)
82 * @n3win - level 3 window (values: 1 thru 7)
83 * @nvc - # of logical channels (values: 1 thru 64)
84 * @pktlen - level 3 packet length - log base 2 of size
85 * @locaddr - my address
86 * @remaddr - remote address
87 * @t1 - time, in seconds
88 * @t2 - time, in seconds
89 * @t21 - time, in seconds
90 * @npvc - # of permanent virt. circuits (1 thru nvc)
91 * @t23 - time, in seconds
92 * @flags - see dosx25.doc, in portuguese, for details
93 */
94struct cycx_x25_config {
95 u8 link;
96 u8 speed;
97 u8 clock;
98 u8 n2;
99 u8 n2win;
100 u8 n3win;
101 u8 nvc;
102 u8 pktlen;
103 u8 locaddr;
104 u8 remaddr;
105 u16 t1;
106 u16 t2;
107 u8 t21;
108 u8 npvc;
109 u8 t23;
110 u8 flags;
111} PACKED;
112
113struct cycx_x25_stats {
114 u16 rx_crc_errors;
115 u16 rx_over_errors;
116 u16 n2_tx_frames;
117 u16 n2_rx_frames;
118 u16 tx_timeouts;
119 u16 rx_timeouts;
120 u16 n3_tx_packets;
121 u16 n3_rx_packets;
122 u16 tx_aborts;
123 u16 rx_aborts;
124} PACKED;
125#endif /* _CYCX_X25_H */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 3c7ec327ebd2..b2a2a08523bf 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -11,7 +11,6 @@
11#include <linux/rcupdate.h> 11#include <linux/rcupdate.h>
12#include <linux/lockref.h> 12#include <linux/lockref.h>
13 13
14struct nameidata;
15struct path; 14struct path;
16struct vfsmount; 15struct vfsmount;
17 16
@@ -55,6 +54,7 @@ struct qstr {
55#define QSTR_INIT(n,l) { { { .len = l } }, .name = n } 54#define QSTR_INIT(n,l) { { { .len = l } }, .name = n }
56#define hashlen_hash(hashlen) ((u32) (hashlen)) 55#define hashlen_hash(hashlen) ((u32) (hashlen))
57#define hashlen_len(hashlen) ((u32)((hashlen) >> 32)) 56#define hashlen_len(hashlen) ((u32)((hashlen) >> 32))
57#define hashlen_create(hash,len) (((u64)(len)<<32)|(u32)(hash))
58 58
59struct dentry_stat_t { 59struct dentry_stat_t {
60 long nr_dentry; 60 long nr_dentry;
@@ -225,11 +225,6 @@ struct dentry_operations {
225 225
226extern seqlock_t rename_lock; 226extern seqlock_t rename_lock;
227 227
228static inline int dname_external(const struct dentry *dentry)
229{
230 return dentry->d_name.name != dentry->d_iname;
231}
232
233/* 228/*
234 * These are the low-level FS interfaces to the dcache.. 229 * These are the low-level FS interfaces to the dcache..
235 */ 230 */
@@ -249,10 +244,11 @@ extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
249extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); 244extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *);
250extern struct dentry *d_find_any_alias(struct inode *inode); 245extern struct dentry *d_find_any_alias(struct inode *inode);
251extern struct dentry * d_obtain_alias(struct inode *); 246extern struct dentry * d_obtain_alias(struct inode *);
247extern struct dentry * d_obtain_root(struct inode *);
252extern void shrink_dcache_sb(struct super_block *); 248extern void shrink_dcache_sb(struct super_block *);
253extern void shrink_dcache_parent(struct dentry *); 249extern void shrink_dcache_parent(struct dentry *);
254extern void shrink_dcache_for_umount(struct super_block *); 250extern void shrink_dcache_for_umount(struct super_block *);
255extern int d_invalidate(struct dentry *); 251extern void d_invalidate(struct dentry *);
256 252
257/* only used at mount-time */ 253/* only used at mount-time */
258extern struct dentry * d_make_root(struct inode *); 254extern struct dentry * d_make_root(struct inode *);
@@ -267,7 +263,6 @@ extern void d_prune_aliases(struct inode *);
267 263
268/* test whether we have any submounts in a subdir tree */ 264/* test whether we have any submounts in a subdir tree */
269extern int have_submounts(struct dentry *); 265extern int have_submounts(struct dentry *);
270extern int check_submounts_and_drop(struct dentry *);
271 266
272/* 267/*
273 * This adds the entry to the hash queues. 268 * This adds the entry to the hash queues.
diff --git a/include/linux/decompress/bunzip2.h b/include/linux/decompress/bunzip2.h
index 115272137a9c..4d683df898e6 100644
--- a/include/linux/decompress/bunzip2.h
+++ b/include/linux/decompress/bunzip2.h
@@ -1,10 +1,10 @@
1#ifndef DECOMPRESS_BUNZIP2_H 1#ifndef DECOMPRESS_BUNZIP2_H
2#define DECOMPRESS_BUNZIP2_H 2#define DECOMPRESS_BUNZIP2_H
3 3
4int bunzip2(unsigned char *inbuf, int len, 4int bunzip2(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/generic.h b/include/linux/decompress/generic.h
index 0c7111a55a1a..1fcfd64b5076 100644
--- a/include/linux/decompress/generic.h
+++ b/include/linux/decompress/generic.h
@@ -1,11 +1,11 @@
1#ifndef DECOMPRESS_GENERIC_H 1#ifndef DECOMPRESS_GENERIC_H
2#define DECOMPRESS_GENERIC_H 2#define DECOMPRESS_GENERIC_H
3 3
4typedef int (*decompress_fn) (unsigned char *inbuf, int len, 4typedef int (*decompress_fn) (unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *outbuf, 7 unsigned char *outbuf,
8 int *posp, 8 long *posp,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10 10
11/* inbuf - input buffer 11/* inbuf - input buffer
@@ -33,7 +33,7 @@ typedef int (*decompress_fn) (unsigned char *inbuf, int len,
33 33
34 34
35/* Utility routine to detect the decompression method */ 35/* Utility routine to detect the decompression method */
36decompress_fn decompress_method(const unsigned char *inbuf, int len, 36decompress_fn decompress_method(const unsigned char *inbuf, long len,
37 const char **name); 37 const char **name);
38 38
39#endif 39#endif
diff --git a/include/linux/decompress/inflate.h b/include/linux/decompress/inflate.h
index 1d0aedef9822..e4f411fdbd24 100644
--- a/include/linux/decompress/inflate.h
+++ b/include/linux/decompress/inflate.h
@@ -1,10 +1,10 @@
1#ifndef LINUX_DECOMPRESS_INFLATE_H 1#ifndef LINUX_DECOMPRESS_INFLATE_H
2#define LINUX_DECOMPRESS_INFLATE_H 2#define LINUX_DECOMPRESS_INFLATE_H
3 3
4int gunzip(unsigned char *inbuf, int len, 4int gunzip(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error_fn)(char *x)); 9 void(*error_fn)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/unlz4.h b/include/linux/decompress/unlz4.h
index d5b68bf3ec92..3273c2f36496 100644
--- a/include/linux/decompress/unlz4.h
+++ b/include/linux/decompress/unlz4.h
@@ -1,10 +1,10 @@
1#ifndef DECOMPRESS_UNLZ4_H 1#ifndef DECOMPRESS_UNLZ4_H
2#define DECOMPRESS_UNLZ4_H 2#define DECOMPRESS_UNLZ4_H
3 3
4int unlz4(unsigned char *inbuf, int len, 4int unlz4(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/unlzma.h b/include/linux/decompress/unlzma.h
index 7796538f1bf4..8a891a193840 100644
--- a/include/linux/decompress/unlzma.h
+++ b/include/linux/decompress/unlzma.h
@@ -1,11 +1,11 @@
1#ifndef DECOMPRESS_UNLZMA_H 1#ifndef DECOMPRESS_UNLZMA_H
2#define DECOMPRESS_UNLZMA_H 2#define DECOMPRESS_UNLZMA_H
3 3
4int unlzma(unsigned char *, int, 4int unlzma(unsigned char *, long,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *posp, 8 long *posp,
9 void(*error)(char *x) 9 void(*error)(char *x)
10 ); 10 );
11 11
diff --git a/include/linux/decompress/unlzo.h b/include/linux/decompress/unlzo.h
index 987229752519..af18f95d6570 100644
--- a/include/linux/decompress/unlzo.h
+++ b/include/linux/decompress/unlzo.h
@@ -1,10 +1,10 @@
1#ifndef DECOMPRESS_UNLZO_H 1#ifndef DECOMPRESS_UNLZO_H
2#define DECOMPRESS_UNLZO_H 2#define DECOMPRESS_UNLZO_H
3 3
4int unlzo(unsigned char *inbuf, int len, 4int unlzo(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/unxz.h b/include/linux/decompress/unxz.h
index 41728fc6c8a1..f764e2a7201e 100644
--- a/include/linux/decompress/unxz.h
+++ b/include/linux/decompress/unxz.h
@@ -10,10 +10,10 @@
10#ifndef DECOMPRESS_UNXZ_H 10#ifndef DECOMPRESS_UNXZ_H
11#define DECOMPRESS_UNXZ_H 11#define DECOMPRESS_UNXZ_H
12 12
13int unxz(unsigned char *in, int in_size, 13int unxz(unsigned char *in, long in_size,
14 int (*fill)(void *dest, unsigned int size), 14 long (*fill)(void *dest, unsigned long size),
15 int (*flush)(void *src, unsigned int size), 15 long (*flush)(void *src, unsigned long size),
16 unsigned char *out, int *in_used, 16 unsigned char *out, long *in_used,
17 void (*error)(char *x)); 17 void (*error)(char *x));
18 18
19#endif 19#endif
diff --git a/include/linux/devcoredump.h b/include/linux/devcoredump.h
new file mode 100644
index 000000000000..c0a360e99f64
--- /dev/null
+++ b/include/linux/devcoredump.h
@@ -0,0 +1,35 @@
1#ifndef __DEVCOREDUMP_H
2#define __DEVCOREDUMP_H
3
4#include <linux/device.h>
5#include <linux/module.h>
6#include <linux/vmalloc.h>
7
8#ifdef CONFIG_DEV_COREDUMP
9void dev_coredumpv(struct device *dev, const void *data, size_t datalen,
10 gfp_t gfp);
11
12void dev_coredumpm(struct device *dev, struct module *owner,
13 const void *data, size_t datalen, gfp_t gfp,
14 ssize_t (*read)(char *buffer, loff_t offset, size_t count,
15 const void *data, size_t datalen),
16 void (*free)(const void *data));
17#else
18static inline void dev_coredumpv(struct device *dev, const void *data,
19 size_t datalen, gfp_t gfp)
20{
21 vfree(data);
22}
23
24static inline void
25dev_coredumpm(struct device *dev, struct module *owner,
26 const void *data, size_t datalen, gfp_t gfp,
27 ssize_t (*read)(char *buffer, loff_t offset, size_t count,
28 const void *data, size_t datalen),
29 void (*free)(const void *data))
30{
31 free(data);
32}
33#endif /* CONFIG_DEV_COREDUMP */
34
35#endif /* __DEVCOREDUMP_H */
diff --git a/include/linux/device.h b/include/linux/device.h
index 43d183aeb25b..ce1f21608b16 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -181,13 +181,14 @@ extern int bus_unregister_notifier(struct bus_type *bus,
181 * with the device lock held in the core, so be careful. 181 * with the device lock held in the core, so be careful.
182 */ 182 */
183#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ 183#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */
184#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ 184#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device to be removed */
185#define BUS_NOTIFY_BIND_DRIVER 0x00000003 /* driver about to be 185#define BUS_NOTIFY_REMOVED_DEVICE 0x00000003 /* device removed */
186#define BUS_NOTIFY_BIND_DRIVER 0x00000004 /* driver about to be
186 bound */ 187 bound */
187#define BUS_NOTIFY_BOUND_DRIVER 0x00000004 /* driver bound to device */ 188#define BUS_NOTIFY_BOUND_DRIVER 0x00000005 /* driver bound to device */
188#define BUS_NOTIFY_UNBIND_DRIVER 0x00000005 /* driver about to be 189#define BUS_NOTIFY_UNBIND_DRIVER 0x00000006 /* driver about to be
189 unbound */ 190 unbound */
190#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000006 /* driver is unbound 191#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000007 /* driver is unbound
191 from the device */ 192 from the device */
192 193
193extern struct kset *bus_get_kset(struct bus_type *bus); 194extern struct kset *bus_get_kset(struct bus_type *bus);
@@ -607,8 +608,8 @@ extern int devres_release_group(struct device *dev, void *id);
607extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp); 608extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp);
608extern char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, 609extern char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt,
609 va_list ap); 610 va_list ap);
610extern char *devm_kasprintf(struct device *dev, gfp_t gfp, 611extern __printf(3, 4)
611 const char *fmt, ...); 612char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...);
612static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) 613static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
613{ 614{
614 return devm_kmalloc(dev, size, gfp | __GFP_ZERO); 615 return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
index 772eab5d524a..569bbd039896 100644
--- a/include/linux/dma-contiguous.h
+++ b/include/linux/dma-contiguous.h
@@ -53,18 +53,13 @@
53 53
54#ifdef __KERNEL__ 54#ifdef __KERNEL__
55 55
56#include <linux/device.h>
57
56struct cma; 58struct cma;
57struct page; 59struct page;
58struct device;
59 60
60#ifdef CONFIG_DMA_CMA 61#ifdef CONFIG_DMA_CMA
61 62
62/*
63 * There is always at least global CMA area and a few optional device
64 * private areas configured in kernel .config.
65 */
66#define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS)
67
68extern struct cma *dma_contiguous_default_area; 63extern struct cma *dma_contiguous_default_area;
69 64
70static inline struct cma *dev_get_cma_area(struct device *dev) 65static inline struct cma *dev_get_cma_area(struct device *dev)
@@ -123,8 +118,6 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages,
123 118
124#else 119#else
125 120
126#define MAX_CMA_AREAS (0)
127
128static inline struct cma *dev_get_cma_area(struct device *dev) 121static inline struct cma *dev_get_cma_area(struct device *dev)
129{ 122{
130 return NULL; 123 return NULL;
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 931b70986272..d5d388160f42 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -263,6 +263,32 @@ struct dma_attrs;
263#define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \ 263#define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \
264 dma_unmap_sg(dev, sgl, nents, dir) 264 dma_unmap_sg(dev, sgl, nents, dir)
265 265
266#else
267static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
268 dma_addr_t *dma_addr, gfp_t gfp)
269{
270 DEFINE_DMA_ATTRS(attrs);
271 dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
272 return dma_alloc_attrs(dev, size, dma_addr, gfp, &attrs);
273}
274
275static inline void dma_free_writecombine(struct device *dev, size_t size,
276 void *cpu_addr, dma_addr_t dma_addr)
277{
278 DEFINE_DMA_ATTRS(attrs);
279 dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
280 return dma_free_attrs(dev, size, cpu_addr, dma_addr, &attrs);
281}
282
283static inline int dma_mmap_writecombine(struct device *dev,
284 struct vm_area_struct *vma,
285 void *cpu_addr, dma_addr_t dma_addr,
286 size_t size)
287{
288 DEFINE_DMA_ATTRS(attrs);
289 dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
290 return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
291}
266#endif /* CONFIG_HAVE_DMA_ATTRS */ 292#endif /* CONFIG_HAVE_DMA_ATTRS */
267 293
268#ifdef CONFIG_NEED_DMA_MAP_STATE 294#ifdef CONFIG_NEED_DMA_MAP_STATE
diff --git a/include/linux/dma/dw.h b/include/linux/dma/dw.h
new file mode 100644
index 000000000000..71456442ebe3
--- /dev/null
+++ b/include/linux/dma/dw.h
@@ -0,0 +1,64 @@
1/*
2 * Driver for the Synopsys DesignWare DMA Controller
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 * Copyright (C) 2010-2011 ST Microelectronics
6 * Copyright (C) 2014 Intel Corporation
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#ifndef _DMA_DW_H
13#define _DMA_DW_H
14
15#include <linux/clk.h>
16#include <linux/device.h>
17#include <linux/dmaengine.h>
18
19#include <linux/platform_data/dma-dw.h>
20
21struct dw_dma;
22
23/**
24 * struct dw_dma_chip - representation of DesignWare DMA controller hardware
25 * @dev: struct device of the DMA controller
26 * @irq: irq line
27 * @regs: memory mapped I/O space
28 * @clk: hclk clock
29 * @dw: struct dw_dma that is filed by dw_dma_probe()
30 */
31struct dw_dma_chip {
32 struct device *dev;
33 int irq;
34 void __iomem *regs;
35 struct clk *clk;
36 struct dw_dma *dw;
37};
38
39/* Export to the platform drivers */
40int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata);
41int dw_dma_remove(struct dw_dma_chip *chip);
42
43/* DMA API extensions */
44struct dw_desc;
45
46struct dw_cyclic_desc {
47 struct dw_desc **desc;
48 unsigned long periods;
49 void (*period_callback)(void *param);
50 void *period_callback_param;
51};
52
53struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
54 dma_addr_t buf_addr, size_t buf_len, size_t period_len,
55 enum dma_transfer_direction direction);
56void dw_dma_cyclic_free(struct dma_chan *chan);
57int dw_dma_cyclic_start(struct dma_chan *chan);
58void dw_dma_cyclic_stop(struct dma_chan *chan);
59
60dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan);
61
62dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan);
63
64#endif /* _DMA_DW_H */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 3d1c2aa51530..653a1fd07ae8 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -37,7 +37,6 @@
37 */ 37 */
38typedef s32 dma_cookie_t; 38typedef s32 dma_cookie_t;
39#define DMA_MIN_COOKIE 1 39#define DMA_MIN_COOKIE 1
40#define DMA_MAX_COOKIE INT_MAX
41 40
42static inline int dma_submit_error(dma_cookie_t cookie) 41static inline int dma_submit_error(dma_cookie_t cookie)
43{ 42{
@@ -200,15 +199,12 @@ enum dma_ctrl_flags {
200 * configuration data in statically from the platform). An additional 199 * configuration data in statically from the platform). An additional
201 * argument of struct dma_slave_config must be passed in with this 200 * argument of struct dma_slave_config must be passed in with this
202 * command. 201 * command.
203 * @FSLDMA_EXTERNAL_START: this command will put the Freescale DMA controller
204 * into external start mode.
205 */ 202 */
206enum dma_ctrl_cmd { 203enum dma_ctrl_cmd {
207 DMA_TERMINATE_ALL, 204 DMA_TERMINATE_ALL,
208 DMA_PAUSE, 205 DMA_PAUSE,
209 DMA_RESUME, 206 DMA_RESUME,
210 DMA_SLAVE_CONFIG, 207 DMA_SLAVE_CONFIG,
211 FSLDMA_EXTERNAL_START,
212}; 208};
213 209
214/** 210/**
@@ -308,7 +304,9 @@ enum dma_slave_buswidth {
308 * struct dma_slave_config - dma slave channel runtime config 304 * struct dma_slave_config - dma slave channel runtime config
309 * @direction: whether the data shall go in or out on this slave 305 * @direction: whether the data shall go in or out on this slave
310 * channel, right now. DMA_MEM_TO_DEV and DMA_DEV_TO_MEM are 306 * channel, right now. DMA_MEM_TO_DEV and DMA_DEV_TO_MEM are
311 * legal values. 307 * legal values. DEPRECATED, drivers should use the direction argument
308 * to the device_prep_slave_sg and device_prep_dma_cyclic functions or
309 * the dir field in the dma_interleaved_template structure.
312 * @src_addr: this is the physical address where DMA slave data 310 * @src_addr: this is the physical address where DMA slave data
313 * should be read (RX), if the source is memory this argument is 311 * should be read (RX), if the source is memory this argument is
314 * ignored. 312 * ignored.
@@ -671,7 +669,7 @@ struct dma_device {
671 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)( 669 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
672 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, 670 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
673 size_t period_len, enum dma_transfer_direction direction, 671 size_t period_len, enum dma_transfer_direction direction,
674 unsigned long flags, void *context); 672 unsigned long flags);
675 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)( 673 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)(
676 struct dma_chan *chan, struct dma_interleaved_template *xt, 674 struct dma_chan *chan, struct dma_interleaved_template *xt,
677 unsigned long flags); 675 unsigned long flags);
@@ -746,7 +744,7 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic(
746 unsigned long flags) 744 unsigned long flags)
747{ 745{
748 return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len, 746 return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len,
749 period_len, dir, flags, NULL); 747 period_len, dir, flags);
750} 748}
751 749
752static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma( 750static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma(
@@ -756,6 +754,16 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma(
756 return chan->device->device_prep_interleaved_dma(chan, xt, flags); 754 return chan->device->device_prep_interleaved_dma(chan, xt, flags);
757} 755}
758 756
757static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_sg(
758 struct dma_chan *chan,
759 struct scatterlist *dst_sg, unsigned int dst_nents,
760 struct scatterlist *src_sg, unsigned int src_nents,
761 unsigned long flags)
762{
763 return chan->device->device_prep_dma_sg(chan, dst_sg, dst_nents,
764 src_sg, src_nents, flags);
765}
766
759static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps) 767static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
760{ 768{
761 if (!chan || !caps) 769 if (!chan || !caps)
@@ -901,18 +909,6 @@ static inline void dmaengine_put(void)
901} 909}
902#endif 910#endif
903 911
904#ifdef CONFIG_NET_DMA
905#define net_dmaengine_get() dmaengine_get()
906#define net_dmaengine_put() dmaengine_put()
907#else
908static inline void net_dmaengine_get(void)
909{
910}
911static inline void net_dmaengine_put(void)
912{
913}
914#endif
915
916#ifdef CONFIG_ASYNC_TX_DMA 912#ifdef CONFIG_ASYNC_TX_DMA
917#define async_dmaengine_get() dmaengine_get() 913#define async_dmaengine_get() dmaengine_get()
918#define async_dmaengine_put() dmaengine_put() 914#define async_dmaengine_put() dmaengine_put()
@@ -934,16 +930,8 @@ async_dma_find_channel(enum dma_transaction_type type)
934 return NULL; 930 return NULL;
935} 931}
936#endif /* CONFIG_ASYNC_TX_DMA */ 932#endif /* CONFIG_ASYNC_TX_DMA */
937
938dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
939 void *dest, void *src, size_t len);
940dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
941 struct page *page, unsigned int offset, void *kdata, size_t len);
942dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan,
943 struct page *dest_pg, unsigned int dest_off, struct page *src_pg,
944 unsigned int src_off, size_t len);
945void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx, 933void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx,
946 struct dma_chan *chan); 934 struct dma_chan *chan);
947 935
948static inline void async_tx_ack(struct dma_async_tx_descriptor *tx) 936static inline void async_tx_ack(struct dma_async_tx_descriptor *tx)
949{ 937{
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 1deece46a0ca..593fff99e6bf 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -56,13 +56,19 @@ struct dmar_drhd_unit {
56 struct intel_iommu *iommu; 56 struct intel_iommu *iommu;
57}; 57};
58 58
59struct dmar_pci_path {
60 u8 bus;
61 u8 device;
62 u8 function;
63};
64
59struct dmar_pci_notify_info { 65struct dmar_pci_notify_info {
60 struct pci_dev *dev; 66 struct pci_dev *dev;
61 unsigned long event; 67 unsigned long event;
62 int bus; 68 int bus;
63 u16 seg; 69 u16 seg;
64 u16 level; 70 u16 level;
65 struct acpi_dmar_pci_path path[]; 71 struct dmar_pci_path path[];
66} __attribute__((packed)); 72} __attribute__((packed));
67 73
68extern struct rw_semaphore dmar_global_lock; 74extern struct rw_semaphore dmar_global_lock;
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 3dbe9bd57a09..debb70d40547 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -52,7 +52,7 @@
52#endif 52#endif
53 53
54extern const char *drbd_buildtag(void); 54extern const char *drbd_buildtag(void);
55#define REL_VERSION "8.4.3" 55#define REL_VERSION "8.4.5"
56#define API_VERSION 1 56#define API_VERSION 1
57#define PRO_VERSION_MIN 86 57#define PRO_VERSION_MIN 86
58#define PRO_VERSION_MAX 101 58#define PRO_VERSION_MAX 101
@@ -245,7 +245,7 @@ enum drbd_disk_state {
245 D_DISKLESS, 245 D_DISKLESS,
246 D_ATTACHING, /* In the process of reading the meta-data */ 246 D_ATTACHING, /* In the process of reading the meta-data */
247 D_FAILED, /* Becomes D_DISKLESS as soon as we told it the peer */ 247 D_FAILED, /* Becomes D_DISKLESS as soon as we told it the peer */
248 /* when >= D_FAILED it is legal to access mdev->bc */ 248 /* when >= D_FAILED it is legal to access mdev->ldev */
249 D_NEGOTIATING, /* Late attaching state, we need to talk to the peer */ 249 D_NEGOTIATING, /* Late attaching state, we need to talk to the peer */
250 D_INCONSISTENT, 250 D_INCONSISTENT,
251 D_OUTDATED, 251 D_OUTDATED,
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
index 4193f5f2636c..7b131ed8f9c6 100644
--- a/include/linux/drbd_genl.h
+++ b/include/linux/drbd_genl.h
@@ -171,6 +171,10 @@ GENL_struct(DRBD_NLA_NET_CONF, 5, net_conf,
171 __flg_field(28, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, tentative) 171 __flg_field(28, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, tentative)
172 __flg_field_def(29, DRBD_GENLA_F_MANDATORY, use_rle, DRBD_USE_RLE_DEF) 172 __flg_field_def(29, DRBD_GENLA_F_MANDATORY, use_rle, DRBD_USE_RLE_DEF)
173 /* 9: __u32_field_def(30, DRBD_GENLA_F_MANDATORY, fencing_policy, DRBD_FENCING_DEF) */ 173 /* 9: __u32_field_def(30, DRBD_GENLA_F_MANDATORY, fencing_policy, DRBD_FENCING_DEF) */
174 /* 9: __str_field_def(31, DRBD_GENLA_F_MANDATORY, name, SHARED_SECRET_MAX) */
175 /* 9: __u32_field(32, DRBD_F_REQUIRED | DRBD_F_INVARIANT, peer_node_id) */
176 __flg_field_def(33, 0 /* OPTIONAL */, csums_after_crash_only, DRBD_CSUMS_AFTER_CRASH_ONLY_DEF)
177 __u32_field_def(34, 0 /* OPTIONAL */, sock_check_timeo, DRBD_SOCKET_CHECK_TIMEO_DEF)
174) 178)
175 179
176GENL_struct(DRBD_NLA_SET_ROLE_PARMS, 6, set_role_parms, 180GENL_struct(DRBD_NLA_SET_ROLE_PARMS, 6, set_role_parms,
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 17e50bb00521..8ac8c5d9a3ad 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -214,6 +214,7 @@
214#define DRBD_ALLOW_TWO_PRIMARIES_DEF 0 214#define DRBD_ALLOW_TWO_PRIMARIES_DEF 0
215#define DRBD_ALWAYS_ASBP_DEF 0 215#define DRBD_ALWAYS_ASBP_DEF 0
216#define DRBD_USE_RLE_DEF 1 216#define DRBD_USE_RLE_DEF 1
217#define DRBD_CSUMS_AFTER_CRASH_ONLY_DEF 0
217 218
218#define DRBD_AL_STRIPES_MIN 1 219#define DRBD_AL_STRIPES_MIN 1
219#define DRBD_AL_STRIPES_MAX 1024 220#define DRBD_AL_STRIPES_MAX 1024
@@ -224,4 +225,9 @@
224#define DRBD_AL_STRIPE_SIZE_MAX 16777216 225#define DRBD_AL_STRIPE_SIZE_MAX 16777216
225#define DRBD_AL_STRIPE_SIZE_DEF 32 226#define DRBD_AL_STRIPE_SIZE_DEF 32
226#define DRBD_AL_STRIPE_SIZE_SCALE 'k' /* kilobytes */ 227#define DRBD_AL_STRIPE_SIZE_SCALE 'k' /* kilobytes */
228
229#define DRBD_SOCKET_CHECK_TIMEO_MIN 0
230#define DRBD_SOCKET_CHECK_TIMEO_MAX DRBD_PING_TIMEO_MAX
231#define DRBD_SOCKET_CHECK_TIMEO_DEF 0
232#define DRBD_SOCKET_CHECK_TIMEO_SCALE '1'
227#endif 233#endif
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
deleted file mode 100644
index 68b4024184de..000000000000
--- a/include/linux/dw_dmac.h
+++ /dev/null
@@ -1,111 +0,0 @@
1/*
2 * Driver for the Synopsys DesignWare DMA Controller
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 * Copyright (C) 2010-2011 ST Microelectronics
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef DW_DMAC_H
12#define DW_DMAC_H
13
14#include <linux/dmaengine.h>
15
16/**
17 * struct dw_dma_slave - Controller-specific information about a slave
18 *
19 * @dma_dev: required DMA master device. Depricated.
20 * @bus_id: name of this device channel, not just a device name since
21 * devices may have more than one channel e.g. "foo_tx"
22 * @cfg_hi: Platform-specific initializer for the CFG_HI register
23 * @cfg_lo: Platform-specific initializer for the CFG_LO register
24 * @src_master: src master for transfers on allocated channel.
25 * @dst_master: dest master for transfers on allocated channel.
26 */
27struct dw_dma_slave {
28 struct device *dma_dev;
29 u32 cfg_hi;
30 u32 cfg_lo;
31 u8 src_master;
32 u8 dst_master;
33};
34
35/**
36 * struct dw_dma_platform_data - Controller configuration parameters
37 * @nr_channels: Number of channels supported by hardware (max 8)
38 * @is_private: The device channels should be marked as private and not for
39 * by the general purpose DMA channel allocator.
40 * @chan_allocation_order: Allocate channels starting from 0 or 7
41 * @chan_priority: Set channel priority increasing from 0 to 7 or 7 to 0.
42 * @block_size: Maximum block size supported by the controller
43 * @nr_masters: Number of AHB masters supported by the controller
44 * @data_width: Maximum data width supported by hardware per AHB master
45 * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
46 */
47struct dw_dma_platform_data {
48 unsigned int nr_channels;
49 bool is_private;
50#define CHAN_ALLOCATION_ASCENDING 0 /* zero to seven */
51#define CHAN_ALLOCATION_DESCENDING 1 /* seven to zero */
52 unsigned char chan_allocation_order;
53#define CHAN_PRIORITY_ASCENDING 0 /* chan0 highest */
54#define CHAN_PRIORITY_DESCENDING 1 /* chan7 highest */
55 unsigned char chan_priority;
56 unsigned short block_size;
57 unsigned char nr_masters;
58 unsigned char data_width[4];
59};
60
61/* bursts size */
62enum dw_dma_msize {
63 DW_DMA_MSIZE_1,
64 DW_DMA_MSIZE_4,
65 DW_DMA_MSIZE_8,
66 DW_DMA_MSIZE_16,
67 DW_DMA_MSIZE_32,
68 DW_DMA_MSIZE_64,
69 DW_DMA_MSIZE_128,
70 DW_DMA_MSIZE_256,
71};
72
73/* Platform-configurable bits in CFG_HI */
74#define DWC_CFGH_FCMODE (1 << 0)
75#define DWC_CFGH_FIFO_MODE (1 << 1)
76#define DWC_CFGH_PROTCTL(x) ((x) << 2)
77#define DWC_CFGH_SRC_PER(x) ((x) << 7)
78#define DWC_CFGH_DST_PER(x) ((x) << 11)
79
80/* Platform-configurable bits in CFG_LO */
81#define DWC_CFGL_LOCK_CH_XFER (0 << 12) /* scope of LOCK_CH */
82#define DWC_CFGL_LOCK_CH_BLOCK (1 << 12)
83#define DWC_CFGL_LOCK_CH_XACT (2 << 12)
84#define DWC_CFGL_LOCK_BUS_XFER (0 << 14) /* scope of LOCK_BUS */
85#define DWC_CFGL_LOCK_BUS_BLOCK (1 << 14)
86#define DWC_CFGL_LOCK_BUS_XACT (2 << 14)
87#define DWC_CFGL_LOCK_CH (1 << 15) /* channel lockout */
88#define DWC_CFGL_LOCK_BUS (1 << 16) /* busmaster lockout */
89#define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */
90#define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */
91
92/* DMA API extensions */
93struct dw_cyclic_desc {
94 struct dw_desc **desc;
95 unsigned long periods;
96 void (*period_callback)(void *param);
97 void *period_callback_param;
98};
99
100struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
101 dma_addr_t buf_addr, size_t buf_len, size_t period_len,
102 enum dma_transfer_direction direction);
103void dw_dma_cyclic_free(struct dma_chan *chan);
104int dw_dma_cyclic_start(struct dma_chan *chan);
105void dw_dma_cyclic_stop(struct dma_chan *chan);
106
107dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan);
108
109dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan);
110
111#endif /* DW_DMAC_H */
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 2fe93b26b42f..4f1bbc68cd1b 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -42,7 +42,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
42#if defined(CONFIG_DYNAMIC_DEBUG) 42#if defined(CONFIG_DYNAMIC_DEBUG)
43extern int ddebug_remove_module(const char *mod_name); 43extern int ddebug_remove_module(const char *mod_name);
44extern __printf(2, 3) 44extern __printf(2, 3)
45int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...); 45void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...);
46 46
47extern int ddebug_dyndbg_module_param_cb(char *param, char *val, 47extern int ddebug_dyndbg_module_param_cb(char *param, char *val,
48 const char *modname); 48 const char *modname);
@@ -50,15 +50,15 @@ extern int ddebug_dyndbg_module_param_cb(char *param, char *val,
50struct device; 50struct device;
51 51
52extern __printf(3, 4) 52extern __printf(3, 4)
53int __dynamic_dev_dbg(struct _ddebug *descriptor, const struct device *dev, 53void __dynamic_dev_dbg(struct _ddebug *descriptor, const struct device *dev,
54 const char *fmt, ...); 54 const char *fmt, ...);
55 55
56struct net_device; 56struct net_device;
57 57
58extern __printf(3, 4) 58extern __printf(3, 4)
59int __dynamic_netdev_dbg(struct _ddebug *descriptor, 59void __dynamic_netdev_dbg(struct _ddebug *descriptor,
60 const struct net_device *dev, 60 const struct net_device *dev,
61 const char *fmt, ...); 61 const char *fmt, ...);
62 62
63#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ 63#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
64 static struct _ddebug __aligned(8) \ 64 static struct _ddebug __aligned(8) \
diff --git a/include/linux/dynamic_queue_limits.h b/include/linux/dynamic_queue_limits.h
index 5621547d631b..a4be70398ce1 100644
--- a/include/linux/dynamic_queue_limits.h
+++ b/include/linux/dynamic_queue_limits.h
@@ -73,14 +73,22 @@ static inline void dql_queued(struct dql *dql, unsigned int count)
73{ 73{
74 BUG_ON(count > DQL_MAX_OBJECT); 74 BUG_ON(count > DQL_MAX_OBJECT);
75 75
76 dql->num_queued += count;
77 dql->last_obj_cnt = count; 76 dql->last_obj_cnt = count;
77
78 /* We want to force a write first, so that cpu do not attempt
79 * to get cache line containing last_obj_cnt, num_queued, adj_limit
80 * in Shared state, but directly does a Request For Ownership
81 * It is only a hint, we use barrier() only.
82 */
83 barrier();
84
85 dql->num_queued += count;
78} 86}
79 87
80/* Returns how many objects can be queued, < 0 indicates over limit. */ 88/* Returns how many objects can be queued, < 0 indicates over limit. */
81static inline int dql_avail(const struct dql *dql) 89static inline int dql_avail(const struct dql *dql)
82{ 90{
83 return dql->adj_limit - dql->num_queued; 91 return ACCESS_ONCE(dql->adj_limit) - ACCESS_ONCE(dql->num_queued);
84} 92}
85 93
86/* Record number of completed objects and recalculate the limit. */ 94/* Record number of completed objects and recalculate the limit. */
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 8e6c20af11a2..e1e68da6f35c 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -194,6 +194,9 @@ static inline char *mc_event_error_type(const unsigned int err_type)
194 * @MEM_DDR3: DDR3 RAM 194 * @MEM_DDR3: DDR3 RAM
195 * @MEM_RDDR3: Registered DDR3 RAM 195 * @MEM_RDDR3: Registered DDR3 RAM
196 * This is a variant of the DDR3 memories. 196 * This is a variant of the DDR3 memories.
197 * @MEM_DDR4: DDR4 RAM
198 * @MEM_RDDR4: Registered DDR4 RAM
199 * This is a variant of the DDR4 memories.
197 */ 200 */
198enum mem_type { 201enum mem_type {
199 MEM_EMPTY = 0, 202 MEM_EMPTY = 0,
@@ -213,6 +216,8 @@ enum mem_type {
213 MEM_XDR, 216 MEM_XDR,
214 MEM_DDR3, 217 MEM_DDR3,
215 MEM_RDDR3, 218 MEM_RDDR3,
219 MEM_DDR4,
220 MEM_RDDR4,
216}; 221};
217 222
218#define MEM_FLAG_EMPTY BIT(MEM_EMPTY) 223#define MEM_FLAG_EMPTY BIT(MEM_EMPTY)
diff --git a/include/linux/efi.h b/include/linux/efi.h
index efc681fd5895..0949f9c7e872 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -92,6 +92,7 @@ typedef struct {
92#define EFI_MEMORY_WC ((u64)0x0000000000000002ULL) /* write-coalescing */ 92#define EFI_MEMORY_WC ((u64)0x0000000000000002ULL) /* write-coalescing */
93#define EFI_MEMORY_WT ((u64)0x0000000000000004ULL) /* write-through */ 93#define EFI_MEMORY_WT ((u64)0x0000000000000004ULL) /* write-through */
94#define EFI_MEMORY_WB ((u64)0x0000000000000008ULL) /* write-back */ 94#define EFI_MEMORY_WB ((u64)0x0000000000000008ULL) /* write-back */
95#define EFI_MEMORY_UCE ((u64)0x0000000000000010ULL) /* uncached, exported */
95#define EFI_MEMORY_WP ((u64)0x0000000000001000ULL) /* write-protect */ 96#define EFI_MEMORY_WP ((u64)0x0000000000001000ULL) /* write-protect */
96#define EFI_MEMORY_RP ((u64)0x0000000000002000ULL) /* read-protect */ 97#define EFI_MEMORY_RP ((u64)0x0000000000002000ULL) /* read-protect */
97#define EFI_MEMORY_XP ((u64)0x0000000000004000ULL) /* execute-protect */ 98#define EFI_MEMORY_XP ((u64)0x0000000000004000ULL) /* execute-protect */
@@ -502,6 +503,10 @@ typedef efi_status_t efi_get_next_variable_t (unsigned long *name_size, efi_char
502typedef efi_status_t efi_set_variable_t (efi_char16_t *name, efi_guid_t *vendor, 503typedef efi_status_t efi_set_variable_t (efi_char16_t *name, efi_guid_t *vendor,
503 u32 attr, unsigned long data_size, 504 u32 attr, unsigned long data_size,
504 void *data); 505 void *data);
506typedef efi_status_t
507efi_set_variable_nonblocking_t(efi_char16_t *name, efi_guid_t *vendor,
508 u32 attr, unsigned long data_size, void *data);
509
505typedef efi_status_t efi_get_next_high_mono_count_t (u32 *count); 510typedef efi_status_t efi_get_next_high_mono_count_t (u32 *count);
506typedef void efi_reset_system_t (int reset_type, efi_status_t status, 511typedef void efi_reset_system_t (int reset_type, efi_status_t status,
507 unsigned long data_size, efi_char16_t *data); 512 unsigned long data_size, efi_char16_t *data);
@@ -821,6 +826,7 @@ extern struct efi {
821 efi_get_variable_t *get_variable; 826 efi_get_variable_t *get_variable;
822 efi_get_next_variable_t *get_next_variable; 827 efi_get_next_variable_t *get_next_variable;
823 efi_set_variable_t *set_variable; 828 efi_set_variable_t *set_variable;
829 efi_set_variable_nonblocking_t *set_variable_nonblocking;
824 efi_query_variable_info_t *query_variable_info; 830 efi_query_variable_info_t *query_variable_info;
825 efi_update_capsule_t *update_capsule; 831 efi_update_capsule_t *update_capsule;
826 efi_query_capsule_caps_t *query_capsule_caps; 832 efi_query_capsule_caps_t *query_capsule_caps;
@@ -886,6 +892,13 @@ extern bool efi_poweroff_required(void);
886 (md) <= (efi_memory_desc_t *)((m)->map_end - (m)->desc_size); \ 892 (md) <= (efi_memory_desc_t *)((m)->map_end - (m)->desc_size); \
887 (md) = (void *)(md) + (m)->desc_size) 893 (md) = (void *)(md) + (m)->desc_size)
888 894
895/*
896 * Format an EFI memory descriptor's type and attributes to a user-provided
897 * character buffer, as per snprintf(), and return the buffer.
898 */
899char * __init efi_md_typeattr_format(char *buf, size_t size,
900 const efi_memory_desc_t *md);
901
889/** 902/**
890 * efi_range_is_wc - check the WC bit on an address range 903 * efi_range_is_wc - check the WC bit on an address range
891 * @start: starting kvirt address 904 * @start: starting kvirt address
@@ -1034,6 +1047,7 @@ struct efivar_operations {
1034 efi_get_variable_t *get_variable; 1047 efi_get_variable_t *get_variable;
1035 efi_get_next_variable_t *get_next_variable; 1048 efi_get_next_variable_t *get_next_variable;
1036 efi_set_variable_t *set_variable; 1049 efi_set_variable_t *set_variable;
1050 efi_set_variable_nonblocking_t *set_variable_nonblocking;
1037 efi_query_variable_store_t *query_variable_store; 1051 efi_query_variable_store_t *query_variable_store;
1038}; 1052};
1039 1053
@@ -1156,6 +1170,9 @@ int efivars_sysfs_init(void);
1156#ifdef CONFIG_EFI_RUNTIME_MAP 1170#ifdef CONFIG_EFI_RUNTIME_MAP
1157int efi_runtime_map_init(struct kobject *); 1171int efi_runtime_map_init(struct kobject *);
1158void efi_runtime_map_setup(void *, int, u32); 1172void efi_runtime_map_setup(void *, int, u32);
1173int efi_get_runtime_map_size(void);
1174int efi_get_runtime_map_desc_size(void);
1175int efi_runtime_map_copy(void *buf, size_t bufsz);
1159#else 1176#else
1160static inline int efi_runtime_map_init(struct kobject *kobj) 1177static inline int efi_runtime_map_init(struct kobject *kobj)
1161{ 1178{
@@ -1164,6 +1181,22 @@ static inline int efi_runtime_map_init(struct kobject *kobj)
1164 1181
1165static inline void 1182static inline void
1166efi_runtime_map_setup(void *map, int nr_entries, u32 desc_size) {} 1183efi_runtime_map_setup(void *map, int nr_entries, u32 desc_size) {}
1184
1185static inline int efi_get_runtime_map_size(void)
1186{
1187 return 0;
1188}
1189
1190static inline int efi_get_runtime_map_desc_size(void)
1191{
1192 return 0;
1193}
1194
1195static inline int efi_runtime_map_copy(void *buf, size_t bufsz)
1196{
1197 return 0;
1198}
1199
1167#endif 1200#endif
1168 1201
1169/* prototypes shared between arch specific and generic stub code */ 1202/* prototypes shared between arch specific and generic stub code */
@@ -1208,4 +1241,7 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
1208 unsigned long *load_addr, 1241 unsigned long *load_addr,
1209 unsigned long *load_size); 1242 unsigned long *load_size);
1210 1243
1244efi_status_t efi_parse_options(char *cmdline);
1245
1246bool efi_runtime_disabled(void);
1211#endif /* _LINUX_EFI_H */ 1247#endif /* _LINUX_EFI_H */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 9c5529dc6d07..733980fce8e3 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -29,6 +29,7 @@
29#include <asm/bitsperlong.h> 29#include <asm/bitsperlong.h>
30 30
31#ifdef __KERNEL__ 31#ifdef __KERNEL__
32u32 eth_get_headlen(void *data, unsigned int max_len);
32__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); 33__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
33extern const struct header_ops eth_header_ops; 34extern const struct header_ops eth_header_ops;
34 35
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index e658229fee39..c1a2d60dfb82 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -257,6 +257,10 @@ struct ethtool_ops {
257 struct ethtool_eeprom *, u8 *); 257 struct ethtool_eeprom *, u8 *);
258 int (*get_eee)(struct net_device *, struct ethtool_eee *); 258 int (*get_eee)(struct net_device *, struct ethtool_eee *);
259 int (*set_eee)(struct net_device *, struct ethtool_eee *); 259 int (*set_eee)(struct net_device *, struct ethtool_eee *);
260 int (*get_tunable)(struct net_device *,
261 const struct ethtool_tunable *, void *);
262 int (*set_tunable)(struct net_device *,
263 const struct ethtool_tunable *, const void *);
260 264
261 265
262}; 266};
diff --git a/include/linux/extcon/extcon-gpio.h b/include/linux/extcon/extcon-gpio.h
index 8900fdf511c6..0b17ad43fbfc 100644
--- a/include/linux/extcon/extcon-gpio.h
+++ b/include/linux/extcon/extcon-gpio.h
@@ -34,8 +34,10 @@
34 * @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW). 34 * @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW).
35 * @state_on: print_state is overriden with state_on if attached. 35 * @state_on: print_state is overriden with state_on if attached.
36 * If NULL, default method of extcon class is used. 36 * If NULL, default method of extcon class is used.
37 * @state_off: print_state is overriden with state_on if detached. 37 * @state_off: print_state is overriden with state_off if detached.
38 * If NUll, default method of extcon class is used. 38 * If NUll, default method of extcon class is used.
39 * @check_on_resume: Boolean describing whether to check the state of gpio
40 * while resuming from sleep.
39 * 41 *
40 * Note that in order for state_on or state_off to be valid, both state_on 42 * Note that in order for state_on or state_off to be valid, both state_on
41 * and state_off should be not NULL. If at least one of them is NULL, 43 * and state_off should be not NULL. If at least one of them is NULL,
diff --git a/include/linux/extcon/sm5502.h b/include/linux/extcon/sm5502.h
deleted file mode 100644
index 030526bf8d79..000000000000
--- a/include/linux/extcon/sm5502.h
+++ /dev/null
@@ -1,287 +0,0 @@
1/*
2 * sm5502.h
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __LINUX_EXTCON_SM5502_H
18#define __LINUX_EXTCON_SM5502_H
19
20enum sm5502_types {
21 TYPE_SM5502,
22};
23
24/* SM5502 registers */
25enum sm5502_reg {
26 SM5502_REG_DEVICE_ID = 0x01,
27 SM5502_REG_CONTROL,
28 SM5502_REG_INT1,
29 SM5502_REG_INT2,
30 SM5502_REG_INTMASK1,
31 SM5502_REG_INTMASK2,
32 SM5502_REG_ADC,
33 SM5502_REG_TIMING_SET1,
34 SM5502_REG_TIMING_SET2,
35 SM5502_REG_DEV_TYPE1,
36 SM5502_REG_DEV_TYPE2,
37 SM5502_REG_BUTTON1,
38 SM5502_REG_BUTTON2,
39 SM5502_REG_CAR_KIT_STATUS,
40 SM5502_REG_RSVD1,
41 SM5502_REG_RSVD2,
42 SM5502_REG_RSVD3,
43 SM5502_REG_RSVD4,
44 SM5502_REG_MANUAL_SW1,
45 SM5502_REG_MANUAL_SW2,
46 SM5502_REG_DEV_TYPE3,
47 SM5502_REG_RSVD5,
48 SM5502_REG_RSVD6,
49 SM5502_REG_RSVD7,
50 SM5502_REG_RSVD8,
51 SM5502_REG_RSVD9,
52 SM5502_REG_RESET,
53 SM5502_REG_RSVD10,
54 SM5502_REG_RESERVED_ID1,
55 SM5502_REG_RSVD11,
56 SM5502_REG_RSVD12,
57 SM5502_REG_RESERVED_ID2,
58 SM5502_REG_RSVD13,
59 SM5502_REG_OCP,
60 SM5502_REG_RSVD14,
61 SM5502_REG_RSVD15,
62 SM5502_REG_RSVD16,
63 SM5502_REG_RSVD17,
64 SM5502_REG_RSVD18,
65 SM5502_REG_RSVD19,
66 SM5502_REG_RSVD20,
67 SM5502_REG_RSVD21,
68 SM5502_REG_RSVD22,
69 SM5502_REG_RSVD23,
70 SM5502_REG_RSVD24,
71 SM5502_REG_RSVD25,
72 SM5502_REG_RSVD26,
73 SM5502_REG_RSVD27,
74 SM5502_REG_RSVD28,
75 SM5502_REG_RSVD29,
76 SM5502_REG_RSVD30,
77 SM5502_REG_RSVD31,
78 SM5502_REG_RSVD32,
79 SM5502_REG_RSVD33,
80 SM5502_REG_RSVD34,
81 SM5502_REG_RSVD35,
82 SM5502_REG_RSVD36,
83 SM5502_REG_RESERVED_ID3,
84
85 SM5502_REG_END,
86};
87
88/* Define SM5502 MASK/SHIFT constant */
89#define SM5502_REG_DEVICE_ID_VENDOR_SHIFT 0
90#define SM5502_REG_DEVICE_ID_VERSION_SHIFT 3
91#define SM5502_REG_DEVICE_ID_VENDOR_MASK (0x3 << SM5502_REG_DEVICE_ID_VENDOR_SHIFT)
92#define SM5502_REG_DEVICE_ID_VERSION_MASK (0x1f << SM5502_REG_DEVICE_ID_VERSION_SHIFT)
93
94#define SM5502_REG_CONTROL_MASK_INT_SHIFT 0
95#define SM5502_REG_CONTROL_WAIT_SHIFT 1
96#define SM5502_REG_CONTROL_MANUAL_SW_SHIFT 2
97#define SM5502_REG_CONTROL_RAW_DATA_SHIFT 3
98#define SM5502_REG_CONTROL_SW_OPEN_SHIFT 4
99#define SM5502_REG_CONTROL_MASK_INT_MASK (0x1 << SM5502_REG_CONTROL_MASK_INT_SHIFT)
100#define SM5502_REG_CONTROL_WAIT_MASK (0x1 << SM5502_REG_CONTROL_WAIT_SHIFT)
101#define SM5502_REG_CONTROL_MANUAL_SW_MASK (0x1 << SM5502_REG_CONTROL_MANUAL_SW_SHIFT)
102#define SM5502_REG_CONTROL_RAW_DATA_MASK (0x1 << SM5502_REG_CONTROL_RAW_DATA_SHIFT)
103#define SM5502_REG_CONTROL_SW_OPEN_MASK (0x1 << SM5502_REG_CONTROL_SW_OPEN_SHIFT)
104
105#define SM5502_REG_INTM1_ATTACH_SHIFT 0
106#define SM5502_REG_INTM1_DETACH_SHIFT 1
107#define SM5502_REG_INTM1_KP_SHIFT 2
108#define SM5502_REG_INTM1_LKP_SHIFT 3
109#define SM5502_REG_INTM1_LKR_SHIFT 4
110#define SM5502_REG_INTM1_OVP_EVENT_SHIFT 5
111#define SM5502_REG_INTM1_OCP_EVENT_SHIFT 6
112#define SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT 7
113#define SM5502_REG_INTM1_ATTACH_MASK (0x1 << SM5502_REG_INTM1_ATTACH_SHIFT)
114#define SM5502_REG_INTM1_DETACH_MASK (0x1 << SM5502_REG_INTM1_DETACH_SHIFT)
115#define SM5502_REG_INTM1_KP_MASK (0x1 << SM5502_REG_INTM1_KP_SHIFT)
116#define SM5502_REG_INTM1_LKP_MASK (0x1 << SM5502_REG_INTM1_LKP_SHIFT)
117#define SM5502_REG_INTM1_LKR_MASK (0x1 << SM5502_REG_INTM1_LKR_SHIFT)
118#define SM5502_REG_INTM1_OVP_EVENT_MASK (0x1 << SM5502_REG_INTM1_OVP_EVENT_SHIFT)
119#define SM5502_REG_INTM1_OCP_EVENT_MASK (0x1 << SM5502_REG_INTM1_OCP_EVENT_SHIFT)
120#define SM5502_REG_INTM1_OVP_OCP_DIS_MASK (0x1 << SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT)
121
122#define SM5502_REG_INTM2_VBUS_DET_SHIFT 0
123#define SM5502_REG_INTM2_REV_ACCE_SHIFT 1
124#define SM5502_REG_INTM2_ADC_CHG_SHIFT 2
125#define SM5502_REG_INTM2_STUCK_KEY_SHIFT 3
126#define SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT 4
127#define SM5502_REG_INTM2_MHL_SHIFT 5
128#define SM5502_REG_INTM2_VBUS_DET_MASK (0x1 << SM5502_REG_INTM2_VBUS_DET_SHIFT)
129#define SM5502_REG_INTM2_REV_ACCE_MASK (0x1 << SM5502_REG_INTM2_REV_ACCE_SHIFT)
130#define SM5502_REG_INTM2_ADC_CHG_MASK (0x1 << SM5502_REG_INTM2_ADC_CHG_SHIFT)
131#define SM5502_REG_INTM2_STUCK_KEY_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_SHIFT)
132#define SM5502_REG_INTM2_STUCK_KEY_RCV_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT)
133#define SM5502_REG_INTM2_MHL_MASK (0x1 << SM5502_REG_INTM2_MHL_SHIFT)
134
135#define SM5502_REG_ADC_SHIFT 0
136#define SM5502_REG_ADC_MASK (0x1f << SM5502_REG_ADC_SHIFT)
137
138#define SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT 4
139#define SM5502_REG_TIMING_SET1_KEY_PRESS_MASK (0xf << SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT)
140#define TIMING_KEY_PRESS_100MS 0x0
141#define TIMING_KEY_PRESS_200MS 0x1
142#define TIMING_KEY_PRESS_300MS 0x2
143#define TIMING_KEY_PRESS_400MS 0x3
144#define TIMING_KEY_PRESS_500MS 0x4
145#define TIMING_KEY_PRESS_600MS 0x5
146#define TIMING_KEY_PRESS_700MS 0x6
147#define TIMING_KEY_PRESS_800MS 0x7
148#define TIMING_KEY_PRESS_900MS 0x8
149#define TIMING_KEY_PRESS_1000MS 0x9
150#define SM5502_REG_TIMING_SET1_ADC_DET_SHIFT 0
151#define SM5502_REG_TIMING_SET1_ADC_DET_MASK (0xf << SM5502_REG_TIMING_SET1_ADC_DET_SHIFT)
152#define TIMING_ADC_DET_50MS 0x0
153#define TIMING_ADC_DET_100MS 0x1
154#define TIMING_ADC_DET_150MS 0x2
155#define TIMING_ADC_DET_200MS 0x3
156#define TIMING_ADC_DET_300MS 0x4
157#define TIMING_ADC_DET_400MS 0x5
158#define TIMING_ADC_DET_500MS 0x6
159#define TIMING_ADC_DET_600MS 0x7
160#define TIMING_ADC_DET_700MS 0x8
161#define TIMING_ADC_DET_800MS 0x9
162#define TIMING_ADC_DET_900MS 0xA
163#define TIMING_ADC_DET_1000MS 0xB
164
165#define SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT 4
166#define SM5502_REG_TIMING_SET2_SW_WAIT_MASK (0xf << SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT)
167#define TIMING_SW_WAIT_10MS 0x0
168#define TIMING_SW_WAIT_30MS 0x1
169#define TIMING_SW_WAIT_50MS 0x2
170#define TIMING_SW_WAIT_70MS 0x3
171#define TIMING_SW_WAIT_90MS 0x4
172#define TIMING_SW_WAIT_110MS 0x5
173#define TIMING_SW_WAIT_130MS 0x6
174#define TIMING_SW_WAIT_150MS 0x7
175#define TIMING_SW_WAIT_170MS 0x8
176#define TIMING_SW_WAIT_190MS 0x9
177#define TIMING_SW_WAIT_210MS 0xA
178#define SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT 0
179#define SM5502_REG_TIMING_SET2_LONG_KEY_MASK (0xf << SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT)
180#define TIMING_LONG_KEY_300MS 0x0
181#define TIMING_LONG_KEY_400MS 0x1
182#define TIMING_LONG_KEY_500MS 0x2
183#define TIMING_LONG_KEY_600MS 0x3
184#define TIMING_LONG_KEY_700MS 0x4
185#define TIMING_LONG_KEY_800MS 0x5
186#define TIMING_LONG_KEY_900MS 0x6
187#define TIMING_LONG_KEY_1000MS 0x7
188#define TIMING_LONG_KEY_1100MS 0x8
189#define TIMING_LONG_KEY_1200MS 0x9
190#define TIMING_LONG_KEY_1300MS 0xA
191#define TIMING_LONG_KEY_1400MS 0xB
192#define TIMING_LONG_KEY_1500MS 0xC
193
194#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT 0
195#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT 1
196#define SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT 2
197#define SM5502_REG_DEV_TYPE1_UART_SHIFT 3
198#define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT 4
199#define SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT 5
200#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT 6
201#define SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT 7
202#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_MASK (0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT)
203#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1__MASK (0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT)
204#define SM5502_REG_DEV_TYPE1_USB_SDP_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT)
205#define SM5502_REG_DEV_TYPE1_UART_MASK (0x1 << SM5502_REG_DEV_TYPE1_UART_SHIFT)
206#define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_MASK (0x1 << SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT)
207#define SM5502_REG_DEV_TYPE1_USB_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT)
208#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT)
209#define SM5502_REG_DEV_TYPE1_USB_OTG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT)
210
211#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT 0
212#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT 1
213#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT 2
214#define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT 3
215#define SM5502_REG_DEV_TYPE2_PPD_SHIFT 4
216#define SM5502_REG_DEV_TYPE2_TTY_SHIFT 5
217#define SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT 6
218#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT)
219#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT)
220#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT)
221#define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT)
222#define SM5502_REG_DEV_TYPE2_PPD_MASK (0x1 << SM5502_REG_DEV_TYPE2_PPD_SHIFT)
223#define SM5502_REG_DEV_TYPE2_TTY_MASK (0x1 << SM5502_REG_DEV_TYPE2_TTY_SHIFT)
224#define SM5502_REG_DEV_TYPE2_AV_CABLE_MASK (0x1 << SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT)
225
226#define SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT 0
227#define SM5502_REG_MANUAL_SW1_DP_SHIFT 2
228#define SM5502_REG_MANUAL_SW1_DM_SHIFT 5
229#define SM5502_REG_MANUAL_SW1_VBUSIN_MASK (0x3 << SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT)
230#define SM5502_REG_MANUAL_SW1_DP_MASK (0x7 << SM5502_REG_MANUAL_SW1_DP_SHIFT)
231#define SM5502_REG_MANUAL_SW1_DM_MASK (0x7 << SM5502_REG_MANUAL_SW1_DM_SHIFT)
232#define VBUSIN_SWITCH_OPEN 0x0
233#define VBUSIN_SWITCH_VBUSOUT 0x1
234#define VBUSIN_SWITCH_MIC 0x2
235#define VBUSIN_SWITCH_VBUSOUT_WITH_USB 0x3
236#define DM_DP_CON_SWITCH_OPEN 0x0
237#define DM_DP_CON_SWITCH_USB 0x1
238#define DM_DP_CON_SWITCH_AUDIO 0x2
239#define DM_DP_CON_SWITCH_UART 0x3
240#define DM_DP_SWITCH_OPEN ((DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
241 | (DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
242#define DM_DP_SWITCH_USB ((DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
243 | (DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
244#define DM_DP_SWITCH_AUDIO ((DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
245 | (DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
246#define DM_DP_SWITCH_UART ((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
247 | (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
248
249/* SM5502 Interrupts */
250enum sm5502_irq {
251 /* INT1 */
252 SM5502_IRQ_INT1_ATTACH,
253 SM5502_IRQ_INT1_DETACH,
254 SM5502_IRQ_INT1_KP,
255 SM5502_IRQ_INT1_LKP,
256 SM5502_IRQ_INT1_LKR,
257 SM5502_IRQ_INT1_OVP_EVENT,
258 SM5502_IRQ_INT1_OCP_EVENT,
259 SM5502_IRQ_INT1_OVP_OCP_DIS,
260
261 /* INT2 */
262 SM5502_IRQ_INT2_VBUS_DET,
263 SM5502_IRQ_INT2_REV_ACCE,
264 SM5502_IRQ_INT2_ADC_CHG,
265 SM5502_IRQ_INT2_STUCK_KEY,
266 SM5502_IRQ_INT2_STUCK_KEY_RCV,
267 SM5502_IRQ_INT2_MHL,
268
269 SM5502_IRQ_NUM,
270};
271
272#define SM5502_IRQ_INT1_ATTACH_MASK BIT(0)
273#define SM5502_IRQ_INT1_DETACH_MASK BIT(1)
274#define SM5502_IRQ_INT1_KP_MASK BIT(2)
275#define SM5502_IRQ_INT1_LKP_MASK BIT(3)
276#define SM5502_IRQ_INT1_LKR_MASK BIT(4)
277#define SM5502_IRQ_INT1_OVP_EVENT_MASK BIT(5)
278#define SM5502_IRQ_INT1_OCP_EVENT_MASK BIT(6)
279#define SM5502_IRQ_INT1_OVP_OCP_DIS_MASK BIT(7)
280#define SM5502_IRQ_INT2_VBUS_DET_MASK BIT(0)
281#define SM5502_IRQ_INT2_REV_ACCE_MASK BIT(1)
282#define SM5502_IRQ_INT2_ADC_CHG_MASK BIT(2)
283#define SM5502_IRQ_INT2_STUCK_KEY_MASK BIT(3)
284#define SM5502_IRQ_INT2_STUCK_KEY_RCV_MASK BIT(4)
285#define SM5502_IRQ_INT2_MHL_MASK BIT(5)
286
287#endif /* __LINUX_EXTCON_SM5502_H */
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index 6ff0b0b42d47..860313a33a43 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -15,8 +15,9 @@
15#include <linux/types.h> 15#include <linux/types.h>
16 16
17#define F2FS_SUPER_OFFSET 1024 /* byte-size offset */ 17#define F2FS_SUPER_OFFSET 1024 /* byte-size offset */
18#define F2FS_LOG_SECTOR_SIZE 9 /* 9 bits for 512 byte */ 18#define F2FS_MIN_LOG_SECTOR_SIZE 9 /* 9 bits for 512 bytes */
19#define F2FS_LOG_SECTORS_PER_BLOCK 3 /* 4KB: F2FS_BLKSIZE */ 19#define F2FS_MAX_LOG_SECTOR_SIZE 12 /* 12 bits for 4096 bytes */
20#define F2FS_LOG_SECTORS_PER_BLOCK 3 /* log number for sector/blk */
20#define F2FS_BLKSIZE 4096 /* support only 4KB block */ 21#define F2FS_BLKSIZE 4096 /* support only 4KB block */
21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */ 22#define F2FS_MAX_EXTENSION 64 /* # of extension entries */
22#define F2FS_BLK_ALIGN(x) (((x) + F2FS_BLKSIZE - 1) / F2FS_BLKSIZE) 23#define F2FS_BLK_ALIGN(x) (((x) + F2FS_BLKSIZE - 1) / F2FS_BLKSIZE)
@@ -24,6 +25,9 @@
24#define NULL_ADDR ((block_t)0) /* used as block_t addresses */ 25#define NULL_ADDR ((block_t)0) /* used as block_t addresses */
25#define NEW_ADDR ((block_t)-1) /* used as block_t addresses */ 26#define NEW_ADDR ((block_t)-1) /* used as block_t addresses */
26 27
28/* 0, 1(node nid), 2(meta nid) are reserved node id */
29#define F2FS_RESERVED_NODE_NUM 3
30
27#define F2FS_ROOT_INO(sbi) (sbi->root_ino_num) 31#define F2FS_ROOT_INO(sbi) (sbi->root_ino_num)
28#define F2FS_NODE_INO(sbi) (sbi->node_ino_num) 32#define F2FS_NODE_INO(sbi) (sbi->node_ino_num)
29#define F2FS_META_INO(sbi) (sbi->meta_ino_num) 33#define F2FS_META_INO(sbi) (sbi->meta_ino_num)
@@ -82,11 +86,14 @@ struct f2fs_super_block {
82/* 86/*
83 * For checkpoint 87 * For checkpoint
84 */ 88 */
89#define CP_FSCK_FLAG 0x00000010
85#define CP_ERROR_FLAG 0x00000008 90#define CP_ERROR_FLAG 0x00000008
86#define CP_COMPACT_SUM_FLAG 0x00000004 91#define CP_COMPACT_SUM_FLAG 0x00000004
87#define CP_ORPHAN_PRESENT_FLAG 0x00000002 92#define CP_ORPHAN_PRESENT_FLAG 0x00000002
88#define CP_UMOUNT_FLAG 0x00000001 93#define CP_UMOUNT_FLAG 0x00000001
89 94
95#define F2FS_CP_PACKS 2 /* # of checkpoint packs */
96
90struct f2fs_checkpoint { 97struct f2fs_checkpoint {
91 __le64 checkpoint_ver; /* checkpoint block version number */ 98 __le64 checkpoint_ver; /* checkpoint block version number */
92 __le64 user_block_count; /* # of user blocks */ 99 __le64 user_block_count; /* # of user blocks */
@@ -123,6 +130,9 @@ struct f2fs_checkpoint {
123 */ 130 */
124#define F2FS_ORPHANS_PER_BLOCK 1020 131#define F2FS_ORPHANS_PER_BLOCK 1020
125 132
133#define GET_ORPHAN_BLOCKS(n) ((n + F2FS_ORPHANS_PER_BLOCK - 1) / \
134 F2FS_ORPHANS_PER_BLOCK)
135
126struct f2fs_orphan_block { 136struct f2fs_orphan_block {
127 __le32 ino[F2FS_ORPHANS_PER_BLOCK]; /* inode numbers */ 137 __le32 ino[F2FS_ORPHANS_PER_BLOCK]; /* inode numbers */
128 __le32 reserved; /* reserved */ 138 __le32 reserved; /* reserved */
@@ -144,6 +154,7 @@ struct f2fs_extent {
144#define F2FS_NAME_LEN 255 154#define F2FS_NAME_LEN 255
145#define F2FS_INLINE_XATTR_ADDRS 50 /* 200 bytes for inline xattrs */ 155#define F2FS_INLINE_XATTR_ADDRS 50 /* 200 bytes for inline xattrs */
146#define DEF_ADDRS_PER_INODE 923 /* Address Pointers in an Inode */ 156#define DEF_ADDRS_PER_INODE 923 /* Address Pointers in an Inode */
157#define DEF_NIDS_PER_INODE 5 /* Node IDs in an Inode */
147#define ADDRS_PER_INODE(fi) addrs_per_inode(fi) 158#define ADDRS_PER_INODE(fi) addrs_per_inode(fi)
148#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ 159#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */
149#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */ 160#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */
@@ -163,8 +174,9 @@ struct f2fs_extent {
163#define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \ 174#define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \
164 F2FS_INLINE_XATTR_ADDRS - 1)) 175 F2FS_INLINE_XATTR_ADDRS - 1))
165 176
166#define INLINE_DATA_OFFSET (PAGE_CACHE_SIZE - sizeof(struct node_footer) \ 177#define INLINE_DATA_OFFSET (PAGE_CACHE_SIZE - sizeof(struct node_footer) -\
167 - sizeof(__le32) * (DEF_ADDRS_PER_INODE + 5 - 1)) 178 sizeof(__le32) * (DEF_ADDRS_PER_INODE + \
179 DEF_NIDS_PER_INODE - 1))
168 180
169struct f2fs_inode { 181struct f2fs_inode {
170 __le16 i_mode; /* file mode */ 182 __le16 i_mode; /* file mode */
@@ -194,7 +206,7 @@ struct f2fs_inode {
194 206
195 __le32 i_addr[DEF_ADDRS_PER_INODE]; /* Pointers to data blocks */ 207 __le32 i_addr[DEF_ADDRS_PER_INODE]; /* Pointers to data blocks */
196 208
197 __le32 i_nid[5]; /* direct(2), indirect(2), 209 __le32 i_nid[DEF_NIDS_PER_INODE]; /* direct(2), indirect(2),
198 double_indirect(1) node id */ 210 double_indirect(1) node id */
199} __packed; 211} __packed;
200 212
diff --git a/include/linux/fb.h b/include/linux/fb.h
index b6bfda99add3..09bb7a18d287 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -553,7 +553,7 @@ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
553#define fb_memcpy_fromfb sbus_memcpy_fromio 553#define fb_memcpy_fromfb sbus_memcpy_fromio
554#define fb_memcpy_tofb sbus_memcpy_toio 554#define fb_memcpy_tofb sbus_memcpy_toio
555 555
556#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__) 556#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__) || defined(__arm__)
557 557
558#define fb_readb __raw_readb 558#define fb_readb __raw_readb
559#define fb_readw __raw_readw 559#define fb_readw __raw_readw
diff --git a/include/linux/filter.h b/include/linux/filter.h
index a5227ab8ccb1..ca95abd2bed1 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -4,58 +4,24 @@
4#ifndef __LINUX_FILTER_H__ 4#ifndef __LINUX_FILTER_H__
5#define __LINUX_FILTER_H__ 5#define __LINUX_FILTER_H__
6 6
7#include <stdarg.h>
8
7#include <linux/atomic.h> 9#include <linux/atomic.h>
8#include <linux/compat.h> 10#include <linux/compat.h>
9#include <linux/skbuff.h> 11#include <linux/skbuff.h>
12#include <linux/linkage.h>
13#include <linux/printk.h>
10#include <linux/workqueue.h> 14#include <linux/workqueue.h>
11#include <uapi/linux/filter.h>
12 15
13/* Internally used and optimized filter representation with extended 16#include <asm/cacheflush.h>
14 * instruction set based on top of classic BPF.
15 */
16 17
17/* instruction classes */ 18#include <uapi/linux/filter.h>
18#define BPF_ALU64 0x07 /* alu mode in double word width */ 19#include <uapi/linux/bpf.h>
19
20/* ld/ldx fields */
21#define BPF_DW 0x18 /* double word */
22#define BPF_XADD 0xc0 /* exclusive add */
23
24/* alu/jmp fields */
25#define BPF_MOV 0xb0 /* mov reg to reg */
26#define BPF_ARSH 0xc0 /* sign extending arithmetic shift right */
27
28/* change endianness of a register */
29#define BPF_END 0xd0 /* flags for endianness conversion: */
30#define BPF_TO_LE 0x00 /* convert to little-endian */
31#define BPF_TO_BE 0x08 /* convert to big-endian */
32#define BPF_FROM_LE BPF_TO_LE
33#define BPF_FROM_BE BPF_TO_BE
34
35#define BPF_JNE 0x50 /* jump != */
36#define BPF_JSGT 0x60 /* SGT is signed '>', GT in x86 */
37#define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */
38#define BPF_CALL 0x80 /* function call */
39#define BPF_EXIT 0x90 /* function return */
40
41/* Register numbers */
42enum {
43 BPF_REG_0 = 0,
44 BPF_REG_1,
45 BPF_REG_2,
46 BPF_REG_3,
47 BPF_REG_4,
48 BPF_REG_5,
49 BPF_REG_6,
50 BPF_REG_7,
51 BPF_REG_8,
52 BPF_REG_9,
53 BPF_REG_10,
54 __MAX_BPF_REG,
55};
56 20
57/* BPF has 10 general purpose 64-bit registers and stack frame. */ 21struct sk_buff;
58#define MAX_BPF_REG __MAX_BPF_REG 22struct sock;
23struct seccomp_data;
24struct bpf_prog_aux;
59 25
60/* ArgX, context and stack frame pointer register positions. Note, 26/* ArgX, context and stack frame pointer register positions. Note,
61 * Arg1, Arg2, Arg3, etc are used as argument mappings of function 27 * Arg1, Arg2, Arg3, etc are used as argument mappings of function
@@ -161,6 +127,30 @@ enum {
161 .off = 0, \ 127 .off = 0, \
162 .imm = IMM }) 128 .imm = IMM })
163 129
130/* BPF_LD_IMM64 macro encodes single 'load 64-bit immediate' insn */
131#define BPF_LD_IMM64(DST, IMM) \
132 BPF_LD_IMM64_RAW(DST, 0, IMM)
133
134#define BPF_LD_IMM64_RAW(DST, SRC, IMM) \
135 ((struct bpf_insn) { \
136 .code = BPF_LD | BPF_DW | BPF_IMM, \
137 .dst_reg = DST, \
138 .src_reg = SRC, \
139 .off = 0, \
140 .imm = (__u32) (IMM) }), \
141 ((struct bpf_insn) { \
142 .code = 0, /* zero is reserved opcode */ \
143 .dst_reg = 0, \
144 .src_reg = 0, \
145 .off = 0, \
146 .imm = ((__u64) (IMM)) >> 32 })
147
148#define BPF_PSEUDO_MAP_FD 1
149
150/* pseudo BPF_LD_IMM64 insn used to refer to process-local map_fd */
151#define BPF_LD_MAP_FD(DST, MAP_FD) \
152 BPF_LD_IMM64_RAW(DST, BPF_PSEUDO_MAP_FD, MAP_FD)
153
164/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */ 154/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */
165 155
166#define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \ 156#define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \
@@ -299,14 +289,6 @@ enum {
299#define SK_RUN_FILTER(filter, ctx) \ 289#define SK_RUN_FILTER(filter, ctx) \
300 (*filter->prog->bpf_func)(ctx, filter->prog->insnsi) 290 (*filter->prog->bpf_func)(ctx, filter->prog->insnsi)
301 291
302struct bpf_insn {
303 __u8 code; /* opcode */
304 __u8 dst_reg:4; /* dest register */
305 __u8 src_reg:4; /* source register */
306 __s16 off; /* signed offset */
307 __s32 imm; /* signed immediate constant */
308};
309
310#ifdef CONFIG_COMPAT 292#ifdef CONFIG_COMPAT
311/* A struct sock_filter is architecture independent. */ 293/* A struct sock_filter is architecture independent. */
312struct compat_sock_fprog { 294struct compat_sock_fprog {
@@ -320,20 +302,23 @@ struct sock_fprog_kern {
320 struct sock_filter *filter; 302 struct sock_filter *filter;
321}; 303};
322 304
323struct sk_buff; 305struct bpf_binary_header {
324struct sock; 306 unsigned int pages;
325struct seccomp_data; 307 u8 image[];
308};
326 309
327struct bpf_prog { 310struct bpf_prog {
328 u32 jited:1, /* Is our filter JIT'ed? */ 311 u16 pages; /* Number of allocated pages */
329 len:31; /* Number of filter blocks */ 312 bool jited; /* Is our filter JIT'ed? */
313 u32 len; /* Number of filter blocks */
330 struct sock_fprog_kern *orig_prog; /* Original BPF program */ 314 struct sock_fprog_kern *orig_prog; /* Original BPF program */
315 struct bpf_prog_aux *aux; /* Auxiliary fields */
331 unsigned int (*bpf_func)(const struct sk_buff *skb, 316 unsigned int (*bpf_func)(const struct sk_buff *skb,
332 const struct bpf_insn *filter); 317 const struct bpf_insn *filter);
318 /* Instructions for interpreter */
333 union { 319 union {
334 struct sock_filter insns[0]; 320 struct sock_filter insns[0];
335 struct bpf_insn insnsi[0]; 321 struct bpf_insn insnsi[0];
336 struct work_struct work;
337 }; 322 };
338}; 323};
339 324
@@ -353,6 +338,26 @@ static inline unsigned int bpf_prog_size(unsigned int proglen)
353 338
354#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) 339#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0]))
355 340
341#ifdef CONFIG_DEBUG_SET_MODULE_RONX
342static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
343{
344 set_memory_ro((unsigned long)fp, fp->pages);
345}
346
347static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)
348{
349 set_memory_rw((unsigned long)fp, fp->pages);
350}
351#else
352static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
353{
354}
355
356static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)
357{
358}
359#endif /* CONFIG_DEBUG_SET_MODULE_RONX */
360
356int sk_filter(struct sock *sk, struct sk_buff *skb); 361int sk_filter(struct sock *sk, struct sk_buff *skb);
357 362
358void bpf_prog_select_runtime(struct bpf_prog *fp); 363void bpf_prog_select_runtime(struct bpf_prog *fp);
@@ -361,6 +366,17 @@ void bpf_prog_free(struct bpf_prog *fp);
361int bpf_convert_filter(struct sock_filter *prog, int len, 366int bpf_convert_filter(struct sock_filter *prog, int len,
362 struct bpf_insn *new_prog, int *new_len); 367 struct bpf_insn *new_prog, int *new_len);
363 368
369struct bpf_prog *bpf_prog_alloc(unsigned int size, gfp_t gfp_extra_flags);
370struct bpf_prog *bpf_prog_realloc(struct bpf_prog *fp_old, unsigned int size,
371 gfp_t gfp_extra_flags);
372void __bpf_prog_free(struct bpf_prog *fp);
373
374static inline void bpf_prog_unlock_free(struct bpf_prog *fp)
375{
376 bpf_prog_unlock_ro(fp);
377 __bpf_prog_free(fp);
378}
379
364int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog); 380int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog);
365void bpf_prog_destroy(struct bpf_prog *fp); 381void bpf_prog_destroy(struct bpf_prog *fp);
366 382
@@ -377,6 +393,38 @@ void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp);
377u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); 393u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);
378void bpf_int_jit_compile(struct bpf_prog *fp); 394void bpf_int_jit_compile(struct bpf_prog *fp);
379 395
396#ifdef CONFIG_BPF_JIT
397typedef void (*bpf_jit_fill_hole_t)(void *area, unsigned int size);
398
399struct bpf_binary_header *
400bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr,
401 unsigned int alignment,
402 bpf_jit_fill_hole_t bpf_fill_ill_insns);
403void bpf_jit_binary_free(struct bpf_binary_header *hdr);
404
405void bpf_jit_compile(struct bpf_prog *fp);
406void bpf_jit_free(struct bpf_prog *fp);
407
408static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
409 u32 pass, void *image)
410{
411 pr_err("flen=%u proglen=%u pass=%u image=%pK\n",
412 flen, proglen, pass, image);
413 if (image)
414 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
415 16, 1, image, proglen, false);
416}
417#else
418static inline void bpf_jit_compile(struct bpf_prog *fp)
419{
420}
421
422static inline void bpf_jit_free(struct bpf_prog *fp)
423{
424 bpf_prog_unlock_free(fp);
425}
426#endif /* CONFIG_BPF_JIT */
427
380#define BPF_ANC BIT(15) 428#define BPF_ANC BIT(15)
381 429
382static inline u16 bpf_anc_helper(const struct sock_filter *ftest) 430static inline u16 bpf_anc_helper(const struct sock_filter *ftest)
@@ -424,36 +472,6 @@ static inline void *bpf_load_pointer(const struct sk_buff *skb, int k,
424 return bpf_internal_load_pointer_neg_helper(skb, k, size); 472 return bpf_internal_load_pointer_neg_helper(skb, k, size);
425} 473}
426 474
427#ifdef CONFIG_BPF_JIT
428#include <stdarg.h>
429#include <linux/linkage.h>
430#include <linux/printk.h>
431
432void bpf_jit_compile(struct bpf_prog *fp);
433void bpf_jit_free(struct bpf_prog *fp);
434
435static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
436 u32 pass, void *image)
437{
438 pr_err("flen=%u proglen=%u pass=%u image=%pK\n",
439 flen, proglen, pass, image);
440 if (image)
441 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
442 16, 1, image, proglen, false);
443}
444#else
445#include <linux/slab.h>
446
447static inline void bpf_jit_compile(struct bpf_prog *fp)
448{
449}
450
451static inline void bpf_jit_free(struct bpf_prog *fp)
452{
453 kfree(fp);
454}
455#endif /* CONFIG_BPF_JIT */
456
457static inline int bpf_tell_extensions(void) 475static inline int bpf_tell_extensions(void)
458{ 476{
459 return SKF_AD_MAX; 477 return SKF_AD_MAX;
diff --git a/include/linux/flex_proportions.h b/include/linux/flex_proportions.h
index 4ebc49fae391..0d348e011a6e 100644
--- a/include/linux/flex_proportions.h
+++ b/include/linux/flex_proportions.h
@@ -10,6 +10,7 @@
10#include <linux/percpu_counter.h> 10#include <linux/percpu_counter.h>
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/seqlock.h> 12#include <linux/seqlock.h>
13#include <linux/gfp.h>
13 14
14/* 15/*
15 * When maximum proportion of some event type is specified, this is the 16 * When maximum proportion of some event type is specified, this is the
@@ -32,7 +33,7 @@ struct fprop_global {
32 seqcount_t sequence; 33 seqcount_t sequence;
33}; 34};
34 35
35int fprop_global_init(struct fprop_global *p); 36int fprop_global_init(struct fprop_global *p, gfp_t gfp);
36void fprop_global_destroy(struct fprop_global *p); 37void fprop_global_destroy(struct fprop_global *p);
37bool fprop_new_period(struct fprop_global *p, int periods); 38bool fprop_new_period(struct fprop_global *p, int periods);
38 39
@@ -79,7 +80,7 @@ struct fprop_local_percpu {
79 raw_spinlock_t lock; /* Protect period and numerator */ 80 raw_spinlock_t lock; /* Protect period and numerator */
80}; 81};
81 82
82int fprop_local_init_percpu(struct fprop_local_percpu *pl); 83int fprop_local_init_percpu(struct fprop_local_percpu *pl, gfp_t gfp);
83void fprop_local_destroy_percpu(struct fprop_local_percpu *pl); 84void fprop_local_destroy_percpu(struct fprop_local_percpu *pl);
84void __fprop_inc_percpu(struct fprop_global *p, struct fprop_local_percpu *pl); 85void __fprop_inc_percpu(struct fprop_global *p, struct fprop_local_percpu *pl);
85void __fprop_inc_percpu_max(struct fprop_global *p, struct fprop_local_percpu *pl, 86void __fprop_inc_percpu_max(struct fprop_global *p, struct fprop_local_percpu *pl,
diff --git a/include/linux/font.h b/include/linux/font.h
index 40a24ab41b36..d6821769dd1e 100644
--- a/include/linux/font.h
+++ b/include/linux/font.h
@@ -31,6 +31,7 @@ struct font_desc {
31#define SUN12x22_IDX 7 31#define SUN12x22_IDX 7
32#define ACORN8x8_IDX 8 32#define ACORN8x8_IDX 8
33#define MINI4x6_IDX 9 33#define MINI4x6_IDX 9
34#define FONT6x10_IDX 10
34 35
35extern const struct font_desc font_vga_8x8, 36extern const struct font_desc font_vga_8x8,
36 font_vga_8x16, 37 font_vga_8x16,
@@ -41,7 +42,8 @@ extern const struct font_desc font_vga_8x8,
41 font_sun_8x16, 42 font_sun_8x16,
42 font_sun_12x22, 43 font_sun_12x22,
43 font_acorn_8x8, 44 font_acorn_8x8,
44 font_mini_4x6; 45 font_mini_4x6,
46 font_6x10;
45 47
46/* Find a font with a specific name */ 48/* Find a font with a specific name */
47 49
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2daccaf4b547..9ab779e8a63c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -192,8 +192,6 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
192#define READ 0 192#define READ 0
193#define WRITE RW_MASK 193#define WRITE RW_MASK
194#define READA RWA_MASK 194#define READA RWA_MASK
195#define KERNEL_READ (READ|REQ_KERNEL)
196#define KERNEL_WRITE (WRITE|REQ_KERNEL)
197 195
198#define READ_SYNC (READ | REQ_SYNC) 196#define READ_SYNC (READ | REQ_SYNC)
199#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE) 197#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE)
@@ -225,6 +223,13 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
225#define ATTR_TIMES_SET (1 << 16) 223#define ATTR_TIMES_SET (1 << 16)
226 224
227/* 225/*
226 * Whiteout is represented by a char device. The following constants define the
227 * mode and device number to use.
228 */
229#define WHITEOUT_MODE 0
230#define WHITEOUT_DEV 0
231
232/*
228 * This is the Inode Attributes structure, used for notify_change(). It 233 * This is the Inode Attributes structure, used for notify_change(). It
229 * uses the above definitions as flags, to know which values have changed. 234 * uses the above definitions as flags, to know which values have changed.
230 * Also, in this manner, a Filesystem can look at only the values it cares 235 * Also, in this manner, a Filesystem can look at only the values it cares
@@ -256,6 +261,12 @@ struct iattr {
256 */ 261 */
257#include <linux/quota.h> 262#include <linux/quota.h>
258 263
264/*
265 * Maximum number of layers of fs stack. Needs to be limited to
266 * prevent kernel stack overflow
267 */
268#define FILESYSTEM_MAX_STACK_DEPTH 2
269
259/** 270/**
260 * enum positive_aop_returns - aop return codes with specific semantics 271 * enum positive_aop_returns - aop return codes with specific semantics
261 * 272 *
@@ -387,7 +398,7 @@ struct address_space {
387 struct inode *host; /* owner: inode, block_device */ 398 struct inode *host; /* owner: inode, block_device */
388 struct radix_tree_root page_tree; /* radix tree of all pages */ 399 struct radix_tree_root page_tree; /* radix tree of all pages */
389 spinlock_t tree_lock; /* and lock protecting it */ 400 spinlock_t tree_lock; /* and lock protecting it */
390 unsigned int i_mmap_writable;/* count VM_SHARED mappings */ 401 atomic_t i_mmap_writable;/* count VM_SHARED mappings */
391 struct rb_root i_mmap; /* tree of private and shared mappings */ 402 struct rb_root i_mmap; /* tree of private and shared mappings */
392 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ 403 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
393 struct mutex i_mmap_mutex; /* protect tree, count, list */ 404 struct mutex i_mmap_mutex; /* protect tree, count, list */
@@ -470,10 +481,35 @@ static inline int mapping_mapped(struct address_space *mapping)
470 * Note that i_mmap_writable counts all VM_SHARED vmas: do_mmap_pgoff 481 * Note that i_mmap_writable counts all VM_SHARED vmas: do_mmap_pgoff
471 * marks vma as VM_SHARED if it is shared, and the file was opened for 482 * marks vma as VM_SHARED if it is shared, and the file was opened for
472 * writing i.e. vma may be mprotected writable even if now readonly. 483 * writing i.e. vma may be mprotected writable even if now readonly.
484 *
485 * If i_mmap_writable is negative, no new writable mappings are allowed. You
486 * can only deny writable mappings, if none exists right now.
473 */ 487 */
474static inline int mapping_writably_mapped(struct address_space *mapping) 488static inline int mapping_writably_mapped(struct address_space *mapping)
475{ 489{
476 return mapping->i_mmap_writable != 0; 490 return atomic_read(&mapping->i_mmap_writable) > 0;
491}
492
493static inline int mapping_map_writable(struct address_space *mapping)
494{
495 return atomic_inc_unless_negative(&mapping->i_mmap_writable) ?
496 0 : -EPERM;
497}
498
499static inline void mapping_unmap_writable(struct address_space *mapping)
500{
501 atomic_dec(&mapping->i_mmap_writable);
502}
503
504static inline int mapping_deny_writable(struct address_space *mapping)
505{
506 return atomic_dec_unless_positive(&mapping->i_mmap_writable) ?
507 0 : -EBUSY;
508}
509
510static inline void mapping_allow_writable(struct address_space *mapping)
511{
512 atomic_inc(&mapping->i_mmap_writable);
477} 513}
478 514
479/* 515/*
@@ -603,11 +639,13 @@ static inline int inode_unhashed(struct inode *inode)
603 * 2: child/target 639 * 2: child/target
604 * 3: xattr 640 * 3: xattr
605 * 4: second non-directory 641 * 4: second non-directory
606 * The last is for certain operations (such as rename) which lock two 642 * 5: second parent (when locking independent directories in rename)
643 *
644 * I_MUTEX_NONDIR2 is for certain operations (such as rename) which lock two
607 * non-directories at once. 645 * non-directories at once.
608 * 646 *
609 * The locking order between these classes is 647 * The locking order between these classes is
610 * parent -> child -> normal -> xattr -> second non-directory 648 * parent[2] -> child -> grandchild -> normal -> xattr -> second non-directory
611 */ 649 */
612enum inode_i_mutex_lock_class 650enum inode_i_mutex_lock_class
613{ 651{
@@ -615,7 +653,8 @@ enum inode_i_mutex_lock_class
615 I_MUTEX_PARENT, 653 I_MUTEX_PARENT,
616 I_MUTEX_CHILD, 654 I_MUTEX_CHILD,
617 I_MUTEX_XATTR, 655 I_MUTEX_XATTR,
618 I_MUTEX_NONDIR2 656 I_MUTEX_NONDIR2,
657 I_MUTEX_PARENT2,
619}; 658};
620 659
621void lock_two_nondirectories(struct inode *, struct inode*); 660void lock_two_nondirectories(struct inode *, struct inode*);
@@ -826,13 +865,7 @@ static inline struct file *get_file(struct file *f)
826 */ 865 */
827#define FILE_LOCK_DEFERRED 1 866#define FILE_LOCK_DEFERRED 1
828 867
829/* 868/* legacy typedef, should eventually be removed */
830 * The POSIX file lock owner is determined by
831 * the "struct files_struct" in the thread group
832 * (or NULL for no owner - BSD locks).
833 *
834 * Lockd stuffs a "host" pointer into this.
835 */
836typedef void *fl_owner_t; 869typedef void *fl_owner_t;
837 870
838struct file_lock_operations { 871struct file_lock_operations {
@@ -843,10 +876,13 @@ struct file_lock_operations {
843struct lock_manager_operations { 876struct lock_manager_operations {
844 int (*lm_compare_owner)(struct file_lock *, struct file_lock *); 877 int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
845 unsigned long (*lm_owner_key)(struct file_lock *); 878 unsigned long (*lm_owner_key)(struct file_lock *);
879 void (*lm_get_owner)(struct file_lock *, struct file_lock *);
880 void (*lm_put_owner)(struct file_lock *);
846 void (*lm_notify)(struct file_lock *); /* unblock callback */ 881 void (*lm_notify)(struct file_lock *); /* unblock callback */
847 int (*lm_grant)(struct file_lock *, struct file_lock *, int); 882 int (*lm_grant)(struct file_lock *, int);
848 void (*lm_break)(struct file_lock *); 883 bool (*lm_break)(struct file_lock *);
849 int (*lm_change)(struct file_lock **, int); 884 int (*lm_change)(struct file_lock **, int, struct list_head *);
885 void (*lm_setup)(struct file_lock *, void **);
850}; 886};
851 887
852struct lock_manager { 888struct lock_manager {
@@ -941,7 +977,7 @@ void locks_free_lock(struct file_lock *fl);
941extern void locks_init_lock(struct file_lock *); 977extern void locks_init_lock(struct file_lock *);
942extern struct file_lock * locks_alloc_lock(void); 978extern struct file_lock * locks_alloc_lock(void);
943extern void locks_copy_lock(struct file_lock *, struct file_lock *); 979extern void locks_copy_lock(struct file_lock *, struct file_lock *);
944extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); 980extern void locks_copy_conflock(struct file_lock *, struct file_lock *);
945extern void locks_remove_posix(struct file *, fl_owner_t); 981extern void locks_remove_posix(struct file *, fl_owner_t);
946extern void locks_remove_file(struct file *); 982extern void locks_remove_file(struct file *);
947extern void locks_release_private(struct file_lock *); 983extern void locks_release_private(struct file_lock *);
@@ -955,11 +991,9 @@ extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
955extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 991extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
956extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); 992extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type);
957extern void lease_get_mtime(struct inode *, struct timespec *time); 993extern void lease_get_mtime(struct inode *, struct timespec *time);
958extern int generic_setlease(struct file *, long, struct file_lock **); 994extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
959extern int vfs_setlease(struct file *, long, struct file_lock **); 995extern int vfs_setlease(struct file *, long, struct file_lock **, void **);
960extern int lease_modify(struct file_lock **, int); 996extern int lease_modify(struct file_lock **, int, struct list_head *);
961extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
962extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
963#else /* !CONFIG_FILE_LOCKING */ 997#else /* !CONFIG_FILE_LOCKING */
964static inline int fcntl_getlk(struct file *file, unsigned int cmd, 998static inline int fcntl_getlk(struct file *file, unsigned int cmd,
965 struct flock __user *user) 999 struct flock __user *user)
@@ -988,12 +1022,12 @@ static inline int fcntl_setlk64(unsigned int fd, struct file *file,
988#endif 1022#endif
989static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg) 1023static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
990{ 1024{
991 return 0; 1025 return -EINVAL;
992} 1026}
993 1027
994static inline int fcntl_getlease(struct file *filp) 1028static inline int fcntl_getlease(struct file *filp)
995{ 1029{
996 return 0; 1030 return F_UNLCK;
997} 1031}
998 1032
999static inline void locks_init_lock(struct file_lock *fl) 1033static inline void locks_init_lock(struct file_lock *fl)
@@ -1001,7 +1035,7 @@ static inline void locks_init_lock(struct file_lock *fl)
1001 return; 1035 return;
1002} 1036}
1003 1037
1004static inline void __locks_copy_lock(struct file_lock *new, struct file_lock *fl) 1038static inline void locks_copy_conflock(struct file_lock *new, struct file_lock *fl)
1005{ 1039{
1006 return; 1040 return;
1007} 1041}
@@ -1075,33 +1109,22 @@ static inline void lease_get_mtime(struct inode *inode, struct timespec *time)
1075} 1109}
1076 1110
1077static inline int generic_setlease(struct file *filp, long arg, 1111static inline int generic_setlease(struct file *filp, long arg,
1078 struct file_lock **flp) 1112 struct file_lock **flp, void **priv)
1079{ 1113{
1080 return -EINVAL; 1114 return -EINVAL;
1081} 1115}
1082 1116
1083static inline int vfs_setlease(struct file *filp, long arg, 1117static inline int vfs_setlease(struct file *filp, long arg,
1084 struct file_lock **lease) 1118 struct file_lock **lease, void **priv)
1085{ 1119{
1086 return -EINVAL; 1120 return -EINVAL;
1087} 1121}
1088 1122
1089static inline int lease_modify(struct file_lock **before, int arg) 1123static inline int lease_modify(struct file_lock **before, int arg,
1124 struct list_head *dispose)
1090{ 1125{
1091 return -EINVAL; 1126 return -EINVAL;
1092} 1127}
1093
1094static inline int lock_may_read(struct inode *inode, loff_t start,
1095 unsigned long len)
1096{
1097 return 1;
1098}
1099
1100static inline int lock_may_write(struct inode *inode, loff_t start,
1101 unsigned long len)
1102{
1103 return 1;
1104}
1105#endif /* !CONFIG_FILE_LOCKING */ 1128#endif /* !CONFIG_FILE_LOCKING */
1106 1129
1107 1130
@@ -1126,8 +1149,8 @@ extern void fasync_free(struct fasync_struct *);
1126/* can be called from interrupts */ 1149/* can be called from interrupts */
1127extern void kill_fasync(struct fasync_struct **, int, int); 1150extern void kill_fasync(struct fasync_struct **, int, int);
1128 1151
1129extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force); 1152extern void __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
1130extern int f_setown(struct file *filp, unsigned long arg, int force); 1153extern void f_setown(struct file *filp, unsigned long arg, int force);
1131extern void f_delown(struct file *filp); 1154extern void f_delown(struct file *filp);
1132extern pid_t f_getown(struct file *filp); 1155extern pid_t f_getown(struct file *filp);
1133extern int send_sigurg(struct fown_struct *fown); 1156extern int send_sigurg(struct fown_struct *fown);
@@ -1250,6 +1273,7 @@ struct super_block {
1250 1273
1251 /* AIO completions deferred from interrupt context */ 1274 /* AIO completions deferred from interrupt context */
1252 struct workqueue_struct *s_dio_done_wq; 1275 struct workqueue_struct *s_dio_done_wq;
1276 struct hlist_head s_pins;
1253 1277
1254 /* 1278 /*
1255 * Keep the lru lists last in the structure so they always sit on their 1279 * Keep the lru lists last in the structure so they always sit on their
@@ -1258,6 +1282,11 @@ struct super_block {
1258 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp; 1282 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp;
1259 struct list_lru s_inode_lru ____cacheline_aligned_in_smp; 1283 struct list_lru s_inode_lru ____cacheline_aligned_in_smp;
1260 struct rcu_head rcu; 1284 struct rcu_head rcu;
1285
1286 /*
1287 * Indicates how deep in a filesystem stack this SB is
1288 */
1289 int s_stack_depth;
1261}; 1290};
1262 1291
1263extern struct timespec current_fs_time(struct super_block *sb); 1292extern struct timespec current_fs_time(struct super_block *sb);
@@ -1390,6 +1419,7 @@ extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct ino
1390extern int vfs_rmdir(struct inode *, struct dentry *); 1419extern int vfs_rmdir(struct inode *, struct dentry *);
1391extern int vfs_unlink(struct inode *, struct dentry *, struct inode **); 1420extern int vfs_unlink(struct inode *, struct dentry *, struct inode **);
1392extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int); 1421extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int);
1422extern int vfs_whiteout(struct inode *, struct dentry *);
1393 1423
1394/* 1424/*
1395 * VFS dentry helper functions. 1425 * VFS dentry helper functions.
@@ -1480,7 +1510,7 @@ struct file_operations {
1480 int (*flock) (struct file *, int, struct file_lock *); 1510 int (*flock) (struct file *, int, struct file_lock *);
1481 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); 1511 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
1482 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); 1512 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
1483 int (*setlease)(struct file *, long, struct file_lock **); 1513 int (*setlease)(struct file *, long, struct file_lock **, void **);
1484 long (*fallocate)(struct file *file, int mode, loff_t offset, 1514 long (*fallocate)(struct file *file, int mode, loff_t offset,
1485 loff_t len); 1515 loff_t len);
1486 int (*show_fdinfo)(struct seq_file *m, struct file *f); 1516 int (*show_fdinfo)(struct seq_file *m, struct file *f);
@@ -1520,6 +1550,9 @@ struct inode_operations {
1520 umode_t create_mode, int *opened); 1550 umode_t create_mode, int *opened);
1521 int (*tmpfile) (struct inode *, struct dentry *, umode_t); 1551 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
1522 int (*set_acl)(struct inode *, struct posix_acl *, int); 1552 int (*set_acl)(struct inode *, struct posix_acl *, int);
1553
1554 /* WARNING: probably going away soon, do not use! */
1555 int (*dentry_open)(struct dentry *, struct file *, const struct cred *);
1523} ____cacheline_aligned; 1556} ____cacheline_aligned;
1524 1557
1525ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, 1558ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
@@ -1617,6 +1650,9 @@ struct super_operations {
1617#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT) 1650#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT)
1618#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC) 1651#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC)
1619 1652
1653#define IS_WHITEOUT(inode) (S_ISCHR(inode->i_mode) && \
1654 (inode)->i_rdev == WHITEOUT_DEV)
1655
1620/* 1656/*
1621 * Inode state bits. Protected by inode->i_lock 1657 * Inode state bits. Protected by inode->i_lock
1622 * 1658 *
@@ -1829,7 +1865,8 @@ extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data);
1829extern void kern_unmount(struct vfsmount *mnt); 1865extern void kern_unmount(struct vfsmount *mnt);
1830extern int may_umount_tree(struct vfsmount *); 1866extern int may_umount_tree(struct vfsmount *);
1831extern int may_umount(struct vfsmount *); 1867extern int may_umount(struct vfsmount *);
1832extern long do_mount(const char *, const char *, const char *, unsigned long, void *); 1868extern long do_mount(const char *, const char __user *,
1869 const char *, unsigned long, void *);
1833extern struct vfsmount *collect_mounts(struct path *); 1870extern struct vfsmount *collect_mounts(struct path *);
1834extern void drop_collected_mounts(struct vfsmount *); 1871extern void drop_collected_mounts(struct vfsmount *);
1835extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1872extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
@@ -1848,7 +1885,7 @@ extern int current_umask(void);
1848extern void ihold(struct inode * inode); 1885extern void ihold(struct inode * inode);
1849extern void iput(struct inode *); 1886extern void iput(struct inode *);
1850 1887
1851static inline struct inode *file_inode(struct file *f) 1888static inline struct inode *file_inode(const struct file *f)
1852{ 1889{
1853 return f->f_inode; 1890 return f->f_inode;
1854} 1891}
@@ -2031,6 +2068,7 @@ extern struct file *file_open_name(struct filename *, int, umode_t);
2031extern struct file *filp_open(const char *, int, umode_t); 2068extern struct file *filp_open(const char *, int, umode_t);
2032extern struct file *file_open_root(struct dentry *, struct vfsmount *, 2069extern struct file *file_open_root(struct dentry *, struct vfsmount *,
2033 const char *, int); 2070 const char *, int);
2071extern int vfs_open(const struct path *, struct file *, const struct cred *);
2034extern struct file * dentry_open(const struct path *, int, const struct cred *); 2072extern struct file * dentry_open(const struct path *, int, const struct cred *);
2035extern int filp_close(struct file *, fl_owner_t id); 2073extern int filp_close(struct file *, fl_owner_t id);
2036 2074
@@ -2244,7 +2282,9 @@ extern sector_t bmap(struct inode *, sector_t);
2244#endif 2282#endif
2245extern int notify_change(struct dentry *, struct iattr *, struct inode **); 2283extern int notify_change(struct dentry *, struct iattr *, struct inode **);
2246extern int inode_permission(struct inode *, int); 2284extern int inode_permission(struct inode *, int);
2285extern int __inode_permission(struct inode *, int);
2247extern int generic_permission(struct inode *, int); 2286extern int generic_permission(struct inode *, int);
2287extern int __check_sticky(struct inode *dir, struct inode *inode);
2248 2288
2249static inline bool execute_ok(struct inode *inode) 2289static inline bool execute_ok(struct inode *inode)
2250{ 2290{
@@ -2335,6 +2375,7 @@ extern int do_pipe_flags(int *, int);
2335 2375
2336extern int kernel_read(struct file *, loff_t, char *, unsigned long); 2376extern int kernel_read(struct file *, loff_t, char *, unsigned long);
2337extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t); 2377extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t);
2378extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *);
2338extern struct file * open_exec(const char *); 2379extern struct file * open_exec(const char *);
2339 2380
2340/* fs/dcache.c -- generic fs support functions */ 2381/* fs/dcache.c -- generic fs support functions */
@@ -2428,6 +2469,7 @@ extern ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, lo
2428extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); 2469extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2429 2470
2430/* fs/block_dev.c */ 2471/* fs/block_dev.c */
2472extern ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to);
2431extern ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from); 2473extern ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from);
2432extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, 2474extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
2433 int datasync); 2475 int datasync);
@@ -2442,6 +2484,9 @@ extern ssize_t iter_file_splice_write(struct pipe_inode_info *,
2442 struct file *, loff_t *, size_t, unsigned int); 2484 struct file *, loff_t *, size_t, unsigned int);
2443extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, 2485extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
2444 struct file *out, loff_t *, size_t len, unsigned int flags); 2486 struct file *out, loff_t *, size_t len, unsigned int flags);
2487extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
2488 loff_t *opos, size_t len, unsigned int flags);
2489
2445 2490
2446extern void 2491extern void
2447file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 2492file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
@@ -2584,6 +2629,7 @@ extern int simple_write_end(struct file *file, struct address_space *mapping,
2584 struct page *page, void *fsdata); 2629 struct page *page, void *fsdata);
2585extern int always_delete_dentry(const struct dentry *); 2630extern int always_delete_dentry(const struct dentry *);
2586extern struct inode *alloc_anon_inode(struct super_block *); 2631extern struct inode *alloc_anon_inode(struct super_block *);
2632extern int simple_nosetlease(struct file *, long, struct file_lock **, void **);
2587extern const struct dentry_operations simple_dentry_operations; 2633extern const struct dentry_operations simple_dentry_operations;
2588 2634
2589extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); 2635extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
@@ -2688,7 +2734,7 @@ static const struct file_operations __fops = { \
2688 .read = simple_attr_read, \ 2734 .read = simple_attr_read, \
2689 .write = simple_attr_write, \ 2735 .write = simple_attr_write, \
2690 .llseek = generic_file_llseek, \ 2736 .llseek = generic_file_llseek, \
2691}; 2737}
2692 2738
2693static inline __printf(1, 2) 2739static inline __printf(1, 2)
2694void __simple_attr_check_format(const char *fmt, ...) 2740void __simple_attr_check_format(const char *fmt, ...)
@@ -2726,6 +2772,14 @@ static inline int is_sxid(umode_t mode)
2726 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); 2772 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
2727} 2773}
2728 2774
2775static inline int check_sticky(struct inode *dir, struct inode *inode)
2776{
2777 if (!(dir->i_mode & S_ISVTX))
2778 return 0;
2779
2780 return __check_sticky(dir, inode);
2781}
2782
2729static inline void inode_has_no_xattr(struct inode *inode) 2783static inline void inode_has_no_xattr(struct inode *inode)
2730{ 2784{
2731 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC)) 2785 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC))
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index efb05961bdd8..77d783f71527 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -139,7 +139,6 @@ struct fs_platform_info {
139 int rx_ring, tx_ring; /* number of buffers on rx */ 139 int rx_ring, tx_ring; /* number of buffers on rx */
140 __u8 macaddr[ETH_ALEN]; /* mac address */ 140 __u8 macaddr[ETH_ALEN]; /* mac address */
141 int rx_copybreak; /* limit we copy small frames */ 141 int rx_copybreak; /* limit we copy small frames */
142 int use_napi; /* use NAPI */
143 int napi_weight; /* NAPI weight */ 142 int napi_weight; /* NAPI weight */
144 143
145 int use_rmii; /* use RMII mode */ 144 int use_rmii; /* use RMII mode */
diff --git a/include/linux/fs_pin.h b/include/linux/fs_pin.h
new file mode 100644
index 000000000000..f66525e72ccf
--- /dev/null
+++ b/include/linux/fs_pin.h
@@ -0,0 +1,17 @@
1#include <linux/fs.h>
2
3struct fs_pin {
4 atomic_long_t count;
5 union {
6 struct {
7 struct hlist_node s_list;
8 struct hlist_node m_list;
9 };
10 struct rcu_head rcu;
11 };
12 void (*kill)(struct fs_pin *);
13};
14
15void pin_put(struct fs_pin *);
16void pin_remove(struct fs_pin *);
17void pin_insert(struct fs_pin *, struct vfsmount *);
diff --git a/include/linux/fsl_ifc.h b/include/linux/fsl_ifc.h
index f49ddb1b2273..84d60cb841b1 100644
--- a/include/linux/fsl_ifc.h
+++ b/include/linux/fsl_ifc.h
@@ -781,13 +781,13 @@ struct fsl_ifc_regs {
781 __be32 amask; 781 __be32 amask;
782 u32 res4[0x2]; 782 u32 res4[0x2];
783 } amask_cs[FSL_IFC_BANK_COUNT]; 783 } amask_cs[FSL_IFC_BANK_COUNT];
784 u32 res5[0x17]; 784 u32 res5[0x18];
785 struct { 785 struct {
786 __be32 csor_ext;
787 __be32 csor; 786 __be32 csor;
787 __be32 csor_ext;
788 u32 res6; 788 u32 res6;
789 } csor_cs[FSL_IFC_BANK_COUNT]; 789 } csor_cs[FSL_IFC_BANK_COUNT];
790 u32 res7[0x19]; 790 u32 res7[0x18];
791 struct { 791 struct {
792 __be32 ftim[4]; 792 __be32 ftim[4];
793 u32 res8[0x8]; 793 u32 res8[0x8];
diff --git a/include/linux/fsldma.h b/include/linux/fsldma.h
new file mode 100644
index 000000000000..b213c02963c9
--- /dev/null
+++ b/include/linux/fsldma.h
@@ -0,0 +1,13 @@
1/*
2 * This 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, or
5 * (at your option) any later version.
6 */
7
8#ifndef FSL_DMA_H
9#define FSL_DMA_H
10/* fsl dma API for enxternal start */
11int fsl_dma_external_start(struct dma_chan *dchan, int enable);
12
13#endif
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index fc7718c6bd3e..ca060d7c4fa6 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -322,16 +322,18 @@ extern int fsnotify_fasync(int fd, struct file *file, int on);
322extern void fsnotify_destroy_event(struct fsnotify_group *group, 322extern void fsnotify_destroy_event(struct fsnotify_group *group,
323 struct fsnotify_event *event); 323 struct fsnotify_event *event);
324/* attach the event to the group notification queue */ 324/* attach the event to the group notification queue */
325extern int fsnotify_add_notify_event(struct fsnotify_group *group, 325extern int fsnotify_add_event(struct fsnotify_group *group,
326 struct fsnotify_event *event, 326 struct fsnotify_event *event,
327 int (*merge)(struct list_head *, 327 int (*merge)(struct list_head *,
328 struct fsnotify_event *)); 328 struct fsnotify_event *));
329/* Remove passed event from groups notification queue */
330extern void fsnotify_remove_event(struct fsnotify_group *group, struct fsnotify_event *event);
329/* true if the group notification queue is empty */ 331/* true if the group notification queue is empty */
330extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group); 332extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
331/* return, but do not dequeue the first event on the notification queue */ 333/* return, but do not dequeue the first event on the notification queue */
332extern struct fsnotify_event *fsnotify_peek_notify_event(struct fsnotify_group *group); 334extern struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group);
333/* return AND dequeue the first event on the notification queue */ 335/* return AND dequeue the first event on the notification queue */
334extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group); 336extern struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group);
335 337
336/* functions used to manipulate the marks attached to inodes */ 338/* functions used to manipulate the marks attached to inodes */
337 339
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 6bb5e3f2a3b4..662697babd48 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -56,6 +56,8 @@ struct ftrace_ops;
56typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip, 56typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
57 struct ftrace_ops *op, struct pt_regs *regs); 57 struct ftrace_ops *op, struct pt_regs *regs);
58 58
59ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops);
60
59/* 61/*
60 * FTRACE_OPS_FL_* bits denote the state of ftrace_ops struct and are 62 * FTRACE_OPS_FL_* bits denote the state of ftrace_ops struct and are
61 * set in the flags member. 63 * set in the flags member.
@@ -89,6 +91,9 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
89 * INITIALIZED - The ftrace_ops has already been initialized (first use time 91 * INITIALIZED - The ftrace_ops has already been initialized (first use time
90 * register_ftrace_function() is called, it will initialized the ops) 92 * register_ftrace_function() is called, it will initialized the ops)
91 * DELETED - The ops are being deleted, do not let them be registered again. 93 * DELETED - The ops are being deleted, do not let them be registered again.
94 * ADDING - The ops is in the process of being added.
95 * REMOVING - The ops is in the process of being removed.
96 * MODIFYING - The ops is in the process of changing its filter functions.
92 */ 97 */
93enum { 98enum {
94 FTRACE_OPS_FL_ENABLED = 1 << 0, 99 FTRACE_OPS_FL_ENABLED = 1 << 0,
@@ -100,8 +105,20 @@ enum {
100 FTRACE_OPS_FL_STUB = 1 << 6, 105 FTRACE_OPS_FL_STUB = 1 << 6,
101 FTRACE_OPS_FL_INITIALIZED = 1 << 7, 106 FTRACE_OPS_FL_INITIALIZED = 1 << 7,
102 FTRACE_OPS_FL_DELETED = 1 << 8, 107 FTRACE_OPS_FL_DELETED = 1 << 8,
108 FTRACE_OPS_FL_ADDING = 1 << 9,
109 FTRACE_OPS_FL_REMOVING = 1 << 10,
110 FTRACE_OPS_FL_MODIFYING = 1 << 11,
103}; 111};
104 112
113#ifdef CONFIG_DYNAMIC_FTRACE
114/* The hash used to know what functions callbacks trace */
115struct ftrace_ops_hash {
116 struct ftrace_hash *notrace_hash;
117 struct ftrace_hash *filter_hash;
118 struct mutex regex_lock;
119};
120#endif
121
105/* 122/*
106 * Note, ftrace_ops can be referenced outside of RCU protection. 123 * Note, ftrace_ops can be referenced outside of RCU protection.
107 * (Although, for perf, the control ops prevent that). If ftrace_ops is 124 * (Although, for perf, the control ops prevent that). If ftrace_ops is
@@ -121,10 +138,9 @@ struct ftrace_ops {
121 int __percpu *disabled; 138 int __percpu *disabled;
122#ifdef CONFIG_DYNAMIC_FTRACE 139#ifdef CONFIG_DYNAMIC_FTRACE
123 int nr_trampolines; 140 int nr_trampolines;
124 struct ftrace_hash *notrace_hash; 141 struct ftrace_ops_hash local_hash;
125 struct ftrace_hash *filter_hash; 142 struct ftrace_ops_hash *func_hash;
126 struct ftrace_hash *tramp_hash; 143 struct ftrace_ops_hash old_hash;
127 struct mutex regex_lock;
128 unsigned long trampoline; 144 unsigned long trampoline;
129#endif 145#endif
130}; 146};
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 06c6faa9e5cc..28672e87e910 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -571,40 +571,6 @@ do { \
571 __trace_printk(ip, fmt, ##args); \ 571 __trace_printk(ip, fmt, ##args); \
572} while (0) 572} while (0)
573 573
574/**
575 * tracepoint_string - register constant persistent string to trace system
576 * @str - a constant persistent string that will be referenced in tracepoints
577 *
578 * If constant strings are being used in tracepoints, it is faster and
579 * more efficient to just save the pointer to the string and reference
580 * that with a printf "%s" instead of saving the string in the ring buffer
581 * and wasting space and time.
582 *
583 * The problem with the above approach is that userspace tools that read
584 * the binary output of the trace buffers do not have access to the string.
585 * Instead they just show the address of the string which is not very
586 * useful to users.
587 *
588 * With tracepoint_string(), the string will be registered to the tracing
589 * system and exported to userspace via the debugfs/tracing/printk_formats
590 * file that maps the string address to the string text. This way userspace
591 * tools that read the binary buffers have a way to map the pointers to
592 * the ASCII strings they represent.
593 *
594 * The @str used must be a constant string and persistent as it would not
595 * make sense to show a string that no longer exists. But it is still fine
596 * to be used with modules, because when modules are unloaded, if they
597 * had tracepoints, the ring buffers are cleared too. As long as the string
598 * does not change during the life of the module, it is fine to use
599 * tracepoint_string() within a module.
600 */
601#define tracepoint_string(str) \
602 ({ \
603 static const char *___tp_str __tracepoint_string = str; \
604 ___tp_str; \
605 })
606#define __tracepoint_string __attribute__((section("__tracepoint_str")))
607
608#ifdef CONFIG_PERF_EVENTS 574#ifdef CONFIG_PERF_EVENTS
609struct perf_event; 575struct perf_event;
610 576
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index 1c2fdaa2ffc3..1ccaab44abcc 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -110,6 +110,10 @@ extern void gen_pool_set_algo(struct gen_pool *pool, genpool_algo_t algo,
110extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size, 110extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size,
111 unsigned long start, unsigned int nr, void *data); 111 unsigned long start, unsigned int nr, void *data);
112 112
113extern unsigned long gen_pool_first_fit_order_align(unsigned long *map,
114 unsigned long size, unsigned long start, unsigned int nr,
115 void *data);
116
113extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size, 117extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size,
114 unsigned long start, unsigned int nr, void *data); 118 unsigned long start, unsigned int nr, void *data);
115 119
@@ -117,6 +121,9 @@ extern struct gen_pool *devm_gen_pool_create(struct device *dev,
117 int min_alloc_order, int nid); 121 int min_alloc_order, int nid);
118extern struct gen_pool *dev_get_gen_pool(struct device *dev); 122extern struct gen_pool *dev_get_gen_pool(struct device *dev);
119 123
124bool addr_in_gen_pool(struct gen_pool *pool, unsigned long start,
125 size_t size);
126
120#ifdef CONFIG_OF 127#ifdef CONFIG_OF
121extern struct gen_pool *of_get_named_gen_pool(struct device_node *np, 128extern struct gen_pool *of_get_named_gen_pool(struct device_node *np,
122 const char *propname, int index); 129 const char *propname, int index);
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h
index c0894dd8827b..667c31101b8b 100644
--- a/include/linux/genl_magic_func.h
+++ b/include/linux/genl_magic_func.h
@@ -178,12 +178,12 @@ static int s_name ## _from_attrs_for_change(struct s_name *s, \
178#define __assign(attr_nr, attr_flag, name, nla_type, type, assignment...) \ 178#define __assign(attr_nr, attr_flag, name, nla_type, type, assignment...) \
179 nla = ntb[attr_nr]; \ 179 nla = ntb[attr_nr]; \
180 if (nla) { \ 180 if (nla) { \
181 if (exclude_invariants && ((attr_flag) & DRBD_F_INVARIANT)) { \ 181 if (exclude_invariants && !!((attr_flag) & DRBD_F_INVARIANT)) { \
182 pr_info("<< must not change invariant attr: %s\n", #name); \ 182 pr_info("<< must not change invariant attr: %s\n", #name); \
183 return -EEXIST; \ 183 return -EEXIST; \
184 } \ 184 } \
185 assignment; \ 185 assignment; \
186 } else if (exclude_invariants && ((attr_flag) & DRBD_F_INVARIANT)) { \ 186 } else if (exclude_invariants && !!((attr_flag) & DRBD_F_INVARIANT)) { \
187 /* attribute missing from payload, */ \ 187 /* attribute missing from payload, */ \
188 /* which was expected */ \ 188 /* which was expected */ \
189 } else if ((attr_flag) & DRBD_F_REQUIRED) { \ 189 } else if ((attr_flag) & DRBD_F_REQUIRED) { \
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 6eb1fb37de9a..41b30fd4d041 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -156,7 +156,7 @@ struct vm_area_struct;
156#define GFP_DMA32 __GFP_DMA32 156#define GFP_DMA32 __GFP_DMA32
157 157
158/* Convert GFP flags to their corresponding migrate type */ 158/* Convert GFP flags to their corresponding migrate type */
159static inline int allocflags_to_migratetype(gfp_t gfp_flags) 159static inline int gfpflags_to_migratetype(const gfp_t gfp_flags)
160{ 160{
161 WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK); 161 WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK);
162 162
@@ -360,7 +360,7 @@ extern unsigned long get_zeroed_page(gfp_t gfp_mask);
360void *alloc_pages_exact(size_t size, gfp_t gfp_mask); 360void *alloc_pages_exact(size_t size, gfp_t gfp_mask);
361void free_pages_exact(void *virt, size_t size); 361void free_pages_exact(void *virt, size_t size);
362/* This is different from alloc_pages_exact_node !!! */ 362/* This is different from alloc_pages_exact_node !!! */
363void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask); 363void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask);
364 364
365#define __get_free_page(gfp_mask) \ 365#define __get_free_page(gfp_mask) \
366 __get_free_pages((gfp_mask), 0) 366 __get_free_pages((gfp_mask), 0)
diff --git a/include/linux/glob.h b/include/linux/glob.h
new file mode 100644
index 000000000000..861d8347d08e
--- /dev/null
+++ b/include/linux/glob.h
@@ -0,0 +1,9 @@
1#ifndef _LINUX_GLOB_H
2#define _LINUX_GLOB_H
3
4#include <linux/types.h> /* For bool */
5#include <linux/compiler.h> /* For __pure */
6
7bool __pure glob_match(char const *pat, char const *str);
8
9#endif /* _LINUX_GLOB_H */
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 05e53ccb708b..12f146fa6604 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -16,33 +16,54 @@ struct device;
16 */ 16 */
17struct gpio_desc; 17struct gpio_desc;
18 18
19#define GPIOD_FLAGS_BIT_DIR_SET BIT(0)
20#define GPIOD_FLAGS_BIT_DIR_OUT BIT(1)
21#define GPIOD_FLAGS_BIT_DIR_VAL BIT(2)
22
23/**
24 * Optional flags that can be passed to one of gpiod_* to configure direction
25 * and output value. These values cannot be OR'd.
26 */
27enum gpiod_flags {
28 GPIOD_ASIS = 0,
29 GPIOD_IN = GPIOD_FLAGS_BIT_DIR_SET,
30 GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT,
31 GPIOD_OUT_HIGH = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT |
32 GPIOD_FLAGS_BIT_DIR_VAL,
33};
34
19#ifdef CONFIG_GPIOLIB 35#ifdef CONFIG_GPIOLIB
20 36
21/* Acquire and dispose GPIOs */ 37/* Acquire and dispose GPIOs */
22struct gpio_desc *__must_check gpiod_get(struct device *dev, 38struct gpio_desc *__must_check __gpiod_get(struct device *dev,
23 const char *con_id); 39 const char *con_id,
24struct gpio_desc *__must_check gpiod_get_index(struct device *dev, 40 enum gpiod_flags flags);
41struct gpio_desc *__must_check __gpiod_get_index(struct device *dev,
25 const char *con_id, 42 const char *con_id,
26 unsigned int idx); 43 unsigned int idx,
27struct gpio_desc *__must_check gpiod_get_optional(struct device *dev, 44 enum gpiod_flags flags);
28 const char *con_id); 45struct gpio_desc *__must_check __gpiod_get_optional(struct device *dev,
29struct gpio_desc *__must_check gpiod_get_index_optional(struct device *dev, 46 const char *con_id,
47 enum gpiod_flags flags);
48struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev,
30 const char *con_id, 49 const char *con_id,
31 unsigned int index); 50 unsigned int index,
32 51 enum gpiod_flags flags);
33void gpiod_put(struct gpio_desc *desc); 52void gpiod_put(struct gpio_desc *desc);
34 53
35struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, 54struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev,
36 const char *con_id); 55 const char *con_id,
37struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, 56 enum gpiod_flags flags);
57struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev,
38 const char *con_id, 58 const char *con_id,
39 unsigned int idx); 59 unsigned int idx,
40struct gpio_desc *__must_check devm_gpiod_get_optional(struct device *dev, 60 enum gpiod_flags flags);
41 const char *con_id); 61struct gpio_desc *__must_check __devm_gpiod_get_optional(struct device *dev,
62 const char *con_id,
63 enum gpiod_flags flags);
42struct gpio_desc *__must_check 64struct gpio_desc *__must_check
43devm_gpiod_get_index_optional(struct device *dev, const char *con_id, 65__devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
44 unsigned int index); 66 unsigned int index, enum gpiod_flags flags);
45
46void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); 67void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
47 68
48int gpiod_get_direction(const struct gpio_desc *desc); 69int gpiod_get_direction(const struct gpio_desc *desc);
@@ -75,27 +96,31 @@ int desc_to_gpio(const struct gpio_desc *desc);
75 96
76#else /* CONFIG_GPIOLIB */ 97#else /* CONFIG_GPIOLIB */
77 98
78static inline struct gpio_desc *__must_check gpiod_get(struct device *dev, 99static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev,
79 const char *con_id) 100 const char *con_id,
101 enum gpiod_flags flags)
80{ 102{
81 return ERR_PTR(-ENOSYS); 103 return ERR_PTR(-ENOSYS);
82} 104}
83static inline struct gpio_desc *__must_check gpiod_get_index(struct device *dev, 105static inline struct gpio_desc *__must_check
84 const char *con_id, 106__gpiod_get_index(struct device *dev,
85 unsigned int idx) 107 const char *con_id,
108 unsigned int idx,
109 enum gpiod_flags flags)
86{ 110{
87 return ERR_PTR(-ENOSYS); 111 return ERR_PTR(-ENOSYS);
88} 112}
89 113
90static inline struct gpio_desc *__must_check 114static inline struct gpio_desc *__must_check
91gpiod_get_optional(struct device *dev, const char *con_id) 115__gpiod_get_optional(struct device *dev, const char *con_id,
116 enum gpiod_flags flags)
92{ 117{
93 return ERR_PTR(-ENOSYS); 118 return ERR_PTR(-ENOSYS);
94} 119}
95 120
96static inline struct gpio_desc *__must_check 121static inline struct gpio_desc *__must_check
97gpiod_get_index_optional(struct device *dev, const char *con_id, 122__gpiod_get_index_optional(struct device *dev, const char *con_id,
98 unsigned int index) 123 unsigned int index, enum gpiod_flags flags)
99{ 124{
100 return ERR_PTR(-ENOSYS); 125 return ERR_PTR(-ENOSYS);
101} 126}
@@ -108,28 +133,33 @@ static inline void gpiod_put(struct gpio_desc *desc)
108 WARN_ON(1); 133 WARN_ON(1);
109} 134}
110 135
111static inline struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, 136static inline struct gpio_desc *__must_check
112 const char *con_id) 137__devm_gpiod_get(struct device *dev,
138 const char *con_id,
139 enum gpiod_flags flags)
113{ 140{
114 return ERR_PTR(-ENOSYS); 141 return ERR_PTR(-ENOSYS);
115} 142}
116static inline 143static inline
117struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, 144struct gpio_desc *__must_check
118 const char *con_id, 145__devm_gpiod_get_index(struct device *dev,
119 unsigned int idx) 146 const char *con_id,
147 unsigned int idx,
148 enum gpiod_flags flags)
120{ 149{
121 return ERR_PTR(-ENOSYS); 150 return ERR_PTR(-ENOSYS);
122} 151}
123 152
124static inline struct gpio_desc *__must_check 153static inline struct gpio_desc *__must_check
125devm_gpiod_get_optional(struct device *dev, const char *con_id) 154__devm_gpiod_get_optional(struct device *dev, const char *con_id,
155 enum gpiod_flags flags)
126{ 156{
127 return ERR_PTR(-ENOSYS); 157 return ERR_PTR(-ENOSYS);
128} 158}
129 159
130static inline struct gpio_desc *__must_check 160static inline struct gpio_desc *__must_check
131devm_gpiod_get_index_optional(struct device *dev, const char *con_id, 161__devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
132 unsigned int index) 162 unsigned int index, enum gpiod_flags flags)
133{ 163{
134 return ERR_PTR(-ENOSYS); 164 return ERR_PTR(-ENOSYS);
135} 165}
@@ -254,9 +284,43 @@ static inline int desc_to_gpio(const struct gpio_desc *desc)
254 return -EINVAL; 284 return -EINVAL;
255} 285}
256 286
257
258#endif /* CONFIG_GPIOLIB */ 287#endif /* CONFIG_GPIOLIB */
259 288
289/*
290 * Vararg-hacks! This is done to transition the kernel to always pass
291 * the options flags argument to the below functions. During a transition
292 * phase these vararg macros make both old-and-newstyle code compile,
293 * but when all calls to the elder API are removed, these should go away
294 * and the __gpiod_get() etc functions above be renamed just gpiod_get()
295 * etc.
296 */
297#define __gpiod_get(dev, con_id, flags, ...) __gpiod_get(dev, con_id, flags)
298#define gpiod_get(varargs...) __gpiod_get(varargs, 0)
299#define __gpiod_get_index(dev, con_id, index, flags, ...) \
300 __gpiod_get_index(dev, con_id, index, flags)
301#define gpiod_get_index(varargs...) __gpiod_get_index(varargs, 0)
302#define __gpiod_get_optional(dev, con_id, flags, ...) \
303 __gpiod_get_optional(dev, con_id, flags)
304#define gpiod_get_optional(varargs...) __gpiod_get_optional(varargs, 0)
305#define __gpiod_get_index_optional(dev, con_id, index, flags, ...) \
306 __gpiod_get_index_optional(dev, con_id, index, flags)
307#define gpiod_get_index_optional(varargs...) \
308 __gpiod_get_index_optional(varargs, 0)
309#define __devm_gpiod_get(dev, con_id, flags, ...) \
310 __devm_gpiod_get(dev, con_id, flags)
311#define devm_gpiod_get(varargs...) __devm_gpiod_get(varargs, 0)
312#define __devm_gpiod_get_index(dev, con_id, index, flags, ...) \
313 __devm_gpiod_get_index(dev, con_id, index, flags)
314#define devm_gpiod_get_index(varargs...) __devm_gpiod_get_index(varargs, 0)
315#define __devm_gpiod_get_optional(dev, con_id, flags, ...) \
316 __devm_gpiod_get_optional(dev, con_id, flags)
317#define devm_gpiod_get_optional(varargs...) \
318 __devm_gpiod_get_optional(varargs, 0)
319#define __devm_gpiod_get_index_optional(dev, con_id, index, flags, ...) \
320 __devm_gpiod_get_index_optional(dev, con_id, index, flags)
321#define devm_gpiod_get_index_optional(varargs...) \
322 __devm_gpiod_get_index_optional(varargs, 0)
323
260#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) 324#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
261 325
262int gpiod_export(struct gpio_desc *desc, bool direction_may_change); 326int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 4fcd60913a42..249db3057e4d 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -56,6 +56,8 @@ struct seq_file;
56 * as the chip access may sleep when e.g. reading out the IRQ status 56 * as the chip access may sleep when e.g. reading out the IRQ status
57 * registers. 57 * registers.
58 * @exported: flags if the gpiochip is exported for use from sysfs. Private. 58 * @exported: flags if the gpiochip is exported for use from sysfs. Private.
59 * @irq_not_threaded: flag must be set if @can_sleep is set but the
60 * IRQs don't need to be threaded
59 * 61 *
60 * A gpio_chip can help platforms abstract various sources of GPIOs so 62 * A gpio_chip can help platforms abstract various sources of GPIOs so
61 * they can all be accessed through a common programing interface. 63 * they can all be accessed through a common programing interface.
@@ -101,6 +103,7 @@ struct gpio_chip {
101 struct gpio_desc *desc; 103 struct gpio_desc *desc;
102 const char *const *names; 104 const char *const *names;
103 bool can_sleep; 105 bool can_sleep;
106 bool irq_not_threaded;
104 bool exported; 107 bool exported;
105 108
106#ifdef CONFIG_GPIOLIB_IRQCHIP 109#ifdef CONFIG_GPIOLIB_IRQCHIP
@@ -141,73 +144,16 @@ extern const char *gpiochip_is_requested(struct gpio_chip *chip,
141 144
142/* add/remove chips */ 145/* add/remove chips */
143extern int gpiochip_add(struct gpio_chip *chip); 146extern int gpiochip_add(struct gpio_chip *chip);
144extern int __must_check gpiochip_remove(struct gpio_chip *chip); 147extern void gpiochip_remove(struct gpio_chip *chip);
145extern struct gpio_chip *gpiochip_find(void *data, 148extern struct gpio_chip *gpiochip_find(void *data,
146 int (*match)(struct gpio_chip *chip, void *data)); 149 int (*match)(struct gpio_chip *chip, void *data));
147 150
148/* lock/unlock as IRQ */ 151/* lock/unlock as IRQ */
149int gpiod_lock_as_irq(struct gpio_desc *desc); 152int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
150void gpiod_unlock_as_irq(struct gpio_desc *desc); 153void gpio_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
151 154
152struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc); 155struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
153 156
154struct gpio_desc *gpiochip_get_desc(struct gpio_chip *chip,
155 u16 hwnum);
156
157enum gpio_lookup_flags {
158 GPIO_ACTIVE_HIGH = (0 << 0),
159 GPIO_ACTIVE_LOW = (1 << 0),
160 GPIO_OPEN_DRAIN = (1 << 1),
161 GPIO_OPEN_SOURCE = (1 << 2),
162};
163
164/**
165 * struct gpiod_lookup - lookup table
166 * @chip_label: name of the chip the GPIO belongs to
167 * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO
168 * @con_id: name of the GPIO from the device's point of view
169 * @idx: index of the GPIO in case several GPIOs share the same name
170 * @flags: mask of GPIO_* values
171 *
172 * gpiod_lookup is a lookup table for associating GPIOs to specific devices and
173 * functions using platform data.
174 */
175struct gpiod_lookup {
176 const char *chip_label;
177 u16 chip_hwnum;
178 const char *con_id;
179 unsigned int idx;
180 enum gpio_lookup_flags flags;
181};
182
183struct gpiod_lookup_table {
184 struct list_head list;
185 const char *dev_id;
186 struct gpiod_lookup table[];
187};
188
189/*
190 * Simple definition of a single GPIO under a con_id
191 */
192#define GPIO_LOOKUP(_chip_label, _chip_hwnum, _con_id, _flags) \
193 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, 0, _flags)
194
195/*
196 * Use this macro if you need to have several GPIOs under the same con_id.
197 * Each GPIO needs to use a different index and can be accessed using
198 * gpiod_get_index()
199 */
200#define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, _idx, _flags) \
201{ \
202 .chip_label = _chip_label, \
203 .chip_hwnum = _chip_hwnum, \
204 .con_id = _con_id, \
205 .idx = _idx, \
206 .flags = _flags, \
207}
208
209void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
210
211#ifdef CONFIG_GPIOLIB_IRQCHIP 157#ifdef CONFIG_GPIOLIB_IRQCHIP
212 158
213void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip, 159void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,
@@ -223,6 +169,10 @@ int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
223 169
224#endif /* CONFIG_GPIOLIB_IRQCHIP */ 170#endif /* CONFIG_GPIOLIB_IRQCHIP */
225 171
172struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum,
173 const char *label);
174void gpiochip_free_own_desc(struct gpio_desc *desc);
175
226#else /* CONFIG_GPIOLIB */ 176#else /* CONFIG_GPIOLIB */
227 177
228static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) 178static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
diff --git a/include/linux/gpio/machine.h b/include/linux/gpio/machine.h
new file mode 100644
index 000000000000..e2706140eaff
--- /dev/null
+++ b/include/linux/gpio/machine.h
@@ -0,0 +1,61 @@
1#ifndef __LINUX_GPIO_MACHINE_H
2#define __LINUX_GPIO_MACHINE_H
3
4#include <linux/types.h>
5#include <linux/list.h>
6
7enum gpio_lookup_flags {
8 GPIO_ACTIVE_HIGH = (0 << 0),
9 GPIO_ACTIVE_LOW = (1 << 0),
10 GPIO_OPEN_DRAIN = (1 << 1),
11 GPIO_OPEN_SOURCE = (1 << 2),
12};
13
14/**
15 * struct gpiod_lookup - lookup table
16 * @chip_label: name of the chip the GPIO belongs to
17 * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO
18 * @con_id: name of the GPIO from the device's point of view
19 * @idx: index of the GPIO in case several GPIOs share the same name
20 * @flags: mask of GPIO_* values
21 *
22 * gpiod_lookup is a lookup table for associating GPIOs to specific devices and
23 * functions using platform data.
24 */
25struct gpiod_lookup {
26 const char *chip_label;
27 u16 chip_hwnum;
28 const char *con_id;
29 unsigned int idx;
30 enum gpio_lookup_flags flags;
31};
32
33struct gpiod_lookup_table {
34 struct list_head list;
35 const char *dev_id;
36 struct gpiod_lookup table[];
37};
38
39/*
40 * Simple definition of a single GPIO under a con_id
41 */
42#define GPIO_LOOKUP(_chip_label, _chip_hwnum, _con_id, _flags) \
43 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, 0, _flags)
44
45/*
46 * Use this macro if you need to have several GPIOs under the same con_id.
47 * Each GPIO needs to use a different index and can be accessed using
48 * gpiod_get_index()
49 */
50#define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, _idx, _flags) \
51{ \
52 .chip_label = _chip_label, \
53 .chip_hwnum = _chip_hwnum, \
54 .con_id = _con_id, \
55 .idx = _idx, \
56 .flags = _flags, \
57}
58
59void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
60
61#endif /* __LINUX_GPIO_MACHINE_H */
diff --git a/include/linux/hash.h b/include/linux/hash.h
index bd1754c7ecef..d0494c399392 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -37,6 +37,9 @@ static __always_inline u64 hash_64(u64 val, unsigned int bits)
37{ 37{
38 u64 hash = val; 38 u64 hash = val;
39 39
40#if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64
41 hash = hash * GOLDEN_RATIO_PRIME_64;
42#else
40 /* Sigh, gcc can't optimise this alone like it does for 32 bits. */ 43 /* Sigh, gcc can't optimise this alone like it does for 32 bits. */
41 u64 n = hash; 44 u64 n = hash;
42 n <<= 18; 45 n <<= 18;
@@ -51,6 +54,7 @@ static __always_inline u64 hash_64(u64 val, unsigned int bits)
51 hash += n; 54 hash += n;
52 n <<= 2; 55 n <<= 2;
53 hash += n; 56 hash += n;
57#endif
54 58
55 /* High bits are more random, so use them. */ 59 /* High bits are more random, so use them. */
56 return hash >> (64 - bits); 60 return hash >> (64 - bits);
diff --git a/include/linux/hid.h b/include/linux/hid.h
index fca74f1d5c84..78ea9bf941cd 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -265,6 +265,7 @@ struct hid_item {
265#define HID_CONNECT_HIDDEV 0x08 265#define HID_CONNECT_HIDDEV 0x08
266#define HID_CONNECT_HIDDEV_FORCE 0x10 266#define HID_CONNECT_HIDDEV_FORCE 0x10
267#define HID_CONNECT_FF 0x20 267#define HID_CONNECT_FF 0x20
268#define HID_CONNECT_DRIVER 0x40
268#define HID_CONNECT_DEFAULT (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| \ 269#define HID_CONNECT_DEFAULT (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| \
269 HID_CONNECT_HIDDEV|HID_CONNECT_FF) 270 HID_CONNECT_HIDDEV|HID_CONNECT_FF)
270 271
@@ -287,6 +288,7 @@ struct hid_item {
287#define HID_QUIRK_HIDINPUT_FORCE 0x00000080 288#define HID_QUIRK_HIDINPUT_FORCE 0x00000080
288#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100 289#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100
289#define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200 290#define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200
291#define HID_QUIRK_ALWAYS_POLL 0x00000400
290#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 292#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
291#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID 0x00020000 293#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID 0x00020000
292#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP 0x00040000 294#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP 0x00040000
@@ -312,6 +314,11 @@ struct hid_item {
312#define HID_GROUP_RMI 0x0100 314#define HID_GROUP_RMI 0x0100
313 315
314/* 316/*
317 * Vendor specific HID device groups
318 */
319#define HID_GROUP_WACOM 0x0101
320
321/*
315 * This is the global environment of the parser. This information is 322 * This is the global environment of the parser. This information is
316 * persistent for main-items. The global environment can be saved and 323 * persistent for main-items. The global environment can be saved and
317 * restored with PUSH/POP statements. 324 * restored with PUSH/POP statements.
@@ -435,6 +442,7 @@ struct hid_output_fifo {
435#define HID_CLAIMED_INPUT 1 442#define HID_CLAIMED_INPUT 1
436#define HID_CLAIMED_HIDDEV 2 443#define HID_CLAIMED_HIDDEV 2
437#define HID_CLAIMED_HIDRAW 4 444#define HID_CLAIMED_HIDRAW 4
445#define HID_CLAIMED_DRIVER 8
438 446
439#define HID_STAT_ADDED 1 447#define HID_STAT_ADDED 1
440#define HID_STAT_PARSED 2 448#define HID_STAT_PARSED 2
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 7fb31da45d03..9286a46b7d69 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -93,7 +93,7 @@ static inline int kmap_atomic_idx_push(void)
93 93
94#ifdef CONFIG_DEBUG_HIGHMEM 94#ifdef CONFIG_DEBUG_HIGHMEM
95 WARN_ON_ONCE(in_irq() && !irqs_disabled()); 95 WARN_ON_ONCE(in_irq() && !irqs_disabled());
96 BUG_ON(idx > KM_TYPE_NR); 96 BUG_ON(idx >= KM_TYPE_NR);
97#endif 97#endif
98 return idx; 98 return idx;
99} 99}
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index d2b52999e771..bb9840fd1e18 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -164,12 +164,15 @@ int host1x_job_submit(struct host1x_job *job);
164 */ 164 */
165 165
166struct host1x_reloc { 166struct host1x_reloc {
167 struct host1x_bo *cmdbuf; 167 struct {
168 u32 cmdbuf_offset; 168 struct host1x_bo *bo;
169 struct host1x_bo *target; 169 unsigned long offset;
170 u32 target_offset; 170 } cmdbuf;
171 u32 shift; 171 struct {
172 u32 pad; 172 struct host1x_bo *bo;
173 unsigned long offset;
174 } target;
175 unsigned long shift;
173}; 176};
174 177
175struct host1x_job { 178struct host1x_job {
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index b826239bdce0..ad9051bab267 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -93,10 +93,6 @@ extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
93#endif /* CONFIG_DEBUG_VM */ 93#endif /* CONFIG_DEBUG_VM */
94 94
95extern unsigned long transparent_hugepage_flags; 95extern unsigned long transparent_hugepage_flags;
96extern int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
97 pmd_t *dst_pmd, pmd_t *src_pmd,
98 struct vm_area_struct *vma,
99 unsigned long addr, unsigned long end);
100extern int split_huge_page_to_list(struct page *page, struct list_head *list); 96extern int split_huge_page_to_list(struct page *page, struct list_head *list);
101static inline int split_huge_page(struct page *page) 97static inline int split_huge_page(struct page *page)
102{ 98{
@@ -136,7 +132,7 @@ extern int __pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma,
136static inline int pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma, 132static inline int pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma,
137 spinlock_t **ptl) 133 spinlock_t **ptl)
138{ 134{
139 VM_BUG_ON(!rwsem_is_locked(&vma->vm_mm->mmap_sem)); 135 VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma);
140 if (pmd_trans_huge(*pmd)) 136 if (pmd_trans_huge(*pmd))
141 return __pmd_trans_huge_lock(pmd, vma, ptl); 137 return __pmd_trans_huge_lock(pmd, vma, ptl);
142 else 138 else
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index a23c096b3080..6e6d338641fe 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -87,7 +87,6 @@ pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
87#endif 87#endif
88 88
89extern unsigned long hugepages_treat_as_movable; 89extern unsigned long hugepages_treat_as_movable;
90extern const unsigned long hugetlb_zero, hugetlb_infinity;
91extern int sysctl_hugetlb_shm_group; 90extern int sysctl_hugetlb_shm_group;
92extern struct list_head huge_boot_pages; 91extern struct list_head huge_boot_pages;
93 92
diff --git a/include/linux/i2c/atmel_mxt_ts.h b/include/linux/i2c/atmel_mxt_ts.h
index 3891dc1de21c..02bf6ea31701 100644
--- a/include/linux/i2c/atmel_mxt_ts.h
+++ b/include/linux/i2c/atmel_mxt_ts.h
@@ -17,9 +17,6 @@
17 17
18/* The platform data for the Atmel maXTouch touchscreen driver */ 18/* The platform data for the Atmel maXTouch touchscreen driver */
19struct mxt_platform_data { 19struct mxt_platform_data {
20 const u8 *config;
21 size_t config_length;
22 u32 config_crc;
23 unsigned long irqflags; 20 unsigned long irqflags;
24 u8 t19_num_keys; 21 u8 t19_num_keys;
25 const unsigned int *t19_keymap; 22 const unsigned int *t19_keymap;
diff --git a/include/linux/i2c/s6000.h b/include/linux/i2c/s6000.h
deleted file mode 100644
index d9b34bfdae76..000000000000
--- a/include/linux/i2c/s6000.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __LINUX_I2C_S6000_H
2#define __LINUX_I2C_S6000_H
3
4struct s6_i2c_platform_data {
5 const char *clock; /* the clock to use */
6 int bus_num; /* the bus number to register */
7};
8
9#endif
10
diff --git a/include/linux/i82593.h b/include/linux/i82593.h
deleted file mode 100644
index afac5c7a323d..000000000000
--- a/include/linux/i82593.h
+++ /dev/null
@@ -1,229 +0,0 @@
1/*
2 * Definitions for Intel 82593 CSMA/CD Core LAN Controller
3 * The definitions are taken from the 1992 users manual with Intel
4 * order number 297125-001.
5 *
6 * /usr/src/pc/RCS/i82593.h,v 1.1 1996/07/17 15:23:12 root Exp
7 *
8 * Copyright 1994, Anders Klemets <klemets@it.kth.se>
9 *
10 * HISTORY
11 * i82593.h,v
12 * Revision 1.4 2005/11/4 09:15:00 baroniunas
13 * Modified copyright with permission of author as follows:
14 *
15 * "If I82539.H is the only file with my copyright statement
16 * that is included in the Source Forge project, then you have
17 * my approval to change the copyright statement to be a GPL
18 * license, in the way you proposed on October 10."
19 *
20 * Revision 1.1 1996/07/17 15:23:12 root
21 * Initial revision
22 *
23 * Revision 1.3 1995/04/05 15:13:58 adj
24 * Initial alpha release
25 *
26 * Revision 1.2 1994/06/16 23:57:31 klemets
27 * Mirrored all the fields in the configuration block.
28 *
29 * Revision 1.1 1994/06/02 20:25:34 klemets
30 * Initial revision
31 *
32 *
33 */
34#ifndef _I82593_H
35#define _I82593_H
36
37/* Intel 82593 CSMA/CD Core LAN Controller */
38
39/* Port 0 Command Register definitions */
40
41/* Execution operations */
42#define OP0_NOP 0 /* CHNL = 0 */
43#define OP0_SWIT_TO_PORT_1 0 /* CHNL = 1 */
44#define OP0_IA_SETUP 1
45#define OP0_CONFIGURE 2
46#define OP0_MC_SETUP 3
47#define OP0_TRANSMIT 4
48#define OP0_TDR 5
49#define OP0_DUMP 6
50#define OP0_DIAGNOSE 7
51#define OP0_TRANSMIT_NO_CRC 9
52#define OP0_RETRANSMIT 12
53#define OP0_ABORT 13
54/* Reception operations */
55#define OP0_RCV_ENABLE 8
56#define OP0_RCV_DISABLE 10
57#define OP0_STOP_RCV 11
58/* Status pointer control operations */
59#define OP0_FIX_PTR 15 /* CHNL = 1 */
60#define OP0_RLS_PTR 15 /* CHNL = 0 */
61#define OP0_RESET 14
62
63#define CR0_CHNL (1 << 4) /* 0=Channel 0, 1=Channel 1 */
64#define CR0_STATUS_0 0x00
65#define CR0_STATUS_1 0x20
66#define CR0_STATUS_2 0x40
67#define CR0_STATUS_3 0x60
68#define CR0_INT_ACK (1 << 7) /* 0=No ack, 1=acknowledge */
69
70/* Port 0 Status Register definitions */
71
72#define SR0_NO_RESULT 0 /* dummy */
73#define SR0_EVENT_MASK 0x0f
74#define SR0_IA_SETUP_DONE 1
75#define SR0_CONFIGURE_DONE 2
76#define SR0_MC_SETUP_DONE 3
77#define SR0_TRANSMIT_DONE 4
78#define SR0_TDR_DONE 5
79#define SR0_DUMP_DONE 6
80#define SR0_DIAGNOSE_PASSED 7
81#define SR0_TRANSMIT_NO_CRC_DONE 9
82#define SR0_RETRANSMIT_DONE 12
83#define SR0_EXECUTION_ABORTED 13
84#define SR0_END_OF_FRAME 8
85#define SR0_RECEPTION_ABORTED 10
86#define SR0_DIAGNOSE_FAILED 15
87#define SR0_STOP_REG_HIT 11
88
89#define SR0_CHNL (1 << 4)
90#define SR0_EXECUTION (1 << 5)
91#define SR0_RECEPTION (1 << 6)
92#define SR0_INTERRUPT (1 << 7)
93#define SR0_BOTH_RX_TX (SR0_EXECUTION | SR0_RECEPTION)
94
95#define SR3_EXEC_STATE_MASK 0x03
96#define SR3_EXEC_IDLE 0
97#define SR3_TX_ABORT_IN_PROGRESS 1
98#define SR3_EXEC_ACTIVE 2
99#define SR3_ABORT_IN_PROGRESS 3
100#define SR3_EXEC_CHNL (1 << 2)
101#define SR3_STP_ON_NO_RSRC (1 << 3)
102#define SR3_RCVING_NO_RSRC (1 << 4)
103#define SR3_RCV_STATE_MASK 0x60
104#define SR3_RCV_IDLE 0x00
105#define SR3_RCV_READY 0x20
106#define SR3_RCV_ACTIVE 0x40
107#define SR3_RCV_STOP_IN_PROG 0x60
108#define SR3_RCV_CHNL (1 << 7)
109
110/* Port 1 Command Register definitions */
111
112#define OP1_NOP 0
113#define OP1_SWIT_TO_PORT_0 1
114#define OP1_INT_DISABLE 2
115#define OP1_INT_ENABLE 3
116#define OP1_SET_TS 5
117#define OP1_RST_TS 7
118#define OP1_POWER_DOWN 8
119#define OP1_RESET_RING_MNGMT 11
120#define OP1_RESET 14
121#define OP1_SEL_RST 15
122
123#define CR1_STATUS_4 0x00
124#define CR1_STATUS_5 0x20
125#define CR1_STATUS_6 0x40
126#define CR1_STOP_REG_UPDATE (1 << 7)
127
128/* Receive frame status bits */
129
130#define RX_RCLD (1 << 0)
131#define RX_IA_MATCH (1 << 1)
132#define RX_NO_AD_MATCH (1 << 2)
133#define RX_NO_SFD (1 << 3)
134#define RX_SRT_FRM (1 << 7)
135#define RX_OVRRUN (1 << 8)
136#define RX_ALG_ERR (1 << 10)
137#define RX_CRC_ERR (1 << 11)
138#define RX_LEN_ERR (1 << 12)
139#define RX_RCV_OK (1 << 13)
140#define RX_TYP_LEN (1 << 15)
141
142/* Transmit status bits */
143
144#define TX_NCOL_MASK 0x0f
145#define TX_FRTL (1 << 4)
146#define TX_MAX_COL (1 << 5)
147#define TX_HRT_BEAT (1 << 6)
148#define TX_DEFER (1 << 7)
149#define TX_UND_RUN (1 << 8)
150#define TX_LOST_CTS (1 << 9)
151#define TX_LOST_CRS (1 << 10)
152#define TX_LTCOL (1 << 11)
153#define TX_OK (1 << 13)
154#define TX_COLL (1 << 15)
155
156struct i82593_conf_block {
157 u_char fifo_limit : 4,
158 forgnesi : 1,
159 fifo_32 : 1,
160 d6mod : 1,
161 throttle_enb : 1;
162 u_char throttle : 6,
163 cntrxint : 1,
164 contin : 1;
165 u_char addr_len : 3,
166 acloc : 1,
167 preamb_len : 2,
168 loopback : 2;
169 u_char lin_prio : 3,
170 tbofstop : 1,
171 exp_prio : 3,
172 bof_met : 1;
173 u_char : 4,
174 ifrm_spc : 4;
175 u_char : 5,
176 slottim_low : 3;
177 u_char slottim_hi : 3,
178 : 1,
179 max_retr : 4;
180 u_char prmisc : 1,
181 bc_dis : 1,
182 : 1,
183 crs_1 : 1,
184 nocrc_ins : 1,
185 crc_1632 : 1,
186 : 1,
187 crs_cdt : 1;
188 u_char cs_filter : 3,
189 crs_src : 1,
190 cd_filter : 3,
191 : 1;
192 u_char : 2,
193 min_fr_len : 6;
194 u_char lng_typ : 1,
195 lng_fld : 1,
196 rxcrc_xf : 1,
197 artx : 1,
198 sarec : 1,
199 tx_jabber : 1, /* why is this called max_len in the manual? */
200 hash_1 : 1,
201 lbpkpol : 1;
202 u_char : 6,
203 fdx : 1,
204 : 1;
205 u_char dummy_6 : 6, /* supposed to be ones */
206 mult_ia : 1,
207 dis_bof : 1;
208 u_char dummy_1 : 1, /* supposed to be one */
209 tx_ifs_retrig : 2,
210 mc_all : 1,
211 rcv_mon : 2,
212 frag_acpt : 1,
213 tstrttrs : 1;
214 u_char fretx : 1,
215 runt_eop : 1,
216 hw_sw_pin : 1,
217 big_endn : 1,
218 syncrqs : 1,
219 sttlen : 1,
220 tx_eop : 1,
221 rx_eop : 1;
222 u_char rbuf_size : 5,
223 rcvstop : 1,
224 : 2;
225};
226
227#define I82593_MAX_MULTICAST_ADDRESSES 128 /* Hardware hashed filter */
228
229#endif /* _I82593_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 63ab3873c5ed..b1be39c76931 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -6,6 +6,7 @@
6 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> 6 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
7 * Copyright (c) 2005, Devicescape Software, Inc. 7 * Copyright (c) 2005, Devicescape Software, Inc.
8 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net> 8 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
9 * Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * 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 * it under the terms of the GNU General Public License version 2 as
@@ -165,8 +166,12 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
165 166
166#define IEEE80211_MAX_MESH_ID_LEN 32 167#define IEEE80211_MAX_MESH_ID_LEN 32
167 168
169#define IEEE80211_FIRST_TSPEC_TSID 8
168#define IEEE80211_NUM_TIDS 16 170#define IEEE80211_NUM_TIDS 16
169 171
172/* number of user priorities 802.11 uses */
173#define IEEE80211_NUM_UPS 8
174
170#define IEEE80211_QOS_CTL_LEN 2 175#define IEEE80211_QOS_CTL_LEN 2
171/* 1d tag mask */ 176/* 1d tag mask */
172#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 177#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
@@ -838,6 +843,16 @@ enum ieee80211_vht_opmode_bits {
838 843
839#define WLAN_SA_QUERY_TR_ID_LEN 2 844#define WLAN_SA_QUERY_TR_ID_LEN 2
840 845
846/**
847 * struct ieee80211_tpc_report_ie
848 *
849 * This structure refers to "TPC Report element"
850 */
851struct ieee80211_tpc_report_ie {
852 u8 tx_power;
853 u8 link_margin;
854} __packed;
855
841struct ieee80211_mgmt { 856struct ieee80211_mgmt {
842 __le16 frame_control; 857 __le16 frame_control;
843 __le16 duration; 858 __le16 duration;
@@ -973,6 +988,13 @@ struct ieee80211_mgmt {
973 u8 action_code; 988 u8 action_code;
974 u8 operating_mode; 989 u8 operating_mode;
975 } __packed vht_opmode_notif; 990 } __packed vht_opmode_notif;
991 struct {
992 u8 action_code;
993 u8 dialog_token;
994 u8 tpc_elem_id;
995 u8 tpc_elem_length;
996 struct ieee80211_tpc_report_ie tpc;
997 } __packed tpc_report;
976 } u; 998 } u;
977 } __packed action; 999 } __packed action;
978 } u; 1000 } u;
@@ -1806,7 +1828,8 @@ enum ieee80211_eid {
1806 WLAN_EID_DMG_TSPEC = 146, 1828 WLAN_EID_DMG_TSPEC = 146,
1807 WLAN_EID_DMG_AT = 147, 1829 WLAN_EID_DMG_AT = 147,
1808 WLAN_EID_DMG_CAP = 148, 1830 WLAN_EID_DMG_CAP = 148,
1809 /* 149-150 reserved for Cisco */ 1831 /* 149 reserved for Cisco */
1832 WLAN_EID_CISCO_VENDOR_SPECIFIC = 150,
1810 WLAN_EID_DMG_OPERATION = 151, 1833 WLAN_EID_DMG_OPERATION = 151,
1811 WLAN_EID_DMG_BSS_PARAM_CHANGE = 152, 1834 WLAN_EID_DMG_BSS_PARAM_CHANGE = 152,
1812 WLAN_EID_DMG_BEAM_REFINEMENT = 153, 1835 WLAN_EID_DMG_BEAM_REFINEMENT = 153,
@@ -1865,6 +1888,7 @@ enum ieee80211_category {
1865 WLAN_CATEGORY_DLS = 2, 1888 WLAN_CATEGORY_DLS = 2,
1866 WLAN_CATEGORY_BACK = 3, 1889 WLAN_CATEGORY_BACK = 3,
1867 WLAN_CATEGORY_PUBLIC = 4, 1890 WLAN_CATEGORY_PUBLIC = 4,
1891 WLAN_CATEGORY_RADIO_MEASUREMENT = 5,
1868 WLAN_CATEGORY_HT = 7, 1892 WLAN_CATEGORY_HT = 7,
1869 WLAN_CATEGORY_SA_QUERY = 8, 1893 WLAN_CATEGORY_SA_QUERY = 8,
1870 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9, 1894 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
@@ -2378,4 +2402,51 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
2378#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024)) 2402#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024))
2379#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x)) 2403#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x))
2380 2404
2405/**
2406 * ieee80211_action_contains_tpc - checks if the frame contains TPC element
2407 * @skb: the skb containing the frame, length will be checked
2408 *
2409 * This function checks if it's either TPC report action frame or Link
2410 * Measurement report action frame as defined in IEEE Std. 802.11-2012 8.5.2.5
2411 * and 8.5.7.5 accordingly.
2412 */
2413static inline bool ieee80211_action_contains_tpc(struct sk_buff *skb)
2414{
2415 struct ieee80211_mgmt *mgmt = (void *)skb->data;
2416
2417 if (!ieee80211_is_action(mgmt->frame_control))
2418 return false;
2419
2420 if (skb->len < IEEE80211_MIN_ACTION_SIZE +
2421 sizeof(mgmt->u.action.u.tpc_report))
2422 return false;
2423
2424 /*
2425 * TPC report - check that:
2426 * category = 0 (Spectrum Management) or 5 (Radio Measurement)
2427 * spectrum management action = 3 (TPC/Link Measurement report)
2428 * TPC report EID = 35
2429 * TPC report element length = 2
2430 *
2431 * The spectrum management's tpc_report struct is used here both for
2432 * parsing tpc_report and radio measurement's link measurement report
2433 * frame, since the relevant part is identical in both frames.
2434 */
2435 if (mgmt->u.action.category != WLAN_CATEGORY_SPECTRUM_MGMT &&
2436 mgmt->u.action.category != WLAN_CATEGORY_RADIO_MEASUREMENT)
2437 return false;
2438
2439 /* both spectrum mgmt and link measurement have same action code */
2440 if (mgmt->u.action.u.tpc_report.action_code !=
2441 WLAN_ACTION_SPCT_TPC_RPRT)
2442 return false;
2443
2444 if (mgmt->u.action.u.tpc_report.tpc_elem_id != WLAN_EID_TPC_REPORT ||
2445 mgmt->u.action.u.tpc_report.tpc_elem_length !=
2446 sizeof(struct ieee80211_tpc_report_ie))
2447 return false;
2448
2449 return true;
2450}
2451
2381#endif /* LINUX_IEEE80211_H */ 2452#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 6b2c7cf352a5..6f6929ea8a0c 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -60,6 +60,7 @@ struct macvlan_dev {
60#ifdef CONFIG_NET_POLL_CONTROLLER 60#ifdef CONFIG_NET_POLL_CONTROLLER
61 struct netpoll *netpoll; 61 struct netpoll *netpoll;
62#endif 62#endif
63 unsigned int macaddr_count;
63}; 64};
64 65
65static inline void macvlan_count_rx(const struct macvlan_dev *vlan, 66static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 4967916fe4ac..d69f0577a319 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -187,7 +187,6 @@ vlan_dev_get_egress_qos_mask(struct net_device *dev, u32 skprio)
187} 187}
188 188
189extern bool vlan_do_receive(struct sk_buff **skb); 189extern bool vlan_do_receive(struct sk_buff **skb);
190extern struct sk_buff *vlan_untag(struct sk_buff *skb);
191 190
192extern int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid); 191extern int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid);
193extern void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid); 192extern void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid);
@@ -241,11 +240,6 @@ static inline bool vlan_do_receive(struct sk_buff **skb)
241 return false; 240 return false;
242} 241}
243 242
244static inline struct sk_buff *vlan_untag(struct sk_buff *skb)
245{
246 return skb;
247}
248
249static inline int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid) 243static inline int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid)
250{ 244{
251 return 0; 245 return 0;
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index f47550d75f85..2c677afeea47 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -39,6 +39,7 @@ static inline struct igmpv3_query *
39 39
40extern int sysctl_igmp_max_memberships; 40extern int sysctl_igmp_max_memberships;
41extern int sysctl_igmp_max_msf; 41extern int sysctl_igmp_max_msf;
42extern int sysctl_igmp_qrv;
42 43
43struct ip_sf_socklist { 44struct ip_sf_socklist {
44 unsigned int sl_max; 45 unsigned int sl_max;
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index 4b79ffe7b188..fa76c79a52a1 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -84,10 +84,12 @@ static inline void iio_trigger_put(struct iio_trigger *trig)
84 put_device(&trig->dev); 84 put_device(&trig->dev);
85} 85}
86 86
87static inline void iio_trigger_get(struct iio_trigger *trig) 87static inline struct iio_trigger *iio_trigger_get(struct iio_trigger *trig)
88{ 88{
89 get_device(&trig->dev); 89 get_device(&trig->dev);
90 __module_get(trig->ops->owner); 90 __module_get(trig->ops->owner);
91
92 return trig;
91} 93}
92 94
93/** 95/**
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 7cf5e9b32550..120ccc53fcb7 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -15,7 +15,7 @@ struct linux_binprm;
15 15
16#ifdef CONFIG_IMA 16#ifdef CONFIG_IMA
17extern int ima_bprm_check(struct linux_binprm *bprm); 17extern int ima_bprm_check(struct linux_binprm *bprm);
18extern int ima_file_check(struct file *file, int mask); 18extern int ima_file_check(struct file *file, int mask, int opened);
19extern void ima_file_free(struct file *file); 19extern void ima_file_free(struct file *file);
20extern int ima_file_mmap(struct file *file, unsigned long prot); 20extern int ima_file_mmap(struct file *file, unsigned long prot);
21extern int ima_module_check(struct file *file); 21extern int ima_module_check(struct file *file);
@@ -27,7 +27,7 @@ static inline int ima_bprm_check(struct linux_binprm *bprm)
27 return 0; 27 return 0;
28} 28}
29 29
30static inline int ima_file_check(struct file *file, int mask) 30static inline int ima_file_check(struct file *file, int mask, int opened)
31{ 31{
32 return 0; 32 return 0;
33} 33}
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 2bb4c4f3531a..77fc43f8fb72 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -111,12 +111,21 @@ extern struct group_info init_groups;
111#ifdef CONFIG_PREEMPT_RCU 111#ifdef CONFIG_PREEMPT_RCU
112#define INIT_TASK_RCU_PREEMPT(tsk) \ 112#define INIT_TASK_RCU_PREEMPT(tsk) \
113 .rcu_read_lock_nesting = 0, \ 113 .rcu_read_lock_nesting = 0, \
114 .rcu_read_unlock_special = 0, \ 114 .rcu_read_unlock_special.s = 0, \
115 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \ 115 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \
116 INIT_TASK_RCU_TREE_PREEMPT() 116 INIT_TASK_RCU_TREE_PREEMPT()
117#else 117#else
118#define INIT_TASK_RCU_PREEMPT(tsk) 118#define INIT_TASK_RCU_PREEMPT(tsk)
119#endif 119#endif
120#ifdef CONFIG_TASKS_RCU
121#define INIT_TASK_RCU_TASKS(tsk) \
122 .rcu_tasks_holdout = false, \
123 .rcu_tasks_holdout_list = \
124 LIST_HEAD_INIT(tsk.rcu_tasks_holdout_list), \
125 .rcu_tasks_idle_cpu = -1,
126#else
127#define INIT_TASK_RCU_TASKS(tsk)
128#endif
120 129
121extern struct cred init_cred; 130extern struct cred init_cred;
122 131
@@ -224,6 +233,7 @@ extern struct task_group root_task_group;
224 INIT_FTRACE_GRAPH \ 233 INIT_FTRACE_GRAPH \
225 INIT_TRACE_RECURSION \ 234 INIT_TRACE_RECURSION \
226 INIT_TASK_RCU_PREEMPT(tsk) \ 235 INIT_TASK_RCU_PREEMPT(tsk) \
236 INIT_TASK_RCU_TASKS(tsk) \
227 INIT_CPUSET_SEQ(tsk) \ 237 INIT_CPUSET_SEQ(tsk) \
228 INIT_RT_MUTEXES(tsk) \ 238 INIT_RT_MUTEXES(tsk) \
229 INIT_VTIME(tsk) \ 239 INIT_VTIME(tsk) \
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
index 1b1dfa80d9ff..f583ff639776 100644
--- a/include/linux/input/mt.h
+++ b/include/linux/input/mt.h
@@ -105,6 +105,7 @@ void input_mt_report_slot_state(struct input_dev *dev,
105 105
106void input_mt_report_finger_count(struct input_dev *dev, int count); 106void input_mt_report_finger_count(struct input_dev *dev, int count);
107void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count); 107void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count);
108void input_mt_drop_unused(struct input_dev *dev);
108 109
109void input_mt_sync_frame(struct input_dev *dev); 110void input_mt_sync_frame(struct input_dev *dev);
110 111
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
index 160cf353aa39..7bae83b7c396 100644
--- a/include/linux/input/pixcir_ts.h
+++ b/include/linux/input/pixcir_ts.h
@@ -43,10 +43,22 @@ enum pixcir_int_mode {
43#define PIXCIR_INT_ENABLE (1UL << 3) 43#define PIXCIR_INT_ENABLE (1UL << 3)
44#define PIXCIR_INT_POL_HIGH (1UL << 2) 44#define PIXCIR_INT_POL_HIGH (1UL << 2)
45 45
46/**
47 * struct pixcir_irc_chip_data - chip related data
48 * @max_fingers: Max number of fingers reported simultaneously by h/w
49 * @has_hw_ids: Hardware supports finger tracking IDs
50 *
51 */
52struct pixcir_i2c_chip_data {
53 u8 max_fingers;
54 bool has_hw_ids;
55};
56
46struct pixcir_ts_platform_data { 57struct pixcir_ts_platform_data {
47 int x_max; 58 int x_max;
48 int y_max; 59 int y_max;
49 int gpio_attb; /* GPIO connected to ATTB line */ 60 int gpio_attb; /* GPIO connected to ATTB line */
61 struct pixcir_i2c_chip_data chip;
50}; 62};
51 63
52#endif 64#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 698ad053d064..69517a24bc50 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -193,11 +193,6 @@ extern void irq_wake_thread(unsigned int irq, void *dev_id);
193/* The following three functions are for the core kernel use only. */ 193/* The following three functions are for the core kernel use only. */
194extern void suspend_device_irqs(void); 194extern void suspend_device_irqs(void);
195extern void resume_device_irqs(void); 195extern void resume_device_irqs(void);
196#ifdef CONFIG_PM_SLEEP
197extern int check_wakeup_irqs(void);
198#else
199static inline int check_wakeup_irqs(void) { return 0; }
200#endif
201 196
202/** 197/**
203 * struct irq_affinity_notify - context for notification of IRQ affinity changes 198 * struct irq_affinity_notify - context for notification of IRQ affinity changes
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 20f9a527922a..e6a7c9ff72f2 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -57,8 +57,11 @@ struct iommu_domain {
57 struct iommu_domain_geometry geometry; 57 struct iommu_domain_geometry geometry;
58}; 58};
59 59
60#define IOMMU_CAP_CACHE_COHERENCY 0x1 60enum iommu_cap {
61#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ 61 IOMMU_CAP_CACHE_COHERENCY, /* IOMMU can enforce cache coherent DMA
62 transactions */
63 IOMMU_CAP_INTR_REMAP, /* IOMMU supports interrupt isolation */
64};
62 65
63/* 66/*
64 * Following constraints are specifc to FSL_PAMUV1: 67 * Following constraints are specifc to FSL_PAMUV1:
@@ -80,6 +83,7 @@ enum iommu_attr {
80 DOMAIN_ATTR_FSL_PAMU_STASH, 83 DOMAIN_ATTR_FSL_PAMU_STASH,
81 DOMAIN_ATTR_FSL_PAMU_ENABLE, 84 DOMAIN_ATTR_FSL_PAMU_ENABLE,
82 DOMAIN_ATTR_FSL_PAMUV1, 85 DOMAIN_ATTR_FSL_PAMUV1,
86 DOMAIN_ATTR_NESTING, /* two stages of translation */
83 DOMAIN_ATTR_MAX, 87 DOMAIN_ATTR_MAX,
84}; 88};
85 89
@@ -94,7 +98,6 @@ enum iommu_attr {
94 * @map: map a physically contiguous memory region to an iommu domain 98 * @map: map a physically contiguous memory region to an iommu domain
95 * @unmap: unmap a physically contiguous memory region from an iommu domain 99 * @unmap: unmap a physically contiguous memory region from an iommu domain
96 * @iova_to_phys: translate iova to physical address 100 * @iova_to_phys: translate iova to physical address
97 * @domain_has_cap: domain capabilities query
98 * @add_device: add device to iommu grouping 101 * @add_device: add device to iommu grouping
99 * @remove_device: remove device from iommu grouping 102 * @remove_device: remove device from iommu grouping
100 * @domain_get_attr: Query domain attributes 103 * @domain_get_attr: Query domain attributes
@@ -102,6 +105,7 @@ enum iommu_attr {
102 * @pgsize_bitmap: bitmap of supported page sizes 105 * @pgsize_bitmap: bitmap of supported page sizes
103 */ 106 */
104struct iommu_ops { 107struct iommu_ops {
108 bool (*capable)(enum iommu_cap);
105 int (*domain_init)(struct iommu_domain *domain); 109 int (*domain_init)(struct iommu_domain *domain);
106 void (*domain_destroy)(struct iommu_domain *domain); 110 void (*domain_destroy)(struct iommu_domain *domain);
107 int (*attach_dev)(struct iommu_domain *domain, struct device *dev); 111 int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
@@ -111,8 +115,6 @@ struct iommu_ops {
111 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, 115 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
112 size_t size); 116 size_t size);
113 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova); 117 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova);
114 int (*domain_has_cap)(struct iommu_domain *domain,
115 unsigned long cap);
116 int (*add_device)(struct device *dev); 118 int (*add_device)(struct device *dev);
117 void (*remove_device)(struct device *dev); 119 void (*remove_device)(struct device *dev);
118 int (*device_group)(struct device *dev, unsigned int *groupid); 120 int (*device_group)(struct device *dev, unsigned int *groupid);
@@ -142,6 +144,7 @@ struct iommu_ops {
142 144
143extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops); 145extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops);
144extern bool iommu_present(struct bus_type *bus); 146extern bool iommu_present(struct bus_type *bus);
147extern bool iommu_capable(struct bus_type *bus, enum iommu_cap cap);
145extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); 148extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
146extern struct iommu_group *iommu_group_get_by_id(int id); 149extern struct iommu_group *iommu_group_get_by_id(int id);
147extern void iommu_domain_free(struct iommu_domain *domain); 150extern void iommu_domain_free(struct iommu_domain *domain);
@@ -154,8 +157,6 @@ extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
154extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, 157extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
155 size_t size); 158 size_t size);
156extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); 159extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
157extern int iommu_domain_has_cap(struct iommu_domain *domain,
158 unsigned long cap);
159extern void iommu_set_fault_handler(struct iommu_domain *domain, 160extern void iommu_set_fault_handler(struct iommu_domain *domain,
160 iommu_fault_handler_t handler, void *token); 161 iommu_fault_handler_t handler, void *token);
161 162
@@ -250,6 +251,11 @@ static inline bool iommu_present(struct bus_type *bus)
250 return false; 251 return false;
251} 252}
252 253
254static inline bool iommu_capable(struct bus_type *bus, enum iommu_cap cap)
255{
256 return false;
257}
258
253static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) 259static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
254{ 260{
255 return NULL; 261 return NULL;
@@ -304,12 +310,6 @@ static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_ad
304 return 0; 310 return 0;
305} 311}
306 312
307static inline int iommu_domain_has_cap(struct iommu_domain *domain,
308 unsigned long cap)
309{
310 return 0;
311}
312
313static inline void iommu_set_fault_handler(struct iommu_domain *domain, 313static inline void iommu_set_fault_handler(struct iommu_domain *domain,
314 iommu_fault_handler_t handler, void *token) 314 iommu_fault_handler_t handler, void *token)
315{ 315{
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 5e3a906cc089..2c5250222278 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -215,6 +215,11 @@ static inline int __deprecated check_region(resource_size_t s,
215 215
216/* Wrappers for managed devices */ 216/* Wrappers for managed devices */
217struct device; 217struct device;
218
219extern int devm_request_resource(struct device *dev, struct resource *root,
220 struct resource *new);
221extern void devm_release_resource(struct device *dev, struct resource *new);
222
218#define devm_request_region(dev,start,n,name) \ 223#define devm_request_region(dev,start,n,name) \
219 __devm_request_region(dev, &ioport_resource, (start), (n), (name)) 224 __devm_request_region(dev, &ioport_resource, (start), (n), (name))
220#define devm_request_mem_region(dev,start,n,name) \ 225#define devm_request_mem_region(dev,start,n,name) \
@@ -237,6 +242,12 @@ extern int iomem_is_exclusive(u64 addr);
237extern int 242extern int
238walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, 243walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
239 void *arg, int (*func)(unsigned long, unsigned long, void *)); 244 void *arg, int (*func)(unsigned long, unsigned long, void *));
245extern int
246walk_system_ram_res(u64 start, u64 end, void *arg,
247 int (*func)(u64, u64, void *));
248extern int
249walk_iomem_res(char *name, unsigned long flags, u64 start, u64 end, void *arg,
250 int (*func)(u64, u64, void *));
240 251
241/* True if any part of r1 overlaps r2 */ 252/* True if any part of r1 overlaps r2 */
242static inline bool resource_overlaps(struct resource *r1, struct resource *r2) 253static inline bool resource_overlaps(struct resource *r1, struct resource *r2)
diff --git a/include/linux/ipack.h b/include/linux/ipack.h
index 1888e06ddf64..8bddc3fbdddf 100644
--- a/include/linux/ipack.h
+++ b/include/linux/ipack.h
@@ -172,6 +172,7 @@ struct ipack_bus_ops {
172 * @ops: bus operations for the mezzanine drivers 172 * @ops: bus operations for the mezzanine drivers
173 */ 173 */
174struct ipack_bus_device { 174struct ipack_bus_device {
175 struct module *owner;
175 struct device *parent; 176 struct device *parent;
176 int slots; 177 int slots;
177 int bus_nr; 178 int bus_nr;
@@ -189,7 +190,8 @@ struct ipack_bus_device {
189 * available bus device in ipack. 190 * available bus device in ipack.
190 */ 191 */
191struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots, 192struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots,
192 const struct ipack_bus_ops *ops); 193 const struct ipack_bus_ops *ops,
194 struct module *owner);
193 195
194/** 196/**
195 * ipack_bus_unregister -- unregister an ipack bus 197 * ipack_bus_unregister -- unregister an ipack bus
@@ -265,3 +267,23 @@ void ipack_put_device(struct ipack_device *dev);
265 .format = (_format), \ 267 .format = (_format), \
266 .vendor = (vend), \ 268 .vendor = (vend), \
267 .device = (dev) 269 .device = (dev)
270
271/**
272 * ipack_get_carrier - it increase the carrier ref. counter of
273 * the carrier module
274 * @dev: mezzanine device which wants to get the carrier
275 */
276static inline int ipack_get_carrier(struct ipack_device *dev)
277{
278 return try_module_get(dev->bus->owner);
279}
280
281/**
282 * ipack_get_carrier - it decrease the carrier ref. counter of
283 * the carrier module
284 * @dev: mezzanine device which wants to get the carrier
285 */
286static inline void ipack_put_carrier(struct ipack_device *dev)
287{
288 module_put(dev->bus->owner);
289}
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 62af59242ddc..03f48d936f66 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -173,6 +173,7 @@ struct irq_data {
173 * IRQD_IRQ_DISABLED - Disabled state of the interrupt 173 * IRQD_IRQ_DISABLED - Disabled state of the interrupt
174 * IRQD_IRQ_MASKED - Masked state of the interrupt 174 * IRQD_IRQ_MASKED - Masked state of the interrupt
175 * IRQD_IRQ_INPROGRESS - In progress state of the interrupt 175 * IRQD_IRQ_INPROGRESS - In progress state of the interrupt
176 * IRQD_WAKEUP_ARMED - Wakeup mode armed
176 */ 177 */
177enum { 178enum {
178 IRQD_TRIGGER_MASK = 0xf, 179 IRQD_TRIGGER_MASK = 0xf,
@@ -186,6 +187,7 @@ enum {
186 IRQD_IRQ_DISABLED = (1 << 16), 187 IRQD_IRQ_DISABLED = (1 << 16),
187 IRQD_IRQ_MASKED = (1 << 17), 188 IRQD_IRQ_MASKED = (1 << 17),
188 IRQD_IRQ_INPROGRESS = (1 << 18), 189 IRQD_IRQ_INPROGRESS = (1 << 18),
190 IRQD_WAKEUP_ARMED = (1 << 19),
189}; 191};
190 192
191static inline bool irqd_is_setaffinity_pending(struct irq_data *d) 193static inline bool irqd_is_setaffinity_pending(struct irq_data *d)
@@ -257,6 +259,12 @@ static inline bool irqd_irq_inprogress(struct irq_data *d)
257 return d->state_use_accessors & IRQD_IRQ_INPROGRESS; 259 return d->state_use_accessors & IRQD_IRQ_INPROGRESS;
258} 260}
259 261
262static inline bool irqd_is_wakeup_armed(struct irq_data *d)
263{
264 return d->state_use_accessors & IRQD_WAKEUP_ARMED;
265}
266
267
260/* 268/*
261 * Functions for chained handlers which can be enabled/disabled by the 269 * Functions for chained handlers which can be enabled/disabled by the
262 * standard disable_irq/enable_irq calls. Must be called with 270 * standard disable_irq/enable_irq calls. Must be called with
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index bf9422c3aefe..bf3fe719c7ce 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -39,9 +39,12 @@ bool irq_work_queue_on(struct irq_work *work, int cpu);
39#endif 39#endif
40 40
41void irq_work_run(void); 41void irq_work_run(void);
42void irq_work_tick(void);
42void irq_work_sync(struct irq_work *work); 43void irq_work_sync(struct irq_work *work);
43 44
44#ifdef CONFIG_IRQ_WORK 45#ifdef CONFIG_IRQ_WORK
46#include <asm/irq_work.h>
47
45bool irq_work_needs_cpu(void); 48bool irq_work_needs_cpu(void);
46#else 49#else
47static inline bool irq_work_needs_cpu(void) { return false; } 50static inline bool irq_work_needs_cpu(void) { return false; }
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 45e2d8c15bd2..13eed92c7d24 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -21,7 +21,11 @@
21#define GIC_CPU_ACTIVEPRIO 0xd0 21#define GIC_CPU_ACTIVEPRIO 0xd0
22#define GIC_CPU_IDENT 0xfc 22#define GIC_CPU_IDENT 0xfc
23 23
24#define GICC_ENABLE 0x1
25#define GICC_INT_PRI_THRESHOLD 0xf0
24#define GICC_IAR_INT_ID_MASK 0x3ff 26#define GICC_IAR_INT_ID_MASK 0x3ff
27#define GICC_INT_SPURIOUS 1023
28#define GICC_DIS_BYPASS_MASK 0x1e0
25 29
26#define GIC_DIST_CTRL 0x000 30#define GIC_DIST_CTRL 0x000
27#define GIC_DIST_CTR 0x004 31#define GIC_DIST_CTR 0x004
@@ -39,6 +43,18 @@
39#define GIC_DIST_SGI_PENDING_CLEAR 0xf10 43#define GIC_DIST_SGI_PENDING_CLEAR 0xf10
40#define GIC_DIST_SGI_PENDING_SET 0xf20 44#define GIC_DIST_SGI_PENDING_SET 0xf20
41 45
46#define GICD_ENABLE 0x1
47#define GICD_DISABLE 0x0
48#define GICD_INT_ACTLOW_LVLTRIG 0x0
49#define GICD_INT_EN_CLR_X32 0xffffffff
50#define GICD_INT_EN_SET_SGI 0x0000ffff
51#define GICD_INT_EN_CLR_PPI 0xffff0000
52#define GICD_INT_DEF_PRI 0xa0
53#define GICD_INT_DEF_PRI_X4 ((GICD_INT_DEF_PRI << 24) |\
54 (GICD_INT_DEF_PRI << 16) |\
55 (GICD_INT_DEF_PRI << 8) |\
56 GICD_INT_DEF_PRI)
57
42#define GICH_HCR 0x0 58#define GICH_HCR 0x0
43#define GICH_VTR 0x4 59#define GICH_VTR 0x4
44#define GICH_VMCR 0x8 60#define GICH_VMCR 0x8
diff --git a/include/linux/irqchip/irq-omap-intc.h b/include/linux/irqchip/irq-omap-intc.h
new file mode 100644
index 000000000000..e06b370cfc0d
--- /dev/null
+++ b/include/linux/irqchip/irq-omap-intc.h
@@ -0,0 +1,32 @@
1/**
2 * irq-omap-intc.h - INTC Idle Functions
3 *
4 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Author: Felipe Balbi <balbi@ti.com>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 of
10 * the License 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 __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H
19#define __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H
20
21void omap2_init_irq(void);
22void omap3_init_irq(void);
23void ti81xx_init_irq(void);
24
25int omap_irq_pending(void);
26void omap_intc_save_context(void);
27void omap_intc_restore_context(void);
28void omap3_intc_suspend(void);
29void omap3_intc_prepare_idle(void);
30void omap3_intc_resume_idle(void);
31
32#endif /* __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H */
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 472c021a2d4f..faf433af425e 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -12,6 +12,8 @@ struct irq_affinity_notify;
12struct proc_dir_entry; 12struct proc_dir_entry;
13struct module; 13struct module;
14struct irq_desc; 14struct irq_desc;
15struct irq_domain;
16struct pt_regs;
15 17
16/** 18/**
17 * struct irq_desc - interrupt descriptor 19 * struct irq_desc - interrupt descriptor
@@ -36,6 +38,11 @@ struct irq_desc;
36 * @threads_oneshot: bitfield to handle shared oneshot threads 38 * @threads_oneshot: bitfield to handle shared oneshot threads
37 * @threads_active: number of irqaction threads currently running 39 * @threads_active: number of irqaction threads currently running
38 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers 40 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
41 * @nr_actions: number of installed actions on this descriptor
42 * @no_suspend_depth: number of irqactions on a irq descriptor with
43 * IRQF_NO_SUSPEND set
44 * @force_resume_depth: number of irqactions on a irq descriptor with
45 * IRQF_FORCE_RESUME set
39 * @dir: /proc/irq/ procfs entry 46 * @dir: /proc/irq/ procfs entry
40 * @name: flow handler name for /proc/interrupts output 47 * @name: flow handler name for /proc/interrupts output
41 */ 48 */
@@ -68,6 +75,11 @@ struct irq_desc {
68 unsigned long threads_oneshot; 75 unsigned long threads_oneshot;
69 atomic_t threads_active; 76 atomic_t threads_active;
70 wait_queue_head_t wait_for_threads; 77 wait_queue_head_t wait_for_threads;
78#ifdef CONFIG_PM_SLEEP
79 unsigned int nr_actions;
80 unsigned int no_suspend_depth;
81 unsigned int force_resume_depth;
82#endif
71#ifdef CONFIG_PROC_FS 83#ifdef CONFIG_PROC_FS
72 struct proc_dir_entry *dir; 84 struct proc_dir_entry *dir;
73#endif 85#endif
@@ -118,6 +130,23 @@ static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *de
118 130
119int generic_handle_irq(unsigned int irq); 131int generic_handle_irq(unsigned int irq);
120 132
133#ifdef CONFIG_HANDLE_DOMAIN_IRQ
134/*
135 * Convert a HW interrupt number to a logical one using a IRQ domain,
136 * and handle the result interrupt number. Return -EINVAL if
137 * conversion failed. Providing a NULL domain indicates that the
138 * conversion has already been done.
139 */
140int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
141 bool lookup, struct pt_regs *regs);
142
143static inline int handle_domain_irq(struct irq_domain *domain,
144 unsigned int hwirq, struct pt_regs *regs)
145{
146 return __handle_domain_irq(domain, hwirq, true, regs);
147}
148#endif
149
121/* Test to see if a driver has successfully requested an irq */ 150/* Test to see if a driver has successfully requested an irq */
122static inline int irq_has_action(unsigned int irq) 151static inline int irq_has_action(unsigned int irq)
123{ 152{
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index d5b50a19463c..704b9a599b26 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -159,7 +159,11 @@ typedef struct journal_header_s
159 * journal_block_tag (in the descriptor). The other h_chksum* fields are 159 * journal_block_tag (in the descriptor). The other h_chksum* fields are
160 * not used. 160 * not used.
161 * 161 *
162 * Checksum v1 and v2 are mutually exclusive features. 162 * If FEATURE_INCOMPAT_CSUM_V3 is set, the descriptor block uses
163 * journal_block_tag3_t to store a full 32-bit checksum. Everything else
164 * is the same as v2.
165 *
166 * Checksum v1, v2, and v3 are mutually exclusive features.
163 */ 167 */
164struct commit_header { 168struct commit_header {
165 __be32 h_magic; 169 __be32 h_magic;
@@ -179,6 +183,14 @@ struct commit_header {
179 * raw struct shouldn't be used for pointer math or sizeof() - use 183 * raw struct shouldn't be used for pointer math or sizeof() - use
180 * journal_tag_bytes(journal) instead to compute this. 184 * journal_tag_bytes(journal) instead to compute this.
181 */ 185 */
186typedef struct journal_block_tag3_s
187{
188 __be32 t_blocknr; /* The on-disk block number */
189 __be32 t_flags; /* See below */
190 __be32 t_blocknr_high; /* most-significant high 32bits. */
191 __be32 t_checksum; /* crc32c(uuid+seq+block) */
192} journal_block_tag3_t;
193
182typedef struct journal_block_tag_s 194typedef struct journal_block_tag_s
183{ 195{
184 __be32 t_blocknr; /* The on-disk block number */ 196 __be32 t_blocknr; /* The on-disk block number */
@@ -187,9 +199,6 @@ typedef struct journal_block_tag_s
187 __be32 t_blocknr_high; /* most-significant high 32bits. */ 199 __be32 t_blocknr_high; /* most-significant high 32bits. */
188} journal_block_tag_t; 200} journal_block_tag_t;
189 201
190#define JBD2_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high))
191#define JBD2_TAG_SIZE64 (sizeof(journal_block_tag_t))
192
193/* Tail of descriptor block, for checksumming */ 202/* Tail of descriptor block, for checksumming */
194struct jbd2_journal_block_tail { 203struct jbd2_journal_block_tail {
195 __be32 t_checksum; /* crc32c(uuid+descr_block) */ 204 __be32 t_checksum; /* crc32c(uuid+descr_block) */
@@ -284,6 +293,7 @@ typedef struct journal_superblock_s
284#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002 293#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002
285#define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004 294#define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004
286#define JBD2_FEATURE_INCOMPAT_CSUM_V2 0x00000008 295#define JBD2_FEATURE_INCOMPAT_CSUM_V2 0x00000008
296#define JBD2_FEATURE_INCOMPAT_CSUM_V3 0x00000010
287 297
288/* Features known to this kernel version: */ 298/* Features known to this kernel version: */
289#define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM 299#define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM
@@ -291,7 +301,8 @@ typedef struct journal_superblock_s
291#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \ 301#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \
292 JBD2_FEATURE_INCOMPAT_64BIT | \ 302 JBD2_FEATURE_INCOMPAT_64BIT | \
293 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | \ 303 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | \
294 JBD2_FEATURE_INCOMPAT_CSUM_V2) 304 JBD2_FEATURE_INCOMPAT_CSUM_V2 | \
305 JBD2_FEATURE_INCOMPAT_CSUM_V3)
295 306
296#ifdef __KERNEL__ 307#ifdef __KERNEL__
297 308
@@ -1031,7 +1042,7 @@ void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
1031extern void jbd2_journal_commit_transaction(journal_t *); 1042extern void jbd2_journal_commit_transaction(journal_t *);
1032 1043
1033/* Checkpoint list management */ 1044/* Checkpoint list management */
1034int __jbd2_journal_clean_checkpoint_list(journal_t *journal); 1045void __jbd2_journal_clean_checkpoint_list(journal_t *journal);
1035int __jbd2_journal_remove_checkpoint(struct journal_head *); 1046int __jbd2_journal_remove_checkpoint(struct journal_head *);
1036void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *); 1047void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);
1037 1048
@@ -1296,6 +1307,15 @@ static inline int tid_geq(tid_t x, tid_t y)
1296extern int jbd2_journal_blocks_per_page(struct inode *inode); 1307extern int jbd2_journal_blocks_per_page(struct inode *inode);
1297extern size_t journal_tag_bytes(journal_t *journal); 1308extern size_t journal_tag_bytes(journal_t *journal);
1298 1309
1310static inline int jbd2_journal_has_csum_v2or3(journal_t *journal)
1311{
1312 if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2) ||
1313 JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3))
1314 return 1;
1315
1316 return 0;
1317}
1318
1299/* 1319/*
1300 * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for 1320 * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for
1301 * transaction control blocks. 1321 * transaction control blocks.
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 1f44466c1e9d..c367cbdf73ab 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -258,23 +258,11 @@ extern unsigned long preset_lpj;
258#define SEC_JIFFIE_SC (32 - SHIFT_HZ) 258#define SEC_JIFFIE_SC (32 - SHIFT_HZ)
259#endif 259#endif
260#define NSEC_JIFFIE_SC (SEC_JIFFIE_SC + 29) 260#define NSEC_JIFFIE_SC (SEC_JIFFIE_SC + 29)
261#define USEC_JIFFIE_SC (SEC_JIFFIE_SC + 19)
262#define SEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) +\ 261#define SEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) +\
263 TICK_NSEC -1) / (u64)TICK_NSEC)) 262 TICK_NSEC -1) / (u64)TICK_NSEC))
264 263
265#define NSEC_CONVERSION ((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) +\ 264#define NSEC_CONVERSION ((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) +\
266 TICK_NSEC -1) / (u64)TICK_NSEC)) 265 TICK_NSEC -1) / (u64)TICK_NSEC))
267#define USEC_CONVERSION \
268 ((unsigned long)((((u64)NSEC_PER_USEC << USEC_JIFFIE_SC) +\
269 TICK_NSEC -1) / (u64)TICK_NSEC))
270/*
271 * USEC_ROUND is used in the timeval to jiffie conversion. See there
272 * for more details. It is the scaled resolution rounding value. Note
273 * that it is a 64-bit value. Since, when it is applied, we are already
274 * in jiffies (albit scaled), it is nothing but the bits we will shift
275 * off.
276 */
277#define USEC_ROUND (u64)(((u64)1 << USEC_JIFFIE_SC) - 1)
278/* 266/*
279 * The maximum jiffie value is (MAX_INT >> 1). Here we translate that 267 * The maximum jiffie value is (MAX_INT >> 1). Here we translate that
280 * into seconds. The 64-bit case will overflow if we are not careful, 268 * into seconds. The 64-bit case will overflow if we are not careful,
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 784304b222b3..98f923b6a0ea 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -8,28 +8,28 @@
8 * Copyright (C) 2011-2012 Peter Zijlstra <pzijlstr@redhat.com> 8 * Copyright (C) 2011-2012 Peter Zijlstra <pzijlstr@redhat.com>
9 * 9 *
10 * Jump labels provide an interface to generate dynamic branches using 10 * Jump labels provide an interface to generate dynamic branches using
11 * self-modifying code. Assuming toolchain and architecture support the result 11 * self-modifying code. Assuming toolchain and architecture support, the result
12 * of a "if (static_key_false(&key))" statement is a unconditional branch (which 12 * of a "if (static_key_false(&key))" statement is an unconditional branch (which
13 * defaults to false - and the true block is placed out of line). 13 * defaults to false - and the true block is placed out of line).
14 * 14 *
15 * However at runtime we can change the branch target using 15 * However at runtime we can change the branch target using
16 * static_key_slow_{inc,dec}(). These function as a 'reference' count on the key 16 * static_key_slow_{inc,dec}(). These function as a 'reference' count on the key
17 * object and for as long as there are references all branches referring to 17 * object, and for as long as there are references all branches referring to
18 * that particular key will point to the (out of line) true block. 18 * that particular key will point to the (out of line) true block.
19 * 19 *
20 * Since this relies on modifying code the static_key_slow_{inc,dec}() functions 20 * Since this relies on modifying code, the static_key_slow_{inc,dec}() functions
21 * must be considered absolute slow paths (machine wide synchronization etc.). 21 * must be considered absolute slow paths (machine wide synchronization etc.).
22 * OTOH, since the affected branches are unconditional their runtime overhead 22 * OTOH, since the affected branches are unconditional, their runtime overhead
23 * will be absolutely minimal, esp. in the default (off) case where the total 23 * will be absolutely minimal, esp. in the default (off) case where the total
24 * effect is a single NOP of appropriate size. The on case will patch in a jump 24 * effect is a single NOP of appropriate size. The on case will patch in a jump
25 * to the out-of-line block. 25 * to the out-of-line block.
26 * 26 *
27 * When the control is directly exposed to userspace it is prudent to delay the 27 * When the control is directly exposed to userspace, it is prudent to delay the
28 * decrement to avoid high frequency code modifications which can (and do) 28 * decrement to avoid high frequency code modifications which can (and do)
29 * cause significant performance degradation. Struct static_key_deferred and 29 * cause significant performance degradation. Struct static_key_deferred and
30 * static_key_slow_dec_deferred() provide for this. 30 * static_key_slow_dec_deferred() provide for this.
31 * 31 *
32 * Lacking toolchain and or architecture support, it falls back to a simple 32 * Lacking toolchain and or architecture support, jump labels fall back to a simple
33 * conditional branch. 33 * conditional branch.
34 * 34 *
35 * struct static_key my_key = STATIC_KEY_INIT_TRUE; 35 * struct static_key my_key = STATIC_KEY_INIT_TRUE;
@@ -43,8 +43,7 @@
43 * 43 *
44 * Not initializing the key (static data is initialized to 0s anyway) is the 44 * Not initializing the key (static data is initialized to 0s anyway) is the
45 * same as using STATIC_KEY_INIT_FALSE. 45 * same as using STATIC_KEY_INIT_FALSE.
46 * 46 */
47*/
48 47
49#include <linux/types.h> 48#include <linux/types.h>
50#include <linux/compiler.h> 49#include <linux/compiler.h>
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index a9e2268ecccb..3d770f5564b8 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -376,10 +376,6 @@ extern unsigned long simple_strtoul(const char *,char **,unsigned int);
376extern long simple_strtol(const char *,char **,unsigned int); 376extern long simple_strtol(const char *,char **,unsigned int);
377extern unsigned long long simple_strtoull(const char *,char **,unsigned int); 377extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
378extern long long simple_strtoll(const char *,char **,unsigned int); 378extern long long simple_strtoll(const char *,char **,unsigned int);
379#define strict_strtoul kstrtoul
380#define strict_strtol kstrtol
381#define strict_strtoull kstrtoull
382#define strict_strtoll kstrtoll
383 379
384extern int num_to_str(char *buf, int size, unsigned long long num); 380extern int num_to_str(char *buf, int size, unsigned long long num);
385 381
@@ -407,6 +403,7 @@ int vsscanf(const char *, const char *, va_list);
407extern int get_option(char **str, int *pint); 403extern int get_option(char **str, int *pint);
408extern char *get_options(const char *str, int nints, int *ints); 404extern char *get_options(const char *str, int nints, int *ints);
409extern unsigned long long memparse(const char *ptr, char **retptr); 405extern unsigned long long memparse(const char *ptr, char **retptr);
406extern bool parse_option_str(const char *str, const char *option);
410 407
411extern int core_kernel_text(unsigned long addr); 408extern int core_kernel_text(unsigned long addr);
412extern int core_kernel_data(unsigned long addr); 409extern int core_kernel_data(unsigned long addr);
@@ -470,6 +467,7 @@ extern enum system_states {
470#define TAINT_FIRMWARE_WORKAROUND 11 467#define TAINT_FIRMWARE_WORKAROUND 11
471#define TAINT_OOT_MODULE 12 468#define TAINT_OOT_MODULE 12
472#define TAINT_UNSIGNED_MODULE 13 469#define TAINT_UNSIGNED_MODULE 13
470#define TAINT_SOFTLOCKUP 14
473 471
474extern const char hex_asc[]; 472extern const char hex_asc[];
475#define hex_asc_lo(x) hex_asc[((x) & 0x0f)] 473#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
@@ -493,13 +491,9 @@ static inline char *hex_byte_pack_upper(char *buf, u8 byte)
493 return buf; 491 return buf;
494} 492}
495 493
496static inline char * __deprecated pack_hex_byte(char *buf, u8 byte)
497{
498 return hex_byte_pack(buf, byte);
499}
500
501extern int hex_to_bin(char ch); 494extern int hex_to_bin(char ch);
502extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); 495extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
496extern char *bin2hex(char *dst, const void *src, size_t count);
503 497
504bool mac_pton(const char *s, u8 *mac); 498bool mac_pton(const char *s, u8 *mac);
505 499
@@ -719,23 +713,8 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
719 (void) (&_max1 == &_max2); \ 713 (void) (&_max1 == &_max2); \
720 _max1 > _max2 ? _max1 : _max2; }) 714 _max1 > _max2 ? _max1 : _max2; })
721 715
722#define min3(x, y, z) ({ \ 716#define min3(x, y, z) min((typeof(x))min(x, y), z)
723 typeof(x) _min1 = (x); \ 717#define max3(x, y, z) max((typeof(x))max(x, y), z)
724 typeof(y) _min2 = (y); \
725 typeof(z) _min3 = (z); \
726 (void) (&_min1 == &_min2); \
727 (void) (&_min1 == &_min3); \
728 _min1 < _min2 ? (_min1 < _min3 ? _min1 : _min3) : \
729 (_min2 < _min3 ? _min2 : _min3); })
730
731#define max3(x, y, z) ({ \
732 typeof(x) _max1 = (x); \
733 typeof(y) _max2 = (y); \
734 typeof(z) _max3 = (z); \
735 (void) (&_max1 == &_max2); \
736 (void) (&_max1 == &_max3); \
737 _max1 > _max2 ? (_max1 > _max3 ? _max1 : _max3) : \
738 (_max2 > _max3 ? _max2 : _max3); })
739 718
740/** 719/**
741 * min_not_zero - return the minimum that is _not_ zero, unless both are zero 720 * min_not_zero - return the minimum that is _not_ zero, unless both are zero
@@ -750,20 +729,13 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
750/** 729/**
751 * clamp - return a value clamped to a given range with strict typechecking 730 * clamp - return a value clamped to a given range with strict typechecking
752 * @val: current value 731 * @val: current value
753 * @min: minimum allowable value 732 * @lo: lowest allowable value
754 * @max: maximum allowable value 733 * @hi: highest allowable value
755 * 734 *
756 * This macro does strict typechecking of min/max to make sure they are of the 735 * This macro does strict typechecking of lo/hi to make sure they are of the
757 * same type as val. See the unnecessary pointer comparisons. 736 * same type as val. See the unnecessary pointer comparisons.
758 */ 737 */
759#define clamp(val, min, max) ({ \ 738#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
760 typeof(val) __val = (val); \
761 typeof(min) __min = (min); \
762 typeof(max) __max = (max); \
763 (void) (&__val == &__min); \
764 (void) (&__val == &__max); \
765 __val = __val < __min ? __min: __val; \
766 __val > __max ? __max: __val; })
767 739
768/* 740/*
769 * ..and if you can't take the strict 741 * ..and if you can't take the strict
@@ -785,36 +757,26 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
785 * clamp_t - return a value clamped to a given range using a given type 757 * clamp_t - return a value clamped to a given range using a given type
786 * @type: the type of variable to use 758 * @type: the type of variable to use
787 * @val: current value 759 * @val: current value
788 * @min: minimum allowable value 760 * @lo: minimum allowable value
789 * @max: maximum allowable value 761 * @hi: maximum allowable value
790 * 762 *
791 * This macro does no typechecking and uses temporary variables of type 763 * This macro does no typechecking and uses temporary variables of type
792 * 'type' to make all the comparisons. 764 * 'type' to make all the comparisons.
793 */ 765 */
794#define clamp_t(type, val, min, max) ({ \ 766#define clamp_t(type, val, lo, hi) min_t(type, max_t(type, val, lo), hi)
795 type __val = (val); \
796 type __min = (min); \
797 type __max = (max); \
798 __val = __val < __min ? __min: __val; \
799 __val > __max ? __max: __val; })
800 767
801/** 768/**
802 * clamp_val - return a value clamped to a given range using val's type 769 * clamp_val - return a value clamped to a given range using val's type
803 * @val: current value 770 * @val: current value
804 * @min: minimum allowable value 771 * @lo: minimum allowable value
805 * @max: maximum allowable value 772 * @hi: maximum allowable value
806 * 773 *
807 * This macro does no typechecking and uses temporary variables of whatever 774 * This macro does no typechecking and uses temporary variables of whatever
808 * type the input argument 'val' is. This is useful when val is an unsigned 775 * type the input argument 'val' is. This is useful when val is an unsigned
809 * type and min and max are literals that will otherwise be assigned a signed 776 * type and min and max are literals that will otherwise be assigned a signed
810 * integer type. 777 * integer type.
811 */ 778 */
812#define clamp_val(val, min, max) ({ \ 779#define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi)
813 typeof(val) __val = (val); \
814 typeof(val) __min = (min); \
815 typeof(val) __max = (max); \
816 __val = __val < __min ? __min: __val; \
817 __val > __max ? __max: __val; })
818 780
819 781
820/* 782/*
@@ -849,5 +811,7 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
849 /* User perms >= group perms >= other perms */ \ 811 /* User perms >= group perms >= other perms */ \
850 BUILD_BUG_ON_ZERO(((perms) >> 6) < (((perms) >> 3) & 7)) + \ 812 BUILD_BUG_ON_ZERO(((perms) >> 6) < (((perms) >> 3) & 7)) + \
851 BUILD_BUG_ON_ZERO((((perms) >> 3) & 7) < ((perms) & 7)) + \ 813 BUILD_BUG_ON_ZERO((((perms) >> 3) & 7) < ((perms) & 7)) + \
814 /* Other writable? Generally considered a bad idea. */ \
815 BUILD_BUG_ON_ZERO((perms) & 2) + \
852 (perms)) 816 (perms))
853#endif 817#endif
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index ecbc52f9ff77..8422b4ed6882 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -44,8 +44,8 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);
44DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat); 44DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
45 45
46/* Must have preemption disabled for this to be meaningful. */ 46/* Must have preemption disabled for this to be meaningful. */
47#define kstat_this_cpu (&__get_cpu_var(kstat)) 47#define kstat_this_cpu this_cpu_ptr(&kstat)
48#define kcpustat_this_cpu (&__get_cpu_var(kernel_cpustat)) 48#define kcpustat_this_cpu this_cpu_ptr(&kernel_cpustat)
49#define kstat_cpu(cpu) per_cpu(kstat, cpu) 49#define kstat_cpu(cpu) per_cpu(kstat, cpu)
50#define kcpustat_cpu(cpu) per_cpu(kernel_cpustat, cpu) 50#define kcpustat_cpu(cpu) per_cpu(kernel_cpustat, cpu)
51 51
diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h
index 9be37da93680..e985ba679c4a 100644
--- a/include/linux/kernelcapi.h
+++ b/include/linux/kernelcapi.h
@@ -41,7 +41,7 @@ u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]);
41u16 capi20_get_version(u32 contr, struct capi_version *verp); 41u16 capi20_get_version(u32 contr, struct capi_version *verp);
42u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]); 42u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
43u16 capi20_get_profile(u32 contr, struct capi_profile *profp); 43u16 capi20_get_profile(u32 contr, struct capi_profile *profp);
44int capi20_manufacturer(unsigned int cmd, void __user *data); 44int capi20_manufacturer(unsigned long cmd, void __user *data);
45 45
46#define CAPICTR_UP 0 46#define CAPICTR_UP 0
47#define CAPICTR_DOWN 1 47#define CAPICTR_DOWN 1
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index a75641930049..9d957b7ae095 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -10,6 +10,7 @@
10#include <linux/ioport.h> 10#include <linux/ioport.h>
11#include <linux/elfcore.h> 11#include <linux/elfcore.h>
12#include <linux/elf.h> 12#include <linux/elf.h>
13#include <linux/module.h>
13#include <asm/kexec.h> 14#include <asm/kexec.h>
14 15
15/* Verify architecture specific macros are defined */ 16/* Verify architecture specific macros are defined */
@@ -69,7 +70,18 @@ typedef unsigned long kimage_entry_t;
69#define IND_SOURCE 0x8 70#define IND_SOURCE 0x8
70 71
71struct kexec_segment { 72struct kexec_segment {
72 void __user *buf; 73 /*
74 * This pointer can point to user memory if kexec_load() system
75 * call is used or will point to kernel memory if
76 * kexec_file_load() system call is used.
77 *
78 * Use ->buf when expecting to deal with user memory and use ->kbuf
79 * when expecting to deal with kernel memory.
80 */
81 union {
82 void __user *buf;
83 void *kbuf;
84 };
73 size_t bufsz; 85 size_t bufsz;
74 unsigned long mem; 86 unsigned long mem;
75 size_t memsz; 87 size_t memsz;
@@ -84,6 +96,27 @@ struct compat_kexec_segment {
84}; 96};
85#endif 97#endif
86 98
99struct kexec_sha_region {
100 unsigned long start;
101 unsigned long len;
102};
103
104struct purgatory_info {
105 /* Pointer to elf header of read only purgatory */
106 Elf_Ehdr *ehdr;
107
108 /* Pointer to purgatory sechdrs which are modifiable */
109 Elf_Shdr *sechdrs;
110 /*
111 * Temporary buffer location where purgatory is loaded and relocated
112 * This memory can be freed post image load
113 */
114 void *purgatory_buf;
115
116 /* Address where purgatory is finally loaded and is executed from */
117 unsigned long purgatory_load_addr;
118};
119
87struct kimage { 120struct kimage {
88 kimage_entry_t head; 121 kimage_entry_t head;
89 kimage_entry_t *entry; 122 kimage_entry_t *entry;
@@ -100,7 +133,7 @@ struct kimage {
100 133
101 struct list_head control_pages; 134 struct list_head control_pages;
102 struct list_head dest_pages; 135 struct list_head dest_pages;
103 struct list_head unuseable_pages; 136 struct list_head unusable_pages;
104 137
105 /* Address of next control page to allocate for crash kernels. */ 138 /* Address of next control page to allocate for crash kernels. */
106 unsigned long control_page; 139 unsigned long control_page;
@@ -110,13 +143,64 @@ struct kimage {
110#define KEXEC_TYPE_DEFAULT 0 143#define KEXEC_TYPE_DEFAULT 0
111#define KEXEC_TYPE_CRASH 1 144#define KEXEC_TYPE_CRASH 1
112 unsigned int preserve_context : 1; 145 unsigned int preserve_context : 1;
146 /* If set, we are using file mode kexec syscall */
147 unsigned int file_mode:1;
113 148
114#ifdef ARCH_HAS_KIMAGE_ARCH 149#ifdef ARCH_HAS_KIMAGE_ARCH
115 struct kimage_arch arch; 150 struct kimage_arch arch;
116#endif 151#endif
152
153 /* Additional fields for file based kexec syscall */
154 void *kernel_buf;
155 unsigned long kernel_buf_len;
156
157 void *initrd_buf;
158 unsigned long initrd_buf_len;
159
160 char *cmdline_buf;
161 unsigned long cmdline_buf_len;
162
163 /* File operations provided by image loader */
164 struct kexec_file_ops *fops;
165
166 /* Image loader handling the kernel can store a pointer here */
167 void *image_loader_data;
168
169 /* Information for loading purgatory */
170 struct purgatory_info purgatory_info;
117}; 171};
118 172
173/*
174 * Keeps track of buffer parameters as provided by caller for requesting
175 * memory placement of buffer.
176 */
177struct kexec_buf {
178 struct kimage *image;
179 char *buffer;
180 unsigned long bufsz;
181 unsigned long mem;
182 unsigned long memsz;
183 unsigned long buf_align;
184 unsigned long buf_min;
185 unsigned long buf_max;
186 bool top_down; /* allocate from top of memory hole */
187};
119 188
189typedef int (kexec_probe_t)(const char *kernel_buf, unsigned long kernel_size);
190typedef void *(kexec_load_t)(struct kimage *image, char *kernel_buf,
191 unsigned long kernel_len, char *initrd,
192 unsigned long initrd_len, char *cmdline,
193 unsigned long cmdline_len);
194typedef int (kexec_cleanup_t)(void *loader_data);
195typedef int (kexec_verify_sig_t)(const char *kernel_buf,
196 unsigned long kernel_len);
197
198struct kexec_file_ops {
199 kexec_probe_t *probe;
200 kexec_load_t *load;
201 kexec_cleanup_t *cleanup;
202 kexec_verify_sig_t *verify_sig;
203};
120 204
121/* kexec interface functions */ 205/* kexec interface functions */
122extern void machine_kexec(struct kimage *image); 206extern void machine_kexec(struct kimage *image);
@@ -127,8 +211,21 @@ extern asmlinkage long sys_kexec_load(unsigned long entry,
127 struct kexec_segment __user *segments, 211 struct kexec_segment __user *segments,
128 unsigned long flags); 212 unsigned long flags);
129extern int kernel_kexec(void); 213extern int kernel_kexec(void);
214extern int kexec_add_buffer(struct kimage *image, char *buffer,
215 unsigned long bufsz, unsigned long memsz,
216 unsigned long buf_align, unsigned long buf_min,
217 unsigned long buf_max, bool top_down,
218 unsigned long *load_addr);
130extern struct page *kimage_alloc_control_pages(struct kimage *image, 219extern struct page *kimage_alloc_control_pages(struct kimage *image,
131 unsigned int order); 220 unsigned int order);
221extern int kexec_load_purgatory(struct kimage *image, unsigned long min,
222 unsigned long max, int top_down,
223 unsigned long *load_addr);
224extern int kexec_purgatory_get_set_symbol(struct kimage *image,
225 const char *name, void *buf,
226 unsigned int size, bool get_value);
227extern void *kexec_purgatory_get_symbol_addr(struct kimage *image,
228 const char *name);
132extern void crash_kexec(struct pt_regs *); 229extern void crash_kexec(struct pt_regs *);
133int kexec_should_crash(struct task_struct *); 230int kexec_should_crash(struct task_struct *);
134void crash_save_cpu(struct pt_regs *regs, int cpu); 231void crash_save_cpu(struct pt_regs *regs, int cpu);
@@ -177,6 +274,10 @@ extern int kexec_load_disabled;
177#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT) 274#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)
178#endif 275#endif
179 276
277/* List of defined/legal kexec file flags */
278#define KEXEC_FILE_FLAGS (KEXEC_FILE_UNLOAD | KEXEC_FILE_ON_CRASH | \
279 KEXEC_FILE_NO_INITRAMFS)
280
180#define VMCOREINFO_BYTES (4096) 281#define VMCOREINFO_BYTES (4096)
181#define VMCOREINFO_NOTE_NAME "VMCOREINFO" 282#define VMCOREINFO_NOTE_NAME "VMCOREINFO"
182#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4) 283#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4)
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index 44792ee649de..ff9f1d394235 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -53,6 +53,24 @@ typedef int (*request_key_actor_t)(struct key_construction *key,
53 const char *op, void *aux); 53 const char *op, void *aux);
54 54
55/* 55/*
56 * Preparsed matching criterion.
57 */
58struct key_match_data {
59 /* Comparison function, defaults to exact description match, but can be
60 * overridden by type->match_preparse(). Should return true if a match
61 * is found and false if not.
62 */
63 bool (*cmp)(const struct key *key,
64 const struct key_match_data *match_data);
65
66 const void *raw_data; /* Raw match data */
67 void *preparsed; /* For ->match_preparse() to stash stuff */
68 unsigned lookup_type; /* Type of lookup for this search. */
69#define KEYRING_SEARCH_LOOKUP_DIRECT 0x0000 /* Direct lookup by description. */
70#define KEYRING_SEARCH_LOOKUP_ITERATE 0x0001 /* Iterative search. */
71};
72
73/*
56 * kernel managed key type definition 74 * kernel managed key type definition
57 */ 75 */
58struct key_type { 76struct key_type {
@@ -65,11 +83,6 @@ struct key_type {
65 */ 83 */
66 size_t def_datalen; 84 size_t def_datalen;
67 85
68 /* Default key search algorithm. */
69 unsigned def_lookup_type;
70#define KEYRING_SEARCH_LOOKUP_DIRECT 0x0000 /* Direct lookup by description. */
71#define KEYRING_SEARCH_LOOKUP_ITERATE 0x0001 /* Iterative search. */
72
73 /* vet a description */ 86 /* vet a description */
74 int (*vet_description)(const char *description); 87 int (*vet_description)(const char *description);
75 88
@@ -96,8 +109,15 @@ struct key_type {
96 */ 109 */
97 int (*update)(struct key *key, struct key_preparsed_payload *prep); 110 int (*update)(struct key *key, struct key_preparsed_payload *prep);
98 111
99 /* match a key against a description */ 112 /* Preparse the data supplied to ->match() (optional). The
100 int (*match)(const struct key *key, const void *desc); 113 * data to be preparsed can be found in match_data->raw_data.
114 * The lookup type can also be set by this function.
115 */
116 int (*match_preparse)(struct key_match_data *match_data);
117
118 /* Free preparsed match data (optional). This should be supplied it
119 * ->match_preparse() is supplied. */
120 void (*match_free)(struct key_match_data *match_data);
101 121
102 /* clear some of the data from a key on revokation (optional) 122 /* clear some of the data from a key on revokation (optional)
103 * - the key's semaphore will be write-locked by the caller 123 * - the key's semaphore will be write-locked by the caller
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 6b06d378f3df..e465bb15912d 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -283,7 +283,7 @@ struct kgdb_io {
283 283
284extern struct kgdb_arch arch_kgdb_ops; 284extern struct kgdb_arch arch_kgdb_ops;
285 285
286extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs); 286extern unsigned long kgdb_arch_pc(int exception, struct pt_regs *regs);
287 287
288#ifdef CONFIG_SERIAL_KGDB_NMI 288#ifdef CONFIG_SERIAL_KGDB_NMI
289extern int kgdb_register_nmi_console(void); 289extern int kgdb_register_nmi_console(void);
diff --git a/include/linux/khugepaged.h b/include/linux/khugepaged.h
index 6b394f0b5148..eeb307985715 100644
--- a/include/linux/khugepaged.h
+++ b/include/linux/khugepaged.h
@@ -6,7 +6,8 @@
6#ifdef CONFIG_TRANSPARENT_HUGEPAGE 6#ifdef CONFIG_TRANSPARENT_HUGEPAGE
7extern int __khugepaged_enter(struct mm_struct *mm); 7extern int __khugepaged_enter(struct mm_struct *mm);
8extern void __khugepaged_exit(struct mm_struct *mm); 8extern void __khugepaged_exit(struct mm_struct *mm);
9extern int khugepaged_enter_vma_merge(struct vm_area_struct *vma); 9extern int khugepaged_enter_vma_merge(struct vm_area_struct *vma,
10 unsigned long vm_flags);
10 11
11#define khugepaged_enabled() \ 12#define khugepaged_enabled() \
12 (transparent_hugepage_flags & \ 13 (transparent_hugepage_flags & \
@@ -35,13 +36,13 @@ static inline void khugepaged_exit(struct mm_struct *mm)
35 __khugepaged_exit(mm); 36 __khugepaged_exit(mm);
36} 37}
37 38
38static inline int khugepaged_enter(struct vm_area_struct *vma) 39static inline int khugepaged_enter(struct vm_area_struct *vma,
40 unsigned long vm_flags)
39{ 41{
40 if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags)) 42 if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags))
41 if ((khugepaged_always() || 43 if ((khugepaged_always() ||
42 (khugepaged_req_madv() && 44 (khugepaged_req_madv() && (vm_flags & VM_HUGEPAGE))) &&
43 vma->vm_flags & VM_HUGEPAGE)) && 45 !(vm_flags & VM_NOHUGEPAGE))
44 !(vma->vm_flags & VM_NOHUGEPAGE))
45 if (__khugepaged_enter(vma->vm_mm)) 46 if (__khugepaged_enter(vma->vm_mm))
46 return -ENOMEM; 47 return -ENOMEM;
47 return 0; 48 return 0;
@@ -54,11 +55,13 @@ static inline int khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm)
54static inline void khugepaged_exit(struct mm_struct *mm) 55static inline void khugepaged_exit(struct mm_struct *mm)
55{ 56{
56} 57}
57static inline int khugepaged_enter(struct vm_area_struct *vma) 58static inline int khugepaged_enter(struct vm_area_struct *vma,
59 unsigned long vm_flags)
58{ 60{
59 return 0; 61 return 0;
60} 62}
61static inline int khugepaged_enter_vma_merge(struct vm_area_struct *vma) 63static inline int khugepaged_enter_vma_merge(struct vm_area_struct *vma,
64 unsigned long vm_flags)
62{ 65{
63 return 0; 66 return 0;
64} 67}
diff --git a/include/linux/klist.h b/include/linux/klist.h
index a370ce57cf1d..61e5b723ae73 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -44,7 +44,7 @@ struct klist_node {
44 44
45extern void klist_add_tail(struct klist_node *n, struct klist *k); 45extern void klist_add_tail(struct klist_node *n, struct klist *k);
46extern void klist_add_head(struct klist_node *n, struct klist *k); 46extern void klist_add_head(struct klist_node *n, struct klist *k);
47extern void klist_add_after(struct klist_node *n, struct klist_node *pos); 47extern void klist_add_behind(struct klist_node *n, struct klist_node *pos);
48extern void klist_add_before(struct klist_node *n, struct klist_node *pos); 48extern void klist_add_before(struct klist_node *n, struct klist_node *pos);
49 49
50extern void klist_del(struct klist_node *n); 50extern void klist_del(struct klist_node *n);
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ec4e3bd83d47..ea53b04993f2 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -136,12 +136,11 @@ static inline bool is_error_page(struct page *page)
136#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22 136#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22
137#define KVM_REQ_ENABLE_IBS 23 137#define KVM_REQ_ENABLE_IBS 23
138#define KVM_REQ_DISABLE_IBS 24 138#define KVM_REQ_DISABLE_IBS 24
139#define KVM_REQ_APIC_PAGE_RELOAD 25
139 140
140#define KVM_USERSPACE_IRQ_SOURCE_ID 0 141#define KVM_USERSPACE_IRQ_SOURCE_ID 0
141#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 142#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
142 143
143struct kvm;
144struct kvm_vcpu;
145extern struct kmem_cache *kvm_vcpu_cache; 144extern struct kmem_cache *kvm_vcpu_cache;
146 145
147extern spinlock_t kvm_lock; 146extern spinlock_t kvm_lock;
@@ -200,6 +199,17 @@ int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, unsigned long hva,
200int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu); 199int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu);
201#endif 200#endif
202 201
202/*
203 * Carry out a gup that requires IO. Allow the mm to relinquish the mmap
204 * semaphore if the filemap/swap has to wait on a page lock. pagep == NULL
205 * controls whether we retry the gup one more time to completion in that case.
206 * Typically this is called after a FAULT_FLAG_RETRY_NOWAIT in the main tdp
207 * handler.
208 */
209int kvm_get_user_page_io(struct task_struct *tsk, struct mm_struct *mm,
210 unsigned long addr, bool write_fault,
211 struct page **pagep);
212
203enum { 213enum {
204 OUTSIDE_GUEST_MODE, 214 OUTSIDE_GUEST_MODE,
205 IN_GUEST_MODE, 215 IN_GUEST_MODE,
@@ -325,25 +335,6 @@ struct kvm_kernel_irq_routing_entry {
325 struct hlist_node link; 335 struct hlist_node link;
326}; 336};
327 337
328#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
329
330struct kvm_irq_routing_table {
331 int chip[KVM_NR_IRQCHIPS][KVM_IRQCHIP_NUM_PINS];
332 struct kvm_kernel_irq_routing_entry *rt_entries;
333 u32 nr_rt_entries;
334 /*
335 * Array indexed by gsi. Each entry contains list of irq chips
336 * the gsi is connected to.
337 */
338 struct hlist_head map[0];
339};
340
341#else
342
343struct kvm_irq_routing_table {};
344
345#endif
346
347#ifndef KVM_PRIVATE_MEM_SLOTS 338#ifndef KVM_PRIVATE_MEM_SLOTS
348#define KVM_PRIVATE_MEM_SLOTS 0 339#define KVM_PRIVATE_MEM_SLOTS 0
349#endif 340#endif
@@ -401,11 +392,12 @@ struct kvm {
401 struct mutex irq_lock; 392 struct mutex irq_lock;
402#ifdef CONFIG_HAVE_KVM_IRQCHIP 393#ifdef CONFIG_HAVE_KVM_IRQCHIP
403 /* 394 /*
404 * Update side is protected by irq_lock and, 395 * Update side is protected by irq_lock.
405 * if configured, irqfds.lock.
406 */ 396 */
407 struct kvm_irq_routing_table __rcu *irq_routing; 397 struct kvm_irq_routing_table __rcu *irq_routing;
408 struct hlist_head mask_notifier_list; 398 struct hlist_head mask_notifier_list;
399#endif
400#ifdef CONFIG_HAVE_KVM_IRQFD
409 struct hlist_head irq_ack_notifier_list; 401 struct hlist_head irq_ack_notifier_list;
410#endif 402#endif
411 403
@@ -455,7 +447,7 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
455int __must_check vcpu_load(struct kvm_vcpu *vcpu); 447int __must_check vcpu_load(struct kvm_vcpu *vcpu);
456void vcpu_put(struct kvm_vcpu *vcpu); 448void vcpu_put(struct kvm_vcpu *vcpu);
457 449
458#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING 450#ifdef CONFIG_HAVE_KVM_IRQFD
459int kvm_irqfd_init(void); 451int kvm_irqfd_init(void);
460void kvm_irqfd_exit(void); 452void kvm_irqfd_exit(void);
461#else 453#else
@@ -544,6 +536,8 @@ struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
544unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); 536unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
545unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable); 537unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable);
546unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn); 538unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn);
539unsigned long gfn_to_hva_memslot_prot(struct kvm_memory_slot *slot, gfn_t gfn,
540 bool *writable);
547void kvm_release_page_clean(struct page *page); 541void kvm_release_page_clean(struct page *page);
548void kvm_release_page_dirty(struct page *page); 542void kvm_release_page_dirty(struct page *page);
549void kvm_set_page_accessed(struct page *page); 543void kvm_set_page_accessed(struct page *page);
@@ -595,6 +589,7 @@ void kvm_flush_remote_tlbs(struct kvm *kvm);
595void kvm_reload_remote_mmus(struct kvm *kvm); 589void kvm_reload_remote_mmus(struct kvm *kvm);
596void kvm_make_mclock_inprogress_request(struct kvm *kvm); 590void kvm_make_mclock_inprogress_request(struct kvm *kvm);
597void kvm_make_scan_ioapic_request(struct kvm *kvm); 591void kvm_make_scan_ioapic_request(struct kvm *kvm);
592bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req);
598 593
599long kvm_arch_dev_ioctl(struct file *filp, 594long kvm_arch_dev_ioctl(struct file *filp,
600 unsigned int ioctl, unsigned long arg); 595 unsigned int ioctl, unsigned long arg);
@@ -602,7 +597,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
602 unsigned int ioctl, unsigned long arg); 597 unsigned int ioctl, unsigned long arg);
603int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf); 598int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf);
604 599
605int kvm_dev_ioctl_check_extension(long ext); 600int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext);
606 601
607int kvm_get_dirty_log(struct kvm *kvm, 602int kvm_get_dirty_log(struct kvm *kvm,
608 struct kvm_dirty_log *log, int *is_dirty); 603 struct kvm_dirty_log *log, int *is_dirty);
@@ -640,6 +635,8 @@ void kvm_arch_exit(void);
640int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu); 635int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu);
641void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu); 636void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu);
642 637
638void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu);
639
643void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu); 640void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu);
644void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu); 641void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
645void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu); 642void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
@@ -648,8 +645,8 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu);
648int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu); 645int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu);
649void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu); 646void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu);
650 647
651int kvm_arch_hardware_enable(void *garbage); 648int kvm_arch_hardware_enable(void);
652void kvm_arch_hardware_disable(void *garbage); 649void kvm_arch_hardware_disable(void);
653int kvm_arch_hardware_setup(void); 650int kvm_arch_hardware_setup(void);
654void kvm_arch_hardware_unsetup(void); 651void kvm_arch_hardware_unsetup(void);
655void kvm_arch_check_processor_compat(void *rtn); 652void kvm_arch_check_processor_compat(void *rtn);
@@ -752,6 +749,10 @@ void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,
752void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin, 749void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin,
753 bool mask); 750 bool mask);
754 751
752int kvm_irq_map_gsi(struct kvm *kvm,
753 struct kvm_kernel_irq_routing_entry *entries, int gsi);
754int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin);
755
755int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level, 756int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level,
756 bool line_status); 757 bool line_status);
757int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level); 758int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level);
@@ -942,28 +943,27 @@ int kvm_set_irq_routing(struct kvm *kvm,
942 const struct kvm_irq_routing_entry *entries, 943 const struct kvm_irq_routing_entry *entries,
943 unsigned nr, 944 unsigned nr,
944 unsigned flags); 945 unsigned flags);
945int kvm_set_routing_entry(struct kvm_irq_routing_table *rt, 946int kvm_set_routing_entry(struct kvm_kernel_irq_routing_entry *e,
946 struct kvm_kernel_irq_routing_entry *e,
947 const struct kvm_irq_routing_entry *ue); 947 const struct kvm_irq_routing_entry *ue);
948void kvm_free_irq_routing(struct kvm *kvm); 948void kvm_free_irq_routing(struct kvm *kvm);
949 949
950int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi);
951
952#else 950#else
953 951
954static inline void kvm_free_irq_routing(struct kvm *kvm) {} 952static inline void kvm_free_irq_routing(struct kvm *kvm) {}
955 953
956#endif 954#endif
957 955
956int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi);
957
958#ifdef CONFIG_HAVE_KVM_EVENTFD 958#ifdef CONFIG_HAVE_KVM_EVENTFD
959 959
960void kvm_eventfd_init(struct kvm *kvm); 960void kvm_eventfd_init(struct kvm *kvm);
961int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args); 961int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
962 962
963#ifdef CONFIG_HAVE_KVM_IRQCHIP 963#ifdef CONFIG_HAVE_KVM_IRQFD
964int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args); 964int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args);
965void kvm_irqfd_release(struct kvm *kvm); 965void kvm_irqfd_release(struct kvm *kvm);
966void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *); 966void kvm_irq_routing_update(struct kvm *);
967#else 967#else
968static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args) 968static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
969{ 969{
@@ -985,10 +985,8 @@ static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
985static inline void kvm_irqfd_release(struct kvm *kvm) {} 985static inline void kvm_irqfd_release(struct kvm *kvm) {}
986 986
987#ifdef CONFIG_HAVE_KVM_IRQCHIP 987#ifdef CONFIG_HAVE_KVM_IRQCHIP
988static inline void kvm_irq_routing_update(struct kvm *kvm, 988static inline void kvm_irq_routing_update(struct kvm *kvm)
989 struct kvm_irq_routing_table *irq_rt)
990{ 989{
991 rcu_assign_pointer(kvm->irq_routing, irq_rt);
992} 990}
993#endif 991#endif
994 992
@@ -1049,8 +1047,6 @@ static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
1049 1047
1050extern bool kvm_rebooting; 1048extern bool kvm_rebooting;
1051 1049
1052struct kvm_device_ops;
1053
1054struct kvm_device { 1050struct kvm_device {
1055 struct kvm_device_ops *ops; 1051 struct kvm_device_ops *ops;
1056 struct kvm *kvm; 1052 struct kvm *kvm;
@@ -1083,12 +1079,11 @@ struct kvm_device_ops {
1083void kvm_device_get(struct kvm_device *dev); 1079void kvm_device_get(struct kvm_device *dev);
1084void kvm_device_put(struct kvm_device *dev); 1080void kvm_device_put(struct kvm_device *dev);
1085struct kvm_device *kvm_device_from_filp(struct file *filp); 1081struct kvm_device *kvm_device_from_filp(struct file *filp);
1082int kvm_register_device_ops(struct kvm_device_ops *ops, u32 type);
1083void kvm_unregister_device_ops(u32 type);
1086 1084
1087extern struct kvm_device_ops kvm_mpic_ops; 1085extern struct kvm_device_ops kvm_mpic_ops;
1088extern struct kvm_device_ops kvm_xics_ops; 1086extern struct kvm_device_ops kvm_xics_ops;
1089extern struct kvm_device_ops kvm_vfio_ops;
1090extern struct kvm_device_ops kvm_arm_vgic_v2_ops;
1091extern struct kvm_device_ops kvm_flic_ops;
1092 1087
1093#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT 1088#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
1094 1089
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index b0bcce0ddc95..b606bb689a3e 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -17,6 +17,20 @@
17#ifndef __KVM_TYPES_H__ 17#ifndef __KVM_TYPES_H__
18#define __KVM_TYPES_H__ 18#define __KVM_TYPES_H__
19 19
20struct kvm;
21struct kvm_async_pf;
22struct kvm_device_ops;
23struct kvm_interrupt;
24struct kvm_irq_routing_table;
25struct kvm_memory_slot;
26struct kvm_one_reg;
27struct kvm_run;
28struct kvm_userspace_memory_region;
29struct kvm_vcpu;
30struct kvm_vcpu_init;
31
32enum kvm_mr_change;
33
20#include <asm/types.h> 34#include <asm/types.h>
21 35
22/* 36/*
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 0287ab296689..a57611d0c94e 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -13,8 +13,8 @@
13#define __LINUX_LEDS_H_INCLUDED 13#define __LINUX_LEDS_H_INCLUDED
14 14
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/spinlock.h>
17#include <linux/rwsem.h> 16#include <linux/rwsem.h>
17#include <linux/spinlock.h>
18#include <linux/timer.h> 18#include <linux/timer.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20 20
@@ -31,8 +31,8 @@ enum led_brightness {
31 31
32struct led_classdev { 32struct led_classdev {
33 const char *name; 33 const char *name;
34 int brightness; 34 enum led_brightness brightness;
35 int max_brightness; 35 enum led_brightness max_brightness;
36 int flags; 36 int flags;
37 37
38 /* Lower 16 bits reflect status */ 38 /* Lower 16 bits reflect status */
@@ -63,6 +63,8 @@ struct led_classdev {
63 unsigned long *delay_off); 63 unsigned long *delay_off);
64 64
65 struct device *dev; 65 struct device *dev;
66 const struct attribute_group **groups;
67
66 struct list_head node; /* LED Device list */ 68 struct list_head node; /* LED Device list */
67 const char *default_trigger; /* Trigger to use */ 69 const char *default_trigger; /* Trigger to use */
68 70
@@ -138,6 +140,16 @@ extern void led_blink_set_oneshot(struct led_classdev *led_cdev,
138 */ 140 */
139extern void led_set_brightness(struct led_classdev *led_cdev, 141extern void led_set_brightness(struct led_classdev *led_cdev,
140 enum led_brightness brightness); 142 enum led_brightness brightness);
143/**
144 * led_update_brightness - update LED brightness
145 * @led_cdev: the LED to query
146 *
147 * Get an LED's current brightness and update led_cdev->brightness
148 * member with the obtained value.
149 *
150 * Returns: 0 on success or negative error value on failure
151 */
152extern int led_update_brightness(struct led_classdev *led_cdev);
141 153
142/* 154/*
143 * LED Triggers 155 * LED Triggers
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 92abb497ab14..bd5fefeaf548 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1404,14 +1404,14 @@ static inline int sata_srst_pmp(struct ata_link *link)
1404 * printk helpers 1404 * printk helpers
1405 */ 1405 */
1406__printf(3, 4) 1406__printf(3, 4)
1407int ata_port_printk(const struct ata_port *ap, const char *level, 1407void ata_port_printk(const struct ata_port *ap, const char *level,
1408 const char *fmt, ...); 1408 const char *fmt, ...);
1409__printf(3, 4) 1409__printf(3, 4)
1410int ata_link_printk(const struct ata_link *link, const char *level, 1410void ata_link_printk(const struct ata_link *link, const char *level,
1411 const char *fmt, ...); 1411 const char *fmt, ...);
1412__printf(3, 4) 1412__printf(3, 4)
1413int ata_dev_printk(const struct ata_device *dev, const char *level, 1413void ata_dev_printk(const struct ata_device *dev, const char *level,
1414 const char *fmt, ...); 1414 const char *fmt, ...);
1415 1415
1416#define ata_port_err(ap, fmt, ...) \ 1416#define ata_port_err(ap, fmt, ...) \
1417 ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__) 1417 ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__)
diff --git a/include/linux/list.h b/include/linux/list.h
index ef9594171062..f33f831eb3c8 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -5,6 +5,7 @@
5#include <linux/stddef.h> 5#include <linux/stddef.h>
6#include <linux/poison.h> 6#include <linux/poison.h>
7#include <linux/const.h> 7#include <linux/const.h>
8#include <linux/kernel.h>
8 9
9/* 10/*
10 * Simple doubly linked list implementation. 11 * Simple doubly linked list implementation.
@@ -654,15 +655,15 @@ static inline void hlist_add_before(struct hlist_node *n,
654 *(n->pprev) = n; 655 *(n->pprev) = n;
655} 656}
656 657
657static inline void hlist_add_after(struct hlist_node *n, 658static inline void hlist_add_behind(struct hlist_node *n,
658 struct hlist_node *next) 659 struct hlist_node *prev)
659{ 660{
660 next->next = n->next; 661 n->next = prev->next;
661 n->next = next; 662 prev->next = n;
662 next->pprev = &n->next; 663 n->pprev = &prev->next;
663 664
664 if(next->next) 665 if (n->next)
665 next->next->pprev = &next->next; 666 n->next->pprev = &n->next;
666} 667}
667 668
668/* after that we'll appear to be on some hlist and hlist_del will work */ 669/* after that we'll appear to be on some hlist and hlist_del will work */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 219d79627c05..ff82a32871b5 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -178,7 +178,6 @@ struct nlm_block {
178 unsigned char b_granted; /* VFS granted lock */ 178 unsigned char b_granted; /* VFS granted lock */
179 struct nlm_file * b_file; /* file in question */ 179 struct nlm_file * b_file; /* file in question */
180 struct cache_req * b_cache_req; /* deferred request handling */ 180 struct cache_req * b_cache_req; /* deferred request handling */
181 struct file_lock * b_fl; /* set for GETLK */
182 struct cache_deferred_req * b_deferred_req; 181 struct cache_deferred_req * b_deferred_req;
183 unsigned int b_flags; /* block flags */ 182 unsigned int b_flags; /* block flags */
184#define B_QUEUED 1 /* lock queued */ 183#define B_QUEUED 1 /* lock queued */
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 008388f920d7..74ab23176e9b 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> 4 * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
5 * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> 5 * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
6 * 6 *
7 * see Documentation/lockdep-design.txt for more details. 7 * see Documentation/locking/lockdep-design.txt for more details.
8 */ 8 */
9#ifndef __LINUX_LOCKDEP_H 9#ifndef __LINUX_LOCKDEP_H
10#define __LINUX_LOCKDEP_H 10#define __LINUX_LOCKDEP_H
@@ -362,6 +362,10 @@ extern void lockdep_trace_alloc(gfp_t mask);
362 WARN_ON(debug_locks && !lockdep_is_held(l)); \ 362 WARN_ON(debug_locks && !lockdep_is_held(l)); \
363 } while (0) 363 } while (0)
364 364
365#define lockdep_assert_held_once(l) do { \
366 WARN_ON_ONCE(debug_locks && !lockdep_is_held(l)); \
367 } while (0)
368
365#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion) 369#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
366 370
367#else /* !CONFIG_LOCKDEP */ 371#else /* !CONFIG_LOCKDEP */
@@ -412,6 +416,7 @@ struct lock_class_key { };
412#define lockdep_depth(tsk) (0) 416#define lockdep_depth(tsk) (0)
413 417
414#define lockdep_assert_held(l) do { (void)(l); } while (0) 418#define lockdep_assert_held(l) do { (void)(l); } while (0)
419#define lockdep_assert_held_once(l) do { (void)(l); } while (0)
415 420
416#define lockdep_recursing(tsk) (0) 421#define lockdep_recursing(tsk) (0)
417 422
@@ -505,6 +510,7 @@ static inline void print_irqtrace_events(struct task_struct *curr)
505 510
506#define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_) 511#define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_)
507#define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_) 512#define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_)
513#define lock_map_acquire_tryread(l) lock_acquire_shared_recursive(l, 0, 1, NULL, _THIS_IP_)
508#define lock_map_release(l) lock_release(l, 1, _THIS_IP_) 514#define lock_map_release(l) lock_release(l, 1, _THIS_IP_)
509 515
510#ifdef CONFIG_PROVE_LOCKING 516#ifdef CONFIG_PROVE_LOCKING
diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h
new file mode 100644
index 000000000000..307d9cab2026
--- /dev/null
+++ b/include/linux/mailbox_client.h
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2013-2014 Linaro Ltd.
3 * Author: Jassi Brar <jassisinghbrar@gmail.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 __MAILBOX_CLIENT_H
11#define __MAILBOX_CLIENT_H
12
13#include <linux/of.h>
14#include <linux/device.h>
15
16struct mbox_chan;
17
18/**
19 * struct mbox_client - User of a mailbox
20 * @dev: The client device
21 * @tx_block: If the mbox_send_message should block until data is
22 * transmitted.
23 * @tx_tout: Max block period in ms before TX is assumed failure
24 * @knows_txdone: If the client could run the TX state machine. Usually
25 * if the client receives some ACK packet for transmission.
26 * Unused if the controller already has TX_Done/RTR IRQ.
27 * @rx_callback: Atomic callback to provide client the data received
28 * @tx_done: Atomic callback to tell client of data transmission
29 */
30struct mbox_client {
31 struct device *dev;
32 bool tx_block;
33 unsigned long tx_tout;
34 bool knows_txdone;
35
36 void (*rx_callback)(struct mbox_client *cl, void *mssg);
37 void (*tx_done)(struct mbox_client *cl, void *mssg, int r);
38};
39
40struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index);
41int mbox_send_message(struct mbox_chan *chan, void *mssg);
42void mbox_client_txdone(struct mbox_chan *chan, int r); /* atomic */
43bool mbox_client_peek_data(struct mbox_chan *chan); /* atomic */
44void mbox_free_channel(struct mbox_chan *chan); /* may sleep */
45
46#endif /* __MAILBOX_CLIENT_H */
diff --git a/include/linux/mailbox_controller.h b/include/linux/mailbox_controller.h
new file mode 100644
index 000000000000..d4cf96f07cfc
--- /dev/null
+++ b/include/linux/mailbox_controller.h
@@ -0,0 +1,133 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 */
6
7#ifndef __MAILBOX_CONTROLLER_H
8#define __MAILBOX_CONTROLLER_H
9
10#include <linux/of.h>
11#include <linux/types.h>
12#include <linux/timer.h>
13#include <linux/device.h>
14#include <linux/completion.h>
15
16struct mbox_chan;
17
18/**
19 * struct mbox_chan_ops - methods to control mailbox channels
20 * @send_data: The API asks the MBOX controller driver, in atomic
21 * context try to transmit a message on the bus. Returns 0 if
22 * data is accepted for transmission, -EBUSY while rejecting
23 * if the remote hasn't yet read the last data sent. Actual
24 * transmission of data is reported by the controller via
25 * mbox_chan_txdone (if it has some TX ACK irq). It must not
26 * sleep.
27 * @startup: Called when a client requests the chan. The controller
28 * could ask clients for additional parameters of communication
29 * to be provided via client's chan_data. This call may
30 * block. After this call the Controller must forward any
31 * data received on the chan by calling mbox_chan_received_data.
32 * The controller may do stuff that need to sleep.
33 * @shutdown: Called when a client relinquishes control of a chan.
34 * This call may block too. The controller must not forward
35 * any received data anymore.
36 * The controller may do stuff that need to sleep.
37 * @last_tx_done: If the controller sets 'txdone_poll', the API calls
38 * this to poll status of last TX. The controller must
39 * give priority to IRQ method over polling and never
40 * set both txdone_poll and txdone_irq. Only in polling
41 * mode 'send_data' is expected to return -EBUSY.
42 * The controller may do stuff that need to sleep/block.
43 * Used only if txdone_poll:=true && txdone_irq:=false
44 * @peek_data: Atomic check for any received data. Return true if controller
45 * has some data to push to the client. False otherwise.
46 */
47struct mbox_chan_ops {
48 int (*send_data)(struct mbox_chan *chan, void *data);
49 int (*startup)(struct mbox_chan *chan);
50 void (*shutdown)(struct mbox_chan *chan);
51 bool (*last_tx_done)(struct mbox_chan *chan);
52 bool (*peek_data)(struct mbox_chan *chan);
53};
54
55/**
56 * struct mbox_controller - Controller of a class of communication channels
57 * @dev: Device backing this controller
58 * @ops: Operators that work on each communication chan
59 * @chans: Array of channels
60 * @num_chans: Number of channels in the 'chans' array.
61 * @txdone_irq: Indicates if the controller can report to API when
62 * the last transmitted data was read by the remote.
63 * Eg, if it has some TX ACK irq.
64 * @txdone_poll: If the controller can read but not report the TX
65 * done. Ex, some register shows the TX status but
66 * no interrupt rises. Ignored if 'txdone_irq' is set.
67 * @txpoll_period: If 'txdone_poll' is in effect, the API polls for
68 * last TX's status after these many millisecs
69 * @of_xlate: Controller driver specific mapping of channel via DT
70 * @poll: API private. Used to poll for TXDONE on all channels.
71 * @node: API private. To hook into list of controllers.
72 */
73struct mbox_controller {
74 struct device *dev;
75 struct mbox_chan_ops *ops;
76 struct mbox_chan *chans;
77 int num_chans;
78 bool txdone_irq;
79 bool txdone_poll;
80 unsigned txpoll_period;
81 struct mbox_chan *(*of_xlate)(struct mbox_controller *mbox,
82 const struct of_phandle_args *sp);
83 /* Internal to API */
84 struct timer_list poll;
85 struct list_head node;
86};
87
88/*
89 * The length of circular buffer for queuing messages from a client.
90 * 'msg_count' tracks the number of buffered messages while 'msg_free'
91 * is the index where the next message would be buffered.
92 * We shouldn't need it too big because every transfer is interrupt
93 * triggered and if we have lots of data to transfer, the interrupt
94 * latencies are going to be the bottleneck, not the buffer length.
95 * Besides, mbox_send_message could be called from atomic context and
96 * the client could also queue another message from the notifier 'tx_done'
97 * of the last transfer done.
98 * REVISIT: If too many platforms see the "Try increasing MBOX_TX_QUEUE_LEN"
99 * print, it needs to be taken from config option or somesuch.
100 */
101#define MBOX_TX_QUEUE_LEN 20
102
103/**
104 * struct mbox_chan - s/w representation of a communication chan
105 * @mbox: Pointer to the parent/provider of this channel
106 * @txdone_method: Way to detect TXDone chosen by the API
107 * @cl: Pointer to the current owner of this channel
108 * @tx_complete: Transmission completion
109 * @active_req: Currently active request hook
110 * @msg_count: No. of mssg currently queued
111 * @msg_free: Index of next available mssg slot
112 * @msg_data: Hook for data packet
113 * @lock: Serialise access to the channel
114 * @con_priv: Hook for controller driver to attach private data
115 */
116struct mbox_chan {
117 struct mbox_controller *mbox;
118 unsigned txdone_method;
119 struct mbox_client *cl;
120 struct completion tx_complete;
121 void *active_req;
122 unsigned msg_count, msg_free;
123 void *msg_data[MBOX_TX_QUEUE_LEN];
124 spinlock_t lock; /* Serialise access to the channel */
125 void *con_priv;
126};
127
128int mbox_controller_register(struct mbox_controller *mbox); /* can sleep */
129void mbox_controller_unregister(struct mbox_controller *mbox); /* can sleep */
130void mbox_chan_received_data(struct mbox_chan *chan, void *data); /* atomic */
131void mbox_chan_txdone(struct mbox_chan *chan, int r); /* atomic */
132
133#endif /* __MAILBOX_CONTROLLER_H */
diff --git a/include/linux/mei_cl_bus.h b/include/linux/mei_cl_bus.h
index d14af7b722ef..164aad1f9f12 100644
--- a/include/linux/mei_cl_bus.h
+++ b/include/linux/mei_cl_bus.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/device.h> 4#include <linux/device.h>
5#include <linux/uuid.h> 5#include <linux/uuid.h>
6#include <linux/mod_devicetable.h>
6 7
7struct mei_cl_device; 8struct mei_cl_device;
8 9
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index b660e05b63d4..e8cc45307f8f 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -249,7 +249,7 @@ phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
249/* 249/*
250 * Set the allocation direction to bottom-up or top-down. 250 * Set the allocation direction to bottom-up or top-down.
251 */ 251 */
252static inline void memblock_set_bottom_up(bool enable) 252static inline void __init memblock_set_bottom_up(bool enable)
253{ 253{
254 memblock.bottom_up = enable; 254 memblock.bottom_up = enable;
255} 255}
@@ -264,7 +264,7 @@ static inline bool memblock_bottom_up(void)
264 return memblock.bottom_up; 264 return memblock.bottom_up;
265} 265}
266#else 266#else
267static inline void memblock_set_bottom_up(bool enable) {} 267static inline void __init memblock_set_bottom_up(bool enable) {}
268static inline bool memblock_bottom_up(void) { return false; } 268static inline bool memblock_bottom_up(void) { return false; }
269#endif 269#endif
270 270
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index eb65d29516ca..6b75640ef5ab 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -54,39 +54,20 @@ struct mem_cgroup_reclaim_cookie {
54}; 54};
55 55
56#ifdef CONFIG_MEMCG 56#ifdef CONFIG_MEMCG
57/* 57int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm,
58 * All "charge" functions with gfp_mask should use GFP_KERNEL or 58 gfp_t gfp_mask, struct mem_cgroup **memcgp);
59 * (gfp_mask & GFP_RECLAIM_MASK). In current implementatin, memcg doesn't 59void mem_cgroup_commit_charge(struct page *page, struct mem_cgroup *memcg,
60 * alloc memory but reclaims memory from all available zones. So, "where I want 60 bool lrucare);
61 * memory from" bits of gfp_mask has no meaning. So any bits of that field is 61void mem_cgroup_cancel_charge(struct page *page, struct mem_cgroup *memcg);
62 * available but adding a rule is better. charge functions' gfp_mask should 62void mem_cgroup_uncharge(struct page *page);
63 * be set to GFP_KERNEL or gfp_mask & GFP_RECLAIM_MASK for avoiding ambiguous 63void mem_cgroup_uncharge_list(struct list_head *page_list);
64 * codes.
65 * (Of course, if memcg does memory allocation in future, GFP_KERNEL is sane.)
66 */
67 64
68extern int mem_cgroup_charge_anon(struct page *page, struct mm_struct *mm, 65void mem_cgroup_migrate(struct page *oldpage, struct page *newpage,
69 gfp_t gfp_mask); 66 bool lrucare);
70/* for swap handling */
71extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
72 struct page *page, gfp_t mask, struct mem_cgroup **memcgp);
73extern void mem_cgroup_commit_charge_swapin(struct page *page,
74 struct mem_cgroup *memcg);
75extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg);
76
77extern int mem_cgroup_charge_file(struct page *page, struct mm_struct *mm,
78 gfp_t gfp_mask);
79 67
80struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *); 68struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *);
81struct lruvec *mem_cgroup_page_lruvec(struct page *, struct zone *); 69struct lruvec *mem_cgroup_page_lruvec(struct page *, struct zone *);
82 70
83/* For coalescing uncharge for reducing memcg' overhead*/
84extern void mem_cgroup_uncharge_start(void);
85extern void mem_cgroup_uncharge_end(void);
86
87extern void mem_cgroup_uncharge_page(struct page *page);
88extern void mem_cgroup_uncharge_cache_page(struct page *page);
89
90bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg, 71bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg,
91 struct mem_cgroup *memcg); 72 struct mem_cgroup *memcg);
92bool task_in_mem_cgroup(struct task_struct *task, 73bool task_in_mem_cgroup(struct task_struct *task,
@@ -113,12 +94,6 @@ bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg)
113 94
114extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg); 95extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg);
115 96
116extern void
117mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
118 struct mem_cgroup **memcgp);
119extern void mem_cgroup_end_migration(struct mem_cgroup *memcg,
120 struct page *oldpage, struct page *newpage, bool migration_ok);
121
122struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *, 97struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *,
123 struct mem_cgroup *, 98 struct mem_cgroup *,
124 struct mem_cgroup_reclaim_cookie *); 99 struct mem_cgroup_reclaim_cookie *);
@@ -133,8 +108,6 @@ unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list);
133void mem_cgroup_update_lru_size(struct lruvec *, enum lru_list, int); 108void mem_cgroup_update_lru_size(struct lruvec *, enum lru_list, int);
134extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, 109extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
135 struct task_struct *p); 110 struct task_struct *p);
136extern void mem_cgroup_replace_page_cache(struct page *oldpage,
137 struct page *newpage);
138 111
139static inline void mem_cgroup_oom_enable(void) 112static inline void mem_cgroup_oom_enable(void)
140{ 113{
@@ -166,48 +139,23 @@ static inline bool mem_cgroup_disabled(void)
166 return false; 139 return false;
167} 140}
168 141
169void __mem_cgroup_begin_update_page_stat(struct page *page, bool *locked, 142struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page, bool *locked,
170 unsigned long *flags); 143 unsigned long *flags);
171 144void mem_cgroup_end_page_stat(struct mem_cgroup *memcg, bool locked,
172extern atomic_t memcg_moving; 145 unsigned long flags);
173 146void mem_cgroup_update_page_stat(struct mem_cgroup *memcg,
174static inline void mem_cgroup_begin_update_page_stat(struct page *page, 147 enum mem_cgroup_stat_index idx, int val);
175 bool *locked, unsigned long *flags)
176{
177 if (mem_cgroup_disabled())
178 return;
179 rcu_read_lock();
180 *locked = false;
181 if (atomic_read(&memcg_moving))
182 __mem_cgroup_begin_update_page_stat(page, locked, flags);
183}
184
185void __mem_cgroup_end_update_page_stat(struct page *page,
186 unsigned long *flags);
187static inline void mem_cgroup_end_update_page_stat(struct page *page,
188 bool *locked, unsigned long *flags)
189{
190 if (mem_cgroup_disabled())
191 return;
192 if (*locked)
193 __mem_cgroup_end_update_page_stat(page, flags);
194 rcu_read_unlock();
195}
196
197void mem_cgroup_update_page_stat(struct page *page,
198 enum mem_cgroup_stat_index idx,
199 int val);
200 148
201static inline void mem_cgroup_inc_page_stat(struct page *page, 149static inline void mem_cgroup_inc_page_stat(struct mem_cgroup *memcg,
202 enum mem_cgroup_stat_index idx) 150 enum mem_cgroup_stat_index idx)
203{ 151{
204 mem_cgroup_update_page_stat(page, idx, 1); 152 mem_cgroup_update_page_stat(memcg, idx, 1);
205} 153}
206 154
207static inline void mem_cgroup_dec_page_stat(struct page *page, 155static inline void mem_cgroup_dec_page_stat(struct mem_cgroup *memcg,
208 enum mem_cgroup_stat_index idx) 156 enum mem_cgroup_stat_index idx)
209{ 157{
210 mem_cgroup_update_page_stat(page, idx, -1); 158 mem_cgroup_update_page_stat(memcg, idx, -1);
211} 159}
212 160
213unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, 161unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
@@ -233,46 +181,36 @@ void mem_cgroup_print_bad_page(struct page *page);
233#else /* CONFIG_MEMCG */ 181#else /* CONFIG_MEMCG */
234struct mem_cgroup; 182struct mem_cgroup;
235 183
236static inline int mem_cgroup_charge_anon(struct page *page, 184static inline int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm,
237 struct mm_struct *mm, gfp_t gfp_mask) 185 gfp_t gfp_mask,
238{ 186 struct mem_cgroup **memcgp)
239 return 0;
240}
241
242static inline int mem_cgroup_charge_file(struct page *page,
243 struct mm_struct *mm, gfp_t gfp_mask)
244{ 187{
188 *memcgp = NULL;
245 return 0; 189 return 0;
246} 190}
247 191
248static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm, 192static inline void mem_cgroup_commit_charge(struct page *page,
249 struct page *page, gfp_t gfp_mask, struct mem_cgroup **memcgp) 193 struct mem_cgroup *memcg,
250{ 194 bool lrucare)
251 return 0;
252}
253
254static inline void mem_cgroup_commit_charge_swapin(struct page *page,
255 struct mem_cgroup *memcg)
256{
257}
258
259static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg)
260{ 195{
261} 196}
262 197
263static inline void mem_cgroup_uncharge_start(void) 198static inline void mem_cgroup_cancel_charge(struct page *page,
199 struct mem_cgroup *memcg)
264{ 200{
265} 201}
266 202
267static inline void mem_cgroup_uncharge_end(void) 203static inline void mem_cgroup_uncharge(struct page *page)
268{ 204{
269} 205}
270 206
271static inline void mem_cgroup_uncharge_page(struct page *page) 207static inline void mem_cgroup_uncharge_list(struct list_head *page_list)
272{ 208{
273} 209}
274 210
275static inline void mem_cgroup_uncharge_cache_page(struct page *page) 211static inline void mem_cgroup_migrate(struct page *oldpage,
212 struct page *newpage,
213 bool lrucare)
276{ 214{
277} 215}
278 216
@@ -311,17 +249,6 @@ static inline struct cgroup_subsys_state
311 return NULL; 249 return NULL;
312} 250}
313 251
314static inline void
315mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
316 struct mem_cgroup **memcgp)
317{
318}
319
320static inline void mem_cgroup_end_migration(struct mem_cgroup *memcg,
321 struct page *oldpage, struct page *newpage, bool migration_ok)
322{
323}
324
325static inline struct mem_cgroup * 252static inline struct mem_cgroup *
326mem_cgroup_iter(struct mem_cgroup *root, 253mem_cgroup_iter(struct mem_cgroup *root,
327 struct mem_cgroup *prev, 254 struct mem_cgroup *prev,
@@ -363,13 +290,14 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
363{ 290{
364} 291}
365 292
366static inline void mem_cgroup_begin_update_page_stat(struct page *page, 293static inline struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page,
367 bool *locked, unsigned long *flags) 294 bool *locked, unsigned long *flags)
368{ 295{
296 return NULL;
369} 297}
370 298
371static inline void mem_cgroup_end_update_page_stat(struct page *page, 299static inline void mem_cgroup_end_page_stat(struct mem_cgroup *memcg,
372 bool *locked, unsigned long *flags) 300 bool locked, unsigned long flags)
373{ 301{
374} 302}
375 303
@@ -391,12 +319,12 @@ static inline bool mem_cgroup_oom_synchronize(bool wait)
391 return false; 319 return false;
392} 320}
393 321
394static inline void mem_cgroup_inc_page_stat(struct page *page, 322static inline void mem_cgroup_inc_page_stat(struct mem_cgroup *memcg,
395 enum mem_cgroup_stat_index idx) 323 enum mem_cgroup_stat_index idx)
396{ 324{
397} 325}
398 326
399static inline void mem_cgroup_dec_page_stat(struct page *page, 327static inline void mem_cgroup_dec_page_stat(struct mem_cgroup *memcg,
400 enum mem_cgroup_stat_index idx) 328 enum mem_cgroup_stat_index idx)
401{ 329{
402} 330}
@@ -417,10 +345,6 @@ static inline
417void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx) 345void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
418{ 346{
419} 347}
420static inline void mem_cgroup_replace_page_cache(struct page *oldpage,
421 struct page *newpage)
422{
423}
424#endif /* CONFIG_MEMCG */ 348#endif /* CONFIG_MEMCG */
425 349
426#if !defined(CONFIG_MEMCG) || !defined(CONFIG_DEBUG_VM) 350#if !defined(CONFIG_MEMCG) || !defined(CONFIG_DEBUG_VM)
@@ -492,11 +416,6 @@ void __memcg_kmem_uncharge_pages(struct page *page, int order);
492 416
493int memcg_cache_id(struct mem_cgroup *memcg); 417int memcg_cache_id(struct mem_cgroup *memcg);
494 418
495int memcg_alloc_cache_params(struct mem_cgroup *memcg, struct kmem_cache *s,
496 struct kmem_cache *root_cache);
497void memcg_free_cache_params(struct kmem_cache *s);
498
499int memcg_update_cache_size(struct kmem_cache *s, int num_groups);
500void memcg_update_array_size(int num_groups); 419void memcg_update_array_size(int num_groups);
501 420
502struct kmem_cache * 421struct kmem_cache *
@@ -626,16 +545,6 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg)
626 return -1; 545 return -1;
627} 546}
628 547
629static inline int memcg_alloc_cache_params(struct mem_cgroup *memcg,
630 struct kmem_cache *s, struct kmem_cache *root_cache)
631{
632 return 0;
633}
634
635static inline void memcg_free_cache_params(struct kmem_cache *s)
636{
637}
638
639static inline struct kmem_cache * 548static inline struct kmem_cache *
640memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp) 549memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
641{ 550{
diff --git a/include/linux/memory.h b/include/linux/memory.h
index bb7384e3c3d8..8b8d8d12348e 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -35,7 +35,7 @@ struct memory_block {
35}; 35};
36 36
37int arch_get_memory_phys_device(unsigned long start_pfn); 37int arch_get_memory_phys_device(unsigned long start_pfn);
38unsigned long __weak memory_block_size_bytes(void); 38unsigned long memory_block_size_bytes(void);
39 39
40/* These states are exposed to userspace as text strings in sysfs */ 40/* These states are exposed to userspace as text strings in sysfs */
41#define MEM_ONLINE (1<<0) /* exposed to userspace */ 41#define MEM_ONLINE (1<<0) /* exposed to userspace */
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 010d125bffbf..8f1a41951df9 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -26,11 +26,12 @@ enum {
26 MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO, 26 MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO,
27}; 27};
28 28
29/* Types for control the zone type of onlined memory */ 29/* Types for control the zone type of onlined and offlined memory */
30enum { 30enum {
31 ONLINE_KEEP, 31 MMOP_OFFLINE = -1,
32 ONLINE_KERNEL, 32 MMOP_ONLINE_KEEP,
33 ONLINE_MOVABLE, 33 MMOP_ONLINE_KERNEL,
34 MMOP_ONLINE_MOVABLE,
34}; 35};
35 36
36/* 37/*
@@ -83,6 +84,7 @@ extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages);
83extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); 84extern int add_one_highpage(struct page *page, int pfn, int bad_ppro);
84/* VM interface that may be used by firmware interface */ 85/* VM interface that may be used by firmware interface */
85extern int online_pages(unsigned long, unsigned long, int); 86extern int online_pages(unsigned long, unsigned long, int);
87extern int test_pages_in_a_zone(unsigned long, unsigned long);
86extern void __offline_isolated_pages(unsigned long, unsigned long); 88extern void __offline_isolated_pages(unsigned long, unsigned long);
87 89
88typedef void (*online_page_callback_t)(struct page *page); 90typedef void (*online_page_callback_t)(struct page *page);
@@ -258,6 +260,7 @@ static inline void remove_memory(int nid, u64 start, u64 size) {}
258extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn, 260extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
259 void *arg, int (*func)(struct memory_block *, void *)); 261 void *arg, int (*func)(struct memory_block *, void *));
260extern int add_memory(int nid, u64 start, u64 size); 262extern int add_memory(int nid, u64 start, u64 size);
263extern int zone_for_memory(int nid, u64 start, u64 size, int zone_default);
261extern int arch_add_memory(int nid, u64 start, u64 size); 264extern int arch_add_memory(int nid, u64 start, u64 size);
262extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); 265extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
263extern bool is_memblock_offlined(struct memory_block *mem); 266extern bool is_memblock_offlined(struct memory_block *mem);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index f230a978e6ba..3d385c81c153 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -134,9 +134,10 @@ void mpol_free_shared_policy(struct shared_policy *p);
134struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, 134struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
135 unsigned long idx); 135 unsigned long idx);
136 136
137struct mempolicy *get_vma_policy(struct task_struct *tsk, 137struct mempolicy *get_task_policy(struct task_struct *p);
138 struct vm_area_struct *vma, unsigned long addr); 138struct mempolicy *__get_vma_policy(struct vm_area_struct *vma,
139bool vma_policy_mof(struct task_struct *task, struct vm_area_struct *vma); 139 unsigned long addr);
140bool vma_policy_mof(struct vm_area_struct *vma);
140 141
141extern void numa_default_policy(void); 142extern void numa_default_policy(void);
142extern void numa_policy_init(void); 143extern void numa_policy_init(void);
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 4e7fe7417fc9..9475fee2bfc5 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -505,6 +505,7 @@ static inline int is_ab9540_2p0_or_earlier(struct ab8500 *ab)
505void ab8500_override_turn_on_stat(u8 mask, u8 set); 505void ab8500_override_turn_on_stat(u8 mask, u8 set);
506 506
507#ifdef CONFIG_AB8500_DEBUG 507#ifdef CONFIG_AB8500_DEBUG
508extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
508void ab8500_dump_all_banks(struct device *dev); 509void ab8500_dump_all_banks(struct device *dev);
509void ab8500_debug_register_interrupt(int line); 510void ab8500_debug_register_interrupt(int line);
510#else 511#else
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index a614b33d0a39..f34723f7663c 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -18,7 +18,7 @@
18#include <linux/regulator/consumer.h> 18#include <linux/regulator/consumer.h>
19#include <linux/mfd/arizona/pdata.h> 19#include <linux/mfd/arizona/pdata.h>
20 20
21#define ARIZONA_MAX_CORE_SUPPLIES 3 21#define ARIZONA_MAX_CORE_SUPPLIES 2
22 22
23enum arizona_type { 23enum arizona_type {
24 WM5102 = 1, 24 WM5102 = 1,
@@ -46,8 +46,8 @@ enum arizona_type {
46#define ARIZONA_IRQ_DSP_IRQ6 17 46#define ARIZONA_IRQ_DSP_IRQ6 17
47#define ARIZONA_IRQ_DSP_IRQ7 18 47#define ARIZONA_IRQ_DSP_IRQ7 18
48#define ARIZONA_IRQ_DSP_IRQ8 19 48#define ARIZONA_IRQ_DSP_IRQ8 19
49#define ARIZONA_IRQ_SPK_SHUTDOWN_WARN 20 49#define ARIZONA_IRQ_SPK_OVERHEAT_WARN 20
50#define ARIZONA_IRQ_SPK_SHUTDOWN 21 50#define ARIZONA_IRQ_SPK_OVERHEAT 21
51#define ARIZONA_IRQ_MICDET 22 51#define ARIZONA_IRQ_MICDET 22
52#define ARIZONA_IRQ_HPDET 23 52#define ARIZONA_IRQ_HPDET 23
53#define ARIZONA_IRQ_WSEQ_DONE 24 53#define ARIZONA_IRQ_WSEQ_DONE 24
@@ -78,8 +78,31 @@ enum arizona_type {
78#define ARIZONA_IRQ_FLL1_CLOCK_OK 49 78#define ARIZONA_IRQ_FLL1_CLOCK_OK 49
79#define ARIZONA_IRQ_MICD_CLAMP_RISE 50 79#define ARIZONA_IRQ_MICD_CLAMP_RISE 50
80#define ARIZONA_IRQ_MICD_CLAMP_FALL 51 80#define ARIZONA_IRQ_MICD_CLAMP_FALL 51
81 81#define ARIZONA_IRQ_HP3R_DONE 52
82#define ARIZONA_NUM_IRQ 52 82#define ARIZONA_IRQ_HP3L_DONE 53
83#define ARIZONA_IRQ_HP2R_DONE 54
84#define ARIZONA_IRQ_HP2L_DONE 55
85#define ARIZONA_IRQ_HP1R_DONE 56
86#define ARIZONA_IRQ_HP1L_DONE 57
87#define ARIZONA_IRQ_ISRC3_CFG_ERR 58
88#define ARIZONA_IRQ_DSP_SHARED_WR_COLL 59
89#define ARIZONA_IRQ_SPK_SHUTDOWN 60
90#define ARIZONA_IRQ_SPK1R_SHORT 61
91#define ARIZONA_IRQ_SPK1L_SHORT 62
92#define ARIZONA_IRQ_HP3R_SC_NEG 63
93#define ARIZONA_IRQ_HP3R_SC_POS 64
94#define ARIZONA_IRQ_HP3L_SC_NEG 65
95#define ARIZONA_IRQ_HP3L_SC_POS 66
96#define ARIZONA_IRQ_HP2R_SC_NEG 67
97#define ARIZONA_IRQ_HP2R_SC_POS 68
98#define ARIZONA_IRQ_HP2L_SC_NEG 69
99#define ARIZONA_IRQ_HP2L_SC_POS 70
100#define ARIZONA_IRQ_HP1R_SC_NEG 71
101#define ARIZONA_IRQ_HP1R_SC_POS 72
102#define ARIZONA_IRQ_HP1L_SC_NEG 73
103#define ARIZONA_IRQ_HP1L_SC_POS 74
104
105#define ARIZONA_NUM_IRQ 75
83 106
84struct snd_soc_dapm_context; 107struct snd_soc_dapm_context;
85 108
@@ -109,6 +132,8 @@ struct arizona {
109 struct mutex clk_lock; 132 struct mutex clk_lock;
110 int clk32k_ref; 133 int clk32k_ref;
111 134
135 bool ctrlif_error;
136
112 struct snd_soc_dapm_context *dapm; 137 struct snd_soc_dapm_context *dapm;
113 138
114 int tdm_width[ARIZONA_MAX_AIF]; 139 int tdm_width[ARIZONA_MAX_AIF];
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 7204d8138b24..c0b075f6bc35 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -27,6 +27,7 @@
27#define ARIZONA_WRITE_SEQUENCER_CTRL_0 0x16 27#define ARIZONA_WRITE_SEQUENCER_CTRL_0 0x16
28#define ARIZONA_WRITE_SEQUENCER_CTRL_1 0x17 28#define ARIZONA_WRITE_SEQUENCER_CTRL_1 0x17
29#define ARIZONA_WRITE_SEQUENCER_CTRL_2 0x18 29#define ARIZONA_WRITE_SEQUENCER_CTRL_2 0x18
30#define ARIZONA_WRITE_SEQUENCER_CTRL_3 0x19
30#define ARIZONA_WRITE_SEQUENCER_PROM 0x1A 31#define ARIZONA_WRITE_SEQUENCER_PROM 0x1A
31#define ARIZONA_TONE_GENERATOR_1 0x20 32#define ARIZONA_TONE_GENERATOR_1 0x20
32#define ARIZONA_TONE_GENERATOR_2 0x21 33#define ARIZONA_TONE_GENERATOR_2 0x21
@@ -70,7 +71,9 @@
70#define ARIZONA_SAMPLE_RATE_3_STATUS 0x10C 71#define ARIZONA_SAMPLE_RATE_3_STATUS 0x10C
71#define ARIZONA_ASYNC_CLOCK_1 0x112 72#define ARIZONA_ASYNC_CLOCK_1 0x112
72#define ARIZONA_ASYNC_SAMPLE_RATE_1 0x113 73#define ARIZONA_ASYNC_SAMPLE_RATE_1 0x113
74#define ARIZONA_ASYNC_SAMPLE_RATE_2 0x114
73#define ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS 0x11B 75#define ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS 0x11B
76#define ARIZONA_ASYNC_SAMPLE_RATE_2_STATUS 0x11C
74#define ARIZONA_OUTPUT_SYSTEM_CLOCK 0x149 77#define ARIZONA_OUTPUT_SYSTEM_CLOCK 0x149
75#define ARIZONA_OUTPUT_ASYNC_CLOCK 0x14A 78#define ARIZONA_OUTPUT_ASYNC_CLOCK 0x14A
76#define ARIZONA_RATE_ESTIMATOR_1 0x152 79#define ARIZONA_RATE_ESTIMATOR_1 0x152
@@ -878,22 +881,26 @@
878#define ARIZONA_INTERRUPT_STATUS_3 0xD02 881#define ARIZONA_INTERRUPT_STATUS_3 0xD02
879#define ARIZONA_INTERRUPT_STATUS_4 0xD03 882#define ARIZONA_INTERRUPT_STATUS_4 0xD03
880#define ARIZONA_INTERRUPT_STATUS_5 0xD04 883#define ARIZONA_INTERRUPT_STATUS_5 0xD04
884#define ARIZONA_INTERRUPT_STATUS_6 0xD05
881#define ARIZONA_INTERRUPT_STATUS_1_MASK 0xD08 885#define ARIZONA_INTERRUPT_STATUS_1_MASK 0xD08
882#define ARIZONA_INTERRUPT_STATUS_2_MASK 0xD09 886#define ARIZONA_INTERRUPT_STATUS_2_MASK 0xD09
883#define ARIZONA_INTERRUPT_STATUS_3_MASK 0xD0A 887#define ARIZONA_INTERRUPT_STATUS_3_MASK 0xD0A
884#define ARIZONA_INTERRUPT_STATUS_4_MASK 0xD0B 888#define ARIZONA_INTERRUPT_STATUS_4_MASK 0xD0B
885#define ARIZONA_INTERRUPT_STATUS_5_MASK 0xD0C 889#define ARIZONA_INTERRUPT_STATUS_5_MASK 0xD0C
890#define ARIZONA_INTERRUPT_STATUS_6_MASK 0xD0D
886#define ARIZONA_INTERRUPT_CONTROL 0xD0F 891#define ARIZONA_INTERRUPT_CONTROL 0xD0F
887#define ARIZONA_IRQ2_STATUS_1 0xD10 892#define ARIZONA_IRQ2_STATUS_1 0xD10
888#define ARIZONA_IRQ2_STATUS_2 0xD11 893#define ARIZONA_IRQ2_STATUS_2 0xD11
889#define ARIZONA_IRQ2_STATUS_3 0xD12 894#define ARIZONA_IRQ2_STATUS_3 0xD12
890#define ARIZONA_IRQ2_STATUS_4 0xD13 895#define ARIZONA_IRQ2_STATUS_4 0xD13
891#define ARIZONA_IRQ2_STATUS_5 0xD14 896#define ARIZONA_IRQ2_STATUS_5 0xD14
897#define ARIZONA_IRQ2_STATUS_6 0xD15
892#define ARIZONA_IRQ2_STATUS_1_MASK 0xD18 898#define ARIZONA_IRQ2_STATUS_1_MASK 0xD18
893#define ARIZONA_IRQ2_STATUS_2_MASK 0xD19 899#define ARIZONA_IRQ2_STATUS_2_MASK 0xD19
894#define ARIZONA_IRQ2_STATUS_3_MASK 0xD1A 900#define ARIZONA_IRQ2_STATUS_3_MASK 0xD1A
895#define ARIZONA_IRQ2_STATUS_4_MASK 0xD1B 901#define ARIZONA_IRQ2_STATUS_4_MASK 0xD1B
896#define ARIZONA_IRQ2_STATUS_5_MASK 0xD1C 902#define ARIZONA_IRQ2_STATUS_5_MASK 0xD1C
903#define ARIZONA_IRQ2_STATUS_6_MASK 0xD1D
897#define ARIZONA_IRQ2_CONTROL 0xD1F 904#define ARIZONA_IRQ2_CONTROL 0xD1F
898#define ARIZONA_INTERRUPT_RAW_STATUS_2 0xD20 905#define ARIZONA_INTERRUPT_RAW_STATUS_2 0xD20
899#define ARIZONA_INTERRUPT_RAW_STATUS_3 0xD21 906#define ARIZONA_INTERRUPT_RAW_STATUS_3 0xD21
@@ -902,6 +909,7 @@
902#define ARIZONA_INTERRUPT_RAW_STATUS_6 0xD24 909#define ARIZONA_INTERRUPT_RAW_STATUS_6 0xD24
903#define ARIZONA_INTERRUPT_RAW_STATUS_7 0xD25 910#define ARIZONA_INTERRUPT_RAW_STATUS_7 0xD25
904#define ARIZONA_INTERRUPT_RAW_STATUS_8 0xD26 911#define ARIZONA_INTERRUPT_RAW_STATUS_8 0xD26
912#define ARIZONA_INTERRUPT_RAW_STATUS_9 0xD28
905#define ARIZONA_IRQ_PIN_STATUS 0xD40 913#define ARIZONA_IRQ_PIN_STATUS 0xD40
906#define ARIZONA_ADSP2_IRQ0 0xD41 914#define ARIZONA_ADSP2_IRQ0 0xD41
907#define ARIZONA_AOD_WKUP_AND_TRIG 0xD50 915#define ARIZONA_AOD_WKUP_AND_TRIG 0xD50
@@ -1659,16 +1667,30 @@
1659/* 1667/*
1660 * R275 (0x113) - Async sample rate 1 1668 * R275 (0x113) - Async sample rate 1
1661 */ 1669 */
1662#define ARIZONA_ASYNC_SAMPLE_RATE_MASK 0x001F /* ASYNC_SAMPLE_RATE - [4:0] */ 1670#define ARIZONA_ASYNC_SAMPLE_RATE_1_MASK 0x001F /* ASYNC_SAMPLE_RATE_1 - [4:0] */
1663#define ARIZONA_ASYNC_SAMPLE_RATE_SHIFT 0 /* ASYNC_SAMPLE_RATE - [4:0] */ 1671#define ARIZONA_ASYNC_SAMPLE_RATE_1_SHIFT 0 /* ASYNC_SAMPLE_RATE_1 - [4:0] */
1664#define ARIZONA_ASYNC_SAMPLE_RATE_WIDTH 5 /* ASYNC_SAMPLE_RATE - [4:0] */ 1672#define ARIZONA_ASYNC_SAMPLE_RATE_1_WIDTH 5 /* ASYNC_SAMPLE_RATE_1 - [4:0] */
1673
1674/*
1675 * R276 (0x114) - Async sample rate 2
1676 */
1677#define ARIZONA_ASYNC_SAMPLE_RATE_2_MASK 0x001F /* ASYNC_SAMPLE_RATE_2 - [4:0] */
1678#define ARIZONA_ASYNC_SAMPLE_RATE_2_SHIFT 0 /* ASYNC_SAMPLE_RATE_2 - [4:0] */
1679#define ARIZONA_ASYNC_SAMPLE_RATE_2_WIDTH 5 /* ASYNC_SAMPLE_RATE_2 - [4:0] */
1665 1680
1666/* 1681/*
1667 * R283 (0x11B) - Async sample rate 1 status 1682 * R283 (0x11B) - Async sample rate 1 status
1668 */ 1683 */
1669#define ARIZONA_ASYNC_SAMPLE_RATE_STS_MASK 0x001F /* ASYNC_SAMPLE_RATE_STS - [4:0] */ 1684#define ARIZONA_ASYNC_SAMPLE_RATE_1_STS_MASK 0x001F /* ASYNC_SAMPLE_RATE_1_STS - [4:0] */
1670#define ARIZONA_ASYNC_SAMPLE_RATE_STS_SHIFT 0 /* ASYNC_SAMPLE_RATE_STS - [4:0] */ 1685#define ARIZONA_ASYNC_SAMPLE_RATE_1_STS_SHIFT 0 /* ASYNC_SAMPLE_RATE_1_STS - [4:0] */
1671#define ARIZONA_ASYNC_SAMPLE_RATE_STS_WIDTH 5 /* ASYNC_SAMPLE_RATE_STS - [4:0] */ 1686#define ARIZONA_ASYNC_SAMPLE_RATE_1_STS_WIDTH 5 /* ASYNC_SAMPLE_RATE_1_STS - [4:0] */
1687
1688/*
1689 * R284 (0x11C) - Async sample rate 2 status
1690 */
1691#define ARIZONA_ASYNC_SAMPLE_RATE_2_STS_MASK 0x001F /* ASYNC_SAMPLE_RATE_2_STS - [4:0] */
1692#define ARIZONA_ASYNC_SAMPLE_RATE_2_STS_SHIFT 0 /* ASYNC_SAMPLE_RATE_2_STS - [4:0] */
1693#define ARIZONA_ASYNC_SAMPLE_RATE_2_STS_WIDTH 5 /* ASYNC_SAMPLE_RATE_2_STS - [4:0] */
1672 1694
1673/* 1695/*
1674 * R329 (0x149) - Output system clock 1696 * R329 (0x149) - Output system clock
@@ -4691,14 +4713,14 @@
4691/* 4713/*
4692 * R3330 (0xD02) - Interrupt Status 3 4714 * R3330 (0xD02) - Interrupt Status 3
4693 */ 4715 */
4694#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1 0x8000 /* SPK_SHUTDOWN_WARN_EINT1 */ 4716#define ARIZONA_SPK_OVERHEAT_WARN_EINT1 0x8000 /* SPK_OVERHEAT_WARN_EINT1 */
4695#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1_MASK 0x8000 /* SPK_SHUTDOWN_WARN_EINT1 */ 4717#define ARIZONA_SPK_OVERHEAT_WARN_EINT1_MASK 0x8000 /* SPK_OVERHEAD_WARN_EINT1 */
4696#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1_SHIFT 15 /* SPK_SHUTDOWN_WARN_EINT1 */ 4718#define ARIZONA_SPK_OVERHEAT_WARN_EINT1_SHIFT 15 /* SPK_OVERHEAT_WARN_EINT1 */
4697#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1_WIDTH 1 /* SPK_SHUTDOWN_WARN_EINT1 */ 4719#define ARIZONA_SPK_OVERHEAT_WARN_EINT1_WIDTH 1 /* SPK_OVERHEAT_WARN_EINT1 */
4698#define ARIZONA_SPK_SHUTDOWN_EINT1 0x4000 /* SPK_SHUTDOWN_EINT1 */ 4720#define ARIZONA_SPK_OVERHEAT_EINT1 0x4000 /* SPK_OVERHEAT_EINT1 */
4699#define ARIZONA_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* SPK_SHUTDOWN_EINT1 */ 4721#define ARIZONA_SPK_OVERHEAT_EINT1_MASK 0x4000 /* SPK_OVERHEAT_EINT1 */
4700#define ARIZONA_SPK_SHUTDOWN_EINT1_SHIFT 14 /* SPK_SHUTDOWN_EINT1 */ 4722#define ARIZONA_SPK_OVERHEAT_EINT1_SHIFT 14 /* SPK_OVERHEAT_EINT1 */
4701#define ARIZONA_SPK_SHUTDOWN_EINT1_WIDTH 1 /* SPK_SHUTDOWN_EINT1 */ 4723#define ARIZONA_SPK_OVERHEAT_EINT1_WIDTH 1 /* SPK_OVERHEAT_EINT1 */
4702#define ARIZONA_HPDET_EINT1 0x2000 /* HPDET_EINT1 */ 4724#define ARIZONA_HPDET_EINT1 0x2000 /* HPDET_EINT1 */
4703#define ARIZONA_HPDET_EINT1_MASK 0x2000 /* HPDET_EINT1 */ 4725#define ARIZONA_HPDET_EINT1_MASK 0x2000 /* HPDET_EINT1 */
4704#define ARIZONA_HPDET_EINT1_SHIFT 13 /* HPDET_EINT1 */ 4726#define ARIZONA_HPDET_EINT1_SHIFT 13 /* HPDET_EINT1 */
@@ -4795,6 +4817,77 @@
4795#define ARIZONA_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* ISRC2_CFG_ERR_EINT1 */ 4817#define ARIZONA_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* ISRC2_CFG_ERR_EINT1 */
4796#define ARIZONA_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* ISRC2_CFG_ERR_EINT1 */ 4818#define ARIZONA_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* ISRC2_CFG_ERR_EINT1 */
4797#define ARIZONA_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* ISRC2_CFG_ERR_EINT1 */ 4819#define ARIZONA_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* ISRC2_CFG_ERR_EINT1 */
4820#define ARIZONA_HP3R_DONE_EINT1 0x0020 /* HP3R_DONE_EINT1 */
4821#define ARIZONA_HP3R_DONE_EINT1_MASK 0x0020 /* HP3R_DONE_EINT1 */
4822#define ARIZONA_HP3R_DONE_EINT1_SHIFT 5 /* HP3R_DONE_EINT1 */
4823#define ARIZONA_HP3R_DONE_EINT1_WIDTH 1 /* HP3R_DONE_EINT1 */
4824#define ARIZONA_HP3L_DONE_EINT1 0x0010 /* HP3L_DONE_EINT1 */
4825#define ARIZONA_HP3L_DONE_EINT1_MASK 0x0010 /* HP3L_DONE_EINT1 */
4826#define ARIZONA_HP3L_DONE_EINT1_SHIFT 4 /* HP3L_DONE_EINT1 */
4827#define ARIZONA_HP3L_DONE_EINT1_WIDTH 1 /* HP3L_DONE_EINT1 */
4828#define ARIZONA_HP2R_DONE_EINT1 0x0008 /* HP2R_DONE_EINT1 */
4829#define ARIZONA_HP2R_DONE_EINT1_MASK 0x0008 /* HP2R_DONE_EINT1 */
4830#define ARIZONA_HP2R_DONE_EINT1_SHIFT 3 /* HP2R_DONE_EINT1 */
4831#define ARIZONA_HP2R_DONE_EINT1_WIDTH 1 /* HP2R_DONE_EINT1 */
4832#define ARIZONA_HP2L_DONE_EINT1 0x0004 /* HP2L_DONE_EINT1 */
4833#define ARIZONA_HP2L_DONE_EINT1_MASK 0x0004 /* HP2L_DONE_EINT1 */
4834#define ARIZONA_HP2L_DONE_EINT1_SHIFT 2 /* HP2L_DONE_EINT1 */
4835#define ARIZONA_HP2L_DONE_EINT1_WIDTH 1 /* HP2L_DONE_EINT1 */
4836#define ARIZONA_HP1R_DONE_EINT1 0x0002 /* HP1R_DONE_EINT1 */
4837#define ARIZONA_HP1R_DONE_EINT1_MASK 0x0002 /* HP1R_DONE_EINT1 */
4838#define ARIZONA_HP1R_DONE_EINT1_SHIFT 1 /* HP1R_DONE_EINT1 */
4839#define ARIZONA_HP1R_DONE_EINT1_WIDTH 1 /* HP1R_DONE_EINT1 */
4840#define ARIZONA_HP1L_DONE_EINT1 0x0001 /* HP1L_DONE_EINT1 */
4841#define ARIZONA_HP1L_DONE_EINT1_MASK 0x0001 /* HP1L_DONE_EINT1 */
4842#define ARIZONA_HP1L_DONE_EINT1_SHIFT 0 /* HP1L_DONE_EINT1 */
4843#define ARIZONA_HP1L_DONE_EINT1_WIDTH 1 /* HP1L_DONE_EINT1 */
4844
4845/*
4846 * R3331 (0xD03) - Interrupt Status 4 (Alternate layout)
4847 *
4848 * Alternate layout used on later devices, note only fields that have moved
4849 * are specified
4850 */
4851#define ARIZONA_V2_AIF3_ERR_EINT1 0x8000 /* AIF3_ERR_EINT1 */
4852#define ARIZONA_V2_AIF3_ERR_EINT1_MASK 0x8000 /* AIF3_ERR_EINT1 */
4853#define ARIZONA_V2_AIF3_ERR_EINT1_SHIFT 15 /* AIF3_ERR_EINT1 */
4854#define ARIZONA_V2_AIF3_ERR_EINT1_WIDTH 1 /* AIF3_ERR_EINT1 */
4855#define ARIZONA_V2_AIF2_ERR_EINT1 0x4000 /* AIF2_ERR_EINT1 */
4856#define ARIZONA_V2_AIF2_ERR_EINT1_MASK 0x4000 /* AIF2_ERR_EINT1 */
4857#define ARIZONA_V2_AIF2_ERR_EINT1_SHIFT 14 /* AIF2_ERR_EINT1 */
4858#define ARIZONA_V2_AIF2_ERR_EINT1_WIDTH 1 /* AIF2_ERR_EINT1 */
4859#define ARIZONA_V2_AIF1_ERR_EINT1 0x2000 /* AIF1_ERR_EINT1 */
4860#define ARIZONA_V2_AIF1_ERR_EINT1_MASK 0x2000 /* AIF1_ERR_EINT1 */
4861#define ARIZONA_V2_AIF1_ERR_EINT1_SHIFT 13 /* AIF1_ERR_EINT1 */
4862#define ARIZONA_V2_AIF1_ERR_EINT1_WIDTH 1 /* AIF1_ERR_EINT1 */
4863#define ARIZONA_V2_CTRLIF_ERR_EINT1 0x1000 /* CTRLIF_ERR_EINT1 */
4864#define ARIZONA_V2_CTRLIF_ERR_EINT1_MASK 0x1000 /* CTRLIF_ERR_EINT1 */
4865#define ARIZONA_V2_CTRLIF_ERR_EINT1_SHIFT 12 /* CTRLIF_ERR_EINT1 */
4866#define ARIZONA_V2_CTRLIF_ERR_EINT1_WIDTH 1 /* CTRLIF_ERR_EINT1 */
4867#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1 0x0800 /* MIXER_DROPPED_SAMPLE_EINT1 */
4868#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1_MASK 0x0800 /* MIXER_DROPPED_SAMPLE_EINT1 */
4869#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1_SHIFT 11 /* MIXER_DROPPED_SAMPLE_EINT1 */
4870#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1_WIDTH 1 /* MIXER_DROPPED_SAMPLE_EINT1 */
4871#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1 0x0400 /* ASYNC_CLK_ENA_LOW_EINT1 */
4872#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1_MASK 0x0400 /* ASYNC_CLK_ENA_LOW_EINT1 */
4873#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1_SHIFT 10 /* ASYNC_CLK_ENA_LOW_EINT1 */
4874#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1_WIDTH 1 /* ASYNC_CLK_ENA_LOW_EINT1 */
4875#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1 0x0200 /* SYSCLK_ENA_LOW_EINT1 */
4876#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1_MASK 0x0200 /* SYSCLK_ENA_LOW_EINT1 */
4877#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1_SHIFT 9 /* SYSCLK_ENA_LOW_EINT1 */
4878#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1_WIDTH 1 /* SYSCLK_ENA_LOW_EINT1 */
4879#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1 0x0100 /* ISRC1_CFG_ERR_EINT1 */
4880#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1_MASK 0x0100 /* ISRC1_CFG_ERR_EINT1 */
4881#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1_SHIFT 8 /* ISRC1_CFG_ERR_EINT1 */
4882#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1_WIDTH 1 /* ISRC1_CFG_ERR_EINT1 */
4883#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1 0x0080 /* ISRC2_CFG_ERR_EINT1 */
4884#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1_MASK 0x0080 /* ISRC2_CFG_ERR_EINT1 */
4885#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1_SHIFT 7 /* ISRC2_CFG_ERR_EINT1 */
4886#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* ISRC2_CFG_ERR_EINT1 */
4887#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1 0x0040 /* ISRC3_CFG_ERR_EINT1 */
4888#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1_MASK 0x0040 /* ISRC3_CFG_ERR_EINT1 */
4889#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1_SHIFT 6 /* ISRC3_CFG_ERR_EINT1 */
4890#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1_WIDTH 1 /* ISRC3_CFG_ERR_EINT1 */
4798 4891
4799/* 4892/*
4800 * R3332 (0xD04) - Interrupt Status 5 4893 * R3332 (0xD04) - Interrupt Status 5
@@ -4821,6 +4914,85 @@
4821#define ARIZONA_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* FLL1_CLOCK_OK_EINT1 */ 4914#define ARIZONA_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* FLL1_CLOCK_OK_EINT1 */
4822 4915
4823/* 4916/*
4917 * R3332 (0xD05) - Interrupt Status 5 (Alternate layout)
4918 *
4919 * Alternate layout used on later devices, note only fields that have moved
4920 * are specified
4921 */
4922#define ARIZONA_V2_ASRC_CFG_ERR_EINT1 0x0008 /* ASRC_CFG_ERR_EINT1 */
4923#define ARIZONA_V2_ASRC_CFG_ERR_EINT1_MASK 0x0008 /* ASRC_CFG_ERR_EINT1 */
4924#define ARIZONA_V2_ASRC_CFG_ERR_EINT1_SHIFT 3 /* ASRC_CFG_ERR_EINT1 */
4925#define ARIZONA_V2_ASRC_CFG_ERR_EINT1_WIDTH 1 /* ASRC_CFG_ERR_EINT1 */
4926
4927/*
4928 * R3333 (0xD05) - Interrupt Status 6
4929 */
4930#define ARIZONA_DSP_SHARED_WR_COLL_EINT1 0x8000 /* DSP_SHARED_WR_COLL_EINT1 */
4931#define ARIZONA_DSP_SHARED_WR_COLL_EINT1_MASK 0x8000 /* DSP_SHARED_WR_COLL_EINT1 */
4932#define ARIZONA_DSP_SHARED_WR_COLL_EINT1_SHIFT 15 /* DSP_SHARED_WR_COLL_EINT1 */
4933#define ARIZONA_DSP_SHARED_WR_COLL_EINT1_WIDTH 1 /* DSP_SHARED_WR_COLL_EINT1 */
4934#define ARIZONA_SPK_SHUTDOWN_EINT1 0x4000 /* SPK_SHUTDOWN_EINT1 */
4935#define ARIZONA_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* SPK_SHUTDOWN_EINT1 */
4936#define ARIZONA_SPK_SHUTDOWN_EINT1_SHIFT 14 /* SPK_SHUTDOWN_EINT1 */
4937#define ARIZONA_SPK_SHUTDOWN_EINT1_WIDTH 1 /* SPK_SHUTDOWN_EINT1 */
4938#define ARIZONA_SPK1R_SHORT_EINT1 0x2000 /* SPK1R_SHORT_EINT1 */
4939#define ARIZONA_SPK1R_SHORT_EINT1_MASK 0x2000 /* SPK1R_SHORT_EINT1 */
4940#define ARIZONA_SPK1R_SHORT_EINT1_SHIFT 13 /* SPK1R_SHORT_EINT1 */
4941#define ARIZONA_SPK1R_SHORT_EINT1_WIDTH 1 /* SPK1R_SHORT_EINT1 */
4942#define ARIZONA_SPK1L_SHORT_EINT1 0x1000 /* SPK1L_SHORT_EINT1 */
4943#define ARIZONA_SPK1L_SHORT_EINT1_MASK 0x1000 /* SPK1L_SHORT_EINT1 */
4944#define ARIZONA_SPK1L_SHORT_EINT1_SHIFT 12 /* SPK1L_SHORT_EINT1 */
4945#define ARIZONA_SPK1L_SHORT_EINT1_WIDTH 1 /* SPK1L_SHORT_EINT1 */
4946#define ARIZONA_HP3R_SC_NEG_EINT1 0x0800 /* HP3R_SC_NEG_EINT1 */
4947#define ARIZONA_HP3R_SC_NEG_EINT1_MASK 0x0800 /* HP3R_SC_NEG_EINT1 */
4948#define ARIZONA_HP3R_SC_NEG_EINT1_SHIFT 11 /* HP3R_SC_NEG_EINT1 */
4949#define ARIZONA_HP3R_SC_NEG_EINT1_WIDTH 1 /* HP3R_SC_NEG_EINT1 */
4950#define ARIZONA_HP3R_SC_POS_EINT1 0x0400 /* HP3R_SC_POS_EINT1 */
4951#define ARIZONA_HP3R_SC_POS_EINT1_MASK 0x0400 /* HP3R_SC_POS_EINT1 */
4952#define ARIZONA_HP3R_SC_POS_EINT1_SHIFT 10 /* HP3R_SC_POS_EINT1 */
4953#define ARIZONA_HP3R_SC_POS_EINT1_WIDTH 1 /* HP3R_SC_POS_EINT1 */
4954#define ARIZONA_HP3L_SC_NEG_EINT1 0x0200 /* HP3L_SC_NEG_EINT1 */
4955#define ARIZONA_HP3L_SC_NEG_EINT1_MASK 0x0200 /* HP3L_SC_NEG_EINT1 */
4956#define ARIZONA_HP3L_SC_NEG_EINT1_SHIFT 9 /* HP3L_SC_NEG_EINT1 */
4957#define ARIZONA_HP3L_SC_NEG_EINT1_WIDTH 1 /* HP3L_SC_NEG_EINT1 */
4958#define ARIZONA_HP3L_SC_POS_EINT1 0x0100 /* HP3L_SC_POS_EINT1 */
4959#define ARIZONA_HP3L_SC_POS_EINT1_MASK 0x0100 /* HP3L_SC_POS_EINT1 */
4960#define ARIZONA_HP3L_SC_POS_EINT1_SHIFT 8 /* HP3L_SC_POS_EINT1 */
4961#define ARIZONA_HP3L_SC_POS_EINT1_WIDTH 1 /* HP3L_SC_POS_EINT1 */
4962#define ARIZONA_HP2R_SC_NEG_EINT1 0x0080 /* HP2R_SC_NEG_EINT1 */
4963#define ARIZONA_HP2R_SC_NEG_EINT1_MASK 0x0080 /* HP2R_SC_NEG_EINT1 */
4964#define ARIZONA_HP2R_SC_NEG_EINT1_SHIFT 7 /* HP2R_SC_NEG_EINT1 */
4965#define ARIZONA_HP2R_SC_NEG_EINT1_WIDTH 1 /* HP2R_SC_NEG_EINT1 */
4966#define ARIZONA_HP2R_SC_POS_EINT1 0x0040 /* HP2R_SC_POS_EINT1 */
4967#define ARIZONA_HP2R_SC_POS_EINT1_MASK 0x0040 /* HP2R_SC_POS_EINT1 */
4968#define ARIZONA_HP2R_SC_POS_EINT1_SHIFT 6 /* HP2R_SC_POS_EINT1 */
4969#define ARIZONA_HP2R_SC_POS_EINT1_WIDTH 1 /* HP2R_SC_POS_EINT1 */
4970#define ARIZONA_HP2L_SC_NEG_EINT1 0x0020 /* HP2L_SC_NEG_EINT1 */
4971#define ARIZONA_HP2L_SC_NEG_EINT1_MASK 0x0020 /* HP2L_SC_NEG_EINT1 */
4972#define ARIZONA_HP2L_SC_NEG_EINT1_SHIFT 5 /* HP2L_SC_NEG_EINT1 */
4973#define ARIZONA_HP2L_SC_NEG_EINT1_WIDTH 1 /* HP2L_SC_NEG_EINT1 */
4974#define ARIZONA_HP2L_SC_POS_EINT1 0x0010 /* HP2L_SC_POS_EINT1 */
4975#define ARIZONA_HP2L_SC_POS_EINT1_MASK 0x0010 /* HP2L_SC_POS_EINT1 */
4976#define ARIZONA_HP2L_SC_POS_EINT1_SHIFT 4 /* HP2L_SC_POS_EINT1 */
4977#define ARIZONA_HP2L_SC_POS_EINT1_WIDTH 1 /* HP2L_SC_POS_EINT1 */
4978#define ARIZONA_HP1R_SC_NEG_EINT1 0x0008 /* HP1R_SC_NEG_EINT1 */
4979#define ARIZONA_HP1R_SC_NEG_EINT1_MASK 0x0008 /* HP1R_SC_NEG_EINT1 */
4980#define ARIZONA_HP1R_SC_NEG_EINT1_SHIFT 3 /* HP1R_SC_NEG_EINT1 */
4981#define ARIZONA_HP1R_SC_NEG_EINT1_WIDTH 1 /* HP1R_SC_NEG_EINT1 */
4982#define ARIZONA_HP1R_SC_POS_EINT1 0x0004 /* HP1R_SC_POS_EINT1 */
4983#define ARIZONA_HP1R_SC_POS_EINT1_MASK 0x0004 /* HP1R_SC_POS_EINT1 */
4984#define ARIZONA_HP1R_SC_POS_EINT1_SHIFT 2 /* HP1R_SC_POS_EINT1 */
4985#define ARIZONA_HP1R_SC_POS_EINT1_WIDTH 1 /* HP1R_SC_POS_EINT1 */
4986#define ARIZONA_HP1L_SC_NEG_EINT1 0x0002 /* HP1L_SC_NEG_EINT1 */
4987#define ARIZONA_HP1L_SC_NEG_EINT1_MASK 0x0002 /* HP1L_SC_NEG_EINT1 */
4988#define ARIZONA_HP1L_SC_NEG_EINT1_SHIFT 1 /* HP1L_SC_NEG_EINT1 */
4989#define ARIZONA_HP1L_SC_NEG_EINT1_WIDTH 1 /* HP1L_SC_NEG_EINT1 */
4990#define ARIZONA_HP1L_SC_POS_EINT1 0x0001 /* HP1L_SC_POS_EINT1 */
4991#define ARIZONA_HP1L_SC_POS_EINT1_MASK 0x0001 /* HP1L_SC_POS_EINT1 */
4992#define ARIZONA_HP1L_SC_POS_EINT1_SHIFT 0 /* HP1L_SC_POS_EINT1 */
4993#define ARIZONA_HP1L_SC_POS_EINT1_WIDTH 1 /* HP1L_SC_POS_EINT1 */
4994
4995/*
4824 * R3336 (0xD08) - Interrupt Status 1 Mask 4996 * R3336 (0xD08) - Interrupt Status 1 Mask
4825 */ 4997 */
4826#define ARIZONA_IM_GP4_EINT1 0x0008 /* IM_GP4_EINT1 */ 4998#define ARIZONA_IM_GP4_EINT1 0x0008 /* IM_GP4_EINT1 */
@@ -4859,14 +5031,14 @@
4859/* 5031/*
4860 * R3338 (0xD0A) - Interrupt Status 3 Mask 5032 * R3338 (0xD0A) - Interrupt Status 3 Mask
4861 */ 5033 */
4862#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5034#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4863#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1_MASK 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5035#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1_MASK 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4864#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1_SHIFT 15 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5036#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1_SHIFT 15 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4865#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1_WIDTH 1 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5037#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1_WIDTH 1 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4866#define ARIZONA_IM_SPK_SHUTDOWN_EINT1 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */ 5038#define ARIZONA_IM_SPK_OVERHEAT_EINT1 0x4000 /* IM_SPK_OVERHEAT_EINT1 */
4867#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */ 5039#define ARIZONA_IM_SPK_OVERHEAT_EINT1_MASK 0x4000 /* IM_SPK_OVERHEAT_EINT1 */
4868#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT1 */ 5040#define ARIZONA_IM_SPK_OVERHEAT_EINT1_SHIFT 14 /* IM_SPK_OVERHEAT_EINT1 */
4869#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT1 */ 5041#define ARIZONA_IM_SPK_OVERHEAT_EINT1_WIDTH 1 /* IM_SPK_OVERHEAT_EINT1 */
4870#define ARIZONA_IM_HPDET_EINT1 0x2000 /* IM_HPDET_EINT1 */ 5042#define ARIZONA_IM_HPDET_EINT1 0x2000 /* IM_HPDET_EINT1 */
4871#define ARIZONA_IM_HPDET_EINT1_MASK 0x2000 /* IM_HPDET_EINT1 */ 5043#define ARIZONA_IM_HPDET_EINT1_MASK 0x2000 /* IM_HPDET_EINT1 */
4872#define ARIZONA_IM_HPDET_EINT1_SHIFT 13 /* IM_HPDET_EINT1 */ 5044#define ARIZONA_IM_HPDET_EINT1_SHIFT 13 /* IM_HPDET_EINT1 */
@@ -4963,6 +5135,77 @@
4963#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT1 */ 5135#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT1 */
4964#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT1 */ 5136#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT1 */
4965#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT1 */ 5137#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT1 */
5138#define ARIZONA_IM_HP3R_DONE_EINT1 0x0020 /* IM_HP3R_DONE_EINT1 */
5139#define ARIZONA_IM_HP3R_DONE_EINT1_MASK 0x0020 /* IM_HP3R_DONE_EINT1 */
5140#define ARIZONA_IM_HP3R_DONE_EINT1_SHIFT 5 /* IM_HP3R_DONE_EINT1 */
5141#define ARIZONA_IM_HP3R_DONE_EINT1_WIDTH 1 /* IM_HP3R_DONE_EINT1 */
5142#define ARIZONA_IM_HP3L_DONE_EINT1 0x0010 /* IM_HP3L_DONE_EINT1 */
5143#define ARIZONA_IM_HP3L_DONE_EINT1_MASK 0x0010 /* IM_HP3L_DONE_EINT1 */
5144#define ARIZONA_IM_HP3L_DONE_EINT1_SHIFT 4 /* IM_HP3L_DONE_EINT1 */
5145#define ARIZONA_IM_HP3L_DONE_EINT1_WIDTH 1 /* IM_HP3L_DONE_EINT1 */
5146#define ARIZONA_IM_HP2R_DONE_EINT1 0x0008 /* IM_HP2R_DONE_EINT1 */
5147#define ARIZONA_IM_HP2R_DONE_EINT1_MASK 0x0008 /* IM_HP2R_DONE_EINT1 */
5148#define ARIZONA_IM_HP2R_DONE_EINT1_SHIFT 3 /* IM_HP2R_DONE_EINT1 */
5149#define ARIZONA_IM_HP2R_DONE_EINT1_WIDTH 1 /* IM_HP2R_DONE_EINT1 */
5150#define ARIZONA_IM_HP2L_DONE_EINT1 0x0004 /* IM_HP2L_DONE_EINT1 */
5151#define ARIZONA_IM_HP2L_DONE_EINT1_MASK 0x0004 /* IM_HP2L_DONE_EINT1 */
5152#define ARIZONA_IM_HP2L_DONE_EINT1_SHIFT 2 /* IM_HP2L_DONE_EINT1 */
5153#define ARIZONA_IM_HP2L_DONE_EINT1_WIDTH 1 /* IM_HP2L_DONE_EINT1 */
5154#define ARIZONA_IM_HP1R_DONE_EINT1 0x0002 /* IM_HP1R_DONE_EINT1 */
5155#define ARIZONA_IM_HP1R_DONE_EINT1_MASK 0x0002 /* IM_HP1R_DONE_EINT1 */
5156#define ARIZONA_IM_HP1R_DONE_EINT1_SHIFT 1 /* IM_HP1R_DONE_EINT1 */
5157#define ARIZONA_IM_HP1R_DONE_EINT1_WIDTH 1 /* IM_HP1R_DONE_EINT1 */
5158#define ARIZONA_IM_HP1L_DONE_EINT1 0x0001 /* IM_HP1L_DONE_EINT1 */
5159#define ARIZONA_IM_HP1L_DONE_EINT1_MASK 0x0001 /* IM_HP1L_DONE_EINT1 */
5160#define ARIZONA_IM_HP1L_DONE_EINT1_SHIFT 0 /* IM_HP1L_DONE_EINT1 */
5161#define ARIZONA_IM_HP1L_DONE_EINT1_WIDTH 1 /* IM_HP1L_DONE_EINT1 */
5162
5163/*
5164 * R3339 (0xD0B) - Interrupt Status 4 Mask (Alternate layout)
5165 *
5166 * Alternate layout used on later devices, note only fields that have moved
5167 * are specified
5168 */
5169#define ARIZONA_V2_IM_AIF3_ERR_EINT1 0x8000 /* IM_AIF3_ERR_EINT1 */
5170#define ARIZONA_V2_IM_AIF3_ERR_EINT1_MASK 0x8000 /* IM_AIF3_ERR_EINT1 */
5171#define ARIZONA_V2_IM_AIF3_ERR_EINT1_SHIFT 15 /* IM_AIF3_ERR_EINT1 */
5172#define ARIZONA_V2_IM_AIF3_ERR_EINT1_WIDTH 1 /* IM_AIF3_ERR_EINT1 */
5173#define ARIZONA_V2_IM_AIF2_ERR_EINT1 0x4000 /* IM_AIF2_ERR_EINT1 */
5174#define ARIZONA_V2_IM_AIF2_ERR_EINT1_MASK 0x4000 /* IM_AIF2_ERR_EINT1 */
5175#define ARIZONA_V2_IM_AIF2_ERR_EINT1_SHIFT 14 /* IM_AIF2_ERR_EINT1 */
5176#define ARIZONA_V2_IM_AIF2_ERR_EINT1_WIDTH 1 /* IM_AIF2_ERR_EINT1 */
5177#define ARIZONA_V2_IM_AIF1_ERR_EINT1 0x2000 /* IM_AIF1_ERR_EINT1 */
5178#define ARIZONA_V2_IM_AIF1_ERR_EINT1_MASK 0x2000 /* IM_AIF1_ERR_EINT1 */
5179#define ARIZONA_V2_IM_AIF1_ERR_EINT1_SHIFT 13 /* IM_AIF1_ERR_EINT1 */
5180#define ARIZONA_V2_IM_AIF1_ERR_EINT1_WIDTH 1 /* IM_AIF1_ERR_EINT1 */
5181#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1 0x1000 /* IM_CTRLIF_ERR_EINT1 */
5182#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1_MASK 0x1000 /* IM_CTRLIF_ERR_EINT1 */
5183#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1_SHIFT 12 /* IM_CTRLIF_ERR_EINT1 */
5184#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1_WIDTH 1 /* IM_CTRLIF_ERR_EINT1 */
5185#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5186#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1_MASK 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5187#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1_SHIFT 11 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5188#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1_WIDTH 1 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5189#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5190#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1_MASK 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5191#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1_SHIFT 10 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5192#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1_WIDTH 1 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5193#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1 0x0200 /* IM_SYSCLK_ENA_LOW_EINT1 */
5194#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1_MASK 0x0200 /* IM_SYSCLK_ENA_LOW_EINT1 */
5195#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1_SHIFT 9 /* IM_SYSCLK_ENA_LOW_EINT1 */
5196#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1_WIDTH 1 /* IM_SYSCLK_ENA_LOW_EINT1 */
5197#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1 0x0100 /* IM_ISRC1_CFG_ERR_EINT1 */
5198#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1_MASK 0x0100 /* IM_ISRC1_CFG_ERR_EINT1 */
5199#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1_SHIFT 8 /* IM_ISRC1_CFG_ERR_EINT1 */
5200#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC1_CFG_ERR_EINT1 */
5201#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1 0x0080 /* IM_ISRC2_CFG_ERR_EINT1 */
5202#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1_MASK 0x0080 /* IM_ISRC2_CFG_ERR_EINT1 */
5203#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1_SHIFT 7 /* IM_ISRC2_CFG_ERR_EINT1 */
5204#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT1 */
5205#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1 0x0040 /* IM_ISRC3_CFG_ERR_EINT1 */
5206#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1_MASK 0x0040 /* IM_ISRC3_CFG_ERR_EINT1 */
5207#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1_SHIFT 6 /* IM_ISRC3_CFG_ERR_EINT1 */
5208#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC3_CFG_ERR_EINT1 */
4966 5209
4967/* 5210/*
4968 * R3340 (0xD0C) - Interrupt Status 5 Mask 5211 * R3340 (0xD0C) - Interrupt Status 5 Mask
@@ -4989,6 +5232,85 @@
4989#define ARIZONA_IM_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT1 */ 5232#define ARIZONA_IM_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT1 */
4990 5233
4991/* 5234/*
5235 * R3340 (0xD0C) - Interrupt Status 5 Mask (Alternate layout)
5236 *
5237 * Alternate layout used on later devices, note only fields that have moved
5238 * are specified
5239 */
5240#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1 0x0008 /* IM_ASRC_CFG_ERR_EINT1 */
5241#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1_MASK 0x0008 /* IM_ASRC_CFG_ERR_EINT1 */
5242#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1_SHIFT 3 /* IM_ASRC_CFG_ERR_EINT1 */
5243#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1_WIDTH 1 /* IM_ASRC_CFG_ERR_EINT1 */
5244
5245/*
5246 * R3341 (0xD0D) - Interrupt Status 6 Mask
5247 */
5248#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5249#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1_MASK 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5250#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1_SHIFT 15 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5251#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1_WIDTH 1 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5252#define ARIZONA_IM_SPK_SHUTDOWN_EINT1 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */
5253#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */
5254#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT1 */
5255#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT1 */
5256#define ARIZONA_IM_SPK1R_SHORT_EINT1 0x2000 /* IM_SPK1R_SHORT_EINT1 */
5257#define ARIZONA_IM_SPK1R_SHORT_EINT1_MASK 0x2000 /* IM_SPK1R_SHORT_EINT1 */
5258#define ARIZONA_IM_SPK1R_SHORT_EINT1_SHIFT 13 /* IM_SPK1R_SHORT_EINT1 */
5259#define ARIZONA_IM_SPK1R_SHORT_EINT1_WIDTH 1 /* IM_SPK1R_SHORT_EINT1 */
5260#define ARIZONA_IM_SPK1L_SHORT_EINT1 0x1000 /* IM_SPK1L_SHORT_EINT1 */
5261#define ARIZONA_IM_SPK1L_SHORT_EINT1_MASK 0x1000 /* IM_SPK1L_SHORT_EINT1 */
5262#define ARIZONA_IM_SPK1L_SHORT_EINT1_SHIFT 12 /* IM_SPK1L_SHORT_EINT1 */
5263#define ARIZONA_IM_SPK1L_SHORT_EINT1_WIDTH 1 /* IM_SPK1L_SHORT_EINT1 */
5264#define ARIZONA_IM_HP3R_SC_NEG_EINT1 0x0800 /* IM_HP3R_SC_NEG_EINT1 */
5265#define ARIZONA_IM_HP3R_SC_NEG_EINT1_MASK 0x0800 /* IM_HP3R_SC_NEG_EINT1 */
5266#define ARIZONA_IM_HP3R_SC_NEG_EINT1_SHIFT 11 /* IM_HP3R_SC_NEG_EINT1 */
5267#define ARIZONA_IM_HP3R_SC_NEG_EINT1_WIDTH 1 /* IM_HP3R_SC_NEG_EINT1 */
5268#define ARIZONA_IM_HP3R_SC_POS_EINT1 0x0400 /* IM_HP3R_SC_POS_EINT1 */
5269#define ARIZONA_IM_HP3R_SC_POS_EINT1_MASK 0x0400 /* IM_HP3R_SC_POS_EINT1 */
5270#define ARIZONA_IM_HP3R_SC_POS_EINT1_SHIFT 10 /* IM_HP3R_SC_POS_EINT1 */
5271#define ARIZONA_IM_HP3R_SC_POS_EINT1_WIDTH 1 /* IM_HP3R_SC_POS_EINT1 */
5272#define ARIZONA_IM_HP3L_SC_NEG_EINT1 0x0200 /* IM_HP3L_SC_NEG_EINT1 */
5273#define ARIZONA_IM_HP3L_SC_NEG_EINT1_MASK 0x0200 /* IM_HP3L_SC_NEG_EINT1 */
5274#define ARIZONA_IM_HP3L_SC_NEG_EINT1_SHIFT 9 /* IM_HP3L_SC_NEG_EINT1 */
5275#define ARIZONA_IM_HP3L_SC_NEG_EINT1_WIDTH 1 /* IM_HP3L_SC_NEG_EINT1 */
5276#define ARIZONA_IM_HP3L_SC_POS_EINT1 0x0100 /* IM_HP3L_SC_POS_EINT1 */
5277#define ARIZONA_IM_HP3L_SC_POS_EINT1_MASK 0x0100 /* IM_HP3L_SC_POS_EINT1 */
5278#define ARIZONA_IM_HP3L_SC_POS_EINT1_SHIFT 8 /* IM_HP3L_SC_POS_EINT1 */
5279#define ARIZONA_IM_HP3L_SC_POS_EINT1_WIDTH 1 /* IM_HP3L_SC_POS_EINT1 */
5280#define ARIZONA_IM_HP2R_SC_NEG_EINT1 0x0080 /* IM_HP2R_SC_NEG_EINT1 */
5281#define ARIZONA_IM_HP2R_SC_NEG_EINT1_MASK 0x0080 /* IM_HP2R_SC_NEG_EINT1 */
5282#define ARIZONA_IM_HP2R_SC_NEG_EINT1_SHIFT 7 /* IM_HP2R_SC_NEG_EINT1 */
5283#define ARIZONA_IM_HP2R_SC_NEG_EINT1_WIDTH 1 /* IM_HP2R_SC_NEG_EINT1 */
5284#define ARIZONA_IM_HP2R_SC_POS_EINT1 0x0040 /* IM_HP2R_SC_POS_EINT1 */
5285#define ARIZONA_IM_HP2R_SC_POS_EINT1_MASK 0x0040 /* IM_HP2R_SC_POS_EINT1 */
5286#define ARIZONA_IM_HP2R_SC_POS_EINT1_SHIFT 6 /* IM_HP2R_SC_POS_EINT1 */
5287#define ARIZONA_IM_HP2R_SC_POS_EINT1_WIDTH 1 /* IM_HP2R_SC_POS_EINT1 */
5288#define ARIZONA_IM_HP2L_SC_NEG_EINT1 0x0020 /* IM_HP2L_SC_NEG_EINT1 */
5289#define ARIZONA_IM_HP2L_SC_NEG_EINT1_MASK 0x0020 /* IM_HP2L_SC_NEG_EINT1 */
5290#define ARIZONA_IM_HP2L_SC_NEG_EINT1_SHIFT 5 /* IM_HP2L_SC_NEG_EINT1 */
5291#define ARIZONA_IM_HP2L_SC_NEG_EINT1_WIDTH 1 /* IM_HP2L_SC_NEG_EINT1 */
5292#define ARIZONA_IM_HP2L_SC_POS_EINT1 0x0010 /* IM_HP2L_SC_POS_EINT1 */
5293#define ARIZONA_IM_HP2L_SC_POS_EINT1_MASK 0x0010 /* IM_HP2L_SC_POS_EINT1 */
5294#define ARIZONA_IM_HP2L_SC_POS_EINT1_SHIFT 4 /* IM_HP2L_SC_POS_EINT1 */
5295#define ARIZONA_IM_HP2L_SC_POS_EINT1_WIDTH 1 /* IM_HP2L_SC_POS_EINT1 */
5296#define ARIZONA_IM_HP1R_SC_NEG_EINT1 0x0008 /* IM_HP1R_SC_NEG_EINT1 */
5297#define ARIZONA_IM_HP1R_SC_NEG_EINT1_MASK 0x0008 /* IM_HP1R_SC_NEG_EINT1 */
5298#define ARIZONA_IM_HP1R_SC_NEG_EINT1_SHIFT 3 /* IM_HP1R_SC_NEG_EINT1 */
5299#define ARIZONA_IM_HP1R_SC_NEG_EINT1_WIDTH 1 /* IM_HP1R_SC_NEG_EINT1 */
5300#define ARIZONA_IM_HP1R_SC_POS_EINT1 0x0004 /* IM_HP1R_SC_POS_EINT1 */
5301#define ARIZONA_IM_HP1R_SC_POS_EINT1_MASK 0x0004 /* IM_HP1R_SC_POS_EINT1 */
5302#define ARIZONA_IM_HP1R_SC_POS_EINT1_SHIFT 2 /* IM_HP1R_SC_POS_EINT1 */
5303#define ARIZONA_IM_HP1R_SC_POS_EINT1_WIDTH 1 /* IM_HP1R_SC_POS_EINT1 */
5304#define ARIZONA_IM_HP1L_SC_NEG_EINT1 0x0002 /* IM_HP1L_SC_NEG_EINT1 */
5305#define ARIZONA_IM_HP1L_SC_NEG_EINT1_MASK 0x0002 /* IM_HP1L_SC_NEG_EINT1 */
5306#define ARIZONA_IM_HP1L_SC_NEG_EINT1_SHIFT 1 /* IM_HP1L_SC_NEG_EINT1 */
5307#define ARIZONA_IM_HP1L_SC_NEG_EINT1_WIDTH 1 /* IM_HP1L_SC_NEG_EINT1 */
5308#define ARIZONA_IM_HP1L_SC_POS_EINT1 0x0001 /* IM_HP1L_SC_POS_EINT1 */
5309#define ARIZONA_IM_HP1L_SC_POS_EINT1_MASK 0x0001 /* IM_HP1L_SC_POS_EINT1 */
5310#define ARIZONA_IM_HP1L_SC_POS_EINT1_SHIFT 0 /* IM_HP1L_SC_POS_EINT1 */
5311#define ARIZONA_IM_HP1L_SC_POS_EINT1_WIDTH 1 /* IM_HP1L_SC_POS_EINT1 */
5312
5313/*
4992 * R3343 (0xD0F) - Interrupt Control 5314 * R3343 (0xD0F) - Interrupt Control
4993 */ 5315 */
4994#define ARIZONA_IM_IRQ1 0x0001 /* IM_IRQ1 */ 5316#define ARIZONA_IM_IRQ1 0x0001 /* IM_IRQ1 */
@@ -5035,14 +5357,14 @@
5035/* 5357/*
5036 * R3346 (0xD12) - IRQ2 Status 3 5358 * R3346 (0xD12) - IRQ2 Status 3
5037 */ 5359 */
5038#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2 0x8000 /* SPK_SHUTDOWN_WARN_EINT2 */ 5360#define ARIZONA_SPK_OVERHEAT_WARN_EINT2 0x8000 /* SPK_OVERHEAT_WARN_EINT2 */
5039#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2_MASK 0x8000 /* SPK_SHUTDOWN_WARN_EINT2 */ 5361#define ARIZONA_SPK_OVERHEAT_WARN_EINT2_MASK 0x8000 /* SPK_OVERHEAT_WARN_EINT2 */
5040#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2_SHIFT 15 /* SPK_SHUTDOWN_WARN_EINT2 */ 5362#define ARIZONA_SPK_OVERHEAT_WARN_EINT2_SHIFT 15 /* SPK_OVERHEAT_WARN_EINT2 */
5041#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2_WIDTH 1 /* SPK_SHUTDOWN_WARN_EINT2 */ 5363#define ARIZONA_SPK_OVERHEAT_WARN_EINT2_WIDTH 1 /* SPK_OVERHEAT_WARN_EINT2 */
5042#define ARIZONA_SPK_SHUTDOWN_EINT2 0x4000 /* SPK_SHUTDOWN_EINT2 */ 5364#define ARIZONA_SPK_OVERHEAT_EINT2 0x4000 /* SPK_OVERHEAT_EINT2 */
5043#define ARIZONA_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* SPK_SHUTDOWN_EINT2 */ 5365#define ARIZONA_SPK_OVERHEAT_EINT2_MASK 0x4000 /* SPK_OVERHEAT_EINT2 */
5044#define ARIZONA_SPK_SHUTDOWN_EINT2_SHIFT 14 /* SPK_SHUTDOWN_EINT2 */ 5366#define ARIZONA_SPK_OVERHEAT_EINT2_SHIFT 14 /* SPK_OVERHEAT_EINT2 */
5045#define ARIZONA_SPK_SHUTDOWN_EINT2_WIDTH 1 /* SPK_SHUTDOWN_EINT2 */ 5367#define ARIZONA_SPK_OVERHEAT_EINT2_WIDTH 1 /* SPK_OVERHEAT_EINT2 */
5046#define ARIZONA_HPDET_EINT2 0x2000 /* HPDET_EINT2 */ 5368#define ARIZONA_HPDET_EINT2 0x2000 /* HPDET_EINT2 */
5047#define ARIZONA_HPDET_EINT2_MASK 0x2000 /* HPDET_EINT2 */ 5369#define ARIZONA_HPDET_EINT2_MASK 0x2000 /* HPDET_EINT2 */
5048#define ARIZONA_HPDET_EINT2_SHIFT 13 /* HPDET_EINT2 */ 5370#define ARIZONA_HPDET_EINT2_SHIFT 13 /* HPDET_EINT2 */
@@ -5139,6 +5461,77 @@
5139#define ARIZONA_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* ISRC2_CFG_ERR_EINT2 */ 5461#define ARIZONA_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* ISRC2_CFG_ERR_EINT2 */
5140#define ARIZONA_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* ISRC2_CFG_ERR_EINT2 */ 5462#define ARIZONA_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* ISRC2_CFG_ERR_EINT2 */
5141#define ARIZONA_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* ISRC2_CFG_ERR_EINT2 */ 5463#define ARIZONA_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* ISRC2_CFG_ERR_EINT2 */
5464#define ARIZONA_HP3R_DONE_EINT2 0x0020 /* HP3R_DONE_EINT2 */
5465#define ARIZONA_HP3R_DONE_EINT2_MASK 0x0020 /* HP3R_DONE_EINT2 */
5466#define ARIZONA_HP3R_DONE_EINT2_SHIFT 5 /* HP3R_DONE_EINT2 */
5467#define ARIZONA_HP3R_DONE_EINT2_WIDTH 1 /* HP3R_DONE_EINT2 */
5468#define ARIZONA_HP3L_DONE_EINT2 0x0010 /* HP3L_DONE_EINT2 */
5469#define ARIZONA_HP3L_DONE_EINT2_MASK 0x0010 /* HP3L_DONE_EINT2 */
5470#define ARIZONA_HP3L_DONE_EINT2_SHIFT 4 /* HP3L_DONE_EINT2 */
5471#define ARIZONA_HP3L_DONE_EINT2_WIDTH 1 /* HP3L_DONE_EINT2 */
5472#define ARIZONA_HP2R_DONE_EINT2 0x0008 /* HP2R_DONE_EINT2 */
5473#define ARIZONA_HP2R_DONE_EINT2_MASK 0x0008 /* HP2R_DONE_EINT2 */
5474#define ARIZONA_HP2R_DONE_EINT2_SHIFT 3 /* HP2R_DONE_EINT2 */
5475#define ARIZONA_HP2R_DONE_EINT2_WIDTH 1 /* HP2R_DONE_EINT2 */
5476#define ARIZONA_HP2L_DONE_EINT2 0x0004 /* HP2L_DONE_EINT2 */
5477#define ARIZONA_HP2L_DONE_EINT2_MASK 0x0004 /* HP2L_DONE_EINT2 */
5478#define ARIZONA_HP2L_DONE_EINT2_SHIFT 2 /* HP2L_DONE_EINT2 */
5479#define ARIZONA_HP2L_DONE_EINT2_WIDTH 1 /* HP2L_DONE_EINT2 */
5480#define ARIZONA_HP1R_DONE_EINT2 0x0002 /* HP1R_DONE_EINT2 */
5481#define ARIZONA_HP1R_DONE_EINT2_MASK 0x0002 /* HP1R_DONE_EINT2 */
5482#define ARIZONA_HP1R_DONE_EINT2_SHIFT 1 /* HP1R_DONE_EINT2 */
5483#define ARIZONA_HP1R_DONE_EINT2_WIDTH 1 /* HP1R_DONE_EINT2 */
5484#define ARIZONA_HP1L_DONE_EINT2 0x0001 /* HP1L_DONE_EINT2 */
5485#define ARIZONA_HP1L_DONE_EINT2_MASK 0x0001 /* HP1L_DONE_EINT2 */
5486#define ARIZONA_HP1L_DONE_EINT2_SHIFT 0 /* HP1L_DONE_EINT2 */
5487#define ARIZONA_HP1L_DONE_EINT2_WIDTH 1 /* HP1L_DONE_EINT2 */
5488
5489/*
5490 * R3347 (0xD13) - IRQ2 Status 4 (Alternate layout)
5491 *
5492 * Alternate layout used on later devices, note only fields that have moved
5493 * are specified
5494 */
5495#define ARIZONA_V2_AIF3_ERR_EINT2 0x8000 /* AIF3_ERR_EINT2 */
5496#define ARIZONA_V2_AIF3_ERR_EINT2_MASK 0x8000 /* AIF3_ERR_EINT2 */
5497#define ARIZONA_V2_AIF3_ERR_EINT2_SHIFT 15 /* AIF3_ERR_EINT2 */
5498#define ARIZONA_V2_AIF3_ERR_EINT2_WIDTH 1 /* AIF3_ERR_EINT2 */
5499#define ARIZONA_V2_AIF2_ERR_EINT2 0x4000 /* AIF2_ERR_EINT2 */
5500#define ARIZONA_V2_AIF2_ERR_EINT2_MASK 0x4000 /* AIF2_ERR_EINT2 */
5501#define ARIZONA_V2_AIF2_ERR_EINT2_SHIFT 14 /* AIF2_ERR_EINT2 */
5502#define ARIZONA_V2_AIF2_ERR_EINT2_WIDTH 1 /* AIF2_ERR_EINT2 */
5503#define ARIZONA_V2_AIF1_ERR_EINT2 0x2000 /* AIF1_ERR_EINT2 */
5504#define ARIZONA_V2_AIF1_ERR_EINT2_MASK 0x2000 /* AIF1_ERR_EINT2 */
5505#define ARIZONA_V2_AIF1_ERR_EINT2_SHIFT 13 /* AIF1_ERR_EINT2 */
5506#define ARIZONA_V2_AIF1_ERR_EINT2_WIDTH 1 /* AIF1_ERR_EINT2 */
5507#define ARIZONA_V2_CTRLIF_ERR_EINT2 0x1000 /* CTRLIF_ERR_EINT2 */
5508#define ARIZONA_V2_CTRLIF_ERR_EINT2_MASK 0x1000 /* CTRLIF_ERR_EINT2 */
5509#define ARIZONA_V2_CTRLIF_ERR_EINT2_SHIFT 12 /* CTRLIF_ERR_EINT2 */
5510#define ARIZONA_V2_CTRLIF_ERR_EINT2_WIDTH 1 /* CTRLIF_ERR_EINT2 */
5511#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2 0x0800 /* MIXER_DROPPED_SAMPLE_EINT2 */
5512#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2_MASK 0x0800 /* MIXER_DROPPED_SAMPLE_EINT2 */
5513#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2_SHIFT 11 /* MIXER_DROPPED_SAMPLE_EINT2 */
5514#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2_WIDTH 1 /* MIXER_DROPPED_SAMPLE_EINT2 */
5515#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2 0x0400 /* ASYNC_CLK_ENA_LOW_EINT2 */
5516#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2_MASK 0x0400 /* ASYNC_CLK_ENA_LOW_EINT2 */
5517#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2_SHIFT 10 /* ASYNC_CLK_ENA_LOW_EINT2 */
5518#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2_WIDTH 1 /* ASYNC_CLK_ENA_LOW_EINT2 */
5519#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2 0x0200 /* SYSCLK_ENA_LOW_EINT2 */
5520#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2_MASK 0x0200 /* SYSCLK_ENA_LOW_EINT2 */
5521#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2_SHIFT 9 /* SYSCLK_ENA_LOW_EINT2 */
5522#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2_WIDTH 1 /* SYSCLK_ENA_LOW_EINT2 */
5523#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2 0x0100 /* ISRC1_CFG_ERR_EINT2 */
5524#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2_MASK 0x0100 /* ISRC1_CFG_ERR_EINT2 */
5525#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2_SHIFT 8 /* ISRC1_CFG_ERR_EINT2 */
5526#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2_WIDTH 1 /* ISRC1_CFG_ERR_EINT2 */
5527#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2 0x0080 /* ISRC2_CFG_ERR_EINT2 */
5528#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2_MASK 0x0080 /* ISRC2_CFG_ERR_EINT2 */
5529#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2_SHIFT 7 /* ISRC2_CFG_ERR_EINT2 */
5530#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* ISRC2_CFG_ERR_EINT2 */
5531#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2 0x0040 /* ISRC3_CFG_ERR_EINT2 */
5532#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2_MASK 0x0040 /* ISRC3_CFG_ERR_EINT2 */
5533#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2_SHIFT 6 /* ISRC3_CFG_ERR_EINT2 */
5534#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2_WIDTH 1 /* ISRC3_CFG_ERR_EINT2 */
5142 5535
5143/* 5536/*
5144 * R3348 (0xD14) - IRQ2 Status 5 5537 * R3348 (0xD14) - IRQ2 Status 5
@@ -5165,6 +5558,85 @@
5165#define ARIZONA_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* FLL1_CLOCK_OK_EINT2 */ 5558#define ARIZONA_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* FLL1_CLOCK_OK_EINT2 */
5166 5559
5167/* 5560/*
5561 * R3348 (0xD14) - IRQ2 Status 5 (Alternate layout)
5562 *
5563 * Alternate layout used on later devices, note only fields that have moved
5564 * are specified
5565 */
5566#define ARIZONA_V2_ASRC_CFG_ERR_EINT2 0x0008 /* ASRC_CFG_ERR_EINT2 */
5567#define ARIZONA_V2_ASRC_CFG_ERR_EINT2_MASK 0x0008 /* ASRC_CFG_ERR_EINT2 */
5568#define ARIZONA_V2_ASRC_CFG_ERR_EINT2_SHIFT 3 /* ASRC_CFG_ERR_EINT2 */
5569#define ARIZONA_V2_ASRC_CFG_ERR_EINT2_WIDTH 1 /* ASRC_CFG_ERR_EINT2 */
5570
5571/*
5572 * R3349 (0xD15) - IRQ2 Status 6
5573 */
5574#define ARIZONA_DSP_SHARED_WR_COLL_EINT2 0x8000 /* DSP_SHARED_WR_COLL_EINT2 */
5575#define ARIZONA_DSP_SHARED_WR_COLL_EINT2_MASK 0x8000 /* DSP_SHARED_WR_COLL_EINT2 */
5576#define ARIZONA_DSP_SHARED_WR_COLL_EINT2_SHIFT 15 /* DSP_SHARED_WR_COLL_EINT2 */
5577#define ARIZONA_DSP_SHARED_WR_COLL_EINT2_WIDTH 1 /* DSP_SHARED_WR_COLL_EINT2 */
5578#define ARIZONA_SPK_SHUTDOWN_EINT2 0x4000 /* SPK_SHUTDOWN_EINT2 */
5579#define ARIZONA_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* SPK_SHUTDOWN_EINT2 */
5580#define ARIZONA_SPK_SHUTDOWN_EINT2_SHIFT 14 /* SPK_SHUTDOWN_EINT2 */
5581#define ARIZONA_SPK_SHUTDOWN_EINT2_WIDTH 1 /* SPK_SHUTDOWN_EINT2 */
5582#define ARIZONA_SPK1R_SHORT_EINT2 0x2000 /* SPK1R_SHORT_EINT2 */
5583#define ARIZONA_SPK1R_SHORT_EINT2_MASK 0x2000 /* SPK1R_SHORT_EINT2 */
5584#define ARIZONA_SPK1R_SHORT_EINT2_SHIFT 13 /* SPK1R_SHORT_EINT2 */
5585#define ARIZONA_SPK1R_SHORT_EINT2_WIDTH 1 /* SPK1R_SHORT_EINT2 */
5586#define ARIZONA_SPK1L_SHORT_EINT2 0x1000 /* SPK1L_SHORT_EINT2 */
5587#define ARIZONA_SPK1L_SHORT_EINT2_MASK 0x1000 /* SPK1L_SHORT_EINT2 */
5588#define ARIZONA_SPK1L_SHORT_EINT2_SHIFT 12 /* SPK1L_SHORT_EINT2 */
5589#define ARIZONA_SPK1L_SHORT_EINT2_WIDTH 1 /* SPK1L_SHORT_EINT2 */
5590#define ARIZONA_HP3R_SC_NEG_EINT2 0x0800 /* HP3R_SC_NEG_EINT2 */
5591#define ARIZONA_HP3R_SC_NEG_EINT2_MASK 0x0800 /* HP3R_SC_NEG_EINT2 */
5592#define ARIZONA_HP3R_SC_NEG_EINT2_SHIFT 11 /* HP3R_SC_NEG_EINT2 */
5593#define ARIZONA_HP3R_SC_NEG_EINT2_WIDTH 1 /* HP3R_SC_NEG_EINT2 */
5594#define ARIZONA_HP3R_SC_POS_EINT2 0x0400 /* HP3R_SC_POS_EINT2 */
5595#define ARIZONA_HP3R_SC_POS_EINT2_MASK 0x0400 /* HP3R_SC_POS_EINT2 */
5596#define ARIZONA_HP3R_SC_POS_EINT2_SHIFT 10 /* HP3R_SC_POS_EINT2 */
5597#define ARIZONA_HP3R_SC_POS_EINT2_WIDTH 1 /* HP3R_SC_POS_EINT2 */
5598#define ARIZONA_HP3L_SC_NEG_EINT2 0x0200 /* HP3L_SC_NEG_EINT2 */
5599#define ARIZONA_HP3L_SC_NEG_EINT2_MASK 0x0200 /* HP3L_SC_NEG_EINT2 */
5600#define ARIZONA_HP3L_SC_NEG_EINT2_SHIFT 9 /* HP3L_SC_NEG_EINT2 */
5601#define ARIZONA_HP3L_SC_NEG_EINT2_WIDTH 1 /* HP3L_SC_NEG_EINT2 */
5602#define ARIZONA_HP3L_SC_POS_EINT2 0x0100 /* HP3L_SC_POS_EINT2 */
5603#define ARIZONA_HP3L_SC_POS_EINT2_MASK 0x0100 /* HP3L_SC_POS_EINT2 */
5604#define ARIZONA_HP3L_SC_POS_EINT2_SHIFT 8 /* HP3L_SC_POS_EINT2 */
5605#define ARIZONA_HP3L_SC_POS_EINT2_WIDTH 1 /* HP3L_SC_POS_EINT2 */
5606#define ARIZONA_HP2R_SC_NEG_EINT2 0x0080 /* HP2R_SC_NEG_EINT2 */
5607#define ARIZONA_HP2R_SC_NEG_EINT2_MASK 0x0080 /* HP2R_SC_NEG_EINT2 */
5608#define ARIZONA_HP2R_SC_NEG_EINT2_SHIFT 7 /* HP2R_SC_NEG_EINT2 */
5609#define ARIZONA_HP2R_SC_NEG_EINT2_WIDTH 1 /* HP2R_SC_NEG_EINT2 */
5610#define ARIZONA_HP2R_SC_POS_EINT2 0x0040 /* HP2R_SC_POS_EINT2 */
5611#define ARIZONA_HP2R_SC_POS_EINT2_MASK 0x0040 /* HP2R_SC_POS_EINT2 */
5612#define ARIZONA_HP2R_SC_POS_EINT2_SHIFT 6 /* HP2R_SC_POS_EINT2 */
5613#define ARIZONA_HP2R_SC_POS_EINT2_WIDTH 1 /* HP2R_SC_POS_EINT2 */
5614#define ARIZONA_HP2L_SC_NEG_EINT2 0x0020 /* HP2L_SC_NEG_EINT2 */
5615#define ARIZONA_HP2L_SC_NEG_EINT2_MASK 0x0020 /* HP2L_SC_NEG_EINT2 */
5616#define ARIZONA_HP2L_SC_NEG_EINT2_SHIFT 5 /* HP2L_SC_NEG_EINT2 */
5617#define ARIZONA_HP2L_SC_NEG_EINT2_WIDTH 1 /* HP2L_SC_NEG_EINT2 */
5618#define ARIZONA_HP2L_SC_POS_EINT2 0x0010 /* HP2L_SC_POS_EINT2 */
5619#define ARIZONA_HP2L_SC_POS_EINT2_MASK 0x0010 /* HP2L_SC_POS_EINT2 */
5620#define ARIZONA_HP2L_SC_POS_EINT2_SHIFT 4 /* HP2L_SC_POS_EINT2 */
5621#define ARIZONA_HP2L_SC_POS_EINT2_WIDTH 1 /* HP2L_SC_POS_EINT2 */
5622#define ARIZONA_HP1R_SC_NEG_EINT2 0x0008 /* HP1R_SC_NEG_EINT2 */
5623#define ARIZONA_HP1R_SC_NEG_EINT2_MASK 0x0008 /* HP1R_SC_NEG_EINT2 */
5624#define ARIZONA_HP1R_SC_NEG_EINT2_SHIFT 3 /* HP1R_SC_NEG_EINT2 */
5625#define ARIZONA_HP1R_SC_NEG_EINT2_WIDTH 1 /* HP1R_SC_NEG_EINT2 */
5626#define ARIZONA_HP1R_SC_POS_EINT2 0x0004 /* HP1R_SC_POS_EINT2 */
5627#define ARIZONA_HP1R_SC_POS_EINT2_MASK 0x0004 /* HP1R_SC_POS_EINT2 */
5628#define ARIZONA_HP1R_SC_POS_EINT2_SHIFT 2 /* HP1R_SC_POS_EINT2 */
5629#define ARIZONA_HP1R_SC_POS_EINT2_WIDTH 1 /* HP1R_SC_POS_EINT2 */
5630#define ARIZONA_HP1L_SC_NEG_EINT2 0x0002 /* HP1L_SC_NEG_EINT2 */
5631#define ARIZONA_HP1L_SC_NEG_EINT2_MASK 0x0002 /* HP1L_SC_NEG_EINT2 */
5632#define ARIZONA_HP1L_SC_NEG_EINT2_SHIFT 1 /* HP1L_SC_NEG_EINT2 */
5633#define ARIZONA_HP1L_SC_NEG_EINT2_WIDTH 1 /* HP1L_SC_NEG_EINT2 */
5634#define ARIZONA_HP1L_SC_POS_EINT2 0x0001 /* HP1L_SC_POS_EINT2 */
5635#define ARIZONA_HP1L_SC_POS_EINT2_MASK 0x0001 /* HP1L_SC_POS_EINT2 */
5636#define ARIZONA_HP1L_SC_POS_EINT2_SHIFT 0 /* HP1L_SC_POS_EINT2 */
5637#define ARIZONA_HP1L_SC_POS_EINT2_WIDTH 1 /* HP1L_SC_POS_EINT2 */
5638
5639/*
5168 * R3352 (0xD18) - IRQ2 Status 1 Mask 5640 * R3352 (0xD18) - IRQ2 Status 1 Mask
5169 */ 5641 */
5170#define ARIZONA_IM_GP4_EINT2 0x0008 /* IM_GP4_EINT2 */ 5642#define ARIZONA_IM_GP4_EINT2 0x0008 /* IM_GP4_EINT2 */
@@ -5203,14 +5675,14 @@
5203/* 5675/*
5204 * R3354 (0xD1A) - IRQ2 Status 3 Mask 5676 * R3354 (0xD1A) - IRQ2 Status 3 Mask
5205 */ 5677 */
5206#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5678#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5207#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2_MASK 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5679#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2_MASK 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5208#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2_SHIFT 15 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5680#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2_SHIFT 15 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5209#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2_WIDTH 1 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5681#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2_WIDTH 1 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5210#define ARIZONA_IM_SPK_SHUTDOWN_EINT2 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */ 5682#define ARIZONA_IM_SPK_OVERHEAT_EINT2 0x4000 /* IM_SPK_OVERHEAT_EINT2 */
5211#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */ 5683#define ARIZONA_IM_SPK_OVERHEAT_EINT2_MASK 0x4000 /* IM_SPK_OVERHEAT_EINT2 */
5212#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT2 */ 5684#define ARIZONA_IM_SPK_OVERHEAT_EINT2_SHIFT 14 /* IM_SPK_OVERHEAT_EINT2 */
5213#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT2 */ 5685#define ARIZONA_IM_SPK_OVERHEAT_EINT2_WIDTH 1 /* IM_SPK_OVERHEAT_EINT2 */
5214#define ARIZONA_IM_HPDET_EINT2 0x2000 /* IM_HPDET_EINT2 */ 5686#define ARIZONA_IM_HPDET_EINT2 0x2000 /* IM_HPDET_EINT2 */
5215#define ARIZONA_IM_HPDET_EINT2_MASK 0x2000 /* IM_HPDET_EINT2 */ 5687#define ARIZONA_IM_HPDET_EINT2_MASK 0x2000 /* IM_HPDET_EINT2 */
5216#define ARIZONA_IM_HPDET_EINT2_SHIFT 13 /* IM_HPDET_EINT2 */ 5688#define ARIZONA_IM_HPDET_EINT2_SHIFT 13 /* IM_HPDET_EINT2 */
@@ -5307,6 +5779,77 @@
5307#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT2 */ 5779#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT2 */
5308#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT2 */ 5780#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT2 */
5309#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT2 */ 5781#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT2 */
5782#define ARIZONA_IM_HP3R_DONE_EINT2 0x0020 /* IM_HP3R_DONE_EINT2 */
5783#define ARIZONA_IM_HP3R_DONE_EINT2_MASK 0x0020 /* IM_HP3R_DONE_EINT2 */
5784#define ARIZONA_IM_HP3R_DONE_EINT2_SHIFT 5 /* IM_HP3R_DONE_EINT2 */
5785#define ARIZONA_IM_HP3R_DONE_EINT2_WIDTH 1 /* IM_HP3R_DONE_EINT2 */
5786#define ARIZONA_IM_HP3L_DONE_EINT2 0x0010 /* IM_HP3L_DONE_EINT2 */
5787#define ARIZONA_IM_HP3L_DONE_EINT2_MASK 0x0010 /* IM_HP3L_DONE_EINT2 */
5788#define ARIZONA_IM_HP3L_DONE_EINT2_SHIFT 4 /* IM_HP3L_DONE_EINT2 */
5789#define ARIZONA_IM_HP3L_DONE_EINT2_WIDTH 1 /* IM_HP3L_DONE_EINT2 */
5790#define ARIZONA_IM_HP2R_DONE_EINT2 0x0008 /* IM_HP2R_DONE_EINT2 */
5791#define ARIZONA_IM_HP2R_DONE_EINT2_MASK 0x0008 /* IM_HP2R_DONE_EINT2 */
5792#define ARIZONA_IM_HP2R_DONE_EINT2_SHIFT 3 /* IM_HP2R_DONE_EINT2 */
5793#define ARIZONA_IM_HP2R_DONE_EINT2_WIDTH 1 /* IM_HP2R_DONE_EINT2 */
5794#define ARIZONA_IM_HP2L_DONE_EINT2 0x0004 /* IM_HP2L_DONE_EINT2 */
5795#define ARIZONA_IM_HP2L_DONE_EINT2_MASK 0x0004 /* IM_HP2L_DONE_EINT2 */
5796#define ARIZONA_IM_HP2L_DONE_EINT2_SHIFT 2 /* IM_HP2L_DONE_EINT2 */
5797#define ARIZONA_IM_HP2L_DONE_EINT2_WIDTH 1 /* IM_HP2L_DONE_EINT2 */
5798#define ARIZONA_IM_HP1R_DONE_EINT2 0x0002 /* IM_HP1R_DONE_EINT2 */
5799#define ARIZONA_IM_HP1R_DONE_EINT2_MASK 0x0002 /* IM_HP1R_DONE_EINT2 */
5800#define ARIZONA_IM_HP1R_DONE_EINT2_SHIFT 1 /* IM_HP1R_DONE_EINT2 */
5801#define ARIZONA_IM_HP1R_DONE_EINT2_WIDTH 1 /* IM_HP1R_DONE_EINT2 */
5802#define ARIZONA_IM_HP1L_DONE_EINT2 0x0001 /* IM_HP1L_DONE_EINT2 */
5803#define ARIZONA_IM_HP1L_DONE_EINT2_MASK 0x0001 /* IM_HP1L_DONE_EINT2 */
5804#define ARIZONA_IM_HP1L_DONE_EINT2_SHIFT 0 /* IM_HP1L_DONE_EINT2 */
5805#define ARIZONA_IM_HP1L_DONE_EINT2_WIDTH 1 /* IM_HP1L_DONE_EINT2 */
5806
5807/*
5808 * R3355 (0xD1B) - IRQ2 Status 4 Mask (Alternate layout)
5809 *
5810 * Alternate layout used on later devices, note only fields that have moved
5811 * are specified
5812 */
5813#define ARIZONA_V2_IM_AIF3_ERR_EINT2 0x8000 /* IM_AIF3_ERR_EINT2 */
5814#define ARIZONA_V2_IM_AIF3_ERR_EINT2_MASK 0x8000 /* IM_AIF3_ERR_EINT2 */
5815#define ARIZONA_V2_IM_AIF3_ERR_EINT2_SHIFT 15 /* IM_AIF3_ERR_EINT2 */
5816#define ARIZONA_V2_IM_AIF3_ERR_EINT2_WIDTH 1 /* IM_AIF3_ERR_EINT2 */
5817#define ARIZONA_V2_IM_AIF2_ERR_EINT2 0x4000 /* IM_AIF2_ERR_EINT2 */
5818#define ARIZONA_V2_IM_AIF2_ERR_EINT2_MASK 0x4000 /* IM_AIF2_ERR_EINT2 */
5819#define ARIZONA_V2_IM_AIF2_ERR_EINT2_SHIFT 14 /* IM_AIF2_ERR_EINT2 */
5820#define ARIZONA_V2_IM_AIF2_ERR_EINT2_WIDTH 1 /* IM_AIF2_ERR_EINT2 */
5821#define ARIZONA_V2_IM_AIF1_ERR_EINT2 0x2000 /* IM_AIF1_ERR_EINT2 */
5822#define ARIZONA_V2_IM_AIF1_ERR_EINT2_MASK 0x2000 /* IM_AIF1_ERR_EINT2 */
5823#define ARIZONA_V2_IM_AIF1_ERR_EINT2_SHIFT 13 /* IM_AIF1_ERR_EINT2 */
5824#define ARIZONA_V2_IM_AIF1_ERR_EINT2_WIDTH 1 /* IM_AIF1_ERR_EINT2 */
5825#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2 0x1000 /* IM_CTRLIF_ERR_EINT2 */
5826#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2_MASK 0x1000 /* IM_CTRLIF_ERR_EINT2 */
5827#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2_SHIFT 12 /* IM_CTRLIF_ERR_EINT2 */
5828#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2_WIDTH 1 /* IM_CTRLIF_ERR_EINT2 */
5829#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5830#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2_MASK 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5831#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2_SHIFT 11 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5832#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2_WIDTH 1 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5833#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5834#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2_MASK 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5835#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2_SHIFT 10 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5836#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2_WIDTH 1 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5837#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2 0x0200 /* IM_SYSCLK_ENA_LOW_EINT2 */
5838#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2_MASK 0x0200 /* IM_SYSCLK_ENA_LOW_EINT2 */
5839#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2_SHIFT 9 /* IM_SYSCLK_ENA_LOW_EINT2 */
5840#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2_WIDTH 1 /* IM_SYSCLK_ENA_LOW_EINT2 */
5841#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2 0x0100 /* IM_ISRC1_CFG_ERR_EINT2 */
5842#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2_MASK 0x0100 /* IM_ISRC1_CFG_ERR_EINT2 */
5843#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2_SHIFT 8 /* IM_ISRC1_CFG_ERR_EINT2 */
5844#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC1_CFG_ERR_EINT2 */
5845#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2 0x0080 /* IM_ISRC2_CFG_ERR_EINT2 */
5846#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2_MASK 0x0080 /* IM_ISRC2_CFG_ERR_EINT2 */
5847#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2_SHIFT 7 /* IM_ISRC2_CFG_ERR_EINT2 */
5848#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT2 */
5849#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2 0x0040 /* IM_ISRC3_CFG_ERR_EINT2 */
5850#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2_MASK 0x0040 /* IM_ISRC3_CFG_ERR_EINT2 */
5851#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2_SHIFT 6 /* IM_ISRC3_CFG_ERR_EINT2 */
5852#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC3_CFG_ERR_EINT2 */
5310 5853
5311/* 5854/*
5312 * R3356 (0xD1C) - IRQ2 Status 5 Mask 5855 * R3356 (0xD1C) - IRQ2 Status 5 Mask
@@ -5334,6 +5877,85 @@
5334#define ARIZONA_IM_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT2 */ 5877#define ARIZONA_IM_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT2 */
5335 5878
5336/* 5879/*
5880 * R3340 (0xD0C) - Interrupt Status 5 Mask (Alternate layout)
5881 *
5882 * Alternate layout used on later devices, note only fields that have moved
5883 * are specified
5884 */
5885#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2 0x0008 /* IM_ASRC_CFG_ERR_EINT2 */
5886#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2_MASK 0x0008 /* IM_ASRC_CFG_ERR_EINT2 */
5887#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2_SHIFT 3 /* IM_ASRC_CFG_ERR_EINT2 */
5888#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2_WIDTH 1 /* IM_ASRC_CFG_ERR_EINT2 */
5889
5890/*
5891 * R3357 (0xD1D) - IRQ2 Status 6 Mask
5892 */
5893#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5894#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2_MASK 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5895#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2_SHIFT 15 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5896#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2_WIDTH 1 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5897#define ARIZONA_IM_SPK_SHUTDOWN_EINT2 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */
5898#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */
5899#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT2 */
5900#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT2 */
5901#define ARIZONA_IM_SPK1R_SHORT_EINT2 0x2000 /* IM_SPK1R_SHORT_EINT2 */
5902#define ARIZONA_IM_SPK1R_SHORT_EINT2_MASK 0x2000 /* IM_SPK1R_SHORT_EINT2 */
5903#define ARIZONA_IM_SPK1R_SHORT_EINT2_SHIFT 13 /* IM_SPK1R_SHORT_EINT2 */
5904#define ARIZONA_IM_SPK1R_SHORT_EINT2_WIDTH 1 /* IM_SPK1R_SHORT_EINT2 */
5905#define ARIZONA_IM_SPK1L_SHORT_EINT2 0x1000 /* IM_SPK1L_SHORT_EINT2 */
5906#define ARIZONA_IM_SPK1L_SHORT_EINT2_MASK 0x1000 /* IM_SPK1L_SHORT_EINT2 */
5907#define ARIZONA_IM_SPK1L_SHORT_EINT2_SHIFT 12 /* IM_SPK1L_SHORT_EINT2 */
5908#define ARIZONA_IM_SPK1L_SHORT_EINT2_WIDTH 1 /* IM_SPK1L_SHORT_EINT2 */
5909#define ARIZONA_IM_HP3R_SC_NEG_EINT2 0x0800 /* IM_HP3R_SC_NEG_EINT2 */
5910#define ARIZONA_IM_HP3R_SC_NEG_EINT2_MASK 0x0800 /* IM_HP3R_SC_NEG_EINT2 */
5911#define ARIZONA_IM_HP3R_SC_NEG_EINT2_SHIFT 11 /* IM_HP3R_SC_NEG_EINT2 */
5912#define ARIZONA_IM_HP3R_SC_NEG_EINT2_WIDTH 1 /* IM_HP3R_SC_NEG_EINT2 */
5913#define ARIZONA_IM_HP3R_SC_POS_EINT2 0x0400 /* IM_HP3R_SC_POS_EINT2 */
5914#define ARIZONA_IM_HP3R_SC_POS_EINT2_MASK 0x0400 /* IM_HP3R_SC_POS_EINT2 */
5915#define ARIZONA_IM_HP3R_SC_POS_EINT2_SHIFT 10 /* IM_HP3R_SC_POS_EINT2 */
5916#define ARIZONA_IM_HP3R_SC_POS_EINT2_WIDTH 1 /* IM_HP3R_SC_POS_EINT2 */
5917#define ARIZONA_IM_HP3L_SC_NEG_EINT2 0x0200 /* IM_HP3L_SC_NEG_EINT2 */
5918#define ARIZONA_IM_HP3L_SC_NEG_EINT2_MASK 0x0200 /* IM_HP3L_SC_NEG_EINT2 */
5919#define ARIZONA_IM_HP3L_SC_NEG_EINT2_SHIFT 9 /* IM_HP3L_SC_NEG_EINT2 */
5920#define ARIZONA_IM_HP3L_SC_NEG_EINT2_WIDTH 1 /* IM_HP3L_SC_NEG_EINT2 */
5921#define ARIZONA_IM_HP3L_SC_POS_EINT2 0x0100 /* IM_HP3L_SC_POS_EINT2 */
5922#define ARIZONA_IM_HP3L_SC_POS_EINT2_MASK 0x0100 /* IM_HP3L_SC_POS_EINT2 */
5923#define ARIZONA_IM_HP3L_SC_POS_EINT2_SHIFT 8 /* IM_HP3L_SC_POS_EINT2 */
5924#define ARIZONA_IM_HP3L_SC_POS_EINT2_WIDTH 1 /* IM_HP3L_SC_POS_EINT2 */
5925#define ARIZONA_IM_HP2R_SC_NEG_EINT2 0x0080 /* IM_HP2R_SC_NEG_EINT2 */
5926#define ARIZONA_IM_HP2R_SC_NEG_EINT2_MASK 0x0080 /* IM_HP2R_SC_NEG_EINT2 */
5927#define ARIZONA_IM_HP2R_SC_NEG_EINT2_SHIFT 7 /* IM_HP2R_SC_NEG_EINT2 */
5928#define ARIZONA_IM_HP2R_SC_NEG_EINT2_WIDTH 1 /* IM_HP2R_SC_NEG_EINT2 */
5929#define ARIZONA_IM_HP2R_SC_POS_EINT2 0x0040 /* IM_HP2R_SC_POS_EINT2 */
5930#define ARIZONA_IM_HP2R_SC_POS_EINT2_MASK 0x0040 /* IM_HP2R_SC_POS_EINT2 */
5931#define ARIZONA_IM_HP2R_SC_POS_EINT2_SHIFT 6 /* IM_HP2R_SC_POS_EINT2 */
5932#define ARIZONA_IM_HP2R_SC_POS_EINT2_WIDTH 1 /* IM_HP2R_SC_POS_EINT2 */
5933#define ARIZONA_IM_HP2L_SC_NEG_EINT2 0x0020 /* IM_HP2L_SC_NEG_EINT2 */
5934#define ARIZONA_IM_HP2L_SC_NEG_EINT2_MASK 0x0020 /* IM_HP2L_SC_NEG_EINT2 */
5935#define ARIZONA_IM_HP2L_SC_NEG_EINT2_SHIFT 5 /* IM_HP2L_SC_NEG_EINT2 */
5936#define ARIZONA_IM_HP2L_SC_NEG_EINT2_WIDTH 1 /* IM_HP2L_SC_NEG_EINT2 */
5937#define ARIZONA_IM_HP2L_SC_POS_EINT2 0x0010 /* IM_HP2L_SC_POS_EINT2 */
5938#define ARIZONA_IM_HP2L_SC_POS_EINT2_MASK 0x0010 /* IM_HP2L_SC_POS_EINT2 */
5939#define ARIZONA_IM_HP2L_SC_POS_EINT2_SHIFT 4 /* IM_HP2L_SC_POS_EINT2 */
5940#define ARIZONA_IM_HP2L_SC_POS_EINT2_WIDTH 1 /* IM_HP2L_SC_POS_EINT2 */
5941#define ARIZONA_IM_HP1R_SC_NEG_EINT2 0x0008 /* IM_HP1R_SC_NEG_EINT2 */
5942#define ARIZONA_IM_HP1R_SC_NEG_EINT2_MASK 0x0008 /* IM_HP1R_SC_NEG_EINT2 */
5943#define ARIZONA_IM_HP1R_SC_NEG_EINT2_SHIFT 3 /* IM_HP1R_SC_NEG_EINT2 */
5944#define ARIZONA_IM_HP1R_SC_NEG_EINT2_WIDTH 1 /* IM_HP1R_SC_NEG_EINT2 */
5945#define ARIZONA_IM_HP1R_SC_POS_EINT2 0x0004 /* IM_HP1R_SC_POS_EINT2 */
5946#define ARIZONA_IM_HP1R_SC_POS_EINT2_MASK 0x0004 /* IM_HP1R_SC_POS_EINT2 */
5947#define ARIZONA_IM_HP1R_SC_POS_EINT2_SHIFT 2 /* IM_HP1R_SC_POS_EINT2 */
5948#define ARIZONA_IM_HP1R_SC_POS_EINT2_WIDTH 1 /* IM_HP1R_SC_POS_EINT2 */
5949#define ARIZONA_IM_HP1L_SC_NEG_EINT2 0x0002 /* IM_HP1L_SC_NEG_EINT2 */
5950#define ARIZONA_IM_HP1L_SC_NEG_EINT2_MASK 0x0002 /* IM_HP1L_SC_NEG_EINT2 */
5951#define ARIZONA_IM_HP1L_SC_NEG_EINT2_SHIFT 1 /* IM_HP1L_SC_NEG_EINT2 */
5952#define ARIZONA_IM_HP1L_SC_NEG_EINT2_WIDTH 1 /* IM_HP1L_SC_NEG_EINT2 */
5953#define ARIZONA_IM_HP1L_SC_POS_EINT2 0x0001 /* IM_HP1L_SC_POS_EINT2 */
5954#define ARIZONA_IM_HP1L_SC_POS_EINT2_MASK 0x0001 /* IM_HP1L_SC_POS_EINT2 */
5955#define ARIZONA_IM_HP1L_SC_POS_EINT2_SHIFT 0 /* IM_HP1L_SC_POS_EINT2 */
5956#define ARIZONA_IM_HP1L_SC_POS_EINT2_WIDTH 1 /* IM_HP1L_SC_POS_EINT2 */
5957
5958/*
5337 * R3359 (0xD1F) - IRQ2 Control 5959 * R3359 (0xD1F) - IRQ2 Control
5338 */ 5960 */
5339#define ARIZONA_IM_IRQ2 0x0001 /* IM_IRQ2 */ 5961#define ARIZONA_IM_IRQ2 0x0001 /* IM_IRQ2 */
@@ -5360,14 +5982,14 @@
5360/* 5982/*
5361 * R3361 (0xD21) - Interrupt Raw Status 3 5983 * R3361 (0xD21) - Interrupt Raw Status 3
5362 */ 5984 */
5363#define ARIZONA_SPK_SHUTDOWN_WARN_STS 0x8000 /* SPK_SHUTDOWN_WARN_STS */ 5985#define ARIZONA_SPK_OVERHEAT_WARN_STS 0x8000 /* SPK_OVERHEAT_WARN_STS */
5364#define ARIZONA_SPK_SHUTDOWN_WARN_STS_MASK 0x8000 /* SPK_SHUTDOWN_WARN_STS */ 5986#define ARIZONA_SPK_OVERHEAT_WARN_STS_MASK 0x8000 /* SPK_OVERHEAT_WARN_STS */
5365#define ARIZONA_SPK_SHUTDOWN_WARN_STS_SHIFT 15 /* SPK_SHUTDOWN_WARN_STS */ 5987#define ARIZONA_SPK_OVERHEAT_WARN_STS_SHIFT 15 /* SPK_OVERHEAT_WARN_STS */
5366#define ARIZONA_SPK_SHUTDOWN_WARN_STS_WIDTH 1 /* SPK_SHUTDOWN_WARN_STS */ 5988#define ARIZONA_SPK_OVERHEAT_WARN_STS_WIDTH 1 /* SPK_OVERHEAT_WARN_STS */
5367#define ARIZONA_SPK_SHUTDOWN_STS 0x4000 /* SPK_SHUTDOWN_STS */ 5989#define ARIZONA_SPK_OVERHEAT_STS 0x4000 /* SPK_OVERHEAT_STS */
5368#define ARIZONA_SPK_SHUTDOWN_STS_MASK 0x4000 /* SPK_SHUTDOWN_STS */ 5990#define ARIZONA_SPK_OVERHEAT_STS_MASK 0x4000 /* SPK_OVERHEAT_STS */
5369#define ARIZONA_SPK_SHUTDOWN_STS_SHIFT 14 /* SPK_SHUTDOWN_STS */ 5991#define ARIZONA_SPK_OVERHEAT_STS_SHIFT 14 /* SPK_OVERHEAT_STS */
5370#define ARIZONA_SPK_SHUTDOWN_STS_WIDTH 1 /* SPK_SHUTDOWN_STS */ 5992#define ARIZONA_SPK_OVERHEAT_STS_WIDTH 1 /* SPK_OVERHEAT_STS */
5371#define ARIZONA_HPDET_STS 0x2000 /* HPDET_STS */ 5993#define ARIZONA_HPDET_STS 0x2000 /* HPDET_STS */
5372#define ARIZONA_HPDET_STS_MASK 0x2000 /* HPDET_STS */ 5994#define ARIZONA_HPDET_STS_MASK 0x2000 /* HPDET_STS */
5373#define ARIZONA_HPDET_STS_SHIFT 13 /* HPDET_STS */ 5995#define ARIZONA_HPDET_STS_SHIFT 13 /* HPDET_STS */
@@ -5464,6 +6086,30 @@
5464#define ARIZONA_ISRC2_CFG_ERR_STS_MASK 0x0040 /* ISRC2_CFG_ERR_STS */ 6086#define ARIZONA_ISRC2_CFG_ERR_STS_MASK 0x0040 /* ISRC2_CFG_ERR_STS */
5465#define ARIZONA_ISRC2_CFG_ERR_STS_SHIFT 6 /* ISRC2_CFG_ERR_STS */ 6087#define ARIZONA_ISRC2_CFG_ERR_STS_SHIFT 6 /* ISRC2_CFG_ERR_STS */
5466#define ARIZONA_ISRC2_CFG_ERR_STS_WIDTH 1 /* ISRC2_CFG_ERR_STS */ 6088#define ARIZONA_ISRC2_CFG_ERR_STS_WIDTH 1 /* ISRC2_CFG_ERR_STS */
6089#define ARIZONA_HP3R_DONE_STS 0x0020 /* HP3R_DONE_STS */
6090#define ARIZONA_HP3R_DONE_STS_MASK 0x0020 /* HP3R_DONE_STS */
6091#define ARIZONA_HP3R_DONE_STS_SHIFT 5 /* HP3R_DONE_STS */
6092#define ARIZONA_HP3R_DONE_STS_WIDTH 1 /* HP3R_DONE_STS */
6093#define ARIZONA_HP3L_DONE_STS 0x0010 /* HP3L_DONE_STS */
6094#define ARIZONA_HP3L_DONE_STS_MASK 0x0010 /* HP3L_DONE_STS */
6095#define ARIZONA_HP3L_DONE_STS_SHIFT 4 /* HP3L_DONE_STS */
6096#define ARIZONA_HP3L_DONE_STS_WIDTH 1 /* HP3L_DONE_STS */
6097#define ARIZONA_HP2R_DONE_STS 0x0008 /* HP2R_DONE_STS */
6098#define ARIZONA_HP2R_DONE_STS_MASK 0x0008 /* HP2R_DONE_STS */
6099#define ARIZONA_HP2R_DONE_STS_SHIFT 3 /* HP2R_DONE_STS */
6100#define ARIZONA_HP2R_DONE_STS_WIDTH 1 /* HP2R_DONE_STS */
6101#define ARIZONA_HP2L_DONE_STS 0x0004 /* HP2L_DONE_STS */
6102#define ARIZONA_HP2L_DONE_STS_MASK 0x0004 /* HP2L_DONE_STS */
6103#define ARIZONA_HP2L_DONE_STS_SHIFT 2 /* HP2L_DONE_STS */
6104#define ARIZONA_HP2L_DONE_STS_WIDTH 1 /* HP2L_DONE_STS */
6105#define ARIZONA_HP1R_DONE_STS 0x0002 /* HP1R_DONE_STS */
6106#define ARIZONA_HP1R_DONE_STS_MASK 0x0002 /* HP1R_DONE_STS */
6107#define ARIZONA_HP1R_DONE_STS_SHIFT 1 /* HP1R_DONE_STS */
6108#define ARIZONA_HP1R_DONE_STS_WIDTH 1 /* HP1R_DONE_STS */
6109#define ARIZONA_HP1L_DONE_STS 0x0001 /* HP1L_DONE_STS */
6110#define ARIZONA_HP1L_DONE_STS_MASK 0x0001 /* HP1L_DONE_STS */
6111#define ARIZONA_HP1L_DONE_STS_SHIFT 0 /* HP1L_DONE_STS */
6112#define ARIZONA_HP1L_DONE_STS_WIDTH 1 /* HP1L_DONE_STS */
5467 6113
5468/* 6114/*
5469 * R3363 (0xD23) - Interrupt Raw Status 5 6115 * R3363 (0xD23) - Interrupt Raw Status 5
@@ -5580,6 +6226,10 @@
5580#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_MASK 0x0008 /* ADSP2_1_OVERCLOCKED_STS */ 6226#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_MASK 0x0008 /* ADSP2_1_OVERCLOCKED_STS */
5581#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_SHIFT 3 /* ADSP2_1_OVERCLOCKED_STS */ 6227#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_SHIFT 3 /* ADSP2_1_OVERCLOCKED_STS */
5582#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_WIDTH 1 /* ADSP2_1_OVERCLOCKED_STS */ 6228#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_WIDTH 1 /* ADSP2_1_OVERCLOCKED_STS */
6229#define ARIZONA_ISRC3_OVERCLOCKED_STS 0x0004 /* ISRC3_OVERCLOCKED_STS */
6230#define ARIZONA_ISRC3_OVERCLOCKED_STS_MASK 0x0004 /* ISRC3_OVERCLOCKED_STS */
6231#define ARIZONA_ISRC3_OVERCLOCKED_STS_SHIFT 2 /* ISRC3_OVERCLOCKED_STS */
6232#define ARIZONA_ISRC3_OVERCLOCKED_STS_WIDTH 1 /* ISRC3_OVERCLOCKED_STS */
5583#define ARIZONA_ISRC2_OVERCLOCKED_STS 0x0002 /* ISRC2_OVERCLOCKED_STS */ 6233#define ARIZONA_ISRC2_OVERCLOCKED_STS 0x0002 /* ISRC2_OVERCLOCKED_STS */
5584#define ARIZONA_ISRC2_OVERCLOCKED_STS_MASK 0x0002 /* ISRC2_OVERCLOCKED_STS */ 6234#define ARIZONA_ISRC2_OVERCLOCKED_STS_MASK 0x0002 /* ISRC2_OVERCLOCKED_STS */
5585#define ARIZONA_ISRC2_OVERCLOCKED_STS_SHIFT 1 /* ISRC2_OVERCLOCKED_STS */ 6235#define ARIZONA_ISRC2_OVERCLOCKED_STS_SHIFT 1 /* ISRC2_OVERCLOCKED_STS */
@@ -5604,6 +6254,10 @@
5604#define ARIZONA_AIF1_UNDERCLOCKED_STS_MASK 0x0100 /* AIF1_UNDERCLOCKED_STS */ 6254#define ARIZONA_AIF1_UNDERCLOCKED_STS_MASK 0x0100 /* AIF1_UNDERCLOCKED_STS */
5605#define ARIZONA_AIF1_UNDERCLOCKED_STS_SHIFT 8 /* AIF1_UNDERCLOCKED_STS */ 6255#define ARIZONA_AIF1_UNDERCLOCKED_STS_SHIFT 8 /* AIF1_UNDERCLOCKED_STS */
5606#define ARIZONA_AIF1_UNDERCLOCKED_STS_WIDTH 1 /* AIF1_UNDERCLOCKED_STS */ 6256#define ARIZONA_AIF1_UNDERCLOCKED_STS_WIDTH 1 /* AIF1_UNDERCLOCKED_STS */
6257#define ARIZONA_ISRC3_UNDERCLOCKED_STS 0x0080 /* ISRC3_UNDERCLOCKED_STS */
6258#define ARIZONA_ISRC3_UNDERCLOCKED_STS_MASK 0x0080 /* ISRC3_UNDERCLOCKED_STS */
6259#define ARIZONA_ISRC3_UNDERCLOCKED_STS_SHIFT 7 /* ISRC3_UNDERCLOCKED_STS */
6260#define ARIZONA_ISRC3_UNDERCLOCKED_STS_WIDTH 1 /* ISRC3_UNDERCLOCKED_STS */
5607#define ARIZONA_ISRC2_UNDERCLOCKED_STS 0x0040 /* ISRC2_UNDERCLOCKED_STS */ 6261#define ARIZONA_ISRC2_UNDERCLOCKED_STS 0x0040 /* ISRC2_UNDERCLOCKED_STS */
5608#define ARIZONA_ISRC2_UNDERCLOCKED_STS_MASK 0x0040 /* ISRC2_UNDERCLOCKED_STS */ 6262#define ARIZONA_ISRC2_UNDERCLOCKED_STS_MASK 0x0040 /* ISRC2_UNDERCLOCKED_STS */
5609#define ARIZONA_ISRC2_UNDERCLOCKED_STS_SHIFT 6 /* ISRC2_UNDERCLOCKED_STS */ 6263#define ARIZONA_ISRC2_UNDERCLOCKED_STS_SHIFT 6 /* ISRC2_UNDERCLOCKED_STS */
@@ -5634,6 +6288,74 @@
5634#define ARIZONA_MIXER_UNDERCLOCKED_STS_WIDTH 1 /* MIXER_UNDERCLOCKED_STS */ 6288#define ARIZONA_MIXER_UNDERCLOCKED_STS_WIDTH 1 /* MIXER_UNDERCLOCKED_STS */
5635 6289
5636/* 6290/*
6291 * R3368 (0xD28) - Interrupt Raw Status 9
6292 */
6293#define ARIZONA_DSP_SHARED_WR_COLL_STS 0x8000 /* DSP_SHARED_WR_COLL_STS */
6294#define ARIZONA_DSP_SHARED_WR_COLL_STS_MASK 0x8000 /* DSP_SHARED_WR_COLL_STS */
6295#define ARIZONA_DSP_SHARED_WR_COLL_STS_SHIFT 15 /* DSP_SHARED_WR_COLL_STS */
6296#define ARIZONA_DSP_SHARED_WR_COLL_STS_WIDTH 1 /* DSP_SHARED_WR_COLL_STS */
6297#define ARIZONA_SPK_SHUTDOWN_STS 0x4000 /* SPK_SHUTDOWN_STS */
6298#define ARIZONA_SPK_SHUTDOWN_STS_MASK 0x4000 /* SPK_SHUTDOWN_STS */
6299#define ARIZONA_SPK_SHUTDOWN_STS_SHIFT 14 /* SPK_SHUTDOWN_STS */
6300#define ARIZONA_SPK_SHUTDOWN_STS_WIDTH 1 /* SPK_SHUTDOWN_STS */
6301#define ARIZONA_SPK1R_SHORT_STS 0x2000 /* SPK1R_SHORT_STS */
6302#define ARIZONA_SPK1R_SHORT_STS_MASK 0x2000 /* SPK1R_SHORT_STS */
6303#define ARIZONA_SPK1R_SHORT_STS_SHIFT 13 /* SPK1R_SHORT_STS */
6304#define ARIZONA_SPK1R_SHORT_STS_WIDTH 1 /* SPK1R_SHORT_STS */
6305#define ARIZONA_SPK1L_SHORT_STS 0x1000 /* SPK1L_SHORT_STS */
6306#define ARIZONA_SPK1L_SHORT_STS_MASK 0x1000 /* SPK1L_SHORT_STS */
6307#define ARIZONA_SPK1L_SHORT_STS_SHIFT 12 /* SPK1L_SHORT_STS */
6308#define ARIZONA_SPK1L_SHORT_STS_WIDTH 1 /* SPK1L_SHORT_STS */
6309#define ARIZONA_HP3R_SC_NEG_STS 0x0800 /* HP3R_SC_NEG_STS */
6310#define ARIZONA_HP3R_SC_NEG_STS_MASK 0x0800 /* HP3R_SC_NEG_STS */
6311#define ARIZONA_HP3R_SC_NEG_STS_SHIFT 11 /* HP3R_SC_NEG_STS */
6312#define ARIZONA_HP3R_SC_NEG_STS_WIDTH 1 /* HP3R_SC_NEG_STS */
6313#define ARIZONA_HP3R_SC_POS_STS 0x0400 /* HP3R_SC_POS_STS */
6314#define ARIZONA_HP3R_SC_POS_STS_MASK 0x0400 /* HP3R_SC_POS_STS */
6315#define ARIZONA_HP3R_SC_POS_STS_SHIFT 10 /* HP3R_SC_POS_STS */
6316#define ARIZONA_HP3R_SC_POS_STS_WIDTH 1 /* HP3R_SC_POS_STS */
6317#define ARIZONA_HP3L_SC_NEG_STS 0x0200 /* HP3L_SC_NEG_STS */
6318#define ARIZONA_HP3L_SC_NEG_STS_MASK 0x0200 /* HP3L_SC_NEG_STS */
6319#define ARIZONA_HP3L_SC_NEG_STS_SHIFT 9 /* HP3L_SC_NEG_STS */
6320#define ARIZONA_HP3L_SC_NEG_STS_WIDTH 1 /* HP3L_SC_NEG_STS */
6321#define ARIZONA_HP3L_SC_POS_STS 0x0100 /* HP3L_SC_POS_STS */
6322#define ARIZONA_HP3L_SC_POS_STS_MASK 0x0100 /* HP3L_SC_POS_STS */
6323#define ARIZONA_HP3L_SC_POS_STS_SHIFT 8 /* HP3L_SC_POS_STS */
6324#define ARIZONA_HP3L_SC_POS_STS_WIDTH 1 /* HP3L_SC_POS_STS */
6325#define ARIZONA_HP2R_SC_NEG_STS 0x0080 /* HP2R_SC_NEG_STS */
6326#define ARIZONA_HP2R_SC_NEG_STS_MASK 0x0080 /* HP2R_SC_NEG_STS */
6327#define ARIZONA_HP2R_SC_NEG_STS_SHIFT 7 /* HP2R_SC_NEG_STS */
6328#define ARIZONA_HP2R_SC_NEG_STS_WIDTH 1 /* HP2R_SC_NEG_STS */
6329#define ARIZONA_HP2R_SC_POS_STS 0x0040 /* HP2R_SC_POS_STS */
6330#define ARIZONA_HP2R_SC_POS_STS_MASK 0x0040 /* HP2R_SC_POS_STS */
6331#define ARIZONA_HP2R_SC_POS_STS_SHIFT 6 /* HP2R_SC_POS_STS */
6332#define ARIZONA_HP2R_SC_POS_STS_WIDTH 1 /* HP2R_SC_POS_STS */
6333#define ARIZONA_HP2L_SC_NEG_STS 0x0020 /* HP2L_SC_NEG_STS */
6334#define ARIZONA_HP2L_SC_NEG_STS_MASK 0x0020 /* HP2L_SC_NEG_STS */
6335#define ARIZONA_HP2L_SC_NEG_STS_SHIFT 5 /* HP2L_SC_NEG_STS */
6336#define ARIZONA_HP2L_SC_NEG_STS_WIDTH 1 /* HP2L_SC_NEG_STS */
6337#define ARIZONA_HP2L_SC_POS_STS 0x0010 /* HP2L_SC_POS_STS */
6338#define ARIZONA_HP2L_SC_POS_STS_MASK 0x0010 /* HP2L_SC_POS_STS */
6339#define ARIZONA_HP2L_SC_POS_STS_SHIFT 4 /* HP2L_SC_POS_STS */
6340#define ARIZONA_HP2L_SC_POS_STS_WIDTH 1 /* HP2L_SC_POS_STS */
6341#define ARIZONA_HP1R_SC_NEG_STS 0x0008 /* HP1R_SC_NEG_STS */
6342#define ARIZONA_HP1R_SC_NEG_STS_MASK 0x0008 /* HP1R_SC_NEG_STS */
6343#define ARIZONA_HP1R_SC_NEG_STS_SHIFT 3 /* HP1R_SC_NEG_STS */
6344#define ARIZONA_HP1R_SC_NEG_STS_WIDTH 1 /* HP1R_SC_NEG_STS */
6345#define ARIZONA_HP1R_SC_POS_STS 0x0004 /* HP1R_SC_POS_STS */
6346#define ARIZONA_HP1R_SC_POS_STS_MASK 0x0004 /* HP1R_SC_POS_STS */
6347#define ARIZONA_HP1R_SC_POS_STS_SHIFT 2 /* HP1R_SC_POS_STS */
6348#define ARIZONA_HP1R_SC_POS_STS_WIDTH 1 /* HP1R_SC_POS_STS */
6349#define ARIZONA_HP1L_SC_NEG_STS 0x0002 /* HP1L_SC_NEG_STS */
6350#define ARIZONA_HP1L_SC_NEG_STS_MASK 0x0002 /* HP1L_SC_NEG_STS */
6351#define ARIZONA_HP1L_SC_NEG_STS_SHIFT 1 /* HP1L_SC_NEG_STS */
6352#define ARIZONA_HP1L_SC_NEG_STS_WIDTH 1 /* HP1L_SC_NEG_STS */
6353#define ARIZONA_HP1L_SC_POS_STS 0x0001 /* HP1L_SC_POS_STS */
6354#define ARIZONA_HP1L_SC_POS_STS_MASK 0x0001 /* HP1L_SC_POS_STS */
6355#define ARIZONA_HP1L_SC_POS_STS_SHIFT 0 /* HP1L_SC_POS_STS */
6356#define ARIZONA_HP1L_SC_POS_STS_WIDTH 1 /* HP1L_SC_POS_STS */
6357
6358/*
5637 * R3392 (0xD40) - IRQ Pin Status 6359 * R3392 (0xD40) - IRQ Pin Status
5638 */ 6360 */
5639#define ARIZONA_IRQ2_STS 0x0002 /* IRQ2_STS */ 6361#define ARIZONA_IRQ2_STS 0x0002 /* IRQ2_STS */
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index f543de91ce19..73e1709d4c09 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -44,6 +44,9 @@ struct mfd_cell {
44 */ 44 */
45 const char *of_compatible; 45 const char *of_compatible;
46 46
47 /* Matches ACPI PNP id, either _HID or _CID */
48 const char *acpi_pnpid;
49
47 /* 50 /*
48 * These resources can be specified relative to the parent device. 51 * These resources can be specified relative to the parent device.
49 * For accessing hardware you should use resources from the platform dev 52 * For accessing hardware you should use resources from the platform dev
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 887ef4f7bef7..0e166b92f5b4 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -16,7 +16,9 @@
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/notifier.h>
19#include <linux/mfd/cros_ec_commands.h> 20#include <linux/mfd/cros_ec_commands.h>
21#include <linux/mutex.h>
20 22
21/* 23/*
22 * Command interface between EC and AP, for LPC, I2C and SPI interfaces. 24 * Command interface between EC and AP, for LPC, I2C and SPI interfaces.
@@ -33,83 +35,76 @@ enum {
33 EC_MSG_TX_PROTO_BYTES, 35 EC_MSG_TX_PROTO_BYTES,
34}; 36};
35 37
36/** 38/*
37 * struct cros_ec_msg - A message sent to the EC, and its reply
38 *
39 * @version: Command version number (often 0) 39 * @version: Command version number (often 0)
40 * @cmd: Command to send (EC_CMD_...) 40 * @command: Command to send (EC_CMD_...)
41 * @out_buf: Outgoing payload (to EC) 41 * @outdata: Outgoing data to EC
42 * @outlen: Outgoing length 42 * @outsize: Outgoing length in bytes
43 * @in_buf: Incoming payload (from EC) 43 * @indata: Where to put the incoming data from EC
44 * @in_len: Incoming length 44 * @insize: Max number of bytes to accept from EC
45 * @result: EC's response to the command (separate from communication failure)
45 */ 46 */
46struct cros_ec_msg { 47struct cros_ec_command {
47 u8 version; 48 uint32_t version;
48 u8 cmd; 49 uint32_t command;
49 uint8_t *out_buf; 50 uint8_t *outdata;
50 int out_len; 51 uint32_t outsize;
51 uint8_t *in_buf; 52 uint8_t *indata;
52 int in_len; 53 uint32_t insize;
54 uint32_t result;
53}; 55};
54 56
55/** 57/**
56 * struct cros_ec_device - Information about a ChromeOS EC device 58 * struct cros_ec_device - Information about a ChromeOS EC device
57 * 59 *
58 * @name: Name of this EC interface 60 * @ec_name: name of EC device (e.g. 'chromeos-ec')
61 * @phys_name: name of physical comms layer (e.g. 'i2c-4')
62 * @dev: Device pointer
63 * @was_wake_device: true if this device was set to wake the system from
64 * sleep at the last suspend
65 *
59 * @priv: Private data 66 * @priv: Private data
60 * @irq: Interrupt to use 67 * @irq: Interrupt to use
61 * @din: input buffer (from EC) 68 * @din: input buffer (for data from EC)
62 * @dout: output buffer (to EC) 69 * @dout: output buffer (for data to EC)
63 * \note 70 * \note
64 * These two buffers will always be dword-aligned and include enough 71 * These two buffers will always be dword-aligned and include enough
65 * space for up to 7 word-alignment bytes also, so we can ensure that 72 * space for up to 7 word-alignment bytes also, so we can ensure that
66 * the body of the message is always dword-aligned (64-bit). 73 * the body of the message is always dword-aligned (64-bit).
67 *
68 * We use this alignment to keep ARM and x86 happy. Probably word 74 * We use this alignment to keep ARM and x86 happy. Probably word
69 * alignment would be OK, there might be a small performance advantage 75 * alignment would be OK, there might be a small performance advantage
70 * to using dword. 76 * to using dword.
71 * @din_size: size of din buffer 77 * @din_size: size of din buffer to allocate (zero to use static din)
72 * @dout_size: size of dout buffer 78 * @dout_size: size of dout buffer to allocate (zero to use static dout)
73 * @command_send: send a command
74 * @command_recv: receive a command
75 * @ec_name: name of EC device (e.g. 'chromeos-ec')
76 * @phys_name: name of physical comms layer (e.g. 'i2c-4')
77 * @parent: pointer to parent device (e.g. i2c or spi device) 79 * @parent: pointer to parent device (e.g. i2c or spi device)
78 * @dev: Device pointer
79 * dev_lock: Lock to prevent concurrent access
80 * @wake_enabled: true if this device can wake the system from sleep 80 * @wake_enabled: true if this device can wake the system from sleep
81 * @was_wake_device: true if this device was set to wake the system from 81 * @cmd_xfer: send command to EC and get response
82 * sleep at the last suspend 82 * Returns the number of bytes received if the communication succeeded, but
83 * @event_notifier: interrupt event notifier for transport devices 83 * that doesn't mean the EC was happy with the command. The caller
84 * should check msg.result for the EC's result code.
85 * @lock: one transaction at a time
84 */ 86 */
85struct cros_ec_device { 87struct cros_ec_device {
86 const char *name; 88
89 /* These are used by other drivers that want to talk to the EC */
90 const char *ec_name;
91 const char *phys_name;
92 struct device *dev;
93 bool was_wake_device;
94 struct class *cros_class;
95
96 /* These are used to implement the platform-specific interface */
87 void *priv; 97 void *priv;
88 int irq; 98 int irq;
89 uint8_t *din; 99 uint8_t *din;
90 uint8_t *dout; 100 uint8_t *dout;
91 int din_size; 101 int din_size;
92 int dout_size; 102 int dout_size;
93 int (*command_send)(struct cros_ec_device *ec,
94 uint16_t cmd, void *out_buf, int out_len);
95 int (*command_recv)(struct cros_ec_device *ec,
96 uint16_t cmd, void *in_buf, int in_len);
97 int (*command_sendrecv)(struct cros_ec_device *ec,
98 uint16_t cmd, void *out_buf, int out_len,
99 void *in_buf, int in_len);
100 int (*command_xfer)(struct cros_ec_device *ec,
101 struct cros_ec_msg *msg);
102
103 const char *ec_name;
104 const char *phys_name;
105 struct device *parent; 103 struct device *parent;
106
107 /* These are --private-- fields - do not assign */
108 struct device *dev;
109 struct mutex dev_lock;
110 bool wake_enabled; 104 bool wake_enabled;
111 bool was_wake_device; 105 int (*cmd_xfer)(struct cros_ec_device *ec,
112 struct blocking_notifier_head event_notifier; 106 struct cros_ec_command *msg);
107 struct mutex lock;
113}; 108};
114 109
115/** 110/**
@@ -143,13 +138,36 @@ int cros_ec_resume(struct cros_ec_device *ec_dev);
143 * @msg: Message to write 138 * @msg: Message to write
144 */ 139 */
145int cros_ec_prepare_tx(struct cros_ec_device *ec_dev, 140int cros_ec_prepare_tx(struct cros_ec_device *ec_dev,
146 struct cros_ec_msg *msg); 141 struct cros_ec_command *msg);
142
143/**
144 * cros_ec_check_result - Check ec_msg->result
145 *
146 * This is used by ChromeOS EC drivers to check the ec_msg->result for
147 * errors and to warn about them.
148 *
149 * @ec_dev: EC device
150 * @msg: Message to check
151 */
152int cros_ec_check_result(struct cros_ec_device *ec_dev,
153 struct cros_ec_command *msg);
154
155/**
156 * cros_ec_cmd_xfer - Send a command to the ChromeOS EC
157 *
158 * Call this to send a command to the ChromeOS EC. This should be used
159 * instead of calling the EC's cmd_xfer() callback directly.
160 *
161 * @ec_dev: EC device
162 * @msg: Message to write
163 */
164int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev,
165 struct cros_ec_command *msg);
147 166
148/** 167/**
149 * cros_ec_remove - Remove a ChromeOS EC 168 * cros_ec_remove - Remove a ChromeOS EC
150 * 169 *
151 * Call this to deregister a ChromeOS EC. After this you should call 170 * Call this to deregister a ChromeOS EC, then clean up any private data.
152 * cros_ec_free().
153 * 171 *
154 * @ec_dev: Device to register 172 * @ec_dev: Device to register
155 * @return 0 if ok, -ve on error 173 * @return 0 if ok, -ve on error
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 7853a6410d14..a49cd41feea7 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -1928,9 +1928,6 @@ struct ec_response_power_info {
1928 1928
1929#define EC_CMD_I2C_PASSTHRU 0x9e 1929#define EC_CMD_I2C_PASSTHRU 0x9e
1930 1930
1931/* Slave address is 10 (not 7) bit */
1932#define EC_I2C_FLAG_10BIT (1 << 16)
1933
1934/* Read data; if not present, message is a write */ 1931/* Read data; if not present, message is a write */
1935#define EC_I2C_FLAG_READ (1 << 15) 1932#define EC_I2C_FLAG_READ (1 << 15)
1936 1933
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index bba65f51a0b5..c18a4c19d6fc 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -211,7 +211,7 @@ static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
211int da9052_device_init(struct da9052 *da9052, u8 chip_id); 211int da9052_device_init(struct da9052 *da9052, u8 chip_id);
212void da9052_device_exit(struct da9052 *da9052); 212void da9052_device_exit(struct da9052 *da9052);
213 213
214extern struct regmap_config da9052_regmap_config; 214extern const struct regmap_config da9052_regmap_config;
215 215
216int da9052_irq_init(struct da9052 *da9052); 216int da9052_irq_init(struct da9052 *da9052);
217int da9052_irq_exit(struct da9052 *da9052); 217int da9052_irq_exit(struct da9052 *da9052);
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
index 00a9aac5d1e8..b92a3262f8f6 100644
--- a/include/linux/mfd/da9063/core.h
+++ b/include/linux/mfd/da9063/core.h
@@ -34,7 +34,8 @@ enum da9063_models {
34}; 34};
35 35
36enum da9063_variant_codes { 36enum da9063_variant_codes {
37 PMIC_DA9063_BB = 0x5 37 PMIC_DA9063_AD = 0x3,
38 PMIC_DA9063_BB = 0x5,
38}; 39};
39 40
40/* Interrupts */ 41/* Interrupts */
diff --git a/include/linux/mfd/da9063/registers.h b/include/linux/mfd/da9063/registers.h
index 09a85c699da1..2e0ba6d5fbc3 100644
--- a/include/linux/mfd/da9063/registers.h
+++ b/include/linux/mfd/da9063/registers.h
@@ -104,16 +104,27 @@
104#define DA9063_REG_COUNT_D 0x43 104#define DA9063_REG_COUNT_D 0x43
105#define DA9063_REG_COUNT_MO 0x44 105#define DA9063_REG_COUNT_MO 0x44
106#define DA9063_REG_COUNT_Y 0x45 106#define DA9063_REG_COUNT_Y 0x45
107#define DA9063_REG_ALARM_S 0x46 107
108#define DA9063_REG_ALARM_MI 0x47 108#define DA9063_AD_REG_ALARM_MI 0x46
109#define DA9063_REG_ALARM_H 0x48 109#define DA9063_AD_REG_ALARM_H 0x47
110#define DA9063_REG_ALARM_D 0x49 110#define DA9063_AD_REG_ALARM_D 0x48
111#define DA9063_REG_ALARM_MO 0x4A 111#define DA9063_AD_REG_ALARM_MO 0x49
112#define DA9063_REG_ALARM_Y 0x4B 112#define DA9063_AD_REG_ALARM_Y 0x4A
113#define DA9063_REG_SECOND_A 0x4C 113#define DA9063_AD_REG_SECOND_A 0x4B
114#define DA9063_REG_SECOND_B 0x4D 114#define DA9063_AD_REG_SECOND_B 0x4C
115#define DA9063_REG_SECOND_C 0x4E 115#define DA9063_AD_REG_SECOND_C 0x4D
116#define DA9063_REG_SECOND_D 0x4F 116#define DA9063_AD_REG_SECOND_D 0x4E
117
118#define DA9063_BB_REG_ALARM_S 0x46
119#define DA9063_BB_REG_ALARM_MI 0x47
120#define DA9063_BB_REG_ALARM_H 0x48
121#define DA9063_BB_REG_ALARM_D 0x49
122#define DA9063_BB_REG_ALARM_MO 0x4A
123#define DA9063_BB_REG_ALARM_Y 0x4B
124#define DA9063_BB_REG_SECOND_A 0x4C
125#define DA9063_BB_REG_SECOND_B 0x4D
126#define DA9063_BB_REG_SECOND_C 0x4E
127#define DA9063_BB_REG_SECOND_D 0x4F
117 128
118/* Sequencer Control Registers */ 129/* Sequencer Control Registers */
119#define DA9063_REG_SEQ 0x81 130#define DA9063_REG_SEQ 0x81
@@ -223,37 +234,67 @@
223#define DA9063_REG_CONFIG_J 0x10F 234#define DA9063_REG_CONFIG_J 0x10F
224#define DA9063_REG_CONFIG_K 0x110 235#define DA9063_REG_CONFIG_K 0x110
225#define DA9063_REG_CONFIG_L 0x111 236#define DA9063_REG_CONFIG_L 0x111
226#define DA9063_REG_CONFIG_M 0x112 237
227#define DA9063_REG_CONFIG_N 0x113 238#define DA9063_AD_REG_MON_REG_1 0x112
228 239#define DA9063_AD_REG_MON_REG_2 0x113
229#define DA9063_REG_MON_REG_1 0x114 240#define DA9063_AD_REG_MON_REG_3 0x114
230#define DA9063_REG_MON_REG_2 0x115 241#define DA9063_AD_REG_MON_REG_4 0x115
231#define DA9063_REG_MON_REG_3 0x116 242#define DA9063_AD_REG_MON_REG_5 0x116
232#define DA9063_REG_MON_REG_4 0x117 243#define DA9063_AD_REG_MON_REG_6 0x117
233#define DA9063_REG_MON_REG_5 0x11E 244#define DA9063_AD_REG_TRIM_CLDR 0x118
234#define DA9063_REG_MON_REG_6 0x11F 245
235#define DA9063_REG_TRIM_CLDR 0x120 246#define DA9063_AD_REG_GP_ID_0 0x119
247#define DA9063_AD_REG_GP_ID_1 0x11A
248#define DA9063_AD_REG_GP_ID_2 0x11B
249#define DA9063_AD_REG_GP_ID_3 0x11C
250#define DA9063_AD_REG_GP_ID_4 0x11D
251#define DA9063_AD_REG_GP_ID_5 0x11E
252#define DA9063_AD_REG_GP_ID_6 0x11F
253#define DA9063_AD_REG_GP_ID_7 0x120
254#define DA9063_AD_REG_GP_ID_8 0x121
255#define DA9063_AD_REG_GP_ID_9 0x122
256#define DA9063_AD_REG_GP_ID_10 0x123
257#define DA9063_AD_REG_GP_ID_11 0x124
258#define DA9063_AD_REG_GP_ID_12 0x125
259#define DA9063_AD_REG_GP_ID_13 0x126
260#define DA9063_AD_REG_GP_ID_14 0x127
261#define DA9063_AD_REG_GP_ID_15 0x128
262#define DA9063_AD_REG_GP_ID_16 0x129
263#define DA9063_AD_REG_GP_ID_17 0x12A
264#define DA9063_AD_REG_GP_ID_18 0x12B
265#define DA9063_AD_REG_GP_ID_19 0x12C
266
267#define DA9063_BB_REG_CONFIG_M 0x112
268#define DA9063_BB_REG_CONFIG_N 0x113
269
270#define DA9063_BB_REG_MON_REG_1 0x114
271#define DA9063_BB_REG_MON_REG_2 0x115
272#define DA9063_BB_REG_MON_REG_3 0x116
273#define DA9063_BB_REG_MON_REG_4 0x117
274#define DA9063_BB_REG_MON_REG_5 0x11E
275#define DA9063_BB_REG_MON_REG_6 0x11F
276#define DA9063_BB_REG_TRIM_CLDR 0x120
236/* General Purpose Registers */ 277/* General Purpose Registers */
237#define DA9063_REG_GP_ID_0 0x121 278#define DA9063_BB_REG_GP_ID_0 0x121
238#define DA9063_REG_GP_ID_1 0x122 279#define DA9063_BB_REG_GP_ID_1 0x122
239#define DA9063_REG_GP_ID_2 0x123 280#define DA9063_BB_REG_GP_ID_2 0x123
240#define DA9063_REG_GP_ID_3 0x124 281#define DA9063_BB_REG_GP_ID_3 0x124
241#define DA9063_REG_GP_ID_4 0x125 282#define DA9063_BB_REG_GP_ID_4 0x125
242#define DA9063_REG_GP_ID_5 0x126 283#define DA9063_BB_REG_GP_ID_5 0x126
243#define DA9063_REG_GP_ID_6 0x127 284#define DA9063_BB_REG_GP_ID_6 0x127
244#define DA9063_REG_GP_ID_7 0x128 285#define DA9063_BB_REG_GP_ID_7 0x128
245#define DA9063_REG_GP_ID_8 0x129 286#define DA9063_BB_REG_GP_ID_8 0x129
246#define DA9063_REG_GP_ID_9 0x12A 287#define DA9063_BB_REG_GP_ID_9 0x12A
247#define DA9063_REG_GP_ID_10 0x12B 288#define DA9063_BB_REG_GP_ID_10 0x12B
248#define DA9063_REG_GP_ID_11 0x12C 289#define DA9063_BB_REG_GP_ID_11 0x12C
249#define DA9063_REG_GP_ID_12 0x12D 290#define DA9063_BB_REG_GP_ID_12 0x12D
250#define DA9063_REG_GP_ID_13 0x12E 291#define DA9063_BB_REG_GP_ID_13 0x12E
251#define DA9063_REG_GP_ID_14 0x12F 292#define DA9063_BB_REG_GP_ID_14 0x12F
252#define DA9063_REG_GP_ID_15 0x130 293#define DA9063_BB_REG_GP_ID_15 0x130
253#define DA9063_REG_GP_ID_16 0x131 294#define DA9063_BB_REG_GP_ID_16 0x131
254#define DA9063_REG_GP_ID_17 0x132 295#define DA9063_BB_REG_GP_ID_17 0x132
255#define DA9063_REG_GP_ID_18 0x133 296#define DA9063_BB_REG_GP_ID_18 0x133
256#define DA9063_REG_GP_ID_19 0x134 297#define DA9063_BB_REG_GP_ID_19 0x134
257 298
258/* Chip ID and variant */ 299/* Chip ID and variant */
259#define DA9063_REG_CHIP_ID 0x181 300#define DA9063_REG_CHIP_ID 0x181
@@ -404,10 +445,10 @@
404/* DA9063_REG_CONTROL_B (addr=0x0F) */ 445/* DA9063_REG_CONTROL_B (addr=0x0F) */
405#define DA9063_CHG_SEL 0x01 446#define DA9063_CHG_SEL 0x01
406#define DA9063_WATCHDOG_PD 0x02 447#define DA9063_WATCHDOG_PD 0x02
407#define DA9063_RESET_BLINKING 0x04 448#define DA9063_BB_RESET_BLINKING 0x04
408#define DA9063_NRES_MODE 0x08 449#define DA9063_NRES_MODE 0x08
409#define DA9063_NONKEY_LOCK 0x10 450#define DA9063_NONKEY_LOCK 0x10
410#define DA9063_BUCK_SLOWSTART 0x80 451#define DA9063_BB_BUCK_SLOWSTART 0x80
411 452
412/* DA9063_REG_CONTROL_C (addr=0x10) */ 453/* DA9063_REG_CONTROL_C (addr=0x10) */
413#define DA9063_DEBOUNCING_MASK 0x07 454#define DA9063_DEBOUNCING_MASK 0x07
@@ -467,7 +508,7 @@
467#define DA9063_GPADC_PAUSE 0x02 508#define DA9063_GPADC_PAUSE 0x02
468#define DA9063_PMIF_DIS 0x04 509#define DA9063_PMIF_DIS 0x04
469#define DA9063_HS2WIRE_DIS 0x08 510#define DA9063_HS2WIRE_DIS 0x08
470#define DA9063_CLDR_PAUSE 0x10 511#define DA9063_BB_CLDR_PAUSE 0x10
471#define DA9063_BBAT_DIS 0x20 512#define DA9063_BBAT_DIS 0x20
472#define DA9063_OUT_32K_PAUSE 0x40 513#define DA9063_OUT_32K_PAUSE 0x40
473#define DA9063_PMCONT_DIS 0x80 514#define DA9063_PMCONT_DIS 0x80
@@ -844,7 +885,7 @@
844#define DA9063_MONITOR 0x40 885#define DA9063_MONITOR 0x40
845 886
846/* DA9063_REG_ALARM_S (addr=0x46) */ 887/* DA9063_REG_ALARM_S (addr=0x46) */
847#define DA9063_ALARM_S_MASK 0x3F 888#define DA9063_BB_ALARM_S_MASK 0x3F
848#define DA9063_ALARM_STATUS_ALARM 0x80 889#define DA9063_ALARM_STATUS_ALARM 0x80
849#define DA9063_ALARM_STATUS_TICK 0x40 890#define DA9063_ALARM_STATUS_TICK 0x40
850/* DA9063_REG_ALARM_MI (addr=0x47) */ 891/* DA9063_REG_ALARM_MI (addr=0x47) */
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h
index 5166935ce66d..cb01496bfa49 100644
--- a/include/linux/mfd/davinci_voicecodec.h
+++ b/include/linux/mfd/davinci_voicecodec.h
@@ -21,7 +21,7 @@
21 */ 21 */
22 22
23#ifndef __LINUX_MFD_DAVINCI_VOICECODEC_H_ 23#ifndef __LINUX_MFD_DAVINCI_VOICECODEC_H_
24#define __LINUX_MFD_DAVINIC_VOICECODEC_H_ 24#define __LINUX_MFD_DAVINCI_VOICECODEC_H_
25 25
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
diff --git a/include/linux/mfd/hi6421-pmic.h b/include/linux/mfd/hi6421-pmic.h
new file mode 100644
index 000000000000..587273e35acf
--- /dev/null
+++ b/include/linux/mfd/hi6421-pmic.h
@@ -0,0 +1,41 @@
1/*
2 * Header file for device driver Hi6421 PMIC
3 *
4 * Copyright (c) <2011-2014> HiSilicon Technologies Co., Ltd.
5 * http://www.hisilicon.com
6 * Copyright (c) <2013-2014> Linaro Ltd.
7 * http://www.linaro.org
8 *
9 * Author: Guodong Xu <guodong.xu@linaro.org>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#ifndef __HI6421_PMIC_H
17#define __HI6421_PMIC_H
18
19/* Hi6421 registers are mapped to memory bus in 4 bytes stride */
20#define HI6421_REG_TO_BUS_ADDR(x) (x << 2)
21
22/* Hi6421 maximum register number */
23#define HI6421_REG_MAX 0xFF
24
25/* Hi6421 OCP (over current protection) and DEB (debounce) control register */
26#define HI6421_OCP_DEB_CTRL_REG HI6421_REG_TO_BUS_ADDR(0x51)
27#define HI6421_OCP_DEB_SEL_MASK 0x0C
28#define HI6421_OCP_DEB_SEL_8MS 0x00
29#define HI6421_OCP_DEB_SEL_16MS 0x04
30#define HI6421_OCP_DEB_SEL_32MS 0x08
31#define HI6421_OCP_DEB_SEL_64MS 0x0C
32#define HI6421_OCP_EN_DEBOUNCE_MASK 0x02
33#define HI6421_OCP_EN_DEBOUNCE_ENABLE 0x02
34#define HI6421_OCP_AUTO_STOP_MASK 0x01
35#define HI6421_OCP_AUTO_STOP_ENABLE 0x01
36
37struct hi6421_pmic {
38 struct regmap *regmap;
39};
40
41#endif /* __HI6421_PMIC_H */
diff --git a/include/linux/mfd/intel_soc_pmic.h b/include/linux/mfd/intel_soc_pmic.h
new file mode 100644
index 000000000000..abcbfcf32d10
--- /dev/null
+++ b/include/linux/mfd/intel_soc_pmic.h
@@ -0,0 +1,30 @@
1/*
2 * intel_soc_pmic.h - Intel SoC PMIC Driver
3 *
4 * Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
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 version
8 * 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * Author: Yang, Bin <bin.yang@intel.com>
16 * Author: Zhu, Lejun <lejun.zhu@linux.intel.com>
17 */
18
19#ifndef __INTEL_SOC_PMIC_H__
20#define __INTEL_SOC_PMIC_H__
21
22#include <linux/regmap.h>
23
24struct intel_soc_pmic {
25 int irq;
26 struct regmap *regmap;
27 struct regmap_irq_chip_data *irq_chip_data;
28};
29
30#endif /* __INTEL_SOC_PMIC_H__ */
diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
index 499253604026..f01c1fae4d84 100644
--- a/include/linux/mfd/max14577-private.h
+++ b/include/linux/mfd/max14577-private.h
@@ -72,15 +72,33 @@ enum max14577_muic_reg {
72 MAX14577_MUIC_REG_END, 72 MAX14577_MUIC_REG_END,
73}; 73};
74 74
75/*
76 * Combined charger types for max14577 and max77836.
77 *
78 * On max14577 three lower bits map to STATUS2/CHGTYP field.
79 * However the max77836 has different two last values of STATUS2/CHGTYP.
80 * To indicate the difference enum has two additional values for max77836.
81 * These values are just a register value bitwise OR with 0x8.
82 */
75enum max14577_muic_charger_type { 83enum max14577_muic_charger_type {
76 MAX14577_CHARGER_TYPE_NONE = 0, 84 MAX14577_CHARGER_TYPE_NONE = 0x0,
77 MAX14577_CHARGER_TYPE_USB, 85 MAX14577_CHARGER_TYPE_USB = 0x1,
78 MAX14577_CHARGER_TYPE_DOWNSTREAM_PORT, 86 MAX14577_CHARGER_TYPE_DOWNSTREAM_PORT = 0x2,
79 MAX14577_CHARGER_TYPE_DEDICATED_CHG, 87 MAX14577_CHARGER_TYPE_DEDICATED_CHG = 0x3,
80 MAX14577_CHARGER_TYPE_SPECIAL_500MA, 88 MAX14577_CHARGER_TYPE_SPECIAL_500MA = 0x4,
81 MAX14577_CHARGER_TYPE_SPECIAL_1A, 89 /* Special 1A or 2A charger */
82 MAX14577_CHARGER_TYPE_RESERVED, 90 MAX14577_CHARGER_TYPE_SPECIAL_1A = 0x5,
83 MAX14577_CHARGER_TYPE_DEAD_BATTERY = 7, 91 /* max14577: reserved, used on max77836 */
92 MAX14577_CHARGER_TYPE_RESERVED = 0x6,
93 /* max14577: dead-battery charing with maximum current 100mA */
94 MAX14577_CHARGER_TYPE_DEAD_BATTERY = 0x7,
95 /*
96 * max77836: special charger (bias on D+/D-),
97 * matches register value of 0x6
98 */
99 MAX77836_CHARGER_TYPE_SPECIAL_BIAS = 0xe,
100 /* max77836: reserved, register value 0x7 */
101 MAX77836_CHARGER_TYPE_RESERVED = 0xf,
84}; 102};
85 103
86/* MAX14577 interrupts */ 104/* MAX14577 interrupts */
@@ -121,13 +139,15 @@ enum max14577_muic_charger_type {
121#define STATUS2_CHGTYP_SHIFT 0 139#define STATUS2_CHGTYP_SHIFT 0
122#define STATUS2_CHGDETRUN_SHIFT 3 140#define STATUS2_CHGDETRUN_SHIFT 3
123#define STATUS2_DCDTMR_SHIFT 4 141#define STATUS2_DCDTMR_SHIFT 4
124#define STATUS2_DBCHG_SHIFT 5 142#define MAX14577_STATUS2_DBCHG_SHIFT 5
143#define MAX77836_STATUS2_DXOVP_SHIFT 5
125#define STATUS2_VBVOLT_SHIFT 6 144#define STATUS2_VBVOLT_SHIFT 6
126#define MAX77836_STATUS2_VIDRM_SHIFT 7 145#define MAX77836_STATUS2_VIDRM_SHIFT 7
127#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT) 146#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT)
128#define STATUS2_CHGDETRUN_MASK BIT(STATUS2_CHGDETRUN_SHIFT) 147#define STATUS2_CHGDETRUN_MASK BIT(STATUS2_CHGDETRUN_SHIFT)
129#define STATUS2_DCDTMR_MASK BIT(STATUS2_DCDTMR_SHIFT) 148#define STATUS2_DCDTMR_MASK BIT(STATUS2_DCDTMR_SHIFT)
130#define STATUS2_DBCHG_MASK BIT(STATUS2_DBCHG_SHIFT) 149#define MAX14577_STATUS2_DBCHG_MASK BIT(MAX14577_STATUS2_DBCHG_SHIFT)
150#define MAX77836_STATUS2_DXOVP_MASK BIT(MAX77836_STATUS2_DXOVP_SHIFT)
131#define STATUS2_VBVOLT_MASK BIT(STATUS2_VBVOLT_SHIFT) 151#define STATUS2_VBVOLT_MASK BIT(STATUS2_VBVOLT_SHIFT)
132#define MAX77836_STATUS2_VIDRM_MASK BIT(MAX77836_STATUS2_VIDRM_SHIFT) 152#define MAX77836_STATUS2_VIDRM_MASK BIT(MAX77836_STATUS2_VIDRM_SHIFT)
133 153
@@ -177,9 +197,11 @@ enum max14577_muic_charger_type {
177#define CTRL3_JIGSET_SHIFT 0 197#define CTRL3_JIGSET_SHIFT 0
178#define CTRL3_BOOTSET_SHIFT 2 198#define CTRL3_BOOTSET_SHIFT 2
179#define CTRL3_ADCDBSET_SHIFT 4 199#define CTRL3_ADCDBSET_SHIFT 4
200#define CTRL3_WBTH_SHIFT 6
180#define CTRL3_JIGSET_MASK (0x3 << CTRL3_JIGSET_SHIFT) 201#define CTRL3_JIGSET_MASK (0x3 << CTRL3_JIGSET_SHIFT)
181#define CTRL3_BOOTSET_MASK (0x3 << CTRL3_BOOTSET_SHIFT) 202#define CTRL3_BOOTSET_MASK (0x3 << CTRL3_BOOTSET_SHIFT)
182#define CTRL3_ADCDBSET_MASK (0x3 << CTRL3_ADCDBSET_SHIFT) 203#define CTRL3_ADCDBSET_MASK (0x3 << CTRL3_ADCDBSET_SHIFT)
204#define CTRL3_WBTH_MASK (0x3 << CTRL3_WBTH_SHIFT)
183 205
184/* Slave addr = 0x4A: Charger */ 206/* Slave addr = 0x4A: Charger */
185enum max14577_charger_reg { 207enum max14577_charger_reg {
@@ -210,16 +232,20 @@ enum max14577_charger_reg {
210#define CDETCTRL1_CHGTYPMAN_SHIFT 1 232#define CDETCTRL1_CHGTYPMAN_SHIFT 1
211#define CDETCTRL1_DCDEN_SHIFT 2 233#define CDETCTRL1_DCDEN_SHIFT 2
212#define CDETCTRL1_DCD2SCT_SHIFT 3 234#define CDETCTRL1_DCD2SCT_SHIFT 3
213#define CDETCTRL1_DCHKTM_SHIFT 4 235#define MAX14577_CDETCTRL1_DCHKTM_SHIFT 4
214#define CDETCTRL1_DBEXIT_SHIFT 5 236#define MAX77836_CDETCTRL1_CDLY_SHIFT 4
237#define MAX14577_CDETCTRL1_DBEXIT_SHIFT 5
238#define MAX77836_CDETCTRL1_DCDCPL_SHIFT 5
215#define CDETCTRL1_DBIDLE_SHIFT 6 239#define CDETCTRL1_DBIDLE_SHIFT 6
216#define CDETCTRL1_CDPDET_SHIFT 7 240#define CDETCTRL1_CDPDET_SHIFT 7
217#define CDETCTRL1_CHGDETEN_MASK BIT(CDETCTRL1_CHGDETEN_SHIFT) 241#define CDETCTRL1_CHGDETEN_MASK BIT(CDETCTRL1_CHGDETEN_SHIFT)
218#define CDETCTRL1_CHGTYPMAN_MASK BIT(CDETCTRL1_CHGTYPMAN_SHIFT) 242#define CDETCTRL1_CHGTYPMAN_MASK BIT(CDETCTRL1_CHGTYPMAN_SHIFT)
219#define CDETCTRL1_DCDEN_MASK BIT(CDETCTRL1_DCDEN_SHIFT) 243#define CDETCTRL1_DCDEN_MASK BIT(CDETCTRL1_DCDEN_SHIFT)
220#define CDETCTRL1_DCD2SCT_MASK BIT(CDETCTRL1_DCD2SCT_SHIFT) 244#define CDETCTRL1_DCD2SCT_MASK BIT(CDETCTRL1_DCD2SCT_SHIFT)
221#define CDETCTRL1_DCHKTM_MASK BIT(CDETCTRL1_DCHKTM_SHIFT) 245#define MAX14577_CDETCTRL1_DCHKTM_MASK BIT(MAX14577_CDETCTRL1_DCHKTM_SHIFT)
222#define CDETCTRL1_DBEXIT_MASK BIT(CDETCTRL1_DBEXIT_SHIFT) 246#define MAX77836_CDETCTRL1_CDDLY_MASK BIT(MAX77836_CDETCTRL1_CDDLY_SHIFT)
247#define MAX14577_CDETCTRL1_DBEXIT_MASK BIT(MAX14577_CDETCTRL1_DBEXIT_SHIFT)
248#define MAX77836_CDETCTRL1_DCDCPL_MASK BIT(MAX77836_CDETCTRL1_DCDCPL_SHIFT)
223#define CDETCTRL1_DBIDLE_MASK BIT(CDETCTRL1_DBIDLE_SHIFT) 249#define CDETCTRL1_DBIDLE_MASK BIT(CDETCTRL1_DBIDLE_SHIFT)
224#define CDETCTRL1_CDPDET_MASK BIT(CDETCTRL1_CDPDET_SHIFT) 250#define CDETCTRL1_CDPDET_MASK BIT(CDETCTRL1_CDPDET_SHIFT)
225 251
@@ -255,17 +281,36 @@ enum max14577_charger_reg {
255#define CHGCTRL7_OTPCGHCVS_SHIFT 0 281#define CHGCTRL7_OTPCGHCVS_SHIFT 0
256#define CHGCTRL7_OTPCGHCVS_MASK (0x3 << CHGCTRL7_OTPCGHCVS_SHIFT) 282#define CHGCTRL7_OTPCGHCVS_MASK (0x3 << CHGCTRL7_OTPCGHCVS_SHIFT)
257 283
258/* MAX14577 regulator current limits (as in CHGCTRL4 register), uA */ 284/* MAX14577 charger current limits (as in CHGCTRL4 register), uA */
259#define MAX14577_REGULATOR_CURRENT_LIMIT_MIN 90000 285#define MAX14577_CHARGER_CURRENT_LIMIT_MIN 90000U
260#define MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START 200000 286#define MAX14577_CHARGER_CURRENT_LIMIT_HIGH_START 200000U
261#define MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP 50000 287#define MAX14577_CHARGER_CURRENT_LIMIT_HIGH_STEP 50000U
262#define MAX14577_REGULATOR_CURRENT_LIMIT_MAX 950000 288#define MAX14577_CHARGER_CURRENT_LIMIT_MAX 950000U
263 289
264/* MAX77836 regulator current limits (as in CHGCTRL4 register), uA */ 290/* MAX77836 charger current limits (as in CHGCTRL4 register), uA */
265#define MAX77836_REGULATOR_CURRENT_LIMIT_MIN 45000 291#define MAX77836_CHARGER_CURRENT_LIMIT_MIN 45000U
266#define MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_START 100000 292#define MAX77836_CHARGER_CURRENT_LIMIT_HIGH_START 100000U
267#define MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_STEP 25000 293#define MAX77836_CHARGER_CURRENT_LIMIT_HIGH_STEP 25000U
268#define MAX77836_REGULATOR_CURRENT_LIMIT_MAX 475000 294#define MAX77836_CHARGER_CURRENT_LIMIT_MAX 475000U
295
296/*
297 * MAX14577 charger End-Of-Charge current limits
298 * (as in CHGCTRL5 register), uA
299 */
300#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_MIN 50000U
301#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_STEP 10000U
302#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_MAX 200000U
303
304/*
305 * MAX14577/MAX77836 Battery Constant Voltage
306 * (as in CHGCTRL3 register), uV
307 */
308#define MAXIM_CHARGER_CONSTANT_VOLTAGE_MIN 4000000U
309#define MAXIM_CHARGER_CONSTANT_VOLTAGE_STEP 20000U
310#define MAXIM_CHARGER_CONSTANT_VOLTAGE_MAX 4350000U
311
312/* Default value for fast charge timer, in hours */
313#define MAXIM_CHARGER_FAST_CHARGE_TIMER_DEFAULT 5
269 314
270/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */ 315/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */
271#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000 316#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000
diff --git a/include/linux/mfd/max14577.h b/include/linux/mfd/max14577.h
index c83fbed1c7b6..ccfaf952c31b 100644
--- a/include/linux/mfd/max14577.h
+++ b/include/linux/mfd/max14577.h
@@ -54,6 +54,13 @@ struct max14577_regulator_platform_data {
54 struct device_node *of_node; 54 struct device_node *of_node;
55}; 55};
56 56
57struct max14577_charger_platform_data {
58 u32 constant_uvolt;
59 u32 fast_charge_uamp;
60 u32 eoc_uamp;
61 u32 ovp_uvolt;
62};
63
57/* 64/*
58 * MAX14577 MFD platform data 65 * MAX14577 MFD platform data
59 */ 66 */
@@ -74,4 +81,27 @@ struct max14577_platform_data {
74 struct max14577_regulator_platform_data *regulators; 81 struct max14577_regulator_platform_data *regulators;
75}; 82};
76 83
84/*
85 * Valid limits of current for max14577 and max77836 chargers.
86 * They must correspond to MBCICHWRCL and MBCICHWRCH fields in CHGCTRL4
87 * register for given chipset.
88 */
89struct maxim_charger_current {
90 /* Minimal current, set in CHGCTRL4/MBCICHWRCL, uA */
91 unsigned int min;
92 /*
93 * Minimal current when high setting is active,
94 * set in CHGCTRL4/MBCICHWRCH, uA
95 */
96 unsigned int high_start;
97 /* Value of one step in high setting, uA */
98 unsigned int high_step;
99 /* Maximum current of high setting, uA */
100 unsigned int max;
101};
102
103extern const struct maxim_charger_current maxim_charger_currents[];
104extern int maxim_charger_calc_reg_current(const struct maxim_charger_current *limits,
105 unsigned int min_ua, unsigned int max_ua, u8 *dst);
106
77#endif /* __MAX14577_H__ */ 107#endif /* __MAX14577_H__ */
diff --git a/include/linux/mfd/max77686-private.h b/include/linux/mfd/max77686-private.h
index 8c75a9c8dfab..960b92ad450d 100644
--- a/include/linux/mfd/max77686-private.h
+++ b/include/linux/mfd/max77686-private.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * max77686-private.h - Voltage regulator driver for the Maxim 77686 2 * max77686-private.h - Voltage regulator driver for the Maxim 77686/802
3 * 3 *
4 * Copyright (C) 2012 Samsung Electrnoics 4 * Copyright (C) 2012 Samsung Electrnoics
5 * Chiwoong Byun <woong.byun@samsung.com> 5 * Chiwoong Byun <woong.byun@samsung.com>
@@ -28,6 +28,7 @@
28 28
29#define MAX77686_REG_INVALID (0xff) 29#define MAX77686_REG_INVALID (0xff)
30 30
31/* MAX77686 PMIC registers */
31enum max77686_pmic_reg { 32enum max77686_pmic_reg {
32 MAX77686_REG_DEVICE_ID = 0x00, 33 MAX77686_REG_DEVICE_ID = 0x00,
33 MAX77686_REG_INTSRC = 0x01, 34 MAX77686_REG_INTSRC = 0x01,
@@ -181,8 +182,209 @@ enum max77686_rtc_reg {
181 MAX77686_ALARM2_DATE = 0x1B, 182 MAX77686_ALARM2_DATE = 0x1B,
182}; 183};
183 184
184#define MAX77686_IRQSRC_PMIC (0) 185/* MAX77802 PMIC registers */
185#define MAX77686_IRQSRC_RTC (1 << 0) 186enum max77802_pmic_reg {
187 MAX77802_REG_DEVICE_ID = 0x00,
188 MAX77802_REG_INTSRC = 0x01,
189 MAX77802_REG_INT1 = 0x02,
190 MAX77802_REG_INT2 = 0x03,
191
192 MAX77802_REG_INT1MSK = 0x04,
193 MAX77802_REG_INT2MSK = 0x05,
194
195 MAX77802_REG_STATUS1 = 0x06,
196 MAX77802_REG_STATUS2 = 0x07,
197
198 MAX77802_REG_PWRON = 0x08,
199 /* Reserved: 0x09 */
200 MAX77802_REG_MRSTB = 0x0A,
201 MAX77802_REG_EPWRHOLD = 0x0B,
202 /* Reserved: 0x0C-0x0D */
203 MAX77802_REG_BOOSTCTRL = 0x0E,
204 MAX77802_REG_BOOSTOUT = 0x0F,
205
206 MAX77802_REG_BUCK1CTRL = 0x10,
207 MAX77802_REG_BUCK1DVS1 = 0x11,
208 MAX77802_REG_BUCK1DVS2 = 0x12,
209 MAX77802_REG_BUCK1DVS3 = 0x13,
210 MAX77802_REG_BUCK1DVS4 = 0x14,
211 MAX77802_REG_BUCK1DVS5 = 0x15,
212 MAX77802_REG_BUCK1DVS6 = 0x16,
213 MAX77802_REG_BUCK1DVS7 = 0x17,
214 MAX77802_REG_BUCK1DVS8 = 0x18,
215 /* Reserved: 0x19 */
216 MAX77802_REG_BUCK2CTRL1 = 0x1A,
217 MAX77802_REG_BUCK2CTRL2 = 0x1B,
218 MAX77802_REG_BUCK2PHTRAN = 0x1C,
219 MAX77802_REG_BUCK2DVS1 = 0x1D,
220 MAX77802_REG_BUCK2DVS2 = 0x1E,
221 MAX77802_REG_BUCK2DVS3 = 0x1F,
222 MAX77802_REG_BUCK2DVS4 = 0x20,
223 MAX77802_REG_BUCK2DVS5 = 0x21,
224 MAX77802_REG_BUCK2DVS6 = 0x22,
225 MAX77802_REG_BUCK2DVS7 = 0x23,
226 MAX77802_REG_BUCK2DVS8 = 0x24,
227 /* Reserved: 0x25-0x26 */
228 MAX77802_REG_BUCK3CTRL1 = 0x27,
229 MAX77802_REG_BUCK3DVS1 = 0x28,
230 MAX77802_REG_BUCK3DVS2 = 0x29,
231 MAX77802_REG_BUCK3DVS3 = 0x2A,
232 MAX77802_REG_BUCK3DVS4 = 0x2B,
233 MAX77802_REG_BUCK3DVS5 = 0x2C,
234 MAX77802_REG_BUCK3DVS6 = 0x2D,
235 MAX77802_REG_BUCK3DVS7 = 0x2E,
236 MAX77802_REG_BUCK3DVS8 = 0x2F,
237 /* Reserved: 0x30-0x36 */
238 MAX77802_REG_BUCK4CTRL1 = 0x37,
239 MAX77802_REG_BUCK4DVS1 = 0x38,
240 MAX77802_REG_BUCK4DVS2 = 0x39,
241 MAX77802_REG_BUCK4DVS3 = 0x3A,
242 MAX77802_REG_BUCK4DVS4 = 0x3B,
243 MAX77802_REG_BUCK4DVS5 = 0x3C,
244 MAX77802_REG_BUCK4DVS6 = 0x3D,
245 MAX77802_REG_BUCK4DVS7 = 0x3E,
246 MAX77802_REG_BUCK4DVS8 = 0x3F,
247 /* Reserved: 0x40 */
248 MAX77802_REG_BUCK5CTRL = 0x41,
249 MAX77802_REG_BUCK5OUT = 0x42,
250 /* Reserved: 0x43 */
251 MAX77802_REG_BUCK6CTRL = 0x44,
252 MAX77802_REG_BUCK6DVS1 = 0x45,
253 MAX77802_REG_BUCK6DVS2 = 0x46,
254 MAX77802_REG_BUCK6DVS3 = 0x47,
255 MAX77802_REG_BUCK6DVS4 = 0x48,
256 MAX77802_REG_BUCK6DVS5 = 0x49,
257 MAX77802_REG_BUCK6DVS6 = 0x4A,
258 MAX77802_REG_BUCK6DVS7 = 0x4B,
259 MAX77802_REG_BUCK6DVS8 = 0x4C,
260 /* Reserved: 0x4D */
261 MAX77802_REG_BUCK7CTRL = 0x4E,
262 MAX77802_REG_BUCK7OUT = 0x4F,
263 /* Reserved: 0x50 */
264 MAX77802_REG_BUCK8CTRL = 0x51,
265 MAX77802_REG_BUCK8OUT = 0x52,
266 /* Reserved: 0x53 */
267 MAX77802_REG_BUCK9CTRL = 0x54,
268 MAX77802_REG_BUCK9OUT = 0x55,
269 /* Reserved: 0x56 */
270 MAX77802_REG_BUCK10CTRL = 0x57,
271 MAX77802_REG_BUCK10OUT = 0x58,
272
273 /* Reserved: 0x59-0x5F */
274
275 MAX77802_REG_LDO1CTRL1 = 0x60,
276 MAX77802_REG_LDO2CTRL1 = 0x61,
277 MAX77802_REG_LDO3CTRL1 = 0x62,
278 MAX77802_REG_LDO4CTRL1 = 0x63,
279 MAX77802_REG_LDO5CTRL1 = 0x64,
280 MAX77802_REG_LDO6CTRL1 = 0x65,
281 MAX77802_REG_LDO7CTRL1 = 0x66,
282 MAX77802_REG_LDO8CTRL1 = 0x67,
283 MAX77802_REG_LDO9CTRL1 = 0x68,
284 MAX77802_REG_LDO10CTRL1 = 0x69,
285 MAX77802_REG_LDO11CTRL1 = 0x6A,
286 MAX77802_REG_LDO12CTRL1 = 0x6B,
287 MAX77802_REG_LDO13CTRL1 = 0x6C,
288 MAX77802_REG_LDO14CTRL1 = 0x6D,
289 MAX77802_REG_LDO15CTRL1 = 0x6E,
290 /* Reserved: 0x6F */
291 MAX77802_REG_LDO17CTRL1 = 0x70,
292 MAX77802_REG_LDO18CTRL1 = 0x71,
293 MAX77802_REG_LDO19CTRL1 = 0x72,
294 MAX77802_REG_LDO20CTRL1 = 0x73,
295 MAX77802_REG_LDO21CTRL1 = 0x74,
296 MAX77802_REG_LDO22CTRL1 = 0x75,
297 MAX77802_REG_LDO23CTRL1 = 0x76,
298 MAX77802_REG_LDO24CTRL1 = 0x77,
299 MAX77802_REG_LDO25CTRL1 = 0x78,
300 MAX77802_REG_LDO26CTRL1 = 0x79,
301 MAX77802_REG_LDO27CTRL1 = 0x7A,
302 MAX77802_REG_LDO28CTRL1 = 0x7B,
303 MAX77802_REG_LDO29CTRL1 = 0x7C,
304 MAX77802_REG_LDO30CTRL1 = 0x7D,
305 /* Reserved: 0x7E */
306 MAX77802_REG_LDO32CTRL1 = 0x7F,
307 MAX77802_REG_LDO33CTRL1 = 0x80,
308 MAX77802_REG_LDO34CTRL1 = 0x81,
309 MAX77802_REG_LDO35CTRL1 = 0x82,
310 /* Reserved: 0x83-0x8F */
311 MAX77802_REG_LDO1CTRL2 = 0x90,
312 MAX77802_REG_LDO2CTRL2 = 0x91,
313 MAX77802_REG_LDO3CTRL2 = 0x92,
314 MAX77802_REG_LDO4CTRL2 = 0x93,
315 MAX77802_REG_LDO5CTRL2 = 0x94,
316 MAX77802_REG_LDO6CTRL2 = 0x95,
317 MAX77802_REG_LDO7CTRL2 = 0x96,
318 MAX77802_REG_LDO8CTRL2 = 0x97,
319 MAX77802_REG_LDO9CTRL2 = 0x98,
320 MAX77802_REG_LDO10CTRL2 = 0x99,
321 MAX77802_REG_LDO11CTRL2 = 0x9A,
322 MAX77802_REG_LDO12CTRL2 = 0x9B,
323 MAX77802_REG_LDO13CTRL2 = 0x9C,
324 MAX77802_REG_LDO14CTRL2 = 0x9D,
325 MAX77802_REG_LDO15CTRL2 = 0x9E,
326 /* Reserved: 0x9F */
327 MAX77802_REG_LDO17CTRL2 = 0xA0,
328 MAX77802_REG_LDO18CTRL2 = 0xA1,
329 MAX77802_REG_LDO19CTRL2 = 0xA2,
330 MAX77802_REG_LDO20CTRL2 = 0xA3,
331 MAX77802_REG_LDO21CTRL2 = 0xA4,
332 MAX77802_REG_LDO22CTRL2 = 0xA5,
333 MAX77802_REG_LDO23CTRL2 = 0xA6,
334 MAX77802_REG_LDO24CTRL2 = 0xA7,
335 MAX77802_REG_LDO25CTRL2 = 0xA8,
336 MAX77802_REG_LDO26CTRL2 = 0xA9,
337 MAX77802_REG_LDO27CTRL2 = 0xAA,
338 MAX77802_REG_LDO28CTRL2 = 0xAB,
339 MAX77802_REG_LDO29CTRL2 = 0xAC,
340 MAX77802_REG_LDO30CTRL2 = 0xAD,
341 /* Reserved: 0xAE */
342 MAX77802_REG_LDO32CTRL2 = 0xAF,
343 MAX77802_REG_LDO33CTRL2 = 0xB0,
344 MAX77802_REG_LDO34CTRL2 = 0xB1,
345 MAX77802_REG_LDO35CTRL2 = 0xB2,
346 /* Reserved: 0xB3 */
347
348 MAX77802_REG_BBAT_CHG = 0xB4,
349 MAX77802_REG_32KHZ = 0xB5,
350
351 MAX77802_REG_PMIC_END = 0xB6,
352};
353
354enum max77802_rtc_reg {
355 MAX77802_RTC_INT = 0xC0,
356 MAX77802_RTC_INTM = 0xC1,
357 MAX77802_RTC_CONTROLM = 0xC2,
358 MAX77802_RTC_CONTROL = 0xC3,
359 MAX77802_RTC_UPDATE0 = 0xC4,
360 MAX77802_RTC_UPDATE1 = 0xC5,
361 MAX77802_WTSR_SMPL_CNTL = 0xC6,
362 MAX77802_RTC_SEC = 0xC7,
363 MAX77802_RTC_MIN = 0xC8,
364 MAX77802_RTC_HOUR = 0xC9,
365 MAX77802_RTC_WEEKDAY = 0xCA,
366 MAX77802_RTC_MONTH = 0xCB,
367 MAX77802_RTC_YEAR = 0xCC,
368 MAX77802_RTC_DATE = 0xCD,
369 MAX77802_RTC_AE1 = 0xCE,
370 MAX77802_ALARM1_SEC = 0xCF,
371 MAX77802_ALARM1_MIN = 0xD0,
372 MAX77802_ALARM1_HOUR = 0xD1,
373 MAX77802_ALARM1_WEEKDAY = 0xD2,
374 MAX77802_ALARM1_MONTH = 0xD3,
375 MAX77802_ALARM1_YEAR = 0xD4,
376 MAX77802_ALARM1_DATE = 0xD5,
377 MAX77802_RTC_AE2 = 0xD6,
378 MAX77802_ALARM2_SEC = 0xD7,
379 MAX77802_ALARM2_MIN = 0xD8,
380 MAX77802_ALARM2_HOUR = 0xD9,
381 MAX77802_ALARM2_WEEKDAY = 0xDA,
382 MAX77802_ALARM2_MONTH = 0xDB,
383 MAX77802_ALARM2_YEAR = 0xDC,
384 MAX77802_ALARM2_DATE = 0xDD,
385
386 MAX77802_RTC_END = 0xDF,
387};
186 388
187enum max77686_irq_source { 389enum max77686_irq_source {
188 PMIC_INT1 = 0, 390 PMIC_INT1 = 0,
@@ -205,30 +407,46 @@ enum max77686_irq {
205 MAX77686_PMICIRQ_140C, 407 MAX77686_PMICIRQ_140C,
206 MAX77686_PMICIRQ_120C, 408 MAX77686_PMICIRQ_120C,
207 409
208 MAX77686_RTCIRQ_RTC60S, 410 MAX77686_RTCIRQ_RTC60S = 0,
209 MAX77686_RTCIRQ_RTCA1, 411 MAX77686_RTCIRQ_RTCA1,
210 MAX77686_RTCIRQ_RTCA2, 412 MAX77686_RTCIRQ_RTCA2,
211 MAX77686_RTCIRQ_SMPL, 413 MAX77686_RTCIRQ_SMPL,
212 MAX77686_RTCIRQ_RTC1S, 414 MAX77686_RTCIRQ_RTC1S,
213 MAX77686_RTCIRQ_WTSR, 415 MAX77686_RTCIRQ_WTSR,
214
215 MAX77686_IRQ_NR,
216}; 416};
217 417
418#define MAX77686_INT1_PWRONF_MSK BIT(0)
419#define MAX77686_INT1_PWRONR_MSK BIT(1)
420#define MAX77686_INT1_JIGONBF_MSK BIT(2)
421#define MAX77686_INT1_JIGONBR_MSK BIT(3)
422#define MAX77686_INT1_ACOKBF_MSK BIT(4)
423#define MAX77686_INT1_ACOKBR_MSK BIT(5)
424#define MAX77686_INT1_ONKEY1S_MSK BIT(6)
425#define MAX77686_INT1_MRSTB_MSK BIT(7)
426
427#define MAX77686_INT2_140C_MSK BIT(0)
428#define MAX77686_INT2_120C_MSK BIT(1)
429
430#define MAX77686_RTCINT_RTC60S_MSK BIT(0)
431#define MAX77686_RTCINT_RTCA1_MSK BIT(1)
432#define MAX77686_RTCINT_RTCA2_MSK BIT(2)
433#define MAX77686_RTCINT_SMPL_MSK BIT(3)
434#define MAX77686_RTCINT_RTC1S_MSK BIT(4)
435#define MAX77686_RTCINT_WTSR_MSK BIT(5)
436
218struct max77686_dev { 437struct max77686_dev {
219 struct device *dev; 438 struct device *dev;
220 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */ 439 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
221 struct i2c_client *rtc; /* slave addr 0x0c */ 440 struct i2c_client *rtc; /* slave addr 0x0c */
222 441
223 int type; 442 unsigned long type;
224 443
225 struct regmap *regmap; /* regmap for mfd */ 444 struct regmap *regmap; /* regmap for mfd */
226 struct regmap *rtc_regmap; /* regmap for rtc */ 445 struct regmap *rtc_regmap; /* regmap for rtc */
227 446 struct regmap_irq_chip_data *irq_data;
228 struct irq_domain *irq_domain; 447 struct regmap_irq_chip_data *rtc_irq_data;
229 448
230 int irq; 449 int irq;
231 int irq_gpio;
232 bool wakeup; 450 bool wakeup;
233 struct mutex irqlock; 451 struct mutex irqlock;
234 int irq_masks_cur[MAX77686_IRQ_GROUP_NR]; 452 int irq_masks_cur[MAX77686_IRQ_GROUP_NR];
@@ -237,6 +455,7 @@ struct max77686_dev {
237 455
238enum max77686_types { 456enum max77686_types {
239 TYPE_MAX77686, 457 TYPE_MAX77686,
458 TYPE_MAX77802,
240}; 459};
241 460
242extern int max77686_irq_init(struct max77686_dev *max77686); 461extern int max77686_irq_init(struct max77686_dev *max77686);
diff --git a/include/linux/mfd/max77686.h b/include/linux/mfd/max77686.h
index 46c0f320ed76..7e6dc4b2b795 100644
--- a/include/linux/mfd/max77686.h
+++ b/include/linux/mfd/max77686.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * max77686.h - Driver for the Maxim 77686 2 * max77686.h - Driver for the Maxim 77686/802
3 * 3 *
4 * Copyright (C) 2012 Samsung Electrnoics 4 * Copyright (C) 2012 Samsung Electrnoics
5 * Chiwoong Byun <woong.byun@samsung.com> 5 * Chiwoong Byun <woong.byun@samsung.com>
@@ -71,6 +71,54 @@ enum max77686_regulators {
71 MAX77686_REG_MAX, 71 MAX77686_REG_MAX,
72}; 72};
73 73
74/* MAX77802 regulator IDs */
75enum max77802_regulators {
76 MAX77802_BUCK1 = 0,
77 MAX77802_BUCK2,
78 MAX77802_BUCK3,
79 MAX77802_BUCK4,
80 MAX77802_BUCK5,
81 MAX77802_BUCK6,
82 MAX77802_BUCK7,
83 MAX77802_BUCK8,
84 MAX77802_BUCK9,
85 MAX77802_BUCK10,
86 MAX77802_LDO1,
87 MAX77802_LDO2,
88 MAX77802_LDO3,
89 MAX77802_LDO4,
90 MAX77802_LDO5,
91 MAX77802_LDO6,
92 MAX77802_LDO7,
93 MAX77802_LDO8,
94 MAX77802_LDO9,
95 MAX77802_LDO10,
96 MAX77802_LDO11,
97 MAX77802_LDO12,
98 MAX77802_LDO13,
99 MAX77802_LDO14,
100 MAX77802_LDO15,
101 MAX77802_LDO17,
102 MAX77802_LDO18,
103 MAX77802_LDO19,
104 MAX77802_LDO20,
105 MAX77802_LDO21,
106 MAX77802_LDO23,
107 MAX77802_LDO24,
108 MAX77802_LDO25,
109 MAX77802_LDO26,
110 MAX77802_LDO27,
111 MAX77802_LDO28,
112 MAX77802_LDO29,
113 MAX77802_LDO30,
114 MAX77802_LDO32,
115 MAX77802_LDO33,
116 MAX77802_LDO34,
117 MAX77802_LDO35,
118
119 MAX77802_REG_MAX,
120};
121
74struct max77686_regulator_data { 122struct max77686_regulator_data {
75 int id; 123 int id;
76 struct regulator_init_data *initdata; 124 struct regulator_init_data *initdata;
@@ -83,14 +131,19 @@ enum max77686_opmode {
83 MAX77686_OPMODE_STANDBY, 131 MAX77686_OPMODE_STANDBY,
84}; 132};
85 133
134enum max77802_opmode {
135 MAX77802_OPMODE_OFF,
136 MAX77802_OPMODE_STANDBY,
137 MAX77802_OPMODE_LP,
138 MAX77802_OPMODE_NORMAL,
139};
140
86struct max77686_opmode_data { 141struct max77686_opmode_data {
87 int id; 142 int id;
88 int mode; 143 int mode;
89}; 144};
90 145
91struct max77686_platform_data { 146struct max77686_platform_data {
92 /* IRQ */
93 int irq_gpio;
94 int ono; 147 int ono;
95 int wakeup; 148 int wakeup;
96 149
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index c466ff3e16b8..582e67f34054 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -46,7 +46,7 @@ enum max77693_pmic_reg {
46 MAX77693_LED_REG_VOUT_FLASH2 = 0x0C, 46 MAX77693_LED_REG_VOUT_FLASH2 = 0x0C,
47 MAX77693_LED_REG_FLASH_INT = 0x0E, 47 MAX77693_LED_REG_FLASH_INT = 0x0E,
48 MAX77693_LED_REG_FLASH_INT_MASK = 0x0F, 48 MAX77693_LED_REG_FLASH_INT_MASK = 0x0F,
49 MAX77693_LED_REG_FLASH_INT_STATUS = 0x10, 49 MAX77693_LED_REG_FLASH_STATUS = 0x10,
50 50
51 MAX77693_PMIC_REG_PMIC_ID1 = 0x20, 51 MAX77693_PMIC_REG_PMIC_ID1 = 0x20,
52 MAX77693_PMIC_REG_PMIC_ID2 = 0x21, 52 MAX77693_PMIC_REG_PMIC_ID2 = 0x21,
@@ -85,6 +85,65 @@ enum max77693_pmic_reg {
85 MAX77693_PMIC_REG_END, 85 MAX77693_PMIC_REG_END,
86}; 86};
87 87
88/* MAX77693 ITORCH register */
89#define TORCH_IOUT1_SHIFT 0
90#define TORCH_IOUT2_SHIFT 4
91#define TORCH_IOUT_MIN 15625
92#define TORCH_IOUT_MAX 250000
93#define TORCH_IOUT_STEP 15625
94
95/* MAX77693 IFLASH1 and IFLASH2 registers */
96#define FLASH_IOUT_MIN 15625
97#define FLASH_IOUT_MAX_1LED 1000000
98#define FLASH_IOUT_MAX_2LEDS 625000
99#define FLASH_IOUT_STEP 15625
100
101/* MAX77693 TORCH_TIMER register */
102#define TORCH_TMR_NO_TIMER 0x40
103#define TORCH_TIMEOUT_MIN 262000
104#define TORCH_TIMEOUT_MAX 15728000
105
106/* MAX77693 FLASH_TIMER register */
107#define FLASH_TMR_LEVEL 0x80
108#define FLASH_TIMEOUT_MIN 62500
109#define FLASH_TIMEOUT_MAX 1000000
110#define FLASH_TIMEOUT_STEP 62500
111
112/* MAX77693 FLASH_EN register */
113#define FLASH_EN_OFF 0x0
114#define FLASH_EN_FLASH 0x1
115#define FLASH_EN_TORCH 0x2
116#define FLASH_EN_ON 0x3
117#define FLASH_EN_SHIFT(x) (6 - ((x) - 1) * 2)
118#define TORCH_EN_SHIFT(x) (2 - ((x) - 1) * 2)
119
120/* MAX77693 MAX_FLASH1 register */
121#define MAX_FLASH1_MAX_FL_EN 0x80
122#define MAX_FLASH1_VSYS_MIN 2400
123#define MAX_FLASH1_VSYS_MAX 3400
124#define MAX_FLASH1_VSYS_STEP 33
125
126/* MAX77693 VOUT_CNTL register */
127#define FLASH_BOOST_FIXED 0x04
128#define FLASH_BOOST_LEDNUM_2 0x80
129
130/* MAX77693 VOUT_FLASH1 register */
131#define FLASH_VOUT_MIN 3300
132#define FLASH_VOUT_MAX 5500
133#define FLASH_VOUT_STEP 25
134#define FLASH_VOUT_RMIN 0x0c
135
136/* MAX77693 FLASH_STATUS register */
137#define FLASH_STATUS_FLASH_ON BIT(3)
138#define FLASH_STATUS_TORCH_ON BIT(2)
139
140/* MAX77693 FLASH_INT register */
141#define FLASH_INT_FLED2_OPEN BIT(0)
142#define FLASH_INT_FLED2_SHORT BIT(1)
143#define FLASH_INT_FLED1_OPEN BIT(2)
144#define FLASH_INT_FLED1_SHORT BIT(3)
145#define FLASH_INT_OVER_CURRENT BIT(4)
146
88/* MAX77693 CHG_CNFG_00 register */ 147/* MAX77693 CHG_CNFG_00 register */
89#define CHG_CNFG_00_CHG_MASK 0x1 148#define CHG_CNFG_00_CHG_MASK 0x1
90#define CHG_CNFG_00_BUCK_MASK 0x4 149#define CHG_CNFG_00_BUCK_MASK 0x4
@@ -251,6 +310,15 @@ enum max77693_haptic_reg {
251 MAX77693_HAPTIC_REG_END, 310 MAX77693_HAPTIC_REG_END,
252}; 311};
253 312
313/* max77693-pmic LSCNFG configuraton register */
314#define MAX77693_PMIC_LOW_SYS_MASK 0x80
315#define MAX77693_PMIC_LOW_SYS_SHIFT 7
316
317/* max77693-haptic configuration register */
318#define MAX77693_CONFIG2_MODE 7
319#define MAX77693_CONFIG2_MEN 6
320#define MAX77693_CONFIG2_HTYP 5
321
254enum max77693_irq_source { 322enum max77693_irq_source {
255 LED_INT = 0, 323 LED_INT = 0,
256 TOPSYS_INT, 324 TOPSYS_INT,
@@ -262,6 +330,13 @@ enum max77693_irq_source {
262 MAX77693_IRQ_GROUP_NR, 330 MAX77693_IRQ_GROUP_NR,
263}; 331};
264 332
333#define SRC_IRQ_CHARGER BIT(0)
334#define SRC_IRQ_TOP BIT(1)
335#define SRC_IRQ_FLASH BIT(2)
336#define SRC_IRQ_MUIC BIT(3)
337#define SRC_IRQ_ALL (SRC_IRQ_CHARGER | SRC_IRQ_TOP \
338 | SRC_IRQ_FLASH | SRC_IRQ_MUIC)
339
265#define LED_IRQ_FLED2_OPEN BIT(0) 340#define LED_IRQ_FLED2_OPEN BIT(0)
266#define LED_IRQ_FLED2_SHORT BIT(1) 341#define LED_IRQ_FLED2_SHORT BIT(1)
267#define LED_IRQ_FLED1_OPEN BIT(2) 342#define LED_IRQ_FLED1_OPEN BIT(2)
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index 3f3dc45f93ee..f0b6585cd874 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -63,6 +63,45 @@ struct max77693_muic_platform_data {
63 int path_uart; 63 int path_uart;
64}; 64};
65 65
66/* MAX77693 led flash */
67
68/* triggers */
69enum max77693_led_trigger {
70 MAX77693_LED_TRIG_OFF,
71 MAX77693_LED_TRIG_FLASH,
72 MAX77693_LED_TRIG_TORCH,
73 MAX77693_LED_TRIG_EXT,
74 MAX77693_LED_TRIG_SOFT,
75};
76
77/* trigger types */
78enum max77693_led_trigger_type {
79 MAX77693_LED_TRIG_TYPE_EDGE,
80 MAX77693_LED_TRIG_TYPE_LEVEL,
81};
82
83/* boost modes */
84enum max77693_led_boost_mode {
85 MAX77693_LED_BOOST_NONE,
86 MAX77693_LED_BOOST_ADAPTIVE,
87 MAX77693_LED_BOOST_FIXED,
88};
89
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 */
104
66struct max77693_platform_data { 105struct max77693_platform_data {
67 /* regulator data */ 106 /* regulator data */
68 struct max77693_regulator_data *regulators; 107 struct max77693_regulator_data *regulators;
@@ -70,5 +109,6 @@ struct max77693_platform_data {
70 109
71 /* muic data */ 110 /* muic data */
72 struct max77693_muic_platform_data *muic_data; 111 struct max77693_muic_platform_data *muic_data;
112 struct max77693_led_platform_data *led_data;
73}; 113};
74#endif /* __LINUX_MFD_MAX77693_H */ 114#endif /* __LINUX_MFD_MAX77693_H */
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
index a8eeda773a7b..4ff6137d8d67 100644
--- a/include/linux/mfd/mc13783.h
+++ b/include/linux/mfd/mc13783.h
@@ -86,6 +86,5 @@
86#define MC13783_IRQ_HSL 43 86#define MC13783_IRQ_HSL 43
87#define MC13783_IRQ_ALSPTH 44 87#define MC13783_IRQ_ALSPTH 44
88#define MC13783_IRQ_AHSSHORT 45 88#define MC13783_IRQ_AHSSHORT 45
89#define MC13783_NUM_IRQ MC13XXX_NUM_IRQ
90 89
91#endif /* ifndef __LINUX_MFD_MC13783_H */ 90#endif /* ifndef __LINUX_MFD_MC13783_H */
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index d63b1d309106..638222e43e48 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -23,15 +23,10 @@ int mc13xxx_reg_rmw(struct mc13xxx *mc13xxx, unsigned int offset,
23 23
24int mc13xxx_irq_request(struct mc13xxx *mc13xxx, int irq, 24int mc13xxx_irq_request(struct mc13xxx *mc13xxx, int irq,
25 irq_handler_t handler, const char *name, void *dev); 25 irq_handler_t handler, const char *name, void *dev);
26int mc13xxx_irq_request_nounmask(struct mc13xxx *mc13xxx, int irq,
27 irq_handler_t handler, const char *name, void *dev);
28int mc13xxx_irq_free(struct mc13xxx *mc13xxx, int irq, void *dev); 26int mc13xxx_irq_free(struct mc13xxx *mc13xxx, int irq, void *dev);
29 27
30int mc13xxx_irq_mask(struct mc13xxx *mc13xxx, int irq);
31int mc13xxx_irq_unmask(struct mc13xxx *mc13xxx, int irq);
32int mc13xxx_irq_status(struct mc13xxx *mc13xxx, int irq, 28int mc13xxx_irq_status(struct mc13xxx *mc13xxx, int irq,
33 int *enabled, int *pending); 29 int *enabled, int *pending);
34int mc13xxx_irq_ack(struct mc13xxx *mc13xxx, int irq);
35 30
36int mc13xxx_get_flags(struct mc13xxx *mc13xxx); 31int mc13xxx_get_flags(struct mc13xxx *mc13xxx);
37 32
@@ -39,6 +34,22 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
39 unsigned int mode, unsigned int channel, 34 unsigned int mode, unsigned int channel,
40 u8 ato, bool atox, unsigned int *sample); 35 u8 ato, bool atox, unsigned int *sample);
41 36
37/* Deprecated calls */
38static inline int mc13xxx_irq_ack(struct mc13xxx *mc13xxx, int irq)
39{
40 return 0;
41}
42
43static inline int mc13xxx_irq_request_nounmask(struct mc13xxx *mc13xxx, int irq,
44 irq_handler_t handler,
45 const char *name, void *dev)
46{
47 return mc13xxx_irq_request(mc13xxx, irq, handler, name, dev);
48}
49
50int mc13xxx_irq_mask(struct mc13xxx *mc13xxx, int irq);
51int mc13xxx_irq_unmask(struct mc13xxx *mc13xxx, int irq);
52
42#define MC13783_AUDIO_RX0 36 53#define MC13783_AUDIO_RX0 36
43#define MC13783_AUDIO_RX1 37 54#define MC13783_AUDIO_RX1 37
44#define MC13783_AUDIO_TX 38 55#define MC13783_AUDIO_TX 38
@@ -68,8 +79,6 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
68#define MC13XXX_IRQ_THWARNH 37 79#define MC13XXX_IRQ_THWARNH 37
69#define MC13XXX_IRQ_CLK 38 80#define MC13XXX_IRQ_CLK 38
70 81
71#define MC13XXX_NUM_IRQ 46
72
73struct regulator_init_data; 82struct regulator_init_data;
74 83
75struct mc13xxx_regulator_init_data { 84struct mc13xxx_regulator_init_data {
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
new file mode 100644
index 000000000000..fb09312d854b
--- /dev/null
+++ b/include/linux/mfd/rk808.h
@@ -0,0 +1,196 @@
1/*
2 * rk808.h for Rockchip RK808
3 *
4 * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
5 *
6 * Author: Chris Zhong <zyw@rock-chips.com>
7 * Author: Zhang Qing <zhangqing@rock-chips.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms and conditions of the GNU General Public License,
11 * version 2, as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 */
18
19#ifndef __LINUX_REGULATOR_rk808_H
20#define __LINUX_REGULATOR_rk808_H
21
22#include <linux/regulator/machine.h>
23#include <linux/regmap.h>
24
25/*
26 * rk808 Global Register Map.
27 */
28
29#define RK808_DCDC1 0 /* (0+RK808_START) */
30#define RK808_LDO1 4 /* (4+RK808_START) */
31#define RK808_NUM_REGULATORS 14
32
33enum rk808_reg {
34 RK808_ID_DCDC1,
35 RK808_ID_DCDC2,
36 RK808_ID_DCDC3,
37 RK808_ID_DCDC4,
38 RK808_ID_LDO1,
39 RK808_ID_LDO2,
40 RK808_ID_LDO3,
41 RK808_ID_LDO4,
42 RK808_ID_LDO5,
43 RK808_ID_LDO6,
44 RK808_ID_LDO7,
45 RK808_ID_LDO8,
46 RK808_ID_SWITCH1,
47 RK808_ID_SWITCH2,
48};
49
50#define RK808_SECONDS_REG 0x00
51#define RK808_MINUTES_REG 0x01
52#define RK808_HOURS_REG 0x02
53#define RK808_DAYS_REG 0x03
54#define RK808_MONTHS_REG 0x04
55#define RK808_YEARS_REG 0x05
56#define RK808_WEEKS_REG 0x06
57#define RK808_ALARM_SECONDS_REG 0x08
58#define RK808_ALARM_MINUTES_REG 0x09
59#define RK808_ALARM_HOURS_REG 0x0a
60#define RK808_ALARM_DAYS_REG 0x0b
61#define RK808_ALARM_MONTHS_REG 0x0c
62#define RK808_ALARM_YEARS_REG 0x0d
63#define RK808_RTC_CTRL_REG 0x10
64#define RK808_RTC_STATUS_REG 0x11
65#define RK808_RTC_INT_REG 0x12
66#define RK808_RTC_COMP_LSB_REG 0x13
67#define RK808_RTC_COMP_MSB_REG 0x14
68#define RK808_CLK32OUT_REG 0x20
69#define RK808_VB_MON_REG 0x21
70#define RK808_THERMAL_REG 0x22
71#define RK808_DCDC_EN_REG 0x23
72#define RK808_LDO_EN_REG 0x24
73#define RK808_SLEEP_SET_OFF_REG1 0x25
74#define RK808_SLEEP_SET_OFF_REG2 0x26
75#define RK808_DCDC_UV_STS_REG 0x27
76#define RK808_DCDC_UV_ACT_REG 0x28
77#define RK808_LDO_UV_STS_REG 0x29
78#define RK808_LDO_UV_ACT_REG 0x2a
79#define RK808_DCDC_PG_REG 0x2b
80#define RK808_LDO_PG_REG 0x2c
81#define RK808_VOUT_MON_TDB_REG 0x2d
82#define RK808_BUCK1_CONFIG_REG 0x2e
83#define RK808_BUCK1_ON_VSEL_REG 0x2f
84#define RK808_BUCK1_SLP_VSEL_REG 0x30
85#define RK808_BUCK1_DVS_VSEL_REG 0x31
86#define RK808_BUCK2_CONFIG_REG 0x32
87#define RK808_BUCK2_ON_VSEL_REG 0x33
88#define RK808_BUCK2_SLP_VSEL_REG 0x34
89#define RK808_BUCK2_DVS_VSEL_REG 0x35
90#define RK808_BUCK3_CONFIG_REG 0x36
91#define RK808_BUCK4_CONFIG_REG 0x37
92#define RK808_BUCK4_ON_VSEL_REG 0x38
93#define RK808_BUCK4_SLP_VSEL_REG 0x39
94#define RK808_BOOST_CONFIG_REG 0x3a
95#define RK808_LDO1_ON_VSEL_REG 0x3b
96#define RK808_LDO1_SLP_VSEL_REG 0x3c
97#define RK808_LDO2_ON_VSEL_REG 0x3d
98#define RK808_LDO2_SLP_VSEL_REG 0x3e
99#define RK808_LDO3_ON_VSEL_REG 0x3f
100#define RK808_LDO3_SLP_VSEL_REG 0x40
101#define RK808_LDO4_ON_VSEL_REG 0x41
102#define RK808_LDO4_SLP_VSEL_REG 0x42
103#define RK808_LDO5_ON_VSEL_REG 0x43
104#define RK808_LDO5_SLP_VSEL_REG 0x44
105#define RK808_LDO6_ON_VSEL_REG 0x45
106#define RK808_LDO6_SLP_VSEL_REG 0x46
107#define RK808_LDO7_ON_VSEL_REG 0x47
108#define RK808_LDO7_SLP_VSEL_REG 0x48
109#define RK808_LDO8_ON_VSEL_REG 0x49
110#define RK808_LDO8_SLP_VSEL_REG 0x4a
111#define RK808_DEVCTRL_REG 0x4b
112#define RK808_INT_STS_REG1 0x4c
113#define RK808_INT_STS_MSK_REG1 0x4d
114#define RK808_INT_STS_REG2 0x4e
115#define RK808_INT_STS_MSK_REG2 0x4f
116#define RK808_IO_POL_REG 0x50
117
118/* IRQ Definitions */
119#define RK808_IRQ_VOUT_LO 0
120#define RK808_IRQ_VB_LO 1
121#define RK808_IRQ_PWRON 2
122#define RK808_IRQ_PWRON_LP 3
123#define RK808_IRQ_HOTDIE 4
124#define RK808_IRQ_RTC_ALARM 5
125#define RK808_IRQ_RTC_PERIOD 6
126#define RK808_IRQ_PLUG_IN_INT 7
127#define RK808_IRQ_PLUG_OUT_INT 8
128#define RK808_NUM_IRQ 9
129
130#define RK808_IRQ_VOUT_LO_MSK BIT(0)
131#define RK808_IRQ_VB_LO_MSK BIT(1)
132#define RK808_IRQ_PWRON_MSK BIT(2)
133#define RK808_IRQ_PWRON_LP_MSK BIT(3)
134#define RK808_IRQ_HOTDIE_MSK BIT(4)
135#define RK808_IRQ_RTC_ALARM_MSK BIT(5)
136#define RK808_IRQ_RTC_PERIOD_MSK BIT(6)
137#define RK808_IRQ_PLUG_IN_INT_MSK BIT(0)
138#define RK808_IRQ_PLUG_OUT_INT_MSK BIT(1)
139
140#define RK808_VBAT_LOW_2V8 0x00
141#define RK808_VBAT_LOW_2V9 0x01
142#define RK808_VBAT_LOW_3V0 0x02
143#define RK808_VBAT_LOW_3V1 0x03
144#define RK808_VBAT_LOW_3V2 0x04
145#define RK808_VBAT_LOW_3V3 0x05
146#define RK808_VBAT_LOW_3V4 0x06
147#define RK808_VBAT_LOW_3V5 0x07
148#define VBAT_LOW_VOL_MASK (0x07 << 0)
149#define EN_VABT_LOW_SHUT_DOWN (0x00 << 4)
150#define EN_VBAT_LOW_IRQ (0x1 << 4)
151#define VBAT_LOW_ACT_MASK (0x1 << 4)
152
153#define BUCK_ILMIN_MASK (7 << 0)
154#define BOOST_ILMIN_MASK (7 << 0)
155#define BUCK1_RATE_MASK (3 << 3)
156#define BUCK2_RATE_MASK (3 << 3)
157#define MASK_ALL 0xff
158
159#define SWITCH2_EN BIT(6)
160#define SWITCH1_EN BIT(5)
161#define DEV_OFF_RST BIT(3)
162
163#define VB_LO_ACT BIT(4)
164#define VB_LO_SEL_3500MV (7 << 0)
165
166#define VOUT_LO_INT BIT(0)
167#define CLK32KOUT2_EN BIT(0)
168
169enum {
170 BUCK_ILMIN_50MA,
171 BUCK_ILMIN_100MA,
172 BUCK_ILMIN_150MA,
173 BUCK_ILMIN_200MA,
174 BUCK_ILMIN_250MA,
175 BUCK_ILMIN_300MA,
176 BUCK_ILMIN_350MA,
177 BUCK_ILMIN_400MA,
178};
179
180enum {
181 BOOST_ILMIN_75MA,
182 BOOST_ILMIN_100MA,
183 BOOST_ILMIN_125MA,
184 BOOST_ILMIN_150MA,
185 BOOST_ILMIN_175MA,
186 BOOST_ILMIN_200MA,
187 BOOST_ILMIN_225MA,
188 BOOST_ILMIN_250MA,
189};
190
191struct rk808 {
192 struct i2c_client *i2c;
193 struct regmap_irq_chip_data *irq_data;
194 struct regmap *regmap;
195};
196#endif /* __LINUX_REGULATOR_rk808_H */
diff --git a/include/linux/mfd/rn5t618.h b/include/linux/mfd/rn5t618.h
new file mode 100644
index 000000000000..c72d5344f3b3
--- /dev/null
+++ b/include/linux/mfd/rn5t618.h
@@ -0,0 +1,228 @@
1/*
2 * MFD core driver for Ricoh RN5T618 PMIC
3 *
4 * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
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 * You should have received a copy of the GNU General Public License
11 * along with this program. If not, see <http://www.gnu.org/licenses/>.
12 */
13
14#ifndef __LINUX_MFD_RN5T618_H
15#define __LINUX_MFD_RN5T618_H
16
17#include <linux/regmap.h>
18
19#define RN5T618_LSIVER 0x00
20#define RN5T618_OTPVER 0x01
21#define RN5T618_IODAC 0x02
22#define RN5T618_VINDAC 0x03
23#define RN5T618_CPUCNT 0x06
24#define RN5T618_PSWR 0x07
25#define RN5T618_PONHIS 0x09
26#define RN5T618_POFFHIS 0x0a
27#define RN5T618_WATCHDOG 0x0b
28#define RN5T618_WATCHDOGCNT 0x0c
29#define RN5T618_PWRFUNC 0x0d
30#define RN5T618_SLPCNT 0x0e
31#define RN5T618_REPCNT 0x0f
32#define RN5T618_PWRONTIMSET 0x10
33#define RN5T618_NOETIMSETCNT 0x11
34#define RN5T618_PWRIREN 0x12
35#define RN5T618_PWRIRQ 0x13
36#define RN5T618_PWRMON 0x14
37#define RN5T618_PWRIRSEL 0x15
38#define RN5T618_DC1_SLOT 0x16
39#define RN5T618_DC2_SLOT 0x17
40#define RN5T618_DC3_SLOT 0x18
41#define RN5T618_LDO1_SLOT 0x1b
42#define RN5T618_LDO2_SLOT 0x1c
43#define RN5T618_LDO3_SLOT 0x1d
44#define RN5T618_LDO4_SLOT 0x1e
45#define RN5T618_LDO5_SLOT 0x1f
46#define RN5T618_PSO0_SLOT 0x25
47#define RN5T618_PSO1_SLOT 0x26
48#define RN5T618_PSO2_SLOT 0x27
49#define RN5T618_PSO3_SLOT 0x28
50#define RN5T618_LDORTC1_SLOT 0x2a
51#define RN5T618_DC1CTL 0x2c
52#define RN5T618_DC1CTL2 0x2d
53#define RN5T618_DC2CTL 0x2e
54#define RN5T618_DC2CTL2 0x2f
55#define RN5T618_DC3CTL 0x30
56#define RN5T618_DC3CTL2 0x31
57#define RN5T618_DC1DAC 0x36
58#define RN5T618_DC2DAC 0x37
59#define RN5T618_DC3DAC 0x38
60#define RN5T618_DC1DAC_SLP 0x3b
61#define RN5T618_DC2DAC_SLP 0x3c
62#define RN5T618_DC3DAC_SLP 0x3d
63#define RN5T618_DCIREN 0x40
64#define RN5T618_DCIRQ 0x41
65#define RN5T618_DCIRMON 0x42
66#define RN5T618_LDOEN1 0x44
67#define RN5T618_LDOEN2 0x45
68#define RN5T618_LDODIS 0x46
69#define RN5T618_LDO1DAC 0x4c
70#define RN5T618_LDO2DAC 0x4d
71#define RN5T618_LDO3DAC 0x4e
72#define RN5T618_LDO4DAC 0x4f
73#define RN5T618_LDO5DAC 0x50
74#define RN5T618_LDORTCDAC 0x56
75#define RN5T618_LDORTC2DAC 0x57
76#define RN5T618_LDO1DAC_SLP 0x58
77#define RN5T618_LDO2DAC_SLP 0x59
78#define RN5T618_LDO3DAC_SLP 0x5a
79#define RN5T618_LDO4DAC_SLP 0x5b
80#define RN5T618_LDO5DAC_SLP 0x5c
81#define RN5T618_ADCCNT1 0x64
82#define RN5T618_ADCCNT2 0x65
83#define RN5T618_ADCCNT3 0x66
84#define RN5T618_ILIMDATAH 0x68
85#define RN5T618_ILIMDATAL 0x69
86#define RN5T618_VBATDATAH 0x6a
87#define RN5T618_VBATDATAL 0x6b
88#define RN5T618_VADPDATAH 0x6c
89#define RN5T618_VADPDATAL 0x6d
90#define RN5T618_VUSBDATAH 0x6e
91#define RN5T618_VUSBDATAL 0x6f
92#define RN5T618_VSYSDATAH 0x70
93#define RN5T618_VSYSDATAL 0x71
94#define RN5T618_VTHMDATAH 0x72
95#define RN5T618_VTHMDATAL 0x73
96#define RN5T618_AIN1DATAH 0x74
97#define RN5T618_AIN1DATAL 0x75
98#define RN5T618_AIN0DATAH 0x76
99#define RN5T618_AIN0DATAL 0x77
100#define RN5T618_ILIMTHL 0x78
101#define RN5T618_ILIMTHH 0x79
102#define RN5T618_VBATTHL 0x7a
103#define RN5T618_VBATTHH 0x7b
104#define RN5T618_VADPTHL 0x7c
105#define RN5T618_VADPTHH 0x7d
106#define RN5T618_VUSBTHL 0x7e
107#define RN5T618_VUSBTHH 0x7f
108#define RN5T618_VSYSTHL 0x80
109#define RN5T618_VSYSTHH 0x81
110#define RN5T618_VTHMTHL 0x82
111#define RN5T618_VTHMTHH 0x83
112#define RN5T618_AIN1THL 0x84
113#define RN5T618_AIN1THH 0x85
114#define RN5T618_AIN0THL 0x86
115#define RN5T618_AIN0THH 0x87
116#define RN5T618_EN_ADCIR1 0x88
117#define RN5T618_EN_ADCIR2 0x89
118#define RN5T618_EN_ADCIR3 0x8a
119#define RN5T618_IR_ADC1 0x8c
120#define RN5T618_IR_ADC2 0x8d
121#define RN5T618_IR_ADC3 0x8e
122#define RN5T618_IOSEL 0x90
123#define RN5T618_IOOUT 0x91
124#define RN5T618_GPEDGE1 0x92
125#define RN5T618_GPEDGE2 0x93
126#define RN5T618_EN_GPIR 0x94
127#define RN5T618_IR_GPR 0x95
128#define RN5T618_IR_GPF 0x96
129#define RN5T618_MON_IOIN 0x97
130#define RN5T618_GPLED_FUNC 0x98
131#define RN5T618_INTPOL 0x9c
132#define RN5T618_INTEN 0x9d
133#define RN5T618_INTMON 0x9e
134#define RN5T618_PREVINDAC 0xb0
135#define RN5T618_BATDAC 0xb1
136#define RN5T618_CHGCTL1 0xb3
137#define RN5T618_CHGCTL2 0xb4
138#define RN5T618_VSYSSET 0xb5
139#define RN5T618_REGISET1 0xb6
140#define RN5T618_REGISET2 0xb7
141#define RN5T618_CHGISET 0xb8
142#define RN5T618_TIMSET 0xb9
143#define RN5T618_BATSET1 0xba
144#define RN5T618_BATSET2 0xbb
145#define RN5T618_DIESET 0xbc
146#define RN5T618_CHGSTATE 0xbd
147#define RN5T618_CHGCTRL_IRFMASK 0xbe
148#define RN5T618_CHGSTAT_IRFMASK1 0xbf
149#define RN5T618_CHGSTAT_IRFMASK2 0xc0
150#define RN5T618_CHGERR_IRFMASK 0xc1
151#define RN5T618_CHGCTRL_IRR 0xc2
152#define RN5T618_CHGSTAT_IRR1 0xc3
153#define RN5T618_CHGSTAT_IRR2 0xc4
154#define RN5T618_CHGERR_IRR 0xc5
155#define RN5T618_CHGCTRL_MONI 0xc6
156#define RN5T618_CHGSTAT_MONI1 0xc7
157#define RN5T618_CHGSTAT_MONI2 0xc8
158#define RN5T618_CHGERR_MONI 0xc9
159#define RN5T618_CHGCTRL_DETMOD1 0xca
160#define RN5T618_CHGCTRL_DETMOD2 0xcb
161#define RN5T618_CHGSTAT_DETMOD1 0xcc
162#define RN5T618_CHGSTAT_DETMOD2 0xcd
163#define RN5T618_CHGSTAT_DETMOD3 0xce
164#define RN5T618_CHGERR_DETMOD1 0xcf
165#define RN5T618_CHGERR_DETMOD2 0xd0
166#define RN5T618_CHGOSCCTL 0xd4
167#define RN5T618_CHGOSCSCORESET1 0xd5
168#define RN5T618_CHGOSCSCORESET2 0xd6
169#define RN5T618_CHGOSCSCORESET3 0xd7
170#define RN5T618_CHGOSCFREQSET1 0xd8
171#define RN5T618_CHGOSCFREQSET2 0xd9
172#define RN5T618_CONTROL 0xe0
173#define RN5T618_SOC 0xe1
174#define RN5T618_RE_CAP_H 0xe2
175#define RN5T618_RE_CAP_L 0xe3
176#define RN5T618_FA_CAP_H 0xe4
177#define RN5T618_FA_CAP_L 0xe5
178#define RN5T618_AGE 0xe6
179#define RN5T618_TT_EMPTY_H 0xe7
180#define RN5T618_TT_EMPTY_L 0xe8
181#define RN5T618_TT_FULL_H 0xe9
182#define RN5T618_TT_FULL_L 0xea
183#define RN5T618_VOLTAGE_1 0xeb
184#define RN5T618_VOLTAGE_0 0xec
185#define RN5T618_TEMP_1 0xed
186#define RN5T618_TEMP_0 0xee
187#define RN5T618_CC_CTRL 0xef
188#define RN5T618_CC_COUNT2 0xf0
189#define RN5T618_CC_COUNT1 0xf1
190#define RN5T618_CC_COUNT0 0xf2
191#define RN5T618_CC_SUMREG3 0xf3
192#define RN5T618_CC_SUMREG2 0xf4
193#define RN5T618_CC_SUMREG1 0xf5
194#define RN5T618_CC_SUMREG0 0xf6
195#define RN5T618_CC_OFFREG1 0xf7
196#define RN5T618_CC_OFFREG0 0xf8
197#define RN5T618_CC_GAINREG1 0xf9
198#define RN5T618_CC_GAINREG0 0xfa
199#define RN5T618_CC_AVEREG1 0xfb
200#define RN5T618_CC_AVEREG0 0xfc
201#define RN5T618_MAX_REG 0xfc
202
203#define RN5T618_REPCNT_REPWRON BIT(0)
204#define RN5T618_SLPCNT_SWPWROFF BIT(0)
205#define RN5T618_WATCHDOG_WDOGEN BIT(2)
206#define RN5T618_WATCHDOG_WDOGTIM_M (BIT(0) | BIT(1))
207#define RN5T618_WATCHDOG_WDOGTIM_S 0
208#define RN5T618_PWRIRQ_IR_WDOG BIT(6)
209
210enum {
211 RN5T618_DCDC1,
212 RN5T618_DCDC2,
213 RN5T618_DCDC3,
214 RN5T618_LDO1,
215 RN5T618_LDO2,
216 RN5T618_LDO3,
217 RN5T618_LDO4,
218 RN5T618_LDO5,
219 RN5T618_LDORTC1,
220 RN5T618_LDORTC2,
221 RN5T618_REG_NUM,
222};
223
224struct rn5t618 {
225 struct regmap *regmap;
226};
227
228#endif /* __LINUX_MFD_RN5T618_H */
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index a3835976f7c6..74346d5e7899 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -943,6 +943,12 @@ void rtsx_pci_send_cmd_no_wait(struct rtsx_pcr *pcr);
943int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout); 943int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout);
944int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist, 944int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist,
945 int num_sg, bool read, int timeout); 945 int num_sg, bool read, int timeout);
946int rtsx_pci_dma_map_sg(struct rtsx_pcr *pcr, struct scatterlist *sglist,
947 int num_sg, bool read);
948void rtsx_pci_dma_unmap_sg(struct rtsx_pcr *pcr, struct scatterlist *sglist,
949 int num_sg, bool read);
950int rtsx_pci_dma_transfer(struct rtsx_pcr *pcr, struct scatterlist *sglist,
951 int count, bool read, int timeout);
946int rtsx_pci_read_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len); 952int rtsx_pci_read_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len);
947int rtsx_pci_write_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len); 953int rtsx_pci_write_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len);
948int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card); 954int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card);
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 47d84242940b..1825edacbda7 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -14,6 +14,27 @@
14#ifndef __LINUX_MFD_SEC_CORE_H 14#ifndef __LINUX_MFD_SEC_CORE_H
15#define __LINUX_MFD_SEC_CORE_H 15#define __LINUX_MFD_SEC_CORE_H
16 16
17/* Macros to represent minimum voltages for LDO/BUCK */
18#define MIN_3000_MV 3000000
19#define MIN_2500_MV 2500000
20#define MIN_2000_MV 2000000
21#define MIN_1800_MV 1800000
22#define MIN_1500_MV 1500000
23#define MIN_1400_MV 1400000
24#define MIN_1000_MV 1000000
25
26#define MIN_900_MV 900000
27#define MIN_850_MV 850000
28#define MIN_800_MV 800000
29#define MIN_750_MV 750000
30#define MIN_600_MV 600000
31
32/* Macros to represent steps for LDO/BUCK */
33#define STEP_50_MV 50000
34#define STEP_25_MV 25000
35#define STEP_12_5_MV 12500
36#define STEP_6_25_MV 6250
37
17enum sec_device_type { 38enum sec_device_type {
18 S5M8751X, 39 S5M8751X,
19 S5M8763X, 40 S5M8763X,
@@ -21,6 +42,7 @@ enum sec_device_type {
21 S2MPA01, 42 S2MPA01,
22 S2MPS11X, 43 S2MPS11X,
23 S2MPS14X, 44 S2MPS14X,
45 S2MPU02,
24}; 46};
25 47
26/** 48/**
diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/irq.h
index 1224f447356b..f35af7361b60 100644
--- a/include/linux/mfd/samsung/irq.h
+++ b/include/linux/mfd/samsung/irq.h
@@ -129,6 +129,30 @@ enum s2mps14_irq {
129 S2MPS14_IRQ_NR, 129 S2MPS14_IRQ_NR,
130}; 130};
131 131
132enum s2mpu02_irq {
133 S2MPU02_IRQ_PWRONF,
134 S2MPU02_IRQ_PWRONR,
135 S2MPU02_IRQ_JIGONBF,
136 S2MPU02_IRQ_JIGONBR,
137 S2MPU02_IRQ_ACOKBF,
138 S2MPU02_IRQ_ACOKBR,
139 S2MPU02_IRQ_PWRON1S,
140 S2MPU02_IRQ_MRB,
141
142 S2MPU02_IRQ_RTC60S,
143 S2MPU02_IRQ_RTCA1,
144 S2MPU02_IRQ_RTCA0,
145 S2MPU02_IRQ_SMPL,
146 S2MPU02_IRQ_RTC1S,
147 S2MPU02_IRQ_WTSR,
148
149 S2MPU02_IRQ_INT120C,
150 S2MPU02_IRQ_INT140C,
151 S2MPU02_IRQ_TSD,
152
153 S2MPU02_IRQ_NR,
154};
155
132/* Masks for interrupts are the same as in s2mps11 */ 156/* Masks for interrupts are the same as in s2mps11 */
133#define S2MPS14_IRQ_TSD_MASK (1 << 2) 157#define S2MPS14_IRQ_TSD_MASK (1 << 2)
134 158
diff --git a/include/linux/mfd/samsung/s2mpa01.h b/include/linux/mfd/samsung/s2mpa01.h
index fbc63bc0d6a2..2766108bca2f 100644
--- a/include/linux/mfd/samsung/s2mpa01.h
+++ b/include/linux/mfd/samsung/s2mpa01.h
@@ -155,18 +155,6 @@ enum s2mpa01_regulators {
155 S2MPA01_REGULATOR_MAX, 155 S2MPA01_REGULATOR_MAX,
156}; 156};
157 157
158#define S2MPA01_BUCK_MIN1 600000
159#define S2MPA01_BUCK_MIN2 800000
160#define S2MPA01_BUCK_MIN3 1000000
161#define S2MPA01_BUCK_MIN4 1500000
162#define S2MPA01_LDO_MIN 800000
163
164#define S2MPA01_BUCK_STEP1 6250
165#define S2MPA01_BUCK_STEP2 12500
166
167#define S2MPA01_LDO_STEP1 50000
168#define S2MPA01_LDO_STEP2 25000
169
170#define S2MPA01_LDO_VSEL_MASK 0x3F 158#define S2MPA01_LDO_VSEL_MASK 0x3F
171#define S2MPA01_BUCK_VSEL_MASK 0xFF 159#define S2MPA01_BUCK_VSEL_MASK 0xFF
172#define S2MPA01_ENABLE_MASK (0x03 << S2MPA01_ENABLE_SHIFT) 160#define S2MPA01_ENABLE_MASK (0x03 << S2MPA01_ENABLE_SHIFT)
diff --git a/include/linux/mfd/samsung/s2mps11.h b/include/linux/mfd/samsung/s2mps11.h
index b3ddf98dec37..7981a9d77d3f 100644
--- a/include/linux/mfd/samsung/s2mps11.h
+++ b/include/linux/mfd/samsung/s2mps11.h
@@ -171,15 +171,6 @@ enum s2mps11_regulators {
171 S2MPS11_REGULATOR_MAX, 171 S2MPS11_REGULATOR_MAX,
172}; 172};
173 173
174#define S2MPS11_BUCK_MIN1 600000
175#define S2MPS11_BUCK_MIN2 750000
176#define S2MPS11_BUCK_MIN3 3000000
177#define S2MPS11_LDO_MIN 800000
178#define S2MPS11_BUCK_STEP1 6250
179#define S2MPS11_BUCK_STEP2 12500
180#define S2MPS11_BUCK_STEP3 25000
181#define S2MPS11_LDO_STEP1 50000
182#define S2MPS11_LDO_STEP2 25000
183#define S2MPS11_LDO_VSEL_MASK 0x3F 174#define S2MPS11_LDO_VSEL_MASK 0x3F
184#define S2MPS11_BUCK_VSEL_MASK 0xFF 175#define S2MPS11_BUCK_VSEL_MASK 0xFF
185#define S2MPS11_ENABLE_MASK (0x03 << S2MPS11_ENABLE_SHIFT) 176#define S2MPS11_ENABLE_MASK (0x03 << S2MPS11_ENABLE_SHIFT)
diff --git a/include/linux/mfd/samsung/s2mps14.h b/include/linux/mfd/samsung/s2mps14.h
index 900cd7a04314..c92f4782afb5 100644
--- a/include/linux/mfd/samsung/s2mps14.h
+++ b/include/linux/mfd/samsung/s2mps14.h
@@ -123,10 +123,6 @@ enum s2mps14_regulators {
123}; 123};
124 124
125/* Regulator constraints for BUCKx */ 125/* Regulator constraints for BUCKx */
126#define S2MPS14_BUCK1235_MIN_600MV 600000
127#define S2MPS14_BUCK4_MIN_1400MV 1400000
128#define S2MPS14_BUCK1235_STEP_6_25MV 6250
129#define S2MPS14_BUCK4_STEP_12_5MV 12500
130#define S2MPS14_BUCK1235_START_SEL 0x20 126#define S2MPS14_BUCK1235_START_SEL 0x20
131#define S2MPS14_BUCK4_START_SEL 0x40 127#define S2MPS14_BUCK4_START_SEL 0x40
132/* 128/*
@@ -136,12 +132,6 @@ enum s2mps14_regulators {
136 */ 132 */
137#define S2MPS14_BUCK_RAMP_DELAY 12500 133#define S2MPS14_BUCK_RAMP_DELAY 12500
138 134
139/* Regulator constraints for different types of LDOx */
140#define S2MPS14_LDO_MIN_800MV 800000
141#define S2MPS14_LDO_MIN_1800MV 1800000
142#define S2MPS14_LDO_STEP_12_5MV 12500
143#define S2MPS14_LDO_STEP_25MV 25000
144
145#define S2MPS14_LDO_VSEL_MASK 0x3F 135#define S2MPS14_LDO_VSEL_MASK 0x3F
146#define S2MPS14_BUCK_VSEL_MASK 0xFF 136#define S2MPS14_BUCK_VSEL_MASK 0xFF
147#define S2MPS14_ENABLE_MASK (0x03 << S2MPS14_ENABLE_SHIFT) 137#define S2MPS14_ENABLE_MASK (0x03 << S2MPS14_ENABLE_SHIFT)
diff --git a/include/linux/mfd/samsung/s2mpu02.h b/include/linux/mfd/samsung/s2mpu02.h
new file mode 100644
index 000000000000..47ae9bc583a7
--- /dev/null
+++ b/include/linux/mfd/samsung/s2mpu02.h
@@ -0,0 +1,201 @@
1/*
2 * s2mpu02.h
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#ifndef __LINUX_MFD_S2MPU02_H
20#define __LINUX_MFD_S2MPU02_H
21
22/* S2MPU02 registers */
23enum S2MPU02_reg {
24 S2MPU02_REG_ID,
25 S2MPU02_REG_INT1,
26 S2MPU02_REG_INT2,
27 S2MPU02_REG_INT3,
28 S2MPU02_REG_INT1M,
29 S2MPU02_REG_INT2M,
30 S2MPU02_REG_INT3M,
31 S2MPU02_REG_ST1,
32 S2MPU02_REG_ST2,
33 S2MPU02_REG_PWRONSRC,
34 S2MPU02_REG_OFFSRC,
35 S2MPU02_REG_BU_CHG,
36 S2MPU02_REG_RTCCTRL,
37 S2MPU02_REG_PMCTRL1,
38 S2MPU02_REG_RSVD1,
39 S2MPU02_REG_RSVD2,
40 S2MPU02_REG_RSVD3,
41 S2MPU02_REG_RSVD4,
42 S2MPU02_REG_RSVD5,
43 S2MPU02_REG_RSVD6,
44 S2MPU02_REG_RSVD7,
45 S2MPU02_REG_WRSTEN,
46 S2MPU02_REG_RSVD8,
47 S2MPU02_REG_RSVD9,
48 S2MPU02_REG_RSVD10,
49 S2MPU02_REG_B1CTRL1,
50 S2MPU02_REG_B1CTRL2,
51 S2MPU02_REG_B2CTRL1,
52 S2MPU02_REG_B2CTRL2,
53 S2MPU02_REG_B3CTRL1,
54 S2MPU02_REG_B3CTRL2,
55 S2MPU02_REG_B4CTRL1,
56 S2MPU02_REG_B4CTRL2,
57 S2MPU02_REG_B5CTRL1,
58 S2MPU02_REG_B5CTRL2,
59 S2MPU02_REG_B5CTRL3,
60 S2MPU02_REG_B5CTRL4,
61 S2MPU02_REG_B5CTRL5,
62 S2MPU02_REG_B6CTRL1,
63 S2MPU02_REG_B6CTRL2,
64 S2MPU02_REG_B7CTRL1,
65 S2MPU02_REG_B7CTRL2,
66 S2MPU02_REG_RAMP1,
67 S2MPU02_REG_RAMP2,
68 S2MPU02_REG_L1CTRL,
69 S2MPU02_REG_L2CTRL1,
70 S2MPU02_REG_L2CTRL2,
71 S2MPU02_REG_L2CTRL3,
72 S2MPU02_REG_L2CTRL4,
73 S2MPU02_REG_L3CTRL,
74 S2MPU02_REG_L4CTRL,
75 S2MPU02_REG_L5CTRL,
76 S2MPU02_REG_L6CTRL,
77 S2MPU02_REG_L7CTRL,
78 S2MPU02_REG_L8CTRL,
79 S2MPU02_REG_L9CTRL,
80 S2MPU02_REG_L10CTRL,
81 S2MPU02_REG_L11CTRL,
82 S2MPU02_REG_L12CTRL,
83 S2MPU02_REG_L13CTRL,
84 S2MPU02_REG_L14CTRL,
85 S2MPU02_REG_L15CTRL,
86 S2MPU02_REG_L16CTRL,
87 S2MPU02_REG_L17CTRL,
88 S2MPU02_REG_L18CTRL,
89 S2MPU02_REG_L19CTRL,
90 S2MPU02_REG_L20CTRL,
91 S2MPU02_REG_L21CTRL,
92 S2MPU02_REG_L22CTRL,
93 S2MPU02_REG_L23CTRL,
94 S2MPU02_REG_L24CTRL,
95 S2MPU02_REG_L25CTRL,
96 S2MPU02_REG_L26CTRL,
97 S2MPU02_REG_L27CTRL,
98 S2MPU02_REG_L28CTRL,
99 S2MPU02_REG_LDODSCH1,
100 S2MPU02_REG_LDODSCH2,
101 S2MPU02_REG_LDODSCH3,
102 S2MPU02_REG_LDODSCH4,
103 S2MPU02_REG_SELMIF,
104 S2MPU02_REG_RSVD11,
105 S2MPU02_REG_RSVD12,
106 S2MPU02_REG_RSVD13,
107 S2MPU02_REG_DVSSEL,
108 S2MPU02_REG_DVSPTR,
109 S2MPU02_REG_DVSDATA,
110};
111
112/* S2MPU02 regulator ids */
113enum S2MPU02_regulators {
114 S2MPU02_LDO1,
115 S2MPU02_LDO2,
116 S2MPU02_LDO3,
117 S2MPU02_LDO4,
118 S2MPU02_LDO5,
119 S2MPU02_LDO6,
120 S2MPU02_LDO7,
121 S2MPU02_LDO8,
122 S2MPU02_LDO9,
123 S2MPU02_LDO10,
124 S2MPU02_LDO11,
125 S2MPU02_LDO12,
126 S2MPU02_LDO13,
127 S2MPU02_LDO14,
128 S2MPU02_LDO15,
129 S2MPU02_LDO16,
130 S2MPU02_LDO17,
131 S2MPU02_LDO18,
132 S2MPU02_LDO19,
133 S2MPU02_LDO20,
134 S2MPU02_LDO21,
135 S2MPU02_LDO22,
136 S2MPU02_LDO23,
137 S2MPU02_LDO24,
138 S2MPU02_LDO25,
139 S2MPU02_LDO26,
140 S2MPU02_LDO27,
141 S2MPU02_LDO28,
142 S2MPU02_BUCK1,
143 S2MPU02_BUCK2,
144 S2MPU02_BUCK3,
145 S2MPU02_BUCK4,
146 S2MPU02_BUCK5,
147 S2MPU02_BUCK6,
148 S2MPU02_BUCK7,
149
150 S2MPU02_REGULATOR_MAX,
151};
152
153/* Regulator constraints for BUCKx */
154#define S2MPU02_BUCK1234_MIN_600MV 600000
155#define S2MPU02_BUCK5_MIN_1081_25MV 1081250
156#define S2MPU02_BUCK6_MIN_1700MV 1700000
157#define S2MPU02_BUCK7_MIN_900MV 900000
158
159#define S2MPU02_BUCK1234_STEP_6_25MV 6250
160#define S2MPU02_BUCK5_STEP_6_25MV 6250
161#define S2MPU02_BUCK6_STEP_2_50MV 2500
162#define S2MPU02_BUCK7_STEP_6_25MV 6250
163
164#define S2MPU02_BUCK1234_START_SEL 0x00
165#define S2MPU02_BUCK5_START_SEL 0x4D
166#define S2MPU02_BUCK6_START_SEL 0x28
167#define S2MPU02_BUCK7_START_SEL 0x30
168
169#define S2MPU02_BUCK_RAMP_DELAY 12500
170
171/* Regulator constraints for different types of LDOx */
172#define S2MPU02_LDO_MIN_900MV 900000
173#define S2MPU02_LDO_MIN_1050MV 1050000
174#define S2MPU02_LDO_MIN_1600MV 1600000
175#define S2MPU02_LDO_STEP_12_5MV 12500
176#define S2MPU02_LDO_STEP_25MV 25000
177#define S2MPU02_LDO_STEP_50MV 50000
178
179#define S2MPU02_LDO_GROUP1_START_SEL 0x8
180#define S2MPU02_LDO_GROUP2_START_SEL 0xA
181#define S2MPU02_LDO_GROUP3_START_SEL 0x10
182
183#define S2MPU02_LDO_VSEL_MASK 0x3F
184#define S2MPU02_BUCK_VSEL_MASK 0xFF
185#define S2MPU02_ENABLE_MASK (0x03 << S2MPU02_ENABLE_SHIFT)
186#define S2MPU02_ENABLE_SHIFT 6
187
188/* On/Off controlled by PWREN */
189#define S2MPU02_ENABLE_SUSPEND (0x01 << S2MPU02_ENABLE_SHIFT)
190#define S2MPU02_DISABLE_SUSPEND (0x11 << S2MPU02_ENABLE_SHIFT)
191#define S2MPU02_LDO_N_VOLTAGES (S2MPU02_LDO_VSEL_MASK + 1)
192#define S2MPU02_BUCK_N_VOLTAGES (S2MPU02_BUCK_VSEL_MASK + 1)
193
194/* RAMP delay for BUCK1234*/
195#define S2MPU02_BUCK1_RAMP_SHIFT 6
196#define S2MPU02_BUCK2_RAMP_SHIFT 4
197#define S2MPU02_BUCK3_RAMP_SHIFT 2
198#define S2MPU02_BUCK4_RAMP_SHIFT 0
199#define S2MPU02_BUCK1234_RAMP_MASK 0x3
200
201#endif /* __LINUX_MFD_S2MPU02_H */
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index fb96c84dada5..e2e70053470e 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -155,6 +155,7 @@ struct ti_tscadc_dev {
155 void __iomem *tscadc_base; 155 void __iomem *tscadc_base;
156 int irq; 156 int irq;
157 int used_cells; /* 1-2 */ 157 int used_cells; /* 1-2 */
158 int tsc_wires;
158 int tsc_cell; /* -1 if not used */ 159 int tsc_cell; /* -1 if not used */
159 int adc_cell; /* -1 if not used */ 160 int adc_cell; /* -1 if not used */
160 struct mfd_cell cells[TSCADC_CELLS]; 161 struct mfd_cell cells[TSCADC_CELLS];
diff --git a/include/linux/mfd/ti_ssp.h b/include/linux/mfd/ti_ssp.h
deleted file mode 100644
index dbb4b43bd20e..000000000000
--- a/include/linux/mfd/ti_ssp.h
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * Sequencer Serial Port (SSP) driver for Texas Instruments' SoCs
3 *
4 * Copyright (C) 2010 Texas Instruments Inc
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __TI_SSP_H__
22#define __TI_SSP_H__
23
24struct ti_ssp_dev_data {
25 const char *dev_name;
26 void *pdata;
27 size_t pdata_size;
28};
29
30struct ti_ssp_data {
31 unsigned long out_clock;
32 struct ti_ssp_dev_data dev_data[2];
33};
34
35struct ti_ssp_spi_data {
36 unsigned long iosel;
37 int num_cs;
38 void (*select)(int cs);
39};
40
41/*
42 * Sequencer port IO pin configuration bits. These do not correlate 1-1 with
43 * the hardware. The iosel field in the port data combines iosel1 and iosel2,
44 * and is therefore not a direct map to register space. It is best to use the
45 * macros below to construct iosel values.
46 *
47 * least significant 16 bits --> iosel1
48 * most significant 16 bits --> iosel2
49 */
50
51#define SSP_IN 0x0000
52#define SSP_DATA 0x0001
53#define SSP_CLOCK 0x0002
54#define SSP_CHIPSEL 0x0003
55#define SSP_OUT 0x0004
56#define SSP_PIN_SEL(pin, v) ((v) << ((pin) * 3))
57#define SSP_PIN_MASK(pin) SSP_PIN_SEL(pin, 0x7)
58#define SSP_INPUT_SEL(pin) ((pin) << 16)
59
60/* Sequencer port config bits */
61#define SSP_EARLY_DIN BIT(8)
62#define SSP_DELAY_DOUT BIT(9)
63
64/* Sequence map definitions */
65#define SSP_CLK_HIGH BIT(0)
66#define SSP_CLK_LOW 0
67#define SSP_DATA_HIGH BIT(1)
68#define SSP_DATA_LOW 0
69#define SSP_CS_HIGH BIT(2)
70#define SSP_CS_LOW 0
71#define SSP_OUT_MODE BIT(3)
72#define SSP_IN_MODE 0
73#define SSP_DATA_REG BIT(4)
74#define SSP_ADDR_REG 0
75
76#define SSP_OPCODE_DIRECT ((0x0) << 5)
77#define SSP_OPCODE_TOGGLE ((0x1) << 5)
78#define SSP_OPCODE_SHIFT ((0x2) << 5)
79#define SSP_OPCODE_BRANCH0 ((0x4) << 5)
80#define SSP_OPCODE_BRANCH1 ((0x5) << 5)
81#define SSP_OPCODE_BRANCH ((0x6) << 5)
82#define SSP_OPCODE_STOP ((0x7) << 5)
83#define SSP_BRANCH(addr) ((addr) << 8)
84#define SSP_COUNT(cycles) ((cycles) << 8)
85
86int ti_ssp_raw_read(struct device *dev);
87int ti_ssp_raw_write(struct device *dev, u32 val);
88int ti_ssp_load(struct device *dev, int offs, u32* prog, int len);
89int ti_ssp_run(struct device *dev, u32 pc, u32 input, u32 *output);
90int ti_ssp_set_mode(struct device *dev, int mode);
91int ti_ssp_set_iosel(struct device *dev, u32 iosel);
92
93#endif /* __TI_SSP_H__ */
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 8f6f2e91e7ae..57388171610d 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -5,6 +5,7 @@
5#include <linux/fb.h> 5#include <linux/fb.h>
6#include <linux/io.h> 6#include <linux/io.h>
7#include <linux/jiffies.h> 7#include <linux/jiffies.h>
8#include <linux/mmc/card.h>
8#include <linux/platform_device.h> 9#include <linux/platform_device.h>
9#include <linux/pm_runtime.h> 10#include <linux/pm_runtime.h>
10 11
@@ -83,6 +84,27 @@
83 */ 84 */
84#define TMIO_MMC_HAVE_HIGH_REG (1 << 6) 85#define TMIO_MMC_HAVE_HIGH_REG (1 << 6)
85 86
87/*
88 * Some controllers have CMD12 automatically
89 * issue/non-issue register
90 */
91#define TMIO_MMC_HAVE_CMD12_CTRL (1 << 7)
92
93/*
94 * Some controllers needs to set 1 on SDIO status reserved bits
95 */
96#define TMIO_MMC_SDIO_STATUS_QUIRK (1 << 8)
97
98/*
99 * Some controllers have DMA enable/disable register
100 */
101#define TMIO_MMC_HAVE_CTL_DMA_REG (1 << 9)
102
103/*
104 * Some controllers allows to set SDx actual clock
105 */
106#define TMIO_MMC_CLK_ACTUAL (1 << 10)
107
86int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); 108int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
87int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); 109int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
88void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state); 110void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
@@ -96,6 +118,7 @@ struct tmio_mmc_dma {
96 int slave_id_tx; 118 int slave_id_tx;
97 int slave_id_rx; 119 int slave_id_rx;
98 int alignment_shift; 120 int alignment_shift;
121 dma_addr_t dma_rx_offset;
99 bool (*filter)(struct dma_chan *chan, void *arg); 122 bool (*filter)(struct dma_chan *chan, void *arg);
100}; 123};
101 124
@@ -120,6 +143,8 @@ struct tmio_mmc_data {
120 /* clock management callbacks */ 143 /* clock management callbacks */
121 int (*clk_enable)(struct platform_device *pdev, unsigned int *f); 144 int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
122 void (*clk_disable)(struct platform_device *pdev); 145 void (*clk_disable)(struct platform_device *pdev);
146 int (*multi_io_quirk)(struct mmc_card *card,
147 unsigned int direction, int blk_size);
123}; 148};
124 149
125/* 150/*
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
index 95d6938737fd..ac7fba44d7e4 100644
--- a/include/linux/mfd/tps65217.h
+++ b/include/linux/mfd/tps65217.h
@@ -60,6 +60,8 @@
60#define TPS65217_REG_SEQ5 0X1D 60#define TPS65217_REG_SEQ5 0X1D
61#define TPS65217_REG_SEQ6 0X1E 61#define TPS65217_REG_SEQ6 0X1E
62 62
63#define TPS65217_REG_MAX TPS65217_REG_SEQ6
64
63/* Register field definitions */ 65/* Register field definitions */
64#define TPS65217_CHIPID_CHIP_MASK 0xF0 66#define TPS65217_CHIPID_CHIP_MASK 0xF0
65#define TPS65217_CHIPID_REV_MASK 0x0F 67#define TPS65217_CHIPID_REV_MASK 0x0F
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 16c2335c2856..6483a6fdce59 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -892,7 +892,7 @@ struct tps65910 {
892 struct device *dev; 892 struct device *dev;
893 struct i2c_client *i2c_client; 893 struct i2c_client *i2c_client;
894 struct regmap *regmap; 894 struct regmap *regmap;
895 unsigned int id; 895 unsigned long id;
896 896
897 /* Client devices */ 897 /* Client devices */
898 struct tps65910_pmic *pmic; 898 struct tps65910_pmic *pmic;
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 2e5b194b9b19..53d33dee70e1 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -37,6 +37,7 @@
37 37
38/* struct phy_device dev_flags definitions */ 38/* struct phy_device dev_flags definitions */
39#define MICREL_PHY_50MHZ_CLK 0x00000001 39#define MICREL_PHY_50MHZ_CLK 0x00000001
40#define MICREL_PHY_25MHZ_CLK 0x00000002
40 41
41#define MICREL_KSZ9021_EXTREG_CTRL 0xB 42#define MICREL_KSZ9021_EXTREG_CTRL 0xB
42#define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC 43#define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index a2901c414664..01aad3ed89ec 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -13,18 +13,9 @@ typedef void free_page_t(struct page *page, unsigned long private);
13 * Return values from addresss_space_operations.migratepage(): 13 * Return values from addresss_space_operations.migratepage():
14 * - negative errno on page migration failure; 14 * - negative errno on page migration failure;
15 * - zero on page migration success; 15 * - zero on page migration success;
16 *
17 * The balloon page migration introduces this special case where a 'distinct'
18 * return code is used to flag a successful page migration to unmap_and_move().
19 * This approach is necessary because page migration can race against balloon
20 * deflation procedure, and for such case we could introduce a nasty page leak
21 * if a successfully migrated balloon page gets released concurrently with
22 * migration's unmap_and_move() wrap-up steps.
23 */ 16 */
24#define MIGRATEPAGE_SUCCESS 0 17#define MIGRATEPAGE_SUCCESS 0
25#define MIGRATEPAGE_BALLOON_SUCCESS 1 /* special ret code for balloon page 18
26 * sucessful migration case.
27 */
28enum migrate_reason { 19enum migrate_reason {
29 MR_COMPACTION, 20 MR_COMPACTION,
30 MR_MEMORY_FAILURE, 21 MR_MEMORY_FAILURE,
@@ -82,9 +73,6 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
82 return -ENOSYS; 73 return -ENOSYS;
83} 74}
84 75
85/* Possible settings for the migrate_page() method in address_operations */
86#define migrate_page NULL
87
88#endif /* CONFIG_MIGRATION */ 76#endif /* CONFIG_MIGRATION */
89 77
90#ifdef CONFIG_NUMA_BALANCING 78#ifdef CONFIG_NUMA_BALANCING
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index c8450366c130..379c02648ab3 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -116,6 +116,7 @@ enum {
116 /* special QP and management commands */ 116 /* special QP and management commands */
117 MLX4_CMD_CONF_SPECIAL_QP = 0x23, 117 MLX4_CMD_CONF_SPECIAL_QP = 0x23,
118 MLX4_CMD_MAD_IFC = 0x24, 118 MLX4_CMD_MAD_IFC = 0x24,
119 MLX4_CMD_MAD_DEMUX = 0x203,
119 120
120 /* multicast commands */ 121 /* multicast commands */
121 MLX4_CMD_READ_MCG = 0x25, 122 MLX4_CMD_READ_MCG = 0x25,
@@ -186,6 +187,12 @@ enum {
186}; 187};
187 188
188enum { 189enum {
190 MLX4_CMD_MAD_DEMUX_CONFIG = 0,
191 MLX4_CMD_MAD_DEMUX_QUERY_STATE = 1,
192 MLX4_CMD_MAD_DEMUX_QUERY_RESTR = 2, /* Query mad demux restrictions */
193};
194
195enum {
189 MLX4_CMD_WRAPPED, 196 MLX4_CMD_WRAPPED,
190 MLX4_CMD_NATIVE 197 MLX4_CMD_NATIVE
191}; 198};
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index e15b1544ea83..37e4404d0227 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -38,6 +38,7 @@
38#include <linux/completion.h> 38#include <linux/completion.h>
39#include <linux/radix-tree.h> 39#include <linux/radix-tree.h>
40#include <linux/cpu_rmap.h> 40#include <linux/cpu_rmap.h>
41#include <linux/crash_dump.h>
41 42
42#include <linux/atomic.h> 43#include <linux/atomic.h>
43 44
@@ -183,19 +184,25 @@ enum {
183 MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 8, 184 MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 8,
184 MLX4_DEV_CAP_FLAG2_DMFS_IPOIB = 1LL << 9, 185 MLX4_DEV_CAP_FLAG2_DMFS_IPOIB = 1LL << 9,
185 MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10, 186 MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10,
187 MLX4_DEV_CAP_FLAG2_MAD_DEMUX = 1LL << 11,
188 MLX4_DEV_CAP_FLAG2_CQE_STRIDE = 1LL << 12,
189 MLX4_DEV_CAP_FLAG2_EQE_STRIDE = 1LL << 13
186}; 190};
187 191
188enum { 192enum {
189 MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0, 193 MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0,
190 MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1 194 MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1,
195 MLX4_DEV_CAP_CQE_STRIDE_ENABLED = 1LL << 2,
196 MLX4_DEV_CAP_EQE_STRIDE_ENABLED = 1LL << 3
191}; 197};
192 198
193enum { 199enum {
194 MLX4_USER_DEV_CAP_64B_CQE = 1L << 0 200 MLX4_USER_DEV_CAP_LARGE_CQE = 1L << 0
195}; 201};
196 202
197enum { 203enum {
198 MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0 204 MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0,
205 MLX4_FUNC_CAP_EQE_CQE_STRIDE = 1L << 1
199}; 206};
200 207
201 208
@@ -208,6 +215,7 @@ enum {
208 MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, 215 MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9,
209 MLX4_BMME_FLAG_RESERVED_LKEY = 1 << 10, 216 MLX4_BMME_FLAG_RESERVED_LKEY = 1 << 10,
210 MLX4_BMME_FLAG_FAST_REG_WR = 1 << 11, 217 MLX4_BMME_FLAG_FAST_REG_WR = 1 << 11,
218 MLX4_BMME_FLAG_VSD_INIT2RTR = 1 << 28,
211}; 219};
212 220
213enum mlx4_event { 221enum mlx4_event {
@@ -273,6 +281,7 @@ enum {
273 MLX4_PERM_REMOTE_WRITE = 1 << 13, 281 MLX4_PERM_REMOTE_WRITE = 1 << 13,
274 MLX4_PERM_ATOMIC = 1 << 14, 282 MLX4_PERM_ATOMIC = 1 << 14,
275 MLX4_PERM_BIND_MW = 1 << 15, 283 MLX4_PERM_BIND_MW = 1 << 15,
284 MLX4_PERM_MASK = 0xFC00
276}; 285};
277 286
278enum { 287enum {
@@ -574,7 +583,7 @@ struct mlx4_uar {
574}; 583};
575 584
576struct mlx4_bf { 585struct mlx4_bf {
577 unsigned long offset; 586 unsigned int offset;
578 int buf_size; 587 int buf_size;
579 struct mlx4_uar *uar; 588 struct mlx4_uar *uar;
580 void __iomem *reg; 589 void __iomem *reg;
@@ -698,6 +707,7 @@ struct mlx4_dev {
698 u64 regid_promisc_array[MLX4_MAX_PORTS + 1]; 707 u64 regid_promisc_array[MLX4_MAX_PORTS + 1];
699 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1]; 708 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1];
700 struct mlx4_vf_dev *dev_vfs; 709 struct mlx4_vf_dev *dev_vfs;
710 int nvfs[MLX4_MAX_PORTS + 1];
701}; 711};
702 712
703struct mlx4_eqe { 713struct mlx4_eqe {
@@ -1194,6 +1204,9 @@ int mlx4_map_sw_to_hw_steering_id(struct mlx4_dev *dev,
1194 enum mlx4_net_trans_rule_id id); 1204 enum mlx4_net_trans_rule_id id);
1195int mlx4_hw_rule_sz(struct mlx4_dev *dev, enum mlx4_net_trans_rule_id id); 1205int mlx4_hw_rule_sz(struct mlx4_dev *dev, enum mlx4_net_trans_rule_id id);
1196 1206
1207int mlx4_tunnel_steer_add(struct mlx4_dev *dev, unsigned char *addr,
1208 int port, int qpn, u16 prio, u64 *reg_id);
1209
1197void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port, 1210void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port,
1198 int i, int val); 1211 int i, int val);
1199 1212
@@ -1254,11 +1267,26 @@ int mlx4_vf_smi_enabled(struct mlx4_dev *dev, int slave, int port);
1254int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port); 1267int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port);
1255int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port, 1268int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port,
1256 int enable); 1269 int enable);
1270int mlx4_mr_hw_get_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr,
1271 struct mlx4_mpt_entry ***mpt_entry);
1272int mlx4_mr_hw_write_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr,
1273 struct mlx4_mpt_entry **mpt_entry);
1274int mlx4_mr_hw_change_pd(struct mlx4_dev *dev, struct mlx4_mpt_entry *mpt_entry,
1275 u32 pdn);
1276int mlx4_mr_hw_change_access(struct mlx4_dev *dev,
1277 struct mlx4_mpt_entry *mpt_entry,
1278 u32 access);
1279void mlx4_mr_hw_put_mpt(struct mlx4_dev *dev,
1280 struct mlx4_mpt_entry **mpt_entry);
1281void mlx4_mr_rereg_mem_cleanup(struct mlx4_dev *dev, struct mlx4_mr *mr);
1282int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr,
1283 u64 iova, u64 size, int npages,
1284 int page_shift, struct mlx4_mpt_entry *mpt_entry);
1257 1285
1258/* Returns true if running in low memory profile (kdump kernel) */ 1286/* Returns true if running in low memory profile (kdump kernel) */
1259static inline bool mlx4_low_memory_profile(void) 1287static inline bool mlx4_low_memory_profile(void)
1260{ 1288{
1261 return reset_devices; 1289 return is_kdump_kernel();
1262} 1290}
1263 1291
1264#endif /* MLX4_DEVICE_H */ 1292#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 7040dc98ff8b..5f4e36cf0091 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -56,7 +56,8 @@ enum mlx4_qp_optpar {
56 MLX4_QP_OPTPAR_RNR_RETRY = 1 << 13, 56 MLX4_QP_OPTPAR_RNR_RETRY = 1 << 13,
57 MLX4_QP_OPTPAR_ACK_TIMEOUT = 1 << 14, 57 MLX4_QP_OPTPAR_ACK_TIMEOUT = 1 << 14,
58 MLX4_QP_OPTPAR_SCHED_QUEUE = 1 << 16, 58 MLX4_QP_OPTPAR_SCHED_QUEUE = 1 << 16,
59 MLX4_QP_OPTPAR_COUNTER_INDEX = 1 << 20 59 MLX4_QP_OPTPAR_COUNTER_INDEX = 1 << 20,
60 MLX4_QP_OPTPAR_VLAN_STRIPPING = 1 << 21,
60}; 61};
61 62
62enum mlx4_qp_state { 63enum mlx4_qp_state {
@@ -423,13 +424,20 @@ struct mlx4_wqe_inline_seg {
423 424
424enum mlx4_update_qp_attr { 425enum mlx4_update_qp_attr {
425 MLX4_UPDATE_QP_SMAC = 1 << 0, 426 MLX4_UPDATE_QP_SMAC = 1 << 0,
427 MLX4_UPDATE_QP_VSD = 1 << 2,
428 MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 2) - 1
429};
430
431enum mlx4_update_qp_params_flags {
432 MLX4_UPDATE_QP_PARAMS_FLAGS_VSD_ENABLE = 1 << 0,
426}; 433};
427 434
428struct mlx4_update_qp_params { 435struct mlx4_update_qp_params {
429 u8 smac_index; 436 u8 smac_index;
437 u32 flags;
430}; 438};
431 439
432int mlx4_update_qp(struct mlx4_dev *dev, struct mlx4_qp *qp, 440int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,
433 enum mlx4_update_qp_attr attr, 441 enum mlx4_update_qp_attr attr,
434 struct mlx4_update_qp_params *params); 442 struct mlx4_update_qp_params *params);
435int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 443int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 334947151dfc..1d67fd32e71c 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -44,6 +44,50 @@
44#error Host endianness not defined 44#error Host endianness not defined
45#endif 45#endif
46 46
47/* helper macros */
48#define __mlx5_nullp(typ) ((struct mlx5_ifc_##typ##_bits *)0)
49#define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld)
50#define __mlx5_bit_off(typ, fld) ((unsigned)(unsigned long)(&(__mlx5_nullp(typ)->fld)))
51#define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32)
52#define __mlx5_64_off(typ, fld) (__mlx5_bit_off(typ, fld) / 64)
53#define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0x1f))
54#define __mlx5_mask(typ, fld) ((u32)((1ull << __mlx5_bit_sz(typ, fld)) - 1))
55#define __mlx5_dw_mask(typ, fld) (__mlx5_mask(typ, fld) << __mlx5_dw_bit_off(typ, fld))
56#define __mlx5_st_sz_bits(typ) sizeof(struct mlx5_ifc_##typ##_bits)
57
58#define MLX5_FLD_SZ_BYTES(typ, fld) (__mlx5_bit_sz(typ, fld) / 8)
59#define MLX5_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8)
60#define MLX5_ST_SZ_DW(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 32)
61#define MLX5_BYTE_OFF(typ, fld) (__mlx5_bit_off(typ, fld) / 8)
62#define MLX5_ADDR_OF(typ, p, fld) ((char *)(p) + MLX5_BYTE_OFF(typ, fld))
63
64/* insert a value to a struct */
65#define MLX5_SET(typ, p, fld, v) do { \
66 BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 32); \
67 *((__be32 *)(p) + __mlx5_dw_off(typ, fld)) = \
68 cpu_to_be32((be32_to_cpu(*((__be32 *)(p) + __mlx5_dw_off(typ, fld))) & \
69 (~__mlx5_dw_mask(typ, fld))) | (((v) & __mlx5_mask(typ, fld)) \
70 << __mlx5_dw_bit_off(typ, fld))); \
71} while (0)
72
73#define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\
74__mlx5_dw_off(typ, fld))) >> __mlx5_dw_bit_off(typ, fld)) & \
75__mlx5_mask(typ, fld))
76
77#define MLX5_GET_PR(typ, p, fld) ({ \
78 u32 ___t = MLX5_GET(typ, p, fld); \
79 pr_debug(#fld " = 0x%x\n", ___t); \
80 ___t; \
81})
82
83#define MLX5_SET64(typ, p, fld, v) do { \
84 BUILD_BUG_ON(__mlx5_bit_sz(typ, fld) != 64); \
85 BUILD_BUG_ON(__mlx5_bit_off(typ, fld) % 64); \
86 *((__be64 *)(p) + __mlx5_64_off(typ, fld)) = cpu_to_be64(v); \
87} while (0)
88
89#define MLX5_GET64(typ, p, fld) be64_to_cpu(*((__be64 *)(p) + __mlx5_64_off(typ, fld)))
90
47enum { 91enum {
48 MLX5_MAX_COMMANDS = 32, 92 MLX5_MAX_COMMANDS = 32,
49 MLX5_CMD_DATA_BLOCK_SIZE = 512, 93 MLX5_CMD_DATA_BLOCK_SIZE = 512,
@@ -71,6 +115,11 @@ enum {
71}; 115};
72 116
73enum { 117enum {
118 MLX5_MIN_PKEY_TABLE_SIZE = 128,
119 MLX5_MAX_LOG_PKEY_TABLE = 5,
120};
121
122enum {
74 MLX5_PERM_LOCAL_READ = 1 << 2, 123 MLX5_PERM_LOCAL_READ = 1 << 2,
75 MLX5_PERM_LOCAL_WRITE = 1 << 3, 124 MLX5_PERM_LOCAL_WRITE = 1 << 3,
76 MLX5_PERM_REMOTE_READ = 1 << 4, 125 MLX5_PERM_REMOTE_READ = 1 << 4,
@@ -184,10 +233,10 @@ enum {
184 MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29, 233 MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29,
185 MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30, 234 MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30,
186 MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32, 235 MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32,
236 MLX5_DEV_CAP_FLAG_DCT = 1LL << 37,
187 MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38, 237 MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38,
188 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39, 238 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39,
189 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40, 239 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
190 MLX5_DEV_CAP_FLAG_DCT = 1LL << 41,
191 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46, 240 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46,
192}; 241};
193 242
@@ -243,10 +292,14 @@ enum {
243}; 292};
244 293
245enum { 294enum {
246 MLX5_CAP_OFF_DCT = 41,
247 MLX5_CAP_OFF_CMDIF_CSUM = 46, 295 MLX5_CAP_OFF_CMDIF_CSUM = 46,
248}; 296};
249 297
298enum {
299 HCA_CAP_OPMOD_GET_MAX = 0,
300 HCA_CAP_OPMOD_GET_CUR = 1,
301};
302
250struct mlx5_inbox_hdr { 303struct mlx5_inbox_hdr {
251 __be16 opcode; 304 __be16 opcode;
252 u8 rsvd[4]; 305 u8 rsvd[4];
@@ -274,101 +327,6 @@ struct mlx5_cmd_query_adapter_mbox_out {
274 u8 vsd_psid[16]; 327 u8 vsd_psid[16];
275}; 328};
276 329
277struct mlx5_hca_cap {
278 u8 rsvd1[16];
279 u8 log_max_srq_sz;
280 u8 log_max_qp_sz;
281 u8 rsvd2;
282 u8 log_max_qp;
283 u8 log_max_strq_sz;
284 u8 log_max_srqs;
285 u8 rsvd4[2];
286 u8 rsvd5;
287 u8 log_max_cq_sz;
288 u8 rsvd6;
289 u8 log_max_cq;
290 u8 log_max_eq_sz;
291 u8 log_max_mkey;
292 u8 rsvd7;
293 u8 log_max_eq;
294 u8 max_indirection;
295 u8 log_max_mrw_sz;
296 u8 log_max_bsf_list_sz;
297 u8 log_max_klm_list_sz;
298 u8 rsvd_8_0;
299 u8 log_max_ra_req_dc;
300 u8 rsvd_8_1;
301 u8 log_max_ra_res_dc;
302 u8 rsvd9;
303 u8 log_max_ra_req_qp;
304 u8 rsvd10;
305 u8 log_max_ra_res_qp;
306 u8 rsvd11[4];
307 __be16 max_qp_count;
308 __be16 rsvd12;
309 u8 rsvd13;
310 u8 local_ca_ack_delay;
311 u8 rsvd14;
312 u8 num_ports;
313 u8 log_max_msg;
314 u8 rsvd15[3];
315 __be16 stat_rate_support;
316 u8 rsvd16[2];
317 __be64 flags;
318 u8 rsvd17;
319 u8 uar_sz;
320 u8 rsvd18;
321 u8 log_pg_sz;
322 __be16 bf_log_bf_reg_size;
323 u8 rsvd19[4];
324 __be16 max_desc_sz_sq;
325 u8 rsvd20[2];
326 __be16 max_desc_sz_rq;
327 u8 rsvd21[2];
328 __be16 max_desc_sz_sq_dc;
329 __be32 max_qp_mcg;
330 u8 rsvd22[3];
331 u8 log_max_mcg;
332 u8 rsvd23;
333 u8 log_max_pd;
334 u8 rsvd24;
335 u8 log_max_xrcd;
336 u8 rsvd25[42];
337 __be16 log_uar_page_sz;
338 u8 rsvd26[28];
339 u8 log_max_atomic_size_qp;
340 u8 rsvd27[2];
341 u8 log_max_atomic_size_dc;
342 u8 rsvd28[76];
343};
344
345
346struct mlx5_cmd_query_hca_cap_mbox_in {
347 struct mlx5_inbox_hdr hdr;
348 u8 rsvd[8];
349};
350
351
352struct mlx5_cmd_query_hca_cap_mbox_out {
353 struct mlx5_outbox_hdr hdr;
354 u8 rsvd0[8];
355 struct mlx5_hca_cap hca_cap;
356};
357
358
359struct mlx5_cmd_set_hca_cap_mbox_in {
360 struct mlx5_inbox_hdr hdr;
361 u8 rsvd[8];
362 struct mlx5_hca_cap hca_cap;
363};
364
365
366struct mlx5_cmd_set_hca_cap_mbox_out {
367 struct mlx5_outbox_hdr hdr;
368 u8 rsvd0[8];
369};
370
371
372struct mlx5_cmd_init_hca_mbox_in { 330struct mlx5_cmd_init_hca_mbox_in {
373 struct mlx5_inbox_hdr hdr; 331 struct mlx5_inbox_hdr hdr;
374 u8 rsvd0[2]; 332 u8 rsvd0[2];
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index b88e9b46d957..246310dc8bef 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -44,6 +44,7 @@
44 44
45#include <linux/mlx5/device.h> 45#include <linux/mlx5/device.h>
46#include <linux/mlx5/doorbell.h> 46#include <linux/mlx5/doorbell.h>
47#include <linux/mlx5/mlx5_ifc.h>
47 48
48enum { 49enum {
49 MLX5_BOARD_ID_LEN = 64, 50 MLX5_BOARD_ID_LEN = 64,
@@ -99,81 +100,6 @@ enum {
99}; 100};
100 101
101enum { 102enum {
102 MLX5_CMD_OP_QUERY_HCA_CAP = 0x100,
103 MLX5_CMD_OP_QUERY_ADAPTER = 0x101,
104 MLX5_CMD_OP_INIT_HCA = 0x102,
105 MLX5_CMD_OP_TEARDOWN_HCA = 0x103,
106 MLX5_CMD_OP_ENABLE_HCA = 0x104,
107 MLX5_CMD_OP_DISABLE_HCA = 0x105,
108 MLX5_CMD_OP_QUERY_PAGES = 0x107,
109 MLX5_CMD_OP_MANAGE_PAGES = 0x108,
110 MLX5_CMD_OP_SET_HCA_CAP = 0x109,
111
112 MLX5_CMD_OP_CREATE_MKEY = 0x200,
113 MLX5_CMD_OP_QUERY_MKEY = 0x201,
114 MLX5_CMD_OP_DESTROY_MKEY = 0x202,
115 MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS = 0x203,
116
117 MLX5_CMD_OP_CREATE_EQ = 0x301,
118 MLX5_CMD_OP_DESTROY_EQ = 0x302,
119 MLX5_CMD_OP_QUERY_EQ = 0x303,
120
121 MLX5_CMD_OP_CREATE_CQ = 0x400,
122 MLX5_CMD_OP_DESTROY_CQ = 0x401,
123 MLX5_CMD_OP_QUERY_CQ = 0x402,
124 MLX5_CMD_OP_MODIFY_CQ = 0x403,
125
126 MLX5_CMD_OP_CREATE_QP = 0x500,
127 MLX5_CMD_OP_DESTROY_QP = 0x501,
128 MLX5_CMD_OP_RST2INIT_QP = 0x502,
129 MLX5_CMD_OP_INIT2RTR_QP = 0x503,
130 MLX5_CMD_OP_RTR2RTS_QP = 0x504,
131 MLX5_CMD_OP_RTS2RTS_QP = 0x505,
132 MLX5_CMD_OP_SQERR2RTS_QP = 0x506,
133 MLX5_CMD_OP_2ERR_QP = 0x507,
134 MLX5_CMD_OP_RTS2SQD_QP = 0x508,
135 MLX5_CMD_OP_SQD2RTS_QP = 0x509,
136 MLX5_CMD_OP_2RST_QP = 0x50a,
137 MLX5_CMD_OP_QUERY_QP = 0x50b,
138 MLX5_CMD_OP_CONF_SQP = 0x50c,
139 MLX5_CMD_OP_MAD_IFC = 0x50d,
140 MLX5_CMD_OP_INIT2INIT_QP = 0x50e,
141 MLX5_CMD_OP_SUSPEND_QP = 0x50f,
142 MLX5_CMD_OP_UNSUSPEND_QP = 0x510,
143 MLX5_CMD_OP_SQD2SQD_QP = 0x511,
144 MLX5_CMD_OP_ALLOC_QP_COUNTER_SET = 0x512,
145 MLX5_CMD_OP_DEALLOC_QP_COUNTER_SET = 0x513,
146 MLX5_CMD_OP_QUERY_QP_COUNTER_SET = 0x514,
147
148 MLX5_CMD_OP_CREATE_PSV = 0x600,
149 MLX5_CMD_OP_DESTROY_PSV = 0x601,
150 MLX5_CMD_OP_QUERY_PSV = 0x602,
151 MLX5_CMD_OP_QUERY_SIG_RULE_TABLE = 0x603,
152 MLX5_CMD_OP_QUERY_BLOCK_SIZE_TABLE = 0x604,
153
154 MLX5_CMD_OP_CREATE_SRQ = 0x700,
155 MLX5_CMD_OP_DESTROY_SRQ = 0x701,
156 MLX5_CMD_OP_QUERY_SRQ = 0x702,
157 MLX5_CMD_OP_ARM_RQ = 0x703,
158 MLX5_CMD_OP_RESIZE_SRQ = 0x704,
159
160 MLX5_CMD_OP_ALLOC_PD = 0x800,
161 MLX5_CMD_OP_DEALLOC_PD = 0x801,
162 MLX5_CMD_OP_ALLOC_UAR = 0x802,
163 MLX5_CMD_OP_DEALLOC_UAR = 0x803,
164
165 MLX5_CMD_OP_ATTACH_TO_MCG = 0x806,
166 MLX5_CMD_OP_DETACH_FROM_MCG = 0x807,
167
168
169 MLX5_CMD_OP_ALLOC_XRCD = 0x80e,
170 MLX5_CMD_OP_DEALLOC_XRCD = 0x80f,
171
172 MLX5_CMD_OP_ACCESS_REG = 0x805,
173 MLX5_CMD_OP_MAX = 0x810,
174};
175
176enum {
177 MLX5_REG_PCAP = 0x5001, 103 MLX5_REG_PCAP = 0x5001,
178 MLX5_REG_PMTU = 0x5003, 104 MLX5_REG_PMTU = 0x5003,
179 MLX5_REG_PTYS = 0x5004, 105 MLX5_REG_PTYS = 0x5004,
@@ -335,23 +261,30 @@ struct mlx5_port_caps {
335 int pkey_table_len; 261 int pkey_table_len;
336}; 262};
337 263
338struct mlx5_caps { 264struct mlx5_general_caps {
339 u8 log_max_eq; 265 u8 log_max_eq;
340 u8 log_max_cq; 266 u8 log_max_cq;
341 u8 log_max_qp; 267 u8 log_max_qp;
342 u8 log_max_mkey; 268 u8 log_max_mkey;
343 u8 log_max_pd; 269 u8 log_max_pd;
344 u8 log_max_srq; 270 u8 log_max_srq;
271 u8 log_max_strq;
272 u8 log_max_mrw_sz;
273 u8 log_max_bsf_list_size;
274 u8 log_max_klm_list_size;
345 u32 max_cqes; 275 u32 max_cqes;
346 int max_wqes; 276 int max_wqes;
277 u32 max_eqes;
278 u32 max_indirection;
347 int max_sq_desc_sz; 279 int max_sq_desc_sz;
348 int max_rq_desc_sz; 280 int max_rq_desc_sz;
281 int max_dc_sq_desc_sz;
349 u64 flags; 282 u64 flags;
350 u16 stat_rate_support; 283 u16 stat_rate_support;
351 int log_max_msg; 284 int log_max_msg;
352 int num_ports; 285 int num_ports;
353 int max_ra_res_qp; 286 u8 log_max_ra_res_qp;
354 int max_ra_req_qp; 287 u8 log_max_ra_req_qp;
355 int max_srq_wqes; 288 int max_srq_wqes;
356 int bf_reg_size; 289 int bf_reg_size;
357 int bf_regs_per_page; 290 int bf_regs_per_page;
@@ -363,6 +296,19 @@ struct mlx5_caps {
363 u8 log_max_mcg; 296 u8 log_max_mcg;
364 u32 max_qp_mcg; 297 u32 max_qp_mcg;
365 int min_page_sz; 298 int min_page_sz;
299 int pd_cap;
300 u32 max_qp_counters;
301 u32 pkey_table_size;
302 u8 log_max_ra_req_dc;
303 u8 log_max_ra_res_dc;
304 u32 uar_sz;
305 u8 min_log_pg_sz;
306 u8 log_max_xrcd;
307 u16 log_uar_page_sz;
308};
309
310struct mlx5_caps {
311 struct mlx5_general_caps gen;
366}; 312};
367 313
368struct mlx5_cmd_mailbox { 314struct mlx5_cmd_mailbox {
@@ -429,6 +375,16 @@ struct mlx5_core_mr {
429 u32 pd; 375 u32 pd;
430}; 376};
431 377
378enum mlx5_res_type {
379 MLX5_RES_QP,
380};
381
382struct mlx5_core_rsc_common {
383 enum mlx5_res_type res;
384 atomic_t refcount;
385 struct completion free;
386};
387
432struct mlx5_core_srq { 388struct mlx5_core_srq {
433 u32 srqn; 389 u32 srqn;
434 int max; 390 int max;
@@ -695,6 +651,9 @@ void mlx5_cmd_cleanup(struct mlx5_core_dev *dev);
695void mlx5_cmd_use_events(struct mlx5_core_dev *dev); 651void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
696void mlx5_cmd_use_polling(struct mlx5_core_dev *dev); 652void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);
697int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr); 653int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr);
654int mlx5_cmd_status_to_err_v2(void *ptr);
655int mlx5_core_get_caps(struct mlx5_core_dev *dev, struct mlx5_caps *caps,
656 u16 opmod);
698int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, 657int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
699 int out_size); 658 int out_size);
700int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size, 659int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size,
@@ -751,7 +710,7 @@ int mlx5_eq_init(struct mlx5_core_dev *dev);
751void mlx5_eq_cleanup(struct mlx5_core_dev *dev); 710void mlx5_eq_cleanup(struct mlx5_core_dev *dev);
752void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas); 711void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas);
753void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn); 712void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn);
754void mlx5_qp_event(struct mlx5_core_dev *dev, u32 qpn, int event_type); 713void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type);
755void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); 714void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type);
756struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); 715struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn);
757void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector); 716void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector);
@@ -788,6 +747,7 @@ void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);
788int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn, 747int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn,
789 int npsvs, u32 *sig_index); 748 int npsvs, u32 *sig_index);
790int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num); 749int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num);
750void mlx5_core_put_rsc(struct mlx5_core_rsc_common *common);
791 751
792static inline u32 mlx5_mkey_to_idx(u32 mkey) 752static inline u32 mlx5_mkey_to_idx(u32 mkey)
793{ 753{
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
new file mode 100644
index 000000000000..5f48b8f592c5
--- /dev/null
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -0,0 +1,349 @@
1/*
2 * Copyright (c) 2014, Mellanox Technologies inc. All rights reserved.
3 *
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
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_IFC_H
34#define MLX5_IFC_H
35
36enum {
37 MLX5_CMD_OP_QUERY_HCA_CAP = 0x100,
38 MLX5_CMD_OP_QUERY_ADAPTER = 0x101,
39 MLX5_CMD_OP_INIT_HCA = 0x102,
40 MLX5_CMD_OP_TEARDOWN_HCA = 0x103,
41 MLX5_CMD_OP_ENABLE_HCA = 0x104,
42 MLX5_CMD_OP_DISABLE_HCA = 0x105,
43 MLX5_CMD_OP_QUERY_PAGES = 0x107,
44 MLX5_CMD_OP_MANAGE_PAGES = 0x108,
45 MLX5_CMD_OP_SET_HCA_CAP = 0x109,
46 MLX5_CMD_OP_CREATE_MKEY = 0x200,
47 MLX5_CMD_OP_QUERY_MKEY = 0x201,
48 MLX5_CMD_OP_DESTROY_MKEY = 0x202,
49 MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS = 0x203,
50 MLX5_CMD_OP_PAGE_FAULT_RESUME = 0x204,
51 MLX5_CMD_OP_CREATE_EQ = 0x301,
52 MLX5_CMD_OP_DESTROY_EQ = 0x302,
53 MLX5_CMD_OP_QUERY_EQ = 0x303,
54 MLX5_CMD_OP_GEN_EQE = 0x304,
55 MLX5_CMD_OP_CREATE_CQ = 0x400,
56 MLX5_CMD_OP_DESTROY_CQ = 0x401,
57 MLX5_CMD_OP_QUERY_CQ = 0x402,
58 MLX5_CMD_OP_MODIFY_CQ = 0x403,
59 MLX5_CMD_OP_CREATE_QP = 0x500,
60 MLX5_CMD_OP_DESTROY_QP = 0x501,
61 MLX5_CMD_OP_RST2INIT_QP = 0x502,
62 MLX5_CMD_OP_INIT2RTR_QP = 0x503,
63 MLX5_CMD_OP_RTR2RTS_QP = 0x504,
64 MLX5_CMD_OP_RTS2RTS_QP = 0x505,
65 MLX5_CMD_OP_SQERR2RTS_QP = 0x506,
66 MLX5_CMD_OP_2ERR_QP = 0x507,
67 MLX5_CMD_OP_2RST_QP = 0x50a,
68 MLX5_CMD_OP_QUERY_QP = 0x50b,
69 MLX5_CMD_OP_INIT2INIT_QP = 0x50e,
70 MLX5_CMD_OP_CREATE_PSV = 0x600,
71 MLX5_CMD_OP_DESTROY_PSV = 0x601,
72 MLX5_CMD_OP_CREATE_SRQ = 0x700,
73 MLX5_CMD_OP_DESTROY_SRQ = 0x701,
74 MLX5_CMD_OP_QUERY_SRQ = 0x702,
75 MLX5_CMD_OP_ARM_RQ = 0x703,
76 MLX5_CMD_OP_RESIZE_SRQ = 0x704,
77 MLX5_CMD_OP_CREATE_DCT = 0x710,
78 MLX5_CMD_OP_DESTROY_DCT = 0x711,
79 MLX5_CMD_OP_DRAIN_DCT = 0x712,
80 MLX5_CMD_OP_QUERY_DCT = 0x713,
81 MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION = 0x714,
82 MLX5_CMD_OP_QUERY_VPORT_STATE = 0x750,
83 MLX5_CMD_OP_MODIFY_VPORT_STATE = 0x751,
84 MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT = 0x752,
85 MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT = 0x753,
86 MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT = 0x754,
87 MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT = 0x755,
88 MLX5_CMD_OP_QUERY_RCOE_ADDRESS = 0x760,
89 MLX5_CMD_OP_SET_ROCE_ADDRESS = 0x761,
90 MLX5_CMD_OP_QUERY_VPORT_COUNTER = 0x770,
91 MLX5_CMD_OP_ALLOC_Q_COUNTER = 0x771,
92 MLX5_CMD_OP_DEALLOC_Q_COUNTER = 0x772,
93 MLX5_CMD_OP_QUERY_Q_COUNTER = 0x773,
94 MLX5_CMD_OP_ALLOC_PD = 0x800,
95 MLX5_CMD_OP_DEALLOC_PD = 0x801,
96 MLX5_CMD_OP_ALLOC_UAR = 0x802,
97 MLX5_CMD_OP_DEALLOC_UAR = 0x803,
98 MLX5_CMD_OP_CONFIG_INT_MODERATION = 0x804,
99 MLX5_CMD_OP_ACCESS_REG = 0x805,
100 MLX5_CMD_OP_ATTACH_TO_MCG = 0x806,
101 MLX5_CMD_OP_DETACH_FROM_MCG = 0x807,
102 MLX5_CMD_OP_GET_DROPPED_PACKET_LOG = 0x80a,
103 MLX5_CMD_OP_MAD_IFC = 0x50d,
104 MLX5_CMD_OP_QUERY_MAD_DEMUX = 0x80b,
105 MLX5_CMD_OP_SET_MAD_DEMUX = 0x80c,
106 MLX5_CMD_OP_NOP = 0x80d,
107 MLX5_CMD_OP_ALLOC_XRCD = 0x80e,
108 MLX5_CMD_OP_DEALLOC_XRCD = 0x80f,
109 MLX5_CMD_OP_SET_BURST_SIZE = 0x812,
110 MLX5_CMD_OP_QUERY_BURST_SZIE = 0x813,
111 MLX5_CMD_OP_ACTIVATE_TRACER = 0x814,
112 MLX5_CMD_OP_DEACTIVATE_TRACER = 0x815,
113 MLX5_CMD_OP_CREATE_SNIFFER_RULE = 0x820,
114 MLX5_CMD_OP_DESTROY_SNIFFER_RULE = 0x821,
115 MLX5_CMD_OP_QUERY_CONG_PARAMS = 0x822,
116 MLX5_CMD_OP_MODIFY_CONG_PARAMS = 0x823,
117 MLX5_CMD_OP_QUERY_CONG_STATISTICS = 0x824,
118 MLX5_CMD_OP_CREATE_TIR = 0x900,
119 MLX5_CMD_OP_MODIFY_TIR = 0x901,
120 MLX5_CMD_OP_DESTROY_TIR = 0x902,
121 MLX5_CMD_OP_QUERY_TIR = 0x903,
122 MLX5_CMD_OP_CREATE_TIS = 0x912,
123 MLX5_CMD_OP_MODIFY_TIS = 0x913,
124 MLX5_CMD_OP_DESTROY_TIS = 0x914,
125 MLX5_CMD_OP_QUERY_TIS = 0x915,
126 MLX5_CMD_OP_CREATE_SQ = 0x904,
127 MLX5_CMD_OP_MODIFY_SQ = 0x905,
128 MLX5_CMD_OP_DESTROY_SQ = 0x906,
129 MLX5_CMD_OP_QUERY_SQ = 0x907,
130 MLX5_CMD_OP_CREATE_RQ = 0x908,
131 MLX5_CMD_OP_MODIFY_RQ = 0x909,
132 MLX5_CMD_OP_DESTROY_RQ = 0x90a,
133 MLX5_CMD_OP_QUERY_RQ = 0x90b,
134 MLX5_CMD_OP_CREATE_RMP = 0x90c,
135 MLX5_CMD_OP_MODIFY_RMP = 0x90d,
136 MLX5_CMD_OP_DESTROY_RMP = 0x90e,
137 MLX5_CMD_OP_QUERY_RMP = 0x90f,
138 MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY = 0x910,
139 MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY = 0x911,
140 MLX5_CMD_OP_MAX = 0x911
141};
142
143struct mlx5_ifc_cmd_hca_cap_bits {
144 u8 reserved_0[0x80];
145
146 u8 log_max_srq_sz[0x8];
147 u8 log_max_qp_sz[0x8];
148 u8 reserved_1[0xb];
149 u8 log_max_qp[0x5];
150
151 u8 log_max_strq_sz[0x8];
152 u8 reserved_2[0x3];
153 u8 log_max_srqs[0x5];
154 u8 reserved_3[0x10];
155
156 u8 reserved_4[0x8];
157 u8 log_max_cq_sz[0x8];
158 u8 reserved_5[0xb];
159 u8 log_max_cq[0x5];
160
161 u8 log_max_eq_sz[0x8];
162 u8 reserved_6[0x2];
163 u8 log_max_mkey[0x6];
164 u8 reserved_7[0xc];
165 u8 log_max_eq[0x4];
166
167 u8 max_indirection[0x8];
168 u8 reserved_8[0x1];
169 u8 log_max_mrw_sz[0x7];
170 u8 reserved_9[0x2];
171 u8 log_max_bsf_list_size[0x6];
172 u8 reserved_10[0x2];
173 u8 log_max_klm_list_size[0x6];
174
175 u8 reserved_11[0xa];
176 u8 log_max_ra_req_dc[0x6];
177 u8 reserved_12[0xa];
178 u8 log_max_ra_res_dc[0x6];
179
180 u8 reserved_13[0xa];
181 u8 log_max_ra_req_qp[0x6];
182 u8 reserved_14[0xa];
183 u8 log_max_ra_res_qp[0x6];
184
185 u8 pad_cap[0x1];
186 u8 cc_query_allowed[0x1];
187 u8 cc_modify_allowed[0x1];
188 u8 reserved_15[0x1d];
189
190 u8 reserved_16[0x6];
191 u8 max_qp_cnt[0xa];
192 u8 pkey_table_size[0x10];
193
194 u8 eswitch_owner[0x1];
195 u8 reserved_17[0xa];
196 u8 local_ca_ack_delay[0x5];
197 u8 reserved_18[0x8];
198 u8 num_ports[0x8];
199
200 u8 reserved_19[0x3];
201 u8 log_max_msg[0x5];
202 u8 reserved_20[0x18];
203
204 u8 stat_rate_support[0x10];
205 u8 reserved_21[0x10];
206
207 u8 reserved_22[0x10];
208 u8 cmdif_checksum[0x2];
209 u8 sigerr_cqe[0x1];
210 u8 reserved_23[0x1];
211 u8 wq_signature[0x1];
212 u8 sctr_data_cqe[0x1];
213 u8 reserved_24[0x1];
214 u8 sho[0x1];
215 u8 tph[0x1];
216 u8 rf[0x1];
217 u8 dc[0x1];
218 u8 reserved_25[0x2];
219 u8 roce[0x1];
220 u8 atomic[0x1];
221 u8 rsz_srq[0x1];
222
223 u8 cq_oi[0x1];
224 u8 cq_resize[0x1];
225 u8 cq_moderation[0x1];
226 u8 sniffer_rule_flow[0x1];
227 u8 sniffer_rule_vport[0x1];
228 u8 sniffer_rule_phy[0x1];
229 u8 reserved_26[0x1];
230 u8 pg[0x1];
231 u8 block_lb_mc[0x1];
232 u8 reserved_27[0x3];
233 u8 cd[0x1];
234 u8 reserved_28[0x1];
235 u8 apm[0x1];
236 u8 reserved_29[0x7];
237 u8 qkv[0x1];
238 u8 pkv[0x1];
239 u8 reserved_30[0x4];
240 u8 xrc[0x1];
241 u8 ud[0x1];
242 u8 uc[0x1];
243 u8 rc[0x1];
244
245 u8 reserved_31[0xa];
246 u8 uar_sz[0x6];
247 u8 reserved_32[0x8];
248 u8 log_pg_sz[0x8];
249
250 u8 bf[0x1];
251 u8 reserved_33[0xa];
252 u8 log_bf_reg_size[0x5];
253 u8 reserved_34[0x10];
254
255 u8 reserved_35[0x10];
256 u8 max_wqe_sz_sq[0x10];
257
258 u8 reserved_36[0x10];
259 u8 max_wqe_sz_rq[0x10];
260
261 u8 reserved_37[0x10];
262 u8 max_wqe_sz_sq_dc[0x10];
263
264 u8 reserved_38[0x7];
265 u8 max_qp_mcg[0x19];
266
267 u8 reserved_39[0x18];
268 u8 log_max_mcg[0x8];
269
270 u8 reserved_40[0xb];
271 u8 log_max_pd[0x5];
272 u8 reserved_41[0xb];
273 u8 log_max_xrcd[0x5];
274
275 u8 reserved_42[0x20];
276
277 u8 reserved_43[0x3];
278 u8 log_max_rq[0x5];
279 u8 reserved_44[0x3];
280 u8 log_max_sq[0x5];
281 u8 reserved_45[0x3];
282 u8 log_max_tir[0x5];
283 u8 reserved_46[0x3];
284 u8 log_max_tis[0x5];
285
286 u8 reserved_47[0x13];
287 u8 log_max_rq_per_tir[0x5];
288 u8 reserved_48[0x3];
289 u8 log_max_tis_per_sq[0x5];
290
291 u8 reserved_49[0xe0];
292
293 u8 reserved_50[0x10];
294 u8 log_uar_page_sz[0x10];
295
296 u8 reserved_51[0x100];
297
298 u8 reserved_52[0x1f];
299 u8 cqe_zip[0x1];
300
301 u8 cqe_zip_timeout[0x10];
302 u8 cqe_zip_max_num[0x10];
303
304 u8 reserved_53[0x220];
305};
306
307struct mlx5_ifc_set_hca_cap_in_bits {
308 u8 opcode[0x10];
309 u8 reserved_0[0x10];
310
311 u8 reserved_1[0x10];
312 u8 op_mod[0x10];
313
314 u8 reserved_2[0x40];
315
316 struct mlx5_ifc_cmd_hca_cap_bits hca_capability_struct;
317};
318
319struct mlx5_ifc_query_hca_cap_in_bits {
320 u8 opcode[0x10];
321 u8 reserved_0[0x10];
322
323 u8 reserved_1[0x10];
324 u8 op_mod[0x10];
325
326 u8 reserved_2[0x40];
327};
328
329struct mlx5_ifc_query_hca_cap_out_bits {
330 u8 status[0x8];
331 u8 reserved_0[0x18];
332
333 u8 syndrome[0x20];
334
335 u8 reserved_1[0x40];
336
337 u8 capability_struct[256][0x8];
338};
339
340struct mlx5_ifc_set_hca_cap_out_bits {
341 u8 status[0x8];
342 u8 reserved_0[0x18];
343
344 u8 syndrome[0x20];
345
346 u8 reserved_1[0x40];
347};
348
349#endif /* MLX5_IFC_H */
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index 9709b30e2d69..3fa075daeb1d 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -40,6 +40,15 @@
40#define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 5) 40#define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 5)
41#define MLX5_DIF_SIZE 8 41#define MLX5_DIF_SIZE 8
42#define MLX5_STRIDE_BLOCK_OP 0x400 42#define MLX5_STRIDE_BLOCK_OP 0x400
43#define MLX5_CPY_GRD_MASK 0xc0
44#define MLX5_CPY_APP_MASK 0x30
45#define MLX5_CPY_REF_MASK 0x0f
46#define MLX5_BSF_INC_REFTAG (1 << 6)
47#define MLX5_BSF_INL_VALID (1 << 15)
48#define MLX5_BSF_REFRESH_DIF (1 << 14)
49#define MLX5_BSF_REPEAT_BLOCK (1 << 7)
50#define MLX5_BSF_APPTAG_ESCAPE 0x1
51#define MLX5_BSF_APPREF_ESCAPE 0x2
43 52
44enum mlx5_qp_optpar { 53enum mlx5_qp_optpar {
45 MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0, 54 MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0,
@@ -287,6 +296,22 @@ struct mlx5_wqe_inline_seg {
287 __be32 byte_count; 296 __be32 byte_count;
288}; 297};
289 298
299enum mlx5_sig_type {
300 MLX5_DIF_CRC = 0x1,
301 MLX5_DIF_IPCS = 0x2,
302};
303
304struct mlx5_bsf_inl {
305 __be16 vld_refresh;
306 __be16 dif_apptag;
307 __be32 dif_reftag;
308 u8 sig_type;
309 u8 rp_inv_seed;
310 u8 rsvd[3];
311 u8 dif_inc_ref_guard_check;
312 __be16 dif_app_bitmask_check;
313};
314
290struct mlx5_bsf { 315struct mlx5_bsf {
291 struct mlx5_bsf_basic { 316 struct mlx5_bsf_basic {
292 u8 bsf_size_sbs; 317 u8 bsf_size_sbs;
@@ -310,14 +335,8 @@ struct mlx5_bsf {
310 __be32 w_tfs_psv; 335 __be32 w_tfs_psv;
311 __be32 m_tfs_psv; 336 __be32 m_tfs_psv;
312 } ext; 337 } ext;
313 struct mlx5_bsf_inl { 338 struct mlx5_bsf_inl w_inl;
314 __be32 w_inl_vld; 339 struct mlx5_bsf_inl m_inl;
315 __be32 w_rsvd;
316 __be64 w_block_format;
317 __be32 m_inl_vld;
318 __be32 m_rsvd;
319 __be64 m_block_format;
320 } inl;
321}; 340};
322 341
323struct mlx5_klm { 342struct mlx5_klm {
@@ -342,10 +361,9 @@ struct mlx5_stride_block_ctrl_seg {
342}; 361};
343 362
344struct mlx5_core_qp { 363struct mlx5_core_qp {
364 struct mlx5_core_rsc_common common; /* must be first */
345 void (*event) (struct mlx5_core_qp *, int); 365 void (*event) (struct mlx5_core_qp *, int);
346 int qpn; 366 int qpn;
347 atomic_t refcount;
348 struct completion free;
349 struct mlx5_rsc_debug *dbg; 367 struct mlx5_rsc_debug *dbg;
350 int pid; 368 int pid;
351}; 369};
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e03dd29145a0..b46461116cd2 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -18,6 +18,7 @@
18#include <linux/pfn.h> 18#include <linux/pfn.h>
19#include <linux/bit_spinlock.h> 19#include <linux/bit_spinlock.h>
20#include <linux/shrinker.h> 20#include <linux/shrinker.h>
21#include <linux/resource.h>
21 22
22struct mempolicy; 23struct mempolicy;
23struct anon_vma; 24struct anon_vma;
@@ -346,6 +347,7 @@ static inline int put_page_unless_one(struct page *page)
346} 347}
347 348
348extern int page_is_ram(unsigned long pfn); 349extern int page_is_ram(unsigned long pfn);
350extern int region_is_ram(resource_size_t phys_addr, unsigned long size);
349 351
350/* Support for virtually mapped pages */ 352/* Support for virtually mapped pages */
351struct page *vmalloc_to_page(const void *addr); 353struct page *vmalloc_to_page(const void *addr);
@@ -553,6 +555,25 @@ static inline void __ClearPageBuddy(struct page *page)
553 atomic_set(&page->_mapcount, -1); 555 atomic_set(&page->_mapcount, -1);
554} 556}
555 557
558#define PAGE_BALLOON_MAPCOUNT_VALUE (-256)
559
560static inline int PageBalloon(struct page *page)
561{
562 return atomic_read(&page->_mapcount) == PAGE_BALLOON_MAPCOUNT_VALUE;
563}
564
565static inline void __SetPageBalloon(struct page *page)
566{
567 VM_BUG_ON_PAGE(atomic_read(&page->_mapcount) != -1, page);
568 atomic_set(&page->_mapcount, PAGE_BALLOON_MAPCOUNT_VALUE);
569}
570
571static inline void __ClearPageBalloon(struct page *page)
572{
573 VM_BUG_ON_PAGE(!PageBalloon(page), page);
574 atomic_set(&page->_mapcount, -1);
575}
576
556void put_page(struct page *page); 577void put_page(struct page *page);
557void put_pages_list(struct list_head *pages); 578void put_pages_list(struct list_head *pages);
558 579
@@ -1155,6 +1176,7 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
1155 1176
1156extern void truncate_pagecache(struct inode *inode, loff_t new); 1177extern void truncate_pagecache(struct inode *inode, loff_t new);
1157extern void truncate_setsize(struct inode *inode, loff_t newsize); 1178extern void truncate_setsize(struct inode *inode, loff_t newsize);
1179void pagecache_isize_extended(struct inode *inode, loff_t from, loff_t to);
1158void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end); 1180void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end);
1159int truncate_inode_page(struct address_space *mapping, struct page *page); 1181int truncate_inode_page(struct address_space *mapping, struct page *page);
1160int generic_error_remove_page(struct address_space *mapping, struct page *page); 1182int generic_error_remove_page(struct address_space *mapping, struct page *page);
@@ -1213,7 +1235,6 @@ int __set_page_dirty_no_writeback(struct page *page);
1213int redirty_page_for_writepage(struct writeback_control *wbc, 1235int redirty_page_for_writepage(struct writeback_control *wbc,
1214 struct page *page); 1236 struct page *page);
1215void account_page_dirtied(struct page *page, struct address_space *mapping); 1237void account_page_dirtied(struct page *page, struct address_space *mapping);
1216void account_page_writeback(struct page *page);
1217int set_page_dirty(struct page *page); 1238int set_page_dirty(struct page *page);
1218int set_page_dirty_lock(struct page *page); 1239int set_page_dirty_lock(struct page *page);
1219int clear_page_dirty_for_io(struct page *page); 1240int clear_page_dirty_for_io(struct page *page);
@@ -1247,8 +1268,8 @@ static inline int stack_guard_page_end(struct vm_area_struct *vma,
1247 !vma_growsup(vma->vm_next, addr); 1268 !vma_growsup(vma->vm_next, addr);
1248} 1269}
1249 1270
1250extern pid_t 1271extern struct task_struct *task_of_stack(struct task_struct *task,
1251vm_is_stack(struct task_struct *task, struct vm_area_struct *vma, int in_group); 1272 struct vm_area_struct *vma, bool in_group);
1252 1273
1253extern unsigned long move_page_tables(struct vm_area_struct *vma, 1274extern unsigned long move_page_tables(struct vm_area_struct *vma,
1254 unsigned long old_addr, struct vm_area_struct *new_vma, 1275 unsigned long old_addr, struct vm_area_struct *new_vma,
@@ -1780,6 +1801,20 @@ extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
1780 bool *need_rmap_locks); 1801 bool *need_rmap_locks);
1781extern void exit_mmap(struct mm_struct *); 1802extern void exit_mmap(struct mm_struct *);
1782 1803
1804static inline int check_data_rlimit(unsigned long rlim,
1805 unsigned long new,
1806 unsigned long start,
1807 unsigned long end_data,
1808 unsigned long start_data)
1809{
1810 if (rlim < RLIM_INFINITY) {
1811 if (((new - start) + (end_data - start_data)) > rlim)
1812 return -ENOSPC;
1813 }
1814
1815 return 0;
1816}
1817
1783extern int mm_take_all_locks(struct mm_struct *mm); 1818extern int mm_take_all_locks(struct mm_struct *mm);
1784extern void mm_drop_all_locks(struct mm_struct *mm); 1819extern void mm_drop_all_locks(struct mm_struct *mm);
1785 1820
@@ -1939,11 +1974,16 @@ static inline struct vm_area_struct *find_exact_vma(struct mm_struct *mm,
1939 1974
1940#ifdef CONFIG_MMU 1975#ifdef CONFIG_MMU
1941pgprot_t vm_get_page_prot(unsigned long vm_flags); 1976pgprot_t vm_get_page_prot(unsigned long vm_flags);
1977void vma_set_page_prot(struct vm_area_struct *vma);
1942#else 1978#else
1943static inline pgprot_t vm_get_page_prot(unsigned long vm_flags) 1979static inline pgprot_t vm_get_page_prot(unsigned long vm_flags)
1944{ 1980{
1945 return __pgprot(0); 1981 return __pgprot(0);
1946} 1982}
1983static inline void vma_set_page_prot(struct vm_area_struct *vma)
1984{
1985 vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
1986}
1947#endif 1987#endif
1948 1988
1949#ifdef CONFIG_NUMA_BALANCING 1989#ifdef CONFIG_NUMA_BALANCING
@@ -1985,6 +2025,7 @@ static inline struct page *follow_page(struct vm_area_struct *vma,
1985#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ 2025#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */
1986#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */ 2026#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */
1987#define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */ 2027#define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */
2028#define FOLL_TRIED 0x800 /* a retry, previous pass started an IO */
1988 2029
1989typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, 2030typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
1990 void *data); 2031 void *data);
@@ -2014,13 +2055,20 @@ static inline bool kernel_page_present(struct page *page) { return true; }
2014#endif /* CONFIG_HIBERNATION */ 2055#endif /* CONFIG_HIBERNATION */
2015#endif 2056#endif
2016 2057
2058#ifdef __HAVE_ARCH_GATE_AREA
2017extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm); 2059extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm);
2018#ifdef __HAVE_ARCH_GATE_AREA 2060extern int in_gate_area_no_mm(unsigned long addr);
2019int in_gate_area_no_mm(unsigned long addr); 2061extern int in_gate_area(struct mm_struct *mm, unsigned long addr);
2020int in_gate_area(struct mm_struct *mm, unsigned long addr);
2021#else 2062#else
2022int in_gate_area_no_mm(unsigned long addr); 2063static inline struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
2023#define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);}) 2064{
2065 return NULL;
2066}
2067static inline int in_gate_area_no_mm(unsigned long addr) { return 0; }
2068static inline int in_gate_area(struct mm_struct *mm, unsigned long addr)
2069{
2070 return 0;
2071}
2024#endif /* __HAVE_ARCH_GATE_AREA */ 2072#endif /* __HAVE_ARCH_GATE_AREA */
2025 2073
2026#ifdef CONFIG_SYSCTL 2074#ifdef CONFIG_SYSCTL
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 796deac19fcf..6e0b286649f1 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -461,6 +461,7 @@ static inline void mm_init_cpumask(struct mm_struct *mm)
461#ifdef CONFIG_CPUMASK_OFFSTACK 461#ifdef CONFIG_CPUMASK_OFFSTACK
462 mm->cpu_vm_mask_var = &mm->cpumask_allocation; 462 mm->cpu_vm_mask_var = &mm->cpumask_allocation;
463#endif 463#endif
464 cpumask_clear(mm->cpu_vm_mask_var);
464} 465}
465 466
466/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */ 467/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index d424b9de3aff..b0692d28f8e6 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -42,7 +42,8 @@ struct mmc_csd {
42 unsigned int read_partial:1, 42 unsigned int read_partial:1,
43 read_misalign:1, 43 read_misalign:1,
44 write_partial:1, 44 write_partial:1,
45 write_misalign:1; 45 write_misalign:1,
46 dsr_imp:1;
46}; 47};
47 48
48struct mmc_ext_csd { 49struct mmc_ext_csd {
@@ -74,7 +75,7 @@ struct mmc_ext_csd {
74 unsigned int sec_trim_mult; /* Secure trim multiplier */ 75 unsigned int sec_trim_mult; /* Secure trim multiplier */
75 unsigned int sec_erase_mult; /* Secure erase multiplier */ 76 unsigned int sec_erase_mult; /* Secure erase multiplier */
76 unsigned int trim_timeout; /* In milliseconds */ 77 unsigned int trim_timeout; /* In milliseconds */
77 bool enhanced_area_en; /* enable bit */ 78 bool partition_setting_completed; /* enable bit */
78 unsigned long long enhanced_area_offset; /* Units: Byte */ 79 unsigned long long enhanced_area_offset; /* Units: Byte */
79 unsigned int enhanced_area_size; /* Units: KB */ 80 unsigned int enhanced_area_size; /* Units: KB */
80 unsigned int cache_size; /* Units: KB */ 81 unsigned int cache_size; /* Units: KB */
@@ -214,11 +215,12 @@ enum mmc_blk_status {
214}; 215};
215 216
216/* The number of MMC physical partitions. These consist of: 217/* The number of MMC physical partitions. These consist of:
217 * boot partitions (2), general purpose partitions (4) in MMC v4.4. 218 * boot partitions (2), general purpose partitions (4) and
219 * RPMB partition (1) in MMC v4.4.
218 */ 220 */
219#define MMC_NUM_BOOT_PARTITION 2 221#define MMC_NUM_BOOT_PARTITION 2
220#define MMC_NUM_GP_PARTITION 4 222#define MMC_NUM_GP_PARTITION 4
221#define MMC_NUM_PHY_PARTITION 6 223#define MMC_NUM_PHY_PARTITION 7
222#define MAX_MMC_PART_NAME_LEN 20 224#define MAX_MMC_PART_NAME_LEN 20
223 225
224/* 226/*
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index babaea93bca6..001366927cf4 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -26,6 +26,8 @@ enum dw_mci_state {
26 STATE_DATA_BUSY, 26 STATE_DATA_BUSY,
27 STATE_SENDING_STOP, 27 STATE_SENDING_STOP,
28 STATE_DATA_ERROR, 28 STATE_DATA_ERROR,
29 STATE_SENDING_CMD11,
30 STATE_WAITING_CMD11_DONE,
29}; 31};
30 32
31enum { 33enum {
@@ -188,7 +190,7 @@ struct dw_mci {
188 /* Workaround flags */ 190 /* Workaround flags */
189 u32 quirks; 191 u32 quirks;
190 192
191 struct regulator *vmmc; /* Power regulator */ 193 bool vqmmc_enabled;
192 unsigned long irq_flags; /* IRQ flags */ 194 unsigned long irq_flags; /* IRQ flags */
193 int irq; 195 int irq;
194}; 196};
@@ -213,6 +215,8 @@ struct dw_mci_dma_ops {
213#define DW_MCI_QUIRK_HIGHSPEED BIT(2) 215#define DW_MCI_QUIRK_HIGHSPEED BIT(2)
214/* Unreliable card detection */ 216/* Unreliable card detection */
215#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3) 217#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)
218/* No write protect */
219#define DW_MCI_QUIRK_NO_WRITE_PROTECT BIT(4)
216 220
217/* Slot level quirks */ 221/* Slot level quirks */
218/* This slot has no write protect */ 222/* This slot has no write protect */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 7960424d0bc0..df0c15396bbf 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -42,6 +42,7 @@ struct mmc_ios {
42#define MMC_POWER_OFF 0 42#define MMC_POWER_OFF 0
43#define MMC_POWER_UP 1 43#define MMC_POWER_UP 1
44#define MMC_POWER_ON 2 44#define MMC_POWER_ON 2
45#define MMC_POWER_UNDEFINED 3
45 46
46 unsigned char bus_width; /* data bus width */ 47 unsigned char bus_width; /* data bus width */
47 48
@@ -139,6 +140,13 @@ struct mmc_host_ops {
139 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); 140 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
140 void (*hw_reset)(struct mmc_host *host); 141 void (*hw_reset)(struct mmc_host *host);
141 void (*card_event)(struct mmc_host *host); 142 void (*card_event)(struct mmc_host *host);
143
144 /*
145 * Optional callback to support controllers with HW issues for multiple
146 * I/O. Returns the number of supported blocks for the request.
147 */
148 int (*multi_io_quirk)(struct mmc_card *card,
149 unsigned int direction, int blk_size);
142}; 150};
143 151
144struct mmc_card; 152struct mmc_card;
@@ -265,7 +273,6 @@ struct mmc_host {
265 273
266#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */ 274#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
267#define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */ 275#define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */
268#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
269#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */ 276#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
270#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */ 277#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */
271#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ 278#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
@@ -365,6 +372,9 @@ struct mmc_host {
365 372
366 unsigned int slotno; /* used for sdio acpi binding */ 373 unsigned int slotno; /* used for sdio acpi binding */
367 374
375 int dsr_req; /* DSR value is valid */
376 u32 dsr; /* optional driver stage (DSR) value */
377
368 unsigned long private[0] ____cacheline_aligned; 378 unsigned long private[0] ____cacheline_aligned;
369}; 379};
370 380
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 64ec963ed347..1cd00b3a75b9 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -53,6 +53,11 @@
53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */ 53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */
54#define MMC_SEND_TUNING_BLOCK_HS200 21 /* adtc R1 */ 54#define MMC_SEND_TUNING_BLOCK_HS200 21 /* adtc R1 */
55 55
56#define MMC_TUNING_BLK_PATTERN_4BIT_SIZE 64
57#define MMC_TUNING_BLK_PATTERN_8BIT_SIZE 128
58extern const u8 tuning_blk_pattern_4bit[MMC_TUNING_BLK_PATTERN_4BIT_SIZE];
59extern const u8 tuning_blk_pattern_8bit[MMC_TUNING_BLK_PATTERN_8BIT_SIZE];
60
56 /* class 3 */ 61 /* class 3 */
57#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */ 62#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */
58 63
@@ -281,6 +286,7 @@ struct _mmc_csd {
281#define EXT_CSD_EXP_EVENTS_CTRL 56 /* R/W, 2 bytes */ 286#define EXT_CSD_EXP_EVENTS_CTRL 56 /* R/W, 2 bytes */
282#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */ 287#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */
283#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */ 288#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */
289#define EXT_CSD_PARTITION_SETTING_COMPLETED 155 /* R/W */
284#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ 290#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
285#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ 291#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
286#define EXT_CSD_HPI_MGMT 161 /* R/W */ 292#define EXT_CSD_HPI_MGMT 161 /* R/W */
@@ -349,6 +355,7 @@ struct _mmc_csd {
349#define EXT_CSD_PART_CONFIG_ACC_RPMB (0x3) 355#define EXT_CSD_PART_CONFIG_ACC_RPMB (0x3)
350#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4) 356#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4)
351 357
358#define EXT_CSD_PART_SETTING_COMPLETED (0x1)
352#define EXT_CSD_PART_SUPPORT_PART_EN (0x1) 359#define EXT_CSD_PART_SUPPORT_PART_EN (0x1)
353 360
354#define EXT_CSD_CMD_SET_NORMAL (1<<0) 361#define EXT_CSD_CMD_SET_NORMAL (1<<0)
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 08abe9941884..dba793e3a331 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -98,15 +98,14 @@ struct sdhci_host {
98#define SDHCI_QUIRK2_BROKEN_HS200 (1<<6) 98#define SDHCI_QUIRK2_BROKEN_HS200 (1<<6)
99/* Controller does not support DDR50 */ 99/* Controller does not support DDR50 */
100#define SDHCI_QUIRK2_BROKEN_DDR50 (1<<7) 100#define SDHCI_QUIRK2_BROKEN_DDR50 (1<<7)
101/* Stop command (CMD12) can set Transfer Complete when not using MMC_RSP_BUSY */
102#define SDHCI_QUIRK2_STOP_WITH_TC (1<<8)
101 103
102 int irq; /* Device IRQ */ 104 int irq; /* Device IRQ */
103 void __iomem *ioaddr; /* Mapped address */ 105 void __iomem *ioaddr; /* Mapped address */
104 106
105 const struct sdhci_ops *ops; /* Low level hw interface */ 107 const struct sdhci_ops *ops; /* Low level hw interface */
106 108
107 struct regulator *vmmc; /* Power regulator (vmmc) */
108 struct regulator *vqmmc; /* Signaling regulator (vccq) */
109
110 /* Internal data */ 109 /* Internal data */
111 struct mmc_host *mmc; /* MMC structure */ 110 struct mmc_host *mmc; /* MMC structure */
112 u64 dma_mask; /* custom DMA mask */ 111 u64 dma_mask; /* custom DMA mask */
@@ -149,6 +148,7 @@ struct sdhci_host {
149 struct mmc_command *cmd; /* Current command */ 148 struct mmc_command *cmd; /* Current command */
150 struct mmc_data *data; /* Current data request */ 149 struct mmc_data *data; /* Current data request */
151 unsigned int data_early:1; /* Data finished before cmd */ 150 unsigned int data_early:1; /* Data finished before cmd */
151 unsigned int busy_handle:1; /* Handling the order of Busy-end */
152 152
153 struct sg_mapping_iter sg_miter; /* SG state for PIO */ 153 struct sg_mapping_iter sg_miter; /* SG state for PIO */
154 unsigned int blocks; /* remaining PIO blocks */ 154 unsigned int blocks; /* remaining PIO blocks */
diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h
index d2433381e828..e56fa24c9322 100644
--- a/include/linux/mmc/slot-gpio.h
+++ b/include/linux/mmc/slot-gpio.h
@@ -24,7 +24,10 @@ void mmc_gpio_free_cd(struct mmc_host *host);
24 24
25int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id, 25int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id,
26 unsigned int idx, bool override_active_level, 26 unsigned int idx, bool override_active_level,
27 unsigned int debounce); 27 unsigned int debounce, bool *gpio_invert);
28int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id,
29 unsigned int idx, bool override_active_level,
30 unsigned int debounce, bool *gpio_invert);
28void mmc_gpiod_free_cd(struct mmc_host *host); 31void mmc_gpiod_free_cd(struct mmc_host *host);
29void mmc_gpiod_request_cd_irq(struct mmc_host *host); 32void mmc_gpiod_request_cd_irq(struct mmc_host *host);
30 33
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index edd82a105220..877ef226f90f 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -4,10 +4,14 @@
4#include <linux/stringify.h> 4#include <linux/stringify.h>
5 5
6struct page; 6struct page;
7struct vm_area_struct;
8struct mm_struct;
7 9
8extern void dump_page(struct page *page, const char *reason); 10extern void dump_page(struct page *page, const char *reason);
9extern void dump_page_badflags(struct page *page, const char *reason, 11extern void dump_page_badflags(struct page *page, const char *reason,
10 unsigned long badflags); 12 unsigned long badflags);
13void dump_vma(const struct vm_area_struct *vma);
14void dump_mm(const struct mm_struct *mm);
11 15
12#ifdef CONFIG_DEBUG_VM 16#ifdef CONFIG_DEBUG_VM
13#define VM_BUG_ON(cond) BUG_ON(cond) 17#define VM_BUG_ON(cond) BUG_ON(cond)
@@ -18,13 +22,31 @@ extern void dump_page_badflags(struct page *page, const char *reason,
18 BUG(); \ 22 BUG(); \
19 } \ 23 } \
20 } while (0) 24 } while (0)
25#define VM_BUG_ON_VMA(cond, vma) \
26 do { \
27 if (unlikely(cond)) { \
28 dump_vma(vma); \
29 BUG(); \
30 } \
31 } while (0)
32#define VM_BUG_ON_MM(cond, mm) \
33 do { \
34 if (unlikely(cond)) { \
35 dump_mm(mm); \
36 BUG(); \
37 } \
38 } while (0)
21#define VM_WARN_ON(cond) WARN_ON(cond) 39#define VM_WARN_ON(cond) WARN_ON(cond)
22#define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond) 40#define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond)
41#define VM_WARN_ONCE(cond, format...) WARN_ONCE(cond, format)
23#else 42#else
24#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond) 43#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
25#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond) 44#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
45#define VM_BUG_ON_VMA(cond, vma) VM_BUG_ON(cond)
46#define VM_BUG_ON_MM(cond, mm) VM_BUG_ON(cond)
26#define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond) 47#define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond)
27#define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond) 48#define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond)
49#define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond)
28#endif 50#endif
29 51
30#ifdef CONFIG_DEBUG_VIRTUAL 52#ifdef CONFIG_DEBUG_VIRTUAL
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index deca87452528..88787bb4b3b9 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -57,10 +57,13 @@ struct mmu_notifier_ops {
57 * pte. This way the VM will provide proper aging to the 57 * pte. This way the VM will provide proper aging to the
58 * accesses to the page through the secondary MMUs and not 58 * accesses to the page through the secondary MMUs and not
59 * only to the ones through the Linux pte. 59 * only to the ones through the Linux pte.
60 * Start-end is necessary in case the secondary MMU is mapping the page
61 * at a smaller granularity than the primary MMU.
60 */ 62 */
61 int (*clear_flush_young)(struct mmu_notifier *mn, 63 int (*clear_flush_young)(struct mmu_notifier *mn,
62 struct mm_struct *mm, 64 struct mm_struct *mm,
63 unsigned long address); 65 unsigned long start,
66 unsigned long end);
64 67
65 /* 68 /*
66 * test_young is called to check the young/accessed bitflag in 69 * test_young is called to check the young/accessed bitflag in
@@ -170,10 +173,13 @@ extern int __mmu_notifier_register(struct mmu_notifier *mn,
170 struct mm_struct *mm); 173 struct mm_struct *mm);
171extern void mmu_notifier_unregister(struct mmu_notifier *mn, 174extern void mmu_notifier_unregister(struct mmu_notifier *mn,
172 struct mm_struct *mm); 175 struct mm_struct *mm);
176extern void mmu_notifier_unregister_no_release(struct mmu_notifier *mn,
177 struct mm_struct *mm);
173extern void __mmu_notifier_mm_destroy(struct mm_struct *mm); 178extern void __mmu_notifier_mm_destroy(struct mm_struct *mm);
174extern void __mmu_notifier_release(struct mm_struct *mm); 179extern void __mmu_notifier_release(struct mm_struct *mm);
175extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm, 180extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm,
176 unsigned long address); 181 unsigned long start,
182 unsigned long end);
177extern int __mmu_notifier_test_young(struct mm_struct *mm, 183extern int __mmu_notifier_test_young(struct mm_struct *mm,
178 unsigned long address); 184 unsigned long address);
179extern void __mmu_notifier_change_pte(struct mm_struct *mm, 185extern void __mmu_notifier_change_pte(struct mm_struct *mm,
@@ -192,10 +198,11 @@ static inline void mmu_notifier_release(struct mm_struct *mm)
192} 198}
193 199
194static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm, 200static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
195 unsigned long address) 201 unsigned long start,
202 unsigned long end)
196{ 203{
197 if (mm_has_notifiers(mm)) 204 if (mm_has_notifiers(mm))
198 return __mmu_notifier_clear_flush_young(mm, address); 205 return __mmu_notifier_clear_flush_young(mm, start, end);
199 return 0; 206 return 0;
200} 207}
201 208
@@ -253,7 +260,9 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
253 unsigned long ___address = __address; \ 260 unsigned long ___address = __address; \
254 __young = ptep_clear_flush_young(___vma, ___address, __ptep); \ 261 __young = ptep_clear_flush_young(___vma, ___address, __ptep); \
255 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \ 262 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \
256 ___address); \ 263 ___address, \
264 ___address + \
265 PAGE_SIZE); \
257 __young; \ 266 __young; \
258}) 267})
259 268
@@ -264,7 +273,9 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
264 unsigned long ___address = __address; \ 273 unsigned long ___address = __address; \
265 __young = pmdp_clear_flush_young(___vma, ___address, __pmdp); \ 274 __young = pmdp_clear_flush_young(___vma, ___address, __pmdp); \
266 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \ 275 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \
267 ___address); \ 276 ___address, \
277 ___address + \
278 PMD_SIZE); \
268 __young; \ 279 __young; \
269}) 280})
270 281
@@ -288,6 +299,10 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
288 set_pte_at(___mm, ___address, __ptep, ___pte); \ 299 set_pte_at(___mm, ___address, __ptep, ___pte); \
289}) 300})
290 301
302extern void mmu_notifier_call_srcu(struct rcu_head *rcu,
303 void (*func)(struct rcu_head *rcu));
304extern void mmu_notifier_synchronize(void);
305
291#else /* CONFIG_MMU_NOTIFIER */ 306#else /* CONFIG_MMU_NOTIFIER */
292 307
293static inline void mmu_notifier_release(struct mm_struct *mm) 308static inline void mmu_notifier_release(struct mm_struct *mm)
@@ -295,7 +310,8 @@ static inline void mmu_notifier_release(struct mm_struct *mm)
295} 310}
296 311
297static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm, 312static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
298 unsigned long address) 313 unsigned long start,
314 unsigned long end)
299{ 315{
300 return 0; 316 return 0;
301} 317}
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 6cbd1b6c3d20..ffe66e381c04 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -143,6 +143,7 @@ enum zone_stat_item {
143 NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */ 143 NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */
144 NR_DIRTIED, /* page dirtyings since bootup */ 144 NR_DIRTIED, /* page dirtyings since bootup */
145 NR_WRITTEN, /* page writings since bootup */ 145 NR_WRITTEN, /* page writings since bootup */
146 NR_PAGES_SCANNED, /* pages scanned since last reclaim */
146#ifdef CONFIG_NUMA 147#ifdef CONFIG_NUMA
147 NUMA_HIT, /* allocated in intended node */ 148 NUMA_HIT, /* allocated in intended node */
148 NUMA_MISS, /* allocated in non intended node */ 149 NUMA_MISS, /* allocated in non intended node */
@@ -324,19 +325,12 @@ enum zone_type {
324#ifndef __GENERATING_BOUNDS_H 325#ifndef __GENERATING_BOUNDS_H
325 326
326struct zone { 327struct zone {
327 /* Fields commonly accessed by the page allocator */ 328 /* Read-mostly fields */
328 329
329 /* zone watermarks, access with *_wmark_pages(zone) macros */ 330 /* zone watermarks, access with *_wmark_pages(zone) macros */
330 unsigned long watermark[NR_WMARK]; 331 unsigned long watermark[NR_WMARK];
331 332
332 /* 333 /*
333 * When free pages are below this point, additional steps are taken
334 * when reading the number of free pages to avoid per-cpu counter
335 * drift allowing watermarks to be breached
336 */
337 unsigned long percpu_drift_mark;
338
339 /*
340 * We don't know if the memory that we're going to allocate will be freeable 334 * We don't know if the memory that we're going to allocate will be freeable
341 * or/and it will be released eventually, so to avoid totally wasting several 335 * or/and it will be released eventually, so to avoid totally wasting several
342 * GB of ram we must reserve some of the lower zone memory (otherwise we risk 336 * GB of ram we must reserve some of the lower zone memory (otherwise we risk
@@ -344,41 +338,26 @@ struct zone {
344 * on the higher zones). This array is recalculated at runtime if the 338 * on the higher zones). This array is recalculated at runtime if the
345 * sysctl_lowmem_reserve_ratio sysctl changes. 339 * sysctl_lowmem_reserve_ratio sysctl changes.
346 */ 340 */
347 unsigned long lowmem_reserve[MAX_NR_ZONES]; 341 long lowmem_reserve[MAX_NR_ZONES];
348
349 /*
350 * This is a per-zone reserve of pages that should not be
351 * considered dirtyable memory.
352 */
353 unsigned long dirty_balance_reserve;
354 342
355#ifdef CONFIG_NUMA 343#ifdef CONFIG_NUMA
356 int node; 344 int node;
345#endif
346
357 /* 347 /*
358 * zone reclaim becomes active if more unmapped pages exist. 348 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on
349 * this zone's LRU. Maintained by the pageout code.
359 */ 350 */
360 unsigned long min_unmapped_pages; 351 unsigned int inactive_ratio;
361 unsigned long min_slab_pages; 352
362#endif 353 struct pglist_data *zone_pgdat;
363 struct per_cpu_pageset __percpu *pageset; 354 struct per_cpu_pageset __percpu *pageset;
355
364 /* 356 /*
365 * free areas of different sizes 357 * This is a per-zone reserve of pages that should not be
358 * considered dirtyable memory.
366 */ 359 */
367 spinlock_t lock; 360 unsigned long dirty_balance_reserve;
368#if defined CONFIG_COMPACTION || defined CONFIG_CMA
369 /* Set to true when the PG_migrate_skip bits should be cleared */
370 bool compact_blockskip_flush;
371
372 /* pfn where compaction free scanner should start */
373 unsigned long compact_cached_free_pfn;
374 /* pfn where async and sync compaction migration scanner should start */
375 unsigned long compact_cached_migrate_pfn[2];
376#endif
377#ifdef CONFIG_MEMORY_HOTPLUG
378 /* see spanned/present_pages for more description */
379 seqlock_t span_seqlock;
380#endif
381 struct free_area free_area[MAX_ORDER];
382 361
383#ifndef CONFIG_SPARSEMEM 362#ifndef CONFIG_SPARSEMEM
384 /* 363 /*
@@ -388,74 +367,14 @@ struct zone {
388 unsigned long *pageblock_flags; 367 unsigned long *pageblock_flags;
389#endif /* CONFIG_SPARSEMEM */ 368#endif /* CONFIG_SPARSEMEM */
390 369
391#ifdef CONFIG_COMPACTION 370#ifdef CONFIG_NUMA
392 /*
393 * On compaction failure, 1<<compact_defer_shift compactions
394 * are skipped before trying again. The number attempted since
395 * last failure is tracked with compact_considered.
396 */
397 unsigned int compact_considered;
398 unsigned int compact_defer_shift;
399 int compact_order_failed;
400#endif
401
402 ZONE_PADDING(_pad1_)
403
404 /* Fields commonly accessed by the page reclaim scanner */
405 spinlock_t lru_lock;
406 struct lruvec lruvec;
407
408 /* Evictions & activations on the inactive file list */
409 atomic_long_t inactive_age;
410
411 unsigned long pages_scanned; /* since last reclaim */
412 unsigned long flags; /* zone flags, see below */
413
414 /* Zone statistics */
415 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
416
417 /*
418 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on
419 * this zone's LRU. Maintained by the pageout code.
420 */
421 unsigned int inactive_ratio;
422
423
424 ZONE_PADDING(_pad2_)
425 /* Rarely used or read-mostly fields */
426
427 /* 371 /*
428 * wait_table -- the array holding the hash table 372 * zone reclaim becomes active if more unmapped pages exist.
429 * wait_table_hash_nr_entries -- the size of the hash table array
430 * wait_table_bits -- wait_table_size == (1 << wait_table_bits)
431 *
432 * The purpose of all these is to keep track of the people
433 * waiting for a page to become available and make them
434 * runnable again when possible. The trouble is that this
435 * consumes a lot of space, especially when so few things
436 * wait on pages at a given time. So instead of using
437 * per-page waitqueues, we use a waitqueue hash table.
438 *
439 * The bucket discipline is to sleep on the same queue when
440 * colliding and wake all in that wait queue when removing.
441 * When something wakes, it must check to be sure its page is
442 * truly available, a la thundering herd. The cost of a
443 * collision is great, but given the expected load of the
444 * table, they should be so rare as to be outweighed by the
445 * benefits from the saved space.
446 *
447 * __wait_on_page_locked() and unlock_page() in mm/filemap.c, are the
448 * primary users of these fields, and in mm/page_alloc.c
449 * free_area_init_core() performs the initialization of them.
450 */ 373 */
451 wait_queue_head_t * wait_table; 374 unsigned long min_unmapped_pages;
452 unsigned long wait_table_hash_nr_entries; 375 unsigned long min_slab_pages;
453 unsigned long wait_table_bits; 376#endif /* CONFIG_NUMA */
454 377
455 /*
456 * Discontig memory support fields.
457 */
458 struct pglist_data *zone_pgdat;
459 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */ 378 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */
460 unsigned long zone_start_pfn; 379 unsigned long zone_start_pfn;
461 380
@@ -500,9 +419,11 @@ struct zone {
500 * adjust_managed_page_count() should be used instead of directly 419 * adjust_managed_page_count() should be used instead of directly
501 * touching zone->managed_pages and totalram_pages. 420 * touching zone->managed_pages and totalram_pages.
502 */ 421 */
422 unsigned long managed_pages;
503 unsigned long spanned_pages; 423 unsigned long spanned_pages;
504 unsigned long present_pages; 424 unsigned long present_pages;
505 unsigned long managed_pages; 425
426 const char *name;
506 427
507 /* 428 /*
508 * Number of MIGRATE_RESEVE page block. To maintain for just 429 * Number of MIGRATE_RESEVE page block. To maintain for just
@@ -510,66 +431,120 @@ struct zone {
510 */ 431 */
511 int nr_migrate_reserve_block; 432 int nr_migrate_reserve_block;
512 433
434#ifdef CONFIG_MEMORY_ISOLATION
513 /* 435 /*
514 * rarely used fields: 436 * Number of isolated pageblock. It is used to solve incorrect
437 * freepage counting problem due to racy retrieving migratetype
438 * of pageblock. Protected by zone->lock.
515 */ 439 */
516 const char *name; 440 unsigned long nr_isolate_pageblock;
441#endif
442
443#ifdef CONFIG_MEMORY_HOTPLUG
444 /* see spanned/present_pages for more description */
445 seqlock_t span_seqlock;
446#endif
447
448 /*
449 * wait_table -- the array holding the hash table
450 * wait_table_hash_nr_entries -- the size of the hash table array
451 * wait_table_bits -- wait_table_size == (1 << wait_table_bits)
452 *
453 * The purpose of all these is to keep track of the people
454 * waiting for a page to become available and make them
455 * runnable again when possible. The trouble is that this
456 * consumes a lot of space, especially when so few things
457 * wait on pages at a given time. So instead of using
458 * per-page waitqueues, we use a waitqueue hash table.
459 *
460 * The bucket discipline is to sleep on the same queue when
461 * colliding and wake all in that wait queue when removing.
462 * When something wakes, it must check to be sure its page is
463 * truly available, a la thundering herd. The cost of a
464 * collision is great, but given the expected load of the
465 * table, they should be so rare as to be outweighed by the
466 * benefits from the saved space.
467 *
468 * __wait_on_page_locked() and unlock_page() in mm/filemap.c, are the
469 * primary users of these fields, and in mm/page_alloc.c
470 * free_area_init_core() performs the initialization of them.
471 */
472 wait_queue_head_t *wait_table;
473 unsigned long wait_table_hash_nr_entries;
474 unsigned long wait_table_bits;
475
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 */
482 struct free_area free_area[MAX_ORDER];
483
484 /* zone flags, see below */
485 unsigned long flags;
486
487 ZONE_PADDING(_pad2_)
488
489 /* Write-intensive fields used by page reclaim */
490
491 /* Fields commonly accessed by the page reclaim scanner */
492 spinlock_t lru_lock;
493 struct lruvec lruvec;
494
495 /* Evictions & activations on the inactive file list */
496 atomic_long_t inactive_age;
497
498 /*
499 * When free pages are below this point, additional steps are taken
500 * when reading the number of free pages to avoid per-cpu counter
501 * drift allowing watermarks to be breached
502 */
503 unsigned long percpu_drift_mark;
504
505#if defined CONFIG_COMPACTION || defined CONFIG_CMA
506 /* pfn where compaction free scanner should start */
507 unsigned long compact_cached_free_pfn;
508 /* pfn where async and sync compaction migration scanner should start */
509 unsigned long compact_cached_migrate_pfn[2];
510#endif
511
512#ifdef CONFIG_COMPACTION
513 /*
514 * On compaction failure, 1<<compact_defer_shift compactions
515 * are skipped before trying again. The number attempted since
516 * last failure is tracked with compact_considered.
517 */
518 unsigned int compact_considered;
519 unsigned int compact_defer_shift;
520 int compact_order_failed;
521#endif
522
523#if defined CONFIG_COMPACTION || defined CONFIG_CMA
524 /* Set to true when the PG_migrate_skip bits should be cleared */
525 bool compact_blockskip_flush;
526#endif
527
528 ZONE_PADDING(_pad3_)
529 /* Zone statistics */
530 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
517} ____cacheline_internodealigned_in_smp; 531} ____cacheline_internodealigned_in_smp;
518 532
519typedef enum { 533enum zone_flags {
520 ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */ 534 ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */
521 ZONE_OOM_LOCKED, /* zone is in OOM killer zonelist */ 535 ZONE_OOM_LOCKED, /* zone is in OOM killer zonelist */
522 ZONE_CONGESTED, /* zone has many dirty pages backed by 536 ZONE_CONGESTED, /* zone has many dirty pages backed by
523 * a congested BDI 537 * a congested BDI
524 */ 538 */
525 ZONE_TAIL_LRU_DIRTY, /* reclaim scanning has recently found 539 ZONE_DIRTY, /* reclaim scanning has recently found
526 * many dirty file pages at the tail 540 * many dirty file pages at the tail
527 * of the LRU. 541 * of the LRU.
528 */ 542 */
529 ZONE_WRITEBACK, /* reclaim scanning has recently found 543 ZONE_WRITEBACK, /* reclaim scanning has recently found
530 * many pages under writeback 544 * many pages under writeback
531 */ 545 */
532} zone_flags_t; 546 ZONE_FAIR_DEPLETED, /* fair zone policy batch depleted */
533 547};
534static inline void zone_set_flag(struct zone *zone, zone_flags_t flag)
535{
536 set_bit(flag, &zone->flags);
537}
538
539static inline int zone_test_and_set_flag(struct zone *zone, zone_flags_t flag)
540{
541 return test_and_set_bit(flag, &zone->flags);
542}
543
544static inline void zone_clear_flag(struct zone *zone, zone_flags_t flag)
545{
546 clear_bit(flag, &zone->flags);
547}
548
549static inline int zone_is_reclaim_congested(const struct zone *zone)
550{
551 return test_bit(ZONE_CONGESTED, &zone->flags);
552}
553
554static inline int zone_is_reclaim_dirty(const struct zone *zone)
555{
556 return test_bit(ZONE_TAIL_LRU_DIRTY, &zone->flags);
557}
558
559static inline int zone_is_reclaim_writeback(const struct zone *zone)
560{
561 return test_bit(ZONE_WRITEBACK, &zone->flags);
562}
563
564static inline int zone_is_reclaim_locked(const struct zone *zone)
565{
566 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags);
567}
568
569static inline int zone_is_oom_locked(const struct zone *zone)
570{
571 return test_bit(ZONE_OOM_LOCKED, &zone->flags);
572}
573 548
574static inline unsigned long zone_end_pfn(const struct zone *zone) 549static inline unsigned long zone_end_pfn(const struct zone *zone)
575{ 550{
@@ -872,6 +847,8 @@ static inline int zone_movable_is_highmem(void)
872{ 847{
873#if defined(CONFIG_HIGHMEM) && defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) 848#if defined(CONFIG_HIGHMEM) && defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
874 return movable_zone == ZONE_HIGHMEM; 849 return movable_zone == ZONE_HIGHMEM;
850#elif defined(CONFIG_HIGHMEM)
851 return (ZONE_MOVABLE - 1) == ZONE_HIGHMEM;
875#else 852#else
876 return 0; 853 return 0;
877#endif 854#endif
diff --git a/include/linux/module.h b/include/linux/module.h
index f520a767c86c..71f282a4e307 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -396,18 +396,25 @@ bool is_module_address(unsigned long addr);
396bool is_module_percpu_address(unsigned long addr); 396bool is_module_percpu_address(unsigned long addr);
397bool is_module_text_address(unsigned long addr); 397bool is_module_text_address(unsigned long addr);
398 398
399static inline int within_module_core(unsigned long addr, const struct module *mod) 399static inline bool within_module_core(unsigned long addr,
400 const struct module *mod)
400{ 401{
401 return (unsigned long)mod->module_core <= addr && 402 return (unsigned long)mod->module_core <= addr &&
402 addr < (unsigned long)mod->module_core + mod->core_size; 403 addr < (unsigned long)mod->module_core + mod->core_size;
403} 404}
404 405
405static inline int within_module_init(unsigned long addr, const struct module *mod) 406static inline bool within_module_init(unsigned long addr,
407 const struct module *mod)
406{ 408{
407 return (unsigned long)mod->module_init <= addr && 409 return (unsigned long)mod->module_init <= addr &&
408 addr < (unsigned long)mod->module_init + mod->init_size; 410 addr < (unsigned long)mod->module_init + mod->init_size;
409} 411}
410 412
413static inline bool within_module(unsigned long addr, const struct module *mod)
414{
415 return within_module_init(addr, mod) || within_module_core(addr, mod);
416}
417
411/* Search for module by name: must hold module_mutex. */ 418/* Search for module by name: must hold module_mutex. */
412struct module *find_module(const char *name); 419struct module *find_module(const char *name);
413 420
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index 560ca53a75fa..7eeb9bbfb816 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -45,7 +45,8 @@ static inline int apply_relocate(Elf_Shdr *sechdrs,
45 unsigned int relsec, 45 unsigned int relsec,
46 struct module *me) 46 struct module *me)
47{ 47{
48 printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name); 48 printk(KERN_ERR "module %s: REL relocation unsupported\n",
49 module_name(me));
49 return -ENOEXEC; 50 return -ENOEXEC;
50} 51}
51#endif 52#endif
@@ -67,7 +68,8 @@ static inline int apply_relocate_add(Elf_Shdr *sechdrs,
67 unsigned int relsec, 68 unsigned int relsec,
68 struct module *me) 69 struct module *me)
69{ 70{
70 printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name); 71 printk(KERN_ERR "module %s: REL relocation unsupported\n",
72 module_name(me));
71 return -ENOEXEC; 73 return -ENOEXEC;
72} 74}
73#endif 75#endif
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 494f99e852da..1c9effa25e26 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -42,7 +42,7 @@ struct kernel_param;
42 * NOARG - the parameter allows for no argument (foo instead of foo=1) 42 * NOARG - the parameter allows for no argument (foo instead of foo=1)
43 */ 43 */
44enum { 44enum {
45 KERNEL_PARAM_FL_NOARG = (1 << 0) 45 KERNEL_PARAM_OPS_FL_NOARG = (1 << 0)
46}; 46};
47 47
48struct kernel_param_ops { 48struct kernel_param_ops {
@@ -56,11 +56,21 @@ struct kernel_param_ops {
56 void (*free)(void *arg); 56 void (*free)(void *arg);
57}; 57};
58 58
59/*
60 * Flags available for kernel_param
61 *
62 * UNSAFE - the parameter is dangerous and setting it will taint the kernel
63 */
64enum {
65 KERNEL_PARAM_FL_UNSAFE = (1 << 0)
66};
67
59struct kernel_param { 68struct kernel_param {
60 const char *name; 69 const char *name;
61 const struct kernel_param_ops *ops; 70 const struct kernel_param_ops *ops;
62 u16 perm; 71 u16 perm;
63 s16 level; 72 s8 level;
73 u8 flags;
64 union { 74 union {
65 void *arg; 75 void *arg;
66 const struct kparam_string *str; 76 const struct kparam_string *str;
@@ -68,6 +78,8 @@ struct kernel_param {
68 }; 78 };
69}; 79};
70 80
81extern const struct kernel_param __start___param[], __stop___param[];
82
71/* Special one for strings we want to copy into */ 83/* Special one for strings we want to copy into */
72struct kparam_string { 84struct kparam_string {
73 unsigned int maxlen; 85 unsigned int maxlen;
@@ -113,6 +125,12 @@ struct kparam_array
113 module_param_named(name, name, type, perm) 125 module_param_named(name, name, type, perm)
114 126
115/** 127/**
128 * module_param_unsafe - same as module_param but taints kernel
129 */
130#define module_param_unsafe(name, type, perm) \
131 module_param_named_unsafe(name, name, type, perm)
132
133/**
116 * module_param_named - typesafe helper for a renamed module/cmdline parameter 134 * module_param_named - typesafe helper for a renamed module/cmdline parameter
117 * @name: a valid C identifier which is the parameter name. 135 * @name: a valid C identifier which is the parameter name.
118 * @value: the actual lvalue to alter. 136 * @value: the actual lvalue to alter.
@@ -129,6 +147,14 @@ struct kparam_array
129 __MODULE_PARM_TYPE(name, #type) 147 __MODULE_PARM_TYPE(name, #type)
130 148
131/** 149/**
150 * module_param_named_unsafe - same as module_param_named but taints kernel
151 */
152#define module_param_named_unsafe(name, value, type, perm) \
153 param_check_##type(name, &(value)); \
154 module_param_cb_unsafe(name, &param_ops_##type, &value, perm); \
155 __MODULE_PARM_TYPE(name, #type)
156
157/**
132 * module_param_cb - general callback for a module/cmdline parameter 158 * module_param_cb - general callback for a module/cmdline parameter
133 * @name: a valid C identifier which is the parameter name. 159 * @name: a valid C identifier which is the parameter name.
134 * @ops: the set & get operations for this parameter. 160 * @ops: the set & get operations for this parameter.
@@ -137,7 +163,11 @@ struct kparam_array
137 * The ops can have NULL set or get functions. 163 * The ops can have NULL set or get functions.
138 */ 164 */
139#define module_param_cb(name, ops, arg, perm) \ 165#define module_param_cb(name, ops, arg, perm) \
140 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1) 166 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0)
167
168#define module_param_cb_unsafe(name, ops, arg, perm) \
169 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \
170 KERNEL_PARAM_FL_UNSAFE)
141 171
142/** 172/**
143 * <level>_param_cb - general callback for a module/cmdline parameter 173 * <level>_param_cb - general callback for a module/cmdline parameter
@@ -149,7 +179,7 @@ struct kparam_array
149 * The ops can have NULL set or get functions. 179 * The ops can have NULL set or get functions.
150 */ 180 */
151#define __level_param_cb(name, ops, arg, perm, level) \ 181#define __level_param_cb(name, ops, arg, perm, level) \
152 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level) 182 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level, 0)
153 183
154#define core_param_cb(name, ops, arg, perm) \ 184#define core_param_cb(name, ops, arg, perm) \
155 __level_param_cb(name, ops, arg, perm, 1) 185 __level_param_cb(name, ops, arg, perm, 1)
@@ -184,22 +214,22 @@ struct kparam_array
184 214
185/* This is the fundamental function for registering boot/module 215/* This is the fundamental function for registering boot/module
186 parameters. */ 216 parameters. */
187#define __module_param_call(prefix, name, ops, arg, perm, level) \ 217#define __module_param_call(prefix, name, ops, arg, perm, level, flags) \
188 /* Default value instead of permissions? */ \ 218 /* Default value instead of permissions? */ \
189 static const char __param_str_##name[] = prefix #name; \ 219 static const char __param_str_##name[] = prefix #name; \
190 static struct kernel_param __moduleparam_const __param_##name \ 220 static struct kernel_param __moduleparam_const __param_##name \
191 __used \ 221 __used \
192 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 222 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
193 = { __param_str_##name, ops, VERIFY_OCTAL_PERMISSIONS(perm), \ 223 = { __param_str_##name, ops, VERIFY_OCTAL_PERMISSIONS(perm), \
194 level, { arg } } 224 level, flags, { arg } }
195 225
196/* Obsolete - use module_param_cb() */ 226/* Obsolete - use module_param_cb() */
197#define module_param_call(name, set, get, arg, perm) \ 227#define module_param_call(name, set, get, arg, perm) \
198 static struct kernel_param_ops __param_ops_##name = \ 228 static struct kernel_param_ops __param_ops_##name = \
199 { 0, (void *)set, (void *)get }; \ 229 { .flags = 0, (void *)set, (void *)get }; \
200 __module_param_call(MODULE_PARAM_PREFIX, \ 230 __module_param_call(MODULE_PARAM_PREFIX, \
201 name, &__param_ops_##name, arg, \ 231 name, &__param_ops_##name, arg, \
202 (perm) + sizeof(__check_old_set_param(set))*0, -1) 232 (perm) + sizeof(__check_old_set_param(set))*0, -1, 0)
203 233
204/* We don't get oldget: it's often a new-style param_get_uint, etc. */ 234/* We don't get oldget: it's often a new-style param_get_uint, etc. */
205static inline int 235static inline int
@@ -279,7 +309,7 @@ static inline void __kernel_param_unlock(void)
279 */ 309 */
280#define core_param(name, var, type, perm) \ 310#define core_param(name, var, type, perm) \
281 param_check_##type(name, &(var)); \ 311 param_check_##type(name, &(var)); \
282 __module_param_call("", name, &param_ops_##type, &var, perm, -1) 312 __module_param_call("", name, &param_ops_##type, &var, perm, -1, 0)
283#endif /* !MODULE */ 313#endif /* !MODULE */
284 314
285/** 315/**
@@ -297,7 +327,7 @@ static inline void __kernel_param_unlock(void)
297 = { len, string }; \ 327 = { len, string }; \
298 __module_param_call(MODULE_PARAM_PREFIX, name, \ 328 __module_param_call(MODULE_PARAM_PREFIX, name, \
299 &param_ops_string, \ 329 &param_ops_string, \
300 .str = &__param_string_##name, perm, -1); \ 330 .str = &__param_string_##name, perm, -1, 0);\
301 __MODULE_PARM_TYPE(name, "string") 331 __MODULE_PARM_TYPE(name, "string")
302 332
303/** 333/**
@@ -444,7 +474,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp);
444 __module_param_call(MODULE_PARAM_PREFIX, name, \ 474 __module_param_call(MODULE_PARAM_PREFIX, name, \
445 &param_array_ops, \ 475 &param_array_ops, \
446 .arr = &__param_arr_##name, \ 476 .arr = &__param_arr_##name, \
447 perm, -1); \ 477 perm, -1, 0); \
448 __MODULE_PARM_TYPE(name, "array of " #type) 478 __MODULE_PARM_TYPE(name, "array of " #type)
449 479
450extern struct kernel_param_ops param_array_ops; 480extern struct kernel_param_ops param_array_ops;
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 839bac270904..c2c561dc0114 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -42,13 +42,20 @@ struct mnt_namespace;
42 * flag, consider how it interacts with shared mounts. 42 * flag, consider how it interacts with shared mounts.
43 */ 43 */
44#define MNT_SHARED_MASK (MNT_UNBINDABLE) 44#define MNT_SHARED_MASK (MNT_UNBINDABLE)
45#define MNT_PROPAGATION_MASK (MNT_SHARED | MNT_UNBINDABLE) 45#define MNT_USER_SETTABLE_MASK (MNT_NOSUID | MNT_NODEV | MNT_NOEXEC \
46 | MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME \
47 | MNT_READONLY)
48#define MNT_ATIME_MASK (MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME )
46 49
47#define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \ 50#define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \
48 MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED) 51 MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED)
49 52
50#define MNT_INTERNAL 0x4000 53#define MNT_INTERNAL 0x4000
51 54
55#define MNT_LOCK_ATIME 0x040000
56#define MNT_LOCK_NOEXEC 0x080000
57#define MNT_LOCK_NOSUID 0x100000
58#define MNT_LOCK_NODEV 0x200000
52#define MNT_LOCK_READONLY 0x400000 59#define MNT_LOCK_READONLY 0x400000
53#define MNT_LOCKED 0x800000 60#define MNT_LOCKED 0x800000
54#define MNT_DOOMED 0x1000000 61#define MNT_DOOMED 0x1000000
@@ -62,6 +69,7 @@ struct vfsmount {
62}; 69};
63 70
64struct file; /* forward dec */ 71struct file; /* forward dec */
72struct path;
65 73
66extern int mnt_want_write(struct vfsmount *mnt); 74extern int mnt_want_write(struct vfsmount *mnt);
67extern int mnt_want_write_file(struct file *file); 75extern int mnt_want_write_file(struct file *file);
@@ -70,10 +78,12 @@ extern void mnt_drop_write(struct vfsmount *mnt);
70extern void mnt_drop_write_file(struct file *file); 78extern void mnt_drop_write_file(struct file *file);
71extern void mntput(struct vfsmount *mnt); 79extern void mntput(struct vfsmount *mnt);
72extern struct vfsmount *mntget(struct vfsmount *mnt); 80extern struct vfsmount *mntget(struct vfsmount *mnt);
73extern void mnt_pin(struct vfsmount *mnt); 81extern struct vfsmount *mnt_clone_internal(struct path *path);
74extern void mnt_unpin(struct vfsmount *mnt);
75extern int __mnt_is_readonly(struct vfsmount *mnt); 82extern int __mnt_is_readonly(struct vfsmount *mnt);
76 83
84struct path;
85extern struct vfsmount *clone_private_mount(struct path *path);
86
77struct file_system_type; 87struct file_system_type;
78extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, 88extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
79 int flags, const char *name, 89 int flags, const char *name,
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 8103f32f6d87..44f4746d033b 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -29,7 +29,6 @@ struct msi_desc {
29 __u8 multi_cap : 3; /* log2 num of messages supported */ 29 __u8 multi_cap : 3; /* log2 num of messages supported */
30 __u8 maskbit : 1; /* mask-pending bit supported ? */ 30 __u8 maskbit : 1; /* mask-pending bit supported ? */
31 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 31 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
32 __u8 pos; /* Location of the msi capability */
33 __u16 entry_nr; /* specific enabled entry */ 32 __u16 entry_nr; /* specific enabled entry */
34 unsigned default_irq; /* default pre-assigned irq */ 33 unsigned default_irq; /* default pre-assigned irq */
35 } msi_attrib; 34 } msi_attrib;
@@ -47,8 +46,6 @@ struct msi_desc {
47 46
48 /* Last set MSI message */ 47 /* Last set MSI message */
49 struct msi_msg msg; 48 struct msi_msg msg;
50
51 struct kobject kobj;
52}; 49};
53 50
54/* 51/*
@@ -60,7 +57,6 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
60void arch_teardown_msi_irq(unsigned int irq); 57void arch_teardown_msi_irq(unsigned int irq);
61int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 58int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
62void arch_teardown_msi_irqs(struct pci_dev *dev); 59void arch_teardown_msi_irqs(struct pci_dev *dev);
63int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);
64void arch_restore_msi_irqs(struct pci_dev *dev); 60void arch_restore_msi_irqs(struct pci_dev *dev);
65 61
66void default_teardown_msi_irqs(struct pci_dev *dev); 62void default_teardown_msi_irqs(struct pci_dev *dev);
@@ -77,8 +73,6 @@ struct msi_chip {
77 int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev, 73 int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev,
78 struct msi_desc *desc); 74 struct msi_desc *desc);
79 void (*teardown_irq)(struct msi_chip *chip, unsigned int irq); 75 void (*teardown_irq)(struct msi_chip *chip, unsigned int irq);
80 int (*check_device)(struct msi_chip *chip, struct pci_dev *dev,
81 int nvec, int type);
82}; 76};
83 77
84#endif /* LINUX_MSI_H */ 78#endif /* LINUX_MSI_H */
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 37ef6b194089..299d7d31fe53 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -153,7 +153,7 @@ struct cfi_ident {
153 uint16_t MaxBufWriteSize; 153 uint16_t MaxBufWriteSize;
154 uint8_t NumEraseRegions; 154 uint8_t NumEraseRegions;
155 uint32_t EraseRegionInfo[0]; /* Not host ordered */ 155 uint32_t EraseRegionInfo[0]; /* Not host ordered */
156} __attribute__((packed)); 156} __packed;
157 157
158/* Extended Query Structure for both PRI and ALT */ 158/* Extended Query Structure for both PRI and ALT */
159 159
@@ -161,7 +161,7 @@ struct cfi_extquery {
161 uint8_t pri[3]; 161 uint8_t pri[3];
162 uint8_t MajorVersion; 162 uint8_t MajorVersion;
163 uint8_t MinorVersion; 163 uint8_t MinorVersion;
164} __attribute__((packed)); 164} __packed;
165 165
166/* Vendor-Specific PRI for Intel/Sharp Extended Command Set (0x0001) */ 166/* Vendor-Specific PRI for Intel/Sharp Extended Command Set (0x0001) */
167 167
@@ -180,7 +180,7 @@ struct cfi_pri_intelext {
180 uint8_t FactProtRegSize; 180 uint8_t FactProtRegSize;
181 uint8_t UserProtRegSize; 181 uint8_t UserProtRegSize;
182 uint8_t extra[0]; 182 uint8_t extra[0];
183} __attribute__((packed)); 183} __packed;
184 184
185struct cfi_intelext_otpinfo { 185struct cfi_intelext_otpinfo {
186 uint32_t ProtRegAddr; 186 uint32_t ProtRegAddr;
@@ -188,7 +188,7 @@ struct cfi_intelext_otpinfo {
188 uint8_t FactProtRegSize; 188 uint8_t FactProtRegSize;
189 uint16_t UserGroups; 189 uint16_t UserGroups;
190 uint8_t UserProtRegSize; 190 uint8_t UserProtRegSize;
191} __attribute__((packed)); 191} __packed;
192 192
193struct cfi_intelext_blockinfo { 193struct cfi_intelext_blockinfo {
194 uint16_t NumIdentBlocks; 194 uint16_t NumIdentBlocks;
@@ -196,7 +196,7 @@ struct cfi_intelext_blockinfo {
196 uint16_t MinBlockEraseCycles; 196 uint16_t MinBlockEraseCycles;
197 uint8_t BitsPerCell; 197 uint8_t BitsPerCell;
198 uint8_t BlockCap; 198 uint8_t BlockCap;
199} __attribute__((packed)); 199} __packed;
200 200
201struct cfi_intelext_regioninfo { 201struct cfi_intelext_regioninfo {
202 uint16_t NumIdentPartitions; 202 uint16_t NumIdentPartitions;
@@ -205,7 +205,7 @@ struct cfi_intelext_regioninfo {
205 uint8_t NumOpAllowedSimEraMode; 205 uint8_t NumOpAllowedSimEraMode;
206 uint8_t NumBlockTypes; 206 uint8_t NumBlockTypes;
207 struct cfi_intelext_blockinfo BlockTypes[1]; 207 struct cfi_intelext_blockinfo BlockTypes[1];
208} __attribute__((packed)); 208} __packed;
209 209
210struct cfi_intelext_programming_regioninfo { 210struct cfi_intelext_programming_regioninfo {
211 uint8_t ProgRegShift; 211 uint8_t ProgRegShift;
@@ -214,7 +214,7 @@ struct cfi_intelext_programming_regioninfo {
214 uint8_t Reserved2; 214 uint8_t Reserved2;
215 uint8_t ControlInvalid; 215 uint8_t ControlInvalid;
216 uint8_t Reserved3; 216 uint8_t Reserved3;
217} __attribute__((packed)); 217} __packed;
218 218
219/* Vendor-Specific PRI for AMD/Fujitsu Extended Command Set (0x0002) */ 219/* Vendor-Specific PRI for AMD/Fujitsu Extended Command Set (0x0002) */
220 220
@@ -233,7 +233,7 @@ struct cfi_pri_amdstd {
233 uint8_t VppMin; 233 uint8_t VppMin;
234 uint8_t VppMax; 234 uint8_t VppMax;
235 uint8_t TopBottom; 235 uint8_t TopBottom;
236} __attribute__((packed)); 236} __packed;
237 237
238/* Vendor-Specific PRI for Atmel chips (command set 0x0002) */ 238/* Vendor-Specific PRI for Atmel chips (command set 0x0002) */
239 239
@@ -245,18 +245,18 @@ struct cfi_pri_atmel {
245 uint8_t BottomBoot; 245 uint8_t BottomBoot;
246 uint8_t BurstMode; 246 uint8_t BurstMode;
247 uint8_t PageMode; 247 uint8_t PageMode;
248} __attribute__((packed)); 248} __packed;
249 249
250struct cfi_pri_query { 250struct cfi_pri_query {
251 uint8_t NumFields; 251 uint8_t NumFields;
252 uint32_t ProtField[1]; /* Not host ordered */ 252 uint32_t ProtField[1]; /* Not host ordered */
253} __attribute__((packed)); 253} __packed;
254 254
255struct cfi_bri_query { 255struct cfi_bri_query {
256 uint8_t PageModeReadCap; 256 uint8_t PageModeReadCap;
257 uint8_t NumFields; 257 uint8_t NumFields;
258 uint32_t ConfField[1]; /* Not host ordered */ 258 uint32_t ConfField[1]; /* Not host ordered */
259} __attribute__((packed)); 259} __packed;
260 260
261#define P_ID_NONE 0x0000 261#define P_ID_NONE 0x0000
262#define P_ID_INTEL_EXT 0x0001 262#define P_ID_INTEL_EXT 0x0001
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index a1b0b4c8fd79..031ff3a9a0bd 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -222,6 +222,7 @@ struct mtd_info {
222 int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 222 int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
223 int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 223 int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
224 int (*_is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 224 int (*_is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
225 int (*_block_isreserved) (struct mtd_info *mtd, loff_t ofs);
225 int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs); 226 int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs);
226 int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs); 227 int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs);
227 int (*_suspend) (struct mtd_info *mtd); 228 int (*_suspend) (struct mtd_info *mtd);
@@ -302,6 +303,7 @@ static inline void mtd_sync(struct mtd_info *mtd)
302int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); 303int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
303int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); 304int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
304int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len); 305int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len);
306int mtd_block_isreserved(struct mtd_info *mtd, loff_t ofs);
305int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs); 307int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs);
306int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs); 308int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs);
307 309
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 2f0af2891f0f..e4d451e4600b 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -587,6 +587,11 @@ struct nand_buffers {
587 * @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds, 587 * @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds,
588 * also from the datasheet. It is the recommended ECC step 588 * also from the datasheet. It is the recommended ECC step
589 * size, if known; if unknown, set to zero. 589 * size, if known; if unknown, set to zero.
590 * @onfi_timing_mode_default: [INTERN] default ONFI timing mode. This field is
591 * either deduced from the datasheet if the NAND
592 * chip is not ONFI compliant or set to 0 if it is
593 * (an ONFI chip is always configured in mode 0
594 * after a NAND reset)
590 * @numchips: [INTERN] number of physical chips 595 * @numchips: [INTERN] number of physical chips
591 * @chipsize: [INTERN] the size of one chip for multichip arrays 596 * @chipsize: [INTERN] the size of one chip for multichip arrays
592 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 597 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
@@ -671,6 +676,7 @@ struct nand_chip {
671 uint8_t bits_per_cell; 676 uint8_t bits_per_cell;
672 uint16_t ecc_strength_ds; 677 uint16_t ecc_strength_ds;
673 uint16_t ecc_step_ds; 678 uint16_t ecc_step_ds;
679 int onfi_timing_mode_default;
674 int badblockpos; 680 int badblockpos;
675 int badblockbits; 681 int badblockbits;
676 682
@@ -766,12 +772,17 @@ struct nand_chip {
766 * @options: stores various chip bit options 772 * @options: stores various chip bit options
767 * @id_len: The valid length of the @id. 773 * @id_len: The valid length of the @id.
768 * @oobsize: OOB size 774 * @oobsize: OOB size
775 * @ecc: ECC correctability and step information from the datasheet.
769 * @ecc.strength_ds: The ECC correctability from the datasheet, same as the 776 * @ecc.strength_ds: The ECC correctability from the datasheet, same as the
770 * @ecc_strength_ds in nand_chip{}. 777 * @ecc_strength_ds in nand_chip{}.
771 * @ecc.step_ds: The ECC step required by the @ecc.strength_ds, same as the 778 * @ecc.step_ds: The ECC step required by the @ecc.strength_ds, same as the
772 * @ecc_step_ds in nand_chip{}, also from the datasheet. 779 * @ecc_step_ds in nand_chip{}, also from the datasheet.
773 * For example, the "4bit ECC for each 512Byte" can be set with 780 * For example, the "4bit ECC for each 512Byte" can be set with
774 * NAND_ECC_INFO(4, 512). 781 * NAND_ECC_INFO(4, 512).
782 * @onfi_timing_mode_default: the default ONFI timing mode entered after a NAND
783 * reset. Should be deduced from timings described
784 * in the datasheet.
785 *
775 */ 786 */
776struct nand_flash_dev { 787struct nand_flash_dev {
777 char *name; 788 char *name;
@@ -792,6 +803,7 @@ struct nand_flash_dev {
792 uint16_t strength_ds; 803 uint16_t strength_ds;
793 uint16_t step_ds; 804 uint16_t step_ds;
794 } ecc; 805 } ecc;
806 int onfi_timing_mode_default;
795}; 807};
796 808
797/** 809/**
@@ -810,6 +822,7 @@ extern struct nand_manufacturers nand_manuf_ids[];
810extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); 822extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd);
811extern int nand_default_bbt(struct mtd_info *mtd); 823extern int nand_default_bbt(struct mtd_info *mtd);
812extern int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs); 824extern int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs);
825extern int nand_isreserved_bbt(struct mtd_info *mtd, loff_t offs);
813extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt); 826extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt);
814extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, 827extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
815 int allowbbt); 828 int allowbbt);
@@ -947,4 +960,56 @@ static inline int jedec_feature(struct nand_chip *chip)
947 return chip->jedec_version ? le16_to_cpu(chip->jedec_params.features) 960 return chip->jedec_version ? le16_to_cpu(chip->jedec_params.features)
948 : 0; 961 : 0;
949} 962}
963
964/*
965 * struct nand_sdr_timings - SDR NAND chip timings
966 *
967 * This struct defines the timing requirements of a SDR NAND chip.
968 * These informations can be found in every NAND datasheets and the timings
969 * meaning are described in the ONFI specifications:
970 * www.onfi.org/~/media/ONFI/specs/onfi_3_1_spec.pdf (chapter 4.15 Timing
971 * Parameters)
972 *
973 * All these timings are expressed in picoseconds.
974 */
975
976struct nand_sdr_timings {
977 u32 tALH_min;
978 u32 tADL_min;
979 u32 tALS_min;
980 u32 tAR_min;
981 u32 tCEA_max;
982 u32 tCEH_min;
983 u32 tCH_min;
984 u32 tCHZ_max;
985 u32 tCLH_min;
986 u32 tCLR_min;
987 u32 tCLS_min;
988 u32 tCOH_min;
989 u32 tCS_min;
990 u32 tDH_min;
991 u32 tDS_min;
992 u32 tFEAT_max;
993 u32 tIR_min;
994 u32 tITC_max;
995 u32 tRC_min;
996 u32 tREA_max;
997 u32 tREH_min;
998 u32 tRHOH_min;
999 u32 tRHW_min;
1000 u32 tRHZ_max;
1001 u32 tRLOH_min;
1002 u32 tRP_min;
1003 u32 tRR_min;
1004 u64 tRST_max;
1005 u32 tWB_max;
1006 u32 tWC_min;
1007 u32 tWH_min;
1008 u32 tWHR_min;
1009 u32 tWP_min;
1010 u32 tWW_min;
1011};
1012
1013/* get timing characteristics from ONFI timing mode. */
1014const struct nand_sdr_timings *onfi_async_timing_mode_to_sdr_timings(int mode);
950#endif /* __LINUX_MTD_NAND_H */ 1015#endif /* __LINUX_MTD_NAND_H */
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 53241842a7ab..046a0a2e4c4e 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -34,6 +34,7 @@
34#define SPINOR_OP_SE 0xd8 /* Sector erase (usually 64KiB) */ 34#define SPINOR_OP_SE 0xd8 /* Sector erase (usually 64KiB) */
35#define SPINOR_OP_RDID 0x9f /* Read JEDEC ID */ 35#define SPINOR_OP_RDID 0x9f /* Read JEDEC ID */
36#define SPINOR_OP_RDCR 0x35 /* Read configuration register */ 36#define SPINOR_OP_RDCR 0x35 /* Read configuration register */
37#define SPINOR_OP_RDFSR 0x70 /* Read flag status register */
37 38
38/* 4-byte address opcodes - used on Spansion and some Macronix flashes. */ 39/* 4-byte address opcodes - used on Spansion and some Macronix flashes. */
39#define SPINOR_OP_READ4 0x13 /* Read data bytes (low frequency) */ 40#define SPINOR_OP_READ4 0x13 /* Read data bytes (low frequency) */
@@ -66,6 +67,9 @@
66 67
67#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */ 68#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */
68 69
70/* Flag Status Register bits */
71#define FSR_READY 0x80
72
69/* Configuration Register bits. */ 73/* Configuration Register bits. */
70#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */ 74#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */
71 75
@@ -183,32 +187,17 @@ struct spi_nor {
183/** 187/**
184 * spi_nor_scan() - scan the SPI NOR 188 * spi_nor_scan() - scan the SPI NOR
185 * @nor: the spi_nor structure 189 * @nor: the spi_nor structure
186 * @id: the spi_device_id provided by the driver 190 * @name: the chip type name
187 * @mode: the read mode supported by the driver 191 * @mode: the read mode supported by the driver
188 * 192 *
189 * The drivers can use this fuction to scan the SPI NOR. 193 * The drivers can use this fuction to scan the SPI NOR.
190 * In the scanning, it will try to get all the necessary information to 194 * In the scanning, it will try to get all the necessary information to
191 * fill the mtd_info{} and the spi_nor{}. 195 * fill the mtd_info{} and the spi_nor{}.
192 * 196 *
193 * The board may assigns a spi_device_id with @id which be used to compared with 197 * The chip type name can be provided through the @name parameter.
194 * the spi_device_id detected by the scanning.
195 * 198 *
196 * Return: 0 for success, others for failure. 199 * Return: 0 for success, others for failure.
197 */ 200 */
198int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, 201int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode);
199 enum read_mode mode);
200extern const struct spi_device_id spi_nor_ids[];
201
202/**
203 * spi_nor_match_id() - find the spi_device_id by the name
204 * @name: the name of the spi_device_id
205 *
206 * The drivers use this function to find the spi_device_id
207 * specified by the @name.
208 *
209 * Return: returns the right spi_device_id pointer on success,
210 * and returns NULL on failure.
211 */
212const struct spi_device_id *spi_nor_match_id(char *name);
213 202
214#endif 203#endif
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 8d5535c58cc2..cc31498fc526 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -52,7 +52,7 @@ struct mutex {
52 atomic_t count; 52 atomic_t count;
53 spinlock_t wait_lock; 53 spinlock_t wait_lock;
54 struct list_head wait_list; 54 struct list_head wait_list;
55#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP) 55#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER)
56 struct task_struct *owner; 56 struct task_struct *owner;
57#endif 57#endif
58#ifdef CONFIG_MUTEX_SPIN_ON_OWNER 58#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
@@ -133,7 +133,7 @@ static inline int mutex_is_locked(struct mutex *lock)
133 133
134/* 134/*
135 * See kernel/locking/mutex.c for detailed documentation of these APIs. 135 * See kernel/locking/mutex.c for detailed documentation of these APIs.
136 * Also see Documentation/mutex-design.txt. 136 * Also see Documentation/locking/mutex-design.txt.
137 */ 137 */
138#ifdef CONFIG_DEBUG_LOCK_ALLOC 138#ifdef CONFIG_DEBUG_LOCK_ALLOC
139extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); 139extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
diff --git a/include/linux/mvebu-pmsu.h b/include/linux/mvebu-pmsu.h
new file mode 100644
index 000000000000..b918d07efe23
--- /dev/null
+++ b/include/linux/mvebu-pmsu.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2012 Marvell
3 *
4 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __MVEBU_PMSU_H__
12#define __MVEBU_PMSU_H__
13
14#ifdef CONFIG_MACH_MVEBU_V7
15int mvebu_pmsu_dfs_request(int cpu);
16#else
17static inline int mvebu_pmsu_dfs_request(int cpu) { return -ENODEV; }
18#endif
19
20#endif /* __MVEBU_PMSU_H__ */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 38377392d082..74fd5d37f15a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -30,6 +30,7 @@
30#include <linux/bug.h> 30#include <linux/bug.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/atomic.h> 32#include <linux/atomic.h>
33#include <linux/prefetch.h>
33#include <asm/cache.h> 34#include <asm/cache.h>
34#include <asm/byteorder.h> 35#include <asm/byteorder.h>
35 36
@@ -543,7 +544,7 @@ struct netdev_queue {
543 * read mostly part 544 * read mostly part
544 */ 545 */
545 struct net_device *dev; 546 struct net_device *dev;
546 struct Qdisc *qdisc; 547 struct Qdisc __rcu *qdisc;
547 struct Qdisc *qdisc_sleeping; 548 struct Qdisc *qdisc_sleeping;
548#ifdef CONFIG_SYSFS 549#ifdef CONFIG_SYSFS
549 struct kobject kobj; 550 struct kobject kobj;
@@ -997,6 +998,12 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
997 * Callback to use for xmit over the accelerated station. This 998 * Callback to use for xmit over the accelerated station. This
998 * is used in place of ndo_start_xmit on accelerated net 999 * is used in place of ndo_start_xmit on accelerated net
999 * devices. 1000 * devices.
1001 * bool (*ndo_gso_check) (struct sk_buff *skb,
1002 * struct net_device *dev);
1003 * Called by core transmit path to determine if device is capable of
1004 * performing GSO on a packet. The device returns true if it is
1005 * able to GSO the packet, false otherwise. If the return value is
1006 * false the stack will do software GSO.
1000 */ 1007 */
1001struct net_device_ops { 1008struct net_device_ops {
1002 int (*ndo_init)(struct net_device *dev); 1009 int (*ndo_init)(struct net_device *dev);
@@ -1146,6 +1153,8 @@ struct net_device_ops {
1146 struct net_device *dev, 1153 struct net_device *dev,
1147 void *priv); 1154 void *priv);
1148 int (*ndo_get_lock_subclass)(struct net_device *dev); 1155 int (*ndo_get_lock_subclass)(struct net_device *dev);
1156 bool (*ndo_gso_check) (struct sk_buff *skb,
1157 struct net_device *dev);
1149}; 1158};
1150 1159
1151/** 1160/**
@@ -1206,6 +1215,7 @@ enum netdev_priv_flags {
1206 IFF_SUPP_NOFCS = 1<<19, 1215 IFF_SUPP_NOFCS = 1<<19,
1207 IFF_LIVE_ADDR_CHANGE = 1<<20, 1216 IFF_LIVE_ADDR_CHANGE = 1<<20,
1208 IFF_MACVLAN = 1<<21, 1217 IFF_MACVLAN = 1<<21,
1218 IFF_XMIT_DST_RELEASE_PERM = 1<<22,
1209}; 1219};
1210 1220
1211#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN 1221#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -1230,6 +1240,7 @@ enum netdev_priv_flags {
1230#define IFF_SUPP_NOFCS IFF_SUPP_NOFCS 1240#define IFF_SUPP_NOFCS IFF_SUPP_NOFCS
1231#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE 1241#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE
1232#define IFF_MACVLAN IFF_MACVLAN 1242#define IFF_MACVLAN IFF_MACVLAN
1243#define IFF_XMIT_DST_RELEASE_PERM IFF_XMIT_DST_RELEASE_PERM
1233 1244
1234/** 1245/**
1235 * struct net_device - The DEVICE structure. 1246 * struct net_device - The DEVICE structure.
@@ -1416,6 +1427,8 @@ enum netdev_priv_flags {
1416 * @gso_max_size: Maximum size of generic segmentation offload 1427 * @gso_max_size: Maximum size of generic segmentation offload
1417 * @gso_max_segs: Maximum number of segments that can be passed to the 1428 * @gso_max_segs: Maximum number of segments that can be passed to the
1418 * NIC for GSO 1429 * NIC for GSO
1430 * @gso_min_segs: Minimum number of segments that can be passed to the
1431 * NIC for GSO
1419 * 1432 *
1420 * @dcbnl_ops: Data Center Bridging netlink ops 1433 * @dcbnl_ops: Data Center Bridging netlink ops
1421 * @num_tc: Number of traffic classes in the net device 1434 * @num_tc: Number of traffic classes in the net device
@@ -1666,7 +1679,7 @@ struct net_device {
1666 unsigned int gso_max_size; 1679 unsigned int gso_max_size;
1667#define GSO_MAX_SEGS 65535 1680#define GSO_MAX_SEGS 65535
1668 u16 gso_max_segs; 1681 u16 gso_max_segs;
1669 1682 u16 gso_min_segs;
1670#ifdef CONFIG_DCB 1683#ifdef CONFIG_DCB
1671 const struct dcbnl_rtnl_ops *dcbnl_ops; 1684 const struct dcbnl_rtnl_ops *dcbnl_ops;
1672#endif 1685#endif
@@ -1747,6 +1760,12 @@ struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
1747 return &dev->_tx[index]; 1760 return &dev->_tx[index];
1748} 1761}
1749 1762
1763static inline struct netdev_queue *skb_get_tx_queue(const struct net_device *dev,
1764 const struct sk_buff *skb)
1765{
1766 return netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
1767}
1768
1750static inline void netdev_for_each_tx_queue(struct net_device *dev, 1769static inline void netdev_for_each_tx_queue(struct net_device *dev,
1751 void (*f)(struct net_device *, 1770 void (*f)(struct net_device *,
1752 struct netdev_queue *, 1771 struct netdev_queue *,
@@ -1781,24 +1800,13 @@ void dev_net_set(struct net_device *dev, struct net *net)
1781#endif 1800#endif
1782} 1801}
1783 1802
1784static inline bool netdev_uses_dsa_tags(struct net_device *dev) 1803static inline bool netdev_uses_dsa(struct net_device *dev)
1785{ 1804{
1786#ifdef CONFIG_NET_DSA_TAG_DSA 1805#if IS_ENABLED(CONFIG_NET_DSA)
1787 if (dev->dsa_ptr != NULL)
1788 return dsa_uses_dsa_tags(dev->dsa_ptr);
1789#endif
1790
1791 return 0;
1792}
1793
1794static inline bool netdev_uses_trailer_tags(struct net_device *dev)
1795{
1796#ifdef CONFIG_NET_DSA_TAG_TRAILER
1797 if (dev->dsa_ptr != NULL) 1806 if (dev->dsa_ptr != NULL)
1798 return dsa_uses_trailer_tags(dev->dsa_ptr); 1807 return dsa_uses_tagged_protocol(dev->dsa_ptr);
1799#endif 1808#endif
1800 1809 return false;
1801 return 0;
1802} 1810}
1803 1811
1804/** 1812/**
@@ -1879,11 +1887,20 @@ struct napi_gro_cb {
1879 /* jiffies when first packet was created/queued */ 1887 /* jiffies when first packet was created/queued */
1880 unsigned long age; 1888 unsigned long age;
1881 1889
1882 /* Used in ipv6_gro_receive() */ 1890 /* Used in ipv6_gro_receive() and foo-over-udp */
1883 u16 proto; 1891 u16 proto;
1884 1892
1885 /* Used in udp_gro_receive */ 1893 /* Used in udp_gro_receive */
1886 u16 udp_mark; 1894 u8 udp_mark:1;
1895
1896 /* GRO checksum is valid */
1897 u8 csum_valid:1;
1898
1899 /* Number of checksums via CHECKSUM_UNNECESSARY */
1900 u8 csum_cnt:3;
1901
1902 /* Used in foo-over-udp, set in udp[46]_gro_receive */
1903 u8 is_ipv6:1;
1887 1904
1888 /* used to support CHECKSUM_COMPLETE for tunneling protocols */ 1905 /* used to support CHECKSUM_COMPLETE for tunneling protocols */
1889 __wsum csum; 1906 __wsum csum;
@@ -1910,7 +1927,6 @@ struct packet_type {
1910struct offload_callbacks { 1927struct offload_callbacks {
1911 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1928 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
1912 netdev_features_t features); 1929 netdev_features_t features);
1913 int (*gso_send_check)(struct sk_buff *skb);
1914 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1930 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1915 struct sk_buff *skb); 1931 struct sk_buff *skb);
1916 int (*gro_complete)(struct sk_buff *skb, int nhoff); 1932 int (*gro_complete)(struct sk_buff *skb, int nhoff);
@@ -1924,6 +1940,7 @@ struct packet_offload {
1924 1940
1925struct udp_offload { 1941struct udp_offload {
1926 __be16 port; 1942 __be16 port;
1943 u8 ipproto;
1927 struct offload_callbacks callbacks; 1944 struct offload_callbacks callbacks;
1928}; 1945};
1929 1946
@@ -1982,6 +1999,7 @@ struct pcpu_sw_netstats {
1982#define NETDEV_CHANGEUPPER 0x0015 1999#define NETDEV_CHANGEUPPER 0x0015
1983#define NETDEV_RESEND_IGMP 0x0016 2000#define NETDEV_RESEND_IGMP 0x0016
1984#define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */ 2001#define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */
2002#define NETDEV_CHANGEINFODATA 0x0018
1985 2003
1986int register_netdevice_notifier(struct notifier_block *nb); 2004int register_netdevice_notifier(struct notifier_block *nb);
1987int unregister_netdevice_notifier(struct notifier_block *nb); 2005int unregister_netdevice_notifier(struct notifier_block *nb);
@@ -2074,8 +2092,8 @@ void __dev_remove_pack(struct packet_type *pt);
2074void dev_add_offload(struct packet_offload *po); 2092void dev_add_offload(struct packet_offload *po);
2075void dev_remove_offload(struct packet_offload *po); 2093void dev_remove_offload(struct packet_offload *po);
2076 2094
2077struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, 2095struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags,
2078 unsigned short mask); 2096 unsigned short mask);
2079struct net_device *dev_get_by_name(struct net *net, const char *name); 2097struct net_device *dev_get_by_name(struct net *net, const char *name);
2080struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); 2098struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);
2081struct net_device *__dev_get_by_name(struct net *net, const char *name); 2099struct net_device *__dev_get_by_name(struct net *net, const char *name);
@@ -2153,11 +2171,97 @@ static inline void *skb_gro_network_header(struct sk_buff *skb)
2153static inline void skb_gro_postpull_rcsum(struct sk_buff *skb, 2171static inline void skb_gro_postpull_rcsum(struct sk_buff *skb,
2154 const void *start, unsigned int len) 2172 const void *start, unsigned int len)
2155{ 2173{
2156 if (skb->ip_summed == CHECKSUM_COMPLETE) 2174 if (NAPI_GRO_CB(skb)->csum_valid)
2157 NAPI_GRO_CB(skb)->csum = csum_sub(NAPI_GRO_CB(skb)->csum, 2175 NAPI_GRO_CB(skb)->csum = csum_sub(NAPI_GRO_CB(skb)->csum,
2158 csum_partial(start, len, 0)); 2176 csum_partial(start, len, 0));
2159} 2177}
2160 2178
2179/* GRO checksum functions. These are logical equivalents of the normal
2180 * checksum functions (in skbuff.h) except that they operate on the GRO
2181 * offsets and fields in sk_buff.
2182 */
2183
2184__sum16 __skb_gro_checksum_complete(struct sk_buff *skb);
2185
2186static inline bool __skb_gro_checksum_validate_needed(struct sk_buff *skb,
2187 bool zero_okay,
2188 __sum16 check)
2189{
2190 return (skb->ip_summed != CHECKSUM_PARTIAL &&
2191 NAPI_GRO_CB(skb)->csum_cnt == 0 &&
2192 (!zero_okay || check));
2193}
2194
2195static inline __sum16 __skb_gro_checksum_validate_complete(struct sk_buff *skb,
2196 __wsum psum)
2197{
2198 if (NAPI_GRO_CB(skb)->csum_valid &&
2199 !csum_fold(csum_add(psum, NAPI_GRO_CB(skb)->csum)))
2200 return 0;
2201
2202 NAPI_GRO_CB(skb)->csum = psum;
2203
2204 return __skb_gro_checksum_complete(skb);
2205}
2206
2207static inline void skb_gro_incr_csum_unnecessary(struct sk_buff *skb)
2208{
2209 if (NAPI_GRO_CB(skb)->csum_cnt > 0) {
2210 /* Consume a checksum from CHECKSUM_UNNECESSARY */
2211 NAPI_GRO_CB(skb)->csum_cnt--;
2212 } else {
2213 /* Update skb for CHECKSUM_UNNECESSARY and csum_level when we
2214 * verified a new top level checksum or an encapsulated one
2215 * during GRO. This saves work if we fallback to normal path.
2216 */
2217 __skb_incr_checksum_unnecessary(skb);
2218 }
2219}
2220
2221#define __skb_gro_checksum_validate(skb, proto, zero_okay, check, \
2222 compute_pseudo) \
2223({ \
2224 __sum16 __ret = 0; \
2225 if (__skb_gro_checksum_validate_needed(skb, zero_okay, check)) \
2226 __ret = __skb_gro_checksum_validate_complete(skb, \
2227 compute_pseudo(skb, proto)); \
2228 if (__ret) \
2229 __skb_mark_checksum_bad(skb); \
2230 else \
2231 skb_gro_incr_csum_unnecessary(skb); \
2232 __ret; \
2233})
2234
2235#define skb_gro_checksum_validate(skb, proto, compute_pseudo) \
2236 __skb_gro_checksum_validate(skb, proto, false, 0, compute_pseudo)
2237
2238#define skb_gro_checksum_validate_zero_check(skb, proto, check, \
2239 compute_pseudo) \
2240 __skb_gro_checksum_validate(skb, proto, true, check, compute_pseudo)
2241
2242#define skb_gro_checksum_simple_validate(skb) \
2243 __skb_gro_checksum_validate(skb, 0, false, 0, null_compute_pseudo)
2244
2245static inline bool __skb_gro_checksum_convert_check(struct sk_buff *skb)
2246{
2247 return (NAPI_GRO_CB(skb)->csum_cnt == 0 &&
2248 !NAPI_GRO_CB(skb)->csum_valid);
2249}
2250
2251static inline void __skb_gro_checksum_convert(struct sk_buff *skb,
2252 __sum16 check, __wsum pseudo)
2253{
2254 NAPI_GRO_CB(skb)->csum = ~pseudo;
2255 NAPI_GRO_CB(skb)->csum_valid = 1;
2256}
2257
2258#define skb_gro_checksum_try_convert(skb, proto, check, compute_pseudo) \
2259do { \
2260 if (__skb_gro_checksum_convert_check(skb)) \
2261 __skb_gro_checksum_convert(skb, check, \
2262 compute_pseudo(skb, proto)); \
2263} while (0)
2264
2161static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 2265static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
2162 unsigned short type, 2266 unsigned short type,
2163 const void *daddr, const void *saddr, 2267 const void *daddr, const void *saddr,
@@ -2261,12 +2365,7 @@ static inline void input_queue_tail_incr_save(struct softnet_data *sd,
2261DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); 2365DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
2262 2366
2263void __netif_schedule(struct Qdisc *q); 2367void __netif_schedule(struct Qdisc *q);
2264 2368void netif_schedule_queue(struct netdev_queue *txq);
2265static inline void netif_schedule_queue(struct netdev_queue *txq)
2266{
2267 if (!(txq->state & QUEUE_STATE_ANY_XOFF))
2268 __netif_schedule(txq->qdisc);
2269}
2270 2369
2271static inline void netif_tx_schedule_all(struct net_device *dev) 2370static inline void netif_tx_schedule_all(struct net_device *dev)
2272{ 2371{
@@ -2302,11 +2401,7 @@ static inline void netif_tx_start_all_queues(struct net_device *dev)
2302 } 2401 }
2303} 2402}
2304 2403
2305static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue) 2404void netif_tx_wake_queue(struct netdev_queue *dev_queue);
2306{
2307 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state))
2308 __netif_schedule(dev_queue->qdisc);
2309}
2310 2405
2311/** 2406/**
2312 * netif_wake_queue - restart transmit 2407 * netif_wake_queue - restart transmit
@@ -2394,6 +2489,34 @@ netif_xmit_frozen_or_drv_stopped(const struct netdev_queue *dev_queue)
2394 return dev_queue->state & QUEUE_STATE_DRV_XOFF_OR_FROZEN; 2489 return dev_queue->state & QUEUE_STATE_DRV_XOFF_OR_FROZEN;
2395} 2490}
2396 2491
2492/**
2493 * netdev_txq_bql_enqueue_prefetchw - prefetch bql data for write
2494 * @dev_queue: pointer to transmit queue
2495 *
2496 * BQL enabled drivers might use this helper in their ndo_start_xmit(),
2497 * to give appropriate hint to the cpu.
2498 */
2499static inline void netdev_txq_bql_enqueue_prefetchw(struct netdev_queue *dev_queue)
2500{
2501#ifdef CONFIG_BQL
2502 prefetchw(&dev_queue->dql.num_queued);
2503#endif
2504}
2505
2506/**
2507 * netdev_txq_bql_complete_prefetchw - prefetch bql data for write
2508 * @dev_queue: pointer to transmit queue
2509 *
2510 * BQL enabled drivers might use this helper in their TX completion path,
2511 * to give appropriate hint to the cpu.
2512 */
2513static inline void netdev_txq_bql_complete_prefetchw(struct netdev_queue *dev_queue)
2514{
2515#ifdef CONFIG_BQL
2516 prefetchw(&dev_queue->dql.limit);
2517#endif
2518}
2519
2397static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, 2520static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
2398 unsigned int bytes) 2521 unsigned int bytes)
2399{ 2522{
@@ -2578,19 +2701,7 @@ static inline bool netif_subqueue_stopped(const struct net_device *dev,
2578 return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); 2701 return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb));
2579} 2702}
2580 2703
2581/** 2704void netif_wake_subqueue(struct net_device *dev, u16 queue_index);
2582 * netif_wake_subqueue - allow sending packets on subqueue
2583 * @dev: network device
2584 * @queue_index: sub queue index
2585 *
2586 * Resume individual transmit queue of a device with multiple transmit queues.
2587 */
2588static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
2589{
2590 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
2591 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state))
2592 __netif_schedule(txq->qdisc);
2593}
2594 2705
2595#ifdef CONFIG_XPS 2706#ifdef CONFIG_XPS
2596int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, 2707int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
@@ -2754,8 +2865,9 @@ int dev_set_mac_address(struct net_device *, struct sockaddr *);
2754int dev_change_carrier(struct net_device *, bool new_carrier); 2865int dev_change_carrier(struct net_device *, bool new_carrier);
2755int dev_get_phys_port_id(struct net_device *dev, 2866int dev_get_phys_port_id(struct net_device *dev,
2756 struct netdev_phys_port_id *ppid); 2867 struct netdev_phys_port_id *ppid);
2757int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2868struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
2758 struct netdev_queue *txq); 2869struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2870 struct netdev_queue *txq, int *ret);
2759int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2871int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2760int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2872int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2761bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb); 2873bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb);
@@ -3176,7 +3288,7 @@ static inline int __dev_uc_sync(struct net_device *dev,
3176} 3288}
3177 3289
3178/** 3290/**
3179 * __dev_uc_unsync - Remove synchonized addresses from device 3291 * __dev_uc_unsync - Remove synchronized addresses from device
3180 * @dev: device to sync 3292 * @dev: device to sync
3181 * @unsync: function to call if address should be removed 3293 * @unsync: function to call if address should be removed
3182 * 3294 *
@@ -3220,7 +3332,7 @@ static inline int __dev_mc_sync(struct net_device *dev,
3220} 3332}
3221 3333
3222/** 3334/**
3223 * __dev_mc_unsync - Remove synchonized addresses from device 3335 * __dev_mc_unsync - Remove synchronized addresses from device
3224 * @dev: device to sync 3336 * @dev: device to sync
3225 * @unsync: function to call if address should be removed 3337 * @unsync: function to call if address should be removed
3226 * 3338 *
@@ -3357,6 +3469,27 @@ int __init dev_proc_init(void);
3357#define dev_proc_init() 0 3469#define dev_proc_init() 0
3358#endif 3470#endif
3359 3471
3472static inline netdev_tx_t __netdev_start_xmit(const struct net_device_ops *ops,
3473 struct sk_buff *skb, struct net_device *dev,
3474 bool more)
3475{
3476 skb->xmit_more = more ? 1 : 0;
3477 return ops->ndo_start_xmit(skb, dev);
3478}
3479
3480static inline netdev_tx_t netdev_start_xmit(struct sk_buff *skb, struct net_device *dev,
3481 struct netdev_queue *txq, bool more)
3482{
3483 const struct net_device_ops *ops = dev->netdev_ops;
3484 int rc;
3485
3486 rc = __netdev_start_xmit(ops, skb, dev, more);
3487 if (rc == NETDEV_TX_OK)
3488 txq_trans_update(txq);
3489
3490 return rc;
3491}
3492
3360int netdev_class_create_file_ns(struct class_attribute *class_attr, 3493int netdev_class_create_file_ns(struct class_attribute *class_attr,
3361 const void *ns); 3494 const void *ns);
3362void netdev_class_remove_file_ns(struct class_attribute *class_attr, 3495void netdev_class_remove_file_ns(struct class_attribute *class_attr,
@@ -3447,10 +3580,12 @@ static inline bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features)
3447 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 3580 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
3448} 3581}
3449 3582
3450static inline bool netif_needs_gso(struct sk_buff *skb, 3583static inline bool netif_needs_gso(struct net_device *dev, struct sk_buff *skb,
3451 netdev_features_t features) 3584 netdev_features_t features)
3452{ 3585{
3453 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || 3586 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
3587 (dev->netdev_ops->ndo_gso_check &&
3588 !dev->netdev_ops->ndo_gso_check(skb, dev)) ||
3454 unlikely((skb->ip_summed != CHECKSUM_PARTIAL) && 3589 unlikely((skb->ip_summed != CHECKSUM_PARTIAL) &&
3455 (skb->ip_summed != CHECKSUM_UNNECESSARY))); 3590 (skb->ip_summed != CHECKSUM_UNNECESSARY)));
3456} 3591}
@@ -3494,6 +3629,12 @@ static inline bool netif_supports_nofcs(struct net_device *dev)
3494 return dev->priv_flags & IFF_SUPP_NOFCS; 3629 return dev->priv_flags & IFF_SUPP_NOFCS;
3495} 3630}
3496 3631
3632/* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */
3633static inline void netif_keep_dst(struct net_device *dev)
3634{
3635 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM);
3636}
3637
3497extern struct pernet_operations __net_initdata loopback_net_ops; 3638extern struct pernet_operations __net_initdata loopback_net_ops;
3498 3639
3499/* Logging, debugging and troubleshooting/diagnostic helpers. */ 3640/* Logging, debugging and troubleshooting/diagnostic helpers. */
@@ -3523,22 +3664,22 @@ static inline const char *netdev_reg_state(const struct net_device *dev)
3523} 3664}
3524 3665
3525__printf(3, 4) 3666__printf(3, 4)
3526int netdev_printk(const char *level, const struct net_device *dev, 3667void netdev_printk(const char *level, const struct net_device *dev,
3527 const char *format, ...); 3668 const char *format, ...);
3528__printf(2, 3) 3669__printf(2, 3)
3529int netdev_emerg(const struct net_device *dev, const char *format, ...); 3670void netdev_emerg(const struct net_device *dev, const char *format, ...);
3530__printf(2, 3) 3671__printf(2, 3)
3531int netdev_alert(const struct net_device *dev, const char *format, ...); 3672void netdev_alert(const struct net_device *dev, const char *format, ...);
3532__printf(2, 3) 3673__printf(2, 3)
3533int netdev_crit(const struct net_device *dev, const char *format, ...); 3674void netdev_crit(const struct net_device *dev, const char *format, ...);
3534__printf(2, 3) 3675__printf(2, 3)
3535int netdev_err(const struct net_device *dev, const char *format, ...); 3676void netdev_err(const struct net_device *dev, const char *format, ...);
3536__printf(2, 3) 3677__printf(2, 3)
3537int netdev_warn(const struct net_device *dev, const char *format, ...); 3678void netdev_warn(const struct net_device *dev, const char *format, ...);
3538__printf(2, 3) 3679__printf(2, 3)
3539int netdev_notice(const struct net_device *dev, const char *format, ...); 3680void netdev_notice(const struct net_device *dev, const char *format, ...);
3540__printf(2, 3) 3681__printf(2, 3)
3541int netdev_info(const struct net_device *dev, const char *format, ...); 3682void netdev_info(const struct net_device *dev, const char *format, ...);
3542 3683
3543#define MODULE_ALIAS_NETDEV(device) \ 3684#define MODULE_ALIAS_NETDEV(device) \
3544 MODULE_ALIAS("netdev-" device) 3685 MODULE_ALIAS("netdev-" device)
@@ -3556,7 +3697,6 @@ do { \
3556({ \ 3697({ \
3557 if (0) \ 3698 if (0) \
3558 netdev_printk(KERN_DEBUG, __dev, format, ##args); \ 3699 netdev_printk(KERN_DEBUG, __dev, format, ##args); \
3559 0; \
3560}) 3700})
3561#endif 3701#endif
3562 3702
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 2077489f9887..2517ece98820 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -9,6 +9,7 @@
9#include <linux/in6.h> 9#include <linux/in6.h>
10#include <linux/wait.h> 10#include <linux/wait.h>
11#include <linux/list.h> 11#include <linux/list.h>
12#include <linux/static_key.h>
12#include <uapi/linux/netfilter.h> 13#include <uapi/linux/netfilter.h>
13#ifdef CONFIG_NETFILTER 14#ifdef CONFIG_NETFILTER
14static inline int NF_DROP_GETERR(int verdict) 15static inline int NF_DROP_GETERR(int verdict)
@@ -99,9 +100,9 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg);
99 100
100extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 101extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
101 102
102#if defined(CONFIG_JUMP_LABEL) 103#ifdef HAVE_JUMP_LABEL
103#include <linux/static_key.h>
104extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 104extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
105
105static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook) 106static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
106{ 107{
107 if (__builtin_constant_p(pf) && 108 if (__builtin_constant_p(pf) &&
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 96afc29184be..f1606fa6132d 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -57,6 +57,8 @@ enum ip_set_extension {
57 IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER), 57 IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER),
58 IPSET_EXT_BIT_COMMENT = 2, 58 IPSET_EXT_BIT_COMMENT = 2,
59 IPSET_EXT_COMMENT = (1 << IPSET_EXT_BIT_COMMENT), 59 IPSET_EXT_COMMENT = (1 << IPSET_EXT_BIT_COMMENT),
60 IPSET_EXT_BIT_SKBINFO = 3,
61 IPSET_EXT_SKBINFO = (1 << IPSET_EXT_BIT_SKBINFO),
60 /* Mark set with an extension which needs to call destroy */ 62 /* Mark set with an extension which needs to call destroy */
61 IPSET_EXT_BIT_DESTROY = 7, 63 IPSET_EXT_BIT_DESTROY = 7,
62 IPSET_EXT_DESTROY = (1 << IPSET_EXT_BIT_DESTROY), 64 IPSET_EXT_DESTROY = (1 << IPSET_EXT_BIT_DESTROY),
@@ -65,12 +67,14 @@ enum ip_set_extension {
65#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT) 67#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT)
66#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER) 68#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER)
67#define SET_WITH_COMMENT(s) ((s)->extensions & IPSET_EXT_COMMENT) 69#define SET_WITH_COMMENT(s) ((s)->extensions & IPSET_EXT_COMMENT)
70#define SET_WITH_SKBINFO(s) ((s)->extensions & IPSET_EXT_SKBINFO)
68#define SET_WITH_FORCEADD(s) ((s)->flags & IPSET_CREATE_FLAG_FORCEADD) 71#define SET_WITH_FORCEADD(s) ((s)->flags & IPSET_CREATE_FLAG_FORCEADD)
69 72
70/* Extension id, in size order */ 73/* Extension id, in size order */
71enum ip_set_ext_id { 74enum ip_set_ext_id {
72 IPSET_EXT_ID_COUNTER = 0, 75 IPSET_EXT_ID_COUNTER = 0,
73 IPSET_EXT_ID_TIMEOUT, 76 IPSET_EXT_ID_TIMEOUT,
77 IPSET_EXT_ID_SKBINFO,
74 IPSET_EXT_ID_COMMENT, 78 IPSET_EXT_ID_COMMENT,
75 IPSET_EXT_ID_MAX, 79 IPSET_EXT_ID_MAX,
76}; 80};
@@ -92,6 +96,10 @@ struct ip_set_ext {
92 u64 packets; 96 u64 packets;
93 u64 bytes; 97 u64 bytes;
94 u32 timeout; 98 u32 timeout;
99 u32 skbmark;
100 u32 skbmarkmask;
101 u32 skbprio;
102 u16 skbqueue;
95 char *comment; 103 char *comment;
96}; 104};
97 105
@@ -104,6 +112,13 @@ struct ip_set_comment {
104 char *str; 112 char *str;
105}; 113};
106 114
115struct ip_set_skbinfo {
116 u32 skbmark;
117 u32 skbmarkmask;
118 u32 skbprio;
119 u16 skbqueue;
120};
121
107struct ip_set; 122struct ip_set;
108 123
109#define ext_timeout(e, s) \ 124#define ext_timeout(e, s) \
@@ -112,7 +127,8 @@ struct ip_set;
112(struct ip_set_counter *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COUNTER]) 127(struct ip_set_counter *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COUNTER])
113#define ext_comment(e, s) \ 128#define ext_comment(e, s) \
114(struct ip_set_comment *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COMMENT]) 129(struct ip_set_comment *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COMMENT])
115 130#define ext_skbinfo(e, s) \
131(struct ip_set_skbinfo *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_SKBINFO])
116 132
117typedef int (*ipset_adtfn)(struct ip_set *set, void *value, 133typedef int (*ipset_adtfn)(struct ip_set *set, void *value,
118 const struct ip_set_ext *ext, 134 const struct ip_set_ext *ext,
@@ -256,6 +272,8 @@ ip_set_put_flags(struct sk_buff *skb, struct ip_set *set)
256 cadt_flags |= IPSET_FLAG_WITH_COUNTERS; 272 cadt_flags |= IPSET_FLAG_WITH_COUNTERS;
257 if (SET_WITH_COMMENT(set)) 273 if (SET_WITH_COMMENT(set))
258 cadt_flags |= IPSET_FLAG_WITH_COMMENT; 274 cadt_flags |= IPSET_FLAG_WITH_COMMENT;
275 if (SET_WITH_SKBINFO(set))
276 cadt_flags |= IPSET_FLAG_WITH_SKBINFO;
259 if (SET_WITH_FORCEADD(set)) 277 if (SET_WITH_FORCEADD(set))
260 cadt_flags |= IPSET_FLAG_WITH_FORCEADD; 278 cadt_flags |= IPSET_FLAG_WITH_FORCEADD;
261 279
@@ -304,6 +322,43 @@ ip_set_update_counter(struct ip_set_counter *counter,
304 } 322 }
305} 323}
306 324
325static inline void
326ip_set_get_skbinfo(struct ip_set_skbinfo *skbinfo,
327 const struct ip_set_ext *ext,
328 struct ip_set_ext *mext, u32 flags)
329{
330 mext->skbmark = skbinfo->skbmark;
331 mext->skbmarkmask = skbinfo->skbmarkmask;
332 mext->skbprio = skbinfo->skbprio;
333 mext->skbqueue = skbinfo->skbqueue;
334}
335static inline bool
336ip_set_put_skbinfo(struct sk_buff *skb, struct ip_set_skbinfo *skbinfo)
337{
338 /* Send nonzero parameters only */
339 return ((skbinfo->skbmark || skbinfo->skbmarkmask) &&
340 nla_put_net64(skb, IPSET_ATTR_SKBMARK,
341 cpu_to_be64((u64)skbinfo->skbmark << 32 |
342 skbinfo->skbmarkmask))) ||
343 (skbinfo->skbprio &&
344 nla_put_net32(skb, IPSET_ATTR_SKBPRIO,
345 cpu_to_be32(skbinfo->skbprio))) ||
346 (skbinfo->skbqueue &&
347 nla_put_net16(skb, IPSET_ATTR_SKBQUEUE,
348 cpu_to_be16(skbinfo->skbqueue)));
349
350}
351
352static inline void
353ip_set_init_skbinfo(struct ip_set_skbinfo *skbinfo,
354 const struct ip_set_ext *ext)
355{
356 skbinfo->skbmark = ext->skbmark;
357 skbinfo->skbmarkmask = ext->skbmarkmask;
358 skbinfo->skbprio = ext->skbprio;
359 skbinfo->skbqueue = ext->skbqueue;
360}
361
307static inline bool 362static inline bool
308ip_set_put_counter(struct sk_buff *skb, struct ip_set_counter *counter) 363ip_set_put_counter(struct sk_buff *skb, struct ip_set_counter *counter)
309{ 364{
@@ -497,6 +552,9 @@ ip_set_put_extensions(struct sk_buff *skb, const struct ip_set *set,
497 if (SET_WITH_COMMENT(set) && 552 if (SET_WITH_COMMENT(set) &&
498 ip_set_put_comment(skb, ext_comment(e, set))) 553 ip_set_put_comment(skb, ext_comment(e, set)))
499 return -EMSGSIZE; 554 return -EMSGSIZE;
555 if (SET_WITH_SKBINFO(set) &&
556 ip_set_put_skbinfo(skb, ext_skbinfo(e, set)))
557 return -EMSGSIZE;
500 return 0; 558 return 0;
501} 559}
502 560
diff --git a/include/linux/netfilter/ipset/ip_set_list.h b/include/linux/netfilter/ipset/ip_set_list.h
index 68c2aea897f5..fe2622a00151 100644
--- a/include/linux/netfilter/ipset/ip_set_list.h
+++ b/include/linux/netfilter/ipset/ip_set_list.h
@@ -6,5 +6,6 @@
6 6
7#define IP_SET_LIST_DEFAULT_SIZE 8 7#define IP_SET_LIST_DEFAULT_SIZE 8
8#define IP_SET_LIST_MIN_SIZE 4 8#define IP_SET_LIST_MIN_SIZE 4
9#define IP_SET_LIST_MAX_SIZE 65536
9 10
10#endif /* __IP_SET_LIST_H */ 11#endif /* __IP_SET_LIST_H */
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 8ab1c278b66d..c755e4971fa3 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -15,7 +15,7 @@ enum nf_br_hook_priorities {
15 NF_BR_PRI_LAST = INT_MAX, 15 NF_BR_PRI_LAST = INT_MAX,
16}; 16};
17 17
18#ifdef CONFIG_BRIDGE_NETFILTER 18#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
19 19
20#define BRNF_PKT_TYPE 0x01 20#define BRNF_PKT_TYPE 0x01
21#define BRNF_BRIDGED_DNAT 0x02 21#define BRNF_BRIDGED_DNAT 0x02
@@ -24,16 +24,6 @@ enum nf_br_hook_priorities {
24#define BRNF_8021Q 0x10 24#define BRNF_8021Q 0x10
25#define BRNF_PPPoE 0x20 25#define BRNF_PPPoE 0x20
26 26
27/* Only used in br_forward.c */
28int nf_bridge_copy_header(struct sk_buff *skb);
29static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
30{
31 if (skb->nf_bridge &&
32 skb->nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT))
33 return nf_bridge_copy_header(skb);
34 return 0;
35}
36
37static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb) 27static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
38{ 28{
39 switch (skb->protocol) { 29 switch (skb->protocol) {
@@ -46,6 +36,44 @@ static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
46 } 36 }
47} 37}
48 38
39static inline void nf_bridge_update_protocol(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
47/* Fill in the header for fragmented IP packets handled by
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{
54 int err;
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
63 skb_copy_to_linear_data_offset(skb, -header_size,
64 skb->nf_bridge->data, header_size);
65 __skb_push(skb, nf_bridge_encap_header_len(skb));
66 return 0;
67}
68
69static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
70{
71 if (skb->nf_bridge &&
72 skb->nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT))
73 return nf_bridge_copy_header(skb);
74 return 0;
75}
76
49static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb) 77static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
50{ 78{
51 if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE)) 79 if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE))
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index a1e3064a8d99..356acc2846fd 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -110,6 +110,20 @@ enum nfs_opnum4 {
110 OP_DESTROY_CLIENTID = 57, 110 OP_DESTROY_CLIENTID = 57,
111 OP_RECLAIM_COMPLETE = 58, 111 OP_RECLAIM_COMPLETE = 58,
112 112
113 /* nfs42 */
114 OP_ALLOCATE = 59,
115 OP_COPY = 60,
116 OP_COPY_NOTIFY = 61,
117 OP_DEALLOCATE = 62,
118 OP_IO_ADVISE = 63,
119 OP_LAYOUTERROR = 64,
120 OP_LAYOUTSTATS = 65,
121 OP_OFFLOAD_CANCEL = 66,
122 OP_OFFLOAD_STATUS = 67,
123 OP_READ_PLUS = 68,
124 OP_SEEK = 69,
125 OP_WRITE_SAME = 70,
126
113 OP_ILLEGAL = 10044, 127 OP_ILLEGAL = 10044,
114}; 128};
115 129
@@ -117,10 +131,10 @@ enum nfs_opnum4 {
117Needs to be updated if more operations are defined in future.*/ 131Needs to be updated if more operations are defined in future.*/
118 132
119#define FIRST_NFS4_OP OP_ACCESS 133#define FIRST_NFS4_OP OP_ACCESS
120#define LAST_NFS4_OP OP_RECLAIM_COMPLETE 134#define LAST_NFS4_OP OP_WRITE_SAME
121#define LAST_NFS40_OP OP_RELEASE_LOCKOWNER 135#define LAST_NFS40_OP OP_RELEASE_LOCKOWNER
122#define LAST_NFS41_OP OP_RECLAIM_COMPLETE 136#define LAST_NFS41_OP OP_RECLAIM_COMPLETE
123#define LAST_NFS42_OP OP_RECLAIM_COMPLETE 137#define LAST_NFS42_OP OP_WRITE_SAME
124 138
125enum nfsstat4 { 139enum nfsstat4 {
126 NFS4_OK = 0, 140 NFS4_OK = 0,
@@ -235,10 +249,11 @@ enum nfsstat4 {
235 /* nfs42 */ 249 /* nfs42 */
236 NFS4ERR_PARTNER_NOTSUPP = 10088, 250 NFS4ERR_PARTNER_NOTSUPP = 10088,
237 NFS4ERR_PARTNER_NO_AUTH = 10089, 251 NFS4ERR_PARTNER_NO_AUTH = 10089,
238 NFS4ERR_METADATA_NOTSUPP = 10090, 252 NFS4ERR_UNION_NOTSUPP = 10090,
239 NFS4ERR_OFFLOAD_DENIED = 10091, 253 NFS4ERR_OFFLOAD_DENIED = 10091,
240 NFS4ERR_WRONG_LFS = 10092, 254 NFS4ERR_WRONG_LFS = 10092,
241 NFS4ERR_BADLABEL = 10093, 255 NFS4ERR_BADLABEL = 10093,
256 NFS4ERR_OFFLOAD_NO_REQS = 10094,
242}; 257};
243 258
244static inline bool seqid_mutating_err(u32 err) 259static inline bool seqid_mutating_err(u32 err)
@@ -472,6 +487,9 @@ enum {
472 NFSPROC4_CLNT_GETDEVICELIST, 487 NFSPROC4_CLNT_GETDEVICELIST,
473 NFSPROC4_CLNT_BIND_CONN_TO_SESSION, 488 NFSPROC4_CLNT_BIND_CONN_TO_SESSION,
474 NFSPROC4_CLNT_DESTROY_CLIENTID, 489 NFSPROC4_CLNT_DESTROY_CLIENTID,
490
491 /* nfs42 */
492 NFSPROC4_CLNT_SEEK,
475}; 493};
476 494
477/* nfs41 types */ 495/* nfs41 types */
@@ -535,4 +553,9 @@ struct nfs4_deviceid {
535 char data[NFS4_DEVICEID4_SIZE]; 553 char data[NFS4_DEVICEID4_SIZE];
536}; 554};
537 555
556enum data_content4 {
557 NFS4_CONTENT_DATA = 0,
558 NFS4_CONTENT_HOLE = 1,
559};
560
538#endif 561#endif
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index e30f6059ecd6..c72d1ad41ad4 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -52,6 +52,7 @@ struct nfs_access_entry {
52 unsigned long jiffies; 52 unsigned long jiffies;
53 struct rpc_cred * cred; 53 struct rpc_cred * cred;
54 int mask; 54 int mask;
55 struct rcu_head rcu_head;
55}; 56};
56 57
57struct nfs_lockowner { 58struct nfs_lockowner {
@@ -352,6 +353,7 @@ extern int nfs_release(struct inode *, struct file *);
352extern int nfs_attribute_timeout(struct inode *inode); 353extern int nfs_attribute_timeout(struct inode *inode);
353extern int nfs_attribute_cache_expired(struct inode *inode); 354extern int nfs_attribute_cache_expired(struct inode *inode);
354extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 355extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
356extern int nfs_revalidate_inode_rcu(struct nfs_server *server, struct inode *inode);
355extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 357extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
356extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 358extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
357extern int nfs_setattr(struct dentry *, struct iattr *); 359extern int nfs_setattr(struct dentry *, struct iattr *);
@@ -441,31 +443,15 @@ static inline struct rpc_cred *nfs_file_cred(struct file *file)
441} 443}
442 444
443/* 445/*
444 * linux/fs/nfs/xattr.c
445 */
446#ifdef CONFIG_NFS_V3_ACL
447extern ssize_t nfs3_listxattr(struct dentry *, char *, size_t);
448extern ssize_t nfs3_getxattr(struct dentry *, const char *, void *, size_t);
449extern int nfs3_setxattr(struct dentry *, const char *,
450 const void *, size_t, int);
451extern int nfs3_removexattr (struct dentry *, const char *name);
452#else
453# define nfs3_listxattr NULL
454# define nfs3_getxattr NULL
455# define nfs3_setxattr NULL
456# define nfs3_removexattr NULL
457#endif
458
459/*
460 * linux/fs/nfs/direct.c 446 * linux/fs/nfs/direct.c
461 */ 447 */
462extern ssize_t nfs_direct_IO(int, struct kiocb *, struct iov_iter *, loff_t); 448extern ssize_t nfs_direct_IO(int, struct kiocb *, struct iov_iter *, loff_t);
463extern ssize_t nfs_file_direct_read(struct kiocb *iocb, 449extern ssize_t nfs_file_direct_read(struct kiocb *iocb,
464 struct iov_iter *iter, 450 struct iov_iter *iter,
465 loff_t pos, bool uio); 451 loff_t pos);
466extern ssize_t nfs_file_direct_write(struct kiocb *iocb, 452extern ssize_t nfs_file_direct_write(struct kiocb *iocb,
467 struct iov_iter *iter, 453 struct iov_iter *iter,
468 loff_t pos, bool uio); 454 loff_t pos);
469 455
470/* 456/*
471 * linux/fs/nfs/dir.c 457 * linux/fs/nfs/dir.c
@@ -527,17 +513,9 @@ extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned
527extern int nfs_wb_all(struct inode *inode); 513extern int nfs_wb_all(struct inode *inode);
528extern int nfs_wb_page(struct inode *inode, struct page* page); 514extern int nfs_wb_page(struct inode *inode, struct page* page);
529extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 515extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
530#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
531extern int nfs_commit_inode(struct inode *, int); 516extern int nfs_commit_inode(struct inode *, int);
532extern struct nfs_commit_data *nfs_commitdata_alloc(void); 517extern struct nfs_commit_data *nfs_commitdata_alloc(void);
533extern void nfs_commit_free(struct nfs_commit_data *data); 518extern void nfs_commit_free(struct nfs_commit_data *data);
534#else
535static inline int
536nfs_commit_inode(struct inode *inode, int how)
537{
538 return 0;
539}
540#endif
541 519
542static inline int 520static inline int
543nfs_have_writebacks(struct inode *inode) 521nfs_have_writebacks(struct inode *inode)
@@ -555,23 +533,6 @@ extern int nfs_readpage_async(struct nfs_open_context *, struct inode *,
555 struct page *); 533 struct page *);
556 534
557/* 535/*
558 * linux/fs/nfs3proc.c
559 */
560#ifdef CONFIG_NFS_V3_ACL
561extern struct posix_acl *nfs3_get_acl(struct inode *inode, int type);
562extern int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type);
563extern int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
564 struct posix_acl *dfacl);
565extern const struct xattr_handler *nfs3_xattr_handlers[];
566#else
567static inline int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
568 struct posix_acl *dfacl)
569{
570 return 0;
571}
572#endif /* CONFIG_NFS_V3_ACL */
573
574/*
575 * inline functions 536 * inline functions
576 */ 537 */
577 538
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 1150ea41b626..a32ba0d7a98f 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -45,6 +45,7 @@ struct nfs_client {
45 struct sockaddr_storage cl_addr; /* server identifier */ 45 struct sockaddr_storage cl_addr; /* server identifier */
46 size_t cl_addrlen; 46 size_t cl_addrlen;
47 char * cl_hostname; /* hostname of server */ 47 char * cl_hostname; /* hostname of server */
48 char * cl_acceptor; /* GSSAPI acceptor name */
48 struct list_head cl_share_link; /* link in global client list */ 49 struct list_head cl_share_link; /* link in global client list */
49 struct list_head cl_superblocks; /* List of nfs_server structs */ 50 struct list_head cl_superblocks; /* List of nfs_server structs */
50 51
@@ -229,5 +230,6 @@ struct nfs_server {
229#define NFS_CAP_STATEID_NFSV41 (1U << 16) 230#define NFS_CAP_STATEID_NFSV41 (1U << 16)
230#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17) 231#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17)
231#define NFS_CAP_SECURITY_LABEL (1U << 18) 232#define NFS_CAP_SECURITY_LABEL (1U << 18)
233#define NFS_CAP_SEEK (1U << 19)
232 234
233#endif 235#endif
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 7d9096d95d4a..6c3e06ee2fb7 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -26,7 +26,7 @@ enum {
26 PG_MAPPED, /* page private set for buffered io */ 26 PG_MAPPED, /* page private set for buffered io */
27 PG_CLEAN, /* write succeeded */ 27 PG_CLEAN, /* write succeeded */
28 PG_COMMIT_TO_DS, /* used by pnfs layouts */ 28 PG_COMMIT_TO_DS, /* used by pnfs layouts */
29 PG_INODE_REF, /* extra ref held by inode (head req only) */ 29 PG_INODE_REF, /* extra ref held by inode when in writeback */
30 PG_HEADLOCK, /* page group lock of wb_head */ 30 PG_HEADLOCK, /* page group lock of wb_head */
31 PG_TEARDOWN, /* page group sync for destroy */ 31 PG_TEARDOWN, /* page group sync for destroy */
32 PG_UNLOCKPAGE, /* page group sync bit in read path */ 32 PG_UNLOCKPAGE, /* page group sync bit in read path */
@@ -62,12 +62,13 @@ struct nfs_pageio_ops {
62 62
63struct nfs_rw_ops { 63struct nfs_rw_ops {
64 const fmode_t rw_mode; 64 const fmode_t rw_mode;
65 struct nfs_rw_header *(*rw_alloc_header)(void); 65 struct nfs_pgio_header *(*rw_alloc_header)(void);
66 void (*rw_free_header)(struct nfs_rw_header *); 66 void (*rw_free_header)(struct nfs_pgio_header *);
67 void (*rw_release)(struct nfs_pgio_data *); 67 void (*rw_release)(struct nfs_pgio_header *);
68 int (*rw_done)(struct rpc_task *, struct nfs_pgio_data *, struct inode *); 68 int (*rw_done)(struct rpc_task *, struct nfs_pgio_header *,
69 void (*rw_result)(struct rpc_task *, struct nfs_pgio_data *); 69 struct inode *);
70 void (*rw_initiate)(struct nfs_pgio_data *, struct rpc_message *, 70 void (*rw_result)(struct rpc_task *, struct nfs_pgio_header *);
71 void (*rw_initiate)(struct nfs_pgio_header *, struct rpc_message *,
71 struct rpc_task_setup *, int); 72 struct rpc_task_setup *, int);
72}; 73};
73 74
@@ -111,6 +112,8 @@ extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
111 int how); 112 int how);
112extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *, 113extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *,
113 struct nfs_page *); 114 struct nfs_page *);
115extern int nfs_pageio_resend(struct nfs_pageio_descriptor *,
116 struct nfs_pgio_header *);
114extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc); 117extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc);
115extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t); 118extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t);
116extern size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, 119extern size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc,
@@ -119,7 +122,8 @@ extern size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc,
119extern int nfs_wait_on_request(struct nfs_page *); 122extern int nfs_wait_on_request(struct nfs_page *);
120extern void nfs_unlock_request(struct nfs_page *req); 123extern void nfs_unlock_request(struct nfs_page *req);
121extern void nfs_unlock_and_release_request(struct nfs_page *); 124extern void nfs_unlock_and_release_request(struct nfs_page *);
122extern void nfs_page_group_lock(struct nfs_page *); 125extern int nfs_page_group_lock(struct nfs_page *, bool);
126extern void nfs_page_group_lock_wait(struct nfs_page *);
123extern void nfs_page_group_unlock(struct nfs_page *); 127extern void nfs_page_group_unlock(struct nfs_page *);
124extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int); 128extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int);
125 129
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 9a1396e70310..47ebb4fafd87 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -252,17 +252,6 @@ struct nfs4_layoutget {
252 gfp_t gfp_flags; 252 gfp_t gfp_flags;
253}; 253};
254 254
255struct nfs4_getdevicelist_args {
256 struct nfs4_sequence_args seq_args;
257 const struct nfs_fh *fh;
258 u32 layoutclass;
259};
260
261struct nfs4_getdevicelist_res {
262 struct nfs4_sequence_res seq_res;
263 struct pnfs_devicelist *devlist;
264};
265
266struct nfs4_getdeviceinfo_args { 255struct nfs4_getdeviceinfo_args {
267 struct nfs4_sequence_args seq_args; 256 struct nfs4_sequence_args seq_args;
268 struct pnfs_device *pdev; 257 struct pnfs_device *pdev;
@@ -279,6 +268,9 @@ struct nfs4_layoutcommit_args {
279 __u64 lastbytewritten; 268 __u64 lastbytewritten;
280 struct inode *inode; 269 struct inode *inode;
281 const u32 *bitmask; 270 const u32 *bitmask;
271 size_t layoutupdate_len;
272 struct page *layoutupdate_page;
273 struct page **layoutupdate_pages;
282}; 274};
283 275
284struct nfs4_layoutcommit_res { 276struct nfs4_layoutcommit_res {
@@ -993,6 +985,7 @@ struct nfs4_setclientid {
993 unsigned int sc_uaddr_len; 985 unsigned int sc_uaddr_len;
994 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1]; 986 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
995 u32 sc_cb_ident; 987 u32 sc_cb_ident;
988 struct rpc_cred *sc_cred;
996}; 989};
997 990
998struct nfs4_setclientid_res { 991struct nfs4_setclientid_res {
@@ -1231,13 +1224,43 @@ struct nfs41_free_stateid_res {
1231 unsigned int status; 1224 unsigned int status;
1232}; 1225};
1233 1226
1227static inline void
1228nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1229{
1230 kfree(cinfo->buckets);
1231}
1232
1234#else 1233#else
1235 1234
1236struct pnfs_ds_commit_info { 1235struct pnfs_ds_commit_info {
1237}; 1236};
1238 1237
1238static inline void
1239nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1240{
1241}
1242
1239#endif /* CONFIG_NFS_V4_1 */ 1243#endif /* CONFIG_NFS_V4_1 */
1240 1244
1245#ifdef CONFIG_NFS_V4_2
1246struct nfs42_seek_args {
1247 struct nfs4_sequence_args seq_args;
1248
1249 struct nfs_fh *sa_fh;
1250 nfs4_stateid sa_stateid;
1251 u64 sa_offset;
1252 u32 sa_what;
1253};
1254
1255struct nfs42_seek_res {
1256 struct nfs4_sequence_res seq_res;
1257 unsigned int status;
1258
1259 u32 sr_eof;
1260 u64 sr_offset;
1261};
1262#endif
1263
1241struct nfs_page; 1264struct nfs_page;
1242 1265
1243#define NFS_PAGEVEC_SIZE (8U) 1266#define NFS_PAGEVEC_SIZE (8U)
@@ -1253,18 +1276,12 @@ enum {
1253 NFS_IOHDR_ERROR = 0, 1276 NFS_IOHDR_ERROR = 0,
1254 NFS_IOHDR_EOF, 1277 NFS_IOHDR_EOF,
1255 NFS_IOHDR_REDO, 1278 NFS_IOHDR_REDO,
1256 NFS_IOHDR_NEED_COMMIT,
1257 NFS_IOHDR_NEED_RESCHED,
1258}; 1279};
1259 1280
1260struct nfs_pgio_data;
1261
1262struct nfs_pgio_header { 1281struct nfs_pgio_header {
1263 struct inode *inode; 1282 struct inode *inode;
1264 struct rpc_cred *cred; 1283 struct rpc_cred *cred;
1265 struct list_head pages; 1284 struct list_head pages;
1266 struct nfs_pgio_data *data;
1267 atomic_t refcnt;
1268 struct nfs_page *req; 1285 struct nfs_page *req;
1269 struct nfs_writeverf verf; /* Used for writes */ 1286 struct nfs_writeverf verf; /* Used for writes */
1270 struct pnfs_layout_segment *lseg; 1287 struct pnfs_layout_segment *lseg;
@@ -1281,28 +1298,22 @@ struct nfs_pgio_header {
1281 int error; /* merge with pnfs_error */ 1298 int error; /* merge with pnfs_error */
1282 unsigned long good_bytes; /* boundary of good data */ 1299 unsigned long good_bytes; /* boundary of good data */
1283 unsigned long flags; 1300 unsigned long flags;
1284};
1285 1301
1286struct nfs_pgio_data { 1302 /*
1287 struct nfs_pgio_header *header; 1303 * rpc data
1304 */
1288 struct rpc_task task; 1305 struct rpc_task task;
1289 struct nfs_fattr fattr; 1306 struct nfs_fattr fattr;
1290 struct nfs_writeverf verf; /* Used for writes */
1291 struct nfs_pgio_args args; /* argument struct */ 1307 struct nfs_pgio_args args; /* argument struct */
1292 struct nfs_pgio_res res; /* result struct */ 1308 struct nfs_pgio_res res; /* result struct */
1293 unsigned long timestamp; /* For lease renewal */ 1309 unsigned long timestamp; /* For lease renewal */
1294 int (*pgio_done_cb) (struct rpc_task *task, struct nfs_pgio_data *data); 1310 int (*pgio_done_cb)(struct rpc_task *, struct nfs_pgio_header *);
1295 __u64 mds_offset; /* Filelayout dense stripe */ 1311 __u64 mds_offset; /* Filelayout dense stripe */
1296 struct nfs_page_array pages; 1312 struct nfs_page_array page_array;
1297 struct nfs_client *ds_clp; /* pNFS data server */ 1313 struct nfs_client *ds_clp; /* pNFS data server */
1298 int ds_idx; /* ds index if ds_clp is set */ 1314 int ds_idx; /* ds index if ds_clp is set */
1299}; 1315};
1300 1316
1301struct nfs_rw_header {
1302 struct nfs_pgio_header header;
1303 struct nfs_pgio_data rpc_data;
1304};
1305
1306struct nfs_mds_commit_info { 1317struct nfs_mds_commit_info {
1307 atomic_t rpcs_out; 1318 atomic_t rpcs_out;
1308 unsigned long ncommit; 1319 unsigned long ncommit;
@@ -1339,6 +1350,7 @@ struct nfs_commit_data {
1339 struct pnfs_layout_segment *lseg; 1350 struct pnfs_layout_segment *lseg;
1340 struct nfs_client *ds_clp; /* pNFS data server */ 1351 struct nfs_client *ds_clp; /* pNFS data server */
1341 int ds_commit_index; 1352 int ds_commit_index;
1353 loff_t lwb;
1342 const struct rpc_call_ops *mds_ops; 1354 const struct rpc_call_ops *mds_ops;
1343 const struct nfs_commit_completion_ops *completion_ops; 1355 const struct nfs_commit_completion_ops *completion_ops;
1344 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data); 1356 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
@@ -1357,6 +1369,7 @@ struct nfs_unlinkdata {
1357 struct inode *dir; 1369 struct inode *dir;
1358 struct rpc_cred *cred; 1370 struct rpc_cred *cred;
1359 struct nfs_fattr dir_attr; 1371 struct nfs_fattr dir_attr;
1372 long timeout;
1360}; 1373};
1361 1374
1362struct nfs_renamedata { 1375struct nfs_renamedata {
@@ -1370,6 +1383,7 @@ struct nfs_renamedata {
1370 struct dentry *new_dentry; 1383 struct dentry *new_dentry;
1371 struct nfs_fattr new_fattr; 1384 struct nfs_fattr new_fattr;
1372 void (*complete)(struct rpc_task *, struct nfs_renamedata *); 1385 void (*complete)(struct rpc_task *, struct nfs_renamedata *);
1386 long timeout;
1373}; 1387};
1374 1388
1375struct nfs_access_entry; 1389struct nfs_access_entry;
@@ -1432,11 +1446,12 @@ struct nfs_rpc_ops {
1432 struct nfs_pathconf *); 1446 struct nfs_pathconf *);
1433 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 1447 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1434 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int); 1448 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
1435 int (*pgio_rpc_prepare)(struct rpc_task *, struct nfs_pgio_data *); 1449 int (*pgio_rpc_prepare)(struct rpc_task *,
1436 void (*read_setup) (struct nfs_pgio_data *, struct rpc_message *); 1450 struct nfs_pgio_header *);
1437 int (*read_done) (struct rpc_task *, struct nfs_pgio_data *); 1451 void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *);
1438 void (*write_setup) (struct nfs_pgio_data *, struct rpc_message *); 1452 int (*read_done)(struct rpc_task *, struct nfs_pgio_header *);
1439 int (*write_done) (struct rpc_task *, struct nfs_pgio_data *); 1453 void (*write_setup)(struct nfs_pgio_header *, struct rpc_message *);
1454 int (*write_done)(struct rpc_task *, struct nfs_pgio_header *);
1440 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *); 1455 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
1441 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *); 1456 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
1442 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *); 1457 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 1d2a6ab6b8bb..9b2022ab4d85 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -24,6 +24,19 @@ static inline void touch_nmi_watchdog(void)
24} 24}
25#endif 25#endif
26 26
27#if defined(CONFIG_HARDLOCKUP_DETECTOR)
28extern void watchdog_enable_hardlockup_detector(bool val);
29extern bool watchdog_hardlockup_detector_is_enabled(void);
30#else
31static inline void watchdog_enable_hardlockup_detector(bool val)
32{
33}
34static inline bool watchdog_hardlockup_detector_is_enabled(void)
35{
36 return true;
37}
38#endif
39
27/* 40/*
28 * Create trigger_all_cpu_backtrace() out of the arch-provided 41 * Create trigger_all_cpu_backtrace() out of the arch-provided
29 * base function. Return whether such support was available, 42 * base function. Return whether such support was available,
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 58b9a02c38d2..83a6aeda899d 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -430,7 +430,15 @@ static inline int num_node_state(enum node_states state)
430 for_each_node_mask((__node), node_states[__state]) 430 for_each_node_mask((__node), node_states[__state])
431 431
432#define first_online_node first_node(node_states[N_ONLINE]) 432#define first_online_node first_node(node_states[N_ONLINE])
433#define next_online_node(nid) next_node((nid), node_states[N_ONLINE]) 433#define first_memory_node first_node(node_states[N_MEMORY])
434static inline int next_online_node(int nid)
435{
436 return next_node(nid, node_states[N_ONLINE]);
437}
438static inline int next_memory_node(int nid)
439{
440 return next_node(nid, node_states[N_MEMORY]);
441}
434 442
435extern int nr_node_ids; 443extern int nr_node_ids;
436extern int nr_online_nodes; 444extern int nr_online_nodes;
@@ -471,6 +479,7 @@ static inline int num_node_state(enum node_states state)
471 for ( (node) = 0; (node) == 0; (node) = 1) 479 for ( (node) = 0; (node) == 0; (node) = 1)
472 480
473#define first_online_node 0 481#define first_online_node 0
482#define first_memory_node 0
474#define next_online_node(nid) (MAX_NUMNODES) 483#define next_online_node(nid) (MAX_NUMNODES)
475#define nr_node_ids 1 484#define nr_node_ids 1
476#define nr_online_nodes 1 485#define nr_online_nodes 1
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index b4ec59d159ac..35fa08fd7739 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -40,32 +40,28 @@ extern struct nsproxy init_nsproxy;
40 * the namespaces access rules are: 40 * the namespaces access rules are:
41 * 41 *
42 * 1. only current task is allowed to change tsk->nsproxy pointer or 42 * 1. only current task is allowed to change tsk->nsproxy pointer or
43 * any pointer on the nsproxy itself 43 * any pointer on the nsproxy itself. Current must hold the task_lock
44 * when changing tsk->nsproxy.
44 * 45 *
45 * 2. when accessing (i.e. reading) current task's namespaces - no 46 * 2. when accessing (i.e. reading) current task's namespaces - no
46 * precautions should be taken - just dereference the pointers 47 * precautions should be taken - just dereference the pointers
47 * 48 *
48 * 3. the access to other task namespaces is performed like this 49 * 3. the access to other task namespaces is performed like this
49 * rcu_read_lock(); 50 * task_lock(task);
50 * nsproxy = task_nsproxy(tsk); 51 * nsproxy = task->nsproxy;
51 * if (nsproxy != NULL) { 52 * if (nsproxy != NULL) {
52 * / * 53 * / *
53 * * work with the namespaces here 54 * * work with the namespaces here
54 * * e.g. get the reference on one of them 55 * * e.g. get the reference on one of them
55 * * / 56 * * /
56 * } / * 57 * } / *
57 * * NULL task_nsproxy() means that this task is 58 * * NULL task->nsproxy means that this task is
58 * * almost dead (zombie) 59 * * almost dead (zombie)
59 * * / 60 * * /
60 * rcu_read_unlock(); 61 * task_unlock(task);
61 * 62 *
62 */ 63 */
63 64
64static inline struct nsproxy *task_nsproxy(struct task_struct *tsk)
65{
66 return rcu_dereference(tsk->nsproxy);
67}
68
69int copy_namespaces(unsigned long flags, struct task_struct *tsk); 65int copy_namespaces(unsigned long flags, struct task_struct *tsk);
70void exit_task_namespaces(struct task_struct *tsk); 66void exit_task_namespaces(struct task_struct *tsk);
71void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new); 67void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new);
diff --git a/include/linux/of.h b/include/linux/of.h
index 196b34c1ef4e..29f0adc5f3e4 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -74,8 +74,6 @@ struct of_phandle_args {
74 uint32_t args[MAX_PHANDLE_ARGS]; 74 uint32_t args[MAX_PHANDLE_ARGS];
75}; 75};
76 76
77extern int of_node_add(struct device_node *node);
78
79/* initialize a node */ 77/* initialize a node */
80extern struct kobj_type of_node_ktype; 78extern struct kobj_type of_node_ktype;
81static inline void of_node_init(struct device_node *node) 79static inline void of_node_init(struct device_node *node)
@@ -113,6 +111,7 @@ static inline void of_node_put(struct device_node *node) { }
113extern struct device_node *of_allnodes; 111extern struct device_node *of_allnodes;
114extern struct device_node *of_chosen; 112extern struct device_node *of_chosen;
115extern struct device_node *of_aliases; 113extern struct device_node *of_aliases;
114extern struct device_node *of_stdout;
116extern raw_spinlock_t devtree_lock; 115extern raw_spinlock_t devtree_lock;
117 116
118static inline bool of_have_populated_dt(void) 117static inline bool of_have_populated_dt(void)
@@ -204,6 +203,7 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
204#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ 203#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
205#define OF_DETACHED 2 /* node has been detached from the device tree */ 204#define OF_DETACHED 2 /* node has been detached from the device tree */
206#define OF_POPULATED 3 /* device already created for the node */ 205#define OF_POPULATED 3 /* device already created for the node */
206#define OF_POPULATED_BUS 4 /* of_platform_populate recursed to children of this node */
207 207
208#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) 208#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
209#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) 209#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
@@ -267,14 +267,12 @@ extern int of_property_read_u64(const struct device_node *np,
267extern int of_property_read_string(struct device_node *np, 267extern int of_property_read_string(struct device_node *np,
268 const char *propname, 268 const char *propname,
269 const char **out_string); 269 const char **out_string);
270extern int of_property_read_string_index(struct device_node *np,
271 const char *propname,
272 int index, const char **output);
273extern int of_property_match_string(struct device_node *np, 270extern int of_property_match_string(struct device_node *np,
274 const char *propname, 271 const char *propname,
275 const char *string); 272 const char *string);
276extern int of_property_count_strings(struct device_node *np, 273extern int of_property_read_string_helper(struct device_node *np,
277 const char *propname); 274 const char *propname,
275 const char **out_strs, size_t sz, int index);
278extern int of_device_is_compatible(const struct device_node *device, 276extern int of_device_is_compatible(const struct device_node *device,
279 const char *); 277 const char *);
280extern int of_device_is_available(const struct device_node *device); 278extern int of_device_is_available(const struct device_node *device);
@@ -322,6 +320,7 @@ extern int of_update_property(struct device_node *np, struct property *newprop);
322struct of_prop_reconfig { 320struct of_prop_reconfig {
323 struct device_node *dn; 321 struct device_node *dn;
324 struct property *prop; 322 struct property *prop;
323 struct property *old_prop;
325}; 324};
326 325
327extern int of_reconfig_notifier_register(struct notifier_block *); 326extern int of_reconfig_notifier_register(struct notifier_block *);
@@ -352,7 +351,7 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
352 */ 351 */
353const char *of_prop_next_string(struct property *prop, const char *cur); 352const char *of_prop_next_string(struct property *prop, const char *cur);
354 353
355int of_device_is_stdout_path(struct device_node *dn); 354bool of_console_check(struct device_node *dn, char *name, int index);
356 355
357#else /* CONFIG_OF */ 356#else /* CONFIG_OF */
358 357
@@ -485,15 +484,9 @@ static inline int of_property_read_string(struct device_node *np,
485 return -ENOSYS; 484 return -ENOSYS;
486} 485}
487 486
488static inline int of_property_read_string_index(struct device_node *np, 487static inline int of_property_read_string_helper(struct device_node *np,
489 const char *propname, int index, 488 const char *propname,
490 const char **out_string) 489 const char **out_strs, size_t sz, int index)
491{
492 return -ENOSYS;
493}
494
495static inline int of_property_count_strings(struct device_node *np,
496 const char *propname)
497{ 490{
498 return -ENOSYS; 491 return -ENOSYS;
499} 492}
@@ -564,9 +557,9 @@ static inline int of_machine_is_compatible(const char *compat)
564 return 0; 557 return 0;
565} 558}
566 559
567static inline int of_device_is_stdout_path(struct device_node *dn) 560static inline bool of_console_check(const struct device_node *dn, const char *name, int index)
568{ 561{
569 return 0; 562 return false;
570} 563}
571 564
572static inline const __be32 *of_prop_next_u32(struct property *prop, 565static inline const __be32 *of_prop_next_u32(struct property *prop,
@@ -667,6 +660,70 @@ static inline int of_property_count_u64_elems(const struct device_node *np,
667} 660}
668 661
669/** 662/**
663 * of_property_read_string_array() - Read an array of strings from a multiple
664 * strings property.
665 * @np: device node from which the property value is to be read.
666 * @propname: name of the property to be searched.
667 * @out_strs: output array of string pointers.
668 * @sz: number of array elements to read.
669 *
670 * Search for a property in a device tree node and retrieve a list of
671 * terminated string values (pointer to data, not a copy) in that property.
672 *
673 * If @out_strs is NULL, the number of strings in the property is returned.
674 */
675static inline int of_property_read_string_array(struct device_node *np,
676 const char *propname, const char **out_strs,
677 size_t sz)
678{
679 return of_property_read_string_helper(np, propname, out_strs, sz, 0);
680}
681
682/**
683 * of_property_count_strings() - Find and return the number of strings from a
684 * multiple strings property.
685 * @np: device node from which the property value is to be read.
686 * @propname: name of the property to be searched.
687 *
688 * Search for a property in a device tree node and retrieve the number of null
689 * terminated string contain in it. Returns the number of strings on
690 * success, -EINVAL if the property does not exist, -ENODATA if property
691 * does not have a value, and -EILSEQ if the string is not null-terminated
692 * within the length of the property data.
693 */
694static inline int of_property_count_strings(struct device_node *np,
695 const char *propname)
696{
697 return of_property_read_string_helper(np, propname, NULL, 0, 0);
698}
699
700/**
701 * of_property_read_string_index() - Find and read a string from a multiple
702 * strings property.
703 * @np: device node from which the property value is to be read.
704 * @propname: name of the property to be searched.
705 * @index: index of the string in the list of strings
706 * @out_string: pointer to null terminated return string, modified only if
707 * return value is 0.
708 *
709 * Search for a property in a device tree node and retrieve a null
710 * terminated string value (pointer to data, not a copy) in the list of strings
711 * contained in that property.
712 * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
713 * property does not have a value, and -EILSEQ if the string is not
714 * null-terminated within the length of the property data.
715 *
716 * The out_string pointer is modified only if a valid string can be decoded.
717 */
718static inline int of_property_read_string_index(struct device_node *np,
719 const char *propname,
720 int index, const char **output)
721{
722 int rc = of_property_read_string_helper(np, propname, output, 1, index);
723 return rc < 0 ? rc : 0;
724}
725
726/**
670 * of_property_read_bool - Findfrom a property 727 * of_property_read_bool - Findfrom a property
671 * @np: device node from which the property value is to be read. 728 * @np: device node from which the property value is to be read.
672 * @propname: name of the property to be searched. 729 * @propname: name of the property to be searched.
@@ -786,4 +843,83 @@ typedef void (*of_init_fn_1)(struct device_node *);
786#define OF_DECLARE_2(table, name, compat, fn) \ 843#define OF_DECLARE_2(table, name, compat, fn) \
787 _OF_DECLARE(table, name, compat, fn, of_init_fn_2) 844 _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
788 845
846/**
847 * struct of_changeset_entry - Holds a changeset entry
848 *
849 * @node: list_head for the log list
850 * @action: notifier action
851 * @np: pointer to the device node affected
852 * @prop: pointer to the property affected
853 * @old_prop: hold a pointer to the original property
854 *
855 * Every modification of the device tree during a changeset
856 * is held in a list of of_changeset_entry structures.
857 * That way we can recover from a partial application, or we can
858 * revert the changeset
859 */
860struct of_changeset_entry {
861 struct list_head node;
862 unsigned long action;
863 struct device_node *np;
864 struct property *prop;
865 struct property *old_prop;
866};
867
868/**
869 * struct of_changeset - changeset tracker structure
870 *
871 * @entries: list_head for the changeset entries
872 *
873 * changesets are a convenient way to apply bulk changes to the
874 * live tree. In case of an error, changes are rolled-back.
875 * changesets live on after initial application, and if not
876 * destroyed after use, they can be reverted in one single call.
877 */
878struct of_changeset {
879 struct list_head entries;
880};
881
882#ifdef CONFIG_OF_DYNAMIC
883extern void of_changeset_init(struct of_changeset *ocs);
884extern void of_changeset_destroy(struct of_changeset *ocs);
885extern int of_changeset_apply(struct of_changeset *ocs);
886extern int of_changeset_revert(struct of_changeset *ocs);
887extern int of_changeset_action(struct of_changeset *ocs,
888 unsigned long action, struct device_node *np,
889 struct property *prop);
890
891static inline int of_changeset_attach_node(struct of_changeset *ocs,
892 struct device_node *np)
893{
894 return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL);
895}
896
897static inline int of_changeset_detach_node(struct of_changeset *ocs,
898 struct device_node *np)
899{
900 return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL);
901}
902
903static inline int of_changeset_add_property(struct of_changeset *ocs,
904 struct device_node *np, struct property *prop)
905{
906 return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop);
907}
908
909static inline int of_changeset_remove_property(struct of_changeset *ocs,
910 struct device_node *np, struct property *prop)
911{
912 return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop);
913}
914
915static inline int of_changeset_update_property(struct of_changeset *ocs,
916 struct device_node *np, struct property *prop)
917{
918 return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop);
919}
920#endif
921
922/* CONFIG_OF_RESOLVE api */
923extern int of_resolve_phandles(struct device_node *tree);
924
789#endif /* _LINUX_OF_H */ 925#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index fb7b7221e063..8cb14eb393d6 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -23,17 +23,6 @@ struct of_pci_range {
23#define for_each_of_pci_range(parser, range) \ 23#define for_each_of_pci_range(parser, range) \
24 for (; of_pci_range_parser_one(parser, range);) 24 for (; of_pci_range_parser_one(parser, range);)
25 25
26static inline void of_pci_range_to_resource(struct of_pci_range *range,
27 struct device_node *np,
28 struct resource *res)
29{
30 res->flags = range->flags;
31 res->start = range->cpu_addr;
32 res->end = range->cpu_addr + range->size - 1;
33 res->parent = res->child = res->sibling = NULL;
34 res->name = np->full_name;
35}
36
37/* Translate a DMA address from device space to CPU space */ 26/* Translate a DMA address from device space to CPU space */
38extern u64 of_translate_dma_address(struct device_node *dev, 27extern u64 of_translate_dma_address(struct device_node *dev,
39 const __be32 *in_addr); 28 const __be32 *in_addr);
@@ -55,7 +44,9 @@ extern void __iomem *of_iomap(struct device_node *device, int index);
55extern const __be32 *of_get_address(struct device_node *dev, int index, 44extern const __be32 *of_get_address(struct device_node *dev, int index,
56 u64 *size, unsigned int *flags); 45 u64 *size, unsigned int *flags);
57 46
47extern int pci_register_io_range(phys_addr_t addr, resource_size_t size);
58extern unsigned long pci_address_to_pio(phys_addr_t addr); 48extern unsigned long pci_address_to_pio(phys_addr_t addr);
49extern phys_addr_t pci_pio_to_address(unsigned long pio);
59 50
60extern int of_pci_range_parser_init(struct of_pci_range_parser *parser, 51extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
61 struct device_node *node); 52 struct device_node *node);
@@ -80,6 +71,11 @@ static inline const __be32 *of_get_address(struct device_node *dev, int index,
80 return NULL; 71 return NULL;
81} 72}
82 73
74static inline phys_addr_t pci_pio_to_address(unsigned long pio)
75{
76 return 0;
77}
78
83static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser, 79static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser,
84 struct device_node *node) 80 struct device_node *node)
85{ 81{
@@ -138,6 +134,9 @@ extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
138 u64 *size, unsigned int *flags); 134 u64 *size, unsigned int *flags);
139extern int of_pci_address_to_resource(struct device_node *dev, int bar, 135extern int of_pci_address_to_resource(struct device_node *dev, int bar,
140 struct resource *r); 136 struct resource *r);
137extern int of_pci_range_to_resource(struct of_pci_range *range,
138 struct device_node *np,
139 struct resource *res);
141#else /* CONFIG_OF_ADDRESS && CONFIG_PCI */ 140#else /* CONFIG_OF_ADDRESS && CONFIG_PCI */
142static inline int of_pci_address_to_resource(struct device_node *dev, int bar, 141static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
143 struct resource *r) 142 struct resource *r)
@@ -150,6 +149,12 @@ static inline const __be32 *of_get_pci_address(struct device_node *dev,
150{ 149{
151 return NULL; 150 return NULL;
152} 151}
152static inline int of_pci_range_to_resource(struct of_pci_range *range,
153 struct device_node *np,
154 struct resource *res)
155{
156 return -ENOSYS;
157}
153#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ 158#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
154 159
155#endif /* __OF_ADDRESS_H */ 160#endif /* __OF_ADDRESS_H */
diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h
index ae36298ba076..56bc026c143f 100644
--- a/include/linux/of_dma.h
+++ b/include/linux/of_dma.h
@@ -41,6 +41,8 @@ extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
41 const char *name); 41 const char *name);
42extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec, 42extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
43 struct of_dma *ofdma); 43 struct of_dma *ofdma);
44extern struct dma_chan *of_dma_xlate_by_chan_id(struct of_phandle_args *dma_spec,
45 struct of_dma *ofdma);
44#else 46#else
45static inline int of_dma_controller_register(struct device_node *np, 47static inline int of_dma_controller_register(struct device_node *np,
46 struct dma_chan *(*of_dma_xlate) 48 struct dma_chan *(*of_dma_xlate)
@@ -66,6 +68,8 @@ static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_s
66 return NULL; 68 return NULL;
67} 69}
68 70
71#define of_dma_xlate_by_chan_id NULL
72
69#endif 73#endif
70 74
71#endif /* __LINUX_OF_DMA_H */ 75#endif /* __LINUX_OF_DMA_H */
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index dde3a4a0fa5d..1fd207e7a847 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -15,6 +15,7 @@ struct device_node *of_pci_find_child_device(struct device_node *parent,
15int of_pci_get_devfn(struct device_node *np); 15int 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);
18#else 19#else
19static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) 20static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
20{ 21{
@@ -43,6 +44,18 @@ of_pci_parse_bus_range(struct device_node *node, struct resource *res)
43{ 44{
44 return -EINVAL; 45 return -EINVAL;
45} 46}
47
48static inline int
49of_get_pci_domain_nr(struct device_node *node)
50{
51 return -1;
52}
53#endif
54
55#if defined(CONFIG_OF_ADDRESS)
56int of_pci_get_host_bridge_resources(struct device_node *dev,
57 unsigned char busno, unsigned char bus_max,
58 struct list_head *resources, resource_size_t *io_base);
46#endif 59#endif
47 60
48#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI) 61#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI)
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index d96e1badbee0..c2b0627a2317 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -72,7 +72,7 @@ extern int of_platform_populate(struct device_node *root,
72 const struct of_device_id *matches, 72 const struct of_device_id *matches,
73 const struct of_dev_auxdata *lookup, 73 const struct of_dev_auxdata *lookup,
74 struct device *parent); 74 struct device *parent);
75extern int of_platform_depopulate(struct device *parent); 75extern void of_platform_depopulate(struct device *parent);
76#else 76#else
77static inline int of_platform_populate(struct device_node *root, 77static inline int of_platform_populate(struct device_node *root,
78 const struct of_device_id *matches, 78 const struct of_device_id *matches,
@@ -81,10 +81,7 @@ static inline int of_platform_populate(struct device_node *root,
81{ 81{
82 return -ENODEV; 82 return -ENODEV;
83} 83}
84static inline int of_platform_depopulate(struct device *parent) 84static inline void of_platform_depopulate(struct device *parent) { }
85{
86 return -ENODEV;
87}
88#endif 85#endif
89 86
90#endif /* _LINUX_OF_PLATFORM_H */ 87#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
index 4669ddfdd5af..ad2f67054372 100644
--- a/include/linux/of_reserved_mem.h
+++ b/include/linux/of_reserved_mem.h
@@ -8,6 +8,7 @@ struct reserved_mem_ops;
8struct reserved_mem { 8struct reserved_mem {
9 const char *name; 9 const char *name;
10 unsigned long fdt_node; 10 unsigned long fdt_node;
11 unsigned long phandle;
11 const struct reserved_mem_ops *ops; 12 const struct reserved_mem_ops *ops;
12 phys_addr_t base; 13 phys_addr_t base;
13 phys_addr_t size; 14 phys_addr_t size;
@@ -15,7 +16,7 @@ struct reserved_mem {
15}; 16};
16 17
17struct reserved_mem_ops { 18struct reserved_mem_ops {
18 void (*device_init)(struct reserved_mem *rmem, 19 int (*device_init)(struct reserved_mem *rmem,
19 struct device *dev); 20 struct device *dev);
20 void (*device_release)(struct reserved_mem *rmem, 21 void (*device_release)(struct reserved_mem *rmem,
21 struct device *dev); 22 struct device *dev);
@@ -27,10 +28,19 @@ typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
27 _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn) 28 _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn)
28 29
29#ifdef CONFIG_OF_RESERVED_MEM 30#ifdef CONFIG_OF_RESERVED_MEM
31int of_reserved_mem_device_init(struct device *dev);
32void of_reserved_mem_device_release(struct device *dev);
33
30void fdt_init_reserved_mem(void); 34void fdt_init_reserved_mem(void);
31void fdt_reserved_mem_save_node(unsigned long node, const char *uname, 35void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
32 phys_addr_t base, phys_addr_t size); 36 phys_addr_t base, phys_addr_t size);
33#else 37#else
38static inline int of_reserved_mem_device_init(struct device *dev)
39{
40 return -ENOSYS;
41}
42static inline void of_reserved_mem_device_release(struct device *pdev) { }
43
34static inline void fdt_init_reserved_mem(void) { } 44static inline void fdt_init_reserved_mem(void) { }
35static inline void fdt_reserved_mem_save_node(unsigned long node, 45static inline void fdt_reserved_mem_save_node(unsigned long node,
36 const char *uname, phys_addr_t base, phys_addr_t size) { } 46 const char *uname, phys_addr_t base, phys_addr_t size) { }
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 88e6ea4a5d36..e5a70132a240 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -130,6 +130,7 @@
130#define IS_WORD_16 BIT(0xd) 130#define IS_WORD_16 BIT(0xd)
131#define ENABLE_16XX_MODE BIT(0xe) 131#define ENABLE_16XX_MODE BIT(0xe)
132#define HS_CHANNELS_RESERVED BIT(0xf) 132#define HS_CHANNELS_RESERVED BIT(0xf)
133#define DMA_ENGINE_HANDLE_IRQ BIT(0x10)
133 134
134/* Defines for DMA Capabilities */ 135/* Defines for DMA Capabilities */
135#define DMA_HAS_TRANSPARENT_CAPS (0x1 << 18) 136#define DMA_HAS_TRANSPARENT_CAPS (0x1 << 18)
@@ -305,15 +306,12 @@ extern void omap_set_dma_transfer_params(int lch, int data_type,
305 int elem_count, int frame_count, 306 int elem_count, int frame_count,
306 int sync_mode, 307 int sync_mode,
307 int dma_trigger, int src_or_dst_synch); 308 int dma_trigger, int src_or_dst_synch);
308extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode,
309 u32 color);
310extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode); 309extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode);
311extern void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode); 310extern void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode);
312 311
313extern void omap_set_dma_src_params(int lch, int src_port, int src_amode, 312extern void omap_set_dma_src_params(int lch, int src_port, int src_amode,
314 unsigned long src_start, 313 unsigned long src_start,
315 int src_ei, int src_fi); 314 int src_ei, int src_fi);
316extern void omap_set_dma_src_index(int lch, int eidx, int fidx);
317extern void omap_set_dma_src_data_pack(int lch, int enable); 315extern void omap_set_dma_src_data_pack(int lch, int enable);
318extern void omap_set_dma_src_burst_mode(int lch, 316extern void omap_set_dma_src_burst_mode(int lch,
319 enum omap_dma_burst_mode burst_mode); 317 enum omap_dma_burst_mode burst_mode);
@@ -321,7 +319,6 @@ extern void omap_set_dma_src_burst_mode(int lch,
321extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, 319extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
322 unsigned long dest_start, 320 unsigned long dest_start,
323 int dst_ei, int dst_fi); 321 int dst_ei, int dst_fi);
324extern void omap_set_dma_dest_index(int lch, int eidx, int fidx);
325extern void omap_set_dma_dest_data_pack(int lch, int enable); 322extern void omap_set_dma_dest_data_pack(int lch, int enable);
326extern void omap_set_dma_dest_burst_mode(int lch, 323extern void omap_set_dma_dest_burst_mode(int lch,
327 enum omap_dma_burst_mode burst_mode); 324 enum omap_dma_burst_mode burst_mode);
@@ -330,52 +327,19 @@ extern void omap_set_dma_params(int lch,
330 struct omap_dma_channel_params *params); 327 struct omap_dma_channel_params *params);
331 328
332extern void omap_dma_link_lch(int lch_head, int lch_queue); 329extern void omap_dma_link_lch(int lch_head, int lch_queue);
333extern void omap_dma_unlink_lch(int lch_head, int lch_queue);
334 330
335extern int omap_set_dma_callback(int lch, 331extern int omap_set_dma_callback(int lch,
336 void (*callback)(int lch, u16 ch_status, void *data), 332 void (*callback)(int lch, u16 ch_status, void *data),
337 void *data); 333 void *data);
338extern dma_addr_t omap_get_dma_src_pos(int lch); 334extern dma_addr_t omap_get_dma_src_pos(int lch);
339extern dma_addr_t omap_get_dma_dst_pos(int lch); 335extern dma_addr_t omap_get_dma_dst_pos(int lch);
340extern void omap_clear_dma(int lch);
341extern int omap_get_dma_active_status(int lch); 336extern int omap_get_dma_active_status(int lch);
342extern int omap_dma_running(void); 337extern int omap_dma_running(void);
343extern void omap_dma_set_global_params(int arb_rate, int max_fifo_depth, 338extern void omap_dma_set_global_params(int arb_rate, int max_fifo_depth,
344 int tparams); 339 int tparams);
345extern int omap_dma_set_prio_lch(int lch, unsigned char read_prio,
346 unsigned char write_prio);
347extern void omap_set_dma_dst_endian_type(int lch, enum end_type etype);
348extern void omap_set_dma_src_endian_type(int lch, enum end_type etype);
349extern int omap_get_dma_index(int lch, int *ei, int *fi);
350
351void omap_dma_global_context_save(void); 340void omap_dma_global_context_save(void);
352void omap_dma_global_context_restore(void); 341void omap_dma_global_context_restore(void);
353 342
354extern void omap_dma_disable_irq(int lch);
355
356/* Chaining APIs */
357#ifndef CONFIG_ARCH_OMAP1
358extern int omap_request_dma_chain(int dev_id, const char *dev_name,
359 void (*callback) (int lch, u16 ch_status,
360 void *data),
361 int *chain_id, int no_of_chans,
362 int chain_mode,
363 struct omap_dma_channel_params params);
364extern int omap_free_dma_chain(int chain_id);
365extern int omap_dma_chain_a_transfer(int chain_id, int src_start,
366 int dest_start, int elem_count,
367 int frame_count, void *callbk_data);
368extern int omap_start_dma_chain_transfers(int chain_id);
369extern int omap_stop_dma_chain_transfers(int chain_id);
370extern int omap_get_dma_chain_index(int chain_id, int *ei, int *fi);
371extern int omap_get_dma_chain_dst_pos(int chain_id);
372extern int omap_get_dma_chain_src_pos(int chain_id);
373
374extern int omap_modify_dma_chain_params(int chain_id,
375 struct omap_dma_channel_params params);
376extern int omap_dma_chain_status(int chain_id);
377#endif
378
379#if defined(CONFIG_ARCH_OMAP1) && IS_ENABLED(CONFIG_FB_OMAP) 343#if defined(CONFIG_ARCH_OMAP1) && IS_ENABLED(CONFIG_FB_OMAP)
380#include <mach/lcd_dma.h> 344#include <mach/lcd_dma.h>
381#else 345#else
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 4cd62677feb9..e8d6e1058723 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -50,13 +50,16 @@ static inline bool oom_task_origin(const struct task_struct *p)
50extern unsigned long oom_badness(struct task_struct *p, 50extern unsigned long oom_badness(struct task_struct *p,
51 struct mem_cgroup *memcg, const nodemask_t *nodemask, 51 struct mem_cgroup *memcg, const nodemask_t *nodemask,
52 unsigned long totalpages); 52 unsigned long totalpages);
53
54extern int oom_kills_count(void);
55extern void note_oom_kill(void);
53extern void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, 56extern void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
54 unsigned int points, unsigned long totalpages, 57 unsigned int points, unsigned long totalpages,
55 struct mem_cgroup *memcg, nodemask_t *nodemask, 58 struct mem_cgroup *memcg, nodemask_t *nodemask,
56 const char *message); 59 const char *message);
57 60
58extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 61extern bool oom_zonelist_trylock(struct zonelist *zonelist, gfp_t gfp_flags);
59extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 62extern void oom_zonelist_unlock(struct zonelist *zonelist, gfp_t gfp_flags);
60 63
61extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask, 64extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask,
62 int order, const nodemask_t *nodemask); 65 int order, const nodemask_t *nodemask);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 8304959ad336..e1f5fcd79792 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -171,13 +171,12 @@ static inline int __TestClearPage##uname(struct page *page) \
171#define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \ 171#define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
172 __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname) 172 __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname)
173 173
174#define PAGEFLAG_FALSE(uname) \
175static inline int Page##uname(const struct page *page) \
176 { return 0; }
177
178#define TESTSCFLAG(uname, lname) \ 174#define TESTSCFLAG(uname, lname) \
179 TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname) 175 TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname)
180 176
177#define TESTPAGEFLAG_FALSE(uname) \
178static inline int Page##uname(const struct page *page) { return 0; }
179
181#define SETPAGEFLAG_NOOP(uname) \ 180#define SETPAGEFLAG_NOOP(uname) \
182static inline void SetPage##uname(struct page *page) { } 181static inline void SetPage##uname(struct page *page) { }
183 182
@@ -187,12 +186,21 @@ static inline void ClearPage##uname(struct page *page) { }
187#define __CLEARPAGEFLAG_NOOP(uname) \ 186#define __CLEARPAGEFLAG_NOOP(uname) \
188static inline void __ClearPage##uname(struct page *page) { } 187static inline void __ClearPage##uname(struct page *page) { }
189 188
189#define TESTSETFLAG_FALSE(uname) \
190static inline int TestSetPage##uname(struct page *page) { return 0; }
191
190#define TESTCLEARFLAG_FALSE(uname) \ 192#define TESTCLEARFLAG_FALSE(uname) \
191static inline int TestClearPage##uname(struct page *page) { return 0; } 193static inline int TestClearPage##uname(struct page *page) { return 0; }
192 194
193#define __TESTCLEARFLAG_FALSE(uname) \ 195#define __TESTCLEARFLAG_FALSE(uname) \
194static inline int __TestClearPage##uname(struct page *page) { return 0; } 196static inline int __TestClearPage##uname(struct page *page) { return 0; }
195 197
198#define PAGEFLAG_FALSE(uname) TESTPAGEFLAG_FALSE(uname) \
199 SETPAGEFLAG_NOOP(uname) CLEARPAGEFLAG_NOOP(uname)
200
201#define TESTSCFLAG_FALSE(uname) \
202 TESTSETFLAG_FALSE(uname) TESTCLEARFLAG_FALSE(uname)
203
196struct page; /* forward declaration */ 204struct page; /* forward declaration */
197 205
198TESTPAGEFLAG(Locked, locked) 206TESTPAGEFLAG(Locked, locked)
@@ -248,7 +256,6 @@ PAGEFLAG_FALSE(HighMem)
248PAGEFLAG(SwapCache, swapcache) 256PAGEFLAG(SwapCache, swapcache)
249#else 257#else
250PAGEFLAG_FALSE(SwapCache) 258PAGEFLAG_FALSE(SwapCache)
251 SETPAGEFLAG_NOOP(SwapCache) CLEARPAGEFLAG_NOOP(SwapCache)
252#endif 259#endif
253 260
254PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) 261PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
@@ -258,8 +265,8 @@ PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
258PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) 265PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked)
259 TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked) 266 TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked)
260#else 267#else
261PAGEFLAG_FALSE(Mlocked) SETPAGEFLAG_NOOP(Mlocked) 268PAGEFLAG_FALSE(Mlocked) __CLEARPAGEFLAG_NOOP(Mlocked)
262 TESTCLEARFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked) 269 TESTSCFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked)
263#endif 270#endif
264 271
265#ifdef CONFIG_ARCH_USES_PG_UNCACHED 272#ifdef CONFIG_ARCH_USES_PG_UNCACHED
diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index 3fff8e774067..2dc1e1697b45 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -2,6 +2,10 @@
2#define __LINUX_PAGEISOLATION_H 2#define __LINUX_PAGEISOLATION_H
3 3
4#ifdef CONFIG_MEMORY_ISOLATION 4#ifdef CONFIG_MEMORY_ISOLATION
5static inline bool has_isolate_pageblock(struct zone *zone)
6{
7 return zone->nr_isolate_pageblock;
8}
5static inline bool is_migrate_isolate_page(struct page *page) 9static inline bool is_migrate_isolate_page(struct page *page)
6{ 10{
7 return get_pageblock_migratetype(page) == MIGRATE_ISOLATE; 11 return get_pageblock_migratetype(page) == MIGRATE_ISOLATE;
@@ -11,6 +15,10 @@ static inline bool is_migrate_isolate(int migratetype)
11 return migratetype == MIGRATE_ISOLATE; 15 return migratetype == MIGRATE_ISOLATE;
12} 16}
13#else 17#else
18static inline bool has_isolate_pageblock(struct zone *zone)
19{
20 return false;
21}
14static inline bool is_migrate_isolate_page(struct page *page) 22static inline bool is_migrate_isolate_page(struct page *page)
15{ 23{
16 return false; 24 return false;
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 777a524716db..5c831f1eca79 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -3,17 +3,15 @@
3 3
4enum { 4enum {
5 /* flags for mem_cgroup */ 5 /* flags for mem_cgroup */
6 PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */ 6 PCG_USED = 0x01, /* This page is charged to a memcg */
7 PCG_USED, /* this object is in use. */ 7 PCG_MEM = 0x02, /* This page holds a memory charge */
8 PCG_MIGRATION, /* under page migration */ 8 PCG_MEMSW = 0x04, /* This page holds a memory+swap charge */
9 __NR_PCG_FLAGS,
10}; 9};
11 10
12#ifndef __GENERATING_BOUNDS_H 11struct pglist_data;
13#include <generated/bounds.h>
14 12
15#ifdef CONFIG_MEMCG 13#ifdef CONFIG_MEMCG
16#include <linux/bit_spinlock.h> 14struct mem_cgroup;
17 15
18/* 16/*
19 * Page Cgroup can be considered as an extended mem_map. 17 * Page Cgroup can be considered as an extended mem_map.
@@ -27,65 +25,30 @@ struct page_cgroup {
27 struct mem_cgroup *mem_cgroup; 25 struct mem_cgroup *mem_cgroup;
28}; 26};
29 27
30void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat); 28extern void pgdat_page_cgroup_init(struct pglist_data *pgdat);
31 29
32#ifdef CONFIG_SPARSEMEM 30#ifdef CONFIG_SPARSEMEM
33static inline void __init page_cgroup_init_flatmem(void) 31static inline void page_cgroup_init_flatmem(void)
34{ 32{
35} 33}
36extern void __init page_cgroup_init(void); 34extern void page_cgroup_init(void);
37#else 35#else
38void __init page_cgroup_init_flatmem(void); 36extern void page_cgroup_init_flatmem(void);
39static inline void __init page_cgroup_init(void) 37static inline void page_cgroup_init(void)
40{ 38{
41} 39}
42#endif 40#endif
43 41
44struct page_cgroup *lookup_page_cgroup(struct page *page); 42struct page_cgroup *lookup_page_cgroup(struct page *page);
45struct page *lookup_cgroup_page(struct page_cgroup *pc);
46
47#define TESTPCGFLAG(uname, lname) \
48static inline int PageCgroup##uname(struct page_cgroup *pc) \
49 { return test_bit(PCG_##lname, &pc->flags); }
50
51#define SETPCGFLAG(uname, lname) \
52static inline void SetPageCgroup##uname(struct page_cgroup *pc)\
53 { set_bit(PCG_##lname, &pc->flags); }
54
55#define CLEARPCGFLAG(uname, lname) \
56static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \
57 { clear_bit(PCG_##lname, &pc->flags); }
58
59#define TESTCLEARPCGFLAG(uname, lname) \
60static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \
61 { return test_and_clear_bit(PCG_##lname, &pc->flags); }
62
63TESTPCGFLAG(Used, USED)
64CLEARPCGFLAG(Used, USED)
65SETPCGFLAG(Used, USED)
66
67SETPCGFLAG(Migration, MIGRATION)
68CLEARPCGFLAG(Migration, MIGRATION)
69TESTPCGFLAG(Migration, MIGRATION)
70 43
71static inline void lock_page_cgroup(struct page_cgroup *pc) 44static inline int PageCgroupUsed(struct page_cgroup *pc)
72{ 45{
73 /* 46 return !!(pc->flags & PCG_USED);
74 * Don't take this lock in IRQ context.
75 * This lock is for pc->mem_cgroup, USED, MIGRATION
76 */
77 bit_spin_lock(PCG_LOCK, &pc->flags);
78} 47}
79 48#else /* !CONFIG_MEMCG */
80static inline void unlock_page_cgroup(struct page_cgroup *pc)
81{
82 bit_spin_unlock(PCG_LOCK, &pc->flags);
83}
84
85#else /* CONFIG_MEMCG */
86struct page_cgroup; 49struct page_cgroup;
87 50
88static inline void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat) 51static inline void pgdat_page_cgroup_init(struct pglist_data *pgdat)
89{ 52{
90} 53}
91 54
@@ -98,10 +61,9 @@ static inline void page_cgroup_init(void)
98{ 61{
99} 62}
100 63
101static inline void __init page_cgroup_init_flatmem(void) 64static inline void page_cgroup_init_flatmem(void)
102{ 65{
103} 66}
104
105#endif /* CONFIG_MEMCG */ 67#endif /* CONFIG_MEMCG */
106 68
107#include <linux/swap.h> 69#include <linux/swap.h>
@@ -140,6 +102,4 @@ static inline void swap_cgroup_swapoff(int type)
140 102
141#endif /* CONFIG_MEMCG_SWAP */ 103#endif /* CONFIG_MEMCG_SWAP */
142 104
143#endif /* !__GENERATING_BOUNDS_H */
144
145#endif /* __LINUX_PAGE_CGROUP_H */ 105#endif /* __LINUX_PAGE_CGROUP_H */
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index bf657ff3208c..7ea069cd3257 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -24,8 +24,7 @@ enum mapping_flags {
24 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */ 24 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */
25 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */ 25 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */
26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */ 26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */
27 AS_BALLOON_MAP = __GFP_BITS_SHIFT + 4, /* balloon page special map */ 27 AS_EXITING = __GFP_BITS_SHIFT + 4, /* final truncate in progress */
28 AS_EXITING = __GFP_BITS_SHIFT + 5, /* final truncate in progress */
29}; 28};
30 29
31static inline void mapping_set_error(struct address_space *mapping, int error) 30static inline void mapping_set_error(struct address_space *mapping, int error)
@@ -55,21 +54,6 @@ static inline int mapping_unevictable(struct address_space *mapping)
55 return !!mapping; 54 return !!mapping;
56} 55}
57 56
58static inline void mapping_set_balloon(struct address_space *mapping)
59{
60 set_bit(AS_BALLOON_MAP, &mapping->flags);
61}
62
63static inline void mapping_clear_balloon(struct address_space *mapping)
64{
65 clear_bit(AS_BALLOON_MAP, &mapping->flags);
66}
67
68static inline int mapping_balloon(struct address_space *mapping)
69{
70 return mapping && test_bit(AS_BALLOON_MAP, &mapping->flags);
71}
72
73static inline void mapping_set_exiting(struct address_space *mapping) 57static inline void mapping_set_exiting(struct address_space *mapping)
74{ 58{
75 set_bit(AS_EXITING, &mapping->flags); 59 set_bit(AS_EXITING, &mapping->flags);
@@ -484,6 +468,9 @@ static inline int lock_page_killable(struct page *page)
484/* 468/*
485 * lock_page_or_retry - Lock the page, unless this would block and the 469 * lock_page_or_retry - Lock the page, unless this would block and the
486 * caller indicated that it can handle a retry. 470 * caller indicated that it can handle a retry.
471 *
472 * Return value and mmap_sem implications depend on flags; see
473 * __lock_page_or_retry().
487 */ 474 */
488static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm, 475static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm,
489 unsigned int flags) 476 unsigned int flags)
@@ -493,12 +480,14 @@ static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm,
493} 480}
494 481
495/* 482/*
496 * This is exported only for wait_on_page_locked/wait_on_page_writeback. 483 * This is exported only for wait_on_page_locked/wait_on_page_writeback,
497 * Never use this directly! 484 * and for filesystems which need to wait on PG_private.
498 */ 485 */
499extern void wait_on_page_bit(struct page *page, int bit_nr); 486extern void wait_on_page_bit(struct page *page, int bit_nr);
500 487
501extern int wait_on_page_bit_killable(struct page *page, int bit_nr); 488extern int wait_on_page_bit_killable(struct page *page, int bit_nr);
489extern int wait_on_page_bit_killable_timeout(struct page *page,
490 int bit_nr, unsigned long timeout);
502 491
503static inline int wait_on_page_locked_killable(struct page *page) 492static inline int wait_on_page_locked_killable(struct page *page)
504{ 493{
@@ -507,6 +496,12 @@ static inline int wait_on_page_locked_killable(struct page *page)
507 return 0; 496 return 0;
508} 497}
509 498
499extern wait_queue_head_t *page_waitqueue(struct page *page);
500static inline void wake_up_page(struct page *page, int bit)
501{
502 __wake_up_bit(page_waitqueue(page), &page->flags, bit);
503}
504
510/* 505/*
511 * Wait for a page to be unlocked. 506 * Wait for a page to be unlocked.
512 * 507 *
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 64dacb7288a6..24c7728ca681 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -41,8 +41,13 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
41 41
42 if (pci_is_root_bus(pbus)) 42 if (pci_is_root_bus(pbus))
43 dev = pbus->bridge; 43 dev = pbus->bridge;
44 else 44 else {
45 /* If pbus is a virtual bus, there is no bridge to it */
46 if (!pbus->self)
47 return NULL;
48
45 dev = &pbus->self->dev; 49 dev = &pbus->self->dev;
50 }
46 51
47 return ACPI_HANDLE(dev); 52 return ACPI_HANDLE(dev);
48} 53}
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 61978a460841..5be8db45e368 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -45,7 +45,7 @@
45 * In the interest of not exposing interfaces to user-space unnecessarily, 45 * In the interest of not exposing interfaces to user-space unnecessarily,
46 * the following kernel-only defines are being added here. 46 * the following kernel-only defines are being added here.
47 */ 47 */
48#define PCI_DEVID(bus, devfn) ((((u16)bus) << 8) | devfn) 48#define PCI_DEVID(bus, devfn) ((((u16)(bus)) << 8) | (devfn))
49/* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */ 49/* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */
50#define PCI_BUS_NUM(x) (((x) >> 8) & 0xff) 50#define PCI_BUS_NUM(x) (((x) >> 8) & 0xff)
51 51
@@ -303,6 +303,7 @@ struct pci_dev {
303 D3cold, not set for devices 303 D3cold, not set for devices
304 powered on/off by the 304 powered on/off by the
305 corresponding bridge */ 305 corresponding bridge */
306 unsigned int ignore_hotplug:1; /* Ignore hotplug events */
306 unsigned int d3_delay; /* D3->D0 transition time in ms */ 307 unsigned int d3_delay; /* D3->D0 transition time in ms */
307 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ 308 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */
308 309
@@ -456,6 +457,9 @@ struct pci_bus {
456 unsigned char primary; /* number of primary bridge */ 457 unsigned char primary; /* number of primary bridge */
457 unsigned char max_bus_speed; /* enum pci_bus_speed */ 458 unsigned char max_bus_speed; /* enum pci_bus_speed */
458 unsigned char cur_bus_speed; /* enum pci_bus_speed */ 459 unsigned char cur_bus_speed; /* enum pci_bus_speed */
460#ifdef CONFIG_PCI_DOMAINS_GENERIC
461 int domain_nr;
462#endif
459 463
460 char name[48]; 464 char name[48];
461 465
@@ -1021,6 +1025,11 @@ bool pci_dev_run_wake(struct pci_dev *dev);
1021bool pci_check_pme_status(struct pci_dev *dev); 1025bool pci_check_pme_status(struct pci_dev *dev);
1022void pci_pme_wakeup_bus(struct pci_bus *bus); 1026void pci_pme_wakeup_bus(struct pci_bus *bus);
1023 1027
1028static inline void pci_ignore_hotplug(struct pci_dev *dev)
1029{
1030 dev->ignore_hotplug = 1;
1031}
1032
1024static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, 1033static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
1025 bool enable) 1034 bool enable)
1026{ 1035{
@@ -1097,6 +1106,9 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
1097 resource_size_t), 1106 resource_size_t),
1098 void *alignf_data); 1107 void *alignf_data);
1099 1108
1109
1110int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr);
1111
1100static inline dma_addr_t pci_bus_address(struct pci_dev *pdev, int bar) 1112static inline dma_addr_t pci_bus_address(struct pci_dev *pdev, int bar)
1101{ 1113{
1102 struct pci_bus_region region; 1114 struct pci_bus_region region;
@@ -1282,12 +1294,32 @@ void pci_cfg_access_unlock(struct pci_dev *dev);
1282 */ 1294 */
1283#ifdef CONFIG_PCI_DOMAINS 1295#ifdef CONFIG_PCI_DOMAINS
1284extern int pci_domains_supported; 1296extern int pci_domains_supported;
1297int pci_get_new_domain_nr(void);
1285#else 1298#else
1286enum { pci_domains_supported = 0 }; 1299enum { pci_domains_supported = 0 };
1287static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } 1300static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
1288static inline int pci_proc_domain(struct pci_bus *bus) { return 0; } 1301static inline int pci_proc_domain(struct pci_bus *bus) { return 0; }
1302static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
1289#endif /* CONFIG_PCI_DOMAINS */ 1303#endif /* CONFIG_PCI_DOMAINS */
1290 1304
1305/*
1306 * Generic implementation for PCI domain support. If your
1307 * architecture does not need custom management of PCI
1308 * domains then this implementation will be used
1309 */
1310#ifdef CONFIG_PCI_DOMAINS_GENERIC
1311static inline int pci_domain_nr(struct pci_bus *bus)
1312{
1313 return bus->domain_nr;
1314}
1315void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent);
1316#else
1317static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
1318 struct device *parent)
1319{
1320}
1321#endif
1322
1291/* some architectures require additional setup to direct VGA traffic */ 1323/* some architectures require additional setup to direct VGA traffic */
1292typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, 1324typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode,
1293 unsigned int command_bits, u32 flags); 1325 unsigned int command_bits, u32 flags);
@@ -1396,6 +1428,7 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
1396 1428
1397static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } 1429static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
1398static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) { return NULL; } 1430static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) { return NULL; }
1431static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
1399 1432
1400#define dev_is_pci(d) (false) 1433#define dev_is_pci(d) (false)
1401#define dev_is_pf(d) (false) 1434#define dev_is_pf(d) (false)
@@ -1557,16 +1590,11 @@ enum pci_fixup_pass {
1557 1590
1558#ifdef CONFIG_PCI_QUIRKS 1591#ifdef CONFIG_PCI_QUIRKS
1559void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1592void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
1560struct pci_dev *pci_get_dma_source(struct pci_dev *dev);
1561int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); 1593int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags);
1562void pci_dev_specific_enable_acs(struct pci_dev *dev); 1594void pci_dev_specific_enable_acs(struct pci_dev *dev);
1563#else 1595#else
1564static inline void pci_fixup_device(enum pci_fixup_pass pass, 1596static inline void pci_fixup_device(enum pci_fixup_pass pass,
1565 struct pci_dev *dev) { } 1597 struct pci_dev *dev) { }
1566static inline struct pci_dev *pci_get_dma_source(struct pci_dev *dev)
1567{
1568 return pci_dev_get(dev);
1569}
1570static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev, 1598static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev,
1571 u16 acs_flags) 1599 u16 acs_flags)
1572{ 1600{
@@ -1701,7 +1729,7 @@ bool pci_acs_path_enabled(struct pci_dev *start,
1701 struct pci_dev *end, u16 acs_flags); 1729 struct pci_dev *end, u16 acs_flags);
1702 1730
1703#define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */ 1731#define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */
1704#define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT) 1732#define PCI_VPD_LRDT_ID(x) ((x) | PCI_VPD_LRDT)
1705 1733
1706/* Large Resource Data Type Tag Item Names */ 1734/* Large Resource Data Type Tag Item Names */
1707#define PCI_VPD_LTIN_ID_STRING 0x02 /* Identifier String */ 1735#define PCI_VPD_LTIN_ID_STRING 0x02 /* Identifier String */
@@ -1828,15 +1856,17 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,
1828 int (*fn)(struct pci_dev *pdev, 1856 int (*fn)(struct pci_dev *pdev,
1829 u16 alias, void *data), void *data); 1857 u16 alias, void *data), void *data);
1830 1858
1831/** 1859/* helper functions for operation of device flag */
1832 * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device 1860static inline void pci_set_dev_assigned(struct pci_dev *pdev)
1833 * @pdev: the PCI device 1861{
1834 * 1862 pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
1835 * if the device is PCIE, return NULL 1863}
1836 * if the device isn't connected to a PCIe bridge (that is its parent is a 1864static inline void pci_clear_dev_assigned(struct pci_dev *pdev)
1837 * legacy PCI bridge and the bridge is directly connected to bus 0), return its 1865{
1838 * parent 1866 pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
1839 */ 1867}
1840struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev); 1868static inline bool pci_is_dev_assigned(struct pci_dev *pdev)
1841 1869{
1870 return (pdev->dev_flags & PCI_DEV_FLAGS_ASSIGNED) == PCI_DEV_FLAGS_ASSIGNED;
1871}
1842#endif /* LINUX_PCI_H */ 1872#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 5f2e559af6b0..2706ee9a4327 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -187,6 +187,4 @@ static inline int pci_get_hp_params(struct pci_dev *dev,
187 return -ENODEV; 187 return -ENODEV;
188} 188}
189#endif 189#endif
190
191void pci_configure_slot(struct pci_dev *dev);
192#endif 190#endif
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 6ed0bb73a864..1fa99a301817 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2245,6 +2245,8 @@
2245#define PCI_VENDOR_ID_MORETON 0x15aa 2245#define PCI_VENDOR_ID_MORETON 0x15aa
2246#define PCI_DEVICE_ID_RASTEL_2PORT 0x2000 2246#define PCI_DEVICE_ID_RASTEL_2PORT 0x2000
2247 2247
2248#define PCI_VENDOR_ID_VMWARE 0x15ad
2249
2248#define PCI_VENDOR_ID_ZOLTRIX 0x15b0 2250#define PCI_VENDOR_ID_ZOLTRIX 0x15b0
2249#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0 2251#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0
2250 2252
@@ -2536,6 +2538,7 @@
2536#define PCI_DEVICE_ID_INTEL_EESSC 0x0008 2538#define PCI_DEVICE_ID_INTEL_EESSC 0x0008
2537#define PCI_DEVICE_ID_INTEL_SNB_IMC 0x0100 2539#define PCI_DEVICE_ID_INTEL_SNB_IMC 0x0100
2538#define PCI_DEVICE_ID_INTEL_IVB_IMC 0x0154 2540#define PCI_DEVICE_ID_INTEL_IVB_IMC 0x0154
2541#define PCI_DEVICE_ID_INTEL_IVB_E3_IMC 0x0150
2539#define PCI_DEVICE_ID_INTEL_HSW_IMC 0x0c00 2542#define PCI_DEVICE_ID_INTEL_HSW_IMC 0x0c00
2540#define PCI_DEVICE_ID_INTEL_PXHD_0 0x0320 2543#define PCI_DEVICE_ID_INTEL_PXHD_0 0x0320
2541#define PCI_DEVICE_ID_INTEL_PXHD_1 0x0321 2544#define PCI_DEVICE_ID_INTEL_PXHD_1 0x0321
@@ -2557,6 +2560,7 @@
2557#define PCI_DEVICE_ID_INTEL_MFD_EMMC0 0x0823 2560#define PCI_DEVICE_ID_INTEL_MFD_EMMC0 0x0823
2558#define PCI_DEVICE_ID_INTEL_MFD_EMMC1 0x0824 2561#define PCI_DEVICE_ID_INTEL_MFD_EMMC1 0x0824
2559#define PCI_DEVICE_ID_INTEL_MRST_SD2 0x084F 2562#define PCI_DEVICE_ID_INTEL_MRST_SD2 0x084F
2563#define PCI_DEVICE_ID_INTEL_QUARK_X1000_ILB 0x095E
2560#define PCI_DEVICE_ID_INTEL_I960 0x0960 2564#define PCI_DEVICE_ID_INTEL_I960 0x0960
2561#define PCI_DEVICE_ID_INTEL_I960RM 0x0962 2565#define PCI_DEVICE_ID_INTEL_I960RM 0x0962
2562#define PCI_DEVICE_ID_INTEL_CENTERTON_ILB 0x0c60 2566#define PCI_DEVICE_ID_INTEL_CENTERTON_ILB 0x0c60
@@ -2818,7 +2822,22 @@
2818#define PCI_DEVICE_ID_INTEL_UNC_R2PCIE 0x3c43 2822#define PCI_DEVICE_ID_INTEL_UNC_R2PCIE 0x3c43
2819#define PCI_DEVICE_ID_INTEL_UNC_R3QPI0 0x3c44 2823#define PCI_DEVICE_ID_INTEL_UNC_R3QPI0 0x3c44
2820#define PCI_DEVICE_ID_INTEL_UNC_R3QPI1 0x3c45 2824#define PCI_DEVICE_ID_INTEL_UNC_R3QPI1 0x3c45
2825#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_RAS 0x3c71 /* 15.1 */
2826#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_ERR0 0x3c72 /* 16.2 */
2827#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_ERR1 0x3c73 /* 16.3 */
2828#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_ERR2 0x3c76 /* 16.6 */
2829#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_ERR3 0x3c77 /* 16.7 */
2830#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_HA0 0x3ca0 /* 14.0 */
2831#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TA 0x3ca8 /* 15.0 */
2832#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD0 0x3caa /* 15.2 */
2833#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD1 0x3cab /* 15.3 */
2834#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD2 0x3cac /* 15.4 */
2835#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD3 0x3cad /* 15.5 */
2836#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_DDRIO 0x3cb8 /* 17.0 */
2821#define PCI_DEVICE_ID_INTEL_JAKETOWN_UBOX 0x3ce0 2837#define PCI_DEVICE_ID_INTEL_JAKETOWN_UBOX 0x3ce0
2838#define PCI_DEVICE_ID_INTEL_SBRIDGE_SAD0 0x3cf4 /* 12.6 */
2839#define PCI_DEVICE_ID_INTEL_SBRIDGE_BR 0x3cf5 /* 13.6 */
2840#define PCI_DEVICE_ID_INTEL_SBRIDGE_SAD1 0x3cf6 /* 12.7 */
2822#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2841#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2823#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 2842#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0
2824#define PCI_DEVICE_ID_INTEL_5100_19 0x65f3 2843#define PCI_DEVICE_ID_INTEL_5100_19 0x65f3
@@ -2860,6 +2879,7 @@
2860#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 2879#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601
2861#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119 2880#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119
2862#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a 2881#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a
2882#define PCI_DEVICE_ID_INTEL_E6XX_CU 0x8183
2863#define PCI_DEVICE_ID_INTEL_ITC_LPC 0x8186 2883#define PCI_DEVICE_ID_INTEL_ITC_LPC 0x8186
2864#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 2884#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4
2865#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 2885#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index cfd56046ecec..420032d41d27 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -257,9 +257,6 @@ do { \
257#define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var))) 257#define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var)))
258#define __get_cpu_var(var) (*this_cpu_ptr(&(var))) 258#define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
259 259
260/* keep until we have removed all uses of __this_cpu_ptr */
261#define __this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
262
263/* 260/*
264 * Must be an lvalue. Since @var must be a simple identifier, 261 * Must be an lvalue. Since @var must be a simple identifier,
265 * we force a syntax error here if it isn't. 262 * we force a syntax error here if it isn't.
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
index 652fd64cab5e..d5c89e0dd0e6 100644
--- a/include/linux/percpu-refcount.h
+++ b/include/linux/percpu-refcount.h
@@ -13,7 +13,7 @@
13 * 13 *
14 * The refcount will have a range of 0 to ((1U << 31) - 1), i.e. one bit less 14 * The refcount will have a range of 0 to ((1U << 31) - 1), i.e. one bit less
15 * than an atomic_t - this is because of the way shutdown works, see 15 * than an atomic_t - this is because of the way shutdown works, see
16 * percpu_ref_kill()/PCPU_COUNT_BIAS. 16 * percpu_ref_kill()/PERCPU_COUNT_BIAS.
17 * 17 *
18 * Before you call percpu_ref_kill(), percpu_ref_put() does not check for the 18 * Before you call percpu_ref_kill(), percpu_ref_put() does not check for the
19 * refcount hitting 0 - it can't, if it was in percpu mode. percpu_ref_kill() 19 * refcount hitting 0 - it can't, if it was in percpu mode. percpu_ref_kill()
@@ -49,28 +49,60 @@
49#include <linux/kernel.h> 49#include <linux/kernel.h>
50#include <linux/percpu.h> 50#include <linux/percpu.h>
51#include <linux/rcupdate.h> 51#include <linux/rcupdate.h>
52#include <linux/gfp.h>
52 53
53struct percpu_ref; 54struct percpu_ref;
54typedef void (percpu_ref_func_t)(struct percpu_ref *); 55typedef void (percpu_ref_func_t)(struct percpu_ref *);
55 56
57/* flags set in the lower bits of percpu_ref->percpu_count_ptr */
58enum {
59 __PERCPU_REF_ATOMIC = 1LU << 0, /* operating in atomic mode */
60 __PERCPU_REF_DEAD = 1LU << 1, /* (being) killed */
61 __PERCPU_REF_ATOMIC_DEAD = __PERCPU_REF_ATOMIC | __PERCPU_REF_DEAD,
62
63 __PERCPU_REF_FLAG_BITS = 2,
64};
65
66/* @flags for percpu_ref_init() */
67enum {
68 /*
69 * Start w/ ref == 1 in atomic mode. Can be switched to percpu
70 * operation using percpu_ref_switch_to_percpu(). If initialized
71 * with this flag, the ref will stay in atomic mode until
72 * percpu_ref_switch_to_percpu() is invoked on it.
73 */
74 PERCPU_REF_INIT_ATOMIC = 1 << 0,
75
76 /*
77 * Start dead w/ ref == 0 in atomic mode. Must be revived with
78 * percpu_ref_reinit() before used. Implies INIT_ATOMIC.
79 */
80 PERCPU_REF_INIT_DEAD = 1 << 1,
81};
82
56struct percpu_ref { 83struct percpu_ref {
57 atomic_t count; 84 atomic_long_t count;
58 /* 85 /*
59 * The low bit of the pointer indicates whether the ref is in percpu 86 * The low bit of the pointer indicates whether the ref is in percpu
60 * mode; if set, then get/put will manipulate the atomic_t. 87 * mode; if set, then get/put will manipulate the atomic_t.
61 */ 88 */
62 unsigned long pcpu_count_ptr; 89 unsigned long percpu_count_ptr;
63 percpu_ref_func_t *release; 90 percpu_ref_func_t *release;
64 percpu_ref_func_t *confirm_kill; 91 percpu_ref_func_t *confirm_switch;
92 bool force_atomic:1;
65 struct rcu_head rcu; 93 struct rcu_head rcu;
66}; 94};
67 95
68int __must_check percpu_ref_init(struct percpu_ref *ref, 96int __must_check percpu_ref_init(struct percpu_ref *ref,
69 percpu_ref_func_t *release); 97 percpu_ref_func_t *release, unsigned int flags,
70void percpu_ref_reinit(struct percpu_ref *ref); 98 gfp_t gfp);
71void percpu_ref_exit(struct percpu_ref *ref); 99void percpu_ref_exit(struct percpu_ref *ref);
100void percpu_ref_switch_to_atomic(struct percpu_ref *ref,
101 percpu_ref_func_t *confirm_switch);
102void percpu_ref_switch_to_percpu(struct percpu_ref *ref);
72void percpu_ref_kill_and_confirm(struct percpu_ref *ref, 103void percpu_ref_kill_and_confirm(struct percpu_ref *ref,
73 percpu_ref_func_t *confirm_kill); 104 percpu_ref_func_t *confirm_kill);
105void percpu_ref_reinit(struct percpu_ref *ref);
74 106
75/** 107/**
76 * percpu_ref_kill - drop the initial ref 108 * percpu_ref_kill - drop the initial ref
@@ -87,26 +119,24 @@ static inline void percpu_ref_kill(struct percpu_ref *ref)
87 return percpu_ref_kill_and_confirm(ref, NULL); 119 return percpu_ref_kill_and_confirm(ref, NULL);
88} 120}
89 121
90#define PCPU_REF_DEAD 1
91
92/* 122/*
93 * Internal helper. Don't use outside percpu-refcount proper. The 123 * Internal helper. Don't use outside percpu-refcount proper. The
94 * function doesn't return the pointer and let the caller test it for NULL 124 * function doesn't return the pointer and let the caller test it for NULL
95 * because doing so forces the compiler to generate two conditional 125 * because doing so forces the compiler to generate two conditional
96 * branches as it can't assume that @ref->pcpu_count is not NULL. 126 * branches as it can't assume that @ref->percpu_count is not NULL.
97 */ 127 */
98static inline bool __pcpu_ref_alive(struct percpu_ref *ref, 128static inline bool __ref_is_percpu(struct percpu_ref *ref,
99 unsigned __percpu **pcpu_countp) 129 unsigned long __percpu **percpu_countp)
100{ 130{
101 unsigned long pcpu_ptr = ACCESS_ONCE(ref->pcpu_count_ptr); 131 unsigned long percpu_ptr = ACCESS_ONCE(ref->percpu_count_ptr);
102 132
103 /* paired with smp_store_release() in percpu_ref_reinit() */ 133 /* paired with smp_store_release() in percpu_ref_reinit() */
104 smp_read_barrier_depends(); 134 smp_read_barrier_depends();
105 135
106 if (unlikely(pcpu_ptr & PCPU_REF_DEAD)) 136 if (unlikely(percpu_ptr & __PERCPU_REF_ATOMIC))
107 return false; 137 return false;
108 138
109 *pcpu_countp = (unsigned __percpu *)pcpu_ptr; 139 *percpu_countp = (unsigned long __percpu *)percpu_ptr;
110 return true; 140 return true;
111} 141}
112 142
@@ -114,18 +144,20 @@ static inline bool __pcpu_ref_alive(struct percpu_ref *ref,
114 * percpu_ref_get - increment a percpu refcount 144 * percpu_ref_get - increment a percpu refcount
115 * @ref: percpu_ref to get 145 * @ref: percpu_ref to get
116 * 146 *
117 * Analagous to atomic_inc(). 147 * Analagous to atomic_long_inc().
118 */ 148 *
149 * This function is safe to call as long as @ref is between init and exit.
150 */
119static inline void percpu_ref_get(struct percpu_ref *ref) 151static inline void percpu_ref_get(struct percpu_ref *ref)
120{ 152{
121 unsigned __percpu *pcpu_count; 153 unsigned long __percpu *percpu_count;
122 154
123 rcu_read_lock_sched(); 155 rcu_read_lock_sched();
124 156
125 if (__pcpu_ref_alive(ref, &pcpu_count)) 157 if (__ref_is_percpu(ref, &percpu_count))
126 this_cpu_inc(*pcpu_count); 158 this_cpu_inc(*percpu_count);
127 else 159 else
128 atomic_inc(&ref->count); 160 atomic_long_inc(&ref->count);
129 161
130 rcu_read_unlock_sched(); 162 rcu_read_unlock_sched();
131} 163}
@@ -137,20 +169,20 @@ static inline void percpu_ref_get(struct percpu_ref *ref)
137 * Increment a percpu refcount unless its count already reached zero. 169 * Increment a percpu refcount unless its count already reached zero.
138 * Returns %true on success; %false on failure. 170 * Returns %true on success; %false on failure.
139 * 171 *
140 * The caller is responsible for ensuring that @ref stays accessible. 172 * This function is safe to call as long as @ref is between init and exit.
141 */ 173 */
142static inline bool percpu_ref_tryget(struct percpu_ref *ref) 174static inline bool percpu_ref_tryget(struct percpu_ref *ref)
143{ 175{
144 unsigned __percpu *pcpu_count; 176 unsigned long __percpu *percpu_count;
145 int ret = false; 177 int ret;
146 178
147 rcu_read_lock_sched(); 179 rcu_read_lock_sched();
148 180
149 if (__pcpu_ref_alive(ref, &pcpu_count)) { 181 if (__ref_is_percpu(ref, &percpu_count)) {
150 this_cpu_inc(*pcpu_count); 182 this_cpu_inc(*percpu_count);
151 ret = true; 183 ret = true;
152 } else { 184 } else {
153 ret = atomic_inc_not_zero(&ref->count); 185 ret = atomic_long_inc_not_zero(&ref->count);
154 } 186 }
155 187
156 rcu_read_unlock_sched(); 188 rcu_read_unlock_sched();
@@ -165,23 +197,26 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref)
165 * Increment a percpu refcount unless it has already been killed. Returns 197 * Increment a percpu refcount unless it has already been killed. Returns
166 * %true on success; %false on failure. 198 * %true on success; %false on failure.
167 * 199 *
168 * Completion of percpu_ref_kill() in itself doesn't guarantee that tryget 200 * Completion of percpu_ref_kill() in itself doesn't guarantee that this
169 * will fail. For such guarantee, percpu_ref_kill_and_confirm() should be 201 * function will fail. For such guarantee, percpu_ref_kill_and_confirm()
170 * used. After the confirm_kill callback is invoked, it's guaranteed that 202 * should be used. After the confirm_kill callback is invoked, it's
171 * no new reference will be given out by percpu_ref_tryget(). 203 * guaranteed that no new reference will be given out by
204 * percpu_ref_tryget_live().
172 * 205 *
173 * The caller is responsible for ensuring that @ref stays accessible. 206 * This function is safe to call as long as @ref is between init and exit.
174 */ 207 */
175static inline bool percpu_ref_tryget_live(struct percpu_ref *ref) 208static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)
176{ 209{
177 unsigned __percpu *pcpu_count; 210 unsigned long __percpu *percpu_count;
178 int ret = false; 211 int ret = false;
179 212
180 rcu_read_lock_sched(); 213 rcu_read_lock_sched();
181 214
182 if (__pcpu_ref_alive(ref, &pcpu_count)) { 215 if (__ref_is_percpu(ref, &percpu_count)) {
183 this_cpu_inc(*pcpu_count); 216 this_cpu_inc(*percpu_count);
184 ret = true; 217 ret = true;
218 } else if (!(ACCESS_ONCE(ref->percpu_count_ptr) & __PERCPU_REF_DEAD)) {
219 ret = atomic_long_inc_not_zero(&ref->count);
185 } 220 }
186 221
187 rcu_read_unlock_sched(); 222 rcu_read_unlock_sched();
@@ -195,16 +230,18 @@ static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)
195 * 230 *
196 * Decrement the refcount, and if 0, call the release function (which was passed 231 * Decrement the refcount, and if 0, call the release function (which was passed
197 * to percpu_ref_init()) 232 * to percpu_ref_init())
233 *
234 * This function is safe to call as long as @ref is between init and exit.
198 */ 235 */
199static inline void percpu_ref_put(struct percpu_ref *ref) 236static inline void percpu_ref_put(struct percpu_ref *ref)
200{ 237{
201 unsigned __percpu *pcpu_count; 238 unsigned long __percpu *percpu_count;
202 239
203 rcu_read_lock_sched(); 240 rcu_read_lock_sched();
204 241
205 if (__pcpu_ref_alive(ref, &pcpu_count)) 242 if (__ref_is_percpu(ref, &percpu_count))
206 this_cpu_dec(*pcpu_count); 243 this_cpu_dec(*percpu_count);
207 else if (unlikely(atomic_dec_and_test(&ref->count))) 244 else if (unlikely(atomic_long_dec_and_test(&ref->count)))
208 ref->release(ref); 245 ref->release(ref);
209 246
210 rcu_read_unlock_sched(); 247 rcu_read_unlock_sched();
@@ -215,14 +252,16 @@ static inline void percpu_ref_put(struct percpu_ref *ref)
215 * @ref: percpu_ref to test 252 * @ref: percpu_ref to test
216 * 253 *
217 * Returns %true if @ref reached zero. 254 * Returns %true if @ref reached zero.
255 *
256 * This function is safe to call as long as @ref is between init and exit.
218 */ 257 */
219static inline bool percpu_ref_is_zero(struct percpu_ref *ref) 258static inline bool percpu_ref_is_zero(struct percpu_ref *ref)
220{ 259{
221 unsigned __percpu *pcpu_count; 260 unsigned long __percpu *percpu_count;
222 261
223 if (__pcpu_ref_alive(ref, &pcpu_count)) 262 if (__ref_is_percpu(ref, &percpu_count))
224 return false; 263 return false;
225 return !atomic_read(&ref->count); 264 return !atomic_long_read(&ref->count);
226} 265}
227 266
228#endif 267#endif
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 6f61b61b7996..a3aa63e47637 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -48,9 +48,9 @@
48 * intelligent way to determine this would be nice. 48 * intelligent way to determine this would be nice.
49 */ 49 */
50#if BITS_PER_LONG > 32 50#if BITS_PER_LONG > 32
51#define PERCPU_DYNAMIC_RESERVE (20 << 10) 51#define PERCPU_DYNAMIC_RESERVE (28 << 10)
52#else 52#else
53#define PERCPU_DYNAMIC_RESERVE (12 << 10) 53#define PERCPU_DYNAMIC_RESERVE (20 << 10)
54#endif 54#endif
55 55
56extern void *pcpu_base_addr; 56extern void *pcpu_base_addr;
@@ -122,11 +122,16 @@ extern void __init setup_per_cpu_areas(void);
122#endif 122#endif
123extern void __init percpu_init_late(void); 123extern void __init percpu_init_late(void);
124 124
125extern void __percpu *__alloc_percpu_gfp(size_t size, size_t align, gfp_t gfp);
125extern void __percpu *__alloc_percpu(size_t size, size_t align); 126extern void __percpu *__alloc_percpu(size_t size, size_t align);
126extern void free_percpu(void __percpu *__pdata); 127extern void free_percpu(void __percpu *__pdata);
127extern phys_addr_t per_cpu_ptr_to_phys(void *addr); 128extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
128 129
129#define alloc_percpu(type) \ 130#define alloc_percpu_gfp(type, gfp) \
130 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) 131 (typeof(type) __percpu *)__alloc_percpu_gfp(sizeof(type), \
132 __alignof__(type), gfp)
133#define alloc_percpu(type) \
134 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), \
135 __alignof__(type))
131 136
132#endif /* __LINUX_PERCPU_H */ 137#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index d5dd4657c8d6..50e50095c8d1 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -12,6 +12,7 @@
12#include <linux/threads.h> 12#include <linux/threads.h>
13#include <linux/percpu.h> 13#include <linux/percpu.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/gfp.h>
15 16
16#ifdef CONFIG_SMP 17#ifdef CONFIG_SMP
17 18
@@ -26,14 +27,14 @@ struct percpu_counter {
26 27
27extern int percpu_counter_batch; 28extern int percpu_counter_batch;
28 29
29int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, 30int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, gfp_t gfp,
30 struct lock_class_key *key); 31 struct lock_class_key *key);
31 32
32#define percpu_counter_init(fbc, value) \ 33#define percpu_counter_init(fbc, value, gfp) \
33 ({ \ 34 ({ \
34 static struct lock_class_key __key; \ 35 static struct lock_class_key __key; \
35 \ 36 \
36 __percpu_counter_init(fbc, value, &__key); \ 37 __percpu_counter_init(fbc, value, gfp, &__key); \
37 }) 38 })
38 39
39void percpu_counter_destroy(struct percpu_counter *fbc); 40void percpu_counter_destroy(struct percpu_counter *fbc);
@@ -89,7 +90,8 @@ struct percpu_counter {
89 s64 count; 90 s64 count;
90}; 91};
91 92
92static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount) 93static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount,
94 gfp_t gfp)
93{ 95{
94 fbc->count = amount; 96 fbc->count = amount;
95 return 0; 97 return 0;
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 707617a8c0f6..893a0d07986f 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -52,6 +52,7 @@ struct perf_guest_info_callbacks {
52#include <linux/atomic.h> 52#include <linux/atomic.h>
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 <asm/local.h> 56#include <asm/local.h>
56 57
57struct perf_callchain_entry { 58struct perf_callchain_entry {
@@ -268,6 +269,7 @@ struct pmu {
268 * enum perf_event_active_state - the states of a event 269 * enum perf_event_active_state - the states of a event
269 */ 270 */
270enum perf_event_active_state { 271enum perf_event_active_state {
272 PERF_EVENT_STATE_EXIT = -3,
271 PERF_EVENT_STATE_ERROR = -2, 273 PERF_EVENT_STATE_ERROR = -2,
272 PERF_EVENT_STATE_OFF = -1, 274 PERF_EVENT_STATE_OFF = -1,
273 PERF_EVENT_STATE_INACTIVE = 0, 275 PERF_EVENT_STATE_INACTIVE = 0,
@@ -507,6 +509,9 @@ struct perf_event_context {
507 int nr_cgroups; /* cgroup evts */ 509 int nr_cgroups; /* cgroup evts */
508 int nr_branch_stack; /* branch_stack evt */ 510 int nr_branch_stack; /* branch_stack evt */
509 struct rcu_head rcu_head; 511 struct rcu_head rcu_head;
512
513 struct delayed_work orphans_remove;
514 bool orphans_remove_sched;
510}; 515};
511 516
512/* 517/*
@@ -604,6 +609,13 @@ struct perf_sample_data {
604 u64 txn; 609 u64 txn;
605}; 610};
606 611
612/* default value for data source */
613#define PERF_MEM_NA (PERF_MEM_S(OP, NA) |\
614 PERF_MEM_S(LVL, NA) |\
615 PERF_MEM_S(SNOOP, NA) |\
616 PERF_MEM_S(LOCK, NA) |\
617 PERF_MEM_S(TLB, NA))
618
607static inline void perf_sample_data_init(struct perf_sample_data *data, 619static inline void perf_sample_data_init(struct perf_sample_data *data,
608 u64 addr, u64 period) 620 u64 addr, u64 period)
609{ 621{
@@ -616,7 +628,7 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
616 data->regs_user.regs = NULL; 628 data->regs_user.regs = NULL;
617 data->stack_user_size = 0; 629 data->stack_user_size = 0;
618 data->weight = 0; 630 data->weight = 0;
619 data->data_src.val = 0; 631 data->data_src.val = PERF_MEM_NA;
620 data->txn = 0; 632 data->txn = 0;
621} 633}
622 634
diff --git a/include/linux/phonedev.h b/include/linux/phonedev.h
deleted file mode 100644
index 4269de99e320..000000000000
--- a/include/linux/phonedev.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef __LINUX_PHONEDEV_H
2#define __LINUX_PHONEDEV_H
3
4#include <linux/types.h>
5
6#ifdef __KERNEL__
7
8#include <linux/poll.h>
9
10struct phone_device {
11 struct phone_device *next;
12 const struct file_operations *f_op;
13 int (*open) (struct phone_device *, struct file *);
14 int board; /* Device private index */
15 int minor;
16};
17
18extern int phonedev_init(void);
19#define PHONE_MAJOR 100
20extern int phone_register_device(struct phone_device *, int unit);
21#define PHONE_UNIT_ANY -1
22extern void phone_unregister_device(struct phone_device *);
23
24#endif
25#endif
diff --git a/include/linux/phy.h b/include/linux/phy.h
index ed39956b5613..d090cfcaa167 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -598,6 +598,19 @@ static inline int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)
598} 598}
599 599
600/** 600/**
601 * phy_read_mmd_indirect - reads data from the MMD registers
602 * @phydev: The PHY device bus
603 * @prtad: MMD Address
604 * @devad: MMD DEVAD
605 * @addr: PHY address on the MII bus
606 *
607 * Description: it reads data from the MMD registers (clause 22 to access to
608 * clause 45) of the specified phy address.
609 */
610int phy_read_mmd_indirect(struct phy_device *phydev, int prtad,
611 int devad, int addr);
612
613/**
601 * phy_read - Convenience function for reading a given PHY register 614 * phy_read - Convenience function for reading a given PHY register
602 * @phydev: the phy_device struct 615 * @phydev: the phy_device struct
603 * @regnum: register number to read 616 * @regnum: register number to read
@@ -668,6 +681,20 @@ static inline int phy_write_mmd(struct phy_device *phydev, int devad,
668 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 681 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
669} 682}
670 683
684/**
685 * phy_write_mmd_indirect - writes data to the MMD registers
686 * @phydev: The PHY device
687 * @prtad: MMD Address
688 * @devad: MMD DEVAD
689 * @addr: PHY address on the MII bus
690 * @data: data to write in the MMD register
691 *
692 * Description: Write data from the MMD registers of the specified
693 * phy address.
694 */
695void phy_write_mmd_indirect(struct phy_device *phydev, int prtad,
696 int devad, int addr, u32 data);
697
671struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, 698struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
672 bool is_c45, 699 bool is_c45,
673 struct phy_c45_device_ids *c45_ids); 700 struct phy_c45_device_ids *c45_ids);
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index ae612acebb53..f2ca1b459377 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -14,34 +14,35 @@ struct device_node;
14#ifdef CONFIG_FIXED_PHY 14#ifdef CONFIG_FIXED_PHY
15extern int fixed_phy_add(unsigned int irq, int phy_id, 15extern int fixed_phy_add(unsigned int irq, int phy_id,
16 struct fixed_phy_status *status); 16 struct fixed_phy_status *status);
17extern int fixed_phy_register(unsigned int irq, 17extern struct phy_device *fixed_phy_register(unsigned int irq,
18 struct fixed_phy_status *status, 18 struct fixed_phy_status *status,
19 struct device_node *np); 19 struct device_node *np);
20extern void fixed_phy_del(int phy_addr); 20extern void fixed_phy_del(int phy_addr);
21extern int fixed_phy_set_link_update(struct phy_device *phydev,
22 int (*link_update)(struct net_device *,
23 struct fixed_phy_status *));
21#else 24#else
22static inline int fixed_phy_add(unsigned int irq, int phy_id, 25static inline int fixed_phy_add(unsigned int irq, int phy_id,
23 struct fixed_phy_status *status) 26 struct fixed_phy_status *status)
24{ 27{
25 return -ENODEV; 28 return -ENODEV;
26} 29}
27static inline int fixed_phy_register(unsigned int irq, 30static inline struct phy_device *fixed_phy_register(unsigned int irq,
28 struct fixed_phy_status *status, 31 struct fixed_phy_status *status,
29 struct device_node *np) 32 struct device_node *np)
30{ 33{
31 return -ENODEV; 34 return ERR_PTR(-ENODEV);
32} 35}
33static inline int fixed_phy_del(int phy_addr) 36static inline int fixed_phy_del(int phy_addr)
34{ 37{
35 return -ENODEV; 38 return -ENODEV;
36} 39}
37#endif /* CONFIG_FIXED_PHY */ 40static inline int fixed_phy_set_link_update(struct phy_device *phydev,
38
39/*
40 * This function issued only by fixed_phy-aware drivers, no need
41 * protect it with #ifdef
42 */
43extern int fixed_phy_set_link_update(struct phy_device *phydev,
44 int (*link_update)(struct net_device *, 41 int (*link_update)(struct net_device *,
45 struct fixed_phy_status *)); 42 struct fixed_phy_status *))
43{
44 return -ENODEV;
45}
46#endif /* CONFIG_FIXED_PHY */
46 47
47#endif /* __PHY_FIXED_H */ 48#endif /* __PHY_FIXED_H */
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 7246ef3d4455..1997ffc295a7 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -33,6 +33,7 @@ struct pid_namespace {
33#ifdef CONFIG_PROC_FS 33#ifdef CONFIG_PROC_FS
34 struct vfsmount *proc_mnt; 34 struct vfsmount *proc_mnt;
35 struct dentry *proc_self; 35 struct dentry *proc_self;
36 struct dentry *proc_thread_self;
36#endif 37#endif
37#ifdef CONFIG_BSD_PROCESS_ACCT 38#ifdef CONFIG_BSD_PROCESS_ACCT
38 struct bsd_acct_struct *bacct; 39 struct bsd_acct_struct *bacct;
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index a15f10727eb8..d578a60eff23 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -57,7 +57,7 @@
57 * which are then pulled up with an external resistor. Setting this 57 * which are then pulled up with an external resistor. Setting this
58 * config will enable open drain mode, the argument is ignored. 58 * config will enable open drain mode, the argument is ignored.
59 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source 59 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source
60 * (open emitter). Setting this config will enable open drain mode, the 60 * (open emitter). Setting this config will enable open source mode, the
61 * argument is ignored. 61 * argument is ignored.
62 * @PIN_CONFIG_DRIVE_STRENGTH: the pin will sink or source at most the current 62 * @PIN_CONFIG_DRIVE_STRENGTH: the pin will sink or source at most the current
63 * passed as argument. The argument is in mA. 63 * passed as argument. The argument is in mA.
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index c15395031cb3..511bda9ed4bf 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -39,13 +39,12 @@ struct pinctrl_dev;
39 * name can be used with the generic @pinctrl_ops to retrieve the 39 * name can be used with the generic @pinctrl_ops to retrieve the
40 * actual pins affected. The applicable groups will be returned in 40 * actual pins affected. The applicable groups will be returned in
41 * @groups and the number of groups in @num_groups 41 * @groups and the number of groups in @num_groups
42 * @enable: enable a certain muxing function with a certain pin group. The 42 * @set_mux: enable a certain muxing function with a certain pin group. The
43 * driver does not need to figure out whether enabling this function 43 * driver does not need to figure out whether enabling this function
44 * conflicts some other use of the pins in that group, such collisions 44 * conflicts some other use of the pins in that group, such collisions
45 * are handled by the pinmux subsystem. The @func_selector selects a 45 * are handled by the pinmux subsystem. The @func_selector selects a
46 * certain function whereas @group_selector selects a certain set of pins 46 * certain function whereas @group_selector selects a certain set of pins
47 * to be used. On simple controllers the latter argument may be ignored 47 * to be used. On simple controllers the latter argument may be ignored
48 * @disable: disable a certain muxing selector with a certain pin group
49 * @gpio_request_enable: requests and enables GPIO on a certain pin. 48 * @gpio_request_enable: requests and enables GPIO on a certain pin.
50 * Implement this only if you can mux every pin individually as GPIO. The 49 * Implement this only if you can mux every pin individually as GPIO. The
51 * affected GPIO range is passed along with an offset(pin number) into that 50 * affected GPIO range is passed along with an offset(pin number) into that
@@ -68,10 +67,8 @@ struct pinmux_ops {
68 unsigned selector, 67 unsigned selector,
69 const char * const **groups, 68 const char * const **groups,
70 unsigned * const num_groups); 69 unsigned * const num_groups);
71 int (*enable) (struct pinctrl_dev *pctldev, unsigned func_selector, 70 int (*set_mux) (struct pinctrl_dev *pctldev, unsigned func_selector,
72 unsigned group_selector); 71 unsigned group_selector);
73 void (*disable) (struct pinctrl_dev *pctldev, unsigned func_selector,
74 unsigned group_selector);
75 int (*gpio_request_enable) (struct pinctrl_dev *pctldev, 72 int (*gpio_request_enable) (struct pinctrl_dev *pctldev,
76 struct pinctrl_gpio_range *range, 73 struct pinctrl_gpio_range *range,
77 unsigned offset); 74 unsigned offset);
diff --git a/include/linux/mailbox.h b/include/linux/pl320-ipc.h
index 5161f63ec1c8..5161f63ec1c8 100644
--- a/include/linux/mailbox.h
+++ b/include/linux/pl320-ipc.h
diff --git a/include/linux/platform_data/camera-mx1.h b/include/linux/platform_data/camera-mx1.h
deleted file mode 100644
index 4fd6c70314b4..000000000000
--- a/include/linux/platform_data/camera-mx1.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * mx1_camera.h - i.MX1/i.MXL camera driver header file
3 *
4 * Copyright (c) 2008, Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 * Copyright (C) 2009, Darius Augulis <augulis.darius@gmail.com>
6 *
7 * Based on PXA camera.h file:
8 * Copyright (C) 2003, Intel Corporation
9 * Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#ifndef __ASM_ARCH_CAMERA_H_
17#define __ASM_ARCH_CAMERA_H_
18
19#define MX1_CAMERA_DATA_HIGH 1
20#define MX1_CAMERA_PCLK_RISING 2
21#define MX1_CAMERA_VSYNC_HIGH 4
22
23extern unsigned char mx1_camera_sof_fiq_start, mx1_camera_sof_fiq_end;
24
25/**
26 * struct mx1_camera_pdata - i.MX1/i.MXL camera platform data
27 * @mclk_10khz: master clock frequency in 10kHz units
28 * @flags: MX1 camera platform flags
29 */
30struct mx1_camera_pdata {
31 unsigned long mclk_10khz;
32 unsigned long flags;
33};
34
35#endif /* __ASM_ARCH_CAMERA_H_ */
diff --git a/include/linux/platform_data/dma-dw.h b/include/linux/platform_data/dma-dw.h
new file mode 100644
index 000000000000..d8155c005242
--- /dev/null
+++ b/include/linux/platform_data/dma-dw.h
@@ -0,0 +1,59 @@
1/*
2 * Driver for the Synopsys DesignWare DMA Controller
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 * Copyright (C) 2010-2011 ST Microelectronics
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef _PLATFORM_DATA_DMA_DW_H
12#define _PLATFORM_DATA_DMA_DW_H
13
14#include <linux/device.h>
15
16/**
17 * struct dw_dma_slave - Controller-specific information about a slave
18 *
19 * @dma_dev: required DMA master device. Depricated.
20 * @src_id: src request line
21 * @dst_id: dst request line
22 * @src_master: src master for transfers on allocated channel.
23 * @dst_master: dest master for transfers on allocated channel.
24 */
25struct dw_dma_slave {
26 struct device *dma_dev;
27 u8 src_id;
28 u8 dst_id;
29 u8 src_master;
30 u8 dst_master;
31};
32
33/**
34 * struct dw_dma_platform_data - Controller configuration parameters
35 * @nr_channels: Number of channels supported by hardware (max 8)
36 * @is_private: The device channels should be marked as private and not for
37 * by the general purpose DMA channel allocator.
38 * @chan_allocation_order: Allocate channels starting from 0 or 7
39 * @chan_priority: Set channel priority increasing from 0 to 7 or 7 to 0.
40 * @block_size: Maximum block size supported by the controller
41 * @nr_masters: Number of AHB masters supported by the controller
42 * @data_width: Maximum data width supported by hardware per AHB master
43 * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
44 */
45struct dw_dma_platform_data {
46 unsigned int nr_channels;
47 bool is_private;
48#define CHAN_ALLOCATION_ASCENDING 0 /* zero to seven */
49#define CHAN_ALLOCATION_DESCENDING 1 /* seven to zero */
50 unsigned char chan_allocation_order;
51#define CHAN_PRIORITY_ASCENDING 0 /* chan0 highest */
52#define CHAN_PRIORITY_DESCENDING 1 /* chan7 highest */
53 unsigned char chan_priority;
54 unsigned short block_size;
55 unsigned char nr_masters;
56 unsigned char data_width[4];
57};
58
59#endif /* _PLATFORM_DATA_DMA_DW_H */
diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h
index d05542aafa3e..6a1357d31871 100644
--- a/include/linux/platform_data/dma-imx.h
+++ b/include/linux/platform_data/dma-imx.h
@@ -40,6 +40,7 @@ enum sdma_peripheral_type {
40 IMX_DMATYPE_ASRC, /* ASRC */ 40 IMX_DMATYPE_ASRC, /* ASRC */
41 IMX_DMATYPE_ESAI, /* ESAI */ 41 IMX_DMATYPE_ESAI, /* ESAI */
42 IMX_DMATYPE_SSI_DUAL, /* SSI Dual FIFO */ 42 IMX_DMATYPE_SSI_DUAL, /* SSI Dual FIFO */
43 IMX_DMATYPE_ASRC_SP, /* Shared ASRC */
43}; 44};
44 45
45enum imx_dma_prio { 46enum imx_dma_prio {
diff --git a/include/linux/platform_data/drv260x-pdata.h b/include/linux/platform_data/drv260x-pdata.h
new file mode 100644
index 000000000000..0a03b0944411
--- /dev/null
+++ b/include/linux/platform_data/drv260x-pdata.h
@@ -0,0 +1,28 @@
1/*
2 * Platform data for DRV260X haptics driver family
3 *
4 * Author: Dan Murphy <dmurphy@ti.com>
5 *
6 * Copyright: (C) 2014 Texas Instruments, Inc.
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 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18#ifndef _LINUX_DRV260X_PDATA_H
19#define _LINUX_DRV260X_PDATA_H
20
21struct drv260x_platform_data {
22 u32 library_selection;
23 u32 mode;
24 u32 vib_rated_voltage;
25 u32 vib_overdrive_voltage;
26};
27
28#endif
diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h
index eb8d5627d080..bdb2710e2aab 100644
--- a/include/linux/platform_data/edma.h
+++ b/include/linux/platform_data/edma.h
@@ -150,6 +150,8 @@ void edma_clear_event(unsigned channel);
150void edma_pause(unsigned channel); 150void edma_pause(unsigned channel);
151void edma_resume(unsigned channel); 151void edma_resume(unsigned channel);
152 152
153void edma_assign_channel_eventq(unsigned channel, enum dma_event_q eventq_no);
154
153struct edma_rsv_info { 155struct edma_rsv_info {
154 156
155 const s16 (*rsv_chans)[2]; 157 const s16 (*rsv_chans)[2];
diff --git a/include/linux/platform_data/elm.h b/include/linux/platform_data/elm.h
index 780d1e97f620..b8686c00f15f 100644
--- a/include/linux/platform_data/elm.h
+++ b/include/linux/platform_data/elm.h
@@ -42,8 +42,24 @@ struct elm_errorvec {
42 int error_loc[16]; 42 int error_loc[16];
43}; 43};
44 44
45#if IS_ENABLED(CONFIG_MTD_NAND_OMAP_BCH)
45void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc, 46void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
46 struct elm_errorvec *err_vec); 47 struct elm_errorvec *err_vec);
47int elm_config(struct device *dev, enum bch_ecc bch_type, 48int elm_config(struct device *dev, enum bch_ecc bch_type,
48 int ecc_steps, int ecc_step_size, int ecc_syndrome_size); 49 int ecc_steps, int ecc_step_size, int ecc_syndrome_size);
50#else
51static inline void
52elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
53 struct elm_errorvec *err_vec)
54{
55}
56
57static inline int elm_config(struct device *dev, enum bch_ecc bch_type,
58 int ecc_steps, int ecc_step_size,
59 int ecc_syndrome_size)
60{
61 return -ENOSYS;
62}
63#endif /* CONFIG_MTD_NAND_ECC_BCH */
64
49#endif /* __ELM_H */ 65#endif /* __ELM_H */
diff --git a/include/linux/platform_data/gpio-dwapb.h b/include/linux/platform_data/gpio-dwapb.h
new file mode 100644
index 000000000000..28702c849af1
--- /dev/null
+++ b/include/linux/platform_data/gpio-dwapb.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright(c) 2014 Intel Corporation.
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 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 */
13
14#ifndef GPIO_DW_APB_H
15#define GPIO_DW_APB_H
16
17struct dwapb_port_property {
18 struct device_node *node;
19 const char *name;
20 unsigned int idx;
21 unsigned int ngpio;
22 unsigned int gpio_base;
23 unsigned int irq;
24 bool irq_shared;
25};
26
27struct dwapb_platform_data {
28 struct dwapb_port_property *properties;
29 unsigned int nports;
30};
31
32#endif
diff --git a/include/linux/tegra-soc.h b/include/linux/platform_data/i2c-designware.h
index 95f611d78f3a..7a61fb27c25b 100644
--- a/include/linux/tegra-soc.h
+++ b/include/linux/platform_data/i2c-designware.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. 2 * Copyright(c) 2014 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 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, 5 * under the terms and conditions of the GNU General Public License,
@@ -9,14 +9,13 @@
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details. 11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 12 */
16 13
17#ifndef __LINUX_TEGRA_SOC_H_ 14#ifndef I2C_DESIGNWARE_H
18#define __LINUX_TEGRA_SOC_H_ 15#define I2C_DESIGNWARE_H
19 16
20u32 tegra_read_chipid(void); 17struct dw_i2c_platform_data {
18 unsigned int i2c_scl_freq;
19};
21 20
22#endif /* __LINUX_TEGRA_SOC_H_ */ 21#endif
diff --git a/include/linux/platform_data/isl9305.h b/include/linux/platform_data/isl9305.h
new file mode 100644
index 000000000000..1419133fa69e
--- /dev/null
+++ b/include/linux/platform_data/isl9305.h
@@ -0,0 +1,30 @@
1/*
2 * isl9305 - Intersil ISL9305 DCDC regulator
3 *
4 * Copyright 2014 Linaro Ltd
5 *
6 * Author: Mark Brown <broonie@kernel.org>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#ifndef __ISL9305_H
15#define __ISL9305_H
16
17#define ISL9305_DCD1 0
18#define ISL9305_DCD2 1
19#define ISL9305_LDO1 2
20#define ISL9305_LDO2 3
21
22#define ISL9305_MAX_REGULATOR ISL9305_LDO2
23
24struct regulator_init_data;
25
26struct isl9305_pdata {
27 struct regulator_init_data *init_data[ISL9305_MAX_REGULATOR];
28};
29
30#endif
diff --git a/include/linux/platform_data/mmc-omap.h b/include/linux/platform_data/mmc-omap.h
index 2bf1b30cb5dc..51e70cf25cbc 100644
--- a/include/linux/platform_data/mmc-omap.h
+++ b/include/linux/platform_data/mmc-omap.h
@@ -28,6 +28,7 @@
28 */ 28 */
29#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0) 29#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
30#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1) 30#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
31#define OMAP_HSMMC_SWAKEUP_MISSING BIT(2)
31 32
32struct mmc_card; 33struct mmc_card;
33 34
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
index 660c029d694f..090bbab0130a 100644
--- a/include/linux/platform_data/mtd-nand-omap2.h
+++ b/include/linux/platform_data/mtd-nand-omap2.h
@@ -21,8 +21,17 @@ enum nand_io {
21}; 21};
22 22
23enum omap_ecc { 23enum omap_ecc {
24 /* 1-bit ECC calculation by GPMC, Error detection by Software */ 24 /*
25 OMAP_ECC_HAM1_CODE_HW = 0, 25 * 1-bit ECC: calculation and correction by SW
26 * ECC stored at end of spare area
27 */
28 OMAP_ECC_HAM1_CODE_SW = 0,
29
30 /*
31 * 1-bit ECC: calculation by GPMC, Error detection by Software
32 * ECC layout compatible with ROM code layout
33 */
34 OMAP_ECC_HAM1_CODE_HW,
26 /* 4-bit ECC calculation by GPMC, Error detection by Software */ 35 /* 4-bit ECC calculation by GPMC, Error detection by Software */
27 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW, 36 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW,
28 /* 4-bit ECC calculation by GPMC, Error detection by ELM */ 37 /* 4-bit ECC calculation by GPMC, Error detection by ELM */
@@ -62,6 +71,7 @@ struct omap_nand_platform_data {
62 struct mtd_partition *parts; 71 struct mtd_partition *parts;
63 int nr_parts; 72 int nr_parts;
64 bool dev_ready; 73 bool dev_ready;
74 bool flash_bbt;
65 enum nand_io xfer_type; 75 enum nand_io xfer_type;
66 int devsize; 76 int devsize;
67 enum omap_ecc ecc_opt; 77 enum omap_ecc ecc_opt;
diff --git a/include/linux/platform_data/rcar-du.h b/include/linux/platform_data/rcar-du.h
index 1a2e9901a22e..a5f045e1d8fe 100644
--- a/include/linux/platform_data/rcar-du.h
+++ b/include/linux/platform_data/rcar-du.h
@@ -14,7 +14,7 @@
14#ifndef __RCAR_DU_H__ 14#ifndef __RCAR_DU_H__
15#define __RCAR_DU_H__ 15#define __RCAR_DU_H__
16 16
17#include <drm/drm_mode.h> 17#include <video/videomode.h>
18 18
19enum rcar_du_output { 19enum rcar_du_output {
20 RCAR_DU_OUTPUT_DPAD0, 20 RCAR_DU_OUTPUT_DPAD0,
@@ -35,7 +35,7 @@ enum rcar_du_encoder_type {
35struct rcar_du_panel_data { 35struct rcar_du_panel_data {
36 unsigned int width_mm; /* Panel width in mm */ 36 unsigned int width_mm; /* Panel width in mm */
37 unsigned int height_mm; /* Panel height in mm */ 37 unsigned int height_mm; /* Panel height in mm */
38 struct drm_mode_modeinfo mode; 38 struct videomode mode;
39}; 39};
40 40
41struct rcar_du_connector_lvds_data { 41struct rcar_du_connector_lvds_data {
diff --git a/include/linux/platform_data/samsung-usbphy.h b/include/linux/platform_data/samsung-usbphy.h
deleted file mode 100644
index 1bd24cba982b..000000000000
--- a/include/linux/platform_data/samsung-usbphy.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics Co.Ltd
3 * http://www.samsung.com/
4 * Author: Praveen Paneri <p.paneri@samsung.com>
5 *
6 * Defines platform data for samsung usb phy driver.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#ifndef __SAMSUNG_USBPHY_PLATFORM_H
15#define __SAMSUNG_USBPHY_PLATFORM_H
16
17/**
18 * samsung_usbphy_data - Platform data for USB PHY driver.
19 * @pmu_isolation: Function to control usb phy isolation in PMU.
20 */
21struct samsung_usbphy_data {
22 void (*pmu_isolation)(int on);
23};
24
25extern void samsung_usbphy_set_pdata(struct samsung_usbphy_data *pd);
26
27#endif /* __SAMSUNG_USBPHY_PLATFORM_H */
diff --git a/include/linux/platform_data/tegra_emc.h b/include/linux/platform_data/tegra_emc.h
deleted file mode 100644
index df67505e98f8..000000000000
--- a/include/linux/platform_data/tegra_emc.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * Copyright (C) 2011 Google, Inc.
3 *
4 * Author:
5 * Colin Cross <ccross@android.com>
6 * Olof Johansson <olof@lixom.net>
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#ifndef __TEGRA_EMC_H_
20#define __TEGRA_EMC_H_
21
22#define TEGRA_EMC_NUM_REGS 46
23
24struct tegra_emc_table {
25 unsigned long rate;
26 u32 regs[TEGRA_EMC_NUM_REGS];
27};
28
29struct tegra_emc_pdata {
30 int num_tables;
31 struct tegra_emc_table *tables;
32};
33
34#endif
diff --git a/include/linux/platform_data/usb-ehci-mxc.h b/include/linux/platform_data/usb-ehci-mxc.h
index 7eb9d1329671..157e71f79f99 100644
--- a/include/linux/platform_data/usb-ehci-mxc.h
+++ b/include/linux/platform_data/usb-ehci-mxc.h
@@ -1,46 +1,6 @@
1#ifndef __INCLUDE_ASM_ARCH_MXC_EHCI_H 1#ifndef __INCLUDE_ASM_ARCH_MXC_EHCI_H
2#define __INCLUDE_ASM_ARCH_MXC_EHCI_H 2#define __INCLUDE_ASM_ARCH_MXC_EHCI_H
3 3
4/* values for portsc field */
5#define MXC_EHCI_PHY_LOW_POWER_SUSPEND (1 << 23)
6#define MXC_EHCI_FORCE_FS (1 << 24)
7#define MXC_EHCI_UTMI_8BIT (0 << 28)
8#define MXC_EHCI_UTMI_16BIT (1 << 28)
9#define MXC_EHCI_SERIAL (1 << 29)
10#define MXC_EHCI_MODE_UTMI (0 << 30)
11#define MXC_EHCI_MODE_PHILIPS (1 << 30)
12#define MXC_EHCI_MODE_ULPI (2 << 30)
13#define MXC_EHCI_MODE_SERIAL (3 << 30)
14
15/* values for flags field */
16#define MXC_EHCI_INTERFACE_DIFF_UNI (0 << 0)
17#define MXC_EHCI_INTERFACE_DIFF_BI (1 << 0)
18#define MXC_EHCI_INTERFACE_SINGLE_UNI (2 << 0)
19#define MXC_EHCI_INTERFACE_SINGLE_BI (3 << 0)
20#define MXC_EHCI_INTERFACE_MASK (0xf)
21
22#define MXC_EHCI_POWER_PINS_ENABLED (1 << 5)
23#define MXC_EHCI_PWR_PIN_ACTIVE_HIGH (1 << 6)
24#define MXC_EHCI_OC_PIN_ACTIVE_LOW (1 << 7)
25#define MXC_EHCI_TTL_ENABLED (1 << 8)
26
27#define MXC_EHCI_INTERNAL_PHY (1 << 9)
28#define MXC_EHCI_IPPUE_DOWN (1 << 10)
29#define MXC_EHCI_IPPUE_UP (1 << 11)
30#define MXC_EHCI_WAKEUP_ENABLED (1 << 12)
31#define MXC_EHCI_ITC_NO_THRESHOLD (1 << 13)
32
33#define MXC_USBCTRL_OFFSET 0
34#define MXC_USB_PHY_CTR_FUNC_OFFSET 0x8
35#define MXC_USB_PHY_CTR_FUNC2_OFFSET 0xc
36#define MXC_USBH2CTRL_OFFSET 0x14
37
38#define MX5_USBOTHER_REGS_OFFSET 0x800
39
40/* USB_PHY_CTRL_FUNC2*/
41#define MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK 0x3
42#define MX5_USB_UTMI_PHYCTRL1_PLLDIV_SHIFT 0
43
44struct mxc_usbh_platform_data { 4struct mxc_usbh_platform_data {
45 int (*init)(struct platform_device *pdev); 5 int (*init)(struct platform_device *pdev);
46 int (*exit)(struct platform_device *pdev); 6 int (*exit)(struct platform_device *pdev);
@@ -49,11 +9,5 @@ struct mxc_usbh_platform_data {
49 struct usb_phy *otg; 9 struct usb_phy *otg;
50}; 10};
51 11
52int mx51_initialize_usb_hw(int port, unsigned int flags);
53int mx25_initialize_usb_hw(int port, unsigned int flags);
54int mx31_initialize_usb_hw(int port, unsigned int flags);
55int mx35_initialize_usb_hw(int port, unsigned int flags);
56int mx27_initialize_usb_hw(int port, unsigned int flags);
57
58#endif /* __INCLUDE_ASM_ARCH_MXC_EHCI_H */ 12#endif /* __INCLUDE_ASM_ARCH_MXC_EHCI_H */
59 13
diff --git a/include/linux/platform_data/usb-imx_udc.h b/include/linux/platform_data/usb-imx_udc.h
deleted file mode 100644
index be273371f34a..000000000000
--- a/include/linux/platform_data/usb-imx_udc.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * Copyright (C) 2008 Darius Augulis <augulis.darius@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __ASM_ARCH_MXC_USB
16#define __ASM_ARCH_MXC_USB
17
18struct imxusb_platform_data {
19 int (*init)(struct device *);
20 void (*exit)(struct device *);
21};
22
23#endif /* __ASM_ARCH_MXC_USB */
diff --git a/include/linux/platform_data/video-clcd-versatile.h b/include/linux/platform_data/video-clcd-versatile.h
new file mode 100644
index 000000000000..09ccf182af4d
--- /dev/null
+++ b/include/linux/platform_data/video-clcd-versatile.h
@@ -0,0 +1,27 @@
1#ifndef PLAT_CLCD_H
2#define PLAT_CLCD_H
3
4#ifdef CONFIG_PLAT_VERSATILE_CLCD
5struct clcd_panel *versatile_clcd_get_panel(const char *);
6int versatile_clcd_setup_dma(struct clcd_fb *, unsigned long);
7int versatile_clcd_mmap_dma(struct clcd_fb *, struct vm_area_struct *);
8void versatile_clcd_remove_dma(struct clcd_fb *);
9#else
10static inline struct clcd_panel *versatile_clcd_get_panel(const char *s)
11{
12 return NULL;
13}
14static inline int versatile_clcd_setup_dma(struct clcd_fb *fb, unsigned long framesize)
15{
16 return -ENODEV;
17}
18static inline int versatile_clcd_mmap_dma(struct clcd_fb *fb, struct vm_area_struct *vm)
19{
20 return -ENODEV;
21}
22static inline void versatile_clcd_remove_dma(struct clcd_fb *fb)
23{
24}
25#endif
26
27#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 72c0fe098a27..383fd68aaee1 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -619,6 +619,7 @@ extern int dev_pm_put_subsys_data(struct device *dev);
619 */ 619 */
620struct dev_pm_domain { 620struct dev_pm_domain {
621 struct dev_pm_ops ops; 621 struct dev_pm_ops ops;
622 void (*detach)(struct device *dev, bool power_off);
622}; 623};
623 624
624/* 625/*
@@ -679,12 +680,16 @@ struct dev_pm_domain {
679extern void device_pm_lock(void); 680extern void device_pm_lock(void);
680extern void dpm_resume_start(pm_message_t state); 681extern void dpm_resume_start(pm_message_t state);
681extern void dpm_resume_end(pm_message_t state); 682extern void dpm_resume_end(pm_message_t state);
683extern void dpm_resume_noirq(pm_message_t state);
684extern void dpm_resume_early(pm_message_t state);
682extern void dpm_resume(pm_message_t state); 685extern void dpm_resume(pm_message_t state);
683extern void dpm_complete(pm_message_t state); 686extern void dpm_complete(pm_message_t state);
684 687
685extern void device_pm_unlock(void); 688extern void device_pm_unlock(void);
686extern int dpm_suspend_end(pm_message_t state); 689extern int dpm_suspend_end(pm_message_t state);
687extern int dpm_suspend_start(pm_message_t state); 690extern int dpm_suspend_start(pm_message_t state);
691extern int dpm_suspend_noirq(pm_message_t state);
692extern int dpm_suspend_late(pm_message_t state);
688extern int dpm_suspend(pm_message_t state); 693extern int dpm_suspend(pm_message_t state);
689extern int dpm_prepare(pm_message_t state); 694extern int dpm_prepare(pm_message_t state);
690 695
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 7c1d252b20c0..2e0e06daf8c0 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -35,18 +35,10 @@ struct gpd_dev_ops {
35 int (*stop)(struct device *dev); 35 int (*stop)(struct device *dev);
36 int (*save_state)(struct device *dev); 36 int (*save_state)(struct device *dev);
37 int (*restore_state)(struct device *dev); 37 int (*restore_state)(struct device *dev);
38 int (*suspend)(struct device *dev);
39 int (*suspend_late)(struct device *dev);
40 int (*resume_early)(struct device *dev);
41 int (*resume)(struct device *dev);
42 int (*freeze)(struct device *dev);
43 int (*freeze_late)(struct device *dev);
44 int (*thaw_early)(struct device *dev);
45 int (*thaw)(struct device *dev);
46 bool (*active_wakeup)(struct device *dev); 38 bool (*active_wakeup)(struct device *dev);
47}; 39};
48 40
49struct gpd_cpu_data { 41struct gpd_cpuidle_data {
50 unsigned int saved_exit_latency; 42 unsigned int saved_exit_latency;
51 struct cpuidle_state *idle_state; 43 struct cpuidle_state *idle_state;
52}; 44};
@@ -60,7 +52,7 @@ struct generic_pm_domain {
60 struct mutex lock; 52 struct mutex lock;
61 struct dev_power_governor *gov; 53 struct dev_power_governor *gov;
62 struct work_struct power_off_work; 54 struct work_struct power_off_work;
63 char *name; 55 const char *name;
64 unsigned int in_progress; /* Number of devices being suspended now */ 56 unsigned int in_progress; /* Number of devices being suspended now */
65 atomic_t sd_count; /* Number of subdomains with power "on" */ 57 atomic_t sd_count; /* Number of subdomains with power "on" */
66 enum gpd_status status; /* Current state of the domain */ 58 enum gpd_status status; /* Current state of the domain */
@@ -71,7 +63,6 @@ struct generic_pm_domain {
71 unsigned int suspended_count; /* System suspend device counter */ 63 unsigned int suspended_count; /* System suspend device counter */
72 unsigned int prepared_count; /* Suspend counter of prepared devices */ 64 unsigned int prepared_count; /* Suspend counter of prepared devices */
73 bool suspend_power_off; /* Power status before system suspend */ 65 bool suspend_power_off; /* Power status before system suspend */
74 bool dev_irq_safe; /* Device callbacks are IRQ-safe */
75 int (*power_off)(struct generic_pm_domain *domain); 66 int (*power_off)(struct generic_pm_domain *domain);
76 s64 power_off_latency_ns; 67 s64 power_off_latency_ns;
77 int (*power_on)(struct generic_pm_domain *domain); 68 int (*power_on)(struct generic_pm_domain *domain);
@@ -80,8 +71,11 @@ struct generic_pm_domain {
80 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ 71 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
81 bool max_off_time_changed; 72 bool max_off_time_changed;
82 bool cached_power_down_ok; 73 bool cached_power_down_ok;
83 struct device_node *of_node; /* Node in device tree */ 74 struct gpd_cpuidle_data *cpuidle_data;
84 struct gpd_cpu_data *cpu_data; 75 int (*attach_dev)(struct generic_pm_domain *domain,
76 struct device *dev);
77 void (*detach_dev)(struct generic_pm_domain *domain,
78 struct device *dev);
85}; 79};
86 80
87static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) 81static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
@@ -108,12 +102,11 @@ struct gpd_timing_data {
108 102
109struct generic_pm_domain_data { 103struct generic_pm_domain_data {
110 struct pm_domain_data base; 104 struct pm_domain_data base;
111 struct gpd_dev_ops ops;
112 struct gpd_timing_data td; 105 struct gpd_timing_data td;
113 struct notifier_block nb; 106 struct notifier_block nb;
114 struct mutex lock; 107 struct mutex lock;
115 unsigned int refcount; 108 unsigned int refcount;
116 bool need_restore; 109 int need_restore;
117}; 110};
118 111
119#ifdef CONFIG_PM_GENERIC_DOMAINS 112#ifdef CONFIG_PM_GENERIC_DOMAINS
@@ -127,17 +120,11 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
127 return to_gpd_data(dev->power.subsys_data->domain_data); 120 return to_gpd_data(dev->power.subsys_data->domain_data);
128} 121}
129 122
130extern struct dev_power_governor simple_qos_governor;
131
132extern struct generic_pm_domain *dev_to_genpd(struct device *dev); 123extern struct generic_pm_domain *dev_to_genpd(struct device *dev);
133extern int __pm_genpd_add_device(struct generic_pm_domain *genpd, 124extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
134 struct device *dev, 125 struct device *dev,
135 struct gpd_timing_data *td); 126 struct gpd_timing_data *td);
136 127
137extern int __pm_genpd_of_add_device(struct device_node *genpd_node,
138 struct device *dev,
139 struct gpd_timing_data *td);
140
141extern int __pm_genpd_name_add_device(const char *domain_name, 128extern int __pm_genpd_name_add_device(const char *domain_name,
142 struct device *dev, 129 struct device *dev,
143 struct gpd_timing_data *td); 130 struct gpd_timing_data *td);
@@ -151,10 +138,6 @@ extern int pm_genpd_add_subdomain_names(const char *master_name,
151 const char *subdomain_name); 138 const char *subdomain_name);
152extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 139extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
153 struct generic_pm_domain *target); 140 struct generic_pm_domain *target);
154extern int pm_genpd_add_callbacks(struct device *dev,
155 struct gpd_dev_ops *ops,
156 struct gpd_timing_data *td);
157extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td);
158extern int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state); 141extern int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state);
159extern int pm_genpd_name_attach_cpuidle(const char *name, int state); 142extern int pm_genpd_name_attach_cpuidle(const char *name, int state);
160extern int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd); 143extern int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd);
@@ -165,8 +148,7 @@ extern void pm_genpd_init(struct generic_pm_domain *genpd,
165extern int pm_genpd_poweron(struct generic_pm_domain *genpd); 148extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
166extern int pm_genpd_name_poweron(const char *domain_name); 149extern int pm_genpd_name_poweron(const char *domain_name);
167 150
168extern bool default_stop_ok(struct device *dev); 151extern struct dev_power_governor simple_qos_governor;
169
170extern struct dev_power_governor pm_domain_always_on_gov; 152extern struct dev_power_governor pm_domain_always_on_gov;
171#else 153#else
172 154
@@ -184,12 +166,6 @@ static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
184{ 166{
185 return -ENOSYS; 167 return -ENOSYS;
186} 168}
187static inline int __pm_genpd_of_add_device(struct device_node *genpd_node,
188 struct device *dev,
189 struct gpd_timing_data *td)
190{
191 return -ENOSYS;
192}
193static inline int __pm_genpd_name_add_device(const char *domain_name, 169static inline int __pm_genpd_name_add_device(const char *domain_name,
194 struct device *dev, 170 struct device *dev,
195 struct gpd_timing_data *td) 171 struct gpd_timing_data *td)
@@ -217,16 +193,6 @@ static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
217{ 193{
218 return -ENOSYS; 194 return -ENOSYS;
219} 195}
220static inline int pm_genpd_add_callbacks(struct device *dev,
221 struct gpd_dev_ops *ops,
222 struct gpd_timing_data *td)
223{
224 return -ENOSYS;
225}
226static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td)
227{
228 return -ENOSYS;
229}
230static inline int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int st) 196static inline int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int st)
231{ 197{
232 return -ENOSYS; 198 return -ENOSYS;
@@ -255,10 +221,6 @@ static inline int pm_genpd_name_poweron(const char *domain_name)
255{ 221{
256 return -ENOSYS; 222 return -ENOSYS;
257} 223}
258static inline bool default_stop_ok(struct device *dev)
259{
260 return false;
261}
262#define simple_qos_governor NULL 224#define simple_qos_governor NULL
263#define pm_domain_always_on_gov NULL 225#define pm_domain_always_on_gov NULL
264#endif 226#endif
@@ -269,45 +231,87 @@ static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
269 return __pm_genpd_add_device(genpd, dev, NULL); 231 return __pm_genpd_add_device(genpd, dev, NULL);
270} 232}
271 233
272static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
273 struct device *dev)
274{
275 return __pm_genpd_of_add_device(genpd_node, dev, NULL);
276}
277
278static inline int pm_genpd_name_add_device(const char *domain_name, 234static inline int pm_genpd_name_add_device(const char *domain_name,
279 struct device *dev) 235 struct device *dev)
280{ 236{
281 return __pm_genpd_name_add_device(domain_name, dev, NULL); 237 return __pm_genpd_name_add_device(domain_name, dev, NULL);
282} 238}
283 239
284static inline int pm_genpd_remove_callbacks(struct device *dev)
285{
286 return __pm_genpd_remove_callbacks(dev, true);
287}
288
289#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME 240#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME
290extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd);
291extern void pm_genpd_poweroff_unused(void); 241extern void pm_genpd_poweroff_unused(void);
292#else 242#else
293static inline void genpd_queue_power_off_work(struct generic_pm_domain *gpd) {}
294static inline void pm_genpd_poweroff_unused(void) {} 243static inline void pm_genpd_poweroff_unused(void) {}
295#endif 244#endif
296 245
297#ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP 246#ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP
298extern void pm_genpd_syscore_switch(struct device *dev, bool suspend); 247extern void pm_genpd_syscore_poweroff(struct device *dev);
248extern void pm_genpd_syscore_poweron(struct device *dev);
299#else 249#else
300static inline void pm_genpd_syscore_switch(struct device *dev, bool suspend) {} 250static inline void pm_genpd_syscore_poweroff(struct device *dev) {}
251static inline void pm_genpd_syscore_poweron(struct device *dev) {}
301#endif 252#endif
302 253
303static inline void pm_genpd_syscore_poweroff(struct device *dev) 254/* OF PM domain providers */
255struct of_device_id;
256
257struct genpd_onecell_data {
258 struct generic_pm_domain **domains;
259 unsigned int num_domains;
260};
261
262typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
263 void *data);
264
265#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
266int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
267 void *data);
268void of_genpd_del_provider(struct device_node *np);
269
270struct generic_pm_domain *__of_genpd_xlate_simple(
271 struct of_phandle_args *genpdspec,
272 void *data);
273struct generic_pm_domain *__of_genpd_xlate_onecell(
274 struct of_phandle_args *genpdspec,
275 void *data);
276
277int genpd_dev_pm_attach(struct device *dev);
278#else /* !CONFIG_PM_GENERIC_DOMAINS_OF */
279static inline int __of_genpd_add_provider(struct device_node *np,
280 genpd_xlate_t xlate, void *data)
281{
282 return 0;
283}
284static inline void of_genpd_del_provider(struct device_node *np) {}
285
286#define __of_genpd_xlate_simple NULL
287#define __of_genpd_xlate_onecell NULL
288
289static inline int genpd_dev_pm_attach(struct device *dev)
290{
291 return -ENODEV;
292}
293#endif /* CONFIG_PM_GENERIC_DOMAINS_OF */
294
295static inline int of_genpd_add_provider_simple(struct device_node *np,
296 struct generic_pm_domain *genpd)
297{
298 return __of_genpd_add_provider(np, __of_genpd_xlate_simple, genpd);
299}
300static inline int of_genpd_add_provider_onecell(struct device_node *np,
301 struct genpd_onecell_data *data)
304{ 302{
305 pm_genpd_syscore_switch(dev, true); 303 return __of_genpd_add_provider(np, __of_genpd_xlate_onecell, data);
306} 304}
307 305
308static inline void pm_genpd_syscore_poweron(struct device *dev) 306#ifdef CONFIG_PM
307extern int dev_pm_domain_attach(struct device *dev, bool power_on);
308extern void dev_pm_domain_detach(struct device *dev, bool power_off);
309#else
310static inline int dev_pm_domain_attach(struct device *dev, bool power_on)
309{ 311{
310 pm_genpd_syscore_switch(dev, false); 312 return -ENODEV;
311} 313}
314static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {}
315#endif
312 316
313#endif /* _LINUX_PM_DOMAIN_H */ 317#endif /* _LINUX_PM_DOMAIN_H */
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 9ab4bf7c4646..636e82834506 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -15,6 +15,7 @@ enum {
15 PM_QOS_CPU_DMA_LATENCY, 15 PM_QOS_CPU_DMA_LATENCY,
16 PM_QOS_NETWORK_LATENCY, 16 PM_QOS_NETWORK_LATENCY,
17 PM_QOS_NETWORK_THROUGHPUT, 17 PM_QOS_NETWORK_THROUGHPUT,
18 PM_QOS_MEMORY_BANDWIDTH,
18 19
19 /* insert new class ID */ 20 /* insert new class ID */
20 PM_QOS_NUM_CLASSES, 21 PM_QOS_NUM_CLASSES,
@@ -32,6 +33,7 @@ enum pm_qos_flags_status {
32#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 33#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
33#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 34#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
34#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 35#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
36#define PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE 0
35#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0 37#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0
36#define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 38#define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0
37#define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) 39#define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1)
@@ -69,7 +71,8 @@ struct dev_pm_qos_request {
69enum pm_qos_type { 71enum pm_qos_type {
70 PM_QOS_UNITIALIZED, 72 PM_QOS_UNITIALIZED,
71 PM_QOS_MAX, /* return the largest value */ 73 PM_QOS_MAX, /* return the largest value */
72 PM_QOS_MIN /* return the smallest value */ 74 PM_QOS_MIN, /* return the smallest value */
75 PM_QOS_SUM /* return the sum */
73}; 76};
74 77
75/* 78/*
diff --git a/include/linux/pnfs_osd_xdr.h b/include/linux/pnfs_osd_xdr.h
index fe25876c1a5d..17d7d0d20eca 100644
--- a/include/linux/pnfs_osd_xdr.h
+++ b/include/linux/pnfs_osd_xdr.h
@@ -5,7 +5,7 @@
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Benny Halevy <bhalevy@panasas.com> 7 * Benny Halevy <bhalevy@panasas.com>
8 * Boaz Harrosh <bharrosh@panasas.com> 8 * Boaz Harrosh <ooo@electrozaur.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 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 11 * it under the terms of the GNU General Public License version 2
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h
index 07e7945a1ff2..e97fc656a058 100644
--- a/include/linux/power/charger-manager.h
+++ b/include/linux/power/charger-manager.h
@@ -253,9 +253,6 @@ struct charger_manager {
253 struct device *dev; 253 struct device *dev;
254 struct charger_desc *desc; 254 struct charger_desc *desc;
255 255
256 struct power_supply *fuel_gauge;
257 struct power_supply **charger_stat;
258
259#ifdef CONFIG_THERMAL 256#ifdef CONFIG_THERMAL
260 struct thermal_zone_device *tzd_batt; 257 struct thermal_zone_device *tzd_batt;
261#endif 258#endif
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index f3dea41dbcd2..096dbced02ac 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -18,8 +18,6 @@
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/notifier.h> 19#include <linux/notifier.h>
20 20
21struct device;
22
23/* 21/*
24 * All voltages, currents, charges, energies, time and temperatures in uV, 22 * All voltages, currents, charges, energies, time and temperatures in uV,
25 * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise 23 * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise
@@ -102,9 +100,11 @@ enum power_supply_property {
102 POWER_SUPPLY_PROP_VOLTAGE_NOW, 100 POWER_SUPPLY_PROP_VOLTAGE_NOW,
103 POWER_SUPPLY_PROP_VOLTAGE_AVG, 101 POWER_SUPPLY_PROP_VOLTAGE_AVG,
104 POWER_SUPPLY_PROP_VOLTAGE_OCV, 102 POWER_SUPPLY_PROP_VOLTAGE_OCV,
103 POWER_SUPPLY_PROP_VOLTAGE_BOOT,
105 POWER_SUPPLY_PROP_CURRENT_MAX, 104 POWER_SUPPLY_PROP_CURRENT_MAX,
106 POWER_SUPPLY_PROP_CURRENT_NOW, 105 POWER_SUPPLY_PROP_CURRENT_NOW,
107 POWER_SUPPLY_PROP_CURRENT_AVG, 106 POWER_SUPPLY_PROP_CURRENT_AVG,
107 POWER_SUPPLY_PROP_CURRENT_BOOT,
108 POWER_SUPPLY_PROP_POWER_NOW, 108 POWER_SUPPLY_PROP_POWER_NOW,
109 POWER_SUPPLY_PROP_POWER_AVG, 109 POWER_SUPPLY_PROP_POWER_AVG,
110 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, 110 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
@@ -146,6 +146,7 @@ enum power_supply_property {
146 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */ 146 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */
147 POWER_SUPPLY_PROP_SCOPE, 147 POWER_SUPPLY_PROP_SCOPE,
148 POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT, 148 POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
149 POWER_SUPPLY_PROP_CALIBRATE,
149 /* Properties of type `const char *' */ 150 /* Properties of type `const char *' */
150 POWER_SUPPLY_PROP_MODEL_NAME, 151 POWER_SUPPLY_PROP_MODEL_NAME,
151 POWER_SUPPLY_PROP_MANUFACTURER, 152 POWER_SUPPLY_PROP_MANUFACTURER,
@@ -172,6 +173,7 @@ union power_supply_propval {
172 const char *strval; 173 const char *strval;
173}; 174};
174 175
176struct device;
175struct device_node; 177struct device_node;
176 178
177struct power_supply { 179struct power_supply {
@@ -198,6 +200,12 @@ struct power_supply {
198 void (*external_power_changed)(struct power_supply *psy); 200 void (*external_power_changed)(struct power_supply *psy);
199 void (*set_charged)(struct power_supply *psy); 201 void (*set_charged)(struct power_supply *psy);
200 202
203 /*
204 * Set if thermal zone should not be created for this power supply.
205 * For example for virtual supplies forwarding calls to actual
206 * sensors or other supplies.
207 */
208 bool no_thermal;
201 /* For APM emulation, think legacy userspace. */ 209 /* For APM emulation, think legacy userspace. */
202 int use_for_apm; 210 int use_for_apm;
203 211
@@ -291,6 +299,7 @@ static inline bool power_supply_is_amp_property(enum power_supply_property psp)
291 case POWER_SUPPLY_PROP_CURRENT_MAX: 299 case POWER_SUPPLY_PROP_CURRENT_MAX:
292 case POWER_SUPPLY_PROP_CURRENT_NOW: 300 case POWER_SUPPLY_PROP_CURRENT_NOW:
293 case POWER_SUPPLY_PROP_CURRENT_AVG: 301 case POWER_SUPPLY_PROP_CURRENT_AVG:
302 case POWER_SUPPLY_PROP_CURRENT_BOOT:
294 return 1; 303 return 1;
295 default: 304 default:
296 break; 305 break;
@@ -315,6 +324,7 @@ static inline bool power_supply_is_watt_property(enum power_supply_property psp)
315 case POWER_SUPPLY_PROP_VOLTAGE_NOW: 324 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
316 case POWER_SUPPLY_PROP_VOLTAGE_AVG: 325 case POWER_SUPPLY_PROP_VOLTAGE_AVG:
317 case POWER_SUPPLY_PROP_VOLTAGE_OCV: 326 case POWER_SUPPLY_PROP_VOLTAGE_OCV:
327 case POWER_SUPPLY_PROP_VOLTAGE_BOOT:
318 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: 328 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
319 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX: 329 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
320 case POWER_SUPPLY_PROP_POWER_NOW: 330 case POWER_SUPPLY_PROP_POWER_NOW:
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 319ff7e53efb..d78125f73ac4 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -10,6 +10,9 @@
10extern const char linux_banner[]; 10extern const char linux_banner[];
11extern const char linux_proc_banner[]; 11extern const char linux_proc_banner[];
12 12
13extern char *log_buf_addr_get(void);
14extern u32 log_buf_len_get(void);
15
13static inline int printk_get_level(const char *buffer) 16static inline int printk_get_level(const char *buffer)
14{ 17{
15 if (buffer[0] == KERN_SOH_ASCII && buffer[1]) { 18 if (buffer[0] == KERN_SOH_ASCII && buffer[1]) {
@@ -31,7 +34,7 @@ static inline const char *printk_skip_level(const char *buffer)
31} 34}
32 35
33/* printk's without a loglevel use this.. */ 36/* printk's without a loglevel use this.. */
34#define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL 37#define MESSAGE_LOGLEVEL_DEFAULT CONFIG_MESSAGE_LOGLEVEL_DEFAULT
35 38
36/* We show everything that is MORE important than this.. */ 39/* We show everything that is MORE important than this.. */
37#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */ 40#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */
diff --git a/include/linux/prio_heap.h b/include/linux/prio_heap.h
deleted file mode 100644
index 08094350f26a..000000000000
--- a/include/linux/prio_heap.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _LINUX_PRIO_HEAP_H
2#define _LINUX_PRIO_HEAP_H
3
4/*
5 * Simple insertion-only static-sized priority heap containing
6 * pointers, based on CLR, chapter 7
7 */
8
9#include <linux/gfp.h>
10
11/**
12 * struct ptr_heap - simple static-sized priority heap
13 * @ptrs - pointer to data area
14 * @max - max number of elements that can be stored in @ptrs
15 * @size - current number of valid elements in @ptrs (in the range 0..@size-1
16 * @gt: comparison operator, which should implement "greater than"
17 */
18struct ptr_heap {
19 void **ptrs;
20 int max;
21 int size;
22 int (*gt)(void *, void *);
23};
24
25/**
26 * heap_init - initialize an empty heap with a given memory size
27 * @heap: the heap structure to be initialized
28 * @size: amount of memory to use in bytes
29 * @gfp_mask: mask to pass to kmalloc()
30 * @gt: comparison operator, which should implement "greater than"
31 */
32extern int heap_init(struct ptr_heap *heap, size_t size, gfp_t gfp_mask,
33 int (*gt)(void *, void *));
34
35/**
36 * heap_free - release a heap's storage
37 * @heap: the heap structure whose data should be released
38 */
39void heap_free(struct ptr_heap *heap);
40
41/**
42 * heap_insert - insert a value into the heap and return any overflowed value
43 * @heap: the heap to be operated on
44 * @p: the pointer to be inserted
45 *
46 * Attempts to insert the given value into the priority heap. If the
47 * heap is full prior to the insertion, then the resulting heap will
48 * consist of the smallest @max elements of the original heap and the
49 * new element; the greatest element will be removed from the heap and
50 * returned. Note that the returned element will be the new element
51 * (i.e. no change to the heap) if the new element is greater than all
52 * elements currently in the heap.
53 */
54extern void *heap_insert(struct ptr_heap *heap, void *p);
55
56
57
58#endif /* _LINUX_PRIO_HEAP_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 9d117f61d976..b97bf2ef996e 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -74,6 +74,8 @@ static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *p
74 74
75#endif /* CONFIG_PROC_FS */ 75#endif /* CONFIG_PROC_FS */
76 76
77struct net;
78
77static inline struct proc_dir_entry *proc_net_mkdir( 79static inline struct proc_dir_entry *proc_net_mkdir(
78 struct net *net, const char *name, struct proc_dir_entry *parent) 80 struct net *net, const char *name, struct proc_dir_entry *parent)
79{ 81{
diff --git a/include/linux/proportions.h b/include/linux/proportions.h
index 26a8a4ed9b07..00e8e8fa7358 100644
--- a/include/linux/proportions.h
+++ b/include/linux/proportions.h
@@ -12,6 +12,7 @@
12#include <linux/percpu_counter.h> 12#include <linux/percpu_counter.h>
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/mutex.h> 14#include <linux/mutex.h>
15#include <linux/gfp.h>
15 16
16struct prop_global { 17struct prop_global {
17 /* 18 /*
@@ -40,7 +41,7 @@ struct prop_descriptor {
40 struct mutex mutex; /* serialize the prop_global switch */ 41 struct mutex mutex; /* serialize the prop_global switch */
41}; 42};
42 43
43int prop_descriptor_init(struct prop_descriptor *pd, int shift); 44int prop_descriptor_init(struct prop_descriptor *pd, int shift, gfp_t gfp);
44void prop_change_shift(struct prop_descriptor *pd, int new_shift); 45void prop_change_shift(struct prop_descriptor *pd, int new_shift);
45 46
46/* 47/*
@@ -61,7 +62,7 @@ struct prop_local_percpu {
61 raw_spinlock_t lock; /* protect the snapshot state */ 62 raw_spinlock_t lock; /* protect the snapshot state */
62}; 63};
63 64
64int prop_local_init_percpu(struct prop_local_percpu *pl); 65int prop_local_init_percpu(struct prop_local_percpu *pl, gfp_t gfp);
65void prop_local_destroy_percpu(struct prop_local_percpu *pl); 66void prop_local_destroy_percpu(struct prop_local_percpu *pl);
66void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl); 67void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl);
67void prop_fraction_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl, 68void prop_fraction_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl,
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 0f3c5d38da1f..80d345a3524c 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -390,7 +390,6 @@ struct quota_info {
390 unsigned int flags; /* Flags for diskquotas on this device */ 390 unsigned int flags; /* Flags for diskquotas on this device */
391 struct mutex dqio_mutex; /* lock device while I/O in progress */ 391 struct mutex dqio_mutex; /* lock device while I/O in progress */
392 struct mutex dqonoff_mutex; /* Serialize quotaon & quotaoff */ 392 struct mutex dqonoff_mutex; /* Serialize quotaon & quotaoff */
393 struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */
394 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ 393 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */
395 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ 394 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
396 const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ 395 const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
diff --git a/include/linux/random.h b/include/linux/random.h
index 57fbbffd77a0..b05856e16b75 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -26,7 +26,7 @@ unsigned int get_random_int(void);
26unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len); 26unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
27 27
28u32 prandom_u32(void); 28u32 prandom_u32(void);
29void prandom_bytes(void *buf, int nbytes); 29void prandom_bytes(void *buf, size_t nbytes);
30void prandom_seed(u32 seed); 30void prandom_seed(u32 seed);
31void prandom_reseed_late(void); 31void prandom_reseed_late(void);
32 32
@@ -35,7 +35,7 @@ struct rnd_state {
35}; 35};
36 36
37u32 prandom_u32_state(struct rnd_state *state); 37u32 prandom_u32_state(struct rnd_state *state);
38void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes); 38void prandom_bytes_state(struct rnd_state *state, void *buf, size_t nbytes);
39 39
40/** 40/**
41 * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro) 41 * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro)
diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h
index fea49b5da12a..378c5ee75f78 100644
--- a/include/linux/rbtree_augmented.h
+++ b/include/linux/rbtree_augmented.h
@@ -43,6 +43,16 @@ struct rb_augment_callbacks {
43 43
44extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root, 44extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root,
45 void (*augment_rotate)(struct rb_node *old, struct rb_node *new)); 45 void (*augment_rotate)(struct rb_node *old, struct rb_node *new));
46/*
47 * Fixup the rbtree and update the augmented information when rebalancing.
48 *
49 * On insertion, the user must update the augmented information on the path
50 * leading to the inserted node, then call rb_link_node() as usual and
51 * rb_augment_inserted() instead of the usual rb_insert_color() call.
52 * If rb_augment_inserted() rebalances the rbtree, it will callback into
53 * a user provided function to update the augmented information on the
54 * affected subtrees.
55 */
46static inline void 56static inline void
47rb_insert_augmented(struct rb_node *node, struct rb_root *root, 57rb_insert_augmented(struct rb_node *node, struct rb_root *root,
48 const struct rb_augment_callbacks *augment) 58 const struct rb_augment_callbacks *augment)
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 8183b46fbaa2..372ad5e0dcb8 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -432,9 +432,9 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
432} 432}
433 433
434/** 434/**
435 * hlist_add_after_rcu 435 * hlist_add_behind_rcu
436 * @prev: the existing element to add the new element after.
437 * @n: the new element to add to the hash list. 436 * @n: the new element to add to the hash list.
437 * @prev: the existing element to add the new element after.
438 * 438 *
439 * Description: 439 * Description:
440 * Adds the specified element to the specified hlist 440 * Adds the specified element to the specified hlist
@@ -449,8 +449,8 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
449 * hlist_for_each_entry_rcu(), used to prevent memory-consistency 449 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
450 * problems on Alpha CPUs. 450 * problems on Alpha CPUs.
451 */ 451 */
452static inline void hlist_add_after_rcu(struct hlist_node *prev, 452static inline void hlist_add_behind_rcu(struct hlist_node *n,
453 struct hlist_node *n) 453 struct hlist_node *prev)
454{ 454{
455 n->next = prev->next; 455 n->next = prev->next;
456 n->pprev = &prev->next; 456 n->pprev = &prev->next;
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index d231aa17b1d7..53ff1a752d7e 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -47,14 +47,12 @@
47#include <asm/barrier.h> 47#include <asm/barrier.h>
48 48
49extern int rcu_expedited; /* for sysctl */ 49extern int rcu_expedited; /* for sysctl */
50#ifdef CONFIG_RCU_TORTURE_TEST
51extern int rcutorture_runnable; /* for sysctl */
52#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
53 50
54enum rcutorture_type { 51enum rcutorture_type {
55 RCU_FLAVOR, 52 RCU_FLAVOR,
56 RCU_BH_FLAVOR, 53 RCU_BH_FLAVOR,
57 RCU_SCHED_FLAVOR, 54 RCU_SCHED_FLAVOR,
55 RCU_TASKS_FLAVOR,
58 SRCU_FLAVOR, 56 SRCU_FLAVOR,
59 INVALID_RCU_FLAVOR 57 INVALID_RCU_FLAVOR
60}; 58};
@@ -197,6 +195,28 @@ void call_rcu_sched(struct rcu_head *head,
197 195
198void synchronize_sched(void); 196void synchronize_sched(void);
199 197
198/**
199 * call_rcu_tasks() - Queue an RCU for invocation task-based grace period
200 * @head: structure to be used for queueing the RCU updates.
201 * @func: actual callback function to be invoked after the grace period
202 *
203 * The callback function will be invoked some time after a full grace
204 * period elapses, in other words after all currently executing RCU
205 * read-side critical sections have completed. call_rcu_tasks() assumes
206 * that the read-side critical sections end at a voluntary context
207 * switch (not a preemption!), entry into idle, or transition to usermode
208 * execution. As such, there are no read-side primitives analogous to
209 * rcu_read_lock() and rcu_read_unlock() because this primitive is intended
210 * to determine that all tasks have passed through a safe state, not so
211 * much for data-strcuture synchronization.
212 *
213 * See the description of call_rcu() for more detailed information on
214 * memory ordering guarantees.
215 */
216void call_rcu_tasks(struct rcu_head *head, void (*func)(struct rcu_head *head));
217void synchronize_rcu_tasks(void);
218void rcu_barrier_tasks(void);
219
200#ifdef CONFIG_PREEMPT_RCU 220#ifdef CONFIG_PREEMPT_RCU
201 221
202void __rcu_read_lock(void); 222void __rcu_read_lock(void);
@@ -238,8 +258,8 @@ static inline int rcu_preempt_depth(void)
238 258
239/* Internal to kernel */ 259/* Internal to kernel */
240void rcu_init(void); 260void rcu_init(void);
241void rcu_sched_qs(int cpu); 261void rcu_sched_qs(void);
242void rcu_bh_qs(int cpu); 262void rcu_bh_qs(void);
243void rcu_check_callbacks(int cpu, int user); 263void rcu_check_callbacks(int cpu, int user);
244struct notifier_block; 264struct notifier_block;
245void rcu_idle_enter(void); 265void rcu_idle_enter(void);
@@ -269,6 +289,14 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
269 struct task_struct *next) { } 289 struct task_struct *next) { }
270#endif /* CONFIG_RCU_USER_QS */ 290#endif /* CONFIG_RCU_USER_QS */
271 291
292#ifdef CONFIG_RCU_NOCB_CPU
293void rcu_init_nohz(void);
294#else /* #ifdef CONFIG_RCU_NOCB_CPU */
295static inline void rcu_init_nohz(void)
296{
297}
298#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
299
272/** 300/**
273 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers 301 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers
274 * @a: Code that RCU needs to pay attention to. 302 * @a: Code that RCU needs to pay attention to.
@@ -294,6 +322,36 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
294 rcu_irq_exit(); \ 322 rcu_irq_exit(); \
295 } while (0) 323 } while (0)
296 324
325/*
326 * Note a voluntary context switch for RCU-tasks benefit. This is a
327 * macro rather than an inline function to avoid #include hell.
328 */
329#ifdef CONFIG_TASKS_RCU
330#define TASKS_RCU(x) x
331extern struct srcu_struct tasks_rcu_exit_srcu;
332#define rcu_note_voluntary_context_switch(t) \
333 do { \
334 if (ACCESS_ONCE((t)->rcu_tasks_holdout)) \
335 ACCESS_ONCE((t)->rcu_tasks_holdout) = false; \
336 } while (0)
337#else /* #ifdef CONFIG_TASKS_RCU */
338#define TASKS_RCU(x) do { } while (0)
339#define rcu_note_voluntary_context_switch(t) do { } while (0)
340#endif /* #else #ifdef CONFIG_TASKS_RCU */
341
342/**
343 * cond_resched_rcu_qs - Report potential quiescent states to RCU
344 *
345 * This macro resembles cond_resched(), except that it is defined to
346 * report potential quiescent states to RCU-tasks even if the cond_resched()
347 * machinery were to be shut off, as some advocate for PREEMPT kernels.
348 */
349#define cond_resched_rcu_qs() \
350do { \
351 rcu_note_voluntary_context_switch(current); \
352 cond_resched(); \
353} while (0)
354
297#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) 355#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP)
298bool __rcu_is_watching(void); 356bool __rcu_is_watching(void);
299#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */ 357#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
@@ -349,7 +407,7 @@ bool rcu_lockdep_current_cpu_online(void);
349#else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ 407#else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
350static inline bool rcu_lockdep_current_cpu_online(void) 408static inline bool rcu_lockdep_current_cpu_online(void)
351{ 409{
352 return 1; 410 return true;
353} 411}
354#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ 412#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
355 413
@@ -371,41 +429,7 @@ extern struct lockdep_map rcu_sched_lock_map;
371extern struct lockdep_map rcu_callback_map; 429extern struct lockdep_map rcu_callback_map;
372int debug_lockdep_rcu_enabled(void); 430int debug_lockdep_rcu_enabled(void);
373 431
374/** 432int rcu_read_lock_held(void);
375 * rcu_read_lock_held() - might we be in RCU read-side critical section?
376 *
377 * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU
378 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC,
379 * this assumes we are in an RCU read-side critical section unless it can
380 * prove otherwise. This is useful for debug checks in functions that
381 * require that they be called within an RCU read-side critical section.
382 *
383 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
384 * and while lockdep is disabled.
385 *
386 * Note that rcu_read_lock() and the matching rcu_read_unlock() must
387 * occur in the same context, for example, it is illegal to invoke
388 * rcu_read_unlock() in process context if the matching rcu_read_lock()
389 * was invoked from within an irq handler.
390 *
391 * Note that rcu_read_lock() is disallowed if the CPU is either idle or
392 * offline from an RCU perspective, so check for those as well.
393 */
394static inline int rcu_read_lock_held(void)
395{
396 if (!debug_lockdep_rcu_enabled())
397 return 1;
398 if (!rcu_is_watching())
399 return 0;
400 if (!rcu_lockdep_current_cpu_online())
401 return 0;
402 return lock_is_held(&rcu_lock_map);
403}
404
405/*
406 * rcu_read_lock_bh_held() is defined out of line to avoid #include-file
407 * hell.
408 */
409int rcu_read_lock_bh_held(void); 433int rcu_read_lock_bh_held(void);
410 434
411/** 435/**
@@ -593,6 +617,21 @@ static inline void rcu_preempt_sleep_check(void)
593#define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v) 617#define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v)
594 618
595/** 619/**
620 * lockless_dereference() - safely load a pointer for later dereference
621 * @p: The pointer to load
622 *
623 * Similar to rcu_dereference(), but for situations where the pointed-to
624 * object's lifetime is managed by something other than RCU. That
625 * "something other" might be reference counting or simple immortality.
626 */
627#define lockless_dereference(p) \
628({ \
629 typeof(p) _________p1 = ACCESS_ONCE(p); \
630 smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
631 (_________p1); \
632})
633
634/**
596 * rcu_assign_pointer() - assign to RCU-protected pointer 635 * rcu_assign_pointer() - assign to RCU-protected pointer
597 * @p: pointer to assign to 636 * @p: pointer to assign to
598 * @v: value to assign (publish) 637 * @v: value to assign (publish)
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index d40a6a451330..38cc5b1e252d 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -80,7 +80,7 @@ static inline void kfree_call_rcu(struct rcu_head *head,
80 80
81static inline void rcu_note_context_switch(int cpu) 81static inline void rcu_note_context_switch(int cpu)
82{ 82{
83 rcu_sched_qs(cpu); 83 rcu_sched_qs();
84} 84}
85 85
86/* 86/*
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 48bf152761c7..67fc8fcdc4b0 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -38,6 +38,9 @@ extern int reboot_force;
38extern int register_reboot_notifier(struct notifier_block *); 38extern int register_reboot_notifier(struct notifier_block *);
39extern int unregister_reboot_notifier(struct notifier_block *); 39extern int unregister_reboot_notifier(struct notifier_block *);
40 40
41extern int register_restart_handler(struct notifier_block *);
42extern int unregister_restart_handler(struct notifier_block *);
43extern void do_kernel_restart(char *cmd);
41 44
42/* 45/*
43 * Architecture-specific implementations of sys_reboot commands. 46 * Architecture-specific implementations of sys_reboot commands.
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index f8a8733068a7..f540b1496e2f 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -35,6 +35,8 @@
35#ifndef __LINUX_REGULATOR_CONSUMER_H_ 35#ifndef __LINUX_REGULATOR_CONSUMER_H_
36#define __LINUX_REGULATOR_CONSUMER_H_ 36#define __LINUX_REGULATOR_CONSUMER_H_
37 37
38#include <linux/err.h>
39
38struct device; 40struct device;
39struct notifier_block; 41struct notifier_block;
40struct regmap; 42struct regmap;
@@ -93,7 +95,12 @@ struct regmap;
93 * OVER_TEMP Regulator over temp. 95 * OVER_TEMP Regulator over temp.
94 * FORCE_DISABLE Regulator forcibly shut down by software. 96 * FORCE_DISABLE Regulator forcibly shut down by software.
95 * VOLTAGE_CHANGE Regulator voltage changed. 97 * VOLTAGE_CHANGE Regulator voltage changed.
98 * Data passed is old voltage cast to (void *).
96 * DISABLE Regulator was disabled. 99 * DISABLE Regulator was disabled.
100 * PRE_VOLTAGE_CHANGE Regulator is about to have voltage changed.
101 * Data passed is "struct pre_voltage_change_data"
102 * ABORT_VOLTAGE_CHANGE Regulator voltage change failed for some reason.
103 * Data passed is old voltage cast to (void *).
97 * 104 *
98 * NOTE: These events can be OR'ed together when passed into handler. 105 * NOTE: These events can be OR'ed together when passed into handler.
99 */ 106 */
@@ -106,6 +113,21 @@ struct regmap;
106#define REGULATOR_EVENT_FORCE_DISABLE 0x20 113#define REGULATOR_EVENT_FORCE_DISABLE 0x20
107#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40 114#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40
108#define REGULATOR_EVENT_DISABLE 0x80 115#define REGULATOR_EVENT_DISABLE 0x80
116#define REGULATOR_EVENT_PRE_VOLTAGE_CHANGE 0x100
117#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x200
118
119/**
120 * struct pre_voltage_change_data - Data sent with PRE_VOLTAGE_CHANGE event
121 *
122 * @old_uV: Current voltage before change.
123 * @min_uV: Min voltage we'll change to.
124 * @max_uV: Max voltage we'll change to.
125 */
126struct pre_voltage_change_data {
127 unsigned long old_uV;
128 unsigned long min_uV;
129 unsigned long max_uV;
130};
109 131
110struct regulator; 132struct regulator;
111 133
diff --git a/include/linux/regulator/da9211.h b/include/linux/regulator/da9211.h
index 0981ce0e72cc..5479394fefce 100644
--- a/include/linux/regulator/da9211.h
+++ b/include/linux/regulator/da9211.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * da9211.h - Regulator device driver for DA9211 2 * da9211.h - Regulator device driver for DA9211/DA9213
3 * Copyright (C) 2014 Dialog Semiconductor Ltd. 3 * Copyright (C) 2014 Dialog Semiconductor Ltd.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
@@ -20,6 +20,11 @@
20 20
21#define DA9211_MAX_REGULATORS 2 21#define DA9211_MAX_REGULATORS 2
22 22
23enum da9211_chip_id {
24 DA9211,
25 DA9213,
26};
27
23struct da9211_pdata { 28struct da9211_pdata {
24 /* 29 /*
25 * Number of buck 30 * Number of buck
@@ -27,6 +32,6 @@ struct da9211_pdata {
27 * 2 : 2 phase 2 buck 32 * 2 : 2 phase 2 buck
28 */ 33 */
29 int num_buck; 34 int num_buck;
30 struct regulator_init_data *init_data; 35 struct regulator_init_data *init_data[DA9211_MAX_REGULATORS];
31}; 36};
32#endif 37#endif
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index bbe03a1924c0..fc0ee0ce8325 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -203,6 +203,8 @@ enum regulator_type {
203 * 203 *
204 * @name: Identifying name for the regulator. 204 * @name: Identifying name for the regulator.
205 * @supply_name: Identifying the regulator supply 205 * @supply_name: Identifying the regulator supply
206 * @of_match: Name used to identify regulator in DT.
207 * @regulators_node: Name of node containing regulator definitions in DT.
206 * @id: Numerical identifier for the regulator. 208 * @id: Numerical identifier for the regulator.
207 * @ops: Regulator operations table. 209 * @ops: Regulator operations table.
208 * @irq: Interrupt number for the regulator. 210 * @irq: Interrupt number for the regulator.
@@ -218,6 +220,8 @@ enum regulator_type {
218 * @linear_min_sel: Minimal selector for starting linear mapping 220 * @linear_min_sel: Minimal selector for starting linear mapping
219 * @fixed_uV: Fixed voltage of rails. 221 * @fixed_uV: Fixed voltage of rails.
220 * @ramp_delay: Time to settle down after voltage change (unit: uV/us) 222 * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
223 * @linear_ranges: A constant table of possible voltage ranges.
224 * @n_linear_ranges: Number of entries in the @linear_ranges table.
221 * @volt_table: Voltage mapping table (if table based mapping) 225 * @volt_table: Voltage mapping table (if table based mapping)
222 * 226 *
223 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ 227 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
@@ -238,14 +242,17 @@ enum regulator_type {
238 * @bypass_val_off: Disabling value for control when using regmap set_bypass 242 * @bypass_val_off: Disabling value for control when using regmap set_bypass
239 * 243 *
240 * @enable_time: Time taken for initial enable of regulator (in uS). 244 * @enable_time: Time taken for initial enable of regulator (in uS).
245 * @off_on_delay: guard time (in uS), before re-enabling a regulator
241 */ 246 */
242struct regulator_desc { 247struct regulator_desc {
243 const char *name; 248 const char *name;
244 const char *supply_name; 249 const char *supply_name;
250 const char *of_match;
251 const char *regulators_node;
245 int id; 252 int id;
246 bool continuous_voltage_range; 253 bool continuous_voltage_range;
247 unsigned n_voltages; 254 unsigned n_voltages;
248 struct regulator_ops *ops; 255 const struct regulator_ops *ops;
249 int irq; 256 int irq;
250 enum regulator_type type; 257 enum regulator_type type;
251 struct module *owner; 258 struct module *owner;
@@ -276,6 +283,8 @@ struct regulator_desc {
276 unsigned int bypass_val_off; 283 unsigned int bypass_val_off;
277 284
278 unsigned int enable_time; 285 unsigned int enable_time;
286
287 unsigned int off_on_delay;
279}; 288};
280 289
281/** 290/**
@@ -348,6 +357,9 @@ struct regulator_dev {
348 357
349 struct regulator_enable_gpio *ena_pin; 358 struct regulator_enable_gpio *ena_pin;
350 unsigned int ena_gpio_state:1; 359 unsigned int ena_gpio_state:1;
360
361 /* time when this regulator was disabled last time */
362 unsigned long last_off_jiffy;
351}; 363};
352 364
353struct regulator_dev * 365struct regulator_dev *
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 730e638c5589..0b08d05d470b 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -85,6 +85,7 @@ struct regulator_state {
85 * bootloader then it will be enabled when the constraints are 85 * bootloader then it will be enabled when the constraints are
86 * applied. 86 * applied.
87 * @apply_uV: Apply the voltage constraint when initialising. 87 * @apply_uV: Apply the voltage constraint when initialising.
88 * @ramp_disable: Disable ramp delay when initialising or when setting voltage.
88 * 89 *
89 * @input_uV: Input voltage for regulator when supplied by another regulator. 90 * @input_uV: Input voltage for regulator when supplied by another regulator.
90 * 91 *
diff --git a/include/linux/regulator/max1586.h b/include/linux/regulator/max1586.h
index de9a7fae20be..cedd0febe882 100644
--- a/include/linux/regulator/max1586.h
+++ b/include/linux/regulator/max1586.h
@@ -40,7 +40,7 @@
40 */ 40 */
41struct max1586_subdev_data { 41struct max1586_subdev_data {
42 int id; 42 int id;
43 char *name; 43 const char *name;
44 struct regulator_init_data *platform_data; 44 struct regulator_init_data *platform_data;
45}; 45};
46 46
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 9cda293c867d..fb298e9d6d3a 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -21,7 +21,7 @@
21#include <linux/rculist.h> 21#include <linux/rculist.h>
22 22
23struct rhash_head { 23struct rhash_head {
24 struct rhash_head *next; 24 struct rhash_head __rcu *next;
25}; 25};
26 26
27#define INIT_HASH_HEAD(ptr) ((ptr)->next = NULL) 27#define INIT_HASH_HEAD(ptr) ((ptr)->next = NULL)
@@ -44,6 +44,7 @@ struct rhashtable;
44 * @head_offset: Offset of rhash_head in struct to be hashed 44 * @head_offset: Offset of rhash_head in struct to be hashed
45 * @hash_rnd: Seed to use while hashing 45 * @hash_rnd: Seed to use while hashing
46 * @max_shift: Maximum number of shifts while expanding 46 * @max_shift: Maximum number of shifts while expanding
47 * @min_shift: Minimum number of shifts while shrinking
47 * @hashfn: Function to hash key 48 * @hashfn: Function to hash key
48 * @obj_hashfn: Function to hash object 49 * @obj_hashfn: Function to hash object
49 * @grow_decision: If defined, may return true if table should expand 50 * @grow_decision: If defined, may return true if table should expand
@@ -57,6 +58,7 @@ struct rhashtable_params {
57 size_t head_offset; 58 size_t head_offset;
58 u32 hash_rnd; 59 u32 hash_rnd;
59 size_t max_shift; 60 size_t max_shift;
61 size_t min_shift;
60 rht_hashfn_t hashfn; 62 rht_hashfn_t hashfn;
61 rht_obj_hashfn_t obj_hashfn; 63 rht_obj_hashfn_t obj_hashfn;
62 bool (*grow_decision)(const struct rhashtable *ht, 64 bool (*grow_decision)(const struct rhashtable *ht,
@@ -97,7 +99,7 @@ u32 rhashtable_obj_hashfn(const struct rhashtable *ht, void *ptr);
97void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node, gfp_t); 99void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node, gfp_t);
98bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node, gfp_t); 100bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node, gfp_t);
99void rhashtable_remove_pprev(struct rhashtable *ht, struct rhash_head *obj, 101void rhashtable_remove_pprev(struct rhashtable *ht, struct rhash_head *obj,
100 struct rhash_head **pprev, gfp_t flags); 102 struct rhash_head __rcu **pprev, gfp_t flags);
101 103
102bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size); 104bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size);
103bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size); 105bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size);
@@ -117,18 +119,12 @@ void rhashtable_destroy(const struct rhashtable *ht);
117#define rht_dereference_rcu(p, ht) \ 119#define rht_dereference_rcu(p, ht) \
118 rcu_dereference_check(p, lockdep_rht_mutex_is_held(ht)) 120 rcu_dereference_check(p, lockdep_rht_mutex_is_held(ht))
119 121
120/* Internal, use rht_obj() instead */
121#define rht_entry(ptr, type, member) container_of(ptr, type, member) 122#define rht_entry(ptr, type, member) container_of(ptr, type, member)
122#define rht_entry_safe(ptr, type, member) \ 123#define rht_entry_safe(ptr, type, member) \
123({ \ 124({ \
124 typeof(ptr) __ptr = (ptr); \ 125 typeof(ptr) __ptr = (ptr); \
125 __ptr ? rht_entry(__ptr, type, member) : NULL; \ 126 __ptr ? rht_entry(__ptr, type, member) : NULL; \
126}) 127})
127#define rht_entry_safe_rcu(ptr, type, member) \
128({ \
129 typeof(*ptr) __rcu *__ptr = (typeof(*ptr) __rcu __force *)ptr; \
130 __ptr ? container_of((typeof(ptr))rcu_dereference_raw(__ptr), type, member) : NULL; \
131})
132 128
133#define rht_next_entry_safe(pos, ht, member) \ 129#define rht_next_entry_safe(pos, ht, member) \
134({ \ 130({ \
@@ -205,9 +201,10 @@ void rhashtable_destroy(const struct rhashtable *ht);
205 * traversal is guarded by rcu_read_lock(). 201 * traversal is guarded by rcu_read_lock().
206 */ 202 */
207#define rht_for_each_entry_rcu(pos, head, member) \ 203#define rht_for_each_entry_rcu(pos, head, member) \
208 for (pos = rht_entry_safe_rcu(head, typeof(*(pos)), member); \ 204 for (pos = rht_entry_safe(rcu_dereference_raw(head), \
205 typeof(*(pos)), member); \
209 pos; \ 206 pos; \
210 pos = rht_entry_safe_rcu((pos)->member.next, \ 207 pos = rht_entry_safe(rcu_dereference_raw((pos)->member.next), \
211 typeof(*(pos)), member)) 208 typeof(*(pos)), member))
212 209
213#endif /* _LINUX_RHASHTABLE_H */ 210#endif /* _LINUX_RHASHTABLE_H */
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 49a4d6f59108..e2c13cd863bd 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -97,7 +97,7 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k
97 __ring_buffer_alloc((size), (flags), &__key); \ 97 __ring_buffer_alloc((size), (flags), &__key); \
98}) 98})
99 99
100int ring_buffer_wait(struct ring_buffer *buffer, int cpu); 100int ring_buffer_wait(struct ring_buffer *buffer, int cpu, bool full);
101int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, 101int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu,
102 struct file *filp, poll_table *poll_table); 102 struct file *filp, poll_table *poll_table);
103 103
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 5059994fe297..9fc2f213e74f 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -384,11 +384,16 @@ void rio_dev_put(struct rio_dev *);
384 384
385#ifdef CONFIG_RAPIDIO_DMA_ENGINE 385#ifdef CONFIG_RAPIDIO_DMA_ENGINE
386extern struct dma_chan *rio_request_dma(struct rio_dev *rdev); 386extern struct dma_chan *rio_request_dma(struct rio_dev *rdev);
387extern struct dma_chan *rio_request_mport_dma(struct rio_mport *mport);
387extern void rio_release_dma(struct dma_chan *dchan); 388extern void rio_release_dma(struct dma_chan *dchan);
388extern struct dma_async_tx_descriptor *rio_dma_prep_slave_sg( 389extern struct dma_async_tx_descriptor *rio_dma_prep_slave_sg(
389 struct rio_dev *rdev, struct dma_chan *dchan, 390 struct rio_dev *rdev, struct dma_chan *dchan,
390 struct rio_dma_data *data, 391 struct rio_dma_data *data,
391 enum dma_transfer_direction direction, unsigned long flags); 392 enum dma_transfer_direction direction, unsigned long flags);
393extern struct dma_async_tx_descriptor *rio_dma_prep_xfer(
394 struct dma_chan *dchan, u16 destid,
395 struct rio_dma_data *data,
396 enum dma_transfer_direction direction, unsigned long flags);
392#endif 397#endif
393 398
394/** 399/**
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index be574506e6a9..c0c2bce6b0b7 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -150,7 +150,7 @@ int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *);
150static inline void anon_vma_merge(struct vm_area_struct *vma, 150static inline void anon_vma_merge(struct vm_area_struct *vma,
151 struct vm_area_struct *next) 151 struct vm_area_struct *next)
152{ 152{
153 VM_BUG_ON(vma->anon_vma != next->anon_vma); 153 VM_BUG_ON_VMA(vma->anon_vma != next->anon_vma, vma);
154 unlink_anon_vmas(next); 154 unlink_anon_vmas(next);
155} 155}
156 156
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 167bae7bdfa4..6cacbce1a06c 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -47,6 +47,16 @@ static inline int lockdep_rtnl_is_held(void)
47 rcu_dereference_check(p, lockdep_rtnl_is_held()) 47 rcu_dereference_check(p, lockdep_rtnl_is_held())
48 48
49/** 49/**
50 * rcu_dereference_bh_rtnl - rcu_dereference_bh with debug checking
51 * @p: The pointer to read, prior to dereference
52 *
53 * Do an rcu_dereference_bh(p), but check caller either holds rcu_read_lock_bh()
54 * or RTNL. Note : Please prefer rtnl_dereference() or rcu_dereference_bh()
55 */
56#define rcu_dereference_bh_rtnl(p) \
57 rcu_dereference_bh_check(p, lockdep_rtnl_is_held())
58
59/**
50 * rtnl_dereference - fetch RCU pointer when updates are prevented by RTNL 60 * rtnl_dereference - fetch RCU pointer when updates are prevented by RTNL
51 * @p: The pointer to read, prior to dereferencing 61 * @p: The pointer to read, prior to dereferencing
52 * 62 *
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 035d3c57fc8a..8f498cdde280 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -149,7 +149,7 @@ extern void downgrade_write(struct rw_semaphore *sem);
149 * static then another method for expressing nested locking is 149 * static then another method for expressing nested locking is
150 * the explicit definition of lock class keys and the use of 150 * the explicit definition of lock class keys and the use of
151 * lockdep_set_class() at lock initialization time. 151 * lockdep_set_class() at lock initialization time.
152 * See Documentation/lockdep-design.txt for more details.) 152 * See Documentation/locking/lockdep-design.txt for more details.)
153 */ 153 */
154extern void down_read_nested(struct rw_semaphore *sem, int subclass); 154extern void down_read_nested(struct rw_semaphore *sem, int subclass);
155extern void down_write_nested(struct rw_semaphore *sem, int subclass); 155extern void down_write_nested(struct rw_semaphore *sem, int subclass);
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index f4ec8bbcb372..ed8f9e70df9b 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -136,7 +136,7 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
136static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents, 136static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
137 struct scatterlist *sgl) 137 struct scatterlist *sgl)
138{ 138{
139#ifndef ARCH_HAS_SG_CHAIN 139#ifndef CONFIG_ARCH_HAS_SG_CHAIN
140 BUG(); 140 BUG();
141#endif 141#endif
142 142
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7c19d552dc3f..5e344bbe63ec 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -33,6 +33,7 @@ struct sched_param {
33 33
34#include <linux/smp.h> 34#include <linux/smp.h>
35#include <linux/sem.h> 35#include <linux/sem.h>
36#include <linux/shm.h>
36#include <linux/signal.h> 37#include <linux/signal.h>
37#include <linux/compiler.h> 38#include <linux/compiler.h>
38#include <linux/completion.h> 39#include <linux/completion.h>
@@ -56,6 +57,7 @@ struct sched_param {
56#include <linux/llist.h> 57#include <linux/llist.h>
57#include <linux/uidgid.h> 58#include <linux/uidgid.h>
58#include <linux/gfp.h> 59#include <linux/gfp.h>
60#include <linux/magic.h>
59 61
60#include <asm/processor.h> 62#include <asm/processor.h>
61 63
@@ -166,10 +168,10 @@ extern int nr_threads;
166DECLARE_PER_CPU(unsigned long, process_counts); 168DECLARE_PER_CPU(unsigned long, process_counts);
167extern int nr_processes(void); 169extern int nr_processes(void);
168extern unsigned long nr_running(void); 170extern unsigned long nr_running(void);
171extern bool single_task_running(void);
169extern unsigned long nr_iowait(void); 172extern unsigned long nr_iowait(void);
170extern unsigned long nr_iowait_cpu(int cpu); 173extern unsigned long nr_iowait_cpu(int cpu);
171extern unsigned long this_cpu_load(void); 174extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load);
172
173 175
174extern void calc_global_load(unsigned long ticks); 176extern void calc_global_load(unsigned long ticks);
175extern void update_cpu_load_nohz(void); 177extern void update_cpu_load_nohz(void);
@@ -645,6 +647,7 @@ struct signal_struct {
645 * Live threads maintain their own counters and add to these 647 * Live threads maintain their own counters and add to these
646 * in __exit_signal, except for the group leader. 648 * in __exit_signal, except for the group leader.
647 */ 649 */
650 seqlock_t stats_lock;
648 cputime_t utime, stime, cutime, cstime; 651 cputime_t utime, stime, cutime, cstime;
649 cputime_t gtime; 652 cputime_t gtime;
650 cputime_t cgtime; 653 cputime_t cgtime;
@@ -1023,6 +1026,7 @@ struct sched_domain_topology_level {
1023extern struct sched_domain_topology_level *sched_domain_topology; 1026extern struct sched_domain_topology_level *sched_domain_topology;
1024 1027
1025extern void set_sched_topology(struct sched_domain_topology_level *tl); 1028extern void set_sched_topology(struct sched_domain_topology_level *tl);
1029extern void wake_up_if_idle(int cpu);
1026 1030
1027#ifdef CONFIG_SCHED_DEBUG 1031#ifdef CONFIG_SCHED_DEBUG
1028# define SD_INIT_NAME(type) .name = #type 1032# define SD_INIT_NAME(type) .name = #type
@@ -1212,6 +1216,13 @@ struct sched_dl_entity {
1212 struct hrtimer dl_timer; 1216 struct hrtimer dl_timer;
1213}; 1217};
1214 1218
1219union rcu_special {
1220 struct {
1221 bool blocked;
1222 bool need_qs;
1223 } b;
1224 short s;
1225};
1215struct rcu_node; 1226struct rcu_node;
1216 1227
1217enum perf_event_task_context { 1228enum perf_event_task_context {
@@ -1264,12 +1275,18 @@ struct task_struct {
1264 1275
1265#ifdef CONFIG_PREEMPT_RCU 1276#ifdef CONFIG_PREEMPT_RCU
1266 int rcu_read_lock_nesting; 1277 int rcu_read_lock_nesting;
1267 char rcu_read_unlock_special; 1278 union rcu_special rcu_read_unlock_special;
1268 struct list_head rcu_node_entry; 1279 struct list_head rcu_node_entry;
1269#endif /* #ifdef CONFIG_PREEMPT_RCU */ 1280#endif /* #ifdef CONFIG_PREEMPT_RCU */
1270#ifdef CONFIG_TREE_PREEMPT_RCU 1281#ifdef CONFIG_TREE_PREEMPT_RCU
1271 struct rcu_node *rcu_blocked_node; 1282 struct rcu_node *rcu_blocked_node;
1272#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ 1283#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
1284#ifdef CONFIG_TASKS_RCU
1285 unsigned long rcu_tasks_nvcsw;
1286 bool rcu_tasks_holdout;
1287 struct list_head rcu_tasks_holdout_list;
1288 int rcu_tasks_idle_cpu;
1289#endif /* #ifdef CONFIG_TASKS_RCU */
1273 1290
1274#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 1291#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
1275 struct sched_info sched_info; 1292 struct sched_info sched_info;
@@ -1385,6 +1402,7 @@ struct task_struct {
1385#ifdef CONFIG_SYSVIPC 1402#ifdef CONFIG_SYSVIPC
1386/* ipc stuff */ 1403/* ipc stuff */
1387 struct sysv_sem sysvsem; 1404 struct sysv_sem sysvsem;
1405 struct sysv_shm sysvshm;
1388#endif 1406#endif
1389#ifdef CONFIG_DETECT_HUNG_TASK 1407#ifdef CONFIG_DETECT_HUNG_TASK
1390/* hung task detection */ 1408/* hung task detection */
@@ -1628,12 +1646,6 @@ struct task_struct {
1628 unsigned long trace_recursion; 1646 unsigned long trace_recursion;
1629#endif /* CONFIG_TRACING */ 1647#endif /* CONFIG_TRACING */
1630#ifdef CONFIG_MEMCG /* memcg uses this to do batch job */ 1648#ifdef CONFIG_MEMCG /* memcg uses this to do batch job */
1631 struct memcg_batch_info {
1632 int do_batch; /* incremented when batch uncharge started */
1633 struct mem_cgroup *memcg; /* target memcg of uncharge */
1634 unsigned long nr_pages; /* uncharged usage */
1635 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */
1636 } memcg_batch;
1637 unsigned int memcg_kmem_skip_account; 1649 unsigned int memcg_kmem_skip_account;
1638 struct memcg_oom_info { 1650 struct memcg_oom_info {
1639 struct mem_cgroup *memcg; 1651 struct mem_cgroup *memcg;
@@ -1908,8 +1920,6 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1908#define PF_KTHREAD 0x00200000 /* I am a kernel thread */ 1920#define PF_KTHREAD 0x00200000 /* I am a kernel thread */
1909#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ 1921#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */
1910#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ 1922#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */
1911#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */
1912#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
1913#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */ 1923#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */
1914#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ 1924#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
1915#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1925#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
@@ -1941,11 +1951,13 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1941#define tsk_used_math(p) ((p)->flags & PF_USED_MATH) 1951#define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
1942#define used_math() tsk_used_math(current) 1952#define used_math() tsk_used_math(current)
1943 1953
1944/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags */ 1954/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags
1955 * __GFP_FS is also cleared as it implies __GFP_IO.
1956 */
1945static inline gfp_t memalloc_noio_flags(gfp_t flags) 1957static inline gfp_t memalloc_noio_flags(gfp_t flags)
1946{ 1958{
1947 if (unlikely(current->flags & PF_MEMALLOC_NOIO)) 1959 if (unlikely(current->flags & PF_MEMALLOC_NOIO))
1948 flags &= ~__GFP_IO; 1960 flags &= ~(__GFP_IO | __GFP_FS);
1949 return flags; 1961 return flags;
1950} 1962}
1951 1963
@@ -1962,17 +1974,31 @@ static inline void memalloc_noio_restore(unsigned int flags)
1962} 1974}
1963 1975
1964/* Per-process atomic flags. */ 1976/* Per-process atomic flags. */
1965#define PFA_NO_NEW_PRIVS 0x00000001 /* May not gain new privileges. */ 1977#define PFA_NO_NEW_PRIVS 0 /* May not gain new privileges. */
1978#define PFA_SPREAD_PAGE 1 /* Spread page cache over cpuset */
1979#define PFA_SPREAD_SLAB 2 /* Spread some slab caches over cpuset */
1966 1980
1967static inline bool task_no_new_privs(struct task_struct *p)
1968{
1969 return test_bit(PFA_NO_NEW_PRIVS, &p->atomic_flags);
1970}
1971 1981
1972static inline void task_set_no_new_privs(struct task_struct *p) 1982#define TASK_PFA_TEST(name, func) \
1973{ 1983 static inline bool task_##func(struct task_struct *p) \
1974 set_bit(PFA_NO_NEW_PRIVS, &p->atomic_flags); 1984 { return test_bit(PFA_##name, &p->atomic_flags); }
1975} 1985#define TASK_PFA_SET(name, func) \
1986 static inline void task_set_##func(struct task_struct *p) \
1987 { set_bit(PFA_##name, &p->atomic_flags); }
1988#define TASK_PFA_CLEAR(name, func) \
1989 static inline void task_clear_##func(struct task_struct *p) \
1990 { clear_bit(PFA_##name, &p->atomic_flags); }
1991
1992TASK_PFA_TEST(NO_NEW_PRIVS, no_new_privs)
1993TASK_PFA_SET(NO_NEW_PRIVS, no_new_privs)
1994
1995TASK_PFA_TEST(SPREAD_PAGE, spread_page)
1996TASK_PFA_SET(SPREAD_PAGE, spread_page)
1997TASK_PFA_CLEAR(SPREAD_PAGE, spread_page)
1998
1999TASK_PFA_TEST(SPREAD_SLAB, spread_slab)
2000TASK_PFA_SET(SPREAD_SLAB, spread_slab)
2001TASK_PFA_CLEAR(SPREAD_SLAB, spread_slab)
1976 2002
1977/* 2003/*
1978 * task->jobctl flags 2004 * task->jobctl flags
@@ -2004,29 +2030,21 @@ extern void task_clear_jobctl_trapping(struct task_struct *task);
2004extern void task_clear_jobctl_pending(struct task_struct *task, 2030extern void task_clear_jobctl_pending(struct task_struct *task,
2005 unsigned int mask); 2031 unsigned int mask);
2006 2032
2007#ifdef CONFIG_PREEMPT_RCU
2008
2009#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */
2010#define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */
2011
2012static inline void rcu_copy_process(struct task_struct *p) 2033static inline void rcu_copy_process(struct task_struct *p)
2013{ 2034{
2035#ifdef CONFIG_PREEMPT_RCU
2014 p->rcu_read_lock_nesting = 0; 2036 p->rcu_read_lock_nesting = 0;
2015 p->rcu_read_unlock_special = 0; 2037 p->rcu_read_unlock_special.s = 0;
2016#ifdef CONFIG_TREE_PREEMPT_RCU
2017 p->rcu_blocked_node = NULL; 2038 p->rcu_blocked_node = NULL;
2018#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
2019 INIT_LIST_HEAD(&p->rcu_node_entry); 2039 INIT_LIST_HEAD(&p->rcu_node_entry);
2040#endif /* #ifdef CONFIG_PREEMPT_RCU */
2041#ifdef CONFIG_TASKS_RCU
2042 p->rcu_tasks_holdout = false;
2043 INIT_LIST_HEAD(&p->rcu_tasks_holdout_list);
2044 p->rcu_tasks_idle_cpu = -1;
2045#endif /* #ifdef CONFIG_TASKS_RCU */
2020} 2046}
2021 2047
2022#else
2023
2024static inline void rcu_copy_process(struct task_struct *p)
2025{
2026}
2027
2028#endif
2029
2030static inline void tsk_restore_flags(struct task_struct *task, 2048static inline void tsk_restore_flags(struct task_struct *task,
2031 unsigned long orig_flags, unsigned long flags) 2049 unsigned long orig_flags, unsigned long flags)
2032{ 2050{
@@ -2364,8 +2382,10 @@ static inline int on_sig_stack(unsigned long sp)
2364 2382
2365static inline int sas_ss_flags(unsigned long sp) 2383static inline int sas_ss_flags(unsigned long sp)
2366{ 2384{
2367 return (current->sas_ss_size == 0 ? SS_DISABLE 2385 if (!current->sas_ss_size)
2368 : on_sig_stack(sp) ? SS_ONSTACK : 0); 2386 return SS_DISABLE;
2387
2388 return on_sig_stack(sp) ? SS_ONSTACK : 0;
2369} 2389}
2370 2390
2371static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig) 2391static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig)
@@ -2611,12 +2631,27 @@ static inline void setup_thread_stack(struct task_struct *p, struct task_struct
2611 task_thread_info(p)->task = p; 2631 task_thread_info(p)->task = p;
2612} 2632}
2613 2633
2634/*
2635 * Return the address of the last usable long on the stack.
2636 *
2637 * When the stack grows down, this is just above the thread
2638 * info struct. Going any lower will corrupt the threadinfo.
2639 *
2640 * When the stack grows up, this is the highest address.
2641 * Beyond that position, we corrupt data on the next page.
2642 */
2614static inline unsigned long *end_of_stack(struct task_struct *p) 2643static inline unsigned long *end_of_stack(struct task_struct *p)
2615{ 2644{
2645#ifdef CONFIG_STACK_GROWSUP
2646 return (unsigned long *)((unsigned long)task_thread_info(p) + THREAD_SIZE) - 1;
2647#else
2616 return (unsigned long *)(task_thread_info(p) + 1); 2648 return (unsigned long *)(task_thread_info(p) + 1);
2649#endif
2617} 2650}
2618 2651
2619#endif 2652#endif
2653#define task_stack_end_corrupted(task) \
2654 (*(end_of_stack(task)) != STACK_END_MAGIC)
2620 2655
2621static inline int object_is_on_stack(void *obj) 2656static inline int object_is_on_stack(void *obj)
2622{ 2657{
@@ -2639,6 +2674,7 @@ static inline unsigned long stack_not_used(struct task_struct *p)
2639 return (unsigned long)n - (unsigned long)end_of_stack(p); 2674 return (unsigned long)n - (unsigned long)end_of_stack(p);
2640} 2675}
2641#endif 2676#endif
2677extern void set_task_stack_end_magic(struct task_struct *tsk);
2642 2678
2643/* set thread flags in other task's structures 2679/* set thread flags in other task's structures
2644 * - see asm/thread_info.h for TIF_xxxx flags available 2680 * - see asm/thread_info.h for TIF_xxxx flags available
@@ -2967,15 +3003,10 @@ static inline void inc_syscw(struct task_struct *tsk)
2967 3003
2968#ifdef CONFIG_MEMCG 3004#ifdef CONFIG_MEMCG
2969extern void mm_update_next_owner(struct mm_struct *mm); 3005extern void mm_update_next_owner(struct mm_struct *mm);
2970extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p);
2971#else 3006#else
2972static inline void mm_update_next_owner(struct mm_struct *mm) 3007static inline void mm_update_next_owner(struct mm_struct *mm)
2973{ 3008{
2974} 3009}
2975
2976static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
2977{
2978}
2979#endif /* CONFIG_MEMCG */ 3010#endif /* CONFIG_MEMCG */
2980 3011
2981static inline unsigned long task_rlimit(const struct task_struct *tsk, 3012static inline unsigned long task_rlimit(const struct task_struct *tsk,
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index 005bf3e38db5..f0f8bad54be9 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -5,12 +5,4 @@
5 5
6extern struct screen_info screen_info; 6extern struct screen_info screen_info;
7 7
8#define ORIG_X (screen_info.orig_x)
9#define ORIG_Y (screen_info.orig_y)
10#define ORIG_VIDEO_MODE (screen_info.orig_video_mode)
11#define ORIG_VIDEO_COLS (screen_info.orig_video_cols)
12#define ORIG_VIDEO_EGA_BX (screen_info.orig_video_ega_bx)
13#define ORIG_VIDEO_LINES (screen_info.orig_video_lines)
14#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA)
15#define ORIG_VIDEO_POINTS (screen_info.orig_video_points)
16#endif /* _SCREEN_INFO_H */ 8#endif /* _SCREEN_INFO_H */
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 5d586a45a319..a19ddacdac30 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -27,19 +27,23 @@ struct seccomp {
27 struct seccomp_filter *filter; 27 struct seccomp_filter *filter;
28}; 28};
29 29
30extern int __secure_computing(int); 30#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
31static inline int secure_computing(int this_syscall) 31extern int __secure_computing(void);
32static inline int secure_computing(void)
32{ 33{
33 if (unlikely(test_thread_flag(TIF_SECCOMP))) 34 if (unlikely(test_thread_flag(TIF_SECCOMP)))
34 return __secure_computing(this_syscall); 35 return __secure_computing();
35 return 0; 36 return 0;
36} 37}
37 38
38/* A wrapper for architectures supporting only SECCOMP_MODE_STRICT. */ 39#define SECCOMP_PHASE1_OK 0
39static inline void secure_computing_strict(int this_syscall) 40#define SECCOMP_PHASE1_SKIP 1
40{ 41
41 BUG_ON(secure_computing(this_syscall) != 0); 42extern u32 seccomp_phase1(struct seccomp_data *sd);
42} 43int seccomp_phase2(u32 phase1_result);
44#else
45extern void secure_computing_strict(int this_syscall);
46#endif
43 47
44extern long prctl_get_seccomp(void); 48extern long prctl_get_seccomp(void);
45extern long prctl_set_seccomp(unsigned long, char __user *); 49extern long prctl_set_seccomp(unsigned long, char __user *);
@@ -56,8 +60,11 @@ static inline int seccomp_mode(struct seccomp *s)
56struct seccomp { }; 60struct seccomp { };
57struct seccomp_filter { }; 61struct seccomp_filter { };
58 62
59static inline int secure_computing(int this_syscall) { return 0; } 63#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
64static inline int secure_computing(void) { return 0; }
65#else
60static inline void secure_computing_strict(int this_syscall) { return; } 66static inline void secure_computing_strict(int this_syscall) { return; }
67#endif
61 68
62static inline long prctl_get_seccomp(void) 69static inline long prctl_get_seccomp(void)
63{ 70{
diff --git a/include/linux/security.h b/include/linux/security.h
index 623f90e5f38d..ba96471c11ba 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1559,7 +1559,7 @@ struct security_operations {
1559 int (*file_lock) (struct file *file, unsigned int cmd); 1559 int (*file_lock) (struct file *file, unsigned int cmd);
1560 int (*file_fcntl) (struct file *file, unsigned int cmd, 1560 int (*file_fcntl) (struct file *file, unsigned int cmd,
1561 unsigned long arg); 1561 unsigned long arg);
1562 int (*file_set_fowner) (struct file *file); 1562 void (*file_set_fowner) (struct file *file);
1563 int (*file_send_sigiotask) (struct task_struct *tsk, 1563 int (*file_send_sigiotask) (struct task_struct *tsk,
1564 struct fown_struct *fown, int sig); 1564 struct fown_struct *fown, int sig);
1565 int (*file_receive) (struct file *file); 1565 int (*file_receive) (struct file *file);
@@ -1834,7 +1834,7 @@ int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
1834 unsigned long prot); 1834 unsigned long prot);
1835int security_file_lock(struct file *file, unsigned int cmd); 1835int security_file_lock(struct file *file, unsigned int cmd);
1836int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg); 1836int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
1837int security_file_set_fowner(struct file *file); 1837void security_file_set_fowner(struct file *file);
1838int security_file_send_sigiotask(struct task_struct *tsk, 1838int security_file_send_sigiotask(struct task_struct *tsk,
1839 struct fown_struct *fown, int sig); 1839 struct fown_struct *fown, int sig);
1840int security_file_receive(struct file *file); 1840int security_file_receive(struct file *file);
@@ -2108,7 +2108,7 @@ static inline int security_dentry_init_security(struct dentry *dentry,
2108static inline int security_inode_init_security(struct inode *inode, 2108static inline int security_inode_init_security(struct inode *inode,
2109 struct inode *dir, 2109 struct inode *dir,
2110 const struct qstr *qstr, 2110 const struct qstr *qstr,
2111 const initxattrs initxattrs, 2111 const initxattrs xattrs,
2112 void *fs_data) 2112 void *fs_data)
2113{ 2113{
2114 return 0; 2114 return 0;
@@ -2312,9 +2312,9 @@ static inline int security_file_fcntl(struct file *file, unsigned int cmd,
2312 return 0; 2312 return 0;
2313} 2313}
2314 2314
2315static inline int security_file_set_fowner(struct file *file) 2315static inline void security_file_set_fowner(struct file *file)
2316{ 2316{
2317 return 0; 2317 return;
2318} 2318}
2319 2319
2320static inline int security_file_send_sigiotask(struct task_struct *tsk, 2320static inline int security_file_send_sigiotask(struct task_struct *tsk,
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index cc359636cfa3..f5df8f687b4d 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -456,4 +456,23 @@ read_sequnlock_excl_irqrestore(seqlock_t *sl, unsigned long flags)
456 spin_unlock_irqrestore(&sl->lock, flags); 456 spin_unlock_irqrestore(&sl->lock, flags);
457} 457}
458 458
459static inline unsigned long
460read_seqbegin_or_lock_irqsave(seqlock_t *lock, int *seq)
461{
462 unsigned long flags = 0;
463
464 if (!(*seq & 1)) /* Even */
465 *seq = read_seqbegin(lock);
466 else /* Odd */
467 read_seqlock_excl_irqsave(lock, flags);
468
469 return flags;
470}
471
472static inline void
473done_seqretry_irqrestore(seqlock_t *lock, int seq, unsigned long flags)
474{
475 if (seq & 1)
476 read_sequnlock_excl_irqrestore(lock, flags);
477}
459#endif /* __LINUX_SEQLOCK_H */ 478#endif /* __LINUX_SEQLOCK_H */
diff --git a/include/linux/seqno-fence.h b/include/linux/seqno-fence.h
index 3d6003de4b0d..a1ba6a5ccdd6 100644
--- a/include/linux/seqno-fence.h
+++ b/include/linux/seqno-fence.h
@@ -62,6 +62,7 @@ to_seqno_fence(struct fence *fence)
62 * @context: the execution context this fence is a part of 62 * @context: the execution context this fence is a part of
63 * @seqno_ofs: the offset within @sync_buf 63 * @seqno_ofs: the offset within @sync_buf
64 * @seqno: the sequence # to signal on 64 * @seqno: the sequence # to signal on
65 * @cond: fence wait condition
65 * @ops: the fence_ops for operations on this seqno fence 66 * @ops: the fence_ops for operations on this seqno fence
66 * 67 *
67 * This function initializes a struct seqno_fence with passed parameters, 68 * This function initializes a struct seqno_fence with passed parameters,
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index f93649e22c43..3df10d5f154b 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -84,6 +84,7 @@ struct uart_8250_port {
84 unsigned char mcr_mask; /* mask of user bits */ 84 unsigned char mcr_mask; /* mask of user bits */
85 unsigned char mcr_force; /* mask of forced bits */ 85 unsigned char mcr_force; /* mask of forced bits */
86 unsigned char cur_iotype; /* Running I/O type */ 86 unsigned char cur_iotype; /* Running I/O type */
87 unsigned int rpm_tx_active;
87 88
88 /* 89 /*
89 * Some bits in registers are cleared on a read, so they must 90 * Some bits in registers are cleared on a read, so they must
@@ -96,10 +97,13 @@ struct uart_8250_port {
96 unsigned char msr_saved_flags; 97 unsigned char msr_saved_flags;
97 98
98 struct uart_8250_dma *dma; 99 struct uart_8250_dma *dma;
100 struct serial_rs485 rs485;
99 101
100 /* 8250 specific callbacks */ 102 /* 8250 specific callbacks */
101 int (*dl_read)(struct uart_8250_port *); 103 int (*dl_read)(struct uart_8250_port *);
102 void (*dl_write)(struct uart_8250_port *, int); 104 void (*dl_write)(struct uart_8250_port *, int);
105 int (*rs485_config)(struct uart_8250_port *,
106 struct serial_rs485 *rs485);
103}; 107};
104 108
105static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up) 109static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up)
@@ -121,6 +125,8 @@ extern void serial8250_early_out(struct uart_port *port, int offset, int value);
121extern int setup_early_serial8250_console(char *cmdline); 125extern int setup_early_serial8250_console(char *cmdline);
122extern void serial8250_do_set_termios(struct uart_port *port, 126extern void serial8250_do_set_termios(struct uart_port *port,
123 struct ktermios *termios, struct ktermios *old); 127 struct ktermios *termios, struct ktermios *old);
128extern int serial8250_do_startup(struct uart_port *port);
129extern void serial8250_do_shutdown(struct uart_port *port);
124extern void serial8250_do_pm(struct uart_port *port, unsigned int state, 130extern void serial8250_do_pm(struct uart_port *port, unsigned int state,
125 unsigned int oldstate); 131 unsigned int oldstate);
126extern int fsl8250_handle_irq(struct uart_port *port); 132extern int fsl8250_handle_irq(struct uart_port *port);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index cf3a1e789bf5..21c2e05c1bc3 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -112,6 +112,7 @@ struct uart_icount {
112}; 112};
113 113
114typedef unsigned int __bitwise__ upf_t; 114typedef unsigned int __bitwise__ upf_t;
115typedef unsigned int __bitwise__ upstat_t;
115 116
116struct uart_port { 117struct uart_port {
117 spinlock_t lock; /* port lock */ 118 spinlock_t lock; /* port lock */
@@ -122,6 +123,10 @@ struct uart_port {
122 void (*set_termios)(struct uart_port *, 123 void (*set_termios)(struct uart_port *,
123 struct ktermios *new, 124 struct ktermios *new,
124 struct ktermios *old); 125 struct ktermios *old);
126 int (*startup)(struct uart_port *port);
127 void (*shutdown)(struct uart_port *port);
128 void (*throttle)(struct uart_port *port);
129 void (*unthrottle)(struct uart_port *port);
125 int (*handle_irq)(struct uart_port *); 130 int (*handle_irq)(struct uart_port *);
126 void (*pm)(struct uart_port *, unsigned int state, 131 void (*pm)(struct uart_port *, unsigned int state,
127 unsigned int old); 132 unsigned int old);
@@ -152,6 +157,7 @@ struct uart_port {
152 unsigned long sysrq; /* sysrq timeout */ 157 unsigned long sysrq; /* sysrq timeout */
153#endif 158#endif
154 159
160 /* flags must be updated while holding port mutex */
155 upf_t flags; 161 upf_t flags;
156 162
157#define UPF_FOURPORT ((__force upf_t) (1 << 1)) 163#define UPF_FOURPORT ((__force upf_t) (1 << 1))
@@ -187,6 +193,13 @@ struct uart_port {
187#define UPF_CHANGE_MASK ((__force upf_t) (0x17fff)) 193#define UPF_CHANGE_MASK ((__force upf_t) (0x17fff))
188#define UPF_USR_MASK ((__force upf_t) (UPF_SPD_MASK|UPF_LOW_LATENCY)) 194#define UPF_USR_MASK ((__force upf_t) (UPF_SPD_MASK|UPF_LOW_LATENCY))
189 195
196 /* status must be updated while holding port lock */
197 upstat_t status;
198
199#define UPSTAT_CTS_ENABLE ((__force upstat_t) (1 << 0))
200#define UPSTAT_DCD_ENABLE ((__force upstat_t) (1 << 1))
201
202 int hw_stopped; /* sw-assisted CTS flow state */
190 unsigned int mctrl; /* current modem ctrl settings */ 203 unsigned int mctrl; /* current modem ctrl settings */
191 unsigned int timeout; /* character-based timeout */ 204 unsigned int timeout; /* character-based timeout */
192 unsigned int type; /* port type */ 205 unsigned int type; /* port type */
@@ -347,11 +360,16 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
347static inline int uart_tx_stopped(struct uart_port *port) 360static inline int uart_tx_stopped(struct uart_port *port)
348{ 361{
349 struct tty_struct *tty = port->state->port.tty; 362 struct tty_struct *tty = port->state->port.tty;
350 if(tty->stopped || tty->hw_stopped) 363 if (tty->stopped || port->hw_stopped)
351 return 1; 364 return 1;
352 return 0; 365 return 0;
353} 366}
354 367
368static inline bool uart_cts_enabled(struct uart_port *uport)
369{
370 return uport->status & UPSTAT_CTS_ENABLE;
371}
372
355/* 373/*
356 * The following are helper functions for the low level drivers. 374 * The following are helper functions for the low level drivers.
357 */ 375 */
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
index b7b43b82231e..56b97eed28a4 100644
--- a/include/linux/sh_dma.h
+++ b/include/linux/sh_dma.h
@@ -95,19 +95,21 @@ struct sh_dmae_pdata {
95}; 95};
96 96
97/* DMAOR definitions */ 97/* DMAOR definitions */
98#define DMAOR_AE 0x00000004 98#define DMAOR_AE 0x00000004 /* Address Error Flag */
99#define DMAOR_NMIF 0x00000002 99#define DMAOR_NMIF 0x00000002
100#define DMAOR_DME 0x00000001 100#define DMAOR_DME 0x00000001 /* DMA Master Enable */
101 101
102/* Definitions for the SuperH DMAC */ 102/* Definitions for the SuperH DMAC */
103#define DM_INC 0x00004000 103#define DM_INC 0x00004000 /* Destination addresses are incremented */
104#define DM_DEC 0x00008000 104#define DM_DEC 0x00008000 /* Destination addresses are decremented */
105#define DM_FIX 0x0000c000 105#define DM_FIX 0x0000c000 /* Destination address is fixed */
106#define SM_INC 0x00001000 106#define SM_INC 0x00001000 /* Source addresses are incremented */
107#define SM_DEC 0x00002000 107#define SM_DEC 0x00002000 /* Source addresses are decremented */
108#define SM_FIX 0x00003000 108#define SM_FIX 0x00003000 /* Source address is fixed */
109#define CHCR_DE 0x00000001 109#define RS_AUTO 0x00000400 /* Auto Request */
110#define CHCR_TE 0x00000002 110#define RS_ERS 0x00000800 /* DMA extended resource selector */
111#define CHCR_IE 0x00000004 111#define CHCR_DE 0x00000001 /* DMA Enable */
112#define CHCR_TE 0x00000002 /* Transfer End Flag */
113#define CHCR_IE 0x00000004 /* Interrupt Enable */
112 114
113#endif 115#endif
diff --git a/include/linux/shm.h b/include/linux/shm.h
index 57d77709fbe2..6fb801686ad6 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_SHM_H_ 1#ifndef _LINUX_SHM_H_
2#define _LINUX_SHM_H_ 2#define _LINUX_SHM_H_
3 3
4#include <linux/list.h>
4#include <asm/page.h> 5#include <asm/page.h>
5#include <uapi/linux/shm.h> 6#include <uapi/linux/shm.h>
6#include <asm/shmparam.h> 7#include <asm/shmparam.h>
@@ -20,6 +21,7 @@ struct shmid_kernel /* private to the kernel */
20 21
21 /* The task created the shm object. NULL if the task is dead. */ 22 /* The task created the shm object. NULL if the task is dead. */
22 struct task_struct *shm_creator; 23 struct task_struct *shm_creator;
24 struct list_head shm_clist; /* list by creator */
23}; 25};
24 26
25/* shm_mode upper byte flags */ 27/* shm_mode upper byte flags */
@@ -44,11 +46,20 @@ struct shmid_kernel /* private to the kernel */
44#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT) 46#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT)
45 47
46#ifdef CONFIG_SYSVIPC 48#ifdef CONFIG_SYSVIPC
49struct sysv_shm {
50 struct list_head shm_clist;
51};
52
47long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr, 53long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr,
48 unsigned long shmlba); 54 unsigned long shmlba);
49extern int is_file_shm_hugepages(struct file *file); 55int is_file_shm_hugepages(struct file *file);
50extern void exit_shm(struct task_struct *task); 56void exit_shm(struct task_struct *task);
57#define shm_init_task(task) INIT_LIST_HEAD(&(task)->sysvshm.shm_clist)
51#else 58#else
59struct sysv_shm {
60 /* empty */
61};
62
52static inline long do_shmat(int shmid, char __user *shmaddr, 63static inline long do_shmat(int shmid, char __user *shmaddr,
53 int shmflg, unsigned long *addr, 64 int shmflg, unsigned long *addr,
54 unsigned long shmlba) 65 unsigned long shmlba)
@@ -62,6 +73,9 @@ static inline int is_file_shm_hugepages(struct file *file)
62static inline void exit_shm(struct task_struct *task) 73static inline void exit_shm(struct task_struct *task)
63{ 74{
64} 75}
76static inline void shm_init_task(struct task_struct *task)
77{
78}
65#endif 79#endif
66 80
67#endif /* _LINUX_SHM_H_ */ 81#endif /* _LINUX_SHM_H_ */
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 4d1771c2d29f..50777b5b1e4c 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -1,6 +1,7 @@
1#ifndef __SHMEM_FS_H 1#ifndef __SHMEM_FS_H
2#define __SHMEM_FS_H 2#define __SHMEM_FS_H
3 3
4#include <linux/file.h>
4#include <linux/swap.h> 5#include <linux/swap.h>
5#include <linux/mempolicy.h> 6#include <linux/mempolicy.h>
6#include <linux/pagemap.h> 7#include <linux/pagemap.h>
@@ -11,6 +12,7 @@
11 12
12struct shmem_inode_info { 13struct shmem_inode_info {
13 spinlock_t lock; 14 spinlock_t lock;
15 unsigned int seals; /* shmem seals */
14 unsigned long flags; 16 unsigned long flags;
15 unsigned long alloced; /* data pages alloced to file */ 17 unsigned long alloced; /* data pages alloced to file */
16 union { 18 union {
@@ -65,4 +67,19 @@ static inline struct page *shmem_read_mapping_page(
65 mapping_gfp_mask(mapping)); 67 mapping_gfp_mask(mapping));
66} 68}
67 69
70#ifdef CONFIG_TMPFS
71
72extern int shmem_add_seals(struct file *file, unsigned int seals);
73extern int shmem_get_seals(struct file *file);
74extern long shmem_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
75
76#else
77
78static inline long shmem_fcntl(struct file *f, unsigned int c, unsigned long a)
79{
80 return -EINVAL;
81}
82
83#endif
84
68#endif 85#endif
diff --git a/include/linux/signal.h b/include/linux/signal.h
index c9e65360c49a..ab1e0392b5ac 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -2,6 +2,7 @@
2#define _LINUX_SIGNAL_H 2#define _LINUX_SIGNAL_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/bug.h>
5#include <uapi/linux/signal.h> 6#include <uapi/linux/signal.h>
6 7
7struct task_struct; 8struct task_struct;
@@ -67,7 +68,6 @@ static inline int sigismember(sigset_t *set, int _sig)
67 68
68static inline int sigisemptyset(sigset_t *set) 69static inline int sigisemptyset(sigset_t *set)
69{ 70{
70 extern void _NSIG_WORDS_is_unsupported_size(void);
71 switch (_NSIG_WORDS) { 71 switch (_NSIG_WORDS) {
72 case 4: 72 case 4:
73 return (set->sig[3] | set->sig[2] | 73 return (set->sig[3] | set->sig[2] |
@@ -77,7 +77,7 @@ static inline int sigisemptyset(sigset_t *set)
77 case 1: 77 case 1:
78 return set->sig[0] == 0; 78 return set->sig[0] == 0;
79 default: 79 default:
80 _NSIG_WORDS_is_unsupported_size(); 80 BUILD_BUG();
81 return 0; 81 return 0;
82 } 82 }
83} 83}
@@ -90,24 +90,23 @@ static inline int sigisemptyset(sigset_t *set)
90#define _SIG_SET_BINOP(name, op) \ 90#define _SIG_SET_BINOP(name, op) \
91static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \ 91static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \
92{ \ 92{ \
93 extern void _NSIG_WORDS_is_unsupported_size(void); \
94 unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \ 93 unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \
95 \ 94 \
96 switch (_NSIG_WORDS) { \ 95 switch (_NSIG_WORDS) { \
97 case 4: \ 96 case 4: \
98 a3 = a->sig[3]; a2 = a->sig[2]; \ 97 a3 = a->sig[3]; a2 = a->sig[2]; \
99 b3 = b->sig[3]; b2 = b->sig[2]; \ 98 b3 = b->sig[3]; b2 = b->sig[2]; \
100 r->sig[3] = op(a3, b3); \ 99 r->sig[3] = op(a3, b3); \
101 r->sig[2] = op(a2, b2); \ 100 r->sig[2] = op(a2, b2); \
102 case 2: \ 101 case 2: \
103 a1 = a->sig[1]; b1 = b->sig[1]; \ 102 a1 = a->sig[1]; b1 = b->sig[1]; \
104 r->sig[1] = op(a1, b1); \ 103 r->sig[1] = op(a1, b1); \
105 case 1: \ 104 case 1: \
106 a0 = a->sig[0]; b0 = b->sig[0]; \ 105 a0 = a->sig[0]; b0 = b->sig[0]; \
107 r->sig[0] = op(a0, b0); \ 106 r->sig[0] = op(a0, b0); \
108 break; \ 107 break; \
109 default: \ 108 default: \
110 _NSIG_WORDS_is_unsupported_size(); \ 109 BUILD_BUG(); \
111 } \ 110 } \
112} 111}
113 112
@@ -128,16 +127,14 @@ _SIG_SET_BINOP(sigandnsets, _sig_andn)
128#define _SIG_SET_OP(name, op) \ 127#define _SIG_SET_OP(name, op) \
129static inline void name(sigset_t *set) \ 128static inline void name(sigset_t *set) \
130{ \ 129{ \
131 extern void _NSIG_WORDS_is_unsupported_size(void); \
132 \
133 switch (_NSIG_WORDS) { \ 130 switch (_NSIG_WORDS) { \
134 case 4: set->sig[3] = op(set->sig[3]); \ 131 case 4: set->sig[3] = op(set->sig[3]); \
135 set->sig[2] = op(set->sig[2]); \ 132 set->sig[2] = op(set->sig[2]); \
136 case 2: set->sig[1] = op(set->sig[1]); \ 133 case 2: set->sig[1] = op(set->sig[1]); \
137 case 1: set->sig[0] = op(set->sig[0]); \ 134 case 1: set->sig[0] = op(set->sig[0]); \
138 break; \ 135 break; \
139 default: \ 136 default: \
140 _NSIG_WORDS_is_unsupported_size(); \ 137 BUILD_BUG(); \
141 } \ 138 } \
142} 139}
143 140
@@ -280,9 +277,8 @@ struct ksignal {
280 int sig; 277 int sig;
281}; 278};
282 279
283extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 280extern int get_signal(struct ksignal *ksig);
284extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping); 281extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
285extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping);
286extern void exit_signals(struct task_struct *tsk); 282extern void exit_signals(struct task_struct *tsk);
287extern void kernel_sigaction(int, __sighandler_t); 283extern void kernel_sigaction(int, __sighandler_t);
288 284
@@ -301,18 +297,6 @@ static inline void disallow_signal(int sig)
301 kernel_sigaction(sig, SIG_IGN); 297 kernel_sigaction(sig, SIG_IGN);
302} 298}
303 299
304/*
305 * Eventually that'll replace get_signal_to_deliver(); macro for now,
306 * to avoid nastiness with include order.
307 */
308#define get_signal(ksig) \
309({ \
310 struct ksignal *p = (ksig); \
311 p->sig = get_signal_to_deliver(&p->info, &p->ka, \
312 signal_pt_regs(), NULL);\
313 p->sig > 0; \
314})
315
316extern struct kmem_cache *sighand_cachep; 300extern struct kmem_cache *sighand_cachep;
317 301
318int unhandled_signal(struct task_struct *tsk, int sig); 302int unhandled_signal(struct task_struct *tsk, int sig);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 11c270551d25..6c8b6f604e76 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -28,7 +28,6 @@
28#include <linux/textsearch.h> 28#include <linux/textsearch.h>
29#include <net/checksum.h> 29#include <net/checksum.h>
30#include <linux/rcupdate.h> 30#include <linux/rcupdate.h>
31#include <linux/dmaengine.h>
32#include <linux/hrtimer.h> 31#include <linux/hrtimer.h>
33#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
34#include <linux/netdev_features.h> 33#include <linux/netdev_features.h>
@@ -47,11 +46,29 @@
47 * 46 *
48 * The hardware you're dealing with doesn't calculate the full checksum 47 * The hardware you're dealing with doesn't calculate the full checksum
49 * (as in CHECKSUM_COMPLETE), but it does parse headers and verify checksums 48 * (as in CHECKSUM_COMPLETE), but it does parse headers and verify checksums
50 * for specific protocols e.g. TCP/UDP/SCTP, then, for such packets it will 49 * for specific protocols. For such packets it will set CHECKSUM_UNNECESSARY
51 * set CHECKSUM_UNNECESSARY if their checksums are okay. skb->csum is still 50 * if their checksums are okay. skb->csum is still undefined in this case
52 * undefined in this case though. It is a bad option, but, unfortunately, 51 * though. It is a bad option, but, unfortunately, nowadays most vendors do
53 * nowadays most vendors do this. Apparently with the secret goal to sell 52 * this. Apparently with the secret goal to sell you new devices, when you
54 * you new devices, when you will add new protocol to your host, f.e. IPv6 8) 53 * will add new protocol to your host, f.e. IPv6 8)
54 *
55 * CHECKSUM_UNNECESSARY is applicable to following protocols:
56 * TCP: IPv6 and IPv4.
57 * UDP: IPv4 and IPv6. A device may apply CHECKSUM_UNNECESSARY to a
58 * zero UDP checksum for either IPv4 or IPv6, the networking stack
59 * may perform further validation in this case.
60 * GRE: only if the checksum is present in the header.
61 * SCTP: indicates the CRC in SCTP header has been validated.
62 *
63 * skb->csum_level indicates the number of consecutive checksums found in
64 * the packet minus one that have been verified as CHECKSUM_UNNECESSARY.
65 * For instance if a device receives an IPv6->UDP->GRE->IPv4->TCP packet
66 * and a device is able to verify the checksums for UDP (possibly zero),
67 * GRE (checksum flag is set), and TCP-- skb->csum_level would be set to
68 * two. If the device were only able to verify the UDP checksum and not
69 * GRE, either because it doesn't support GRE checksum of because GRE
70 * checksum is bad, skb->csum_level would be set to zero (TCP checksum is
71 * not considered in this case).
55 * 72 *
56 * CHECKSUM_COMPLETE: 73 * CHECKSUM_COMPLETE:
57 * 74 *
@@ -112,6 +129,9 @@
112#define CHECKSUM_COMPLETE 2 129#define CHECKSUM_COMPLETE 2
113#define CHECKSUM_PARTIAL 3 130#define CHECKSUM_PARTIAL 3
114 131
132/* Maximum value in skb->csum_level */
133#define SKB_MAX_CSUM_LEVEL 3
134
115#define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES) 135#define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES)
116#define SKB_WITH_OVERHEAD(X) \ 136#define SKB_WITH_OVERHEAD(X) \
117 ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) 137 ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
@@ -135,7 +155,7 @@ struct nf_conntrack {
135}; 155};
136#endif 156#endif
137 157
138#ifdef CONFIG_BRIDGE_NETFILTER 158#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
139struct nf_bridge_info { 159struct nf_bridge_info {
140 atomic_t use; 160 atomic_t use;
141 unsigned int mask; 161 unsigned int mask;
@@ -318,9 +338,10 @@ struct skb_shared_info {
318 338
319 339
320enum { 340enum {
321 SKB_FCLONE_UNAVAILABLE, 341 SKB_FCLONE_UNAVAILABLE, /* skb has no fclone (from head_cache) */
322 SKB_FCLONE_ORIG, 342 SKB_FCLONE_ORIG, /* orig skb (from fclone_cache) */
323 SKB_FCLONE_CLONE, 343 SKB_FCLONE_CLONE, /* companion fclone skb (from fclone_cache) */
344 SKB_FCLONE_FREE, /* this companion fclone skb is available */
324}; 345};
325 346
326enum { 347enum {
@@ -452,6 +473,7 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
452 * @tc_verd: traffic control verdict 473 * @tc_verd: traffic control verdict
453 * @hash: the packet hash 474 * @hash: the packet hash
454 * @queue_mapping: Queue mapping for multiqueue devices 475 * @queue_mapping: Queue mapping for multiqueue devices
476 * @xmit_more: More SKBs are pending for this queue
455 * @ndisc_nodetype: router type (from link layer) 477 * @ndisc_nodetype: router type (from link layer)
456 * @ooo_okay: allow the mapping of a socket to a queue to be changed 478 * @ooo_okay: allow the mapping of a socket to a queue to be changed
457 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport 479 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport
@@ -460,8 +482,6 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
460 * @wifi_acked_valid: wifi_acked was set 482 * @wifi_acked_valid: wifi_acked was set
461 * @wifi_acked: whether frame was acked on wifi or not 483 * @wifi_acked: whether frame was acked on wifi or not
462 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS 484 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
463 * @dma_cookie: a cookie to one of several possible DMA operations
464 * done by skb DMA functions
465 * @napi_id: id of the NAPI struct this skb came from 485 * @napi_id: id of the NAPI struct this skb came from
466 * @secmark: security marking 486 * @secmark: security marking
467 * @mark: Generic packet mark 487 * @mark: Generic packet mark
@@ -505,87 +525,101 @@ struct sk_buff {
505 char cb[48] __aligned(8); 525 char cb[48] __aligned(8);
506 526
507 unsigned long _skb_refdst; 527 unsigned long _skb_refdst;
528 void (*destructor)(struct sk_buff *skb);
508#ifdef CONFIG_XFRM 529#ifdef CONFIG_XFRM
509 struct sec_path *sp; 530 struct sec_path *sp;
510#endif 531#endif
532#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
533 struct nf_conntrack *nfct;
534#endif
535#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
536 struct nf_bridge_info *nf_bridge;
537#endif
511 unsigned int len, 538 unsigned int len,
512 data_len; 539 data_len;
513 __u16 mac_len, 540 __u16 mac_len,
514 hdr_len; 541 hdr_len;
515 union { 542
516 __wsum csum; 543 /* Following fields are _not_ copied in __copy_skb_header()
517 struct { 544 * Note that queue_mapping is here mostly to fill a hole.
518 __u16 csum_start; 545 */
519 __u16 csum_offset;
520 };
521 };
522 __u32 priority;
523 kmemcheck_bitfield_begin(flags1); 546 kmemcheck_bitfield_begin(flags1);
524 __u8 ignore_df:1, 547 __u16 queue_mapping;
525 cloned:1, 548 __u8 cloned:1,
526 ip_summed:2,
527 nohdr:1, 549 nohdr:1,
528 nfctinfo:3;
529 __u8 pkt_type:3,
530 fclone:2, 550 fclone:2,
531 ipvs_property:1,
532 peeked:1, 551 peeked:1,
533 nf_trace:1; 552 head_frag:1,
553 xmit_more:1;
554 /* one bit hole */
534 kmemcheck_bitfield_end(flags1); 555 kmemcheck_bitfield_end(flags1);
535 __be16 protocol;
536 556
537 void (*destructor)(struct sk_buff *skb); 557 /* fields enclosed in headers_start/headers_end are copied
538#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 558 * using a single memcpy() in __copy_skb_header()
539 struct nf_conntrack *nfct; 559 */
540#endif 560 /* private: */
541#ifdef CONFIG_BRIDGE_NETFILTER 561 __u32 headers_start[0];
542 struct nf_bridge_info *nf_bridge; 562 /* public: */
543#endif
544
545 int skb_iif;
546
547 __u32 hash;
548
549 __be16 vlan_proto;
550 __u16 vlan_tci;
551 563
552#ifdef CONFIG_NET_SCHED 564/* if you move pkt_type around you also must adapt those constants */
553 __u16 tc_index; /* traffic control index */ 565#ifdef __BIG_ENDIAN_BITFIELD
554#ifdef CONFIG_NET_CLS_ACT 566#define PKT_TYPE_MAX (7 << 5)
555 __u16 tc_verd; /* traffic control verdict */ 567#else
556#endif 568#define PKT_TYPE_MAX 7
557#endif 569#endif
570#define PKT_TYPE_OFFSET() offsetof(struct sk_buff, __pkt_type_offset)
558 571
559 __u16 queue_mapping; 572 __u8 __pkt_type_offset[0];
560 kmemcheck_bitfield_begin(flags2); 573 __u8 pkt_type:3;
561#ifdef CONFIG_IPV6_NDISC_NODETYPE
562 __u8 ndisc_nodetype:2;
563#endif
564 __u8 pfmemalloc:1; 574 __u8 pfmemalloc:1;
575 __u8 ignore_df:1;
576 __u8 nfctinfo:3;
577
578 __u8 nf_trace:1;
579 __u8 ip_summed:2;
565 __u8 ooo_okay:1; 580 __u8 ooo_okay:1;
566 __u8 l4_hash:1; 581 __u8 l4_hash:1;
567 __u8 sw_hash:1; 582 __u8 sw_hash:1;
568 __u8 wifi_acked_valid:1; 583 __u8 wifi_acked_valid:1;
569 __u8 wifi_acked:1; 584 __u8 wifi_acked:1;
585
570 __u8 no_fcs:1; 586 __u8 no_fcs:1;
571 __u8 head_frag:1; 587 /* Indicates the inner headers are valid in the skbuff. */
572 /* Encapsulation protocol and NIC drivers should use
573 * this flag to indicate to each other if the skb contains
574 * encapsulated packet or not and maybe use the inner packet
575 * headers if needed
576 */
577 __u8 encapsulation:1; 588 __u8 encapsulation:1;
578 __u8 encap_hdr_csum:1; 589 __u8 encap_hdr_csum:1;
579 __u8 csum_valid:1; 590 __u8 csum_valid:1;
580 __u8 csum_complete_sw:1; 591 __u8 csum_complete_sw:1;
581 /* 2/4 bit hole (depending on ndisc_nodetype presence) */ 592 __u8 csum_level:2;
582 kmemcheck_bitfield_end(flags2); 593 __u8 csum_bad:1;
594
595#ifdef CONFIG_IPV6_NDISC_NODETYPE
596 __u8 ndisc_nodetype:2;
597#endif
598 __u8 ipvs_property:1;
599 __u8 inner_protocol_type:1;
600 /* 4 or 6 bit hole */
601
602#ifdef CONFIG_NET_SCHED
603 __u16 tc_index; /* traffic control index */
604#ifdef CONFIG_NET_CLS_ACT
605 __u16 tc_verd; /* traffic control verdict */
606#endif
607#endif
583 608
584#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL
585 union { 609 union {
586 unsigned int napi_id; 610 __wsum csum;
587 dma_cookie_t dma_cookie; 611 struct {
612 __u16 csum_start;
613 __u16 csum_offset;
614 };
588 }; 615 };
616 __u32 priority;
617 int skb_iif;
618 __u32 hash;
619 __be16 vlan_proto;
620 __u16 vlan_tci;
621#ifdef CONFIG_NET_RX_BUSY_POLL
622 unsigned int napi_id;
589#endif 623#endif
590#ifdef CONFIG_NETWORK_SECMARK 624#ifdef CONFIG_NETWORK_SECMARK
591 __u32 secmark; 625 __u32 secmark;
@@ -596,13 +630,24 @@ struct sk_buff {
596 __u32 reserved_tailroom; 630 __u32 reserved_tailroom;
597 }; 631 };
598 632
599 __be16 inner_protocol; 633 union {
634 __be16 inner_protocol;
635 __u8 inner_ipproto;
636 };
637
600 __u16 inner_transport_header; 638 __u16 inner_transport_header;
601 __u16 inner_network_header; 639 __u16 inner_network_header;
602 __u16 inner_mac_header; 640 __u16 inner_mac_header;
641
642 __be16 protocol;
603 __u16 transport_header; 643 __u16 transport_header;
604 __u16 network_header; 644 __u16 network_header;
605 __u16 mac_header; 645 __u16 mac_header;
646
647 /* private: */
648 __u32 headers_end[0];
649 /* public: */
650
606 /* These elements must be at the end, see alloc_skb() for details. */ 651 /* These elements must be at the end, see alloc_skb() for details. */
607 sk_buff_data_t tail; 652 sk_buff_data_t tail;
608 sk_buff_data_t end; 653 sk_buff_data_t end;
@@ -734,6 +779,41 @@ static inline struct sk_buff *alloc_skb(unsigned int size,
734 return __alloc_skb(size, priority, 0, NUMA_NO_NODE); 779 return __alloc_skb(size, priority, 0, NUMA_NO_NODE);
735} 780}
736 781
782struct sk_buff *alloc_skb_with_frags(unsigned long header_len,
783 unsigned long data_len,
784 int max_page_order,
785 int *errcode,
786 gfp_t gfp_mask);
787
788/* Layout of fast clones : [skb1][skb2][fclone_ref] */
789struct sk_buff_fclones {
790 struct sk_buff skb1;
791
792 struct sk_buff skb2;
793
794 atomic_t fclone_ref;
795};
796
797/**
798 * skb_fclone_busy - check if fclone is busy
799 * @skb: buffer
800 *
801 * Returns true is skb is a fast clone, and its clone is not freed.
802 * Some drivers call skb_orphan() in their ndo_start_xmit(),
803 * so we also check that this didnt happen.
804 */
805static inline bool skb_fclone_busy(const struct sock *sk,
806 const struct sk_buff *skb)
807{
808 const struct sk_buff_fclones *fclones;
809
810 fclones = container_of(skb, struct sk_buff_fclones, skb1);
811
812 return skb->fclone == SKB_FCLONE_ORIG &&
813 fclones->skb2.fclone == SKB_FCLONE_CLONE &&
814 fclones->skb2.sk == sk;
815}
816
737static inline struct sk_buff *alloc_skb_fclone(unsigned int size, 817static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
738 gfp_t priority) 818 gfp_t priority)
739{ 819{
@@ -1042,6 +1122,7 @@ static inline int skb_header_cloned(const struct sk_buff *skb)
1042 * Drop a reference to the header part of the buffer. This is done 1122 * Drop a reference to the header part of the buffer. This is done
1043 * by acquiring a payload reference. You must not read from the header 1123 * by acquiring a payload reference. You must not read from the header
1044 * part of skb->data after this. 1124 * part of skb->data after this.
1125 * Note : Check if you can use __skb_header_release() instead.
1045 */ 1126 */
1046static inline void skb_header_release(struct sk_buff *skb) 1127static inline void skb_header_release(struct sk_buff *skb)
1047{ 1128{
@@ -1051,6 +1132,20 @@ static inline void skb_header_release(struct sk_buff *skb)
1051} 1132}
1052 1133
1053/** 1134/**
1135 * __skb_header_release - release reference to header
1136 * @skb: buffer to operate on
1137 *
1138 * Variant of skb_header_release() assuming skb is private to caller.
1139 * We can avoid one atomic operation.
1140 */
1141static inline void __skb_header_release(struct sk_buff *skb)
1142{
1143 skb->nohdr = 1;
1144 atomic_set(&skb_shinfo(skb)->dataref, 1 + (1 << SKB_DATAREF_SHIFT));
1145}
1146
1147
1148/**
1054 * skb_shared - is the buffer shared 1149 * skb_shared - is the buffer shared
1055 * @skb: buffer to check 1150 * @skb: buffer to check
1056 * 1151 *
@@ -1116,7 +1211,12 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
1116 might_sleep_if(pri & __GFP_WAIT); 1211 might_sleep_if(pri & __GFP_WAIT);
1117 if (skb_cloned(skb)) { 1212 if (skb_cloned(skb)) {
1118 struct sk_buff *nskb = skb_copy(skb, pri); 1213 struct sk_buff *nskb = skb_copy(skb, pri);
1119 kfree_skb(skb); /* Free our shared copy */ 1214
1215 /* Free our shared copy */
1216 if (likely(nskb))
1217 consume_skb(skb);
1218 else
1219 kfree_skb(skb);
1120 skb = nskb; 1220 skb = nskb;
1121 } 1221 }
1122 return skb; 1222 return skb;
@@ -1675,6 +1775,23 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
1675 skb->tail += len; 1775 skb->tail += len;
1676} 1776}
1677 1777
1778#define ENCAP_TYPE_ETHER 0
1779#define ENCAP_TYPE_IPPROTO 1
1780
1781static inline void skb_set_inner_protocol(struct sk_buff *skb,
1782 __be16 protocol)
1783{
1784 skb->inner_protocol = protocol;
1785 skb->inner_protocol_type = ENCAP_TYPE_ETHER;
1786}
1787
1788static inline void skb_set_inner_ipproto(struct sk_buff *skb,
1789 __u8 ipproto)
1790{
1791 skb->inner_ipproto = ipproto;
1792 skb->inner_protocol_type = ENCAP_TYPE_IPPROTO;
1793}
1794
1678static inline void skb_reset_inner_headers(struct sk_buff *skb) 1795static inline void skb_reset_inner_headers(struct sk_buff *skb)
1679{ 1796{
1680 skb->inner_mac_header = skb->mac_header; 1797 skb->inner_mac_header = skb->mac_header;
@@ -1860,18 +1977,6 @@ static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len)
1860 return pskb_may_pull(skb, skb_network_offset(skb) + len); 1977 return pskb_may_pull(skb, skb_network_offset(skb) + len);
1861} 1978}
1862 1979
1863static inline void skb_pop_rcv_encapsulation(struct sk_buff *skb)
1864{
1865 /* Only continue with checksum unnecessary if device indicated
1866 * it is valid across encapsulation (skb->encapsulation was set).
1867 */
1868 if (skb->ip_summed == CHECKSUM_UNNECESSARY && !skb->encapsulation)
1869 skb->ip_summed = CHECKSUM_NONE;
1870
1871 skb->encapsulation = 0;
1872 skb->csum_valid = 0;
1873}
1874
1875/* 1980/*
1876 * CPUs often take a performance hit when accessing unaligned memory 1981 * CPUs often take a performance hit when accessing unaligned memory
1877 * locations. The actual performance hit varies, it can be small if the 1982 * locations. The actual performance hit varies, it can be small if the
@@ -2555,6 +2660,7 @@ int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen);
2555void skb_scrub_packet(struct sk_buff *skb, bool xnet); 2660void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2556unsigned int skb_gso_transport_seglen(const struct sk_buff *skb); 2661unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
2557struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features); 2662struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
2663struct sk_buff *skb_vlan_untag(struct sk_buff *skb);
2558 2664
2559struct skb_checksum_ops { 2665struct skb_checksum_ops {
2560 __wsum (*update)(const void *mem, int len, __wsum wsum); 2666 __wsum (*update)(const void *mem, int len, __wsum wsum);
@@ -2566,20 +2672,26 @@ __wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
2566__wsum skb_checksum(const struct sk_buff *skb, int offset, int len, 2672__wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
2567 __wsum csum); 2673 __wsum csum);
2568 2674
2569static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 2675static inline void *__skb_header_pointer(const struct sk_buff *skb, int offset,
2570 int len, void *buffer) 2676 int len, void *data, int hlen, void *buffer)
2571{ 2677{
2572 int hlen = skb_headlen(skb);
2573
2574 if (hlen - offset >= len) 2678 if (hlen - offset >= len)
2575 return skb->data + offset; 2679 return data + offset;
2576 2680
2577 if (skb_copy_bits(skb, offset, buffer, len) < 0) 2681 if (!skb ||
2682 skb_copy_bits(skb, offset, buffer, len) < 0)
2578 return NULL; 2683 return NULL;
2579 2684
2580 return buffer; 2685 return buffer;
2581} 2686}
2582 2687
2688static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
2689 int len, void *buffer)
2690{
2691 return __skb_header_pointer(skb, offset, len, skb->data,
2692 skb_headlen(skb), buffer);
2693}
2694
2583/** 2695/**
2584 * skb_needs_linearize - check if we need to linearize a given skb 2696 * skb_needs_linearize - check if we need to linearize a given skb
2585 * depending on the given device features. 2697 * depending on the given device features.
@@ -2670,6 +2782,8 @@ static inline ktime_t net_invalid_timestamp(void)
2670 return ktime_set(0, 0); 2782 return ktime_set(0, 0);
2671} 2783}
2672 2784
2785struct sk_buff *skb_clone_sk(struct sk_buff *skb);
2786
2673#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING 2787#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
2674 2788
2675void skb_clone_tx_timestamp(struct sk_buff *skb); 2789void skb_clone_tx_timestamp(struct sk_buff *skb);
@@ -2785,6 +2899,42 @@ static inline __sum16 skb_checksum_complete(struct sk_buff *skb)
2785 0 : __skb_checksum_complete(skb); 2899 0 : __skb_checksum_complete(skb);
2786} 2900}
2787 2901
2902static inline void __skb_decr_checksum_unnecessary(struct sk_buff *skb)
2903{
2904 if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
2905 if (skb->csum_level == 0)
2906 skb->ip_summed = CHECKSUM_NONE;
2907 else
2908 skb->csum_level--;
2909 }
2910}
2911
2912static inline void __skb_incr_checksum_unnecessary(struct sk_buff *skb)
2913{
2914 if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
2915 if (skb->csum_level < SKB_MAX_CSUM_LEVEL)
2916 skb->csum_level++;
2917 } else if (skb->ip_summed == CHECKSUM_NONE) {
2918 skb->ip_summed = CHECKSUM_UNNECESSARY;
2919 skb->csum_level = 0;
2920 }
2921}
2922
2923static inline void __skb_mark_checksum_bad(struct sk_buff *skb)
2924{
2925 /* Mark current checksum as bad (typically called from GRO
2926 * path). In the case that ip_summed is CHECKSUM_NONE
2927 * this must be the first checksum encountered in the packet.
2928 * When ip_summed is CHECKSUM_UNNECESSARY, this is the first
2929 * checksum after the last one validated. For UDP, a zero
2930 * checksum can not be marked as bad.
2931 */
2932
2933 if (skb->ip_summed == CHECKSUM_NONE ||
2934 skb->ip_summed == CHECKSUM_UNNECESSARY)
2935 skb->csum_bad = 1;
2936}
2937
2788/* Check if we need to perform checksum complete validation. 2938/* Check if we need to perform checksum complete validation.
2789 * 2939 *
2790 * Returns true if checksum complete is needed, false otherwise 2940 * Returns true if checksum complete is needed, false otherwise
@@ -2796,6 +2946,7 @@ static inline bool __skb_checksum_validate_needed(struct sk_buff *skb,
2796{ 2946{
2797 if (skb_csum_unnecessary(skb) || (zero_okay && !check)) { 2947 if (skb_csum_unnecessary(skb) || (zero_okay && !check)) {
2798 skb->csum_valid = 1; 2948 skb->csum_valid = 1;
2949 __skb_decr_checksum_unnecessary(skb);
2799 return false; 2950 return false;
2800 } 2951 }
2801 2952
@@ -2825,6 +2976,9 @@ static inline __sum16 __skb_checksum_validate_complete(struct sk_buff *skb,
2825 skb->csum_valid = 1; 2976 skb->csum_valid = 1;
2826 return 0; 2977 return 0;
2827 } 2978 }
2979 } else if (skb->csum_bad) {
2980 /* ip_summed == CHECKSUM_NONE in this case */
2981 return 1;
2828 } 2982 }
2829 2983
2830 skb->csum = psum; 2984 skb->csum = psum;
@@ -2882,6 +3036,26 @@ static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto)
2882#define skb_checksum_simple_validate(skb) \ 3036#define skb_checksum_simple_validate(skb) \
2883 __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo) 3037 __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo)
2884 3038
3039static inline bool __skb_checksum_convert_check(struct sk_buff *skb)
3040{
3041 return (skb->ip_summed == CHECKSUM_NONE &&
3042 skb->csum_valid && !skb->csum_bad);
3043}
3044
3045static inline void __skb_checksum_convert(struct sk_buff *skb,
3046 __sum16 check, __wsum pseudo)
3047{
3048 skb->csum = ~pseudo;
3049 skb->ip_summed = CHECKSUM_COMPLETE;
3050}
3051
3052#define skb_checksum_try_convert(skb, proto, check, compute_pseudo) \
3053do { \
3054 if (__skb_checksum_convert_check(skb)) \
3055 __skb_checksum_convert(skb, check, \
3056 compute_pseudo(skb, proto)); \
3057} while (0)
3058
2885#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 3059#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2886void nf_conntrack_destroy(struct nf_conntrack *nfct); 3060void nf_conntrack_destroy(struct nf_conntrack *nfct);
2887static inline void nf_conntrack_put(struct nf_conntrack *nfct) 3061static inline void nf_conntrack_put(struct nf_conntrack *nfct)
@@ -2895,7 +3069,7 @@ static inline void nf_conntrack_get(struct nf_conntrack *nfct)
2895 atomic_inc(&nfct->use); 3069 atomic_inc(&nfct->use);
2896} 3070}
2897#endif 3071#endif
2898#ifdef CONFIG_BRIDGE_NETFILTER 3072#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
2899static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge) 3073static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
2900{ 3074{
2901 if (nf_bridge && atomic_dec_and_test(&nf_bridge->use)) 3075 if (nf_bridge && atomic_dec_and_test(&nf_bridge->use))
@@ -2913,7 +3087,7 @@ static inline void nf_reset(struct sk_buff *skb)
2913 nf_conntrack_put(skb->nfct); 3087 nf_conntrack_put(skb->nfct);
2914 skb->nfct = NULL; 3088 skb->nfct = NULL;
2915#endif 3089#endif
2916#ifdef CONFIG_BRIDGE_NETFILTER 3090#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
2917 nf_bridge_put(skb->nf_bridge); 3091 nf_bridge_put(skb->nf_bridge);
2918 skb->nf_bridge = NULL; 3092 skb->nf_bridge = NULL;
2919#endif 3093#endif
@@ -2927,19 +3101,22 @@ static inline void nf_reset_trace(struct sk_buff *skb)
2927} 3101}
2928 3102
2929/* Note: This doesn't put any conntrack and bridge info in dst. */ 3103/* Note: This doesn't put any conntrack and bridge info in dst. */
2930static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src) 3104static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src,
3105 bool copy)
2931{ 3106{
2932#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 3107#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2933 dst->nfct = src->nfct; 3108 dst->nfct = src->nfct;
2934 nf_conntrack_get(src->nfct); 3109 nf_conntrack_get(src->nfct);
2935 dst->nfctinfo = src->nfctinfo; 3110 if (copy)
3111 dst->nfctinfo = src->nfctinfo;
2936#endif 3112#endif
2937#ifdef CONFIG_BRIDGE_NETFILTER 3113#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
2938 dst->nf_bridge = src->nf_bridge; 3114 dst->nf_bridge = src->nf_bridge;
2939 nf_bridge_get(src->nf_bridge); 3115 nf_bridge_get(src->nf_bridge);
2940#endif 3116#endif
2941#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) || defined(CONFIG_NF_TABLES) 3117#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) || defined(CONFIG_NF_TABLES)
2942 dst->nf_trace = src->nf_trace; 3118 if (copy)
3119 dst->nf_trace = src->nf_trace;
2943#endif 3120#endif
2944} 3121}
2945 3122
@@ -2948,10 +3125,10 @@ static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src)
2948#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 3125#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2949 nf_conntrack_put(dst->nfct); 3126 nf_conntrack_put(dst->nfct);
2950#endif 3127#endif
2951#ifdef CONFIG_BRIDGE_NETFILTER 3128#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
2952 nf_bridge_put(dst->nf_bridge); 3129 nf_bridge_put(dst->nf_bridge);
2953#endif 3130#endif
2954 __nf_copy(dst, src); 3131 __nf_copy(dst, src, true);
2955} 3132}
2956 3133
2957#ifdef CONFIG_NETWORK_SECMARK 3134#ifdef CONFIG_NETWORK_SECMARK
@@ -3136,7 +3313,9 @@ bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
3136 3313
3137int skb_checksum_setup(struct sk_buff *skb, bool recalculate); 3314int skb_checksum_setup(struct sk_buff *skb, bool recalculate);
3138 3315
3139u32 __skb_get_poff(const struct sk_buff *skb); 3316u32 skb_get_poff(const struct sk_buff *skb);
3317u32 __skb_get_poff(const struct sk_buff *skb, void *data,
3318 const struct flow_keys *keys, int hlen);
3140 3319
3141/** 3320/**
3142 * skb_head_is_locked - Determine if the skb->head is locked down 3321 * skb_head_is_locked - Determine if the skb->head is locked down
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 1d9abb7d22a0..c265bec6a57d 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -158,31 +158,6 @@ size_t ksize(const void *);
158#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) 158#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
159#endif 159#endif
160 160
161#ifdef CONFIG_SLOB
162/*
163 * Common fields provided in kmem_cache by all slab allocators
164 * This struct is either used directly by the allocator (SLOB)
165 * or the allocator must include definitions for all fields
166 * provided in kmem_cache_common in their definition of kmem_cache.
167 *
168 * Once we can do anonymous structs (C11 standard) we could put a
169 * anonymous struct definition in these allocators so that the
170 * separate allocations in the kmem_cache structure of SLAB and
171 * SLUB is no longer needed.
172 */
173struct kmem_cache {
174 unsigned int object_size;/* The original size of the object */
175 unsigned int size; /* The aligned/padded/added on size */
176 unsigned int align; /* Alignment as calculated */
177 unsigned long flags; /* Active flags on the slab */
178 const char *name; /* Slab name for sysfs */
179 int refcount; /* Use counter */
180 void (*ctor)(void *); /* Called on object slot creation */
181 struct list_head list; /* List of all slab caches on the system */
182};
183
184#endif /* CONFIG_SLOB */
185
186/* 161/*
187 * Kmalloc array related definitions 162 * Kmalloc array related definitions
188 */ 163 */
@@ -363,14 +338,6 @@ kmem_cache_alloc_node_trace(struct kmem_cache *s,
363} 338}
364#endif /* CONFIG_TRACING */ 339#endif /* CONFIG_TRACING */
365 340
366#ifdef CONFIG_SLAB
367#include <linux/slab_def.h>
368#endif
369
370#ifdef CONFIG_SLUB
371#include <linux/slub_def.h>
372#endif
373
374extern void *kmalloc_order(size_t size, gfp_t flags, unsigned int order); 341extern void *kmalloc_order(size_t size, gfp_t flags, unsigned int order);
375 342
376#ifdef CONFIG_TRACING 343#ifdef CONFIG_TRACING
@@ -582,37 +549,15 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
582 * allocator where we care about the real place the memory allocation 549 * allocator where we care about the real place the memory allocation
583 * request comes from. 550 * request comes from.
584 */ 551 */
585#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
586 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \
587 (defined(CONFIG_SLOB) && defined(CONFIG_TRACING))
588extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long); 552extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
589#define kmalloc_track_caller(size, flags) \ 553#define kmalloc_track_caller(size, flags) \
590 __kmalloc_track_caller(size, flags, _RET_IP_) 554 __kmalloc_track_caller(size, flags, _RET_IP_)
591#else
592#define kmalloc_track_caller(size, flags) \
593 __kmalloc(size, flags)
594#endif /* DEBUG_SLAB */
595 555
596#ifdef CONFIG_NUMA 556#ifdef CONFIG_NUMA
597/*
598 * kmalloc_node_track_caller is a special version of kmalloc_node that
599 * records the calling function of the routine calling it for slab leak
600 * tracking instead of just the calling function (confusing, eh?).
601 * It's useful when the call to kmalloc_node comes from a widely-used
602 * standard allocator where we care about the real place the memory
603 * allocation request comes from.
604 */
605#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
606 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \
607 (defined(CONFIG_SLOB) && defined(CONFIG_TRACING))
608extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long); 557extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long);
609#define kmalloc_node_track_caller(size, flags, node) \ 558#define kmalloc_node_track_caller(size, flags, node) \
610 __kmalloc_node_track_caller(size, flags, node, \ 559 __kmalloc_node_track_caller(size, flags, node, \
611 _RET_IP_) 560 _RET_IP_)
612#else
613#define kmalloc_node_track_caller(size, flags, node) \
614 __kmalloc_node(size, flags, node)
615#endif
616 561
617#else /* CONFIG_NUMA */ 562#else /* CONFIG_NUMA */
618 563
@@ -650,14 +595,7 @@ static inline void *kzalloc_node(size_t size, gfp_t flags, int node)
650 return kmalloc_node(size, flags | __GFP_ZERO, node); 595 return kmalloc_node(size, flags | __GFP_ZERO, node);
651} 596}
652 597
653/* 598unsigned int kmem_cache_size(struct kmem_cache *s);
654 * Determine the size of a slab object
655 */
656static inline unsigned int kmem_cache_size(struct kmem_cache *s)
657{
658 return s->object_size;
659}
660
661void __init kmem_cache_init_late(void); 599void __init kmem_cache_init_late(void);
662 600
663#endif /* _LINUX_SLAB_H */ 601#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 8235dfbb3b05..b869d1662ba3 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -8,6 +8,8 @@
8 */ 8 */
9 9
10struct kmem_cache { 10struct kmem_cache {
11 struct array_cache __percpu *cpu_cache;
12
11/* 1) Cache tunables. Protected by slab_mutex */ 13/* 1) Cache tunables. Protected by slab_mutex */
12 unsigned int batchcount; 14 unsigned int batchcount;
13 unsigned int limit; 15 unsigned int limit;
@@ -71,23 +73,7 @@ struct kmem_cache {
71 struct memcg_cache_params *memcg_params; 73 struct memcg_cache_params *memcg_params;
72#endif 74#endif
73 75
74/* 6) per-cpu/per-node data, touched during every alloc/free */ 76 struct kmem_cache_node *node[MAX_NUMNODES];
75 /*
76 * We put array[] at the end of kmem_cache, because we want to size
77 * this array to nr_cpu_ids slots instead of NR_CPUS
78 * (see kmem_cache_init())
79 * We still use [NR_CPUS] and not [1] or [0] because cache_cache
80 * is statically defined, so we reserve the max number of cpus.
81 *
82 * We also need to guarantee that the list is able to accomodate a
83 * pointer for each node since "nodelists" uses the remainder of
84 * available pointers.
85 */
86 struct kmem_cache_node **node;
87 struct array_cache *array[NR_CPUS + MAX_NUMNODES];
88 /*
89 * Do not add fields after array[]
90 */
91}; 77};
92 78
93#endif /* _LINUX_SLAB_DEF_H */ 79#endif /* _LINUX_SLAB_DEF_H */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 34347f26be9b..93dff5fff524 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -100,6 +100,7 @@ int smp_call_function_any(const struct cpumask *mask,
100 smp_call_func_t func, void *info, int wait); 100 smp_call_func_t func, void *info, int wait);
101 101
102void kick_all_cpus_sync(void); 102void kick_all_cpus_sync(void);
103void wake_up_all_idle_cpus(void);
103 104
104/* 105/*
105 * Generic and arch helpers 106 * Generic and arch helpers
@@ -148,6 +149,7 @@ smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,
148} 149}
149 150
150static inline void kick_all_cpus_sync(void) { } 151static inline void kick_all_cpus_sync(void) { }
152static inline void wake_up_all_idle_cpus(void) { }
151 153
152#endif /* !SMP */ 154#endif /* !SMP */
153 155
diff --git a/include/linux/soc/ti/knav_dma.h b/include/linux/soc/ti/knav_dma.h
new file mode 100644
index 000000000000..dad035c16d94
--- /dev/null
+++ b/include/linux/soc/ti/knav_dma.h
@@ -0,0 +1,175 @@
1/*
2 * Copyright (C) 2014 Texas Instruments Incorporated
3 * Authors: Sandeep Nair <sandeep_n@ti.com
4 * Cyril Chemparathy <cyril@ti.com
5 Santosh Shilimkar <santosh.shilimkar@ti.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 as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__
18#define __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__
19
20/*
21 * PKTDMA descriptor manipulation macros for host packet descriptor
22 */
23#define MASK(x) (BIT(x) - 1)
24#define KNAV_DMA_DESC_PKT_LEN_MASK MASK(22)
25#define KNAV_DMA_DESC_PKT_LEN_SHIFT 0
26#define KNAV_DMA_DESC_PS_INFO_IN_SOP BIT(22)
27#define KNAV_DMA_DESC_PS_INFO_IN_DESC 0
28#define KNAV_DMA_DESC_TAG_MASK MASK(8)
29#define KNAV_DMA_DESC_SAG_HI_SHIFT 24
30#define KNAV_DMA_DESC_STAG_LO_SHIFT 16
31#define KNAV_DMA_DESC_DTAG_HI_SHIFT 8
32#define KNAV_DMA_DESC_DTAG_LO_SHIFT 0
33#define KNAV_DMA_DESC_HAS_EPIB BIT(31)
34#define KNAV_DMA_DESC_NO_EPIB 0
35#define KNAV_DMA_DESC_PSLEN_SHIFT 24
36#define KNAV_DMA_DESC_PSLEN_MASK MASK(6)
37#define KNAV_DMA_DESC_ERR_FLAG_SHIFT 20
38#define KNAV_DMA_DESC_ERR_FLAG_MASK MASK(4)
39#define KNAV_DMA_DESC_PSFLAG_SHIFT 16
40#define KNAV_DMA_DESC_PSFLAG_MASK MASK(4)
41#define KNAV_DMA_DESC_RETQ_SHIFT 0
42#define KNAV_DMA_DESC_RETQ_MASK MASK(14)
43#define KNAV_DMA_DESC_BUF_LEN_MASK MASK(22)
44
45#define KNAV_DMA_NUM_EPIB_WORDS 4
46#define KNAV_DMA_NUM_PS_WORDS 16
47#define KNAV_DMA_FDQ_PER_CHAN 4
48
49/* Tx channel scheduling priority */
50enum knav_dma_tx_priority {
51 DMA_PRIO_HIGH = 0,
52 DMA_PRIO_MED_H,
53 DMA_PRIO_MED_L,
54 DMA_PRIO_LOW
55};
56
57/* Rx channel error handling mode during buffer starvation */
58enum knav_dma_rx_err_mode {
59 DMA_DROP = 0,
60 DMA_RETRY
61};
62
63/* Rx flow size threshold configuration */
64enum knav_dma_rx_thresholds {
65 DMA_THRESH_NONE = 0,
66 DMA_THRESH_0 = 1,
67 DMA_THRESH_0_1 = 3,
68 DMA_THRESH_0_1_2 = 7
69};
70
71/* Descriptor type */
72enum knav_dma_desc_type {
73 DMA_DESC_HOST = 0,
74 DMA_DESC_MONOLITHIC = 2
75};
76
77/**
78 * struct knav_dma_tx_cfg: Tx channel configuration
79 * @filt_einfo: Filter extended packet info
80 * @filt_pswords: Filter PS words present
81 * @knav_dma_tx_priority: Tx channel scheduling priority
82 */
83struct knav_dma_tx_cfg {
84 bool filt_einfo;
85 bool filt_pswords;
86 enum knav_dma_tx_priority priority;
87};
88
89/**
90 * struct knav_dma_rx_cfg: Rx flow configuration
91 * @einfo_present: Extended packet info present
92 * @psinfo_present: PS words present
93 * @knav_dma_rx_err_mode: Error during buffer starvation
94 * @knav_dma_desc_type: Host or Monolithic desc
95 * @psinfo_at_sop: PS word located at start of packet
96 * @sop_offset: Start of packet offset
97 * @dst_q: Destination queue for a given flow
98 * @thresh: Rx flow size threshold
99 * @fdq[]: Free desc Queue array
100 * @sz_thresh0: RX packet size threshold 0
101 * @sz_thresh1: RX packet size threshold 1
102 * @sz_thresh2: RX packet size threshold 2
103 */
104struct knav_dma_rx_cfg {
105 bool einfo_present;
106 bool psinfo_present;
107 enum knav_dma_rx_err_mode err_mode;
108 enum knav_dma_desc_type desc_type;
109 bool psinfo_at_sop;
110 unsigned int sop_offset;
111 unsigned int dst_q;
112 enum knav_dma_rx_thresholds thresh;
113 unsigned int fdq[KNAV_DMA_FDQ_PER_CHAN];
114 unsigned int sz_thresh0;
115 unsigned int sz_thresh1;
116 unsigned int sz_thresh2;
117};
118
119/**
120 * struct knav_dma_cfg: Pktdma channel configuration
121 * @sl_cfg: Slave configuration
122 * @tx: Tx channel configuration
123 * @rx: Rx flow configuration
124 */
125struct knav_dma_cfg {
126 enum dma_transfer_direction direction;
127 union {
128 struct knav_dma_tx_cfg tx;
129 struct knav_dma_rx_cfg rx;
130 } u;
131};
132
133/**
134 * struct knav_dma_desc: Host packet descriptor layout
135 * @desc_info: Descriptor information like id, type, length
136 * @tag_info: Flow tag info written in during RX
137 * @packet_info: Queue Manager, policy, flags etc
138 * @buff_len: Buffer length in bytes
139 * @buff: Buffer pointer
140 * @next_desc: For chaining the descriptors
141 * @orig_len: length since 'buff_len' can be overwritten
142 * @orig_buff: buff pointer since 'buff' can be overwritten
143 * @epib: Extended packet info block
144 * @psdata: Protocol specific
145 */
146struct knav_dma_desc {
147 u32 desc_info;
148 u32 tag_info;
149 u32 packet_info;
150 u32 buff_len;
151 u32 buff;
152 u32 next_desc;
153 u32 orig_len;
154 u32 orig_buff;
155 u32 epib[KNAV_DMA_NUM_EPIB_WORDS];
156 u32 psdata[KNAV_DMA_NUM_PS_WORDS];
157 u32 pad[4];
158} ____cacheline_aligned;
159
160#if IS_ENABLED(CONFIG_KEYSTONE_NAVIGATOR_DMA)
161void *knav_dma_open_channel(struct device *dev, const char *name,
162 struct knav_dma_cfg *config);
163void knav_dma_close_channel(void *channel);
164#else
165static inline void *knav_dma_open_channel(struct device *dev, const char *name,
166 struct knav_dma_cfg *config)
167{
168 return (void *) NULL;
169}
170static inline void knav_dma_close_channel(void *channel)
171{}
172
173#endif
174
175#endif /* __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__ */
diff --git a/include/linux/soc/ti/knav_qmss.h b/include/linux/soc/ti/knav_qmss.h
new file mode 100644
index 000000000000..9f0ebb3bad27
--- /dev/null
+++ b/include/linux/soc/ti/knav_qmss.h
@@ -0,0 +1,90 @@
1/*
2 * Keystone Navigator Queue Management Sub-System header
3 *
4 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
5 * Author: Sandeep Nair <sandeep_n@ti.com>
6 * Cyril Chemparathy <cyril@ti.com>
7 * Santosh Shilimkar <santosh.shilimkar@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#ifndef __SOC_TI_KNAV_QMSS_H__
20#define __SOC_TI_KNAV_QMSS_H__
21
22#include <linux/err.h>
23#include <linux/time.h>
24#include <linux/atomic.h>
25#include <linux/device.h>
26#include <linux/fcntl.h>
27#include <linux/dma-mapping.h>
28
29/* queue types */
30#define KNAV_QUEUE_QPEND ((unsigned)-2) /* interruptible qpend queue */
31#define KNAV_QUEUE_ACC ((unsigned)-3) /* Accumulated queue */
32#define KNAV_QUEUE_GP ((unsigned)-4) /* General purpose queue */
33
34/* queue flags */
35#define KNAV_QUEUE_SHARED 0x0001 /* Queue can be shared */
36
37/**
38 * enum knav_queue_ctrl_cmd - queue operations.
39 * @KNAV_QUEUE_GET_ID: Get the ID number for an open queue
40 * @KNAV_QUEUE_FLUSH: forcibly empty a queue if possible
41 * @KNAV_QUEUE_SET_NOTIFIER: Set a notifier callback to a queue handle.
42 * @KNAV_QUEUE_ENABLE_NOTIFY: Enable notifier callback for a queue handle.
43 * @KNAV_QUEUE_DISABLE_NOTIFY: Disable notifier callback for a queue handle.
44 * @KNAV_QUEUE_GET_COUNT: Get number of queues.
45 */
46enum knav_queue_ctrl_cmd {
47 KNAV_QUEUE_GET_ID,
48 KNAV_QUEUE_FLUSH,
49 KNAV_QUEUE_SET_NOTIFIER,
50 KNAV_QUEUE_ENABLE_NOTIFY,
51 KNAV_QUEUE_DISABLE_NOTIFY,
52 KNAV_QUEUE_GET_COUNT
53};
54
55/* Queue notifier callback prototype */
56typedef void (*knav_queue_notify_fn)(void *arg);
57
58/**
59 * struct knav_queue_notify_config: Notifier configuration
60 * @fn: Notifier function
61 * @fn_arg: Notifier function arguments
62 */
63struct knav_queue_notify_config {
64 knav_queue_notify_fn fn;
65 void *fn_arg;
66};
67
68void *knav_queue_open(const char *name, unsigned id,
69 unsigned flags);
70void knav_queue_close(void *qhandle);
71int knav_queue_device_control(void *qhandle,
72 enum knav_queue_ctrl_cmd cmd,
73 unsigned long arg);
74dma_addr_t knav_queue_pop(void *qhandle, unsigned *size);
75int knav_queue_push(void *qhandle, dma_addr_t dma,
76 unsigned size, unsigned flags);
77
78void *knav_pool_create(const char *name,
79 int num_desc, int region_id);
80void knav_pool_destroy(void *ph);
81int knav_pool_count(void *ph);
82void *knav_pool_desc_get(void *ph);
83void knav_pool_desc_put(void *ph, void *desc);
84int knav_pool_desc_map(void *ph, void *desc, unsigned size,
85 dma_addr_t *dma, unsigned *dma_sz);
86void *knav_pool_desc_unmap(void *ph, dma_addr_t dma, unsigned dma_sz);
87dma_addr_t knav_pool_desc_virt_to_dma(void *ph, void *virt);
88void *knav_pool_desc_dma_to_virt(void *ph, dma_addr_t dma);
89
90#endif /* __SOC_TI_KNAV_QMSS_H__ */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index ec538fc287a6..bb9b83640070 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -256,7 +256,7 @@ struct ucred {
256#define MSG_EOF MSG_FIN 256#define MSG_EOF MSG_FIN
257 257
258#define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */ 258#define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */
259#define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file 259#define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exec for file
260 descriptor received through 260 descriptor received through
261 SCM_RIGHTS */ 261 SCM_RIGHTS */
262#if defined(CONFIG_COMPAT) 262#if defined(CONFIG_COMPAT)
diff --git a/include/linux/spi/mcp23s08.h b/include/linux/spi/mcp23s08.h
index 2d676d5aaa89..aa07d7b32568 100644
--- a/include/linux/spi/mcp23s08.h
+++ b/include/linux/spi/mcp23s08.h
@@ -22,4 +22,22 @@ struct mcp23s08_platform_data {
22 * base to base+15 (or base+31 for s17 variant). 22 * base to base+15 (or base+31 for s17 variant).
23 */ 23 */
24 unsigned base; 24 unsigned base;
25 /* Marks the device as a interrupt controller.
26 * NOTE: The interrupt functionality is only supported for i2c
27 * versions of the chips. The spi chips can also do the interrupts,
28 * but this is not supported by the linux driver yet.
29 */
30 bool irq_controller;
31
32 /* Sets the mirror flag in the IOCON register. Devices
33 * with two interrupt outputs (these are the devices ending with 17 and
34 * those that have 16 IOs) have two IO banks: IO 0-7 form bank 1 and
35 * IO 8-15 are bank 2. These chips have two different interrupt outputs:
36 * One for bank 1 and another for bank 2. If irq-mirror is set, both
37 * interrupts are generated regardless of the bank that an input change
38 * occurred on. If it is not set, the interrupt are only generated for
39 * the bank they belong to.
40 * On devices with only one interrupt output this property is useless.
41 */
42 bool mirror;
25}; 43};
diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h
index 82d5111cd0c2..d5a316550177 100644
--- a/include/linux/spi/pxa2xx_spi.h
+++ b/include/linux/spi/pxa2xx_spi.h
@@ -23,6 +23,8 @@
23#define PXA2XX_CS_ASSERT (0x01) 23#define PXA2XX_CS_ASSERT (0x01)
24#define PXA2XX_CS_DEASSERT (0x02) 24#define PXA2XX_CS_DEASSERT (0x02)
25 25
26struct dma_chan;
27
26/* device.platform_data for SSP controller devices */ 28/* device.platform_data for SSP controller devices */
27struct pxa2xx_spi_master { 29struct pxa2xx_spi_master {
28 u32 clock_enable; 30 u32 clock_enable;
@@ -30,10 +32,9 @@ struct pxa2xx_spi_master {
30 u8 enable_dma; 32 u8 enable_dma;
31 33
32 /* DMA engine specific config */ 34 /* DMA engine specific config */
33 int rx_chan_id; 35 bool (*dma_filter)(struct dma_chan *chan, void *param);
34 int tx_chan_id; 36 void *tx_param;
35 int rx_slave_id; 37 void *rx_param;
36 int tx_slave_id;
37 38
38 /* For non-PXA arches */ 39 /* For non-PXA arches */
39 struct ssp_device ssp; 40 struct ssp_device ssp;
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index e713543336f1..46d188a9947c 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -253,6 +253,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
253 * the device whose settings are being modified. 253 * the device whose settings are being modified.
254 * @transfer: adds a message to the controller's transfer queue. 254 * @transfer: adds a message to the controller's transfer queue.
255 * @cleanup: frees controller-specific state 255 * @cleanup: frees controller-specific state
256 * @can_dma: determine whether this master supports DMA
256 * @queued: whether this master is providing an internal message queue 257 * @queued: whether this master is providing an internal message queue
257 * @kworker: thread struct for message pump 258 * @kworker: thread struct for message pump
258 * @kworker_task: pointer to task for message pump kworker thread 259 * @kworker_task: pointer to task for message pump kworker thread
@@ -262,6 +263,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
262 * @cur_msg: the currently in-flight message 263 * @cur_msg: the currently in-flight message
263 * @cur_msg_prepared: spi_prepare_message was called for the currently 264 * @cur_msg_prepared: spi_prepare_message was called for the currently
264 * in-flight message 265 * in-flight message
266 * @cur_msg_mapped: message has been mapped for DMA
265 * @xfer_completion: used by core transfer_one_message() 267 * @xfer_completion: used by core transfer_one_message()
266 * @busy: message pump is busy 268 * @busy: message pump is busy
267 * @running: message pump is running 269 * @running: message pump is running
@@ -299,6 +301,10 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
299 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS 301 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
300 * number. Any individual value may be -ENOENT for CS lines that 302 * number. Any individual value may be -ENOENT for CS lines that
301 * are not GPIOs (driven by the SPI controller itself). 303 * are not GPIOs (driven by the SPI controller itself).
304 * @dma_tx: DMA transmit channel
305 * @dma_rx: DMA receive channel
306 * @dummy_rx: dummy receive buffer for full-duplex devices
307 * @dummy_tx: dummy transmit buffer for full-duplex devices
302 * 308 *
303 * Each SPI master controller can communicate with one or more @spi_device 309 * Each SPI master controller can communicate with one or more @spi_device
304 * children. These make a small bus, sharing MOSI, MISO and SCK signals 310 * children. These make a small bus, sharing MOSI, MISO and SCK signals
@@ -632,6 +638,7 @@ struct spi_transfer {
632 * addresses for each transfer buffer 638 * addresses for each transfer buffer
633 * @complete: called to report transaction completions 639 * @complete: called to report transaction completions
634 * @context: the argument to complete() when it's called 640 * @context: the argument to complete() when it's called
641 * @frame_length: the total number of bytes in the message
635 * @actual_length: the total number of bytes that were transferred in all 642 * @actual_length: the total number of bytes that were transferred in all
636 * successful segments 643 * successful segments
637 * @status: zero for success, else negative errno 644 * @status: zero for success, else negative errno
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 3f2867ff0ced..262ba4ef9a8e 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -197,7 +197,13 @@ static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock)
197 _raw_spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \ 197 _raw_spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \
198 } while (0) 198 } while (0)
199#else 199#else
200# define raw_spin_lock_nested(lock, subclass) _raw_spin_lock(lock) 200/*
201 * Always evaluate the 'subclass' argument to avoid that the compiler
202 * warns about set-but-not-used variables when building with
203 * CONFIG_DEBUG_LOCK_ALLOC=n and with W=1.
204 */
205# define raw_spin_lock_nested(lock, subclass) \
206 _raw_spin_lock(((void)(subclass), (lock)))
201# define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock) 207# define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock)
202#endif 208#endif
203 209
diff --git a/include/linux/string.h b/include/linux/string.h
index d36977e029af..2e22a2e58f3a 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -41,7 +41,7 @@ extern int strcmp(const char *,const char *);
41extern int strncmp(const char *,const char *,__kernel_size_t); 41extern int strncmp(const char *,const char *,__kernel_size_t);
42#endif 42#endif
43#ifndef __HAVE_ARCH_STRNICMP 43#ifndef __HAVE_ARCH_STRNICMP
44extern int strnicmp(const char *, const char *, __kernel_size_t); 44#define strnicmp strncasecmp
45#endif 45#endif
46#ifndef __HAVE_ARCH_STRCASECMP 46#ifndef __HAVE_ARCH_STRCASECMP
47extern int strcasecmp(const char *s1, const char *s2); 47extern int strcasecmp(const char *s1, const char *s2);
@@ -132,7 +132,7 @@ int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4);
132#endif 132#endif
133 133
134extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, 134extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
135 const void *from, size_t available); 135 const void *from, size_t available);
136 136
137/** 137/**
138 * strstarts - does @str start with @prefix? 138 * strstarts - does @str start with @prefix?
@@ -144,7 +144,8 @@ static inline bool strstarts(const char *str, const char *prefix)
144 return strncmp(str, prefix, strlen(prefix)) == 0; 144 return strncmp(str, prefix, strlen(prefix)) == 0;
145} 145}
146 146
147extern size_t memweight(const void *ptr, size_t bytes); 147size_t memweight(const void *ptr, size_t bytes);
148void memzero_explicit(void *s, size_t count);
148 149
149/** 150/**
150 * kbasename - return the last part of a pathname. 151 * kbasename - return the last part of a pathname.
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index 3eeee9672a4a..6eb567ac56bc 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -20,40 +20,6 @@ int string_get_size(u64 size, enum string_size_units units,
20#define UNESCAPE_ANY \ 20#define UNESCAPE_ANY \
21 (UNESCAPE_SPACE | UNESCAPE_OCTAL | UNESCAPE_HEX | UNESCAPE_SPECIAL) 21 (UNESCAPE_SPACE | UNESCAPE_OCTAL | UNESCAPE_HEX | UNESCAPE_SPECIAL)
22 22
23/**
24 * string_unescape - unquote characters in the given string
25 * @src: source buffer (escaped)
26 * @dst: destination buffer (unescaped)
27 * @size: size of the destination buffer (0 to unlimit)
28 * @flags: combination of the flags (bitwise OR):
29 * %UNESCAPE_SPACE:
30 * '\f' - form feed
31 * '\n' - new line
32 * '\r' - carriage return
33 * '\t' - horizontal tab
34 * '\v' - vertical tab
35 * %UNESCAPE_OCTAL:
36 * '\NNN' - byte with octal value NNN (1 to 3 digits)
37 * %UNESCAPE_HEX:
38 * '\xHH' - byte with hexadecimal value HH (1 to 2 digits)
39 * %UNESCAPE_SPECIAL:
40 * '\"' - double quote
41 * '\\' - backslash
42 * '\a' - alert (BEL)
43 * '\e' - escape
44 * %UNESCAPE_ANY:
45 * all previous together
46 *
47 * Returns amount of characters processed to the destination buffer excluding
48 * trailing '\0'.
49 *
50 * Because the size of the output will be the same as or less than the size of
51 * the input, the transformation may be performed in place.
52 *
53 * Caller must provide valid source and destination pointers. Be aware that
54 * destination buffer will always be NULL-terminated. Source string must be
55 * NULL-terminated as well.
56 */
57int string_unescape(char *src, char *dst, size_t size, unsigned int flags); 23int string_unescape(char *src, char *dst, size_t size, unsigned int flags);
58 24
59static inline int string_unescape_inplace(char *buf, unsigned int flags) 25static inline int string_unescape_inplace(char *buf, unsigned int flags)
@@ -71,4 +37,35 @@ static inline int string_unescape_any_inplace(char *buf)
71 return string_unescape_any(buf, buf, 0); 37 return string_unescape_any(buf, buf, 0);
72} 38}
73 39
40#define ESCAPE_SPACE 0x01
41#define ESCAPE_SPECIAL 0x02
42#define ESCAPE_NULL 0x04
43#define ESCAPE_OCTAL 0x08
44#define ESCAPE_ANY \
45 (ESCAPE_SPACE | ESCAPE_OCTAL | ESCAPE_SPECIAL | ESCAPE_NULL)
46#define ESCAPE_NP 0x10
47#define ESCAPE_ANY_NP (ESCAPE_ANY | ESCAPE_NP)
48#define ESCAPE_HEX 0x20
49
50int string_escape_mem(const char *src, size_t isz, char **dst, size_t osz,
51 unsigned int flags, const char *esc);
52
53static inline int string_escape_mem_any_np(const char *src, size_t isz,
54 char **dst, size_t osz, const char *esc)
55{
56 return string_escape_mem(src, isz, dst, osz, ESCAPE_ANY_NP, esc);
57}
58
59static inline int string_escape_str(const char *src, char **dst, size_t sz,
60 unsigned int flags, const char *esc)
61{
62 return string_escape_mem(src, strlen(src), dst, sz, flags, esc);
63}
64
65static inline int string_escape_str_any_np(const char *src, char **dst,
66 size_t sz, const char *esc)
67{
68 return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, esc);
69}
70
74#endif 71#endif
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 790be1472792..8e030075fe79 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -103,6 +103,7 @@ struct rpc_auth_create_args {
103 103
104/* Flags for rpcauth_lookupcred() */ 104/* Flags for rpcauth_lookupcred() */
105#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */ 105#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */
106#define RPCAUTH_LOOKUP_RCU 0x02 /* lock-less lookup */
106 107
107/* 108/*
108 * Client authentication ops 109 * Client authentication ops
@@ -140,6 +141,7 @@ struct rpc_credops {
140 void *, __be32 *, void *); 141 void *, __be32 *, void *);
141 int (*crkey_timeout)(struct rpc_cred *); 142 int (*crkey_timeout)(struct rpc_cred *);
142 bool (*crkey_to_expire)(struct rpc_cred *); 143 bool (*crkey_to_expire)(struct rpc_cred *);
144 char * (*crstringify_acceptor)(struct rpc_cred *);
143}; 145};
144 146
145extern const struct rpc_authops authunix_ops; 147extern const struct rpc_authops authunix_ops;
@@ -153,6 +155,7 @@ void rpc_destroy_generic_auth(void);
153void rpc_destroy_authunix(void); 155void rpc_destroy_authunix(void);
154 156
155struct rpc_cred * rpc_lookup_cred(void); 157struct rpc_cred * rpc_lookup_cred(void);
158struct rpc_cred * rpc_lookup_cred_nonblock(void);
156struct rpc_cred * rpc_lookup_machine_cred(const char *service_name); 159struct rpc_cred * rpc_lookup_machine_cred(const char *service_name);
157int rpcauth_register(const struct rpc_authops *); 160int rpcauth_register(const struct rpc_authops *);
158int rpcauth_unregister(const struct rpc_authops *); 161int rpcauth_unregister(const struct rpc_authops *);
@@ -182,6 +185,7 @@ void rpcauth_clear_credcache(struct rpc_cred_cache *);
182int rpcauth_key_timeout_notify(struct rpc_auth *, 185int rpcauth_key_timeout_notify(struct rpc_auth *,
183 struct rpc_cred *); 186 struct rpc_cred *);
184bool rpcauth_cred_key_to_expire(struct rpc_cred *); 187bool rpcauth_cred_key_to_expire(struct rpc_cred *);
188char * rpcauth_stringify_acceptor(struct rpc_cred *);
185 189
186static inline 190static inline
187struct rpc_cred * get_rpccred(struct rpc_cred *cred) 191struct rpc_cred * get_rpccred(struct rpc_cred *cred)
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index f1cfd4c85cd0..36eebc451b41 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -69,8 +69,9 @@ struct gss_cl_ctx {
69 enum rpc_gss_proc gc_proc; 69 enum rpc_gss_proc gc_proc;
70 u32 gc_seq; 70 u32 gc_seq;
71 spinlock_t gc_seq_lock; 71 spinlock_t gc_seq_lock;
72 struct gss_ctx __rcu *gc_gss_ctx; 72 struct gss_ctx *gc_gss_ctx;
73 struct xdr_netobj gc_wire_ctx; 73 struct xdr_netobj gc_wire_ctx;
74 struct xdr_netobj gc_acceptor;
74 u32 gc_win; 75 u32 gc_win;
75 unsigned long gc_expiry; 76 unsigned long gc_expiry;
76 struct rcu_head gc_rcu; 77 struct rcu_head gc_rcu;
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index 5af2931cf58d..df02a4188487 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -81,7 +81,7 @@ struct gss_krb5_enctype {
81 struct xdr_netobj *in, 81 struct xdr_netobj *in,
82 struct xdr_netobj *out); /* complete key generation */ 82 struct xdr_netobj *out); /* complete key generation */
83 u32 (*encrypt_v2) (struct krb5_ctx *kctx, u32 offset, 83 u32 (*encrypt_v2) (struct krb5_ctx *kctx, u32 offset,
84 struct xdr_buf *buf, int ec, 84 struct xdr_buf *buf,
85 struct page **pages); /* v2 encryption function */ 85 struct page **pages); /* v2 encryption function */
86 u32 (*decrypt_v2) (struct krb5_ctx *kctx, u32 offset, 86 u32 (*decrypt_v2) (struct krb5_ctx *kctx, u32 offset,
87 struct xdr_buf *buf, u32 *headskip, 87 struct xdr_buf *buf, u32 *headskip,
@@ -310,7 +310,7 @@ gss_krb5_aes_make_key(const struct gss_krb5_enctype *gk5e,
310 310
311u32 311u32
312gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset, 312gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset,
313 struct xdr_buf *buf, int ec, 313 struct xdr_buf *buf,
314 struct page **pages); 314 struct page **pages);
315 315
316u32 316u32
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 1bc7cd05b22e..21678464883a 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -236,7 +236,7 @@ struct svc_rqst {
236 struct svc_cred rq_cred; /* auth info */ 236 struct svc_cred rq_cred; /* auth info */
237 void * rq_xprt_ctxt; /* transport specific context ptr */ 237 void * rq_xprt_ctxt; /* transport specific context ptr */
238 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ 238 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */
239 int rq_usedeferral; /* use deferral */ 239 bool rq_usedeferral; /* use deferral */
240 240
241 size_t rq_xprt_hlen; /* xprt header len */ 241 size_t rq_xprt_hlen; /* xprt header len */
242 struct xdr_buf rq_arg; 242 struct xdr_buf rq_arg;
@@ -277,10 +277,9 @@ struct svc_rqst {
277 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */ 277 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */
278 int rq_cachetype; 278 int rq_cachetype;
279 struct svc_cacherep * rq_cacherep; /* cache info */ 279 struct svc_cacherep * rq_cacherep; /* cache info */
280 int rq_splice_ok; /* turned off in gss privacy 280 bool rq_splice_ok; /* turned off in gss privacy
281 * to prevent encrypting page 281 * to prevent encrypting page
282 * cache pages */ 282 * cache pages */
283 wait_queue_head_t rq_wait; /* synchronization */
284 struct task_struct *rq_task; /* service thread */ 283 struct task_struct *rq_task; /* service thread */
285}; 284};
286 285
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index 5cf99a016368..975da754c778 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -174,8 +174,7 @@ struct svcxprt_rdma {
174 * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ. */ 174 * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ. */
175#define RPCRDMA_ORD (64/4) 175#define RPCRDMA_ORD (64/4)
176#define RPCRDMA_SQ_DEPTH_MULT 8 176#define RPCRDMA_SQ_DEPTH_MULT 8
177#define RPCRDMA_MAX_THREADS 16 177#define RPCRDMA_MAX_REQUESTS 32
178#define RPCRDMA_MAX_REQUESTS 16
179#define RPCRDMA_MAX_REQ_SIZE 4096 178#define RPCRDMA_MAX_REQ_SIZE 4096
180 179
181/* svc_rdma_marshal.c */ 180/* svc_rdma_marshal.c */
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 7235040a19b2..ce6e4182a5b2 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -25,6 +25,7 @@ struct svc_xprt_ops {
25 void (*xpo_detach)(struct svc_xprt *); 25 void (*xpo_detach)(struct svc_xprt *);
26 void (*xpo_free)(struct svc_xprt *); 26 void (*xpo_free)(struct svc_xprt *);
27 int (*xpo_secure_port)(struct svc_rqst *); 27 int (*xpo_secure_port)(struct svc_rqst *);
28 void (*xpo_adjust_wspace)(struct svc_xprt *);
28}; 29};
29 30
30struct svc_xprt_class { 31struct svc_xprt_class {
@@ -33,6 +34,7 @@ struct svc_xprt_class {
33 struct svc_xprt_ops *xcl_ops; 34 struct svc_xprt_ops *xcl_ops;
34 struct list_head xcl_list; 35 struct list_head xcl_list;
35 u32 xcl_max_payload; 36 u32 xcl_max_payload;
37 int xcl_ident;
36}; 38};
37 39
38/* 40/*
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index fcbfe8783243..cf391eef2e6d 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -357,6 +357,7 @@ int xs_swapper(struct rpc_xprt *xprt, int enable);
357#define XPRT_CONNECTION_ABORT (7) 357#define XPRT_CONNECTION_ABORT (7)
358#define XPRT_CONNECTION_CLOSE (8) 358#define XPRT_CONNECTION_CLOSE (8)
359#define XPRT_CONGESTED (9) 359#define XPRT_CONGESTED (9)
360#define XPRT_CONNECTION_REUSE (10)
360 361
361static inline void xprt_set_connected(struct rpc_xprt *xprt) 362static inline void xprt_set_connected(struct rpc_xprt *xprt)
362{ 363{
diff --git a/include/linux/sunrpc/xprtrdma.h b/include/linux/sunrpc/xprtrdma.h
index c2f04e1ae159..64a0a0a97b23 100644
--- a/include/linux/sunrpc/xprtrdma.h
+++ b/include/linux/sunrpc/xprtrdma.h
@@ -62,8 +62,6 @@
62#define RPCRDMA_INLINE_PAD_THRESH (512)/* payload threshold to pad (bytes) */ 62#define RPCRDMA_INLINE_PAD_THRESH (512)/* payload threshold to pad (bytes) */
63 63
64/* memory registration strategies */ 64/* memory registration strategies */
65#define RPCRDMA_PERSISTENT_REGISTRATION (1)
66
67enum rpcrdma_memreg { 65enum rpcrdma_memreg {
68 RPCRDMA_BOUNCEBUFFERS = 0, 66 RPCRDMA_BOUNCEBUFFERS = 0,
69 RPCRDMA_REGISTER, 67 RPCRDMA_REGISTER,
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 519064e0c943..3388c1b6f7d8 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -189,6 +189,8 @@ struct platform_suspend_ops {
189 189
190struct platform_freeze_ops { 190struct platform_freeze_ops {
191 int (*begin)(void); 191 int (*begin)(void);
192 int (*prepare)(void);
193 void (*restore)(void);
192 void (*end)(void); 194 void (*end)(void);
193}; 195};
194 196
@@ -371,6 +373,8 @@ extern int unregister_pm_notifier(struct notifier_block *nb);
371extern bool events_check_enabled; 373extern bool events_check_enabled;
372 374
373extern bool pm_wakeup_pending(void); 375extern bool pm_wakeup_pending(void);
376extern void pm_system_wakeup(void);
377extern void pm_wakeup_clear(void);
374extern bool pm_get_wakeup_count(unsigned int *count, bool block); 378extern bool pm_get_wakeup_count(unsigned int *count, bool block);
375extern bool pm_save_wakeup_count(unsigned int count); 379extern bool pm_save_wakeup_count(unsigned int count);
376extern void pm_wakep_autosleep_enabled(bool set); 380extern void pm_wakep_autosleep_enabled(bool set);
@@ -418,6 +422,8 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
418#define pm_notifier(fn, pri) do { (void)(fn); } while (0) 422#define pm_notifier(fn, pri) do { (void)(fn); } while (0)
419 423
420static inline bool pm_wakeup_pending(void) { return false; } 424static inline bool pm_wakeup_pending(void) { return false; }
425static inline void pm_system_wakeup(void) {}
426static inline void pm_wakeup_clear(void) {}
421 427
422static inline void lock_system_sleep(void) {} 428static inline void lock_system_sleep(void) {}
423static inline void unlock_system_sleep(void) {} 429static inline void unlock_system_sleep(void) {}
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 4bdbee80eede..37a585beef5c 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -311,7 +311,6 @@ extern void lru_add_page_tail(struct page *page, struct page *page_tail,
311 struct lruvec *lruvec, struct list_head *head); 311 struct lruvec *lruvec, struct list_head *head);
312extern void activate_page(struct page *); 312extern void activate_page(struct page *);
313extern void mark_page_accessed(struct page *); 313extern void mark_page_accessed(struct page *);
314extern void init_page_accessed(struct page *page);
315extern void lru_add_drain(void); 314extern void lru_add_drain(void);
316extern void lru_add_drain_cpu(int cpu); 315extern void lru_add_drain_cpu(int cpu);
317extern void lru_add_drain_all(void); 316extern void lru_add_drain_all(void);
@@ -321,12 +320,17 @@ extern void swap_setup(void);
321 320
322extern void add_page_to_unevictable_list(struct page *page); 321extern void add_page_to_unevictable_list(struct page *page);
323 322
323extern void lru_cache_add_active_or_unevictable(struct page *page,
324 struct vm_area_struct *vma);
325
324/* linux/mm/vmscan.c */ 326/* linux/mm/vmscan.c */
325extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 327extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
326 gfp_t gfp_mask, nodemask_t *mask); 328 gfp_t gfp_mask, nodemask_t *mask);
327extern int __isolate_lru_page(struct page *page, isolate_mode_t mode); 329extern int __isolate_lru_page(struct page *page, isolate_mode_t mode);
328extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 330extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
329 gfp_t gfp_mask, bool noswap); 331 unsigned long nr_pages,
332 gfp_t gfp_mask,
333 bool may_swap);
330extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, 334extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
331 gfp_t gfp_mask, bool noswap, 335 gfp_t gfp_mask, bool noswap,
332 struct zone *zone, 336 struct zone *zone,
@@ -352,22 +356,6 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
352extern int page_evictable(struct page *page); 356extern int page_evictable(struct page *page);
353extern void check_move_unevictable_pages(struct page **, int nr_pages); 357extern void check_move_unevictable_pages(struct page **, int nr_pages);
354 358
355extern unsigned long scan_unevictable_pages;
356extern int scan_unevictable_handler(struct ctl_table *, int,
357 void __user *, size_t *, loff_t *);
358#ifdef CONFIG_NUMA
359extern int scan_unevictable_register_node(struct node *node);
360extern void scan_unevictable_unregister_node(struct node *node);
361#else
362static inline int scan_unevictable_register_node(struct node *node)
363{
364 return 0;
365}
366static inline void scan_unevictable_unregister_node(struct node *node)
367{
368}
369#endif
370
371extern int kswapd_run(int nid); 359extern int kswapd_run(int nid);
372extern void kswapd_stop(int nid); 360extern void kswapd_stop(int nid);
373#ifdef CONFIG_MEMCG 361#ifdef CONFIG_MEMCG
@@ -379,9 +367,13 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
379} 367}
380#endif 368#endif
381#ifdef CONFIG_MEMCG_SWAP 369#ifdef CONFIG_MEMCG_SWAP
382extern void mem_cgroup_uncharge_swap(swp_entry_t ent); 370extern void mem_cgroup_swapout(struct page *page, swp_entry_t entry);
371extern void mem_cgroup_uncharge_swap(swp_entry_t entry);
383#else 372#else
384static inline void mem_cgroup_uncharge_swap(swp_entry_t ent) 373static inline void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
374{
375}
376static inline void mem_cgroup_uncharge_swap(swp_entry_t entry)
385{ 377{
386} 378}
387#endif 379#endif
@@ -441,7 +433,7 @@ extern void swap_shmem_alloc(swp_entry_t);
441extern int swap_duplicate(swp_entry_t); 433extern int swap_duplicate(swp_entry_t);
442extern int swapcache_prepare(swp_entry_t); 434extern int swapcache_prepare(swp_entry_t);
443extern void swap_free(swp_entry_t); 435extern void swap_free(swp_entry_t);
444extern void swapcache_free(swp_entry_t, struct page *page); 436extern void swapcache_free(swp_entry_t);
445extern int free_swap_and_cache(swp_entry_t); 437extern int free_swap_and_cache(swp_entry_t);
446extern int swap_type_of(dev_t, sector_t, struct block_device **); 438extern int swap_type_of(dev_t, sector_t, struct block_device **);
447extern unsigned int count_swap_pages(int, int); 439extern unsigned int count_swap_pages(int, int);
@@ -505,7 +497,7 @@ static inline void swap_free(swp_entry_t swp)
505{ 497{
506} 498}
507 499
508static inline void swapcache_free(swp_entry_t swp, struct page *page) 500static inline void swapcache_free(swp_entry_t swp)
509{ 501{
510} 502}
511 503
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 701daff5d899..bda9b81357cc 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -65,6 +65,7 @@ struct old_linux_dirent;
65struct perf_event_attr; 65struct perf_event_attr;
66struct file_handle; 66struct file_handle;
67struct sigaltstack; 67struct sigaltstack;
68union bpf_attr;
68 69
69#include <linux/types.h> 70#include <linux/types.h>
70#include <linux/aio_abi.h> 71#include <linux/aio_abi.h>
@@ -317,6 +318,10 @@ asmlinkage long sys_restart_syscall(void);
317asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, 318asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
318 struct kexec_segment __user *segments, 319 struct kexec_segment __user *segments,
319 unsigned long flags); 320 unsigned long flags);
321asmlinkage long sys_kexec_file_load(int kernel_fd, int initrd_fd,
322 unsigned long cmdline_len,
323 const char __user *cmdline_ptr,
324 unsigned long flags);
320 325
321asmlinkage long sys_exit(int error_code); 326asmlinkage long sys_exit(int error_code);
322asmlinkage long sys_exit_group(int error_code); 327asmlinkage long sys_exit_group(int error_code);
@@ -802,6 +807,7 @@ asmlinkage long sys_timerfd_settime(int ufd, int flags,
802asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr); 807asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr);
803asmlinkage long sys_eventfd(unsigned int count); 808asmlinkage long sys_eventfd(unsigned int count);
804asmlinkage long sys_eventfd2(unsigned int count, int flags); 809asmlinkage long sys_eventfd2(unsigned int count, int flags);
810asmlinkage long sys_memfd_create(const char __user *uname_ptr, unsigned int flags);
805asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len); 811asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
806asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int); 812asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int);
807asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *, 813asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
@@ -870,5 +876,5 @@ asmlinkage long sys_seccomp(unsigned int op, unsigned int flags,
870 const char __user *uargs); 876 const char __user *uargs);
871asmlinkage long sys_getrandom(char __user *buf, size_t count, 877asmlinkage long sys_getrandom(char __user *buf, size_t count,
872 unsigned int flags); 878 unsigned int flags);
873 879asmlinkage long sys_bpf(int cmd, union bpf_attr *attr, unsigned int size);
874#endif 880#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 14a8ff2de11e..b7361f831226 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -34,8 +34,6 @@ struct ctl_table_root;
34struct ctl_table_header; 34struct ctl_table_header;
35struct ctl_dir; 35struct ctl_dir;
36 36
37typedef struct ctl_table ctl_table;
38
39typedef int proc_handler (struct ctl_table *ctl, int write, 37typedef int proc_handler (struct ctl_table *ctl, int write,
40 void __user *buffer, size_t *lenp, loff_t *ppos); 38 void __user *buffer, size_t *lenp, loff_t *ppos);
41 39
diff --git a/include/linux/t10-pi.h b/include/linux/t10-pi.h
new file mode 100644
index 000000000000..6a8b9942632d
--- /dev/null
+++ b/include/linux/t10-pi.h
@@ -0,0 +1,22 @@
1#ifndef _LINUX_T10_PI_H
2#define _LINUX_T10_PI_H
3
4#include <linux/types.h>
5#include <linux/blkdev.h>
6
7/*
8 * T10 Protection Information tuple.
9 */
10struct t10_pi_tuple {
11 __be16 guard_tag; /* Checksum */
12 __be16 app_tag; /* Opaque storage */
13 __be32 ref_tag; /* Target LBA or indirect LBA */
14};
15
16
17extern struct blk_integrity t10_pi_type1_crc;
18extern struct blk_integrity t10_pi_type1_ip;
19extern struct blk_integrity t10_pi_type3_crc;
20extern struct blk_integrity t10_pi_type3_ip;
21
22#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index fa5258f322e7..c2dee7deefa8 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -19,7 +19,6 @@
19 19
20 20
21#include <linux/skbuff.h> 21#include <linux/skbuff.h>
22#include <linux/dmaengine.h>
23#include <net/sock.h> 22#include <net/sock.h>
24#include <net/inet_connection_sock.h> 23#include <net/inet_connection_sock.h>
25#include <net/inet_timewait_sock.h> 24#include <net/inet_timewait_sock.h>
@@ -166,13 +165,6 @@ struct tcp_sock {
166 struct iovec *iov; 165 struct iovec *iov;
167 int memory; 166 int memory;
168 int len; 167 int len;
169#ifdef CONFIG_NET_DMA
170 /* members for async copy */
171 struct dma_chan *dma_chan;
172 int wakeup;
173 struct dma_pinned_list *pinned_list;
174 dma_cookie_t dma_cookie;
175#endif
176 } ucopy; 168 } ucopy;
177 169
178 u32 snd_wl1; /* Sequence for window update */ 170 u32 snd_wl1; /* Sequence for window update */
@@ -276,7 +268,7 @@ struct tcp_sock {
276 u32 retrans_stamp; /* Timestamp of the last retransmit, 268 u32 retrans_stamp; /* Timestamp of the last retransmit,
277 * also used in SYN-SENT to remember stamp of 269 * also used in SYN-SENT to remember stamp of
278 * the first SYN. */ 270 * the first SYN. */
279 u32 undo_marker; /* tracking retrans started here. */ 271 u32 undo_marker; /* snd_una upon a new recovery episode. */
280 int undo_retrans; /* number of undoable retransmissions. */ 272 int undo_retrans; /* number of undoable retransmissions. */
281 u32 total_retrans; /* Total retransmits for entire connection */ 273 u32 total_retrans; /* Total retransmits for entire connection */
282 274
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index f7e11c7ea7d9..ef90838b36a0 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -44,6 +44,10 @@
44#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \ 44#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \
45 ((long)t-2732+5)/10 : ((long)t-2732-5)/10) 45 ((long)t-2732+5)/10 : ((long)t-2732-5)/10)
46#define CELSIUS_TO_KELVIN(t) ((t)*10+2732) 46#define CELSIUS_TO_KELVIN(t) ((t)*10+2732)
47#define DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, off) (((t) - (off)) * 100)
48#define DECI_KELVIN_TO_MILLICELSIUS(t) DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, 2732)
49#define MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, off) (((t) / 100) + (off))
50#define MILLICELSIUS_TO_DECI_KELVIN(t) MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, 2732)
47 51
48/* Adding event notification support elements */ 52/* Adding event notification support elements */
49#define THERMAL_GENL_FAMILY_NAME "thermal_event" 53#define THERMAL_GENL_FAMILY_NAME "thermal_event"
@@ -158,6 +162,42 @@ struct thermal_attr {
158 char name[THERMAL_NAME_LENGTH]; 162 char name[THERMAL_NAME_LENGTH];
159}; 163};
160 164
165/**
166 * struct thermal_zone_device - structure for a thermal zone
167 * @id: unique id number for each thermal zone
168 * @type: the thermal zone device type
169 * @device: &struct device for this thermal zone
170 * @trip_temp_attrs: attributes for trip points for sysfs: trip temperature
171 * @trip_type_attrs: attributes for trip points for sysfs: trip type
172 * @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis
173 * @devdata: private pointer for device private data
174 * @trips: number of trip points the thermal zone supports
175 * @passive_delay: number of milliseconds to wait between polls when
176 * performing passive cooling. Currenty only used by the
177 * step-wise governor
178 * @polling_delay: number of milliseconds to wait between polls when
179 * checking whether trip points have been crossed (0 for
180 * interrupt driven systems)
181 * @temperature: current temperature. This is only for core code,
182 * drivers should use thermal_zone_get_temp() to get the
183 * current temperature
184 * @last_temperature: previous temperature read
185 * @emul_temperature: emulated temperature when using CONFIG_THERMAL_EMULATION
186 * @passive: 1 if you've crossed a passive trip point, 0 otherwise.
187 * Currenty only used by the step-wise governor.
188 * @forced_passive: If > 0, temperature at which to switch on all ACPI
189 * processor cooling devices. Currently only used by the
190 * step-wise governor.
191 * @ops: operations this &thermal_zone_device supports
192 * @tzp: thermal zone parameters
193 * @governor: pointer to the governor for this thermal zone
194 * @thermal_instances: list of &struct thermal_instance of this thermal zone
195 * @idr: &struct idr to generate unique id for this zone's cooling
196 * devices
197 * @lock: lock to protect thermal_instances list
198 * @node: node in thermal_tz_list (in thermal_core.c)
199 * @poll_queue: delayed work for polling
200 */
161struct thermal_zone_device { 201struct thermal_zone_device {
162 int id; 202 int id;
163 char type[THERMAL_NAME_LENGTH]; 203 char type[THERMAL_NAME_LENGTH];
@@ -179,12 +219,18 @@ struct thermal_zone_device {
179 struct thermal_governor *governor; 219 struct thermal_governor *governor;
180 struct list_head thermal_instances; 220 struct list_head thermal_instances;
181 struct idr idr; 221 struct idr idr;
182 struct mutex lock; /* protect thermal_instances list */ 222 struct mutex lock;
183 struct list_head node; 223 struct list_head node;
184 struct delayed_work poll_queue; 224 struct delayed_work poll_queue;
185}; 225};
186 226
187/* Structure that holds thermal governor information */ 227/**
228 * struct thermal_governor - structure that holds thermal governor information
229 * @name: name of the governor
230 * @throttle: callback called for every trip point even if temperature is
231 * below the trip point temperature
232 * @governor_list: node in thermal_governor_list (in thermal_core.c)
233 */
188struct thermal_governor { 234struct thermal_governor {
189 char name[THERMAL_NAME_LENGTH]; 235 char name[THERMAL_NAME_LENGTH];
190 int (*throttle)(struct thermal_zone_device *tz, int trip); 236 int (*throttle)(struct thermal_zone_device *tz, int trip);
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
index 932b76392248..884d6263e962 100644
--- a/include/linux/ti_wilink_st.h
+++ b/include/linux/ti_wilink_st.h
@@ -268,7 +268,7 @@ struct kim_data_s {
268 struct st_data_s *core_data; 268 struct st_data_s *core_data;
269 struct chip_version version; 269 struct chip_version version;
270 unsigned char ldisc_install; 270 unsigned char ldisc_install;
271 unsigned char dev_name[UART_DEV_NAME_LEN]; 271 unsigned char dev_name[UART_DEV_NAME_LEN + 1];
272 unsigned char flow_cntrl; 272 unsigned char flow_cntrl;
273 unsigned long baud_rate; 273 unsigned long baud_rate;
274}; 274};
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 059052306831..eda850ca757a 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -108,7 +108,7 @@ extern struct tick_sched *tick_get_tick_sched(int cpu);
108extern void tick_irq_enter(void); 108extern void tick_irq_enter(void);
109extern int tick_oneshot_mode_active(void); 109extern int tick_oneshot_mode_active(void);
110# ifndef arch_needs_cpu 110# ifndef arch_needs_cpu
111# define arch_needs_cpu(cpu) (0) 111# define arch_needs_cpu() (0)
112# endif 112# endif
113# else 113# else
114static inline void tick_clock_notify(void) { } 114static inline void tick_clock_notify(void) { }
@@ -181,19 +181,12 @@ static inline bool tick_nohz_full_cpu(int cpu)
181 return cpumask_test_cpu(cpu, tick_nohz_full_mask); 181 return cpumask_test_cpu(cpu, tick_nohz_full_mask);
182} 182}
183 183
184extern void tick_nohz_init(void);
185extern void __tick_nohz_full_check(void); 184extern void __tick_nohz_full_check(void);
185extern void tick_nohz_full_kick(void);
186extern void tick_nohz_full_kick_cpu(int cpu); 186extern void tick_nohz_full_kick_cpu(int cpu);
187
188static inline void tick_nohz_full_kick(void)
189{
190 tick_nohz_full_kick_cpu(smp_processor_id());
191}
192
193extern void tick_nohz_full_kick_all(void); 187extern void tick_nohz_full_kick_all(void);
194extern void __tick_nohz_task_switch(struct task_struct *tsk); 188extern void __tick_nohz_task_switch(struct task_struct *tsk);
195#else 189#else
196static inline void tick_nohz_init(void) { }
197static inline bool tick_nohz_full_enabled(void) { return false; } 190static inline bool tick_nohz_full_enabled(void) { return false; }
198static inline bool tick_nohz_full_cpu(int cpu) { return false; } 191static inline bool tick_nohz_full_cpu(int cpu) { return false; }
199static inline void __tick_nohz_full_check(void) { } 192static inline void __tick_nohz_full_check(void) { }
diff --git a/include/linux/topology.h b/include/linux/topology.h
index dda6ee521e74..909b6e43b694 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -119,11 +119,20 @@ static inline int numa_node_id(void)
119 * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem(). 119 * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem().
120 */ 120 */
121DECLARE_PER_CPU(int, _numa_mem_); 121DECLARE_PER_CPU(int, _numa_mem_);
122extern int _node_numa_mem_[MAX_NUMNODES];
122 123
123#ifndef set_numa_mem 124#ifndef set_numa_mem
124static inline void set_numa_mem(int node) 125static inline void set_numa_mem(int node)
125{ 126{
126 this_cpu_write(_numa_mem_, node); 127 this_cpu_write(_numa_mem_, node);
128 _node_numa_mem_[numa_node_id()] = node;
129}
130#endif
131
132#ifndef node_to_mem_node
133static inline int node_to_mem_node(int node)
134{
135 return _node_numa_mem_[node];
127} 136}
128#endif 137#endif
129 138
@@ -146,6 +155,7 @@ static inline int cpu_to_mem(int cpu)
146static inline void set_cpu_numa_mem(int cpu, int node) 155static inline void set_cpu_numa_mem(int cpu, int node)
147{ 156{
148 per_cpu(_numa_mem_, cpu) = node; 157 per_cpu(_numa_mem_, cpu) = node;
158 _node_numa_mem_[cpu_to_node(cpu)] = node;
149} 159}
150#endif 160#endif
151 161
@@ -159,6 +169,13 @@ static inline int numa_mem_id(void)
159} 169}
160#endif 170#endif
161 171
172#ifndef node_to_mem_node
173static inline int node_to_mem_node(int node)
174{
175 return node;
176}
177#endif
178
162#ifndef cpu_to_mem 179#ifndef cpu_to_mem
163static inline int cpu_to_mem(int cpu) 180static inline int cpu_to_mem(int cpu)
164{ 181{
diff --git a/include/linux/torture.h b/include/linux/torture.h
index 5ca58fcbaf1b..7759fc3c622d 100644
--- a/include/linux/torture.h
+++ b/include/linux/torture.h
@@ -51,7 +51,7 @@
51 51
52/* Definitions for online/offline exerciser. */ 52/* Definitions for online/offline exerciser. */
53int torture_onoff_init(long ooholdoff, long oointerval); 53int torture_onoff_init(long ooholdoff, long oointerval);
54char *torture_onoff_stats(char *page); 54void torture_onoff_stats(void);
55bool torture_onoff_failures(void); 55bool torture_onoff_failures(void);
56 56
57/* Low-rider random number generator. */ 57/* Low-rider random number generator. */
@@ -77,7 +77,8 @@ int torture_stutter_init(int s);
77/* Initialization and cleanup. */ 77/* Initialization and cleanup. */
78bool torture_init_begin(char *ttype, bool v, int *runnable); 78bool torture_init_begin(char *ttype, bool v, int *runnable);
79void torture_init_end(void); 79void torture_init_end(void);
80bool torture_cleanup(void); 80bool torture_cleanup_begin(void);
81void torture_cleanup_end(void);
81bool torture_must_stop(void); 82bool torture_must_stop(void);
82bool torture_must_stop_irq(void); 83bool torture_must_stop_irq(void);
83void torture_kthread_stopping(char *title); 84void torture_kthread_stopping(char *title);
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 6f8ab7da27c4..84d497297c5f 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -133,10 +133,6 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
133 133
134/** 134/**
135 * tracehook_signal_handler - signal handler setup is complete 135 * tracehook_signal_handler - signal handler setup is complete
136 * @sig: number of signal being delivered
137 * @info: siginfo_t of signal being delivered
138 * @ka: sigaction setting that chose the handler
139 * @regs: user register state
140 * @stepping: nonzero if debugger single-step or block-step in use 136 * @stepping: nonzero if debugger single-step or block-step in use
141 * 137 *
142 * Called by the arch code after a signal handler has been set up. 138 * Called by the arch code after a signal handler has been set up.
@@ -146,9 +142,7 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
146 * Called without locks, shortly before returning to user mode 142 * Called without locks, shortly before returning to user mode
147 * (or handling more signals). 143 * (or handling more signals).
148 */ 144 */
149static inline void tracehook_signal_handler(int sig, siginfo_t *info, 145static inline void tracehook_signal_handler(int stepping)
150 const struct k_sigaction *ka,
151 struct pt_regs *regs, int stepping)
152{ 146{
153 if (stepping) 147 if (stepping)
154 ptrace_notify(SIGTRAP); 148 ptrace_notify(SIGTRAP);
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 2e2a5f7717e5..e08e21e5f601 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -157,6 +157,12 @@ extern void syscall_unregfunc(void);
157 * Make sure the alignment of the structure in the __tracepoints section will 157 * Make sure the alignment of the structure in the __tracepoints section will
158 * not add unwanted padding between the beginning of the section and the 158 * not add unwanted padding between the beginning of the section and the
159 * structure. Force alignment to the same alignment as the section start. 159 * structure. Force alignment to the same alignment as the section start.
160 *
161 * When lockdep is enabled, we make sure to always do the RCU portions of
162 * the tracepoint code, regardless of whether tracing is on or we match the
163 * condition. This lets us find RCU issues triggered with tracepoints even
164 * when this tracepoint is off. This code has no purpose other than poking
165 * RCU a bit.
160 */ 166 */
161#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ 167#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
162 extern struct tracepoint __tracepoint_##name; \ 168 extern struct tracepoint __tracepoint_##name; \
@@ -167,6 +173,11 @@ extern void syscall_unregfunc(void);
167 TP_PROTO(data_proto), \ 173 TP_PROTO(data_proto), \
168 TP_ARGS(data_args), \ 174 TP_ARGS(data_args), \
169 TP_CONDITION(cond),,); \ 175 TP_CONDITION(cond),,); \
176 if (IS_ENABLED(CONFIG_LOCKDEP)) { \
177 rcu_read_lock_sched_notrace(); \
178 rcu_dereference_sched(__tracepoint_##name.funcs);\
179 rcu_read_unlock_sched_notrace(); \
180 } \
170 } \ 181 } \
171 __DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \ 182 __DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \
172 PARAMS(cond), PARAMS(data_proto), PARAMS(data_args)) \ 183 PARAMS(cond), PARAMS(data_proto), PARAMS(data_args)) \
@@ -249,6 +260,50 @@ extern void syscall_unregfunc(void);
249 260
250#endif /* CONFIG_TRACEPOINTS */ 261#endif /* CONFIG_TRACEPOINTS */
251 262
263#ifdef CONFIG_TRACING
264/**
265 * tracepoint_string - register constant persistent string to trace system
266 * @str - a constant persistent string that will be referenced in tracepoints
267 *
268 * If constant strings are being used in tracepoints, it is faster and
269 * more efficient to just save the pointer to the string and reference
270 * that with a printf "%s" instead of saving the string in the ring buffer
271 * and wasting space and time.
272 *
273 * The problem with the above approach is that userspace tools that read
274 * the binary output of the trace buffers do not have access to the string.
275 * Instead they just show the address of the string which is not very
276 * useful to users.
277 *
278 * With tracepoint_string(), the string will be registered to the tracing
279 * system and exported to userspace via the debugfs/tracing/printk_formats
280 * file that maps the string address to the string text. This way userspace
281 * tools that read the binary buffers have a way to map the pointers to
282 * the ASCII strings they represent.
283 *
284 * The @str used must be a constant string and persistent as it would not
285 * make sense to show a string that no longer exists. But it is still fine
286 * to be used with modules, because when modules are unloaded, if they
287 * had tracepoints, the ring buffers are cleared too. As long as the string
288 * does not change during the life of the module, it is fine to use
289 * tracepoint_string() within a module.
290 */
291#define tracepoint_string(str) \
292 ({ \
293 static const char *___tp_str __tracepoint_string = str; \
294 ___tp_str; \
295 })
296#define __tracepoint_string __attribute__((section("__tracepoint_str")))
297#else
298/*
299 * tracepoint_string() is used to save the string address for userspace
300 * tracing tools. When tracing isn't configured, there's no need to save
301 * anything.
302 */
303# define tracepoint_string(str) str
304# define __tracepoint_string
305#endif
306
252/* 307/*
253 * The need for the DECLARE_TRACE_NOARGS() is to handle the prototype 308 * The need for the DECLARE_TRACE_NOARGS() is to handle the prototype
254 * (void). "void" is a special value in a function prototype and can 309 * (void). "void" is a special value in a function prototype and can
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 84132942902a..5171ef8f7b85 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -252,6 +252,7 @@ struct tty_struct {
252 struct rw_semaphore termios_rwsem; 252 struct rw_semaphore termios_rwsem;
253 struct mutex winsize_mutex; 253 struct mutex winsize_mutex;
254 spinlock_t ctrl_lock; 254 spinlock_t ctrl_lock;
255 spinlock_t flow_lock;
255 /* Termios values are protected by the termios rwsem */ 256 /* Termios values are protected by the termios rwsem */
256 struct ktermios termios, termios_locked; 257 struct ktermios termios, termios_locked;
257 struct termiox *termiox; /* May be NULL for unsupported */ 258 struct termiox *termiox; /* May be NULL for unsupported */
@@ -261,8 +262,13 @@ struct tty_struct {
261 unsigned long flags; 262 unsigned long flags;
262 int count; 263 int count;
263 struct winsize winsize; /* winsize_mutex */ 264 struct winsize winsize; /* winsize_mutex */
264 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 265 unsigned long stopped:1, /* flow_lock */
265 unsigned char ctrl_status; /* ctrl_lock */ 266 flow_stopped:1,
267 unused:BITS_PER_LONG - 2;
268 int hw_stopped;
269 unsigned long ctrl_status:8, /* ctrl_lock */
270 packet:1,
271 unused_ctrl:BITS_PER_LONG - 9;
266 unsigned int receive_room; /* Bytes free for queue */ 272 unsigned int receive_room; /* Bytes free for queue */
267 int flow_change; 273 int flow_change;
268 274
@@ -397,7 +403,9 @@ extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
397extern char *tty_name(struct tty_struct *tty, char *buf); 403extern char *tty_name(struct tty_struct *tty, char *buf);
398extern void tty_wait_until_sent(struct tty_struct *tty, long timeout); 404extern void tty_wait_until_sent(struct tty_struct *tty, long timeout);
399extern int tty_check_change(struct tty_struct *tty); 405extern int tty_check_change(struct tty_struct *tty);
406extern void __stop_tty(struct tty_struct *tty);
400extern void stop_tty(struct tty_struct *tty); 407extern void stop_tty(struct tty_struct *tty);
408extern void __start_tty(struct tty_struct *tty);
401extern void start_tty(struct tty_struct *tty); 409extern void start_tty(struct tty_struct *tty);
402extern int tty_register_driver(struct tty_driver *driver); 410extern int tty_register_driver(struct tty_driver *driver);
403extern int tty_unregister_driver(struct tty_driver *driver); 411extern int tty_unregister_driver(struct tty_driver *driver);
@@ -411,6 +419,7 @@ extern void tty_unregister_device(struct tty_driver *driver, unsigned index);
411extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, 419extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
412 int buflen); 420 int buflen);
413extern void tty_write_message(struct tty_struct *tty, char *msg); 421extern void tty_write_message(struct tty_struct *tty, char *msg);
422extern int tty_send_xchar(struct tty_struct *tty, char ch);
414extern int tty_put_char(struct tty_struct *tty, unsigned char c); 423extern int tty_put_char(struct tty_struct *tty, unsigned char c);
415extern int tty_chars_in_buffer(struct tty_struct *tty); 424extern int tty_chars_in_buffer(struct tty_struct *tty);
416extern int tty_write_room(struct tty_struct *tty); 425extern int tty_write_room(struct tty_struct *tty);
@@ -495,8 +504,6 @@ extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty);
495extern struct mutex tty_mutex; 504extern struct mutex tty_mutex;
496extern spinlock_t tty_files_lock; 505extern spinlock_t tty_files_lock;
497 506
498extern void tty_write_unlock(struct tty_struct *tty);
499extern int tty_write_lock(struct tty_struct *tty, int ndelay);
500#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock)) 507#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock))
501 508
502extern void tty_port_init(struct tty_port *port); 509extern void tty_port_init(struct tty_port *port);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index e48c608a8fa8..92e337c18839 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -152,6 +152,8 @@
152 * This routine notifies the tty driver that it should stop 152 * This routine notifies the tty driver that it should stop
153 * outputting characters to the tty device. 153 * outputting characters to the tty device.
154 * 154 *
155 * Called with ->flow_lock held. Serialized with start() method.
156 *
155 * Optional: 157 * Optional:
156 * 158 *
157 * Note: Call stop_tty not this method. 159 * Note: Call stop_tty not this method.
@@ -161,6 +163,8 @@
161 * This routine notifies the tty driver that it resume sending 163 * This routine notifies the tty driver that it resume sending
162 * characters to the tty device. 164 * characters to the tty device.
163 * 165 *
166 * Called with ->flow_lock held. Serialized with stop() method.
167 *
164 * Optional: 168 * Optional:
165 * 169 *
166 * Note: Call start_tty not this method. 170 * Note: Call start_tty not this method.
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 247cfdcc4b08..ee3277593222 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -49,7 +49,11 @@ struct udp_sock {
49 unsigned int corkflag; /* Cork is required */ 49 unsigned int corkflag; /* Cork is required */
50 __u8 encap_type; /* Is this an Encapsulation socket? */ 50 __u8 encap_type; /* Is this an Encapsulation socket? */
51 unsigned char no_check6_tx:1,/* Send zero UDP6 checksums on TX? */ 51 unsigned char no_check6_tx:1,/* Send zero UDP6 checksums on TX? */
52 no_check6_rx:1;/* Allow zero UDP6 checksums on RX? */ 52 no_check6_rx:1,/* Allow zero UDP6 checksums on RX? */
53 convert_csum:1;/* On receive, convert checksum
54 * unnecessary to checksum complete
55 * if possible.
56 */
53 /* 57 /*
54 * Following member retains the information to create a UDP header 58 * Following member retains the information to create a UDP header
55 * when the socket is uncorked. 59 * when the socket is uncorked.
@@ -98,6 +102,16 @@ static inline bool udp_get_no_check6_rx(struct sock *sk)
98 return udp_sk(sk)->no_check6_rx; 102 return udp_sk(sk)->no_check6_rx;
99} 103}
100 104
105static inline void udp_set_convert_csum(struct sock *sk, bool val)
106{
107 udp_sk(sk)->convert_csum = val;
108}
109
110static inline bool udp_get_convert_csum(struct sock *sk)
111{
112 return udp_sk(sk)->convert_csum;
113}
114
101#define udp_portaddr_for_each_entry(__sk, node, list) \ 115#define udp_portaddr_for_each_entry(__sk, node, list) \
102 hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node) 116 hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node)
103 117
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 09a7cffc224e..9b1581414cd4 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -80,11 +80,14 @@ size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
80 struct iov_iter *i); 80 struct iov_iter *i);
81size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes, 81size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes,
82 struct iov_iter *i); 82 struct iov_iter *i);
83size_t copy_to_iter(void *addr, size_t bytes, struct iov_iter *i);
84size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i);
85size_t iov_iter_zero(size_t bytes, struct iov_iter *);
83unsigned long iov_iter_alignment(const struct iov_iter *i); 86unsigned long iov_iter_alignment(const struct iov_iter *i);
84void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, 87void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov,
85 unsigned long nr_segs, size_t count); 88 unsigned long nr_segs, size_t count);
86ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, 89ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
87 size_t maxsize, size_t *start); 90 size_t maxsize, unsigned maxpages, size_t *start);
88ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, 91ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages,
89 size_t maxsize, size_t *start); 92 size_t maxsize, size_t *start);
90int iov_iter_npages(const struct iov_iter *i, int maxpages); 93int iov_iter_npages(const struct iov_iter *i, int maxpages);
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 1ad4724458de..baa81718d985 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -63,7 +63,17 @@ struct uio_port {
63 63
64#define MAX_UIO_PORT_REGIONS 5 64#define MAX_UIO_PORT_REGIONS 5
65 65
66struct uio_device; 66struct uio_device {
67 struct module *owner;
68 struct device *dev;
69 int minor;
70 atomic_t event;
71 struct fasync_struct *async_queue;
72 wait_queue_head_t wait;
73 struct uio_info *info;
74 struct kobject *map_dir;
75 struct kobject *portio_dir;
76};
67 77
68/** 78/**
69 * struct uio_info - UIO device capabilities 79 * struct uio_info - UIO device capabilities
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 4f844c6b03ee..60beb5dc7977 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -98,11 +98,11 @@ struct uprobes_state {
98 struct xol_area *xol_area; 98 struct xol_area *xol_area;
99}; 99};
100 100
101extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 101extern int set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
102extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 102extern int set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
103extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 103extern bool is_swbp_insn(uprobe_opcode_t *insn);
104extern bool __weak is_trap_insn(uprobe_opcode_t *insn); 104extern bool is_trap_insn(uprobe_opcode_t *insn);
105extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); 105extern unsigned long uprobe_get_swbp_addr(struct pt_regs *regs);
106extern unsigned long uprobe_get_trap_addr(struct pt_regs *regs); 106extern unsigned long uprobe_get_trap_addr(struct pt_regs *regs);
107extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t); 107extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t);
108extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 108extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
@@ -128,8 +128,8 @@ extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
128extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data); 128extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
129extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs); 129extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
130extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs); 130extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
131extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs); 131extern bool arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs);
132extern void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr, 132extern void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
133 void *src, unsigned long len); 133 void *src, unsigned long len);
134#else /* !CONFIG_UPROBES */ 134#else /* !CONFIG_UPROBES */
135struct uprobes_state { 135struct uprobes_state {
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d2465bc0e73c..447a7e2fc19b 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1862,6 +1862,18 @@ extern void usb_unregister_notify(struct notifier_block *nb);
1862/* debugfs stuff */ 1862/* debugfs stuff */
1863extern struct dentry *usb_debug_root; 1863extern struct dentry *usb_debug_root;
1864 1864
1865/* LED triggers */
1866enum usb_led_event {
1867 USB_LED_EVENT_HOST = 0,
1868 USB_LED_EVENT_GADGET = 1,
1869};
1870
1871#ifdef CONFIG_USB_LED_TRIG
1872extern void usb_led_activity(enum usb_led_event ev);
1873#else
1874static inline void usb_led_activity(enum usb_led_event ev) {}
1875#endif
1876
1865#endif /* __KERNEL__ */ 1877#endif /* __KERNEL__ */
1866 1878
1867#endif 1879#endif
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index bbe779f640be..e14c09a45c5a 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -31,6 +31,7 @@ struct ci_hdrc_platform_data {
31#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 31#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
32 void (*notify_event) (struct ci_hdrc *ci, unsigned event); 32 void (*notify_event) (struct ci_hdrc *ci, unsigned event);
33 struct regulator *reg_vbus; 33 struct regulator *reg_vbus;
34 bool tpl_support;
34}; 35};
35 36
36/* Default offset of capability registers */ 37/* Default offset of capability registers */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index c3a61853cd13..522cafe26790 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -345,12 +345,13 @@ static inline int usb_ep_queue(struct usb_ep *ep,
345 * @ep:the endpoint associated with the request 345 * @ep:the endpoint associated with the request
346 * @req:the request being canceled 346 * @req:the request being canceled
347 * 347 *
348 * if the request is still active on the endpoint, it is dequeued and its 348 * If the request is still active on the endpoint, it is dequeued and its
349 * completion routine is called (with status -ECONNRESET); else a negative 349 * completion routine is called (with status -ECONNRESET); else a negative
350 * error code is returned. 350 * error code is returned. This is guaranteed to happen before the call to
351 * usb_ep_dequeue() returns.
351 * 352 *
352 * note that some hardware can't clear out write fifos (to unlink the request 353 * Note that some hardware can't clear out write fifos (to unlink the request
353 * at the head of the queue) except as part of disconnecting from usb. such 354 * at the head of the queue) except as part of disconnecting from usb. Such
354 * restrictions prevent drivers from supporting configuration changes, 355 * restrictions prevent drivers from supporting configuration changes,
355 * even to configuration zero (a "chapter 9" requirement). 356 * even to configuration zero (a "chapter 9" requirement).
356 */ 357 */
@@ -816,6 +817,8 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
816 * Called in a context that permits sleeping. 817 * Called in a context that permits sleeping.
817 * @suspend: Invoked on USB suspend. May be called in_interrupt. 818 * @suspend: Invoked on USB suspend. May be called in_interrupt.
818 * @resume: Invoked on USB resume. May be called in_interrupt. 819 * @resume: Invoked on USB resume. May be called in_interrupt.
820 * @reset: Invoked on USB bus reset. It is mandatory for all gadget drivers
821 * and should be called in_interrupt.
819 * @driver: Driver model state for this driver. 822 * @driver: Driver model state for this driver.
820 * 823 *
821 * Devices are disabled till a gadget driver successfully bind()s, which 824 * Devices are disabled till a gadget driver successfully bind()s, which
@@ -873,6 +876,7 @@ struct usb_gadget_driver {
873 void (*disconnect)(struct usb_gadget *); 876 void (*disconnect)(struct usb_gadget *);
874 void (*suspend)(struct usb_gadget *); 877 void (*suspend)(struct usb_gadget *);
875 void (*resume)(struct usb_gadget *); 878 void (*resume)(struct usb_gadget *);
879 void (*reset)(struct usb_gadget *);
876 880
877 /* FIXME support safe rmmod */ 881 /* FIXME support safe rmmod */
878 struct device_driver driver; 882 struct device_driver driver;
@@ -1013,6 +1017,20 @@ extern void usb_gadget_set_state(struct usb_gadget *gadget,
1013 1017
1014/*-------------------------------------------------------------------------*/ 1018/*-------------------------------------------------------------------------*/
1015 1019
1020/* utility to tell udc core that the bus reset occurs */
1021extern void usb_gadget_udc_reset(struct usb_gadget *gadget,
1022 struct usb_gadget_driver *driver);
1023
1024/*-------------------------------------------------------------------------*/
1025
1026/* utility to give requests back to the gadget layer */
1027
1028extern void usb_gadget_giveback_request(struct usb_ep *ep,
1029 struct usb_request *req);
1030
1031
1032/*-------------------------------------------------------------------------*/
1033
1016/* utility wrapping a simple endpoint selection policy */ 1034/* utility wrapping a simple endpoint selection policy */
1017 1035
1018extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, 1036extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 485cd5e2100c..cd96a2bc3388 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -106,7 +106,8 @@ struct usb_hcd {
106 * OTG and some Host controllers need software interaction with phys; 106 * OTG and some Host controllers need software interaction with phys;
107 * other external phys should be software-transparent 107 * other external phys should be software-transparent
108 */ 108 */
109 struct usb_phy *phy; 109 struct usb_phy *usb_phy;
110 struct phy *phy;
110 111
111 /* Flags that need to be manipulated atomically because they can 112 /* Flags that need to be manipulated atomically because they can
112 * change while the host controller is running. Always use 113 * change while the host controller is running. Always use
@@ -144,6 +145,7 @@ struct usb_hcd {
144 unsigned has_tt:1; /* Integrated TT in root hub */ 145 unsigned has_tt:1; /* Integrated TT in root hub */
145 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */ 146 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */
146 unsigned can_do_streams:1; /* HC supports streams */ 147 unsigned can_do_streams:1; /* HC supports streams */
148 unsigned tpl_support:1; /* OTG & EH TPL support */
147 149
148 unsigned int irq; /* irq allocated */ 150 unsigned int irq; /* irq allocated */
149 void __iomem *regs; /* device memory/io */ 151 void __iomem *regs; /* device memory/io */
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
index 8c38aa26b3bb..cfe0528cdbb1 100644
--- a/include/linux/usb/of.h
+++ b/include/linux/usb/of.h
@@ -14,6 +14,7 @@
14#if IS_ENABLED(CONFIG_OF) 14#if IS_ENABLED(CONFIG_OF)
15enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np); 15enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np);
16enum usb_device_speed of_usb_get_maximum_speed(struct device_node *np); 16enum usb_device_speed of_usb_get_maximum_speed(struct device_node *np);
17bool of_usb_host_tpl_support(struct device_node *np);
17#else 18#else
18static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np) 19static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
19{ 20{
@@ -25,6 +26,10 @@ of_usb_get_maximum_speed(struct device_node *np)
25{ 26{
26 return USB_SPEED_UNKNOWN; 27 return USB_SPEED_UNKNOWN;
27} 28}
29static inline bool of_usb_host_tpl_support(struct device_node *np)
30{
31 return false;
32}
28#endif 33#endif
29 34
30#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT) 35#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT)
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 55a17b188daa..9948c874e3f1 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -8,27 +8,27 @@
8#define __LINUX_USB_QUIRKS_H 8#define __LINUX_USB_QUIRKS_H
9 9
10/* string descriptors must not be fetched using a 255-byte read */ 10/* string descriptors must not be fetched using a 255-byte read */
11#define USB_QUIRK_STRING_FETCH_255 0x00000001 11#define USB_QUIRK_STRING_FETCH_255 BIT(0)
12 12
13/* device can't resume correctly so reset it instead */ 13/* device can't resume correctly so reset it instead */
14#define USB_QUIRK_RESET_RESUME 0x00000002 14#define USB_QUIRK_RESET_RESUME BIT(1)
15 15
16/* device can't handle Set-Interface requests */ 16/* device can't handle Set-Interface requests */
17#define USB_QUIRK_NO_SET_INTF 0x00000004 17#define USB_QUIRK_NO_SET_INTF BIT(2)
18 18
19/* device can't handle its Configuration or Interface strings */ 19/* device can't handle its Configuration or Interface strings */
20#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008 20#define USB_QUIRK_CONFIG_INTF_STRINGS BIT(3)
21 21
22/* device can't be reset(e.g morph devices), don't use reset */ 22/* device can't be reset(e.g morph devices), don't use reset */
23#define USB_QUIRK_RESET 0x00000010 23#define USB_QUIRK_RESET BIT(4)
24 24
25/* device has more interface descriptions than the bNumInterfaces count, 25/* device has more interface descriptions than the bNumInterfaces count,
26 and can't handle talking to these interfaces */ 26 and can't handle talking to these interfaces */
27#define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020 27#define USB_QUIRK_HONOR_BNUMINTERFACES BIT(5)
28 28
29/* device needs a pause during initialization, after we read the device 29/* device needs a pause during initialization, after we read the device
30 descriptor */ 30 descriptor */
31#define USB_QUIRK_DELAY_INIT 0x00000040 31#define USB_QUIRK_DELAY_INIT BIT(6)
32 32
33/* 33/*
34 * For high speed and super speed interupt endpoints, the USB 2.0 and 34 * For high speed and super speed interupt endpoints, the USB 2.0 and
@@ -39,6 +39,12 @@
39 * Devices with this quirk report their bInterval as the result of this 39 * Devices with this quirk report their bInterval as the result of this
40 * calculation instead of the exponent variable used in the calculation. 40 * calculation instead of the exponent variable used in the calculation.
41 */ 41 */
42#define USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL 0x00000080 42#define USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL BIT(7)
43
44/* device can't handle device_qualifier descriptor requests */
45#define USB_QUIRK_DEVICE_QUALIFIER BIT(8)
46
47/* device generates spurious wakeup, ignore remote wakeup capability */
48#define USB_QUIRK_IGNORE_REMOTE_WAKEUP BIT(9)
43 49
44#endif /* __LINUX_USB_QUIRKS_H */ 50#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 26088feb6608..d9a4905e01d0 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -78,6 +78,7 @@ struct usbnet {
78# define EVENT_NO_RUNTIME_PM 9 78# define EVENT_NO_RUNTIME_PM 9
79# define EVENT_RX_KILL 10 79# define EVENT_RX_KILL 10
80# define EVENT_LINK_CHANGE 11 80# define EVENT_LINK_CHANGE 11
81# define EVENT_SET_RX_MODE 12
81}; 82};
82 83
83static inline struct usb_driver *driver_of(struct usb_interface *intf) 84static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -159,6 +160,9 @@ struct driver_info {
159 /* called by minidriver when receiving indication */ 160 /* called by minidriver when receiving indication */
160 void (*indication)(struct usbnet *dev, void *ind, int indlen); 161 void (*indication)(struct usbnet *dev, void *ind, int indlen);
161 162
163 /* rx mode change (device changes address list filtering) */
164 void (*set_rx_mode)(struct usbnet *dev);
165
162 /* for new devices, use the descriptor-reading code instead */ 166 /* for new devices, use the descriptor-reading code instead */
163 int in; /* rx endpoint */ 167 int in; /* rx endpoint */
164 int out; /* tx endpoint */ 168 int out; /* tx endpoint */
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 9b7de1b46437..a7f2604c5f25 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -73,6 +73,10 @@
73 /* Device advertises UAS but it is broken */ \ 73 /* Device advertises UAS but it is broken */ \
74 US_FLAG(BROKEN_FUA, 0x01000000) \ 74 US_FLAG(BROKEN_FUA, 0x01000000) \
75 /* Cannot handle FUA in WRITE or READ CDBs */ \ 75 /* Cannot handle FUA in WRITE or READ CDBs */ \
76 US_FLAG(NO_ATA_1X, 0x02000000) \
77 /* Cannot handle ATA_12 or ATA_16 CDBs */ \
78 US_FLAG(NO_REPORT_OPCODES, 0x04000000) \
79 /* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \
76 80
77#define US_FLAG(name, value) US_FL_##name = value , 81#define US_FLAG(name, value) US_FL_##name = value ,
78enum { US_DO_ALL_FLAGS }; 82enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 4836ba3c1cd8..e95372654f09 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -57,9 +57,9 @@ static inline void put_user_ns(struct user_namespace *ns)
57} 57}
58 58
59struct seq_operations; 59struct seq_operations;
60extern struct seq_operations proc_uid_seq_operations; 60extern const struct seq_operations proc_uid_seq_operations;
61extern struct seq_operations proc_gid_seq_operations; 61extern const struct seq_operations proc_gid_seq_operations;
62extern struct seq_operations proc_projid_seq_operations; 62extern const struct seq_operations proc_projid_seq_operations;
63extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *); 63extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *);
64extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *); 64extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *);
65extern ssize_t proc_projid_map_write(struct file *, const char __user *, size_t, loff_t *); 65extern ssize_t proc_projid_map_write(struct file *, const char __user *, size_t, loff_t *);
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 8ec980b5e3af..d3204115f15d 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -98,4 +98,27 @@ extern int vfio_external_user_iommu_id(struct vfio_group *group);
98extern long vfio_external_check_extension(struct vfio_group *group, 98extern long vfio_external_check_extension(struct vfio_group *group,
99 unsigned long arg); 99 unsigned long arg);
100 100
101struct pci_dev;
102#ifdef CONFIG_EEH
103extern void vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
104extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
105extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
106 unsigned int cmd,
107 unsigned long arg);
108#else
109static inline void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
110{
111}
112
113static inline void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
114{
115}
116
117static inline long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
118 unsigned int cmd,
119 unsigned long arg)
120{
121 return -ENOTTY;
122}
123#endif /* CONFIG_EEH */
101#endif /* VFIO_H */ 124#endif /* VFIO_H */
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index 502073a53dd3..b483abd34493 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -64,6 +64,7 @@ int vga_switcheroo_get_client_state(struct pci_dev *dev);
64void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic); 64void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic);
65 65
66int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain); 66int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain);
67void vga_switcheroo_fini_domain_pm_ops(struct device *dev);
67int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain); 68int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain);
68#else 69#else
69 70
@@ -82,6 +83,7 @@ static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return
82static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {} 83static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {}
83 84
84static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } 85static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; }
86static inline void vga_switcheroo_fini_domain_pm_ops(struct device *dev) {}
85static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } 87static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; }
86 88
87#endif 89#endif
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 2c02f3a8d2ba..c37bd4d06739 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -182,7 +182,6 @@ extern void vga_put(struct pci_dev *pdev, unsigned int rsrc);
182 * vga_get()... 182 * vga_get()...
183 */ 183 */
184 184
185#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
186#ifdef CONFIG_VGA_ARB 185#ifdef CONFIG_VGA_ARB
187extern struct pci_dev *vga_default_device(void); 186extern struct pci_dev *vga_default_device(void);
188extern void vga_set_default_device(struct pci_dev *pdev); 187extern void vga_set_default_device(struct pci_dev *pdev);
@@ -190,7 +189,6 @@ extern void vga_set_default_device(struct pci_dev *pdev);
190static inline struct pci_dev *vga_default_device(void) { return NULL; }; 189static inline struct pci_dev *vga_default_device(void) { return NULL; };
191static inline void vga_set_default_device(struct pci_dev *pdev) { }; 190static inline void vga_set_default_device(struct pci_dev *pdev) { };
192#endif 191#endif
193#endif
194 192
195/** 193/**
196 * vga_conflicts 194 * vga_conflicts
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index b46671e28de2..65261a7244fc 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -78,6 +78,10 @@ bool virtqueue_is_broken(struct virtqueue *vq);
78/** 78/**
79 * virtio_device - representation of a device using virtio 79 * virtio_device - representation of a device using virtio
80 * @index: unique position on the virtio bus 80 * @index: unique position on the virtio bus
81 * @failed: saved value for CONFIG_S_FAILED bit (for restore)
82 * @config_enabled: configuration change reporting enabled
83 * @config_change_pending: configuration change reported while disabled
84 * @config_lock: protects configuration change reporting
81 * @dev: underlying device. 85 * @dev: underlying device.
82 * @id: the device type identification (used to match it with a driver). 86 * @id: the device type identification (used to match it with a driver).
83 * @config: the configuration ops for this device. 87 * @config: the configuration ops for this device.
@@ -88,6 +92,10 @@ bool virtqueue_is_broken(struct virtqueue *vq);
88 */ 92 */
89struct virtio_device { 93struct virtio_device {
90 int index; 94 int index;
95 bool failed;
96 bool config_enabled;
97 bool config_change_pending;
98 spinlock_t config_lock;
91 struct device dev; 99 struct device dev;
92 struct virtio_device_id id; 100 struct virtio_device_id id;
93 const struct virtio_config_ops *config; 101 const struct virtio_config_ops *config;
@@ -108,6 +116,12 @@ void unregister_virtio_device(struct virtio_device *dev);
108 116
109void virtio_break_device(struct virtio_device *dev); 117void virtio_break_device(struct virtio_device *dev);
110 118
119void virtio_config_changed(struct virtio_device *dev);
120#ifdef CONFIG_PM_SLEEP
121int virtio_device_freeze(struct virtio_device *dev);
122int virtio_device_restore(struct virtio_device *dev);
123#endif
124
111/** 125/**
112 * virtio_driver - operations for a virtio I/O driver 126 * virtio_driver - operations for a virtio I/O driver
113 * @driver: underlying device driver (populate name and owner). 127 * @driver: underlying device driver (populate name and owner).
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index e8f8f71e843c..7f4ef66873ef 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -109,6 +109,23 @@ struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
109 return vq; 109 return vq;
110} 110}
111 111
112/**
113 * virtio_device_ready - enable vq use in probe function
114 * @vdev: the device
115 *
116 * Driver must call this to use vqs in the probe function.
117 *
118 * Note: vqs are enabled automatically after probe returns.
119 */
120static inline
121void virtio_device_ready(struct virtio_device *dev)
122{
123 unsigned status = dev->config->get_status(dev);
124
125 BUG_ON(status & VIRTIO_CONFIG_S_DRIVER_OK);
126 dev->config->set_status(dev, status | VIRTIO_CONFIG_S_DRIVER_OK);
127}
128
112static inline 129static inline
113const char *virtio_bus_name(struct virtio_device *vdev) 130const char *virtio_bus_name(struct virtio_device *vdev)
114{ 131{
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index ced92345c963..730334cdf037 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -72,6 +72,13 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
72 THP_ZERO_PAGE_ALLOC, 72 THP_ZERO_PAGE_ALLOC,
73 THP_ZERO_PAGE_ALLOC_FAILED, 73 THP_ZERO_PAGE_ALLOC_FAILED,
74#endif 74#endif
75#ifdef CONFIG_MEMORY_BALLOON
76 BALLOON_INFLATE,
77 BALLOON_DEFLATE,
78#ifdef CONFIG_BALLOON_COMPACTION
79 BALLOON_MIGRATE,
80#endif
81#endif
75#ifdef CONFIG_DEBUG_TLBFLUSH 82#ifdef CONFIG_DEBUG_TLBFLUSH
76#ifdef CONFIG_SMP 83#ifdef CONFIG_SMP
77 NR_TLB_REMOTE_FLUSH, /* cpu tried to flush others' tlbs */ 84 NR_TLB_REMOTE_FLUSH, /* cpu tried to flush others' tlbs */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 4b8a89189a29..b87696fdf06a 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -113,7 +113,7 @@ extern struct vm_struct *remove_vm_area(const void *addr);
113extern struct vm_struct *find_vm_area(const void *addr); 113extern struct vm_struct *find_vm_area(const void *addr);
114 114
115extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 115extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
116 struct page ***pages); 116 struct page **pages);
117#ifdef CONFIG_MMU 117#ifdef CONFIG_MMU
118extern int map_kernel_range_noflush(unsigned long start, unsigned long size, 118extern int map_kernel_range_noflush(unsigned long start, unsigned long size,
119 pgprot_t prot, struct page **pages); 119 pgprot_t prot, struct page **pages);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 6fb1ba5f9b2f..e4a8eb9312ea 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -25,7 +25,7 @@ struct wait_bit_key {
25 void *flags; 25 void *flags;
26 int bit_nr; 26 int bit_nr;
27#define WAIT_ATOMIC_T_BIT_NR -1 27#define WAIT_ATOMIC_T_BIT_NR -1
28 unsigned long private; 28 unsigned long timeout;
29}; 29};
30 30
31struct wait_bit_queue { 31struct wait_bit_queue {
@@ -154,6 +154,7 @@ int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, wait_bit_ac
154void wake_up_bit(void *, int); 154void wake_up_bit(void *, int);
155void wake_up_atomic_t(atomic_t *); 155void wake_up_atomic_t(atomic_t *);
156int out_of_line_wait_on_bit(void *, int, wait_bit_action_f *, unsigned); 156int out_of_line_wait_on_bit(void *, int, wait_bit_action_f *, unsigned);
157int out_of_line_wait_on_bit_timeout(void *, int, wait_bit_action_f *, unsigned, unsigned long);
157int out_of_line_wait_on_bit_lock(void *, int, wait_bit_action_f *, unsigned); 158int out_of_line_wait_on_bit_lock(void *, int, wait_bit_action_f *, unsigned);
158int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned); 159int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned);
159wait_queue_head_t *bit_waitqueue(void *, int); 160wait_queue_head_t *bit_waitqueue(void *, int);
@@ -280,9 +281,11 @@ do { \
280 * wake_up() has to be called after changing any variable that could 281 * wake_up() has to be called after changing any variable that could
281 * change the result of the wait condition. 282 * change the result of the wait condition.
282 * 283 *
283 * The function returns 0 if the @timeout elapsed, or the remaining 284 * Returns:
284 * jiffies (at least 1) if the @condition evaluated to %true before 285 * 0 if the @condition evaluated to %false after the @timeout elapsed,
285 * the @timeout elapsed. 286 * 1 if the @condition evaluated to %true after the @timeout elapsed,
287 * or the remaining jiffies (at least 1) if the @condition evaluated
288 * to %true before the @timeout elapsed.
286 */ 289 */
287#define wait_event_timeout(wq, condition, timeout) \ 290#define wait_event_timeout(wq, condition, timeout) \
288({ \ 291({ \
@@ -363,9 +366,11 @@ do { \
363 * change the result of the wait condition. 366 * change the result of the wait condition.
364 * 367 *
365 * Returns: 368 * Returns:
366 * 0 if the @timeout elapsed, -%ERESTARTSYS if it was interrupted by 369 * 0 if the @condition evaluated to %false after the @timeout elapsed,
367 * a signal, or the remaining jiffies (at least 1) if the @condition 370 * 1 if the @condition evaluated to %true after the @timeout elapsed,
368 * evaluated to %true before the @timeout elapsed. 371 * the remaining jiffies (at least 1) if the @condition evaluated
372 * to %true before the @timeout elapsed, or -%ERESTARTSYS if it was
373 * interrupted by a signal.
369 */ 374 */
370#define wait_event_interruptible_timeout(wq, condition, timeout) \ 375#define wait_event_interruptible_timeout(wq, condition, timeout) \
371({ \ 376({ \
@@ -859,6 +864,8 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
859 864
860extern int bit_wait(struct wait_bit_key *); 865extern int bit_wait(struct wait_bit_key *);
861extern int bit_wait_io(struct wait_bit_key *); 866extern int bit_wait_io(struct wait_bit_key *);
867extern int bit_wait_timeout(struct wait_bit_key *);
868extern int bit_wait_io_timeout(struct wait_bit_key *);
862 869
863/** 870/**
864 * wait_on_bit - wait for a bit to be cleared 871 * wait_on_bit - wait for a bit to be cleared
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 2a3038ee17a3..395b70e0eccf 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -97,13 +97,8 @@ struct watchdog_device {
97#define WDOG_UNREGISTERED 4 /* Has the device been unregistered */ 97#define WDOG_UNREGISTERED 4 /* Has the device been unregistered */
98}; 98};
99 99
100#ifdef CONFIG_WATCHDOG_NOWAYOUT 100#define WATCHDOG_NOWAYOUT IS_BUILTIN(CONFIG_WATCHDOG_NOWAYOUT)
101#define WATCHDOG_NOWAYOUT 1 101#define WATCHDOG_NOWAYOUT_INIT_STATUS (WATCHDOG_NOWAYOUT << WDOG_NO_WAY_OUT)
102#define WATCHDOG_NOWAYOUT_INIT_STATUS (1 << WDOG_NO_WAY_OUT)
103#else
104#define WATCHDOG_NOWAYOUT 0
105#define WATCHDOG_NOWAYOUT_INIT_STATUS 0
106#endif
107 102
108/* Use the following function to check whether or not the watchdog is active */ 103/* Use the following function to check whether or not the watchdog is active */
109static inline bool watchdog_active(struct watchdog_device *wdd) 104static inline bool watchdog_active(struct watchdog_device *wdd)
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index a0cc2e95ed1b..b996e6cde6bb 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -419,7 +419,7 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
419 alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \ 419 alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \
420 1, (name)) 420 1, (name))
421#define create_singlethread_workqueue(name) \ 421#define create_singlethread_workqueue(name) \
422 alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM, 1, (name)) 422 alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name)
423 423
424extern void destroy_workqueue(struct workqueue_struct *wq); 424extern void destroy_workqueue(struct workqueue_struct *wq);
425 425
diff --git a/include/linux/zbud.h b/include/linux/zbud.h
index 13af0d450bf6..f9d41a6e361f 100644
--- a/include/linux/zbud.h
+++ b/include/linux/zbud.h
@@ -11,7 +11,7 @@ struct zbud_ops {
11 11
12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops); 12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops);
13void zbud_destroy_pool(struct zbud_pool *pool); 13void zbud_destroy_pool(struct zbud_pool *pool);
14int zbud_alloc(struct zbud_pool *pool, unsigned int size, gfp_t gfp, 14int zbud_alloc(struct zbud_pool *pool, size_t size, gfp_t gfp,
15 unsigned long *handle); 15 unsigned long *handle);
16void zbud_free(struct zbud_pool *pool, unsigned long handle); 16void zbud_free(struct zbud_pool *pool, unsigned long handle);
17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries); 17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries);
diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 9c5a6b4de0a3..92dbbd3f6c75 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -83,11 +83,11 @@ struct internal_state;
83 83
84typedef struct z_stream_s { 84typedef struct z_stream_s {
85 const Byte *next_in; /* next input byte */ 85 const Byte *next_in; /* next input byte */
86 uInt avail_in; /* number of bytes available at next_in */ 86 uLong avail_in; /* number of bytes available at next_in */
87 uLong total_in; /* total nb of input bytes read so far */ 87 uLong total_in; /* total nb of input bytes read so far */
88 88
89 Byte *next_out; /* next output byte should be put there */ 89 Byte *next_out; /* next output byte should be put there */
90 uInt avail_out; /* remaining free space at next_out */ 90 uLong avail_out; /* remaining free space at next_out */
91 uLong total_out; /* total nb of bytes output so far */ 91 uLong total_out; /* total nb of bytes output so far */
92 92
93 char *msg; /* last error message, NULL if no error */ 93 char *msg; /* last error message, NULL if no error */
@@ -493,64 +493,6 @@ extern int deflateInit2 (z_streamp strm,
493 method). msg is set to null if there is no error message. deflateInit2 does 493 method). msg is set to null if there is no error message. deflateInit2 does
494 not perform any compression: this will be done by deflate(). 494 not perform any compression: this will be done by deflate().
495*/ 495*/
496
497#if 0
498extern int zlib_deflateSetDictionary (z_streamp strm,
499 const Byte *dictionary,
500 uInt dictLength);
501#endif
502/*
503 Initializes the compression dictionary from the given byte sequence
504 without producing any compressed output. This function must be called
505 immediately after deflateInit, deflateInit2 or deflateReset, before any
506 call of deflate. The compressor and decompressor must use exactly the same
507 dictionary (see inflateSetDictionary).
508
509 The dictionary should consist of strings (byte sequences) that are likely
510 to be encountered later in the data to be compressed, with the most commonly
511 used strings preferably put towards the end of the dictionary. Using a
512 dictionary is most useful when the data to be compressed is short and can be
513 predicted with good accuracy; the data can then be compressed better than
514 with the default empty dictionary.
515
516 Depending on the size of the compression data structures selected by
517 deflateInit or deflateInit2, a part of the dictionary may in effect be
518 discarded, for example if the dictionary is larger than the window size in
519 deflate or deflate2. Thus the strings most likely to be useful should be
520 put at the end of the dictionary, not at the front.
521
522 Upon return of this function, strm->adler is set to the Adler32 value
523 of the dictionary; the decompressor may later use this value to determine
524 which dictionary has been used by the compressor. (The Adler32 value
525 applies to the whole dictionary even if only a subset of the dictionary is
526 actually used by the compressor.)
527
528 deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
529 parameter is invalid (such as NULL dictionary) or the stream state is
530 inconsistent (for example if deflate has already been called for this stream
531 or if the compression method is bsort). deflateSetDictionary does not
532 perform any compression: this will be done by deflate().
533*/
534
535#if 0
536extern int zlib_deflateCopy (z_streamp dest, z_streamp source);
537#endif
538
539/*
540 Sets the destination stream as a complete copy of the source stream.
541
542 This function can be useful when several compression strategies will be
543 tried, for example when there are several ways of pre-processing the input
544 data with a filter. The streams that will be discarded should then be freed
545 by calling deflateEnd. Note that deflateCopy duplicates the internal
546 compression state which can be quite large, so this strategy is slow and
547 can consume lots of memory.
548
549 deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
550 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
551 (such as zalloc being NULL). msg is left unchanged in both source and
552 destination.
553*/
554 496
555extern int zlib_deflateReset (z_streamp strm); 497extern int zlib_deflateReset (z_streamp strm);
556/* 498/*
@@ -568,27 +510,6 @@ static inline unsigned long deflateBound(unsigned long s)
568 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11; 510 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11;
569} 511}
570 512
571#if 0
572extern int zlib_deflateParams (z_streamp strm, int level, int strategy);
573#endif
574/*
575 Dynamically update the compression level and compression strategy. The
576 interpretation of level and strategy is as in deflateInit2. This can be
577 used to switch between compression and straight copy of the input data, or
578 to switch to a different kind of input data requiring a different
579 strategy. If the compression level is changed, the input available so far
580 is compressed with the old level (and may be flushed); the new level will
581 take effect only at the next call of deflate().
582
583 Before the call of deflateParams, the stream state must be set as for
584 a call of deflate(), since the currently available input may have to
585 be compressed and flushed. In particular, strm->avail_out must be non-zero.
586
587 deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
588 stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
589 if strm->avail_out was zero.
590*/
591
592/* 513/*
593extern int inflateInit2 (z_streamp strm, int windowBits); 514extern int inflateInit2 (z_streamp strm, int windowBits);
594 515
@@ -631,45 +552,6 @@ extern int inflateInit2 (z_streamp strm, int windowBits);
631 and avail_out are unchanged.) 552 and avail_out are unchanged.)
632*/ 553*/
633 554
634extern int zlib_inflateSetDictionary (z_streamp strm,
635 const Byte *dictionary,
636 uInt dictLength);
637/*
638 Initializes the decompression dictionary from the given uncompressed byte
639 sequence. This function must be called immediately after a call of inflate,
640 if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
641 can be determined from the adler32 value returned by that call of inflate.
642 The compressor and decompressor must use exactly the same dictionary (see
643 deflateSetDictionary). For raw inflate, this function can be called
644 immediately after inflateInit2() or inflateReset() and before any call of
645 inflate() to set the dictionary. The application must insure that the
646 dictionary that was used for compression is provided.
647
648 inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
649 parameter is invalid (such as NULL dictionary) or the stream state is
650 inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
651 expected one (incorrect adler32 value). inflateSetDictionary does not
652 perform any decompression: this will be done by subsequent calls of
653 inflate().
654*/
655
656#if 0
657extern int zlib_inflateSync (z_streamp strm);
658#endif
659/*
660 Skips invalid compressed data until a full flush point (see above the
661 description of deflate with Z_FULL_FLUSH) can be found, or until all
662 available input is skipped. No output is provided.
663
664 inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
665 if no more input was provided, Z_DATA_ERROR if no flush point has been found,
666 or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
667 case, the application may save the current current value of total_in which
668 indicates where valid compressed data was found. In the error case, the
669 application may repeatedly call inflateSync, providing more input each time,
670 until success or end of the input data.
671*/
672
673extern int zlib_inflateReset (z_streamp strm); 555extern int zlib_inflateReset (z_streamp strm);
674/* 556/*
675 This function is equivalent to inflateEnd followed by inflateInit, 557 This function is equivalent to inflateEnd followed by inflateInit,
diff --git a/include/linux/zpool.h b/include/linux/zpool.h
new file mode 100644
index 000000000000..f14bd75f08b3
--- /dev/null
+++ b/include/linux/zpool.h
@@ -0,0 +1,106 @@
1/*
2 * zpool memory storage api
3 *
4 * Copyright (C) 2014 Dan Streetman
5 *
6 * This is a common frontend for the zbud and zsmalloc memory
7 * storage pool implementations. Typically, this is used to
8 * store compressed memory.
9 */
10
11#ifndef _ZPOOL_H_
12#define _ZPOOL_H_
13
14struct zpool;
15
16struct zpool_ops {
17 int (*evict)(struct zpool *pool, unsigned long handle);
18};
19
20/*
21 * Control how a handle is mapped. It will be ignored if the
22 * implementation does not support it. Its use is optional.
23 * Note that this does not refer to memory protection, it
24 * refers to how the memory will be copied in/out if copying
25 * is necessary during mapping; read-write is the safest as
26 * it copies the existing memory in on map, and copies the
27 * changed memory back out on unmap. Write-only does not copy
28 * in the memory and should only be used for initialization.
29 * If in doubt, use ZPOOL_MM_DEFAULT which is read-write.
30 */
31enum zpool_mapmode {
32 ZPOOL_MM_RW, /* normal read-write mapping */
33 ZPOOL_MM_RO, /* read-only (no copy-out at unmap time) */
34 ZPOOL_MM_WO, /* write-only (no copy-in at map time) */
35
36 ZPOOL_MM_DEFAULT = ZPOOL_MM_RW
37};
38
39struct zpool *zpool_create_pool(char *type, gfp_t gfp, struct zpool_ops *ops);
40
41char *zpool_get_type(struct zpool *pool);
42
43void zpool_destroy_pool(struct zpool *pool);
44
45int zpool_malloc(struct zpool *pool, size_t size, gfp_t gfp,
46 unsigned long *handle);
47
48void zpool_free(struct zpool *pool, unsigned long handle);
49
50int zpool_shrink(struct zpool *pool, unsigned int pages,
51 unsigned int *reclaimed);
52
53void *zpool_map_handle(struct zpool *pool, unsigned long handle,
54 enum zpool_mapmode mm);
55
56void zpool_unmap_handle(struct zpool *pool, unsigned long handle);
57
58u64 zpool_get_total_size(struct zpool *pool);
59
60
61/**
62 * struct zpool_driver - driver implementation for zpool
63 * @type: name of the driver.
64 * @list: entry in the list of zpool drivers.
65 * @create: create a new pool.
66 * @destroy: destroy a pool.
67 * @malloc: allocate mem from a pool.
68 * @free: free mem from a pool.
69 * @shrink: shrink the pool.
70 * @map: map a handle.
71 * @unmap: unmap a handle.
72 * @total_size: get total size of a pool.
73 *
74 * This is created by a zpool implementation and registered
75 * with zpool.
76 */
77struct zpool_driver {
78 char *type;
79 struct module *owner;
80 atomic_t refcount;
81 struct list_head list;
82
83 void *(*create)(gfp_t gfp, struct zpool_ops *ops);
84 void (*destroy)(void *pool);
85
86 int (*malloc)(void *pool, size_t size, gfp_t gfp,
87 unsigned long *handle);
88 void (*free)(void *pool, unsigned long handle);
89
90 int (*shrink)(void *pool, unsigned int pages,
91 unsigned int *reclaimed);
92
93 void *(*map)(void *pool, unsigned long handle,
94 enum zpool_mapmode mm);
95 void (*unmap)(void *pool, unsigned long handle);
96
97 u64 (*total_size)(void *pool);
98};
99
100void zpool_register_driver(struct zpool_driver *driver);
101
102int zpool_unregister_driver(struct zpool_driver *driver);
103
104int zpool_evict(void *pool, unsigned long handle);
105
106#endif
diff --git a/include/linux/zsmalloc.h b/include/linux/zsmalloc.h
index e44d634e7fb7..05c214760977 100644
--- a/include/linux/zsmalloc.h
+++ b/include/linux/zsmalloc.h
@@ -46,6 +46,6 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle,
46 enum zs_mapmode mm); 46 enum zs_mapmode mm);
47void zs_unmap_object(struct zs_pool *pool, unsigned long handle); 47void zs_unmap_object(struct zs_pool *pool, unsigned long handle);
48 48
49u64 zs_get_total_size_bytes(struct zs_pool *pool); 49unsigned long zs_get_total_pages(struct zs_pool *pool);
50 50
51#endif 51#endif
diff --git a/include/media/davinci/dm644x_ccdc.h b/include/media/davinci/dm644x_ccdc.h
index 852e96c4bb46..984fb79031de 100644
--- a/include/media/davinci/dm644x_ccdc.h
+++ b/include/media/davinci/dm644x_ccdc.h
@@ -114,7 +114,7 @@ struct ccdc_fault_pixel {
114 /* Number of fault pixel */ 114 /* Number of fault pixel */
115 unsigned short fp_num; 115 unsigned short fp_num;
116 /* Address of fault pixel table */ 116 /* Address of fault pixel table */
117 unsigned int fpc_table_addr; 117 unsigned long fpc_table_addr;
118}; 118};
119 119
120/* Structure for CCDC configuration parameters for raw capture mode passed 120/* Structure for CCDC configuration parameters for raw capture mode passed
diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h
index c9d06d9f7e6e..398279dd1922 100644
--- a/include/media/omap3isp.h
+++ b/include/media/omap3isp.h
@@ -57,6 +57,8 @@ enum {
57 * 0 - Active high, 1 - Active low 57 * 0 - Active high, 1 - Active low
58 * @vs_pol: Vertical synchronization polarity 58 * @vs_pol: Vertical synchronization polarity
59 * 0 - Active high, 1 - Active low 59 * 0 - Active high, 1 - Active low
60 * @fld_pol: Field signal polarity
61 * 0 - Positive, 1 - Negative
60 * @data_pol: Data polarity 62 * @data_pol: Data polarity
61 * 0 - Normal, 1 - One's complement 63 * 0 - Normal, 1 - One's complement
62 */ 64 */
@@ -65,6 +67,7 @@ struct isp_parallel_platform_data {
65 unsigned int clk_pol:1; 67 unsigned int clk_pol:1;
66 unsigned int hs_pol:1; 68 unsigned int hs_pol:1;
67 unsigned int vs_pol:1; 69 unsigned int vs_pol:1;
70 unsigned int fld_pol:1;
68 unsigned int data_pol:1; 71 unsigned int data_pol:1;
69}; 72};
70 73
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 80f951890b4c..e7a1514075ec 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -135,6 +135,7 @@ void rc_map_init(void);
135#define RC_MAP_DM1105_NEC "rc-dm1105-nec" 135#define RC_MAP_DM1105_NEC "rc-dm1105-nec"
136#define RC_MAP_DNTV_LIVE_DVBT_PRO "rc-dntv-live-dvbt-pro" 136#define RC_MAP_DNTV_LIVE_DVBT_PRO "rc-dntv-live-dvbt-pro"
137#define RC_MAP_DNTV_LIVE_DVB_T "rc-dntv-live-dvb-t" 137#define RC_MAP_DNTV_LIVE_DVB_T "rc-dntv-live-dvb-t"
138#define RC_MAP_DVBSKY "rc-dvbsky"
138#define RC_MAP_EMPTY "rc-empty" 139#define RC_MAP_EMPTY "rc-empty"
139#define RC_MAP_EM_TERRATEC "rc-em-terratec" 140#define RC_MAP_EM_TERRATEC "rc-em-terratec"
140#define RC_MAP_ENCORE_ENLTV2 "rc-encore-enltv2" 141#define RC_MAP_ENCORE_ENLTV2 "rc-encore-enltv2"
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index fc910a622451..6ef2d01197da 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -295,7 +295,7 @@ struct vb2_buffer {
295 * can return an error if hardware fails, in that case all 295 * can return an error if hardware fails, in that case all
296 * buffers that have been already given by the @buf_queue 296 * buffers that have been already given by the @buf_queue
297 * callback are to be returned by the driver by calling 297 * callback are to be returned by the driver by calling
298 * @vb2_buffer_done(VB2_BUF_STATE_DEQUEUED). 298 * @vb2_buffer_done(VB2_BUF_STATE_QUEUED).
299 * If you need a minimum number of buffers before you can 299 * If you need a minimum number of buffers before you can
300 * start streaming, then set @min_buffers_needed in the 300 * start streaming, then set @min_buffers_needed in the
301 * vb2_queue structure. If that is non-zero then 301 * vb2_queue structure. If that is non-zero then
@@ -356,8 +356,8 @@ struct v4l2_fh;
356 * @buf_struct_size: size of the driver-specific buffer structure; 356 * @buf_struct_size: size of the driver-specific buffer structure;
357 * "0" indicates the driver doesn't want to use a custom buffer 357 * "0" indicates the driver doesn't want to use a custom buffer
358 * structure type, so sizeof(struct vb2_buffer) will is used 358 * structure type, so sizeof(struct vb2_buffer) will is used
359 * @timestamp_flags: Timestamp flags; V4L2_BUF_FLAGS_TIMESTAMP_* and 359 * @timestamp_flags: Timestamp flags; V4L2_BUF_FLAG_TIMESTAMP_* and
360 * V4L2_BUF_FLAGS_TSTAMP_SRC_* 360 * V4L2_BUF_FLAG_TSTAMP_SRC_*
361 * @gfp_flags: additional gfp flags used when allocating the buffers. 361 * @gfp_flags: additional gfp flags used when allocating the buffers.
362 * Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32 362 * Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32
363 * to force the buffer allocation to a specific memory zone. 363 * to force the buffer allocation to a specific memory zone.
@@ -366,6 +366,7 @@ struct v4l2_fh;
366 * cannot be started unless at least this number of buffers 366 * cannot be started unless at least this number of buffers
367 * have been queued into the driver. 367 * have been queued into the driver.
368 * 368 *
369 * @mmap_lock: private mutex used when buffers are allocated/freed/mmapped
369 * @memory: current memory type used 370 * @memory: current memory type used
370 * @bufs: videobuf buffer structures 371 * @bufs: videobuf buffer structures
371 * @num_buffers: number of allocated/used buffers 372 * @num_buffers: number of allocated/used buffers
@@ -380,6 +381,9 @@ struct v4l2_fh;
380 * @start_streaming_called: start_streaming() was called successfully and we 381 * @start_streaming_called: start_streaming() was called successfully and we
381 * started streaming. 382 * started streaming.
382 * @error: a fatal error occurred on the queue 383 * @error: a fatal error occurred on the queue
384 * @waiting_for_buffers: used in poll() to check if vb2 is still waiting for
385 * buffers. Only set for capture queues if qbuf has not yet been
386 * called since poll() needs to return POLLERR in that situation.
383 * @fileio: file io emulator internal data, used only if emulator is active 387 * @fileio: file io emulator internal data, used only if emulator is active
384 * @threadio: thread io internal data, used only if thread is active 388 * @threadio: thread io internal data, used only if thread is active
385 */ 389 */
@@ -399,6 +403,7 @@ struct vb2_queue {
399 u32 min_buffers_needed; 403 u32 min_buffers_needed;
400 404
401/* private: internal use only */ 405/* private: internal use only */
406 struct mutex mmap_lock;
402 enum v4l2_memory memory; 407 enum v4l2_memory memory;
403 struct vb2_buffer *bufs[VIDEO_MAX_FRAME]; 408 struct vb2_buffer *bufs[VIDEO_MAX_FRAME];
404 unsigned int num_buffers; 409 unsigned int num_buffers;
@@ -417,6 +422,7 @@ struct vb2_queue {
417 unsigned int streaming:1; 422 unsigned int streaming:1;
418 unsigned int start_streaming_called:1; 423 unsigned int start_streaming_called:1;
419 unsigned int error:1; 424 unsigned int error:1;
425 unsigned int waiting_for_buffers:1;
420 426
421 struct vb2_fileio_data *fileio; 427 struct vb2_fileio_data *fileio;
422 struct vb2_threadio_data *threadio; 428 struct vb2_threadio_data *threadio;
@@ -588,6 +594,15 @@ vb2_plane_size(struct vb2_buffer *vb, unsigned int plane_no)
588 return 0; 594 return 0;
589} 595}
590 596
597/**
598 * vb2_start_streaming_called() - return streaming status of driver
599 * @q: videobuf queue
600 */
601static inline bool vb2_start_streaming_called(struct vb2_queue *q)
602{
603 return q->start_streaming_called;
604}
605
591/* 606/*
592 * The following functions are not part of the vb2 core API, but are simple 607 * The following functions are not part of the vb2 core API, but are simple
593 * helper functions that you can use in your struct v4l2_file_operations, 608 * helper functions that you can use in your struct v4l2_file_operations,
diff --git a/include/misc/cxl.h b/include/misc/cxl.h
new file mode 100644
index 000000000000..975cc7861f18
--- /dev/null
+++ b/include/misc/cxl.h
@@ -0,0 +1,48 @@
1/*
2 * Copyright 2014 IBM Corp.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#ifndef _MISC_CXL_H
11#define _MISC_CXL_H
12
13#ifdef CONFIG_CXL_BASE
14
15#define CXL_IRQ_RANGES 4
16
17struct cxl_irq_ranges {
18 irq_hw_number_t offset[CXL_IRQ_RANGES];
19 irq_hw_number_t range[CXL_IRQ_RANGES];
20};
21
22extern atomic_t cxl_use_count;
23
24static inline bool cxl_ctx_in_use(void)
25{
26 return (atomic_read(&cxl_use_count) != 0);
27}
28
29static inline void cxl_ctx_get(void)
30{
31 atomic_inc(&cxl_use_count);
32}
33
34static inline void cxl_ctx_put(void)
35{
36 atomic_dec(&cxl_use_count);
37}
38
39void cxl_slbia(struct mm_struct *mm);
40
41#else /* CONFIG_CXL_BASE */
42
43static inline bool cxl_ctx_in_use(void) { return false; }
44static inline void cxl_slbia(struct mm_struct *mm) {}
45
46#endif /* CONFIG_CXL_BASE */
47
48#endif
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index d9fa68f26c41..2a25dec30211 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -34,7 +34,6 @@
34 * @list: used to maintain a list of currently available transports 34 * @list: used to maintain a list of currently available transports
35 * @name: the human-readable name of the transport 35 * @name: the human-readable name of the transport
36 * @maxsize: transport provided maximum packet size 36 * @maxsize: transport provided maximum packet size
37 * @pref: Preferences of this transport
38 * @def: set if this transport should be considered the default 37 * @def: set if this transport should be considered the default
39 * @create: member function to create a new connection on this transport 38 * @create: member function to create a new connection on this transport
40 * @close: member function to discard a connection on this transport 39 * @close: member function to discard a connection on this transport
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index f679877bb601..d13573bb879e 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -202,8 +202,9 @@ int ipv6_sock_ac_drop(struct sock *sk, int ifindex,
202 const struct in6_addr *addr); 202 const struct in6_addr *addr);
203void ipv6_sock_ac_close(struct sock *sk); 203void ipv6_sock_ac_close(struct sock *sk);
204 204
205int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); 205int __ipv6_dev_ac_inc(struct inet6_dev *idev, const struct in6_addr *addr);
206int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); 206int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr);
207void ipv6_ac_destroy_dev(struct inet6_dev *idev);
207bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev, 208bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
208 const struct in6_addr *addr); 209 const struct in6_addr *addr);
209bool ipv6_chk_acast_addr_src(struct net *net, struct net_device *dev, 210bool ipv6_chk_acast_addr_src(struct net *net, struct net_device *dev,
diff --git a/include/net/ah.h b/include/net/ah.h
index ca95b98969dd..4e2dfa474a7e 100644
--- a/include/net/ah.h
+++ b/include/net/ah.h
@@ -3,9 +3,6 @@
3 3
4#include <linux/skbuff.h> 4#include <linux/skbuff.h>
5 5
6/* This is the maximum truncated ICV length that we know of. */
7#define MAX_AH_AUTH_LEN 64
8
9struct crypto_ahash; 6struct crypto_ahash;
10 7
11struct ah_data { 8struct ah_data {
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 373000de610d..58695ffeb138 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -120,9 +120,9 @@ struct bt_voice {
120#define BT_RCVMTU 13 120#define BT_RCVMTU 13
121 121
122__printf(1, 2) 122__printf(1, 2)
123int bt_info(const char *fmt, ...); 123void bt_info(const char *fmt, ...);
124__printf(1, 2) 124__printf(1, 2)
125int bt_err(const char *fmt, ...); 125void bt_err(const char *fmt, ...);
126 126
127#define BT_INFO(fmt, ...) bt_info(fmt "\n", ##__VA_ARGS__) 127#define BT_INFO(fmt, ...) bt_info(fmt "\n", ##__VA_ARGS__)
128#define BT_ERR(fmt, ...) bt_err(fmt "\n", ##__VA_ARGS__) 128#define BT_ERR(fmt, ...) bt_err(fmt "\n", ##__VA_ARGS__)
@@ -284,6 +284,7 @@ struct hci_req_ctrl {
284struct bt_skb_cb { 284struct bt_skb_cb {
285 __u8 pkt_type; 285 __u8 pkt_type;
286 __u8 incoming; 286 __u8 incoming;
287 __u16 opcode;
287 __u16 expect; 288 __u16 expect;
288 __u8 force_active; 289 __u8 force_active;
289 struct l2cap_chan *chan; 290 struct l2cap_chan *chan;
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 3f8547f1c6f8..6e8f24967308 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -385,6 +385,7 @@ enum {
385#define HCI_ERROR_AUTH_FAILURE 0x05 385#define HCI_ERROR_AUTH_FAILURE 0x05
386#define HCI_ERROR_MEMORY_EXCEEDED 0x07 386#define HCI_ERROR_MEMORY_EXCEEDED 0x07
387#define HCI_ERROR_CONNECTION_TIMEOUT 0x08 387#define HCI_ERROR_CONNECTION_TIMEOUT 0x08
388#define HCI_ERROR_REJ_LIMITED_RESOURCES 0x0d
388#define HCI_ERROR_REJ_BAD_ADDR 0x0f 389#define HCI_ERROR_REJ_BAD_ADDR 0x0f
389#define HCI_ERROR_REMOTE_USER_TERM 0x13 390#define HCI_ERROR_REMOTE_USER_TERM 0x13
390#define HCI_ERROR_REMOTE_LOW_RESOURCES 0x14 391#define HCI_ERROR_REMOTE_LOW_RESOURCES 0x14
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index b5d5af3aa469..37ff1aef0845 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -302,7 +302,7 @@ struct hci_dev {
302 __u32 req_status; 302 __u32 req_status;
303 __u32 req_result; 303 __u32 req_result;
304 304
305 struct crypto_blkcipher *tfm_aes; 305 void *smp_data;
306 306
307 struct discovery_state discovery; 307 struct discovery_state discovery;
308 struct hci_conn_hash conn_hash; 308 struct hci_conn_hash conn_hash;
@@ -464,6 +464,8 @@ struct hci_conn_params {
464 HCI_AUTO_CONN_ALWAYS, 464 HCI_AUTO_CONN_ALWAYS,
465 HCI_AUTO_CONN_LINK_LOSS, 465 HCI_AUTO_CONN_LINK_LOSS,
466 } auto_connect; 466 } auto_connect;
467
468 struct hci_conn *conn;
467}; 469};
468 470
469extern struct list_head hci_dev_list; 471extern struct list_head hci_dev_list;
@@ -537,7 +539,6 @@ enum {
537 HCI_CONN_RSWITCH_PEND, 539 HCI_CONN_RSWITCH_PEND,
538 HCI_CONN_MODE_CHANGE_PEND, 540 HCI_CONN_MODE_CHANGE_PEND,
539 HCI_CONN_SCO_SETUP_PEND, 541 HCI_CONN_SCO_SETUP_PEND,
540 HCI_CONN_LE_SMP_PEND,
541 HCI_CONN_MGMT_CONNECTED, 542 HCI_CONN_MGMT_CONNECTED,
542 HCI_CONN_SSP_ENABLED, 543 HCI_CONN_SSP_ENABLED,
543 HCI_CONN_SC_ENABLED, 544 HCI_CONN_SC_ENABLED,
@@ -551,6 +552,7 @@ enum {
551 HCI_CONN_FIPS, 552 HCI_CONN_FIPS,
552 HCI_CONN_STK_ENCRYPT, 553 HCI_CONN_STK_ENCRYPT,
553 HCI_CONN_AUTH_INITIATOR, 554 HCI_CONN_AUTH_INITIATOR,
555 HCI_CONN_DROP,
554}; 556};
555 557
556static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) 558static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
@@ -700,7 +702,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
700 return NULL; 702 return NULL;
701} 703}
702 704
703void hci_disconnect(struct hci_conn *conn, __u8 reason); 705int hci_disconnect(struct hci_conn *conn, __u8 reason);
704bool hci_setup_sync(struct hci_conn *conn, __u16 handle); 706bool hci_setup_sync(struct hci_conn *conn, __u16 handle);
705void hci_sco_setup(struct hci_conn *conn, __u8 status); 707void hci_sco_setup(struct hci_conn *conn, __u8 status);
706 708
@@ -754,9 +756,10 @@ void hci_le_conn_failed(struct hci_conn *conn, u8 status);
754 * _get()/_drop() in it, but require the caller to have a valid ref (FIXME). 756 * _get()/_drop() in it, but require the caller to have a valid ref (FIXME).
755 */ 757 */
756 758
757static inline void hci_conn_get(struct hci_conn *conn) 759static inline struct hci_conn *hci_conn_get(struct hci_conn *conn)
758{ 760{
759 get_device(&conn->dev); 761 get_device(&conn->dev);
762 return conn;
760} 763}
761 764
762static inline void hci_conn_put(struct hci_conn *conn) 765static inline void hci_conn_put(struct hci_conn *conn)
@@ -788,7 +791,7 @@ static inline void hci_conn_drop(struct hci_conn *conn)
788 if (!conn->out) 791 if (!conn->out)
789 timeo *= 2; 792 timeo *= 2;
790 } else { 793 } else {
791 timeo = msecs_to_jiffies(10); 794 timeo = 0;
792 } 795 }
793 break; 796 break;
794 797
@@ -797,7 +800,7 @@ static inline void hci_conn_drop(struct hci_conn *conn)
797 break; 800 break;
798 801
799 default: 802 default:
800 timeo = msecs_to_jiffies(10); 803 timeo = 0;
801 break; 804 break;
802 } 805 }
803 806
@@ -923,7 +926,6 @@ int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
923void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 926void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
924 927
925int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb); 928int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb);
926int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count);
927int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count); 929int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count);
928 930
929void hci_init_sysfs(struct hci_dev *hdev); 931void hci_init_sysfs(struct hci_dev *hdev);
@@ -968,6 +970,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
968#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) 970#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE))
969#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) 971#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR))
970 972
973#define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \
974 !test_bit(HCI_AUTO_OFF, &hdev->dev_flags))
975
971/* ----- HCI protocols ----- */ 976/* ----- HCI protocols ----- */
972#define HCI_PROTO_DEFER 0x01 977#define HCI_PROTO_DEFER 0x01
973 978
@@ -1256,6 +1261,8 @@ bool hci_req_pending(struct hci_dev *hdev);
1256void hci_req_add_le_scan_disable(struct hci_request *req); 1261void hci_req_add_le_scan_disable(struct hci_request *req);
1257void hci_req_add_le_passive_scan(struct hci_request *req); 1262void hci_req_add_le_passive_scan(struct hci_request *req);
1258 1263
1264void hci_update_page_scan(struct hci_dev *hdev, struct hci_request *req);
1265
1259struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, 1266struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen,
1260 const void *param, u32 timeout); 1267 const void *param, u32 timeout);
1261struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, 1268struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen,
@@ -1334,8 +1341,7 @@ int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1334int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr, 1341int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr,
1335 u8 link_type, u8 addr_type, u32 passkey, 1342 u8 link_type, u8 addr_type, u32 passkey,
1336 u8 entered); 1343 u8 entered);
1337void mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1344void mgmt_auth_failed(struct hci_conn *conn, u8 status);
1338 u8 addr_type, u8 status);
1339void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); 1345void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
1340void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); 1346void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1341void mgmt_sc_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); 1347void mgmt_sc_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
@@ -1351,6 +1357,7 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1351void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1357void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1352 u8 addr_type, s8 rssi, u8 *name, u8 name_len); 1358 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
1353void mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1359void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1360bool mgmt_powering_down(struct hci_dev *hdev);
1354void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent); 1361void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent);
1355void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk); 1362void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk);
1356void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk, 1363void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 8df15ad0d43f..ead99f032f7a 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -633,10 +633,11 @@ struct l2cap_conn {
633 struct sk_buff_head pending_rx; 633 struct sk_buff_head pending_rx;
634 struct work_struct pending_rx_work; 634 struct work_struct pending_rx_work;
635 635
636 struct work_struct id_addr_update_work;
637
636 __u8 disc_reason; 638 __u8 disc_reason;
637 639
638 struct delayed_work security_timer; 640 struct l2cap_chan *smp;
639 struct smp_chan *smp_chan;
640 641
641 struct list_head chan_l; 642 struct list_head chan_l;
642 struct mutex chan_lock; 643 struct mutex chan_lock;
@@ -708,6 +709,8 @@ enum {
708 FLAG_EFS_ENABLE, 709 FLAG_EFS_ENABLE,
709 FLAG_DEFER_SETUP, 710 FLAG_DEFER_SETUP,
710 FLAG_LE_CONN_REQ_SENT, 711 FLAG_LE_CONN_REQ_SENT,
712 FLAG_PENDING_SECURITY,
713 FLAG_HOLD_HCI_CONN,
711}; 714};
712 715
713enum { 716enum {
@@ -837,18 +840,43 @@ static inline struct l2cap_chan *l2cap_chan_no_new_connection(struct l2cap_chan
837 return NULL; 840 return NULL;
838} 841}
839 842
843static inline int l2cap_chan_no_recv(struct l2cap_chan *chan, struct sk_buff *skb)
844{
845 return -ENOSYS;
846}
847
848static inline struct sk_buff *l2cap_chan_no_alloc_skb(struct l2cap_chan *chan,
849 unsigned long hdr_len,
850 unsigned long len, int nb)
851{
852 return ERR_PTR(-ENOSYS);
853}
854
840static inline void l2cap_chan_no_teardown(struct l2cap_chan *chan, int err) 855static inline void l2cap_chan_no_teardown(struct l2cap_chan *chan, int err)
841{ 856{
842} 857}
843 858
859static inline void l2cap_chan_no_close(struct l2cap_chan *chan)
860{
861}
862
844static inline void l2cap_chan_no_ready(struct l2cap_chan *chan) 863static inline void l2cap_chan_no_ready(struct l2cap_chan *chan)
845{ 864{
846} 865}
847 866
867static inline void l2cap_chan_no_state_change(struct l2cap_chan *chan,
868 int state, int err)
869{
870}
871
848static inline void l2cap_chan_no_defer(struct l2cap_chan *chan) 872static inline void l2cap_chan_no_defer(struct l2cap_chan *chan)
849{ 873{
850} 874}
851 875
876static inline void l2cap_chan_no_suspend(struct l2cap_chan *chan)
877{
878}
879
852static inline void l2cap_chan_no_resume(struct l2cap_chan *chan) 880static inline void l2cap_chan_no_resume(struct l2cap_chan *chan)
853{ 881{
854} 882}
@@ -911,14 +939,13 @@ int l2cap_ertm_init(struct l2cap_chan *chan);
911void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); 939void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
912void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); 940void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
913void l2cap_chan_del(struct l2cap_chan *chan, int err); 941void l2cap_chan_del(struct l2cap_chan *chan, int err);
914void l2cap_conn_update_id_addr(struct hci_conn *hcon);
915void l2cap_send_conn_req(struct l2cap_chan *chan); 942void l2cap_send_conn_req(struct l2cap_chan *chan);
916void l2cap_move_start(struct l2cap_chan *chan); 943void l2cap_move_start(struct l2cap_chan *chan);
917void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan, 944void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan,
918 u8 status); 945 u8 status);
919void __l2cap_physical_cfm(struct l2cap_chan *chan, int result); 946void __l2cap_physical_cfm(struct l2cap_chan *chan, int result);
920 947
921void l2cap_conn_get(struct l2cap_conn *conn); 948struct l2cap_conn *l2cap_conn_get(struct l2cap_conn *conn);
922void l2cap_conn_put(struct l2cap_conn *conn); 949void l2cap_conn_put(struct l2cap_conn *conn);
923 950
924int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user); 951int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user);
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0a080c4de275..a2ddcf2398fd 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4,6 +4,7 @@
4 * 802.11 device and configuration interface 4 * 802.11 device and configuration interface
5 * 5 *
6 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
7 * Copyright 2013-2014 Intel Mobile Communications GmbH
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * 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 * it under the terms of the GNU General Public License version 2 as
@@ -663,6 +664,7 @@ struct cfg80211_acl_data {
663 * @crypto: crypto settings 664 * @crypto: crypto settings
664 * @privacy: the BSS uses privacy 665 * @privacy: the BSS uses privacy
665 * @auth_type: Authentication type (algorithm) 666 * @auth_type: Authentication type (algorithm)
667 * @smps_mode: SMPS mode
666 * @inactivity_timeout: time in seconds to determine station's inactivity. 668 * @inactivity_timeout: time in seconds to determine station's inactivity.
667 * @p2p_ctwindow: P2P CT Window 669 * @p2p_ctwindow: P2P CT Window
668 * @p2p_opp_ps: P2P opportunistic PS 670 * @p2p_opp_ps: P2P opportunistic PS
@@ -681,6 +683,7 @@ struct cfg80211_ap_settings {
681 struct cfg80211_crypto_settings crypto; 683 struct cfg80211_crypto_settings crypto;
682 bool privacy; 684 bool privacy;
683 enum nl80211_auth_type auth_type; 685 enum nl80211_auth_type auth_type;
686 enum nl80211_smps_mode smps_mode;
684 int inactivity_timeout; 687 int inactivity_timeout;
685 u8 p2p_ctwindow; 688 u8 p2p_ctwindow;
686 bool p2p_opp_ps; 689 bool p2p_opp_ps;
@@ -1503,12 +1506,14 @@ enum cfg80211_signal_type {
1503 * @tsf: TSF contained in the frame that carried these IEs 1506 * @tsf: TSF contained in the frame that carried these IEs
1504 * @rcu_head: internal use, for freeing 1507 * @rcu_head: internal use, for freeing
1505 * @len: length of the IEs 1508 * @len: length of the IEs
1509 * @from_beacon: these IEs are known to come from a beacon
1506 * @data: IE data 1510 * @data: IE data
1507 */ 1511 */
1508struct cfg80211_bss_ies { 1512struct cfg80211_bss_ies {
1509 u64 tsf; 1513 u64 tsf;
1510 struct rcu_head rcu_head; 1514 struct rcu_head rcu_head;
1511 int len; 1515 int len;
1516 bool from_beacon;
1512 u8 data[]; 1517 u8 data[];
1513}; 1518};
1514 1519
@@ -1605,10 +1610,12 @@ struct cfg80211_auth_request {
1605 * 1610 *
1606 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) 1611 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
1607 * @ASSOC_REQ_DISABLE_VHT: Disable VHT 1612 * @ASSOC_REQ_DISABLE_VHT: Disable VHT
1613 * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
1608 */ 1614 */
1609enum cfg80211_assoc_req_flags { 1615enum cfg80211_assoc_req_flags {
1610 ASSOC_REQ_DISABLE_HT = BIT(0), 1616 ASSOC_REQ_DISABLE_HT = BIT(0),
1611 ASSOC_REQ_DISABLE_VHT = BIT(1), 1617 ASSOC_REQ_DISABLE_VHT = BIT(1),
1618 ASSOC_REQ_USE_RRM = BIT(2),
1612}; 1619};
1613 1620
1614/** 1621/**
@@ -1800,6 +1807,7 @@ struct cfg80211_connect_params {
1800 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 1807 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
1801 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 1808 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
1802 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 1809 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
1810 * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
1803 */ 1811 */
1804enum wiphy_params_flags { 1812enum wiphy_params_flags {
1805 WIPHY_PARAM_RETRY_SHORT = 1 << 0, 1813 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
@@ -1807,6 +1815,7 @@ enum wiphy_params_flags {
1807 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 1815 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
1808 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 1816 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
1809 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 1817 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
1818 WIPHY_PARAM_DYN_ACK = 1 << 5,
1810}; 1819};
1811 1820
1812/* 1821/*
@@ -1973,14 +1982,12 @@ struct cfg80211_wowlan_wakeup {
1973 1982
1974/** 1983/**
1975 * struct cfg80211_gtk_rekey_data - rekey data 1984 * struct cfg80211_gtk_rekey_data - rekey data
1976 * @kek: key encryption key 1985 * @kek: key encryption key (NL80211_KEK_LEN bytes)
1977 * @kck: key confirmation key 1986 * @kck: key confirmation key (NL80211_KCK_LEN bytes)
1978 * @replay_ctr: replay counter 1987 * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
1979 */ 1988 */
1980struct cfg80211_gtk_rekey_data { 1989struct cfg80211_gtk_rekey_data {
1981 u8 kek[NL80211_KEK_LEN]; 1990 const u8 *kek, *kck, *replay_ctr;
1982 u8 kck[NL80211_KCK_LEN];
1983 u8 replay_ctr[NL80211_REPLAY_CTR_LEN];
1984}; 1991};
1985 1992
1986/** 1993/**
@@ -2313,6 +2320,17 @@ struct cfg80211_qos_map {
2313 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the 2320 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
2314 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width 2321 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width
2315 * changes during the lifetime of the BSS. 2322 * changes during the lifetime of the BSS.
2323 *
2324 * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
2325 * with the given parameters; action frame exchange has been handled by
2326 * userspace so this just has to modify the TX path to take the TS into
2327 * account.
2328 * If the admitted time is 0 just validate the parameters to make sure
2329 * the session can be created at all; it is valid to just always return
2330 * success for that but that may result in inefficient behaviour (handshake
2331 * with the peer followed by immediate teardown when the addition is later
2332 * rejected)
2333 * @del_tx_ts: remove an existing TX TS
2316 */ 2334 */
2317struct cfg80211_ops { 2335struct cfg80211_ops {
2318 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 2336 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -2553,6 +2571,12 @@ struct cfg80211_ops {
2553 2571
2554 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, 2572 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
2555 struct cfg80211_chan_def *chandef); 2573 struct cfg80211_chan_def *chandef);
2574
2575 int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
2576 u8 tsid, const u8 *peer, u8 user_prio,
2577 u16 admitted_time);
2578 int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
2579 u8 tsid, const u8 *peer);
2556}; 2580};
2557 2581
2558/* 2582/*
@@ -2599,9 +2623,13 @@ struct cfg80211_ops {
2599 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. 2623 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
2600 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in 2624 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
2601 * beaconing mode (AP, IBSS, Mesh, ...). 2625 * beaconing mode (AP, IBSS, Mesh, ...).
2626 * @WIPHY_FLAG_SUPPORTS_WMM_ADMISSION: the device supports setting up WMM
2627 * TSPEC sessions (TID aka TSID 0-7) with the NL80211_CMD_ADD_TX_TS
2628 * command. Standard IEEE 802.11 TSPEC setup is not yet supported, it
2629 * needs to be able to handle Block-Ack agreements and other things.
2602 */ 2630 */
2603enum wiphy_flags { 2631enum wiphy_flags {
2604 /* use hole at 0 */ 2632 WIPHY_FLAG_SUPPORTS_WMM_ADMISSION = BIT(0),
2605 /* use hole at 1 */ 2633 /* use hole at 1 */
2606 /* use hole at 2 */ 2634 /* use hole at 2 */
2607 WIPHY_FLAG_NETNS_OK = BIT(3), 2635 WIPHY_FLAG_NETNS_OK = BIT(3),
@@ -3765,11 +3793,25 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
3765} 3793}
3766 3794
3767/** 3795/**
3768 * cfg80211_inform_bss - inform cfg80211 of a new BSS 3796 * enum cfg80211_bss_frame_type - frame type that the BSS data came from
3797 * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
3798 * from a beacon or probe response
3799 * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
3800 * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
3801 */
3802enum cfg80211_bss_frame_type {
3803 CFG80211_BSS_FTYPE_UNKNOWN,
3804 CFG80211_BSS_FTYPE_BEACON,
3805 CFG80211_BSS_FTYPE_PRESP,
3806};
3807
3808/**
3809 * cfg80211_inform_bss_width - inform cfg80211 of a new BSS
3769 * 3810 *
3770 * @wiphy: the wiphy reporting the BSS 3811 * @wiphy: the wiphy reporting the BSS
3771 * @rx_channel: The channel the frame was received on 3812 * @rx_channel: The channel the frame was received on
3772 * @scan_width: width of the control channel 3813 * @scan_width: width of the control channel
3814 * @ftype: frame type (if known)
3773 * @bssid: the BSSID of the BSS 3815 * @bssid: the BSSID of the BSS
3774 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 3816 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
3775 * @capability: the capability field sent by the peer 3817 * @capability: the capability field sent by the peer
@@ -3789,6 +3831,7 @@ struct cfg80211_bss * __must_check
3789cfg80211_inform_bss_width(struct wiphy *wiphy, 3831cfg80211_inform_bss_width(struct wiphy *wiphy,
3790 struct ieee80211_channel *rx_channel, 3832 struct ieee80211_channel *rx_channel,
3791 enum nl80211_bss_scan_width scan_width, 3833 enum nl80211_bss_scan_width scan_width,
3834 enum cfg80211_bss_frame_type ftype,
3792 const u8 *bssid, u64 tsf, u16 capability, 3835 const u8 *bssid, u64 tsf, u16 capability,
3793 u16 beacon_interval, const u8 *ie, size_t ielen, 3836 u16 beacon_interval, const u8 *ie, size_t ielen,
3794 s32 signal, gfp_t gfp); 3837 s32 signal, gfp_t gfp);
@@ -3796,12 +3839,13 @@ cfg80211_inform_bss_width(struct wiphy *wiphy,
3796static inline struct cfg80211_bss * __must_check 3839static inline struct cfg80211_bss * __must_check
3797cfg80211_inform_bss(struct wiphy *wiphy, 3840cfg80211_inform_bss(struct wiphy *wiphy,
3798 struct ieee80211_channel *rx_channel, 3841 struct ieee80211_channel *rx_channel,
3842 enum cfg80211_bss_frame_type ftype,
3799 const u8 *bssid, u64 tsf, u16 capability, 3843 const u8 *bssid, u64 tsf, u16 capability,
3800 u16 beacon_interval, const u8 *ie, size_t ielen, 3844 u16 beacon_interval, const u8 *ie, size_t ielen,
3801 s32 signal, gfp_t gfp) 3845 s32 signal, gfp_t gfp)
3802{ 3846{
3803 return cfg80211_inform_bss_width(wiphy, rx_channel, 3847 return cfg80211_inform_bss_width(wiphy, rx_channel,
3804 NL80211_BSS_CHAN_WIDTH_20, 3848 NL80211_BSS_CHAN_WIDTH_20, ftype,
3805 bssid, tsf, capability, 3849 bssid, tsf, capability,
3806 beacon_interval, ie, ielen, signal, 3850 beacon_interval, ie, ielen, signal,
3807 gfp); 3851 gfp);
@@ -3902,6 +3946,7 @@ void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
3902 * moves to cfg80211 in this call 3946 * moves to cfg80211 in this call
3903 * @buf: authentication frame (header + body) 3947 * @buf: authentication frame (header + body)
3904 * @len: length of the frame data 3948 * @len: length of the frame data
3949 * @uapsd_queues: bitmap of ACs configured to uapsd. -1 if n/a.
3905 * 3950 *
3906 * After being asked to associate via cfg80211_ops::assoc() the driver must 3951 * After being asked to associate via cfg80211_ops::assoc() the driver must
3907 * call either this function or cfg80211_auth_timeout(). 3952 * call either this function or cfg80211_auth_timeout().
@@ -3910,7 +3955,8 @@ void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
3910 */ 3955 */
3911void cfg80211_rx_assoc_resp(struct net_device *dev, 3956void cfg80211_rx_assoc_resp(struct net_device *dev,
3912 struct cfg80211_bss *bss, 3957 struct cfg80211_bss *bss,
3913 const u8 *buf, size_t len); 3958 const u8 *buf, size_t len,
3959 int uapsd_queues);
3914 3960
3915/** 3961/**
3916 * cfg80211_assoc_timeout - notification of timed out association 3962 * cfg80211_assoc_timeout - notification of timed out association
@@ -4412,7 +4458,6 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
4412 * @buf: Management frame (header + body) 4458 * @buf: Management frame (header + body)
4413 * @len: length of the frame data 4459 * @len: length of the frame data
4414 * @flags: flags, as defined in enum nl80211_rxmgmt_flags 4460 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
4415 * @gfp: context flags
4416 * 4461 *
4417 * This function is called whenever an Action frame is received for a station 4462 * This function is called whenever an Action frame is received for a station
4418 * mode interface, but is not processed in kernel. 4463 * mode interface, but is not processed in kernel.
@@ -4423,7 +4468,7 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
4423 * driver is responsible for rejecting the frame. 4468 * driver is responsible for rejecting the frame.
4424 */ 4469 */
4425bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm, 4470bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
4426 const u8 *buf, size_t len, u32 flags, gfp_t gfp); 4471 const u8 *buf, size_t len, u32 flags);
4427 4472
4428/** 4473/**
4429 * cfg80211_mgmt_tx_status - notification of TX status for management frame 4474 * cfg80211_mgmt_tx_status - notification of TX status for management frame
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 87cb1903640d..6465bae80a4f 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -122,9 +122,7 @@ static inline __wsum csum_partial_ext(const void *buff, int len, __wsum sum)
122 122
123static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) 123static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
124{ 124{
125 __be32 diff[] = { ~from, to }; 125 *sum = csum_fold(csum_add(csum_sub(~csum_unfold(*sum), from), to));
126
127 *sum = csum_fold(csum_partial(diff, sizeof(diff), ~csum_unfold(*sum)));
128} 126}
129 127
130/* Implements RFC 1624 (Incremental Internet Checksum) 128/* Implements RFC 1624 (Incremental Internet Checksum)
diff --git a/include/net/codel.h b/include/net/codel.h
index fe0eab32ce76..aeee28081245 100644
--- a/include/net/codel.h
+++ b/include/net/codel.h
@@ -66,7 +66,7 @@ typedef s32 codel_tdiff_t;
66 66
67static inline codel_time_t codel_get_time(void) 67static inline codel_time_t codel_get_time(void)
68{ 68{
69 u64 ns = ktime_to_ns(ktime_get()); 69 u64 ns = ktime_get_ns();
70 70
71 return ns >> CODEL_SHIFT; 71 return ns >> CODEL_SHIFT;
72} 72}
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 6efce384451e..b76559293535 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -15,6 +15,18 @@
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/timer.h> 16#include <linux/timer.h>
17#include <linux/workqueue.h> 17#include <linux/workqueue.h>
18#include <linux/of.h>
19#include <linux/phy.h>
20#include <linux/phy_fixed.h>
21#include <linux/ethtool.h>
22
23enum dsa_tag_protocol {
24 DSA_TAG_PROTO_NONE = 0,
25 DSA_TAG_PROTO_DSA,
26 DSA_TAG_PROTO_TRAILER,
27 DSA_TAG_PROTO_EDSA,
28 DSA_TAG_PROTO_BRCM,
29};
18 30
19#define DSA_MAX_SWITCHES 4 31#define DSA_MAX_SWITCHES 4
20#define DSA_MAX_PORTS 12 32#define DSA_MAX_PORTS 12
@@ -23,9 +35,15 @@ struct dsa_chip_data {
23 /* 35 /*
24 * How to access the switch configuration registers. 36 * How to access the switch configuration registers.
25 */ 37 */
26 struct device *mii_bus; 38 struct device *host_dev;
27 int sw_addr; 39 int sw_addr;
28 40
41 /* Device tree node pointer for this specific switch chip
42 * used during switch setup in case additional properties
43 * and resources needs to be used
44 */
45 struct device_node *of_node;
46
29 /* 47 /*
30 * The names of the switch's ports. Use "cpu" to 48 * The names of the switch's ports. Use "cpu" to
31 * designate the switch port that the cpu is connected to, 49 * designate the switch port that the cpu is connected to,
@@ -34,6 +52,7 @@ struct dsa_chip_data {
34 * or any other string to indicate this is a physical port. 52 * or any other string to indicate this is a physical port.
35 */ 53 */
36 char *port_names[DSA_MAX_PORTS]; 54 char *port_names[DSA_MAX_PORTS];
55 struct device_node *port_dn[DSA_MAX_PORTS];
37 56
38 /* 57 /*
39 * An array (with nr_chips elements) of which element [a] 58 * An array (with nr_chips elements) of which element [a]
@@ -59,6 +78,8 @@ struct dsa_platform_data {
59 struct dsa_chip_data *chip; 78 struct dsa_chip_data *chip;
60}; 79};
61 80
81struct packet_type;
82
62struct dsa_switch_tree { 83struct dsa_switch_tree {
63 /* 84 /*
64 * Configuration data for the platform device that owns 85 * Configuration data for the platform device that owns
@@ -71,7 +92,11 @@ struct dsa_switch_tree {
71 * protocol to use. 92 * protocol to use.
72 */ 93 */
73 struct net_device *master_netdev; 94 struct net_device *master_netdev;
74 __be16 tag_protocol; 95 int (*rcv)(struct sk_buff *skb,
96 struct net_device *dev,
97 struct packet_type *pt,
98 struct net_device *orig_dev);
99 enum dsa_tag_protocol tag_protocol;
75 100
76 /* 101 /*
77 * The switch and port to which the CPU is attached. 102 * The switch and port to which the CPU is attached.
@@ -110,15 +135,16 @@ struct dsa_switch {
110 struct dsa_switch_driver *drv; 135 struct dsa_switch_driver *drv;
111 136
112 /* 137 /*
113 * Reference to mii bus to use. 138 * Reference to host device to use.
114 */ 139 */
115 struct mii_bus *master_mii_bus; 140 struct device *master_dev;
116 141
117 /* 142 /*
118 * Slave mii_bus and devices for the individual ports. 143 * Slave mii_bus and devices for the individual ports.
119 */ 144 */
120 u32 dsa_port_mask; 145 u32 dsa_port_mask;
121 u32 phys_port_mask; 146 u32 phys_port_mask;
147 u32 phys_mii_mask;
122 struct mii_bus *slave_mii_bus; 148 struct mii_bus *slave_mii_bus;
123 struct net_device *ports[DSA_MAX_PORTS]; 149 struct net_device *ports[DSA_MAX_PORTS];
124}; 150};
@@ -147,15 +173,16 @@ static inline u8 dsa_upstream_port(struct dsa_switch *ds)
147struct dsa_switch_driver { 173struct dsa_switch_driver {
148 struct list_head list; 174 struct list_head list;
149 175
150 __be16 tag_protocol; 176 enum dsa_tag_protocol tag_protocol;
151 int priv_size; 177 int priv_size;
152 178
153 /* 179 /*
154 * Probing and setup. 180 * Probing and setup.
155 */ 181 */
156 char *(*probe)(struct mii_bus *bus, int sw_addr); 182 char *(*probe)(struct device *host_dev, int sw_addr);
157 int (*setup)(struct dsa_switch *ds); 183 int (*setup)(struct dsa_switch *ds);
158 int (*set_addr)(struct dsa_switch *ds, u8 *addr); 184 int (*set_addr)(struct dsa_switch *ds, u8 *addr);
185 u32 (*get_phy_flags)(struct dsa_switch *ds, int port);
159 186
160 /* 187 /*
161 * Access to the switch's PHY registers. 188 * Access to the switch's PHY registers.
@@ -170,37 +197,64 @@ struct dsa_switch_driver {
170 void (*poll_link)(struct dsa_switch *ds); 197 void (*poll_link)(struct dsa_switch *ds);
171 198
172 /* 199 /*
200 * Link state adjustment (called from libphy)
201 */
202 void (*adjust_link)(struct dsa_switch *ds, int port,
203 struct phy_device *phydev);
204 void (*fixed_link_update)(struct dsa_switch *ds, int port,
205 struct fixed_phy_status *st);
206
207 /*
173 * ethtool hardware statistics. 208 * ethtool hardware statistics.
174 */ 209 */
175 void (*get_strings)(struct dsa_switch *ds, int port, uint8_t *data); 210 void (*get_strings)(struct dsa_switch *ds, int port, uint8_t *data);
176 void (*get_ethtool_stats)(struct dsa_switch *ds, 211 void (*get_ethtool_stats)(struct dsa_switch *ds,
177 int port, uint64_t *data); 212 int port, uint64_t *data);
178 int (*get_sset_count)(struct dsa_switch *ds); 213 int (*get_sset_count)(struct dsa_switch *ds);
214
215 /*
216 * ethtool Wake-on-LAN
217 */
218 void (*get_wol)(struct dsa_switch *ds, int port,
219 struct ethtool_wolinfo *w);
220 int (*set_wol)(struct dsa_switch *ds, int port,
221 struct ethtool_wolinfo *w);
222
223 /*
224 * Suspend and resume
225 */
226 int (*suspend)(struct dsa_switch *ds);
227 int (*resume)(struct dsa_switch *ds);
228
229 /*
230 * Port enable/disable
231 */
232 int (*port_enable)(struct dsa_switch *ds, int port,
233 struct phy_device *phy);
234 void (*port_disable)(struct dsa_switch *ds, int port,
235 struct phy_device *phy);
236
237 /*
238 * EEE setttings
239 */
240 int (*set_eee)(struct dsa_switch *ds, int port,
241 struct phy_device *phydev,
242 struct ethtool_eee *e);
243 int (*get_eee)(struct dsa_switch *ds, int port,
244 struct ethtool_eee *e);
179}; 245};
180 246
181void register_switch_driver(struct dsa_switch_driver *type); 247void register_switch_driver(struct dsa_switch_driver *type);
182void unregister_switch_driver(struct dsa_switch_driver *type); 248void unregister_switch_driver(struct dsa_switch_driver *type);
249struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev);
183 250
184static inline void *ds_to_priv(struct dsa_switch *ds) 251static inline void *ds_to_priv(struct dsa_switch *ds)
185{ 252{
186 return (void *)(ds + 1); 253 return (void *)(ds + 1);
187} 254}
188 255
189/* 256static inline bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst)
190 * The original DSA tag format and some other tag formats have no
191 * ethertype, which means that we need to add a little hack to the
192 * networking receive path to make sure that received frames get
193 * the right ->protocol assigned to them when one of those tag
194 * formats is in use.
195 */
196static inline bool dsa_uses_dsa_tags(struct dsa_switch_tree *dst)
197{
198 return !!(dst->tag_protocol == htons(ETH_P_DSA));
199}
200
201static inline bool dsa_uses_trailer_tags(struct dsa_switch_tree *dst)
202{ 257{
203 return !!(dst->tag_protocol == htons(ETH_P_TRAILER)); 258 return dst->rcv != NULL;
204} 259}
205
206#endif 260#endif
diff --git a/include/net/dst.h b/include/net/dst.h
index 71c60f42be48..a8ae4e760778 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -480,6 +480,7 @@ void dst_init(void);
480/* Flags for xfrm_lookup flags argument. */ 480/* Flags for xfrm_lookup flags argument. */
481enum { 481enum {
482 XFRM_LOOKUP_ICMP = 1 << 0, 482 XFRM_LOOKUP_ICMP = 1 << 0,
483 XFRM_LOOKUP_QUEUE = 1 << 1,
483}; 484};
484 485
485struct flowi; 486struct flowi;
@@ -490,7 +491,16 @@ static inline struct dst_entry *xfrm_lookup(struct net *net,
490 int flags) 491 int flags)
491{ 492{
492 return dst_orig; 493 return dst_orig;
493} 494}
495
496static inline struct dst_entry *xfrm_lookup_route(struct net *net,
497 struct dst_entry *dst_orig,
498 const struct flowi *fl,
499 struct sock *sk,
500 int flags)
501{
502 return dst_orig;
503}
494 504
495static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) 505static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
496{ 506{
@@ -502,6 +512,10 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
502 const struct flowi *fl, struct sock *sk, 512 const struct flowi *fl, struct sock *sk,
503 int flags); 513 int flags);
504 514
515struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig,
516 const struct flowi *fl, struct sock *sk,
517 int flags);
518
505/* skb attached with this dst needs transformation if dst->xfrm is valid */ 519/* skb attached with this dst needs transformation if dst->xfrm is valid */
506static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) 520static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
507{ 521{
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
index 2f26dfb8450e..1f99a1de0e4f 100644
--- a/include/net/dst_ops.h
+++ b/include/net/dst_ops.h
@@ -63,7 +63,7 @@ static inline void dst_entries_add(struct dst_ops *dst, int val)
63 63
64static inline int dst_entries_init(struct dst_ops *dst) 64static inline int dst_entries_init(struct dst_ops *dst)
65{ 65{
66 return percpu_counter_init(&dst->pcpuc_entries, 0); 66 return percpu_counter_init(&dst->pcpuc_entries, 0, GFP_KERNEL);
67} 67}
68 68
69static inline void dst_entries_destroy(struct dst_ops *dst) 69static inline void dst_entries_destroy(struct dst_ops *dst)
diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h
index 6667a054763a..7ee2df083542 100644
--- a/include/net/flow_keys.h
+++ b/include/net/flow_keys.h
@@ -27,7 +27,19 @@ struct flow_keys {
27 u8 ip_proto; 27 u8 ip_proto;
28}; 28};
29 29
30bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow); 30bool __skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow,
31__be32 skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto); 31 void *data, __be16 proto, int nhoff, int hlen);
32static inline bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow)
33{
34 return __skb_flow_dissect(skb, flow, NULL, 0, 0, 0);
35}
36__be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto,
37 void *data, int hlen_proto);
38static inline __be32 skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto)
39{
40 return __skb_flow_get_ports(skb, thoff, ip_proto, NULL, 0);
41}
32u32 flow_hash_from_keys(struct flow_keys *keys); 42u32 flow_hash_from_keys(struct flow_keys *keys);
43unsigned int flow_get_hlen(const unsigned char *data, unsigned int max_len,
44 __be16 protocol);
33#endif 45#endif
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h
index ea4271dceff0..cbafa3768d48 100644
--- a/include/net/gen_stats.h
+++ b/include/net/gen_stats.h
@@ -6,6 +6,11 @@
6#include <linux/rtnetlink.h> 6#include <linux/rtnetlink.h>
7#include <linux/pkt_sched.h> 7#include <linux/pkt_sched.h>
8 8
9struct gnet_stats_basic_cpu {
10 struct gnet_stats_basic_packed bstats;
11 struct u64_stats_sync syncp;
12};
13
9struct gnet_dump { 14struct gnet_dump {
10 spinlock_t * lock; 15 spinlock_t * lock;
11 struct sk_buff * skb; 16 struct sk_buff * skb;
@@ -27,21 +32,29 @@ int gnet_stats_start_copy_compat(struct sk_buff *skb, int type,
27 spinlock_t *lock, struct gnet_dump *d); 32 spinlock_t *lock, struct gnet_dump *d);
28 33
29int gnet_stats_copy_basic(struct gnet_dump *d, 34int gnet_stats_copy_basic(struct gnet_dump *d,
35 struct gnet_stats_basic_cpu __percpu *cpu,
30 struct gnet_stats_basic_packed *b); 36 struct gnet_stats_basic_packed *b);
37void __gnet_stats_copy_basic(struct gnet_stats_basic_packed *bstats,
38 struct gnet_stats_basic_cpu __percpu *cpu,
39 struct gnet_stats_basic_packed *b);
31int gnet_stats_copy_rate_est(struct gnet_dump *d, 40int gnet_stats_copy_rate_est(struct gnet_dump *d,
32 const struct gnet_stats_basic_packed *b, 41 const struct gnet_stats_basic_packed *b,
33 struct gnet_stats_rate_est64 *r); 42 struct gnet_stats_rate_est64 *r);
34int gnet_stats_copy_queue(struct gnet_dump *d, struct gnet_stats_queue *q); 43int gnet_stats_copy_queue(struct gnet_dump *d,
44 struct gnet_stats_queue __percpu *cpu_q,
45 struct gnet_stats_queue *q, __u32 qlen);
35int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len); 46int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len);
36 47
37int gnet_stats_finish_copy(struct gnet_dump *d); 48int gnet_stats_finish_copy(struct gnet_dump *d);
38 49
39int gen_new_estimator(struct gnet_stats_basic_packed *bstats, 50int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
51 struct gnet_stats_basic_cpu __percpu *cpu_bstats,
40 struct gnet_stats_rate_est64 *rate_est, 52 struct gnet_stats_rate_est64 *rate_est,
41 spinlock_t *stats_lock, struct nlattr *opt); 53 spinlock_t *stats_lock, struct nlattr *opt);
42void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, 54void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
43 struct gnet_stats_rate_est64 *rate_est); 55 struct gnet_stats_rate_est64 *rate_est);
44int gen_replace_estimator(struct gnet_stats_basic_packed *bstats, 56int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
57 struct gnet_stats_basic_cpu __percpu *cpu_bstats,
45 struct gnet_stats_rate_est64 *rate_est, 58 struct gnet_stats_rate_est64 *rate_est,
46 spinlock_t *stats_lock, struct nlattr *opt); 59 spinlock_t *stats_lock, struct nlattr *opt);
47bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, 60bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 93695f0e22a5..af10c2cf8a1d 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -394,4 +394,12 @@ static inline int genl_set_err(struct genl_family *family, struct net *net,
394 return netlink_set_err(net->genl_sock, portid, group, code); 394 return netlink_set_err(net->genl_sock, portid, group, code);
395} 395}
396 396
397static inline int genl_has_listeners(struct genl_family *family,
398 struct sock *sk, unsigned int group)
399{
400 if (WARN_ON_ONCE(group >= family->n_mcgrps))
401 return -EINVAL;
402 group = family->mcgrp_offset + group;
403 return netlink_has_listeners(sk, group);
404}
397#endif /* __NET_GENERIC_NETLINK_H */ 405#endif /* __NET_GENERIC_NETLINK_H */
diff --git a/include/net/geneve.h b/include/net/geneve.h
new file mode 100644
index 000000000000..112132cf8e2e
--- /dev/null
+++ b/include/net/geneve.h
@@ -0,0 +1,97 @@
1#ifndef __NET_GENEVE_H
2#define __NET_GENEVE_H 1
3
4#ifdef CONFIG_INET
5#include <net/udp_tunnel.h>
6#endif
7
8
9/* Geneve Header:
10 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
11 * |Ver| Opt Len |O|C| Rsvd. | Protocol Type |
12 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
13 * | Virtual Network Identifier (VNI) | Reserved |
14 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
15 * | Variable Length Options |
16 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
17 *
18 * Option Header:
19 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
20 * | Option Class | Type |R|R|R| Length |
21 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
22 * | Variable Option Data |
23 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
24 */
25
26struct geneve_opt {
27 __be16 opt_class;
28 u8 type;
29#ifdef __LITTLE_ENDIAN_BITFIELD
30 u8 length:5;
31 u8 r3:1;
32 u8 r2:1;
33 u8 r1:1;
34#else
35 u8 r1:1;
36 u8 r2:1;
37 u8 r3:1;
38 u8 length:5;
39#endif
40 u8 opt_data[];
41};
42
43#define GENEVE_CRIT_OPT_TYPE (1 << 7)
44
45struct genevehdr {
46#ifdef __LITTLE_ENDIAN_BITFIELD
47 u8 opt_len:6;
48 u8 ver:2;
49 u8 rsvd1:6;
50 u8 critical:1;
51 u8 oam:1;
52#else
53 u8 ver:2;
54 u8 opt_len:6;
55 u8 oam:1;
56 u8 critical:1;
57 u8 rsvd1:6;
58#endif
59 __be16 proto_type;
60 u8 vni[3];
61 u8 rsvd2;
62 struct geneve_opt options[];
63};
64
65#ifdef CONFIG_INET
66struct geneve_sock;
67
68typedef void (geneve_rcv_t)(struct geneve_sock *gs, struct sk_buff *skb);
69
70struct geneve_sock {
71 struct hlist_node hlist;
72 geneve_rcv_t *rcv;
73 void *rcv_data;
74 struct work_struct del_work;
75 struct socket *sock;
76 struct rcu_head rcu;
77 atomic_t refcnt;
78 struct udp_offload udp_offloads;
79};
80
81#define GENEVE_VER 0
82#define GENEVE_BASE_HLEN (sizeof(struct udphdr) + sizeof(struct genevehdr))
83
84struct geneve_sock *geneve_sock_add(struct net *net, __be16 port,
85 geneve_rcv_t *rcv, void *data,
86 bool no_share, bool ipv6);
87
88void geneve_sock_release(struct geneve_sock *vs);
89
90int geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt,
91 struct sk_buff *skb, __be32 src, __be32 dst, __u8 tos,
92 __u8 ttl, __be16 df, __be16 src_port, __be16 dst_port,
93 __be16 tun_flags, u8 vni[3], u8 opt_len, u8 *opt,
94 bool xnet);
95#endif /*ifdef CONFIG_INET */
96
97#endif /*ifdef__NET_GENEVE_H */
diff --git a/include/net/gue.h b/include/net/gue.h
new file mode 100644
index 000000000000..b6c332788084
--- /dev/null
+++ b/include/net/gue.h
@@ -0,0 +1,23 @@
1#ifndef __NET_GUE_H
2#define __NET_GUE_H
3
4struct guehdr {
5 union {
6 struct {
7#if defined(__LITTLE_ENDIAN_BITFIELD)
8 __u8 hlen:4,
9 version:4;
10#elif defined (__BIG_ENDIAN_BITFIELD)
11 __u8 version:4,
12 hlen:4;
13#else
14#error "Please fix <asm/byteorder.h>"
15#endif
16 __u8 next_hdr;
17 __u16 flags;
18 };
19 __u32 word;
20 };
21};
22
23#endif
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index d07b1a64b4e7..98e5f9578f86 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -35,7 +35,6 @@ enum {
35 INET6_IFADDR_STATE_DAD, 35 INET6_IFADDR_STATE_DAD,
36 INET6_IFADDR_STATE_POSTDAD, 36 INET6_IFADDR_STATE_POSTDAD,
37 INET6_IFADDR_STATE_ERRDAD, 37 INET6_IFADDR_STATE_ERRDAD,
38 INET6_IFADDR_STATE_UP,
39 INET6_IFADDR_STATE_DEAD, 38 INET6_IFADDR_STATE_DEAD,
40}; 39};
41 40
@@ -147,7 +146,6 @@ struct ifacaddr6 {
147 struct ifacaddr6 *aca_next; 146 struct ifacaddr6 *aca_next;
148 int aca_users; 147 int aca_users;
149 atomic_t aca_refcnt; 148 atomic_t aca_refcnt;
150 spinlock_t aca_lock;
151 unsigned long aca_cstamp; 149 unsigned long aca_cstamp;
152 unsigned long aca_tstamp; 150 unsigned long aca_tstamp;
153}; 151};
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index ae0613544308..d1d272843b3b 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -80,7 +80,8 @@ static inline struct sock *__inet6_lookup(struct net *net,
80static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, 80static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
81 struct sk_buff *skb, 81 struct sk_buff *skb,
82 const __be16 sport, 82 const __be16 sport,
83 const __be16 dport) 83 const __be16 dport,
84 int iif)
84{ 85{
85 struct sock *sk = skb_steal_sock(skb); 86 struct sock *sk = skb_steal_sock(skb);
86 87
@@ -90,7 +91,7 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
90 return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo, 91 return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo,
91 &ipv6_hdr(skb)->saddr, sport, 92 &ipv6_hdr(skb)->saddr, sport,
92 &ipv6_hdr(skb)->daddr, ntohs(dport), 93 &ipv6_hdr(skb)->daddr, ntohs(dport),
93 inet6_iif(skb)); 94 iif);
94} 95}
95 96
96struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, 97struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 7a4313887568..848e85cb5c61 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -62,6 +62,7 @@ struct inet_connection_sock_af_ops {
62 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); 62 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
63 int (*bind_conflict)(const struct sock *sk, 63 int (*bind_conflict)(const struct sock *sk,
64 const struct inet_bind_bucket *tb, bool relax); 64 const struct inet_bind_bucket *tb, bool relax);
65 void (*mtu_reduced)(struct sock *sk);
65}; 66};
66 67
67/** inet_connection_sock - INET connection oriented sock 68/** inet_connection_sock - INET connection oriented sock
@@ -241,6 +242,15 @@ static inline void inet_csk_reset_xmit_timer(struct sock *sk, const int what,
241#endif 242#endif
242} 243}
243 244
245static inline unsigned long
246inet_csk_rto_backoff(const struct inet_connection_sock *icsk,
247 unsigned long max_when)
248{
249 u64 when = (u64)icsk->icsk_rto << icsk->icsk_backoff;
250
251 return (unsigned long)min_t(u64, when, max_when);
252}
253
244struct sock *inet_csk_accept(struct sock *sk, int flags, int *err); 254struct sock *inet_csk_accept(struct sock *sk, int flags, int *err);
245 255
246struct request_sock *inet_csk_search_req(const struct sock *sk, 256struct request_sock *inet_csk_search_req(const struct sock *sk,
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 65a8855e99fe..8d1765577acc 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -151,7 +151,7 @@ static inline void add_frag_mem_limit(struct inet_frag_queue *q, int i)
151 151
152static inline void init_frag_mem_limit(struct netns_frags *nf) 152static inline void init_frag_mem_limit(struct netns_frags *nf)
153{ 153{
154 percpu_counter_init(&nf->mem, 0); 154 percpu_counter_init(&nf->mem, 0, GFP_KERNEL);
155} 155}
156 156
157static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf) 157static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf)
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 01d590ee5e7e..80479abddf73 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -61,7 +61,6 @@ struct inet_peer {
61struct inet_peer_base { 61struct inet_peer_base {
62 struct inet_peer __rcu *root; 62 struct inet_peer __rcu *root;
63 seqlock_t lock; 63 seqlock_t lock;
64 u32 flush_seq;
65 int total; 64 int total;
66}; 65};
67 66
diff --git a/include/net/ip.h b/include/net/ip.h
index db4a771b9ef3..0bb620702929 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -180,8 +180,10 @@ static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg)
180 return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0; 180 return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0;
181} 181}
182 182
183void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr, 183void ip_send_unicast_reply(struct net *net, struct sk_buff *skb,
184 __be32 saddr, const struct ip_reply_arg *arg, 184 const struct ip_options *sopt,
185 __be32 daddr, __be32 saddr,
186 const struct ip_reply_arg *arg,
185 unsigned int len); 187 unsigned int len);
186 188
187#define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field) 189#define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field)
@@ -229,8 +231,6 @@ static inline int inet_is_local_reserved_port(struct net *net, int port)
229} 231}
230#endif 232#endif
231 233
232extern int sysctl_ip_nonlocal_bind;
233
234/* From inetpeer.c */ 234/* From inetpeer.c */
235extern int inet_peer_threshold; 235extern int inet_peer_threshold;
236extern int inet_peer_minttl; 236extern int inet_peer_minttl;
@@ -364,6 +364,14 @@ static inline void inet_set_txhash(struct sock *sk)
364 sk->sk_txhash = flow_hash_from_keys(&keys); 364 sk->sk_txhash = flow_hash_from_keys(&keys);
365} 365}
366 366
367static inline __wsum inet_gro_compute_pseudo(struct sk_buff *skb, int proto)
368{
369 const struct iphdr *iph = skb_gro_network_header(skb);
370
371 return csum_tcpudp_nofold(iph->saddr, iph->daddr,
372 skb_gro_len(skb), proto, 0);
373}
374
367/* 375/*
368 * Map a multicast IP onto multicast MAC for type ethernet. 376 * Map a multicast IP onto multicast MAC for type ethernet.
369 */ 377 */
@@ -505,7 +513,14 @@ int ip_forward(struct sk_buff *skb);
505 513
506void ip_options_build(struct sk_buff *skb, struct ip_options *opt, 514void ip_options_build(struct sk_buff *skb, struct ip_options *opt,
507 __be32 daddr, struct rtable *rt, int is_frag); 515 __be32 daddr, struct rtable *rt, int is_frag);
508int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); 516
517int __ip_options_echo(struct ip_options *dopt, struct sk_buff *skb,
518 const struct ip_options *sopt);
519static inline int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb)
520{
521 return __ip_options_echo(dopt, skb, &IPCB(skb)->opt);
522}
523
509void ip_options_fragment(struct sk_buff *skb); 524void ip_options_fragment(struct sk_buff *skb);
510int ip_options_compile(struct net *net, struct ip_options *opt, 525int ip_options_compile(struct net *net, struct ip_options *opt,
511 struct sk_buff *skb); 526 struct sk_buff *skb);
@@ -542,6 +557,10 @@ void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
542void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport, 557void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
543 u32 info); 558 u32 info);
544 559
560bool icmp_global_allow(void);
561extern int sysctl_icmp_msgs_per_sec;
562extern int sysctl_icmp_msgs_burst;
563
545#ifdef CONFIG_PROC_FS 564#ifdef CONFIG_PROC_FS
546int ip_misc_proc_init(void); 565int ip_misc_proc_init(void);
547#endif 566#endif
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index 55236cb71174..1a49b73f7f6e 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -48,6 +48,14 @@ static inline __wsum ip6_compute_pseudo(struct sk_buff *skb, int proto)
48 skb->len, proto, 0)); 48 skb->len, proto, 0));
49} 49}
50 50
51static inline __wsum ip6_gro_compute_pseudo(struct sk_buff *skb, int proto)
52{
53 const struct ipv6hdr *iph = skb_gro_network_header(skb);
54
55 return ~csum_unfold(csum_ipv6_magic(&iph->saddr, &iph->daddr,
56 skb_gro_len(skb), proto, 0));
57}
58
51static __inline__ __sum16 tcp_v6_check(int len, 59static __inline__ __sum16 tcp_v6_check(int len,
52 const struct in6_addr *saddr, 60 const struct in6_addr *saddr,
53 const struct in6_addr *daddr, 61 const struct in6_addr *daddr,
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 9bcb220bd4ad..8eea35d32a75 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -64,7 +64,7 @@ struct fib6_node {
64 64
65 __u16 fn_bit; /* bit key */ 65 __u16 fn_bit; /* bit key */
66 __u16 fn_flags; 66 __u16 fn_flags;
67 __u32 fn_sernum; 67 int fn_sernum;
68 struct rt6_info *rr_ptr; 68 struct rt6_info *rr_ptr;
69}; 69};
70 70
@@ -114,16 +114,13 @@ struct rt6_info {
114 u32 rt6i_flags; 114 u32 rt6i_flags;
115 struct rt6key rt6i_src; 115 struct rt6key rt6i_src;
116 struct rt6key rt6i_prefsrc; 116 struct rt6key rt6i_prefsrc;
117 u32 rt6i_metric;
118 117
119 struct inet6_dev *rt6i_idev; 118 struct inet6_dev *rt6i_idev;
120 unsigned long _rt6i_peer; 119 unsigned long _rt6i_peer;
121 120
122 u32 rt6i_genid; 121 u32 rt6i_metric;
123
124 /* more non-fragment space at head required */ 122 /* more non-fragment space at head required */
125 unsigned short rt6i_nfheader_len; 123 unsigned short rt6i_nfheader_len;
126
127 u8 rt6i_protocol; 124 u8 rt6i_protocol;
128}; 125};
129 126
@@ -205,15 +202,25 @@ static inline void ip6_rt_put(struct rt6_info *rt)
205 dst_release(&rt->dst); 202 dst_release(&rt->dst);
206} 203}
207 204
208struct fib6_walker_t { 205enum fib6_walk_state {
206#ifdef CONFIG_IPV6_SUBTREES
207 FWS_S,
208#endif
209 FWS_L,
210 FWS_R,
211 FWS_C,
212 FWS_U
213};
214
215struct fib6_walker {
209 struct list_head lh; 216 struct list_head lh;
210 struct fib6_node *root, *node; 217 struct fib6_node *root, *node;
211 struct rt6_info *leaf; 218 struct rt6_info *leaf;
212 unsigned char state; 219 enum fib6_walk_state state;
213 unsigned char prune; 220 bool prune;
214 unsigned int skip; 221 unsigned int skip;
215 unsigned int count; 222 unsigned int count;
216 int (*func)(struct fib6_walker_t *); 223 int (*func)(struct fib6_walker *);
217 void *args; 224 void *args;
218}; 225};
219 226
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 9922093f575e..dc9d2a27c315 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -65,7 +65,8 @@ struct fnhe_hash_bucket {
65 struct fib_nh_exception __rcu *chain; 65 struct fib_nh_exception __rcu *chain;
66}; 66};
67 67
68#define FNHE_HASH_SIZE 2048 68#define FNHE_HASH_SHIFT 11
69#define FNHE_HASH_SIZE (1 << FNHE_HASH_SHIFT)
69#define FNHE_RECLAIM_DEPTH 5 70#define FNHE_RECLAIM_DEPTH 5
70 71
71struct fib_nh { 72struct fib_nh {
@@ -87,7 +88,7 @@ struct fib_nh {
87 int nh_saddr_genid; 88 int nh_saddr_genid;
88 struct rtable __rcu * __percpu *nh_pcpu_rth_output; 89 struct rtable __rcu * __percpu *nh_pcpu_rth_output;
89 struct rtable __rcu *nh_rth_input; 90 struct rtable __rcu *nh_rth_input;
90 struct fnhe_hash_bucket *nh_exceptions; 91 struct fnhe_hash_bucket __rcu *nh_exceptions;
91}; 92};
92 93
93/* 94/*
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 8dd8cab88b87..5bc6edeb7143 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -10,6 +10,7 @@
10#include <net/gro_cells.h> 10#include <net/gro_cells.h>
11#include <net/inet_ecn.h> 11#include <net/inet_ecn.h>
12#include <net/ip.h> 12#include <net/ip.h>
13#include <net/netns/generic.h>
13#include <net/rtnetlink.h> 14#include <net/rtnetlink.h>
14 15
15#if IS_ENABLED(CONFIG_IPV6) 16#if IS_ENABLED(CONFIG_IPV6)
@@ -31,6 +32,13 @@ struct ip_tunnel_6rd_parm {
31}; 32};
32#endif 33#endif
33 34
35struct ip_tunnel_encap {
36 __u16 type;
37 __u16 flags;
38 __be16 sport;
39 __be16 dport;
40};
41
34struct ip_tunnel_prl_entry { 42struct ip_tunnel_prl_entry {
35 struct ip_tunnel_prl_entry __rcu *next; 43 struct ip_tunnel_prl_entry __rcu *next;
36 __be32 addr; 44 __be32 addr;
@@ -56,13 +64,18 @@ struct ip_tunnel {
56 /* These four fields used only by GRE */ 64 /* These four fields used only by GRE */
57 __u32 i_seqno; /* The last seen seqno */ 65 __u32 i_seqno; /* The last seen seqno */
58 __u32 o_seqno; /* The last output seqno */ 66 __u32 o_seqno; /* The last output seqno */
59 int hlen; /* Precalculated header length */ 67 int tun_hlen; /* Precalculated header length */
60 int mlink; 68 int mlink;
61 69
62 struct ip_tunnel_dst __percpu *dst_cache; 70 struct ip_tunnel_dst __percpu *dst_cache;
63 71
64 struct ip_tunnel_parm parms; 72 struct ip_tunnel_parm parms;
65 73
74 int encap_hlen; /* Encap header length (FOU,GUE) */
75 struct ip_tunnel_encap encap;
76
77 int hlen; /* tun_hlen + encap_hlen */
78
66 /* for SIT */ 79 /* for SIT */
67#ifdef CONFIG_IPV6_SIT_6RD 80#ifdef CONFIG_IPV6_SIT_6RD
68 struct ip_tunnel_6rd_parm ip6rd; 81 struct ip_tunnel_6rd_parm ip6rd;
@@ -73,15 +86,18 @@ struct ip_tunnel {
73 struct gro_cells gro_cells; 86 struct gro_cells gro_cells;
74}; 87};
75 88
76#define TUNNEL_CSUM __cpu_to_be16(0x01) 89#define TUNNEL_CSUM __cpu_to_be16(0x01)
77#define TUNNEL_ROUTING __cpu_to_be16(0x02) 90#define TUNNEL_ROUTING __cpu_to_be16(0x02)
78#define TUNNEL_KEY __cpu_to_be16(0x04) 91#define TUNNEL_KEY __cpu_to_be16(0x04)
79#define TUNNEL_SEQ __cpu_to_be16(0x08) 92#define TUNNEL_SEQ __cpu_to_be16(0x08)
80#define TUNNEL_STRICT __cpu_to_be16(0x10) 93#define TUNNEL_STRICT __cpu_to_be16(0x10)
81#define TUNNEL_REC __cpu_to_be16(0x20) 94#define TUNNEL_REC __cpu_to_be16(0x20)
82#define TUNNEL_VERSION __cpu_to_be16(0x40) 95#define TUNNEL_VERSION __cpu_to_be16(0x40)
83#define TUNNEL_NO_KEY __cpu_to_be16(0x80) 96#define TUNNEL_NO_KEY __cpu_to_be16(0x80)
84#define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100) 97#define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100)
98#define TUNNEL_OAM __cpu_to_be16(0x0200)
99#define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400)
100#define TUNNEL_OPTIONS_PRESENT __cpu_to_be16(0x0800)
85 101
86struct tnl_ptk_info { 102struct tnl_ptk_info {
87 __be16 flags; 103 __be16 flags;
@@ -114,6 +130,8 @@ void ip_tunnel_delete_net(struct ip_tunnel_net *itn, struct rtnl_link_ops *ops);
114void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, 130void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
115 const struct iphdr *tnl_params, const u8 protocol); 131 const struct iphdr *tnl_params, const u8 protocol);
116int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd); 132int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd);
133int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t,
134 u8 *protocol, struct flowi4 *fl4);
117int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu); 135int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);
118 136
119struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev, 137struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev,
@@ -131,6 +149,8 @@ int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
131 struct ip_tunnel_parm *p); 149 struct ip_tunnel_parm *p);
132void ip_tunnel_setup(struct net_device *dev, int net_id); 150void ip_tunnel_setup(struct net_device *dev, int net_id);
133void ip_tunnel_dst_reset_all(struct ip_tunnel *t); 151void ip_tunnel_dst_reset_all(struct ip_tunnel *t);
152int ip_tunnel_encap_setup(struct ip_tunnel *t,
153 struct ip_tunnel_encap *ipencap);
134 154
135/* Extract dsfield from inner protocol */ 155/* Extract dsfield from inner protocol */
136static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph, 156static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph,
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 624a8a54806d..615b20b58545 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1,6 +1,5 @@
1/* 1/* IP Virtual Server
2 * IP Virtual Server 2 * data structure and functionality definitions
3 * data structure and functionality definitions
4 */ 3 */
5 4
6#ifndef _NET_IP_VS_H 5#ifndef _NET_IP_VS_H
@@ -12,7 +11,7 @@
12 11
13#include <linux/list.h> /* for struct list_head */ 12#include <linux/list.h> /* for struct list_head */
14#include <linux/spinlock.h> /* for struct rwlock_t */ 13#include <linux/spinlock.h> /* for struct rwlock_t */
15#include <linux/atomic.h> /* for struct atomic_t */ 14#include <linux/atomic.h> /* for struct atomic_t */
16#include <linux/compiler.h> 15#include <linux/compiler.h>
17#include <linux/timer.h> 16#include <linux/timer.h>
18#include <linux/bug.h> 17#include <linux/bug.h>
@@ -30,15 +29,13 @@
30#endif 29#endif
31#include <net/net_namespace.h> /* Netw namespace */ 30#include <net/net_namespace.h> /* Netw namespace */
32 31
33/* 32/* Generic access of ipvs struct */
34 * Generic access of ipvs struct
35 */
36static inline struct netns_ipvs *net_ipvs(struct net* net) 33static inline struct netns_ipvs *net_ipvs(struct net* net)
37{ 34{
38 return net->ipvs; 35 return net->ipvs;
39} 36}
40/* 37
41 * Get net ptr from skb in traffic cases 38/* Get net ptr from skb in traffic cases
42 * use skb_sknet when call is from userland (ioctl or netlink) 39 * use skb_sknet when call is from userland (ioctl or netlink)
43 */ 40 */
44static inline struct net *skb_net(const struct sk_buff *skb) 41static inline struct net *skb_net(const struct sk_buff *skb)
@@ -90,8 +87,8 @@ static inline struct net *skb_sknet(const struct sk_buff *skb)
90 return &init_net; 87 return &init_net;
91#endif 88#endif
92} 89}
93/* 90
94 * This one needed for single_open_net since net is stored directly in 91/* This one needed for single_open_net since net is stored directly in
95 * private not as a struct i.e. seq_file_net can't be used. 92 * private not as a struct i.e. seq_file_net can't be used.
96 */ 93 */
97static inline struct net *seq_file_single_net(struct seq_file *seq) 94static inline struct net *seq_file_single_net(struct seq_file *seq)
@@ -108,7 +105,7 @@ extern int ip_vs_conn_tab_size;
108 105
109struct ip_vs_iphdr { 106struct ip_vs_iphdr {
110 __u32 len; /* IPv4 simply where L4 starts 107 __u32 len; /* IPv4 simply where L4 starts
111 IPv6 where L4 Transport Header starts */ 108 * IPv6 where L4 Transport Header starts */
112 __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/ 109 __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/
113 __s16 protocol; 110 __s16 protocol;
114 __s32 flags; 111 __s32 flags;
@@ -304,16 +301,11 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
304#define LeaveFunction(level) do {} while (0) 301#define LeaveFunction(level) do {} while (0)
305#endif 302#endif
306 303
307 304/* The port number of FTP service (in network order). */
308/*
309 * The port number of FTP service (in network order).
310 */
311#define FTPPORT cpu_to_be16(21) 305#define FTPPORT cpu_to_be16(21)
312#define FTPDATA cpu_to_be16(20) 306#define FTPDATA cpu_to_be16(20)
313 307
314/* 308/* TCP State Values */
315 * TCP State Values
316 */
317enum { 309enum {
318 IP_VS_TCP_S_NONE = 0, 310 IP_VS_TCP_S_NONE = 0,
319 IP_VS_TCP_S_ESTABLISHED, 311 IP_VS_TCP_S_ESTABLISHED,
@@ -329,25 +321,19 @@ enum {
329 IP_VS_TCP_S_LAST 321 IP_VS_TCP_S_LAST
330}; 322};
331 323
332/* 324/* UDP State Values */
333 * UDP State Values
334 */
335enum { 325enum {
336 IP_VS_UDP_S_NORMAL, 326 IP_VS_UDP_S_NORMAL,
337 IP_VS_UDP_S_LAST, 327 IP_VS_UDP_S_LAST,
338}; 328};
339 329
340/* 330/* ICMP State Values */
341 * ICMP State Values
342 */
343enum { 331enum {
344 IP_VS_ICMP_S_NORMAL, 332 IP_VS_ICMP_S_NORMAL,
345 IP_VS_ICMP_S_LAST, 333 IP_VS_ICMP_S_LAST,
346}; 334};
347 335
348/* 336/* SCTP State Values */
349 * SCTP State Values
350 */
351enum ip_vs_sctp_states { 337enum ip_vs_sctp_states {
352 IP_VS_SCTP_S_NONE, 338 IP_VS_SCTP_S_NONE,
353 IP_VS_SCTP_S_INIT1, 339 IP_VS_SCTP_S_INIT1,
@@ -366,21 +352,18 @@ enum ip_vs_sctp_states {
366 IP_VS_SCTP_S_LAST 352 IP_VS_SCTP_S_LAST
367}; 353};
368 354
369/* 355/* Delta sequence info structure
370 * Delta sequence info structure 356 * Each ip_vs_conn has 2 (output AND input seq. changes).
371 * Each ip_vs_conn has 2 (output AND input seq. changes). 357 * Only used in the VS/NAT.
372 * Only used in the VS/NAT.
373 */ 358 */
374struct ip_vs_seq { 359struct ip_vs_seq {
375 __u32 init_seq; /* Add delta from this seq */ 360 __u32 init_seq; /* Add delta from this seq */
376 __u32 delta; /* Delta in sequence numbers */ 361 __u32 delta; /* Delta in sequence numbers */
377 __u32 previous_delta; /* Delta in sequence numbers 362 __u32 previous_delta; /* Delta in sequence numbers
378 before last resized pkt */ 363 * before last resized pkt */
379}; 364};
380 365
381/* 366/* counters per cpu */
382 * counters per cpu
383 */
384struct ip_vs_counters { 367struct ip_vs_counters {
385 __u32 conns; /* connections scheduled */ 368 __u32 conns; /* connections scheduled */
386 __u32 inpkts; /* incoming packets */ 369 __u32 inpkts; /* incoming packets */
@@ -388,17 +371,13 @@ struct ip_vs_counters {
388 __u64 inbytes; /* incoming bytes */ 371 __u64 inbytes; /* incoming bytes */
389 __u64 outbytes; /* outgoing bytes */ 372 __u64 outbytes; /* outgoing bytes */
390}; 373};
391/* 374/* Stats per cpu */
392 * Stats per cpu
393 */
394struct ip_vs_cpu_stats { 375struct ip_vs_cpu_stats {
395 struct ip_vs_counters ustats; 376 struct ip_vs_counters ustats;
396 struct u64_stats_sync syncp; 377 struct u64_stats_sync syncp;
397}; 378};
398 379
399/* 380/* IPVS statistics objects */
400 * IPVS statistics objects
401 */
402struct ip_vs_estimator { 381struct ip_vs_estimator {
403 struct list_head list; 382 struct list_head list;
404 383
@@ -491,9 +470,7 @@ struct ip_vs_protocol {
491 void (*timeout_change)(struct ip_vs_proto_data *pd, int flags); 470 void (*timeout_change)(struct ip_vs_proto_data *pd, int flags);
492}; 471};
493 472
494/* 473/* protocol data per netns */
495 * protocol data per netns
496 */
497struct ip_vs_proto_data { 474struct ip_vs_proto_data {
498 struct ip_vs_proto_data *next; 475 struct ip_vs_proto_data *next;
499 struct ip_vs_protocol *pp; 476 struct ip_vs_protocol *pp;
@@ -520,9 +497,7 @@ struct ip_vs_conn_param {
520 __u8 pe_data_len; 497 __u8 pe_data_len;
521}; 498};
522 499
523/* 500/* IP_VS structure allocated for each dynamically scheduled connection */
524 * IP_VS structure allocated for each dynamically scheduled connection
525 */
526struct ip_vs_conn { 501struct ip_vs_conn {
527 struct hlist_node c_list; /* hashed list heads */ 502 struct hlist_node c_list; /* hashed list heads */
528 /* Protocol, addresses and port numbers */ 503 /* Protocol, addresses and port numbers */
@@ -535,6 +510,7 @@ struct ip_vs_conn {
535 union nf_inet_addr daddr; /* destination address */ 510 union nf_inet_addr daddr; /* destination address */
536 volatile __u32 flags; /* status flags */ 511 volatile __u32 flags; /* status flags */
537 __u16 protocol; /* Which protocol (TCP/UDP) */ 512 __u16 protocol; /* Which protocol (TCP/UDP) */
513 __u16 daf; /* Address family of the dest */
538#ifdef CONFIG_NET_NS 514#ifdef CONFIG_NET_NS
539 struct net *net; /* Name space */ 515 struct net *net; /* Name space */
540#endif 516#endif
@@ -560,17 +536,18 @@ struct ip_vs_conn {
560 struct ip_vs_dest *dest; /* real server */ 536 struct ip_vs_dest *dest; /* real server */
561 atomic_t in_pkts; /* incoming packet counter */ 537 atomic_t in_pkts; /* incoming packet counter */
562 538
563 /* packet transmitter for different forwarding methods. If it 539 /* Packet transmitter for different forwarding methods. If it
564 mangles the packet, it must return NF_DROP or better NF_STOLEN, 540 * mangles the packet, it must return NF_DROP or better NF_STOLEN,
565 otherwise this must be changed to a sk_buff **. 541 * otherwise this must be changed to a sk_buff **.
566 NF_ACCEPT can be returned when destination is local. 542 * NF_ACCEPT can be returned when destination is local.
567 */ 543 */
568 int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp, 544 int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp,
569 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 545 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
570 546
571 /* Note: we can group the following members into a structure, 547 /* Note: we can group the following members into a structure,
572 in order to save more space, and the following members are 548 * in order to save more space, and the following members are
573 only used in VS/NAT anyway */ 549 * only used in VS/NAT anyway
550 */
574 struct ip_vs_app *app; /* bound ip_vs_app object */ 551 struct ip_vs_app *app; /* bound ip_vs_app object */
575 void *app_data; /* Application private data */ 552 void *app_data; /* Application private data */
576 struct ip_vs_seq in_seq; /* incoming seq. struct */ 553 struct ip_vs_seq in_seq; /* incoming seq. struct */
@@ -583,9 +560,7 @@ struct ip_vs_conn {
583 struct rcu_head rcu_head; 560 struct rcu_head rcu_head;
584}; 561};
585 562
586/* 563/* To save some memory in conn table when name space is disabled. */
587 * To save some memory in conn table when name space is disabled.
588 */
589static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp) 564static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp)
590{ 565{
591#ifdef CONFIG_NET_NS 566#ifdef CONFIG_NET_NS
@@ -594,6 +569,7 @@ static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp)
594 return &init_net; 569 return &init_net;
595#endif 570#endif
596} 571}
572
597static inline void ip_vs_conn_net_set(struct ip_vs_conn *cp, struct net *net) 573static inline void ip_vs_conn_net_set(struct ip_vs_conn *cp, struct net *net)
598{ 574{
599#ifdef CONFIG_NET_NS 575#ifdef CONFIG_NET_NS
@@ -611,13 +587,12 @@ static inline int ip_vs_conn_net_eq(const struct ip_vs_conn *cp,
611#endif 587#endif
612} 588}
613 589
614/* 590/* Extended internal versions of struct ip_vs_service_user and ip_vs_dest_user
615 * Extended internal versions of struct ip_vs_service_user and 591 * for IPv6 support.
616 * ip_vs_dest_user for IPv6 support.
617 * 592 *
618 * We need these to conveniently pass around service and destination 593 * We need these to conveniently pass around service and destination
619 * options, but unfortunately, we also need to keep the old definitions to 594 * options, but unfortunately, we also need to keep the old definitions to
620 * maintain userspace backwards compatibility for the setsockopt interface. 595 * maintain userspace backwards compatibility for the setsockopt interface.
621 */ 596 */
622struct ip_vs_service_user_kern { 597struct ip_vs_service_user_kern {
623 /* virtual service addresses */ 598 /* virtual service addresses */
@@ -648,12 +623,15 @@ struct ip_vs_dest_user_kern {
648 /* thresholds for active connections */ 623 /* thresholds for active connections */
649 u32 u_threshold; /* upper threshold */ 624 u32 u_threshold; /* upper threshold */
650 u32 l_threshold; /* lower threshold */ 625 u32 l_threshold; /* lower threshold */
626
627 /* Address family of addr */
628 u16 af;
651}; 629};
652 630
653 631
654/* 632/*
655 * The information about the virtual service offered to the net 633 * The information about the virtual service offered to the net and the
656 * and the forwarding entries 634 * forwarding entries.
657 */ 635 */
658struct ip_vs_service { 636struct ip_vs_service {
659 struct hlist_node s_list; /* for normal service table */ 637 struct hlist_node s_list; /* for normal service table */
@@ -693,9 +671,8 @@ struct ip_vs_dest_dst {
693 struct rcu_head rcu_head; 671 struct rcu_head rcu_head;
694}; 672};
695 673
696/* 674/* The real server destination forwarding entry with ip address, port number,
697 * The real server destination forwarding entry 675 * and so on.
698 * with ip address, port number, and so on.
699 */ 676 */
700struct ip_vs_dest { 677struct ip_vs_dest {
701 struct list_head n_list; /* for the dests in the service */ 678 struct list_head n_list; /* for the dests in the service */
@@ -734,10 +711,7 @@ struct ip_vs_dest {
734 unsigned int in_rs_table:1; /* we are in rs_table */ 711 unsigned int in_rs_table:1; /* we are in rs_table */
735}; 712};
736 713
737 714/* The scheduler object */
738/*
739 * The scheduler object
740 */
741struct ip_vs_scheduler { 715struct ip_vs_scheduler {
742 struct list_head n_list; /* d-linked list head */ 716 struct list_head n_list; /* d-linked list head */
743 char *name; /* scheduler name */ 717 char *name; /* scheduler name */
@@ -777,9 +751,7 @@ struct ip_vs_pe {
777 int (*show_pe_data)(const struct ip_vs_conn *cp, char *buf); 751 int (*show_pe_data)(const struct ip_vs_conn *cp, char *buf);
778}; 752};
779 753
780/* 754/* The application module object (a.k.a. app incarnation) */
781 * The application module object (a.k.a. app incarnation)
782 */
783struct ip_vs_app { 755struct ip_vs_app {
784 struct list_head a_list; /* member in app list */ 756 struct list_head a_list; /* member in app list */
785 int type; /* IP_VS_APP_TYPE_xxx */ 757 int type; /* IP_VS_APP_TYPE_xxx */
@@ -795,16 +767,14 @@ struct ip_vs_app {
795 atomic_t usecnt; /* usage counter */ 767 atomic_t usecnt; /* usage counter */
796 struct rcu_head rcu_head; 768 struct rcu_head rcu_head;
797 769
798 /* 770 /* output hook: Process packet in inout direction, diff set for TCP.
799 * output hook: Process packet in inout direction, diff set for TCP.
800 * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok, 771 * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok,
801 * 2=Mangled but checksum was not updated 772 * 2=Mangled but checksum was not updated
802 */ 773 */
803 int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *, 774 int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *,
804 struct sk_buff *, int *diff); 775 struct sk_buff *, int *diff);
805 776
806 /* 777 /* input hook: Process packet in outin direction, diff set for TCP.
807 * input hook: Process packet in outin direction, diff set for TCP.
808 * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok, 778 * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok,
809 * 2=Mangled but checksum was not updated 779 * 2=Mangled but checksum was not updated
810 */ 780 */
@@ -863,9 +833,7 @@ struct ipvs_master_sync_state {
863struct netns_ipvs { 833struct netns_ipvs {
864 int gen; /* Generation */ 834 int gen; /* Generation */
865 int enable; /* enable like nf_hooks do */ 835 int enable; /* enable like nf_hooks do */
866 /* 836 /* Hash table: for real service lookups */
867 * Hash table: for real service lookups
868 */
869 #define IP_VS_RTAB_BITS 4 837 #define IP_VS_RTAB_BITS 4
870 #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS) 838 #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS)
871 #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1) 839 #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1)
@@ -899,7 +867,7 @@ struct netns_ipvs {
899 struct list_head sctp_apps[SCTP_APP_TAB_SIZE]; 867 struct list_head sctp_apps[SCTP_APP_TAB_SIZE];
900#endif 868#endif
901 /* ip_vs_conn */ 869 /* ip_vs_conn */
902 atomic_t conn_count; /* connection counter */ 870 atomic_t conn_count; /* connection counter */
903 871
904 /* ip_vs_ctl */ 872 /* ip_vs_ctl */
905 struct ip_vs_stats tot_stats; /* Statistics & est. */ 873 struct ip_vs_stats tot_stats; /* Statistics & est. */
@@ -986,6 +954,10 @@ struct netns_ipvs {
986 char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN]; 954 char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
987 /* net name space ptr */ 955 /* net name space ptr */
988 struct net *net; /* Needed by timer routines */ 956 struct net *net; /* Needed by timer routines */
957 /* Number of heterogeneous destinations, needed becaus heterogeneous
958 * are not supported when synchronization is enabled.
959 */
960 unsigned int mixed_address_family_dests;
989}; 961};
990 962
991#define DEFAULT_SYNC_THRESHOLD 3 963#define DEFAULT_SYNC_THRESHOLD 3
@@ -1139,9 +1111,8 @@ static inline int sysctl_backup_only(struct netns_ipvs *ipvs)
1139 1111
1140#endif 1112#endif
1141 1113
1142/* 1114/* IPVS core functions
1143 * IPVS core functions 1115 * (from ip_vs_core.c)
1144 * (from ip_vs_core.c)
1145 */ 1116 */
1146const char *ip_vs_proto_name(unsigned int proto); 1117const char *ip_vs_proto_name(unsigned int proto);
1147void ip_vs_init_hash_table(struct list_head *table, int rows); 1118void ip_vs_init_hash_table(struct list_head *table, int rows);
@@ -1149,11 +1120,9 @@ void ip_vs_init_hash_table(struct list_head *table, int rows);
1149 1120
1150#define IP_VS_APP_TYPE_FTP 1 1121#define IP_VS_APP_TYPE_FTP 1
1151 1122
1152/* 1123/* ip_vs_conn handling functions
1153 * ip_vs_conn handling functions 1124 * (from ip_vs_conn.c)
1154 * (from ip_vs_conn.c)
1155 */ 1125 */
1156
1157enum { 1126enum {
1158 IP_VS_DIR_INPUT = 0, 1127 IP_VS_DIR_INPUT = 0,
1159 IP_VS_DIR_OUTPUT, 1128 IP_VS_DIR_OUTPUT,
@@ -1210,7 +1179,7 @@ static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
1210void ip_vs_conn_put(struct ip_vs_conn *cp); 1179void ip_vs_conn_put(struct ip_vs_conn *cp);
1211void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport); 1180void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport);
1212 1181
1213struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, 1182struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, int dest_af,
1214 const union nf_inet_addr *daddr, 1183 const union nf_inet_addr *daddr,
1215 __be16 dport, unsigned int flags, 1184 __be16 dport, unsigned int flags,
1216 struct ip_vs_dest *dest, __u32 fwmark); 1185 struct ip_vs_dest *dest, __u32 fwmark);
@@ -1284,9 +1253,7 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
1284 atomic_inc(&ctl_cp->n_control); 1253 atomic_inc(&ctl_cp->n_control);
1285} 1254}
1286 1255
1287/* 1256/* IPVS netns init & cleanup functions */
1288 * IPVS netns init & cleanup functions
1289 */
1290int ip_vs_estimator_net_init(struct net *net); 1257int ip_vs_estimator_net_init(struct net *net);
1291int ip_vs_control_net_init(struct net *net); 1258int ip_vs_control_net_init(struct net *net);
1292int ip_vs_protocol_net_init(struct net *net); 1259int ip_vs_protocol_net_init(struct net *net);
@@ -1301,9 +1268,8 @@ void ip_vs_estimator_net_cleanup(struct net *net);
1301void ip_vs_sync_net_cleanup(struct net *net); 1268void ip_vs_sync_net_cleanup(struct net *net);
1302void ip_vs_service_net_cleanup(struct net *net); 1269void ip_vs_service_net_cleanup(struct net *net);
1303 1270
1304/* 1271/* IPVS application functions
1305 * IPVS application functions 1272 * (from ip_vs_app.c)
1306 * (from ip_vs_app.c)
1307 */ 1273 */
1308#define IP_VS_APP_MAX_PORTS 8 1274#define IP_VS_APP_MAX_PORTS 8
1309struct ip_vs_app *register_ip_vs_app(struct net *net, struct ip_vs_app *app); 1275struct ip_vs_app *register_ip_vs_app(struct net *net, struct ip_vs_app *app);
@@ -1323,9 +1289,7 @@ int unregister_ip_vs_pe(struct ip_vs_pe *pe);
1323struct ip_vs_pe *ip_vs_pe_getbyname(const char *name); 1289struct ip_vs_pe *ip_vs_pe_getbyname(const char *name);
1324struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name); 1290struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name);
1325 1291
1326/* 1292/* Use a #define to avoid all of module.h just for these trivial ops */
1327 * Use a #define to avoid all of module.h just for these trivial ops
1328 */
1329#define ip_vs_pe_get(pe) \ 1293#define ip_vs_pe_get(pe) \
1330 if (pe && pe->module) \ 1294 if (pe && pe->module) \
1331 __module_get(pe->module); 1295 __module_get(pe->module);
@@ -1334,9 +1298,7 @@ struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name);
1334 if (pe && pe->module) \ 1298 if (pe && pe->module) \
1335 module_put(pe->module); 1299 module_put(pe->module);
1336 1300
1337/* 1301/* IPVS protocol functions (from ip_vs_proto.c) */
1338 * IPVS protocol functions (from ip_vs_proto.c)
1339 */
1340int ip_vs_protocol_init(void); 1302int ip_vs_protocol_init(void);
1341void ip_vs_protocol_cleanup(void); 1303void ip_vs_protocol_cleanup(void);
1342void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags); 1304void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags);
@@ -1354,9 +1316,8 @@ extern struct ip_vs_protocol ip_vs_protocol_esp;
1354extern struct ip_vs_protocol ip_vs_protocol_ah; 1316extern struct ip_vs_protocol ip_vs_protocol_ah;
1355extern struct ip_vs_protocol ip_vs_protocol_sctp; 1317extern struct ip_vs_protocol ip_vs_protocol_sctp;
1356 1318
1357/* 1319/* Registering/unregistering scheduler functions
1358 * Registering/unregistering scheduler functions 1320 * (from ip_vs_sched.c)
1359 * (from ip_vs_sched.c)
1360 */ 1321 */
1361int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1322int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1362int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1323int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
@@ -1375,10 +1336,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
1375 1336
1376void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); 1337void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
1377 1338
1378 1339/* IPVS control data and functions (from ip_vs_ctl.c) */
1379/*
1380 * IPVS control data and functions (from ip_vs_ctl.c)
1381 */
1382extern struct ip_vs_stats ip_vs_stats; 1340extern struct ip_vs_stats ip_vs_stats;
1383extern int sysctl_ip_vs_sync_ver; 1341extern int sysctl_ip_vs_sync_ver;
1384 1342
@@ -1396,8 +1354,9 @@ void ip_vs_unregister_nl_ioctl(void);
1396int ip_vs_control_init(void); 1354int ip_vs_control_init(void);
1397void ip_vs_control_cleanup(void); 1355void ip_vs_control_cleanup(void);
1398struct ip_vs_dest * 1356struct ip_vs_dest *
1399ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, 1357ip_vs_find_dest(struct net *net, int svc_af, int dest_af,
1400 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, 1358 const union nf_inet_addr *daddr, __be16 dport,
1359 const union nf_inet_addr *vaddr, __be16 vport,
1401 __u16 protocol, __u32 fwmark, __u32 flags); 1360 __u16 protocol, __u32 fwmark, __u32 flags);
1402void ip_vs_try_bind_dest(struct ip_vs_conn *cp); 1361void ip_vs_try_bind_dest(struct ip_vs_conn *cp);
1403 1362
@@ -1418,26 +1377,21 @@ static inline void ip_vs_dest_put_and_free(struct ip_vs_dest *dest)
1418 kfree(dest); 1377 kfree(dest);
1419} 1378}
1420 1379
1421/* 1380/* IPVS sync daemon data and function prototypes
1422 * IPVS sync daemon data and function prototypes 1381 * (from ip_vs_sync.c)
1423 * (from ip_vs_sync.c)
1424 */ 1382 */
1425int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid); 1383int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid);
1426int stop_sync_thread(struct net *net, int state); 1384int stop_sync_thread(struct net *net, int state);
1427void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts); 1385void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
1428 1386
1429/* 1387/* IPVS rate estimator prototypes (from ip_vs_est.c) */
1430 * IPVS rate estimator prototypes (from ip_vs_est.c)
1431 */
1432void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats); 1388void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats);
1433void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats); 1389void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats);
1434void ip_vs_zero_estimator(struct ip_vs_stats *stats); 1390void ip_vs_zero_estimator(struct ip_vs_stats *stats);
1435void ip_vs_read_estimator(struct ip_vs_stats_user *dst, 1391void ip_vs_read_estimator(struct ip_vs_stats_user *dst,
1436 struct ip_vs_stats *stats); 1392 struct ip_vs_stats *stats);
1437 1393
1438/* 1394/* Various IPVS packet transmitters (from ip_vs_xmit.c) */
1439 * Various IPVS packet transmitters (from ip_vs_xmit.c)
1440 */
1441int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1395int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1442 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1396 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1443int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1397int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
@@ -1468,12 +1422,10 @@ int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1468#endif 1422#endif
1469 1423
1470#ifdef CONFIG_SYSCTL 1424#ifdef CONFIG_SYSCTL
1471/* 1425/* This is a simple mechanism to ignore packets when
1472 * This is a simple mechanism to ignore packets when 1426 * we are loaded. Just set ip_vs_drop_rate to 'n' and
1473 * we are loaded. Just set ip_vs_drop_rate to 'n' and 1427 * we start to drop 1/rate of the packets
1474 * we start to drop 1/rate of the packets
1475 */ 1428 */
1476
1477static inline int ip_vs_todrop(struct netns_ipvs *ipvs) 1429static inline int ip_vs_todrop(struct netns_ipvs *ipvs)
1478{ 1430{
1479 if (!ipvs->drop_rate) 1431 if (!ipvs->drop_rate)
@@ -1487,9 +1439,7 @@ static inline int ip_vs_todrop(struct netns_ipvs *ipvs)
1487static inline int ip_vs_todrop(struct netns_ipvs *ipvs) { return 0; } 1439static inline int ip_vs_todrop(struct netns_ipvs *ipvs) { return 0; }
1488#endif 1440#endif
1489 1441
1490/* 1442/* ip_vs_fwd_tag returns the forwarding tag of the connection */
1491 * ip_vs_fwd_tag returns the forwarding tag of the connection
1492 */
1493#define IP_VS_FWD_METHOD(cp) (cp->flags & IP_VS_CONN_F_FWD_MASK) 1443#define IP_VS_FWD_METHOD(cp) (cp->flags & IP_VS_CONN_F_FWD_MASK)
1494 1444
1495static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp) 1445static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp)
@@ -1548,9 +1498,7 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
1548 return csum_partial(diff, sizeof(diff), oldsum); 1498 return csum_partial(diff, sizeof(diff), oldsum);
1549} 1499}
1550 1500
1551/* 1501/* Forget current conntrack (unconfirmed) and attach notrack entry */
1552 * Forget current conntrack (unconfirmed) and attach notrack entry
1553 */
1554static inline void ip_vs_notrack(struct sk_buff *skb) 1502static inline void ip_vs_notrack(struct sk_buff *skb)
1555{ 1503{
1556#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 1504#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
@@ -1567,9 +1515,8 @@ static inline void ip_vs_notrack(struct sk_buff *skb)
1567} 1515}
1568 1516
1569#ifdef CONFIG_IP_VS_NFCT 1517#ifdef CONFIG_IP_VS_NFCT
1570/* 1518/* Netfilter connection tracking
1571 * Netfilter connection tracking 1519 * (from ip_vs_nfct.c)
1572 * (from ip_vs_nfct.c)
1573 */ 1520 */
1574static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs) 1521static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
1575{ 1522{
@@ -1608,14 +1555,12 @@ static inline int ip_vs_confirm_conntrack(struct sk_buff *skb)
1608static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) 1555static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp)
1609{ 1556{
1610} 1557}
1611/* CONFIG_IP_VS_NFCT */ 1558#endif /* CONFIG_IP_VS_NFCT */
1612#endif
1613 1559
1614static inline int 1560static inline int
1615ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) 1561ip_vs_dest_conn_overhead(struct ip_vs_dest *dest)
1616{ 1562{
1617 /* 1563 /* We think the overhead of processing active connections is 256
1618 * We think the overhead of processing active connections is 256
1619 * times higher than that of inactive connections in average. (This 1564 * times higher than that of inactive connections in average. (This
1620 * 256 times might not be accurate, we will change it later) We 1565 * 256 times might not be accurate, we will change it later) We
1621 * use the following formula to estimate the overhead now: 1566 * use the following formula to estimate the overhead now:
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index a2db816e8461..4292929392b0 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -121,6 +121,7 @@ struct frag_hdr {
121 121
122/* sysctls */ 122/* sysctls */
123extern int sysctl_mld_max_msf; 123extern int sysctl_mld_max_msf;
124extern int sysctl_mld_qrv;
124 125
125#define _DEVINC(net, statname, modifier, idev, field) \ 126#define _DEVINC(net, statname, modifier, idev, field) \
126({ \ 127({ \
@@ -287,7 +288,8 @@ struct ipv6_txoptions *ipv6_renew_options(struct sock *sk,
287struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, 288struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
288 struct ipv6_txoptions *opt); 289 struct ipv6_txoptions *opt);
289 290
290bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb); 291bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb,
292 const struct inet6_skb_parm *opt);
291 293
292static inline bool ipv6_accept_ra(struct inet6_dev *idev) 294static inline bool ipv6_accept_ra(struct inet6_dev *idev)
293{ 295{
@@ -669,6 +671,8 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add
669 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); 671 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
670} 672}
671 673
674void ipv6_proxy_select_ident(struct sk_buff *skb);
675
672int ip6_dst_hoplimit(struct dst_entry *dst); 676int ip6_dst_hoplimit(struct dst_entry *dst);
673 677
674static inline int ip6_sk_dst_hoplimit(struct ipv6_pinfo *np, struct flowi6 *fl6, 678static inline int ip6_sk_dst_hoplimit(struct ipv6_pinfo *np, struct flowi6 *fl6,
diff --git a/include/net/lib80211.h b/include/net/lib80211.h
index be95b9262801..aab0f427edb5 100644
--- a/include/net/lib80211.h
+++ b/include/net/lib80211.h
@@ -32,11 +32,6 @@
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/seq_file.h> 33#include <linux/seq_file.h>
34 34
35/* print_ssid() is intended to be used in debug (and possibly error)
36 * messages. It should never be used for passing ssid to user space. */
37const char *print_ssid(char *buf, const char *ssid, u8 ssid_len);
38#define DECLARE_SSID_BUF(var) char var[IEEE80211_MAX_SSID_LEN * 4 + 1] __maybe_unused
39
40#define NUM_WEP_KEYS 4 35#define NUM_WEP_KEYS 4
41 36
42enum { 37enum {
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index dae2e24616e1..0ad1f47d2dc7 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4,6 +4,7 @@
4 * Copyright 2002-2005, Devicescape Software, Inc. 4 * Copyright 2002-2005, Devicescape Software, Inc.
5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
6 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
7 * Copyright 2013-2014 Intel Mobile Communications GmbH
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * 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 * it under the terms of the GNU General Public License version 2 as
@@ -1226,7 +1227,8 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
1226 * 1227 *
1227 * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the 1228 * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the
1228 * driver to indicate that it requires IV generation for this 1229 * driver to indicate that it requires IV generation for this
1229 * particular key. 1230 * particular key. Setting this flag does not necessarily mean that SKBs
1231 * will have sufficient tailroom for ICV or MIC.
1230 * @IEEE80211_KEY_FLAG_GENERATE_MMIC: This flag should be set by 1232 * @IEEE80211_KEY_FLAG_GENERATE_MMIC: This flag should be set by
1231 * the driver for a TKIP key if it requires Michael MIC 1233 * the driver for a TKIP key if it requires Michael MIC
1232 * generation in software. 1234 * generation in software.
@@ -1238,7 +1240,9 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
1238 * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver 1240 * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
1239 * if space should be prepared for the IV, but the IV 1241 * if space should be prepared for the IV, but the IV
1240 * itself should not be generated. Do not set together with 1242 * itself should not be generated. Do not set together with
1241 * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key. 1243 * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key. Setting this flag does
1244 * not necessarily mean that SKBs will have sufficient tailroom for ICV or
1245 * MIC.
1242 * @IEEE80211_KEY_FLAG_RX_MGMT: This key will be used to decrypt received 1246 * @IEEE80211_KEY_FLAG_RX_MGMT: This key will be used to decrypt received
1243 * management frames. The flag can help drivers that have a hardware 1247 * management frames. The flag can help drivers that have a hardware
1244 * crypto implementation that doesn't deal with management frames 1248 * crypto implementation that doesn't deal with management frames
@@ -1405,7 +1409,7 @@ struct ieee80211_sta_rates {
1405 * @supp_rates: Bitmap of supported rates (per band) 1409 * @supp_rates: Bitmap of supported rates (per band)
1406 * @ht_cap: HT capabilities of this STA; restricted to our own capabilities 1410 * @ht_cap: HT capabilities of this STA; restricted to our own capabilities
1407 * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities 1411 * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities
1408 * @wme: indicates whether the STA supports WME. Only valid during AP-mode. 1412 * @wme: indicates whether the STA supports QoS/WME.
1409 * @drv_priv: data area for driver use, will always be aligned to 1413 * @drv_priv: data area for driver use, will always be aligned to
1410 * sizeof(void *), size is determined in hw information. 1414 * sizeof(void *), size is determined in hw information.
1411 * @uapsd_queues: bitmap of queues configured for uapsd. Only valid 1415 * @uapsd_queues: bitmap of queues configured for uapsd. Only valid
@@ -1533,16 +1537,6 @@ struct ieee80211_tx_control {
1533 * @IEEE80211_HW_MFP_CAPABLE: 1537 * @IEEE80211_HW_MFP_CAPABLE:
1534 * Hardware supports management frame protection (MFP, IEEE 802.11w). 1538 * Hardware supports management frame protection (MFP, IEEE 802.11w).
1535 * 1539 *
1536 * @IEEE80211_HW_SUPPORTS_STATIC_SMPS:
1537 * Hardware supports static spatial multiplexing powersave,
1538 * ie. can turn off all but one chain even on HT connections
1539 * that should be using more chains.
1540 *
1541 * @IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS:
1542 * Hardware supports dynamic spatial multiplexing powersave,
1543 * ie. can turn off all but one chain and then wake the rest
1544 * up as required after, for example, rts/cts handshake.
1545 *
1546 * @IEEE80211_HW_SUPPORTS_UAPSD: 1540 * @IEEE80211_HW_SUPPORTS_UAPSD:
1547 * Hardware supports Unscheduled Automatic Power Save Delivery 1541 * Hardware supports Unscheduled Automatic Power Save Delivery
1548 * (U-APSD) in managed mode. The mode is configured with 1542 * (U-APSD) in managed mode. The mode is configured with
@@ -1606,6 +1600,9 @@ struct ieee80211_tx_control {
1606 * is not enabled the default action is to disconnect when getting the 1600 * is not enabled the default action is to disconnect when getting the
1607 * CSA frame. 1601 * CSA frame.
1608 * 1602 *
1603 * @IEEE80211_HW_SUPPORTS_CLONED_SKBS: The driver will never modify the payload
1604 * or tailroom of TX skbs without copying them first.
1605 *
1609 * @IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS: The HW supports scanning on all bands 1606 * @IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS: The HW supports scanning on all bands
1610 * in one command, mac80211 doesn't have to run separate scans per band. 1607 * in one command, mac80211 doesn't have to run separate scans per band.
1611 */ 1608 */
@@ -1625,8 +1622,7 @@ enum ieee80211_hw_flags {
1625 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, 1622 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
1626 IEEE80211_HW_MFP_CAPABLE = 1<<13, 1623 IEEE80211_HW_MFP_CAPABLE = 1<<13,
1627 IEEE80211_HW_WANT_MONITOR_VIF = 1<<14, 1624 IEEE80211_HW_WANT_MONITOR_VIF = 1<<14,
1628 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, 1625 /* free slots */
1629 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16,
1630 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, 1626 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17,
1631 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, 1627 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
1632 IEEE80211_HW_CONNECTION_MONITOR = 1<<19, 1628 IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
@@ -1639,7 +1635,7 @@ enum ieee80211_hw_flags {
1639 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, 1635 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26,
1640 IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27, 1636 IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27,
1641 IEEE80211_HW_CHANCTX_STA_CSA = 1<<28, 1637 IEEE80211_HW_CHANCTX_STA_CSA = 1<<28,
1642 /* bit 29 unused */ 1638 IEEE80211_HW_SUPPORTS_CLONED_SKBS = 1<<29,
1643 IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS = 1<<30, 1639 IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS = 1<<30,
1644}; 1640};
1645 1641
@@ -2666,7 +2662,9 @@ enum ieee80211_roc_type {
2666 * 2662 *
2667 * @set_coverage_class: Set slot time for given coverage class as specified 2663 * @set_coverage_class: Set slot time for given coverage class as specified
2668 * in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout 2664 * in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout
2669 * accordingly. This callback is not required and may sleep. 2665 * accordingly; coverage class equals to -1 to enable ACK timeout
2666 * estimation algorithm (dynack). To disable dynack set valid value for
2667 * coverage class. This callback is not required and may sleep.
2670 * 2668 *
2671 * @testmode_cmd: Implement a cfg80211 test mode command. The passed @vif may 2669 * @testmode_cmd: Implement a cfg80211 test mode command. The passed @vif may
2672 * be %NULL. The callback can sleep. 2670 * be %NULL. The callback can sleep.
@@ -2950,7 +2948,7 @@ struct ieee80211_ops {
2950 int (*get_survey)(struct ieee80211_hw *hw, int idx, 2948 int (*get_survey)(struct ieee80211_hw *hw, int idx,
2951 struct survey_info *survey); 2949 struct survey_info *survey);
2952 void (*rfkill_poll)(struct ieee80211_hw *hw); 2950 void (*rfkill_poll)(struct ieee80211_hw *hw);
2953 void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); 2951 void (*set_coverage_class)(struct ieee80211_hw *hw, s16 coverage_class);
2954#ifdef CONFIG_NL80211_TESTMODE 2952#ifdef CONFIG_NL80211_TESTMODE
2955 int (*testmode_cmd)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2953 int (*testmode_cmd)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2956 void *data, int len); 2954 void *data, int len);
diff --git a/include/net/mld.h b/include/net/mld.h
index faa1d161bf24..01d751303498 100644
--- a/include/net/mld.h
+++ b/include/net/mld.h
@@ -88,12 +88,15 @@ struct mld2_query {
88#define MLDV2_QQIC_EXP(value) (((value) >> 4) & 0x07) 88#define MLDV2_QQIC_EXP(value) (((value) >> 4) & 0x07)
89#define MLDV2_QQIC_MAN(value) ((value) & 0x0f) 89#define MLDV2_QQIC_MAN(value) ((value) & 0x0f)
90 90
91#define MLD_EXP_MIN_LIMIT 32768UL
92#define MLDV1_MRD_MAX_COMPAT (MLD_EXP_MIN_LIMIT - 1)
93
91static inline unsigned long mldv2_mrc(const struct mld2_query *mlh2) 94static inline unsigned long mldv2_mrc(const struct mld2_query *mlh2)
92{ 95{
93 /* RFC3810, 5.1.3. Maximum Response Code */ 96 /* RFC3810, 5.1.3. Maximum Response Code */
94 unsigned long ret, mc_mrc = ntohs(mlh2->mld2q_mrc); 97 unsigned long ret, mc_mrc = ntohs(mlh2->mld2q_mrc);
95 98
96 if (mc_mrc < 32768) { 99 if (mc_mrc < MLD_EXP_MIN_LIMIT) {
97 ret = mc_mrc; 100 ret = mc_mrc;
98 } else { 101 } else {
99 unsigned long mc_man, mc_exp; 102 unsigned long mc_man, mc_exp;
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 47f425464f84..f60558d0254c 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -373,7 +373,7 @@ static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
373 return 0; 373 return 0;
374} 374}
375 375
376#ifdef CONFIG_BRIDGE_NETFILTER 376#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
377static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb) 377static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
378{ 378{
379 unsigned int seq, hh_alen; 379 unsigned int seq, hh_alen;
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 361d26077196..e0d64667a4b3 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -352,26 +352,12 @@ static inline void rt_genid_bump_ipv4(struct net *net)
352 atomic_inc(&net->ipv4.rt_genid); 352 atomic_inc(&net->ipv4.rt_genid);
353} 353}
354 354
355#if IS_ENABLED(CONFIG_IPV6) 355extern void (*__fib6_flush_trees)(struct net *net);
356static inline int rt_genid_ipv6(struct net *net)
357{
358 return atomic_read(&net->ipv6.rt_genid);
359}
360
361static inline void rt_genid_bump_ipv6(struct net *net)
362{
363 atomic_inc(&net->ipv6.rt_genid);
364}
365#else
366static inline int rt_genid_ipv6(struct net *net)
367{
368 return 0;
369}
370
371static inline void rt_genid_bump_ipv6(struct net *net) 356static inline void rt_genid_bump_ipv6(struct net *net)
372{ 357{
358 if (__fib6_flush_trees)
359 __fib6_flush_trees(net);
373} 360}
374#endif
375 361
376#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN) 362#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
377static inline struct netns_ieee802154_lowpan * 363static inline struct netns_ieee802154_lowpan *
diff --git a/include/net/netdma.h b/include/net/netdma.h
deleted file mode 100644
index 8ba8ce284eeb..000000000000
--- a/include/net/netdma.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
21#ifndef NETDMA_H
22#define NETDMA_H
23#ifdef CONFIG_NET_DMA
24#include <linux/dmaengine.h>
25#include <linux/skbuff.h>
26
27int dma_skb_copy_datagram_iovec(struct dma_chan* chan,
28 struct sk_buff *skb, int offset, struct iovec *to,
29 size_t len, struct dma_pinned_list *pinned_list);
30
31#endif /* CONFIG_NET_DMA */
32#endif /* NETDMA_H */
diff --git a/include/net/netfilter/br_netfilter.h b/include/net/netfilter/br_netfilter.h
new file mode 100644
index 000000000000..2aa6048a55c1
--- /dev/null
+++ b/include/net/netfilter/br_netfilter.h
@@ -0,0 +1,6 @@
1#ifndef _BR_NETFILTER_H_
2#define _BR_NETFILTER_H_
3
4void br_netfilter_enable(void);
5
6#endif /* _BR_NETFILTER_H_ */
diff --git a/include/net/netfilter/ipv4/nf_nat_masquerade.h b/include/net/netfilter/ipv4/nf_nat_masquerade.h
new file mode 100644
index 000000000000..a9c001c646da
--- /dev/null
+++ b/include/net/netfilter/ipv4/nf_nat_masquerade.h
@@ -0,0 +1,14 @@
1#ifndef _NF_NAT_MASQUERADE_IPV4_H_
2#define _NF_NAT_MASQUERADE_IPV4_H_
3
4#include <net/netfilter/nf_nat.h>
5
6unsigned int
7nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int hooknum,
8 const struct nf_nat_range *range,
9 const struct net_device *out);
10
11void nf_nat_masquerade_ipv4_register_notifier(void);
12void nf_nat_masquerade_ipv4_unregister_notifier(void);
13
14#endif /*_NF_NAT_MASQUERADE_IPV4_H_ */
diff --git a/include/net/netfilter/ipv4/nf_reject.h b/include/net/netfilter/ipv4/nf_reject.h
index 931fbf812171..03e928a55229 100644
--- a/include/net/netfilter/ipv4/nf_reject.h
+++ b/include/net/netfilter/ipv4/nf_reject.h
@@ -1,128 +1,23 @@
1#ifndef _IPV4_NF_REJECT_H 1#ifndef _IPV4_NF_REJECT_H
2#define _IPV4_NF_REJECT_H 2#define _IPV4_NF_REJECT_H
3 3
4#include <linux/skbuff.h>
4#include <net/ip.h> 5#include <net/ip.h>
5#include <net/tcp.h> 6#include <net/icmp.h>
6#include <net/route.h>
7#include <net/dst.h>
8 7
9static inline void nf_send_unreach(struct sk_buff *skb_in, int code) 8static inline void nf_send_unreach(struct sk_buff *skb_in, int code)
10{ 9{
11 icmp_send(skb_in, ICMP_DEST_UNREACH, code, 0); 10 icmp_send(skb_in, ICMP_DEST_UNREACH, code, 0);
12} 11}
13 12
14/* Send RST reply */ 13void nf_send_reset(struct sk_buff *oldskb, int hook);
15static void nf_send_reset(struct sk_buff *oldskb, int hook)
16{
17 struct sk_buff *nskb;
18 const struct iphdr *oiph;
19 struct iphdr *niph;
20 const struct tcphdr *oth;
21 struct tcphdr _otcph, *tcph;
22
23 /* IP header checks: fragment. */
24 if (ip_hdr(oldskb)->frag_off & htons(IP_OFFSET))
25 return;
26
27 oth = skb_header_pointer(oldskb, ip_hdrlen(oldskb),
28 sizeof(_otcph), &_otcph);
29 if (oth == NULL)
30 return;
31
32 /* No RST for RST. */
33 if (oth->rst)
34 return;
35
36 if (skb_rtable(oldskb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
37 return;
38
39 /* Check checksum */
40 if (nf_ip_checksum(oldskb, hook, ip_hdrlen(oldskb), IPPROTO_TCP))
41 return;
42 oiph = ip_hdr(oldskb);
43
44 nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct tcphdr) +
45 LL_MAX_HEADER, GFP_ATOMIC);
46 if (!nskb)
47 return;
48
49 skb_reserve(nskb, LL_MAX_HEADER);
50
51 skb_reset_network_header(nskb);
52 niph = (struct iphdr *)skb_put(nskb, sizeof(struct iphdr));
53 niph->version = 4;
54 niph->ihl = sizeof(struct iphdr) / 4;
55 niph->tos = 0;
56 niph->id = 0;
57 niph->frag_off = htons(IP_DF);
58 niph->protocol = IPPROTO_TCP;
59 niph->check = 0;
60 niph->saddr = oiph->daddr;
61 niph->daddr = oiph->saddr;
62
63 skb_reset_transport_header(nskb);
64 tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr));
65 memset(tcph, 0, sizeof(*tcph));
66 tcph->source = oth->dest;
67 tcph->dest = oth->source;
68 tcph->doff = sizeof(struct tcphdr) / 4;
69
70 if (oth->ack)
71 tcph->seq = oth->ack_seq;
72 else {
73 tcph->ack_seq = htonl(ntohl(oth->seq) + oth->syn + oth->fin +
74 oldskb->len - ip_hdrlen(oldskb) -
75 (oth->doff << 2));
76 tcph->ack = 1;
77 }
78
79 tcph->rst = 1;
80 tcph->check = ~tcp_v4_check(sizeof(struct tcphdr), niph->saddr,
81 niph->daddr, 0);
82 nskb->ip_summed = CHECKSUM_PARTIAL;
83 nskb->csum_start = (unsigned char *)tcph - nskb->head;
84 nskb->csum_offset = offsetof(struct tcphdr, check);
85
86 /* ip_route_me_harder expects skb->dst to be set */
87 skb_dst_set_noref(nskb, skb_dst(oldskb));
88
89 nskb->protocol = htons(ETH_P_IP);
90 if (ip_route_me_harder(nskb, RTN_UNSPEC))
91 goto free_nskb;
92
93 niph->ttl = ip4_dst_hoplimit(skb_dst(nskb));
94
95 /* "Never happens" */
96 if (nskb->len > dst_mtu(skb_dst(nskb)))
97 goto free_nskb;
98
99 nf_ct_attach(nskb, oldskb);
100
101#ifdef CONFIG_BRIDGE_NETFILTER
102 /* If we use ip_local_out for bridged traffic, the MAC source on
103 * the RST will be ours, instead of the destination's. This confuses
104 * some routers/firewalls, and they drop the packet. So we need to
105 * build the eth header using the original destination's MAC as the
106 * source, and send the RST packet directly.
107 */
108 if (oldskb->nf_bridge) {
109 struct ethhdr *oeth = eth_hdr(oldskb);
110 nskb->dev = oldskb->nf_bridge->physindev;
111 niph->tot_len = htons(nskb->len);
112 ip_send_check(niph);
113 if (dev_hard_header(nskb, nskb->dev, ntohs(nskb->protocol),
114 oeth->h_source, oeth->h_dest, nskb->len) < 0)
115 goto free_nskb;
116 dev_queue_xmit(nskb);
117 } else
118#endif
119 ip_local_out(nskb);
120
121 return;
122
123 free_nskb:
124 kfree_skb(nskb);
125}
126 14
15const struct tcphdr *nf_reject_ip_tcphdr_get(struct sk_buff *oldskb,
16 struct tcphdr *_oth, int hook);
17struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb,
18 const struct sk_buff *oldskb,
19 __be16 protocol, int ttl);
20void nf_reject_ip_tcphdr_put(struct sk_buff *nskb, const struct sk_buff *oldskb,
21 const struct tcphdr *oth);
127 22
128#endif /* _IPV4_NF_REJECT_H */ 23#endif /* _IPV4_NF_REJECT_H */
diff --git a/include/net/netfilter/ipv6/nf_nat_masquerade.h b/include/net/netfilter/ipv6/nf_nat_masquerade.h
new file mode 100644
index 000000000000..0a13396cd390
--- /dev/null
+++ b/include/net/netfilter/ipv6/nf_nat_masquerade.h
@@ -0,0 +1,10 @@
1#ifndef _NF_NAT_MASQUERADE_IPV6_H_
2#define _NF_NAT_MASQUERADE_IPV6_H_
3
4unsigned int
5nf_nat_masquerade_ipv6(struct sk_buff *skb, const struct nf_nat_range *range,
6 const struct net_device *out);
7void nf_nat_masquerade_ipv6_register_notifier(void);
8void nf_nat_masquerade_ipv6_unregister_notifier(void);
9
10#endif /* _NF_NAT_MASQUERADE_IPV6_H_ */
diff --git a/include/net/netfilter/ipv6/nf_reject.h b/include/net/netfilter/ipv6/nf_reject.h
index 710d17ed70b4..23216d48abf9 100644
--- a/include/net/netfilter/ipv6/nf_reject.h
+++ b/include/net/netfilter/ipv6/nf_reject.h
@@ -1,11 +1,7 @@
1#ifndef _IPV6_NF_REJECT_H 1#ifndef _IPV6_NF_REJECT_H
2#define _IPV6_NF_REJECT_H 2#define _IPV6_NF_REJECT_H
3 3
4#include <net/ipv6.h> 4#include <linux/icmpv6.h>
5#include <net/ip6_route.h>
6#include <net/ip6_fib.h>
7#include <net/ip6_checksum.h>
8#include <linux/netfilter_ipv6.h>
9 5
10static inline void 6static inline void
11nf_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,
@@ -17,155 +13,16 @@ nf_send_unreach6(struct net *net, struct sk_buff *skb_in, unsigned char code,
17 icmpv6_send(skb_in, ICMPV6_DEST_UNREACH, code, 0); 13 icmpv6_send(skb_in, ICMPV6_DEST_UNREACH, code, 0);
18} 14}
19 15
20/* Send RST reply */ 16void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook);
21static void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) 17
22{ 18const struct tcphdr *nf_reject_ip6_tcphdr_get(struct sk_buff *oldskb,
23 struct sk_buff *nskb; 19 struct tcphdr *otcph,
24 struct tcphdr otcph, *tcph; 20 unsigned int *otcplen, int hook);
25 unsigned int otcplen, hh_len; 21struct ipv6hdr *nf_reject_ip6hdr_put(struct sk_buff *nskb,
26 int tcphoff, needs_ack; 22 const struct sk_buff *oldskb,
27 const struct ipv6hdr *oip6h = ipv6_hdr(oldskb); 23 __be16 protocol, int hoplimit);
28 struct ipv6hdr *ip6h; 24void nf_reject_ip6_tcphdr_put(struct sk_buff *nskb,
29#define DEFAULT_TOS_VALUE 0x0U 25 const struct sk_buff *oldskb,
30 const __u8 tclass = DEFAULT_TOS_VALUE; 26 const struct tcphdr *oth, unsigned int otcplen);
31 struct dst_entry *dst = NULL;
32 u8 proto;
33 __be16 frag_off;
34 struct flowi6 fl6;
35
36 if ((!(ipv6_addr_type(&oip6h->saddr) & IPV6_ADDR_UNICAST)) ||
37 (!(ipv6_addr_type(&oip6h->daddr) & IPV6_ADDR_UNICAST))) {
38 pr_debug("addr is not unicast.\n");
39 return;
40 }
41
42 proto = oip6h->nexthdr;
43 tcphoff = ipv6_skip_exthdr(oldskb, ((u8*)(oip6h+1) - oldskb->data), &proto, &frag_off);
44
45 if ((tcphoff < 0) || (tcphoff > oldskb->len)) {
46 pr_debug("Cannot get TCP header.\n");
47 return;
48 }
49
50 otcplen = oldskb->len - tcphoff;
51
52 /* IP header checks: fragment, too short. */
53 if (proto != IPPROTO_TCP || otcplen < sizeof(struct tcphdr)) {
54 pr_debug("proto(%d) != IPPROTO_TCP, "
55 "or too short. otcplen = %d\n",
56 proto, otcplen);
57 return;
58 }
59
60 if (skb_copy_bits(oldskb, tcphoff, &otcph, sizeof(struct tcphdr)))
61 BUG();
62
63 /* No RST for RST. */
64 if (otcph.rst) {
65 pr_debug("RST is set\n");
66 return;
67 }
68
69 /* Check checksum. */
70 if (nf_ip6_checksum(oldskb, hook, tcphoff, IPPROTO_TCP)) {
71 pr_debug("TCP checksum is invalid\n");
72 return;
73 }
74
75 memset(&fl6, 0, sizeof(fl6));
76 fl6.flowi6_proto = IPPROTO_TCP;
77 fl6.saddr = oip6h->daddr;
78 fl6.daddr = oip6h->saddr;
79 fl6.fl6_sport = otcph.dest;
80 fl6.fl6_dport = otcph.source;
81 security_skb_classify_flow(oldskb, flowi6_to_flowi(&fl6));
82 dst = ip6_route_output(net, NULL, &fl6);
83 if (dst == NULL || dst->error) {
84 dst_release(dst);
85 return;
86 }
87 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0);
88 if (IS_ERR(dst))
89 return;
90
91 hh_len = (dst->dev->hard_header_len + 15)&~15;
92 nskb = alloc_skb(hh_len + 15 + dst->header_len + sizeof(struct ipv6hdr)
93 + sizeof(struct tcphdr) + dst->trailer_len,
94 GFP_ATOMIC);
95
96 if (!nskb) {
97 net_dbg_ratelimited("cannot alloc skb\n");
98 dst_release(dst);
99 return;
100 }
101
102 skb_dst_set(nskb, dst);
103
104 skb_reserve(nskb, hh_len + dst->header_len);
105
106 skb_put(nskb, sizeof(struct ipv6hdr));
107 skb_reset_network_header(nskb);
108 ip6h = ipv6_hdr(nskb);
109 ip6_flow_hdr(ip6h, tclass, 0);
110 ip6h->hop_limit = ip6_dst_hoplimit(dst);
111 ip6h->nexthdr = IPPROTO_TCP;
112 ip6h->saddr = oip6h->daddr;
113 ip6h->daddr = oip6h->saddr;
114
115 skb_reset_transport_header(nskb);
116 tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr));
117 /* Truncate to length (no data) */
118 tcph->doff = sizeof(struct tcphdr)/4;
119 tcph->source = otcph.dest;
120 tcph->dest = otcph.source;
121
122 if (otcph.ack) {
123 needs_ack = 0;
124 tcph->seq = otcph.ack_seq;
125 tcph->ack_seq = 0;
126 } else {
127 needs_ack = 1;
128 tcph->ack_seq = htonl(ntohl(otcph.seq) + otcph.syn + otcph.fin
129 + otcplen - (otcph.doff<<2));
130 tcph->seq = 0;
131 }
132
133 /* Reset flags */
134 ((u_int8_t *)tcph)[13] = 0;
135 tcph->rst = 1;
136 tcph->ack = needs_ack;
137 tcph->window = 0;
138 tcph->urg_ptr = 0;
139 tcph->check = 0;
140
141 /* Adjust TCP checksum */
142 tcph->check = csum_ipv6_magic(&ipv6_hdr(nskb)->saddr,
143 &ipv6_hdr(nskb)->daddr,
144 sizeof(struct tcphdr), IPPROTO_TCP,
145 csum_partial(tcph,
146 sizeof(struct tcphdr), 0));
147
148 nf_ct_attach(nskb, oldskb);
149
150#ifdef CONFIG_BRIDGE_NETFILTER
151 /* If we use ip6_local_out for bridged traffic, the MAC source on
152 * the RST will be ours, instead of the destination's. This confuses
153 * some routers/firewalls, and they drop the packet. So we need to
154 * build the eth header using the original destination's MAC as the
155 * source, and send the RST packet directly.
156 */
157 if (oldskb->nf_bridge) {
158 struct ethhdr *oeth = eth_hdr(oldskb);
159 nskb->dev = oldskb->nf_bridge->physindev;
160 nskb->protocol = htons(ETH_P_IPV6);
161 ip6h->payload_len = htons(sizeof(struct tcphdr));
162 if (dev_hard_header(nskb, nskb->dev, ntohs(nskb->protocol),
163 oeth->h_source, oeth->h_dest, nskb->len) < 0)
164 return;
165 dev_queue_xmit(nskb);
166 } else
167#endif
168 ip6_local_out(nskb);
169}
170 27
171#endif /* _IPV6_NF_REJECT_H */ 28#endif /* _IPV6_NF_REJECT_H */
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 37252f71a380..c8a7db605e03 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -242,7 +242,7 @@ extern s32 (*nf_ct_nat_offset)(const struct nf_conn *ct,
242DECLARE_PER_CPU(struct nf_conn, nf_conntrack_untracked); 242DECLARE_PER_CPU(struct nf_conn, nf_conntrack_untracked);
243static inline struct nf_conn *nf_ct_untracked_get(void) 243static inline struct nf_conn *nf_ct_untracked_get(void)
244{ 244{
245 return &__raw_get_cpu_var(nf_conntrack_untracked); 245 return raw_cpu_ptr(&nf_conntrack_untracked);
246} 246}
247void nf_ct_untracked_status_or(unsigned long bits); 247void nf_ct_untracked_status_or(unsigned long bits);
248 248
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index a71dd333ac68..344b1ab19220 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -32,10 +32,8 @@ struct nf_conn_nat {
32 struct hlist_node bysource; 32 struct hlist_node bysource;
33 struct nf_conn *ct; 33 struct nf_conn *ct;
34 union nf_conntrack_nat_help help; 34 union nf_conntrack_nat_help help;
35#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \ 35#if IS_ENABLED(CONFIG_NF_NAT_MASQUERADE_IPV4) || \
36 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE) || \ 36 IS_ENABLED(CONFIG_NF_NAT_MASQUERADE_IPV6)
37 defined(CONFIG_IP6_NF_TARGET_MASQUERADE) || \
38 defined(CONFIG_IP6_NF_TARGET_MASQUERADE_MODULE)
39 int masq_index; 37 int masq_index;
40#endif 38#endif
41}; 39};
@@ -68,8 +66,8 @@ static inline bool nf_nat_oif_changed(unsigned int hooknum,
68 struct nf_conn_nat *nat, 66 struct nf_conn_nat *nat,
69 const struct net_device *out) 67 const struct net_device *out)
70{ 68{
71#if IS_ENABLED(CONFIG_IP_NF_TARGET_MASQUERADE) || \ 69#if IS_ENABLED(CONFIG_NF_NAT_MASQUERADE_IPV4) || \
72 IS_ENABLED(CONFIG_IP6_NF_TARGET_MASQUERADE) 70 IS_ENABLED(CONFIG_NF_NAT_MASQUERADE_IPV6)
73 return nat->masq_index && hooknum == NF_INET_POST_ROUTING && 71 return nat->masq_index && hooknum == NF_INET_POST_ROUTING &&
74 CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL && 72 CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL &&
75 nat->masq_index != out->ifindex; 73 nat->masq_index != out->ifindex;
diff --git a/include/net/netfilter/nf_nat_l3proto.h b/include/net/netfilter/nf_nat_l3proto.h
index 5a2919b2e09a..340c013795a4 100644
--- a/include/net/netfilter/nf_nat_l3proto.h
+++ b/include/net/netfilter/nf_nat_l3proto.h
@@ -42,8 +42,83 @@ const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto);
42int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct, 42int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
43 enum ip_conntrack_info ctinfo, 43 enum ip_conntrack_info ctinfo,
44 unsigned int hooknum); 44 unsigned int hooknum);
45
46unsigned int nf_nat_ipv4_in(const struct nf_hook_ops *ops, struct sk_buff *skb,
47 const struct net_device *in,
48 const struct net_device *out,
49 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
50 struct sk_buff *skb,
51 const struct net_device *in,
52 const struct net_device *out,
53 struct nf_conn *ct));
54
55unsigned int nf_nat_ipv4_out(const struct nf_hook_ops *ops, struct sk_buff *skb,
56 const struct net_device *in,
57 const struct net_device *out,
58 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
59 struct sk_buff *skb,
60 const struct net_device *in,
61 const struct net_device *out,
62 struct nf_conn *ct));
63
64unsigned int nf_nat_ipv4_local_fn(const struct nf_hook_ops *ops,
65 struct sk_buff *skb,
66 const struct net_device *in,
67 const struct net_device *out,
68 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
69 struct sk_buff *skb,
70 const struct net_device *in,
71 const struct net_device *out,
72 struct nf_conn *ct));
73
74unsigned int nf_nat_ipv4_fn(const struct nf_hook_ops *ops, struct sk_buff *skb,
75 const struct net_device *in,
76 const struct net_device *out,
77 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
78 struct sk_buff *skb,
79 const struct net_device *in,
80 const struct net_device *out,
81 struct nf_conn *ct));
82
45int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct, 83int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
46 enum ip_conntrack_info ctinfo, 84 enum ip_conntrack_info ctinfo,
47 unsigned int hooknum, unsigned int hdrlen); 85 unsigned int hooknum, unsigned int hdrlen);
48 86
87unsigned int nf_nat_ipv6_in(const struct nf_hook_ops *ops, struct sk_buff *skb,
88 const struct net_device *in,
89 const struct net_device *out,
90 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
91 struct sk_buff *skb,
92 const struct net_device *in,
93 const struct net_device *out,
94 struct nf_conn *ct));
95
96unsigned int nf_nat_ipv6_out(const struct nf_hook_ops *ops, struct sk_buff *skb,
97 const struct net_device *in,
98 const struct net_device *out,
99 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
100 struct sk_buff *skb,
101 const struct net_device *in,
102 const struct net_device *out,
103 struct nf_conn *ct));
104
105unsigned int nf_nat_ipv6_local_fn(const struct nf_hook_ops *ops,
106 struct sk_buff *skb,
107 const struct net_device *in,
108 const struct net_device *out,
109 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
110 struct sk_buff *skb,
111 const struct net_device *in,
112 const struct net_device *out,
113 struct nf_conn *ct));
114
115unsigned int nf_nat_ipv6_fn(const struct nf_hook_ops *ops, struct sk_buff *skb,
116 const struct net_device *in,
117 const struct net_device *out,
118 unsigned int (*do_chain)(const struct nf_hook_ops *ops,
119 struct sk_buff *skb,
120 const struct net_device *in,
121 const struct net_device *out,
122 struct nf_conn *ct));
123
49#endif /* _NF_NAT_L3PROTO_H */ 124#endif /* _NF_NAT_L3PROTO_H */
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index c4d86198d3d6..845c596bf594 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -241,6 +241,7 @@ void nft_unregister_set(struct nft_set_ops *ops);
241 * @dtype: data type (verdict or numeric type defined by userspace) 241 * @dtype: data type (verdict or numeric type defined by userspace)
242 * @size: maximum set size 242 * @size: maximum set size
243 * @nelems: number of elements 243 * @nelems: number of elements
244 * @policy: set parameterization (see enum nft_set_policies)
244 * @ops: set ops 245 * @ops: set ops
245 * @flags: set flags 246 * @flags: set flags
246 * @klen: key length 247 * @klen: key length
@@ -255,6 +256,7 @@ struct nft_set {
255 u32 dtype; 256 u32 dtype;
256 u32 size; 257 u32 size;
257 u32 nelems; 258 u32 nelems;
259 u16 policy;
258 /* runtime data below here */ 260 /* runtime data below here */
259 const struct nft_set_ops *ops ____cacheline_aligned; 261 const struct nft_set_ops *ops ____cacheline_aligned;
260 u16 flags; 262 u16 flags;
@@ -528,6 +530,9 @@ enum nft_chain_type {
528 NFT_CHAIN_T_MAX 530 NFT_CHAIN_T_MAX
529}; 531};
530 532
533int nft_chain_validate_dependency(const struct nft_chain *chain,
534 enum nft_chain_type type);
535
531struct nft_stats { 536struct nft_stats {
532 u64 bytes; 537 u64 bytes;
533 u64 pkts; 538 u64 pkts;
diff --git a/include/net/netfilter/nft_masq.h b/include/net/netfilter/nft_masq.h
new file mode 100644
index 000000000000..e2a518b60e19
--- /dev/null
+++ b/include/net/netfilter/nft_masq.h
@@ -0,0 +1,19 @@
1#ifndef _NFT_MASQ_H_
2#define _NFT_MASQ_H_
3
4struct nft_masq {
5 u32 flags;
6};
7
8extern const struct nla_policy nft_masq_policy[];
9
10int nft_masq_init(const struct nft_ctx *ctx,
11 const struct nft_expr *expr,
12 const struct nlattr * const tb[]);
13
14int nft_masq_dump(struct sk_buff *skb, const struct nft_expr *expr);
15
16int nft_masq_validate(const struct nft_ctx *ctx, const struct nft_expr *expr,
17 const struct nft_data **data);
18
19#endif /* _NFT_MASQ_H_ */
diff --git a/include/net/netfilter/nft_reject.h b/include/net/netfilter/nft_reject.h
index 36b0da2d55bb..60fa1530006b 100644
--- a/include/net/netfilter/nft_reject.h
+++ b/include/net/netfilter/nft_reject.h
@@ -14,12 +14,7 @@ int nft_reject_init(const struct nft_ctx *ctx,
14 14
15int nft_reject_dump(struct sk_buff *skb, const struct nft_expr *expr); 15int nft_reject_dump(struct sk_buff *skb, const struct nft_expr *expr);
16 16
17void nft_reject_ipv4_eval(const struct nft_expr *expr, 17int nft_reject_icmp_code(u8 code);
18 struct nft_data data[NFT_REG_MAX + 1], 18int nft_reject_icmpv6_code(u8 code);
19 const struct nft_pktinfo *pkt);
20
21void nft_reject_ipv6_eval(const struct nft_expr *expr,
22 struct nft_data data[NFT_REG_MAX + 1],
23 const struct nft_pktinfo *pkt);
24 19
25#endif 20#endif
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index a4fc39bb3e4f..7b5a300de7f5 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -524,10 +524,10 @@ static inline int netlbl_catmap_setrng(struct netlbl_lsm_catmap **catmap,
524{ 524{
525 return 0; 525 return 0;
526} 526}
527static int netlbl_catmap_setlong(struct netlbl_lsm_catmap **catmap, 527static inline int netlbl_catmap_setlong(struct netlbl_lsm_catmap **catmap,
528 u32 offset, 528 u32 offset,
529 unsigned long bitmap, 529 unsigned long bitmap,
530 gfp_t flags) 530 gfp_t flags)
531{ 531{
532 return 0; 532 return 0;
533} 533}
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 6c1076275aaa..7b903e1bdbbb 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -431,7 +431,7 @@ static inline int nlmsg_report(const struct nlmsghdr *nlh)
431/** 431/**
432 * nlmsg_put - Add a new netlink message to an skb 432 * nlmsg_put - Add a new netlink message to an skb
433 * @skb: socket buffer to store message in 433 * @skb: socket buffer to store message in
434 * @portid: netlink process id 434 * @portid: netlink PORTID of requesting application
435 * @seq: sequence number of message 435 * @seq: sequence number of message
436 * @type: message type 436 * @type: message type
437 * @payload: length of message payload 437 * @payload: length of message payload
diff --git a/include/net/netns/ieee802154_6lowpan.h b/include/net/netns/ieee802154_6lowpan.h
index e2070960bac0..8170f8d7052b 100644
--- a/include/net/netns/ieee802154_6lowpan.h
+++ b/include/net/netns/ieee802154_6lowpan.h
@@ -16,7 +16,6 @@ struct netns_sysctl_lowpan {
16struct netns_ieee802154_lowpan { 16struct netns_ieee802154_lowpan {
17 struct netns_sysctl_lowpan sysctl; 17 struct netns_sysctl_lowpan sysctl;
18 struct netns_frags frags; 18 struct netns_frags frags;
19 int max_dsize;
20}; 19};
21 20
22#endif 21#endif
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index aec5e12f9f19..24945cefc4fd 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -76,6 +76,7 @@ struct netns_ipv4 {
76 int sysctl_tcp_ecn; 76 int sysctl_tcp_ecn;
77 int sysctl_ip_no_pmtu_disc; 77 int sysctl_ip_no_pmtu_disc;
78 int sysctl_ip_fwd_use_pmtu; 78 int sysctl_ip_fwd_use_pmtu;
79 int sysctl_ip_nonlocal_bind;
79 80
80 int sysctl_fwmark_reflect; 81 int sysctl_fwmark_reflect;
81 int sysctl_tcp_fwmark_accept; 82 int sysctl_tcp_fwmark_accept;
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index eade27adecf3..69ae41f2098c 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -76,7 +76,7 @@ struct netns_ipv6 {
76#endif 76#endif
77#endif 77#endif
78 atomic_t dev_addr_genid; 78 atomic_t dev_addr_genid;
79 atomic_t rt_genid; 79 atomic_t fib6_sernum;
80}; 80};
81 81
82#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) 82#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index 3492434baf88..9da798256f0e 100644
--- a/include/net/netns/xfrm.h
+++ b/include/net/netns/xfrm.h
@@ -13,6 +13,19 @@ struct ctl_table_header;
13struct xfrm_policy_hash { 13struct xfrm_policy_hash {
14 struct hlist_head *table; 14 struct hlist_head *table;
15 unsigned int hmask; 15 unsigned int hmask;
16 u8 dbits4;
17 u8 sbits4;
18 u8 dbits6;
19 u8 sbits6;
20};
21
22struct xfrm_policy_hthresh {
23 struct work_struct work;
24 seqlock_t lock;
25 u8 lbits4;
26 u8 rbits4;
27 u8 lbits6;
28 u8 rbits6;
16}; 29};
17 30
18struct netns_xfrm { 31struct netns_xfrm {
@@ -41,6 +54,7 @@ struct netns_xfrm {
41 struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX * 2]; 54 struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX * 2];
42 unsigned int policy_count[XFRM_POLICY_MAX * 2]; 55 unsigned int policy_count[XFRM_POLICY_MAX * 2];
43 struct work_struct policy_hash_work; 56 struct work_struct policy_hash_work;
57 struct xfrm_policy_hthresh policy_hthresh;
44 58
45 59
46 struct sock *nlsk; 60 struct sock *nlsk;
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index fbfa4e471abb..9eca9ae2280c 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -2,6 +2,7 @@
2 * The NFC Controller Interface is the communication protocol between an 2 * The NFC Controller Interface is the communication protocol between an
3 * NFC Controller (NFCC) and a Device Host (DH). 3 * NFC Controller (NFCC) and a Device Host (DH).
4 * 4 *
5 * Copyright (C) 2014 Marvell International Ltd.
5 * Copyright (C) 2011 Texas Instruments, Inc. 6 * Copyright (C) 2011 Texas Instruments, Inc.
6 * 7 *
7 * Written by Ilan Elias <ilane@ti.com> 8 * Written by Ilan Elias <ilane@ti.com>
@@ -65,19 +66,18 @@
65#define NCI_NFC_F_PASSIVE_POLL_MODE 0x02 66#define NCI_NFC_F_PASSIVE_POLL_MODE 0x02
66#define NCI_NFC_A_ACTIVE_POLL_MODE 0x03 67#define NCI_NFC_A_ACTIVE_POLL_MODE 0x03
67#define NCI_NFC_F_ACTIVE_POLL_MODE 0x05 68#define NCI_NFC_F_ACTIVE_POLL_MODE 0x05
68#define NCI_NFC_15693_PASSIVE_POLL_MODE 0x06 69#define NCI_NFC_V_PASSIVE_POLL_MODE 0x06
69#define NCI_NFC_A_PASSIVE_LISTEN_MODE 0x80 70#define NCI_NFC_A_PASSIVE_LISTEN_MODE 0x80
70#define NCI_NFC_B_PASSIVE_LISTEN_MODE 0x81 71#define NCI_NFC_B_PASSIVE_LISTEN_MODE 0x81
71#define NCI_NFC_F_PASSIVE_LISTEN_MODE 0x82 72#define NCI_NFC_F_PASSIVE_LISTEN_MODE 0x82
72#define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83 73#define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83
73#define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85 74#define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85
74#define NCI_NFC_15693_PASSIVE_LISTEN_MODE 0x86
75 75
76/* NCI RF Technologies */ 76/* NCI RF Technologies */
77#define NCI_NFC_RF_TECHNOLOGY_A 0x00 77#define NCI_NFC_RF_TECHNOLOGY_A 0x00
78#define NCI_NFC_RF_TECHNOLOGY_B 0x01 78#define NCI_NFC_RF_TECHNOLOGY_B 0x01
79#define NCI_NFC_RF_TECHNOLOGY_F 0x02 79#define NCI_NFC_RF_TECHNOLOGY_F 0x02
80#define NCI_NFC_RF_TECHNOLOGY_15693 0x03 80#define NCI_NFC_RF_TECHNOLOGY_V 0x03
81 81
82/* NCI Bit Rates */ 82/* NCI Bit Rates */
83#define NCI_NFC_BIT_RATE_106 0x00 83#define NCI_NFC_BIT_RATE_106 0x00
@@ -87,6 +87,7 @@
87#define NCI_NFC_BIT_RATE_1695 0x04 87#define NCI_NFC_BIT_RATE_1695 0x04
88#define NCI_NFC_BIT_RATE_3390 0x05 88#define NCI_NFC_BIT_RATE_3390 0x05
89#define NCI_NFC_BIT_RATE_6780 0x06 89#define NCI_NFC_BIT_RATE_6780 0x06
90#define NCI_NFC_BIT_RATE_26 0x20
90 91
91/* NCI RF Protocols */ 92/* NCI RF Protocols */
92#define NCI_RF_PROTOCOL_UNKNOWN 0x00 93#define NCI_RF_PROTOCOL_UNKNOWN 0x00
@@ -95,6 +96,7 @@
95#define NCI_RF_PROTOCOL_T3T 0x03 96#define NCI_RF_PROTOCOL_T3T 0x03
96#define NCI_RF_PROTOCOL_ISO_DEP 0x04 97#define NCI_RF_PROTOCOL_ISO_DEP 0x04
97#define NCI_RF_PROTOCOL_NFC_DEP 0x05 98#define NCI_RF_PROTOCOL_NFC_DEP 0x05
99#define NCI_RF_PROTOCOL_T5T 0x06
98 100
99/* NCI RF Interfaces */ 101/* NCI RF Interfaces */
100#define NCI_RF_INTERFACE_NFCEE_DIRECT 0x00 102#define NCI_RF_INTERFACE_NFCEE_DIRECT 0x00
@@ -328,6 +330,12 @@ struct rf_tech_specific_params_nfcf_poll {
328 __u8 sensf_res[18]; /* 16 or 18 Bytes */ 330 __u8 sensf_res[18]; /* 16 or 18 Bytes */
329} __packed; 331} __packed;
330 332
333struct rf_tech_specific_params_nfcv_poll {
334 __u8 res_flags;
335 __u8 dsfid;
336 __u8 uid[8]; /* 8 Bytes */
337} __packed;
338
331struct nci_rf_discover_ntf { 339struct nci_rf_discover_ntf {
332 __u8 rf_discovery_id; 340 __u8 rf_discovery_id;
333 __u8 rf_protocol; 341 __u8 rf_protocol;
@@ -338,6 +346,7 @@ struct nci_rf_discover_ntf {
338 struct rf_tech_specific_params_nfca_poll nfca_poll; 346 struct rf_tech_specific_params_nfca_poll nfca_poll;
339 struct rf_tech_specific_params_nfcb_poll nfcb_poll; 347 struct rf_tech_specific_params_nfcb_poll nfcb_poll;
340 struct rf_tech_specific_params_nfcf_poll nfcf_poll; 348 struct rf_tech_specific_params_nfcf_poll nfcf_poll;
349 struct rf_tech_specific_params_nfcv_poll nfcv_poll;
341 } rf_tech_specific_params; 350 } rf_tech_specific_params;
342 351
343 __u8 ntf_type; 352 __u8 ntf_type;
@@ -372,6 +381,7 @@ struct nci_rf_intf_activated_ntf {
372 struct rf_tech_specific_params_nfca_poll nfca_poll; 381 struct rf_tech_specific_params_nfca_poll nfca_poll;
373 struct rf_tech_specific_params_nfcb_poll nfcb_poll; 382 struct rf_tech_specific_params_nfcb_poll nfcb_poll;
374 struct rf_tech_specific_params_nfcf_poll nfcf_poll; 383 struct rf_tech_specific_params_nfcf_poll nfcf_poll;
384 struct rf_tech_specific_params_nfcv_poll nfcv_poll;
375 } rf_tech_specific_params; 385 } rf_tech_specific_params;
376 386
377 __u8 data_exch_rf_tech_and_mode; 387 __u8 data_exch_rf_tech_and_mode;
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 1f9a0f5272fe..75d10e625c49 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -64,10 +64,11 @@ enum nci_state {
64struct nci_dev; 64struct nci_dev;
65 65
66struct nci_ops { 66struct nci_ops {
67 int (*open)(struct nci_dev *ndev); 67 int (*open)(struct nci_dev *ndev);
68 int (*close)(struct nci_dev *ndev); 68 int (*close)(struct nci_dev *ndev);
69 int (*send)(struct nci_dev *ndev, struct sk_buff *skb); 69 int (*send)(struct nci_dev *ndev, struct sk_buff *skb);
70 int (*setup)(struct nci_dev *ndev); 70 int (*setup)(struct nci_dev *ndev);
71 __u32 (*get_rfprotocol)(struct nci_dev *ndev, __u8 rf_protocol);
71}; 72};
72 73
73#define NCI_MAX_SUPPORTED_RF_INTERFACES 4 74#define NCI_MAX_SUPPORTED_RF_INTERFACES 4
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 6da46dcf1049..bc49967e1a68 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -20,11 +20,7 @@ int unregister_tcf_proto_ops(struct tcf_proto_ops *ops);
20static inline unsigned long 20static inline unsigned long
21__cls_set_class(unsigned long *clp, unsigned long cl) 21__cls_set_class(unsigned long *clp, unsigned long cl)
22{ 22{
23 unsigned long old_cl; 23 return xchg(clp, cl);
24
25 old_cl = *clp;
26 *clp = cl;
27 return old_cl;
28} 24}
29 25
30static inline unsigned long 26static inline unsigned long
@@ -137,7 +133,7 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts,
137int tcf_exts_validate(struct net *net, struct tcf_proto *tp, 133int tcf_exts_validate(struct net *net, struct tcf_proto *tp,
138 struct nlattr **tb, struct nlattr *rate_tlv, 134 struct nlattr **tb, struct nlattr *rate_tlv,
139 struct tcf_exts *exts, bool ovr); 135 struct tcf_exts *exts, bool ovr);
140void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts); 136void tcf_exts_destroy(struct tcf_exts *exts);
141void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, 137void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst,
142 struct tcf_exts *src); 138 struct tcf_exts *src);
143int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts); 139int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts);
@@ -170,6 +166,7 @@ struct tcf_ematch {
170 unsigned int datalen; 166 unsigned int datalen;
171 u16 matchid; 167 u16 matchid;
172 u16 flags; 168 u16 flags;
169 struct net *net;
173}; 170};
174 171
175static inline int tcf_em_is_container(struct tcf_ematch *em) 172static inline int tcf_em_is_container(struct tcf_ematch *em)
@@ -233,12 +230,11 @@ struct tcf_ematch_tree {
233struct tcf_ematch_ops { 230struct tcf_ematch_ops {
234 int kind; 231 int kind;
235 int datalen; 232 int datalen;
236 int (*change)(struct tcf_proto *, void *, 233 int (*change)(struct net *net, void *,
237 int, struct tcf_ematch *); 234 int, struct tcf_ematch *);
238 int (*match)(struct sk_buff *, struct tcf_ematch *, 235 int (*match)(struct sk_buff *, struct tcf_ematch *,
239 struct tcf_pkt_info *); 236 struct tcf_pkt_info *);
240 void (*destroy)(struct tcf_proto *, 237 void (*destroy)(struct tcf_ematch *);
241 struct tcf_ematch *);
242 int (*dump)(struct sk_buff *, struct tcf_ematch *); 238 int (*dump)(struct sk_buff *, struct tcf_ematch *);
243 struct module *owner; 239 struct module *owner;
244 struct list_head link; 240 struct list_head link;
@@ -248,7 +244,7 @@ int tcf_em_register(struct tcf_ematch_ops *);
248void tcf_em_unregister(struct tcf_ematch_ops *); 244void tcf_em_unregister(struct tcf_ematch_ops *);
249int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *, 245int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *,
250 struct tcf_ematch_tree *); 246 struct tcf_ematch_tree *);
251void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *); 247void tcf_em_tree_destroy(struct tcf_ematch_tree *);
252int tcf_em_tree_dump(struct sk_buff *, struct tcf_ematch_tree *, int); 248int tcf_em_tree_dump(struct sk_buff *, struct tcf_ematch_tree *, int);
253int __tcf_em_tree_match(struct sk_buff *, struct tcf_ematch_tree *, 249int __tcf_em_tree_match(struct sk_buff *, struct tcf_ematch_tree *,
254 struct tcf_pkt_info *); 250 struct tcf_pkt_info *);
@@ -305,7 +301,7 @@ struct tcf_ematch_tree {
305}; 301};
306 302
307#define tcf_em_tree_validate(tp, tb, t) ((void)(t), 0) 303#define tcf_em_tree_validate(tp, tb, t) ((void)(t), 0)
308#define tcf_em_tree_destroy(tp, t) do { (void)(t); } while(0) 304#define tcf_em_tree_destroy(t) do { (void)(t); } while(0)
309#define tcf_em_tree_dump(skb, t, tlv) (0) 305#define tcf_em_tree_dump(skb, t, tlv) (0)
310#define tcf_em_tree_change(tp, dst, src) do { } while(0) 306#define tcf_em_tree_change(tp, dst, src) do { } while(0)
311#define tcf_em_tree_match(skb, t, info) ((void)(info), 1) 307#define tcf_em_tree_match(skb, t, info) ((void)(info), 1)
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index ec030cd76616..27a33833ff4a 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -50,7 +50,7 @@ typedef long psched_tdiff_t;
50 50
51static inline psched_time_t psched_get_time(void) 51static inline psched_time_t psched_get_time(void)
52{ 52{
53 return PSCHED_NS2TICKS(ktime_to_ns(ktime_get())); 53 return PSCHED_NS2TICKS(ktime_get_ns());
54} 54}
55 55
56static inline psched_tdiff_t 56static inline psched_tdiff_t
@@ -65,12 +65,12 @@ struct qdisc_watchdog {
65}; 65};
66 66
67void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc); 67void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc);
68void qdisc_watchdog_schedule_ns(struct qdisc_watchdog *wd, u64 expires); 68void qdisc_watchdog_schedule_ns(struct qdisc_watchdog *wd, u64 expires, bool throttle);
69 69
70static inline void qdisc_watchdog_schedule(struct qdisc_watchdog *wd, 70static inline void qdisc_watchdog_schedule(struct qdisc_watchdog *wd,
71 psched_time_t expires) 71 psched_time_t expires)
72{ 72{
73 qdisc_watchdog_schedule_ns(wd, PSCHED_TICKS2NS(expires)); 73 qdisc_watchdog_schedule_ns(wd, PSCHED_TICKS2NS(expires), true);
74} 74}
75 75
76void qdisc_watchdog_cancel(struct qdisc_watchdog *wd); 76void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);
@@ -99,7 +99,7 @@ void qdisc_put_stab(struct qdisc_size_table *tab);
99void qdisc_warn_nonwc(const char *txt, struct Qdisc *qdisc); 99void qdisc_warn_nonwc(const char *txt, struct Qdisc *qdisc);
100int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q, 100int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
101 struct net_device *dev, struct netdev_queue *txq, 101 struct net_device *dev, struct netdev_queue *txq,
102 spinlock_t *root_lock); 102 spinlock_t *root_lock, bool validate);
103 103
104void __qdisc_run(struct Qdisc *q); 104void __qdisc_run(struct Qdisc *q);
105 105
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index 259992444e80..dad7ab20a8cb 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -167,7 +167,7 @@ struct ieee80211_reg_rule {
167struct ieee80211_regdomain { 167struct ieee80211_regdomain {
168 struct rcu_head rcu_head; 168 struct rcu_head rcu_head;
169 u32 n_reg_rules; 169 u32 n_reg_rules;
170 char alpha2[2]; 170 char alpha2[3];
171 enum nl80211_dfs_regions dfs_region; 171 enum nl80211_dfs_regions dfs_region;
172 struct ieee80211_reg_rule reg_rules[]; 172 struct ieee80211_reg_rule reg_rules[];
173}; 173};
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index a3cfb8ebeb53..d17ed6fb2f70 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -6,6 +6,8 @@
6#include <linux/rcupdate.h> 6#include <linux/rcupdate.h>
7#include <linux/pkt_sched.h> 7#include <linux/pkt_sched.h>
8#include <linux/pkt_cls.h> 8#include <linux/pkt_cls.h>
9#include <linux/percpu.h>
10#include <linux/dynamic_queue_limits.h>
9#include <net/gen_stats.h> 11#include <net/gen_stats.h>
10#include <net/rtnetlink.h> 12#include <net/rtnetlink.h>
11 13
@@ -58,6 +60,7 @@ struct Qdisc {
58 * multiqueue device. 60 * multiqueue device.
59 */ 61 */
60#define TCQ_F_WARN_NONWC (1 << 16) 62#define TCQ_F_WARN_NONWC (1 << 16)
63#define TCQ_F_CPUSTATS 0x20 /* run using percpu statistics */
61 u32 limit; 64 u32 limit;
62 const struct Qdisc_ops *ops; 65 const struct Qdisc_ops *ops;
63 struct qdisc_size_table __rcu *stab; 66 struct qdisc_size_table __rcu *stab;
@@ -83,9 +86,15 @@ struct Qdisc {
83 */ 86 */
84 unsigned long state; 87 unsigned long state;
85 struct sk_buff_head q; 88 struct sk_buff_head q;
86 struct gnet_stats_basic_packed bstats; 89 union {
90 struct gnet_stats_basic_packed bstats;
91 struct gnet_stats_basic_cpu __percpu *cpu_bstats;
92 } __packed;
87 unsigned int __state; 93 unsigned int __state;
88 struct gnet_stats_queue qstats; 94 union {
95 struct gnet_stats_queue qstats;
96 struct gnet_stats_queue __percpu *cpu_qstats;
97 } __packed;
89 struct rcu_head rcu_head; 98 struct rcu_head rcu_head;
90 int padded; 99 int padded;
91 atomic_t refcnt; 100 atomic_t refcnt;
@@ -111,6 +120,21 @@ static inline void qdisc_run_end(struct Qdisc *qdisc)
111 qdisc->__state &= ~__QDISC___STATE_RUNNING; 120 qdisc->__state &= ~__QDISC___STATE_RUNNING;
112} 121}
113 122
123static inline bool qdisc_may_bulk(const struct Qdisc *qdisc)
124{
125 return qdisc->flags & TCQ_F_ONETXQUEUE;
126}
127
128static inline int qdisc_avail_bulklimit(const struct netdev_queue *txq)
129{
130#ifdef CONFIG_BQL
131 /* Non-BQL migrated drivers will return 0, too. */
132 return dql_avail(&txq->dql);
133#else
134 return 0;
135#endif
136}
137
114static inline bool qdisc_is_throttled(const struct Qdisc *qdisc) 138static inline bool qdisc_is_throttled(const struct Qdisc *qdisc)
115{ 139{
116 return test_bit(__QDISC_STATE_THROTTLED, &qdisc->state) ? true : false; 140 return test_bit(__QDISC_STATE_THROTTLED, &qdisc->state) ? true : false;
@@ -143,7 +167,7 @@ struct Qdisc_class_ops {
143 void (*walk)(struct Qdisc *, struct qdisc_walker * arg); 167 void (*walk)(struct Qdisc *, struct qdisc_walker * arg);
144 168
145 /* Filter manipulation */ 169 /* Filter manipulation */
146 struct tcf_proto ** (*tcf_chain)(struct Qdisc *, unsigned long); 170 struct tcf_proto __rcu ** (*tcf_chain)(struct Qdisc *, unsigned long);
147 unsigned long (*bind_tcf)(struct Qdisc *, unsigned long, 171 unsigned long (*bind_tcf)(struct Qdisc *, unsigned long,
148 u32 classid); 172 u32 classid);
149 void (*unbind_tcf)(struct Qdisc *, unsigned long); 173 void (*unbind_tcf)(struct Qdisc *, unsigned long);
@@ -212,8 +236,8 @@ struct tcf_proto_ops {
212 236
213struct tcf_proto { 237struct tcf_proto {
214 /* Fast access part */ 238 /* Fast access part */
215 struct tcf_proto *next; 239 struct tcf_proto __rcu *next;
216 void *root; 240 void __rcu *root;
217 int (*classify)(struct sk_buff *, 241 int (*classify)(struct sk_buff *,
218 const struct tcf_proto *, 242 const struct tcf_proto *,
219 struct tcf_result *); 243 struct tcf_result *);
@@ -225,13 +249,15 @@ struct tcf_proto {
225 struct Qdisc *q; 249 struct Qdisc *q;
226 void *data; 250 void *data;
227 const struct tcf_proto_ops *ops; 251 const struct tcf_proto_ops *ops;
252 struct rcu_head rcu;
228}; 253};
229 254
230struct qdisc_skb_cb { 255struct qdisc_skb_cb {
231 unsigned int pkt_len; 256 unsigned int pkt_len;
232 u16 slave_dev_queue_mapping; 257 u16 slave_dev_queue_mapping;
233 u16 _pad; 258 u16 _pad;
234 unsigned char data[24]; 259#define QDISC_CB_PRIV_LEN 20
260 unsigned char data[QDISC_CB_PRIV_LEN];
235}; 261};
236 262
237static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz) 263static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz)
@@ -259,7 +285,9 @@ static inline spinlock_t *qdisc_lock(struct Qdisc *qdisc)
259 285
260static inline struct Qdisc *qdisc_root(const struct Qdisc *qdisc) 286static inline struct Qdisc *qdisc_root(const struct Qdisc *qdisc)
261{ 287{
262 return qdisc->dev_queue->qdisc; 288 struct Qdisc *q = rcu_dereference_rtnl(qdisc->dev_queue->qdisc);
289
290 return q;
263} 291}
264 292
265static inline struct Qdisc *qdisc_root_sleeping(const struct Qdisc *qdisc) 293static inline struct Qdisc *qdisc_root_sleeping(const struct Qdisc *qdisc)
@@ -376,7 +404,7 @@ struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
376void __qdisc_calculate_pkt_len(struct sk_buff *skb, 404void __qdisc_calculate_pkt_len(struct sk_buff *skb,
377 const struct qdisc_size_table *stab); 405 const struct qdisc_size_table *stab);
378void tcf_destroy(struct tcf_proto *tp); 406void tcf_destroy(struct tcf_proto *tp);
379void tcf_destroy_chain(struct tcf_proto **fl); 407void tcf_destroy_chain(struct tcf_proto __rcu **fl);
380 408
381/* Reset all TX qdiscs greater then index of a device. */ 409/* Reset all TX qdiscs greater then index of a device. */
382static inline void qdisc_reset_all_tx_gt(struct net_device *dev, unsigned int i) 410static inline void qdisc_reset_all_tx_gt(struct net_device *dev, unsigned int i)
@@ -384,7 +412,7 @@ static inline void qdisc_reset_all_tx_gt(struct net_device *dev, unsigned int i)
384 struct Qdisc *qdisc; 412 struct Qdisc *qdisc;
385 413
386 for (; i < dev->num_tx_queues; i++) { 414 for (; i < dev->num_tx_queues; i++) {
387 qdisc = netdev_get_tx_queue(dev, i)->qdisc; 415 qdisc = rtnl_dereference(netdev_get_tx_queue(dev, i)->qdisc);
388 if (qdisc) { 416 if (qdisc) {
389 spin_lock_bh(qdisc_lock(qdisc)); 417 spin_lock_bh(qdisc_lock(qdisc));
390 qdisc_reset(qdisc); 418 qdisc_reset(qdisc);
@@ -402,13 +430,18 @@ static inline void qdisc_reset_all_tx(struct net_device *dev)
402static inline bool qdisc_all_tx_empty(const struct net_device *dev) 430static inline bool qdisc_all_tx_empty(const struct net_device *dev)
403{ 431{
404 unsigned int i; 432 unsigned int i;
433
434 rcu_read_lock();
405 for (i = 0; i < dev->num_tx_queues; i++) { 435 for (i = 0; i < dev->num_tx_queues; i++) {
406 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 436 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
407 const struct Qdisc *q = txq->qdisc; 437 const struct Qdisc *q = rcu_dereference(txq->qdisc);
408 438
409 if (q->q.qlen) 439 if (q->q.qlen) {
440 rcu_read_unlock();
410 return false; 441 return false;
442 }
411 } 443 }
444 rcu_read_unlock();
412 return true; 445 return true;
413} 446}
414 447
@@ -416,9 +449,10 @@ static inline bool qdisc_all_tx_empty(const struct net_device *dev)
416static inline bool qdisc_tx_changing(const struct net_device *dev) 449static inline bool qdisc_tx_changing(const struct net_device *dev)
417{ 450{
418 unsigned int i; 451 unsigned int i;
452
419 for (i = 0; i < dev->num_tx_queues; i++) { 453 for (i = 0; i < dev->num_tx_queues; i++) {
420 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 454 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
421 if (txq->qdisc != txq->qdisc_sleeping) 455 if (rcu_access_pointer(txq->qdisc) != txq->qdisc_sleeping)
422 return true; 456 return true;
423 } 457 }
424 return false; 458 return false;
@@ -428,9 +462,10 @@ static inline bool qdisc_tx_changing(const struct net_device *dev)
428static inline bool qdisc_tx_is_noop(const struct net_device *dev) 462static inline bool qdisc_tx_is_noop(const struct net_device *dev)
429{ 463{
430 unsigned int i; 464 unsigned int i;
465
431 for (i = 0; i < dev->num_tx_queues; i++) { 466 for (i = 0; i < dev->num_tx_queues; i++) {
432 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 467 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
433 if (txq->qdisc != &noop_qdisc) 468 if (rcu_access_pointer(txq->qdisc) != &noop_qdisc)
434 return false; 469 return false;
435 } 470 }
436 return true; 471 return true;
@@ -476,6 +511,10 @@ static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch)
476 return qdisc_enqueue(skb, sch) & NET_XMIT_MASK; 511 return qdisc_enqueue(skb, sch) & NET_XMIT_MASK;
477} 512}
478 513
514static inline bool qdisc_is_percpu_stats(const struct Qdisc *q)
515{
516 return q->flags & TCQ_F_CPUSTATS;
517}
479 518
480static inline void bstats_update(struct gnet_stats_basic_packed *bstats, 519static inline void bstats_update(struct gnet_stats_basic_packed *bstats,
481 const struct sk_buff *skb) 520 const struct sk_buff *skb)
@@ -484,17 +523,62 @@ static inline void bstats_update(struct gnet_stats_basic_packed *bstats,
484 bstats->packets += skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1; 523 bstats->packets += skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
485} 524}
486 525
526static inline void qdisc_bstats_update_cpu(struct Qdisc *sch,
527 const struct sk_buff *skb)
528{
529 struct gnet_stats_basic_cpu *bstats =
530 this_cpu_ptr(sch->cpu_bstats);
531
532 u64_stats_update_begin(&bstats->syncp);
533 bstats_update(&bstats->bstats, skb);
534 u64_stats_update_end(&bstats->syncp);
535}
536
487static inline void qdisc_bstats_update(struct Qdisc *sch, 537static inline void qdisc_bstats_update(struct Qdisc *sch,
488 const struct sk_buff *skb) 538 const struct sk_buff *skb)
489{ 539{
490 bstats_update(&sch->bstats, skb); 540 bstats_update(&sch->bstats, skb);
491} 541}
492 542
543static inline void qdisc_qstats_backlog_dec(struct Qdisc *sch,
544 const struct sk_buff *skb)
545{
546 sch->qstats.backlog -= qdisc_pkt_len(skb);
547}
548
549static inline void qdisc_qstats_backlog_inc(struct Qdisc *sch,
550 const struct sk_buff *skb)
551{
552 sch->qstats.backlog += qdisc_pkt_len(skb);
553}
554
555static inline void __qdisc_qstats_drop(struct Qdisc *sch, int count)
556{
557 sch->qstats.drops += count;
558}
559
560static inline void qdisc_qstats_drop(struct Qdisc *sch)
561{
562 sch->qstats.drops++;
563}
564
565static inline void qdisc_qstats_drop_cpu(struct Qdisc *sch)
566{
567 struct gnet_stats_queue *qstats = this_cpu_ptr(sch->cpu_qstats);
568
569 qstats->drops++;
570}
571
572static inline void qdisc_qstats_overlimit(struct Qdisc *sch)
573{
574 sch->qstats.overlimits++;
575}
576
493static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, 577static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
494 struct sk_buff_head *list) 578 struct sk_buff_head *list)
495{ 579{
496 __skb_queue_tail(list, skb); 580 __skb_queue_tail(list, skb);
497 sch->qstats.backlog += qdisc_pkt_len(skb); 581 qdisc_qstats_backlog_inc(sch, skb);
498 582
499 return NET_XMIT_SUCCESS; 583 return NET_XMIT_SUCCESS;
500} 584}
@@ -510,7 +594,7 @@ static inline struct sk_buff *__qdisc_dequeue_head(struct Qdisc *sch,
510 struct sk_buff *skb = __skb_dequeue(list); 594 struct sk_buff *skb = __skb_dequeue(list);
511 595
512 if (likely(skb != NULL)) { 596 if (likely(skb != NULL)) {
513 sch->qstats.backlog -= qdisc_pkt_len(skb); 597 qdisc_qstats_backlog_dec(sch, skb);
514 qdisc_bstats_update(sch, skb); 598 qdisc_bstats_update(sch, skb);
515 } 599 }
516 600
@@ -529,7 +613,7 @@ static inline unsigned int __qdisc_queue_drop_head(struct Qdisc *sch,
529 613
530 if (likely(skb != NULL)) { 614 if (likely(skb != NULL)) {
531 unsigned int len = qdisc_pkt_len(skb); 615 unsigned int len = qdisc_pkt_len(skb);
532 sch->qstats.backlog -= len; 616 qdisc_qstats_backlog_dec(sch, skb);
533 kfree_skb(skb); 617 kfree_skb(skb);
534 return len; 618 return len;
535 } 619 }
@@ -548,7 +632,7 @@ static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch,
548 struct sk_buff *skb = __skb_dequeue_tail(list); 632 struct sk_buff *skb = __skb_dequeue_tail(list);
549 633
550 if (likely(skb != NULL)) 634 if (likely(skb != NULL))
551 sch->qstats.backlog -= qdisc_pkt_len(skb); 635 qdisc_qstats_backlog_dec(sch, skb);
552 636
553 return skb; 637 return skb;
554} 638}
@@ -630,14 +714,14 @@ static inline unsigned int qdisc_queue_drop(struct Qdisc *sch)
630static inline int qdisc_drop(struct sk_buff *skb, struct Qdisc *sch) 714static inline int qdisc_drop(struct sk_buff *skb, struct Qdisc *sch)
631{ 715{
632 kfree_skb(skb); 716 kfree_skb(skb);
633 sch->qstats.drops++; 717 qdisc_qstats_drop(sch);
634 718
635 return NET_XMIT_DROP; 719 return NET_XMIT_DROP;
636} 720}
637 721
638static inline int qdisc_reshape_fail(struct sk_buff *skb, struct Qdisc *sch) 722static inline int qdisc_reshape_fail(struct sk_buff *skb, struct Qdisc *sch)
639{ 723{
640 sch->qstats.drops++; 724 qdisc_qstats_drop(sch);
641 725
642#ifdef CONFIG_NET_CLS_ACT 726#ifdef CONFIG_NET_CLS_ACT
643 if (sch->reshape_fail == NULL || sch->reshape_fail(skb, sch)) 727 if (sch->reshape_fail == NULL || sch->reshape_fail(skb, sch))
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index f22538e68245..d4a20d00461c 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -115,7 +115,7 @@ typedef enum {
115 * analysis of the state functions, but in reality just taken from 115 * analysis of the state functions, but in reality just taken from
116 * thin air in the hopes othat we don't trigger a kernel panic. 116 * thin air in the hopes othat we don't trigger a kernel panic.
117 */ 117 */
118#define SCTP_MAX_NUM_COMMANDS 14 118#define SCTP_MAX_NUM_COMMANDS 20
119 119
120typedef union { 120typedef union {
121 void *zero_all; /* Set to NULL to clear the entire union */ 121 void *zero_all; /* Set to NULL to clear the entire union */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index f6e7397e799d..856f01cb51dd 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -320,6 +320,19 @@ static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc)
320 return asoc ? asoc->assoc_id : 0; 320 return asoc ? asoc->assoc_id : 0;
321} 321}
322 322
323static inline enum sctp_sstat_state
324sctp_assoc_to_state(const struct sctp_association *asoc)
325{
326 /* SCTP's uapi always had SCTP_EMPTY(=0) as a dummy state, but we
327 * got rid of it in kernel space. Therefore SCTP_CLOSED et al
328 * start at =1 in user space, but actually as =0 in kernel space.
329 * Now that we can not break user space and SCTP_EMPTY is exposed
330 * there, we need to fix it up with an ugly offset not to break
331 * applications. :(
332 */
333 return asoc->state + 1;
334}
335
323/* Look up the association by its id. */ 336/* Look up the association by its id. */
324struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); 337struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
325 338
@@ -413,6 +426,11 @@ static inline void sctp_assoc_pending_pmtu(struct sock *sk, struct sctp_associat
413 asoc->pmtu_pending = 0; 426 asoc->pmtu_pending = 0;
414} 427}
415 428
429static inline bool sctp_chunk_pending(const struct sctp_chunk *chunk)
430{
431 return !list_empty(&chunk->list);
432}
433
416/* Walk through a list of TLV parameters. Don't trust the 434/* Walk through a list of TLV parameters. Don't trust the
417 * individual parameter lengths and instead depend on 435 * individual parameter lengths and instead depend on
418 * the chunk length to indicate when to stop. Make sure 436 * the chunk length to indicate when to stop. Make sure
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 7f4eeb340a54..72a31db47ded 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -248,9 +248,9 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *,
248 int, __be16); 248 int, __be16);
249struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc, 249struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc,
250 union sctp_addr *addr); 250 union sctp_addr *addr);
251int sctp_verify_asconf(const struct sctp_association *asoc, 251bool sctp_verify_asconf(const struct sctp_association *asoc,
252 struct sctp_paramhdr *param_hdr, void *chunk_end, 252 struct sctp_chunk *chunk, bool addr_param_needed,
253 struct sctp_paramhdr **errp); 253 struct sctp_paramhdr **errp);
254struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, 254struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
255 struct sctp_chunk *asconf); 255 struct sctp_chunk *asconf);
256int sctp_process_asconf_ack(struct sctp_association *asoc, 256int sctp_process_asconf_ack(struct sctp_association *asoc,
diff --git a/include/net/snmp.h b/include/net/snmp.h
index f1f27fdbb0d5..35512ac6dcfb 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -146,19 +146,15 @@ struct linux_xfrm_mib {
146 146
147#define SNMP_ADD_STATS(mib, field, addend) \ 147#define SNMP_ADD_STATS(mib, field, addend) \
148 this_cpu_add(mib->mibs[field], addend) 148 this_cpu_add(mib->mibs[field], addend)
149/*
150 * Use "__typeof__(*mib) *ptr" instead of "__typeof__(mib) ptr"
151 * to make @ptr a non-percpu pointer.
152 */
153#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ 149#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
154 do { \ 150 do { \
155 __typeof__(*mib->mibs) *ptr = mib->mibs; \ 151 __typeof__((mib->mibs) + 0) ptr = mib->mibs; \
156 this_cpu_inc(ptr[basefield##PKTS]); \ 152 this_cpu_inc(ptr[basefield##PKTS]); \
157 this_cpu_add(ptr[basefield##OCTETS], addend); \ 153 this_cpu_add(ptr[basefield##OCTETS], addend); \
158 } while (0) 154 } while (0)
159#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 155#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
160 do { \ 156 do { \
161 __typeof__(*mib->mibs) *ptr = mib->mibs; \ 157 __typeof__((mib->mibs) + 0) ptr = mib->mibs; \
162 __this_cpu_inc(ptr[basefield##PKTS]); \ 158 __this_cpu_inc(ptr[basefield##PKTS]); \
163 __this_cpu_add(ptr[basefield##OCTETS], addend); \ 159 __this_cpu_add(ptr[basefield##OCTETS], addend); \
164 } while (0) 160 } while (0)
@@ -168,7 +164,7 @@ struct linux_xfrm_mib {
168 164
169#define SNMP_ADD_STATS64_BH(mib, field, addend) \ 165#define SNMP_ADD_STATS64_BH(mib, field, addend) \
170 do { \ 166 do { \
171 __typeof__(*mib) *ptr = __this_cpu_ptr(mib); \ 167 __typeof__(*mib) *ptr = raw_cpu_ptr(mib); \
172 u64_stats_update_begin(&ptr->syncp); \ 168 u64_stats_update_begin(&ptr->syncp); \
173 ptr->mibs[field] += addend; \ 169 ptr->mibs[field] += addend; \
174 u64_stats_update_end(&ptr->syncp); \ 170 u64_stats_update_end(&ptr->syncp); \
@@ -189,8 +185,8 @@ struct linux_xfrm_mib {
189#define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1) 185#define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1)
190#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \ 186#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \
191 do { \ 187 do { \
192 __typeof__(*mib) *ptr; \ 188 __typeof__(*mib) *ptr; \
193 ptr = __this_cpu_ptr(mib); \ 189 ptr = raw_cpu_ptr((mib)); \
194 u64_stats_update_begin(&ptr->syncp); \ 190 u64_stats_update_begin(&ptr->syncp); \
195 ptr->mibs[basefield##PKTS]++; \ 191 ptr->mibs[basefield##PKTS]++; \
196 ptr->mibs[basefield##OCTETS] += addend; \ 192 ptr->mibs[basefield##OCTETS] += addend; \
diff --git a/include/net/sock.h b/include/net/sock.h
index 52fe0bc5598a..7db3db112baa 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -233,7 +233,6 @@ struct cg_proto;
233 * @sk_receive_queue: incoming packets 233 * @sk_receive_queue: incoming packets
234 * @sk_wmem_alloc: transmit queue bytes committed 234 * @sk_wmem_alloc: transmit queue bytes committed
235 * @sk_write_queue: Packet sending queue 235 * @sk_write_queue: Packet sending queue
236 * @sk_async_wait_queue: DMA copied packets
237 * @sk_omem_alloc: "o" is "option" or "other" 236 * @sk_omem_alloc: "o" is "option" or "other"
238 * @sk_wmem_queued: persistent queue size 237 * @sk_wmem_queued: persistent queue size
239 * @sk_forward_alloc: space allocated forward 238 * @sk_forward_alloc: space allocated forward
@@ -362,10 +361,6 @@ struct sock {
362 struct sk_filter __rcu *sk_filter; 361 struct sk_filter __rcu *sk_filter;
363 struct socket_wq __rcu *sk_wq; 362 struct socket_wq __rcu *sk_wq;
364 363
365#ifdef CONFIG_NET_DMA
366 struct sk_buff_head sk_async_wait_queue;
367#endif
368
369#ifdef CONFIG_XFRM 364#ifdef CONFIG_XFRM
370 struct xfrm_policy *sk_policy[2]; 365 struct xfrm_policy *sk_policy[2];
371#endif 366#endif
@@ -987,7 +982,6 @@ struct proto {
987 struct sk_buff *skb); 982 struct sk_buff *skb);
988 983
989 void (*release_cb)(struct sock *sk); 984 void (*release_cb)(struct sock *sk);
990 void (*mtu_reduced)(struct sock *sk);
991 985
992 /* Keeping track of sk's, looking them up, and port selection methods. */ 986 /* Keeping track of sk's, looking them up, and port selection methods. */
993 void (*hash)(struct sock *sk); 987 void (*hash)(struct sock *sk);
@@ -1575,7 +1569,12 @@ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
1575void sock_wfree(struct sk_buff *skb); 1569void sock_wfree(struct sk_buff *skb);
1576void skb_orphan_partial(struct sk_buff *skb); 1570void skb_orphan_partial(struct sk_buff *skb);
1577void sock_rfree(struct sk_buff *skb); 1571void sock_rfree(struct sk_buff *skb);
1572void sock_efree(struct sk_buff *skb);
1573#ifdef CONFIG_INET
1578void sock_edemux(struct sk_buff *skb); 1574void sock_edemux(struct sk_buff *skb);
1575#else
1576#define sock_edemux(skb) sock_efree(skb)
1577#endif
1579 1578
1580int sock_setsockopt(struct socket *sock, int level, int op, 1579int sock_setsockopt(struct socket *sock, int level, int op,
1581 char __user *optval, unsigned int optlen); 1580 char __user *optval, unsigned int optlen);
@@ -2042,6 +2041,7 @@ void sk_stop_timer(struct sock *sk, struct timer_list *timer);
2042int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); 2041int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
2043 2042
2044int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb); 2043int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb);
2044struct sk_buff *sock_dequeue_err_skb(struct sock *sk);
2045 2045
2046/* 2046/*
2047 * Recover an error report and clear atomically 2047 * Recover an error report and clear atomically
@@ -2166,9 +2166,7 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
2166 */ 2166 */
2167 if (sock_flag(sk, SOCK_RCVTSTAMP) || 2167 if (sock_flag(sk, SOCK_RCVTSTAMP) ||
2168 (sk->sk_tsflags & SOF_TIMESTAMPING_RX_SOFTWARE) || 2168 (sk->sk_tsflags & SOF_TIMESTAMPING_RX_SOFTWARE) ||
2169 (kt.tv64 && 2169 (kt.tv64 && sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE) ||
2170 (sk->sk_tsflags & SOF_TIMESTAMPING_SOFTWARE ||
2171 skb_shinfo(skb)->tx_flags & SKBTX_ANY_SW_TSTAMP)) ||
2172 (hwtstamps->hwtstamp.tv64 && 2170 (hwtstamps->hwtstamp.tv64 &&
2173 (sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE))) 2171 (sk->sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE)))
2174 __sock_recv_timestamp(msg, sk, skb); 2172 __sock_recv_timestamp(msg, sk, skb);
@@ -2196,38 +2194,36 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2196 sk->sk_stamp = skb->tstamp; 2194 sk->sk_stamp = skb->tstamp;
2197} 2195}
2198 2196
2197void __sock_tx_timestamp(const struct sock *sk, __u8 *tx_flags);
2198
2199/** 2199/**
2200 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped 2200 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
2201 * @sk: socket sending this packet 2201 * @sk: socket sending this packet
2202 * @tx_flags: filled with instructions for time stamping 2202 * @tx_flags: completed with instructions for time stamping
2203 *
2204 * Note : callers should take care of initial *tx_flags value (usually 0)
2203 */ 2205 */
2204void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); 2206static inline void sock_tx_timestamp(const struct sock *sk, __u8 *tx_flags)
2207{
2208 if (unlikely(sk->sk_tsflags))
2209 __sock_tx_timestamp(sk, tx_flags);
2210 if (unlikely(sock_flag(sk, SOCK_WIFI_STATUS)))
2211 *tx_flags |= SKBTX_WIFI_STATUS;
2212}
2205 2213
2206/** 2214/**
2207 * sk_eat_skb - Release a skb if it is no longer needed 2215 * sk_eat_skb - Release a skb if it is no longer needed
2208 * @sk: socket to eat this skb from 2216 * @sk: socket to eat this skb from
2209 * @skb: socket buffer to eat 2217 * @skb: socket buffer to eat
2210 * @copied_early: flag indicating whether DMA operations copied this data early
2211 * 2218 *
2212 * This routine must be called with interrupts disabled or with the socket 2219 * This routine must be called with interrupts disabled or with the socket
2213 * locked so that the sk_buff queue operation is ok. 2220 * locked so that the sk_buff queue operation is ok.
2214*/ 2221*/
2215#ifdef CONFIG_NET_DMA 2222static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb)
2216static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, bool copied_early)
2217{
2218 __skb_unlink(skb, &sk->sk_receive_queue);
2219 if (!copied_early)
2220 __kfree_skb(skb);
2221 else
2222 __skb_queue_tail(&sk->sk_async_wait_queue, skb);
2223}
2224#else
2225static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, bool copied_early)
2226{ 2223{
2227 __skb_unlink(skb, &sk->sk_receive_queue); 2224 __skb_unlink(skb, &sk->sk_receive_queue);
2228 __kfree_skb(skb); 2225 __kfree_skb(skb);
2229} 2226}
2230#endif
2231 2227
2232static inline 2228static inline
2233struct net *sock_net(const struct sock *sk) 2229struct net *sock_net(const struct sock *sk)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index dafa1cbc149b..4062b4f0d121 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -27,7 +27,6 @@
27#include <linux/cache.h> 27#include <linux/cache.h>
28#include <linux/percpu.h> 28#include <linux/percpu.h>
29#include <linux/skbuff.h> 29#include <linux/skbuff.h>
30#include <linux/dmaengine.h>
31#include <linux/crypto.h> 30#include <linux/crypto.h>
32#include <linux/cryptohash.h> 31#include <linux/cryptohash.h>
33#include <linux/kref.h> 32#include <linux/kref.h>
@@ -262,7 +261,6 @@ extern int sysctl_tcp_adv_win_scale;
262extern int sysctl_tcp_tw_reuse; 261extern int sysctl_tcp_tw_reuse;
263extern int sysctl_tcp_frto; 262extern int sysctl_tcp_frto;
264extern int sysctl_tcp_low_latency; 263extern int sysctl_tcp_low_latency;
265extern int sysctl_tcp_dma_copybreak;
266extern int sysctl_tcp_nometrics_save; 264extern int sysctl_tcp_nometrics_save;
267extern int sysctl_tcp_moderate_rcvbuf; 265extern int sysctl_tcp_moderate_rcvbuf;
268extern int sysctl_tcp_tso_win_divisor; 266extern int sysctl_tcp_tso_win_divisor;
@@ -368,7 +366,6 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
368void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, 366void tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
369 const struct tcphdr *th, unsigned int len); 367 const struct tcphdr *th, unsigned int len);
370void tcp_rcv_space_adjust(struct sock *sk); 368void tcp_rcv_space_adjust(struct sock *sk);
371void tcp_cleanup_rbuf(struct sock *sk, int copied);
372int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); 369int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp);
373void tcp_twsk_destructor(struct sock *sk); 370void tcp_twsk_destructor(struct sock *sk);
374ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos, 371ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
@@ -417,7 +414,7 @@ void tcp_update_metrics(struct sock *sk);
417void tcp_init_metrics(struct sock *sk); 414void tcp_init_metrics(struct sock *sk);
418void tcp_metrics_init(void); 415void tcp_metrics_init(void);
419bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, 416bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst,
420 bool paws_check); 417 bool paws_check, bool timestamps);
421bool tcp_remember_stamp(struct sock *sk); 418bool tcp_remember_stamp(struct sock *sk);
422bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw); 419bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw);
423void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst); 420void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst);
@@ -448,6 +445,7 @@ const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
448 */ 445 */
449 446
450void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb); 447void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
448void tcp_v4_mtu_reduced(struct sock *sk);
451int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); 449int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb);
452struct sock *tcp_create_openreq_child(struct sock *sk, 450struct sock *tcp_create_openreq_child(struct sock *sk,
453 struct request_sock *req, 451 struct request_sock *req,
@@ -470,8 +468,7 @@ void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb);
470/* From syncookies.c */ 468/* From syncookies.c */
471int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th, 469int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
472 u32 cookie); 470 u32 cookie);
473struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, 471struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb);
474 struct ip_options *opt);
475#ifdef CONFIG_SYN_COOKIES 472#ifdef CONFIG_SYN_COOKIES
476 473
477/* Syncookies use a monotonic timer which increments every 60 seconds. 474/* Syncookies use a monotonic timer which increments every 60 seconds.
@@ -671,6 +668,12 @@ void tcp_send_window_probe(struct sock *sk);
671 */ 668 */
672#define tcp_time_stamp ((__u32)(jiffies)) 669#define tcp_time_stamp ((__u32)(jiffies))
673 670
671static inline u32 tcp_skb_timestamp(const struct sk_buff *skb)
672{
673 return skb->skb_mstamp.stamp_jiffies;
674}
675
676
674#define tcp_flag_byte(th) (((u_int8_t *)th)[13]) 677#define tcp_flag_byte(th) (((u_int8_t *)th)[13])
675 678
676#define TCPHDR_FIN 0x01 679#define TCPHDR_FIN 0x01
@@ -689,15 +692,18 @@ void tcp_send_window_probe(struct sock *sk);
689 * If this grows please adjust skbuff.h:skbuff->cb[xxx] size appropriately. 692 * If this grows please adjust skbuff.h:skbuff->cb[xxx] size appropriately.
690 */ 693 */
691struct tcp_skb_cb { 694struct tcp_skb_cb {
692 union {
693 struct inet_skb_parm h4;
694#if IS_ENABLED(CONFIG_IPV6)
695 struct inet6_skb_parm h6;
696#endif
697 } header; /* For incoming frames */
698 __u32 seq; /* Starting sequence number */ 695 __u32 seq; /* Starting sequence number */
699 __u32 end_seq; /* SEQ + FIN + SYN + datalen */ 696 __u32 end_seq; /* SEQ + FIN + SYN + datalen */
700 __u32 when; /* used to compute rtt's */ 697 union {
698 /* Note : tcp_tw_isn is used in input path only
699 * (isn chosen by tcp_timewait_state_process())
700 *
701 * tcp_gso_segs is used in write queue only,
702 * cf tcp_skb_pcount()
703 */
704 __u32 tcp_tw_isn;
705 __u32 tcp_gso_segs;
706 };
701 __u8 tcp_flags; /* TCP header flags. (tcp[13]) */ 707 __u8 tcp_flags; /* TCP header flags. (tcp[13]) */
702 708
703 __u8 sacked; /* State flags for SACK/FACK. */ 709 __u8 sacked; /* State flags for SACK/FACK. */
@@ -705,39 +711,51 @@ struct tcp_skb_cb {
705#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */ 711#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */
706#define TCPCB_LOST 0x04 /* SKB is lost */ 712#define TCPCB_LOST 0x04 /* SKB is lost */
707#define TCPCB_TAGBITS 0x07 /* All tag bits */ 713#define TCPCB_TAGBITS 0x07 /* All tag bits */
714#define TCPCB_REPAIRED 0x10 /* SKB repaired (no skb_mstamp) */
708#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */ 715#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */
709#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS) 716#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS| \
717 TCPCB_REPAIRED)
710 718
711 __u8 ip_dsfield; /* IPv4 tos or IPv6 dsfield */ 719 __u8 ip_dsfield; /* IPv4 tos or IPv6 dsfield */
712 /* 1 byte hole */ 720 /* 1 byte hole */
713 __u32 ack_seq; /* Sequence number ACK'd */ 721 __u32 ack_seq; /* Sequence number ACK'd */
722 union {
723 struct inet_skb_parm h4;
724#if IS_ENABLED(CONFIG_IPV6)
725 struct inet6_skb_parm h6;
726#endif
727 } header; /* For incoming frames */
714}; 728};
715 729
716#define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0])) 730#define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0]))
717 731
718/* RFC3168 : 6.1.1 SYN packets must not have ECT/ECN bits set 732
719 * 733#if IS_ENABLED(CONFIG_IPV6)
720 * If we receive a SYN packet with these bits set, it means a network is 734/* This is the variant of inet6_iif() that must be used by TCP,
721 * playing bad games with TOS bits. In order to avoid possible false congestion 735 * as TCP moves IP6CB into a different location in skb->cb[]
722 * notifications, we disable TCP ECN negociation.
723 */ 736 */
724static inline void 737static inline int tcp_v6_iif(const struct sk_buff *skb)
725TCP_ECN_create_request(struct request_sock *req, const struct sk_buff *skb,
726 struct net *net)
727{ 738{
728 const struct tcphdr *th = tcp_hdr(skb); 739 return TCP_SKB_CB(skb)->header.h6.iif;
729
730 if (net->ipv4.sysctl_tcp_ecn && th->ece && th->cwr &&
731 INET_ECN_is_not_ect(TCP_SKB_CB(skb)->ip_dsfield))
732 inet_rsk(req)->ecn_ok = 1;
733} 740}
741#endif
734 742
735/* Due to TSO, an SKB can be composed of multiple actual 743/* Due to TSO, an SKB can be composed of multiple actual
736 * packets. To keep these tracked properly, we use this. 744 * packets. To keep these tracked properly, we use this.
737 */ 745 */
738static inline int tcp_skb_pcount(const struct sk_buff *skb) 746static inline int tcp_skb_pcount(const struct sk_buff *skb)
739{ 747{
740 return skb_shinfo(skb)->gso_segs; 748 return TCP_SKB_CB(skb)->tcp_gso_segs;
749}
750
751static inline void tcp_skb_pcount_set(struct sk_buff *skb, int segs)
752{
753 TCP_SKB_CB(skb)->tcp_gso_segs = segs;
754}
755
756static inline void tcp_skb_pcount_add(struct sk_buff *skb, int segs)
757{
758 TCP_SKB_CB(skb)->tcp_gso_segs += segs;
741} 759}
742 760
743/* This is valid iff tcp_skb_pcount() > 1. */ 761/* This is valid iff tcp_skb_pcount() > 1. */
@@ -752,8 +770,17 @@ enum tcp_ca_event {
752 CA_EVENT_CWND_RESTART, /* congestion window restart */ 770 CA_EVENT_CWND_RESTART, /* congestion window restart */
753 CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */ 771 CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */
754 CA_EVENT_LOSS, /* loss timeout */ 772 CA_EVENT_LOSS, /* loss timeout */
755 CA_EVENT_FAST_ACK, /* in sequence ack */ 773 CA_EVENT_ECN_NO_CE, /* ECT set, but not CE marked */
756 CA_EVENT_SLOW_ACK, /* other ack */ 774 CA_EVENT_ECN_IS_CE, /* received CE marked IP packet */
775 CA_EVENT_DELAYED_ACK, /* Delayed ack is sent */
776 CA_EVENT_NON_DELAYED_ACK,
777};
778
779/* Information about inbound ACK, passed to cong_ops->in_ack_event() */
780enum tcp_ca_ack_event_flags {
781 CA_ACK_SLOWPATH = (1 << 0), /* In slow path processing */
782 CA_ACK_WIN_UPDATE = (1 << 1), /* ACK updated window */
783 CA_ACK_ECE = (1 << 2), /* ECE bit is set on ack */
757}; 784};
758 785
759/* 786/*
@@ -763,7 +790,10 @@ enum tcp_ca_event {
763#define TCP_CA_MAX 128 790#define TCP_CA_MAX 128
764#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX) 791#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX)
765 792
793/* Algorithm can be set on socket without CAP_NET_ADMIN privileges */
766#define TCP_CONG_NON_RESTRICTED 0x1 794#define TCP_CONG_NON_RESTRICTED 0x1
795/* Requires ECN/ECT set on all packets */
796#define TCP_CONG_NEEDS_ECN 0x2
767 797
768struct tcp_congestion_ops { 798struct tcp_congestion_ops {
769 struct list_head list; 799 struct list_head list;
@@ -782,6 +812,8 @@ struct tcp_congestion_ops {
782 void (*set_state)(struct sock *sk, u8 new_state); 812 void (*set_state)(struct sock *sk, u8 new_state);
783 /* call when cwnd event occurs (optional) */ 813 /* call when cwnd event occurs (optional) */
784 void (*cwnd_event)(struct sock *sk, enum tcp_ca_event ev); 814 void (*cwnd_event)(struct sock *sk, enum tcp_ca_event ev);
815 /* call when ack arrives (optional) */
816 void (*in_ack_event)(struct sock *sk, u32 flags);
785 /* new value of cwnd after loss (optional) */ 817 /* new value of cwnd after loss (optional) */
786 u32 (*undo_cwnd)(struct sock *sk); 818 u32 (*undo_cwnd)(struct sock *sk);
787 /* hook for packet ack accounting (optional) */ 819 /* hook for packet ack accounting (optional) */
@@ -796,6 +828,7 @@ struct tcp_congestion_ops {
796int tcp_register_congestion_control(struct tcp_congestion_ops *type); 828int tcp_register_congestion_control(struct tcp_congestion_ops *type);
797void tcp_unregister_congestion_control(struct tcp_congestion_ops *type); 829void tcp_unregister_congestion_control(struct tcp_congestion_ops *type);
798 830
831void tcp_assign_congestion_control(struct sock *sk);
799void tcp_init_congestion_control(struct sock *sk); 832void tcp_init_congestion_control(struct sock *sk);
800void tcp_cleanup_congestion_control(struct sock *sk); 833void tcp_cleanup_congestion_control(struct sock *sk);
801int tcp_set_default_congestion_control(const char *name); 834int tcp_set_default_congestion_control(const char *name);
@@ -804,14 +837,20 @@ void tcp_get_available_congestion_control(char *buf, size_t len);
804void tcp_get_allowed_congestion_control(char *buf, size_t len); 837void tcp_get_allowed_congestion_control(char *buf, size_t len);
805int tcp_set_allowed_congestion_control(char *allowed); 838int tcp_set_allowed_congestion_control(char *allowed);
806int tcp_set_congestion_control(struct sock *sk, const char *name); 839int tcp_set_congestion_control(struct sock *sk, const char *name);
807int tcp_slow_start(struct tcp_sock *tp, u32 acked); 840void tcp_slow_start(struct tcp_sock *tp, u32 acked);
808void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w); 841void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w);
809 842
810extern struct tcp_congestion_ops tcp_init_congestion_ops;
811u32 tcp_reno_ssthresh(struct sock *sk); 843u32 tcp_reno_ssthresh(struct sock *sk);
812void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked); 844void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked);
813extern struct tcp_congestion_ops tcp_reno; 845extern struct tcp_congestion_ops tcp_reno;
814 846
847static inline bool tcp_ca_needs_ecn(const struct sock *sk)
848{
849 const struct inet_connection_sock *icsk = inet_csk(sk);
850
851 return icsk->icsk_ca_ops->flags & TCP_CONG_NEEDS_ECN;
852}
853
815static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) 854static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
816{ 855{
817 struct inet_connection_sock *icsk = inet_csk(sk); 856 struct inet_connection_sock *icsk = inet_csk(sk);
@@ -1028,12 +1067,6 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp)
1028 tp->ucopy.len = 0; 1067 tp->ucopy.len = 0;
1029 tp->ucopy.memory = 0; 1068 tp->ucopy.memory = 0;
1030 skb_queue_head_init(&tp->ucopy.prequeue); 1069 skb_queue_head_init(&tp->ucopy.prequeue);
1031#ifdef CONFIG_NET_DMA
1032 tp->ucopy.dma_chan = NULL;
1033 tp->ucopy.wakeup = 0;
1034 tp->ucopy.pinned_list = NULL;
1035 tp->ucopy.dma_cookie = 0;
1036#endif
1037} 1070}
1038 1071
1039bool tcp_prequeue(struct sock *sk, struct sk_buff *skb); 1072bool tcp_prequeue(struct sock *sk, struct sk_buff *skb);
@@ -1643,4 +1676,24 @@ int tcpv4_offload_init(void);
1643void tcp_v4_init(void); 1676void tcp_v4_init(void);
1644void tcp_init(void); 1677void tcp_init(void);
1645 1678
1679/*
1680 * Save and compile IPv4 options, return a pointer to it
1681 */
1682static inline struct ip_options_rcu *tcp_v4_save_options(struct sk_buff *skb)
1683{
1684 const struct ip_options *opt = &TCP_SKB_CB(skb)->header.h4.opt;
1685 struct ip_options_rcu *dopt = NULL;
1686
1687 if (opt->optlen) {
1688 int opt_size = sizeof(*dopt) + opt->optlen;
1689
1690 dopt = kmalloc(opt_size, GFP_ATOMIC);
1691 if (dopt && __ip_options_echo(&dopt->opt, skb, opt)) {
1692 kfree(dopt);
1693 dopt = NULL;
1694 }
1695 }
1696 return dopt;
1697}
1698
1646#endif /* _TCP_H */ 1699#endif /* _TCP_H */
diff --git a/include/net/udp.h b/include/net/udp.h
index 70f941368ace..07f9b70962f6 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -158,6 +158,24 @@ static inline __sum16 udp_v4_check(int len, __be32 saddr,
158void udp_set_csum(bool nocheck, struct sk_buff *skb, 158void udp_set_csum(bool nocheck, struct sk_buff *skb,
159 __be32 saddr, __be32 daddr, int len); 159 __be32 saddr, __be32 daddr, int len);
160 160
161struct sk_buff **udp_gro_receive(struct sk_buff **head, struct sk_buff *skb,
162 struct udphdr *uh);
163int udp_gro_complete(struct sk_buff *skb, int nhoff);
164
165static inline struct udphdr *udp_gro_udphdr(struct sk_buff *skb)
166{
167 struct udphdr *uh;
168 unsigned int hlen, off;
169
170 off = skb_gro_offset(skb);
171 hlen = off + sizeof(*uh);
172 uh = skb_gro_header_fast(skb, off);
173 if (skb_gro_header_hard(skb, hlen))
174 uh = skb_gro_header_slow(skb, hlen, off);
175
176 return uh;
177}
178
161/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ 179/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */
162static inline void udp_lib_hash(struct sock *sk) 180static inline void udp_lib_hash(struct sock *sk)
163{ 181{
@@ -221,7 +239,8 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
221int udp_disconnect(struct sock *sk, int flags); 239int udp_disconnect(struct sock *sk, int flags);
222unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait); 240unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait);
223struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb, 241struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
224 netdev_features_t features); 242 netdev_features_t features,
243 bool is_ipv6);
225int udp_lib_getsockopt(struct sock *sk, int level, int optname, 244int udp_lib_getsockopt(struct sock *sk, int level, int optname,
226 char __user *optval, int __user *optlen); 245 char __user *optval, int __user *optlen);
227int udp_lib_setsockopt(struct sock *sk, int level, int optname, 246int udp_lib_setsockopt(struct sock *sk, int level, int optname,
diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h
index ffd69cbded35..2a50a70ef587 100644
--- a/include/net/udp_tunnel.h
+++ b/include/net/udp_tunnel.h
@@ -1,6 +1,14 @@
1#ifndef __NET_UDP_TUNNEL_H 1#ifndef __NET_UDP_TUNNEL_H
2#define __NET_UDP_TUNNEL_H 2#define __NET_UDP_TUNNEL_H
3 3
4#include <net/ip_tunnels.h>
5#include <net/udp.h>
6
7#if IS_ENABLED(CONFIG_IPV6)
8#include <net/ipv6.h>
9#include <net/addrconf.h>
10#endif
11
4struct udp_port_cfg { 12struct udp_port_cfg {
5 u8 family; 13 u8 family;
6 14
@@ -26,7 +34,89 @@ struct udp_port_cfg {
26 use_udp6_rx_checksums:1; 34 use_udp6_rx_checksums:1;
27}; 35};
28 36
29int udp_sock_create(struct net *net, struct udp_port_cfg *cfg, 37int udp_sock_create4(struct net *net, struct udp_port_cfg *cfg,
30 struct socket **sockp); 38 struct socket **sockp);
39
40#if IS_ENABLED(CONFIG_IPV6)
41int udp_sock_create6(struct net *net, struct udp_port_cfg *cfg,
42 struct socket **sockp);
43#else
44static inline int udp_sock_create6(struct net *net, struct udp_port_cfg *cfg,
45 struct socket **sockp)
46{
47 return 0;
48}
49#endif
50
51static inline int udp_sock_create(struct net *net,
52 struct udp_port_cfg *cfg,
53 struct socket **sockp)
54{
55 if (cfg->family == AF_INET)
56 return udp_sock_create4(net, cfg, sockp);
57
58 if (cfg->family == AF_INET6)
59 return udp_sock_create6(net, cfg, sockp);
60
61 return -EPFNOSUPPORT;
62}
63
64typedef int (*udp_tunnel_encap_rcv_t)(struct sock *sk, struct sk_buff *skb);
65typedef void (*udp_tunnel_encap_destroy_t)(struct sock *sk);
66
67struct udp_tunnel_sock_cfg {
68 void *sk_user_data; /* user data used by encap_rcv call back */
69 /* Used for setting up udp_sock fields, see udp.h for details */
70 __u8 encap_type;
71 udp_tunnel_encap_rcv_t encap_rcv;
72 udp_tunnel_encap_destroy_t encap_destroy;
73};
74
75/* Setup the given (UDP) sock to receive UDP encapsulated packets */
76void setup_udp_tunnel_sock(struct net *net, struct socket *sock,
77 struct udp_tunnel_sock_cfg *sock_cfg);
78
79/* Transmit the skb using UDP encapsulation. */
80int udp_tunnel_xmit_skb(struct socket *sock, struct rtable *rt,
81 struct sk_buff *skb, __be32 src, __be32 dst,
82 __u8 tos, __u8 ttl, __be16 df, __be16 src_port,
83 __be16 dst_port, bool xnet);
84
85#if IS_ENABLED(CONFIG_IPV6)
86int udp_tunnel6_xmit_skb(struct socket *sock, struct dst_entry *dst,
87 struct sk_buff *skb, struct net_device *dev,
88 struct in6_addr *saddr, struct in6_addr *daddr,
89 __u8 prio, __u8 ttl, __be16 src_port,
90 __be16 dst_port);
91#endif
92
93void udp_tunnel_sock_release(struct socket *sock);
94
95static inline struct sk_buff *udp_tunnel_handle_offloads(struct sk_buff *skb,
96 bool udp_csum)
97{
98 int type = udp_csum ? SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
99
100 return iptunnel_handle_offloads(skb, udp_csum, type);
101}
102
103static inline void udp_tunnel_gro_complete(struct sk_buff *skb, int nhoff)
104{
105 struct udphdr *uh;
106
107 uh = (struct udphdr *)(skb->data + nhoff - sizeof(struct udphdr));
108 skb_shinfo(skb)->gso_type |= uh->check ?
109 SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
110}
111
112static inline void udp_tunnel_encap_enable(struct socket *sock)
113{
114#if IS_ENABLED(CONFIG_IPV6)
115 if (sock->sk->sk_family == PF_INET6)
116 ipv6_stub->udpv6_encap_enable();
117 else
118#endif
119 udp_encap_enable();
120}
31 121
32#endif 122#endif
diff --git a/include/net/wimax.h b/include/net/wimax.h
index e52ef5357e08..c52b68577cb0 100644
--- a/include/net/wimax.h
+++ b/include/net/wimax.h
@@ -290,7 +290,7 @@ struct wimax_dev;
290 * This operation has to be synchronous, and return only when the 290 * This operation has to be synchronous, and return only when the
291 * reset is complete. In case of having had to resort to bus/cold 291 * reset is complete. In case of having had to resort to bus/cold
292 * reset implying a device disconnection, the call is allowed to 292 * reset implying a device disconnection, the call is allowed to
293 * return inmediately. 293 * return immediately.
294 * NOTE: wimax_dev->mutex is NOT locked when this op is being 294 * NOTE: wimax_dev->mutex is NOT locked when this op is being
295 * called; however, wimax_dev->mutex_reset IS locked to ensure 295 * called; however, wimax_dev->mutex_reset IS locked to ensure
296 * serialization of calls to wimax_reset(). 296 * serialization of calls to wimax_reset().
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 721e9c3b11bd..dc4865e90fe4 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1591,6 +1591,7 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark,
1591struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir, 1591struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir,
1592 u32 id, int delete, int *err); 1592 u32 id, int delete, int *err);
1593int xfrm_policy_flush(struct net *net, u8 type, bool task_valid); 1593int xfrm_policy_flush(struct net *net, u8 type, bool task_valid);
1594void xfrm_policy_hash_rebuild(struct net *net);
1594u32 xfrm_get_acqseq(void); 1595u32 xfrm_get_acqseq(void);
1595int verify_spi_info(u8 proto, u32 min, u32 max); 1596int verify_spi_info(u8 proto, u32 min, u32 max);
1596int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 1597int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h
index 47da53c27ffa..79abb9c71772 100644
--- a/include/ras/ras_event.h
+++ b/include/ras/ras_event.h
@@ -8,6 +8,7 @@
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9#include <linux/edac.h> 9#include <linux/edac.h>
10#include <linux/ktime.h> 10#include <linux/ktime.h>
11#include <linux/pci.h>
11#include <linux/aer.h> 12#include <linux/aer.h>
12#include <linux/cper.h> 13#include <linux/cper.h>
13 14
@@ -173,25 +174,34 @@ TRACE_EVENT(mc_event,
173 * u8 severity - error severity 0:NONFATAL 1:FATAL 2:CORRECTED 174 * u8 severity - error severity 0:NONFATAL 1:FATAL 2:CORRECTED
174 */ 175 */
175 176
176#define aer_correctable_errors \ 177#define aer_correctable_errors \
177 {BIT(0), "Receiver Error"}, \ 178 {PCI_ERR_COR_RCVR, "Receiver Error"}, \
178 {BIT(6), "Bad TLP"}, \ 179 {PCI_ERR_COR_BAD_TLP, "Bad TLP"}, \
179 {BIT(7), "Bad DLLP"}, \ 180 {PCI_ERR_COR_BAD_DLLP, "Bad DLLP"}, \
180 {BIT(8), "RELAY_NUM Rollover"}, \ 181 {PCI_ERR_COR_REP_ROLL, "RELAY_NUM Rollover"}, \
181 {BIT(12), "Replay Timer Timeout"}, \ 182 {PCI_ERR_COR_REP_TIMER, "Replay Timer Timeout"}, \
182 {BIT(13), "Advisory Non-Fatal"} 183 {PCI_ERR_COR_ADV_NFAT, "Advisory Non-Fatal Error"}, \
183 184 {PCI_ERR_COR_INTERNAL, "Corrected Internal Error"}, \
184#define aer_uncorrectable_errors \ 185 {PCI_ERR_COR_LOG_OVER, "Header Log Overflow"}
185 {BIT(4), "Data Link Protocol"}, \ 186
186 {BIT(12), "Poisoned TLP"}, \ 187#define aer_uncorrectable_errors \
187 {BIT(13), "Flow Control Protocol"}, \ 188 {PCI_ERR_UNC_UND, "Undefined"}, \
188 {BIT(14), "Completion Timeout"}, \ 189 {PCI_ERR_UNC_DLP, "Data Link Protocol Error"}, \
189 {BIT(15), "Completer Abort"}, \ 190 {PCI_ERR_UNC_SURPDN, "Surprise Down Error"}, \
190 {BIT(16), "Unexpected Completion"}, \ 191 {PCI_ERR_UNC_POISON_TLP,"Poisoned TLP"}, \
191 {BIT(17), "Receiver Overflow"}, \ 192 {PCI_ERR_UNC_FCP, "Flow Control Protocol Error"}, \
192 {BIT(18), "Malformed TLP"}, \ 193 {PCI_ERR_UNC_COMP_TIME, "Completion Timeout"}, \
193 {BIT(19), "ECRC"}, \ 194 {PCI_ERR_UNC_COMP_ABORT,"Completer Abort"}, \
194 {BIT(20), "Unsupported Request"} 195 {PCI_ERR_UNC_UNX_COMP, "Unexpected Completion"}, \
196 {PCI_ERR_UNC_RX_OVER, "Receiver Overflow"}, \
197 {PCI_ERR_UNC_MALF_TLP, "Malformed TLP"}, \
198 {PCI_ERR_UNC_ECRC, "ECRC Error"}, \
199 {PCI_ERR_UNC_UNSUP, "Unsupported Request Error"}, \
200 {PCI_ERR_UNC_ACSV, "ACS Violation"}, \
201 {PCI_ERR_UNC_INTN, "Uncorrectable Internal Error"},\
202 {PCI_ERR_UNC_MCBTLP, "MC Blocked TLP"}, \
203 {PCI_ERR_UNC_ATOMEG, "AtomicOp Egress Blocked"}, \
204 {PCI_ERR_UNC_TLPPRE, "TLP Prefix Blocked Error"}
195 205
196TRACE_EVENT(aer_event, 206TRACE_EVENT(aer_event,
197 TP_PROTO(const char *dev_name, 207 TP_PROTO(const char *dev_name,
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
index 3d81b90cc315..9bb99e983f58 100644
--- a/include/rdma/ib_mad.h
+++ b/include/rdma/ib_mad.h
@@ -40,6 +40,7 @@
40#include <linux/list.h> 40#include <linux/list.h>
41 41
42#include <rdma/ib_verbs.h> 42#include <rdma/ib_verbs.h>
43#include <uapi/rdma/ib_user_mad.h>
43 44
44/* Management base version */ 45/* Management base version */
45#define IB_MGMT_BASE_VERSION 1 46#define IB_MGMT_BASE_VERSION 1
@@ -355,9 +356,13 @@ typedef void (*ib_mad_recv_handler)(struct ib_mad_agent *mad_agent,
355 * @hi_tid: Access layer assigned transaction ID for this client. 356 * @hi_tid: Access layer assigned transaction ID for this client.
356 * Unsolicited MADs sent by this client will have the upper 32-bits 357 * Unsolicited MADs sent by this client will have the upper 32-bits
357 * of their TID set to this value. 358 * of their TID set to this value.
359 * @flags: registration flags
358 * @port_num: Port number on which QP is registered 360 * @port_num: Port number on which QP is registered
359 * @rmpp_version: If set, indicates the RMPP version used by this agent. 361 * @rmpp_version: If set, indicates the RMPP version used by this agent.
360 */ 362 */
363enum {
364 IB_MAD_USER_RMPP = IB_USER_MAD_USER_RMPP,
365};
361struct ib_mad_agent { 366struct ib_mad_agent {
362 struct ib_device *device; 367 struct ib_device *device;
363 struct ib_qp *qp; 368 struct ib_qp *qp;
@@ -367,6 +372,7 @@ struct ib_mad_agent {
367 ib_mad_snoop_handler snoop_handler; 372 ib_mad_snoop_handler snoop_handler;
368 void *context; 373 void *context;
369 u32 hi_tid; 374 u32 hi_tid;
375 u32 flags;
370 u8 port_num; 376 u8 port_num;
371 u8 rmpp_version; 377 u8 rmpp_version;
372}; 378};
@@ -426,6 +432,7 @@ struct ib_mad_recv_wc {
426 * in the range from 0x30 to 0x4f. Otherwise not used. 432 * in the range from 0x30 to 0x4f. Otherwise not used.
427 * @method_mask: The caller will receive unsolicited MADs for any method 433 * @method_mask: The caller will receive unsolicited MADs for any method
428 * where @method_mask = 1. 434 * where @method_mask = 1.
435 *
429 */ 436 */
430struct ib_mad_reg_req { 437struct ib_mad_reg_req {
431 u8 mgmt_class; 438 u8 mgmt_class;
@@ -451,6 +458,7 @@ struct ib_mad_reg_req {
451 * @recv_handler: The completion callback routine invoked for a received 458 * @recv_handler: The completion callback routine invoked for a received
452 * MAD. 459 * MAD.
453 * @context: User specified context associated with the registration. 460 * @context: User specified context associated with the registration.
461 * @registration_flags: Registration flags to set for this agent
454 */ 462 */
455struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, 463struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
456 u8 port_num, 464 u8 port_num,
@@ -459,7 +467,8 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
459 u8 rmpp_version, 467 u8 rmpp_version,
460 ib_mad_send_handler send_handler, 468 ib_mad_send_handler send_handler,
461 ib_mad_recv_handler recv_handler, 469 ib_mad_recv_handler recv_handler,
462 void *context); 470 void *context,
471 u32 registration_flags);
463 472
464enum ib_mad_snoop_flags { 473enum ib_mad_snoop_flags {
465 /*IB_MAD_SNOOP_POSTED_SENDS = 1,*/ 474 /*IB_MAD_SNOOP_POSTED_SENDS = 1,*/
@@ -661,4 +670,11 @@ void *ib_get_rmpp_segment(struct ib_mad_send_buf *send_buf, int seg_num);
661 */ 670 */
662void ib_free_send_mad(struct ib_mad_send_buf *send_buf); 671void ib_free_send_mad(struct ib_mad_send_buf *send_buf);
663 672
673/**
674 * ib_mad_kernel_rmpp_agent - Returns if the agent is performing RMPP.
675 * @agent: the agent in question
676 * @return: true if agent is performing rmpp, false otherwise.
677 */
678int ib_mad_kernel_rmpp_agent(struct ib_mad_agent *agent);
679
664#endif /* IB_MAD_H */ 680#endif /* IB_MAD_H */
diff --git a/include/rdma/ib_umem.h b/include/rdma/ib_umem.h
index 1ea0b65c4cfb..a2bf41e0bde9 100644
--- a/include/rdma/ib_umem.h
+++ b/include/rdma/ib_umem.h
@@ -47,6 +47,7 @@ struct ib_umem {
47 int writable; 47 int writable;
48 int hugetlb; 48 int hugetlb;
49 struct work_struct work; 49 struct work_struct work;
50 struct pid *pid;
50 struct mm_struct *mm; 51 struct mm_struct *mm;
51 unsigned long diff; 52 unsigned long diff;
52 struct sg_table sg_head; 53 struct sg_table sg_head;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 7ccef342f724..470a011d6fa4 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -491,20 +491,14 @@ struct ib_mr_init_attr {
491 u32 flags; 491 u32 flags;
492}; 492};
493 493
494enum ib_signature_type {
495 IB_SIG_TYPE_T10_DIF,
496};
497
498/** 494/**
499 * T10-DIF Signature types 495 * Signature types
500 * T10-DIF types are defined by SCSI 496 * IB_SIG_TYPE_NONE: Unprotected.
501 * specifications. 497 * IB_SIG_TYPE_T10_DIF: Type T10-DIF
502 */ 498 */
503enum ib_t10_dif_type { 499enum ib_signature_type {
504 IB_T10DIF_NONE, 500 IB_SIG_TYPE_NONE,
505 IB_T10DIF_TYPE1, 501 IB_SIG_TYPE_T10_DIF,
506 IB_T10DIF_TYPE2,
507 IB_T10DIF_TYPE3
508}; 502};
509 503
510/** 504/**
@@ -520,24 +514,26 @@ enum ib_t10_dif_bg_type {
520/** 514/**
521 * struct ib_t10_dif_domain - Parameters specific for T10-DIF 515 * struct ib_t10_dif_domain - Parameters specific for T10-DIF
522 * domain. 516 * domain.
523 * @type: T10-DIF type (0|1|2|3)
524 * @bg_type: T10-DIF block guard type (CRC|CSUM) 517 * @bg_type: T10-DIF block guard type (CRC|CSUM)
525 * @pi_interval: protection information interval. 518 * @pi_interval: protection information interval.
526 * @bg: seed of guard computation. 519 * @bg: seed of guard computation.
527 * @app_tag: application tag of guard block 520 * @app_tag: application tag of guard block
528 * @ref_tag: initial guard block reference tag. 521 * @ref_tag: initial guard block reference tag.
529 * @type3_inc_reftag: T10-DIF type 3 does not state 522 * @ref_remap: Indicate wethear the reftag increments each block
530 * about the reference tag, it is the user 523 * @app_escape: Indicate to skip block check if apptag=0xffff
531 * choice to increment it or not. 524 * @ref_escape: Indicate to skip block check if reftag=0xffffffff
525 * @apptag_check_mask: check bitmask of application tag.
532 */ 526 */
533struct ib_t10_dif_domain { 527struct ib_t10_dif_domain {
534 enum ib_t10_dif_type type;
535 enum ib_t10_dif_bg_type bg_type; 528 enum ib_t10_dif_bg_type bg_type;
536 u16 pi_interval; 529 u16 pi_interval;
537 u16 bg; 530 u16 bg;
538 u16 app_tag; 531 u16 app_tag;
539 u32 ref_tag; 532 u32 ref_tag;
540 bool type3_inc_reftag; 533 bool ref_remap;
534 bool app_escape;
535 bool ref_escape;
536 u16 apptag_check_mask;
541}; 537};
542 538
543/** 539/**
@@ -1097,7 +1093,8 @@ struct ib_mr_attr {
1097enum ib_mr_rereg_flags { 1093enum ib_mr_rereg_flags {
1098 IB_MR_REREG_TRANS = 1, 1094 IB_MR_REREG_TRANS = 1,
1099 IB_MR_REREG_PD = (1<<1), 1095 IB_MR_REREG_PD = (1<<1),
1100 IB_MR_REREG_ACCESS = (1<<2) 1096 IB_MR_REREG_ACCESS = (1<<2),
1097 IB_MR_REREG_SUPPORTED = ((IB_MR_REREG_ACCESS << 1) - 1)
1101}; 1098};
1102 1099
1103/** 1100/**
@@ -1547,6 +1544,13 @@ struct ib_device {
1547 u64 virt_addr, 1544 u64 virt_addr,
1548 int mr_access_flags, 1545 int mr_access_flags,
1549 struct ib_udata *udata); 1546 struct ib_udata *udata);
1547 int (*rereg_user_mr)(struct ib_mr *mr,
1548 int flags,
1549 u64 start, u64 length,
1550 u64 virt_addr,
1551 int mr_access_flags,
1552 struct ib_pd *pd,
1553 struct ib_udata *udata);
1550 int (*query_mr)(struct ib_mr *mr, 1554 int (*query_mr)(struct ib_mr *mr,
1551 struct ib_mr_attr *mr_attr); 1555 struct ib_mr_attr *mr_attr);
1552 int (*dereg_mr)(struct ib_mr *mr); 1556 int (*dereg_mr)(struct ib_mr *mr);
diff --git a/include/rxrpc/types.h b/include/rxrpc/types.h
deleted file mode 100644
index 30d48f6da228..000000000000
--- a/include/rxrpc/types.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/* types.h: Rx types
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
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 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_TYPES_H
13#define _LINUX_RXRPC_TYPES_H
14
15#include <linux/types.h>
16#include <linux/list.h>
17#include <linux/socket.h>
18#include <linux/in.h>
19#include <linux/spinlock.h>
20#include <linux/atomic.h>
21
22typedef uint32_t rxrpc_seq_t; /* Rx message sequence number */
23typedef uint32_t rxrpc_serial_t; /* Rx message serial number */
24typedef __be32 rxrpc_seq_net_t; /* on-the-wire Rx message sequence number */
25typedef __be32 rxrpc_serial_net_t; /* on-the-wire Rx message serial number */
26
27struct rxrpc_call;
28struct rxrpc_connection;
29struct rxrpc_header;
30struct rxrpc_message;
31struct rxrpc_operation;
32struct rxrpc_peer;
33struct rxrpc_service;
34typedef struct rxrpc_timer rxrpc_timer_t;
35struct rxrpc_transport;
36
37typedef void (*rxrpc_call_attn_func_t)(struct rxrpc_call *call);
38typedef void (*rxrpc_call_error_func_t)(struct rxrpc_call *call);
39typedef void (*rxrpc_call_aemap_func_t)(struct rxrpc_call *call);
40
41#endif /* _LINUX_RXRPC_TYPES_H */
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index fd0421c6d40a..95ed9424a11a 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -527,6 +527,7 @@ enum iscsi_err {
527 ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19, 527 ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19,
528 ISCSI_ERR_TCP_CONN_CLOSE = ISCSI_ERR_BASE + 20, 528 ISCSI_ERR_TCP_CONN_CLOSE = ISCSI_ERR_BASE + 20,
529 ISCSI_ERR_SCSI_EH_SESSION_RST = ISCSI_ERR_BASE + 21, 529 ISCSI_ERR_SCSI_EH_SESSION_RST = ISCSI_ERR_BASE + 21,
530 ISCSI_ERR_NOP_TIMEDOUT = ISCSI_ERR_BASE + 22,
530}; 531};
531 532
532/* 533/*
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
index b2e85fdd2ae0..a09cca829082 100644
--- a/include/scsi/osd_initiator.h
+++ b/include/scsi/osd_initiator.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2008 Panasas Inc. All rights reserved. 4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 * 5 *
6 * Authors: 6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com> 7 * Boaz Harrosh <ooo@electrozaur.com>
8 * Benny Halevy <bhalevy@panasas.com> 8 * Benny Halevy <bhalevy@panasas.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
diff --git a/include/scsi/osd_ore.h b/include/scsi/osd_ore.h
index 6ca3265a4dca..7a8d2cd30328 100644
--- a/include/scsi/osd_ore.h
+++ b/include/scsi/osd_ore.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2011 2 * Copyright (C) 2011
3 * Boaz Harrosh <bharrosh@panasas.com> 3 * Boaz Harrosh <ooo@electrozaur.com>
4 * 4 *
5 * Public Declarations of the ORE API 5 * Public Declarations of the ORE API
6 * 6 *
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
index a2594afe05c7..e0ca835e7bf7 100644
--- a/include/scsi/osd_protocol.h
+++ b/include/scsi/osd_protocol.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2008 Panasas Inc. All rights reserved. 4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 * 5 *
6 * Authors: 6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com> 7 * Boaz Harrosh <ooo@electrozaur.com>
8 * Benny Halevy <bhalevy@panasas.com> 8 * Benny Halevy <bhalevy@panasas.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
@@ -496,7 +496,7 @@ struct osd_timestamp {
496 */ 496 */
497 497
498struct osd_key_identifier { 498struct osd_key_identifier {
499 u8 id[7]; /* if you know why 7 please email bharrosh@panasas.com */ 499 u8 id[7]; /* if you know why 7 please email ooo@electrozaur.com */
500} __packed; 500} __packed;
501 501
502/* for osd_capability.format */ 502/* for osd_capability.format */
diff --git a/include/scsi/osd_sec.h b/include/scsi/osd_sec.h
index f96151c9c9e8..7abeb0f0db30 100644
--- a/include/scsi/osd_sec.h
+++ b/include/scsi/osd_sec.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2008 Panasas Inc. All rights reserved. 4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 * 5 *
6 * Authors: 6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com> 7 * Boaz Harrosh <ooo@electrozaur.com>
8 * Benny Halevy <bhalevy@panasas.com> 8 * Benny Halevy <bhalevy@panasas.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
diff --git a/include/scsi/osd_sense.h b/include/scsi/osd_sense.h
index 91db543a5502..d52aa93a0b2d 100644
--- a/include/scsi/osd_sense.h
+++ b/include/scsi/osd_sense.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2008 Panasas Inc. All rights reserved. 4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 * 5 *
6 * Authors: 6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com> 7 * Boaz Harrosh <ooo@electrozaur.com>
8 * Benny Halevy <bhalevy@panasas.com> 8 * Benny Halevy <bhalevy@panasas.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
diff --git a/include/scsi/osd_types.h b/include/scsi/osd_types.h
index bd0be7ed4bcf..48e8a165e136 100644
--- a/include/scsi/osd_types.h
+++ b/include/scsi/osd_types.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2008 Panasas Inc. All rights reserved. 4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 * 5 *
6 * Authors: 6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com> 7 * Boaz Harrosh <ooo@electrozaur.com>
8 * Benny Halevy <bhalevy@panasas.com> 8 * Benny Halevy <bhalevy@panasas.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index e6df23cae7be..d17178e6fcdd 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -31,7 +31,7 @@ enum scsi_timeouts {
31 * Like SCSI_MAX_SG_SEGMENTS, but for archs that have sg chaining. This limit 31 * Like SCSI_MAX_SG_SEGMENTS, but for archs that have sg chaining. This limit
32 * is totally arbitrary, a setting of 2048 will get you at least 8mb ios. 32 * is totally arbitrary, a setting of 2048 will get you at least 8mb ios.
33 */ 33 */
34#ifdef ARCH_HAS_SG_CHAIN 34#ifdef CONFIG_ARCH_HAS_SG_CHAIN
35#define SCSI_MAX_SG_CHAIN_SEGMENTS 2048 35#define SCSI_MAX_SG_CHAIN_SEGMENTS 2048
36#else 36#else
37#define SCSI_MAX_SG_CHAIN_SEGMENTS SCSI_MAX_SG_SEGMENTS 37#define SCSI_MAX_SG_CHAIN_SEGMENTS SCSI_MAX_SG_SEGMENTS
@@ -333,6 +333,7 @@ static inline int scsi_status_is_good(int status)
333#define TYPE_RBC 0x0e 333#define TYPE_RBC 0x0e
334#define TYPE_OSD 0x11 334#define TYPE_OSD 0x11
335#define TYPE_ZBC 0x14 335#define TYPE_ZBC 0x14
336#define TYPE_WLUN 0x1e /* well-known logical unit */
336#define TYPE_NO_LUN 0x7f 337#define TYPE_NO_LUN 0x7f
337 338
338/* SCSI protocols; these are taken from SPC-3 section 7.5 */ 339/* SCSI protocols; these are taken from SPC-3 section 7.5 */
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 73f349044941..522a5f27f553 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -10,9 +10,10 @@
10#include <scsi/scsi_device.h> 10#include <scsi/scsi_device.h>
11 11
12struct Scsi_Host; 12struct Scsi_Host;
13struct scsi_device;
14struct scsi_driver; 13struct scsi_driver;
15 14
15#include <scsi/scsi_device.h>
16
16/* 17/*
17 * MAX_COMMAND_SIZE is: 18 * MAX_COMMAND_SIZE is:
18 * The longest fixed-length SCSI CDB as per the SCSI standard. 19 * The longest fixed-length SCSI CDB as per the SCSI standard.
@@ -81,6 +82,7 @@ struct scsi_cmnd {
81 82
82 unsigned char prot_op; 83 unsigned char prot_op;
83 unsigned char prot_type; 84 unsigned char prot_type;
85 unsigned char prot_flags;
84 86
85 unsigned short cmd_len; 87 unsigned short cmd_len;
86 enum dma_data_direction sc_data_direction; 88 enum dma_data_direction sc_data_direction;
@@ -252,6 +254,14 @@ static inline unsigned char scsi_get_prot_op(struct scsi_cmnd *scmd)
252 return scmd->prot_op; 254 return scmd->prot_op;
253} 255}
254 256
257enum scsi_prot_flags {
258 SCSI_PROT_TRANSFER_PI = 1 << 0,
259 SCSI_PROT_GUARD_CHECK = 1 << 1,
260 SCSI_PROT_REF_CHECK = 1 << 2,
261 SCSI_PROT_REF_INCREMENT = 1 << 3,
262 SCSI_PROT_IP_CHECKSUM = 1 << 4,
263};
264
255/* 265/*
256 * The controller usually does not know anything about the target it 266 * The controller usually does not know anything about the target it
257 * is communicating with. However, when DIX is enabled the controller 267 * is communicating with. However, when DIX is enabled the controller
@@ -280,6 +290,17 @@ static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd)
280 return blk_rq_pos(scmd->request); 290 return blk_rq_pos(scmd->request);
281} 291}
282 292
293static inline unsigned int scsi_prot_interval(struct scsi_cmnd *scmd)
294{
295 return scmd->device->sector_size;
296}
297
298static inline u32 scsi_prot_ref_tag(struct scsi_cmnd *scmd)
299{
300 return blk_rq_pos(scmd->request) >>
301 (ilog2(scsi_prot_interval(scmd)) - 9) & 0xffffffff;
302}
303
283static inline unsigned scsi_prot_sg_count(struct scsi_cmnd *cmd) 304static inline unsigned scsi_prot_sg_count(struct scsi_cmnd *cmd)
284{ 305{
285 return cmd->prot_sdb ? cmd->prot_sdb->table.nents : 0; 306 return cmd->prot_sdb ? cmd->prot_sdb->table.nents : 0;
@@ -316,17 +337,12 @@ static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
316static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd) 337static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd)
317{ 338{
318 unsigned int xfer_len = scsi_out(scmd)->length; 339 unsigned int xfer_len = scsi_out(scmd)->length;
319 unsigned int prot_op = scsi_get_prot_op(scmd); 340 unsigned int prot_interval = scsi_prot_interval(scmd);
320 unsigned int sector_size = scmd->device->sector_size;
321 341
322 switch (prot_op) { 342 if (scmd->prot_flags & SCSI_PROT_TRANSFER_PI)
323 case SCSI_PROT_NORMAL: 343 xfer_len += (xfer_len >> ilog2(prot_interval)) * 8;
324 case SCSI_PROT_WRITE_STRIP:
325 case SCSI_PROT_READ_INSERT:
326 return xfer_len;
327 }
328 344
329 return xfer_len + (xfer_len >> ilog2(sector_size)) * 8; 345 return xfer_len;
330} 346}
331 347
332#endif /* _SCSI_SCSI_CMND_H */ 348#endif /* _SCSI_SCSI_CMND_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 1a0d1842962e..27ecee73bd72 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -174,6 +174,7 @@ struct scsi_device {
174 unsigned wce_default_on:1; /* Cache is ON by default */ 174 unsigned wce_default_on:1; /* Cache is ON by default */
175 unsigned no_dif:1; /* T10 PI (DIF) should be disabled */ 175 unsigned no_dif:1; /* T10 PI (DIF) should be disabled */
176 unsigned broken_fua:1; /* Don't set FUA bit */ 176 unsigned broken_fua:1; /* Don't set FUA bit */
177 unsigned lun_in_cdb:1; /* Store LUN bits in CDB[1] */
177 178
178 atomic_t disk_events_disable_depth; /* disable depth for disk events */ 179 atomic_t disk_events_disable_depth; /* disable depth for disk events */
179 180
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index b286b5787c85..00859c288bee 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -606,7 +606,7 @@ struct Scsi_Host {
606 /* 606 /*
607 * These three parameters can be used to allow for wide scsi, 607 * These three parameters can be used to allow for wide scsi,
608 * and for host adapters that support multiple busses 608 * and for host adapters that support multiple busses
609 * The first two should be set to 1 more than the actual max id 609 * The last two should be set to 1 more than the actual max id
610 * or lun (e.g. 8 for SCSI parallel systems). 610 * or lun (e.g. 8 for SCSI parallel systems).
611 */ 611 */
612 unsigned int max_channel; 612 unsigned int max_channel;
@@ -680,6 +680,7 @@ struct Scsi_Host {
680 unsigned no_write_same:1; 680 unsigned no_write_same:1;
681 681
682 unsigned use_blk_mq:1; 682 unsigned use_blk_mq:1;
683 unsigned use_cmd_list:1;
683 684
684 /* 685 /*
685 * Optional work queue to be utilized by the transport 686 * Optional work queue to be utilized by the transport
@@ -692,6 +693,9 @@ struct Scsi_Host {
692 */ 693 */
693 struct workqueue_struct *tmf_work_q; 694 struct workqueue_struct *tmf_work_q;
694 695
696 /* The transport requires the LUN bits NOT to be stored in CDB[1] */
697 unsigned no_scsi2_lun_in_cdb:1;
698
695 /* 699 /*
696 * Value host_blocked counts down from 700 * Value host_blocked counts down from
697 */ 701 */
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index cdcc90b07ecb..56ed843969ca 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -67,8 +67,9 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
67 if (!sdev->tagged_supported) 67 if (!sdev->tagged_supported)
68 return; 68 return;
69 69
70 if (!shost_use_blk_mq(sdev->host) && 70 if (shost_use_blk_mq(sdev->host))
71 blk_queue_tagged(sdev->request_queue)) 71 queue_flag_set_unlocked(QUEUE_FLAG_QUEUED, sdev->request_queue);
72 else if (!blk_queue_tagged(sdev->request_queue))
72 blk_queue_init_tags(sdev->request_queue, depth, 73 blk_queue_init_tags(sdev->request_queue, depth,
73 sdev->host->bqt); 74 sdev->host->bqt);
74 75
@@ -81,8 +82,7 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
81 **/ 82 **/
82static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth) 83static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth)
83{ 84{
84 if (!shost_use_blk_mq(sdev->host) && 85 if (blk_queue_tagged(sdev->request_queue))
85 blk_queue_tagged(sdev->request_queue))
86 blk_queue_free_tags(sdev->request_queue); 86 blk_queue_free_tags(sdev->request_queue);
87 scsi_adjust_queue_depth(sdev, 0, depth); 87 scsi_adjust_queue_depth(sdev, 0, depth);
88} 88}
diff --git a/include/scsi/sg.h b/include/scsi/sg.h
index 9859355a7cf9..750e5db7c6bf 100644
--- a/include/scsi/sg.h
+++ b/include/scsi/sg.h
@@ -86,7 +86,9 @@ typedef struct sg_io_hdr
86#define SG_FLAG_MMAP_IO 4 /* request memory mapped IO */ 86#define SG_FLAG_MMAP_IO 4 /* request memory mapped IO */
87#define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */ 87#define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */
88 /* user space (debug indirect IO) */ 88 /* user space (debug indirect IO) */
89#define SG_FLAG_Q_AT_TAIL 0x10 /* default is Q_AT_HEAD */ 89/* defaults:: for sg driver: Q_AT_HEAD; for block layer: Q_AT_TAIL */
90#define SG_FLAG_Q_AT_TAIL 0x10
91#define SG_FLAG_Q_AT_HEAD 0x20
90 92
91/* following 'info' values are "or"-ed together */ 93/* following 'info' values are "or"-ed together */
92#define SG_INFO_OK_MASK 0x1 94#define SG_INFO_OK_MASK 0x1
diff --git a/include/linux/tegra-ahb.h b/include/soc/tegra/ahb.h
index f1cd075ceee1..504eb6f957e5 100644
--- a/include/linux/tegra-ahb.h
+++ b/include/soc/tegra/ahb.h
@@ -11,9 +11,9 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#ifndef __LINUX_AHB_H__ 14#ifndef __SOC_TEGRA_AHB_H__
15#define __LINUX_AHB_H__ 15#define __SOC_TEGRA_AHB_H__
16 16
17extern int tegra_ahb_enable_smmu(struct device_node *ahb); 17extern int tegra_ahb_enable_smmu(struct device_node *ahb);
18 18
19#endif /* __LINUX_AHB_H__ */ 19#endif /* __SOC_TEGRA_AHB_H__ */
diff --git a/include/soc/tegra/common.h b/include/soc/tegra/common.h
new file mode 100644
index 000000000000..fc13a9a134e9
--- /dev/null
+++ b/include/soc/tegra/common.h
@@ -0,0 +1,14 @@
1/*
2 * Copyright (C) 2014 NVIDIA Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __SOC_TEGRA_COMMON_H__
10#define __SOC_TEGRA_COMMON_H__
11
12bool soc_is_tegra(void);
13
14#endif /* __SOC_TEGRA_COMMON_H__ */
diff --git a/include/linux/tegra-cpuidle.h b/include/soc/tegra/cpuidle.h
index 9c6286bbf662..ea04f4225638 100644
--- a/include/linux/tegra-cpuidle.h
+++ b/include/soc/tegra/cpuidle.h
@@ -11,8 +11,8 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#ifndef __LINUX_TEGRA_CPUIDLE_H__ 14#ifndef __SOC_TEGRA_CPUIDLE_H__
15#define __LINUX_TEGRA_CPUIDLE_H__ 15#define __SOC_TEGRA_CPUIDLE_H__
16 16
17#ifdef CONFIG_CPU_IDLE 17#ifdef CONFIG_CPU_IDLE
18void tegra_cpuidle_pcie_irqs_in_use(void); 18void tegra_cpuidle_pcie_irqs_in_use(void);
@@ -22,4 +22,4 @@ static inline void tegra_cpuidle_pcie_irqs_in_use(void)
22} 22}
23#endif 23#endif
24 24
25#endif 25#endif /* __SOC_TEGRA_CPUIDLE_H__ */
diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h
new file mode 100644
index 000000000000..8e1249474e84
--- /dev/null
+++ b/include/soc/tegra/fuse.h
@@ -0,0 +1,65 @@
1/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
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 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __SOC_TEGRA_FUSE_H__
18#define __SOC_TEGRA_FUSE_H__
19
20#define TEGRA20 0x20
21#define TEGRA30 0x30
22#define TEGRA114 0x35
23#define TEGRA124 0x40
24
25#define TEGRA_FUSE_SKU_CALIB_0 0xf0
26#define TEGRA30_FUSE_SATA_CALIB 0x124
27
28#ifndef __ASSEMBLY__
29
30u32 tegra_read_chipid(void);
31u8 tegra_get_chip_id(void);
32
33enum tegra_revision {
34 TEGRA_REVISION_UNKNOWN = 0,
35 TEGRA_REVISION_A01,
36 TEGRA_REVISION_A02,
37 TEGRA_REVISION_A03,
38 TEGRA_REVISION_A03p,
39 TEGRA_REVISION_A04,
40 TEGRA_REVISION_MAX,
41};
42
43struct tegra_sku_info {
44 int sku_id;
45 int cpu_process_id;
46 int cpu_speedo_id;
47 int cpu_speedo_value;
48 int cpu_iddq_value;
49 int core_process_id;
50 int soc_speedo_id;
51 int gpu_speedo_id;
52 int gpu_process_id;
53 int gpu_speedo_value;
54 enum tegra_revision revision;
55};
56
57u32 tegra_read_straps(void);
58u32 tegra_read_chipid(void);
59int tegra_fuse_readl(unsigned long offset, u32 *value);
60
61extern struct tegra_sku_info tegra_sku_info;
62
63#endif /* __ASSEMBLY__ */
64
65#endif /* __SOC_TEGRA_FUSE_H__ */
diff --git a/include/soc/tegra/pm.h b/include/soc/tegra/pm.h
new file mode 100644
index 000000000000..30fe2078a547
--- /dev/null
+++ b/include/soc/tegra/pm.h
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2014 NVIDIA Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __SOC_TEGRA_PM_H__
10#define __SOC_TEGRA_PM_H__
11
12enum tegra_suspend_mode {
13 TEGRA_SUSPEND_NONE = 0,
14 TEGRA_SUSPEND_LP2, /* CPU voltage off */
15 TEGRA_SUSPEND_LP1, /* CPU voltage off, DRAM self-refresh */
16 TEGRA_SUSPEND_LP0, /* CPU + core voltage off, DRAM self-refresh */
17 TEGRA_MAX_SUSPEND_MODE,
18};
19
20#ifdef CONFIG_PM_SLEEP
21enum tegra_suspend_mode
22tegra_pm_validate_suspend_mode(enum tegra_suspend_mode mode);
23
24/* low-level resume entry point */
25void tegra_resume(void);
26#else
27static inline enum tegra_suspend_mode
28tegra_pm_validate_suspend_mode(enum tegra_suspend_mode mode)
29{
30 return TEGRA_SUSPEND_NONE;
31}
32
33static inline void tegra_resume(void)
34{
35}
36#endif /* CONFIG_PM_SLEEP */
37
38#endif /* __SOC_TEGRA_PM_H__ */
diff --git a/include/linux/tegra-powergate.h b/include/soc/tegra/pmc.h
index 46f0a07812b4..65a93273e72f 100644
--- a/include/linux/tegra-powergate.h
+++ b/include/soc/tegra/pmc.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2010 Google, Inc 2 * Copyright (c) 2010 Google, Inc
3 * Copyright (c) 2014 NVIDIA Corporation
3 * 4 *
4 * Author: 5 * Author:
5 * Colin Cross <ccross@google.com> 6 * Colin Cross <ccross@google.com>
@@ -15,12 +16,34 @@
15 * 16 *
16 */ 17 */
17 18
18#ifndef _MACH_TEGRA_POWERGATE_H_ 19#ifndef __SOC_TEGRA_PMC_H__
19#define _MACH_TEGRA_POWERGATE_H_ 20#define __SOC_TEGRA_PMC_H__
21
22#include <linux/reboot.h>
23
24#include <soc/tegra/pm.h>
20 25
21struct clk; 26struct clk;
22struct reset_control; 27struct reset_control;
23 28
29void tegra_pmc_restart(enum reboot_mode mode, const char *cmd);
30
31#ifdef CONFIG_PM_SLEEP
32enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
33void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
34void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
35#endif /* CONFIG_PM_SLEEP */
36
37#ifdef CONFIG_SMP
38bool tegra_pmc_cpu_is_powered(int cpuid);
39int tegra_pmc_cpu_power_on(int cpuid);
40int tegra_pmc_cpu_remove_clamping(int cpuid);
41#endif /* CONFIG_SMP */
42
43/*
44 * powergate and I/O rail APIs
45 */
46
24#define TEGRA_POWERGATE_CPU 0 47#define TEGRA_POWERGATE_CPU 0
25#define TEGRA_POWERGATE_3D 1 48#define TEGRA_POWERGATE_3D 1
26#define TEGRA_POWERGATE_VENC 2 49#define TEGRA_POWERGATE_VENC 2
@@ -129,6 +152,6 @@ static inline int tegra_io_rail_power_off(int id)
129{ 152{
130 return -ENOSYS; 153 return -ENOSYS;
131} 154}
132#endif 155#endif /* CONFIG_ARCH_TEGRA */
133 156
134#endif /* _MACH_TEGRA_POWERGATE_H_ */ 157#endif /* __SOC_TEGRA_PMC_H__ */
diff --git a/include/sound/atmel-abdac.h b/include/sound/atmel-abdac.h
index edff6a8ba1b5..a8f735d677fa 100644
--- a/include/sound/atmel-abdac.h
+++ b/include/sound/atmel-abdac.h
@@ -10,7 +10,7 @@
10#ifndef __INCLUDE_SOUND_ATMEL_ABDAC_H 10#ifndef __INCLUDE_SOUND_ATMEL_ABDAC_H
11#define __INCLUDE_SOUND_ATMEL_ABDAC_H 11#define __INCLUDE_SOUND_ATMEL_ABDAC_H
12 12
13#include <linux/dw_dmac.h> 13#include <linux/platform_data/dma-dw.h>
14 14
15/** 15/**
16 * struct atmel_abdac_pdata - board specific ABDAC configuration 16 * struct atmel_abdac_pdata - board specific ABDAC configuration
diff --git a/include/sound/atmel-ac97c.h b/include/sound/atmel-ac97c.h
index 00e6c289a936..f2a1cdc37661 100644
--- a/include/sound/atmel-ac97c.h
+++ b/include/sound/atmel-ac97c.h
@@ -10,7 +10,7 @@
10#ifndef __INCLUDE_SOUND_ATMEL_AC97C_H 10#ifndef __INCLUDE_SOUND_ATMEL_AC97C_H
11#define __INCLUDE_SOUND_ATMEL_AC97C_H 11#define __INCLUDE_SOUND_ATMEL_AC97C_H
12 12
13#include <linux/dw_dmac.h> 13#include <linux/platform_data/dma-dw.h>
14 14
15#define AC97C_CAPTURE 0x01 15#define AC97C_CAPTURE 0x01
16#define AC97C_PLAYBACK 0x02 16#define AC97C_PLAYBACK 0x02
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 6f3e10ca0e32..e862497f7556 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -183,6 +183,7 @@ struct snd_pcm_ops {
183#define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B) 183#define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B)
184#define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8) 184#define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8)
185#define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE) 185#define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE)
186#define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE)
186 187
187#ifdef SNDRV_LITTLE_ENDIAN 188#ifdef SNDRV_LITTLE_ENDIAN
188#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE 189#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE
@@ -365,6 +366,7 @@ struct snd_pcm_runtime {
365 366
366struct snd_pcm_group { /* keep linked substreams */ 367struct snd_pcm_group { /* keep linked substreams */
367 spinlock_t lock; 368 spinlock_t lock;
369 struct mutex mutex;
368 struct list_head substreams; 370 struct list_head substreams;
369 int count; 371 int count;
370}; 372};
@@ -460,6 +462,7 @@ struct snd_pcm {
460 void (*private_free) (struct snd_pcm *pcm); 462 void (*private_free) (struct snd_pcm *pcm);
461 struct device *dev; /* actual hw device this belongs to */ 463 struct device *dev; /* actual hw device this belongs to */
462 bool internal; /* pcm is for internal use only */ 464 bool internal; /* pcm is for internal use only */
465 bool nonatomic; /* whole PCM operations are in non-atomic context */
463#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 466#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
464 struct snd_pcm_oss oss; 467 struct snd_pcm_oss oss;
465#endif 468#endif
@@ -492,8 +495,6 @@ int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree);
492 * Native I/O 495 * Native I/O
493 */ 496 */
494 497
495extern rwlock_t snd_pcm_link_rwlock;
496
497int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info); 498int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info);
498int snd_pcm_info_user(struct snd_pcm_substream *substream, 499int snd_pcm_info_user(struct snd_pcm_substream *substream,
499 struct snd_pcm_info __user *info); 500 struct snd_pcm_info __user *info);
@@ -537,41 +538,18 @@ static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream)
537 return substream->group != &substream->self_group; 538 return substream->group != &substream->self_group;
538} 539}
539 540
540static inline void snd_pcm_stream_lock(struct snd_pcm_substream *substream) 541void snd_pcm_stream_lock(struct snd_pcm_substream *substream);
541{ 542void snd_pcm_stream_unlock(struct snd_pcm_substream *substream);
542 read_lock(&snd_pcm_link_rwlock); 543void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream);
543 spin_lock(&substream->self_group.lock); 544void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream);
544} 545unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
545 546#define snd_pcm_stream_lock_irqsave(substream, flags) \
546static inline void snd_pcm_stream_unlock(struct snd_pcm_substream *substream) 547 do { \
547{ 548 typecheck(unsigned long, flags); \
548 spin_unlock(&substream->self_group.lock); 549 flags = _snd_pcm_stream_lock_irqsave(substream); \
549 read_unlock(&snd_pcm_link_rwlock); 550 } while (0)
550} 551void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream,
551 552 unsigned long flags);
552static inline void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream)
553{
554 read_lock_irq(&snd_pcm_link_rwlock);
555 spin_lock(&substream->self_group.lock);
556}
557
558static inline void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream)
559{
560 spin_unlock(&substream->self_group.lock);
561 read_unlock_irq(&snd_pcm_link_rwlock);
562}
563
564#define snd_pcm_stream_lock_irqsave(substream, flags) \
565do { \
566 read_lock_irqsave(&snd_pcm_link_rwlock, (flags)); \
567 spin_lock(&substream->self_group.lock); \
568} while (0)
569
570#define snd_pcm_stream_unlock_irqrestore(substream, flags) \
571do { \
572 spin_unlock(&substream->self_group.lock); \
573 read_unlock_irqrestore(&snd_pcm_link_rwlock, (flags)); \
574} while (0)
575 553
576#define snd_pcm_group_for_each_entry(s, substream) \ 554#define snd_pcm_group_for_each_entry(s, substream) \
577 list_for_each_entry(s, &substream->group->substreams, link_list) 555 list_for_each_entry(s, &substream->group->substreams, link_list)
diff --git a/include/sound/rt5645.h b/include/sound/rt5645.h
index 1de744c242f6..a5352712194b 100644
--- a/include/sound/rt5645.h
+++ b/include/sound/rt5645.h
@@ -20,6 +20,9 @@ struct rt5645_platform_data {
20 /* 0 = IN2N; 1 = GPIO5; 2 = GPIO11 */ 20 /* 0 = IN2N; 1 = GPIO5; 2 = GPIO11 */
21 unsigned int dmic2_data_pin; 21 unsigned int dmic2_data_pin;
22 /* 0 = IN2P; 1 = GPIO6; 2 = GPIO10; 3 = GPIO12 */ 22 /* 0 = IN2P; 1 = GPIO6; 2 = GPIO10; 3 = GPIO12 */
23
24 unsigned int hp_det_gpio;
25 bool gpio_hp_det_active_high;
23}; 26};
24 27
25#endif 28#endif
diff --git a/include/sound/rt5677.h b/include/sound/rt5677.h
index 3da14313bcfc..082670e3a353 100644
--- a/include/sound/rt5677.h
+++ b/include/sound/rt5677.h
@@ -12,10 +12,21 @@
12#ifndef __LINUX_SND_RT5677_H 12#ifndef __LINUX_SND_RT5677_H
13#define __LINUX_SND_RT5677_H 13#define __LINUX_SND_RT5677_H
14 14
15enum rt5677_dmic2_clk {
16 RT5677_DMIC_CLK1 = 0,
17 RT5677_DMIC_CLK2 = 1,
18};
19
20
15struct rt5677_platform_data { 21struct rt5677_platform_data {
16 /* IN1 IN2 can optionally be differential */ 22 /* IN1/IN2/LOUT1/LOUT2/LOUT3 can optionally be differential */
17 bool in1_diff; 23 bool in1_diff;
18 bool in2_diff; 24 bool in2_diff;
25 bool lout1_diff;
26 bool lout2_diff;
27 bool lout3_diff;
28 /* DMIC2 clock source selection */
29 enum rt5677_dmic2_clk dmic2_clk_pin;
19}; 30};
20 31
21#endif 32#endif
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index aac04ff84eea..3a4d7da67b8d 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -432,6 +432,7 @@ int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
432int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, 432int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
433 const char *pin); 433 const char *pin);
434void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card); 434void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card);
435unsigned int dapm_kcontrol_get_value(const struct snd_kcontrol *kcontrol);
435 436
436/* Mostly internal - should not normally be used */ 437/* Mostly internal - should not normally be used */
437void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm); 438void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm);
@@ -587,13 +588,13 @@ struct snd_soc_dapm_context {
587 enum snd_soc_bias_level suspend_bias_level; 588 enum snd_soc_bias_level suspend_bias_level;
588 struct delayed_work delayed_work; 589 struct delayed_work delayed_work;
589 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */ 590 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
590 591 /* Go to BIAS_OFF in suspend if the DAPM context is idle */
592 unsigned int suspend_bias_off:1;
591 void (*seq_notifier)(struct snd_soc_dapm_context *, 593 void (*seq_notifier)(struct snd_soc_dapm_context *,
592 enum snd_soc_dapm_type, int); 594 enum snd_soc_dapm_type, int);
593 595
594 struct device *dev; /* from parent - for debug */ 596 struct device *dev; /* from parent - for debug */
595 struct snd_soc_component *component; /* parent component */ 597 struct snd_soc_component *component; /* parent component */
596 struct snd_soc_codec *codec; /* parent codec */
597 struct snd_soc_card *card; /* parent card */ 598 struct snd_soc_card *card; /* parent card */
598 599
599 /* used during DAPM updates */ 600 /* used during DAPM updates */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index be6ecae247b0..7ba7130037a0 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -277,7 +277,7 @@
277 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE | \ 277 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE | \
278 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ 278 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \
279 .tlv.c = (snd_soc_bytes_tlv_callback), \ 279 .tlv.c = (snd_soc_bytes_tlv_callback), \
280 .info = snd_soc_info_bytes_ext, \ 280 .info = snd_soc_bytes_info_ext, \
281 .private_value = (unsigned long)&(struct soc_bytes_ext) \ 281 .private_value = (unsigned long)&(struct soc_bytes_ext) \
282 {.max = xcount, .get = xhandler_get, .put = xhandler_put, } } 282 {.max = xcount, .get = xhandler_get, .put = xhandler_put, } }
283#define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ 283#define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \
@@ -690,6 +690,17 @@ struct snd_soc_compr_ops {
690struct snd_soc_component_driver { 690struct snd_soc_component_driver {
691 const char *name; 691 const char *name;
692 692
693 /* Default control and setup, added after probe() is run */
694 const struct snd_kcontrol_new *controls;
695 unsigned int num_controls;
696 const struct snd_soc_dapm_widget *dapm_widgets;
697 unsigned int num_dapm_widgets;
698 const struct snd_soc_dapm_route *dapm_routes;
699 unsigned int num_dapm_routes;
700
701 int (*probe)(struct snd_soc_component *);
702 void (*remove)(struct snd_soc_component *);
703
693 /* DT */ 704 /* DT */
694 int (*of_xlate_dai_name)(struct snd_soc_component *component, 705 int (*of_xlate_dai_name)(struct snd_soc_component *component,
695 struct of_phandle_args *args, 706 struct of_phandle_args *args,
@@ -697,6 +708,10 @@ struct snd_soc_component_driver {
697 void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type, 708 void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type,
698 int subseq); 709 int subseq);
699 int (*stream_event)(struct snd_soc_component *, int event); 710 int (*stream_event)(struct snd_soc_component *, int event);
711
712 /* probe ordering - for components with runtime dependencies */
713 int probe_order;
714 int remove_order;
700}; 715};
701 716
702struct snd_soc_component { 717struct snd_soc_component {
@@ -710,6 +725,7 @@ struct snd_soc_component {
710 725
711 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */ 726 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
712 unsigned int registered_as_component:1; 727 unsigned int registered_as_component:1;
728 unsigned int probed:1;
713 729
714 struct list_head list; 730 struct list_head list;
715 731
@@ -728,9 +744,35 @@ struct snd_soc_component {
728 744
729 struct mutex io_mutex; 745 struct mutex io_mutex;
730 746
747#ifdef CONFIG_DEBUG_FS
748 struct dentry *debugfs_root;
749#endif
750
751 /*
752 * DO NOT use any of the fields below in drivers, they are temporary and
753 * are going to be removed again soon. If you use them in driver code the
754 * driver will be marked as BROKEN when these fields are removed.
755 */
756
731 /* Don't use these, use snd_soc_component_get_dapm() */ 757 /* Don't use these, use snd_soc_component_get_dapm() */
732 struct snd_soc_dapm_context dapm; 758 struct snd_soc_dapm_context dapm;
733 struct snd_soc_dapm_context *dapm_ptr; 759 struct snd_soc_dapm_context *dapm_ptr;
760
761 const struct snd_kcontrol_new *controls;
762 unsigned int num_controls;
763 const struct snd_soc_dapm_widget *dapm_widgets;
764 unsigned int num_dapm_widgets;
765 const struct snd_soc_dapm_route *dapm_routes;
766 unsigned int num_dapm_routes;
767 struct snd_soc_codec *codec;
768
769 int (*probe)(struct snd_soc_component *);
770 void (*remove)(struct snd_soc_component *);
771
772#ifdef CONFIG_DEBUG_FS
773 void (*init_debugfs)(struct snd_soc_component *component);
774 const char *debugfs_prefix;
775#endif
734}; 776};
735 777
736/* SoC Audio Codec device */ 778/* SoC Audio Codec device */
@@ -746,11 +788,9 @@ struct snd_soc_codec {
746 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 788 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
747 unsigned int cache_bypass:1; /* Suppress access to the cache */ 789 unsigned int cache_bypass:1; /* Suppress access to the cache */
748 unsigned int suspended:1; /* Codec is in suspend PM state */ 790 unsigned int suspended:1; /* Codec is in suspend PM state */
749 unsigned int probed:1; /* Codec has been probed */
750 unsigned int ac97_registered:1; /* Codec has been AC97 registered */ 791 unsigned int ac97_registered:1; /* Codec has been AC97 registered */
751 unsigned int ac97_created:1; /* Codec has been created by SoC */ 792 unsigned int ac97_created:1; /* Codec has been created by SoC */
752 unsigned int cache_init:1; /* codec cache has been initialized */ 793 unsigned int cache_init:1; /* codec cache has been initialized */
753 u32 cache_only; /* Suppress writes to hardware */
754 u32 cache_sync; /* Cache needs to be synced to hardware */ 794 u32 cache_sync; /* Cache needs to be synced to hardware */
755 795
756 /* codec IO */ 796 /* codec IO */
@@ -766,7 +806,6 @@ struct snd_soc_codec {
766 struct snd_soc_dapm_context dapm; 806 struct snd_soc_dapm_context dapm;
767 807
768#ifdef CONFIG_DEBUG_FS 808#ifdef CONFIG_DEBUG_FS
769 struct dentry *debugfs_codec_root;
770 struct dentry *debugfs_reg; 809 struct dentry *debugfs_reg;
771#endif 810#endif
772}; 811};
@@ -808,15 +847,12 @@ struct snd_soc_codec_driver {
808 int (*set_bias_level)(struct snd_soc_codec *, 847 int (*set_bias_level)(struct snd_soc_codec *,
809 enum snd_soc_bias_level level); 848 enum snd_soc_bias_level level);
810 bool idle_bias_off; 849 bool idle_bias_off;
850 bool suspend_bias_off;
811 851
812 void (*seq_notifier)(struct snd_soc_dapm_context *, 852 void (*seq_notifier)(struct snd_soc_dapm_context *,
813 enum snd_soc_dapm_type, int); 853 enum snd_soc_dapm_type, int);
814 854
815 bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */ 855 bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */
816
817 /* probe ordering - for components with runtime dependencies */
818 int probe_order;
819 int remove_order;
820}; 856};
821 857
822/* SoC platform interface */ 858/* SoC platform interface */
@@ -832,14 +868,6 @@ struct snd_soc_platform_driver {
832 int (*pcm_new)(struct snd_soc_pcm_runtime *); 868 int (*pcm_new)(struct snd_soc_pcm_runtime *);
833 void (*pcm_free)(struct snd_pcm *); 869 void (*pcm_free)(struct snd_pcm *);
834 870
835 /* Default control and setup, added after probe() is run */
836 const struct snd_kcontrol_new *controls;
837 int num_controls;
838 const struct snd_soc_dapm_widget *dapm_widgets;
839 int num_dapm_widgets;
840 const struct snd_soc_dapm_route *dapm_routes;
841 int num_dapm_routes;
842
843 /* 871 /*
844 * For platform caused delay reporting. 872 * For platform caused delay reporting.
845 * Optional. 873 * Optional.
@@ -853,13 +881,6 @@ struct snd_soc_platform_driver {
853 /* platform stream compress ops */ 881 /* platform stream compress ops */
854 const struct snd_compr_ops *compr_ops; 882 const struct snd_compr_ops *compr_ops;
855 883
856 /* probe ordering - for components with runtime dependencies */
857 int probe_order;
858 int remove_order;
859
860 /* platform IO - used for platform DAPM */
861 unsigned int (*read)(struct snd_soc_platform *, unsigned int);
862 int (*write)(struct snd_soc_platform *, unsigned int, unsigned int);
863 int (*bespoke_trigger)(struct snd_pcm_substream *, int); 884 int (*bespoke_trigger)(struct snd_pcm_substream *, int);
864}; 885};
865 886
@@ -874,15 +895,10 @@ struct snd_soc_platform {
874 const struct snd_soc_platform_driver *driver; 895 const struct snd_soc_platform_driver *driver;
875 896
876 unsigned int suspended:1; /* platform is suspended */ 897 unsigned int suspended:1; /* platform is suspended */
877 unsigned int probed:1;
878 898
879 struct list_head list; 899 struct list_head list;
880 900
881 struct snd_soc_component component; 901 struct snd_soc_component component;
882
883#ifdef CONFIG_DEBUG_FS
884 struct dentry *debugfs_platform_root;
885#endif
886}; 902};
887 903
888struct snd_soc_dai_link { 904struct snd_soc_dai_link {
@@ -897,7 +913,7 @@ struct snd_soc_dai_link {
897 * only for codec to codec links, or systems using device tree. 913 * only for codec to codec links, or systems using device tree.
898 */ 914 */
899 const char *cpu_name; 915 const char *cpu_name;
900 const struct device_node *cpu_of_node; 916 struct device_node *cpu_of_node;
901 /* 917 /*
902 * You MAY specify the DAI name of the CPU DAI. If this information is 918 * You MAY specify the DAI name of the CPU DAI. If this information is
903 * omitted, the CPU-side DAI is matched using .cpu_name/.cpu_of_node 919 * omitted, the CPU-side DAI is matched using .cpu_name/.cpu_of_node
@@ -909,7 +925,7 @@ struct snd_soc_dai_link {
909 * DT/OF node, but not both. 925 * DT/OF node, but not both.
910 */ 926 */
911 const char *codec_name; 927 const char *codec_name;
912 const struct device_node *codec_of_node; 928 struct device_node *codec_of_node;
913 /* You MUST specify the DAI name within the codec */ 929 /* You MUST specify the DAI name within the codec */
914 const char *codec_dai_name; 930 const char *codec_dai_name;
915 931
@@ -922,7 +938,7 @@ struct snd_soc_dai_link {
922 * do not need a platform. 938 * do not need a platform.
923 */ 939 */
924 const char *platform_name; 940 const char *platform_name;
925 const struct device_node *platform_of_node; 941 struct device_node *platform_of_node;
926 int be_id; /* optional ID for machine driver BE identification */ 942 int be_id; /* optional ID for machine driver BE identification */
927 943
928 const struct snd_soc_pcm_stream *params; 944 const struct snd_soc_pcm_stream *params;
@@ -994,7 +1010,7 @@ struct snd_soc_aux_dev {
994 const struct device_node *codec_of_node; 1010 const struct device_node *codec_of_node;
995 1011
996 /* codec/machine specific init - e.g. add machine controls */ 1012 /* codec/machine specific init - e.g. add machine controls */
997 int (*init)(struct snd_soc_dapm_context *dapm); 1013 int (*init)(struct snd_soc_component *component);
998}; 1014};
999 1015
1000/* SoC card */ 1016/* SoC card */
@@ -1112,6 +1128,7 @@ struct snd_soc_pcm_runtime {
1112 struct snd_soc_platform *platform; 1128 struct snd_soc_platform *platform;
1113 struct snd_soc_dai *codec_dai; 1129 struct snd_soc_dai *codec_dai;
1114 struct snd_soc_dai *cpu_dai; 1130 struct snd_soc_dai *cpu_dai;
1131 struct snd_soc_component *component; /* Only valid for AUX dev rtds */
1115 1132
1116 struct snd_soc_dai **codec_dais; 1133 struct snd_soc_dai **codec_dais;
1117 unsigned int num_codecs; 1134 unsigned int num_codecs;
@@ -1260,9 +1277,6 @@ void snd_soc_component_async_complete(struct snd_soc_component *component);
1260int snd_soc_component_test_bits(struct snd_soc_component *component, 1277int snd_soc_component_test_bits(struct snd_soc_component *component,
1261 unsigned int reg, unsigned int mask, unsigned int value); 1278 unsigned int reg, unsigned int mask, unsigned int value);
1262 1279
1263int snd_soc_component_init_io(struct snd_soc_component *component,
1264 struct regmap *regmap);
1265
1266/* device driver data */ 1280/* device driver data */
1267 1281
1268static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card, 1282static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
@@ -1276,26 +1290,37 @@ static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card)
1276 return card->drvdata; 1290 return card->drvdata;
1277} 1291}
1278 1292
1293static inline void snd_soc_component_set_drvdata(struct snd_soc_component *c,
1294 void *data)
1295{
1296 dev_set_drvdata(c->dev, data);
1297}
1298
1299static inline void *snd_soc_component_get_drvdata(struct snd_soc_component *c)
1300{
1301 return dev_get_drvdata(c->dev);
1302}
1303
1279static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec, 1304static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
1280 void *data) 1305 void *data)
1281{ 1306{
1282 dev_set_drvdata(codec->dev, data); 1307 snd_soc_component_set_drvdata(&codec->component, data);
1283} 1308}
1284 1309
1285static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec) 1310static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec)
1286{ 1311{
1287 return dev_get_drvdata(codec->dev); 1312 return snd_soc_component_get_drvdata(&codec->component);
1288} 1313}
1289 1314
1290static inline void snd_soc_platform_set_drvdata(struct snd_soc_platform *platform, 1315static inline void snd_soc_platform_set_drvdata(struct snd_soc_platform *platform,
1291 void *data) 1316 void *data)
1292{ 1317{
1293 dev_set_drvdata(platform->dev, data); 1318 snd_soc_component_set_drvdata(&platform->component, data);
1294} 1319}
1295 1320
1296static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platform) 1321static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platform)
1297{ 1322{
1298 return dev_get_drvdata(platform->dev); 1323 return snd_soc_component_get_drvdata(&platform->component);
1299} 1324}
1300 1325
1301static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd, 1326static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd,
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h
index f634f8f85db5..cae9c9d4ef22 100644
--- a/include/sound/vx_core.h
+++ b/include/sound/vx_core.h
@@ -80,8 +80,6 @@ struct vx_pipe {
80 80
81 unsigned int references; /* an output pipe may be used for monitoring and/or playback */ 81 unsigned int references; /* an output pipe may be used for monitoring and/or playback */
82 struct vx_pipe *monitoring_pipe; /* pointer to the monitoring pipe (capture pipe only)*/ 82 struct vx_pipe *monitoring_pipe; /* pointer to the monitoring pipe (capture pipe only)*/
83
84 struct tasklet_struct start_tq;
85}; 83};
86 84
87struct vx_core; 85struct vx_core;
@@ -165,9 +163,7 @@ struct vx_core {
165 struct snd_vx_hardware *hw; 163 struct snd_vx_hardware *hw;
166 struct snd_vx_ops *ops; 164 struct snd_vx_ops *ops;
167 165
168 spinlock_t lock; 166 struct mutex lock;
169 spinlock_t irq_lock;
170 struct tasklet_struct tq;
171 167
172 unsigned int chip_status; 168 unsigned int chip_status;
173 unsigned int pcm_running; 169 unsigned int pcm_running;
@@ -223,6 +219,7 @@ void snd_vx_free_firmware(struct vx_core *chip);
223 * interrupt handler; exported for pcmcia 219 * interrupt handler; exported for pcmcia
224 */ 220 */
225irqreturn_t snd_vx_irq_handler(int irq, void *dev); 221irqreturn_t snd_vx_irq_handler(int irq, void *dev);
222irqreturn_t snd_vx_threaded_irq_handler(int irq, void *dev);
226 223
227/* 224/*
228 * lowlevel functions 225 * lowlevel functions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 9ec9864ecf38..23c518a0340c 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -108,6 +108,8 @@
108#define DA_EMULATE_ALUA 0 108#define DA_EMULATE_ALUA 0
109/* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */ 109/* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */
110#define DA_ENFORCE_PR_ISIDS 1 110#define DA_ENFORCE_PR_ISIDS 1
111/* Force SPC-3 PR Activate Persistence across Target Power Loss */
112#define DA_FORCE_PR_APTPL 0
111#define DA_STATUS_MAX_SECTORS_MIN 16 113#define DA_STATUS_MAX_SECTORS_MIN 16
112#define DA_STATUS_MAX_SECTORS_MAX 8192 114#define DA_STATUS_MAX_SECTORS_MAX 8192
113/* By default don't report non-rotating (solid state) medium */ 115/* By default don't report non-rotating (solid state) medium */
@@ -680,6 +682,7 @@ struct se_dev_attrib {
680 enum target_prot_type pi_prot_type; 682 enum target_prot_type pi_prot_type;
681 enum target_prot_type hw_pi_prot_type; 683 enum target_prot_type hw_pi_prot_type;
682 int enforce_pr_isids; 684 int enforce_pr_isids;
685 int force_pr_aptpl;
683 int is_nonrot; 686 int is_nonrot;
684 int emulate_rest_reord; 687 int emulate_rest_reord;
685 u32 hw_block_size; 688 u32 hw_block_size;
@@ -903,4 +906,18 @@ struct se_wwn {
903 struct config_group fabric_stat_group; 906 struct config_group fabric_stat_group;
904}; 907};
905 908
909static inline void atomic_inc_mb(atomic_t *v)
910{
911 smp_mb__before_atomic();
912 atomic_inc(v);
913 smp_mb__after_atomic();
914}
915
916static inline void atomic_dec_mb(atomic_t *v)
917{
918 smp_mb__before_atomic();
919 atomic_dec(v);
920 smp_mb__after_atomic();
921}
922
906#endif /* TARGET_CORE_BASE_H */ 923#endif /* TARGET_CORE_BASE_H */
diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h
index 0194a641e4e2..b04ee7e5a466 100644
--- a/include/trace/events/asoc.h
+++ b/include/trace/events/asoc.h
@@ -175,7 +175,7 @@ TRACE_EVENT(snd_soc_dapm_output_path,
175 __entry->path_sink = (long)path->sink; 175 __entry->path_sink = (long)path->sink;
176 ), 176 ),
177 177
178 TP_printk("%c%s -> %s -> %s\n", 178 TP_printk("%c%s -> %s -> %s",
179 (int) __entry->path_sink && 179 (int) __entry->path_sink &&
180 (int) __entry->path_connect ? '*' : ' ', 180 (int) __entry->path_connect ? '*' : ' ',
181 __get_str(wname), __get_str(pname), __get_str(psname)) 181 __get_str(wname), __get_str(pname), __get_str(psname))
@@ -204,7 +204,7 @@ TRACE_EVENT(snd_soc_dapm_input_path,
204 __entry->path_source = (long)path->source; 204 __entry->path_source = (long)path->source;
205 ), 205 ),
206 206
207 TP_printk("%c%s <- %s <- %s\n", 207 TP_printk("%c%s <- %s <- %s",
208 (int) __entry->path_source && 208 (int) __entry->path_source &&
209 (int) __entry->path_connect ? '*' : ' ', 209 (int) __entry->path_connect ? '*' : ' ',
210 __get_str(wname), __get_str(pname), __get_str(psname)) 210 __get_str(wname), __get_str(pname), __get_str(psname))
@@ -226,7 +226,7 @@ TRACE_EVENT(snd_soc_dapm_connected,
226 __entry->stream = stream; 226 __entry->stream = stream;
227 ), 227 ),
228 228
229 TP_printk("%s: found %d paths\n", 229 TP_printk("%s: found %d paths",
230 __entry->stream ? "capture" : "playback", __entry->paths) 230 __entry->stream ? "capture" : "playback", __entry->paths)
231); 231);
232 232
diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h
index c9c3c044b32f..981acf74b14f 100644
--- a/include/trace/events/bcache.h
+++ b/include/trace/events/bcache.h
@@ -148,11 +148,13 @@ TRACE_EVENT(bcache_read,
148); 148);
149 149
150TRACE_EVENT(bcache_write, 150TRACE_EVENT(bcache_write,
151 TP_PROTO(struct bio *bio, bool writeback, bool bypass), 151 TP_PROTO(struct cache_set *c, u64 inode, struct bio *bio,
152 TP_ARGS(bio, writeback, bypass), 152 bool writeback, bool bypass),
153 TP_ARGS(c, inode, bio, writeback, bypass),
153 154
154 TP_STRUCT__entry( 155 TP_STRUCT__entry(
155 __field(dev_t, dev ) 156 __array(char, uuid, 16 )
157 __field(u64, inode )
156 __field(sector_t, sector ) 158 __field(sector_t, sector )
157 __field(unsigned int, nr_sector ) 159 __field(unsigned int, nr_sector )
158 __array(char, rwbs, 6 ) 160 __array(char, rwbs, 6 )
@@ -161,7 +163,8 @@ TRACE_EVENT(bcache_write,
161 ), 163 ),
162 164
163 TP_fast_assign( 165 TP_fast_assign(
164 __entry->dev = bio->bi_bdev->bd_dev; 166 memcpy(__entry->uuid, c->sb.set_uuid, 16);
167 __entry->inode = inode;
165 __entry->sector = bio->bi_iter.bi_sector; 168 __entry->sector = bio->bi_iter.bi_sector;
166 __entry->nr_sector = bio->bi_iter.bi_size >> 9; 169 __entry->nr_sector = bio->bi_iter.bi_size >> 9;
167 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size); 170 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size);
@@ -169,8 +172,8 @@ TRACE_EVENT(bcache_write,
169 __entry->bypass = bypass; 172 __entry->bypass = bypass;
170 ), 173 ),
171 174
172 TP_printk("%d,%d %s %llu + %u hit %u bypass %u", 175 TP_printk("%pU inode %llu %s %llu + %u hit %u bypass %u",
173 MAJOR(__entry->dev), MINOR(__entry->dev), 176 __entry->uuid, __entry->inode,
174 __entry->rwbs, (unsigned long long)__entry->sector, 177 __entry->rwbs, (unsigned long long)__entry->sector,
175 __entry->nr_sector, __entry->writeback, __entry->bypass) 178 __entry->nr_sector, __entry->writeback, __entry->bypass)
176); 179);
@@ -258,9 +261,9 @@ DEFINE_EVENT(btree_node, bcache_btree_node_alloc,
258 TP_ARGS(b) 261 TP_ARGS(b)
259); 262);
260 263
261DEFINE_EVENT(btree_node, bcache_btree_node_alloc_fail, 264DEFINE_EVENT(cache_set, bcache_btree_node_alloc_fail,
262 TP_PROTO(struct btree *b), 265 TP_PROTO(struct cache_set *c),
263 TP_ARGS(b) 266 TP_ARGS(c)
264); 267);
265 268
266DEFINE_EVENT(btree_node, bcache_btree_node_free, 269DEFINE_EVENT(btree_node, bcache_btree_node_free,
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 4ee4e30d26d9..1faecea101f3 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -23,6 +23,7 @@ struct map_lookup;
23struct extent_buffer; 23struct extent_buffer;
24struct btrfs_work; 24struct btrfs_work;
25struct __btrfs_workqueue; 25struct __btrfs_workqueue;
26struct btrfs_qgroup_operation;
26 27
27#define show_ref_type(type) \ 28#define show_ref_type(type) \
28 __print_symbolic(type, \ 29 __print_symbolic(type, \
@@ -157,12 +158,13 @@ DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
157 158
158#define show_map_flags(flag) \ 159#define show_map_flags(flag) \
159 __print_flags(flag, "|", \ 160 __print_flags(flag, "|", \
160 { EXTENT_FLAG_PINNED, "PINNED" }, \ 161 { (1 << EXTENT_FLAG_PINNED), "PINNED" },\
161 { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \ 162 { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\
162 { EXTENT_FLAG_VACANCY, "VACANCY" }, \ 163 { (1 << EXTENT_FLAG_VACANCY), "VACANCY" },\
163 { EXTENT_FLAG_PREALLOC, "PREALLOC" }, \ 164 { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\
164 { EXTENT_FLAG_LOGGING, "LOGGING" }, \ 165 { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\
165 { EXTENT_FLAG_FILLING, "FILLING" }) 166 { (1 << EXTENT_FLAG_FILLING), "FILLING" },\
167 { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" })
166 168
167TRACE_EVENT_CONDITION(btrfs_get_extent, 169TRACE_EVENT_CONDITION(btrfs_get_extent,
168 170
@@ -996,6 +998,7 @@ DECLARE_EVENT_CLASS(btrfs__work,
996 __field( void *, func ) 998 __field( void *, func )
997 __field( void *, ordered_func ) 999 __field( void *, ordered_func )
998 __field( void *, ordered_free ) 1000 __field( void *, ordered_free )
1001 __field( void *, normal_work )
999 ), 1002 ),
1000 1003
1001 TP_fast_assign( 1004 TP_fast_assign(
@@ -1004,11 +1007,13 @@ DECLARE_EVENT_CLASS(btrfs__work,
1004 __entry->func = work->func; 1007 __entry->func = work->func;
1005 __entry->ordered_func = work->ordered_func; 1008 __entry->ordered_func = work->ordered_func;
1006 __entry->ordered_free = work->ordered_free; 1009 __entry->ordered_free = work->ordered_free;
1010 __entry->normal_work = &work->normal_work;
1007 ), 1011 ),
1008 1012
1009 TP_printk("work=%p, wq=%p, func=%p, ordered_func=%p, ordered_free=%p", 1013 TP_printk("work=%p (normal_work=%p), wq=%p, func=%pf, ordered_func=%p,"
1010 __entry->work, __entry->wq, __entry->func, 1014 " ordered_free=%p",
1011 __entry->ordered_func, __entry->ordered_free) 1015 __entry->work, __entry->normal_work, __entry->wq,
1016 __entry->func, __entry->ordered_func, __entry->ordered_free)
1012); 1017);
1013 1018
1014/* For situiations that the work is freed */ 1019/* For situiations that the work is freed */
@@ -1043,13 +1048,6 @@ DEFINE_EVENT(btrfs__work, btrfs_work_sched,
1043 TP_ARGS(work) 1048 TP_ARGS(work)
1044); 1049);
1045 1050
1046DEFINE_EVENT(btrfs__work, btrfs_normal_work_done,
1047
1048 TP_PROTO(struct btrfs_work *work),
1049
1050 TP_ARGS(work)
1051);
1052
1053DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, 1051DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done,
1054 1052
1055 TP_PROTO(struct btrfs_work *work), 1053 TP_PROTO(struct btrfs_work *work),
@@ -1119,6 +1117,61 @@ DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy,
1119 TP_ARGS(wq) 1117 TP_ARGS(wq)
1120); 1118);
1121 1119
1120#define show_oper_type(type) \
1121 __print_symbolic(type, \
1122 { BTRFS_QGROUP_OPER_ADD_EXCL, "OPER_ADD_EXCL" }, \
1123 { BTRFS_QGROUP_OPER_ADD_SHARED, "OPER_ADD_SHARED" }, \
1124 { BTRFS_QGROUP_OPER_SUB_EXCL, "OPER_SUB_EXCL" }, \
1125 { BTRFS_QGROUP_OPER_SUB_SHARED, "OPER_SUB_SHARED" })
1126
1127DECLARE_EVENT_CLASS(btrfs_qgroup_oper,
1128
1129 TP_PROTO(struct btrfs_qgroup_operation *oper),
1130
1131 TP_ARGS(oper),
1132
1133 TP_STRUCT__entry(
1134 __field( u64, ref_root )
1135 __field( u64, bytenr )
1136 __field( u64, num_bytes )
1137 __field( u64, seq )
1138 __field( int, type )
1139 __field( u64, elem_seq )
1140 ),
1141
1142 TP_fast_assign(
1143 __entry->ref_root = oper->ref_root;
1144 __entry->bytenr = oper->bytenr,
1145 __entry->num_bytes = oper->num_bytes;
1146 __entry->seq = oper->seq;
1147 __entry->type = oper->type;
1148 __entry->elem_seq = oper->elem.seq;
1149 ),
1150
1151 TP_printk("ref_root = %llu, bytenr = %llu, num_bytes = %llu, "
1152 "seq = %llu, elem.seq = %llu, type = %s",
1153 (unsigned long long)__entry->ref_root,
1154 (unsigned long long)__entry->bytenr,
1155 (unsigned long long)__entry->num_bytes,
1156 (unsigned long long)__entry->seq,
1157 (unsigned long long)__entry->elem_seq,
1158 show_oper_type(__entry->type))
1159);
1160
1161DEFINE_EVENT(btrfs_qgroup_oper, btrfs_qgroup_account,
1162
1163 TP_PROTO(struct btrfs_qgroup_operation *oper),
1164
1165 TP_ARGS(oper)
1166);
1167
1168DEFINE_EVENT(btrfs_qgroup_oper, btrfs_qgroup_record_ref,
1169
1170 TP_PROTO(struct btrfs_qgroup_operation *oper),
1171
1172 TP_ARGS(oper)
1173);
1174
1122#endif /* _TRACE_BTRFS_H */ 1175#endif /* _TRACE_BTRFS_H */
1123 1176
1124/* This part must be outside protection */ 1177/* This part must be outside protection */
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index d4f70a7fe876..ff4bd1b35246 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -2369,7 +2369,7 @@ TRACE_EVENT(ext4_es_lookup_extent_exit,
2369 show_extent_status(__entry->found ? __entry->status : 0)) 2369 show_extent_status(__entry->found ? __entry->status : 0))
2370); 2370);
2371 2371
2372TRACE_EVENT(ext4_es_shrink_enter, 2372DECLARE_EVENT_CLASS(ext4__es_shrink_enter,
2373 TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt), 2373 TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2374 2374
2375 TP_ARGS(sb, nr_to_scan, cache_cnt), 2375 TP_ARGS(sb, nr_to_scan, cache_cnt),
@@ -2391,26 +2391,38 @@ TRACE_EVENT(ext4_es_shrink_enter,
2391 __entry->nr_to_scan, __entry->cache_cnt) 2391 __entry->nr_to_scan, __entry->cache_cnt)
2392); 2392);
2393 2393
2394TRACE_EVENT(ext4_es_shrink_exit, 2394DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_count,
2395 TP_PROTO(struct super_block *sb, int shrunk_nr, int cache_cnt), 2395 TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2396 2396
2397 TP_ARGS(sb, shrunk_nr, cache_cnt), 2397 TP_ARGS(sb, nr_to_scan, cache_cnt)
2398);
2399
2400DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_scan_enter,
2401 TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2402
2403 TP_ARGS(sb, nr_to_scan, cache_cnt)
2404);
2405
2406TRACE_EVENT(ext4_es_shrink_scan_exit,
2407 TP_PROTO(struct super_block *sb, int nr_shrunk, int cache_cnt),
2408
2409 TP_ARGS(sb, nr_shrunk, cache_cnt),
2398 2410
2399 TP_STRUCT__entry( 2411 TP_STRUCT__entry(
2400 __field( dev_t, dev ) 2412 __field( dev_t, dev )
2401 __field( int, shrunk_nr ) 2413 __field( int, nr_shrunk )
2402 __field( int, cache_cnt ) 2414 __field( int, cache_cnt )
2403 ), 2415 ),
2404 2416
2405 TP_fast_assign( 2417 TP_fast_assign(
2406 __entry->dev = sb->s_dev; 2418 __entry->dev = sb->s_dev;
2407 __entry->shrunk_nr = shrunk_nr; 2419 __entry->nr_shrunk = nr_shrunk;
2408 __entry->cache_cnt = cache_cnt; 2420 __entry->cache_cnt = cache_cnt;
2409 ), 2421 ),
2410 2422
2411 TP_printk("dev %d,%d shrunk_nr %d cache_cnt %d", 2423 TP_printk("dev %d,%d nr_shrunk %d cache_cnt %d",
2412 MAJOR(__entry->dev), MINOR(__entry->dev), 2424 MAJOR(__entry->dev), MINOR(__entry->dev),
2413 __entry->shrunk_nr, __entry->cache_cnt) 2425 __entry->nr_shrunk, __entry->cache_cnt)
2414); 2426);
2415 2427
2416TRACE_EVENT(ext4_collapse_range, 2428TRACE_EVENT(ext4_collapse_range,
@@ -2438,6 +2450,37 @@ TRACE_EVENT(ext4_collapse_range,
2438 __entry->offset, __entry->len) 2450 __entry->offset, __entry->len)
2439); 2451);
2440 2452
2453TRACE_EVENT(ext4_es_shrink,
2454 TP_PROTO(struct super_block *sb, int nr_shrunk, u64 scan_time,
2455 int skip_precached, int nr_skipped, int retried),
2456
2457 TP_ARGS(sb, nr_shrunk, scan_time, skip_precached, nr_skipped, retried),
2458
2459 TP_STRUCT__entry(
2460 __field( dev_t, dev )
2461 __field( int, nr_shrunk )
2462 __field( unsigned long long, scan_time )
2463 __field( int, skip_precached )
2464 __field( int, nr_skipped )
2465 __field( int, retried )
2466 ),
2467
2468 TP_fast_assign(
2469 __entry->dev = sb->s_dev;
2470 __entry->nr_shrunk = nr_shrunk;
2471 __entry->scan_time = div_u64(scan_time, 1000);
2472 __entry->skip_precached = skip_precached;
2473 __entry->nr_skipped = nr_skipped;
2474 __entry->retried = retried;
2475 ),
2476
2477 TP_printk("dev %d,%d nr_shrunk %d, scan_time %llu skip_precached %d "
2478 "nr_skipped %d retried %d",
2479 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->nr_shrunk,
2480 __entry->scan_time, __entry->skip_precached,
2481 __entry->nr_skipped, __entry->retried)
2482);
2483
2441#endif /* _TRACE_EXT4_H */ 2484#endif /* _TRACE_EXT4_H */
2442 2485
2443/* This part must be outside protection */ 2486/* This part must be outside protection */
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index d06d44363fea..bbc4de9baef7 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -69,6 +69,12 @@
69 { GC_GREEDY, "Greedy" }, \ 69 { GC_GREEDY, "Greedy" }, \
70 { GC_CB, "Cost-Benefit" }) 70 { GC_CB, "Cost-Benefit" })
71 71
72#define show_cpreason(type) \
73 __print_symbolic(type, \
74 { CP_UMOUNT, "Umount" }, \
75 { CP_SYNC, "Sync" }, \
76 { CP_DISCARD, "Discard" })
77
72struct victim_sel_policy; 78struct victim_sel_policy;
73 79
74DECLARE_EVENT_CLASS(f2fs__inode, 80DECLARE_EVENT_CLASS(f2fs__inode,
@@ -944,25 +950,25 @@ TRACE_EVENT(f2fs_submit_page_mbio,
944 950
945TRACE_EVENT(f2fs_write_checkpoint, 951TRACE_EVENT(f2fs_write_checkpoint,
946 952
947 TP_PROTO(struct super_block *sb, bool is_umount, char *msg), 953 TP_PROTO(struct super_block *sb, int reason, char *msg),
948 954
949 TP_ARGS(sb, is_umount, msg), 955 TP_ARGS(sb, reason, msg),
950 956
951 TP_STRUCT__entry( 957 TP_STRUCT__entry(
952 __field(dev_t, dev) 958 __field(dev_t, dev)
953 __field(bool, is_umount) 959 __field(int, reason)
954 __field(char *, msg) 960 __field(char *, msg)
955 ), 961 ),
956 962
957 TP_fast_assign( 963 TP_fast_assign(
958 __entry->dev = sb->s_dev; 964 __entry->dev = sb->s_dev;
959 __entry->is_umount = is_umount; 965 __entry->reason = reason;
960 __entry->msg = msg; 966 __entry->msg = msg;
961 ), 967 ),
962 968
963 TP_printk("dev = (%d,%d), checkpoint for %s, state = %s", 969 TP_printk("dev = (%d,%d), checkpoint for %s, state = %s",
964 show_dev(__entry), 970 show_dev(__entry),
965 __entry->is_umount ? "clean umount" : "consistency", 971 show_cpreason(__entry->reason),
966 __entry->msg) 972 __entry->msg)
967); 973);
968 974
diff --git a/include/trace/events/filelock.h b/include/trace/events/filelock.h
index 59d11c22f076..a0d008070962 100644
--- a/include/trace/events/filelock.h
+++ b/include/trace/events/filelock.h
@@ -53,15 +53,15 @@ DECLARE_EVENT_CLASS(filelock_lease,
53 ), 53 ),
54 54
55 TP_fast_assign( 55 TP_fast_assign(
56 __entry->fl = fl; 56 __entry->fl = fl ? fl : NULL;
57 __entry->s_dev = inode->i_sb->s_dev; 57 __entry->s_dev = inode->i_sb->s_dev;
58 __entry->i_ino = inode->i_ino; 58 __entry->i_ino = inode->i_ino;
59 __entry->fl_next = fl->fl_next; 59 __entry->fl_next = fl ? fl->fl_next : NULL;
60 __entry->fl_owner = fl->fl_owner; 60 __entry->fl_owner = fl ? fl->fl_owner : NULL;
61 __entry->fl_flags = fl->fl_flags; 61 __entry->fl_flags = fl ? fl->fl_flags : 0;
62 __entry->fl_type = fl->fl_type; 62 __entry->fl_type = fl ? fl->fl_type : 0;
63 __entry->fl_break_time = fl->fl_break_time; 63 __entry->fl_break_time = fl ? fl->fl_break_time : 0;
64 __entry->fl_downgrade_time = fl->fl_downgrade_time; 64 __entry->fl_downgrade_time = fl ? fl->fl_downgrade_time : 0;
65 ), 65 ),
66 66
67 TP_printk("fl=0x%p dev=0x%x:0x%x ino=0x%lx fl_next=0x%p fl_owner=0x%p fl_flags=%s fl_type=%s fl_break_time=%lu fl_downgrade_time=%lu", 67 TP_printk("fl=0x%p dev=0x%x:0x%x ino=0x%lx fl_next=0x%p fl_owner=0x%p fl_flags=%s fl_type=%s fl_break_time=%lu fl_downgrade_time=%lu",
diff --git a/include/trace/events/ipi.h b/include/trace/events/ipi.h
new file mode 100644
index 000000000000..834a7362a610
--- /dev/null
+++ b/include/trace/events/ipi.h
@@ -0,0 +1,89 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM ipi
3
4#if !defined(_TRACE_IPI_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_IPI_H
6
7#include <linux/tracepoint.h>
8
9/**
10 * ipi_raise - called when a smp cross call is made
11 *
12 * @mask: mask of recipient CPUs for the IPI
13 * @reason: string identifying the IPI purpose
14 *
15 * It is necessary for @reason to be a static string declared with
16 * __tracepoint_string.
17 */
18TRACE_EVENT(ipi_raise,
19
20 TP_PROTO(const struct cpumask *mask, const char *reason),
21
22 TP_ARGS(mask, reason),
23
24 TP_STRUCT__entry(
25 __bitmask(target_cpus, nr_cpumask_bits)
26 __field(const char *, reason)
27 ),
28
29 TP_fast_assign(
30 __assign_bitmask(target_cpus, cpumask_bits(mask), nr_cpumask_bits);
31 __entry->reason = reason;
32 ),
33
34 TP_printk("target_mask=%s (%s)", __get_bitmask(target_cpus), __entry->reason)
35);
36
37DECLARE_EVENT_CLASS(ipi_handler,
38
39 TP_PROTO(const char *reason),
40
41 TP_ARGS(reason),
42
43 TP_STRUCT__entry(
44 __field(const char *, reason)
45 ),
46
47 TP_fast_assign(
48 __entry->reason = reason;
49 ),
50
51 TP_printk("(%s)", __entry->reason)
52);
53
54/**
55 * ipi_entry - called immediately before the IPI handler
56 *
57 * @reason: string identifying the IPI purpose
58 *
59 * It is necessary for @reason to be a static string declared with
60 * __tracepoint_string, ideally the same as used with trace_ipi_raise
61 * for that IPI.
62 */
63DEFINE_EVENT(ipi_handler, ipi_entry,
64
65 TP_PROTO(const char *reason),
66
67 TP_ARGS(reason)
68);
69
70/**
71 * ipi_exit - called immediately after the IPI handler returns
72 *
73 * @reason: string identifying the IPI purpose
74 *
75 * It is necessary for @reason to be a static string declared with
76 * __tracepoint_string, ideally the same as used with trace_ipi_raise for
77 * that IPI.
78 */
79DEFINE_EVENT(ipi_handler, ipi_exit,
80
81 TP_PROTO(const char *reason),
82
83 TP_ARGS(reason)
84);
85
86#endif /* _TRACE_IPI_H */
87
88/* This part must be outside protection */
89#include <trace/define_trace.h>
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index 1c09820df585..3608bebd3d9c 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -107,7 +107,7 @@ DECLARE_EVENT_CLASS(softirq,
107 * @vec_nr: softirq vector number 107 * @vec_nr: softirq vector number
108 * 108 *
109 * When used in combination with the softirq_exit tracepoint 109 * When used in combination with the softirq_exit tracepoint
110 * we can determine the softirq handler runtine. 110 * we can determine the softirq handler routine.
111 */ 111 */
112DEFINE_EVENT(softirq, softirq_entry, 112DEFINE_EVENT(softirq, softirq_entry,
113 113
@@ -121,7 +121,7 @@ DEFINE_EVENT(softirq, softirq_entry,
121 * @vec_nr: softirq vector number 121 * @vec_nr: softirq vector number
122 * 122 *
123 * When used in combination with the softirq_entry tracepoint 123 * When used in combination with the softirq_entry tracepoint
124 * we can determine the softirq handler runtine. 124 * we can determine the softirq handler routine.
125 */ 125 */
126DEFINE_EVENT(softirq, softirq_exit, 126DEFINE_EVENT(softirq, softirq_exit,
127 127
diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
index 131a0bda7aec..6edf1f2028cd 100644
--- a/include/trace/events/kvm.h
+++ b/include/trace/events/kvm.h
@@ -37,7 +37,7 @@ TRACE_EVENT(kvm_userspace_exit,
37 __entry->errno < 0 ? -__entry->errno : __entry->reason) 37 __entry->errno < 0 ? -__entry->errno : __entry->reason)
38); 38);
39 39
40#if defined(CONFIG_HAVE_KVM_IRQCHIP) 40#if defined(CONFIG_HAVE_KVM_IRQFD)
41TRACE_EVENT(kvm_set_irq, 41TRACE_EVENT(kvm_set_irq,
42 TP_PROTO(unsigned int gsi, int level, int irq_source_id), 42 TP_PROTO(unsigned int gsi, int level, int irq_source_id),
43 TP_ARGS(gsi, level, irq_source_id), 43 TP_ARGS(gsi, level, irq_source_id),
@@ -57,7 +57,7 @@ TRACE_EVENT(kvm_set_irq,
57 TP_printk("gsi %u level %d source %d", 57 TP_printk("gsi %u level %d source %d",
58 __entry->gsi, __entry->level, __entry->irq_source_id) 58 __entry->gsi, __entry->level, __entry->irq_source_id)
59); 59);
60#endif 60#endif /* defined(CONFIG_HAVE_KVM_IRQFD) */
61 61
62#if defined(__KVM_HAVE_IOAPIC) 62#if defined(__KVM_HAVE_IOAPIC)
63#define kvm_deliver_mode \ 63#define kvm_deliver_mode \
@@ -95,6 +95,26 @@ TRACE_EVENT(kvm_ioapic_set_irq,
95 __entry->coalesced ? " (coalesced)" : "") 95 __entry->coalesced ? " (coalesced)" : "")
96); 96);
97 97
98TRACE_EVENT(kvm_ioapic_delayed_eoi_inj,
99 TP_PROTO(__u64 e),
100 TP_ARGS(e),
101
102 TP_STRUCT__entry(
103 __field( __u64, e )
104 ),
105
106 TP_fast_assign(
107 __entry->e = e;
108 ),
109
110 TP_printk("dst %x vec=%u (%s|%s|%s%s)",
111 (u8)(__entry->e >> 56), (u8)__entry->e,
112 __print_symbolic((__entry->e >> 8 & 0x7), kvm_deliver_mode),
113 (__entry->e & (1<<11)) ? "logical" : "physical",
114 (__entry->e & (1<<15)) ? "level" : "edge",
115 (__entry->e & (1<<16)) ? "|masked" : "")
116);
117
98TRACE_EVENT(kvm_msi_set_irq, 118TRACE_EVENT(kvm_msi_set_irq,
99 TP_PROTO(__u64 address, __u64 data), 119 TP_PROTO(__u64 address, __u64 data),
100 TP_ARGS(address, data), 120 TP_ARGS(address, data),
@@ -124,7 +144,7 @@ TRACE_EVENT(kvm_msi_set_irq,
124 144
125#endif /* defined(__KVM_HAVE_IOAPIC) */ 145#endif /* defined(__KVM_HAVE_IOAPIC) */
126 146
127#if defined(CONFIG_HAVE_KVM_IRQCHIP) 147#if defined(CONFIG_HAVE_KVM_IRQFD)
128 148
129TRACE_EVENT(kvm_ack_irq, 149TRACE_EVENT(kvm_ack_irq,
130 TP_PROTO(unsigned int irqchip, unsigned int pin), 150 TP_PROTO(unsigned int irqchip, unsigned int pin),
@@ -149,7 +169,7 @@ TRACE_EVENT(kvm_ack_irq,
149#endif 169#endif
150); 170);
151 171
152#endif /* defined(CONFIG_HAVE_KVM_IRQCHIP) */ 172#endif /* defined(CONFIG_HAVE_KVM_IRQFD) */
153 173
154 174
155 175
@@ -205,24 +225,26 @@ TRACE_EVENT(kvm_fpu,
205); 225);
206 226
207TRACE_EVENT(kvm_age_page, 227TRACE_EVENT(kvm_age_page,
208 TP_PROTO(ulong hva, struct kvm_memory_slot *slot, int ref), 228 TP_PROTO(ulong gfn, int level, struct kvm_memory_slot *slot, int ref),
209 TP_ARGS(hva, slot, ref), 229 TP_ARGS(gfn, level, slot, ref),
210 230
211 TP_STRUCT__entry( 231 TP_STRUCT__entry(
212 __field( u64, hva ) 232 __field( u64, hva )
213 __field( u64, gfn ) 233 __field( u64, gfn )
234 __field( u8, level )
214 __field( u8, referenced ) 235 __field( u8, referenced )
215 ), 236 ),
216 237
217 TP_fast_assign( 238 TP_fast_assign(
218 __entry->hva = hva; 239 __entry->gfn = gfn;
219 __entry->gfn = 240 __entry->level = level;
220 slot->base_gfn + ((hva - slot->userspace_addr) >> PAGE_SHIFT); 241 __entry->hva = ((gfn - slot->base_gfn) <<
242 PAGE_SHIFT) + slot->userspace_addr;
221 __entry->referenced = ref; 243 __entry->referenced = ref;
222 ), 244 ),
223 245
224 TP_printk("hva %llx gfn %llx %s", 246 TP_printk("hva %llx gfn %llx level %u %s",
225 __entry->hva, __entry->gfn, 247 __entry->hva, __entry->gfn, __entry->level,
226 __entry->referenced ? "YOUNG" : "OLD") 248 __entry->referenced ? "YOUNG" : "OLD")
227); 249);
228 250
diff --git a/include/trace/events/migrate.h b/include/trace/events/migrate.h
index 4e4f2f8b1ac2..dd2b5467d905 100644
--- a/include/trace/events/migrate.h
+++ b/include/trace/events/migrate.h
@@ -17,6 +17,7 @@
17 {MR_MEMORY_HOTPLUG, "memory_hotplug"}, \ 17 {MR_MEMORY_HOTPLUG, "memory_hotplug"}, \
18 {MR_SYSCALL, "syscall_or_cpuset"}, \ 18 {MR_SYSCALL, "syscall_or_cpuset"}, \
19 {MR_MEMPOLICY_MBIND, "mempolicy_mbind"}, \ 19 {MR_MEMPOLICY_MBIND, "mempolicy_mbind"}, \
20 {MR_NUMA_MISPLACED, "numa_misplaced"}, \
20 {MR_CMA, "cma"} 21 {MR_CMA, "cma"}
21 22
22TRACE_EVENT(mm_migrate_pages, 23TRACE_EVENT(mm_migrate_pages,
diff --git a/include/trace/events/pagemap.h b/include/trace/events/pagemap.h
index 1c9fabde69e4..ce0803b8d05f 100644
--- a/include/trace/events/pagemap.h
+++ b/include/trace/events/pagemap.h
@@ -28,12 +28,10 @@ TRACE_EVENT(mm_lru_insertion,
28 28
29 TP_PROTO( 29 TP_PROTO(
30 struct page *page, 30 struct page *page,
31 unsigned long pfn, 31 int lru
32 int lru,
33 unsigned long flags
34 ), 32 ),
35 33
36 TP_ARGS(page, pfn, lru, flags), 34 TP_ARGS(page, lru),
37 35
38 TP_STRUCT__entry( 36 TP_STRUCT__entry(
39 __field(struct page *, page ) 37 __field(struct page *, page )
@@ -44,9 +42,9 @@ TRACE_EVENT(mm_lru_insertion,
44 42
45 TP_fast_assign( 43 TP_fast_assign(
46 __entry->page = page; 44 __entry->page = page;
47 __entry->pfn = pfn; 45 __entry->pfn = page_to_pfn(page);
48 __entry->lru = lru; 46 __entry->lru = lru;
49 __entry->flags = flags; 47 __entry->flags = trace_pagemap_flags(page);
50 ), 48 ),
51 49
52 /* Flag format is based on page-types.c formatting for pagemap */ 50 /* Flag format is based on page-types.c formatting for pagemap */
@@ -64,9 +62,9 @@ TRACE_EVENT(mm_lru_insertion,
64 62
65TRACE_EVENT(mm_lru_activate, 63TRACE_EVENT(mm_lru_activate,
66 64
67 TP_PROTO(struct page *page, unsigned long pfn), 65 TP_PROTO(struct page *page),
68 66
69 TP_ARGS(page, pfn), 67 TP_ARGS(page),
70 68
71 TP_STRUCT__entry( 69 TP_STRUCT__entry(
72 __field(struct page *, page ) 70 __field(struct page *, page )
@@ -75,7 +73,7 @@ TRACE_EVENT(mm_lru_activate,
75 73
76 TP_fast_assign( 74 TP_fast_assign(
77 __entry->page = page; 75 __entry->page = page;
78 __entry->pfn = pfn; 76 __entry->pfn = page_to_pfn(page);
79 ), 77 ),
80 78
81 /* Flag format is based on page-types.c formatting for pagemap */ 79 /* Flag format is based on page-types.c formatting for pagemap */
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index aca382266411..e335e7d8c6c2 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -180,9 +180,12 @@ TRACE_EVENT(rcu_grace_period_init,
180 * argument is a string as follows: 180 * argument is a string as follows:
181 * 181 *
182 * "WakeEmpty": Wake rcuo kthread, first CB to empty list. 182 * "WakeEmpty": Wake rcuo kthread, first CB to empty list.
183 * "WakeEmptyIsDeferred": Wake rcuo kthread later, first CB to empty list.
183 * "WakeOvf": Wake rcuo kthread, CB list is huge. 184 * "WakeOvf": Wake rcuo kthread, CB list is huge.
185 * "WakeOvfIsDeferred": Wake rcuo kthread later, CB list is huge.
184 * "WakeNot": Don't wake rcuo kthread. 186 * "WakeNot": Don't wake rcuo kthread.
185 * "WakeNotPoll": Don't wake rcuo kthread because it is polling. 187 * "WakeNotPoll": Don't wake rcuo kthread because it is polling.
188 * "DeferredWake": Carried out the "IsDeferred" wakeup.
186 * "Poll": Start of new polling cycle for rcu_nocb_poll. 189 * "Poll": Start of new polling cycle for rcu_nocb_poll.
187 * "Sleep": Sleep waiting for CBs for !rcu_nocb_poll. 190 * "Sleep": Sleep waiting for CBs for !rcu_nocb_poll.
188 * "WokeEmpty": rcuo kthread woke to find empty list. 191 * "WokeEmpty": rcuo kthread woke to find empty list.
@@ -657,18 +660,18 @@ TRACE_EVENT(rcu_torture_read,
657/* 660/*
658 * Tracepoint for _rcu_barrier() execution. The string "s" describes 661 * Tracepoint for _rcu_barrier() execution. The string "s" describes
659 * the _rcu_barrier phase: 662 * the _rcu_barrier phase:
660 * "Begin": rcu_barrier_callback() started. 663 * "Begin": _rcu_barrier() started.
661 * "Check": rcu_barrier_callback() checking for piggybacking. 664 * "Check": _rcu_barrier() checking for piggybacking.
662 * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit. 665 * "EarlyExit": _rcu_barrier() piggybacked, thus early exit.
663 * "Inc1": rcu_barrier_callback() piggyback check counter incremented. 666 * "Inc1": _rcu_barrier() piggyback check counter incremented.
664 * "Offline": rcu_barrier_callback() found offline CPU 667 * "OfflineNoCB": _rcu_barrier() found callback on never-online CPU
665 * "OnlineNoCB": rcu_barrier_callback() found online no-CBs CPU. 668 * "OnlineNoCB": _rcu_barrier() found online no-CBs CPU.
666 * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks. 669 * "OnlineQ": _rcu_barrier() found online CPU with callbacks.
667 * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks. 670 * "OnlineNQ": _rcu_barrier() found online CPU, no callbacks.
668 * "IRQ": An rcu_barrier_callback() callback posted on remote CPU. 671 * "IRQ": An rcu_barrier_callback() callback posted on remote CPU.
669 * "CB": An rcu_barrier_callback() invoked a callback, not the last. 672 * "CB": An rcu_barrier_callback() invoked a callback, not the last.
670 * "LastCB": An rcu_barrier_callback() invoked the last callback. 673 * "LastCB": An rcu_barrier_callback() invoked the last callback.
671 * "Inc2": rcu_barrier_callback() piggyback check counter incremented. 674 * "Inc2": _rcu_barrier() piggyback check counter incremented.
672 * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument 675 * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument
673 * is the count of remaining callbacks, and "done" is the piggybacking count. 676 * is the count of remaining callbacks, and "done" is the piggybacking count.
674 */ 677 */
diff --git a/include/trace/events/thermal.h b/include/trace/events/thermal.h
new file mode 100644
index 000000000000..0f4f95d63c03
--- /dev/null
+++ b/include/trace/events/thermal.h
@@ -0,0 +1,83 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM thermal
3
4#if !defined(_TRACE_THERMAL_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_THERMAL_H
6
7#include <linux/thermal.h>
8#include <linux/tracepoint.h>
9
10TRACE_EVENT(thermal_temperature,
11
12 TP_PROTO(struct thermal_zone_device *tz),
13
14 TP_ARGS(tz),
15
16 TP_STRUCT__entry(
17 __string(thermal_zone, tz->type)
18 __field(int, id)
19 __field(int, temp_prev)
20 __field(int, temp)
21 ),
22
23 TP_fast_assign(
24 __assign_str(thermal_zone, tz->type);
25 __entry->id = tz->id;
26 __entry->temp_prev = tz->last_temperature;
27 __entry->temp = tz->temperature;
28 ),
29
30 TP_printk("thermal_zone=%s id=%d temp_prev=%d temp=%d",
31 __get_str(thermal_zone), __entry->id, __entry->temp_prev,
32 __entry->temp)
33);
34
35TRACE_EVENT(cdev_update,
36
37 TP_PROTO(struct thermal_cooling_device *cdev, unsigned long target),
38
39 TP_ARGS(cdev, target),
40
41 TP_STRUCT__entry(
42 __string(type, cdev->type)
43 __field(unsigned long, target)
44 ),
45
46 TP_fast_assign(
47 __assign_str(type, cdev->type);
48 __entry->target = target;
49 ),
50
51 TP_printk("type=%s target=%lu", __get_str(type), __entry->target)
52);
53
54TRACE_EVENT(thermal_zone_trip,
55
56 TP_PROTO(struct thermal_zone_device *tz, int trip,
57 enum thermal_trip_type trip_type),
58
59 TP_ARGS(tz, trip, trip_type),
60
61 TP_STRUCT__entry(
62 __string(thermal_zone, tz->type)
63 __field(int, id)
64 __field(int, trip)
65 __field(enum thermal_trip_type, trip_type)
66 ),
67
68 TP_fast_assign(
69 __assign_str(thermal_zone, tz->type);
70 __entry->id = tz->id;
71 __entry->trip = trip;
72 __entry->trip_type = trip_type;
73 ),
74
75 TP_printk("thermal_zone=%s id=%d trip=%d trip_type=%d",
76 __get_str(thermal_zone), __entry->id, __entry->trip,
77 __entry->trip_type)
78);
79
80#endif /* _TRACE_THERMAL_H */
81
82/* This part must be outside protection */
83#include <trace/define_trace.h>
diff --git a/include/trace/events/thp.h b/include/trace/events/thp.h
new file mode 100644
index 000000000000..b59b065e9e5d
--- /dev/null
+++ b/include/trace/events/thp.h
@@ -0,0 +1,88 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM thp
3
4#if !defined(_TRACE_THP_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_THP_H
6
7#include <linux/types.h>
8#include <linux/tracepoint.h>
9
10TRACE_EVENT(hugepage_invalidate,
11
12 TP_PROTO(unsigned long addr, unsigned long pte),
13 TP_ARGS(addr, pte),
14 TP_STRUCT__entry(
15 __field(unsigned long, addr)
16 __field(unsigned long, pte)
17 ),
18
19 TP_fast_assign(
20 __entry->addr = addr;
21 __entry->pte = pte;
22 ),
23
24 TP_printk("hugepage invalidate at addr 0x%lx and pte = 0x%lx",
25 __entry->addr, __entry->pte)
26);
27
28TRACE_EVENT(hugepage_set_pmd,
29
30 TP_PROTO(unsigned long addr, unsigned long pmd),
31 TP_ARGS(addr, pmd),
32 TP_STRUCT__entry(
33 __field(unsigned long, addr)
34 __field(unsigned long, pmd)
35 ),
36
37 TP_fast_assign(
38 __entry->addr = addr;
39 __entry->pmd = pmd;
40 ),
41
42 TP_printk("Set pmd with 0x%lx with 0x%lx", __entry->addr, __entry->pmd)
43);
44
45
46TRACE_EVENT(hugepage_update,
47
48 TP_PROTO(unsigned long addr, unsigned long pte, unsigned long clr, unsigned long set),
49 TP_ARGS(addr, pte, clr, set),
50 TP_STRUCT__entry(
51 __field(unsigned long, addr)
52 __field(unsigned long, pte)
53 __field(unsigned long, clr)
54 __field(unsigned long, set)
55 ),
56
57 TP_fast_assign(
58 __entry->addr = addr;
59 __entry->pte = pte;
60 __entry->clr = clr;
61 __entry->set = set;
62
63 ),
64
65 TP_printk("hugepage update at addr 0x%lx and pte = 0x%lx clr = 0x%lx, set = 0x%lx", __entry->addr, __entry->pte, __entry->clr, __entry->set)
66);
67TRACE_EVENT(hugepage_splitting,
68
69 TP_PROTO(unsigned long addr, unsigned long pte),
70 TP_ARGS(addr, pte),
71 TP_STRUCT__entry(
72 __field(unsigned long, addr)
73 __field(unsigned long, pte)
74 ),
75
76 TP_fast_assign(
77 __entry->addr = addr;
78 __entry->pte = pte;
79 ),
80
81 TP_printk("hugepage splitting at addr 0x%lx and pte = 0x%lx",
82 __entry->addr, __entry->pte)
83);
84
85#endif /* _TRACE_THP_H */
86
87/* This part must be outside protection */
88#include <trace/define_trace.h>
diff --git a/include/uapi/Kbuild b/include/uapi/Kbuild
index 81d2106287fe..245aa6e05e6a 100644
--- a/include/uapi/Kbuild
+++ b/include/uapi/Kbuild
@@ -12,3 +12,4 @@ header-y += video/
12header-y += drm/ 12header-y += drm/
13header-y += xen/ 13header-y += xen/
14header-y += scsi/ 14header-y += scsi/
15header-y += misc/
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index f1afd607f043..22749c134117 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -703,9 +703,13 @@ __SYSCALL(__NR_renameat2, sys_renameat2)
703__SYSCALL(__NR_seccomp, sys_seccomp) 703__SYSCALL(__NR_seccomp, sys_seccomp)
704#define __NR_getrandom 278 704#define __NR_getrandom 278
705__SYSCALL(__NR_getrandom, sys_getrandom) 705__SYSCALL(__NR_getrandom, sys_getrandom)
706#define __NR_memfd_create 279
707__SYSCALL(__NR_memfd_create, sys_memfd_create)
708#define __NR_bpf 280
709__SYSCALL(__NR_bpf, sys_bpf)
706 710
707#undef __NR_syscalls 711#undef __NR_syscalls
708#define __NR_syscalls 279 712#define __NR_syscalls 281
709 713
710/* 714/*
711 * All syscalls below here should go away really, 715 * All syscalls below here should go away really,
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 9abbeb924cbb..b0b855613641 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -780,7 +780,7 @@ struct drm_prime_handle {
780 780
781/** 781/**
782 * Device specific ioctls should only be in their respective headers 782 * Device specific ioctls should only be in their respective headers
783 * The device specific ioctl range is from 0x40 to 0x99. 783 * The device specific ioctl range is from 0x40 to 0x9f.
784 * Generic IOCTLS restart at 0xA0. 784 * Generic IOCTLS restart at 0xA0.
785 * 785 *
786 * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and 786 * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index def54f9e07ca..a0db2d4aa5f0 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -88,6 +88,11 @@
88#define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */ 88#define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */
89#define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */ 89#define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */
90 90
91/* Picture aspect ratio options */
92#define DRM_MODE_PICTURE_ASPECT_NONE 0
93#define DRM_MODE_PICTURE_ASPECT_4_3 1
94#define DRM_MODE_PICTURE_ASPECT_16_9 2
95
91/* Dithering mode options */ 96/* Dithering mode options */
92#define DRM_MODE_DITHERING_OFF 0 97#define DRM_MODE_DITHERING_OFF 0
93#define DRM_MODE_DITHERING_ON 1 98#define DRM_MODE_DITHERING_ON 1
diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h
index d5844122ff32..5575ed1598bd 100644
--- a/include/uapi/drm/exynos_drm.h
+++ b/include/uapi/drm/exynos_drm.h
@@ -33,38 +33,6 @@ struct drm_exynos_gem_create {
33}; 33};
34 34
35/** 35/**
36 * A structure for getting buffer offset.
37 *
38 * @handle: a pointer to gem object created.
39 * @pad: just padding to be 64-bit aligned.
40 * @offset: relatived offset value of the memory region allocated.
41 * - this value should be set by user.
42 */
43struct drm_exynos_gem_map_off {
44 unsigned int handle;
45 unsigned int pad;
46 uint64_t offset;
47};
48
49/**
50 * A structure for mapping buffer.
51 *
52 * @handle: a handle to gem object created.
53 * @pad: just padding to be 64-bit aligned.
54 * @size: memory size to be mapped.
55 * @mapped: having user virtual address mmaped.
56 * - this variable would be filled by exynos gem module
57 * of kernel side with user virtual address which is allocated
58 * by do_mmap().
59 */
60struct drm_exynos_gem_mmap {
61 unsigned int handle;
62 unsigned int pad;
63 uint64_t size;
64 uint64_t mapped;
65};
66
67/**
68 * A structure to gem information. 36 * A structure to gem information.
69 * 37 *
70 * @handle: a handle to gem object created. 38 * @handle: a handle to gem object created.
@@ -316,8 +284,6 @@ struct drm_exynos_ipp_cmd_ctrl {
316}; 284};
317 285
318#define DRM_EXYNOS_GEM_CREATE 0x00 286#define DRM_EXYNOS_GEM_CREATE 0x00
319#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
320#define DRM_EXYNOS_GEM_MMAP 0x02
321/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */ 287/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
322#define DRM_EXYNOS_GEM_GET 0x04 288#define DRM_EXYNOS_GEM_GET 0x04
323#define DRM_EXYNOS_VIDI_CONNECTION 0x07 289#define DRM_EXYNOS_VIDI_CONNECTION 0x07
@@ -336,12 +302,6 @@ struct drm_exynos_ipp_cmd_ctrl {
336#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ 302#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
337 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) 303 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
338 304
339#define DRM_IOCTL_EXYNOS_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \
340 DRM_EXYNOS_GEM_MAP_OFFSET, struct drm_exynos_gem_map_off)
341
342#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
343 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
344
345#define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \ 305#define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
346 DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info) 306 DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
347 307
diff --git a/include/uapi/drm/nouveau_drm.h b/include/uapi/drm/nouveau_drm.h
index 2a5769fdf8ba..0d7608dc1a34 100644
--- a/include/uapi/drm/nouveau_drm.h
+++ b/include/uapi/drm/nouveau_drm.h
@@ -25,6 +25,16 @@
25#ifndef __NOUVEAU_DRM_H__ 25#ifndef __NOUVEAU_DRM_H__
26#define __NOUVEAU_DRM_H__ 26#define __NOUVEAU_DRM_H__
27 27
28#define DRM_NOUVEAU_EVENT_NVIF 0x80000000
29
30/* reserved object handles when using deprecated object APIs - these
31 * are here so that libdrm can allow interoperability with the new
32 * object APIs
33 */
34#define NOUVEAU_ABI16_CLIENT 0xffffffff
35#define NOUVEAU_ABI16_DEVICE 0xdddddddd
36#define NOUVEAU_ABI16_CHAN(n) (0xcccc0000 | (n))
37
28#define NOUVEAU_GEM_DOMAIN_CPU (1 << 0) 38#define NOUVEAU_GEM_DOMAIN_CPU (1 << 0)
29#define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1) 39#define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1)
30#define NOUVEAU_GEM_DOMAIN_GART (1 << 2) 40#define NOUVEAU_GEM_DOMAIN_GART (1 << 2)
@@ -123,6 +133,7 @@ struct drm_nouveau_gem_cpu_fini {
123#define DRM_NOUVEAU_GROBJ_ALLOC 0x04 /* deprecated */ 133#define DRM_NOUVEAU_GROBJ_ALLOC 0x04 /* deprecated */
124#define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05 /* deprecated */ 134#define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05 /* deprecated */
125#define DRM_NOUVEAU_GPUOBJ_FREE 0x06 /* deprecated */ 135#define DRM_NOUVEAU_GPUOBJ_FREE 0x06 /* deprecated */
136#define DRM_NOUVEAU_NVIF 0x07
126#define DRM_NOUVEAU_GEM_NEW 0x40 137#define DRM_NOUVEAU_GEM_NEW 0x40
127#define DRM_NOUVEAU_GEM_PUSHBUF 0x41 138#define DRM_NOUVEAU_GEM_PUSHBUF 0x41
128#define DRM_NOUVEAU_GEM_CPU_PREP 0x42 139#define DRM_NOUVEAU_GEM_CPU_PREP 0x42
diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
index 1cc0b610f162..50d0fb41a3bf 100644
--- a/include/uapi/drm/radeon_drm.h
+++ b/include/uapi/drm/radeon_drm.h
@@ -511,6 +511,7 @@ typedef struct {
511#define DRM_RADEON_GEM_BUSY 0x2a 511#define DRM_RADEON_GEM_BUSY 0x2a
512#define DRM_RADEON_GEM_VA 0x2b 512#define DRM_RADEON_GEM_VA 0x2b
513#define DRM_RADEON_GEM_OP 0x2c 513#define DRM_RADEON_GEM_OP 0x2c
514#define DRM_RADEON_GEM_USERPTR 0x2d
514 515
515#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) 516#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
516#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) 517#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)
@@ -554,6 +555,7 @@ typedef struct {
554#define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy) 555#define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy)
555#define DRM_IOCTL_RADEON_GEM_VA DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_VA, struct drm_radeon_gem_va) 556#define DRM_IOCTL_RADEON_GEM_VA DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_VA, struct drm_radeon_gem_va)
556#define DRM_IOCTL_RADEON_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_OP, struct drm_radeon_gem_op) 557#define DRM_IOCTL_RADEON_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_OP, struct drm_radeon_gem_op)
558#define DRM_IOCTL_RADEON_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_USERPTR, struct drm_radeon_gem_userptr)
557 559
558typedef struct drm_radeon_init { 560typedef struct drm_radeon_init {
559 enum { 561 enum {
@@ -796,7 +798,13 @@ struct drm_radeon_gem_info {
796 uint64_t vram_visible; 798 uint64_t vram_visible;
797}; 799};
798 800
799#define RADEON_GEM_NO_BACKING_STORE 1 801#define RADEON_GEM_NO_BACKING_STORE (1 << 0)
802#define RADEON_GEM_GTT_UC (1 << 1)
803#define RADEON_GEM_GTT_WC (1 << 2)
804/* BO is expected to be accessed by the CPU */
805#define RADEON_GEM_CPU_ACCESS (1 << 3)
806/* CPU access is not expected to work for this BO */
807#define RADEON_GEM_NO_CPU_ACCESS (1 << 4)
800 808
801struct drm_radeon_gem_create { 809struct drm_radeon_gem_create {
802 uint64_t size; 810 uint64_t size;
@@ -806,6 +814,23 @@ struct drm_radeon_gem_create {
806 uint32_t flags; 814 uint32_t flags;
807}; 815};
808 816
817/*
818 * This is not a reliable API and you should expect it to fail for any
819 * number of reasons and have fallback path that do not use userptr to
820 * perform any operation.
821 */
822#define RADEON_GEM_USERPTR_READONLY (1 << 0)
823#define RADEON_GEM_USERPTR_ANONONLY (1 << 1)
824#define RADEON_GEM_USERPTR_VALIDATE (1 << 2)
825#define RADEON_GEM_USERPTR_REGISTER (1 << 3)
826
827struct drm_radeon_gem_userptr {
828 uint64_t addr;
829 uint64_t size;
830 uint32_t flags;
831 uint32_t handle;
832};
833
809#define RADEON_TILING_MACRO 0x1 834#define RADEON_TILING_MACRO 0x1
810#define RADEON_TILING_MICRO 0x2 835#define RADEON_TILING_MICRO 0x2
811#define RADEON_TILING_SWAP_16BIT 0x4 836#define RADEON_TILING_SWAP_16BIT 0x4
@@ -942,6 +967,7 @@ struct drm_radeon_cs_chunk {
942}; 967};
943 968
944/* drm_radeon_cs_reloc.flags */ 969/* drm_radeon_cs_reloc.flags */
970#define RADEON_RELOC_PRIO_MASK (0xf << 0)
945 971
946struct drm_radeon_cs_reloc { 972struct drm_radeon_cs_reloc {
947 uint32_t handle; 973 uint32_t handle;
diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h
index b75482112428..c15d781ecc0f 100644
--- a/include/uapi/drm/tegra_drm.h
+++ b/include/uapi/drm/tegra_drm.h
@@ -129,6 +129,44 @@ struct drm_tegra_submit {
129 __u32 reserved[5]; /* future expansion */ 129 __u32 reserved[5]; /* future expansion */
130}; 130};
131 131
132#define DRM_TEGRA_GEM_TILING_MODE_PITCH 0
133#define DRM_TEGRA_GEM_TILING_MODE_TILED 1
134#define DRM_TEGRA_GEM_TILING_MODE_BLOCK 2
135
136struct drm_tegra_gem_set_tiling {
137 /* input */
138 __u32 handle;
139 __u32 mode;
140 __u32 value;
141 __u32 pad;
142};
143
144struct drm_tegra_gem_get_tiling {
145 /* input */
146 __u32 handle;
147 /* output */
148 __u32 mode;
149 __u32 value;
150 __u32 pad;
151};
152
153#define DRM_TEGRA_GEM_BOTTOM_UP (1 << 0)
154#define DRM_TEGRA_GEM_FLAGS (DRM_TEGRA_GEM_BOTTOM_UP)
155
156struct drm_tegra_gem_set_flags {
157 /* input */
158 __u32 handle;
159 /* output */
160 __u32 flags;
161};
162
163struct drm_tegra_gem_get_flags {
164 /* input */
165 __u32 handle;
166 /* output */
167 __u32 flags;
168};
169
132#define DRM_TEGRA_GEM_CREATE 0x00 170#define DRM_TEGRA_GEM_CREATE 0x00
133#define DRM_TEGRA_GEM_MMAP 0x01 171#define DRM_TEGRA_GEM_MMAP 0x01
134#define DRM_TEGRA_SYNCPT_READ 0x02 172#define DRM_TEGRA_SYNCPT_READ 0x02
@@ -139,6 +177,10 @@ struct drm_tegra_submit {
139#define DRM_TEGRA_GET_SYNCPT 0x07 177#define DRM_TEGRA_GET_SYNCPT 0x07
140#define DRM_TEGRA_SUBMIT 0x08 178#define DRM_TEGRA_SUBMIT 0x08
141#define DRM_TEGRA_GET_SYNCPT_BASE 0x09 179#define DRM_TEGRA_GET_SYNCPT_BASE 0x09
180#define DRM_TEGRA_GEM_SET_TILING 0x0a
181#define DRM_TEGRA_GEM_GET_TILING 0x0b
182#define DRM_TEGRA_GEM_SET_FLAGS 0x0c
183#define DRM_TEGRA_GEM_GET_FLAGS 0x0d
142 184
143#define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create) 185#define DRM_IOCTL_TEGRA_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_CREATE, struct drm_tegra_gem_create)
144#define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap) 186#define DRM_IOCTL_TEGRA_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_MMAP, struct drm_tegra_gem_mmap)
@@ -150,5 +192,9 @@ struct drm_tegra_submit {
150#define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt) 192#define DRM_IOCTL_TEGRA_GET_SYNCPT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT, struct drm_tegra_get_syncpt)
151#define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit) 193#define DRM_IOCTL_TEGRA_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_SUBMIT, struct drm_tegra_submit)
152#define DRM_IOCTL_TEGRA_GET_SYNCPT_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT_BASE, struct drm_tegra_get_syncpt_base) 194#define DRM_IOCTL_TEGRA_GET_SYNCPT_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GET_SYNCPT_BASE, struct drm_tegra_get_syncpt_base)
195#define DRM_IOCTL_TEGRA_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_TILING, struct drm_tegra_gem_set_tiling)
196#define DRM_IOCTL_TEGRA_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_TILING, struct drm_tegra_gem_get_tiling)
197#define DRM_IOCTL_TEGRA_GEM_SET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_SET_FLAGS, struct drm_tegra_gem_set_flags)
198#define DRM_IOCTL_TEGRA_GEM_GET_FLAGS DRM_IOWR(DRM_COMMAND_BASE + DRM_TEGRA_GEM_GET_FLAGS, struct drm_tegra_gem_get_flags)
153 199
154#endif 200#endif
diff --git a/include/uapi/drm/vmwgfx_drm.h b/include/uapi/drm/vmwgfx_drm.h
index 4fc66f6b12ce..c472bedbe38e 100644
--- a/include/uapi/drm/vmwgfx_drm.h
+++ b/include/uapi/drm/vmwgfx_drm.h
@@ -29,7 +29,7 @@
29#define __VMWGFX_DRM_H__ 29#define __VMWGFX_DRM_H__
30 30
31#ifndef __KERNEL__ 31#ifndef __KERNEL__
32#include <drm.h> 32#include <drm/drm.h>
33#endif 33#endif
34 34
35#define DRM_VMW_MAX_SURFACE_FACES 6 35#define DRM_VMW_MAX_SURFACE_FACES 6
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 24e9033f8b3f..4c94f31a8c99 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -67,6 +67,8 @@ header-y += bfs_fs.h
67header-y += binfmts.h 67header-y += binfmts.h
68header-y += blkpg.h 68header-y += blkpg.h
69header-y += blktrace_api.h 69header-y += blktrace_api.h
70header-y += bpf.h
71header-y += bpf_common.h
70header-y += bpqether.h 72header-y += bpqether.h
71header-y += bsg.h 73header-y += bsg.h
72header-y += btrfs.h 74header-y += btrfs.h
@@ -123,6 +125,7 @@ header-y += filter.h
123header-y += firewire-cdev.h 125header-y += firewire-cdev.h
124header-y += firewire-constants.h 126header-y += firewire-constants.h
125header-y += flat.h 127header-y += flat.h
128header-y += fou.h
126header-y += fs.h 129header-y += fs.h
127header-y += fsl_hypervisor.h 130header-y += fsl_hypervisor.h
128header-y += fuse.h 131header-y += fuse.h
@@ -139,6 +142,7 @@ header-y += hid.h
139header-y += hiddev.h 142header-y += hiddev.h
140header-y += hidraw.h 143header-y += hidraw.h
141header-y += hpet.h 144header-y += hpet.h
145header-y += hsr_netlink.h
142header-y += hyperv.h 146header-y += hyperv.h
143header-y += hysdn_if.h 147header-y += hysdn_if.h
144header-y += i2c-dev.h 148header-y += i2c-dev.h
@@ -240,6 +244,7 @@ header-y += matroxfb.h
240header-y += mdio.h 244header-y += mdio.h
241header-y += media.h 245header-y += media.h
242header-y += mei.h 246header-y += mei.h
247header-y += memfd.h
243header-y += mempolicy.h 248header-y += mempolicy.h
244header-y += meye.h 249header-y += meye.h
245header-y += mic_common.h 250header-y += mic_common.h
@@ -248,6 +253,7 @@ header-y += mii.h
248header-y += minix_fs.h 253header-y += minix_fs.h
249header-y += mman.h 254header-y += mman.h
250header-y += mmtimer.h 255header-y += mmtimer.h
256header-y += mpls.h
251header-y += mqueue.h 257header-y += mqueue.h
252header-y += mroute.h 258header-y += mroute.h
253header-y += mroute6.h 259header-y += mroute6.h
@@ -353,6 +359,7 @@ header-y += serio.h
353header-y += shm.h 359header-y += shm.h
354header-y += signal.h 360header-y += signal.h
355header-y += signalfd.h 361header-y += signalfd.h
362header-y += smiapp.h
356header-y += snmp.h 363header-y += snmp.h
357header-y += sock_diag.h 364header-y += sock_diag.h
358header-y += socket.h 365header-y += socket.h
@@ -370,6 +377,7 @@ header-y += swab.h
370header-y += synclink.h 377header-y += synclink.h
371header-y += sysctl.h 378header-y += sysctl.h
372header-y += sysinfo.h 379header-y += sysinfo.h
380header-y += target_core_user.h
373header-y += taskstats.h 381header-y += taskstats.h
374header-y += tcp.h 382header-y += tcp.h
375header-y += tcp_metrics.h 383header-y += tcp_metrics.h
@@ -395,6 +403,7 @@ header-y += un.h
395header-y += unistd.h 403header-y += unistd.h
396header-y += unix_diag.h 404header-y += unix_diag.h
397header-y += usbdevice_fs.h 405header-y += usbdevice_fs.h
406header-y += usbip.h
398header-y += utime.h 407header-y += utime.h
399header-y += utsname.h 408header-y += utsname.h
400header-y += uuid.h 409header-y += uuid.h
@@ -418,6 +427,7 @@ header-y += virtio_net.h
418header-y += virtio_pci.h 427header-y += virtio_pci.h
419header-y += virtio_ring.h 428header-y += virtio_ring.h
420header-y += virtio_rng.h 429header-y += virtio_rng.h
430header=y += vm_sockets.h
421header-y += vt.h 431header-y += vt.h
422header-y += wait.h 432header-y += wait.h
423header-y += wanrouter.h 433header-y += wanrouter.h
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 3b9ff33e1768..d4dbef14d4df 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -352,6 +352,7 @@ enum {
352#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 352#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
353#define AUDIT_ARCH_M32R (EM_M32R) 353#define AUDIT_ARCH_M32R (EM_M32R)
354#define AUDIT_ARCH_M68K (EM_68K) 354#define AUDIT_ARCH_M68K (EM_68K)
355#define AUDIT_ARCH_MICROBLAZE (EM_MICROBLAZE)
355#define AUDIT_ARCH_MIPS (EM_MIPS) 356#define AUDIT_ARCH_MIPS (EM_MIPS)
356#define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE) 357#define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE)
357#define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT) 358#define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT)
@@ -445,17 +446,4 @@ struct audit_rule_data {
445 char buf[0]; /* string fields buffer */ 446 char buf[0]; /* string fields buffer */
446}; 447};
447 448
448/* audit_rule is supported to maintain backward compatibility with
449 * userspace. It supports integer fields only and corresponds to
450 * AUDIT_ADD, AUDIT_DEL and AUDIT_LIST requests.
451 */
452struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */
453 __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
454 __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
455 __u32 field_count;
456 __u32 mask[AUDIT_BITMASK_SIZE];
457 __u32 fields[AUDIT_MAX_FIELDS];
458 __u32 values[AUDIT_MAX_FIELDS];
459};
460
461#endif /* _UAPI_LINUX_AUDIT_H_ */ 449#endif /* _UAPI_LINUX_AUDIT_H_ */
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
new file mode 100644
index 000000000000..d18316f9e9c4
--- /dev/null
+++ b/include/uapi/linux/bpf.h
@@ -0,0 +1,156 @@
1/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
2 *
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of version 2 of the GNU General Public
5 * License as published by the Free Software Foundation.
6 */
7#ifndef _UAPI__LINUX_BPF_H__
8#define _UAPI__LINUX_BPF_H__
9
10#include <linux/types.h>
11#include <linux/bpf_common.h>
12
13/* Extended instruction set based on top of classic BPF */
14
15/* instruction classes */
16#define BPF_ALU64 0x07 /* alu mode in double word width */
17
18/* ld/ldx fields */
19#define BPF_DW 0x18 /* double word */
20#define BPF_XADD 0xc0 /* exclusive add */
21
22/* alu/jmp fields */
23#define BPF_MOV 0xb0 /* mov reg to reg */
24#define BPF_ARSH 0xc0 /* sign extending arithmetic shift right */
25
26/* change endianness of a register */
27#define BPF_END 0xd0 /* flags for endianness conversion: */
28#define BPF_TO_LE 0x00 /* convert to little-endian */
29#define BPF_TO_BE 0x08 /* convert to big-endian */
30#define BPF_FROM_LE BPF_TO_LE
31#define BPF_FROM_BE BPF_TO_BE
32
33#define BPF_JNE 0x50 /* jump != */
34#define BPF_JSGT 0x60 /* SGT is signed '>', GT in x86 */
35#define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */
36#define BPF_CALL 0x80 /* function call */
37#define BPF_EXIT 0x90 /* function return */
38
39/* Register numbers */
40enum {
41 BPF_REG_0 = 0,
42 BPF_REG_1,
43 BPF_REG_2,
44 BPF_REG_3,
45 BPF_REG_4,
46 BPF_REG_5,
47 BPF_REG_6,
48 BPF_REG_7,
49 BPF_REG_8,
50 BPF_REG_9,
51 BPF_REG_10,
52 __MAX_BPF_REG,
53};
54
55/* BPF has 10 general purpose 64-bit registers and stack frame. */
56#define MAX_BPF_REG __MAX_BPF_REG
57
58struct bpf_insn {
59 __u8 code; /* opcode */
60 __u8 dst_reg:4; /* dest register */
61 __u8 src_reg:4; /* source register */
62 __s16 off; /* signed offset */
63 __s32 imm; /* signed immediate constant */
64};
65
66/* BPF syscall commands */
67enum bpf_cmd {
68 /* create a map with given type and attributes
69 * fd = bpf(BPF_MAP_CREATE, union bpf_attr *, u32 size)
70 * returns fd or negative error
71 * map is deleted when fd is closed
72 */
73 BPF_MAP_CREATE,
74
75 /* lookup key in a given map
76 * err = bpf(BPF_MAP_LOOKUP_ELEM, union bpf_attr *attr, u32 size)
77 * Using attr->map_fd, attr->key, attr->value
78 * returns zero and stores found elem into value
79 * or negative error
80 */
81 BPF_MAP_LOOKUP_ELEM,
82
83 /* create or update key/value pair in a given map
84 * err = bpf(BPF_MAP_UPDATE_ELEM, union bpf_attr *attr, u32 size)
85 * Using attr->map_fd, attr->key, attr->value
86 * returns zero or negative error
87 */
88 BPF_MAP_UPDATE_ELEM,
89
90 /* find and delete elem by key in a given map
91 * err = bpf(BPF_MAP_DELETE_ELEM, union bpf_attr *attr, u32 size)
92 * Using attr->map_fd, attr->key
93 * returns zero or negative error
94 */
95 BPF_MAP_DELETE_ELEM,
96
97 /* lookup key in a given map and return next key
98 * err = bpf(BPF_MAP_GET_NEXT_KEY, union bpf_attr *attr, u32 size)
99 * Using attr->map_fd, attr->key, attr->next_key
100 * returns zero and stores next key or negative error
101 */
102 BPF_MAP_GET_NEXT_KEY,
103
104 /* verify and load eBPF program
105 * prog_fd = bpf(BPF_PROG_LOAD, union bpf_attr *attr, u32 size)
106 * Using attr->prog_type, attr->insns, attr->license
107 * returns fd or negative error
108 */
109 BPF_PROG_LOAD,
110};
111
112enum bpf_map_type {
113 BPF_MAP_TYPE_UNSPEC,
114};
115
116enum bpf_prog_type {
117 BPF_PROG_TYPE_UNSPEC,
118};
119
120union bpf_attr {
121 struct { /* anonymous struct used by BPF_MAP_CREATE command */
122 __u32 map_type; /* one of enum bpf_map_type */
123 __u32 key_size; /* size of key in bytes */
124 __u32 value_size; /* size of value in bytes */
125 __u32 max_entries; /* max number of entries in a map */
126 };
127
128 struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
129 __u32 map_fd;
130 __aligned_u64 key;
131 union {
132 __aligned_u64 value;
133 __aligned_u64 next_key;
134 };
135 };
136
137 struct { /* anonymous struct used by BPF_PROG_LOAD command */
138 __u32 prog_type; /* one of enum bpf_prog_type */
139 __u32 insn_cnt;
140 __aligned_u64 insns;
141 __aligned_u64 license;
142 __u32 log_level; /* verbosity level of verifier */
143 __u32 log_size; /* size of user buffer */
144 __aligned_u64 log_buf; /* user supplied buffer */
145 };
146} __attribute__((aligned(8)));
147
148/* integer value in 'imm' field of BPF_CALL instruction selects which helper
149 * function eBPF program intends to call
150 */
151enum bpf_func_id {
152 BPF_FUNC_unspec,
153 __BPF_FUNC_MAX_ID,
154};
155
156#endif /* _UAPI__LINUX_BPF_H__ */
diff --git a/include/uapi/linux/bpf_common.h b/include/uapi/linux/bpf_common.h
new file mode 100644
index 000000000000..a5c220e0828f
--- /dev/null
+++ b/include/uapi/linux/bpf_common.h
@@ -0,0 +1,55 @@
1#ifndef _UAPI__LINUX_BPF_COMMON_H__
2#define _UAPI__LINUX_BPF_COMMON_H__
3
4/* Instruction classes */
5#define BPF_CLASS(code) ((code) & 0x07)
6#define BPF_LD 0x00
7#define BPF_LDX 0x01
8#define BPF_ST 0x02
9#define BPF_STX 0x03
10#define BPF_ALU 0x04
11#define BPF_JMP 0x05
12#define BPF_RET 0x06
13#define BPF_MISC 0x07
14
15/* ld/ldx fields */
16#define BPF_SIZE(code) ((code) & 0x18)
17#define BPF_W 0x00
18#define BPF_H 0x08
19#define BPF_B 0x10
20#define BPF_MODE(code) ((code) & 0xe0)
21#define BPF_IMM 0x00
22#define BPF_ABS 0x20
23#define BPF_IND 0x40
24#define BPF_MEM 0x60
25#define BPF_LEN 0x80
26#define BPF_MSH 0xa0
27
28/* alu/jmp fields */
29#define BPF_OP(code) ((code) & 0xf0)
30#define BPF_ADD 0x00
31#define BPF_SUB 0x10
32#define BPF_MUL 0x20
33#define BPF_DIV 0x30
34#define BPF_OR 0x40
35#define BPF_AND 0x50
36#define BPF_LSH 0x60
37#define BPF_RSH 0x70
38#define BPF_NEG 0x80
39#define BPF_MOD 0x90
40#define BPF_XOR 0xa0
41
42#define BPF_JA 0x00
43#define BPF_JEQ 0x10
44#define BPF_JGT 0x20
45#define BPF_JGE 0x30
46#define BPF_JSET 0x40
47#define BPF_SRC(code) ((code) & 0x08)
48#define BPF_K 0x00
49#define BPF_X 0x08
50
51#ifndef BPF_MAXINSNS
52#define BPF_MAXINSNS 4096
53#endif
54
55#endif /* _UAPI__LINUX_BPF_COMMON_H__ */
diff --git a/include/uapi/linux/bsg.h b/include/uapi/linux/bsg.h
index 7a12e1c0f371..02986cf8b6f1 100644
--- a/include/uapi/linux/bsg.h
+++ b/include/uapi/linux/bsg.h
@@ -10,12 +10,13 @@
10#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2 10#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2
11 11
12/* 12/*
13 * For flags member below 13 * For flag constants below:
14 * sg.h sg_io_hdr also has bits defined for it's flags member. However 14 * sg.h sg_io_hdr also has bits defined for it's flags member. These
15 * none of these bits are implemented/used by bsg. The bits below are 15 * two flag values (0x10 and 0x20) have the same meaning in sg.h . For
16 * allocated to not conflict with sg.h ones anyway. 16 * bsg the BSG_FLAG_Q_AT_HEAD flag is ignored since it is the deafult.
17 */ 17 */
18#define BSG_FLAG_Q_AT_TAIL 0x10 /* default, == 0 at this bit, is Q_AT_HEAD */ 18#define BSG_FLAG_Q_AT_TAIL 0x10 /* default is Q_AT_HEAD */
19#define BSG_FLAG_Q_AT_HEAD 0x20
19 20
20struct sg_io_v4 { 21struct sg_io_v4 {
21 __s32 guard; /* [i] 'Q' to differentiate from v3 */ 22 __s32 guard; /* [i] 'Q' to differentiate from v3 */
diff --git a/include/uapi/linux/dm-ioctl.h b/include/uapi/linux/dm-ioctl.h
index c8a4302093a3..3315ab21f728 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 27 270#define DM_VERSION_MINOR 28
271#define DM_VERSION_PATCHLEVEL 0 271#define DM_VERSION_PATCHLEVEL 0
272#define DM_VERSION_EXTRA "-ioctl (2013-10-30)" 272#define DM_VERSION_EXTRA "-ioctl (2014-09-17)"
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/elf-em.h b/include/uapi/linux/elf-em.h
index 01529bd96438..aa90bc98b6e2 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -32,6 +32,7 @@
32#define EM_V850 87 /* NEC v850 */ 32#define EM_V850 87 /* NEC v850 */
33#define EM_M32R 88 /* Renesas M32R */ 33#define EM_M32R 88 /* Renesas M32R */
34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ 34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */
35#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
35#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ 36#define EM_BLACKFIN 106 /* ADI Blackfin Processor */
36#define EM_TI_C6000 140 /* TI C6X DSPs */ 37#define EM_TI_C6000 140 /* TI C6X DSPs */
37#define EM_AARCH64 183 /* ARM 64 bit */ 38#define EM_AARCH64 183 /* ARM 64 bit */
diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
index ef6103bf1f9b..ea9bf2561b9e 100644
--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -391,6 +391,8 @@ typedef struct elf64_shdr {
391#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */ 391#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
392#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */ 392#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
393#define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */ 393#define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */
394#define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15 upper half */
395#define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31 */
394#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */ 396#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
395#define NT_ARM_TLS 0x401 /* ARM TLS register */ 397#define NT_ARM_TLS 0x401 /* ARM TLS register */
396#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */ 398#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index e3c7a719c76b..99b43056a6fe 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -209,6 +209,33 @@ struct ethtool_value {
209 __u32 data; 209 __u32 data;
210}; 210};
211 211
212enum tunable_id {
213 ETHTOOL_ID_UNSPEC,
214 ETHTOOL_RX_COPYBREAK,
215 ETHTOOL_TX_COPYBREAK,
216};
217
218enum tunable_type_id {
219 ETHTOOL_TUNABLE_UNSPEC,
220 ETHTOOL_TUNABLE_U8,
221 ETHTOOL_TUNABLE_U16,
222 ETHTOOL_TUNABLE_U32,
223 ETHTOOL_TUNABLE_U64,
224 ETHTOOL_TUNABLE_STRING,
225 ETHTOOL_TUNABLE_S8,
226 ETHTOOL_TUNABLE_S16,
227 ETHTOOL_TUNABLE_S32,
228 ETHTOOL_TUNABLE_S64,
229};
230
231struct ethtool_tunable {
232 __u32 cmd;
233 __u32 id;
234 __u32 type_id;
235 __u32 len;
236 void *data[0];
237};
238
212/** 239/**
213 * struct ethtool_regs - hardware register dump 240 * struct ethtool_regs - hardware register dump
214 * @cmd: Command number = %ETHTOOL_GREGS 241 * @cmd: Command number = %ETHTOOL_GREGS
@@ -1152,6 +1179,8 @@ enum ethtool_sfeatures_retval_bits {
1152 1179
1153#define ETHTOOL_GRSSH 0x00000046 /* Get RX flow hash configuration */ 1180#define ETHTOOL_GRSSH 0x00000046 /* Get RX flow hash configuration */
1154#define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */ 1181#define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */
1182#define ETHTOOL_GTUNABLE 0x00000048 /* Get tunable configuration */
1183#define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */
1155 1184
1156/* compatibility with older code */ 1185/* compatibility with older code */
1157#define SPARC_ETH_GSET ETHTOOL_GSET 1186#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h
index 074b886c6be0..beed138bd359 100644
--- a/include/uapi/linux/fcntl.h
+++ b/include/uapi/linux/fcntl.h
@@ -28,6 +28,21 @@
28#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8) 28#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
29 29
30/* 30/*
31 * Set/Get seals
32 */
33#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
34#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
35
36/*
37 * Types of seals
38 */
39#define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */
40#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
41#define F_SEAL_GROW 0x0004 /* prevent file from growing */
42#define F_SEAL_WRITE 0x0008 /* prevent writes */
43/* (1U << 31) is reserved for signed error codes */
44
45/*
31 * Types of directory notifications that may be requested. 46 * Types of directory notifications that may be requested.
32 */ 47 */
33#define DN_ACCESS 0x00000001 /* File accessed */ 48#define DN_ACCESS 0x00000001 /* File accessed */
diff --git a/include/uapi/linux/filter.h b/include/uapi/linux/filter.h
index 253b4d42cf2b..47785d5ecf17 100644
--- a/include/uapi/linux/filter.h
+++ b/include/uapi/linux/filter.h
@@ -7,7 +7,7 @@
7 7
8#include <linux/compiler.h> 8#include <linux/compiler.h>
9#include <linux/types.h> 9#include <linux/types.h>
10 10#include <linux/bpf_common.h>
11 11
12/* 12/*
13 * Current version of the filter code architecture. 13 * Current version of the filter code architecture.
@@ -32,56 +32,6 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
32 struct sock_filter __user *filter; 32 struct sock_filter __user *filter;
33}; 33};
34 34
35/*
36 * Instruction classes
37 */
38
39#define BPF_CLASS(code) ((code) & 0x07)
40#define BPF_LD 0x00
41#define BPF_LDX 0x01
42#define BPF_ST 0x02
43#define BPF_STX 0x03
44#define BPF_ALU 0x04
45#define BPF_JMP 0x05
46#define BPF_RET 0x06
47#define BPF_MISC 0x07
48
49/* ld/ldx fields */
50#define BPF_SIZE(code) ((code) & 0x18)
51#define BPF_W 0x00
52#define BPF_H 0x08
53#define BPF_B 0x10
54#define BPF_MODE(code) ((code) & 0xe0)
55#define BPF_IMM 0x00
56#define BPF_ABS 0x20
57#define BPF_IND 0x40
58#define BPF_MEM 0x60
59#define BPF_LEN 0x80
60#define BPF_MSH 0xa0
61
62/* alu/jmp fields */
63#define BPF_OP(code) ((code) & 0xf0)
64#define BPF_ADD 0x00
65#define BPF_SUB 0x10
66#define BPF_MUL 0x20
67#define BPF_DIV 0x30
68#define BPF_OR 0x40
69#define BPF_AND 0x50
70#define BPF_LSH 0x60
71#define BPF_RSH 0x70
72#define BPF_NEG 0x80
73#define BPF_MOD 0x90
74#define BPF_XOR 0xa0
75
76#define BPF_JA 0x00
77#define BPF_JEQ 0x10
78#define BPF_JGT 0x20
79#define BPF_JGE 0x30
80#define BPF_JSET 0x40
81#define BPF_SRC(code) ((code) & 0x08)
82#define BPF_K 0x00
83#define BPF_X 0x08
84
85/* ret - BPF_K and BPF_X also apply */ 35/* ret - BPF_K and BPF_X also apply */
86#define BPF_RVAL(code) ((code) & 0x18) 36#define BPF_RVAL(code) ((code) & 0x18)
87#define BPF_A 0x10 37#define BPF_A 0x10
@@ -91,10 +41,6 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
91#define BPF_TAX 0x00 41#define BPF_TAX 0x00
92#define BPF_TXA 0x80 42#define BPF_TXA 0x80
93 43
94#ifndef BPF_MAXINSNS
95#define BPF_MAXINSNS 4096
96#endif
97
98/* 44/*
99 * Macros for filter block array initializers. 45 * Macros for filter block array initializers.
100 */ 46 */
diff --git a/include/uapi/linux/fou.h b/include/uapi/linux/fou.h
new file mode 100644
index 000000000000..8df06894da23
--- /dev/null
+++ b/include/uapi/linux/fou.h
@@ -0,0 +1,39 @@
1/* fou.h - FOU Interface */
2
3#ifndef _UAPI_LINUX_FOU_H
4#define _UAPI_LINUX_FOU_H
5
6/* NETLINK_GENERIC related info
7 */
8#define FOU_GENL_NAME "fou"
9#define FOU_GENL_VERSION 0x1
10
11enum {
12 FOU_ATTR_UNSPEC,
13 FOU_ATTR_PORT, /* u16 */
14 FOU_ATTR_AF, /* u8 */
15 FOU_ATTR_IPPROTO, /* u8 */
16 FOU_ATTR_TYPE, /* u8 */
17
18 __FOU_ATTR_MAX,
19};
20
21#define FOU_ATTR_MAX (__FOU_ATTR_MAX - 1)
22
23enum {
24 FOU_CMD_UNSPEC,
25 FOU_CMD_ADD,
26 FOU_CMD_DEL,
27
28 __FOU_CMD_MAX,
29};
30
31enum {
32 FOU_ENCAP_UNSPEC,
33 FOU_ENCAP_DIRECT,
34 FOU_ENCAP_GUE,
35};
36
37#define FOU_CMD_MAX (__FOU_CMD_MAX - 1)
38
39#endif /* _UAPI_LINUX_FOU_H */
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index ca1a11bb4443..3735fa0a6784 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -37,6 +37,7 @@
37 37
38#define RENAME_NOREPLACE (1 << 0) /* Don't overwrite target */ 38#define RENAME_NOREPLACE (1 << 0) /* Don't overwrite target */
39#define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */ 39#define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */
40#define RENAME_WHITEOUT (1 << 2) /* Whiteout source */
40 41
41struct fstrim_range { 42struct fstrim_range {
42 __u64 start; 43 __u64 start;
diff --git a/include/uapi/linux/genwqe/genwqe_card.h b/include/uapi/linux/genwqe/genwqe_card.h
index 4fc065f29255..baa93fb4cd4f 100644
--- a/include/uapi/linux/genwqe/genwqe_card.h
+++ b/include/uapi/linux/genwqe/genwqe_card.h
@@ -8,7 +8,7 @@
8 * 8 *
9 * Author: Frank Haverkamp <haver@linux.vnet.ibm.com> 9 * Author: Frank Haverkamp <haver@linux.vnet.ibm.com>
10 * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com> 10 * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com>
11 * Author: Michael Jung <mijung@de.ibm.com> 11 * Author: Michael Jung <mijung@gmx.net>
12 * Author: Michael Ruettger <michael@ibmra.de> 12 * Author: Michael Ruettger <michael@ibmra.de>
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h
index 78e4a86030dd..0a8e6badb29b 100644
--- a/include/uapi/linux/hyperv.h
+++ b/include/uapi/linux/hyperv.h
@@ -137,7 +137,7 @@ struct hv_do_fcopy {
137 __u64 offset; 137 __u64 offset;
138 __u32 size; 138 __u32 size;
139 __u8 data[DATA_FRAGMENT]; 139 __u8 data[DATA_FRAGMENT];
140}; 140} __attribute__((packed));
141 141
142/* 142/*
143 * An implementation of HyperV key value pair (KVP) functionality for Linux. 143 * An implementation of HyperV key value pair (KVP) functionality for Linux.
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
index 39f621a9fe82..da17e456908d 100644
--- a/include/uapi/linux/if_bridge.h
+++ b/include/uapi/linux/if_bridge.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/if_ether.h> 17#include <linux/if_ether.h>
18#include <linux/in6.h>
18 19
19#define SYSFS_BRIDGE_ATTR "bridge" 20#define SYSFS_BRIDGE_ATTR "bridge"
20#define SYSFS_BRIDGE_FDB "brforward" 21#define SYSFS_BRIDGE_FDB "brforward"
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
index 0f8210b8e0bc..aa63ed023c2b 100644
--- a/include/uapi/linux/if_ether.h
+++ b/include/uapi/linux/if_ether.h
@@ -128,6 +128,7 @@
128#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ 128#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */
129#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */ 129#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */
130#define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */ 130#define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */
131#define ETH_P_XDSA 0x00F8 /* Multiplexed DSA protocol */
131 132
132/* 133/*
133 * This is an Ethernet frame header. 134 * This is an Ethernet frame header.
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index ff957604a721..0bdb77e16875 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -215,6 +215,18 @@ enum in6_addr_gen_mode {
215 IN6_ADDR_GEN_MODE_NONE, 215 IN6_ADDR_GEN_MODE_NONE,
216}; 216};
217 217
218/* Bridge section */
219
220enum {
221 IFLA_BR_UNSPEC,
222 IFLA_BR_FORWARD_DELAY,
223 IFLA_BR_HELLO_TIME,
224 IFLA_BR_MAX_AGE,
225 __IFLA_BR_MAX,
226};
227
228#define IFLA_BR_MAX (__IFLA_BR_MAX - 1)
229
218enum { 230enum {
219 BRIDGE_MODE_UNSPEC, 231 BRIDGE_MODE_UNSPEC,
220 BRIDGE_MODE_HAIRPIN, 232 BRIDGE_MODE_HAIRPIN,
@@ -291,6 +303,10 @@ enum {
291 IFLA_MACVLAN_UNSPEC, 303 IFLA_MACVLAN_UNSPEC,
292 IFLA_MACVLAN_MODE, 304 IFLA_MACVLAN_MODE,
293 IFLA_MACVLAN_FLAGS, 305 IFLA_MACVLAN_FLAGS,
306 IFLA_MACVLAN_MACADDR_MODE,
307 IFLA_MACVLAN_MACADDR,
308 IFLA_MACVLAN_MACADDR_DATA,
309 IFLA_MACVLAN_MACADDR_COUNT,
294 __IFLA_MACVLAN_MAX, 310 __IFLA_MACVLAN_MAX,
295}; 311};
296 312
@@ -301,6 +317,14 @@ enum macvlan_mode {
301 MACVLAN_MODE_VEPA = 2, /* talk to other ports through ext bridge */ 317 MACVLAN_MODE_VEPA = 2, /* talk to other ports through ext bridge */
302 MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */ 318 MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */
303 MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */ 319 MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */
320 MACVLAN_MODE_SOURCE = 16,/* use source MAC address list to assign */
321};
322
323enum macvlan_macaddr_mode {
324 MACVLAN_MACADDR_ADD,
325 MACVLAN_MACADDR_DEL,
326 MACVLAN_MACADDR_FLUSH,
327 MACVLAN_MACADDR_SET,
304}; 328};
305 329
306#define MACVLAN_FLAG_NOPROMISC 1 330#define MACVLAN_FLAG_NOPROMISC 1
diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index 3bce9e9d9f7c..280d9e092283 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -53,10 +53,23 @@ enum {
53 IFLA_IPTUN_6RD_RELAY_PREFIX, 53 IFLA_IPTUN_6RD_RELAY_PREFIX,
54 IFLA_IPTUN_6RD_PREFIXLEN, 54 IFLA_IPTUN_6RD_PREFIXLEN,
55 IFLA_IPTUN_6RD_RELAY_PREFIXLEN, 55 IFLA_IPTUN_6RD_RELAY_PREFIXLEN,
56 IFLA_IPTUN_ENCAP_TYPE,
57 IFLA_IPTUN_ENCAP_FLAGS,
58 IFLA_IPTUN_ENCAP_SPORT,
59 IFLA_IPTUN_ENCAP_DPORT,
56 __IFLA_IPTUN_MAX, 60 __IFLA_IPTUN_MAX,
57}; 61};
58#define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1) 62#define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1)
59 63
64enum tunnel_encap_types {
65 TUNNEL_ENCAP_NONE,
66 TUNNEL_ENCAP_FOU,
67 TUNNEL_ENCAP_GUE,
68};
69
70#define TUNNEL_ENCAP_FLAG_CSUM (1<<0)
71#define TUNNEL_ENCAP_FLAG_CSUM6 (1<<1)
72
60/* SIT-mode i_flags */ 73/* SIT-mode i_flags */
61#define SIT_ISATAP 0x0001 74#define SIT_ISATAP 0x0001
62 75
@@ -94,6 +107,10 @@ enum {
94 IFLA_GRE_ENCAP_LIMIT, 107 IFLA_GRE_ENCAP_LIMIT,
95 IFLA_GRE_FLOWINFO, 108 IFLA_GRE_FLOWINFO,
96 IFLA_GRE_FLAGS, 109 IFLA_GRE_FLAGS,
110 IFLA_GRE_ENCAP_TYPE,
111 IFLA_GRE_ENCAP_FLAGS,
112 IFLA_GRE_ENCAP_SPORT,
113 IFLA_GRE_ENCAP_DPORT,
97 __IFLA_GRE_MAX, 114 __IFLA_GRE_MAX,
98}; 115};
99 116
diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h
index 22b7a69619d8..74a2a1773494 100644
--- a/include/uapi/linux/in6.h
+++ b/include/uapi/linux/in6.h
@@ -233,7 +233,6 @@ struct in6_flowlabel_req {
233#if 0 /* not yet */ 233#if 0 /* not yet */
234#define IPV6_USE_MIN_MTU 63 234#define IPV6_USE_MIN_MTU 63
235#endif 235#endif
236#define IPV6_AUTOFLOWLABEL 64
237 236
238/* 237/*
239 * Netfilter (1) 238 * Netfilter (1)
@@ -262,6 +261,7 @@ struct in6_flowlabel_req {
262 * IP6T_SO_ORIGINAL_DST 80 261 * IP6T_SO_ORIGINAL_DST 80
263 */ 262 */
264 263
264#define IPV6_AUTOFLOWLABEL 70
265/* RFC5014: Source address selection */ 265/* RFC5014: Source address selection */
266#define IPV6_ADDR_PREFERENCES 72 266#define IPV6_ADDR_PREFERENCES 72
267 267
diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h
index bbde90fa5838..d65c0a09efd3 100644
--- a/include/uapi/linux/inet_diag.h
+++ b/include/uapi/linux/inet_diag.h
@@ -110,10 +110,10 @@ enum {
110 INET_DIAG_TCLASS, 110 INET_DIAG_TCLASS,
111 INET_DIAG_SKMEMINFO, 111 INET_DIAG_SKMEMINFO,
112 INET_DIAG_SHUTDOWN, 112 INET_DIAG_SHUTDOWN,
113 INET_DIAG_DCTCPINFO,
113}; 114};
114 115
115#define INET_DIAG_MAX INET_DIAG_SHUTDOWN 116#define INET_DIAG_MAX INET_DIAG_DCTCPINFO
116
117 117
118/* INET_DIAG_MEM */ 118/* INET_DIAG_MEM */
119 119
@@ -133,5 +133,14 @@ struct tcpvegas_info {
133 __u32 tcpv_minrtt; 133 __u32 tcpv_minrtt;
134}; 134};
135 135
136/* INET_DIAG_DCTCPINFO */
137
138struct tcp_dctcp_info {
139 __u16 dctcp_enabled;
140 __u16 dctcp_ce_state;
141 __u32 dctcp_alpha;
142 __u32 dctcp_ab_ecn;
143 __u32 dctcp_ab_tot;
144};
136 145
137#endif /* _UAPI_INET_DIAG_H_ */ 146#endif /* _UAPI_INET_DIAG_H_ */
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index 19df18c9b8be..a1d7e931ab72 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -165,6 +165,7 @@ struct input_keymap_entry {
165#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */ 165#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */
166#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ 166#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */
167#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ 167#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
168#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
168 169
169#define INPUT_PROP_MAX 0x1f 170#define INPUT_PROP_MAX 0x1f
170#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) 171#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
@@ -738,6 +739,13 @@ struct input_keymap_entry {
738#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ 739#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
739#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ 740#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
740 741
742#define KEY_KBDINPUTASSIST_PREV 0x260
743#define KEY_KBDINPUTASSIST_NEXT 0x261
744#define KEY_KBDINPUTASSIST_PREVGROUP 0x262
745#define KEY_KBDINPUTASSIST_NEXTGROUP 0x263
746#define KEY_KBDINPUTASSIST_ACCEPT 0x264
747#define KEY_KBDINPUTASSIST_CANCEL 0x265
748
741#define BTN_TRIGGER_HAPPY 0x2c0 749#define BTN_TRIGGER_HAPPY 0x2c0
742#define BTN_TRIGGER_HAPPY1 0x2c0 750#define BTN_TRIGGER_HAPPY1 0x2c0
743#define BTN_TRIGGER_HAPPY2 0x2c1 751#define BTN_TRIGGER_HAPPY2 0x2c1
diff --git a/include/uapi/linux/ip_vs.h b/include/uapi/linux/ip_vs.h
index fbcffe8041f7..cabe95d5b461 100644
--- a/include/uapi/linux/ip_vs.h
+++ b/include/uapi/linux/ip_vs.h
@@ -384,6 +384,9 @@ enum {
384 IPVS_DEST_ATTR_PERSIST_CONNS, /* persistent connections */ 384 IPVS_DEST_ATTR_PERSIST_CONNS, /* persistent connections */
385 385
386 IPVS_DEST_ATTR_STATS, /* nested attribute for dest stats */ 386 IPVS_DEST_ATTR_STATS, /* nested attribute for dest stats */
387
388 IPVS_DEST_ATTR_ADDR_FAMILY, /* Address family of address */
389
387 __IPVS_DEST_ATTR_MAX, 390 __IPVS_DEST_ATTR_MAX,
388}; 391};
389 392
diff --git a/include/uapi/linux/kernel-page-flags.h b/include/uapi/linux/kernel-page-flags.h
index 5116a0e48172..2f96d233c980 100644
--- a/include/uapi/linux/kernel-page-flags.h
+++ b/include/uapi/linux/kernel-page-flags.h
@@ -31,6 +31,7 @@
31 31
32#define KPF_KSM 21 32#define KPF_KSM 21
33#define KPF_THP 22 33#define KPF_THP 22
34#define KPF_BALLOON 23
34 35
35 36
36#endif /* _UAPILINUX_KERNEL_PAGE_FLAGS_H */ 37#endif /* _UAPILINUX_KERNEL_PAGE_FLAGS_H */
diff --git a/include/uapi/linux/kexec.h b/include/uapi/linux/kexec.h
index d6629d49a243..6925f5b42f89 100644
--- a/include/uapi/linux/kexec.h
+++ b/include/uapi/linux/kexec.h
@@ -13,6 +13,17 @@
13#define KEXEC_PRESERVE_CONTEXT 0x00000002 13#define KEXEC_PRESERVE_CONTEXT 0x00000002
14#define KEXEC_ARCH_MASK 0xffff0000 14#define KEXEC_ARCH_MASK 0xffff0000
15 15
16/*
17 * Kexec file load interface flags.
18 * KEXEC_FILE_UNLOAD : Unload already loaded kexec/kdump image.
19 * KEXEC_FILE_ON_CRASH : Load/unload operation belongs to kdump image.
20 * KEXEC_FILE_NO_INITRAMFS : No initramfs is being loaded. Ignore the initrd
21 * fd field.
22 */
23#define KEXEC_FILE_UNLOAD 0x00000001
24#define KEXEC_FILE_ON_CRASH 0x00000002
25#define KEXEC_FILE_NO_INITRAMFS 0x00000004
26
16/* These values match the ELF architecture values. 27/* These values match the ELF architecture values.
17 * Unless there is a good reason that should continue to be the case. 28 * Unless there is a good reason that should continue to be the case.
18 */ 29 */
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 9b744af871d7..60768822b140 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -162,7 +162,7 @@ struct kvm_pit_config {
162#define KVM_EXIT_TPR_ACCESS 12 162#define KVM_EXIT_TPR_ACCESS 12
163#define KVM_EXIT_S390_SIEIC 13 163#define KVM_EXIT_S390_SIEIC 13
164#define KVM_EXIT_S390_RESET 14 164#define KVM_EXIT_S390_RESET 14
165#define KVM_EXIT_DCR 15 165#define KVM_EXIT_DCR 15 /* deprecated */
166#define KVM_EXIT_NMI 16 166#define KVM_EXIT_NMI 16
167#define KVM_EXIT_INTERNAL_ERROR 17 167#define KVM_EXIT_INTERNAL_ERROR 17
168#define KVM_EXIT_OSI 18 168#define KVM_EXIT_OSI 18
@@ -268,7 +268,7 @@ struct kvm_run {
268 __u64 trans_exc_code; 268 __u64 trans_exc_code;
269 __u32 pgm_code; 269 __u32 pgm_code;
270 } s390_ucontrol; 270 } s390_ucontrol;
271 /* KVM_EXIT_DCR */ 271 /* KVM_EXIT_DCR (deprecated) */
272 struct { 272 struct {
273 __u32 dcrn; 273 __u32 dcrn;
274 __u32 data; 274 __u32 data;
@@ -654,9 +654,7 @@ struct kvm_ppc_smmu_info {
654#endif 654#endif
655/* Bug in KVM_SET_USER_MEMORY_REGION fixed: */ 655/* Bug in KVM_SET_USER_MEMORY_REGION fixed: */
656#define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21 656#define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21
657#ifdef __KVM_HAVE_USER_NMI
658#define KVM_CAP_USER_NMI 22 657#define KVM_CAP_USER_NMI 22
659#endif
660#ifdef __KVM_HAVE_GUEST_DEBUG 658#ifdef __KVM_HAVE_GUEST_DEBUG
661#define KVM_CAP_SET_GUEST_DEBUG 23 659#define KVM_CAP_SET_GUEST_DEBUG 23
662#endif 660#endif
@@ -738,9 +736,7 @@ struct kvm_ppc_smmu_info {
738#define KVM_CAP_PPC_GET_SMMU_INFO 78 736#define KVM_CAP_PPC_GET_SMMU_INFO 78
739#define KVM_CAP_S390_COW 79 737#define KVM_CAP_S390_COW 79
740#define KVM_CAP_PPC_ALLOC_HTAB 80 738#define KVM_CAP_PPC_ALLOC_HTAB 80
741#ifdef __KVM_HAVE_READONLY_MEM
742#define KVM_CAP_READONLY_MEM 81 739#define KVM_CAP_READONLY_MEM 81
743#endif
744#define KVM_CAP_IRQFD_RESAMPLE 82 740#define KVM_CAP_IRQFD_RESAMPLE 82
745#define KVM_CAP_PPC_BOOKE_WATCHDOG 83 741#define KVM_CAP_PPC_BOOKE_WATCHDOG 83
746#define KVM_CAP_PPC_HTAB_FD 84 742#define KVM_CAP_PPC_HTAB_FD 84
@@ -763,6 +759,8 @@ struct kvm_ppc_smmu_info {
763#define KVM_CAP_VM_ATTRIBUTES 101 759#define KVM_CAP_VM_ATTRIBUTES 101
764#define KVM_CAP_ARM_PSCI_0_2 102 760#define KVM_CAP_ARM_PSCI_0_2 102
765#define KVM_CAP_PPC_FIXUP_HCALL 103 761#define KVM_CAP_PPC_FIXUP_HCALL 103
762#define KVM_CAP_PPC_ENABLE_HCALL 104
763#define KVM_CAP_CHECK_EXTENSION_VM 105
766 764
767#ifdef KVM_CAP_IRQ_ROUTING 765#ifdef KVM_CAP_IRQ_ROUTING
768 766
@@ -945,15 +943,25 @@ struct kvm_device_attr {
945 __u64 addr; /* userspace address of attr data */ 943 __u64 addr; /* userspace address of attr data */
946}; 944};
947 945
948#define KVM_DEV_TYPE_FSL_MPIC_20 1
949#define KVM_DEV_TYPE_FSL_MPIC_42 2
950#define KVM_DEV_TYPE_XICS 3
951#define KVM_DEV_TYPE_VFIO 4
952#define KVM_DEV_VFIO_GROUP 1 946#define KVM_DEV_VFIO_GROUP 1
953#define KVM_DEV_VFIO_GROUP_ADD 1 947#define KVM_DEV_VFIO_GROUP_ADD 1
954#define KVM_DEV_VFIO_GROUP_DEL 2 948#define KVM_DEV_VFIO_GROUP_DEL 2
955#define KVM_DEV_TYPE_ARM_VGIC_V2 5 949
956#define KVM_DEV_TYPE_FLIC 6 950enum kvm_device_type {
951 KVM_DEV_TYPE_FSL_MPIC_20 = 1,
952#define KVM_DEV_TYPE_FSL_MPIC_20 KVM_DEV_TYPE_FSL_MPIC_20
953 KVM_DEV_TYPE_FSL_MPIC_42,
954#define KVM_DEV_TYPE_FSL_MPIC_42 KVM_DEV_TYPE_FSL_MPIC_42
955 KVM_DEV_TYPE_XICS,
956#define KVM_DEV_TYPE_XICS KVM_DEV_TYPE_XICS
957 KVM_DEV_TYPE_VFIO,
958#define KVM_DEV_TYPE_VFIO KVM_DEV_TYPE_VFIO
959 KVM_DEV_TYPE_ARM_VGIC_V2,
960#define KVM_DEV_TYPE_ARM_VGIC_V2 KVM_DEV_TYPE_ARM_VGIC_V2
961 KVM_DEV_TYPE_FLIC,
962#define KVM_DEV_TYPE_FLIC KVM_DEV_TYPE_FLIC
963 KVM_DEV_TYPE_MAX,
964};
957 965
958/* 966/*
959 * ioctls for VM fds 967 * ioctls for VM fds
@@ -1091,7 +1099,7 @@ struct kvm_s390_ucas_mapping {
1091#define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97) 1099#define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97)
1092#define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state) 1100#define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state)
1093#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) 1101#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state)
1094/* Available with KVM_CAP_NMI */ 1102/* Available with KVM_CAP_USER_NMI */
1095#define KVM_NMI _IO(KVMIO, 0x9a) 1103#define KVM_NMI _IO(KVMIO, 0x9a)
1096/* Available with KVM_CAP_SET_GUEST_DEBUG */ 1104/* Available with KVM_CAP_SET_GUEST_DEBUG */
1097#define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug) 1105#define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug)
diff --git a/include/uapi/linux/memfd.h b/include/uapi/linux/memfd.h
new file mode 100644
index 000000000000..534e364bda92
--- /dev/null
+++ b/include/uapi/linux/memfd.h
@@ -0,0 +1,8 @@
1#ifndef _UAPI_LINUX_MEMFD_H
2#define _UAPI_LINUX_MEMFD_H
3
4/* flags for memfd_create(2) (unsigned int) */
5#define MFD_CLOEXEC 0x0001U
6#define MFD_ALLOW_SEALING 0x0002U
7
8#endif /* _UAPI_LINUX_MEMFD_H */
diff --git a/include/uapi/linux/netfilter/ipset/ip_set.h b/include/uapi/linux/netfilter/ipset/ip_set.h
index 78c2f2e79920..ca03119111a2 100644
--- a/include/uapi/linux/netfilter/ipset/ip_set.h
+++ b/include/uapi/linux/netfilter/ipset/ip_set.h
@@ -115,6 +115,9 @@ enum {
115 IPSET_ATTR_BYTES, 115 IPSET_ATTR_BYTES,
116 IPSET_ATTR_PACKETS, 116 IPSET_ATTR_PACKETS,
117 IPSET_ATTR_COMMENT, 117 IPSET_ATTR_COMMENT,
118 IPSET_ATTR_SKBMARK,
119 IPSET_ATTR_SKBPRIO,
120 IPSET_ATTR_SKBQUEUE,
118 __IPSET_ATTR_ADT_MAX, 121 __IPSET_ATTR_ADT_MAX,
119}; 122};
120#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1) 123#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1)
@@ -147,6 +150,7 @@ enum ipset_errno {
147 IPSET_ERR_COUNTER, 150 IPSET_ERR_COUNTER,
148 IPSET_ERR_COMMENT, 151 IPSET_ERR_COMMENT,
149 IPSET_ERR_INVALID_MARKMASK, 152 IPSET_ERR_INVALID_MARKMASK,
153 IPSET_ERR_SKBINFO,
150 154
151 /* Type specific error codes */ 155 /* Type specific error codes */
152 IPSET_ERR_TYPE_SPECIFIC = 4352, 156 IPSET_ERR_TYPE_SPECIFIC = 4352,
@@ -170,6 +174,12 @@ enum ipset_cmd_flags {
170 IPSET_FLAG_MATCH_COUNTERS = (1 << IPSET_FLAG_BIT_MATCH_COUNTERS), 174 IPSET_FLAG_MATCH_COUNTERS = (1 << IPSET_FLAG_BIT_MATCH_COUNTERS),
171 IPSET_FLAG_BIT_RETURN_NOMATCH = 7, 175 IPSET_FLAG_BIT_RETURN_NOMATCH = 7,
172 IPSET_FLAG_RETURN_NOMATCH = (1 << IPSET_FLAG_BIT_RETURN_NOMATCH), 176 IPSET_FLAG_RETURN_NOMATCH = (1 << IPSET_FLAG_BIT_RETURN_NOMATCH),
177 IPSET_FLAG_BIT_MAP_SKBMARK = 8,
178 IPSET_FLAG_MAP_SKBMARK = (1 << IPSET_FLAG_BIT_MAP_SKBMARK),
179 IPSET_FLAG_BIT_MAP_SKBPRIO = 9,
180 IPSET_FLAG_MAP_SKBPRIO = (1 << IPSET_FLAG_BIT_MAP_SKBPRIO),
181 IPSET_FLAG_BIT_MAP_SKBQUEUE = 10,
182 IPSET_FLAG_MAP_SKBQUEUE = (1 << IPSET_FLAG_BIT_MAP_SKBQUEUE),
173 IPSET_FLAG_CMD_MAX = 15, 183 IPSET_FLAG_CMD_MAX = 15,
174}; 184};
175 185
@@ -187,6 +197,8 @@ enum ipset_cadt_flags {
187 IPSET_FLAG_WITH_COMMENT = (1 << IPSET_FLAG_BIT_WITH_COMMENT), 197 IPSET_FLAG_WITH_COMMENT = (1 << IPSET_FLAG_BIT_WITH_COMMENT),
188 IPSET_FLAG_BIT_WITH_FORCEADD = 5, 198 IPSET_FLAG_BIT_WITH_FORCEADD = 5,
189 IPSET_FLAG_WITH_FORCEADD = (1 << IPSET_FLAG_BIT_WITH_FORCEADD), 199 IPSET_FLAG_WITH_FORCEADD = (1 << IPSET_FLAG_BIT_WITH_FORCEADD),
200 IPSET_FLAG_BIT_WITH_SKBINFO = 6,
201 IPSET_FLAG_WITH_SKBINFO = (1 << IPSET_FLAG_BIT_WITH_SKBINFO),
190 IPSET_FLAG_CADT_MAX = 15, 202 IPSET_FLAG_CADT_MAX = 15,
191}; 203};
192 204
diff --git a/include/uapi/linux/netfilter/nf_nat.h b/include/uapi/linux/netfilter/nf_nat.h
index 1ad3659102b6..0880781ad7b6 100644
--- a/include/uapi/linux/netfilter/nf_nat.h
+++ b/include/uapi/linux/netfilter/nf_nat.h
@@ -13,6 +13,11 @@
13#define NF_NAT_RANGE_PROTO_RANDOM_ALL \ 13#define NF_NAT_RANGE_PROTO_RANDOM_ALL \
14 (NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PROTO_RANDOM_FULLY) 14 (NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PROTO_RANDOM_FULLY)
15 15
16#define NF_NAT_RANGE_MASK \
17 (NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED | \
18 NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PERSISTENT | \
19 NF_NAT_RANGE_PROTO_RANDOM_FULLY)
20
16struct nf_nat_ipv4_range { 21struct nf_nat_ipv4_range {
17 unsigned int flags; 22 unsigned int flags;
18 __be32 min_ip; 23 __be32 min_ip;
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index 801bdd1e56e3..f31fe7b660a5 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -51,6 +51,8 @@ enum nft_verdicts {
51 * @NFT_MSG_NEWSETELEM: create a new set element (enum nft_set_elem_attributes) 51 * @NFT_MSG_NEWSETELEM: create a new set element (enum nft_set_elem_attributes)
52 * @NFT_MSG_GETSETELEM: get a set element (enum nft_set_elem_attributes) 52 * @NFT_MSG_GETSETELEM: get a set element (enum nft_set_elem_attributes)
53 * @NFT_MSG_DELSETELEM: delete a set element (enum nft_set_elem_attributes) 53 * @NFT_MSG_DELSETELEM: delete a set element (enum nft_set_elem_attributes)
54 * @NFT_MSG_NEWGEN: announce a new generation, only for events (enum nft_gen_attributes)
55 * @NFT_MSG_GETGEN: get the rule-set generation (enum nft_gen_attributes)
54 */ 56 */
55enum nf_tables_msg_types { 57enum nf_tables_msg_types {
56 NFT_MSG_NEWTABLE, 58 NFT_MSG_NEWTABLE,
@@ -68,6 +70,8 @@ enum nf_tables_msg_types {
68 NFT_MSG_NEWSETELEM, 70 NFT_MSG_NEWSETELEM,
69 NFT_MSG_GETSETELEM, 71 NFT_MSG_GETSETELEM,
70 NFT_MSG_DELSETELEM, 72 NFT_MSG_DELSETELEM,
73 NFT_MSG_NEWGEN,
74 NFT_MSG_GETGEN,
71 NFT_MSG_MAX, 75 NFT_MSG_MAX,
72}; 76};
73 77
@@ -571,6 +575,10 @@ enum nft_exthdr_attributes {
571 * @NFT_META_L4PROTO: layer 4 protocol number 575 * @NFT_META_L4PROTO: layer 4 protocol number
572 * @NFT_META_BRI_IIFNAME: packet input bridge interface name 576 * @NFT_META_BRI_IIFNAME: packet input bridge interface name
573 * @NFT_META_BRI_OIFNAME: packet output bridge interface name 577 * @NFT_META_BRI_OIFNAME: packet output bridge interface name
578 * @NFT_META_PKTTYPE: packet type (skb->pkt_type), special handling for loopback
579 * @NFT_META_CPU: cpu id through smp_processor_id()
580 * @NFT_META_IIFGROUP: packet input interface group
581 * @NFT_META_OIFGROUP: packet output interface group
574 */ 582 */
575enum nft_meta_keys { 583enum nft_meta_keys {
576 NFT_META_LEN, 584 NFT_META_LEN,
@@ -592,6 +600,10 @@ enum nft_meta_keys {
592 NFT_META_L4PROTO, 600 NFT_META_L4PROTO,
593 NFT_META_BRI_IIFNAME, 601 NFT_META_BRI_IIFNAME,
594 NFT_META_BRI_OIFNAME, 602 NFT_META_BRI_OIFNAME,
603 NFT_META_PKTTYPE,
604 NFT_META_CPU,
605 NFT_META_IIFGROUP,
606 NFT_META_OIFGROUP,
595}; 607};
596 608
597/** 609/**
@@ -737,13 +749,34 @@ enum nft_queue_attributes {
737 * 749 *
738 * @NFT_REJECT_ICMP_UNREACH: reject using ICMP unreachable 750 * @NFT_REJECT_ICMP_UNREACH: reject using ICMP unreachable
739 * @NFT_REJECT_TCP_RST: reject using TCP RST 751 * @NFT_REJECT_TCP_RST: reject using TCP RST
752 * @NFT_REJECT_ICMPX_UNREACH: abstracted ICMP unreachable for bridge and inet
740 */ 753 */
741enum nft_reject_types { 754enum nft_reject_types {
742 NFT_REJECT_ICMP_UNREACH, 755 NFT_REJECT_ICMP_UNREACH,
743 NFT_REJECT_TCP_RST, 756 NFT_REJECT_TCP_RST,
757 NFT_REJECT_ICMPX_UNREACH,
744}; 758};
745 759
746/** 760/**
761 * enum nft_reject_code - Generic reject codes for IPv4/IPv6
762 *
763 * @NFT_REJECT_ICMPX_NO_ROUTE: no route to host / network unreachable
764 * @NFT_REJECT_ICMPX_PORT_UNREACH: port unreachable
765 * @NFT_REJECT_ICMPX_HOST_UNREACH: host unreachable
766 * @NFT_REJECT_ICMPX_ADMIN_PROHIBITED: administratively prohibited
767 *
768 * These codes are mapped to real ICMP and ICMPv6 codes.
769 */
770enum nft_reject_inet_code {
771 NFT_REJECT_ICMPX_NO_ROUTE = 0,
772 NFT_REJECT_ICMPX_PORT_UNREACH,
773 NFT_REJECT_ICMPX_HOST_UNREACH,
774 NFT_REJECT_ICMPX_ADMIN_PROHIBITED,
775 __NFT_REJECT_ICMPX_MAX
776};
777#define NFT_REJECT_ICMPX_MAX (__NFT_REJECT_ICMPX_MAX - 1)
778
779/**
747 * enum nft_reject_attributes - nf_tables reject expression netlink attributes 780 * enum nft_reject_attributes - nf_tables reject expression netlink attributes
748 * 781 *
749 * @NFTA_REJECT_TYPE: packet type to use (NLA_U32: nft_reject_types) 782 * @NFTA_REJECT_TYPE: packet type to use (NLA_U32: nft_reject_types)
@@ -777,6 +810,7 @@ enum nft_nat_types {
777 * @NFTA_NAT_REG_ADDR_MAX: source register of address range end (NLA_U32: nft_registers) 810 * @NFTA_NAT_REG_ADDR_MAX: source register of address range end (NLA_U32: nft_registers)
778 * @NFTA_NAT_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers) 811 * @NFTA_NAT_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
779 * @NFTA_NAT_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers) 812 * @NFTA_NAT_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
813 * @NFTA_NAT_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
780 */ 814 */
781enum nft_nat_attributes { 815enum nft_nat_attributes {
782 NFTA_NAT_UNSPEC, 816 NFTA_NAT_UNSPEC,
@@ -786,8 +820,33 @@ enum nft_nat_attributes {
786 NFTA_NAT_REG_ADDR_MAX, 820 NFTA_NAT_REG_ADDR_MAX,
787 NFTA_NAT_REG_PROTO_MIN, 821 NFTA_NAT_REG_PROTO_MIN,
788 NFTA_NAT_REG_PROTO_MAX, 822 NFTA_NAT_REG_PROTO_MAX,
823 NFTA_NAT_FLAGS,
789 __NFTA_NAT_MAX 824 __NFTA_NAT_MAX
790}; 825};
791#define NFTA_NAT_MAX (__NFTA_NAT_MAX - 1) 826#define NFTA_NAT_MAX (__NFTA_NAT_MAX - 1)
792 827
828/**
829 * enum nft_masq_attributes - nf_tables masquerade expression attributes
830 *
831 * @NFTA_MASQ_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
832 */
833enum nft_masq_attributes {
834 NFTA_MASQ_UNSPEC,
835 NFTA_MASQ_FLAGS,
836 __NFTA_MASQ_MAX
837};
838#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1)
839
840/**
841 * enum nft_gen_attributes - nf_tables ruleset generation attributes
842 *
843 * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32)
844 */
845enum nft_gen_attributes {
846 NFTA_GEN_UNSPEC,
847 NFTA_GEN_ID,
848 __NFTA_GEN_MAX
849};
850#define NFTA_GEN_MAX (__NFTA_GEN_MAX - 1)
851
793#endif /* _LINUX_NF_TABLES_H */ 852#endif /* _LINUX_NF_TABLES_H */
diff --git a/include/uapi/linux/netfilter/nfnetlink_acct.h b/include/uapi/linux/netfilter/nfnetlink_acct.h
index 51404ec19022..f3e34dbbf966 100644
--- a/include/uapi/linux/netfilter/nfnetlink_acct.h
+++ b/include/uapi/linux/netfilter/nfnetlink_acct.h
@@ -28,9 +28,17 @@ enum nfnl_acct_type {
28 NFACCT_USE, 28 NFACCT_USE,
29 NFACCT_FLAGS, 29 NFACCT_FLAGS,
30 NFACCT_QUOTA, 30 NFACCT_QUOTA,
31 NFACCT_FILTER,
31 __NFACCT_MAX 32 __NFACCT_MAX
32}; 33};
33#define NFACCT_MAX (__NFACCT_MAX - 1) 34#define NFACCT_MAX (__NFACCT_MAX - 1)
34 35
36enum nfnl_attr_filter_type {
37 NFACCT_FILTER_UNSPEC,
38 NFACCT_FILTER_MASK,
39 NFACCT_FILTER_VALUE,
40 __NFACCT_FILTER_MAX
41};
42#define NFACCT_FILTER_MAX (__NFACCT_FILTER_MAX - 1)
35 43
36#endif /* _UAPI_NFNL_ACCT_H_ */ 44#endif /* _UAPI_NFNL_ACCT_H_ */
diff --git a/include/uapi/linux/netfilter/xt_set.h b/include/uapi/linux/netfilter/xt_set.h
index 964d3d42f874..d6a1df1f2947 100644
--- a/include/uapi/linux/netfilter/xt_set.h
+++ b/include/uapi/linux/netfilter/xt_set.h
@@ -71,4 +71,14 @@ struct xt_set_info_match_v3 {
71 __u32 flags; 71 __u32 flags;
72}; 72};
73 73
74/* Revision 3 target */
75
76struct xt_set_info_target_v3 {
77 struct xt_set_info add_set;
78 struct xt_set_info del_set;
79 struct xt_set_info map_set;
80 __u32 flags;
81 __u32 timeout;
82};
83
74#endif /*_XT_SET_H*/ 84#endif /*_XT_SET_H*/
diff --git a/include/uapi/linux/netfilter_arp/arpt_mangle.h b/include/uapi/linux/netfilter_arp/arpt_mangle.h
index 250f502902bb..8c2b16a1f5a0 100644
--- a/include/uapi/linux/netfilter_arp/arpt_mangle.h
+++ b/include/uapi/linux/netfilter_arp/arpt_mangle.h
@@ -13,7 +13,7 @@ struct arpt_mangle
13 union { 13 union {
14 struct in_addr tgt_ip; 14 struct in_addr tgt_ip;
15 } u_t; 15 } u_t;
16 u_int8_t flags; 16 __u8 flags;
17 int target; 17 int target;
18}; 18};
19 19
diff --git a/include/uapi/linux/nfsd/export.h b/include/uapi/linux/nfsd/export.h
index cf47c313794e..584b6ef3a5e8 100644
--- a/include/uapi/linux/nfsd/export.h
+++ b/include/uapi/linux/nfsd/export.h
@@ -28,7 +28,8 @@
28#define NFSEXP_ALLSQUASH 0x0008 28#define NFSEXP_ALLSQUASH 0x0008
29#define NFSEXP_ASYNC 0x0010 29#define NFSEXP_ASYNC 0x0010
30#define NFSEXP_GATHERED_WRITES 0x0020 30#define NFSEXP_GATHERED_WRITES 0x0020
31/* 40 80 100 currently unused */ 31#define NFSEXP_NOREADDIRPLUS 0x0040
32/* 80 100 currently unused */
32#define NFSEXP_NOHIDE 0x0200 33#define NFSEXP_NOHIDE 0x0200
33#define NFSEXP_NOSUBTREECHECK 0x0400 34#define NFSEXP_NOSUBTREECHECK 0x0400
34#define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */ 35#define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */
@@ -47,7 +48,7 @@
47 */ 48 */
48#define NFSEXP_V4ROOT 0x10000 49#define NFSEXP_V4ROOT 0x10000
49/* All flags that we claim to support. (Note we don't support NOACL.) */ 50/* All flags that we claim to support. (Note we don't support NOACL.) */
50#define NFSEXP_ALLFLAGS 0x17E3F 51#define NFSEXP_ALLFLAGS 0x1FE7F
51 52
52/* The flags that may vary depending on security flavor: */ 53/* The flags that may vary depending on security flavor: */
53#define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ 54#define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index f1db15b9c041..4b28dc07bcb1 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -722,6 +722,22 @@
722 * QoS mapping is relevant for IP packets, it is only valid during an 722 * QoS mapping is relevant for IP packets, it is only valid during an
723 * association. This is cleared on disassociation and AP restart. 723 * association. This is cleared on disassociation and AP restart.
724 * 724 *
725 * @NL80211_CMD_ADD_TX_TS: Ask the kernel to add a traffic stream for the given
726 * %NL80211_ATTR_TSID and %NL80211_ATTR_MAC with %NL80211_ATTR_USER_PRIO
727 * and %NL80211_ATTR_ADMITTED_TIME parameters.
728 * Note that the action frame handshake with the AP shall be handled by
729 * userspace via the normal management RX/TX framework, this only sets
730 * up the TX TS in the driver/device.
731 * If the admitted time attribute is not added then the request just checks
732 * if a subsequent setup could be successful, the intent is to use this to
733 * avoid setting up a session with the AP when local restrictions would
734 * make that impossible. However, the subsequent "real" setup may still
735 * fail even if the check was successful.
736 * @NL80211_CMD_DEL_TX_TS: Remove an existing TS with the %NL80211_ATTR_TSID
737 * and %NL80211_ATTR_MAC parameters. It isn't necessary to call this
738 * before removing a station entry entirely, or before disassociating
739 * or similar, cleanup will happen in the driver/device in this case.
740 *
725 * @NL80211_CMD_MAX: highest used command number 741 * @NL80211_CMD_MAX: highest used command number
726 * @__NL80211_CMD_AFTER_LAST: internal use 742 * @__NL80211_CMD_AFTER_LAST: internal use
727 */ 743 */
@@ -893,6 +909,9 @@ enum nl80211_commands {
893 909
894 NL80211_CMD_SET_QOS_MAP, 910 NL80211_CMD_SET_QOS_MAP,
895 911
912 NL80211_CMD_ADD_TX_TS,
913 NL80211_CMD_DEL_TX_TS,
914
896 /* add new commands above here */ 915 /* add new commands above here */
897 916
898 /* used to define NL80211_CMD_MAX below */ 917 /* used to define NL80211_CMD_MAX below */
@@ -1594,6 +1613,31 @@ enum nl80211_commands {
1594 * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is 1613 * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
1595 * the TDLS link initiator. 1614 * the TDLS link initiator.
1596 * 1615 *
1616 * @NL80211_ATTR_USE_RRM: flag for indicating whether the current connection
1617 * shall support Radio Resource Measurements (11k). This attribute can be
1618 * used with %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests.
1619 * User space applications are expected to use this flag only if the
1620 * underlying device supports these minimal RRM features:
1621 * %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES,
1622 * %NL80211_FEATURE_QUIET,
1623 * If this flag is used, driver must add the Power Capabilities IE to the
1624 * association request. In addition, it must also set the RRM capability
1625 * flag in the association request's Capability Info field.
1626 *
1627 * @NL80211_ATTR_WIPHY_DYN_ACK: flag attribute used to enable ACK timeout
1628 * estimation algorithm (dynack). In order to activate dynack
1629 * %NL80211_FEATURE_ACKTO_ESTIMATION feature flag must be set by lower
1630 * drivers to indicate dynack capability. Dynack is automatically disabled
1631 * setting valid value for coverage class.
1632 *
1633 * @NL80211_ATTR_TSID: a TSID value (u8 attribute)
1634 * @NL80211_ATTR_USER_PRIO: user priority value (u8 attribute)
1635 * @NL80211_ATTR_ADMITTED_TIME: admitted time in units of 32 microseconds
1636 * (per second) (u16 attribute)
1637 *
1638 * @NL80211_ATTR_SMPS_MODE: SMPS mode to use (ap mode). see
1639 * &enum nl80211_smps_mode.
1640 *
1597 * @NL80211_ATTR_MAX: highest attribute number currently defined 1641 * @NL80211_ATTR_MAX: highest attribute number currently defined
1598 * @__NL80211_ATTR_AFTER_LAST: internal use 1642 * @__NL80211_ATTR_AFTER_LAST: internal use
1599 */ 1643 */
@@ -1936,6 +1980,16 @@ enum nl80211_attrs {
1936 1980
1937 NL80211_ATTR_TDLS_INITIATOR, 1981 NL80211_ATTR_TDLS_INITIATOR,
1938 1982
1983 NL80211_ATTR_USE_RRM,
1984
1985 NL80211_ATTR_WIPHY_DYN_ACK,
1986
1987 NL80211_ATTR_TSID,
1988 NL80211_ATTR_USER_PRIO,
1989 NL80211_ATTR_ADMITTED_TIME,
1990
1991 NL80211_ATTR_SMPS_MODE,
1992
1939 /* add attributes here, update the policy in nl80211.c */ 1993 /* add attributes here, update the policy in nl80211.c */
1940 1994
1941 __NL80211_ATTR_AFTER_LAST, 1995 __NL80211_ATTR_AFTER_LAST,
@@ -3055,14 +3109,20 @@ enum nl80211_bss_scan_width {
3055 * @NL80211_BSS_BSSID: BSSID of the BSS (6 octets) 3109 * @NL80211_BSS_BSSID: BSSID of the BSS (6 octets)
3056 * @NL80211_BSS_FREQUENCY: frequency in MHz (u32) 3110 * @NL80211_BSS_FREQUENCY: frequency in MHz (u32)
3057 * @NL80211_BSS_TSF: TSF of the received probe response/beacon (u64) 3111 * @NL80211_BSS_TSF: TSF of the received probe response/beacon (u64)
3112 * (if @NL80211_BSS_PRESP_DATA is present then this is known to be
3113 * from a probe response, otherwise it may be from the same beacon
3114 * that the NL80211_BSS_BEACON_TSF will be from)
3058 * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16) 3115 * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16)
3059 * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16) 3116 * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16)
3060 * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the 3117 * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the
3061 * raw information elements from the probe response/beacon (bin); 3118 * raw information elements from the probe response/beacon (bin);
3062 * if the %NL80211_BSS_BEACON_IES attribute is present, the IEs here are 3119 * if the %NL80211_BSS_BEACON_IES attribute is present and the data is
3063 * from a Probe Response frame; otherwise they are from a Beacon frame. 3120 * different then the IEs here are from a Probe Response frame; otherwise
3121 * they are from a Beacon frame.
3064 * However, if the driver does not indicate the source of the IEs, these 3122 * However, if the driver does not indicate the source of the IEs, these
3065 * IEs may be from either frame subtype. 3123 * IEs may be from either frame subtype.
3124 * If present, the @NL80211_BSS_PRESP_DATA attribute indicates that the
3125 * data here is known to be from a probe response, without any heuristics.
3066 * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon 3126 * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon
3067 * in mBm (100 * dBm) (s32) 3127 * in mBm (100 * dBm) (s32)
3068 * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon 3128 * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
@@ -3074,6 +3134,10 @@ enum nl80211_bss_scan_width {
3074 * yet been received 3134 * yet been received
3075 * @NL80211_BSS_CHAN_WIDTH: channel width of the control channel 3135 * @NL80211_BSS_CHAN_WIDTH: channel width of the control channel
3076 * (u32, enum nl80211_bss_scan_width) 3136 * (u32, enum nl80211_bss_scan_width)
3137 * @NL80211_BSS_BEACON_TSF: TSF of the last received beacon (u64)
3138 * (not present if no beacon frame has been received yet)
3139 * @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and
3140 * @NL80211_BSS_TSF is known to be from a probe response (flag attribute)
3077 * @__NL80211_BSS_AFTER_LAST: internal 3141 * @__NL80211_BSS_AFTER_LAST: internal
3078 * @NL80211_BSS_MAX: highest BSS attribute 3142 * @NL80211_BSS_MAX: highest BSS attribute
3079 */ 3143 */
@@ -3091,6 +3155,8 @@ enum nl80211_bss {
3091 NL80211_BSS_SEEN_MS_AGO, 3155 NL80211_BSS_SEEN_MS_AGO,
3092 NL80211_BSS_BEACON_IES, 3156 NL80211_BSS_BEACON_IES,
3093 NL80211_BSS_CHAN_WIDTH, 3157 NL80211_BSS_CHAN_WIDTH,
3158 NL80211_BSS_BEACON_TSF,
3159 NL80211_BSS_PRESP_DATA,
3094 3160
3095 /* keep last */ 3161 /* keep last */
3096 __NL80211_BSS_AFTER_LAST, 3162 __NL80211_BSS_AFTER_LAST,
@@ -3956,6 +4022,26 @@ enum nl80211_ap_sme_features {
3956 * @NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE: This driver supports dynamic 4022 * @NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE: This driver supports dynamic
3957 * channel bandwidth change (e.g., HT 20 <-> 40 MHz channel) during the 4023 * channel bandwidth change (e.g., HT 20 <-> 40 MHz channel) during the
3958 * lifetime of a BSS. 4024 * lifetime of a BSS.
4025 * @NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES: This device adds a DS Parameter
4026 * Set IE to probe requests.
4027 * @NL80211_FEATURE_WFA_TPC_IE_IN_PROBES: This device adds a WFA TPC Report IE
4028 * to probe requests.
4029 * @NL80211_FEATURE_QUIET: This device, in client mode, supports Quiet Period
4030 * requests sent to it by an AP.
4031 * @NL80211_FEATURE_TX_POWER_INSERTION: This device is capable of inserting the
4032 * current tx power value into the TPC Report IE in the spectrum
4033 * management TPC Report action frame, and in the Radio Measurement Link
4034 * Measurement Report action frame.
4035 * @NL80211_FEATURE_ACKTO_ESTIMATION: This driver supports dynamic ACK timeout
4036 * estimation (dynack). %NL80211_ATTR_WIPHY_DYN_ACK flag attribute is used
4037 * to enable dynack.
4038 * @NL80211_FEATURE_STATIC_SMPS: Device supports static spatial
4039 * multiplexing powersave, ie. can turn off all but one chain
4040 * even on HT connections that should be using more chains.
4041 * @NL80211_FEATURE_DYNAMIC_SMPS: Device supports dynamic spatial
4042 * multiplexing powersave, ie. can turn off all but one chain
4043 * and then wake the rest up as required after, for example,
4044 * rts/cts handshake.
3959 */ 4045 */
3960enum nl80211_feature_flags { 4046enum nl80211_feature_flags {
3961 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 4047 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
@@ -3977,6 +4063,13 @@ enum nl80211_feature_flags {
3977 NL80211_FEATURE_USERSPACE_MPM = 1 << 16, 4063 NL80211_FEATURE_USERSPACE_MPM = 1 << 16,
3978 NL80211_FEATURE_ACTIVE_MONITOR = 1 << 17, 4064 NL80211_FEATURE_ACTIVE_MONITOR = 1 << 17,
3979 NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE = 1 << 18, 4065 NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE = 1 << 18,
4066 NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES = 1 << 19,
4067 NL80211_FEATURE_WFA_TPC_IE_IN_PROBES = 1 << 20,
4068 NL80211_FEATURE_QUIET = 1 << 21,
4069 NL80211_FEATURE_TX_POWER_INSERTION = 1 << 22,
4070 NL80211_FEATURE_ACKTO_ESTIMATION = 1 << 23,
4071 NL80211_FEATURE_STATIC_SMPS = 1 << 24,
4072 NL80211_FEATURE_DYNAMIC_SMPS = 1 << 25,
3980}; 4073};
3981 4074
3982/** 4075/**
@@ -4051,6 +4144,25 @@ enum nl80211_acl_policy {
4051}; 4144};
4052 4145
4053/** 4146/**
4147 * enum nl80211_smps_mode - SMPS mode
4148 *
4149 * Requested SMPS mode (for AP mode)
4150 *
4151 * @NL80211_SMPS_OFF: SMPS off (use all antennas).
4152 * @NL80211_SMPS_STATIC: static SMPS (use a single antenna)
4153 * @NL80211_SMPS_DYNAMIC: dynamic smps (start with a single antenna and
4154 * turn on other antennas after CTS/RTS).
4155 */
4156enum nl80211_smps_mode {
4157 NL80211_SMPS_OFF,
4158 NL80211_SMPS_STATIC,
4159 NL80211_SMPS_DYNAMIC,
4160
4161 __NL80211_SMPS_AFTER_LAST,
4162 NL80211_SMPS_MAX = __NL80211_SMPS_AFTER_LAST - 1
4163};
4164
4165/**
4054 * enum nl80211_radar_event - type of radar event for DFS operation 4166 * enum nl80211_radar_event - type of radar event for DFS operation
4055 * 4167 *
4056 * Type of event to be used with NL80211_ATTR_RADAR_EVENT to inform userspace 4168 * Type of event to be used with NL80211_ATTR_RADAR_EVENT to inform userspace
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index a794d1dd7b40..435eabc5ffaa 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -192,6 +192,7 @@ enum ovs_vport_type {
192 OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ 192 OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
193 OVS_VPORT_TYPE_GRE, /* GRE tunnel. */ 193 OVS_VPORT_TYPE_GRE, /* GRE tunnel. */
194 OVS_VPORT_TYPE_VXLAN, /* VXLAN tunnel. */ 194 OVS_VPORT_TYPE_VXLAN, /* VXLAN tunnel. */
195 OVS_VPORT_TYPE_GENEVE, /* Geneve tunnel. */
195 __OVS_VPORT_TYPE_MAX 196 __OVS_VPORT_TYPE_MAX
196}; 197};
197 198
@@ -289,9 +290,12 @@ enum ovs_key_attr {
289 OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */ 290 OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */
290 OVS_KEY_ATTR_SCTP, /* struct ovs_key_sctp */ 291 OVS_KEY_ATTR_SCTP, /* struct ovs_key_sctp */
291 OVS_KEY_ATTR_TCP_FLAGS, /* be16 TCP flags. */ 292 OVS_KEY_ATTR_TCP_FLAGS, /* be16 TCP flags. */
293 OVS_KEY_ATTR_DP_HASH, /* u32 hash value. Value 0 indicates the hash
294 is not computed by the datapath. */
295 OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */
292 296
293#ifdef __KERNEL__ 297#ifdef __KERNEL__
294 OVS_KEY_ATTR_IPV4_TUNNEL, /* struct ovs_key_ipv4_tunnel */ 298 OVS_KEY_ATTR_TUNNEL_INFO, /* struct ovs_tunnel_info */
295#endif 299#endif
296 __OVS_KEY_ATTR_MAX 300 __OVS_KEY_ATTR_MAX
297}; 301};
@@ -306,6 +310,8 @@ enum ovs_tunnel_key_attr {
306 OVS_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */ 310 OVS_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */
307 OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */ 311 OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */
308 OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */ 312 OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */
313 OVS_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */
314 OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS, /* Array of Geneve options. */
309 __OVS_TUNNEL_KEY_ATTR_MAX 315 __OVS_TUNNEL_KEY_ATTR_MAX
310}; 316};
311 317
@@ -493,6 +499,27 @@ struct ovs_action_push_vlan {
493 __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */ 499 __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */
494}; 500};
495 501
502/* Data path hash algorithm for computing Datapath hash.
503 *
504 * The algorithm type only specifies the fields in a flow
505 * will be used as part of the hash. Each datapath is free
506 * to use its own hash algorithm. The hash value will be
507 * opaque to the user space daemon.
508 */
509enum ovs_hash_alg {
510 OVS_HASH_ALG_L4,
511};
512
513/*
514 * struct ovs_action_hash - %OVS_ACTION_ATTR_HASH action argument.
515 * @hash_alg: Algorithm used to compute hash prior to recirculation.
516 * @hash_basis: basis used for computing hash.
517 */
518struct ovs_action_hash {
519 uint32_t hash_alg; /* One of ovs_hash_alg. */
520 uint32_t hash_basis;
521};
522
496/** 523/**
497 * enum ovs_action_attr - Action types. 524 * enum ovs_action_attr - Action types.
498 * 525 *
@@ -521,6 +548,8 @@ enum ovs_action_attr {
521 OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */ 548 OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */
522 OVS_ACTION_ATTR_POP_VLAN, /* No argument. */ 549 OVS_ACTION_ATTR_POP_VLAN, /* No argument. */
523 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */ 550 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */
551 OVS_ACTION_ATTR_RECIRC, /* u32 recirc_id. */
552 OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */
524 __OVS_ACTION_ATTR_MAX 553 __OVS_ACTION_ATTR_MAX
525}; 554};
526 555
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 30db069bce62..4a1d0cc38ff2 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -552,6 +552,7 @@
552#define PCI_EXP_RTCTL_PMEIE 0x0008 /* PME Interrupt Enable */ 552#define PCI_EXP_RTCTL_PMEIE 0x0008 /* PME Interrupt Enable */
553#define PCI_EXP_RTCTL_CRSSVE 0x0010 /* CRS Software Visibility Enable */ 553#define PCI_EXP_RTCTL_CRSSVE 0x0010 /* CRS Software Visibility Enable */
554#define PCI_EXP_RTCAP 30 /* Root Capabilities */ 554#define PCI_EXP_RTCAP 30 /* Root Capabilities */
555#define PCI_EXP_RTCAP_CRSVIS 0x0001 /* CRS Software Visibility capability */
555#define PCI_EXP_RTSTA 32 /* Root Status */ 556#define PCI_EXP_RTSTA 32 /* Root Status */
556#define PCI_EXP_RTSTA_PME 0x00010000 /* PME status */ 557#define PCI_EXP_RTSTA_PME 0x00010000 /* PME status */
557#define PCI_EXP_RTSTA_PENDING 0x00020000 /* PME pending */ 558#define PCI_EXP_RTSTA_PENDING 0x00020000 /* PME pending */
@@ -630,7 +631,7 @@
630 631
631/* Advanced Error Reporting */ 632/* Advanced Error Reporting */
632#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ 633#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */
633#define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */ 634#define PCI_ERR_UNC_UND 0x00000001 /* Undefined */
634#define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ 635#define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */
635#define PCI_ERR_UNC_SURPDN 0x00000020 /* Surprise Down */ 636#define PCI_ERR_UNC_SURPDN 0x00000020 /* Surprise Down */
636#define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ 637#define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 9269de254874..9d845404d875 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -364,7 +364,7 @@ struct perf_event_mmap_page {
364 /* 364 /*
365 * Bits needed to read the hw events in user-space. 365 * Bits needed to read the hw events in user-space.
366 * 366 *
367 * u32 seq, time_mult, time_shift, idx, width; 367 * u32 seq, time_mult, time_shift, index, width;
368 * u64 count, enabled, running; 368 * u64 count, enabled, running;
369 * u64 cyc, time_offset; 369 * u64 cyc, time_offset;
370 * s64 pmc = 0; 370 * s64 pmc = 0;
@@ -383,11 +383,11 @@ struct perf_event_mmap_page {
383 * time_shift = pc->time_shift; 383 * time_shift = pc->time_shift;
384 * } 384 * }
385 * 385 *
386 * idx = pc->index; 386 * index = pc->index;
387 * count = pc->offset; 387 * count = pc->offset;
388 * if (pc->cap_usr_rdpmc && idx) { 388 * if (pc->cap_user_rdpmc && index) {
389 * width = pc->pmc_width; 389 * width = pc->pmc_width;
390 * pmc = rdpmc(idx - 1); 390 * pmc = rdpmc(index - 1);
391 * } 391 * }
392 * 392 *
393 * barrier(); 393 * barrier();
@@ -415,7 +415,7 @@ struct perf_event_mmap_page {
415 }; 415 };
416 416
417 /* 417 /*
418 * If cap_usr_rdpmc this field provides the bit-width of the value 418 * If cap_user_rdpmc this field provides the bit-width of the value
419 * read using the rdpmc() or equivalent instruction. This can be used 419 * read using the rdpmc() or equivalent instruction. This can be used
420 * to sign extend the result like: 420 * to sign extend the result like:
421 * 421 *
@@ -439,10 +439,10 @@ struct perf_event_mmap_page {
439 * 439 *
440 * Where time_offset,time_mult,time_shift and cyc are read in the 440 * Where time_offset,time_mult,time_shift and cyc are read in the
441 * seqcount loop described above. This delta can then be added to 441 * seqcount loop described above. This delta can then be added to
442 * enabled and possible running (if idx), improving the scaling: 442 * enabled and possible running (if index), improving the scaling:
443 * 443 *
444 * enabled += delta; 444 * enabled += delta;
445 * if (idx) 445 * if (index)
446 * running += delta; 446 * running += delta;
447 * 447 *
448 * quot = count / running; 448 * quot = count / running;
diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h
index 58afc04c107e..513df75d0fc9 100644
--- a/include/uapi/linux/prctl.h
+++ b/include/uapi/linux/prctl.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_PRCTL_H 1#ifndef _LINUX_PRCTL_H
2#define _LINUX_PRCTL_H 2#define _LINUX_PRCTL_H
3 3
4#include <linux/types.h>
5
4/* Values to pass as first argument to prctl() */ 6/* Values to pass as first argument to prctl() */
5 7
6#define PR_SET_PDEATHSIG 1 /* Second arg is a signal */ 8#define PR_SET_PDEATHSIG 1 /* Second arg is a signal */
@@ -119,6 +121,31 @@
119# define PR_SET_MM_ENV_END 11 121# define PR_SET_MM_ENV_END 11
120# define PR_SET_MM_AUXV 12 122# define PR_SET_MM_AUXV 12
121# define PR_SET_MM_EXE_FILE 13 123# define PR_SET_MM_EXE_FILE 13
124# define PR_SET_MM_MAP 14
125# define PR_SET_MM_MAP_SIZE 15
126
127/*
128 * This structure provides new memory descriptor
129 * map which mostly modifies /proc/pid/stat[m]
130 * output for a task. This mostly done in a
131 * sake of checkpoint/restore functionality.
132 */
133struct prctl_mm_map {
134 __u64 start_code; /* code section bounds */
135 __u64 end_code;
136 __u64 start_data; /* data section bounds */
137 __u64 end_data;
138 __u64 start_brk; /* heap for brk() syscall */
139 __u64 brk;
140 __u64 start_stack; /* stack starts at */
141 __u64 arg_start; /* command line arguments bounds */
142 __u64 arg_end;
143 __u64 env_start; /* environment variables bounds */
144 __u64 env_end;
145 __u64 *auxv; /* auxiliary vector */
146 __u32 auxv_size; /* vector size */
147 __u32 exe_fd; /* /proc/$pid/exe link file */
148};
122 149
123/* 150/*
124 * Set specific pid that is allowed to ptrace the current task. 151 * Set specific pid that is allowed to ptrace the current task.
diff --git a/include/uapi/linux/raid/md_u.h b/include/uapi/linux/raid/md_u.h
index 4133e744e4e6..74e7c60c4716 100644
--- a/include/uapi/linux/raid/md_u.h
+++ b/include/uapi/linux/raid/md_u.h
@@ -39,7 +39,6 @@
39#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t) 39#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)
40#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t) 40#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
41#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t) 41#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
42#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)
43#define RAID_AUTORUN _IO (MD_MAJOR, 0x14) 42#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
44#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t) 43#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
45 44
diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h
index 34f9d7387d13..b932be9f5c5b 100644
--- a/include/uapi/linux/sched.h
+++ b/include/uapi/linux/sched.h
@@ -13,7 +13,7 @@
13#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ 13#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
14#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ 14#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
15#define CLONE_THREAD 0x00010000 /* Same thread group? */ 15#define CLONE_THREAD 0x00010000 /* Same thread group? */
16#define CLONE_NEWNS 0x00020000 /* New namespace group? */ 16#define CLONE_NEWNS 0x00020000 /* New mount namespace group */
17#define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ 17#define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */
18#define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */ 18#define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */
19#define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */ 19#define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
index 5820269aa132..16ad8521af6a 100644
--- a/include/uapi/linux/serial_core.h
+++ b/include/uapi/linux/serial_core.h
@@ -244,4 +244,7 @@
244/* SC16IS74xx */ 244/* SC16IS74xx */
245#define PORT_SC16IS7XX 108 245#define PORT_SC16IS7XX 108
246 246
247/* MESON */
248#define PORT_MESON 109
249
247#endif /* _UAPILINUX_SERIAL_CORE_H */ 250#endif /* _UAPILINUX_SERIAL_CORE_H */
diff --git a/include/uapi/linux/serio.h b/include/uapi/linux/serio.h
index 9f53fa7fc132..becdd78295cc 100644
--- a/include/uapi/linux/serio.h
+++ b/include/uapi/linux/serio.h
@@ -76,5 +76,6 @@
76#define SERIO_HAMPSHIRE 0x3b 76#define SERIO_HAMPSHIRE 0x3b
77#define SERIO_PS2MULT 0x3c 77#define SERIO_PS2MULT 0x3c
78#define SERIO_TSC40 0x3d 78#define SERIO_TSC40 0x3d
79#define SERIO_WACOM_IV 0x3e
79 80
80#endif /* _UAPI_SERIO_H */ 81#endif /* _UAPI_SERIO_H */
diff --git a/include/uapi/linux/smiapp.h b/include/uapi/linux/smiapp.h
new file mode 100644
index 000000000000..53938f4412ee
--- /dev/null
+++ b/include/uapi/linux/smiapp.h
@@ -0,0 +1,29 @@
1/*
2 * include/uapi/linux/smiapp.h
3 *
4 * Generic driver for SMIA/SMIA++ compliant camera modules
5 *
6 * Copyright (C) 2014 Intel Corporation
7 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
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 */
19
20#ifndef __UAPI_LINUX_SMIAPP_H_
21#define __UAPI_LINUX_SMIAPP_H_
22
23#define V4L2_SMIAPP_TEST_PATTERN_MODE_DISABLED 0
24#define V4L2_SMIAPP_TEST_PATTERN_MODE_SOLID_COLOUR 1
25#define V4L2_SMIAPP_TEST_PATTERN_MODE_COLOUR_BARS 2
26#define V4L2_SMIAPP_TEST_PATTERN_MODE_COLOUR_BARS_GREY 3
27#define V4L2_SMIAPP_TEST_PATTERN_MODE_PN9 4
28
29#endif /* __UAPI_LINUX_SMIAPP_H_ */
diff --git a/include/uapi/linux/target_core_user.h b/include/uapi/linux/target_core_user.h
new file mode 100644
index 000000000000..7dcfbe6771b1
--- /dev/null
+++ b/include/uapi/linux/target_core_user.h
@@ -0,0 +1,142 @@
1#ifndef __TARGET_CORE_USER_H
2#define __TARGET_CORE_USER_H
3
4/* This header will be used by application too */
5
6#include <linux/types.h>
7#include <linux/uio.h>
8
9#ifndef __packed
10#define __packed __attribute__((packed))
11#endif
12
13#define TCMU_VERSION "1.0"
14
15/*
16 * Ring Design
17 * -----------
18 *
19 * The mmaped area is divided into three parts:
20 * 1) The mailbox (struct tcmu_mailbox, below)
21 * 2) The command ring
22 * 3) Everything beyond the command ring (data)
23 *
24 * The mailbox tells userspace the offset of the command ring from the
25 * start of the shared memory region, and how big the command ring is.
26 *
27 * The kernel passes SCSI commands to userspace by putting a struct
28 * tcmu_cmd_entry in the ring, updating mailbox->cmd_head, and poking
29 * userspace via uio's interrupt mechanism.
30 *
31 * tcmu_cmd_entry contains a header. If the header type is PAD,
32 * userspace should skip hdr->length bytes (mod cmdr_size) to find the
33 * next cmd_entry.
34 *
35 * Otherwise, the entry will contain offsets into the mmaped area that
36 * contain the cdb and data buffers -- the latter accessible via the
37 * iov array. iov addresses are also offsets into the shared area.
38 *
39 * When userspace is completed handling the command, set
40 * entry->rsp.scsi_status, fill in rsp.sense_buffer if appropriate,
41 * and also set mailbox->cmd_tail equal to the old cmd_tail plus
42 * hdr->length, mod cmdr_size. If cmd_tail doesn't equal cmd_head, it
43 * should process the next packet the same way, and so on.
44 */
45
46#define TCMU_MAILBOX_VERSION 1
47#define ALIGN_SIZE 64 /* Should be enough for most CPUs */
48
49struct tcmu_mailbox {
50 __u16 version;
51 __u16 flags;
52 __u32 cmdr_off;
53 __u32 cmdr_size;
54
55 __u32 cmd_head;
56
57 /* Updated by user. On its own cacheline */
58 __u32 cmd_tail __attribute__((__aligned__(ALIGN_SIZE)));
59
60} __packed;
61
62enum tcmu_opcode {
63 TCMU_OP_PAD = 0,
64 TCMU_OP_CMD,
65};
66
67/*
68 * Only a few opcodes, and length is 8-byte aligned, so use low bits for opcode.
69 */
70struct tcmu_cmd_entry_hdr {
71 __u32 len_op;
72} __packed;
73
74#define TCMU_OP_MASK 0x7
75
76static inline enum tcmu_opcode tcmu_hdr_get_op(struct tcmu_cmd_entry_hdr *hdr)
77{
78 return hdr->len_op & TCMU_OP_MASK;
79}
80
81static inline void tcmu_hdr_set_op(struct tcmu_cmd_entry_hdr *hdr, enum tcmu_opcode op)
82{
83 hdr->len_op &= ~TCMU_OP_MASK;
84 hdr->len_op |= (op & TCMU_OP_MASK);
85}
86
87static inline __u32 tcmu_hdr_get_len(struct tcmu_cmd_entry_hdr *hdr)
88{
89 return hdr->len_op & ~TCMU_OP_MASK;
90}
91
92static inline void tcmu_hdr_set_len(struct tcmu_cmd_entry_hdr *hdr, __u32 len)
93{
94 hdr->len_op &= TCMU_OP_MASK;
95 hdr->len_op |= len;
96}
97
98/* Currently the same as SCSI_SENSE_BUFFERSIZE */
99#define TCMU_SENSE_BUFFERSIZE 96
100
101struct tcmu_cmd_entry {
102 struct tcmu_cmd_entry_hdr hdr;
103
104 uint16_t cmd_id;
105 uint16_t __pad1;
106
107 union {
108 struct {
109 uint64_t cdb_off;
110 uint64_t iov_cnt;
111 struct iovec iov[0];
112 } req;
113 struct {
114 uint8_t scsi_status;
115 uint8_t __pad1;
116 uint16_t __pad2;
117 uint32_t __pad3;
118 char sense_buffer[TCMU_SENSE_BUFFERSIZE];
119 } rsp;
120 };
121
122} __packed;
123
124#define TCMU_OP_ALIGN_SIZE sizeof(uint64_t)
125
126enum tcmu_genl_cmd {
127 TCMU_CMD_UNSPEC,
128 TCMU_CMD_ADDED_DEVICE,
129 TCMU_CMD_REMOVED_DEVICE,
130 __TCMU_CMD_MAX,
131};
132#define TCMU_CMD_MAX (__TCMU_CMD_MAX - 1)
133
134enum tcmu_genl_attr {
135 TCMU_ATTR_UNSPEC,
136 TCMU_ATTR_DEVICE,
137 TCMU_ATTR_MINOR,
138 __TCMU_ATTR_MAX,
139};
140#define TCMU_ATTR_MAX (__TCMU_ATTR_MAX - 1)
141
142#endif
diff --git a/include/uapi/linux/uhid.h b/include/uapi/linux/uhid.h
index 1e3b09c191cd..aaa86d6bd1dd 100644
--- a/include/uapi/linux/uhid.h
+++ b/include/uapi/linux/uhid.h
@@ -24,35 +24,23 @@
24#include <linux/hid.h> 24#include <linux/hid.h>
25 25
26enum uhid_event_type { 26enum uhid_event_type {
27 UHID_CREATE, 27 __UHID_LEGACY_CREATE,
28 UHID_DESTROY, 28 UHID_DESTROY,
29 UHID_START, 29 UHID_START,
30 UHID_STOP, 30 UHID_STOP,
31 UHID_OPEN, 31 UHID_OPEN,
32 UHID_CLOSE, 32 UHID_CLOSE,
33 UHID_OUTPUT, 33 UHID_OUTPUT,
34 UHID_OUTPUT_EV, /* obsolete! */ 34 __UHID_LEGACY_OUTPUT_EV,
35 UHID_INPUT, 35 __UHID_LEGACY_INPUT,
36 UHID_FEATURE, 36 UHID_GET_REPORT,
37 UHID_FEATURE_ANSWER, 37 UHID_GET_REPORT_REPLY,
38 UHID_CREATE2, 38 UHID_CREATE2,
39 UHID_INPUT2, 39 UHID_INPUT2,
40 UHID_SET_REPORT,
41 UHID_SET_REPORT_REPLY,
40}; 42};
41 43
42struct uhid_create_req {
43 __u8 name[128];
44 __u8 phys[64];
45 __u8 uniq[64];
46 __u8 __user *rd_data;
47 __u16 rd_size;
48
49 __u16 bus;
50 __u32 vendor;
51 __u32 product;
52 __u32 version;
53 __u32 country;
54} __attribute__((__packed__));
55
56struct uhid_create2_req { 44struct uhid_create2_req {
57 __u8 name[128]; 45 __u8 name[128];
58 __u8 phys[64]; 46 __u8 phys[64];
@@ -66,6 +54,16 @@ struct uhid_create2_req {
66 __u8 rd_data[HID_MAX_DESCRIPTOR_SIZE]; 54 __u8 rd_data[HID_MAX_DESCRIPTOR_SIZE];
67} __attribute__((__packed__)); 55} __attribute__((__packed__));
68 56
57enum uhid_dev_flag {
58 UHID_DEV_NUMBERED_FEATURE_REPORTS = (1ULL << 0),
59 UHID_DEV_NUMBERED_OUTPUT_REPORTS = (1ULL << 1),
60 UHID_DEV_NUMBERED_INPUT_REPORTS = (1ULL << 2),
61};
62
63struct uhid_start_req {
64 __u64 dev_flags;
65};
66
69#define UHID_DATA_MAX 4096 67#define UHID_DATA_MAX 4096
70 68
71enum uhid_report_type { 69enum uhid_report_type {
@@ -74,36 +72,94 @@ enum uhid_report_type {
74 UHID_INPUT_REPORT, 72 UHID_INPUT_REPORT,
75}; 73};
76 74
77struct uhid_input_req { 75struct uhid_input2_req {
76 __u16 size;
77 __u8 data[UHID_DATA_MAX];
78} __attribute__((__packed__));
79
80struct uhid_output_req {
78 __u8 data[UHID_DATA_MAX]; 81 __u8 data[UHID_DATA_MAX];
79 __u16 size; 82 __u16 size;
83 __u8 rtype;
80} __attribute__((__packed__)); 84} __attribute__((__packed__));
81 85
82struct uhid_input2_req { 86struct uhid_get_report_req {
87 __u32 id;
88 __u8 rnum;
89 __u8 rtype;
90} __attribute__((__packed__));
91
92struct uhid_get_report_reply_req {
93 __u32 id;
94 __u16 err;
83 __u16 size; 95 __u16 size;
84 __u8 data[UHID_DATA_MAX]; 96 __u8 data[UHID_DATA_MAX];
85} __attribute__((__packed__)); 97} __attribute__((__packed__));
86 98
87struct uhid_output_req { 99struct uhid_set_report_req {
100 __u32 id;
101 __u8 rnum;
102 __u8 rtype;
103 __u16 size;
104 __u8 data[UHID_DATA_MAX];
105} __attribute__((__packed__));
106
107struct uhid_set_report_reply_req {
108 __u32 id;
109 __u16 err;
110} __attribute__((__packed__));
111
112/*
113 * Compat Layer
114 * All these commands and requests are obsolete. You should avoid using them in
115 * new code. We support them for backwards-compatibility, but you might not get
116 * access to new feature in case you use them.
117 */
118
119enum uhid_legacy_event_type {
120 UHID_CREATE = __UHID_LEGACY_CREATE,
121 UHID_OUTPUT_EV = __UHID_LEGACY_OUTPUT_EV,
122 UHID_INPUT = __UHID_LEGACY_INPUT,
123 UHID_FEATURE = UHID_GET_REPORT,
124 UHID_FEATURE_ANSWER = UHID_GET_REPORT_REPLY,
125};
126
127/* Obsolete! Use UHID_CREATE2. */
128struct uhid_create_req {
129 __u8 name[128];
130 __u8 phys[64];
131 __u8 uniq[64];
132 __u8 __user *rd_data;
133 __u16 rd_size;
134
135 __u16 bus;
136 __u32 vendor;
137 __u32 product;
138 __u32 version;
139 __u32 country;
140} __attribute__((__packed__));
141
142/* Obsolete! Use UHID_INPUT2. */
143struct uhid_input_req {
88 __u8 data[UHID_DATA_MAX]; 144 __u8 data[UHID_DATA_MAX];
89 __u16 size; 145 __u16 size;
90 __u8 rtype;
91} __attribute__((__packed__)); 146} __attribute__((__packed__));
92 147
93/* Obsolete! Newer kernels will no longer send these events but instead convert 148/* Obsolete! Kernel uses UHID_OUTPUT exclusively now. */
94 * it into raw output reports via UHID_OUTPUT. */
95struct uhid_output_ev_req { 149struct uhid_output_ev_req {
96 __u16 type; 150 __u16 type;
97 __u16 code; 151 __u16 code;
98 __s32 value; 152 __s32 value;
99} __attribute__((__packed__)); 153} __attribute__((__packed__));
100 154
155/* Obsolete! Kernel uses ABI compatible UHID_GET_REPORT. */
101struct uhid_feature_req { 156struct uhid_feature_req {
102 __u32 id; 157 __u32 id;
103 __u8 rnum; 158 __u8 rnum;
104 __u8 rtype; 159 __u8 rtype;
105} __attribute__((__packed__)); 160} __attribute__((__packed__));
106 161
162/* Obsolete! Use ABI compatible UHID_GET_REPORT_REPLY. */
107struct uhid_feature_answer_req { 163struct uhid_feature_answer_req {
108 __u32 id; 164 __u32 id;
109 __u16 err; 165 __u16 err;
@@ -111,6 +167,15 @@ struct uhid_feature_answer_req {
111 __u8 data[UHID_DATA_MAX]; 167 __u8 data[UHID_DATA_MAX];
112} __attribute__((__packed__)); 168} __attribute__((__packed__));
113 169
170/*
171 * UHID Events
172 * All UHID events from and to the kernel are encoded as "struct uhid_event".
173 * The "type" field contains a UHID_* type identifier. All payload depends on
174 * that type and can be accessed via ev->u.XYZ accordingly.
175 * If user-space writes short events, they're extended with 0s by the kernel. If
176 * the kernel writes short events, user-space shall extend them with 0s.
177 */
178
114struct uhid_event { 179struct uhid_event {
115 __u32 type; 180 __u32 type;
116 181
@@ -120,9 +185,14 @@ struct uhid_event {
120 struct uhid_output_req output; 185 struct uhid_output_req output;
121 struct uhid_output_ev_req output_ev; 186 struct uhid_output_ev_req output_ev;
122 struct uhid_feature_req feature; 187 struct uhid_feature_req feature;
188 struct uhid_get_report_req get_report;
123 struct uhid_feature_answer_req feature_answer; 189 struct uhid_feature_answer_req feature_answer;
190 struct uhid_get_report_reply_req get_report_reply;
124 struct uhid_create2_req create2; 191 struct uhid_create2_req create2;
125 struct uhid_input2_req input2; 192 struct uhid_input2_req input2;
193 struct uhid_set_report_req set_report;
194 struct uhid_set_report_reply_req set_report_reply;
195 struct uhid_start_req start;
126 } u; 196 } u;
127} __attribute__((__packed__)); 197} __attribute__((__packed__));
128 198
diff --git a/include/uapi/linux/uinput.h b/include/uapi/linux/uinput.h
index 0389b489bbba..baeab83deb64 100644
--- a/include/uapi/linux/uinput.h
+++ b/include/uapi/linux/uinput.h
@@ -84,6 +84,15 @@ struct uinput_ff_erase {
84 */ 84 */
85#define UI_GET_SYSNAME(len) _IOC(_IOC_READ, UINPUT_IOCTL_BASE, 300, len) 85#define UI_GET_SYSNAME(len) _IOC(_IOC_READ, UINPUT_IOCTL_BASE, 300, len)
86 86
87/**
88 * UI_GET_VERSION - Return version of uinput protocol
89 *
90 * This writes uinput protocol version implemented by the kernel into
91 * the integer pointed to by the ioctl argument. The protocol version
92 * is hard-coded in the kernel and is independent of the uinput device.
93 */
94#define UI_GET_VERSION _IOR(UINPUT_IOCTL_BASE, 301, unsigned int)
95
87/* 96/*
88 * To write a force-feedback-capable driver, the upload_effect 97 * To write a force-feedback-capable driver, the upload_effect
89 * and erase_effect callbacks in input_dev must be implemented. 98 * and erase_effect callbacks in input_dev must be implemented.
diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h
index 0154b2859fd7..295ba299e7bd 100644
--- a/include/uapi/linux/usb/functionfs.h
+++ b/include/uapi/linux/usb/functionfs.h
@@ -19,6 +19,7 @@ enum functionfs_flags {
19 FUNCTIONFS_HAS_HS_DESC = 2, 19 FUNCTIONFS_HAS_HS_DESC = 2,
20 FUNCTIONFS_HAS_SS_DESC = 4, 20 FUNCTIONFS_HAS_SS_DESC = 4,
21 FUNCTIONFS_HAS_MS_OS_DESC = 8, 21 FUNCTIONFS_HAS_MS_OS_DESC = 8,
22 FUNCTIONFS_VIRTUAL_ADDR = 16,
22}; 23};
23 24
24/* Descriptor of an non-audio endpoint */ 25/* Descriptor of an non-audio endpoint */
@@ -32,6 +33,16 @@ struct usb_endpoint_descriptor_no_audio {
32 __u8 bInterval; 33 __u8 bInterval;
33} __attribute__((packed)); 34} __attribute__((packed));
34 35
36struct usb_functionfs_descs_head_v2 {
37 __le32 magic;
38 __le32 length;
39 __le32 flags;
40 /*
41 * __le32 fs_count, hs_count, fs_count; must be included manually in
42 * the structure taking flags into consideration.
43 */
44} __attribute__((packed));
45
35/* Legacy format, deprecated as of 3.14. */ 46/* Legacy format, deprecated as of 3.14. */
36struct usb_functionfs_descs_head { 47struct usb_functionfs_descs_head {
37 __le32 magic; 48 __le32 magic;
@@ -92,7 +103,7 @@ struct usb_ext_prop_desc {
92 * structure. Any flags that are not recognised cause the whole block to be 103 * structure. Any flags that are not recognised cause the whole block to be
93 * rejected with -ENOSYS. 104 * rejected with -ENOSYS.
94 * 105 *
95 * Legacy descriptors format: 106 * Legacy descriptors format (deprecated as of 3.14):
96 * 107 *
97 * | off | name | type | description | 108 * | off | name | type | description |
98 * |-----+-----------+--------------+--------------------------------------| 109 * |-----+-----------+--------------+--------------------------------------|
@@ -265,6 +276,12 @@ struct usb_functionfs_event {
265 */ 276 */
266#define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129) 277#define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129)
267 278
279/*
280 * Returns endpoint descriptor. If function is not active returns -ENODEV.
281 */
282#define FUNCTIONFS_ENDPOINT_DESC _IOR('g', 130, \
283 struct usb_endpoint_descriptor)
284
268 285
269 286
270#endif /* _UAPI__LINUX_FUNCTIONFS_H__ */ 287#endif /* _UAPI__LINUX_FUNCTIONFS_H__ */
diff --git a/include/uapi/linux/usbip.h b/include/uapi/linux/usbip.h
new file mode 100644
index 000000000000..fa5db30ede36
--- /dev/null
+++ b/include/uapi/linux/usbip.h
@@ -0,0 +1,26 @@
1/*
2 * usbip.h
3 *
4 * USBIP uapi defines and function prototypes etc.
5*/
6
7#ifndef _UAPI_LINUX_USBIP_H
8#define _UAPI_LINUX_USBIP_H
9
10/* usbip device status - exported in usbip device sysfs status */
11enum usbip_device_status {
12 /* sdev is available. */
13 SDEV_ST_AVAILABLE = 0x01,
14 /* sdev is now used. */
15 SDEV_ST_USED,
16 /* sdev is unusable because of a fatal error. */
17 SDEV_ST_ERROR,
18
19 /* vdev does not connect a remote device. */
20 VDEV_ST_NULL,
21 /* vdev is used, but the USB address is not assigned yet */
22 VDEV_ST_NOTASSIGNED,
23 VDEV_ST_USED,
24 VDEV_ST_ERROR
25};
26#endif /* _UAPI_LINUX_USBIP_H */
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index e946e43fb8d5..661f119a51b8 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -746,6 +746,8 @@ enum v4l2_auto_focus_range {
746 V4L2_AUTO_FOCUS_RANGE_INFINITY = 3, 746 V4L2_AUTO_FOCUS_RANGE_INFINITY = 3,
747}; 747};
748 748
749#define V4L2_CID_PAN_SPEED (V4L2_CID_CAMERA_CLASS_BASE+32)
750#define V4L2_CID_TILT_SPEED (V4L2_CID_CAMERA_CLASS_BASE+33)
749 751
750/* FM Modulator class control IDs */ 752/* FM Modulator class control IDs */
751 753
@@ -865,6 +867,10 @@ enum v4l2_jpeg_chroma_subsampling {
865#define V4L2_CID_VBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1) 867#define V4L2_CID_VBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1)
866#define V4L2_CID_HBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2) 868#define V4L2_CID_HBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2)
867#define V4L2_CID_ANALOGUE_GAIN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3) 869#define V4L2_CID_ANALOGUE_GAIN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3)
870#define V4L2_CID_TEST_PATTERN_RED (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 4)
871#define V4L2_CID_TEST_PATTERN_GREENR (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 5)
872#define V4L2_CID_TEST_PATTERN_BLUE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 6)
873#define V4L2_CID_TEST_PATTERN_GREENB (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 7)
868 874
869 875
870/* Image processing controls */ 876/* Image processing controls */
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index cb9023d4f063..29715d27548f 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -30,6 +30,12 @@
30 */ 30 */
31#define VFIO_DMA_CC_IOMMU 4 31#define VFIO_DMA_CC_IOMMU 4
32 32
33/* Check if EEH is supported */
34#define VFIO_EEH 5
35
36/* Two-stage IOMMU */
37#define VFIO_TYPE1_NESTING_IOMMU 6 /* Implies v2 */
38
33/* 39/*
34 * The IOCTL interface is designed for extensibility by embedding the 40 * The IOCTL interface is designed for extensibility by embedding the
35 * structure length (argsz) and flags into structures passed between 41 * structure length (argsz) and flags into structures passed between
@@ -455,6 +461,37 @@ struct vfio_iommu_spapr_tce_info {
455 461
456#define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) 462#define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
457 463
464/*
465 * EEH PE operation struct provides ways to:
466 * - enable/disable EEH functionality;
467 * - unfreeze IO/DMA for frozen PE;
468 * - read PE state;
469 * - reset PE;
470 * - configure PE.
471 */
472struct vfio_eeh_pe_op {
473 __u32 argsz;
474 __u32 flags;
475 __u32 op;
476};
477
478#define VFIO_EEH_PE_DISABLE 0 /* Disable EEH functionality */
479#define VFIO_EEH_PE_ENABLE 1 /* Enable EEH functionality */
480#define VFIO_EEH_PE_UNFREEZE_IO 2 /* Enable IO for frozen PE */
481#define VFIO_EEH_PE_UNFREEZE_DMA 3 /* Enable DMA for frozen PE */
482#define VFIO_EEH_PE_GET_STATE 4 /* PE state retrieval */
483#define VFIO_EEH_PE_STATE_NORMAL 0 /* PE in functional state */
484#define VFIO_EEH_PE_STATE_RESET 1 /* PE reset in progress */
485#define VFIO_EEH_PE_STATE_STOPPED 2 /* Stopped DMA and IO */
486#define VFIO_EEH_PE_STATE_STOPPED_DMA 4 /* Stopped DMA only */
487#define VFIO_EEH_PE_STATE_UNAVAIL 5 /* State unavailable */
488#define VFIO_EEH_PE_RESET_DEACTIVATE 5 /* Deassert PE reset */
489#define VFIO_EEH_PE_RESET_HOT 6 /* Assert hot reset */
490#define VFIO_EEH_PE_RESET_FUNDAMENTAL 7 /* Assert fundamental reset */
491#define VFIO_EEH_PE_CONFIGURE 8 /* PE configuration */
492
493#define VFIO_EEH_PE_OP _IO(VFIO_TYPE, VFIO_BASE + 21)
494
458/* ***************************************************************** */ 495/* ***************************************************************** */
459 496
460#endif /* _UAPIVFIO_H */ 497#endif /* _UAPIVFIO_H */
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 778a3298fb34..1c2f84fd4d99 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -79,6 +79,7 @@
79/* Four-character-code (FOURCC) */ 79/* Four-character-code (FOURCC) */
80#define v4l2_fourcc(a, b, c, d)\ 80#define v4l2_fourcc(a, b, c, d)\
81 ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24)) 81 ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24))
82#define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1 << 31))
82 83
83/* 84/*
84 * E N U M S 85 * E N U M S
@@ -307,6 +308,8 @@ struct v4l2_pix_format {
307#define V4L2_PIX_FMT_XRGB555 v4l2_fourcc('X', 'R', '1', '5') /* 16 XRGB-1-5-5-5 */ 308#define V4L2_PIX_FMT_XRGB555 v4l2_fourcc('X', 'R', '1', '5') /* 16 XRGB-1-5-5-5 */
308#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ 309#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
309#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ 310#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */
311#define V4L2_PIX_FMT_ARGB555X v4l2_fourcc_be('A', 'R', '1', '5') /* 16 ARGB-5-5-5 BE */
312#define V4L2_PIX_FMT_XRGB555X v4l2_fourcc_be('X', 'R', '1', '5') /* 16 XRGB-5-5-5 BE */
310#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ 313#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
311#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */ 314#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */
312#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ 315#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
@@ -1285,11 +1288,11 @@ struct v4l2_ext_control {
1285 union { 1288 union {
1286 __s32 value; 1289 __s32 value;
1287 __s64 value64; 1290 __s64 value64;
1288 char *string; 1291 char __user *string;
1289 __u8 *p_u8; 1292 __u8 __user *p_u8;
1290 __u16 *p_u16; 1293 __u16 __user *p_u16;
1291 __u32 *p_u32; 1294 __u32 __user *p_u32;
1292 void *ptr; 1295 void __user *ptr;
1293 }; 1296 };
1294} __attribute__ ((packed)); 1297} __attribute__ ((packed));
1295 1298
diff --git a/include/uapi/linux/virtio_blk.h b/include/uapi/linux/virtio_blk.h
index 6d8e61c48563..9ad67b267584 100644
--- a/include/uapi/linux/virtio_blk.h
+++ b/include/uapi/linux/virtio_blk.h
@@ -40,6 +40,7 @@
40#define VIRTIO_BLK_F_WCE 9 /* Writeback mode enabled after reset */ 40#define VIRTIO_BLK_F_WCE 9 /* Writeback mode enabled after reset */
41#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */ 41#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */
42#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */ 42#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */
43#define VIRTIO_BLK_F_MQ 12 /* support more than one vq */
43 44
44#ifndef __KERNEL__ 45#ifndef __KERNEL__
45/* Old (deprecated) name for VIRTIO_BLK_F_WCE. */ 46/* Old (deprecated) name for VIRTIO_BLK_F_WCE. */
@@ -77,6 +78,10 @@ struct virtio_blk_config {
77 78
78 /* writeback mode (if VIRTIO_BLK_F_CONFIG_WCE) */ 79 /* writeback mode (if VIRTIO_BLK_F_CONFIG_WCE) */
79 __u8 wce; 80 __u8 wce;
81 __u8 unused;
82
83 /* number of vqs, only available when VIRTIO_BLK_F_MQ is set */
84 __u16 num_queues;
80} __attribute__((packed)); 85} __attribute__((packed));
81 86
82/* 87/*
diff --git a/include/uapi/linux/wil6210_uapi.h b/include/uapi/linux/wil6210_uapi.h
new file mode 100644
index 000000000000..6a3cddd156c4
--- /dev/null
+++ b/include/uapi/linux/wil6210_uapi.h
@@ -0,0 +1,87 @@
1/*
2 * Copyright (c) 2014 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef __WIL6210_UAPI_H__
18#define __WIL6210_UAPI_H__
19
20#if !defined(__KERNEL__)
21#define __user
22#endif
23
24#include <linux/sockios.h>
25
26/* Numbers SIOCDEVPRIVATE and SIOCDEVPRIVATE + 1
27 * are used by Android devices to implement PNO (preferred network offload).
28 * Albeit it is temporary solution, use different numbers to avoid conflicts
29 */
30
31/**
32 * Perform 32-bit I/O operation to the card memory
33 *
34 * User code should arrange data in memory like this:
35 *
36 * struct wil_memio io;
37 * struct ifreq ifr = {
38 * .ifr_data = &io,
39 * };
40 */
41#define WIL_IOCTL_MEMIO (SIOCDEVPRIVATE + 2)
42
43/**
44 * Perform block I/O operation to the card memory
45 *
46 * User code should arrange data in memory like this:
47 *
48 * void *buf;
49 * struct wil_memio_block io = {
50 * .block = buf,
51 * };
52 * struct ifreq ifr = {
53 * .ifr_data = &io,
54 * };
55 */
56#define WIL_IOCTL_MEMIO_BLOCK (SIOCDEVPRIVATE + 3)
57
58/**
59 * operation to perform
60 *
61 * @wil_mmio_op_mask - bits defining operation,
62 * @wil_mmio_addr_mask - bits defining addressing mode
63 */
64enum wil_memio_op {
65 wil_mmio_read = 0,
66 wil_mmio_write = 1,
67 wil_mmio_op_mask = 0xff,
68 wil_mmio_addr_linker = 0 << 8,
69 wil_mmio_addr_ahb = 1 << 8,
70 wil_mmio_addr_bar = 2 << 8,
71 wil_mmio_addr_mask = 0xff00,
72};
73
74struct wil_memio {
75 uint32_t op; /* enum wil_memio_op */
76 uint32_t addr; /* should be 32-bit aligned */
77 uint32_t val;
78};
79
80struct wil_memio_block {
81 uint32_t op; /* enum wil_memio_op */
82 uint32_t addr; /* should be 32-bit aligned */
83 uint32_t size; /* should be multiple of 4 */
84 void __user *block; /* block address */
85};
86
87#endif /* __WIL6210_UAPI_H__ */
diff --git a/include/uapi/linux/xattr.h b/include/uapi/linux/xattr.h
index c38355c1f3c9..1590c49cae57 100644
--- a/include/uapi/linux/xattr.h
+++ b/include/uapi/linux/xattr.h
@@ -13,7 +13,7 @@
13#ifndef _UAPI_LINUX_XATTR_H 13#ifndef _UAPI_LINUX_XATTR_H
14#define _UAPI_LINUX_XATTR_H 14#define _UAPI_LINUX_XATTR_H
15 15
16#ifdef __UAPI_DEF_XATTR 16#if __UAPI_DEF_XATTR
17#define __USE_KERNEL_XATTR_DEFS 17#define __USE_KERNEL_XATTR_DEFS
18 18
19#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ 19#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h
index 25e5dd916ba4..02d5125a5ee8 100644
--- a/include/uapi/linux/xfrm.h
+++ b/include/uapi/linux/xfrm.h
@@ -328,6 +328,8 @@ enum xfrm_spdattr_type_t {
328 XFRMA_SPD_UNSPEC, 328 XFRMA_SPD_UNSPEC,
329 XFRMA_SPD_INFO, 329 XFRMA_SPD_INFO,
330 XFRMA_SPD_HINFO, 330 XFRMA_SPD_HINFO,
331 XFRMA_SPD_IPV4_HTHRESH,
332 XFRMA_SPD_IPV6_HTHRESH,
331 __XFRMA_SPD_MAX 333 __XFRMA_SPD_MAX
332 334
333#define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1) 335#define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1)
@@ -347,6 +349,11 @@ struct xfrmu_spdhinfo {
347 __u32 spdhmcnt; 349 __u32 spdhmcnt;
348}; 350};
349 351
352struct xfrmu_spdhthresh {
353 __u8 lbits;
354 __u8 rbits;
355};
356
350struct xfrm_usersa_info { 357struct xfrm_usersa_info {
351 struct xfrm_selector sel; 358 struct xfrm_selector sel;
352 struct xfrm_id id; 359 struct xfrm_id id;
diff --git a/include/uapi/misc/Kbuild b/include/uapi/misc/Kbuild
new file mode 100644
index 000000000000..e96cae7d58c9
--- /dev/null
+++ b/include/uapi/misc/Kbuild
@@ -0,0 +1,2 @@
1# misc Header export list
2header-y += cxl.h
diff --git a/include/uapi/misc/cxl.h b/include/uapi/misc/cxl.h
new file mode 100644
index 000000000000..cd6d789b73ec
--- /dev/null
+++ b/include/uapi/misc/cxl.h
@@ -0,0 +1,88 @@
1/*
2 * Copyright 2014 IBM Corp.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#ifndef _UAPI_MISC_CXL_H
11#define _UAPI_MISC_CXL_H
12
13#include <linux/types.h>
14#include <linux/ioctl.h>
15
16
17struct cxl_ioctl_start_work {
18 __u64 flags;
19 __u64 work_element_descriptor;
20 __u64 amr;
21 __s16 num_interrupts;
22 __s16 reserved1;
23 __s32 reserved2;
24 __u64 reserved3;
25 __u64 reserved4;
26 __u64 reserved5;
27 __u64 reserved6;
28};
29
30#define CXL_START_WORK_AMR 0x0000000000000001ULL
31#define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL
32#define CXL_START_WORK_ALL (CXL_START_WORK_AMR |\
33 CXL_START_WORK_NUM_IRQS)
34
35/* ioctl numbers */
36#define CXL_MAGIC 0xCA
37#define CXL_IOCTL_START_WORK _IOW(CXL_MAGIC, 0x00, struct cxl_ioctl_start_work)
38#define CXL_IOCTL_GET_PROCESS_ELEMENT _IOR(CXL_MAGIC, 0x01, __u32)
39
40#define CXL_READ_MIN_SIZE 0x1000 /* 4K */
41
42/* Events from read() */
43enum cxl_event_type {
44 CXL_EVENT_RESERVED = 0,
45 CXL_EVENT_AFU_INTERRUPT = 1,
46 CXL_EVENT_DATA_STORAGE = 2,
47 CXL_EVENT_AFU_ERROR = 3,
48};
49
50struct cxl_event_header {
51 __u16 type;
52 __u16 size;
53 __u16 process_element;
54 __u16 reserved1;
55};
56
57struct cxl_event_afu_interrupt {
58 __u16 flags;
59 __u16 irq; /* Raised AFU interrupt number */
60 __u32 reserved1;
61};
62
63struct cxl_event_data_storage {
64 __u16 flags;
65 __u16 reserved1;
66 __u32 reserved2;
67 __u64 addr;
68 __u64 dsisr;
69 __u64 reserved3;
70};
71
72struct cxl_event_afu_error {
73 __u16 flags;
74 __u16 reserved1;
75 __u32 reserved2;
76 __u64 error;
77};
78
79struct cxl_event {
80 struct cxl_event_header header;
81 union {
82 struct cxl_event_afu_interrupt irq;
83 struct cxl_event_data_storage fault;
84 struct cxl_event_afu_error afu_error;
85 };
86};
87
88#endif /* _UAPI_MISC_CXL_H */
diff --git a/include/uapi/rdma/ib_user_mad.h b/include/uapi/rdma/ib_user_mad.h
index d6fce1cbdb90..09f809f323ea 100644
--- a/include/uapi/rdma/ib_user_mad.h
+++ b/include/uapi/rdma/ib_user_mad.h
@@ -191,6 +191,45 @@ struct ib_user_mad_reg_req {
191 __u8 rmpp_version; 191 __u8 rmpp_version;
192}; 192};
193 193
194/**
195 * ib_user_mad_reg_req2 - MAD registration request
196 *
197 * @id - Set by the _kernel_; used by userspace to identify the
198 * registered agent in future requests.
199 * @qpn - Queue pair number; must be 0 or 1.
200 * @mgmt_class - Indicates which management class of MADs should be
201 * receive by the caller. This field is only required if
202 * the user wishes to receive unsolicited MADs, otherwise
203 * it should be 0.
204 * @mgmt_class_version - Indicates which version of MADs for the given
205 * management class to receive.
206 * @res - Ignored.
207 * @flags - additional registration flags; Must be in the set of
208 * flags defined in IB_USER_MAD_REG_FLAGS_CAP
209 * @method_mask - The caller wishes to receive unsolicited MADs for the
210 * methods whose bit(s) is(are) set.
211 * @oui - Indicates IEEE OUI to use when mgmt_class is a vendor
212 * class in the range from 0x30 to 0x4f. Otherwise not
213 * used.
214 * @rmpp_version - If set, indicates the RMPP version to use.
215 */
216enum {
217 IB_USER_MAD_USER_RMPP = (1 << 0),
218};
219#define IB_USER_MAD_REG_FLAGS_CAP (IB_USER_MAD_USER_RMPP)
220struct ib_user_mad_reg_req2 {
221 __u32 id;
222 __u32 qpn;
223 __u8 mgmt_class;
224 __u8 mgmt_class_version;
225 __u16 res;
226 __u32 flags;
227 __u64 method_mask[2];
228 __u32 oui;
229 __u8 rmpp_version;
230 __u8 reserved[3];
231};
232
194#define IB_IOCTL_MAGIC 0x1b 233#define IB_IOCTL_MAGIC 0x1b
195 234
196#define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ 235#define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \
@@ -200,4 +239,7 @@ struct ib_user_mad_reg_req {
200 239
201#define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3) 240#define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3)
202 241
242#define IB_USER_MAD_REGISTER_AGENT2 _IOWR(IB_IOCTL_MAGIC, 4, \
243 struct ib_user_mad_reg_req2)
244
203#endif /* IB_USER_MAD_H */ 245#endif /* IB_USER_MAD_H */
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index cbfdd4ca9510..26daf55ff76e 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -276,6 +276,22 @@ struct ib_uverbs_reg_mr_resp {
276 __u32 rkey; 276 __u32 rkey;
277}; 277};
278 278
279struct ib_uverbs_rereg_mr {
280 __u64 response;
281 __u32 mr_handle;
282 __u32 flags;
283 __u64 start;
284 __u64 length;
285 __u64 hca_va;
286 __u32 pd_handle;
287 __u32 access_flags;
288};
289
290struct ib_uverbs_rereg_mr_resp {
291 __u32 lkey;
292 __u32 rkey;
293};
294
279struct ib_uverbs_dereg_mr { 295struct ib_uverbs_dereg_mr {
280 __u32 mr_handle; 296 __u32 mr_handle;
281}; 297};
diff --git a/include/uapi/rdma/rdma_user_cm.h b/include/uapi/rdma/rdma_user_cm.h
index 99b80abf360a..3066718eb120 100644
--- a/include/uapi/rdma/rdma_user_cm.h
+++ b/include/uapi/rdma/rdma_user_cm.h
@@ -34,6 +34,7 @@
34#define RDMA_USER_CM_H 34#define RDMA_USER_CM_H
35 35
36#include <linux/types.h> 36#include <linux/types.h>
37#include <linux/socket.h>
37#include <linux/in6.h> 38#include <linux/in6.h>
38#include <rdma/ib_user_verbs.h> 39#include <rdma/ib_user_verbs.h>
39#include <rdma/ib_user_sa.h> 40#include <rdma/ib_user_sa.h>
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index 32168f7ffce3..6ee586728df9 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -219,7 +219,8 @@ typedef int __bitwise snd_pcm_format_t;
219#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */ 219#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
220#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ 220#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
221#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ 221#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
222#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U16_LE 222#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
223#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_LE
223 224
224#ifdef SNDRV_LITTLE_ENDIAN 225#ifdef SNDRV_LITTLE_ENDIAN
225#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE 226#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
index 3e43e22cdff9..c74bf4a0520e 100644
--- a/include/video/imx-ipu-v3.h
+++ b/include/video/imx-ipu-v3.h
@@ -16,6 +16,7 @@
16#include <linux/videodev2.h> 16#include <linux/videodev2.h>
17#include <linux/bitmap.h> 17#include <linux/bitmap.h>
18#include <linux/fb.h> 18#include <linux/fb.h>
19#include <media/v4l2-mediabus.h>
19 20
20struct ipu_soc; 21struct ipu_soc;
21 22
@@ -61,6 +62,29 @@ struct ipu_di_signal_cfg {
61 u8 vsync_pin; 62 u8 vsync_pin;
62}; 63};
63 64
65/*
66 * Enumeration of CSI destinations
67 */
68enum ipu_csi_dest {
69 IPU_CSI_DEST_IDMAC, /* to memory via SMFC */
70 IPU_CSI_DEST_IC, /* to Image Converter */
71 IPU_CSI_DEST_VDIC, /* to VDIC */
72};
73
74/*
75 * Enumeration of IPU rotation modes
76 */
77enum ipu_rotate_mode {
78 IPU_ROTATE_NONE = 0,
79 IPU_ROTATE_VERT_FLIP,
80 IPU_ROTATE_HORIZ_FLIP,
81 IPU_ROTATE_180,
82 IPU_ROTATE_90_RIGHT,
83 IPU_ROTATE_90_RIGHT_VFLIP,
84 IPU_ROTATE_90_RIGHT_HFLIP,
85 IPU_ROTATE_90_LEFT,
86};
87
64enum ipu_color_space { 88enum ipu_color_space {
65 IPUV3_COLORSPACE_RGB, 89 IPUV3_COLORSPACE_RGB,
66 IPUV3_COLORSPACE_YUV, 90 IPUV3_COLORSPACE_YUV,
@@ -76,6 +100,36 @@ enum ipu_channel_irq {
76 IPU_IRQ_EOS = 192, 100 IPU_IRQ_EOS = 192,
77}; 101};
78 102
103/*
104 * Enumeration of IDMAC channels
105 */
106#define IPUV3_CHANNEL_CSI0 0
107#define IPUV3_CHANNEL_CSI1 1
108#define IPUV3_CHANNEL_CSI2 2
109#define IPUV3_CHANNEL_CSI3 3
110#define IPUV3_CHANNEL_VDI_MEM_IC_VF 5
111#define IPUV3_CHANNEL_MEM_IC_PP 11
112#define IPUV3_CHANNEL_MEM_IC_PRP_VF 12
113#define IPUV3_CHANNEL_G_MEM_IC_PRP_VF 14
114#define IPUV3_CHANNEL_G_MEM_IC_PP 15
115#define IPUV3_CHANNEL_IC_PRP_ENC_MEM 20
116#define IPUV3_CHANNEL_IC_PRP_VF_MEM 21
117#define IPUV3_CHANNEL_IC_PP_MEM 22
118#define IPUV3_CHANNEL_MEM_BG_SYNC 23
119#define IPUV3_CHANNEL_MEM_BG_ASYNC 24
120#define IPUV3_CHANNEL_MEM_FG_SYNC 27
121#define IPUV3_CHANNEL_MEM_DC_SYNC 28
122#define IPUV3_CHANNEL_MEM_FG_ASYNC 29
123#define IPUV3_CHANNEL_MEM_FG_SYNC_ALPHA 31
124#define IPUV3_CHANNEL_MEM_DC_ASYNC 41
125#define IPUV3_CHANNEL_MEM_ROT_ENC 45
126#define IPUV3_CHANNEL_MEM_ROT_VF 46
127#define IPUV3_CHANNEL_MEM_ROT_PP 47
128#define IPUV3_CHANNEL_ROT_ENC_MEM 48
129#define IPUV3_CHANNEL_ROT_VF_MEM 49
130#define IPUV3_CHANNEL_ROT_PP_MEM 50
131#define IPUV3_CHANNEL_MEM_BG_SYNC_ALPHA 51
132
79int ipu_map_irq(struct ipu_soc *ipu, int irq); 133int ipu_map_irq(struct ipu_soc *ipu, int irq);
80int ipu_idmac_channel_irq(struct ipu_soc *ipu, struct ipuv3_channel *channel, 134int ipu_idmac_channel_irq(struct ipu_soc *ipu, struct ipuv3_channel *channel,
81 enum ipu_channel_irq irq); 135 enum ipu_channel_irq irq);
@@ -93,6 +147,13 @@ int ipu_idmac_channel_irq(struct ipu_soc *ipu, struct ipuv3_channel *channel,
93#define IPU_IRQ_VSYNC_PRE_1 (448 + 15) 147#define IPU_IRQ_VSYNC_PRE_1 (448 + 15)
94 148
95/* 149/*
150 * IPU Common functions
151 */
152void ipu_set_csi_src_mux(struct ipu_soc *ipu, int csi_id, bool mipi_csi2);
153void ipu_set_ic_src_mux(struct ipu_soc *ipu, int csi_id, bool vdi);
154void ipu_dump(struct ipu_soc *ipu);
155
156/*
96 * IPU Image DMA Controller (idmac) functions 157 * IPU Image DMA Controller (idmac) functions
97 */ 158 */
98struct ipuv3_channel *ipu_idmac_get(struct ipu_soc *ipu, unsigned channel); 159struct ipuv3_channel *ipu_idmac_get(struct ipu_soc *ipu, unsigned channel);
@@ -100,12 +161,58 @@ void ipu_idmac_put(struct ipuv3_channel *);
100 161
101int ipu_idmac_enable_channel(struct ipuv3_channel *channel); 162int ipu_idmac_enable_channel(struct ipuv3_channel *channel);
102int ipu_idmac_disable_channel(struct ipuv3_channel *channel); 163int ipu_idmac_disable_channel(struct ipuv3_channel *channel);
164void ipu_idmac_enable_watermark(struct ipuv3_channel *channel, bool enable);
165int ipu_idmac_lock_enable(struct ipuv3_channel *channel, int num_bursts);
103int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms); 166int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms);
104 167
105void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel, 168void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel,
106 bool doublebuffer); 169 bool doublebuffer);
107int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel); 170int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel);
171bool ipu_idmac_buffer_is_ready(struct ipuv3_channel *channel, u32 buf_num);
108void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num); 172void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num);
173void ipu_idmac_clear_buffer(struct ipuv3_channel *channel, u32 buf_num);
174
175/*
176 * IPU Channel Parameter Memory (cpmem) functions
177 */
178struct ipu_rgb {
179 struct fb_bitfield red;
180 struct fb_bitfield green;
181 struct fb_bitfield blue;
182 struct fb_bitfield transp;
183 int bits_per_pixel;
184};
185
186struct ipu_image {
187 struct v4l2_pix_format pix;
188 struct v4l2_rect rect;
189 dma_addr_t phys0;
190 dma_addr_t phys1;
191};
192
193void ipu_cpmem_zero(struct ipuv3_channel *ch);
194void ipu_cpmem_set_resolution(struct ipuv3_channel *ch, int xres, int yres);
195void ipu_cpmem_set_stride(struct ipuv3_channel *ch, int stride);
196void ipu_cpmem_set_high_priority(struct ipuv3_channel *ch);
197void ipu_cpmem_set_buffer(struct ipuv3_channel *ch, int bufnum, dma_addr_t buf);
198void ipu_cpmem_interlaced_scan(struct ipuv3_channel *ch, int stride);
199void ipu_cpmem_set_axi_id(struct ipuv3_channel *ch, u32 id);
200void ipu_cpmem_set_burstsize(struct ipuv3_channel *ch, int burstsize);
201void ipu_cpmem_set_block_mode(struct ipuv3_channel *ch);
202void ipu_cpmem_set_rotation(struct ipuv3_channel *ch,
203 enum ipu_rotate_mode rot);
204int ipu_cpmem_set_format_rgb(struct ipuv3_channel *ch,
205 const struct ipu_rgb *rgb);
206int ipu_cpmem_set_format_passthrough(struct ipuv3_channel *ch, int width);
207void ipu_cpmem_set_yuv_interleaved(struct ipuv3_channel *ch, u32 pixel_format);
208void ipu_cpmem_set_yuv_planar_full(struct ipuv3_channel *ch,
209 u32 pixel_format, int stride,
210 int u_offset, int v_offset);
211void ipu_cpmem_set_yuv_planar(struct ipuv3_channel *ch,
212 u32 pixel_format, int stride, int height);
213int ipu_cpmem_set_fmt(struct ipuv3_channel *ch, u32 drm_fourcc);
214int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image);
215void ipu_cpmem_dump(struct ipuv3_channel *ch);
109 216
110/* 217/*
111 * IPU Display Controller (dc) functions 218 * IPU Display Controller (dc) functions
@@ -169,171 +276,78 @@ int ipu_dp_set_global_alpha(struct ipu_dp *dp, bool enable, u8 alpha,
169/* 276/*
170 * IPU CMOS Sensor Interface (csi) functions 277 * IPU CMOS Sensor Interface (csi) functions
171 */ 278 */
172int ipu_csi_enable(struct ipu_soc *ipu, int csi); 279struct ipu_csi;
173int ipu_csi_disable(struct ipu_soc *ipu, int csi); 280int ipu_csi_init_interface(struct ipu_csi *csi,
281 struct v4l2_mbus_config *mbus_cfg,
282 struct v4l2_mbus_framefmt *mbus_fmt);
283bool ipu_csi_is_interlaced(struct ipu_csi *csi);
284void ipu_csi_get_window(struct ipu_csi *csi, struct v4l2_rect *w);
285void ipu_csi_set_window(struct ipu_csi *csi, struct v4l2_rect *w);
286void ipu_csi_set_test_generator(struct ipu_csi *csi, bool active,
287 u32 r_value, u32 g_value, u32 b_value,
288 u32 pix_clk);
289int ipu_csi_set_mipi_datatype(struct ipu_csi *csi, u32 vc,
290 struct v4l2_mbus_framefmt *mbus_fmt);
291int ipu_csi_set_skip_smfc(struct ipu_csi *csi, u32 skip,
292 u32 max_ratio, u32 id);
293int ipu_csi_set_dest(struct ipu_csi *csi, enum ipu_csi_dest csi_dest);
294int ipu_csi_enable(struct ipu_csi *csi);
295int ipu_csi_disable(struct ipu_csi *csi);
296struct ipu_csi *ipu_csi_get(struct ipu_soc *ipu, int id);
297void ipu_csi_put(struct ipu_csi *csi);
298void ipu_csi_dump(struct ipu_csi *csi);
174 299
175/* 300/*
176 * IPU Sensor Multiple FIFO Controller (SMFC) functions 301 * IPU Image Converter (ic) functions
177 */ 302 */
178int ipu_smfc_enable(struct ipu_soc *ipu); 303enum ipu_ic_task {
179int ipu_smfc_disable(struct ipu_soc *ipu); 304 IC_TASK_ENCODER,
180int ipu_smfc_map_channel(struct ipu_soc *ipu, int channel, int csi_id, int mipi_id); 305 IC_TASK_VIEWFINDER,
181int ipu_smfc_set_burstsize(struct ipu_soc *ipu, int channel, int burstsize); 306 IC_TASK_POST_PROCESSOR,
182 307 IC_NUM_TASKS,
183#define IPU_CPMEM_WORD(word, ofs, size) ((((word) * 160 + (ofs)) << 8) | (size))
184
185#define IPU_FIELD_UBO IPU_CPMEM_WORD(0, 46, 22)
186#define IPU_FIELD_VBO IPU_CPMEM_WORD(0, 68, 22)
187#define IPU_FIELD_IOX IPU_CPMEM_WORD(0, 90, 4)
188#define IPU_FIELD_RDRW IPU_CPMEM_WORD(0, 94, 1)
189#define IPU_FIELD_SO IPU_CPMEM_WORD(0, 113, 1)
190#define IPU_FIELD_SLY IPU_CPMEM_WORD(1, 102, 14)
191#define IPU_FIELD_SLUV IPU_CPMEM_WORD(1, 128, 14)
192
193#define IPU_FIELD_XV IPU_CPMEM_WORD(0, 0, 10)
194#define IPU_FIELD_YV IPU_CPMEM_WORD(0, 10, 9)
195#define IPU_FIELD_XB IPU_CPMEM_WORD(0, 19, 13)
196#define IPU_FIELD_YB IPU_CPMEM_WORD(0, 32, 12)
197#define IPU_FIELD_NSB_B IPU_CPMEM_WORD(0, 44, 1)
198#define IPU_FIELD_CF IPU_CPMEM_WORD(0, 45, 1)
199#define IPU_FIELD_SX IPU_CPMEM_WORD(0, 46, 12)
200#define IPU_FIELD_SY IPU_CPMEM_WORD(0, 58, 11)
201#define IPU_FIELD_NS IPU_CPMEM_WORD(0, 69, 10)
202#define IPU_FIELD_SDX IPU_CPMEM_WORD(0, 79, 7)
203#define IPU_FIELD_SM IPU_CPMEM_WORD(0, 86, 10)
204#define IPU_FIELD_SCC IPU_CPMEM_WORD(0, 96, 1)
205#define IPU_FIELD_SCE IPU_CPMEM_WORD(0, 97, 1)
206#define IPU_FIELD_SDY IPU_CPMEM_WORD(0, 98, 7)
207#define IPU_FIELD_SDRX IPU_CPMEM_WORD(0, 105, 1)
208#define IPU_FIELD_SDRY IPU_CPMEM_WORD(0, 106, 1)
209#define IPU_FIELD_BPP IPU_CPMEM_WORD(0, 107, 3)
210#define IPU_FIELD_DEC_SEL IPU_CPMEM_WORD(0, 110, 2)
211#define IPU_FIELD_DIM IPU_CPMEM_WORD(0, 112, 1)
212#define IPU_FIELD_BNDM IPU_CPMEM_WORD(0, 114, 3)
213#define IPU_FIELD_BM IPU_CPMEM_WORD(0, 117, 2)
214#define IPU_FIELD_ROT IPU_CPMEM_WORD(0, 119, 1)
215#define IPU_FIELD_HF IPU_CPMEM_WORD(0, 120, 1)
216#define IPU_FIELD_VF IPU_CPMEM_WORD(0, 121, 1)
217#define IPU_FIELD_THE IPU_CPMEM_WORD(0, 122, 1)
218#define IPU_FIELD_CAP IPU_CPMEM_WORD(0, 123, 1)
219#define IPU_FIELD_CAE IPU_CPMEM_WORD(0, 124, 1)
220#define IPU_FIELD_FW IPU_CPMEM_WORD(0, 125, 13)
221#define IPU_FIELD_FH IPU_CPMEM_WORD(0, 138, 12)
222#define IPU_FIELD_EBA0 IPU_CPMEM_WORD(1, 0, 29)
223#define IPU_FIELD_EBA1 IPU_CPMEM_WORD(1, 29, 29)
224#define IPU_FIELD_ILO IPU_CPMEM_WORD(1, 58, 20)
225#define IPU_FIELD_NPB IPU_CPMEM_WORD(1, 78, 7)
226#define IPU_FIELD_PFS IPU_CPMEM_WORD(1, 85, 4)
227#define IPU_FIELD_ALU IPU_CPMEM_WORD(1, 89, 1)
228#define IPU_FIELD_ALBM IPU_CPMEM_WORD(1, 90, 3)
229#define IPU_FIELD_ID IPU_CPMEM_WORD(1, 93, 2)
230#define IPU_FIELD_TH IPU_CPMEM_WORD(1, 95, 7)
231#define IPU_FIELD_SL IPU_CPMEM_WORD(1, 102, 14)
232#define IPU_FIELD_WID0 IPU_CPMEM_WORD(1, 116, 3)
233#define IPU_FIELD_WID1 IPU_CPMEM_WORD(1, 119, 3)
234#define IPU_FIELD_WID2 IPU_CPMEM_WORD(1, 122, 3)
235#define IPU_FIELD_WID3 IPU_CPMEM_WORD(1, 125, 3)
236#define IPU_FIELD_OFS0 IPU_CPMEM_WORD(1, 128, 5)
237#define IPU_FIELD_OFS1 IPU_CPMEM_WORD(1, 133, 5)
238#define IPU_FIELD_OFS2 IPU_CPMEM_WORD(1, 138, 5)
239#define IPU_FIELD_OFS3 IPU_CPMEM_WORD(1, 143, 5)
240#define IPU_FIELD_SXYS IPU_CPMEM_WORD(1, 148, 1)
241#define IPU_FIELD_CRE IPU_CPMEM_WORD(1, 149, 1)
242#define IPU_FIELD_DEC_SEL2 IPU_CPMEM_WORD(1, 150, 1)
243
244struct ipu_cpmem_word {
245 u32 data[5];
246 u32 res[3];
247};
248
249struct ipu_ch_param {
250 struct ipu_cpmem_word word[2];
251};
252
253void ipu_ch_param_write_field(struct ipu_ch_param __iomem *base, u32 wbs, u32 v);
254u32 ipu_ch_param_read_field(struct ipu_ch_param __iomem *base, u32 wbs);
255struct ipu_ch_param __iomem *ipu_get_cpmem(struct ipuv3_channel *channel);
256void ipu_ch_param_dump(struct ipu_ch_param __iomem *p);
257
258static inline void ipu_ch_param_zero(struct ipu_ch_param __iomem *p)
259{
260 int i;
261 void __iomem *base = p;
262
263 for (i = 0; i < sizeof(*p) / sizeof(u32); i++)
264 writel(0, base + i * sizeof(u32));
265}
266
267static inline void ipu_cpmem_set_buffer(struct ipu_ch_param __iomem *p,
268 int bufnum, dma_addr_t buf)
269{
270 if (bufnum)
271 ipu_ch_param_write_field(p, IPU_FIELD_EBA1, buf >> 3);
272 else
273 ipu_ch_param_write_field(p, IPU_FIELD_EBA0, buf >> 3);
274}
275
276static inline void ipu_cpmem_set_resolution(struct ipu_ch_param __iomem *p,
277 int xres, int yres)
278{
279 ipu_ch_param_write_field(p, IPU_FIELD_FW, xres - 1);
280 ipu_ch_param_write_field(p, IPU_FIELD_FH, yres - 1);
281}
282
283static inline void ipu_cpmem_set_stride(struct ipu_ch_param __iomem *p,
284 int stride)
285{
286 ipu_ch_param_write_field(p, IPU_FIELD_SLY, stride - 1);
287}
288
289void ipu_cpmem_set_high_priority(struct ipuv3_channel *channel);
290
291struct ipu_rgb {
292 struct fb_bitfield red;
293 struct fb_bitfield green;
294 struct fb_bitfield blue;
295 struct fb_bitfield transp;
296 int bits_per_pixel;
297};
298
299struct ipu_image {
300 struct v4l2_pix_format pix;
301 struct v4l2_rect rect;
302 dma_addr_t phys;
303}; 308};
304 309
305int ipu_cpmem_set_format_passthrough(struct ipu_ch_param __iomem *p, 310struct ipu_ic;
306 int width); 311int ipu_ic_task_init(struct ipu_ic *ic,
307 312 int in_width, int in_height,
308int ipu_cpmem_set_format_rgb(struct ipu_ch_param __iomem *, 313 int out_width, int out_height,
309 const struct ipu_rgb *rgb); 314 enum ipu_color_space in_cs,
310 315 enum ipu_color_space out_cs);
311static inline void ipu_cpmem_interlaced_scan(struct ipu_ch_param *p, 316int ipu_ic_task_graphics_init(struct ipu_ic *ic,
312 int stride) 317 enum ipu_color_space in_g_cs,
313{ 318 bool galpha_en, u32 galpha,
314 ipu_ch_param_write_field(p, IPU_FIELD_SO, 1); 319 bool colorkey_en, u32 colorkey);
315 ipu_ch_param_write_field(p, IPU_FIELD_ILO, stride / 8); 320void ipu_ic_task_enable(struct ipu_ic *ic);
316 ipu_ch_param_write_field(p, IPU_FIELD_SLY, (stride * 2) - 1); 321void ipu_ic_task_disable(struct ipu_ic *ic);
317}; 322int ipu_ic_task_idma_init(struct ipu_ic *ic, struct ipuv3_channel *channel,
323 u32 width, u32 height, int burst_size,
324 enum ipu_rotate_mode rot);
325int ipu_ic_enable(struct ipu_ic *ic);
326int ipu_ic_disable(struct ipu_ic *ic);
327struct ipu_ic *ipu_ic_get(struct ipu_soc *ipu, enum ipu_ic_task task);
328void ipu_ic_put(struct ipu_ic *ic);
329void ipu_ic_dump(struct ipu_ic *ic);
318 330
319void ipu_cpmem_set_yuv_planar(struct ipu_ch_param __iomem *p, u32 pixel_format, 331/*
320 int stride, int height); 332 * IPU Sensor Multiple FIFO Controller (SMFC) functions
321void ipu_cpmem_set_yuv_interleaved(struct ipu_ch_param __iomem *p, 333 */
322 u32 pixel_format); 334struct ipu_smfc *ipu_smfc_get(struct ipu_soc *ipu, unsigned int chno);
323void ipu_cpmem_set_yuv_planar_full(struct ipu_ch_param __iomem *p, 335void ipu_smfc_put(struct ipu_smfc *smfc);
324 u32 pixel_format, int stride, int u_offset, int v_offset); 336int ipu_smfc_enable(struct ipu_smfc *smfc);
325int ipu_cpmem_set_fmt(struct ipu_ch_param __iomem *cpmem, u32 pixelformat); 337int ipu_smfc_disable(struct ipu_smfc *smfc);
326int ipu_cpmem_set_image(struct ipu_ch_param __iomem *cpmem, 338int ipu_smfc_map_channel(struct ipu_smfc *smfc, int csi_id, int mipi_id);
327 struct ipu_image *image); 339int ipu_smfc_set_burstsize(struct ipu_smfc *smfc, int burstsize);
340int ipu_smfc_set_watermark(struct ipu_smfc *smfc, u32 set_level, u32 clr_level);
328 341
329enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc); 342enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc);
330enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat); 343enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat);
331 344enum ipu_color_space ipu_mbus_code_to_colorspace(u32 mbus_code);
332static inline void ipu_cpmem_set_burstsize(struct ipu_ch_param __iomem *p, 345int ipu_stride_to_bytes(u32 pixel_stride, u32 pixelformat);
333 int burstsize) 346bool ipu_pixelformat_is_planar(u32 pixelformat);
334{ 347int ipu_degrees_to_rot_mode(enum ipu_rotate_mode *mode, int degrees,
335 ipu_ch_param_write_field(p, IPU_FIELD_NPB, burstsize - 1); 348 bool hflip, bool vflip);
336}; 349int ipu_rot_mode_to_degrees(int *degrees, enum ipu_rotate_mode mode,
350 bool hflip, bool vflip);
337 351
338struct ipu_client_platformdata { 352struct ipu_client_platformdata {
339 int csi; 353 int csi;
diff --git a/include/video/of_display_timing.h b/include/video/of_display_timing.h
index 79e6697af6cf..ea755b5616d8 100644
--- a/include/video/of_display_timing.h
+++ b/include/video/of_display_timing.h
@@ -15,9 +15,25 @@ struct display_timings;
15 15
16#define OF_USE_NATIVE_MODE -1 16#define OF_USE_NATIVE_MODE -1
17 17
18#ifdef CONFIG_OF
18int of_get_display_timing(struct device_node *np, const char *name, 19int of_get_display_timing(struct device_node *np, const char *name,
19 struct display_timing *dt); 20 struct display_timing *dt);
20struct display_timings *of_get_display_timings(struct device_node *np); 21struct display_timings *of_get_display_timings(struct device_node *np);
21int of_display_timings_exist(struct device_node *np); 22int of_display_timings_exist(struct device_node *np);
23#else
24static inline int of_get_display_timing(struct device_node *np, const char *name,
25 struct display_timing *dt)
26{
27 return -ENOSYS;
28}
29static inline struct display_timings *of_get_display_timings(struct device_node *np)
30{
31 return NULL;
32}
33static inline int of_display_timings_exist(struct device_node *np)
34{
35 return -ENOSYS;
36}
37#endif
22 38
23#endif 39#endif
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index fc06c5b5f12a..069dfca9549a 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -61,6 +61,7 @@ struct omap_overlay_manager;
61struct dss_lcd_mgr_config; 61struct dss_lcd_mgr_config;
62struct snd_aes_iec958; 62struct snd_aes_iec958;
63struct snd_cea_861_aud_if; 63struct snd_cea_861_aud_if;
64struct hdmi_avi_infoframe;
64 65
65enum omap_display_type { 66enum omap_display_type {
66 OMAP_DISPLAY_TYPE_NONE = 0, 67 OMAP_DISPLAY_TYPE_NONE = 0,
@@ -631,6 +632,10 @@ struct omapdss_hdmi_ops {
631 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len); 632 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
632 bool (*detect)(struct omap_dss_device *dssdev); 633 bool (*detect)(struct omap_dss_device *dssdev);
633 634
635 int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
636 int (*set_infoframe)(struct omap_dss_device *dssdev,
637 const struct hdmi_avi_infoframe *avi);
638
634 /* 639 /*
635 * Note: These functions might sleep. Do not call while 640 * Note: These functions might sleep. Do not call while
636 * holding a spinlock/readlock. 641 * holding a spinlock/readlock.
@@ -850,6 +855,10 @@ struct omap_dss_driver {
850 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len); 855 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
851 bool (*detect)(struct omap_dss_device *dssdev); 856 bool (*detect)(struct omap_dss_device *dssdev);
852 857
858 int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
859 int (*set_hdmi_infoframe)(struct omap_dss_device *dssdev,
860 const struct hdmi_avi_infoframe *avi);
861
853 /* 862 /*
854 * For display drivers that support audio. This encompasses 863 * For display drivers that support audio. This encompasses
855 * HDMI and DisplayPort at the moment. 864 * HDMI and DisplayPort at the moment.
diff --git a/include/video/samsung_fimd.h b/include/video/samsung_fimd.h
index b0393209679b..a20e4a3a8b15 100644
--- a/include/video/samsung_fimd.h
+++ b/include/video/samsung_fimd.h
@@ -19,6 +19,7 @@
19/* VIDCON0 */ 19/* VIDCON0 */
20 20
21#define VIDCON0 0x00 21#define VIDCON0 0x00
22#define VIDCON0_DSI_EN (1 << 30)
22#define VIDCON0_INTERLACE (1 << 29) 23#define VIDCON0_INTERLACE (1 << 29)
23#define VIDCON0_VIDOUT_MASK (0x7 << 26) 24#define VIDCON0_VIDOUT_MASK (0x7 << 26)
24#define VIDCON0_VIDOUT_SHIFT 26 25#define VIDCON0_VIDOUT_SHIFT 26
@@ -107,7 +108,7 @@
107#define VIDCON2_ORGYCbCr (1 << 8) 108#define VIDCON2_ORGYCbCr (1 << 8)
108#define VIDCON2_YUVORDCrCb (1 << 7) 109#define VIDCON2_YUVORDCrCb (1 << 7)
109 110
110/* PRTCON (S3C6410, S5PC100) 111/* PRTCON (S3C6410)
111 * Might not be present in the S3C6410 documentation, 112 * Might not be present in the S3C6410 documentation,
112 * but tests prove it's there almost for sure; shouldn't hurt in any case. 113 * but tests prove it's there almost for sure; shouldn't hurt in any case.
113 */ 114 */
@@ -355,7 +356,7 @@
355#define VIDINTCON0_INT_ENABLE (1 << 0) 356#define VIDINTCON0_INT_ENABLE (1 << 0)
356 357
357#define VIDINTCON1 0x134 358#define VIDINTCON1 0x134
358#define VIDINTCON1_INT_I180 (1 << 2) 359#define VIDINTCON1_INT_I80 (1 << 2)
359#define VIDINTCON1_INT_FRAME (1 << 1) 360#define VIDINTCON1_INT_FRAME (1 << 1)
360#define VIDINTCON1_INT_FIFO (1 << 0) 361#define VIDINTCON1_INT_FIFO (1 << 0)
361 362
diff --git a/include/xen/events.h b/include/xen/events.h
index 8bee7a75e850..5321cd9636e6 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -28,6 +28,8 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
28 unsigned long irqflags, 28 unsigned long irqflags,
29 const char *devname, 29 const char *devname,
30 void *dev_id); 30 void *dev_id);
31int bind_interdomain_evtchn_to_irq(unsigned int remote_domain,
32 unsigned int remote_port);
31int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, 33int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain,
32 unsigned int remote_port, 34 unsigned int remote_port,
33 irq_handler_t handler, 35 irq_handler_t handler,
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index 5c1aba154b64..3387465b9caa 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -64,24 +64,6 @@ int gnttab_resume(void);
64 64
65int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, 65int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
66 int readonly); 66 int readonly);
67int gnttab_grant_foreign_access_subpage(domid_t domid, unsigned long frame,
68 int flags, unsigned page_off,
69 unsigned length);
70int gnttab_grant_foreign_access_trans(domid_t domid, int flags,
71 domid_t trans_domid,
72 grant_ref_t trans_gref);
73
74/*
75 * Are sub-page grants available on this version of Xen? Returns true if they
76 * are, and false if they're not.
77 */
78bool gnttab_subpage_grants_available(void);
79
80/*
81 * Are transitive grants available on this version of Xen? Returns true if they
82 * are, and false if they're not.
83 */
84bool gnttab_trans_grants_available(void);
85 67
86/* 68/*
87 * End access through the given grant reference, iff the grant entry is no 69 * End access through the given grant reference, iff the grant entry is no
@@ -128,13 +110,6 @@ void gnttab_cancel_free_callback(struct gnttab_free_callback *callback);
128 110
129void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid, 111void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
130 unsigned long frame, int readonly); 112 unsigned long frame, int readonly);
131int gnttab_grant_foreign_access_subpage_ref(grant_ref_t ref, domid_t domid,
132 unsigned long frame, int flags,
133 unsigned page_off,
134 unsigned length);
135int gnttab_grant_foreign_access_trans_ref(grant_ref_t ref, domid_t domid,
136 int flags, domid_t trans_domid,
137 grant_ref_t trans_gref);
138 113
139void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, 114void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
140 unsigned long pfn); 115 unsigned long pfn);
@@ -170,13 +145,10 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr,
170 unmap->dev_bus_addr = 0; 145 unmap->dev_bus_addr = 0;
171} 146}
172 147
173int arch_gnttab_init(unsigned long nr_shared, unsigned long nr_status); 148int arch_gnttab_init(unsigned long nr_shared);
174int arch_gnttab_map_shared(xen_pfn_t *frames, unsigned long nr_gframes, 149int arch_gnttab_map_shared(xen_pfn_t *frames, unsigned long nr_gframes,
175 unsigned long max_nr_gframes, 150 unsigned long max_nr_gframes,
176 void **__shared); 151 void **__shared);
177int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes,
178 unsigned long max_nr_gframes,
179 grant_status_t **__shared);
180void arch_gnttab_unmap(void *shared, unsigned long nr_gframes); 152void arch_gnttab_unmap(void *shared, unsigned long nr_gframes);
181 153
182struct grant_frames { 154struct grant_frames {
diff --git a/include/xen/interface/elfnote.h b/include/xen/interface/elfnote.h
index 6f4eae328ca7..f90b03454659 100644
--- a/include/xen/interface/elfnote.h
+++ b/include/xen/interface/elfnote.h
@@ -3,6 +3,24 @@
3 * 3 *
4 * Definitions used for the Xen ELF notes. 4 * Definitions used for the Xen ELF notes.
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
6 * Copyright (c) 2006, Ian Campbell, XenSource Ltd. 24 * Copyright (c) 2006, Ian Campbell, XenSource Ltd.
7 */ 25 */
8 26
@@ -18,12 +36,13 @@
18 * 36 *
19 * LEGACY indicated the fields in the legacy __xen_guest string which 37 * LEGACY indicated the fields in the legacy __xen_guest string which
20 * this a note type replaces. 38 * this a note type replaces.
39 *
40 * String values (for non-legacy) are NULL terminated ASCII, also known
41 * as ASCIZ type.
21 */ 42 */
22 43
23/* 44/*
24 * NAME=VALUE pair (string). 45 * NAME=VALUE pair (string).
25 *
26 * LEGACY: FEATURES and PAE
27 */ 46 */
28#define XEN_ELFNOTE_INFO 0 47#define XEN_ELFNOTE_INFO 0
29 48
@@ -137,10 +156,30 @@
137 156
138/* 157/*
139 * Whether or not the guest supports cooperative suspend cancellation. 158 * Whether or not the guest supports cooperative suspend cancellation.
159 * This is a numeric value.
160 *
161 * Default is 0
140 */ 162 */
141#define XEN_ELFNOTE_SUSPEND_CANCEL 14 163#define XEN_ELFNOTE_SUSPEND_CANCEL 14
142 164
143/* 165/*
166 * The (non-default) location the initial phys-to-machine map should be
167 * placed at by the hypervisor (Dom0) or the tools (DomU).
168 * The kernel must be prepared for this mapping to be established using
169 * large pages, despite such otherwise not being available to guests.
170 * The kernel must also be able to handle the page table pages used for
171 * this mapping not being accessible through the initial mapping.
172 * (Only x86-64 supports this at present.)
173 */
174#define XEN_ELFNOTE_INIT_P2M 15
175
176/*
177 * Whether or not the guest can deal with being passed an initrd not
178 * mapped through its initial page tables.
179 */
180#define XEN_ELFNOTE_MOD_START_PFN 16
181
182/*
144 * The features supported by this kernel (numeric). 183 * The features supported by this kernel (numeric).
145 * 184 *
146 * Other than XEN_ELFNOTE_FEATURES on pre-4.2 Xen, this note allows a 185 * Other than XEN_ELFNOTE_FEATURES on pre-4.2 Xen, this note allows a
@@ -153,6 +192,11 @@
153 */ 192 */
154#define XEN_ELFNOTE_SUPPORTED_FEATURES 17 193#define XEN_ELFNOTE_SUPPORTED_FEATURES 17
155 194
195/*
196 * The number of the highest elfnote defined.
197 */
198#define XEN_ELFNOTE_MAX XEN_ELFNOTE_SUPPORTED_FEATURES
199
156#endif /* __XEN_PUBLIC_ELFNOTE_H__ */ 200#endif /* __XEN_PUBLIC_ELFNOTE_H__ */
157 201
158/* 202/*
diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h
index 131a6ccdba25..14334d0161d5 100644
--- a/include/xen/interface/features.h
+++ b/include/xen/interface/features.h
@@ -53,6 +53,9 @@
53/* operation as Dom0 is supported */ 53/* operation as Dom0 is supported */
54#define XENFEAT_dom0 11 54#define XENFEAT_dom0 11
55 55
56/* Xen also maps grant references at pfn = mfn */
57#define XENFEAT_grant_map_identity 12
58
56#define XENFEAT_NR_SUBMAPS 1 59#define XENFEAT_NR_SUBMAPS 1
57 60
58#endif /* __XEN_PUBLIC_FEATURES_H__ */ 61#endif /* __XEN_PUBLIC_FEATURES_H__ */
diff --git a/include/xen/interface/io/vscsiif.h b/include/xen/interface/io/vscsiif.h
new file mode 100644
index 000000000000..d07d7aca8d1c
--- /dev/null
+++ b/include/xen/interface/io/vscsiif.h
@@ -0,0 +1,229 @@
1/******************************************************************************
2 * vscsiif.h
3 *
4 * Based on the blkif.h code.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Copyright(c) FUJITSU Limited 2008.
25 */
26
27#ifndef __XEN__PUBLIC_IO_SCSI_H__
28#define __XEN__PUBLIC_IO_SCSI_H__
29
30#include "ring.h"
31#include "../grant_table.h"
32
33/*
34 * Feature and Parameter Negotiation
35 * =================================
36 * The two halves of a Xen pvSCSI driver utilize nodes within the XenStore to
37 * communicate capabilities and to negotiate operating parameters. This
38 * section enumerates these nodes which reside in the respective front and
39 * backend portions of the XenStore, following the XenBus convention.
40 *
41 * Any specified default value is in effect if the corresponding XenBus node
42 * is not present in the XenStore.
43 *
44 * XenStore nodes in sections marked "PRIVATE" are solely for use by the
45 * driver side whose XenBus tree contains them.
46 *
47 *****************************************************************************
48 * Backend XenBus Nodes
49 *****************************************************************************
50 *
51 *------------------ Backend Device Identification (PRIVATE) ------------------
52 *
53 * p-devname
54 * Values: string
55 *
56 * A free string used to identify the physical device (e.g. a disk name).
57 *
58 * p-dev
59 * Values: string
60 *
61 * A string specifying the backend device: either a 4-tuple "h:c:t:l"
62 * (host, controller, target, lun, all integers), or a WWN (e.g.
63 * "naa.60014054ac780582").
64 *
65 * v-dev
66 * Values: string
67 *
68 * A string specifying the frontend device in form of a 4-tuple "h:c:t:l"
69 * (host, controller, target, lun, all integers).
70 *
71 *--------------------------------- Features ---------------------------------
72 *
73 * feature-sg-grant
74 * Values: unsigned [VSCSIIF_SG_TABLESIZE...65535]
75 * Default Value: 0
76 *
77 * Specifies the maximum number of scatter/gather elements in grant pages
78 * supported. If not set, the backend supports up to VSCSIIF_SG_TABLESIZE
79 * SG elements specified directly in the request.
80 *
81 *****************************************************************************
82 * Frontend XenBus Nodes
83 *****************************************************************************
84 *
85 *----------------------- Request Transport Parameters -----------------------
86 *
87 * event-channel
88 * Values: unsigned
89 *
90 * The identifier of the Xen event channel used to signal activity
91 * in the ring buffer.
92 *
93 * ring-ref
94 * Values: unsigned
95 *
96 * The Xen grant reference granting permission for the backend to map
97 * the sole page in a single page sized ring buffer.
98 *
99 * protocol
100 * Values: string (XEN_IO_PROTO_ABI_*)
101 * Default Value: XEN_IO_PROTO_ABI_NATIVE
102 *
103 * The machine ABI rules governing the format of all ring request and
104 * response structures.
105 */
106
107/* Requests from the frontend to the backend */
108
109/*
110 * Request a SCSI operation specified via a CDB in vscsiif_request.cmnd.
111 * The target is specified via channel, id and lun.
112 *
113 * The operation to be performed is specified via a CDB in cmnd[], the length
114 * of the CDB is in cmd_len. sc_data_direction specifies the direction of data
115 * (to the device, from the device, or none at all).
116 *
117 * If data is to be transferred to or from the device the buffer(s) in the
118 * guest memory is/are specified via one or multiple scsiif_request_segment
119 * descriptors each specifying a memory page via a grant_ref_t, a offset into
120 * the page and the length of the area in that page. All scsiif_request_segment
121 * areas concatenated form the resulting data buffer used by the operation.
122 * If the number of scsiif_request_segment areas is not too large (less than
123 * or equal VSCSIIF_SG_TABLESIZE) the areas can be specified directly in the
124 * seg[] array and the number of valid scsiif_request_segment elements is to be
125 * set in nr_segments.
126 *
127 * If "feature-sg-grant" in the Xenstore is set it is possible to specify more
128 * than VSCSIIF_SG_TABLESIZE scsiif_request_segment elements via indirection.
129 * The maximum number of allowed scsiif_request_segment elements is the value
130 * of the "feature-sg-grant" entry from Xenstore. When using indirection the
131 * seg[] array doesn't contain specifications of the data buffers, but
132 * references to scsiif_request_segment arrays, which in turn reference the
133 * data buffers. While nr_segments holds the number of populated seg[] entries
134 * (plus the set VSCSIIF_SG_GRANT bit), the number of scsiif_request_segment
135 * elements referencing the target data buffers is calculated from the lengths
136 * of the seg[] elements (the sum of all valid seg[].length divided by the
137 * size of one scsiif_request_segment structure).
138 */
139#define VSCSIIF_ACT_SCSI_CDB 1
140
141/*
142 * Request abort of a running operation for the specified target given by
143 * channel, id, lun and the operation's rqid in ref_rqid.
144 */
145#define VSCSIIF_ACT_SCSI_ABORT 2
146
147/*
148 * Request a device reset of the specified target (channel and id).
149 */
150#define VSCSIIF_ACT_SCSI_RESET 3
151
152/*
153 * Preset scatter/gather elements for a following request. Deprecated.
154 * Keeping the define only to avoid usage of the value "4" for other actions.
155 */
156#define VSCSIIF_ACT_SCSI_SG_PRESET 4
157
158/*
159 * Maximum scatter/gather segments per request.
160 *
161 * Considering balance between allocating at least 16 "vscsiif_request"
162 * structures on one page (4096 bytes) and the number of scatter/gather
163 * elements needed, we decided to use 26 as a magic number.
164 *
165 * If "feature-sg-grant" is set, more scatter/gather elements can be specified
166 * by placing them in one or more (up to VSCSIIF_SG_TABLESIZE) granted pages.
167 * In this case the vscsiif_request seg elements don't contain references to
168 * the user data, but to the SG elements referencing the user data.
169 */
170#define VSCSIIF_SG_TABLESIZE 26
171
172/*
173 * based on Linux kernel 2.6.18, still valid
174 * Changing these values requires support of multiple protocols via the rings
175 * as "old clients" will blindly use these values and the resulting structure
176 * sizes.
177 */
178#define VSCSIIF_MAX_COMMAND_SIZE 16
179#define VSCSIIF_SENSE_BUFFERSIZE 96
180
181struct scsiif_request_segment {
182 grant_ref_t gref;
183 uint16_t offset;
184 uint16_t length;
185};
186
187#define VSCSIIF_SG_PER_PAGE (PAGE_SIZE / sizeof(struct scsiif_request_segment))
188
189/* Size of one request is 252 bytes */
190struct vscsiif_request {
191 uint16_t rqid; /* private guest value, echoed in resp */
192 uint8_t act; /* command between backend and frontend */
193 uint8_t cmd_len; /* valid CDB bytes */
194
195 uint8_t cmnd[VSCSIIF_MAX_COMMAND_SIZE]; /* the CDB */
196 uint16_t timeout_per_command; /* deprecated */
197 uint16_t channel, id, lun; /* (virtual) device specification */
198 uint16_t ref_rqid; /* command abort reference */
199 uint8_t sc_data_direction; /* for DMA_TO_DEVICE(1)
200 DMA_FROM_DEVICE(2)
201 DMA_NONE(3) requests */
202 uint8_t nr_segments; /* Number of pieces of scatter-gather */
203/*
204 * flag in nr_segments: SG elements via grant page
205 *
206 * If VSCSIIF_SG_GRANT is set, the low 7 bits of nr_segments specify the number
207 * of grant pages containing SG elements. Usable if "feature-sg-grant" set.
208 */
209#define VSCSIIF_SG_GRANT 0x80
210
211 struct scsiif_request_segment seg[VSCSIIF_SG_TABLESIZE];
212 uint32_t reserved[3];
213};
214
215/* Size of one response is 252 bytes */
216struct vscsiif_response {
217 uint16_t rqid; /* identifies request */
218 uint8_t padding;
219 uint8_t sense_len;
220 uint8_t sense_buffer[VSCSIIF_SENSE_BUFFERSIZE];
221 int32_t rslt;
222 uint32_t residual_len; /* request bufflen -
223 return the value from physical device */
224 uint32_t reserved[36];
225};
226
227DEFINE_RING_TYPES(vscsiif, struct vscsiif_request, struct vscsiif_response);
228
229#endif /*__XEN__PUBLIC_IO_SCSI_H__*/
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index de082130ba4b..f68719f405af 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -3,6 +3,24 @@
3 * 3 *
4 * Guest OS interface to Xen. 4 * Guest OS interface to Xen.
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
6 * Copyright (c) 2004, K A Fraser 24 * Copyright (c) 2004, K A Fraser
7 */ 25 */
8 26
@@ -73,13 +91,23 @@
73 * VIRTUAL INTERRUPTS 91 * VIRTUAL INTERRUPTS
74 * 92 *
75 * Virtual interrupts that a guest OS may receive from Xen. 93 * Virtual interrupts that a guest OS may receive from Xen.
94 * In the side comments, 'V.' denotes a per-VCPU VIRQ while 'G.' denotes a
95 * global VIRQ. The former can be bound once per VCPU and cannot be re-bound.
96 * The latter can be allocated only once per guest: they must initially be
97 * allocated to VCPU0 but can subsequently be re-bound.
76 */ 98 */
77#define VIRQ_TIMER 0 /* Timebase update, and/or requested timeout. */ 99#define VIRQ_TIMER 0 /* V. Timebase update, and/or requested timeout. */
78#define VIRQ_DEBUG 1 /* Request guest to dump debug info. */ 100#define VIRQ_DEBUG 1 /* V. Request guest to dump debug info. */
79#define VIRQ_CONSOLE 2 /* (DOM0) Bytes received on emergency console. */ 101#define VIRQ_CONSOLE 2 /* G. (DOM0) Bytes received on emergency console. */
80#define VIRQ_DOM_EXC 3 /* (DOM0) Exceptional event for some domain. */ 102#define VIRQ_DOM_EXC 3 /* G. (DOM0) Exceptional event for some domain. */
81#define VIRQ_DEBUGGER 6 /* (DOM0) A domain has paused for debugging. */ 103#define VIRQ_TBUF 4 /* G. (DOM0) Trace buffer has records available. */
82#define VIRQ_PCPU_STATE 9 /* (DOM0) PCPU state changed */ 104#define VIRQ_DEBUGGER 6 /* G. (DOM0) A domain has paused for debugging. */
105#define VIRQ_XENOPROF 7 /* V. XenOprofile interrupt: new sample available */
106#define VIRQ_CON_RING 8 /* G. (DOM0) Bytes received on console */
107#define VIRQ_PCPU_STATE 9 /* G. (DOM0) PCPU state changed */
108#define VIRQ_MEM_EVENT 10 /* G. (DOM0) A memory event has occured */
109#define VIRQ_XC_RESERVED 11 /* G. Reserved for XenClient */
110#define VIRQ_ENOMEM 12 /* G. (DOM0) Low on heap memory */
83 111
84/* Architecture-specific VIRQ definitions. */ 112/* Architecture-specific VIRQ definitions. */
85#define VIRQ_ARCH_0 16 113#define VIRQ_ARCH_0 16
@@ -92,24 +120,68 @@
92#define VIRQ_ARCH_7 23 120#define VIRQ_ARCH_7 23
93 121
94#define NR_VIRQS 24 122#define NR_VIRQS 24
123
95/* 124/*
96 * MMU-UPDATE REQUESTS 125 * enum neg_errnoval HYPERVISOR_mmu_update(const struct mmu_update reqs[],
97 * 126 * unsigned count, unsigned *done_out,
98 * HYPERVISOR_mmu_update() accepts a list of (ptr, val) pairs. 127 * unsigned foreigndom)
99 * A foreigndom (FD) can be specified (or DOMID_SELF for none). 128 * @reqs is an array of mmu_update_t structures ((ptr, val) pairs).
100 * Where the FD has some effect, it is described below. 129 * @count is the length of the above array.
101 * ptr[1:0] specifies the appropriate MMU_* command. 130 * @pdone is an output parameter indicating number of completed operations
131 * @foreigndom[15:0]: FD, the expected owner of data pages referenced in this
132 * hypercall invocation. Can be DOMID_SELF.
133 * @foreigndom[31:16]: PFD, the expected owner of pagetable pages referenced
134 * in this hypercall invocation. The value of this field
135 * (x) encodes the PFD as follows:
136 * x == 0 => PFD == DOMID_SELF
137 * x != 0 => PFD == x - 1
102 * 138 *
139 * Sub-commands: ptr[1:0] specifies the appropriate MMU_* command.
140 * -------------
103 * ptr[1:0] == MMU_NORMAL_PT_UPDATE: 141 * ptr[1:0] == MMU_NORMAL_PT_UPDATE:
104 * Updates an entry in a page table. If updating an L1 table, and the new 142 * Updates an entry in a page table belonging to PFD. If updating an L1 table,
105 * table entry is valid/present, the mapped frame must belong to the FD, if 143 * and the new table entry is valid/present, the mapped frame must belong to
106 * an FD has been specified. If attempting to map an I/O page then the 144 * FD. If attempting to map an I/O page then the caller assumes the privilege
107 * caller assumes the privilege of the FD. 145 * of the FD.
108 * FD == DOMID_IO: Permit /only/ I/O mappings, at the priv level of the caller. 146 * FD == DOMID_IO: Permit /only/ I/O mappings, at the priv level of the caller.
109 * FD == DOMID_XEN: Map restricted areas of Xen's heap space. 147 * FD == DOMID_XEN: Map restricted areas of Xen's heap space.
110 * ptr[:2] -- Machine address of the page-table entry to modify. 148 * ptr[:2] -- Machine address of the page-table entry to modify.
111 * val -- Value to write. 149 * val -- Value to write.
112 * 150 *
151 * There also certain implicit requirements when using this hypercall. The
152 * pages that make up a pagetable must be mapped read-only in the guest.
153 * This prevents uncontrolled guest updates to the pagetable. Xen strictly
154 * enforces this, and will disallow any pagetable update which will end up
155 * mapping pagetable page RW, and will disallow using any writable page as a
156 * pagetable. In practice it means that when constructing a page table for a
157 * process, thread, etc, we MUST be very dilligient in following these rules:
158 * 1). Start with top-level page (PGD or in Xen language: L4). Fill out
159 * the entries.
160 * 2). Keep on going, filling out the upper (PUD or L3), and middle (PMD
161 * or L2).
162 * 3). Start filling out the PTE table (L1) with the PTE entries. Once
163 * done, make sure to set each of those entries to RO (so writeable bit
164 * is unset). Once that has been completed, set the PMD (L2) for this
165 * PTE table as RO.
166 * 4). When completed with all of the PMD (L2) entries, and all of them have
167 * been set to RO, make sure to set RO the PUD (L3). Do the same
168 * operation on PGD (L4) pagetable entries that have a PUD (L3) entry.
169 * 5). Now before you can use those pages (so setting the cr3), you MUST also
170 * pin them so that the hypervisor can verify the entries. This is done
171 * via the HYPERVISOR_mmuext_op(MMUEXT_PIN_L4_TABLE, guest physical frame
172 * number of the PGD (L4)). And this point the HYPERVISOR_mmuext_op(
173 * MMUEXT_NEW_BASEPTR, guest physical frame number of the PGD (L4)) can be
174 * issued.
175 * For 32-bit guests, the L4 is not used (as there is less pagetables), so
176 * instead use L3.
177 * At this point the pagetables can be modified using the MMU_NORMAL_PT_UPDATE
178 * hypercall. Also if so desired the OS can also try to write to the PTE
179 * and be trapped by the hypervisor (as the PTE entry is RO).
180 *
181 * To deallocate the pages, the operations are the reverse of the steps
182 * mentioned above. The argument is MMUEXT_UNPIN_TABLE for all levels and the
183 * pagetable MUST not be in use (meaning that the cr3 is not set to it).
184 *
113 * ptr[1:0] == MMU_MACHPHYS_UPDATE: 185 * ptr[1:0] == MMU_MACHPHYS_UPDATE:
114 * Updates an entry in the machine->pseudo-physical mapping table. 186 * Updates an entry in the machine->pseudo-physical mapping table.
115 * ptr[:2] -- Machine address within the frame whose mapping to modify. 187 * ptr[:2] -- Machine address within the frame whose mapping to modify.
@@ -119,6 +191,72 @@
119 * ptr[1:0] == MMU_PT_UPDATE_PRESERVE_AD: 191 * ptr[1:0] == MMU_PT_UPDATE_PRESERVE_AD:
120 * As MMU_NORMAL_PT_UPDATE above, but A/D bits currently in the PTE are ORed 192 * As MMU_NORMAL_PT_UPDATE above, but A/D bits currently in the PTE are ORed
121 * with those in @val. 193 * with those in @val.
194 *
195 * @val is usually the machine frame number along with some attributes.
196 * The attributes by default follow the architecture defined bits. Meaning that
197 * if this is a X86_64 machine and four page table layout is used, the layout
198 * of val is:
199 * - 63 if set means No execute (NX)
200 * - 46-13 the machine frame number
201 * - 12 available for guest
202 * - 11 available for guest
203 * - 10 available for guest
204 * - 9 available for guest
205 * - 8 global
206 * - 7 PAT (PSE is disabled, must use hypercall to make 4MB or 2MB pages)
207 * - 6 dirty
208 * - 5 accessed
209 * - 4 page cached disabled
210 * - 3 page write through
211 * - 2 userspace accessible
212 * - 1 writeable
213 * - 0 present
214 *
215 * The one bits that does not fit with the default layout is the PAGE_PSE
216 * also called PAGE_PAT). The MMUEXT_[UN]MARK_SUPER arguments to the
217 * HYPERVISOR_mmuext_op serve as mechanism to set a pagetable to be 4MB
218 * (or 2MB) instead of using the PAGE_PSE bit.
219 *
220 * The reason that the PAGE_PSE (bit 7) is not being utilized is due to Xen
221 * using it as the Page Attribute Table (PAT) bit - for details on it please
222 * refer to Intel SDM 10.12. The PAT allows to set the caching attributes of
223 * pages instead of using MTRRs.
224 *
225 * The PAT MSR is as follows (it is a 64-bit value, each entry is 8 bits):
226 * PAT4 PAT0
227 * +-----+-----+----+----+----+-----+----+----+
228 * | UC | UC- | WC | WB | UC | UC- | WC | WB | <= Linux
229 * +-----+-----+----+----+----+-----+----+----+
230 * | UC | UC- | WT | WB | UC | UC- | WT | WB | <= BIOS (default when machine boots)
231 * +-----+-----+----+----+----+-----+----+----+
232 * | rsv | rsv | WP | WC | UC | UC- | WT | WB | <= Xen
233 * +-----+-----+----+----+----+-----+----+----+
234 *
235 * The lookup of this index table translates to looking up
236 * Bit 7, Bit 4, and Bit 3 of val entry:
237 *
238 * PAT/PSE (bit 7) ... PCD (bit 4) .. PWT (bit 3).
239 *
240 * If all bits are off, then we are using PAT0. If bit 3 turned on,
241 * then we are using PAT1, if bit 3 and bit 4, then PAT2..
242 *
243 * As you can see, the Linux PAT1 translates to PAT4 under Xen. Which means
244 * that if a guest that follows Linux's PAT setup and would like to set Write
245 * Combined on pages it MUST use PAT4 entry. Meaning that Bit 7 (PAGE_PAT) is
246 * set. For example, under Linux it only uses PAT0, PAT1, and PAT2 for the
247 * caching as:
248 *
249 * WB = none (so PAT0)
250 * WC = PWT (bit 3 on)
251 * UC = PWT | PCD (bit 3 and 4 are on).
252 *
253 * To make it work with Xen, it needs to translate the WC bit as so:
254 *
255 * PWT (so bit 3 on) --> PAT (so bit 7 is on) and clear bit 3
256 *
257 * And to translate back it would:
258 *
259 * PAT (bit 7 on) --> PWT (bit 3 on) and clear bit 7.
122 */ 260 */
123#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */ 261#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */
124#define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */ 262#define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */
@@ -127,7 +265,12 @@
127/* 265/*
128 * MMU EXTENDED OPERATIONS 266 * MMU EXTENDED OPERATIONS
129 * 267 *
130 * HYPERVISOR_mmuext_op() accepts a list of mmuext_op structures. 268 * enum neg_errnoval HYPERVISOR_mmuext_op(mmuext_op_t uops[],
269 * unsigned int count,
270 * unsigned int *pdone,
271 * unsigned int foreigndom)
272 */
273/* HYPERVISOR_mmuext_op() accepts a list of mmuext_op structures.
131 * A foreigndom (FD) can be specified (or DOMID_SELF for none). 274 * A foreigndom (FD) can be specified (or DOMID_SELF for none).
132 * Where the FD has some effect, it is described below. 275 * Where the FD has some effect, it is described below.
133 * 276 *
@@ -164,9 +307,23 @@
164 * cmd: MMUEXT_FLUSH_CACHE 307 * cmd: MMUEXT_FLUSH_CACHE
165 * No additional arguments. Writes back and flushes cache contents. 308 * No additional arguments. Writes back and flushes cache contents.
166 * 309 *
310 * cmd: MMUEXT_FLUSH_CACHE_GLOBAL
311 * No additional arguments. Writes back and flushes cache contents
312 * on all CPUs in the system.
313 *
167 * cmd: MMUEXT_SET_LDT 314 * cmd: MMUEXT_SET_LDT
168 * linear_addr: Linear address of LDT base (NB. must be page-aligned). 315 * linear_addr: Linear address of LDT base (NB. must be page-aligned).
169 * nr_ents: Number of entries in LDT. 316 * nr_ents: Number of entries in LDT.
317 *
318 * cmd: MMUEXT_CLEAR_PAGE
319 * mfn: Machine frame number to be cleared.
320 *
321 * cmd: MMUEXT_COPY_PAGE
322 * mfn: Machine frame number of the destination page.
323 * src_mfn: Machine frame number of the source page.
324 *
325 * cmd: MMUEXT_[UN]MARK_SUPER
326 * mfn: Machine frame number of head of superpage to be [un]marked.
170 */ 327 */
171#define MMUEXT_PIN_L1_TABLE 0 328#define MMUEXT_PIN_L1_TABLE 0
172#define MMUEXT_PIN_L2_TABLE 1 329#define MMUEXT_PIN_L2_TABLE 1
@@ -183,12 +340,18 @@
183#define MMUEXT_FLUSH_CACHE 12 340#define MMUEXT_FLUSH_CACHE 12
184#define MMUEXT_SET_LDT 13 341#define MMUEXT_SET_LDT 13
185#define MMUEXT_NEW_USER_BASEPTR 15 342#define MMUEXT_NEW_USER_BASEPTR 15
343#define MMUEXT_CLEAR_PAGE 16
344#define MMUEXT_COPY_PAGE 17
345#define MMUEXT_FLUSH_CACHE_GLOBAL 18
346#define MMUEXT_MARK_SUPER 19
347#define MMUEXT_UNMARK_SUPER 20
186 348
187#ifndef __ASSEMBLY__ 349#ifndef __ASSEMBLY__
188struct mmuext_op { 350struct mmuext_op {
189 unsigned int cmd; 351 unsigned int cmd;
190 union { 352 union {
191 /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR */ 353 /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR
354 * CLEAR_PAGE, COPY_PAGE, [UN]MARK_SUPER */
192 xen_pfn_t mfn; 355 xen_pfn_t mfn;
193 /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */ 356 /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */
194 unsigned long linear_addr; 357 unsigned long linear_addr;
@@ -198,6 +361,8 @@ struct mmuext_op {
198 unsigned int nr_ents; 361 unsigned int nr_ents;
199 /* TLB_FLUSH_MULTI, INVLPG_MULTI */ 362 /* TLB_FLUSH_MULTI, INVLPG_MULTI */
200 void *vcpumask; 363 void *vcpumask;
364 /* COPY_PAGE */
365 xen_pfn_t src_mfn;
201 } arg2; 366 } arg2;
202}; 367};
203DEFINE_GUEST_HANDLE_STRUCT(mmuext_op); 368DEFINE_GUEST_HANDLE_STRUCT(mmuext_op);
@@ -225,10 +390,23 @@ DEFINE_GUEST_HANDLE_STRUCT(mmuext_op);
225 */ 390 */
226#define VMASST_CMD_enable 0 391#define VMASST_CMD_enable 0
227#define VMASST_CMD_disable 1 392#define VMASST_CMD_disable 1
393
394/* x86/32 guests: simulate full 4GB segment limits. */
228#define VMASST_TYPE_4gb_segments 0 395#define VMASST_TYPE_4gb_segments 0
396
397/* x86/32 guests: trap (vector 15) whenever above vmassist is used. */
229#define VMASST_TYPE_4gb_segments_notify 1 398#define VMASST_TYPE_4gb_segments_notify 1
399
400/*
401 * x86 guests: support writes to bottom-level PTEs.
402 * NB1. Page-directory entries cannot be written.
403 * NB2. Guest must continue to remove all writable mappings of PTEs.
404 */
230#define VMASST_TYPE_writable_pagetables 2 405#define VMASST_TYPE_writable_pagetables 2
406
407/* x86/PAE guests: support PDPTs above 4GB. */
231#define VMASST_TYPE_pae_extended_cr3 3 408#define VMASST_TYPE_pae_extended_cr3 3
409
232#define MAX_VMASST_TYPE 3 410#define MAX_VMASST_TYPE 3
233 411
234#ifndef __ASSEMBLY__ 412#ifndef __ASSEMBLY__
@@ -260,6 +438,15 @@ typedef uint16_t domid_t;
260 */ 438 */
261#define DOMID_XEN (0x7FF2U) 439#define DOMID_XEN (0x7FF2U)
262 440
441/* DOMID_COW is used as the owner of sharable pages */
442#define DOMID_COW (0x7FF3U)
443
444/* DOMID_INVALID is used to identify pages with unknown owner. */
445#define DOMID_INVALID (0x7FF4U)
446
447/* Idle domain. */
448#define DOMID_IDLE (0x7FFFU)
449
263/* 450/*
264 * Send an array of these to HYPERVISOR_mmu_update(). 451 * Send an array of these to HYPERVISOR_mmu_update().
265 * NB. The fields are natural pointer/address size for this architecture. 452 * NB. The fields are natural pointer/address size for this architecture.
@@ -272,7 +459,9 @@ DEFINE_GUEST_HANDLE_STRUCT(mmu_update);
272 459
273/* 460/*
274 * Send an array of these to HYPERVISOR_multicall(). 461 * Send an array of these to HYPERVISOR_multicall().
275 * NB. The fields are natural register size for this architecture. 462 * NB. The fields are logically the natural register size for this
463 * architecture. In cases where xen_ulong_t is larger than this then
464 * any unused bits in the upper portion must be zero.
276 */ 465 */
277struct multicall_entry { 466struct multicall_entry {
278 xen_ulong_t op; 467 xen_ulong_t op;
@@ -442,8 +631,48 @@ struct start_info {
442 unsigned long mod_start; /* VIRTUAL address of pre-loaded module. */ 631 unsigned long mod_start; /* VIRTUAL address of pre-loaded module. */
443 unsigned long mod_len; /* Size (bytes) of pre-loaded module. */ 632 unsigned long mod_len; /* Size (bytes) of pre-loaded module. */
444 int8_t cmd_line[MAX_GUEST_CMDLINE]; 633 int8_t cmd_line[MAX_GUEST_CMDLINE];
634 /* The pfn range here covers both page table and p->m table frames. */
635 unsigned long first_p2m_pfn;/* 1st pfn forming initial P->M table. */
636 unsigned long nr_p2m_frames;/* # of pfns forming initial P->M table. */
445}; 637};
446 638
639/* These flags are passed in the 'flags' field of start_info_t. */
640#define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */
641#define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */
642#define SIF_MULTIBOOT_MOD (1<<2) /* Is mod_start a multiboot module? */
643#define SIF_MOD_START_PFN (1<<3) /* Is mod_start a PFN? */
644#define SIF_PM_MASK (0xFF<<8) /* reserve 1 byte for xen-pm options */
645
646/*
647 * A multiboot module is a package containing modules very similar to a
648 * multiboot module array. The only differences are:
649 * - the array of module descriptors is by convention simply at the beginning
650 * of the multiboot module,
651 * - addresses in the module descriptors are based on the beginning of the
652 * multiboot module,
653 * - the number of modules is determined by a termination descriptor that has
654 * mod_start == 0.
655 *
656 * This permits to both build it statically and reference it in a configuration
657 * file, and let the PV guest easily rebase the addresses to virtual addresses
658 * and at the same time count the number of modules.
659 */
660struct xen_multiboot_mod_list {
661 /* Address of first byte of the module */
662 uint32_t mod_start;
663 /* Address of last byte of the module (inclusive) */
664 uint32_t mod_end;
665 /* Address of zero-terminated command line */
666 uint32_t cmdline;
667 /* Unused, must be zero */
668 uint32_t pad;
669};
670/*
671 * The console structure in start_info.console.dom0
672 *
673 * This structure includes a variety of information required to
674 * have a working VGA/VESA console.
675 */
447struct dom0_vga_console_info { 676struct dom0_vga_console_info {
448 uint8_t video_type; 677 uint8_t video_type;
449#define XEN_VGATYPE_TEXT_MODE_3 0x03 678#define XEN_VGATYPE_TEXT_MODE_3 0x03
@@ -484,11 +713,6 @@ struct dom0_vga_console_info {
484 } u; 713 } u;
485}; 714};
486 715
487/* These flags are passed in the 'flags' field of start_info_t. */
488#define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */
489#define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */
490#define SIF_PM_MASK (0xFF<<8) /* reserve 1 byte for xen-pm options */
491
492typedef uint64_t cpumap_t; 716typedef uint64_t cpumap_t;
493 717
494typedef uint8_t xen_domain_handle_t[16]; 718typedef uint8_t xen_domain_handle_t[16];
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index 0324c6d340c1..b78f21caf55a 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -86,6 +86,7 @@ struct xenbus_device_id
86 86
87/* A xenbus driver. */ 87/* A xenbus driver. */
88struct xenbus_driver { 88struct xenbus_driver {
89 const char *name; /* defaults to ids[0].devicetype */
89 const struct xenbus_device_id *ids; 90 const struct xenbus_device_id *ids;
90 int (*probe)(struct xenbus_device *dev, 91 int (*probe)(struct xenbus_device *dev,
91 const struct xenbus_device_id *id); 92 const struct xenbus_device_id *id);
@@ -100,20 +101,22 @@ struct xenbus_driver {
100 int (*is_ready)(struct xenbus_device *dev); 101 int (*is_ready)(struct xenbus_device *dev);
101}; 102};
102 103
103#define DEFINE_XENBUS_DRIVER(var, drvname, methods...) \
104struct xenbus_driver var ## _driver = { \
105 .driver.name = drvname + 0 ?: var ## _ids->devicetype, \
106 .driver.owner = THIS_MODULE, \
107 .ids = var ## _ids, ## methods \
108}
109
110static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv) 104static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv)
111{ 105{
112 return container_of(drv, struct xenbus_driver, driver); 106 return container_of(drv, struct xenbus_driver, driver);
113} 107}
114 108
115int __must_check xenbus_register_frontend(struct xenbus_driver *); 109int __must_check __xenbus_register_frontend(struct xenbus_driver *drv,
116int __must_check xenbus_register_backend(struct xenbus_driver *); 110 struct module *owner,
111 const char *mod_name);
112int __must_check __xenbus_register_backend(struct xenbus_driver *drv,
113 struct module *owner,
114 const char *mod_name);
115
116#define xenbus_register_frontend(drv) \
117 __xenbus_register_frontend(drv, THIS_MODULE, KBUILD_MODNAME);
118#define xenbus_register_backend(drv) \
119 __xenbus_register_backend(drv, THIS_MODULE, KBUILD_MODNAME);
117 120
118void xenbus_unregister_driver(struct xenbus_driver *drv); 121void xenbus_unregister_driver(struct xenbus_driver *drv);
119 122