aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-08-15 14:11:45 -0400
committerSage Weil <sage@inktank.com>2013-08-15 14:11:45 -0400
commitee3e542fec6e69bc9fb668698889a37d93950ddf (patch)
treee74ee766a4764769ef1d3d45d266b4dea64101d3 /include
parentfe2a801b50c0bb8039d627e5ae1fec249d10ff39 (diff)
parentf1d6e17f540af37bb1891480143669ba7636c4cf (diff)
Merge remote-tracking branch 'linus/master' into testing
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h4
-rw-r--r--include/acpi/acoutput.h8
-rw-r--r--include/acpi/acpi_bus.h44
-rw-r--r--include/acpi/acpixf.h4
-rw-r--r--include/acpi/actypes.h15
-rw-r--r--include/acpi/processor.h5
-rw-r--r--include/asm-generic/mutex-dec.h10
-rw-r--r--include/asm-generic/mutex-null.h2
-rw-r--r--include/asm-generic/mutex-xchg.h10
-rw-r--r--include/asm-generic/pgtable.h61
-rw-r--r--include/asm-generic/sections.h21
-rw-r--r--include/asm-generic/uaccess.h10
-rw-r--r--include/asm-generic/vmlinux.lds.h39
-rw-r--r--include/clocksource/arm_arch_timer.h2
-rw-r--r--include/drm/drmP.h40
-rw-r--r--include/drm/drm_crtc.h37
-rw-r--r--include/drm/drm_fixed.h94
-rw-r--r--include/drm/drm_gem_cma_helper.h12
-rw-r--r--include/drm/drm_mm.h38
-rw-r--r--include/drm/drm_os_linux.h16
-rw-r--r--include/drm/drm_pciids.h24
-rw-r--r--include/drm/drm_rect.h167
-rw-r--r--include/drm/i915_powerwell.h36
-rw-r--r--include/drm/ttm/ttm_bo_api.h37
-rw-r--r--include/drm/ttm/ttm_bo_driver.h169
-rw-r--r--include/drm/ttm/ttm_execbuf_util.h12
-rw-r--r--include/dt-bindings/clk/exynos-audss-clk.h25
-rw-r--r--include/dt-bindings/clock/imx6sl-clock.h148
-rw-r--r--include/dt-bindings/clock/tegra114-car.h342
-rw-r--r--include/dt-bindings/clock/tegra20-car.h158
-rw-r--r--include/dt-bindings/clock/tegra30-car.h265
-rw-r--r--include/dt-bindings/clock/vf610-clock.h165
-rw-r--r--include/dt-bindings/dma/at91.h27
-rw-r--r--include/dt-bindings/gpio/tegra-gpio.h50
-rw-r--r--include/dt-bindings/pinctrl/am33xx.h42
-rw-r--r--include/dt-bindings/pinctrl/at91.h35
-rw-r--r--include/dt-bindings/pinctrl/omap.h55
-rw-r--r--include/dt-bindings/pinctrl/rockchip.h (renamed from include/linux/clk/mvebu.h)24
-rw-r--r--include/kvm/arm_arch_timer.h89
-rw-r--r--include/kvm/arm_vgic.h220
-rw-r--r--include/linux/acpi.h3
-rw-r--r--include/linux/aer.h22
-rw-r--r--include/linux/alarmtimer.h4
-rw-r--r--include/linux/amba/pl08x.h8
-rw-r--r--include/linux/arm-cci.h61
-rw-r--r--include/linux/async_tx.h4
-rw-r--r--include/linux/audit.h26
-rw-r--r--include/linux/backlight.h6
-rw-r--r--include/linux/bcma/bcma.h1
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h55
-rw-r--r--include/linux/bio.h4
-rw-r--r--include/linux/bootmem.h2
-rw-r--r--include/linux/buffer_head.h6
-rw-r--r--include/linux/can/platform/flexcan.h20
-rw-r--r--include/linux/cgroup.h228
-rw-r--r--include/linux/cgroup_subsys.h45
-rw-r--r--include/linux/clk-provider.h62
-rw-r--r--include/linux/clk/tegra.h6
-rw-r--r--include/linux/clk/zynq.h8
-rw-r--r--include/linux/clockchips.h5
-rw-r--r--include/linux/clocksource.h8
-rw-r--r--include/linux/completion.h2
-rw-r--r--include/linux/console.h3
-rw-r--r--include/linux/cpu.h5
-rw-r--r--include/linux/cpu_cooling.h4
-rw-r--r--include/linux/cpufreq.h54
-rw-r--r--include/linux/cpuidle.h6
-rw-r--r--include/linux/dcache.h16
-rw-r--r--include/linux/debug_locks.h4
-rw-r--r--include/linux/debugfs.h2
-rw-r--r--include/linux/decompress/unlz4.h10
-rw-r--r--include/linux/devfreq.h2
-rw-r--r--include/linux/device-mapper.h6
-rw-r--r--include/linux/device.h62
-rw-r--r--include/linux/dmaengine.h5
-rw-r--r--include/linux/drbd.h6
-rw-r--r--include/linux/drbd_genl.h2
-rw-r--r--include/linux/drbd_limits.h9
-rw-r--r--include/linux/dw_apb_timer.h2
-rw-r--r--include/linux/edac.h7
-rw-r--r--include/linux/efi.h32
-rw-r--r--include/linux/elevator.h6
-rw-r--r--include/linux/err.h10
-rw-r--r--include/linux/f2fs_fs.h4
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/filter.h4
-rw-r--r--include/linux/firewire.h3
-rw-r--r--include/linux/firmware.h11
-rw-r--r--include/linux/fmc-sdb.h36
-rw-r--r--include/linux/fmc.h237
-rw-r--r--include/linux/freezer.h171
-rw-r--r--include/linux/fs.h106
-rw-r--r--include/linux/fscache-cache.h175
-rw-r--r--include/linux/fsnotify.h8
-rw-r--r--include/linux/ftrace.h9
-rw-r--r--include/linux/ftrace_event.h12
-rw-r--r--include/linux/gfp.h2
-rw-r--r--include/linux/hardirq.h2
-rw-r--r--include/linux/huge_mm.h8
-rw-r--r--include/linux/hugetlb.h22
-rw-r--r--include/linux/hyperv.h70
-rw-r--r--include/linux/i2c/twl.h31
-rw-r--r--include/linux/ieee80211.h10
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_macvlan.h12
-rw-r--r--include/linux/if_team.h11
-rw-r--r--include/linux/if_vlan.h5
-rw-r--r--include/linux/igmp.h1
-rw-r--r--include/linux/iio/common/st_sensors.h24
-rw-r--r--include/linux/iio/frequency/adf4350.h4
-rw-r--r--include/linux/iio/iio.h4
-rw-r--r--include/linux/iio/trigger.h3
-rw-r--r--include/linux/inetdevice.h5
-rw-r--r--include/linux/init.h19
-rw-r--r--include/linux/input/ti_am335x_tsc.h23
-rw-r--r--include/linux/input/tps6507x-ts.h1
-rw-r--r--include/linux/io.h25
-rw-r--r--include/linux/ipmi-fru.h135
-rw-r--r--include/linux/irq.h53
-rw-r--r--include/linux/irqchip.h4
-rw-r--r--include/linux/irqdomain.h140
-rw-r--r--include/linux/jbd.h28
-rw-r--r--include/linux/jbd2.h175
-rw-r--r--include/linux/jbd_common.h26
-rw-r--r--include/linux/jiffies.h4
-rw-r--r--include/linux/kernel.h16
-rw-r--r--include/linux/ktime.h23
-rw-r--r--include/linux/kvm_host.h4
-rw-r--r--include/linux/lcd.h5
-rw-r--r--include/linux/libata.h5
-rw-r--r--include/linux/list.h11
-rw-r--r--include/linux/llist.h19
-rw-r--r--include/linux/loop.h85
-rw-r--r--include/linux/lz4.h87
-rw-r--r--include/linux/marvell_phy.h2
-rw-r--r--include/linux/memcontrol.h9
-rw-r--r--include/linux/memory_hotplug.h14
-rw-r--r--include/linux/mfd/88pm80x.h17
-rw-r--r--include/linux/mfd/abx500/ab8500-sysctrl.h4
-rw-r--r--include/linux/mfd/abx500/ab8500.h2
-rw-r--r--include/linux/mfd/arizona/core.h4
-rw-r--r--include/linux/mfd/arizona/pdata.h2
-rw-r--r--include/linux/mfd/arizona/registers.h47
-rw-r--r--include/linux/mfd/davinci_voicecodec.h5
-rw-r--r--include/linux/mfd/dbx500-prcmu.h12
-rw-r--r--include/linux/mfd/kempld.h125
-rw-r--r--include/linux/mfd/max77693-private.h13
-rw-r--r--include/linux/mfd/max77693.h18
-rw-r--r--include/linux/mfd/max8998-private.h7
-rw-r--r--include/linux/mfd/max8998.h20
-rw-r--r--include/linux/mfd/mc13xxx.h100
-rw-r--r--include/linux/mfd/palmas.h40
-rw-r--r--include/linux/mfd/rtsx_pci.h1
-rw-r--r--include/linux/mfd/samsung/core.h6
-rw-r--r--include/linux/mfd/samsung/s2mps11.h1
-rw-r--r--include/linux/mfd/syscon/clps711x.h94
-rw-r--r--include/linux/mfd/syscon/imx6q-iomuxc-gpr.h137
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h51
-rw-r--r--include/linux/mfd/tmio.h5
-rw-r--r--include/linux/mfd/tps6507x.h1
-rw-r--r--include/linux/mfd/twl6040.h7
-rw-r--r--include/linux/mfd/wm8994/core.h2
-rw-r--r--include/linux/mfd/wm8994/pdata.h10
-rw-r--r--include/linux/mfd/wm8994/registers.h8
-rw-r--r--include/linux/mlx4/cmd.h3
-rw-r--r--include/linux/mlx4/device.h3
-rw-r--r--include/linux/mlx4/qp.h36
-rw-r--r--include/linux/mlx5/cmd.h51
-rw-r--r--include/linux/mlx5/cq.h165
-rw-r--r--include/linux/mlx5/device.h913
-rw-r--r--include/linux/mlx5/doorbell.h79
-rw-r--r--include/linux/mlx5/driver.h771
-rw-r--r--include/linux/mlx5/qp.h467
-rw-r--r--include/linux/mlx5/srq.h41
-rw-r--r--include/linux/mm.h52
-rw-r--r--include/linux/mm_types.h3
-rw-r--r--include/linux/mman.h8
-rw-r--r--include/linux/mmc/card.h11
-rw-r--r--include/linux/mmc/core.h5
-rw-r--r--include/linux/mmc/host.h12
-rw-r--r--include/linux/mmc/sdhci.h6
-rw-r--r--include/linux/mmzone.h68
-rw-r--r--include/linux/mod_devicetable.h30
-rw-r--r--include/linux/moduleparam.h2
-rw-r--r--include/linux/msi.h1
-rw-r--r--include/linux/mutex-debug.h1
-rw-r--r--include/linux/mutex.h5
-rw-r--r--include/linux/mv643xx_eth.h2
-rw-r--r--include/linux/nbd.h1
-rw-r--r--include/linux/net.h6
-rw-r--r--include/linux/netdev_features.h4
-rw-r--r--include/linux/netdevice.h85
-rw-r--r--include/linux/netfilter.h2
-rw-r--r--include/linux/netlink.h27
-rw-r--r--include/linux/netpoll.h4
-rw-r--r--include/linux/nfs4.h22
-rw-r--r--include/linux/nfs_fs.h28
-rw-r--r--include/linux/nfs_fs_sb.h8
-rw-r--r--include/linux/nfs_xdr.h20
-rw-r--r--include/linux/nmi.h2
-rw-r--r--include/linux/of_address.h48
-rw-r--r--include/linux/of_device.h6
-rw-r--r--include/linux/of_dma.h1
-rw-r--r--include/linux/of_pci.h2
-rw-r--r--include/linux/of_platform.h35
-rw-r--r--include/linux/omap-mailbox.h29
-rw-r--r--include/linux/pageblock-flags.h6
-rw-r--r--include/linux/pagevec.h34
-rw-r--r--include/linux/pci.h6
-rw-r--r--include/linux/pci_ids.h7
-rw-r--r--include/linux/percpu-refcount.h174
-rw-r--r--include/linux/perf_event.h32
-rw-r--r--include/linux/phy.h27
-rw-r--r--include/linux/pid.h6
-rw-r--r--include/linux/pinctrl/consumer.h77
-rw-r--r--include/linux/pinctrl/devinfo.h4
-rw-r--r--include/linux/pinctrl/pinconf-generic.h25
-rw-r--r--include/linux/pinctrl/pinconf.h2
-rw-r--r--include/linux/pinctrl/pinctrl.h4
-rw-r--r--include/linux/platform_data/ad7303.h21
-rw-r--r--include/linux/platform_data/brcmfmac-sdio.h5
-rw-r--r--include/linux/platform_data/clk-ux500.h6
-rw-r--r--include/linux/platform_data/cyttsp4.h76
-rw-r--r--include/linux/platform_data/dma-atmel.h4
-rw-r--r--include/linux/platform_data/dma-imx.h6
-rw-r--r--include/linux/platform_data/dma-ste-dma40.h41
-rw-r--r--include/linux/platform_data/edma.h183
-rw-r--r--include/linux/platform_data/g762.h37
-rw-r--r--include/linux/platform_data/gpio-rcar.h5
-rw-r--r--include/linux/platform_data/keypad-pxa27x.h3
-rw-r--r--include/linux/platform_data/mailbox-omap.h58
-rw-r--r--include/linux/platform_data/mmc-esdhc-imx.h1
-rw-r--r--include/linux/platform_data/mmc-pxamci.h2
-rw-r--r--include/linux/platform_data/net-cw1200.h81
-rw-r--r--include/linux/platform_data/omap_ocp2scp.h31
-rw-r--r--include/linux/platform_data/pinctrl-coh901.h22
-rw-r--r--include/linux/platform_data/pwm-renesas-tpu.h16
-rw-r--r--include/linux/platform_data/rcar-du.h54
-rw-r--r--include/linux/platform_data/remoteproc-omap.h2
-rw-r--r--include/linux/platform_data/si5351.h18
-rw-r--r--include/linux/platform_data/spi-davinci.h2
-rw-r--r--include/linux/platform_data/ssm2518.h22
-rw-r--r--include/linux/platform_data/ti_am335x_adc.h14
-rw-r--r--include/linux/platform_data/usb-musb-ux500.h5
-rw-r--r--include/linux/platform_data/usb-rcar-phy.h28
-rw-r--r--include/linux/platform_data/usb3503.h5
-rw-r--r--include/linux/platform_device.h11
-rw-r--r--include/linux/pm_runtime.h2
-rw-r--r--include/linux/pm_wakeup.h4
-rw-r--r--include/linux/posix-timers.h16
-rw-r--r--include/linux/power/smartreflex.h10
-rw-r--r--include/linux/power_supply.h4
-rw-r--r--include/linux/pstore.h12
-rw-r--r--include/linux/ptrace.h10
-rw-r--r--include/linux/pvclock_gtod.h7
-rw-r--r--include/linux/pwm.h29
-rw-r--r--include/linux/rcupdate.h5
-rw-r--r--include/linux/rcutiny.h41
-rw-r--r--include/linux/rcutree.h3
-rw-r--r--include/linux/reboot.h27
-rw-r--r--include/linux/regmap.h44
-rw-r--r--include/linux/regulator/ab8500.h4
-rw-r--r--include/linux/regulator/consumer.h1
-rw-r--r--include/linux/reservation.h62
-rw-r--r--include/linux/rio.h82
-rw-r--r--include/linux/rio_ids.h2
-rw-r--r--include/linux/scatterlist.h5
-rw-r--r--include/linux/sched.h33
-rw-r--r--include/linux/sched_clock.h21
-rw-r--r--include/linux/sdb.h159
-rw-r--r--include/linux/security.h60
-rw-r--r--include/linux/sem.h6
-rw-r--r--include/linux/seq_file.h6
-rw-r--r--include/linux/serial_core.h7
-rw-r--r--include/linux/serial_sci.h12
-rw-r--r--include/linux/sh_dma.h2
-rw-r--r--include/linux/shdma-base.h7
-rw-r--r--include/linux/skbuff.h137
-rw-r--r--include/linux/slab.h57
-rw-r--r--include/linux/slob_def.h8
-rw-r--r--include/linux/smp.h20
-rw-r--r--include/linux/socket.h2
-rw-r--r--include/linux/spi/spi.h3
-rw-r--r--include/linux/spi/xilinx_spi.h1
-rw-r--r--include/linux/spinlock.h14
-rw-r--r--include/linux/spinlock_api_smp.h2
-rw-r--r--include/linux/spinlock_up.h2
-rw-r--r--include/linux/srcu.h43
-rw-r--r--include/linux/ssb/ssb_driver_mips.h15
-rw-r--r--include/linux/ssb/ssb_regs.h1
-rw-r--r--include/linux/stmmac.h4
-rw-r--r--include/linux/sunrpc/cache.h49
-rw-r--r--include/linux/sunrpc/gss_api.h2
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h4
-rw-r--r--include/linux/sunrpc/sched.h21
-rw-r--r--include/linux/sunrpc/svcauth.h11
-rw-r--r--include/linux/suspend.h1
-rw-r--r--include/linux/swap.h24
-rw-r--r--include/linux/swapops.h2
-rw-r--r--include/linux/syscalls.h5
-rw-r--r--include/linux/sysfs.h64
-rw-r--r--include/linux/tcp.h1
-rw-r--r--include/linux/tick.h6
-rw-r--r--include/linux/tpm.h2
-rw-r--r--include/linux/tracepoint.h2
-rw-r--r--include/linux/tty.h3
-rw-r--r--include/linux/tty_ldisc.h52
-rw-r--r--include/linux/usb.h32
-rw-r--r--include/linux/usb/chipidea.h31
-rw-r--r--include/linux/usb/ehci_pdriver.h4
-rw-r--r--include/linux/usb/hcd.h1
-rw-r--r--include/linux/usb/of.h32
-rw-r--r--include/linux/usb/otg.h7
-rw-r--r--include/linux/usb/phy.h9
-rw-r--r--include/linux/usb/serial.h15
-rw-r--r--include/linux/usb/tegra_usb_phy.h9
-rw-r--r--include/linux/usb/wusb-wa.h17
-rw-r--r--include/linux/user_namespace.h1
-rw-r--r--include/linux/vexpress.h1
-rw-r--r--include/linux/virtio.h11
-rw-r--r--include/linux/virtio_ring.h1
-rw-r--r--include/linux/vmalloc.h16
-rw-r--r--include/linux/vmpressure.h3
-rw-r--r--include/linux/vt_kern.h2
-rw-r--r--include/linux/wait.h24
-rw-r--r--include/linux/workqueue.h42
-rw-r--r--include/linux/writeback.h9
-rw-r--r--include/linux/ww_mutex.h378
-rw-r--r--include/linux/zbud.h22
-rw-r--r--include/media/davinci/vpbe_osd.h4
-rw-r--r--include/media/media-device.h9
-rw-r--r--include/media/media-entity.h5
-rw-r--r--include/media/rc-map.h1
-rw-r--r--include/media/s5p_fimc.h58
-rw-r--r--include/media/sh_mobile_ceu.h2
-rw-r--r--include/media/sh_mobile_csi2.h2
-rw-r--r--include/media/soc_camera.h43
-rw-r--r--include/media/ths7303.h2
-rw-r--r--include/media/tveeprom.h11
-rw-r--r--include/media/tvp7002.h46
-rw-r--r--include/media/v4l2-async.h105
-rw-r--r--include/media/v4l2-chip-ident.h352
-rw-r--r--include/media/v4l2-clk.h54
-rw-r--r--include/media/v4l2-common.h10
-rw-r--r--include/media/v4l2-ctrls.h1
-rw-r--r--include/media/v4l2-dev.h5
-rw-r--r--include/media/v4l2-int-device.h3
-rw-r--r--include/media/v4l2-ioctl.h2
-rw-r--r--include/media/v4l2-subdev.h14
-rw-r--r--include/net/9p/transport.h6
-rw-r--r--include/net/act_api.h2
-rw-r--r--include/net/addrconf.h4
-rw-r--r--include/net/bluetooth/hci.h1
-rw-r--r--include/net/bluetooth/hci_core.h29
-rw-r--r--include/net/bluetooth/l2cap.h2
-rw-r--r--include/net/busy_poll.h190
-rw-r--r--include/net/cfg80211.h236
-rw-r--r--include/net/gen_stats.h10
-rw-r--r--include/net/gre.h31
-rw-r--r--include/net/ieee80211_radiotap.h7
-rw-r--r--include/net/if_inet6.h13
-rw-r--r--include/net/inet_ecn.h6
-rw-r--r--include/net/inet_sock.h1
-rw-r--r--include/net/ip6_fib.h2
-rw-r--r--include/net/ip_fib.h5
-rw-r--r--include/net/ip_tunnels.h36
-rw-r--r--include/net/ip_vs.h92
-rw-r--r--include/net/ipv6.h10
-rw-r--r--include/net/mac80211.h27
-rw-r--r--include/net/ndisc.h4
-rw-r--r--include/net/net_namespace.h13
-rw-r--r--include/net/netfilter/xt_rateest.h2
-rw-r--r--include/net/netns/x_tables.h6
-rw-r--r--include/net/nfc/hci.h7
-rw-r--r--include/net/nfc/nci_core.h58
-rw-r--r--include/net/nfc/nfc.h35
-rw-r--r--include/net/ping.h65
-rw-r--r--include/net/sch_generic.h17
-rw-r--r--include/net/sctp/checksum.h5
-rw-r--r--include/net/sctp/sctp.h111
-rw-r--r--include/net/sctp/structs.h6
-rw-r--r--include/net/sock.h21
-rw-r--r--include/net/tcp.h29
-rw-r--r--include/net/transp_v6.h79
-rw-r--r--include/net/udp.h8
-rw-r--r--include/rdma/ib.h89
-rw-r--r--include/rdma/ib_addr.h6
-rw-r--r--include/rdma/ib_sa.h7
-rw-r--r--include/rdma/ib_verbs.h35
-rw-r--r--include/rdma/rdma_cm.h13
-rw-r--r--include/scsi/iscsi_if.h5
-rw-r--r--include/scsi/libiscsi.h4
-rw-r--r--include/scsi/libsas.h2
-rw-r--r--include/scsi/scsi.h5
-rw-r--r--include/scsi/scsi_device.h1
-rw-r--r--include/scsi/scsi_devinfo.h1
-rw-r--r--include/sound/control.h3
-rw-r--r--include/sound/core.h2
-rw-r--r--include/sound/pcm.h5
-rw-r--r--include/sound/rt5640.h22
-rw-r--r--include/sound/soc-dapm.h3
-rw-r--r--include/sound/soc.h4
-rw-r--r--include/target/iscsi/iscsi_transport.h21
-rw-r--r--include/target/target_core_base.h23
-rw-r--r--include/target/target_core_configfs.h1
-rw-r--r--include/target/target_core_fabric.h2
-rw-r--r--include/target/target_core_fabric_configfs.h11
-rw-r--r--include/trace/define_trace.h5
-rw-r--r--include/trace/events/9p.h28
-rw-r--r--include/trace/events/bcache.h381
-rw-r--r--include/trace/events/btrfs.h35
-rw-r--r--include/trace/events/ext3.h12
-rw-r--r--include/trace/events/ext4.h304
-rw-r--r--include/trace/events/nmi.h37
-rw-r--r--include/trace/events/pagemap.h89
-rw-r--r--include/trace/events/power.h173
-rw-r--r--include/trace/events/regmap.h23
-rw-r--r--include/trace/events/target.h214
-rw-r--r--include/trace/ftrace.h8
-rw-r--r--include/trace/syscall.h1
-rw-r--r--include/uapi/asm-generic/fcntl.h8
-rw-r--r--include/uapi/asm-generic/poll.h2
-rw-r--r--include/uapi/asm-generic/socket.h2
-rw-r--r--include/uapi/asm-generic/unistd.h2
-rw-r--r--include/uapi/drm/drm.h1
-rw-r--r--include/uapi/drm/drm_mode.h13
-rw-r--r--include/uapi/drm/i915_drm.h3
-rw-r--r--include/uapi/drm/tegra_drm.h2
-rw-r--r--include/uapi/linux/Kbuild1
-rw-r--r--include/uapi/linux/bcm933xx_hcs.h24
-rw-r--r--include/uapi/linux/btrfs.h42
-rw-r--r--include/uapi/linux/const.h3
-rw-r--r--include/uapi/linux/dm-ioctl.h4
-rw-r--r--include/uapi/linux/ethtool.h4
-rw-r--r--include/uapi/linux/firewire-cdev.h4
-rw-r--r--include/uapi/linux/gen_stats.h11
-rw-r--r--include/uapi/linux/if_arp.h1
-rw-r--r--include/uapi/linux/if_link.h15
-rw-r--r--include/uapi/linux/if_pppox.h4
-rw-r--r--include/uapi/linux/if_tun.h2
-rw-r--r--include/uapi/linux/input.h17
-rw-r--r--include/uapi/linux/ip_vs.h6
-rw-r--r--include/uapi/linux/kvm.h2
-rw-r--r--include/uapi/linux/msdos_fs.h10
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_queue.h2
-rw-r--r--include/uapi/linux/netfilter/xt_socket.h7
-rw-r--r--include/uapi/linux/nfc.h18
-rw-r--r--include/uapi/linux/nl80211.h37
-rw-r--r--include/uapi/linux/openvswitch.h20
-rw-r--r--include/uapi/linux/pci_regs.h2
-rw-r--r--include/uapi/linux/perf_event.h5
-rw-r--r--include/uapi/linux/ptrace.h3
-rw-r--r--include/uapi/linux/rtnetlink.h2
-rw-r--r--include/uapi/linux/serial_core.h6
-rw-r--r--include/uapi/linux/snmp.h2
-rw-r--r--include/uapi/linux/tipc.h2
-rw-r--r--include/uapi/linux/tipc_config.h2
-rw-r--r--include/uapi/linux/usb/ch11.h11
-rw-r--r--include/uapi/linux/v4l2-controls.h4
-rw-r--r--include/uapi/linux/vfio.h42
-rw-r--r--include/uapi/linux/videodev2.h27
-rw-r--r--include/uapi/linux/virtio_config.h3
-rw-r--r--include/uapi/linux/virtio_console.h3
-rw-r--r--include/uapi/linux/virtio_pci.h4
-rw-r--r--include/uapi/mtd/ubi-user.h5
-rw-r--r--include/uapi/rdma/rdma_user_cm.h73
-rw-r--r--include/uapi/sound/asound.h2
-rw-r--r--include/video/display_timing.h1
-rw-r--r--include/video/of_display_timing.h3
-rw-r--r--include/video/omap-panel-data.h209
-rw-r--r--include/video/omapdss.h293
-rw-r--r--include/video/uvesafb.h1
-rw-r--r--include/xen/acpi.h16
-rw-r--r--include/xen/events.h3
-rw-r--r--include/xen/hvm.h4
-rw-r--r--include/xen/interface/io/blkif.h53
-rw-r--r--include/xen/interface/io/netif.h12
-rw-r--r--include/xen/interface/io/protocols.h2
-rw-r--r--include/xen/interface/io/ring.h5
480 files changed, 13403 insertions, 3327 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 14ceff788c40..1c16f821434f 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -219,8 +219,8 @@
219 * 219 *
220 *****************************************************************************/ 220 *****************************************************************************/
221 221
222#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ 222#define ACPI_DEBUGGER_MAX_ARGS ACPI_METHOD_NUM_ARGS + 4 /* Max command line arguments */
223#define ACPI_DB_LINE_BUFFER_SIZE 512 223#define ACPI_DB_LINE_BUFFER_SIZE 512
224 224
225#define ACPI_DEBUGGER_COMMAND_PROMPT '-' 225#define ACPI_DEBUGGER_COMMAND_PROMPT '-'
226#define ACPI_DEBUGGER_EXECUTE_PROMPT '%' 226#define ACPI_DEBUGGER_EXECUTE_PROMPT '%'
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 4f52ea795c7a..4607b027a657 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -428,27 +428,21 @@
428 * This is the non-debug case -- make everything go away, 428 * This is the non-debug case -- make everything go away,
429 * leaving no executable debug code! 429 * leaving no executable debug code!
430 */ 430 */
431#define ACPI_FUNCTION_NAME(a)
432#define ACPI_DEBUG_PRINT(pl) 431#define ACPI_DEBUG_PRINT(pl)
433#define ACPI_DEBUG_PRINT_RAW(pl) 432#define ACPI_DEBUG_PRINT_RAW(pl)
434#define ACPI_DEBUG_EXEC(a) 433#define ACPI_DEBUG_EXEC(a)
435#define ACPI_DEBUG_ONLY_MEMBERS(a) 434#define ACPI_DEBUG_ONLY_MEMBERS(a)
435#define ACPI_FUNCTION_NAME(a)
436#define ACPI_FUNCTION_TRACE(a) 436#define ACPI_FUNCTION_TRACE(a)
437#define ACPI_FUNCTION_TRACE_PTR(a, b) 437#define ACPI_FUNCTION_TRACE_PTR(a, b)
438#define ACPI_FUNCTION_TRACE_U32(a, b) 438#define ACPI_FUNCTION_TRACE_U32(a, b)
439#define ACPI_FUNCTION_TRACE_STR(a, b) 439#define ACPI_FUNCTION_TRACE_STR(a, b)
440#define ACPI_FUNCTION_EXIT
441#define ACPI_FUNCTION_STATUS_EXIT(s)
442#define ACPI_FUNCTION_VALUE_EXIT(s)
443#define ACPI_FUNCTION_ENTRY() 440#define ACPI_FUNCTION_ENTRY()
444#define ACPI_DUMP_STACK_ENTRY(a) 441#define ACPI_DUMP_STACK_ENTRY(a)
445#define ACPI_DUMP_OPERANDS(a, b, c) 442#define ACPI_DUMP_OPERANDS(a, b, c)
446#define ACPI_DUMP_ENTRY(a, b) 443#define ACPI_DUMP_ENTRY(a, b)
447#define ACPI_DUMP_TABLES(a, b)
448#define ACPI_DUMP_PATHNAME(a, b, c, d) 444#define ACPI_DUMP_PATHNAME(a, b, c, d)
449#define ACPI_DUMP_BUFFER(a, b) 445#define ACPI_DUMP_BUFFER(a, b)
450#define ACPI_DEBUG_PRINT(pl)
451#define ACPI_DEBUG_PRINT_RAW(pl)
452#define ACPI_IS_DEBUG_ENABLED(level, component) 0 446#define ACPI_IS_DEBUG_ENABLED(level, component) 0
453 447
454/* Return macros must have a return statement at the minimum */ 448/* Return macros must have a return statement at the minimum */
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index c13c919ab99e..94383a70c1a3 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -63,13 +63,6 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld
63#define ACPI_BUS_FILE_ROOT "acpi" 63#define ACPI_BUS_FILE_ROOT "acpi"
64extern struct proc_dir_entry *acpi_root_dir; 64extern struct proc_dir_entry *acpi_root_dir;
65 65
66enum acpi_bus_removal_type {
67 ACPI_BUS_REMOVAL_NORMAL = 0,
68 ACPI_BUS_REMOVAL_EJECT,
69 ACPI_BUS_REMOVAL_SUPRISE,
70 ACPI_BUS_REMOVAL_TYPE_COUNT
71};
72
73enum acpi_bus_device_type { 66enum acpi_bus_device_type {
74 ACPI_BUS_TYPE_DEVICE = 0, 67 ACPI_BUS_TYPE_DEVICE = 0,
75 ACPI_BUS_TYPE_POWER, 68 ACPI_BUS_TYPE_POWER,
@@ -163,12 +156,10 @@ struct acpi_device_flags {
163 u32 dynamic_status:1; 156 u32 dynamic_status:1;
164 u32 removable:1; 157 u32 removable:1;
165 u32 ejectable:1; 158 u32 ejectable:1;
166 u32 suprise_removal_ok:1;
167 u32 power_manageable:1; 159 u32 power_manageable:1;
168 u32 performance_manageable:1;
169 u32 eject_pending:1; 160 u32 eject_pending:1;
170 u32 match_driver:1; 161 u32 match_driver:1;
171 u32 reserved:24; 162 u32 reserved:26;
172}; 163};
173 164
174/* File System */ 165/* File System */
@@ -283,14 +274,12 @@ struct acpi_device_wakeup {
283}; 274};
284 275
285struct acpi_device_physical_node { 276struct acpi_device_physical_node {
286 u8 node_id; 277 unsigned int node_id;
287 struct list_head node; 278 struct list_head node;
288 struct device *dev; 279 struct device *dev;
280 bool put_online:1;
289}; 281};
290 282
291/* set maximum of physical nodes to 32 for expansibility */
292#define ACPI_MAX_PHYSICAL_NODE 32
293
294/* Device */ 283/* Device */
295struct acpi_device { 284struct acpi_device {
296 int device_type; 285 int device_type;
@@ -310,11 +299,9 @@ struct acpi_device {
310 struct acpi_driver *driver; 299 struct acpi_driver *driver;
311 void *driver_data; 300 void *driver_data;
312 struct device dev; 301 struct device dev;
313 enum acpi_bus_removal_type removal_type; /* indicate for different removal type */ 302 unsigned int physical_node_count;
314 u8 physical_node_count;
315 struct list_head physical_node_list; 303 struct list_head physical_node_list;
316 struct mutex physical_node_lock; 304 struct mutex physical_node_lock;
317 DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE);
318 struct list_head power_dependent; 305 struct list_head power_dependent;
319 void (*remove)(struct acpi_device *); 306 void (*remove)(struct acpi_device *);
320}; 307};
@@ -443,7 +430,6 @@ int register_acpi_bus_type(struct acpi_bus_type *);
443int unregister_acpi_bus_type(struct acpi_bus_type *); 430int unregister_acpi_bus_type(struct acpi_bus_type *);
444 431
445struct acpi_pci_root { 432struct acpi_pci_root {
446 struct list_head node;
447 struct acpi_device * device; 433 struct acpi_device * device;
448 struct pci_bus *bus; 434 struct pci_bus *bus;
449 u16 segment; 435 u16 segment;
@@ -455,7 +441,11 @@ struct acpi_pci_root {
455}; 441};
456 442
457/* helper */ 443/* helper */
458acpi_handle acpi_get_child(acpi_handle, u64); 444acpi_handle acpi_find_child(acpi_handle, u64, bool);
445static inline acpi_handle acpi_get_child(acpi_handle handle, u64 addr)
446{
447 return acpi_find_child(handle, addr, false);
448}
459int acpi_is_root_bridge(acpi_handle); 449int acpi_is_root_bridge(acpi_handle);
460struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); 450struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
461#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev)) 451#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev))
@@ -468,8 +458,6 @@ acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
468 acpi_notify_handler handler, void *context); 458 acpi_notify_handler handler, void *context);
469acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, 459acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
470 acpi_notify_handler handler); 460 acpi_notify_handler handler);
471int acpi_device_power_state(struct device *dev, struct acpi_device *adev,
472 u32 target_state, int d_max_in, int *d_min_p);
473int acpi_pm_device_sleep_state(struct device *, int *, int); 461int acpi_pm_device_sleep_state(struct device *, int *, int);
474void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev); 462void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev);
475void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev); 463void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev);
@@ -485,23 +473,13 @@ static inline acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
485{ 473{
486 return AE_SUPPORT; 474 return AE_SUPPORT;
487} 475}
488static inline int __acpi_device_power_state(int m, int *p) 476static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
489{ 477{
490 if (p) 478 if (p)
491 *p = ACPI_STATE_D0; 479 *p = ACPI_STATE_D0;
480
492 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3) ? m : ACPI_STATE_D0; 481 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3) ? m : ACPI_STATE_D0;
493} 482}
494static inline int acpi_device_power_state(struct device *dev,
495 struct acpi_device *adev,
496 u32 target_state, int d_max_in,
497 int *d_min_p)
498{
499 return __acpi_device_power_state(d_max_in, d_min_p);
500}
501static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
502{
503 return __acpi_device_power_state(m, p);
504}
505static inline void acpi_dev_pm_add_dependent(acpi_handle handle, 483static inline void acpi_dev_pm_add_dependent(acpi_handle handle,
506 struct device *depdev) {} 484 struct device *depdev) {}
507static inline void acpi_dev_pm_remove_dependent(acpi_handle handle, 485static inline void acpi_dev_pm_remove_dependent(acpi_handle handle,
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 454881e6450a..22d497ee6ef9 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 0x20130328 49#define ACPI_CA_VERSION 0x20130517
50 50
51#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
52#include <acpi/actypes.h> 52#include <acpi/actypes.h>
@@ -62,6 +62,7 @@ extern u32 acpi_current_gpe_count;
62extern struct acpi_table_fadt acpi_gbl_FADT; 62extern struct acpi_table_fadt acpi_gbl_FADT;
63extern u8 acpi_gbl_system_awake_and_running; 63extern u8 acpi_gbl_system_awake_and_running;
64extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */ 64extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */
65extern u8 acpi_gbl_osi_data;
65 66
66/* Runtime configuration of debug print levels */ 67/* Runtime configuration of debug print levels */
67 68
@@ -80,6 +81,7 @@ extern bool acpi_gbl_enable_aml_debug_object;
80extern u8 acpi_gbl_copy_dsdt_locally; 81extern u8 acpi_gbl_copy_dsdt_locally;
81extern u8 acpi_gbl_truncate_io_addresses; 82extern u8 acpi_gbl_truncate_io_addresses;
82extern u8 acpi_gbl_disable_auto_repair; 83extern u8 acpi_gbl_disable_auto_repair;
84extern u8 acpi_gbl_disable_ssdt_table_load;
83 85
84/* 86/*
85 * Hardware-reduced prototypes. All interfaces that use these macros will 87 * Hardware-reduced prototypes. All interfaces that use these macros will
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index a64adcc29ae5..22b03c9286e9 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -1144,4 +1144,19 @@ struct acpi_memory_list {
1144#endif 1144#endif
1145}; 1145};
1146 1146
1147/* Definitions for _OSI support */
1148
1149#define ACPI_OSI_WIN_2000 0x01
1150#define ACPI_OSI_WIN_XP 0x02
1151#define ACPI_OSI_WIN_XP_SP1 0x03
1152#define ACPI_OSI_WINSRV_2003 0x04
1153#define ACPI_OSI_WIN_XP_SP2 0x05
1154#define ACPI_OSI_WINSRV_2003_SP1 0x06
1155#define ACPI_OSI_WIN_VISTA 0x07
1156#define ACPI_OSI_WINSRV_2008 0x08
1157#define ACPI_OSI_WIN_VISTA_SP1 0x09
1158#define ACPI_OSI_WIN_VISTA_SP2 0x0A
1159#define ACPI_OSI_WIN_7 0x0B
1160#define ACPI_OSI_WIN_8 0x0C
1161
1147#endif /* __ACTYPES_H__ */ 1162#endif /* __ACTYPES_H__ */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index ea69367fdd3b..66096d06925e 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -6,6 +6,10 @@
6#include <linux/thermal.h> 6#include <linux/thermal.h>
7#include <asm/acpi.h> 7#include <asm/acpi.h>
8 8
9#define ACPI_PROCESSOR_CLASS "processor"
10#define ACPI_PROCESSOR_DEVICE_NAME "Processor"
11#define ACPI_PROCESSOR_DEVICE_HID "ACPI0007"
12
9#define ACPI_PROCESSOR_BUSY_METRIC 10 13#define ACPI_PROCESSOR_BUSY_METRIC 10
10 14
11#define ACPI_PROCESSOR_MAX_POWER 8 15#define ACPI_PROCESSOR_MAX_POWER 8
@@ -207,6 +211,7 @@ struct acpi_processor {
207 struct acpi_processor_throttling throttling; 211 struct acpi_processor_throttling throttling;
208 struct acpi_processor_limit limit; 212 struct acpi_processor_limit limit;
209 struct thermal_cooling_device *cdev; 213 struct thermal_cooling_device *cdev;
214 struct device *dev; /* Processor device. */
210}; 215};
211 216
212struct acpi_processor_errata { 217struct acpi_processor_errata {
diff --git a/include/asm-generic/mutex-dec.h b/include/asm-generic/mutex-dec.h
index f104af7cf437..d4f9fb4e53df 100644
--- a/include/asm-generic/mutex-dec.h
+++ b/include/asm-generic/mutex-dec.h
@@ -28,17 +28,15 @@ __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
28 * __mutex_fastpath_lock_retval - try to take the lock by moving the count 28 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
29 * from 1 to a 0 value 29 * from 1 to a 0 value
30 * @count: pointer of type atomic_t 30 * @count: pointer of type atomic_t
31 * @fail_fn: function to call if the original value was not 1
32 * 31 *
33 * Change the count from 1 to a value lower than 1, and call <fail_fn> if 32 * Change the count from 1 to a value lower than 1. This function returns 0
34 * it wasn't 1 originally. This function returns 0 if the fastpath succeeds, 33 * if the fastpath succeeds, or -1 otherwise.
35 * or anything the slow path function returns.
36 */ 34 */
37static inline int 35static inline int
38__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) 36__mutex_fastpath_lock_retval(atomic_t *count)
39{ 37{
40 if (unlikely(atomic_dec_return(count) < 0)) 38 if (unlikely(atomic_dec_return(count) < 0))
41 return fail_fn(count); 39 return -1;
42 return 0; 40 return 0;
43} 41}
44 42
diff --git a/include/asm-generic/mutex-null.h b/include/asm-generic/mutex-null.h
index e1bbbc72b6a2..61069ed334e2 100644
--- a/include/asm-generic/mutex-null.h
+++ b/include/asm-generic/mutex-null.h
@@ -11,7 +11,7 @@
11#define _ASM_GENERIC_MUTEX_NULL_H 11#define _ASM_GENERIC_MUTEX_NULL_H
12 12
13#define __mutex_fastpath_lock(count, fail_fn) fail_fn(count) 13#define __mutex_fastpath_lock(count, fail_fn) fail_fn(count)
14#define __mutex_fastpath_lock_retval(count, fail_fn) fail_fn(count) 14#define __mutex_fastpath_lock_retval(count) (-1)
15#define __mutex_fastpath_unlock(count, fail_fn) fail_fn(count) 15#define __mutex_fastpath_unlock(count, fail_fn) fail_fn(count)
16#define __mutex_fastpath_trylock(count, fail_fn) fail_fn(count) 16#define __mutex_fastpath_trylock(count, fail_fn) fail_fn(count)
17#define __mutex_slowpath_needs_to_unlock() 1 17#define __mutex_slowpath_needs_to_unlock() 1
diff --git a/include/asm-generic/mutex-xchg.h b/include/asm-generic/mutex-xchg.h
index c04e0db8a2d6..f169ec064785 100644
--- a/include/asm-generic/mutex-xchg.h
+++ b/include/asm-generic/mutex-xchg.h
@@ -39,18 +39,16 @@ __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
39 * __mutex_fastpath_lock_retval - try to take the lock by moving the count 39 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
40 * from 1 to a 0 value 40 * from 1 to a 0 value
41 * @count: pointer of type atomic_t 41 * @count: pointer of type atomic_t
42 * @fail_fn: function to call if the original value was not 1
43 * 42 *
44 * Change the count from 1 to a value lower than 1, and call <fail_fn> if it 43 * Change the count from 1 to a value lower than 1. This function returns 0
45 * wasn't 1 originally. This function returns 0 if the fastpath succeeds, 44 * if the fastpath succeeds, or -1 otherwise.
46 * or anything the slow path function returns
47 */ 45 */
48static inline int 46static inline int
49__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) 47__mutex_fastpath_lock_retval(atomic_t *count)
50{ 48{
51 if (unlikely(atomic_xchg(count, 0) != 1)) 49 if (unlikely(atomic_xchg(count, 0) != 1))
52 if (likely(atomic_xchg(count, -1) != 1)) 50 if (likely(atomic_xchg(count, -1) != 1))
53 return fail_fn(count); 51 return -1;
54 return 0; 52 return 0;
55} 53}
56 54
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index a59ff51b0166..0807ddf97b05 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -173,11 +173,12 @@ extern void pmdp_splitting_flush(struct vm_area_struct *vma,
173#endif 173#endif
174 174
175#ifndef __HAVE_ARCH_PGTABLE_DEPOSIT 175#ifndef __HAVE_ARCH_PGTABLE_DEPOSIT
176extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable); 176extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
177 pgtable_t pgtable);
177#endif 178#endif
178 179
179#ifndef __HAVE_ARCH_PGTABLE_WITHDRAW 180#ifndef __HAVE_ARCH_PGTABLE_WITHDRAW
180extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm); 181extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
181#endif 182#endif
182 183
183#ifndef __HAVE_ARCH_PMDP_INVALIDATE 184#ifndef __HAVE_ARCH_PMDP_INVALIDATE
@@ -396,6 +397,58 @@ static inline void ptep_modify_prot_commit(struct mm_struct *mm,
396#define arch_start_context_switch(prev) do {} while (0) 397#define arch_start_context_switch(prev) do {} while (0)
397#endif 398#endif
398 399
400#ifndef CONFIG_HAVE_ARCH_SOFT_DIRTY
401static inline int pte_soft_dirty(pte_t pte)
402{
403 return 0;
404}
405
406static inline int pmd_soft_dirty(pmd_t pmd)
407{
408 return 0;
409}
410
411static inline pte_t pte_mksoft_dirty(pte_t pte)
412{
413 return pte;
414}
415
416static inline pmd_t pmd_mksoft_dirty(pmd_t pmd)
417{
418 return pmd;
419}
420
421static inline pte_t pte_swp_mksoft_dirty(pte_t pte)
422{
423 return pte;
424}
425
426static inline int pte_swp_soft_dirty(pte_t pte)
427{
428 return 0;
429}
430
431static inline pte_t pte_swp_clear_soft_dirty(pte_t pte)
432{
433 return pte;
434}
435
436static inline pte_t pte_file_clear_soft_dirty(pte_t pte)
437{
438 return pte;
439}
440
441static inline pte_t pte_file_mksoft_dirty(pte_t pte)
442{
443 return pte;
444}
445
446static inline int pte_file_soft_dirty(pte_t pte)
447{
448 return 0;
449}
450#endif
451
399#ifndef __HAVE_PFNMAP_TRACKING 452#ifndef __HAVE_PFNMAP_TRACKING
400/* 453/*
401 * Interfaces that can be used by architecture code to keep track of 454 * Interfaces that can be used by architecture code to keep track of
@@ -692,4 +745,8 @@ static inline pmd_t pmd_mknuma(pmd_t pmd)
692 745
693#endif /* !__ASSEMBLY__ */ 746#endif /* !__ASSEMBLY__ */
694 747
748#ifndef io_remap_pfn_range
749#define io_remap_pfn_range remap_pfn_range
750#endif
751
695#endif /* _ASM_GENERIC_PGTABLE_H */ 752#endif /* _ASM_GENERIC_PGTABLE_H */
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index c1a1216e29ce..f1a24b5c3b90 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -3,6 +3,26 @@
3 3
4/* References to section boundaries */ 4/* References to section boundaries */
5 5
6/*
7 * Usage guidelines:
8 * _text, _data: architecture specific, don't use them in arch-independent code
9 * [_stext, _etext]: contains .text.* sections, may also contain .rodata.*
10 * and/or .init.* sections
11 * [_sdata, _edata]: contains .data.* sections, may also contain .rodata.*
12 * and/or .init.* sections.
13 * [__start_rodata, __end_rodata]: contains .rodata.* sections
14 * [__init_begin, __init_end]: contains .init.* sections, but .init.text.*
15 * may be out of this range on some architectures.
16 * [_sinittext, _einittext]: contains .init.text.* sections
17 * [__bss_start, __bss_stop]: contains BSS sections
18 *
19 * Following global variables are optional and may be unavailable on some
20 * architectures and/or kernel configurations.
21 * _text, _data
22 * __kprobes_text_start, __kprobes_text_end
23 * __entry_text_start, __entry_text_end
24 * __ctors_start, __ctors_end
25 */
6extern char _text[], _stext[], _etext[]; 26extern char _text[], _stext[], _etext[];
7extern char _data[], _sdata[], _edata[]; 27extern char _data[], _sdata[], _edata[];
8extern char __bss_start[], __bss_stop[]; 28extern char __bss_start[], __bss_stop[];
@@ -12,7 +32,6 @@ extern char _end[];
12extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[]; 32extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[];
13extern char __kprobes_text_start[], __kprobes_text_end[]; 33extern char __kprobes_text_start[], __kprobes_text_end[];
14extern char __entry_text_start[], __entry_text_end[]; 34extern char __entry_text_start[], __entry_text_end[];
15extern char __initdata_begin[], __initdata_end[];
16extern char __start_rodata[], __end_rodata[]; 35extern char __start_rodata[], __end_rodata[];
17 36
18/* Start and end of .ctors section - used for constructor calls. */ 37/* Start and end of .ctors section - used for constructor calls. */
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index c184aa8ec8cd..dc1269c74a52 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -163,7 +163,7 @@ static inline __must_check long __copy_to_user(void __user *to,
163 163
164#define put_user(x, ptr) \ 164#define put_user(x, ptr) \
165({ \ 165({ \
166 might_sleep(); \ 166 might_fault(); \
167 access_ok(VERIFY_WRITE, ptr, sizeof(*ptr)) ? \ 167 access_ok(VERIFY_WRITE, ptr, sizeof(*ptr)) ? \
168 __put_user(x, ptr) : \ 168 __put_user(x, ptr) : \
169 -EFAULT; \ 169 -EFAULT; \
@@ -225,7 +225,7 @@ extern int __put_user_bad(void) __attribute__((noreturn));
225 225
226#define get_user(x, ptr) \ 226#define get_user(x, ptr) \
227({ \ 227({ \
228 might_sleep(); \ 228 might_fault(); \
229 access_ok(VERIFY_READ, ptr, sizeof(*ptr)) ? \ 229 access_ok(VERIFY_READ, ptr, sizeof(*ptr)) ? \
230 __get_user(x, ptr) : \ 230 __get_user(x, ptr) : \
231 -EFAULT; \ 231 -EFAULT; \
@@ -255,7 +255,7 @@ extern int __get_user_bad(void) __attribute__((noreturn));
255static inline long copy_from_user(void *to, 255static inline long copy_from_user(void *to,
256 const void __user * from, unsigned long n) 256 const void __user * from, unsigned long n)
257{ 257{
258 might_sleep(); 258 might_fault();
259 if (access_ok(VERIFY_READ, from, n)) 259 if (access_ok(VERIFY_READ, from, n))
260 return __copy_from_user(to, from, n); 260 return __copy_from_user(to, from, n);
261 else 261 else
@@ -265,7 +265,7 @@ static inline long copy_from_user(void *to,
265static inline long copy_to_user(void __user *to, 265static inline long copy_to_user(void __user *to,
266 const void *from, unsigned long n) 266 const void *from, unsigned long n)
267{ 267{
268 might_sleep(); 268 might_fault();
269 if (access_ok(VERIFY_WRITE, to, n)) 269 if (access_ok(VERIFY_WRITE, to, n))
270 return __copy_to_user(to, from, n); 270 return __copy_to_user(to, from, n);
271 else 271 else
@@ -336,7 +336,7 @@ __clear_user(void __user *to, unsigned long n)
336static inline __must_check unsigned long 336static inline __must_check unsigned long
337clear_user(void __user *to, unsigned long n) 337clear_user(void __user *to, unsigned long n)
338{ 338{
339 might_sleep(); 339 might_fault();
340 if (!access_ok(VERIFY_WRITE, to, n)) 340 if (!access_ok(VERIFY_WRITE, to, n))
341 return n; 341 return n;
342 342
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index eb58d2d7d971..69732d279e8b 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -68,14 +68,6 @@
68 * are handled as text/data or they can be discarded (which 68 * are handled as text/data or they can be discarded (which
69 * often happens at runtime) 69 * often happens at runtime)
70 */ 70 */
71#ifdef CONFIG_HOTPLUG
72#define DEV_KEEP(sec) *(.dev##sec)
73#define DEV_DISCARD(sec)
74#else
75#define DEV_KEEP(sec)
76#define DEV_DISCARD(sec) *(.dev##sec)
77#endif
78
79#ifdef CONFIG_HOTPLUG_CPU 71#ifdef CONFIG_HOTPLUG_CPU
80#define CPU_KEEP(sec) *(.cpu##sec) 72#define CPU_KEEP(sec) *(.cpu##sec)
81#define CPU_DISCARD(sec) 73#define CPU_DISCARD(sec)
@@ -182,10 +174,6 @@
182 *(.data) \ 174 *(.data) \
183 *(.ref.data) \ 175 *(.ref.data) \
184 *(.data..shared_aligned) /* percpu related */ \ 176 *(.data..shared_aligned) /* percpu related */ \
185 DEV_KEEP(init.data) \
186 DEV_KEEP(exit.data) \
187 CPU_KEEP(init.data) \
188 CPU_KEEP(exit.data) \
189 MEM_KEEP(init.data) \ 177 MEM_KEEP(init.data) \
190 MEM_KEEP(exit.data) \ 178 MEM_KEEP(exit.data) \
191 *(.data.unlikely) \ 179 *(.data.unlikely) \
@@ -285,13 +273,6 @@
285 VMLINUX_SYMBOL(__end_builtin_fw) = .; \ 273 VMLINUX_SYMBOL(__end_builtin_fw) = .; \
286 } \ 274 } \
287 \ 275 \
288 /* RapidIO route ops */ \
289 .rio_ops : AT(ADDR(.rio_ops) - LOAD_OFFSET) { \
290 VMLINUX_SYMBOL(__start_rio_switch_ops) = .; \
291 *(.rio_switch_ops) \
292 VMLINUX_SYMBOL(__end_rio_switch_ops) = .; \
293 } \
294 \
295 TRACEDATA \ 276 TRACEDATA \
296 \ 277 \
297 /* Kernel symbol table: Normal symbols */ \ 278 /* Kernel symbol table: Normal symbols */ \
@@ -372,10 +353,6 @@
372 /* __*init sections */ \ 353 /* __*init sections */ \
373 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \ 354 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
374 *(.ref.rodata) \ 355 *(.ref.rodata) \
375 DEV_KEEP(init.rodata) \
376 DEV_KEEP(exit.rodata) \
377 CPU_KEEP(init.rodata) \
378 CPU_KEEP(exit.rodata) \
379 MEM_KEEP(init.rodata) \ 356 MEM_KEEP(init.rodata) \
380 MEM_KEEP(exit.rodata) \ 357 MEM_KEEP(exit.rodata) \
381 } \ 358 } \
@@ -416,10 +393,6 @@
416 *(.text.hot) \ 393 *(.text.hot) \
417 *(.text) \ 394 *(.text) \
418 *(.ref.text) \ 395 *(.ref.text) \
419 DEV_KEEP(init.text) \
420 DEV_KEEP(exit.text) \
421 CPU_KEEP(init.text) \
422 CPU_KEEP(exit.text) \
423 MEM_KEEP(init.text) \ 396 MEM_KEEP(init.text) \
424 MEM_KEEP(exit.text) \ 397 MEM_KEEP(exit.text) \
425 *(.text.unlikely) 398 *(.text.unlikely)
@@ -503,16 +476,12 @@
503/* init and exit section handling */ 476/* init and exit section handling */
504#define INIT_DATA \ 477#define INIT_DATA \
505 *(.init.data) \ 478 *(.init.data) \
506 DEV_DISCARD(init.data) \
507 CPU_DISCARD(init.data) \
508 MEM_DISCARD(init.data) \ 479 MEM_DISCARD(init.data) \
509 KERNEL_CTORS() \ 480 KERNEL_CTORS() \
510 MCOUNT_REC() \ 481 MCOUNT_REC() \
511 *(.init.rodata) \ 482 *(.init.rodata) \
512 FTRACE_EVENTS() \ 483 FTRACE_EVENTS() \
513 TRACE_SYSCALLS() \ 484 TRACE_SYSCALLS() \
514 DEV_DISCARD(init.rodata) \
515 CPU_DISCARD(init.rodata) \
516 MEM_DISCARD(init.rodata) \ 485 MEM_DISCARD(init.rodata) \
517 CLK_OF_TABLES() \ 486 CLK_OF_TABLES() \
518 CLKSRC_OF_TABLES() \ 487 CLKSRC_OF_TABLES() \
@@ -521,23 +490,15 @@
521 490
522#define INIT_TEXT \ 491#define INIT_TEXT \
523 *(.init.text) \ 492 *(.init.text) \
524 DEV_DISCARD(init.text) \
525 CPU_DISCARD(init.text) \
526 MEM_DISCARD(init.text) 493 MEM_DISCARD(init.text)
527 494
528#define EXIT_DATA \ 495#define EXIT_DATA \
529 *(.exit.data) \ 496 *(.exit.data) \
530 DEV_DISCARD(exit.data) \
531 DEV_DISCARD(exit.rodata) \
532 CPU_DISCARD(exit.data) \
533 CPU_DISCARD(exit.rodata) \
534 MEM_DISCARD(exit.data) \ 497 MEM_DISCARD(exit.data) \
535 MEM_DISCARD(exit.rodata) 498 MEM_DISCARD(exit.rodata)
536 499
537#define EXIT_TEXT \ 500#define EXIT_TEXT \
538 *(.exit.text) \ 501 *(.exit.text) \
539 DEV_DISCARD(exit.text) \
540 CPU_DISCARD(exit.text) \
541 MEM_DISCARD(exit.text) 502 MEM_DISCARD(exit.text)
542 503
543#define EXIT_CALL \ 504#define EXIT_CALL \
diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h
index e6c9c4cc9b23..c463ce990c48 100644
--- a/include/clocksource/arm_arch_timer.h
+++ b/include/clocksource/arm_arch_timer.h
@@ -32,7 +32,7 @@
32#ifdef CONFIG_ARM_ARCH_TIMER 32#ifdef CONFIG_ARM_ARCH_TIMER
33 33
34extern u32 arch_timer_get_rate(void); 34extern u32 arch_timer_get_rate(void);
35extern u64 (*arch_timer_read_counter)(void); 35extern u64 arch_timer_read_counter(void);
36extern struct timecounter *arch_timer_get_timecounter(void); 36extern struct timecounter *arch_timer_get_timecounter(void);
37 37
38#else 38#else
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 63d17ee9eb48..12083dc862a9 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -55,16 +55,13 @@
55#include <linux/mm.h> 55#include <linux/mm.h>
56#include <linux/cdev.h> 56#include <linux/cdev.h>
57#include <linux/mutex.h> 57#include <linux/mutex.h>
58#include <linux/io.h>
58#include <linux/slab.h> 59#include <linux/slab.h>
59#if defined(__alpha__) || defined(__powerpc__) 60#if defined(__alpha__) || defined(__powerpc__)
60#include <asm/pgtable.h> /* For pte_wrprotect */ 61#include <asm/pgtable.h> /* For pte_wrprotect */
61#endif 62#endif
62#include <asm/io.h>
63#include <asm/mman.h> 63#include <asm/mman.h>
64#include <asm/uaccess.h> 64#include <asm/uaccess.h>
65#ifdef CONFIG_MTRR
66#include <asm/mtrr.h>
67#endif
68#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) 65#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
69#include <linux/types.h> 66#include <linux/types.h>
70#include <linux/agp_backend.h> 67#include <linux/agp_backend.h>
@@ -933,12 +930,15 @@ struct drm_driver {
933 struct dma_buf *dma_buf); 930 struct dma_buf *dma_buf);
934 /* low-level interface used by drm_gem_prime_{import,export} */ 931 /* low-level interface used by drm_gem_prime_{import,export} */
935 int (*gem_prime_pin)(struct drm_gem_object *obj); 932 int (*gem_prime_pin)(struct drm_gem_object *obj);
933 void (*gem_prime_unpin)(struct drm_gem_object *obj);
936 struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj); 934 struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj);
937 struct drm_gem_object *(*gem_prime_import_sg_table)( 935 struct drm_gem_object *(*gem_prime_import_sg_table)(
938 struct drm_device *dev, size_t size, 936 struct drm_device *dev, size_t size,
939 struct sg_table *sgt); 937 struct sg_table *sgt);
940 void *(*gem_prime_vmap)(struct drm_gem_object *obj); 938 void *(*gem_prime_vmap)(struct drm_gem_object *obj);
941 void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr); 939 void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr);
940 int (*gem_prime_mmap)(struct drm_gem_object *obj,
941 struct vm_area_struct *vma);
942 942
943 /* vga arb irq handler */ 943 /* vga arb irq handler */
944 void (*vgaarb_irq)(struct drm_device *dev, bool state); 944 void (*vgaarb_irq)(struct drm_device *dev, bool state);
@@ -1250,37 +1250,8 @@ static inline int drm_core_has_MTRR(struct drm_device *dev)
1250{ 1250{
1251 return drm_core_check_feature(dev, DRIVER_USE_MTRR); 1251 return drm_core_check_feature(dev, DRIVER_USE_MTRR);
1252} 1252}
1253
1254#define DRM_MTRR_WC MTRR_TYPE_WRCOMB
1255
1256static inline int drm_mtrr_add(unsigned long offset, unsigned long size,
1257 unsigned int flags)
1258{
1259 return mtrr_add(offset, size, flags, 1);
1260}
1261
1262static inline int drm_mtrr_del(int handle, unsigned long offset,
1263 unsigned long size, unsigned int flags)
1264{
1265 return mtrr_del(handle, offset, size);
1266}
1267
1268#else 1253#else
1269#define drm_core_has_MTRR(dev) (0) 1254#define drm_core_has_MTRR(dev) (0)
1270
1271#define DRM_MTRR_WC 0
1272
1273static inline int drm_mtrr_add(unsigned long offset, unsigned long size,
1274 unsigned int flags)
1275{
1276 return 0;
1277}
1278
1279static inline int drm_mtrr_del(int handle, unsigned long offset,
1280 unsigned long size, unsigned int flags)
1281{
1282 return 0;
1283}
1284#endif 1255#endif
1285 1256
1286static inline void drm_device_set_unplugged(struct drm_device *dev) 1257static inline void drm_device_set_unplugged(struct drm_device *dev)
@@ -1630,7 +1601,6 @@ extern void drm_sysfs_destroy(void);
1630extern int drm_sysfs_device_add(struct drm_minor *minor); 1601extern int drm_sysfs_device_add(struct drm_minor *minor);
1631extern void drm_sysfs_hotplug_event(struct drm_device *dev); 1602extern void drm_sysfs_hotplug_event(struct drm_device *dev);
1632extern void drm_sysfs_device_remove(struct drm_minor *minor); 1603extern void drm_sysfs_device_remove(struct drm_minor *minor);
1633extern char *drm_get_connector_status_name(enum drm_connector_status status);
1634extern int drm_sysfs_connector_add(struct drm_connector *connector); 1604extern int drm_sysfs_connector_add(struct drm_connector *connector);
1635extern void drm_sysfs_connector_remove(struct drm_connector *connector); 1605extern void drm_sysfs_connector_remove(struct drm_connector *connector);
1636 1606
@@ -1648,6 +1618,8 @@ int drm_gem_private_object_init(struct drm_device *dev,
1648void drm_gem_object_handle_free(struct drm_gem_object *obj); 1618void drm_gem_object_handle_free(struct drm_gem_object *obj);
1649void drm_gem_vm_open(struct vm_area_struct *vma); 1619void drm_gem_vm_open(struct vm_area_struct *vma);
1650void drm_gem_vm_close(struct vm_area_struct *vma); 1620void drm_gem_vm_close(struct vm_area_struct *vma);
1621int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
1622 struct vm_area_struct *vma);
1651int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); 1623int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
1652 1624
1653#include <drm/drm_global.h> 1625#include <drm/drm_global.h>
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index adb3f9b625f6..fa12a2fa4293 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -339,6 +339,9 @@ struct drm_crtc_funcs {
339 /* cursor controls */ 339 /* cursor controls */
340 int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv, 340 int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv,
341 uint32_t handle, uint32_t width, uint32_t height); 341 uint32_t handle, uint32_t width, uint32_t height);
342 int (*cursor_set2)(struct drm_crtc *crtc, struct drm_file *file_priv,
343 uint32_t handle, uint32_t width, uint32_t height,
344 int32_t hot_x, int32_t hot_y);
342 int (*cursor_move)(struct drm_crtc *crtc, int x, int y); 345 int (*cursor_move)(struct drm_crtc *crtc, int x, int y);
343 346
344 /* Set gamma on the CRTC */ 347 /* Set gamma on the CRTC */
@@ -409,6 +412,10 @@ struct drm_crtc {
409 /* framebuffer the connector is currently bound to */ 412 /* framebuffer the connector is currently bound to */
410 struct drm_framebuffer *fb; 413 struct drm_framebuffer *fb;
411 414
415 /* Temporary tracking of the old fb while a modeset is ongoing. Used
416 * by drm_mode_set_config_internal to implement correct refcounting. */
417 struct drm_framebuffer *old_fb;
418
412 bool enabled; 419 bool enabled;
413 420
414 /* Requested mode from modesetting. */ 421 /* Requested mode from modesetting. */
@@ -654,11 +661,7 @@ struct drm_plane_funcs {
654 * @format_count: number of formats supported 661 * @format_count: number of formats supported
655 * @crtc: currently bound CRTC 662 * @crtc: currently bound CRTC
656 * @fb: currently bound fb 663 * @fb: currently bound fb
657 * @gamma_size: size of gamma table
658 * @gamma_store: gamma correction table
659 * @enabled: enabled flag
660 * @funcs: helper functions 664 * @funcs: helper functions
661 * @helper_private: storage for drver layer
662 * @properties: property tracking for this plane 665 * @properties: property tracking for this plane
663 */ 666 */
664struct drm_plane { 667struct drm_plane {
@@ -674,14 +677,7 @@ struct drm_plane {
674 struct drm_crtc *crtc; 677 struct drm_crtc *crtc;
675 struct drm_framebuffer *fb; 678 struct drm_framebuffer *fb;
676 679
677 /* CRTC gamma size for reporting to userspace */
678 uint32_t gamma_size;
679 uint16_t *gamma_store;
680
681 bool enabled;
682
683 const struct drm_plane_funcs *funcs; 680 const struct drm_plane_funcs *funcs;
684 void *helper_private;
685 681
686 struct drm_object_properties properties; 682 struct drm_object_properties properties;
687}; 683};
@@ -894,15 +890,17 @@ extern int drm_plane_init(struct drm_device *dev,
894 const uint32_t *formats, uint32_t format_count, 890 const uint32_t *formats, uint32_t format_count,
895 bool priv); 891 bool priv);
896extern void drm_plane_cleanup(struct drm_plane *plane); 892extern void drm_plane_cleanup(struct drm_plane *plane);
893extern void drm_plane_force_disable(struct drm_plane *plane);
897 894
898extern void drm_encoder_cleanup(struct drm_encoder *encoder); 895extern void drm_encoder_cleanup(struct drm_encoder *encoder);
899 896
900extern char *drm_get_connector_name(struct drm_connector *connector); 897extern const char *drm_get_connector_name(const struct drm_connector *connector);
901extern char *drm_get_dpms_name(int val); 898extern const char *drm_get_connector_status_name(enum drm_connector_status status);
902extern char *drm_get_dvi_i_subconnector_name(int val); 899extern const char *drm_get_dpms_name(int val);
903extern char *drm_get_dvi_i_select_name(int val); 900extern const char *drm_get_dvi_i_subconnector_name(int val);
904extern char *drm_get_tv_subconnector_name(int val); 901extern const char *drm_get_dvi_i_select_name(int val);
905extern char *drm_get_tv_select_name(int val); 902extern const char *drm_get_tv_subconnector_name(int val);
903extern const char *drm_get_tv_select_name(int val);
906extern void drm_fb_release(struct drm_file *file_priv); 904extern void drm_fb_release(struct drm_file *file_priv);
907extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 905extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
908extern bool drm_probe_ddc(struct i2c_adapter *adapter); 906extern bool drm_probe_ddc(struct i2c_adapter *adapter);
@@ -994,7 +992,7 @@ extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats
994extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); 992extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
995extern int drm_mode_create_dithering_property(struct drm_device *dev); 993extern int drm_mode_create_dithering_property(struct drm_device *dev);
996extern int drm_mode_create_dirty_info_property(struct drm_device *dev); 994extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
997extern char *drm_get_encoder_name(struct drm_encoder *encoder); 995extern const char *drm_get_encoder_name(const struct drm_encoder *encoder);
998 996
999extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, 997extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
1000 struct drm_encoder *encoder); 998 struct drm_encoder *encoder);
@@ -1022,6 +1020,8 @@ extern int drm_mode_setplane(struct drm_device *dev,
1022 void *data, struct drm_file *file_priv); 1020 void *data, struct drm_file *file_priv);
1023extern int drm_mode_cursor_ioctl(struct drm_device *dev, 1021extern int drm_mode_cursor_ioctl(struct drm_device *dev,
1024 void *data, struct drm_file *file_priv); 1022 void *data, struct drm_file *file_priv);
1023extern int drm_mode_cursor2_ioctl(struct drm_device *dev,
1024 void *data, struct drm_file *file_priv);
1025extern int drm_mode_addfb(struct drm_device *dev, 1025extern int drm_mode_addfb(struct drm_device *dev,
1026 void *data, struct drm_file *file_priv); 1026 void *data, struct drm_file *file_priv);
1027extern int drm_mode_addfb2(struct drm_device *dev, 1027extern int drm_mode_addfb2(struct drm_device *dev,
@@ -1094,5 +1094,6 @@ extern int drm_format_num_planes(uint32_t format);
1094extern int drm_format_plane_cpp(uint32_t format, int plane); 1094extern int drm_format_plane_cpp(uint32_t format, int plane);
1095extern int drm_format_horz_chroma_subsampling(uint32_t format); 1095extern int drm_format_horz_chroma_subsampling(uint32_t format);
1096extern int drm_format_vert_chroma_subsampling(uint32_t format); 1096extern int drm_format_vert_chroma_subsampling(uint32_t format);
1097extern const char *drm_get_format_name(uint32_t format);
1097 1098
1098#endif /* __DRM_CRTC_H__ */ 1099#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h
index 0ead502e17d2..d639049a613d 100644
--- a/include/drm/drm_fixed.h
+++ b/include/drm/drm_fixed.h
@@ -20,10 +20,13 @@
20 * OTHER DEALINGS IN THE SOFTWARE. 20 * OTHER DEALINGS IN THE SOFTWARE.
21 * 21 *
22 * Authors: Dave Airlie 22 * Authors: Dave Airlie
23 * Christian König
23 */ 24 */
24#ifndef DRM_FIXED_H 25#ifndef DRM_FIXED_H
25#define DRM_FIXED_H 26#define DRM_FIXED_H
26 27
28#include <linux/math64.h>
29
27typedef union dfixed { 30typedef union dfixed {
28 u32 full; 31 u32 full;
29} fixed20_12; 32} fixed20_12;
@@ -65,4 +68,95 @@ static inline u32 dfixed_div(fixed20_12 A, fixed20_12 B)
65 tmp /= 2; 68 tmp /= 2;
66 return lower_32_bits(tmp); 69 return lower_32_bits(tmp);
67} 70}
71
72#define DRM_FIXED_POINT 32
73#define DRM_FIXED_ONE (1ULL << DRM_FIXED_POINT)
74#define DRM_FIXED_DECIMAL_MASK (DRM_FIXED_ONE - 1)
75#define DRM_FIXED_DIGITS_MASK (~DRM_FIXED_DECIMAL_MASK)
76
77static inline s64 drm_int2fixp(int a)
78{
79 return ((s64)a) << DRM_FIXED_POINT;
80}
81
82static inline int drm_fixp2int(int64_t a)
83{
84 return ((s64)a) >> DRM_FIXED_POINT;
85}
86
87static inline unsigned drm_fixp_msbset(int64_t a)
88{
89 unsigned shift, sign = (a >> 63) & 1;
90
91 for (shift = 62; shift > 0; --shift)
92 if (((a >> shift) & 1) != sign)
93 return shift;
94
95 return 0;
96}
97
98static inline s64 drm_fixp_mul(s64 a, s64 b)
99{
100 unsigned shift = drm_fixp_msbset(a) + drm_fixp_msbset(b);
101 s64 result;
102
103 if (shift > 61) {
104 shift = shift - 61;
105 a >>= (shift >> 1) + (shift & 1);
106 b >>= shift >> 1;
107 } else
108 shift = 0;
109
110 result = a * b;
111
112 if (shift > DRM_FIXED_POINT)
113 return result << (shift - DRM_FIXED_POINT);
114
115 if (shift < DRM_FIXED_POINT)
116 return result >> (DRM_FIXED_POINT - shift);
117
118 return result;
119}
120
121static inline s64 drm_fixp_div(s64 a, s64 b)
122{
123 unsigned shift = 62 - drm_fixp_msbset(a);
124 s64 result;
125
126 a <<= shift;
127
128 if (shift < DRM_FIXED_POINT)
129 b >>= (DRM_FIXED_POINT - shift);
130
131 result = div64_s64(a, b);
132
133 if (shift > DRM_FIXED_POINT)
134 return result >> (shift - DRM_FIXED_POINT);
135
136 return result;
137}
138
139static inline s64 drm_fixp_exp(s64 x)
140{
141 s64 tolerance = div64_s64(DRM_FIXED_ONE, 1000000);
142 s64 sum = DRM_FIXED_ONE, term, y = x;
143 u64 count = 1;
144
145 if (x < 0)
146 y = -1 * x;
147
148 term = y;
149
150 while (term >= tolerance) {
151 sum = sum + term;
152 count = count + 1;
153 term = drm_fixp_mul(term, div64_s64(y, count));
154 }
155
156 if (x < 0)
157 sum = drm_fixp_div(DRM_FIXED_ONE, sum);
158
159 return sum;
160}
161
68#endif 162#endif
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
index 63397ced9254..c34f27f80bcc 100644
--- a/include/drm/drm_gem_cma_helper.h
+++ b/include/drm/drm_gem_cma_helper.h
@@ -4,6 +4,9 @@
4struct drm_gem_cma_object { 4struct drm_gem_cma_object {
5 struct drm_gem_object base; 5 struct drm_gem_object base;
6 dma_addr_t paddr; 6 dma_addr_t paddr;
7 struct sg_table *sgt;
8
9 /* For objects with DMA memory allocated by GEM CMA */
7 void *vaddr; 10 void *vaddr;
8}; 11};
9 12
@@ -45,4 +48,13 @@ extern const struct vm_operations_struct drm_gem_cma_vm_ops;
45void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m); 48void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m);
46#endif 49#endif
47 50
51struct sg_table *drm_gem_cma_prime_get_sg_table(struct drm_gem_object *obj);
52struct drm_gem_object *
53drm_gem_cma_prime_import_sg_table(struct drm_device *dev, size_t size,
54 struct sg_table *sgt);
55int drm_gem_cma_prime_mmap(struct drm_gem_object *obj,
56 struct vm_area_struct *vma);
57void *drm_gem_cma_prime_vmap(struct drm_gem_object *obj);
58void drm_gem_cma_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
59
48#endif /* __DRM_GEM_CMA_HELPER_H__ */ 60#endif /* __DRM_GEM_CMA_HELPER_H__ */
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index 88591ef8fa24..4d06edb56d5f 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -177,17 +177,6 @@ static inline struct drm_mm_node *drm_mm_get_block_range(
177 return drm_mm_get_block_range_generic(parent, size, alignment, 0, 177 return drm_mm_get_block_range_generic(parent, size, alignment, 0,
178 start, end, 0); 178 start, end, 0);
179} 179}
180static inline struct drm_mm_node *drm_mm_get_color_block_range(
181 struct drm_mm_node *parent,
182 unsigned long size,
183 unsigned alignment,
184 unsigned long color,
185 unsigned long start,
186 unsigned long end)
187{
188 return drm_mm_get_block_range_generic(parent, size, alignment, color,
189 start, end, 0);
190}
191static inline struct drm_mm_node *drm_mm_get_block_atomic_range( 180static inline struct drm_mm_node *drm_mm_get_block_atomic_range(
192 struct drm_mm_node *parent, 181 struct drm_mm_node *parent,
193 unsigned long size, 182 unsigned long size,
@@ -255,29 +244,10 @@ static inline struct drm_mm_node *drm_mm_search_free_in_range(
255 return drm_mm_search_free_in_range_generic(mm, size, alignment, 0, 244 return drm_mm_search_free_in_range_generic(mm, size, alignment, 0,
256 start, end, best_match); 245 start, end, best_match);
257} 246}
258static inline struct drm_mm_node *drm_mm_search_free_color(const struct drm_mm *mm, 247
259 unsigned long size, 248extern void drm_mm_init(struct drm_mm *mm,
260 unsigned alignment, 249 unsigned long start,
261 unsigned long color, 250 unsigned long size);
262 bool best_match)
263{
264 return drm_mm_search_free_generic(mm,size, alignment, color, best_match);
265}
266static inline struct drm_mm_node *drm_mm_search_free_in_range_color(
267 const struct drm_mm *mm,
268 unsigned long size,
269 unsigned alignment,
270 unsigned long color,
271 unsigned long start,
272 unsigned long end,
273 bool best_match)
274{
275 return drm_mm_search_free_in_range_generic(mm, size, alignment, color,
276 start, end, best_match);
277}
278extern int drm_mm_init(struct drm_mm *mm,
279 unsigned long start,
280 unsigned long size);
281extern void drm_mm_takedown(struct drm_mm *mm); 251extern void drm_mm_takedown(struct drm_mm *mm);
282extern int drm_mm_clean(struct drm_mm *mm); 252extern int drm_mm_clean(struct drm_mm *mm);
283extern int drm_mm_pre_get(struct drm_mm *mm); 253extern int drm_mm_pre_get(struct drm_mm *mm);
diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h
index 675ddf4b441f..815fafc6b4ad 100644
--- a/include/drm/drm_os_linux.h
+++ b/include/drm/drm_os_linux.h
@@ -65,22 +65,6 @@ struct no_agp_kern {
65#define DRM_AGP_KERN struct no_agp_kern 65#define DRM_AGP_KERN struct no_agp_kern
66#endif 66#endif
67 67
68#if !(__OS_HAS_MTRR)
69static __inline__ int mtrr_add(unsigned long base, unsigned long size,
70 unsigned int type, char increment)
71{
72 return -ENODEV;
73}
74
75static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size)
76{
77 return -ENODEV;
78}
79
80#define MTRR_TYPE_WRCOMB 1
81
82#endif
83
84/** Other copying of data to kernel space */ 68/** Other copying of data to kernel space */
85#define DRM_COPY_FROM_USER(arg1, arg2, arg3) \ 69#define DRM_COPY_FROM_USER(arg1, arg2, arg3) \
86 copy_from_user(arg1, arg2, arg3) 70 copy_from_user(arg1, arg2, arg3)
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index bb1bc485390b..34efaf64cc87 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -152,6 +152,14 @@
152 {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 152 {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
153 {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 153 {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
154 {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ 154 {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
155 {0x1002, 0x6640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
156 {0x1002, 0x6641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
157 {0x1002, 0x6649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
158 {0x1002, 0x6650, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
159 {0x1002, 0x6651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
160 {0x1002, 0x6658, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
161 {0x1002, 0x665c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
162 {0x1002, 0x665d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
155 {0x1002, 0x6660, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 163 {0x1002, 0x6660, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
156 {0x1002, 0x6663, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 164 {0x1002, 0x6663, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
157 {0x1002, 0x6664, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 165 {0x1002, 0x6664, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -580,6 +588,22 @@
580 {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 588 {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
581 {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 589 {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
582 {0x1002, 0x980A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 590 {0x1002, 0x980A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
591 {0x1002, 0x9830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
592 {0x1002, 0x9831, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
593 {0x1002, 0x9832, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
594 {0x1002, 0x9833, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
595 {0x1002, 0x9834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
596 {0x1002, 0x9835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
597 {0x1002, 0x9836, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
598 {0x1002, 0x9837, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
599 {0x1002, 0x9838, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
600 {0x1002, 0x9839, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
601 {0x1002, 0x983a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
602 {0x1002, 0x983b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
603 {0x1002, 0x983c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
604 {0x1002, 0x983d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
605 {0x1002, 0x983e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
606 {0x1002, 0x983f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KABINI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
583 {0x1002, 0x9900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 607 {0x1002, 0x9900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
584 {0x1002, 0x9901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 608 {0x1002, 0x9901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
585 {0x1002, 0x9903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 609 {0x1002, 0x9903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
new file mode 100644
index 000000000000..d1286297567b
--- /dev/null
+++ b/include/drm/drm_rect.h
@@ -0,0 +1,167 @@
1/*
2 * Copyright (C) 2011-2013 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 */
23
24#ifndef DRM_RECT_H
25#define DRM_RECT_H
26
27/**
28 * DOC: rect utils
29 *
30 * Utility functions to help manage rectangular areas for
31 * clipping, scaling, etc. calculations.
32 */
33
34/**
35 * struct drm_rect - two dimensional rectangle
36 * @x1: horizontal starting coordinate (inclusive)
37 * @x2: horizontal ending coordinate (exclusive)
38 * @y1: vertical starting coordinate (inclusive)
39 * @y2: vertical ending coordinate (exclusive)
40 */
41struct drm_rect {
42 int x1, y1, x2, y2;
43};
44
45/**
46 * drm_rect_adjust_size - adjust the size of the rectangle
47 * @r: rectangle to be adjusted
48 * @dw: horizontal adjustment
49 * @dh: vertical adjustment
50 *
51 * Change the size of rectangle @r by @dw in the horizontal direction,
52 * and by @dh in the vertical direction, while keeping the center
53 * of @r stationary.
54 *
55 * Positive @dw and @dh increase the size, negative values decrease it.
56 */
57static inline void drm_rect_adjust_size(struct drm_rect *r, int dw, int dh)
58{
59 r->x1 -= dw >> 1;
60 r->y1 -= dh >> 1;
61 r->x2 += (dw + 1) >> 1;
62 r->y2 += (dh + 1) >> 1;
63}
64
65/**
66 * drm_rect_translate - translate the rectangle
67 * @r: rectangle to be tranlated
68 * @dx: horizontal translation
69 * @dy: vertical translation
70 *
71 * Move rectangle @r by @dx in the horizontal direction,
72 * and by @dy in the vertical direction.
73 */
74static inline void drm_rect_translate(struct drm_rect *r, int dx, int dy)
75{
76 r->x1 += dx;
77 r->y1 += dy;
78 r->x2 += dx;
79 r->y2 += dy;
80}
81
82/**
83 * drm_rect_downscale - downscale a rectangle
84 * @r: rectangle to be downscaled
85 * @horz: horizontal downscale factor
86 * @vert: vertical downscale factor
87 *
88 * Divide the coordinates of rectangle @r by @horz and @vert.
89 */
90static inline void drm_rect_downscale(struct drm_rect *r, int horz, int vert)
91{
92 r->x1 /= horz;
93 r->y1 /= vert;
94 r->x2 /= horz;
95 r->y2 /= vert;
96}
97
98/**
99 * drm_rect_width - determine the rectangle width
100 * @r: rectangle whose width is returned
101 *
102 * RETURNS:
103 * The width of the rectangle.
104 */
105static inline int drm_rect_width(const struct drm_rect *r)
106{
107 return r->x2 - r->x1;
108}
109
110/**
111 * drm_rect_height - determine the rectangle height
112 * @r: rectangle whose height is returned
113 *
114 * RETURNS:
115 * The height of the rectangle.
116 */
117static inline int drm_rect_height(const struct drm_rect *r)
118{
119 return r->y2 - r->y1;
120}
121
122/**
123 * drm_rect_visible - determine if the the rectangle is visible
124 * @r: rectangle whose visibility is returned
125 *
126 * RETURNS:
127 * %true if the rectangle is visible, %false otherwise.
128 */
129static inline bool drm_rect_visible(const struct drm_rect *r)
130{
131 return drm_rect_width(r) > 0 && drm_rect_height(r) > 0;
132}
133
134/**
135 * drm_rect_equals - determine if two rectangles are equal
136 * @r1: first rectangle
137 * @r2: second rectangle
138 *
139 * RETURNS:
140 * %true if the rectangles are equal, %false otherwise.
141 */
142static inline bool drm_rect_equals(const struct drm_rect *r1,
143 const struct drm_rect *r2)
144{
145 return r1->x1 == r2->x1 && r1->x2 == r2->x2 &&
146 r1->y1 == r2->y1 && r1->y2 == r2->y2;
147}
148
149bool drm_rect_intersect(struct drm_rect *r, const struct drm_rect *clip);
150bool drm_rect_clip_scaled(struct drm_rect *src, struct drm_rect *dst,
151 const struct drm_rect *clip,
152 int hscale, int vscale);
153int drm_rect_calc_hscale(const struct drm_rect *src,
154 const struct drm_rect *dst,
155 int min_hscale, int max_hscale);
156int drm_rect_calc_vscale(const struct drm_rect *src,
157 const struct drm_rect *dst,
158 int min_vscale, int max_vscale);
159int drm_rect_calc_hscale_relaxed(struct drm_rect *src,
160 struct drm_rect *dst,
161 int min_hscale, int max_hscale);
162int drm_rect_calc_vscale_relaxed(struct drm_rect *src,
163 struct drm_rect *dst,
164 int min_vscale, int max_vscale);
165void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point);
166
167#endif
diff --git a/include/drm/i915_powerwell.h b/include/drm/i915_powerwell.h
new file mode 100644
index 000000000000..cfdc884405b7
--- /dev/null
+++ b/include/drm/i915_powerwell.h
@@ -0,0 +1,36 @@
1/**************************************************************************
2 *
3 * Copyright 2013 Intel Inc.
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#ifndef _I915_POWERWELL_H_
30#define _I915_POWERWELL_H_
31
32/* For use by hda_i915 driver */
33extern void i915_request_power_well(void);
34extern void i915_release_power_well(void);
35
36#endif /* _I915_POWERWELL_H_ */
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 3cb5d848fb66..8a6aa56ece52 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -39,6 +39,7 @@
39#include <linux/mm.h> 39#include <linux/mm.h>
40#include <linux/rbtree.h> 40#include <linux/rbtree.h>
41#include <linux/bitmap.h> 41#include <linux/bitmap.h>
42#include <linux/reservation.h>
42 43
43struct ttm_bo_device; 44struct ttm_bo_device;
44 45
@@ -153,7 +154,6 @@ struct ttm_tt;
153 * Lru lists may keep one refcount, the delayed delete list, and kref != 0 154 * Lru lists may keep one refcount, the delayed delete list, and kref != 0
154 * keeps one refcount. When this refcount reaches zero, 155 * keeps one refcount. When this refcount reaches zero,
155 * the object is destroyed. 156 * the object is destroyed.
156 * @event_queue: Queue for processes waiting on buffer object status change.
157 * @mem: structure describing current placement. 157 * @mem: structure describing current placement.
158 * @persistent_swap_storage: Usually the swap storage is deleted for buffers 158 * @persistent_swap_storage: Usually the swap storage is deleted for buffers
159 * pinned in physical memory. If this behaviour is not desired, this member 159 * pinned in physical memory. If this behaviour is not desired, this member
@@ -164,12 +164,6 @@ struct ttm_tt;
164 * @lru: List head for the lru list. 164 * @lru: List head for the lru list.
165 * @ddestroy: List head for the delayed destroy list. 165 * @ddestroy: List head for the delayed destroy list.
166 * @swap: List head for swap LRU list. 166 * @swap: List head for swap LRU list.
167 * @val_seq: Sequence of the validation holding the @reserved lock.
168 * Used to avoid starvation when many processes compete to validate the
169 * buffer. This member is protected by the bo_device::lru_lock.
170 * @seq_valid: The value of @val_seq is valid. This value is protected by
171 * the bo_device::lru_lock.
172 * @reserved: Deadlock-free lock used for synchronization state transitions.
173 * @sync_obj: Pointer to a synchronization object. 167 * @sync_obj: Pointer to a synchronization object.
174 * @priv_flags: Flags describing buffer object internal state. 168 * @priv_flags: Flags describing buffer object internal state.
175 * @vm_rb: Rb node for the vm rb tree. 169 * @vm_rb: Rb node for the vm rb tree.
@@ -209,10 +203,9 @@ struct ttm_buffer_object {
209 203
210 struct kref kref; 204 struct kref kref;
211 struct kref list_kref; 205 struct kref list_kref;
212 wait_queue_head_t event_queue;
213 206
214 /** 207 /**
215 * Members protected by the bo::reserved lock. 208 * Members protected by the bo::resv::reserved lock.
216 */ 209 */
217 210
218 struct ttm_mem_reg mem; 211 struct ttm_mem_reg mem;
@@ -234,15 +227,6 @@ struct ttm_buffer_object {
234 struct list_head ddestroy; 227 struct list_head ddestroy;
235 struct list_head swap; 228 struct list_head swap;
236 struct list_head io_reserve_lru; 229 struct list_head io_reserve_lru;
237 uint32_t val_seq;
238 bool seq_valid;
239
240 /**
241 * Members protected by the bdev::lru_lock
242 * only when written to.
243 */
244
245 atomic_t reserved;
246 230
247 /** 231 /**
248 * Members protected by struct buffer_object_device::fence_lock 232 * Members protected by struct buffer_object_device::fence_lock
@@ -272,6 +256,9 @@ struct ttm_buffer_object {
272 uint32_t cur_placement; 256 uint32_t cur_placement;
273 257
274 struct sg_table *sg; 258 struct sg_table *sg;
259
260 struct reservation_object *resv;
261 struct reservation_object ttm_resv;
275}; 262};
276 263
277/** 264/**
@@ -725,18 +712,4 @@ extern ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
725 712
726extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev); 713extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
727 714
728/**
729 * ttm_bo_is_reserved - return an indication if a ttm buffer object is reserved
730 *
731 * @bo: The buffer object to check.
732 *
733 * This function returns an indication if a bo is reserved or not, and should
734 * only be used to print an error when it is not from incorrect api usage, since
735 * there's no guarantee that it is the caller that is holding the reservation.
736 */
737static inline bool ttm_bo_is_reserved(struct ttm_buffer_object *bo)
738{
739 return atomic_read(&bo->reserved);
740}
741
742#endif 715#endif
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 9c8dca79808e..984fc2d571a1 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -33,11 +33,13 @@
33#include <ttm/ttm_bo_api.h> 33#include <ttm/ttm_bo_api.h>
34#include <ttm/ttm_memory.h> 34#include <ttm/ttm_memory.h>
35#include <ttm/ttm_module.h> 35#include <ttm/ttm_module.h>
36#include <ttm/ttm_placement.h>
36#include <drm/drm_mm.h> 37#include <drm/drm_mm.h>
37#include <drm/drm_global.h> 38#include <drm/drm_global.h>
38#include <linux/workqueue.h> 39#include <linux/workqueue.h>
39#include <linux/fs.h> 40#include <linux/fs.h>
40#include <linux/spinlock.h> 41#include <linux/spinlock.h>
42#include <linux/reservation.h>
41 43
42struct ttm_backend_func { 44struct ttm_backend_func {
43 /** 45 /**
@@ -771,6 +773,55 @@ extern int ttm_mem_io_lock(struct ttm_mem_type_manager *man,
771 bool interruptible); 773 bool interruptible);
772extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man); 774extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man);
773 775
776extern void ttm_bo_del_sub_from_lru(struct ttm_buffer_object *bo);
777extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo);
778
779/**
780 * ttm_bo_reserve_nolru:
781 *
782 * @bo: A pointer to a struct ttm_buffer_object.
783 * @interruptible: Sleep interruptible if waiting.
784 * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY.
785 * @use_ticket: If @bo is already reserved, Only sleep waiting for
786 * it to become unreserved if @ticket->stamp is older.
787 *
788 * Will not remove reserved buffers from the lru lists.
789 * Otherwise identical to ttm_bo_reserve.
790 *
791 * Returns:
792 * -EDEADLK: The reservation may cause a deadlock.
793 * Release all buffer reservations, wait for @bo to become unreserved and
794 * try again. (only if use_sequence == 1).
795 * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by
796 * a signal. Release all buffer reservations and return to user-space.
797 * -EBUSY: The function needed to sleep, but @no_wait was true
798 * -EALREADY: Bo already reserved using @ticket. This error code will only
799 * be returned if @use_ticket is set to true.
800 */
801static inline int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo,
802 bool interruptible,
803 bool no_wait, bool use_ticket,
804 struct ww_acquire_ctx *ticket)
805{
806 int ret = 0;
807
808 if (no_wait) {
809 bool success;
810 if (WARN_ON(ticket))
811 return -EBUSY;
812
813 success = ww_mutex_trylock(&bo->resv->lock);
814 return success ? 0 : -EBUSY;
815 }
816
817 if (interruptible)
818 ret = ww_mutex_lock_interruptible(&bo->resv->lock, ticket);
819 else
820 ret = ww_mutex_lock(&bo->resv->lock, ticket);
821 if (ret == -EINTR)
822 return -ERESTARTSYS;
823 return ret;
824}
774 825
775/** 826/**
776 * ttm_bo_reserve: 827 * ttm_bo_reserve:
@@ -778,8 +829,8 @@ extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man);
778 * @bo: A pointer to a struct ttm_buffer_object. 829 * @bo: A pointer to a struct ttm_buffer_object.
779 * @interruptible: Sleep interruptible if waiting. 830 * @interruptible: Sleep interruptible if waiting.
780 * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY. 831 * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY.
781 * @use_sequence: If @bo is already reserved, Only sleep waiting for 832 * @use_ticket: If @bo is already reserved, Only sleep waiting for
782 * it to become unreserved if @sequence < (@bo)->sequence. 833 * it to become unreserved if @ticket->stamp is older.
783 * 834 *
784 * Locks a buffer object for validation. (Or prevents other processes from 835 * Locks a buffer object for validation. (Or prevents other processes from
785 * locking it for validation) and removes it from lru lists, while taking 836 * locking it for validation) and removes it from lru lists, while taking
@@ -793,7 +844,7 @@ extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man);
793 * Processes attempting to reserve multiple buffers other than for eviction, 844 * Processes attempting to reserve multiple buffers other than for eviction,
794 * (typically execbuf), should first obtain a unique 32-bit 845 * (typically execbuf), should first obtain a unique 32-bit
795 * validation sequence number, 846 * validation sequence number,
796 * and call this function with @use_sequence == 1 and @sequence == the unique 847 * and call this function with @use_ticket == 1 and @ticket->stamp == the unique
797 * sequence number. If upon call of this function, the buffer object is already 848 * sequence number. If upon call of this function, the buffer object is already
798 * reserved, the validation sequence is checked against the validation 849 * reserved, the validation sequence is checked against the validation
799 * sequence of the process currently reserving the buffer, 850 * sequence of the process currently reserving the buffer,
@@ -808,36 +859,31 @@ extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man);
808 * will eventually succeed, preventing both deadlocks and starvation. 859 * will eventually succeed, preventing both deadlocks and starvation.
809 * 860 *
810 * Returns: 861 * Returns:
811 * -EAGAIN: The reservation may cause a deadlock. 862 * -EDEADLK: The reservation may cause a deadlock.
812 * Release all buffer reservations, wait for @bo to become unreserved and 863 * Release all buffer reservations, wait for @bo to become unreserved and
813 * try again. (only if use_sequence == 1). 864 * try again. (only if use_sequence == 1).
814 * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by 865 * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by
815 * a signal. Release all buffer reservations and return to user-space. 866 * a signal. Release all buffer reservations and return to user-space.
816 * -EBUSY: The function needed to sleep, but @no_wait was true 867 * -EBUSY: The function needed to sleep, but @no_wait was true
817 * -EDEADLK: Bo already reserved using @sequence. This error code will only 868 * -EALREADY: Bo already reserved using @ticket. This error code will only
818 * be returned if @use_sequence is set to true. 869 * be returned if @use_ticket is set to true.
819 */ 870 */
820extern int ttm_bo_reserve(struct ttm_buffer_object *bo, 871static inline int ttm_bo_reserve(struct ttm_buffer_object *bo,
821 bool interruptible, 872 bool interruptible,
822 bool no_wait, bool use_sequence, uint32_t sequence); 873 bool no_wait, bool use_ticket,
874 struct ww_acquire_ctx *ticket)
875{
876 int ret;
823 877
824/** 878 WARN_ON(!atomic_read(&bo->kref.refcount));
825 * ttm_bo_reserve_slowpath_nolru:
826 * @bo: A pointer to a struct ttm_buffer_object.
827 * @interruptible: Sleep interruptible if waiting.
828 * @sequence: Set (@bo)->sequence to this value after lock
829 *
830 * This is called after ttm_bo_reserve returns -EAGAIN and we backed off
831 * from all our other reservations. Because there are no other reservations
832 * held by us, this function cannot deadlock any more.
833 *
834 * Will not remove reserved buffers from the lru lists.
835 * Otherwise identical to ttm_bo_reserve_slowpath.
836 */
837extern int ttm_bo_reserve_slowpath_nolru(struct ttm_buffer_object *bo,
838 bool interruptible,
839 uint32_t sequence);
840 879
880 ret = ttm_bo_reserve_nolru(bo, interruptible, no_wait, use_ticket,
881 ticket);
882 if (likely(ret == 0))
883 ttm_bo_del_sub_from_lru(bo);
884
885 return ret;
886}
841 887
842/** 888/**
843 * ttm_bo_reserve_slowpath: 889 * ttm_bo_reserve_slowpath:
@@ -849,54 +895,57 @@ extern int ttm_bo_reserve_slowpath_nolru(struct ttm_buffer_object *bo,
849 * from all our other reservations. Because there are no other reservations 895 * from all our other reservations. Because there are no other reservations
850 * held by us, this function cannot deadlock any more. 896 * held by us, this function cannot deadlock any more.
851 */ 897 */
852extern int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo, 898static inline int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo,
853 bool interruptible, uint32_t sequence); 899 bool interruptible,
900 struct ww_acquire_ctx *ticket)
901{
902 int ret = 0;
854 903
855/** 904 WARN_ON(!atomic_read(&bo->kref.refcount));
856 * ttm_bo_reserve_nolru: 905
857 * 906 if (interruptible)
858 * @bo: A pointer to a struct ttm_buffer_object. 907 ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock,
859 * @interruptible: Sleep interruptible if waiting. 908 ticket);
860 * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY. 909 else
861 * @use_sequence: If @bo is already reserved, Only sleep waiting for 910 ww_mutex_lock_slow(&bo->resv->lock, ticket);
862 * it to become unreserved if @sequence < (@bo)->sequence. 911
863 * 912 if (likely(ret == 0))
864 * Will not remove reserved buffers from the lru lists. 913 ttm_bo_del_sub_from_lru(bo);
865 * Otherwise identical to ttm_bo_reserve. 914 else if (ret == -EINTR)
866 * 915 ret = -ERESTARTSYS;
867 * Returns: 916
868 * -EAGAIN: The reservation may cause a deadlock. 917 return ret;
869 * Release all buffer reservations, wait for @bo to become unreserved and 918}
870 * try again. (only if use_sequence == 1).
871 * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by
872 * a signal. Release all buffer reservations and return to user-space.
873 * -EBUSY: The function needed to sleep, but @no_wait was true
874 * -EDEADLK: Bo already reserved using @sequence. This error code will only
875 * be returned if @use_sequence is set to true.
876 */
877extern int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo,
878 bool interruptible,
879 bool no_wait, bool use_sequence,
880 uint32_t sequence);
881 919
882/** 920/**
883 * ttm_bo_unreserve 921 * ttm_bo_unreserve_ticket
884 *
885 * @bo: A pointer to a struct ttm_buffer_object. 922 * @bo: A pointer to a struct ttm_buffer_object.
923 * @ticket: ww_acquire_ctx used for reserving
886 * 924 *
887 * Unreserve a previous reservation of @bo. 925 * Unreserve a previous reservation of @bo made with @ticket.
888 */ 926 */
889extern void ttm_bo_unreserve(struct ttm_buffer_object *bo); 927static inline void ttm_bo_unreserve_ticket(struct ttm_buffer_object *bo,
928 struct ww_acquire_ctx *t)
929{
930 if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) {
931 spin_lock(&bo->glob->lru_lock);
932 ttm_bo_add_to_lru(bo);
933 spin_unlock(&bo->glob->lru_lock);
934 }
935 ww_mutex_unlock(&bo->resv->lock);
936}
890 937
891/** 938/**
892 * ttm_bo_unreserve_locked 939 * ttm_bo_unreserve
893 * 940 *
894 * @bo: A pointer to a struct ttm_buffer_object. 941 * @bo: A pointer to a struct ttm_buffer_object.
895 * 942 *
896 * Unreserve a previous reservation of @bo. 943 * Unreserve a previous reservation of @bo.
897 * Needs to be called with struct ttm_bo_global::lru_lock held.
898 */ 944 */
899extern void ttm_bo_unreserve_locked(struct ttm_buffer_object *bo); 945static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo)
946{
947 ttm_bo_unreserve_ticket(bo, NULL);
948}
900 949
901/* 950/*
902 * ttm_bo_util.c 951 * ttm_bo_util.c
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h
index 547e19f06e57..ec8a1d306510 100644
--- a/include/drm/ttm/ttm_execbuf_util.h
+++ b/include/drm/ttm/ttm_execbuf_util.h
@@ -57,17 +57,20 @@ struct ttm_validate_buffer {
57/** 57/**
58 * function ttm_eu_backoff_reservation 58 * function ttm_eu_backoff_reservation
59 * 59 *
60 * @ticket: ww_acquire_ctx from reserve call
60 * @list: thread private list of ttm_validate_buffer structs. 61 * @list: thread private list of ttm_validate_buffer structs.
61 * 62 *
62 * Undoes all buffer validation reservations for bos pointed to by 63 * Undoes all buffer validation reservations for bos pointed to by
63 * the list entries. 64 * the list entries.
64 */ 65 */
65 66
66extern void ttm_eu_backoff_reservation(struct list_head *list); 67extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
68 struct list_head *list);
67 69
68/** 70/**
69 * function ttm_eu_reserve_buffers 71 * function ttm_eu_reserve_buffers
70 * 72 *
73 * @ticket: [out] ww_acquire_ctx returned by call.
71 * @list: thread private list of ttm_validate_buffer structs. 74 * @list: thread private list of ttm_validate_buffer structs.
72 * 75 *
73 * Tries to reserve bos pointed to by the list entries for validation. 76 * Tries to reserve bos pointed to by the list entries for validation.
@@ -90,11 +93,13 @@ extern void ttm_eu_backoff_reservation(struct list_head *list);
90 * has failed. 93 * has failed.
91 */ 94 */
92 95
93extern int ttm_eu_reserve_buffers(struct list_head *list); 96extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
97 struct list_head *list);
94 98
95/** 99/**
96 * function ttm_eu_fence_buffer_objects. 100 * function ttm_eu_fence_buffer_objects.
97 * 101 *
102 * @ticket: ww_acquire_ctx from reserve call
98 * @list: thread private list of ttm_validate_buffer structs. 103 * @list: thread private list of ttm_validate_buffer structs.
99 * @sync_obj: The new sync object for the buffers. 104 * @sync_obj: The new sync object for the buffers.
100 * 105 *
@@ -104,6 +109,7 @@ extern int ttm_eu_reserve_buffers(struct list_head *list);
104 * 109 *
105 */ 110 */
106 111
107extern void ttm_eu_fence_buffer_objects(struct list_head *list, void *sync_obj); 112extern void ttm_eu_fence_buffer_objects(struct ww_acquire_ctx *ticket,
113 struct list_head *list, void *sync_obj);
108 114
109#endif 115#endif
diff --git a/include/dt-bindings/clk/exynos-audss-clk.h b/include/dt-bindings/clk/exynos-audss-clk.h
new file mode 100644
index 000000000000..8279f427c60f
--- /dev/null
+++ b/include/dt-bindings/clk/exynos-audss-clk.h
@@ -0,0 +1,25 @@
1/*
2 * This header provides constants for Samsung audio subsystem
3 * clock controller.
4 *
5 * The constants defined in this header are being used in dts
6 * and exynos audss driver.
7 */
8
9#ifndef _DT_BINDINGS_CLK_EXYNOS_AUDSS_H
10#define _DT_BINDINGS_CLK_EXYNOS_AUDSS_H
11
12#define EXYNOS_MOUT_AUDSS 0
13#define EXYNOS_MOUT_I2S 1
14#define EXYNOS_DOUT_SRP 2
15#define EXYNOS_DOUT_AUD_BUS 3
16#define EXYNOS_DOUT_I2S 4
17#define EXYNOS_SRP_CLK 5
18#define EXYNOS_I2S_BUS 6
19#define EXYNOS_SCLK_I2S 7
20#define EXYNOS_PCM_BUS 8
21#define EXYNOS_SCLK_PCM 9
22
23#define EXYNOS_AUDSS_MAX_CLKS 10
24
25#endif
diff --git a/include/dt-bindings/clock/imx6sl-clock.h b/include/dt-bindings/clock/imx6sl-clock.h
new file mode 100644
index 000000000000..7fcdf90879f2
--- /dev/null
+++ b/include/dt-bindings/clock/imx6sl-clock.h
@@ -0,0 +1,148 @@
1/*
2 * Copyright 2013 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
10#ifndef __DT_BINDINGS_CLOCK_IMX6SL_H
11#define __DT_BINDINGS_CLOCK_IMX6SL_H
12
13#define IMX6SL_CLK_DUMMY 0
14#define IMX6SL_CLK_CKIL 1
15#define IMX6SL_CLK_OSC 2
16#define IMX6SL_CLK_PLL1_SYS 3
17#define IMX6SL_CLK_PLL2_BUS 4
18#define IMX6SL_CLK_PLL3_USB_OTG 5
19#define IMX6SL_CLK_PLL4_AUDIO 6
20#define IMX6SL_CLK_PLL5_VIDEO 7
21#define IMX6SL_CLK_PLL6_ENET 8
22#define IMX6SL_CLK_PLL7_USB_HOST 9
23#define IMX6SL_CLK_USBPHY1 10
24#define IMX6SL_CLK_USBPHY2 11
25#define IMX6SL_CLK_USBPHY1_GATE 12
26#define IMX6SL_CLK_USBPHY2_GATE 13
27#define IMX6SL_CLK_PLL4_POST_DIV 14
28#define IMX6SL_CLK_PLL5_POST_DIV 15
29#define IMX6SL_CLK_PLL5_VIDEO_DIV 16
30#define IMX6SL_CLK_ENET_REF 17
31#define IMX6SL_CLK_PLL2_PFD0 18
32#define IMX6SL_CLK_PLL2_PFD1 19
33#define IMX6SL_CLK_PLL2_PFD2 20
34#define IMX6SL_CLK_PLL3_PFD0 21
35#define IMX6SL_CLK_PLL3_PFD1 22
36#define IMX6SL_CLK_PLL3_PFD2 23
37#define IMX6SL_CLK_PLL3_PFD3 24
38#define IMX6SL_CLK_PLL2_198M 25
39#define IMX6SL_CLK_PLL3_120M 26
40#define IMX6SL_CLK_PLL3_80M 27
41#define IMX6SL_CLK_PLL3_60M 28
42#define IMX6SL_CLK_STEP 29
43#define IMX6SL_CLK_PLL1_SW 30
44#define IMX6SL_CLK_OCRAM_ALT_SEL 31
45#define IMX6SL_CLK_OCRAM_SEL 32
46#define IMX6SL_CLK_PRE_PERIPH2_SEL 33
47#define IMX6SL_CLK_PRE_PERIPH_SEL 34
48#define IMX6SL_CLK_PERIPH2_CLK2_SEL 35
49#define IMX6SL_CLK_PERIPH_CLK2_SEL 36
50#define IMX6SL_CLK_CSI_SEL 37
51#define IMX6SL_CLK_LCDIF_AXI_SEL 38
52#define IMX6SL_CLK_USDHC1_SEL 39
53#define IMX6SL_CLK_USDHC2_SEL 40
54#define IMX6SL_CLK_USDHC3_SEL 41
55#define IMX6SL_CLK_USDHC4_SEL 42
56#define IMX6SL_CLK_SSI1_SEL 43
57#define IMX6SL_CLK_SSI2_SEL 44
58#define IMX6SL_CLK_SSI3_SEL 45
59#define IMX6SL_CLK_PERCLK_SEL 46
60#define IMX6SL_CLK_PXP_AXI_SEL 47
61#define IMX6SL_CLK_EPDC_AXI_SEL 48
62#define IMX6SL_CLK_GPU2D_OVG_SEL 49
63#define IMX6SL_CLK_GPU2D_SEL 50
64#define IMX6SL_CLK_LCDIF_PIX_SEL 51
65#define IMX6SL_CLK_EPDC_PIX_SEL 52
66#define IMX6SL_CLK_SPDIF0_SEL 53
67#define IMX6SL_CLK_SPDIF1_SEL 54
68#define IMX6SL_CLK_EXTERN_AUDIO_SEL 55
69#define IMX6SL_CLK_ECSPI_SEL 56
70#define IMX6SL_CLK_UART_SEL 57
71#define IMX6SL_CLK_PERIPH 58
72#define IMX6SL_CLK_PERIPH2 59
73#define IMX6SL_CLK_OCRAM_PODF 60
74#define IMX6SL_CLK_PERIPH_CLK2_PODF 61
75#define IMX6SL_CLK_PERIPH2_CLK2_PODF 62
76#define IMX6SL_CLK_IPG 63
77#define IMX6SL_CLK_CSI_PODF 64
78#define IMX6SL_CLK_LCDIF_AXI_PODF 65
79#define IMX6SL_CLK_USDHC1_PODF 66
80#define IMX6SL_CLK_USDHC2_PODF 67
81#define IMX6SL_CLK_USDHC3_PODF 68
82#define IMX6SL_CLK_USDHC4_PODF 69
83#define IMX6SL_CLK_SSI1_PRED 70
84#define IMX6SL_CLK_SSI1_PODF 71
85#define IMX6SL_CLK_SSI2_PRED 72
86#define IMX6SL_CLK_SSI2_PODF 73
87#define IMX6SL_CLK_SSI3_PRED 74
88#define IMX6SL_CLK_SSI3_PODF 75
89#define IMX6SL_CLK_PERCLK 76
90#define IMX6SL_CLK_PXP_AXI_PODF 77
91#define IMX6SL_CLK_EPDC_AXI_PODF 78
92#define IMX6SL_CLK_GPU2D_OVG_PODF 79
93#define IMX6SL_CLK_GPU2D_PODF 80
94#define IMX6SL_CLK_LCDIF_PIX_PRED 81
95#define IMX6SL_CLK_EPDC_PIX_PRED 82
96#define IMX6SL_CLK_LCDIF_PIX_PODF 83
97#define IMX6SL_CLK_EPDC_PIX_PODF 84
98#define IMX6SL_CLK_SPDIF0_PRED 85
99#define IMX6SL_CLK_SPDIF0_PODF 86
100#define IMX6SL_CLK_SPDIF1_PRED 87
101#define IMX6SL_CLK_SPDIF1_PODF 88
102#define IMX6SL_CLK_EXTERN_AUDIO_PRED 89
103#define IMX6SL_CLK_EXTERN_AUDIO_PODF 90
104#define IMX6SL_CLK_ECSPI_ROOT 91
105#define IMX6SL_CLK_UART_ROOT 92
106#define IMX6SL_CLK_AHB 93
107#define IMX6SL_CLK_MMDC_ROOT 94
108#define IMX6SL_CLK_ARM 95
109#define IMX6SL_CLK_ECSPI1 96
110#define IMX6SL_CLK_ECSPI2 97
111#define IMX6SL_CLK_ECSPI3 98
112#define IMX6SL_CLK_ECSPI4 99
113#define IMX6SL_CLK_EPIT1 100
114#define IMX6SL_CLK_EPIT2 101
115#define IMX6SL_CLK_EXTERN_AUDIO 102
116#define IMX6SL_CLK_GPT 103
117#define IMX6SL_CLK_GPT_SERIAL 104
118#define IMX6SL_CLK_GPU2D_OVG 105
119#define IMX6SL_CLK_I2C1 106
120#define IMX6SL_CLK_I2C2 107
121#define IMX6SL_CLK_I2C3 108
122#define IMX6SL_CLK_OCOTP 109
123#define IMX6SL_CLK_CSI 110
124#define IMX6SL_CLK_PXP_AXI 111
125#define IMX6SL_CLK_EPDC_AXI 112
126#define IMX6SL_CLK_LCDIF_AXI 113
127#define IMX6SL_CLK_LCDIF_PIX 114
128#define IMX6SL_CLK_EPDC_PIX 115
129#define IMX6SL_CLK_OCRAM 116
130#define IMX6SL_CLK_PWM1 117
131#define IMX6SL_CLK_PWM2 118
132#define IMX6SL_CLK_PWM3 119
133#define IMX6SL_CLK_PWM4 120
134#define IMX6SL_CLK_SDMA 121
135#define IMX6SL_CLK_SPDIF 122
136#define IMX6SL_CLK_SSI1 123
137#define IMX6SL_CLK_SSI2 124
138#define IMX6SL_CLK_SSI3 125
139#define IMX6SL_CLK_UART 126
140#define IMX6SL_CLK_UART_SERIAL 127
141#define IMX6SL_CLK_USBOH3 128
142#define IMX6SL_CLK_USDHC1 129
143#define IMX6SL_CLK_USDHC2 130
144#define IMX6SL_CLK_USDHC3 131
145#define IMX6SL_CLK_USDHC4 132
146#define IMX6SL_CLK_CLK_END 133
147
148#endif /* __DT_BINDINGS_CLOCK_IMX6SL_H */
diff --git a/include/dt-bindings/clock/tegra114-car.h b/include/dt-bindings/clock/tegra114-car.h
new file mode 100644
index 000000000000..614aec417902
--- /dev/null
+++ b/include/dt-bindings/clock/tegra114-car.h
@@ -0,0 +1,342 @@
1/*
2 * This header provides constants for binding nvidia,tegra114-car.
3 *
4 * The first 160 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB
5 * registers. These IDs often match those in the CAR's RST_DEVICES registers,
6 * but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In
7 * this case, those clocks are assigned IDs above 160 in order to highlight
8 * this issue. Implementations that interpret these clock IDs as bit values
9 * within the CLK_OUT_ENB or RST_DEVICES registers should be careful to
10 * explicitly handle these special cases.
11 *
12 * The balance of the clocks controlled by the CAR are assigned IDs of 160 and
13 * above.
14 */
15
16#ifndef _DT_BINDINGS_CLOCK_TEGRA114_CAR_H
17#define _DT_BINDINGS_CLOCK_TEGRA114_CAR_H
18
19/* 0 */
20/* 1 */
21/* 2 */
22/* 3 */
23#define TEGRA114_CLK_RTC 4
24#define TEGRA114_CLK_TIMER 5
25#define TEGRA114_CLK_UARTA 6
26/* 7 (register bit affects uartb and vfir) */
27/* 8 */
28#define TEGRA114_CLK_SDMMC2 9
29/* 10 (register bit affects spdif_in and spdif_out) */
30#define TEGRA114_CLK_I2S1 11
31#define TEGRA114_CLK_I2C1 12
32#define TEGRA114_CLK_NDFLASH 13
33#define TEGRA114_CLK_SDMMC1 14
34#define TEGRA114_CLK_SDMMC4 15
35/* 16 */
36#define TEGRA114_CLK_PWM 17
37#define TEGRA114_CLK_I2S2 18
38#define TEGRA114_CLK_EPP 19
39/* 20 (register bit affects vi and vi_sensor) */
40#define TEGRA114_CLK_GR_2D 21
41#define TEGRA114_CLK_USBD 22
42#define TEGRA114_CLK_ISP 23
43#define TEGRA114_CLK_GR_3D 24
44/* 25 */
45#define TEGRA114_CLK_DISP2 26
46#define TEGRA114_CLK_DISP1 27
47#define TEGRA114_CLK_HOST1X 28
48#define TEGRA114_CLK_VCP 29
49#define TEGRA114_CLK_I2S0 30
50/* 31 */
51
52/* 32 */
53/* 33 */
54#define TEGRA114_CLK_APBDMA 34
55/* 35 */
56#define TEGRA114_CLK_KBC 36
57/* 37 */
58/* 38 */
59/* 39 (register bit affects fuse and fuse_burn) */
60#define TEGRA114_CLK_KFUSE 40
61#define TEGRA114_CLK_SBC1 41
62#define TEGRA114_CLK_NOR 42
63/* 43 */
64#define TEGRA114_CLK_SBC2 44
65/* 45 */
66#define TEGRA114_CLK_SBC3 46
67#define TEGRA114_CLK_I2C5 47
68#define TEGRA114_CLK_DSIA 48
69/* 49 */
70#define TEGRA114_CLK_MIPI 50
71#define TEGRA114_CLK_HDMI 51
72#define TEGRA114_CLK_CSI 52
73/* 53 */
74#define TEGRA114_CLK_I2C2 54
75#define TEGRA114_CLK_UARTC 55
76#define TEGRA114_CLK_MIPI_CAL 56
77#define TEGRA114_CLK_EMC 57
78#define TEGRA114_CLK_USB2 58
79#define TEGRA114_CLK_USB3 59
80/* 60 */
81#define TEGRA114_CLK_VDE 61
82#define TEGRA114_CLK_BSEA 62
83#define TEGRA114_CLK_BSEV 63
84
85/* 64 */
86#define TEGRA114_CLK_UARTD 65
87/* 66 */
88#define TEGRA114_CLK_I2C3 67
89#define TEGRA114_CLK_SBC4 68
90#define TEGRA114_CLK_SDMMC3 69
91/* 70 */
92#define TEGRA114_CLK_OWR 71
93/* 72 */
94#define TEGRA114_CLK_CSITE 73
95/* 74 */
96/* 75 */
97#define TEGRA114_CLK_LA 76
98#define TEGRA114_CLK_TRACE 77
99#define TEGRA114_CLK_SOC_THERM 78
100#define TEGRA114_CLK_DTV 79
101#define TEGRA114_CLK_NDSPEED 80
102#define TEGRA114_CLK_I2CSLOW 81
103#define TEGRA114_CLK_DSIB 82
104#define TEGRA114_CLK_TSEC 83
105/* 84 */
106/* 85 */
107/* 86 */
108/* 87 */
109/* 88 */
110#define TEGRA114_CLK_XUSB_HOST 89
111/* 90 */
112#define TEGRA114_CLK_MSENC 91
113#define TEGRA114_CLK_CSUS 92
114/* 93 */
115/* 94 */
116/* 95 (bit affects xusb_dev and xusb_dev_src) */
117
118/* 96 */
119/* 97 */
120/* 98 */
121#define TEGRA114_CLK_MSELECT 99
122#define TEGRA114_CLK_TSENSOR 100
123#define TEGRA114_CLK_I2S3 101
124#define TEGRA114_CLK_I2S4 102
125#define TEGRA114_CLK_I2C4 103
126#define TEGRA114_CLK_SBC5 104
127#define TEGRA114_CLK_SBC6 105
128#define TEGRA114_CLK_D_AUDIO 106
129#define TEGRA114_CLK_APBIF 107
130#define TEGRA114_CLK_DAM0 108
131#define TEGRA114_CLK_DAM1 109
132#define TEGRA114_CLK_DAM2 110
133#define TEGRA114_CLK_HDA2CODEC_2X 111
134/* 112 */
135#define TEGRA114_CLK_AUDIO0_2X 113
136#define TEGRA114_CLK_AUDIO1_2X 114
137#define TEGRA114_CLK_AUDIO2_2X 115
138#define TEGRA114_CLK_AUDIO3_2X 116
139#define TEGRA114_CLK_AUDIO4_2X 117
140#define TEGRA114_CLK_SPDIF_2X 118
141#define TEGRA114_CLK_ACTMON 119
142#define TEGRA114_CLK_EXTERN1 120
143#define TEGRA114_CLK_EXTERN2 121
144#define TEGRA114_CLK_EXTERN3 122
145/* 123 */
146/* 124 */
147#define TEGRA114_CLK_HDA 125
148/* 126 */
149#define TEGRA114_CLK_SE 127
150
151#define TEGRA114_CLK_HDA2HDMI 128
152/* 129 */
153/* 130 */
154/* 131 */
155/* 132 */
156/* 133 */
157/* 134 */
158/* 135 */
159/* 136 */
160/* 137 */
161/* 138 */
162/* 139 */
163/* 140 */
164/* 141 */
165/* 142 */
166/* 143 (bit affects xusb_falcon_src, xusb_fs_src, */
167/* xusb_host_src and xusb_ss_src) */
168#define TEGRA114_CLK_CILAB 144
169#define TEGRA114_CLK_CILCD 145
170#define TEGRA114_CLK_CILE 146
171#define TEGRA114_CLK_DSIALP 147
172#define TEGRA114_CLK_DSIBLP 148
173/* 149 */
174#define TEGRA114_CLK_DDS 150
175/* 151 */
176#define TEGRA114_CLK_DP2 152
177#define TEGRA114_CLK_AMX 153
178#define TEGRA114_CLK_ADX 154
179/* 155 (bit affects dfll_ref and dfll_soc) */
180#define TEGRA114_CLK_XUSB_SS 156
181/* 157 */
182/* 158 */
183/* 159 */
184
185/* 160 */
186/* 161 */
187/* 162 */
188/* 163 */
189/* 164 */
190/* 165 */
191/* 166 */
192/* 167 */
193/* 168 */
194/* 169 */
195/* 170 */
196/* 171 */
197/* 172 */
198/* 173 */
199/* 174 */
200/* 175 */
201/* 176 */
202/* 177 */
203/* 178 */
204/* 179 */
205/* 180 */
206/* 181 */
207/* 182 */
208/* 183 */
209/* 184 */
210/* 185 */
211/* 186 */
212/* 187 */
213/* 188 */
214/* 189 */
215/* 190 */
216/* 191 */
217
218#define TEGRA114_CLK_UARTB 192
219#define TEGRA114_CLK_VFIR 193
220#define TEGRA114_CLK_SPDIF_IN 194
221#define TEGRA114_CLK_SPDIF_OUT 195
222#define TEGRA114_CLK_VI 196
223#define TEGRA114_CLK_VI_SENSOR 197
224#define TEGRA114_CLK_FUSE 198
225#define TEGRA114_CLK_FUSE_BURN 199
226#define TEGRA114_CLK_CLK_32K 200
227#define TEGRA114_CLK_CLK_M 201
228#define TEGRA114_CLK_CLK_M_DIV2 202
229#define TEGRA114_CLK_CLK_M_DIV4 203
230#define TEGRA114_CLK_PLL_REF 204
231#define TEGRA114_CLK_PLL_C 205
232#define TEGRA114_CLK_PLL_C_OUT1 206
233#define TEGRA114_CLK_PLL_C2 207
234#define TEGRA114_CLK_PLL_C3 208
235#define TEGRA114_CLK_PLL_M 209
236#define TEGRA114_CLK_PLL_M_OUT1 210
237#define TEGRA114_CLK_PLL_P 211
238#define TEGRA114_CLK_PLL_P_OUT1 212
239#define TEGRA114_CLK_PLL_P_OUT2 213
240#define TEGRA114_CLK_PLL_P_OUT3 214
241#define TEGRA114_CLK_PLL_P_OUT4 215
242#define TEGRA114_CLK_PLL_A 216
243#define TEGRA114_CLK_PLL_A_OUT0 217
244#define TEGRA114_CLK_PLL_D 218
245#define TEGRA114_CLK_PLL_D_OUT0 219
246#define TEGRA114_CLK_PLL_D2 220
247#define TEGRA114_CLK_PLL_D2_OUT0 221
248#define TEGRA114_CLK_PLL_U 222
249#define TEGRA114_CLK_PLL_U_480M 223
250
251#define TEGRA114_CLK_PLL_U_60M 224
252#define TEGRA114_CLK_PLL_U_48M 225
253#define TEGRA114_CLK_PLL_U_12M 226
254#define TEGRA114_CLK_PLL_X 227
255#define TEGRA114_CLK_PLL_X_OUT0 228
256#define TEGRA114_CLK_PLL_RE_VCO 229
257#define TEGRA114_CLK_PLL_RE_OUT 230
258#define TEGRA114_CLK_PLL_E_OUT0 231
259#define TEGRA114_CLK_SPDIF_IN_SYNC 232
260#define TEGRA114_CLK_I2S0_SYNC 233
261#define TEGRA114_CLK_I2S1_SYNC 234
262#define TEGRA114_CLK_I2S2_SYNC 235
263#define TEGRA114_CLK_I2S3_SYNC 236
264#define TEGRA114_CLK_I2S4_SYNC 237
265#define TEGRA114_CLK_VIMCLK_SYNC 238
266#define TEGRA114_CLK_AUDIO0 239
267#define TEGRA114_CLK_AUDIO1 240
268#define TEGRA114_CLK_AUDIO2 241
269#define TEGRA114_CLK_AUDIO3 242
270#define TEGRA114_CLK_AUDIO4 243
271#define TEGRA114_CLK_SPDIF 244
272#define TEGRA114_CLK_CLK_OUT_1 245
273#define TEGRA114_CLK_CLK_OUT_2 246
274#define TEGRA114_CLK_CLK_OUT_3 247
275#define TEGRA114_CLK_BLINK 248
276/* 249 */
277/* 250 */
278/* 251 */
279#define TEGRA114_CLK_XUSB_HOST_SRC 252
280#define TEGRA114_CLK_XUSB_FALCON_SRC 253
281#define TEGRA114_CLK_XUSB_FS_SRC 254
282#define TEGRA114_CLK_XUSB_SS_SRC 255
283
284#define TEGRA114_CLK_XUSB_DEV_SRC 256
285#define TEGRA114_CLK_XUSB_DEV 257
286#define TEGRA114_CLK_XUSB_HS_SRC 258
287#define TEGRA114_CLK_SCLK 259
288#define TEGRA114_CLK_HCLK 260
289#define TEGRA114_CLK_PCLK 261
290#define TEGRA114_CLK_CCLK_G 262
291#define TEGRA114_CLK_CCLK_LP 263
292/* 264 */
293/* 265 */
294/* 266 */
295/* 267 */
296/* 268 */
297/* 269 */
298/* 270 */
299/* 271 */
300/* 272 */
301/* 273 */
302/* 274 */
303/* 275 */
304/* 276 */
305/* 277 */
306/* 278 */
307/* 279 */
308/* 280 */
309/* 281 */
310/* 282 */
311/* 283 */
312/* 284 */
313/* 285 */
314/* 286 */
315/* 287 */
316
317/* 288 */
318/* 289 */
319/* 290 */
320/* 291 */
321/* 292 */
322/* 293 */
323/* 294 */
324/* 295 */
325/* 296 */
326/* 297 */
327/* 298 */
328/* 299 */
329#define TEGRA114_CLK_AUDIO0_MUX 300
330#define TEGRA114_CLK_AUDIO1_MUX 301
331#define TEGRA114_CLK_AUDIO2_MUX 302
332#define TEGRA114_CLK_AUDIO3_MUX 303
333#define TEGRA114_CLK_AUDIO4_MUX 304
334#define TEGRA114_CLK_SPDIF_MUX 305
335#define TEGRA114_CLK_CLK_OUT_1_MUX 306
336#define TEGRA114_CLK_CLK_OUT_2_MUX 307
337#define TEGRA114_CLK_CLK_OUT_3_MUX 308
338#define TEGRA114_CLK_DSIA_MUX 309
339#define TEGRA114_CLK_DSIB_MUX 310
340#define TEGRA114_CLK_CLK_MAX 311
341
342#endif /* _DT_BINDINGS_CLOCK_TEGRA114_CAR_H */
diff --git a/include/dt-bindings/clock/tegra20-car.h b/include/dt-bindings/clock/tegra20-car.h
new file mode 100644
index 000000000000..a1ae9a8fdd6c
--- /dev/null
+++ b/include/dt-bindings/clock/tegra20-car.h
@@ -0,0 +1,158 @@
1/*
2 * This header provides constants for binding nvidia,tegra20-car.
3 *
4 * The first 96 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB
5 * registers. These IDs often match those in the CAR's RST_DEVICES registers,
6 * but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In
7 * this case, those clocks are assigned IDs above 95 in order to highlight
8 * this issue. Implementations that interpret these clock IDs as bit values
9 * within the CLK_OUT_ENB or RST_DEVICES registers should be careful to
10 * explicitly handle these special cases.
11 *
12 * The balance of the clocks controlled by the CAR are assigned IDs of 96 and
13 * above.
14 */
15
16#ifndef _DT_BINDINGS_CLOCK_TEGRA20_CAR_H
17#define _DT_BINDINGS_CLOCK_TEGRA20_CAR_H
18
19#define TEGRA20_CLK_CPU 0
20/* 1 */
21/* 2 */
22#define TEGRA20_CLK_AC97 3
23#define TEGRA20_CLK_RTC 4
24#define TEGRA20_CLK_TIMER 5
25#define TEGRA20_CLK_UARTA 6
26/* 7 (register bit affects uart2 and vfir) */
27#define TEGRA20_CLK_GPIO 8
28#define TEGRA20_CLK_SDMMC2 9
29/* 10 (register bit affects spdif_in and spdif_out) */
30#define TEGRA20_CLK_I2S1 11
31#define TEGRA20_CLK_I2C1 12
32#define TEGRA20_CLK_NDFLASH 13
33#define TEGRA20_CLK_SDMMC1 14
34#define TEGRA20_CLK_SDMMC4 15
35#define TEGRA20_CLK_TWC 16
36#define TEGRA20_CLK_PWM 17
37#define TEGRA20_CLK_I2S2 18
38#define TEGRA20_CLK_EPP 19
39/* 20 (register bit affects vi and vi_sensor) */
40#define TEGRA20_CLK_GR2D 21
41#define TEGRA20_CLK_USBD 22
42#define TEGRA20_CLK_ISP 23
43#define TEGRA20_CLK_GR3D 24
44#define TEGRA20_CLK_IDE 25
45#define TEGRA20_CLK_DISP2 26
46#define TEGRA20_CLK_DISP1 27
47#define TEGRA20_CLK_HOST1X 28
48#define TEGRA20_CLK_VCP 29
49/* 30 */
50#define TEGRA20_CLK_CACHE2 31
51
52#define TEGRA20_CLK_MEM 32
53#define TEGRA20_CLK_AHBDMA 33
54#define TEGRA20_CLK_APBDMA 34
55/* 35 */
56#define TEGRA20_CLK_KBC 36
57#define TEGRA20_CLK_STAT_MON 37
58#define TEGRA20_CLK_PMC 38
59#define TEGRA20_CLK_FUSE 39
60#define TEGRA20_CLK_KFUSE 40
61#define TEGRA20_CLK_SBC1 41
62#define TEGRA20_CLK_NOR 42
63#define TEGRA20_CLK_SPI 43
64#define TEGRA20_CLK_SBC2 44
65#define TEGRA20_CLK_XIO 45
66#define TEGRA20_CLK_SBC3 46
67#define TEGRA20_CLK_DVC 47
68#define TEGRA20_CLK_DSI 48
69/* 49 (register bit affects tvo and cve) */
70#define TEGRA20_CLK_MIPI 50
71#define TEGRA20_CLK_HDMI 51
72#define TEGRA20_CLK_CSI 52
73#define TEGRA20_CLK_TVDAC 53
74#define TEGRA20_CLK_I2C2 54
75#define TEGRA20_CLK_UARTC 55
76/* 56 */
77#define TEGRA20_CLK_EMC 57
78#define TEGRA20_CLK_USB2 58
79#define TEGRA20_CLK_USB3 59
80#define TEGRA20_CLK_MPE 60
81#define TEGRA20_CLK_VDE 61
82#define TEGRA20_CLK_BSEA 62
83#define TEGRA20_CLK_BSEV 63
84
85#define TEGRA20_CLK_SPEEDO 64
86#define TEGRA20_CLK_UARTD 65
87#define TEGRA20_CLK_UARTE 66
88#define TEGRA20_CLK_I2C3 67
89#define TEGRA20_CLK_SBC4 68
90#define TEGRA20_CLK_SDMMC3 69
91#define TEGRA20_CLK_PEX 70
92#define TEGRA20_CLK_OWR 71
93#define TEGRA20_CLK_AFI 72
94#define TEGRA20_CLK_CSITE 73
95#define TEGRA20_CLK_PCIE_XCLK 74
96#define TEGRA20_CLK_AVPUCQ 75
97#define TEGRA20_CLK_LA 76
98/* 77 */
99/* 78 */
100/* 79 */
101/* 80 */
102/* 81 */
103/* 82 */
104/* 83 */
105#define TEGRA20_CLK_IRAMA 84
106#define TEGRA20_CLK_IRAMB 85
107#define TEGRA20_CLK_IRAMC 86
108#define TEGRA20_CLK_IRAMD 87
109#define TEGRA20_CLK_CRAM2 88
110#define TEGRA20_CLK_AUDIO_2X 89 /* a/k/a audio_2x_sync_clk */
111#define TEGRA20_CLK_CLK_D 90
112/* 91 */
113#define TEGRA20_CLK_CSUS 92
114#define TEGRA20_CLK_CDEV2 93
115#define TEGRA20_CLK_CDEV1 94
116/* 95 */
117
118#define TEGRA20_CLK_UARTB 96
119#define TEGRA20_CLK_VFIR 97
120#define TEGRA20_CLK_SPDIF_IN 98
121#define TEGRA20_CLK_SPDIF_OUT 99
122#define TEGRA20_CLK_VI 100
123#define TEGRA20_CLK_VI_SENSOR 101
124#define TEGRA20_CLK_TVO 102
125#define TEGRA20_CLK_CVE 103
126#define TEGRA20_CLK_OSC 104
127#define TEGRA20_CLK_CLK_32K 105 /* a/k/a clk_s */
128#define TEGRA20_CLK_CLK_M 106
129#define TEGRA20_CLK_SCLK 107
130#define TEGRA20_CLK_CCLK 108
131#define TEGRA20_CLK_HCLK 109
132#define TEGRA20_CLK_PCLK 110
133#define TEGRA20_CLK_BLINK 111
134#define TEGRA20_CLK_PLL_A 112
135#define TEGRA20_CLK_PLL_A_OUT0 113
136#define TEGRA20_CLK_PLL_C 114
137#define TEGRA20_CLK_PLL_C_OUT1 115
138#define TEGRA20_CLK_PLL_D 116
139#define TEGRA20_CLK_PLL_D_OUT0 117
140#define TEGRA20_CLK_PLL_E 118
141#define TEGRA20_CLK_PLL_M 119
142#define TEGRA20_CLK_PLL_M_OUT1 120
143#define TEGRA20_CLK_PLL_P 121
144#define TEGRA20_CLK_PLL_P_OUT1 122
145#define TEGRA20_CLK_PLL_P_OUT2 123
146#define TEGRA20_CLK_PLL_P_OUT3 124
147#define TEGRA20_CLK_PLL_P_OUT4 125
148#define TEGRA20_CLK_PLL_S 126
149#define TEGRA20_CLK_PLL_U 127
150
151#define TEGRA20_CLK_PLL_X 128
152#define TEGRA20_CLK_COP 129 /* a/k/a avp */
153#define TEGRA20_CLK_AUDIO 130 /* a/k/a audio_sync_clk */
154#define TEGRA20_CLK_PLL_REF 131
155#define TEGRA20_CLK_TWD 132
156#define TEGRA20_CLK_CLK_MAX 133
157
158#endif /* _DT_BINDINGS_CLOCK_TEGRA20_CAR_H */
diff --git a/include/dt-bindings/clock/tegra30-car.h b/include/dt-bindings/clock/tegra30-car.h
new file mode 100644
index 000000000000..e40fae8f9a8d
--- /dev/null
+++ b/include/dt-bindings/clock/tegra30-car.h
@@ -0,0 +1,265 @@
1/*
2 * This header provides constants for binding nvidia,tegra30-car.
3 *
4 * The first 130 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB
5 * registers. These IDs often match those in the CAR's RST_DEVICES registers,
6 * but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In
7 * this case, those clocks are assigned IDs above 160 in order to highlight
8 * this issue. Implementations that interpret these clock IDs as bit values
9 * within the CLK_OUT_ENB or RST_DEVICES registers should be careful to
10 * explicitly handle these special cases.
11 *
12 * The balance of the clocks controlled by the CAR are assigned IDs of 160 and
13 * above.
14 */
15
16#ifndef _DT_BINDINGS_CLOCK_TEGRA30_CAR_H
17#define _DT_BINDINGS_CLOCK_TEGRA30_CAR_H
18
19#define TEGRA30_CLK_CPU 0
20/* 1 */
21/* 2 */
22/* 3 */
23#define TEGRA30_CLK_RTC 4
24#define TEGRA30_CLK_TIMER 5
25#define TEGRA30_CLK_UARTA 6
26/* 7 (register bit affects uartb and vfir) */
27#define TEGRA30_CLK_GPIO 8
28#define TEGRA30_CLK_SDMMC2 9
29/* 10 (register bit affects spdif_in and spdif_out) */
30#define TEGRA30_CLK_I2S1 11
31#define TEGRA30_CLK_I2C1 12
32#define TEGRA30_CLK_NDFLASH 13
33#define TEGRA30_CLK_SDMMC1 14
34#define TEGRA30_CLK_SDMMC4 15
35/* 16 */
36#define TEGRA30_CLK_PWM 17
37#define TEGRA30_CLK_I2S2 18
38#define TEGRA30_CLK_EPP 19
39/* 20 (register bit affects vi and vi_sensor) */
40#define TEGRA30_CLK_GR2D 21
41#define TEGRA30_CLK_USBD 22
42#define TEGRA30_CLK_ISP 23
43#define TEGRA30_CLK_GR3D 24
44/* 25 */
45#define TEGRA30_CLK_DISP2 26
46#define TEGRA30_CLK_DISP1 27
47#define TEGRA30_CLK_HOST1X 28
48#define TEGRA30_CLK_VCP 29
49#define TEGRA30_CLK_I2S0 30
50#define TEGRA30_CLK_COP_CACHE 31
51
52#define TEGRA30_CLK_MC 32
53#define TEGRA30_CLK_AHBDMA 33
54#define TEGRA30_CLK_APBDMA 34
55/* 35 */
56#define TEGRA30_CLK_KBC 36
57#define TEGRA30_CLK_STATMON 37
58#define TEGRA30_CLK_PMC 38
59/* 39 (register bit affects fuse and fuse_burn) */
60#define TEGRA30_CLK_KFUSE 40
61#define TEGRA30_CLK_SBC1 41
62#define TEGRA30_CLK_NOR 42
63/* 43 */
64#define TEGRA30_CLK_SBC2 44
65/* 45 */
66#define TEGRA30_CLK_SBC3 46
67#define TEGRA30_CLK_I2C5 47
68#define TEGRA30_CLK_DSIA 48
69/* 49 (register bit affects cve and tvo) */
70#define TEGRA30_CLK_MIPI 50
71#define TEGRA30_CLK_HDMI 51
72#define TEGRA30_CLK_CSI 52
73#define TEGRA30_CLK_TVDAC 53
74#define TEGRA30_CLK_I2C2 54
75#define TEGRA30_CLK_UARTC 55
76/* 56 */
77#define TEGRA30_CLK_EMC 57
78#define TEGRA30_CLK_USB2 58
79#define TEGRA30_CLK_USB3 59
80#define TEGRA30_CLK_MPE 60
81#define TEGRA30_CLK_VDE 61
82#define TEGRA30_CLK_BSEA 62
83#define TEGRA30_CLK_BSEV 63
84
85#define TEGRA30_CLK_SPEEDO 64
86#define TEGRA30_CLK_UARTD 65
87#define TEGRA30_CLK_UARTE 66
88#define TEGRA30_CLK_I2C3 67
89#define TEGRA30_CLK_SBC4 68
90#define TEGRA30_CLK_SDMMC3 69
91#define TEGRA30_CLK_PCIE 70
92#define TEGRA30_CLK_OWR 71
93#define TEGRA30_CLK_AFI 72
94#define TEGRA30_CLK_CSITE 73
95#define TEGRA30_CLK_PCIEX 74
96#define TEGRA30_CLK_AVPUCQ 75
97#define TEGRA30_CLK_LA 76
98/* 77 */
99/* 78 */
100#define TEGRA30_CLK_DTV 79
101#define TEGRA30_CLK_NDSPEED 80
102#define TEGRA30_CLK_I2CSLOW 81
103#define TEGRA30_CLK_DSIB 82
104/* 83 */
105#define TEGRA30_CLK_IRAMA 84
106#define TEGRA30_CLK_IRAMB 85
107#define TEGRA30_CLK_IRAMC 86
108#define TEGRA30_CLK_IRAMD 87
109#define TEGRA30_CLK_CRAM2 88
110/* 89 */
111#define TEGRA30_CLK_AUDIO_2X 90 /* a/k/a audio_2x_sync_clk */
112/* 91 */
113#define TEGRA30_CLK_CSUS 92
114#define TEGRA30_CLK_CDEV2 93
115#define TEGRA30_CLK_CDEV1 94
116/* 95 */
117
118#define TEGRA30_CLK_CPU_G 96
119#define TEGRA30_CLK_CPU_LP 97
120#define TEGRA30_CLK_GR3D2 98
121#define TEGRA30_CLK_MSELECT 99
122#define TEGRA30_CLK_TSENSOR 100
123#define TEGRA30_CLK_I2S3 101
124#define TEGRA30_CLK_I2S4 102
125#define TEGRA30_CLK_I2C4 103
126#define TEGRA30_CLK_SBC5 104
127#define TEGRA30_CLK_SBC6 105
128#define TEGRA30_CLK_D_AUDIO 106
129#define TEGRA30_CLK_APBIF 107
130#define TEGRA30_CLK_DAM0 108
131#define TEGRA30_CLK_DAM1 109
132#define TEGRA30_CLK_DAM2 110
133#define TEGRA30_CLK_HDA2CODEC_2X 111
134#define TEGRA30_CLK_ATOMICS 112
135#define TEGRA30_CLK_AUDIO0_2X 113
136#define TEGRA30_CLK_AUDIO1_2X 114
137#define TEGRA30_CLK_AUDIO2_2X 115
138#define TEGRA30_CLK_AUDIO3_2X 116
139#define TEGRA30_CLK_AUDIO4_2X 117
140#define TEGRA30_CLK_SPDIF_2X 118
141#define TEGRA30_CLK_ACTMON 119
142#define TEGRA30_CLK_EXTERN1 120
143#define TEGRA30_CLK_EXTERN2 121
144#define TEGRA30_CLK_EXTERN3 122
145#define TEGRA30_CLK_SATA_OOB 123
146#define TEGRA30_CLK_SATA 124
147#define TEGRA30_CLK_HDA 125
148/* 126 */
149#define TEGRA30_CLK_SE 127
150
151#define TEGRA30_CLK_HDA2HDMI 128
152#define TEGRA30_CLK_SATA_COLD 129
153/* 130 */
154/* 131 */
155/* 132 */
156/* 133 */
157/* 134 */
158/* 135 */
159/* 136 */
160/* 137 */
161/* 138 */
162/* 139 */
163/* 140 */
164/* 141 */
165/* 142 */
166/* 143 */
167/* 144 */
168/* 145 */
169/* 146 */
170/* 147 */
171/* 148 */
172/* 149 */
173/* 150 */
174/* 151 */
175/* 152 */
176/* 153 */
177/* 154 */
178/* 155 */
179/* 156 */
180/* 157 */
181/* 158 */
182/* 159 */
183
184#define TEGRA30_CLK_UARTB 160
185#define TEGRA30_CLK_VFIR 161
186#define TEGRA30_CLK_SPDIF_IN 162
187#define TEGRA30_CLK_SPDIF_OUT 163
188#define TEGRA30_CLK_VI 164
189#define TEGRA30_CLK_VI_SENSOR 165
190#define TEGRA30_CLK_FUSE 166
191#define TEGRA30_CLK_FUSE_BURN 167
192#define TEGRA30_CLK_CVE 168
193#define TEGRA30_CLK_TVO 169
194#define TEGRA30_CLK_CLK_32K 170
195#define TEGRA30_CLK_CLK_M 171
196#define TEGRA30_CLK_CLK_M_DIV2 172
197#define TEGRA30_CLK_CLK_M_DIV4 173
198#define TEGRA30_CLK_PLL_REF 174
199#define TEGRA30_CLK_PLL_C 175
200#define TEGRA30_CLK_PLL_C_OUT1 176
201#define TEGRA30_CLK_PLL_M 177
202#define TEGRA30_CLK_PLL_M_OUT1 178
203#define TEGRA30_CLK_PLL_P 179
204#define TEGRA30_CLK_PLL_P_OUT1 180
205#define TEGRA30_CLK_PLL_P_OUT2 181
206#define TEGRA30_CLK_PLL_P_OUT3 182
207#define TEGRA30_CLK_PLL_P_OUT4 183
208#define TEGRA30_CLK_PLL_A 184
209#define TEGRA30_CLK_PLL_A_OUT0 185
210#define TEGRA30_CLK_PLL_D 186
211#define TEGRA30_CLK_PLL_D_OUT0 187
212#define TEGRA30_CLK_PLL_D2 188
213#define TEGRA30_CLK_PLL_D2_OUT0 189
214#define TEGRA30_CLK_PLL_U 190
215#define TEGRA30_CLK_PLL_X 191
216
217#define TEGRA30_CLK_PLL_X_OUT0 192
218#define TEGRA30_CLK_PLL_E 193
219#define TEGRA30_CLK_SPDIF_IN_SYNC 194
220#define TEGRA30_CLK_I2S0_SYNC 195
221#define TEGRA30_CLK_I2S1_SYNC 196
222#define TEGRA30_CLK_I2S2_SYNC 197
223#define TEGRA30_CLK_I2S3_SYNC 198
224#define TEGRA30_CLK_I2S4_SYNC 199
225#define TEGRA30_CLK_VIMCLK_SYNC 200
226#define TEGRA30_CLK_AUDIO0 201
227#define TEGRA30_CLK_AUDIO1 202
228#define TEGRA30_CLK_AUDIO2 203
229#define TEGRA30_CLK_AUDIO3 204
230#define TEGRA30_CLK_AUDIO4 205
231#define TEGRA30_CLK_SPDIF 206
232#define TEGRA30_CLK_CLK_OUT_1 207 /* (extern1) */
233#define TEGRA30_CLK_CLK_OUT_2 208 /* (extern2) */
234#define TEGRA30_CLK_CLK_OUT_3 209 /* (extern3) */
235#define TEGRA30_CLK_SCLK 210
236#define TEGRA30_CLK_BLINK 211
237#define TEGRA30_CLK_CCLK_G 212
238#define TEGRA30_CLK_CCLK_LP 213
239#define TEGRA30_CLK_TWD 214
240#define TEGRA30_CLK_CML0 215
241#define TEGRA30_CLK_CML1 216
242#define TEGRA30_CLK_HCLK 217
243#define TEGRA30_CLK_PCLK 218
244/* 219 */
245/* 220 */
246/* 221 */
247/* 222 */
248/* 223 */
249
250/* 288 */
251/* 289 */
252/* 290 */
253/* 291 */
254/* 292 */
255/* 293 */
256/* 294 */
257/* 295 */
258/* 296 */
259/* 297 */
260/* 298 */
261/* 299 */
262#define TEGRA30_CLK_CLK_OUT_1_MUX 300
263#define TEGRA30_CLK_CLK_MAX 301
264
265#endif /* _DT_BINDINGS_CLOCK_TEGRA30_CAR_H */
diff --git a/include/dt-bindings/clock/vf610-clock.h b/include/dt-bindings/clock/vf610-clock.h
new file mode 100644
index 000000000000..4aa2b48cd151
--- /dev/null
+++ b/include/dt-bindings/clock/vf610-clock.h
@@ -0,0 +1,165 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9
10#ifndef __DT_BINDINGS_CLOCK_VF610_H
11#define __DT_BINDINGS_CLOCK_VF610_H
12
13#define VF610_CLK_DUMMY 0
14#define VF610_CLK_SIRC_128K 1
15#define VF610_CLK_SIRC_32K 2
16#define VF610_CLK_FIRC 3
17#define VF610_CLK_SXOSC 4
18#define VF610_CLK_FXOSC 5
19#define VF610_CLK_FXOSC_HALF 6
20#define VF610_CLK_SLOW_CLK_SEL 7
21#define VF610_CLK_FASK_CLK_SEL 8
22#define VF610_CLK_AUDIO_EXT 9
23#define VF610_CLK_ENET_EXT 10
24#define VF610_CLK_PLL1_MAIN 11
25#define VF610_CLK_PLL1_PFD1 12
26#define VF610_CLK_PLL1_PFD2 13
27#define VF610_CLK_PLL1_PFD3 14
28#define VF610_CLK_PLL1_PFD4 15
29#define VF610_CLK_PLL2_MAIN 16
30#define VF610_CLK_PLL2_PFD1 17
31#define VF610_CLK_PLL2_PFD2 18
32#define VF610_CLK_PLL2_PFD3 19
33#define VF610_CLK_PLL2_PFD4 20
34#define VF610_CLK_PLL3_MAIN 21
35#define VF610_CLK_PLL3_PFD1 22
36#define VF610_CLK_PLL3_PFD2 23
37#define VF610_CLK_PLL3_PFD3 24
38#define VF610_CLK_PLL3_PFD4 25
39#define VF610_CLK_PLL4_MAIN 26
40#define VF610_CLK_PLL5_MAIN 27
41#define VF610_CLK_PLL6_MAIN 28
42#define VF610_CLK_PLL3_MAIN_DIV 29
43#define VF610_CLK_PLL4_MAIN_DIV 30
44#define VF610_CLK_PLL6_MAIN_DIV 31
45#define VF610_CLK_PLL1_PFD_SEL 32
46#define VF610_CLK_PLL2_PFD_SEL 33
47#define VF610_CLK_SYS_SEL 34
48#define VF610_CLK_DDR_SEL 35
49#define VF610_CLK_SYS_BUS 36
50#define VF610_CLK_PLATFORM_BUS 37
51#define VF610_CLK_IPG_BUS 38
52#define VF610_CLK_UART0 39
53#define VF610_CLK_UART1 40
54#define VF610_CLK_UART2 41
55#define VF610_CLK_UART3 42
56#define VF610_CLK_UART4 43
57#define VF610_CLK_UART5 44
58#define VF610_CLK_PIT 45
59#define VF610_CLK_I2C0 46
60#define VF610_CLK_I2C1 47
61#define VF610_CLK_I2C2 48
62#define VF610_CLK_I2C3 49
63#define VF610_CLK_FTM0_EXT_SEL 50
64#define VF610_CLK_FTM0_FIX_SEL 51
65#define VF610_CLK_FTM0_EXT_FIX_EN 52
66#define VF610_CLK_FTM1_EXT_SEL 53
67#define VF610_CLK_FTM1_FIX_SEL 54
68#define VF610_CLK_FTM1_EXT_FIX_EN 55
69#define VF610_CLK_FTM2_EXT_SEL 56
70#define VF610_CLK_FTM2_FIX_SEL 57
71#define VF610_CLK_FTM2_EXT_FIX_EN 58
72#define VF610_CLK_FTM3_EXT_SEL 59
73#define VF610_CLK_FTM3_FIX_SEL 60
74#define VF610_CLK_FTM3_EXT_FIX_EN 61
75#define VF610_CLK_FTM0 62
76#define VF610_CLK_FTM1 63
77#define VF610_CLK_FTM2 64
78#define VF610_CLK_FTM3 65
79#define VF610_CLK_ENET_50M 66
80#define VF610_CLK_ENET_25M 67
81#define VF610_CLK_ENET_SEL 68
82#define VF610_CLK_ENET 69
83#define VF610_CLK_ENET_TS_SEL 70
84#define VF610_CLK_ENET_TS 71
85#define VF610_CLK_DSPI0 72
86#define VF610_CLK_DSPI1 73
87#define VF610_CLK_DSPI2 74
88#define VF610_CLK_DSPI3 75
89#define VF610_CLK_WDT 76
90#define VF610_CLK_ESDHC0_SEL 77
91#define VF610_CLK_ESDHC0_EN 78
92#define VF610_CLK_ESDHC0_DIV 79
93#define VF610_CLK_ESDHC0 80
94#define VF610_CLK_ESDHC1_SEL 81
95#define VF610_CLK_ESDHC1_EN 82
96#define VF610_CLK_ESDHC1_DIV 83
97#define VF610_CLK_ESDHC1 84
98#define VF610_CLK_DCU0_SEL 85
99#define VF610_CLK_DCU0_EN 86
100#define VF610_CLK_DCU0_DIV 87
101#define VF610_CLK_DCU0 88
102#define VF610_CLK_DCU1_SEL 89
103#define VF610_CLK_DCU1_EN 90
104#define VF610_CLK_DCU1_DIV 91
105#define VF610_CLK_DCU1 92
106#define VF610_CLK_ESAI_SEL 93
107#define VF610_CLK_ESAI_EN 94
108#define VF610_CLK_ESAI_DIV 95
109#define VF610_CLK_ESAI 96
110#define VF610_CLK_SAI0_SEL 97
111#define VF610_CLK_SAI0_EN 98
112#define VF610_CLK_SAI0_DIV 99
113#define VF610_CLK_SAI0 100
114#define VF610_CLK_SAI1_SEL 101
115#define VF610_CLK_SAI1_EN 102
116#define VF610_CLK_SAI1_DIV 103
117#define VF610_CLK_SAI1 104
118#define VF610_CLK_SAI2_SEL 105
119#define VF610_CLK_SAI2_EN 106
120#define VF610_CLK_SAI2_DIV 107
121#define VF610_CLK_SAI2 108
122#define VF610_CLK_SAI3_SEL 109
123#define VF610_CLK_SAI3_EN 110
124#define VF610_CLK_SAI3_DIV 111
125#define VF610_CLK_SAI3 112
126#define VF610_CLK_USBC0 113
127#define VF610_CLK_USBC1 114
128#define VF610_CLK_QSPI0_SEL 115
129#define VF610_CLK_QSPI0_EN 116
130#define VF610_CLK_QSPI0_X4_DIV 117
131#define VF610_CLK_QSPI0_X2_DIV 118
132#define VF610_CLK_QSPI0_X1_DIV 119
133#define VF610_CLK_QSPI1_SEL 120
134#define VF610_CLK_QSPI1_EN 121
135#define VF610_CLK_QSPI1_X4_DIV 122
136#define VF610_CLK_QSPI1_X2_DIV 123
137#define VF610_CLK_QSPI1_X1_DIV 124
138#define VF610_CLK_QSPI0 125
139#define VF610_CLK_QSPI1 126
140#define VF610_CLK_NFC_SEL 127
141#define VF610_CLK_NFC_EN 128
142#define VF610_CLK_NFC_PRE_DIV 129
143#define VF610_CLK_NFC_FRAC_DIV 130
144#define VF610_CLK_NFC_INV 131
145#define VF610_CLK_NFC 132
146#define VF610_CLK_VADC_SEL 133
147#define VF610_CLK_VADC_EN 134
148#define VF610_CLK_VADC_DIV 135
149#define VF610_CLK_VADC_DIV_HALF 136
150#define VF610_CLK_VADC 137
151#define VF610_CLK_ADC0 138
152#define VF610_CLK_ADC1 139
153#define VF610_CLK_DAC0 140
154#define VF610_CLK_DAC1 141
155#define VF610_CLK_FLEXCAN0 142
156#define VF610_CLK_FLEXCAN1 143
157#define VF610_CLK_ASRC 144
158#define VF610_CLK_GPU_SEL 145
159#define VF610_CLK_GPU_EN 146
160#define VF610_CLK_GPU2D 147
161#define VF610_CLK_ENET0 148
162#define VF610_CLK_ENET1 149
163#define VF610_CLK_END 150
164
165#endif /* __DT_BINDINGS_CLOCK_VF610_H */
diff --git a/include/dt-bindings/dma/at91.h b/include/dt-bindings/dma/at91.h
new file mode 100644
index 000000000000..e835037a77b4
--- /dev/null
+++ b/include/dt-bindings/dma/at91.h
@@ -0,0 +1,27 @@
1/*
2 * This header provides macros for at91 dma bindings.
3 *
4 * Copyright (C) 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
5 *
6 * GPLv2 only
7 */
8
9#ifndef __DT_BINDINGS_AT91_DMA_H__
10#define __DT_BINDINGS_AT91_DMA_H__
11
12/*
13 * Source and/or destination peripheral ID
14 */
15#define AT91_DMA_CFG_PER_ID_MASK (0xff)
16#define AT91_DMA_CFG_PER_ID(id) (id & AT91_DMA_CFG_PER_ID_MASK)
17
18/*
19 * FIFO configuration: it defines when a request is serviced.
20 */
21#define AT91_DMA_CFG_FIFOCFG_OFFSET (8)
22#define AT91_DMA_CFG_FIFOCFG_MASK (0xf << AT91_DMA_CFG_FIFOCFG_OFFSET)
23#define AT91_DMA_CFG_FIFOCFG_HALF (0x0 << AT91_DMA_CFG_FIFOCFG_OFFSET) /* half FIFO (default behavior) */
24#define AT91_DMA_CFG_FIFOCFG_ALAP (0x1 << AT91_DMA_CFG_FIFOCFG_OFFSET) /* largest defined AHB burst */
25#define AT91_DMA_CFG_FIFOCFG_ASAP (0x2 << AT91_DMA_CFG_FIFOCFG_OFFSET) /* single AHB access */
26
27#endif /* __DT_BINDINGS_AT91_DMA_H__ */
diff --git a/include/dt-bindings/gpio/tegra-gpio.h b/include/dt-bindings/gpio/tegra-gpio.h
new file mode 100644
index 000000000000..4d179c00f081
--- /dev/null
+++ b/include/dt-bindings/gpio/tegra-gpio.h
@@ -0,0 +1,50 @@
1/*
2 * This header provides constants for binding nvidia,tegra*-gpio.
3 *
4 * The first cell in Tegra's GPIO specifier is the GPIO ID. The macros below
5 * provide names for this.
6 *
7 * The second cell contains standard flag values specified in gpio.h.
8 */
9
10#ifndef _DT_BINDINGS_GPIO_TEGRA_GPIO_H
11#define _DT_BINDINGS_GPIO_TEGRA_GPIO_H
12
13#include <dt-bindings/gpio/gpio.h>
14
15#define TEGRA_GPIO_BANK_ID_A 0
16#define TEGRA_GPIO_BANK_ID_B 1
17#define TEGRA_GPIO_BANK_ID_C 2
18#define TEGRA_GPIO_BANK_ID_D 3
19#define TEGRA_GPIO_BANK_ID_E 4
20#define TEGRA_GPIO_BANK_ID_F 5
21#define TEGRA_GPIO_BANK_ID_G 6
22#define TEGRA_GPIO_BANK_ID_H 7
23#define TEGRA_GPIO_BANK_ID_I 8
24#define TEGRA_GPIO_BANK_ID_J 9
25#define TEGRA_GPIO_BANK_ID_K 10
26#define TEGRA_GPIO_BANK_ID_L 11
27#define TEGRA_GPIO_BANK_ID_M 12
28#define TEGRA_GPIO_BANK_ID_N 13
29#define TEGRA_GPIO_BANK_ID_O 14
30#define TEGRA_GPIO_BANK_ID_P 15
31#define TEGRA_GPIO_BANK_ID_Q 16
32#define TEGRA_GPIO_BANK_ID_R 17
33#define TEGRA_GPIO_BANK_ID_S 18
34#define TEGRA_GPIO_BANK_ID_T 19
35#define TEGRA_GPIO_BANK_ID_U 20
36#define TEGRA_GPIO_BANK_ID_V 21
37#define TEGRA_GPIO_BANK_ID_W 22
38#define TEGRA_GPIO_BANK_ID_X 23
39#define TEGRA_GPIO_BANK_ID_Y 24
40#define TEGRA_GPIO_BANK_ID_Z 25
41#define TEGRA_GPIO_BANK_ID_AA 26
42#define TEGRA_GPIO_BANK_ID_BB 27
43#define TEGRA_GPIO_BANK_ID_CC 28
44#define TEGRA_GPIO_BANK_ID_DD 29
45#define TEGRA_GPIO_BANK_ID_EE 30
46
47#define TEGRA_GPIO(bank, offset) \
48 ((TEGRA_GPIO_BANK_ID_##bank * 8) + offset)
49
50#endif
diff --git a/include/dt-bindings/pinctrl/am33xx.h b/include/dt-bindings/pinctrl/am33xx.h
new file mode 100644
index 000000000000..2fbc804e1a45
--- /dev/null
+++ b/include/dt-bindings/pinctrl/am33xx.h
@@ -0,0 +1,42 @@
1/*
2 * This header provides constants specific to AM33XX pinctrl bindings.
3 */
4
5#ifndef _DT_BINDINGS_PINCTRL_AM33XX_H
6#define _DT_BINDINGS_PINCTRL_AM33XX_H
7
8#include <dt-bindings/pinctrl/omap.h>
9
10/* am33xx specific mux bit defines */
11#undef PULL_ENA
12#undef INPUT_EN
13
14#define PULL_DISABLE (1 << 3)
15#define INPUT_EN (1 << 5)
16#define SLEWCTRL_FAST (1 << 6)
17
18/* update macro depending on INPUT_EN and PULL_ENA */
19#undef PIN_OUTPUT
20#undef PIN_OUTPUT_PULLUP
21#undef PIN_OUTPUT_PULLDOWN
22#undef PIN_INPUT
23#undef PIN_INPUT_PULLUP
24#undef PIN_INPUT_PULLDOWN
25
26#define PIN_OUTPUT (PULL_DISABLE)
27#define PIN_OUTPUT_PULLUP (PULL_UP)
28#define PIN_OUTPUT_PULLDOWN 0
29#define PIN_INPUT (INPUT_EN | PULL_DISABLE)
30#define PIN_INPUT_PULLUP (INPUT_EN | PULL_UP)
31#define PIN_INPUT_PULLDOWN (INPUT_EN)
32
33/* undef non-existing modes */
34#undef PIN_OFF_NONE
35#undef PIN_OFF_OUTPUT_HIGH
36#undef PIN_OFF_OUTPUT_LOW
37#undef PIN_OFF_INPUT_PULLUP
38#undef PIN_OFF_INPUT_PULLDOWN
39#undef PIN_OFF_WAKEUPENABLE
40
41#endif
42
diff --git a/include/dt-bindings/pinctrl/at91.h b/include/dt-bindings/pinctrl/at91.h
new file mode 100644
index 000000000000..d7988b4d8af9
--- /dev/null
+++ b/include/dt-bindings/pinctrl/at91.h
@@ -0,0 +1,35 @@
1/*
2 * This header provides constants for most at91 pinctrl bindings.
3 *
4 * Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * GPLv2 only
7 */
8
9#ifndef __DT_BINDINGS_AT91_PINCTRL_H__
10#define __DT_BINDINGS_AT91_PINCTRL_H__
11
12#define AT91_PINCTRL_NONE (0 << 0)
13#define AT91_PINCTRL_PULL_UP (1 << 0)
14#define AT91_PINCTRL_MULTI_DRIVE (1 << 1)
15#define AT91_PINCTRL_DEGLITCH (1 << 2)
16#define AT91_PINCTRL_PULL_DOWN (1 << 3)
17#define AT91_PINCTRL_DIS_SCHMIT (1 << 4)
18#define AT91_PINCTRL_DEBOUNCE (1 << 16)
19#define AT91_PINCTRL_DEBOUNCE_VA(x) (x << 17)
20
21#define AT91_PINCTRL_PULL_UP_DEGLITCH (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DEGLITCH)
22
23#define AT91_PIOA 0
24#define AT91_PIOB 1
25#define AT91_PIOC 2
26#define AT91_PIOD 3
27#define AT91_PIOE 4
28
29#define AT91_PERIPH_GPIO 0
30#define AT91_PERIPH_A 1
31#define AT91_PERIPH_B 2
32#define AT91_PERIPH_C 3
33#define AT91_PERIPH_D 4
34
35#endif /* __DT_BINDINGS_AT91_PINCTRL_H__ */
diff --git a/include/dt-bindings/pinctrl/omap.h b/include/dt-bindings/pinctrl/omap.h
new file mode 100644
index 000000000000..edbd250809cb
--- /dev/null
+++ b/include/dt-bindings/pinctrl/omap.h
@@ -0,0 +1,55 @@
1/*
2 * This header provides constants for OMAP pinctrl bindings.
3 *
4 * Copyright (C) 2009 Nokia
5 * Copyright (C) 2009-2010 Texas Instruments
6 */
7
8#ifndef _DT_BINDINGS_PINCTRL_OMAP_H
9#define _DT_BINDINGS_PINCTRL_OMAP_H
10
11/* 34xx mux mode options for each pin. See TRM for options */
12#define MUX_MODE0 0
13#define MUX_MODE1 1
14#define MUX_MODE2 2
15#define MUX_MODE3 3
16#define MUX_MODE4 4
17#define MUX_MODE5 5
18#define MUX_MODE6 6
19#define MUX_MODE7 7
20
21/* 24xx/34xx mux bit defines */
22#define PULL_ENA (1 << 3)
23#define PULL_UP (1 << 4)
24#define ALTELECTRICALSEL (1 << 5)
25
26/* 34xx specific mux bit defines */
27#define INPUT_EN (1 << 8)
28#define OFF_EN (1 << 9)
29#define OFFOUT_EN (1 << 10)
30#define OFFOUT_VAL (1 << 11)
31#define OFF_PULL_EN (1 << 12)
32#define OFF_PULL_UP (1 << 13)
33#define WAKEUP_EN (1 << 14)
34
35/* 44xx specific mux bit defines */
36#define WAKEUP_EVENT (1 << 15)
37
38/* Active pin states */
39#define PIN_OUTPUT 0
40#define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP)
41#define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA)
42#define PIN_INPUT INPUT_EN
43#define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP)
44#define PIN_INPUT_PULLDOWN (PULL_ENA | INPUT_EN)
45
46/* Off mode states */
47#define PIN_OFF_NONE 0
48#define PIN_OFF_OUTPUT_HIGH (OFF_EN | OFFOUT_EN | OFFOUT_VAL)
49#define PIN_OFF_OUTPUT_LOW (OFF_EN | OFFOUT_EN)
50#define PIN_OFF_INPUT_PULLUP (OFF_EN | OFF_PULL_EN | OFF_PULL_UP)
51#define PIN_OFF_INPUT_PULLDOWN (OFF_EN | OFF_PULL_EN)
52#define PIN_OFF_WAKEUPENABLE WAKEUP_EN
53
54#endif
55
diff --git a/include/linux/clk/mvebu.h b/include/dt-bindings/pinctrl/rockchip.h
index 8c4ae713b063..cd5788be82ce 100644
--- a/include/linux/clk/mvebu.h
+++ b/include/dt-bindings/pinctrl/rockchip.h
@@ -1,4 +1,9 @@
1/* 1/*
2 * Header providing constants for Rockchip pinctrl bindings.
3 *
4 * Copyright (c) 2013 MundoReader S.L.
5 * Author: Heiko Stuebner <heiko@sntech.de>
6 *
2 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by 8 * 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 9 * the Free Software Foundation; either version 2 of the License, or
@@ -8,15 +13,20 @@
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details. 15 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 */ 16 */
16 17
17#ifndef __CLK_MVEBU_H_ 18#ifndef __DT_BINDINGS_ROCKCHIP_PINCTRL_H__
18#define __CLK_MVEBU_H_ 19#define __DT_BINDINGS_ROCKCHIP_PINCTRL_H__
20
21#define RK_GPIO0 0
22#define RK_GPIO1 1
23#define RK_GPIO2 2
24#define RK_GPIO3 3
25#define RK_GPIO4 4
26#define RK_GPIO6 6
19 27
20void __init mvebu_clocks_init(void); 28#define RK_FUNC_GPIO 0
29#define RK_FUNC_1 1
30#define RK_FUNC_2 2
21 31
22#endif 32#endif
diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h
new file mode 100644
index 000000000000..6d9aeddc09bf
--- /dev/null
+++ b/include/kvm/arm_arch_timer.h
@@ -0,0 +1,89 @@
1/*
2 * Copyright (C) 2012 ARM Ltd.
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __ASM_ARM_KVM_ARCH_TIMER_H
20#define __ASM_ARM_KVM_ARCH_TIMER_H
21
22#include <linux/clocksource.h>
23#include <linux/hrtimer.h>
24#include <linux/workqueue.h>
25
26struct arch_timer_kvm {
27#ifdef CONFIG_KVM_ARM_TIMER
28 /* Is the timer enabled */
29 bool enabled;
30
31 /* Virtual offset */
32 cycle_t cntvoff;
33#endif
34};
35
36struct arch_timer_cpu {
37#ifdef CONFIG_KVM_ARM_TIMER
38 /* Registers: control register, timer value */
39 u32 cntv_ctl; /* Saved/restored */
40 cycle_t cntv_cval; /* Saved/restored */
41
42 /*
43 * Anything that is not used directly from assembly code goes
44 * here.
45 */
46
47 /* Background timer used when the guest is not running */
48 struct hrtimer timer;
49
50 /* Work queued with the above timer expires */
51 struct work_struct expired;
52
53 /* Background timer active */
54 bool armed;
55
56 /* Timer IRQ */
57 const struct kvm_irq_level *irq;
58#endif
59};
60
61#ifdef CONFIG_KVM_ARM_TIMER
62int kvm_timer_hyp_init(void);
63int kvm_timer_init(struct kvm *kvm);
64void kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu,
65 const struct kvm_irq_level *irq);
66void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu);
67void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu);
68void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu);
69void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu);
70#else
71static inline int kvm_timer_hyp_init(void)
72{
73 return 0;
74};
75
76static inline int kvm_timer_init(struct kvm *kvm)
77{
78 return 0;
79}
80
81static inline void kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu,
82 const struct kvm_irq_level *irq) {}
83static inline void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu) {}
84static inline void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu) {}
85static inline void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu) {}
86static inline void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu) {}
87#endif
88
89#endif
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
new file mode 100644
index 000000000000..343744e4809c
--- /dev/null
+++ b/include/kvm/arm_vgic.h
@@ -0,0 +1,220 @@
1/*
2 * Copyright (C) 2012 ARM Ltd.
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __ASM_ARM_KVM_VGIC_H
20#define __ASM_ARM_KVM_VGIC_H
21
22#include <linux/kernel.h>
23#include <linux/kvm.h>
24#include <linux/irqreturn.h>
25#include <linux/spinlock.h>
26#include <linux/types.h>
27#include <linux/irqchip/arm-gic.h>
28
29#define VGIC_NR_IRQS 128
30#define VGIC_NR_SGIS 16
31#define VGIC_NR_PPIS 16
32#define VGIC_NR_PRIVATE_IRQS (VGIC_NR_SGIS + VGIC_NR_PPIS)
33#define VGIC_NR_SHARED_IRQS (VGIC_NR_IRQS - VGIC_NR_PRIVATE_IRQS)
34#define VGIC_MAX_CPUS KVM_MAX_VCPUS
35#define VGIC_MAX_LRS (1 << 6)
36
37/* Sanity checks... */
38#if (VGIC_MAX_CPUS > 8)
39#error Invalid number of CPU interfaces
40#endif
41
42#if (VGIC_NR_IRQS & 31)
43#error "VGIC_NR_IRQS must be a multiple of 32"
44#endif
45
46#if (VGIC_NR_IRQS > 1024)
47#error "VGIC_NR_IRQS must be <= 1024"
48#endif
49
50/*
51 * The GIC distributor registers describing interrupts have two parts:
52 * - 32 per-CPU interrupts (SGI + PPI)
53 * - a bunch of shared interrupts (SPI)
54 */
55struct vgic_bitmap {
56 union {
57 u32 reg[VGIC_NR_PRIVATE_IRQS / 32];
58 DECLARE_BITMAP(reg_ul, VGIC_NR_PRIVATE_IRQS);
59 } percpu[VGIC_MAX_CPUS];
60 union {
61 u32 reg[VGIC_NR_SHARED_IRQS / 32];
62 DECLARE_BITMAP(reg_ul, VGIC_NR_SHARED_IRQS);
63 } shared;
64};
65
66struct vgic_bytemap {
67 u32 percpu[VGIC_MAX_CPUS][VGIC_NR_PRIVATE_IRQS / 4];
68 u32 shared[VGIC_NR_SHARED_IRQS / 4];
69};
70
71struct vgic_dist {
72#ifdef CONFIG_KVM_ARM_VGIC
73 spinlock_t lock;
74 bool ready;
75
76 /* Virtual control interface mapping */
77 void __iomem *vctrl_base;
78
79 /* Distributor and vcpu interface mapping in the guest */
80 phys_addr_t vgic_dist_base;
81 phys_addr_t vgic_cpu_base;
82
83 /* Distributor enabled */
84 u32 enabled;
85
86 /* Interrupt enabled (one bit per IRQ) */
87 struct vgic_bitmap irq_enabled;
88
89 /* Interrupt 'pin' level */
90 struct vgic_bitmap irq_state;
91
92 /* Level-triggered interrupt in progress */
93 struct vgic_bitmap irq_active;
94
95 /* Interrupt priority. Not used yet. */
96 struct vgic_bytemap irq_priority;
97
98 /* Level/edge triggered */
99 struct vgic_bitmap irq_cfg;
100
101 /* Source CPU per SGI and target CPU */
102 u8 irq_sgi_sources[VGIC_MAX_CPUS][VGIC_NR_SGIS];
103
104 /* Target CPU for each IRQ */
105 u8 irq_spi_cpu[VGIC_NR_SHARED_IRQS];
106 struct vgic_bitmap irq_spi_target[VGIC_MAX_CPUS];
107
108 /* Bitmap indicating which CPU has something pending */
109 unsigned long irq_pending_on_cpu;
110#endif
111};
112
113struct vgic_cpu {
114#ifdef CONFIG_KVM_ARM_VGIC
115 /* per IRQ to LR mapping */
116 u8 vgic_irq_lr_map[VGIC_NR_IRQS];
117
118 /* Pending interrupts on this VCPU */
119 DECLARE_BITMAP( pending_percpu, VGIC_NR_PRIVATE_IRQS);
120 DECLARE_BITMAP( pending_shared, VGIC_NR_SHARED_IRQS);
121
122 /* Bitmap of used/free list registers */
123 DECLARE_BITMAP( lr_used, VGIC_MAX_LRS);
124
125 /* Number of list registers on this CPU */
126 int nr_lr;
127
128 /* CPU vif control registers for world switch */
129 u32 vgic_hcr;
130 u32 vgic_vmcr;
131 u32 vgic_misr; /* Saved only */
132 u32 vgic_eisr[2]; /* Saved only */
133 u32 vgic_elrsr[2]; /* Saved only */
134 u32 vgic_apr;
135 u32 vgic_lr[VGIC_MAX_LRS];
136#endif
137};
138
139#define LR_EMPTY 0xff
140
141struct kvm;
142struct kvm_vcpu;
143struct kvm_run;
144struct kvm_exit_mmio;
145
146#ifdef CONFIG_KVM_ARM_VGIC
147int kvm_vgic_set_addr(struct kvm *kvm, unsigned long type, u64 addr);
148int kvm_vgic_hyp_init(void);
149int kvm_vgic_init(struct kvm *kvm);
150int kvm_vgic_create(struct kvm *kvm);
151int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu);
152void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu);
153void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu);
154int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num,
155 bool level);
156int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu);
157bool vgic_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run,
158 struct kvm_exit_mmio *mmio);
159
160#define irqchip_in_kernel(k) (!!((k)->arch.vgic.vctrl_base))
161#define vgic_initialized(k) ((k)->arch.vgic.ready)
162
163#else
164static inline int kvm_vgic_hyp_init(void)
165{
166 return 0;
167}
168
169static inline int kvm_vgic_set_addr(struct kvm *kvm, unsigned long type, u64 addr)
170{
171 return 0;
172}
173
174static inline int kvm_vgic_init(struct kvm *kvm)
175{
176 return 0;
177}
178
179static inline int kvm_vgic_create(struct kvm *kvm)
180{
181 return 0;
182}
183
184static inline int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu)
185{
186 return 0;
187}
188
189static inline void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu) {}
190static inline void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) {}
191
192static inline int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid,
193 unsigned int irq_num, bool level)
194{
195 return 0;
196}
197
198static inline int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu)
199{
200 return 0;
201}
202
203static inline bool vgic_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run,
204 struct kvm_exit_mmio *mmio)
205{
206 return false;
207}
208
209static inline int irqchip_in_kernel(struct kvm *kvm)
210{
211 return 0;
212}
213
214static inline bool vgic_initialized(struct kvm *kvm)
215{
216 return true;
217}
218#endif
219
220#endif
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 17b5b5967641..353ba256f368 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -352,8 +352,7 @@ extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
352 352
353/* Enable _OST when all relevant hotplug operations are enabled */ 353/* Enable _OST when all relevant hotplug operations are enabled */
354#if defined(CONFIG_ACPI_HOTPLUG_CPU) && \ 354#if defined(CONFIG_ACPI_HOTPLUG_CPU) && \
355 (defined(CONFIG_ACPI_HOTPLUG_MEMORY) || \ 355 defined(CONFIG_ACPI_HOTPLUG_MEMORY) && \
356 defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)) && \
357 defined(CONFIG_ACPI_CONTAINER) 356 defined(CONFIG_ACPI_CONTAINER)
358#define ACPI_HOTPLUG_OST 357#define ACPI_HOTPLUG_OST
359#endif 358#endif
diff --git a/include/linux/aer.h b/include/linux/aer.h
index 737f90ab4b62..4dbaa7081530 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -7,6 +7,10 @@
7#ifndef _AER_H_ 7#ifndef _AER_H_
8#define _AER_H_ 8#define _AER_H_
9 9
10#define AER_NONFATAL 0
11#define AER_FATAL 1
12#define AER_CORRECTABLE 2
13
10struct aer_header_log_regs { 14struct aer_header_log_regs {
11 unsigned int dw0; 15 unsigned int dw0;
12 unsigned int dw1; 16 unsigned int dw1;
@@ -31,9 +35,9 @@ struct aer_capability_regs {
31 35
32#if defined(CONFIG_PCIEAER) 36#if defined(CONFIG_PCIEAER)
33/* pci-e port driver needs this function to enable aer */ 37/* pci-e port driver needs this function to enable aer */
34extern int pci_enable_pcie_error_reporting(struct pci_dev *dev); 38int pci_enable_pcie_error_reporting(struct pci_dev *dev);
35extern int pci_disable_pcie_error_reporting(struct pci_dev *dev); 39int pci_disable_pcie_error_reporting(struct pci_dev *dev);
36extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); 40int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
37#else 41#else
38static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev) 42static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev)
39{ 43{
@@ -49,11 +53,11 @@ static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
49} 53}
50#endif 54#endif
51 55
52extern void cper_print_aer(struct pci_dev *dev, 56void cper_print_aer(struct pci_dev *dev, int cper_severity,
53 int cper_severity, struct aer_capability_regs *aer); 57 struct aer_capability_regs *aer);
54extern int cper_severity_to_aer(int cper_severity); 58int cper_severity_to_aer(int cper_severity);
55extern void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, 59void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
56 int severity, 60 int severity,
57 struct aer_capability_regs *aer_regs); 61 struct aer_capability_regs *aer_regs);
58#endif //_AER_H_ 62#endif //_AER_H_
59 63
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h
index 9069694e70eb..a899402a5a0e 100644
--- a/include/linux/alarmtimer.h
+++ b/include/linux/alarmtimer.h
@@ -44,10 +44,14 @@ struct alarm {
44void alarm_init(struct alarm *alarm, enum alarmtimer_type type, 44void alarm_init(struct alarm *alarm, enum alarmtimer_type type,
45 enum alarmtimer_restart (*function)(struct alarm *, ktime_t)); 45 enum alarmtimer_restart (*function)(struct alarm *, ktime_t));
46int alarm_start(struct alarm *alarm, ktime_t start); 46int alarm_start(struct alarm *alarm, ktime_t start);
47int alarm_start_relative(struct alarm *alarm, ktime_t start);
48void alarm_restart(struct alarm *alarm);
47int alarm_try_to_cancel(struct alarm *alarm); 49int alarm_try_to_cancel(struct alarm *alarm);
48int alarm_cancel(struct alarm *alarm); 50int alarm_cancel(struct alarm *alarm);
49 51
50u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval); 52u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval);
53u64 alarm_forward_now(struct alarm *alarm, ktime_t interval);
54ktime_t alarm_expires_remaining(const struct alarm *alarm);
51 55
52/* Provide way to access the rtc device being used by alarmtimers */ 56/* Provide way to access the rtc device being used by alarmtimers */
53struct rtc_device *alarmtimer_get_rtcdev(void); 57struct rtc_device *alarmtimer_get_rtcdev(void);
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
index 2a5f64a11b77..10fe2a211c2e 100644
--- a/include/linux/amba/pl08x.h
+++ b/include/linux/amba/pl08x.h
@@ -76,11 +76,11 @@ struct pl08x_channel_data {
76 * platform, all inclusive, including multiplexed channels. The available 76 * platform, all inclusive, including multiplexed channels. The available
77 * physical channels will be multiplexed around these signals as they are 77 * physical channels will be multiplexed around these signals as they are
78 * requested, just enumerate all possible channels. 78 * requested, just enumerate all possible channels.
79 * @get_signal: request a physical signal to be used for a DMA transfer 79 * @get_xfer_signal: request a physical signal to be used for a DMA transfer
80 * immediately: if there is some multiplexing or similar blocking the use 80 * immediately: if there is some multiplexing or similar blocking the use
81 * of the channel the transfer can be denied by returning less than zero, 81 * of the channel the transfer can be denied by returning less than zero,
82 * else it returns the allocated signal number 82 * else it returns the allocated signal number
83 * @put_signal: indicate to the platform that this physical signal is not 83 * @put_xfer_signal: indicate to the platform that this physical signal is not
84 * running any DMA transfer and multiplexing can be recycled 84 * running any DMA transfer and multiplexing can be recycled
85 * @lli_buses: buses which LLIs can be fetched from: PL08X_AHB1 | PL08X_AHB2 85 * @lli_buses: buses which LLIs can be fetched from: PL08X_AHB1 | PL08X_AHB2
86 * @mem_buses: buses which memory can be accessed from: PL08X_AHB1 | PL08X_AHB2 86 * @mem_buses: buses which memory can be accessed from: PL08X_AHB1 | PL08X_AHB2
@@ -89,8 +89,8 @@ struct pl08x_platform_data {
89 const struct pl08x_channel_data *slave_channels; 89 const struct pl08x_channel_data *slave_channels;
90 unsigned int num_slave_channels; 90 unsigned int num_slave_channels;
91 struct pl08x_channel_data memcpy_channel; 91 struct pl08x_channel_data memcpy_channel;
92 int (*get_signal)(const struct pl08x_channel_data *); 92 int (*get_xfer_signal)(const struct pl08x_channel_data *);
93 void (*put_signal)(const struct pl08x_channel_data *, int); 93 void (*put_xfer_signal)(const struct pl08x_channel_data *, int);
94 u8 lli_buses; 94 u8 lli_buses;
95 u8 mem_buses; 95 u8 mem_buses;
96}; 96};
diff --git a/include/linux/arm-cci.h b/include/linux/arm-cci.h
new file mode 100644
index 000000000000..79d6edf446d5
--- /dev/null
+++ b/include/linux/arm-cci.h
@@ -0,0 +1,61 @@
1/*
2 * CCI cache coherent interconnect support
3 *
4 * Copyright (C) 2013 ARM Ltd.
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 __LINUX_ARM_CCI_H
22#define __LINUX_ARM_CCI_H
23
24#include <linux/errno.h>
25#include <linux/types.h>
26
27struct device_node;
28
29#ifdef CONFIG_ARM_CCI
30extern bool cci_probed(void);
31extern int cci_ace_get_port(struct device_node *dn);
32extern int cci_disable_port_by_cpu(u64 mpidr);
33extern int __cci_control_port_by_device(struct device_node *dn, bool enable);
34extern int __cci_control_port_by_index(u32 port, bool enable);
35#else
36static inline bool cci_probed(void) { return false; }
37static inline int cci_ace_get_port(struct device_node *dn)
38{
39 return -ENODEV;
40}
41static inline int cci_disable_port_by_cpu(u64 mpidr) { return -ENODEV; }
42static inline int __cci_control_port_by_device(struct device_node *dn,
43 bool enable)
44{
45 return -ENODEV;
46}
47static inline int __cci_control_port_by_index(u32 port, bool enable)
48{
49 return -ENODEV;
50}
51#endif
52#define cci_disable_port_by_device(dev) \
53 __cci_control_port_by_device(dev, false)
54#define cci_enable_port_by_device(dev) \
55 __cci_control_port_by_device(dev, true)
56#define cci_disable_port_by_index(dev) \
57 __cci_control_port_by_index(dev, false)
58#define cci_enable_port_by_index(dev) \
59 __cci_control_port_by_index(dev, true)
60
61#endif
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index a1c486a88e88..179b38ffd351 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -182,10 +182,6 @@ async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset,
182 unsigned int src_offset, size_t len, 182 unsigned int src_offset, size_t len,
183 struct async_submit_ctl *submit); 183 struct async_submit_ctl *submit);
184 184
185struct dma_async_tx_descriptor *
186async_memset(struct page *dest, int val, unsigned int offset,
187 size_t len, struct async_submit_ctl *submit);
188
189struct dma_async_tx_descriptor *async_trigger_callback(struct async_submit_ctl *submit); 185struct dma_async_tx_descriptor *async_trigger_callback(struct async_submit_ctl *submit);
190 186
191struct dma_async_tx_descriptor * 187struct dma_async_tx_descriptor *
diff --git a/include/linux/audit.h b/include/linux/audit.h
index b20b03852f21..729a4d165bcc 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -103,8 +103,11 @@ extern void __audit_syscall_exit(int ret_success, long ret_value);
103extern struct filename *__audit_reusename(const __user char *uptr); 103extern struct filename *__audit_reusename(const __user char *uptr);
104extern void __audit_getname(struct filename *name); 104extern void __audit_getname(struct filename *name);
105extern void audit_putname(struct filename *name); 105extern void audit_putname(struct filename *name);
106
107#define AUDIT_INODE_PARENT 1 /* dentry represents the parent */
108#define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */
106extern void __audit_inode(struct filename *name, const struct dentry *dentry, 109extern void __audit_inode(struct filename *name, const struct dentry *dentry,
107 unsigned int parent); 110 unsigned int flags);
108extern void __audit_inode_child(const struct inode *parent, 111extern void __audit_inode_child(const struct inode *parent,
109 const struct dentry *dentry, 112 const struct dentry *dentry,
110 const unsigned char type); 113 const unsigned char type);
@@ -148,10 +151,22 @@ static inline void audit_getname(struct filename *name)
148 if (unlikely(!audit_dummy_context())) 151 if (unlikely(!audit_dummy_context()))
149 __audit_getname(name); 152 __audit_getname(name);
150} 153}
151static inline void audit_inode(struct filename *name, const struct dentry *dentry, 154static inline void audit_inode(struct filename *name,
155 const struct dentry *dentry,
152 unsigned int parent) { 156 unsigned int parent) {
157 if (unlikely(!audit_dummy_context())) {
158 unsigned int flags = 0;
159 if (parent)
160 flags |= AUDIT_INODE_PARENT;
161 __audit_inode(name, dentry, flags);
162 }
163}
164static inline void audit_inode_parent_hidden(struct filename *name,
165 const struct dentry *dentry)
166{
153 if (unlikely(!audit_dummy_context())) 167 if (unlikely(!audit_dummy_context()))
154 __audit_inode(name, dentry, parent); 168 __audit_inode(name, dentry,
169 AUDIT_INODE_PARENT | AUDIT_INODE_HIDDEN);
155} 170}
156static inline void audit_inode_child(const struct inode *parent, 171static inline void audit_inode_child(const struct inode *parent,
157 const struct dentry *dentry, 172 const struct dentry *dentry,
@@ -311,7 +326,7 @@ static inline void audit_putname(struct filename *name)
311{ } 326{ }
312static inline void __audit_inode(struct filename *name, 327static inline void __audit_inode(struct filename *name,
313 const struct dentry *dentry, 328 const struct dentry *dentry,
314 unsigned int parent) 329 unsigned int flags)
315{ } 330{ }
316static inline void __audit_inode_child(const struct inode *parent, 331static inline void __audit_inode_child(const struct inode *parent,
317 const struct dentry *dentry, 332 const struct dentry *dentry,
@@ -321,6 +336,9 @@ static inline void audit_inode(struct filename *name,
321 const struct dentry *dentry, 336 const struct dentry *dentry,
322 unsigned int parent) 337 unsigned int parent)
323{ } 338{ }
339static inline void audit_inode_parent_hidden(struct filename *name,
340 const struct dentry *dentry)
341{ }
324static inline void audit_inode_child(const struct inode *parent, 342static inline void audit_inode_child(const struct inode *parent,
325 const struct dentry *dentry, 343 const struct dentry *dentry,
326 const unsigned char type) 344 const unsigned char type)
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index da9a0825e007..53b77949c79d 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -114,7 +114,13 @@ static inline void backlight_update_status(struct backlight_device *bd)
114extern struct backlight_device *backlight_device_register(const char *name, 114extern struct backlight_device *backlight_device_register(const char *name,
115 struct device *dev, void *devdata, const struct backlight_ops *ops, 115 struct device *dev, void *devdata, const struct backlight_ops *ops,
116 const struct backlight_properties *props); 116 const struct backlight_properties *props);
117extern struct backlight_device *devm_backlight_device_register(
118 struct device *dev, const char *name, struct device *parent,
119 void *devdata, const struct backlight_ops *ops,
120 const struct backlight_properties *props);
117extern void backlight_device_unregister(struct backlight_device *bd); 121extern void backlight_device_unregister(struct backlight_device *bd);
122extern void devm_backlight_device_unregister(struct device *dev,
123 struct backlight_device *bd);
118extern void backlight_force_update(struct backlight_device *bd, 124extern void backlight_force_update(struct backlight_device *bd,
119 enum backlight_update_reason reason); 125 enum backlight_update_reason reason);
120 126
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 2e34db82a643..622fc505d3e1 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -144,6 +144,7 @@ struct bcma_host_ops {
144 144
145/* Chip IDs of PCIe devices */ 145/* Chip IDs of PCIe devices */
146#define BCMA_CHIP_ID_BCM4313 0x4313 146#define BCMA_CHIP_ID_BCM4313 0x4313
147#define BCMA_CHIP_ID_BCM43142 43142
147#define BCMA_CHIP_ID_BCM43224 43224 148#define BCMA_CHIP_ID_BCM43224 43224
148#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8 149#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8
149#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa 150#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index b8b09eac60a4..c49e1a159e6e 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -330,6 +330,8 @@
330#define BCMA_CC_PMU_CAP 0x0604 /* PMU capabilities */ 330#define BCMA_CC_PMU_CAP 0x0604 /* PMU capabilities */
331#define BCMA_CC_PMU_CAP_REVISION 0x000000FF /* Revision mask */ 331#define BCMA_CC_PMU_CAP_REVISION 0x000000FF /* Revision mask */
332#define BCMA_CC_PMU_STAT 0x0608 /* PMU status */ 332#define BCMA_CC_PMU_STAT 0x0608 /* PMU status */
333#define BCMA_CC_PMU_STAT_EXT_LPO_AVAIL 0x00000100
334#define BCMA_CC_PMU_STAT_WDRESET 0x00000080
333#define BCMA_CC_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */ 335#define BCMA_CC_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */
334#define BCMA_CC_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */ 336#define BCMA_CC_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */
335#define BCMA_CC_PMU_STAT_HAVEALP 0x00000008 /* ALP available */ 337#define BCMA_CC_PMU_STAT_HAVEALP 0x00000008 /* ALP available */
@@ -355,6 +357,11 @@
355#define BCMA_CC_REGCTL_DATA 0x065C 357#define BCMA_CC_REGCTL_DATA 0x065C
356#define BCMA_CC_PLLCTL_ADDR 0x0660 358#define BCMA_CC_PLLCTL_ADDR 0x0660
357#define BCMA_CC_PLLCTL_DATA 0x0664 359#define BCMA_CC_PLLCTL_DATA 0x0664
360#define BCMA_CC_PMU_STRAPOPT 0x0668 /* (corerev >= 28) */
361#define BCMA_CC_PMU_XTAL_FREQ 0x066C /* (pmurev >= 10) */
362#define BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK 0x00001FFF
363#define BCMA_CC_PMU_XTAL_FREQ_MEASURE_MASK 0x80000000
364#define BCMA_CC_PMU_XTAL_FREQ_MEASURE_SHIFT 31
358#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */ 365#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */
359/* NAND flash MLC controller registers (corerev >= 38) */ 366/* NAND flash MLC controller registers (corerev >= 38) */
360#define BCMA_CC_NAND_REVISION 0x0C00 367#define BCMA_CC_NAND_REVISION 0x0C00
@@ -435,6 +442,23 @@
435#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_MASK 0x00000007 442#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_MASK 0x00000007
436#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_SHIFT 0 443#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_SHIFT 0
437 444
445/* PMU rev 15 */
446#define BCMA_CC_PMU15_PLL_PLLCTL0 0
447#define BCMA_CC_PMU15_PLL_PC0_CLKSEL_MASK 0x00000003
448#define BCMA_CC_PMU15_PLL_PC0_CLKSEL_SHIFT 0
449#define BCMA_CC_PMU15_PLL_PC0_FREQTGT_MASK 0x003FFFFC
450#define BCMA_CC_PMU15_PLL_PC0_FREQTGT_SHIFT 2
451#define BCMA_CC_PMU15_PLL_PC0_PRESCALE_MASK 0x00C00000
452#define BCMA_CC_PMU15_PLL_PC0_PRESCALE_SHIFT 22
453#define BCMA_CC_PMU15_PLL_PC0_KPCTRL_MASK 0x07000000
454#define BCMA_CC_PMU15_PLL_PC0_KPCTRL_SHIFT 24
455#define BCMA_CC_PMU15_PLL_PC0_FCNTCTRL_MASK 0x38000000
456#define BCMA_CC_PMU15_PLL_PC0_FCNTCTRL_SHIFT 27
457#define BCMA_CC_PMU15_PLL_PC0_FDCMODE_MASK 0x40000000
458#define BCMA_CC_PMU15_PLL_PC0_FDCMODE_SHIFT 30
459#define BCMA_CC_PMU15_PLL_PC0_CTRLBIAS_MASK 0x80000000
460#define BCMA_CC_PMU15_PLL_PC0_CTRLBIAS_SHIFT 31
461
438/* ALP clock on pre-PMU chips */ 462/* ALP clock on pre-PMU chips */
439#define BCMA_CC_PMU_ALP_CLOCK 20000000 463#define BCMA_CC_PMU_ALP_CLOCK 20000000
440/* HT clock for systems with PMU-enabled chipcommon */ 464/* HT clock for systems with PMU-enabled chipcommon */
@@ -507,6 +531,37 @@
507#define BCMA_CHIPCTL_5357_I2S_PINS_ENABLE BIT(18) 531#define BCMA_CHIPCTL_5357_I2S_PINS_ENABLE BIT(18)
508#define BCMA_CHIPCTL_5357_I2CSPI_PINS_ENABLE BIT(19) 532#define BCMA_CHIPCTL_5357_I2CSPI_PINS_ENABLE BIT(19)
509 533
534#define BCMA_RES_4314_LPLDO_PU BIT(0)
535#define BCMA_RES_4314_PMU_SLEEP_DIS BIT(1)
536#define BCMA_RES_4314_PMU_BG_PU BIT(2)
537#define BCMA_RES_4314_CBUCK_LPOM_PU BIT(3)
538#define BCMA_RES_4314_CBUCK_PFM_PU BIT(4)
539#define BCMA_RES_4314_CLDO_PU BIT(5)
540#define BCMA_RES_4314_LPLDO2_LVM BIT(6)
541#define BCMA_RES_4314_WL_PMU_PU BIT(7)
542#define BCMA_RES_4314_LNLDO_PU BIT(8)
543#define BCMA_RES_4314_LDO3P3_PU BIT(9)
544#define BCMA_RES_4314_OTP_PU BIT(10)
545#define BCMA_RES_4314_XTAL_PU BIT(11)
546#define BCMA_RES_4314_WL_PWRSW_PU BIT(12)
547#define BCMA_RES_4314_LQ_AVAIL BIT(13)
548#define BCMA_RES_4314_LOGIC_RET BIT(14)
549#define BCMA_RES_4314_MEM_SLEEP BIT(15)
550#define BCMA_RES_4314_MACPHY_RET BIT(16)
551#define BCMA_RES_4314_WL_CORE_READY BIT(17)
552#define BCMA_RES_4314_ILP_REQ BIT(18)
553#define BCMA_RES_4314_ALP_AVAIL BIT(19)
554#define BCMA_RES_4314_MISC_PWRSW_PU BIT(20)
555#define BCMA_RES_4314_SYNTH_PWRSW_PU BIT(21)
556#define BCMA_RES_4314_RX_PWRSW_PU BIT(22)
557#define BCMA_RES_4314_RADIO_PU BIT(23)
558#define BCMA_RES_4314_VCO_LDO_PU BIT(24)
559#define BCMA_RES_4314_AFE_LDO_PU BIT(25)
560#define BCMA_RES_4314_RX_LDO_PU BIT(26)
561#define BCMA_RES_4314_TX_LDO_PU BIT(27)
562#define BCMA_RES_4314_HT_AVAIL BIT(28)
563#define BCMA_RES_4314_MACPHY_CLK_AVAIL BIT(29)
564
510/* Data for the PMU, if available. 565/* Data for the PMU, if available.
511 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) 566 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU)
512 */ 567 */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index ef24466d8f82..ec48bac5b039 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -97,11 +97,11 @@ static inline void *bio_data(struct bio *bio)
97 * permanent PIO fall back, user is probably better off disabling highmem 97 * permanent PIO fall back, user is probably better off disabling highmem
98 * I/O completely on that queue (see ide-dma for example) 98 * I/O completely on that queue (see ide-dma for example)
99 */ 99 */
100#define __bio_kmap_atomic(bio, idx, kmtype) \ 100#define __bio_kmap_atomic(bio, idx) \
101 (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \ 101 (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \
102 bio_iovec_idx((bio), (idx))->bv_offset) 102 bio_iovec_idx((bio), (idx))->bv_offset)
103 103
104#define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr) 104#define __bio_kunmap_atomic(addr) kunmap_atomic(addr)
105 105
106/* 106/*
107 * merge helpers etc 107 * merge helpers etc
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 5f0b0e1f7c08..f1f07d31a3af 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -44,8 +44,8 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
44 unsigned long endpfn); 44 unsigned long endpfn);
45extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); 45extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
46 46
47extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
48extern unsigned long free_all_bootmem(void); 47extern unsigned long free_all_bootmem(void);
48extern void reset_all_zones_managed_pages(void);
49 49
50extern void free_bootmem_node(pg_data_t *pgdat, 50extern void free_bootmem_node(pg_data_t *pgdat,
51 unsigned long addr, 51 unsigned long addr,
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 9e52b0626b39..91fa9a94ae92 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -139,6 +139,9 @@ BUFFER_FNS(Prio, prio)
139 }) 139 })
140#define page_has_buffers(page) PagePrivate(page) 140#define page_has_buffers(page) PagePrivate(page)
141 141
142void buffer_check_dirty_writeback(struct page *page,
143 bool *dirty, bool *writeback);
144
142/* 145/*
143 * Declarations 146 * Declarations
144 */ 147 */
@@ -198,7 +201,8 @@ extern int buffer_heads_over_limit;
198 * Generic address_space_operations implementations for buffer_head-backed 201 * Generic address_space_operations implementations for buffer_head-backed
199 * address_spaces. 202 * address_spaces.
200 */ 203 */
201void block_invalidatepage(struct page *page, unsigned long offset); 204void block_invalidatepage(struct page *page, unsigned int offset,
205 unsigned int length);
202int block_write_full_page(struct page *page, get_block_t *get_block, 206int block_write_full_page(struct page *page, get_block_t *get_block,
203 struct writeback_control *wbc); 207 struct writeback_control *wbc);
204int block_write_full_page_endio(struct page *page, get_block_t *get_block, 208int block_write_full_page_endio(struct page *page, get_block_t *get_block,
diff --git a/include/linux/can/platform/flexcan.h b/include/linux/can/platform/flexcan.h
deleted file mode 100644
index 72b713ab57e9..000000000000
--- a/include/linux/can/platform/flexcan.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Copyright (C) 2010 Marc Kleine-Budde <kernel@pengutronix.de>
3 *
4 * This file is released under the GPLv2
5 *
6 */
7
8#ifndef __CAN_PLATFORM_FLEXCAN_H
9#define __CAN_PLATFORM_FLEXCAN_H
10
11/**
12 * struct flexcan_platform_data - flex CAN controller platform data
13 * @transceiver_enable: - called to power on/off the transceiver
14 *
15 */
16struct flexcan_platform_data {
17 void (*transceiver_switch)(int enable);
18};
19
20#endif /* __CAN_PLATFORM_FLEXCAN_H */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 8bda1294c035..e9ac882868c0 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -20,6 +20,7 @@
20#include <linux/workqueue.h> 20#include <linux/workqueue.h>
21#include <linux/xattr.h> 21#include <linux/xattr.h>
22#include <linux/fs.h> 22#include <linux/fs.h>
23#include <linux/percpu-refcount.h>
23 24
24#ifdef CONFIG_CGROUPS 25#ifdef CONFIG_CGROUPS
25 26
@@ -72,13 +73,8 @@ struct cgroup_subsys_state {
72 */ 73 */
73 struct cgroup *cgroup; 74 struct cgroup *cgroup;
74 75
75 /* 76 /* reference count - access via css_[try]get() and css_put() */
76 * State maintained by the cgroup system to allow subsystems 77 struct percpu_ref refcnt;
77 * to be "busy". Should be accessed via css_get(),
78 * css_tryget() and css_put().
79 */
80
81 atomic_t refcnt;
82 78
83 unsigned long flags; 79 unsigned long flags;
84 /* ID for this css, if possible */ 80 /* ID for this css, if possible */
@@ -94,56 +90,52 @@ enum {
94 CSS_ONLINE = (1 << 1), /* between ->css_online() and ->css_offline() */ 90 CSS_ONLINE = (1 << 1), /* between ->css_online() and ->css_offline() */
95}; 91};
96 92
97/* Caller must verify that the css is not for root cgroup */ 93/**
98static inline void __css_get(struct cgroup_subsys_state *css, int count) 94 * css_get - obtain a reference on the specified css
99{ 95 * @css: target css
100 atomic_add(count, &css->refcnt); 96 *
101} 97 * The caller must already have a reference.
102
103/*
104 * Call css_get() to hold a reference on the css; it can be used
105 * for a reference obtained via:
106 * - an existing ref-counted reference to the css
107 * - task->cgroups for a locked task
108 */ 98 */
109
110static inline void css_get(struct cgroup_subsys_state *css) 99static inline void css_get(struct cgroup_subsys_state *css)
111{ 100{
112 /* We don't need to reference count the root state */ 101 /* We don't need to reference count the root state */
113 if (!(css->flags & CSS_ROOT)) 102 if (!(css->flags & CSS_ROOT))
114 __css_get(css, 1); 103 percpu_ref_get(&css->refcnt);
115} 104}
116 105
117/* 106/**
118 * Call css_tryget() to take a reference on a css if your existing 107 * css_tryget - try to obtain a reference on the specified css
119 * (known-valid) reference isn't already ref-counted. Returns false if 108 * @css: target css
120 * the css has been destroyed. 109 *
110 * Obtain a reference on @css if it's alive. The caller naturally needs to
111 * ensure that @css is accessible but doesn't have to be holding a
112 * reference on it - IOW, RCU protected access is good enough for this
113 * function. Returns %true if a reference count was successfully obtained;
114 * %false otherwise.
121 */ 115 */
122
123extern bool __css_tryget(struct cgroup_subsys_state *css);
124static inline bool css_tryget(struct cgroup_subsys_state *css) 116static inline bool css_tryget(struct cgroup_subsys_state *css)
125{ 117{
126 if (css->flags & CSS_ROOT) 118 if (css->flags & CSS_ROOT)
127 return true; 119 return true;
128 return __css_tryget(css); 120 return percpu_ref_tryget(&css->refcnt);
129} 121}
130 122
131/* 123/**
132 * css_put() should be called to release a reference taken by 124 * css_put - put a css reference
133 * css_get() or css_tryget() 125 * @css: target css
126 *
127 * Put a reference obtained via css_get() and css_tryget().
134 */ 128 */
135
136extern void __css_put(struct cgroup_subsys_state *css);
137static inline void css_put(struct cgroup_subsys_state *css) 129static inline void css_put(struct cgroup_subsys_state *css)
138{ 130{
139 if (!(css->flags & CSS_ROOT)) 131 if (!(css->flags & CSS_ROOT))
140 __css_put(css); 132 percpu_ref_put(&css->refcnt);
141} 133}
142 134
143/* bits in struct cgroup flags field */ 135/* bits in struct cgroup flags field */
144enum { 136enum {
145 /* Control Group is dead */ 137 /* Control Group is dead */
146 CGRP_REMOVED, 138 CGRP_DEAD,
147 /* 139 /*
148 * Control Group has previously had a child cgroup or a task, 140 * Control Group has previously had a child cgroup or a task,
149 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) 141 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
@@ -169,12 +161,6 @@ struct cgroup_name {
169struct cgroup { 161struct cgroup {
170 unsigned long flags; /* "unsigned long" so bitops work */ 162 unsigned long flags; /* "unsigned long" so bitops work */
171 163
172 /*
173 * count users of this cgroup. >0 means busy, but doesn't
174 * necessarily indicate the number of tasks in the cgroup
175 */
176 atomic_t count;
177
178 int id; /* ida allocated in-hierarchy ID */ 164 int id; /* ida allocated in-hierarchy ID */
179 165
180 /* 166 /*
@@ -189,6 +175,14 @@ struct cgroup {
189 struct dentry *dentry; /* cgroup fs entry, RCU protected */ 175 struct dentry *dentry; /* cgroup fs entry, RCU protected */
190 176
191 /* 177 /*
178 * Monotonically increasing unique serial number which defines a
179 * uniform order among all cgroups. It's guaranteed that all
180 * ->children lists are in the ascending order of ->serial_nr.
181 * It's used to allow interrupting and resuming iterations.
182 */
183 u64 serial_nr;
184
185 /*
192 * This is a copy of dentry->d_name, and it's needed because 186 * This is a copy of dentry->d_name, and it's needed because
193 * we can't use dentry->d_name in cgroup_path(). 187 * we can't use dentry->d_name in cgroup_path().
194 * 188 *
@@ -207,13 +201,10 @@ struct cgroup {
207 struct cgroupfs_root *root; 201 struct cgroupfs_root *root;
208 202
209 /* 203 /*
210 * List of cg_cgroup_links pointing at css_sets with 204 * List of cgrp_cset_links pointing at css_sets with tasks in this
211 * tasks in this cgroup. Protected by css_set_lock 205 * cgroup. Protected by css_set_lock.
212 */ 206 */
213 struct list_head css_sets; 207 struct list_head cset_links;
214
215 struct list_head allcg_node; /* cgroupfs_root->allcg_list */
216 struct list_head cft_q_node; /* used during cftype add/rm */
217 208
218 /* 209 /*
219 * Linked list running through all cgroups that can 210 * Linked list running through all cgroups that can
@@ -229,9 +220,10 @@ struct cgroup {
229 struct list_head pidlists; 220 struct list_head pidlists;
230 struct mutex pidlist_mutex; 221 struct mutex pidlist_mutex;
231 222
232 /* For RCU-protected deletion */ 223 /* For css percpu_ref killing and RCU-protected deletion */
233 struct rcu_head rcu_head; 224 struct rcu_head rcu_head;
234 struct work_struct free_work; 225 struct work_struct destroy_work;
226 atomic_t css_kill_cnt;
235 227
236 /* List of events which userspace want to receive */ 228 /* List of events which userspace want to receive */
237 struct list_head event_list; 229 struct list_head event_list;
@@ -269,18 +261,35 @@ enum {
269 * 261 *
270 * - Remount is disallowed. 262 * - Remount is disallowed.
271 * 263 *
264 * - rename(2) is disallowed.
265 *
266 * - "tasks" is removed. Everything should be at process
267 * granularity. Use "cgroup.procs" instead.
268 *
269 * - "release_agent" and "notify_on_release" are removed.
270 * Replacement notification mechanism will be implemented.
271 *
272 * - cpuset: tasks will be kept in empty cpusets when hotplug happens
273 * and take masks of ancestors with non-empty cpus/mems, instead of
274 * being moved to an ancestor.
275 *
276 * - cpuset: a task can be moved into an empty cpuset, and again it
277 * takes masks of ancestors.
278 *
272 * - memcg: use_hierarchy is on by default and the cgroup file for 279 * - memcg: use_hierarchy is on by default and the cgroup file for
273 * the flag is not created. 280 * the flag is not created.
274 * 281 *
275 * The followings are planned changes. 282 * - blkcg: blk-throttle becomes properly hierarchical.
276 *
277 * - release_agent will be disallowed once replacement notification
278 * mechanism is implemented.
279 */ 283 */
280 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0), 284 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0),
281 285
282 CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */ 286 CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */
283 CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */ 287 CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */
288
289 /* mount options live below bit 16 */
290 CGRP_ROOT_OPTION_MASK = (1 << 16) - 1,
291
292 CGRP_ROOT_SUBSYS_BOUND = (1 << 16), /* subsystems finished binding */
284}; 293};
285 294
286/* 295/*
@@ -291,18 +300,12 @@ enum {
291struct cgroupfs_root { 300struct cgroupfs_root {
292 struct super_block *sb; 301 struct super_block *sb;
293 302
294 /* 303 /* The bitmask of subsystems attached to this hierarchy */
295 * The bitmask of subsystems intended to be attached to this
296 * hierarchy
297 */
298 unsigned long subsys_mask; 304 unsigned long subsys_mask;
299 305
300 /* Unique id for this hierarchy. */ 306 /* Unique id for this hierarchy. */
301 int hierarchy_id; 307 int hierarchy_id;
302 308
303 /* The bitmask of subsystems currently attached to this hierarchy */
304 unsigned long actual_subsys_mask;
305
306 /* A list running through the attached subsystems */ 309 /* A list running through the attached subsystems */
307 struct list_head subsys_list; 310 struct list_head subsys_list;
308 311
@@ -315,9 +318,6 @@ struct cgroupfs_root {
315 /* A list running through the active hierarchies */ 318 /* A list running through the active hierarchies */
316 struct list_head root_list; 319 struct list_head root_list;
317 320
318 /* All cgroups on this root, cgroup_mutex protected */
319 struct list_head allcg_list;
320
321 /* Hierarchy-specific flags */ 321 /* Hierarchy-specific flags */
322 unsigned long flags; 322 unsigned long flags;
323 323
@@ -357,11 +357,10 @@ struct css_set {
357 struct list_head tasks; 357 struct list_head tasks;
358 358
359 /* 359 /*
360 * List of cg_cgroup_link objects on link chains from 360 * List of cgrp_cset_links pointing at cgroups referenced from this
361 * cgroups referenced from this css_set. Protected by 361 * css_set. Protected by css_set_lock.
362 * css_set_lock
363 */ 362 */
364 struct list_head cg_links; 363 struct list_head cgrp_links;
365 364
366 /* 365 /*
367 * Set of subsystem states, one for each subsystem. This array 366 * Set of subsystem states, one for each subsystem. This array
@@ -394,9 +393,11 @@ struct cgroup_map_cb {
394 */ 393 */
395 394
396/* cftype->flags */ 395/* cftype->flags */
397#define CFTYPE_ONLY_ON_ROOT (1U << 0) /* only create on root cg */ 396enum {
398#define CFTYPE_NOT_ON_ROOT (1U << 1) /* don't create on root cg */ 397 CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cg */
399#define CFTYPE_INSANE (1U << 2) /* don't create if sane_behavior */ 398 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cg */
399 CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */
400};
400 401
401#define MAX_CFTYPE_NAME 64 402#define MAX_CFTYPE_NAME 64
402 403
@@ -442,13 +443,13 @@ struct cftype {
442 * entry. The key/value pairs (and their ordering) should not 443 * entry. The key/value pairs (and their ordering) should not
443 * change between reboots. 444 * change between reboots.
444 */ 445 */
445 int (*read_map)(struct cgroup *cont, struct cftype *cft, 446 int (*read_map)(struct cgroup *cgrp, struct cftype *cft,
446 struct cgroup_map_cb *cb); 447 struct cgroup_map_cb *cb);
447 /* 448 /*
448 * read_seq_string() is used for outputting a simple sequence 449 * read_seq_string() is used for outputting a simple sequence
449 * using seqfile. 450 * using seqfile.
450 */ 451 */
451 int (*read_seq_string)(struct cgroup *cont, struct cftype *cft, 452 int (*read_seq_string)(struct cgroup *cgrp, struct cftype *cft,
452 struct seq_file *m); 453 struct seq_file *m);
453 454
454 ssize_t (*write)(struct cgroup *cgrp, struct cftype *cft, 455 ssize_t (*write)(struct cgroup *cgrp, struct cftype *cft,
@@ -538,10 +539,10 @@ static inline const char *cgroup_name(const struct cgroup *cgrp)
538int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 539int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
539int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 540int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
540 541
541int cgroup_is_removed(const struct cgroup *cgrp);
542bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); 542bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);
543 543
544int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen); 544int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
545int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen);
545 546
546int cgroup_task_count(const struct cgroup *cgrp); 547int cgroup_task_count(const struct cgroup *cgrp);
547 548
@@ -646,22 +647,60 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(
646 return cgrp->subsys[subsys_id]; 647 return cgrp->subsys[subsys_id];
647} 648}
648 649
649/* 650/**
650 * function to get the cgroup_subsys_state which allows for extra 651 * task_css_set_check - obtain a task's css_set with extra access conditions
651 * rcu_dereference_check() conditions, such as locks used during the 652 * @task: the task to obtain css_set for
652 * cgroup_subsys::attach() methods. 653 * @__c: extra condition expression to be passed to rcu_dereference_check()
654 *
655 * A task's css_set is RCU protected, initialized and exited while holding
656 * task_lock(), and can only be modified while holding both cgroup_mutex
657 * and task_lock() while the task is alive. This macro verifies that the
658 * caller is inside proper critical section and returns @task's css_set.
659 *
660 * The caller can also specify additional allowed conditions via @__c, such
661 * as locks used during the cgroup_subsys::attach() methods.
653 */ 662 */
654#ifdef CONFIG_PROVE_RCU 663#ifdef CONFIG_PROVE_RCU
655extern struct mutex cgroup_mutex; 664extern struct mutex cgroup_mutex;
656#define task_subsys_state_check(task, subsys_id, __c) \ 665#define task_css_set_check(task, __c) \
657 rcu_dereference_check((task)->cgroups->subsys[(subsys_id)], \ 666 rcu_dereference_check((task)->cgroups, \
658 lockdep_is_held(&(task)->alloc_lock) || \ 667 lockdep_is_held(&(task)->alloc_lock) || \
659 lockdep_is_held(&cgroup_mutex) || (__c)) 668 lockdep_is_held(&cgroup_mutex) || (__c))
660#else 669#else
661#define task_subsys_state_check(task, subsys_id, __c) \ 670#define task_css_set_check(task, __c) \
662 rcu_dereference((task)->cgroups->subsys[(subsys_id)]) 671 rcu_dereference((task)->cgroups)
663#endif 672#endif
664 673
674/**
675 * task_subsys_state_check - obtain css for (task, subsys) w/ extra access conds
676 * @task: the target task
677 * @subsys_id: the target subsystem ID
678 * @__c: extra condition expression to be passed to rcu_dereference_check()
679 *
680 * Return the cgroup_subsys_state for the (@task, @subsys_id) pair. The
681 * synchronization rules are the same as task_css_set_check().
682 */
683#define task_subsys_state_check(task, subsys_id, __c) \
684 task_css_set_check((task), (__c))->subsys[(subsys_id)]
685
686/**
687 * task_css_set - obtain a task's css_set
688 * @task: the task to obtain css_set for
689 *
690 * See task_css_set_check().
691 */
692static inline struct css_set *task_css_set(struct task_struct *task)
693{
694 return task_css_set_check(task, false);
695}
696
697/**
698 * task_subsys_state - obtain css for (task, subsys)
699 * @task: the target task
700 * @subsys_id: the target subsystem ID
701 *
702 * See task_subsys_state_check().
703 */
665static inline struct cgroup_subsys_state * 704static inline struct cgroup_subsys_state *
666task_subsys_state(struct task_struct *task, int subsys_id) 705task_subsys_state(struct task_struct *task, int subsys_id)
667{ 706{
@@ -674,12 +713,14 @@ static inline struct cgroup* task_cgroup(struct task_struct *task,
674 return task_subsys_state(task, subsys_id)->cgroup; 713 return task_subsys_state(task, subsys_id)->cgroup;
675} 714}
676 715
716struct cgroup *cgroup_next_sibling(struct cgroup *pos);
717
677/** 718/**
678 * cgroup_for_each_child - iterate through children of a cgroup 719 * cgroup_for_each_child - iterate through children of a cgroup
679 * @pos: the cgroup * to use as the loop cursor 720 * @pos: the cgroup * to use as the loop cursor
680 * @cgroup: cgroup whose children to walk 721 * @cgrp: cgroup whose children to walk
681 * 722 *
682 * Walk @cgroup's children. Must be called under rcu_read_lock(). A child 723 * Walk @cgrp's children. Must be called under rcu_read_lock(). A child
683 * cgroup which hasn't finished ->css_online() or already has finished 724 * cgroup which hasn't finished ->css_online() or already has finished
684 * ->css_offline() may show up during traversal and it's each subsystem's 725 * ->css_offline() may show up during traversal and it's each subsystem's
685 * responsibility to verify that each @pos is alive. 726 * responsibility to verify that each @pos is alive.
@@ -687,9 +728,15 @@ static inline struct cgroup* task_cgroup(struct task_struct *task,
687 * If a subsystem synchronizes against the parent in its ->css_online() and 728 * If a subsystem synchronizes against the parent in its ->css_online() and
688 * before starting iterating, a cgroup which finished ->css_online() is 729 * before starting iterating, a cgroup which finished ->css_online() is
689 * guaranteed to be visible in the future iterations. 730 * guaranteed to be visible in the future iterations.
731 *
732 * It is allowed to temporarily drop RCU read lock during iteration. The
733 * caller is responsible for ensuring that @pos remains accessible until
734 * the start of the next iteration by, for example, bumping the css refcnt.
690 */ 735 */
691#define cgroup_for_each_child(pos, cgroup) \ 736#define cgroup_for_each_child(pos, cgrp) \
692 list_for_each_entry_rcu(pos, &(cgroup)->children, sibling) 737 for ((pos) = list_first_or_null_rcu(&(cgrp)->children, \
738 struct cgroup, sibling); \
739 (pos); (pos) = cgroup_next_sibling((pos)))
693 740
694struct cgroup *cgroup_next_descendant_pre(struct cgroup *pos, 741struct cgroup *cgroup_next_descendant_pre(struct cgroup *pos,
695 struct cgroup *cgroup); 742 struct cgroup *cgroup);
@@ -748,6 +795,10 @@ struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos);
748 * Alternatively, a subsystem may choose to use a single global lock to 795 * Alternatively, a subsystem may choose to use a single global lock to
749 * synchronize ->css_online() and ->css_offline() against tree-walking 796 * synchronize ->css_online() and ->css_offline() against tree-walking
750 * operations. 797 * operations.
798 *
799 * It is allowed to temporarily drop RCU read lock during iteration. The
800 * caller is responsible for ensuring that @pos remains accessible until
801 * the start of the next iteration by, for example, bumping the css refcnt.
751 */ 802 */
752#define cgroup_for_each_descendant_pre(pos, cgroup) \ 803#define cgroup_for_each_descendant_pre(pos, cgroup) \
753 for (pos = cgroup_next_descendant_pre(NULL, (cgroup)); (pos); \ 804 for (pos = cgroup_next_descendant_pre(NULL, (cgroup)); (pos); \
@@ -771,7 +822,7 @@ struct cgroup *cgroup_next_descendant_post(struct cgroup *pos,
771 822
772/* A cgroup_iter should be treated as an opaque object */ 823/* A cgroup_iter should be treated as an opaque object */
773struct cgroup_iter { 824struct cgroup_iter {
774 struct list_head *cg_link; 825 struct list_head *cset_link;
775 struct list_head *task; 826 struct list_head *task;
776}; 827};
777 828
@@ -827,7 +878,6 @@ bool css_is_ancestor(struct cgroup_subsys_state *cg,
827 878
828/* Get id and depth of css */ 879/* Get id and depth of css */
829unsigned short css_id(struct cgroup_subsys_state *css); 880unsigned short css_id(struct cgroup_subsys_state *css);
830unsigned short css_depth(struct cgroup_subsys_state *css);
831struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id); 881struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
832 882
833#else /* !CONFIG_CGROUPS */ 883#else /* !CONFIG_CGROUPS */
@@ -838,8 +888,6 @@ static inline void cgroup_fork(struct task_struct *p) {}
838static inline void cgroup_post_fork(struct task_struct *p) {} 888static inline void cgroup_post_fork(struct task_struct *p) {}
839static inline void cgroup_exit(struct task_struct *p, int callbacks) {} 889static inline void cgroup_exit(struct task_struct *p, int callbacks) {}
840 890
841static inline void cgroup_lock(void) {}
842static inline void cgroup_unlock(void) {}
843static inline int cgroupstats_build(struct cgroupstats *stats, 891static inline int cgroupstats_build(struct cgroupstats *stats,
844 struct dentry *dentry) 892 struct dentry *dentry)
845{ 893{
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 6e7ec64b69ab..b613ffd402d1 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -1,86 +1,55 @@
1/* Add subsystem definitions of the form SUBSYS(<name>) in this 1/*
2 * file. Surround each one by a line of comment markers so that 2 * List of cgroup subsystems.
3 * patches don't collide 3 *
4 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS.
4 */ 5 */
5
6/* */
7
8/* */
9
10#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS) 6#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS)
11SUBSYS(cpuset) 7SUBSYS(cpuset)
12#endif 8#endif
13 9
14/* */
15
16#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG) 10#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG)
17SUBSYS(debug) 11SUBSYS(debug)
18#endif 12#endif
19 13
20/* */
21
22#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED) 14#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED)
23SUBSYS(cpu_cgroup) 15SUBSYS(cpu_cgroup)
24#endif 16#endif
25 17
26/* */
27
28#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT) 18#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT)
29SUBSYS(cpuacct) 19SUBSYS(cpuacct)
30#endif 20#endif
31 21
32/* */
33
34#if IS_SUBSYS_ENABLED(CONFIG_MEMCG) 22#if IS_SUBSYS_ENABLED(CONFIG_MEMCG)
35SUBSYS(mem_cgroup) 23SUBSYS(mem_cgroup)
36#endif 24#endif
37 25
38/* */
39
40#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE) 26#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE)
41SUBSYS(devices) 27SUBSYS(devices)
42#endif 28#endif
43 29
44/* */
45
46#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER) 30#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER)
47SUBSYS(freezer) 31SUBSYS(freezer)
48#endif 32#endif
49 33
50/* */
51
52#if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP) 34#if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP)
53SUBSYS(net_cls) 35SUBSYS(net_cls)
54#endif 36#endif
55 37
56/* */
57
58#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP) 38#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP)
59SUBSYS(blkio) 39SUBSYS(blkio)
60#endif 40#endif
61 41
62/* */
63
64#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF) 42#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF)
65SUBSYS(perf) 43SUBSYS(perf)
66#endif 44#endif
67 45
68/* */
69
70#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP) 46#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP)
71SUBSYS(net_prio) 47SUBSYS(net_prio)
72#endif 48#endif
73 49
74/* */
75
76#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB) 50#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB)
77SUBSYS(hugetlb) 51SUBSYS(hugetlb)
78#endif 52#endif
79 53/*
80/* */ 54 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS.
81 55 */
82#ifdef CONFIG_CGROUP_BCACHE
83SUBSYS(bcache)
84#endif
85
86/* */
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 11860985fecb..1ec14a732176 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -210,6 +210,10 @@ void of_fixed_clk_setup(struct device_node *np);
210 * CLK_GATE_SET_TO_DISABLE - by default this clock sets the bit at bit_idx to 210 * CLK_GATE_SET_TO_DISABLE - by default this clock sets the bit at bit_idx to
211 * enable the clock. Setting this flag does the opposite: setting the bit 211 * enable the clock. Setting this flag does the opposite: setting the bit
212 * disable the clock and clearing it enables the clock 212 * disable the clock and clearing it enables the clock
213 * CLK_GATE_HIWORD_MASK - The gate settings are only in lower 16-bit
214 * of this register, and mask of gate bits are in higher 16-bit of this
215 * register. While setting the gate bits, higher 16-bit should also be
216 * updated to indicate changing gate bits.
213 */ 217 */
214struct clk_gate { 218struct clk_gate {
215 struct clk_hw hw; 219 struct clk_hw hw;
@@ -220,6 +224,7 @@ struct clk_gate {
220}; 224};
221 225
222#define CLK_GATE_SET_TO_DISABLE BIT(0) 226#define CLK_GATE_SET_TO_DISABLE BIT(0)
227#define CLK_GATE_HIWORD_MASK BIT(1)
223 228
224extern const struct clk_ops clk_gate_ops; 229extern const struct clk_ops clk_gate_ops;
225struct clk *clk_register_gate(struct device *dev, const char *name, 230struct clk *clk_register_gate(struct device *dev, const char *name,
@@ -257,6 +262,10 @@ struct clk_div_table {
257 * Some hardware implementations gracefully handle this case and allow a 262 * Some hardware implementations gracefully handle this case and allow a
258 * zero divisor by not modifying their input clock 263 * zero divisor by not modifying their input clock
259 * (divide by one / bypass). 264 * (divide by one / bypass).
265 * CLK_DIVIDER_HIWORD_MASK - The divider settings are only in lower 16-bit
266 * of this register, and mask of divider bits are in higher 16-bit of this
267 * register. While setting the divider bits, higher 16-bit should also be
268 * updated to indicate changing divider bits.
260 */ 269 */
261struct clk_divider { 270struct clk_divider {
262 struct clk_hw hw; 271 struct clk_hw hw;
@@ -271,6 +280,7 @@ struct clk_divider {
271#define CLK_DIVIDER_ONE_BASED BIT(0) 280#define CLK_DIVIDER_ONE_BASED BIT(0)
272#define CLK_DIVIDER_POWER_OF_TWO BIT(1) 281#define CLK_DIVIDER_POWER_OF_TWO BIT(1)
273#define CLK_DIVIDER_ALLOW_ZERO BIT(2) 282#define CLK_DIVIDER_ALLOW_ZERO BIT(2)
283#define CLK_DIVIDER_HIWORD_MASK BIT(3)
274 284
275extern const struct clk_ops clk_divider_ops; 285extern const struct clk_ops clk_divider_ops;
276struct clk *clk_register_divider(struct device *dev, const char *name, 286struct clk *clk_register_divider(struct device *dev, const char *name,
@@ -299,6 +309,10 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name,
299 * Flags: 309 * Flags:
300 * CLK_MUX_INDEX_ONE - register index starts at 1, not 0 310 * CLK_MUX_INDEX_ONE - register index starts at 1, not 0
301 * CLK_MUX_INDEX_BIT - register index is a single bit (power of two) 311 * CLK_MUX_INDEX_BIT - register index is a single bit (power of two)
312 * CLK_MUX_HIWORD_MASK - The mux settings are only in lower 16-bit of this
313 * register, and mask of mux bits are in higher 16-bit of this register.
314 * While setting the mux bits, higher 16-bit should also be updated to
315 * indicate changing mux bits.
302 */ 316 */
303struct clk_mux { 317struct clk_mux {
304 struct clk_hw hw; 318 struct clk_hw hw;
@@ -312,6 +326,7 @@ struct clk_mux {
312 326
313#define CLK_MUX_INDEX_ONE BIT(0) 327#define CLK_MUX_INDEX_ONE BIT(0)
314#define CLK_MUX_INDEX_BIT BIT(1) 328#define CLK_MUX_INDEX_BIT BIT(1)
329#define CLK_MUX_HIWORD_MASK BIT(2)
315 330
316extern const struct clk_ops clk_mux_ops; 331extern const struct clk_ops clk_mux_ops;
317 332
@@ -423,6 +438,17 @@ struct of_device_id;
423 438
424typedef void (*of_clk_init_cb_t)(struct device_node *); 439typedef void (*of_clk_init_cb_t)(struct device_node *);
425 440
441struct clk_onecell_data {
442 struct clk **clks;
443 unsigned int clk_num;
444};
445
446#define CLK_OF_DECLARE(name, compat, fn) \
447 static const struct of_device_id __clk_of_table_##name \
448 __used __section(__clk_of_table) \
449 = { .compatible = compat, .data = fn };
450
451#ifdef CONFIG_OF
426int of_clk_add_provider(struct device_node *np, 452int of_clk_add_provider(struct device_node *np,
427 struct clk *(*clk_src_get)(struct of_phandle_args *args, 453 struct clk *(*clk_src_get)(struct of_phandle_args *args,
428 void *data), 454 void *data),
@@ -430,19 +456,39 @@ int of_clk_add_provider(struct device_node *np,
430void of_clk_del_provider(struct device_node *np); 456void of_clk_del_provider(struct device_node *np);
431struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, 457struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
432 void *data); 458 void *data);
433struct clk_onecell_data {
434 struct clk **clks;
435 unsigned int clk_num;
436};
437struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); 459struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
438const char *of_clk_get_parent_name(struct device_node *np, int index); 460const char *of_clk_get_parent_name(struct device_node *np, int index);
439 461
440void of_clk_init(const struct of_device_id *matches); 462void of_clk_init(const struct of_device_id *matches);
441 463
442#define CLK_OF_DECLARE(name, compat, fn) \ 464#else /* !CONFIG_OF */
443 static const struct of_device_id __clk_of_table_##name \
444 __used __section(__clk_of_table) \
445 = { .compatible = compat, .data = fn };
446 465
466static inline int of_clk_add_provider(struct device_node *np,
467 struct clk *(*clk_src_get)(struct of_phandle_args *args,
468 void *data),
469 void *data)
470{
471 return 0;
472}
473#define of_clk_del_provider(np) \
474 { while (0); }
475static inline struct clk *of_clk_src_simple_get(
476 struct of_phandle_args *clkspec, void *data)
477{
478 return ERR_PTR(-ENOENT);
479}
480static inline struct clk *of_clk_src_onecell_get(
481 struct of_phandle_args *clkspec, void *data)
482{
483 return ERR_PTR(-ENOENT);
484}
485static inline const char *of_clk_get_parent_name(struct device_node *np,
486 int index)
487{
488 return NULL;
489}
490#define of_clk_init(matches) \
491 { while (0); }
492#endif /* CONFIG_OF */
447#endif /* CONFIG_COMMON_CLK */ 493#endif /* CONFIG_COMMON_CLK */
448#endif /* CLK_PROVIDER_H */ 494#endif /* CLK_PROVIDER_H */
diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h
index 642789baec74..23a0ceee831f 100644
--- a/include/linux/clk/tegra.h
+++ b/include/linux/clk/tegra.h
@@ -120,9 +120,13 @@ static inline void tegra_cpu_clock_resume(void)
120} 120}
121#endif 121#endif
122 122
123#ifdef CONFIG_ARCH_TEGRA
123void tegra_periph_reset_deassert(struct clk *c); 124void tegra_periph_reset_deassert(struct clk *c);
124void tegra_periph_reset_assert(struct clk *c); 125void tegra_periph_reset_assert(struct clk *c);
125void tegra_clocks_init(void); 126#else
127static inline void tegra_periph_reset_deassert(struct clk *c) {}
128static inline void tegra_periph_reset_assert(struct clk *c) {}
129#endif
126void tegra_clocks_apply_init_table(void); 130void tegra_clocks_apply_init_table(void);
127 131
128#endif /* __LINUX_CLK_TEGRA_H_ */ 132#endif /* __LINUX_CLK_TEGRA_H_ */
diff --git a/include/linux/clk/zynq.h b/include/linux/clk/zynq.h
index 56be7cd9aa8b..e062d317ccce 100644
--- a/include/linux/clk/zynq.h
+++ b/include/linux/clk/zynq.h
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (C) 2013 Xilinx Inc.
2 * Copyright (C) 2012 National Instruments 3 * Copyright (C) 2012 National Instruments
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
@@ -19,6 +20,11 @@
19#ifndef __LINUX_CLK_ZYNQ_H_ 20#ifndef __LINUX_CLK_ZYNQ_H_
20#define __LINUX_CLK_ZYNQ_H_ 21#define __LINUX_CLK_ZYNQ_H_
21 22
22void __init xilinx_zynq_clocks_init(void __iomem *slcr); 23#include <linux/spinlock.h>
23 24
25void zynq_clock_init(void __iomem *slcr);
26
27struct clk *clk_register_zynq_pll(const char *name, const char *parent,
28 void __iomem *pll_ctrl, void __iomem *pll_status, u8 lock_index,
29 spinlock_t *lock);
24#endif 30#endif
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 963d71431388..0857922e8ad0 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -30,6 +30,7 @@ enum clock_event_nofitiers {
30#include <linux/notifier.h> 30#include <linux/notifier.h>
31 31
32struct clock_event_device; 32struct clock_event_device;
33struct module;
33 34
34/* Clock event mode commands */ 35/* Clock event mode commands */
35enum clock_event_mode { 36enum clock_event_mode {
@@ -83,6 +84,7 @@ enum clock_event_mode {
83 * @irq: IRQ number (only for non CPU local devices) 84 * @irq: IRQ number (only for non CPU local devices)
84 * @cpumask: cpumask to indicate for which CPUs this device works 85 * @cpumask: cpumask to indicate for which CPUs this device works
85 * @list: list head for the management code 86 * @list: list head for the management code
87 * @owner: module reference
86 */ 88 */
87struct clock_event_device { 89struct clock_event_device {
88 void (*event_handler)(struct clock_event_device *); 90 void (*event_handler)(struct clock_event_device *);
@@ -112,6 +114,7 @@ struct clock_event_device {
112 int irq; 114 int irq;
113 const struct cpumask *cpumask; 115 const struct cpumask *cpumask;
114 struct list_head list; 116 struct list_head list;
117 struct module *owner;
115} ____cacheline_aligned; 118} ____cacheline_aligned;
116 119
117/* 120/*
@@ -138,6 +141,7 @@ static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec,
138extern u64 clockevent_delta2ns(unsigned long latch, 141extern u64 clockevent_delta2ns(unsigned long latch,
139 struct clock_event_device *evt); 142 struct clock_event_device *evt);
140extern void clockevents_register_device(struct clock_event_device *dev); 143extern void clockevents_register_device(struct clock_event_device *dev);
144extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu);
141 145
142extern void clockevents_config(struct clock_event_device *dev, u32 freq); 146extern void clockevents_config(struct clock_event_device *dev, u32 freq);
143extern void clockevents_config_and_register(struct clock_event_device *dev, 147extern void clockevents_config_and_register(struct clock_event_device *dev,
@@ -150,7 +154,6 @@ extern void clockevents_exchange_device(struct clock_event_device *old,
150 struct clock_event_device *new); 154 struct clock_event_device *new);
151extern void clockevents_set_mode(struct clock_event_device *dev, 155extern void clockevents_set_mode(struct clock_event_device *dev,
152 enum clock_event_mode mode); 156 enum clock_event_mode mode);
153extern int clockevents_register_notifier(struct notifier_block *nb);
154extern int clockevents_program_event(struct clock_event_device *dev, 157extern int clockevents_program_event(struct clock_event_device *dev,
155 ktime_t expires, bool force); 158 ktime_t expires, bool force);
156 159
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 7279b94c01da..dbbf8aa7731b 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -21,6 +21,7 @@
21/* clocksource cycle base type */ 21/* clocksource cycle base type */
22typedef u64 cycle_t; 22typedef u64 cycle_t;
23struct clocksource; 23struct clocksource;
24struct module;
24 25
25#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA 26#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA
26#include <asm/clocksource.h> 27#include <asm/clocksource.h>
@@ -162,6 +163,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
162 * @suspend: suspend function for the clocksource, if necessary 163 * @suspend: suspend function for the clocksource, if necessary
163 * @resume: resume function for the clocksource, if necessary 164 * @resume: resume function for the clocksource, if necessary
164 * @cycle_last: most recent cycle counter value seen by ::read() 165 * @cycle_last: most recent cycle counter value seen by ::read()
166 * @owner: module reference, must be set by clocksource in modules
165 */ 167 */
166struct clocksource { 168struct clocksource {
167 /* 169 /*
@@ -195,6 +197,7 @@ struct clocksource {
195 cycle_t cs_last; 197 cycle_t cs_last;
196 cycle_t wd_last; 198 cycle_t wd_last;
197#endif 199#endif
200 struct module *owner;
198} ____cacheline_aligned; 201} ____cacheline_aligned;
199 202
200/* 203/*
@@ -207,6 +210,7 @@ struct clocksource {
207#define CLOCK_SOURCE_VALID_FOR_HRES 0x20 210#define CLOCK_SOURCE_VALID_FOR_HRES 0x20
208#define CLOCK_SOURCE_UNSTABLE 0x40 211#define CLOCK_SOURCE_UNSTABLE 0x40
209#define CLOCK_SOURCE_SUSPEND_NONSTOP 0x80 212#define CLOCK_SOURCE_SUSPEND_NONSTOP 0x80
213#define CLOCK_SOURCE_RESELECT 0x100
210 214
211/* simplify initialization of mask field */ 215/* simplify initialization of mask field */
212#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) 216#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
@@ -279,7 +283,7 @@ static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
279 283
280 284
281extern int clocksource_register(struct clocksource*); 285extern int clocksource_register(struct clocksource*);
282extern void clocksource_unregister(struct clocksource*); 286extern int clocksource_unregister(struct clocksource*);
283extern void clocksource_touch_watchdog(void); 287extern void clocksource_touch_watchdog(void);
284extern struct clocksource* clocksource_get_next(void); 288extern struct clocksource* clocksource_get_next(void);
285extern void clocksource_change_rating(struct clocksource *cs, int rating); 289extern void clocksource_change_rating(struct clocksource *cs, int rating);
@@ -321,7 +325,7 @@ static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz)
321} 325}
322 326
323 327
324extern void timekeeping_notify(struct clocksource *clock); 328extern int timekeeping_notify(struct clocksource *clock);
325 329
326extern cycle_t clocksource_mmio_readl_up(struct clocksource *); 330extern cycle_t clocksource_mmio_readl_up(struct clocksource *);
327extern cycle_t clocksource_mmio_readl_down(struct clocksource *); 331extern cycle_t clocksource_mmio_readl_down(struct clocksource *);
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 33f0280fd533..3cd574d5b19e 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -5,7 +5,7 @@
5 * (C) Copyright 2001 Linus Torvalds 5 * (C) Copyright 2001 Linus Torvalds
6 * 6 *
7 * Atomic wait-for-completion handler data structures. 7 * Atomic wait-for-completion handler data structures.
8 * See kernel/sched.c for details. 8 * See kernel/sched/core.c for details.
9 */ 9 */
10 10
11#include <linux/wait.h> 11#include <linux/wait.h>
diff --git a/include/linux/console.h b/include/linux/console.h
index 73bab0f58af5..7571a16bd653 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -75,10 +75,7 @@ extern const struct consw newport_con; /* SGI Newport console */
75extern const struct consw prom_con; /* SPARC PROM console */ 75extern const struct consw prom_con; /* SPARC PROM console */
76 76
77int con_is_bound(const struct consw *csw); 77int con_is_bound(const struct consw *csw);
78int register_con_driver(const struct consw *csw, int first, int last);
79int unregister_con_driver(const struct consw *csw);
80int do_unregister_con_driver(const struct consw *csw); 78int do_unregister_con_driver(const struct consw *csw);
81int take_over_console(const struct consw *sw, int first, int last, int deflt);
82int do_take_over_console(const struct consw *sw, int first, int last, int deflt); 79int do_take_over_console(const struct consw *sw, int first, int last, int deflt);
83void give_up_console(const struct consw *sw); 80void give_up_console(const struct consw *sw);
84#ifdef CONFIG_HW_CONSOLE 81#ifdef CONFIG_HW_CONSOLE
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 9f3c7e81270a..ab0eade73039 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -6,9 +6,8 @@
6 * definitions of processors. 6 * definitions of processors.
7 * 7 *
8 * Basic handling of the devices is done in drivers/base/cpu.c 8 * Basic handling of the devices is done in drivers/base/cpu.c
9 * and system devices are handled in drivers/base/sys.c.
10 * 9 *
11 * CPUs are exported via sysfs in the class/cpu/devices/ 10 * CPUs are exported via sysfs in the devices/system/cpu
12 * directory. 11 * directory.
13 */ 12 */
14#ifndef _LINUX_CPU_H_ 13#ifndef _LINUX_CPU_H_
@@ -115,7 +114,7 @@ enum {
115/* Need to know about CPUs going up/down? */ 114/* Need to know about CPUs going up/down? */
116#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) 115#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE)
117#define cpu_notifier(fn, pri) { \ 116#define cpu_notifier(fn, pri) { \
118 static struct notifier_block fn##_nb __cpuinitdata = \ 117 static struct notifier_block fn##_nb = \
119 { .notifier_call = fn, .priority = pri }; \ 118 { .notifier_call = fn, .priority = pri }; \
120 register_cpu_notifier(&fn##_nb); \ 119 register_cpu_notifier(&fn##_nb); \
121} 120}
diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h
index 282e27028418..a5d52eea8232 100644
--- a/include/linux/cpu_cooling.h
+++ b/include/linux/cpu_cooling.h
@@ -41,7 +41,7 @@ cpufreq_cooling_register(const struct cpumask *clip_cpus);
41 */ 41 */
42void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); 42void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
43 43
44unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int); 44unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq);
45#else /* !CONFIG_CPU_THERMAL */ 45#else /* !CONFIG_CPU_THERMAL */
46static inline struct thermal_cooling_device * 46static inline struct thermal_cooling_device *
47cpufreq_cooling_register(const struct cpumask *clip_cpus) 47cpufreq_cooling_register(const struct cpumask *clip_cpus)
@@ -54,7 +54,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
54 return; 54 return;
55} 55}
56static inline 56static inline
57unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int) 57unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq)
58{ 58{
59 return THERMAL_CSTATE_INVALID; 59 return THERMAL_CSTATE_INVALID;
60} 60}
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 037d36ae63e5..90d5a15120d5 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * linux/include/linux/cpufreq.h 2 * linux/include/linux/cpufreq.h
3 * 3 *
4 * Copyright (C) 2001 Russell King 4 * Copyright (C) 2001 Russell King
5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> 5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 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 8 * it under the terms of the GNU General Public License version 2 as
@@ -26,7 +26,6 @@
26/* Print length for names. Extra 1 space for accomodating '\n' in prints */ 26/* Print length for names. Extra 1 space for accomodating '\n' in prints */
27#define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1) 27#define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1)
28 28
29
30/********************************************************************* 29/*********************************************************************
31 * CPUFREQ NOTIFIER INTERFACE * 30 * CPUFREQ NOTIFIER INTERFACE *
32 *********************************************************************/ 31 *********************************************************************/
@@ -71,6 +70,10 @@ struct cpufreq_governor;
71 70
72/* /sys/devices/system/cpu/cpufreq: entry point for global variables */ 71/* /sys/devices/system/cpu/cpufreq: entry point for global variables */
73extern struct kobject *cpufreq_global_kobject; 72extern struct kobject *cpufreq_global_kobject;
73int cpufreq_get_global_kobject(void);
74void cpufreq_put_global_kobject(void);
75int cpufreq_sysfs_create_file(const struct attribute *attr);
76void cpufreq_sysfs_remove_file(const struct attribute *attr);
74 77
75#define CPUFREQ_ETERNAL (-1) 78#define CPUFREQ_ETERNAL (-1)
76struct cpufreq_cpuinfo { 79struct cpufreq_cpuinfo {
@@ -107,6 +110,7 @@ struct cpufreq_policy {
107 unsigned int policy; /* see above */ 110 unsigned int policy; /* see above */
108 struct cpufreq_governor *governor; /* see below */ 111 struct cpufreq_governor *governor; /* see below */
109 void *governor_data; 112 void *governor_data;
113 bool governor_enabled; /* governor start/stop flag */
110 114
111 struct work_struct update; /* if update_policy() needs to be 115 struct work_struct update; /* if update_policy() needs to be
112 * called, but you're in IRQ context */ 116 * called, but you're in IRQ context */
@@ -115,6 +119,7 @@ struct cpufreq_policy {
115 119
116 struct kobject kobj; 120 struct kobject kobj;
117 struct completion kobj_unregister; 121 struct completion kobj_unregister;
122 int transition_ongoing; /* Tracks transition status */
118}; 123};
119 124
120#define CPUFREQ_ADJUST (0) 125#define CPUFREQ_ADJUST (0)
@@ -148,17 +153,18 @@ struct cpufreq_freqs {
148 u8 flags; /* flags of cpufreq_driver, see below. */ 153 u8 flags; /* flags of cpufreq_driver, see below. */
149}; 154};
150 155
151
152/** 156/**
153 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch safe) 157 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch
158 * safe)
154 * @old: old value 159 * @old: old value
155 * @div: divisor 160 * @div: divisor
156 * @mult: multiplier 161 * @mult: multiplier
157 * 162 *
158 * 163 *
159 * new = old * mult / div 164 * new = old * mult / div
160 */ 165 */
161static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mult) 166static inline unsigned long cpufreq_scale(unsigned long old, u_int div,
167 u_int mult)
162{ 168{
163#if BITS_PER_LONG == 32 169#if BITS_PER_LONG == 32
164 170
@@ -211,14 +217,12 @@ extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
211 unsigned int target_freq, 217 unsigned int target_freq,
212 unsigned int relation); 218 unsigned int relation);
213 219
214
215extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy, 220extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy,
216 unsigned int cpu); 221 unsigned int cpu);
217 222
218int cpufreq_register_governor(struct cpufreq_governor *governor); 223int cpufreq_register_governor(struct cpufreq_governor *governor);
219void cpufreq_unregister_governor(struct cpufreq_governor *governor); 224void cpufreq_unregister_governor(struct cpufreq_governor *governor);
220 225
221
222/********************************************************************* 226/*********************************************************************
223 * CPUFREQ DRIVER INTERFACE * 227 * CPUFREQ DRIVER INTERFACE *
224 *********************************************************************/ 228 *********************************************************************/
@@ -229,7 +233,7 @@ void cpufreq_unregister_governor(struct cpufreq_governor *governor);
229struct freq_attr; 233struct freq_attr;
230 234
231struct cpufreq_driver { 235struct cpufreq_driver {
232 struct module *owner; 236 struct module *owner;
233 char name[CPUFREQ_NAME_LEN]; 237 char name[CPUFREQ_NAME_LEN];
234 u8 flags; 238 u8 flags;
235 /* 239 /*
@@ -277,11 +281,11 @@ struct cpufreq_driver {
277int cpufreq_register_driver(struct cpufreq_driver *driver_data); 281int cpufreq_register_driver(struct cpufreq_driver *driver_data);
278int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); 282int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
279 283
280
281void cpufreq_notify_transition(struct cpufreq_policy *policy, 284void cpufreq_notify_transition(struct cpufreq_policy *policy,
282 struct cpufreq_freqs *freqs, unsigned int state); 285 struct cpufreq_freqs *freqs, unsigned int state);
283 286
284static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max) 287static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
288 unsigned int min, unsigned int max)
285{ 289{
286 if (policy->min < min) 290 if (policy->min < min)
287 policy->min = min; 291 policy->min = min;
@@ -337,12 +341,16 @@ const char *cpufreq_get_current_driver(void);
337/********************************************************************* 341/*********************************************************************
338 * CPUFREQ 2.6. INTERFACE * 342 * CPUFREQ 2.6. INTERFACE *
339 *********************************************************************/ 343 *********************************************************************/
344u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);
340int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); 345int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
341int cpufreq_update_policy(unsigned int cpu); 346int cpufreq_update_policy(unsigned int cpu);
342bool have_governor_per_policy(void); 347bool have_governor_per_policy(void);
348struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
343 349
344#ifdef CONFIG_CPU_FREQ 350#ifdef CONFIG_CPU_FREQ
345/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ 351/*
352 * query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it
353 */
346unsigned int cpufreq_get(unsigned int cpu); 354unsigned int cpufreq_get(unsigned int cpu);
347#else 355#else
348static inline unsigned int cpufreq_get(unsigned int cpu) 356static inline unsigned int cpufreq_get(unsigned int cpu)
@@ -351,7 +359,9 @@ static inline unsigned int cpufreq_get(unsigned int cpu)
351} 359}
352#endif 360#endif
353 361
354/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */ 362/*
363 * query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it
364 */
355#ifdef CONFIG_CPU_FREQ 365#ifdef CONFIG_CPU_FREQ
356unsigned int cpufreq_quick_get(unsigned int cpu); 366unsigned int cpufreq_quick_get(unsigned int cpu);
357unsigned int cpufreq_quick_get_max(unsigned int cpu); 367unsigned int cpufreq_quick_get_max(unsigned int cpu);
@@ -366,16 +376,14 @@ static inline unsigned int cpufreq_quick_get_max(unsigned int cpu)
366} 376}
367#endif 377#endif
368 378
369
370/********************************************************************* 379/*********************************************************************
371 * CPUFREQ DEFAULT GOVERNOR * 380 * CPUFREQ DEFAULT GOVERNOR *
372 *********************************************************************/ 381 *********************************************************************/
373 382
374
375/* 383/*
376 Performance governor is fallback governor if any other gov failed to 384 * Performance governor is fallback governor if any other gov failed to auto
377 auto load due latency restrictions 385 * load due latency restrictions
378*/ 386 */
379#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE 387#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE
380extern struct cpufreq_governor cpufreq_gov_performance; 388extern struct cpufreq_governor cpufreq_gov_performance;
381#endif 389#endif
@@ -395,7 +403,6 @@ extern struct cpufreq_governor cpufreq_gov_conservative;
395#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative) 403#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative)
396#endif 404#endif
397 405
398
399/********************************************************************* 406/*********************************************************************
400 * FREQUENCY TABLE HELPERS * 407 * FREQUENCY TABLE HELPERS *
401 *********************************************************************/ 408 *********************************************************************/
@@ -404,7 +411,7 @@ extern struct cpufreq_governor cpufreq_gov_conservative;
404#define CPUFREQ_TABLE_END ~1 411#define CPUFREQ_TABLE_END ~1
405 412
406struct cpufreq_frequency_table { 413struct cpufreq_frequency_table {
407 unsigned int index; /* any */ 414 unsigned int driver_data; /* driver specific data, not used by core */
408 unsigned int frequency; /* kHz - doesn't need to be in ascending 415 unsigned int frequency; /* kHz - doesn't need to be in ascending
409 * order */ 416 * order */
410}; 417};
@@ -432,4 +439,7 @@ void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
432void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy); 439void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy);
433 440
434void cpufreq_frequency_table_put_attr(unsigned int cpu); 441void cpufreq_frequency_table_put_attr(unsigned int cpu);
442
443ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf);
444
435#endif /* _LINUX_CPUFREQ_H */ 445#endif /* _LINUX_CPUFREQ_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 8f0406230a0a..0bc4b74668e9 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -111,6 +111,9 @@ struct cpuidle_driver {
111 struct cpuidle_state states[CPUIDLE_STATE_MAX]; 111 struct cpuidle_state states[CPUIDLE_STATE_MAX];
112 int state_count; 112 int state_count;
113 int safe_state_index; 113 int safe_state_index;
114
115 /* the driver handles the cpus in cpumask */
116 struct cpumask *cpumask;
114}; 117};
115 118
116#ifdef CONFIG_CPU_IDLE 119#ifdef CONFIG_CPU_IDLE
@@ -135,9 +138,6 @@ extern void cpuidle_disable_device(struct cpuidle_device *dev);
135extern int cpuidle_play_dead(void); 138extern int cpuidle_play_dead(void);
136 139
137extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); 140extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
138extern int cpuidle_register_cpu_driver(struct cpuidle_driver *drv, int cpu);
139extern void cpuidle_unregister_cpu_driver(struct cpuidle_driver *drv, int cpu);
140
141#else 141#else
142static inline void disable_cpuidle(void) { } 142static inline void disable_cpuidle(void) { }
143static inline int cpuidle_idle_call(void) { return -ENODEV; } 143static inline int cpuidle_idle_call(void) { return -ENODEV; }
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 1a6bb81f0fe5..b90337c9d468 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -146,10 +146,8 @@ enum dentry_d_lock_class
146struct dentry_operations { 146struct dentry_operations {
147 int (*d_revalidate)(struct dentry *, unsigned int); 147 int (*d_revalidate)(struct dentry *, unsigned int);
148 int (*d_weak_revalidate)(struct dentry *, unsigned int); 148 int (*d_weak_revalidate)(struct dentry *, unsigned int);
149 int (*d_hash)(const struct dentry *, const struct inode *, 149 int (*d_hash)(const struct dentry *, struct qstr *);
150 struct qstr *); 150 int (*d_compare)(const struct dentry *, const struct dentry *,
151 int (*d_compare)(const struct dentry *, const struct inode *,
152 const struct dentry *, const struct inode *,
153 unsigned int, const char *, const struct qstr *); 151 unsigned int, const char *, const struct qstr *);
154 int (*d_delete)(const struct dentry *); 152 int (*d_delete)(const struct dentry *);
155 void (*d_release)(struct dentry *); 153 void (*d_release)(struct dentry *);
@@ -246,6 +244,8 @@ extern struct dentry * d_make_root(struct inode *);
246/* <clickety>-<click> the ramfs-type tree */ 244/* <clickety>-<click> the ramfs-type tree */
247extern void d_genocide(struct dentry *); 245extern void d_genocide(struct dentry *);
248 246
247extern void d_tmpfile(struct dentry *, struct inode *);
248
249extern struct dentry *d_find_alias(struct inode *); 249extern struct dentry *d_find_alias(struct inode *);
250extern void d_prune_aliases(struct inode *); 250extern void d_prune_aliases(struct inode *);
251 251
@@ -300,8 +300,7 @@ extern struct dentry *d_lookup(const struct dentry *, const struct qstr *);
300extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); 300extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
301extern struct dentry *__d_lookup(const struct dentry *, const struct qstr *); 301extern struct dentry *__d_lookup(const struct dentry *, const struct qstr *);
302extern struct dentry *__d_lookup_rcu(const struct dentry *parent, 302extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
303 const struct qstr *name, 303 const struct qstr *name, unsigned *seq);
304 unsigned *seq, struct inode *inode);
305 304
306/** 305/**
307 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok 306 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok
@@ -325,6 +324,11 @@ static inline int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq)
325 return ret; 324 return ret;
326} 325}
327 326
327static inline unsigned d_count(const struct dentry *dentry)
328{
329 return dentry->d_count;
330}
331
328/* validate "insecure" dentry pointer */ 332/* validate "insecure" dentry pointer */
329extern int d_validate(struct dentry *, struct dentry *); 333extern int d_validate(struct dentry *, struct dentry *);
330 334
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 21ca773f77bf..822c1354f3a6 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -51,7 +51,7 @@ struct task_struct;
51extern void debug_show_all_locks(void); 51extern void debug_show_all_locks(void);
52extern void debug_show_held_locks(struct task_struct *task); 52extern void debug_show_held_locks(struct task_struct *task);
53extern void debug_check_no_locks_freed(const void *from, unsigned long len); 53extern void debug_check_no_locks_freed(const void *from, unsigned long len);
54extern void debug_check_no_locks_held(struct task_struct *task); 54extern void debug_check_no_locks_held(void);
55#else 55#else
56static inline void debug_show_all_locks(void) 56static inline void debug_show_all_locks(void)
57{ 57{
@@ -67,7 +67,7 @@ debug_check_no_locks_freed(const void *from, unsigned long len)
67} 67}
68 68
69static inline void 69static inline void
70debug_check_no_locks_held(struct task_struct *task) 70debug_check_no_locks_held(void)
71{ 71{
72} 72}
73#endif 73#endif
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 63f2465807d4..d68b4ea7343c 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -79,6 +79,8 @@ struct dentry *debugfs_create_x64(const char *name, umode_t mode,
79 struct dentry *parent, u64 *value); 79 struct dentry *parent, u64 *value);
80struct dentry *debugfs_create_size_t(const char *name, umode_t mode, 80struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
81 struct dentry *parent, size_t *value); 81 struct dentry *parent, size_t *value);
82struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode,
83 struct dentry *parent, atomic_t *value);
82struct dentry *debugfs_create_bool(const char *name, umode_t mode, 84struct dentry *debugfs_create_bool(const char *name, umode_t mode,
83 struct dentry *parent, u32 *value); 85 struct dentry *parent, u32 *value);
84 86
diff --git a/include/linux/decompress/unlz4.h b/include/linux/decompress/unlz4.h
new file mode 100644
index 000000000000..d5b68bf3ec92
--- /dev/null
+++ b/include/linux/decompress/unlz4.h
@@ -0,0 +1,10 @@
1#ifndef DECOMPRESS_UNLZ4_H
2#define DECOMPRESS_UNLZ4_H
3
4int unlz4(unsigned char *inbuf, int len,
5 int(*fill)(void*, unsigned int),
6 int(*flush)(void*, unsigned int),
7 unsigned char *output,
8 int *pos,
9 void(*error)(char *x));
10#endif
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index fe8c4476f7e4..5f1ab92107e6 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -181,6 +181,8 @@ extern struct devfreq *devfreq_add_device(struct device *dev,
181 const char *governor_name, 181 const char *governor_name,
182 void *data); 182 void *data);
183extern int devfreq_remove_device(struct devfreq *devfreq); 183extern int devfreq_remove_device(struct devfreq *devfreq);
184
185/* Supposed to be called by PM_SLEEP/PM_RUNTIME callbacks */
184extern int devfreq_suspend_device(struct devfreq *devfreq); 186extern int devfreq_suspend_device(struct devfreq *devfreq);
185extern int devfreq_resume_device(struct devfreq *devfreq); 187extern int devfreq_resume_device(struct devfreq *devfreq);
186 188
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 3cd32478f2fd..e151d4c9298d 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -446,9 +446,9 @@ int __must_check dm_set_target_max_io_len(struct dm_target *ti, sector_t len);
446/* 446/*
447 * Table reference counting. 447 * Table reference counting.
448 */ 448 */
449struct dm_table *dm_get_live_table(struct mapped_device *md); 449struct dm_table *dm_get_live_table(struct mapped_device *md, int *srcu_idx);
450void dm_table_get(struct dm_table *t); 450void dm_put_live_table(struct mapped_device *md, int srcu_idx);
451void dm_table_put(struct dm_table *t); 451void dm_sync_table(struct mapped_device *md);
452 452
453/* 453/*
454 * Queries 454 * Queries
diff --git a/include/linux/device.h b/include/linux/device.h
index c0a126125325..22b546a58591 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -47,7 +47,11 @@ struct bus_attribute {
47}; 47};
48 48
49#define BUS_ATTR(_name, _mode, _show, _store) \ 49#define BUS_ATTR(_name, _mode, _show, _store) \
50struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) 50 struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store)
51#define BUS_ATTR_RW(_name) \
52 struct bus_attribute bus_attr_##_name = __ATTR_RW(_name)
53#define BUS_ATTR_RO(_name) \
54 struct bus_attribute bus_attr_##_name = __ATTR_RO(_name)
51 55
52extern int __must_check bus_create_file(struct bus_type *, 56extern int __must_check bus_create_file(struct bus_type *,
53 struct bus_attribute *); 57 struct bus_attribute *);
@@ -71,6 +75,10 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
71 * the specific driver's probe to initial the matched device. 75 * the specific driver's probe to initial the matched device.
72 * @remove: Called when a device removed from this bus. 76 * @remove: Called when a device removed from this bus.
73 * @shutdown: Called at shut-down time to quiesce the device. 77 * @shutdown: Called at shut-down time to quiesce the device.
78 *
79 * @online: Called to put the device back online (after offlining it).
80 * @offline: Called to put the device offline for hot-removal. May fail.
81 *
74 * @suspend: Called when a device on this bus wants to go to sleep mode. 82 * @suspend: Called when a device on this bus wants to go to sleep mode.
75 * @resume: Called to bring a device on this bus out of sleep mode. 83 * @resume: Called to bring a device on this bus out of sleep mode.
76 * @pm: Power management operations of this bus, callback the specific 84 * @pm: Power management operations of this bus, callback the specific
@@ -80,6 +88,7 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
80 * bus-specific setup 88 * bus-specific setup
81 * @p: The private data of the driver core, only the driver core can 89 * @p: The private data of the driver core, only the driver core can
82 * touch this. 90 * touch this.
91 * @lock_key: Lock class key for use by the lock validator
83 * 92 *
84 * A bus is a channel between the processor and one or more devices. For the 93 * A bus is a channel between the processor and one or more devices. For the
85 * purposes of the device model, all devices are connected via a bus, even if 94 * purposes of the device model, all devices are connected via a bus, even if
@@ -104,6 +113,9 @@ struct bus_type {
104 int (*remove)(struct device *dev); 113 int (*remove)(struct device *dev);
105 void (*shutdown)(struct device *dev); 114 void (*shutdown)(struct device *dev);
106 115
116 int (*online)(struct device *dev);
117 int (*offline)(struct device *dev);
118
107 int (*suspend)(struct device *dev, pm_message_t state); 119 int (*suspend)(struct device *dev, pm_message_t state);
108 int (*resume)(struct device *dev); 120 int (*resume)(struct device *dev);
109 121
@@ -253,9 +265,12 @@ struct driver_attribute {
253 size_t count); 265 size_t count);
254}; 266};
255 267
256#define DRIVER_ATTR(_name, _mode, _show, _store) \ 268#define DRIVER_ATTR(_name, _mode, _show, _store) \
257struct driver_attribute driver_attr_##_name = \ 269 struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store)
258 __ATTR(_name, _mode, _show, _store) 270#define DRIVER_ATTR_RW(_name) \
271 struct driver_attribute driver_attr_##_name = __ATTR_RW(_name)
272#define DRIVER_ATTR_RO(_name) \
273 struct driver_attribute driver_attr_##_name = __ATTR_RO(_name)
259 274
260extern int __must_check driver_create_file(struct device_driver *driver, 275extern int __must_check driver_create_file(struct device_driver *driver,
261 const struct driver_attribute *attr); 276 const struct driver_attribute *attr);
@@ -305,6 +320,7 @@ int subsys_virtual_register(struct bus_type *subsys,
305 * @name: Name of the class. 320 * @name: Name of the class.
306 * @owner: The module owner. 321 * @owner: The module owner.
307 * @class_attrs: Default attributes of this class. 322 * @class_attrs: Default attributes of this class.
323 * @dev_groups: Default attributes of the devices that belong to the class.
308 * @dev_attrs: Default attributes of the devices belong to the class. 324 * @dev_attrs: Default attributes of the devices belong to the class.
309 * @dev_bin_attrs: Default binary attributes of the devices belong to the class. 325 * @dev_bin_attrs: Default binary attributes of the devices belong to the class.
310 * @dev_kobj: The kobject that represents this class and links it into the hierarchy. 326 * @dev_kobj: The kobject that represents this class and links it into the hierarchy.
@@ -334,7 +350,8 @@ struct class {
334 struct module *owner; 350 struct module *owner;
335 351
336 struct class_attribute *class_attrs; 352 struct class_attribute *class_attrs;
337 struct device_attribute *dev_attrs; 353 struct device_attribute *dev_attrs; /* use dev_groups instead */
354 const struct attribute_group **dev_groups;
338 struct bin_attribute *dev_bin_attrs; 355 struct bin_attribute *dev_bin_attrs;
339 struct kobject *dev_kobj; 356 struct kobject *dev_kobj;
340 357
@@ -406,8 +423,12 @@ struct class_attribute {
406 const struct class_attribute *attr); 423 const struct class_attribute *attr);
407}; 424};
408 425
409#define CLASS_ATTR(_name, _mode, _show, _store) \ 426#define CLASS_ATTR(_name, _mode, _show, _store) \
410struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store) 427 struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store)
428#define CLASS_ATTR_RW(_name) \
429 struct class_attribute class_attr_##_name = __ATTR_RW(_name)
430#define CLASS_ATTR_RO(_name) \
431 struct class_attribute class_attr_##_name = __ATTR_RO(_name)
411 432
412extern int __must_check class_create_file(struct class *class, 433extern int __must_check class_create_file(struct class *class,
413 const struct class_attribute *attr); 434 const struct class_attribute *attr);
@@ -415,7 +436,6 @@ extern void class_remove_file(struct class *class,
415 const struct class_attribute *attr); 436 const struct class_attribute *attr);
416 437
417/* Simple class attribute that is just a static string */ 438/* Simple class attribute that is just a static string */
418
419struct class_attribute_string { 439struct class_attribute_string {
420 struct class_attribute attr; 440 struct class_attribute attr;
421 char *str; 441 char *str;
@@ -504,6 +524,10 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
504 524
505#define DEVICE_ATTR(_name, _mode, _show, _store) \ 525#define DEVICE_ATTR(_name, _mode, _show, _store) \
506 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 526 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
527#define DEVICE_ATTR_RW(_name) \
528 struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
529#define DEVICE_ATTR_RO(_name) \
530 struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
507#define DEVICE_ULONG_ATTR(_name, _mode, _var) \ 531#define DEVICE_ULONG_ATTR(_name, _mode, _var) \
508 struct dev_ext_attribute dev_attr_##_name = \ 532 struct dev_ext_attribute dev_attr_##_name = \
509 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 533 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
@@ -635,6 +659,7 @@ struct acpi_dev_node {
635 * segment limitations. 659 * segment limitations.
636 * @dma_pools: Dma pools (if dma'ble device). 660 * @dma_pools: Dma pools (if dma'ble device).
637 * @dma_mem: Internal for coherent mem override. 661 * @dma_mem: Internal for coherent mem override.
662 * @cma_area: Contiguous memory area for dma allocations
638 * @archdata: For arch-specific additions. 663 * @archdata: For arch-specific additions.
639 * @of_node: Associated device tree node. 664 * @of_node: Associated device tree node.
640 * @acpi_node: Associated ACPI device node. 665 * @acpi_node: Associated ACPI device node.
@@ -648,6 +673,10 @@ struct acpi_dev_node {
648 * @release: Callback to free the device after all references have 673 * @release: Callback to free the device after all references have
649 * gone away. This should be set by the allocator of the 674 * gone away. This should be set by the allocator of the
650 * device (i.e. the bus driver that discovered the device). 675 * device (i.e. the bus driver that discovered the device).
676 * @iommu_group: IOMMU group the device belongs to.
677 *
678 * @offline_disabled: If set, the device is permanently online.
679 * @offline: Set after successful invocation of bus type's .offline().
651 * 680 *
652 * At the lowest level, every device in a Linux system is represented by an 681 * At the lowest level, every device in a Linux system is represented by an
653 * instance of struct device. The device structure contains the information 682 * instance of struct device. The device structure contains the information
@@ -720,6 +749,9 @@ struct device {
720 749
721 void (*release)(struct device *dev); 750 void (*release)(struct device *dev);
722 struct iommu_group *iommu_group; 751 struct iommu_group *iommu_group;
752
753 bool offline_disabled:1;
754 bool offline:1;
723}; 755};
724 756
725static inline struct device *kobj_to_dev(struct kobject *kobj) 757static inline struct device *kobj_to_dev(struct kobject *kobj)
@@ -856,6 +888,15 @@ extern const char *device_get_devnode(struct device *dev,
856extern void *dev_get_drvdata(const struct device *dev); 888extern void *dev_get_drvdata(const struct device *dev);
857extern int dev_set_drvdata(struct device *dev, void *data); 889extern int dev_set_drvdata(struct device *dev, void *data);
858 890
891static inline bool device_supports_offline(struct device *dev)
892{
893 return dev->bus && dev->bus->offline && dev->bus->online;
894}
895
896extern void lock_device_hotplug(void);
897extern void unlock_device_hotplug(void);
898extern int device_offline(struct device *dev);
899extern int device_online(struct device *dev);
859/* 900/*
860 * Root device objects for grouping under /sys/devices 901 * Root device objects for grouping under /sys/devices
861 */ 902 */
@@ -899,6 +940,11 @@ extern __printf(5, 6)
899struct device *device_create(struct class *cls, struct device *parent, 940struct device *device_create(struct class *cls, struct device *parent,
900 dev_t devt, void *drvdata, 941 dev_t devt, void *drvdata,
901 const char *fmt, ...); 942 const char *fmt, ...);
943extern __printf(6, 7)
944struct device *device_create_with_groups(struct class *cls,
945 struct device *parent, dev_t devt, void *drvdata,
946 const struct attribute_group **groups,
947 const char *fmt, ...);
902extern void device_destroy(struct class *cls, dev_t devt); 948extern void device_destroy(struct class *cls, dev_t devt);
903 949
904/* 950/*
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 96d3e4ab11a9..cb286b1acdb6 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -66,7 +66,6 @@ enum dma_transaction_type {
66 DMA_PQ, 66 DMA_PQ,
67 DMA_XOR_VAL, 67 DMA_XOR_VAL,
68 DMA_PQ_VAL, 68 DMA_PQ_VAL,
69 DMA_MEMSET,
70 DMA_INTERRUPT, 69 DMA_INTERRUPT,
71 DMA_SG, 70 DMA_SG,
72 DMA_PRIVATE, 71 DMA_PRIVATE,
@@ -520,7 +519,6 @@ struct dma_tx_state {
520 * @device_prep_dma_xor_val: prepares a xor validation operation 519 * @device_prep_dma_xor_val: prepares a xor validation operation
521 * @device_prep_dma_pq: prepares a pq operation 520 * @device_prep_dma_pq: prepares a pq operation
522 * @device_prep_dma_pq_val: prepares a pqzero_sum operation 521 * @device_prep_dma_pq_val: prepares a pqzero_sum operation
523 * @device_prep_dma_memset: prepares a memset operation
524 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 522 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
525 * @device_prep_slave_sg: prepares a slave dma operation 523 * @device_prep_slave_sg: prepares a slave dma operation
526 * @device_prep_dma_cyclic: prepare a cyclic dma operation suitable for audio. 524 * @device_prep_dma_cyclic: prepare a cyclic dma operation suitable for audio.
@@ -573,9 +571,6 @@ struct dma_device {
573 struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src, 571 struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
574 unsigned int src_cnt, const unsigned char *scf, size_t len, 572 unsigned int src_cnt, const unsigned char *scf, size_t len,
575 enum sum_check_flags *pqres, unsigned long flags); 573 enum sum_check_flags *pqres, unsigned long flags);
576 struct dma_async_tx_descriptor *(*device_prep_dma_memset)(
577 struct dma_chan *chan, dma_addr_t dest, int value, size_t len,
578 unsigned long flags);
579 struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)( 574 struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)(
580 struct dma_chan *chan, unsigned long flags); 575 struct dma_chan *chan, unsigned long flags);
581 struct dma_async_tx_descriptor *(*device_prep_dma_sg)( 576 struct dma_async_tx_descriptor *(*device_prep_dma_sg)(
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 1b4d4ee1168f..de7d74ab3de6 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -177,7 +177,11 @@ enum drbd_ret_code {
177 ERR_NEED_APV_100 = 163, 177 ERR_NEED_APV_100 = 163,
178 ERR_NEED_ALLOW_TWO_PRI = 164, 178 ERR_NEED_ALLOW_TWO_PRI = 164,
179 ERR_MD_UNCLEAN = 165, 179 ERR_MD_UNCLEAN = 165,
180 180 ERR_MD_LAYOUT_CONNECTED = 166,
181 ERR_MD_LAYOUT_TOO_BIG = 167,
182 ERR_MD_LAYOUT_TOO_SMALL = 168,
183 ERR_MD_LAYOUT_NO_FIT = 169,
184 ERR_IMPLICIT_SHRINK = 170,
181 /* insert new ones above this line */ 185 /* insert new ones above this line */
182 AFTER_LAST_ERR_CODE 186 AFTER_LAST_ERR_CODE
183}; 187};
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
index d0d8fac8a6e4..e8c44572b8cb 100644
--- a/include/linux/drbd_genl.h
+++ b/include/linux/drbd_genl.h
@@ -181,6 +181,8 @@ GENL_struct(DRBD_NLA_RESIZE_PARMS, 7, resize_parms,
181 __u64_field(1, DRBD_GENLA_F_MANDATORY, resize_size) 181 __u64_field(1, DRBD_GENLA_F_MANDATORY, resize_size)
182 __flg_field(2, DRBD_GENLA_F_MANDATORY, resize_force) 182 __flg_field(2, DRBD_GENLA_F_MANDATORY, resize_force)
183 __flg_field(3, DRBD_GENLA_F_MANDATORY, no_resync) 183 __flg_field(3, DRBD_GENLA_F_MANDATORY, no_resync)
184 __u32_field_def(4, 0 /* OPTIONAL */, al_stripes, DRBD_AL_STRIPES_DEF)
185 __u32_field_def(5, 0 /* OPTIONAL */, al_stripe_size, DRBD_AL_STRIPE_SIZE_DEF)
184) 186)
185 187
186GENL_struct(DRBD_NLA_STATE_INFO, 8, state_info, 188GENL_struct(DRBD_NLA_STATE_INFO, 8, state_info,
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 1fedf2b17cc8..17e50bb00521 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -215,4 +215,13 @@
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 217
218#define DRBD_AL_STRIPES_MIN 1
219#define DRBD_AL_STRIPES_MAX 1024
220#define DRBD_AL_STRIPES_DEF 1
221#define DRBD_AL_STRIPES_SCALE '1'
222
223#define DRBD_AL_STRIPE_SIZE_MIN 4
224#define DRBD_AL_STRIPE_SIZE_MAX 16777216
225#define DRBD_AL_STRIPE_SIZE_DEF 32
226#define DRBD_AL_STRIPE_SIZE_SCALE 'k' /* kilobytes */
218#endif 227#endif
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h
index dd755ce2a5eb..1f79b20918b1 100644
--- a/include/linux/dw_apb_timer.h
+++ b/include/linux/dw_apb_timer.h
@@ -51,7 +51,5 @@ dw_apb_clocksource_init(unsigned rating, const char *name, void __iomem *base,
51void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs); 51void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs);
52void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs); 52void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs);
53cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs); 53cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs);
54void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs);
55 54
56extern void dw_apb_timer_init(void);
57#endif /* __DW_APB_TIMER_H__ */ 55#endif /* __DW_APB_TIMER_H__ */
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 0b763276f619..5c6d7fbaf89e 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -622,7 +622,7 @@ struct edac_raw_error_desc {
622 */ 622 */
623struct mem_ctl_info { 623struct mem_ctl_info {
624 struct device dev; 624 struct device dev;
625 struct bus_type bus; 625 struct bus_type *bus;
626 626
627 struct list_head link; /* for global list of mem_ctl_info structs */ 627 struct list_head link; /* for global list of mem_ctl_info structs */
628 628
@@ -742,4 +742,9 @@ struct mem_ctl_info {
742#endif 742#endif
743}; 743};
744 744
745/*
746 * Maximum number of memory controllers in the coherent fabric.
747 */
748#define EDAC_MAX_MCS 16
749
745#endif 750#endif
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 2bc0ad78d058..5f8f176154f7 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -287,20 +287,20 @@ typedef struct {
287 287
288typedef struct { 288typedef struct {
289 efi_table_hdr_t hdr; 289 efi_table_hdr_t hdr;
290 unsigned long get_time; 290 void *get_time;
291 unsigned long set_time; 291 void *set_time;
292 unsigned long get_wakeup_time; 292 void *get_wakeup_time;
293 unsigned long set_wakeup_time; 293 void *set_wakeup_time;
294 unsigned long set_virtual_address_map; 294 void *set_virtual_address_map;
295 unsigned long convert_pointer; 295 void *convert_pointer;
296 unsigned long get_variable; 296 void *get_variable;
297 unsigned long get_next_variable; 297 void *get_next_variable;
298 unsigned long set_variable; 298 void *set_variable;
299 unsigned long get_next_high_mono_count; 299 void *get_next_high_mono_count;
300 unsigned long reset_system; 300 void *reset_system;
301 unsigned long update_capsule; 301 void *update_capsule;
302 unsigned long query_capsule_caps; 302 void *query_capsule_caps;
303 unsigned long query_variable_info; 303 void *query_variable_info;
304} efi_runtime_services_t; 304} efi_runtime_services_t;
305 305
306typedef efi_status_t efi_get_time_t (efi_time_t *tm, efi_time_cap_t *tc); 306typedef efi_status_t efi_get_time_t (efi_time_t *tm, efi_time_cap_t *tc);
@@ -594,8 +594,8 @@ extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size);
594extern int __init efi_uart_console_only (void); 594extern int __init efi_uart_console_only (void);
595extern void efi_initialize_iomem_resources(struct resource *code_resource, 595extern void efi_initialize_iomem_resources(struct resource *code_resource,
596 struct resource *data_resource, struct resource *bss_resource); 596 struct resource *data_resource, struct resource *bss_resource);
597extern unsigned long efi_get_time(void); 597extern void efi_get_time(struct timespec *now);
598extern int efi_set_rtc_mmss(unsigned long nowtime); 598extern int efi_set_rtc_mmss(const struct timespec *now);
599extern void efi_reserve_boot_services(void); 599extern void efi_reserve_boot_services(void);
600extern struct efi_memory_map memmap; 600extern struct efi_memory_map memmap;
601 601
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index acd0312d46fb..306dd8cd0b6f 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -7,6 +7,7 @@
7#ifdef CONFIG_BLOCK 7#ifdef CONFIG_BLOCK
8 8
9struct io_cq; 9struct io_cq;
10struct elevator_type;
10 11
11typedef int (elevator_merge_fn) (struct request_queue *, struct request **, 12typedef int (elevator_merge_fn) (struct request_queue *, struct request **,
12 struct bio *); 13 struct bio *);
@@ -35,7 +36,8 @@ typedef void (elevator_put_req_fn) (struct request *);
35typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *); 36typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *);
36typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *); 37typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *);
37 38
38typedef int (elevator_init_fn) (struct request_queue *); 39typedef int (elevator_init_fn) (struct request_queue *,
40 struct elevator_type *e);
39typedef void (elevator_exit_fn) (struct elevator_queue *); 41typedef void (elevator_exit_fn) (struct elevator_queue *);
40 42
41struct elevator_ops 43struct elevator_ops
@@ -155,6 +157,8 @@ extern int elevator_init(struct request_queue *, char *);
155extern void elevator_exit(struct elevator_queue *); 157extern void elevator_exit(struct elevator_queue *);
156extern int elevator_change(struct request_queue *, const char *); 158extern int elevator_change(struct request_queue *, const char *);
157extern bool elv_rq_merge_ok(struct request *, struct bio *); 159extern bool elv_rq_merge_ok(struct request *, struct bio *);
160extern struct elevator_queue *elevator_alloc(struct request_queue *,
161 struct elevator_type *);
158 162
159/* 163/*
160 * Helper functions. 164 * Helper functions.
diff --git a/include/linux/err.h b/include/linux/err.h
index f2edce25a76b..221fcfb676c4 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -24,17 +24,17 @@ static inline void * __must_check ERR_PTR(long error)
24 return (void *) error; 24 return (void *) error;
25} 25}
26 26
27static inline long __must_check PTR_ERR(const void *ptr) 27static inline long __must_check PTR_ERR(__force const void *ptr)
28{ 28{
29 return (long) ptr; 29 return (long) ptr;
30} 30}
31 31
32static inline long __must_check IS_ERR(const void *ptr) 32static inline long __must_check IS_ERR(__force const void *ptr)
33{ 33{
34 return IS_ERR_VALUE((unsigned long)ptr); 34 return IS_ERR_VALUE((unsigned long)ptr);
35} 35}
36 36
37static inline long __must_check IS_ERR_OR_NULL(const void *ptr) 37static inline long __must_check IS_ERR_OR_NULL(__force const void *ptr)
38{ 38{
39 return !ptr || IS_ERR_VALUE((unsigned long)ptr); 39 return !ptr || IS_ERR_VALUE((unsigned long)ptr);
40} 40}
@@ -46,13 +46,13 @@ static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
46 * Explicitly cast an error-valued pointer to another pointer type in such a 46 * Explicitly cast an error-valued pointer to another pointer type in such a
47 * way as to make it clear that's what's going on. 47 * way as to make it clear that's what's going on.
48 */ 48 */
49static inline void * __must_check ERR_CAST(const void *ptr) 49static inline void * __must_check ERR_CAST(__force const void *ptr)
50{ 50{
51 /* cast away the const */ 51 /* cast away the const */
52 return (void *) ptr; 52 return (void *) ptr;
53} 53}
54 54
55static inline int __must_check PTR_RET(const void *ptr) 55static inline int __must_check PTR_RET(__force const void *ptr)
56{ 56{
57 if (IS_ERR(ptr)) 57 if (IS_ERR(ptr))
58 return PTR_ERR(ptr); 58 return PTR_ERR(ptr);
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index df6fab82f87e..383d5e39b280 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -20,8 +20,8 @@
20#define F2FS_BLKSIZE 4096 /* support only 4KB block */ 20#define F2FS_BLKSIZE 4096 /* support only 4KB block */
21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */ 21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */
22 22
23#define NULL_ADDR 0x0U 23#define NULL_ADDR ((block_t)0) /* used as block_t addresses */
24#define NEW_ADDR -1U 24#define NEW_ADDR ((block_t)-1) /* used as block_t addresses */
25 25
26#define F2FS_ROOT_INO(sbi) (sbi->root_ino_num) 26#define F2FS_ROOT_INO(sbi) (sbi->root_ino_num)
27#define F2FS_NODE_INO(sbi) (sbi->node_ino_num) 27#define F2FS_NODE_INO(sbi) (sbi->node_ino_num)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index d49c60f5aa4c..ffac70aab3e9 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -624,7 +624,7 @@ extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u3
624extern void fb_set_suspend(struct fb_info *info, int state); 624extern void fb_set_suspend(struct fb_info *info, int state);
625extern int fb_get_color_depth(struct fb_var_screeninfo *var, 625extern int fb_get_color_depth(struct fb_var_screeninfo *var,
626 struct fb_fix_screeninfo *fix); 626 struct fb_fix_screeninfo *fix);
627extern int fb_get_options(char *name, char **option); 627extern int fb_get_options(const char *name, char **option);
628extern int fb_new_modelist(struct fb_info *info); 628extern int fb_new_modelist(struct fb_info *info);
629 629
630extern struct fb_info *registered_fb[FB_MAX]; 630extern struct fb_info *registered_fb[FB_MAX];
diff --git a/include/linux/filter.h b/include/linux/filter.h
index f65f5a69db8f..a6ac84871d6d 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -59,10 +59,10 @@ extern void bpf_jit_free(struct sk_filter *fp);
59static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, 59static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
60 u32 pass, void *image) 60 u32 pass, void *image)
61{ 61{
62 pr_err("flen=%u proglen=%u pass=%u image=%p\n", 62 pr_err("flen=%u proglen=%u pass=%u image=%pK\n",
63 flen, proglen, pass, image); 63 flen, proglen, pass, image);
64 if (image) 64 if (image)
65 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_ADDRESS, 65 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
66 16, 1, image, proglen, false); 66 16, 1, image, proglen, false);
67} 67}
68#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) 68#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns)
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 191501afd7fb..5d7782e42b8f 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -251,8 +251,10 @@ struct ieee1394_device_id;
251 251
252struct fw_driver { 252struct fw_driver {
253 struct device_driver driver; 253 struct device_driver driver;
254 int (*probe)(struct fw_unit *unit, const struct ieee1394_device_id *id);
254 /* Called when the parent device sits through a bus reset. */ 255 /* Called when the parent device sits through a bus reset. */
255 void (*update)(struct fw_unit *unit); 256 void (*update)(struct fw_unit *unit);
257 void (*remove)(struct fw_unit *unit);
256 const struct ieee1394_device_id *id_table; 258 const struct ieee1394_device_id *id_table;
257}; 259};
258 260
@@ -434,6 +436,7 @@ struct fw_iso_context {
434 int type; 436 int type;
435 int channel; 437 int channel;
436 int speed; 438 int speed;
439 bool drop_overflow_headers;
437 size_t header_size; 440 size_t header_size;
438 union { 441 union {
439 fw_iso_callback_t sc; 442 fw_iso_callback_t sc;
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index e4279fedb93a..e154c1005cd1 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -47,8 +47,6 @@ int request_firmware_nowait(
47 void (*cont)(const struct firmware *fw, void *context)); 47 void (*cont)(const struct firmware *fw, void *context));
48 48
49void release_firmware(const struct firmware *fw); 49void release_firmware(const struct firmware *fw);
50int cache_firmware(const char *name);
51int uncache_firmware(const char *name);
52#else 50#else
53static inline int request_firmware(const struct firmware **fw, 51static inline int request_firmware(const struct firmware **fw,
54 const char *name, 52 const char *name,
@@ -68,15 +66,6 @@ static inline void release_firmware(const struct firmware *fw)
68{ 66{
69} 67}
70 68
71static inline int cache_firmware(const char *name)
72{
73 return -ENOENT;
74}
75
76static inline int uncache_firmware(const char *name)
77{
78 return -EINVAL;
79}
80#endif 69#endif
81 70
82#endif 71#endif
diff --git a/include/linux/fmc-sdb.h b/include/linux/fmc-sdb.h
new file mode 100644
index 000000000000..1974317a9b3d
--- /dev/null
+++ b/include/linux/fmc-sdb.h
@@ -0,0 +1,36 @@
1/*
2 * This file is separate from sdb.h, because I want that one to remain
3 * unchanged (as far as possible) from the official sdb distribution
4 *
5 * This file and associated functionality are a playground for me to
6 * understand stuff which will later be implemented in more generic places.
7 */
8#include <linux/sdb.h>
9
10/* This is the union of all currently defined types */
11union sdb_record {
12 struct sdb_interconnect ic;
13 struct sdb_device dev;
14 struct sdb_bridge bridge;
15 struct sdb_integration integr;
16 struct sdb_empty empty;
17};
18
19struct fmc_device;
20
21/* Every sdb table is turned into this structure */
22struct sdb_array {
23 int len;
24 int level;
25 unsigned long baseaddr;
26 struct fmc_device *fmc; /* the device that hosts it */
27 struct sdb_array *parent; /* NULL at root */
28 union sdb_record *record; /* copies of the struct */
29 struct sdb_array **subtree; /* only valid for bridge items */
30};
31
32extern int fmc_scan_sdb_tree(struct fmc_device *fmc, unsigned long address);
33extern void fmc_show_sdb_tree(const struct fmc_device *fmc);
34extern signed long fmc_find_sdb_device(struct sdb_array *tree, uint64_t vendor,
35 uint32_t device, unsigned long *sz);
36extern int fmc_free_sdb_tree(struct fmc_device *fmc);
diff --git a/include/linux/fmc.h b/include/linux/fmc.h
new file mode 100644
index 000000000000..a5f0aa5c2a8d
--- /dev/null
+++ b/include/linux/fmc.h
@@ -0,0 +1,237 @@
1/*
2 * Copyright (C) 2012 CERN (www.cern.ch)
3 * Author: Alessandro Rubini <rubini@gnudd.com>
4 *
5 * Released according to the GNU GPL, version 2 or any later version.
6 *
7 * This work is part of the White Rabbit project, a research effort led
8 * by CERN, the European Institute for Nuclear Research.
9 */
10#ifndef __LINUX_FMC_H__
11#define __LINUX_FMC_H__
12#include <linux/types.h>
13#include <linux/moduleparam.h>
14#include <linux/device.h>
15#include <linux/list.h>
16#include <linux/interrupt.h>
17#include <linux/io.h>
18
19struct fmc_device;
20struct fmc_driver;
21
22/*
23 * This bus abstraction is developed separately from drivers, so we need
24 * to check the version of the data structures we receive.
25 */
26
27#define FMC_MAJOR 3
28#define FMC_MINOR 0
29#define FMC_VERSION ((FMC_MAJOR << 16) | FMC_MINOR)
30#define __FMC_MAJOR(x) ((x) >> 16)
31#define __FMC_MINOR(x) ((x) & 0xffff)
32
33/*
34 * The device identification, as defined by the IPMI FRU (Field Replaceable
35 * Unit) includes four different strings to describe the device. Here we
36 * only match the "Board Manufacturer" and the "Board Product Name",
37 * ignoring the "Board Serial Number" and "Board Part Number". All 4 are
38 * expected to be strings, so they are treated as zero-terminated C strings.
39 * Unspecified string (NULL) means "any", so if both are unspecified this
40 * is a catch-all driver. So null entries are allowed and we use array
41 * and length. This is unlike pci and usb that use null-terminated arrays
42 */
43struct fmc_fru_id {
44 char *manufacturer;
45 char *product_name;
46};
47
48/*
49 * If the FPGA is already programmed (think Etherbone or the second
50 * SVEC slot), we can match on SDB devices in the memory image. This
51 * match uses an array of devices that must all be present, and the
52 * match is based on vendor and device only. Further checks are expected
53 * to happen in the probe function. Zero means "any" and catch-all is allowed.
54 */
55struct fmc_sdb_one_id {
56 uint64_t vendor;
57 uint32_t device;
58};
59struct fmc_sdb_id {
60 struct fmc_sdb_one_id *cores;
61 int cores_nr;
62};
63
64struct fmc_device_id {
65 struct fmc_fru_id *fru_id;
66 int fru_id_nr;
67 struct fmc_sdb_id *sdb_id;
68 int sdb_id_nr;
69};
70
71/* This sizes the module_param_array used by generic module parameters */
72#define FMC_MAX_CARDS 32
73
74/* The driver is a pretty simple thing */
75struct fmc_driver {
76 unsigned long version;
77 struct device_driver driver;
78 int (*probe)(struct fmc_device *);
79 int (*remove)(struct fmc_device *);
80 const struct fmc_device_id id_table;
81 /* What follows is for generic module parameters */
82 int busid_n;
83 int busid_val[FMC_MAX_CARDS];
84 int gw_n;
85 char *gw_val[FMC_MAX_CARDS];
86};
87#define to_fmc_driver(x) container_of((x), struct fmc_driver, driver)
88
89/* These are the generic parameters, that drivers may instantiate */
90#define FMC_PARAM_BUSID(_d) \
91 module_param_array_named(busid, _d.busid_val, int, &_d.busid_n, 0444)
92#define FMC_PARAM_GATEWARE(_d) \
93 module_param_array_named(gateware, _d.gw_val, charp, &_d.gw_n, 0444)
94
95/*
96 * Drivers may need to configure gpio pins in the carrier. To read input
97 * (a very uncommon operation, and definitely not in the hot paths), just
98 * configure one gpio only and get 0 or 1 as retval of the config method
99 */
100struct fmc_gpio {
101 char *carrier_name; /* name or NULL for virtual pins */
102 int gpio;
103 int _gpio; /* internal use by the carrier */
104 int mode; /* GPIOF_DIR_OUT etc, from <linux/gpio.h> */
105 int irqmode; /* IRQF_TRIGGER_LOW and so on */
106};
107
108/* The numbering of gpio pins allows access to raw pins or virtual roles */
109#define FMC_GPIO_RAW(x) (x) /* 4096 of them */
110#define __FMC_GPIO_IS_RAW(x) ((x) < 0x1000)
111#define FMC_GPIO_IRQ(x) ((x) + 0x1000) /* 256 of them */
112#define FMC_GPIO_LED(x) ((x) + 0x1100) /* 256 of them */
113#define FMC_GPIO_KEY(x) ((x) + 0x1200) /* 256 of them */
114#define FMC_GPIO_TP(x) ((x) + 0x1300) /* 256 of them */
115#define FMC_GPIO_USER(x) ((x) + 0x1400) /* 256 of them */
116/* We may add SCL and SDA, or other roles if the need arises */
117
118/* GPIOF_DIR_IN etc are missing before 3.0. copy from <linux/gpio.h> */
119#ifndef GPIOF_DIR_IN
120# define GPIOF_DIR_OUT (0 << 0)
121# define GPIOF_DIR_IN (1 << 0)
122# define GPIOF_INIT_LOW (0 << 1)
123# define GPIOF_INIT_HIGH (1 << 1)
124#endif
125
126/*
127 * The operations are offered by each carrier and should make driver
128 * design completely independent of the carrier. Named GPIO pins may be
129 * the exception.
130 */
131struct fmc_operations {
132 uint32_t (*read32)(struct fmc_device *fmc, int offset);
133 void (*write32)(struct fmc_device *fmc, uint32_t value, int offset);
134 int (*validate)(struct fmc_device *fmc, struct fmc_driver *drv);
135 int (*reprogram)(struct fmc_device *f, struct fmc_driver *d, char *gw);
136 int (*irq_request)(struct fmc_device *fmc, irq_handler_t h,
137 char *name, int flags);
138 void (*irq_ack)(struct fmc_device *fmc);
139 int (*irq_free)(struct fmc_device *fmc);
140 int (*gpio_config)(struct fmc_device *fmc, struct fmc_gpio *gpio,
141 int ngpio);
142 int (*read_ee)(struct fmc_device *fmc, int pos, void *d, int l);
143 int (*write_ee)(struct fmc_device *fmc, int pos, const void *d, int l);
144};
145
146/* Prefer this helper rather than calling of fmc->reprogram directly */
147extern int fmc_reprogram(struct fmc_device *f, struct fmc_driver *d, char *gw,
148 int sdb_entry);
149
150/*
151 * The device reports all information needed to access hw.
152 *
153 * If we have eeprom_len and not contents, the core reads it.
154 * Then, parsing of identifiers is done by the core which fills fmc_fru_id..
155 * Similarly a device that must be matched based on SDB cores must
156 * fill the entry point and the core will scan the bus (FIXME: sdb match)
157 */
158struct fmc_device {
159 unsigned long version;
160 unsigned long flags;
161 struct module *owner; /* char device must pin it */
162 struct fmc_fru_id id; /* for EEPROM-based match */
163 struct fmc_operations *op; /* carrier-provided */
164 int irq; /* according to host bus. 0 == none */
165 int eeprom_len; /* Usually 8kB, may be less */
166 int eeprom_addr; /* 0x50, 0x52 etc */
167 uint8_t *eeprom; /* Full contents or leading part */
168 char *carrier_name; /* "SPEC" or similar, for special use */
169 void *carrier_data; /* "struct spec *" or equivalent */
170 __iomem void *fpga_base; /* May be NULL (Etherbone) */
171 __iomem void *slot_base; /* Set by the driver */
172 struct fmc_device **devarray; /* Allocated by the bus */
173 int slot_id; /* Index in the slot array */
174 int nr_slots; /* Number of slots in this carrier */
175 unsigned long memlen; /* Used for the char device */
176 struct device dev; /* For Linux use */
177 struct device *hwdev; /* The underlying hardware device */
178 unsigned long sdbfs_entry;
179 struct sdb_array *sdb;
180 uint32_t device_id; /* Filled by the device */
181 char *mezzanine_name; /* Defaults to ``fmc'' */
182 void *mezzanine_data;
183};
184#define to_fmc_device(x) container_of((x), struct fmc_device, dev)
185
186#define FMC_DEVICE_HAS_GOLDEN 1
187#define FMC_DEVICE_HAS_CUSTOM 2
188#define FMC_DEVICE_NO_MEZZANINE 4
189#define FMC_DEVICE_MATCH_SDB 8 /* fmc-core must scan sdb in fpga */
190
191/*
192 * If fpga_base can be used, the carrier offers no readl/writel methods, and
193 * this expands to a single, fast, I/O access.
194 */
195static inline uint32_t fmc_readl(struct fmc_device *fmc, int offset)
196{
197 if (unlikely(fmc->op->read32))
198 return fmc->op->read32(fmc, offset);
199 return readl(fmc->fpga_base + offset);
200}
201static inline void fmc_writel(struct fmc_device *fmc, uint32_t val, int off)
202{
203 if (unlikely(fmc->op->write32))
204 fmc->op->write32(fmc, val, off);
205 else
206 writel(val, fmc->fpga_base + off);
207}
208
209/* pci-like naming */
210static inline void *fmc_get_drvdata(const struct fmc_device *fmc)
211{
212 return dev_get_drvdata(&fmc->dev);
213}
214
215static inline void fmc_set_drvdata(struct fmc_device *fmc, void *data)
216{
217 dev_set_drvdata(&fmc->dev, data);
218}
219
220/* The 4 access points */
221extern int fmc_driver_register(struct fmc_driver *drv);
222extern void fmc_driver_unregister(struct fmc_driver *drv);
223extern int fmc_device_register(struct fmc_device *tdev);
224extern void fmc_device_unregister(struct fmc_device *tdev);
225
226/* Two more for device sets, all driven by the same FPGA */
227extern int fmc_device_register_n(struct fmc_device **devs, int n);
228extern void fmc_device_unregister_n(struct fmc_device **devs, int n);
229
230/* Internal cross-calls between files; not exported to other modules */
231extern int fmc_match(struct device *dev, struct device_driver *drv);
232extern int fmc_fill_id_info(struct fmc_device *fmc);
233extern void fmc_free_id_info(struct fmc_device *fmc);
234extern void fmc_dump_eeprom(const struct fmc_device *fmc);
235extern void fmc_dump_sdb(const struct fmc_device *fmc);
236
237#endif /* __LINUX_FMC_H__ */
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index e70df40d84f6..7fd81b8c4897 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -3,6 +3,7 @@
3#ifndef FREEZER_H_INCLUDED 3#ifndef FREEZER_H_INCLUDED
4#define FREEZER_H_INCLUDED 4#define FREEZER_H_INCLUDED
5 5
6#include <linux/debug_locks.h>
6#include <linux/sched.h> 7#include <linux/sched.h>
7#include <linux/wait.h> 8#include <linux/wait.h>
8#include <linux/atomic.h> 9#include <linux/atomic.h>
@@ -46,7 +47,11 @@ extern int freeze_kernel_threads(void);
46extern void thaw_processes(void); 47extern void thaw_processes(void);
47extern void thaw_kernel_threads(void); 48extern void thaw_kernel_threads(void);
48 49
49static inline bool try_to_freeze(void) 50/*
51 * DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION
52 * If try_to_freeze causes a lockdep warning it means the caller may deadlock
53 */
54static inline bool try_to_freeze_unsafe(void)
50{ 55{
51 might_sleep(); 56 might_sleep();
52 if (likely(!freezing(current))) 57 if (likely(!freezing(current)))
@@ -54,6 +59,13 @@ static inline bool try_to_freeze(void)
54 return __refrigerator(false); 59 return __refrigerator(false);
55} 60}
56 61
62static inline bool try_to_freeze(void)
63{
64 if (!(current->flags & PF_NOFREEZE))
65 debug_check_no_locks_held();
66 return try_to_freeze_unsafe();
67}
68
57extern bool freeze_task(struct task_struct *p); 69extern bool freeze_task(struct task_struct *p);
58extern bool set_freezable(void); 70extern bool set_freezable(void);
59 71
@@ -115,6 +127,14 @@ static inline void freezer_count(void)
115 try_to_freeze(); 127 try_to_freeze();
116} 128}
117 129
130/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
131static inline void freezer_count_unsafe(void)
132{
133 current->flags &= ~PF_FREEZER_SKIP;
134 smp_mb();
135 try_to_freeze_unsafe();
136}
137
118/** 138/**
119 * freezer_should_skip - whether to skip a task when determining frozen 139 * freezer_should_skip - whether to skip a task when determining frozen
120 * state is reached 140 * state is reached
@@ -139,28 +159,86 @@ static inline bool freezer_should_skip(struct task_struct *p)
139} 159}
140 160
141/* 161/*
142 * These macros are intended to be used whenever you want allow a sleeping 162 * These functions are intended to be used whenever you want allow a sleeping
143 * task to be frozen. Note that neither return any clear indication of 163 * task to be frozen. Note that neither return any clear indication of
144 * whether a freeze event happened while in this function. 164 * whether a freeze event happened while in this function.
145 */ 165 */
146 166
147/* Like schedule(), but should not block the freezer. */ 167/* Like schedule(), but should not block the freezer. */
148#define freezable_schedule() \ 168static inline void freezable_schedule(void)
149({ \ 169{
150 freezer_do_not_count(); \ 170 freezer_do_not_count();
151 schedule(); \ 171 schedule();
152 freezer_count(); \ 172 freezer_count();
153}) 173}
174
175/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
176static inline void freezable_schedule_unsafe(void)
177{
178 freezer_do_not_count();
179 schedule();
180 freezer_count_unsafe();
181}
182
183/*
184 * Like freezable_schedule_timeout(), but should not block the freezer. Do not
185 * call this with locks held.
186 */
187static inline long freezable_schedule_timeout(long timeout)
188{
189 long __retval;
190 freezer_do_not_count();
191 __retval = schedule_timeout(timeout);
192 freezer_count();
193 return __retval;
194}
195
196/*
197 * Like schedule_timeout_interruptible(), but should not block the freezer. Do not
198 * call this with locks held.
199 */
200static inline long freezable_schedule_timeout_interruptible(long timeout)
201{
202 long __retval;
203 freezer_do_not_count();
204 __retval = schedule_timeout_interruptible(timeout);
205 freezer_count();
206 return __retval;
207}
154 208
155/* Like schedule_timeout_killable(), but should not block the freezer. */ 209/* Like schedule_timeout_killable(), but should not block the freezer. */
156#define freezable_schedule_timeout_killable(timeout) \ 210static inline long freezable_schedule_timeout_killable(long timeout)
157({ \ 211{
158 long __retval; \ 212 long __retval;
159 freezer_do_not_count(); \ 213 freezer_do_not_count();
160 __retval = schedule_timeout_killable(timeout); \ 214 __retval = schedule_timeout_killable(timeout);
161 freezer_count(); \ 215 freezer_count();
162 __retval; \ 216 return __retval;
163}) 217}
218
219/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
220static inline long freezable_schedule_timeout_killable_unsafe(long timeout)
221{
222 long __retval;
223 freezer_do_not_count();
224 __retval = schedule_timeout_killable(timeout);
225 freezer_count_unsafe();
226 return __retval;
227}
228
229/*
230 * Like schedule_hrtimeout_range(), but should not block the freezer. Do not
231 * call this with locks held.
232 */
233static inline int freezable_schedule_hrtimeout_range(ktime_t *expires,
234 unsigned long delta, const enum hrtimer_mode mode)
235{
236 int __retval;
237 freezer_do_not_count();
238 __retval = schedule_hrtimeout_range(expires, delta, mode);
239 freezer_count();
240 return __retval;
241}
164 242
165/* 243/*
166 * Freezer-friendly wrappers around wait_event_interruptible(), 244 * Freezer-friendly wrappers around wait_event_interruptible(),
@@ -177,33 +255,45 @@ static inline bool freezer_should_skip(struct task_struct *p)
177 __retval; \ 255 __retval; \
178}) 256})
179 257
258/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
259#define wait_event_freezekillable_unsafe(wq, condition) \
260({ \
261 int __retval; \
262 freezer_do_not_count(); \
263 __retval = wait_event_killable(wq, (condition)); \
264 freezer_count_unsafe(); \
265 __retval; \
266})
267
180#define wait_event_freezable(wq, condition) \ 268#define wait_event_freezable(wq, condition) \
181({ \ 269({ \
182 int __retval; \ 270 int __retval; \
183 for (;;) { \ 271 freezer_do_not_count(); \
184 __retval = wait_event_interruptible(wq, \ 272 __retval = wait_event_interruptible(wq, (condition)); \
185 (condition) || freezing(current)); \ 273 freezer_count(); \
186 if (__retval || (condition)) \
187 break; \
188 try_to_freeze(); \
189 } \
190 __retval; \ 274 __retval; \
191}) 275})
192 276
193#define wait_event_freezable_timeout(wq, condition, timeout) \ 277#define wait_event_freezable_timeout(wq, condition, timeout) \
194({ \ 278({ \
195 long __retval = timeout; \ 279 long __retval = timeout; \
196 for (;;) { \ 280 freezer_do_not_count(); \
197 __retval = wait_event_interruptible_timeout(wq, \ 281 __retval = wait_event_interruptible_timeout(wq, (condition), \
198 (condition) || freezing(current), \ 282 __retval); \
199 __retval); \ 283 freezer_count(); \
200 if (__retval <= 0 || (condition)) \
201 break; \
202 try_to_freeze(); \
203 } \
204 __retval; \ 284 __retval; \
205}) 285})
206 286
287#define wait_event_freezable_exclusive(wq, condition) \
288({ \
289 int __retval; \
290 freezer_do_not_count(); \
291 __retval = wait_event_interruptible_exclusive(wq, condition); \
292 freezer_count(); \
293 __retval; \
294})
295
296
207#else /* !CONFIG_FREEZER */ 297#else /* !CONFIG_FREEZER */
208static inline bool frozen(struct task_struct *p) { return false; } 298static inline bool frozen(struct task_struct *p) { return false; }
209static inline bool freezing(struct task_struct *p) { return false; } 299static inline bool freezing(struct task_struct *p) { return false; }
@@ -225,18 +315,37 @@ static inline void set_freezable(void) {}
225 315
226#define freezable_schedule() schedule() 316#define freezable_schedule() schedule()
227 317
318#define freezable_schedule_unsafe() schedule()
319
320#define freezable_schedule_timeout(timeout) schedule_timeout(timeout)
321
322#define freezable_schedule_timeout_interruptible(timeout) \
323 schedule_timeout_interruptible(timeout)
324
228#define freezable_schedule_timeout_killable(timeout) \ 325#define freezable_schedule_timeout_killable(timeout) \
229 schedule_timeout_killable(timeout) 326 schedule_timeout_killable(timeout)
230 327
328#define freezable_schedule_timeout_killable_unsafe(timeout) \
329 schedule_timeout_killable(timeout)
330
331#define freezable_schedule_hrtimeout_range(expires, delta, mode) \
332 schedule_hrtimeout_range(expires, delta, mode)
333
231#define wait_event_freezable(wq, condition) \ 334#define wait_event_freezable(wq, condition) \
232 wait_event_interruptible(wq, condition) 335 wait_event_interruptible(wq, condition)
233 336
234#define wait_event_freezable_timeout(wq, condition, timeout) \ 337#define wait_event_freezable_timeout(wq, condition, timeout) \
235 wait_event_interruptible_timeout(wq, condition, timeout) 338 wait_event_interruptible_timeout(wq, condition, timeout)
236 339
340#define wait_event_freezable_exclusive(wq, condition) \
341 wait_event_interruptible_exclusive(wq, condition)
342
237#define wait_event_freezekillable(wq, condition) \ 343#define wait_event_freezekillable(wq, condition) \
238 wait_event_killable(wq, condition) 344 wait_event_killable(wq, condition)
239 345
346#define wait_event_freezekillable_unsafe(wq, condition) \
347 wait_event_killable(wq, condition)
348
240#endif /* !CONFIG_FREEZER */ 349#endif /* !CONFIG_FREEZER */
241 350
242#endif /* FREEZER_H_INCLUDED */ 351#endif /* FREEZER_H_INCLUDED */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 65c2be22b601..981874773e85 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -10,6 +10,7 @@
10#include <linux/stat.h> 10#include <linux/stat.h>
11#include <linux/cache.h> 11#include <linux/cache.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/llist.h>
13#include <linux/radix-tree.h> 14#include <linux/radix-tree.h>
14#include <linux/rbtree.h> 15#include <linux/rbtree.h>
15#include <linux/init.h> 16#include <linux/init.h>
@@ -364,7 +365,7 @@ struct address_space_operations {
364 365
365 /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ 366 /* Unfortunately this kludge is needed for FIBMAP. Don't use it */
366 sector_t (*bmap)(struct address_space *, sector_t); 367 sector_t (*bmap)(struct address_space *, sector_t);
367 void (*invalidatepage) (struct page *, unsigned long); 368 void (*invalidatepage) (struct page *, unsigned int, unsigned int);
368 int (*releasepage) (struct page *, gfp_t); 369 int (*releasepage) (struct page *, gfp_t);
369 void (*freepage)(struct page *); 370 void (*freepage)(struct page *);
370 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 371 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
@@ -372,14 +373,15 @@ struct address_space_operations {
372 int (*get_xip_mem)(struct address_space *, pgoff_t, int, 373 int (*get_xip_mem)(struct address_space *, pgoff_t, int,
373 void **, unsigned long *); 374 void **, unsigned long *);
374 /* 375 /*
375 * migrate the contents of a page to the specified target. If sync 376 * migrate the contents of a page to the specified target. If
376 * is false, it must not block. 377 * migrate_mode is MIGRATE_ASYNC, it must not block.
377 */ 378 */
378 int (*migratepage) (struct address_space *, 379 int (*migratepage) (struct address_space *,
379 struct page *, struct page *, enum migrate_mode); 380 struct page *, struct page *, enum migrate_mode);
380 int (*launder_page) (struct page *); 381 int (*launder_page) (struct page *);
381 int (*is_partially_uptodate) (struct page *, read_descriptor_t *, 382 int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
382 unsigned long); 383 unsigned long);
384 void (*is_dirty_writeback) (struct page *, bool *, bool *);
383 int (*error_remove_page)(struct address_space *, struct page *); 385 int (*error_remove_page)(struct address_space *, struct page *);
384 386
385 /* swapfile support */ 387 /* swapfile support */
@@ -767,6 +769,7 @@ struct file {
767 */ 769 */
768 union { 770 union {
769 struct list_head fu_list; 771 struct list_head fu_list;
772 struct llist_node fu_llist;
770 struct rcu_head fu_rcuhead; 773 struct rcu_head fu_rcuhead;
771 } f_u; 774 } f_u;
772 struct path f_path; 775 struct path f_path;
@@ -908,6 +911,7 @@ struct file_lock_operations {
908 911
909struct lock_manager_operations { 912struct lock_manager_operations {
910 int (*lm_compare_owner)(struct file_lock *, struct file_lock *); 913 int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
914 unsigned long (*lm_owner_key)(struct file_lock *);
911 void (*lm_notify)(struct file_lock *); /* unblock callback */ 915 void (*lm_notify)(struct file_lock *); /* unblock callback */
912 int (*lm_grant)(struct file_lock *, struct file_lock *, int); 916 int (*lm_grant)(struct file_lock *, struct file_lock *, int);
913 void (*lm_break)(struct file_lock *); 917 void (*lm_break)(struct file_lock *);
@@ -926,14 +930,33 @@ int locks_in_grace(struct net *);
926/* that will die - we need it for nfs_lock_info */ 930/* that will die - we need it for nfs_lock_info */
927#include <linux/nfs_fs_i.h> 931#include <linux/nfs_fs_i.h>
928 932
933/*
934 * struct file_lock represents a generic "file lock". It's used to represent
935 * POSIX byte range locks, BSD (flock) locks, and leases. It's important to
936 * note that the same struct is used to represent both a request for a lock and
937 * the lock itself, but the same object is never used for both.
938 *
939 * FIXME: should we create a separate "struct lock_request" to help distinguish
940 * these two uses?
941 *
942 * The i_flock list is ordered by:
943 *
944 * 1) lock type -- FL_LEASEs first, then FL_FLOCK, and finally FL_POSIX
945 * 2) lock owner
946 * 3) lock range start
947 * 4) lock range end
948 *
949 * Obviously, the last two criteria only matter for POSIX locks.
950 */
929struct file_lock { 951struct file_lock {
930 struct file_lock *fl_next; /* singly linked list for this inode */ 952 struct file_lock *fl_next; /* singly linked list for this inode */
931 struct list_head fl_link; /* doubly linked list of all locks */ 953 struct hlist_node fl_link; /* node in global lists */
932 struct list_head fl_block; /* circular list of blocked processes */ 954 struct list_head fl_block; /* circular list of blocked processes */
933 fl_owner_t fl_owner; 955 fl_owner_t fl_owner;
934 unsigned int fl_flags; 956 unsigned int fl_flags;
935 unsigned char fl_type; 957 unsigned char fl_type;
936 unsigned int fl_pid; 958 unsigned int fl_pid;
959 int fl_link_cpu; /* what cpu's list is this on? */
937 struct pid *fl_nspid; 960 struct pid *fl_nspid;
938 wait_queue_head_t fl_wait; 961 wait_queue_head_t fl_wait;
939 struct file *fl_file; 962 struct file *fl_file;
@@ -994,7 +1017,7 @@ extern void locks_release_private(struct file_lock *);
994extern void posix_test_lock(struct file *, struct file_lock *); 1017extern void posix_test_lock(struct file *, struct file_lock *);
995extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); 1018extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
996extern int posix_lock_file_wait(struct file *, struct file_lock *); 1019extern int posix_lock_file_wait(struct file *, struct file_lock *);
997extern int posix_unblock_lock(struct file *, struct file_lock *); 1020extern int posix_unblock_lock(struct file_lock *);
998extern int vfs_test_lock(struct file *, struct file_lock *); 1021extern int vfs_test_lock(struct file *, struct file_lock *);
999extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); 1022extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
1000extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); 1023extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
@@ -1006,9 +1029,6 @@ extern int vfs_setlease(struct file *, long, struct file_lock **);
1006extern int lease_modify(struct file_lock **, int); 1029extern int lease_modify(struct file_lock **, int);
1007extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 1030extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1008extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 1031extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1009extern void locks_delete_block(struct file_lock *waiter);
1010extern void lock_flocks(void);
1011extern void unlock_flocks(void);
1012#else /* !CONFIG_FILE_LOCKING */ 1032#else /* !CONFIG_FILE_LOCKING */
1013static inline int fcntl_getlk(struct file *file, struct flock __user *user) 1033static inline int fcntl_getlk(struct file *file, struct flock __user *user)
1014{ 1034{
@@ -1084,8 +1104,7 @@ static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl)
1084 return -ENOLCK; 1104 return -ENOLCK;
1085} 1105}
1086 1106
1087static inline int posix_unblock_lock(struct file *filp, 1107static inline int posix_unblock_lock(struct file_lock *waiter)
1088 struct file_lock *waiter)
1089{ 1108{
1090 return -ENOENT; 1109 return -ENOENT;
1091} 1110}
@@ -1150,19 +1169,6 @@ static inline int lock_may_write(struct inode *inode, loff_t start,
1150{ 1169{
1151 return 1; 1170 return 1;
1152} 1171}
1153
1154static inline void locks_delete_block(struct file_lock *waiter)
1155{
1156}
1157
1158static inline void lock_flocks(void)
1159{
1160}
1161
1162static inline void unlock_flocks(void)
1163{
1164}
1165
1166#endif /* !CONFIG_FILE_LOCKING */ 1172#endif /* !CONFIG_FILE_LOCKING */
1167 1173
1168 1174
@@ -1506,6 +1512,11 @@ int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags);
1506 * to have different dirent layouts depending on the binary type. 1512 * to have different dirent layouts depending on the binary type.
1507 */ 1513 */
1508typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); 1514typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
1515struct dir_context {
1516 const filldir_t actor;
1517 loff_t pos;
1518};
1519
1509struct block_device_operations; 1520struct block_device_operations;
1510 1521
1511/* These macros are for out of kernel modules to test that 1522/* These macros are for out of kernel modules to test that
@@ -1521,7 +1532,7 @@ struct file_operations {
1521 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); 1532 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
1522 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 1533 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1523 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 1534 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1524 int (*readdir) (struct file *, void *, filldir_t); 1535 int (*iterate) (struct file *, struct dir_context *);
1525 unsigned int (*poll) (struct file *, struct poll_table_struct *); 1536 unsigned int (*poll) (struct file *, struct poll_table_struct *);
1526 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 1537 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
1527 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 1538 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
@@ -1575,6 +1586,7 @@ struct inode_operations {
1575 int (*atomic_open)(struct inode *, struct dentry *, 1586 int (*atomic_open)(struct inode *, struct dentry *,
1576 struct file *, unsigned open_flag, 1587 struct file *, unsigned open_flag,
1577 umode_t create_mode, int *opened); 1588 umode_t create_mode, int *opened);
1589 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
1578} ____cacheline_aligned; 1590} ____cacheline_aligned;
1579 1591
1580ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, 1592ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
@@ -1738,6 +1750,7 @@ struct super_operations {
1738#define I_REFERENCED (1 << 8) 1750#define I_REFERENCED (1 << 8)
1739#define __I_DIO_WAKEUP 9 1751#define __I_DIO_WAKEUP 9
1740#define I_DIO_WAKEUP (1 << I_DIO_WAKEUP) 1752#define I_DIO_WAKEUP (1 << I_DIO_WAKEUP)
1753#define I_LINKABLE (1 << 10)
1741 1754
1742#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) 1755#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
1743 1756
@@ -1891,7 +1904,6 @@ extern int current_umask(void);
1891extern struct kobject *fs_kobj; 1904extern struct kobject *fs_kobj;
1892 1905
1893#define MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK) 1906#define MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK)
1894extern int rw_verify_area(int, struct file *, loff_t *, size_t);
1895 1907
1896#define FLOCK_VERIFY_READ 1 1908#define FLOCK_VERIFY_READ 1
1897#define FLOCK_VERIFY_WRITE 2 1909#define FLOCK_VERIFY_WRITE 2
@@ -2304,7 +2316,6 @@ extern struct file * open_exec(const char *);
2304/* fs/dcache.c -- generic fs support functions */ 2316/* fs/dcache.c -- generic fs support functions */
2305extern int is_subdir(struct dentry *, struct dentry *); 2317extern int is_subdir(struct dentry *, struct dentry *);
2306extern int path_is_under(struct path *, struct path *); 2318extern int path_is_under(struct path *, struct path *);
2307extern ino_t find_inode_number(struct dentry *, struct qstr *);
2308 2319
2309#include <linux/err.h> 2320#include <linux/err.h>
2310 2321
@@ -2419,9 +2430,12 @@ extern void
2419file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 2430file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
2420extern loff_t noop_llseek(struct file *file, loff_t offset, int whence); 2431extern loff_t noop_llseek(struct file *file, loff_t offset, int whence);
2421extern loff_t no_llseek(struct file *file, loff_t offset, int whence); 2432extern loff_t no_llseek(struct file *file, loff_t offset, int whence);
2433extern loff_t vfs_setpos(struct file *file, loff_t offset, loff_t maxsize);
2422extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence); 2434extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence);
2423extern loff_t generic_file_llseek_size(struct file *file, loff_t offset, 2435extern loff_t generic_file_llseek_size(struct file *file, loff_t offset,
2424 int whence, loff_t maxsize, loff_t eof); 2436 int whence, loff_t maxsize, loff_t eof);
2437extern loff_t fixed_size_llseek(struct file *file, loff_t offset,
2438 int whence, loff_t size);
2425extern int generic_file_open(struct inode * inode, struct file * filp); 2439extern int generic_file_open(struct inode * inode, struct file * filp);
2426extern int nonseekable_open(struct inode * inode, struct file * filp); 2440extern int nonseekable_open(struct inode * inode, struct file * filp);
2427 2441
@@ -2494,6 +2508,7 @@ loff_t inode_get_bytes(struct inode *inode);
2494void inode_set_bytes(struct inode *inode, loff_t bytes); 2508void inode_set_bytes(struct inode *inode, loff_t bytes);
2495 2509
2496extern int vfs_readdir(struct file *, filldir_t, void *); 2510extern int vfs_readdir(struct file *, filldir_t, void *);
2511extern int iterate_dir(struct file *, struct dir_context *);
2497 2512
2498extern int vfs_stat(const char __user *, struct kstat *); 2513extern int vfs_stat(const char __user *, struct kstat *);
2499extern int vfs_lstat(const char __user *, struct kstat *); 2514extern int vfs_lstat(const char __user *, struct kstat *);
@@ -2524,7 +2539,7 @@ extern void iterate_supers_type(struct file_system_type *,
2524extern int dcache_dir_open(struct inode *, struct file *); 2539extern int dcache_dir_open(struct inode *, struct file *);
2525extern int dcache_dir_close(struct inode *, struct file *); 2540extern int dcache_dir_close(struct inode *, struct file *);
2526extern loff_t dcache_dir_lseek(struct file *, loff_t, int); 2541extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
2527extern int dcache_readdir(struct file *, void *, filldir_t); 2542extern int dcache_readdir(struct file *, struct dir_context *);
2528extern int simple_setattr(struct dentry *, struct iattr *); 2543extern int simple_setattr(struct dentry *, struct iattr *);
2529extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2544extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
2530extern int simple_statfs(struct dentry *, struct kstatfs *); 2545extern int simple_statfs(struct dentry *, struct kstatfs *);
@@ -2688,4 +2703,41 @@ static inline void inode_has_no_xattr(struct inode *inode)
2688 inode->i_flags |= S_NOSEC; 2703 inode->i_flags |= S_NOSEC;
2689} 2704}
2690 2705
2706static inline bool dir_emit(struct dir_context *ctx,
2707 const char *name, int namelen,
2708 u64 ino, unsigned type)
2709{
2710 return ctx->actor(ctx, name, namelen, ctx->pos, ino, type) == 0;
2711}
2712static inline bool dir_emit_dot(struct file *file, struct dir_context *ctx)
2713{
2714 return ctx->actor(ctx, ".", 1, ctx->pos,
2715 file->f_path.dentry->d_inode->i_ino, DT_DIR) == 0;
2716}
2717static inline bool dir_emit_dotdot(struct file *file, struct dir_context *ctx)
2718{
2719 return ctx->actor(ctx, "..", 2, ctx->pos,
2720 parent_ino(file->f_path.dentry), DT_DIR) == 0;
2721}
2722static inline bool dir_emit_dots(struct file *file, struct dir_context *ctx)
2723{
2724 if (ctx->pos == 0) {
2725 if (!dir_emit_dot(file, ctx))
2726 return false;
2727 ctx->pos = 1;
2728 }
2729 if (ctx->pos == 1) {
2730 if (!dir_emit_dotdot(file, ctx))
2731 return false;
2732 ctx->pos = 2;
2733 }
2734 return true;
2735}
2736static inline bool dir_relax(struct inode *inode)
2737{
2738 mutex_unlock(&inode->i_mutex);
2739 mutex_lock(&inode->i_mutex);
2740 return !IS_DEADDIR(inode);
2741}
2742
2691#endif /* _LINUX_FS_H */ 2743#endif /* _LINUX_FS_H */
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index 5dfa0aa216b6..a9ff9a36b86d 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -97,7 +97,8 @@ struct fscache_operation {
97#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */ 97#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */
98#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */ 98#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */
99#define FSCACHE_OP_DEC_READ_CNT 6 /* decrement object->n_reads on destruction */ 99#define FSCACHE_OP_DEC_READ_CNT 6 /* decrement object->n_reads on destruction */
100#define FSCACHE_OP_KEEP_FLAGS 0x0070 /* flags to keep when repurposing an op */ 100#define FSCACHE_OP_UNUSE_COOKIE 7 /* call fscache_unuse_cookie() on completion */
101#define FSCACHE_OP_KEEP_FLAGS 0x00f0 /* flags to keep when repurposing an op */
101 102
102 enum fscache_operation_state state; 103 enum fscache_operation_state state;
103 atomic_t usage; 104 atomic_t usage;
@@ -150,7 +151,7 @@ struct fscache_retrieval {
150 void *context; /* netfs read context (pinned) */ 151 void *context; /* netfs read context (pinned) */
151 struct list_head to_do; /* list of things to be done by the backend */ 152 struct list_head to_do; /* list of things to be done by the backend */
152 unsigned long start_time; /* time at which retrieval started */ 153 unsigned long start_time; /* time at which retrieval started */
153 unsigned n_pages; /* number of pages to be retrieved */ 154 atomic_t n_pages; /* number of pages to be retrieved */
154}; 155};
155 156
156typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op, 157typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op,
@@ -194,15 +195,14 @@ static inline void fscache_enqueue_retrieval(struct fscache_retrieval *op)
194static inline void fscache_retrieval_complete(struct fscache_retrieval *op, 195static inline void fscache_retrieval_complete(struct fscache_retrieval *op,
195 int n_pages) 196 int n_pages)
196{ 197{
197 op->n_pages -= n_pages; 198 atomic_sub(n_pages, &op->n_pages);
198 if (op->n_pages <= 0) 199 if (atomic_read(&op->n_pages) <= 0)
199 fscache_op_complete(&op->op, true); 200 fscache_op_complete(&op->op, true);
200} 201}
201 202
202/** 203/**
203 * fscache_put_retrieval - Drop a reference to a retrieval operation 204 * fscache_put_retrieval - Drop a reference to a retrieval operation
204 * @op: The retrieval operation affected 205 * @op: The retrieval operation affected
205 * @n_pages: The number of pages to account for
206 * 206 *
207 * Drop a reference to a retrieval operation. 207 * Drop a reference to a retrieval operation.
208 */ 208 */
@@ -314,6 +314,7 @@ struct fscache_cache_ops {
314struct fscache_cookie { 314struct fscache_cookie {
315 atomic_t usage; /* number of users of this cookie */ 315 atomic_t usage; /* number of users of this cookie */
316 atomic_t n_children; /* number of children of this cookie */ 316 atomic_t n_children; /* number of children of this cookie */
317 atomic_t n_active; /* number of active users of netfs ptrs */
317 spinlock_t lock; 318 spinlock_t lock;
318 spinlock_t stores_lock; /* lock on page store tree */ 319 spinlock_t stores_lock; /* lock on page store tree */
319 struct hlist_head backing_objects; /* object(s) backing this file/index */ 320 struct hlist_head backing_objects; /* object(s) backing this file/index */
@@ -326,13 +327,11 @@ struct fscache_cookie {
326 327
327 unsigned long flags; 328 unsigned long flags;
328#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */ 329#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */
329#define FSCACHE_COOKIE_CREATING 1 /* T if non-index object being created still */ 330#define FSCACHE_COOKIE_NO_DATA_YET 1 /* T if new object with no cached data yet */
330#define FSCACHE_COOKIE_NO_DATA_YET 2 /* T if new object with no cached data yet */ 331#define FSCACHE_COOKIE_UNAVAILABLE 2 /* T if cookie is unavailable (error, etc) */
331#define FSCACHE_COOKIE_PENDING_FILL 3 /* T if pending initial fill on object */ 332#define FSCACHE_COOKIE_INVALIDATING 3 /* T if cookie is being invalidated */
332#define FSCACHE_COOKIE_FILLING 4 /* T if filling object incrementally */ 333#define FSCACHE_COOKIE_RELINQUISHED 4 /* T if cookie has been relinquished */
333#define FSCACHE_COOKIE_UNAVAILABLE 5 /* T if cookie is unavailable (error, etc) */ 334#define FSCACHE_COOKIE_RETIRED 5 /* T if cookie was retired */
334#define FSCACHE_COOKIE_WAITING_ON_READS 6 /* T if cookie is waiting on reads */
335#define FSCACHE_COOKIE_INVALIDATING 7 /* T if cookie is being invalidated */
336}; 335};
337 336
338extern struct fscache_cookie fscache_fsdef_index; 337extern struct fscache_cookie fscache_fsdef_index;
@@ -341,45 +340,40 @@ extern struct fscache_cookie fscache_fsdef_index;
341 * Event list for fscache_object::{event_mask,events} 340 * Event list for fscache_object::{event_mask,events}
342 */ 341 */
343enum { 342enum {
344 FSCACHE_OBJECT_EV_REQUEUE, /* T if object should be requeued */ 343 FSCACHE_OBJECT_EV_NEW_CHILD, /* T if object has a new child */
344 FSCACHE_OBJECT_EV_PARENT_READY, /* T if object's parent is ready */
345 FSCACHE_OBJECT_EV_UPDATE, /* T if object should be updated */ 345 FSCACHE_OBJECT_EV_UPDATE, /* T if object should be updated */
346 FSCACHE_OBJECT_EV_INVALIDATE, /* T if cache requested object invalidation */ 346 FSCACHE_OBJECT_EV_INVALIDATE, /* T if cache requested object invalidation */
347 FSCACHE_OBJECT_EV_CLEARED, /* T if accessors all gone */ 347 FSCACHE_OBJECT_EV_CLEARED, /* T if accessors all gone */
348 FSCACHE_OBJECT_EV_ERROR, /* T if fatal error occurred during processing */ 348 FSCACHE_OBJECT_EV_ERROR, /* T if fatal error occurred during processing */
349 FSCACHE_OBJECT_EV_RELEASE, /* T if netfs requested object release */ 349 FSCACHE_OBJECT_EV_KILL, /* T if netfs relinquished or cache withdrew object */
350 FSCACHE_OBJECT_EV_RETIRE, /* T if netfs requested object retirement */
351 FSCACHE_OBJECT_EV_WITHDRAW, /* T if cache requested object withdrawal */
352 NR_FSCACHE_OBJECT_EVENTS 350 NR_FSCACHE_OBJECT_EVENTS
353}; 351};
354 352
355#define FSCACHE_OBJECT_EVENTS_MASK ((1UL << NR_FSCACHE_OBJECT_EVENTS) - 1) 353#define FSCACHE_OBJECT_EVENTS_MASK ((1UL << NR_FSCACHE_OBJECT_EVENTS) - 1)
356 354
357/* 355/*
356 * States for object state machine.
357 */
358struct fscache_transition {
359 unsigned long events;
360 const struct fscache_state *transit_to;
361};
362
363struct fscache_state {
364 char name[24];
365 char short_name[8];
366 const struct fscache_state *(*work)(struct fscache_object *object,
367 int event);
368 const struct fscache_transition transitions[];
369};
370
371/*
358 * on-disk cache file or index handle 372 * on-disk cache file or index handle
359 */ 373 */
360struct fscache_object { 374struct fscache_object {
361 enum fscache_object_state { 375 const struct fscache_state *state; /* Object state machine state */
362 FSCACHE_OBJECT_INIT, /* object in initial unbound state */ 376 const struct fscache_transition *oob_table; /* OOB state transition table */
363 FSCACHE_OBJECT_LOOKING_UP, /* looking up object */
364 FSCACHE_OBJECT_CREATING, /* creating object */
365
366 /* active states */
367 FSCACHE_OBJECT_AVAILABLE, /* cleaning up object after creation */
368 FSCACHE_OBJECT_ACTIVE, /* object is usable */
369 FSCACHE_OBJECT_INVALIDATING, /* object is invalidating */
370 FSCACHE_OBJECT_UPDATING, /* object is updating */
371
372 /* terminal states */
373 FSCACHE_OBJECT_DYING, /* object waiting for accessors to finish */
374 FSCACHE_OBJECT_LC_DYING, /* object cleaning up after lookup/create */
375 FSCACHE_OBJECT_ABORT_INIT, /* abort the init state */
376 FSCACHE_OBJECT_RELEASING, /* releasing object */
377 FSCACHE_OBJECT_RECYCLING, /* retiring object */
378 FSCACHE_OBJECT_WITHDRAWING, /* withdrawing object */
379 FSCACHE_OBJECT_DEAD, /* object is now dead */
380 FSCACHE_OBJECT__NSTATES
381 } state;
382
383 int debug_id; /* debugging ID */ 377 int debug_id; /* debugging ID */
384 int n_children; /* number of child objects */ 378 int n_children; /* number of child objects */
385 int n_ops; /* number of extant ops on object */ 379 int n_ops; /* number of extant ops on object */
@@ -390,6 +384,7 @@ struct fscache_object {
390 spinlock_t lock; /* state and operations lock */ 384 spinlock_t lock; /* state and operations lock */
391 385
392 unsigned long lookup_jif; /* time at which lookup started */ 386 unsigned long lookup_jif; /* time at which lookup started */
387 unsigned long oob_event_mask; /* OOB events this object is interested in */
393 unsigned long event_mask; /* events this object is interested in */ 388 unsigned long event_mask; /* events this object is interested in */
394 unsigned long events; /* events to be processed by this object 389 unsigned long events; /* events to be processed by this object
395 * (order is important - using fls) */ 390 * (order is important - using fls) */
@@ -398,6 +393,9 @@ struct fscache_object {
398#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */ 393#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */
399#define FSCACHE_OBJECT_PENDING_WRITE 1 /* T if object has pending write */ 394#define FSCACHE_OBJECT_PENDING_WRITE 1 /* T if object has pending write */
400#define FSCACHE_OBJECT_WAITING 2 /* T if object is waiting on its parent */ 395#define FSCACHE_OBJECT_WAITING 2 /* T if object is waiting on its parent */
396#define FSCACHE_OBJECT_IS_LIVE 3 /* T if object is not withdrawn or relinquished */
397#define FSCACHE_OBJECT_IS_LOOKED_UP 4 /* T if object has been looked up */
398#define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */
401 399
402 struct list_head cache_link; /* link in cache->object_list */ 400 struct list_head cache_link; /* link in cache->object_list */
403 struct hlist_node cookie_link; /* link in cookie->backing_objects */ 401 struct hlist_node cookie_link; /* link in cookie->backing_objects */
@@ -415,62 +413,40 @@ struct fscache_object {
415 loff_t store_limit_l; /* current storage limit */ 413 loff_t store_limit_l; /* current storage limit */
416}; 414};
417 415
418extern const char *fscache_object_states[]; 416extern void fscache_object_init(struct fscache_object *, struct fscache_cookie *,
417 struct fscache_cache *);
418extern void fscache_object_destroy(struct fscache_object *);
419 419
420#define fscache_object_is_active(obj) \ 420extern void fscache_object_lookup_negative(struct fscache_object *object);
421 (!test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \ 421extern void fscache_obtained_object(struct fscache_object *object);
422 (obj)->state >= FSCACHE_OBJECT_AVAILABLE && \
423 (obj)->state < FSCACHE_OBJECT_DYING)
424 422
425#define fscache_object_is_dead(obj) \ 423static inline bool fscache_object_is_live(struct fscache_object *object)
426 (test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \ 424{
427 (obj)->state >= FSCACHE_OBJECT_DYING) 425 return test_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags);
426}
428 427
429extern void fscache_object_work_func(struct work_struct *work); 428static inline bool fscache_object_is_dying(struct fscache_object *object)
429{
430 return !fscache_object_is_live(object);
431}
430 432
431/** 433static inline bool fscache_object_is_available(struct fscache_object *object)
432 * fscache_object_init - Initialise a cache object description
433 * @object: Object description
434 *
435 * Initialise a cache object description to its basic values.
436 *
437 * See Documentation/filesystems/caching/backend-api.txt for a complete
438 * description.
439 */
440static inline
441void fscache_object_init(struct fscache_object *object,
442 struct fscache_cookie *cookie,
443 struct fscache_cache *cache)
444{ 434{
445 atomic_inc(&cache->object_count); 435 return test_bit(FSCACHE_OBJECT_IS_AVAILABLE, &object->flags);
446
447 object->state = FSCACHE_OBJECT_INIT;
448 spin_lock_init(&object->lock);
449 INIT_LIST_HEAD(&object->cache_link);
450 INIT_HLIST_NODE(&object->cookie_link);
451 INIT_WORK(&object->work, fscache_object_work_func);
452 INIT_LIST_HEAD(&object->dependents);
453 INIT_LIST_HEAD(&object->dep_link);
454 INIT_LIST_HEAD(&object->pending_ops);
455 object->n_children = 0;
456 object->n_ops = object->n_in_progress = object->n_exclusive = 0;
457 object->events = object->event_mask = 0;
458 object->flags = 0;
459 object->store_limit = 0;
460 object->store_limit_l = 0;
461 object->cache = cache;
462 object->cookie = cookie;
463 object->parent = NULL;
464} 436}
465 437
466extern void fscache_object_lookup_negative(struct fscache_object *object); 438static inline bool fscache_object_is_active(struct fscache_object *object)
467extern void fscache_obtained_object(struct fscache_object *object); 439{
440 return fscache_object_is_available(object) &&
441 fscache_object_is_live(object) &&
442 !test_bit(FSCACHE_IOERROR, &object->cache->flags);
443}
468 444
469#ifdef CONFIG_FSCACHE_OBJECT_LIST 445static inline bool fscache_object_is_dead(struct fscache_object *object)
470extern void fscache_object_destroy(struct fscache_object *object); 446{
471#else 447 return fscache_object_is_dying(object) &&
472#define fscache_object_destroy(object) do {} while(0) 448 test_bit(FSCACHE_IOERROR, &object->cache->flags);
473#endif 449}
474 450
475/** 451/**
476 * fscache_object_destroyed - Note destruction of an object in a cache 452 * fscache_object_destroyed - Note destruction of an object in a cache
@@ -531,6 +507,33 @@ static inline void fscache_end_io(struct fscache_retrieval *op,
531 op->end_io_func(page, op->context, error); 507 op->end_io_func(page, op->context, error);
532} 508}
533 509
510/**
511 * fscache_use_cookie - Request usage of cookie attached to an object
512 * @object: Object description
513 *
514 * Request usage of the cookie attached to an object. NULL is returned if the
515 * relinquishment had reduced the cookie usage count to 0.
516 */
517static inline bool fscache_use_cookie(struct fscache_object *object)
518{
519 struct fscache_cookie *cookie = object->cookie;
520 return atomic_inc_not_zero(&cookie->n_active) != 0;
521}
522
523/**
524 * fscache_unuse_cookie - Cease usage of cookie attached to an object
525 * @object: Object description
526 *
527 * Cease usage of the cookie attached to an object. When the users count
528 * reaches zero then the cookie relinquishment will be permitted to proceed.
529 */
530static inline void fscache_unuse_cookie(struct fscache_object *object)
531{
532 struct fscache_cookie *cookie = object->cookie;
533 if (atomic_dec_and_test(&cookie->n_active))
534 wake_up_atomic_t(&cookie->n_active);
535}
536
534/* 537/*
535 * out-of-line cache backend functions 538 * out-of-line cache backend functions
536 */ 539 */
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index a78680a92dba..1c804b057fb1 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -38,7 +38,7 @@ static inline int fsnotify_parent(struct path *path, struct dentry *dentry, __u3
38static inline int fsnotify_perm(struct file *file, int mask) 38static inline int fsnotify_perm(struct file *file, int mask)
39{ 39{
40 struct path *path = &file->f_path; 40 struct path *path = &file->f_path;
41 struct inode *inode = path->dentry->d_inode; 41 struct inode *inode = file_inode(file);
42 __u32 fsnotify_mask = 0; 42 __u32 fsnotify_mask = 0;
43 int ret; 43 int ret;
44 44
@@ -192,7 +192,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
192static inline void fsnotify_access(struct file *file) 192static inline void fsnotify_access(struct file *file)
193{ 193{
194 struct path *path = &file->f_path; 194 struct path *path = &file->f_path;
195 struct inode *inode = path->dentry->d_inode; 195 struct inode *inode = file_inode(file);
196 __u32 mask = FS_ACCESS; 196 __u32 mask = FS_ACCESS;
197 197
198 if (S_ISDIR(inode->i_mode)) 198 if (S_ISDIR(inode->i_mode))
@@ -210,7 +210,7 @@ static inline void fsnotify_access(struct file *file)
210static inline void fsnotify_modify(struct file *file) 210static inline void fsnotify_modify(struct file *file)
211{ 211{
212 struct path *path = &file->f_path; 212 struct path *path = &file->f_path;
213 struct inode *inode = path->dentry->d_inode; 213 struct inode *inode = file_inode(file);
214 __u32 mask = FS_MODIFY; 214 __u32 mask = FS_MODIFY;
215 215
216 if (S_ISDIR(inode->i_mode)) 216 if (S_ISDIR(inode->i_mode))
@@ -228,7 +228,7 @@ static inline void fsnotify_modify(struct file *file)
228static inline void fsnotify_open(struct file *file) 228static inline void fsnotify_open(struct file *file)
229{ 229{
230 struct path *path = &file->f_path; 230 struct path *path = &file->f_path;
231 struct inode *inode = path->dentry->d_inode; 231 struct inode *inode = file_inode(file);
232 __u32 mask = FS_OPEN; 232 __u32 mask = FS_OPEN;
233 233
234 if (S_ISDIR(inode->i_mode)) 234 if (S_ISDIR(inode->i_mode))
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 99d0fbcbaf79..9f15c0064c50 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -566,10 +566,6 @@ static inline ssize_t ftrace_filter_write(struct file *file, const char __user *
566 size_t cnt, loff_t *ppos) { return -ENODEV; } 566 size_t cnt, loff_t *ppos) { return -ENODEV; }
567static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf, 567static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
568 size_t cnt, loff_t *ppos) { return -ENODEV; } 568 size_t cnt, loff_t *ppos) { return -ENODEV; }
569static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence)
570{
571 return -ENODEV;
572}
573static inline int 569static inline int
574ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; } 570ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; }
575#endif /* CONFIG_DYNAMIC_FTRACE */ 571#endif /* CONFIG_DYNAMIC_FTRACE */
@@ -828,10 +824,15 @@ enum ftrace_dump_mode;
828 824
829extern enum ftrace_dump_mode ftrace_dump_on_oops; 825extern enum ftrace_dump_mode ftrace_dump_on_oops;
830 826
827extern void disable_trace_on_warning(void);
828extern int __disable_trace_on_warning;
829
831#ifdef CONFIG_PREEMPT 830#ifdef CONFIG_PREEMPT
832#define INIT_TRACE_RECURSION .trace_recursion = 0, 831#define INIT_TRACE_RECURSION .trace_recursion = 0,
833#endif 832#endif
834 833
834#else /* CONFIG_TRACING */
835static inline void disable_trace_on_warning(void) { }
835#endif /* CONFIG_TRACING */ 836#endif /* CONFIG_TRACING */
836 837
837#ifndef INIT_TRACE_RECURSION 838#ifndef INIT_TRACE_RECURSION
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 4372658c73ae..120d57a1c3a5 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -78,6 +78,11 @@ struct trace_iterator {
78 /* trace_seq for __print_flags() and __print_symbolic() etc. */ 78 /* trace_seq for __print_flags() and __print_symbolic() etc. */
79 struct trace_seq tmp_seq; 79 struct trace_seq tmp_seq;
80 80
81 cpumask_var_t started;
82
83 /* it's true when current open file is snapshot */
84 bool snapshot;
85
81 /* The below is zeroed out in pipe_read */ 86 /* The below is zeroed out in pipe_read */
82 struct trace_seq seq; 87 struct trace_seq seq;
83 struct trace_entry *ent; 88 struct trace_entry *ent;
@@ -90,10 +95,7 @@ struct trace_iterator {
90 loff_t pos; 95 loff_t pos;
91 long idx; 96 long idx;
92 97
93 cpumask_var_t started; 98 /* All new field here will be zeroed out in pipe_read */
94
95 /* it's true when current open file is snapshot */
96 bool snapshot;
97}; 99};
98 100
99enum trace_iter_flags { 101enum trace_iter_flags {
@@ -332,7 +334,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type,
332 const char *name, int offset, int size, 334 const char *name, int offset, int size,
333 int is_signed, int filter_type); 335 int is_signed, int filter_type);
334extern int trace_add_event_call(struct ftrace_event_call *call); 336extern int trace_add_event_call(struct ftrace_event_call *call);
335extern void trace_remove_event_call(struct ftrace_event_call *call); 337extern int trace_remove_event_call(struct ftrace_event_call *call);
336 338
337#define is_signed_type(type) (((type)(-1)) < (type)1) 339#define is_signed_type(type) (((type)(-1)) < (type)1)
338 340
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 0f615eb23d05..9b4dd491f7e8 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -209,7 +209,7 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
209 * 0x9 => DMA or NORMAL (MOVABLE+DMA) 209 * 0x9 => DMA or NORMAL (MOVABLE+DMA)
210 * 0xa => MOVABLE (Movable is valid only if HIGHMEM is set too) 210 * 0xa => MOVABLE (Movable is valid only if HIGHMEM is set too)
211 * 0xb => BAD (MOVABLE+HIGHMEM+DMA) 211 * 0xb => BAD (MOVABLE+HIGHMEM+DMA)
212 * 0xc => DMA32 (MOVABLE+HIGHMEM+DMA32) 212 * 0xc => DMA32 (MOVABLE+DMA32)
213 * 0xd => BAD (MOVABLE+DMA32+DMA) 213 * 0xd => BAD (MOVABLE+DMA32+DMA)
214 * 0xe => BAD (MOVABLE+DMA32+HIGHMEM) 214 * 0xe => BAD (MOVABLE+DMA32+HIGHMEM)
215 * 0xf => BAD (MOVABLE+DMA32+HIGHMEM+DMA) 215 * 0xf => BAD (MOVABLE+DMA32+HIGHMEM+DMA)
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index c1d6555d2567..05bcc0903766 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -128,7 +128,7 @@ extern void synchronize_irq(unsigned int irq);
128# define synchronize_irq(irq) barrier() 128# define synchronize_irq(irq) barrier()
129#endif 129#endif
130 130
131#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU) 131#if defined(CONFIG_TINY_RCU)
132 132
133static inline void rcu_nmi_enter(void) 133static inline void rcu_nmi_enter(void)
134{ 134{
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 528454c2caa9..b60de92e2edc 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -60,9 +60,9 @@ extern pmd_t *page_check_address_pmd(struct page *page,
60#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER) 60#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
61 61
62#ifdef CONFIG_TRANSPARENT_HUGEPAGE 62#ifdef CONFIG_TRANSPARENT_HUGEPAGE
63#define HPAGE_PMD_SHIFT HPAGE_SHIFT 63#define HPAGE_PMD_SHIFT PMD_SHIFT
64#define HPAGE_PMD_MASK HPAGE_MASK 64#define HPAGE_PMD_SIZE ((1UL) << HPAGE_PMD_SHIFT)
65#define HPAGE_PMD_SIZE HPAGE_SIZE 65#define HPAGE_PMD_MASK (~(HPAGE_PMD_SIZE - 1))
66 66
67extern bool is_vma_temporary_stack(struct vm_area_struct *vma); 67extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
68 68
@@ -123,7 +123,7 @@ extern void __split_huge_page_pmd(struct vm_area_struct *vma,
123 } while (0) 123 } while (0)
124extern void split_huge_page_pmd_mm(struct mm_struct *mm, unsigned long address, 124extern void split_huge_page_pmd_mm(struct mm_struct *mm, unsigned long address,
125 pmd_t *pmd); 125 pmd_t *pmd);
126#if HPAGE_PMD_ORDER > MAX_ORDER 126#if HPAGE_PMD_ORDER >= MAX_ORDER
127#error "hugepages can't be allocated by the buddy allocator" 127#error "hugepages can't be allocated by the buddy allocator"
128#endif 128#endif
129extern int hugepage_madvise(struct vm_area_struct *vma, 129extern int hugepage_madvise(struct vm_area_struct *vma,
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 6b4890fa57e7..c2b1801a160b 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -55,7 +55,6 @@ void __unmap_hugepage_range_final(struct mmu_gather *tlb,
55void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, 55void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
56 unsigned long start, unsigned long end, 56 unsigned long start, unsigned long end,
57 struct page *ref_page); 57 struct page *ref_page);
58int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
59void hugetlb_report_meminfo(struct seq_file *); 58void hugetlb_report_meminfo(struct seq_file *);
60int hugetlb_report_node_meminfo(int, char *); 59int hugetlb_report_node_meminfo(int, char *);
61void hugetlb_show_meminfo(void); 60void hugetlb_show_meminfo(void);
@@ -69,6 +68,10 @@ void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
69int dequeue_hwpoisoned_huge_page(struct page *page); 68int dequeue_hwpoisoned_huge_page(struct page *page);
70void copy_huge_page(struct page *dst, struct page *src); 69void copy_huge_page(struct page *dst, struct page *src);
71 70
71#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
72pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
73#endif
74
72extern unsigned long hugepages_treat_as_movable; 75extern unsigned long hugepages_treat_as_movable;
73extern const unsigned long hugetlb_zero, hugetlb_infinity; 76extern const unsigned long hugetlb_zero, hugetlb_infinity;
74extern int sysctl_hugetlb_shm_group; 77extern int sysctl_hugetlb_shm_group;
@@ -110,7 +113,6 @@ static inline unsigned long hugetlb_total_pages(void)
110#define follow_hugetlb_page(m,v,p,vs,a,b,i,w) ({ BUG(); 0; }) 113#define follow_hugetlb_page(m,v,p,vs,a,b,i,w) ({ BUG(); 0; })
111#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) 114#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL)
112#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) 115#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; })
113#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; })
114static inline void hugetlb_report_meminfo(struct seq_file *m) 116static inline void hugetlb_report_meminfo(struct seq_file *m)
115{ 117{
116} 118}
@@ -358,6 +360,17 @@ static inline int hstate_index(struct hstate *h)
358 return h - hstates; 360 return h - hstates;
359} 361}
360 362
363pgoff_t __basepage_index(struct page *page);
364
365/* Return page->index in PAGE_SIZE units */
366static inline pgoff_t basepage_index(struct page *page)
367{
368 if (!PageCompound(page))
369 return page->index;
370
371 return __basepage_index(page);
372}
373
361#else /* CONFIG_HUGETLB_PAGE */ 374#else /* CONFIG_HUGETLB_PAGE */
362struct hstate {}; 375struct hstate {};
363#define alloc_huge_page_node(h, nid) NULL 376#define alloc_huge_page_node(h, nid) NULL
@@ -378,6 +391,11 @@ static inline unsigned int pages_per_huge_page(struct hstate *h)
378} 391}
379#define hstate_index_to_shift(index) 0 392#define hstate_index_to_shift(index) 0
380#define hstate_index(h) 0 393#define hstate_index(h) 0
394
395static inline pgoff_t basepage_index(struct page *page)
396{
397 return page->index;
398}
381#endif /* CONFIG_HUGETLB_PAGE */ 399#endif /* CONFIG_HUGETLB_PAGE */
382 400
383#endif /* _LINUX_HUGETLB_H */ 401#endif /* _LINUX_HUGETLB_H */
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index c2559847d7ee..fae8bac907ef 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -909,6 +909,7 @@ enum vmbus_channel_state {
909 CHANNEL_OFFER_STATE, 909 CHANNEL_OFFER_STATE,
910 CHANNEL_OPENING_STATE, 910 CHANNEL_OPENING_STATE,
911 CHANNEL_OPEN_STATE, 911 CHANNEL_OPEN_STATE,
912 CHANNEL_OPENED_STATE,
912}; 913};
913 914
914struct vmbus_channel_debug_info { 915struct vmbus_channel_debug_info {
@@ -1046,6 +1047,38 @@ struct vmbus_channel {
1046 * preserve the earlier behavior. 1047 * preserve the earlier behavior.
1047 */ 1048 */
1048 u32 target_vp; 1049 u32 target_vp;
1050 /*
1051 * Support for sub-channels. For high performance devices,
1052 * it will be useful to have multiple sub-channels to support
1053 * a scalable communication infrastructure with the host.
1054 * The support for sub-channels is implemented as an extention
1055 * to the current infrastructure.
1056 * The initial offer is considered the primary channel and this
1057 * offer message will indicate if the host supports sub-channels.
1058 * The guest is free to ask for sub-channels to be offerred and can
1059 * open these sub-channels as a normal "primary" channel. However,
1060 * all sub-channels will have the same type and instance guids as the
1061 * primary channel. Requests sent on a given channel will result in a
1062 * response on the same channel.
1063 */
1064
1065 /*
1066 * Sub-channel creation callback. This callback will be called in
1067 * process context when a sub-channel offer is received from the host.
1068 * The guest can open the sub-channel in the context of this callback.
1069 */
1070 void (*sc_creation_callback)(struct vmbus_channel *new_sc);
1071
1072 spinlock_t sc_lock;
1073 /*
1074 * All Sub-channels of a primary channel are linked here.
1075 */
1076 struct list_head sc_list;
1077 /*
1078 * The primary channel this sub-channel belongs to.
1079 * This will be NULL for the primary channel.
1080 */
1081 struct vmbus_channel *primary_channel;
1049}; 1082};
1050 1083
1051static inline void set_channel_read_state(struct vmbus_channel *c, bool state) 1084static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
@@ -1057,6 +1090,34 @@ void vmbus_onmessage(void *context);
1057 1090
1058int vmbus_request_offers(void); 1091int vmbus_request_offers(void);
1059 1092
1093/*
1094 * APIs for managing sub-channels.
1095 */
1096
1097void vmbus_set_sc_create_callback(struct vmbus_channel *primary_channel,
1098 void (*sc_cr_cb)(struct vmbus_channel *new_sc));
1099
1100/*
1101 * Retrieve the (sub) channel on which to send an outgoing request.
1102 * When a primary channel has multiple sub-channels, we choose a
1103 * channel whose VCPU binding is closest to the VCPU on which
1104 * this call is being made.
1105 */
1106struct vmbus_channel *vmbus_get_outgoing_channel(struct vmbus_channel *primary);
1107
1108/*
1109 * Check if sub-channels have already been offerred. This API will be useful
1110 * when the driver is unloaded after establishing sub-channels. In this case,
1111 * when the driver is re-loaded, the driver would have to check if the
1112 * subchannels have already been established before attempting to request
1113 * the creation of sub-channels.
1114 * This function returns TRUE to indicate that subchannels have already been
1115 * created.
1116 * This function should be invoked after setting the callback function for
1117 * sub-channel creation.
1118 */
1119bool vmbus_are_subchannels_present(struct vmbus_channel *primary);
1120
1060/* The format must be the same as struct vmdata_gpa_direct */ 1121/* The format must be the same as struct vmdata_gpa_direct */
1061struct vmbus_channel_packet_page_buffer { 1122struct vmbus_channel_packet_page_buffer {
1062 u16 type; 1123 u16 type;
@@ -1327,6 +1388,15 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
1327 0x8e, 0x77, 0x05, 0x58, 0xeb, 0x10, 0x73, 0xf8 \ 1388 0x8e, 0x77, 0x05, 0x58, 0xeb, 0x10, 0x73, 0xf8 \
1328 } 1389 }
1329 1390
1391/*
1392 * Synthetic FC GUID
1393 * {2f9bcc4a-0069-4af3-b76b-6fd0be528cda}
1394 */
1395#define HV_SYNTHFC_GUID \
1396 .guid = { \
1397 0x4A, 0xCC, 0x9B, 0x2F, 0x69, 0x00, 0xF3, 0x4A, \
1398 0xB7, 0x6B, 0x6F, 0xD0, 0xBE, 0x52, 0x8C, 0xDA \
1399 }
1330 1400
1331/* 1401/*
1332 * Common header for Hyper-V ICs 1402 * Common header for Hyper-V ICs
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 488debbef895..81cbbdb96aae 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -658,7 +658,6 @@ struct twl4030_power_data {
658 bool use_poweroff; /* Board is wired for TWL poweroff */ 658 bool use_poweroff; /* Board is wired for TWL poweroff */
659}; 659};
660 660
661extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
662extern int twl4030_remove_script(u8 flags); 661extern int twl4030_remove_script(u8 flags);
663extern void twl4030_power_off(void); 662extern void twl4030_power_off(void);
664 663
@@ -726,7 +725,7 @@ struct twl4030_platform_data {
726 struct regulator_init_data *clk32kg; 725 struct regulator_init_data *clk32kg;
727 struct regulator_init_data *v1v8; 726 struct regulator_init_data *v1v8;
728 struct regulator_init_data *v2v1; 727 struct regulator_init_data *v2v1;
729 /* TWL6025 LDO regulators */ 728 /* TWL6032 LDO regulators */
730 struct regulator_init_data *ldo1; 729 struct regulator_init_data *ldo1;
731 struct regulator_init_data *ldo2; 730 struct regulator_init_data *ldo2;
732 struct regulator_init_data *ldo3; 731 struct regulator_init_data *ldo3;
@@ -736,7 +735,7 @@ struct twl4030_platform_data {
736 struct regulator_init_data *ldo7; 735 struct regulator_init_data *ldo7;
737 struct regulator_init_data *ldoln; 736 struct regulator_init_data *ldoln;
738 struct regulator_init_data *ldousb; 737 struct regulator_init_data *ldousb;
739 /* TWL6025 DCDC regulators */ 738 /* TWL6032 DCDC regulators */
740 struct regulator_init_data *smps3; 739 struct regulator_init_data *smps3;
741 struct regulator_init_data *smps4; 740 struct regulator_init_data *smps4;
742 struct regulator_init_data *vio6025; 741 struct regulator_init_data *vio6025;
@@ -753,7 +752,7 @@ struct twl_regulator_driver_data {
753#define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */ 752#define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */
754#define TWL5031 BIT(2) /* twl5031 has different registers */ 753#define TWL5031 BIT(2) /* twl5031 has different registers */
755#define TWL6030_CLASS BIT(3) /* TWL6030 class */ 754#define TWL6030_CLASS BIT(3) /* TWL6030 class */
756#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */ 755#define TWL6032_SUBCLASS BIT(4) /* TWL6032 has changed registers */
757#define TWL4030_ALLOW_UNSUPPORTED BIT(5) /* Some voltages are possible 756#define TWL4030_ALLOW_UNSUPPORTED BIT(5) /* Some voltages are possible
758 * but not officially supported. 757 * but not officially supported.
759 * This flag is necessary to 758 * This flag is necessary to
@@ -840,20 +839,20 @@ static inline int twl4030charger_usb_en(int enable) { return 0; }
840#define TWL6030_REG_CLK32KG 48 839#define TWL6030_REG_CLK32KG 48
841 840
842/* LDOs on 6025 have different names */ 841/* LDOs on 6025 have different names */
843#define TWL6025_REG_LDO2 49 842#define TWL6032_REG_LDO2 49
844#define TWL6025_REG_LDO4 50 843#define TWL6032_REG_LDO4 50
845#define TWL6025_REG_LDO3 51 844#define TWL6032_REG_LDO3 51
846#define TWL6025_REG_LDO5 52 845#define TWL6032_REG_LDO5 52
847#define TWL6025_REG_LDO1 53 846#define TWL6032_REG_LDO1 53
848#define TWL6025_REG_LDO7 54 847#define TWL6032_REG_LDO7 54
849#define TWL6025_REG_LDO6 55 848#define TWL6032_REG_LDO6 55
850#define TWL6025_REG_LDOLN 56 849#define TWL6032_REG_LDOLN 56
851#define TWL6025_REG_LDOUSB 57 850#define TWL6032_REG_LDOUSB 57
852 851
853/* 6025 DCDC supplies */ 852/* 6025 DCDC supplies */
854#define TWL6025_REG_SMPS3 58 853#define TWL6032_REG_SMPS3 58
855#define TWL6025_REG_SMPS4 59 854#define TWL6032_REG_SMPS4 59
856#define TWL6025_REG_VIO 60 855#define TWL6032_REG_VIO 60
857 856
858 857
859#endif /* End of __TWL4030_H */ 858#endif /* End of __TWL4030_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 06b0ed0154a4..b0dc87a2a376 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -146,6 +146,7 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
146#define IEEE80211_MAX_RTS_THRESHOLD 2353 146#define IEEE80211_MAX_RTS_THRESHOLD 2353
147#define IEEE80211_MAX_AID 2007 147#define IEEE80211_MAX_AID 2007
148#define IEEE80211_MAX_TIM_LEN 251 148#define IEEE80211_MAX_TIM_LEN 251
149#define IEEE80211_MAX_MESH_PEERINGS 63
149/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 150/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
150 6.2.1.1.2. 151 6.2.1.1.2.
151 152
@@ -1829,6 +1830,15 @@ enum ieee80211_key_len {
1829 WLAN_KEY_LEN_AES_CMAC = 16, 1830 WLAN_KEY_LEN_AES_CMAC = 16,
1830}; 1831};
1831 1832
1833#define IEEE80211_WEP_IV_LEN 4
1834#define IEEE80211_WEP_ICV_LEN 4
1835#define IEEE80211_CCMP_HDR_LEN 8
1836#define IEEE80211_CCMP_MIC_LEN 8
1837#define IEEE80211_CCMP_PN_LEN 6
1838#define IEEE80211_TKIP_IV_LEN 8
1839#define IEEE80211_TKIP_ICV_LEN 4
1840#define IEEE80211_CMAC_PN_LEN 6
1841
1832/* Public action codes */ 1842/* Public action codes */
1833enum ieee80211_pub_actioncode { 1843enum ieee80211_pub_actioncode {
1834 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4, 1844 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4,
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 12b4d55a02af..d5569734f672 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -30,7 +30,6 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
30 30
31int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); 31int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
32 32
33int mac_pton(const char *s, u8 *mac);
34extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); 33extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
35 34
36#endif /* _LINUX_IF_ETHER_H */ 35#endif /* _LINUX_IF_ETHER_H */
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index c3f817c3eb45..a86784dec3d3 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -12,5 +12,6 @@ struct ifla_vf_info {
12 __u32 qos; 12 __u32 qos;
13 __u32 tx_rate; 13 __u32 tx_rate;
14 __u32 spoofchk; 14 __u32 spoofchk;
15 __u32 linkstate;
15}; 16};
16#endif /* _LINUX_IF_LINK_H */ 17#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 84dde1dd1da4..ddd33fd5904d 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -8,7 +8,7 @@
8#include <net/netlink.h> 8#include <net/netlink.h>
9#include <linux/u64_stats_sync.h> 9#include <linux/u64_stats_sync.h>
10 10
11#if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE) 11#if IS_ENABLED(CONFIG_MACVTAP)
12struct socket *macvtap_get_socket(struct file *); 12struct socket *macvtap_get_socket(struct file *);
13#else 13#else
14#include <linux/err.h> 14#include <linux/err.h>
@@ -50,7 +50,7 @@ struct macvlan_pcpu_stats {
50 * Maximum times a macvtap device can be opened. This can be used to 50 * Maximum times a macvtap device can be opened. This can be used to
51 * configure the number of receive queue, e.g. for multiqueue virtio. 51 * configure the number of receive queue, e.g. for multiqueue virtio.
52 */ 52 */
53#define MAX_MACVTAP_QUEUES (NR_CPUS < 16 ? NR_CPUS : 16) 53#define MAX_MACVTAP_QUEUES 16
54 54
55#define MACVLAN_MC_FILTER_BITS 8 55#define MACVLAN_MC_FILTER_BITS 8
56#define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS) 56#define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS)
@@ -65,12 +65,18 @@ struct macvlan_dev {
65 65
66 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ); 66 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ);
67 67
68 netdev_features_t set_features;
68 enum macvlan_mode mode; 69 enum macvlan_mode mode;
69 u16 flags; 70 u16 flags;
70 int (*receive)(struct sk_buff *skb); 71 int (*receive)(struct sk_buff *skb);
71 int (*forward)(struct net_device *dev, struct sk_buff *skb); 72 int (*forward)(struct net_device *dev, struct sk_buff *skb);
72 struct macvtap_queue *taps[MAX_MACVTAP_QUEUES]; 73 /* This array tracks active taps. */
74 struct macvtap_queue __rcu *taps[MAX_MACVTAP_QUEUES];
75 /* This list tracks all taps (both enabled and disabled) */
76 struct list_head queue_list;
73 int numvtaps; 77 int numvtaps;
78 int numqueues;
79 netdev_features_t tap_features;
74 int minor; 80 int minor;
75}; 81};
76 82
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 16fae6436d0e..f6156f91eb1c 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -69,6 +69,7 @@ struct team_port {
69 s32 priority; /* lower number ~ higher priority */ 69 s32 priority; /* lower number ~ higher priority */
70 u16 queue_id; 70 u16 queue_id;
71 struct list_head qom_list; /* node in queue override mapping list */ 71 struct list_head qom_list; /* node in queue override mapping list */
72 struct rcu_head rcu;
72 long mode_priv[0]; 73 long mode_priv[0];
73}; 74};
74 75
@@ -228,6 +229,16 @@ static inline struct team_port *team_get_port_by_index(struct team *team,
228 return port; 229 return port;
229 return NULL; 230 return NULL;
230} 231}
232
233static inline int team_num_to_port_index(struct team *team, int num)
234{
235 int en_port_count = ACCESS_ONCE(team->en_port_count);
236
237 if (unlikely(!en_port_count))
238 return 0;
239 return num % en_port_count;
240}
241
231static inline struct team_port *team_get_port_by_index_rcu(struct team *team, 242static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
232 int port_index) 243 int port_index)
233{ 244{
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 637fa71de0c7..715c343f7c00 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -79,9 +79,8 @@ static inline int is_vlan_dev(struct net_device *dev)
79} 79}
80 80
81#define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT) 81#define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT)
82#define vlan_tx_nonzero_tag_present(__skb) \
83 (vlan_tx_tag_present(__skb) && ((__skb)->vlan_tci & VLAN_VID_MASK))
84#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) 82#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
83#define vlan_tx_tag_get_id(__skb) ((__skb)->vlan_tci & VLAN_VID_MASK)
85 84
86#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 85#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
87 86
@@ -243,8 +242,6 @@ static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
243 return skb; 242 return skb;
244} 243}
245 244
246#define HAVE_VLAN_PUT_TAG
247
248/** 245/**
249 * vlan_put_tag - inserts VLAN tag according to device features 246 * vlan_put_tag - inserts VLAN tag according to device features
250 * @skb: skbuff to tag 247 * @skb: skbuff to tag
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 7f2bf1518480..e3362b5f13e8 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -84,6 +84,7 @@ struct ip_mc_list {
84 struct ip_mc_list *next; 84 struct ip_mc_list *next;
85 struct ip_mc_list __rcu *next_rcu; 85 struct ip_mc_list __rcu *next_rcu;
86 }; 86 };
87 struct ip_mc_list __rcu *next_hash;
87 struct timer_list timer; 88 struct timer_list timer;
88 int users; 89 int users;
89 atomic_t refcnt; 90 atomic_t refcnt;
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 172c5b23cb84..72b26940730d 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -24,14 +24,10 @@
24#define ST_SENSORS_FULLSCALE_AVL_MAX 10 24#define ST_SENSORS_FULLSCALE_AVL_MAX 10
25 25
26#define ST_SENSORS_NUMBER_ALL_CHANNELS 4 26#define ST_SENSORS_NUMBER_ALL_CHANNELS 4
27#define ST_SENSORS_NUMBER_DATA_CHANNELS 3
28#define ST_SENSORS_ENABLE_ALL_AXIS 0x07 27#define ST_SENSORS_ENABLE_ALL_AXIS 0x07
29#define ST_SENSORS_BYTE_FOR_CHANNEL 2
30#define ST_SENSORS_SCAN_X 0 28#define ST_SENSORS_SCAN_X 0
31#define ST_SENSORS_SCAN_Y 1 29#define ST_SENSORS_SCAN_Y 1
32#define ST_SENSORS_SCAN_Z 2 30#define ST_SENSORS_SCAN_Z 2
33#define ST_SENSORS_DEFAULT_12_REALBITS 12
34#define ST_SENSORS_DEFAULT_16_REALBITS 16
35#define ST_SENSORS_DEFAULT_POWER_ON_VALUE 0x01 31#define ST_SENSORS_DEFAULT_POWER_ON_VALUE 0x01
36#define ST_SENSORS_DEFAULT_POWER_OFF_VALUE 0x00 32#define ST_SENSORS_DEFAULT_POWER_OFF_VALUE 0x00
37#define ST_SENSORS_DEFAULT_WAI_ADDRESS 0x0f 33#define ST_SENSORS_DEFAULT_WAI_ADDRESS 0x0f
@@ -42,20 +38,20 @@
42#define ST_SENSORS_MAX_NAME 17 38#define ST_SENSORS_MAX_NAME 17
43#define ST_SENSORS_MAX_4WAI 7 39#define ST_SENSORS_MAX_4WAI 7
44 40
45#define ST_SENSORS_LSM_CHANNELS(device_type, index, mod, endian, bits, addr) \ 41#define ST_SENSORS_LSM_CHANNELS(device_type, mask, index, mod, \
42 ch2, s, endian, rbits, sbits, addr) \
46{ \ 43{ \
47 .type = device_type, \ 44 .type = device_type, \
48 .modified = 1, \ 45 .modified = mod, \
49 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 46 .info_mask_separate = mask, \
50 BIT(IIO_CHAN_INFO_SCALE), \
51 .scan_index = index, \ 47 .scan_index = index, \
52 .channel2 = mod, \ 48 .channel2 = ch2, \
53 .address = addr, \ 49 .address = addr, \
54 .scan_type = { \ 50 .scan_type = { \
55 .sign = 's', \ 51 .sign = s, \
56 .realbits = bits, \ 52 .realbits = rbits, \
57 .shift = 16 - bits, \ 53 .shift = sbits - rbits, \
58 .storagebits = 16, \ 54 .storagebits = sbits, \
59 .endianness = endian, \ 55 .endianness = endian, \
60 }, \ 56 }, \
61} 57}
@@ -204,6 +200,7 @@ struct st_sensors {
204 * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread. 200 * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
205 * @buffer_data: Data used by buffer part. 201 * @buffer_data: Data used by buffer part.
206 * @odr: Output data rate of the sensor [Hz]. 202 * @odr: Output data rate of the sensor [Hz].
203 * num_data_channels: Number of data channels used in buffer.
207 * @get_irq_data_ready: Function to get the IRQ used for data ready signal. 204 * @get_irq_data_ready: Function to get the IRQ used for data ready signal.
208 * @tf: Transfer function structure used by I/O operations. 205 * @tf: Transfer function structure used by I/O operations.
209 * @tb: Transfer buffers and mutex used by I/O operations. 206 * @tb: Transfer buffers and mutex used by I/O operations.
@@ -220,6 +217,7 @@ struct st_sensor_data {
220 char *buffer_data; 217 char *buffer_data;
221 218
222 unsigned int odr; 219 unsigned int odr;
220 unsigned int num_data_channels;
223 221
224 unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev); 222 unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev);
225 223
diff --git a/include/linux/iio/frequency/adf4350.h b/include/linux/iio/frequency/adf4350.h
index be91f344d5fc..ffd8c8f90928 100644
--- a/include/linux/iio/frequency/adf4350.h
+++ b/include/linux/iio/frequency/adf4350.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * ADF4350/ADF4351 SPI PLL driver 2 * ADF4350/ADF4351 SPI PLL driver
3 * 3 *
4 * Copyright 2012 Analog Devices Inc. 4 * Copyright 2012-2013 Analog Devices Inc.
5 * 5 *
6 * Licensed under the GPL-2. 6 * Licensed under the GPL-2.
7 */ 7 */
@@ -41,7 +41,7 @@
41#define ADF4350_REG2_RDIV2_EN (1 << 24) 41#define ADF4350_REG2_RDIV2_EN (1 << 24)
42#define ADF4350_REG2_RMULT2_EN (1 << 25) 42#define ADF4350_REG2_RMULT2_EN (1 << 25)
43#define ADF4350_REG2_MUXOUT(x) ((x) << 26) 43#define ADF4350_REG2_MUXOUT(x) ((x) << 26)
44#define ADF4350_REG2_NOISE_MODE(x) ((x) << 29) 44#define ADF4350_REG2_NOISE_MODE(x) (((unsigned)(x)) << 29)
45#define ADF4350_MUXOUT_THREESTATE 0 45#define ADF4350_MUXOUT_THREESTATE 0
46#define ADF4350_MUXOUT_DVDD 1 46#define ADF4350_MUXOUT_DVDD 1
47#define ADF4350_MUXOUT_GND 2 47#define ADF4350_MUXOUT_GND 2
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 8d171f427632..3d35b7023591 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -211,8 +211,8 @@ struct iio_chan_spec {
211static inline bool iio_channel_has_info(const struct iio_chan_spec *chan, 211static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
212 enum iio_chan_info_enum type) 212 enum iio_chan_info_enum type)
213{ 213{
214 return (chan->info_mask_separate & type) | 214 return (chan->info_mask_separate & BIT(type)) |
215 (chan->info_mask_shared_by_type & type); 215 (chan->info_mask_shared_by_type & BIT(type));
216} 216}
217 217
218#define IIO_ST(si, rb, sb, sh) \ 218#define IIO_ST(si, rb, sb, sh) \
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index 3869c525b052..369cf2cd5144 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -8,6 +8,7 @@
8 */ 8 */
9#include <linux/irq.h> 9#include <linux/irq.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/atomic.h>
11 12
12#ifndef _IIO_TRIGGER_H_ 13#ifndef _IIO_TRIGGER_H_
13#define _IIO_TRIGGER_H_ 14#define _IIO_TRIGGER_H_
@@ -61,7 +62,7 @@ struct iio_trigger {
61 62
62 struct list_head list; 63 struct list_head list;
63 struct list_head alloc_list; 64 struct list_head alloc_list;
64 int use_count; 65 atomic_t use_count;
65 66
66 struct irq_chip subirq_chip; 67 struct irq_chip subirq_chip;
67 int subirq_base; 68 int subirq_base;
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index ea1e3b863890..b99cd23f3474 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -50,12 +50,17 @@ struct ipv4_devconf {
50 DECLARE_BITMAP(state, IPV4_DEVCONF_MAX); 50 DECLARE_BITMAP(state, IPV4_DEVCONF_MAX);
51}; 51};
52 52
53#define MC_HASH_SZ_LOG 9
54
53struct in_device { 55struct in_device {
54 struct net_device *dev; 56 struct net_device *dev;
55 atomic_t refcnt; 57 atomic_t refcnt;
56 int dead; 58 int dead;
57 struct in_ifaddr *ifa_list; /* IP ifaddr chain */ 59 struct in_ifaddr *ifa_list; /* IP ifaddr chain */
60
58 struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */ 61 struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */
62 struct ip_mc_list __rcu * __rcu *mc_hash;
63
59 int mc_count; /* Number of installed mcasts */ 64 int mc_count; /* Number of installed mcasts */
60 spinlock_t mc_tomb_lock; 65 spinlock_t mc_tomb_lock;
61 struct ip_mc_list *mc_tomb; 66 struct ip_mc_list *mc_tomb;
diff --git a/include/linux/init.h b/include/linux/init.h
index 861814710d52..e73f2b708525 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -93,13 +93,13 @@
93 93
94#define __exit __section(.exit.text) __exitused __cold notrace 94#define __exit __section(.exit.text) __exitused __cold notrace
95 95
96/* Used for HOTPLUG_CPU */ 96/* temporary, until all users are removed */
97#define __cpuinit __section(.cpuinit.text) __cold notrace 97#define __cpuinit
98#define __cpuinitdata __section(.cpuinit.data) 98#define __cpuinitdata
99#define __cpuinitconst __constsection(.cpuinit.rodata) 99#define __cpuinitconst
100#define __cpuexit __section(.cpuexit.text) __exitused __cold notrace 100#define __cpuexit
101#define __cpuexitdata __section(.cpuexit.data) 101#define __cpuexitdata
102#define __cpuexitconst __constsection(.cpuexit.rodata) 102#define __cpuexitconst
103 103
104/* Used for MEMORY_HOTPLUG */ 104/* Used for MEMORY_HOTPLUG */
105#define __meminit __section(.meminit.text) __cold notrace 105#define __meminit __section(.meminit.text) __cold notrace
@@ -118,9 +118,8 @@
118#define __INITRODATA .section ".init.rodata","a",%progbits 118#define __INITRODATA .section ".init.rodata","a",%progbits
119#define __FINITDATA .previous 119#define __FINITDATA .previous
120 120
121#define __CPUINIT .section ".cpuinit.text", "ax" 121/* temporary, until all users are removed */
122#define __CPUINITDATA .section ".cpuinit.data", "aw" 122#define __CPUINIT
123#define __CPUINITRODATA .section ".cpuinit.rodata", "a"
124 123
125#define __MEMINIT .section ".meminit.text", "ax" 124#define __MEMINIT .section ".meminit.text", "ax"
126#define __MEMINITDATA .section ".meminit.data", "aw" 125#define __MEMINITDATA .section ".meminit.data", "aw"
diff --git a/include/linux/input/ti_am335x_tsc.h b/include/linux/input/ti_am335x_tsc.h
deleted file mode 100644
index 49269a2aa329..000000000000
--- a/include/linux/input/ti_am335x_tsc.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef __LINUX_TI_AM335X_TSC_H
2#define __LINUX_TI_AM335X_TSC_H
3
4/**
5 * struct tsc_data Touchscreen wire configuration
6 * @wires: Wires refer to application modes
7 * i.e. 4/5/8 wire touchscreen support
8 * on the platform.
9 * @x_plate_resistance: X plate resistance.
10 * @steps_to_configure: The sequencer supports a total of
11 * 16 programmable steps.
12 * A step configured to read a single
13 * co-ordinate value, can be applied
14 * more number of times for better results.
15 */
16
17struct tsc_data {
18 int wires;
19 int x_plate_resistance;
20 int steps_to_configure;
21};
22
23#endif
diff --git a/include/linux/input/tps6507x-ts.h b/include/linux/input/tps6507x-ts.h
index ab1440313924..b433df801d92 100644
--- a/include/linux/input/tps6507x-ts.h
+++ b/include/linux/input/tps6507x-ts.h
@@ -14,7 +14,6 @@
14/* Board specific touch screen initial values */ 14/* Board specific touch screen initial values */
15struct touchscreen_init_data { 15struct touchscreen_init_data {
16 int poll_period; /* ms */ 16 int poll_period; /* ms */
17 int vref; /* non-zero to leave vref on */
18 __u16 min_pressure; /* min reading to be treated as a touch */ 17 __u16 min_pressure; /* min reading to be treated as a touch */
19 __u16 vendor; 18 __u16 vendor;
20 __u16 product; 19 __u16 product;
diff --git a/include/linux/io.h b/include/linux/io.h
index 069e4075f872..f4f42faec686 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -76,4 +76,29 @@ void devm_ioremap_release(struct device *dev, void *res);
76#define arch_has_dev_port() (1) 76#define arch_has_dev_port() (1)
77#endif 77#endif
78 78
79/*
80 * Some systems (x86 without PAT) have a somewhat reliable way to mark a
81 * physical address range such that uncached mappings will actually
82 * end up write-combining. This facility should be used in conjunction
83 * with pgprot_writecombine, ioremap-wc, or set_memory_wc, since it has
84 * no effect if the per-page mechanisms are functional.
85 * (On x86 without PAT, these functions manipulate MTRRs.)
86 *
87 * arch_phys_del_wc(0) or arch_phys_del_wc(any error code) is guaranteed
88 * to have no effect.
89 */
90#ifndef arch_phys_wc_add
91static inline int __must_check arch_phys_wc_add(unsigned long base,
92 unsigned long size)
93{
94 return 0; /* It worked (i.e. did nothing). */
95}
96
97static inline void arch_phys_wc_del(int handle)
98{
99}
100
101#define arch_phys_wc_add arch_phys_wc_add
102#endif
103
79#endif /* _LINUX_IO_H */ 104#endif /* _LINUX_IO_H */
diff --git a/include/linux/ipmi-fru.h b/include/linux/ipmi-fru.h
new file mode 100644
index 000000000000..4d3a76380e32
--- /dev/null
+++ b/include/linux/ipmi-fru.h
@@ -0,0 +1,135 @@
1/*
2 * Copyright (C) 2012 CERN (www.cern.ch)
3 * Author: Alessandro Rubini <rubini@gnudd.com>
4 *
5 * Released according to the GNU GPL, version 2 or any later version.
6 *
7 * This work is part of the White Rabbit project, a research effort led
8 * by CERN, the European Institute for Nuclear Research.
9 */
10#ifndef __LINUX_IPMI_FRU_H__
11#define __LINUX_IPMI_FRU_H__
12#ifdef __KERNEL__
13# include <linux/types.h>
14# include <linux/string.h>
15#else
16# include <stdint.h>
17# include <string.h>
18#endif
19
20/*
21 * These structures match the unaligned crap we have in FRU1011.pdf
22 * (http://download.intel.com/design/servers/ipmi/FRU1011.pdf)
23 */
24
25/* chapter 8, page 5 */
26struct fru_common_header {
27 uint8_t format; /* 0x01 */
28 uint8_t internal_use_off; /* multiple of 8 bytes */
29 uint8_t chassis_info_off; /* multiple of 8 bytes */
30 uint8_t board_area_off; /* multiple of 8 bytes */
31 uint8_t product_area_off; /* multiple of 8 bytes */
32 uint8_t multirecord_off; /* multiple of 8 bytes */
33 uint8_t pad; /* must be 0 */
34 uint8_t checksum; /* sum modulo 256 must be 0 */
35};
36
37/* chapter 9, page 5 -- internal_use: not used by us */
38
39/* chapter 10, page 6 -- chassis info: not used by us */
40
41/* chapter 13, page 9 -- used by board_info_area below */
42struct fru_type_length {
43 uint8_t type_length;
44 uint8_t data[0];
45};
46
47/* chapter 11, page 7 */
48struct fru_board_info_area {
49 uint8_t format; /* 0x01 */
50 uint8_t area_len; /* multiple of 8 bytes */
51 uint8_t language; /* I hope it's 0 */
52 uint8_t mfg_date[3]; /* LSB, minutes since 1996-01-01 */
53 struct fru_type_length tl[0]; /* type-length stuff follows */
54
55 /*
56 * the TL there are in order:
57 * Board Manufacturer
58 * Board Product Name
59 * Board Serial Number
60 * Board Part Number
61 * FRU File ID (may be null)
62 * more manufacturer-specific stuff
63 * 0xc1 as a terminator
64 * 0x00 pad to a multiple of 8 bytes - 1
65 * checksum (sum of all stuff module 256 must be zero)
66 */
67};
68
69enum fru_type {
70 FRU_TYPE_BINARY = 0x00,
71 FRU_TYPE_BCDPLUS = 0x40,
72 FRU_TYPE_ASCII6 = 0x80,
73 FRU_TYPE_ASCII = 0xc0, /* not ascii: depends on language */
74};
75
76/*
77 * some helpers
78 */
79static inline struct fru_board_info_area *fru_get_board_area(
80 const struct fru_common_header *header)
81{
82 /* we know for sure that the header is 8 bytes in size */
83 return (struct fru_board_info_area *)(header + header->board_area_off);
84}
85
86static inline int fru_type(struct fru_type_length *tl)
87{
88 return tl->type_length & 0xc0;
89}
90
91static inline int fru_length(struct fru_type_length *tl)
92{
93 return (tl->type_length & 0x3f) + 1; /* len of whole record */
94}
95
96/* assume ascii-latin1 encoding */
97static inline int fru_strlen(struct fru_type_length *tl)
98{
99 return fru_length(tl) - 1;
100}
101
102static inline char *fru_strcpy(char *dest, struct fru_type_length *tl)
103{
104 int len = fru_strlen(tl);
105 memcpy(dest, tl->data, len);
106 dest[len] = '\0';
107 return dest;
108}
109
110static inline struct fru_type_length *fru_next_tl(struct fru_type_length *tl)
111{
112 return tl + fru_length(tl);
113}
114
115static inline int fru_is_eof(struct fru_type_length *tl)
116{
117 return tl->type_length == 0xc1;
118}
119
120/*
121 * External functions defined in fru-parse.c.
122 */
123extern int fru_header_cksum_ok(struct fru_common_header *header);
124extern int fru_bia_cksum_ok(struct fru_board_info_area *bia);
125
126/* All these 4 return allocated strings by calling fru_alloc() */
127extern char *fru_get_board_manufacturer(struct fru_common_header *header);
128extern char *fru_get_product_name(struct fru_common_header *header);
129extern char *fru_get_serial_number(struct fru_common_header *header);
130extern char *fru_get_part_number(struct fru_common_header *header);
131
132/* This must be defined by the caller of the above functions */
133extern void *fru_alloc(size_t size);
134
135#endif /* __LINUX_IMPI_FRU_H__ */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index bc4e06611958..f04d3ba335cb 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -119,6 +119,7 @@ struct irq_domain;
119 119
120/** 120/**
121 * struct irq_data - per irq and irq chip data passed down to chip functions 121 * struct irq_data - per irq and irq chip data passed down to chip functions
122 * @mask: precomputed bitmask for accessing the chip registers
122 * @irq: interrupt number 123 * @irq: interrupt number
123 * @hwirq: hardware interrupt number, local to the interrupt domain 124 * @hwirq: hardware interrupt number, local to the interrupt domain
124 * @node: node index useful for balancing 125 * @node: node index useful for balancing
@@ -138,6 +139,7 @@ struct irq_domain;
138 * irq_data. 139 * irq_data.
139 */ 140 */
140struct irq_data { 141struct irq_data {
142 u32 mask;
141 unsigned int irq; 143 unsigned int irq;
142 unsigned long hwirq; 144 unsigned long hwirq;
143 unsigned int node; 145 unsigned int node;
@@ -294,6 +296,7 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
294 * @irq_suspend: function called from core code on suspend once per chip 296 * @irq_suspend: function called from core code on suspend once per chip
295 * @irq_resume: function called from core code on resume once per chip 297 * @irq_resume: function called from core code on resume once per chip
296 * @irq_pm_shutdown: function called from core code on shutdown once per chip 298 * @irq_pm_shutdown: function called from core code on shutdown once per chip
299 * @irq_calc_mask: Optional function to set irq_data.mask for special cases
297 * @irq_print_chip: optional to print special chip info in show_interrupts 300 * @irq_print_chip: optional to print special chip info in show_interrupts
298 * @flags: chip specific flags 301 * @flags: chip specific flags
299 */ 302 */
@@ -325,6 +328,8 @@ struct irq_chip {
325 void (*irq_resume)(struct irq_data *data); 328 void (*irq_resume)(struct irq_data *data);
326 void (*irq_pm_shutdown)(struct irq_data *data); 329 void (*irq_pm_shutdown)(struct irq_data *data);
327 330
331 void (*irq_calc_mask)(struct irq_data *data);
332
328 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p); 333 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p);
329 334
330 unsigned long flags; 335 unsigned long flags;
@@ -579,6 +584,12 @@ static inline struct msi_desc *irq_data_get_msi(struct irq_data *d)
579 return d->msi_desc; 584 return d->msi_desc;
580} 585}
581 586
587static inline u32 irq_get_trigger_type(unsigned int irq)
588{
589 struct irq_data *d = irq_get_irq_data(irq);
590 return d ? irqd_get_trigger_type(d) : 0;
591}
592
582int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node, 593int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,
583 struct module *owner); 594 struct module *owner);
584 595
@@ -644,6 +655,8 @@ struct irq_chip_regs {
644 * @regs: Register offsets for this chip 655 * @regs: Register offsets for this chip
645 * @handler: Flow handler associated with this chip 656 * @handler: Flow handler associated with this chip
646 * @type: Chip can handle these flow types 657 * @type: Chip can handle these flow types
658 * @mask_cache_priv: Cached mask register private to the chip type
659 * @mask_cache: Pointer to cached mask register
647 * 660 *
648 * A irq_generic_chip can have several instances of irq_chip_type when 661 * A irq_generic_chip can have several instances of irq_chip_type when
649 * it requires different functions and register offsets for different 662 * it requires different functions and register offsets for different
@@ -654,6 +667,8 @@ struct irq_chip_type {
654 struct irq_chip_regs regs; 667 struct irq_chip_regs regs;
655 irq_flow_handler_t handler; 668 irq_flow_handler_t handler;
656 u32 type; 669 u32 type;
670 u32 mask_cache_priv;
671 u32 *mask_cache;
657}; 672};
658 673
659/** 674/**
@@ -662,13 +677,16 @@ struct irq_chip_type {
662 * @reg_base: Register base address (virtual) 677 * @reg_base: Register base address (virtual)
663 * @irq_base: Interrupt base nr for this chip 678 * @irq_base: Interrupt base nr for this chip
664 * @irq_cnt: Number of interrupts handled by this chip 679 * @irq_cnt: Number of interrupts handled by this chip
665 * @mask_cache: Cached mask register 680 * @mask_cache: Cached mask register shared between all chip types
666 * @type_cache: Cached type register 681 * @type_cache: Cached type register
667 * @polarity_cache: Cached polarity register 682 * @polarity_cache: Cached polarity register
668 * @wake_enabled: Interrupt can wakeup from suspend 683 * @wake_enabled: Interrupt can wakeup from suspend
669 * @wake_active: Interrupt is marked as an wakeup from suspend source 684 * @wake_active: Interrupt is marked as an wakeup from suspend source
670 * @num_ct: Number of available irq_chip_type instances (usually 1) 685 * @num_ct: Number of available irq_chip_type instances (usually 1)
671 * @private: Private data for non generic chip callbacks 686 * @private: Private data for non generic chip callbacks
687 * @installed: bitfield to denote installed interrupts
688 * @unused: bitfield to denote unused interrupts
689 * @domain: irq domain pointer
672 * @list: List head for keeping track of instances 690 * @list: List head for keeping track of instances
673 * @chip_types: Array of interrupt irq_chip_types 691 * @chip_types: Array of interrupt irq_chip_types
674 * 692 *
@@ -690,6 +708,9 @@ struct irq_chip_generic {
690 u32 wake_active; 708 u32 wake_active;
691 unsigned int num_ct; 709 unsigned int num_ct;
692 void *private; 710 void *private;
711 unsigned long installed;
712 unsigned long unused;
713 struct irq_domain *domain;
693 struct list_head list; 714 struct list_head list;
694 struct irq_chip_type chip_types[0]; 715 struct irq_chip_type chip_types[0];
695}; 716};
@@ -700,10 +721,32 @@ struct irq_chip_generic {
700 * @IRQ_GC_INIT_NESTED_LOCK: Set the lock class of the irqs to nested for 721 * @IRQ_GC_INIT_NESTED_LOCK: Set the lock class of the irqs to nested for
701 * irq chips which need to call irq_set_wake() on 722 * irq chips which need to call irq_set_wake() on
702 * the parent irq. Usually GPIO implementations 723 * the parent irq. Usually GPIO implementations
724 * @IRQ_GC_MASK_CACHE_PER_TYPE: Mask cache is chip type private
725 * @IRQ_GC_NO_MASK: Do not calculate irq_data->mask
703 */ 726 */
704enum irq_gc_flags { 727enum irq_gc_flags {
705 IRQ_GC_INIT_MASK_CACHE = 1 << 0, 728 IRQ_GC_INIT_MASK_CACHE = 1 << 0,
706 IRQ_GC_INIT_NESTED_LOCK = 1 << 1, 729 IRQ_GC_INIT_NESTED_LOCK = 1 << 1,
730 IRQ_GC_MASK_CACHE_PER_TYPE = 1 << 2,
731 IRQ_GC_NO_MASK = 1 << 3,
732};
733
734/*
735 * struct irq_domain_chip_generic - Generic irq chip data structure for irq domains
736 * @irqs_per_chip: Number of interrupts per chip
737 * @num_chips: Number of chips
738 * @irq_flags_to_set: IRQ* flags to set on irq setup
739 * @irq_flags_to_clear: IRQ* flags to clear on irq setup
740 * @gc_flags: Generic chip specific setup flags
741 * @gc: Array of pointers to generic interrupt chips
742 */
743struct irq_domain_chip_generic {
744 unsigned int irqs_per_chip;
745 unsigned int num_chips;
746 unsigned int irq_flags_to_clear;
747 unsigned int irq_flags_to_set;
748 enum irq_gc_flags gc_flags;
749 struct irq_chip_generic *gc[0];
707}; 750};
708 751
709/* Generic chip callback functions */ 752/* Generic chip callback functions */
@@ -729,6 +772,14 @@ int irq_setup_alt_chip(struct irq_data *d, unsigned int type);
729void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk, 772void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk,
730 unsigned int clr, unsigned int set); 773 unsigned int clr, unsigned int set);
731 774
775struct irq_chip_generic *irq_get_domain_generic_chip(struct irq_domain *d, unsigned int hw_irq);
776int irq_alloc_domain_generic_chips(struct irq_domain *d, int irqs_per_chip,
777 int num_ct, const char *name,
778 irq_flow_handler_t handler,
779 unsigned int clr, unsigned int set,
780 enum irq_gc_flags flags);
781
782
732static inline struct irq_chip_type *irq_data_get_chip_type(struct irq_data *d) 783static inline struct irq_chip_type *irq_data_get_chip_type(struct irq_data *d)
733{ 784{
734 return container_of(d->chip, struct irq_chip_type, chip); 785 return container_of(d->chip, struct irq_chip_type, chip);
diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h
index e0006f1d35a0..14d79131f53d 100644
--- a/include/linux/irqchip.h
+++ b/include/linux/irqchip.h
@@ -11,6 +11,10 @@
11#ifndef _LINUX_IRQCHIP_H 11#ifndef _LINUX_IRQCHIP_H
12#define _LINUX_IRQCHIP_H 12#define _LINUX_IRQCHIP_H
13 13
14#ifdef CONFIG_IRQCHIP
14void irqchip_init(void); 15void irqchip_init(void);
16#else
17static inline void irqchip_init(void) {}
18#endif
15 19
16#endif 20#endif
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 0d5b17bf5e51..c983ed18c332 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -66,52 +66,55 @@ struct irq_domain_ops {
66 unsigned long *out_hwirq, unsigned int *out_type); 66 unsigned long *out_hwirq, unsigned int *out_type);
67}; 67};
68 68
69extern struct irq_domain_ops irq_generic_chip_ops;
70
71struct irq_domain_chip_generic;
72
69/** 73/**
70 * struct irq_domain - Hardware interrupt number translation object 74 * struct irq_domain - Hardware interrupt number translation object
71 * @link: Element in global irq_domain list. 75 * @link: Element in global irq_domain list.
72 * @revmap_type: Method used for reverse mapping hwirq numbers to linux irq. This 76 * @name: Name of interrupt domain
73 * will be one of the IRQ_DOMAIN_MAP_* values.
74 * @revmap_data: Revmap method specific data.
75 * @ops: pointer to irq_domain methods 77 * @ops: pointer to irq_domain methods
76 * @host_data: private data pointer for use by owner. Not touched by irq_domain 78 * @host_data: private data pointer for use by owner. Not touched by irq_domain
77 * core code. 79 * core code.
78 * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator 80 *
79 * of the irq_domain is responsible for allocating the array of 81 * Optional elements
80 * irq_desc structures. 82 * @of_node: Pointer to device tree nodes associated with the irq_domain. Used
81 * @nr_irq: Number of irqs managed by the irq domain 83 * when decoding device tree interrupt specifiers.
82 * @hwirq_base: Starting number for hwirqs managed by the irq domain 84 * @gc: Pointer to a list of generic chips. There is a helper function for
83 * @of_node: (optional) Pointer to device tree nodes associated with the 85 * setting up one or more generic chips for interrupt controllers
84 * irq_domain. Used when decoding device tree interrupt specifiers. 86 * drivers using the generic chip library which uses this pointer.
87 *
88 * Revmap data, used internally by irq_domain
89 * @revmap_direct_max_irq: The largest hwirq that can be set for controllers that
90 * support direct mapping
91 * @revmap_size: Size of the linear map table @linear_revmap[]
92 * @revmap_tree: Radix map tree for hwirqs that don't fit in the linear map
93 * @linear_revmap: Linear table of hwirq->virq reverse mappings
85 */ 94 */
86struct irq_domain { 95struct irq_domain {
87 struct list_head link; 96 struct list_head link;
88 97 const char *name;
89 /* type of reverse mapping_technique */
90 unsigned int revmap_type;
91 union {
92 struct {
93 unsigned int size;
94 unsigned int first_irq;
95 irq_hw_number_t first_hwirq;
96 } legacy;
97 struct {
98 unsigned int size;
99 unsigned int *revmap;
100 } linear;
101 struct {
102 unsigned int max_irq;
103 } nomap;
104 struct radix_tree_root tree;
105 } revmap_data;
106 const struct irq_domain_ops *ops; 98 const struct irq_domain_ops *ops;
107 void *host_data; 99 void *host_data;
108 irq_hw_number_t inval_irq;
109 100
110 /* Optional device node pointer */ 101 /* Optional data */
111 struct device_node *of_node; 102 struct device_node *of_node;
103 struct irq_domain_chip_generic *gc;
104
105 /* reverse map data. The linear map gets appended to the irq_domain */
106 irq_hw_number_t hwirq_max;
107 unsigned int revmap_direct_max_irq;
108 unsigned int revmap_size;
109 struct radix_tree_root revmap_tree;
110 unsigned int linear_revmap[];
112}; 111};
113 112
114#ifdef CONFIG_IRQ_DOMAIN 113#ifdef CONFIG_IRQ_DOMAIN
114struct irq_domain *__irq_domain_add(struct device_node *of_node, int size,
115 irq_hw_number_t hwirq_max, int direct_max,
116 const struct irq_domain_ops *ops,
117 void *host_data);
115struct irq_domain *irq_domain_add_simple(struct device_node *of_node, 118struct irq_domain *irq_domain_add_simple(struct device_node *of_node,
116 unsigned int size, 119 unsigned int size,
117 unsigned int first_irq, 120 unsigned int first_irq,
@@ -123,21 +126,30 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
123 irq_hw_number_t first_hwirq, 126 irq_hw_number_t first_hwirq,
124 const struct irq_domain_ops *ops, 127 const struct irq_domain_ops *ops,
125 void *host_data); 128 void *host_data);
126struct irq_domain *irq_domain_add_linear(struct device_node *of_node, 129extern struct irq_domain *irq_find_host(struct device_node *node);
130extern void irq_set_default_host(struct irq_domain *host);
131
132/**
133 * irq_domain_add_linear() - Allocate and register a linear revmap irq_domain.
134 * @of_node: pointer to interrupt controller's device tree node.
135 * @size: Number of interrupts in the domain.
136 * @ops: map/unmap domain callbacks
137 * @host_data: Controller private data pointer
138 */
139static inline struct irq_domain *irq_domain_add_linear(struct device_node *of_node,
127 unsigned int size, 140 unsigned int size,
128 const struct irq_domain_ops *ops, 141 const struct irq_domain_ops *ops,
129 void *host_data); 142 void *host_data)
130struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, 143{
144 return __irq_domain_add(of_node, size, size, 0, ops, host_data);
145}
146static inline struct irq_domain *irq_domain_add_nomap(struct device_node *of_node,
131 unsigned int max_irq, 147 unsigned int max_irq,
132 const struct irq_domain_ops *ops, 148 const struct irq_domain_ops *ops,
133 void *host_data); 149 void *host_data)
134struct irq_domain *irq_domain_add_tree(struct device_node *of_node, 150{
135 const struct irq_domain_ops *ops, 151 return __irq_domain_add(of_node, 0, max_irq, max_irq, ops, host_data);
136 void *host_data); 152}
137
138extern struct irq_domain *irq_find_host(struct device_node *node);
139extern void irq_set_default_host(struct irq_domain *host);
140
141static inline struct irq_domain *irq_domain_add_legacy_isa( 153static inline struct irq_domain *irq_domain_add_legacy_isa(
142 struct device_node *of_node, 154 struct device_node *of_node,
143 const struct irq_domain_ops *ops, 155 const struct irq_domain_ops *ops,
@@ -146,21 +158,40 @@ static inline struct irq_domain *irq_domain_add_legacy_isa(
146 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops, 158 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops,
147 host_data); 159 host_data);
148} 160}
161static inline struct irq_domain *irq_domain_add_tree(struct device_node *of_node,
162 const struct irq_domain_ops *ops,
163 void *host_data)
164{
165 return __irq_domain_add(of_node, 0, ~0, 0, ops, host_data);
166}
149 167
150extern void irq_domain_remove(struct irq_domain *host); 168extern void irq_domain_remove(struct irq_domain *host);
151 169
152extern int irq_domain_associate_many(struct irq_domain *domain, 170extern int irq_domain_associate(struct irq_domain *domain, unsigned int irq,
153 unsigned int irq_base, 171 irq_hw_number_t hwirq);
154 irq_hw_number_t hwirq_base, int count); 172extern void irq_domain_associate_many(struct irq_domain *domain,
155static inline int irq_domain_associate(struct irq_domain *domain, unsigned int irq, 173 unsigned int irq_base,
156 irq_hw_number_t hwirq) 174 irq_hw_number_t hwirq_base, int count);
157{
158 return irq_domain_associate_many(domain, irq, hwirq, 1);
159}
160 175
161extern unsigned int irq_create_mapping(struct irq_domain *host, 176extern unsigned int irq_create_mapping(struct irq_domain *host,
162 irq_hw_number_t hwirq); 177 irq_hw_number_t hwirq);
163extern void irq_dispose_mapping(unsigned int virq); 178extern void irq_dispose_mapping(unsigned int virq);
179
180/**
181 * irq_linear_revmap() - Find a linux irq from a hw irq number.
182 * @domain: domain owning this hardware interrupt
183 * @hwirq: hardware irq number in that domain space
184 *
185 * This is a fast path alternative to irq_find_mapping() that can be
186 * called directly by irq controller code to save a handful of
187 * instructions. It is always safe to call, but won't find irqs mapped
188 * using the radix tree.
189 */
190static inline unsigned int irq_linear_revmap(struct irq_domain *domain,
191 irq_hw_number_t hwirq)
192{
193 return hwirq < domain->revmap_size ? domain->linear_revmap[hwirq] : 0;
194}
164extern unsigned int irq_find_mapping(struct irq_domain *host, 195extern unsigned int irq_find_mapping(struct irq_domain *host,
165 irq_hw_number_t hwirq); 196 irq_hw_number_t hwirq);
166extern unsigned int irq_create_direct_mapping(struct irq_domain *host); 197extern unsigned int irq_create_direct_mapping(struct irq_domain *host);
@@ -174,9 +205,6 @@ static inline int irq_create_identity_mapping(struct irq_domain *host,
174 return irq_create_strict_mappings(host, hwirq, hwirq, 1); 205 return irq_create_strict_mappings(host, hwirq, hwirq, 1);
175} 206}
176 207
177extern unsigned int irq_linear_revmap(struct irq_domain *host,
178 irq_hw_number_t hwirq);
179
180extern const struct irq_domain_ops irq_domain_simple_ops; 208extern const struct irq_domain_ops irq_domain_simple_ops;
181 209
182/* stock xlate functions */ 210/* stock xlate functions */
@@ -190,14 +218,6 @@ int irq_domain_xlate_onetwocell(struct irq_domain *d, struct device_node *ctrlr,
190 const u32 *intspec, unsigned int intsize, 218 const u32 *intspec, unsigned int intsize,
191 irq_hw_number_t *out_hwirq, unsigned int *out_type); 219 irq_hw_number_t *out_hwirq, unsigned int *out_type);
192 220
193#if defined(CONFIG_OF_IRQ)
194extern void irq_domain_generate_simple(const struct of_device_id *match,
195 u64 phys_base, unsigned int irq_start);
196#else /* CONFIG_OF_IRQ */
197static inline void irq_domain_generate_simple(const struct of_device_id *match,
198 u64 phys_base, unsigned int irq_start) { }
199#endif /* !CONFIG_OF_IRQ */
200
201#else /* CONFIG_IRQ_DOMAIN */ 221#else /* CONFIG_IRQ_DOMAIN */
202static inline void irq_dispose_mapping(unsigned int virq) { } 222static inline void irq_dispose_mapping(unsigned int virq) { }
203#endif /* !CONFIG_IRQ_DOMAIN */ 223#endif /* !CONFIG_IRQ_DOMAIN */
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 7e0b622503c4..8685d1be12c7 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -27,7 +27,6 @@
27#include <linux/buffer_head.h> 27#include <linux/buffer_head.h>
28#include <linux/journal-head.h> 28#include <linux/journal-head.h>
29#include <linux/stddef.h> 29#include <linux/stddef.h>
30#include <linux/bit_spinlock.h>
31#include <linux/mutex.h> 30#include <linux/mutex.h>
32#include <linux/timer.h> 31#include <linux/timer.h>
33#include <linux/lockdep.h> 32#include <linux/lockdep.h>
@@ -244,6 +243,31 @@ typedef struct journal_superblock_s
244 243
245#include <linux/fs.h> 244#include <linux/fs.h>
246#include <linux/sched.h> 245#include <linux/sched.h>
246
247enum jbd_state_bits {
248 BH_JBD /* Has an attached ext3 journal_head */
249 = BH_PrivateStart,
250 BH_JWrite, /* Being written to log (@@@ DEBUGGING) */
251 BH_Freed, /* Has been freed (truncated) */
252 BH_Revoked, /* Has been revoked from the log */
253 BH_RevokeValid, /* Revoked flag is valid */
254 BH_JBDDirty, /* Is dirty but journaled */
255 BH_State, /* Pins most journal_head state */
256 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
257 BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */
258 BH_JBDPrivateStart, /* First bit available for private use by FS */
259};
260
261BUFFER_FNS(JBD, jbd)
262BUFFER_FNS(JWrite, jwrite)
263BUFFER_FNS(JBDDirty, jbddirty)
264TAS_BUFFER_FNS(JBDDirty, jbddirty)
265BUFFER_FNS(Revoked, revoked)
266TAS_BUFFER_FNS(Revoked, revoked)
267BUFFER_FNS(RevokeValid, revokevalid)
268TAS_BUFFER_FNS(RevokeValid, revokevalid)
269BUFFER_FNS(Freed, freed)
270
247#include <linux/jbd_common.h> 271#include <linux/jbd_common.h>
248 272
249#define J_ASSERT(assert) BUG_ON(!(assert)) 273#define J_ASSERT(assert) BUG_ON(!(assert))
@@ -840,7 +864,7 @@ extern void journal_release_buffer (handle_t *, struct buffer_head *);
840extern int journal_forget (handle_t *, struct buffer_head *); 864extern int journal_forget (handle_t *, struct buffer_head *);
841extern void journal_sync_buffer (struct buffer_head *); 865extern void journal_sync_buffer (struct buffer_head *);
842extern void journal_invalidatepage(journal_t *, 866extern void journal_invalidatepage(journal_t *,
843 struct page *, unsigned long); 867 struct page *, unsigned int, unsigned int);
844extern int journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); 868extern int journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
845extern int journal_stop(handle_t *); 869extern int journal_stop(handle_t *);
846extern int journal_flush (journal_t *); 870extern int journal_flush (journal_t *);
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 6e051f472edb..d5b50a19463c 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -26,7 +26,6 @@
26#include <linux/buffer_head.h> 26#include <linux/buffer_head.h>
27#include <linux/journal-head.h> 27#include <linux/journal-head.h>
28#include <linux/stddef.h> 28#include <linux/stddef.h>
29#include <linux/bit_spinlock.h>
30#include <linux/mutex.h> 29#include <linux/mutex.h>
31#include <linux/timer.h> 30#include <linux/timer.h>
32#include <linux/slab.h> 31#include <linux/slab.h>
@@ -57,17 +56,13 @@
57 */ 56 */
58#define JBD2_EXPENSIVE_CHECKING 57#define JBD2_EXPENSIVE_CHECKING
59extern ushort jbd2_journal_enable_debug; 58extern ushort jbd2_journal_enable_debug;
59void __jbd2_debug(int level, const char *file, const char *func,
60 unsigned int line, const char *fmt, ...);
60 61
61#define jbd_debug(n, f, a...) \ 62#define jbd_debug(n, fmt, a...) \
62 do { \ 63 __jbd2_debug((n), __FILE__, __func__, __LINE__, (fmt), ##a)
63 if ((n) <= jbd2_journal_enable_debug) { \
64 printk (KERN_DEBUG "(%s, %d): %s: ", \
65 __FILE__, __LINE__, __func__); \
66 printk (f, ## a); \
67 } \
68 } while (0)
69#else 64#else
70#define jbd_debug(f, a...) /**/ 65#define jbd_debug(n, fmt, a...) /**/
71#endif 66#endif
72 67
73extern void *jbd2_alloc(size_t size, gfp_t flags); 68extern void *jbd2_alloc(size_t size, gfp_t flags);
@@ -302,6 +297,34 @@ typedef struct journal_superblock_s
302 297
303#include <linux/fs.h> 298#include <linux/fs.h>
304#include <linux/sched.h> 299#include <linux/sched.h>
300
301enum jbd_state_bits {
302 BH_JBD /* Has an attached ext3 journal_head */
303 = BH_PrivateStart,
304 BH_JWrite, /* Being written to log (@@@ DEBUGGING) */
305 BH_Freed, /* Has been freed (truncated) */
306 BH_Revoked, /* Has been revoked from the log */
307 BH_RevokeValid, /* Revoked flag is valid */
308 BH_JBDDirty, /* Is dirty but journaled */
309 BH_State, /* Pins most journal_head state */
310 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
311 BH_Shadow, /* IO on shadow buffer is running */
312 BH_Verified, /* Metadata block has been verified ok */
313 BH_JBDPrivateStart, /* First bit available for private use by FS */
314};
315
316BUFFER_FNS(JBD, jbd)
317BUFFER_FNS(JWrite, jwrite)
318BUFFER_FNS(JBDDirty, jbddirty)
319TAS_BUFFER_FNS(JBDDirty, jbddirty)
320BUFFER_FNS(Revoked, revoked)
321TAS_BUFFER_FNS(Revoked, revoked)
322BUFFER_FNS(RevokeValid, revokevalid)
323TAS_BUFFER_FNS(RevokeValid, revokevalid)
324BUFFER_FNS(Freed, freed)
325BUFFER_FNS(Shadow, shadow)
326BUFFER_FNS(Verified, verified)
327
305#include <linux/jbd_common.h> 328#include <linux/jbd_common.h>
306 329
307#define J_ASSERT(assert) BUG_ON(!(assert)) 330#define J_ASSERT(assert) BUG_ON(!(assert))
@@ -382,8 +405,15 @@ struct jbd2_revoke_table_s;
382 405
383struct jbd2_journal_handle 406struct jbd2_journal_handle
384{ 407{
385 /* Which compound transaction is this update a part of? */ 408 union {
386 transaction_t *h_transaction; 409 /* Which compound transaction is this update a part of? */
410 transaction_t *h_transaction;
411 /* Which journal handle belongs to - used iff h_reserved set */
412 journal_t *h_journal;
413 };
414
415 /* Handle reserved for finishing the logical operation */
416 handle_t *h_rsv_handle;
387 417
388 /* Number of remaining buffers we are allowed to dirty: */ 418 /* Number of remaining buffers we are allowed to dirty: */
389 int h_buffer_credits; 419 int h_buffer_credits;
@@ -398,6 +428,7 @@ struct jbd2_journal_handle
398 /* Flags [no locking] */ 428 /* Flags [no locking] */
399 unsigned int h_sync: 1; /* sync-on-close */ 429 unsigned int h_sync: 1; /* sync-on-close */
400 unsigned int h_jdata: 1; /* force data journaling */ 430 unsigned int h_jdata: 1; /* force data journaling */
431 unsigned int h_reserved: 1; /* handle with reserved credits */
401 unsigned int h_aborted: 1; /* fatal error on handle */ 432 unsigned int h_aborted: 1; /* fatal error on handle */
402 unsigned int h_type: 8; /* for handle statistics */ 433 unsigned int h_type: 8; /* for handle statistics */
403 unsigned int h_line_no: 16; /* for handle statistics */ 434 unsigned int h_line_no: 16; /* for handle statistics */
@@ -524,12 +555,6 @@ struct transaction_s
524 struct journal_head *t_checkpoint_io_list; 555 struct journal_head *t_checkpoint_io_list;
525 556
526 /* 557 /*
527 * Doubly-linked circular list of temporary buffers currently undergoing
528 * IO in the log [j_list_lock]
529 */
530 struct journal_head *t_iobuf_list;
531
532 /*
533 * Doubly-linked circular list of metadata buffers being shadowed by log 558 * Doubly-linked circular list of metadata buffers being shadowed by log
534 * IO. The IO buffers on the iobuf list and the shadow buffers on this 559 * IO. The IO buffers on the iobuf list and the shadow buffers on this
535 * list match each other one for one at all times. [j_list_lock] 560 * list match each other one for one at all times. [j_list_lock]
@@ -537,12 +562,6 @@ struct transaction_s
537 struct journal_head *t_shadow_list; 562 struct journal_head *t_shadow_list;
538 563
539 /* 564 /*
540 * Doubly-linked circular list of control buffers being written to the
541 * log. [j_list_lock]
542 */
543 struct journal_head *t_log_list;
544
545 /*
546 * List of inodes whose data we've modified in data=ordered mode. 565 * List of inodes whose data we've modified in data=ordered mode.
547 * [j_list_lock] 566 * [j_list_lock]
548 */ 567 */
@@ -671,11 +690,10 @@ jbd2_time_diff(unsigned long start, unsigned long end)
671 * waiting for checkpointing 690 * waiting for checkpointing
672 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction 691 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction
673 * to start committing, or for a barrier lock to be released 692 * to start committing, or for a barrier lock to be released
674 * @j_wait_logspace: Wait queue for waiting for checkpointing to complete
675 * @j_wait_done_commit: Wait queue for waiting for commit to complete 693 * @j_wait_done_commit: Wait queue for waiting for commit to complete
676 * @j_wait_checkpoint: Wait queue to trigger checkpointing
677 * @j_wait_commit: Wait queue to trigger commit 694 * @j_wait_commit: Wait queue to trigger commit
678 * @j_wait_updates: Wait queue to wait for updates to complete 695 * @j_wait_updates: Wait queue to wait for updates to complete
696 * @j_wait_reserved: Wait queue to wait for reserved buffer credits to drop
679 * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints 697 * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints
680 * @j_head: Journal head - identifies the first unused block in the journal 698 * @j_head: Journal head - identifies the first unused block in the journal
681 * @j_tail: Journal tail - identifies the oldest still-used block in the 699 * @j_tail: Journal tail - identifies the oldest still-used block in the
@@ -689,6 +707,7 @@ jbd2_time_diff(unsigned long start, unsigned long end)
689 * journal 707 * journal
690 * @j_fs_dev: Device which holds the client fs. For internal journal this will 708 * @j_fs_dev: Device which holds the client fs. For internal journal this will
691 * be equal to j_dev 709 * be equal to j_dev
710 * @j_reserved_credits: Number of buffers reserved from the running transaction
692 * @j_maxlen: Total maximum capacity of the journal region on disk. 711 * @j_maxlen: Total maximum capacity of the journal region on disk.
693 * @j_list_lock: Protects the buffer lists and internal buffer state. 712 * @j_list_lock: Protects the buffer lists and internal buffer state.
694 * @j_inode: Optional inode where we store the journal. If present, all journal 713 * @j_inode: Optional inode where we store the journal. If present, all journal
@@ -778,21 +797,18 @@ struct journal_s
778 */ 797 */
779 wait_queue_head_t j_wait_transaction_locked; 798 wait_queue_head_t j_wait_transaction_locked;
780 799
781 /* Wait queue for waiting for checkpointing to complete */
782 wait_queue_head_t j_wait_logspace;
783
784 /* Wait queue for waiting for commit to complete */ 800 /* Wait queue for waiting for commit to complete */
785 wait_queue_head_t j_wait_done_commit; 801 wait_queue_head_t j_wait_done_commit;
786 802
787 /* Wait queue to trigger checkpointing */
788 wait_queue_head_t j_wait_checkpoint;
789
790 /* Wait queue to trigger commit */ 803 /* Wait queue to trigger commit */
791 wait_queue_head_t j_wait_commit; 804 wait_queue_head_t j_wait_commit;
792 805
793 /* Wait queue to wait for updates to complete */ 806 /* Wait queue to wait for updates to complete */
794 wait_queue_head_t j_wait_updates; 807 wait_queue_head_t j_wait_updates;
795 808
809 /* Wait queue to wait for reserved buffer credits to drop */
810 wait_queue_head_t j_wait_reserved;
811
796 /* Semaphore for locking against concurrent checkpoints */ 812 /* Semaphore for locking against concurrent checkpoints */
797 struct mutex j_checkpoint_mutex; 813 struct mutex j_checkpoint_mutex;
798 814
@@ -847,6 +863,9 @@ struct journal_s
847 /* Total maximum capacity of the journal region on disk. */ 863 /* Total maximum capacity of the journal region on disk. */
848 unsigned int j_maxlen; 864 unsigned int j_maxlen;
849 865
866 /* Number of buffers reserved from the running transaction */
867 atomic_t j_reserved_credits;
868
850 /* 869 /*
851 * Protects the buffer lists and internal buffer state. 870 * Protects the buffer lists and internal buffer state.
852 */ 871 */
@@ -991,9 +1010,17 @@ extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, i
991extern void __journal_free_buffer(struct journal_head *bh); 1010extern void __journal_free_buffer(struct journal_head *bh);
992extern void jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int); 1011extern void jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int);
993extern void __journal_clean_data_list(transaction_t *transaction); 1012extern void __journal_clean_data_list(transaction_t *transaction);
1013static inline void jbd2_file_log_bh(struct list_head *head, struct buffer_head *bh)
1014{
1015 list_add_tail(&bh->b_assoc_buffers, head);
1016}
1017static inline void jbd2_unfile_log_bh(struct buffer_head *bh)
1018{
1019 list_del_init(&bh->b_assoc_buffers);
1020}
994 1021
995/* Log buffer allocation */ 1022/* Log buffer allocation */
996extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *); 1023struct buffer_head *jbd2_journal_get_descriptor_buffer(journal_t *journal);
997int jbd2_journal_next_log_block(journal_t *, unsigned long long *); 1024int jbd2_journal_next_log_block(journal_t *, unsigned long long *);
998int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid, 1025int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid,
999 unsigned long *block); 1026 unsigned long *block);
@@ -1039,11 +1066,10 @@ extern void jbd2_buffer_abort_trigger(struct journal_head *jh,
1039 struct jbd2_buffer_trigger_type *triggers); 1066 struct jbd2_buffer_trigger_type *triggers);
1040 1067
1041/* Buffer IO */ 1068/* Buffer IO */
1042extern int 1069extern int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
1043jbd2_journal_write_metadata_buffer(transaction_t *transaction, 1070 struct journal_head *jh_in,
1044 struct journal_head *jh_in, 1071 struct buffer_head **bh_out,
1045 struct journal_head **jh_out, 1072 sector_t blocknr);
1046 unsigned long long blocknr);
1047 1073
1048/* Transaction locking */ 1074/* Transaction locking */
1049extern void __wait_on_journal (journal_t *); 1075extern void __wait_on_journal (journal_t *);
@@ -1076,10 +1102,14 @@ static inline handle_t *journal_current_handle(void)
1076 */ 1102 */
1077 1103
1078extern handle_t *jbd2_journal_start(journal_t *, int nblocks); 1104extern handle_t *jbd2_journal_start(journal_t *, int nblocks);
1079extern handle_t *jbd2__journal_start(journal_t *, int nblocks, gfp_t gfp_mask, 1105extern handle_t *jbd2__journal_start(journal_t *, int blocks, int rsv_blocks,
1080 unsigned int type, unsigned int line_no); 1106 gfp_t gfp_mask, unsigned int type,
1107 unsigned int line_no);
1081extern int jbd2_journal_restart(handle_t *, int nblocks); 1108extern int jbd2_journal_restart(handle_t *, int nblocks);
1082extern int jbd2__journal_restart(handle_t *, int nblocks, gfp_t gfp_mask); 1109extern int jbd2__journal_restart(handle_t *, int nblocks, gfp_t gfp_mask);
1110extern int jbd2_journal_start_reserved(handle_t *handle,
1111 unsigned int type, unsigned int line_no);
1112extern void jbd2_journal_free_reserved(handle_t *handle);
1083extern int jbd2_journal_extend (handle_t *, int nblocks); 1113extern int jbd2_journal_extend (handle_t *, int nblocks);
1084extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); 1114extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
1085extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); 1115extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
@@ -1090,7 +1120,7 @@ extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
1090extern int jbd2_journal_forget (handle_t *, struct buffer_head *); 1120extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
1091extern void journal_sync_buffer (struct buffer_head *); 1121extern void journal_sync_buffer (struct buffer_head *);
1092extern int jbd2_journal_invalidatepage(journal_t *, 1122extern int jbd2_journal_invalidatepage(journal_t *,
1093 struct page *, unsigned long); 1123 struct page *, unsigned int, unsigned int);
1094extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); 1124extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
1095extern int jbd2_journal_stop(handle_t *); 1125extern int jbd2_journal_stop(handle_t *);
1096extern int jbd2_journal_flush (journal_t *); 1126extern int jbd2_journal_flush (journal_t *);
@@ -1125,6 +1155,7 @@ extern void jbd2_journal_ack_err (journal_t *);
1125extern int jbd2_journal_clear_err (journal_t *); 1155extern int jbd2_journal_clear_err (journal_t *);
1126extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); 1156extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
1127extern int jbd2_journal_force_commit(journal_t *); 1157extern int jbd2_journal_force_commit(journal_t *);
1158extern int jbd2_journal_force_commit_nested(journal_t *);
1128extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode); 1159extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);
1129extern int jbd2_journal_begin_ordered_truncate(journal_t *journal, 1160extern int jbd2_journal_begin_ordered_truncate(journal_t *journal,
1130 struct jbd2_inode *inode, loff_t new_size); 1161 struct jbd2_inode *inode, loff_t new_size);
@@ -1178,8 +1209,10 @@ extern int jbd2_journal_init_revoke_caches(void);
1178extern void jbd2_journal_destroy_revoke(journal_t *); 1209extern void jbd2_journal_destroy_revoke(journal_t *);
1179extern int jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *); 1210extern int jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *);
1180extern int jbd2_journal_cancel_revoke(handle_t *, struct journal_head *); 1211extern int jbd2_journal_cancel_revoke(handle_t *, struct journal_head *);
1181extern void jbd2_journal_write_revoke_records(journal_t *, 1212extern void jbd2_journal_write_revoke_records(journal_t *journal,
1182 transaction_t *, int); 1213 transaction_t *transaction,
1214 struct list_head *log_bufs,
1215 int write_op);
1183 1216
1184/* Recovery revoke support */ 1217/* Recovery revoke support */
1185extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t); 1218extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t);
@@ -1195,11 +1228,9 @@ extern void jbd2_clear_buffer_revoked_flags(journal_t *journal);
1195 * transitions on demand. 1228 * transitions on demand.
1196 */ 1229 */
1197 1230
1198int __jbd2_log_space_left(journal_t *); /* Called with journal locked */
1199int jbd2_log_start_commit(journal_t *journal, tid_t tid); 1231int jbd2_log_start_commit(journal_t *journal, tid_t tid);
1200int __jbd2_log_start_commit(journal_t *journal, tid_t tid); 1232int __jbd2_log_start_commit(journal_t *journal, tid_t tid);
1201int jbd2_journal_start_commit(journal_t *journal, tid_t *tid); 1233int jbd2_journal_start_commit(journal_t *journal, tid_t *tid);
1202int jbd2_journal_force_commit_nested(journal_t *journal);
1203int jbd2_log_wait_commit(journal_t *journal, tid_t tid); 1234int jbd2_log_wait_commit(journal_t *journal, tid_t tid);
1204int jbd2_complete_transaction(journal_t *journal, tid_t tid); 1235int jbd2_complete_transaction(journal_t *journal, tid_t tid);
1205int jbd2_log_do_checkpoint(journal_t *journal); 1236int jbd2_log_do_checkpoint(journal_t *journal);
@@ -1235,7 +1266,7 @@ static inline int is_journal_aborted(journal_t *journal)
1235 1266
1236static inline int is_handle_aborted(handle_t *handle) 1267static inline int is_handle_aborted(handle_t *handle)
1237{ 1268{
1238 if (handle->h_aborted) 1269 if (handle->h_aborted || !handle->h_transaction)
1239 return 1; 1270 return 1;
1240 return is_journal_aborted(handle->h_transaction->t_journal); 1271 return is_journal_aborted(handle->h_transaction->t_journal);
1241} 1272}
@@ -1266,16 +1297,37 @@ extern int jbd2_journal_blocks_per_page(struct inode *inode);
1266extern size_t journal_tag_bytes(journal_t *journal); 1297extern size_t journal_tag_bytes(journal_t *journal);
1267 1298
1268/* 1299/*
1300 * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for
1301 * transaction control blocks.
1302 */
1303#define JBD2_CONTROL_BLOCKS_SHIFT 5
1304
1305/*
1269 * Return the minimum number of blocks which must be free in the journal 1306 * Return the minimum number of blocks which must be free in the journal
1270 * before a new transaction may be started. Must be called under j_state_lock. 1307 * before a new transaction may be started. Must be called under j_state_lock.
1271 */ 1308 */
1272static inline int jbd_space_needed(journal_t *journal) 1309static inline int jbd2_space_needed(journal_t *journal)
1273{ 1310{
1274 int nblocks = journal->j_max_transaction_buffers; 1311 int nblocks = journal->j_max_transaction_buffers;
1275 if (journal->j_committing_transaction) 1312 return nblocks + (nblocks >> JBD2_CONTROL_BLOCKS_SHIFT);
1276 nblocks += atomic_read(&journal->j_committing_transaction-> 1313}
1277 t_outstanding_credits); 1314
1278 return nblocks; 1315/*
1316 * Return number of free blocks in the log. Must be called under j_state_lock.
1317 */
1318static inline unsigned long jbd2_log_space_left(journal_t *journal)
1319{
1320 /* Allow for rounding errors */
1321 unsigned long free = journal->j_free - 32;
1322
1323 if (journal->j_committing_transaction) {
1324 unsigned long committing = atomic_read(&journal->
1325 j_committing_transaction->t_outstanding_credits);
1326
1327 /* Transaction + control blocks */
1328 free -= committing + (committing >> JBD2_CONTROL_BLOCKS_SHIFT);
1329 }
1330 return free;
1279} 1331}
1280 1332
1281/* 1333/*
@@ -1286,11 +1338,9 @@ static inline int jbd_space_needed(journal_t *journal)
1286#define BJ_None 0 /* Not journaled */ 1338#define BJ_None 0 /* Not journaled */
1287#define BJ_Metadata 1 /* Normal journaled metadata */ 1339#define BJ_Metadata 1 /* Normal journaled metadata */
1288#define BJ_Forget 2 /* Buffer superseded by this transaction */ 1340#define BJ_Forget 2 /* Buffer superseded by this transaction */
1289#define BJ_IO 3 /* Buffer is for temporary IO use */ 1341#define BJ_Shadow 3 /* Buffer contents being shadowed to the log */
1290#define BJ_Shadow 4 /* Buffer contents being shadowed to the log */ 1342#define BJ_Reserved 4 /* Buffer is reserved for access by journal */
1291#define BJ_LogCtl 5 /* Buffer contains log descriptors */ 1343#define BJ_Types 5
1292#define BJ_Reserved 6 /* Buffer is reserved for access by journal */
1293#define BJ_Types 7
1294 1344
1295extern int jbd_blocks_per_page(struct inode *inode); 1345extern int jbd_blocks_per_page(struct inode *inode);
1296 1346
@@ -1319,6 +1369,19 @@ static inline u32 jbd2_chksum(journal_t *journal, u32 crc,
1319 return *(u32 *)desc.ctx; 1369 return *(u32 *)desc.ctx;
1320} 1370}
1321 1371
1372/* Return most recent uncommitted transaction */
1373static inline tid_t jbd2_get_latest_transaction(journal_t *journal)
1374{
1375 tid_t tid;
1376
1377 read_lock(&journal->j_state_lock);
1378 tid = journal->j_commit_request;
1379 if (journal->j_running_transaction)
1380 tid = journal->j_running_transaction->t_tid;
1381 read_unlock(&journal->j_state_lock);
1382 return tid;
1383}
1384
1322#ifdef __KERNEL__ 1385#ifdef __KERNEL__
1323 1386
1324#define buffer_trace_init(bh) do {} while (0) 1387#define buffer_trace_init(bh) do {} while (0)
diff --git a/include/linux/jbd_common.h b/include/linux/jbd_common.h
index 6133679bc4c0..3dc53432355f 100644
--- a/include/linux/jbd_common.h
+++ b/include/linux/jbd_common.h
@@ -1,31 +1,7 @@
1#ifndef _LINUX_JBD_STATE_H 1#ifndef _LINUX_JBD_STATE_H
2#define _LINUX_JBD_STATE_H 2#define _LINUX_JBD_STATE_H
3 3
4enum jbd_state_bits { 4#include <linux/bit_spinlock.h>
5 BH_JBD /* Has an attached ext3 journal_head */
6 = BH_PrivateStart,
7 BH_JWrite, /* Being written to log (@@@ DEBUGGING) */
8 BH_Freed, /* Has been freed (truncated) */
9 BH_Revoked, /* Has been revoked from the log */
10 BH_RevokeValid, /* Revoked flag is valid */
11 BH_JBDDirty, /* Is dirty but journaled */
12 BH_State, /* Pins most journal_head state */
13 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
14 BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */
15 BH_Verified, /* Metadata block has been verified ok */
16 BH_JBDPrivateStart, /* First bit available for private use by FS */
17};
18
19BUFFER_FNS(JBD, jbd)
20BUFFER_FNS(JWrite, jwrite)
21BUFFER_FNS(JBDDirty, jbddirty)
22TAS_BUFFER_FNS(JBDDirty, jbddirty)
23BUFFER_FNS(Revoked, revoked)
24TAS_BUFFER_FNS(Revoked, revoked)
25BUFFER_FNS(RevokeValid, revokevalid)
26TAS_BUFFER_FNS(RevokeValid, revokevalid)
27BUFFER_FNS(Freed, freed)
28BUFFER_FNS(Verified, verified)
29 5
30static inline struct buffer_head *jh2bh(struct journal_head *jh) 6static inline struct buffer_head *jh2bh(struct journal_head *jh)
31{ 7{
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 8fb8edf12417..97ba4e78a37e 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -139,6 +139,10 @@ static inline u64 get_jiffies_64(void)
139 ((__s64)(a) - (__s64)(b) >= 0)) 139 ((__s64)(a) - (__s64)(b) >= 0))
140#define time_before_eq64(a,b) time_after_eq64(b,a) 140#define time_before_eq64(a,b) time_after_eq64(b,a)
141 141
142#define time_in_range64(a, b, c) \
143 (time_after_eq64(a, b) && \
144 time_before_eq64(a, c))
145
142/* 146/*
143 * These four macros compare jiffies and 'a' for convenience. 147 * These four macros compare jiffies and 'a' for convenience.
144 */ 148 */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e9ef6d6b51d5..482ad2d84a32 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -193,13 +193,10 @@ extern int _cond_resched(void);
193 (__x < 0) ? -__x : __x; \ 193 (__x < 0) ? -__x : __x; \
194 }) 194 })
195 195
196#ifdef CONFIG_PROVE_LOCKING 196#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP)
197void might_fault(void); 197void might_fault(void);
198#else 198#else
199static inline void might_fault(void) 199static inline void might_fault(void) { }
200{
201 might_sleep();
202}
203#endif 200#endif
204 201
205extern struct atomic_notifier_head panic_notifier_list; 202extern struct atomic_notifier_head panic_notifier_list;
@@ -450,6 +447,8 @@ static inline char * __deprecated pack_hex_byte(char *buf, u8 byte)
450extern int hex_to_bin(char ch); 447extern int hex_to_bin(char ch);
451extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); 448extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
452 449
450int mac_pton(const char *s, u8 *mac);
451
453/* 452/*
454 * General tracing related utility functions - trace_printk(), 453 * General tracing related utility functions - trace_printk(),
455 * tracing_on/tracing_off and tracing_start()/tracing_stop 454 * tracing_on/tracing_off and tracing_start()/tracing_stop
@@ -562,9 +561,6 @@ int __trace_bprintk(unsigned long ip, const char *fmt, ...);
562extern __printf(2, 3) 561extern __printf(2, 3)
563int __trace_printk(unsigned long ip, const char *fmt, ...); 562int __trace_printk(unsigned long ip, const char *fmt, ...);
564 563
565extern int __trace_bputs(unsigned long ip, const char *str);
566extern int __trace_puts(unsigned long ip, const char *str, int size);
567
568/** 564/**
569 * trace_puts - write a string into the ftrace buffer 565 * trace_puts - write a string into the ftrace buffer
570 * @str: the string to record 566 * @str: the string to record
@@ -600,6 +596,8 @@ extern int __trace_puts(unsigned long ip, const char *str, int size);
600 else \ 596 else \
601 __trace_puts(_THIS_IP_, str, strlen(str)); \ 597 __trace_puts(_THIS_IP_, str, strlen(str)); \
602}) 598})
599extern int __trace_bputs(unsigned long ip, const char *str);
600extern int __trace_puts(unsigned long ip, const char *str, int size);
603 601
604extern void trace_dump_stack(int skip); 602extern void trace_dump_stack(int skip);
605 603
@@ -631,7 +629,7 @@ extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
631static inline void tracing_start(void) { } 629static inline void tracing_start(void) { }
632static inline void tracing_stop(void) { } 630static inline void tracing_stop(void) { }
633static inline void ftrace_off_permanent(void) { } 631static inline void ftrace_off_permanent(void) { }
634static inline void trace_dump_stack(void) { } 632static inline void trace_dump_stack(int skip) { }
635 633
636static inline void tracing_on(void) { } 634static inline void tracing_on(void) { }
637static inline void tracing_off(void) { } 635static inline void tracing_off(void) { }
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index bbca12804d12..debf208b7611 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -229,7 +229,8 @@ static inline ktime_t timespec_to_ktime(const struct timespec ts)
229static inline ktime_t timeval_to_ktime(const struct timeval tv) 229static inline ktime_t timeval_to_ktime(const struct timeval tv)
230{ 230{
231 return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec, 231 return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec,
232 .nsec = (s32)tv.tv_usec * 1000 } }; 232 .nsec = (s32)(tv.tv_usec *
233 NSEC_PER_USEC) } };
233} 234}
234 235
235/** 236/**
@@ -320,12 +321,17 @@ static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier)
320 321
321static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec) 322static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec)
322{ 323{
323 return ktime_add_ns(kt, usec * 1000); 324 return ktime_add_ns(kt, usec * NSEC_PER_USEC);
325}
326
327static inline ktime_t ktime_add_ms(const ktime_t kt, const u64 msec)
328{
329 return ktime_add_ns(kt, msec * NSEC_PER_MSEC);
324} 330}
325 331
326static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec) 332static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
327{ 333{
328 return ktime_sub_ns(kt, usec * 1000); 334 return ktime_sub_ns(kt, usec * NSEC_PER_USEC);
329} 335}
330 336
331extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); 337extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);
@@ -338,7 +344,8 @@ extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);
338 * 344 *
339 * Returns true if there was a successful conversion, false if kt was 0. 345 * Returns true if there was a successful conversion, false if kt was 0.
340 */ 346 */
341static inline bool ktime_to_timespec_cond(const ktime_t kt, struct timespec *ts) 347static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt,
348 struct timespec *ts)
342{ 349{
343 if (kt.tv64) { 350 if (kt.tv64) {
344 *ts = ktime_to_timespec(kt); 351 *ts = ktime_to_timespec(kt);
@@ -366,7 +373,15 @@ extern void ktime_get_ts(struct timespec *ts);
366static inline ktime_t ns_to_ktime(u64 ns) 373static inline ktime_t ns_to_ktime(u64 ns)
367{ 374{
368 static const ktime_t ktime_zero = { .tv64 = 0 }; 375 static const ktime_t ktime_zero = { .tv64 = 0 };
376
369 return ktime_add_ns(ktime_zero, ns); 377 return ktime_add_ns(ktime_zero, ns);
370} 378}
371 379
380static inline ktime_t ms_to_ktime(u64 ms)
381{
382 static const ktime_t ktime_zero = { .tv64 = 0 };
383
384 return ktime_add_ms(ktime_zero, ms);
385}
386
372#endif 387#endif
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 8db53cfaccdb..a63d83ebd151 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -125,6 +125,7 @@ static inline bool is_error_page(struct page *page)
125#define KVM_REQ_MCLOCK_INPROGRESS 19 125#define KVM_REQ_MCLOCK_INPROGRESS 19
126#define KVM_REQ_EPR_EXIT 20 126#define KVM_REQ_EPR_EXIT 20
127#define KVM_REQ_SCAN_IOAPIC 21 127#define KVM_REQ_SCAN_IOAPIC 21
128#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22
128 129
129#define KVM_USERSPACE_IRQ_SOURCE_ID 0 130#define KVM_USERSPACE_IRQ_SOURCE_ID 0
130#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 131#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
@@ -145,7 +146,8 @@ struct kvm_io_range {
145#define NR_IOBUS_DEVS 1000 146#define NR_IOBUS_DEVS 1000
146 147
147struct kvm_io_bus { 148struct kvm_io_bus {
148 int dev_count; 149 int dev_count;
150 int ioeventfd_count;
149 struct kvm_io_range range[]; 151 struct kvm_io_range range[];
150}; 152};
151 153
diff --git a/include/linux/lcd.h b/include/linux/lcd.h
index e00c3b0ebc6b..504f6246f38f 100644
--- a/include/linux/lcd.h
+++ b/include/linux/lcd.h
@@ -112,7 +112,12 @@ static inline void lcd_set_power(struct lcd_device *ld, int power)
112 112
113extern struct lcd_device *lcd_device_register(const char *name, 113extern struct lcd_device *lcd_device_register(const char *name,
114 struct device *parent, void *devdata, struct lcd_ops *ops); 114 struct device *parent, void *devdata, struct lcd_ops *ops);
115extern struct lcd_device *devm_lcd_device_register(struct device *dev,
116 const char *name, struct device *parent,
117 void *devdata, struct lcd_ops *ops);
115extern void lcd_device_unregister(struct lcd_device *ld); 118extern void lcd_device_unregister(struct lcd_device *ld);
119extern void devm_lcd_device_unregister(struct device *dev,
120 struct lcd_device *ld);
116 121
117#define to_lcd_device(obj) container_of(obj, struct lcd_device, dev) 122#define to_lcd_device(obj) container_of(obj, struct lcd_device, dev)
118 123
diff --git a/include/linux/libata.h b/include/linux/libata.h
index eae7a053dc51..4ea55bb45deb 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -399,6 +399,7 @@ enum {
399 ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */ 399 ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */
400 ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */ 400 ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */
401 ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17), /* Set max sects to 65535 */ 401 ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17), /* Set max sects to 65535 */
402 ATA_HORKAGE_ATAPI_DMADIR = (1 << 18), /* device requires dmadir */
402 403
403 /* DMA mask for user DMA control: User visible values; DO NOT 404 /* DMA mask for user DMA control: User visible values; DO NOT
404 renumber */ 405 renumber */
@@ -746,6 +747,7 @@ struct ata_port {
746 /* Flags that change dynamically, protected by ap->lock */ 747 /* Flags that change dynamically, protected by ap->lock */
747 unsigned int pflags; /* ATA_PFLAG_xxx */ 748 unsigned int pflags; /* ATA_PFLAG_xxx */
748 unsigned int print_id; /* user visible unique port ID */ 749 unsigned int print_id; /* user visible unique port ID */
750 unsigned int local_port_no; /* host local port num */
749 unsigned int port_no; /* 0 based port no. inside the host */ 751 unsigned int port_no; /* 0 based port no. inside the host */
750 752
751#ifdef CONFIG_ATA_SFF 753#ifdef CONFIG_ATA_SFF
@@ -908,6 +910,9 @@ struct ata_port_operations {
908 ssize_t (*sw_activity_show)(struct ata_device *dev, char *buf); 910 ssize_t (*sw_activity_show)(struct ata_device *dev, char *buf);
909 ssize_t (*sw_activity_store)(struct ata_device *dev, 911 ssize_t (*sw_activity_store)(struct ata_device *dev,
910 enum sw_activity val); 912 enum sw_activity val);
913 ssize_t (*transmit_led_message)(struct ata_port *ap, u32 state,
914 ssize_t size);
915
911 /* 916 /*
912 * Obsolete 917 * Obsolete
913 */ 918 */
diff --git a/include/linux/list.h b/include/linux/list.h
index b83e5657365a..f4d8a2f12a33 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -381,17 +381,6 @@ static inline void list_splice_tail_init(struct list_head *list,
381 for (pos = (head)->next; pos != (head); pos = pos->next) 381 for (pos = (head)->next; pos != (head); pos = pos->next)
382 382
383/** 383/**
384 * __list_for_each - iterate over a list
385 * @pos: the &struct list_head to use as a loop cursor.
386 * @head: the head for your list.
387 *
388 * This variant doesn't differ from list_for_each() any more.
389 * We don't do prefetching in either case.
390 */
391#define __list_for_each(pos, head) \
392 for (pos = (head)->next; pos != (head); pos = pos->next)
393
394/**
395 * list_for_each_prev - iterate over a list backwards 384 * list_for_each_prev - iterate over a list backwards
396 * @pos: the &struct list_head to use as a loop cursor. 385 * @pos: the &struct list_head to use as a loop cursor.
397 * @head: the head for your list. 386 * @head: the head for your list.
diff --git a/include/linux/llist.h b/include/linux/llist.h
index a5199f6d0e82..cdaa7f023899 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -142,6 +142,9 @@ static inline struct llist_node *llist_next(struct llist_node *node)
142 return node->next; 142 return node->next;
143} 143}
144 144
145extern bool llist_add_batch(struct llist_node *new_first,
146 struct llist_node *new_last,
147 struct llist_head *head);
145/** 148/**
146 * llist_add - add a new entry 149 * llist_add - add a new entry
147 * @new: new entry to be added 150 * @new: new entry to be added
@@ -151,18 +154,7 @@ static inline struct llist_node *llist_next(struct llist_node *node)
151 */ 154 */
152static inline bool llist_add(struct llist_node *new, struct llist_head *head) 155static inline bool llist_add(struct llist_node *new, struct llist_head *head)
153{ 156{
154 struct llist_node *entry, *old_entry; 157 return llist_add_batch(new, new, head);
155
156 entry = head->first;
157 for (;;) {
158 old_entry = entry;
159 new->next = entry;
160 entry = cmpxchg(&head->first, old_entry, new);
161 if (entry == old_entry)
162 break;
163 }
164
165 return old_entry == NULL;
166} 158}
167 159
168/** 160/**
@@ -178,9 +170,6 @@ static inline struct llist_node *llist_del_all(struct llist_head *head)
178 return xchg(&head->first, NULL); 170 return xchg(&head->first, NULL);
179} 171}
180 172
181extern bool llist_add_batch(struct llist_node *new_first,
182 struct llist_node *new_last,
183 struct llist_head *head);
184extern struct llist_node *llist_del_first(struct llist_head *head); 173extern struct llist_node *llist_del_first(struct llist_head *head);
185 174
186#endif /* LLIST_H */ 175#endif /* LLIST_H */
diff --git a/include/linux/loop.h b/include/linux/loop.h
deleted file mode 100644
index 460b60fa7adf..000000000000
--- a/include/linux/loop.h
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * include/linux/loop.h
3 *
4 * Written by Theodore Ts'o, 3/29/93.
5 *
6 * Copyright 1993 by Theodore Ts'o. Redistribution of this file is
7 * permitted under the GNU General Public License.
8 */
9#ifndef _LINUX_LOOP_H
10#define _LINUX_LOOP_H
11
12#include <linux/bio.h>
13#include <linux/blkdev.h>
14#include <linux/spinlock.h>
15#include <linux/mutex.h>
16#include <uapi/linux/loop.h>
17
18/* Possible states of device */
19enum {
20 Lo_unbound,
21 Lo_bound,
22 Lo_rundown,
23};
24
25struct loop_func_table;
26
27struct loop_device {
28 int lo_number;
29 int lo_refcnt;
30 loff_t lo_offset;
31 loff_t lo_sizelimit;
32 int lo_flags;
33 int (*transfer)(struct loop_device *, int cmd,
34 struct page *raw_page, unsigned raw_off,
35 struct page *loop_page, unsigned loop_off,
36 int size, sector_t real_block);
37 char lo_file_name[LO_NAME_SIZE];
38 char lo_crypt_name[LO_NAME_SIZE];
39 char lo_encrypt_key[LO_KEY_SIZE];
40 int lo_encrypt_key_size;
41 struct loop_func_table *lo_encryption;
42 __u32 lo_init[2];
43 kuid_t lo_key_owner; /* Who set the key */
44 int (*ioctl)(struct loop_device *, int cmd,
45 unsigned long arg);
46
47 struct file * lo_backing_file;
48 struct block_device *lo_device;
49 unsigned lo_blocksize;
50 void *key_data;
51
52 gfp_t old_gfp_mask;
53
54 spinlock_t lo_lock;
55 struct bio_list lo_bio_list;
56 unsigned int lo_bio_count;
57 int lo_state;
58 struct mutex lo_ctl_mutex;
59 struct task_struct *lo_thread;
60 wait_queue_head_t lo_event;
61 /* wait queue for incoming requests */
62 wait_queue_head_t lo_req_wait;
63
64 struct request_queue *lo_queue;
65 struct gendisk *lo_disk;
66};
67
68/* Support for loadable transfer modules */
69struct loop_func_table {
70 int number; /* filter type */
71 int (*transfer)(struct loop_device *lo, int cmd,
72 struct page *raw_page, unsigned raw_off,
73 struct page *loop_page, unsigned loop_off,
74 int size, sector_t real_block);
75 int (*init)(struct loop_device *, const struct loop_info64 *);
76 /* release is called from loop_unregister_transfer or clr_fd */
77 int (*release)(struct loop_device *);
78 int (*ioctl)(struct loop_device *, int cmd, unsigned long arg);
79 struct module *owner;
80};
81
82int loop_register_transfer(struct loop_func_table *funcs);
83int loop_unregister_transfer(int number);
84
85#endif
diff --git a/include/linux/lz4.h b/include/linux/lz4.h
new file mode 100644
index 000000000000..d21c13f10a64
--- /dev/null
+++ b/include/linux/lz4.h
@@ -0,0 +1,87 @@
1#ifndef __LZ4_H__
2#define __LZ4_H__
3/*
4 * LZ4 Kernel Interface
5 *
6 * Copyright (C) 2013, LG Electronics, Kyungsik Lee <kyungsik.lee@lge.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#define LZ4_MEM_COMPRESS (4096 * sizeof(unsigned char *))
13#define LZ4HC_MEM_COMPRESS (65538 * sizeof(unsigned char *))
14
15/*
16 * lz4_compressbound()
17 * Provides the maximum size that LZ4 may output in a "worst case" scenario
18 * (input data not compressible)
19 */
20static inline size_t lz4_compressbound(size_t isize)
21{
22 return isize + (isize / 255) + 16;
23}
24
25/*
26 * lz4_compress()
27 * src : source address of the original data
28 * src_len : size of the original data
29 * dst : output buffer address of the compressed data
30 * This requires 'dst' of size LZ4_COMPRESSBOUND.
31 * dst_len : is the output size, which is returned after compress done
32 * workmem : address of the working memory.
33 * This requires 'workmem' of size LZ4_MEM_COMPRESS.
34 * return : Success if return 0
35 * Error if return (< 0)
36 * note : Destination buffer and workmem must be already allocated with
37 * the defined size.
38 */
39int lz4_compress(const unsigned char *src, size_t src_len,
40 unsigned char *dst, size_t *dst_len, void *wrkmem);
41
42 /*
43 * lz4hc_compress()
44 * src : source address of the original data
45 * src_len : size of the original data
46 * dst : output buffer address of the compressed data
47 * This requires 'dst' of size LZ4_COMPRESSBOUND.
48 * dst_len : is the output size, which is returned after compress done
49 * workmem : address of the working memory.
50 * This requires 'workmem' of size LZ4HC_MEM_COMPRESS.
51 * return : Success if return 0
52 * Error if return (< 0)
53 * note : Destination buffer and workmem must be already allocated with
54 * the defined size.
55 */
56int lz4hc_compress(const unsigned char *src, size_t src_len,
57 unsigned char *dst, size_t *dst_len, void *wrkmem);
58
59/*
60 * lz4_decompress()
61 * src : source address of the compressed data
62 * src_len : is the input size, whcih is returned after decompress done
63 * dest : output buffer address of the decompressed data
64 * actual_dest_len: is the size of uncompressed data, supposing it's known
65 * return : Success if return 0
66 * Error if return (< 0)
67 * note : Destination buffer must be already allocated.
68 * slightly faster than lz4_decompress_unknownoutputsize()
69 */
70int lz4_decompress(const char *src, size_t *src_len, char *dest,
71 size_t actual_dest_len);
72
73/*
74 * lz4_decompress_unknownoutputsize()
75 * src : source address of the compressed data
76 * src_len : is the input size, therefore the compressed size
77 * dest : output buffer address of the decompressed data
78 * dest_len: is the max size of the destination buffer, which is
79 * returned with actual size of decompressed data after
80 * decompress done
81 * return : Success if return 0
82 * Error if return (< 0)
83 * note : Destination buffer must be already allocated.
84 */
85int lz4_decompress_unknownoutputsize(const char *src, size_t src_len,
86 char *dest, size_t *dest_len);
87#endif
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index dd3c34ebca9a..8e9a029e093d 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -14,6 +14,8 @@
14#define MARVELL_PHY_ID_88E1149R 0x01410e50 14#define MARVELL_PHY_ID_88E1149R 0x01410e50
15#define MARVELL_PHY_ID_88E1240 0x01410e30 15#define MARVELL_PHY_ID_88E1240 0x01410e30
16#define MARVELL_PHY_ID_88E1318S 0x01410e90 16#define MARVELL_PHY_ID_88E1318S 0x01410e90
17#define MARVELL_PHY_ID_88E1116R 0x01410e40
18#define MARVELL_PHY_ID_88E1510 0x01410dd0
17 19
18/* struct phy_device dev_flags definitions */ 20/* struct phy_device dev_flags definitions */
19#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001 21#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index d6183f06d8c1..7b4d9d79570b 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -77,7 +77,8 @@ extern void mem_cgroup_uncharge_cache_page(struct page *page);
77 77
78bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg, 78bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg,
79 struct mem_cgroup *memcg); 79 struct mem_cgroup *memcg);
80int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg); 80bool task_in_mem_cgroup(struct task_struct *task,
81 const struct mem_cgroup *memcg);
81 82
82extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); 83extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
83extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); 84extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
@@ -273,10 +274,10 @@ static inline bool mm_match_cgroup(struct mm_struct *mm,
273 return true; 274 return true;
274} 275}
275 276
276static inline int task_in_mem_cgroup(struct task_struct *task, 277static inline bool task_in_mem_cgroup(struct task_struct *task,
277 const struct mem_cgroup *memcg) 278 const struct mem_cgroup *memcg)
278{ 279{
279 return 1; 280 return true;
280} 281}
281 282
282static inline struct cgroup_subsys_state 283static inline struct cgroup_subsys_state
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 3e622c610925..dd38e62b84d2 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -234,6 +234,8 @@ static inline void unlock_memory_hotplug(void) {}
234 234
235extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); 235extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
236extern void try_offline_node(int nid); 236extern void try_offline_node(int nid);
237extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
238extern void remove_memory(int nid, u64 start, u64 size);
237 239
238#else 240#else
239static inline int is_mem_section_removable(unsigned long pfn, 241static inline int is_mem_section_removable(unsigned long pfn,
@@ -243,15 +245,23 @@ static inline int is_mem_section_removable(unsigned long pfn,
243} 245}
244 246
245static inline void try_offline_node(int nid) {} 247static inline void try_offline_node(int nid) {}
248
249static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
250{
251 return -EINVAL;
252}
253
254static inline void remove_memory(int nid, u64 start, u64 size) {}
246#endif /* CONFIG_MEMORY_HOTREMOVE */ 255#endif /* CONFIG_MEMORY_HOTREMOVE */
247 256
257extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
258 void *arg, int (*func)(struct memory_block *, void *));
248extern int mem_online_node(int nid); 259extern int mem_online_node(int nid);
249extern int add_memory(int nid, u64 start, u64 size); 260extern int add_memory(int nid, u64 start, u64 size);
250extern int arch_add_memory(int nid, u64 start, u64 size); 261extern int arch_add_memory(int nid, u64 start, u64 size);
251extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); 262extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
252extern int offline_memory_block(struct memory_block *mem);
253extern bool is_memblock_offlined(struct memory_block *mem); 263extern bool is_memblock_offlined(struct memory_block *mem);
254extern int remove_memory(int nid, u64 start, u64 size); 264extern void remove_memory(int nid, u64 start, u64 size);
255extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, 265extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
256 int nr_pages); 266 int nr_pages);
257extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms); 267extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms);
diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h
index e94537befabd..97cb283cc8e1 100644
--- a/include/linux/mfd/88pm80x.h
+++ b/include/linux/mfd/88pm80x.h
@@ -17,7 +17,6 @@
17#include <linux/regmap.h> 17#include <linux/regmap.h>
18#include <linux/atomic.h> 18#include <linux/atomic.h>
19 19
20#define PM80X_VERSION_MASK (0xFF) /* 80X chip ID mask */
21enum { 20enum {
22 CHIP_INVALID = 0, 21 CHIP_INVALID = 0,
23 CHIP_PM800, 22 CHIP_PM800,
@@ -299,8 +298,7 @@ struct pm80x_chip {
299 struct regmap *regmap; 298 struct regmap *regmap;
300 struct regmap_irq_chip *regmap_irq_chip; 299 struct regmap_irq_chip *regmap_irq_chip;
301 struct regmap_irq_chip_data *irq_data; 300 struct regmap_irq_chip_data *irq_data;
302 unsigned char version; 301 int type;
303 int id;
304 int irq; 302 int irq;
305 int irq_mode; 303 int irq_mode;
306 unsigned long wu_flag; 304 unsigned long wu_flag;
@@ -309,8 +307,14 @@ struct pm80x_chip {
309 307
310struct pm80x_platform_data { 308struct pm80x_platform_data {
311 struct pm80x_rtc_pdata *rtc; 309 struct pm80x_rtc_pdata *rtc;
312 unsigned short power_page_addr; /* power page I2C address */ 310 /*
313 unsigned short gpadc_page_addr; /* gpadc page I2C address */ 311 * For the regulator not defined, set regulators[not_defined] to be
312 * NULL. num_regulators are the number of regulators supposed to be
313 * initialized. If all regulators are not defined, set num_regulators
314 * to be 0.
315 */
316 struct regulator_init_data *regulators[PM800_ID_RG_MAX];
317 unsigned int num_regulators;
314 int irq_mode; /* Clear interrupt by read/write(0/1) */ 318 int irq_mode; /* Clear interrupt by read/write(0/1) */
315 int batt_det; /* enable/disable */ 319 int batt_det; /* enable/disable */
316 int (*plat_config)(struct pm80x_chip *chip, 320 int (*plat_config)(struct pm80x_chip *chip,
@@ -363,7 +367,6 @@ static inline int pm80x_dev_resume(struct device *dev)
363} 367}
364#endif 368#endif
365 369
366extern int pm80x_init(struct i2c_client *client, 370extern int pm80x_init(struct i2c_client *client);
367 const struct i2c_device_id *id);
368extern int pm80x_deinit(void); 371extern int pm80x_deinit(void);
369#endif /* __LINUX_MFD_88PM80X_H */ 372#endif /* __LINUX_MFD_88PM80X_H */
diff --git a/include/linux/mfd/abx500/ab8500-sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h
index 990bc93f46e1..adba89d9c660 100644
--- a/include/linux/mfd/abx500/ab8500-sysctrl.h
+++ b/include/linux/mfd/abx500/ab8500-sysctrl.h
@@ -278,8 +278,8 @@ struct ab8500_sysctrl_platform_data {
278 278
279#define AB9540_SYSCLK12CONFCTRL_PLL26TO38ENA BIT(0) 279#define AB9540_SYSCLK12CONFCTRL_PLL26TO38ENA BIT(0)
280#define AB9540_SYSCLK12CONFCTRL_SYSCLK12USBMUXSEL BIT(1) 280#define AB9540_SYSCLK12CONFCTRL_SYSCLK12USBMUXSEL BIT(1)
281#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL_MASK 0x0C 281#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL0 BIT(2)
282#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL_SHIFT 2 282#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL1 BIT(3)
283#define AB9540_SYSCLK12CONFCTRL_SYSCLK12BUFMUX BIT(4) 283#define AB9540_SYSCLK12CONFCTRL_SYSCLK12BUFMUX BIT(4)
284#define AB9540_SYSCLK12CONFCTRL_SYSCLK12PLLMUX BIT(5) 284#define AB9540_SYSCLK12CONFCTRL_SYSCLK12PLLMUX BIT(5)
285#define AB9540_SYSCLK12CONFCTRL_SYSCLK2MUXVALID BIT(6) 285#define AB9540_SYSCLK12CONFCTRL_SYSCLK2MUXVALID BIT(6)
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 0390d5943ed6..f4acd898dac9 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -291,6 +291,8 @@ enum ab8500_version {
291#define AB8540_INT_FSYNC2R 213 291#define AB8540_INT_FSYNC2R 213
292#define AB8540_INT_BITCLK2F 214 292#define AB8540_INT_BITCLK2F 214
293#define AB8540_INT_BITCLK2R 215 293#define AB8540_INT_BITCLK2R 215
294/* ab8540_irq_regoffset[27] -> IT[Source|Latch|Mask]33 */
295#define AB8540_INT_RTC_1S 216
294 296
295/* 297/*
296 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the 298 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index cc281368dc55..5cf8b91ce996 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -23,6 +23,7 @@
23enum arizona_type { 23enum arizona_type {
24 WM5102 = 1, 24 WM5102 = 1,
25 WM5110 = 2, 25 WM5110 = 2,
26 WM8997 = 3,
26}; 27};
27 28
28#define ARIZONA_IRQ_GP1 0 29#define ARIZONA_IRQ_GP1 0
@@ -95,6 +96,8 @@ struct arizona {
95 96
96 struct arizona_pdata pdata; 97 struct arizona_pdata pdata;
97 98
99 unsigned int external_dcvdd:1;
100
98 int irq; 101 int irq;
99 struct irq_domain *virq; 102 struct irq_domain *virq;
100 struct regmap_irq_chip_data *aod_irq_chip; 103 struct regmap_irq_chip_data *aod_irq_chip;
@@ -119,5 +122,6 @@ int arizona_set_irq_wake(struct arizona *arizona, int irq, int on);
119 122
120int wm5102_patch(struct arizona *arizona); 123int wm5102_patch(struct arizona *arizona);
121int wm5110_patch(struct arizona *arizona); 124int wm5110_patch(struct arizona *arizona);
125int wm8997_patch(struct arizona *arizona);
122 126
123#endif 127#endif
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 80dead1f7100..12a5c135c746 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -77,7 +77,7 @@ struct arizona_micbias {
77 int mV; /** Regulated voltage */ 77 int mV; /** Regulated voltage */
78 unsigned int ext_cap:1; /** External capacitor fitted */ 78 unsigned int ext_cap:1; /** External capacitor fitted */
79 unsigned int discharge:1; /** Actively discharge */ 79 unsigned int discharge:1; /** Actively discharge */
80 unsigned int fast_start:1; /** Enable aggressive startup ramp rate */ 80 unsigned int soft_start:1; /** Disable aggressive startup ramp rate */
81 unsigned int bypass:1; /** Use bypass mode */ 81 unsigned int bypass:1; /** Use bypass mode */
82}; 82};
83 83
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 715b6ba3d52a..4706d3d46e56 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -215,6 +215,9 @@
215#define ARIZONA_DAC_DIGITAL_VOLUME_6R 0x43D 215#define ARIZONA_DAC_DIGITAL_VOLUME_6R 0x43D
216#define ARIZONA_DAC_VOLUME_LIMIT_6R 0x43E 216#define ARIZONA_DAC_VOLUME_LIMIT_6R 0x43E
217#define ARIZONA_NOISE_GATE_SELECT_6R 0x43F 217#define ARIZONA_NOISE_GATE_SELECT_6R 0x43F
218#define ARIZONA_DRE_ENABLE 0x440
219#define ARIZONA_DRE_CONTROL_2 0x442
220#define ARIZONA_DRE_CONTROL_3 0x443
218#define ARIZONA_DAC_AEC_CONTROL_1 0x450 221#define ARIZONA_DAC_AEC_CONTROL_1 0x450
219#define ARIZONA_NOISE_GATE_CONTROL 0x458 222#define ARIZONA_NOISE_GATE_CONTROL 0x458
220#define ARIZONA_PDM_SPK1_CTRL_1 0x490 223#define ARIZONA_PDM_SPK1_CTRL_1 0x490
@@ -1002,6 +1005,7 @@
1002#define ARIZONA_DSP2_CLOCKING_1 0x1201 1005#define ARIZONA_DSP2_CLOCKING_1 0x1201
1003#define ARIZONA_DSP2_STATUS_1 0x1204 1006#define ARIZONA_DSP2_STATUS_1 0x1204
1004#define ARIZONA_DSP2_STATUS_2 0x1205 1007#define ARIZONA_DSP2_STATUS_2 0x1205
1008#define ARIZONA_DSP2_STATUS_3 0x1206
1005#define ARIZONA_DSP2_SCRATCH_0 0x1240 1009#define ARIZONA_DSP2_SCRATCH_0 0x1240
1006#define ARIZONA_DSP2_SCRATCH_1 0x1241 1010#define ARIZONA_DSP2_SCRATCH_1 0x1241
1007#define ARIZONA_DSP2_SCRATCH_2 0x1242 1011#define ARIZONA_DSP2_SCRATCH_2 0x1242
@@ -1010,6 +1014,7 @@
1010#define ARIZONA_DSP3_CLOCKING_1 0x1301 1014#define ARIZONA_DSP3_CLOCKING_1 0x1301
1011#define ARIZONA_DSP3_STATUS_1 0x1304 1015#define ARIZONA_DSP3_STATUS_1 0x1304
1012#define ARIZONA_DSP3_STATUS_2 0x1305 1016#define ARIZONA_DSP3_STATUS_2 0x1305
1017#define ARIZONA_DSP3_STATUS_3 0x1306
1013#define ARIZONA_DSP3_SCRATCH_0 0x1340 1018#define ARIZONA_DSP3_SCRATCH_0 0x1340
1014#define ARIZONA_DSP3_SCRATCH_1 0x1341 1019#define ARIZONA_DSP3_SCRATCH_1 0x1341
1015#define ARIZONA_DSP3_SCRATCH_2 0x1342 1020#define ARIZONA_DSP3_SCRATCH_2 0x1342
@@ -1018,6 +1023,7 @@
1018#define ARIZONA_DSP4_CLOCKING_1 0x1401 1023#define ARIZONA_DSP4_CLOCKING_1 0x1401
1019#define ARIZONA_DSP4_STATUS_1 0x1404 1024#define ARIZONA_DSP4_STATUS_1 0x1404
1020#define ARIZONA_DSP4_STATUS_2 0x1405 1025#define ARIZONA_DSP4_STATUS_2 0x1405
1026#define ARIZONA_DSP4_STATUS_3 0x1406
1021#define ARIZONA_DSP4_SCRATCH_0 0x1440 1027#define ARIZONA_DSP4_SCRATCH_0 0x1440
1022#define ARIZONA_DSP4_SCRATCH_1 0x1441 1028#define ARIZONA_DSP4_SCRATCH_1 0x1441
1023#define ARIZONA_DSP4_SCRATCH_2 0x1442 1029#define ARIZONA_DSP4_SCRATCH_2 0x1442
@@ -3130,6 +3136,47 @@
3130#define ARIZONA_OUT6R_NGATE_SRC_WIDTH 12 /* OUT6R_NGATE_SRC - [11:0] */ 3136#define ARIZONA_OUT6R_NGATE_SRC_WIDTH 12 /* OUT6R_NGATE_SRC - [11:0] */
3131 3137
3132/* 3138/*
3139 * R1088 (0x440) - DRE Enable
3140 */
3141#define ARIZONA_DRE3L_ENA 0x0010 /* DRE3L_ENA */
3142#define ARIZONA_DRE3L_ENA_MASK 0x0010 /* DRE3L_ENA */
3143#define ARIZONA_DRE3L_ENA_SHIFT 4 /* DRE3L_ENA */
3144#define ARIZONA_DRE3L_ENA_WIDTH 1 /* DRE3L_ENA */
3145#define ARIZONA_DRE2R_ENA 0x0008 /* DRE2R_ENA */
3146#define ARIZONA_DRE2R_ENA_MASK 0x0008 /* DRE2R_ENA */
3147#define ARIZONA_DRE2R_ENA_SHIFT 3 /* DRE2R_ENA */
3148#define ARIZONA_DRE2R_ENA_WIDTH 1 /* DRE2R_ENA */
3149#define ARIZONA_DRE2L_ENA 0x0004 /* DRE2L_ENA */
3150#define ARIZONA_DRE2L_ENA_MASK 0x0004 /* DRE2L_ENA */
3151#define ARIZONA_DRE2L_ENA_SHIFT 2 /* DRE2L_ENA */
3152#define ARIZONA_DRE2L_ENA_WIDTH 1 /* DRE2L_ENA */
3153#define ARIZONA_DRE1R_ENA 0x0002 /* DRE1R_ENA */
3154#define ARIZONA_DRE1R_ENA_MASK 0x0002 /* DRE1R_ENA */
3155#define ARIZONA_DRE1R_ENA_SHIFT 1 /* DRE1R_ENA */
3156#define ARIZONA_DRE1R_ENA_WIDTH 1 /* DRE1R_ENA */
3157#define ARIZONA_DRE1L_ENA 0x0001 /* DRE1L_ENA */
3158#define ARIZONA_DRE1L_ENA_MASK 0x0001 /* DRE1L_ENA */
3159#define ARIZONA_DRE1L_ENA_SHIFT 0 /* DRE1L_ENA */
3160#define ARIZONA_DRE1L_ENA_WIDTH 1 /* DRE1L_ENA */
3161
3162/*
3163 * R1090 (0x442) - DRE Control 2
3164 */
3165#define ARIZONA_DRE_T_LOW_MASK 0x3F00 /* DRE_T_LOW - [13:8] */
3166#define ARIZONA_DRE_T_LOW_SHIFT 8 /* DRE_T_LOW - [13:8] */
3167#define ARIZONA_DRE_T_LOW_WIDTH 6 /* DRE_T_LOW - [13:8] */
3168
3169/*
3170 * R1091 (0x443) - DRE Control 3
3171 */
3172#define ARIZONA_DRE_GAIN_SHIFT_MASK 0xC000 /* DRE_GAIN_SHIFT - [15:14] */
3173#define ARIZONA_DRE_GAIN_SHIFT_SHIFT 14 /* DRE_GAIN_SHIFT - [15:14] */
3174#define ARIZONA_DRE_GAIN_SHIFT_WIDTH 2 /* DRE_GAIN_SHIFT - [15:14] */
3175#define ARIZONA_DRE_LOW_LEVEL_ABS_MASK 0x000F /* LOW_LEVEL_ABS - [3:0] */
3176#define ARIZONA_DRE_LOW_LEVEL_ABS_SHIFT 0 /* LOW_LEVEL_ABS - [3:0] */
3177#define ARIZONA_DRE_LOW_LEVEL_ABS_WIDTH 4 /* LOW_LEVEL_ABS - [3:0] */
3178
3179/*
3133 * R1104 (0x450) - DAC AEC Control 1 3180 * R1104 (0x450) - DAC AEC Control 1
3134 */ 3181 */
3135#define ARIZONA_AEC_LOOPBACK_SRC_MASK 0x003C /* AEC_LOOPBACK_SRC - [5:2] */ 3182#define ARIZONA_AEC_LOOPBACK_SRC_MASK 0x003C /* AEC_LOOPBACK_SRC - [5:2] */
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h
index 0ab61320ffa8..13a1ee95a233 100644
--- a/include/linux/mfd/davinci_voicecodec.h
+++ b/include/linux/mfd/davinci_voicecodec.h
@@ -26,8 +26,9 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/mfd/core.h> 28#include <linux/mfd/core.h>
29#include <linux/platform_data/edma.h>
29 30
30#include <mach/edma.h> 31#include <mach/hardware.h>
31 32
32/* 33/*
33 * Register values. 34 * Register values.
@@ -112,8 +113,6 @@ struct davinci_vc {
112 113
113 /* Memory resources */ 114 /* Memory resources */
114 void __iomem *base; 115 void __iomem *base;
115 resource_size_t pbase;
116 size_t base_size;
117 116
118 /* MFD cells */ 117 /* MFD cells */
119 struct mfd_cell cells[DAVINCI_VC_CELLS]; 118 struct mfd_cell cells[DAVINCI_VC_CELLS];
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index 689e6a0d9c99..ca0790fba2f5 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -134,6 +134,11 @@ enum prcmu_clock {
134 PRCMU_SIACLK, 134 PRCMU_SIACLK,
135 PRCMU_SVACLK, 135 PRCMU_SVACLK,
136 PRCMU_ACLK, 136 PRCMU_ACLK,
137 PRCMU_HVACLK, /* Ux540 only */
138 PRCMU_G1CLK, /* Ux540 only */
139 PRCMU_SDMMCHCLK,
140 PRCMU_CAMCLK,
141 PRCMU_BML8580CLK,
137 PRCMU_NUM_REG_CLOCKS, 142 PRCMU_NUM_REG_CLOCKS,
138 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS, 143 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS,
139 PRCMU_CDCLK, 144 PRCMU_CDCLK,
@@ -148,6 +153,13 @@ enum prcmu_clock {
148 PRCMU_DSI0ESCCLK, 153 PRCMU_DSI0ESCCLK,
149 PRCMU_DSI1ESCCLK, 154 PRCMU_DSI1ESCCLK,
150 PRCMU_DSI2ESCCLK, 155 PRCMU_DSI2ESCCLK,
156 /* LCD DSI PLL - Ux540 only */
157 PRCMU_PLLDSI_LCD,
158 PRCMU_DSI0CLK_LCD,
159 PRCMU_DSI1CLK_LCD,
160 PRCMU_DSI0ESCCLK_LCD,
161 PRCMU_DSI1ESCCLK_LCD,
162 PRCMU_DSI2ESCCLK_LCD,
151}; 163};
152 164
153/** 165/**
diff --git a/include/linux/mfd/kempld.h b/include/linux/mfd/kempld.h
new file mode 100644
index 000000000000..b911ef3add03
--- /dev/null
+++ b/include/linux/mfd/kempld.h
@@ -0,0 +1,125 @@
1/*
2 * Kontron PLD driver definitions
3 *
4 * Copyright (c) 2010-2012 Kontron Europe GmbH
5 * Author: Michael Brunner <michael.brunner@kontron.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License 2 as published
9 * by the Free Software Foundation.
10 */
11
12#ifndef _LINUX_MFD_KEMPLD_H_
13#define _LINUX_MFD_KEMPLD_H_
14
15/* kempld register definitions */
16#define KEMPLD_IOINDEX 0xa80
17#define KEMPLD_IODATA 0xa81
18#define KEMPLD_MUTEX_KEY 0x80
19#define KEMPLD_VERSION 0x00
20#define KEMPLD_VERSION_LSB 0x00
21#define KEMPLD_VERSION_MSB 0x01
22#define KEMPLD_VERSION_GET_MINOR(x) (x & 0x1f)
23#define KEMPLD_VERSION_GET_MAJOR(x) ((x >> 5) & 0x1f)
24#define KEMPLD_VERSION_GET_NUMBER(x) ((x >> 10) & 0xf)
25#define KEMPLD_VERSION_GET_TYPE(x) ((x >> 14) & 0x3)
26#define KEMPLD_BUILDNR 0x02
27#define KEMPLD_BUILDNR_LSB 0x02
28#define KEMPLD_BUILDNR_MSB 0x03
29#define KEMPLD_FEATURE 0x04
30#define KEMPLD_FEATURE_LSB 0x04
31#define KEMPLD_FEATURE_MSB 0x05
32#define KEMPLD_FEATURE_BIT_I2C (1 << 0)
33#define KEMPLD_FEATURE_BIT_WATCHDOG (1 << 1)
34#define KEMPLD_FEATURE_BIT_GPIO (1 << 2)
35#define KEMPLD_FEATURE_MASK_UART (7 << 3)
36#define KEMPLD_FEATURE_BIT_NMI (1 << 8)
37#define KEMPLD_FEATURE_BIT_SMI (1 << 9)
38#define KEMPLD_FEATURE_BIT_SCI (1 << 10)
39#define KEMPLD_SPEC 0x06
40#define KEMPLD_SPEC_GET_MINOR(x) (x & 0x0f)
41#define KEMPLD_SPEC_GET_MAJOR(x) ((x >> 4) & 0x0f)
42#define KEMPLD_IRQ_GPIO 0x35
43#define KEMPLD_IRQ_I2C 0x36
44#define KEMPLD_CFG 0x37
45#define KEMPLD_CFG_GPIO_I2C_MUX (1 << 0)
46#define KEMPLD_CFG_BIOS_WP (1 << 7)
47
48#define KEMPLD_CLK 33333333
49
50#define KEMPLD_TYPE_RELEASE 0x0
51#define KEMPLD_TYPE_DEBUG 0x1
52#define KEMPLD_TYPE_CUSTOM 0x2
53
54/**
55 * struct kempld_info - PLD device information structure
56 * @major: PLD major revision
57 * @minor: PLD minor revision
58 * @buildnr: PLD build number
59 * @number: PLD board specific index
60 * @type: PLD type
61 * @spec_major: PLD FW specification major revision
62 * @spec_minor: PLD FW specification minor revision
63 */
64struct kempld_info {
65 unsigned int major;
66 unsigned int minor;
67 unsigned int buildnr;
68 unsigned int number;
69 unsigned int type;
70 unsigned int spec_major;
71 unsigned int spec_minor;
72};
73
74/**
75 * struct kempld_device_data - Internal representation of the PLD device
76 * @io_base: Pointer to the IO memory
77 * @io_index: Pointer to the IO index register
78 * @io_data: Pointer to the IO data register
79 * @pld_clock: PLD clock frequency
80 * @feature_mask: PLD feature mask
81 * @dev: Pointer to kernel device structure
82 * @info: KEMPLD info structure
83 * @lock: PLD mutex
84 */
85struct kempld_device_data {
86 void __iomem *io_base;
87 void __iomem *io_index;
88 void __iomem *io_data;
89 u32 pld_clock;
90 u32 feature_mask;
91 struct device *dev;
92 struct kempld_info info;
93 struct mutex lock;
94};
95
96/**
97 * struct kempld_platform_data - PLD hardware configuration structure
98 * @pld_clock: PLD clock frequency
99 * @gpio_base GPIO base pin number
100 * @ioresource: IO addresses of the PLD
101 * @get_mutex: PLD specific get_mutex callback
102 * @release_mutex: PLD specific release_mutex callback
103 * @get_info: PLD specific get_info callback
104 * @register_cells: PLD specific register_cells callback
105 */
106struct kempld_platform_data {
107 u32 pld_clock;
108 int gpio_base;
109 struct resource *ioresource;
110 void (*get_hardware_mutex) (struct kempld_device_data *);
111 void (*release_hardware_mutex) (struct kempld_device_data *);
112 int (*get_info) (struct kempld_device_data *);
113 int (*register_cells) (struct kempld_device_data *);
114};
115
116extern void kempld_get_mutex(struct kempld_device_data *pld);
117extern void kempld_release_mutex(struct kempld_device_data *pld);
118extern u8 kempld_read8(struct kempld_device_data *pld, u8 index);
119extern void kempld_write8(struct kempld_device_data *pld, u8 index, u8 data);
120extern u16 kempld_read16(struct kempld_device_data *pld, u8 index);
121extern void kempld_write16(struct kempld_device_data *pld, u8 index, u16 data);
122extern u32 kempld_read32(struct kempld_device_data *pld, u8 index);
123extern void kempld_write32(struct kempld_device_data *pld, u8 index, u32 data);
124
125#endif /* _LINUX_MFD_KEMPLD_H_ */
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 1aa4f13cdfa6..244fb0d51589 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -85,6 +85,19 @@ enum max77693_pmic_reg {
85 MAX77693_PMIC_REG_END, 85 MAX77693_PMIC_REG_END,
86}; 86};
87 87
88/* MAX77693 CHG_CNFG_00 register */
89#define CHG_CNFG_00_CHG_MASK 0x1
90#define CHG_CNFG_00_BUCK_MASK 0x4
91
92/* MAX77693 CHG_CNFG_09 Register */
93#define CHG_CNFG_09_CHGIN_ILIM_MASK 0x7F
94
95/* MAX77693 CHG_CTRL Register */
96#define SAFEOUT_CTRL_SAFEOUT1_MASK 0x3
97#define SAFEOUT_CTRL_SAFEOUT2_MASK 0xC
98#define SAFEOUT_CTRL_ENSAFEOUT1_MASK 0x40
99#define SAFEOUT_CTRL_ENSAFEOUT2_MASK 0x80
100
88/* Slave addr = 0x4A: MUIC */ 101/* Slave addr = 0x4A: MUIC */
89enum max77693_muic_reg { 102enum max77693_muic_reg {
90 MAX77693_MUIC_REG_ID = 0x00, 103 MAX77693_MUIC_REG_ID = 0x00,
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index 3109a6c5c948..676f0f388992 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -30,6 +30,20 @@
30#ifndef __LINUX_MFD_MAX77693_H 30#ifndef __LINUX_MFD_MAX77693_H
31#define __LINUX_MFD_MAX77693_H 31#define __LINUX_MFD_MAX77693_H
32 32
33/* MAX77686 regulator IDs */
34enum max77693_regulators {
35 MAX77693_ESAFEOUT1 = 0,
36 MAX77693_ESAFEOUT2,
37 MAX77693_CHARGER,
38 MAX77693_REG_MAX,
39};
40
41struct max77693_regulator_data {
42 int id;
43 struct regulator_init_data *initdata;
44 struct device_node *of_node;
45};
46
33struct max77693_reg_data { 47struct max77693_reg_data {
34 u8 addr; 48 u8 addr;
35 u8 data; 49 u8 data;
@@ -52,6 +66,10 @@ struct max77693_muic_platform_data {
52struct max77693_platform_data { 66struct max77693_platform_data {
53 int wakeup; 67 int wakeup;
54 68
69 /* regulator data */
70 struct max77693_regulator_data *regulators;
71 int num_regulators;
72
55 /* muic data */ 73 /* muic data */
56 struct max77693_muic_platform_data *muic_data; 74 struct max77693_muic_platform_data *muic_data;
57}; 75};
diff --git a/include/linux/mfd/max8998-private.h b/include/linux/mfd/max8998-private.h
index effa5d3b96ae..84844e0a5704 100644
--- a/include/linux/mfd/max8998-private.h
+++ b/include/linux/mfd/max8998-private.h
@@ -132,9 +132,12 @@ enum {
132 132
133#define MAX8998_ENRAMP (1 << 4) 133#define MAX8998_ENRAMP (1 << 4)
134 134
135struct irq_domain;
136
135/** 137/**
136 * struct max8998_dev - max8998 master device for sub-drivers 138 * struct max8998_dev - max8998 master device for sub-drivers
137 * @dev: master device of the chip (can be used to access platform data) 139 * @dev: master device of the chip (can be used to access platform data)
140 * @pdata: platform data for the driver and subdrivers
138 * @i2c: i2c client private data for regulator 141 * @i2c: i2c client private data for regulator
139 * @rtc: i2c client private data for rtc 142 * @rtc: i2c client private data for rtc
140 * @iolock: mutex for serializing io access 143 * @iolock: mutex for serializing io access
@@ -148,12 +151,14 @@ enum {
148 */ 151 */
149struct max8998_dev { 152struct max8998_dev {
150 struct device *dev; 153 struct device *dev;
154 struct max8998_platform_data *pdata;
151 struct i2c_client *i2c; 155 struct i2c_client *i2c;
152 struct i2c_client *rtc; 156 struct i2c_client *rtc;
153 struct mutex iolock; 157 struct mutex iolock;
154 struct mutex irqlock; 158 struct mutex irqlock;
155 159
156 int irq_base; 160 unsigned int irq_base;
161 struct irq_domain *irq_domain;
157 int irq; 162 int irq;
158 int ono; 163 int ono;
159 u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS]; 164 u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS];
diff --git a/include/linux/mfd/max8998.h b/include/linux/mfd/max8998.h
index 6823548d0c0a..e3956a654cbc 100644
--- a/include/linux/mfd/max8998.h
+++ b/include/linux/mfd/max8998.h
@@ -58,10 +58,12 @@ enum {
58 * max8998_regulator_data - regulator data 58 * max8998_regulator_data - regulator data
59 * @id: regulator id 59 * @id: regulator id
60 * @initdata: regulator init data (contraints, supplies, ...) 60 * @initdata: regulator init data (contraints, supplies, ...)
61 * @reg_node: DT node of regulator (unused on non-DT platforms)
61 */ 62 */
62struct max8998_regulator_data { 63struct max8998_regulator_data {
63 int id; 64 int id;
64 struct regulator_init_data *initdata; 65 struct regulator_init_data *initdata;
66 struct device_node *reg_node;
65}; 67};
66 68
67/** 69/**
@@ -73,12 +75,8 @@ struct max8998_regulator_data {
73 * @buck_voltage_lock: Do NOT change the values of the following six 75 * @buck_voltage_lock: Do NOT change the values of the following six
74 * registers set by buck?_voltage?. The voltage of BUCK1/2 cannot 76 * registers set by buck?_voltage?. The voltage of BUCK1/2 cannot
75 * be other than the preset values. 77 * be other than the preset values.
76 * @buck1_voltage1: BUCK1 DVS mode 1 voltage register 78 * @buck1_voltage: BUCK1 DVS mode 1 voltage registers
77 * @buck1_voltage2: BUCK1 DVS mode 2 voltage register 79 * @buck2_voltage: BUCK2 DVS mode 2 voltage registers
78 * @buck1_voltage3: BUCK1 DVS mode 3 voltage register
79 * @buck1_voltage4: BUCK1 DVS mode 4 voltage register
80 * @buck2_voltage1: BUCK2 DVS mode 1 voltage register
81 * @buck2_voltage2: BUCK2 DVS mode 2 voltage register
82 * @buck1_set1: BUCK1 gpio pin 1 to set output voltage 80 * @buck1_set1: BUCK1 gpio pin 1 to set output voltage
83 * @buck1_set2: BUCK1 gpio pin 2 to set output voltage 81 * @buck1_set2: BUCK1 gpio pin 2 to set output voltage
84 * @buck1_default_idx: Default for BUCK1 gpio pin 1, 2 82 * @buck1_default_idx: Default for BUCK1 gpio pin 1, 2
@@ -100,15 +98,11 @@ struct max8998_regulator_data {
100struct max8998_platform_data { 98struct max8998_platform_data {
101 struct max8998_regulator_data *regulators; 99 struct max8998_regulator_data *regulators;
102 int num_regulators; 100 int num_regulators;
103 int irq_base; 101 unsigned int irq_base;
104 int ono; 102 int ono;
105 bool buck_voltage_lock; 103 bool buck_voltage_lock;
106 int buck1_voltage1; 104 int buck1_voltage[4];
107 int buck1_voltage2; 105 int buck2_voltage[2];
108 int buck1_voltage3;
109 int buck1_voltage4;
110 int buck2_voltage1;
111 int buck2_voltage2;
112 int buck1_set1; 106 int buck1_set1;
113 int buck1_set2; 107 int buck1_set2;
114 int buck1_default_idx; 108 int buck1_default_idx;
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index bf070755982e..41ed59276c00 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -78,20 +78,30 @@ struct mc13xxx_regulator_platform_data {
78 struct mc13xxx_regulator_init_data *regulators; 78 struct mc13xxx_regulator_init_data *regulators;
79}; 79};
80 80
81enum {
82 /* MC13783 LED IDs */
83 MC13783_LED_MD,
84 MC13783_LED_AD,
85 MC13783_LED_KP,
86 MC13783_LED_R1,
87 MC13783_LED_G1,
88 MC13783_LED_B1,
89 MC13783_LED_R2,
90 MC13783_LED_G2,
91 MC13783_LED_B2,
92 MC13783_LED_R3,
93 MC13783_LED_G3,
94 MC13783_LED_B3,
95 /* MC13892 LED IDs */
96 MC13892_LED_MD,
97 MC13892_LED_AD,
98 MC13892_LED_KP,
99 MC13892_LED_R,
100 MC13892_LED_G,
101 MC13892_LED_B,
102};
103
81struct mc13xxx_led_platform_data { 104struct mc13xxx_led_platform_data {
82#define MC13783_LED_MD 0
83#define MC13783_LED_AD 1
84#define MC13783_LED_KP 2
85#define MC13783_LED_R1 3
86#define MC13783_LED_G1 4
87#define MC13783_LED_B1 5
88#define MC13783_LED_R2 6
89#define MC13783_LED_G2 7
90#define MC13783_LED_B2 8
91#define MC13783_LED_R3 9
92#define MC13783_LED_G3 10
93#define MC13783_LED_B3 11
94#define MC13783_LED_MAX MC13783_LED_B3
95 int id; 105 int id;
96 const char *name; 106 const char *name;
97 const char *default_trigger; 107 const char *default_trigger;
@@ -100,46 +110,36 @@ struct mc13xxx_led_platform_data {
100 char max_current; 110 char max_current;
101}; 111};
102 112
113#define MAX_LED_CONTROL_REGS 6
114
103struct mc13xxx_leds_platform_data { 115struct mc13xxx_leds_platform_data {
104 int num_leds;
105 struct mc13xxx_led_platform_data *led; 116 struct mc13xxx_led_platform_data *led;
117 int num_leds;
106 118
107#define MC13783_LED_TRIODE_MD (1 << 0) 119/* LED Control 0 */
108#define MC13783_LED_TRIODE_AD (1 << 1) 120#define MC13783_LED_C0_ENABLE (1 << 0)
109#define MC13783_LED_TRIODE_KP (1 << 2) 121#define MC13783_LED_C0_TRIODE_MD (1 << 7)
110#define MC13783_LED_BOOST_EN (1 << 3) 122#define MC13783_LED_C0_TRIODE_AD (1 << 8)
111#define MC13783_LED_TC1HALF (1 << 4) 123#define MC13783_LED_C0_TRIODE_KP (1 << 9)
112#define MC13783_LED_SLEWLIMTC (1 << 5) 124#define MC13783_LED_C0_BOOST (1 << 10)
113#define MC13783_LED_SLEWLIMBL (1 << 6) 125#define MC13783_LED_C0_ABMODE(x) (((x) & 0x7) << 11)
114#define MC13783_LED_TRIODE_TC1 (1 << 7) 126#define MC13783_LED_C0_ABREF(x) (((x) & 0x3) << 14)
115#define MC13783_LED_TRIODE_TC2 (1 << 8) 127/* LED Control 1 */
116#define MC13783_LED_TRIODE_TC3 (1 << 9) 128#define MC13783_LED_C1_TC1HALF (1 << 18)
117 int flags; 129#define MC13783_LED_C1_SLEWLIM (1 << 23)
118 130/* LED Control 2 */
119#define MC13783_LED_AB_DISABLED 0 131#define MC13783_LED_C2_PERIOD(x) (((x) & 0x3) << 21)
120#define MC13783_LED_AB_MD1 1 132#define MC13783_LED_C2_SLEWLIM (1 << 23)
121#define MC13783_LED_AB_MD12 2 133/* LED Control 3 */
122#define MC13783_LED_AB_MD123 3 134#define MC13783_LED_C3_PERIOD(x) (((x) & 0x3) << 21)
123#define MC13783_LED_AB_MD1234 4 135#define MC13783_LED_C3_TRIODE_TC1 (1 << 23)
124#define MC13783_LED_AB_MD1234_AD1 5 136/* LED Control 4 */
125#define MC13783_LED_AB_MD1234_AD12 6 137#define MC13783_LED_C4_PERIOD(x) (((x) & 0x3) << 21)
126#define MC13783_LED_AB_MD1_AD 7 138#define MC13783_LED_C4_TRIODE_TC2 (1 << 23)
127 char abmode; 139/* LED Control 5 */
128 140#define MC13783_LED_C5_PERIOD(x) (((x) & 0x3) << 21)
129#define MC13783_LED_ABREF_200MV 0 141#define MC13783_LED_C5_TRIODE_TC3 (1 << 23)
130#define MC13783_LED_ABREF_400MV 1 142 u32 led_control[MAX_LED_CONTROL_REGS];
131#define MC13783_LED_ABREF_600MV 2
132#define MC13783_LED_ABREF_800MV 3
133 char abref;
134
135#define MC13783_LED_PERIOD_10MS 0
136#define MC13783_LED_PERIOD_100MS 1
137#define MC13783_LED_PERIOD_500MS 2
138#define MC13783_LED_PERIOD_2S 3
139 char bl_period;
140 char tc1_period;
141 char tc2_period;
142 char tc3_period;
143}; 143};
144 144
145struct mc13xxx_buttons_platform_data { 145struct mc13xxx_buttons_platform_data {
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 8f21daf62fb5..1a8dd7afe084 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -20,6 +20,8 @@
20#include <linux/leds.h> 20#include <linux/leds.h>
21#include <linux/regmap.h> 21#include <linux/regmap.h>
22#include <linux/regulator/driver.h> 22#include <linux/regulator/driver.h>
23#include <linux/extcon.h>
24#include <linux/usb/phy_companion.h>
23 25
24#define PALMAS_NUM_CLIENTS 3 26#define PALMAS_NUM_CLIENTS 3
25 27
@@ -32,11 +34,30 @@
32 ((a) == PALMAS_CHIP_ID)) 34 ((a) == PALMAS_CHIP_ID))
33#define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID) 35#define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID)
34 36
37/**
38 * Palmas PMIC feature types
39 *
40 * PALMAS_PMIC_FEATURE_SMPS10_BOOST - used when the PMIC provides SMPS10_BOOST
41 * regulator.
42 *
43 * PALMAS_PMIC_HAS(b, f) - macro to check if a bandgap device is capable of a
44 * specific feature (above) or not. Return non-zero, if yes.
45 */
46#define PALMAS_PMIC_FEATURE_SMPS10_BOOST BIT(0)
47#define PALMAS_PMIC_HAS(b, f) \
48 ((b)->features & PALMAS_PMIC_FEATURE_ ## f)
49
35struct palmas_pmic; 50struct palmas_pmic;
36struct palmas_gpadc; 51struct palmas_gpadc;
37struct palmas_resource; 52struct palmas_resource;
38struct palmas_usb; 53struct palmas_usb;
39 54
55enum palmas_usb_state {
56 PALMAS_USB_STATE_DISCONNECT,
57 PALMAS_USB_STATE_VBUS,
58 PALMAS_USB_STATE_ID,
59};
60
40struct palmas { 61struct palmas {
41 struct device *dev; 62 struct device *dev;
42 63
@@ -46,6 +67,7 @@ struct palmas {
46 /* Stored chip id */ 67 /* Stored chip id */
47 int id; 68 int id;
48 69
70 unsigned int features;
49 /* IRQ Data */ 71 /* IRQ Data */
50 int irq; 72 int irq;
51 u32 irq_mask; 73 u32 irq_mask;
@@ -180,9 +202,6 @@ struct palmas_pmic_platform_data {
180}; 202};
181 203
182struct palmas_usb_platform_data { 204struct palmas_usb_platform_data {
183 /* Set this if platform wishes its own vbus control */
184 int no_control_vbus;
185
186 /* Do we enable the wakeup comparator on probe */ 205 /* Do we enable the wakeup comparator on probe */
187 int wakeup; 206 int wakeup;
188}; 207};
@@ -350,22 +369,19 @@ struct palmas_usb {
350 struct palmas *palmas; 369 struct palmas *palmas;
351 struct device *dev; 370 struct device *dev;
352 371
353 /* for vbus reporting with irqs disabled */ 372 struct extcon_dev edev;
354 spinlock_t lock;
355
356 struct regulator *vbus_reg;
357 373
358 /* used to set vbus, in atomic path */ 374 /* used to set vbus, in atomic path */
359 struct work_struct set_vbus_work; 375 struct work_struct set_vbus_work;
360 376
361 int irq1; 377 int id_otg_irq;
362 int irq2; 378 int id_irq;
363 int irq3; 379 int vbus_otg_irq;
364 int irq4; 380 int vbus_irq;
365 381
366 int vbus_enable; 382 int vbus_enable;
367 383
368 u8 linkstat; 384 enum palmas_usb_state linkstat;
369}; 385};
370 386
371#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator) 387#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator)
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 86bc635f8385..7a9f7089435d 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -575,6 +575,7 @@
575 575
576#define CARD_PWR_CTL 0xFD50 576#define CARD_PWR_CTL 0xFD50
577#define CARD_CLK_SWITCH 0xFD51 577#define CARD_CLK_SWITCH 0xFD51
578#define RTL8411B_PACKAGE_MODE 0xFD51
578#define CARD_SHARE_MODE 0xFD52 579#define CARD_SHARE_MODE 0xFD52
579#define CARD_DRIVE_SEL 0xFD53 580#define CARD_DRIVE_SEL 0xFD53
580#define CARD_STOP 0xFD54 581#define CARD_STOP 0xFD54
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index f0f4de3b4ccc..378ae8a04c6a 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -14,8 +14,6 @@
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#define NUM_IRQ_REGS 4
18
19enum sec_device_type { 17enum sec_device_type {
20 S5M8751X, 18 S5M8751X,
21 S5M8763X, 19 S5M8763X,
@@ -44,8 +42,6 @@ struct sec_pmic_dev {
44 struct regmap *regmap; 42 struct regmap *regmap;
45 struct i2c_client *i2c; 43 struct i2c_client *i2c;
46 struct i2c_client *rtc; 44 struct i2c_client *rtc;
47 struct mutex iolock;
48 struct mutex irqlock;
49 45
50 int device_type; 46 int device_type;
51 int irq_base; 47 int irq_base;
@@ -53,8 +49,6 @@ struct sec_pmic_dev {
53 struct regmap_irq_chip_data *irq_data; 49 struct regmap_irq_chip_data *irq_data;
54 50
55 int ono; 51 int ono;
56 u8 irq_masks_cur[NUM_IRQ_REGS];
57 u8 irq_masks_cache[NUM_IRQ_REGS];
58 int type; 52 int type;
59 bool wakeup; 53 bool wakeup;
60}; 54};
diff --git a/include/linux/mfd/samsung/s2mps11.h b/include/linux/mfd/samsung/s2mps11.h
index ad2252f239d7..4e94dc65f987 100644
--- a/include/linux/mfd/samsung/s2mps11.h
+++ b/include/linux/mfd/samsung/s2mps11.h
@@ -189,6 +189,7 @@ enum s2mps11_regulators {
189#define S2MPS11_ENABLE_SHIFT 0x06 189#define S2MPS11_ENABLE_SHIFT 0x06
190#define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1) 190#define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1)
191#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1) 191#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)
192#define S2MPS11_RAMP_DELAY 25000 /* uV/us */
192 193
193#define S2MPS11_PMIC_EN_SHIFT 6 194#define S2MPS11_PMIC_EN_SHIFT 6
194#define S2MPS11_REGULATOR_MAX (S2MPS11_REG_MAX - 3) 195#define S2MPS11_REGULATOR_MAX (S2MPS11_REG_MAX - 3)
diff --git a/include/linux/mfd/syscon/clps711x.h b/include/linux/mfd/syscon/clps711x.h
new file mode 100644
index 000000000000..26355abae515
--- /dev/null
+++ b/include/linux/mfd/syscon/clps711x.h
@@ -0,0 +1,94 @@
1/*
2 * CLPS711X system register bits definitions
3 *
4 * Copyright (C) 2013 Alexander Shiyan <shc_work@mail.ru>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef _LINUX_MFD_SYSCON_CLPS711X_H_
13#define _LINUX_MFD_SYSCON_CLPS711X_H_
14
15#define SYSCON_OFFSET (0x00)
16#define SYSFLG_OFFSET (0x40)
17
18#define SYSCON1_KBDSCAN(x) ((x) & 15)
19#define SYSCON1_KBDSCAN_MASK (15)
20#define SYSCON1_TC1M (1 << 4)
21#define SYSCON1_TC1S (1 << 5)
22#define SYSCON1_TC2M (1 << 6)
23#define SYSCON1_TC2S (1 << 7)
24#define SYSCON1_BZTOG (1 << 9)
25#define SYSCON1_BZMOD (1 << 10)
26#define SYSCON1_DBGEN (1 << 11)
27#define SYSCON1_LCDEN (1 << 12)
28#define SYSCON1_CDENTX (1 << 13)
29#define SYSCON1_CDENRX (1 << 14)
30#define SYSCON1_SIREN (1 << 15)
31#define SYSCON1_ADCKSEL(x) (((x) & 3) << 16)
32#define SYSCON1_ADCKSEL_MASK (3 << 16)
33#define SYSCON1_EXCKEN (1 << 18)
34#define SYSCON1_WAKEDIS (1 << 19)
35#define SYSCON1_IRTXM (1 << 20)
36
37#define SYSCON2_SERSEL (1 << 0)
38#define SYSCON2_KBD6 (1 << 1)
39#define SYSCON2_DRAMZ (1 << 2)
40#define SYSCON2_KBWEN (1 << 3)
41#define SYSCON2_SS2TXEN (1 << 4)
42#define SYSCON2_PCCARD1 (1 << 5)
43#define SYSCON2_PCCARD2 (1 << 6)
44#define SYSCON2_SS2RXEN (1 << 7)
45#define SYSCON2_SS2MAEN (1 << 9)
46#define SYSCON2_OSTB (1 << 12)
47#define SYSCON2_CLKENSL (1 << 13)
48#define SYSCON2_BUZFREQ (1 << 14)
49
50#define SYSCON3_ADCCON (1 << 0)
51#define SYSCON3_CLKCTL0 (1 << 1)
52#define SYSCON3_CLKCTL1 (1 << 2)
53#define SYSCON3_DAISEL (1 << 3)
54#define SYSCON3_ADCCKNSEN (1 << 4)
55#define SYSCON3_VERSN(x) (((x) >> 5) & 7)
56#define SYSCON3_VERSN_MASK (7 << 5)
57#define SYSCON3_FASTWAKE (1 << 8)
58#define SYSCON3_DAIEN (1 << 9)
59#define SYSCON3_128FS SYSCON3_DAIEN
60#define SYSCON3_ENPD67 (1 << 10)
61
62#define SYSCON_UARTEN (1 << 8)
63
64#define SYSFLG1_MCDR (1 << 0)
65#define SYSFLG1_DCDET (1 << 1)
66#define SYSFLG1_WUDR (1 << 2)
67#define SYSFLG1_WUON (1 << 3)
68#define SYSFLG1_CTS (1 << 8)
69#define SYSFLG1_DSR (1 << 9)
70#define SYSFLG1_DCD (1 << 10)
71#define SYSFLG1_NBFLG (1 << 12)
72#define SYSFLG1_RSTFLG (1 << 13)
73#define SYSFLG1_PFFLG (1 << 14)
74#define SYSFLG1_CLDFLG (1 << 15)
75#define SYSFLG1_CRXFE (1 << 24)
76#define SYSFLG1_CTXFF (1 << 25)
77#define SYSFLG1_SSIBUSY (1 << 26)
78#define SYSFLG1_ID (1 << 29)
79#define SYSFLG1_VERID(x) (((x) >> 30) & 3)
80#define SYSFLG1_VERID_MASK (3 << 30)
81
82#define SYSFLG2_SSRXOF (1 << 0)
83#define SYSFLG2_RESVAL (1 << 1)
84#define SYSFLG2_RESFRM (1 << 2)
85#define SYSFLG2_SS2RXFE (1 << 3)
86#define SYSFLG2_SS2TXFF (1 << 4)
87#define SYSFLG2_SS2TXUF (1 << 5)
88#define SYSFLG2_CKMODE (1 << 6)
89
90#define SYSFLG_UBUSY (1 << 11)
91#define SYSFLG_URXFE (1 << 22)
92#define SYSFLG_UTXFF (1 << 23)
93
94#endif
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
index dab34a1deb2c..b6bdcd66c07d 100644
--- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -103,15 +103,15 @@
103#define IMX6Q_GPR1_EXC_MON_MASK BIT(22) 103#define IMX6Q_GPR1_EXC_MON_MASK BIT(22)
104#define IMX6Q_GPR1_EXC_MON_OKAY 0x0 104#define IMX6Q_GPR1_EXC_MON_OKAY 0x0
105#define IMX6Q_GPR1_EXC_MON_SLVE BIT(22) 105#define IMX6Q_GPR1_EXC_MON_SLVE BIT(22)
106#define IMX6Q_GPR1_MIPI_IPU2_SEL_MASK BIT(21) 106#define IMX6Q_GPR1_ENET_CLK_SEL_MASK BIT(21)
107#define IMX6Q_GPR1_MIPI_IPU2_SEL_GASKET 0x0 107#define IMX6Q_GPR1_ENET_CLK_SEL_PAD 0
108#define IMX6Q_GPR1_MIPI_IPU2_SEL_IOMUX BIT(21) 108#define IMX6Q_GPR1_ENET_CLK_SEL_ANATOP BIT(21)
109#define IMX6Q_GPR1_MIPI_IPU1_MUX_MASK BIT(20) 109#define IMX6Q_GPR1_MIPI_IPU2_MUX_MASK BIT(20)
110#define IMX6Q_GPR1_MIPI_IPU1_MUX_GASKET 0x0
111#define IMX6Q_GPR1_MIPI_IPU1_MUX_IOMUX BIT(20)
112#define IMX6Q_GPR1_MIPI_IPU2_MUX_MASK BIT(19)
113#define IMX6Q_GPR1_MIPI_IPU2_MUX_GASKET 0x0 110#define IMX6Q_GPR1_MIPI_IPU2_MUX_GASKET 0x0
114#define IMX6Q_GPR1_MIPI_IPU2_MUX_IOMUX BIT(19) 111#define IMX6Q_GPR1_MIPI_IPU2_MUX_IOMUX BIT(20)
112#define IMX6Q_GPR1_MIPI_IPU1_MUX_MASK BIT(19)
113#define IMX6Q_GPR1_MIPI_IPU1_MUX_GASKET 0x0
114#define IMX6Q_GPR1_MIPI_IPU1_MUX_IOMUX BIT(19)
115#define IMX6Q_GPR1_PCIE_TEST_PD BIT(18) 115#define IMX6Q_GPR1_PCIE_TEST_PD BIT(18)
116#define IMX6Q_GPR1_IPU_VPU_MUX_MASK BIT(17) 116#define IMX6Q_GPR1_IPU_VPU_MUX_MASK BIT(17)
117#define IMX6Q_GPR1_IPU_VPU_MUX_IPU1 0x0 117#define IMX6Q_GPR1_IPU_VPU_MUX_IPU1 0x0
@@ -279,41 +279,88 @@
279#define IMX6Q_GPR13_CAN2_STOP_REQ BIT(29) 279#define IMX6Q_GPR13_CAN2_STOP_REQ BIT(29)
280#define IMX6Q_GPR13_CAN1_STOP_REQ BIT(28) 280#define IMX6Q_GPR13_CAN1_STOP_REQ BIT(28)
281#define IMX6Q_GPR13_ENET_STOP_REQ BIT(27) 281#define IMX6Q_GPR13_ENET_STOP_REQ BIT(27)
282#define IMX6Q_GPR13_SATA_PHY_8_MASK (0x7 << 24) 282#define IMX6Q_GPR13_SATA_RX_EQ_VAL_MASK (0x7 << 24)
283#define IMX6Q_GPR13_SATA_PHY_8_0_5_DB (0x0 << 24) 283#define IMX6Q_GPR13_SATA_RX_EQ_VAL_0_5_DB (0x0 << 24)
284#define IMX6Q_GPR13_SATA_PHY_8_1_0_DB (0x1 << 24) 284#define IMX6Q_GPR13_SATA_RX_EQ_VAL_1_0_DB (0x1 << 24)
285#define IMX6Q_GPR13_SATA_PHY_8_1_5_DB (0x2 << 24) 285#define IMX6Q_GPR13_SATA_RX_EQ_VAL_1_5_DB (0x2 << 24)
286#define IMX6Q_GPR13_SATA_PHY_8_2_0_DB (0x3 << 24) 286#define IMX6Q_GPR13_SATA_RX_EQ_VAL_2_0_DB (0x3 << 24)
287#define IMX6Q_GPR13_SATA_PHY_8_2_5_DB (0x4 << 24) 287#define IMX6Q_GPR13_SATA_RX_EQ_VAL_2_5_DB (0x4 << 24)
288#define IMX6Q_GPR13_SATA_PHY_8_3_0_DB (0x5 << 24) 288#define IMX6Q_GPR13_SATA_RX_EQ_VAL_3_0_DB (0x5 << 24)
289#define IMX6Q_GPR13_SATA_PHY_8_3_5_DB (0x6 << 24) 289#define IMX6Q_GPR13_SATA_RX_EQ_VAL_3_5_DB (0x6 << 24)
290#define IMX6Q_GPR13_SATA_PHY_8_4_0_DB (0x7 << 24) 290#define IMX6Q_GPR13_SATA_RX_EQ_VAL_4_0_DB (0x7 << 24)
291#define IMX6Q_GPR13_SATA_PHY_7_MASK (0x1f << 19) 291#define IMX6Q_GPR13_SATA_RX_LOS_LVL_MASK (0x1f << 19)
292#define IMX6Q_GPR13_SATA_PHY_7_SATA1I (0x10 << 19) 292#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1I (0x10 << 19)
293#define IMX6Q_GPR13_SATA_PHY_7_SATA1M (0x10 << 19) 293#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1M (0x10 << 19)
294#define IMX6Q_GPR13_SATA_PHY_7_SATA1X (0x1a << 19) 294#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1X (0x1a << 19)
295#define IMX6Q_GPR13_SATA_PHY_7_SATA2I (0x12 << 19) 295#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2I (0x12 << 19)
296#define IMX6Q_GPR13_SATA_PHY_7_SATA2M (0x12 << 19) 296#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2M (0x12 << 19)
297#define IMX6Q_GPR13_SATA_PHY_7_SATA2X (0x1a << 19) 297#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2X (0x1a << 19)
298#define IMX6Q_GPR13_SATA_PHY_6_MASK (0x7 << 16) 298#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_MASK (0x7 << 16)
299#define IMX6Q_GPR13_SATA_SPEED_MASK BIT(15) 299#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_1P_1F (0x0 << 16)
300#define IMX6Q_GPR13_SATA_SPEED_1P5G 0x0 300#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_2F (0x1 << 16)
301#define IMX6Q_GPR13_SATA_SPEED_3P0G BIT(15) 301#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_1P_4F (0x2 << 16)
302#define IMX6Q_GPR13_SATA_PHY_5 BIT(14) 302#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_4F (0x3 << 16)
303#define IMX6Q_GPR13_SATA_PHY_4_MASK (0x7 << 11) 303#define IMX6Q_GPR13_SATA_SPD_MODE_MASK BIT(15)
304#define IMX6Q_GPR13_SATA_PHY_4_16_16 (0x0 << 11) 304#define IMX6Q_GPR13_SATA_SPD_MODE_1P5G 0x0
305#define IMX6Q_GPR13_SATA_PHY_4_14_16 (0x1 << 11) 305#define IMX6Q_GPR13_SATA_SPD_MODE_3P0G BIT(15)
306#define IMX6Q_GPR13_SATA_PHY_4_12_16 (0x2 << 11) 306#define IMX6Q_GPR13_SATA_MPLL_SS_EN BIT(14)
307#define IMX6Q_GPR13_SATA_PHY_4_10_16 (0x3 << 11) 307#define IMX6Q_GPR13_SATA_TX_ATTEN_MASK (0x7 << 11)
308#define IMX6Q_GPR13_SATA_PHY_4_9_16 (0x4 << 11) 308#define IMX6Q_GPR13_SATA_TX_ATTEN_16_16 (0x0 << 11)
309#define IMX6Q_GPR13_SATA_PHY_4_8_16 (0x5 << 11) 309#define IMX6Q_GPR13_SATA_TX_ATTEN_14_16 (0x1 << 11)
310#define IMX6Q_GPR13_SATA_PHY_3_MASK (0xf << 7) 310#define IMX6Q_GPR13_SATA_TX_ATTEN_12_16 (0x2 << 11)
311#define IMX6Q_GPR13_SATA_PHY_3_OFF 0x7 311#define IMX6Q_GPR13_SATA_TX_ATTEN_10_16 (0x3 << 11)
312#define IMX6Q_GPR13_SATA_PHY_2_MASK (0x1f << 2) 312#define IMX6Q_GPR13_SATA_TX_ATTEN_9_16 (0x4 << 11)
313#define IMX6Q_GPR13_SATA_PHY_2_OFF 0x2 313#define IMX6Q_GPR13_SATA_TX_ATTEN_8_16 (0x5 << 11)
314#define IMX6Q_GPR13_SATA_PHY_1_MASK (0x3 << 0) 314#define IMX6Q_GPR13_SATA_TX_BOOST_MASK (0xf << 7)
315#define IMX6Q_GPR13_SATA_PHY_1_FAST (0x0 << 0) 315#define IMX6Q_GPR13_SATA_TX_BOOST_0_00_DB (0x0 << 7)
316#define IMX6Q_GPR13_SATA_PHY_1_MED (0x1 << 0) 316#define IMX6Q_GPR13_SATA_TX_BOOST_0_37_DB (0x1 << 7)
317#define IMX6Q_GPR13_SATA_PHY_1_SLOW (0x2 << 0) 317#define IMX6Q_GPR13_SATA_TX_BOOST_0_74_DB (0x2 << 7)
318 318#define IMX6Q_GPR13_SATA_TX_BOOST_1_11_DB (0x3 << 7)
319#define IMX6Q_GPR13_SATA_TX_BOOST_1_48_DB (0x4 << 7)
320#define IMX6Q_GPR13_SATA_TX_BOOST_1_85_DB (0x5 << 7)
321#define IMX6Q_GPR13_SATA_TX_BOOST_2_22_DB (0x6 << 7)
322#define IMX6Q_GPR13_SATA_TX_BOOST_2_59_DB (0x7 << 7)
323#define IMX6Q_GPR13_SATA_TX_BOOST_2_96_DB (0x8 << 7)
324#define IMX6Q_GPR13_SATA_TX_BOOST_3_33_DB (0x9 << 7)
325#define IMX6Q_GPR13_SATA_TX_BOOST_3_70_DB (0xa << 7)
326#define IMX6Q_GPR13_SATA_TX_BOOST_4_07_DB (0xb << 7)
327#define IMX6Q_GPR13_SATA_TX_BOOST_4_44_DB (0xc << 7)
328#define IMX6Q_GPR13_SATA_TX_BOOST_4_81_DB (0xd << 7)
329#define IMX6Q_GPR13_SATA_TX_BOOST_5_28_DB (0xe << 7)
330#define IMX6Q_GPR13_SATA_TX_BOOST_5_75_DB (0xf << 7)
331#define IMX6Q_GPR13_SATA_TX_LVL_MASK (0x1f << 2)
332#define IMX6Q_GPR13_SATA_TX_LVL_0_937_V (0x00 << 2)
333#define IMX6Q_GPR13_SATA_TX_LVL_0_947_V (0x01 << 2)
334#define IMX6Q_GPR13_SATA_TX_LVL_0_957_V (0x02 << 2)
335#define IMX6Q_GPR13_SATA_TX_LVL_0_966_V (0x03 << 2)
336#define IMX6Q_GPR13_SATA_TX_LVL_0_976_V (0x04 << 2)
337#define IMX6Q_GPR13_SATA_TX_LVL_0_986_V (0x05 << 2)
338#define IMX6Q_GPR13_SATA_TX_LVL_0_996_V (0x06 << 2)
339#define IMX6Q_GPR13_SATA_TX_LVL_1_005_V (0x07 << 2)
340#define IMX6Q_GPR13_SATA_TX_LVL_1_015_V (0x08 << 2)
341#define IMX6Q_GPR13_SATA_TX_LVL_1_025_V (0x09 << 2)
342#define IMX6Q_GPR13_SATA_TX_LVL_1_035_V (0x0a << 2)
343#define IMX6Q_GPR13_SATA_TX_LVL_1_045_V (0x0b << 2)
344#define IMX6Q_GPR13_SATA_TX_LVL_1_054_V (0x0c << 2)
345#define IMX6Q_GPR13_SATA_TX_LVL_1_064_V (0x0d << 2)
346#define IMX6Q_GPR13_SATA_TX_LVL_1_074_V (0x0e << 2)
347#define IMX6Q_GPR13_SATA_TX_LVL_1_084_V (0x0f << 2)
348#define IMX6Q_GPR13_SATA_TX_LVL_1_094_V (0x10 << 2)
349#define IMX6Q_GPR13_SATA_TX_LVL_1_104_V (0x11 << 2)
350#define IMX6Q_GPR13_SATA_TX_LVL_1_113_V (0x12 << 2)
351#define IMX6Q_GPR13_SATA_TX_LVL_1_123_V (0x13 << 2)
352#define IMX6Q_GPR13_SATA_TX_LVL_1_133_V (0x14 << 2)
353#define IMX6Q_GPR13_SATA_TX_LVL_1_143_V (0x15 << 2)
354#define IMX6Q_GPR13_SATA_TX_LVL_1_152_V (0x16 << 2)
355#define IMX6Q_GPR13_SATA_TX_LVL_1_162_V (0x17 << 2)
356#define IMX6Q_GPR13_SATA_TX_LVL_1_172_V (0x18 << 2)
357#define IMX6Q_GPR13_SATA_TX_LVL_1_182_V (0x19 << 2)
358#define IMX6Q_GPR13_SATA_TX_LVL_1_191_V (0x1a << 2)
359#define IMX6Q_GPR13_SATA_TX_LVL_1_201_V (0x1b << 2)
360#define IMX6Q_GPR13_SATA_TX_LVL_1_211_V (0x1c << 2)
361#define IMX6Q_GPR13_SATA_TX_LVL_1_221_V (0x1d << 2)
362#define IMX6Q_GPR13_SATA_TX_LVL_1_230_V (0x1e << 2)
363#define IMX6Q_GPR13_SATA_TX_LVL_1_240_V (0x1f << 2)
364#define IMX6Q_GPR13_SATA_MPLL_CLK_EN BIT(1)
365#define IMX6Q_GPR13_SATA_TX_EDGE_RATE BIT(0)
319#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */ 366#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index c79ad5d2f271..db1791bb997a 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -30,8 +30,8 @@
30#define REG_IDLECONFIG 0x058 30#define REG_IDLECONFIG 0x058
31#define REG_CHARGECONFIG 0x05C 31#define REG_CHARGECONFIG 0x05C
32#define REG_CHARGEDELAY 0x060 32#define REG_CHARGEDELAY 0x060
33#define REG_STEPCONFIG(n) (0x64 + ((n - 1) * 8)) 33#define REG_STEPCONFIG(n) (0x64 + ((n) * 8))
34#define REG_STEPDELAY(n) (0x68 + ((n - 1) * 8)) 34#define REG_STEPDELAY(n) (0x68 + ((n) * 8))
35#define REG_FIFO0CNT 0xE4 35#define REG_FIFO0CNT 0xE4
36#define REG_FIFO0THR 0xE8 36#define REG_FIFO0THR 0xE8
37#define REG_FIFO1CNT 0xF0 37#define REG_FIFO1CNT 0xF0
@@ -46,8 +46,6 @@
46/* Step Enable */ 46/* Step Enable */
47#define STEPENB_MASK (0x1FFFF << 0) 47#define STEPENB_MASK (0x1FFFF << 0)
48#define STEPENB(val) ((val) << 0) 48#define STEPENB(val) ((val) << 0)
49#define STPENB_STEPENB STEPENB(0x1FFFF)
50#define STPENB_STEPENB_TC STEPENB(0x1FFF)
51 49
52/* IRQ enable */ 50/* IRQ enable */
53#define IRQENB_HW_PEN BIT(0) 51#define IRQENB_HW_PEN BIT(0)
@@ -73,8 +71,6 @@
73#define STEPCONFIG_INM_ADCREFM STEPCONFIG_INM(8) 71#define STEPCONFIG_INM_ADCREFM STEPCONFIG_INM(8)
74#define STEPCONFIG_INP_MASK (0xF << 19) 72#define STEPCONFIG_INP_MASK (0xF << 19)
75#define STEPCONFIG_INP(val) ((val) << 19) 73#define STEPCONFIG_INP(val) ((val) << 19)
76#define STEPCONFIG_INP_AN2 STEPCONFIG_INP(2)
77#define STEPCONFIG_INP_AN3 STEPCONFIG_INP(3)
78#define STEPCONFIG_INP_AN4 STEPCONFIG_INP(4) 74#define STEPCONFIG_INP_AN4 STEPCONFIG_INP(4)
79#define STEPCONFIG_INP_ADCREFM STEPCONFIG_INP(8) 75#define STEPCONFIG_INP_ADCREFM STEPCONFIG_INP(8)
80#define STEPCONFIG_FIFO1 BIT(26) 76#define STEPCONFIG_FIFO1 BIT(26)
@@ -96,7 +92,6 @@
96#define STEPCHARGE_INM_AN1 STEPCHARGE_INM(1) 92#define STEPCHARGE_INM_AN1 STEPCHARGE_INM(1)
97#define STEPCHARGE_INP_MASK (0xF << 19) 93#define STEPCHARGE_INP_MASK (0xF << 19)
98#define STEPCHARGE_INP(val) ((val) << 19) 94#define STEPCHARGE_INP(val) ((val) << 19)
99#define STEPCHARGE_INP_AN1 STEPCHARGE_INP(1)
100#define STEPCHARGE_RFM_MASK (3 << 23) 95#define STEPCHARGE_RFM_MASK (3 << 23)
101#define STEPCHARGE_RFM(val) ((val) << 23) 96#define STEPCHARGE_RFM(val) ((val) << 23)
102#define STEPCHARGE_RFM_XNUR STEPCHARGE_RFM(1) 97#define STEPCHARGE_RFM_XNUR STEPCHARGE_RFM(1)
@@ -118,29 +113,40 @@
118#define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3) 113#define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3)
119#define CNTRLREG_TSCENB BIT(7) 114#define CNTRLREG_TSCENB BIT(7)
120 115
116/* FIFO READ Register */
117#define FIFOREAD_DATA_MASK (0xfff << 0)
118#define FIFOREAD_CHNLID_MASK (0xf << 16)
119
120/* Sequencer Status */
121#define SEQ_STATUS BIT(5)
122
121#define ADC_CLK 3000000 123#define ADC_CLK 3000000
122#define MAX_CLK_DIV 7 124#define MAX_CLK_DIV 7
123#define TOTAL_STEPS 16 125#define TOTAL_STEPS 16
124#define TOTAL_CHANNELS 8 126#define TOTAL_CHANNELS 8
125 127
126#define TSCADC_CELLS 2 128/*
127 129* ADC runs at 3MHz, and it takes
128enum tscadc_cells { 130* 15 cycles to latch one data output.
129 TSC_CELL, 131* Hence the idle time for ADC to
130 ADC_CELL, 132* process one sample data would be
131}; 133* around 5 micro seconds.
134*/
135#define IDLE_TIMEOUT 5 /* microsec */
132 136
133struct mfd_tscadc_board { 137#define TSCADC_CELLS 2
134 struct tsc_data *tsc_init;
135 struct adc_data *adc_init;
136};
137 138
138struct ti_tscadc_dev { 139struct ti_tscadc_dev {
139 struct device *dev; 140 struct device *dev;
140 struct regmap *regmap_tscadc; 141 struct regmap *regmap_tscadc;
141 void __iomem *tscadc_base; 142 void __iomem *tscadc_base;
142 int irq; 143 int irq;
144 int used_cells; /* 1-2 */
145 int tsc_cell; /* -1 if not used */
146 int adc_cell; /* -1 if not used */
143 struct mfd_cell cells[TSCADC_CELLS]; 147 struct mfd_cell cells[TSCADC_CELLS];
148 u32 reg_se_cache;
149 spinlock_t reg_lock;
144 150
145 /* tsc device */ 151 /* tsc device */
146 struct titsc *tsc; 152 struct titsc *tsc;
@@ -149,4 +155,15 @@ struct ti_tscadc_dev {
149 struct adc_device *adc; 155 struct adc_device *adc;
150}; 156};
151 157
158static inline struct ti_tscadc_dev *ti_tscadc_dev_get(struct platform_device *p)
159{
160 struct ti_tscadc_dev **tscadc_dev = p->dev.platform_data;
161
162 return *tscadc_dev;
163}
164
165void am335x_tsc_se_update(struct ti_tscadc_dev *tsadc);
166void am335x_tsc_se_set(struct ti_tscadc_dev *tsadc, u32 val);
167void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val);
168
152#endif 169#endif
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 99bf3e665997..ce3511326f80 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -81,10 +81,15 @@ int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
81void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state); 81void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
82void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state); 82void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
83 83
84struct dma_chan;
85
84struct tmio_mmc_dma { 86struct tmio_mmc_dma {
85 void *chan_priv_tx; 87 void *chan_priv_tx;
86 void *chan_priv_rx; 88 void *chan_priv_rx;
89 int slave_id_tx;
90 int slave_id_rx;
87 int alignment_shift; 91 int alignment_shift;
92 bool (*filter)(struct dma_chan *chan, void *arg);
88}; 93};
89 94
90struct tmio_mmc_host; 95struct tmio_mmc_host;
diff --git a/include/linux/mfd/tps6507x.h b/include/linux/mfd/tps6507x.h
index c923e4864f55..c2ae56933539 100644
--- a/include/linux/mfd/tps6507x.h
+++ b/include/linux/mfd/tps6507x.h
@@ -163,7 +163,6 @@ struct tps6507x_dev {
163 163
164 /* Client devices */ 164 /* Client devices */
165 struct tps6507x_pmic *pmic; 165 struct tps6507x_pmic *pmic;
166 struct tps6507x_ts *ts;
167}; 166};
168 167
169#endif /* __LINUX_MFD_TPS6507X_H */ 168#endif /* __LINUX_MFD_TPS6507X_H */
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 94ac944d12f0..7e7fbce7a308 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -125,8 +125,15 @@
125 125
126#define TWL6040_HSDACENA (1 << 0) 126#define TWL6040_HSDACENA (1 << 0)
127#define TWL6040_HSDACMODE (1 << 1) 127#define TWL6040_HSDACMODE (1 << 1)
128#define TWL6040_HSDRVENA (1 << 2)
128#define TWL6040_HSDRVMODE (1 << 3) 129#define TWL6040_HSDRVMODE (1 << 3)
129 130
131/* HFLCTL/R (0x14/0x16) fields */
132
133#define TWL6040_HFDACENA (1 << 0)
134#define TWL6040_HFPGAENA (1 << 1)
135#define TWL6040_HFDRVENA (1 << 4)
136
130/* VIBCTLL/R (0x18/0x1A) fields */ 137/* VIBCTLL/R (0x18/0x1A) fields */
131 138
132#define TWL6040_VIBENA (1 << 0) 139#define TWL6040_VIBENA (1 << 0)
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index ae5c249530b4..40854ac0ba3d 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -29,6 +29,7 @@ enum wm8994_type {
29 29
30struct regulator_dev; 30struct regulator_dev;
31struct regulator_bulk_data; 31struct regulator_bulk_data;
32struct irq_domain;
32 33
33#define WM8994_NUM_GPIO_REGS 11 34#define WM8994_NUM_GPIO_REGS 11
34#define WM8994_NUM_LDO_REGS 2 35#define WM8994_NUM_LDO_REGS 2
@@ -73,6 +74,7 @@ struct wm8994 {
73 74
74 int irq; 75 int irq;
75 struct regmap_irq_chip_data *irq_data; 76 struct regmap_irq_chip_data *irq_data;
77 struct irq_domain *edge_irq;
76 78
77 /* Used over suspend/resume */ 79 /* Used over suspend/resume */
78 bool suspended; 80 bool suspended;
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 68e776594889..90c60524a496 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -182,6 +182,11 @@ struct wm8994_pdata {
182 */ 182 */
183 int micdet_delay; 183 int micdet_delay;
184 184
185 /* Delay between microphone detect completing and reporting on
186 * insert (specified in ms)
187 */
188 int mic_id_delay;
189
185 /* IRQ for microphone detection if brought out directly as a 190 /* IRQ for microphone detection if brought out directly as a
186 * signal. 191 * signal.
187 */ 192 */
@@ -223,6 +228,11 @@ struct wm8994_pdata {
223 * lines is mastered. 228 * lines is mastered.
224 */ 229 */
225 int max_channels_clocked[WM8994_NUM_AIF]; 230 int max_channels_clocked[WM8994_NUM_AIF];
231
232 /**
233 * GPIO for the IRQ pin if host only supports edge triggering
234 */
235 int irq_gpio;
226}; 236};
227 237
228#endif 238#endif
diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h
index 053548961c15..db8cef3d5321 100644
--- a/include/linux/mfd/wm8994/registers.h
+++ b/include/linux/mfd/wm8994/registers.h
@@ -2668,6 +2668,10 @@
2668/* 2668/*
2669 * R772 (0x304) - AIF1ADC LRCLK 2669 * R772 (0x304) - AIF1ADC LRCLK
2670 */ 2670 */
2671#define WM8958_AIF1_LRCLK_INV 0x1000 /* AIF1_LRCLK_INV */
2672#define WM8958_AIF1_LRCLK_INV_MASK 0x1000 /* AIF1_LRCLK_INV */
2673#define WM8958_AIF1_LRCLK_INV_SHIFT 12 /* AIF1_LRCLK_INV */
2674#define WM8958_AIF1_LRCLK_INV_WIDTH 1 /* AIF1_LRCLK_INV */
2671#define WM8994_AIF1ADC_LRCLK_DIR 0x0800 /* AIF1ADC_LRCLK_DIR */ 2675#define WM8994_AIF1ADC_LRCLK_DIR 0x0800 /* AIF1ADC_LRCLK_DIR */
2672#define WM8994_AIF1ADC_LRCLK_DIR_MASK 0x0800 /* AIF1ADC_LRCLK_DIR */ 2676#define WM8994_AIF1ADC_LRCLK_DIR_MASK 0x0800 /* AIF1ADC_LRCLK_DIR */
2673#define WM8994_AIF1ADC_LRCLK_DIR_SHIFT 11 /* AIF1ADC_LRCLK_DIR */ 2677#define WM8994_AIF1ADC_LRCLK_DIR_SHIFT 11 /* AIF1ADC_LRCLK_DIR */
@@ -2679,6 +2683,10 @@
2679/* 2683/*
2680 * R773 (0x305) - AIF1DAC LRCLK 2684 * R773 (0x305) - AIF1DAC LRCLK
2681 */ 2685 */
2686#define WM8958_AIF1_LRCLK_INV 0x1000 /* AIF1_LRCLK_INV */
2687#define WM8958_AIF1_LRCLK_INV_MASK 0x1000 /* AIF1_LRCLK_INV */
2688#define WM8958_AIF1_LRCLK_INV_SHIFT 12 /* AIF1_LRCLK_INV */
2689#define WM8958_AIF1_LRCLK_INV_WIDTH 1 /* AIF1_LRCLK_INV */
2682#define WM8994_AIF1DAC_LRCLK_DIR 0x0800 /* AIF1DAC_LRCLK_DIR */ 2690#define WM8994_AIF1DAC_LRCLK_DIR 0x0800 /* AIF1DAC_LRCLK_DIR */
2683#define WM8994_AIF1DAC_LRCLK_DIR_MASK 0x0800 /* AIF1DAC_LRCLK_DIR */ 2691#define WM8994_AIF1DAC_LRCLK_DIR_MASK 0x0800 /* AIF1DAC_LRCLK_DIR */
2684#define WM8994_AIF1DAC_LRCLK_DIR_SHIFT 11 /* AIF1DAC_LRCLK_DIR */ 2692#define WM8994_AIF1DAC_LRCLK_DIR_SHIFT 11 /* AIF1DAC_LRCLK_DIR */
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index adf6e0648f20..bb1c8096a7eb 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -111,6 +111,7 @@ enum {
111 MLX4_CMD_INIT2INIT_QP = 0x2d, 111 MLX4_CMD_INIT2INIT_QP = 0x2d,
112 MLX4_CMD_SUSPEND_QP = 0x32, 112 MLX4_CMD_SUSPEND_QP = 0x32,
113 MLX4_CMD_UNSUSPEND_QP = 0x33, 113 MLX4_CMD_UNSUSPEND_QP = 0x33,
114 MLX4_CMD_UPDATE_QP = 0x61,
114 /* special QP and management commands */ 115 /* special QP and management commands */
115 MLX4_CMD_CONF_SPECIAL_QP = 0x23, 116 MLX4_CMD_CONF_SPECIAL_QP = 0x23,
116 MLX4_CMD_MAD_IFC = 0x24, 117 MLX4_CMD_MAD_IFC = 0x24,
@@ -237,7 +238,7 @@ int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac);
237int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos); 238int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
238int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); 239int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
239int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); 240int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf);
240 241int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state);
241 242
242#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) 243#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8)
243 244
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index a51b0134ce18..52c23a892bab 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -157,7 +157,8 @@ enum {
157 MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4, 157 MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4,
158 MLX4_DEV_CAP_FLAG2_TS = 1LL << 5, 158 MLX4_DEV_CAP_FLAG2_TS = 1LL << 5,
159 MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6, 159 MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6,
160 MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7 160 MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7,
161 MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 8
161}; 162};
162 163
163enum { 164enum {
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 352eec9df1b8..262deac02c9e 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -152,6 +152,8 @@ enum { /* fl */
152}; 152};
153enum { /* vlan_control */ 153enum { /* vlan_control */
154 MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED = 1 << 6, 154 MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED = 1 << 6,
155 MLX4_VLAN_CTRL_ETH_TX_BLOCK_PRIO_TAGGED = 1 << 5, /* 802.1p priority tag */
156 MLX4_VLAN_CTRL_ETH_TX_BLOCK_UNTAGGED = 1 << 4,
155 MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED = 1 << 2, 157 MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED = 1 << 2,
156 MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED = 1 << 1, /* 802.1p priority tag */ 158 MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED = 1 << 1, /* 802.1p priority tag */
157 MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED = 1 << 0 159 MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED = 1 << 0
@@ -206,6 +208,40 @@ struct mlx4_qp_context {
206 u32 reserved5[10]; 208 u32 reserved5[10];
207}; 209};
208 210
211struct mlx4_update_qp_context {
212 __be64 qp_mask;
213 __be64 primary_addr_path_mask;
214 __be64 secondary_addr_path_mask;
215 u64 reserved1;
216 struct mlx4_qp_context qp_context;
217 u64 reserved2[58];
218};
219
220enum {
221 MLX4_UPD_QP_MASK_PM_STATE = 32,
222 MLX4_UPD_QP_MASK_VSD = 33,
223};
224
225enum {
226 MLX4_UPD_QP_PATH_MASK_PKEY_INDEX = 0 + 32,
227 MLX4_UPD_QP_PATH_MASK_FSM = 1 + 32,
228 MLX4_UPD_QP_PATH_MASK_MAC_INDEX = 2 + 32,
229 MLX4_UPD_QP_PATH_MASK_FVL = 3 + 32,
230 MLX4_UPD_QP_PATH_MASK_CV = 4 + 32,
231 MLX4_UPD_QP_PATH_MASK_VLAN_INDEX = 5 + 32,
232 MLX4_UPD_QP_PATH_MASK_ETH_HIDE_CQE_VLAN = 6 + 32,
233 MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_UNTAGGED = 7 + 32,
234 MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_1P = 8 + 32,
235 MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_TAGGED = 9 + 32,
236 MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_UNTAGGED = 10 + 32,
237 MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_1P = 11 + 32,
238 MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_TAGGED = 12 + 32,
239 MLX4_UPD_QP_PATH_MASK_FEUP = 13 + 32,
240 MLX4_UPD_QP_PATH_MASK_SCHED_QUEUE = 14 + 32,
241 MLX4_UPD_QP_PATH_MASK_IF_COUNTER_INDEX = 15 + 32,
242 MLX4_UPD_QP_PATH_MASK_FVL_RX = 16 + 32,
243};
244
209enum { /* param3 */ 245enum { /* param3 */
210 MLX4_STRIP_VLAN = 1 << 30 246 MLX4_STRIP_VLAN = 1 << 30
211}; 247};
diff --git a/include/linux/mlx5/cmd.h b/include/linux/mlx5/cmd.h
new file mode 100644
index 000000000000..2826a4b6071e
--- /dev/null
+++ b/include/linux/mlx5/cmd.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (c) 2013, 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_CMD_H
34#define MLX5_CMD_H
35
36#include <linux/types.h>
37
38struct manage_pages_layout {
39 u64 ptr;
40 u32 reserved;
41 u16 num_entries;
42 u16 func_id;
43};
44
45
46struct mlx5_cmd_alloc_uar_imm_out {
47 u32 rsvd[3];
48 u32 uarn;
49};
50
51#endif /* MLX5_CMD_H */
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h
new file mode 100644
index 000000000000..3db67f73d96d
--- /dev/null
+++ b/include/linux/mlx5/cq.h
@@ -0,0 +1,165 @@
1/*
2 * Copyright (c) 2013, 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_CORE_CQ_H
34#define MLX5_CORE_CQ_H
35
36#include <rdma/ib_verbs.h>
37#include <linux/mlx5/driver.h>
38
39
40struct mlx5_core_cq {
41 u32 cqn;
42 int cqe_sz;
43 __be32 *set_ci_db;
44 __be32 *arm_db;
45 atomic_t refcount;
46 struct completion free;
47 unsigned vector;
48 int irqn;
49 void (*comp) (struct mlx5_core_cq *);
50 void (*event) (struct mlx5_core_cq *, enum mlx5_event);
51 struct mlx5_uar *uar;
52 u32 cons_index;
53 unsigned arm_sn;
54 struct mlx5_rsc_debug *dbg;
55 int pid;
56};
57
58
59enum {
60 MLX5_CQE_SYNDROME_LOCAL_LENGTH_ERR = 0x01,
61 MLX5_CQE_SYNDROME_LOCAL_QP_OP_ERR = 0x02,
62 MLX5_CQE_SYNDROME_LOCAL_PROT_ERR = 0x04,
63 MLX5_CQE_SYNDROME_WR_FLUSH_ERR = 0x05,
64 MLX5_CQE_SYNDROME_MW_BIND_ERR = 0x06,
65 MLX5_CQE_SYNDROME_BAD_RESP_ERR = 0x10,
66 MLX5_CQE_SYNDROME_LOCAL_ACCESS_ERR = 0x11,
67 MLX5_CQE_SYNDROME_REMOTE_INVAL_REQ_ERR = 0x12,
68 MLX5_CQE_SYNDROME_REMOTE_ACCESS_ERR = 0x13,
69 MLX5_CQE_SYNDROME_REMOTE_OP_ERR = 0x14,
70 MLX5_CQE_SYNDROME_TRANSPORT_RETRY_EXC_ERR = 0x15,
71 MLX5_CQE_SYNDROME_RNR_RETRY_EXC_ERR = 0x16,
72 MLX5_CQE_SYNDROME_REMOTE_ABORTED_ERR = 0x22,
73};
74
75enum {
76 MLX5_CQE_OWNER_MASK = 1,
77 MLX5_CQE_REQ = 0,
78 MLX5_CQE_RESP_WR_IMM = 1,
79 MLX5_CQE_RESP_SEND = 2,
80 MLX5_CQE_RESP_SEND_IMM = 3,
81 MLX5_CQE_RESP_SEND_INV = 4,
82 MLX5_CQE_RESIZE_CQ = 0xff, /* TBD */
83 MLX5_CQE_REQ_ERR = 13,
84 MLX5_CQE_RESP_ERR = 14,
85};
86
87enum {
88 MLX5_CQ_MODIFY_RESEIZE = 0,
89 MLX5_CQ_MODIFY_MODER = 1,
90 MLX5_CQ_MODIFY_MAPPING = 2,
91};
92
93struct mlx5_cq_modify_params {
94 int type;
95 union {
96 struct {
97 u32 page_offset;
98 u8 log_cq_size;
99 } resize;
100
101 struct {
102 } moder;
103
104 struct {
105 } mapping;
106 } params;
107};
108
109enum {
110 CQE_SIZE_64 = 0,
111 CQE_SIZE_128 = 1,
112};
113
114static inline int cqe_sz_to_mlx_sz(u8 size)
115{
116 return size == 64 ? CQE_SIZE_64 : CQE_SIZE_128;
117}
118
119static inline void mlx5_cq_set_ci(struct mlx5_core_cq *cq)
120{
121 *cq->set_ci_db = cpu_to_be32(cq->cons_index & 0xffffff);
122}
123
124enum {
125 MLX5_CQ_DB_REQ_NOT_SOL = 1 << 24,
126 MLX5_CQ_DB_REQ_NOT = 0 << 24
127};
128
129static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd,
130 void __iomem *uar_page,
131 spinlock_t *doorbell_lock)
132{
133 __be32 doorbell[2];
134 u32 sn;
135 u32 ci;
136
137 sn = cq->arm_sn & 3;
138 ci = cq->cons_index & 0xffffff;
139
140 *cq->arm_db = cpu_to_be32(sn << 28 | cmd | ci);
141
142 /* Make sure that the doorbell record in host memory is
143 * written before ringing the doorbell via PCI MMIO.
144 */
145 wmb();
146
147 doorbell[0] = cpu_to_be32(sn << 28 | cmd | ci);
148 doorbell[1] = cpu_to_be32(cq->cqn);
149
150 mlx5_write64(doorbell, uar_page + MLX5_CQ_DOORBELL, doorbell_lock);
151}
152
153int mlx5_init_cq_table(struct mlx5_core_dev *dev);
154void mlx5_cleanup_cq_table(struct mlx5_core_dev *dev);
155int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
156 struct mlx5_create_cq_mbox_in *in, int inlen);
157int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
158int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
159 struct mlx5_query_cq_mbox_out *out);
160int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
161 int type, struct mlx5_cq_modify_params *params);
162int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
163void mlx5_debug_cq_remove(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
164
165#endif /* MLX5_CORE_CQ_H */
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
new file mode 100644
index 000000000000..737685e9e852
--- /dev/null
+++ b/include/linux/mlx5/device.h
@@ -0,0 +1,913 @@
1/*
2 * Copyright (c) 2013, 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_DEVICE_H
34#define MLX5_DEVICE_H
35
36#include <linux/types.h>
37#include <rdma/ib_verbs.h>
38
39#if defined(__LITTLE_ENDIAN)
40#define MLX5_SET_HOST_ENDIANNESS 0
41#elif defined(__BIG_ENDIAN)
42#define MLX5_SET_HOST_ENDIANNESS 0x80
43#else
44#error Host endianness not defined
45#endif
46
47enum {
48 MLX5_MAX_COMMANDS = 32,
49 MLX5_CMD_DATA_BLOCK_SIZE = 512,
50 MLX5_PCI_CMD_XPORT = 7,
51};
52
53enum {
54 MLX5_EXTENDED_UD_AV = 0x80000000,
55};
56
57enum {
58 MLX5_CQ_STATE_ARMED = 9,
59 MLX5_CQ_STATE_ALWAYS_ARMED = 0xb,
60 MLX5_CQ_STATE_FIRED = 0xa,
61};
62
63enum {
64 MLX5_STAT_RATE_OFFSET = 5,
65};
66
67enum {
68 MLX5_INLINE_SEG = 0x80000000,
69};
70
71enum {
72 MLX5_PERM_LOCAL_READ = 1 << 2,
73 MLX5_PERM_LOCAL_WRITE = 1 << 3,
74 MLX5_PERM_REMOTE_READ = 1 << 4,
75 MLX5_PERM_REMOTE_WRITE = 1 << 5,
76 MLX5_PERM_ATOMIC = 1 << 6,
77 MLX5_PERM_UMR_EN = 1 << 7,
78};
79
80enum {
81 MLX5_PCIE_CTRL_SMALL_FENCE = 1 << 0,
82 MLX5_PCIE_CTRL_RELAXED_ORDERING = 1 << 2,
83 MLX5_PCIE_CTRL_NO_SNOOP = 1 << 3,
84 MLX5_PCIE_CTRL_TLP_PROCE_EN = 1 << 6,
85 MLX5_PCIE_CTRL_TPH_MASK = 3 << 4,
86};
87
88enum {
89 MLX5_ACCESS_MODE_PA = 0,
90 MLX5_ACCESS_MODE_MTT = 1,
91 MLX5_ACCESS_MODE_KLM = 2
92};
93
94enum {
95 MLX5_MKEY_REMOTE_INVAL = 1 << 24,
96 MLX5_MKEY_FLAG_SYNC_UMR = 1 << 29,
97 MLX5_MKEY_BSF_EN = 1 << 30,
98 MLX5_MKEY_LEN64 = 1 << 31,
99};
100
101enum {
102 MLX5_EN_RD = (u64)1,
103 MLX5_EN_WR = (u64)2
104};
105
106enum {
107 MLX5_BF_REGS_PER_PAGE = 4,
108 MLX5_MAX_UAR_PAGES = 1 << 8,
109 MLX5_MAX_UUARS = MLX5_MAX_UAR_PAGES * MLX5_BF_REGS_PER_PAGE,
110};
111
112enum {
113 MLX5_MKEY_MASK_LEN = 1ull << 0,
114 MLX5_MKEY_MASK_PAGE_SIZE = 1ull << 1,
115 MLX5_MKEY_MASK_START_ADDR = 1ull << 6,
116 MLX5_MKEY_MASK_PD = 1ull << 7,
117 MLX5_MKEY_MASK_EN_RINVAL = 1ull << 8,
118 MLX5_MKEY_MASK_BSF_EN = 1ull << 12,
119 MLX5_MKEY_MASK_KEY = 1ull << 13,
120 MLX5_MKEY_MASK_QPN = 1ull << 14,
121 MLX5_MKEY_MASK_LR = 1ull << 17,
122 MLX5_MKEY_MASK_LW = 1ull << 18,
123 MLX5_MKEY_MASK_RR = 1ull << 19,
124 MLX5_MKEY_MASK_RW = 1ull << 20,
125 MLX5_MKEY_MASK_A = 1ull << 21,
126 MLX5_MKEY_MASK_SMALL_FENCE = 1ull << 23,
127 MLX5_MKEY_MASK_FREE = 1ull << 29,
128};
129
130enum mlx5_event {
131 MLX5_EVENT_TYPE_COMP = 0x0,
132
133 MLX5_EVENT_TYPE_PATH_MIG = 0x01,
134 MLX5_EVENT_TYPE_COMM_EST = 0x02,
135 MLX5_EVENT_TYPE_SQ_DRAINED = 0x03,
136 MLX5_EVENT_TYPE_SRQ_LAST_WQE = 0x13,
137 MLX5_EVENT_TYPE_SRQ_RQ_LIMIT = 0x14,
138
139 MLX5_EVENT_TYPE_CQ_ERROR = 0x04,
140 MLX5_EVENT_TYPE_WQ_CATAS_ERROR = 0x05,
141 MLX5_EVENT_TYPE_PATH_MIG_FAILED = 0x07,
142 MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR = 0x10,
143 MLX5_EVENT_TYPE_WQ_ACCESS_ERROR = 0x11,
144 MLX5_EVENT_TYPE_SRQ_CATAS_ERROR = 0x12,
145
146 MLX5_EVENT_TYPE_INTERNAL_ERROR = 0x08,
147 MLX5_EVENT_TYPE_PORT_CHANGE = 0x09,
148 MLX5_EVENT_TYPE_GPIO_EVENT = 0x15,
149 MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19,
150
151 MLX5_EVENT_TYPE_DB_BF_CONGESTION = 0x1a,
152 MLX5_EVENT_TYPE_STALL_EVENT = 0x1b,
153
154 MLX5_EVENT_TYPE_CMD = 0x0a,
155 MLX5_EVENT_TYPE_PAGE_REQUEST = 0xb,
156};
157
158enum {
159 MLX5_PORT_CHANGE_SUBTYPE_DOWN = 1,
160 MLX5_PORT_CHANGE_SUBTYPE_ACTIVE = 4,
161 MLX5_PORT_CHANGE_SUBTYPE_INITIALIZED = 5,
162 MLX5_PORT_CHANGE_SUBTYPE_LID = 6,
163 MLX5_PORT_CHANGE_SUBTYPE_PKEY = 7,
164 MLX5_PORT_CHANGE_SUBTYPE_GUID = 8,
165 MLX5_PORT_CHANGE_SUBTYPE_CLIENT_REREG = 9,
166};
167
168enum {
169 MLX5_DEV_CAP_FLAG_RC = 1LL << 0,
170 MLX5_DEV_CAP_FLAG_UC = 1LL << 1,
171 MLX5_DEV_CAP_FLAG_UD = 1LL << 2,
172 MLX5_DEV_CAP_FLAG_XRC = 1LL << 3,
173 MLX5_DEV_CAP_FLAG_SRQ = 1LL << 6,
174 MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8,
175 MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9,
176 MLX5_DEV_CAP_FLAG_APM = 1LL << 17,
177 MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18,
178 MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24,
179 MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32,
180 MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38,
181 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39,
182 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
183 MLX5_DEV_CAP_FLAG_DCT = 1LL << 41,
184 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 1LL << 46,
185};
186
187enum {
188 MLX5_OPCODE_NOP = 0x00,
189 MLX5_OPCODE_SEND_INVAL = 0x01,
190 MLX5_OPCODE_RDMA_WRITE = 0x08,
191 MLX5_OPCODE_RDMA_WRITE_IMM = 0x09,
192 MLX5_OPCODE_SEND = 0x0a,
193 MLX5_OPCODE_SEND_IMM = 0x0b,
194 MLX5_OPCODE_RDMA_READ = 0x10,
195 MLX5_OPCODE_ATOMIC_CS = 0x11,
196 MLX5_OPCODE_ATOMIC_FA = 0x12,
197 MLX5_OPCODE_ATOMIC_MASKED_CS = 0x14,
198 MLX5_OPCODE_ATOMIC_MASKED_FA = 0x15,
199 MLX5_OPCODE_BIND_MW = 0x18,
200 MLX5_OPCODE_CONFIG_CMD = 0x1f,
201
202 MLX5_RECV_OPCODE_RDMA_WRITE_IMM = 0x00,
203 MLX5_RECV_OPCODE_SEND = 0x01,
204 MLX5_RECV_OPCODE_SEND_IMM = 0x02,
205 MLX5_RECV_OPCODE_SEND_INVAL = 0x03,
206
207 MLX5_CQE_OPCODE_ERROR = 0x1e,
208 MLX5_CQE_OPCODE_RESIZE = 0x16,
209
210 MLX5_OPCODE_SET_PSV = 0x20,
211 MLX5_OPCODE_GET_PSV = 0x21,
212 MLX5_OPCODE_CHECK_PSV = 0x22,
213 MLX5_OPCODE_RGET_PSV = 0x26,
214 MLX5_OPCODE_RCHECK_PSV = 0x27,
215
216 MLX5_OPCODE_UMR = 0x25,
217
218};
219
220enum {
221 MLX5_SET_PORT_RESET_QKEY = 0,
222 MLX5_SET_PORT_GUID0 = 16,
223 MLX5_SET_PORT_NODE_GUID = 17,
224 MLX5_SET_PORT_SYS_GUID = 18,
225 MLX5_SET_PORT_GID_TABLE = 19,
226 MLX5_SET_PORT_PKEY_TABLE = 20,
227};
228
229enum {
230 MLX5_MAX_PAGE_SHIFT = 31
231};
232
233struct mlx5_inbox_hdr {
234 __be16 opcode;
235 u8 rsvd[4];
236 __be16 opmod;
237};
238
239struct mlx5_outbox_hdr {
240 u8 status;
241 u8 rsvd[3];
242 __be32 syndrome;
243};
244
245struct mlx5_cmd_query_adapter_mbox_in {
246 struct mlx5_inbox_hdr hdr;
247 u8 rsvd[8];
248};
249
250struct mlx5_cmd_query_adapter_mbox_out {
251 struct mlx5_outbox_hdr hdr;
252 u8 rsvd0[24];
253 u8 intapin;
254 u8 rsvd1[13];
255 __be16 vsd_vendor_id;
256 u8 vsd[208];
257 u8 vsd_psid[16];
258};
259
260struct mlx5_hca_cap {
261 u8 rsvd1[16];
262 u8 log_max_srq_sz;
263 u8 log_max_qp_sz;
264 u8 rsvd2;
265 u8 log_max_qp;
266 u8 log_max_strq_sz;
267 u8 log_max_srqs;
268 u8 rsvd4[2];
269 u8 rsvd5;
270 u8 log_max_cq_sz;
271 u8 rsvd6;
272 u8 log_max_cq;
273 u8 log_max_eq_sz;
274 u8 log_max_mkey;
275 u8 rsvd7;
276 u8 log_max_eq;
277 u8 max_indirection;
278 u8 log_max_mrw_sz;
279 u8 log_max_bsf_list_sz;
280 u8 log_max_klm_list_sz;
281 u8 rsvd_8_0;
282 u8 log_max_ra_req_dc;
283 u8 rsvd_8_1;
284 u8 log_max_ra_res_dc;
285 u8 rsvd9;
286 u8 log_max_ra_req_qp;
287 u8 rsvd10;
288 u8 log_max_ra_res_qp;
289 u8 rsvd11[4];
290 __be16 max_qp_count;
291 __be16 rsvd12;
292 u8 rsvd13;
293 u8 local_ca_ack_delay;
294 u8 rsvd14;
295 u8 num_ports;
296 u8 log_max_msg;
297 u8 rsvd15[3];
298 __be16 stat_rate_support;
299 u8 rsvd16[2];
300 __be64 flags;
301 u8 rsvd17;
302 u8 uar_sz;
303 u8 rsvd18;
304 u8 log_pg_sz;
305 __be16 bf_log_bf_reg_size;
306 u8 rsvd19[4];
307 __be16 max_desc_sz_sq;
308 u8 rsvd20[2];
309 __be16 max_desc_sz_rq;
310 u8 rsvd21[2];
311 __be16 max_desc_sz_sq_dc;
312 u8 rsvd22[4];
313 __be16 max_qp_mcg;
314 u8 rsvd23;
315 u8 log_max_mcg;
316 u8 rsvd24;
317 u8 log_max_pd;
318 u8 rsvd25;
319 u8 log_max_xrcd;
320 u8 rsvd26[42];
321 __be16 log_uar_page_sz;
322 u8 rsvd27[28];
323 u8 log_msx_atomic_size_qp;
324 u8 rsvd28[2];
325 u8 log_msx_atomic_size_dc;
326 u8 rsvd29[76];
327};
328
329
330struct mlx5_cmd_query_hca_cap_mbox_in {
331 struct mlx5_inbox_hdr hdr;
332 u8 rsvd[8];
333};
334
335
336struct mlx5_cmd_query_hca_cap_mbox_out {
337 struct mlx5_outbox_hdr hdr;
338 u8 rsvd0[8];
339 struct mlx5_hca_cap hca_cap;
340};
341
342
343struct mlx5_cmd_set_hca_cap_mbox_in {
344 struct mlx5_inbox_hdr hdr;
345 u8 rsvd[8];
346 struct mlx5_hca_cap hca_cap;
347};
348
349
350struct mlx5_cmd_set_hca_cap_mbox_out {
351 struct mlx5_outbox_hdr hdr;
352 u8 rsvd0[8];
353};
354
355
356struct mlx5_cmd_init_hca_mbox_in {
357 struct mlx5_inbox_hdr hdr;
358 u8 rsvd0[2];
359 __be16 profile;
360 u8 rsvd1[4];
361};
362
363struct mlx5_cmd_init_hca_mbox_out {
364 struct mlx5_outbox_hdr hdr;
365 u8 rsvd[8];
366};
367
368struct mlx5_cmd_teardown_hca_mbox_in {
369 struct mlx5_inbox_hdr hdr;
370 u8 rsvd0[2];
371 __be16 profile;
372 u8 rsvd1[4];
373};
374
375struct mlx5_cmd_teardown_hca_mbox_out {
376 struct mlx5_outbox_hdr hdr;
377 u8 rsvd[8];
378};
379
380struct mlx5_cmd_layout {
381 u8 type;
382 u8 rsvd0[3];
383 __be32 inlen;
384 __be64 in_ptr;
385 __be32 in[4];
386 __be32 out[4];
387 __be64 out_ptr;
388 __be32 outlen;
389 u8 token;
390 u8 sig;
391 u8 rsvd1;
392 u8 status_own;
393};
394
395
396struct health_buffer {
397 __be32 assert_var[5];
398 __be32 rsvd0[3];
399 __be32 assert_exit_ptr;
400 __be32 assert_callra;
401 __be32 rsvd1[2];
402 __be32 fw_ver;
403 __be32 hw_id;
404 __be32 rsvd2;
405 u8 irisc_index;
406 u8 synd;
407 __be16 ext_sync;
408};
409
410struct mlx5_init_seg {
411 __be32 fw_rev;
412 __be32 cmdif_rev_fw_sub;
413 __be32 rsvd0[2];
414 __be32 cmdq_addr_h;
415 __be32 cmdq_addr_l_sz;
416 __be32 cmd_dbell;
417 __be32 rsvd1[121];
418 struct health_buffer health;
419 __be32 rsvd2[884];
420 __be32 health_counter;
421 __be32 rsvd3[1023];
422 __be64 ieee1588_clk;
423 __be32 ieee1588_clk_type;
424 __be32 clr_intx;
425};
426
427struct mlx5_eqe_comp {
428 __be32 reserved[6];
429 __be32 cqn;
430};
431
432struct mlx5_eqe_qp_srq {
433 __be32 reserved[6];
434 __be32 qp_srq_n;
435};
436
437struct mlx5_eqe_cq_err {
438 __be32 cqn;
439 u8 reserved1[7];
440 u8 syndrome;
441};
442
443struct mlx5_eqe_dropped_packet {
444};
445
446struct mlx5_eqe_port_state {
447 u8 reserved0[8];
448 u8 port;
449};
450
451struct mlx5_eqe_gpio {
452 __be32 reserved0[2];
453 __be64 gpio_event;
454};
455
456struct mlx5_eqe_congestion {
457 u8 type;
458 u8 rsvd0;
459 u8 congestion_level;
460};
461
462struct mlx5_eqe_stall_vl {
463 u8 rsvd0[3];
464 u8 port_vl;
465};
466
467struct mlx5_eqe_cmd {
468 __be32 vector;
469 __be32 rsvd[6];
470};
471
472struct mlx5_eqe_page_req {
473 u8 rsvd0[2];
474 __be16 func_id;
475 u8 rsvd1[2];
476 __be16 num_pages;
477 __be32 rsvd2[5];
478};
479
480union ev_data {
481 __be32 raw[7];
482 struct mlx5_eqe_cmd cmd;
483 struct mlx5_eqe_comp comp;
484 struct mlx5_eqe_qp_srq qp_srq;
485 struct mlx5_eqe_cq_err cq_err;
486 struct mlx5_eqe_dropped_packet dp;
487 struct mlx5_eqe_port_state port;
488 struct mlx5_eqe_gpio gpio;
489 struct mlx5_eqe_congestion cong;
490 struct mlx5_eqe_stall_vl stall_vl;
491 struct mlx5_eqe_page_req req_pages;
492} __packed;
493
494struct mlx5_eqe {
495 u8 rsvd0;
496 u8 type;
497 u8 rsvd1;
498 u8 sub_type;
499 __be32 rsvd2[7];
500 union ev_data data;
501 __be16 rsvd3;
502 u8 signature;
503 u8 owner;
504} __packed;
505
506struct mlx5_cmd_prot_block {
507 u8 data[MLX5_CMD_DATA_BLOCK_SIZE];
508 u8 rsvd0[48];
509 __be64 next;
510 __be32 block_num;
511 u8 rsvd1;
512 u8 token;
513 u8 ctrl_sig;
514 u8 sig;
515};
516
517struct mlx5_err_cqe {
518 u8 rsvd0[32];
519 __be32 srqn;
520 u8 rsvd1[18];
521 u8 vendor_err_synd;
522 u8 syndrome;
523 __be32 s_wqe_opcode_qpn;
524 __be16 wqe_counter;
525 u8 signature;
526 u8 op_own;
527};
528
529struct mlx5_cqe64 {
530 u8 rsvd0[17];
531 u8 ml_path;
532 u8 rsvd20[4];
533 __be16 slid;
534 __be32 flags_rqpn;
535 u8 rsvd28[4];
536 __be32 srqn;
537 __be32 imm_inval_pkey;
538 u8 rsvd40[4];
539 __be32 byte_cnt;
540 __be64 timestamp;
541 __be32 sop_drop_qpn;
542 __be16 wqe_counter;
543 u8 signature;
544 u8 op_own;
545};
546
547struct mlx5_wqe_srq_next_seg {
548 u8 rsvd0[2];
549 __be16 next_wqe_index;
550 u8 signature;
551 u8 rsvd1[11];
552};
553
554union mlx5_ext_cqe {
555 struct ib_grh grh;
556 u8 inl[64];
557};
558
559struct mlx5_cqe128 {
560 union mlx5_ext_cqe inl_grh;
561 struct mlx5_cqe64 cqe64;
562};
563
564struct mlx5_srq_ctx {
565 u8 state_log_sz;
566 u8 rsvd0[3];
567 __be32 flags_xrcd;
568 __be32 pgoff_cqn;
569 u8 rsvd1[4];
570 u8 log_pg_sz;
571 u8 rsvd2[7];
572 __be32 pd;
573 __be16 lwm;
574 __be16 wqe_cnt;
575 u8 rsvd3[8];
576 __be64 db_record;
577};
578
579struct mlx5_create_srq_mbox_in {
580 struct mlx5_inbox_hdr hdr;
581 __be32 input_srqn;
582 u8 rsvd0[4];
583 struct mlx5_srq_ctx ctx;
584 u8 rsvd1[208];
585 __be64 pas[0];
586};
587
588struct mlx5_create_srq_mbox_out {
589 struct mlx5_outbox_hdr hdr;
590 __be32 srqn;
591 u8 rsvd[4];
592};
593
594struct mlx5_destroy_srq_mbox_in {
595 struct mlx5_inbox_hdr hdr;
596 __be32 srqn;
597 u8 rsvd[4];
598};
599
600struct mlx5_destroy_srq_mbox_out {
601 struct mlx5_outbox_hdr hdr;
602 u8 rsvd[8];
603};
604
605struct mlx5_query_srq_mbox_in {
606 struct mlx5_inbox_hdr hdr;
607 __be32 srqn;
608 u8 rsvd0[4];
609};
610
611struct mlx5_query_srq_mbox_out {
612 struct mlx5_outbox_hdr hdr;
613 u8 rsvd0[8];
614 struct mlx5_srq_ctx ctx;
615 u8 rsvd1[32];
616 __be64 pas[0];
617};
618
619struct mlx5_arm_srq_mbox_in {
620 struct mlx5_inbox_hdr hdr;
621 __be32 srqn;
622 __be16 rsvd;
623 __be16 lwm;
624};
625
626struct mlx5_arm_srq_mbox_out {
627 struct mlx5_outbox_hdr hdr;
628 u8 rsvd[8];
629};
630
631struct mlx5_cq_context {
632 u8 status;
633 u8 cqe_sz_flags;
634 u8 st;
635 u8 rsvd3;
636 u8 rsvd4[6];
637 __be16 page_offset;
638 __be32 log_sz_usr_page;
639 __be16 cq_period;
640 __be16 cq_max_count;
641 __be16 rsvd20;
642 __be16 c_eqn;
643 u8 log_pg_sz;
644 u8 rsvd25[7];
645 __be32 last_notified_index;
646 __be32 solicit_producer_index;
647 __be32 consumer_counter;
648 __be32 producer_counter;
649 u8 rsvd48[8];
650 __be64 db_record_addr;
651};
652
653struct mlx5_create_cq_mbox_in {
654 struct mlx5_inbox_hdr hdr;
655 __be32 input_cqn;
656 u8 rsvdx[4];
657 struct mlx5_cq_context ctx;
658 u8 rsvd6[192];
659 __be64 pas[0];
660};
661
662struct mlx5_create_cq_mbox_out {
663 struct mlx5_outbox_hdr hdr;
664 __be32 cqn;
665 u8 rsvd0[4];
666};
667
668struct mlx5_destroy_cq_mbox_in {
669 struct mlx5_inbox_hdr hdr;
670 __be32 cqn;
671 u8 rsvd0[4];
672};
673
674struct mlx5_destroy_cq_mbox_out {
675 struct mlx5_outbox_hdr hdr;
676 u8 rsvd0[8];
677};
678
679struct mlx5_query_cq_mbox_in {
680 struct mlx5_inbox_hdr hdr;
681 __be32 cqn;
682 u8 rsvd0[4];
683};
684
685struct mlx5_query_cq_mbox_out {
686 struct mlx5_outbox_hdr hdr;
687 u8 rsvd0[8];
688 struct mlx5_cq_context ctx;
689 u8 rsvd6[16];
690 __be64 pas[0];
691};
692
693struct mlx5_enable_hca_mbox_in {
694 struct mlx5_inbox_hdr hdr;
695 u8 rsvd[8];
696};
697
698struct mlx5_enable_hca_mbox_out {
699 struct mlx5_outbox_hdr hdr;
700 u8 rsvd[8];
701};
702
703struct mlx5_disable_hca_mbox_in {
704 struct mlx5_inbox_hdr hdr;
705 u8 rsvd[8];
706};
707
708struct mlx5_disable_hca_mbox_out {
709 struct mlx5_outbox_hdr hdr;
710 u8 rsvd[8];
711};
712
713struct mlx5_eq_context {
714 u8 status;
715 u8 ec_oi;
716 u8 st;
717 u8 rsvd2[7];
718 __be16 page_pffset;
719 __be32 log_sz_usr_page;
720 u8 rsvd3[7];
721 u8 intr;
722 u8 log_page_size;
723 u8 rsvd4[15];
724 __be32 consumer_counter;
725 __be32 produser_counter;
726 u8 rsvd5[16];
727};
728
729struct mlx5_create_eq_mbox_in {
730 struct mlx5_inbox_hdr hdr;
731 u8 rsvd0[3];
732 u8 input_eqn;
733 u8 rsvd1[4];
734 struct mlx5_eq_context ctx;
735 u8 rsvd2[8];
736 __be64 events_mask;
737 u8 rsvd3[176];
738 __be64 pas[0];
739};
740
741struct mlx5_create_eq_mbox_out {
742 struct mlx5_outbox_hdr hdr;
743 u8 rsvd0[3];
744 u8 eq_number;
745 u8 rsvd1[4];
746};
747
748struct mlx5_destroy_eq_mbox_in {
749 struct mlx5_inbox_hdr hdr;
750 u8 rsvd0[3];
751 u8 eqn;
752 u8 rsvd1[4];
753};
754
755struct mlx5_destroy_eq_mbox_out {
756 struct mlx5_outbox_hdr hdr;
757 u8 rsvd[8];
758};
759
760struct mlx5_map_eq_mbox_in {
761 struct mlx5_inbox_hdr hdr;
762 __be64 mask;
763 u8 mu;
764 u8 rsvd0[2];
765 u8 eqn;
766 u8 rsvd1[24];
767};
768
769struct mlx5_map_eq_mbox_out {
770 struct mlx5_outbox_hdr hdr;
771 u8 rsvd[8];
772};
773
774struct mlx5_query_eq_mbox_in {
775 struct mlx5_inbox_hdr hdr;
776 u8 rsvd0[3];
777 u8 eqn;
778 u8 rsvd1[4];
779};
780
781struct mlx5_query_eq_mbox_out {
782 struct mlx5_outbox_hdr hdr;
783 u8 rsvd[8];
784 struct mlx5_eq_context ctx;
785};
786
787struct mlx5_mkey_seg {
788 /* This is a two bit field occupying bits 31-30.
789 * bit 31 is always 0,
790 * bit 30 is zero for regular MRs and 1 (e.g free) for UMRs that do not have tanslation
791 */
792 u8 status;
793 u8 pcie_control;
794 u8 flags;
795 u8 version;
796 __be32 qpn_mkey7_0;
797 u8 rsvd1[4];
798 __be32 flags_pd;
799 __be64 start_addr;
800 __be64 len;
801 __be32 bsfs_octo_size;
802 u8 rsvd2[16];
803 __be32 xlt_oct_size;
804 u8 rsvd3[3];
805 u8 log2_page_size;
806 u8 rsvd4[4];
807};
808
809struct mlx5_query_special_ctxs_mbox_in {
810 struct mlx5_inbox_hdr hdr;
811 u8 rsvd[8];
812};
813
814struct mlx5_query_special_ctxs_mbox_out {
815 struct mlx5_outbox_hdr hdr;
816 __be32 dump_fill_mkey;
817 __be32 reserved_lkey;
818};
819
820struct mlx5_create_mkey_mbox_in {
821 struct mlx5_inbox_hdr hdr;
822 __be32 input_mkey_index;
823 u8 rsvd0[4];
824 struct mlx5_mkey_seg seg;
825 u8 rsvd1[16];
826 __be32 xlat_oct_act_size;
827 __be32 bsf_coto_act_size;
828 u8 rsvd2[168];
829 __be64 pas[0];
830};
831
832struct mlx5_create_mkey_mbox_out {
833 struct mlx5_outbox_hdr hdr;
834 __be32 mkey;
835 u8 rsvd[4];
836};
837
838struct mlx5_destroy_mkey_mbox_in {
839 struct mlx5_inbox_hdr hdr;
840 __be32 mkey;
841 u8 rsvd[4];
842};
843
844struct mlx5_destroy_mkey_mbox_out {
845 struct mlx5_outbox_hdr hdr;
846 u8 rsvd[8];
847};
848
849struct mlx5_query_mkey_mbox_in {
850 struct mlx5_inbox_hdr hdr;
851 __be32 mkey;
852};
853
854struct mlx5_query_mkey_mbox_out {
855 struct mlx5_outbox_hdr hdr;
856 __be64 pas[0];
857};
858
859struct mlx5_modify_mkey_mbox_in {
860 struct mlx5_inbox_hdr hdr;
861 __be32 mkey;
862 __be64 pas[0];
863};
864
865struct mlx5_modify_mkey_mbox_out {
866 struct mlx5_outbox_hdr hdr;
867};
868
869struct mlx5_dump_mkey_mbox_in {
870 struct mlx5_inbox_hdr hdr;
871};
872
873struct mlx5_dump_mkey_mbox_out {
874 struct mlx5_outbox_hdr hdr;
875 __be32 mkey;
876};
877
878struct mlx5_mad_ifc_mbox_in {
879 struct mlx5_inbox_hdr hdr;
880 __be16 remote_lid;
881 u8 rsvd0;
882 u8 port;
883 u8 rsvd1[4];
884 u8 data[256];
885};
886
887struct mlx5_mad_ifc_mbox_out {
888 struct mlx5_outbox_hdr hdr;
889 u8 rsvd[8];
890 u8 data[256];
891};
892
893struct mlx5_access_reg_mbox_in {
894 struct mlx5_inbox_hdr hdr;
895 u8 rsvd0[2];
896 __be16 register_id;
897 __be32 arg;
898 __be32 data[0];
899};
900
901struct mlx5_access_reg_mbox_out {
902 struct mlx5_outbox_hdr hdr;
903 u8 rsvd[8];
904 __be32 data[0];
905};
906
907#define MLX5_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
908
909enum {
910 MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0
911};
912
913#endif /* MLX5_DEVICE_H */
diff --git a/include/linux/mlx5/doorbell.h b/include/linux/mlx5/doorbell.h
new file mode 100644
index 000000000000..163a818411e7
--- /dev/null
+++ b/include/linux/mlx5/doorbell.h
@@ -0,0 +1,79 @@
1/*
2 * Copyright (c) 2013, 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_DOORBELL_H
34#define MLX5_DOORBELL_H
35
36#define MLX5_BF_OFFSET 0x800
37#define MLX5_CQ_DOORBELL 0x20
38
39#if BITS_PER_LONG == 64
40/* Assume that we can just write a 64-bit doorbell atomically. s390
41 * actually doesn't have writeq() but S/390 systems don't even have
42 * PCI so we won't worry about it.
43 */
44
45#define MLX5_DECLARE_DOORBELL_LOCK(name)
46#define MLX5_INIT_DOORBELL_LOCK(ptr) do { } while (0)
47#define MLX5_GET_DOORBELL_LOCK(ptr) (NULL)
48
49static inline void mlx5_write64(__be32 val[2], void __iomem *dest,
50 spinlock_t *doorbell_lock)
51{
52 __raw_writeq(*(u64 *)val, dest);
53}
54
55#else
56
57/* Just fall back to a spinlock to protect the doorbell if
58 * BITS_PER_LONG is 32 -- there's no portable way to do atomic 64-bit
59 * MMIO writes.
60 */
61
62#define MLX5_DECLARE_DOORBELL_LOCK(name) spinlock_t name;
63#define MLX5_INIT_DOORBELL_LOCK(ptr) spin_lock_init(ptr)
64#define MLX5_GET_DOORBELL_LOCK(ptr) (ptr)
65
66static inline void mlx5_write64(__be32 val[2], void __iomem *dest,
67 spinlock_t *doorbell_lock)
68{
69 unsigned long flags;
70
71 spin_lock_irqsave(doorbell_lock, flags);
72 __raw_writel((__force u32) val[0], dest);
73 __raw_writel((__force u32) val[1], dest + 4);
74 spin_unlock_irqrestore(doorbell_lock, flags);
75}
76
77#endif
78
79#endif /* MLX5_DOORBELL_H */
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
new file mode 100644
index 000000000000..2aa258b0ced1
--- /dev/null
+++ b/include/linux/mlx5/driver.h
@@ -0,0 +1,771 @@
1/*
2 * Copyright (c) 2013, 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_DRIVER_H
34#define MLX5_DRIVER_H
35
36#include <linux/kernel.h>
37#include <linux/completion.h>
38#include <linux/pci.h>
39#include <linux/spinlock_types.h>
40#include <linux/semaphore.h>
41#include <linux/vmalloc.h>
42#include <linux/radix-tree.h>
43#include <linux/mlx5/device.h>
44#include <linux/mlx5/doorbell.h>
45
46enum {
47 MLX5_BOARD_ID_LEN = 64,
48 MLX5_MAX_NAME_LEN = 16,
49};
50
51enum {
52 /* one minute for the sake of bringup. Generally, commands must always
53 * complete and we may need to increase this timeout value
54 */
55 MLX5_CMD_TIMEOUT_MSEC = 7200 * 1000,
56 MLX5_CMD_WQ_MAX_NAME = 32,
57};
58
59enum {
60 CMD_OWNER_SW = 0x0,
61 CMD_OWNER_HW = 0x1,
62 CMD_STATUS_SUCCESS = 0,
63};
64
65enum mlx5_sqp_t {
66 MLX5_SQP_SMI = 0,
67 MLX5_SQP_GSI = 1,
68 MLX5_SQP_IEEE_1588 = 2,
69 MLX5_SQP_SNIFFER = 3,
70 MLX5_SQP_SYNC_UMR = 4,
71};
72
73enum {
74 MLX5_MAX_PORTS = 2,
75};
76
77enum {
78 MLX5_EQ_VEC_PAGES = 0,
79 MLX5_EQ_VEC_CMD = 1,
80 MLX5_EQ_VEC_ASYNC = 2,
81 MLX5_EQ_VEC_COMP_BASE,
82};
83
84enum {
85 MLX5_MAX_EQ_NAME = 20
86};
87
88enum {
89 MLX5_ATOMIC_MODE_IB_COMP = 1 << 16,
90 MLX5_ATOMIC_MODE_CX = 2 << 16,
91 MLX5_ATOMIC_MODE_8B = 3 << 16,
92 MLX5_ATOMIC_MODE_16B = 4 << 16,
93 MLX5_ATOMIC_MODE_32B = 5 << 16,
94 MLX5_ATOMIC_MODE_64B = 6 << 16,
95 MLX5_ATOMIC_MODE_128B = 7 << 16,
96 MLX5_ATOMIC_MODE_256B = 8 << 16,
97};
98
99enum {
100 MLX5_CMD_OP_QUERY_HCA_CAP = 0x100,
101 MLX5_CMD_OP_QUERY_ADAPTER = 0x101,
102 MLX5_CMD_OP_INIT_HCA = 0x102,
103 MLX5_CMD_OP_TEARDOWN_HCA = 0x103,
104 MLX5_CMD_OP_ENABLE_HCA = 0x104,
105 MLX5_CMD_OP_DISABLE_HCA = 0x105,
106 MLX5_CMD_OP_QUERY_PAGES = 0x107,
107 MLX5_CMD_OP_MANAGE_PAGES = 0x108,
108 MLX5_CMD_OP_SET_HCA_CAP = 0x109,
109
110 MLX5_CMD_OP_CREATE_MKEY = 0x200,
111 MLX5_CMD_OP_QUERY_MKEY = 0x201,
112 MLX5_CMD_OP_DESTROY_MKEY = 0x202,
113 MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS = 0x203,
114
115 MLX5_CMD_OP_CREATE_EQ = 0x301,
116 MLX5_CMD_OP_DESTROY_EQ = 0x302,
117 MLX5_CMD_OP_QUERY_EQ = 0x303,
118
119 MLX5_CMD_OP_CREATE_CQ = 0x400,
120 MLX5_CMD_OP_DESTROY_CQ = 0x401,
121 MLX5_CMD_OP_QUERY_CQ = 0x402,
122 MLX5_CMD_OP_MODIFY_CQ = 0x403,
123
124 MLX5_CMD_OP_CREATE_QP = 0x500,
125 MLX5_CMD_OP_DESTROY_QP = 0x501,
126 MLX5_CMD_OP_RST2INIT_QP = 0x502,
127 MLX5_CMD_OP_INIT2RTR_QP = 0x503,
128 MLX5_CMD_OP_RTR2RTS_QP = 0x504,
129 MLX5_CMD_OP_RTS2RTS_QP = 0x505,
130 MLX5_CMD_OP_SQERR2RTS_QP = 0x506,
131 MLX5_CMD_OP_2ERR_QP = 0x507,
132 MLX5_CMD_OP_RTS2SQD_QP = 0x508,
133 MLX5_CMD_OP_SQD2RTS_QP = 0x509,
134 MLX5_CMD_OP_2RST_QP = 0x50a,
135 MLX5_CMD_OP_QUERY_QP = 0x50b,
136 MLX5_CMD_OP_CONF_SQP = 0x50c,
137 MLX5_CMD_OP_MAD_IFC = 0x50d,
138 MLX5_CMD_OP_INIT2INIT_QP = 0x50e,
139 MLX5_CMD_OP_SUSPEND_QP = 0x50f,
140 MLX5_CMD_OP_UNSUSPEND_QP = 0x510,
141 MLX5_CMD_OP_SQD2SQD_QP = 0x511,
142 MLX5_CMD_OP_ALLOC_QP_COUNTER_SET = 0x512,
143 MLX5_CMD_OP_DEALLOC_QP_COUNTER_SET = 0x513,
144 MLX5_CMD_OP_QUERY_QP_COUNTER_SET = 0x514,
145
146 MLX5_CMD_OP_CREATE_PSV = 0x600,
147 MLX5_CMD_OP_DESTROY_PSV = 0x601,
148 MLX5_CMD_OP_QUERY_PSV = 0x602,
149 MLX5_CMD_OP_QUERY_SIG_RULE_TABLE = 0x603,
150 MLX5_CMD_OP_QUERY_BLOCK_SIZE_TABLE = 0x604,
151
152 MLX5_CMD_OP_CREATE_SRQ = 0x700,
153 MLX5_CMD_OP_DESTROY_SRQ = 0x701,
154 MLX5_CMD_OP_QUERY_SRQ = 0x702,
155 MLX5_CMD_OP_ARM_RQ = 0x703,
156 MLX5_CMD_OP_RESIZE_SRQ = 0x704,
157
158 MLX5_CMD_OP_ALLOC_PD = 0x800,
159 MLX5_CMD_OP_DEALLOC_PD = 0x801,
160 MLX5_CMD_OP_ALLOC_UAR = 0x802,
161 MLX5_CMD_OP_DEALLOC_UAR = 0x803,
162
163 MLX5_CMD_OP_ATTACH_TO_MCG = 0x806,
164 MLX5_CMD_OP_DETACH_FROM_MCG = 0x807,
165
166
167 MLX5_CMD_OP_ALLOC_XRCD = 0x80e,
168 MLX5_CMD_OP_DEALLOC_XRCD = 0x80f,
169
170 MLX5_CMD_OP_ACCESS_REG = 0x805,
171 MLX5_CMD_OP_MAX = 0x810,
172};
173
174enum {
175 MLX5_REG_PCAP = 0x5001,
176 MLX5_REG_PMTU = 0x5003,
177 MLX5_REG_PTYS = 0x5004,
178 MLX5_REG_PAOS = 0x5006,
179 MLX5_REG_PMAOS = 0x5012,
180 MLX5_REG_PUDE = 0x5009,
181 MLX5_REG_PMPE = 0x5010,
182 MLX5_REG_PELC = 0x500e,
183 MLX5_REG_PMLP = 0, /* TBD */
184 MLX5_REG_NODE_DESC = 0x6001,
185 MLX5_REG_HOST_ENDIANNESS = 0x7004,
186};
187
188enum dbg_rsc_type {
189 MLX5_DBG_RSC_QP,
190 MLX5_DBG_RSC_EQ,
191 MLX5_DBG_RSC_CQ,
192};
193
194struct mlx5_field_desc {
195 struct dentry *dent;
196 int i;
197};
198
199struct mlx5_rsc_debug {
200 struct mlx5_core_dev *dev;
201 void *object;
202 enum dbg_rsc_type type;
203 struct dentry *root;
204 struct mlx5_field_desc fields[0];
205};
206
207enum mlx5_dev_event {
208 MLX5_DEV_EVENT_SYS_ERROR,
209 MLX5_DEV_EVENT_PORT_UP,
210 MLX5_DEV_EVENT_PORT_DOWN,
211 MLX5_DEV_EVENT_PORT_INITIALIZED,
212 MLX5_DEV_EVENT_LID_CHANGE,
213 MLX5_DEV_EVENT_PKEY_CHANGE,
214 MLX5_DEV_EVENT_GUID_CHANGE,
215 MLX5_DEV_EVENT_CLIENT_REREG,
216};
217
218struct mlx5_uuar_info {
219 struct mlx5_uar *uars;
220 int num_uars;
221 int num_low_latency_uuars;
222 unsigned long *bitmap;
223 unsigned int *count;
224 struct mlx5_bf *bfs;
225
226 /*
227 * protect uuar allocation data structs
228 */
229 struct mutex lock;
230};
231
232struct mlx5_bf {
233 void __iomem *reg;
234 void __iomem *regreg;
235 int buf_size;
236 struct mlx5_uar *uar;
237 unsigned long offset;
238 int need_lock;
239 /* protect blue flame buffer selection when needed
240 */
241 spinlock_t lock;
242
243 /* serialize 64 bit writes when done as two 32 bit accesses
244 */
245 spinlock_t lock32;
246 int uuarn;
247};
248
249struct mlx5_cmd_first {
250 __be32 data[4];
251};
252
253struct mlx5_cmd_msg {
254 struct list_head list;
255 struct cache_ent *cache;
256 u32 len;
257 struct mlx5_cmd_first first;
258 struct mlx5_cmd_mailbox *next;
259};
260
261struct mlx5_cmd_debug {
262 struct dentry *dbg_root;
263 struct dentry *dbg_in;
264 struct dentry *dbg_out;
265 struct dentry *dbg_outlen;
266 struct dentry *dbg_status;
267 struct dentry *dbg_run;
268 void *in_msg;
269 void *out_msg;
270 u8 status;
271 u16 inlen;
272 u16 outlen;
273};
274
275struct cache_ent {
276 /* protect block chain allocations
277 */
278 spinlock_t lock;
279 struct list_head head;
280};
281
282struct cmd_msg_cache {
283 struct cache_ent large;
284 struct cache_ent med;
285
286};
287
288struct mlx5_cmd_stats {
289 u64 sum;
290 u64 n;
291 struct dentry *root;
292 struct dentry *avg;
293 struct dentry *count;
294 /* protect command average calculations */
295 spinlock_t lock;
296};
297
298struct mlx5_cmd {
299 void *cmd_buf;
300 dma_addr_t dma;
301 u16 cmdif_rev;
302 u8 log_sz;
303 u8 log_stride;
304 int max_reg_cmds;
305 int events;
306 u32 __iomem *vector;
307
308 /* protect command queue allocations
309 */
310 spinlock_t alloc_lock;
311
312 /* protect token allocations
313 */
314 spinlock_t token_lock;
315 u8 token;
316 unsigned long bitmask;
317 char wq_name[MLX5_CMD_WQ_MAX_NAME];
318 struct workqueue_struct *wq;
319 struct semaphore sem;
320 struct semaphore pages_sem;
321 int mode;
322 struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS];
323 struct pci_pool *pool;
324 struct mlx5_cmd_debug dbg;
325 struct cmd_msg_cache cache;
326 int checksum_disabled;
327 struct mlx5_cmd_stats stats[MLX5_CMD_OP_MAX];
328};
329
330struct mlx5_port_caps {
331 int gid_table_len;
332 int pkey_table_len;
333};
334
335struct mlx5_caps {
336 u8 log_max_eq;
337 u8 log_max_cq;
338 u8 log_max_qp;
339 u8 log_max_mkey;
340 u8 log_max_pd;
341 u8 log_max_srq;
342 u32 max_cqes;
343 int max_wqes;
344 int max_sq_desc_sz;
345 int max_rq_desc_sz;
346 u64 flags;
347 u16 stat_rate_support;
348 int log_max_msg;
349 int num_ports;
350 int max_ra_res_qp;
351 int max_ra_req_qp;
352 int max_srq_wqes;
353 int bf_reg_size;
354 int bf_regs_per_page;
355 struct mlx5_port_caps port[MLX5_MAX_PORTS];
356 u8 ext_port_cap[MLX5_MAX_PORTS];
357 int max_vf;
358 u32 reserved_lkey;
359 u8 local_ca_ack_delay;
360 u8 log_max_mcg;
361 u16 max_qp_mcg;
362 int min_page_sz;
363};
364
365struct mlx5_cmd_mailbox {
366 void *buf;
367 dma_addr_t dma;
368 struct mlx5_cmd_mailbox *next;
369};
370
371struct mlx5_buf_list {
372 void *buf;
373 dma_addr_t map;
374};
375
376struct mlx5_buf {
377 struct mlx5_buf_list direct;
378 struct mlx5_buf_list *page_list;
379 int nbufs;
380 int npages;
381 int page_shift;
382 int size;
383};
384
385struct mlx5_eq {
386 struct mlx5_core_dev *dev;
387 __be32 __iomem *doorbell;
388 u32 cons_index;
389 struct mlx5_buf buf;
390 int size;
391 u8 irqn;
392 u8 eqn;
393 int nent;
394 u64 mask;
395 char name[MLX5_MAX_EQ_NAME];
396 struct list_head list;
397 int index;
398 struct mlx5_rsc_debug *dbg;
399};
400
401
402struct mlx5_core_mr {
403 u64 iova;
404 u64 size;
405 u32 key;
406 u32 pd;
407 u32 access;
408};
409
410struct mlx5_core_srq {
411 u32 srqn;
412 int max;
413 int max_gs;
414 int max_avail_gather;
415 int wqe_shift;
416 void (*event) (struct mlx5_core_srq *, enum mlx5_event);
417
418 atomic_t refcount;
419 struct completion free;
420};
421
422struct mlx5_eq_table {
423 void __iomem *update_ci;
424 void __iomem *update_arm_ci;
425 struct list_head *comp_eq_head;
426 struct mlx5_eq pages_eq;
427 struct mlx5_eq async_eq;
428 struct mlx5_eq cmd_eq;
429 struct msix_entry *msix_arr;
430 int num_comp_vectors;
431 /* protect EQs list
432 */
433 spinlock_t lock;
434};
435
436struct mlx5_uar {
437 u32 index;
438 struct list_head bf_list;
439 unsigned free_bf_bmap;
440 void __iomem *wc_map;
441 void __iomem *map;
442};
443
444
445struct mlx5_core_health {
446 struct health_buffer __iomem *health;
447 __be32 __iomem *health_counter;
448 struct timer_list timer;
449 struct list_head list;
450 u32 prev;
451 int miss_counter;
452};
453
454struct mlx5_cq_table {
455 /* protect radix tree
456 */
457 spinlock_t lock;
458 struct radix_tree_root tree;
459};
460
461struct mlx5_qp_table {
462 /* protect radix tree
463 */
464 spinlock_t lock;
465 struct radix_tree_root tree;
466};
467
468struct mlx5_srq_table {
469 /* protect radix tree
470 */
471 spinlock_t lock;
472 struct radix_tree_root tree;
473};
474
475struct mlx5_priv {
476 char name[MLX5_MAX_NAME_LEN];
477 struct mlx5_eq_table eq_table;
478 struct mlx5_uuar_info uuari;
479 MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock);
480
481 /* pages stuff */
482 struct workqueue_struct *pg_wq;
483 struct rb_root page_root;
484 int fw_pages;
485 int reg_pages;
486
487 struct mlx5_core_health health;
488
489 struct mlx5_srq_table srq_table;
490
491 /* start: qp staff */
492 struct mlx5_qp_table qp_table;
493 struct dentry *qp_debugfs;
494 struct dentry *eq_debugfs;
495 struct dentry *cq_debugfs;
496 struct dentry *cmdif_debugfs;
497 /* end: qp staff */
498
499 /* start: cq staff */
500 struct mlx5_cq_table cq_table;
501 /* end: cq staff */
502
503 /* start: alloc staff */
504 struct mutex pgdir_mutex;
505 struct list_head pgdir_list;
506 /* end: alloc staff */
507 struct dentry *dbg_root;
508
509 /* protect mkey key part */
510 spinlock_t mkey_lock;
511 u8 mkey_key;
512};
513
514struct mlx5_core_dev {
515 struct pci_dev *pdev;
516 u8 rev_id;
517 char board_id[MLX5_BOARD_ID_LEN];
518 struct mlx5_cmd cmd;
519 struct mlx5_caps caps;
520 phys_addr_t iseg_base;
521 struct mlx5_init_seg __iomem *iseg;
522 void (*event) (struct mlx5_core_dev *dev,
523 enum mlx5_dev_event event,
524 void *data);
525 struct mlx5_priv priv;
526 struct mlx5_profile *profile;
527 atomic_t num_qps;
528};
529
530struct mlx5_db {
531 __be32 *db;
532 union {
533 struct mlx5_db_pgdir *pgdir;
534 struct mlx5_ib_user_db_page *user_page;
535 } u;
536 dma_addr_t dma;
537 int index;
538};
539
540enum {
541 MLX5_DB_PER_PAGE = PAGE_SIZE / L1_CACHE_BYTES,
542};
543
544enum {
545 MLX5_COMP_EQ_SIZE = 1024,
546};
547
548struct mlx5_db_pgdir {
549 struct list_head list;
550 DECLARE_BITMAP(bitmap, MLX5_DB_PER_PAGE);
551 __be32 *db_page;
552 dma_addr_t db_dma;
553};
554
555typedef void (*mlx5_cmd_cbk_t)(int status, void *context);
556
557struct mlx5_cmd_work_ent {
558 struct mlx5_cmd_msg *in;
559 struct mlx5_cmd_msg *out;
560 mlx5_cmd_cbk_t callback;
561 void *context;
562 int idx;
563 struct completion done;
564 struct mlx5_cmd *cmd;
565 struct work_struct work;
566 struct mlx5_cmd_layout *lay;
567 int ret;
568 int page_queue;
569 u8 status;
570 u8 token;
571 struct timespec ts1;
572 struct timespec ts2;
573};
574
575struct mlx5_pas {
576 u64 pa;
577 u8 log_sz;
578};
579
580static inline void *mlx5_buf_offset(struct mlx5_buf *buf, int offset)
581{
582 if (likely(BITS_PER_LONG == 64 || buf->nbufs == 1))
583 return buf->direct.buf + offset;
584 else
585 return buf->page_list[offset >> PAGE_SHIFT].buf +
586 (offset & (PAGE_SIZE - 1));
587}
588
589extern struct workqueue_struct *mlx5_core_wq;
590
591#define STRUCT_FIELD(header, field) \
592 .struct_offset_bytes = offsetof(struct ib_unpacked_ ## header, field), \
593 .struct_size_bytes = sizeof((struct ib_unpacked_ ## header *)0)->field
594
595struct ib_field {
596 size_t struct_offset_bytes;
597 size_t struct_size_bytes;
598 int offset_bits;
599 int size_bits;
600};
601
602static inline struct mlx5_core_dev *pci2mlx5_core_dev(struct pci_dev *pdev)
603{
604 return pci_get_drvdata(pdev);
605}
606
607extern struct dentry *mlx5_debugfs_root;
608
609static inline u16 fw_rev_maj(struct mlx5_core_dev *dev)
610{
611 return ioread32be(&dev->iseg->fw_rev) & 0xffff;
612}
613
614static inline u16 fw_rev_min(struct mlx5_core_dev *dev)
615{
616 return ioread32be(&dev->iseg->fw_rev) >> 16;
617}
618
619static inline u16 fw_rev_sub(struct mlx5_core_dev *dev)
620{
621 return ioread32be(&dev->iseg->cmdif_rev_fw_sub) & 0xffff;
622}
623
624static inline u16 cmdif_rev(struct mlx5_core_dev *dev)
625{
626 return ioread32be(&dev->iseg->cmdif_rev_fw_sub) >> 16;
627}
628
629static inline void *mlx5_vzalloc(unsigned long size)
630{
631 void *rtn;
632
633 rtn = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
634 if (!rtn)
635 rtn = vzalloc(size);
636 return rtn;
637}
638
639static inline void mlx5_vfree(const void *addr)
640{
641 if (addr && is_vmalloc_addr(addr))
642 vfree(addr);
643 else
644 kfree(addr);
645}
646
647int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev);
648void mlx5_dev_cleanup(struct mlx5_core_dev *dev);
649int mlx5_cmd_init(struct mlx5_core_dev *dev);
650void mlx5_cmd_cleanup(struct mlx5_core_dev *dev);
651void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
652void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);
653int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr);
654int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
655 int out_size);
656int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn);
657int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn);
658int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari);
659int mlx5_free_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari);
660void mlx5_health_cleanup(void);
661void __init mlx5_health_init(void);
662void mlx5_start_health_poll(struct mlx5_core_dev *dev);
663void mlx5_stop_health_poll(struct mlx5_core_dev *dev);
664int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct,
665 struct mlx5_buf *buf);
666void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf);
667struct mlx5_cmd_mailbox *mlx5_alloc_cmd_mailbox_chain(struct mlx5_core_dev *dev,
668 gfp_t flags, int npages);
669void mlx5_free_cmd_mailbox_chain(struct mlx5_core_dev *dev,
670 struct mlx5_cmd_mailbox *head);
671int mlx5_core_create_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
672 struct mlx5_create_srq_mbox_in *in, int inlen);
673int mlx5_core_destroy_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq);
674int mlx5_core_query_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
675 struct mlx5_query_srq_mbox_out *out);
676int mlx5_core_arm_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
677 u16 lwm, int is_srq);
678int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
679 struct mlx5_create_mkey_mbox_in *in, int inlen);
680int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr);
681int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
682 struct mlx5_query_mkey_mbox_out *out, int outlen);
683int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
684 u32 *mkey);
685int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn);
686int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn);
687int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb,
688 u16 opmod, int port);
689void mlx5_pagealloc_init(struct mlx5_core_dev *dev);
690void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev);
691int mlx5_pagealloc_start(struct mlx5_core_dev *dev);
692void mlx5_pagealloc_stop(struct mlx5_core_dev *dev);
693void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id,
694 s16 npages);
695int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot);
696int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev);
697void mlx5_register_debugfs(void);
698void mlx5_unregister_debugfs(void);
699int mlx5_eq_init(struct mlx5_core_dev *dev);
700void mlx5_eq_cleanup(struct mlx5_core_dev *dev);
701void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas);
702void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn);
703void mlx5_qp_event(struct mlx5_core_dev *dev, u32 qpn, int event_type);
704void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type);
705struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn);
706void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector);
707void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type);
708int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
709 int nent, u64 mask, const char *name, struct mlx5_uar *uar);
710int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
711int mlx5_start_eqs(struct mlx5_core_dev *dev);
712int mlx5_stop_eqs(struct mlx5_core_dev *dev);
713int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
714int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
715
716int mlx5_qp_debugfs_init(struct mlx5_core_dev *dev);
717void mlx5_qp_debugfs_cleanup(struct mlx5_core_dev *dev);
718int mlx5_core_access_reg(struct mlx5_core_dev *dev, void *data_in,
719 int size_in, void *data_out, int size_out,
720 u16 reg_num, int arg, int write);
721int mlx5_set_port_caps(struct mlx5_core_dev *dev, int port_num, u32 caps);
722
723int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
724void mlx5_debug_eq_remove(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
725int mlx5_core_eq_query(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
726 struct mlx5_query_eq_mbox_out *out, int outlen);
727int mlx5_eq_debugfs_init(struct mlx5_core_dev *dev);
728void mlx5_eq_debugfs_cleanup(struct mlx5_core_dev *dev);
729int mlx5_cq_debugfs_init(struct mlx5_core_dev *dev);
730void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev);
731int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db);
732void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db);
733
734typedef void (*health_handler_t)(struct pci_dev *pdev, struct health_buffer __iomem *buf, int size);
735int mlx5_register_health_report_handler(health_handler_t handler);
736void mlx5_unregister_health_report_handler(void);
737const char *mlx5_command_str(int command);
738int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev);
739void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);
740
741static inline u32 mlx5_mkey_to_idx(u32 mkey)
742{
743 return mkey >> 8;
744}
745
746static inline u32 mlx5_idx_to_mkey(u32 mkey_idx)
747{
748 return mkey_idx << 8;
749}
750
751enum {
752 MLX5_PROF_MASK_QP_SIZE = (u64)1 << 0,
753 MLX5_PROF_MASK_CMDIF_CSUM = (u64)1 << 1,
754 MLX5_PROF_MASK_MR_CACHE = (u64)1 << 2,
755};
756
757enum {
758 MAX_MR_CACHE_ENTRIES = 16,
759};
760
761struct mlx5_profile {
762 u64 mask;
763 u32 log_max_qp;
764 int cmdif_csum;
765 struct {
766 int size;
767 int limit;
768 } mr_cache[MAX_MR_CACHE_ENTRIES];
769};
770
771#endif /* MLX5_DRIVER_H */
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
new file mode 100644
index 000000000000..d9e3eacb3a7f
--- /dev/null
+++ b/include/linux/mlx5/qp.h
@@ -0,0 +1,467 @@
1/*
2 * Copyright (c) 2013, 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_QP_H
34#define MLX5_QP_H
35
36#include <linux/mlx5/device.h>
37#include <linux/mlx5/driver.h>
38
39#define MLX5_INVALID_LKEY 0x100
40
41enum mlx5_qp_optpar {
42 MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0,
43 MLX5_QP_OPTPAR_RRE = 1 << 1,
44 MLX5_QP_OPTPAR_RAE = 1 << 2,
45 MLX5_QP_OPTPAR_RWE = 1 << 3,
46 MLX5_QP_OPTPAR_PKEY_INDEX = 1 << 4,
47 MLX5_QP_OPTPAR_Q_KEY = 1 << 5,
48 MLX5_QP_OPTPAR_RNR_TIMEOUT = 1 << 6,
49 MLX5_QP_OPTPAR_PRIMARY_ADDR_PATH = 1 << 7,
50 MLX5_QP_OPTPAR_SRA_MAX = 1 << 8,
51 MLX5_QP_OPTPAR_RRA_MAX = 1 << 9,
52 MLX5_QP_OPTPAR_PM_STATE = 1 << 10,
53 MLX5_QP_OPTPAR_RETRY_COUNT = 1 << 12,
54 MLX5_QP_OPTPAR_RNR_RETRY = 1 << 13,
55 MLX5_QP_OPTPAR_ACK_TIMEOUT = 1 << 14,
56 MLX5_QP_OPTPAR_PRI_PORT = 1 << 16,
57 MLX5_QP_OPTPAR_SRQN = 1 << 18,
58 MLX5_QP_OPTPAR_CQN_RCV = 1 << 19,
59 MLX5_QP_OPTPAR_DC_HS = 1 << 20,
60 MLX5_QP_OPTPAR_DC_KEY = 1 << 21,
61};
62
63enum mlx5_qp_state {
64 MLX5_QP_STATE_RST = 0,
65 MLX5_QP_STATE_INIT = 1,
66 MLX5_QP_STATE_RTR = 2,
67 MLX5_QP_STATE_RTS = 3,
68 MLX5_QP_STATE_SQER = 4,
69 MLX5_QP_STATE_SQD = 5,
70 MLX5_QP_STATE_ERR = 6,
71 MLX5_QP_STATE_SQ_DRAINING = 7,
72 MLX5_QP_STATE_SUSPENDED = 9,
73 MLX5_QP_NUM_STATE
74};
75
76enum {
77 MLX5_QP_ST_RC = 0x0,
78 MLX5_QP_ST_UC = 0x1,
79 MLX5_QP_ST_UD = 0x2,
80 MLX5_QP_ST_XRC = 0x3,
81 MLX5_QP_ST_MLX = 0x4,
82 MLX5_QP_ST_DCI = 0x5,
83 MLX5_QP_ST_DCT = 0x6,
84 MLX5_QP_ST_QP0 = 0x7,
85 MLX5_QP_ST_QP1 = 0x8,
86 MLX5_QP_ST_RAW_ETHERTYPE = 0x9,
87 MLX5_QP_ST_RAW_IPV6 = 0xa,
88 MLX5_QP_ST_SNIFFER = 0xb,
89 MLX5_QP_ST_SYNC_UMR = 0xe,
90 MLX5_QP_ST_PTP_1588 = 0xd,
91 MLX5_QP_ST_REG_UMR = 0xc,
92 MLX5_QP_ST_MAX
93};
94
95enum {
96 MLX5_QP_PM_MIGRATED = 0x3,
97 MLX5_QP_PM_ARMED = 0x0,
98 MLX5_QP_PM_REARM = 0x1
99};
100
101enum {
102 MLX5_NON_ZERO_RQ = 0 << 24,
103 MLX5_SRQ_RQ = 1 << 24,
104 MLX5_CRQ_RQ = 2 << 24,
105 MLX5_ZERO_LEN_RQ = 3 << 24
106};
107
108enum {
109 /* params1 */
110 MLX5_QP_BIT_SRE = 1 << 15,
111 MLX5_QP_BIT_SWE = 1 << 14,
112 MLX5_QP_BIT_SAE = 1 << 13,
113 /* params2 */
114 MLX5_QP_BIT_RRE = 1 << 15,
115 MLX5_QP_BIT_RWE = 1 << 14,
116 MLX5_QP_BIT_RAE = 1 << 13,
117 MLX5_QP_BIT_RIC = 1 << 4,
118};
119
120enum {
121 MLX5_WQE_CTRL_CQ_UPDATE = 2 << 2,
122 MLX5_WQE_CTRL_SOLICITED = 1 << 1,
123};
124
125enum {
126 MLX5_SEND_WQE_BB = 64,
127};
128
129enum {
130 MLX5_WQE_FMR_PERM_LOCAL_READ = 1 << 27,
131 MLX5_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28,
132 MLX5_WQE_FMR_PERM_REMOTE_READ = 1 << 29,
133 MLX5_WQE_FMR_PERM_REMOTE_WRITE = 1 << 30,
134 MLX5_WQE_FMR_PERM_ATOMIC = 1 << 31
135};
136
137enum {
138 MLX5_FENCE_MODE_NONE = 0 << 5,
139 MLX5_FENCE_MODE_INITIATOR_SMALL = 1 << 5,
140 MLX5_FENCE_MODE_STRONG_ORDERING = 3 << 5,
141 MLX5_FENCE_MODE_SMALL_AND_FENCE = 4 << 5,
142};
143
144enum {
145 MLX5_QP_LAT_SENSITIVE = 1 << 28,
146 MLX5_QP_ENABLE_SIG = 1 << 31,
147};
148
149enum {
150 MLX5_RCV_DBR = 0,
151 MLX5_SND_DBR = 1,
152};
153
154struct mlx5_wqe_fmr_seg {
155 __be32 flags;
156 __be32 mem_key;
157 __be64 buf_list;
158 __be64 start_addr;
159 __be64 reg_len;
160 __be32 offset;
161 __be32 page_size;
162 u32 reserved[2];
163};
164
165struct mlx5_wqe_ctrl_seg {
166 __be32 opmod_idx_opcode;
167 __be32 qpn_ds;
168 u8 signature;
169 u8 rsvd[2];
170 u8 fm_ce_se;
171 __be32 imm;
172};
173
174struct mlx5_wqe_xrc_seg {
175 __be32 xrc_srqn;
176 u8 rsvd[12];
177};
178
179struct mlx5_wqe_masked_atomic_seg {
180 __be64 swap_add;
181 __be64 compare;
182 __be64 swap_add_mask;
183 __be64 compare_mask;
184};
185
186struct mlx5_av {
187 union {
188 struct {
189 __be32 qkey;
190 __be32 reserved;
191 } qkey;
192 __be64 dc_key;
193 } key;
194 __be32 dqp_dct;
195 u8 stat_rate_sl;
196 u8 fl_mlid;
197 __be16 rlid;
198 u8 reserved0[10];
199 u8 tclass;
200 u8 hop_limit;
201 __be32 grh_gid_fl;
202 u8 rgid[16];
203};
204
205struct mlx5_wqe_datagram_seg {
206 struct mlx5_av av;
207};
208
209struct mlx5_wqe_raddr_seg {
210 __be64 raddr;
211 __be32 rkey;
212 u32 reserved;
213};
214
215struct mlx5_wqe_atomic_seg {
216 __be64 swap_add;
217 __be64 compare;
218};
219
220struct mlx5_wqe_data_seg {
221 __be32 byte_count;
222 __be32 lkey;
223 __be64 addr;
224};
225
226struct mlx5_wqe_umr_ctrl_seg {
227 u8 flags;
228 u8 rsvd0[3];
229 __be16 klm_octowords;
230 __be16 bsf_octowords;
231 __be64 mkey_mask;
232 u8 rsvd1[32];
233};
234
235struct mlx5_seg_set_psv {
236 __be32 psv_num;
237 __be16 syndrome;
238 __be16 status;
239 __be32 transient_sig;
240 __be32 ref_tag;
241};
242
243struct mlx5_seg_get_psv {
244 u8 rsvd[19];
245 u8 num_psv;
246 __be32 l_key;
247 __be64 va;
248 __be32 psv_index[4];
249};
250
251struct mlx5_seg_check_psv {
252 u8 rsvd0[2];
253 __be16 err_coalescing_op;
254 u8 rsvd1[2];
255 __be16 xport_err_op;
256 u8 rsvd2[2];
257 __be16 xport_err_mask;
258 u8 rsvd3[7];
259 u8 num_psv;
260 __be32 l_key;
261 __be64 va;
262 __be32 psv_index[4];
263};
264
265struct mlx5_rwqe_sig {
266 u8 rsvd0[4];
267 u8 signature;
268 u8 rsvd1[11];
269};
270
271struct mlx5_wqe_signature_seg {
272 u8 rsvd0[4];
273 u8 signature;
274 u8 rsvd1[11];
275};
276
277struct mlx5_wqe_inline_seg {
278 __be32 byte_count;
279};
280
281struct mlx5_core_qp {
282 void (*event) (struct mlx5_core_qp *, int);
283 int qpn;
284 atomic_t refcount;
285 struct completion free;
286 struct mlx5_rsc_debug *dbg;
287 int pid;
288};
289
290struct mlx5_qp_path {
291 u8 fl;
292 u8 rsvd3;
293 u8 free_ar;
294 u8 pkey_index;
295 u8 rsvd0;
296 u8 grh_mlid;
297 __be16 rlid;
298 u8 ackto_lt;
299 u8 mgid_index;
300 u8 static_rate;
301 u8 hop_limit;
302 __be32 tclass_flowlabel;
303 u8 rgid[16];
304 u8 rsvd1[4];
305 u8 sl;
306 u8 port;
307 u8 rsvd2[6];
308};
309
310struct mlx5_qp_context {
311 __be32 flags;
312 __be32 flags_pd;
313 u8 mtu_msgmax;
314 u8 rq_size_stride;
315 __be16 sq_crq_size;
316 __be32 qp_counter_set_usr_page;
317 __be32 wire_qpn;
318 __be32 log_pg_sz_remote_qpn;
319 struct mlx5_qp_path pri_path;
320 struct mlx5_qp_path alt_path;
321 __be32 params1;
322 u8 reserved2[4];
323 __be32 next_send_psn;
324 __be32 cqn_send;
325 u8 reserved3[8];
326 __be32 last_acked_psn;
327 __be32 ssn;
328 __be32 params2;
329 __be32 rnr_nextrecvpsn;
330 __be32 xrcd;
331 __be32 cqn_recv;
332 __be64 db_rec_addr;
333 __be32 qkey;
334 __be32 rq_type_srqn;
335 __be32 rmsn;
336 __be16 hw_sq_wqe_counter;
337 __be16 sw_sq_wqe_counter;
338 __be16 hw_rcyclic_byte_counter;
339 __be16 hw_rq_counter;
340 __be16 sw_rcyclic_byte_counter;
341 __be16 sw_rq_counter;
342 u8 rsvd0[5];
343 u8 cgs;
344 u8 cs_req;
345 u8 cs_res;
346 __be64 dc_access_key;
347 u8 rsvd1[24];
348};
349
350struct mlx5_create_qp_mbox_in {
351 struct mlx5_inbox_hdr hdr;
352 __be32 input_qpn;
353 u8 rsvd0[4];
354 __be32 opt_param_mask;
355 u8 rsvd1[4];
356 struct mlx5_qp_context ctx;
357 u8 rsvd3[16];
358 __be64 pas[0];
359};
360
361struct mlx5_create_qp_mbox_out {
362 struct mlx5_outbox_hdr hdr;
363 __be32 qpn;
364 u8 rsvd0[4];
365};
366
367struct mlx5_destroy_qp_mbox_in {
368 struct mlx5_inbox_hdr hdr;
369 __be32 qpn;
370 u8 rsvd0[4];
371};
372
373struct mlx5_destroy_qp_mbox_out {
374 struct mlx5_outbox_hdr hdr;
375 u8 rsvd0[8];
376};
377
378struct mlx5_modify_qp_mbox_in {
379 struct mlx5_inbox_hdr hdr;
380 __be32 qpn;
381 u8 rsvd1[4];
382 __be32 optparam;
383 u8 rsvd0[4];
384 struct mlx5_qp_context ctx;
385};
386
387struct mlx5_modify_qp_mbox_out {
388 struct mlx5_outbox_hdr hdr;
389 u8 rsvd0[8];
390};
391
392struct mlx5_query_qp_mbox_in {
393 struct mlx5_inbox_hdr hdr;
394 __be32 qpn;
395 u8 rsvd[4];
396};
397
398struct mlx5_query_qp_mbox_out {
399 struct mlx5_outbox_hdr hdr;
400 u8 rsvd1[8];
401 __be32 optparam;
402 u8 rsvd0[4];
403 struct mlx5_qp_context ctx;
404 u8 rsvd2[16];
405 __be64 pas[0];
406};
407
408struct mlx5_conf_sqp_mbox_in {
409 struct mlx5_inbox_hdr hdr;
410 __be32 qpn;
411 u8 rsvd[3];
412 u8 type;
413};
414
415struct mlx5_conf_sqp_mbox_out {
416 struct mlx5_outbox_hdr hdr;
417 u8 rsvd[8];
418};
419
420struct mlx5_alloc_xrcd_mbox_in {
421 struct mlx5_inbox_hdr hdr;
422 u8 rsvd[8];
423};
424
425struct mlx5_alloc_xrcd_mbox_out {
426 struct mlx5_outbox_hdr hdr;
427 __be32 xrcdn;
428 u8 rsvd[4];
429};
430
431struct mlx5_dealloc_xrcd_mbox_in {
432 struct mlx5_inbox_hdr hdr;
433 __be32 xrcdn;
434 u8 rsvd[4];
435};
436
437struct mlx5_dealloc_xrcd_mbox_out {
438 struct mlx5_outbox_hdr hdr;
439 u8 rsvd[8];
440};
441
442static inline struct mlx5_core_qp *__mlx5_qp_lookup(struct mlx5_core_dev *dev, u32 qpn)
443{
444 return radix_tree_lookup(&dev->priv.qp_table.tree, qpn);
445}
446
447int mlx5_core_create_qp(struct mlx5_core_dev *dev,
448 struct mlx5_core_qp *qp,
449 struct mlx5_create_qp_mbox_in *in,
450 int inlen);
451int mlx5_core_qp_modify(struct mlx5_core_dev *dev, enum mlx5_qp_state cur_state,
452 enum mlx5_qp_state new_state,
453 struct mlx5_modify_qp_mbox_in *in, int sqd_event,
454 struct mlx5_core_qp *qp);
455int mlx5_core_destroy_qp(struct mlx5_core_dev *dev,
456 struct mlx5_core_qp *qp);
457int mlx5_core_qp_query(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp,
458 struct mlx5_query_qp_mbox_out *out, int outlen);
459
460int mlx5_core_xrcd_alloc(struct mlx5_core_dev *dev, u32 *xrcdn);
461int mlx5_core_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn);
462void mlx5_init_qp_table(struct mlx5_core_dev *dev);
463void mlx5_cleanup_qp_table(struct mlx5_core_dev *dev);
464int mlx5_debug_qp_add(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp);
465void mlx5_debug_qp_remove(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp);
466
467#endif /* MLX5_QP_H */
diff --git a/include/linux/mlx5/srq.h b/include/linux/mlx5/srq.h
new file mode 100644
index 000000000000..e1a363a33663
--- /dev/null
+++ b/include/linux/mlx5/srq.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright (c) 2013, 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_SRQ_H
34#define MLX5_SRQ_H
35
36#include <linux/mlx5/driver.h>
37
38void mlx5_init_srq_table(struct mlx5_core_dev *dev);
39void mlx5_cleanup_srq_table(struct mlx5_core_dev *dev);
40
41#endif /* MLX5_SRQ_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e0c8528a41a4..f0224608d15e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -25,11 +25,17 @@ struct file_ra_state;
25struct user_struct; 25struct user_struct;
26struct writeback_control; 26struct writeback_control;
27 27
28#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */ 28#ifndef CONFIG_NEED_MULTIPLE_NODES /* Don't use mapnrs, do it properly */
29extern unsigned long max_mapnr; 29extern unsigned long max_mapnr;
30
31static inline void set_max_mapnr(unsigned long limit)
32{
33 max_mapnr = limit;
34}
35#else
36static inline void set_max_mapnr(unsigned long limit) { }
30#endif 37#endif
31 38
32extern unsigned long num_physpages;
33extern unsigned long totalram_pages; 39extern unsigned long totalram_pages;
34extern void * high_memory; 40extern void * high_memory;
35extern int page_cluster; 41extern int page_cluster;
@@ -52,6 +58,9 @@ extern unsigned long sysctl_admin_reserve_kbytes;
52/* to align the pointer to the (next) page boundary */ 58/* to align the pointer to the (next) page boundary */
53#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) 59#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
54 60
61/* test whether an address (unsigned long or pointer) is aligned to PAGE_SIZE */
62#define PAGE_ALIGNED(addr) IS_ALIGNED((unsigned long)addr, PAGE_SIZE)
63
55/* 64/*
56 * Linux kernel virtual memory manager primitives. 65 * Linux kernel virtual memory manager primitives.
57 * The idea being to have a "virtual" mm in the same way 66 * The idea being to have a "virtual" mm in the same way
@@ -142,12 +151,6 @@ extern unsigned int kobjsize(const void *objp);
142#define VM_STACK_FLAGS (VM_GROWSDOWN | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT) 151#define VM_STACK_FLAGS (VM_GROWSDOWN | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT)
143#endif 152#endif
144 153
145#define VM_READHINTMASK (VM_SEQ_READ | VM_RAND_READ)
146#define VM_ClearReadHint(v) (v)->vm_flags &= ~VM_READHINTMASK
147#define VM_NormalReadHint(v) (!((v)->vm_flags & VM_READHINTMASK))
148#define VM_SequentialReadHint(v) ((v)->vm_flags & VM_SEQ_READ)
149#define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ)
150
151/* 154/*
152 * Special vmas that are non-mergable, non-mlock()able. 155 * Special vmas that are non-mergable, non-mlock()able.
153 * Note: mm/huge_memory.c VM_NO_THP depends on this definition. 156 * Note: mm/huge_memory.c VM_NO_THP depends on this definition.
@@ -1041,7 +1044,8 @@ int get_kernel_page(unsigned long start, int write, struct page **pages);
1041struct page *get_dump_page(unsigned long addr); 1044struct page *get_dump_page(unsigned long addr);
1042 1045
1043extern int try_to_release_page(struct page * page, gfp_t gfp_mask); 1046extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
1044extern void do_invalidatepage(struct page *page, unsigned long offset); 1047extern void do_invalidatepage(struct page *page, unsigned int offset,
1048 unsigned int length);
1045 1049
1046int __set_page_dirty_nobuffers(struct page *page); 1050int __set_page_dirty_nobuffers(struct page *page);
1047int __set_page_dirty_no_writeback(struct page *page); 1051int __set_page_dirty_no_writeback(struct page *page);
@@ -1304,11 +1308,12 @@ extern void free_initmem(void);
1304/* 1308/*
1305 * Free reserved pages within range [PAGE_ALIGN(start), end & PAGE_MASK) 1309 * Free reserved pages within range [PAGE_ALIGN(start), end & PAGE_MASK)
1306 * into the buddy system. The freed pages will be poisoned with pattern 1310 * into the buddy system. The freed pages will be poisoned with pattern
1307 * "poison" if it's non-zero. 1311 * "poison" if it's within range [0, UCHAR_MAX].
1308 * Return pages freed into the buddy system. 1312 * Return pages freed into the buddy system.
1309 */ 1313 */
1310extern unsigned long free_reserved_area(unsigned long start, unsigned long end, 1314extern unsigned long free_reserved_area(void *start, void *end,
1311 int poison, char *s); 1315 int poison, char *s);
1316
1312#ifdef CONFIG_HIGHMEM 1317#ifdef CONFIG_HIGHMEM
1313/* 1318/*
1314 * Free a highmem page into the buddy system, adjusting totalhigh_pages 1319 * Free a highmem page into the buddy system, adjusting totalhigh_pages
@@ -1317,10 +1322,8 @@ extern unsigned long free_reserved_area(unsigned long start, unsigned long end,
1317extern void free_highmem_page(struct page *page); 1322extern void free_highmem_page(struct page *page);
1318#endif 1323#endif
1319 1324
1320static inline void adjust_managed_page_count(struct page *page, long count) 1325extern void adjust_managed_page_count(struct page *page, long count);
1321{ 1326extern void mem_init_print_info(const char *str);
1322 totalram_pages += count;
1323}
1324 1327
1325/* Free the reserved page into the buddy system, so it gets managed. */ 1328/* Free the reserved page into the buddy system, so it gets managed. */
1326static inline void __free_reserved_page(struct page *page) 1329static inline void __free_reserved_page(struct page *page)
@@ -1344,18 +1347,29 @@ static inline void mark_page_reserved(struct page *page)
1344 1347
1345/* 1348/*
1346 * Default method to free all the __init memory into the buddy system. 1349 * Default method to free all the __init memory into the buddy system.
1347 * The freed pages will be poisoned with pattern "poison" if it is 1350 * The freed pages will be poisoned with pattern "poison" if it's within
1348 * non-zero. Return pages freed into the buddy system. 1351 * range [0, UCHAR_MAX].
1352 * Return pages freed into the buddy system.
1349 */ 1353 */
1350static inline unsigned long free_initmem_default(int poison) 1354static inline unsigned long free_initmem_default(int poison)
1351{ 1355{
1352 extern char __init_begin[], __init_end[]; 1356 extern char __init_begin[], __init_end[];
1353 1357
1354 return free_reserved_area(PAGE_ALIGN((unsigned long)&__init_begin) , 1358 return free_reserved_area(&__init_begin, &__init_end,
1355 ((unsigned long)&__init_end) & PAGE_MASK,
1356 poison, "unused kernel"); 1359 poison, "unused kernel");
1357} 1360}
1358 1361
1362static inline unsigned long get_num_physpages(void)
1363{
1364 int nid;
1365 unsigned long phys_pages = 0;
1366
1367 for_each_online_node(nid)
1368 phys_pages += node_present_pages(nid);
1369
1370 return phys_pages;
1371}
1372
1359#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 1373#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
1360/* 1374/*
1361 * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its 1375 * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index ace9a5f01c64..fb425aa16c01 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -330,12 +330,9 @@ struct mm_struct {
330 unsigned long (*get_unmapped_area) (struct file *filp, 330 unsigned long (*get_unmapped_area) (struct file *filp,
331 unsigned long addr, unsigned long len, 331 unsigned long addr, unsigned long len,
332 unsigned long pgoff, unsigned long flags); 332 unsigned long pgoff, unsigned long flags);
333 void (*unmap_area) (struct mm_struct *mm, unsigned long addr);
334#endif 333#endif
335 unsigned long mmap_base; /* base of mmap area */ 334 unsigned long mmap_base; /* base of mmap area */
336 unsigned long task_size; /* size of task vm space */ 335 unsigned long task_size; /* size of task vm space */
337 unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */
338 unsigned long free_area_cache; /* first hole of size cached_hole_size or larger */
339 unsigned long highest_vm_end; /* highest vma end address */ 336 unsigned long highest_vm_end; /* highest vma end address */
340 pgd_t * pgd; 337 pgd_t * pgd;
341 atomic_t mm_users; /* How many users with user space? */ 338 atomic_t mm_users; /* How many users with user space? */
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 9aa863da287f..92dc257251e4 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -11,11 +11,17 @@ extern int sysctl_overcommit_memory;
11extern int sysctl_overcommit_ratio; 11extern int sysctl_overcommit_ratio;
12extern struct percpu_counter vm_committed_as; 12extern struct percpu_counter vm_committed_as;
13 13
14#ifdef CONFIG_SMP
15extern s32 vm_committed_as_batch;
16#else
17#define vm_committed_as_batch 0
18#endif
19
14unsigned long vm_memory_committed(void); 20unsigned long vm_memory_committed(void);
15 21
16static inline void vm_acct_memory(long pages) 22static inline void vm_acct_memory(long pages)
17{ 23{
18 percpu_counter_add(&vm_committed_as, pages); 24 __percpu_counter_add(&vm_committed_as, pages, vm_committed_as_batch);
19} 25}
20 26
21static inline void vm_unacct_memory(long pages) 27static inline void vm_unacct_memory(long pages)
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index f31725ba49f3..842de3e21e70 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -94,7 +94,11 @@ struct mmc_ext_csd {
94 u8 raw_ext_csd_structure; /* 194 */ 94 u8 raw_ext_csd_structure; /* 194 */
95 u8 raw_card_type; /* 196 */ 95 u8 raw_card_type; /* 196 */
96 u8 out_of_int_time; /* 198 */ 96 u8 out_of_int_time; /* 198 */
97 u8 raw_s_a_timeout; /* 217 */ 97 u8 raw_pwr_cl_52_195; /* 200 */
98 u8 raw_pwr_cl_26_195; /* 201 */
99 u8 raw_pwr_cl_52_360; /* 202 */
100 u8 raw_pwr_cl_26_360; /* 203 */
101 u8 raw_s_a_timeout; /* 217 */
98 u8 raw_hc_erase_gap_size; /* 221 */ 102 u8 raw_hc_erase_gap_size; /* 221 */
99 u8 raw_erase_timeout_mult; /* 223 */ 103 u8 raw_erase_timeout_mult; /* 223 */
100 u8 raw_hc_erase_grp_size; /* 224 */ 104 u8 raw_hc_erase_grp_size; /* 224 */
@@ -102,6 +106,10 @@ struct mmc_ext_csd {
102 u8 raw_sec_erase_mult; /* 230 */ 106 u8 raw_sec_erase_mult; /* 230 */
103 u8 raw_sec_feature_support;/* 231 */ 107 u8 raw_sec_feature_support;/* 231 */
104 u8 raw_trim_mult; /* 232 */ 108 u8 raw_trim_mult; /* 232 */
109 u8 raw_pwr_cl_200_195; /* 236 */
110 u8 raw_pwr_cl_200_360; /* 237 */
111 u8 raw_pwr_cl_ddr_52_195; /* 238 */
112 u8 raw_pwr_cl_ddr_52_360; /* 239 */
105 u8 raw_bkops_status; /* 246 */ 113 u8 raw_bkops_status; /* 246 */
106 u8 raw_sectors[4]; /* 212 - 4 bytes */ 114 u8 raw_sectors[4]; /* 212 - 4 bytes */
107 115
@@ -512,6 +520,7 @@ struct mmc_driver {
512 void (*remove)(struct mmc_card *); 520 void (*remove)(struct mmc_card *);
513 int (*suspend)(struct mmc_card *); 521 int (*suspend)(struct mmc_card *);
514 int (*resume)(struct mmc_card *); 522 int (*resume)(struct mmc_card *);
523 void (*shutdown)(struct mmc_card *);
515}; 524};
516 525
517extern int mmc_register_driver(struct mmc_driver *); 526extern int mmc_register_driver(struct mmc_driver *);
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 39613b9a6fc5..443243b241d5 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -96,6 +96,8 @@ struct mmc_command {
96 */ 96 */
97 97
98 unsigned int cmd_timeout_ms; /* in milliseconds */ 98 unsigned int cmd_timeout_ms; /* in milliseconds */
99 /* Set this flag only for blocking sanitize request */
100 bool sanitize_busy;
99 101
100 struct mmc_data *data; /* data segment associated with cmd */ 102 struct mmc_data *data; /* data segment associated with cmd */
101 struct mmc_request *mrq; /* associated request */ 103 struct mmc_request *mrq; /* associated request */
@@ -188,6 +190,9 @@ extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
188extern void mmc_release_host(struct mmc_host *host); 190extern void mmc_release_host(struct mmc_host *host);
189extern int mmc_try_claim_host(struct mmc_host *host); 191extern int mmc_try_claim_host(struct mmc_host *host);
190 192
193extern void mmc_get_card(struct mmc_card *card);
194extern void mmc_put_card(struct mmc_card *card);
195
191extern int mmc_flush_cache(struct mmc_card *); 196extern int mmc_flush_cache(struct mmc_card *);
192 197
193extern int mmc_detect_card_removed(struct mmc_host *host); 198extern int mmc_detect_card_removed(struct mmc_host *host);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index e326ae2882a0..3b0c33ae13e1 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -239,7 +239,7 @@ struct mmc_host {
239#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ 239#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
240#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ 240#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
241#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ 241#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */
242 242#define MMC_CAP_AGGRESSIVE_PM (1 << 7) /* Suspend (e)MMC/SD at idle */
243#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ 243#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
244#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ 244#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
245#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ 245#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */
@@ -264,7 +264,7 @@ struct mmc_host {
264 264
265#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */ 265#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
266#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */ 266#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
267#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */ 267#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 */ 268#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
269#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */ 269#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */
270#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */ 270#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
@@ -272,7 +272,6 @@ struct mmc_host {
272#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ 272#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
273 MMC_CAP2_HS200_1_2V_SDR) 273 MMC_CAP2_HS200_1_2V_SDR)
274#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */ 274#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */
275#define MMC_CAP2_DETECT_ON_ERR (1 << 8) /* On I/O err check card removal */
276#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */ 275#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */
277#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */ 276#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
278#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */ 277#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
@@ -281,6 +280,7 @@ struct mmc_host {
281#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \ 280#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
282 MMC_CAP2_PACKED_WR) 281 MMC_CAP2_PACKED_WR)
283#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */ 282#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
283#define MMC_CAP2_SANITIZE (1 << 15) /* Support Sanitize */
284 284
285 mmc_pm_flag_t pm_caps; /* supported pm features */ 285 mmc_pm_flag_t pm_caps; /* supported pm features */
286 286
@@ -369,7 +369,7 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *);
369int mmc_add_host(struct mmc_host *); 369int mmc_add_host(struct mmc_host *);
370void mmc_remove_host(struct mmc_host *); 370void mmc_remove_host(struct mmc_host *);
371void mmc_free_host(struct mmc_host *); 371void mmc_free_host(struct mmc_host *);
372void mmc_of_parse(struct mmc_host *host); 372int mmc_of_parse(struct mmc_host *host);
373 373
374static inline void *mmc_priv(struct mmc_host *host) 374static inline void *mmc_priv(struct mmc_host *host)
375{ 375{
@@ -425,10 +425,6 @@ static inline int mmc_regulator_get_supply(struct mmc_host *mmc)
425} 425}
426#endif 426#endif
427 427
428int mmc_card_awake(struct mmc_host *host);
429int mmc_card_sleep(struct mmc_host *host);
430int mmc_card_can_sleep(struct mmc_host *host);
431
432int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); 428int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
433 429
434/* Module parameter */ 430/* Module parameter */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index b838ffc49e4a..e3c6a74d980a 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -95,6 +95,9 @@ struct sdhci_host {
95/* The system physically doesn't support 1.8v, even if the host does */ 95/* The system physically doesn't support 1.8v, even if the host does */
96#define SDHCI_QUIRK2_NO_1_8_V (1<<2) 96#define SDHCI_QUIRK2_NO_1_8_V (1<<2)
97#define SDHCI_QUIRK2_PRESET_VALUE_BROKEN (1<<3) 97#define SDHCI_QUIRK2_PRESET_VALUE_BROKEN (1<<3)
98#define SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON (1<<4)
99/* Controller has a non-standard host control register */
100#define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1<<5)
98 101
99 int irq; /* Device IRQ */ 102 int irq; /* Device IRQ */
100 void __iomem *ioaddr; /* Mapped address */ 103 void __iomem *ioaddr; /* Mapped address */
@@ -126,7 +129,7 @@ struct sdhci_host {
126#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ 129#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */
127#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */ 130#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */
128#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ 131#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */
129#define SDHCI_HS200_NEEDS_TUNING (1<<10) /* HS200 needs tuning */ 132#define SDHCI_SDR104_NEEDS_TUNING (1<<10) /* SDR104/HS200 needs tuning */
130#define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */ 133#define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */
131 134
132 unsigned int version; /* SDHCI spec. version */ 135 unsigned int version; /* SDHCI spec. version */
@@ -139,6 +142,7 @@ struct sdhci_host {
139 u8 pwr; /* Current voltage */ 142 u8 pwr; /* Current voltage */
140 143
141 bool runtime_suspended; /* Host is runtime suspended */ 144 bool runtime_suspended; /* Host is runtime suspended */
145 bool bus_on; /* Bus power prevents runtime suspend */
142 146
143 struct mmc_request *mrq; /* Current request */ 147 struct mmc_request *mrq; /* Current request */
144 struct mmc_command *cmd; /* Current command */ 148 struct mmc_command *cmd; /* Current command */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 5c76737d836b..af4a3b77a8de 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -474,10 +474,16 @@ struct zone {
474 * frequently read in proximity to zone->lock. It's good to 474 * frequently read in proximity to zone->lock. It's good to
475 * give them a chance of being in the same cacheline. 475 * give them a chance of being in the same cacheline.
476 * 476 *
477 * Write access to present_pages and managed_pages at runtime should 477 * Write access to present_pages at runtime should be protected by
478 * be protected by lock_memory_hotplug()/unlock_memory_hotplug(). 478 * lock_memory_hotplug()/unlock_memory_hotplug(). Any reader who can't
479 * Any reader who can't tolerant drift of present_pages and 479 * tolerant drift of present_pages should hold memory hotplug lock to
480 * managed_pages should hold memory hotplug lock to get a stable value. 480 * get a stable value.
481 *
482 * Read access to managed_pages should be safe because it's unsigned
483 * long. Write access to zone->managed_pages and totalram_pages are
484 * protected by managed_page_count_lock at runtime. Idealy only
485 * adjust_managed_page_count() should be used instead of directly
486 * touching zone->managed_pages and totalram_pages.
481 */ 487 */
482 unsigned long spanned_pages; 488 unsigned long spanned_pages;
483 unsigned long present_pages; 489 unsigned long present_pages;
@@ -495,6 +501,13 @@ typedef enum {
495 ZONE_CONGESTED, /* zone has many dirty pages backed by 501 ZONE_CONGESTED, /* zone has many dirty pages backed by
496 * a congested BDI 502 * a congested BDI
497 */ 503 */
504 ZONE_TAIL_LRU_DIRTY, /* reclaim scanning has recently found
505 * many dirty file pages at the tail
506 * of the LRU.
507 */
508 ZONE_WRITEBACK, /* reclaim scanning has recently found
509 * many pages under writeback
510 */
498} zone_flags_t; 511} zone_flags_t;
499 512
500static inline void zone_set_flag(struct zone *zone, zone_flags_t flag) 513static inline void zone_set_flag(struct zone *zone, zone_flags_t flag)
@@ -517,6 +530,16 @@ static inline int zone_is_reclaim_congested(const struct zone *zone)
517 return test_bit(ZONE_CONGESTED, &zone->flags); 530 return test_bit(ZONE_CONGESTED, &zone->flags);
518} 531}
519 532
533static inline int zone_is_reclaim_dirty(const struct zone *zone)
534{
535 return test_bit(ZONE_TAIL_LRU_DIRTY, &zone->flags);
536}
537
538static inline int zone_is_reclaim_writeback(const struct zone *zone)
539{
540 return test_bit(ZONE_WRITEBACK, &zone->flags);
541}
542
520static inline int zone_is_reclaim_locked(const struct zone *zone) 543static inline int zone_is_reclaim_locked(const struct zone *zone)
521{ 544{
522 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags); 545 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags);
@@ -716,7 +739,10 @@ typedef struct pglist_data {
716 * or node_spanned_pages stay constant. Holding this will also 739 * or node_spanned_pages stay constant. Holding this will also
717 * guarantee that any pfn_valid() stays that way. 740 * guarantee that any pfn_valid() stays that way.
718 * 741 *
719 * Nests above zone->lock and zone->size_seqlock. 742 * pgdat_resize_lock() and pgdat_resize_unlock() are provided to
743 * manipulate node_size_lock without checking for CONFIG_MEMORY_HOTPLUG.
744 *
745 * Nests above zone->lock and zone->span_seqlock
720 */ 746 */
721 spinlock_t node_size_lock; 747 spinlock_t node_size_lock;
722#endif 748#endif
@@ -843,11 +869,6 @@ static inline int is_highmem_idx(enum zone_type idx)
843#endif 869#endif
844} 870}
845 871
846static inline int is_normal_idx(enum zone_type idx)
847{
848 return (idx == ZONE_NORMAL);
849}
850
851/** 872/**
852 * is_highmem - helper function to quickly check if a struct zone is a 873 * is_highmem - helper function to quickly check if a struct zone is a
853 * highmem zone or not. This is an attempt to keep references 874 * highmem zone or not. This is an attempt to keep references
@@ -866,29 +887,6 @@ static inline int is_highmem(struct zone *zone)
866#endif 887#endif
867} 888}
868 889
869static inline int is_normal(struct zone *zone)
870{
871 return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL;
872}
873
874static inline int is_dma32(struct zone *zone)
875{
876#ifdef CONFIG_ZONE_DMA32
877 return zone == zone->zone_pgdat->node_zones + ZONE_DMA32;
878#else
879 return 0;
880#endif
881}
882
883static inline int is_dma(struct zone *zone)
884{
885#ifdef CONFIG_ZONE_DMA
886 return zone == zone->zone_pgdat->node_zones + ZONE_DMA;
887#else
888 return 0;
889#endif
890}
891
892/* These two functions are used to setup the per zone pages min values */ 890/* These two functions are used to setup the per zone pages min values */
893struct ctl_table; 891struct ctl_table;
894int min_free_kbytes_sysctl_handler(struct ctl_table *, int, 892int min_free_kbytes_sysctl_handler(struct ctl_table *, int,
@@ -1111,6 +1109,10 @@ struct mem_section {
1111 struct page_cgroup *page_cgroup; 1109 struct page_cgroup *page_cgroup;
1112 unsigned long pad; 1110 unsigned long pad;
1113#endif 1111#endif
1112 /*
1113 * WARNING: mem_section must be a power-of-2 in size for the
1114 * calculation and use of SECTION_ROOT_MASK to make sense.
1115 */
1114}; 1116};
1115 1117
1116#ifdef CONFIG_SPARSEMEM_EXTREME 1118#ifdef CONFIG_SPARSEMEM_EXTREME
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index b508016fb76d..45e921401b06 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -361,7 +361,8 @@ struct ssb_device_id {
361 __u16 vendor; 361 __u16 vendor;
362 __u16 coreid; 362 __u16 coreid;
363 __u8 revision; 363 __u8 revision;
364}; 364 __u8 __pad;
365} __attribute__((packed, aligned(2)));
365#define SSB_DEVICE(_vendor, _coreid, _revision) \ 366#define SSB_DEVICE(_vendor, _coreid, _revision) \
366 { .vendor = _vendor, .coreid = _coreid, .revision = _revision, } 367 { .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
367#define SSB_DEVTABLE_END \ 368#define SSB_DEVTABLE_END \
@@ -377,7 +378,7 @@ struct bcma_device_id {
377 __u16 id; 378 __u16 id;
378 __u8 rev; 379 __u8 rev;
379 __u8 class; 380 __u8 class;
380}; 381} __attribute__((packed,aligned(2)));
381#define BCMA_CORE(_manuf, _id, _rev, _class) \ 382#define BCMA_CORE(_manuf, _id, _rev, _class) \
382 { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, } 383 { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, }
383#define BCMA_CORETABLE_END \ 384#define BCMA_CORETABLE_END \
@@ -456,7 +457,8 @@ enum dmi_field {
456}; 457};
457 458
458struct dmi_strmatch { 459struct dmi_strmatch {
459 unsigned char slot; 460 unsigned char slot:7;
461 unsigned char exact_match:1;
460 char substr[79]; 462 char substr[79];
461}; 463};
462 464
@@ -474,7 +476,8 @@ struct dmi_system_id {
474 */ 476 */
475#define dmi_device_id dmi_system_id 477#define dmi_device_id dmi_system_id
476 478
477#define DMI_MATCH(a, b) { a, b } 479#define DMI_MATCH(a, b) { .slot = a, .substr = b }
480#define DMI_EXACT_MATCH(a, b) { .slot = a, .substr = b, .exact_match = 1 }
478 481
479#define PLATFORM_NAME_SIZE 20 482#define PLATFORM_NAME_SIZE 20
480#define PLATFORM_MODULE_PREFIX "platform:" 483#define PLATFORM_MODULE_PREFIX "platform:"
@@ -577,4 +580,23 @@ struct mei_cl_device_id {
577 kernel_ulong_t driver_info; 580 kernel_ulong_t driver_info;
578}; 581};
579 582
583/* RapidIO */
584
585#define RIO_ANY_ID 0xffff
586
587/**
588 * struct rio_device_id - RIO device identifier
589 * @did: RapidIO device ID
590 * @vid: RapidIO vendor ID
591 * @asm_did: RapidIO assembly device ID
592 * @asm_vid: RapidIO assembly vendor ID
593 *
594 * Identifies a RapidIO device based on both the device/vendor IDs and
595 * the assembly device/vendor IDs.
596 */
597struct rio_device_id {
598 __u16 did, vid;
599 __u16 asm_did, asm_vid;
600};
601
580#endif /* LINUX_MOD_DEVICETABLE_H */ 602#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 137b4198fc03..27d9da3f86ff 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -439,7 +439,7 @@ extern struct kernel_param_ops param_ops_string;
439extern int param_set_copystring(const char *val, const struct kernel_param *); 439extern int param_set_copystring(const char *val, const struct kernel_param *);
440extern int param_get_string(char *buffer, const struct kernel_param *kp); 440extern int param_get_string(char *buffer, const struct kernel_param *kp);
441 441
442/* for exporting parameters in /sys/parameters */ 442/* for exporting parameters in /sys/module/.../parameters */
443 443
444struct module; 444struct module;
445 445
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 20c2d6dd5d25..ee66f3a12fb6 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -35,6 +35,7 @@ struct msi_desc {
35 35
36 u32 masked; /* mask bits */ 36 u32 masked; /* mask bits */
37 unsigned int irq; 37 unsigned int irq;
38 unsigned int nvec_used; /* number of messages */
38 struct list_head list; 39 struct list_head list;
39 40
40 union { 41 union {
diff --git a/include/linux/mutex-debug.h b/include/linux/mutex-debug.h
index 731d77d6e155..4ac8b1977b73 100644
--- a/include/linux/mutex-debug.h
+++ b/include/linux/mutex-debug.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/linkage.h> 4#include <linux/linkage.h>
5#include <linux/lockdep.h> 5#include <linux/lockdep.h>
6#include <linux/debug_locks.h>
6 7
7/* 8/*
8 * Mutexes - debugging helpers: 9 * Mutexes - debugging helpers:
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 433da8a1a426..ccd4260834c5 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -10,6 +10,7 @@
10#ifndef __LINUX_MUTEX_H 10#ifndef __LINUX_MUTEX_H
11#define __LINUX_MUTEX_H 11#define __LINUX_MUTEX_H
12 12
13#include <asm/current.h>
13#include <linux/list.h> 14#include <linux/list.h>
14#include <linux/spinlock_types.h> 15#include <linux/spinlock_types.h>
15#include <linux/linkage.h> 16#include <linux/linkage.h>
@@ -136,6 +137,7 @@ static inline int mutex_is_locked(struct mutex *lock)
136#ifdef CONFIG_DEBUG_LOCK_ALLOC 137#ifdef CONFIG_DEBUG_LOCK_ALLOC
137extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); 138extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
138extern void _mutex_lock_nest_lock(struct mutex *lock, struct lockdep_map *nest_lock); 139extern void _mutex_lock_nest_lock(struct mutex *lock, struct lockdep_map *nest_lock);
140
139extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock, 141extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock,
140 unsigned int subclass); 142 unsigned int subclass);
141extern int __must_check mutex_lock_killable_nested(struct mutex *lock, 143extern int __must_check mutex_lock_killable_nested(struct mutex *lock,
@@ -147,7 +149,7 @@ extern int __must_check mutex_lock_killable_nested(struct mutex *lock,
147 149
148#define mutex_lock_nest_lock(lock, nest_lock) \ 150#define mutex_lock_nest_lock(lock, nest_lock) \
149do { \ 151do { \
150 typecheck(struct lockdep_map *, &(nest_lock)->dep_map); \ 152 typecheck(struct lockdep_map *, &(nest_lock)->dep_map); \
151 _mutex_lock_nest_lock(lock, &(nest_lock)->dep_map); \ 153 _mutex_lock_nest_lock(lock, &(nest_lock)->dep_map); \
152} while (0) 154} while (0)
153 155
@@ -170,6 +172,7 @@ extern int __must_check mutex_lock_killable(struct mutex *lock);
170 */ 172 */
171extern int mutex_trylock(struct mutex *lock); 173extern int mutex_trylock(struct mutex *lock);
172extern void mutex_unlock(struct mutex *lock); 174extern void mutex_unlock(struct mutex *lock);
175
173extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); 176extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
174 177
175#ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX 178#ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 141d395bbb5f..6e8215b15998 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -30,6 +30,7 @@ struct mv643xx_eth_shared_platform_data {
30#define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x)) 30#define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x))
31#define MV643XX_ETH_PHY_NONE 0xff 31#define MV643XX_ETH_PHY_NONE 0xff
32 32
33struct device_node;
33struct mv643xx_eth_platform_data { 34struct mv643xx_eth_platform_data {
34 /* 35 /*
35 * Pointer back to our parent instance, and our port number. 36 * Pointer back to our parent instance, and our port number.
@@ -41,6 +42,7 @@ struct mv643xx_eth_platform_data {
41 * Whether a PHY is present, and if yes, at which address. 42 * Whether a PHY is present, and if yes, at which address.
42 */ 43 */
43 int phy_addr; 44 int phy_addr;
45 struct device_node *phy_node;
44 46
45 /* 47 /*
46 * Use this MAC address if it is valid, overriding the 48 * Use this MAC address if it is valid, overriding the
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 4871170a04a0..ae4981ebd18e 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -41,6 +41,7 @@ struct nbd_device {
41 u64 bytesize; 41 u64 bytesize;
42 pid_t pid; /* pid of nbd-client, if attached */ 42 pid_t pid; /* pid of nbd-client, if attached */
43 int xmit_timeout; 43 int xmit_timeout;
44 int disconnect; /* a disconnect has been requested by user */
44}; 45};
45 46
46#endif 47#endif
diff --git a/include/linux/net.h b/include/linux/net.h
index 99c9f0c103c2..4f27575ce1d6 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -79,9 +79,9 @@ enum sock_type {
79#endif /* ARCH_HAS_SOCKET_TYPES */ 79#endif /* ARCH_HAS_SOCKET_TYPES */
80 80
81enum sock_shutdown_cmd { 81enum sock_shutdown_cmd {
82 SHUT_RD = 0, 82 SHUT_RD,
83 SHUT_WR = 1, 83 SHUT_WR,
84 SHUT_RDWR = 2, 84 SHUT_RDWR,
85}; 85};
86 86
87struct socket_wq { 87struct socket_wq {
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 09906b7ca47d..a2a89a5c7be5 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -43,8 +43,9 @@ enum {
43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */ 43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */
44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */ 44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */
45 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */ 45 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */
46 NETIF_F_GSO_MPLS_BIT, /* ... MPLS segmentation */
46 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */ 47 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */
47 NETIF_F_GSO_UDP_TUNNEL_BIT, 48 NETIF_F_GSO_MPLS_BIT,
48 49
49 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ 50 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
50 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */ 51 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
@@ -107,6 +108,7 @@ enum {
107#define NETIF_F_RXALL __NETIF_F(RXALL) 108#define NETIF_F_RXALL __NETIF_F(RXALL)
108#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE) 109#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE)
109#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL) 110#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL)
111#define NETIF_F_GSO_MPLS __NETIF_F(GSO_MPLS)
110#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER) 112#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)
111#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) 113#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
112#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) 114#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 96e4c21e15e0..9a4156845e93 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -324,12 +324,15 @@ struct napi_struct {
324 struct sk_buff *gro_list; 324 struct sk_buff *gro_list;
325 struct sk_buff *skb; 325 struct sk_buff *skb;
326 struct list_head dev_list; 326 struct list_head dev_list;
327 struct hlist_node napi_hash_node;
328 unsigned int napi_id;
327}; 329};
328 330
329enum { 331enum {
330 NAPI_STATE_SCHED, /* Poll is scheduled */ 332 NAPI_STATE_SCHED, /* Poll is scheduled */
331 NAPI_STATE_DISABLE, /* Disable pending */ 333 NAPI_STATE_DISABLE, /* Disable pending */
332 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ 334 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */
335 NAPI_STATE_HASHED, /* In NAPI hash */
333}; 336};
334 337
335enum gro_result { 338enum gro_result {
@@ -446,6 +449,32 @@ extern void __napi_complete(struct napi_struct *n);
446extern void napi_complete(struct napi_struct *n); 449extern void napi_complete(struct napi_struct *n);
447 450
448/** 451/**
452 * napi_by_id - lookup a NAPI by napi_id
453 * @napi_id: hashed napi_id
454 *
455 * lookup @napi_id in napi_hash table
456 * must be called under rcu_read_lock()
457 */
458extern struct napi_struct *napi_by_id(unsigned int napi_id);
459
460/**
461 * napi_hash_add - add a NAPI to global hashtable
462 * @napi: napi context
463 *
464 * generate a new napi_id and store a @napi under it in napi_hash
465 */
466extern void napi_hash_add(struct napi_struct *napi);
467
468/**
469 * napi_hash_del - remove a NAPI from global table
470 * @napi: napi context
471 *
472 * Warning: caller must observe rcu grace period
473 * before freeing memory containing @napi
474 */
475extern void napi_hash_del(struct napi_struct *napi);
476
477/**
449 * napi_disable - prevent NAPI from scheduling 478 * napi_disable - prevent NAPI from scheduling
450 * @n: napi context 479 * @n: napi context
451 * 480 *
@@ -800,6 +829,7 @@ struct netdev_fcoe_hbainfo {
800 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); 829 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting);
801 * int (*ndo_get_vf_config)(struct net_device *dev, 830 * int (*ndo_get_vf_config)(struct net_device *dev,
802 * int vf, struct ifla_vf_info *ivf); 831 * int vf, struct ifla_vf_info *ivf);
832 * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state);
803 * int (*ndo_set_vf_port)(struct net_device *dev, int vf, 833 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
804 * struct nlattr *port[]); 834 * struct nlattr *port[]);
805 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); 835 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
@@ -943,6 +973,9 @@ struct net_device_ops {
943 gfp_t gfp); 973 gfp_t gfp);
944 void (*ndo_netpoll_cleanup)(struct net_device *dev); 974 void (*ndo_netpoll_cleanup)(struct net_device *dev);
945#endif 975#endif
976#ifdef CONFIG_NET_RX_BUSY_POLL
977 int (*ndo_busy_poll)(struct napi_struct *dev);
978#endif
946 int (*ndo_set_vf_mac)(struct net_device *dev, 979 int (*ndo_set_vf_mac)(struct net_device *dev,
947 int queue, u8 *mac); 980 int queue, u8 *mac);
948 int (*ndo_set_vf_vlan)(struct net_device *dev, 981 int (*ndo_set_vf_vlan)(struct net_device *dev,
@@ -954,6 +987,8 @@ struct net_device_ops {
954 int (*ndo_get_vf_config)(struct net_device *dev, 987 int (*ndo_get_vf_config)(struct net_device *dev,
955 int vf, 988 int vf,
956 struct ifla_vf_info *ivf); 989 struct ifla_vf_info *ivf);
990 int (*ndo_set_vf_link_state)(struct net_device *dev,
991 int vf, int link_state);
957 int (*ndo_set_vf_port)(struct net_device *dev, 992 int (*ndo_set_vf_port)(struct net_device *dev,
958 int vf, 993 int vf,
959 struct nlattr *port[]); 994 struct nlattr *port[]);
@@ -1088,6 +1123,8 @@ struct net_device {
1088 * need to set them appropriately. 1123 * need to set them appropriately.
1089 */ 1124 */
1090 netdev_features_t hw_enc_features; 1125 netdev_features_t hw_enc_features;
1126 /* mask of fetures inheritable by MPLS */
1127 netdev_features_t mpls_features;
1091 1128
1092 /* Interface index. Unique device identifier */ 1129 /* Interface index. Unique device identifier */
1093 int ifindex; 1130 int ifindex;
@@ -1140,8 +1177,10 @@ struct net_device {
1140 unsigned char addr_assign_type; /* hw address assignment type */ 1177 unsigned char addr_assign_type; /* hw address assignment type */
1141 unsigned char addr_len; /* hardware address length */ 1178 unsigned char addr_len; /* hardware address length */
1142 unsigned char neigh_priv_len; 1179 unsigned char neigh_priv_len;
1143 unsigned short dev_id; /* for shared network cards */ 1180 unsigned short dev_id; /* Used to differentiate devices
1144 1181 * that share the same link
1182 * layer address
1183 */
1145 spinlock_t addr_list_lock; 1184 spinlock_t addr_list_lock;
1146 struct netdev_hw_addr_list uc; /* Unicast mac addresses */ 1185 struct netdev_hw_addr_list uc; /* Unicast mac addresses */
1147 struct netdev_hw_addr_list mc; /* Multicast mac addresses */ 1186 struct netdev_hw_addr_list mc; /* Multicast mac addresses */
@@ -1593,9 +1632,34 @@ struct packet_offload {
1593#define NETDEV_RELEASE 0x0012 1632#define NETDEV_RELEASE 0x0012
1594#define NETDEV_NOTIFY_PEERS 0x0013 1633#define NETDEV_NOTIFY_PEERS 0x0013
1595#define NETDEV_JOIN 0x0014 1634#define NETDEV_JOIN 0x0014
1635#define NETDEV_CHANGEUPPER 0x0015
1596 1636
1597extern int register_netdevice_notifier(struct notifier_block *nb); 1637extern int register_netdevice_notifier(struct notifier_block *nb);
1598extern int unregister_netdevice_notifier(struct notifier_block *nb); 1638extern int unregister_netdevice_notifier(struct notifier_block *nb);
1639
1640struct netdev_notifier_info {
1641 struct net_device *dev;
1642};
1643
1644struct netdev_notifier_change_info {
1645 struct netdev_notifier_info info; /* must be first */
1646 unsigned int flags_changed;
1647};
1648
1649static inline void netdev_notifier_info_init(struct netdev_notifier_info *info,
1650 struct net_device *dev)
1651{
1652 info->dev = dev;
1653}
1654
1655static inline struct net_device *
1656netdev_notifier_info_to_dev(const struct netdev_notifier_info *info)
1657{
1658 return info->dev;
1659}
1660
1661extern int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev,
1662 struct netdev_notifier_info *info);
1599extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); 1663extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1600 1664
1601 1665
@@ -1779,6 +1843,19 @@ static inline int unregister_gifconf(unsigned int family)
1779 return register_gifconf(family, NULL); 1843 return register_gifconf(family, NULL);
1780} 1844}
1781 1845
1846#ifdef CONFIG_NET_FLOW_LIMIT
1847#define FLOW_LIMIT_HISTORY (1 << 7) /* must be ^2 and !overflow buckets */
1848struct sd_flow_limit {
1849 u64 count;
1850 unsigned int num_buckets;
1851 unsigned int history_head;
1852 u16 history[FLOW_LIMIT_HISTORY];
1853 u8 buckets[];
1854};
1855
1856extern int netdev_flow_limit_table_len;
1857#endif /* CONFIG_NET_FLOW_LIMIT */
1858
1782/* 1859/*
1783 * Incoming packets are placed on per-cpu queues 1860 * Incoming packets are placed on per-cpu queues
1784 */ 1861 */
@@ -1808,6 +1885,10 @@ struct softnet_data {
1808 unsigned int dropped; 1885 unsigned int dropped;
1809 struct sk_buff_head input_pkt_queue; 1886 struct sk_buff_head input_pkt_queue;
1810 struct napi_struct backlog; 1887 struct napi_struct backlog;
1888
1889#ifdef CONFIG_NET_FLOW_LIMIT
1890 struct sd_flow_limit __rcu *flow_limit;
1891#endif
1811}; 1892};
1812 1893
1813static inline void input_queue_head_incr(struct softnet_data *sd) 1894static inline void input_queue_head_incr(struct softnet_data *sd)
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 0060fde3160e..de70f7b45b68 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -35,7 +35,7 @@ static inline void nf_inet_addr_mask(const union nf_inet_addr *a1,
35 result->all[3] = a1->all[3] & mask->all[3]; 35 result->all[3] = a1->all[3] & mask->all[3];
36} 36}
37 37
38extern void netfilter_init(void); 38extern int netfilter_init(void);
39 39
40/* Largest hook number + 1 */ 40/* Largest hook number + 1 */
41#define NF_MAX_HOOKS 8 41#define NF_MAX_HOOKS 8
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 6358da5eeee8..7a6c396a263b 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -46,6 +46,7 @@ struct netlink_kernel_cfg {
46 void (*input)(struct sk_buff *skb); 46 void (*input)(struct sk_buff *skb);
47 struct mutex *cb_mutex; 47 struct mutex *cb_mutex;
48 void (*bind)(int group); 48 void (*bind)(int group);
49 bool (*compare)(struct net *net, struct sock *sk);
49}; 50};
50 51
51extern struct sock *__netlink_kernel_create(struct net *net, int unit, 52extern struct sock *__netlink_kernel_create(struct net *net, int unit,
@@ -84,6 +85,22 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb,
84void netlink_detachskb(struct sock *sk, struct sk_buff *skb); 85void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
85int netlink_sendskb(struct sock *sk, struct sk_buff *skb); 86int netlink_sendskb(struct sock *sk, struct sk_buff *skb);
86 87
88static inline struct sk_buff *
89netlink_skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
90{
91 struct sk_buff *nskb;
92
93 nskb = skb_clone(skb, gfp_mask);
94 if (!nskb)
95 return NULL;
96
97 /* This is a large skb, set destructor callback to release head */
98 if (is_vmalloc_addr(skb->head))
99 nskb->destructor = skb->destructor;
100
101 return nskb;
102}
103
87/* 104/*
88 * skb should fit one page. This choice is good for headerless malloc. 105 * skb should fit one page. This choice is good for headerless malloc.
89 * But we should limit to 8K so that userspace does not have to 106 * But we should limit to 8K so that userspace does not have to
@@ -144,4 +161,14 @@ static inline int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
144 return __netlink_dump_start(ssk, skb, nlh, control); 161 return __netlink_dump_start(ssk, skb, nlh, control);
145} 162}
146 163
164struct netlink_tap {
165 struct net_device *dev;
166 struct module *module;
167 struct list_head list;
168};
169
170extern int netlink_add_tap(struct netlink_tap *nt);
171extern int __netlink_remove_tap(struct netlink_tap *nt);
172extern int netlink_remove_tap(struct netlink_tap *nt);
173
147#endif /* __LINUX_NETLINK_H */ 174#endif /* __LINUX_NETLINK_H */
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index fa2cb76a7029..f3c7c24bec1c 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -53,10 +53,10 @@ struct netpoll_info {
53}; 53};
54 54
55#ifdef CONFIG_NETPOLL 55#ifdef CONFIG_NETPOLL
56extern int netpoll_rx_disable(struct net_device *dev); 56extern void netpoll_rx_disable(struct net_device *dev);
57extern void netpoll_rx_enable(struct net_device *dev); 57extern void netpoll_rx_enable(struct net_device *dev);
58#else 58#else
59static inline int netpoll_rx_disable(struct net_device *dev) { return 0; } 59static inline void netpoll_rx_disable(struct net_device *dev) { return; }
60static inline void netpoll_rx_enable(struct net_device *dev) { return; } 60static inline void netpoll_rx_enable(struct net_device *dev) { return; }
61#endif 61#endif
62 62
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 7b8fc73810ad..e36dee52f224 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -32,6 +32,15 @@ struct nfs4_acl {
32 struct nfs4_ace aces[0]; 32 struct nfs4_ace aces[0];
33}; 33};
34 34
35#define NFS4_MAXLABELLEN 2048
36
37struct nfs4_label {
38 uint32_t lfs;
39 uint32_t pi;
40 u32 len;
41 char *label;
42};
43
35typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; 44typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier;
36 45
37struct nfs_stateid4 { 46struct nfs_stateid4 {
@@ -219,6 +228,14 @@ enum nfsstat4 {
219 NFS4ERR_REJECT_DELEG = 10085, /* on callback */ 228 NFS4ERR_REJECT_DELEG = 10085, /* on callback */
220 NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */ 229 NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */
221 NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */ 230 NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */
231
232 /* nfs42 */
233 NFS4ERR_PARTNER_NOTSUPP = 10088,
234 NFS4ERR_PARTNER_NO_AUTH = 10089,
235 NFS4ERR_METADATA_NOTSUPP = 10090,
236 NFS4ERR_OFFLOAD_DENIED = 10091,
237 NFS4ERR_WRONG_LFS = 10092,
238 NFS4ERR_BADLABEL = 10093,
222}; 239};
223 240
224static inline bool seqid_mutating_err(u32 err) 241static inline bool seqid_mutating_err(u32 err)
@@ -378,6 +395,7 @@ enum lock_type4 {
378#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) 395#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30)
379#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) 396#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)
380#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) 397#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4)
398#define FATTR4_WORD2_SECURITY_LABEL (1UL << 17)
381 399
382/* MDS threshold bitmap bits */ 400/* MDS threshold bitmap bits */
383#define THRESHOLD_RD (1UL << 0) 401#define THRESHOLD_RD (1UL << 0)
@@ -390,11 +408,15 @@ enum lock_type4 {
390#define NFS4_VERSION 4 408#define NFS4_VERSION 4
391#define NFS4_MINOR_VERSION 0 409#define NFS4_MINOR_VERSION 0
392 410
411#if defined(CONFIG_NFS_V4_2)
412#define NFS4_MAX_MINOR_VERSION 2
413#else
393#if defined(CONFIG_NFS_V4_1) 414#if defined(CONFIG_NFS_V4_1)
394#define NFS4_MAX_MINOR_VERSION 1 415#define NFS4_MAX_MINOR_VERSION 1
395#else 416#else
396#define NFS4_MAX_MINOR_VERSION 0 417#define NFS4_MAX_MINOR_VERSION 0
397#endif /* CONFIG_NFS_V4_1 */ 418#endif /* CONFIG_NFS_V4_1 */
419#endif /* CONFIG_NFS_V4_2 */
398 420
399#define NFS4_DEBUG 1 421#define NFS4_DEBUG 1
400 422
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index fc01d5cb4cf1..7125cef74164 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -207,6 +207,7 @@ struct nfs_inode {
207#define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */ 207#define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */
208#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */ 208#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */
209#define NFS_INO_REVAL_FORCED 0x0040 /* force revalidation ignoring a delegation */ 209#define NFS_INO_REVAL_FORCED 0x0040 /* force revalidation ignoring a delegation */
210#define NFS_INO_INVALID_LABEL 0x0080 /* cached label is invalid */
210 211
211/* 212/*
212 * Bit offsets in flags field 213 * Bit offsets in flags field
@@ -336,7 +337,7 @@ extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping);
336extern void nfs_zap_caches(struct inode *); 337extern void nfs_zap_caches(struct inode *);
337extern void nfs_invalidate_atime(struct inode *); 338extern void nfs_invalidate_atime(struct inode *);
338extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, 339extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,
339 struct nfs_fattr *); 340 struct nfs_fattr *, struct nfs4_label *);
340extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); 341extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
341extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); 342extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr);
342extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); 343extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr);
@@ -347,15 +348,19 @@ extern int nfs_permission(struct inode *, int);
347extern int nfs_open(struct inode *, struct file *); 348extern int nfs_open(struct inode *, struct file *);
348extern int nfs_release(struct inode *, struct file *); 349extern int nfs_release(struct inode *, struct file *);
349extern int nfs_attribute_timeout(struct inode *inode); 350extern int nfs_attribute_timeout(struct inode *inode);
351extern int nfs_attribute_cache_expired(struct inode *inode);
350extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 352extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
351extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 353extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
352extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 354extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
353extern int nfs_setattr(struct dentry *, struct iattr *); 355extern int nfs_setattr(struct dentry *, struct iattr *);
354extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 356extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
357extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr,
358 struct nfs4_label *label);
355extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 359extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
356extern void put_nfs_open_context(struct nfs_open_context *ctx); 360extern void put_nfs_open_context(struct nfs_open_context *ctx);
357extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); 361extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode);
358extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode); 362extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode);
363extern void nfs_inode_attach_open_context(struct nfs_open_context *ctx);
359extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); 364extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
360extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx); 365extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx);
361extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); 366extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx);
@@ -468,7 +473,8 @@ extern const struct file_operations nfs_dir_operations;
468extern const struct dentry_operations nfs_dentry_operations; 473extern const struct dentry_operations nfs_dentry_operations;
469 474
470extern void nfs_force_lookup_revalidate(struct inode *dir); 475extern void nfs_force_lookup_revalidate(struct inode *dir);
471extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 476extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh,
477 struct nfs_fattr *fattr, struct nfs4_label *label);
472extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags); 478extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags);
473extern void nfs_access_zap_cache(struct inode *inode); 479extern void nfs_access_zap_cache(struct inode *inode);
474 480
@@ -497,6 +503,24 @@ extern int nfs_mountpoint_expiry_timeout;
497extern void nfs_release_automount_timer(void); 503extern void nfs_release_automount_timer(void);
498 504
499/* 505/*
506 * linux/fs/nfs/nfs4proc.c
507 */
508#ifdef CONFIG_NFS_V4_SECURITY_LABEL
509extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags);
510static inline void nfs4_label_free(struct nfs4_label *label)
511{
512 if (label) {
513 kfree(label->label);
514 kfree(label);
515 }
516 return;
517}
518#else
519static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; }
520static inline void nfs4_label_free(void *label) {}
521#endif
522
523/*
500 * linux/fs/nfs/unlink.c 524 * linux/fs/nfs/unlink.c
501 */ 525 */
502extern void nfs_complete_unlink(struct dentry *dentry, struct inode *); 526extern void nfs_complete_unlink(struct dentry *dentry, struct inode *);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 3b7fa2abecca..d2212432c456 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -146,7 +146,12 @@ struct nfs_server {
146 u32 attr_bitmask[3];/* V4 bitmask representing the set 146 u32 attr_bitmask[3];/* V4 bitmask representing the set
147 of attributes supported on this 147 of attributes supported on this
148 filesystem */ 148 filesystem */
149 u32 cache_consistency_bitmask[2]; 149 u32 attr_bitmask_nl[3];
150 /* V4 bitmask representing the
151 set of attributes supported
152 on this filesystem excluding
153 the label support bit. */
154 u32 cache_consistency_bitmask[3];
150 /* V4 bitmask representing the subset 155 /* V4 bitmask representing the subset
151 of change attribute, size, ctime 156 of change attribute, size, ctime
152 and mtime attributes supported by 157 and mtime attributes supported by
@@ -200,5 +205,6 @@ struct nfs_server {
200#define NFS_CAP_UIDGID_NOMAP (1U << 15) 205#define NFS_CAP_UIDGID_NOMAP (1U << 15)
201#define NFS_CAP_STATEID_NFSV41 (1U << 16) 206#define NFS_CAP_STATEID_NFSV41 (1U << 16)
202#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17) 207#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17)
208#define NFS_CAP_SECURITY_LABEL (1U << 18)
203 209
204#endif 210#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 104b62f23ee0..8651574a305b 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -101,6 +101,7 @@ struct nfs_fattr {
101#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22) 101#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
102#define NFS_ATTR_FATTR_OWNER_NAME (1U << 23) 102#define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
103#define NFS_ATTR_FATTR_GROUP_NAME (1U << 24) 103#define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
104#define NFS_ATTR_FATTR_V4_SECURITY_LABEL (1U << 25)
104 105
105#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ 106#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
106 | NFS_ATTR_FATTR_MODE \ 107 | NFS_ATTR_FATTR_MODE \
@@ -120,7 +121,8 @@ struct nfs_fattr {
120#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \ 121#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
121 | NFS_ATTR_FATTR_SPACE_USED) 122 | NFS_ATTR_FATTR_SPACE_USED)
122#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \ 123#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
123 | NFS_ATTR_FATTR_SPACE_USED) 124 | NFS_ATTR_FATTR_SPACE_USED \
125 | NFS_ATTR_FATTR_V4_SECURITY_LABEL)
124 126
125/* 127/*
126 * Info on the file system 128 * Info on the file system
@@ -246,6 +248,7 @@ struct nfs4_layoutget_res {
246struct nfs4_layoutget { 248struct nfs4_layoutget {
247 struct nfs4_layoutget_args args; 249 struct nfs4_layoutget_args args;
248 struct nfs4_layoutget_res res; 250 struct nfs4_layoutget_res res;
251 struct rpc_cred *cred;
249 gfp_t gfp_flags; 252 gfp_t gfp_flags;
250}; 253};
251 254
@@ -347,6 +350,7 @@ struct nfs_openargs {
347 const u32 * open_bitmap; 350 const u32 * open_bitmap;
348 __u32 claim; 351 __u32 claim;
349 enum createmode4 createmode; 352 enum createmode4 createmode;
353 const struct nfs4_label *label;
350}; 354};
351 355
352struct nfs_openres { 356struct nfs_openres {
@@ -356,6 +360,7 @@ struct nfs_openres {
356 struct nfs4_change_info cinfo; 360 struct nfs4_change_info cinfo;
357 __u32 rflags; 361 __u32 rflags;
358 struct nfs_fattr * f_attr; 362 struct nfs_fattr * f_attr;
363 struct nfs4_label *f_label;
359 struct nfs_seqid * seqid; 364 struct nfs_seqid * seqid;
360 const struct nfs_server *server; 365 const struct nfs_server *server;
361 fmode_t delegation_type; 366 fmode_t delegation_type;
@@ -598,6 +603,7 @@ struct nfs_entry {
598 int eof; 603 int eof;
599 struct nfs_fh * fh; 604 struct nfs_fh * fh;
600 struct nfs_fattr * fattr; 605 struct nfs_fattr * fattr;
606 struct nfs4_label *label;
601 unsigned char d_type; 607 unsigned char d_type;
602 struct nfs_server * server; 608 struct nfs_server * server;
603}; 609};
@@ -630,6 +636,7 @@ struct nfs_setattrargs {
630 struct iattr * iap; 636 struct iattr * iap;
631 const struct nfs_server * server; /* Needed for name mapping */ 637 const struct nfs_server * server; /* Needed for name mapping */
632 const u32 * bitmask; 638 const u32 * bitmask;
639 const struct nfs4_label *label;
633}; 640};
634 641
635struct nfs_setaclargs { 642struct nfs_setaclargs {
@@ -665,6 +672,7 @@ struct nfs_getaclres {
665struct nfs_setattrres { 672struct nfs_setattrres {
666 struct nfs4_sequence_res seq_res; 673 struct nfs4_sequence_res seq_res;
667 struct nfs_fattr * fattr; 674 struct nfs_fattr * fattr;
675 struct nfs4_label *label;
668 const struct nfs_server * server; 676 const struct nfs_server * server;
669}; 677};
670 678
@@ -862,6 +870,7 @@ struct nfs4_create_arg {
862 const struct iattr * attrs; 870 const struct iattr * attrs;
863 const struct nfs_fh * dir_fh; 871 const struct nfs_fh * dir_fh;
864 const u32 * bitmask; 872 const u32 * bitmask;
873 const struct nfs4_label *label;
865}; 874};
866 875
867struct nfs4_create_res { 876struct nfs4_create_res {
@@ -869,6 +878,7 @@ struct nfs4_create_res {
869 const struct nfs_server * server; 878 const struct nfs_server * server;
870 struct nfs_fh * fh; 879 struct nfs_fh * fh;
871 struct nfs_fattr * fattr; 880 struct nfs_fattr * fattr;
881 struct nfs4_label *label;
872 struct nfs4_change_info dir_cinfo; 882 struct nfs4_change_info dir_cinfo;
873}; 883};
874 884
@@ -893,6 +903,7 @@ struct nfs4_getattr_res {
893 struct nfs4_sequence_res seq_res; 903 struct nfs4_sequence_res seq_res;
894 const struct nfs_server * server; 904 const struct nfs_server * server;
895 struct nfs_fattr * fattr; 905 struct nfs_fattr * fattr;
906 struct nfs4_label *label;
896}; 907};
897 908
898struct nfs4_link_arg { 909struct nfs4_link_arg {
@@ -907,6 +918,7 @@ struct nfs4_link_res {
907 struct nfs4_sequence_res seq_res; 918 struct nfs4_sequence_res seq_res;
908 const struct nfs_server * server; 919 const struct nfs_server * server;
909 struct nfs_fattr * fattr; 920 struct nfs_fattr * fattr;
921 struct nfs4_label *label;
910 struct nfs4_change_info cinfo; 922 struct nfs4_change_info cinfo;
911 struct nfs_fattr * dir_attr; 923 struct nfs_fattr * dir_attr;
912}; 924};
@@ -924,6 +936,7 @@ struct nfs4_lookup_res {
924 const struct nfs_server * server; 936 const struct nfs_server * server;
925 struct nfs_fattr * fattr; 937 struct nfs_fattr * fattr;
926 struct nfs_fh * fh; 938 struct nfs_fh * fh;
939 struct nfs4_label *label;
927}; 940};
928 941
929struct nfs4_lookup_root_arg { 942struct nfs4_lookup_root_arg {
@@ -1366,11 +1379,12 @@ struct nfs_rpc_ops {
1366 struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *, 1379 struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *,
1367 struct nfs_subversion *); 1380 struct nfs_subversion *);
1368 int (*getattr) (struct nfs_server *, struct nfs_fh *, 1381 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1369 struct nfs_fattr *); 1382 struct nfs_fattr *, struct nfs4_label *);
1370 int (*setattr) (struct dentry *, struct nfs_fattr *, 1383 int (*setattr) (struct dentry *, struct nfs_fattr *,
1371 struct iattr *); 1384 struct iattr *);
1372 int (*lookup) (struct inode *, struct qstr *, 1385 int (*lookup) (struct inode *, struct qstr *,
1373 struct nfs_fh *, struct nfs_fattr *); 1386 struct nfs_fh *, struct nfs_fattr *,
1387 struct nfs4_label *);
1374 int (*access) (struct inode *, struct nfs_access_entry *); 1388 int (*access) (struct inode *, struct nfs_access_entry *);
1375 int (*readlink)(struct inode *, struct page *, unsigned int, 1389 int (*readlink)(struct inode *, struct page *, unsigned int,
1376 unsigned int); 1390 unsigned int);
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index db50840e6355..6a45fb583ff1 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -46,7 +46,7 @@ static inline bool trigger_all_cpu_backtrace(void)
46#ifdef CONFIG_LOCKUP_DETECTOR 46#ifdef CONFIG_LOCKUP_DETECTOR
47int hw_nmi_is_cpu_stuck(struct pt_regs *); 47int hw_nmi_is_cpu_stuck(struct pt_regs *);
48u64 hw_nmi_get_sample_period(int watchdog_thresh); 48u64 hw_nmi_get_sample_period(int watchdog_thresh);
49extern int watchdog_enabled; 49extern int watchdog_user_enabled;
50extern int watchdog_thresh; 50extern int watchdog_thresh;
51struct ctl_table; 51struct ctl_table;
52extern int proc_dowatchdog(struct ctl_table *, int , 52extern int proc_dowatchdog(struct ctl_table *, int ,
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 0506eb53519b..4c2e6f26432c 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -4,6 +4,36 @@
4#include <linux/errno.h> 4#include <linux/errno.h>
5#include <linux/of.h> 5#include <linux/of.h>
6 6
7struct of_pci_range_parser {
8 struct device_node *node;
9 const __be32 *range;
10 const __be32 *end;
11 int np;
12 int pna;
13};
14
15struct of_pci_range {
16 u32 pci_space;
17 u64 pci_addr;
18 u64 cpu_addr;
19 u64 size;
20 u32 flags;
21};
22
23#define for_each_of_pci_range(parser, range) \
24 for (; of_pci_range_parser_one(parser, range);)
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
7#ifdef CONFIG_OF_ADDRESS 37#ifdef CONFIG_OF_ADDRESS
8extern u64 of_translate_address(struct device_node *np, const __be32 *addr); 38extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
9extern bool of_can_translate_address(struct device_node *dev); 39extern bool of_can_translate_address(struct device_node *dev);
@@ -27,6 +57,11 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
27#define pci_address_to_pio pci_address_to_pio 57#define pci_address_to_pio pci_address_to_pio
28#endif 58#endif
29 59
60extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
61 struct device_node *node);
62extern struct of_pci_range *of_pci_range_parser_one(
63 struct of_pci_range_parser *parser,
64 struct of_pci_range *range);
30#else /* CONFIG_OF_ADDRESS */ 65#else /* CONFIG_OF_ADDRESS */
31#ifndef of_address_to_resource 66#ifndef of_address_to_resource
32static inline int of_address_to_resource(struct device_node *dev, int index, 67static inline int of_address_to_resource(struct device_node *dev, int index,
@@ -53,6 +88,19 @@ static inline const __be32 *of_get_address(struct device_node *dev, int index,
53{ 88{
54 return NULL; 89 return NULL;
55} 90}
91
92static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser,
93 struct device_node *node)
94{
95 return -1;
96}
97
98static inline struct of_pci_range *of_pci_range_parser_one(
99 struct of_pci_range_parser *parser,
100 struct of_pci_range *range)
101{
102 return NULL;
103}
56#endif /* CONFIG_OF_ADDRESS */ 104#endif /* CONFIG_OF_ADDRESS */
57 105
58 106
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 901b7435e890..9d27475feec1 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -4,12 +4,12 @@
4#include <linux/platform_device.h> 4#include <linux/platform_device.h>
5#include <linux/of_platform.h> /* temporary until merge */ 5#include <linux/of_platform.h> /* temporary until merge */
6 6
7#ifdef CONFIG_OF_DEVICE
8#include <linux/of.h> 7#include <linux/of.h>
9#include <linux/mod_devicetable.h> 8#include <linux/mod_devicetable.h>
10 9
11struct device; 10struct device;
12 11
12#ifdef CONFIG_OF
13extern const struct of_device_id *of_match_device( 13extern const struct of_device_id *of_match_device(
14 const struct of_device_id *matches, const struct device *dev); 14 const struct of_device_id *matches, const struct device *dev);
15extern void of_device_make_bus_id(struct device *dev); 15extern void of_device_make_bus_id(struct device *dev);
@@ -43,7 +43,7 @@ static inline void of_device_node_put(struct device *dev)
43 of_node_put(dev->of_node); 43 of_node_put(dev->of_node);
44} 44}
45 45
46#else /* CONFIG_OF_DEVICE */ 46#else /* CONFIG_OF */
47 47
48static inline int of_driver_match_device(struct device *dev, 48static inline int of_driver_match_device(struct device *dev,
49 struct device_driver *drv) 49 struct device_driver *drv)
@@ -67,6 +67,6 @@ static inline const struct of_device_id *of_match_device(
67{ 67{
68 return NULL; 68 return NULL;
69} 69}
70#endif /* CONFIG_OF_DEVICE */ 70#endif /* CONFIG_OF */
71 71
72#endif /* _LINUX_OF_DEVICE_H */ 72#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h
index 364dda734877..ae36298ba076 100644
--- a/include/linux/of_dma.h
+++ b/include/linux/of_dma.h
@@ -21,7 +21,6 @@ struct device_node;
21struct of_dma { 21struct of_dma {
22 struct list_head of_dma_controllers; 22 struct list_head of_dma_controllers;
23 struct device_node *of_node; 23 struct device_node *of_node;
24 int of_dma_nbcells;
25 struct dma_chan *(*of_dma_xlate) 24 struct dma_chan *(*of_dma_xlate)
26 (struct of_phandle_args *, struct of_dma *); 25 (struct of_phandle_args *, struct of_dma *);
27 void *of_dma_data; 26 void *of_dma_data;
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index bb115deb7612..7a04826018c0 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -10,5 +10,7 @@ int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq);
10struct device_node; 10struct device_node;
11struct device_node *of_pci_find_child_device(struct device_node *parent, 11struct device_node *of_pci_find_child_device(struct device_node *parent,
12 unsigned int devfn); 12 unsigned int devfn);
13int of_pci_get_devfn(struct device_node *np);
14int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
13 15
14#endif 16#endif
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 2a93b64a3869..05cb4a928252 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -13,8 +13,6 @@
13 13
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/mod_devicetable.h> 15#include <linux/mod_devicetable.h>
16
17#ifdef CONFIG_OF_DEVICE
18#include <linux/pm.h> 16#include <linux/pm.h>
19#include <linux/of_device.h> 17#include <linux/of_device.h>
20#include <linux/platform_device.h> 18#include <linux/platform_device.h>
@@ -53,27 +51,6 @@ struct of_dev_auxdata {
53 { .compatible = _compat, .phys_addr = _phys, .name = _name, \ 51 { .compatible = _compat, .phys_addr = _phys, .name = _name, \
54 .platform_data = _pdata } 52 .platform_data = _pdata }
55 53
56/**
57 * of_platform_driver - Legacy of-aware driver for platform devices.
58 *
59 * An of_platform_driver driver is attached to a basic platform_device on
60 * the ibm ebus (ibmebus_bus_type).
61 */
62struct of_platform_driver
63{
64 int (*probe)(struct platform_device* dev,
65 const struct of_device_id *match);
66 int (*remove)(struct platform_device* dev);
67
68 int (*suspend)(struct platform_device* dev, pm_message_t state);
69 int (*resume)(struct platform_device* dev);
70 int (*shutdown)(struct platform_device* dev);
71
72 struct device_driver driver;
73};
74#define to_of_platform_driver(drv) \
75 container_of(drv,struct of_platform_driver, driver)
76
77extern const struct of_device_id of_default_bus_match_table[]; 54extern const struct of_device_id of_default_bus_match_table[];
78 55
79/* Platform drivers register/unregister */ 56/* Platform drivers register/unregister */
@@ -82,7 +59,6 @@ extern struct platform_device *of_device_alloc(struct device_node *np,
82 struct device *parent); 59 struct device *parent);
83extern struct platform_device *of_find_device_by_node(struct device_node *np); 60extern struct platform_device *of_find_device_by_node(struct device_node *np);
84 61
85#ifdef CONFIG_OF_ADDRESS /* device reg helpers depend on OF_ADDRESS */
86/* Platform devices and busses creation */ 62/* Platform devices and busses creation */
87extern struct platform_device *of_platform_device_create(struct device_node *np, 63extern struct platform_device *of_platform_device_create(struct device_node *np,
88 const char *bus_id, 64 const char *bus_id,
@@ -91,17 +67,12 @@ extern struct platform_device *of_platform_device_create(struct device_node *np,
91extern int of_platform_bus_probe(struct device_node *root, 67extern int of_platform_bus_probe(struct device_node *root,
92 const struct of_device_id *matches, 68 const struct of_device_id *matches,
93 struct device *parent); 69 struct device *parent);
70#ifdef CONFIG_OF_ADDRESS
94extern int of_platform_populate(struct device_node *root, 71extern int of_platform_populate(struct device_node *root,
95 const struct of_device_id *matches, 72 const struct of_device_id *matches,
96 const struct of_dev_auxdata *lookup, 73 const struct of_dev_auxdata *lookup,
97 struct device *parent); 74 struct device *parent);
98#endif /* CONFIG_OF_ADDRESS */ 75#else
99
100#endif /* CONFIG_OF_DEVICE */
101
102#if !defined(CONFIG_OF_ADDRESS)
103struct of_dev_auxdata;
104struct device_node;
105static inline int of_platform_populate(struct device_node *root, 76static inline int of_platform_populate(struct device_node *root,
106 const struct of_device_id *matches, 77 const struct of_device_id *matches,
107 const struct of_dev_auxdata *lookup, 78 const struct of_dev_auxdata *lookup,
@@ -109,6 +80,6 @@ static inline int of_platform_populate(struct device_node *root,
109{ 80{
110 return -ENODEV; 81 return -ENODEV;
111} 82}
112#endif /* !CONFIG_OF_ADDRESS */ 83#endif
113 84
114#endif /* _LINUX_OF_PLATFORM_H */ 85#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/omap-mailbox.h b/include/linux/omap-mailbox.h
new file mode 100644
index 000000000000..f8322d9cd235
--- /dev/null
+++ b/include/linux/omap-mailbox.h
@@ -0,0 +1,29 @@
1/*
2 * omap-mailbox: interprocessor communication module for OMAP
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 OMAP_MAILBOX_H
10#define OMAP_MAILBOX_H
11
12typedef u32 mbox_msg_t;
13struct omap_mbox;
14
15typedef int __bitwise omap_mbox_irq_t;
16#define IRQ_TX ((__force omap_mbox_irq_t) 1)
17#define IRQ_RX ((__force omap_mbox_irq_t) 2)
18
19int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg);
20
21struct omap_mbox *omap_mbox_get(const char *, struct notifier_block *nb);
22void omap_mbox_put(struct omap_mbox *mbox, struct notifier_block *nb);
23
24void omap_mbox_save_ctx(struct omap_mbox *mbox);
25void omap_mbox_restore_ctx(struct omap_mbox *mbox);
26void omap_mbox_enable_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq);
27void omap_mbox_disable_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq);
28
29#endif /* OMAP_MAILBOX_H */
diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
index be655e4a2a75..2ee8cd2466b5 100644
--- a/include/linux/pageblock-flags.h
+++ b/include/linux/pageblock-flags.h
@@ -80,10 +80,4 @@ void set_pageblock_flags_group(struct page *page, unsigned long flags,
80 PB_migrate_skip) 80 PB_migrate_skip)
81#endif /* CONFIG_COMPACTION */ 81#endif /* CONFIG_COMPACTION */
82 82
83#define get_pageblock_flags(page) \
84 get_pageblock_flags_group(page, 0, PB_migrate_end)
85#define set_pageblock_flags(page, flags) \
86 set_pageblock_flags_group(page, flags, \
87 0, PB_migrate_end)
88
89#endif /* PAGEBLOCK_FLAGS_H */ 83#endif /* PAGEBLOCK_FLAGS_H */
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index 2aa12b8499c0..e4dbfab37729 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -21,7 +21,7 @@ struct pagevec {
21}; 21};
22 22
23void __pagevec_release(struct pagevec *pvec); 23void __pagevec_release(struct pagevec *pvec);
24void __pagevec_lru_add(struct pagevec *pvec, enum lru_list lru); 24void __pagevec_lru_add(struct pagevec *pvec);
25unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, 25unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping,
26 pgoff_t start, unsigned nr_pages); 26 pgoff_t start, unsigned nr_pages);
27unsigned pagevec_lookup_tag(struct pagevec *pvec, 27unsigned pagevec_lookup_tag(struct pagevec *pvec,
@@ -64,36 +64,4 @@ static inline void pagevec_release(struct pagevec *pvec)
64 __pagevec_release(pvec); 64 __pagevec_release(pvec);
65} 65}
66 66
67static inline void __pagevec_lru_add_anon(struct pagevec *pvec)
68{
69 __pagevec_lru_add(pvec, LRU_INACTIVE_ANON);
70}
71
72static inline void __pagevec_lru_add_active_anon(struct pagevec *pvec)
73{
74 __pagevec_lru_add(pvec, LRU_ACTIVE_ANON);
75}
76
77static inline void __pagevec_lru_add_file(struct pagevec *pvec)
78{
79 __pagevec_lru_add(pvec, LRU_INACTIVE_FILE);
80}
81
82static inline void __pagevec_lru_add_active_file(struct pagevec *pvec)
83{
84 __pagevec_lru_add(pvec, LRU_ACTIVE_FILE);
85}
86
87static inline void pagevec_lru_add_file(struct pagevec *pvec)
88{
89 if (pagevec_count(pvec))
90 __pagevec_lru_add_file(pvec);
91}
92
93static inline void pagevec_lru_add_anon(struct pagevec *pvec)
94{
95 if (pagevec_count(pvec))
96 __pagevec_lru_add_anon(pvec);
97}
98
99#endif /* _LINUX_PAGEVEC_H */ 67#endif /* _LINUX_PAGEVEC_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3a24e4ff3248..0fd1f1582fa1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -364,7 +364,8 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
364 return dev; 364 return dev;
365} 365}
366 366
367struct pci_dev *alloc_pci_dev(void); 367struct pci_dev *pci_alloc_dev(struct pci_bus *bus);
368struct pci_dev * __deprecated alloc_pci_dev(void);
368 369
369#define to_pci_dev(n) container_of(n, struct pci_dev, dev) 370#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
370#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) 371#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
@@ -1018,6 +1019,8 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
1018void pci_release_selected_regions(struct pci_dev *, int); 1019void pci_release_selected_regions(struct pci_dev *, int);
1019 1020
1020/* drivers/pci/bus.c */ 1021/* drivers/pci/bus.c */
1022struct pci_bus *pci_bus_get(struct pci_bus *bus);
1023void pci_bus_put(struct pci_bus *bus);
1021void pci_add_resource(struct list_head *resources, struct resource *res); 1024void pci_add_resource(struct list_head *resources, struct resource *res);
1022void pci_add_resource_offset(struct list_head *resources, struct resource *res, 1025void pci_add_resource_offset(struct list_head *resources, struct resource *res,
1023 resource_size_t offset); 1026 resource_size_t offset);
@@ -1643,6 +1646,7 @@ void pcibios_set_master(struct pci_dev *dev);
1643int pcibios_set_pcie_reset_state(struct pci_dev *dev, 1646int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1644 enum pcie_reset_state state); 1647 enum pcie_reset_state state);
1645int pcibios_add_device(struct pci_dev *dev); 1648int pcibios_add_device(struct pci_dev *dev);
1649void pcibios_release_device(struct pci_dev *dev);
1646 1650
1647#ifdef CONFIG_PCI_MMCONFIG 1651#ifdef CONFIG_PCI_MMCONFIG
1648void __init pci_mmcfg_early_init(void); 1652void __init pci_mmcfg_early_init(void);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index c12916248469..3bed2e89611b 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -556,7 +556,6 @@
556#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450 556#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450
557#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451 557#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451
558#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458 558#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458
559#define PCI_DEVICE_ID_AMD_HUDSON2_SMBUS 0x780b
560#define PCI_DEVICE_ID_AMD_CS5535_IDE 0x208F 559#define PCI_DEVICE_ID_AMD_CS5535_IDE 0x208F
561#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090 560#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090
562#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091 561#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091
@@ -568,8 +567,9 @@
568#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A 567#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
569#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081 568#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081
570#define PCI_DEVICE_ID_AMD_LX_AES 0x2082 569#define PCI_DEVICE_ID_AMD_LX_AES 0x2082
571#define PCI_DEVICE_ID_AMD_HUDSON2_IDE 0x780c
572#define PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE 0x7800 570#define PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE 0x7800
571#define PCI_DEVICE_ID_AMD_HUDSON2_SMBUS 0x780b
572#define PCI_DEVICE_ID_AMD_HUDSON2_IDE 0x780c
573 573
574#define PCI_VENDOR_ID_TRIDENT 0x1023 574#define PCI_VENDOR_ID_TRIDENT 0x1023
575#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 575#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
@@ -2476,6 +2476,9 @@
2476 2476
2477#define PCI_VENDOR_ID_ASMEDIA 0x1b21 2477#define PCI_VENDOR_ID_ASMEDIA 0x1b21
2478 2478
2479#define PCI_VENDOR_ID_CIRCUITCO 0x1cc8
2480#define PCI_SUBSYSTEM_ID_CIRCUITCO_MINNOWBOARD 0x0001
2481
2479#define PCI_VENDOR_ID_TEKRAM 0x1de1 2482#define PCI_VENDOR_ID_TEKRAM 0x1de1
2480#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 2483#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
2481 2484
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
new file mode 100644
index 000000000000..95961f0bf62d
--- /dev/null
+++ b/include/linux/percpu-refcount.h
@@ -0,0 +1,174 @@
1/*
2 * Percpu refcounts:
3 * (C) 2012 Google, Inc.
4 * Author: Kent Overstreet <koverstreet@google.com>
5 *
6 * This implements a refcount with similar semantics to atomic_t - atomic_inc(),
7 * atomic_dec_and_test() - but percpu.
8 *
9 * There's one important difference between percpu refs and normal atomic_t
10 * refcounts; you have to keep track of your initial refcount, and then when you
11 * start shutting down you call percpu_ref_kill() _before_ dropping the initial
12 * refcount.
13 *
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
16 * percpu_ref_kill()/PCPU_COUNT_BIAS.
17 *
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()
20 * puts the ref back in single atomic_t mode, collecting the per cpu refs and
21 * issuing the appropriate barriers, and then marks the ref as shutting down so
22 * that percpu_ref_put() will check for the ref hitting 0. After it returns,
23 * it's safe to drop the initial ref.
24 *
25 * USAGE:
26 *
27 * See fs/aio.c for some example usage; it's used there for struct kioctx, which
28 * is created when userspaces calls io_setup(), and destroyed when userspace
29 * calls io_destroy() or the process exits.
30 *
31 * In the aio code, kill_ioctx() is called when we wish to destroy a kioctx; it
32 * calls percpu_ref_kill(), then hlist_del_rcu() and sychronize_rcu() to remove
33 * the kioctx from the proccess's list of kioctxs - after that, there can't be
34 * any new users of the kioctx (from lookup_ioctx()) and it's then safe to drop
35 * the initial ref with percpu_ref_put().
36 *
37 * Code that does a two stage shutdown like this often needs some kind of
38 * explicit synchronization to ensure the initial refcount can only be dropped
39 * once - percpu_ref_kill() does this for you, it returns true once and false if
40 * someone else already called it. The aio code uses it this way, but it's not
41 * necessary if the code has some other mechanism to synchronize teardown.
42 * around.
43 */
44
45#ifndef _LINUX_PERCPU_REFCOUNT_H
46#define _LINUX_PERCPU_REFCOUNT_H
47
48#include <linux/atomic.h>
49#include <linux/kernel.h>
50#include <linux/percpu.h>
51#include <linux/rcupdate.h>
52
53struct percpu_ref;
54typedef void (percpu_ref_func_t)(struct percpu_ref *);
55
56struct percpu_ref {
57 atomic_t count;
58 /*
59 * The low bit of the pointer indicates whether the ref is in percpu
60 * mode; if set, then get/put will manipulate the atomic_t (this is a
61 * hack because we need to keep the pointer around for
62 * percpu_ref_kill_rcu())
63 */
64 unsigned __percpu *pcpu_count;
65 percpu_ref_func_t *release;
66 percpu_ref_func_t *confirm_kill;
67 struct rcu_head rcu;
68};
69
70int __must_check percpu_ref_init(struct percpu_ref *ref,
71 percpu_ref_func_t *release);
72void percpu_ref_cancel_init(struct percpu_ref *ref);
73void percpu_ref_kill_and_confirm(struct percpu_ref *ref,
74 percpu_ref_func_t *confirm_kill);
75
76/**
77 * percpu_ref_kill - drop the initial ref
78 * @ref: percpu_ref to kill
79 *
80 * Must be used to drop the initial ref on a percpu refcount; must be called
81 * precisely once before shutdown.
82 *
83 * Puts @ref in non percpu mode, then does a call_rcu() before gathering up the
84 * percpu counters and dropping the initial ref.
85 */
86static inline void percpu_ref_kill(struct percpu_ref *ref)
87{
88 return percpu_ref_kill_and_confirm(ref, NULL);
89}
90
91#define PCPU_STATUS_BITS 2
92#define PCPU_STATUS_MASK ((1 << PCPU_STATUS_BITS) - 1)
93#define PCPU_REF_PTR 0
94#define PCPU_REF_DEAD 1
95
96#define REF_STATUS(count) (((unsigned long) count) & PCPU_STATUS_MASK)
97
98/**
99 * percpu_ref_get - increment a percpu refcount
100 * @ref: percpu_ref to get
101 *
102 * Analagous to atomic_inc().
103 */
104static inline void percpu_ref_get(struct percpu_ref *ref)
105{
106 unsigned __percpu *pcpu_count;
107
108 rcu_read_lock_sched();
109
110 pcpu_count = ACCESS_ONCE(ref->pcpu_count);
111
112 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR))
113 __this_cpu_inc(*pcpu_count);
114 else
115 atomic_inc(&ref->count);
116
117 rcu_read_unlock_sched();
118}
119
120/**
121 * percpu_ref_tryget - try to increment a percpu refcount
122 * @ref: percpu_ref to try-get
123 *
124 * Increment a percpu refcount unless it has already been killed. Returns
125 * %true on success; %false on failure.
126 *
127 * Completion of percpu_ref_kill() in itself doesn't guarantee that tryget
128 * will fail. For such guarantee, percpu_ref_kill_and_confirm() should be
129 * used. After the confirm_kill callback is invoked, it's guaranteed that
130 * no new reference will be given out by percpu_ref_tryget().
131 */
132static inline bool percpu_ref_tryget(struct percpu_ref *ref)
133{
134 unsigned __percpu *pcpu_count;
135 int ret = false;
136
137 rcu_read_lock_sched();
138
139 pcpu_count = ACCESS_ONCE(ref->pcpu_count);
140
141 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) {
142 __this_cpu_inc(*pcpu_count);
143 ret = true;
144 }
145
146 rcu_read_unlock_sched();
147
148 return ret;
149}
150
151/**
152 * percpu_ref_put - decrement a percpu refcount
153 * @ref: percpu_ref to put
154 *
155 * Decrement the refcount, and if 0, call the release function (which was passed
156 * to percpu_ref_init())
157 */
158static inline void percpu_ref_put(struct percpu_ref *ref)
159{
160 unsigned __percpu *pcpu_count;
161
162 rcu_read_lock_sched();
163
164 pcpu_count = ACCESS_ONCE(ref->pcpu_count);
165
166 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR))
167 __this_cpu_dec(*pcpu_count);
168 else if (unlikely(atomic_dec_and_test(&ref->count)))
169 ref->release(ref);
170
171 rcu_read_unlock_sched();
172}
173
174#endif
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index c5b6dbf9c2fc..c43f6eabad5b 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -73,13 +73,18 @@ struct perf_raw_record {
73 * 73 *
74 * support for mispred, predicted is optional. In case it 74 * support for mispred, predicted is optional. In case it
75 * is not supported mispred = predicted = 0. 75 * is not supported mispred = predicted = 0.
76 *
77 * in_tx: running in a hardware transaction
78 * abort: aborting a hardware transaction
76 */ 79 */
77struct perf_branch_entry { 80struct perf_branch_entry {
78 __u64 from; 81 __u64 from;
79 __u64 to; 82 __u64 to;
80 __u64 mispred:1, /* target mispredicted */ 83 __u64 mispred:1, /* target mispredicted */
81 predicted:1,/* target predicted */ 84 predicted:1,/* target predicted */
82 reserved:62; 85 in_tx:1, /* in transaction */
86 abort:1, /* transaction abort */
87 reserved:60;
83}; 88};
84 89
85/* 90/*
@@ -113,6 +118,8 @@ struct hw_perf_event_extra {
113 int idx; /* index in shared_regs->regs[] */ 118 int idx; /* index in shared_regs->regs[] */
114}; 119};
115 120
121struct event_constraint;
122
116/** 123/**
117 * struct hw_perf_event - performance event hardware details: 124 * struct hw_perf_event - performance event hardware details:
118 */ 125 */
@@ -131,6 +138,8 @@ struct hw_perf_event {
131 138
132 struct hw_perf_event_extra extra_reg; 139 struct hw_perf_event_extra extra_reg;
133 struct hw_perf_event_extra branch_reg; 140 struct hw_perf_event_extra branch_reg;
141
142 struct event_constraint *constraint;
134 }; 143 };
135 struct { /* software */ 144 struct { /* software */
136 struct hrtimer hrtimer; 145 struct hrtimer hrtimer;
@@ -188,12 +197,13 @@ struct pmu {
188 197
189 struct device *dev; 198 struct device *dev;
190 const struct attribute_group **attr_groups; 199 const struct attribute_group **attr_groups;
191 char *name; 200 const char *name;
192 int type; 201 int type;
193 202
194 int * __percpu pmu_disable_count; 203 int * __percpu pmu_disable_count;
195 struct perf_cpu_context * __percpu pmu_cpu_context; 204 struct perf_cpu_context * __percpu pmu_cpu_context;
196 int task_ctx_nr; 205 int task_ctx_nr;
206 int hrtimer_interval_ms;
197 207
198 /* 208 /*
199 * Fully disable/enable this PMU, can be used to protect from the PMI 209 * Fully disable/enable this PMU, can be used to protect from the PMI
@@ -500,8 +510,9 @@ struct perf_cpu_context {
500 struct perf_event_context *task_ctx; 510 struct perf_event_context *task_ctx;
501 int active_oncpu; 511 int active_oncpu;
502 int exclusive; 512 int exclusive;
513 struct hrtimer hrtimer;
514 ktime_t hrtimer_interval;
503 struct list_head rotation_list; 515 struct list_head rotation_list;
504 int jiffies_interval;
505 struct pmu *unique_pmu; 516 struct pmu *unique_pmu;
506 struct perf_cgroup *cgrp; 517 struct perf_cgroup *cgrp;
507}; 518};
@@ -517,7 +528,7 @@ struct perf_output_handle {
517 528
518#ifdef CONFIG_PERF_EVENTS 529#ifdef CONFIG_PERF_EVENTS
519 530
520extern int perf_pmu_register(struct pmu *pmu, char *name, int type); 531extern int perf_pmu_register(struct pmu *pmu, const char *name, int type);
521extern void perf_pmu_unregister(struct pmu *pmu); 532extern void perf_pmu_unregister(struct pmu *pmu);
522 533
523extern int perf_num_counters(void); 534extern int perf_num_counters(void);
@@ -695,10 +706,17 @@ static inline void perf_callchain_store(struct perf_callchain_entry *entry, u64
695extern int sysctl_perf_event_paranoid; 706extern int sysctl_perf_event_paranoid;
696extern int sysctl_perf_event_mlock; 707extern int sysctl_perf_event_mlock;
697extern int sysctl_perf_event_sample_rate; 708extern int sysctl_perf_event_sample_rate;
709extern int sysctl_perf_cpu_time_max_percent;
710
711extern void perf_sample_event_took(u64 sample_len_ns);
698 712
699extern int perf_proc_update_handler(struct ctl_table *table, int write, 713extern int perf_proc_update_handler(struct ctl_table *table, int write,
700 void __user *buffer, size_t *lenp, 714 void __user *buffer, size_t *lenp,
701 loff_t *ppos); 715 loff_t *ppos);
716extern int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,
717 void __user *buffer, size_t *lenp,
718 loff_t *ppos);
719
702 720
703static inline bool perf_paranoid_tracepoint_raw(void) 721static inline bool perf_paranoid_tracepoint_raw(void)
704{ 722{
@@ -742,6 +760,7 @@ extern unsigned int perf_output_skip(struct perf_output_handle *handle,
742 unsigned int len); 760 unsigned int len);
743extern int perf_swevent_get_recursion_context(void); 761extern int perf_swevent_get_recursion_context(void);
744extern void perf_swevent_put_recursion_context(int rctx); 762extern void perf_swevent_put_recursion_context(int rctx);
763extern u64 perf_swevent_set_period(struct perf_event *event);
745extern void perf_event_enable(struct perf_event *event); 764extern void perf_event_enable(struct perf_event *event);
746extern void perf_event_disable(struct perf_event *event); 765extern void perf_event_disable(struct perf_event *event);
747extern int __perf_event_disable(void *info); 766extern int __perf_event_disable(void *info);
@@ -781,6 +800,7 @@ static inline void perf_event_fork(struct task_struct *tsk) { }
781static inline void perf_event_init(void) { } 800static inline void perf_event_init(void) { }
782static inline int perf_swevent_get_recursion_context(void) { return -1; } 801static inline int perf_swevent_get_recursion_context(void) { return -1; }
783static inline void perf_swevent_put_recursion_context(int rctx) { } 802static inline void perf_swevent_put_recursion_context(int rctx) { }
803static inline u64 perf_swevent_set_period(struct perf_event *event) { return 0; }
784static inline void perf_event_enable(struct perf_event *event) { } 804static inline void perf_event_enable(struct perf_event *event) { }
785static inline void perf_event_disable(struct perf_event *event) { } 805static inline void perf_event_disable(struct perf_event *event) { }
786static inline int __perf_event_disable(void *info) { return -1; } 806static inline int __perf_event_disable(void *info) { return -1; }
@@ -802,11 +822,11 @@ static inline void perf_restore_debug_store(void) { }
802#define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x)) 822#define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x))
803 823
804/* 824/*
805 * This has to have a higher priority than migration_notifier in sched.c. 825 * This has to have a higher priority than migration_notifier in sched/core.c.
806 */ 826 */
807#define perf_cpu_notifier(fn) \ 827#define perf_cpu_notifier(fn) \
808do { \ 828do { \
809 static struct notifier_block fn##_nb __cpuinitdata = \ 829 static struct notifier_block fn##_nb = \
810 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \ 830 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \
811 unsigned long cpu = smp_processor_id(); \ 831 unsigned long cpu = smp_processor_id(); \
812 unsigned long flags; \ 832 unsigned long flags; \
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 9e11039dd7a3..64ab823f7b74 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -49,6 +49,7 @@
49 49
50#define PHY_HAS_INTERRUPT 0x00000001 50#define PHY_HAS_INTERRUPT 0x00000001
51#define PHY_HAS_MAGICANEG 0x00000002 51#define PHY_HAS_MAGICANEG 0x00000002
52#define PHY_IS_INTERNAL 0x00000004
52 53
53/* Interface Mode definitions */ 54/* Interface Mode definitions */
54typedef enum { 55typedef enum {
@@ -57,6 +58,7 @@ typedef enum {
57 PHY_INTERFACE_MODE_GMII, 58 PHY_INTERFACE_MODE_GMII,
58 PHY_INTERFACE_MODE_SGMII, 59 PHY_INTERFACE_MODE_SGMII,
59 PHY_INTERFACE_MODE_TBI, 60 PHY_INTERFACE_MODE_TBI,
61 PHY_INTERFACE_MODE_REVMII,
60 PHY_INTERFACE_MODE_RMII, 62 PHY_INTERFACE_MODE_RMII,
61 PHY_INTERFACE_MODE_RGMII, 63 PHY_INTERFACE_MODE_RGMII,
62 PHY_INTERFACE_MODE_RGMII_ID, 64 PHY_INTERFACE_MODE_RGMII_ID,
@@ -261,6 +263,7 @@ struct phy_c45_device_ids {
261 * phy_id: UID for this device found during discovery 263 * phy_id: UID for this device found during discovery
262 * c45_ids: 802.3-c45 Device Identifers if is_c45. 264 * c45_ids: 802.3-c45 Device Identifers if is_c45.
263 * is_c45: Set to true if this phy uses clause 45 addressing. 265 * is_c45: Set to true if this phy uses clause 45 addressing.
266 * is_internal: Set to true if this phy is internal to a MAC.
264 * state: state of the PHY for management purposes 267 * state: state of the PHY for management purposes
265 * dev_flags: Device-specific flags used by the PHY driver. 268 * dev_flags: Device-specific flags used by the PHY driver.
266 * addr: Bus address of PHY 269 * addr: Bus address of PHY
@@ -298,6 +301,7 @@ struct phy_device {
298 301
299 struct phy_c45_device_ids c45_ids; 302 struct phy_c45_device_ids c45_ids;
300 bool is_c45; 303 bool is_c45;
304 bool is_internal;
301 305
302 enum phy_state state; 306 enum phy_state state;
303 307
@@ -508,6 +512,27 @@ static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)
508 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 512 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
509} 513}
510 514
515/**
516 * phy_interrupt_is_valid - Convenience function for testing a given PHY irq
517 * @phydev: the phy_device struct
518 *
519 * NOTE: must be kept in sync with addition/removal of PHY_POLL and
520 * PHY_IGNORE_INTERRUPT
521 */
522static inline bool phy_interrupt_is_valid(struct phy_device *phydev)
523{
524 return phydev->irq != PHY_POLL && phydev->irq != PHY_IGNORE_INTERRUPT;
525}
526
527/**
528 * phy_is_internal - Convenience function for testing if a PHY is internal
529 * @phydev: the phy_device struct
530 */
531static inline bool phy_is_internal(struct phy_device *phydev)
532{
533 return phydev->is_internal;
534}
535
511struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, 536struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
512 bool is_c45, struct phy_c45_device_ids *c45_ids); 537 bool is_c45, struct phy_c45_device_ids *c45_ids);
513struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); 538struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
@@ -545,6 +570,8 @@ void phy_drivers_unregister(struct phy_driver *drv, int n);
545int phy_driver_register(struct phy_driver *new_driver); 570int phy_driver_register(struct phy_driver *new_driver);
546int phy_drivers_register(struct phy_driver *new_driver, int n); 571int phy_drivers_register(struct phy_driver *new_driver, int n);
547void phy_state_machine(struct work_struct *work); 572void phy_state_machine(struct work_struct *work);
573void phy_change(struct work_struct *work);
574void phy_mac_interrupt(struct phy_device *phydev, int new_link);
548void phy_start_machine(struct phy_device *phydev, 575void phy_start_machine(struct phy_device *phydev,
549 void (*handler)(struct net_device *)); 576 void (*handler)(struct net_device *));
550void phy_stop_machine(struct phy_device *phydev); 577void phy_stop_machine(struct phy_device *phydev);
diff --git a/include/linux/pid.h b/include/linux/pid.h
index a089a3c447fc..23705a53abba 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -86,11 +86,9 @@ extern struct task_struct *get_pid_task(struct pid *pid, enum pid_type);
86extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type); 86extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type);
87 87
88/* 88/*
89 * attach_pid() and detach_pid() must be called with the tasklist_lock 89 * these helpers must be called with the tasklist_lock write-held.
90 * write-held.
91 */ 90 */
92extern void attach_pid(struct task_struct *task, enum pid_type type, 91extern void attach_pid(struct task_struct *task, enum pid_type);
93 struct pid *pid);
94extern void detach_pid(struct task_struct *task, enum pid_type); 92extern void detach_pid(struct task_struct *task, enum pid_type);
95extern void change_pid(struct task_struct *task, enum pid_type, 93extern void change_pid(struct task_struct *task, enum pid_type,
96 struct pid *pid); 94 struct pid *pid);
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 4aad3cea69ae..18eccefea06e 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -40,6 +40,25 @@ extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
40extern struct pinctrl * __must_check devm_pinctrl_get(struct device *dev); 40extern struct pinctrl * __must_check devm_pinctrl_get(struct device *dev);
41extern void devm_pinctrl_put(struct pinctrl *p); 41extern void devm_pinctrl_put(struct pinctrl *p);
42 42
43#ifdef CONFIG_PM
44extern int pinctrl_pm_select_default_state(struct device *dev);
45extern int pinctrl_pm_select_sleep_state(struct device *dev);
46extern int pinctrl_pm_select_idle_state(struct device *dev);
47#else
48static inline int pinctrl_pm_select_default_state(struct device *dev)
49{
50 return 0;
51}
52static inline int pinctrl_pm_select_sleep_state(struct device *dev)
53{
54 return 0;
55}
56static inline int pinctrl_pm_select_idle_state(struct device *dev)
57{
58 return 0;
59}
60#endif
61
43#else /* !CONFIG_PINCTRL */ 62#else /* !CONFIG_PINCTRL */
44 63
45static inline int pinctrl_request_gpio(unsigned gpio) 64static inline int pinctrl_request_gpio(unsigned gpio)
@@ -92,6 +111,21 @@ static inline void devm_pinctrl_put(struct pinctrl *p)
92{ 111{
93} 112}
94 113
114static inline int pinctrl_pm_select_default_state(struct device *dev)
115{
116 return 0;
117}
118
119static inline int pinctrl_pm_select_sleep_state(struct device *dev)
120{
121 return 0;
122}
123
124static inline int pinctrl_pm_select_idle_state(struct device *dev)
125{
126 return 0;
127}
128
95#endif /* CONFIG_PINCTRL */ 129#endif /* CONFIG_PINCTRL */
96 130
97static inline struct pinctrl * __must_check pinctrl_get_select( 131static inline struct pinctrl * __must_check pinctrl_get_select(
@@ -158,47 +192,4 @@ static inline struct pinctrl * __must_check devm_pinctrl_get_select_default(
158 return devm_pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT); 192 return devm_pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
159} 193}
160 194
161#ifdef CONFIG_PINCONF
162
163extern int pin_config_get(const char *dev_name, const char *name,
164 unsigned long *config);
165extern int pin_config_set(const char *dev_name, const char *name,
166 unsigned long config);
167extern int pin_config_group_get(const char *dev_name,
168 const char *pin_group,
169 unsigned long *config);
170extern int pin_config_group_set(const char *dev_name,
171 const char *pin_group,
172 unsigned long config);
173
174#else
175
176static inline int pin_config_get(const char *dev_name, const char *name,
177 unsigned long *config)
178{
179 return 0;
180}
181
182static inline int pin_config_set(const char *dev_name, const char *name,
183 unsigned long config)
184{
185 return 0;
186}
187
188static inline int pin_config_group_get(const char *dev_name,
189 const char *pin_group,
190 unsigned long *config)
191{
192 return 0;
193}
194
195static inline int pin_config_group_set(const char *dev_name,
196 const char *pin_group,
197 unsigned long config)
198{
199 return 0;
200}
201
202#endif
203
204#endif /* __LINUX_PINCTRL_CONSUMER_H */ 195#endif /* __LINUX_PINCTRL_CONSUMER_H */
diff --git a/include/linux/pinctrl/devinfo.h b/include/linux/pinctrl/devinfo.h
index 6e5f8a985ea7..281cb91ddcf5 100644
--- a/include/linux/pinctrl/devinfo.h
+++ b/include/linux/pinctrl/devinfo.h
@@ -28,6 +28,10 @@
28struct dev_pin_info { 28struct dev_pin_info {
29 struct pinctrl *p; 29 struct pinctrl *p;
30 struct pinctrl_state *default_state; 30 struct pinctrl_state *default_state;
31#ifdef CONFIG_PM
32 struct pinctrl_state *sleep_state;
33 struct pinctrl_state *idle_state;
34#endif
31}; 35};
32 36
33extern int pinctrl_bind_pins(struct device *dev); 37extern int pinctrl_bind_pins(struct device *dev);
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index 6aa238096622..bf7e989abcb5 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -29,12 +29,25 @@
29 * if for example some other pin is going to drive the signal connected 29 * if for example some other pin is going to drive the signal connected
30 * to it for a while. Pins used for input are usually always high 30 * to it for a while. Pins used for input are usually always high
31 * impedance. 31 * impedance.
32 * @PIN_CONFIG_BIAS_BUS_HOLD: the pin will be set to weakly latch so that it
33 * weakly drives the last value on a tristate bus, also known as a "bus
34 * holder", "bus keeper" or "repeater". This allows another device on the
35 * bus to change the value by driving the bus high or low and switching to
36 * tristate. The argument is ignored.
32 * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high 37 * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high
33 * impedance to VDD). If the argument is != 0 pull-up is enabled, 38 * impedance to VDD). If the argument is != 0 pull-up is enabled,
34 * if it is 0, pull-up is disabled. 39 * if it is 0, pull-up is total, i.e. the pin is connected to VDD.
35 * @PIN_CONFIG_BIAS_PULL_DOWN: the pin will be pulled down (usually with high 40 * @PIN_CONFIG_BIAS_PULL_DOWN: the pin will be pulled down (usually with high
36 * impedance to GROUND). If the argument is != 0 pull-down is enabled, 41 * impedance to GROUND). If the argument is != 0 pull-down is enabled,
37 * if it is 0, pull-down is disabled. 42 * if it is 0, pull-down is total, i.e. the pin is connected to GROUND.
43 * @PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: the pin will be pulled up or down based
44 * on embedded knowledge of the controller hardware, like current mux
45 * function. The pull direction and possibly strength too will normally
46 * be decided completely inside the hardware block and not be readable
47 * from the kernel side.
48 * If the argument is != 0 pull up/down is enabled, if it is 0, the
49 * configuration is ignored. The proper way to disable it is to use
50 * @PIN_CONFIG_BIAS_DISABLE.
38 * @PIN_CONFIG_DRIVE_PUSH_PULL: the pin will be driven actively high and 51 * @PIN_CONFIG_DRIVE_PUSH_PULL: the pin will be driven actively high and
39 * low, this is the most typical case and is typically achieved with two 52 * low, this is the most typical case and is typically achieved with two
40 * active transistors on the output. Setting this config will enable 53 * active transistors on the output. Setting this config will enable
@@ -57,14 +70,14 @@
57 * setting pins to this mode. 70 * setting pins to this mode.
58 * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode, 71 * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode,
59 * which means it will wait for signals to settle when reading inputs. The 72 * which means it will wait for signals to settle when reading inputs. The
60 * argument gives the debounce time on a custom format. Setting the 73 * argument gives the debounce time in usecs. Setting the
61 * argument to zero turns debouncing off. 74 * argument to zero turns debouncing off.
62 * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power 75 * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power
63 * supplies, the argument to this parameter (on a custom format) tells 76 * supplies, the argument to this parameter (on a custom format) tells
64 * the driver which alternative power source to use. 77 * the driver which alternative power source to use.
65 * @PIN_CONFIG_SLEW_RATE: if the pin can select slew rate, the argument to 78 * @PIN_CONFIG_SLEW_RATE: if the pin can select slew rate, the argument to
66 * this parameter (on a custom format) tells the driver which alternative 79 * this parameter (on a custom format) tells the driver which alternative
67 * slew rate to use. 80 * slew rate to use.
68 * @PIN_CONFIG_LOW_POWER_MODE: this will configure the pin for low power 81 * @PIN_CONFIG_LOW_POWER_MODE: this will configure the pin for low power
69 * operation, if several modes of operation are supported these can be 82 * operation, if several modes of operation are supported these can be
70 * passed in the argument on a custom form, else just use argument 1 83 * passed in the argument on a custom form, else just use argument 1
@@ -78,8 +91,10 @@
78enum pin_config_param { 91enum pin_config_param {
79 PIN_CONFIG_BIAS_DISABLE, 92 PIN_CONFIG_BIAS_DISABLE,
80 PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 93 PIN_CONFIG_BIAS_HIGH_IMPEDANCE,
94 PIN_CONFIG_BIAS_BUS_HOLD,
81 PIN_CONFIG_BIAS_PULL_UP, 95 PIN_CONFIG_BIAS_PULL_UP,
82 PIN_CONFIG_BIAS_PULL_DOWN, 96 PIN_CONFIG_BIAS_PULL_DOWN,
97 PIN_CONFIG_BIAS_PULL_PIN_DEFAULT,
83 PIN_CONFIG_DRIVE_PUSH_PULL, 98 PIN_CONFIG_DRIVE_PUSH_PULL,
84 PIN_CONFIG_DRIVE_OPEN_DRAIN, 99 PIN_CONFIG_DRIVE_OPEN_DRAIN,
85 PIN_CONFIG_DRIVE_OPEN_SOURCE, 100 PIN_CONFIG_DRIVE_OPEN_SOURCE,
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
index 1ad4f31ef6b8..f6998692bdc9 100644
--- a/include/linux/pinctrl/pinconf.h
+++ b/include/linux/pinctrl/pinconf.h
@@ -30,7 +30,7 @@ struct seq_file;
30 * @pin_config_set: configure an individual pin 30 * @pin_config_set: configure an individual pin
31 * @pin_config_group_get: get configurations for an entire pin group 31 * @pin_config_group_get: get configurations for an entire pin group
32 * @pin_config_group_set: configure all pins in a group 32 * @pin_config_group_set: configure all pins in a group
33 * @pin_config_group_dbg_set: optional debugfs to modify a pin configuration 33 * @pin_config_dbg_parse_modify: optional debugfs to modify a pin configuration
34 * @pin_config_dbg_show: optional debugfs display hook that will provide 34 * @pin_config_dbg_show: optional debugfs display hook that will provide
35 * per-device info for a certain pin in debugfs 35 * per-device info for a certain pin in debugfs
36 * @pin_config_group_dbg_show: optional debugfs display hook that will provide 36 * @pin_config_group_dbg_show: optional debugfs display hook that will provide
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 2c2a9e8d8578..5979147d2bda 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -49,7 +49,8 @@ struct pinctrl_pin_desc {
49 * @name: a name for the chip in this range 49 * @name: a name for the chip in this range
50 * @id: an ID number for the chip in this range 50 * @id: an ID number for the chip in this range
51 * @base: base offset of the GPIO range 51 * @base: base offset of the GPIO range
52 * @pin_base: base pin number of the GPIO range 52 * @pin_base: base pin number of the GPIO range if pins == NULL
53 * @pins: enumeration of pins in GPIO range or NULL
53 * @npins: number of pins in the GPIO range, including the base number 54 * @npins: number of pins in the GPIO range, including the base number
54 * @gc: an optional pointer to a gpio_chip 55 * @gc: an optional pointer to a gpio_chip
55 */ 56 */
@@ -59,6 +60,7 @@ struct pinctrl_gpio_range {
59 unsigned int id; 60 unsigned int id;
60 unsigned int base; 61 unsigned int base;
61 unsigned int pin_base; 62 unsigned int pin_base;
63 unsigned const *pins;
62 unsigned int npins; 64 unsigned int npins;
63 struct gpio_chip *gc; 65 struct gpio_chip *gc;
64}; 66};
diff --git a/include/linux/platform_data/ad7303.h b/include/linux/platform_data/ad7303.h
new file mode 100644
index 000000000000..de6a7a6b4bbf
--- /dev/null
+++ b/include/linux/platform_data/ad7303.h
@@ -0,0 +1,21 @@
1/*
2 * Analog Devices AD7303 DAC driver
3 *
4 * Copyright 2013 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2.
7 */
8
9#ifndef __IIO_ADC_AD7303_H__
10#define __IIO_ADC_AD7303_H__
11
12/**
13 * struct ad7303_platform_data - AD7303 platform data
14 * @use_external_ref: If set to true use an external voltage reference connected
15 * to the REF pin, otherwise use the internal reference derived from Vdd.
16 */
17struct ad7303_platform_data {
18 bool use_external_ref;
19};
20
21#endif
diff --git a/include/linux/platform_data/brcmfmac-sdio.h b/include/linux/platform_data/brcmfmac-sdio.h
index 1ade657d5fc1..b7174998c24a 100644
--- a/include/linux/platform_data/brcmfmac-sdio.h
+++ b/include/linux/platform_data/brcmfmac-sdio.h
@@ -90,6 +90,10 @@ void __init brcmfmac_init_pdata(void)
90 * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are 90 * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are
91 * used for registering the irq using request_irq function. 91 * used for registering the irq using request_irq function.
92 * 92 *
93 * broken_sg_support: flag for broken sg list support of SDIO host controller.
94 * Set this to true if the SDIO host controller has higher align requirement
95 * than 32 bytes for each scatterlist item.
96 *
93 * power_on: This function is called by the brcmfmac when the module gets 97 * power_on: This function is called by the brcmfmac when the module gets
94 * loaded. This can be particularly useful for low power devices. The platform 98 * loaded. This can be particularly useful for low power devices. The platform
95 * spcific routine may for example decide to power up the complete device. 99 * spcific routine may for example decide to power up the complete device.
@@ -116,6 +120,7 @@ struct brcmfmac_sdio_platform_data {
116 bool oob_irq_supported; 120 bool oob_irq_supported;
117 unsigned int oob_irq_nr; 121 unsigned int oob_irq_nr;
118 unsigned long oob_irq_flags; 122 unsigned long oob_irq_flags;
123 bool broken_sg_support;
119 void (*power_on)(void); 124 void (*power_on)(void);
120 void (*power_off)(void); 125 void (*power_off)(void);
121 void (*reset)(void); 126 void (*reset)(void);
diff --git a/include/linux/platform_data/clk-ux500.h b/include/linux/platform_data/clk-ux500.h
index 320d9c39ea0a..9d98f3aaa16c 100644
--- a/include/linux/platform_data/clk-ux500.h
+++ b/include/linux/platform_data/clk-ux500.h
@@ -12,7 +12,9 @@
12 12
13void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base, 13void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
14 u32 clkrst5_base, u32 clkrst6_base); 14 u32 clkrst5_base, u32 clkrst6_base);
15void u9540_clk_init(void); 15void u9540_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
16void u8540_clk_init(void); 16 u32 clkrst5_base, u32 clkrst6_base);
17void u8540_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
18 u32 clkrst5_base, u32 clkrst6_base);
17 19
18#endif /* __CLK_UX500_H */ 20#endif /* __CLK_UX500_H */
diff --git a/include/linux/platform_data/cyttsp4.h b/include/linux/platform_data/cyttsp4.h
new file mode 100644
index 000000000000..6eba54aff1dc
--- /dev/null
+++ b/include/linux/platform_data/cyttsp4.h
@@ -0,0 +1,76 @@
1/*
2 * Header file for:
3 * Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers.
4 * For use with Cypress Txx3xx parts.
5 * Supported parts include:
6 * CY8CTST341
7 * CY8CTMA340
8 *
9 * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
10 * Copyright (C) 2012 Javier Martinez Canillas <javier@dowhile0.org>
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 * version 2, and only version 2, as published by the
15 * Free Software Foundation.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 *
26 * Contact Cypress Semiconductor at www.cypress.com (kev@cypress.com)
27 *
28 */
29#ifndef _CYTTSP4_H_
30#define _CYTTSP4_H_
31
32#define CYTTSP4_MT_NAME "cyttsp4_mt"
33#define CYTTSP4_I2C_NAME "cyttsp4_i2c_adapter"
34#define CYTTSP4_SPI_NAME "cyttsp4_spi_adapter"
35
36#define CY_TOUCH_SETTINGS_MAX 32
37
38struct touch_framework {
39 const uint16_t *abs;
40 uint8_t size;
41 uint8_t enable_vkeys;
42} __packed;
43
44struct cyttsp4_mt_platform_data {
45 struct touch_framework *frmwrk;
46 unsigned short flags;
47 char const *inp_dev_name;
48};
49
50struct touch_settings {
51 const uint8_t *data;
52 uint32_t size;
53 uint8_t tag;
54} __packed;
55
56struct cyttsp4_core_platform_data {
57 int irq_gpio;
58 int rst_gpio;
59 int level_irq_udelay;
60 int (*xres)(struct cyttsp4_core_platform_data *pdata,
61 struct device *dev);
62 int (*init)(struct cyttsp4_core_platform_data *pdata,
63 int on, struct device *dev);
64 int (*power)(struct cyttsp4_core_platform_data *pdata,
65 int on, struct device *dev, atomic_t *ignore_irq);
66 int (*irq_stat)(struct cyttsp4_core_platform_data *pdata,
67 struct device *dev);
68 struct touch_settings *sett[CY_TOUCH_SETTINGS_MAX];
69};
70
71struct cyttsp4_platform_data {
72 struct cyttsp4_core_platform_data *core_pdata;
73 struct cyttsp4_mt_platform_data *mt_pdata;
74};
75
76#endif /* _CYTTSP4_H_ */
diff --git a/include/linux/platform_data/dma-atmel.h b/include/linux/platform_data/dma-atmel.h
index cab0997be3de..e95f19c65873 100644
--- a/include/linux/platform_data/dma-atmel.h
+++ b/include/linux/platform_data/dma-atmel.h
@@ -35,16 +35,20 @@ struct at_dma_slave {
35 35
36 36
37/* Platform-configurable bits in CFG */ 37/* Platform-configurable bits in CFG */
38#define ATC_PER_MSB(h) ((0x30U & (h)) >> 4) /* Extract most significant bits of a handshaking identifier */
39
38#define ATC_SRC_PER(h) (0xFU & (h)) /* Channel src rq associated with periph handshaking ifc h */ 40#define ATC_SRC_PER(h) (0xFU & (h)) /* Channel src rq associated with periph handshaking ifc h */
39#define ATC_DST_PER(h) ((0xFU & (h)) << 4) /* Channel dst rq associated with periph handshaking ifc h */ 41#define ATC_DST_PER(h) ((0xFU & (h)) << 4) /* Channel dst rq associated with periph handshaking ifc h */
40#define ATC_SRC_REP (0x1 << 8) /* Source Replay Mod */ 42#define ATC_SRC_REP (0x1 << 8) /* Source Replay Mod */
41#define ATC_SRC_H2SEL (0x1 << 9) /* Source Handshaking Mod */ 43#define ATC_SRC_H2SEL (0x1 << 9) /* Source Handshaking Mod */
42#define ATC_SRC_H2SEL_SW (0x0 << 9) 44#define ATC_SRC_H2SEL_SW (0x0 << 9)
43#define ATC_SRC_H2SEL_HW (0x1 << 9) 45#define ATC_SRC_H2SEL_HW (0x1 << 9)
46#define ATC_SRC_PER_MSB(h) (ATC_PER_MSB(h) << 10) /* Channel src rq (most significant bits) */
44#define ATC_DST_REP (0x1 << 12) /* Destination Replay Mod */ 47#define ATC_DST_REP (0x1 << 12) /* Destination Replay Mod */
45#define ATC_DST_H2SEL (0x1 << 13) /* Destination Handshaking Mod */ 48#define ATC_DST_H2SEL (0x1 << 13) /* Destination Handshaking Mod */
46#define ATC_DST_H2SEL_SW (0x0 << 13) 49#define ATC_DST_H2SEL_SW (0x0 << 13)
47#define ATC_DST_H2SEL_HW (0x1 << 13) 50#define ATC_DST_H2SEL_HW (0x1 << 13)
51#define ATC_DST_PER_MSB(h) (ATC_PER_MSB(h) << 14) /* Channel dst rq (most significant bits) */
48#define ATC_SOD (0x1 << 16) /* Stop On Done */ 52#define ATC_SOD (0x1 << 16) /* Stop On Done */
49#define ATC_LOCK_IF (0x1 << 20) /* Interface Lock */ 53#define ATC_LOCK_IF (0x1 << 20) /* Interface Lock */
50#define ATC_LOCK_B (0x1 << 21) /* AHB Bus Lock */ 54#define ATC_LOCK_B (0x1 << 21) /* AHB Bus Lock */
diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h
index f6d30cc1cb77..beac6b8b6a7b 100644
--- a/include/linux/platform_data/dma-imx.h
+++ b/include/linux/platform_data/dma-imx.h
@@ -60,10 +60,8 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan)
60 60
61static inline int imx_dma_is_general_purpose(struct dma_chan *chan) 61static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
62{ 62{
63 return strstr(dev_name(chan->device->dev), "sdma") || 63 return !strcmp(chan->device->dev->driver->name, "imx-sdma") ||
64 !strcmp(dev_name(chan->device->dev), "imx1-dma") || 64 !strcmp(chan->device->dev->driver->name, "imx-dma");
65 !strcmp(dev_name(chan->device->dev), "imx21-dma") ||
66 !strcmp(dev_name(chan->device->dev), "imx27-dma");
67} 65}
68 66
69#endif 67#endif
diff --git a/include/linux/platform_data/dma-ste-dma40.h b/include/linux/platform_data/dma-ste-dma40.h
index 4b781014b0a0..1bb9b1852256 100644
--- a/include/linux/platform_data/dma-ste-dma40.h
+++ b/include/linux/platform_data/dma-ste-dma40.h
@@ -70,23 +70,8 @@ enum stedma40_flow_ctrl {
70 STEDMA40_FLOW_CTRL, 70 STEDMA40_FLOW_CTRL,
71}; 71};
72 72
73enum stedma40_periph_data_width {
74 STEDMA40_BYTE_WIDTH = STEDMA40_ESIZE_8_BIT,
75 STEDMA40_HALFWORD_WIDTH = STEDMA40_ESIZE_16_BIT,
76 STEDMA40_WORD_WIDTH = STEDMA40_ESIZE_32_BIT,
77 STEDMA40_DOUBLEWORD_WIDTH = STEDMA40_ESIZE_64_BIT
78};
79
80enum stedma40_xfer_dir {
81 STEDMA40_MEM_TO_MEM = 1,
82 STEDMA40_MEM_TO_PERIPH,
83 STEDMA40_PERIPH_TO_MEM,
84 STEDMA40_PERIPH_TO_PERIPH
85};
86
87
88/** 73/**
89 * struct stedma40_chan_cfg - dst/src channel configuration 74 * struct stedma40_half_channel_info - dst/src channel configuration
90 * 75 *
91 * @big_endian: true if the src/dst should be read as big endian 76 * @big_endian: true if the src/dst should be read as big endian
92 * @data_width: Data width of the src/dst hardware 77 * @data_width: Data width of the src/dst hardware
@@ -95,7 +80,7 @@ enum stedma40_xfer_dir {
95 */ 80 */
96struct stedma40_half_channel_info { 81struct stedma40_half_channel_info {
97 bool big_endian; 82 bool big_endian;
98 enum stedma40_periph_data_width data_width; 83 enum dma_slave_buswidth data_width;
99 int psize; 84 int psize;
100 enum stedma40_flow_ctrl flow_ctrl; 85 enum stedma40_flow_ctrl flow_ctrl;
101}; 86};
@@ -109,8 +94,7 @@ struct stedma40_half_channel_info {
109 * version 3+, i.e DB8500v2+ 94 * version 3+, i.e DB8500v2+
110 * @mode: channel mode: physical, logical, or operation 95 * @mode: channel mode: physical, logical, or operation
111 * @mode_opt: options for the chosen channel mode 96 * @mode_opt: options for the chosen channel mode
112 * @src_dev_type: Src device type 97 * @dev_type: src/dst device type (driver uses dir to figure out which)
113 * @dst_dev_type: Dst device type
114 * @src_info: Parameters for dst half channel 98 * @src_info: Parameters for dst half channel
115 * @dst_info: Parameters for dst half channel 99 * @dst_info: Parameters for dst half channel
116 * @use_fixed_channel: if true, use physical channel specified by phy_channel 100 * @use_fixed_channel: if true, use physical channel specified by phy_channel
@@ -121,13 +105,12 @@ struct stedma40_half_channel_info {
121 * 105 *
122 */ 106 */
123struct stedma40_chan_cfg { 107struct stedma40_chan_cfg {
124 enum stedma40_xfer_dir dir; 108 enum dma_transfer_direction dir;
125 bool high_priority; 109 bool high_priority;
126 bool realtime; 110 bool realtime;
127 enum stedma40_mode mode; 111 enum stedma40_mode mode;
128 enum stedma40_mode_opt mode_opt; 112 enum stedma40_mode_opt mode_opt;
129 int src_dev_type; 113 int dev_type;
130 int dst_dev_type;
131 struct stedma40_half_channel_info src_info; 114 struct stedma40_half_channel_info src_info;
132 struct stedma40_half_channel_info dst_info; 115 struct stedma40_half_channel_info dst_info;
133 116
@@ -138,13 +121,8 @@ struct stedma40_chan_cfg {
138/** 121/**
139 * struct stedma40_platform_data - Configuration struct for the dma device. 122 * struct stedma40_platform_data - Configuration struct for the dma device.
140 * 123 *
141 * @dev_len: length of dev_tx and dev_rx
142 * @dev_tx: mapping between destination event line and io address 124 * @dev_tx: mapping between destination event line and io address
143 * @dev_rx: mapping between source event line and io address 125 * @dev_rx: mapping between source event line and io address
144 * @memcpy: list of memcpy event lines
145 * @memcpy_len: length of memcpy
146 * @memcpy_conf_phy: default configuration of physical channel memcpy
147 * @memcpy_conf_log: default configuration of logical channel memcpy
148 * @disabled_channels: A vector, ending with -1, that marks physical channels 126 * @disabled_channels: A vector, ending with -1, that marks physical channels
149 * that are for different reasons not available for the driver. 127 * that are for different reasons not available for the driver.
150 * @soft_lli_chans: A vector, that marks physical channels will use LLI by SW 128 * @soft_lli_chans: A vector, that marks physical channels will use LLI by SW
@@ -154,22 +132,17 @@ struct stedma40_chan_cfg {
154 * @num_of_soft_lli_chans: The number of channels that needs to be configured 132 * @num_of_soft_lli_chans: The number of channels that needs to be configured
155 * to use SoftLLI. 133 * to use SoftLLI.
156 * @use_esram_lcla: flag for mapping the lcla into esram region 134 * @use_esram_lcla: flag for mapping the lcla into esram region
135 * @num_of_memcpy_chans: The number of channels reserved for memcpy.
157 * @num_of_phy_chans: The number of physical channels implemented in HW. 136 * @num_of_phy_chans: The number of physical channels implemented in HW.
158 * 0 means reading the number of channels from DMA HW but this is only valid 137 * 0 means reading the number of channels from DMA HW but this is only valid
159 * for 'multiple of 4' channels, like 8. 138 * for 'multiple of 4' channels, like 8.
160 */ 139 */
161struct stedma40_platform_data { 140struct stedma40_platform_data {
162 u32 dev_len;
163 const dma_addr_t *dev_tx;
164 const dma_addr_t *dev_rx;
165 int *memcpy;
166 u32 memcpy_len;
167 struct stedma40_chan_cfg *memcpy_conf_phy;
168 struct stedma40_chan_cfg *memcpy_conf_log;
169 int disabled_channels[STEDMA40_MAX_PHYS]; 141 int disabled_channels[STEDMA40_MAX_PHYS];
170 int *soft_lli_chans; 142 int *soft_lli_chans;
171 int num_of_soft_lli_chans; 143 int num_of_soft_lli_chans;
172 bool use_esram_lcla; 144 bool use_esram_lcla;
145 int num_of_memcpy_chans;
173 int num_of_phy_chans; 146 int num_of_phy_chans;
174}; 147};
175 148
diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h
new file mode 100644
index 000000000000..57300fd7cc03
--- /dev/null
+++ b/include/linux/platform_data/edma.h
@@ -0,0 +1,183 @@
1/*
2 * TI EDMA definitions
3 *
4 * Copyright (C) 2006-2013 Texas Instruments.
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
12/*
13 * This EDMA3 programming framework exposes two basic kinds of resource:
14 *
15 * Channel Triggers transfers, usually from a hardware event but
16 * also manually or by "chaining" from DMA completions.
17 * Each channel is coupled to a Parameter RAM (PaRAM) slot.
18 *
19 * Slot Each PaRAM slot holds a DMA transfer descriptor (PaRAM
20 * "set"), source and destination addresses, a link to a
21 * next PaRAM slot (if any), options for the transfer, and
22 * instructions for updating those addresses. There are
23 * more than twice as many slots as event channels.
24 *
25 * Each PaRAM set describes a sequence of transfers, either for one large
26 * buffer or for several discontiguous smaller buffers. An EDMA transfer
27 * is driven only from a channel, which performs the transfers specified
28 * in its PaRAM slot until there are no more transfers. When that last
29 * transfer completes, the "link" field may be used to reload the channel's
30 * PaRAM slot with a new transfer descriptor.
31 *
32 * The EDMA Channel Controller (CC) maps requests from channels into physical
33 * Transfer Controller (TC) requests when the channel triggers (by hardware
34 * or software events, or by chaining). The two physical DMA channels provided
35 * by the TCs are thus shared by many logical channels.
36 *
37 * DaVinci hardware also has a "QDMA" mechanism which is not currently
38 * supported through this interface. (DSP firmware uses it though.)
39 */
40
41#ifndef EDMA_H_
42#define EDMA_H_
43
44/* PaRAM slots are laid out like this */
45struct edmacc_param {
46 unsigned int opt;
47 unsigned int src;
48 unsigned int a_b_cnt;
49 unsigned int dst;
50 unsigned int src_dst_bidx;
51 unsigned int link_bcntrld;
52 unsigned int src_dst_cidx;
53 unsigned int ccnt;
54};
55
56/* fields in edmacc_param.opt */
57#define SAM BIT(0)
58#define DAM BIT(1)
59#define SYNCDIM BIT(2)
60#define STATIC BIT(3)
61#define EDMA_FWID (0x07 << 8)
62#define TCCMODE BIT(11)
63#define EDMA_TCC(t) ((t) << 12)
64#define TCINTEN BIT(20)
65#define ITCINTEN BIT(21)
66#define TCCHEN BIT(22)
67#define ITCCHEN BIT(23)
68
69/*ch_status paramater of callback function possible values*/
70#define DMA_COMPLETE 1
71#define DMA_CC_ERROR 2
72#define DMA_TC1_ERROR 3
73#define DMA_TC2_ERROR 4
74
75enum address_mode {
76 INCR = 0,
77 FIFO = 1
78};
79
80enum fifo_width {
81 W8BIT = 0,
82 W16BIT = 1,
83 W32BIT = 2,
84 W64BIT = 3,
85 W128BIT = 4,
86 W256BIT = 5
87};
88
89enum dma_event_q {
90 EVENTQ_0 = 0,
91 EVENTQ_1 = 1,
92 EVENTQ_2 = 2,
93 EVENTQ_3 = 3,
94 EVENTQ_DEFAULT = -1
95};
96
97enum sync_dimension {
98 ASYNC = 0,
99 ABSYNC = 1
100};
101
102#define EDMA_CTLR_CHAN(ctlr, chan) (((ctlr) << 16) | (chan))
103#define EDMA_CTLR(i) ((i) >> 16)
104#define EDMA_CHAN_SLOT(i) ((i) & 0xffff)
105
106#define EDMA_CHANNEL_ANY -1 /* for edma_alloc_channel() */
107#define EDMA_SLOT_ANY -1 /* for edma_alloc_slot() */
108#define EDMA_CONT_PARAMS_ANY 1001
109#define EDMA_CONT_PARAMS_FIXED_EXACT 1002
110#define EDMA_CONT_PARAMS_FIXED_NOT_EXACT 1003
111
112#define EDMA_MAX_CC 2
113
114/* alloc/free DMA channels and their dedicated parameter RAM slots */
115int edma_alloc_channel(int channel,
116 void (*callback)(unsigned channel, u16 ch_status, void *data),
117 void *data, enum dma_event_q);
118void edma_free_channel(unsigned channel);
119
120/* alloc/free parameter RAM slots */
121int edma_alloc_slot(unsigned ctlr, int slot);
122void edma_free_slot(unsigned slot);
123
124/* alloc/free a set of contiguous parameter RAM slots */
125int edma_alloc_cont_slots(unsigned ctlr, unsigned int id, int slot, int count);
126int edma_free_cont_slots(unsigned slot, int count);
127
128/* calls that operate on part of a parameter RAM slot */
129void edma_set_src(unsigned slot, dma_addr_t src_port,
130 enum address_mode mode, enum fifo_width);
131void edma_set_dest(unsigned slot, dma_addr_t dest_port,
132 enum address_mode mode, enum fifo_width);
133void edma_get_position(unsigned slot, dma_addr_t *src, dma_addr_t *dst);
134void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx);
135void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx);
136void edma_set_transfer_params(unsigned slot, u16 acnt, u16 bcnt, u16 ccnt,
137 u16 bcnt_rld, enum sync_dimension sync_mode);
138void edma_link(unsigned from, unsigned to);
139void edma_unlink(unsigned from);
140
141/* calls that operate on an entire parameter RAM slot */
142void edma_write_slot(unsigned slot, const struct edmacc_param *params);
143void edma_read_slot(unsigned slot, struct edmacc_param *params);
144
145/* channel control operations */
146int edma_start(unsigned channel);
147void edma_stop(unsigned channel);
148void edma_clean_channel(unsigned channel);
149void edma_clear_event(unsigned channel);
150void edma_pause(unsigned channel);
151void edma_resume(unsigned channel);
152
153struct edma_rsv_info {
154
155 const s16 (*rsv_chans)[2];
156 const s16 (*rsv_slots)[2];
157};
158
159/* platform_data for EDMA driver */
160struct edma_soc_info {
161
162 /* how many dma resources of each type */
163 unsigned n_channel;
164 unsigned n_region;
165 unsigned n_slot;
166 unsigned n_tc;
167 unsigned n_cc;
168 /*
169 * Default queue is expected to be a low-priority queue.
170 * This way, long transfers on the default queue started
171 * by the codec engine will not cause audio defects.
172 */
173 enum dma_event_q default_queue;
174
175 /* Resource reservation for other cores */
176 struct edma_rsv_info *rsv;
177
178 s8 (*queue_tc_mapping)[2];
179 s8 (*queue_priority_mapping)[2];
180 const s16 (*xbar_chans)[2];
181};
182
183#endif
diff --git a/include/linux/platform_data/g762.h b/include/linux/platform_data/g762.h
new file mode 100644
index 000000000000..d3c51283764d
--- /dev/null
+++ b/include/linux/platform_data/g762.h
@@ -0,0 +1,37 @@
1/*
2 * Platform data structure for g762 fan controller driver
3 *
4 * Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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#ifndef __LINUX_PLATFORM_DATA_G762_H__
21#define __LINUX_PLATFORM_DATA_G762_H__
22
23/*
24 * Following structure can be used to set g762 driver platform specific data
25 * during board init. Note that passing a sparse structure is possible but
26 * will result in non-specified attributes to be set to default value, hence
27 * overloading those installed during boot (e.g. by u-boot).
28 */
29
30struct g762_platform_data {
31 u32 fan_startv;
32 u32 fan_gear_mode;
33 u32 pwm_polarity;
34 u32 clk_freq;
35};
36
37#endif /* __LINUX_PLATFORM_DATA_G762_H__ */
diff --git a/include/linux/platform_data/gpio-rcar.h b/include/linux/platform_data/gpio-rcar.h
index b253f77a7ddf..2d8d69432813 100644
--- a/include/linux/platform_data/gpio-rcar.h
+++ b/include/linux/platform_data/gpio-rcar.h
@@ -17,10 +17,13 @@
17#define __GPIO_RCAR_H__ 17#define __GPIO_RCAR_H__
18 18
19struct gpio_rcar_config { 19struct gpio_rcar_config {
20 unsigned int gpio_base; 20 int gpio_base;
21 unsigned int irq_base; 21 unsigned int irq_base;
22 unsigned int number_of_pins; 22 unsigned int number_of_pins;
23 const char *pctl_name; 23 const char *pctl_name;
24 unsigned has_both_edge_trigger:1;
24}; 25};
25 26
27#define RCAR_GP_PIN(bank, pin) (((bank) * 32) + (pin))
28
26#endif /* __GPIO_RCAR_H__ */ 29#endif /* __GPIO_RCAR_H__ */
diff --git a/include/linux/platform_data/keypad-pxa27x.h b/include/linux/platform_data/keypad-pxa27x.h
index 5ce8d5e6ea51..24625569d16d 100644
--- a/include/linux/platform_data/keypad-pxa27x.h
+++ b/include/linux/platform_data/keypad-pxa27x.h
@@ -36,10 +36,9 @@
36struct pxa27x_keypad_platform_data { 36struct pxa27x_keypad_platform_data {
37 37
38 /* code map for the matrix keys */ 38 /* code map for the matrix keys */
39 const struct matrix_keymap_data *matrix_keymap_data;
39 unsigned int matrix_key_rows; 40 unsigned int matrix_key_rows;
40 unsigned int matrix_key_cols; 41 unsigned int matrix_key_cols;
41 unsigned int *matrix_key_map;
42 int matrix_key_map_size;
43 42
44 /* direct keys */ 43 /* direct keys */
45 int direct_key_num; 44 int direct_key_num;
diff --git a/include/linux/platform_data/mailbox-omap.h b/include/linux/platform_data/mailbox-omap.h
new file mode 100644
index 000000000000..4631dbb4255e
--- /dev/null
+++ b/include/linux/platform_data/mailbox-omap.h
@@ -0,0 +1,58 @@
1/*
2 * mailbox-omap.h
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef _PLAT_MAILBOX_H
17#define _PLAT_MAILBOX_H
18
19/* Interrupt register configuration types */
20#define MBOX_INTR_CFG_TYPE1 (0)
21#define MBOX_INTR_CFG_TYPE2 (1)
22
23/**
24 * struct omap_mbox_dev_info - OMAP mailbox device attribute info
25 * @name: name of the mailbox device
26 * @tx_id: mailbox queue id used for transmitting messages
27 * @rx_id: mailbox queue id on which messages are received
28 * @irq_id: irq identifier number to use from the hwmod data
29 * @usr_id: mailbox user id for identifying the interrupt into
30 * the MPU interrupt controller.
31 */
32struct omap_mbox_dev_info {
33 const char *name;
34 u32 tx_id;
35 u32 rx_id;
36 u32 irq_id;
37 u32 usr_id;
38};
39
40/**
41 * struct omap_mbox_pdata - OMAP mailbox platform data
42 * @intr_type: type of interrupt configuration registers used
43 while programming mailbox queue interrupts
44 * @num_users: number of users (processor devices) that the mailbox
45 * h/w block can interrupt
46 * @num_fifos: number of h/w fifos within the mailbox h/w block
47 * @info_cnt: number of mailbox devices for the platform
48 * @info: array of mailbox device attributes
49 */
50struct omap_mbox_pdata {
51 u32 intr_type;
52 u32 num_users;
53 u32 num_fifos;
54 u32 info_cnt;
55 struct omap_mbox_dev_info *info;
56};
57
58#endif /* _PLAT_MAILBOX_H */
diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h
index b4a0521ce411..d44912d81578 100644
--- a/include/linux/platform_data/mmc-esdhc-imx.h
+++ b/include/linux/platform_data/mmc-esdhc-imx.h
@@ -40,5 +40,6 @@ struct esdhc_platform_data {
40 enum wp_types wp_type; 40 enum wp_types wp_type;
41 enum cd_types cd_type; 41 enum cd_types cd_type;
42 int max_bus_width; 42 int max_bus_width;
43 unsigned int f_max;
43}; 44};
44#endif /* __ASM_ARCH_IMX_ESDHC_H */ 45#endif /* __ASM_ARCH_IMX_ESDHC_H */
diff --git a/include/linux/platform_data/mmc-pxamci.h b/include/linux/platform_data/mmc-pxamci.h
index 9eb515bb799d..1706b3597ce0 100644
--- a/include/linux/platform_data/mmc-pxamci.h
+++ b/include/linux/platform_data/mmc-pxamci.h
@@ -12,7 +12,7 @@ struct pxamci_platform_data {
12 unsigned long detect_delay_ms; /* delay in millisecond before detecting cards after interrupt */ 12 unsigned long detect_delay_ms; /* delay in millisecond before detecting cards after interrupt */
13 int (*init)(struct device *, irq_handler_t , void *); 13 int (*init)(struct device *, irq_handler_t , void *);
14 int (*get_ro)(struct device *); 14 int (*get_ro)(struct device *);
15 void (*setpower)(struct device *, unsigned int); 15 int (*setpower)(struct device *, unsigned int);
16 void (*exit)(struct device *, void *); 16 void (*exit)(struct device *, void *);
17 int gpio_card_detect; /* gpio detecting card insertion */ 17 int gpio_card_detect; /* gpio detecting card insertion */
18 int gpio_card_ro; /* gpio detecting read only toggle */ 18 int gpio_card_ro; /* gpio detecting read only toggle */
diff --git a/include/linux/platform_data/net-cw1200.h b/include/linux/platform_data/net-cw1200.h
new file mode 100644
index 000000000000..c6fbc3ce4ab0
--- /dev/null
+++ b/include/linux/platform_data/net-cw1200.h
@@ -0,0 +1,81 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2011
3 *
4 * Author: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef CW1200_PLAT_H_INCLUDED
9#define CW1200_PLAT_H_INCLUDED
10
11struct cw1200_platform_data_spi {
12 u8 spi_bits_per_word; /* REQUIRED */
13 u16 ref_clk; /* REQUIRED (in KHz) */
14
15 /* All others are optional */
16 bool have_5ghz;
17 int reset; /* GPIO to RSTn signal (0 disables) */
18 int powerup; /* GPIO to POWERUP signal (0 disables) */
19 int (*power_ctrl)(const struct cw1200_platform_data_spi *pdata,
20 bool enable); /* Control 3v3 / 1v8 supply */
21 int (*clk_ctrl)(const struct cw1200_platform_data_spi *pdata,
22 bool enable); /* Control CLK32K */
23 const u8 *macaddr; /* if NULL, use cw1200_mac_template module parameter */
24 const char *sdd_file; /* if NULL, will use default for detected hw type */
25};
26
27struct cw1200_platform_data_sdio {
28 u16 ref_clk; /* REQUIRED (in KHz) */
29
30 /* All others are optional */
31 bool have_5ghz;
32 bool no_nptb; /* SDIO hardware does not support non-power-of-2-blocksizes */
33 int reset; /* GPIO to RSTn signal (0 disables) */
34 int powerup; /* GPIO to POWERUP signal (0 disables) */
35 int irq; /* IRQ line or 0 to use SDIO IRQ */
36 int (*power_ctrl)(const struct cw1200_platform_data_sdio *pdata,
37 bool enable); /* Control 3v3 / 1v8 supply */
38 int (*clk_ctrl)(const struct cw1200_platform_data_sdio *pdata,
39 bool enable); /* Control CLK32K */
40 const u8 *macaddr; /* if NULL, use cw1200_mac_template module parameter */
41 const char *sdd_file; /* if NULL, will use default for detected hw type */
42};
43
44
45/* An example of SPI support in your board setup file:
46
47 static struct cw1200_platform_data_spi cw1200_platform_data = {
48 .ref_clk = 38400,
49 .spi_bits_per_word = 16,
50 .reset = GPIO_RF_RESET,
51 .powerup = GPIO_RF_POWERUP,
52 .macaddr = wifi_mac_addr,
53 .sdd_file = "sdd_sagrad_1091_1098.bin",
54 };
55 static struct spi_board_info myboard_spi_devices[] __initdata = {
56 {
57 .modalias = "cw1200_wlan_spi",
58 .max_speed_hz = 52000000,
59 .bus_num = 0,
60 .irq = WIFI_IRQ,
61 .platform_data = &cw1200_platform_data,
62 .chip_select = 0,
63 },
64 };
65
66 */
67
68/* An example of SDIO support in your board setup file:
69
70 static struct cw1200_platform_data_sdio my_cw1200_platform_data = {
71 .ref_clk = 38400,
72 .have_5ghz = false,
73 .sdd_file = "sdd_myplatform.bin",
74 };
75 cw1200_sdio_set_platform_data(&my_cw1200_platform_data);
76
77 */
78
79void __init cw1200_sdio_set_platform_data(struct cw1200_platform_data_sdio *pdata);
80
81#endif /* CW1200_PLAT_H_INCLUDED */
diff --git a/include/linux/platform_data/omap_ocp2scp.h b/include/linux/platform_data/omap_ocp2scp.h
deleted file mode 100644
index 5c6c3939355f..000000000000
--- a/include/linux/platform_data/omap_ocp2scp.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * omap_ocp2scp.h -- ocp2scp header file
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
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 * Author: Kishon Vijay Abraham I <kishon@ti.com>
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 __DRIVERS_OMAP_OCP2SCP_H
20#define __DRIVERS_OMAP_OCP2SCP_H
21
22struct omap_ocp2scp_dev {
23 const char *drv_name;
24 struct resource *res;
25};
26
27struct omap_ocp2scp_platform_data {
28 int dev_cnt;
29 struct omap_ocp2scp_dev **devices;
30};
31#endif /* __DRIVERS_OMAP_OCP2SCP_H */
diff --git a/include/linux/platform_data/pinctrl-coh901.h b/include/linux/platform_data/pinctrl-coh901.h
deleted file mode 100644
index dfbc65d10484..000000000000
--- a/include/linux/platform_data/pinctrl-coh901.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (C) 2007-2012 ST-Ericsson AB
3 * License terms: GNU General Public License (GPL) version 2
4 * GPIO block resgister definitions and inline macros for
5 * U300 GPIO COH 901 335 or COH 901 571/3
6 * Author: Linus Walleij <linus.walleij@stericsson.com>
7 */
8
9#ifndef __MACH_U300_GPIO_U300_H
10#define __MACH_U300_GPIO_U300_H
11
12/**
13 * struct u300_gpio_platform - U300 GPIO platform data
14 * @ports: number of GPIO block ports
15 * @gpio_base: first GPIO number for this block (use a free range)
16 */
17struct u300_gpio_platform {
18 u8 ports;
19 int gpio_base;
20};
21
22#endif /* __MACH_U300_GPIO_U300_H */
diff --git a/include/linux/platform_data/pwm-renesas-tpu.h b/include/linux/platform_data/pwm-renesas-tpu.h
new file mode 100644
index 000000000000..a7220b10ddab
--- /dev/null
+++ b/include/linux/platform_data/pwm-renesas-tpu.h
@@ -0,0 +1,16 @@
1#ifndef __PWM_RENESAS_TPU_H__
2#define __PWM_RENESAS_TPU_H__
3
4#include <linux/pwm.h>
5
6#define TPU_CHANNEL_MAX 4
7
8struct tpu_pwm_channel_data {
9 enum pwm_polarity polarity;
10};
11
12struct tpu_pwm_platform_data {
13 struct tpu_pwm_channel_data channels[TPU_CHANNEL_MAX];
14};
15
16#endif /* __PWM_RENESAS_TPU_H__ */
diff --git a/include/linux/platform_data/rcar-du.h b/include/linux/platform_data/rcar-du.h
new file mode 100644
index 000000000000..80587fdbba3e
--- /dev/null
+++ b/include/linux/platform_data/rcar-du.h
@@ -0,0 +1,54 @@
1/*
2 * rcar_du.h -- R-Car Display Unit DRM driver
3 *
4 * Copyright (C) 2013 Renesas Corporation
5 *
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __RCAR_DU_H__
15#define __RCAR_DU_H__
16
17#include <drm/drm_mode.h>
18
19enum rcar_du_encoder_type {
20 RCAR_DU_ENCODER_UNUSED = 0,
21 RCAR_DU_ENCODER_VGA,
22 RCAR_DU_ENCODER_LVDS,
23};
24
25struct rcar_du_panel_data {
26 unsigned int width_mm; /* Panel width in mm */
27 unsigned int height_mm; /* Panel height in mm */
28 struct drm_mode_modeinfo mode;
29};
30
31struct rcar_du_encoder_lvds_data {
32 struct rcar_du_panel_data panel;
33};
34
35struct rcar_du_encoder_vga_data {
36 /* TODO: Add DDC information for EDID retrieval */
37};
38
39struct rcar_du_encoder_data {
40 enum rcar_du_encoder_type encoder;
41 unsigned int output;
42
43 union {
44 struct rcar_du_encoder_lvds_data lvds;
45 struct rcar_du_encoder_vga_data vga;
46 } u;
47};
48
49struct rcar_du_platform_data {
50 struct rcar_du_encoder_data *encoders;
51 unsigned int num_encoders;
52};
53
54#endif /* __RCAR_DU_H__ */
diff --git a/include/linux/platform_data/remoteproc-omap.h b/include/linux/platform_data/remoteproc-omap.h
index 3c1c6444ec4b..bfbd12b41162 100644
--- a/include/linux/platform_data/remoteproc-omap.h
+++ b/include/linux/platform_data/remoteproc-omap.h
@@ -50,7 +50,7 @@ void __init omap_rproc_reserve_cma(void);
50 50
51#else 51#else
52 52
53void __init omap_rproc_reserve_cma(void) 53static inline void __init omap_rproc_reserve_cma(void)
54{ 54{
55} 55}
56 56
diff --git a/include/linux/platform_data/si5351.h b/include/linux/platform_data/si5351.h
index 92dabcaf6499..54334393ab92 100644
--- a/include/linux/platform_data/si5351.h
+++ b/include/linux/platform_data/si5351.h
@@ -79,6 +79,23 @@ enum si5351_drive_strength {
79}; 79};
80 80
81/** 81/**
82 * enum si5351_disable_state - Si5351 clock output disable state
83 * @SI5351_DISABLE_DEFAULT: default, do not change eeprom config
84 * @SI5351_DISABLE_LOW: CLKx is set to a LOW state when disabled
85 * @SI5351_DISABLE_HIGH: CLKx is set to a HIGH state when disabled
86 * @SI5351_DISABLE_FLOATING: CLKx is set to a FLOATING state when
87 * disabled
88 * @SI5351_DISABLE_NEVER: CLKx is NEVER disabled
89 */
90enum si5351_disable_state {
91 SI5351_DISABLE_DEFAULT = 0,
92 SI5351_DISABLE_LOW,
93 SI5351_DISABLE_HIGH,
94 SI5351_DISABLE_FLOATING,
95 SI5351_DISABLE_NEVER,
96};
97
98/**
82 * struct si5351_clkout_config - Si5351 clock output configuration 99 * struct si5351_clkout_config - Si5351 clock output configuration
83 * @clkout: clkout number 100 * @clkout: clkout number
84 * @multisynth_src: multisynth source clock 101 * @multisynth_src: multisynth source clock
@@ -91,6 +108,7 @@ struct si5351_clkout_config {
91 enum si5351_multisynth_src multisynth_src; 108 enum si5351_multisynth_src multisynth_src;
92 enum si5351_clkout_src clkout_src; 109 enum si5351_clkout_src clkout_src;
93 enum si5351_drive_strength drive; 110 enum si5351_drive_strength drive;
111 enum si5351_disable_state disable_state;
94 bool pll_master; 112 bool pll_master;
95 unsigned long rate; 113 unsigned long rate;
96}; 114};
diff --git a/include/linux/platform_data/spi-davinci.h b/include/linux/platform_data/spi-davinci.h
index 7af305b37868..8dc2fa47a2aa 100644
--- a/include/linux/platform_data/spi-davinci.h
+++ b/include/linux/platform_data/spi-davinci.h
@@ -19,7 +19,7 @@
19#ifndef __ARCH_ARM_DAVINCI_SPI_H 19#ifndef __ARCH_ARM_DAVINCI_SPI_H
20#define __ARCH_ARM_DAVINCI_SPI_H 20#define __ARCH_ARM_DAVINCI_SPI_H
21 21
22#include <mach/edma.h> 22#include <linux/platform_data/edma.h>
23 23
24#define SPI_INTERN_CS 0xFF 24#define SPI_INTERN_CS 0xFF
25 25
diff --git a/include/linux/platform_data/ssm2518.h b/include/linux/platform_data/ssm2518.h
new file mode 100644
index 000000000000..9a8e3ea287e3
--- /dev/null
+++ b/include/linux/platform_data/ssm2518.h
@@ -0,0 +1,22 @@
1/*
2 * SSM2518 amplifier audio driver
3 *
4 * Copyright 2013 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2.
8 */
9
10#ifndef __LINUX_PLATFORM_DATA_SSM2518_H__
11#define __LINUX_PLATFORM_DATA_SSM2518_H__
12
13/**
14 * struct ssm2518_platform_data - Platform data for the ssm2518 driver
15 * @enable_gpio: GPIO connected to the nSD pin. Set to -1 if the nSD pin is
16 * hardwired.
17 */
18struct ssm2518_platform_data {
19 int enable_gpio;
20};
21
22#endif
diff --git a/include/linux/platform_data/ti_am335x_adc.h b/include/linux/platform_data/ti_am335x_adc.h
deleted file mode 100644
index e41d5834cb84..000000000000
--- a/include/linux/platform_data/ti_am335x_adc.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __LINUX_TI_AM335X_ADC_H
2#define __LINUX_TI_AM335X_ADC_H
3
4/**
5 * struct adc_data ADC Input information
6 * @adc_channels: Number of analog inputs
7 * available for ADC.
8 */
9
10struct adc_data {
11 unsigned int adc_channels;
12};
13
14#endif
diff --git a/include/linux/platform_data/usb-musb-ux500.h b/include/linux/platform_data/usb-musb-ux500.h
index 4c1cc50a595a..dd9c83ac7de0 100644
--- a/include/linux/platform_data/usb-musb-ux500.h
+++ b/include/linux/platform_data/usb-musb-ux500.h
@@ -9,14 +9,11 @@
9 9
10#include <linux/dmaengine.h> 10#include <linux/dmaengine.h>
11 11
12#define UX500_MUSB_DMA_NUM_RX_CHANNELS 8 12#define UX500_MUSB_DMA_NUM_RX_TX_CHANNELS 8
13#define UX500_MUSB_DMA_NUM_TX_CHANNELS 8
14 13
15struct ux500_musb_board_data { 14struct ux500_musb_board_data {
16 void **dma_rx_param_array; 15 void **dma_rx_param_array;
17 void **dma_tx_param_array; 16 void **dma_tx_param_array;
18 u32 num_rx_channels;
19 u32 num_tx_channels;
20 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 17 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
21}; 18};
22 19
diff --git a/include/linux/platform_data/usb-rcar-phy.h b/include/linux/platform_data/usb-rcar-phy.h
new file mode 100644
index 000000000000..8ec6964a32a5
--- /dev/null
+++ b/include/linux/platform_data/usb-rcar-phy.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright (C) 2013 Renesas Solutions Corp.
3 * Copyright (C) 2013 Cogent Embedded, Inc.
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 __USB_RCAR_PHY_H
11#define __USB_RCAR_PHY_H
12
13#include <linux/types.h>
14
15struct rcar_phy_platform_data {
16 bool ferrite_bead:1; /* (R8A7778 only) */
17
18 bool port1_func:1; /* true: port 1 used by function, false: host */
19 unsigned penc1:1; /* Output of the PENC1 pin in function mode */
20 struct { /* Overcurrent pin control for ports 0..2 */
21 bool select_3_3v:1; /* true: USB_OVCn pin, false: OVCn pin */
22 /* Set to false on port 1 in function mode */
23 bool active_high:1; /* true: active high, false: active low */
24 /* Set to true on port 1 in function mode */
25 } ovc_pin[3]; /* (R8A7778 only has 2 ports) */
26};
27
28#endif /* __USB_RCAR_PHY_H */
diff --git a/include/linux/platform_data/usb3503.h b/include/linux/platform_data/usb3503.h
index 85dcc709f7e9..1d1b6ef871f6 100644
--- a/include/linux/platform_data/usb3503.h
+++ b/include/linux/platform_data/usb3503.h
@@ -3,6 +3,10 @@
3 3
4#define USB3503_I2C_NAME "usb3503" 4#define USB3503_I2C_NAME "usb3503"
5 5
6#define USB3503_OFF_PORT1 (1 << 1)
7#define USB3503_OFF_PORT2 (1 << 2)
8#define USB3503_OFF_PORT3 (1 << 3)
9
6enum usb3503_mode { 10enum usb3503_mode {
7 USB3503_MODE_UNKNOWN, 11 USB3503_MODE_UNKNOWN,
8 USB3503_MODE_HUB, 12 USB3503_MODE_HUB,
@@ -11,6 +15,7 @@ enum usb3503_mode {
11 15
12struct usb3503_platform_data { 16struct usb3503_platform_data {
13 enum usb3503_mode initial_mode; 17 enum usb3503_mode initial_mode;
18 u8 port_off_mask;
14 int gpio_intn; 19 int gpio_intn;
15 int gpio_connect; 20 int gpio_connect;
16 int gpio_reset; 21 int gpio_reset;
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 9abf1db6aea6..ce8e4ffd78c7 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -180,7 +180,16 @@ struct platform_driver {
180 const struct platform_device_id *id_table; 180 const struct platform_device_id *id_table;
181}; 181};
182 182
183extern int platform_driver_register(struct platform_driver *); 183#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \
184 driver))
185
186/*
187 * use a macro to avoid include chaining to get THIS_MODULE
188 */
189#define platform_driver_register(drv) \
190 __platform_driver_register(drv, THIS_MODULE)
191extern int __platform_driver_register(struct platform_driver *,
192 struct module *);
184extern void platform_driver_unregister(struct platform_driver *); 193extern void platform_driver_unregister(struct platform_driver *);
185 194
186/* non-hotpluggable platform devices may use this so that probe() and 195/* non-hotpluggable platform devices may use this so that probe() and
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 7d7e09efff9b..6fa7cea25da9 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -37,7 +37,6 @@ extern void pm_runtime_enable(struct device *dev);
37extern void __pm_runtime_disable(struct device *dev, bool check_resume); 37extern void __pm_runtime_disable(struct device *dev, bool check_resume);
38extern void pm_runtime_allow(struct device *dev); 38extern void pm_runtime_allow(struct device *dev);
39extern void pm_runtime_forbid(struct device *dev); 39extern void pm_runtime_forbid(struct device *dev);
40extern int pm_generic_runtime_idle(struct device *dev);
41extern int pm_generic_runtime_suspend(struct device *dev); 40extern int pm_generic_runtime_suspend(struct device *dev);
42extern int pm_generic_runtime_resume(struct device *dev); 41extern int pm_generic_runtime_resume(struct device *dev);
43extern void pm_runtime_no_callbacks(struct device *dev); 42extern void pm_runtime_no_callbacks(struct device *dev);
@@ -143,7 +142,6 @@ static inline bool pm_runtime_active(struct device *dev) { return true; }
143static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } 142static inline bool pm_runtime_status_suspended(struct device *dev) { return false; }
144static inline bool pm_runtime_enabled(struct device *dev) { return false; } 143static inline bool pm_runtime_enabled(struct device *dev) { return false; }
145 144
146static inline int pm_generic_runtime_idle(struct device *dev) { return 0; }
147static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } 145static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
148static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } 146static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
149static inline void pm_runtime_no_callbacks(struct device *dev) {} 147static inline void pm_runtime_no_callbacks(struct device *dev) {}
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 569781faa504..a0f70808d7f4 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -36,8 +36,8 @@
36 * @last_time: Monotonic clock when the wakeup source's was touched last time. 36 * @last_time: Monotonic clock when the wakeup source's was touched last time.
37 * @prevent_sleep_time: Total time this source has been preventing autosleep. 37 * @prevent_sleep_time: Total time this source has been preventing autosleep.
38 * @event_count: Number of signaled wakeup events. 38 * @event_count: Number of signaled wakeup events.
39 * @active_count: Number of times the wakeup sorce was activated. 39 * @active_count: Number of times the wakeup source was activated.
40 * @relax_count: Number of times the wakeup sorce was deactivated. 40 * @relax_count: Number of times the wakeup source was deactivated.
41 * @expire_count: Number of times the wakeup source's timeout has expired. 41 * @expire_count: Number of times the wakeup source's timeout has expired.
42 * @wakeup_count: Number of times the wakeup source might abort suspend. 42 * @wakeup_count: Number of times the wakeup source might abort suspend.
43 * @active: Status of the wakeup source. 43 * @active: Status of the wakeup source.
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 7794d75ed155..907f3fd191ac 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -7,14 +7,20 @@
7#include <linux/timex.h> 7#include <linux/timex.h>
8#include <linux/alarmtimer.h> 8#include <linux/alarmtimer.h>
9 9
10union cpu_time_count { 10
11 cputime_t cpu; 11static inline unsigned long long cputime_to_expires(cputime_t expires)
12 unsigned long long sched; 12{
13}; 13 return (__force unsigned long long)expires;
14}
15
16static inline cputime_t expires_to_cputime(unsigned long long expires)
17{
18 return (__force cputime_t)expires;
19}
14 20
15struct cpu_timer_list { 21struct cpu_timer_list {
16 struct list_head entry; 22 struct list_head entry;
17 union cpu_time_count expires, incr; 23 unsigned long long expires, incr;
18 struct task_struct *task; 24 struct task_struct *task;
19 int firing; 25 int firing;
20}; 26};
diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h
index c0f44c2b006d..d8b187c3925d 100644
--- a/include/linux/power/smartreflex.h
+++ b/include/linux/power/smartreflex.h
@@ -299,11 +299,11 @@ void omap_sr_disable_reset_volt(struct voltagedomain *voltdm);
299void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data); 299void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data);
300 300
301/* Smartreflex driver hooks to be called from Smartreflex class driver */ 301/* Smartreflex driver hooks to be called from Smartreflex class driver */
302int sr_enable(struct voltagedomain *voltdm, unsigned long volt); 302int sr_enable(struct omap_sr *sr, unsigned long volt);
303void sr_disable(struct voltagedomain *voltdm); 303void sr_disable(struct omap_sr *sr);
304int sr_configure_errgen(struct voltagedomain *voltdm); 304int sr_configure_errgen(struct omap_sr *sr);
305int sr_disable_errgen(struct voltagedomain *voltdm); 305int sr_disable_errgen(struct omap_sr *sr);
306int sr_configure_minmax(struct voltagedomain *voltdm); 306int sr_configure_minmax(struct omap_sr *sr);
307 307
308/* API to register the smartreflex class driver with the smartreflex driver */ 308/* API to register the smartreflex class driver with the smartreflex driver */
309int sr_register_class(struct omap_sr_class_data *class_data); 309int sr_register_class(struct omap_sr_class_data *class_data);
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 3828cefb4f65..804b90643a85 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -162,6 +162,8 @@ union power_supply_propval {
162 const char *strval; 162 const char *strval;
163}; 163};
164 164
165struct device_node;
166
165struct power_supply { 167struct power_supply {
166 const char *name; 168 const char *name;
167 enum power_supply_type type; 169 enum power_supply_type type;
@@ -173,9 +175,7 @@ struct power_supply {
173 175
174 char **supplied_from; 176 char **supplied_from;
175 size_t num_supplies; 177 size_t num_supplies;
176#ifdef CONFIG_OF
177 struct device_node *of_node; 178 struct device_node *of_node;
178#endif
179 179
180 int (*get_property)(struct power_supply *psy, 180 int (*get_property)(struct power_supply *psy,
181 enum power_supply_property psp, 181 enum power_supply_property psp,
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 75d01760c911..4aa80ba830a2 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -35,6 +35,10 @@ enum pstore_type_id {
35 PSTORE_TYPE_MCE = 1, 35 PSTORE_TYPE_MCE = 1,
36 PSTORE_TYPE_CONSOLE = 2, 36 PSTORE_TYPE_CONSOLE = 2,
37 PSTORE_TYPE_FTRACE = 3, 37 PSTORE_TYPE_FTRACE = 3,
38 /* PPC64 partition types */
39 PSTORE_TYPE_PPC_RTAS = 4,
40 PSTORE_TYPE_PPC_OF = 5,
41 PSTORE_TYPE_PPC_COMMON = 6,
38 PSTORE_TYPE_UNKNOWN = 255 42 PSTORE_TYPE_UNKNOWN = 255
39}; 43};
40 44
@@ -54,12 +58,12 @@ struct pstore_info {
54 struct pstore_info *psi); 58 struct pstore_info *psi);
55 int (*write)(enum pstore_type_id type, 59 int (*write)(enum pstore_type_id type,
56 enum kmsg_dump_reason reason, u64 *id, 60 enum kmsg_dump_reason reason, u64 *id,
57 unsigned int part, int count, size_t size, 61 unsigned int part, int count, size_t hsize,
58 struct pstore_info *psi); 62 size_t size, struct pstore_info *psi);
59 int (*write_buf)(enum pstore_type_id type, 63 int (*write_buf)(enum pstore_type_id type,
60 enum kmsg_dump_reason reason, u64 *id, 64 enum kmsg_dump_reason reason, u64 *id,
61 unsigned int part, const char *buf, size_t size, 65 unsigned int part, const char *buf, size_t hsize,
62 struct pstore_info *psi); 66 size_t size, struct pstore_info *psi);
63 int (*erase)(enum pstore_type_id type, u64 id, 67 int (*erase)(enum pstore_type_id type, u64 id,
64 int count, struct timespec time, 68 int count, struct timespec time,
65 struct pstore_info *psi); 69 struct pstore_info *psi);
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 89573a33ab3c..07d0df6bf768 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -142,9 +142,6 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
142{ 142{
143 INIT_LIST_HEAD(&child->ptrace_entry); 143 INIT_LIST_HEAD(&child->ptrace_entry);
144 INIT_LIST_HEAD(&child->ptraced); 144 INIT_LIST_HEAD(&child->ptraced);
145#ifdef CONFIG_HAVE_HW_BREAKPOINT
146 atomic_set(&child->ptrace_bp_refcnt, 1);
147#endif
148 child->jobctl = 0; 145 child->jobctl = 0;
149 child->ptrace = 0; 146 child->ptrace = 0;
150 child->parent = child->real_parent; 147 child->parent = child->real_parent;
@@ -351,11 +348,4 @@ extern int task_current_syscall(struct task_struct *target, long *callno,
351 unsigned long args[6], unsigned int maxargs, 348 unsigned long args[6], unsigned int maxargs,
352 unsigned long *sp, unsigned long *pc); 349 unsigned long *sp, unsigned long *pc);
353 350
354#ifdef CONFIG_HAVE_HW_BREAKPOINT
355extern int ptrace_get_breakpoints(struct task_struct *tsk);
356extern void ptrace_put_breakpoints(struct task_struct *tsk);
357#else
358static inline void ptrace_put_breakpoints(struct task_struct *tsk) { }
359#endif /* CONFIG_HAVE_HW_BREAKPOINT */
360
361#endif 351#endif
diff --git a/include/linux/pvclock_gtod.h b/include/linux/pvclock_gtod.h
index 0ca75825b60d..a71d2dbd3610 100644
--- a/include/linux/pvclock_gtod.h
+++ b/include/linux/pvclock_gtod.h
@@ -3,6 +3,13 @@
3 3
4#include <linux/notifier.h> 4#include <linux/notifier.h>
5 5
6/*
7 * The pvclock gtod notifier is called when the system time is updated
8 * and is used to keep guest time synchronized with host time.
9 *
10 * The 'action' parameter in the notifier function is false (0), or
11 * true (non-zero) if system time was stepped.
12 */
6extern int pvclock_gtod_register_notifier(struct notifier_block *nb); 13extern int pvclock_gtod_register_notifier(struct notifier_block *nb);
7extern int pvclock_gtod_unregister_notifier(struct notifier_block *nb); 14extern int pvclock_gtod_unregister_notifier(struct notifier_block *nb);
8 15
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index a4df2042b79c..f0feafd184a0 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -76,6 +76,7 @@ enum pwm_polarity {
76enum { 76enum {
77 PWMF_REQUESTED = 1 << 0, 77 PWMF_REQUESTED = 1 << 0,
78 PWMF_ENABLED = 1 << 1, 78 PWMF_ENABLED = 1 << 1,
79 PWMF_EXPORTED = 1 << 2,
79}; 80};
80 81
81struct pwm_device { 82struct pwm_device {
@@ -86,7 +87,9 @@ struct pwm_device {
86 struct pwm_chip *chip; 87 struct pwm_chip *chip;
87 void *chip_data; 88 void *chip_data;
88 89
89 unsigned int period; /* in nanoseconds */ 90 unsigned int period; /* in nanoseconds */
91 unsigned int duty_cycle; /* in nanoseconds */
92 enum pwm_polarity polarity;
90}; 93};
91 94
92static inline void pwm_set_period(struct pwm_device *pwm, unsigned int period) 95static inline void pwm_set_period(struct pwm_device *pwm, unsigned int period)
@@ -100,6 +103,17 @@ static inline unsigned int pwm_get_period(struct pwm_device *pwm)
100 return pwm ? pwm->period : 0; 103 return pwm ? pwm->period : 0;
101} 104}
102 105
106static inline void pwm_set_duty_cycle(struct pwm_device *pwm, unsigned int duty)
107{
108 if (pwm)
109 pwm->duty_cycle = duty;
110}
111
112static inline unsigned int pwm_get_duty_cycle(struct pwm_device *pwm)
113{
114 return pwm ? pwm->duty_cycle : 0;
115}
116
103/* 117/*
104 * pwm_set_polarity - configure the polarity of a PWM signal 118 * pwm_set_polarity - configure the polarity of a PWM signal
105 */ 119 */
@@ -278,4 +292,17 @@ static inline void pwm_add_table(struct pwm_lookup *table, size_t num)
278} 292}
279#endif 293#endif
280 294
295#ifdef CONFIG_PWM_SYSFS
296void pwmchip_sysfs_export(struct pwm_chip *chip);
297void pwmchip_sysfs_unexport(struct pwm_chip *chip);
298#else
299static inline void pwmchip_sysfs_export(struct pwm_chip *chip)
300{
301}
302
303static inline void pwmchip_sysfs_unexport(struct pwm_chip *chip)
304{
305}
306#endif /* CONFIG_PWM_SYSFS */
307
281#endif /* __LINUX_PWM_H */ 308#endif /* __LINUX_PWM_H */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index ddcc7826d907..4b14bdc911d7 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -216,6 +216,7 @@ static inline int rcu_preempt_depth(void)
216#endif /* #else #ifdef CONFIG_PREEMPT_RCU */ 216#endif /* #else #ifdef CONFIG_PREEMPT_RCU */
217 217
218/* Internal to kernel */ 218/* Internal to kernel */
219extern void rcu_init(void);
219extern void rcu_sched_qs(int cpu); 220extern void rcu_sched_qs(int cpu);
220extern void rcu_bh_qs(int cpu); 221extern void rcu_bh_qs(int cpu);
221extern void rcu_check_callbacks(int cpu, int user); 222extern void rcu_check_callbacks(int cpu, int user);
@@ -239,8 +240,6 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
239 struct task_struct *next) { } 240 struct task_struct *next) { }
240#endif /* CONFIG_RCU_USER_QS */ 241#endif /* CONFIG_RCU_USER_QS */
241 242
242extern void exit_rcu(void);
243
244/** 243/**
245 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers 244 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers
246 * @a: Code that RCU needs to pay attention to. 245 * @a: Code that RCU needs to pay attention to.
@@ -277,7 +276,7 @@ void wait_rcu_gp(call_rcu_func_t crf);
277 276
278#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 277#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
279#include <linux/rcutree.h> 278#include <linux/rcutree.h>
280#elif defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU) 279#elif defined(CONFIG_TINY_RCU)
281#include <linux/rcutiny.h> 280#include <linux/rcutiny.h>
282#else 281#else
283#error "Unknown RCU implementation specified to kernel configuration" 282#error "Unknown RCU implementation specified to kernel configuration"
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 4e56a9c69a35..e31005ee339e 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -27,10 +27,6 @@
27 27
28#include <linux/cache.h> 28#include <linux/cache.h>
29 29
30static inline void rcu_init(void)
31{
32}
33
34static inline void rcu_barrier_bh(void) 30static inline void rcu_barrier_bh(void)
35{ 31{
36 wait_rcu_gp(call_rcu_bh); 32 wait_rcu_gp(call_rcu_bh);
@@ -41,8 +37,6 @@ static inline void rcu_barrier_sched(void)
41 wait_rcu_gp(call_rcu_sched); 37 wait_rcu_gp(call_rcu_sched);
42} 38}
43 39
44#ifdef CONFIG_TINY_RCU
45
46static inline void synchronize_rcu_expedited(void) 40static inline void synchronize_rcu_expedited(void)
47{ 41{
48 synchronize_sched(); /* Only one CPU, so pretty fast anyway!!! */ 42 synchronize_sched(); /* Only one CPU, so pretty fast anyway!!! */
@@ -53,17 +47,6 @@ static inline void rcu_barrier(void)
53 rcu_barrier_sched(); /* Only one CPU, so only one list of callbacks! */ 47 rcu_barrier_sched(); /* Only one CPU, so only one list of callbacks! */
54} 48}
55 49
56#else /* #ifdef CONFIG_TINY_RCU */
57
58void synchronize_rcu_expedited(void);
59
60static inline void rcu_barrier(void)
61{
62 wait_rcu_gp(call_rcu);
63}
64
65#endif /* #else #ifdef CONFIG_TINY_RCU */
66
67static inline void synchronize_rcu_bh(void) 50static inline void synchronize_rcu_bh(void)
68{ 51{
69 synchronize_sched(); 52 synchronize_sched();
@@ -85,35 +68,15 @@ static inline void kfree_call_rcu(struct rcu_head *head,
85 call_rcu(head, func); 68 call_rcu(head, func);
86} 69}
87 70
88#ifdef CONFIG_TINY_RCU
89
90static inline void rcu_preempt_note_context_switch(void)
91{
92}
93
94static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies) 71static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
95{ 72{
96 *delta_jiffies = ULONG_MAX; 73 *delta_jiffies = ULONG_MAX;
97 return 0; 74 return 0;
98} 75}
99 76
100#else /* #ifdef CONFIG_TINY_RCU */
101
102void rcu_preempt_note_context_switch(void);
103int rcu_preempt_needs_cpu(void);
104
105static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
106{
107 *delta_jiffies = ULONG_MAX;
108 return rcu_preempt_needs_cpu();
109}
110
111#endif /* #else #ifdef CONFIG_TINY_RCU */
112
113static inline void rcu_note_context_switch(int cpu) 77static inline void rcu_note_context_switch(int cpu)
114{ 78{
115 rcu_sched_qs(cpu); 79 rcu_sched_qs(cpu);
116 rcu_preempt_note_context_switch();
117} 80}
118 81
119/* 82/*
@@ -156,6 +119,10 @@ static inline void rcu_cpu_stall_reset(void)
156{ 119{
157} 120}
158 121
122static inline void exit_rcu(void)
123{
124}
125
159#ifdef CONFIG_DEBUG_LOCK_ALLOC 126#ifdef CONFIG_DEBUG_LOCK_ALLOC
160extern int rcu_scheduler_active __read_mostly; 127extern int rcu_scheduler_active __read_mostly;
161extern void rcu_scheduler_starting(void); 128extern void rcu_scheduler_starting(void);
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 952b79339304..226169d1bd2b 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -30,7 +30,6 @@
30#ifndef __LINUX_RCUTREE_H 30#ifndef __LINUX_RCUTREE_H
31#define __LINUX_RCUTREE_H 31#define __LINUX_RCUTREE_H
32 32
33extern void rcu_init(void);
34extern void rcu_note_context_switch(int cpu); 33extern void rcu_note_context_switch(int cpu);
35extern int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies); 34extern int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies);
36extern void rcu_cpu_stall_reset(void); 35extern void rcu_cpu_stall_reset(void);
@@ -86,6 +85,8 @@ extern void rcu_force_quiescent_state(void);
86extern void rcu_bh_force_quiescent_state(void); 85extern void rcu_bh_force_quiescent_state(void);
87extern void rcu_sched_force_quiescent_state(void); 86extern void rcu_sched_force_quiescent_state(void);
88 87
88extern void exit_rcu(void);
89
89extern void rcu_scheduler_starting(void); 90extern void rcu_scheduler_starting(void);
90extern int rcu_scheduler_active __read_mostly; 91extern int rcu_scheduler_active __read_mostly;
91 92
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 23b36304cd88..8e00f9f6f963 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -10,6 +10,31 @@
10#define SYS_HALT 0x0002 /* Notify of system halt */ 10#define SYS_HALT 0x0002 /* Notify of system halt */
11#define SYS_POWER_OFF 0x0003 /* Notify of system power off */ 11#define SYS_POWER_OFF 0x0003 /* Notify of system power off */
12 12
13enum reboot_mode {
14 REBOOT_COLD = 0,
15 REBOOT_WARM,
16 REBOOT_HARD,
17 REBOOT_SOFT,
18 REBOOT_GPIO,
19};
20extern enum reboot_mode reboot_mode;
21
22enum reboot_type {
23 BOOT_TRIPLE = 't',
24 BOOT_KBD = 'k',
25 BOOT_BIOS = 'b',
26 BOOT_ACPI = 'a',
27 BOOT_EFI = 'e',
28 BOOT_CF9 = 'p',
29 BOOT_CF9_COND = 'q',
30};
31extern enum reboot_type reboot_type;
32
33extern int reboot_default;
34extern int reboot_cpu;
35extern int reboot_force;
36
37
13extern int register_reboot_notifier(struct notifier_block *); 38extern int register_reboot_notifier(struct notifier_block *);
14extern int unregister_reboot_notifier(struct notifier_block *); 39extern int unregister_reboot_notifier(struct notifier_block *);
15 40
@@ -26,7 +51,7 @@ extern void machine_shutdown(void);
26struct pt_regs; 51struct pt_regs;
27extern void machine_crash_shutdown(struct pt_regs *); 52extern void machine_crash_shutdown(struct pt_regs *);
28 53
29/* 54/*
30 * Architecture independent implemenations of sys_reboot commands. 55 * Architecture independent implemenations of sys_reboot commands.
31 */ 56 */
32 57
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 02d84e24b7c2..580a5320cc96 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/rbtree.h> 17#include <linux/rbtree.h>
18#include <linux/err.h>
18 19
19struct module; 20struct module;
20struct device; 21struct device;
@@ -23,6 +24,7 @@ struct irq_domain;
23struct spi_device; 24struct spi_device;
24struct regmap; 25struct regmap;
25struct regmap_range_cfg; 26struct regmap_range_cfg;
27struct regmap_field;
26 28
27/* An enum of all the supported cache types */ 29/* An enum of all the supported cache types */
28enum regcache_type { 30enum regcache_type {
@@ -394,10 +396,15 @@ bool regmap_can_raw_write(struct regmap *map);
394int regcache_sync(struct regmap *map); 396int regcache_sync(struct regmap *map);
395int regcache_sync_region(struct regmap *map, unsigned int min, 397int regcache_sync_region(struct regmap *map, unsigned int min,
396 unsigned int max); 398 unsigned int max);
399int regcache_drop_region(struct regmap *map, unsigned int min,
400 unsigned int max);
397void regcache_cache_only(struct regmap *map, bool enable); 401void regcache_cache_only(struct regmap *map, bool enable);
398void regcache_cache_bypass(struct regmap *map, bool enable); 402void regcache_cache_bypass(struct regmap *map, bool enable);
399void regcache_mark_dirty(struct regmap *map); 403void regcache_mark_dirty(struct regmap *map);
400 404
405bool regmap_check_range_table(struct regmap *map, unsigned int reg,
406 const struct regmap_access_table *table);
407
401int regmap_register_patch(struct regmap *map, const struct reg_default *regs, 408int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
402 int num_regs); 409 int num_regs);
403 410
@@ -412,6 +419,36 @@ bool regmap_reg_in_ranges(unsigned int reg,
412 unsigned int nranges); 419 unsigned int nranges);
413 420
414/** 421/**
422 * Description of an register field
423 *
424 * @reg: Offset of the register within the regmap bank
425 * @lsb: lsb of the register field.
426 * @reg: msb of the register field.
427 */
428struct reg_field {
429 unsigned int reg;
430 unsigned int lsb;
431 unsigned int msb;
432};
433
434#define REG_FIELD(_reg, _lsb, _msb) { \
435 .reg = _reg, \
436 .lsb = _lsb, \
437 .msb = _msb, \
438 }
439
440struct regmap_field *regmap_field_alloc(struct regmap *regmap,
441 struct reg_field reg_field);
442void regmap_field_free(struct regmap_field *field);
443
444struct regmap_field *devm_regmap_field_alloc(struct device *dev,
445 struct regmap *regmap, struct reg_field reg_field);
446void devm_regmap_field_free(struct device *dev, struct regmap_field *field);
447
448int regmap_field_read(struct regmap_field *field, unsigned int *val);
449int regmap_field_write(struct regmap_field *field, unsigned int val);
450
451/**
415 * Description of an IRQ for the generic regmap irq_chip. 452 * Description of an IRQ for the generic regmap irq_chip.
416 * 453 *
417 * @reg_offset: Offset of the status/mask register within the bank 454 * @reg_offset: Offset of the status/mask register within the bank
@@ -562,6 +599,13 @@ static inline int regcache_sync_region(struct regmap *map, unsigned int min,
562 return -EINVAL; 599 return -EINVAL;
563} 600}
564 601
602static inline int regcache_drop_region(struct regmap *map, unsigned int min,
603 unsigned int max)
604{
605 WARN_ONCE(1, "regmap API is disabled");
606 return -EINVAL;
607}
608
565static inline void regcache_cache_only(struct regmap *map, bool enable) 609static inline void regcache_cache_only(struct regmap *map, bool enable)
566{ 610{
567 WARN_ONCE(1, "regmap API is disabled"); 611 WARN_ONCE(1, "regmap API is disabled");
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 7c5ff0c55773..75307447cef9 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -336,8 +336,4 @@ static inline int ab8500_regulator_debug_exit(struct platform_device *pdev)
336} 336}
337#endif 337#endif
338 338
339/* AB8500 external regulator functions. */
340int ab8500_ext_regulator_init(struct platform_device *pdev);
341void ab8500_ext_regulator_exit(struct platform_device *pdev);
342
343#endif 339#endif
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 145022a83085..3a76389c6aaa 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -165,6 +165,7 @@ int regulator_count_voltages(struct regulator *regulator);
165int regulator_list_voltage(struct regulator *regulator, unsigned selector); 165int regulator_list_voltage(struct regulator *regulator, unsigned selector);
166int regulator_is_supported_voltage(struct regulator *regulator, 166int regulator_is_supported_voltage(struct regulator *regulator,
167 int min_uV, int max_uV); 167 int min_uV, int max_uV);
168unsigned int regulator_get_linear_step(struct regulator *regulator);
168int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); 169int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
169int regulator_set_voltage_time(struct regulator *regulator, 170int regulator_set_voltage_time(struct regulator *regulator,
170 int old_uV, int new_uV); 171 int old_uV, int new_uV);
diff --git a/include/linux/reservation.h b/include/linux/reservation.h
new file mode 100644
index 000000000000..813dae960ebd
--- /dev/null
+++ b/include/linux/reservation.h
@@ -0,0 +1,62 @@
1/*
2 * Header file for reservations for dma-buf and ttm
3 *
4 * Copyright(C) 2011 Linaro Limited. All rights reserved.
5 * Copyright (C) 2012-2013 Canonical Ltd
6 * Copyright (C) 2012 Texas Instruments
7 *
8 * Authors:
9 * Rob Clark <rob.clark@linaro.org>
10 * Maarten Lankhorst <maarten.lankhorst@canonical.com>
11 * Thomas Hellstrom <thellstrom-at-vmware-dot-com>
12 *
13 * Based on bo.c which bears the following copyright notice,
14 * but is dual licensed:
15 *
16 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
17 * All Rights Reserved.
18 *
19 * Permission is hereby granted, free of charge, to any person obtaining a
20 * copy of this software and associated documentation files (the
21 * "Software"), to deal in the Software without restriction, including
22 * without limitation the rights to use, copy, modify, merge, publish,
23 * distribute, sub license, and/or sell copies of the Software, and to
24 * permit persons to whom the Software is furnished to do so, subject to
25 * the following conditions:
26 *
27 * The above copyright notice and this permission notice (including the
28 * next paragraph) shall be included in all copies or substantial portions
29 * of the Software.
30 *
31 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
34 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
35 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
36 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
37 * USE OR OTHER DEALINGS IN THE SOFTWARE.
38 */
39#ifndef _LINUX_RESERVATION_H
40#define _LINUX_RESERVATION_H
41
42#include <linux/ww_mutex.h>
43
44extern struct ww_class reservation_ww_class;
45
46struct reservation_object {
47 struct ww_mutex lock;
48};
49
50static inline void
51reservation_object_init(struct reservation_object *obj)
52{
53 ww_mutex_init(&obj->lock, &reservation_ww_class);
54}
55
56static inline void
57reservation_object_fini(struct reservation_object *obj)
58{
59 ww_mutex_destroy(&obj->lock);
60}
61
62#endif /* _LINUX_RESERVATION_H */
diff --git a/include/linux/rio.h b/include/linux/rio.h
index 18e099342e6f..b71d5738e683 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -20,6 +20,7 @@
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/rio_regs.h> 22#include <linux/rio_regs.h>
23#include <linux/mod_devicetable.h>
23#ifdef CONFIG_RAPIDIO_DMA_ENGINE 24#ifdef CONFIG_RAPIDIO_DMA_ENGINE
24#include <linux/dmaengine.h> 25#include <linux/dmaengine.h>
25#endif 26#endif
@@ -91,9 +92,24 @@ union rio_pw_msg;
91/** 92/**
92 * struct rio_switch - RIO switch info 93 * struct rio_switch - RIO switch info
93 * @node: Node in global list of switches 94 * @node: Node in global list of switches
94 * @switchid: Switch ID that is unique across a network
95 * @route_table: Copy of switch routing table 95 * @route_table: Copy of switch routing table
96 * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0 96 * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0
97 * @ops: pointer to switch-specific operations
98 * @lock: lock to serialize operations updates
99 * @nextdev: Array of per-port pointers to the next attached device
100 */
101struct rio_switch {
102 struct list_head node;
103 u8 *route_table;
104 u32 port_ok;
105 struct rio_switch_ops *ops;
106 spinlock_t lock;
107 struct rio_dev *nextdev[0];
108};
109
110/**
111 * struct rio_switch_ops - Per-switch operations
112 * @owner: The module owner of this structure
97 * @add_entry: Callback for switch-specific route add function 113 * @add_entry: Callback for switch-specific route add function
98 * @get_entry: Callback for switch-specific route get function 114 * @get_entry: Callback for switch-specific route get function
99 * @clr_table: Callback for switch-specific clear route table function 115 * @clr_table: Callback for switch-specific clear route table function
@@ -101,14 +117,12 @@ union rio_pw_msg;
101 * @get_domain: Callback for switch-specific domain get function 117 * @get_domain: Callback for switch-specific domain get function
102 * @em_init: Callback for switch-specific error management init function 118 * @em_init: Callback for switch-specific error management init function
103 * @em_handle: Callback for switch-specific error management handler function 119 * @em_handle: Callback for switch-specific error management handler function
104 * @sw_sysfs: Callback that initializes switch-specific sysfs attributes 120 *
105 * @nextdev: Array of per-port pointers to the next attached device 121 * Defines the operations that are necessary to initialize/control
122 * a particular RIO switch device.
106 */ 123 */
107struct rio_switch { 124struct rio_switch_ops {
108 struct list_head node; 125 struct module *owner;
109 u16 switchid;
110 u8 *route_table;
111 u32 port_ok;
112 int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, 126 int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
113 u16 table, u16 route_destid, u8 route_port); 127 u16 table, u16 route_destid, u8 route_port);
114 int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, 128 int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
@@ -121,8 +135,6 @@ struct rio_switch {
121 u8 *sw_domain); 135 u8 *sw_domain);
122 int (*em_init) (struct rio_dev *dev); 136 int (*em_init) (struct rio_dev *dev);
123 int (*em_handle) (struct rio_dev *dev, u8 swport); 137 int (*em_handle) (struct rio_dev *dev, u8 swport);
124 int (*sw_sysfs) (struct rio_dev *dev, int create);
125 struct rio_dev *nextdev[0];
126}; 138};
127 139
128/** 140/**
@@ -130,6 +142,7 @@ struct rio_switch {
130 * @global_list: Node in list of all RIO devices 142 * @global_list: Node in list of all RIO devices
131 * @net_list: Node in list of RIO devices in a network 143 * @net_list: Node in list of RIO devices in a network
132 * @net: Network this device is a part of 144 * @net: Network this device is a part of
145 * @do_enum: Enumeration flag
133 * @did: Device ID 146 * @did: Device ID
134 * @vid: Vendor ID 147 * @vid: Vendor ID
135 * @device_rev: Device revision 148 * @device_rev: Device revision
@@ -158,6 +171,7 @@ struct rio_dev {
158 struct list_head global_list; /* node in list of all RIO devices */ 171 struct list_head global_list; /* node in list of all RIO devices */
159 struct list_head net_list; /* node in per net list */ 172 struct list_head net_list; /* node in per net list */
160 struct rio_net *net; /* RIO net this device resides in */ 173 struct rio_net *net; /* RIO net this device resides in */
174 bool do_enum;
161 u16 did; 175 u16 did;
162 u16 vid; 176 u16 vid;
163 u32 device_rev; 177 u32 device_rev;
@@ -297,10 +311,6 @@ struct rio_net {
297 struct rio_id_table destid_table; /* destID allocation table */ 311 struct rio_id_table destid_table; /* destID allocation table */
298}; 312};
299 313
300/* Definitions used by switch sysfs initialization callback */
301#define RIO_SW_SYSFS_CREATE 1 /* Create switch attributes */
302#define RIO_SW_SYSFS_REMOVE 0 /* Remove switch attributes */
303
304/* Low-level architecture-dependent routines */ 314/* Low-level architecture-dependent routines */
305 315
306/** 316/**
@@ -385,35 +395,6 @@ struct rio_driver {
385 395
386#define to_rio_driver(drv) container_of(drv,struct rio_driver, driver) 396#define to_rio_driver(drv) container_of(drv,struct rio_driver, driver)
387 397
388/**
389 * struct rio_device_id - RIO device identifier
390 * @did: RIO device ID
391 * @vid: RIO vendor ID
392 * @asm_did: RIO assembly device ID
393 * @asm_vid: RIO assembly vendor ID
394 *
395 * Identifies a RIO device based on both the device/vendor IDs and
396 * the assembly device/vendor IDs.
397 */
398struct rio_device_id {
399 u16 did, vid;
400 u16 asm_did, asm_vid;
401};
402
403/**
404 * struct rio_switch_ops - Per-switch operations
405 * @vid: RIO vendor ID
406 * @did: RIO device ID
407 * @init_hook: Callback that performs switch device initialization
408 *
409 * Defines the operations that are necessary to initialize/control
410 * a particular RIO switch device.
411 */
412struct rio_switch_ops {
413 u16 vid, did;
414 int (*init_hook) (struct rio_dev *rdev, int do_enum);
415};
416
417union rio_pw_msg { 398union rio_pw_msg {
418 struct { 399 struct {
419 u32 comptag; /* Component Tag CSR */ 400 u32 comptag; /* Component Tag CSR */
@@ -468,14 +449,29 @@ static inline struct rio_mport *dma_to_mport(struct dma_device *ddev)
468 449
469/** 450/**
470 * struct rio_scan - RIO enumeration and discovery operations 451 * struct rio_scan - RIO enumeration and discovery operations
452 * @owner: The module owner of this structure
471 * @enumerate: Callback to perform RapidIO fabric enumeration. 453 * @enumerate: Callback to perform RapidIO fabric enumeration.
472 * @discover: Callback to perform RapidIO fabric discovery. 454 * @discover: Callback to perform RapidIO fabric discovery.
473 */ 455 */
474struct rio_scan { 456struct rio_scan {
457 struct module *owner;
475 int (*enumerate)(struct rio_mport *mport, u32 flags); 458 int (*enumerate)(struct rio_mport *mport, u32 flags);
476 int (*discover)(struct rio_mport *mport, u32 flags); 459 int (*discover)(struct rio_mport *mport, u32 flags);
477}; 460};
478 461
462/**
463 * struct rio_scan_node - list node to register RapidIO enumeration and
464 * discovery methods with RapidIO core.
465 * @mport_id: ID of an mport (net) serviced by this enumerator
466 * @node: node in global list of registered enumerators
467 * @ops: RIO enumeration and discovery operations
468 */
469struct rio_scan_node {
470 int mport_id;
471 struct list_head node;
472 struct rio_scan *ops;
473};
474
479/* Architecture and hardware-specific functions */ 475/* Architecture and hardware-specific functions */
480extern int rio_register_mport(struct rio_mport *); 476extern int rio_register_mport(struct rio_mport *);
481extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int); 477extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);
diff --git a/include/linux/rio_ids.h b/include/linux/rio_ids.h
index b66d13d1bdc0..2543bc163d54 100644
--- a/include/linux/rio_ids.h
+++ b/include/linux/rio_ids.h
@@ -13,8 +13,6 @@
13#ifndef LINUX_RIO_IDS_H 13#ifndef LINUX_RIO_IDS_H
14#define LINUX_RIO_IDS_H 14#define LINUX_RIO_IDS_H
15 15
16#define RIO_ANY_ID 0xffff
17
18#define RIO_VID_FREESCALE 0x0002 16#define RIO_VID_FREESCALE 0x0002
19#define RIO_DID_MPC8560 0x0003 17#define RIO_DID_MPC8560 0x0003
20 18
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 26806775b11b..adae88f5b0ab 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -244,6 +244,11 @@ size_t sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents,
244size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents, 244size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents,
245 void *buf, size_t buflen); 245 void *buf, size_t buflen);
246 246
247size_t sg_pcopy_from_buffer(struct scatterlist *sgl, unsigned int nents,
248 void *buf, size_t buflen, off_t skip);
249size_t sg_pcopy_to_buffer(struct scatterlist *sgl, unsigned int nents,
250 void *buf, size_t buflen, off_t skip);
251
247/* 252/*
248 * Maximum number of entries that will be allocated in one piece, if 253 * Maximum number of entries that will be allocated in one piece, if
249 * a list larger than this is required then chaining will be utilized. 254 * a list larger than this is required then chaining will be utilized.
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 178a8d909f14..e9995eb5985c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -314,6 +314,7 @@ struct nsproxy;
314struct user_namespace; 314struct user_namespace;
315 315
316#ifdef CONFIG_MMU 316#ifdef CONFIG_MMU
317extern unsigned long mmap_legacy_base(void);
317extern void arch_pick_mmap_layout(struct mm_struct *mm); 318extern void arch_pick_mmap_layout(struct mm_struct *mm);
318extern unsigned long 319extern unsigned long
319arch_get_unmapped_area(struct file *, unsigned long, unsigned long, 320arch_get_unmapped_area(struct file *, unsigned long, unsigned long,
@@ -322,8 +323,6 @@ extern unsigned long
322arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, 323arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
323 unsigned long len, unsigned long pgoff, 324 unsigned long len, unsigned long pgoff,
324 unsigned long flags); 325 unsigned long flags);
325extern void arch_unmap_area(struct mm_struct *, unsigned long);
326extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
327#else 326#else
328static inline void arch_pick_mmap_layout(struct mm_struct *mm) {} 327static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
329#endif 328#endif
@@ -924,7 +923,7 @@ struct load_weight {
924struct sched_avg { 923struct sched_avg {
925 /* 924 /*
926 * These sums represent an infinite geometric series and so are bound 925 * These sums represent an infinite geometric series and so are bound
927 * above by 1024/(1-y). Thus we only need a u32 to store them for for all 926 * above by 1024/(1-y). Thus we only need a u32 to store them for all
928 * choices of y < 1-2^(-32)*1024. 927 * choices of y < 1-2^(-32)*1024.
929 */ 928 */
930 u32 runnable_avg_sum, runnable_avg_period; 929 u32 runnable_avg_sum, runnable_avg_period;
@@ -994,12 +993,7 @@ struct sched_entity {
994 struct cfs_rq *my_q; 993 struct cfs_rq *my_q;
995#endif 994#endif
996 995
997/* 996#ifdef CONFIG_SMP
998 * Load-tracking only depends on SMP, FAIR_GROUP_SCHED dependency below may be
999 * removed when useful for applications beyond shares distribution (e.g.
1000 * load-balance).
1001 */
1002#if defined(CONFIG_SMP) && defined(CONFIG_FAIR_GROUP_SCHED)
1003 /* Per-entity load-tracking */ 997 /* Per-entity load-tracking */
1004 struct sched_avg avg; 998 struct sched_avg avg;
1005#endif 999#endif
@@ -1406,9 +1400,6 @@ struct task_struct {
1406 } memcg_batch; 1400 } memcg_batch;
1407 unsigned int memcg_kmem_skip_account; 1401 unsigned int memcg_kmem_skip_account;
1408#endif 1402#endif
1409#ifdef CONFIG_HAVE_HW_BREAKPOINT
1410 atomic_t ptrace_bp_refcnt;
1411#endif
1412#ifdef CONFIG_UPROBES 1403#ifdef CONFIG_UPROBES
1413 struct uprobe_task *utask; 1404 struct uprobe_task *utask;
1414#endif 1405#endif
@@ -1542,6 +1533,8 @@ static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1542 * Test if a process is not yet dead (at most zombie state) 1533 * Test if a process is not yet dead (at most zombie state)
1543 * If pid_alive fails, then pointers within the task structure 1534 * If pid_alive fails, then pointers within the task structure
1544 * can be stale and must not be dereferenced. 1535 * can be stale and must not be dereferenced.
1536 *
1537 * Return: 1 if the process is alive. 0 otherwise.
1545 */ 1538 */
1546static inline int pid_alive(struct task_struct *p) 1539static inline int pid_alive(struct task_struct *p)
1547{ 1540{
@@ -1553,6 +1546,8 @@ static inline int pid_alive(struct task_struct *p)
1553 * @tsk: Task structure to be checked. 1546 * @tsk: Task structure to be checked.
1554 * 1547 *
1555 * Check if a task structure is the first user space task the kernel created. 1548 * Check if a task structure is the first user space task the kernel created.
1549 *
1550 * Return: 1 if the task structure is init. 0 otherwise.
1556 */ 1551 */
1557static inline int is_global_init(struct task_struct *tsk) 1552static inline int is_global_init(struct task_struct *tsk)
1558{ 1553{
@@ -1638,6 +1633,7 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1638#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1633#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1639#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1634#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1640#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ 1635#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
1636#define PF_SUSPEND_TASK 0x80000000 /* this thread called freeze_processes and should not be frozen */
1641 1637
1642/* 1638/*
1643 * Only the _current_ task can read/write to tsk->flags, but other 1639 * Only the _current_ task can read/write to tsk->flags, but other
@@ -1903,6 +1899,8 @@ extern struct task_struct *idle_task(int cpu);
1903/** 1899/**
1904 * is_idle_task - is the specified task an idle task? 1900 * is_idle_task - is the specified task an idle task?
1905 * @p: the task in question. 1901 * @p: the task in question.
1902 *
1903 * Return: 1 if @p is an idle task. 0 otherwise.
1906 */ 1904 */
1907static inline bool is_idle_task(const struct task_struct *p) 1905static inline bool is_idle_task(const struct task_struct *p)
1908{ 1906{
@@ -1955,8 +1953,6 @@ extern struct task_struct *find_task_by_vpid(pid_t nr);
1955extern struct task_struct *find_task_by_pid_ns(pid_t nr, 1953extern struct task_struct *find_task_by_pid_ns(pid_t nr,
1956 struct pid_namespace *ns); 1954 struct pid_namespace *ns);
1957 1955
1958extern void __set_special_pids(struct pid *pid);
1959
1960/* per-UID process charging. */ 1956/* per-UID process charging. */
1961extern struct user_struct * alloc_uid(kuid_t); 1957extern struct user_struct * alloc_uid(kuid_t);
1962static inline struct user_struct *get_uid(struct user_struct *u) 1958static inline struct user_struct *get_uid(struct user_struct *u)
@@ -2444,6 +2440,15 @@ extern int __cond_resched_softirq(void);
2444 __cond_resched_softirq(); \ 2440 __cond_resched_softirq(); \
2445}) 2441})
2446 2442
2443static inline void cond_resched_rcu(void)
2444{
2445#if defined(CONFIG_DEBUG_ATOMIC_SLEEP) || !defined(CONFIG_PREEMPT_RCU)
2446 rcu_read_unlock();
2447 cond_resched();
2448 rcu_read_lock();
2449#endif
2450}
2451
2447/* 2452/*
2448 * Does a critical section need to be broken due to another 2453 * Does a critical section need to be broken due to another
2449 * task waiting?: (technically does not depend on CONFIG_PREEMPT, 2454 * task waiting?: (technically does not depend on CONFIG_PREEMPT,
diff --git a/include/linux/sched_clock.h b/include/linux/sched_clock.h
new file mode 100644
index 000000000000..fa7922c80a41
--- /dev/null
+++ b/include/linux/sched_clock.h
@@ -0,0 +1,21 @@
1/*
2 * sched_clock.h: support for extending counters to full 64-bit ns counter
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef LINUX_SCHED_CLOCK
9#define LINUX_SCHED_CLOCK
10
11#ifdef CONFIG_GENERIC_SCHED_CLOCK
12extern void sched_clock_postinit(void);
13#else
14static inline void sched_clock_postinit(void) { }
15#endif
16
17extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
18
19extern unsigned long long (*sched_clock_func)(void);
20
21#endif
diff --git a/include/linux/sdb.h b/include/linux/sdb.h
new file mode 100644
index 000000000000..fbb76a46c8a5
--- /dev/null
+++ b/include/linux/sdb.h
@@ -0,0 +1,159 @@
1/*
2 * This is the official version 1.1 of sdb.h
3 */
4#ifndef __SDB_H__
5#define __SDB_H__
6#ifdef __KERNEL__
7#include <linux/types.h>
8#else
9#include <stdint.h>
10#endif
11
12/*
13 * All structures are 64 bytes long and are expected
14 * to live in an array, one for each interconnect.
15 * Most fields of the structures are shared among the
16 * various types, and most-specific fields are at the
17 * beginning (for alignment reasons, and to keep the
18 * magic number at the head of the interconnect record
19 */
20
21/* Product, 40 bytes at offset 24, 8-byte aligned
22 *
23 * device_id is vendor-assigned; version is device-specific,
24 * date is hex (e.g 0x20120501), name is UTF-8, blank-filled
25 * and not terminated with a 0 byte.
26 */
27struct sdb_product {
28 uint64_t vendor_id; /* 0x18..0x1f */
29 uint32_t device_id; /* 0x20..0x23 */
30 uint32_t version; /* 0x24..0x27 */
31 uint32_t date; /* 0x28..0x2b */
32 uint8_t name[19]; /* 0x2c..0x3e */
33 uint8_t record_type; /* 0x3f */
34};
35
36/*
37 * Component, 56 bytes at offset 8, 8-byte aligned
38 *
39 * The address range is first to last, inclusive
40 * (for example 0x100000 - 0x10ffff)
41 */
42struct sdb_component {
43 uint64_t addr_first; /* 0x08..0x0f */
44 uint64_t addr_last; /* 0x10..0x17 */
45 struct sdb_product product; /* 0x18..0x3f */
46};
47
48/* Type of the SDB record */
49enum sdb_record_type {
50 sdb_type_interconnect = 0x00,
51 sdb_type_device = 0x01,
52 sdb_type_bridge = 0x02,
53 sdb_type_integration = 0x80,
54 sdb_type_repo_url = 0x81,
55 sdb_type_synthesis = 0x82,
56 sdb_type_empty = 0xFF,
57};
58
59/* Type 0: interconnect (first of the array)
60 *
61 * sdb_records is the length of the table including this first
62 * record, version is 1. The bus type is enumerated later.
63 */
64#define SDB_MAGIC 0x5344422d /* "SDB-" */
65struct sdb_interconnect {
66 uint32_t sdb_magic; /* 0x00-0x03 */
67 uint16_t sdb_records; /* 0x04-0x05 */
68 uint8_t sdb_version; /* 0x06 */
69 uint8_t sdb_bus_type; /* 0x07 */
70 struct sdb_component sdb_component; /* 0x08-0x3f */
71};
72
73/* Type 1: device
74 *
75 * class is 0 for "custom device", other values are
76 * to be standardized; ABI version is for the driver,
77 * bus-specific bits are defined by each bus (see below)
78 */
79struct sdb_device {
80 uint16_t abi_class; /* 0x00-0x01 */
81 uint8_t abi_ver_major; /* 0x02 */
82 uint8_t abi_ver_minor; /* 0x03 */
83 uint32_t bus_specific; /* 0x04-0x07 */
84 struct sdb_component sdb_component; /* 0x08-0x3f */
85};
86
87/* Type 2: bridge
88 *
89 * child is the address of the nested SDB table
90 */
91struct sdb_bridge {
92 uint64_t sdb_child; /* 0x00-0x07 */
93 struct sdb_component sdb_component; /* 0x08-0x3f */
94};
95
96/* Type 0x80: integration
97 *
98 * all types with bit 7 set are meta-information, so
99 * software can ignore the types it doesn't know. Here we
100 * just provide product information for an aggregate device
101 */
102struct sdb_integration {
103 uint8_t reserved[24]; /* 0x00-0x17 */
104 struct sdb_product product; /* 0x08-0x3f */
105};
106
107/* Type 0x81: Top module repository url
108 *
109 * again, an informative field that software can ignore
110 */
111struct sdb_repo_url {
112 uint8_t repo_url[63]; /* 0x00-0x3e */
113 uint8_t record_type; /* 0x3f */
114};
115
116/* Type 0x82: Synthesis tool information
117 *
118 * this informative record
119 */
120struct sdb_synthesis {
121 uint8_t syn_name[16]; /* 0x00-0x0f */
122 uint8_t commit_id[16]; /* 0x10-0x1f */
123 uint8_t tool_name[8]; /* 0x20-0x27 */
124 uint32_t tool_version; /* 0x28-0x2b */
125 uint32_t date; /* 0x2c-0x2f */
126 uint8_t user_name[15]; /* 0x30-0x3e */
127 uint8_t record_type; /* 0x3f */
128};
129
130/* Type 0xff: empty
131 *
132 * this allows keeping empty slots during development,
133 * so they can be filled later with minimal efforts and
134 * no misleading description is ever shipped -- hopefully.
135 * It can also be used to pad a table to a desired length.
136 */
137struct sdb_empty {
138 uint8_t reserved[63]; /* 0x00-0x3e */
139 uint8_t record_type; /* 0x3f */
140};
141
142/* The type of bus, for bus-specific flags */
143enum sdb_bus_type {
144 sdb_wishbone = 0x00,
145 sdb_data = 0x01,
146};
147
148#define SDB_WB_WIDTH_MASK 0x0f
149#define SDB_WB_ACCESS8 0x01
150#define SDB_WB_ACCESS16 0x02
151#define SDB_WB_ACCESS32 0x04
152#define SDB_WB_ACCESS64 0x08
153#define SDB_WB_LITTLE_ENDIAN 0x80
154
155#define SDB_DATA_READ 0x04
156#define SDB_DATA_WRITE 0x02
157#define SDB_DATA_EXEC 0x01
158
159#endif /* __SDB_H__ */
diff --git a/include/linux/security.h b/include/linux/security.h
index 4686491852a7..7ce53ae1266b 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -26,6 +26,7 @@
26#include <linux/capability.h> 26#include <linux/capability.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/string.h>
29 30
30struct linux_binprm; 31struct linux_binprm;
31struct cred; 32struct cred;
@@ -60,6 +61,9 @@ struct mm_struct;
60#define SECURITY_CAP_NOAUDIT 0 61#define SECURITY_CAP_NOAUDIT 0
61#define SECURITY_CAP_AUDIT 1 62#define SECURITY_CAP_AUDIT 1
62 63
64/* LSM Agnostic defines for sb_set_mnt_opts */
65#define SECURITY_LSM_NATIVE_LABELS 1
66
63struct ctl_table; 67struct ctl_table;
64struct audit_krule; 68struct audit_krule;
65struct user_namespace; 69struct user_namespace;
@@ -306,6 +310,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
306 * Parse a string of security data filling in the opts structure 310 * Parse a string of security data filling in the opts structure
307 * @options string containing all mount options known by the LSM 311 * @options string containing all mount options known by the LSM
308 * @opts binary data structure usable by the LSM 312 * @opts binary data structure usable by the LSM
313 * @dentry_init_security:
314 * Compute a context for a dentry as the inode is not yet available
315 * since NFSv4 has no label backed by an EA anyway.
316 * @dentry dentry to use in calculating the context.
317 * @mode mode used to determine resource type.
318 * @name name of the last path component used to create file
319 * @ctx pointer to place the pointer to the resulting context in.
320 * @ctxlen point to place the length of the resulting context.
321 *
309 * 322 *
310 * Security hooks for inode operations. 323 * Security hooks for inode operations.
311 * 324 *
@@ -1313,6 +1326,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1313 * @pages contains the number of pages. 1326 * @pages contains the number of pages.
1314 * Return 0 if permission is granted. 1327 * Return 0 if permission is granted.
1315 * 1328 *
1329 * @ismaclabel:
1330 * Check if the extended attribute specified by @name
1331 * represents a MAC label. Returns 1 if name is a MAC
1332 * attribute otherwise returns 0.
1333 * @name full extended attribute name to check against
1334 * LSM as a MAC label.
1335 *
1316 * @secid_to_secctx: 1336 * @secid_to_secctx:
1317 * Convert secid to security context. If secdata is NULL the length of 1337 * Convert secid to security context. If secdata is NULL the length of
1318 * the result will be returned in seclen, but no secdata will be returned. 1338 * the result will be returned in seclen, but no secdata will be returned.
@@ -1392,7 +1412,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1392 * @ctxlen contains the length of @ctx. 1412 * @ctxlen contains the length of @ctx.
1393 * 1413 *
1394 * @inode_getsecctx: 1414 * @inode_getsecctx:
1395 * Returns a string containing all relevant security context information 1415 * On success, returns 0 and fills out @ctx and @ctxlen with the security
1416 * context for the given @inode.
1396 * 1417 *
1397 * @inode we wish to get the security context of. 1418 * @inode we wish to get the security context of.
1398 * @ctx is a pointer in which to place the allocated security context. 1419 * @ctx is a pointer in which to place the allocated security context.
@@ -1439,10 +1460,16 @@ struct security_operations {
1439 int (*sb_pivotroot) (struct path *old_path, 1460 int (*sb_pivotroot) (struct path *old_path,
1440 struct path *new_path); 1461 struct path *new_path);
1441 int (*sb_set_mnt_opts) (struct super_block *sb, 1462 int (*sb_set_mnt_opts) (struct super_block *sb,
1442 struct security_mnt_opts *opts); 1463 struct security_mnt_opts *opts,
1464 unsigned long kern_flags,
1465 unsigned long *set_kern_flags);
1443 int (*sb_clone_mnt_opts) (const struct super_block *oldsb, 1466 int (*sb_clone_mnt_opts) (const struct super_block *oldsb,
1444 struct super_block *newsb); 1467 struct super_block *newsb);
1445 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); 1468 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts);
1469 int (*dentry_init_security) (struct dentry *dentry, int mode,
1470 struct qstr *name, void **ctx,
1471 u32 *ctxlen);
1472
1446 1473
1447#ifdef CONFIG_SECURITY_PATH 1474#ifdef CONFIG_SECURITY_PATH
1448 int (*path_unlink) (struct path *dir, struct dentry *dentry); 1475 int (*path_unlink) (struct path *dir, struct dentry *dentry);
@@ -1590,6 +1617,7 @@ struct security_operations {
1590 1617
1591 int (*getprocattr) (struct task_struct *p, char *name, char **value); 1618 int (*getprocattr) (struct task_struct *p, char *name, char **value);
1592 int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size); 1619 int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size);
1620 int (*ismaclabel) (const char *name);
1593 int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); 1621 int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen);
1594 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); 1622 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid);
1595 void (*release_secctx) (char *secdata, u32 seclen); 1623 void (*release_secctx) (char *secdata, u32 seclen);
@@ -1725,10 +1753,16 @@ int security_sb_mount(const char *dev_name, struct path *path,
1725 const char *type, unsigned long flags, void *data); 1753 const char *type, unsigned long flags, void *data);
1726int security_sb_umount(struct vfsmount *mnt, int flags); 1754int security_sb_umount(struct vfsmount *mnt, int flags);
1727int security_sb_pivotroot(struct path *old_path, struct path *new_path); 1755int security_sb_pivotroot(struct path *old_path, struct path *new_path);
1728int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); 1756int security_sb_set_mnt_opts(struct super_block *sb,
1757 struct security_mnt_opts *opts,
1758 unsigned long kern_flags,
1759 unsigned long *set_kern_flags);
1729int security_sb_clone_mnt_opts(const struct super_block *oldsb, 1760int security_sb_clone_mnt_opts(const struct super_block *oldsb,
1730 struct super_block *newsb); 1761 struct super_block *newsb);
1731int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); 1762int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts);
1763int security_dentry_init_security(struct dentry *dentry, int mode,
1764 struct qstr *name, void **ctx,
1765 u32 *ctxlen);
1732 1766
1733int security_inode_alloc(struct inode *inode); 1767int security_inode_alloc(struct inode *inode);
1734void security_inode_free(struct inode *inode); 1768void security_inode_free(struct inode *inode);
@@ -1840,6 +1874,7 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode);
1840int security_getprocattr(struct task_struct *p, char *name, char **value); 1874int security_getprocattr(struct task_struct *p, char *name, char **value);
1841int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); 1875int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
1842int security_netlink_send(struct sock *sk, struct sk_buff *skb); 1876int security_netlink_send(struct sock *sk, struct sk_buff *skb);
1877int security_ismaclabel(const char *name);
1843int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); 1878int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1844int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); 1879int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
1845void security_release_secctx(char *secdata, u32 seclen); 1880void security_release_secctx(char *secdata, u32 seclen);
@@ -2011,7 +2046,9 @@ static inline int security_sb_pivotroot(struct path *old_path,
2011} 2046}
2012 2047
2013static inline int security_sb_set_mnt_opts(struct super_block *sb, 2048static inline int security_sb_set_mnt_opts(struct super_block *sb,
2014 struct security_mnt_opts *opts) 2049 struct security_mnt_opts *opts,
2050 unsigned long kern_flags,
2051 unsigned long *set_kern_flags)
2015{ 2052{
2016 return 0; 2053 return 0;
2017} 2054}
@@ -2035,6 +2072,16 @@ static inline int security_inode_alloc(struct inode *inode)
2035static inline void security_inode_free(struct inode *inode) 2072static inline void security_inode_free(struct inode *inode)
2036{ } 2073{ }
2037 2074
2075static inline int security_dentry_init_security(struct dentry *dentry,
2076 int mode,
2077 struct qstr *name,
2078 void **ctx,
2079 u32 *ctxlen)
2080{
2081 return -EOPNOTSUPP;
2082}
2083
2084
2038static inline int security_inode_init_security(struct inode *inode, 2085static inline int security_inode_init_security(struct inode *inode,
2039 struct inode *dir, 2086 struct inode *dir,
2040 const struct qstr *qstr, 2087 const struct qstr *qstr,
@@ -2520,6 +2567,11 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
2520 return cap_netlink_send(sk, skb); 2567 return cap_netlink_send(sk, skb);
2521} 2568}
2522 2569
2570static inline int security_ismaclabel(const char *name)
2571{
2572 return 0;
2573}
2574
2523static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) 2575static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2524{ 2576{
2525 return -EOPNOTSUPP; 2577 return -EOPNOTSUPP;
diff --git a/include/linux/sem.h b/include/linux/sem.h
index 53d42650b193..976ce3a19f1b 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -12,10 +12,12 @@ struct task_struct;
12struct sem_array { 12struct sem_array {
13 struct kern_ipc_perm ____cacheline_aligned_in_smp 13 struct kern_ipc_perm ____cacheline_aligned_in_smp
14 sem_perm; /* permissions .. see ipc.h */ 14 sem_perm; /* permissions .. see ipc.h */
15 time_t sem_otime; /* last semop time */
16 time_t sem_ctime; /* last change time */ 15 time_t sem_ctime; /* last change time */
17 struct sem *sem_base; /* ptr to first semaphore in array */ 16 struct sem *sem_base; /* ptr to first semaphore in array */
18 struct list_head sem_pending; /* pending operations to be processed */ 17 struct list_head pending_alter; /* pending operations */
18 /* that alter the array */
19 struct list_head pending_const; /* pending complex operations */
20 /* that do not alter semvals */
19 struct list_head list_id; /* undo requests on this array */ 21 struct list_head list_id; /* undo requests on this array */
20 int sem_nsems; /* no. of semaphores in array */ 22 int sem_nsems; /* no. of semaphores in array */
21 int complex_count; /* pending complex operations */ 23 int complex_count; /* pending complex operations */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 2da29ac178fc..4e32edc8f506 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -173,4 +173,10 @@ extern struct hlist_node *seq_hlist_start_head_rcu(struct hlist_head *head,
173extern struct hlist_node *seq_hlist_next_rcu(void *v, 173extern struct hlist_node *seq_hlist_next_rcu(void *v,
174 struct hlist_head *head, 174 struct hlist_head *head,
175 loff_t *ppos); 175 loff_t *ppos);
176
177/* Helpers for iterating over per-cpu hlist_head-s in seq_files */
178extern struct hlist_node *seq_hlist_start_percpu(struct hlist_head __percpu *head, int *cpu, loff_t pos);
179
180extern struct hlist_node *seq_hlist_next_percpu(void *v, struct hlist_head __percpu *head, int *cpu, loff_t *pos);
181
176#endif 182#endif
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 87d4bbc773fc..b98291ac7f14 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -31,6 +31,13 @@
31#include <linux/sysrq.h> 31#include <linux/sysrq.h>
32#include <uapi/linux/serial_core.h> 32#include <uapi/linux/serial_core.h>
33 33
34#ifdef CONFIG_SERIAL_CORE_CONSOLE
35#define uart_console(port) \
36 ((port)->cons && (port)->cons->index == (port)->line)
37#else
38#define uart_console(port) (0)
39#endif
40
34struct uart_port; 41struct uart_port;
35struct serial_struct; 42struct serial_struct;
36struct device; 43struct device;
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index eb763adf9815..d34049712a4d 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -5,7 +5,7 @@
5#include <linux/sh_dma.h> 5#include <linux/sh_dma.h>
6 6
7/* 7/*
8 * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts) 8 * Generic header for SuperH (H)SCI(F) (used by sh/sh64/h8300 and related parts)
9 */ 9 */
10 10
11#define SCIx_NOT_SUPPORTED (-1) 11#define SCIx_NOT_SUPPORTED (-1)
@@ -16,6 +16,7 @@ enum {
16 SCBRR_ALGO_3, /* (((clk * 2) + 16 * bps) / (16 * bps) - 1) */ 16 SCBRR_ALGO_3, /* (((clk * 2) + 16 * bps) / (16 * bps) - 1) */
17 SCBRR_ALGO_4, /* (((clk * 2) + 16 * bps) / (32 * bps) - 1) */ 17 SCBRR_ALGO_4, /* (((clk * 2) + 16 * bps) / (32 * bps) - 1) */
18 SCBRR_ALGO_5, /* (((clk * 1000 / 32) / bps) - 1) */ 18 SCBRR_ALGO_5, /* (((clk * 1000 / 32) / bps) - 1) */
19 SCBRR_ALGO_6, /* HSCIF variable sample rate algorithm */
19}; 20};
20 21
21#define SCSCR_TIE (1 << 7) 22#define SCSCR_TIE (1 << 7)
@@ -37,7 +38,7 @@ enum {
37 38
38#define SCI_DEFAULT_ERROR_MASK (SCI_PER | SCI_FER) 39#define SCI_DEFAULT_ERROR_MASK (SCI_PER | SCI_FER)
39 40
40/* SCxSR SCIF */ 41/* SCxSR SCIF, HSCIF */
41#define SCIF_ER 0x0080 42#define SCIF_ER 0x0080
42#define SCIF_TEND 0x0040 43#define SCIF_TEND 0x0040
43#define SCIF_TDFE 0x0020 44#define SCIF_TDFE 0x0020
@@ -55,6 +56,9 @@ enum {
55#define SCSPTR_SPB2IO (1 << 1) 56#define SCSPTR_SPB2IO (1 << 1)
56#define SCSPTR_SPB2DT (1 << 0) 57#define SCSPTR_SPB2DT (1 << 0)
57 58
59/* HSSRR HSCIF */
60#define HSCIF_SRE 0x8000
61
58/* Offsets into the sci_port->irqs array */ 62/* Offsets into the sci_port->irqs array */
59enum { 63enum {
60 SCIx_ERI_IRQ, 64 SCIx_ERI_IRQ,
@@ -90,6 +94,7 @@ enum {
90 SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 94 SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
91 SCIx_SH4_SCIF_FIFODATA_REGTYPE, 95 SCIx_SH4_SCIF_FIFODATA_REGTYPE,
92 SCIx_SH7705_SCIF_REGTYPE, 96 SCIx_SH7705_SCIF_REGTYPE,
97 SCIx_HSCIF_REGTYPE,
93 98
94 SCIx_NR_REGTYPES, 99 SCIx_NR_REGTYPES,
95}; 100};
@@ -115,6 +120,7 @@ enum {
115 SCSMR, SCBRR, SCSCR, SCxSR, 120 SCSMR, SCBRR, SCSCR, SCxSR,
116 SCFCR, SCFDR, SCxTDR, SCxRDR, 121 SCFCR, SCFDR, SCxTDR, SCxRDR,
117 SCLSR, SCTFDR, SCRFDR, SCSPTR, 122 SCLSR, SCTFDR, SCRFDR, SCSPTR,
123 HSSRR,
118 124
119 SCIx_NR_REGS, 125 SCIx_NR_REGS,
120}; 126};
@@ -137,7 +143,7 @@ struct plat_sci_port {
137 unsigned long mapbase; /* resource base */ 143 unsigned long mapbase; /* resource base */
138 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ 144 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */
139 unsigned int gpios[SCIx_NR_FNS]; /* SCK, RXD, TXD, CTS, RTS */ 145 unsigned int gpios[SCIx_NR_FNS]; /* SCK, RXD, TXD, CTS, RTS */
140 unsigned int type; /* SCI / SCIF / IRDA */ 146 unsigned int type; /* SCI / SCIF / IRDA / HSCIF */
141 upf_t flags; /* UPF_* flags */ 147 upf_t flags; /* UPF_* flags */
142 unsigned long capabilities; /* Port features/capabilities */ 148 unsigned long capabilities; /* Port features/capabilities */
143 149
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
index b64d6bec6f90..4e83f3e034f3 100644
--- a/include/linux/sh_dma.h
+++ b/include/linux/sh_dma.h
@@ -99,6 +99,4 @@ struct sh_dmae_pdata {
99#define CHCR_TE 0x00000002 99#define CHCR_TE 0x00000002
100#define CHCR_IE 0x00000004 100#define CHCR_IE 0x00000004
101 101
102bool shdma_chan_filter(struct dma_chan *chan, void *arg);
103
104#endif 102#endif
diff --git a/include/linux/shdma-base.h b/include/linux/shdma-base.h
index a3728bf66f0e..5b1c9848124c 100644
--- a/include/linux/shdma-base.h
+++ b/include/linux/shdma-base.h
@@ -68,6 +68,8 @@ struct shdma_chan {
68 int id; /* Raw id of this channel */ 68 int id; /* Raw id of this channel */
69 int irq; /* Channel IRQ */ 69 int irq; /* Channel IRQ */
70 int slave_id; /* Client ID for slave DMA */ 70 int slave_id; /* Client ID for slave DMA */
71 int hw_req; /* DMA request line for slave DMA - same
72 * as MID/RID, used with DT */
71 enum shdma_pm_state pm_state; 73 enum shdma_pm_state pm_state;
72}; 74};
73 75
@@ -122,5 +124,10 @@ void shdma_chan_remove(struct shdma_chan *schan);
122int shdma_init(struct device *dev, struct shdma_dev *sdev, 124int shdma_init(struct device *dev, struct shdma_dev *sdev,
123 int chan_num); 125 int chan_num);
124void shdma_cleanup(struct shdma_dev *sdev); 126void shdma_cleanup(struct shdma_dev *sdev);
127#if IS_ENABLED(CONFIG_SH_DMAE_BASE)
128bool shdma_chan_filter(struct dma_chan *chan, void *arg);
129#else
130#define shdma_chan_filter NULL
131#endif
125 132
126#endif 133#endif
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index dec1748cd002..3b71a4e83642 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -319,6 +319,8 @@ enum {
319 SKB_GSO_GRE = 1 << 6, 319 SKB_GSO_GRE = 1 << 6,
320 320
321 SKB_GSO_UDP_TUNNEL = 1 << 7, 321 SKB_GSO_UDP_TUNNEL = 1 << 7,
322
323 SKB_GSO_MPLS = 1 << 8,
322}; 324};
323 325
324#if BITS_PER_LONG > 32 326#if BITS_PER_LONG > 32
@@ -384,11 +386,13 @@ typedef unsigned char *sk_buff_data_t;
384 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS 386 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
385 * @dma_cookie: a cookie to one of several possible DMA operations 387 * @dma_cookie: a cookie to one of several possible DMA operations
386 * done by skb DMA functions 388 * done by skb DMA functions
389 * @napi_id: id of the NAPI struct this skb came from
387 * @secmark: security marking 390 * @secmark: security marking
388 * @mark: Generic packet mark 391 * @mark: Generic packet mark
389 * @dropcount: total number of sk_receive_queue overflows 392 * @dropcount: total number of sk_receive_queue overflows
390 * @vlan_proto: vlan encapsulation protocol 393 * @vlan_proto: vlan encapsulation protocol
391 * @vlan_tci: vlan tag control information 394 * @vlan_tci: vlan tag control information
395 * @inner_protocol: Protocol (encapsulation)
392 * @inner_transport_header: Inner transport layer header (encapsulation) 396 * @inner_transport_header: Inner transport layer header (encapsulation)
393 * @inner_network_header: Network layer header (encapsulation) 397 * @inner_network_header: Network layer header (encapsulation)
394 * @inner_mac_header: Link layer header (encapsulation) 398 * @inner_mac_header: Link layer header (encapsulation)
@@ -497,8 +501,11 @@ struct sk_buff {
497 /* 7/9 bit hole (depending on ndisc_nodetype presence) */ 501 /* 7/9 bit hole (depending on ndisc_nodetype presence) */
498 kmemcheck_bitfield_end(flags2); 502 kmemcheck_bitfield_end(flags2);
499 503
500#ifdef CONFIG_NET_DMA 504#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL
501 dma_cookie_t dma_cookie; 505 union {
506 unsigned int napi_id;
507 dma_cookie_t dma_cookie;
508 };
502#endif 509#endif
503#ifdef CONFIG_NETWORK_SECMARK 510#ifdef CONFIG_NETWORK_SECMARK
504 __u32 secmark; 511 __u32 secmark;
@@ -509,12 +516,13 @@ struct sk_buff {
509 __u32 reserved_tailroom; 516 __u32 reserved_tailroom;
510 }; 517 };
511 518
512 sk_buff_data_t inner_transport_header; 519 __be16 inner_protocol;
513 sk_buff_data_t inner_network_header; 520 __u16 inner_transport_header;
514 sk_buff_data_t inner_mac_header; 521 __u16 inner_network_header;
515 sk_buff_data_t transport_header; 522 __u16 inner_mac_header;
516 sk_buff_data_t network_header; 523 __u16 transport_header;
517 sk_buff_data_t mac_header; 524 __u16 network_header;
525 __u16 mac_header;
518 /* These elements must be at the end, see alloc_skb() for details. */ 526 /* These elements must be at the end, see alloc_skb() for details. */
519 sk_buff_data_t tail; 527 sk_buff_data_t tail;
520 sk_buff_data_t end; 528 sk_buff_data_t end;
@@ -1388,6 +1396,7 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
1388 skb_reset_tail_pointer(skb); 1396 skb_reset_tail_pointer(skb);
1389 skb->tail += offset; 1397 skb->tail += offset;
1390} 1398}
1399
1391#else /* NET_SKBUFF_DATA_USES_OFFSET */ 1400#else /* NET_SKBUFF_DATA_USES_OFFSET */
1392static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) 1401static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
1393{ 1402{
@@ -1528,7 +1537,6 @@ static inline void skb_reset_mac_len(struct sk_buff *skb)
1528 skb->mac_len = skb->network_header - skb->mac_header; 1537 skb->mac_len = skb->network_header - skb->mac_header;
1529} 1538}
1530 1539
1531#ifdef NET_SKBUFF_DATA_USES_OFFSET
1532static inline unsigned char *skb_inner_transport_header(const struct sk_buff 1540static inline unsigned char *skb_inner_transport_header(const struct sk_buff
1533 *skb) 1541 *skb)
1534{ 1542{
@@ -1582,7 +1590,7 @@ static inline void skb_set_inner_mac_header(struct sk_buff *skb,
1582} 1590}
1583static inline bool skb_transport_header_was_set(const struct sk_buff *skb) 1591static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1584{ 1592{
1585 return skb->transport_header != ~0U; 1593 return skb->transport_header != (typeof(skb->transport_header))~0U;
1586} 1594}
1587 1595
1588static inline unsigned char *skb_transport_header(const struct sk_buff *skb) 1596static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
@@ -1625,7 +1633,7 @@ static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1625 1633
1626static inline int skb_mac_header_was_set(const struct sk_buff *skb) 1634static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1627{ 1635{
1628 return skb->mac_header != ~0U; 1636 return skb->mac_header != (typeof(skb->mac_header))~0U;
1629} 1637}
1630 1638
1631static inline void skb_reset_mac_header(struct sk_buff *skb) 1639static inline void skb_reset_mac_header(struct sk_buff *skb)
@@ -1639,112 +1647,6 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1639 skb->mac_header += offset; 1647 skb->mac_header += offset;
1640} 1648}
1641 1649
1642#else /* NET_SKBUFF_DATA_USES_OFFSET */
1643static inline unsigned char *skb_inner_transport_header(const struct sk_buff
1644 *skb)
1645{
1646 return skb->inner_transport_header;
1647}
1648
1649static inline void skb_reset_inner_transport_header(struct sk_buff *skb)
1650{
1651 skb->inner_transport_header = skb->data;
1652}
1653
1654static inline void skb_set_inner_transport_header(struct sk_buff *skb,
1655 const int offset)
1656{
1657 skb->inner_transport_header = skb->data + offset;
1658}
1659
1660static inline unsigned char *skb_inner_network_header(const struct sk_buff *skb)
1661{
1662 return skb->inner_network_header;
1663}
1664
1665static inline void skb_reset_inner_network_header(struct sk_buff *skb)
1666{
1667 skb->inner_network_header = skb->data;
1668}
1669
1670static inline void skb_set_inner_network_header(struct sk_buff *skb,
1671 const int offset)
1672{
1673 skb->inner_network_header = skb->data + offset;
1674}
1675
1676static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb)
1677{
1678 return skb->inner_mac_header;
1679}
1680
1681static inline void skb_reset_inner_mac_header(struct sk_buff *skb)
1682{
1683 skb->inner_mac_header = skb->data;
1684}
1685
1686static inline void skb_set_inner_mac_header(struct sk_buff *skb,
1687 const int offset)
1688{
1689 skb->inner_mac_header = skb->data + offset;
1690}
1691static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1692{
1693 return skb->transport_header != NULL;
1694}
1695
1696static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1697{
1698 return skb->transport_header;
1699}
1700
1701static inline void skb_reset_transport_header(struct sk_buff *skb)
1702{
1703 skb->transport_header = skb->data;
1704}
1705
1706static inline void skb_set_transport_header(struct sk_buff *skb,
1707 const int offset)
1708{
1709 skb->transport_header = skb->data + offset;
1710}
1711
1712static inline unsigned char *skb_network_header(const struct sk_buff *skb)
1713{
1714 return skb->network_header;
1715}
1716
1717static inline void skb_reset_network_header(struct sk_buff *skb)
1718{
1719 skb->network_header = skb->data;
1720}
1721
1722static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
1723{
1724 skb->network_header = skb->data + offset;
1725}
1726
1727static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1728{
1729 return skb->mac_header;
1730}
1731
1732static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1733{
1734 return skb->mac_header != NULL;
1735}
1736
1737static inline void skb_reset_mac_header(struct sk_buff *skb)
1738{
1739 skb->mac_header = skb->data;
1740}
1741
1742static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1743{
1744 skb->mac_header = skb->data + offset;
1745}
1746#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1747
1748static inline void skb_probe_transport_header(struct sk_buff *skb, 1650static inline void skb_probe_transport_header(struct sk_buff *skb,
1749 const int offset_hint) 1651 const int offset_hint)
1750{ 1652{
@@ -2483,6 +2385,7 @@ extern void skb_split(struct sk_buff *skb,
2483 struct sk_buff *skb1, const u32 len); 2385 struct sk_buff *skb1, const u32 len);
2484extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, 2386extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
2485 int shiftlen); 2387 int shiftlen);
2388extern void skb_scrub_packet(struct sk_buff *skb);
2486 2389
2487extern struct sk_buff *skb_segment(struct sk_buff *skb, 2390extern struct sk_buff *skb_segment(struct sk_buff *skb,
2488 netdev_features_t features); 2391 netdev_features_t features);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 0c621752caa6..6c5cc0ea8713 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -169,11 +169,7 @@ struct kmem_cache {
169 struct list_head list; /* List of all slab caches on the system */ 169 struct list_head list; /* List of all slab caches on the system */
170}; 170};
171 171
172#define KMALLOC_MAX_SIZE (1UL << 30) 172#endif /* CONFIG_SLOB */
173
174#include <linux/slob_def.h>
175
176#else /* CONFIG_SLOB */
177 173
178/* 174/*
179 * Kmalloc array related definitions 175 * Kmalloc array related definitions
@@ -195,7 +191,9 @@ struct kmem_cache {
195#ifndef KMALLOC_SHIFT_LOW 191#ifndef KMALLOC_SHIFT_LOW
196#define KMALLOC_SHIFT_LOW 5 192#define KMALLOC_SHIFT_LOW 5
197#endif 193#endif
198#else 194#endif
195
196#ifdef CONFIG_SLUB
199/* 197/*
200 * SLUB allocates up to order 2 pages directly and otherwise 198 * SLUB allocates up to order 2 pages directly and otherwise
201 * passes the request to the page allocator. 199 * passes the request to the page allocator.
@@ -207,6 +205,19 @@ struct kmem_cache {
207#endif 205#endif
208#endif 206#endif
209 207
208#ifdef CONFIG_SLOB
209/*
210 * SLOB passes all page size and larger requests to the page allocator.
211 * No kmalloc array is necessary since objects of different sizes can
212 * be allocated from the same page.
213 */
214#define KMALLOC_SHIFT_MAX 30
215#define KMALLOC_SHIFT_HIGH PAGE_SHIFT
216#ifndef KMALLOC_SHIFT_LOW
217#define KMALLOC_SHIFT_LOW 3
218#endif
219#endif
220
210/* Maximum allocatable size */ 221/* Maximum allocatable size */
211#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX) 222#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX)
212/* Maximum size for which we actually use a slab cache */ 223/* Maximum size for which we actually use a slab cache */
@@ -221,6 +232,7 @@ struct kmem_cache {
221#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW) 232#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
222#endif 233#endif
223 234
235#ifndef CONFIG_SLOB
224extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1]; 236extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1];
225#ifdef CONFIG_ZONE_DMA 237#ifdef CONFIG_ZONE_DMA
226extern struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1]; 238extern struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1];
@@ -275,13 +287,18 @@ static __always_inline int kmalloc_index(size_t size)
275 /* Will never be reached. Needed because the compiler may complain */ 287 /* Will never be reached. Needed because the compiler may complain */
276 return -1; 288 return -1;
277} 289}
290#endif /* !CONFIG_SLOB */
278 291
279#ifdef CONFIG_SLAB 292#ifdef CONFIG_SLAB
280#include <linux/slab_def.h> 293#include <linux/slab_def.h>
281#elif defined(CONFIG_SLUB) 294#endif
295
296#ifdef CONFIG_SLUB
282#include <linux/slub_def.h> 297#include <linux/slub_def.h>
283#else 298#endif
284#error "Unknown slab allocator" 299
300#ifdef CONFIG_SLOB
301#include <linux/slob_def.h>
285#endif 302#endif
286 303
287/* 304/*
@@ -291,6 +308,7 @@ static __always_inline int kmalloc_index(size_t size)
291 */ 308 */
292static __always_inline int kmalloc_size(int n) 309static __always_inline int kmalloc_size(int n)
293{ 310{
311#ifndef CONFIG_SLOB
294 if (n > 2) 312 if (n > 2)
295 return 1 << n; 313 return 1 << n;
296 314
@@ -299,10 +317,9 @@ static __always_inline int kmalloc_size(int n)
299 317
300 if (n == 2 && KMALLOC_MIN_SIZE <= 64) 318 if (n == 2 && KMALLOC_MIN_SIZE <= 64)
301 return 192; 319 return 192;
302 320#endif
303 return 0; 321 return 0;
304} 322}
305#endif /* !CONFIG_SLOB */
306 323
307/* 324/*
308 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment. 325 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment.
@@ -356,9 +373,8 @@ int cache_show(struct kmem_cache *s, struct seq_file *m);
356void print_slabinfo_header(struct seq_file *m); 373void print_slabinfo_header(struct seq_file *m);
357 374
358/** 375/**
359 * kmalloc_array - allocate memory for an array. 376 * kmalloc - allocate memory
360 * @n: number of elements. 377 * @size: how many bytes of memory are required.
361 * @size: element size.
362 * @flags: the type of memory to allocate. 378 * @flags: the type of memory to allocate.
363 * 379 *
364 * The @flags argument may be one of: 380 * The @flags argument may be one of:
@@ -405,6 +421,17 @@ void print_slabinfo_header(struct seq_file *m);
405 * There are other flags available as well, but these are not intended 421 * There are other flags available as well, but these are not intended
406 * for general use, and so are not documented here. For a full list of 422 * for general use, and so are not documented here. For a full list of
407 * potential flags, always refer to linux/gfp.h. 423 * potential flags, always refer to linux/gfp.h.
424 *
425 * kmalloc is the normal method of allocating memory
426 * in the kernel.
427 */
428static __always_inline void *kmalloc(size_t size, gfp_t flags);
429
430/**
431 * kmalloc_array - allocate memory for an array.
432 * @n: number of elements.
433 * @size: element size.
434 * @flags: the type of memory to allocate (see kmalloc).
408 */ 435 */
409static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) 436static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
410{ 437{
@@ -428,7 +455,7 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
428/** 455/**
429 * kmalloc_node - allocate memory from a specific node 456 * kmalloc_node - allocate memory from a specific node
430 * @size: how many bytes of memory are required. 457 * @size: how many bytes of memory are required.
431 * @flags: the type of memory to allocate (see kcalloc). 458 * @flags: the type of memory to allocate (see kmalloc).
432 * @node: node to allocate from. 459 * @node: node to allocate from.
433 * 460 *
434 * kmalloc() for non-local nodes, used to allocate from a specific node 461 * kmalloc() for non-local nodes, used to allocate from a specific node
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index f28e14a12e3f..095a5a4a8516 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -18,14 +18,6 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
18 return __kmalloc_node(size, flags, node); 18 return __kmalloc_node(size, flags, node);
19} 19}
20 20
21/**
22 * kmalloc - allocate memory
23 * @size: how many bytes of memory are required.
24 * @flags: the type of memory to allocate (see kcalloc).
25 *
26 * kmalloc is the normal method of allocating memory
27 * in the kernel.
28 */
29static __always_inline void *kmalloc(size_t size, gfp_t flags) 21static __always_inline void *kmalloc(size_t size, gfp_t flags)
30{ 22{
31 return __kmalloc_node(size, flags, NUMA_NO_NODE); 23 return __kmalloc_node(size, flags, NUMA_NO_NODE);
diff --git a/include/linux/smp.h b/include/linux/smp.h
index c8488763277f..c181399f2c20 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -11,7 +11,6 @@
11#include <linux/list.h> 11#include <linux/list.h>
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/irqflags.h>
15 14
16extern void cpu_idle(void); 15extern void cpu_idle(void);
17 16
@@ -140,17 +139,14 @@ static inline int up_smp_call_function(smp_call_func_t func, void *info)
140} 139}
141#define smp_call_function(func, info, wait) \ 140#define smp_call_function(func, info, wait) \
142 (up_smp_call_function(func, info)) 141 (up_smp_call_function(func, info))
143 142#define on_each_cpu(func, info, wait) \
144static inline int on_each_cpu(smp_call_func_t func, void *info, int wait) 143 ({ \
145{ 144 unsigned long __flags; \
146 unsigned long flags; 145 local_irq_save(__flags); \
147 146 func(info); \
148 local_irq_save(flags); 147 local_irq_restore(__flags); \
149 func(info); 148 0; \
150 local_irq_restore(flags); 149 })
151 return 0;
152}
153
154/* 150/*
155 * Note we still need to test the mask even for UP 151 * Note we still need to test the mask even for UP
156 * because we actually can get an empty mask from 152 * because we actually can get an empty mask from
diff --git a/include/linux/socket.h b/include/linux/socket.h
index b10ce4b341ea..230c04bda3e2 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -167,6 +167,7 @@ struct ucred {
167#define AF_PPPOX 24 /* PPPoX sockets */ 167#define AF_PPPOX 24 /* PPPoX sockets */
168#define AF_WANPIPE 25 /* Wanpipe API Sockets */ 168#define AF_WANPIPE 25 /* Wanpipe API Sockets */
169#define AF_LLC 26 /* Linux LLC */ 169#define AF_LLC 26 /* Linux LLC */
170#define AF_IB 27 /* Native InfiniBand address */
170#define AF_CAN 29 /* Controller Area Network */ 171#define AF_CAN 29 /* Controller Area Network */
171#define AF_TIPC 30 /* TIPC sockets */ 172#define AF_TIPC 30 /* TIPC sockets */
172#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 173#define AF_BLUETOOTH 31 /* Bluetooth sockets */
@@ -211,6 +212,7 @@ struct ucred {
211#define PF_PPPOX AF_PPPOX 212#define PF_PPPOX AF_PPPOX
212#define PF_WANPIPE AF_WANPIPE 213#define PF_WANPIPE AF_WANPIPE
213#define PF_LLC AF_LLC 214#define PF_LLC AF_LLC
215#define PF_IB AF_IB
214#define PF_CAN AF_CAN 216#define PF_CAN AF_CAN
215#define PF_TIPC AF_TIPC 217#define PF_TIPC AF_TIPC
216#define PF_BLUETOOTH AF_BLUETOOTH 218#define PF_BLUETOOTH AF_BLUETOOTH
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 6ff26c8db7b9..28e440be1c07 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -308,6 +308,9 @@ struct spi_master {
308 308
309 /* bitmask of supported bits_per_word for transfers */ 309 /* bitmask of supported bits_per_word for transfers */
310 u32 bits_per_word_mask; 310 u32 bits_per_word_mask;
311#define SPI_BPW_MASK(bits) BIT((bits) - 1)
312#define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0UL : (BIT(bits) - 1))
313#define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1))
311 314
312 /* other constraints relevant to this driver */ 315 /* other constraints relevant to this driver */
313 u16 flags; 316 u16 flags;
diff --git a/include/linux/spi/xilinx_spi.h b/include/linux/spi/xilinx_spi.h
index 6f17278810b0..333ecdfee0d9 100644
--- a/include/linux/spi/xilinx_spi.h
+++ b/include/linux/spi/xilinx_spi.h
@@ -11,7 +11,6 @@
11 */ 11 */
12struct xspi_platform_data { 12struct xspi_platform_data {
13 u16 num_chipselect; 13 u16 num_chipselect;
14 bool little_endian;
15 u8 bits_per_word; 14 u8 bits_per_word;
16 struct spi_board_info *devices; 15 struct spi_board_info *devices;
17 u8 num_devices; 16 u8 num_devices;
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 7d537ced949a..75f34949d9ab 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -117,9 +117,17 @@ do { \
117#endif /*arch_spin_is_contended*/ 117#endif /*arch_spin_is_contended*/
118#endif 118#endif
119 119
120/* The lock does not imply full memory barrier. */ 120/*
121#ifndef ARCH_HAS_SMP_MB_AFTER_LOCK 121 * Despite its name it doesn't necessarily has to be a full barrier.
122static inline void smp_mb__after_lock(void) { smp_mb(); } 122 * It should only guarantee that a STORE before the critical section
123 * can not be reordered with a LOAD inside this section.
124 * spin_lock() is the one-way barrier, this LOAD can not escape out
125 * of the region. So the default implementation simply ensures that
126 * a STORE can not move into the critical section, smp_wmb() should
127 * serialize it with another STORE done by spin_lock().
128 */
129#ifndef smp_mb__before_spinlock
130#define smp_mb__before_spinlock() smp_wmb()
123#endif 131#endif
124 132
125/** 133/**
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index 51df117abe46..bdb9993f0fda 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -144,7 +144,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
144 LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); 144 LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock);
145} 145}
146 146
147#endif /* CONFIG_PREEMPT */ 147#endif /* !CONFIG_GENERIC_LOCKBREAK || CONFIG_DEBUG_LOCK_ALLOC */
148 148
149static inline void __raw_spin_unlock(raw_spinlock_t *lock) 149static inline void __raw_spin_unlock(raw_spinlock_t *lock)
150{ 150{
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h
index e2369c167dbd..8b3ac0d718eb 100644
--- a/include/linux/spinlock_up.h
+++ b/include/linux/spinlock_up.h
@@ -67,7 +67,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)
67 67
68#else /* DEBUG_SPINLOCK */ 68#else /* DEBUG_SPINLOCK */
69#define arch_spin_is_locked(lock) ((void)(lock), 0) 69#define arch_spin_is_locked(lock) ((void)(lock), 0)
70/* for sched.c and kernel_lock.c: */ 70/* for sched/core.c and kernel_lock.c: */
71# define arch_spin_lock(lock) do { barrier(); (void)(lock); } while (0) 71# define arch_spin_lock(lock) do { barrier(); (void)(lock); } while (0)
72# define arch_spin_lock_flags(lock, flags) do { barrier(); (void)(lock); } while (0) 72# define arch_spin_lock_flags(lock, flags) do { barrier(); (void)(lock); } while (0)
73# define arch_spin_unlock(lock) do { barrier(); (void)(lock); } while (0) 73# define arch_spin_unlock(lock) do { barrier(); (void)(lock); } while (0)
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 04f4121a23ae..c114614ed172 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -237,47 +237,4 @@ static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
237 __srcu_read_unlock(sp, idx); 237 __srcu_read_unlock(sp, idx);
238} 238}
239 239
240/**
241 * srcu_read_lock_raw - register a new reader for an SRCU-protected structure.
242 * @sp: srcu_struct in which to register the new reader.
243 *
244 * Enter an SRCU read-side critical section. Similar to srcu_read_lock(),
245 * but avoids the RCU-lockdep checking. This means that it is legal to
246 * use srcu_read_lock_raw() in one context, for example, in an exception
247 * handler, and then have the matching srcu_read_unlock_raw() in another
248 * context, for example in the task that took the exception.
249 *
250 * However, the entire SRCU read-side critical section must reside within a
251 * single task. For example, beware of using srcu_read_lock_raw() in
252 * a device interrupt handler and srcu_read_unlock() in the interrupted
253 * task: This will not work if interrupts are threaded.
254 */
255static inline int srcu_read_lock_raw(struct srcu_struct *sp)
256{
257 unsigned long flags;
258 int ret;
259
260 local_irq_save(flags);
261 ret = __srcu_read_lock(sp);
262 local_irq_restore(flags);
263 return ret;
264}
265
266/**
267 * srcu_read_unlock_raw - unregister reader from an SRCU-protected structure.
268 * @sp: srcu_struct in which to unregister the old reader.
269 * @idx: return value from corresponding srcu_read_lock_raw().
270 *
271 * Exit an SRCU read-side critical section without lockdep-RCU checking.
272 * See srcu_read_lock_raw() for more details.
273 */
274static inline void srcu_read_unlock_raw(struct srcu_struct *sp, int idx)
275{
276 unsigned long flags;
277
278 local_irq_save(flags);
279 __srcu_read_unlock(sp, idx);
280 local_irq_restore(flags);
281}
282
283#endif 240#endif
diff --git a/include/linux/ssb/ssb_driver_mips.h b/include/linux/ssb/ssb_driver_mips.h
index afe79d40a99e..6535e4718fde 100644
--- a/include/linux/ssb/ssb_driver_mips.h
+++ b/include/linux/ssb/ssb_driver_mips.h
@@ -20,6 +20,18 @@ struct ssb_pflash {
20 u32 window_size; 20 u32 window_size;
21}; 21};
22 22
23#ifdef CONFIG_SSB_SFLASH
24struct ssb_sflash {
25 bool present;
26 u32 window;
27 u32 blocksize;
28 u16 numblocks;
29 u32 size;
30
31 void *priv;
32};
33#endif
34
23struct ssb_mipscore { 35struct ssb_mipscore {
24 struct ssb_device *dev; 36 struct ssb_device *dev;
25 37
@@ -27,6 +39,9 @@ struct ssb_mipscore {
27 struct ssb_serial_port serial_ports[4]; 39 struct ssb_serial_port serial_ports[4];
28 40
29 struct ssb_pflash pflash; 41 struct ssb_pflash pflash;
42#ifdef CONFIG_SSB_SFLASH
43 struct ssb_sflash sflash;
44#endif
30}; 45};
31 46
32extern void ssb_mipscore_init(struct ssb_mipscore *mcore); 47extern void ssb_mipscore_init(struct ssb_mipscore *mcore);
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 3a7256955b10..f9f931c89e3e 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -172,6 +172,7 @@
172#define SSB_SPROMSIZE_WORDS_R4 220 172#define SSB_SPROMSIZE_WORDS_R4 220
173#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16)) 173#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16))
174#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16)) 174#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16))
175#define SSB_SPROMSIZE_WORDS_R10 230
175#define SSB_SPROM_BASE1 0x1000 176#define SSB_SPROM_BASE1 0x1000
176#define SSB_SPROM_BASE31 0x0800 177#define SSB_SPROM_BASE31 0x0800
177#define SSB_SPROM_REVISION 0x007E 178#define SSB_SPROM_REVISION 0x007E
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index c1b3ed3fb787..9e495d31516e 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -80,6 +80,10 @@ struct stmmac_mdio_bus_data {
80 unsigned int phy_mask; 80 unsigned int phy_mask;
81 int *irqs; 81 int *irqs;
82 int probed_phy_irq; 82 int probed_phy_irq;
83#ifdef CONFIG_OF
84 int reset_gpio, active_low;
85 u32 delays[3];
86#endif
83}; 87};
84 88
85struct stmmac_dma_cfg { 89struct stmmac_dma_cfg {
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 303399b1ba59..6ce690de447f 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -57,6 +57,7 @@ struct cache_head {
57#define CACHE_VALID 0 /* Entry contains valid data */ 57#define CACHE_VALID 0 /* Entry contains valid data */
58#define CACHE_NEGATIVE 1 /* Negative entry - there is no match for the key */ 58#define CACHE_NEGATIVE 1 /* Negative entry - there is no match for the key */
59#define CACHE_PENDING 2 /* An upcall has been sent but no reply received yet*/ 59#define CACHE_PENDING 2 /* An upcall has been sent but no reply received yet*/
60#define CACHE_CLEANED 3 /* Entry has been cleaned from cache */
60 61
61#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */ 62#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */
62 63
@@ -148,6 +149,24 @@ struct cache_deferred_req {
148 int too_many); 149 int too_many);
149}; 150};
150 151
152/*
153 * timestamps kept in the cache are expressed in seconds
154 * since boot. This is the best for measuring differences in
155 * real time.
156 */
157static inline time_t seconds_since_boot(void)
158{
159 struct timespec boot;
160 getboottime(&boot);
161 return get_seconds() - boot.tv_sec;
162}
163
164static inline time_t convert_to_wallclock(time_t sinceboot)
165{
166 struct timespec boot;
167 getboottime(&boot);
168 return boot.tv_sec + sinceboot;
169}
151 170
152extern const struct file_operations cache_file_operations_pipefs; 171extern const struct file_operations cache_file_operations_pipefs;
153extern const struct file_operations content_file_operations_pipefs; 172extern const struct file_operations content_file_operations_pipefs;
@@ -181,15 +200,10 @@ static inline void cache_put(struct cache_head *h, struct cache_detail *cd)
181 kref_put(&h->ref, cd->cache_put); 200 kref_put(&h->ref, cd->cache_put);
182} 201}
183 202
184static inline int cache_valid(struct cache_head *h) 203static inline int cache_is_expired(struct cache_detail *detail, struct cache_head *h)
185{ 204{
186 /* If an item has been unhashed pending removal when 205 return (h->expiry_time < seconds_since_boot()) ||
187 * the refcount drops to 0, the expiry_time will be 206 (detail->flush_time > h->last_refresh);
188 * set to 0. We don't want to consider such items
189 * valid in this context even though CACHE_VALID is
190 * set.
191 */
192 return (h->expiry_time != 0 && test_bit(CACHE_VALID, &h->flags));
193} 207}
194 208
195extern int cache_check(struct cache_detail *detail, 209extern int cache_check(struct cache_detail *detail,
@@ -250,25 +264,6 @@ static inline int get_uint(char **bpp, unsigned int *anint)
250 return 0; 264 return 0;
251} 265}
252 266
253/*
254 * timestamps kept in the cache are expressed in seconds
255 * since boot. This is the best for measuring differences in
256 * real time.
257 */
258static inline time_t seconds_since_boot(void)
259{
260 struct timespec boot;
261 getboottime(&boot);
262 return get_seconds() - boot.tv_sec;
263}
264
265static inline time_t convert_to_wallclock(time_t sinceboot)
266{
267 struct timespec boot;
268 getboottime(&boot);
269 return boot.tv_sec + sinceboot;
270}
271
272static inline time_t get_expiry(char **bpp) 267static inline time_t get_expiry(char **bpp)
273{ 268{
274 int rv; 269 int rv;
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 161463e59624..1f911ccb2a75 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -151,6 +151,8 @@ struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
151/* Fill in an array with a list of supported pseudoflavors */ 151/* Fill in an array with a list of supported pseudoflavors */
152int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int); 152int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int);
153 153
154struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
155
154/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a 156/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a
155 * corresponding call to gss_mech_put. */ 157 * corresponding call to gss_mech_put. */
156void gss_mech_put(struct gss_api_mech *); 158void gss_mech_put(struct gss_api_mech *);
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index a7b422b33eda..aa5b582cc471 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -73,12 +73,12 @@ extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *,
73extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *); 73extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *);
74 74
75struct rpc_clnt; 75struct rpc_clnt;
76extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *); 76extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *);
77extern int rpc_remove_client_dir(struct dentry *); 77extern int rpc_remove_client_dir(struct dentry *);
78 78
79struct cache_detail; 79struct cache_detail;
80extern struct dentry *rpc_create_cache_dir(struct dentry *, 80extern struct dentry *rpc_create_cache_dir(struct dentry *,
81 struct qstr *, 81 const char *,
82 umode_t umode, 82 umode_t umode,
83 struct cache_detail *); 83 struct cache_detail *);
84extern void rpc_remove_cache_dir(struct dentry *); 84extern void rpc_remove_cache_dir(struct dentry *);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 84ca436b76c2..1821445708d6 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -88,15 +88,6 @@ struct rpc_task {
88 tk_rebind_retry : 2; 88 tk_rebind_retry : 2;
89}; 89};
90 90
91/* support walking a list of tasks on a wait queue */
92#define task_for_each(task, pos, head) \
93 list_for_each(pos, head) \
94 if ((task=list_entry(pos, struct rpc_task, u.tk_wait.list)),1)
95
96#define task_for_first(task, head) \
97 if (!list_empty(head) && \
98 ((task=list_entry((head)->next, struct rpc_task, u.tk_wait.list)),1))
99
100typedef void (*rpc_action)(struct rpc_task *); 91typedef void (*rpc_action)(struct rpc_task *);
101 92
102struct rpc_call_ops { 93struct rpc_call_ops {
@@ -130,6 +121,7 @@ struct rpc_task_setup {
130#define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */ 121#define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */
131#define RPC_TASK_SENT 0x0800 /* message was sent */ 122#define RPC_TASK_SENT 0x0800 /* message was sent */
132#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ 123#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */
124#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */
133 125
134#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 126#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
135#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 127#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
@@ -238,7 +230,6 @@ struct rpc_task *rpc_wake_up_first(struct rpc_wait_queue *,
238 bool (*)(struct rpc_task *, void *), 230 bool (*)(struct rpc_task *, void *),
239 void *); 231 void *);
240void rpc_wake_up_status(struct rpc_wait_queue *, int); 232void rpc_wake_up_status(struct rpc_wait_queue *, int);
241int rpc_queue_empty(struct rpc_wait_queue *);
242void rpc_delay(struct rpc_task *, unsigned long); 233void rpc_delay(struct rpc_task *, unsigned long);
243void * rpc_malloc(struct rpc_task *, size_t); 234void * rpc_malloc(struct rpc_task *, size_t);
244void rpc_free(void *); 235void rpc_free(void *);
@@ -259,16 +250,6 @@ static inline int rpc_wait_for_completion_task(struct rpc_task *task)
259 return __rpc_wait_for_completion_task(task, NULL); 250 return __rpc_wait_for_completion_task(task, NULL);
260} 251}
261 252
262static inline void rpc_task_set_priority(struct rpc_task *task, unsigned char prio)
263{
264 task->tk_priority = prio - RPC_PRIORITY_LOW;
265}
266
267static inline int rpc_task_has_priority(struct rpc_task *task, unsigned char prio)
268{
269 return (task->tk_priority + RPC_PRIORITY_LOW == prio);
270}
271
272#if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS) 253#if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS)
273static inline const char * rpc_qname(const struct rpc_wait_queue *q) 254static inline const char * rpc_qname(const struct rpc_wait_queue *q)
274{ 255{
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index ff374ab30839..8d71d6577459 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -14,6 +14,7 @@
14#include <linux/string.h> 14#include <linux/string.h>
15#include <linux/sunrpc/msg_prot.h> 15#include <linux/sunrpc/msg_prot.h>
16#include <linux/sunrpc/cache.h> 16#include <linux/sunrpc/cache.h>
17#include <linux/sunrpc/gss_api.h>
17#include <linux/hash.h> 18#include <linux/hash.h>
18#include <linux/cred.h> 19#include <linux/cred.h>
19 20
@@ -23,13 +24,23 @@ struct svc_cred {
23 struct group_info *cr_group_info; 24 struct group_info *cr_group_info;
24 u32 cr_flavor; /* pseudoflavor */ 25 u32 cr_flavor; /* pseudoflavor */
25 char *cr_principal; /* for gss */ 26 char *cr_principal; /* for gss */
27 struct gss_api_mech *cr_gss_mech;
26}; 28};
27 29
30static inline void init_svc_cred(struct svc_cred *cred)
31{
32 cred->cr_group_info = NULL;
33 cred->cr_principal = NULL;
34 cred->cr_gss_mech = NULL;
35}
36
28static inline void free_svc_cred(struct svc_cred *cred) 37static inline void free_svc_cred(struct svc_cred *cred)
29{ 38{
30 if (cred->cr_group_info) 39 if (cred->cr_group_info)
31 put_group_info(cred->cr_group_info); 40 put_group_info(cred->cr_group_info);
32 kfree(cred->cr_principal); 41 kfree(cred->cr_principal);
42 gss_mech_put(cred->cr_gss_mech);
43 init_svc_cred(cred);
33} 44}
34 45
35struct svc_rqst; /* forward decl */ 46struct svc_rqst; /* forward decl */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index d4e3f16d5e89..f73cabf59012 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -363,6 +363,7 @@ extern bool pm_wakeup_pending(void);
363extern bool pm_get_wakeup_count(unsigned int *count, bool block); 363extern bool pm_get_wakeup_count(unsigned int *count, bool block);
364extern bool pm_save_wakeup_count(unsigned int count); 364extern bool pm_save_wakeup_count(unsigned int count);
365extern void pm_wakep_autosleep_enabled(bool set); 365extern void pm_wakep_autosleep_enabled(bool set);
366extern void pm_print_active_wakeup_sources(void);
366 367
367static inline void lock_system_sleep(void) 368static inline void lock_system_sleep(void)
368{ 369{
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 1701ce4be746..d95cde5e257d 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -10,6 +10,7 @@
10#include <linux/node.h> 10#include <linux/node.h>
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/atomic.h> 12#include <linux/atomic.h>
13#include <linux/page-flags.h>
13#include <asm/page.h> 14#include <asm/page.h>
14 15
15struct notifier_block; 16struct notifier_block;
@@ -19,10 +20,13 @@ struct bio;
19#define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */ 20#define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */
20#define SWAP_FLAG_PRIO_MASK 0x7fff 21#define SWAP_FLAG_PRIO_MASK 0x7fff
21#define SWAP_FLAG_PRIO_SHIFT 0 22#define SWAP_FLAG_PRIO_SHIFT 0
22#define SWAP_FLAG_DISCARD 0x10000 /* discard swap cluster after use */ 23#define SWAP_FLAG_DISCARD 0x10000 /* enable discard for swap */
24#define SWAP_FLAG_DISCARD_ONCE 0x20000 /* discard swap area at swapon-time */
25#define SWAP_FLAG_DISCARD_PAGES 0x40000 /* discard page-clusters after use */
23 26
24#define SWAP_FLAGS_VALID (SWAP_FLAG_PRIO_MASK | SWAP_FLAG_PREFER | \ 27#define SWAP_FLAGS_VALID (SWAP_FLAG_PRIO_MASK | SWAP_FLAG_PREFER | \
25 SWAP_FLAG_DISCARD) 28 SWAP_FLAG_DISCARD | SWAP_FLAG_DISCARD_ONCE | \
29 SWAP_FLAG_DISCARD_PAGES)
26 30
27static inline int current_is_kswapd(void) 31static inline int current_is_kswapd(void)
28{ 32{
@@ -146,14 +150,16 @@ struct swap_extent {
146enum { 150enum {
147 SWP_USED = (1 << 0), /* is slot in swap_info[] used? */ 151 SWP_USED = (1 << 0), /* is slot in swap_info[] used? */
148 SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */ 152 SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */
149 SWP_DISCARDABLE = (1 << 2), /* swapon+blkdev support discard */ 153 SWP_DISCARDABLE = (1 << 2), /* blkdev support discard */
150 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */ 154 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
151 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */ 155 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
152 SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */ 156 SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */
153 SWP_BLKDEV = (1 << 6), /* its a block device */ 157 SWP_BLKDEV = (1 << 6), /* its a block device */
154 SWP_FILE = (1 << 7), /* set after swap_activate success */ 158 SWP_FILE = (1 << 7), /* set after swap_activate success */
159 SWP_AREA_DISCARD = (1 << 8), /* single-time swap area discards */
160 SWP_PAGE_DISCARD = (1 << 9), /* freed swap page-cluster discards */
155 /* add others here before... */ 161 /* add others here before... */
156 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ 162 SWP_SCANNING = (1 << 10), /* refcount in scan_swap_map */
157}; 163};
158 164
159#define SWAP_CLUSTER_MAX 32UL 165#define SWAP_CLUSTER_MAX 32UL
@@ -233,8 +239,8 @@ extern unsigned long nr_free_pagecache_pages(void);
233 239
234 240
235/* linux/mm/swap.c */ 241/* linux/mm/swap.c */
236extern void __lru_cache_add(struct page *, enum lru_list lru); 242extern void __lru_cache_add(struct page *);
237extern void lru_cache_add_lru(struct page *, enum lru_list lru); 243extern void lru_cache_add(struct page *);
238extern void lru_add_page_tail(struct page *page, struct page *page_tail, 244extern void lru_add_page_tail(struct page *page, struct page *page_tail,
239 struct lruvec *lruvec, struct list_head *head); 245 struct lruvec *lruvec, struct list_head *head);
240extern void activate_page(struct page *); 246extern void activate_page(struct page *);
@@ -254,12 +260,14 @@ extern void add_page_to_unevictable_list(struct page *page);
254 */ 260 */
255static inline void lru_cache_add_anon(struct page *page) 261static inline void lru_cache_add_anon(struct page *page)
256{ 262{
257 __lru_cache_add(page, LRU_INACTIVE_ANON); 263 ClearPageActive(page);
264 __lru_cache_add(page);
258} 265}
259 266
260static inline void lru_cache_add_file(struct page *page) 267static inline void lru_cache_add_file(struct page *page)
261{ 268{
262 __lru_cache_add(page, LRU_INACTIVE_FILE); 269 ClearPageActive(page);
270 __lru_cache_add(page);
263} 271}
264 272
265/* linux/mm/vmscan.c */ 273/* linux/mm/vmscan.c */
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index c5fd30d2a415..8d4fa82bfb91 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -67,6 +67,8 @@ static inline swp_entry_t pte_to_swp_entry(pte_t pte)
67 swp_entry_t arch_entry; 67 swp_entry_t arch_entry;
68 68
69 BUG_ON(pte_file(pte)); 69 BUG_ON(pte_file(pte));
70 if (pte_swp_soft_dirty(pte))
71 pte = pte_swp_clear_soft_dirty(pte);
70 arch_entry = __pte_to_swp_entry(pte); 72 arch_entry = __pte_to_swp_entry(pte);
71 return swp_entry(__swp_type(arch_entry), __swp_offset(arch_entry)); 73 return swp_entry(__swp_type(arch_entry), __swp_offset(arch_entry));
72} 74}
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 4147d700a293..84662ecc7b51 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -802,9 +802,14 @@ asmlinkage long sys_vfork(void);
802asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, int, 802asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, int,
803 int __user *); 803 int __user *);
804#else 804#else
805#ifdef CONFIG_CLONE_BACKWARDS3
806asmlinkage long sys_clone(unsigned long, unsigned long, int, int __user *,
807 int __user *, int);
808#else
805asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, 809asmlinkage long sys_clone(unsigned long, unsigned long, int __user *,
806 int __user *, int); 810 int __user *, int);
807#endif 811#endif
812#endif
808 813
809asmlinkage long sys_execve(const char __user *filename, 814asmlinkage long sys_execve(const char __user *filename,
810 const char __user *const __user *argv, 815 const char __user *const __user *argv,
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index e2cee22f578a..9e8a9b555ad6 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -17,10 +17,12 @@
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/lockdep.h> 18#include <linux/lockdep.h>
19#include <linux/kobject_ns.h> 19#include <linux/kobject_ns.h>
20#include <linux/stat.h>
20#include <linux/atomic.h> 21#include <linux/atomic.h>
21 22
22struct kobject; 23struct kobject;
23struct module; 24struct module;
25struct bin_attribute;
24enum kobj_ns_type; 26enum kobj_ns_type;
25 27
26struct attribute { 28struct attribute {
@@ -59,26 +61,28 @@ struct attribute_group {
59 umode_t (*is_visible)(struct kobject *, 61 umode_t (*is_visible)(struct kobject *,
60 struct attribute *, int); 62 struct attribute *, int);
61 struct attribute **attrs; 63 struct attribute **attrs;
64 struct bin_attribute **bin_attrs;
62}; 65};
63 66
64
65
66/** 67/**
67 * Use these macros to make defining attributes easier. See include/linux/device.h 68 * Use these macros to make defining attributes easier. See include/linux/device.h
68 * for examples.. 69 * for examples..
69 */ 70 */
70 71
71#define __ATTR(_name,_mode,_show,_store) { \ 72#define __ATTR(_name,_mode,_show,_store) { \
72 .attr = {.name = __stringify(_name), .mode = _mode }, \ 73 .attr = {.name = __stringify(_name), .mode = _mode }, \
73 .show = _show, \ 74 .show = _show, \
74 .store = _store, \ 75 .store = _store, \
75} 76}
76 77
77#define __ATTR_RO(_name) { \ 78#define __ATTR_RO(_name) { \
78 .attr = { .name = __stringify(_name), .mode = 0444 }, \ 79 .attr = { .name = __stringify(_name), .mode = S_IRUGO }, \
79 .show = _name##_show, \ 80 .show = _name##_show, \
80} 81}
81 82
83#define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO), \
84 _name##_show, _name##_store)
85
82#define __ATTR_NULL { .attr = { .name = NULL } } 86#define __ATTR_NULL { .attr = { .name = NULL } }
83 87
84#ifdef CONFIG_DEBUG_LOCK_ALLOC 88#ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -92,6 +96,18 @@ struct attribute_group {
92#define __ATTR_IGNORE_LOCKDEP __ATTR 96#define __ATTR_IGNORE_LOCKDEP __ATTR
93#endif 97#endif
94 98
99#define __ATTRIBUTE_GROUPS(_name) \
100static const struct attribute_group *_name##_groups[] = { \
101 &_name##_group, \
102 NULL, \
103}
104
105#define ATTRIBUTE_GROUPS(_name) \
106static const struct attribute_group _name##_group = { \
107 .attrs = _name##_attrs, \
108}; \
109__ATTRIBUTE_GROUPS(_name)
110
95#define attr_name(_attr) (_attr).attr.name 111#define attr_name(_attr) (_attr).attr.name
96 112
97struct file; 113struct file;
@@ -121,6 +137,36 @@ struct bin_attribute {
121 */ 137 */
122#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr) 138#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr)
123 139
140/* macros to create static binary attributes easier */
141#define __BIN_ATTR(_name, _mode, _read, _write, _size) { \
142 .attr = { .name = __stringify(_name), .mode = _mode }, \
143 .read = _read, \
144 .write = _write, \
145 .size = _size, \
146}
147
148#define __BIN_ATTR_RO(_name, _size) { \
149 .attr = { .name = __stringify(_name), .mode = S_IRUGO }, \
150 .read = _name##_read, \
151 .size = _size, \
152}
153
154#define __BIN_ATTR_RW(_name, _size) __BIN_ATTR(_name, \
155 (S_IWUSR | S_IRUGO), _name##_read, \
156 _name##_write)
157
158#define __BIN_ATTR_NULL __ATTR_NULL
159
160#define BIN_ATTR(_name, _mode, _read, _write, _size) \
161struct bin_attribute bin_attr_##_name = __BIN_ATTR(_name, _mode, _read, \
162 _write, _size)
163
164#define BIN_ATTR_RO(_name, _size) \
165struct bin_attribute bin_attr_##_name = __BIN_ATTR_RO(_name, _size)
166
167#define BIN_ATTR_RW(_name, _size) \
168struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size)
169
124struct sysfs_ops { 170struct sysfs_ops {
125 ssize_t (*show)(struct kobject *, struct attribute *,char *); 171 ssize_t (*show)(struct kobject *, struct attribute *,char *);
126 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 172 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t);
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 5adbc33d1ab3..472120b4fac5 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -246,7 +246,6 @@ struct tcp_sock {
246 246
247 /* from STCP, retrans queue hinting */ 247 /* from STCP, retrans queue hinting */
248 struct sk_buff* lost_skb_hint; 248 struct sk_buff* lost_skb_hint;
249 struct sk_buff *scoreboard_skb_hint;
250 struct sk_buff *retransmit_skb_hint; 249 struct sk_buff *retransmit_skb_hint;
251 250
252 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 251 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 9180f4b85e6d..62bd8b72873c 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -174,10 +174,4 @@ static inline void tick_nohz_task_switch(struct task_struct *tsk) { }
174#endif 174#endif
175 175
176 176
177# ifdef CONFIG_CPU_IDLE_GOV_MENU
178extern void menu_hrtimer_cancel(void);
179# else
180static inline void menu_hrtimer_cancel(void) {}
181# endif /* CONFIG_CPU_IDLE_GOV_MENU */
182
183#endif 177#endif
diff --git a/include/linux/tpm.h b/include/linux/tpm.h
index fcb627ff8d3e..9a9051bb1a03 100644
--- a/include/linux/tpm.h
+++ b/include/linux/tpm.h
@@ -22,6 +22,8 @@
22#ifndef __LINUX_TPM_H__ 22#ifndef __LINUX_TPM_H__
23#define __LINUX_TPM_H__ 23#define __LINUX_TPM_H__
24 24
25#define TPM_DIGEST_SIZE 20 /* Max TPM v1.2 PCR size */
26
25/* 27/*
26 * Chip num is this value or a valid tpm idx 28 * Chip num is this value or a valid tpm idx
27 */ 29 */
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index f8e084d0fc77..ebeab360d851 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -378,6 +378,8 @@ static inline void tracepoint_synchronize_unregister(void)
378#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) 378#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
379#define DEFINE_EVENT(template, name, proto, args) \ 379#define DEFINE_EVENT(template, name, proto, args) \
380 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) 380 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
381#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg)\
382 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
381#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ 383#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
382 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) 384 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
383#define DEFINE_EVENT_CONDITION(template, name, proto, \ 385#define DEFINE_EVENT_CONDITION(template, name, proto, \
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 8780bd2a272a..01ac30efd6a6 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -272,7 +272,6 @@ struct tty_struct {
272#define N_TTY_BUF_SIZE 4096 272#define N_TTY_BUF_SIZE 4096
273 273
274 unsigned char closing:1; 274 unsigned char closing:1;
275 unsigned short minimum_to_wake;
276 unsigned char *write_buf; 275 unsigned char *write_buf;
277 int write_cnt; 276 int write_cnt;
278 /* If the tty has a pending do_SAK, queue it here - akpm */ 277 /* If the tty has a pending do_SAK, queue it here - akpm */
@@ -309,8 +308,6 @@ struct tty_file_private {
309#define TTY_LDISC 9 /* Line discipline attached */ 308#define TTY_LDISC 9 /* Line discipline attached */
310#define TTY_LDISC_CHANGING 10 /* Line discipline changing */ 309#define TTY_LDISC_CHANGING 10 /* Line discipline changing */
311#define TTY_LDISC_OPEN 11 /* Line discipline is open */ 310#define TTY_LDISC_OPEN 11 /* Line discipline is open */
312#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */
313#define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */
314#define TTY_PTY_LOCK 16 /* pty private */ 311#define TTY_PTY_LOCK 16 /* pty private */
315#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 312#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
316#define TTY_HUPPED 18 /* Post driver->hangup() */ 313#define TTY_HUPPED 18 /* Post driver->hangup() */
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 58390c73df8b..a1b048999821 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -100,6 +100,11 @@
100 * seek to perform this action quickly but should wait until 100 * seek to perform this action quickly but should wait until
101 * any pending driver I/O is completed. 101 * any pending driver I/O is completed.
102 * 102 *
103 * void (*fasync)(struct tty_struct *, int on)
104 *
105 * Notify line discipline when signal-driven I/O is enabled or
106 * disabled.
107 *
103 * void (*dcd_change)(struct tty_struct *tty, unsigned int status) 108 * void (*dcd_change)(struct tty_struct *tty, unsigned int status)
104 * 109 *
105 * Tells the discipline that the DCD pin has changed its status. 110 * Tells the discipline that the DCD pin has changed its status.
@@ -110,6 +115,52 @@
110#include <linux/wait.h> 115#include <linux/wait.h>
111#include <linux/wait.h> 116#include <linux/wait.h>
112 117
118
119/*
120 * the semaphore definition
121 */
122struct ld_semaphore {
123 long count;
124 raw_spinlock_t wait_lock;
125 unsigned int wait_readers;
126 struct list_head read_wait;
127 struct list_head write_wait;
128#ifdef CONFIG_DEBUG_LOCK_ALLOC
129 struct lockdep_map dep_map;
130#endif
131};
132
133extern void __init_ldsem(struct ld_semaphore *sem, const char *name,
134 struct lock_class_key *key);
135
136#define init_ldsem(sem) \
137do { \
138 static struct lock_class_key __key; \
139 \
140 __init_ldsem((sem), #sem, &__key); \
141} while (0)
142
143
144extern int ldsem_down_read(struct ld_semaphore *sem, long timeout);
145extern int ldsem_down_read_trylock(struct ld_semaphore *sem);
146extern int ldsem_down_write(struct ld_semaphore *sem, long timeout);
147extern int ldsem_down_write_trylock(struct ld_semaphore *sem);
148extern void ldsem_up_read(struct ld_semaphore *sem);
149extern void ldsem_up_write(struct ld_semaphore *sem);
150
151#ifdef CONFIG_DEBUG_LOCK_ALLOC
152extern int ldsem_down_read_nested(struct ld_semaphore *sem, int subclass,
153 long timeout);
154extern int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass,
155 long timeout);
156#else
157# define ldsem_down_read_nested(sem, subclass, timeout) \
158 ldsem_down_read(sem, timeout)
159# define ldsem_down_write_nested(sem, subclass, timeout) \
160 ldsem_down_write(sem, timeout)
161#endif
162
163
113struct tty_ldisc_ops { 164struct tty_ldisc_ops {
114 int magic; 165 int magic;
115 char *name; 166 char *name;
@@ -143,6 +194,7 @@ struct tty_ldisc_ops {
143 char *fp, int count); 194 char *fp, int count);
144 void (*write_wakeup)(struct tty_struct *); 195 void (*write_wakeup)(struct tty_struct *);
145 void (*dcd_change)(struct tty_struct *, unsigned int); 196 void (*dcd_change)(struct tty_struct *, unsigned int);
197 void (*fasync)(struct tty_struct *tty, int on);
146 198
147 struct module *owner; 199 struct module *owner;
148 200
diff --git a/include/linux/usb.h b/include/linux/usb.h
index a0bee5a28d1a..0eec2689b955 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -367,17 +367,6 @@ struct usb_bus {
367 367
368/* ----------------------------------------------------------------------- */ 368/* ----------------------------------------------------------------------- */
369 369
370/* This is arbitrary.
371 * From USB 2.0 spec Table 11-13, offset 7, a hub can
372 * have up to 255 ports. The most yet reported is 10.
373 *
374 * Current Wireless USB host hardware (Intel i1480 for example) allows
375 * up to 22 devices to connect. Upcoming hardware might raise that
376 * limit. Because the arrays need to add a bit for hub status data, we
377 * do 31, so plus one evens out to four bytes.
378 */
379#define USB_MAXCHILDREN (31)
380
381struct usb_tt; 370struct usb_tt;
382 371
383enum usb_device_removable { 372enum usb_device_removable {
@@ -394,6 +383,22 @@ enum usb_port_connect_type {
394}; 383};
395 384
396/* 385/*
386 * USB 2.0 Link Power Management (LPM) parameters.
387 */
388struct usb2_lpm_parameters {
389 /* Best effort service latency indicate how long the host will drive
390 * resume on an exit from L1.
391 */
392 unsigned int besl;
393
394 /* Timeout value in microseconds for the L1 inactivity (LPM) timer.
395 * When the timer counts to zero, the parent hub will initiate a LPM
396 * transition to L1.
397 */
398 int timeout;
399};
400
401/*
397 * USB 3.0 Link Power Management (LPM) parameters. 402 * USB 3.0 Link Power Management (LPM) parameters.
398 * 403 *
399 * PEL and SEL are USB 3.0 Link PM latencies for device-initiated LPM exit. 404 * PEL and SEL are USB 3.0 Link PM latencies for device-initiated LPM exit.
@@ -468,6 +473,7 @@ struct usb3_lpm_parameters {
468 * @wusb: device is Wireless USB 473 * @wusb: device is Wireless USB
469 * @lpm_capable: device supports LPM 474 * @lpm_capable: device supports LPM
470 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM 475 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM
476 * @usb2_hw_lpm_besl_capable: device can perform USB2 hardware BESL LPM
471 * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled 477 * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled
472 * @usb3_lpm_enabled: USB3 hardware LPM enabled 478 * @usb3_lpm_enabled: USB3 hardware LPM enabled
473 * @string_langid: language ID for strings 479 * @string_langid: language ID for strings
@@ -487,6 +493,7 @@ struct usb3_lpm_parameters {
487 * specific data for the device. 493 * specific data for the device.
488 * @slot_id: Slot ID assigned by xHCI 494 * @slot_id: Slot ID assigned by xHCI
489 * @removable: Device can be physically removed from this port 495 * @removable: Device can be physically removed from this port
496 * @l1_params: best effor service latency for USB2 L1 LPM state, and L1 timeout.
490 * @u1_params: exit latencies for USB3 U1 LPM state, and hub-initiated timeout. 497 * @u1_params: exit latencies for USB3 U1 LPM state, and hub-initiated timeout.
491 * @u2_params: exit latencies for USB3 U2 LPM state, and hub-initiated timeout. 498 * @u2_params: exit latencies for USB3 U2 LPM state, and hub-initiated timeout.
492 * @lpm_disable_count: Ref count used by usb_disable_lpm() and usb_enable_lpm() 499 * @lpm_disable_count: Ref count used by usb_disable_lpm() and usb_enable_lpm()
@@ -538,6 +545,7 @@ struct usb_device {
538 unsigned wusb:1; 545 unsigned wusb:1;
539 unsigned lpm_capable:1; 546 unsigned lpm_capable:1;
540 unsigned usb2_hw_lpm_capable:1; 547 unsigned usb2_hw_lpm_capable:1;
548 unsigned usb2_hw_lpm_besl_capable:1;
541 unsigned usb2_hw_lpm_enabled:1; 549 unsigned usb2_hw_lpm_enabled:1;
542 unsigned usb3_lpm_enabled:1; 550 unsigned usb3_lpm_enabled:1;
543 int string_langid; 551 int string_langid;
@@ -566,6 +574,7 @@ struct usb_device {
566 struct wusb_dev *wusb_dev; 574 struct wusb_dev *wusb_dev;
567 int slot_id; 575 int slot_id;
568 enum usb_device_removable removable; 576 enum usb_device_removable removable;
577 struct usb2_lpm_parameters l1_params;
569 struct usb3_lpm_parameters u1_params; 578 struct usb3_lpm_parameters u1_params;
570 struct usb3_lpm_parameters u2_params; 579 struct usb3_lpm_parameters u2_params;
571 unsigned lpm_disable_count; 580 unsigned lpm_disable_count;
@@ -717,6 +726,7 @@ const struct usb_device_id *usb_match_id(struct usb_interface *interface,
717extern int usb_match_one_id(struct usb_interface *interface, 726extern int usb_match_one_id(struct usb_interface *interface,
718 const struct usb_device_id *id); 727 const struct usb_device_id *id);
719 728
729extern int usb_for_each_dev(void *data, int (*fn)(struct usb_device *, void *));
720extern struct usb_interface *usb_find_interface(struct usb_driver *drv, 730extern struct usb_interface *usb_find_interface(struct usb_driver *drv,
721 int minor); 731 int minor);
722extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev, 732extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev,
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 544825dde823..25629948c842 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -7,32 +7,33 @@
7 7
8#include <linux/usb/otg.h> 8#include <linux/usb/otg.h>
9 9
10struct ci13xxx; 10struct ci_hdrc;
11struct ci13xxx_platform_data { 11struct ci_hdrc_platform_data {
12 const char *name; 12 const char *name;
13 /* offset of the capability registers */ 13 /* offset of the capability registers */
14 uintptr_t capoffset; 14 uintptr_t capoffset;
15 unsigned power_budget; 15 unsigned power_budget;
16 struct usb_phy *phy; 16 struct usb_phy *phy;
17 enum usb_phy_interface phy_mode;
17 unsigned long flags; 18 unsigned long flags;
18#define CI13XXX_REGS_SHARED BIT(0) 19#define CI_HDRC_REGS_SHARED BIT(0)
19#define CI13XXX_REQUIRE_TRANSCEIVER BIT(1) 20#define CI_HDRC_REQUIRE_TRANSCEIVER BIT(1)
20#define CI13XXX_PULLUP_ON_VBUS BIT(2) 21#define CI_HDRC_PULLUP_ON_VBUS BIT(2)
21#define CI13XXX_DISABLE_STREAMING BIT(3) 22#define CI_HDRC_DISABLE_STREAMING BIT(3)
22 23 enum usb_dr_mode dr_mode;
23#define CI13XXX_CONTROLLER_RESET_EVENT 0 24#define CI_HDRC_CONTROLLER_RESET_EVENT 0
24#define CI13XXX_CONTROLLER_STOPPED_EVENT 1 25#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
25 void (*notify_event) (struct ci13xxx *ci, unsigned event); 26 void (*notify_event) (struct ci_hdrc *ci, unsigned event);
26}; 27};
27 28
28/* Default offset of capability registers */ 29/* Default offset of capability registers */
29#define DEF_CAPOFFSET 0x100 30#define DEF_CAPOFFSET 0x100
30 31
31/* Add ci13xxx device */ 32/* Add ci hdrc device */
32struct platform_device *ci13xxx_add_device(struct device *dev, 33struct platform_device *ci_hdrc_add_device(struct device *dev,
33 struct resource *res, int nres, 34 struct resource *res, int nres,
34 struct ci13xxx_platform_data *platdata); 35 struct ci_hdrc_platform_data *platdata);
35/* Remove ci13xxx device */ 36/* Remove ci hdrc device */
36void ci13xxx_remove_device(struct platform_device *pdev); 37void ci_hdrc_remove_device(struct platform_device *pdev);
37 38
38#endif 39#endif
diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h
index 99238b096f7e..7eb4dcd0d386 100644
--- a/include/linux/usb/ehci_pdriver.h
+++ b/include/linux/usb/ehci_pdriver.h
@@ -19,6 +19,9 @@
19#ifndef __USB_CORE_EHCI_PDRIVER_H 19#ifndef __USB_CORE_EHCI_PDRIVER_H
20#define __USB_CORE_EHCI_PDRIVER_H 20#define __USB_CORE_EHCI_PDRIVER_H
21 21
22struct platform_device;
23struct usb_hcd;
24
22/** 25/**
23 * struct usb_ehci_pdata - platform_data for generic ehci driver 26 * struct usb_ehci_pdata - platform_data for generic ehci driver
24 * 27 *
@@ -50,6 +53,7 @@ struct usb_ehci_pdata {
50 /* Turn on only VBUS suspend power and hotplug detection, 53 /* Turn on only VBUS suspend power and hotplug detection,
51 * turn off everything else */ 54 * turn off everything else */
52 void (*power_suspend)(struct platform_device *pdev); 55 void (*power_suspend)(struct platform_device *pdev);
56 int (*pre_setup)(struct usb_hcd *hcd);
53}; 57};
54 58
55#endif /* __USB_CORE_EHCI_PDRIVER_H */ 59#endif /* __USB_CORE_EHCI_PDRIVER_H */
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index f5f5c7dfda90..1e88377e22f4 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -218,6 +218,7 @@ struct hc_driver {
218#define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */ 218#define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */
219#define HCD_USB11 0x0010 /* USB 1.1 */ 219#define HCD_USB11 0x0010 /* USB 1.1 */
220#define HCD_USB2 0x0020 /* USB 2.0 */ 220#define HCD_USB2 0x0020 /* USB 2.0 */
221#define HCD_USB25 0x0030 /* Wireless USB 1.0 (USB 2.5)*/
221#define HCD_USB3 0x0040 /* USB 3.0 */ 222#define HCD_USB3 0x0040 /* USB 3.0 */
222#define HCD_MASK 0x0070 223#define HCD_MASK 0x0070
223 224
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
new file mode 100644
index 000000000000..a0ef405368b8
--- /dev/null
+++ b/include/linux/usb/of.h
@@ -0,0 +1,32 @@
1/*
2 * OF helpers for usb devices.
3 *
4 * This file is released under the GPLv2
5 */
6
7#ifndef __LINUX_USB_OF_H
8#define __LINUX_USB_OF_H
9
10#include <linux/usb/otg.h>
11#include <linux/usb/phy.h>
12
13#if IS_ENABLED(CONFIG_OF)
14enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np);
15#else
16static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
17{
18 return USB_DR_MODE_UNKNOWN;
19}
20#endif
21
22#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_PHY)
23enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np);
24#else
25static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
26{
27 return USBPHY_INTERFACE_MODE_UNKNOWN;
28}
29
30#endif
31
32#endif /* __LINUX_USB_OF_H */
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 291e01ba32e5..154332b7c8c0 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -92,4 +92,11 @@ otg_start_srp(struct usb_otg *otg)
92/* for OTG controller drivers (and maybe other stuff) */ 92/* for OTG controller drivers (and maybe other stuff) */
93extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); 93extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
94 94
95enum usb_dr_mode {
96 USB_DR_MODE_UNKNOWN,
97 USB_DR_MODE_HOST,
98 USB_DR_MODE_PERIPHERAL,
99 USB_DR_MODE_OTG,
100};
101
95#endif /* __LINUX_USB_OTG_H */ 102#endif /* __LINUX_USB_OTG_H */
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 6b5978f57633..44036808bf0f 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -12,6 +12,15 @@
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13#include <linux/usb.h> 13#include <linux/usb.h>
14 14
15enum usb_phy_interface {
16 USBPHY_INTERFACE_MODE_UNKNOWN,
17 USBPHY_INTERFACE_MODE_UTMI,
18 USBPHY_INTERFACE_MODE_UTMIW,
19 USBPHY_INTERFACE_MODE_ULPI,
20 USBPHY_INTERFACE_MODE_SERIAL,
21 USBPHY_INTERFACE_MODE_HSIC,
22};
23
15enum usb_phy_events { 24enum usb_phy_events {
16 USB_EVENT_NONE, /* no events or cable disconnected */ 25 USB_EVENT_NONE, /* no events or cable disconnected */
17 USB_EVENT_VBUS, /* vbus valid event */ 26 USB_EVENT_VBUS, /* vbus valid event */
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 302ddf55d2da..d528b8045150 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -19,10 +19,6 @@
19#include <linux/sysrq.h> 19#include <linux/sysrq.h>
20#include <linux/kfifo.h> 20#include <linux/kfifo.h>
21 21
22#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
23#define SERIAL_TTY_MINORS 254 /* loads of devices :) */
24#define SERIAL_TTY_NO_MINOR 255 /* No minor was assigned */
25
26/* The maximum number of ports one device can grab at once */ 22/* The maximum number of ports one device can grab at once */
27#define MAX_NUM_PORTS 8 23#define MAX_NUM_PORTS 8
28 24
@@ -37,7 +33,8 @@
37 * @serial: pointer back to the struct usb_serial owner of this port. 33 * @serial: pointer back to the struct usb_serial owner of this port.
38 * @port: pointer to the corresponding tty_port for this port. 34 * @port: pointer to the corresponding tty_port for this port.
39 * @lock: spinlock to grab when updating portions of this structure. 35 * @lock: spinlock to grab when updating portions of this structure.
40 * @number: the number of the port (the minor number). 36 * @minor: the minor number of the port
37 * @port_number: the struct usb_serial port number of this port (starts at 0)
41 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. 38 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
42 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. 39 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
43 * @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe 40 * @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe
@@ -80,7 +77,8 @@ struct usb_serial_port {
80 struct usb_serial *serial; 77 struct usb_serial *serial;
81 struct tty_port port; 78 struct tty_port port;
82 spinlock_t lock; 79 spinlock_t lock;
83 unsigned char number; 80 u32 minor;
81 u8 port_number;
84 82
85 unsigned char *interrupt_in_buffer; 83 unsigned char *interrupt_in_buffer;
86 struct urb *interrupt_in_urb; 84 struct urb *interrupt_in_urb;
@@ -140,7 +138,6 @@ static inline void usb_set_serial_port_data(struct usb_serial_port *port,
140 * @dev: pointer to the struct usb_device for this device 138 * @dev: pointer to the struct usb_device for this device
141 * @type: pointer to the struct usb_serial_driver for this device 139 * @type: pointer to the struct usb_serial_driver for this device
142 * @interface: pointer to the struct usb_interface for this device 140 * @interface: pointer to the struct usb_interface for this device
143 * @minor: the starting minor number for this device
144 * @num_ports: the number of ports this device has 141 * @num_ports: the number of ports this device has
145 * @num_interrupt_in: number of interrupt in endpoints we have 142 * @num_interrupt_in: number of interrupt in endpoints we have
146 * @num_interrupt_out: number of interrupt out endpoints we have 143 * @num_interrupt_out: number of interrupt out endpoints we have
@@ -159,7 +156,7 @@ struct usb_serial {
159 unsigned char disconnected:1; 156 unsigned char disconnected:1;
160 unsigned char suspending:1; 157 unsigned char suspending:1;
161 unsigned char attached:1; 158 unsigned char attached:1;
162 unsigned char minor; 159 unsigned char minors_reserved:1;
163 unsigned char num_ports; 160 unsigned char num_ports;
164 unsigned char num_port_pointers; 161 unsigned char num_port_pointers;
165 char num_interrupt_in; 162 char num_interrupt_in;
@@ -319,7 +316,7 @@ static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
319#endif 316#endif
320 317
321/* Functions needed by other parts of the usbserial core */ 318/* Functions needed by other parts of the usbserial core */
322extern struct usb_serial *usb_serial_get_by_index(unsigned int minor); 319extern struct usb_serial_port *usb_serial_port_get_by_minor(unsigned int minor);
323extern void usb_serial_put(struct usb_serial *serial); 320extern void usb_serial_put(struct usb_serial *serial);
324extern int usb_serial_generic_open(struct tty_struct *tty, 321extern int usb_serial_generic_open(struct tty_struct *tty,
325 struct usb_serial_port *port); 322 struct usb_serial_port *port);
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
index 1b7519a8c0bf..d2ca919a5b73 100644
--- a/include/linux/usb/tegra_usb_phy.h
+++ b/include/linux/usb/tegra_usb_phy.h
@@ -42,6 +42,7 @@ enum tegra_usb_phy_port_speed {
42enum tegra_usb_phy_mode { 42enum tegra_usb_phy_mode {
43 TEGRA_USB_PHY_MODE_DEVICE, 43 TEGRA_USB_PHY_MODE_DEVICE,
44 TEGRA_USB_PHY_MODE_HOST, 44 TEGRA_USB_PHY_MODE_HOST,
45 TEGRA_USB_PHY_MODE_OTG,
45}; 46};
46 47
47struct tegra_xtal_freq; 48struct tegra_xtal_freq;
@@ -61,14 +62,10 @@ struct tegra_usb_phy {
61 struct device *dev; 62 struct device *dev;
62 bool is_legacy_phy; 63 bool is_legacy_phy;
63 bool is_ulpi_phy; 64 bool is_ulpi_phy;
64 void (*set_pts)(struct usb_phy *x, u8 pts_val); 65 int reset_gpio;
65 void (*set_phcd)(struct usb_phy *x, bool enable);
66}; 66};
67 67
68struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, 68struct usb_phy *tegra_usb_get_phy(struct device_node *dn);
69 void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode,
70 void (*set_pts)(struct usb_phy *x, u8 pts_val),
71 void (*set_phcd)(struct usb_phy *x, bool enable));
72 69
73void tegra_usb_phy_preresume(struct usb_phy *phy); 70void tegra_usb_phy_preresume(struct usb_phy *phy);
74 71
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h
index f9dec37f617b..6be985b2a434 100644
--- a/include/linux/usb/wusb-wa.h
+++ b/include/linux/usb/wusb-wa.h
@@ -92,11 +92,20 @@ struct usb_rpipe_descriptor {
92 __le16 wRPipeIndex; 92 __le16 wRPipeIndex;
93 __le16 wRequests; 93 __le16 wRequests;
94 __le16 wBlocks; /* rw if 0 */ 94 __le16 wBlocks; /* rw if 0 */
95 __le16 wMaxPacketSize; /* rw? */ 95 __le16 wMaxPacketSize; /* rw */
96 u8 bHSHubAddress; /* reserved: 0 */ 96 union {
97 u8 bHSHubPort; /* ??? FIXME ??? */ 97 u8 dwa_bHSHubAddress; /* rw: DWA. */
98 u8 hwa_bMaxBurst; /* rw: HWA. */
99 };
100 union {
101 u8 dwa_bHSHubPort; /* rw: DWA. */
102 u8 hwa_bDeviceInfoIndex; /* rw: HWA. */
103 };
98 u8 bSpeed; /* rw: xfer rate 'enum uwb_phy_rate' */ 104 u8 bSpeed; /* rw: xfer rate 'enum uwb_phy_rate' */
99 u8 bDeviceAddress; /* rw: Target device address */ 105 union {
106 u8 dwa_bDeviceAddress; /* rw: DWA Target device address. */
107 u8 hwa_reserved; /* rw: HWA. */
108 };
100 u8 bEndpointAddress; /* rw: Target EP address */ 109 u8 bEndpointAddress; /* rw: Target EP address */
101 u8 bDataSequence; /* ro: Current Data sequence */ 110 u8 bDataSequence; /* ro: Current Data sequence */
102 __le32 dwCurrentWindow; /* ro */ 111 __le32 dwCurrentWindow; /* ro */
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index b6b215f13b45..14105c26a836 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -23,6 +23,7 @@ struct user_namespace {
23 struct uid_gid_map projid_map; 23 struct uid_gid_map projid_map;
24 atomic_t count; 24 atomic_t count;
25 struct user_namespace *parent; 25 struct user_namespace *parent;
26 int level;
26 kuid_t owner; 27 kuid_t owner;
27 kgid_t group; 28 kgid_t group;
28 unsigned int proc_inum; 29 unsigned int proc_inum;
diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h
index ea7168a68081..617c01b8f74a 100644
--- a/include/linux/vexpress.h
+++ b/include/linux/vexpress.h
@@ -15,6 +15,7 @@
15#define _LINUX_VEXPRESS_H 15#define _LINUX_VEXPRESS_H
16 16
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/reboot.h>
18 19
19#define VEXPRESS_SITE_MB 0 20#define VEXPRESS_SITE_MB 0
20#define VEXPRESS_SITE_DB1 1 21#define VEXPRESS_SITE_DB1 1
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 9ff8645b7e0b..36d36cc89329 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -34,13 +34,6 @@ struct virtqueue {
34 void *priv; 34 void *priv;
35}; 35};
36 36
37int virtqueue_add_buf(struct virtqueue *vq,
38 struct scatterlist sg[],
39 unsigned int out_num,
40 unsigned int in_num,
41 void *data,
42 gfp_t gfp);
43
44int virtqueue_add_outbuf(struct virtqueue *vq, 37int virtqueue_add_outbuf(struct virtqueue *vq,
45 struct scatterlist sg[], unsigned int num, 38 struct scatterlist sg[], unsigned int num,
46 void *data, 39 void *data,
@@ -70,6 +63,10 @@ void virtqueue_disable_cb(struct virtqueue *vq);
70 63
71bool virtqueue_enable_cb(struct virtqueue *vq); 64bool virtqueue_enable_cb(struct virtqueue *vq);
72 65
66unsigned virtqueue_enable_cb_prepare(struct virtqueue *vq);
67
68bool virtqueue_poll(struct virtqueue *vq, unsigned);
69
73bool virtqueue_enable_cb_delayed(struct virtqueue *vq); 70bool virtqueue_enable_cb_delayed(struct virtqueue *vq);
74 71
75void *virtqueue_detach_unused_buf(struct virtqueue *vq); 72void *virtqueue_detach_unused_buf(struct virtqueue *vq);
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index ca3ad41c2c82..b300787af8e0 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_VIRTIO_RING_H 1#ifndef _LINUX_VIRTIO_RING_H
2#define _LINUX_VIRTIO_RING_H 2#define _LINUX_VIRTIO_RING_H
3 3
4#include <asm/barrier.h>
4#include <linux/irqreturn.h> 5#include <linux/irqreturn.h>
5#include <uapi/linux/virtio_ring.h> 6#include <uapi/linux/virtio_ring.h>
6 7
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 7d5773a99f20..4b8a89189a29 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -10,12 +10,12 @@
10struct vm_area_struct; /* vma defining user mapping in mm_types.h */ 10struct vm_area_struct; /* vma defining user mapping in mm_types.h */
11 11
12/* bits in flags of vmalloc's vm_struct below */ 12/* bits in flags of vmalloc's vm_struct below */
13#define VM_IOREMAP 0x00000001 /* ioremap() and friends */ 13#define VM_IOREMAP 0x00000001 /* ioremap() and friends */
14#define VM_ALLOC 0x00000002 /* vmalloc() */ 14#define VM_ALLOC 0x00000002 /* vmalloc() */
15#define VM_MAP 0x00000004 /* vmap()ed pages */ 15#define VM_MAP 0x00000004 /* vmap()ed pages */
16#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */ 16#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */
17#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */ 17#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */
18#define VM_UNLIST 0x00000020 /* vm_struct is not listed in vmlist */ 18#define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */
19/* bits [20..32] reserved for arch specific ioremap internals */ 19/* bits [20..32] reserved for arch specific ioremap internals */
20 20
21/* 21/*
@@ -82,6 +82,10 @@ extern void *vmap(struct page **pages, unsigned int count,
82 unsigned long flags, pgprot_t prot); 82 unsigned long flags, pgprot_t prot);
83extern void vunmap(const void *addr); 83extern void vunmap(const void *addr);
84 84
85extern int remap_vmalloc_range_partial(struct vm_area_struct *vma,
86 unsigned long uaddr, void *kaddr,
87 unsigned long size);
88
85extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, 89extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
86 unsigned long pgoff); 90 unsigned long pgoff);
87void vmalloc_sync_all(void); 91void vmalloc_sync_all(void);
diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h
index 76be077340ea..7dc17e2456de 100644
--- a/include/linux/vmpressure.h
+++ b/include/linux/vmpressure.h
@@ -12,7 +12,7 @@ struct vmpressure {
12 unsigned long scanned; 12 unsigned long scanned;
13 unsigned long reclaimed; 13 unsigned long reclaimed;
14 /* The lock is used to keep the scanned/reclaimed above in sync. */ 14 /* The lock is used to keep the scanned/reclaimed above in sync. */
15 struct mutex sr_lock; 15 struct spinlock sr_lock;
16 16
17 /* The list of vmpressure_event structs. */ 17 /* The list of vmpressure_event structs. */
18 struct list_head events; 18 struct list_head events;
@@ -30,6 +30,7 @@ extern void vmpressure(gfp_t gfp, struct mem_cgroup *memcg,
30extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio); 30extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio);
31 31
32extern void vmpressure_init(struct vmpressure *vmpr); 32extern void vmpressure_init(struct vmpressure *vmpr);
33extern void vmpressure_cleanup(struct vmpressure *vmpr);
33extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg); 34extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg);
34extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr); 35extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr);
35extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css); 36extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css);
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 0d33fca48774..8d7634247fb4 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -133,8 +133,6 @@ void change_console(struct vc_data *new_vc);
133void reset_vc(struct vc_data *vc); 133void reset_vc(struct vc_data *vc);
134extern int do_unbind_con_driver(const struct consw *csw, int first, int last, 134extern int do_unbind_con_driver(const struct consw *csw, int first, int last,
135 int deflt); 135 int deflt);
136extern int unbind_con_driver(const struct consw *csw, int first, int last,
137 int deflt);
138int vty_init(const struct file_operations *console_fops); 136int vty_init(const struct file_operations *console_fops);
139 137
140static inline bool vt_force_oops_output(struct vc_data *vc) 138static inline bool vt_force_oops_output(struct vc_data *vc)
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 1133695eb067..f487a4750b7f 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -23,6 +23,7 @@ struct __wait_queue {
23struct wait_bit_key { 23struct wait_bit_key {
24 void *flags; 24 void *flags;
25 int bit_nr; 25 int bit_nr;
26#define WAIT_ATOMIC_T_BIT_NR -1
26}; 27};
27 28
28struct wait_bit_queue { 29struct wait_bit_queue {
@@ -60,6 +61,9 @@ struct task_struct;
60#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ 61#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \
61 { .flags = word, .bit_nr = bit, } 62 { .flags = word, .bit_nr = bit, }
62 63
64#define __WAIT_ATOMIC_T_KEY_INITIALIZER(p) \
65 { .flags = p, .bit_nr = WAIT_ATOMIC_T_BIT_NR, }
66
63extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *); 67extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *);
64 68
65#define init_waitqueue_head(q) \ 69#define init_waitqueue_head(q) \
@@ -146,8 +150,10 @@ void __wake_up_bit(wait_queue_head_t *, void *, int);
146int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 150int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
147int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 151int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
148void wake_up_bit(void *, int); 152void wake_up_bit(void *, int);
153void wake_up_atomic_t(atomic_t *);
149int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned); 154int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned);
150int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned); 155int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned);
156int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned);
151wait_queue_head_t *bit_waitqueue(void *, int); 157wait_queue_head_t *bit_waitqueue(void *, int);
152 158
153#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) 159#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL)
@@ -902,5 +908,23 @@ static inline int wait_on_bit_lock(void *word, int bit,
902 return 0; 908 return 0;
903 return out_of_line_wait_on_bit_lock(word, bit, action, mode); 909 return out_of_line_wait_on_bit_lock(word, bit, action, mode);
904} 910}
911
912/**
913 * wait_on_atomic_t - Wait for an atomic_t to become 0
914 * @val: The atomic value being waited on, a kernel virtual address
915 * @action: the function used to sleep, which may take special actions
916 * @mode: the task state to sleep in
917 *
918 * Wait for an atomic_t to become 0. We abuse the bit-wait waitqueue table for
919 * the purpose of getting a waitqueue, but we set the key to a bit number
920 * outside of the target 'word'.
921 */
922static inline
923int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode)
924{
925 if (atomic_read(val) == 0)
926 return 0;
927 return out_of_line_wait_on_atomic_t(val, action, mode);
928}
905 929
906#endif 930#endif
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 623488fdc1f5..a0ed78ab54d7 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -303,6 +303,33 @@ enum {
303 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ 303 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */
304 WQ_SYSFS = 1 << 6, /* visible in sysfs, see wq_sysfs_register() */ 304 WQ_SYSFS = 1 << 6, /* visible in sysfs, see wq_sysfs_register() */
305 305
306 /*
307 * Per-cpu workqueues are generally preferred because they tend to
308 * show better performance thanks to cache locality. Per-cpu
309 * workqueues exclude the scheduler from choosing the CPU to
310 * execute the worker threads, which has an unfortunate side effect
311 * of increasing power consumption.
312 *
313 * The scheduler considers a CPU idle if it doesn't have any task
314 * to execute and tries to keep idle cores idle to conserve power;
315 * however, for example, a per-cpu work item scheduled from an
316 * interrupt handler on an idle CPU will force the scheduler to
317 * excute the work item on that CPU breaking the idleness, which in
318 * turn may lead to more scheduling choices which are sub-optimal
319 * in terms of power consumption.
320 *
321 * Workqueues marked with WQ_POWER_EFFICIENT are per-cpu by default
322 * but become unbound if workqueue.power_efficient kernel param is
323 * specified. Per-cpu workqueues which are identified to
324 * contribute significantly to power-consumption are identified and
325 * marked with this flag and enabling the power_efficient mode
326 * leads to noticeable power saving at the cost of small
327 * performance disadvantage.
328 *
329 * http://thread.gmane.org/gmane.linux.kernel/1480396
330 */
331 WQ_POWER_EFFICIENT = 1 << 7,
332
306 __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */ 333 __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */
307 __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */ 334 __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */
308 335
@@ -333,11 +360,19 @@ enum {
333 * 360 *
334 * system_freezable_wq is equivalent to system_wq except that it's 361 * system_freezable_wq is equivalent to system_wq except that it's
335 * freezable. 362 * freezable.
363 *
364 * *_power_efficient_wq are inclined towards saving power and converted
365 * into WQ_UNBOUND variants if 'wq_power_efficient' is enabled; otherwise,
366 * they are same as their non-power-efficient counterparts - e.g.
367 * system_power_efficient_wq is identical to system_wq if
368 * 'wq_power_efficient' is disabled. See WQ_POWER_EFFICIENT for more info.
336 */ 369 */
337extern struct workqueue_struct *system_wq; 370extern struct workqueue_struct *system_wq;
338extern struct workqueue_struct *system_long_wq; 371extern struct workqueue_struct *system_long_wq;
339extern struct workqueue_struct *system_unbound_wq; 372extern struct workqueue_struct *system_unbound_wq;
340extern struct workqueue_struct *system_freezable_wq; 373extern struct workqueue_struct *system_freezable_wq;
374extern struct workqueue_struct *system_power_efficient_wq;
375extern struct workqueue_struct *system_freezable_power_efficient_wq;
341 376
342static inline struct workqueue_struct * __deprecated __system_nrt_wq(void) 377static inline struct workqueue_struct * __deprecated __system_nrt_wq(void)
343{ 378{
@@ -410,11 +445,12 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
410 alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args) 445 alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args)
411 446
412#define create_workqueue(name) \ 447#define create_workqueue(name) \
413 alloc_workqueue((name), WQ_MEM_RECLAIM, 1) 448 alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, (name))
414#define create_freezable_workqueue(name) \ 449#define create_freezable_workqueue(name) \
415 alloc_workqueue((name), WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1) 450 alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \
451 1, (name))
416#define create_singlethread_workqueue(name) \ 452#define create_singlethread_workqueue(name) \
417 alloc_workqueue((name), WQ_UNBOUND | WQ_MEM_RECLAIM, 1) 453 alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM, 1, (name))
418 454
419extern void destroy_workqueue(struct workqueue_struct *wq); 455extern void destroy_workqueue(struct workqueue_struct *wq);
420 456
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 579a5007c696..4e198ca1f685 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -47,11 +47,16 @@ enum wb_reason {
47 WB_REASON_LAPTOP_TIMER, 47 WB_REASON_LAPTOP_TIMER,
48 WB_REASON_FREE_MORE_MEM, 48 WB_REASON_FREE_MORE_MEM,
49 WB_REASON_FS_FREE_SPACE, 49 WB_REASON_FS_FREE_SPACE,
50 /*
51 * There is no bdi forker thread any more and works are done
52 * by emergency worker, however, this is TPs userland visible
53 * and we'll be exposing exactly the same information,
54 * so it has a mismatch name.
55 */
50 WB_REASON_FORKER_THREAD, 56 WB_REASON_FORKER_THREAD,
51 57
52 WB_REASON_MAX, 58 WB_REASON_MAX,
53}; 59};
54extern const char *wb_reason_name[];
55 60
56/* 61/*
57 * A control structure which tells the writeback code what to do. These are 62 * A control structure which tells the writeback code what to do. These are
@@ -78,6 +83,7 @@ struct writeback_control {
78 unsigned tagged_writepages:1; /* tag-and-write to avoid livelock */ 83 unsigned tagged_writepages:1; /* tag-and-write to avoid livelock */
79 unsigned for_reclaim:1; /* Invoked from the page allocator */ 84 unsigned for_reclaim:1; /* Invoked from the page allocator */
80 unsigned range_cyclic:1; /* range_start is cyclic */ 85 unsigned range_cyclic:1; /* range_start is cyclic */
86 unsigned for_sync:1; /* sync(2) WB_SYNC_ALL writeback */
81}; 87};
82 88
83/* 89/*
@@ -94,7 +100,6 @@ int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
94void sync_inodes_sb(struct super_block *); 100void sync_inodes_sb(struct super_block *);
95long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages, 101long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
96 enum wb_reason reason); 102 enum wb_reason reason);
97long wb_do_writeback(struct bdi_writeback *wb, int force_wait);
98void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); 103void wakeup_flusher_threads(long nr_pages, enum wb_reason reason);
99void inode_wait_for_writeback(struct inode *inode); 104void inode_wait_for_writeback(struct inode *inode);
100 105
diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
new file mode 100644
index 000000000000..760399a470bd
--- /dev/null
+++ b/include/linux/ww_mutex.h
@@ -0,0 +1,378 @@
1/*
2 * Wound/Wait Mutexes: blocking mutual exclusion locks with deadlock avoidance
3 *
4 * Original mutex implementation started by Ingo Molnar:
5 *
6 * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
7 *
8 * Wound/wait implementation:
9 * Copyright (C) 2013 Canonical Ltd.
10 *
11 * This file contains the main data structure and API definitions.
12 */
13
14#ifndef __LINUX_WW_MUTEX_H
15#define __LINUX_WW_MUTEX_H
16
17#include <linux/mutex.h>
18
19struct ww_class {
20 atomic_long_t stamp;
21 struct lock_class_key acquire_key;
22 struct lock_class_key mutex_key;
23 const char *acquire_name;
24 const char *mutex_name;
25};
26
27struct ww_acquire_ctx {
28 struct task_struct *task;
29 unsigned long stamp;
30 unsigned acquired;
31#ifdef CONFIG_DEBUG_MUTEXES
32 unsigned done_acquire;
33 struct ww_class *ww_class;
34 struct ww_mutex *contending_lock;
35#endif
36#ifdef CONFIG_DEBUG_LOCK_ALLOC
37 struct lockdep_map dep_map;
38#endif
39#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH
40 unsigned deadlock_inject_interval;
41 unsigned deadlock_inject_countdown;
42#endif
43};
44
45struct ww_mutex {
46 struct mutex base;
47 struct ww_acquire_ctx *ctx;
48#ifdef CONFIG_DEBUG_MUTEXES
49 struct ww_class *ww_class;
50#endif
51};
52
53#ifdef CONFIG_DEBUG_LOCK_ALLOC
54# define __WW_CLASS_MUTEX_INITIALIZER(lockname, ww_class) \
55 , .ww_class = &ww_class
56#else
57# define __WW_CLASS_MUTEX_INITIALIZER(lockname, ww_class)
58#endif
59
60#define __WW_CLASS_INITIALIZER(ww_class) \
61 { .stamp = ATOMIC_LONG_INIT(0) \
62 , .acquire_name = #ww_class "_acquire" \
63 , .mutex_name = #ww_class "_mutex" }
64
65#define __WW_MUTEX_INITIALIZER(lockname, class) \
66 { .base = { \__MUTEX_INITIALIZER(lockname) } \
67 __WW_CLASS_MUTEX_INITIALIZER(lockname, class) }
68
69#define DEFINE_WW_CLASS(classname) \
70 struct ww_class classname = __WW_CLASS_INITIALIZER(classname)
71
72#define DEFINE_WW_MUTEX(mutexname, ww_class) \
73 struct ww_mutex mutexname = __WW_MUTEX_INITIALIZER(mutexname, ww_class)
74
75/**
76 * ww_mutex_init - initialize the w/w mutex
77 * @lock: the mutex to be initialized
78 * @ww_class: the w/w class the mutex should belong to
79 *
80 * Initialize the w/w mutex to unlocked state and associate it with the given
81 * class.
82 *
83 * It is not allowed to initialize an already locked mutex.
84 */
85static inline void ww_mutex_init(struct ww_mutex *lock,
86 struct ww_class *ww_class)
87{
88 __mutex_init(&lock->base, ww_class->mutex_name, &ww_class->mutex_key);
89 lock->ctx = NULL;
90#ifdef CONFIG_DEBUG_MUTEXES
91 lock->ww_class = ww_class;
92#endif
93}
94
95/**
96 * ww_acquire_init - initialize a w/w acquire context
97 * @ctx: w/w acquire context to initialize
98 * @ww_class: w/w class of the context
99 *
100 * Initializes an context to acquire multiple mutexes of the given w/w class.
101 *
102 * Context-based w/w mutex acquiring can be done in any order whatsoever within
103 * a given lock class. Deadlocks will be detected and handled with the
104 * wait/wound logic.
105 *
106 * Mixing of context-based w/w mutex acquiring and single w/w mutex locking can
107 * result in undetected deadlocks and is so forbidden. Mixing different contexts
108 * for the same w/w class when acquiring mutexes can also result in undetected
109 * deadlocks, and is hence also forbidden. Both types of abuse will be caught by
110 * enabling CONFIG_PROVE_LOCKING.
111 *
112 * Nesting of acquire contexts for _different_ w/w classes is possible, subject
113 * to the usual locking rules between different lock classes.
114 *
115 * An acquire context must be released with ww_acquire_fini by the same task
116 * before the memory is freed. It is recommended to allocate the context itself
117 * on the stack.
118 */
119static inline void ww_acquire_init(struct ww_acquire_ctx *ctx,
120 struct ww_class *ww_class)
121{
122 ctx->task = current;
123 ctx->stamp = atomic_long_inc_return(&ww_class->stamp);
124 ctx->acquired = 0;
125#ifdef CONFIG_DEBUG_MUTEXES
126 ctx->ww_class = ww_class;
127 ctx->done_acquire = 0;
128 ctx->contending_lock = NULL;
129#endif
130#ifdef CONFIG_DEBUG_LOCK_ALLOC
131 debug_check_no_locks_freed((void *)ctx, sizeof(*ctx));
132 lockdep_init_map(&ctx->dep_map, ww_class->acquire_name,
133 &ww_class->acquire_key, 0);
134 mutex_acquire(&ctx->dep_map, 0, 0, _RET_IP_);
135#endif
136#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH
137 ctx->deadlock_inject_interval = 1;
138 ctx->deadlock_inject_countdown = ctx->stamp & 0xf;
139#endif
140}
141
142/**
143 * ww_acquire_done - marks the end of the acquire phase
144 * @ctx: the acquire context
145 *
146 * Marks the end of the acquire phase, any further w/w mutex lock calls using
147 * this context are forbidden.
148 *
149 * Calling this function is optional, it is just useful to document w/w mutex
150 * code and clearly designated the acquire phase from actually using the locked
151 * data structures.
152 */
153static inline void ww_acquire_done(struct ww_acquire_ctx *ctx)
154{
155#ifdef CONFIG_DEBUG_MUTEXES
156 lockdep_assert_held(ctx);
157
158 DEBUG_LOCKS_WARN_ON(ctx->done_acquire);
159 ctx->done_acquire = 1;
160#endif
161}
162
163/**
164 * ww_acquire_fini - releases a w/w acquire context
165 * @ctx: the acquire context to free
166 *
167 * Releases a w/w acquire context. This must be called _after_ all acquired w/w
168 * mutexes have been released with ww_mutex_unlock.
169 */
170static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx)
171{
172#ifdef CONFIG_DEBUG_MUTEXES
173 mutex_release(&ctx->dep_map, 0, _THIS_IP_);
174
175 DEBUG_LOCKS_WARN_ON(ctx->acquired);
176 if (!config_enabled(CONFIG_PROVE_LOCKING))
177 /*
178 * lockdep will normally handle this,
179 * but fail without anyway
180 */
181 ctx->done_acquire = 1;
182
183 if (!config_enabled(CONFIG_DEBUG_LOCK_ALLOC))
184 /* ensure ww_acquire_fini will still fail if called twice */
185 ctx->acquired = ~0U;
186#endif
187}
188
189extern int __must_check __ww_mutex_lock(struct ww_mutex *lock,
190 struct ww_acquire_ctx *ctx);
191extern int __must_check __ww_mutex_lock_interruptible(struct ww_mutex *lock,
192 struct ww_acquire_ctx *ctx);
193
194/**
195 * ww_mutex_lock - acquire the w/w mutex
196 * @lock: the mutex to be acquired
197 * @ctx: w/w acquire context, or NULL to acquire only a single lock.
198 *
199 * Lock the w/w mutex exclusively for this task.
200 *
201 * Deadlocks within a given w/w class of locks are detected and handled with the
202 * wait/wound algorithm. If the lock isn't immediately avaiable this function
203 * will either sleep until it is (wait case). Or it selects the current context
204 * for backing off by returning -EDEADLK (wound case). Trying to acquire the
205 * same lock with the same context twice is also detected and signalled by
206 * returning -EALREADY. Returns 0 if the mutex was successfully acquired.
207 *
208 * In the wound case the caller must release all currently held w/w mutexes for
209 * the given context and then wait for this contending lock to be available by
210 * calling ww_mutex_lock_slow. Alternatively callers can opt to not acquire this
211 * lock and proceed with trying to acquire further w/w mutexes (e.g. when
212 * scanning through lru lists trying to free resources).
213 *
214 * The mutex must later on be released by the same task that
215 * acquired it. The task may not exit without first unlocking the mutex. Also,
216 * kernel memory where the mutex resides must not be freed with the mutex still
217 * locked. The mutex must first be initialized (or statically defined) before it
218 * can be locked. memset()-ing the mutex to 0 is not allowed. The mutex must be
219 * of the same w/w lock class as was used to initialize the acquire context.
220 *
221 * A mutex acquired with this function must be released with ww_mutex_unlock.
222 */
223static inline int ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
224{
225 if (ctx)
226 return __ww_mutex_lock(lock, ctx);
227
228 mutex_lock(&lock->base);
229 return 0;
230}
231
232/**
233 * ww_mutex_lock_interruptible - acquire the w/w mutex, interruptible
234 * @lock: the mutex to be acquired
235 * @ctx: w/w acquire context
236 *
237 * Lock the w/w mutex exclusively for this task.
238 *
239 * Deadlocks within a given w/w class of locks are detected and handled with the
240 * wait/wound algorithm. If the lock isn't immediately avaiable this function
241 * will either sleep until it is (wait case). Or it selects the current context
242 * for backing off by returning -EDEADLK (wound case). Trying to acquire the
243 * same lock with the same context twice is also detected and signalled by
244 * returning -EALREADY. Returns 0 if the mutex was successfully acquired. If a
245 * signal arrives while waiting for the lock then this function returns -EINTR.
246 *
247 * In the wound case the caller must release all currently held w/w mutexes for
248 * the given context and then wait for this contending lock to be available by
249 * calling ww_mutex_lock_slow_interruptible. Alternatively callers can opt to
250 * not acquire this lock and proceed with trying to acquire further w/w mutexes
251 * (e.g. when scanning through lru lists trying to free resources).
252 *
253 * The mutex must later on be released by the same task that
254 * acquired it. The task may not exit without first unlocking the mutex. Also,
255 * kernel memory where the mutex resides must not be freed with the mutex still
256 * locked. The mutex must first be initialized (or statically defined) before it
257 * can be locked. memset()-ing the mutex to 0 is not allowed. The mutex must be
258 * of the same w/w lock class as was used to initialize the acquire context.
259 *
260 * A mutex acquired with this function must be released with ww_mutex_unlock.
261 */
262static inline int __must_check ww_mutex_lock_interruptible(struct ww_mutex *lock,
263 struct ww_acquire_ctx *ctx)
264{
265 if (ctx)
266 return __ww_mutex_lock_interruptible(lock, ctx);
267 else
268 return mutex_lock_interruptible(&lock->base);
269}
270
271/**
272 * ww_mutex_lock_slow - slowpath acquiring of the w/w mutex
273 * @lock: the mutex to be acquired
274 * @ctx: w/w acquire context
275 *
276 * Acquires a w/w mutex with the given context after a wound case. This function
277 * will sleep until the lock becomes available.
278 *
279 * The caller must have released all w/w mutexes already acquired with the
280 * context and then call this function on the contended lock.
281 *
282 * Afterwards the caller may continue to (re)acquire the other w/w mutexes it
283 * needs with ww_mutex_lock. Note that the -EALREADY return code from
284 * ww_mutex_lock can be used to avoid locking this contended mutex twice.
285 *
286 * It is forbidden to call this function with any other w/w mutexes associated
287 * with the context held. It is forbidden to call this on anything else than the
288 * contending mutex.
289 *
290 * Note that the slowpath lock acquiring can also be done by calling
291 * ww_mutex_lock directly. This function here is simply to help w/w mutex
292 * locking code readability by clearly denoting the slowpath.
293 */
294static inline void
295ww_mutex_lock_slow(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
296{
297 int ret;
298#ifdef CONFIG_DEBUG_MUTEXES
299 DEBUG_LOCKS_WARN_ON(!ctx->contending_lock);
300#endif
301 ret = ww_mutex_lock(lock, ctx);
302 (void)ret;
303}
304
305/**
306 * ww_mutex_lock_slow_interruptible - slowpath acquiring of the w/w mutex, interruptible
307 * @lock: the mutex to be acquired
308 * @ctx: w/w acquire context
309 *
310 * Acquires a w/w mutex with the given context after a wound case. This function
311 * will sleep until the lock becomes available and returns 0 when the lock has
312 * been acquired. If a signal arrives while waiting for the lock then this
313 * function returns -EINTR.
314 *
315 * The caller must have released all w/w mutexes already acquired with the
316 * context and then call this function on the contended lock.
317 *
318 * Afterwards the caller may continue to (re)acquire the other w/w mutexes it
319 * needs with ww_mutex_lock. Note that the -EALREADY return code from
320 * ww_mutex_lock can be used to avoid locking this contended mutex twice.
321 *
322 * It is forbidden to call this function with any other w/w mutexes associated
323 * with the given context held. It is forbidden to call this on anything else
324 * than the contending mutex.
325 *
326 * Note that the slowpath lock acquiring can also be done by calling
327 * ww_mutex_lock_interruptible directly. This function here is simply to help
328 * w/w mutex locking code readability by clearly denoting the slowpath.
329 */
330static inline int __must_check
331ww_mutex_lock_slow_interruptible(struct ww_mutex *lock,
332 struct ww_acquire_ctx *ctx)
333{
334#ifdef CONFIG_DEBUG_MUTEXES
335 DEBUG_LOCKS_WARN_ON(!ctx->contending_lock);
336#endif
337 return ww_mutex_lock_interruptible(lock, ctx);
338}
339
340extern void ww_mutex_unlock(struct ww_mutex *lock);
341
342/**
343 * ww_mutex_trylock - tries to acquire the w/w mutex without acquire context
344 * @lock: mutex to lock
345 *
346 * Trylocks a mutex without acquire context, so no deadlock detection is
347 * possible. Returns 1 if the mutex has been acquired successfully, 0 otherwise.
348 */
349static inline int __must_check ww_mutex_trylock(struct ww_mutex *lock)
350{
351 return mutex_trylock(&lock->base);
352}
353
354/***
355 * ww_mutex_destroy - mark a w/w mutex unusable
356 * @lock: the mutex to be destroyed
357 *
358 * This function marks the mutex uninitialized, and any subsequent
359 * use of the mutex is forbidden. The mutex must not be locked when
360 * this function is called.
361 */
362static inline void ww_mutex_destroy(struct ww_mutex *lock)
363{
364 mutex_destroy(&lock->base);
365}
366
367/**
368 * ww_mutex_is_locked - is the w/w mutex locked
369 * @lock: the mutex to be queried
370 *
371 * Returns 1 if the mutex is locked, 0 if unlocked.
372 */
373static inline bool ww_mutex_is_locked(struct ww_mutex *lock)
374{
375 return mutex_is_locked(&lock->base);
376}
377
378#endif
diff --git a/include/linux/zbud.h b/include/linux/zbud.h
new file mode 100644
index 000000000000..2571a5cfa5fc
--- /dev/null
+++ b/include/linux/zbud.h
@@ -0,0 +1,22 @@
1#ifndef _ZBUD_H_
2#define _ZBUD_H_
3
4#include <linux/types.h>
5
6struct zbud_pool;
7
8struct zbud_ops {
9 int (*evict)(struct zbud_pool *pool, unsigned long handle);
10};
11
12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops);
13void zbud_destroy_pool(struct zbud_pool *pool);
14int zbud_alloc(struct zbud_pool *pool, int size, gfp_t gfp,
15 unsigned long *handle);
16void zbud_free(struct zbud_pool *pool, unsigned long handle);
17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries);
18void *zbud_map(struct zbud_pool *pool, unsigned long handle);
19void zbud_unmap(struct zbud_pool *pool, unsigned long handle);
20u64 zbud_get_pool_size(struct zbud_pool *pool);
21
22#endif /* _ZBUD_H_ */
diff --git a/include/media/davinci/vpbe_osd.h b/include/media/davinci/vpbe_osd.h
index 42628fcfe1bd..de59364d7ed2 100644
--- a/include/media/davinci/vpbe_osd.h
+++ b/include/media/davinci/vpbe_osd.h
@@ -82,9 +82,9 @@ enum osd_pix_format {
82 PIXFMT_4BPP, 82 PIXFMT_4BPP,
83 PIXFMT_8BPP, 83 PIXFMT_8BPP,
84 PIXFMT_RGB565, 84 PIXFMT_RGB565,
85 PIXFMT_YCbCrI, 85 PIXFMT_YCBCRI,
86 PIXFMT_RGB888, 86 PIXFMT_RGB888,
87 PIXFMT_YCrCbI, 87 PIXFMT_YCRCBI,
88 PIXFMT_NV12, 88 PIXFMT_NV12,
89 PIXFMT_OSD_ATTR, 89 PIXFMT_OSD_ATTR,
90}; 90};
diff --git a/include/media/media-device.h b/include/media/media-device.h
index eaade9815bb6..12155a9596c4 100644
--- a/include/media/media-device.h
+++ b/include/media/media-device.h
@@ -45,6 +45,7 @@ struct device;
45 * @entities: List of registered entities 45 * @entities: List of registered entities
46 * @lock: Entities list lock 46 * @lock: Entities list lock
47 * @graph_mutex: Entities graph operation lock 47 * @graph_mutex: Entities graph operation lock
48 * @link_notify: Link state change notification callback
48 * 49 *
49 * This structure represents an abstract high-level media device. It allows easy 50 * This structure represents an abstract high-level media device. It allows easy
50 * access to entities and provides basic media device-level support. The 51 * access to entities and provides basic media device-level support. The
@@ -75,10 +76,14 @@ struct media_device {
75 /* Serializes graph operations. */ 76 /* Serializes graph operations. */
76 struct mutex graph_mutex; 77 struct mutex graph_mutex;
77 78
78 int (*link_notify)(struct media_pad *source, 79 int (*link_notify)(struct media_link *link, u32 flags,
79 struct media_pad *sink, u32 flags); 80 unsigned int notification);
80}; 81};
81 82
83/* Supported link_notify @notification values. */
84#define MEDIA_DEV_NOTIFY_PRE_LINK_CH 0
85#define MEDIA_DEV_NOTIFY_POST_LINK_CH 1
86
82/* media_devnode to media_device */ 87/* media_devnode to media_device */
83#define to_media_device(node) container_of(node, struct media_device, devnode) 88#define to_media_device(node) container_of(node, struct media_device, devnode)
84 89
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 0c16f518ee09..06bacf937d61 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -128,11 +128,14 @@ void media_entity_cleanup(struct media_entity *entity);
128 128
129int media_entity_create_link(struct media_entity *source, u16 source_pad, 129int media_entity_create_link(struct media_entity *source, u16 source_pad,
130 struct media_entity *sink, u16 sink_pad, u32 flags); 130 struct media_entity *sink, u16 sink_pad, u32 flags);
131void __media_entity_remove_links(struct media_entity *entity);
132void media_entity_remove_links(struct media_entity *entity);
133
131int __media_entity_setup_link(struct media_link *link, u32 flags); 134int __media_entity_setup_link(struct media_link *link, u32 flags);
132int media_entity_setup_link(struct media_link *link, u32 flags); 135int media_entity_setup_link(struct media_link *link, u32 flags);
133struct media_link *media_entity_find_link(struct media_pad *source, 136struct media_link *media_entity_find_link(struct media_pad *source,
134 struct media_pad *sink); 137 struct media_pad *sink);
135struct media_pad *media_entity_remote_source(struct media_pad *pad); 138struct media_pad *media_entity_remote_pad(struct media_pad *pad);
136 139
137struct media_entity *media_entity_get(struct media_entity *entity); 140struct media_entity *media_entity_get(struct media_entity *entity);
138void media_entity_put(struct media_entity *entity); 141void media_entity_put(struct media_entity *entity);
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 5d5d3a30f04a..6628f5d01f52 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -111,6 +111,7 @@ void rc_map_init(void);
111#define RC_MAP_BUDGET_CI_OLD "rc-budget-ci-old" 111#define RC_MAP_BUDGET_CI_OLD "rc-budget-ci-old"
112#define RC_MAP_CINERGY_1400 "rc-cinergy-1400" 112#define RC_MAP_CINERGY_1400 "rc-cinergy-1400"
113#define RC_MAP_CINERGY "rc-cinergy" 113#define RC_MAP_CINERGY "rc-cinergy"
114#define RC_MAP_DELOCK_61959 "rc-delock-61959"
114#define RC_MAP_DIB0700_NEC_TABLE "rc-dib0700-nec" 115#define RC_MAP_DIB0700_NEC_TABLE "rc-dib0700-nec"
115#define RC_MAP_DIB0700_RC5_TABLE "rc-dib0700-rc5" 116#define RC_MAP_DIB0700_RC5_TABLE "rc-dib0700-rc5"
116#define RC_MAP_DIGITALNOW_TINYTWIN "rc-digitalnow-tinytwin" 117#define RC_MAP_DIGITALNOW_TINYTWIN "rc-digitalnow-tinytwin"
diff --git a/include/media/s5p_fimc.h b/include/media/s5p_fimc.h
index f50969025ef3..b975c285c8a9 100644
--- a/include/media/s5p_fimc.h
+++ b/include/media/s5p_fimc.h
@@ -13,6 +13,7 @@
13#define S5P_FIMC_H_ 13#define S5P_FIMC_H_
14 14
15#include <media/media-entity.h> 15#include <media/media-entity.h>
16#include <media/v4l2-dev.h>
16#include <media/v4l2-mediabus.h> 17#include <media/v4l2-mediabus.h>
17 18
18/* 19/*
@@ -115,6 +116,7 @@ struct s5p_platform_fimc {
115 * @color: the driver's private color format id 116 * @color: the driver's private color format id
116 * @memplanes: number of physically non-contiguous data planes 117 * @memplanes: number of physically non-contiguous data planes
117 * @colplanes: number of physically contiguous data planes 118 * @colplanes: number of physically contiguous data planes
119 * @colorspace: v4l2 colorspace (V4L2_COLORSPACE_*)
118 * @depth: per plane driver's private 'number of bits per pixel' 120 * @depth: per plane driver's private 'number of bits per pixel'
119 * @mdataplanes: bitmask indicating meta data plane(s), (1 << plane_no) 121 * @mdataplanes: bitmask indicating meta data plane(s), (1 << plane_no)
120 * @flags: flags indicating which operation mode format applies to 122 * @flags: flags indicating which operation mode format applies to
@@ -126,6 +128,7 @@ struct fimc_fmt {
126 u32 color; 128 u32 color;
127 u16 memplanes; 129 u16 memplanes;
128 u16 colplanes; 130 u16 colplanes;
131 u8 colorspace;
129 u8 depth[FIMC_MAX_PLANES]; 132 u8 depth[FIMC_MAX_PLANES];
130 u16 mdataplanes; 133 u16 mdataplanes;
131 u16 flags; 134 u16 flags;
@@ -140,37 +143,40 @@ struct fimc_fmt {
140#define FMT_FLAGS_YUV (1 << 7) 143#define FMT_FLAGS_YUV (1 << 7)
141}; 144};
142 145
143enum fimc_subdev_index { 146struct exynos_media_pipeline;
144 IDX_SENSOR,
145 IDX_CSIS,
146 IDX_FLITE,
147 IDX_IS_ISP,
148 IDX_FIMC,
149 IDX_MAX,
150};
151 147
152struct media_pipeline; 148/*
153struct v4l2_subdev; 149 * Media pipeline operations to be called from within a video node, i.e. the
150 * last entity within the pipeline. Implemented by related media device driver.
151 */
152struct exynos_media_pipeline_ops {
153 int (*prepare)(struct exynos_media_pipeline *p,
154 struct media_entity *me);
155 int (*unprepare)(struct exynos_media_pipeline *p);
156 int (*open)(struct exynos_media_pipeline *p, struct media_entity *me,
157 bool resume);
158 int (*close)(struct exynos_media_pipeline *p);
159 int (*set_stream)(struct exynos_media_pipeline *p, bool state);
160};
154 161
155struct fimc_pipeline { 162struct exynos_video_entity {
156 struct v4l2_subdev *subdevs[IDX_MAX]; 163 struct video_device vdev;
157 struct media_pipeline *m_pipeline; 164 struct exynos_media_pipeline *pipe;
158}; 165};
159 166
160/* 167struct exynos_media_pipeline {
161 * Media pipeline operations to be called from within the fimc(-lite) 168 struct media_pipeline mp;
162 * video node when it is the last entity of the pipeline. Implemented 169 const struct exynos_media_pipeline_ops *ops;
163 * by corresponding media device driver.
164 */
165struct fimc_pipeline_ops {
166 int (*open)(struct fimc_pipeline *p, struct media_entity *me,
167 bool resume);
168 int (*close)(struct fimc_pipeline *p);
169 int (*set_stream)(struct fimc_pipeline *p, bool state);
170}; 170};
171 171
172#define fimc_pipeline_call(f, op, p, args...) \ 172static inline struct exynos_video_entity *vdev_to_exynos_video_entity(
173 (!(f) ? -ENODEV : (((f)->pipeline_ops && (f)->pipeline_ops->op) ? \ 173 struct video_device *vdev)
174 (f)->pipeline_ops->op((p), ##args) : -ENOIOCTLCMD)) 174{
175 return container_of(vdev, struct exynos_video_entity, vdev);
176}
177
178#define fimc_pipeline_call(ent, op, args...) \
179 (!(ent) ? -ENOENT : (((ent)->pipe->ops && (ent)->pipe->ops->op) ? \
180 (ent)->pipe->ops->op(((ent)->pipe), ##args) : -ENOIOCTLCMD)) \
175 181
176#endif /* S5P_FIMC_H_ */ 182#endif /* S5P_FIMC_H_ */
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index 6fdb6adf6b2b..7f57056c22ba 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -22,6 +22,8 @@ struct sh_mobile_ceu_info {
22 int max_width; 22 int max_width;
23 int max_height; 23 int max_height;
24 struct sh_mobile_ceu_companion *csi2; 24 struct sh_mobile_ceu_companion *csi2;
25 struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */
26 unsigned int *asd_sizes; /* 0-terminated array pf asd group sizes */
25}; 27};
26 28
27#endif /* __ASM_SH_MOBILE_CEU_H__ */ 29#endif /* __ASM_SH_MOBILE_CEU_H__ */
diff --git a/include/media/sh_mobile_csi2.h b/include/media/sh_mobile_csi2.h
index c586c4f7f16b..14030db51f13 100644
--- a/include/media/sh_mobile_csi2.h
+++ b/include/media/sh_mobile_csi2.h
@@ -33,6 +33,7 @@ struct sh_csi2_client_config {
33 unsigned char lanes; /* bitmask[3:0] */ 33 unsigned char lanes; /* bitmask[3:0] */
34 unsigned char channel; /* 0..3 */ 34 unsigned char channel; /* 0..3 */
35 struct platform_device *pdev; /* client platform device */ 35 struct platform_device *pdev; /* client platform device */
36 const char *name; /* async matching: client name */
36}; 37};
37 38
38struct v4l2_device; 39struct v4l2_device;
@@ -42,7 +43,6 @@ struct sh_csi2_pdata {
42 unsigned int flags; 43 unsigned int flags;
43 struct sh_csi2_client_config *clients; 44 struct sh_csi2_client_config *clients;
44 int num_clients; 45 int num_clients;
45 struct v4l2_device *v4l2_dev;
46}; 46};
47 47
48#endif 48#endif
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index ff77d08c30fd..34d2414f2b8c 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -19,11 +19,13 @@
19#include <linux/videodev2.h> 19#include <linux/videodev2.h>
20#include <media/videobuf-core.h> 20#include <media/videobuf-core.h>
21#include <media/videobuf2-core.h> 21#include <media/videobuf2-core.h>
22#include <media/v4l2-async.h>
22#include <media/v4l2-ctrls.h> 23#include <media/v4l2-ctrls.h>
23#include <media/v4l2-device.h> 24#include <media/v4l2-device.h>
24 25
25struct file; 26struct file;
26struct soc_camera_desc; 27struct soc_camera_desc;
28struct soc_camera_async_client;
27 29
28struct soc_camera_device { 30struct soc_camera_device {
29 struct list_head list; /* list of all registered devices */ 31 struct list_head list; /* list of all registered devices */
@@ -49,6 +51,10 @@ struct soc_camera_device {
49 /* soc_camera.c private count. Only accessed with .host_lock held */ 51 /* soc_camera.c private count. Only accessed with .host_lock held */
50 int use_count; 52 int use_count;
51 struct file *streamer; /* stream owner */ 53 struct file *streamer; /* stream owner */
54 struct v4l2_clk *clk;
55 /* Asynchronous subdevice management */
56 struct soc_camera_async_client *sasc;
57 /* video buffer queue */
52 union { 58 union {
53 struct videobuf_queue vb_vidq; 59 struct videobuf_queue vb_vidq;
54 struct vb2_queue vb2_vidq; 60 struct vb2_queue vb2_vidq;
@@ -58,21 +64,38 @@ struct soc_camera_device {
58/* Host supports programmable stride */ 64/* Host supports programmable stride */
59#define SOCAM_HOST_CAP_STRIDE (1 << 0) 65#define SOCAM_HOST_CAP_STRIDE (1 << 0)
60 66
67enum soc_camera_subdev_role {
68 SOCAM_SUBDEV_DATA_SOURCE = 1,
69 SOCAM_SUBDEV_DATA_SINK,
70 SOCAM_SUBDEV_DATA_PROCESSOR,
71};
72
73struct soc_camera_async_subdev {
74 struct v4l2_async_subdev asd;
75 enum soc_camera_subdev_role role;
76};
77
61struct soc_camera_host { 78struct soc_camera_host {
62 struct v4l2_device v4l2_dev; 79 struct v4l2_device v4l2_dev;
63 struct list_head list; 80 struct list_head list;
64 struct mutex host_lock; /* Protect pipeline modifications */ 81 struct mutex host_lock; /* Main synchronisation lock */
82 struct mutex clk_lock; /* Protect pipeline modifications */
65 unsigned char nr; /* Host number */ 83 unsigned char nr; /* Host number */
66 u32 capabilities; 84 u32 capabilities;
85 struct soc_camera_device *icd; /* Currently attached client */
67 void *priv; 86 void *priv;
68 const char *drv_name; 87 const char *drv_name;
69 struct soc_camera_host_ops *ops; 88 struct soc_camera_host_ops *ops;
89 struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */
90 unsigned int *asd_sizes; /* 0-terminated array of asd group sizes */
70}; 91};
71 92
72struct soc_camera_host_ops { 93struct soc_camera_host_ops {
73 struct module *owner; 94 struct module *owner;
74 int (*add)(struct soc_camera_device *); 95 int (*add)(struct soc_camera_device *);
75 void (*remove)(struct soc_camera_device *); 96 void (*remove)(struct soc_camera_device *);
97 int (*clock_start)(struct soc_camera_host *);
98 void (*clock_stop)(struct soc_camera_host *);
76 /* 99 /*
77 * .get_formats() is called for each client device format, but 100 * .get_formats() is called for each client device format, but
78 * .put_formats() is only called once. Further, if any of the calls to 101 * .put_formats() is only called once. Further, if any of the calls to
@@ -157,6 +180,7 @@ struct soc_camera_host_desc {
157}; 180};
158 181
159/* 182/*
183 * Platform data for "soc-camera-pdrv"
160 * This MUST be kept binary-identical to struct soc_camera_link below, until 184 * This MUST be kept binary-identical to struct soc_camera_link below, until
161 * it is completely replaced by this one, after which we can split it into its 185 * it is completely replaced by this one, after which we can split it into its
162 * two components. 186 * two components.
@@ -322,14 +346,17 @@ static inline void soc_camera_limit_side(int *start, int *length,
322unsigned long soc_camera_apply_board_flags(struct soc_camera_subdev_desc *ssdd, 346unsigned long soc_camera_apply_board_flags(struct soc_camera_subdev_desc *ssdd,
323 const struct v4l2_mbus_config *cfg); 347 const struct v4l2_mbus_config *cfg);
324 348
325int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd); 349int soc_camera_power_init(struct device *dev, struct soc_camera_subdev_desc *ssdd);
326int soc_camera_power_off(struct device *dev, struct soc_camera_subdev_desc *ssdd); 350int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd,
351 struct v4l2_clk *clk);
352int soc_camera_power_off(struct device *dev, struct soc_camera_subdev_desc *ssdd,
353 struct v4l2_clk *clk);
327 354
328static inline int soc_camera_set_power(struct device *dev, 355static inline int soc_camera_set_power(struct device *dev,
329 struct soc_camera_subdev_desc *ssdd, bool on) 356 struct soc_camera_subdev_desc *ssdd, struct v4l2_clk *clk, bool on)
330{ 357{
331 return on ? soc_camera_power_on(dev, ssdd) 358 return on ? soc_camera_power_on(dev, ssdd, clk)
332 : soc_camera_power_off(dev, ssdd); 359 : soc_camera_power_off(dev, ssdd, clk);
333} 360}
334 361
335/* This is only temporary here - until v4l2-subdev begins to link to video_device */ 362/* This is only temporary here - until v4l2-subdev begins to link to video_device */
@@ -346,9 +373,9 @@ static inline struct soc_camera_subdev_desc *soc_camera_i2c_to_desc(const struct
346 return client->dev.platform_data; 373 return client->dev.platform_data;
347} 374}
348 375
349static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(const struct video_device *vdev) 376static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(struct video_device *vdev)
350{ 377{
351 struct soc_camera_device *icd = dev_get_drvdata(vdev->parent); 378 struct soc_camera_device *icd = video_get_drvdata(vdev);
352 return soc_camera_to_subdev(icd); 379 return soc_camera_to_subdev(icd);
353} 380}
354 381
diff --git a/include/media/ths7303.h b/include/media/ths7303.h
index 980ec51d574d..a7b49297da82 100644
--- a/include/media/ths7303.h
+++ b/include/media/ths7303.h
@@ -30,13 +30,11 @@
30 * @ch_1: Bias value for channel one. 30 * @ch_1: Bias value for channel one.
31 * @ch_2: Bias value for channel two. 31 * @ch_2: Bias value for channel two.
32 * @ch_3: Bias value for channel three. 32 * @ch_3: Bias value for channel three.
33 * @init_enable: initalize on init.
34 */ 33 */
35struct ths7303_platform_data { 34struct ths7303_platform_data {
36 u8 ch_1; 35 u8 ch_1;
37 u8 ch_2; 36 u8 ch_2;
38 u8 ch_3; 37 u8 ch_3;
39 u8 init_enable;
40}; 38};
41 39
42#endif 40#endif
diff --git a/include/media/tveeprom.h b/include/media/tveeprom.h
index a8ad75a9152a..4a1191abd936 100644
--- a/include/media/tveeprom.h
+++ b/include/media/tveeprom.h
@@ -1,6 +1,17 @@
1/* 1/*
2 */ 2 */
3 3
4enum tveeprom_audio_processor {
5 /* No audio processor present */
6 TVEEPROM_AUDPROC_NONE,
7 /* The audio processor is internal to the video processor */
8 TVEEPROM_AUDPROC_INTERNAL,
9 /* The audio processor is a MSPXXXX device */
10 TVEEPROM_AUDPROC_MSP,
11 /* The audio processor is another device */
12 TVEEPROM_AUDPROC_OTHER,
13};
14
4struct tveeprom { 15struct tveeprom {
5 u32 has_radio; 16 u32 has_radio;
6 /* If has_ir == 0, then it is unknown what the IR capabilities are, 17 /* If has_ir == 0, then it is unknown what the IR capabilities are,
diff --git a/include/media/tvp7002.h b/include/media/tvp7002.h
index ee4353459ef5..fadb6afe9ef0 100644
--- a/include/media/tvp7002.h
+++ b/include/media/tvp7002.h
@@ -26,31 +26,29 @@
26#ifndef _TVP7002_H_ 26#ifndef _TVP7002_H_
27#define _TVP7002_H_ 27#define _TVP7002_H_
28 28
29/* Platform-dependent data 29#define TVP7002_MODULE_NAME "tvp7002"
30 * 30
31 * clk_polarity: 31/**
32 * 0 -> data clocked out on rising edge of DATACLK signal 32 * struct tvp7002_config - Platform dependent data
33 * 1 -> data clocked out on falling edge of DATACLK signal 33 *@clk_polarity: Clock polarity
34 * hs_polarity: 34 * 0 - Data clocked out on rising edge of DATACLK signal
35 * 0 -> active low HSYNC output 35 * 1 - Data clocked out on falling edge of DATACLK signal
36 * 1 -> active high HSYNC output 36 *@hs_polarity: HSYNC polarity
37 * sog_polarity: 37 * 0 - Active low HSYNC output, 1 - Active high HSYNC output
38 * 0 -> normal operation 38 *@vs_polarity: VSYNC Polarity
39 * 1 -> operation with polarity inverted 39 * 0 - Active low VSYNC output, 1 - Active high VSYNC output
40 * vs_polarity: 40 *@fid_polarity: Active-high Field ID polarity.
41 * 0 -> active low VSYNC output 41 * 0 - The field ID output is set to logic 1 for an odd field
42 * 1 -> active high VSYNC output 42 * (field 1) and set to logic 0 for an even field (field 0).
43 * fid_polarity: 43 * 1 - Operation with polarity inverted.
44 * 0 -> the field ID output is set to logic 1 for an odd 44 *@sog_polarity: Active high Sync on Green output polarity.
45 * field (field 1) and set to logic 0 for an even 45 * 0 - Normal operation, 1 - Operation with polarity inverted
46 * field (field 0).
47 * 1 -> operation with polarity inverted.
48 */ 46 */
49struct tvp7002_config { 47struct tvp7002_config {
50 u8 clk_polarity; 48 bool clk_polarity;
51 u8 hs_polarity; 49 bool hs_polarity;
52 u8 vs_polarity; 50 bool vs_polarity;
53 u8 fid_polarity; 51 bool fid_polarity;
54 u8 sog_polarity; 52 bool sog_polarity;
55}; 53};
56#endif 54#endif
diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
new file mode 100644
index 000000000000..c3ec6ac75f7e
--- /dev/null
+++ b/include/media/v4l2-async.h
@@ -0,0 +1,105 @@
1/*
2 * V4L2 asynchronous subdevice registration API
3 *
4 * Copyright (C) 2012-2013, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef V4L2_ASYNC_H
12#define V4L2_ASYNC_H
13
14#include <linux/list.h>
15#include <linux/mutex.h>
16
17struct device;
18struct v4l2_device;
19struct v4l2_subdev;
20struct v4l2_async_notifier;
21
22/* A random max subdevice number, used to allocate an array on stack */
23#define V4L2_MAX_SUBDEVS 128U
24
25enum v4l2_async_bus_type {
26 V4L2_ASYNC_BUS_CUSTOM,
27 V4L2_ASYNC_BUS_PLATFORM,
28 V4L2_ASYNC_BUS_I2C,
29};
30
31/**
32 * struct v4l2_async_subdev - sub-device descriptor, as known to a bridge
33 * @bus_type: subdevice bus type to select the appropriate matching method
34 * @match: union of per-bus type matching data sets
35 * @list: used to link struct v4l2_async_subdev objects, waiting to be
36 * probed, to a notifier->waiting list
37 */
38struct v4l2_async_subdev {
39 enum v4l2_async_bus_type bus_type;
40 union {
41 struct {
42 const char *name;
43 } platform;
44 struct {
45 int adapter_id;
46 unsigned short address;
47 } i2c;
48 struct {
49 bool (*match)(struct device *,
50 struct v4l2_async_subdev *);
51 void *priv;
52 } custom;
53 } match;
54
55 /* v4l2-async core private: not to be used by drivers */
56 struct list_head list;
57};
58
59/**
60 * v4l2_async_subdev_list - provided by subdevices
61 * @list: links struct v4l2_async_subdev_list objects to a global list
62 * before probing, and onto notifier->done after probing
63 * @asd: pointer to respective struct v4l2_async_subdev
64 * @notifier: pointer to managing notifier
65 */
66struct v4l2_async_subdev_list {
67 struct list_head list;
68 struct v4l2_async_subdev *asd;
69 struct v4l2_async_notifier *notifier;
70};
71
72/**
73 * v4l2_async_notifier - v4l2_device notifier data
74 * @num_subdevs:number of subdevices
75 * @subdev: array of pointers to subdevice descriptors
76 * @v4l2_dev: pointer to struct v4l2_device
77 * @waiting: list of struct v4l2_async_subdev, waiting for their drivers
78 * @done: list of struct v4l2_async_subdev_list, already probed
79 * @list: member in a global list of notifiers
80 * @bound: a subdevice driver has successfully probed one of subdevices
81 * @complete: all subdevices have been probed successfully
82 * @unbind: a subdevice is leaving
83 */
84struct v4l2_async_notifier {
85 unsigned int num_subdevs;
86 struct v4l2_async_subdev **subdev;
87 struct v4l2_device *v4l2_dev;
88 struct list_head waiting;
89 struct list_head done;
90 struct list_head list;
91 int (*bound)(struct v4l2_async_notifier *notifier,
92 struct v4l2_subdev *subdev,
93 struct v4l2_async_subdev *asd);
94 int (*complete)(struct v4l2_async_notifier *notifier);
95 void (*unbind)(struct v4l2_async_notifier *notifier,
96 struct v4l2_subdev *subdev,
97 struct v4l2_async_subdev *asd);
98};
99
100int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
101 struct v4l2_async_notifier *notifier);
102void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier);
103int v4l2_async_register_subdev(struct v4l2_subdev *sd);
104void v4l2_async_unregister_subdev(struct v4l2_subdev *sd);
105#endif
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
deleted file mode 100644
index c259b36bf1e9..000000000000
--- a/include/media/v4l2-chip-ident.h
+++ /dev/null
@@ -1,352 +0,0 @@
1/*
2 v4l2 chip identifiers header
3
4 This header provides a list of chip identifiers that can be returned
5 through the VIDIOC_DBG_G_CHIP_IDENT ioctl.
6
7 Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#ifndef V4L2_CHIP_IDENT_H_
25#define V4L2_CHIP_IDENT_H_
26
27/* VIDIOC_DBG_G_CHIP_IDENT: identifies the actual chip installed on the board */
28
29/* KEEP THIS LIST ORDERED BY ID!
30 Otherwise it will be hard to see which ranges are already in use when
31 adding support to a new chip family. */
32enum {
33 /* general idents: reserved range 0-49 */
34 V4L2_IDENT_NONE = 0, /* No chip matched */
35 V4L2_IDENT_AMBIGUOUS = 1, /* Match too general, multiple chips matched */
36 V4L2_IDENT_UNKNOWN = 2, /* Chip found, but cannot identify */
37
38 /* module tvaudio: reserved range 50-99 */
39 V4L2_IDENT_TVAUDIO = 50, /* A tvaudio chip, unknown which it is exactly */
40
41 /* Sony IMX074 */
42 V4L2_IDENT_IMX074 = 74,
43
44 /* module saa7110: just ident 100 */
45 V4L2_IDENT_SAA7110 = 100,
46
47 /* module saa7115: reserved range 101-149 */
48 V4L2_IDENT_SAA7111 = 101,
49 V4L2_IDENT_SAA7111A = 102,
50 V4L2_IDENT_SAA7113 = 103,
51 V4L2_IDENT_SAA7114 = 104,
52 V4L2_IDENT_SAA7115 = 105,
53 V4L2_IDENT_SAA7118 = 108,
54
55 /* module saa7127: reserved range 150-199 */
56 V4L2_IDENT_SAA7127 = 157,
57 V4L2_IDENT_SAA7129 = 159,
58
59 /* module cx25840: reserved range 200-249 */
60 V4L2_IDENT_CX25836 = 236,
61 V4L2_IDENT_CX25837 = 237,
62 V4L2_IDENT_CX25840 = 240,
63 V4L2_IDENT_CX25841 = 241,
64 V4L2_IDENT_CX25842 = 242,
65 V4L2_IDENT_CX25843 = 243,
66
67 /* OmniVision sensors: reserved range 250-299 */
68 V4L2_IDENT_OV7670 = 250,
69 V4L2_IDENT_OV7720 = 251,
70 V4L2_IDENT_OV7725 = 252,
71 V4L2_IDENT_OV7660 = 253,
72 V4L2_IDENT_OV9650 = 254,
73 V4L2_IDENT_OV9655 = 255,
74 V4L2_IDENT_SOI968 = 256,
75 V4L2_IDENT_OV9640 = 257,
76 V4L2_IDENT_OV6650 = 258,
77 V4L2_IDENT_OV2640 = 259,
78 V4L2_IDENT_OV9740 = 260,
79 V4L2_IDENT_OV5642 = 261,
80
81 /* module saa7146: reserved range 300-309 */
82 V4L2_IDENT_SAA7146 = 300,
83
84 /* Conexant MPEG encoder/decoders: reserved range 400-420 */
85 V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */
86 V4L2_IDENT_CX23415 = 415,
87 V4L2_IDENT_CX23416 = 416,
88 V4L2_IDENT_CX23417 = 417,
89 V4L2_IDENT_CX23418 = 418,
90
91 /* module bt819: reserved range 810-819 */
92 V4L2_IDENT_BT815A = 815,
93 V4L2_IDENT_BT817A = 817,
94 V4L2_IDENT_BT819A = 819,
95
96 /* module au0828 */
97 V4L2_IDENT_AU0828 = 828,
98
99 /* module bttv: ident 848 + 849 */
100 V4L2_IDENT_BT848 = 848,
101 V4L2_IDENT_BT849 = 849,
102
103 /* module bt856: just ident 856 */
104 V4L2_IDENT_BT856 = 856,
105
106 /* module bt866: just ident 866 */
107 V4L2_IDENT_BT866 = 866,
108
109 /* module bttv: ident 878 + 879 */
110 V4L2_IDENT_BT878 = 878,
111 V4L2_IDENT_BT879 = 879,
112
113 /* module ks0127: reserved range 1120-1129 */
114 V4L2_IDENT_KS0122S = 1122,
115 V4L2_IDENT_KS0127 = 1127,
116 V4L2_IDENT_KS0127B = 1128,
117
118 /* module indycam: just ident 2000 */
119 V4L2_IDENT_INDYCAM = 2000,
120
121 /* module vp27smpx: just ident 2700 */
122 V4L2_IDENT_VP27SMPX = 2700,
123
124 /* module vpx3220: reserved range: 3210-3229 */
125 V4L2_IDENT_VPX3214C = 3214,
126 V4L2_IDENT_VPX3216B = 3216,
127 V4L2_IDENT_VPX3220A = 3220,
128
129 /* VX855 just ident 3409 */
130 /* Other via devs could use 3314, 3324, 3327, 3336, 3364, 3353 */
131 V4L2_IDENT_VIA_VX855 = 3409,
132
133 /* module tvp5150 */
134 V4L2_IDENT_TVP5150 = 5150,
135
136 /* module saa5246a: just ident 5246 */
137 V4L2_IDENT_SAA5246A = 5246,
138
139 /* module saa5249: just ident 5249 */
140 V4L2_IDENT_SAA5249 = 5249,
141
142 /* module cs5345: just ident 5345 */
143 V4L2_IDENT_CS5345 = 5345,
144
145 /* module tea6415c: just ident 6415 */
146 V4L2_IDENT_TEA6415C = 6415,
147
148 /* module tea6420: just ident 6420 */
149 V4L2_IDENT_TEA6420 = 6420,
150
151 /* module saa6588: just ident 6588 */
152 V4L2_IDENT_SAA6588 = 6588,
153
154 /* module vs6624: just ident 6624 */
155 V4L2_IDENT_VS6624 = 6624,
156
157 /* module saa6752hs: reserved range 6750-6759 */
158 V4L2_IDENT_SAA6752HS = 6752,
159 V4L2_IDENT_SAA6752HS_AC3 = 6753,
160
161 /* modules tef6862: just ident 6862 */
162 V4L2_IDENT_TEF6862 = 6862,
163
164 /* module tvp7002: just ident 7002 */
165 V4L2_IDENT_TVP7002 = 7002,
166
167 /* module adv7170: just ident 7170 */
168 V4L2_IDENT_ADV7170 = 7170,
169
170 /* module adv7175: just ident 7175 */
171 V4L2_IDENT_ADV7175 = 7175,
172
173 /* module adv7180: just ident 7180 */
174 V4L2_IDENT_ADV7180 = 7180,
175
176 /* module adv7183: just ident 7183 */
177 V4L2_IDENT_ADV7183 = 7183,
178
179 /* module saa7185: just ident 7185 */
180 V4L2_IDENT_SAA7185 = 7185,
181
182 /* module saa7191: just ident 7191 */
183 V4L2_IDENT_SAA7191 = 7191,
184
185 /* module ths7303: just ident 7303 */
186 V4L2_IDENT_THS7303 = 7303,
187
188 /* module adv7343: just ident 7343 */
189 V4L2_IDENT_ADV7343 = 7343,
190
191 /* module ths7353: just ident 7353 */
192 V4L2_IDENT_THS7353 = 7353,
193
194 /* module adv7393: just ident 7393 */
195 V4L2_IDENT_ADV7393 = 7393,
196
197 /* module adv7604: just ident 7604 */
198 V4L2_IDENT_ADV7604 = 7604,
199
200 /* module saa7706h: just ident 7706 */
201 V4L2_IDENT_SAA7706H = 7706,
202
203 /* module mt9v011, just ident 8243 */
204 V4L2_IDENT_MT9V011 = 8243,
205
206 /* module wm8739: just ident 8739 */
207 V4L2_IDENT_WM8739 = 8739,
208
209 /* module wm8775: just ident 8775 */
210 V4L2_IDENT_WM8775 = 8775,
211
212 /* Marvell controllers starting at 8801 */
213 V4L2_IDENT_CAFE = 8801,
214 V4L2_IDENT_ARMADA610 = 8802,
215
216 /* AKM AK8813/AK8814 */
217 V4L2_IDENT_AK8813 = 8813,
218 V4L2_IDENT_AK8814 = 8814,
219
220 /* module cx23885 and cx25840 */
221 V4L2_IDENT_CX23885 = 8850,
222 V4L2_IDENT_CX23885_AV = 8851, /* Integrated A/V decoder */
223 V4L2_IDENT_CX23887 = 8870,
224 V4L2_IDENT_CX23887_AV = 8871, /* Integrated A/V decoder */
225 V4L2_IDENT_CX23888 = 8880,
226 V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */
227 V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */
228
229 /* module ad9389b: just ident 9389 */
230 V4L2_IDENT_AD9389B = 9389,
231
232 /* module tda9840: just ident 9840 */
233 V4L2_IDENT_TDA9840 = 9840,
234
235 /* module tw9910: just ident 9910 */
236 V4L2_IDENT_TW9910 = 9910,
237
238 /* module sn9c20x: just ident 10000 */
239 V4L2_IDENT_SN9C20X = 10000,
240
241 /* module cx231xx and cx25840 */
242 V4L2_IDENT_CX2310X_AV = 23099, /* Integrated A/V decoder; not in '100 */
243 V4L2_IDENT_CX23100 = 23100,
244 V4L2_IDENT_CX23101 = 23101,
245 V4L2_IDENT_CX23102 = 23102,
246
247 /* module msp3400: reserved range 34000-34999 for msp34xx */
248 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only
249 use internally (tveeprom.c). */
250
251 V4L2_IDENT_MSP3400B = 34002,
252 V4L2_IDENT_MSP3400C = 34003,
253 V4L2_IDENT_MSP3400D = 34004,
254 V4L2_IDENT_MSP3400G = 34007,
255 V4L2_IDENT_MSP3401G = 34017,
256 V4L2_IDENT_MSP3402G = 34027,
257 V4L2_IDENT_MSP3405D = 34054,
258 V4L2_IDENT_MSP3405G = 34057,
259 V4L2_IDENT_MSP3407D = 34074,
260 V4L2_IDENT_MSP3407G = 34077,
261
262 V4L2_IDENT_MSP3410B = 34102,
263 V4L2_IDENT_MSP3410C = 34103,
264 V4L2_IDENT_MSP3410D = 34104,
265 V4L2_IDENT_MSP3410G = 34107,
266 V4L2_IDENT_MSP3411G = 34117,
267 V4L2_IDENT_MSP3412G = 34127,
268 V4L2_IDENT_MSP3415D = 34154,
269 V4L2_IDENT_MSP3415G = 34157,
270 V4L2_IDENT_MSP3417D = 34174,
271 V4L2_IDENT_MSP3417G = 34177,
272
273 V4L2_IDENT_MSP3420G = 34207,
274 V4L2_IDENT_MSP3421G = 34217,
275 V4L2_IDENT_MSP3422G = 34227,
276 V4L2_IDENT_MSP3425G = 34257,
277 V4L2_IDENT_MSP3427G = 34277,
278
279 V4L2_IDENT_MSP3430G = 34307,
280 V4L2_IDENT_MSP3431G = 34317,
281 V4L2_IDENT_MSP3435G = 34357,
282 V4L2_IDENT_MSP3437G = 34377,
283
284 V4L2_IDENT_MSP3440G = 34407,
285 V4L2_IDENT_MSP3441G = 34417,
286 V4L2_IDENT_MSP3442G = 34427,
287 V4L2_IDENT_MSP3445G = 34457,
288 V4L2_IDENT_MSP3447G = 34477,
289
290 V4L2_IDENT_MSP3450G = 34507,
291 V4L2_IDENT_MSP3451G = 34517,
292 V4L2_IDENT_MSP3452G = 34527,
293 V4L2_IDENT_MSP3455G = 34557,
294 V4L2_IDENT_MSP3457G = 34577,
295
296 V4L2_IDENT_MSP3460G = 34607,
297 V4L2_IDENT_MSP3461G = 34617,
298 V4L2_IDENT_MSP3465G = 34657,
299 V4L2_IDENT_MSP3467G = 34677,
300
301 /* module msp3400: reserved range 44000-44999 for msp44xx */
302 V4L2_IDENT_MSP4400G = 44007,
303 V4L2_IDENT_MSP4408G = 44087,
304 V4L2_IDENT_MSP4410G = 44107,
305 V4L2_IDENT_MSP4418G = 44187,
306 V4L2_IDENT_MSP4420G = 44207,
307 V4L2_IDENT_MSP4428G = 44287,
308 V4L2_IDENT_MSP4440G = 44407,
309 V4L2_IDENT_MSP4448G = 44487,
310 V4L2_IDENT_MSP4450G = 44507,
311 V4L2_IDENT_MSP4458G = 44587,
312
313 /* Micron CMOS sensor chips: 45000-45099 */
314 V4L2_IDENT_MT9M001C12ST = 45000,
315 V4L2_IDENT_MT9M001C12STM = 45005,
316 V4L2_IDENT_MT9M111 = 45007,
317 V4L2_IDENT_MT9M112 = 45008,
318 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */
319 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */
320 V4L2_IDENT_MT9T031 = 45020,
321 V4L2_IDENT_MT9T111 = 45021,
322 V4L2_IDENT_MT9T112 = 45022,
323 V4L2_IDENT_MT9V111 = 45031,
324 V4L2_IDENT_MT9V112 = 45032,
325
326 /* HV7131R CMOS sensor: just ident 46000 */
327 V4L2_IDENT_HV7131R = 46000,
328
329 /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */
330 V4L2_IDENT_RJ54N1CB0C = 51980,
331
332 /* module m52790: just ident 52790 */
333 V4L2_IDENT_M52790 = 52790,
334
335 /* module cs53132a: just ident 53132 */
336 V4L2_IDENT_CS53l32A = 53132,
337
338 /* modules upd61151 MPEG2 encoder: just ident 54000 */
339 V4L2_IDENT_UPD61161 = 54000,
340 /* modules upd61152 MPEG2 encoder with AC3: just ident 54001 */
341 V4L2_IDENT_UPD61162 = 54001,
342
343 /* module upd64031a: just ident 64031 */
344 V4L2_IDENT_UPD64031A = 64031,
345
346 /* module upd64083: just ident 64083 */
347 V4L2_IDENT_UPD64083 = 64083,
348
349 /* Don't just add new IDs at the end: KEEP THIS LIST ORDERED BY ID! */
350};
351
352#endif
diff --git a/include/media/v4l2-clk.h b/include/media/v4l2-clk.h
new file mode 100644
index 000000000000..0503a90b48bb
--- /dev/null
+++ b/include/media/v4l2-clk.h
@@ -0,0 +1,54 @@
1/*
2 * V4L2 clock service
3 *
4 * Copyright (C) 2012-2013, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ATTENTION: This is a temporary API and it shall be replaced by the generic
11 * clock API, when the latter becomes widely available.
12 */
13
14#ifndef MEDIA_V4L2_CLK_H
15#define MEDIA_V4L2_CLK_H
16
17#include <linux/atomic.h>
18#include <linux/list.h>
19#include <linux/mutex.h>
20
21struct module;
22struct device;
23
24struct v4l2_clk {
25 struct list_head list;
26 const struct v4l2_clk_ops *ops;
27 const char *dev_id;
28 const char *id;
29 int enable;
30 struct mutex lock; /* Protect the enable count */
31 atomic_t use_count;
32 void *priv;
33};
34
35struct v4l2_clk_ops {
36 struct module *owner;
37 int (*enable)(struct v4l2_clk *clk);
38 void (*disable)(struct v4l2_clk *clk);
39 unsigned long (*get_rate)(struct v4l2_clk *clk);
40 int (*set_rate)(struct v4l2_clk *clk, unsigned long);
41};
42
43struct v4l2_clk *v4l2_clk_register(const struct v4l2_clk_ops *ops,
44 const char *dev_name,
45 const char *name, void *priv);
46void v4l2_clk_unregister(struct v4l2_clk *clk);
47struct v4l2_clk *v4l2_clk_get(struct device *dev, const char *id);
48void v4l2_clk_put(struct v4l2_clk *clk);
49int v4l2_clk_enable(struct v4l2_clk *clk);
50void v4l2_clk_disable(struct v4l2_clk *clk);
51unsigned long v4l2_clk_get_rate(struct v4l2_clk *clk);
52int v4l2_clk_set_rate(struct v4l2_clk *clk, unsigned long rate);
53
54#endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 1d93c48cb371..015ff82da73c 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -100,16 +100,6 @@ u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
100 100
101/* ------------------------------------------------------------------------- */ 101/* ------------------------------------------------------------------------- */
102 102
103/* Register/chip ident helper function */
104
105struct i2c_client; /* forward reference */
106int v4l2_chip_match_i2c_client(struct i2c_client *c, const struct v4l2_dbg_match *match);
107int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_dbg_chip_ident *chip,
108 u32 ident, u32 revision);
109int v4l2_chip_match_host(const struct v4l2_dbg_match *match);
110
111/* ------------------------------------------------------------------------- */
112
113/* I2C Helper functions */ 103/* I2C Helper functions */
114 104
115struct i2c_driver; 105struct i2c_driver;
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 7343a27fe819..47ada23345a1 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -22,6 +22,7 @@
22#define _V4L2_CTRLS_H 22#define _V4L2_CTRLS_H
23 23
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/mutex.h>
25#include <linux/videodev2.h> 26#include <linux/videodev2.h>
26 27
27/* forward references */ 28/* forward references */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 95d1c91770f4..c768c9f8abc2 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -96,9 +96,9 @@ struct video_device
96 struct device dev; /* v4l device */ 96 struct device dev; /* v4l device */
97 struct cdev *cdev; /* character device */ 97 struct cdev *cdev; /* character device */
98 98
99 /* Set either parent or v4l2_dev if your driver uses v4l2_device */
100 struct device *parent; /* device parent */
101 struct v4l2_device *v4l2_dev; /* v4l2_device parent */ 99 struct v4l2_device *v4l2_dev; /* v4l2_device parent */
100 /* Only set parent if that can't be deduced from v4l2_dev */
101 struct device *dev_parent; /* device parent */
102 102
103 /* Control handler associated with this device node. May be NULL. */ 103 /* Control handler associated with this device node. May be NULL. */
104 struct v4l2_ctrl_handler *ctrl_handler; 104 struct v4l2_ctrl_handler *ctrl_handler;
@@ -129,7 +129,6 @@ struct video_device
129 129
130 /* Video standard vars */ 130 /* Video standard vars */
131 v4l2_std_id tvnorms; /* Supported tv norms */ 131 v4l2_std_id tvnorms; /* Supported tv norms */
132 v4l2_std_id current_norm; /* Current tvnorm */
133 132
134 /* callbacks */ 133 /* callbacks */
135 void (*release)(struct video_device *vdev); 134 void (*release)(struct video_device *vdev);
diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h
index e6aa2318367b..0286c95814ff 100644
--- a/include/media/v4l2-int-device.h
+++ b/include/media/v4l2-int-device.h
@@ -220,8 +220,6 @@ enum v4l2_int_ioctl_num {
220 vidioc_int_reset_num, 220 vidioc_int_reset_num,
221 /* VIDIOC_INT_INIT */ 221 /* VIDIOC_INT_INIT */
222 vidioc_int_init_num, 222 vidioc_int_init_num,
223 /* VIDIOC_DBG_G_CHIP_IDENT */
224 vidioc_int_g_chip_ident_num,
225 223
226 /* 224 /*
227 * 225 *
@@ -303,6 +301,5 @@ V4L2_INT_WRAPPER_1(enum_frameintervals, struct v4l2_frmivalenum, *);
303 301
304V4L2_INT_WRAPPER_0(reset); 302V4L2_INT_WRAPPER_0(reset);
305V4L2_INT_WRAPPER_0(init); 303V4L2_INT_WRAPPER_0(init);
306V4L2_INT_WRAPPER_1(g_chip_ident, int, *);
307 304
308#endif 305#endif
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 931652f0e2af..e0b74a430b3a 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -247,8 +247,6 @@ struct v4l2_ioctl_ops {
247 int (*vidioc_g_chip_info) (struct file *file, void *fh, 247 int (*vidioc_g_chip_info) (struct file *file, void *fh,
248 struct v4l2_dbg_chip_info *chip); 248 struct v4l2_dbg_chip_info *chip);
249#endif 249#endif
250 int (*vidioc_g_chip_ident) (struct file *file, void *fh,
251 struct v4l2_dbg_chip_ident *chip);
252 250
253 int (*vidioc_enum_framesizes) (struct file *file, void *fh, 251 int (*vidioc_enum_framesizes) (struct file *file, void *fh,
254 struct v4l2_frmsizeenum *fsize); 252 struct v4l2_frmsizeenum *fsize);
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 5298d678d0f3..3250cc5e7925 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -24,6 +24,7 @@
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/v4l2-subdev.h> 25#include <linux/v4l2-subdev.h>
26#include <media/media-entity.h> 26#include <media/media-entity.h>
27#include <media/v4l2-async.h>
27#include <media/v4l2-common.h> 28#include <media/v4l2-common.h>
28#include <media/v4l2-dev.h> 29#include <media/v4l2-dev.h>
29#include <media/v4l2-fh.h> 30#include <media/v4l2-fh.h>
@@ -88,7 +89,6 @@ struct v4l2_decode_vbi_line {
88 89
89/* Core ops: it is highly recommended to implement at least these ops: 90/* Core ops: it is highly recommended to implement at least these ops:
90 91
91 g_chip_ident
92 log_status 92 log_status
93 g_register 93 g_register
94 s_register 94 s_register
@@ -145,7 +145,6 @@ struct v4l2_subdev_io_pin_config {
145 performed later. It must not sleep. *Called from an IRQ context*. 145 performed later. It must not sleep. *Called from an IRQ context*.
146 */ 146 */
147struct v4l2_subdev_core_ops { 147struct v4l2_subdev_core_ops {
148 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
149 int (*log_status)(struct v4l2_subdev *sd); 148 int (*log_status)(struct v4l2_subdev *sd);
150 int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n, 149 int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n,
151 struct v4l2_subdev_io_pin_config *pincfg); 150 struct v4l2_subdev_io_pin_config *pincfg);
@@ -585,8 +584,17 @@ struct v4l2_subdev {
585 void *host_priv; 584 void *host_priv;
586 /* subdev device node */ 585 /* subdev device node */
587 struct video_device *devnode; 586 struct video_device *devnode;
587 /* pointer to the physical device, if any */
588 struct device *dev;
589 struct v4l2_async_subdev_list asdl;
588}; 590};
589 591
592static inline struct v4l2_subdev *v4l2_async_to_subdev(
593 struct v4l2_async_subdev_list *asdl)
594{
595 return container_of(asdl, struct v4l2_subdev, asdl);
596}
597
590#define media_entity_to_v4l2_subdev(ent) \ 598#define media_entity_to_v4l2_subdev(ent) \
591 container_of(ent, struct v4l2_subdev, entity) 599 container_of(ent, struct v4l2_subdev, entity)
592#define vdev_to_v4l2_subdev(vdev) \ 600#define vdev_to_v4l2_subdev(vdev) \
@@ -660,7 +668,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,
660/* Call an ops of a v4l2_subdev, doing the right checks against 668/* Call an ops of a v4l2_subdev, doing the right checks against
661 NULL pointers. 669 NULL pointers.
662 670
663 Example: err = v4l2_subdev_call(sd, core, g_chip_ident, &chip); 671 Example: err = v4l2_subdev_call(sd, core, s_std, norm);
664 */ 672 */
665#define v4l2_subdev_call(sd, o, f, args...) \ 673#define v4l2_subdev_call(sd, o, f, args...) \
666 (!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ? \ 674 (!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ? \
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index adcbb20f6511..d9fa68f26c41 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -26,6 +26,9 @@
26#ifndef NET_9P_TRANSPORT_H 26#ifndef NET_9P_TRANSPORT_H
27#define NET_9P_TRANSPORT_H 27#define NET_9P_TRANSPORT_H
28 28
29#define P9_DEF_MIN_RESVPORT (665U)
30#define P9_DEF_MAX_RESVPORT (1023U)
31
29/** 32/**
30 * struct p9_trans_module - transport module interface 33 * struct p9_trans_module - transport module interface
31 * @list: used to maintain a list of currently available transports 34 * @list: used to maintain a list of currently available transports
@@ -37,6 +40,8 @@
37 * @close: member function to discard a connection on this transport 40 * @close: member function to discard a connection on this transport
38 * @request: member function to issue a request to the transport 41 * @request: member function to issue a request to the transport
39 * @cancel: member function to cancel a request (if it hasn't been sent) 42 * @cancel: member function to cancel a request (if it hasn't been sent)
43 * @cancelled: member function to notify that a cancelled request will not
44 * not receive a reply
40 * 45 *
41 * This is the basic API for a transport module which is registered by the 46 * This is the basic API for a transport module which is registered by the
42 * transport module with the 9P core network module and used by the client 47 * transport module with the 9P core network module and used by the client
@@ -55,6 +60,7 @@ struct p9_trans_module {
55 void (*close) (struct p9_client *); 60 void (*close) (struct p9_client *);
56 int (*request) (struct p9_client *, struct p9_req_t *req); 61 int (*request) (struct p9_client *, struct p9_req_t *req);
57 int (*cancel) (struct p9_client *, struct p9_req_t *req); 62 int (*cancel) (struct p9_client *, struct p9_req_t *req);
63 int (*cancelled)(struct p9_client *, struct p9_req_t *req);
58 int (*zc_request)(struct p9_client *, struct p9_req_t *, 64 int (*zc_request)(struct p9_client *, struct p9_req_t *,
59 char *, char *, int , int, int, int); 65 char *, char *, int , int, int, int);
60}; 66};
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 06ef7e926a66..b8ffac7b6bab 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -18,7 +18,7 @@ struct tcf_common {
18 struct tcf_t tcfc_tm; 18 struct tcf_t tcfc_tm;
19 struct gnet_stats_basic_packed tcfc_bstats; 19 struct gnet_stats_basic_packed tcfc_bstats;
20 struct gnet_stats_queue tcfc_qstats; 20 struct gnet_stats_queue tcfc_qstats;
21 struct gnet_stats_rate_est tcfc_rate_est; 21 struct gnet_stats_rate_est64 tcfc_rate_est;
22 spinlock_t tcfc_lock; 22 spinlock_t tcfc_lock;
23 struct rcu_head tcfc_rcu; 23 struct rcu_head tcfc_rcu;
24}; 24};
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 21f702704f24..c7b181cb47a6 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -86,6 +86,9 @@ extern int ipv6_dev_get_saddr(struct net *net,
86 const struct in6_addr *daddr, 86 const struct in6_addr *daddr,
87 unsigned int srcprefs, 87 unsigned int srcprefs,
88 struct in6_addr *saddr); 88 struct in6_addr *saddr);
89extern int __ipv6_get_lladdr(struct inet6_dev *idev,
90 struct in6_addr *addr,
91 unsigned char banned_flags);
89extern int ipv6_get_lladdr(struct net_device *dev, 92extern int ipv6_get_lladdr(struct net_device *dev,
90 struct in6_addr *addr, 93 struct in6_addr *addr,
91 unsigned char banned_flags); 94 unsigned char banned_flags);
@@ -155,6 +158,7 @@ extern bool ipv6_chk_mcast_addr(struct net_device *dev,
155 const struct in6_addr *group, 158 const struct in6_addr *group,
156 const struct in6_addr *src_addr); 159 const struct in6_addr *src_addr);
157 160
161extern void ipv6_mc_dad_complete(struct inet6_dev *idev);
158/* 162/*
159 * identify MLD packets for MLD filter exceptions 163 * identify MLD packets for MLD filter exceptions
160 */ 164 */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index e0512aaef4b8..3c592cf473da 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -107,7 +107,6 @@ enum {
107 HCI_MGMT, 107 HCI_MGMT,
108 HCI_PAIRABLE, 108 HCI_PAIRABLE,
109 HCI_SERVICE_CACHE, 109 HCI_SERVICE_CACHE,
110 HCI_LINK_KEYS,
111 HCI_DEBUG_KEYS, 110 HCI_DEBUG_KEYS,
112 HCI_UNREGISTER, 111 HCI_UNREGISTER,
113 112
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 7cb6d360d147..f77885ea78c2 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -117,13 +117,6 @@ struct oob_data {
117 u8 randomizer[16]; 117 u8 randomizer[16];
118}; 118};
119 119
120struct le_scan_params {
121 u8 type;
122 u16 interval;
123 u16 window;
124 int timeout;
125};
126
127#define HCI_MAX_SHORT_NAME_LENGTH 10 120#define HCI_MAX_SHORT_NAME_LENGTH 10
128 121
129struct amp_assoc { 122struct amp_assoc {
@@ -283,9 +276,6 @@ struct hci_dev {
283 276
284 struct delayed_work le_scan_disable; 277 struct delayed_work le_scan_disable;
285 278
286 struct work_struct le_scan;
287 struct le_scan_params le_scan_params;
288
289 __s8 adv_tx_power; 279 __s8 adv_tx_power;
290 __u8 adv_data[HCI_MAX_AD_LENGTH]; 280 __u8 adv_data[HCI_MAX_AD_LENGTH];
291 __u8 adv_data_len; 281 __u8 adv_data_len;
@@ -432,6 +422,7 @@ void hci_inquiry_cache_update_resolve(struct hci_dev *hdev,
432 struct inquiry_entry *ie); 422 struct inquiry_entry *ie);
433bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, 423bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
434 bool name_known, bool *ssp); 424 bool name_known, bool *ssp);
425void hci_inquiry_cache_flush(struct hci_dev *hdev);
435 426
436/* ----- HCI Connections ----- */ 427/* ----- HCI Connections ----- */
437enum { 428enum {
@@ -1114,6 +1105,16 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
1114 BIT(BDADDR_LE_PUBLIC) | \ 1105 BIT(BDADDR_LE_PUBLIC) | \
1115 BIT(BDADDR_LE_RANDOM)) 1106 BIT(BDADDR_LE_RANDOM))
1116 1107
1108/* These LE scan and inquiry parameters were chosen according to LE General
1109 * Discovery Procedure specification.
1110 */
1111#define DISCOV_LE_SCAN_WIN 0x12
1112#define DISCOV_LE_SCAN_INT 0x12
1113#define DISCOV_LE_TIMEOUT msecs_to_jiffies(10240)
1114#define DISCOV_INTERLEAVED_TIMEOUT msecs_to_jiffies(5120)
1115#define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04
1116#define DISCOV_BREDR_INQUIRY_LEN 0x08
1117
1117int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 1118int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
1118int mgmt_index_added(struct hci_dev *hdev); 1119int mgmt_index_added(struct hci_dev *hdev);
1119int mgmt_index_removed(struct hci_dev *hdev); 1120int mgmt_index_removed(struct hci_dev *hdev);
@@ -1169,10 +1170,7 @@ int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1169 u8 ssp, u8 *eir, u16 eir_len); 1170 u8 ssp, u8 *eir, u16 eir_len);
1170int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1171int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1171 u8 addr_type, s8 rssi, u8 *name, u8 name_len); 1172 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
1172int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status);
1173int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status);
1174int mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1173int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1175int mgmt_interleaved_discovery(struct hci_dev *hdev);
1176int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1174int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1177int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1175int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1178bool mgmt_valid_hdev(struct hci_dev *hdev); 1176bool mgmt_valid_hdev(struct hci_dev *hdev);
@@ -1212,11 +1210,6 @@ void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
1212 u16 latency, u16 to_multiplier); 1210 u16 latency, u16 to_multiplier);
1213void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], 1211void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
1214 __u8 ltk[16]); 1212 __u8 ltk[16]);
1215int hci_do_inquiry(struct hci_dev *hdev, u8 length);
1216int hci_cancel_inquiry(struct hci_dev *hdev);
1217int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
1218 int timeout);
1219int hci_cancel_le_scan(struct hci_dev *hdev);
1220 1213
1221u8 bdaddr_to_le(u8 bdaddr_type); 1214u8 bdaddr_to_le(u8 bdaddr_type);
1222 1215
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index fb94cf13c777..1a966afbbfa8 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -242,7 +242,7 @@ struct l2cap_conn_rsp {
242#define L2CAP_CID_SIGNALING 0x0001 242#define L2CAP_CID_SIGNALING 0x0001
243#define L2CAP_CID_CONN_LESS 0x0002 243#define L2CAP_CID_CONN_LESS 0x0002
244#define L2CAP_CID_A2MP 0x0003 244#define L2CAP_CID_A2MP 0x0003
245#define L2CAP_CID_LE_DATA 0x0004 245#define L2CAP_CID_ATT 0x0004
246#define L2CAP_CID_LE_SIGNALING 0x0005 246#define L2CAP_CID_LE_SIGNALING 0x0005
247#define L2CAP_CID_SMP 0x0006 247#define L2CAP_CID_SMP 0x0006
248#define L2CAP_CID_DYN_START 0x0040 248#define L2CAP_CID_DYN_START 0x0040
diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h
new file mode 100644
index 000000000000..f18b91966d3d
--- /dev/null
+++ b/include/net/busy_poll.h
@@ -0,0 +1,190 @@
1/*
2 * net busy poll support
3 * Copyright(c) 2013 Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope 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.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Author: Eliezer Tamir
19 *
20 * Contact Information:
21 * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
22 */
23
24#ifndef _LINUX_NET_BUSY_POLL_H
25#define _LINUX_NET_BUSY_POLL_H
26
27#include <linux/netdevice.h>
28#include <net/ip.h>
29
30#ifdef CONFIG_NET_RX_BUSY_POLL
31
32struct napi_struct;
33extern unsigned int sysctl_net_busy_read __read_mostly;
34extern unsigned int sysctl_net_busy_poll __read_mostly;
35
36/* return values from ndo_ll_poll */
37#define LL_FLUSH_FAILED -1
38#define LL_FLUSH_BUSY -2
39
40static inline bool net_busy_loop_on(void)
41{
42 return sysctl_net_busy_poll;
43}
44
45/* a wrapper to make debug_smp_processor_id() happy
46 * we can use sched_clock() because we don't care much about precision
47 * we only care that the average is bounded
48 */
49#ifdef CONFIG_DEBUG_PREEMPT
50static inline u64 busy_loop_us_clock(void)
51{
52 u64 rc;
53
54 preempt_disable_notrace();
55 rc = sched_clock();
56 preempt_enable_no_resched_notrace();
57
58 return rc >> 10;
59}
60#else /* CONFIG_DEBUG_PREEMPT */
61static inline u64 busy_loop_us_clock(void)
62{
63 return sched_clock() >> 10;
64}
65#endif /* CONFIG_DEBUG_PREEMPT */
66
67static inline unsigned long sk_busy_loop_end_time(struct sock *sk)
68{
69 return busy_loop_us_clock() + ACCESS_ONCE(sk->sk_ll_usec);
70}
71
72/* in poll/select we use the global sysctl_net_ll_poll value */
73static inline unsigned long busy_loop_end_time(void)
74{
75 return busy_loop_us_clock() + ACCESS_ONCE(sysctl_net_busy_poll);
76}
77
78static inline bool sk_can_busy_loop(struct sock *sk)
79{
80 return sk->sk_ll_usec && sk->sk_napi_id &&
81 !need_resched() && !signal_pending(current);
82}
83
84
85static inline bool busy_loop_timeout(unsigned long end_time)
86{
87 unsigned long now = busy_loop_us_clock();
88
89 return time_after(now, end_time);
90}
91
92/* when used in sock_poll() nonblock is known at compile time to be true
93 * so the loop and end_time will be optimized out
94 */
95static inline bool sk_busy_loop(struct sock *sk, int nonblock)
96{
97 unsigned long end_time = !nonblock ? sk_busy_loop_end_time(sk) : 0;
98 const struct net_device_ops *ops;
99 struct napi_struct *napi;
100 int rc = false;
101
102 /*
103 * rcu read lock for napi hash
104 * bh so we don't race with net_rx_action
105 */
106 rcu_read_lock_bh();
107
108 napi = napi_by_id(sk->sk_napi_id);
109 if (!napi)
110 goto out;
111
112 ops = napi->dev->netdev_ops;
113 if (!ops->ndo_busy_poll)
114 goto out;
115
116 do {
117 rc = ops->ndo_busy_poll(napi);
118
119 if (rc == LL_FLUSH_FAILED)
120 break; /* permanent failure */
121
122 if (rc > 0)
123 /* local bh are disabled so it is ok to use _BH */
124 NET_ADD_STATS_BH(sock_net(sk),
125 LINUX_MIB_LOWLATENCYRXPACKETS, rc);
126
127 } while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) &&
128 !need_resched() && !busy_loop_timeout(end_time));
129
130 rc = !skb_queue_empty(&sk->sk_receive_queue);
131out:
132 rcu_read_unlock_bh();
133 return rc;
134}
135
136/* used in the NIC receive handler to mark the skb */
137static inline void skb_mark_napi_id(struct sk_buff *skb,
138 struct napi_struct *napi)
139{
140 skb->napi_id = napi->napi_id;
141}
142
143/* used in the protocol hanlder to propagate the napi_id to the socket */
144static inline void sk_mark_napi_id(struct sock *sk, struct sk_buff *skb)
145{
146 sk->sk_napi_id = skb->napi_id;
147}
148
149#else /* CONFIG_NET_RX_BUSY_POLL */
150static inline unsigned long net_busy_loop_on(void)
151{
152 return 0;
153}
154
155static inline unsigned long busy_loop_end_time(void)
156{
157 return 0;
158}
159
160static inline bool sk_can_busy_loop(struct sock *sk)
161{
162 return false;
163}
164
165static inline bool sk_busy_poll(struct sock *sk, int nonblock)
166{
167 return false;
168}
169
170static inline void skb_mark_napi_id(struct sk_buff *skb,
171 struct napi_struct *napi)
172{
173}
174
175static inline void sk_mark_napi_id(struct sock *sk, struct sk_buff *skb)
176{
177}
178
179static inline bool busy_loop_timeout(unsigned long end_time)
180{
181 return true;
182}
183
184static inline bool sk_busy_loop(struct sock *sk, int nonblock)
185{
186 return false;
187}
188
189#endif /* CONFIG_NET_RX_BUSY_POLL */
190#endif /* _LINUX_NET_BUSY_POLL_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 26b5b692c22b..7b0730aeb892 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -188,6 +188,8 @@ struct ieee80211_channel {
188 * when used with 802.11g (on the 2.4 GHz band); filled by the 188 * when used with 802.11g (on the 2.4 GHz band); filled by the
189 * core code when registering the wiphy. 189 * core code when registering the wiphy.
190 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 190 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
191 * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
192 * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
191 */ 193 */
192enum ieee80211_rate_flags { 194enum ieee80211_rate_flags {
193 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 195 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
@@ -195,6 +197,8 @@ enum ieee80211_rate_flags {
195 IEEE80211_RATE_MANDATORY_B = 1<<2, 197 IEEE80211_RATE_MANDATORY_B = 1<<2,
196 IEEE80211_RATE_MANDATORY_G = 1<<3, 198 IEEE80211_RATE_MANDATORY_G = 1<<3,
197 IEEE80211_RATE_ERP_G = 1<<4, 199 IEEE80211_RATE_ERP_G = 1<<4,
200 IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5,
201 IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6,
198}; 202};
199 203
200/** 204/**
@@ -433,6 +437,30 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
433 u32 prohibited_flags); 437 u32 prohibited_flags);
434 438
435/** 439/**
440 * ieee80211_chandef_rate_flags - returns rate flags for a channel
441 *
442 * In some channel types, not all rates may be used - for example CCK
443 * rates may not be used in 5/10 MHz channels.
444 *
445 * @chandef: channel definition for the channel
446 *
447 * Returns: rate flags which apply for this channel
448 */
449static inline enum ieee80211_rate_flags
450ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
451{
452 switch (chandef->width) {
453 case NL80211_CHAN_WIDTH_5:
454 return IEEE80211_RATE_SUPPORTS_5MHZ;
455 case NL80211_CHAN_WIDTH_10:
456 return IEEE80211_RATE_SUPPORTS_10MHZ;
457 default:
458 break;
459 }
460 return 0;
461}
462
463/**
436 * enum survey_info_flags - survey information flags 464 * enum survey_info_flags - survey information flags
437 * 465 *
438 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in 466 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
@@ -753,6 +781,8 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
753 * @STATION_INFO_LOCAL_PM: @local_pm filled 781 * @STATION_INFO_LOCAL_PM: @local_pm filled
754 * @STATION_INFO_PEER_PM: @peer_pm filled 782 * @STATION_INFO_PEER_PM: @peer_pm filled
755 * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled 783 * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled
784 * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled
785 * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled
756 */ 786 */
757enum station_info_flags { 787enum station_info_flags {
758 STATION_INFO_INACTIVE_TIME = 1<<0, 788 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -781,6 +811,8 @@ enum station_info_flags {
781 STATION_INFO_NONPEER_PM = 1<<23, 811 STATION_INFO_NONPEER_PM = 1<<23,
782 STATION_INFO_RX_BYTES64 = 1<<24, 812 STATION_INFO_RX_BYTES64 = 1<<24,
783 STATION_INFO_TX_BYTES64 = 1<<25, 813 STATION_INFO_TX_BYTES64 = 1<<25,
814 STATION_INFO_CHAIN_SIGNAL = 1<<26,
815 STATION_INFO_CHAIN_SIGNAL_AVG = 1<<27,
784}; 816};
785 817
786/** 818/**
@@ -857,6 +889,8 @@ struct sta_bss_parameters {
857 u16 beacon_interval; 889 u16 beacon_interval;
858}; 890};
859 891
892#define IEEE80211_MAX_CHAINS 4
893
860/** 894/**
861 * struct station_info - station information 895 * struct station_info - station information
862 * 896 *
@@ -874,6 +908,9 @@ struct sta_bss_parameters {
874 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 908 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
875 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type. 909 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
876 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. 910 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
911 * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
912 * @chain_signal: per-chain signal strength of last received packet in dBm
913 * @chain_signal_avg: per-chain signal strength average in dBm
877 * @txrate: current unicast bitrate from this station 914 * @txrate: current unicast bitrate from this station
878 * @rxrate: current unicast bitrate to this station 915 * @rxrate: current unicast bitrate to this station
879 * @rx_packets: packets received from this station 916 * @rx_packets: packets received from this station
@@ -909,6 +946,11 @@ struct station_info {
909 u8 plink_state; 946 u8 plink_state;
910 s8 signal; 947 s8 signal;
911 s8 signal_avg; 948 s8 signal_avg;
949
950 u8 chains;
951 s8 chain_signal[IEEE80211_MAX_CHAINS];
952 s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
953
912 struct rate_info txrate; 954 struct rate_info txrate;
913 struct rate_info rxrate; 955 struct rate_info rxrate;
914 u32 rx_packets; 956 u32 rx_packets;
@@ -947,6 +989,7 @@ struct station_info {
947 * @MONITOR_FLAG_CONTROL: pass control frames 989 * @MONITOR_FLAG_CONTROL: pass control frames
948 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 990 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
949 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 991 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
992 * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
950 */ 993 */
951enum monitor_flags { 994enum monitor_flags {
952 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 995 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
@@ -954,6 +997,7 @@ enum monitor_flags {
954 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 997 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
955 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 998 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
956 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 999 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1000 MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE,
957}; 1001};
958 1002
959/** 1003/**
@@ -1108,6 +1152,9 @@ struct bss_parameters {
1108 * setting for new peer links. 1152 * setting for new peer links.
1109 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake 1153 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
1110 * after transmitting its beacon. 1154 * after transmitting its beacon.
1155 * @plink_timeout: If no tx activity is seen from a STA we've established
1156 * peering with for longer than this time (in seconds), then remove it
1157 * from the STA's list of peers. Default is 30 minutes.
1111 */ 1158 */
1112struct mesh_config { 1159struct mesh_config {
1113 u16 dot11MeshRetryTimeout; 1160 u16 dot11MeshRetryTimeout;
@@ -1137,6 +1184,7 @@ struct mesh_config {
1137 u16 dot11MeshHWMPconfirmationInterval; 1184 u16 dot11MeshHWMPconfirmationInterval;
1138 enum nl80211_mesh_power_mode power_mode; 1185 enum nl80211_mesh_power_mode power_mode;
1139 u16 dot11MeshAwakeWindowDuration; 1186 u16 dot11MeshAwakeWindowDuration;
1187 u32 plink_timeout;
1140}; 1188};
1141 1189
1142/** 1190/**
@@ -1147,6 +1195,7 @@ struct mesh_config {
1147 * @sync_method: which synchronization method to use 1195 * @sync_method: which synchronization method to use
1148 * @path_sel_proto: which path selection protocol to use 1196 * @path_sel_proto: which path selection protocol to use
1149 * @path_metric: which metric to use 1197 * @path_metric: which metric to use
1198 * @auth_id: which authentication method this mesh is using
1150 * @ie: vendor information elements (optional) 1199 * @ie: vendor information elements (optional)
1151 * @ie_len: length of vendor information elements 1200 * @ie_len: length of vendor information elements
1152 * @is_authenticated: this mesh requires authentication 1201 * @is_authenticated: this mesh requires authentication
@@ -1155,6 +1204,7 @@ struct mesh_config {
1155 * @dtim_period: DTIM period to use 1204 * @dtim_period: DTIM period to use
1156 * @beacon_interval: beacon interval to use 1205 * @beacon_interval: beacon interval to use
1157 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] 1206 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1207 * @basic_rates: basic rates to use when creating the mesh
1158 * 1208 *
1159 * These parameters are fixed when the mesh is created. 1209 * These parameters are fixed when the mesh is created.
1160 */ 1210 */
@@ -1165,6 +1215,7 @@ struct mesh_setup {
1165 u8 sync_method; 1215 u8 sync_method;
1166 u8 path_sel_proto; 1216 u8 path_sel_proto;
1167 u8 path_metric; 1217 u8 path_metric;
1218 u8 auth_id;
1168 const u8 *ie; 1219 const u8 *ie;
1169 u8 ie_len; 1220 u8 ie_len;
1170 bool is_authenticated; 1221 bool is_authenticated;
@@ -1173,6 +1224,7 @@ struct mesh_setup {
1173 u8 dtim_period; 1224 u8 dtim_period;
1174 u16 beacon_interval; 1225 u16 beacon_interval;
1175 int mcast_rate[IEEE80211_NUM_BANDS]; 1226 int mcast_rate[IEEE80211_NUM_BANDS];
1227 u32 basic_rates;
1176}; 1228};
1177 1229
1178/** 1230/**
@@ -1241,6 +1293,7 @@ struct cfg80211_ssid {
1241 * @scan_start: time (in jiffies) when the scan started 1293 * @scan_start: time (in jiffies) when the scan started
1242 * @wdev: the wireless device to scan for 1294 * @wdev: the wireless device to scan for
1243 * @aborted: (internal) scan request was notified as aborted 1295 * @aborted: (internal) scan request was notified as aborted
1296 * @notified: (internal) scan request was notified as done or aborted
1244 * @no_cck: used to send probe requests at non CCK rate in 2GHz band 1297 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
1245 */ 1298 */
1246struct cfg80211_scan_request { 1299struct cfg80211_scan_request {
@@ -1258,7 +1311,7 @@ struct cfg80211_scan_request {
1258 /* internal */ 1311 /* internal */
1259 struct wiphy *wiphy; 1312 struct wiphy *wiphy;
1260 unsigned long scan_start; 1313 unsigned long scan_start;
1261 bool aborted; 1314 bool aborted, notified;
1262 bool no_cck; 1315 bool no_cck;
1263 1316
1264 /* keep last */ 1317 /* keep last */
@@ -1406,7 +1459,8 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1406 * This structure provides information needed to complete IEEE 802.11 1459 * This structure provides information needed to complete IEEE 802.11
1407 * authentication. 1460 * authentication.
1408 * 1461 *
1409 * @bss: The BSS to authenticate with. 1462 * @bss: The BSS to authenticate with, the callee must obtain a reference
1463 * to it if it needs to keep it.
1410 * @auth_type: Authentication type (algorithm) 1464 * @auth_type: Authentication type (algorithm)
1411 * @ie: Extra IEs to add to Authentication frame or %NULL 1465 * @ie: Extra IEs to add to Authentication frame or %NULL
1412 * @ie_len: Length of ie buffer in octets 1466 * @ie_len: Length of ie buffer in octets
@@ -1444,11 +1498,10 @@ enum cfg80211_assoc_req_flags {
1444 * 1498 *
1445 * This structure provides information needed to complete IEEE 802.11 1499 * This structure provides information needed to complete IEEE 802.11
1446 * (re)association. 1500 * (re)association.
1447 * @bss: The BSS to associate with. If the call is successful the driver 1501 * @bss: The BSS to associate with. If the call is successful the driver is
1448 * is given a reference that it must release, normally via a call to 1502 * given a reference that it must give back to cfg80211_send_rx_assoc()
1449 * cfg80211_send_rx_assoc(), or, if association timed out, with a 1503 * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
1450 * call to cfg80211_put_bss() (in addition to calling 1504 * association requests while already associating must be rejected.
1451 * cfg80211_send_assoc_timeout())
1452 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1505 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1453 * @ie_len: Length of ie buffer in octets 1506 * @ie_len: Length of ie buffer in octets
1454 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1507 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
@@ -1850,7 +1903,9 @@ struct cfg80211_update_ft_ies_params {
1850 * @get_mpath: get a mesh path for the given parameters 1903 * @get_mpath: get a mesh path for the given parameters
1851 * @dump_mpath: dump mesh path callback -- resume dump at index @idx 1904 * @dump_mpath: dump mesh path callback -- resume dump at index @idx
1852 * @join_mesh: join the mesh network with the specified parameters 1905 * @join_mesh: join the mesh network with the specified parameters
1906 * (invoked with the wireless_dev mutex held)
1853 * @leave_mesh: leave the current mesh network 1907 * @leave_mesh: leave the current mesh network
1908 * (invoked with the wireless_dev mutex held)
1854 * 1909 *
1855 * @get_mesh_config: Get the current mesh configuration 1910 * @get_mesh_config: Get the current mesh configuration
1856 * 1911 *
@@ -1877,20 +1932,28 @@ struct cfg80211_update_ft_ies_params {
1877 * the scan/scan_done bracket too. 1932 * the scan/scan_done bracket too.
1878 * 1933 *
1879 * @auth: Request to authenticate with the specified peer 1934 * @auth: Request to authenticate with the specified peer
1935 * (invoked with the wireless_dev mutex held)
1880 * @assoc: Request to (re)associate with the specified peer 1936 * @assoc: Request to (re)associate with the specified peer
1937 * (invoked with the wireless_dev mutex held)
1881 * @deauth: Request to deauthenticate from the specified peer 1938 * @deauth: Request to deauthenticate from the specified peer
1939 * (invoked with the wireless_dev mutex held)
1882 * @disassoc: Request to disassociate from the specified peer 1940 * @disassoc: Request to disassociate from the specified peer
1941 * (invoked with the wireless_dev mutex held)
1883 * 1942 *
1884 * @connect: Connect to the ESS with the specified parameters. When connected, 1943 * @connect: Connect to the ESS with the specified parameters. When connected,
1885 * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. 1944 * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
1886 * If the connection fails for some reason, call cfg80211_connect_result() 1945 * If the connection fails for some reason, call cfg80211_connect_result()
1887 * with the status from the AP. 1946 * with the status from the AP.
1947 * (invoked with the wireless_dev mutex held)
1888 * @disconnect: Disconnect from the BSS/ESS. 1948 * @disconnect: Disconnect from the BSS/ESS.
1949 * (invoked with the wireless_dev mutex held)
1889 * 1950 *
1890 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 1951 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
1891 * cfg80211_ibss_joined(), also call that function when changing BSSID due 1952 * cfg80211_ibss_joined(), also call that function when changing BSSID due
1892 * to a merge. 1953 * to a merge.
1954 * (invoked with the wireless_dev mutex held)
1893 * @leave_ibss: Leave the IBSS. 1955 * @leave_ibss: Leave the IBSS.
1956 * (invoked with the wireless_dev mutex held)
1894 * 1957 *
1895 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or 1958 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
1896 * MESH mode) 1959 * MESH mode)
@@ -2307,6 +2370,7 @@ struct cfg80211_ops {
2307 * responds to probe-requests in hardware. 2370 * responds to probe-requests in hardware.
2308 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. 2371 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
2309 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. 2372 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
2373 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
2310 */ 2374 */
2311enum wiphy_flags { 2375enum wiphy_flags {
2312 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), 2376 WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0),
@@ -2330,6 +2394,7 @@ enum wiphy_flags {
2330 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), 2394 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
2331 WIPHY_FLAG_OFFCHAN_TX = BIT(20), 2395 WIPHY_FLAG_OFFCHAN_TX = BIT(20),
2332 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), 2396 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
2397 WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
2333}; 2398};
2334 2399
2335/** 2400/**
@@ -2556,6 +2621,9 @@ struct wiphy_wowlan_support {
2556 * may request, if implemented. 2621 * may request, if implemented.
2557 * 2622 *
2558 * @wowlan: WoWLAN support information 2623 * @wowlan: WoWLAN support information
2624 * @wowlan_config: current WoWLAN configuration; this should usually not be
2625 * used since access to it is necessarily racy, use the parameter passed
2626 * to the suspend() operation instead.
2559 * 2627 *
2560 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. 2628 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
2561 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. 2629 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
@@ -2622,7 +2690,8 @@ struct wiphy {
2622 u32 hw_version; 2690 u32 hw_version;
2623 2691
2624#ifdef CONFIG_PM 2692#ifdef CONFIG_PM
2625 struct wiphy_wowlan_support wowlan; 2693 const struct wiphy_wowlan_support *wowlan;
2694 struct cfg80211_wowlan *wowlan_config;
2626#endif 2695#endif
2627 2696
2628 u16 max_remain_on_channel_duration; 2697 u16 max_remain_on_channel_duration;
@@ -2820,7 +2889,7 @@ struct cfg80211_cached_keys;
2820 * @current_bss: (private) Used by the internal configuration code 2889 * @current_bss: (private) Used by the internal configuration code
2821 * @channel: (private) Used by the internal configuration code to track 2890 * @channel: (private) Used by the internal configuration code to track
2822 * the user-set AP, monitor and WDS channel 2891 * the user-set AP, monitor and WDS channel
2823 * @preset_chan: (private) Used by the internal configuration code to 2892 * @preset_chandef: (private) Used by the internal configuration code to
2824 * track the channel to be used for AP later 2893 * track the channel to be used for AP later
2825 * @bssid: (private) Used by the internal configuration code 2894 * @bssid: (private) Used by the internal configuration code
2826 * @ssid: (private) Used by the internal configuration code 2895 * @ssid: (private) Used by the internal configuration code
@@ -2834,14 +2903,23 @@ struct cfg80211_cached_keys;
2834 * by cfg80211 on change_interface 2903 * by cfg80211 on change_interface
2835 * @mgmt_registrations: list of registrations for management frames 2904 * @mgmt_registrations: list of registrations for management frames
2836 * @mgmt_registrations_lock: lock for the list 2905 * @mgmt_registrations_lock: lock for the list
2837 * @mtx: mutex used to lock data in this struct 2906 * @mtx: mutex used to lock data in this struct, may be used by drivers
2838 * @cleanup_work: work struct used for cleanup that can't be done directly 2907 * and some API functions require it held
2839 * @beacon_interval: beacon interval used on this device for transmitting 2908 * @beacon_interval: beacon interval used on this device for transmitting
2840 * beacons, 0 when not valid 2909 * beacons, 0 when not valid
2841 * @address: The address for this device, valid only if @netdev is %NULL 2910 * @address: The address for this device, valid only if @netdev is %NULL
2842 * @p2p_started: true if this is a P2P Device that has been started 2911 * @p2p_started: true if this is a P2P Device that has been started
2843 * @cac_started: true if DFS channel availability check has been started 2912 * @cac_started: true if DFS channel availability check has been started
2844 * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 2913 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
2914 * @ps: powersave mode is enabled
2915 * @ps_timeout: dynamic powersave timeout
2916 * @ap_unexpected_nlportid: (private) netlink port ID of application
2917 * registered for unexpected class 3 frames (AP mode)
2918 * @conn: (private) cfg80211 software SME connection state machine data
2919 * @connect_keys: (private) keys to set after connection is established
2920 * @ibss_fixed: (private) IBSS is using fixed BSSID
2921 * @event_list: (private) list for internal event processing
2922 * @event_lock: (private) lock for event list
2845 */ 2923 */
2846struct wireless_dev { 2924struct wireless_dev {
2847 struct wiphy *wiphy; 2925 struct wiphy *wiphy;
@@ -2858,8 +2936,6 @@ struct wireless_dev {
2858 2936
2859 struct mutex mtx; 2937 struct mutex mtx;
2860 2938
2861 struct work_struct cleanup_work;
2862
2863 bool use_4addr, p2p_started; 2939 bool use_4addr, p2p_started;
2864 2940
2865 u8 address[ETH_ALEN] __aligned(sizeof(u16)); 2941 u8 address[ETH_ALEN] __aligned(sizeof(u16));
@@ -2867,11 +2943,6 @@ struct wireless_dev {
2867 /* currently used for IBSS and SME - might be rearranged later */ 2943 /* currently used for IBSS and SME - might be rearranged later */
2868 u8 ssid[IEEE80211_MAX_SSID_LEN]; 2944 u8 ssid[IEEE80211_MAX_SSID_LEN];
2869 u8 ssid_len, mesh_id_len, mesh_id_up_len; 2945 u8 ssid_len, mesh_id_len, mesh_id_up_len;
2870 enum {
2871 CFG80211_SME_IDLE,
2872 CFG80211_SME_CONNECTING,
2873 CFG80211_SME_CONNECTED,
2874 } sme_state;
2875 struct cfg80211_conn *conn; 2946 struct cfg80211_conn *conn;
2876 struct cfg80211_cached_keys *connect_keys; 2947 struct cfg80211_cached_keys *connect_keys;
2877 2948
@@ -2989,6 +3060,15 @@ struct ieee80211_rate *
2989ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 3060ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
2990 u32 basic_rates, int bitrate); 3061 u32 basic_rates, int bitrate);
2991 3062
3063/**
3064 * ieee80211_mandatory_rates - get mandatory rates for a given band
3065 * @sband: the band to look for rates in
3066 *
3067 * This function returns a bitmap of the mandatory rates for the given
3068 * band, bits are set according to the rate position in the bitrates array.
3069 */
3070u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband);
3071
2992/* 3072/*
2993 * Radiotap parsing functions -- for controlled injection support 3073 * Radiotap parsing functions -- for controlled injection support
2994 * 3074 *
@@ -3392,122 +3472,87 @@ void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
3392void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 3472void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
3393 3473
3394/** 3474/**
3395 * cfg80211_send_rx_auth - notification of processed authentication 3475 * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
3396 * @dev: network device 3476 * @dev: network device
3397 * @buf: authentication frame (header + body) 3477 * @buf: authentication frame (header + body)
3398 * @len: length of the frame data 3478 * @len: length of the frame data
3399 * 3479 *
3400 * This function is called whenever an authentication has been processed in 3480 * This function is called whenever an authentication, disassociation or
3401 * station mode. The driver is required to call either this function or 3481 * deauthentication frame has been received and processed in station mode.
3402 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() 3482 * After being asked to authenticate via cfg80211_ops::auth() the driver must
3403 * call. This function may sleep. 3483 * call either this function or cfg80211_auth_timeout().
3484 * After being asked to associate via cfg80211_ops::assoc() the driver must
3485 * call either this function or cfg80211_auth_timeout().
3486 * While connected, the driver must calls this for received and processed
3487 * disassociation and deauthentication frames. If the frame couldn't be used
3488 * because it was unprotected, the driver must call the function
3489 * cfg80211_rx_unprot_mlme_mgmt() instead.
3490 *
3491 * This function may sleep. The caller must hold the corresponding wdev's mutex.
3404 */ 3492 */
3405void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 3493void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
3406 3494
3407/** 3495/**
3408 * cfg80211_send_auth_timeout - notification of timed out authentication 3496 * cfg80211_auth_timeout - notification of timed out authentication
3409 * @dev: network device 3497 * @dev: network device
3410 * @addr: The MAC address of the device with which the authentication timed out 3498 * @addr: The MAC address of the device with which the authentication timed out
3411 * 3499 *
3412 * This function may sleep. 3500 * This function may sleep. The caller must hold the corresponding wdev's
3501 * mutex.
3413 */ 3502 */
3414void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 3503void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
3415 3504
3416/** 3505/**
3417 * cfg80211_send_rx_assoc - notification of processed association 3506 * cfg80211_rx_assoc_resp - notification of processed association response
3418 * @dev: network device 3507 * @dev: network device
3419 * @bss: the BSS struct association was requested for, the struct reference 3508 * @bss: the BSS that association was requested with, ownership of the pointer
3420 * is owned by cfg80211 after this call 3509 * moves to cfg80211 in this call
3421 * @buf: (re)association response frame (header + body) 3510 * @buf: authentication frame (header + body)
3422 * @len: length of the frame data 3511 * @len: length of the frame data
3423 * 3512 *
3424 * This function is called whenever a (re)association response has been 3513 * After being asked to associate via cfg80211_ops::assoc() the driver must
3425 * processed in station mode. The driver is required to call either this 3514 * call either this function or cfg80211_auth_timeout().
3426 * function or cfg80211_send_assoc_timeout() to indicate the result of 3515 *
3427 * cfg80211_ops::assoc() call. This function may sleep. 3516 * This function may sleep. The caller must hold the corresponding wdev's mutex.
3428 */ 3517 */
3429void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss, 3518void cfg80211_rx_assoc_resp(struct net_device *dev,
3519 struct cfg80211_bss *bss,
3430 const u8 *buf, size_t len); 3520 const u8 *buf, size_t len);
3431 3521
3432/** 3522/**
3433 * cfg80211_send_assoc_timeout - notification of timed out association 3523 * cfg80211_assoc_timeout - notification of timed out association
3434 * @dev: network device 3524 * @dev: network device
3435 * @addr: The MAC address of the device with which the association timed out 3525 * @bss: The BSS entry with which association timed out.
3436 * 3526 *
3437 * This function may sleep. 3527 * This function may sleep. The caller must hold the corresponding wdev's mutex.
3438 */ 3528 */
3439void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); 3529void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
3440 3530
3441/** 3531/**
3442 * cfg80211_send_deauth - notification of processed deauthentication 3532 * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
3443 * @dev: network device 3533 * @dev: network device
3444 * @buf: deauthentication frame (header + body) 3534 * @buf: 802.11 frame (header + body)
3445 * @len: length of the frame data 3535 * @len: length of the frame data
3446 * 3536 *
3447 * This function is called whenever deauthentication has been processed in 3537 * This function is called whenever deauthentication has been processed in
3448 * station mode. This includes both received deauthentication frames and 3538 * station mode. This includes both received deauthentication frames and
3449 * locally generated ones. This function may sleep. 3539 * locally generated ones. This function may sleep. The caller must hold the
3450 */ 3540 * corresponding wdev's mutex.
3451void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
3452
3453/**
3454 * __cfg80211_send_deauth - notification of processed deauthentication
3455 * @dev: network device
3456 * @buf: deauthentication frame (header + body)
3457 * @len: length of the frame data
3458 *
3459 * Like cfg80211_send_deauth(), but doesn't take the wdev lock.
3460 */
3461void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
3462
3463/**
3464 * cfg80211_send_disassoc - notification of processed disassociation
3465 * @dev: network device
3466 * @buf: disassociation response frame (header + body)
3467 * @len: length of the frame data
3468 *
3469 * This function is called whenever disassociation has been processed in
3470 * station mode. This includes both received disassociation frames and locally
3471 * generated ones. This function may sleep.
3472 */
3473void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
3474
3475/**
3476 * __cfg80211_send_disassoc - notification of processed disassociation
3477 * @dev: network device
3478 * @buf: disassociation response frame (header + body)
3479 * @len: length of the frame data
3480 *
3481 * Like cfg80211_send_disassoc(), but doesn't take the wdev lock.
3482 */ 3541 */
3483void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, 3542void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
3484 size_t len);
3485 3543
3486/** 3544/**
3487 * cfg80211_send_unprot_deauth - notification of unprotected deauthentication 3545 * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
3488 * @dev: network device 3546 * @dev: network device
3489 * @buf: deauthentication frame (header + body) 3547 * @buf: deauthentication frame (header + body)
3490 * @len: length of the frame data 3548 * @len: length of the frame data
3491 * 3549 *
3492 * This function is called whenever a received Deauthentication frame has been 3550 * This function is called whenever a received deauthentication or dissassoc
3493 * dropped in station mode because of MFP being used but the Deauthentication 3551 * frame has been dropped in station mode because of MFP being used but the
3494 * frame was not protected. This function may sleep. 3552 * frame was not protected. This function may sleep.
3495 */ 3553 */
3496void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf, 3554void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
3497 size_t len); 3555 const u8 *buf, size_t len);
3498
3499/**
3500 * cfg80211_send_unprot_disassoc - notification of unprotected disassociation
3501 * @dev: network device
3502 * @buf: disassociation frame (header + body)
3503 * @len: length of the frame data
3504 *
3505 * This function is called whenever a received Disassociation frame has been
3506 * dropped in station mode because of MFP being used but the Disassociation
3507 * frame was not protected. This function may sleep.
3508 */
3509void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf,
3510 size_t len);
3511 3556
3512/** 3557/**
3513 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 3558 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
@@ -4153,6 +4198,7 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
4153 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. 4198 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
4154 * 4199 *
4155 * @wdev: the wireless device for which critical protocol is stopped. 4200 * @wdev: the wireless device for which critical protocol is stopped.
4201 * @gfp: allocation flags
4156 * 4202 *
4157 * This function can be called by the driver to indicate it has reverted 4203 * This function can be called by the driver to indicate it has reverted
4158 * operation back to normal. One reason could be that the duration given 4204 * operation back to normal. One reason could be that the duration given
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h
index a79b6cfb02a8..cf8439ba4d11 100644
--- a/include/net/gen_stats.h
+++ b/include/net/gen_stats.h
@@ -30,7 +30,7 @@ extern int gnet_stats_copy_basic(struct gnet_dump *d,
30 struct gnet_stats_basic_packed *b); 30 struct gnet_stats_basic_packed *b);
31extern int gnet_stats_copy_rate_est(struct gnet_dump *d, 31extern int gnet_stats_copy_rate_est(struct gnet_dump *d,
32 const struct gnet_stats_basic_packed *b, 32 const struct gnet_stats_basic_packed *b,
33 struct gnet_stats_rate_est *r); 33 struct gnet_stats_rate_est64 *r);
34extern int gnet_stats_copy_queue(struct gnet_dump *d, 34extern int gnet_stats_copy_queue(struct gnet_dump *d,
35 struct gnet_stats_queue *q); 35 struct gnet_stats_queue *q);
36extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len); 36extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len);
@@ -38,13 +38,13 @@ extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len);
38extern int gnet_stats_finish_copy(struct gnet_dump *d); 38extern int gnet_stats_finish_copy(struct gnet_dump *d);
39 39
40extern int gen_new_estimator(struct gnet_stats_basic_packed *bstats, 40extern int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
41 struct gnet_stats_rate_est *rate_est, 41 struct gnet_stats_rate_est64 *rate_est,
42 spinlock_t *stats_lock, struct nlattr *opt); 42 spinlock_t *stats_lock, struct nlattr *opt);
43extern void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, 43extern void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
44 struct gnet_stats_rate_est *rate_est); 44 struct gnet_stats_rate_est64 *rate_est);
45extern int gen_replace_estimator(struct gnet_stats_basic_packed *bstats, 45extern int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
46 struct gnet_stats_rate_est *rate_est, 46 struct gnet_stats_rate_est64 *rate_est,
47 spinlock_t *stats_lock, struct nlattr *opt); 47 spinlock_t *stats_lock, struct nlattr *opt);
48extern bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, 48extern bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
49 const struct gnet_stats_rate_est *rate_est); 49 const struct gnet_stats_rate_est64 *rate_est);
50#endif 50#endif
diff --git a/include/net/gre.h b/include/net/gre.h
index 9f03a390c826..57e4afdf7879 100644
--- a/include/net/gre.h
+++ b/include/net/gre.h
@@ -7,6 +7,7 @@
7#define GREPROTO_CISCO 0 7#define GREPROTO_CISCO 0
8#define GREPROTO_PPTP 1 8#define GREPROTO_PPTP 1
9#define GREPROTO_MAX 2 9#define GREPROTO_MAX 2
10#define GRE_IP_PROTO_MAX 2
10 11
11struct gre_protocol { 12struct gre_protocol {
12 int (*handler)(struct sk_buff *skb); 13 int (*handler)(struct sk_buff *skb);
@@ -22,6 +23,36 @@ struct gre_base_hdr {
22int gre_add_protocol(const struct gre_protocol *proto, u8 version); 23int gre_add_protocol(const struct gre_protocol *proto, u8 version);
23int gre_del_protocol(const struct gre_protocol *proto, u8 version); 24int gre_del_protocol(const struct gre_protocol *proto, u8 version);
24 25
26struct gre_cisco_protocol {
27 int (*handler)(struct sk_buff *skb, const struct tnl_ptk_info *tpi);
28 int (*err_handler)(struct sk_buff *skb, u32 info,
29 const struct tnl_ptk_info *tpi);
30 u8 priority;
31};
32
33int gre_cisco_register(struct gre_cisco_protocol *proto);
34int gre_cisco_unregister(struct gre_cisco_protocol *proto);
35
36int gre_offload_init(void);
37void gre_offload_exit(void);
38
39void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
40 int hdr_len);
41struct sk_buff *gre_handle_offloads(struct sk_buff *skb, bool gre_csum);
42
43static inline int ip_gre_calc_hlen(__be16 o_flags)
44{
45 int addend = 4;
46
47 if (o_flags&TUNNEL_CSUM)
48 addend += 4;
49 if (o_flags&TUNNEL_KEY)
50 addend += 4;
51 if (o_flags&TUNNEL_SEQ)
52 addend += 4;
53 return addend;
54}
55
25static inline __be16 gre_flags_to_tnl_flags(__be16 flags) 56static inline __be16 gre_flags_to_tnl_flags(__be16 flags)
26{ 57{
27 __be16 tflags = 0; 58 __be16 tflags = 0;
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index c3999632e616..c6d07cb074bc 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -269,6 +269,7 @@ enum ieee80211_radiotap_type {
269#define IEEE80211_RADIOTAP_MCS_HAVE_GI 0x04 269#define IEEE80211_RADIOTAP_MCS_HAVE_GI 0x04
270#define IEEE80211_RADIOTAP_MCS_HAVE_FMT 0x08 270#define IEEE80211_RADIOTAP_MCS_HAVE_FMT 0x08
271#define IEEE80211_RADIOTAP_MCS_HAVE_FEC 0x10 271#define IEEE80211_RADIOTAP_MCS_HAVE_FEC 0x10
272#define IEEE80211_RADIOTAP_MCS_HAVE_STBC 0x20
272 273
273#define IEEE80211_RADIOTAP_MCS_BW_MASK 0x03 274#define IEEE80211_RADIOTAP_MCS_BW_MASK 0x03
274#define IEEE80211_RADIOTAP_MCS_BW_20 0 275#define IEEE80211_RADIOTAP_MCS_BW_20 0
@@ -278,6 +279,12 @@ enum ieee80211_radiotap_type {
278#define IEEE80211_RADIOTAP_MCS_SGI 0x04 279#define IEEE80211_RADIOTAP_MCS_SGI 0x04
279#define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08 280#define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08
280#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10 281#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10
282#define IEEE80211_RADIOTAP_MCS_STBC_MASK 0x60
283#define IEEE80211_RADIOTAP_MCS_STBC_1 1
284#define IEEE80211_RADIOTAP_MCS_STBC_2 2
285#define IEEE80211_RADIOTAP_MCS_STBC_3 3
286
287#define IEEE80211_RADIOTAP_MCS_STBC_SHIFT 5
281 288
282/* For IEEE80211_RADIOTAP_AMPDU_STATUS */ 289/* For IEEE80211_RADIOTAP_AMPDU_STATUS */
283#define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN 0x0001 290#define IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN 0x0001
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 100fb8cec17c..736b5fb95474 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -50,7 +50,7 @@ struct inet6_ifaddr {
50 50
51 int state; 51 int state;
52 52
53 __u8 probes; 53 __u8 dad_probes;
54 __u8 flags; 54 __u8 flags;
55 55
56 __u16 scope; 56 __u16 scope;
@@ -58,7 +58,7 @@ struct inet6_ifaddr {
58 unsigned long cstamp; /* created timestamp */ 58 unsigned long cstamp; /* created timestamp */
59 unsigned long tstamp; /* updated timestamp */ 59 unsigned long tstamp; /* updated timestamp */
60 60
61 struct timer_list timer; 61 struct timer_list dad_timer;
62 62
63 struct inet6_dev *idev; 63 struct inet6_dev *idev;
64 struct rt6_info *rt; 64 struct rt6_info *rt;
@@ -74,6 +74,7 @@ struct inet6_ifaddr {
74 bool tokenized; 74 bool tokenized;
75 75
76 struct rcu_head rcu; 76 struct rcu_head rcu;
77 struct in6_addr peer_addr;
77}; 78};
78 79
79struct ip6_sf_socklist { 80struct ip6_sf_socklist {
@@ -165,6 +166,7 @@ struct inet6_dev {
165 struct net_device *dev; 166 struct net_device *dev;
166 167
167 struct list_head addr_list; 168 struct list_head addr_list;
169 int valid_ll_addr_cnt;
168 170
169 struct ifmcaddr6 *mc_list; 171 struct ifmcaddr6 *mc_list;
170 struct ifmcaddr6 *mc_tomb; 172 struct ifmcaddr6 *mc_tomb;
@@ -172,10 +174,12 @@ struct inet6_dev {
172 unsigned char mc_qrv; 174 unsigned char mc_qrv;
173 unsigned char mc_gq_running; 175 unsigned char mc_gq_running;
174 unsigned char mc_ifc_count; 176 unsigned char mc_ifc_count;
177 unsigned char mc_dad_count;
175 unsigned long mc_v1_seen; 178 unsigned long mc_v1_seen;
176 unsigned long mc_maxdelay; 179 unsigned long mc_maxdelay;
177 struct timer_list mc_gq_timer; /* general query timer */ 180 struct timer_list mc_gq_timer; /* general query timer */
178 struct timer_list mc_ifc_timer; /* interface change timer */ 181 struct timer_list mc_ifc_timer; /* interface change timer */
182 struct timer_list mc_dad_timer; /* dad complete mc timer */
179 183
180 struct ifacaddr6 *ac_list; 184 struct ifacaddr6 *ac_list;
181 rwlock_t lock; 185 rwlock_t lock;
@@ -192,9 +196,12 @@ struct inet6_dev {
192 struct in6_addr token; 196 struct in6_addr token;
193 197
194 struct neigh_parms *nd_parms; 198 struct neigh_parms *nd_parms;
195 struct inet6_dev *next;
196 struct ipv6_devconf cnf; 199 struct ipv6_devconf cnf;
197 struct ipv6_devstat stats; 200 struct ipv6_devstat stats;
201
202 struct timer_list rs_timer;
203 __u8 rs_probes;
204
198 unsigned long tstamp; /* ipv6InterfaceTable update timestamp */ 205 unsigned long tstamp; /* ipv6InterfaceTable update timestamp */
199 struct rcu_head rcu; 206 struct rcu_head rcu;
200}; 207};
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index aab73757bc4d..3bd22795c3e2 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -134,12 +134,14 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
134{ 134{
135 switch (skb->protocol) { 135 switch (skb->protocol) {
136 case cpu_to_be16(ETH_P_IP): 136 case cpu_to_be16(ETH_P_IP):
137 if (skb->network_header + sizeof(struct iphdr) <= skb->tail) 137 if (skb_network_header(skb) + sizeof(struct iphdr) <=
138 skb_tail_pointer(skb))
138 return IP_ECN_set_ce(ip_hdr(skb)); 139 return IP_ECN_set_ce(ip_hdr(skb));
139 break; 140 break;
140 141
141 case cpu_to_be16(ETH_P_IPV6): 142 case cpu_to_be16(ETH_P_IPV6):
142 if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail) 143 if (skb_network_header(skb) + sizeof(struct ipv6hdr) <=
144 skb_tail_pointer(skb))
143 return IP6_ECN_set_ce(ipv6_hdr(skb)); 145 return IP6_ECN_set_ce(ipv6_hdr(skb));
144 break; 146 break;
145 } 147 }
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 7235ae73a1e8..b21a7f06d6a4 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -32,7 +32,6 @@
32 * 32 *
33 * @faddr - Saved first hop address 33 * @faddr - Saved first hop address
34 * @nexthop - Saved nexthop address in LSRR and SSRR 34 * @nexthop - Saved nexthop address in LSRR and SSRR
35 * @is_data - Options in __data, rather than skb
36 * @is_strictroute - Strict source route 35 * @is_strictroute - Strict source route
37 * @srr_is_hit - Packet destination addr was our one 36 * @srr_is_hit - Packet destination addr was our one
38 * @is_changed - IP checksum more not valid 37 * @is_changed - IP checksum more not valid
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 2a601e7da1bf..48ec25a7fcb6 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -300,7 +300,7 @@ extern void inet6_rt_notify(int event, struct rt6_info *rt,
300 struct nl_info *info); 300 struct nl_info *info);
301 301
302extern void fib6_run_gc(unsigned long expires, 302extern void fib6_run_gc(unsigned long expires,
303 struct net *net); 303 struct net *net, bool force);
304 304
305extern void fib6_gc_cleanup(void); 305extern void fib6_gc_cleanup(void);
306 306
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index e49db91593a9..cbf2be37c91a 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -51,11 +51,13 @@ struct rtable;
51 51
52struct fib_nh_exception { 52struct fib_nh_exception {
53 struct fib_nh_exception __rcu *fnhe_next; 53 struct fib_nh_exception __rcu *fnhe_next;
54 int fnhe_genid;
54 __be32 fnhe_daddr; 55 __be32 fnhe_daddr;
55 u32 fnhe_pmtu; 56 u32 fnhe_pmtu;
56 __be32 fnhe_gw; 57 __be32 fnhe_gw;
57 unsigned long fnhe_expires; 58 unsigned long fnhe_expires;
58 struct rtable __rcu *fnhe_rth; 59 struct rtable __rcu *fnhe_rth_input;
60 struct rtable __rcu *fnhe_rth_output;
59 unsigned long fnhe_stamp; 61 unsigned long fnhe_stamp;
60}; 62};
61 63
@@ -289,7 +291,6 @@ static inline int fib_num_tclassid_users(struct net *net)
289extern int ip_fib_check_default(__be32 gw, struct net_device *dev); 291extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
290extern int fib_sync_down_dev(struct net_device *dev, int force); 292extern int fib_sync_down_dev(struct net_device *dev, int force);
291extern int fib_sync_down_addr(struct net *net, __be32 local); 293extern int fib_sync_down_addr(struct net *net, __be32 local);
292extern void fib_update_nh_saddrs(struct net_device *dev);
293extern int fib_sync_up(struct net_device *dev); 294extern int fib_sync_up(struct net_device *dev);
294extern void fib_select_multipath(struct fib_result *res); 295extern void fib_select_multipath(struct fib_result *res);
295 296
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 09b1360e10bf..781b3cf86a2f 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -42,6 +42,7 @@ struct ip_tunnel {
42 struct ip_tunnel __rcu *next; 42 struct ip_tunnel __rcu *next;
43 struct hlist_node hash_node; 43 struct hlist_node hash_node;
44 struct net_device *dev; 44 struct net_device *dev;
45 struct net *net; /* netns for packet i/o */
45 46
46 int err_count; /* Number of arrived ICMP errors */ 47 int err_count; /* Number of arrived ICMP errors */
47 unsigned long err_time; /* Time when the last ICMP error 48 unsigned long err_time; /* Time when the last ICMP error
@@ -73,6 +74,7 @@ struct ip_tunnel {
73#define TUNNEL_REC __cpu_to_be16(0x20) 74#define TUNNEL_REC __cpu_to_be16(0x20)
74#define TUNNEL_VERSION __cpu_to_be16(0x40) 75#define TUNNEL_VERSION __cpu_to_be16(0x40)
75#define TUNNEL_NO_KEY __cpu_to_be16(0x80) 76#define TUNNEL_NO_KEY __cpu_to_be16(0x80)
77#define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100)
76 78
77struct tnl_ptk_info { 79struct tnl_ptk_info {
78 __be16 flags; 80 __be16 flags;
@@ -92,6 +94,8 @@ struct ip_tunnel_net {
92 struct net_device *fb_tunnel_dev; 94 struct net_device *fb_tunnel_dev;
93}; 95};
94 96
97#ifdef CONFIG_INET
98
95int ip_tunnel_init(struct net_device *dev); 99int ip_tunnel_init(struct net_device *dev);
96void ip_tunnel_uninit(struct net_device *dev); 100void ip_tunnel_uninit(struct net_device *dev);
97void ip_tunnel_dellink(struct net_device *dev, struct list_head *head); 101void ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
@@ -101,7 +105,7 @@ int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
101void ip_tunnel_delete_net(struct ip_tunnel_net *itn); 105void ip_tunnel_delete_net(struct ip_tunnel_net *itn);
102 106
103void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, 107void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
104 const struct iphdr *tnl_params); 108 const struct iphdr *tnl_params, const u8 protocol);
105int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd); 109int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd);
106int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu); 110int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);
107 111
@@ -155,23 +159,31 @@ static inline void tunnel_ip_select_ident(struct sk_buff *skb,
155 (skb_shinfo(skb)->gso_segs ?: 1) - 1); 159 (skb_shinfo(skb)->gso_segs ?: 1) - 1);
156} 160}
157 161
158static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev) 162int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
159{ 163int iptunnel_xmit(struct net *net, struct rtable *rt,
160 int err; 164 struct sk_buff *skb,
161 int pkt_len = skb->len - skb_transport_offset(skb); 165 __be32 src, __be32 dst, __u8 proto,
162 struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats); 166 __u8 tos, __u8 ttl, __be16 df);
163 167
164 nf_reset(skb); 168static inline void iptunnel_xmit_stats(int err,
169 struct net_device_stats *err_stats,
170 struct pcpu_tstats __percpu *stats)
171{
172 if (err > 0) {
173 struct pcpu_tstats *tstats = this_cpu_ptr(stats);
165 174
166 err = ip_local_out(skb);
167 if (likely(net_xmit_eval(err) == 0)) {
168 u64_stats_update_begin(&tstats->syncp); 175 u64_stats_update_begin(&tstats->syncp);
169 tstats->tx_bytes += pkt_len; 176 tstats->tx_bytes += err;
170 tstats->tx_packets++; 177 tstats->tx_packets++;
171 u64_stats_update_end(&tstats->syncp); 178 u64_stats_update_end(&tstats->syncp);
179 } else if (err < 0) {
180 err_stats->tx_errors++;
181 err_stats->tx_aborted_errors++;
172 } else { 182 } else {
173 dev->stats.tx_errors++; 183 err_stats->tx_dropped++;
174 dev->stats.tx_aborted_errors++;
175 } 184 }
176} 185}
186
187#endif /* CONFIG_INET */
188
177#endif /* __NET_IP_TUNNELS_H */ 189#endif /* __NET_IP_TUNNELS_H */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 4c062ccff9aa..f0d70f066f3d 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -197,31 +197,6 @@ ip_vs_fill_iph_skb(int af, const struct sk_buff *skb, struct ip_vs_iphdr *iphdr)
197 } 197 }
198} 198}
199 199
200/* This function is a faster version of ip_vs_fill_iph_skb().
201 * Where we only populate {s,d}addr (and avoid calling ipv6_find_hdr()).
202 * This is used by the some of the ip_vs_*_schedule() functions.
203 * (Mostly done to avoid ABI breakage of external schedulers)
204 */
205static inline void
206ip_vs_fill_iph_addr_only(int af, const struct sk_buff *skb,
207 struct ip_vs_iphdr *iphdr)
208{
209#ifdef CONFIG_IP_VS_IPV6
210 if (af == AF_INET6) {
211 const struct ipv6hdr *iph =
212 (struct ipv6hdr *)skb_network_header(skb);
213 iphdr->saddr.in6 = iph->saddr;
214 iphdr->daddr.in6 = iph->daddr;
215 } else
216#endif
217 {
218 const struct iphdr *iph =
219 (struct iphdr *)skb_network_header(skb);
220 iphdr->saddr.ip = iph->saddr;
221 iphdr->daddr.ip = iph->daddr;
222 }
223}
224
225static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst, 200static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst,
226 const union nf_inet_addr *src) 201 const union nf_inet_addr *src)
227{ 202{
@@ -405,17 +380,18 @@ enum {
405 */ 380 */
406enum ip_vs_sctp_states { 381enum ip_vs_sctp_states {
407 IP_VS_SCTP_S_NONE, 382 IP_VS_SCTP_S_NONE,
408 IP_VS_SCTP_S_INIT_CLI, 383 IP_VS_SCTP_S_INIT1,
409 IP_VS_SCTP_S_INIT_SER, 384 IP_VS_SCTP_S_INIT,
410 IP_VS_SCTP_S_INIT_ACK_CLI, 385 IP_VS_SCTP_S_COOKIE_SENT,
411 IP_VS_SCTP_S_INIT_ACK_SER, 386 IP_VS_SCTP_S_COOKIE_REPLIED,
412 IP_VS_SCTP_S_ECHO_CLI, 387 IP_VS_SCTP_S_COOKIE_WAIT,
413 IP_VS_SCTP_S_ECHO_SER, 388 IP_VS_SCTP_S_COOKIE,
389 IP_VS_SCTP_S_COOKIE_ECHOED,
414 IP_VS_SCTP_S_ESTABLISHED, 390 IP_VS_SCTP_S_ESTABLISHED,
415 IP_VS_SCTP_S_SHUT_CLI, 391 IP_VS_SCTP_S_SHUTDOWN_SENT,
416 IP_VS_SCTP_S_SHUT_SER, 392 IP_VS_SCTP_S_SHUTDOWN_RECEIVED,
417 IP_VS_SCTP_S_SHUT_ACK_CLI, 393 IP_VS_SCTP_S_SHUTDOWN_ACK_SENT,
418 IP_VS_SCTP_S_SHUT_ACK_SER, 394 IP_VS_SCTP_S_REJECTED,
419 IP_VS_SCTP_S_CLOSED, 395 IP_VS_SCTP_S_CLOSED,
420 IP_VS_SCTP_S_LAST 396 IP_VS_SCTP_S_LAST
421}; 397};
@@ -814,7 +790,8 @@ struct ip_vs_scheduler {
814 790
815 /* selecting a server from the given service */ 791 /* selecting a server from the given service */
816 struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc, 792 struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc,
817 const struct sk_buff *skb); 793 const struct sk_buff *skb,
794 struct ip_vs_iphdr *iph);
818}; 795};
819 796
820/* The persistence engine object */ 797/* The persistence engine object */
@@ -905,7 +882,7 @@ struct ip_vs_app {
905struct ipvs_master_sync_state { 882struct ipvs_master_sync_state {
906 struct list_head sync_queue; 883 struct list_head sync_queue;
907 struct ip_vs_sync_buff *sync_buff; 884 struct ip_vs_sync_buff *sync_buff;
908 int sync_queue_len; 885 unsigned long sync_queue_len;
909 unsigned int sync_queue_delay; 886 unsigned int sync_queue_delay;
910 struct task_struct *master_thread; 887 struct task_struct *master_thread;
911 struct delayed_work master_wakeup_work; 888 struct delayed_work master_wakeup_work;
@@ -998,10 +975,13 @@ struct netns_ipvs {
998 int sysctl_snat_reroute; 975 int sysctl_snat_reroute;
999 int sysctl_sync_ver; 976 int sysctl_sync_ver;
1000 int sysctl_sync_ports; 977 int sysctl_sync_ports;
1001 int sysctl_sync_qlen_max; 978 int sysctl_sync_persist_mode;
979 unsigned long sysctl_sync_qlen_max;
1002 int sysctl_sync_sock_size; 980 int sysctl_sync_sock_size;
1003 int sysctl_cache_bypass; 981 int sysctl_cache_bypass;
1004 int sysctl_expire_nodest_conn; 982 int sysctl_expire_nodest_conn;
983 int sysctl_sloppy_tcp;
984 int sysctl_sloppy_sctp;
1005 int sysctl_expire_quiescent_template; 985 int sysctl_expire_quiescent_template;
1006 int sysctl_sync_threshold[2]; 986 int sysctl_sync_threshold[2];
1007 unsigned int sysctl_sync_refresh_period; 987 unsigned int sysctl_sync_refresh_period;
@@ -1044,6 +1024,8 @@ struct netns_ipvs {
1044#define DEFAULT_SYNC_THRESHOLD 3 1024#define DEFAULT_SYNC_THRESHOLD 3
1045#define DEFAULT_SYNC_PERIOD 50 1025#define DEFAULT_SYNC_PERIOD 50
1046#define DEFAULT_SYNC_VER 1 1026#define DEFAULT_SYNC_VER 1
1027#define DEFAULT_SLOPPY_TCP 0
1028#define DEFAULT_SLOPPY_SCTP 0
1047#define DEFAULT_SYNC_REFRESH_PERIOD (0U * HZ) 1029#define DEFAULT_SYNC_REFRESH_PERIOD (0U * HZ)
1048#define DEFAULT_SYNC_RETRIES 0 1030#define DEFAULT_SYNC_RETRIES 0
1049#define IPVS_SYNC_WAKEUP_RATE 8 1031#define IPVS_SYNC_WAKEUP_RATE 8
@@ -1080,12 +1062,27 @@ static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
1080 return ipvs->sysctl_sync_ver; 1062 return ipvs->sysctl_sync_ver;
1081} 1063}
1082 1064
1065static inline int sysctl_sloppy_tcp(struct netns_ipvs *ipvs)
1066{
1067 return ipvs->sysctl_sloppy_tcp;
1068}
1069
1070static inline int sysctl_sloppy_sctp(struct netns_ipvs *ipvs)
1071{
1072 return ipvs->sysctl_sloppy_sctp;
1073}
1074
1083static inline int sysctl_sync_ports(struct netns_ipvs *ipvs) 1075static inline int sysctl_sync_ports(struct netns_ipvs *ipvs)
1084{ 1076{
1085 return ACCESS_ONCE(ipvs->sysctl_sync_ports); 1077 return ACCESS_ONCE(ipvs->sysctl_sync_ports);
1086} 1078}
1087 1079
1088static inline int sysctl_sync_qlen_max(struct netns_ipvs *ipvs) 1080static inline int sysctl_sync_persist_mode(struct netns_ipvs *ipvs)
1081{
1082 return ipvs->sysctl_sync_persist_mode;
1083}
1084
1085static inline unsigned long sysctl_sync_qlen_max(struct netns_ipvs *ipvs)
1089{ 1086{
1090 return ipvs->sysctl_sync_qlen_max; 1087 return ipvs->sysctl_sync_qlen_max;
1091} 1088}
@@ -1133,12 +1130,27 @@ static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
1133 return DEFAULT_SYNC_VER; 1130 return DEFAULT_SYNC_VER;
1134} 1131}
1135 1132
1133static inline int sysctl_sloppy_tcp(struct netns_ipvs *ipvs)
1134{
1135 return DEFAULT_SLOPPY_TCP;
1136}
1137
1138static inline int sysctl_sloppy_sctp(struct netns_ipvs *ipvs)
1139{
1140 return DEFAULT_SLOPPY_SCTP;
1141}
1142
1136static inline int sysctl_sync_ports(struct netns_ipvs *ipvs) 1143static inline int sysctl_sync_ports(struct netns_ipvs *ipvs)
1137{ 1144{
1138 return 1; 1145 return 1;
1139} 1146}
1140 1147
1141static inline int sysctl_sync_qlen_max(struct netns_ipvs *ipvs) 1148static inline int sysctl_sync_persist_mode(struct netns_ipvs *ipvs)
1149{
1150 return 0;
1151}
1152
1153static inline unsigned long sysctl_sync_qlen_max(struct netns_ipvs *ipvs)
1142{ 1154{
1143 return IPVS_SYNC_QLEN_MAX; 1155 return IPVS_SYNC_QLEN_MAX;
1144} 1156}
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 0810aa57c780..5fe564985171 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -260,6 +260,12 @@ static inline void fl6_sock_release(struct ip6_flowlabel *fl)
260 260
261extern void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info); 261extern void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info);
262 262
263int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
264 struct icmp6hdr *thdr, int len);
265
266struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb,
267 struct sock *sk, struct flowi6 *fl6);
268
263extern int ip6_ra_control(struct sock *sk, int sel); 269extern int ip6_ra_control(struct sock *sk, int sel);
264 270
265extern int ipv6_parse_hopopts(struct sk_buff *skb); 271extern int ipv6_parse_hopopts(struct sk_buff *skb);
@@ -853,8 +859,8 @@ static inline int snmp6_unregister_dev(struct inet6_dev *idev) { return 0; }
853#endif 859#endif
854 860
855#ifdef CONFIG_SYSCTL 861#ifdef CONFIG_SYSCTL
856extern ctl_table ipv6_route_table_template[]; 862extern struct ctl_table ipv6_route_table_template[];
857extern ctl_table ipv6_icmp_table_template[]; 863extern struct ctl_table ipv6_icmp_table_template[];
858 864
859extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net); 865extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
860extern struct ctl_table *ipv6_route_sysctl_init(struct net *net); 866extern struct ctl_table *ipv6_route_sysctl_init(struct net *net);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 885898a40d13..5b7a3dadadde 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -217,8 +217,8 @@ struct ieee80211_chanctx_conf {
217 * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface 217 * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface
218 * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS) 218 * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS)
219 * changed (currently only in P2P client mode, GO mode will be later) 219 * changed (currently only in P2P client mode, GO mode will be later)
220 * @BSS_CHANGED_DTIM_PERIOD: the DTIM period value was changed (set when 220 * @BSS_CHANGED_BEACON_INFO: Data from the AP's beacon became available:
221 * it becomes valid, managed mode only) 221 * currently dtim_period only is under consideration.
222 * @BSS_CHANGED_BANDWIDTH: The bandwidth used by this interface changed, 222 * @BSS_CHANGED_BANDWIDTH: The bandwidth used by this interface changed,
223 * note that this is only called when it changes after the channel 223 * note that this is only called when it changes after the channel
224 * context had been assigned. 224 * context had been assigned.
@@ -244,7 +244,7 @@ enum ieee80211_bss_change {
244 BSS_CHANGED_PS = 1<<17, 244 BSS_CHANGED_PS = 1<<17,
245 BSS_CHANGED_TXPOWER = 1<<18, 245 BSS_CHANGED_TXPOWER = 1<<18,
246 BSS_CHANGED_P2P_PS = 1<<19, 246 BSS_CHANGED_P2P_PS = 1<<19,
247 BSS_CHANGED_DTIM_PERIOD = 1<<20, 247 BSS_CHANGED_BEACON_INFO = 1<<20,
248 BSS_CHANGED_BANDWIDTH = 1<<21, 248 BSS_CHANGED_BANDWIDTH = 1<<21,
249 249
250 /* when adding here, make sure to change ieee80211_reconfig */ 250 /* when adding here, make sure to change ieee80211_reconfig */
@@ -288,7 +288,7 @@ enum ieee80211_rssi_event {
288 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag 288 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
289 * @dtim_period: num of beacons before the next DTIM, for beaconing, 289 * @dtim_period: num of beacons before the next DTIM, for beaconing,
290 * valid in station mode only if after the driver was notified 290 * valid in station mode only if after the driver was notified
291 * with the %BSS_CHANGED_DTIM_PERIOD flag, will be non-zero then. 291 * with the %BSS_CHANGED_BEACON_INFO flag, will be non-zero then.
292 * @sync_tsf: last beacon's/probe response's TSF timestamp (could be old 292 * @sync_tsf: last beacon's/probe response's TSF timestamp (could be old
293 * as it may have been received during scanning long ago). If the 293 * as it may have been received during scanning long ago). If the
294 * HW flag %IEEE80211_HW_TIMING_BEACON_ONLY is set, then this can 294 * HW flag %IEEE80211_HW_TIMING_BEACON_ONLY is set, then this can
@@ -305,6 +305,7 @@ enum ieee80211_rssi_event {
305 * @basic_rates: bitmap of basic rates, each bit stands for an 305 * @basic_rates: bitmap of basic rates, each bit stands for an
306 * index into the rate table configured by the driver in 306 * index into the rate table configured by the driver in
307 * the current band. 307 * the current band.
308 * @beacon_rate: associated AP's beacon TX rate
308 * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 309 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
309 * @bssid: The BSSID for this BSS 310 * @bssid: The BSSID for this BSS
310 * @enable_beacon: whether beaconing should be enabled or not 311 * @enable_beacon: whether beaconing should be enabled or not
@@ -352,6 +353,7 @@ struct ieee80211_bss_conf {
352 u32 sync_device_ts; 353 u32 sync_device_ts;
353 u8 sync_dtim_count; 354 u8 sync_dtim_count;
354 u32 basic_rates; 355 u32 basic_rates;
356 struct ieee80211_rate *beacon_rate;
355 int mcast_rate[IEEE80211_NUM_BANDS]; 357 int mcast_rate[IEEE80211_NUM_BANDS];
356 u16 ht_operation_mode; 358 u16 ht_operation_mode;
357 s32 cqm_rssi_thold; 359 s32 cqm_rssi_thold;
@@ -460,6 +462,8 @@ struct ieee80211_bss_conf {
460 * @IEEE80211_TX_CTL_DONTFRAG: Don't fragment this packet even if it 462 * @IEEE80211_TX_CTL_DONTFRAG: Don't fragment this packet even if it
461 * would be fragmented by size (this is optional, only used for 463 * would be fragmented by size (this is optional, only used for
462 * monitor injection). 464 * monitor injection).
465 * @IEEE80211_TX_CTL_PS_RESPONSE: This frame is a response to a poll
466 * frame (PS-Poll or uAPSD).
463 * 467 *
464 * Note: If you have to add new flags to the enumeration, then don't 468 * Note: If you have to add new flags to the enumeration, then don't
465 * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary. 469 * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary.
@@ -495,6 +499,7 @@ enum mac80211_tx_control_flags {
495 IEEE80211_TX_STATUS_EOSP = BIT(28), 499 IEEE80211_TX_STATUS_EOSP = BIT(28),
496 IEEE80211_TX_CTL_USE_MINRATE = BIT(29), 500 IEEE80211_TX_CTL_USE_MINRATE = BIT(29),
497 IEEE80211_TX_CTL_DONTFRAG = BIT(30), 501 IEEE80211_TX_CTL_DONTFRAG = BIT(30),
502 IEEE80211_TX_CTL_PS_RESPONSE = BIT(31),
498}; 503};
499 504
500#define IEEE80211_TX_CTL_STBC_SHIFT 23 505#define IEEE80211_TX_CTL_STBC_SHIFT 23
@@ -805,6 +810,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
805 * on this subframe 810 * on this subframe
806 * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC 811 * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
807 * is stored in the @ampdu_delimiter_crc field) 812 * is stored in the @ampdu_delimiter_crc field)
813 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
808 */ 814 */
809enum mac80211_rx_flags { 815enum mac80211_rx_flags {
810 RX_FLAG_MMIC_ERROR = BIT(0), 816 RX_FLAG_MMIC_ERROR = BIT(0),
@@ -832,8 +838,11 @@ enum mac80211_rx_flags {
832 RX_FLAG_80MHZ = BIT(23), 838 RX_FLAG_80MHZ = BIT(23),
833 RX_FLAG_80P80MHZ = BIT(24), 839 RX_FLAG_80P80MHZ = BIT(24),
834 RX_FLAG_160MHZ = BIT(25), 840 RX_FLAG_160MHZ = BIT(25),
841 RX_FLAG_STBC_MASK = BIT(26) | BIT(27),
835}; 842};
836 843
844#define RX_FLAG_STBC_SHIFT 26
845
837/** 846/**
838 * struct ieee80211_rx_status - receive status 847 * struct ieee80211_rx_status - receive status
839 * 848 *
@@ -850,6 +859,10 @@ enum mac80211_rx_flags {
850 * @signal: signal strength when receiving this frame, either in dBm, in dB or 859 * @signal: signal strength when receiving this frame, either in dBm, in dB or
851 * unspecified depending on the hardware capabilities flags 860 * unspecified depending on the hardware capabilities flags
852 * @IEEE80211_HW_SIGNAL_* 861 * @IEEE80211_HW_SIGNAL_*
862 * @chains: bitmask of receive chains for which separate signal strength
863 * values were filled.
864 * @chain_signal: per-chain signal strength, in dBm (unlike @signal, doesn't
865 * support dB or unspecified units)
853 * @antenna: antenna used 866 * @antenna: antenna used
854 * @rate_idx: index of data rate into band's supported rates or MCS index if 867 * @rate_idx: index of data rate into band's supported rates or MCS index if
855 * HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT) 868 * HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT)
@@ -881,6 +894,8 @@ struct ieee80211_rx_status {
881 u8 band; 894 u8 band;
882 u8 antenna; 895 u8 antenna;
883 s8 signal; 896 s8 signal;
897 u8 chains;
898 s8 chain_signal[IEEE80211_MAX_CHAINS];
884 u8 ampdu_delimiter_crc; 899 u8 ampdu_delimiter_crc;
885 u8 vendor_radiotap_align; 900 u8 vendor_radiotap_align;
886 u8 vendor_radiotap_oui[3]; 901 u8 vendor_radiotap_oui[3];
@@ -1235,7 +1250,7 @@ enum ieee80211_sta_rx_bandwidth {
1235 * struct ieee80211_sta_rates - station rate selection table 1250 * struct ieee80211_sta_rates - station rate selection table
1236 * 1251 *
1237 * @rcu_head: RCU head used for freeing the table on update 1252 * @rcu_head: RCU head used for freeing the table on update
1238 * @rates: transmit rates/flags to be used by default. 1253 * @rate: transmit rates/flags to be used by default.
1239 * Overriding entries per-packet is possible by using cb tx control. 1254 * Overriding entries per-packet is possible by using cb tx control.
1240 */ 1255 */
1241struct ieee80211_sta_rates { 1256struct ieee80211_sta_rates {
@@ -1276,7 +1291,7 @@ struct ieee80211_sta_rates {
1276 * notifications and capabilities. The value is only valid after 1291 * notifications and capabilities. The value is only valid after
1277 * the station moves to associated state. 1292 * the station moves to associated state.
1278 * @smps_mode: current SMPS mode (off, static or dynamic) 1293 * @smps_mode: current SMPS mode (off, static or dynamic)
1279 * @tx_rates: rate control selection table 1294 * @rates: rate control selection table
1280 */ 1295 */
1281struct ieee80211_sta { 1296struct ieee80211_sta {
1282 u32 supp_rates[IEEE80211_NUM_BANDS]; 1297 u32 supp_rates[IEEE80211_NUM_BANDS];
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 745bf741e029..6fea32340ae8 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -119,7 +119,7 @@ extern struct ndisc_options *ndisc_parse_options(u8 *opt, int opt_len,
119 * if RFC 3831 IPv6-over-Fibre Channel is ever implemented it may 119 * if RFC 3831 IPv6-over-Fibre Channel is ever implemented it may
120 * also need a pad of 2. 120 * also need a pad of 2.
121 */ 121 */
122static int ndisc_addr_option_pad(unsigned short type) 122static inline int ndisc_addr_option_pad(unsigned short type)
123{ 123{
124 switch (type) { 124 switch (type) {
125 case ARPHRD_INFINIBAND: return 2; 125 case ARPHRD_INFINIBAND: return 2;
@@ -230,7 +230,7 @@ extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
230 void __user *buffer, 230 void __user *buffer,
231 size_t *lenp, 231 size_t *lenp,
232 loff_t *ppos); 232 loff_t *ppos);
233int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, 233int ndisc_ifinfo_sysctl_strategy(struct ctl_table *ctl,
234 void __user *oldval, size_t __user *oldlenp, 234 void __user *oldval, size_t __user *oldlenp,
235 void __user *newval, size_t newlen); 235 void __user *newval, size_t newlen);
236#endif 236#endif
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index b17697827482..84e37b1ca9e1 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -115,9 +115,12 @@ struct net {
115#ifdef CONFIG_XFRM 115#ifdef CONFIG_XFRM
116 struct netns_xfrm xfrm; 116 struct netns_xfrm xfrm;
117#endif 117#endif
118#if IS_ENABLED(CONFIG_IP_VS)
118 struct netns_ipvs *ipvs; 119 struct netns_ipvs *ipvs;
120#endif
119 struct sock *diag_nlsk; 121 struct sock *diag_nlsk;
120 atomic_t rt_genid; 122 atomic_t rt_genid;
123 atomic_t fnhe_genid;
121}; 124};
122 125
123/* 126/*
@@ -340,4 +343,14 @@ static inline void rt_genid_bump(struct net *net)
340 atomic_inc(&net->rt_genid); 343 atomic_inc(&net->rt_genid);
341} 344}
342 345
346static inline int fnhe_genid(struct net *net)
347{
348 return atomic_read(&net->fnhe_genid);
349}
350
351static inline void fnhe_genid_bump(struct net *net)
352{
353 atomic_inc(&net->fnhe_genid);
354}
355
343#endif /* __NET_NET_NAMESPACE_H */ 356#endif /* __NET_NET_NAMESPACE_H */
diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h
index 5a2978d1cb22..495c71f66e7e 100644
--- a/include/net/netfilter/xt_rateest.h
+++ b/include/net/netfilter/xt_rateest.h
@@ -6,7 +6,7 @@ struct xt_rateest {
6 struct gnet_stats_basic_packed bstats; 6 struct gnet_stats_basic_packed bstats;
7 spinlock_t lock; 7 spinlock_t lock;
8 /* keep rstats and lock on same cache line to speedup xt_rateest_mt() */ 8 /* keep rstats and lock on same cache line to speedup xt_rateest_mt() */
9 struct gnet_stats_rate_est rstats; 9 struct gnet_stats_rate_est64 rstats;
10 10
11 /* following fields not accessed in hot path */ 11 /* following fields not accessed in hot path */
12 struct hlist_node list; 12 struct hlist_node list;
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
index c24060ee411e..02fe40f8c8fd 100644
--- a/include/net/netns/x_tables.h
+++ b/include/net/netns/x_tables.h
@@ -15,5 +15,11 @@ struct netns_xt {
15 struct ebt_table *frame_filter; 15 struct ebt_table *frame_filter;
16 struct ebt_table *frame_nat; 16 struct ebt_table *frame_nat;
17#endif 17#endif
18#if IS_ENABLED(CONFIG_IP_NF_TARGET_ULOG)
19 bool ulog_warn_deprecated;
20#endif
21#if IS_ENABLED(CONFIG_BRIDGE_EBT_ULOG)
22 bool ebt_ulog_warn_deprecated;
23#endif
18}; 24};
19#endif 25#endif
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index b87a1692b086..b64b7bce4b94 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -59,8 +59,10 @@ struct nfc_hci_ops {
59 struct nfc_target *target); 59 struct nfc_target *target);
60 int (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event, 60 int (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event,
61 struct sk_buff *skb); 61 struct sk_buff *skb);
62 int (*enable_se)(struct nfc_dev *dev, u32 secure_element); 62 int (*fw_download)(struct nfc_hci_dev *hdev, const char *firmware_name);
63 int (*disable_se)(struct nfc_dev *dev, u32 secure_element); 63 int (*discover_se)(struct nfc_hci_dev *dev);
64 int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx);
65 int (*disable_se)(struct nfc_hci_dev *dev, u32 se_idx);
64}; 66};
65 67
66/* Pipes */ 68/* Pipes */
@@ -152,7 +154,6 @@ struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
152 struct nfc_hci_init_data *init_data, 154 struct nfc_hci_init_data *init_data,
153 unsigned long quirks, 155 unsigned long quirks,
154 u32 protocols, 156 u32 protocols,
155 u32 supported_se,
156 const char *llc_name, 157 const char *llc_name,
157 int tx_headroom, 158 int tx_headroom,
158 int tx_tailroom, 159 int tx_tailroom,
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 5bc0c460edc0..99fc1f3a392a 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -3,6 +3,7 @@
3 * NFC Controller (NFCC) and a Device Host (DH). 3 * NFC Controller (NFCC) and a Device Host (DH).
4 * 4 *
5 * Copyright (C) 2011 Texas Instruments, Inc. 5 * Copyright (C) 2011 Texas Instruments, Inc.
6 * Copyright (C) 2013 Intel Corporation. All rights reserved.
6 * 7 *
7 * Written by Ilan Elias <ilane@ti.com> 8 * Written by Ilan Elias <ilane@ti.com>
8 * 9 *
@@ -66,7 +67,7 @@ struct nci_dev;
66struct nci_ops { 67struct nci_ops {
67 int (*open)(struct nci_dev *ndev); 68 int (*open)(struct nci_dev *ndev);
68 int (*close)(struct nci_dev *ndev); 69 int (*close)(struct nci_dev *ndev);
69 int (*send)(struct sk_buff *skb); 70 int (*send)(struct nci_dev *ndev, struct sk_buff *skb);
70}; 71};
71 72
72#define NCI_MAX_SUPPORTED_RF_INTERFACES 4 73#define NCI_MAX_SUPPORTED_RF_INTERFACES 4
@@ -147,13 +148,12 @@ struct nci_dev {
147/* ----- NCI Devices ----- */ 148/* ----- NCI Devices ----- */
148struct nci_dev *nci_allocate_device(struct nci_ops *ops, 149struct nci_dev *nci_allocate_device(struct nci_ops *ops,
149 __u32 supported_protocols, 150 __u32 supported_protocols,
150 __u32 supported_se,
151 int tx_headroom, 151 int tx_headroom,
152 int tx_tailroom); 152 int tx_tailroom);
153void nci_free_device(struct nci_dev *ndev); 153void nci_free_device(struct nci_dev *ndev);
154int nci_register_device(struct nci_dev *ndev); 154int nci_register_device(struct nci_dev *ndev);
155void nci_unregister_device(struct nci_dev *ndev); 155void nci_unregister_device(struct nci_dev *ndev);
156int nci_recv_frame(struct sk_buff *skb); 156int nci_recv_frame(struct nci_dev *ndev, struct sk_buff *skb);
157 157
158static inline struct sk_buff *nci_skb_alloc(struct nci_dev *ndev, 158static inline struct sk_buff *nci_skb_alloc(struct nci_dev *ndev,
159 unsigned int len, 159 unsigned int len,
@@ -202,4 +202,56 @@ void nci_req_complete(struct nci_dev *ndev, int result);
202/* ----- NCI status code ----- */ 202/* ----- NCI status code ----- */
203int nci_to_errno(__u8 code); 203int nci_to_errno(__u8 code);
204 204
205/* ----- NCI over SPI acknowledge modes ----- */
206#define NCI_SPI_CRC_DISABLED 0x00
207#define NCI_SPI_CRC_ENABLED 0x01
208
209/* ----- NCI SPI structures ----- */
210struct nci_spi_dev;
211
212struct nci_spi_ops {
213 int (*open)(struct nci_spi_dev *ndev);
214 int (*close)(struct nci_spi_dev *ndev);
215 void (*assert_int)(struct nci_spi_dev *ndev);
216 void (*deassert_int)(struct nci_spi_dev *ndev);
217};
218
219struct nci_spi_dev {
220 struct nci_dev *nci_dev;
221 struct spi_device *spi;
222 struct nci_spi_ops *ops;
223
224 unsigned int xfer_udelay; /* microseconds delay between
225 transactions */
226 u8 acknowledge_mode;
227
228 struct completion req_completion;
229 u8 req_result;
230
231 void *driver_data;
232};
233
234/* ----- NCI SPI Devices ----- */
235struct nci_spi_dev *nci_spi_allocate_device(struct spi_device *spi,
236 struct nci_spi_ops *ops,
237 u32 supported_protocols,
238 u32 supported_se,
239 u8 acknowledge_mode,
240 unsigned int delay);
241void nci_spi_free_device(struct nci_spi_dev *ndev);
242int nci_spi_register_device(struct nci_spi_dev *ndev);
243void nci_spi_unregister_device(struct nci_spi_dev *ndev);
244int nci_spi_recv_frame(struct nci_spi_dev *ndev);
245
246static inline void nci_spi_set_drvdata(struct nci_spi_dev *ndev,
247 void *data)
248{
249 ndev->driver_data = data;
250}
251
252static inline void *nci_spi_get_drvdata(struct nci_spi_dev *ndev)
253{
254 return ndev->driver_data;
255}
256
205#endif /* __NCI_CORE_H */ 257#endif /* __NCI_CORE_H */
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 5eb80bb3cbb2..5f286b726bb6 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -68,8 +68,12 @@ struct nfc_ops {
68 void *cb_context); 68 void *cb_context);
69 int (*tm_send)(struct nfc_dev *dev, struct sk_buff *skb); 69 int (*tm_send)(struct nfc_dev *dev, struct sk_buff *skb);
70 int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target); 70 int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target);
71 int (*enable_se)(struct nfc_dev *dev, u32 secure_element); 71 int (*fw_download)(struct nfc_dev *dev, const char *firmware_name);
72 int (*disable_se)(struct nfc_dev *dev, u32 secure_element); 72
73 /* Secure Element API */
74 int (*discover_se)(struct nfc_dev *dev);
75 int (*enable_se)(struct nfc_dev *dev, u32 se_idx);
76 int (*disable_se)(struct nfc_dev *dev, u32 se_idx);
73}; 77};
74 78
75#define NFC_TARGET_IDX_ANY -1 79#define NFC_TARGET_IDX_ANY -1
@@ -83,6 +87,8 @@ struct nfc_target {
83 u8 sel_res; 87 u8 sel_res;
84 u8 nfcid1_len; 88 u8 nfcid1_len;
85 u8 nfcid1[NFC_NFCID1_MAXSIZE]; 89 u8 nfcid1[NFC_NFCID1_MAXSIZE];
90 u8 nfcid2_len;
91 u8 nfcid2[NFC_NFCID2_MAXSIZE];
86 u8 sensb_res_len; 92 u8 sensb_res_len;
87 u8 sensb_res[NFC_SENSB_RES_MAXSIZE]; 93 u8 sensb_res[NFC_SENSB_RES_MAXSIZE];
88 u8 sensf_res_len; 94 u8 sensf_res_len;
@@ -91,6 +97,23 @@ struct nfc_target {
91 u8 logical_idx; 97 u8 logical_idx;
92}; 98};
93 99
100/**
101 * nfc_se - A structure for NFC accessible secure elements.
102 *
103 * @idx: The secure element index. User space will enable or
104 * disable a secure element by its index.
105 * @type: The secure element type. It can be SE_UICC or
106 * SE_EMBEDDED.
107 * @state: The secure element state, either enabled or disabled.
108 *
109 */
110struct nfc_se {
111 struct list_head list;
112 u32 idx;
113 u16 type;
114 u16 state;
115};
116
94struct nfc_genl_data { 117struct nfc_genl_data {
95 u32 poll_req_portid; 118 u32 poll_req_portid;
96 struct mutex genl_data_mutex; 119 struct mutex genl_data_mutex;
@@ -104,6 +127,7 @@ struct nfc_dev {
104 int targets_generation; 127 int targets_generation;
105 struct device dev; 128 struct device dev;
106 bool dev_up; 129 bool dev_up;
130 bool fw_download_in_progress;
107 u8 rf_mode; 131 u8 rf_mode;
108 bool polling; 132 bool polling;
109 struct nfc_target *active_target; 133 struct nfc_target *active_target;
@@ -111,8 +135,7 @@ struct nfc_dev {
111 struct nfc_genl_data genl_data; 135 struct nfc_genl_data genl_data;
112 u32 supported_protocols; 136 u32 supported_protocols;
113 137
114 u32 supported_se; 138 struct list_head secure_elements;
115 u32 active_se;
116 139
117 int tx_headroom; 140 int tx_headroom;
118 int tx_tailroom; 141 int tx_tailroom;
@@ -132,7 +155,6 @@ extern struct class nfc_class;
132 155
133struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops, 156struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops,
134 u32 supported_protocols, 157 u32 supported_protocols,
135 u32 supported_se,
136 int tx_headroom, 158 int tx_headroom,
137 int tx_tailroom); 159 int tx_tailroom);
138 160
@@ -216,4 +238,7 @@ int nfc_tm_data_received(struct nfc_dev *dev, struct sk_buff *skb);
216 238
217void nfc_driver_failure(struct nfc_dev *dev, int err); 239void nfc_driver_failure(struct nfc_dev *dev, int err);
218 240
241int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type);
242int nfc_remove_se(struct nfc_dev *dev, u32 se_idx);
243
219#endif /* __NET_NFC_H */ 244#endif /* __NET_NFC_H */
diff --git a/include/net/ping.h b/include/net/ping.h
index 682b5ae9af51..5db0224b73ac 100644
--- a/include/net/ping.h
+++ b/include/net/ping.h
@@ -13,6 +13,7 @@
13#ifndef _PING_H 13#ifndef _PING_H
14#define _PING_H 14#define _PING_H
15 15
16#include <net/icmp.h>
16#include <net/netns/hash.h> 17#include <net/netns/hash.h>
17 18
18/* PING_HTABLE_SIZE must be power of 2 */ 19/* PING_HTABLE_SIZE must be power of 2 */
@@ -28,6 +29,18 @@
28 */ 29 */
29#define GID_T_MAX (((gid_t)~0U) >> 1) 30#define GID_T_MAX (((gid_t)~0U) >> 1)
30 31
32/* Compatibility glue so we can support IPv6 when it's compiled as a module */
33struct pingv6_ops {
34 int (*ipv6_recv_error)(struct sock *sk, struct msghdr *msg, int len);
35 int (*ip6_datagram_recv_ctl)(struct sock *sk, struct msghdr *msg,
36 struct sk_buff *skb);
37 int (*icmpv6_err_convert)(u8 type, u8 code, int *err);
38 void (*ipv6_icmp_error)(struct sock *sk, struct sk_buff *skb, int err,
39 __be16 port, u32 info, u8 *payload);
40 int (*ipv6_chk_addr)(struct net *net, const struct in6_addr *addr,
41 const struct net_device *dev, int strict);
42};
43
31struct ping_table { 44struct ping_table {
32 struct hlist_nulls_head hash[PING_HTABLE_SIZE]; 45 struct hlist_nulls_head hash[PING_HTABLE_SIZE];
33 rwlock_t lock; 46 rwlock_t lock;
@@ -36,20 +49,66 @@ struct ping_table {
36struct ping_iter_state { 49struct ping_iter_state {
37 struct seq_net_private p; 50 struct seq_net_private p;
38 int bucket; 51 int bucket;
52 sa_family_t family;
39}; 53};
40 54
41extern struct proto ping_prot; 55extern struct proto ping_prot;
56extern struct ping_table ping_table;
57#if IS_ENABLED(CONFIG_IPV6)
58extern struct pingv6_ops pingv6_ops;
59#endif
60
61struct pingfakehdr {
62 struct icmphdr icmph;
63 struct iovec *iov;
64 sa_family_t family;
65 __wsum wcheck;
66};
67
68int ping_get_port(struct sock *sk, unsigned short ident);
69void ping_hash(struct sock *sk);
70void ping_unhash(struct sock *sk);
42 71
72int ping_init_sock(struct sock *sk);
73void ping_close(struct sock *sk, long timeout);
74int ping_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len);
75void ping_err(struct sk_buff *skb, int offset, u32 info);
76int ping_getfrag(void *from, char *to, int offset, int fraglen, int odd,
77 struct sk_buff *);
43 78
44extern void ping_rcv(struct sk_buff *); 79int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
45extern void ping_err(struct sk_buff *, u32 info); 80 size_t len, int noblock, int flags, int *addr_len);
81int ping_common_sendmsg(int family, struct msghdr *msg, size_t len,
82 void *user_icmph, size_t icmph_len);
83int ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
84 size_t len);
85int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
86 size_t len);
87int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
88void ping_rcv(struct sk_buff *skb);
46 89
47#ifdef CONFIG_PROC_FS 90#ifdef CONFIG_PROC_FS
91struct ping_seq_afinfo {
92 char *name;
93 sa_family_t family;
94 const struct file_operations *seq_fops;
95 const struct seq_operations seq_ops;
96};
97
98extern const struct file_operations ping_seq_fops;
99
100void *ping_seq_start(struct seq_file *seq, loff_t *pos, sa_family_t family);
101void *ping_seq_next(struct seq_file *seq, void *v, loff_t *pos);
102void ping_seq_stop(struct seq_file *seq, void *v);
103int ping_proc_register(struct net *net, struct ping_seq_afinfo *afinfo);
104void ping_proc_unregister(struct net *net, struct ping_seq_afinfo *afinfo);
105
48extern int __init ping_proc_init(void); 106extern int __init ping_proc_init(void);
49extern void ping_proc_exit(void); 107extern void ping_proc_exit(void);
50#endif 108#endif
51 109
52void __init ping_init(void); 110void __init ping_init(void);
53 111int __init pingv6_init(void);
112void pingv6_exit(void);
54 113
55#endif /* _PING_H */ 114#endif /* _PING_H */
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index e7f4e21cc3e1..6eab63363e59 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -58,14 +58,12 @@ struct Qdisc {
58 * multiqueue device. 58 * multiqueue device.
59 */ 59 */
60#define TCQ_F_WARN_NONWC (1 << 16) 60#define TCQ_F_WARN_NONWC (1 << 16)
61 int padded; 61 u32 limit;
62 const struct Qdisc_ops *ops; 62 const struct Qdisc_ops *ops;
63 struct qdisc_size_table __rcu *stab; 63 struct qdisc_size_table __rcu *stab;
64 struct list_head list; 64 struct list_head list;
65 u32 handle; 65 u32 handle;
66 u32 parent; 66 u32 parent;
67 atomic_t refcnt;
68 struct gnet_stats_rate_est rate_est;
69 int (*reshape_fail)(struct sk_buff *skb, 67 int (*reshape_fail)(struct sk_buff *skb,
70 struct Qdisc *q); 68 struct Qdisc *q);
71 69
@@ -76,8 +74,9 @@ struct Qdisc {
76 */ 74 */
77 struct Qdisc *__parent; 75 struct Qdisc *__parent;
78 struct netdev_queue *dev_queue; 76 struct netdev_queue *dev_queue;
79 struct Qdisc *next_sched;
80 77
78 struct gnet_stats_rate_est64 rate_est;
79 struct Qdisc *next_sched;
81 struct sk_buff *gso_skb; 80 struct sk_buff *gso_skb;
82 /* 81 /*
83 * For performance sake on SMP, we put highly modified fields at the end 82 * For performance sake on SMP, we put highly modified fields at the end
@@ -88,8 +87,10 @@ struct Qdisc {
88 unsigned int __state; 87 unsigned int __state;
89 struct gnet_stats_queue qstats; 88 struct gnet_stats_queue qstats;
90 struct rcu_head rcu_head; 89 struct rcu_head rcu_head;
91 spinlock_t busylock; 90 int padded;
92 u32 limit; 91 atomic_t refcnt;
92
93 spinlock_t busylock ____cacheline_aligned_in_smp;
93}; 94};
94 95
95static inline bool qdisc_is_running(const struct Qdisc *qdisc) 96static inline bool qdisc_is_running(const struct Qdisc *qdisc)
@@ -679,7 +680,7 @@ static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask,
679#endif 680#endif
680 681
681struct psched_ratecfg { 682struct psched_ratecfg {
682 u64 rate_bps; 683 u64 rate_bytes_ps; /* bytes per second */
683 u32 mult; 684 u32 mult;
684 u16 overhead; 685 u16 overhead;
685 u8 shift; 686 u8 shift;
@@ -697,7 +698,7 @@ static inline void psched_ratecfg_getrate(struct tc_ratespec *res,
697 const struct psched_ratecfg *r) 698 const struct psched_ratecfg *r)
698{ 699{
699 memset(res, 0, sizeof(*res)); 700 memset(res, 0, sizeof(*res));
700 res->rate = r->rate_bps >> 3; 701 res->rate = r->rate_bytes_ps;
701 res->overhead = r->overhead; 702 res->overhead = r->overhead;
702} 703}
703 704
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
index 5a2110d3176d..0cb08e6fb6df 100644
--- a/include/net/sctp/checksum.h
+++ b/include/net/sctp/checksum.h
@@ -42,6 +42,9 @@
42 * be incorporated into the next SCTP release. 42 * be incorporated into the next SCTP release.
43 */ 43 */
44 44
45#ifndef __sctp_checksum_h__
46#define __sctp_checksum_h__
47
45#include <linux/types.h> 48#include <linux/types.h>
46#include <net/sctp/sctp.h> 49#include <net/sctp/sctp.h>
47#include <linux/crc32c.h> 50#include <linux/crc32c.h>
@@ -81,3 +84,5 @@ static inline __le32 sctp_end_cksum(__u32 crc32)
81{ 84{
82 return cpu_to_le32(~crc32); 85 return cpu_to_le32(~crc32);
83} 86}
87
88#endif /* __sctp_checksum_h__ */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index cd89510eab2a..d8e37ecea691 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -83,30 +83,12 @@
83#include <net/sctp/structs.h> 83#include <net/sctp/structs.h>
84#include <net/sctp/constants.h> 84#include <net/sctp/constants.h>
85 85
86
87/* Set SCTP_DEBUG flag via config if not already set. */
88#ifndef SCTP_DEBUG
89#ifdef CONFIG_SCTP_DBG_MSG
90#define SCTP_DEBUG 1
91#else
92#define SCTP_DEBUG 0
93#endif /* CONFIG_SCTP_DBG */
94#endif /* SCTP_DEBUG */
95
96#ifdef CONFIG_IP_SCTP_MODULE 86#ifdef CONFIG_IP_SCTP_MODULE
97#define SCTP_PROTOSW_FLAG 0 87#define SCTP_PROTOSW_FLAG 0
98#else /* static! */ 88#else /* static! */
99#define SCTP_PROTOSW_FLAG INET_PROTOSW_PERMANENT 89#define SCTP_PROTOSW_FLAG INET_PROTOSW_PERMANENT
100#endif 90#endif
101 91
102
103/* Certain internal static functions need to be exported when
104 * compiled into the test frame.
105 */
106#ifndef SCTP_STATIC
107#define SCTP_STATIC static
108#endif
109
110/* 92/*
111 * Function declarations. 93 * Function declarations.
112 */ 94 */
@@ -196,11 +178,6 @@ extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
196 * Section: Macros, externs, and inlines 178 * Section: Macros, externs, and inlines
197 */ 179 */
198 180
199
200#ifdef TEST_FRAME
201#include <test_frame.h>
202#else
203
204/* spin lock wrappers. */ 181/* spin lock wrappers. */
205#define sctp_spin_lock_irqsave(lock, flags) spin_lock_irqsave(lock, flags) 182#define sctp_spin_lock_irqsave(lock, flags) spin_lock_irqsave(lock, flags)
206#define sctp_spin_unlock_irqrestore(lock, flags) \ 183#define sctp_spin_unlock_irqrestore(lock, flags) \
@@ -226,8 +203,6 @@ extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
226#define SCTP_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->sctp.sctp_statistics, field) 203#define SCTP_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->sctp.sctp_statistics, field)
227#define SCTP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->sctp.sctp_statistics, field) 204#define SCTP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->sctp.sctp_statistics, field)
228 205
229#endif /* !TEST_FRAME */
230
231/* sctp mib definitions */ 206/* sctp mib definitions */
232enum { 207enum {
233 SCTP_MIB_NUM = 0, 208 SCTP_MIB_NUM = 0,
@@ -285,61 +260,6 @@ static inline void sctp_max_rto(struct sctp_association *asoc,
285 } 260 }
286} 261}
287 262
288/* Print debugging messages. */
289#if SCTP_DEBUG
290extern int sctp_debug_flag;
291#define SCTP_DEBUG_PRINTK(fmt, args...) \
292do { \
293 if (sctp_debug_flag) \
294 printk(KERN_DEBUG pr_fmt(fmt), ##args); \
295} while (0)
296#define SCTP_DEBUG_PRINTK_CONT(fmt, args...) \
297do { \
298 if (sctp_debug_flag) \
299 pr_cont(fmt, ##args); \
300} while (0)
301#define SCTP_DEBUG_PRINTK_IPADDR(fmt_lead, fmt_trail, \
302 args_lead, addr, args_trail...) \
303do { \
304 const union sctp_addr *_addr = (addr); \
305 if (sctp_debug_flag) { \
306 if (_addr->sa.sa_family == AF_INET6) { \
307 printk(KERN_DEBUG \
308 pr_fmt(fmt_lead "%pI6" fmt_trail), \
309 args_lead, \
310 &_addr->v6.sin6_addr, \
311 args_trail); \
312 } else { \
313 printk(KERN_DEBUG \
314 pr_fmt(fmt_lead "%pI4" fmt_trail), \
315 args_lead, \
316 &_addr->v4.sin_addr.s_addr, \
317 args_trail); \
318 } \
319 } \
320} while (0)
321#define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; }
322#define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; }
323
324#define SCTP_ASSERT(expr, str, func) \
325 if (!(expr)) { \
326 SCTP_DEBUG_PRINTK("Assertion Failed: %s(%s) at %s:%s:%d\n", \
327 str, (#expr), __FILE__, __func__, __LINE__); \
328 func; \
329 }
330
331#else /* SCTP_DEBUG */
332
333#define SCTP_DEBUG_PRINTK(whatever...)
334#define SCTP_DEBUG_PRINTK_CONT(fmt, args...)
335#define SCTP_DEBUG_PRINTK_IPADDR(whatever...)
336#define SCTP_ENABLE_DEBUG
337#define SCTP_DISABLE_DEBUG
338#define SCTP_ASSERT(expr, str, func)
339
340#endif /* SCTP_DEBUG */
341
342
343/* 263/*
344 * Macros for keeping a global reference of object allocations. 264 * Macros for keeping a global reference of object allocations.
345 */ 265 */
@@ -575,27 +495,6 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;\
575/* Round an int up to the next multiple of 4. */ 495/* Round an int up to the next multiple of 4. */
576#define WORD_ROUND(s) (((s)+3)&~3) 496#define WORD_ROUND(s) (((s)+3)&~3)
577 497
578/* Make a new instance of type. */
579#define t_new(type, flags) kzalloc(sizeof(type), flags)
580
581/* Compare two timevals. */
582#define tv_lt(s, t) \
583 (s.tv_sec < t.tv_sec || (s.tv_sec == t.tv_sec && s.tv_usec < t.tv_usec))
584
585/* Add tv1 to tv2. */
586#define TIMEVAL_ADD(tv1, tv2) \
587({ \
588 suseconds_t usecs = (tv2).tv_usec + (tv1).tv_usec; \
589 time_t secs = (tv2).tv_sec + (tv1).tv_sec; \
590\
591 if (usecs >= 1000000) { \
592 usecs -= 1000000; \
593 secs++; \
594 } \
595 (tv2).tv_sec = secs; \
596 (tv2).tv_usec = usecs; \
597})
598
599/* External references. */ 498/* External references. */
600 499
601extern struct proto sctp_prot; 500extern struct proto sctp_prot;
@@ -633,16 +532,6 @@ static inline int param_type2af(__be16 type)
633 } 532 }
634} 533}
635 534
636/* Perform some sanity checks. */
637static inline int sctp_sanity_check(void)
638{
639 SCTP_ASSERT(sizeof(struct sctp_ulpevent) <=
640 sizeof(((struct sk_buff *)0)->cb),
641 "SCTP: ulpevent does not fit in skb!\n", return 0);
642
643 return 1;
644}
645
646/* Warning: The following hash functions assume a power of two 'size'. */ 535/* Warning: The following hash functions assume a power of two 'size'. */
647/* This is the hash function for the SCTP port hash table. */ 536/* This is the hash function for the SCTP port hash table. */
648static inline int sctp_phashfn(struct net *net, __u16 lport) 537static inline int sctp_phashfn(struct net *net, __u16 lport)
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 1bd4c4144fe8..e745c92a1532 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -54,7 +54,7 @@
54#ifndef __sctp_structs_h__ 54#ifndef __sctp_structs_h__
55#define __sctp_structs_h__ 55#define __sctp_structs_h__
56 56
57#include <linux/time.h> /* We get struct timespec. */ 57#include <linux/ktime.h>
58#include <linux/socket.h> /* linux/in.h needs this!! */ 58#include <linux/socket.h> /* linux/in.h needs this!! */
59#include <linux/in.h> /* We get struct sockaddr_in. */ 59#include <linux/in.h> /* We get struct sockaddr_in. */
60#include <linux/in6.h> /* We get struct in6_addr */ 60#include <linux/in6.h> /* We get struct in6_addr */
@@ -284,7 +284,7 @@ struct sctp_cookie {
284 __u32 peer_ttag; 284 __u32 peer_ttag;
285 285
286 /* When does this cookie expire? */ 286 /* When does this cookie expire? */
287 struct timeval expiration; 287 ktime_t expiration;
288 288
289 /* Number of inbound/outbound streams which are set 289 /* Number of inbound/outbound streams which are set
290 * and negotiated during the INIT process. 290 * and negotiated during the INIT process.
@@ -1537,7 +1537,7 @@ struct sctp_association {
1537 sctp_state_t state; 1537 sctp_state_t state;
1538 1538
1539 /* The cookie life I award for any cookie. */ 1539 /* The cookie life I award for any cookie. */
1540 struct timeval cookie_life; 1540 ktime_t cookie_life;
1541 1541
1542 /* Overall : The overall association error count. 1542 /* Overall : The overall association error count.
1543 * Error Count : [Clear this any time I get something.] 1543 * Error Count : [Clear this any time I get something.]
diff --git a/include/net/sock.h b/include/net/sock.h
index 66772cf8c3c5..31d5cfbb51ec 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -229,6 +229,8 @@ struct cg_proto;
229 * @sk_omem_alloc: "o" is "option" or "other" 229 * @sk_omem_alloc: "o" is "option" or "other"
230 * @sk_wmem_queued: persistent queue size 230 * @sk_wmem_queued: persistent queue size
231 * @sk_forward_alloc: space allocated forward 231 * @sk_forward_alloc: space allocated forward
232 * @sk_napi_id: id of the last napi context to receive data for sk
233 * @sk_ll_usec: usecs to busypoll when there is no data
232 * @sk_allocation: allocation mode 234 * @sk_allocation: allocation mode
233 * @sk_sndbuf: size of send buffer in bytes 235 * @sk_sndbuf: size of send buffer in bytes
234 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, 236 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
@@ -325,6 +327,10 @@ struct sock {
325#ifdef CONFIG_RPS 327#ifdef CONFIG_RPS
326 __u32 sk_rxhash; 328 __u32 sk_rxhash;
327#endif 329#endif
330#ifdef CONFIG_NET_RX_BUSY_POLL
331 unsigned int sk_napi_id;
332 unsigned int sk_ll_usec;
333#endif
328 atomic_t sk_drops; 334 atomic_t sk_drops;
329 int sk_rcvbuf; 335 int sk_rcvbuf;
330 336
@@ -2041,18 +2047,21 @@ static inline void sk_wake_async(struct sock *sk, int how, int band)
2041 sock_wake_async(sk->sk_socket, how, band); 2047 sock_wake_async(sk->sk_socket, how, band);
2042} 2048}
2043 2049
2044#define SOCK_MIN_SNDBUF 2048 2050/* Since sk_{r,w}mem_alloc sums skb->truesize, even a small frame might
2045/* 2051 * need sizeof(sk_buff) + MTU + padding, unless net driver perform copybreak.
2046 * Since sk_rmem_alloc sums skb->truesize, even a small frame might need 2052 * Note: for send buffers, TCP works better if we can build two skbs at
2047 * sizeof(sk_buff) + MTU + padding, unless net driver perform copybreak 2053 * minimum.
2048 */ 2054 */
2049#define SOCK_MIN_RCVBUF (2048 + sizeof(struct sk_buff)) 2055#define TCP_SKB_MIN_TRUESIZE (2048 + SKB_DATA_ALIGN(sizeof(struct sk_buff)))
2056
2057#define SOCK_MIN_SNDBUF (TCP_SKB_MIN_TRUESIZE * 2)
2058#define SOCK_MIN_RCVBUF TCP_SKB_MIN_TRUESIZE
2050 2059
2051static inline void sk_stream_moderate_sndbuf(struct sock *sk) 2060static inline void sk_stream_moderate_sndbuf(struct sock *sk)
2052{ 2061{
2053 if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK)) { 2062 if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK)) {
2054 sk->sk_sndbuf = min(sk->sk_sndbuf, sk->sk_wmem_queued >> 1); 2063 sk->sk_sndbuf = min(sk->sk_sndbuf, sk->sk_wmem_queued >> 1);
2055 sk->sk_sndbuf = max(sk->sk_sndbuf, SOCK_MIN_SNDBUF); 2064 sk->sk_sndbuf = max_t(u32, sk->sk_sndbuf, SOCK_MIN_SNDBUF);
2056 } 2065 }
2057} 2066}
2058 2067
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 5bba80fbd1d9..d1980054ec75 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -61,9 +61,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
61 */ 61 */
62#define MAX_TCP_WINDOW 32767U 62#define MAX_TCP_WINDOW 32767U
63 63
64/* Offer an initial receive window of 10 mss. */
65#define TCP_DEFAULT_INIT_RCVWND 10
66
67/* Minimal accepted MSS. It is (60+60+8) - (20+20). */ 64/* Minimal accepted MSS. It is (60+60+8) - (20+20). */
68#define TCP_MIN_MSS 88U 65#define TCP_MIN_MSS 88U
69 66
@@ -1047,6 +1044,8 @@ static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
1047 rx_opt->num_sacks = 0; 1044 rx_opt->num_sacks = 0;
1048} 1045}
1049 1046
1047extern u32 tcp_default_init_rwnd(u32 mss);
1048
1050/* Determine a window scaling and initial window to offer. */ 1049/* Determine a window scaling and initial window to offer. */
1051extern void tcp_select_initial_window(int __space, __u32 mss, 1050extern void tcp_select_initial_window(int __space, __u32 mss,
1052 __u32 *rcv_wnd, __u32 *window_clamp, 1051 __u32 *rcv_wnd, __u32 *window_clamp,
@@ -1193,7 +1192,6 @@ static inline void tcp_mib_init(struct net *net)
1193static inline void tcp_clear_retrans_hints_partial(struct tcp_sock *tp) 1192static inline void tcp_clear_retrans_hints_partial(struct tcp_sock *tp)
1194{ 1193{
1195 tp->lost_skb_hint = NULL; 1194 tp->lost_skb_hint = NULL;
1196 tp->scoreboard_skb_hint = NULL;
1197} 1195}
1198 1196
1199static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp) 1197static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp)
@@ -1284,11 +1282,13 @@ static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1284#define tcp_twsk_md5_key(twsk) NULL 1282#define tcp_twsk_md5_key(twsk) NULL
1285#endif 1283#endif
1286 1284
1287extern struct tcp_md5sig_pool __percpu *tcp_alloc_md5sig_pool(struct sock *); 1285extern bool tcp_alloc_md5sig_pool(void);
1288extern void tcp_free_md5sig_pool(void);
1289 1286
1290extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); 1287extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void);
1291extern void tcp_put_md5sig_pool(void); 1288static inline void tcp_put_md5sig_pool(void)
1289{
1290 local_bh_enable();
1291}
1292 1292
1293extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *); 1293extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *);
1294extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *, 1294extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *,
@@ -1319,9 +1319,9 @@ void tcp_fastopen_cookie_gen(__be32 addr, struct tcp_fastopen_cookie *foc);
1319 1319
1320/* Fastopen key context */ 1320/* Fastopen key context */
1321struct tcp_fastopen_context { 1321struct tcp_fastopen_context {
1322 struct crypto_cipher __rcu *tfm; 1322 struct crypto_cipher *tfm;
1323 __u8 key[TCP_FASTOPEN_KEY_LENGTH]; 1323 __u8 key[TCP_FASTOPEN_KEY_LENGTH];
1324 struct rcu_head rcu; 1324 struct rcu_head rcu;
1325}; 1325};
1326 1326
1327/* write queue abstraction */ 1327/* write queue abstraction */
@@ -1540,15 +1540,14 @@ extern struct request_sock_ops tcp6_request_sock_ops;
1540 1540
1541extern void tcp_v4_destroy_sock(struct sock *sk); 1541extern void tcp_v4_destroy_sock(struct sock *sk);
1542 1542
1543extern int tcp_v4_gso_send_check(struct sk_buff *skb);
1544extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, 1543extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
1545 netdev_features_t features); 1544 netdev_features_t features);
1546extern struct sk_buff **tcp_gro_receive(struct sk_buff **head, 1545extern struct sk_buff **tcp_gro_receive(struct sk_buff **head,
1547 struct sk_buff *skb); 1546 struct sk_buff *skb);
1548extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head,
1549 struct sk_buff *skb);
1550extern int tcp_gro_complete(struct sk_buff *skb); 1547extern int tcp_gro_complete(struct sk_buff *skb);
1551extern int tcp4_gro_complete(struct sk_buff *skb); 1548
1549extern void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr,
1550 __be32 daddr);
1552 1551
1553#ifdef CONFIG_PROC_FS 1552#ifdef CONFIG_PROC_FS
1554extern int tcp4_proc_init(void); 1553extern int tcp4_proc_init(void);
@@ -1583,6 +1582,8 @@ struct tcp_request_sock_ops {
1583#endif 1582#endif
1584}; 1583};
1585 1584
1585extern int tcpv4_offload_init(void);
1586
1586extern void tcp_v4_init(void); 1587extern void tcp_v4_init(void);
1587extern void tcp_init(void); 1588extern void tcp_init(void);
1588 1589
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 938b7fd11204..48660e50ae90 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -3,56 +3,57 @@
3 3
4#include <net/checksum.h> 4#include <net/checksum.h>
5 5
6/* 6/* IPv6 transport protocols */
7 * IPv6 transport protocols
8 */
9
10extern struct proto rawv6_prot; 7extern struct proto rawv6_prot;
11extern struct proto udpv6_prot; 8extern struct proto udpv6_prot;
12extern struct proto udplitev6_prot; 9extern struct proto udplitev6_prot;
13extern struct proto tcpv6_prot; 10extern struct proto tcpv6_prot;
11extern struct proto pingv6_prot;
14 12
15struct flowi6; 13struct flowi6;
16 14
17/* extension headers */ 15/* extension headers */
18extern int ipv6_exthdrs_init(void); 16int ipv6_exthdrs_init(void);
19extern void ipv6_exthdrs_exit(void); 17void ipv6_exthdrs_exit(void);
20extern int ipv6_frag_init(void); 18int ipv6_frag_init(void);
21extern void ipv6_frag_exit(void); 19void ipv6_frag_exit(void);
22 20
23/* transport protocols */ 21/* transport protocols */
24extern int rawv6_init(void); 22int pingv6_init(void);
25extern void rawv6_exit(void); 23void pingv6_exit(void);
26extern int udpv6_init(void); 24int rawv6_init(void);
27extern void udpv6_exit(void); 25void rawv6_exit(void);
28extern int udplitev6_init(void); 26int udpv6_init(void);
29extern void udplitev6_exit(void); 27void udpv6_exit(void);
30extern int tcpv6_init(void); 28int udplitev6_init(void);
31extern void tcpv6_exit(void); 29void udplitev6_exit(void);
32 30int tcpv6_init(void);
33extern int udpv6_connect(struct sock *sk, 31void tcpv6_exit(void);
34 struct sockaddr *uaddr, 32
35 int addr_len); 33int udpv6_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
36 34
37extern int ip6_datagram_recv_ctl(struct sock *sk, 35int ip6_datagram_recv_ctl(struct sock *sk, struct msghdr *msg,
38 struct msghdr *msg, 36 struct sk_buff *skb);
39 struct sk_buff *skb); 37
40 38int ip6_datagram_send_ctl(struct net *net, struct sock *sk, struct msghdr *msg,
41extern int ip6_datagram_send_ctl(struct net *net, 39 struct flowi6 *fl6, struct ipv6_txoptions *opt,
42 struct sock *sk, 40 int *hlimit, int *tclass, int *dontfrag);
43 struct msghdr *msg, 41
44 struct flowi6 *fl6, 42void ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
45 struct ipv6_txoptions *opt, 43 __u16 srcp, __u16 destp, int bucket);
46 int *hlimit, int *tclass, 44
47 int *dontfrag); 45#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
48 46
49#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006) 47/* address family specific functions */
50
51/*
52 * address family specific functions
53 */
54extern const struct inet_connection_sock_af_ops ipv4_specific; 48extern const struct inet_connection_sock_af_ops ipv4_specific;
55 49
56extern void inet6_destroy_sock(struct sock *sk); 50void inet6_destroy_sock(struct sock *sk);
51
52#define IPV6_SEQ_DGRAM_HEADER \
53 " sl " \
54 "local_address " \
55 "remote_address " \
56 "st tx_queue rx_queue tr tm->when retrnsmt" \
57 " uid timeout inode ref pointer drops\n"
57 58
58#endif 59#endif
diff --git a/include/net/udp.h b/include/net/udp.h
index 065f379c6503..74c10ec5e74f 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -181,12 +181,15 @@ extern int udp_get_port(struct sock *sk, unsigned short snum,
181extern void udp_err(struct sk_buff *, u32); 181extern void udp_err(struct sk_buff *, u32);
182extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, 182extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
183 struct msghdr *msg, size_t len); 183 struct msghdr *msg, size_t len);
184extern int udp_push_pending_frames(struct sock *sk);
184extern void udp_flush_pending_frames(struct sock *sk); 185extern void udp_flush_pending_frames(struct sock *sk);
185extern int udp_rcv(struct sk_buff *skb); 186extern int udp_rcv(struct sk_buff *skb);
186extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg); 187extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
187extern int udp_disconnect(struct sock *sk, int flags); 188extern int udp_disconnect(struct sock *sk, int flags);
188extern unsigned int udp_poll(struct file *file, struct socket *sock, 189extern unsigned int udp_poll(struct file *file, struct socket *sock,
189 poll_table *wait); 190 poll_table *wait);
191extern struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
192 netdev_features_t features);
190extern int udp_lib_getsockopt(struct sock *sk, int level, int optname, 193extern int udp_lib_getsockopt(struct sock *sk, int level, int optname,
191 char __user *optval, int __user *optlen); 194 char __user *optval, int __user *optlen);
192extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, 195extern int udp_lib_setsockopt(struct sock *sk, int level, int optname,
@@ -262,11 +265,10 @@ extern int udp4_proc_init(void);
262extern void udp4_proc_exit(void); 265extern void udp4_proc_exit(void);
263#endif 266#endif
264 267
268extern int udpv4_offload_init(void);
269
265extern void udp_init(void); 270extern void udp_init(void);
266 271
267extern int udp4_ufo_send_check(struct sk_buff *skb);
268extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
269 netdev_features_t features);
270extern void udp_encap_enable(void); 272extern void udp_encap_enable(void);
271#if IS_ENABLED(CONFIG_IPV6) 273#if IS_ENABLED(CONFIG_IPV6)
272extern void udpv6_encap_enable(void); 274extern void udpv6_encap_enable(void);
diff --git a/include/rdma/ib.h b/include/rdma/ib.h
new file mode 100644
index 000000000000..cf8f9e700e48
--- /dev/null
+++ b/include/rdma/ib.h
@@ -0,0 +1,89 @@
1/*
2 * Copyright (c) 2010 Intel Corporation. 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#if !defined(_RDMA_IB_H)
34#define _RDMA_IB_H
35
36#include <linux/types.h>
37
38struct ib_addr {
39 union {
40 __u8 uib_addr8[16];
41 __be16 uib_addr16[8];
42 __be32 uib_addr32[4];
43 __be64 uib_addr64[2];
44 } ib_u;
45#define sib_addr8 ib_u.uib_addr8
46#define sib_addr16 ib_u.uib_addr16
47#define sib_addr32 ib_u.uib_addr32
48#define sib_addr64 ib_u.uib_addr64
49#define sib_raw ib_u.uib_addr8
50#define sib_subnet_prefix ib_u.uib_addr64[0]
51#define sib_interface_id ib_u.uib_addr64[1]
52};
53
54static inline int ib_addr_any(const struct ib_addr *a)
55{
56 return ((a->sib_addr64[0] | a->sib_addr64[1]) == 0);
57}
58
59static inline int ib_addr_loopback(const struct ib_addr *a)
60{
61 return ((a->sib_addr32[0] | a->sib_addr32[1] |
62 a->sib_addr32[2] | (a->sib_addr32[3] ^ htonl(1))) == 0);
63}
64
65static inline void ib_addr_set(struct ib_addr *addr,
66 __be32 w1, __be32 w2, __be32 w3, __be32 w4)
67{
68 addr->sib_addr32[0] = w1;
69 addr->sib_addr32[1] = w2;
70 addr->sib_addr32[2] = w3;
71 addr->sib_addr32[3] = w4;
72}
73
74static inline int ib_addr_cmp(const struct ib_addr *a1, const struct ib_addr *a2)
75{
76 return memcmp(a1, a2, sizeof(struct ib_addr));
77}
78
79struct sockaddr_ib {
80 unsigned short int sib_family; /* AF_IB */
81 __be16 sib_pkey;
82 __be32 sib_flowinfo;
83 struct ib_addr sib_addr;
84 __be64 sib_sid;
85 __be64 sib_sid_mask;
86 __u64 sib_scope_id;
87};
88
89#endif /* _RDMA_IB_H */
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index 99965395c5f3..f3ac0f2c4c66 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -102,11 +102,7 @@ void rdma_addr_cancel(struct rdma_dev_addr *addr);
102int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, 102int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev,
103 const unsigned char *dst_dev_addr); 103 const unsigned char *dst_dev_addr);
104 104
105static inline int ip_addr_size(struct sockaddr *addr) 105int rdma_addr_size(struct sockaddr *addr);
106{
107 return addr->sa_family == AF_INET6 ?
108 sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in);
109}
110 106
111static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr) 107static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr)
112{ 108{
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index 8275e539bace..125f8714301d 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -402,6 +402,12 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
402 struct ib_ah_attr *ah_attr); 402 struct ib_ah_attr *ah_attr);
403 403
404/** 404/**
405 * ib_sa_pack_path - Conert a path record from struct ib_sa_path_rec
406 * to IB MAD wire format.
407 */
408void ib_sa_pack_path(struct ib_sa_path_rec *rec, void *attribute);
409
410/**
405 * ib_sa_unpack_path - Convert a path record from MAD format to struct 411 * ib_sa_unpack_path - Convert a path record from MAD format to struct
406 * ib_sa_path_rec. 412 * ib_sa_path_rec.
407 */ 413 */
@@ -418,4 +424,5 @@ int ib_sa_guid_info_rec_query(struct ib_sa_client *client,
418 void *context), 424 void *context),
419 void *context, 425 void *context,
420 struct ib_sa_query **sa_query); 426 struct ib_sa_query **sa_query);
427
421#endif /* IB_SA_H */ 428#endif /* IB_SA_H */
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 98cc4b29fc5b..645c3cedce9c 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -610,7 +610,21 @@ enum ib_qp_type {
610 IB_QPT_RAW_PACKET = 8, 610 IB_QPT_RAW_PACKET = 8,
611 IB_QPT_XRC_INI = 9, 611 IB_QPT_XRC_INI = 9,
612 IB_QPT_XRC_TGT, 612 IB_QPT_XRC_TGT,
613 IB_QPT_MAX 613 IB_QPT_MAX,
614 /* Reserve a range for qp types internal to the low level driver.
615 * These qp types will not be visible at the IB core layer, so the
616 * IB_QPT_MAX usages should not be affected in the core layer
617 */
618 IB_QPT_RESERVED1 = 0x1000,
619 IB_QPT_RESERVED2,
620 IB_QPT_RESERVED3,
621 IB_QPT_RESERVED4,
622 IB_QPT_RESERVED5,
623 IB_QPT_RESERVED6,
624 IB_QPT_RESERVED7,
625 IB_QPT_RESERVED8,
626 IB_QPT_RESERVED9,
627 IB_QPT_RESERVED10,
614}; 628};
615 629
616enum ib_qp_create_flags { 630enum ib_qp_create_flags {
@@ -766,6 +780,19 @@ enum ib_wr_opcode {
766 IB_WR_MASKED_ATOMIC_CMP_AND_SWP, 780 IB_WR_MASKED_ATOMIC_CMP_AND_SWP,
767 IB_WR_MASKED_ATOMIC_FETCH_AND_ADD, 781 IB_WR_MASKED_ATOMIC_FETCH_AND_ADD,
768 IB_WR_BIND_MW, 782 IB_WR_BIND_MW,
783 /* reserve values for low level drivers' internal use.
784 * These values will not be used at all in the ib core layer.
785 */
786 IB_WR_RESERVED1 = 0xf0,
787 IB_WR_RESERVED2,
788 IB_WR_RESERVED3,
789 IB_WR_RESERVED4,
790 IB_WR_RESERVED5,
791 IB_WR_RESERVED6,
792 IB_WR_RESERVED7,
793 IB_WR_RESERVED8,
794 IB_WR_RESERVED9,
795 IB_WR_RESERVED10,
769}; 796};
770 797
771enum ib_send_flags { 798enum ib_send_flags {
@@ -773,7 +800,11 @@ enum ib_send_flags {
773 IB_SEND_SIGNALED = (1<<1), 800 IB_SEND_SIGNALED = (1<<1),
774 IB_SEND_SOLICITED = (1<<2), 801 IB_SEND_SOLICITED = (1<<2),
775 IB_SEND_INLINE = (1<<3), 802 IB_SEND_INLINE = (1<<3),
776 IB_SEND_IP_CSUM = (1<<4) 803 IB_SEND_IP_CSUM = (1<<4),
804
805 /* reserve bits 26-31 for low level drivers' internal use */
806 IB_SEND_RESERVED_START = (1 << 26),
807 IB_SEND_RESERVED_END = (1 << 31),
777}; 808};
778 809
779struct ib_sge { 810struct ib_sge {
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h
index ad3a3142383a..1ed2088dc9f5 100644
--- a/include/rdma/rdma_cm.h
+++ b/include/rdma/rdma_cm.h
@@ -70,6 +70,11 @@ enum rdma_port_space {
70 RDMA_PS_UDP = 0x0111, 70 RDMA_PS_UDP = 0x0111,
71}; 71};
72 72
73#define RDMA_IB_IP_PS_MASK 0xFFFFFFFFFFFF0000ULL
74#define RDMA_IB_IP_PS_TCP 0x0000000001060000ULL
75#define RDMA_IB_IP_PS_UDP 0x0000000001110000ULL
76#define RDMA_IB_IP_PS_IB 0x00000000013F0000ULL
77
73struct rdma_addr { 78struct rdma_addr {
74 struct sockaddr_storage src_addr; 79 struct sockaddr_storage src_addr;
75 struct sockaddr_storage dst_addr; 80 struct sockaddr_storage dst_addr;
@@ -93,6 +98,7 @@ struct rdma_conn_param {
93 /* Fields below ignored if a QP is created on the rdma_cm_id. */ 98 /* Fields below ignored if a QP is created on the rdma_cm_id. */
94 u8 srq; 99 u8 srq;
95 u32 qp_num; 100 u32 qp_num;
101 u32 qkey;
96}; 102};
97 103
98struct rdma_ud_param { 104struct rdma_ud_param {
@@ -367,4 +373,11 @@ int rdma_set_reuseaddr(struct rdma_cm_id *id, int reuse);
367 */ 373 */
368int rdma_set_afonly(struct rdma_cm_id *id, int afonly); 374int rdma_set_afonly(struct rdma_cm_id *id, int afonly);
369 375
376 /**
377 * rdma_get_service_id - Return the IB service ID for a specified address.
378 * @id: Communication identifier associated with the address.
379 * @addr: Address for the service ID.
380 */
381__be64 rdma_get_service_id(struct rdma_cm_id *id, struct sockaddr *addr);
382
370#endif /* RDMA_CM_H */ 383#endif /* RDMA_CM_H */
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index fe7f06c86f68..9d28ded2a3f4 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -489,6 +489,11 @@ enum iscsi_param {
489 489
490 ISCSI_PARAM_CHAP_IN_IDX, 490 ISCSI_PARAM_CHAP_IN_IDX,
491 ISCSI_PARAM_CHAP_OUT_IDX, 491 ISCSI_PARAM_CHAP_OUT_IDX,
492
493 ISCSI_PARAM_BOOT_ROOT,
494 ISCSI_PARAM_BOOT_NIC,
495 ISCSI_PARAM_BOOT_TARGET,
496
492 /* must always be last */ 497 /* must always be last */
493 ISCSI_PARAM_MAX, 498 ISCSI_PARAM_MAX,
494}; 499};
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 09c041e6c35f..4265a4bb83cd 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -287,6 +287,10 @@ struct iscsi_session {
287 char *targetalias; 287 char *targetalias;
288 char *ifacename; 288 char *ifacename;
289 char *initiatorname; 289 char *initiatorname;
290 char *boot_root;
291 char *boot_nic;
292 char *boot_target;
293
290 /* control data */ 294 /* control data */
291 struct iscsi_transport *tt; 295 struct iscsi_transport *tt;
292 struct Scsi_Host *host; 296 struct Scsi_Host *host;
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index e2c1e66d58ae..f843dd8722a9 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -608,7 +608,7 @@ struct sas_ssp_task {
608 u8 enable_first_burst:1; 608 u8 enable_first_burst:1;
609 enum task_attribute task_attr; 609 enum task_attribute task_attr;
610 u8 task_prio; 610 u8 task_prio;
611 u8 cdb[16]; 611 struct scsi_cmnd *cmd;
612}; 612};
613 613
614struct sas_task { 614struct sas_task {
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 66216c1acb48..4b87d99e7fa1 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -10,9 +10,14 @@
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/scatterlist.h> 12#include <linux/scatterlist.h>
13#include <linux/kernel.h>
13 14
14struct scsi_cmnd; 15struct scsi_cmnd;
15 16
17enum scsi_timeouts {
18 SCSI_DEFAULT_EH_TIMEOUT = 10 * HZ,
19};
20
16/* 21/*
17 * The maximum number of SG segments that we will put inside a 22 * The maximum number of SG segments that we will put inside a
18 * scatterlist (unless chaining is used). Should ideally fit inside a 23 * scatterlist (unless chaining is used). Should ideally fit inside a
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index cc645876d147..a44954c7cdc2 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -113,6 +113,7 @@ struct scsi_device {
113 * scsi_devinfo.[hc]. For now used only to 113 * scsi_devinfo.[hc]. For now used only to
114 * pass settings from slave_alloc to scsi 114 * pass settings from slave_alloc to scsi
115 * core. */ 115 * core. */
116 unsigned int eh_timeout; /* Error handling timeout */
116 unsigned writeable:1; 117 unsigned writeable:1;
117 unsigned removable:1; 118 unsigned removable:1;
118 unsigned changed:1; /* Data invalid due to media change */ 119 unsigned changed:1; /* Data invalid due to media change */
diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
index cc1f3e786ad7..447d2d7466fc 100644
--- a/include/scsi/scsi_devinfo.h
+++ b/include/scsi/scsi_devinfo.h
@@ -31,4 +31,5 @@
31#define BLIST_MAX_512 0x800000 /* maximum 512 sector cdb length */ 31#define BLIST_MAX_512 0x800000 /* maximum 512 sector cdb length */
32#define BLIST_ATTACH_PQ3 0x1000000 /* Scan: Attach to PQ3 devices */ 32#define BLIST_ATTACH_PQ3 0x1000000 /* Scan: Attach to PQ3 devices */
33#define BLIST_NO_DIF 0x2000000 /* Disable T10 PI (DIF) */ 33#define BLIST_NO_DIF 0x2000000 /* Disable T10 PI (DIF) */
34#define BLIST_SKIP_VPD_PAGES 0x4000000 /* Ignore SBC-3 VPD pages */
34#endif 35#endif
diff --git a/include/sound/control.h b/include/sound/control.h
index 34bc93d80d55..5358892b1b39 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -233,7 +233,8 @@ snd_ctl_add_slave_uncached(struct snd_kcontrol *master,
233int snd_ctl_add_vmaster_hook(struct snd_kcontrol *kctl, 233int snd_ctl_add_vmaster_hook(struct snd_kcontrol *kctl,
234 void (*hook)(void *private_data, int), 234 void (*hook)(void *private_data, int),
235 void *private_data); 235 void *private_data);
236void snd_ctl_sync_vmaster_hook(struct snd_kcontrol *kctl); 236void snd_ctl_sync_vmaster(struct snd_kcontrol *kctl, bool hook_only);
237#define snd_ctl_sync_vmaster_hook(kctl) snd_ctl_sync_vmaster(kctl, true)
237 238
238/* 239/*
239 * Helper functions for jack-detection controls 240 * Helper functions for jack-detection controls
diff --git a/include/sound/core.h b/include/sound/core.h
index 5bfe5136441c..c586617cfa0d 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -30,7 +30,7 @@
30 30
31/* number of supported soundcards */ 31/* number of supported soundcards */
32#ifdef CONFIG_SND_DYNAMIC_MINORS 32#ifdef CONFIG_SND_DYNAMIC_MINORS
33#define SNDRV_CARDS 32 33#define SNDRV_CARDS CONFIG_SND_MAX_CARDS
34#else 34#else
35#define SNDRV_CARDS 8 /* don't change - minor numbers */ 35#define SNDRV_CARDS 8 /* don't change - minor numbers */
36#endif 36#endif
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index b48792fe386b..84b10f9a2832 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -384,7 +384,7 @@ struct snd_pcm_substream {
384 unsigned int dma_buf_id; 384 unsigned int dma_buf_id;
385 size_t dma_max; 385 size_t dma_max;
386 /* -- hardware operations -- */ 386 /* -- hardware operations -- */
387 struct snd_pcm_ops *ops; 387 const struct snd_pcm_ops *ops;
388 /* -- runtime information -- */ 388 /* -- runtime information -- */
389 struct snd_pcm_runtime *runtime; 389 struct snd_pcm_runtime *runtime;
390 /* -- timer section -- */ 390 /* -- timer section -- */
@@ -871,7 +871,8 @@ const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format);
871int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames); 871int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames);
872snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsigned, int big_endian); 872snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsigned, int big_endian);
873 873
874void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops); 874void snd_pcm_set_ops(struct snd_pcm * pcm, int direction,
875 const struct snd_pcm_ops *ops);
875void snd_pcm_set_sync(struct snd_pcm_substream *substream); 876void snd_pcm_set_sync(struct snd_pcm_substream *substream);
876int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream); 877int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream);
877int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, 878int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
diff --git a/include/sound/rt5640.h b/include/sound/rt5640.h
new file mode 100644
index 000000000000..27cc75ed67f8
--- /dev/null
+++ b/include/sound/rt5640.h
@@ -0,0 +1,22 @@
1/*
2 * linux/sound/rt5640.h -- Platform data for RT5640
3 *
4 * Copyright 2011 Realtek Microelectronics
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_SND_RT5640_H
12#define __LINUX_SND_RT5640_H
13
14struct rt5640_platform_data {
15 /* IN1 & IN2 can optionally be differential */
16 bool in1_diff;
17 bool in2_diff;
18
19 int ldo1_en; /* GPIO for LDO1_EN */
20};
21
22#endif
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 385c6329a967..3e479f4e15f5 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -311,6 +311,8 @@ struct device;
311#define SND_SOC_DAPM_POST_PMD 0x8 /* after widget power down */ 311#define SND_SOC_DAPM_POST_PMD 0x8 /* after widget power down */
312#define SND_SOC_DAPM_PRE_REG 0x10 /* before audio path setup */ 312#define SND_SOC_DAPM_PRE_REG 0x10 /* before audio path setup */
313#define SND_SOC_DAPM_POST_REG 0x20 /* after audio path setup */ 313#define SND_SOC_DAPM_POST_REG 0x20 /* after audio path setup */
314#define SND_SOC_DAPM_WILL_PMU 0x40 /* called at start of sequence */
315#define SND_SOC_DAPM_WILL_PMD 0x80 /* called at start of sequence */
314#define SND_SOC_DAPM_PRE_POST_PMD \ 316#define SND_SOC_DAPM_PRE_POST_PMD \
315 (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD) 317 (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)
316 318
@@ -479,7 +481,6 @@ struct snd_soc_dapm_route {
479/* dapm audio path between two widgets */ 481/* dapm audio path between two widgets */
480struct snd_soc_dapm_path { 482struct snd_soc_dapm_path {
481 const char *name; 483 const char *name;
482 const char *long_name;
483 484
484 /* source (input) and sink (output) widgets */ 485 /* source (input) and sink (output) widgets */
485 struct snd_soc_dapm_widget *source; 486 struct snd_soc_dapm_widget *source;
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 85c15226103b..6eabee7ec15a 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -340,7 +340,7 @@ struct snd_soc_jack_gpio;
340 340
341typedef int (*hw_write_t)(void *,const char* ,int); 341typedef int (*hw_write_t)(void *,const char* ,int);
342 342
343extern struct snd_ac97_bus_ops soc_ac97_ops; 343extern struct snd_ac97_bus_ops *soc_ac97_ops;
344 344
345enum snd_soc_control_type { 345enum snd_soc_control_type {
346 SND_SOC_I2C = 1, 346 SND_SOC_I2C = 1,
@@ -467,6 +467,8 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
467 struct snd_ac97_bus_ops *ops, int num); 467 struct snd_ac97_bus_ops *ops, int num);
468void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); 468void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
469 469
470int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops);
471
470/* 472/*
471 *Controls 473 *Controls
472 */ 474 */
diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h
index 23a87d0cd72c..e5d09d242ba3 100644
--- a/include/target/iscsi/iscsi_transport.h
+++ b/include/target/iscsi/iscsi_transport.h
@@ -34,8 +34,6 @@ extern void iscsit_put_transport(struct iscsit_transport *);
34/* 34/*
35 * From iscsi_target.c 35 * From iscsi_target.c
36 */ 36 */
37extern int iscsit_add_reject_from_cmd(u8, int, int, unsigned char *,
38 struct iscsi_cmd *);
39extern int iscsit_setup_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *, 37extern int iscsit_setup_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *,
40 unsigned char *); 38 unsigned char *);
41extern void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *); 39extern void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *);
@@ -45,18 +43,26 @@ extern int iscsit_check_dataout_hdr(struct iscsi_conn *, unsigned char *,
45 struct iscsi_cmd **); 43 struct iscsi_cmd **);
46extern int iscsit_check_dataout_payload(struct iscsi_cmd *, struct iscsi_data *, 44extern int iscsit_check_dataout_payload(struct iscsi_cmd *, struct iscsi_data *,
47 bool); 45 bool);
48extern int iscsit_handle_nop_out(struct iscsi_conn *, struct iscsi_cmd *, 46extern int iscsit_setup_nop_out(struct iscsi_conn *, struct iscsi_cmd *,
49 unsigned char *); 47 struct iscsi_nopout *);
48extern int iscsit_process_nop_out(struct iscsi_conn *, struct iscsi_cmd *,
49 struct iscsi_nopout *);
50extern int iscsit_handle_logout_cmd(struct iscsi_conn *, struct iscsi_cmd *, 50extern int iscsit_handle_logout_cmd(struct iscsi_conn *, struct iscsi_cmd *,
51 unsigned char *); 51 unsigned char *);
52extern int iscsit_handle_task_mgt_cmd(struct iscsi_conn *, struct iscsi_cmd *, 52extern int iscsit_handle_task_mgt_cmd(struct iscsi_conn *, struct iscsi_cmd *,
53 unsigned char *); 53 unsigned char *);
54extern int iscsit_setup_text_cmd(struct iscsi_conn *, struct iscsi_cmd *,
55 struct iscsi_text *);
56extern int iscsit_process_text_cmd(struct iscsi_conn *, struct iscsi_cmd *,
57 struct iscsi_text *);
54extern void iscsit_build_rsp_pdu(struct iscsi_cmd *, struct iscsi_conn *, 58extern void iscsit_build_rsp_pdu(struct iscsi_cmd *, struct iscsi_conn *,
55 bool, struct iscsi_scsi_rsp *); 59 bool, struct iscsi_scsi_rsp *);
56extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *, 60extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *,
57 struct iscsi_nopin *, bool); 61 struct iscsi_nopin *, bool);
58extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *, 62extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *,
59 struct iscsi_tm_rsp *); 63 struct iscsi_tm_rsp *);
64extern int iscsit_build_text_rsp(struct iscsi_cmd *, struct iscsi_conn *,
65 struct iscsi_text_rsp *);
60extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *, 66extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *,
61 struct iscsi_reject *); 67 struct iscsi_reject *);
62extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *, 68extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *,
@@ -67,6 +73,10 @@ extern int iscsit_logout_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
67 */ 73 */
68extern void iscsit_increment_maxcmdsn(struct iscsi_cmd *, struct iscsi_session *); 74extern void iscsit_increment_maxcmdsn(struct iscsi_cmd *, struct iscsi_session *);
69/* 75/*
76 * From iscsi_target_erl0.c
77 */
78extern void iscsit_cause_connection_reinstatement(struct iscsi_conn *, int);
79/*
70 * From iscsi_target_erl1.c 80 * From iscsi_target_erl1.c
71 */ 81 */
72extern void iscsit_stop_dataout_timer(struct iscsi_cmd *); 82extern void iscsit_stop_dataout_timer(struct iscsi_cmd *);
@@ -80,4 +90,5 @@ extern int iscsit_tmr_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
80 * From iscsi_target_util.c 90 * From iscsi_target_util.c
81 */ 91 */
82extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, gfp_t); 92extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, gfp_t);
83extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *, __be32); 93extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *,
94 unsigned char *, __be32);
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 4ea4f985f394..e34fc904f2e1 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -218,14 +218,11 @@ enum tcm_tmreq_table {
218 218
219/* fabric independent task management response values */ 219/* fabric independent task management response values */
220enum tcm_tmrsp_table { 220enum tcm_tmrsp_table {
221 TMR_FUNCTION_COMPLETE = 0, 221 TMR_FUNCTION_COMPLETE = 1,
222 TMR_TASK_DOES_NOT_EXIST = 1, 222 TMR_TASK_DOES_NOT_EXIST = 2,
223 TMR_LUN_DOES_NOT_EXIST = 2, 223 TMR_LUN_DOES_NOT_EXIST = 3,
224 TMR_TASK_STILL_ALLEGIANT = 3, 224 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 4,
225 TMR_TASK_FAILOVER_NOT_SUPPORTED = 4, 225 TMR_FUNCTION_REJECTED = 5,
226 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5,
227 TMR_FUNCTION_AUTHORIZATION_FAILED = 6,
228 TMR_FUNCTION_REJECTED = 255,
229}; 226};
230 227
231/* 228/*
@@ -339,8 +336,6 @@ struct t10_pr_registration {
339 /* Used during APTPL metadata reading */ 336 /* Used during APTPL metadata reading */
340#define PR_APTPL_MAX_TPORT_LEN 256 337#define PR_APTPL_MAX_TPORT_LEN 256
341 unsigned char pr_tport[PR_APTPL_MAX_TPORT_LEN]; 338 unsigned char pr_tport[PR_APTPL_MAX_TPORT_LEN];
342 /* For writing out live meta data */
343 unsigned char *pr_aptpl_buf;
344 u16 pr_aptpl_rpti; 339 u16 pr_aptpl_rpti;
345 u16 pr_reg_tpgt; 340 u16 pr_reg_tpgt;
346 /* Reservation effects all target ports */ 341 /* Reservation effects all target ports */
@@ -374,9 +369,7 @@ struct t10_reservation {
374 /* Activate Persistence across Target Power Loss enabled 369 /* Activate Persistence across Target Power Loss enabled
375 * for SCSI device */ 370 * for SCSI device */
376 int pr_aptpl_active; 371 int pr_aptpl_active;
377 /* Used by struct t10_reservation->pr_aptpl_buf_len */
378#define PR_APTPL_BUF_LEN 8192 372#define PR_APTPL_BUF_LEN 8192
379 u32 pr_aptpl_buf_len;
380 u32 pr_generation; 373 u32 pr_generation;
381 spinlock_t registration_lock; 374 spinlock_t registration_lock;
382 spinlock_t aptpl_reg_lock; 375 spinlock_t aptpl_reg_lock;
@@ -424,8 +417,6 @@ struct se_cmd {
424 int sam_task_attr; 417 int sam_task_attr;
425 /* Transport protocol dependent state, see transport_state_table */ 418 /* Transport protocol dependent state, see transport_state_table */
426 enum transport_state_table t_state; 419 enum transport_state_table t_state;
427 /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */
428 unsigned check_release:1;
429 unsigned cmd_wait_set:1; 420 unsigned cmd_wait_set:1;
430 unsigned unknown_data_length:1; 421 unsigned unknown_data_length:1;
431 /* See se_cmd_flags_table */ 422 /* See se_cmd_flags_table */
@@ -458,7 +449,6 @@ struct se_cmd {
458 unsigned char *t_task_cdb; 449 unsigned char *t_task_cdb;
459 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; 450 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
460 unsigned long long t_task_lba; 451 unsigned long long t_task_lba;
461 atomic_t t_fe_count;
462 unsigned int transport_state; 452 unsigned int transport_state;
463#define CMD_T_ABORTED (1 << 0) 453#define CMD_T_ABORTED (1 << 0)
464#define CMD_T_ACTIVE (1 << 1) 454#define CMD_T_ACTIVE (1 << 1)
@@ -802,11 +792,12 @@ struct se_portal_group {
802 struct target_core_fabric_ops *se_tpg_tfo; 792 struct target_core_fabric_ops *se_tpg_tfo;
803 struct se_wwn *se_tpg_wwn; 793 struct se_wwn *se_tpg_wwn;
804 struct config_group tpg_group; 794 struct config_group tpg_group;
805 struct config_group *tpg_default_groups[6]; 795 struct config_group *tpg_default_groups[7];
806 struct config_group tpg_lun_group; 796 struct config_group tpg_lun_group;
807 struct config_group tpg_np_group; 797 struct config_group tpg_np_group;
808 struct config_group tpg_acl_group; 798 struct config_group tpg_acl_group;
809 struct config_group tpg_attrib_group; 799 struct config_group tpg_attrib_group;
800 struct config_group tpg_auth_group;
810 struct config_group tpg_param_group; 801 struct config_group tpg_param_group;
811}; 802};
812 803
diff --git a/include/target/target_core_configfs.h b/include/target/target_core_configfs.h
index 612509592ffd..713c5004f4ae 100644
--- a/include/target/target_core_configfs.h
+++ b/include/target/target_core_configfs.h
@@ -23,6 +23,7 @@ struct target_fabric_configfs_template {
23 struct config_item_type tfc_tpg_np_cit; 23 struct config_item_type tfc_tpg_np_cit;
24 struct config_item_type tfc_tpg_np_base_cit; 24 struct config_item_type tfc_tpg_np_base_cit;
25 struct config_item_type tfc_tpg_attrib_cit; 25 struct config_item_type tfc_tpg_attrib_cit;
26 struct config_item_type tfc_tpg_auth_cit;
26 struct config_item_type tfc_tpg_param_cit; 27 struct config_item_type tfc_tpg_param_cit;
27 struct config_item_type tfc_tpg_nacl_cit; 28 struct config_item_type tfc_tpg_nacl_cit;
28 struct config_item_type tfc_tpg_nacl_base_cit; 29 struct config_item_type tfc_tpg_nacl_base_cit;
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 1dcce9cc99b9..7a16178424f9 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -61,7 +61,7 @@ struct target_core_fabric_ops {
61 int (*get_cmd_state)(struct se_cmd *); 61 int (*get_cmd_state)(struct se_cmd *);
62 int (*queue_data_in)(struct se_cmd *); 62 int (*queue_data_in)(struct se_cmd *);
63 int (*queue_status)(struct se_cmd *); 63 int (*queue_status)(struct se_cmd *);
64 int (*queue_tm_rsp)(struct se_cmd *); 64 void (*queue_tm_rsp)(struct se_cmd *);
65 /* 65 /*
66 * fabric module calls for target_core_fabric_configfs.c 66 * fabric module calls for target_core_fabric_configfs.c
67 */ 67 */
diff --git a/include/target/target_core_fabric_configfs.h b/include/target/target_core_fabric_configfs.h
index a26fb7586a09..b32a14905cfa 100644
--- a/include/target/target_core_fabric_configfs.h
+++ b/include/target/target_core_fabric_configfs.h
@@ -62,6 +62,17 @@ static struct target_fabric_tpg_attrib_attribute _fabric##_tpg_attrib_##_name =
62 _fabric##_tpg_attrib_show_##_name, \ 62 _fabric##_tpg_attrib_show_##_name, \
63 _fabric##_tpg_attrib_store_##_name); 63 _fabric##_tpg_attrib_store_##_name);
64 64
65CONFIGFS_EATTR_STRUCT(target_fabric_tpg_auth, se_portal_group);
66#define TF_TPG_AUTH_ATTR(_fabric, _name, _mode) \
67static struct target_fabric_tpg_auth_attribute _fabric##_tpg_auth_##_name = \
68 __CONFIGFS_EATTR(_name, _mode, \
69 _fabric##_tpg_auth_show_##_name, \
70 _fabric##_tpg_auth_store_##_name);
71
72#define TF_TPG_AUTH_ATTR_RO(_fabric, _name) \
73static struct target_fabric_tpg_auth_attribute _fabric##_tpg_auth_##_name = \
74 __CONFIGFS_EATTR_RO(_name, \
75 _fabric##_tpg_auth_show_##_name);
65 76
66CONFIGFS_EATTR_STRUCT(target_fabric_tpg_param, se_portal_group); 77CONFIGFS_EATTR_STRUCT(target_fabric_tpg_param, se_portal_group);
67#define TF_TPG_PARAM_ATTR(_fabric, _name, _mode) \ 78#define TF_TPG_PARAM_ATTR(_fabric, _name, _mode) \
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index 1905ca8dd399..02e1003568a4 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -44,6 +44,10 @@
44#define DEFINE_EVENT(template, name, proto, args) \ 44#define DEFINE_EVENT(template, name, proto, args) \
45 DEFINE_TRACE(name) 45 DEFINE_TRACE(name)
46 46
47#undef DEFINE_EVENT_FN
48#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg) \
49 DEFINE_TRACE_FN(name, reg, unreg)
50
47#undef DEFINE_EVENT_PRINT 51#undef DEFINE_EVENT_PRINT
48#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ 52#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
49 DEFINE_TRACE(name) 53 DEFINE_TRACE(name)
@@ -91,6 +95,7 @@
91#undef TRACE_EVENT_CONDITION 95#undef TRACE_EVENT_CONDITION
92#undef DECLARE_EVENT_CLASS 96#undef DECLARE_EVENT_CLASS
93#undef DEFINE_EVENT 97#undef DEFINE_EVENT
98#undef DEFINE_EVENT_FN
94#undef DEFINE_EVENT_PRINT 99#undef DEFINE_EVENT_PRINT
95#undef DEFINE_EVENT_CONDITION 100#undef DEFINE_EVENT_CONDITION
96#undef TRACE_HEADER_MULTI_READ 101#undef TRACE_HEADER_MULTI_READ
diff --git a/include/trace/events/9p.h b/include/trace/events/9p.h
index beeaed8398ec..a0666362c111 100644
--- a/include/trace/events/9p.h
+++ b/include/trace/events/9p.h
@@ -143,31 +143,9 @@ TRACE_EVENT(9p_protocol_dump,
143 __entry->tag = pdu->tag; 143 __entry->tag = pdu->tag;
144 memcpy(__entry->line, pdu->sdata, P9_PROTO_DUMP_SZ); 144 memcpy(__entry->line, pdu->sdata, P9_PROTO_DUMP_SZ);
145 ), 145 ),
146 TP_printk("clnt %lu %s(tag = %d)\n%.3x: " 146 TP_printk("clnt %lu %s(tag = %d)\n%.3x: %16ph\n%.3x: %16ph\n",
147 "%02x %02x %02x %02x %02x %02x %02x %02x " 147 (unsigned long)__entry->clnt, show_9p_op(__entry->type),
148 "%02x %02x %02x %02x %02x %02x %02x %02x\n" 148 __entry->tag, 0, __entry->line, 16, __entry->line + 16)
149 "%.3x: "
150 "%02x %02x %02x %02x %02x %02x %02x %02x "
151 "%02x %02x %02x %02x %02x %02x %02x %02x\n",
152 (long)__entry->clnt, show_9p_op(__entry->type),
153 __entry->tag, 0,
154 __entry->line[0], __entry->line[1],
155 __entry->line[2], __entry->line[3],
156 __entry->line[4], __entry->line[5],
157 __entry->line[6], __entry->line[7],
158 __entry->line[8], __entry->line[9],
159 __entry->line[10], __entry->line[11],
160 __entry->line[12], __entry->line[13],
161 __entry->line[14], __entry->line[15],
162 16,
163 __entry->line[16], __entry->line[17],
164 __entry->line[18], __entry->line[19],
165 __entry->line[20], __entry->line[21],
166 __entry->line[22], __entry->line[23],
167 __entry->line[24], __entry->line[25],
168 __entry->line[26], __entry->line[27],
169 __entry->line[28], __entry->line[29],
170 __entry->line[30], __entry->line[31])
171 ); 149 );
172 150
173#endif /* _TRACE_9P_H */ 151#endif /* _TRACE_9P_H */
diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h
index 3cc5a0b278c3..5ebda976ea93 100644
--- a/include/trace/events/bcache.h
+++ b/include/trace/events/bcache.h
@@ -9,9 +9,7 @@
9struct search; 9struct search;
10 10
11DECLARE_EVENT_CLASS(bcache_request, 11DECLARE_EVENT_CLASS(bcache_request,
12
13 TP_PROTO(struct search *s, struct bio *bio), 12 TP_PROTO(struct search *s, struct bio *bio),
14
15 TP_ARGS(s, bio), 13 TP_ARGS(s, bio),
16 14
17 TP_STRUCT__entry( 15 TP_STRUCT__entry(
@@ -22,7 +20,6 @@ DECLARE_EVENT_CLASS(bcache_request,
22 __field(dev_t, orig_sector ) 20 __field(dev_t, orig_sector )
23 __field(unsigned int, nr_sector ) 21 __field(unsigned int, nr_sector )
24 __array(char, rwbs, 6 ) 22 __array(char, rwbs, 6 )
25 __array(char, comm, TASK_COMM_LEN )
26 ), 23 ),
27 24
28 TP_fast_assign( 25 TP_fast_assign(
@@ -33,36 +30,66 @@ DECLARE_EVENT_CLASS(bcache_request,
33 __entry->orig_sector = bio->bi_sector - 16; 30 __entry->orig_sector = bio->bi_sector - 16;
34 __entry->nr_sector = bio->bi_size >> 9; 31 __entry->nr_sector = bio->bi_size >> 9;
35 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 32 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
36 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
37 ), 33 ),
38 34
39 TP_printk("%d,%d %s %llu + %u [%s] (from %d,%d @ %llu)", 35 TP_printk("%d,%d %s %llu + %u (from %d,%d @ %llu)",
40 MAJOR(__entry->dev), MINOR(__entry->dev), 36 MAJOR(__entry->dev), MINOR(__entry->dev),
41 __entry->rwbs, 37 __entry->rwbs, (unsigned long long)__entry->sector,
42 (unsigned long long)__entry->sector, 38 __entry->nr_sector, __entry->orig_major, __entry->orig_minor,
43 __entry->nr_sector, __entry->comm,
44 __entry->orig_major, __entry->orig_minor,
45 (unsigned long long)__entry->orig_sector) 39 (unsigned long long)__entry->orig_sector)
46); 40);
47 41
48DEFINE_EVENT(bcache_request, bcache_request_start, 42DECLARE_EVENT_CLASS(bkey,
43 TP_PROTO(struct bkey *k),
44 TP_ARGS(k),
49 45
50 TP_PROTO(struct search *s, struct bio *bio), 46 TP_STRUCT__entry(
47 __field(u32, size )
48 __field(u32, inode )
49 __field(u64, offset )
50 __field(bool, dirty )
51 ),
51 52
52 TP_ARGS(s, bio) 53 TP_fast_assign(
54 __entry->inode = KEY_INODE(k);
55 __entry->offset = KEY_OFFSET(k);
56 __entry->size = KEY_SIZE(k);
57 __entry->dirty = KEY_DIRTY(k);
58 ),
59
60 TP_printk("%u:%llu len %u dirty %u", __entry->inode,
61 __entry->offset, __entry->size, __entry->dirty)
53); 62);
54 63
55DEFINE_EVENT(bcache_request, bcache_request_end, 64DECLARE_EVENT_CLASS(btree_node,
65 TP_PROTO(struct btree *b),
66 TP_ARGS(b),
67
68 TP_STRUCT__entry(
69 __field(size_t, bucket )
70 ),
56 71
72 TP_fast_assign(
73 __entry->bucket = PTR_BUCKET_NR(b->c, &b->key, 0);
74 ),
75
76 TP_printk("bucket %zu", __entry->bucket)
77);
78
79/* request.c */
80
81DEFINE_EVENT(bcache_request, bcache_request_start,
57 TP_PROTO(struct search *s, struct bio *bio), 82 TP_PROTO(struct search *s, struct bio *bio),
83 TP_ARGS(s, bio)
84);
58 85
86DEFINE_EVENT(bcache_request, bcache_request_end,
87 TP_PROTO(struct search *s, struct bio *bio),
59 TP_ARGS(s, bio) 88 TP_ARGS(s, bio)
60); 89);
61 90
62DECLARE_EVENT_CLASS(bcache_bio, 91DECLARE_EVENT_CLASS(bcache_bio,
63
64 TP_PROTO(struct bio *bio), 92 TP_PROTO(struct bio *bio),
65
66 TP_ARGS(bio), 93 TP_ARGS(bio),
67 94
68 TP_STRUCT__entry( 95 TP_STRUCT__entry(
@@ -70,7 +97,6 @@ DECLARE_EVENT_CLASS(bcache_bio,
70 __field(sector_t, sector ) 97 __field(sector_t, sector )
71 __field(unsigned int, nr_sector ) 98 __field(unsigned int, nr_sector )
72 __array(char, rwbs, 6 ) 99 __array(char, rwbs, 6 )
73 __array(char, comm, TASK_COMM_LEN )
74 ), 100 ),
75 101
76 TP_fast_assign( 102 TP_fast_assign(
@@ -78,191 +104,328 @@ DECLARE_EVENT_CLASS(bcache_bio,
78 __entry->sector = bio->bi_sector; 104 __entry->sector = bio->bi_sector;
79 __entry->nr_sector = bio->bi_size >> 9; 105 __entry->nr_sector = bio->bi_size >> 9;
80 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 106 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
81 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
82 ), 107 ),
83 108
84 TP_printk("%d,%d %s %llu + %u [%s]", 109 TP_printk("%d,%d %s %llu + %u",
85 MAJOR(__entry->dev), MINOR(__entry->dev), 110 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
86 __entry->rwbs, 111 (unsigned long long)__entry->sector, __entry->nr_sector)
87 (unsigned long long)__entry->sector,
88 __entry->nr_sector, __entry->comm)
89); 112);
90 113
91 114DEFINE_EVENT(bcache_bio, bcache_bypass_sequential,
92DEFINE_EVENT(bcache_bio, bcache_passthrough,
93
94 TP_PROTO(struct bio *bio), 115 TP_PROTO(struct bio *bio),
116 TP_ARGS(bio)
117);
95 118
119DEFINE_EVENT(bcache_bio, bcache_bypass_congested,
120 TP_PROTO(struct bio *bio),
96 TP_ARGS(bio) 121 TP_ARGS(bio)
97); 122);
98 123
99DEFINE_EVENT(bcache_bio, bcache_cache_hit, 124TRACE_EVENT(bcache_read,
125 TP_PROTO(struct bio *bio, bool hit, bool bypass),
126 TP_ARGS(bio, hit, bypass),
100 127
101 TP_PROTO(struct bio *bio), 128 TP_STRUCT__entry(
129 __field(dev_t, dev )
130 __field(sector_t, sector )
131 __field(unsigned int, nr_sector )
132 __array(char, rwbs, 6 )
133 __field(bool, cache_hit )
134 __field(bool, bypass )
135 ),
102 136
103 TP_ARGS(bio) 137 TP_fast_assign(
138 __entry->dev = bio->bi_bdev->bd_dev;
139 __entry->sector = bio->bi_sector;
140 __entry->nr_sector = bio->bi_size >> 9;
141 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
142 __entry->cache_hit = hit;
143 __entry->bypass = bypass;
144 ),
145
146 TP_printk("%d,%d %s %llu + %u hit %u bypass %u",
147 MAJOR(__entry->dev), MINOR(__entry->dev),
148 __entry->rwbs, (unsigned long long)__entry->sector,
149 __entry->nr_sector, __entry->cache_hit, __entry->bypass)
104); 150);
105 151
106DEFINE_EVENT(bcache_bio, bcache_cache_miss, 152TRACE_EVENT(bcache_write,
153 TP_PROTO(struct bio *bio, bool writeback, bool bypass),
154 TP_ARGS(bio, writeback, bypass),
107 155
108 TP_PROTO(struct bio *bio), 156 TP_STRUCT__entry(
157 __field(dev_t, dev )
158 __field(sector_t, sector )
159 __field(unsigned int, nr_sector )
160 __array(char, rwbs, 6 )
161 __field(bool, writeback )
162 __field(bool, bypass )
163 ),
109 164
110 TP_ARGS(bio) 165 TP_fast_assign(
166 __entry->dev = bio->bi_bdev->bd_dev;
167 __entry->sector = bio->bi_sector;
168 __entry->nr_sector = bio->bi_size >> 9;
169 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
170 __entry->writeback = writeback;
171 __entry->bypass = bypass;
172 ),
173
174 TP_printk("%d,%d %s %llu + %u hit %u bypass %u",
175 MAJOR(__entry->dev), MINOR(__entry->dev),
176 __entry->rwbs, (unsigned long long)__entry->sector,
177 __entry->nr_sector, __entry->writeback, __entry->bypass)
111); 178);
112 179
113DEFINE_EVENT(bcache_bio, bcache_read_retry, 180DEFINE_EVENT(bcache_bio, bcache_read_retry,
114
115 TP_PROTO(struct bio *bio), 181 TP_PROTO(struct bio *bio),
116
117 TP_ARGS(bio) 182 TP_ARGS(bio)
118); 183);
119 184
120DEFINE_EVENT(bcache_bio, bcache_writethrough, 185DEFINE_EVENT(bkey, bcache_cache_insert,
186 TP_PROTO(struct bkey *k),
187 TP_ARGS(k)
188);
121 189
122 TP_PROTO(struct bio *bio), 190/* Journal */
123 191
124 TP_ARGS(bio) 192DECLARE_EVENT_CLASS(cache_set,
125); 193 TP_PROTO(struct cache_set *c),
194 TP_ARGS(c),
126 195
127DEFINE_EVENT(bcache_bio, bcache_writeback, 196 TP_STRUCT__entry(
197 __array(char, uuid, 16 )
198 ),
128 199
129 TP_PROTO(struct bio *bio), 200 TP_fast_assign(
201 memcpy(__entry->uuid, c->sb.set_uuid, 16);
202 ),
130 203
131 TP_ARGS(bio) 204 TP_printk("%pU", __entry->uuid)
132); 205);
133 206
134DEFINE_EVENT(bcache_bio, bcache_write_skip, 207DEFINE_EVENT(bkey, bcache_journal_replay_key,
135 208 TP_PROTO(struct bkey *k),
136 TP_PROTO(struct bio *bio), 209 TP_ARGS(k)
210);
137 211
138 TP_ARGS(bio) 212DEFINE_EVENT(cache_set, bcache_journal_full,
213 TP_PROTO(struct cache_set *c),
214 TP_ARGS(c)
139); 215);
140 216
141DEFINE_EVENT(bcache_bio, bcache_btree_read, 217DEFINE_EVENT(cache_set, bcache_journal_entry_full,
218 TP_PROTO(struct cache_set *c),
219 TP_ARGS(c)
220);
142 221
222DEFINE_EVENT(bcache_bio, bcache_journal_write,
143 TP_PROTO(struct bio *bio), 223 TP_PROTO(struct bio *bio),
144
145 TP_ARGS(bio) 224 TP_ARGS(bio)
146); 225);
147 226
148DEFINE_EVENT(bcache_bio, bcache_btree_write, 227/* Btree */
149 228
150 TP_PROTO(struct bio *bio), 229DEFINE_EVENT(cache_set, bcache_btree_cache_cannibalize,
230 TP_PROTO(struct cache_set *c),
231 TP_ARGS(c)
232);
151 233
152 TP_ARGS(bio) 234DEFINE_EVENT(btree_node, bcache_btree_read,
235 TP_PROTO(struct btree *b),
236 TP_ARGS(b)
153); 237);
154 238
155DEFINE_EVENT(bcache_bio, bcache_write_dirty, 239TRACE_EVENT(bcache_btree_write,
240 TP_PROTO(struct btree *b),
241 TP_ARGS(b),
156 242
157 TP_PROTO(struct bio *bio), 243 TP_STRUCT__entry(
244 __field(size_t, bucket )
245 __field(unsigned, block )
246 __field(unsigned, keys )
247 ),
158 248
159 TP_ARGS(bio) 249 TP_fast_assign(
250 __entry->bucket = PTR_BUCKET_NR(b->c, &b->key, 0);
251 __entry->block = b->written;
252 __entry->keys = b->sets[b->nsets].data->keys;
253 ),
254
255 TP_printk("bucket %zu", __entry->bucket)
160); 256);
161 257
162DEFINE_EVENT(bcache_bio, bcache_read_dirty, 258DEFINE_EVENT(btree_node, bcache_btree_node_alloc,
259 TP_PROTO(struct btree *b),
260 TP_ARGS(b)
261);
163 262
164 TP_PROTO(struct bio *bio), 263DEFINE_EVENT(btree_node, bcache_btree_node_alloc_fail,
264 TP_PROTO(struct btree *b),
265 TP_ARGS(b)
266);
165 267
166 TP_ARGS(bio) 268DEFINE_EVENT(btree_node, bcache_btree_node_free,
269 TP_PROTO(struct btree *b),
270 TP_ARGS(b)
167); 271);
168 272
169DEFINE_EVENT(bcache_bio, bcache_write_moving, 273TRACE_EVENT(bcache_btree_gc_coalesce,
274 TP_PROTO(unsigned nodes),
275 TP_ARGS(nodes),
170 276
171 TP_PROTO(struct bio *bio), 277 TP_STRUCT__entry(
278 __field(unsigned, nodes )
279 ),
172 280
173 TP_ARGS(bio) 281 TP_fast_assign(
282 __entry->nodes = nodes;
283 ),
284
285 TP_printk("coalesced %u nodes", __entry->nodes)
174); 286);
175 287
176DEFINE_EVENT(bcache_bio, bcache_read_moving, 288DEFINE_EVENT(cache_set, bcache_gc_start,
289 TP_PROTO(struct cache_set *c),
290 TP_ARGS(c)
291);
177 292
178 TP_PROTO(struct bio *bio), 293DEFINE_EVENT(cache_set, bcache_gc_end,
294 TP_PROTO(struct cache_set *c),
295 TP_ARGS(c)
296);
179 297
180 TP_ARGS(bio) 298DEFINE_EVENT(bkey, bcache_gc_copy,
299 TP_PROTO(struct bkey *k),
300 TP_ARGS(k)
181); 301);
182 302
183DEFINE_EVENT(bcache_bio, bcache_journal_write, 303DEFINE_EVENT(bkey, bcache_gc_copy_collision,
304 TP_PROTO(struct bkey *k),
305 TP_ARGS(k)
306);
184 307
185 TP_PROTO(struct bio *bio), 308TRACE_EVENT(bcache_btree_insert_key,
309 TP_PROTO(struct btree *b, struct bkey *k, unsigned op, unsigned status),
310 TP_ARGS(b, k, op, status),
186 311
187 TP_ARGS(bio) 312 TP_STRUCT__entry(
188); 313 __field(u64, btree_node )
314 __field(u32, btree_level )
315 __field(u32, inode )
316 __field(u64, offset )
317 __field(u32, size )
318 __field(u8, dirty )
319 __field(u8, op )
320 __field(u8, status )
321 ),
189 322
190DECLARE_EVENT_CLASS(bcache_cache_bio, 323 TP_fast_assign(
324 __entry->btree_node = PTR_BUCKET_NR(b->c, &b->key, 0);
325 __entry->btree_level = b->level;
326 __entry->inode = KEY_INODE(k);
327 __entry->offset = KEY_OFFSET(k);
328 __entry->size = KEY_SIZE(k);
329 __entry->dirty = KEY_DIRTY(k);
330 __entry->op = op;
331 __entry->status = status;
332 ),
191 333
192 TP_PROTO(struct bio *bio, 334 TP_printk("%u for %u at %llu(%u): %u:%llu len %u dirty %u",
193 sector_t orig_sector, 335 __entry->status, __entry->op,
194 struct block_device* orig_bdev), 336 __entry->btree_node, __entry->btree_level,
337 __entry->inode, __entry->offset,
338 __entry->size, __entry->dirty)
339);
195 340
196 TP_ARGS(bio, orig_sector, orig_bdev), 341DECLARE_EVENT_CLASS(btree_split,
342 TP_PROTO(struct btree *b, unsigned keys),
343 TP_ARGS(b, keys),
197 344
198 TP_STRUCT__entry( 345 TP_STRUCT__entry(
199 __field(dev_t, dev ) 346 __field(size_t, bucket )
200 __field(dev_t, orig_dev ) 347 __field(unsigned, keys )
201 __field(sector_t, sector )
202 __field(sector_t, orig_sector )
203 __field(unsigned int, nr_sector )
204 __array(char, rwbs, 6 )
205 __array(char, comm, TASK_COMM_LEN )
206 ), 348 ),
207 349
208 TP_fast_assign( 350 TP_fast_assign(
209 __entry->dev = bio->bi_bdev->bd_dev; 351 __entry->bucket = PTR_BUCKET_NR(b->c, &b->key, 0);
210 __entry->orig_dev = orig_bdev->bd_dev; 352 __entry->keys = keys;
211 __entry->sector = bio->bi_sector;
212 __entry->orig_sector = orig_sector;
213 __entry->nr_sector = bio->bi_size >> 9;
214 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
215 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
216 ), 353 ),
217 354
218 TP_printk("%d,%d %s %llu + %u [%s] (from %d,%d %llu)", 355 TP_printk("bucket %zu keys %u", __entry->bucket, __entry->keys)
219 MAJOR(__entry->dev), MINOR(__entry->dev),
220 __entry->rwbs,
221 (unsigned long long)__entry->sector,
222 __entry->nr_sector, __entry->comm,
223 MAJOR(__entry->orig_dev), MINOR(__entry->orig_dev),
224 (unsigned long long)__entry->orig_sector)
225); 356);
226 357
227DEFINE_EVENT(bcache_cache_bio, bcache_cache_insert, 358DEFINE_EVENT(btree_split, bcache_btree_node_split,
228 359 TP_PROTO(struct btree *b, unsigned keys),
229 TP_PROTO(struct bio *bio, 360 TP_ARGS(b, keys)
230 sector_t orig_sector, 361);
231 struct block_device *orig_bdev),
232 362
233 TP_ARGS(bio, orig_sector, orig_bdev) 363DEFINE_EVENT(btree_split, bcache_btree_node_compact,
364 TP_PROTO(struct btree *b, unsigned keys),
365 TP_ARGS(b, keys)
234); 366);
235 367
236DECLARE_EVENT_CLASS(bcache_gc, 368DEFINE_EVENT(btree_node, bcache_btree_set_root,
369 TP_PROTO(struct btree *b),
370 TP_ARGS(b)
371);
237 372
238 TP_PROTO(uint8_t *uuid), 373/* Allocator */
239 374
240 TP_ARGS(uuid), 375TRACE_EVENT(bcache_alloc_invalidate,
376 TP_PROTO(struct cache *ca),
377 TP_ARGS(ca),
241 378
242 TP_STRUCT__entry( 379 TP_STRUCT__entry(
243 __field(uint8_t *, uuid) 380 __field(unsigned, free )
381 __field(unsigned, free_inc )
382 __field(unsigned, free_inc_size )
383 __field(unsigned, unused )
244 ), 384 ),
245 385
246 TP_fast_assign( 386 TP_fast_assign(
247 __entry->uuid = uuid; 387 __entry->free = fifo_used(&ca->free);
388 __entry->free_inc = fifo_used(&ca->free_inc);
389 __entry->free_inc_size = ca->free_inc.size;
390 __entry->unused = fifo_used(&ca->unused);
248 ), 391 ),
249 392
250 TP_printk("%pU", __entry->uuid) 393 TP_printk("free %u free_inc %u/%u unused %u", __entry->free,
394 __entry->free_inc, __entry->free_inc_size, __entry->unused)
251); 395);
252 396
397TRACE_EVENT(bcache_alloc_fail,
398 TP_PROTO(struct cache *ca),
399 TP_ARGS(ca),
253 400
254DEFINE_EVENT(bcache_gc, bcache_gc_start, 401 TP_STRUCT__entry(
402 __field(unsigned, free )
403 __field(unsigned, free_inc )
404 __field(unsigned, unused )
405 __field(unsigned, blocked )
406 ),
255 407
256 TP_PROTO(uint8_t *uuid), 408 TP_fast_assign(
409 __entry->free = fifo_used(&ca->free);
410 __entry->free_inc = fifo_used(&ca->free_inc);
411 __entry->unused = fifo_used(&ca->unused);
412 __entry->blocked = atomic_read(&ca->set->prio_blocked);
413 ),
257 414
258 TP_ARGS(uuid) 415 TP_printk("free %u free_inc %u unused %u blocked %u", __entry->free,
416 __entry->free_inc, __entry->unused, __entry->blocked)
259); 417);
260 418
261DEFINE_EVENT(bcache_gc, bcache_gc_end, 419/* Background writeback */
262 420
263 TP_PROTO(uint8_t *uuid), 421DEFINE_EVENT(bkey, bcache_writeback,
422 TP_PROTO(struct bkey *k),
423 TP_ARGS(k)
424);
264 425
265 TP_ARGS(uuid) 426DEFINE_EVENT(bkey, bcache_writeback_collision,
427 TP_PROTO(struct bkey *k),
428 TP_ARGS(k)
266); 429);
267 430
268#endif /* _TRACE_BCACHE_H */ 431#endif /* _TRACE_BCACHE_H */
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index ea546a4e9609..2902657ba766 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -40,22 +40,25 @@ struct extent_buffer;
40 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ 40 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
41 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ 41 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
42 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ 42 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
43 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \
43 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ 44 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
44 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) 45 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
45 46
46#define show_root_type(obj) \ 47#define show_root_type(obj) \
47 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ 48 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
48 (obj >= BTRFS_ROOT_TREE_OBJECTID && \ 49 (obj >= BTRFS_ROOT_TREE_OBJECTID && \
49 obj <= BTRFS_CSUM_TREE_OBJECTID)) ? __show_root_type(obj) : "-" 50 obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-"
50 51
51#define BTRFS_GROUP_FLAGS \ 52#define BTRFS_GROUP_FLAGS \
52 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ 53 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
53 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 54 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
54 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 55 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
55 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ 56 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
56 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ 57 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
57 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ 58 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
58 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"} 59 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
60 { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \
61 { BTRFS_BLOCK_GROUP_RAID6, "RAID6"}
59 62
60#define BTRFS_UUID_SIZE 16 63#define BTRFS_UUID_SIZE 16
61 64
@@ -154,7 +157,9 @@ DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
154 { EXTENT_FLAG_PINNED, "PINNED" }, \ 157 { EXTENT_FLAG_PINNED, "PINNED" }, \
155 { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \ 158 { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \
156 { EXTENT_FLAG_VACANCY, "VACANCY" }, \ 159 { EXTENT_FLAG_VACANCY, "VACANCY" }, \
157 { EXTENT_FLAG_PREALLOC, "PREALLOC" }) 160 { EXTENT_FLAG_PREALLOC, "PREALLOC" }, \
161 { EXTENT_FLAG_LOGGING, "LOGGING" }, \
162 { EXTENT_FLAG_FILLING, "FILLING" })
158 163
159TRACE_EVENT(btrfs_get_extent, 164TRACE_EVENT(btrfs_get_extent,
160 165
@@ -201,13 +206,17 @@ TRACE_EVENT(btrfs_get_extent,
201); 206);
202 207
203#define show_ordered_flags(flags) \ 208#define show_ordered_flags(flags) \
204 __print_symbolic(flags, \ 209 __print_symbolic(flags, \
205 { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \ 210 { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \
206 { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \ 211 { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \
207 { BTRFS_ORDERED_NOCOW, "NOCOW" }, \ 212 { BTRFS_ORDERED_NOCOW, "NOCOW" }, \
208 { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \ 213 { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \
209 { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \ 214 { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \
210 { BTRFS_ORDERED_DIRECT, "DIRECT" }) 215 { BTRFS_ORDERED_DIRECT, "DIRECT" }, \
216 { BTRFS_ORDERED_IOERR, "IOERR" }, \
217 { BTRFS_ORDERED_UPDATED_ISIZE, "UPDATED_ISIZE" }, \
218 { BTRFS_ORDERED_LOGGED_CSUM, "LOGGED_CSUM" })
219
211 220
212DECLARE_EVENT_CLASS(btrfs__ordered_extent, 221DECLARE_EVENT_CLASS(btrfs__ordered_extent,
213 222
@@ -555,7 +564,9 @@ TRACE_EVENT(btrfs_delayed_ref_head,
555 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ 564 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
556 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ 565 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
557 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ 566 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
558 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}) 567 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \
568 { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \
569 { BTRFS_BLOCK_GROUP_RAID6, "RAID6" })
559 570
560DECLARE_EVENT_CLASS(btrfs__chunk, 571DECLARE_EVENT_CLASS(btrfs__chunk,
561 572
diff --git a/include/trace/events/ext3.h b/include/trace/events/ext3.h
index 15d11a39be47..6797b9de90ed 100644
--- a/include/trace/events/ext3.h
+++ b/include/trace/events/ext3.h
@@ -290,13 +290,14 @@ DEFINE_EVENT(ext3__page_op, ext3_releasepage,
290); 290);
291 291
292TRACE_EVENT(ext3_invalidatepage, 292TRACE_EVENT(ext3_invalidatepage,
293 TP_PROTO(struct page *page, unsigned long offset), 293 TP_PROTO(struct page *page, unsigned int offset, unsigned int length),
294 294
295 TP_ARGS(page, offset), 295 TP_ARGS(page, offset, length),
296 296
297 TP_STRUCT__entry( 297 TP_STRUCT__entry(
298 __field( pgoff_t, index ) 298 __field( pgoff_t, index )
299 __field( unsigned long, offset ) 299 __field( unsigned int, offset )
300 __field( unsigned int, length )
300 __field( ino_t, ino ) 301 __field( ino_t, ino )
301 __field( dev_t, dev ) 302 __field( dev_t, dev )
302 303
@@ -305,14 +306,15 @@ TRACE_EVENT(ext3_invalidatepage,
305 TP_fast_assign( 306 TP_fast_assign(
306 __entry->index = page->index; 307 __entry->index = page->index;
307 __entry->offset = offset; 308 __entry->offset = offset;
309 __entry->length = length;
308 __entry->ino = page->mapping->host->i_ino; 310 __entry->ino = page->mapping->host->i_ino;
309 __entry->dev = page->mapping->host->i_sb->s_dev; 311 __entry->dev = page->mapping->host->i_sb->s_dev;
310 ), 312 ),
311 313
312 TP_printk("dev %d,%d ino %lu page_index %lu offset %lu", 314 TP_printk("dev %d,%d ino %lu page_index %lu offset %u length %u",
313 MAJOR(__entry->dev), MINOR(__entry->dev), 315 MAJOR(__entry->dev), MINOR(__entry->dev),
314 (unsigned long) __entry->ino, 316 (unsigned long) __entry->ino,
315 __entry->index, __entry->offset) 317 __entry->index, __entry->offset, __entry->length)
316); 318);
317 319
318TRACE_EVENT(ext3_discard_blocks, 320TRACE_EVENT(ext3_discard_blocks,
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 8ee15b97cd38..2068db241f22 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -19,6 +19,57 @@ struct extent_status;
19 19
20#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode)) 20#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode))
21 21
22#define show_mballoc_flags(flags) __print_flags(flags, "|", \
23 { EXT4_MB_HINT_MERGE, "HINT_MERGE" }, \
24 { EXT4_MB_HINT_RESERVED, "HINT_RESV" }, \
25 { EXT4_MB_HINT_METADATA, "HINT_MDATA" }, \
26 { EXT4_MB_HINT_FIRST, "HINT_FIRST" }, \
27 { EXT4_MB_HINT_BEST, "HINT_BEST" }, \
28 { EXT4_MB_HINT_DATA, "HINT_DATA" }, \
29 { EXT4_MB_HINT_NOPREALLOC, "HINT_NOPREALLOC" }, \
30 { EXT4_MB_HINT_GROUP_ALLOC, "HINT_GRP_ALLOC" }, \
31 { EXT4_MB_HINT_GOAL_ONLY, "HINT_GOAL_ONLY" }, \
32 { EXT4_MB_HINT_TRY_GOAL, "HINT_TRY_GOAL" }, \
33 { EXT4_MB_DELALLOC_RESERVED, "DELALLOC_RESV" }, \
34 { EXT4_MB_STREAM_ALLOC, "STREAM_ALLOC" }, \
35 { EXT4_MB_USE_ROOT_BLOCKS, "USE_ROOT_BLKS" }, \
36 { EXT4_MB_USE_RESERVED, "USE_RESV" })
37
38#define show_map_flags(flags) __print_flags(flags, "|", \
39 { EXT4_GET_BLOCKS_CREATE, "CREATE" }, \
40 { EXT4_GET_BLOCKS_UNINIT_EXT, "UNINIT" }, \
41 { EXT4_GET_BLOCKS_DELALLOC_RESERVE, "DELALLOC" }, \
42 { EXT4_GET_BLOCKS_PRE_IO, "PRE_IO" }, \
43 { EXT4_GET_BLOCKS_CONVERT, "CONVERT" }, \
44 { EXT4_GET_BLOCKS_METADATA_NOFAIL, "METADATA_NOFAIL" }, \
45 { EXT4_GET_BLOCKS_NO_NORMALIZE, "NO_NORMALIZE" }, \
46 { EXT4_GET_BLOCKS_KEEP_SIZE, "KEEP_SIZE" }, \
47 { EXT4_GET_BLOCKS_NO_LOCK, "NO_LOCK" }, \
48 { EXT4_GET_BLOCKS_NO_PUT_HOLE, "NO_PUT_HOLE" })
49
50#define show_mflags(flags) __print_flags(flags, "", \
51 { EXT4_MAP_NEW, "N" }, \
52 { EXT4_MAP_MAPPED, "M" }, \
53 { EXT4_MAP_UNWRITTEN, "U" }, \
54 { EXT4_MAP_BOUNDARY, "B" }, \
55 { EXT4_MAP_UNINIT, "u" }, \
56 { EXT4_MAP_FROM_CLUSTER, "C" })
57
58#define show_free_flags(flags) __print_flags(flags, "|", \
59 { EXT4_FREE_BLOCKS_METADATA, "METADATA" }, \
60 { EXT4_FREE_BLOCKS_FORGET, "FORGET" }, \
61 { EXT4_FREE_BLOCKS_VALIDATED, "VALIDATED" }, \
62 { EXT4_FREE_BLOCKS_NO_QUOT_UPDATE, "NO_QUOTA" }, \
63 { EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER,"1ST_CLUSTER" },\
64 { EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER, "LAST_CLUSTER" })
65
66#define show_extent_status(status) __print_flags(status, "", \
67 { (1 << 3), "W" }, \
68 { (1 << 2), "U" }, \
69 { (1 << 1), "D" }, \
70 { (1 << 0), "H" })
71
72
22TRACE_EVENT(ext4_free_inode, 73TRACE_EVENT(ext4_free_inode,
23 TP_PROTO(struct inode *inode), 74 TP_PROTO(struct inode *inode),
24 75
@@ -281,7 +332,7 @@ DEFINE_EVENT(ext4__write_end, ext4_da_write_end,
281 TP_ARGS(inode, pos, len, copied) 332 TP_ARGS(inode, pos, len, copied)
282); 333);
283 334
284TRACE_EVENT(ext4_da_writepages, 335TRACE_EVENT(ext4_writepages,
285 TP_PROTO(struct inode *inode, struct writeback_control *wbc), 336 TP_PROTO(struct inode *inode, struct writeback_control *wbc),
286 337
287 TP_ARGS(inode, wbc), 338 TP_ARGS(inode, wbc),
@@ -324,46 +375,62 @@ TRACE_EVENT(ext4_da_writepages,
324); 375);
325 376
326TRACE_EVENT(ext4_da_write_pages, 377TRACE_EVENT(ext4_da_write_pages,
327 TP_PROTO(struct inode *inode, struct mpage_da_data *mpd), 378 TP_PROTO(struct inode *inode, pgoff_t first_page,
379 struct writeback_control *wbc),
328 380
329 TP_ARGS(inode, mpd), 381 TP_ARGS(inode, first_page, wbc),
330 382
331 TP_STRUCT__entry( 383 TP_STRUCT__entry(
332 __field( dev_t, dev ) 384 __field( dev_t, dev )
333 __field( ino_t, ino ) 385 __field( ino_t, ino )
334 __field( __u64, b_blocknr ) 386 __field( pgoff_t, first_page )
335 __field( __u32, b_size ) 387 __field( long, nr_to_write )
336 __field( __u32, b_state ) 388 __field( int, sync_mode )
337 __field( unsigned long, first_page )
338 __field( int, io_done )
339 __field( int, pages_written )
340 __field( int, sync_mode )
341 ), 389 ),
342 390
343 TP_fast_assign( 391 TP_fast_assign(
344 __entry->dev = inode->i_sb->s_dev; 392 __entry->dev = inode->i_sb->s_dev;
345 __entry->ino = inode->i_ino; 393 __entry->ino = inode->i_ino;
346 __entry->b_blocknr = mpd->b_blocknr; 394 __entry->first_page = first_page;
347 __entry->b_size = mpd->b_size; 395 __entry->nr_to_write = wbc->nr_to_write;
348 __entry->b_state = mpd->b_state; 396 __entry->sync_mode = wbc->sync_mode;
349 __entry->first_page = mpd->first_page;
350 __entry->io_done = mpd->io_done;
351 __entry->pages_written = mpd->pages_written;
352 __entry->sync_mode = mpd->wbc->sync_mode;
353 ), 397 ),
354 398
355 TP_printk("dev %d,%d ino %lu b_blocknr %llu b_size %u b_state 0x%04x " 399 TP_printk("dev %d,%d ino %lu first_page %lu nr_to_write %ld "
356 "first_page %lu io_done %d pages_written %d sync_mode %d", 400 "sync_mode %d",
357 MAJOR(__entry->dev), MINOR(__entry->dev), 401 MAJOR(__entry->dev), MINOR(__entry->dev),
358 (unsigned long) __entry->ino, 402 (unsigned long) __entry->ino, __entry->first_page,
359 __entry->b_blocknr, __entry->b_size, 403 __entry->nr_to_write, __entry->sync_mode)
360 __entry->b_state, __entry->first_page,
361 __entry->io_done, __entry->pages_written,
362 __entry->sync_mode
363 )
364); 404);
365 405
366TRACE_EVENT(ext4_da_writepages_result, 406TRACE_EVENT(ext4_da_write_pages_extent,
407 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map),
408
409 TP_ARGS(inode, map),
410
411 TP_STRUCT__entry(
412 __field( dev_t, dev )
413 __field( ino_t, ino )
414 __field( __u64, lblk )
415 __field( __u32, len )
416 __field( __u32, flags )
417 ),
418
419 TP_fast_assign(
420 __entry->dev = inode->i_sb->s_dev;
421 __entry->ino = inode->i_ino;
422 __entry->lblk = map->m_lblk;
423 __entry->len = map->m_len;
424 __entry->flags = map->m_flags;
425 ),
426
427 TP_printk("dev %d,%d ino %lu lblk %llu len %u flags %s",
428 MAJOR(__entry->dev), MINOR(__entry->dev),
429 (unsigned long) __entry->ino, __entry->lblk, __entry->len,
430 show_mflags(__entry->flags))
431);
432
433TRACE_EVENT(ext4_writepages_result,
367 TP_PROTO(struct inode *inode, struct writeback_control *wbc, 434 TP_PROTO(struct inode *inode, struct writeback_control *wbc,
368 int ret, int pages_written), 435 int ret, int pages_written),
369 436
@@ -444,16 +511,16 @@ DEFINE_EVENT(ext4__page_op, ext4_releasepage,
444); 511);
445 512
446DECLARE_EVENT_CLASS(ext4_invalidatepage_op, 513DECLARE_EVENT_CLASS(ext4_invalidatepage_op,
447 TP_PROTO(struct page *page, unsigned long offset), 514 TP_PROTO(struct page *page, unsigned int offset, unsigned int length),
448 515
449 TP_ARGS(page, offset), 516 TP_ARGS(page, offset, length),
450 517
451 TP_STRUCT__entry( 518 TP_STRUCT__entry(
452 __field( dev_t, dev ) 519 __field( dev_t, dev )
453 __field( ino_t, ino ) 520 __field( ino_t, ino )
454 __field( pgoff_t, index ) 521 __field( pgoff_t, index )
455 __field( unsigned long, offset ) 522 __field( unsigned int, offset )
456 523 __field( unsigned int, length )
457 ), 524 ),
458 525
459 TP_fast_assign( 526 TP_fast_assign(
@@ -461,24 +528,26 @@ DECLARE_EVENT_CLASS(ext4_invalidatepage_op,
461 __entry->ino = page->mapping->host->i_ino; 528 __entry->ino = page->mapping->host->i_ino;
462 __entry->index = page->index; 529 __entry->index = page->index;
463 __entry->offset = offset; 530 __entry->offset = offset;
531 __entry->length = length;
464 ), 532 ),
465 533
466 TP_printk("dev %d,%d ino %lu page_index %lu offset %lu", 534 TP_printk("dev %d,%d ino %lu page_index %lu offset %u length %u",
467 MAJOR(__entry->dev), MINOR(__entry->dev), 535 MAJOR(__entry->dev), MINOR(__entry->dev),
468 (unsigned long) __entry->ino, 536 (unsigned long) __entry->ino,
469 (unsigned long) __entry->index, __entry->offset) 537 (unsigned long) __entry->index,
538 __entry->offset, __entry->length)
470); 539);
471 540
472DEFINE_EVENT(ext4_invalidatepage_op, ext4_invalidatepage, 541DEFINE_EVENT(ext4_invalidatepage_op, ext4_invalidatepage,
473 TP_PROTO(struct page *page, unsigned long offset), 542 TP_PROTO(struct page *page, unsigned int offset, unsigned int length),
474 543
475 TP_ARGS(page, offset) 544 TP_ARGS(page, offset, length)
476); 545);
477 546
478DEFINE_EVENT(ext4_invalidatepage_op, ext4_journalled_invalidatepage, 547DEFINE_EVENT(ext4_invalidatepage_op, ext4_journalled_invalidatepage,
479 TP_PROTO(struct page *page, unsigned long offset), 548 TP_PROTO(struct page *page, unsigned int offset, unsigned int length),
480 549
481 TP_ARGS(page, offset) 550 TP_ARGS(page, offset, length)
482); 551);
483 552
484TRACE_EVENT(ext4_discard_blocks, 553TRACE_EVENT(ext4_discard_blocks,
@@ -673,10 +742,10 @@ TRACE_EVENT(ext4_request_blocks,
673 __entry->flags = ar->flags; 742 __entry->flags = ar->flags;
674 ), 743 ),
675 744
676 TP_printk("dev %d,%d ino %lu flags %u len %u lblk %u goal %llu " 745 TP_printk("dev %d,%d ino %lu flags %s len %u lblk %u goal %llu "
677 "lleft %u lright %u pleft %llu pright %llu ", 746 "lleft %u lright %u pleft %llu pright %llu ",
678 MAJOR(__entry->dev), MINOR(__entry->dev), 747 MAJOR(__entry->dev), MINOR(__entry->dev),
679 (unsigned long) __entry->ino, __entry->flags, 748 (unsigned long) __entry->ino, show_mballoc_flags(__entry->flags),
680 __entry->len, __entry->logical, __entry->goal, 749 __entry->len, __entry->logical, __entry->goal,
681 __entry->lleft, __entry->lright, __entry->pleft, 750 __entry->lleft, __entry->lright, __entry->pleft,
682 __entry->pright) 751 __entry->pright)
@@ -715,10 +784,10 @@ TRACE_EVENT(ext4_allocate_blocks,
715 __entry->flags = ar->flags; 784 __entry->flags = ar->flags;
716 ), 785 ),
717 786
718 TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %u " 787 TP_printk("dev %d,%d ino %lu flags %s len %u block %llu lblk %u "
719 "goal %llu lleft %u lright %u pleft %llu pright %llu", 788 "goal %llu lleft %u lright %u pleft %llu pright %llu",
720 MAJOR(__entry->dev), MINOR(__entry->dev), 789 MAJOR(__entry->dev), MINOR(__entry->dev),
721 (unsigned long) __entry->ino, __entry->flags, 790 (unsigned long) __entry->ino, show_mballoc_flags(__entry->flags),
722 __entry->len, __entry->block, __entry->logical, 791 __entry->len, __entry->block, __entry->logical,
723 __entry->goal, __entry->lleft, __entry->lright, 792 __entry->goal, __entry->lleft, __entry->lright,
724 __entry->pleft, __entry->pright) 793 __entry->pleft, __entry->pright)
@@ -748,11 +817,11 @@ TRACE_EVENT(ext4_free_blocks,
748 __entry->mode = inode->i_mode; 817 __entry->mode = inode->i_mode;
749 ), 818 ),
750 819
751 TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %d", 820 TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %s",
752 MAJOR(__entry->dev), MINOR(__entry->dev), 821 MAJOR(__entry->dev), MINOR(__entry->dev),
753 (unsigned long) __entry->ino, 822 (unsigned long) __entry->ino,
754 __entry->mode, __entry->block, __entry->count, 823 __entry->mode, __entry->block, __entry->count,
755 __entry->flags) 824 show_free_flags(__entry->flags))
756); 825);
757 826
758TRACE_EVENT(ext4_sync_file_enter, 827TRACE_EVENT(ext4_sync_file_enter,
@@ -903,7 +972,7 @@ TRACE_EVENT(ext4_mballoc_alloc,
903 ), 972 ),
904 973
905 TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u " 974 TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
906 "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x " 975 "result %u/%d/%u@%u blks %u grps %u cr %u flags %s "
907 "tail %u broken %u", 976 "tail %u broken %u",
908 MAJOR(__entry->dev), MINOR(__entry->dev), 977 MAJOR(__entry->dev), MINOR(__entry->dev),
909 (unsigned long) __entry->ino, 978 (unsigned long) __entry->ino,
@@ -914,7 +983,7 @@ TRACE_EVENT(ext4_mballoc_alloc,
914 __entry->result_group, __entry->result_start, 983 __entry->result_group, __entry->result_start,
915 __entry->result_len, __entry->result_logical, 984 __entry->result_len, __entry->result_logical,
916 __entry->found, __entry->groups, __entry->cr, 985 __entry->found, __entry->groups, __entry->cr,
917 __entry->flags, __entry->tail, 986 show_mballoc_flags(__entry->flags), __entry->tail,
918 __entry->buddy ? 1 << __entry->buddy : 0) 987 __entry->buddy ? 1 << __entry->buddy : 0)
919); 988);
920 989
@@ -1528,10 +1597,10 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
1528 __entry->flags = flags; 1597 __entry->flags = flags;
1529 ), 1598 ),
1530 1599
1531 TP_printk("dev %d,%d ino %lu lblk %u len %u flags %u", 1600 TP_printk("dev %d,%d ino %lu lblk %u len %u flags %s",
1532 MAJOR(__entry->dev), MINOR(__entry->dev), 1601 MAJOR(__entry->dev), MINOR(__entry->dev),
1533 (unsigned long) __entry->ino, 1602 (unsigned long) __entry->ino,
1534 __entry->lblk, __entry->len, __entry->flags) 1603 __entry->lblk, __entry->len, show_map_flags(__entry->flags))
1535); 1604);
1536 1605
1537DEFINE_EVENT(ext4__map_blocks_enter, ext4_ext_map_blocks_enter, 1606DEFINE_EVENT(ext4__map_blocks_enter, ext4_ext_map_blocks_enter,
@@ -1549,47 +1618,53 @@ DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
1549); 1618);
1550 1619
1551DECLARE_EVENT_CLASS(ext4__map_blocks_exit, 1620DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1552 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int ret), 1621 TP_PROTO(struct inode *inode, unsigned flags, struct ext4_map_blocks *map,
1622 int ret),
1553 1623
1554 TP_ARGS(inode, map, ret), 1624 TP_ARGS(inode, flags, map, ret),
1555 1625
1556 TP_STRUCT__entry( 1626 TP_STRUCT__entry(
1557 __field( dev_t, dev ) 1627 __field( dev_t, dev )
1558 __field( ino_t, ino ) 1628 __field( ino_t, ino )
1629 __field( unsigned int, flags )
1559 __field( ext4_fsblk_t, pblk ) 1630 __field( ext4_fsblk_t, pblk )
1560 __field( ext4_lblk_t, lblk ) 1631 __field( ext4_lblk_t, lblk )
1561 __field( unsigned int, len ) 1632 __field( unsigned int, len )
1562 __field( unsigned int, flags ) 1633 __field( unsigned int, mflags )
1563 __field( int, ret ) 1634 __field( int, ret )
1564 ), 1635 ),
1565 1636
1566 TP_fast_assign( 1637 TP_fast_assign(
1567 __entry->dev = inode->i_sb->s_dev; 1638 __entry->dev = inode->i_sb->s_dev;
1568 __entry->ino = inode->i_ino; 1639 __entry->ino = inode->i_ino;
1640 __entry->flags = flags;
1569 __entry->pblk = map->m_pblk; 1641 __entry->pblk = map->m_pblk;
1570 __entry->lblk = map->m_lblk; 1642 __entry->lblk = map->m_lblk;
1571 __entry->len = map->m_len; 1643 __entry->len = map->m_len;
1572 __entry->flags = map->m_flags; 1644 __entry->mflags = map->m_flags;
1573 __entry->ret = ret; 1645 __entry->ret = ret;
1574 ), 1646 ),
1575 1647
1576 TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u flags %x ret %d", 1648 TP_printk("dev %d,%d ino %lu flags %s lblk %u pblk %llu len %u "
1649 "mflags %s ret %d",
1577 MAJOR(__entry->dev), MINOR(__entry->dev), 1650 MAJOR(__entry->dev), MINOR(__entry->dev),
1578 (unsigned long) __entry->ino, 1651 (unsigned long) __entry->ino,
1579 __entry->lblk, __entry->pblk, 1652 show_map_flags(__entry->flags), __entry->lblk, __entry->pblk,
1580 __entry->len, __entry->flags, __entry->ret) 1653 __entry->len, show_mflags(__entry->mflags), __entry->ret)
1581); 1654);
1582 1655
1583DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit, 1656DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
1584 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int ret), 1657 TP_PROTO(struct inode *inode, unsigned flags,
1658 struct ext4_map_blocks *map, int ret),
1585 1659
1586 TP_ARGS(inode, map, ret) 1660 TP_ARGS(inode, flags, map, ret)
1587); 1661);
1588 1662
1589DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit, 1663DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
1590 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int ret), 1664 TP_PROTO(struct inode *inode, unsigned flags,
1665 struct ext4_map_blocks *map, int ret),
1591 1666
1592 TP_ARGS(inode, map, ret) 1667 TP_ARGS(inode, flags, map, ret)
1593); 1668);
1594 1669
1595TRACE_EVENT(ext4_ext_load_extent, 1670TRACE_EVENT(ext4_ext_load_extent,
@@ -1638,25 +1713,50 @@ TRACE_EVENT(ext4_load_inode,
1638); 1713);
1639 1714
1640TRACE_EVENT(ext4_journal_start, 1715TRACE_EVENT(ext4_journal_start,
1641 TP_PROTO(struct super_block *sb, int nblocks, unsigned long IP), 1716 TP_PROTO(struct super_block *sb, int blocks, int rsv_blocks,
1717 unsigned long IP),
1642 1718
1643 TP_ARGS(sb, nblocks, IP), 1719 TP_ARGS(sb, blocks, rsv_blocks, IP),
1644 1720
1645 TP_STRUCT__entry( 1721 TP_STRUCT__entry(
1646 __field( dev_t, dev ) 1722 __field( dev_t, dev )
1647 __field(unsigned long, ip ) 1723 __field(unsigned long, ip )
1648 __field( int, nblocks ) 1724 __field( int, blocks )
1725 __field( int, rsv_blocks )
1649 ), 1726 ),
1650 1727
1651 TP_fast_assign( 1728 TP_fast_assign(
1652 __entry->dev = sb->s_dev; 1729 __entry->dev = sb->s_dev;
1653 __entry->ip = IP; 1730 __entry->ip = IP;
1654 __entry->nblocks = nblocks; 1731 __entry->blocks = blocks;
1732 __entry->rsv_blocks = rsv_blocks;
1655 ), 1733 ),
1656 1734
1657 TP_printk("dev %d,%d nblocks %d caller %pF", 1735 TP_printk("dev %d,%d blocks, %d rsv_blocks, %d caller %pF",
1658 MAJOR(__entry->dev), MINOR(__entry->dev), 1736 MAJOR(__entry->dev), MINOR(__entry->dev),
1659 __entry->nblocks, (void *)__entry->ip) 1737 __entry->blocks, __entry->rsv_blocks, (void *)__entry->ip)
1738);
1739
1740TRACE_EVENT(ext4_journal_start_reserved,
1741 TP_PROTO(struct super_block *sb, int blocks, unsigned long IP),
1742
1743 TP_ARGS(sb, blocks, IP),
1744
1745 TP_STRUCT__entry(
1746 __field( dev_t, dev )
1747 __field(unsigned long, ip )
1748 __field( int, blocks )
1749 ),
1750
1751 TP_fast_assign(
1752 __entry->dev = sb->s_dev;
1753 __entry->ip = IP;
1754 __entry->blocks = blocks;
1755 ),
1756
1757 TP_printk("dev %d,%d blocks, %d caller %pF",
1758 MAJOR(__entry->dev), MINOR(__entry->dev),
1759 __entry->blocks, (void *)__entry->ip)
1660); 1760);
1661 1761
1662DECLARE_EVENT_CLASS(ext4__trim, 1762DECLARE_EVENT_CLASS(ext4__trim,
@@ -1736,12 +1836,12 @@ TRACE_EVENT(ext4_ext_handle_uninitialized_extents,
1736 __entry->newblk = newblock; 1836 __entry->newblk = newblock;
1737 ), 1837 ),
1738 1838
1739 TP_printk("dev %d,%d ino %lu m_lblk %u m_pblk %llu m_len %u flags %x " 1839 TP_printk("dev %d,%d ino %lu m_lblk %u m_pblk %llu m_len %u flags %s "
1740 "allocated %d newblock %llu", 1840 "allocated %d newblock %llu",
1741 MAJOR(__entry->dev), MINOR(__entry->dev), 1841 MAJOR(__entry->dev), MINOR(__entry->dev),
1742 (unsigned long) __entry->ino, 1842 (unsigned long) __entry->ino,
1743 (unsigned) __entry->lblk, (unsigned long long) __entry->pblk, 1843 (unsigned) __entry->lblk, (unsigned long long) __entry->pblk,
1744 __entry->len, __entry->flags, 1844 __entry->len, show_map_flags(__entry->flags),
1745 (unsigned int) __entry->allocated, 1845 (unsigned int) __entry->allocated,
1746 (unsigned long long) __entry->newblk) 1846 (unsigned long long) __entry->newblk)
1747); 1847);
@@ -1769,10 +1869,10 @@ TRACE_EVENT(ext4_get_implied_cluster_alloc_exit,
1769 __entry->ret = ret; 1869 __entry->ret = ret;
1770 ), 1870 ),
1771 1871
1772 TP_printk("dev %d,%d m_lblk %u m_pblk %llu m_len %u m_flags %u ret %d", 1872 TP_printk("dev %d,%d m_lblk %u m_pblk %llu m_len %u m_flags %s ret %d",
1773 MAJOR(__entry->dev), MINOR(__entry->dev), 1873 MAJOR(__entry->dev), MINOR(__entry->dev),
1774 __entry->lblk, (unsigned long long) __entry->pblk, 1874 __entry->lblk, (unsigned long long) __entry->pblk,
1775 __entry->len, __entry->flags, __entry->ret) 1875 __entry->len, show_mflags(__entry->flags), __entry->ret)
1776); 1876);
1777 1877
1778TRACE_EVENT(ext4_ext_put_in_cache, 1878TRACE_EVENT(ext4_ext_put_in_cache,
@@ -1926,7 +2026,7 @@ TRACE_EVENT(ext4_ext_show_extent,
1926TRACE_EVENT(ext4_remove_blocks, 2026TRACE_EVENT(ext4_remove_blocks,
1927 TP_PROTO(struct inode *inode, struct ext4_extent *ex, 2027 TP_PROTO(struct inode *inode, struct ext4_extent *ex,
1928 ext4_lblk_t from, ext4_fsblk_t to, 2028 ext4_lblk_t from, ext4_fsblk_t to,
1929 ext4_fsblk_t partial_cluster), 2029 long long partial_cluster),
1930 2030
1931 TP_ARGS(inode, ex, from, to, partial_cluster), 2031 TP_ARGS(inode, ex, from, to, partial_cluster),
1932 2032
@@ -1935,7 +2035,7 @@ TRACE_EVENT(ext4_remove_blocks,
1935 __field( ino_t, ino ) 2035 __field( ino_t, ino )
1936 __field( ext4_lblk_t, from ) 2036 __field( ext4_lblk_t, from )
1937 __field( ext4_lblk_t, to ) 2037 __field( ext4_lblk_t, to )
1938 __field( ext4_fsblk_t, partial ) 2038 __field( long long, partial )
1939 __field( ext4_fsblk_t, ee_pblk ) 2039 __field( ext4_fsblk_t, ee_pblk )
1940 __field( ext4_lblk_t, ee_lblk ) 2040 __field( ext4_lblk_t, ee_lblk )
1941 __field( unsigned short, ee_len ) 2041 __field( unsigned short, ee_len )
@@ -1953,7 +2053,7 @@ TRACE_EVENT(ext4_remove_blocks,
1953 ), 2053 ),
1954 2054
1955 TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]" 2055 TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]"
1956 "from %u to %u partial_cluster %u", 2056 "from %u to %u partial_cluster %lld",
1957 MAJOR(__entry->dev), MINOR(__entry->dev), 2057 MAJOR(__entry->dev), MINOR(__entry->dev),
1958 (unsigned long) __entry->ino, 2058 (unsigned long) __entry->ino,
1959 (unsigned) __entry->ee_lblk, 2059 (unsigned) __entry->ee_lblk,
@@ -1961,19 +2061,20 @@ TRACE_EVENT(ext4_remove_blocks,
1961 (unsigned short) __entry->ee_len, 2061 (unsigned short) __entry->ee_len,
1962 (unsigned) __entry->from, 2062 (unsigned) __entry->from,
1963 (unsigned) __entry->to, 2063 (unsigned) __entry->to,
1964 (unsigned) __entry->partial) 2064 (long long) __entry->partial)
1965); 2065);
1966 2066
1967TRACE_EVENT(ext4_ext_rm_leaf, 2067TRACE_EVENT(ext4_ext_rm_leaf,
1968 TP_PROTO(struct inode *inode, ext4_lblk_t start, 2068 TP_PROTO(struct inode *inode, ext4_lblk_t start,
1969 struct ext4_extent *ex, ext4_fsblk_t partial_cluster), 2069 struct ext4_extent *ex,
2070 long long partial_cluster),
1970 2071
1971 TP_ARGS(inode, start, ex, partial_cluster), 2072 TP_ARGS(inode, start, ex, partial_cluster),
1972 2073
1973 TP_STRUCT__entry( 2074 TP_STRUCT__entry(
1974 __field( dev_t, dev ) 2075 __field( dev_t, dev )
1975 __field( ino_t, ino ) 2076 __field( ino_t, ino )
1976 __field( ext4_fsblk_t, partial ) 2077 __field( long long, partial )
1977 __field( ext4_lblk_t, start ) 2078 __field( ext4_lblk_t, start )
1978 __field( ext4_lblk_t, ee_lblk ) 2079 __field( ext4_lblk_t, ee_lblk )
1979 __field( ext4_fsblk_t, ee_pblk ) 2080 __field( ext4_fsblk_t, ee_pblk )
@@ -1991,14 +2092,14 @@ TRACE_EVENT(ext4_ext_rm_leaf,
1991 ), 2092 ),
1992 2093
1993 TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]" 2094 TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]"
1994 "partial_cluster %u", 2095 "partial_cluster %lld",
1995 MAJOR(__entry->dev), MINOR(__entry->dev), 2096 MAJOR(__entry->dev), MINOR(__entry->dev),
1996 (unsigned long) __entry->ino, 2097 (unsigned long) __entry->ino,
1997 (unsigned) __entry->start, 2098 (unsigned) __entry->start,
1998 (unsigned) __entry->ee_lblk, 2099 (unsigned) __entry->ee_lblk,
1999 (unsigned long long) __entry->ee_pblk, 2100 (unsigned long long) __entry->ee_pblk,
2000 (unsigned short) __entry->ee_len, 2101 (unsigned short) __entry->ee_len,
2001 (unsigned) __entry->partial) 2102 (long long) __entry->partial)
2002); 2103);
2003 2104
2004TRACE_EVENT(ext4_ext_rm_idx, 2105TRACE_EVENT(ext4_ext_rm_idx,
@@ -2025,14 +2126,16 @@ TRACE_EVENT(ext4_ext_rm_idx,
2025); 2126);
2026 2127
2027TRACE_EVENT(ext4_ext_remove_space, 2128TRACE_EVENT(ext4_ext_remove_space,
2028 TP_PROTO(struct inode *inode, ext4_lblk_t start, int depth), 2129 TP_PROTO(struct inode *inode, ext4_lblk_t start,
2130 ext4_lblk_t end, int depth),
2029 2131
2030 TP_ARGS(inode, start, depth), 2132 TP_ARGS(inode, start, end, depth),
2031 2133
2032 TP_STRUCT__entry( 2134 TP_STRUCT__entry(
2033 __field( dev_t, dev ) 2135 __field( dev_t, dev )
2034 __field( ino_t, ino ) 2136 __field( ino_t, ino )
2035 __field( ext4_lblk_t, start ) 2137 __field( ext4_lblk_t, start )
2138 __field( ext4_lblk_t, end )
2036 __field( int, depth ) 2139 __field( int, depth )
2037 ), 2140 ),
2038 2141
@@ -2040,28 +2143,31 @@ TRACE_EVENT(ext4_ext_remove_space,
2040 __entry->dev = inode->i_sb->s_dev; 2143 __entry->dev = inode->i_sb->s_dev;
2041 __entry->ino = inode->i_ino; 2144 __entry->ino = inode->i_ino;
2042 __entry->start = start; 2145 __entry->start = start;
2146 __entry->end = end;
2043 __entry->depth = depth; 2147 __entry->depth = depth;
2044 ), 2148 ),
2045 2149
2046 TP_printk("dev %d,%d ino %lu since %u depth %d", 2150 TP_printk("dev %d,%d ino %lu since %u end %u depth %d",
2047 MAJOR(__entry->dev), MINOR(__entry->dev), 2151 MAJOR(__entry->dev), MINOR(__entry->dev),
2048 (unsigned long) __entry->ino, 2152 (unsigned long) __entry->ino,
2049 (unsigned) __entry->start, 2153 (unsigned) __entry->start,
2154 (unsigned) __entry->end,
2050 __entry->depth) 2155 __entry->depth)
2051); 2156);
2052 2157
2053TRACE_EVENT(ext4_ext_remove_space_done, 2158TRACE_EVENT(ext4_ext_remove_space_done,
2054 TP_PROTO(struct inode *inode, ext4_lblk_t start, int depth, 2159 TP_PROTO(struct inode *inode, ext4_lblk_t start, ext4_lblk_t end,
2055 ext4_lblk_t partial, __le16 eh_entries), 2160 int depth, long long partial, __le16 eh_entries),
2056 2161
2057 TP_ARGS(inode, start, depth, partial, eh_entries), 2162 TP_ARGS(inode, start, end, depth, partial, eh_entries),
2058 2163
2059 TP_STRUCT__entry( 2164 TP_STRUCT__entry(
2060 __field( dev_t, dev ) 2165 __field( dev_t, dev )
2061 __field( ino_t, ino ) 2166 __field( ino_t, ino )
2062 __field( ext4_lblk_t, start ) 2167 __field( ext4_lblk_t, start )
2168 __field( ext4_lblk_t, end )
2063 __field( int, depth ) 2169 __field( int, depth )
2064 __field( ext4_lblk_t, partial ) 2170 __field( long long, partial )
2065 __field( unsigned short, eh_entries ) 2171 __field( unsigned short, eh_entries )
2066 ), 2172 ),
2067 2173
@@ -2069,18 +2175,20 @@ TRACE_EVENT(ext4_ext_remove_space_done,
2069 __entry->dev = inode->i_sb->s_dev; 2175 __entry->dev = inode->i_sb->s_dev;
2070 __entry->ino = inode->i_ino; 2176 __entry->ino = inode->i_ino;
2071 __entry->start = start; 2177 __entry->start = start;
2178 __entry->end = end;
2072 __entry->depth = depth; 2179 __entry->depth = depth;
2073 __entry->partial = partial; 2180 __entry->partial = partial;
2074 __entry->eh_entries = le16_to_cpu(eh_entries); 2181 __entry->eh_entries = le16_to_cpu(eh_entries);
2075 ), 2182 ),
2076 2183
2077 TP_printk("dev %d,%d ino %lu since %u depth %d partial %u " 2184 TP_printk("dev %d,%d ino %lu since %u end %u depth %d partial %lld "
2078 "remaining_entries %u", 2185 "remaining_entries %u",
2079 MAJOR(__entry->dev), MINOR(__entry->dev), 2186 MAJOR(__entry->dev), MINOR(__entry->dev),
2080 (unsigned long) __entry->ino, 2187 (unsigned long) __entry->ino,
2081 (unsigned) __entry->start, 2188 (unsigned) __entry->start,
2189 (unsigned) __entry->end,
2082 __entry->depth, 2190 __entry->depth,
2083 (unsigned) __entry->partial, 2191 (long long) __entry->partial,
2084 (unsigned short) __entry->eh_entries) 2192 (unsigned short) __entry->eh_entries)
2085); 2193);
2086 2194
@@ -2095,7 +2203,7 @@ TRACE_EVENT(ext4_es_insert_extent,
2095 __field( ext4_lblk_t, lblk ) 2203 __field( ext4_lblk_t, lblk )
2096 __field( ext4_lblk_t, len ) 2204 __field( ext4_lblk_t, len )
2097 __field( ext4_fsblk_t, pblk ) 2205 __field( ext4_fsblk_t, pblk )
2098 __field( unsigned long long, status ) 2206 __field( char, status )
2099 ), 2207 ),
2100 2208
2101 TP_fast_assign( 2209 TP_fast_assign(
@@ -2104,14 +2212,14 @@ TRACE_EVENT(ext4_es_insert_extent,
2104 __entry->lblk = es->es_lblk; 2212 __entry->lblk = es->es_lblk;
2105 __entry->len = es->es_len; 2213 __entry->len = es->es_len;
2106 __entry->pblk = ext4_es_pblock(es); 2214 __entry->pblk = ext4_es_pblock(es);
2107 __entry->status = ext4_es_status(es); 2215 __entry->status = ext4_es_status(es) >> 60;
2108 ), 2216 ),
2109 2217
2110 TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %llx", 2218 TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2111 MAJOR(__entry->dev), MINOR(__entry->dev), 2219 MAJOR(__entry->dev), MINOR(__entry->dev),
2112 (unsigned long) __entry->ino, 2220 (unsigned long) __entry->ino,
2113 __entry->lblk, __entry->len, 2221 __entry->lblk, __entry->len,
2114 __entry->pblk, __entry->status) 2222 __entry->pblk, show_extent_status(__entry->status))
2115); 2223);
2116 2224
2117TRACE_EVENT(ext4_es_remove_extent, 2225TRACE_EVENT(ext4_es_remove_extent,
@@ -2172,7 +2280,7 @@ TRACE_EVENT(ext4_es_find_delayed_extent_range_exit,
2172 __field( ext4_lblk_t, lblk ) 2280 __field( ext4_lblk_t, lblk )
2173 __field( ext4_lblk_t, len ) 2281 __field( ext4_lblk_t, len )
2174 __field( ext4_fsblk_t, pblk ) 2282 __field( ext4_fsblk_t, pblk )
2175 __field( unsigned long long, status ) 2283 __field( char, status )
2176 ), 2284 ),
2177 2285
2178 TP_fast_assign( 2286 TP_fast_assign(
@@ -2181,14 +2289,14 @@ TRACE_EVENT(ext4_es_find_delayed_extent_range_exit,
2181 __entry->lblk = es->es_lblk; 2289 __entry->lblk = es->es_lblk;
2182 __entry->len = es->es_len; 2290 __entry->len = es->es_len;
2183 __entry->pblk = ext4_es_pblock(es); 2291 __entry->pblk = ext4_es_pblock(es);
2184 __entry->status = ext4_es_status(es); 2292 __entry->status = ext4_es_status(es) >> 60;
2185 ), 2293 ),
2186 2294
2187 TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %llx", 2295 TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2188 MAJOR(__entry->dev), MINOR(__entry->dev), 2296 MAJOR(__entry->dev), MINOR(__entry->dev),
2189 (unsigned long) __entry->ino, 2297 (unsigned long) __entry->ino,
2190 __entry->lblk, __entry->len, 2298 __entry->lblk, __entry->len,
2191 __entry->pblk, __entry->status) 2299 __entry->pblk, show_extent_status(__entry->status))
2192); 2300);
2193 2301
2194TRACE_EVENT(ext4_es_lookup_extent_enter, 2302TRACE_EVENT(ext4_es_lookup_extent_enter,
@@ -2225,7 +2333,7 @@ TRACE_EVENT(ext4_es_lookup_extent_exit,
2225 __field( ext4_lblk_t, lblk ) 2333 __field( ext4_lblk_t, lblk )
2226 __field( ext4_lblk_t, len ) 2334 __field( ext4_lblk_t, len )
2227 __field( ext4_fsblk_t, pblk ) 2335 __field( ext4_fsblk_t, pblk )
2228 __field( unsigned long long, status ) 2336 __field( char, status )
2229 __field( int, found ) 2337 __field( int, found )
2230 ), 2338 ),
2231 2339
@@ -2235,16 +2343,16 @@ TRACE_EVENT(ext4_es_lookup_extent_exit,
2235 __entry->lblk = es->es_lblk; 2343 __entry->lblk = es->es_lblk;
2236 __entry->len = es->es_len; 2344 __entry->len = es->es_len;
2237 __entry->pblk = ext4_es_pblock(es); 2345 __entry->pblk = ext4_es_pblock(es);
2238 __entry->status = ext4_es_status(es); 2346 __entry->status = ext4_es_status(es) >> 60;
2239 __entry->found = found; 2347 __entry->found = found;
2240 ), 2348 ),
2241 2349
2242 TP_printk("dev %d,%d ino %lu found %d [%u/%u) %llu %llx", 2350 TP_printk("dev %d,%d ino %lu found %d [%u/%u) %llu %s",
2243 MAJOR(__entry->dev), MINOR(__entry->dev), 2351 MAJOR(__entry->dev), MINOR(__entry->dev),
2244 (unsigned long) __entry->ino, __entry->found, 2352 (unsigned long) __entry->ino, __entry->found,
2245 __entry->lblk, __entry->len, 2353 __entry->lblk, __entry->len,
2246 __entry->found ? __entry->pblk : 0, 2354 __entry->found ? __entry->pblk : 0,
2247 __entry->found ? __entry->status : 0) 2355 show_extent_status(__entry->found ? __entry->status : 0))
2248); 2356);
2249 2357
2250TRACE_EVENT(ext4_es_shrink_enter, 2358TRACE_EVENT(ext4_es_shrink_enter,
diff --git a/include/trace/events/nmi.h b/include/trace/events/nmi.h
new file mode 100644
index 000000000000..da3ee96b8d03
--- /dev/null
+++ b/include/trace/events/nmi.h
@@ -0,0 +1,37 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM nmi
3
4#if !defined(_TRACE_NMI_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_NMI_H
6
7#include <linux/ktime.h>
8#include <linux/tracepoint.h>
9
10TRACE_EVENT(nmi_handler,
11
12 TP_PROTO(void *handler, s64 delta_ns, int handled),
13
14 TP_ARGS(handler, delta_ns, handled),
15
16 TP_STRUCT__entry(
17 __field( void *, handler )
18 __field( s64, delta_ns)
19 __field( int, handled )
20 ),
21
22 TP_fast_assign(
23 __entry->handler = handler;
24 __entry->delta_ns = delta_ns;
25 __entry->handled = handled;
26 ),
27
28 TP_printk("%ps() delta_ns: %lld handled: %d",
29 __entry->handler,
30 __entry->delta_ns,
31 __entry->handled)
32);
33
34#endif /* _TRACE_NMI_H */
35
36/* This part ust be outside protection */
37#include <trace/define_trace.h>
diff --git a/include/trace/events/pagemap.h b/include/trace/events/pagemap.h
new file mode 100644
index 000000000000..1c9fabde69e4
--- /dev/null
+++ b/include/trace/events/pagemap.h
@@ -0,0 +1,89 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM pagemap
3
4#if !defined(_TRACE_PAGEMAP_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_PAGEMAP_H
6
7#include <linux/tracepoint.h>
8#include <linux/mm.h>
9
10#define PAGEMAP_MAPPED 0x0001u
11#define PAGEMAP_ANONYMOUS 0x0002u
12#define PAGEMAP_FILE 0x0004u
13#define PAGEMAP_SWAPCACHE 0x0008u
14#define PAGEMAP_SWAPBACKED 0x0010u
15#define PAGEMAP_MAPPEDDISK 0x0020u
16#define PAGEMAP_BUFFERS 0x0040u
17
18#define trace_pagemap_flags(page) ( \
19 (PageAnon(page) ? PAGEMAP_ANONYMOUS : PAGEMAP_FILE) | \
20 (page_mapped(page) ? PAGEMAP_MAPPED : 0) | \
21 (PageSwapCache(page) ? PAGEMAP_SWAPCACHE : 0) | \
22 (PageSwapBacked(page) ? PAGEMAP_SWAPBACKED : 0) | \
23 (PageMappedToDisk(page) ? PAGEMAP_MAPPEDDISK : 0) | \
24 (page_has_private(page) ? PAGEMAP_BUFFERS : 0) \
25 )
26
27TRACE_EVENT(mm_lru_insertion,
28
29 TP_PROTO(
30 struct page *page,
31 unsigned long pfn,
32 int lru,
33 unsigned long flags
34 ),
35
36 TP_ARGS(page, pfn, lru, flags),
37
38 TP_STRUCT__entry(
39 __field(struct page *, page )
40 __field(unsigned long, pfn )
41 __field(int, lru )
42 __field(unsigned long, flags )
43 ),
44
45 TP_fast_assign(
46 __entry->page = page;
47 __entry->pfn = pfn;
48 __entry->lru = lru;
49 __entry->flags = flags;
50 ),
51
52 /* Flag format is based on page-types.c formatting for pagemap */
53 TP_printk("page=%p pfn=%lu lru=%d flags=%s%s%s%s%s%s",
54 __entry->page,
55 __entry->pfn,
56 __entry->lru,
57 __entry->flags & PAGEMAP_MAPPED ? "M" : " ",
58 __entry->flags & PAGEMAP_ANONYMOUS ? "a" : "f",
59 __entry->flags & PAGEMAP_SWAPCACHE ? "s" : " ",
60 __entry->flags & PAGEMAP_SWAPBACKED ? "b" : " ",
61 __entry->flags & PAGEMAP_MAPPEDDISK ? "d" : " ",
62 __entry->flags & PAGEMAP_BUFFERS ? "B" : " ")
63);
64
65TRACE_EVENT(mm_lru_activate,
66
67 TP_PROTO(struct page *page, unsigned long pfn),
68
69 TP_ARGS(page, pfn),
70
71 TP_STRUCT__entry(
72 __field(struct page *, page )
73 __field(unsigned long, pfn )
74 ),
75
76 TP_fast_assign(
77 __entry->page = page;
78 __entry->pfn = pfn;
79 ),
80
81 /* Flag format is based on page-types.c formatting for pagemap */
82 TP_printk("page=%p pfn=%lu", __entry->page, __entry->pfn)
83
84);
85
86#endif /* _TRACE_PAGEMAP_H */
87
88/* This part must be outside protection */
89#include <trace/define_trace.h>
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 427acab5d69a..8e42410bd159 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -5,6 +5,7 @@
5#define _TRACE_POWER_H 5#define _TRACE_POWER_H
6 6
7#include <linux/ktime.h> 7#include <linux/ktime.h>
8#include <linux/pm_qos.h>
8#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
9 10
10DECLARE_EVENT_CLASS(cpu, 11DECLARE_EVENT_CLASS(cpu,
@@ -177,6 +178,178 @@ DEFINE_EVENT(power_domain, power_domain_target,
177 178
178 TP_ARGS(name, state, cpu_id) 179 TP_ARGS(name, state, cpu_id)
179); 180);
181
182/*
183 * The pm qos events are used for pm qos update
184 */
185DECLARE_EVENT_CLASS(pm_qos_request,
186
187 TP_PROTO(int pm_qos_class, s32 value),
188
189 TP_ARGS(pm_qos_class, value),
190
191 TP_STRUCT__entry(
192 __field( int, pm_qos_class )
193 __field( s32, value )
194 ),
195
196 TP_fast_assign(
197 __entry->pm_qos_class = pm_qos_class;
198 __entry->value = value;
199 ),
200
201 TP_printk("pm_qos_class=%s value=%d",
202 __print_symbolic(__entry->pm_qos_class,
203 { PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" },
204 { PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" },
205 { PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" }),
206 __entry->value)
207);
208
209DEFINE_EVENT(pm_qos_request, pm_qos_add_request,
210
211 TP_PROTO(int pm_qos_class, s32 value),
212
213 TP_ARGS(pm_qos_class, value)
214);
215
216DEFINE_EVENT(pm_qos_request, pm_qos_update_request,
217
218 TP_PROTO(int pm_qos_class, s32 value),
219
220 TP_ARGS(pm_qos_class, value)
221);
222
223DEFINE_EVENT(pm_qos_request, pm_qos_remove_request,
224
225 TP_PROTO(int pm_qos_class, s32 value),
226
227 TP_ARGS(pm_qos_class, value)
228);
229
230TRACE_EVENT(pm_qos_update_request_timeout,
231
232 TP_PROTO(int pm_qos_class, s32 value, unsigned long timeout_us),
233
234 TP_ARGS(pm_qos_class, value, timeout_us),
235
236 TP_STRUCT__entry(
237 __field( int, pm_qos_class )
238 __field( s32, value )
239 __field( unsigned long, timeout_us )
240 ),
241
242 TP_fast_assign(
243 __entry->pm_qos_class = pm_qos_class;
244 __entry->value = value;
245 __entry->timeout_us = timeout_us;
246 ),
247
248 TP_printk("pm_qos_class=%s value=%d, timeout_us=%ld",
249 __print_symbolic(__entry->pm_qos_class,
250 { PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" },
251 { PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" },
252 { PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" }),
253 __entry->value, __entry->timeout_us)
254);
255
256DECLARE_EVENT_CLASS(pm_qos_update,
257
258 TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
259
260 TP_ARGS(action, prev_value, curr_value),
261
262 TP_STRUCT__entry(
263 __field( enum pm_qos_req_action, action )
264 __field( int, prev_value )
265 __field( int, curr_value )
266 ),
267
268 TP_fast_assign(
269 __entry->action = action;
270 __entry->prev_value = prev_value;
271 __entry->curr_value = curr_value;
272 ),
273
274 TP_printk("action=%s prev_value=%d curr_value=%d",
275 __print_symbolic(__entry->action,
276 { PM_QOS_ADD_REQ, "ADD_REQ" },
277 { PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
278 { PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
279 __entry->prev_value, __entry->curr_value)
280);
281
282DEFINE_EVENT(pm_qos_update, pm_qos_update_target,
283
284 TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
285
286 TP_ARGS(action, prev_value, curr_value)
287);
288
289DEFINE_EVENT_PRINT(pm_qos_update, pm_qos_update_flags,
290
291 TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
292
293 TP_ARGS(action, prev_value, curr_value),
294
295 TP_printk("action=%s prev_value=0x%x curr_value=0x%x",
296 __print_symbolic(__entry->action,
297 { PM_QOS_ADD_REQ, "ADD_REQ" },
298 { PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
299 { PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
300 __entry->prev_value, __entry->curr_value)
301);
302
303DECLARE_EVENT_CLASS(dev_pm_qos_request,
304
305 TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
306 s32 new_value),
307
308 TP_ARGS(name, type, new_value),
309
310 TP_STRUCT__entry(
311 __string( name, name )
312 __field( enum dev_pm_qos_req_type, type )
313 __field( s32, new_value )
314 ),
315
316 TP_fast_assign(
317 __assign_str(name, name);
318 __entry->type = type;
319 __entry->new_value = new_value;
320 ),
321
322 TP_printk("device=%s type=%s new_value=%d",
323 __get_str(name),
324 __print_symbolic(__entry->type,
325 { DEV_PM_QOS_LATENCY, "DEV_PM_QOS_LATENCY" },
326 { DEV_PM_QOS_FLAGS, "DEV_PM_QOS_FLAGS" }),
327 __entry->new_value)
328);
329
330DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_add_request,
331
332 TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
333 s32 new_value),
334
335 TP_ARGS(name, type, new_value)
336);
337
338DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_update_request,
339
340 TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
341 s32 new_value),
342
343 TP_ARGS(name, type, new_value)
344);
345
346DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_remove_request,
347
348 TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
349 s32 new_value),
350
351 TP_ARGS(name, type, new_value)
352);
180#endif /* _TRACE_POWER_H */ 353#endif /* _TRACE_POWER_H */
181 354
182/* This part must be outside protection */ 355/* This part must be outside protection */
diff --git a/include/trace/events/regmap.h b/include/trace/events/regmap.h
index a43a2f67bd8e..23d561512f64 100644
--- a/include/trace/events/regmap.h
+++ b/include/trace/events/regmap.h
@@ -223,6 +223,29 @@ DEFINE_EVENT(regmap_async, regmap_async_complete_done,
223 223
224); 224);
225 225
226TRACE_EVENT(regcache_drop_region,
227
228 TP_PROTO(struct device *dev, unsigned int from,
229 unsigned int to),
230
231 TP_ARGS(dev, from, to),
232
233 TP_STRUCT__entry(
234 __string( name, dev_name(dev) )
235 __field( unsigned int, from )
236 __field( unsigned int, to )
237 ),
238
239 TP_fast_assign(
240 __assign_str(name, dev_name(dev));
241 __entry->from = from;
242 __entry->to = to;
243 ),
244
245 TP_printk("%s %u-%u", __get_str(name), (unsigned int)__entry->from,
246 (unsigned int)__entry->to)
247);
248
226#endif /* _TRACE_REGMAP_H */ 249#endif /* _TRACE_REGMAP_H */
227 250
228/* This part must be outside protection */ 251/* This part must be outside protection */
diff --git a/include/trace/events/target.h b/include/trace/events/target.h
new file mode 100644
index 000000000000..aef8fc354025
--- /dev/null
+++ b/include/trace/events/target.h
@@ -0,0 +1,214 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM target
3
4#if !defined(_TRACE_TARGET_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_TARGET_H
6
7#include <linux/tracepoint.h>
8#include <linux/trace_seq.h>
9#include <scsi/scsi.h>
10#include <scsi/scsi_tcq.h>
11#include <target/target_core_base.h>
12
13/* cribbed verbatim from <trace/event/scsi.h> */
14#define scsi_opcode_name(opcode) { opcode, #opcode }
15#define show_opcode_name(val) \
16 __print_symbolic(val, \
17 scsi_opcode_name(TEST_UNIT_READY), \
18 scsi_opcode_name(REZERO_UNIT), \
19 scsi_opcode_name(REQUEST_SENSE), \
20 scsi_opcode_name(FORMAT_UNIT), \
21 scsi_opcode_name(READ_BLOCK_LIMITS), \
22 scsi_opcode_name(REASSIGN_BLOCKS), \
23 scsi_opcode_name(INITIALIZE_ELEMENT_STATUS), \
24 scsi_opcode_name(READ_6), \
25 scsi_opcode_name(WRITE_6), \
26 scsi_opcode_name(SEEK_6), \
27 scsi_opcode_name(READ_REVERSE), \
28 scsi_opcode_name(WRITE_FILEMARKS), \
29 scsi_opcode_name(SPACE), \
30 scsi_opcode_name(INQUIRY), \
31 scsi_opcode_name(RECOVER_BUFFERED_DATA), \
32 scsi_opcode_name(MODE_SELECT), \
33 scsi_opcode_name(RESERVE), \
34 scsi_opcode_name(RELEASE), \
35 scsi_opcode_name(COPY), \
36 scsi_opcode_name(ERASE), \
37 scsi_opcode_name(MODE_SENSE), \
38 scsi_opcode_name(START_STOP), \
39 scsi_opcode_name(RECEIVE_DIAGNOSTIC), \
40 scsi_opcode_name(SEND_DIAGNOSTIC), \
41 scsi_opcode_name(ALLOW_MEDIUM_REMOVAL), \
42 scsi_opcode_name(SET_WINDOW), \
43 scsi_opcode_name(READ_CAPACITY), \
44 scsi_opcode_name(READ_10), \
45 scsi_opcode_name(WRITE_10), \
46 scsi_opcode_name(SEEK_10), \
47 scsi_opcode_name(POSITION_TO_ELEMENT), \
48 scsi_opcode_name(WRITE_VERIFY), \
49 scsi_opcode_name(VERIFY), \
50 scsi_opcode_name(SEARCH_HIGH), \
51 scsi_opcode_name(SEARCH_EQUAL), \
52 scsi_opcode_name(SEARCH_LOW), \
53 scsi_opcode_name(SET_LIMITS), \
54 scsi_opcode_name(PRE_FETCH), \
55 scsi_opcode_name(READ_POSITION), \
56 scsi_opcode_name(SYNCHRONIZE_CACHE), \
57 scsi_opcode_name(LOCK_UNLOCK_CACHE), \
58 scsi_opcode_name(READ_DEFECT_DATA), \
59 scsi_opcode_name(MEDIUM_SCAN), \
60 scsi_opcode_name(COMPARE), \
61 scsi_opcode_name(COPY_VERIFY), \
62 scsi_opcode_name(WRITE_BUFFER), \
63 scsi_opcode_name(READ_BUFFER), \
64 scsi_opcode_name(UPDATE_BLOCK), \
65 scsi_opcode_name(READ_LONG), \
66 scsi_opcode_name(WRITE_LONG), \
67 scsi_opcode_name(CHANGE_DEFINITION), \
68 scsi_opcode_name(WRITE_SAME), \
69 scsi_opcode_name(UNMAP), \
70 scsi_opcode_name(READ_TOC), \
71 scsi_opcode_name(LOG_SELECT), \
72 scsi_opcode_name(LOG_SENSE), \
73 scsi_opcode_name(XDWRITEREAD_10), \
74 scsi_opcode_name(MODE_SELECT_10), \
75 scsi_opcode_name(RESERVE_10), \
76 scsi_opcode_name(RELEASE_10), \
77 scsi_opcode_name(MODE_SENSE_10), \
78 scsi_opcode_name(PERSISTENT_RESERVE_IN), \
79 scsi_opcode_name(PERSISTENT_RESERVE_OUT), \
80 scsi_opcode_name(VARIABLE_LENGTH_CMD), \
81 scsi_opcode_name(REPORT_LUNS), \
82 scsi_opcode_name(MAINTENANCE_IN), \
83 scsi_opcode_name(MAINTENANCE_OUT), \
84 scsi_opcode_name(MOVE_MEDIUM), \
85 scsi_opcode_name(EXCHANGE_MEDIUM), \
86 scsi_opcode_name(READ_12), \
87 scsi_opcode_name(WRITE_12), \
88 scsi_opcode_name(WRITE_VERIFY_12), \
89 scsi_opcode_name(SEARCH_HIGH_12), \
90 scsi_opcode_name(SEARCH_EQUAL_12), \
91 scsi_opcode_name(SEARCH_LOW_12), \
92 scsi_opcode_name(READ_ELEMENT_STATUS), \
93 scsi_opcode_name(SEND_VOLUME_TAG), \
94 scsi_opcode_name(WRITE_LONG_2), \
95 scsi_opcode_name(READ_16), \
96 scsi_opcode_name(WRITE_16), \
97 scsi_opcode_name(VERIFY_16), \
98 scsi_opcode_name(WRITE_SAME_16), \
99 scsi_opcode_name(SERVICE_ACTION_IN), \
100 scsi_opcode_name(SAI_READ_CAPACITY_16), \
101 scsi_opcode_name(SAI_GET_LBA_STATUS), \
102 scsi_opcode_name(MI_REPORT_TARGET_PGS), \
103 scsi_opcode_name(MO_SET_TARGET_PGS), \
104 scsi_opcode_name(READ_32), \
105 scsi_opcode_name(WRITE_32), \
106 scsi_opcode_name(WRITE_SAME_32), \
107 scsi_opcode_name(ATA_16), \
108 scsi_opcode_name(ATA_12))
109
110#define show_task_attribute_name(val) \
111 __print_symbolic(val, \
112 { MSG_SIMPLE_TAG, "SIMPLE" }, \
113 { MSG_HEAD_TAG, "HEAD" }, \
114 { MSG_ORDERED_TAG, "ORDERED" }, \
115 { MSG_ACA_TAG, "ACA" } )
116
117#define show_scsi_status_name(val) \
118 __print_symbolic(val, \
119 { SAM_STAT_GOOD, "GOOD" }, \
120 { SAM_STAT_CHECK_CONDITION, "CHECK CONDITION" }, \
121 { SAM_STAT_CONDITION_MET, "CONDITION MET" }, \
122 { SAM_STAT_BUSY, "BUSY" }, \
123 { SAM_STAT_INTERMEDIATE, "INTERMEDIATE" }, \
124 { SAM_STAT_INTERMEDIATE_CONDITION_MET, "INTERMEDIATE CONDITION MET" }, \
125 { SAM_STAT_RESERVATION_CONFLICT, "RESERVATION CONFLICT" }, \
126 { SAM_STAT_COMMAND_TERMINATED, "COMMAND TERMINATED" }, \
127 { SAM_STAT_TASK_SET_FULL, "TASK SET FULL" }, \
128 { SAM_STAT_ACA_ACTIVE, "ACA ACTIVE" }, \
129 { SAM_STAT_TASK_ABORTED, "TASK ABORTED" } )
130
131TRACE_EVENT(target_sequencer_start,
132
133 TP_PROTO(struct se_cmd *cmd),
134
135 TP_ARGS(cmd),
136
137 TP_STRUCT__entry(
138 __field( unsigned int, unpacked_lun )
139 __field( unsigned int, opcode )
140 __field( unsigned int, data_length )
141 __field( unsigned int, task_attribute )
142 __array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE )
143 __string( initiator, cmd->se_sess->se_node_acl->initiatorname )
144 ),
145
146 TP_fast_assign(
147 __entry->unpacked_lun = cmd->se_lun->unpacked_lun;
148 __entry->opcode = cmd->t_task_cdb[0];
149 __entry->data_length = cmd->data_length;
150 __entry->task_attribute = cmd->sam_task_attr;
151 memcpy(__entry->cdb, cmd->t_task_cdb, TCM_MAX_COMMAND_SIZE);
152 __assign_str(initiator, cmd->se_sess->se_node_acl->initiatorname);
153 ),
154
155 TP_printk("%s -> LUN %03u %s data_length %6u CDB %s (TA:%s C:%02x)",
156 __get_str(initiator), __entry->unpacked_lun,
157 show_opcode_name(__entry->opcode),
158 __entry->data_length, __print_hex(__entry->cdb, 16),
159 show_task_attribute_name(__entry->task_attribute),
160 scsi_command_size(__entry->cdb) <= 16 ?
161 __entry->cdb[scsi_command_size(__entry->cdb) - 1] :
162 __entry->cdb[1]
163 )
164);
165
166TRACE_EVENT(target_cmd_complete,
167
168 TP_PROTO(struct se_cmd *cmd),
169
170 TP_ARGS(cmd),
171
172 TP_STRUCT__entry(
173 __field( unsigned int, unpacked_lun )
174 __field( unsigned int, opcode )
175 __field( unsigned int, data_length )
176 __field( unsigned int, task_attribute )
177 __field( unsigned char, scsi_status )
178 __field( unsigned char, sense_length )
179 __array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE )
180 __array( unsigned char, sense_data, 18 )
181 __string(initiator, cmd->se_sess->se_node_acl->initiatorname)
182 ),
183
184 TP_fast_assign(
185 __entry->unpacked_lun = cmd->se_lun->unpacked_lun;
186 __entry->opcode = cmd->t_task_cdb[0];
187 __entry->data_length = cmd->data_length;
188 __entry->task_attribute = cmd->sam_task_attr;
189 __entry->scsi_status = cmd->scsi_status;
190 __entry->sense_length = cmd->scsi_status == SAM_STAT_CHECK_CONDITION ?
191 min(18, ((u8 *) cmd->sense_buffer)[SPC_ADD_SENSE_LEN_OFFSET] + 8) : 0;
192 memcpy(__entry->cdb, cmd->t_task_cdb, TCM_MAX_COMMAND_SIZE);
193 memcpy(__entry->sense_data, cmd->sense_buffer, __entry->sense_length);
194 __assign_str(initiator, cmd->se_sess->se_node_acl->initiatorname);
195 ),
196
197 TP_printk("%s <- LUN %03u status %s (sense len %d%s%s) %s data_length %6u CDB %s (TA:%s C:%02x)",
198 __get_str(initiator), __entry->unpacked_lun,
199 show_scsi_status_name(__entry->scsi_status),
200 __entry->sense_length, __entry->sense_length ? " / " : "",
201 __print_hex(__entry->sense_data, __entry->sense_length),
202 show_opcode_name(__entry->opcode),
203 __entry->data_length, __print_hex(__entry->cdb, 16),
204 show_task_attribute_name(__entry->task_attribute),
205 scsi_command_size(__entry->cdb) <= 16 ?
206 __entry->cdb[scsi_command_size(__entry->cdb) - 1] :
207 __entry->cdb[1]
208 )
209);
210
211#endif /* _TRACE_TARGET_H */
212
213/* This part must be outside protection */
214#include <trace/define_trace.h>
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 19edd7facaa1..41a6643e2136 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -71,6 +71,10 @@
71 static struct ftrace_event_call __used \ 71 static struct ftrace_event_call __used \
72 __attribute__((__aligned__(4))) event_##name 72 __attribute__((__aligned__(4))) event_##name
73 73
74#undef DEFINE_EVENT_FN
75#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg) \
76 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
77
74#undef DEFINE_EVENT_PRINT 78#undef DEFINE_EVENT_PRINT
75#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ 79#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
76 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) 80 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
@@ -666,10 +670,6 @@ perf_trace_##call(void *__data, proto) \
666 sizeof(u64)); \ 670 sizeof(u64)); \
667 __entry_size -= sizeof(u32); \ 671 __entry_size -= sizeof(u32); \
668 \ 672 \
669 if (WARN_ONCE(__entry_size > PERF_MAX_TRACE_SIZE, \
670 "profile buffer not large enough")) \
671 return; \
672 \
673 entry = (struct ftrace_raw_##call *)perf_trace_buf_prepare( \ 673 entry = (struct ftrace_raw_##call *)perf_trace_buf_prepare( \
674 __entry_size, event_call->event.type, &__regs, &rctx); \ 674 __entry_size, event_call->event.type, &__regs, &rctx); \
675 if (!entry) \ 675 if (!entry) \
diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index 84bc4197e736..fed853f3d7aa 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -16,6 +16,7 @@
16 * @nb_args: number of parameters it takes 16 * @nb_args: number of parameters it takes
17 * @types: list of types as strings 17 * @types: list of types as strings
18 * @args: list of args as strings (args[i] matches types[i]) 18 * @args: list of args as strings (args[i] matches types[i])
19 * @enter_fields: list of fields for syscall_enter trace event
19 * @enter_event: associated syscall_enter trace event 20 * @enter_event: associated syscall_enter trace event
20 * @exit_event: associated syscall_exit trace event 21 * @exit_event: associated syscall_exit trace event
21 */ 22 */
diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h
index a48937d4a5ea..95e46c8e05f9 100644
--- a/include/uapi/asm-generic/fcntl.h
+++ b/include/uapi/asm-generic/fcntl.h
@@ -84,6 +84,14 @@
84#define O_PATH 010000000 84#define O_PATH 010000000
85#endif 85#endif
86 86
87#ifndef __O_TMPFILE
88#define __O_TMPFILE 020000000
89#endif
90
91/* a horrid kludge trying to make sure that this will fail on old kernels */
92#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
93#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT)
94
87#ifndef O_NDELAY 95#ifndef O_NDELAY
88#define O_NDELAY O_NONBLOCK 96#define O_NDELAY O_NONBLOCK
89#endif 97#endif
diff --git a/include/uapi/asm-generic/poll.h b/include/uapi/asm-generic/poll.h
index 9ce7f44aebd2..a9694982689f 100644
--- a/include/uapi/asm-generic/poll.h
+++ b/include/uapi/asm-generic/poll.h
@@ -30,6 +30,8 @@
30 30
31#define POLLFREE 0x4000 /* currently only for epoll */ 31#define POLLFREE 0x4000 /* currently only for epoll */
32 32
33#define POLL_BUSY_LOOP 0x8000
34
33struct pollfd { 35struct pollfd {
34 int fd; 36 int fd;
35 short events; 37 short events;
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index c5d2e3a1cf68..f04b69b6abf2 100644
--- a/include/uapi/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
@@ -76,4 +76,6 @@
76 76
77#define SO_SELECT_ERR_QUEUE 45 77#define SO_SELECT_ERR_QUEUE 45
78 78
79#define SO_BUSY_POLL 46
80
79#endif /* __ASM_GENERIC_SOCKET_H */ 81#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 0cc74c4403e4..a20a9b4d3871 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -361,7 +361,7 @@ __SYSCALL(__NR_syslog, sys_syslog)
361#define __NR_ptrace 117 361#define __NR_ptrace 117
362__SYSCALL(__NR_ptrace, sys_ptrace) 362__SYSCALL(__NR_ptrace, sys_ptrace)
363 363
364/* kernel/sched.c */ 364/* kernel/sched/core.c */
365#define __NR_sched_setparam 118 365#define __NR_sched_setparam 118
366__SYSCALL(__NR_sched_setparam, sys_sched_setparam) 366__SYSCALL(__NR_sched_setparam, sys_sched_setparam)
367#define __NR_sched_setscheduler 119 367#define __NR_sched_setscheduler 119
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 5a57be68bab7..238a166b9fe6 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -732,6 +732,7 @@ struct drm_prime_handle {
732#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) 732#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)
733#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) 733#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)
734#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property) 734#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property)
735#define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2)
735 736
736/** 737/**
737 * Device specific ioctls should only be in their respective headers 738 * Device specific ioctls should only be in their respective headers
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 090e5331ab7e..53db7cea373b 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -388,6 +388,19 @@ struct drm_mode_cursor {
388 __u32 handle; 388 __u32 handle;
389}; 389};
390 390
391struct drm_mode_cursor2 {
392 __u32 flags;
393 __u32 crtc_id;
394 __s32 x;
395 __s32 y;
396 __u32 width;
397 __u32 height;
398 /* driver specific handle */
399 __u32 handle;
400 __s32 hot_x;
401 __s32 hot_y;
402};
403
391struct drm_mode_crtc_lut { 404struct drm_mode_crtc_lut {
392 __u32 crtc_id; 405 __u32 crtc_id;
393 __u32 gamma_size; 406 __u32 gamma_size;
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 07d59419fe6b..923ed7fe5775 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -305,7 +305,7 @@ typedef struct drm_i915_irq_wait {
305#define I915_PARAM_HAS_WAIT_TIMEOUT 19 305#define I915_PARAM_HAS_WAIT_TIMEOUT 19
306#define I915_PARAM_HAS_SEMAPHORES 20 306#define I915_PARAM_HAS_SEMAPHORES 20
307#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21 307#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21
308#define I915_PARAM_RSVD_FOR_FUTURE_USE 22 308#define I915_PARAM_HAS_VEBOX 22
309#define I915_PARAM_HAS_SECURE_BATCHES 23 309#define I915_PARAM_HAS_SECURE_BATCHES 23
310#define I915_PARAM_HAS_PINNED_BATCHES 24 310#define I915_PARAM_HAS_PINNED_BATCHES 24
311#define I915_PARAM_HAS_EXEC_NO_RELOC 25 311#define I915_PARAM_HAS_EXEC_NO_RELOC 25
@@ -660,6 +660,7 @@ struct drm_i915_gem_execbuffer2 {
660#define I915_EXEC_RENDER (1<<0) 660#define I915_EXEC_RENDER (1<<0)
661#define I915_EXEC_BSD (2<<0) 661#define I915_EXEC_BSD (2<<0)
662#define I915_EXEC_BLT (3<<0) 662#define I915_EXEC_BLT (3<<0)
663#define I915_EXEC_VEBOX (4<<0)
663 664
664/* Used for switching the constants addressing mode on gen4+ RENDER ring. 665/* Used for switching the constants addressing mode on gen4+ RENDER ring.
665 * Gen6+ only supports relative addressing to dynamic state (default) and 666 * Gen6+ only supports relative addressing to dynamic state (default) and
diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h
index 6e132a2f7420..73bde4eaf16c 100644
--- a/include/uapi/drm/tegra_drm.h
+++ b/include/uapi/drm/tegra_drm.h
@@ -17,6 +17,8 @@
17#ifndef _UAPI_TEGRA_DRM_H_ 17#ifndef _UAPI_TEGRA_DRM_H_
18#define _UAPI_TEGRA_DRM_H_ 18#define _UAPI_TEGRA_DRM_H_
19 19
20#include <drm/drm.h>
21
20struct drm_tegra_gem_create { 22struct drm_tegra_gem_create {
21 __u64 size; 23 __u64 size;
22 __u32 flags; 24 __u32 flags;
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index bdc6e87ff3eb..997f9f2f0963 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -62,6 +62,7 @@ header-y += auxvec.h
62header-y += ax25.h 62header-y += ax25.h
63header-y += b1lli.h 63header-y += b1lli.h
64header-y += baycom.h 64header-y += baycom.h
65header-y += bcm933xx_hcs.h
65header-y += bfs_fs.h 66header-y += bfs_fs.h
66header-y += binfmts.h 67header-y += binfmts.h
67header-y += blkpg.h 68header-y += blkpg.h
diff --git a/include/uapi/linux/bcm933xx_hcs.h b/include/uapi/linux/bcm933xx_hcs.h
new file mode 100644
index 000000000000..d22821831549
--- /dev/null
+++ b/include/uapi/linux/bcm933xx_hcs.h
@@ -0,0 +1,24 @@
1/*
2 * Broadcom Cable Modem firmware format
3 */
4
5#ifndef __BCM933XX_HCS_H
6#define __BCM933XX_HCS_H
7
8#include <linux/types.h>
9
10struct bcm_hcs {
11 __u16 magic;
12 __u16 control;
13 __u16 rev_maj;
14 __u16 rev_min;
15 __u32 build_date;
16 __u32 filelen;
17 __u32 ldaddress;
18 char filename[64];
19 __u16 hcs;
20 __u16 her_znaet_chto;
21 __u32 crc;
22};
23
24#endif /* __BCM933XX_HCS */
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
index 5ef0df545a2a..05aed70627e2 100644
--- a/include/uapi/linux/btrfs.h
+++ b/include/uapi/linux/btrfs.h
@@ -447,6 +447,46 @@ struct btrfs_ioctl_send_args {
447 __u64 reserved[4]; /* in */ 447 __u64 reserved[4]; /* in */
448}; 448};
449 449
450/* Error codes as returned by the kernel */
451enum btrfs_err_code {
452 notused,
453 BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET,
454 BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET,
455 BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET,
456 BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET,
457 BTRFS_ERROR_DEV_TGT_REPLACE,
458 BTRFS_ERROR_DEV_MISSING_NOT_FOUND,
459 BTRFS_ERROR_DEV_ONLY_WRITABLE,
460 BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS
461};
462/* An error code to error string mapping for the kernel
463* error codes
464*/
465static inline char *btrfs_err_str(enum btrfs_err_code err_code)
466{
467 switch (err_code) {
468 case BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET:
469 return "unable to go below two devices on raid1";
470 case BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET:
471 return "unable to go below four devices on raid10";
472 case BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET:
473 return "unable to go below two devices on raid5";
474 case BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET:
475 return "unable to go below three devices on raid6";
476 case BTRFS_ERROR_DEV_TGT_REPLACE:
477 return "unable to remove the dev_replace target dev";
478 case BTRFS_ERROR_DEV_MISSING_NOT_FOUND:
479 return "no missing devices found to remove";
480 case BTRFS_ERROR_DEV_ONLY_WRITABLE:
481 return "unable to remove the only writeable device";
482 case BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS:
483 return "add/delete/balance/replace/resize operation "\
484 "in progress";
485 default:
486 return NULL;
487 }
488}
489
450#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \ 490#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
451 struct btrfs_ioctl_vol_args) 491 struct btrfs_ioctl_vol_args)
452#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \ 492#define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
@@ -530,6 +570,7 @@ struct btrfs_ioctl_send_args {
530 struct btrfs_ioctl_quota_rescan_args) 570 struct btrfs_ioctl_quota_rescan_args)
531#define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \ 571#define BTRFS_IOC_QUOTA_RESCAN_STATUS _IOR(BTRFS_IOCTL_MAGIC, 45, \
532 struct btrfs_ioctl_quota_rescan_args) 572 struct btrfs_ioctl_quota_rescan_args)
573#define BTRFS_IOC_QUOTA_RESCAN_WAIT _IO(BTRFS_IOCTL_MAGIC, 46)
533#define BTRFS_IOC_GET_FSLABEL _IOR(BTRFS_IOCTL_MAGIC, 49, \ 574#define BTRFS_IOC_GET_FSLABEL _IOR(BTRFS_IOCTL_MAGIC, 49, \
534 char[BTRFS_LABEL_SIZE]) 575 char[BTRFS_LABEL_SIZE])
535#define BTRFS_IOC_SET_FSLABEL _IOW(BTRFS_IOCTL_MAGIC, 50, \ 576#define BTRFS_IOC_SET_FSLABEL _IOW(BTRFS_IOCTL_MAGIC, 50, \
@@ -538,5 +579,4 @@ struct btrfs_ioctl_send_args {
538 struct btrfs_ioctl_get_dev_stats) 579 struct btrfs_ioctl_get_dev_stats)
539#define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \ 580#define BTRFS_IOC_DEV_REPLACE _IOWR(BTRFS_IOCTL_MAGIC, 53, \
540 struct btrfs_ioctl_dev_replace_args) 581 struct btrfs_ioctl_dev_replace_args)
541
542#endif /* _UAPI_LINUX_BTRFS_H */ 582#endif /* _UAPI_LINUX_BTRFS_H */
diff --git a/include/uapi/linux/const.h b/include/uapi/linux/const.h
index c22c707c455d..c872bfd25e13 100644
--- a/include/uapi/linux/const.h
+++ b/include/uapi/linux/const.h
@@ -21,4 +21,7 @@
21#define _AT(T,X) ((T)(X)) 21#define _AT(T,X) ((T)(X))
22#endif 22#endif
23 23
24#define _BITUL(x) (_AC(1,UL) << (x))
25#define _BITULL(x) (_AC(1,ULL) << (x))
26
24#endif /* !(_LINUX_CONST_H) */ 27#endif /* !(_LINUX_CONST_H) */
diff --git a/include/uapi/linux/dm-ioctl.h b/include/uapi/linux/dm-ioctl.h
index 7e75b6fd8d45..afd0cbd52edb 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 24 270#define DM_VERSION_MINOR 25
271#define DM_VERSION_PATCHLEVEL 0 271#define DM_VERSION_PATCHLEVEL 0
272#define DM_VERSION_EXTRA "-ioctl (2013-01-15)" 272#define DM_VERSION_EXTRA "-ioctl (2013-06-26)"
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/ethtool.h b/include/uapi/linux/ethtool.h
index 0c9b44871df0..38dbafaa5341 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -993,8 +993,8 @@ enum ethtool_sfeatures_retval_bits {
993#define PORT_OTHER 0xff 993#define PORT_OTHER 0xff
994 994
995/* Which transceiver to use. */ 995/* Which transceiver to use. */
996#define XCVR_INTERNAL 0x00 996#define XCVR_INTERNAL 0x00 /* PHY and MAC are in the same package */
997#define XCVR_EXTERNAL 0x01 997#define XCVR_EXTERNAL 0x01 /* PHY and MAC are in different packages */
998#define XCVR_DUMMY1 0x02 998#define XCVR_DUMMY1 0x02
999#define XCVR_DUMMY2 0x03 999#define XCVR_DUMMY2 0x03
1000#define XCVR_DUMMY3 0x04 1000#define XCVR_DUMMY3 0x04
diff --git a/include/uapi/linux/firewire-cdev.h b/include/uapi/linux/firewire-cdev.h
index d50036953497..1db453e4b550 100644
--- a/include/uapi/linux/firewire-cdev.h
+++ b/include/uapi/linux/firewire-cdev.h
@@ -215,8 +215,8 @@ struct fw_cdev_event_request2 {
215 * with the %FW_CDEV_ISO_INTERRUPT bit set, when explicitly requested with 215 * with the %FW_CDEV_ISO_INTERRUPT bit set, when explicitly requested with
216 * %FW_CDEV_IOC_FLUSH_ISO, or when there have been so many completed packets 216 * %FW_CDEV_IOC_FLUSH_ISO, or when there have been so many completed packets
217 * without the interrupt bit set that the kernel's internal buffer for @header 217 * without the interrupt bit set that the kernel's internal buffer for @header
218 * is about to overflow. (In the last case, kernels with ABI version < 5 drop 218 * is about to overflow. (In the last case, ABI versions < 5 drop header data
219 * header data up to the next interrupt packet.) 219 * up to the next interrupt packet.)
220 * 220 *
221 * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT): 221 * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT):
222 * 222 *
diff --git a/include/uapi/linux/gen_stats.h b/include/uapi/linux/gen_stats.h
index 552c8a0a12d1..6487317ea619 100644
--- a/include/uapi/linux/gen_stats.h
+++ b/include/uapi/linux/gen_stats.h
@@ -9,6 +9,7 @@ enum {
9 TCA_STATS_RATE_EST, 9 TCA_STATS_RATE_EST,
10 TCA_STATS_QUEUE, 10 TCA_STATS_QUEUE,
11 TCA_STATS_APP, 11 TCA_STATS_APP,
12 TCA_STATS_RATE_EST64,
12 __TCA_STATS_MAX, 13 __TCA_STATS_MAX,
13}; 14};
14#define TCA_STATS_MAX (__TCA_STATS_MAX - 1) 15#define TCA_STATS_MAX (__TCA_STATS_MAX - 1)
@@ -38,6 +39,16 @@ struct gnet_stats_rate_est {
38}; 39};
39 40
40/** 41/**
42 * struct gnet_stats_rate_est64 - rate estimator
43 * @bps: current byte rate
44 * @pps: current packet rate
45 */
46struct gnet_stats_rate_est64 {
47 __u64 bps;
48 __u64 pps;
49};
50
51/**
41 * struct gnet_stats_queue - queuing statistics 52 * struct gnet_stats_queue - queuing statistics
42 * @qlen: queue length 53 * @qlen: queue length
43 * @backlog: backlog size of queue 54 * @backlog: backlog size of queue
diff --git a/include/uapi/linux/if_arp.h b/include/uapi/linux/if_arp.h
index 82c7d1bdadeb..d7fea3496f32 100644
--- a/include/uapi/linux/if_arp.h
+++ b/include/uapi/linux/if_arp.h
@@ -93,6 +93,7 @@
93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
94#define ARPHRD_CAIF 822 /* CAIF media type */ 94#define ARPHRD_CAIF 822 /* CAIF media type */
95#define ARPHRD_IP6GRE 823 /* GRE over IPv6 */ 95#define ARPHRD_IP6GRE 823 /* GRE over IPv6 */
96#define ARPHRD_NETLINK 824 /* Netlink header */
96 97
97#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ 98#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
98#define ARPHRD_NONE 0xFFFE /* zero header length */ 99#define ARPHRD_NONE 0xFFFE /* zero header length */
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index b05823cae784..03f6170ab337 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -221,6 +221,8 @@ enum {
221 IFLA_BRPORT_GUARD, /* bpdu guard */ 221 IFLA_BRPORT_GUARD, /* bpdu guard */
222 IFLA_BRPORT_PROTECT, /* root port protection */ 222 IFLA_BRPORT_PROTECT, /* root port protection */
223 IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */ 223 IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */
224 IFLA_BRPORT_LEARNING, /* mac learning */
225 IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */
224 __IFLA_BRPORT_MAX 226 __IFLA_BRPORT_MAX
225}; 227};
226#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) 228#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
@@ -336,6 +338,7 @@ enum {
336 IFLA_VF_VLAN, 338 IFLA_VF_VLAN,
337 IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */ 339 IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */
338 IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */ 340 IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */
341 IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */
339 __IFLA_VF_MAX, 342 __IFLA_VF_MAX,
340}; 343};
341 344
@@ -362,6 +365,18 @@ struct ifla_vf_spoofchk {
362 __u32 setting; 365 __u32 setting;
363}; 366};
364 367
368enum {
369 IFLA_VF_LINK_STATE_AUTO, /* link state of the uplink */
370 IFLA_VF_LINK_STATE_ENABLE, /* link always up */
371 IFLA_VF_LINK_STATE_DISABLE, /* link always down */
372 __IFLA_VF_LINK_STATE_MAX,
373};
374
375struct ifla_vf_link_state {
376 __u32 vf;
377 __u32 link_state;
378};
379
365/* VF ports management section 380/* VF ports management section
366 * 381 *
367 * Nested layout of set/get msg is: 382 * Nested layout of set/get msg is:
diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
index 0b46fd57c8f6..e36a4aecd311 100644
--- a/include/uapi/linux/if_pppox.h
+++ b/include/uapi/linux/if_pppox.h
@@ -135,11 +135,11 @@ struct pppoe_tag {
135 135
136struct pppoe_hdr { 136struct pppoe_hdr {
137#if defined(__LITTLE_ENDIAN_BITFIELD) 137#if defined(__LITTLE_ENDIAN_BITFIELD)
138 __u8 ver : 4;
139 __u8 type : 4; 138 __u8 type : 4;
139 __u8 ver : 4;
140#elif defined(__BIG_ENDIAN_BITFIELD) 140#elif defined(__BIG_ENDIAN_BITFIELD)
141 __u8 type : 4;
142 __u8 ver : 4; 141 __u8 ver : 4;
142 __u8 type : 4;
143#else 143#else
144#error "Please fix <asm/byteorder.h>" 144#error "Please fix <asm/byteorder.h>"
145#endif 145#endif
diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h
index 2835b85fd46d..82334f88967e 100644
--- a/include/uapi/linux/if_tun.h
+++ b/include/uapi/linux/if_tun.h
@@ -68,6 +68,8 @@
68#define IFF_MULTI_QUEUE 0x0100 68#define IFF_MULTI_QUEUE 0x0100
69#define IFF_ATTACH_QUEUE 0x0200 69#define IFF_ATTACH_QUEUE 0x0200
70#define IFF_DETACH_QUEUE 0x0400 70#define IFF_DETACH_QUEUE 0x0400
71/* read-only flag */
72#define IFF_PERSIST 0x0800
71 73
72/* Features for GSO (TUNSETOFFLOAD). */ 74/* Features for GSO (TUNSETOFFLOAD). */
73#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ 75#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index 4649ee35b605..d584047b072b 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -506,11 +506,15 @@ struct input_keymap_entry {
506#define BTN_DEAD 0x12f 506#define BTN_DEAD 0x12f
507 507
508#define BTN_GAMEPAD 0x130 508#define BTN_GAMEPAD 0x130
509#define BTN_A 0x130 509#define BTN_SOUTH 0x130
510#define BTN_B 0x131 510#define BTN_A BTN_SOUTH
511#define BTN_EAST 0x131
512#define BTN_B BTN_EAST
511#define BTN_C 0x132 513#define BTN_C 0x132
512#define BTN_X 0x133 514#define BTN_NORTH 0x133
513#define BTN_Y 0x134 515#define BTN_X BTN_NORTH
516#define BTN_WEST 0x134
517#define BTN_Y BTN_WEST
514#define BTN_Z 0x135 518#define BTN_Z 0x135
515#define BTN_TL 0x136 519#define BTN_TL 0x136
516#define BTN_TR 0x137 520#define BTN_TR 0x137
@@ -707,6 +711,11 @@ struct input_keymap_entry {
707#define KEY_ATTENDANT_TOGGLE 0x21d /* Attendant call on or off */ 711#define KEY_ATTENDANT_TOGGLE 0x21d /* Attendant call on or off */
708#define KEY_LIGHTS_TOGGLE 0x21e /* Reading light on or off */ 712#define KEY_LIGHTS_TOGGLE 0x21e /* Reading light on or off */
709 713
714#define BTN_DPAD_UP 0x220
715#define BTN_DPAD_DOWN 0x221
716#define BTN_DPAD_LEFT 0x222
717#define BTN_DPAD_RIGHT 0x223
718
710#define BTN_TRIGGER_HAPPY 0x2c0 719#define BTN_TRIGGER_HAPPY 0x2c0
711#define BTN_TRIGGER_HAPPY1 0x2c0 720#define BTN_TRIGGER_HAPPY1 0x2c0
712#define BTN_TRIGGER_HAPPY2 0x2c1 721#define BTN_TRIGGER_HAPPY2 0x2c1
diff --git a/include/uapi/linux/ip_vs.h b/include/uapi/linux/ip_vs.h
index a24537725e80..29458223d044 100644
--- a/include/uapi/linux/ip_vs.h
+++ b/include/uapi/linux/ip_vs.h
@@ -20,6 +20,12 @@
20#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */ 20#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
21#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */ 21#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
22#define IP_VS_SVC_F_ONEPACKET 0x0004 /* one-packet scheduling */ 22#define IP_VS_SVC_F_ONEPACKET 0x0004 /* one-packet scheduling */
23#define IP_VS_SVC_F_SCHED1 0x0008 /* scheduler flag 1 */
24#define IP_VS_SVC_F_SCHED2 0x0010 /* scheduler flag 2 */
25#define IP_VS_SVC_F_SCHED3 0x0020 /* scheduler flag 3 */
26
27#define IP_VS_SVC_F_SCHED_SH_FALLBACK IP_VS_SVC_F_SCHED1 /* SH fallback */
28#define IP_VS_SVC_F_SCHED_SH_PORT IP_VS_SVC_F_SCHED2 /* SH use port */
23 29
24/* 30/*
25 * Destination Server Flags 31 * Destination Server Flags
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index d88c8ee00c8b..acccd08be6c7 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -666,6 +666,7 @@ struct kvm_ppc_smmu_info {
666#define KVM_CAP_IRQ_MPIC 90 666#define KVM_CAP_IRQ_MPIC 90
667#define KVM_CAP_PPC_RTAS 91 667#define KVM_CAP_PPC_RTAS 91
668#define KVM_CAP_IRQ_XICS 92 668#define KVM_CAP_IRQ_XICS 92
669#define KVM_CAP_ARM_EL1_32BIT 93
669 670
670#ifdef KVM_CAP_IRQ_ROUTING 671#ifdef KVM_CAP_IRQ_ROUTING
671 672
@@ -783,6 +784,7 @@ struct kvm_dirty_tlb {
783#define KVM_REG_IA64 0x3000000000000000ULL 784#define KVM_REG_IA64 0x3000000000000000ULL
784#define KVM_REG_ARM 0x4000000000000000ULL 785#define KVM_REG_ARM 0x4000000000000000ULL
785#define KVM_REG_S390 0x5000000000000000ULL 786#define KVM_REG_S390 0x5000000000000000ULL
787#define KVM_REG_ARM64 0x6000000000000000ULL
786#define KVM_REG_MIPS 0x7000000000000000ULL 788#define KVM_REG_MIPS 0x7000000000000000ULL
787 789
788#define KVM_REG_SIZE_SHIFT 52 790#define KVM_REG_SIZE_SHIFT 52
diff --git a/include/uapi/linux/msdos_fs.h b/include/uapi/linux/msdos_fs.h
index f055e58b3147..e284ff919d6e 100644
--- a/include/uapi/linux/msdos_fs.h
+++ b/include/uapi/linux/msdos_fs.h
@@ -104,6 +104,8 @@ struct __fat_dirent {
104/* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */ 104/* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */
105#define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32) 105#define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32)
106#define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32) 106#define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32)
107/*Android kernel has used 0x12, so we use 0x13*/
108#define FAT_IOCTL_GET_VOLUME_ID _IOR('r', 0x13, __u32)
107 109
108struct fat_boot_sector { 110struct fat_boot_sector {
109 __u8 ignored[3]; /* Boot strap short or near jump */ 111 __u8 ignored[3]; /* Boot strap short or near jump */
@@ -128,6 +130,10 @@ struct fat_boot_sector {
128 __u8 drive_number; /* Physical drive number */ 130 __u8 drive_number; /* Physical drive number */
129 __u8 state; /* undocumented, but used 131 __u8 state; /* undocumented, but used
130 for mount state. */ 132 for mount state. */
133 __u8 signature; /* extended boot signature */
134 __u8 vol_id[4]; /* volume ID */
135 __u8 vol_label[11]; /* volume label */
136 __u8 fs_type[8]; /* file system type */
131 /* other fiealds are not added here */ 137 /* other fiealds are not added here */
132 } fat16; 138 } fat16;
133 139
@@ -147,6 +153,10 @@ struct fat_boot_sector {
147 __u8 drive_number; /* Physical drive number */ 153 __u8 drive_number; /* Physical drive number */
148 __u8 state; /* undocumented, but used 154 __u8 state; /* undocumented, but used
149 for mount state. */ 155 for mount state. */
156 __u8 signature; /* extended boot signature */
157 __u8 vol_id[4]; /* volume ID */
158 __u8 vol_label[11]; /* volume label */
159 __u8 fs_type[8]; /* file system type */
150 /* other fiealds are not added here */ 160 /* other fiealds are not added here */
151 } fat32; 161 } fat32;
152 }; 162 };
diff --git a/include/uapi/linux/netfilter/nfnetlink_queue.h b/include/uapi/linux/netfilter/nfnetlink_queue.h
index a2308ae5a73d..3a9b92147339 100644
--- a/include/uapi/linux/netfilter/nfnetlink_queue.h
+++ b/include/uapi/linux/netfilter/nfnetlink_queue.h
@@ -105,5 +105,7 @@ enum nfqnl_attr_config {
105#define NFQA_SKB_CSUMNOTREADY (1 << 0) 105#define NFQA_SKB_CSUMNOTREADY (1 << 0)
106/* packet is GSO (i.e., exceeds device mtu) */ 106/* packet is GSO (i.e., exceeds device mtu) */
107#define NFQA_SKB_GSO (1 << 1) 107#define NFQA_SKB_GSO (1 << 1)
108/* csum not validated (incoming device doesn't support hw checksum, etc.) */
109#define NFQA_SKB_CSUM_NOTVERIFIED (1 << 2)
108 110
109#endif /* _NFNETLINK_QUEUE_H */ 111#endif /* _NFNETLINK_QUEUE_H */
diff --git a/include/uapi/linux/netfilter/xt_socket.h b/include/uapi/linux/netfilter/xt_socket.h
index 26d7217bd4f1..6315e2ac3474 100644
--- a/include/uapi/linux/netfilter/xt_socket.h
+++ b/include/uapi/linux/netfilter/xt_socket.h
@@ -5,10 +5,17 @@
5 5
6enum { 6enum {
7 XT_SOCKET_TRANSPARENT = 1 << 0, 7 XT_SOCKET_TRANSPARENT = 1 << 0,
8 XT_SOCKET_NOWILDCARD = 1 << 1,
8}; 9};
9 10
10struct xt_socket_mtinfo1 { 11struct xt_socket_mtinfo1 {
11 __u8 flags; 12 __u8 flags;
12}; 13};
14#define XT_SOCKET_FLAGS_V1 XT_SOCKET_TRANSPARENT
15
16struct xt_socket_mtinfo2 {
17 __u8 flags;
18};
19#define XT_SOCKET_FLAGS_V2 (XT_SOCKET_TRANSPARENT | XT_SOCKET_NOWILDCARD)
13 20
14#endif /* _XT_SOCKET_H */ 21#endif /* _XT_SOCKET_H */
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 7c6f627a717d..8137dd8d2adf 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -69,6 +69,8 @@
69 * starting a poll from a device which has a secure element enabled means 69 * starting a poll from a device which has a secure element enabled means
70 * we want to do SE based card emulation. 70 * we want to do SE based card emulation.
71 * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element. 71 * @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element.
72 * @NFC_CMD_FW_DOWNLOAD: Request to Load/flash firmware, or event to inform
73 * that some firmware was loaded
72 */ 74 */
73enum nfc_commands { 75enum nfc_commands {
74 NFC_CMD_UNSPEC, 76 NFC_CMD_UNSPEC,
@@ -92,6 +94,9 @@ enum nfc_commands {
92 NFC_CMD_DISABLE_SE, 94 NFC_CMD_DISABLE_SE,
93 NFC_CMD_LLC_SDREQ, 95 NFC_CMD_LLC_SDREQ,
94 NFC_EVENT_LLC_SDRES, 96 NFC_EVENT_LLC_SDRES,
97 NFC_CMD_FW_DOWNLOAD,
98 NFC_EVENT_SE_ADDED,
99 NFC_EVENT_SE_REMOVED,
95/* private: internal use only */ 100/* private: internal use only */
96 __NFC_CMD_AFTER_LAST 101 __NFC_CMD_AFTER_LAST
97}; 102};
@@ -121,6 +126,9 @@ enum nfc_commands {
121 * @NFC_ATTR_LLC_PARAM_RW: Receive Window size parameter 126 * @NFC_ATTR_LLC_PARAM_RW: Receive Window size parameter
122 * @NFC_ATTR_LLC_PARAM_MIUX: MIU eXtension parameter 127 * @NFC_ATTR_LLC_PARAM_MIUX: MIU eXtension parameter
123 * @NFC_ATTR_SE: Available Secure Elements 128 * @NFC_ATTR_SE: Available Secure Elements
129 * @NFC_ATTR_FIRMWARE_NAME: Free format firmware version
130 * @NFC_ATTR_SE_INDEX: Secure element index
131 * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED)
124 */ 132 */
125enum nfc_attrs { 133enum nfc_attrs {
126 NFC_ATTR_UNSPEC, 134 NFC_ATTR_UNSPEC,
@@ -143,6 +151,9 @@ enum nfc_attrs {
143 NFC_ATTR_LLC_PARAM_MIUX, 151 NFC_ATTR_LLC_PARAM_MIUX,
144 NFC_ATTR_SE, 152 NFC_ATTR_SE,
145 NFC_ATTR_LLC_SDP, 153 NFC_ATTR_LLC_SDP,
154 NFC_ATTR_FIRMWARE_NAME,
155 NFC_ATTR_SE_INDEX,
156 NFC_ATTR_SE_TYPE,
146/* private: internal use only */ 157/* private: internal use only */
147 __NFC_ATTR_AFTER_LAST 158 __NFC_ATTR_AFTER_LAST
148}; 159};
@@ -159,9 +170,12 @@ enum nfc_sdp_attr {
159 170
160#define NFC_DEVICE_NAME_MAXSIZE 8 171#define NFC_DEVICE_NAME_MAXSIZE 8
161#define NFC_NFCID1_MAXSIZE 10 172#define NFC_NFCID1_MAXSIZE 10
173#define NFC_NFCID2_MAXSIZE 8
174#define NFC_NFCID3_MAXSIZE 10
162#define NFC_SENSB_RES_MAXSIZE 12 175#define NFC_SENSB_RES_MAXSIZE 12
163#define NFC_SENSF_RES_MAXSIZE 18 176#define NFC_SENSF_RES_MAXSIZE 18
164#define NFC_GB_MAXSIZE 48 177#define NFC_GB_MAXSIZE 48
178#define NFC_FIRMWARE_NAME_MAXSIZE 32
165 179
166/* NFC protocols */ 180/* NFC protocols */
167#define NFC_PROTO_JEWEL 1 181#define NFC_PROTO_JEWEL 1
@@ -191,10 +205,12 @@ enum nfc_sdp_attr {
191#define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B) 205#define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B)
192 206
193/* NFC Secure Elements */ 207/* NFC Secure Elements */
194#define NFC_SE_NONE 0x0
195#define NFC_SE_UICC 0x1 208#define NFC_SE_UICC 0x1
196#define NFC_SE_EMBEDDED 0x2 209#define NFC_SE_EMBEDDED 0x2
197 210
211#define NFC_SE_DISABLED 0x0
212#define NFC_SE_ENABLED 0x1
213
198struct sockaddr_nfc { 214struct sockaddr_nfc {
199 sa_family_t sa_family; 215 sa_family_t sa_family;
200 __u32 dev_idx; 216 __u32 dev_idx;
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index d1e48b5e348f..861e5eba3953 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -27,6 +27,8 @@
27 27
28#include <linux/types.h> 28#include <linux/types.h>
29 29
30#define NL80211_GENL_NAME "nl80211"
31
30/** 32/**
31 * DOC: Station handling 33 * DOC: Station handling
32 * 34 *
@@ -1429,6 +1431,11 @@ enum nl80211_commands {
1429 * @NL80211_ATTR_MAX_CRIT_PROT_DURATION: duration in milliseconds in which 1431 * @NL80211_ATTR_MAX_CRIT_PROT_DURATION: duration in milliseconds in which
1430 * the connection should have increased reliability (u16). 1432 * the connection should have increased reliability (u16).
1431 * 1433 *
1434 * @NL80211_ATTR_PEER_AID: Association ID for the peer TDLS station (u16).
1435 * This is similar to @NL80211_ATTR_STA_AID but with a difference of being
1436 * allowed to be used with the first @NL80211_CMD_SET_STATION command to
1437 * update a TDLS peer STA entry.
1438 *
1432 * @NL80211_ATTR_MAX: highest attribute number currently defined 1439 * @NL80211_ATTR_MAX: highest attribute number currently defined
1433 * @__NL80211_ATTR_AFTER_LAST: internal use 1440 * @__NL80211_ATTR_AFTER_LAST: internal use
1434 */ 1441 */
@@ -1727,6 +1734,8 @@ enum nl80211_attrs {
1727 NL80211_ATTR_CRIT_PROT_ID, 1734 NL80211_ATTR_CRIT_PROT_ID,
1728 NL80211_ATTR_MAX_CRIT_PROT_DURATION, 1735 NL80211_ATTR_MAX_CRIT_PROT_DURATION,
1729 1736
1737 NL80211_ATTR_PEER_AID,
1738
1730 /* add attributes here, update the policy in nl80211.c */ 1739 /* add attributes here, update the policy in nl80211.c */
1731 1740
1732 __NL80211_ATTR_AFTER_LAST, 1741 __NL80211_ATTR_AFTER_LAST,
@@ -1991,6 +2000,10 @@ enum nl80211_sta_bss_param {
1991 * @NL80211_STA_INFO_PEER_PM: peer mesh STA link-specific power mode 2000 * @NL80211_STA_INFO_PEER_PM: peer mesh STA link-specific power mode
1992 * @NL80211_STA_INFO_NONPEER_PM: neighbor mesh STA power save mode towards 2001 * @NL80211_STA_INFO_NONPEER_PM: neighbor mesh STA power save mode towards
1993 * non-peer STA 2002 * non-peer STA
2003 * @NL80211_STA_INFO_CHAIN_SIGNAL: per-chain signal strength of last PPDU
2004 * Contains a nested array of signal strength attributes (u8, dBm)
2005 * @NL80211_STA_INFO_CHAIN_SIGNAL_AVG: per-chain signal strength average
2006 * Same format as NL80211_STA_INFO_CHAIN_SIGNAL.
1994 * @__NL80211_STA_INFO_AFTER_LAST: internal 2007 * @__NL80211_STA_INFO_AFTER_LAST: internal
1995 * @NL80211_STA_INFO_MAX: highest possible station info attribute 2008 * @NL80211_STA_INFO_MAX: highest possible station info attribute
1996 */ 2009 */
@@ -2020,6 +2033,8 @@ enum nl80211_sta_info {
2020 NL80211_STA_INFO_NONPEER_PM, 2033 NL80211_STA_INFO_NONPEER_PM,
2021 NL80211_STA_INFO_RX_BYTES64, 2034 NL80211_STA_INFO_RX_BYTES64,
2022 NL80211_STA_INFO_TX_BYTES64, 2035 NL80211_STA_INFO_TX_BYTES64,
2036 NL80211_STA_INFO_CHAIN_SIGNAL,
2037 NL80211_STA_INFO_CHAIN_SIGNAL_AVG,
2023 2038
2024 /* keep last */ 2039 /* keep last */
2025 __NL80211_STA_INFO_AFTER_LAST, 2040 __NL80211_STA_INFO_AFTER_LAST,
@@ -2413,6 +2428,8 @@ enum nl80211_survey_info {
2413 * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering 2428 * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering
2414 * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing. 2429 * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing.
2415 * overrides all other flags. 2430 * overrides all other flags.
2431 * @NL80211_MNTR_FLAG_ACTIVE: use the configured MAC address
2432 * and ACK incoming unicast packets.
2416 * 2433 *
2417 * @__NL80211_MNTR_FLAG_AFTER_LAST: internal use 2434 * @__NL80211_MNTR_FLAG_AFTER_LAST: internal use
2418 * @NL80211_MNTR_FLAG_MAX: highest possible monitor flag 2435 * @NL80211_MNTR_FLAG_MAX: highest possible monitor flag
@@ -2424,6 +2441,7 @@ enum nl80211_mntr_flags {
2424 NL80211_MNTR_FLAG_CONTROL, 2441 NL80211_MNTR_FLAG_CONTROL,
2425 NL80211_MNTR_FLAG_OTHER_BSS, 2442 NL80211_MNTR_FLAG_OTHER_BSS,
2426 NL80211_MNTR_FLAG_COOK_FRAMES, 2443 NL80211_MNTR_FLAG_COOK_FRAMES,
2444 NL80211_MNTR_FLAG_ACTIVE,
2427 2445
2428 /* keep last */ 2446 /* keep last */
2429 __NL80211_MNTR_FLAG_AFTER_LAST, 2447 __NL80211_MNTR_FLAG_AFTER_LAST,
@@ -2559,6 +2577,10 @@ enum nl80211_mesh_power_mode {
2559 * 2577 *
2560 * @NL80211_MESHCONF_AWAKE_WINDOW: awake window duration (in TUs) 2578 * @NL80211_MESHCONF_AWAKE_WINDOW: awake window duration (in TUs)
2561 * 2579 *
2580 * @NL80211_MESHCONF_PLINK_TIMEOUT: If no tx activity is seen from a STA we've
2581 * established peering with for longer than this time (in seconds), then
2582 * remove it from the STA's list of peers. Default is 30 minutes.
2583 *
2562 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use 2584 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
2563 */ 2585 */
2564enum nl80211_meshconf_params { 2586enum nl80211_meshconf_params {
@@ -2590,6 +2612,7 @@ enum nl80211_meshconf_params {
2590 NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL, 2612 NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL,
2591 NL80211_MESHCONF_POWER_MODE, 2613 NL80211_MESHCONF_POWER_MODE,
2592 NL80211_MESHCONF_AWAKE_WINDOW, 2614 NL80211_MESHCONF_AWAKE_WINDOW,
2615 NL80211_MESHCONF_PLINK_TIMEOUT,
2593 2616
2594 /* keep last */ 2617 /* keep last */
2595 __NL80211_MESHCONF_ATTR_AFTER_LAST, 2618 __NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -2637,6 +2660,10 @@ enum nl80211_meshconf_params {
2637 * @NL80211_MESH_SETUP_USERSPACE_MPM: Enable this option if userspace will 2660 * @NL80211_MESH_SETUP_USERSPACE_MPM: Enable this option if userspace will
2638 * implement an MPM which handles peer allocation and state. 2661 * implement an MPM which handles peer allocation and state.
2639 * 2662 *
2663 * @NL80211_MESH_SETUP_AUTH_PROTOCOL: Inform the kernel of the authentication
2664 * method (u8, as defined in IEEE 8.4.2.100.6, e.g. 0x1 for SAE).
2665 * Default is no authentication method required.
2666 *
2640 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number 2667 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
2641 * 2668 *
2642 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use 2669 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
@@ -2650,6 +2677,7 @@ enum nl80211_mesh_setup_params {
2650 NL80211_MESH_SETUP_USERSPACE_AMPE, 2677 NL80211_MESH_SETUP_USERSPACE_AMPE,
2651 NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC, 2678 NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC,
2652 NL80211_MESH_SETUP_USERSPACE_MPM, 2679 NL80211_MESH_SETUP_USERSPACE_MPM,
2680 NL80211_MESH_SETUP_AUTH_PROTOCOL,
2653 2681
2654 /* keep last */ 2682 /* keep last */
2655 __NL80211_MESH_SETUP_ATTR_AFTER_LAST, 2683 __NL80211_MESH_SETUP_ATTR_AFTER_LAST,
@@ -2730,6 +2758,8 @@ enum nl80211_channel_type {
2730 * and %NL80211_ATTR_CENTER_FREQ2 attributes must be provided as well 2758 * and %NL80211_ATTR_CENTER_FREQ2 attributes must be provided as well
2731 * @NL80211_CHAN_WIDTH_160: 160 MHz channel, the %NL80211_ATTR_CENTER_FREQ1 2759 * @NL80211_CHAN_WIDTH_160: 160 MHz channel, the %NL80211_ATTR_CENTER_FREQ1
2732 * attribute must be provided as well 2760 * attribute must be provided as well
2761 * @NL80211_CHAN_WIDTH_5: 5 MHz OFDM channel
2762 * @NL80211_CHAN_WIDTH_10: 10 MHz OFDM channel
2733 */ 2763 */
2734enum nl80211_chan_width { 2764enum nl80211_chan_width {
2735 NL80211_CHAN_WIDTH_20_NOHT, 2765 NL80211_CHAN_WIDTH_20_NOHT,
@@ -2738,6 +2768,8 @@ enum nl80211_chan_width {
2738 NL80211_CHAN_WIDTH_80, 2768 NL80211_CHAN_WIDTH_80,
2739 NL80211_CHAN_WIDTH_80P80, 2769 NL80211_CHAN_WIDTH_80P80,
2740 NL80211_CHAN_WIDTH_160, 2770 NL80211_CHAN_WIDTH_160,
2771 NL80211_CHAN_WIDTH_5,
2772 NL80211_CHAN_WIDTH_10,
2741}; 2773};
2742 2774
2743/** 2775/**
@@ -3556,6 +3588,10 @@ enum nl80211_ap_sme_features {
3556 * Peering Management entity which may be implemented by registering for 3588 * Peering Management entity which may be implemented by registering for
3557 * beacons or NL80211_CMD_NEW_PEER_CANDIDATE events. The mesh beacon is 3589 * beacons or NL80211_CMD_NEW_PEER_CANDIDATE events. The mesh beacon is
3558 * still generated by the driver. 3590 * still generated by the driver.
3591 * @NL80211_FEATURE_ACTIVE_MONITOR: This driver supports an active monitor
3592 * interface. An active monitor interface behaves like a normal monitor
3593 * interface, but gets added to the driver. It ensures that incoming
3594 * unicast packets directed at the configured interface address get ACKed.
3559 */ 3595 */
3560enum nl80211_feature_flags { 3596enum nl80211_feature_flags {
3561 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 3597 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
@@ -3575,6 +3611,7 @@ enum nl80211_feature_flags {
3575 NL80211_FEATURE_ADVERTISE_CHAN_LIMITS = 1 << 14, 3611 NL80211_FEATURE_ADVERTISE_CHAN_LIMITS = 1 << 14,
3576 NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15, 3612 NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15,
3577 NL80211_FEATURE_USERSPACE_MPM = 1 << 16, 3613 NL80211_FEATURE_USERSPACE_MPM = 1 << 16,
3614 NL80211_FEATURE_ACTIVE_MONITOR = 1 << 17,
3578}; 3615};
3579 3616
3580/** 3617/**
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 405918dd7b3f..c55efaaa9bb4 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -164,6 +164,7 @@ enum ovs_vport_type {
164 OVS_VPORT_TYPE_UNSPEC, 164 OVS_VPORT_TYPE_UNSPEC,
165 OVS_VPORT_TYPE_NETDEV, /* network device */ 165 OVS_VPORT_TYPE_NETDEV, /* network device */
166 OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ 166 OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
167 OVS_VPORT_TYPE_GRE, /* GRE tunnel. */
167 __OVS_VPORT_TYPE_MAX 168 __OVS_VPORT_TYPE_MAX
168}; 169};
169 170
@@ -192,7 +193,6 @@ enum ovs_vport_type {
192 * optional; if not specified a free port number is automatically selected. 193 * optional; if not specified a free port number is automatically selected.
193 * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type 194 * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type
194 * of vport. 195 * of vport.
195 * and other attributes are ignored.
196 * 196 *
197 * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to 197 * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to
198 * look up the vport to operate on; otherwise dp_idx from the &struct 198 * look up the vport to operate on; otherwise dp_idx from the &struct
@@ -247,11 +247,29 @@ enum ovs_key_attr {
247 OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ 247 OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */
248 OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ 248 OVS_KEY_ATTR_ND, /* struct ovs_key_nd */
249 OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */ 249 OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */
250 OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */
251
252#ifdef __KERNEL__
253 OVS_KEY_ATTR_IPV4_TUNNEL, /* struct ovs_key_ipv4_tunnel */
254#endif
250 __OVS_KEY_ATTR_MAX 255 __OVS_KEY_ATTR_MAX
251}; 256};
252 257
253#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) 258#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
254 259
260enum ovs_tunnel_key_attr {
261 OVS_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */
262 OVS_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */
263 OVS_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */
264 OVS_TUNNEL_KEY_ATTR_TOS, /* u8 Tunnel IP ToS. */
265 OVS_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */
266 OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */
267 OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */
268 __OVS_TUNNEL_KEY_ATTR_MAX
269};
270
271#define OVS_TUNNEL_KEY_ATTR_MAX (__OVS_TUNNEL_KEY_ATTR_MAX - 1)
272
255/** 273/**
256 * enum ovs_frag_type - IPv4 and IPv6 fragment type 274 * enum ovs_frag_type - IPv4 and IPv6 fragment type
257 * @OVS_FRAG_TYPE_NONE: Packet is not a fragment. 275 * @OVS_FRAG_TYPE_NONE: Packet is not a fragment.
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 864e324da80d..c3cc01d474b0 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -468,7 +468,7 @@
468#define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ 468#define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */
469#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ 469#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */
470#define PCI_EXP_LNKCAP_L1EL 0x00038000 /* L1 Exit Latency */ 470#define PCI_EXP_LNKCAP_L1EL 0x00038000 /* L1 Exit Latency */
471#define PCI_EXP_LNKCAP_CLKPM 0x00040000 /* L1 Clock Power Management */ 471#define PCI_EXP_LNKCAP_CLKPM 0x00040000 /* Clock Power Management */
472#define PCI_EXP_LNKCAP_SDERC 0x00080000 /* Surprise Down Error Reporting Capable */ 472#define PCI_EXP_LNKCAP_SDERC 0x00080000 /* Surprise Down Error Reporting Capable */
473#define PCI_EXP_LNKCAP_DLLLARC 0x00100000 /* Data Link Layer Link Active Reporting Capable */ 473#define PCI_EXP_LNKCAP_DLLLARC 0x00100000 /* Data Link Layer Link Active Reporting Capable */
474#define PCI_EXP_LNKCAP_LBNC 0x00200000 /* Link Bandwidth Notification Capability */ 474#define PCI_EXP_LNKCAP_LBNC 0x00200000 /* Link Bandwidth Notification Capability */
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index fb104e51496e..0b1df41691e8 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -157,8 +157,11 @@ enum perf_branch_sample_type {
157 PERF_SAMPLE_BRANCH_ANY_CALL = 1U << 4, /* any call branch */ 157 PERF_SAMPLE_BRANCH_ANY_CALL = 1U << 4, /* any call branch */
158 PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << 5, /* any return branch */ 158 PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << 5, /* any return branch */
159 PERF_SAMPLE_BRANCH_IND_CALL = 1U << 6, /* indirect calls */ 159 PERF_SAMPLE_BRANCH_IND_CALL = 1U << 6, /* indirect calls */
160 PERF_SAMPLE_BRANCH_ABORT_TX = 1U << 7, /* transaction aborts */
161 PERF_SAMPLE_BRANCH_IN_TX = 1U << 8, /* in transaction */
162 PERF_SAMPLE_BRANCH_NO_TX = 1U << 9, /* not in transaction */
160 163
161 PERF_SAMPLE_BRANCH_MAX = 1U << 7, /* non-ABI */ 164 PERF_SAMPLE_BRANCH_MAX = 1U << 10, /* non-ABI */
162}; 165};
163 166
164#define PERF_SAMPLE_BRANCH_PLM_ALL \ 167#define PERF_SAMPLE_BRANCH_PLM_ALL \
diff --git a/include/uapi/linux/ptrace.h b/include/uapi/linux/ptrace.h
index 52ebcc89f306..cf1019e15f5b 100644
--- a/include/uapi/linux/ptrace.h
+++ b/include/uapi/linux/ptrace.h
@@ -61,6 +61,9 @@ struct ptrace_peeksiginfo_args {
61 __s32 nr; /* how may siginfos to take */ 61 __s32 nr; /* how may siginfos to take */
62}; 62};
63 63
64#define PTRACE_GETSIGMASK 0x420a
65#define PTRACE_SETSIGMASK 0x420b
66
64/* Read signals from a shared (process wide) queue */ 67/* Read signals from a shared (process wide) queue */
65#define PTRACE_PEEKSIGINFO_SHARED (1 << 0) 68#define PTRACE_PEEKSIGINFO_SHARED (1 << 0)
66 69
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index 7a2144e1afae..eb0f1a554d7b 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -386,6 +386,8 @@ enum {
386#define RTAX_RTO_MIN RTAX_RTO_MIN 386#define RTAX_RTO_MIN RTAX_RTO_MIN
387 RTAX_INITRWND, 387 RTAX_INITRWND,
388#define RTAX_INITRWND RTAX_INITRWND 388#define RTAX_INITRWND RTAX_INITRWND
389 RTAX_QUICKACK,
390#define RTAX_QUICKACK RTAX_QUICKACK
389 __RTAX_MAX 391 __RTAX_MAX
390}; 392};
391 393
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
index 74c2bf7211f8..9119cc0977bf 100644
--- a/include/uapi/linux/serial_core.h
+++ b/include/uapi/linux/serial_core.h
@@ -226,4 +226,10 @@
226/* Rocketport EXPRESS/INFINITY */ 226/* Rocketport EXPRESS/INFINITY */
227#define PORT_RP2 102 227#define PORT_RP2 102
228 228
229/* Freescale lpuart */
230#define PORT_LPUART 103
231
232/* SH-SCI */
233#define PORT_HSCIF 104
234
229#endif /* _UAPILINUX_SERIAL_CORE_H */ 235#endif /* _UAPILINUX_SERIAL_CORE_H */
diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h
index df2e8b4f9c03..af0a674cc677 100644
--- a/include/uapi/linux/snmp.h
+++ b/include/uapi/linux/snmp.h
@@ -253,6 +253,7 @@ enum
253 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */ 253 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */
254 LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */ 254 LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */
255 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */ 255 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */
256 LINUX_MIB_LOWLATENCYRXPACKETS, /* LowLatencyRxPackets */
256 __LINUX_MIB_MAX 257 __LINUX_MIB_MAX
257}; 258};
258 259
@@ -287,6 +288,7 @@ enum
287 LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */ 288 LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */
288 LINUX_MIB_XFRMFWDHDRERROR, /* XfrmFwdHdrError*/ 289 LINUX_MIB_XFRMFWDHDRERROR, /* XfrmFwdHdrError*/
289 LINUX_MIB_XFRMOUTSTATEINVALID, /* XfrmOutStateInvalid */ 290 LINUX_MIB_XFRMOUTSTATEINVALID, /* XfrmOutStateInvalid */
291 LINUX_MIB_XFRMACQUIREERROR, /* XfrmAcquireError */
290 __LINUX_MIB_XFRMMAX 292 __LINUX_MIB_XFRMMAX
291}; 293};
292 294
diff --git a/include/uapi/linux/tipc.h b/include/uapi/linux/tipc.h
index f2d90091cc20..852373d27dbb 100644
--- a/include/uapi/linux/tipc.h
+++ b/include/uapi/linux/tipc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/linux/tipc.h: Include file for TIPC socket interface 2 * include/uapi/linux/tipc.h: Header for TIPC socket interface
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, 2010-2011, Wind River Systems 5 * Copyright (c) 2005, 2010-2011, Wind River Systems
diff --git a/include/uapi/linux/tipc_config.h b/include/uapi/linux/tipc_config.h
index 0b1e3f218a36..6b0bff09b3a7 100644
--- a/include/uapi/linux/tipc_config.h
+++ b/include/uapi/linux/tipc_config.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/linux/tipc_config.h: Include file for TIPC configuration interface 2 * include/uapi/linux/tipc_config.h: Header for TIPC configuration interface
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005-2007, 2010-2011, Wind River Systems 5 * Copyright (c) 2005-2007, 2010-2011, Wind River Systems
diff --git a/include/uapi/linux/usb/ch11.h b/include/uapi/linux/usb/ch11.h
index 7692dc69ccf7..331499d597fa 100644
--- a/include/uapi/linux/usb/ch11.h
+++ b/include/uapi/linux/usb/ch11.h
@@ -11,6 +11,17 @@
11 11
12#include <linux/types.h> /* __u8 etc */ 12#include <linux/types.h> /* __u8 etc */
13 13
14/* This is arbitrary.
15 * From USB 2.0 spec Table 11-13, offset 7, a hub can
16 * have up to 255 ports. The most yet reported is 10.
17 *
18 * Current Wireless USB host hardware (Intel i1480 for example) allows
19 * up to 22 devices to connect. Upcoming hardware might raise that
20 * limit. Because the arrays need to add a bit for hub status data, we
21 * use 31, so plus one evens out to four bytes.
22 */
23#define USB_MAXCHILDREN 31
24
14/* 25/*
15 * Hub request types 26 * Hub request types
16 */ 27 */
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 69bd5bb0d5af..e90a88a8708f 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -53,13 +53,13 @@
53#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ 53#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
54#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ 54#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
55#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ 55#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
56#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ 56#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator controls */
57#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ 57#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
58#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */ 58#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
59#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */ 59#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */
60#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */ 60#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */
61#define V4L2_CTRL_CLASS_DV 0x00a00000 /* Digital Video controls */ 61#define V4L2_CTRL_CLASS_DV 0x00a00000 /* Digital Video controls */
62#define V4L2_CTRL_CLASS_FM_RX 0x00a10000 /* Digital Video controls */ 62#define V4L2_CTRL_CLASS_FM_RX 0x00a10000 /* FM Receiver controls */
63 63
64/* User-class control IDs */ 64/* User-class control IDs */
65 65
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index 284ff2436829..916e444e6f74 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -22,6 +22,7 @@
22/* Extensions */ 22/* Extensions */
23 23
24#define VFIO_TYPE1_IOMMU 1 24#define VFIO_TYPE1_IOMMU 1
25#define VFIO_SPAPR_TCE_IOMMU 2
25 26
26/* 27/*
27 * The IOCTL interface is designed for extensibility by embedding the 28 * The IOCTL interface is designed for extensibility by embedding the
@@ -361,10 +362,14 @@ struct vfio_iommu_type1_dma_map {
361#define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13) 362#define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13)
362 363
363/** 364/**
364 * VFIO_IOMMU_UNMAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 14, struct vfio_dma_unmap) 365 * VFIO_IOMMU_UNMAP_DMA - _IOWR(VFIO_TYPE, VFIO_BASE + 14,
366 * struct vfio_dma_unmap)
365 * 367 *
366 * Unmap IO virtual addresses using the provided struct vfio_dma_unmap. 368 * Unmap IO virtual addresses using the provided struct vfio_dma_unmap.
367 * Caller sets argsz. 369 * Caller sets argsz. The actual unmapped size is returned in the size
370 * field. No guarantee is made to the user that arbitrary unmaps of iova
371 * or size different from those used in the original mapping call will
372 * succeed.
368 */ 373 */
369struct vfio_iommu_type1_dma_unmap { 374struct vfio_iommu_type1_dma_unmap {
370 __u32 argsz; 375 __u32 argsz;
@@ -375,4 +380,37 @@ struct vfio_iommu_type1_dma_unmap {
375 380
376#define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14) 381#define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14)
377 382
383/*
384 * IOCTLs to enable/disable IOMMU container usage.
385 * No parameters are supported.
386 */
387#define VFIO_IOMMU_ENABLE _IO(VFIO_TYPE, VFIO_BASE + 15)
388#define VFIO_IOMMU_DISABLE _IO(VFIO_TYPE, VFIO_BASE + 16)
389
390/* -------- Additional API for SPAPR TCE (Server POWERPC) IOMMU -------- */
391
392/*
393 * The SPAPR TCE info struct provides the information about the PCI bus
394 * address ranges available for DMA, these values are programmed into
395 * the hardware so the guest has to know that information.
396 *
397 * The DMA 32 bit window start is an absolute PCI bus address.
398 * The IOVA address passed via map/unmap ioctls are absolute PCI bus
399 * addresses too so the window works as a filter rather than an offset
400 * for IOVA addresses.
401 *
402 * A flag will need to be added if other page sizes are supported,
403 * so as defined here, it is always 4k.
404 */
405struct vfio_iommu_spapr_tce_info {
406 __u32 argsz;
407 __u32 flags; /* reserved for future use */
408 __u32 dma32_window_start; /* 32 bit window start (bytes) */
409 __u32 dma32_window_size; /* 32 bit window size (bytes) */
410};
411
412#define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
413
414/* ***************************************************************** */
415
378#endif /* _UAPIVFIO_H */ 416#endif /* _UAPIVFIO_H */
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index f40b41c7e108..95ef4551edc1 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -395,7 +395,7 @@ struct v4l2_pix_format {
395#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */ 395#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */
396#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */ 396#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */
397#define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */ 397#define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */
398#define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 ES */ 398#define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 part 2 ES */
399#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */ 399#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */
400#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */ 400#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */
401#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */ 401#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */
@@ -555,7 +555,7 @@ struct v4l2_jpegcompression {
555 __u32 jpeg_markers; /* Which markers should go into the JPEG 555 __u32 jpeg_markers; /* Which markers should go into the JPEG
556 * output. Unless you exactly know what 556 * output. Unless you exactly know what
557 * you do, leave them untouched. 557 * you do, leave them untouched.
558 * Inluding less markers will make the 558 * Including less markers will make the
559 * resulting code smaller, but there will 559 * resulting code smaller, but there will
560 * be fewer applications which can read it. 560 * be fewer applications which can read it.
561 * The presence of the APP and COM marker 561 * The presence of the APP and COM marker
@@ -567,7 +567,7 @@ struct v4l2_jpegcompression {
567#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ 567#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */
568#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ 568#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */
569#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will 569#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will
570 * allways use APP0 */ 570 * always use APP0 */
571}; 571};
572 572
573/* 573/*
@@ -900,7 +900,7 @@ typedef __u64 v4l2_std_id;
900/* 900/*
901 * "Common" PAL - This macro is there to be compatible with the old 901 * "Common" PAL - This macro is there to be compatible with the old
902 * V4L1 concept of "PAL": /BGDKHI. 902 * V4L1 concept of "PAL": /BGDKHI.
903 * Several PAL standards are mising here: /M, /N and /Nc 903 * Several PAL standards are missing here: /M, /N and /Nc
904 */ 904 */
905#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\ 905#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\
906 V4L2_STD_PAL_DK |\ 906 V4L2_STD_PAL_DK |\
@@ -1787,11 +1787,13 @@ struct v4l2_event_subscription {
1787/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ 1787/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */
1788 1788
1789#define V4L2_CHIP_MATCH_BRIDGE 0 /* Match against chip ID on the bridge (0 for the bridge) */ 1789#define V4L2_CHIP_MATCH_BRIDGE 0 /* Match against chip ID on the bridge (0 for the bridge) */
1790#define V4L2_CHIP_MATCH_SUBDEV 4 /* Match against subdev index */
1791
1792/* The following four defines are no longer in use */
1790#define V4L2_CHIP_MATCH_HOST V4L2_CHIP_MATCH_BRIDGE 1793#define V4L2_CHIP_MATCH_HOST V4L2_CHIP_MATCH_BRIDGE
1791#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */ 1794#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */
1792#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ 1795#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */
1793#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */ 1796#define V4L2_CHIP_MATCH_AC97 3 /* Match against ancillary AC97 chip */
1794#define V4L2_CHIP_MATCH_SUBDEV 4 /* Match against subdev index */
1795 1797
1796struct v4l2_dbg_match { 1798struct v4l2_dbg_match {
1797 __u32 type; /* Match type */ 1799 __u32 type; /* Match type */
@@ -1808,13 +1810,6 @@ struct v4l2_dbg_register {
1808 __u64 val; 1810 __u64 val;
1809} __attribute__ ((packed)); 1811} __attribute__ ((packed));
1810 1812
1811/* VIDIOC_DBG_G_CHIP_IDENT */
1812struct v4l2_dbg_chip_ident {
1813 struct v4l2_dbg_match match;
1814 __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */
1815 __u32 revision; /* chip revision, chip specific */
1816} __attribute__ ((packed));
1817
1818#define V4L2_CHIP_FL_READABLE (1 << 0) 1813#define V4L2_CHIP_FL_READABLE (1 << 0)
1819#define V4L2_CHIP_FL_WRITABLE (1 << 1) 1814#define V4L2_CHIP_FL_WRITABLE (1 << 1)
1820 1815
@@ -1915,12 +1910,6 @@ struct v4l2_create_buffers {
1915#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register) 1910#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register)
1916#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register) 1911#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register)
1917 1912
1918/* Experimental, meant for debugging, testing and internal use.
1919 Never use this ioctl in applications!
1920 Note: this ioctl is deprecated in favor of VIDIOC_DBG_G_CHIP_INFO and
1921 will go away in the future. */
1922#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident)
1923
1924#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) 1913#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
1925 1914
1926#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) 1915#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
index b7cda390fd00..3ce768c6910d 100644
--- a/include/uapi/linux/virtio_config.h
+++ b/include/uapi/linux/virtio_config.h
@@ -51,4 +51,7 @@
51 * suppressed them? */ 51 * suppressed them? */
52#define VIRTIO_F_NOTIFY_ON_EMPTY 24 52#define VIRTIO_F_NOTIFY_ON_EMPTY 24
53 53
54/* Can the device handle any descriptor layout? */
55#define VIRTIO_F_ANY_LAYOUT 27
56
54#endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */ 57#endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */
diff --git a/include/uapi/linux/virtio_console.h b/include/uapi/linux/virtio_console.h
index c312f16bc4e7..ba260dd0b33a 100644
--- a/include/uapi/linux/virtio_console.h
+++ b/include/uapi/linux/virtio_console.h
@@ -38,6 +38,7 @@
38/* Feature bits */ 38/* Feature bits */
39#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ 39#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
40#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */ 40#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */
41#define VIRTIO_CONSOLE_F_EMERG_WRITE 2 /* Does host support emergency write? */
41 42
42#define VIRTIO_CONSOLE_BAD_ID (~(__u32)0) 43#define VIRTIO_CONSOLE_BAD_ID (~(__u32)0)
43 44
@@ -48,6 +49,8 @@ struct virtio_console_config {
48 __u16 rows; 49 __u16 rows;
49 /* max. number of ports this device can hold */ 50 /* max. number of ports this device can hold */
50 __u32 max_nr_ports; 51 __u32 max_nr_ports;
52 /* emergency write register */
53 __u32 emerg_wr;
51} __attribute__((packed)); 54} __attribute__((packed));
52 55
53/* 56/*
diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h
index ea66f3f60d63..e5ec1caab82a 100644
--- a/include/uapi/linux/virtio_pci.h
+++ b/include/uapi/linux/virtio_pci.h
@@ -80,7 +80,9 @@
80 80
81/* The remaining space is defined by each driver as the per-driver 81/* The remaining space is defined by each driver as the per-driver
82 * configuration space */ 82 * configuration space */
83#define VIRTIO_PCI_CONFIG(dev) ((dev)->msix_enabled ? 24 : 20) 83#define VIRTIO_PCI_CONFIG_OFF(msix_enabled) ((msix_enabled) ? 24 : 20)
84/* Deprecated: please use VIRTIO_PCI_CONFIG_OFF instead */
85#define VIRTIO_PCI_CONFIG(dev) VIRTIO_PCI_CONFIG_OFF((dev)->msix_enabled)
84 86
85/* Virtio ABI version, this must match exactly */ 87/* Virtio ABI version, this must match exactly */
86#define VIRTIO_PCI_ABI_VERSION 0 88#define VIRTIO_PCI_ABI_VERSION 0
diff --git a/include/uapi/mtd/ubi-user.h b/include/uapi/mtd/ubi-user.h
index 53cae1e11e57..723c324590c1 100644
--- a/include/uapi/mtd/ubi-user.h
+++ b/include/uapi/mtd/ubi-user.h
@@ -173,7 +173,10 @@
173 173
174#define UBI_VOL_IOC_MAGIC 'O' 174#define UBI_VOL_IOC_MAGIC 'O'
175 175
176/* Start UBI volume update */ 176/* Start UBI volume update
177 * Note: This actually takes a pointer (__s64*), but we can't change
178 * that without breaking the ABI on 32bit systems
179 */
177#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, __s64) 180#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, __s64)
178/* LEB erasure command, used for debugging, disabled by default */ 181/* LEB erasure command, used for debugging, disabled by default */
179#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, __s32) 182#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, __s32)
diff --git a/include/uapi/rdma/rdma_user_cm.h b/include/uapi/rdma/rdma_user_cm.h
index 1ee9239ff8c2..99b80abf360a 100644
--- a/include/uapi/rdma/rdma_user_cm.h
+++ b/include/uapi/rdma/rdma_user_cm.h
@@ -45,8 +45,8 @@
45enum { 45enum {
46 RDMA_USER_CM_CMD_CREATE_ID, 46 RDMA_USER_CM_CMD_CREATE_ID,
47 RDMA_USER_CM_CMD_DESTROY_ID, 47 RDMA_USER_CM_CMD_DESTROY_ID,
48 RDMA_USER_CM_CMD_BIND_ADDR, 48 RDMA_USER_CM_CMD_BIND_IP,
49 RDMA_USER_CM_CMD_RESOLVE_ADDR, 49 RDMA_USER_CM_CMD_RESOLVE_IP,
50 RDMA_USER_CM_CMD_RESOLVE_ROUTE, 50 RDMA_USER_CM_CMD_RESOLVE_ROUTE,
51 RDMA_USER_CM_CMD_QUERY_ROUTE, 51 RDMA_USER_CM_CMD_QUERY_ROUTE,
52 RDMA_USER_CM_CMD_CONNECT, 52 RDMA_USER_CM_CMD_CONNECT,
@@ -59,9 +59,13 @@ enum {
59 RDMA_USER_CM_CMD_GET_OPTION, 59 RDMA_USER_CM_CMD_GET_OPTION,
60 RDMA_USER_CM_CMD_SET_OPTION, 60 RDMA_USER_CM_CMD_SET_OPTION,
61 RDMA_USER_CM_CMD_NOTIFY, 61 RDMA_USER_CM_CMD_NOTIFY,
62 RDMA_USER_CM_CMD_JOIN_MCAST, 62 RDMA_USER_CM_CMD_JOIN_IP_MCAST,
63 RDMA_USER_CM_CMD_LEAVE_MCAST, 63 RDMA_USER_CM_CMD_LEAVE_MCAST,
64 RDMA_USER_CM_CMD_MIGRATE_ID 64 RDMA_USER_CM_CMD_MIGRATE_ID,
65 RDMA_USER_CM_CMD_QUERY,
66 RDMA_USER_CM_CMD_BIND,
67 RDMA_USER_CM_CMD_RESOLVE_ADDR,
68 RDMA_USER_CM_CMD_JOIN_MCAST
65}; 69};
66 70
67/* 71/*
@@ -95,28 +99,51 @@ struct rdma_ucm_destroy_id_resp {
95 __u32 events_reported; 99 __u32 events_reported;
96}; 100};
97 101
98struct rdma_ucm_bind_addr { 102struct rdma_ucm_bind_ip {
99 __u64 response; 103 __u64 response;
100 struct sockaddr_in6 addr; 104 struct sockaddr_in6 addr;
101 __u32 id; 105 __u32 id;
102}; 106};
103 107
104struct rdma_ucm_resolve_addr { 108struct rdma_ucm_bind {
109 __u32 id;
110 __u16 addr_size;
111 __u16 reserved;
112 struct sockaddr_storage addr;
113};
114
115struct rdma_ucm_resolve_ip {
105 struct sockaddr_in6 src_addr; 116 struct sockaddr_in6 src_addr;
106 struct sockaddr_in6 dst_addr; 117 struct sockaddr_in6 dst_addr;
107 __u32 id; 118 __u32 id;
108 __u32 timeout_ms; 119 __u32 timeout_ms;
109}; 120};
110 121
122struct rdma_ucm_resolve_addr {
123 __u32 id;
124 __u32 timeout_ms;
125 __u16 src_size;
126 __u16 dst_size;
127 __u32 reserved;
128 struct sockaddr_storage src_addr;
129 struct sockaddr_storage dst_addr;
130};
131
111struct rdma_ucm_resolve_route { 132struct rdma_ucm_resolve_route {
112 __u32 id; 133 __u32 id;
113 __u32 timeout_ms; 134 __u32 timeout_ms;
114}; 135};
115 136
116struct rdma_ucm_query_route { 137enum {
138 RDMA_USER_CM_QUERY_ADDR,
139 RDMA_USER_CM_QUERY_PATH,
140 RDMA_USER_CM_QUERY_GID
141};
142
143struct rdma_ucm_query {
117 __u64 response; 144 __u64 response;
118 __u32 id; 145 __u32 id;
119 __u32 reserved; 146 __u32 option;
120}; 147};
121 148
122struct rdma_ucm_query_route_resp { 149struct rdma_ucm_query_route_resp {
@@ -129,9 +156,26 @@ struct rdma_ucm_query_route_resp {
129 __u8 reserved[3]; 156 __u8 reserved[3];
130}; 157};
131 158
159struct rdma_ucm_query_addr_resp {
160 __u64 node_guid;
161 __u8 port_num;
162 __u8 reserved;
163 __u16 pkey;
164 __u16 src_size;
165 __u16 dst_size;
166 struct sockaddr_storage src_addr;
167 struct sockaddr_storage dst_addr;
168};
169
170struct rdma_ucm_query_path_resp {
171 __u32 num_paths;
172 __u32 reserved;
173 struct ib_path_rec_data path_data[0];
174};
175
132struct rdma_ucm_conn_param { 176struct rdma_ucm_conn_param {
133 __u32 qp_num; 177 __u32 qp_num;
134 __u32 reserved; 178 __u32 qkey;
135 __u8 private_data[RDMA_MAX_PRIVATE_DATA]; 179 __u8 private_data[RDMA_MAX_PRIVATE_DATA];
136 __u8 private_data_len; 180 __u8 private_data_len;
137 __u8 srq; 181 __u8 srq;
@@ -192,13 +236,22 @@ struct rdma_ucm_notify {
192 __u32 event; 236 __u32 event;
193}; 237};
194 238
195struct rdma_ucm_join_mcast { 239struct rdma_ucm_join_ip_mcast {
196 __u64 response; /* rdma_ucm_create_id_resp */ 240 __u64 response; /* rdma_ucm_create_id_resp */
197 __u64 uid; 241 __u64 uid;
198 struct sockaddr_in6 addr; 242 struct sockaddr_in6 addr;
199 __u32 id; 243 __u32 id;
200}; 244};
201 245
246struct rdma_ucm_join_mcast {
247 __u64 response; /* rdma_ucma_create_id_resp */
248 __u64 uid;
249 __u32 id;
250 __u16 addr_size;
251 __u16 reserved;
252 struct sockaddr_storage addr;
253};
254
202struct rdma_ucm_get_event { 255struct rdma_ucm_get_event {
203 __u64 response; 256 __u64 response;
204}; 257};
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index e3983d508272..041203f20f6d 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -817,6 +817,8 @@ typedef int __bitwise snd_ctl_elem_iface_t;
817#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ 817#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */
818#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ 818#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */
819 819
820#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN 44
821
820struct snd_ctl_elem_id { 822struct snd_ctl_elem_id {
821 unsigned int numid; /* numeric identifier, zero = invalid */ 823 unsigned int numid; /* numeric identifier, zero = invalid */
822 snd_ctl_elem_iface_t iface; /* interface identifier */ 824 snd_ctl_elem_iface_t iface; /* interface identifier */
diff --git a/include/video/display_timing.h b/include/video/display_timing.h
index 5d0259b08e01..28d9d0d566ca 100644
--- a/include/video/display_timing.h
+++ b/include/video/display_timing.h
@@ -27,6 +27,7 @@ enum display_flags {
27 DISPLAY_FLAGS_PIXDATA_NEGEDGE = BIT(7), 27 DISPLAY_FLAGS_PIXDATA_NEGEDGE = BIT(7),
28 DISPLAY_FLAGS_INTERLACED = BIT(8), 28 DISPLAY_FLAGS_INTERLACED = BIT(8),
29 DISPLAY_FLAGS_DOUBLESCAN = BIT(9), 29 DISPLAY_FLAGS_DOUBLESCAN = BIT(9),
30 DISPLAY_FLAGS_DOUBLECLK = BIT(10),
30}; 31};
31 32
32/* 33/*
diff --git a/include/video/of_display_timing.h b/include/video/of_display_timing.h
index 8016eb727cf3..79e6697af6cf 100644
--- a/include/video/of_display_timing.h
+++ b/include/video/of_display_timing.h
@@ -10,10 +10,13 @@
10#define __LINUX_OF_DISPLAY_TIMING_H 10#define __LINUX_OF_DISPLAY_TIMING_H
11 11
12struct device_node; 12struct device_node;
13struct display_timing;
13struct display_timings; 14struct display_timings;
14 15
15#define OF_USE_NATIVE_MODE -1 16#define OF_USE_NATIVE_MODE -1
16 17
18int of_get_display_timing(struct device_node *np, const char *name,
19 struct display_timing *dt);
17struct display_timings *of_get_display_timings(struct device_node *np); 20struct display_timings *of_get_display_timings(struct device_node *np);
18int of_display_timings_exist(struct device_node *np); 21int of_display_timings_exist(struct device_node *np);
19 22
diff --git a/include/video/omap-panel-data.h b/include/video/omap-panel-data.h
index 0c3b46d3daf3..6b2366fb6e53 100644
--- a/include/video/omap-panel-data.h
+++ b/include/video/omap-panel-data.h
@@ -27,6 +27,9 @@
27#ifndef __OMAP_PANEL_DATA_H 27#ifndef __OMAP_PANEL_DATA_H
28#define __OMAP_PANEL_DATA_H 28#define __OMAP_PANEL_DATA_H
29 29
30#include <video/omapdss.h>
31#include <video/display_timing.h>
32
30struct omap_dss_device; 33struct omap_dss_device;
31 34
32/** 35/**
@@ -147,4 +150,210 @@ struct panel_tpo_td043_data {
147 int nreset_gpio; 150 int nreset_gpio;
148}; 151};
149 152
153/**
154 * encoder_tfp410 platform data
155 * @name: name for this display entity
156 * @power_down_gpio: gpio number for PD pin (or -1 if not available)
157 * @data_lines: number of DPI datalines
158 */
159struct encoder_tfp410_platform_data {
160 const char *name;
161 const char *source;
162 int power_down_gpio;
163 int data_lines;
164};
165
166/**
167 * encoder_tpd12s015 platform data
168 * @name: name for this display entity
169 * @ct_cp_hpd_gpio: CT_CP_HPD gpio number
170 * @ls_oe_gpio: LS_OE gpio number
171 * @hpd_gpio: HPD gpio number
172 */
173struct encoder_tpd12s015_platform_data {
174 const char *name;
175 const char *source;
176
177 int ct_cp_hpd_gpio;
178 int ls_oe_gpio;
179 int hpd_gpio;
180};
181
182/**
183 * connector_dvi platform data
184 * @name: name for this display entity
185 * @source: name of the display entity used as a video source
186 * @i2c_bus_num: i2c bus number to be used for reading EDID
187 */
188struct connector_dvi_platform_data {
189 const char *name;
190 const char *source;
191 int i2c_bus_num;
192};
193
194/**
195 * connector_hdmi platform data
196 * @name: name for this display entity
197 * @source: name of the display entity used as a video source
198 */
199struct connector_hdmi_platform_data {
200 const char *name;
201 const char *source;
202};
203
204/**
205 * connector_atv platform data
206 * @name: name for this display entity
207 * @source: name of the display entity used as a video source
208 * @connector_type: composite/svideo
209 * @invert_polarity: invert signal polarity
210 */
211struct connector_atv_platform_data {
212 const char *name;
213 const char *source;
214
215 enum omap_dss_venc_type connector_type;
216 bool invert_polarity;
217};
218
219/**
220 * panel_dpi platform data
221 * @name: name for this display entity
222 * @source: name of the display entity used as a video source
223 * @data_lines: number of DPI datalines
224 * @display_timing: timings for this panel
225 * @backlight_gpio: gpio to enable/disable the backlight (or -1)
226 * @enable_gpio: gpio to enable/disable the panel (or -1)
227 */
228struct panel_dpi_platform_data {
229 const char *name;
230 const char *source;
231
232 int data_lines;
233
234 const struct display_timing *display_timing;
235
236 int backlight_gpio;
237 int enable_gpio;
238};
239
240/**
241 * panel_dsicm platform data
242 * @name: name for this display entity
243 * @source: name of the display entity used as a video source
244 * @reset_gpio: gpio to reset the panel (or -1)
245 * @use_ext_te: use external TE GPIO
246 * @ext_te_gpio: external TE GPIO
247 * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms)
248 * @use_dsi_backlight: true if panel uses DSI command to control backlight
249 * @pin_config: DSI pin configuration
250 */
251struct panel_dsicm_platform_data {
252 const char *name;
253 const char *source;
254
255 int reset_gpio;
256
257 bool use_ext_te;
258 int ext_te_gpio;
259
260 unsigned ulps_timeout;
261
262 bool use_dsi_backlight;
263
264 struct omap_dsi_pin_config pin_config;
265};
266
267/**
268 * panel_acx565akm platform data
269 * @name: name for this display entity
270 * @source: name of the display entity used as a video source
271 * @reset_gpio: gpio to reset the panel (or -1)
272 * @datapairs: number of SDI datapairs
273 */
274struct panel_acx565akm_platform_data {
275 const char *name;
276 const char *source;
277
278 int reset_gpio;
279
280 int datapairs;
281};
282
283/**
284 * panel_lb035q02 platform data
285 * @name: name for this display entity
286 * @source: name of the display entity used as a video source
287 * @data_lines: number of DPI datalines
288 * @backlight_gpio: gpio to enable/disable the backlight (or -1)
289 * @enable_gpio: gpio to enable/disable the panel (or -1)
290 */
291struct panel_lb035q02_platform_data {
292 const char *name;
293 const char *source;
294
295 int data_lines;
296
297 int backlight_gpio;
298 int enable_gpio;
299};
300
301/**
302 * panel_sharp_ls037v7dw01 platform data
303 * @name: name for this display entity
304 * @source: name of the display entity used as a video source
305 * @data_lines: number of DPI datalines
306 * @resb_gpio: reset signal GPIO
307 * @ini_gpio: power on control GPIO
308 * @mo_gpio: selection for resolution(VGA/QVGA) GPIO
309 * @lr_gpio: selection for horizontal scanning direction GPIO
310 * @ud_gpio: selection for vertical scanning direction GPIO
311 */
312struct panel_sharp_ls037v7dw01_platform_data {
313 const char *name;
314 const char *source;
315
316 int data_lines;
317
318 int resb_gpio;
319 int ini_gpio;
320 int mo_gpio;
321 int lr_gpio;
322 int ud_gpio;
323};
324
325/**
326 * panel-tpo-td043mtea1 platform data
327 * @name: name for this display entity
328 * @source: name of the display entity used as a video source
329 * @data_lines: number of DPI datalines
330 * @nreset_gpio: reset signal
331 */
332struct panel_tpo_td043mtea1_platform_data {
333 const char *name;
334 const char *source;
335
336 int data_lines;
337
338 int nreset_gpio;
339};
340
341/**
342 * panel-nec-nl8048hl11 platform data
343 * @name: name for this display entity
344 * @source: name of the display entity used as a video source
345 * @data_lines: number of DPI datalines
346 * @res_gpio: reset signal
347 * @qvga_gpio: selection for resolution(QVGA/WVGA)
348 */
349struct panel_nec_nl8048hl11_platform_data {
350 const char *name;
351 const char *source;
352
353 int data_lines;
354
355 int res_gpio;
356 int qvga_gpio;
357};
358
150#endif /* __OMAP_PANEL_DATA_H */ 359#endif /* __OMAP_PANEL_DATA_H */
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index aeb4e9a0c5d1..b39463553845 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -23,6 +23,8 @@
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25 25
26#include <video/videomode.h>
27
26#define DISPC_IRQ_FRAMEDONE (1 << 0) 28#define DISPC_IRQ_FRAMEDONE (1 << 0)
27#define DISPC_IRQ_VSYNC (1 << 1) 29#define DISPC_IRQ_VSYNC (1 << 1)
28#define DISPC_IRQ_EVSYNC_EVEN (1 << 2) 30#define DISPC_IRQ_EVSYNC_EVEN (1 << 2)
@@ -68,6 +70,7 @@ enum omap_display_type {
68 OMAP_DISPLAY_TYPE_DSI = 1 << 3, 70 OMAP_DISPLAY_TYPE_DSI = 1 << 3,
69 OMAP_DISPLAY_TYPE_VENC = 1 << 4, 71 OMAP_DISPLAY_TYPE_VENC = 1 << 4,
70 OMAP_DISPLAY_TYPE_HDMI = 1 << 5, 72 OMAP_DISPLAY_TYPE_HDMI = 1 << 5,
73 OMAP_DISPLAY_TYPE_DVI = 1 << 6,
71}; 74};
72 75
73enum omap_plane { 76enum omap_plane {
@@ -169,6 +172,11 @@ enum omap_dss_audio_state {
169 OMAP_DSS_AUDIO_PLAYING, 172 OMAP_DSS_AUDIO_PLAYING,
170}; 173};
171 174
175struct omap_dss_audio {
176 struct snd_aes_iec958 *iec;
177 struct snd_cea_861_aud_if *cea;
178};
179
172enum omap_dss_rotation_type { 180enum omap_dss_rotation_type {
173 OMAP_DSS_ROT_DMA = 1 << 0, 181 OMAP_DSS_ROT_DMA = 1 << 0,
174 OMAP_DSS_ROT_VRFB = 1 << 1, 182 OMAP_DSS_ROT_VRFB = 1 << 1,
@@ -365,6 +373,7 @@ struct omap_dss_board_info {
365 int num_devices; 373 int num_devices;
366 struct omap_dss_device **devices; 374 struct omap_dss_device **devices;
367 struct omap_dss_device *default_device; 375 struct omap_dss_device *default_device;
376 const char *default_display_name;
368 int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask); 377 int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask);
369 void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask); 378 void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask);
370 int (*set_min_bus_tput)(struct device *dev, unsigned long r); 379 int (*set_min_bus_tput)(struct device *dev, unsigned long r);
@@ -512,7 +521,7 @@ struct omap_overlay_manager {
512 enum omap_dss_output_id supported_outputs; 521 enum omap_dss_output_id supported_outputs;
513 522
514 /* dynamic fields */ 523 /* dynamic fields */
515 struct omap_dss_output *output; 524 struct omap_dss_device *output;
516 525
517 /* 526 /*
518 * The following functions do not block: 527 * The following functions do not block:
@@ -526,7 +535,7 @@ struct omap_overlay_manager {
526 */ 535 */
527 536
528 int (*set_output)(struct omap_overlay_manager *mgr, 537 int (*set_output)(struct omap_overlay_manager *mgr,
529 struct omap_dss_output *output); 538 struct omap_dss_device *output);
530 int (*unset_output)(struct omap_overlay_manager *mgr); 539 int (*unset_output)(struct omap_overlay_manager *mgr);
531 540
532 int (*set_manager_info)(struct omap_overlay_manager *mgr, 541 int (*set_manager_info)(struct omap_overlay_manager *mgr,
@@ -569,33 +578,192 @@ struct omap_dss_writeback_info {
569 u8 pre_mult_alpha; 578 u8 pre_mult_alpha;
570}; 579};
571 580
572struct omap_dss_output { 581struct omapdss_dpi_ops {
573 struct list_head list; 582 int (*connect)(struct omap_dss_device *dssdev,
583 struct omap_dss_device *dst);
584 void (*disconnect)(struct omap_dss_device *dssdev,
585 struct omap_dss_device *dst);
574 586
575 const char *name; 587 int (*enable)(struct omap_dss_device *dssdev);
588 void (*disable)(struct omap_dss_device *dssdev);
576 589
577 /* display type supported by the output */ 590 int (*check_timings)(struct omap_dss_device *dssdev,
578 enum omap_display_type type; 591 struct omap_video_timings *timings);
592 void (*set_timings)(struct omap_dss_device *dssdev,
593 struct omap_video_timings *timings);
594 void (*get_timings)(struct omap_dss_device *dssdev,
595 struct omap_video_timings *timings);
579 596
580 /* DISPC channel for this output */ 597 void (*set_data_lines)(struct omap_dss_device *dssdev, int data_lines);
581 enum omap_channel dispc_channel; 598};
582 599
583 /* output instance */ 600struct omapdss_sdi_ops {
584 enum omap_dss_output_id id; 601 int (*connect)(struct omap_dss_device *dssdev,
602 struct omap_dss_device *dst);
603 void (*disconnect)(struct omap_dss_device *dssdev,
604 struct omap_dss_device *dst);
585 605
586 /* output's platform device pointer */ 606 int (*enable)(struct omap_dss_device *dssdev);
587 struct platform_device *pdev; 607 void (*disable)(struct omap_dss_device *dssdev);
588 608
589 /* dynamic fields */ 609 int (*check_timings)(struct omap_dss_device *dssdev,
590 struct omap_overlay_manager *manager; 610 struct omap_video_timings *timings);
611 void (*set_timings)(struct omap_dss_device *dssdev,
612 struct omap_video_timings *timings);
613 void (*get_timings)(struct omap_dss_device *dssdev,
614 struct omap_video_timings *timings);
591 615
592 struct omap_dss_device *device; 616 void (*set_datapairs)(struct omap_dss_device *dssdev, int datapairs);
617};
618
619struct omapdss_dvi_ops {
620 int (*connect)(struct omap_dss_device *dssdev,
621 struct omap_dss_device *dst);
622 void (*disconnect)(struct omap_dss_device *dssdev,
623 struct omap_dss_device *dst);
624
625 int (*enable)(struct omap_dss_device *dssdev);
626 void (*disable)(struct omap_dss_device *dssdev);
627
628 int (*check_timings)(struct omap_dss_device *dssdev,
629 struct omap_video_timings *timings);
630 void (*set_timings)(struct omap_dss_device *dssdev,
631 struct omap_video_timings *timings);
632 void (*get_timings)(struct omap_dss_device *dssdev,
633 struct omap_video_timings *timings);
634};
635
636struct omapdss_atv_ops {
637 int (*connect)(struct omap_dss_device *dssdev,
638 struct omap_dss_device *dst);
639 void (*disconnect)(struct omap_dss_device *dssdev,
640 struct omap_dss_device *dst);
641
642 int (*enable)(struct omap_dss_device *dssdev);
643 void (*disable)(struct omap_dss_device *dssdev);
644
645 int (*check_timings)(struct omap_dss_device *dssdev,
646 struct omap_video_timings *timings);
647 void (*set_timings)(struct omap_dss_device *dssdev,
648 struct omap_video_timings *timings);
649 void (*get_timings)(struct omap_dss_device *dssdev,
650 struct omap_video_timings *timings);
651
652 void (*set_type)(struct omap_dss_device *dssdev,
653 enum omap_dss_venc_type type);
654 void (*invert_vid_out_polarity)(struct omap_dss_device *dssdev,
655 bool invert_polarity);
656
657 int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
658 u32 (*get_wss)(struct omap_dss_device *dssdev);
659};
660
661struct omapdss_hdmi_ops {
662 int (*connect)(struct omap_dss_device *dssdev,
663 struct omap_dss_device *dst);
664 void (*disconnect)(struct omap_dss_device *dssdev,
665 struct omap_dss_device *dst);
666
667 int (*enable)(struct omap_dss_device *dssdev);
668 void (*disable)(struct omap_dss_device *dssdev);
669
670 int (*check_timings)(struct omap_dss_device *dssdev,
671 struct omap_video_timings *timings);
672 void (*set_timings)(struct omap_dss_device *dssdev,
673 struct omap_video_timings *timings);
674 void (*get_timings)(struct omap_dss_device *dssdev,
675 struct omap_video_timings *timings);
676
677 int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
678 bool (*detect)(struct omap_dss_device *dssdev);
679
680 /*
681 * Note: These functions might sleep. Do not call while
682 * holding a spinlock/readlock.
683 */
684 int (*audio_enable)(struct omap_dss_device *dssdev);
685 void (*audio_disable)(struct omap_dss_device *dssdev);
686 bool (*audio_supported)(struct omap_dss_device *dssdev);
687 int (*audio_config)(struct omap_dss_device *dssdev,
688 struct omap_dss_audio *audio);
689 /* Note: These functions may not sleep */
690 int (*audio_start)(struct omap_dss_device *dssdev);
691 void (*audio_stop)(struct omap_dss_device *dssdev);
692};
693
694struct omapdss_dsi_ops {
695 int (*connect)(struct omap_dss_device *dssdev,
696 struct omap_dss_device *dst);
697 void (*disconnect)(struct omap_dss_device *dssdev,
698 struct omap_dss_device *dst);
699
700 int (*enable)(struct omap_dss_device *dssdev);
701 void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
702 bool enter_ulps);
703
704 /* bus configuration */
705 int (*set_config)(struct omap_dss_device *dssdev,
706 const struct omap_dss_dsi_config *cfg);
707 int (*configure_pins)(struct omap_dss_device *dssdev,
708 const struct omap_dsi_pin_config *pin_cfg);
709
710 void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
711 bool enable);
712 int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
713
714 int (*update)(struct omap_dss_device *dssdev, int channel,
715 void (*callback)(int, void *), void *data);
716
717 void (*bus_lock)(struct omap_dss_device *dssdev);
718 void (*bus_unlock)(struct omap_dss_device *dssdev);
719
720 int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
721 void (*disable_video_output)(struct omap_dss_device *dssdev,
722 int channel);
723
724 int (*request_vc)(struct omap_dss_device *dssdev, int *channel);
725 int (*set_vc_id)(struct omap_dss_device *dssdev, int channel,
726 int vc_id);
727 void (*release_vc)(struct omap_dss_device *dssdev, int channel);
728
729 /* data transfer */
730 int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
731 u8 *data, int len);
732 int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
733 u8 *data, int len);
734 int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
735 u8 *data, int len);
736
737 int (*gen_write)(struct omap_dss_device *dssdev, int channel,
738 u8 *data, int len);
739 int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
740 u8 *data, int len);
741 int (*gen_read)(struct omap_dss_device *dssdev, int channel,
742 u8 *reqdata, int reqlen,
743 u8 *data, int len);
744
745 int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
746
747 int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
748 int channel, u16 plen);
593}; 749};
594 750
595struct omap_dss_device { 751struct omap_dss_device {
596 struct device dev; 752 /* old device, to be removed */
753 struct device old_dev;
754
755 /* new device, pointer to panel device */
756 struct device *dev;
757
758 struct module *owner;
759
760 struct list_head panel_list;
761
762 /* alias in the form of "display%d" */
763 char alias[16];
597 764
598 enum omap_display_type type; 765 enum omap_display_type type;
766 enum omap_display_type output_type;
599 767
600 /* obsolete, to be removed */ 768 /* obsolete, to be removed */
601 enum omap_channel channel; 769 enum omap_channel channel;
@@ -616,9 +784,6 @@ struct omap_dss_device {
616 784
617 struct { 785 struct {
618 int module; 786 int module;
619
620 bool ext_te;
621 u8 ext_te_gpio;
622 } dsi; 787 } dsi;
623 788
624 struct { 789 struct {
@@ -639,10 +804,6 @@ struct omap_dss_device {
639 struct rfbi_timings rfbi_timings; 804 struct rfbi_timings rfbi_timings;
640 } ctrl; 805 } ctrl;
641 806
642 int reset_gpio;
643
644 int max_backlight_level;
645
646 const char *name; 807 const char *name;
647 808
648 /* used to match device to driver */ 809 /* used to match device to driver */
@@ -652,22 +813,40 @@ struct omap_dss_device {
652 813
653 struct omap_dss_driver *driver; 814 struct omap_dss_driver *driver;
654 815
816 union {
817 const struct omapdss_dpi_ops *dpi;
818 const struct omapdss_sdi_ops *sdi;
819 const struct omapdss_dvi_ops *dvi;
820 const struct omapdss_hdmi_ops *hdmi;
821 const struct omapdss_atv_ops *atv;
822 const struct omapdss_dsi_ops *dsi;
823 } ops;
824
655 /* helper variable for driver suspend/resume */ 825 /* helper variable for driver suspend/resume */
656 bool activate_after_resume; 826 bool activate_after_resume;
657 827
658 enum omap_display_caps caps; 828 enum omap_display_caps caps;
659 829
660 struct omap_dss_output *output; 830 struct omap_dss_device *output;
661 831
662 enum omap_dss_display_state state; 832 enum omap_dss_display_state state;
663 833
664 enum omap_dss_audio_state audio_state; 834 enum omap_dss_audio_state audio_state;
665 835
666 /* platform specific */ 836 /* OMAP DSS output specific fields */
667 int (*platform_enable)(struct omap_dss_device *dssdev); 837
668 void (*platform_disable)(struct omap_dss_device *dssdev); 838 struct list_head list;
669 int (*set_backlight)(struct omap_dss_device *dssdev, int level); 839
670 int (*get_backlight)(struct omap_dss_device *dssdev); 840 /* DISPC channel for this output */
841 enum omap_channel dispc_channel;
842
843 /* output instance */
844 enum omap_dss_output_id id;
845
846 /* dynamic fields */
847 struct omap_overlay_manager *manager;
848
849 struct omap_dss_device *device;
671}; 850};
672 851
673struct omap_dss_hdmi_data 852struct omap_dss_hdmi_data
@@ -677,17 +856,15 @@ struct omap_dss_hdmi_data
677 int hpd_gpio; 856 int hpd_gpio;
678}; 857};
679 858
680struct omap_dss_audio {
681 struct snd_aes_iec958 *iec;
682 struct snd_cea_861_aud_if *cea;
683};
684
685struct omap_dss_driver { 859struct omap_dss_driver {
686 struct device_driver driver; 860 struct device_driver driver;
687 861
688 int (*probe)(struct omap_dss_device *); 862 int (*probe)(struct omap_dss_device *);
689 void (*remove)(struct omap_dss_device *); 863 void (*remove)(struct omap_dss_device *);
690 864
865 int (*connect)(struct omap_dss_device *dssdev);
866 void (*disconnect)(struct omap_dss_device *dssdev);
867
691 int (*enable)(struct omap_dss_device *display); 868 int (*enable)(struct omap_dss_device *display);
692 void (*disable)(struct omap_dss_device *display); 869 void (*disable)(struct omap_dss_device *display);
693 int (*run_test)(struct omap_dss_device *display, int test); 870 int (*run_test)(struct omap_dss_device *display, int test);
@@ -753,7 +930,10 @@ bool omapdss_is_initialized(void);
753int omap_dss_register_driver(struct omap_dss_driver *); 930int omap_dss_register_driver(struct omap_dss_driver *);
754void omap_dss_unregister_driver(struct omap_dss_driver *); 931void omap_dss_unregister_driver(struct omap_dss_driver *);
755 932
756void omap_dss_get_device(struct omap_dss_device *dssdev); 933int omapdss_register_display(struct omap_dss_device *dssdev);
934void omapdss_unregister_display(struct omap_dss_device *dssdev);
935
936struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
757void omap_dss_put_device(struct omap_dss_device *dssdev); 937void omap_dss_put_device(struct omap_dss_device *dssdev);
758#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL) 938#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
759struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from); 939struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
@@ -761,8 +941,10 @@ struct omap_dss_device *omap_dss_find_device(void *data,
761 int (*match)(struct omap_dss_device *dssdev, void *data)); 941 int (*match)(struct omap_dss_device *dssdev, void *data));
762const char *omapdss_get_default_display_name(void); 942const char *omapdss_get_default_display_name(void);
763 943
764int omap_dss_start_device(struct omap_dss_device *dssdev); 944void videomode_to_omap_video_timings(const struct videomode *vm,
765void omap_dss_stop_device(struct omap_dss_device *dssdev); 945 struct omap_video_timings *ovt);
946void omap_video_timings_to_videomode(const struct omap_video_timings *ovt,
947 struct videomode *vm);
766 948
767int dss_feat_get_num_mgrs(void); 949int dss_feat_get_num_mgrs(void);
768int dss_feat_get_num_ovls(void); 950int dss_feat_get_num_ovls(void);
@@ -778,10 +960,17 @@ struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
778int omap_dss_get_num_overlays(void); 960int omap_dss_get_num_overlays(void);
779struct omap_overlay *omap_dss_get_overlay(int num); 961struct omap_overlay *omap_dss_get_overlay(int num);
780 962
781struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id); 963int omapdss_register_output(struct omap_dss_device *output);
782int omapdss_output_set_device(struct omap_dss_output *out, 964void omapdss_unregister_output(struct omap_dss_device *output);
965struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id);
966struct omap_dss_device *omap_dss_find_output(const char *name);
967struct omap_dss_device *omap_dss_find_output_by_node(struct device_node *node);
968int omapdss_output_set_device(struct omap_dss_device *out,
783 struct omap_dss_device *dssdev); 969 struct omap_dss_device *dssdev);
784int omapdss_output_unset_device(struct omap_dss_output *out); 970int omapdss_output_unset_device(struct omap_dss_device *out);
971
972struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev);
973struct omap_overlay_manager *omapdss_find_mgr_from_display(struct omap_dss_device *dssdev);
785 974
786void omapdss_default_get_resolution(struct omap_dss_device *dssdev, 975void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
787 u16 *xres, u16 *yres); 976 u16 *xres, u16 *yres);
@@ -832,7 +1021,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
832 bool mem_to_mem); 1021 bool mem_to_mem);
833 1022
834#define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver) 1023#define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver)
835#define to_dss_device(x) container_of((x), struct omap_dss_device, dev) 1024#define to_dss_device(x) container_of((x), struct omap_dss_device, old_dev)
836 1025
837void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel, 1026void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
838 bool enable); 1027 bool enable);
@@ -883,6 +1072,11 @@ int omapdss_compat_init(void);
883void omapdss_compat_uninit(void); 1072void omapdss_compat_uninit(void);
884 1073
885struct dss_mgr_ops { 1074struct dss_mgr_ops {
1075 int (*connect)(struct omap_overlay_manager *mgr,
1076 struct omap_dss_device *dst);
1077 void (*disconnect)(struct omap_overlay_manager *mgr,
1078 struct omap_dss_device *dst);
1079
886 void (*start_update)(struct omap_overlay_manager *mgr); 1080 void (*start_update)(struct omap_overlay_manager *mgr);
887 int (*enable)(struct omap_overlay_manager *mgr); 1081 int (*enable)(struct omap_overlay_manager *mgr);
888 void (*disable)(struct omap_overlay_manager *mgr); 1082 void (*disable)(struct omap_overlay_manager *mgr);
@@ -899,6 +1093,10 @@ struct dss_mgr_ops {
899int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops); 1093int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops);
900void dss_uninstall_mgr_ops(void); 1094void dss_uninstall_mgr_ops(void);
901 1095
1096int dss_mgr_connect(struct omap_overlay_manager *mgr,
1097 struct omap_dss_device *dst);
1098void dss_mgr_disconnect(struct omap_overlay_manager *mgr,
1099 struct omap_dss_device *dst);
902void dss_mgr_set_timings(struct omap_overlay_manager *mgr, 1100void dss_mgr_set_timings(struct omap_overlay_manager *mgr,
903 const struct omap_video_timings *timings); 1101 const struct omap_video_timings *timings);
904void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr, 1102void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr,
@@ -910,4 +1108,15 @@ int dss_mgr_register_framedone_handler(struct omap_overlay_manager *mgr,
910 void (*handler)(void *), void *data); 1108 void (*handler)(void *), void *data);
911void dss_mgr_unregister_framedone_handler(struct omap_overlay_manager *mgr, 1109void dss_mgr_unregister_framedone_handler(struct omap_overlay_manager *mgr,
912 void (*handler)(void *), void *data); 1110 void (*handler)(void *), void *data);
1111
1112static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
1113{
1114 return dssdev->output;
1115}
1116
1117static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
1118{
1119 return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
1120}
1121
913#endif 1122#endif
diff --git a/include/video/uvesafb.h b/include/video/uvesafb.h
index 1a91850cb961..30f53625415c 100644
--- a/include/video/uvesafb.h
+++ b/include/video/uvesafb.h
@@ -134,6 +134,7 @@ struct uvesafb_par {
134 134
135 int mode_idx; 135 int mode_idx;
136 struct vbe_crtc_ib crtc; 136 struct vbe_crtc_ib crtc;
137 int mtrr_handle;
137}; 138};
138 139
139#endif /* _UVESAFB_H */ 140#endif /* _UVESAFB_H */
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 68d73d09b770..46aa3d1c1654 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -78,11 +78,25 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
78int xen_acpi_notify_hypervisor_state(u8 sleep_state, 78int xen_acpi_notify_hypervisor_state(u8 sleep_state,
79 u32 pm1a_cnt, u32 pm1b_cnd); 79 u32 pm1a_cnt, u32 pm1b_cnd);
80 80
81static inline int xen_acpi_suspend_lowlevel(void)
82{
83 /*
84 * Xen will save and restore CPU context, so
85 * we can skip that and just go straight to
86 * the suspend.
87 */
88 acpi_enter_sleep_state(ACPI_STATE_S3);
89 return 0;
90}
91
81static inline void xen_acpi_sleep_register(void) 92static inline void xen_acpi_sleep_register(void)
82{ 93{
83 if (xen_initial_domain()) 94 if (xen_initial_domain()) {
84 acpi_os_set_prepare_sleep( 95 acpi_os_set_prepare_sleep(
85 &xen_acpi_notify_hypervisor_state); 96 &xen_acpi_notify_hypervisor_state);
97
98 acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel;
99 }
86} 100}
87#else 101#else
88static inline void xen_acpi_sleep_register(void) 102static inline void xen_acpi_sleep_register(void)
diff --git a/include/xen/events.h b/include/xen/events.h
index b2b27c6a0f7b..c9ea10ee2273 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -76,6 +76,9 @@ unsigned irq_from_evtchn(unsigned int evtchn);
76 76
77/* Xen HVM evtchn vector callback */ 77/* Xen HVM evtchn vector callback */
78void xen_hvm_callback_vector(void); 78void xen_hvm_callback_vector(void);
79#ifdef CONFIG_TRACING
80#define trace_xen_hvm_callback_vector xen_hvm_callback_vector
81#endif
79extern int xen_have_vector_callback; 82extern int xen_have_vector_callback;
80int xen_set_callback_via(uint64_t via); 83int xen_set_callback_via(uint64_t via);
81void xen_evtchn_do_upcall(struct pt_regs *regs); 84void xen_evtchn_do_upcall(struct pt_regs *regs);
diff --git a/include/xen/hvm.h b/include/xen/hvm.h
index 13e43e41637d..63917a8de3b0 100644
--- a/include/xen/hvm.h
+++ b/include/xen/hvm.h
@@ -44,8 +44,8 @@ static inline int hvm_get_parameter(int idx, uint64_t *value)
44 xhv.index = idx; 44 xhv.index = idx;
45 r = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv); 45 r = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv);
46 if (r < 0) { 46 if (r < 0) {
47 printk(KERN_ERR "Cannot get hvm parameter %s (%d): %d!\n", 47 pr_err("Cannot get hvm parameter %s (%d): %d!\n",
48 param_name(idx), idx, r); 48 param_name(idx), idx, r);
49 return r; 49 return r;
50 } 50 }
51 *value = xhv.value; 51 *value = xhv.value;
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h
index ffd4652de91c..65e12099ef89 100644
--- a/include/xen/interface/io/blkif.h
+++ b/include/xen/interface/io/blkif.h
@@ -103,12 +103,46 @@ typedef uint64_t blkif_sector_t;
103#define BLKIF_OP_DISCARD 5 103#define BLKIF_OP_DISCARD 5
104 104
105/* 105/*
106 * Recognized if "feature-max-indirect-segments" in present in the backend
107 * xenbus info. The "feature-max-indirect-segments" node contains the maximum
108 * number of segments allowed by the backend per request. If the node is
109 * present, the frontend might use blkif_request_indirect structs in order to
110 * issue requests with more than BLKIF_MAX_SEGMENTS_PER_REQUEST (11). The
111 * maximum number of indirect segments is fixed by the backend, but the
112 * frontend can issue requests with any number of indirect segments as long as
113 * it's less than the number provided by the backend. The indirect_grefs field
114 * in blkif_request_indirect should be filled by the frontend with the
115 * grant references of the pages that are holding the indirect segments.
116 * This pages are filled with an array of blkif_request_segment_aligned
117 * that hold the information about the segments. The number of indirect
118 * pages to use is determined by the maximum number of segments
119 * a indirect request contains. Every indirect page can contain a maximum
120 * of 512 segments (PAGE_SIZE/sizeof(blkif_request_segment_aligned)),
121 * so to calculate the number of indirect pages to use we have to do
122 * ceil(indirect_segments/512).
123 *
124 * If a backend does not recognize BLKIF_OP_INDIRECT, it should *not*
125 * create the "feature-max-indirect-segments" node!
126 */
127#define BLKIF_OP_INDIRECT 6
128
129/*
106 * Maximum scatter/gather segments per request. 130 * Maximum scatter/gather segments per request.
107 * This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE. 131 * This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE.
108 * NB. This could be 12 if the ring indexes weren't stored in the same page. 132 * NB. This could be 12 if the ring indexes weren't stored in the same page.
109 */ 133 */
110#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 134#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
111 135
136#define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8
137
138struct blkif_request_segment_aligned {
139 grant_ref_t gref; /* reference to I/O buffer frame */
140 /* @first_sect: first sector in frame to transfer (inclusive). */
141 /* @last_sect: last sector in frame to transfer (inclusive). */
142 uint8_t first_sect, last_sect;
143 uint16_t _pad; /* padding to make it 8 bytes, so it's cache-aligned */
144} __attribute__((__packed__));
145
112struct blkif_request_rw { 146struct blkif_request_rw {
113 uint8_t nr_segments; /* number of segments */ 147 uint8_t nr_segments; /* number of segments */
114 blkif_vdev_t handle; /* only for read/write requests */ 148 blkif_vdev_t handle; /* only for read/write requests */
@@ -147,12 +181,31 @@ struct blkif_request_other {
147 uint64_t id; /* private guest value, echoed in resp */ 181 uint64_t id; /* private guest value, echoed in resp */
148} __attribute__((__packed__)); 182} __attribute__((__packed__));
149 183
184struct blkif_request_indirect {
185 uint8_t indirect_op;
186 uint16_t nr_segments;
187#ifdef CONFIG_X86_64
188 uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */
189#endif
190 uint64_t id;
191 blkif_sector_t sector_number;
192 blkif_vdev_t handle;
193 uint16_t _pad2;
194 grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];
195#ifdef CONFIG_X86_64
196 uint32_t _pad3; /* make it 64 byte aligned */
197#else
198 uint64_t _pad3; /* make it 64 byte aligned */
199#endif
200} __attribute__((__packed__));
201
150struct blkif_request { 202struct blkif_request {
151 uint8_t operation; /* BLKIF_OP_??? */ 203 uint8_t operation; /* BLKIF_OP_??? */
152 union { 204 union {
153 struct blkif_request_rw rw; 205 struct blkif_request_rw rw;
154 struct blkif_request_discard discard; 206 struct blkif_request_discard discard;
155 struct blkif_request_other other; 207 struct blkif_request_other other;
208 struct blkif_request_indirect indirect;
156 } u; 209 } u;
157} __attribute__((__packed__)); 210} __attribute__((__packed__));
158 211
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h
index 3ef3fe05ee99..eb262e3324d2 100644
--- a/include/xen/interface/io/netif.h
+++ b/include/xen/interface/io/netif.h
@@ -38,6 +38,18 @@
38 * that it cannot safely queue packets (as it may not be kicked to send them). 38 * that it cannot safely queue packets (as it may not be kicked to send them).
39 */ 39 */
40 40
41 /*
42 * "feature-split-event-channels" is introduced to separate guest TX
43 * and RX notificaion. Backend either doesn't support this feature or
44 * advertise it via xenstore as 0 (disabled) or 1 (enabled).
45 *
46 * To make use of this feature, frontend should allocate two event
47 * channels for TX and RX, advertise them to backend as
48 * "event-channel-tx" and "event-channel-rx" respectively. If frontend
49 * doesn't want to use this feature, it just writes "event-channel"
50 * node as before.
51 */
52
41/* 53/*
42 * This is the 'wire' format for packets: 54 * This is the 'wire' format for packets:
43 * Request 1: xen_netif_tx_request -- XEN_NETTXF_* (any flags) 55 * Request 1: xen_netif_tx_request -- XEN_NETTXF_* (any flags)
diff --git a/include/xen/interface/io/protocols.h b/include/xen/interface/io/protocols.h
index 0eafaf254fff..056744b4b05e 100644
--- a/include/xen/interface/io/protocols.h
+++ b/include/xen/interface/io/protocols.h
@@ -15,7 +15,7 @@
15# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64 15# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64
16#elif defined(__powerpc64__) 16#elif defined(__powerpc64__)
17# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64 17# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64
18#elif defined(__arm__) 18#elif defined(__arm__) || defined(__aarch64__)
19# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_ARM 19# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_ARM
20#else 20#else
21# error arch fixup needed here 21# error arch fixup needed here
diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h
index 75271b9a8f61..7d28aff605c7 100644
--- a/include/xen/interface/io/ring.h
+++ b/include/xen/interface/io/ring.h
@@ -188,6 +188,11 @@ struct __name##_back_ring { \
188#define RING_REQUEST_CONS_OVERFLOW(_r, _cons) \ 188#define RING_REQUEST_CONS_OVERFLOW(_r, _cons) \
189 (((_cons) - (_r)->rsp_prod_pvt) >= RING_SIZE(_r)) 189 (((_cons) - (_r)->rsp_prod_pvt) >= RING_SIZE(_r))
190 190
191/* Ill-behaved frontend determination: Can there be this many requests? */
192#define RING_REQUEST_PROD_OVERFLOW(_r, _prod) \
193 (((_prod) - (_r)->rsp_prod_pvt) > RING_SIZE(_r))
194
195
191#define RING_PUSH_REQUESTS(_r) do { \ 196#define RING_PUSH_REQUESTS(_r) do { \
192 wmb(); /* back sees requests /before/ updated producer index */ \ 197 wmb(); /* back sees requests /before/ updated producer index */ \
193 (_r)->sring->req_prod = (_r)->req_prod_pvt; \ 198 (_r)->sring->req_prod = (_r)->req_prod_pvt; \