aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2014-11-20 08:42:02 -0500
committerJiri Kosina <jkosina@suse.cz>2014-11-20 08:42:02 -0500
commita02001086bbfb4da35d1228bebc2f1b442db455f (patch)
tree62ab47936cef06fd08657ca5b6cd1df98c19be57 /include/linux
parenteff264efeeb0898408e8c9df72d8a32621035bed (diff)
parentfc14f9c1272f62c3e8d01300f52467c0d9af50f9 (diff)
Merge Linus' tree to be be to apply submitted patches to newer code than
current trivial.git base
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acct.h4
-rw-r--r--include/linux/acpi.h14
-rw-r--r--include/linux/aer.h2
-rw-r--r--include/linux/ahci_platform.h13
-rw-r--r--include/linux/amba/bus.h5
-rw-r--r--include/linux/ata_platform.h5
-rw-r--r--include/linux/atmel-mci.h2
-rw-r--r--include/linux/atmel-pwm-bl.h43
-rw-r--r--include/linux/atmel_pwm.h70
-rw-r--r--include/linux/atmel_tc.h13
-rw-r--r--include/linux/atomic.h36
-rw-r--r--include/linux/audit.h27
-rw-r--r--include/linux/backing-dev.h4
-rw-r--r--include/linux/balloon_compaction.h169
-rw-r--r--include/linux/bcma/bcma.h6
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h8
-rw-r--r--include/linux/bcma/bcma_regs.h5
-rw-r--r--include/linux/bcma/bcma_soc.h1
-rw-r--r--include/linux/bio.h66
-rw-r--r--include/linux/bitmap.h62
-rw-r--r--include/linux/bitops.h20
-rw-r--r--include/linux/blk-mq.h30
-rw-r--r--include/linux/blk_types.h18
-rw-r--r--include/linux/blkdev.h84
-rw-r--r--include/linux/bootmem.h1
-rw-r--r--include/linux/bpf.h136
-rw-r--r--include/linux/brcmphy.h138
-rw-r--r--include/linux/buffer_head.h47
-rw-r--r--include/linux/byteorder/generic.h2
-rw-r--r--include/linux/ccp.h12
-rw-r--r--include/linux/ceph/libceph.h1
-rw-r--r--include/linux/ceph/messenger.h14
-rw-r--r--include/linux/ceph/osd_client.h18
-rw-r--r--include/linux/ceph/pagelist.h5
-rw-r--r--include/linux/ceph/rados.h225
-rw-r--r--include/linux/cgroup.h26
-rw-r--r--include/linux/clk-private.h2
-rw-r--r--include/linux/clk-provider.h33
-rw-r--r--include/linux/clk.h29
-rw-r--r--include/linux/clk/at91_pmc.h1
-rw-r--r--include/linux/clk/ti.h1
-rw-r--r--include/linux/clocksource.h2
-rw-r--r--include/linux/cma.h30
-rw-r--r--include/linux/com20020.h29
-rw-r--r--include/linux/compaction.h24
-rw-r--r--include/linux/compiler-gcc4.h1
-rw-r--r--include/linux/compiler-gcc5.h65
-rw-r--r--include/linux/cpu.h2
-rw-r--r--include/linux/cpufreq-dt.h22
-rw-r--r--include/linux/cpufreq.h5
-rw-r--r--include/linux/cpumask.h11
-rw-r--r--include/linux/cpuset.h7
-rw-r--r--include/linux/crash_dump.h15
-rw-r--r--include/linux/crc-t10dif.h5
-rw-r--r--include/linux/cred.h9
-rw-r--r--include/linux/cycx_x25.h125
-rw-r--r--include/linux/dcache.h11
-rw-r--r--include/linux/decompress/bunzip2.h8
-rw-r--r--include/linux/decompress/generic.h10
-rw-r--r--include/linux/decompress/inflate.h8
-rw-r--r--include/linux/decompress/unlz4.h8
-rw-r--r--include/linux/decompress/unlzma.h8
-rw-r--r--include/linux/decompress/unlzo.h8
-rw-r--r--include/linux/decompress/unxz.h8
-rw-r--r--include/linux/devcoredump.h35
-rw-r--r--include/linux/device.h15
-rw-r--r--include/linux/dma-contiguous.h11
-rw-r--r--include/linux/dma-mapping.h26
-rw-r--r--include/linux/dma/dw.h64
-rw-r--r--include/linux/dmaengine.h44
-rw-r--r--include/linux/dmar.h8
-rw-r--r--include/linux/drbd.h4
-rw-r--r--include/linux/drbd_genl.h4
-rw-r--r--include/linux/drbd_limits.h6
-rw-r--r--include/linux/dw_dmac.h111
-rw-r--r--include/linux/dynamic_debug.h12
-rw-r--r--include/linux/dynamic_queue_limits.h12
-rw-r--r--include/linux/edac.h5
-rw-r--r--include/linux/efi.h36
-rw-r--r--include/linux/etherdevice.h1
-rw-r--r--include/linux/ethtool.h4
-rw-r--r--include/linux/extcon/extcon-gpio.h4
-rw-r--r--include/linux/extcon/sm5502.h287
-rw-r--r--include/linux/f2fs_fs.h22
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/filter.h196
-rw-r--r--include/linux/flex_proportions.h5
-rw-r--r--include/linux/font.h4
-rw-r--r--include/linux/fs.h148
-rw-r--r--include/linux/fs_enet_pd.h1
-rw-r--r--include/linux/fs_pin.h17
-rw-r--r--include/linux/fsl_ifc.h6
-rw-r--r--include/linux/fsldma.h13
-rw-r--r--include/linux/fsnotify_backend.h14
-rw-r--r--include/linux/ftrace.h24
-rw-r--r--include/linux/ftrace_event.h34
-rw-r--r--include/linux/genalloc.h7
-rw-r--r--include/linux/genl_magic_func.h4
-rw-r--r--include/linux/gfp.h4
-rw-r--r--include/linux/glob.h9
-rw-r--r--include/linux/gpio/consumer.h134
-rw-r--r--include/linux/gpio/driver.h70
-rw-r--r--include/linux/gpio/machine.h61
-rw-r--r--include/linux/hash.h4
-rw-r--r--include/linux/hid.h8
-rw-r--r--include/linux/highmem.h2
-rw-r--r--include/linux/host1x.h15
-rw-r--r--include/linux/huge_mm.h6
-rw-r--r--include/linux/hugetlb.h1
-rw-r--r--include/linux/i2c/atmel_mxt_ts.h3
-rw-r--r--include/linux/i2c/s6000.h10
-rw-r--r--include/linux/i82593.h229
-rw-r--r--include/linux/ieee80211.h73
-rw-r--r--include/linux/if_macvlan.h1
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/linux/igmp.h1
-rw-r--r--include/linux/iio/trigger.h4
-rw-r--r--include/linux/ima.h4
-rw-r--r--include/linux/init_task.h12
-rw-r--r--include/linux/input/mt.h1
-rw-r--r--include/linux/input/pixcir_ts.h12
-rw-r--r--include/linux/interrupt.h5
-rw-r--r--include/linux/iommu.h26
-rw-r--r--include/linux/ioport.h11
-rw-r--r--include/linux/ipack.h24
-rw-r--r--include/linux/irq.h8
-rw-r--r--include/linux/irq_work.h3
-rw-r--r--include/linux/irqchip/arm-gic.h16
-rw-r--r--include/linux/irqchip/irq-omap-intc.h32
-rw-r--r--include/linux/irqdesc.h29
-rw-r--r--include/linux/jbd2.h32
-rw-r--r--include/linux/jiffies.h12
-rw-r--r--include/linux/jump_label.h17
-rw-r--r--include/linux/kernel.h70
-rw-r--r--include/linux/kernel_stat.h4
-rw-r--r--include/linux/kernelcapi.h2
-rw-r--r--include/linux/kexec.h105
-rw-r--r--include/linux/key-type.h34
-rw-r--r--include/linux/kgdb.h2
-rw-r--r--include/linux/khugepaged.h17
-rw-r--r--include/linux/klist.h2
-rw-r--r--include/linux/kvm_host.h77
-rw-r--r--include/linux/kvm_types.h14
-rw-r--r--include/linux/leds.h18
-rw-r--r--include/linux/libata.h12
-rw-r--r--include/linux/list.h15
-rw-r--r--include/linux/lockd/lockd.h1
-rw-r--r--include/linux/lockdep.h8
-rw-r--r--include/linux/mailbox_client.h46
-rw-r--r--include/linux/mailbox_controller.h133
-rw-r--r--include/linux/mei_cl_bus.h1
-rw-r--r--include/linux/memblock.h4
-rw-r--r--include/linux/memcontrol.h169
-rw-r--r--include/linux/memory.h2
-rw-r--r--include/linux/memory_hotplug.h11
-rw-r--r--include/linux/mempolicy.h7
-rw-r--r--include/linux/mfd/abx500/ab8500.h1
-rw-r--r--include/linux/mfd/arizona/core.h35
-rw-r--r--include/linux/mfd/arizona/registers.h814
-rw-r--r--include/linux/mfd/core.h3
-rw-r--r--include/linux/mfd/cros_ec.h122
-rw-r--r--include/linux/mfd/cros_ec_commands.h3
-rw-r--r--include/linux/mfd/da9052/da9052.h2
-rw-r--r--include/linux/mfd/da9063/core.h3
-rw-r--r--include/linux/mfd/da9063/registers.h129
-rw-r--r--include/linux/mfd/davinci_voicecodec.h2
-rw-r--r--include/linux/mfd/hi6421-pmic.h41
-rw-r--r--include/linux/mfd/intel_soc_pmic.h30
-rw-r--r--include/linux/mfd/max14577-private.h95
-rw-r--r--include/linux/mfd/max14577.h30
-rw-r--r--include/linux/mfd/max77686-private.h239
-rw-r--r--include/linux/mfd/max77686.h59
-rw-r--r--include/linux/mfd/max77693-private.h77
-rw-r--r--include/linux/mfd/max77693.h40
-rw-r--r--include/linux/mfd/mc13783.h1
-rw-r--r--include/linux/mfd/mc13xxx.h23
-rw-r--r--include/linux/mfd/rk808.h196
-rw-r--r--include/linux/mfd/rn5t618.h228
-rw-r--r--include/linux/mfd/rtsx_pci.h6
-rw-r--r--include/linux/mfd/samsung/core.h22
-rw-r--r--include/linux/mfd/samsung/irq.h24
-rw-r--r--include/linux/mfd/samsung/s2mpa01.h12
-rw-r--r--include/linux/mfd/samsung/s2mps11.h9
-rw-r--r--include/linux/mfd/samsung/s2mps14.h10
-rw-r--r--include/linux/mfd/samsung/s2mpu02.h201
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h1
-rw-r--r--include/linux/mfd/ti_ssp.h93
-rw-r--r--include/linux/mfd/tmio.h25
-rw-r--r--include/linux/mfd/tps65217.h2
-rw-r--r--include/linux/mfd/tps65910.h2
-rw-r--r--include/linux/micrel_phy.h1
-rw-r--r--include/linux/migrate.h14
-rw-r--r--include/linux/mlx4/cmd.h7
-rw-r--r--include/linux/mlx4/device.h38
-rw-r--r--include/linux/mlx4/qp.h12
-rw-r--r--include/linux/mlx5/device.h152
-rw-r--r--include/linux/mlx5/driver.h118
-rw-r--r--include/linux/mlx5/mlx5_ifc.h349
-rw-r--r--include/linux/mlx5/qp.h38
-rw-r--r--include/linux/mm.h64
-rw-r--r--include/linux/mm_types.h1
-rw-r--r--include/linux/mmc/card.h10
-rw-r--r--include/linux/mmc/dw_mmc.h6
-rw-r--r--include/linux/mmc/host.h12
-rw-r--r--include/linux/mmc/mmc.h7
-rw-r--r--include/linux/mmc/sdhci.h6
-rw-r--r--include/linux/mmc/slot-gpio.h5
-rw-r--r--include/linux/mmdebug.h22
-rw-r--r--include/linux/mmu_notifier.h30
-rw-r--r--include/linux/mmzone.h269
-rw-r--r--include/linux/module.h11
-rw-r--r--include/linux/moduleloader.h6
-rw-r--r--include/linux/moduleparam.h52
-rw-r--r--include/linux/mount.h16
-rw-r--r--include/linux/msi.h6
-rw-r--r--include/linux/mtd/cfi.h22
-rw-r--r--include/linux/mtd/mtd.h2
-rw-r--r--include/linux/mtd/nand.h65
-rw-r--r--include/linux/mtd/spi-nor.h25
-rw-r--r--include/linux/mutex.h4
-rw-r--r--include/linux/mvebu-pmsu.h20
-rw-r--r--include/linux/netdevice.h264
-rw-r--r--include/linux/netfilter.h5
-rw-r--r--include/linux/netfilter/ipset/ip_set.h60
-rw-r--r--include/linux/netfilter/ipset/ip_set_list.h1
-rw-r--r--include/linux/netfilter_bridge.h50
-rw-r--r--include/linux/nfs4.h29
-rw-r--r--include/linux/nfs_fs.h47
-rw-r--r--include/linux/nfs_fs_sb.h2
-rw-r--r--include/linux/nfs_page.h20
-rw-r--r--include/linux/nfs_xdr.h81
-rw-r--r--include/linux/nmi.h13
-rw-r--r--include/linux/nodemask.h11
-rw-r--r--include/linux/nsproxy.h16
-rw-r--r--include/linux/of.h174
-rw-r--r--include/linux/of_address.h27
-rw-r--r--include/linux/of_dma.h4
-rw-r--r--include/linux/of_pci.h13
-rw-r--r--include/linux/of_platform.h7
-rw-r--r--include/linux/of_reserved_mem.h12
-rw-r--r--include/linux/omap-dma.h38
-rw-r--r--include/linux/oom.h7
-rw-r--r--include/linux/page-flags.h21
-rw-r--r--include/linux/page-isolation.h8
-rw-r--r--include/linux/page_cgroup.h70
-rw-r--r--include/linux/pagemap.h33
-rw-r--r--include/linux/pci-acpi.h7
-rw-r--r--include/linux/pci.h66
-rw-r--r--include/linux/pci_hotplug.h2
-rw-r--r--include/linux/pci_ids.h20
-rw-r--r--include/linux/percpu-defs.h3
-rw-r--r--include/linux/percpu-refcount.h121
-rw-r--r--include/linux/percpu.h13
-rw-r--r--include/linux/percpu_counter.h10
-rw-r--r--include/linux/perf_event.h14
-rw-r--r--include/linux/phonedev.h25
-rw-r--r--include/linux/phy.h27
-rw-r--r--include/linux/phy_fixed.h31
-rw-r--r--include/linux/pid_namespace.h1
-rw-r--r--include/linux/pinctrl/pinconf-generic.h2
-rw-r--r--include/linux/pinctrl/pinmux.h9
-rw-r--r--include/linux/pl320-ipc.h (renamed from include/linux/mailbox.h)0
-rw-r--r--include/linux/platform_data/camera-mx1.h35
-rw-r--r--include/linux/platform_data/dma-dw.h59
-rw-r--r--include/linux/platform_data/dma-imx.h1
-rw-r--r--include/linux/platform_data/drv260x-pdata.h28
-rw-r--r--include/linux/platform_data/edma.h2
-rw-r--r--include/linux/platform_data/elm.h16
-rw-r--r--include/linux/platform_data/gpio-dwapb.h (renamed from include/linux/tegra-cpuidle.h)27
-rw-r--r--include/linux/platform_data/i2c-designware.h (renamed from include/linux/tegra-ahb.h)12
-rw-r--r--include/linux/platform_data/isl9305.h30
-rw-r--r--include/linux/platform_data/mmc-omap.h1
-rw-r--r--include/linux/platform_data/mtd-nand-omap2.h14
-rw-r--r--include/linux/platform_data/rcar-du.h4
-rw-r--r--include/linux/platform_data/samsung-usbphy.h27
-rw-r--r--include/linux/platform_data/tegra_emc.h34
-rw-r--r--include/linux/platform_data/usb-ehci-mxc.h46
-rw-r--r--include/linux/platform_data/usb-imx_udc.h23
-rw-r--r--include/linux/platform_data/video-clcd-versatile.h27
-rw-r--r--include/linux/pm.h5
-rw-r--r--include/linux/pm_domain.h136
-rw-r--r--include/linux/pm_qos.h5
-rw-r--r--include/linux/pnfs_osd_xdr.h2
-rw-r--r--include/linux/power/charger-manager.h3
-rw-r--r--include/linux/power_supply.h14
-rw-r--r--include/linux/printk.h5
-rw-r--r--include/linux/prio_heap.h58
-rw-r--r--include/linux/proc_fs.h2
-rw-r--r--include/linux/proportions.h5
-rw-r--r--include/linux/quota.h1
-rw-r--r--include/linux/random.h4
-rw-r--r--include/linux/rbtree_augmented.h10
-rw-r--r--include/linux/rculist.h8
-rw-r--r--include/linux/rcupdate.h121
-rw-r--r--include/linux/rcutiny.h2
-rw-r--r--include/linux/reboot.h3
-rw-r--r--include/linux/regulator/consumer.h22
-rw-r--r--include/linux/regulator/da9211.h9
-rw-r--r--include/linux/regulator/driver.h14
-rw-r--r--include/linux/regulator/machine.h1
-rw-r--r--include/linux/regulator/max1586.h2
-rw-r--r--include/linux/rhashtable.h19
-rw-r--r--include/linux/ring_buffer.h2
-rw-r--r--include/linux/rio_drv.h5
-rw-r--r--include/linux/rmap.h2
-rw-r--r--include/linux/rtnetlink.h10
-rw-r--r--include/linux/rwsem.h2
-rw-r--r--include/linux/scatterlist.h2
-rw-r--r--include/linux/sched.h121
-rw-r--r--include/linux/screen_info.h8
-rw-r--r--include/linux/seccomp.h25
-rw-r--r--include/linux/security.h10
-rw-r--r--include/linux/seqlock.h19
-rw-r--r--include/linux/seqno-fence.h1
-rw-r--r--include/linux/serial_8250.h6
-rw-r--r--include/linux/serial_core.h20
-rw-r--r--include/linux/sh_dma.h24
-rw-r--r--include/linux/shm.h18
-rw-r--r--include/linux/shmem_fs.h17
-rw-r--r--include/linux/signal.h44
-rw-r--r--include/linux/skbuff.h363
-rw-r--r--include/linux/slab.h64
-rw-r--r--include/linux/slab_def.h20
-rw-r--r--include/linux/smp.h2
-rw-r--r--include/linux/soc/ti/knav_dma.h175
-rw-r--r--include/linux/soc/ti/knav_qmss.h90
-rw-r--r--include/linux/socket.h2
-rw-r--r--include/linux/spi/mcp23s08.h18
-rw-r--r--include/linux/spi/pxa2xx_spi.h9
-rw-r--r--include/linux/spi/spi.h7
-rw-r--r--include/linux/spinlock.h8
-rw-r--r--include/linux/string.h7
-rw-r--r--include/linux/string_helpers.h65
-rw-r--r--include/linux/sunrpc/auth.h4
-rw-r--r--include/linux/sunrpc/auth_gss.h3
-rw-r--r--include/linux/sunrpc/gss_krb5.h4
-rw-r--r--include/linux/sunrpc/svc.h5
-rw-r--r--include/linux/sunrpc/svc_rdma.h3
-rw-r--r--include/linux/sunrpc/svc_xprt.h2
-rw-r--r--include/linux/sunrpc/xprt.h1
-rw-r--r--include/linux/sunrpc/xprtrdma.h2
-rw-r--r--include/linux/suspend.h6
-rw-r--r--include/linux/swap.h38
-rw-r--r--include/linux/syscalls.h8
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/t10-pi.h22
-rw-r--r--include/linux/tcp.h10
-rw-r--r--include/linux/tegra-powergate.h134
-rw-r--r--include/linux/tegra-soc.h22
-rw-r--r--include/linux/thermal.h50
-rw-r--r--include/linux/ti_wilink_st.h2
-rw-r--r--include/linux/tick.h11
-rw-r--r--include/linux/topology.h17
-rw-r--r--include/linux/torture.h5
-rw-r--r--include/linux/tracehook.h8
-rw-r--r--include/linux/tracepoint.h55
-rw-r--r--include/linux/tty.h15
-rw-r--r--include/linux/tty_driver.h4
-rw-r--r--include/linux/udp.h16
-rw-r--r--include/linux/uio.h5
-rw-r--r--include/linux/uio_driver.h12
-rw-r--r--include/linux/uprobes.h14
-rw-r--r--include/linux/usb.h12
-rw-r--r--include/linux/usb/chipidea.h1
-rw-r--r--include/linux/usb/gadget.h26
-rw-r--r--include/linux/usb/hcd.h4
-rw-r--r--include/linux/usb/of.h5
-rw-r--r--include/linux/usb/quirks.h22
-rw-r--r--include/linux/usb/usbnet.h4
-rw-r--r--include/linux/usb_usual.h4
-rw-r--r--include/linux/user_namespace.h6
-rw-r--r--include/linux/vfio.h23
-rw-r--r--include/linux/vga_switcheroo.h2
-rw-r--r--include/linux/vgaarb.h2
-rw-r--r--include/linux/virtio.h14
-rw-r--r--include/linux/virtio_config.h17
-rw-r--r--include/linux/vm_event_item.h7
-rw-r--r--include/linux/vmalloc.h2
-rw-r--r--include/linux/wait.h21
-rw-r--r--include/linux/watchdog.h9
-rw-r--r--include/linux/workqueue.h2
-rw-r--r--include/linux/zbud.h2
-rw-r--r--include/linux/zlib.h122
-rw-r--r--include/linux/zpool.h106
-rw-r--r--include/linux/zsmalloc.h2
385 files changed, 8449 insertions, 4427 deletions
diff --git a/include/linux/acct.h b/include/linux/acct.h
index 4a5b7cb56079..dccc2d4fe7de 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -24,14 +24,10 @@ struct super_block;
24struct pacct_struct; 24struct pacct_struct;
25struct pid_namespace; 25struct pid_namespace;
26extern int acct_parm[]; /* for sysctl */ 26extern int acct_parm[]; /* for sysctl */
27extern void acct_auto_close_mnt(struct vfsmount *m);
28extern void acct_auto_close(struct super_block *sb);
29extern void acct_collect(long exitcode, int group_dead); 27extern void acct_collect(long exitcode, int group_dead);
30extern void acct_process(void); 28extern void acct_process(void);
31extern void acct_exit_ns(struct pid_namespace *); 29extern void acct_exit_ns(struct pid_namespace *);
32#else 30#else
33#define acct_auto_close_mnt(x) do { } while (0)
34#define acct_auto_close(x) do { } while (0)
35#define acct_collect(x,y) do { } while (0) 31#define acct_collect(x,y) do { } while (0)
36#define acct_process() do { } while (0) 32#define acct_process() do { } while (0)
37#define acct_exit_ns(ns) do { } while (0) 33#define acct_exit_ns(ns) do { } while (0)
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 5320153c311b..407a12f663eb 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -364,6 +364,17 @@ extern bool osc_sb_apei_support_acked;
364#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010 364#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010
365#define OSC_PCI_CONTROL_MASKS 0x0000001f 365#define OSC_PCI_CONTROL_MASKS 0x0000001f
366 366
367#define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002
368#define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV 0x00000004
369#define ACPI_GSB_ACCESS_ATTRIB_BYTE 0x00000006
370#define ACPI_GSB_ACCESS_ATTRIB_WORD 0x00000008
371#define ACPI_GSB_ACCESS_ATTRIB_BLOCK 0x0000000A
372#define ACPI_GSB_ACCESS_ATTRIB_MULTIBYTE 0x0000000B
373#define ACPI_GSB_ACCESS_ATTRIB_WORD_CALL 0x0000000C
374#define ACPI_GSB_ACCESS_ATTRIB_BLOCK_CALL 0x0000000D
375#define ACPI_GSB_ACCESS_ATTRIB_RAW_BYTES 0x0000000E
376#define ACPI_GSB_ACCESS_ATTRIB_RAW_PROCESS 0x0000000F
377
367extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, 378extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
368 u32 *mask, u32 req); 379 u32 *mask, u32 req);
369 380
@@ -421,6 +432,7 @@ static inline bool acpi_driver_match_device(struct device *dev,
421int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); 432int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *);
422int acpi_device_modalias(struct device *, char *, int); 433int acpi_device_modalias(struct device *, char *, int);
423 434
435struct platform_device *acpi_create_platform_device(struct acpi_device *);
424#define ACPI_PTR(_ptr) (_ptr) 436#define ACPI_PTR(_ptr) (_ptr)
425 437
426#else /* !CONFIG_ACPI */ 438#else /* !CONFIG_ACPI */
@@ -576,7 +588,6 @@ static inline int acpi_subsys_freeze(struct device *dev) { return 0; }
576#if defined(CONFIG_ACPI) && defined(CONFIG_PM) 588#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
577struct acpi_device *acpi_dev_pm_get_node(struct device *dev); 589struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
578int acpi_dev_pm_attach(struct device *dev, bool power_on); 590int acpi_dev_pm_attach(struct device *dev, bool power_on);
579void acpi_dev_pm_detach(struct device *dev, bool power_off);
580#else 591#else
581static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev) 592static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
582{ 593{
@@ -586,7 +597,6 @@ static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
586{ 597{
587 return -ENODEV; 598 return -ENODEV;
588} 599}
589static inline void acpi_dev_pm_detach(struct device *dev, bool power_off) {}
590#endif 600#endif
591 601
592#ifdef CONFIG_ACPI 602#ifdef CONFIG_ACPI
diff --git a/include/linux/aer.h b/include/linux/aer.h
index c826d1c28f9c..4fef65e57023 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -7,6 +7,8 @@
7#ifndef _AER_H_ 7#ifndef _AER_H_
8#define _AER_H_ 8#define _AER_H_
9 9
10#include <linux/types.h>
11
10#define AER_NONFATAL 0 12#define AER_NONFATAL 0
11#define AER_FATAL 1 13#define AER_FATAL 1
12#define AER_CORRECTABLE 2 14#define AER_CORRECTABLE 2
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index 09a947e8bc87..642d6ae4030c 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -22,19 +22,6 @@ struct ata_port_info;
22struct ahci_host_priv; 22struct ahci_host_priv;
23struct platform_device; 23struct platform_device;
24 24
25/*
26 * Note ahci_platform_data is deprecated, it is only kept around for use
27 * by the old da850 and spear13xx ahci code.
28 * New drivers should instead declare their own platform_driver struct, and
29 * use ahci_platform* functions in their own probe, suspend and resume methods.
30 */
31struct ahci_platform_data {
32 int (*init)(struct device *dev, void __iomem *addr);
33 void (*exit)(struct device *dev);
34 int (*suspend)(struct device *dev);
35 int (*resume)(struct device *dev);
36};
37
38int ahci_platform_enable_clks(struct ahci_host_priv *hpriv); 25int ahci_platform_enable_clks(struct ahci_host_priv *hpriv);
39void ahci_platform_disable_clks(struct ahci_host_priv *hpriv); 26void ahci_platform_disable_clks(struct ahci_host_priv *hpriv);
40int ahci_platform_enable_resources(struct ahci_host_priv *hpriv); 27int ahci_platform_enable_resources(struct ahci_host_priv *hpriv);
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index fdd7e1b61f60..c324f5700d1a 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -44,10 +44,15 @@ struct amba_driver {
44 const struct amba_id *id_table; 44 const struct amba_id *id_table;
45}; 45};
46 46
47/*
48 * Constants for the designer field of the Peripheral ID register. When bit 7
49 * is set to '1', bits [6:0] should be the JEP106 manufacturer identity code.
50 */
47enum amba_vendor { 51enum amba_vendor {
48 AMBA_VENDOR_ARM = 0x41, 52 AMBA_VENDOR_ARM = 0x41,
49 AMBA_VENDOR_ST = 0x80, 53 AMBA_VENDOR_ST = 0x80,
50 AMBA_VENDOR_QCOM = 0x51, 54 AMBA_VENDOR_QCOM = 0x51,
55 AMBA_VENDOR_LSI = 0xb6,
51}; 56};
52 57
53extern struct bus_type amba_bustype; 58extern struct bus_type amba_bustype;
diff --git a/include/linux/ata_platform.h b/include/linux/ata_platform.h
index b9fde17f767c..5c618a084225 100644
--- a/include/linux/ata_platform.h
+++ b/include/linux/ata_platform.h
@@ -8,11 +8,6 @@ struct pata_platform_info {
8 * spacing used by ata_std_ports(). 8 * spacing used by ata_std_ports().
9 */ 9 */
10 unsigned int ioport_shift; 10 unsigned int ioport_shift;
11 /*
12 * Indicate platform specific irq types and initial
13 * IRQ flags when call request_irq()
14 */
15 unsigned int irq_flags;
16}; 11};
17 12
18extern int __pata_platform_probe(struct device *dev, 13extern int __pata_platform_probe(struct device *dev,
diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h
index 4c7a4b2104bf..91b77f8d495d 100644
--- a/include/linux/atmel-mci.h
+++ b/include/linux/atmel-mci.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_ATMEL_MCI_H 1#ifndef __LINUX_ATMEL_MCI_H
2#define __LINUX_ATMEL_MCI_H 2#define __LINUX_ATMEL_MCI_H
3 3
4#include <linux/types.h>
5
4#define ATMCI_MAX_NR_SLOTS 2 6#define ATMCI_MAX_NR_SLOTS 2
5 7
6/** 8/**
diff --git a/include/linux/atmel-pwm-bl.h b/include/linux/atmel-pwm-bl.h
deleted file mode 100644
index 0153a47806c2..000000000000
--- a/include/linux/atmel-pwm-bl.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * Copyright (C) 2007 Atmel Corporation
3 *
4 * Driver for the AT32AP700X PS/2 controller (PSIF).
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10
11#ifndef __INCLUDE_ATMEL_PWM_BL_H
12#define __INCLUDE_ATMEL_PWM_BL_H
13
14/**
15 * struct atmel_pwm_bl_platform_data
16 * @pwm_channel: which PWM channel in the PWM module to use.
17 * @pwm_frequency: PWM frequency to generate, the driver will try to be as
18 * close as the prescaler allows.
19 * @pwm_compare_max: value to use in the PWM channel compare register.
20 * @pwm_duty_max: maximum duty cycle value, must be less than or equal to
21 * pwm_compare_max.
22 * @pwm_duty_min: minimum duty cycle value, must be less than pwm_duty_max.
23 * @pwm_active_low: set to one if the low part of the PWM signal increases the
24 * brightness of the backlight.
25 * @gpio_on: GPIO line to control the backlight on/off, set to -1 if not used.
26 * @on_active_low: set to one if the on/off signal is on when GPIO is low.
27 *
28 * This struct must be added to the platform device in the board code. It is
29 * used by the atmel-pwm-bl driver to setup the GPIO to control on/off and the
30 * PWM device.
31 */
32struct atmel_pwm_bl_platform_data {
33 unsigned int pwm_channel;
34 unsigned int pwm_frequency;
35 unsigned int pwm_compare_max;
36 unsigned int pwm_duty_max;
37 unsigned int pwm_duty_min;
38 unsigned int pwm_active_low;
39 int gpio_on;
40 unsigned int on_active_low;
41};
42
43#endif /* __INCLUDE_ATMEL_PWM_BL_H */
diff --git a/include/linux/atmel_pwm.h b/include/linux/atmel_pwm.h
deleted file mode 100644
index ea04abb3db8e..000000000000
--- a/include/linux/atmel_pwm.h
+++ /dev/null
@@ -1,70 +0,0 @@
1#ifndef __LINUX_ATMEL_PWM_H
2#define __LINUX_ATMEL_PWM_H
3
4/**
5 * struct pwm_channel - driver handle to a PWM channel
6 * @regs: base of this channel's registers
7 * @index: number of this channel (0..31)
8 * @mck: base clock rate, which can be prescaled and maybe subdivided
9 *
10 * Drivers initialize a pwm_channel structure using pwm_channel_alloc().
11 * Then they configure its clock rate (derived from MCK), alignment,
12 * polarity, and duty cycle by writing directly to the channel registers,
13 * before enabling the channel by calling pwm_channel_enable().
14 *
15 * After emitting a PWM signal for the desired length of time, drivers
16 * may then pwm_channel_disable() or pwm_channel_free(). Both of these
17 * disable the channel, but when it's freed the IRQ is deconfigured and
18 * the channel must later be re-allocated and reconfigured.
19 *
20 * Note that if the period or duty cycle need to be changed while the
21 * PWM channel is operating, drivers must use the PWM_CUPD double buffer
22 * mechanism, either polling until they change or getting implicitly
23 * notified through a once-per-period interrupt handler.
24 */
25struct pwm_channel {
26 void __iomem *regs;
27 unsigned index;
28 unsigned long mck;
29};
30
31extern int pwm_channel_alloc(int index, struct pwm_channel *ch);
32extern int pwm_channel_free(struct pwm_channel *ch);
33
34extern int pwm_clk_alloc(unsigned prescale, unsigned div);
35extern void pwm_clk_free(unsigned clk);
36
37extern int __pwm_channel_onoff(struct pwm_channel *ch, int enabled);
38
39#define pwm_channel_enable(ch) __pwm_channel_onoff((ch), 1)
40#define pwm_channel_disable(ch) __pwm_channel_onoff((ch), 0)
41
42/* periodic interrupts, mostly for CUPD changes to period or cycle */
43extern int pwm_channel_handler(struct pwm_channel *ch,
44 void (*handler)(struct pwm_channel *ch));
45
46/* per-channel registers (banked at pwm_channel->regs) */
47#define PWM_CMR 0x00 /* mode register */
48#define PWM_CPR_CPD (1 << 10) /* set: CUPD modifies period */
49#define PWM_CPR_CPOL (1 << 9) /* set: idle high */
50#define PWM_CPR_CALG (1 << 8) /* set: center align */
51#define PWM_CPR_CPRE (0xf << 0) /* mask: rate is mck/(2^pre) */
52#define PWM_CPR_CLKA (0xb << 0) /* rate CLKA */
53#define PWM_CPR_CLKB (0xc << 0) /* rate CLKB */
54#define PWM_CDTY 0x04 /* duty cycle (max of CPRD) */
55#define PWM_CPRD 0x08 /* period (count up from zero) */
56#define PWM_CCNT 0x0c /* counter (20 bits?) */
57#define PWM_CUPD 0x10 /* update CPRD (or CDTY) next period */
58
59static inline void
60pwm_channel_writel(struct pwm_channel *pwmc, unsigned offset, u32 val)
61{
62 __raw_writel(val, pwmc->regs + offset);
63}
64
65static inline u32 pwm_channel_readl(struct pwm_channel *pwmc, unsigned offset)
66{
67 return __raw_readl(pwmc->regs + offset);
68}
69
70#endif /* __LINUX_ATMEL_PWM_H */
diff --git a/include/linux/atmel_tc.h b/include/linux/atmel_tc.h
index 89a931babecf..b87c1c7c242a 100644
--- a/include/linux/atmel_tc.h
+++ b/include/linux/atmel_tc.h
@@ -44,12 +44,13 @@ struct atmel_tcb_config {
44/** 44/**
45 * struct atmel_tc - information about a Timer/Counter Block 45 * struct atmel_tc - information about a Timer/Counter Block
46 * @pdev: physical device 46 * @pdev: physical device
47 * @iomem: resource associated with the I/O register
48 * @regs: mapping through which the I/O registers can be accessed 47 * @regs: mapping through which the I/O registers can be accessed
48 * @id: block id
49 * @tcb_config: configuration data from SoC 49 * @tcb_config: configuration data from SoC
50 * @irq: irq for each of the three channels 50 * @irq: irq for each of the three channels
51 * @clk: internal clock source for each of the three channels 51 * @clk: internal clock source for each of the three channels
52 * @node: list node, for tclib internal use 52 * @node: list node, for tclib internal use
53 * @allocated: if already used, for tclib internal use
53 * 54 *
54 * On some platforms, each TC channel has its own clocks and IRQs, 55 * On some platforms, each TC channel has its own clocks and IRQs,
55 * while on others, all TC channels share the same clock and IRQ. 56 * while on others, all TC channels share the same clock and IRQ.
@@ -61,15 +62,16 @@ struct atmel_tcb_config {
61 */ 62 */
62struct atmel_tc { 63struct atmel_tc {
63 struct platform_device *pdev; 64 struct platform_device *pdev;
64 struct resource *iomem;
65 void __iomem *regs; 65 void __iomem *regs;
66 int id;
66 const struct atmel_tcb_config *tcb_config; 67 const struct atmel_tcb_config *tcb_config;
67 int irq[3]; 68 int irq[3];
68 struct clk *clk[3]; 69 struct clk *clk[3];
69 struct list_head node; 70 struct list_head node;
71 bool allocated;
70}; 72};
71 73
72extern struct atmel_tc *atmel_tc_alloc(unsigned block, const char *name); 74extern struct atmel_tc *atmel_tc_alloc(unsigned block);
73extern void atmel_tc_free(struct atmel_tc *tc); 75extern void atmel_tc_free(struct atmel_tc *tc);
74 76
75/* platform-specific ATMEL_TC_TIMER_CLOCKx divisors (0 means 32KiHz) */ 77/* platform-specific ATMEL_TC_TIMER_CLOCKx divisors (0 means 32KiHz) */
@@ -258,5 +260,10 @@ extern const u8 atmel_tc_divisors[5];
258#define ATMEL_TC_LDRAS (1 << 5) /* RA loading */ 260#define ATMEL_TC_LDRAS (1 << 5) /* RA loading */
259#define ATMEL_TC_LDRBS (1 << 6) /* RB loading */ 261#define ATMEL_TC_LDRBS (1 << 6) /* RB loading */
260#define ATMEL_TC_ETRGS (1 << 7) /* external trigger */ 262#define ATMEL_TC_ETRGS (1 << 7) /* external trigger */
263#define ATMEL_TC_ALL_IRQ (ATMEL_TC_COVFS | ATMEL_TC_LOVRS | \
264 ATMEL_TC_CPAS | ATMEL_TC_CPBS | \
265 ATMEL_TC_CPCS | ATMEL_TC_LDRAS | \
266 ATMEL_TC_LDRBS | ATMEL_TC_ETRGS) \
267 /* all IRQs */
261 268
262#endif 269#endif
diff --git a/include/linux/atomic.h b/include/linux/atomic.h
index fef3a809e7cf..5b08a8540ecf 100644
--- a/include/linux/atomic.h
+++ b/include/linux/atomic.h
@@ -3,42 +3,6 @@
3#define _LINUX_ATOMIC_H 3#define _LINUX_ATOMIC_H
4#include <asm/atomic.h> 4#include <asm/atomic.h>
5 5
6/*
7 * Provide __deprecated wrappers for the new interface, avoid flag day changes.
8 * We need the ugly external functions to break header recursion hell.
9 */
10#ifndef smp_mb__before_atomic_inc
11static inline void __deprecated smp_mb__before_atomic_inc(void)
12{
13 extern void __smp_mb__before_atomic(void);
14 __smp_mb__before_atomic();
15}
16#endif
17
18#ifndef smp_mb__after_atomic_inc
19static inline void __deprecated smp_mb__after_atomic_inc(void)
20{
21 extern void __smp_mb__after_atomic(void);
22 __smp_mb__after_atomic();
23}
24#endif
25
26#ifndef smp_mb__before_atomic_dec
27static inline void __deprecated smp_mb__before_atomic_dec(void)
28{
29 extern void __smp_mb__before_atomic(void);
30 __smp_mb__before_atomic();
31}
32#endif
33
34#ifndef smp_mb__after_atomic_dec
35static inline void __deprecated smp_mb__after_atomic_dec(void)
36{
37 extern void __smp_mb__after_atomic(void);
38 __smp_mb__after_atomic();
39}
40#endif
41
42/** 6/**
43 * atomic_add_unless - add unless the number is already a given value 7 * atomic_add_unless - add unless the number is already a given value
44 * @v: pointer of type atomic_t 8 * @v: pointer of type atomic_t
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 22cfddb75566..e58fe7df8b9c 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -66,12 +66,16 @@ struct audit_krule {
66 66
67struct audit_field { 67struct audit_field {
68 u32 type; 68 u32 type;
69 u32 val; 69 union {
70 kuid_t uid; 70 u32 val;
71 kgid_t gid; 71 kuid_t uid;
72 kgid_t gid;
73 struct {
74 char *lsm_str;
75 void *lsm_rule;
76 };
77 };
72 u32 op; 78 u32 op;
73 char *lsm_str;
74 void *lsm_rule;
75}; 79};
76 80
77extern int is_audit_feature_set(int which); 81extern int is_audit_feature_set(int which);
@@ -86,7 +90,7 @@ extern unsigned compat_dir_class[];
86extern unsigned compat_chattr_class[]; 90extern unsigned compat_chattr_class[];
87extern unsigned compat_signal_class[]; 91extern unsigned compat_signal_class[];
88 92
89extern int __weak audit_classify_compat_syscall(int abi, unsigned syscall); 93extern int audit_classify_compat_syscall(int abi, unsigned syscall);
90 94
91/* audit_names->type values */ 95/* audit_names->type values */
92#define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */ 96#define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */
@@ -109,12 +113,13 @@ extern void audit_log_session_info(struct audit_buffer *ab);
109#endif 113#endif
110 114
111#ifdef CONFIG_AUDITSYSCALL 115#ifdef CONFIG_AUDITSYSCALL
116#include <asm/syscall.h> /* for syscall_get_arch() */
117
112/* These are defined in auditsc.c */ 118/* These are defined in auditsc.c */
113 /* Public API */ 119 /* Public API */
114extern int audit_alloc(struct task_struct *task); 120extern int audit_alloc(struct task_struct *task);
115extern void __audit_free(struct task_struct *task); 121extern void __audit_free(struct task_struct *task);
116extern void __audit_syscall_entry(int arch, 122extern void __audit_syscall_entry(int major, unsigned long a0, unsigned long a1,
117 int major, unsigned long a0, unsigned long a1,
118 unsigned long a2, unsigned long a3); 123 unsigned long a2, unsigned long a3);
119extern void __audit_syscall_exit(int ret_success, long ret_value); 124extern void __audit_syscall_exit(int ret_success, long ret_value);
120extern struct filename *__audit_reusename(const __user char *uptr); 125extern struct filename *__audit_reusename(const __user char *uptr);
@@ -141,12 +146,12 @@ static inline void audit_free(struct task_struct *task)
141 if (unlikely(task->audit_context)) 146 if (unlikely(task->audit_context))
142 __audit_free(task); 147 __audit_free(task);
143} 148}
144static inline void audit_syscall_entry(int arch, int major, unsigned long a0, 149static inline void audit_syscall_entry(int major, unsigned long a0,
145 unsigned long a1, unsigned long a2, 150 unsigned long a1, unsigned long a2,
146 unsigned long a3) 151 unsigned long a3)
147{ 152{
148 if (unlikely(current->audit_context)) 153 if (unlikely(current->audit_context))
149 __audit_syscall_entry(arch, major, a0, a1, a2, a3); 154 __audit_syscall_entry(major, a0, a1, a2, a3);
150} 155}
151static inline void audit_syscall_exit(void *pt_regs) 156static inline void audit_syscall_exit(void *pt_regs)
152{ 157{
@@ -322,7 +327,7 @@ static inline int audit_alloc(struct task_struct *task)
322} 327}
323static inline void audit_free(struct task_struct *task) 328static inline void audit_free(struct task_struct *task)
324{ } 329{ }
325static inline void audit_syscall_entry(int arch, int major, unsigned long a0, 330static inline void audit_syscall_entry(int major, unsigned long a0,
326 unsigned long a1, unsigned long a2, 331 unsigned long a1, unsigned long a2,
327 unsigned long a3) 332 unsigned long a3)
328{ } 333{ }
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index e488e9459a93..5da6012b7a14 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -28,12 +28,10 @@ struct dentry;
28 * Bits in backing_dev_info.state 28 * Bits in backing_dev_info.state
29 */ 29 */
30enum bdi_state { 30enum bdi_state {
31 BDI_wb_alloc, /* Default embedded wb allocated */
32 BDI_async_congested, /* The async (write) queue is getting full */ 31 BDI_async_congested, /* The async (write) queue is getting full */
33 BDI_sync_congested, /* The sync queue is getting full */ 32 BDI_sync_congested, /* The sync queue is getting full */
34 BDI_registered, /* bdi_register() was done */ 33 BDI_registered, /* bdi_register() was done */
35 BDI_writeback_running, /* Writeback is in progress */ 34 BDI_writeback_running, /* Writeback is in progress */
36 BDI_unused, /* Available bits start here */
37}; 35};
38 36
39typedef int (congested_fn)(void *, int); 37typedef int (congested_fn)(void *, int);
@@ -50,7 +48,6 @@ enum bdi_stat_item {
50 48
51struct bdi_writeback { 49struct bdi_writeback {
52 struct backing_dev_info *bdi; /* our parent bdi */ 50 struct backing_dev_info *bdi; /* our parent bdi */
53 unsigned int nr;
54 51
55 unsigned long last_old_flush; /* last old data flush */ 52 unsigned long last_old_flush; /* last old data flush */
56 53
@@ -124,7 +121,6 @@ void bdi_start_background_writeback(struct backing_dev_info *bdi);
124void bdi_writeback_workfn(struct work_struct *work); 121void bdi_writeback_workfn(struct work_struct *work);
125int bdi_has_dirty_io(struct backing_dev_info *bdi); 122int bdi_has_dirty_io(struct backing_dev_info *bdi);
126void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi); 123void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi);
127void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2);
128 124
129extern spinlock_t bdi_lock; 125extern spinlock_t bdi_lock;
130extern struct list_head bdi_list; 126extern struct list_head bdi_list;
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index 089743ade734..9b0a15d06a4f 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -27,10 +27,13 @@
27 * counter raised only while it is under our special handling; 27 * counter raised only while it is under our special handling;
28 * 28 *
29 * iii. after the lockless scan step have selected a potential balloon page for 29 * iii. after the lockless scan step have selected a potential balloon page for
30 * isolation, re-test the page->mapping flags and the page ref counter 30 * isolation, re-test the PageBalloon mark and the PagePrivate flag
31 * under the proper page lock, to ensure isolating a valid balloon page 31 * under the proper page lock, to ensure isolating a valid balloon page
32 * (not yet isolated, nor under release procedure) 32 * (not yet isolated, nor under release procedure)
33 * 33 *
34 * iv. isolation or dequeueing procedure must clear PagePrivate flag under
35 * page lock together with removing page from balloon device page list.
36 *
34 * The functions provided by this interface are placed to help on coping with 37 * The functions provided by this interface are placed to help on coping with
35 * the aforementioned balloon page corner case, as well as to ensure the simple 38 * the aforementioned balloon page corner case, as well as to ensure the simple
36 * set of exposed rules are satisfied while we are dealing with balloon pages 39 * set of exposed rules are satisfied while we are dealing with balloon pages
@@ -54,43 +57,22 @@
54 * balloon driver as a page book-keeper for its registered balloon devices. 57 * balloon driver as a page book-keeper for its registered balloon devices.
55 */ 58 */
56struct balloon_dev_info { 59struct balloon_dev_info {
57 void *balloon_device; /* balloon device descriptor */
58 struct address_space *mapping; /* balloon special page->mapping */
59 unsigned long isolated_pages; /* # of isolated pages for migration */ 60 unsigned long isolated_pages; /* # of isolated pages for migration */
60 spinlock_t pages_lock; /* Protection to pages list */ 61 spinlock_t pages_lock; /* Protection to pages list */
61 struct list_head pages; /* Pages enqueued & handled to Host */ 62 struct list_head pages; /* Pages enqueued & handled to Host */
63 int (*migratepage)(struct balloon_dev_info *, struct page *newpage,
64 struct page *page, enum migrate_mode mode);
62}; 65};
63 66
64extern struct page *balloon_page_enqueue(struct balloon_dev_info *b_dev_info); 67extern struct page *balloon_page_enqueue(struct balloon_dev_info *b_dev_info);
65extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info); 68extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info);
66extern struct balloon_dev_info *balloon_devinfo_alloc(
67 void *balloon_dev_descriptor);
68 69
69static inline void balloon_devinfo_free(struct balloon_dev_info *b_dev_info) 70static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
70{
71 kfree(b_dev_info);
72}
73
74/*
75 * balloon_page_free - release a balloon page back to the page free lists
76 * @page: ballooned page to be set free
77 *
78 * This function must be used to properly set free an isolated/dequeued balloon
79 * page at the end of a sucessful page migration, or at the balloon driver's
80 * page release procedure.
81 */
82static inline void balloon_page_free(struct page *page)
83{ 71{
84 /* 72 balloon->isolated_pages = 0;
85 * Balloon pages always get an extra refcount before being isolated 73 spin_lock_init(&balloon->pages_lock);
86 * and before being dequeued to help on sorting out fortuite colisions 74 INIT_LIST_HEAD(&balloon->pages);
87 * between a thread attempting to isolate and another thread attempting 75 balloon->migratepage = NULL;
88 * to release the very same balloon page.
89 *
90 * Before we handle the page back to Buddy, lets drop its extra refcnt.
91 */
92 put_page(page);
93 __free_page(page);
94} 76}
95 77
96#ifdef CONFIG_BALLOON_COMPACTION 78#ifdef CONFIG_BALLOON_COMPACTION
@@ -98,107 +80,58 @@ extern bool balloon_page_isolate(struct page *page);
98extern void balloon_page_putback(struct page *page); 80extern void balloon_page_putback(struct page *page);
99extern int balloon_page_migrate(struct page *newpage, 81extern int balloon_page_migrate(struct page *newpage,
100 struct page *page, enum migrate_mode mode); 82 struct page *page, enum migrate_mode mode);
101extern struct address_space
102*balloon_mapping_alloc(struct balloon_dev_info *b_dev_info,
103 const struct address_space_operations *a_ops);
104
105static inline void balloon_mapping_free(struct address_space *balloon_mapping)
106{
107 kfree(balloon_mapping);
108}
109 83
110/* 84/*
111 * page_flags_cleared - helper to perform balloon @page ->flags tests. 85 * __is_movable_balloon_page - helper to perform @page PageBalloon tests
112 *
113 * As balloon pages are obtained from buddy and we do not play with page->flags
114 * at driver level (exception made when we get the page lock for compaction),
115 * we can safely identify a ballooned page by checking if the
116 * PAGE_FLAGS_CHECK_AT_PREP page->flags are all cleared. This approach also
117 * helps us skip ballooned pages that are locked for compaction or release, thus
118 * mitigating their racy check at balloon_page_movable()
119 */
120static inline bool page_flags_cleared(struct page *page)
121{
122 return !(page->flags & PAGE_FLAGS_CHECK_AT_PREP);
123}
124
125/*
126 * __is_movable_balloon_page - helper to perform @page mapping->flags tests
127 */ 86 */
128static inline bool __is_movable_balloon_page(struct page *page) 87static inline bool __is_movable_balloon_page(struct page *page)
129{ 88{
130 struct address_space *mapping = page->mapping; 89 return PageBalloon(page);
131 return mapping_balloon(mapping);
132} 90}
133 91
134/* 92/*
135 * balloon_page_movable - test page->mapping->flags to identify balloon pages 93 * balloon_page_movable - test PageBalloon to identify balloon pages
136 * that can be moved by compaction/migration. 94 * and PagePrivate to check that the page is not
137 * 95 * isolated and can be moved by compaction/migration.
138 * This function is used at core compaction's page isolation scheme, therefore
139 * most pages exposed to it are not enlisted as balloon pages and so, to avoid
140 * undesired side effects like racing against __free_pages(), we cannot afford
141 * holding the page locked while testing page->mapping->flags here.
142 * 96 *
143 * As we might return false positives in the case of a balloon page being just 97 * As we might return false positives in the case of a balloon page being just
144 * released under us, the page->mapping->flags need to be re-tested later, 98 * released under us, this need to be re-tested later, under the page lock.
145 * under the proper page lock, at the functions that will be coping with the
146 * balloon page case.
147 */ 99 */
148static inline bool balloon_page_movable(struct page *page) 100static inline bool balloon_page_movable(struct page *page)
149{ 101{
150 /* 102 return PageBalloon(page) && PagePrivate(page);
151 * Before dereferencing and testing mapping->flags, let's make sure
152 * this is not a page that uses ->mapping in a different way
153 */
154 if (page_flags_cleared(page) && !page_mapped(page) &&
155 page_count(page) == 1)
156 return __is_movable_balloon_page(page);
157
158 return false;
159} 103}
160 104
161/* 105/*
162 * isolated_balloon_page - identify an isolated balloon page on private 106 * isolated_balloon_page - identify an isolated balloon page on private
163 * compaction/migration page lists. 107 * compaction/migration page lists.
164 *
165 * After a compaction thread isolates a balloon page for migration, it raises
166 * the page refcount to prevent concurrent compaction threads from re-isolating
167 * the same page. For that reason putback_movable_pages(), or other routines
168 * that need to identify isolated balloon pages on private pagelists, cannot
169 * rely on balloon_page_movable() to accomplish the task.
170 */ 108 */
171static inline bool isolated_balloon_page(struct page *page) 109static inline bool isolated_balloon_page(struct page *page)
172{ 110{
173 /* Already isolated balloon pages, by default, have a raised refcount */ 111 return PageBalloon(page);
174 if (page_flags_cleared(page) && !page_mapped(page) &&
175 page_count(page) >= 2)
176 return __is_movable_balloon_page(page);
177
178 return false;
179} 112}
180 113
181/* 114/*
182 * balloon_page_insert - insert a page into the balloon's page list and make 115 * balloon_page_insert - insert a page into the balloon's page list and make
183 * the page->mapping assignment accordingly. 116 * the page->private assignment accordingly.
117 * @balloon : pointer to balloon device
184 * @page : page to be assigned as a 'balloon page' 118 * @page : page to be assigned as a 'balloon page'
185 * @mapping : allocated special 'balloon_mapping'
186 * @head : balloon's device page list head
187 * 119 *
188 * Caller must ensure the page is locked and the spin_lock protecting balloon 120 * Caller must ensure the page is locked and the spin_lock protecting balloon
189 * pages list is held before inserting a page into the balloon device. 121 * pages list is held before inserting a page into the balloon device.
190 */ 122 */
191static inline void balloon_page_insert(struct page *page, 123static inline void balloon_page_insert(struct balloon_dev_info *balloon,
192 struct address_space *mapping, 124 struct page *page)
193 struct list_head *head)
194{ 125{
195 page->mapping = mapping; 126 __SetPageBalloon(page);
196 list_add(&page->lru, head); 127 SetPagePrivate(page);
128 set_page_private(page, (unsigned long)balloon);
129 list_add(&page->lru, &balloon->pages);
197} 130}
198 131
199/* 132/*
200 * balloon_page_delete - delete a page from balloon's page list and clear 133 * balloon_page_delete - delete a page from balloon's page list and clear
201 * the page->mapping assignement accordingly. 134 * the page->private assignement accordingly.
202 * @page : page to be released from balloon's page list 135 * @page : page to be released from balloon's page list
203 * 136 *
204 * Caller must ensure the page is locked and the spin_lock protecting balloon 137 * Caller must ensure the page is locked and the spin_lock protecting balloon
@@ -206,8 +139,12 @@ static inline void balloon_page_insert(struct page *page,
206 */ 139 */
207static inline void balloon_page_delete(struct page *page) 140static inline void balloon_page_delete(struct page *page)
208{ 141{
209 page->mapping = NULL; 142 __ClearPageBalloon(page);
210 list_del(&page->lru); 143 set_page_private(page, 0);
144 if (PagePrivate(page)) {
145 ClearPagePrivate(page);
146 list_del(&page->lru);
147 }
211} 148}
212 149
213/* 150/*
@@ -216,11 +153,7 @@ static inline void balloon_page_delete(struct page *page)
216 */ 153 */
217static inline struct balloon_dev_info *balloon_page_device(struct page *page) 154static inline struct balloon_dev_info *balloon_page_device(struct page *page)
218{ 155{
219 struct address_space *mapping = page->mapping; 156 return (struct balloon_dev_info *)page_private(page);
220 if (likely(mapping))
221 return mapping->private_data;
222
223 return NULL;
224} 157}
225 158
226static inline gfp_t balloon_mapping_gfp_mask(void) 159static inline gfp_t balloon_mapping_gfp_mask(void)
@@ -228,34 +161,24 @@ static inline gfp_t balloon_mapping_gfp_mask(void)
228 return GFP_HIGHUSER_MOVABLE; 161 return GFP_HIGHUSER_MOVABLE;
229} 162}
230 163
231static inline bool balloon_compaction_check(void)
232{
233 return true;
234}
235
236#else /* !CONFIG_BALLOON_COMPACTION */ 164#else /* !CONFIG_BALLOON_COMPACTION */
237 165
238static inline void *balloon_mapping_alloc(void *balloon_device, 166static inline void balloon_page_insert(struct balloon_dev_info *balloon,
239 const struct address_space_operations *a_ops) 167 struct page *page)
240{
241 return ERR_PTR(-EOPNOTSUPP);
242}
243
244static inline void balloon_mapping_free(struct address_space *balloon_mapping)
245{ 168{
246 return; 169 __SetPageBalloon(page);
170 list_add(&page->lru, &balloon->pages);
247} 171}
248 172
249static inline void balloon_page_insert(struct page *page, 173static inline void balloon_page_delete(struct page *page)
250 struct address_space *mapping,
251 struct list_head *head)
252{ 174{
253 list_add(&page->lru, head); 175 __ClearPageBalloon(page);
176 list_del(&page->lru);
254} 177}
255 178
256static inline void balloon_page_delete(struct page *page) 179static inline bool __is_movable_balloon_page(struct page *page)
257{ 180{
258 list_del(&page->lru); 181 return false;
259} 182}
260 183
261static inline bool balloon_page_movable(struct page *page) 184static inline bool balloon_page_movable(struct page *page)
@@ -289,9 +212,5 @@ static inline gfp_t balloon_mapping_gfp_mask(void)
289 return GFP_HIGHUSER; 212 return GFP_HIGHUSER;
290} 213}
291 214
292static inline bool balloon_compaction_check(void)
293{
294 return false;
295}
296#endif /* CONFIG_BALLOON_COMPACTION */ 215#endif /* CONFIG_BALLOON_COMPACTION */
297#endif /* _LINUX_BALLOON_COMPACTION_H */ 216#endif /* _LINUX_BALLOON_COMPACTION_H */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 0272e49135d0..729f48e6b20b 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -267,7 +267,7 @@ struct bcma_device {
267 u8 core_unit; 267 u8 core_unit;
268 268
269 u32 addr; 269 u32 addr;
270 u32 addr1; 270 u32 addr_s[8];
271 u32 wrap; 271 u32 wrap;
272 272
273 void __iomem *io_addr; 273 void __iomem *io_addr;
@@ -323,6 +323,8 @@ struct bcma_bus {
323 struct pci_dev *host_pci; 323 struct pci_dev *host_pci;
324 /* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */ 324 /* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */
325 struct sdio_func *host_sdio; 325 struct sdio_func *host_sdio;
326 /* Pointer to platform device (only for BCMA_HOSTTYPE_SOC) */
327 struct platform_device *host_pdev;
326 }; 328 };
327 329
328 struct bcma_chipinfo chipinfo; 330 struct bcma_chipinfo chipinfo;
@@ -332,10 +334,10 @@ struct bcma_bus {
332 struct bcma_device *mapped_core; 334 struct bcma_device *mapped_core;
333 struct list_head cores; 335 struct list_head cores;
334 u8 nr_cores; 336 u8 nr_cores;
335 u8 init_done:1;
336 u8 num; 337 u8 num;
337 338
338 struct bcma_drv_cc drv_cc; 339 struct bcma_drv_cc drv_cc;
340 struct bcma_drv_cc_b drv_cc_b;
339 struct bcma_drv_pci drv_pci[2]; 341 struct bcma_drv_pci drv_pci[2];
340 struct bcma_drv_pcie2 drv_pcie2; 342 struct bcma_drv_pcie2 drv_pcie2;
341 struct bcma_drv_mips drv_mips; 343 struct bcma_drv_mips drv_mips;
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 63d105cd14a3..db6fa217f98b 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -644,6 +644,12 @@ struct bcma_drv_cc {
644#endif 644#endif
645}; 645};
646 646
647struct bcma_drv_cc_b {
648 struct bcma_device *core;
649 u8 setup_done:1;
650 void __iomem *mii;
651};
652
647/* Register access */ 653/* Register access */
648#define bcma_cc_read32(cc, offset) \ 654#define bcma_cc_read32(cc, offset) \
649 bcma_read32((cc)->core, offset) 655 bcma_read32((cc)->core, offset)
@@ -699,4 +705,6 @@ extern void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid);
699 705
700extern u32 bcma_pmu_get_bus_clock(struct bcma_drv_cc *cc); 706extern u32 bcma_pmu_get_bus_clock(struct bcma_drv_cc *cc);
701 707
708void bcma_chipco_b_mii_write(struct bcma_drv_cc_b *ccb, u32 offset, u32 value);
709
702#endif /* LINUX_BCMA_DRIVER_CC_H_ */ 710#endif /* LINUX_BCMA_DRIVER_CC_H_ */
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h
index 917dcd7965e7..e64ae7bf80a1 100644
--- a/include/linux/bcma/bcma_regs.h
+++ b/include/linux/bcma/bcma_regs.h
@@ -39,6 +39,11 @@
39#define BCMA_RESET_CTL_RESET 0x0001 39#define BCMA_RESET_CTL_RESET 0x0001
40#define BCMA_RESET_ST 0x0804 40#define BCMA_RESET_ST 0x0804
41 41
42#define BCMA_NS_ROM_IOST_BOOT_DEV_MASK 0x0003
43#define BCMA_NS_ROM_IOST_BOOT_DEV_NOR 0x0000
44#define BCMA_NS_ROM_IOST_BOOT_DEV_NAND 0x0001
45#define BCMA_NS_ROM_IOST_BOOT_DEV_ROM 0x0002
46
42/* BCMA PCI config space registers. */ 47/* BCMA PCI config space registers. */
43#define BCMA_PCI_PMCSR 0x44 48#define BCMA_PCI_PMCSR 0x44
44#define BCMA_PCI_PE 0x100 49#define BCMA_PCI_PE 0x100
diff --git a/include/linux/bcma/bcma_soc.h b/include/linux/bcma/bcma_soc.h
index 4203c5593b9f..f24d245f8394 100644
--- a/include/linux/bcma/bcma_soc.h
+++ b/include/linux/bcma/bcma_soc.h
@@ -10,6 +10,7 @@ struct bcma_soc {
10}; 10};
11 11
12int __init bcma_host_soc_register(struct bcma_soc *soc); 12int __init bcma_host_soc_register(struct bcma_soc *soc);
13int __init bcma_host_soc_init(struct bcma_soc *soc);
13 14
14int bcma_bus_register(struct bcma_bus *bus); 15int bcma_bus_register(struct bcma_bus *bus);
15 16
diff --git a/include/linux/bio.h b/include/linux/bio.h
index d2633ee099d9..7347f486ceca 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -292,7 +292,24 @@ static inline unsigned bio_segments(struct bio *bio)
292 */ 292 */
293#define bio_get(bio) atomic_inc(&(bio)->bi_cnt) 293#define bio_get(bio) atomic_inc(&(bio)->bi_cnt)
294 294
295enum bip_flags {
296 BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */
297 BIP_MAPPED_INTEGRITY = 1 << 1, /* ref tag has been remapped */
298 BIP_CTRL_NOCHECK = 1 << 2, /* disable HBA integrity checking */
299 BIP_DISK_NOCHECK = 1 << 3, /* disable disk integrity checking */
300 BIP_IP_CHECKSUM = 1 << 4, /* IP checksum */
301};
302
295#if defined(CONFIG_BLK_DEV_INTEGRITY) 303#if defined(CONFIG_BLK_DEV_INTEGRITY)
304
305static inline struct bio_integrity_payload *bio_integrity(struct bio *bio)
306{
307 if (bio->bi_rw & REQ_INTEGRITY)
308 return bio->bi_integrity;
309
310 return NULL;
311}
312
296/* 313/*
297 * bio integrity payload 314 * bio integrity payload
298 */ 315 */
@@ -301,20 +318,40 @@ struct bio_integrity_payload {
301 318
302 struct bvec_iter bip_iter; 319 struct bvec_iter bip_iter;
303 320
304 /* kill - should just use bip_vec */
305 void *bip_buf; /* generated integrity data */
306
307 bio_end_io_t *bip_end_io; /* saved I/O completion fn */ 321 bio_end_io_t *bip_end_io; /* saved I/O completion fn */
308 322
309 unsigned short bip_slab; /* slab the bip came from */ 323 unsigned short bip_slab; /* slab the bip came from */
310 unsigned short bip_vcnt; /* # of integrity bio_vecs */ 324 unsigned short bip_vcnt; /* # of integrity bio_vecs */
311 unsigned bip_owns_buf:1; /* should free bip_buf */ 325 unsigned short bip_max_vcnt; /* integrity bio_vec slots */
326 unsigned short bip_flags; /* control flags */
312 327
313 struct work_struct bip_work; /* I/O completion */ 328 struct work_struct bip_work; /* I/O completion */
314 329
315 struct bio_vec *bip_vec; 330 struct bio_vec *bip_vec;
316 struct bio_vec bip_inline_vecs[0];/* embedded bvec array */ 331 struct bio_vec bip_inline_vecs[0];/* embedded bvec array */
317}; 332};
333
334static inline bool bio_integrity_flagged(struct bio *bio, enum bip_flags flag)
335{
336 struct bio_integrity_payload *bip = bio_integrity(bio);
337
338 if (bip)
339 return bip->bip_flags & flag;
340
341 return false;
342}
343
344static inline sector_t bip_get_seed(struct bio_integrity_payload *bip)
345{
346 return bip->bip_iter.bi_sector;
347}
348
349static inline void bip_set_seed(struct bio_integrity_payload *bip,
350 sector_t seed)
351{
352 bip->bip_iter.bi_sector = seed;
353}
354
318#endif /* CONFIG_BLK_DEV_INTEGRITY */ 355#endif /* CONFIG_BLK_DEV_INTEGRITY */
319 356
320extern void bio_trim(struct bio *bio, int offset, int size); 357extern void bio_trim(struct bio *bio, int offset, int size);
@@ -341,6 +378,7 @@ static inline struct bio *bio_next_split(struct bio *bio, int sectors,
341} 378}
342 379
343extern struct bio_set *bioset_create(unsigned int, unsigned int); 380extern struct bio_set *bioset_create(unsigned int, unsigned int);
381extern struct bio_set *bioset_create_nobvec(unsigned int, unsigned int);
344extern void bioset_free(struct bio_set *); 382extern void bioset_free(struct bio_set *);
345extern mempool_t *biovec_create_pool(int pool_entries); 383extern mempool_t *biovec_create_pool(int pool_entries);
346 384
@@ -352,7 +390,6 @@ extern struct bio *bio_clone_fast(struct bio *, gfp_t, struct bio_set *);
352extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs); 390extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs);
353 391
354extern struct bio_set *fs_bio_set; 392extern struct bio_set *fs_bio_set;
355unsigned int bio_integrity_tag_size(struct bio *bio);
356 393
357static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs) 394static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs)
358{ 395{
@@ -660,14 +697,10 @@ struct biovec_slab {
660 for_each_bio(_bio) \ 697 for_each_bio(_bio) \
661 bip_for_each_vec(_bvl, _bio->bi_integrity, _iter) 698 bip_for_each_vec(_bvl, _bio->bi_integrity, _iter)
662 699
663#define bio_integrity(bio) (bio->bi_integrity != NULL)
664
665extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); 700extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int);
666extern void bio_integrity_free(struct bio *); 701extern void bio_integrity_free(struct bio *);
667extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); 702extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int);
668extern int bio_integrity_enabled(struct bio *bio); 703extern bool bio_integrity_enabled(struct bio *bio);
669extern int bio_integrity_set_tag(struct bio *, void *, unsigned int);
670extern int bio_integrity_get_tag(struct bio *, void *, unsigned int);
671extern int bio_integrity_prep(struct bio *); 704extern int bio_integrity_prep(struct bio *);
672extern void bio_integrity_endio(struct bio *, int); 705extern void bio_integrity_endio(struct bio *, int);
673extern void bio_integrity_advance(struct bio *, unsigned int); 706extern void bio_integrity_advance(struct bio *, unsigned int);
@@ -679,14 +712,14 @@ extern void bio_integrity_init(void);
679 712
680#else /* CONFIG_BLK_DEV_INTEGRITY */ 713#else /* CONFIG_BLK_DEV_INTEGRITY */
681 714
682static inline int bio_integrity(struct bio *bio) 715static inline void *bio_integrity(struct bio *bio)
683{ 716{
684 return 0; 717 return NULL;
685} 718}
686 719
687static inline int bio_integrity_enabled(struct bio *bio) 720static inline bool bio_integrity_enabled(struct bio *bio)
688{ 721{
689 return 0; 722 return false;
690} 723}
691 724
692static inline int bioset_integrity_create(struct bio_set *bs, int pool_size) 725static inline int bioset_integrity_create(struct bio_set *bs, int pool_size)
@@ -732,6 +765,11 @@ static inline void bio_integrity_init(void)
732 return; 765 return;
733} 766}
734 767
768static inline bool bio_integrity_flagged(struct bio *bio, enum bip_flags flag)
769{
770 return false;
771}
772
735#endif /* CONFIG_BLK_DEV_INTEGRITY */ 773#endif /* CONFIG_BLK_DEV_INTEGRITY */
736 774
737#endif /* CONFIG_BLOCK */ 775#endif /* CONFIG_BLOCK */
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 7ad634501e48..e1c8d080c427 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -88,32 +88,32 @@
88 * lib/bitmap.c provides these functions: 88 * lib/bitmap.c provides these functions:
89 */ 89 */
90 90
91extern int __bitmap_empty(const unsigned long *bitmap, int bits); 91extern int __bitmap_empty(const unsigned long *bitmap, unsigned int nbits);
92extern int __bitmap_full(const unsigned long *bitmap, int bits); 92extern int __bitmap_full(const unsigned long *bitmap, unsigned int nbits);
93extern int __bitmap_equal(const unsigned long *bitmap1, 93extern int __bitmap_equal(const unsigned long *bitmap1,
94 const unsigned long *bitmap2, int bits); 94 const unsigned long *bitmap2, unsigned int nbits);
95extern void __bitmap_complement(unsigned long *dst, const unsigned long *src, 95extern void __bitmap_complement(unsigned long *dst, const unsigned long *src,
96 int bits); 96 unsigned int nbits);
97extern void __bitmap_shift_right(unsigned long *dst, 97extern void __bitmap_shift_right(unsigned long *dst,
98 const unsigned long *src, int shift, int bits); 98 const unsigned long *src, int shift, int bits);
99extern void __bitmap_shift_left(unsigned long *dst, 99extern void __bitmap_shift_left(unsigned long *dst,
100 const unsigned long *src, int shift, int bits); 100 const unsigned long *src, int shift, int bits);
101extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, 101extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
102 const unsigned long *bitmap2, int bits); 102 const unsigned long *bitmap2, unsigned int nbits);
103extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, 103extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
104 const unsigned long *bitmap2, int bits); 104 const unsigned long *bitmap2, unsigned int nbits);
105extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, 105extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
106 const unsigned long *bitmap2, int bits); 106 const unsigned long *bitmap2, unsigned int nbits);
107extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, 107extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
108 const unsigned long *bitmap2, int bits); 108 const unsigned long *bitmap2, unsigned int nbits);
109extern int __bitmap_intersects(const unsigned long *bitmap1, 109extern int __bitmap_intersects(const unsigned long *bitmap1,
110 const unsigned long *bitmap2, int bits); 110 const unsigned long *bitmap2, unsigned int nbits);
111extern int __bitmap_subset(const unsigned long *bitmap1, 111extern int __bitmap_subset(const unsigned long *bitmap1,
112 const unsigned long *bitmap2, int bits); 112 const unsigned long *bitmap2, unsigned int nbits);
113extern int __bitmap_weight(const unsigned long *bitmap, int bits); 113extern int __bitmap_weight(const unsigned long *bitmap, unsigned int nbits);
114 114
115extern void bitmap_set(unsigned long *map, int i, int len); 115extern void bitmap_set(unsigned long *map, unsigned int start, int len);
116extern void bitmap_clear(unsigned long *map, int start, int nr); 116extern void bitmap_clear(unsigned long *map, unsigned int start, int len);
117extern unsigned long bitmap_find_next_zero_area(unsigned long *map, 117extern unsigned long bitmap_find_next_zero_area(unsigned long *map,
118 unsigned long size, 118 unsigned long size,
119 unsigned long start, 119 unsigned long start,
@@ -140,9 +140,9 @@ extern void bitmap_onto(unsigned long *dst, const unsigned long *orig,
140 const unsigned long *relmap, int bits); 140 const unsigned long *relmap, int bits);
141extern void bitmap_fold(unsigned long *dst, const unsigned long *orig, 141extern void bitmap_fold(unsigned long *dst, const unsigned long *orig,
142 int sz, int bits); 142 int sz, int bits);
143extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); 143extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order);
144extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); 144extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order);
145extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); 145extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order);
146extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); 146extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits);
147extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits); 147extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits);
148 148
@@ -188,15 +188,15 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
188} 188}
189 189
190static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, 190static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
191 const unsigned long *src2, int nbits) 191 const unsigned long *src2, unsigned int nbits)
192{ 192{
193 if (small_const_nbits(nbits)) 193 if (small_const_nbits(nbits))
194 return (*dst = *src1 & *src2) != 0; 194 return (*dst = *src1 & *src2 & BITMAP_LAST_WORD_MASK(nbits)) != 0;
195 return __bitmap_and(dst, src1, src2, nbits); 195 return __bitmap_and(dst, src1, src2, nbits);
196} 196}
197 197
198static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, 198static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
199 const unsigned long *src2, int nbits) 199 const unsigned long *src2, unsigned int nbits)
200{ 200{
201 if (small_const_nbits(nbits)) 201 if (small_const_nbits(nbits))
202 *dst = *src1 | *src2; 202 *dst = *src1 | *src2;
@@ -205,7 +205,7 @@ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
205} 205}
206 206
207static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, 207static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
208 const unsigned long *src2, int nbits) 208 const unsigned long *src2, unsigned int nbits)
209{ 209{
210 if (small_const_nbits(nbits)) 210 if (small_const_nbits(nbits))
211 *dst = *src1 ^ *src2; 211 *dst = *src1 ^ *src2;
@@ -214,24 +214,24 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
214} 214}
215 215
216static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1, 216static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1,
217 const unsigned long *src2, int nbits) 217 const unsigned long *src2, unsigned int nbits)
218{ 218{
219 if (small_const_nbits(nbits)) 219 if (small_const_nbits(nbits))
220 return (*dst = *src1 & ~(*src2)) != 0; 220 return (*dst = *src1 & ~(*src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
221 return __bitmap_andnot(dst, src1, src2, nbits); 221 return __bitmap_andnot(dst, src1, src2, nbits);
222} 222}
223 223
224static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, 224static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
225 int nbits) 225 unsigned int nbits)
226{ 226{
227 if (small_const_nbits(nbits)) 227 if (small_const_nbits(nbits))
228 *dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits); 228 *dst = ~(*src);
229 else 229 else
230 __bitmap_complement(dst, src, nbits); 230 __bitmap_complement(dst, src, nbits);
231} 231}
232 232
233static inline int bitmap_equal(const unsigned long *src1, 233static inline int bitmap_equal(const unsigned long *src1,
234 const unsigned long *src2, int nbits) 234 const unsigned long *src2, unsigned int nbits)
235{ 235{
236 if (small_const_nbits(nbits)) 236 if (small_const_nbits(nbits))
237 return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits)); 237 return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
@@ -240,7 +240,7 @@ static inline int bitmap_equal(const unsigned long *src1,
240} 240}
241 241
242static inline int bitmap_intersects(const unsigned long *src1, 242static inline int bitmap_intersects(const unsigned long *src1,
243 const unsigned long *src2, int nbits) 243 const unsigned long *src2, unsigned int nbits)
244{ 244{
245 if (small_const_nbits(nbits)) 245 if (small_const_nbits(nbits))
246 return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0; 246 return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
@@ -249,7 +249,7 @@ static inline int bitmap_intersects(const unsigned long *src1,
249} 249}
250 250
251static inline int bitmap_subset(const unsigned long *src1, 251static inline int bitmap_subset(const unsigned long *src1,
252 const unsigned long *src2, int nbits) 252 const unsigned long *src2, unsigned int nbits)
253{ 253{
254 if (small_const_nbits(nbits)) 254 if (small_const_nbits(nbits))
255 return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits)); 255 return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits));
@@ -257,7 +257,7 @@ static inline int bitmap_subset(const unsigned long *src1,
257 return __bitmap_subset(src1, src2, nbits); 257 return __bitmap_subset(src1, src2, nbits);
258} 258}
259 259
260static inline int bitmap_empty(const unsigned long *src, int nbits) 260static inline int bitmap_empty(const unsigned long *src, unsigned nbits)
261{ 261{
262 if (small_const_nbits(nbits)) 262 if (small_const_nbits(nbits))
263 return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); 263 return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
@@ -265,7 +265,7 @@ static inline int bitmap_empty(const unsigned long *src, int nbits)
265 return __bitmap_empty(src, nbits); 265 return __bitmap_empty(src, nbits);
266} 266}
267 267
268static inline int bitmap_full(const unsigned long *src, int nbits) 268static inline int bitmap_full(const unsigned long *src, unsigned int nbits)
269{ 269{
270 if (small_const_nbits(nbits)) 270 if (small_const_nbits(nbits))
271 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); 271 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
@@ -273,7 +273,7 @@ static inline int bitmap_full(const unsigned long *src, int nbits)
273 return __bitmap_full(src, nbits); 273 return __bitmap_full(src, nbits);
274} 274}
275 275
276static inline int bitmap_weight(const unsigned long *src, int nbits) 276static inline int bitmap_weight(const unsigned long *src, unsigned int nbits)
277{ 277{
278 if (small_const_nbits(nbits)) 278 if (small_const_nbits(nbits))
279 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); 279 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits));
@@ -284,7 +284,7 @@ static inline void bitmap_shift_right(unsigned long *dst,
284 const unsigned long *src, int n, int nbits) 284 const unsigned long *src, int n, int nbits)
285{ 285{
286 if (small_const_nbits(nbits)) 286 if (small_const_nbits(nbits))
287 *dst = *src >> n; 287 *dst = (*src & BITMAP_LAST_WORD_MASK(nbits)) >> n;
288 else 288 else
289 __bitmap_shift_right(dst, src, n, nbits); 289 __bitmap_shift_right(dst, src, n, nbits);
290} 290}
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index cbc5833fb221..be5fd38bd5a0 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -32,26 +32,6 @@ extern unsigned long __sw_hweight64(__u64 w);
32 */ 32 */
33#include <asm/bitops.h> 33#include <asm/bitops.h>
34 34
35/*
36 * Provide __deprecated wrappers for the new interface, avoid flag day changes.
37 * We need the ugly external functions to break header recursion hell.
38 */
39#ifndef smp_mb__before_clear_bit
40static inline void __deprecated smp_mb__before_clear_bit(void)
41{
42 extern void __smp_mb__before_atomic(void);
43 __smp_mb__before_atomic();
44}
45#endif
46
47#ifndef smp_mb__after_clear_bit
48static inline void __deprecated smp_mb__after_clear_bit(void)
49{
50 extern void __smp_mb__after_atomic(void);
51 __smp_mb__after_atomic();
52}
53#endif
54
55#define for_each_set_bit(bit, addr, size) \ 35#define for_each_set_bit(bit, addr, size) \
56 for ((bit) = find_first_bit((addr), (size)); \ 36 for ((bit) = find_first_bit((addr), (size)); \
57 (bit) < (size); \ 37 (bit) < (size); \
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index eb726b9c5762..c9be1589415a 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -4,6 +4,7 @@
4#include <linux/blkdev.h> 4#include <linux/blkdev.h>
5 5
6struct blk_mq_tags; 6struct blk_mq_tags;
7struct blk_flush_queue;
7 8
8struct blk_mq_cpu_notifier { 9struct blk_mq_cpu_notifier {
9 struct list_head list; 10 struct list_head list;
@@ -34,6 +35,7 @@ struct blk_mq_hw_ctx {
34 35
35 struct request_queue *queue; 36 struct request_queue *queue;
36 unsigned int queue_num; 37 unsigned int queue_num;
38 struct blk_flush_queue *fq;
37 39
38 void *driver_data; 40 void *driver_data;
39 41
@@ -77,8 +79,9 @@ struct blk_mq_tag_set {
77 struct list_head tag_list; 79 struct list_head tag_list;
78}; 80};
79 81
80typedef int (queue_rq_fn)(struct blk_mq_hw_ctx *, struct request *); 82typedef int (queue_rq_fn)(struct blk_mq_hw_ctx *, struct request *, bool);
81typedef struct blk_mq_hw_ctx *(map_queue_fn)(struct request_queue *, const int); 83typedef struct blk_mq_hw_ctx *(map_queue_fn)(struct request_queue *, const int);
84typedef enum blk_eh_timer_return (timeout_fn)(struct request *, bool);
82typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int); 85typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int);
83typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int); 86typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int);
84typedef int (init_request_fn)(void *, struct request *, unsigned int, 87typedef int (init_request_fn)(void *, struct request *, unsigned int,
@@ -86,6 +89,9 @@ typedef int (init_request_fn)(void *, struct request *, unsigned int,
86typedef void (exit_request_fn)(void *, struct request *, unsigned int, 89typedef void (exit_request_fn)(void *, struct request *, unsigned int,
87 unsigned int); 90 unsigned int);
88 91
92typedef void (busy_iter_fn)(struct blk_mq_hw_ctx *, struct request *, void *,
93 bool);
94
89struct blk_mq_ops { 95struct blk_mq_ops {
90 /* 96 /*
91 * Queue request 97 * Queue request
@@ -100,7 +106,7 @@ struct blk_mq_ops {
100 /* 106 /*
101 * Called on request timeout 107 * Called on request timeout
102 */ 108 */
103 rq_timed_out_fn *timeout; 109 timeout_fn *timeout;
104 110
105 softirq_done_fn *complete; 111 softirq_done_fn *complete;
106 112
@@ -115,6 +121,10 @@ struct blk_mq_ops {
115 /* 121 /*
116 * Called for every command allocated by the block layer to allow 122 * Called for every command allocated by the block layer to allow
117 * the driver to set up driver specific data. 123 * the driver to set up driver specific data.
124 *
125 * Tag greater than or equal to queue_depth is for setting up
126 * flush request.
127 *
118 * Ditto for exit/teardown. 128 * Ditto for exit/teardown.
119 */ 129 */
120 init_request_fn *init_request; 130 init_request_fn *init_request;
@@ -127,10 +137,9 @@ enum {
127 BLK_MQ_RQ_QUEUE_ERROR = 2, /* end IO with error */ 137 BLK_MQ_RQ_QUEUE_ERROR = 2, /* end IO with error */
128 138
129 BLK_MQ_F_SHOULD_MERGE = 1 << 0, 139 BLK_MQ_F_SHOULD_MERGE = 1 << 0,
130 BLK_MQ_F_SHOULD_SORT = 1 << 1, 140 BLK_MQ_F_TAG_SHARED = 1 << 1,
131 BLK_MQ_F_TAG_SHARED = 1 << 2, 141 BLK_MQ_F_SG_MERGE = 1 << 2,
132 BLK_MQ_F_SG_MERGE = 1 << 3, 142 BLK_MQ_F_SYSFS_UP = 1 << 3,
133 BLK_MQ_F_SYSFS_UP = 1 << 4,
134 143
135 BLK_MQ_S_STOPPED = 0, 144 BLK_MQ_S_STOPPED = 0,
136 BLK_MQ_S_TAG_ACTIVE = 1, 145 BLK_MQ_S_TAG_ACTIVE = 1,
@@ -141,6 +150,7 @@ enum {
141}; 150};
142 151
143struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *); 152struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *);
153void blk_mq_finish_init(struct request_queue *q);
144int blk_mq_register_disk(struct gendisk *); 154int blk_mq_register_disk(struct gendisk *);
145void blk_mq_unregister_disk(struct gendisk *); 155void blk_mq_unregister_disk(struct gendisk *);
146 156
@@ -160,8 +170,9 @@ struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag);
160struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index); 170struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index);
161struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_tag_set *, unsigned int, int); 171struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_tag_set *, unsigned int, int);
162 172
163void blk_mq_end_io(struct request *rq, int error); 173void blk_mq_start_request(struct request *rq);
164void __blk_mq_end_io(struct request *rq, int error); 174void blk_mq_end_request(struct request *rq, int error);
175void __blk_mq_end_request(struct request *rq, int error);
165 176
166void blk_mq_requeue_request(struct request *rq); 177void blk_mq_requeue_request(struct request *rq);
167void blk_mq_add_to_requeue_list(struct request *rq, bool at_head); 178void blk_mq_add_to_requeue_list(struct request *rq, bool at_head);
@@ -174,7 +185,8 @@ void blk_mq_stop_hw_queues(struct request_queue *q);
174void blk_mq_start_hw_queues(struct request_queue *q); 185void blk_mq_start_hw_queues(struct request_queue *q);
175void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async); 186void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async);
176void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs); 187void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
177void blk_mq_tag_busy_iter(struct blk_mq_tags *tags, void (*fn)(void *data, unsigned long *), void *data); 188void blk_mq_tag_busy_iter(struct blk_mq_hw_ctx *hctx, busy_iter_fn *fn,
189 void *priv);
178 190
179/* 191/*
180 * Driver command data is immediately after the request. So subtract request 192 * Driver command data is immediately after the request. So subtract request
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 66c2167f04a9..445d59231bc4 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -78,9 +78,11 @@ struct bio {
78 struct io_context *bi_ioc; 78 struct io_context *bi_ioc;
79 struct cgroup_subsys_state *bi_css; 79 struct cgroup_subsys_state *bi_css;
80#endif 80#endif
81 union {
81#if defined(CONFIG_BLK_DEV_INTEGRITY) 82#if defined(CONFIG_BLK_DEV_INTEGRITY)
82 struct bio_integrity_payload *bi_integrity; /* data integrity */ 83 struct bio_integrity_payload *bi_integrity; /* data integrity */
83#endif 84#endif
85 };
84 86
85 unsigned short bi_vcnt; /* how many bio_vec's */ 87 unsigned short bi_vcnt; /* how many bio_vec's */
86 88
@@ -118,10 +120,8 @@ struct bio {
118#define BIO_USER_MAPPED 6 /* contains user pages */ 120#define BIO_USER_MAPPED 6 /* contains user pages */
119#define BIO_EOPNOTSUPP 7 /* not supported */ 121#define BIO_EOPNOTSUPP 7 /* not supported */
120#define BIO_NULL_MAPPED 8 /* contains invalid user pages */ 122#define BIO_NULL_MAPPED 8 /* contains invalid user pages */
121#define BIO_FS_INTEGRITY 9 /* fs owns integrity data, not block layer */ 123#define BIO_QUIET 9 /* Make BIO Quiet */
122#define BIO_QUIET 10 /* Make BIO Quiet */ 124#define BIO_SNAP_STABLE 10 /* bio data must be snapshotted during write */
123#define BIO_MAPPED_INTEGRITY 11/* integrity metadata has been remapped */
124#define BIO_SNAP_STABLE 12 /* bio data must be snapshotted during write */
125 125
126/* 126/*
127 * Flags starting here get preserved by bio_reset() - this includes 127 * Flags starting here get preserved by bio_reset() - this includes
@@ -162,6 +162,7 @@ enum rq_flag_bits {
162 __REQ_WRITE_SAME, /* write same block many times */ 162 __REQ_WRITE_SAME, /* write same block many times */
163 163
164 __REQ_NOIDLE, /* don't anticipate more IO after this one */ 164 __REQ_NOIDLE, /* don't anticipate more IO after this one */
165 __REQ_INTEGRITY, /* I/O includes block integrity payload */
165 __REQ_FUA, /* forced unit access */ 166 __REQ_FUA, /* forced unit access */
166 __REQ_FLUSH, /* request for cache flush */ 167 __REQ_FLUSH, /* request for cache flush */
167 168
@@ -186,9 +187,7 @@ enum rq_flag_bits {
186 __REQ_FLUSH_SEQ, /* request for flush sequence */ 187 __REQ_FLUSH_SEQ, /* request for flush sequence */
187 __REQ_IO_STAT, /* account I/O stat */ 188 __REQ_IO_STAT, /* account I/O stat */
188 __REQ_MIXED_MERGE, /* merge of different types, fail separately */ 189 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
189 __REQ_KERNEL, /* direct IO to kernel pages */
190 __REQ_PM, /* runtime pm request */ 190 __REQ_PM, /* runtime pm request */
191 __REQ_END, /* last of chain of requests */
192 __REQ_HASHED, /* on IO scheduler merge hash */ 191 __REQ_HASHED, /* on IO scheduler merge hash */
193 __REQ_MQ_INFLIGHT, /* track inflight for MQ */ 192 __REQ_MQ_INFLIGHT, /* track inflight for MQ */
194 __REQ_NR_BITS, /* stops here */ 193 __REQ_NR_BITS, /* stops here */
@@ -204,13 +203,14 @@ enum rq_flag_bits {
204#define REQ_DISCARD (1ULL << __REQ_DISCARD) 203#define REQ_DISCARD (1ULL << __REQ_DISCARD)
205#define REQ_WRITE_SAME (1ULL << __REQ_WRITE_SAME) 204#define REQ_WRITE_SAME (1ULL << __REQ_WRITE_SAME)
206#define REQ_NOIDLE (1ULL << __REQ_NOIDLE) 205#define REQ_NOIDLE (1ULL << __REQ_NOIDLE)
206#define REQ_INTEGRITY (1ULL << __REQ_INTEGRITY)
207 207
208#define REQ_FAILFAST_MASK \ 208#define REQ_FAILFAST_MASK \
209 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) 209 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
210#define REQ_COMMON_MASK \ 210#define REQ_COMMON_MASK \
211 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | \ 211 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | \
212 REQ_DISCARD | REQ_WRITE_SAME | REQ_NOIDLE | REQ_FLUSH | REQ_FUA | \ 212 REQ_DISCARD | REQ_WRITE_SAME | REQ_NOIDLE | REQ_FLUSH | REQ_FUA | \
213 REQ_SECURE) 213 REQ_SECURE | REQ_INTEGRITY)
214#define REQ_CLONE_MASK REQ_COMMON_MASK 214#define REQ_CLONE_MASK REQ_COMMON_MASK
215 215
216#define BIO_NO_ADVANCE_ITER_MASK (REQ_DISCARD|REQ_WRITE_SAME) 216#define BIO_NO_ADVANCE_ITER_MASK (REQ_DISCARD|REQ_WRITE_SAME)
@@ -240,9 +240,7 @@ enum rq_flag_bits {
240#define REQ_IO_STAT (1ULL << __REQ_IO_STAT) 240#define REQ_IO_STAT (1ULL << __REQ_IO_STAT)
241#define REQ_MIXED_MERGE (1ULL << __REQ_MIXED_MERGE) 241#define REQ_MIXED_MERGE (1ULL << __REQ_MIXED_MERGE)
242#define REQ_SECURE (1ULL << __REQ_SECURE) 242#define REQ_SECURE (1ULL << __REQ_SECURE)
243#define REQ_KERNEL (1ULL << __REQ_KERNEL)
244#define REQ_PM (1ULL << __REQ_PM) 243#define REQ_PM (1ULL << __REQ_PM)
245#define REQ_END (1ULL << __REQ_END)
246#define REQ_HASHED (1ULL << __REQ_HASHED) 244#define REQ_HASHED (1ULL << __REQ_HASHED)
247#define REQ_MQ_INFLIGHT (1ULL << __REQ_MQ_INFLIGHT) 245#define REQ_MQ_INFLIGHT (1ULL << __REQ_MQ_INFLIGHT)
248 246
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 8699bcf5f099..aac0f9ea952a 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -21,6 +21,7 @@
21#include <linux/bsg.h> 21#include <linux/bsg.h>
22#include <linux/smp.h> 22#include <linux/smp.h>
23#include <linux/rcupdate.h> 23#include <linux/rcupdate.h>
24#include <linux/percpu-refcount.h>
24 25
25#include <asm/scatterlist.h> 26#include <asm/scatterlist.h>
26 27
@@ -35,6 +36,7 @@ struct request;
35struct sg_io_hdr; 36struct sg_io_hdr;
36struct bsg_job; 37struct bsg_job;
37struct blkcg_gq; 38struct blkcg_gq;
39struct blk_flush_queue;
38 40
39#define BLKDEV_MIN_RQ 4 41#define BLKDEV_MIN_RQ 4
40#define BLKDEV_MAX_RQ 128 /* Default maximum */ 42#define BLKDEV_MAX_RQ 128 /* Default maximum */
@@ -454,14 +456,7 @@ struct request_queue {
454 */ 456 */
455 unsigned int flush_flags; 457 unsigned int flush_flags;
456 unsigned int flush_not_queueable:1; 458 unsigned int flush_not_queueable:1;
457 unsigned int flush_queue_delayed:1; 459 struct blk_flush_queue *fq;
458 unsigned int flush_pending_idx:1;
459 unsigned int flush_running_idx:1;
460 unsigned long flush_pending_since;
461 struct list_head flush_queue[2];
462 struct list_head flush_data_in_flight;
463 struct request *flush_rq;
464 spinlock_t mq_flush_lock;
465 460
466 struct list_head requeue_list; 461 struct list_head requeue_list;
467 spinlock_t requeue_lock; 462 spinlock_t requeue_lock;
@@ -470,6 +465,7 @@ struct request_queue {
470 struct mutex sysfs_lock; 465 struct mutex sysfs_lock;
471 466
472 int bypass_depth; 467 int bypass_depth;
468 int mq_freeze_depth;
473 469
474#if defined(CONFIG_BLK_DEV_BSG) 470#if defined(CONFIG_BLK_DEV_BSG)
475 bsg_job_fn *bsg_job_fn; 471 bsg_job_fn *bsg_job_fn;
@@ -483,7 +479,7 @@ struct request_queue {
483#endif 479#endif
484 struct rcu_head rcu_head; 480 struct rcu_head rcu_head;
485 wait_queue_head_t mq_freeze_wq; 481 wait_queue_head_t mq_freeze_wq;
486 struct percpu_counter mq_usage_counter; 482 struct percpu_ref mq_usage_counter;
487 struct list_head all_q_node; 483 struct list_head all_q_node;
488 484
489 struct blk_mq_tag_set *tag_set; 485 struct blk_mq_tag_set *tag_set;
@@ -863,7 +859,7 @@ extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
863 859
864static inline struct request_queue *bdev_get_queue(struct block_device *bdev) 860static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
865{ 861{
866 return bdev->bd_disk->queue; 862 return bdev->bd_disk->queue; /* this is never NULL */
867} 863}
868 864
869/* 865/*
@@ -1140,8 +1136,7 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk)
1140/* 1136/*
1141 * tag stuff 1137 * tag stuff
1142 */ 1138 */
1143#define blk_rq_tagged(rq) \ 1139#define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED)
1144 ((rq)->mq_ctx || ((rq)->cmd_flags & REQ_QUEUED))
1145extern int blk_queue_start_tag(struct request_queue *, struct request *); 1140extern int blk_queue_start_tag(struct request_queue *, struct request *);
1146extern struct request *blk_queue_find_tag(struct request_queue *, int); 1141extern struct request *blk_queue_find_tag(struct request_queue *, int);
1147extern void blk_queue_end_tag(struct request_queue *, struct request *); 1142extern void blk_queue_end_tag(struct request_queue *, struct request *);
@@ -1283,10 +1278,9 @@ static inline int queue_alignment_offset(struct request_queue *q)
1283static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector) 1278static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector)
1284{ 1279{
1285 unsigned int granularity = max(lim->physical_block_size, lim->io_min); 1280 unsigned int granularity = max(lim->physical_block_size, lim->io_min);
1286 unsigned int alignment = (sector << 9) & (granularity - 1); 1281 unsigned int alignment = sector_div(sector, granularity >> 9) << 9;
1287 1282
1288 return (granularity + lim->alignment_offset - alignment) 1283 return (granularity + lim->alignment_offset - alignment) % granularity;
1289 & (granularity - 1);
1290} 1284}
1291 1285
1292static inline int bdev_alignment_offset(struct block_device *bdev) 1286static inline int bdev_alignment_offset(struct block_device *bdev)
@@ -1462,32 +1456,31 @@ static inline uint64_t rq_io_start_time_ns(struct request *req)
1462 1456
1463#if defined(CONFIG_BLK_DEV_INTEGRITY) 1457#if defined(CONFIG_BLK_DEV_INTEGRITY)
1464 1458
1465#define INTEGRITY_FLAG_READ 2 /* verify data integrity on read */ 1459enum blk_integrity_flags {
1466#define INTEGRITY_FLAG_WRITE 4 /* generate data integrity on write */ 1460 BLK_INTEGRITY_VERIFY = 1 << 0,
1461 BLK_INTEGRITY_GENERATE = 1 << 1,
1462 BLK_INTEGRITY_DEVICE_CAPABLE = 1 << 2,
1463 BLK_INTEGRITY_IP_CHECKSUM = 1 << 3,
1464};
1467 1465
1468struct blk_integrity_exchg { 1466struct blk_integrity_iter {
1469 void *prot_buf; 1467 void *prot_buf;
1470 void *data_buf; 1468 void *data_buf;
1471 sector_t sector; 1469 sector_t seed;
1472 unsigned int data_size; 1470 unsigned int data_size;
1473 unsigned short sector_size; 1471 unsigned short interval;
1474 const char *disk_name; 1472 const char *disk_name;
1475}; 1473};
1476 1474
1477typedef void (integrity_gen_fn) (struct blk_integrity_exchg *); 1475typedef int (integrity_processing_fn) (struct blk_integrity_iter *);
1478typedef int (integrity_vrfy_fn) (struct blk_integrity_exchg *);
1479typedef void (integrity_set_tag_fn) (void *, void *, unsigned int);
1480typedef void (integrity_get_tag_fn) (void *, void *, unsigned int);
1481 1476
1482struct blk_integrity { 1477struct blk_integrity {
1483 integrity_gen_fn *generate_fn; 1478 integrity_processing_fn *generate_fn;
1484 integrity_vrfy_fn *verify_fn; 1479 integrity_processing_fn *verify_fn;
1485 integrity_set_tag_fn *set_tag_fn;
1486 integrity_get_tag_fn *get_tag_fn;
1487 1480
1488 unsigned short flags; 1481 unsigned short flags;
1489 unsigned short tuple_size; 1482 unsigned short tuple_size;
1490 unsigned short sector_size; 1483 unsigned short interval;
1491 unsigned short tag_size; 1484 unsigned short tag_size;
1492 1485
1493 const char *name; 1486 const char *name;
@@ -1502,10 +1495,10 @@ extern int blk_integrity_compare(struct gendisk *, struct gendisk *);
1502extern int blk_rq_map_integrity_sg(struct request_queue *, struct bio *, 1495extern int blk_rq_map_integrity_sg(struct request_queue *, struct bio *,
1503 struct scatterlist *); 1496 struct scatterlist *);
1504extern int blk_rq_count_integrity_sg(struct request_queue *, struct bio *); 1497extern int blk_rq_count_integrity_sg(struct request_queue *, struct bio *);
1505extern int blk_integrity_merge_rq(struct request_queue *, struct request *, 1498extern bool blk_integrity_merge_rq(struct request_queue *, struct request *,
1506 struct request *); 1499 struct request *);
1507extern int blk_integrity_merge_bio(struct request_queue *, struct request *, 1500extern bool blk_integrity_merge_bio(struct request_queue *, struct request *,
1508 struct bio *); 1501 struct bio *);
1509 1502
1510static inline 1503static inline
1511struct blk_integrity *bdev_get_integrity(struct block_device *bdev) 1504struct blk_integrity *bdev_get_integrity(struct block_device *bdev)
@@ -1518,12 +1511,9 @@ static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk)
1518 return disk->integrity; 1511 return disk->integrity;
1519} 1512}
1520 1513
1521static inline int blk_integrity_rq(struct request *rq) 1514static inline bool blk_integrity_rq(struct request *rq)
1522{ 1515{
1523 if (rq->bio == NULL) 1516 return rq->cmd_flags & REQ_INTEGRITY;
1524 return 0;
1525
1526 return bio_integrity(rq->bio);
1527} 1517}
1528 1518
1529static inline void blk_queue_max_integrity_segments(struct request_queue *q, 1519static inline void blk_queue_max_integrity_segments(struct request_queue *q,
@@ -1562,7 +1552,7 @@ static inline int blk_rq_map_integrity_sg(struct request_queue *q,
1562} 1552}
1563static inline struct blk_integrity *bdev_get_integrity(struct block_device *b) 1553static inline struct blk_integrity *bdev_get_integrity(struct block_device *b)
1564{ 1554{
1565 return 0; 1555 return NULL;
1566} 1556}
1567static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk) 1557static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk)
1568{ 1558{
@@ -1588,17 +1578,17 @@ static inline unsigned short queue_max_integrity_segments(struct request_queue *
1588{ 1578{
1589 return 0; 1579 return 0;
1590} 1580}
1591static inline int blk_integrity_merge_rq(struct request_queue *rq, 1581static inline bool blk_integrity_merge_rq(struct request_queue *rq,
1592 struct request *r1, 1582 struct request *r1,
1593 struct request *r2) 1583 struct request *r2)
1594{ 1584{
1595 return 0; 1585 return true;
1596} 1586}
1597static inline int blk_integrity_merge_bio(struct request_queue *rq, 1587static inline bool blk_integrity_merge_bio(struct request_queue *rq,
1598 struct request *r, 1588 struct request *r,
1599 struct bio *b) 1589 struct bio *b)
1600{ 1590{
1601 return 0; 1591 return true;
1602} 1592}
1603static inline bool blk_integrity_is_initialized(struct gendisk *g) 1593static inline bool blk_integrity_is_initialized(struct gendisk *g)
1604{ 1594{
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 4e2bd4c95b66..0995c2de8162 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -46,6 +46,7 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
46extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); 46extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
47 47
48extern unsigned long free_all_bootmem(void); 48extern unsigned long free_all_bootmem(void);
49extern void reset_node_managed_pages(pg_data_t *pgdat);
49extern void reset_all_zones_managed_pages(void); 50extern void reset_all_zones_managed_pages(void);
50 51
51extern void free_bootmem_node(pg_data_t *pgdat, 52extern void free_bootmem_node(pg_data_t *pgdat,
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
new file mode 100644
index 000000000000..3cf91754a957
--- /dev/null
+++ b/include/linux/bpf.h
@@ -0,0 +1,136 @@
1/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
2 *
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of version 2 of the GNU General Public
5 * License as published by the Free Software Foundation.
6 */
7#ifndef _LINUX_BPF_H
8#define _LINUX_BPF_H 1
9
10#include <uapi/linux/bpf.h>
11#include <linux/workqueue.h>
12#include <linux/file.h>
13
14struct bpf_map;
15
16/* map is generic key/value storage optionally accesible by eBPF programs */
17struct bpf_map_ops {
18 /* funcs callable from userspace (via syscall) */
19 struct bpf_map *(*map_alloc)(union bpf_attr *attr);
20 void (*map_free)(struct bpf_map *);
21 int (*map_get_next_key)(struct bpf_map *map, void *key, void *next_key);
22
23 /* funcs callable from userspace and from eBPF programs */
24 void *(*map_lookup_elem)(struct bpf_map *map, void *key);
25 int (*map_update_elem)(struct bpf_map *map, void *key, void *value);
26 int (*map_delete_elem)(struct bpf_map *map, void *key);
27};
28
29struct bpf_map {
30 atomic_t refcnt;
31 enum bpf_map_type map_type;
32 u32 key_size;
33 u32 value_size;
34 u32 max_entries;
35 struct bpf_map_ops *ops;
36 struct work_struct work;
37};
38
39struct bpf_map_type_list {
40 struct list_head list_node;
41 struct bpf_map_ops *ops;
42 enum bpf_map_type type;
43};
44
45void bpf_register_map_type(struct bpf_map_type_list *tl);
46void bpf_map_put(struct bpf_map *map);
47struct bpf_map *bpf_map_get(struct fd f);
48
49/* function argument constraints */
50enum bpf_arg_type {
51 ARG_ANYTHING = 0, /* any argument is ok */
52
53 /* the following constraints used to prototype
54 * bpf_map_lookup/update/delete_elem() functions
55 */
56 ARG_CONST_MAP_PTR, /* const argument used as pointer to bpf_map */
57 ARG_PTR_TO_MAP_KEY, /* pointer to stack used as map key */
58 ARG_PTR_TO_MAP_VALUE, /* pointer to stack used as map value */
59
60 /* the following constraints used to prototype bpf_memcmp() and other
61 * functions that access data on eBPF program stack
62 */
63 ARG_PTR_TO_STACK, /* any pointer to eBPF program stack */
64 ARG_CONST_STACK_SIZE, /* number of bytes accessed from stack */
65};
66
67/* type of values returned from helper functions */
68enum bpf_return_type {
69 RET_INTEGER, /* function returns integer */
70 RET_VOID, /* function doesn't return anything */
71 RET_PTR_TO_MAP_VALUE_OR_NULL, /* returns a pointer to map elem value or NULL */
72};
73
74/* eBPF function prototype used by verifier to allow BPF_CALLs from eBPF programs
75 * to in-kernel helper functions and for adjusting imm32 field in BPF_CALL
76 * instructions after verifying
77 */
78struct bpf_func_proto {
79 u64 (*func)(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);
80 bool gpl_only;
81 enum bpf_return_type ret_type;
82 enum bpf_arg_type arg1_type;
83 enum bpf_arg_type arg2_type;
84 enum bpf_arg_type arg3_type;
85 enum bpf_arg_type arg4_type;
86 enum bpf_arg_type arg5_type;
87};
88
89/* bpf_context is intentionally undefined structure. Pointer to bpf_context is
90 * the first argument to eBPF programs.
91 * For socket filters: 'struct bpf_context *' == 'struct sk_buff *'
92 */
93struct bpf_context;
94
95enum bpf_access_type {
96 BPF_READ = 1,
97 BPF_WRITE = 2
98};
99
100struct bpf_verifier_ops {
101 /* return eBPF function prototype for verification */
102 const struct bpf_func_proto *(*get_func_proto)(enum bpf_func_id func_id);
103
104 /* return true if 'size' wide access at offset 'off' within bpf_context
105 * with 'type' (read or write) is allowed
106 */
107 bool (*is_valid_access)(int off, int size, enum bpf_access_type type);
108};
109
110struct bpf_prog_type_list {
111 struct list_head list_node;
112 struct bpf_verifier_ops *ops;
113 enum bpf_prog_type type;
114};
115
116void bpf_register_prog_type(struct bpf_prog_type_list *tl);
117
118struct bpf_prog;
119
120struct bpf_prog_aux {
121 atomic_t refcnt;
122 bool is_gpl_compatible;
123 enum bpf_prog_type prog_type;
124 struct bpf_verifier_ops *ops;
125 struct bpf_map **used_maps;
126 u32 used_map_cnt;
127 struct bpf_prog *prog;
128 struct work_struct work;
129};
130
131void bpf_prog_put(struct bpf_prog *prog);
132struct bpf_prog *bpf_prog_get(u32 ufd);
133/* verify correctness of eBPF program */
134int bpf_check(struct bpf_prog *fp, union bpf_attr *attr);
135
136#endif /* _LINUX_BPF_H */
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 6f76277baf39..7ccd928cc1f2 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -13,18 +13,21 @@
13#define PHY_ID_BCM5461 0x002060c0 13#define PHY_ID_BCM5461 0x002060c0
14#define PHY_ID_BCM57780 0x03625d90 14#define PHY_ID_BCM57780 0x03625d90
15 15
16#define PHY_ID_BCM7250 0xae025280
17#define PHY_ID_BCM7364 0xae025260
16#define PHY_ID_BCM7366 0x600d8490 18#define PHY_ID_BCM7366 0x600d8490
19#define PHY_ID_BCM7425 0x03625e60
20#define PHY_ID_BCM7429 0x600d8730
17#define PHY_ID_BCM7439 0x600d8480 21#define PHY_ID_BCM7439 0x600d8480
18#define PHY_ID_BCM7445 0x600d8510 22#define PHY_ID_BCM7445 0x600d8510
19#define PHY_ID_BCM7XXX_28 0x600d8400
20 23
21#define PHY_BCM_OUI_MASK 0xfffffc00 24#define PHY_BCM_OUI_MASK 0xfffffc00
22#define PHY_BCM_OUI_1 0x00206000 25#define PHY_BCM_OUI_1 0x00206000
23#define PHY_BCM_OUI_2 0x0143bc00 26#define PHY_BCM_OUI_2 0x0143bc00
24#define PHY_BCM_OUI_3 0x03625c00 27#define PHY_BCM_OUI_3 0x03625c00
25#define PHY_BCM_OUI_4 0x600d0000 28#define PHY_BCM_OUI_4 0x600d8400
26#define PHY_BCM_OUI_5 0x03625e00 29#define PHY_BCM_OUI_5 0x03625e00
27 30#define PHY_BCM_OUI_6 0xae025000
28 31
29#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001 32#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001
30#define PHY_BCM_FLAGS_MODE_1000BX 0x00000002 33#define PHY_BCM_FLAGS_MODE_1000BX 0x00000002
@@ -39,7 +42,8 @@
39#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 42#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000
40#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 43#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000
41/* Broadcom BCM7xxx specific workarounds */ 44/* Broadcom BCM7xxx specific workarounds */
42#define PHY_BRCM_100MBPS_WAR 0x00010000 45#define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff)
46#define PHY_BRCM_7XXX_PATCH(x) ((x) & 0xff)
43#define PHY_BCM_FLAGS_VALID 0x80000000 47#define PHY_BCM_FLAGS_VALID 0x80000000
44 48
45/* Broadcom BCM54XX register definitions, common to most Broadcom PHYs */ 49/* Broadcom BCM54XX register definitions, common to most Broadcom PHYs */
@@ -93,4 +97,130 @@
93 97
94#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000 98#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000
95 99
100/*
101 * Broadcom LED source encodings. These are used in BCM5461, BCM5481,
102 * BCM5482, and possibly some others.
103 */
104#define BCM_LED_SRC_LINKSPD1 0x0
105#define BCM_LED_SRC_LINKSPD2 0x1
106#define BCM_LED_SRC_XMITLED 0x2
107#define BCM_LED_SRC_ACTIVITYLED 0x3
108#define BCM_LED_SRC_FDXLED 0x4
109#define BCM_LED_SRC_SLAVE 0x5
110#define BCM_LED_SRC_INTR 0x6
111#define BCM_LED_SRC_QUALITY 0x7
112#define BCM_LED_SRC_RCVLED 0x8
113#define BCM_LED_SRC_MULTICOLOR1 0xa
114#define BCM_LED_SRC_OPENSHORT 0xb
115#define BCM_LED_SRC_OFF 0xe /* Tied high */
116#define BCM_LED_SRC_ON 0xf /* Tied low */
117
118
119/*
120 * BCM5482: Shadow registers
121 * Shadow values go into bits [14:10] of register 0x1c to select a shadow
122 * register to access.
123 */
124/* 00101: Spare Control Register 3 */
125#define BCM54XX_SHD_SCR3 0x05
126#define BCM54XX_SHD_SCR3_DEF_CLK125 0x0001
127#define BCM54XX_SHD_SCR3_DLLAPD_DIS 0x0002
128#define BCM54XX_SHD_SCR3_TRDDAPD 0x0004
129
130/* 01010: Auto Power-Down */
131#define BCM54XX_SHD_APD 0x0a
132#define BCM54XX_SHD_APD_EN 0x0020
133
134#define BCM5482_SHD_LEDS1 0x0d /* 01101: LED Selector 1 */
135 /* LED3 / ~LINKSPD[2] selector */
136#define BCM5482_SHD_LEDS1_LED3(src) ((src & 0xf) << 4)
137 /* LED1 / ~LINKSPD[1] selector */
138#define BCM5482_SHD_LEDS1_LED1(src) ((src & 0xf) << 0)
139#define BCM54XX_SHD_RGMII_MODE 0x0b /* 01011: RGMII Mode Selector */
140#define BCM5482_SHD_SSD 0x14 /* 10100: Secondary SerDes control */
141#define BCM5482_SHD_SSD_LEDM 0x0008 /* SSD LED Mode enable */
142#define BCM5482_SHD_SSD_EN 0x0001 /* SSD enable */
143#define BCM5482_SHD_MODE 0x1f /* 11111: Mode Control Register */
144#define BCM5482_SHD_MODE_1000BX 0x0001 /* Enable 1000BASE-X registers */
145
146
147/*
148 * EXPANSION SHADOW ACCESS REGISTERS. (PHY REG 0x15, 0x16, and 0x17)
149 */
150#define MII_BCM54XX_EXP_AADJ1CH0 0x001f
151#define MII_BCM54XX_EXP_AADJ1CH0_SWP_ABCD_OEN 0x0200
152#define MII_BCM54XX_EXP_AADJ1CH0_SWSEL_THPF 0x0100
153#define MII_BCM54XX_EXP_AADJ1CH3 0x601f
154#define MII_BCM54XX_EXP_AADJ1CH3_ADCCKADJ 0x0002
155#define MII_BCM54XX_EXP_EXP08 0x0F08
156#define MII_BCM54XX_EXP_EXP08_RJCT_2MHZ 0x0001
157#define MII_BCM54XX_EXP_EXP08_EARLY_DAC_WAKE 0x0200
158#define MII_BCM54XX_EXP_EXP75 0x0f75
159#define MII_BCM54XX_EXP_EXP75_VDACCTRL 0x003c
160#define MII_BCM54XX_EXP_EXP75_CM_OSC 0x0001
161#define MII_BCM54XX_EXP_EXP96 0x0f96
162#define MII_BCM54XX_EXP_EXP96_MYST 0x0010
163#define MII_BCM54XX_EXP_EXP97 0x0f97
164#define MII_BCM54XX_EXP_EXP97_MYST 0x0c0c
165
166/*
167 * BCM5482: Secondary SerDes registers
168 */
169#define BCM5482_SSD_1000BX_CTL 0x00 /* 1000BASE-X Control */
170#define BCM5482_SSD_1000BX_CTL_PWRDOWN 0x0800 /* Power-down SSD */
171#define BCM5482_SSD_SGMII_SLAVE 0x15 /* SGMII Slave Register */
172#define BCM5482_SSD_SGMII_SLAVE_EN 0x0002 /* Slave mode enable */
173#define BCM5482_SSD_SGMII_SLAVE_AD 0x0001 /* Slave auto-detection */
174
175
176/*****************************************************************************/
177/* Fast Ethernet Transceiver definitions. */
178/*****************************************************************************/
179
180#define MII_BRCM_FET_INTREG 0x1a /* Interrupt register */
181#define MII_BRCM_FET_IR_MASK 0x0100 /* Mask all interrupts */
182#define MII_BRCM_FET_IR_LINK_EN 0x0200 /* Link status change enable */
183#define MII_BRCM_FET_IR_SPEED_EN 0x0400 /* Link speed change enable */
184#define MII_BRCM_FET_IR_DUPLEX_EN 0x0800 /* Duplex mode change enable */
185#define MII_BRCM_FET_IR_ENABLE 0x4000 /* Interrupt enable */
186
187#define MII_BRCM_FET_BRCMTEST 0x1f /* Brcm test register */
188#define MII_BRCM_FET_BT_SRE 0x0080 /* Shadow register enable */
189
190
191/*** Shadow register definitions ***/
192
193#define MII_BRCM_FET_SHDW_MISCCTRL 0x10 /* Shadow misc ctrl */
194#define MII_BRCM_FET_SHDW_MC_FAME 0x4000 /* Force Auto MDIX enable */
195
196#define MII_BRCM_FET_SHDW_AUXMODE4 0x1a /* Auxiliary mode 4 */
197#define MII_BRCM_FET_SHDW_AM4_LED_MASK 0x0003
198#define MII_BRCM_FET_SHDW_AM4_LED_MODE1 0x0001
199
200#define MII_BRCM_FET_SHDW_AUXSTAT2 0x1b /* Auxiliary status 2 */
201#define MII_BRCM_FET_SHDW_AS2_APDE 0x0020 /* Auto power down enable */
202
203/*
204 * Indirect register access functions for the 1000BASE-T/100BASE-TX/10BASE-T
205 * 0x1c shadow registers.
206 */
207static inline int bcm54xx_shadow_read(struct phy_device *phydev, u16 shadow)
208{
209 phy_write(phydev, MII_BCM54XX_SHD, MII_BCM54XX_SHD_VAL(shadow));
210 return MII_BCM54XX_SHD_DATA(phy_read(phydev, MII_BCM54XX_SHD));
211}
212
213static inline int bcm54xx_shadow_write(struct phy_device *phydev, u16 shadow,
214 u16 val)
215{
216 return phy_write(phydev, MII_BCM54XX_SHD,
217 MII_BCM54XX_SHD_WRITE |
218 MII_BCM54XX_SHD_VAL(shadow) |
219 MII_BCM54XX_SHD_DATA(val));
220}
221
222#define BRCM_CL45VEN_EEE_CONTROL 0x803d
223#define LPI_FEATURE_EN 0x8000
224#define LPI_FEATURE_EN_DIG1000X 0x4000
225
96#endif /* _LINUX_BRCMPHY_H */ 226#endif /* _LINUX_BRCMPHY_H */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 324329ceea1e..73b45225a7ca 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -175,12 +175,13 @@ void __wait_on_buffer(struct buffer_head *);
175wait_queue_head_t *bh_waitq_head(struct buffer_head *bh); 175wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
176struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block, 176struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
177 unsigned size); 177 unsigned size);
178struct buffer_head *__getblk(struct block_device *bdev, sector_t block, 178struct buffer_head *__getblk_gfp(struct block_device *bdev, sector_t block,
179 unsigned size); 179 unsigned size, gfp_t gfp);
180void __brelse(struct buffer_head *); 180void __brelse(struct buffer_head *);
181void __bforget(struct buffer_head *); 181void __bforget(struct buffer_head *);
182void __breadahead(struct block_device *, sector_t block, unsigned int size); 182void __breadahead(struct block_device *, sector_t block, unsigned int size);
183struct buffer_head *__bread(struct block_device *, sector_t block, unsigned size); 183struct buffer_head *__bread_gfp(struct block_device *,
184 sector_t block, unsigned size, gfp_t gfp);
184void invalidate_bh_lrus(void); 185void invalidate_bh_lrus(void);
185struct buffer_head *alloc_buffer_head(gfp_t gfp_flags); 186struct buffer_head *alloc_buffer_head(gfp_t gfp_flags);
186void free_buffer_head(struct buffer_head * bh); 187void free_buffer_head(struct buffer_head * bh);
@@ -295,7 +296,13 @@ static inline void bforget(struct buffer_head *bh)
295static inline struct buffer_head * 296static inline struct buffer_head *
296sb_bread(struct super_block *sb, sector_t block) 297sb_bread(struct super_block *sb, sector_t block)
297{ 298{
298 return __bread(sb->s_bdev, block, sb->s_blocksize); 299 return __bread_gfp(sb->s_bdev, block, sb->s_blocksize, __GFP_MOVABLE);
300}
301
302static inline struct buffer_head *
303sb_bread_unmovable(struct super_block *sb, sector_t block)
304{
305 return __bread_gfp(sb->s_bdev, block, sb->s_blocksize, 0);
299} 306}
300 307
301static inline void 308static inline void
@@ -307,7 +314,7 @@ sb_breadahead(struct super_block *sb, sector_t block)
307static inline struct buffer_head * 314static inline struct buffer_head *
308sb_getblk(struct super_block *sb, sector_t block) 315sb_getblk(struct super_block *sb, sector_t block)
309{ 316{
310 return __getblk(sb->s_bdev, block, sb->s_blocksize); 317 return __getblk_gfp(sb->s_bdev, block, sb->s_blocksize, __GFP_MOVABLE);
311} 318}
312 319
313static inline struct buffer_head * 320static inline struct buffer_head *
@@ -344,6 +351,36 @@ static inline void lock_buffer(struct buffer_head *bh)
344 __lock_buffer(bh); 351 __lock_buffer(bh);
345} 352}
346 353
354static inline struct buffer_head *getblk_unmovable(struct block_device *bdev,
355 sector_t block,
356 unsigned size)
357{
358 return __getblk_gfp(bdev, block, size, 0);
359}
360
361static inline struct buffer_head *__getblk(struct block_device *bdev,
362 sector_t block,
363 unsigned size)
364{
365 return __getblk_gfp(bdev, block, size, __GFP_MOVABLE);
366}
367
368/**
369 * __bread() - reads a specified block and returns the bh
370 * @bdev: the block_device to read from
371 * @block: number of block
372 * @size: size (in bytes) to read
373 *
374 * Reads a specified block, and returns buffer head that contains it.
375 * The page cache is allocated from movable area so that it can be migrated.
376 * It returns NULL if the block was unreadable.
377 */
378static inline struct buffer_head *
379__bread(struct block_device *bdev, sector_t block, unsigned size)
380{
381 return __bread_gfp(bdev, block, size, __GFP_MOVABLE);
382}
383
347extern int __set_page_dirty_buffers(struct page *page); 384extern int __set_page_dirty_buffers(struct page *page);
348 385
349#else /* CONFIG_BLOCK */ 386#else /* CONFIG_BLOCK */
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index 0846e6b931ce..89f67c1c3160 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -2,7 +2,7 @@
2#define _LINUX_BYTEORDER_GENERIC_H 2#define _LINUX_BYTEORDER_GENERIC_H
3 3
4/* 4/*
5 * linux/byteorder_generic.h 5 * linux/byteorder/generic.h
6 * Generic Byte-reordering support 6 * Generic Byte-reordering support
7 * 7 *
8 * The "... p" macros, like le64_to_cpup, can be used with pointers 8 * The "... p" macros, like le64_to_cpup, can be used with pointers
diff --git a/include/linux/ccp.h b/include/linux/ccp.h
index ebcc9d146219..7f437036baa4 100644
--- a/include/linux/ccp.h
+++ b/include/linux/ccp.h
@@ -27,6 +27,13 @@ struct ccp_cmd;
27 defined(CONFIG_CRYPTO_DEV_CCP_DD_MODULE) 27 defined(CONFIG_CRYPTO_DEV_CCP_DD_MODULE)
28 28
29/** 29/**
30 * ccp_present - check if a CCP device is present
31 *
32 * Returns zero if a CCP device is present, -ENODEV otherwise.
33 */
34int ccp_present(void);
35
36/**
30 * ccp_enqueue_cmd - queue an operation for processing by the CCP 37 * ccp_enqueue_cmd - queue an operation for processing by the CCP
31 * 38 *
32 * @cmd: ccp_cmd struct to be processed 39 * @cmd: ccp_cmd struct to be processed
@@ -53,6 +60,11 @@ int ccp_enqueue_cmd(struct ccp_cmd *cmd);
53 60
54#else /* CONFIG_CRYPTO_DEV_CCP_DD is not enabled */ 61#else /* CONFIG_CRYPTO_DEV_CCP_DD is not enabled */
55 62
63static inline int ccp_present(void)
64{
65 return -ENODEV;
66}
67
56static inline int ccp_enqueue_cmd(struct ccp_cmd *cmd) 68static inline int ccp_enqueue_cmd(struct ccp_cmd *cmd)
57{ 69{
58 return -ENODEV; 70 return -ENODEV;
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 279b0afac1c1..07bc359b88ac 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -211,7 +211,6 @@ extern struct page **ceph_get_direct_page_vector(const void __user *data,
211 bool write_page); 211 bool write_page);
212extern void ceph_put_page_vector(struct page **pages, int num_pages, 212extern void ceph_put_page_vector(struct page **pages, int num_pages,
213 bool dirty); 213 bool dirty);
214extern void ceph_release_page_vector(struct page **pages, int num_pages);
215extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags); 214extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags);
216extern int ceph_copy_user_to_page_vector(struct page **pages, 215extern int ceph_copy_user_to_page_vector(struct page **pages,
217 const void __user *data, 216 const void __user *data,
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index d21f2dba0731..40ae58e3e9db 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -285,19 +285,9 @@ extern void ceph_msg_data_add_bio(struct ceph_msg *msg, struct bio *bio,
285 285
286extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, 286extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags,
287 bool can_fail); 287 bool can_fail);
288extern void ceph_msg_kfree(struct ceph_msg *m);
289 288
290 289extern struct ceph_msg *ceph_msg_get(struct ceph_msg *msg);
291static inline struct ceph_msg *ceph_msg_get(struct ceph_msg *msg) 290extern void ceph_msg_put(struct ceph_msg *msg);
292{
293 kref_get(&msg->kref);
294 return msg;
295}
296extern void ceph_msg_last_put(struct kref *kref);
297static inline void ceph_msg_put(struct ceph_msg *msg)
298{
299 kref_put(&msg->kref, ceph_msg_last_put);
300}
301 291
302extern void ceph_msg_dump(struct ceph_msg *msg); 292extern void ceph_msg_dump(struct ceph_msg *msg);
303 293
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 94ec69672164..03aeb27fcc69 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -117,7 +117,7 @@ struct ceph_osd_request {
117 struct list_head r_req_lru_item; 117 struct list_head r_req_lru_item;
118 struct list_head r_osd_item; 118 struct list_head r_osd_item;
119 struct list_head r_linger_item; 119 struct list_head r_linger_item;
120 struct list_head r_linger_osd; 120 struct list_head r_linger_osd_item;
121 struct ceph_osd *r_osd; 121 struct ceph_osd *r_osd;
122 struct ceph_pg r_pgid; 122 struct ceph_pg r_pgid;
123 int r_pg_osds[CEPH_PG_MAX_SIZE]; 123 int r_pg_osds[CEPH_PG_MAX_SIZE];
@@ -325,22 +325,14 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
325 325
326extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc, 326extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc,
327 struct ceph_osd_request *req); 327 struct ceph_osd_request *req);
328extern void ceph_osdc_unregister_linger_request(struct ceph_osd_client *osdc, 328
329 struct ceph_osd_request *req); 329extern void ceph_osdc_get_request(struct ceph_osd_request *req);
330 330extern void ceph_osdc_put_request(struct ceph_osd_request *req);
331static inline void ceph_osdc_get_request(struct ceph_osd_request *req)
332{
333 kref_get(&req->r_kref);
334}
335extern void ceph_osdc_release_request(struct kref *kref);
336static inline void ceph_osdc_put_request(struct ceph_osd_request *req)
337{
338 kref_put(&req->r_kref, ceph_osdc_release_request);
339}
340 331
341extern int ceph_osdc_start_request(struct ceph_osd_client *osdc, 332extern int ceph_osdc_start_request(struct ceph_osd_client *osdc,
342 struct ceph_osd_request *req, 333 struct ceph_osd_request *req,
343 bool nofail); 334 bool nofail);
335extern void ceph_osdc_cancel_request(struct ceph_osd_request *req);
344extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc, 336extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc,
345 struct ceph_osd_request *req); 337 struct ceph_osd_request *req);
346extern void ceph_osdc_sync(struct ceph_osd_client *osdc); 338extern void ceph_osdc_sync(struct ceph_osd_client *osdc);
diff --git a/include/linux/ceph/pagelist.h b/include/linux/ceph/pagelist.h
index 9660d6b0a35d..5f871d84ddce 100644
--- a/include/linux/ceph/pagelist.h
+++ b/include/linux/ceph/pagelist.h
@@ -2,6 +2,7 @@
2#define __FS_CEPH_PAGELIST_H 2#define __FS_CEPH_PAGELIST_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/atomic.h>
5 6
6struct ceph_pagelist { 7struct ceph_pagelist {
7 struct list_head head; 8 struct list_head head;
@@ -10,6 +11,7 @@ struct ceph_pagelist {
10 size_t room; 11 size_t room;
11 struct list_head free_list; 12 struct list_head free_list;
12 size_t num_pages_free; 13 size_t num_pages_free;
14 atomic_t refcnt;
13}; 15};
14 16
15struct ceph_pagelist_cursor { 17struct ceph_pagelist_cursor {
@@ -26,9 +28,10 @@ static inline void ceph_pagelist_init(struct ceph_pagelist *pl)
26 pl->room = 0; 28 pl->room = 0;
27 INIT_LIST_HEAD(&pl->free_list); 29 INIT_LIST_HEAD(&pl->free_list);
28 pl->num_pages_free = 0; 30 pl->num_pages_free = 0;
31 atomic_set(&pl->refcnt, 1);
29} 32}
30 33
31extern int ceph_pagelist_release(struct ceph_pagelist *pl); 34extern void ceph_pagelist_release(struct ceph_pagelist *pl);
32 35
33extern int ceph_pagelist_append(struct ceph_pagelist *pl, const void *d, size_t l); 36extern int ceph_pagelist_append(struct ceph_pagelist *pl, const void *d, size_t l);
34 37
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index f20e0d8a2155..2f822dca1046 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -172,6 +172,7 @@ extern const char *ceph_osd_state_name(int s);
172#define CEPH_OSD_OP_MODE_WR 0x2000 172#define CEPH_OSD_OP_MODE_WR 0x2000
173#define CEPH_OSD_OP_MODE_RMW 0x3000 173#define CEPH_OSD_OP_MODE_RMW 0x3000
174#define CEPH_OSD_OP_MODE_SUB 0x4000 174#define CEPH_OSD_OP_MODE_SUB 0x4000
175#define CEPH_OSD_OP_MODE_CACHE 0x8000
175 176
176#define CEPH_OSD_OP_TYPE 0x0f00 177#define CEPH_OSD_OP_TYPE 0x0f00
177#define CEPH_OSD_OP_TYPE_LOCK 0x0100 178#define CEPH_OSD_OP_TYPE_LOCK 0x0100
@@ -181,103 +182,135 @@ extern const char *ceph_osd_state_name(int s);
181#define CEPH_OSD_OP_TYPE_PG 0x0500 182#define CEPH_OSD_OP_TYPE_PG 0x0500
182#define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */ 183#define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */
183 184
185#define __CEPH_OSD_OP1(mode, nr) \
186 (CEPH_OSD_OP_MODE_##mode | (nr))
187
188#define __CEPH_OSD_OP(mode, type, nr) \
189 (CEPH_OSD_OP_MODE_##mode | CEPH_OSD_OP_TYPE_##type | (nr))
190
191#define __CEPH_FORALL_OSD_OPS(f) \
192 /** data **/ \
193 /* read */ \
194 f(READ, __CEPH_OSD_OP(RD, DATA, 1), "read") \
195 f(STAT, __CEPH_OSD_OP(RD, DATA, 2), "stat") \
196 f(MAPEXT, __CEPH_OSD_OP(RD, DATA, 3), "mapext") \
197 \
198 /* fancy read */ \
199 f(MASKTRUNC, __CEPH_OSD_OP(RD, DATA, 4), "masktrunc") \
200 f(SPARSE_READ, __CEPH_OSD_OP(RD, DATA, 5), "sparse-read") \
201 \
202 f(NOTIFY, __CEPH_OSD_OP(RD, DATA, 6), "notify") \
203 f(NOTIFY_ACK, __CEPH_OSD_OP(RD, DATA, 7), "notify-ack") \
204 \
205 /* versioning */ \
206 f(ASSERT_VER, __CEPH_OSD_OP(RD, DATA, 8), "assert-version") \
207 \
208 f(LIST_WATCHERS, __CEPH_OSD_OP(RD, DATA, 9), "list-watchers") \
209 \
210 f(LIST_SNAPS, __CEPH_OSD_OP(RD, DATA, 10), "list-snaps") \
211 \
212 /* sync */ \
213 f(SYNC_READ, __CEPH_OSD_OP(RD, DATA, 11), "sync_read") \
214 \
215 /* write */ \
216 f(WRITE, __CEPH_OSD_OP(WR, DATA, 1), "write") \
217 f(WRITEFULL, __CEPH_OSD_OP(WR, DATA, 2), "writefull") \
218 f(TRUNCATE, __CEPH_OSD_OP(WR, DATA, 3), "truncate") \
219 f(ZERO, __CEPH_OSD_OP(WR, DATA, 4), "zero") \
220 f(DELETE, __CEPH_OSD_OP(WR, DATA, 5), "delete") \
221 \
222 /* fancy write */ \
223 f(APPEND, __CEPH_OSD_OP(WR, DATA, 6), "append") \
224 f(STARTSYNC, __CEPH_OSD_OP(WR, DATA, 7), "startsync") \
225 f(SETTRUNC, __CEPH_OSD_OP(WR, DATA, 8), "settrunc") \
226 f(TRIMTRUNC, __CEPH_OSD_OP(WR, DATA, 9), "trimtrunc") \
227 \
228 f(TMAPUP, __CEPH_OSD_OP(RMW, DATA, 10), "tmapup") \
229 f(TMAPPUT, __CEPH_OSD_OP(WR, DATA, 11), "tmapput") \
230 f(TMAPGET, __CEPH_OSD_OP(RD, DATA, 12), "tmapget") \
231 \
232 f(CREATE, __CEPH_OSD_OP(WR, DATA, 13), "create") \
233 f(ROLLBACK, __CEPH_OSD_OP(WR, DATA, 14), "rollback") \
234 \
235 f(WATCH, __CEPH_OSD_OP(WR, DATA, 15), "watch") \
236 \
237 /* omap */ \
238 f(OMAPGETKEYS, __CEPH_OSD_OP(RD, DATA, 17), "omap-get-keys") \
239 f(OMAPGETVALS, __CEPH_OSD_OP(RD, DATA, 18), "omap-get-vals") \
240 f(OMAPGETHEADER, __CEPH_OSD_OP(RD, DATA, 19), "omap-get-header") \
241 f(OMAPGETVALSBYKEYS, __CEPH_OSD_OP(RD, DATA, 20), "omap-get-vals-by-keys") \
242 f(OMAPSETVALS, __CEPH_OSD_OP(WR, DATA, 21), "omap-set-vals") \
243 f(OMAPSETHEADER, __CEPH_OSD_OP(WR, DATA, 22), "omap-set-header") \
244 f(OMAPCLEAR, __CEPH_OSD_OP(WR, DATA, 23), "omap-clear") \
245 f(OMAPRMKEYS, __CEPH_OSD_OP(WR, DATA, 24), "omap-rm-keys") \
246 f(OMAP_CMP, __CEPH_OSD_OP(RD, DATA, 25), "omap-cmp") \
247 \
248 /* tiering */ \
249 f(COPY_FROM, __CEPH_OSD_OP(WR, DATA, 26), "copy-from") \
250 f(COPY_GET_CLASSIC, __CEPH_OSD_OP(RD, DATA, 27), "copy-get-classic") \
251 f(UNDIRTY, __CEPH_OSD_OP(WR, DATA, 28), "undirty") \
252 f(ISDIRTY, __CEPH_OSD_OP(RD, DATA, 29), "isdirty") \
253 f(COPY_GET, __CEPH_OSD_OP(RD, DATA, 30), "copy-get") \
254 f(CACHE_FLUSH, __CEPH_OSD_OP(CACHE, DATA, 31), "cache-flush") \
255 f(CACHE_EVICT, __CEPH_OSD_OP(CACHE, DATA, 32), "cache-evict") \
256 f(CACHE_TRY_FLUSH, __CEPH_OSD_OP(CACHE, DATA, 33), "cache-try-flush") \
257 \
258 /* convert tmap to omap */ \
259 f(TMAP2OMAP, __CEPH_OSD_OP(RMW, DATA, 34), "tmap2omap") \
260 \
261 /* hints */ \
262 f(SETALLOCHINT, __CEPH_OSD_OP(WR, DATA, 35), "set-alloc-hint") \
263 \
264 /** multi **/ \
265 f(CLONERANGE, __CEPH_OSD_OP(WR, MULTI, 1), "clonerange") \
266 f(ASSERT_SRC_VERSION, __CEPH_OSD_OP(RD, MULTI, 2), "assert-src-version") \
267 f(SRC_CMPXATTR, __CEPH_OSD_OP(RD, MULTI, 3), "src-cmpxattr") \
268 \
269 /** attrs **/ \
270 /* read */ \
271 f(GETXATTR, __CEPH_OSD_OP(RD, ATTR, 1), "getxattr") \
272 f(GETXATTRS, __CEPH_OSD_OP(RD, ATTR, 2), "getxattrs") \
273 f(CMPXATTR, __CEPH_OSD_OP(RD, ATTR, 3), "cmpxattr") \
274 \
275 /* write */ \
276 f(SETXATTR, __CEPH_OSD_OP(WR, ATTR, 1), "setxattr") \
277 f(SETXATTRS, __CEPH_OSD_OP(WR, ATTR, 2), "setxattrs") \
278 f(RESETXATTRS, __CEPH_OSD_OP(WR, ATTR, 3), "resetxattrs") \
279 f(RMXATTR, __CEPH_OSD_OP(WR, ATTR, 4), "rmxattr") \
280 \
281 /** subop **/ \
282 f(PULL, __CEPH_OSD_OP1(SUB, 1), "pull") \
283 f(PUSH, __CEPH_OSD_OP1(SUB, 2), "push") \
284 f(BALANCEREADS, __CEPH_OSD_OP1(SUB, 3), "balance-reads") \
285 f(UNBALANCEREADS, __CEPH_OSD_OP1(SUB, 4), "unbalance-reads") \
286 f(SCRUB, __CEPH_OSD_OP1(SUB, 5), "scrub") \
287 f(SCRUB_RESERVE, __CEPH_OSD_OP1(SUB, 6), "scrub-reserve") \
288 f(SCRUB_UNRESERVE, __CEPH_OSD_OP1(SUB, 7), "scrub-unreserve") \
289 f(SCRUB_STOP, __CEPH_OSD_OP1(SUB, 8), "scrub-stop") \
290 f(SCRUB_MAP, __CEPH_OSD_OP1(SUB, 9), "scrub-map") \
291 \
292 /** lock **/ \
293 f(WRLOCK, __CEPH_OSD_OP(WR, LOCK, 1), "wrlock") \
294 f(WRUNLOCK, __CEPH_OSD_OP(WR, LOCK, 2), "wrunlock") \
295 f(RDLOCK, __CEPH_OSD_OP(WR, LOCK, 3), "rdlock") \
296 f(RDUNLOCK, __CEPH_OSD_OP(WR, LOCK, 4), "rdunlock") \
297 f(UPLOCK, __CEPH_OSD_OP(WR, LOCK, 5), "uplock") \
298 f(DNLOCK, __CEPH_OSD_OP(WR, LOCK, 6), "dnlock") \
299 \
300 /** exec **/ \
301 /* note: the RD bit here is wrong; see special-case below in helper */ \
302 f(CALL, __CEPH_OSD_OP(RD, EXEC, 1), "call") \
303 \
304 /** pg **/ \
305 f(PGLS, __CEPH_OSD_OP(RD, PG, 1), "pgls") \
306 f(PGLS_FILTER, __CEPH_OSD_OP(RD, PG, 2), "pgls-filter") \
307 f(PG_HITSET_LS, __CEPH_OSD_OP(RD, PG, 3), "pg-hitset-ls") \
308 f(PG_HITSET_GET, __CEPH_OSD_OP(RD, PG, 4), "pg-hitset-get")
309
184enum { 310enum {
185 /** data **/ 311#define GENERATE_ENUM_ENTRY(op, opcode, str) CEPH_OSD_OP_##op = (opcode),
186 /* read */ 312__CEPH_FORALL_OSD_OPS(GENERATE_ENUM_ENTRY)
187 CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1, 313#undef GENERATE_ENUM_ENTRY
188 CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2,
189 CEPH_OSD_OP_MAPEXT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 3,
190
191 /* fancy read */
192 CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4,
193 CEPH_OSD_OP_SPARSE_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 5,
194
195 CEPH_OSD_OP_NOTIFY = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 6,
196 CEPH_OSD_OP_NOTIFY_ACK = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 7,
197
198 /* versioning */
199 CEPH_OSD_OP_ASSERT_VER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 8,
200
201 /* write */
202 CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1,
203 CEPH_OSD_OP_WRITEFULL = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 2,
204 CEPH_OSD_OP_TRUNCATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 3,
205 CEPH_OSD_OP_ZERO = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 4,
206 CEPH_OSD_OP_DELETE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 5,
207
208 /* fancy write */
209 CEPH_OSD_OP_APPEND = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 6,
210 CEPH_OSD_OP_STARTSYNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 7,
211 CEPH_OSD_OP_SETTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 8,
212 CEPH_OSD_OP_TRIMTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 9,
213
214 CEPH_OSD_OP_TMAPUP = CEPH_OSD_OP_MODE_RMW | CEPH_OSD_OP_TYPE_DATA | 10,
215 CEPH_OSD_OP_TMAPPUT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 11,
216 CEPH_OSD_OP_TMAPGET = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 12,
217
218 CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13,
219 CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14,
220
221 CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15,
222
223 /* omap */
224 CEPH_OSD_OP_OMAPGETKEYS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 17,
225 CEPH_OSD_OP_OMAPGETVALS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 18,
226 CEPH_OSD_OP_OMAPGETHEADER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 19,
227 CEPH_OSD_OP_OMAPGETVALSBYKEYS =
228 CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 20,
229 CEPH_OSD_OP_OMAPSETVALS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 21,
230 CEPH_OSD_OP_OMAPSETHEADER = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 22,
231 CEPH_OSD_OP_OMAPCLEAR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 23,
232 CEPH_OSD_OP_OMAPRMKEYS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 24,
233 CEPH_OSD_OP_OMAP_CMP = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 25,
234
235 /* hints */
236 CEPH_OSD_OP_SETALLOCHINT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 35,
237
238 /** multi **/
239 CEPH_OSD_OP_CLONERANGE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_MULTI | 1,
240 CEPH_OSD_OP_ASSERT_SRC_VERSION = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 2,
241 CEPH_OSD_OP_SRC_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 3,
242
243 /** attrs **/
244 /* read */
245 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
246 CEPH_OSD_OP_GETXATTRS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 2,
247 CEPH_OSD_OP_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 3,
248
249 /* write */
250 CEPH_OSD_OP_SETXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 1,
251 CEPH_OSD_OP_SETXATTRS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 2,
252 CEPH_OSD_OP_RESETXATTRS = CEPH_OSD_OP_MODE_WR|CEPH_OSD_OP_TYPE_ATTR | 3,
253 CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4,
254
255 /** subop **/
256 CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1,
257 CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2,
258 CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3,
259 CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4,
260 CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5,
261 CEPH_OSD_OP_SCRUB_RESERVE = CEPH_OSD_OP_MODE_SUB | 6,
262 CEPH_OSD_OP_SCRUB_UNRESERVE = CEPH_OSD_OP_MODE_SUB | 7,
263 CEPH_OSD_OP_SCRUB_STOP = CEPH_OSD_OP_MODE_SUB | 8,
264 CEPH_OSD_OP_SCRUB_MAP = CEPH_OSD_OP_MODE_SUB | 9,
265
266 /** lock **/
267 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1,
268 CEPH_OSD_OP_WRUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 2,
269 CEPH_OSD_OP_RDLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 3,
270 CEPH_OSD_OP_RDUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 4,
271 CEPH_OSD_OP_UPLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 5,
272 CEPH_OSD_OP_DNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 6,
273
274 /** exec **/
275 /* note: the RD bit here is wrong; see special-case below in helper */
276 CEPH_OSD_OP_CALL = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_EXEC | 1,
277
278 /** pg **/
279 CEPH_OSD_OP_PGLS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 1,
280 CEPH_OSD_OP_PGLS_FILTER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 2,
281}; 314};
282 315
283static inline int ceph_osd_op_type_lock(int op) 316static inline int ceph_osd_op_type_lock(int op)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index b5223c570eba..1d5196889048 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -27,7 +27,6 @@
27 27
28struct cgroup_root; 28struct cgroup_root;
29struct cgroup_subsys; 29struct cgroup_subsys;
30struct inode;
31struct cgroup; 30struct cgroup;
32 31
33extern int cgroup_init_early(void); 32extern int cgroup_init_early(void);
@@ -38,7 +37,8 @@ extern void cgroup_exit(struct task_struct *p);
38extern int cgroupstats_build(struct cgroupstats *stats, 37extern int cgroupstats_build(struct cgroupstats *stats,
39 struct dentry *dentry); 38 struct dentry *dentry);
40 39
41extern int proc_cgroup_show(struct seq_file *, void *); 40extern int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns,
41 struct pid *pid, struct task_struct *tsk);
42 42
43/* define the enumeration of all cgroup subsystems */ 43/* define the enumeration of all cgroup subsystems */
44#define SUBSYS(_x) _x ## _cgrp_id, 44#define SUBSYS(_x) _x ## _cgrp_id,
@@ -161,11 +161,6 @@ static inline void css_put(struct cgroup_subsys_state *css)
161 161
162/* bits in struct cgroup flags field */ 162/* bits in struct cgroup flags field */
163enum { 163enum {
164 /*
165 * Control Group has previously had a child cgroup or a task,
166 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
167 */
168 CGRP_RELEASABLE,
169 /* Control Group requires release notifications to userspace */ 164 /* Control Group requires release notifications to userspace */
170 CGRP_NOTIFY_ON_RELEASE, 165 CGRP_NOTIFY_ON_RELEASE,
171 /* 166 /*
@@ -235,13 +230,6 @@ struct cgroup {
235 struct list_head e_csets[CGROUP_SUBSYS_COUNT]; 230 struct list_head e_csets[CGROUP_SUBSYS_COUNT];
236 231
237 /* 232 /*
238 * Linked list running through all cgroups that can
239 * potentially be reaped by the release agent. Protected by
240 * release_list_lock
241 */
242 struct list_head release_list;
243
244 /*
245 * list of pidlists, up to two for each namespace (one for procs, one 233 * list of pidlists, up to two for each namespace (one for procs, one
246 * for tasks); created on demand. 234 * for tasks); created on demand.
247 */ 235 */
@@ -250,6 +238,9 @@ struct cgroup {
250 238
251 /* used to wait for offlining of csses */ 239 /* used to wait for offlining of csses */
252 wait_queue_head_t offline_waitq; 240 wait_queue_head_t offline_waitq;
241
242 /* used to schedule release agent */
243 struct work_struct release_agent_work;
253}; 244};
254 245
255#define MAX_CGROUP_ROOT_NAMELEN 64 246#define MAX_CGROUP_ROOT_NAMELEN 64
@@ -536,13 +527,10 @@ static inline bool cgroup_has_tasks(struct cgroup *cgrp)
536 return !list_empty(&cgrp->cset_links); 527 return !list_empty(&cgrp->cset_links);
537} 528}
538 529
539/* returns ino associated with a cgroup, 0 indicates unmounted root */ 530/* returns ino associated with a cgroup */
540static inline ino_t cgroup_ino(struct cgroup *cgrp) 531static inline ino_t cgroup_ino(struct cgroup *cgrp)
541{ 532{
542 if (cgrp->kn) 533 return cgrp->kn->ino;
543 return cgrp->kn->ino;
544 else
545 return 0;
546} 534}
547 535
548/* cft/css accessors for cftype->write() operation */ 536/* cft/css accessors for cftype->write() operation */
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
index efbf70b9fd84..0ca5f6046920 100644
--- a/include/linux/clk-private.h
+++ b/include/linux/clk-private.h
@@ -46,8 +46,10 @@ struct clk {
46 unsigned int enable_count; 46 unsigned int enable_count;
47 unsigned int prepare_count; 47 unsigned int prepare_count;
48 unsigned long accuracy; 48 unsigned long accuracy;
49 int phase;
49 struct hlist_head children; 50 struct hlist_head children;
50 struct hlist_node child_node; 51 struct hlist_node child_node;
52 struct hlist_node debug_node;
51 unsigned int notifier_count; 53 unsigned int notifier_count;
52#ifdef CONFIG_DEBUG_FS 54#ifdef CONFIG_DEBUG_FS
53 struct dentry *dentry; 55 struct dentry *dentry;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 411dd7eb2653..be21af149f11 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -13,6 +13,7 @@
13 13
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/of.h>
16 17
17#ifdef CONFIG_COMMON_CLK 18#ifdef CONFIG_COMMON_CLK
18 19
@@ -129,6 +130,14 @@ struct dentry;
129 * set then clock accuracy will be initialized to parent accuracy 130 * set then clock accuracy will be initialized to parent accuracy
130 * or 0 (perfect clock) if clock has no parent. 131 * or 0 (perfect clock) if clock has no parent.
131 * 132 *
133 * @get_phase: Queries the hardware to get the current phase of a clock.
134 * Returned values are 0-359 degrees on success, negative
135 * error codes on failure.
136 *
137 * @set_phase: Shift the phase this clock signal in degrees specified
138 * by the second argument. Valid values for degrees are
139 * 0-359. Return 0 on success, otherwise -EERROR.
140 *
132 * @init: Perform platform-specific initialization magic. 141 * @init: Perform platform-specific initialization magic.
133 * This is not not used by any of the basic clock types. 142 * This is not not used by any of the basic clock types.
134 * Please consider other ways of solving initialization problems 143 * Please consider other ways of solving initialization problems
@@ -177,6 +186,8 @@ struct clk_ops {
177 unsigned long parent_rate, u8 index); 186 unsigned long parent_rate, u8 index);
178 unsigned long (*recalc_accuracy)(struct clk_hw *hw, 187 unsigned long (*recalc_accuracy)(struct clk_hw *hw,
179 unsigned long parent_accuracy); 188 unsigned long parent_accuracy);
189 int (*get_phase)(struct clk_hw *hw);
190 int (*set_phase)(struct clk_hw *hw, int degrees);
180 void (*init)(struct clk_hw *hw); 191 void (*init)(struct clk_hw *hw);
181 int (*debug_init)(struct clk_hw *hw, struct dentry *dentry); 192 int (*debug_init)(struct clk_hw *hw, struct dentry *dentry);
182}; 193};
@@ -488,6 +499,28 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
488 struct clk_hw *gate_hw, const struct clk_ops *gate_ops, 499 struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
489 unsigned long flags); 500 unsigned long flags);
490 501
502/***
503 * struct clk_gpio_gate - gpio gated clock
504 *
505 * @hw: handle between common and hardware-specific interfaces
506 * @gpiod: gpio descriptor
507 *
508 * Clock with a gpio control for enabling and disabling the parent clock.
509 * Implements .enable, .disable and .is_enabled
510 */
511
512struct clk_gpio {
513 struct clk_hw hw;
514 struct gpio_desc *gpiod;
515};
516
517extern const struct clk_ops clk_gpio_gate_ops;
518struct clk *clk_register_gpio_gate(struct device *dev, const char *name,
519 const char *parent_name, struct gpio_desc *gpio,
520 unsigned long flags);
521
522void of_gpio_clk_gate_setup(struct device_node *node);
523
491/** 524/**
492 * clk_register - allocate a new clock, register it and return an opaque cookie 525 * clk_register - allocate a new clock, register it and return an opaque cookie
493 * @dev: device that is registering this clock 526 * @dev: device that is registering this clock
diff --git a/include/linux/clk.h b/include/linux/clk.h
index afb44bfaf8d1..c7f258a81761 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -106,6 +106,25 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
106 */ 106 */
107long clk_get_accuracy(struct clk *clk); 107long clk_get_accuracy(struct clk *clk);
108 108
109/**
110 * clk_set_phase - adjust the phase shift of a clock signal
111 * @clk: clock signal source
112 * @degrees: number of degrees the signal is shifted
113 *
114 * Shifts the phase of a clock signal by the specified degrees. Returns 0 on
115 * success, -EERROR otherwise.
116 */
117int clk_set_phase(struct clk *clk, int degrees);
118
119/**
120 * clk_get_phase - return the phase shift of a clock signal
121 * @clk: clock signal source
122 *
123 * Returns the phase shift of a clock node in degrees, otherwise returns
124 * -EERROR.
125 */
126int clk_get_phase(struct clk *clk);
127
109#else 128#else
110 129
111static inline long clk_get_accuracy(struct clk *clk) 130static inline long clk_get_accuracy(struct clk *clk)
@@ -113,6 +132,16 @@ static inline long clk_get_accuracy(struct clk *clk)
113 return -ENOTSUPP; 132 return -ENOTSUPP;
114} 133}
115 134
135static inline long clk_set_phase(struct clk *clk, int phase)
136{
137 return -ENOTSUPP;
138}
139
140static inline long clk_get_phase(struct clk *clk)
141{
142 return -ENOTSUPP;
143}
144
116#endif 145#endif
117 146
118/** 147/**
diff --git a/include/linux/clk/at91_pmc.h b/include/linux/clk/at91_pmc.h
index de4268d4987a..c8e3b3d1eded 100644
--- a/include/linux/clk/at91_pmc.h
+++ b/include/linux/clk/at91_pmc.h
@@ -125,6 +125,7 @@ extern void __iomem *at91_pmc_base;
125#define AT91_PMC_PLLADIV2 (1 << 12) /* PLLA divisor by 2 [some SAM9 only] */ 125#define AT91_PMC_PLLADIV2 (1 << 12) /* PLLA divisor by 2 [some SAM9 only] */
126#define AT91_PMC_PLLADIV2_OFF (0 << 12) 126#define AT91_PMC_PLLADIV2_OFF (0 << 12)
127#define AT91_PMC_PLLADIV2_ON (1 << 12) 127#define AT91_PMC_PLLADIV2_ON (1 << 12)
128#define AT91_PMC_H32MXDIV BIT(24)
128 129
129#define AT91_PMC_USB 0x38 /* USB Clock Register [some SAM9 only] */ 130#define AT91_PMC_USB 0x38 /* USB Clock Register [some SAM9 only] */
130#define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */ 131#define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */
diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h
index e8d8a35034a5..f75acbf70e96 100644
--- a/include/linux/clk/ti.h
+++ b/include/linux/clk/ti.h
@@ -292,6 +292,7 @@ void omap2xxx_clkt_vps_init(void);
292void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index); 292void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index);
293void ti_dt_clocks_register(struct ti_dt_clk *oclks); 293void ti_dt_clocks_register(struct ti_dt_clk *oclks);
294void ti_dt_clk_init_provider(struct device_node *np, int index); 294void ti_dt_clk_init_provider(struct device_node *np, int index);
295void ti_dt_clk_init_retry_clks(void);
295void ti_dt_clockdomains_setup(void); 296void ti_dt_clockdomains_setup(void);
296int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw, 297int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw,
297 ti_of_clk_init_cb_t func); 298 ti_of_clk_init_cb_t func);
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 653f0e2b6ca9..abcafaa20b86 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -287,7 +287,7 @@ extern struct clocksource* clocksource_get_next(void);
287extern void clocksource_change_rating(struct clocksource *cs, int rating); 287extern void clocksource_change_rating(struct clocksource *cs, int rating);
288extern void clocksource_suspend(void); 288extern void clocksource_suspend(void);
289extern void clocksource_resume(void); 289extern void clocksource_resume(void);
290extern struct clocksource * __init __weak clocksource_default_clock(void); 290extern struct clocksource * __init clocksource_default_clock(void);
291extern void clocksource_mark_unstable(struct clocksource *cs); 291extern void clocksource_mark_unstable(struct clocksource *cs);
292 292
293extern u64 293extern u64
diff --git a/include/linux/cma.h b/include/linux/cma.h
new file mode 100644
index 000000000000..a93438beb33c
--- /dev/null
+++ b/include/linux/cma.h
@@ -0,0 +1,30 @@
1#ifndef __CMA_H__
2#define __CMA_H__
3
4/*
5 * There is always at least global CMA area and a few optional
6 * areas configured in kernel .config.
7 */
8#ifdef CONFIG_CMA_AREAS
9#define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS)
10
11#else
12#define MAX_CMA_AREAS (0)
13
14#endif
15
16struct cma;
17
18extern phys_addr_t cma_get_base(struct cma *cma);
19extern unsigned long cma_get_size(struct cma *cma);
20
21extern int __init cma_declare_contiguous(phys_addr_t base,
22 phys_addr_t size, phys_addr_t limit,
23 phys_addr_t alignment, unsigned int order_per_bit,
24 bool fixed, struct cma **res_cma);
25extern int cma_init_reserved_mem(phys_addr_t base,
26 phys_addr_t size, int order_per_bit,
27 struct cma **res_cma);
28extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align);
29extern bool cma_release(struct cma *cma, struct page *pages, int count);
30#endif
diff --git a/include/linux/com20020.h b/include/linux/com20020.h
index 5dcfb944b6ce..85898995b234 100644
--- a/include/linux/com20020.h
+++ b/include/linux/com20020.h
@@ -41,6 +41,35 @@ extern const struct net_device_ops com20020_netdev_ops;
41#define BUS_ALIGN 1 41#define BUS_ALIGN 1
42#endif 42#endif
43 43
44#define PLX_PCI_MAX_CARDS 2
45
46struct com20020_pci_channel_map {
47 u32 bar;
48 u32 offset;
49 u32 size; /* 0x00 - auto, e.g. length of entire bar */
50};
51
52struct com20020_pci_card_info {
53 const char *name;
54 int devcount;
55
56 struct com20020_pci_channel_map chan_map_tbl[PLX_PCI_MAX_CARDS];
57
58 unsigned int flags;
59};
60
61struct com20020_priv {
62 struct com20020_pci_card_info *ci;
63 struct list_head list_dev;
64};
65
66struct com20020_dev {
67 struct list_head list;
68 struct net_device *dev;
69
70 struct com20020_priv *pci_priv;
71 int index;
72};
44 73
45#define _INTMASK (ioaddr+BUS_ALIGN*0) /* writable */ 74#define _INTMASK (ioaddr+BUS_ALIGN*0) /* writable */
46#define _STATUS (ioaddr+BUS_ALIGN*0) /* readable */ 75#define _STATUS (ioaddr+BUS_ALIGN*0) /* readable */
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 01e3132820da..60bdf8dc02a3 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -2,14 +2,24 @@
2#define _LINUX_COMPACTION_H 2#define _LINUX_COMPACTION_H
3 3
4/* Return values for compact_zone() and try_to_compact_pages() */ 4/* Return values for compact_zone() and try_to_compact_pages() */
5/* compaction didn't start as it was deferred due to past failures */
6#define COMPACT_DEFERRED 0
5/* compaction didn't start as it was not possible or direct reclaim was more suitable */ 7/* compaction didn't start as it was not possible or direct reclaim was more suitable */
6#define COMPACT_SKIPPED 0 8#define COMPACT_SKIPPED 1
7/* compaction should continue to another pageblock */ 9/* compaction should continue to another pageblock */
8#define COMPACT_CONTINUE 1 10#define COMPACT_CONTINUE 2
9/* direct compaction partially compacted a zone and there are suitable pages */ 11/* direct compaction partially compacted a zone and there are suitable pages */
10#define COMPACT_PARTIAL 2 12#define COMPACT_PARTIAL 3
11/* The full zone was compacted */ 13/* The full zone was compacted */
12#define COMPACT_COMPLETE 3 14#define COMPACT_COMPLETE 4
15
16/* Used to signal whether compaction detected need_sched() or lock contention */
17/* No contention detected */
18#define COMPACT_CONTENDED_NONE 0
19/* Either need_sched() was true or fatal signal pending */
20#define COMPACT_CONTENDED_SCHED 1
21/* Zone lock or lru_lock was contended in async compaction */
22#define COMPACT_CONTENDED_LOCK 2
13 23
14#ifdef CONFIG_COMPACTION 24#ifdef CONFIG_COMPACTION
15extern int sysctl_compact_memory; 25extern int sysctl_compact_memory;
@@ -22,7 +32,8 @@ extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
22extern int fragmentation_index(struct zone *zone, unsigned int order); 32extern int fragmentation_index(struct zone *zone, unsigned int order);
23extern unsigned long try_to_compact_pages(struct zonelist *zonelist, 33extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
24 int order, gfp_t gfp_mask, nodemask_t *mask, 34 int order, gfp_t gfp_mask, nodemask_t *mask,
25 enum migrate_mode mode, bool *contended); 35 enum migrate_mode mode, int *contended,
36 struct zone **candidate_zone);
26extern void compact_pgdat(pg_data_t *pgdat, int order); 37extern void compact_pgdat(pg_data_t *pgdat, int order);
27extern void reset_isolation_suitable(pg_data_t *pgdat); 38extern void reset_isolation_suitable(pg_data_t *pgdat);
28extern unsigned long compaction_suitable(struct zone *zone, int order); 39extern unsigned long compaction_suitable(struct zone *zone, int order);
@@ -91,7 +102,8 @@ static inline bool compaction_restarting(struct zone *zone, int order)
91#else 102#else
92static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, 103static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
93 int order, gfp_t gfp_mask, nodemask_t *nodemask, 104 int order, gfp_t gfp_mask, nodemask_t *nodemask,
94 enum migrate_mode mode, bool *contended) 105 enum migrate_mode mode, int *contended,
106 struct zone **candidate_zone)
95{ 107{
96 return COMPACT_CONTINUE; 108 return COMPACT_CONTINUE;
97} 109}
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 2507fd2a1eb4..d1a558239b1a 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -71,7 +71,6 @@
71 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 71 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
72 * 72 *
73 * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. 73 * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
74 * Fixed in GCC 4.8.2 and later versions.
75 * 74 *
76 * (asm goto is automatically volatile - the naming reflects this.) 75 * (asm goto is automatically volatile - the naming reflects this.)
77 */ 76 */
diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h
new file mode 100644
index 000000000000..c8c565952548
--- /dev/null
+++ b/include/linux/compiler-gcc5.h
@@ -0,0 +1,65 @@
1#ifndef __LINUX_COMPILER_H
2#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
3#endif
4
5#define __used __attribute__((__used__))
6#define __must_check __attribute__((warn_unused_result))
7#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
8
9/* Mark functions as cold. gcc will assume any path leading to a call
10 to them will be unlikely. This means a lot of manual unlikely()s
11 are unnecessary now for any paths leading to the usual suspects
12 like BUG(), printk(), panic() etc. [but let's keep them for now for
13 older compilers]
14
15 Early snapshots of gcc 4.3 don't support this and we can't detect this
16 in the preprocessor, but we can live with this because they're unreleased.
17 Maketime probing would be overkill here.
18
19 gcc also has a __attribute__((__hot__)) to move hot functions into
20 a special section, but I don't see any sense in this right now in
21 the kernel context */
22#define __cold __attribute__((__cold__))
23
24#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
25
26#ifndef __CHECKER__
27# define __compiletime_warning(message) __attribute__((warning(message)))
28# define __compiletime_error(message) __attribute__((error(message)))
29#endif /* __CHECKER__ */
30
31/*
32 * Mark a position in code as unreachable. This can be used to
33 * suppress control flow warnings after asm blocks that transfer
34 * control elsewhere.
35 *
36 * Early snapshots of gcc 4.5 don't support this and we can't detect
37 * this in the preprocessor, but we can live with this because they're
38 * unreleased. Really, we need to have autoconf for the kernel.
39 */
40#define unreachable() __builtin_unreachable()
41
42/* Mark a function definition as prohibited from being cloned. */
43#define __noclone __attribute__((__noclone__))
44
45/*
46 * Tell the optimizer that something else uses this function or variable.
47 */
48#define __visible __attribute__((externally_visible))
49
50/*
51 * GCC 'asm goto' miscompiles certain code sequences:
52 *
53 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
54 *
55 * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
56 *
57 * (asm goto is automatically volatile - the naming reflects this.)
58 */
59#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
60
61#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
62#define __HAVE_BUILTIN_BSWAP32__
63#define __HAVE_BUILTIN_BSWAP64__
64#define __HAVE_BUILTIN_BSWAP16__
65#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 95978ad7fcdd..b2d9a43012b2 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -213,6 +213,7 @@ extern struct bus_type cpu_subsys;
213extern void cpu_hotplug_begin(void); 213extern void cpu_hotplug_begin(void);
214extern void cpu_hotplug_done(void); 214extern void cpu_hotplug_done(void);
215extern void get_online_cpus(void); 215extern void get_online_cpus(void);
216extern bool try_get_online_cpus(void);
216extern void put_online_cpus(void); 217extern void put_online_cpus(void);
217extern void cpu_hotplug_disable(void); 218extern void cpu_hotplug_disable(void);
218extern void cpu_hotplug_enable(void); 219extern void cpu_hotplug_enable(void);
@@ -230,6 +231,7 @@ int cpu_down(unsigned int cpu);
230static inline void cpu_hotplug_begin(void) {} 231static inline void cpu_hotplug_begin(void) {}
231static inline void cpu_hotplug_done(void) {} 232static inline void cpu_hotplug_done(void) {}
232#define get_online_cpus() do { } while (0) 233#define get_online_cpus() do { } while (0)
234#define try_get_online_cpus() true
233#define put_online_cpus() do { } while (0) 235#define put_online_cpus() do { } while (0)
234#define cpu_hotplug_disable() do { } while (0) 236#define cpu_hotplug_disable() do { } while (0)
235#define cpu_hotplug_enable() do { } while (0) 237#define cpu_hotplug_enable() do { } while (0)
diff --git a/include/linux/cpufreq-dt.h b/include/linux/cpufreq-dt.h
new file mode 100644
index 000000000000..0414009e2c30
--- /dev/null
+++ b/include/linux/cpufreq-dt.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2014 Marvell
3 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef __CPUFREQ_DT_H__
11#define __CPUFREQ_DT_H__
12
13struct cpufreq_dt_platform_data {
14 /*
15 * True when each CPU has its own clock to control its
16 * frequency, false when all CPUs are controlled by a single
17 * clock.
18 */
19 bool independent_clocks;
20};
21
22#endif /* __CPUFREQ_DT_H__ */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 7d1955afa62c..503b085b7832 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -112,6 +112,9 @@ struct cpufreq_policy {
112 spinlock_t transition_lock; 112 spinlock_t transition_lock;
113 wait_queue_head_t transition_wait; 113 wait_queue_head_t transition_wait;
114 struct task_struct *transition_task; /* Task which is doing the transition */ 114 struct task_struct *transition_task; /* Task which is doing the transition */
115
116 /* For cpufreq driver's internal use */
117 void *driver_data;
115}; 118};
116 119
117/* Only for ACPI */ 120/* Only for ACPI */
@@ -216,6 +219,7 @@ __ATTR(_name, 0644, show_##_name, store_##_name)
216struct cpufreq_driver { 219struct cpufreq_driver {
217 char name[CPUFREQ_NAME_LEN]; 220 char name[CPUFREQ_NAME_LEN];
218 u8 flags; 221 u8 flags;
222 void *driver_data;
219 223
220 /* needed by all drivers */ 224 /* needed by all drivers */
221 int (*init) (struct cpufreq_policy *policy); 225 int (*init) (struct cpufreq_policy *policy);
@@ -309,6 +313,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data);
309int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); 313int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
310 314
311const char *cpufreq_get_current_driver(void); 315const char *cpufreq_get_current_driver(void);
316void *cpufreq_get_driver_data(void);
312 317
313static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, 318static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
314 unsigned int min, unsigned int max) 319 unsigned int min, unsigned int max)
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 2997af6d2ccd..0a9a6da21e74 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -666,10 +666,19 @@ static inline size_t cpumask_size(void)
666 * 666 *
667 * This code makes NR_CPUS length memcopy and brings to a memory corruption. 667 * This code makes NR_CPUS length memcopy and brings to a memory corruption.
668 * cpumask_copy() provide safe copy functionality. 668 * cpumask_copy() provide safe copy functionality.
669 *
670 * Note that there is another evil here: If you define a cpumask_var_t
671 * as a percpu variable then the way to obtain the address of the cpumask
672 * structure differently influences what this_cpu_* operation needs to be
673 * used. Please use this_cpu_cpumask_var_t in those cases. The direct use
674 * of this_cpu_ptr() or this_cpu_read() will lead to failures when the
675 * other type of cpumask_var_t implementation is configured.
669 */ 676 */
670#ifdef CONFIG_CPUMASK_OFFSTACK 677#ifdef CONFIG_CPUMASK_OFFSTACK
671typedef struct cpumask *cpumask_var_t; 678typedef struct cpumask *cpumask_var_t;
672 679
680#define this_cpu_cpumask_var_ptr(x) this_cpu_read(x)
681
673bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node); 682bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
674bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); 683bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
675bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node); 684bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
@@ -681,6 +690,8 @@ void free_bootmem_cpumask_var(cpumask_var_t mask);
681#else 690#else
682typedef struct cpumask cpumask_var_t[1]; 691typedef struct cpumask cpumask_var_t[1];
683 692
693#define this_cpu_cpumask_var_ptr(x) this_cpu_ptr(x)
694
684static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) 695static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
685{ 696{
686 return true; 697 return true;
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index ade2390ffe92..2f073db7392e 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -86,19 +86,20 @@ extern void __cpuset_memory_pressure_bump(void);
86 86
87extern void cpuset_task_status_allowed(struct seq_file *m, 87extern void cpuset_task_status_allowed(struct seq_file *m,
88 struct task_struct *task); 88 struct task_struct *task);
89extern int proc_cpuset_show(struct seq_file *, void *); 89extern int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns,
90 struct pid *pid, struct task_struct *tsk);
90 91
91extern int cpuset_mem_spread_node(void); 92extern int cpuset_mem_spread_node(void);
92extern int cpuset_slab_spread_node(void); 93extern int cpuset_slab_spread_node(void);
93 94
94static inline int cpuset_do_page_mem_spread(void) 95static inline int cpuset_do_page_mem_spread(void)
95{ 96{
96 return current->flags & PF_SPREAD_PAGE; 97 return task_spread_page(current);
97} 98}
98 99
99static inline int cpuset_do_slab_mem_spread(void) 100static inline int cpuset_do_slab_mem_spread(void)
100{ 101{
101 return current->flags & PF_SPREAD_SLAB; 102 return task_spread_slab(current);
102} 103}
103 104
104extern int current_cpuset_is_being_rebound(void); 105extern int current_cpuset_is_being_rebound(void);
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 72ab536ad3de..3849fce7ecfe 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -14,14 +14,13 @@
14extern unsigned long long elfcorehdr_addr; 14extern unsigned long long elfcorehdr_addr;
15extern unsigned long long elfcorehdr_size; 15extern unsigned long long elfcorehdr_size;
16 16
17extern int __weak elfcorehdr_alloc(unsigned long long *addr, 17extern int elfcorehdr_alloc(unsigned long long *addr, unsigned long long *size);
18 unsigned long long *size); 18extern void elfcorehdr_free(unsigned long long addr);
19extern void __weak elfcorehdr_free(unsigned long long addr); 19extern ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos);
20extern ssize_t __weak elfcorehdr_read(char *buf, size_t count, u64 *ppos); 20extern ssize_t elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos);
21extern ssize_t __weak elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos); 21extern int remap_oldmem_pfn_range(struct vm_area_struct *vma,
22extern int __weak remap_oldmem_pfn_range(struct vm_area_struct *vma, 22 unsigned long from, unsigned long pfn,
23 unsigned long from, unsigned long pfn, 23 unsigned long size, pgprot_t prot);
24 unsigned long size, pgprot_t prot);
25 24
26extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 25extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
27 unsigned long, int); 26 unsigned long, int);
diff --git a/include/linux/crc-t10dif.h b/include/linux/crc-t10dif.h
index b3cb71f0d3b0..cf53d0773ce3 100644
--- a/include/linux/crc-t10dif.h
+++ b/include/linux/crc-t10dif.h
@@ -6,7 +6,8 @@
6#define CRC_T10DIF_DIGEST_SIZE 2 6#define CRC_T10DIF_DIGEST_SIZE 2
7#define CRC_T10DIF_BLOCK_SIZE 1 7#define CRC_T10DIF_BLOCK_SIZE 1
8 8
9__u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer, size_t len); 9extern __u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer,
10__u16 crc_t10dif(unsigned char const *, size_t); 10 size_t len);
11extern __u16 crc_t10dif(unsigned char const *, size_t);
11 12
12#endif 13#endif
diff --git a/include/linux/cred.h b/include/linux/cred.h
index f61d6c8f5ef3..b2d0820837c4 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -259,6 +259,15 @@ static inline void put_cred(const struct cred *_cred)
259 rcu_dereference_protected(current->cred, 1) 259 rcu_dereference_protected(current->cred, 1)
260 260
261/** 261/**
262 * current_real_cred - Access the current task's objective credentials
263 *
264 * Access the objective credentials of the current task. RCU-safe,
265 * since nobody else can modify it.
266 */
267#define current_real_cred() \
268 rcu_dereference_protected(current->real_cred, 1)
269
270/**
262 * __task_cred - Access a task's objective credentials 271 * __task_cred - Access a task's objective credentials
263 * @task: The task to query 272 * @task: The task to query
264 * 273 *
diff --git a/include/linux/cycx_x25.h b/include/linux/cycx_x25.h
deleted file mode 100644
index 362bf19d6cf1..000000000000
--- a/include/linux/cycx_x25.h
+++ /dev/null
@@ -1,125 +0,0 @@
1#ifndef _CYCX_X25_H
2#define _CYCX_X25_H
3/*
4* cycx_x25.h Cyclom X.25 firmware API definitions.
5*
6* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
7*
8* Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
9*
10* Based on sdla_x25.h by Gene Kozin <74604.152@compuserve.com>
11*
12* This program is free software; you can redistribute it and/or
13* modify it under the terms of the GNU General Public License
14* as published by the Free Software Foundation; either version
15* 2 of the License, or (at your option) any later version.
16* ============================================================================
17* 2000/04/02 acme dprintk and cycx_debug
18* 1999/01/03 acme judicious use of data types
19* 1999/01/02 acme #define X25_ACK_N3 0x4411
20* 1998/12/28 acme cleanup: lot'o'things removed
21* commands listed,
22* TX25Cmd & TX25Config structs
23* typedef'ed
24*/
25#ifndef PACKED
26#define PACKED __attribute__((packed))
27#endif
28
29/* X.25 shared memory layout. */
30#define X25_MBOX_OFFS 0x300 /* general mailbox block */
31#define X25_RXMBOX_OFFS 0x340 /* receive mailbox */
32
33/* Debug */
34#define dprintk(level, format, a...) if (cycx_debug >= level) printk(format, ##a)
35
36extern unsigned int cycx_debug;
37
38/* Data Structures */
39/* X.25 Command Block. */
40struct cycx_x25_cmd {
41 u16 command;
42 u16 link; /* values: 0 or 1 */
43 u16 len; /* values: 0 thru 0x205 (517) */
44 u32 buf;
45} PACKED;
46
47/* Defines for the 'command' field. */
48#define X25_CONNECT_REQUEST 0x4401
49#define X25_CONNECT_RESPONSE 0x4402
50#define X25_DISCONNECT_REQUEST 0x4403
51#define X25_DISCONNECT_RESPONSE 0x4404
52#define X25_DATA_REQUEST 0x4405
53#define X25_ACK_TO_VC 0x4406
54#define X25_INTERRUPT_RESPONSE 0x4407
55#define X25_CONFIG 0x4408
56#define X25_CONNECT_INDICATION 0x4409
57#define X25_CONNECT_CONFIRM 0x440A
58#define X25_DISCONNECT_INDICATION 0x440B
59#define X25_DISCONNECT_CONFIRM 0x440C
60#define X25_DATA_INDICATION 0x440E
61#define X25_INTERRUPT_INDICATION 0x440F
62#define X25_ACK_FROM_VC 0x4410
63#define X25_ACK_N3 0x4411
64#define X25_CONNECT_COLLISION 0x4413
65#define X25_N3WIN 0x4414
66#define X25_LINE_ON 0x4415
67#define X25_LINE_OFF 0x4416
68#define X25_RESET_REQUEST 0x4417
69#define X25_LOG 0x4500
70#define X25_STATISTIC 0x4600
71#define X25_TRACE 0x4700
72#define X25_N2TRACEXC 0x4702
73#define X25_N3TRACEXC 0x4703
74
75/**
76 * struct cycx_x25_config - cyclom2x x25 firmware configuration
77 * @link - link number
78 * @speed - line speed
79 * @clock - internal/external
80 * @n2 - # of level 2 retransm.(values: 1 thru FF)
81 * @n2win - level 2 window (values: 1 thru 7)
82 * @n3win - level 3 window (values: 1 thru 7)
83 * @nvc - # of logical channels (values: 1 thru 64)
84 * @pktlen - level 3 packet length - log base 2 of size
85 * @locaddr - my address
86 * @remaddr - remote address
87 * @t1 - time, in seconds
88 * @t2 - time, in seconds
89 * @t21 - time, in seconds
90 * @npvc - # of permanent virt. circuits (1 thru nvc)
91 * @t23 - time, in seconds
92 * @flags - see dosx25.doc, in portuguese, for details
93 */
94struct cycx_x25_config {
95 u8 link;
96 u8 speed;
97 u8 clock;
98 u8 n2;
99 u8 n2win;
100 u8 n3win;
101 u8 nvc;
102 u8 pktlen;
103 u8 locaddr;
104 u8 remaddr;
105 u16 t1;
106 u16 t2;
107 u8 t21;
108 u8 npvc;
109 u8 t23;
110 u8 flags;
111} PACKED;
112
113struct cycx_x25_stats {
114 u16 rx_crc_errors;
115 u16 rx_over_errors;
116 u16 n2_tx_frames;
117 u16 n2_rx_frames;
118 u16 tx_timeouts;
119 u16 rx_timeouts;
120 u16 n3_tx_packets;
121 u16 n3_rx_packets;
122 u16 tx_aborts;
123 u16 rx_aborts;
124} PACKED;
125#endif /* _CYCX_X25_H */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 3c7ec327ebd2..b2a2a08523bf 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -11,7 +11,6 @@
11#include <linux/rcupdate.h> 11#include <linux/rcupdate.h>
12#include <linux/lockref.h> 12#include <linux/lockref.h>
13 13
14struct nameidata;
15struct path; 14struct path;
16struct vfsmount; 15struct vfsmount;
17 16
@@ -55,6 +54,7 @@ struct qstr {
55#define QSTR_INIT(n,l) { { { .len = l } }, .name = n } 54#define QSTR_INIT(n,l) { { { .len = l } }, .name = n }
56#define hashlen_hash(hashlen) ((u32) (hashlen)) 55#define hashlen_hash(hashlen) ((u32) (hashlen))
57#define hashlen_len(hashlen) ((u32)((hashlen) >> 32)) 56#define hashlen_len(hashlen) ((u32)((hashlen) >> 32))
57#define hashlen_create(hash,len) (((u64)(len)<<32)|(u32)(hash))
58 58
59struct dentry_stat_t { 59struct dentry_stat_t {
60 long nr_dentry; 60 long nr_dentry;
@@ -225,11 +225,6 @@ struct dentry_operations {
225 225
226extern seqlock_t rename_lock; 226extern seqlock_t rename_lock;
227 227
228static inline int dname_external(const struct dentry *dentry)
229{
230 return dentry->d_name.name != dentry->d_iname;
231}
232
233/* 228/*
234 * These are the low-level FS interfaces to the dcache.. 229 * These are the low-level FS interfaces to the dcache..
235 */ 230 */
@@ -249,10 +244,11 @@ extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
249extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); 244extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *);
250extern struct dentry *d_find_any_alias(struct inode *inode); 245extern struct dentry *d_find_any_alias(struct inode *inode);
251extern struct dentry * d_obtain_alias(struct inode *); 246extern struct dentry * d_obtain_alias(struct inode *);
247extern struct dentry * d_obtain_root(struct inode *);
252extern void shrink_dcache_sb(struct super_block *); 248extern void shrink_dcache_sb(struct super_block *);
253extern void shrink_dcache_parent(struct dentry *); 249extern void shrink_dcache_parent(struct dentry *);
254extern void shrink_dcache_for_umount(struct super_block *); 250extern void shrink_dcache_for_umount(struct super_block *);
255extern int d_invalidate(struct dentry *); 251extern void d_invalidate(struct dentry *);
256 252
257/* only used at mount-time */ 253/* only used at mount-time */
258extern struct dentry * d_make_root(struct inode *); 254extern struct dentry * d_make_root(struct inode *);
@@ -267,7 +263,6 @@ extern void d_prune_aliases(struct inode *);
267 263
268/* test whether we have any submounts in a subdir tree */ 264/* test whether we have any submounts in a subdir tree */
269extern int have_submounts(struct dentry *); 265extern int have_submounts(struct dentry *);
270extern int check_submounts_and_drop(struct dentry *);
271 266
272/* 267/*
273 * This adds the entry to the hash queues. 268 * This adds the entry to the hash queues.
diff --git a/include/linux/decompress/bunzip2.h b/include/linux/decompress/bunzip2.h
index 115272137a9c..4d683df898e6 100644
--- a/include/linux/decompress/bunzip2.h
+++ b/include/linux/decompress/bunzip2.h
@@ -1,10 +1,10 @@
1#ifndef DECOMPRESS_BUNZIP2_H 1#ifndef DECOMPRESS_BUNZIP2_H
2#define DECOMPRESS_BUNZIP2_H 2#define DECOMPRESS_BUNZIP2_H
3 3
4int bunzip2(unsigned char *inbuf, int len, 4int bunzip2(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/generic.h b/include/linux/decompress/generic.h
index 0c7111a55a1a..1fcfd64b5076 100644
--- a/include/linux/decompress/generic.h
+++ b/include/linux/decompress/generic.h
@@ -1,11 +1,11 @@
1#ifndef DECOMPRESS_GENERIC_H 1#ifndef DECOMPRESS_GENERIC_H
2#define DECOMPRESS_GENERIC_H 2#define DECOMPRESS_GENERIC_H
3 3
4typedef int (*decompress_fn) (unsigned char *inbuf, int len, 4typedef int (*decompress_fn) (unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *outbuf, 7 unsigned char *outbuf,
8 int *posp, 8 long *posp,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10 10
11/* inbuf - input buffer 11/* inbuf - input buffer
@@ -33,7 +33,7 @@ typedef int (*decompress_fn) (unsigned char *inbuf, int len,
33 33
34 34
35/* Utility routine to detect the decompression method */ 35/* Utility routine to detect the decompression method */
36decompress_fn decompress_method(const unsigned char *inbuf, int len, 36decompress_fn decompress_method(const unsigned char *inbuf, long len,
37 const char **name); 37 const char **name);
38 38
39#endif 39#endif
diff --git a/include/linux/decompress/inflate.h b/include/linux/decompress/inflate.h
index 1d0aedef9822..e4f411fdbd24 100644
--- a/include/linux/decompress/inflate.h
+++ b/include/linux/decompress/inflate.h
@@ -1,10 +1,10 @@
1#ifndef LINUX_DECOMPRESS_INFLATE_H 1#ifndef LINUX_DECOMPRESS_INFLATE_H
2#define LINUX_DECOMPRESS_INFLATE_H 2#define LINUX_DECOMPRESS_INFLATE_H
3 3
4int gunzip(unsigned char *inbuf, int len, 4int gunzip(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error_fn)(char *x)); 9 void(*error_fn)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/unlz4.h b/include/linux/decompress/unlz4.h
index d5b68bf3ec92..3273c2f36496 100644
--- a/include/linux/decompress/unlz4.h
+++ b/include/linux/decompress/unlz4.h
@@ -1,10 +1,10 @@
1#ifndef DECOMPRESS_UNLZ4_H 1#ifndef DECOMPRESS_UNLZ4_H
2#define DECOMPRESS_UNLZ4_H 2#define DECOMPRESS_UNLZ4_H
3 3
4int unlz4(unsigned char *inbuf, int len, 4int unlz4(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/unlzma.h b/include/linux/decompress/unlzma.h
index 7796538f1bf4..8a891a193840 100644
--- a/include/linux/decompress/unlzma.h
+++ b/include/linux/decompress/unlzma.h
@@ -1,11 +1,11 @@
1#ifndef DECOMPRESS_UNLZMA_H 1#ifndef DECOMPRESS_UNLZMA_H
2#define DECOMPRESS_UNLZMA_H 2#define DECOMPRESS_UNLZMA_H
3 3
4int unlzma(unsigned char *, int, 4int unlzma(unsigned char *, long,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *posp, 8 long *posp,
9 void(*error)(char *x) 9 void(*error)(char *x)
10 ); 10 );
11 11
diff --git a/include/linux/decompress/unlzo.h b/include/linux/decompress/unlzo.h
index 987229752519..af18f95d6570 100644
--- a/include/linux/decompress/unlzo.h
+++ b/include/linux/decompress/unlzo.h
@@ -1,10 +1,10 @@
1#ifndef DECOMPRESS_UNLZO_H 1#ifndef DECOMPRESS_UNLZO_H
2#define DECOMPRESS_UNLZO_H 2#define DECOMPRESS_UNLZO_H
3 3
4int unlzo(unsigned char *inbuf, int len, 4int unlzo(unsigned char *inbuf, long len,
5 int(*fill)(void*, unsigned int), 5 long (*fill)(void*, unsigned long),
6 int(*flush)(void*, unsigned int), 6 long (*flush)(void*, unsigned long),
7 unsigned char *output, 7 unsigned char *output,
8 int *pos, 8 long *pos,
9 void(*error)(char *x)); 9 void(*error)(char *x));
10#endif 10#endif
diff --git a/include/linux/decompress/unxz.h b/include/linux/decompress/unxz.h
index 41728fc6c8a1..f764e2a7201e 100644
--- a/include/linux/decompress/unxz.h
+++ b/include/linux/decompress/unxz.h
@@ -10,10 +10,10 @@
10#ifndef DECOMPRESS_UNXZ_H 10#ifndef DECOMPRESS_UNXZ_H
11#define DECOMPRESS_UNXZ_H 11#define DECOMPRESS_UNXZ_H
12 12
13int unxz(unsigned char *in, int in_size, 13int unxz(unsigned char *in, long in_size,
14 int (*fill)(void *dest, unsigned int size), 14 long (*fill)(void *dest, unsigned long size),
15 int (*flush)(void *src, unsigned int size), 15 long (*flush)(void *src, unsigned long size),
16 unsigned char *out, int *in_used, 16 unsigned char *out, long *in_used,
17 void (*error)(char *x)); 17 void (*error)(char *x));
18 18
19#endif 19#endif
diff --git a/include/linux/devcoredump.h b/include/linux/devcoredump.h
new file mode 100644
index 000000000000..c0a360e99f64
--- /dev/null
+++ b/include/linux/devcoredump.h
@@ -0,0 +1,35 @@
1#ifndef __DEVCOREDUMP_H
2#define __DEVCOREDUMP_H
3
4#include <linux/device.h>
5#include <linux/module.h>
6#include <linux/vmalloc.h>
7
8#ifdef CONFIG_DEV_COREDUMP
9void dev_coredumpv(struct device *dev, const void *data, size_t datalen,
10 gfp_t gfp);
11
12void dev_coredumpm(struct device *dev, struct module *owner,
13 const void *data, size_t datalen, gfp_t gfp,
14 ssize_t (*read)(char *buffer, loff_t offset, size_t count,
15 const void *data, size_t datalen),
16 void (*free)(const void *data));
17#else
18static inline void dev_coredumpv(struct device *dev, const void *data,
19 size_t datalen, gfp_t gfp)
20{
21 vfree(data);
22}
23
24static inline void
25dev_coredumpm(struct device *dev, struct module *owner,
26 const void *data, size_t datalen, gfp_t gfp,
27 ssize_t (*read)(char *buffer, loff_t offset, size_t count,
28 const void *data, size_t datalen),
29 void (*free)(const void *data))
30{
31 free(data);
32}
33#endif /* CONFIG_DEV_COREDUMP */
34
35#endif /* __DEVCOREDUMP_H */
diff --git a/include/linux/device.h b/include/linux/device.h
index 43d183aeb25b..ce1f21608b16 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -181,13 +181,14 @@ extern int bus_unregister_notifier(struct bus_type *bus,
181 * with the device lock held in the core, so be careful. 181 * with the device lock held in the core, so be careful.
182 */ 182 */
183#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ 183#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */
184#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ 184#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device to be removed */
185#define BUS_NOTIFY_BIND_DRIVER 0x00000003 /* driver about to be 185#define BUS_NOTIFY_REMOVED_DEVICE 0x00000003 /* device removed */
186#define BUS_NOTIFY_BIND_DRIVER 0x00000004 /* driver about to be
186 bound */ 187 bound */
187#define BUS_NOTIFY_BOUND_DRIVER 0x00000004 /* driver bound to device */ 188#define BUS_NOTIFY_BOUND_DRIVER 0x00000005 /* driver bound to device */
188#define BUS_NOTIFY_UNBIND_DRIVER 0x00000005 /* driver about to be 189#define BUS_NOTIFY_UNBIND_DRIVER 0x00000006 /* driver about to be
189 unbound */ 190 unbound */
190#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000006 /* driver is unbound 191#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000007 /* driver is unbound
191 from the device */ 192 from the device */
192 193
193extern struct kset *bus_get_kset(struct bus_type *bus); 194extern struct kset *bus_get_kset(struct bus_type *bus);
@@ -607,8 +608,8 @@ extern int devres_release_group(struct device *dev, void *id);
607extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp); 608extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp);
608extern char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, 609extern char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt,
609 va_list ap); 610 va_list ap);
610extern char *devm_kasprintf(struct device *dev, gfp_t gfp, 611extern __printf(3, 4)
611 const char *fmt, ...); 612char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...);
612static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) 613static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
613{ 614{
614 return devm_kmalloc(dev, size, gfp | __GFP_ZERO); 615 return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
index 772eab5d524a..569bbd039896 100644
--- a/include/linux/dma-contiguous.h
+++ b/include/linux/dma-contiguous.h
@@ -53,18 +53,13 @@
53 53
54#ifdef __KERNEL__ 54#ifdef __KERNEL__
55 55
56#include <linux/device.h>
57
56struct cma; 58struct cma;
57struct page; 59struct page;
58struct device;
59 60
60#ifdef CONFIG_DMA_CMA 61#ifdef CONFIG_DMA_CMA
61 62
62/*
63 * There is always at least global CMA area and a few optional device
64 * private areas configured in kernel .config.
65 */
66#define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS)
67
68extern struct cma *dma_contiguous_default_area; 63extern struct cma *dma_contiguous_default_area;
69 64
70static inline struct cma *dev_get_cma_area(struct device *dev) 65static inline struct cma *dev_get_cma_area(struct device *dev)
@@ -123,8 +118,6 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages,
123 118
124#else 119#else
125 120
126#define MAX_CMA_AREAS (0)
127
128static inline struct cma *dev_get_cma_area(struct device *dev) 121static inline struct cma *dev_get_cma_area(struct device *dev)
129{ 122{
130 return NULL; 123 return NULL;
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 931b70986272..d5d388160f42 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -263,6 +263,32 @@ struct dma_attrs;
263#define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \ 263#define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \
264 dma_unmap_sg(dev, sgl, nents, dir) 264 dma_unmap_sg(dev, sgl, nents, dir)
265 265
266#else
267static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
268 dma_addr_t *dma_addr, gfp_t gfp)
269{
270 DEFINE_DMA_ATTRS(attrs);
271 dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
272 return dma_alloc_attrs(dev, size, dma_addr, gfp, &attrs);
273}
274
275static inline void dma_free_writecombine(struct device *dev, size_t size,
276 void *cpu_addr, dma_addr_t dma_addr)
277{
278 DEFINE_DMA_ATTRS(attrs);
279 dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
280 return dma_free_attrs(dev, size, cpu_addr, dma_addr, &attrs);
281}
282
283static inline int dma_mmap_writecombine(struct device *dev,
284 struct vm_area_struct *vma,
285 void *cpu_addr, dma_addr_t dma_addr,
286 size_t size)
287{
288 DEFINE_DMA_ATTRS(attrs);
289 dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
290 return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
291}
266#endif /* CONFIG_HAVE_DMA_ATTRS */ 292#endif /* CONFIG_HAVE_DMA_ATTRS */
267 293
268#ifdef CONFIG_NEED_DMA_MAP_STATE 294#ifdef CONFIG_NEED_DMA_MAP_STATE
diff --git a/include/linux/dma/dw.h b/include/linux/dma/dw.h
new file mode 100644
index 000000000000..71456442ebe3
--- /dev/null
+++ b/include/linux/dma/dw.h
@@ -0,0 +1,64 @@
1/*
2 * Driver for the Synopsys DesignWare DMA Controller
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 * Copyright (C) 2010-2011 ST Microelectronics
6 * Copyright (C) 2014 Intel Corporation
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef _DMA_DW_H
13#define _DMA_DW_H
14
15#include <linux/clk.h>
16#include <linux/device.h>
17#include <linux/dmaengine.h>
18
19#include <linux/platform_data/dma-dw.h>
20
21struct dw_dma;
22
23/**
24 * struct dw_dma_chip - representation of DesignWare DMA controller hardware
25 * @dev: struct device of the DMA controller
26 * @irq: irq line
27 * @regs: memory mapped I/O space
28 * @clk: hclk clock
29 * @dw: struct dw_dma that is filed by dw_dma_probe()
30 */
31struct dw_dma_chip {
32 struct device *dev;
33 int irq;
34 void __iomem *regs;
35 struct clk *clk;
36 struct dw_dma *dw;
37};
38
39/* Export to the platform drivers */
40int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata);
41int dw_dma_remove(struct dw_dma_chip *chip);
42
43/* DMA API extensions */
44struct dw_desc;
45
46struct dw_cyclic_desc {
47 struct dw_desc **desc;
48 unsigned long periods;
49 void (*period_callback)(void *param);
50 void *period_callback_param;
51};
52
53struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
54 dma_addr_t buf_addr, size_t buf_len, size_t period_len,
55 enum dma_transfer_direction direction);
56void dw_dma_cyclic_free(struct dma_chan *chan);
57int dw_dma_cyclic_start(struct dma_chan *chan);
58void dw_dma_cyclic_stop(struct dma_chan *chan);
59
60dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan);
61
62dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan);
63
64#endif /* _DMA_DW_H */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 3d1c2aa51530..653a1fd07ae8 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -37,7 +37,6 @@
37 */ 37 */
38typedef s32 dma_cookie_t; 38typedef s32 dma_cookie_t;
39#define DMA_MIN_COOKIE 1 39#define DMA_MIN_COOKIE 1
40#define DMA_MAX_COOKIE INT_MAX
41 40
42static inline int dma_submit_error(dma_cookie_t cookie) 41static inline int dma_submit_error(dma_cookie_t cookie)
43{ 42{
@@ -200,15 +199,12 @@ enum dma_ctrl_flags {
200 * configuration data in statically from the platform). An additional 199 * configuration data in statically from the platform). An additional
201 * argument of struct dma_slave_config must be passed in with this 200 * argument of struct dma_slave_config must be passed in with this
202 * command. 201 * command.
203 * @FSLDMA_EXTERNAL_START: this command will put the Freescale DMA controller
204 * into external start mode.
205 */ 202 */
206enum dma_ctrl_cmd { 203enum dma_ctrl_cmd {
207 DMA_TERMINATE_ALL, 204 DMA_TERMINATE_ALL,
208 DMA_PAUSE, 205 DMA_PAUSE,
209 DMA_RESUME, 206 DMA_RESUME,
210 DMA_SLAVE_CONFIG, 207 DMA_SLAVE_CONFIG,
211 FSLDMA_EXTERNAL_START,
212}; 208};
213 209
214/** 210/**
@@ -308,7 +304,9 @@ enum dma_slave_buswidth {
308 * struct dma_slave_config - dma slave channel runtime config 304 * struct dma_slave_config - dma slave channel runtime config
309 * @direction: whether the data shall go in or out on this slave 305 * @direction: whether the data shall go in or out on this slave
310 * channel, right now. DMA_MEM_TO_DEV and DMA_DEV_TO_MEM are 306 * channel, right now. DMA_MEM_TO_DEV and DMA_DEV_TO_MEM are
311 * legal values. 307 * legal values. DEPRECATED, drivers should use the direction argument
308 * to the device_prep_slave_sg and device_prep_dma_cyclic functions or
309 * the dir field in the dma_interleaved_template structure.
312 * @src_addr: this is the physical address where DMA slave data 310 * @src_addr: this is the physical address where DMA slave data
313 * should be read (RX), if the source is memory this argument is 311 * should be read (RX), if the source is memory this argument is
314 * ignored. 312 * ignored.
@@ -671,7 +669,7 @@ struct dma_device {
671 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)( 669 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
672 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, 670 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
673 size_t period_len, enum dma_transfer_direction direction, 671 size_t period_len, enum dma_transfer_direction direction,
674 unsigned long flags, void *context); 672 unsigned long flags);
675 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)( 673 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)(
676 struct dma_chan *chan, struct dma_interleaved_template *xt, 674 struct dma_chan *chan, struct dma_interleaved_template *xt,
677 unsigned long flags); 675 unsigned long flags);
@@ -746,7 +744,7 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic(
746 unsigned long flags) 744 unsigned long flags)
747{ 745{
748 return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len, 746 return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len,
749 period_len, dir, flags, NULL); 747 period_len, dir, flags);
750} 748}
751 749
752static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma( 750static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma(
@@ -756,6 +754,16 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma(
756 return chan->device->device_prep_interleaved_dma(chan, xt, flags); 754 return chan->device->device_prep_interleaved_dma(chan, xt, flags);
757} 755}
758 756
757static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_sg(
758 struct dma_chan *chan,
759 struct scatterlist *dst_sg, unsigned int dst_nents,
760 struct scatterlist *src_sg, unsigned int src_nents,
761 unsigned long flags)
762{
763 return chan->device->device_prep_dma_sg(chan, dst_sg, dst_nents,
764 src_sg, src_nents, flags);
765}
766
759static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps) 767static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
760{ 768{
761 if (!chan || !caps) 769 if (!chan || !caps)
@@ -901,18 +909,6 @@ static inline void dmaengine_put(void)
901} 909}
902#endif 910#endif
903 911
904#ifdef CONFIG_NET_DMA
905#define net_dmaengine_get() dmaengine_get()
906#define net_dmaengine_put() dmaengine_put()
907#else
908static inline void net_dmaengine_get(void)
909{
910}
911static inline void net_dmaengine_put(void)
912{
913}
914#endif
915
916#ifdef CONFIG_ASYNC_TX_DMA 912#ifdef CONFIG_ASYNC_TX_DMA
917#define async_dmaengine_get() dmaengine_get() 913#define async_dmaengine_get() dmaengine_get()
918#define async_dmaengine_put() dmaengine_put() 914#define async_dmaengine_put() dmaengine_put()
@@ -934,16 +930,8 @@ async_dma_find_channel(enum dma_transaction_type type)
934 return NULL; 930 return NULL;
935} 931}
936#endif /* CONFIG_ASYNC_TX_DMA */ 932#endif /* CONFIG_ASYNC_TX_DMA */
937
938dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
939 void *dest, void *src, size_t len);
940dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
941 struct page *page, unsigned int offset, void *kdata, size_t len);
942dma_cookie_t dma_async_memcpy_pg_to_pg(struct dma_chan *chan,
943 struct page *dest_pg, unsigned int dest_off, struct page *src_pg,
944 unsigned int src_off, size_t len);
945void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx, 933void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx,
946 struct dma_chan *chan); 934 struct dma_chan *chan);
947 935
948static inline void async_tx_ack(struct dma_async_tx_descriptor *tx) 936static inline void async_tx_ack(struct dma_async_tx_descriptor *tx)
949{ 937{
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 1deece46a0ca..593fff99e6bf 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -56,13 +56,19 @@ struct dmar_drhd_unit {
56 struct intel_iommu *iommu; 56 struct intel_iommu *iommu;
57}; 57};
58 58
59struct dmar_pci_path {
60 u8 bus;
61 u8 device;
62 u8 function;
63};
64
59struct dmar_pci_notify_info { 65struct dmar_pci_notify_info {
60 struct pci_dev *dev; 66 struct pci_dev *dev;
61 unsigned long event; 67 unsigned long event;
62 int bus; 68 int bus;
63 u16 seg; 69 u16 seg;
64 u16 level; 70 u16 level;
65 struct acpi_dmar_pci_path path[]; 71 struct dmar_pci_path path[];
66} __attribute__((packed)); 72} __attribute__((packed));
67 73
68extern struct rw_semaphore dmar_global_lock; 74extern struct rw_semaphore dmar_global_lock;
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 3dbe9bd57a09..debb70d40547 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -52,7 +52,7 @@
52#endif 52#endif
53 53
54extern const char *drbd_buildtag(void); 54extern const char *drbd_buildtag(void);
55#define REL_VERSION "8.4.3" 55#define REL_VERSION "8.4.5"
56#define API_VERSION 1 56#define API_VERSION 1
57#define PRO_VERSION_MIN 86 57#define PRO_VERSION_MIN 86
58#define PRO_VERSION_MAX 101 58#define PRO_VERSION_MAX 101
@@ -245,7 +245,7 @@ enum drbd_disk_state {
245 D_DISKLESS, 245 D_DISKLESS,
246 D_ATTACHING, /* In the process of reading the meta-data */ 246 D_ATTACHING, /* In the process of reading the meta-data */
247 D_FAILED, /* Becomes D_DISKLESS as soon as we told it the peer */ 247 D_FAILED, /* Becomes D_DISKLESS as soon as we told it the peer */
248 /* when >= D_FAILED it is legal to access mdev->bc */ 248 /* when >= D_FAILED it is legal to access mdev->ldev */
249 D_NEGOTIATING, /* Late attaching state, we need to talk to the peer */ 249 D_NEGOTIATING, /* Late attaching state, we need to talk to the peer */
250 D_INCONSISTENT, 250 D_INCONSISTENT,
251 D_OUTDATED, 251 D_OUTDATED,
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
index 4193f5f2636c..7b131ed8f9c6 100644
--- a/include/linux/drbd_genl.h
+++ b/include/linux/drbd_genl.h
@@ -171,6 +171,10 @@ GENL_struct(DRBD_NLA_NET_CONF, 5, net_conf,
171 __flg_field(28, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, tentative) 171 __flg_field(28, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, tentative)
172 __flg_field_def(29, DRBD_GENLA_F_MANDATORY, use_rle, DRBD_USE_RLE_DEF) 172 __flg_field_def(29, DRBD_GENLA_F_MANDATORY, use_rle, DRBD_USE_RLE_DEF)
173 /* 9: __u32_field_def(30, DRBD_GENLA_F_MANDATORY, fencing_policy, DRBD_FENCING_DEF) */ 173 /* 9: __u32_field_def(30, DRBD_GENLA_F_MANDATORY, fencing_policy, DRBD_FENCING_DEF) */
174 /* 9: __str_field_def(31, DRBD_GENLA_F_MANDATORY, name, SHARED_SECRET_MAX) */
175 /* 9: __u32_field(32, DRBD_F_REQUIRED | DRBD_F_INVARIANT, peer_node_id) */
176 __flg_field_def(33, 0 /* OPTIONAL */, csums_after_crash_only, DRBD_CSUMS_AFTER_CRASH_ONLY_DEF)
177 __u32_field_def(34, 0 /* OPTIONAL */, sock_check_timeo, DRBD_SOCKET_CHECK_TIMEO_DEF)
174) 178)
175 179
176GENL_struct(DRBD_NLA_SET_ROLE_PARMS, 6, set_role_parms, 180GENL_struct(DRBD_NLA_SET_ROLE_PARMS, 6, set_role_parms,
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 17e50bb00521..8ac8c5d9a3ad 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -214,6 +214,7 @@
214#define DRBD_ALLOW_TWO_PRIMARIES_DEF 0 214#define DRBD_ALLOW_TWO_PRIMARIES_DEF 0
215#define DRBD_ALWAYS_ASBP_DEF 0 215#define DRBD_ALWAYS_ASBP_DEF 0
216#define DRBD_USE_RLE_DEF 1 216#define DRBD_USE_RLE_DEF 1
217#define DRBD_CSUMS_AFTER_CRASH_ONLY_DEF 0
217 218
218#define DRBD_AL_STRIPES_MIN 1 219#define DRBD_AL_STRIPES_MIN 1
219#define DRBD_AL_STRIPES_MAX 1024 220#define DRBD_AL_STRIPES_MAX 1024
@@ -224,4 +225,9 @@
224#define DRBD_AL_STRIPE_SIZE_MAX 16777216 225#define DRBD_AL_STRIPE_SIZE_MAX 16777216
225#define DRBD_AL_STRIPE_SIZE_DEF 32 226#define DRBD_AL_STRIPE_SIZE_DEF 32
226#define DRBD_AL_STRIPE_SIZE_SCALE 'k' /* kilobytes */ 227#define DRBD_AL_STRIPE_SIZE_SCALE 'k' /* kilobytes */
228
229#define DRBD_SOCKET_CHECK_TIMEO_MIN 0
230#define DRBD_SOCKET_CHECK_TIMEO_MAX DRBD_PING_TIMEO_MAX
231#define DRBD_SOCKET_CHECK_TIMEO_DEF 0
232#define DRBD_SOCKET_CHECK_TIMEO_SCALE '1'
227#endif 233#endif
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
deleted file mode 100644
index 68b4024184de..000000000000
--- a/include/linux/dw_dmac.h
+++ /dev/null
@@ -1,111 +0,0 @@
1/*
2 * Driver for the Synopsys DesignWare DMA Controller
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 * Copyright (C) 2010-2011 ST Microelectronics
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef DW_DMAC_H
12#define DW_DMAC_H
13
14#include <linux/dmaengine.h>
15
16/**
17 * struct dw_dma_slave - Controller-specific information about a slave
18 *
19 * @dma_dev: required DMA master device. Depricated.
20 * @bus_id: name of this device channel, not just a device name since
21 * devices may have more than one channel e.g. "foo_tx"
22 * @cfg_hi: Platform-specific initializer for the CFG_HI register
23 * @cfg_lo: Platform-specific initializer for the CFG_LO register
24 * @src_master: src master for transfers on allocated channel.
25 * @dst_master: dest master for transfers on allocated channel.
26 */
27struct dw_dma_slave {
28 struct device *dma_dev;
29 u32 cfg_hi;
30 u32 cfg_lo;
31 u8 src_master;
32 u8 dst_master;
33};
34
35/**
36 * struct dw_dma_platform_data - Controller configuration parameters
37 * @nr_channels: Number of channels supported by hardware (max 8)
38 * @is_private: The device channels should be marked as private and not for
39 * by the general purpose DMA channel allocator.
40 * @chan_allocation_order: Allocate channels starting from 0 or 7
41 * @chan_priority: Set channel priority increasing from 0 to 7 or 7 to 0.
42 * @block_size: Maximum block size supported by the controller
43 * @nr_masters: Number of AHB masters supported by the controller
44 * @data_width: Maximum data width supported by hardware per AHB master
45 * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
46 */
47struct dw_dma_platform_data {
48 unsigned int nr_channels;
49 bool is_private;
50#define CHAN_ALLOCATION_ASCENDING 0 /* zero to seven */
51#define CHAN_ALLOCATION_DESCENDING 1 /* seven to zero */
52 unsigned char chan_allocation_order;
53#define CHAN_PRIORITY_ASCENDING 0 /* chan0 highest */
54#define CHAN_PRIORITY_DESCENDING 1 /* chan7 highest */
55 unsigned char chan_priority;
56 unsigned short block_size;
57 unsigned char nr_masters;
58 unsigned char data_width[4];
59};
60
61/* bursts size */
62enum dw_dma_msize {
63 DW_DMA_MSIZE_1,
64 DW_DMA_MSIZE_4,
65 DW_DMA_MSIZE_8,
66 DW_DMA_MSIZE_16,
67 DW_DMA_MSIZE_32,
68 DW_DMA_MSIZE_64,
69 DW_DMA_MSIZE_128,
70 DW_DMA_MSIZE_256,
71};
72
73/* Platform-configurable bits in CFG_HI */
74#define DWC_CFGH_FCMODE (1 << 0)
75#define DWC_CFGH_FIFO_MODE (1 << 1)
76#define DWC_CFGH_PROTCTL(x) ((x) << 2)
77#define DWC_CFGH_SRC_PER(x) ((x) << 7)
78#define DWC_CFGH_DST_PER(x) ((x) << 11)
79
80/* Platform-configurable bits in CFG_LO */
81#define DWC_CFGL_LOCK_CH_XFER (0 << 12) /* scope of LOCK_CH */
82#define DWC_CFGL_LOCK_CH_BLOCK (1 << 12)
83#define DWC_CFGL_LOCK_CH_XACT (2 << 12)
84#define DWC_CFGL_LOCK_BUS_XFER (0 << 14) /* scope of LOCK_BUS */
85#define DWC_CFGL_LOCK_BUS_BLOCK (1 << 14)
86#define DWC_CFGL_LOCK_BUS_XACT (2 << 14)
87#define DWC_CFGL_LOCK_CH (1 << 15) /* channel lockout */
88#define DWC_CFGL_LOCK_BUS (1 << 16) /* busmaster lockout */
89#define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */
90#define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */
91
92/* DMA API extensions */
93struct dw_cyclic_desc {
94 struct dw_desc **desc;
95 unsigned long periods;
96 void (*period_callback)(void *param);
97 void *period_callback_param;
98};
99
100struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
101 dma_addr_t buf_addr, size_t buf_len, size_t period_len,
102 enum dma_transfer_direction direction);
103void dw_dma_cyclic_free(struct dma_chan *chan);
104int dw_dma_cyclic_start(struct dma_chan *chan);
105void dw_dma_cyclic_stop(struct dma_chan *chan);
106
107dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan);
108
109dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan);
110
111#endif /* DW_DMAC_H */
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 2fe93b26b42f..4f1bbc68cd1b 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -42,7 +42,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
42#if defined(CONFIG_DYNAMIC_DEBUG) 42#if defined(CONFIG_DYNAMIC_DEBUG)
43extern int ddebug_remove_module(const char *mod_name); 43extern int ddebug_remove_module(const char *mod_name);
44extern __printf(2, 3) 44extern __printf(2, 3)
45int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...); 45void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...);
46 46
47extern int ddebug_dyndbg_module_param_cb(char *param, char *val, 47extern int ddebug_dyndbg_module_param_cb(char *param, char *val,
48 const char *modname); 48 const char *modname);
@@ -50,15 +50,15 @@ extern int ddebug_dyndbg_module_param_cb(char *param, char *val,
50struct device; 50struct device;
51 51
52extern __printf(3, 4) 52extern __printf(3, 4)
53int __dynamic_dev_dbg(struct _ddebug *descriptor, const struct device *dev, 53void __dynamic_dev_dbg(struct _ddebug *descriptor, const struct device *dev,
54 const char *fmt, ...); 54 const char *fmt, ...);
55 55
56struct net_device; 56struct net_device;
57 57
58extern __printf(3, 4) 58extern __printf(3, 4)
59int __dynamic_netdev_dbg(struct _ddebug *descriptor, 59void __dynamic_netdev_dbg(struct _ddebug *descriptor,
60 const struct net_device *dev, 60 const struct net_device *dev,
61 const char *fmt, ...); 61 const char *fmt, ...);
62 62
63#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ 63#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
64 static struct _ddebug __aligned(8) \ 64 static struct _ddebug __aligned(8) \
diff --git a/include/linux/dynamic_queue_limits.h b/include/linux/dynamic_queue_limits.h
index 5621547d631b..a4be70398ce1 100644
--- a/include/linux/dynamic_queue_limits.h
+++ b/include/linux/dynamic_queue_limits.h
@@ -73,14 +73,22 @@ static inline void dql_queued(struct dql *dql, unsigned int count)
73{ 73{
74 BUG_ON(count > DQL_MAX_OBJECT); 74 BUG_ON(count > DQL_MAX_OBJECT);
75 75
76 dql->num_queued += count;
77 dql->last_obj_cnt = count; 76 dql->last_obj_cnt = count;
77
78 /* We want to force a write first, so that cpu do not attempt
79 * to get cache line containing last_obj_cnt, num_queued, adj_limit
80 * in Shared state, but directly does a Request For Ownership
81 * It is only a hint, we use barrier() only.
82 */
83 barrier();
84
85 dql->num_queued += count;
78} 86}
79 87
80/* Returns how many objects can be queued, < 0 indicates over limit. */ 88/* Returns how many objects can be queued, < 0 indicates over limit. */
81static inline int dql_avail(const struct dql *dql) 89static inline int dql_avail(const struct dql *dql)
82{ 90{
83 return dql->adj_limit - dql->num_queued; 91 return ACCESS_ONCE(dql->adj_limit) - ACCESS_ONCE(dql->num_queued);
84} 92}
85 93
86/* Record number of completed objects and recalculate the limit. */ 94/* Record number of completed objects and recalculate the limit. */
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 8e6c20af11a2..e1e68da6f35c 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -194,6 +194,9 @@ static inline char *mc_event_error_type(const unsigned int err_type)
194 * @MEM_DDR3: DDR3 RAM 194 * @MEM_DDR3: DDR3 RAM
195 * @MEM_RDDR3: Registered DDR3 RAM 195 * @MEM_RDDR3: Registered DDR3 RAM
196 * This is a variant of the DDR3 memories. 196 * This is a variant of the DDR3 memories.
197 * @MEM_DDR4: DDR4 RAM
198 * @MEM_RDDR4: Registered DDR4 RAM
199 * This is a variant of the DDR4 memories.
197 */ 200 */
198enum mem_type { 201enum mem_type {
199 MEM_EMPTY = 0, 202 MEM_EMPTY = 0,
@@ -213,6 +216,8 @@ enum mem_type {
213 MEM_XDR, 216 MEM_XDR,
214 MEM_DDR3, 217 MEM_DDR3,
215 MEM_RDDR3, 218 MEM_RDDR3,
219 MEM_DDR4,
220 MEM_RDDR4,
216}; 221};
217 222
218#define MEM_FLAG_EMPTY BIT(MEM_EMPTY) 223#define MEM_FLAG_EMPTY BIT(MEM_EMPTY)
diff --git a/include/linux/efi.h b/include/linux/efi.h
index efc681fd5895..0949f9c7e872 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -92,6 +92,7 @@ typedef struct {
92#define EFI_MEMORY_WC ((u64)0x0000000000000002ULL) /* write-coalescing */ 92#define EFI_MEMORY_WC ((u64)0x0000000000000002ULL) /* write-coalescing */
93#define EFI_MEMORY_WT ((u64)0x0000000000000004ULL) /* write-through */ 93#define EFI_MEMORY_WT ((u64)0x0000000000000004ULL) /* write-through */
94#define EFI_MEMORY_WB ((u64)0x0000000000000008ULL) /* write-back */ 94#define EFI_MEMORY_WB ((u64)0x0000000000000008ULL) /* write-back */
95#define EFI_MEMORY_UCE ((u64)0x0000000000000010ULL) /* uncached, exported */
95#define EFI_MEMORY_WP ((u64)0x0000000000001000ULL) /* write-protect */ 96#define EFI_MEMORY_WP ((u64)0x0000000000001000ULL) /* write-protect */
96#define EFI_MEMORY_RP ((u64)0x0000000000002000ULL) /* read-protect */ 97#define EFI_MEMORY_RP ((u64)0x0000000000002000ULL) /* read-protect */
97#define EFI_MEMORY_XP ((u64)0x0000000000004000ULL) /* execute-protect */ 98#define EFI_MEMORY_XP ((u64)0x0000000000004000ULL) /* execute-protect */
@@ -502,6 +503,10 @@ typedef efi_status_t efi_get_next_variable_t (unsigned long *name_size, efi_char
502typedef efi_status_t efi_set_variable_t (efi_char16_t *name, efi_guid_t *vendor, 503typedef efi_status_t efi_set_variable_t (efi_char16_t *name, efi_guid_t *vendor,
503 u32 attr, unsigned long data_size, 504 u32 attr, unsigned long data_size,
504 void *data); 505 void *data);
506typedef efi_status_t
507efi_set_variable_nonblocking_t(efi_char16_t *name, efi_guid_t *vendor,
508 u32 attr, unsigned long data_size, void *data);
509
505typedef efi_status_t efi_get_next_high_mono_count_t (u32 *count); 510typedef efi_status_t efi_get_next_high_mono_count_t (u32 *count);
506typedef void efi_reset_system_t (int reset_type, efi_status_t status, 511typedef void efi_reset_system_t (int reset_type, efi_status_t status,
507 unsigned long data_size, efi_char16_t *data); 512 unsigned long data_size, efi_char16_t *data);
@@ -821,6 +826,7 @@ extern struct efi {
821 efi_get_variable_t *get_variable; 826 efi_get_variable_t *get_variable;
822 efi_get_next_variable_t *get_next_variable; 827 efi_get_next_variable_t *get_next_variable;
823 efi_set_variable_t *set_variable; 828 efi_set_variable_t *set_variable;
829 efi_set_variable_nonblocking_t *set_variable_nonblocking;
824 efi_query_variable_info_t *query_variable_info; 830 efi_query_variable_info_t *query_variable_info;
825 efi_update_capsule_t *update_capsule; 831 efi_update_capsule_t *update_capsule;
826 efi_query_capsule_caps_t *query_capsule_caps; 832 efi_query_capsule_caps_t *query_capsule_caps;
@@ -886,6 +892,13 @@ extern bool efi_poweroff_required(void);
886 (md) <= (efi_memory_desc_t *)((m)->map_end - (m)->desc_size); \ 892 (md) <= (efi_memory_desc_t *)((m)->map_end - (m)->desc_size); \
887 (md) = (void *)(md) + (m)->desc_size) 893 (md) = (void *)(md) + (m)->desc_size)
888 894
895/*
896 * Format an EFI memory descriptor's type and attributes to a user-provided
897 * character buffer, as per snprintf(), and return the buffer.
898 */
899char * __init efi_md_typeattr_format(char *buf, size_t size,
900 const efi_memory_desc_t *md);
901
889/** 902/**
890 * efi_range_is_wc - check the WC bit on an address range 903 * efi_range_is_wc - check the WC bit on an address range
891 * @start: starting kvirt address 904 * @start: starting kvirt address
@@ -1034,6 +1047,7 @@ struct efivar_operations {
1034 efi_get_variable_t *get_variable; 1047 efi_get_variable_t *get_variable;
1035 efi_get_next_variable_t *get_next_variable; 1048 efi_get_next_variable_t *get_next_variable;
1036 efi_set_variable_t *set_variable; 1049 efi_set_variable_t *set_variable;
1050 efi_set_variable_nonblocking_t *set_variable_nonblocking;
1037 efi_query_variable_store_t *query_variable_store; 1051 efi_query_variable_store_t *query_variable_store;
1038}; 1052};
1039 1053
@@ -1156,6 +1170,9 @@ int efivars_sysfs_init(void);
1156#ifdef CONFIG_EFI_RUNTIME_MAP 1170#ifdef CONFIG_EFI_RUNTIME_MAP
1157int efi_runtime_map_init(struct kobject *); 1171int efi_runtime_map_init(struct kobject *);
1158void efi_runtime_map_setup(void *, int, u32); 1172void efi_runtime_map_setup(void *, int, u32);
1173int efi_get_runtime_map_size(void);
1174int efi_get_runtime_map_desc_size(void);
1175int efi_runtime_map_copy(void *buf, size_t bufsz);
1159#else 1176#else
1160static inline int efi_runtime_map_init(struct kobject *kobj) 1177static inline int efi_runtime_map_init(struct kobject *kobj)
1161{ 1178{
@@ -1164,6 +1181,22 @@ static inline int efi_runtime_map_init(struct kobject *kobj)
1164 1181
1165static inline void 1182static inline void
1166efi_runtime_map_setup(void *map, int nr_entries, u32 desc_size) {} 1183efi_runtime_map_setup(void *map, int nr_entries, u32 desc_size) {}
1184
1185static inline int efi_get_runtime_map_size(void)
1186{
1187 return 0;
1188}
1189
1190static inline int efi_get_runtime_map_desc_size(void)
1191{
1192 return 0;
1193}
1194
1195static inline int efi_runtime_map_copy(void *buf, size_t bufsz)
1196{
1197 return 0;
1198}
1199
1167#endif 1200#endif
1168 1201
1169/* prototypes shared between arch specific and generic stub code */ 1202/* prototypes shared between arch specific and generic stub code */
@@ -1208,4 +1241,7 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
1208 unsigned long *load_addr, 1241 unsigned long *load_addr,
1209 unsigned long *load_size); 1242 unsigned long *load_size);
1210 1243
1244efi_status_t efi_parse_options(char *cmdline);
1245
1246bool efi_runtime_disabled(void);
1211#endif /* _LINUX_EFI_H */ 1247#endif /* _LINUX_EFI_H */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 9c5529dc6d07..733980fce8e3 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -29,6 +29,7 @@
29#include <asm/bitsperlong.h> 29#include <asm/bitsperlong.h>
30 30
31#ifdef __KERNEL__ 31#ifdef __KERNEL__
32u32 eth_get_headlen(void *data, unsigned int max_len);
32__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); 33__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
33extern const struct header_ops eth_header_ops; 34extern const struct header_ops eth_header_ops;
34 35
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index e658229fee39..c1a2d60dfb82 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -257,6 +257,10 @@ struct ethtool_ops {
257 struct ethtool_eeprom *, u8 *); 257 struct ethtool_eeprom *, u8 *);
258 int (*get_eee)(struct net_device *, struct ethtool_eee *); 258 int (*get_eee)(struct net_device *, struct ethtool_eee *);
259 int (*set_eee)(struct net_device *, struct ethtool_eee *); 259 int (*set_eee)(struct net_device *, struct ethtool_eee *);
260 int (*get_tunable)(struct net_device *,
261 const struct ethtool_tunable *, void *);
262 int (*set_tunable)(struct net_device *,
263 const struct ethtool_tunable *, const void *);
260 264
261 265
262}; 266};
diff --git a/include/linux/extcon/extcon-gpio.h b/include/linux/extcon/extcon-gpio.h
index 8900fdf511c6..0b17ad43fbfc 100644
--- a/include/linux/extcon/extcon-gpio.h
+++ b/include/linux/extcon/extcon-gpio.h
@@ -34,8 +34,10 @@
34 * @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW). 34 * @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW).
35 * @state_on: print_state is overriden with state_on if attached. 35 * @state_on: print_state is overriden with state_on if attached.
36 * If NULL, default method of extcon class is used. 36 * If NULL, default method of extcon class is used.
37 * @state_off: print_state is overriden with state_on if detached. 37 * @state_off: print_state is overriden with state_off if detached.
38 * If NUll, default method of extcon class is used. 38 * If NUll, default method of extcon class is used.
39 * @check_on_resume: Boolean describing whether to check the state of gpio
40 * while resuming from sleep.
39 * 41 *
40 * Note that in order for state_on or state_off to be valid, both state_on 42 * Note that in order for state_on or state_off to be valid, both state_on
41 * and state_off should be not NULL. If at least one of them is NULL, 43 * and state_off should be not NULL. If at least one of them is NULL,
diff --git a/include/linux/extcon/sm5502.h b/include/linux/extcon/sm5502.h
deleted file mode 100644
index 030526bf8d79..000000000000
--- a/include/linux/extcon/sm5502.h
+++ /dev/null
@@ -1,287 +0,0 @@
1/*
2 * sm5502.h
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __LINUX_EXTCON_SM5502_H
18#define __LINUX_EXTCON_SM5502_H
19
20enum sm5502_types {
21 TYPE_SM5502,
22};
23
24/* SM5502 registers */
25enum sm5502_reg {
26 SM5502_REG_DEVICE_ID = 0x01,
27 SM5502_REG_CONTROL,
28 SM5502_REG_INT1,
29 SM5502_REG_INT2,
30 SM5502_REG_INTMASK1,
31 SM5502_REG_INTMASK2,
32 SM5502_REG_ADC,
33 SM5502_REG_TIMING_SET1,
34 SM5502_REG_TIMING_SET2,
35 SM5502_REG_DEV_TYPE1,
36 SM5502_REG_DEV_TYPE2,
37 SM5502_REG_BUTTON1,
38 SM5502_REG_BUTTON2,
39 SM5502_REG_CAR_KIT_STATUS,
40 SM5502_REG_RSVD1,
41 SM5502_REG_RSVD2,
42 SM5502_REG_RSVD3,
43 SM5502_REG_RSVD4,
44 SM5502_REG_MANUAL_SW1,
45 SM5502_REG_MANUAL_SW2,
46 SM5502_REG_DEV_TYPE3,
47 SM5502_REG_RSVD5,
48 SM5502_REG_RSVD6,
49 SM5502_REG_RSVD7,
50 SM5502_REG_RSVD8,
51 SM5502_REG_RSVD9,
52 SM5502_REG_RESET,
53 SM5502_REG_RSVD10,
54 SM5502_REG_RESERVED_ID1,
55 SM5502_REG_RSVD11,
56 SM5502_REG_RSVD12,
57 SM5502_REG_RESERVED_ID2,
58 SM5502_REG_RSVD13,
59 SM5502_REG_OCP,
60 SM5502_REG_RSVD14,
61 SM5502_REG_RSVD15,
62 SM5502_REG_RSVD16,
63 SM5502_REG_RSVD17,
64 SM5502_REG_RSVD18,
65 SM5502_REG_RSVD19,
66 SM5502_REG_RSVD20,
67 SM5502_REG_RSVD21,
68 SM5502_REG_RSVD22,
69 SM5502_REG_RSVD23,
70 SM5502_REG_RSVD24,
71 SM5502_REG_RSVD25,
72 SM5502_REG_RSVD26,
73 SM5502_REG_RSVD27,
74 SM5502_REG_RSVD28,
75 SM5502_REG_RSVD29,
76 SM5502_REG_RSVD30,
77 SM5502_REG_RSVD31,
78 SM5502_REG_RSVD32,
79 SM5502_REG_RSVD33,
80 SM5502_REG_RSVD34,
81 SM5502_REG_RSVD35,
82 SM5502_REG_RSVD36,
83 SM5502_REG_RESERVED_ID3,
84
85 SM5502_REG_END,
86};
87
88/* Define SM5502 MASK/SHIFT constant */
89#define SM5502_REG_DEVICE_ID_VENDOR_SHIFT 0
90#define SM5502_REG_DEVICE_ID_VERSION_SHIFT 3
91#define SM5502_REG_DEVICE_ID_VENDOR_MASK (0x3 << SM5502_REG_DEVICE_ID_VENDOR_SHIFT)
92#define SM5502_REG_DEVICE_ID_VERSION_MASK (0x1f << SM5502_REG_DEVICE_ID_VERSION_SHIFT)
93
94#define SM5502_REG_CONTROL_MASK_INT_SHIFT 0
95#define SM5502_REG_CONTROL_WAIT_SHIFT 1
96#define SM5502_REG_CONTROL_MANUAL_SW_SHIFT 2
97#define SM5502_REG_CONTROL_RAW_DATA_SHIFT 3
98#define SM5502_REG_CONTROL_SW_OPEN_SHIFT 4
99#define SM5502_REG_CONTROL_MASK_INT_MASK (0x1 << SM5502_REG_CONTROL_MASK_INT_SHIFT)
100#define SM5502_REG_CONTROL_WAIT_MASK (0x1 << SM5502_REG_CONTROL_WAIT_SHIFT)
101#define SM5502_REG_CONTROL_MANUAL_SW_MASK (0x1 << SM5502_REG_CONTROL_MANUAL_SW_SHIFT)
102#define SM5502_REG_CONTROL_RAW_DATA_MASK (0x1 << SM5502_REG_CONTROL_RAW_DATA_SHIFT)
103#define SM5502_REG_CONTROL_SW_OPEN_MASK (0x1 << SM5502_REG_CONTROL_SW_OPEN_SHIFT)
104
105#define SM5502_REG_INTM1_ATTACH_SHIFT 0
106#define SM5502_REG_INTM1_DETACH_SHIFT 1
107#define SM5502_REG_INTM1_KP_SHIFT 2
108#define SM5502_REG_INTM1_LKP_SHIFT 3
109#define SM5502_REG_INTM1_LKR_SHIFT 4
110#define SM5502_REG_INTM1_OVP_EVENT_SHIFT 5
111#define SM5502_REG_INTM1_OCP_EVENT_SHIFT 6
112#define SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT 7
113#define SM5502_REG_INTM1_ATTACH_MASK (0x1 << SM5502_REG_INTM1_ATTACH_SHIFT)
114#define SM5502_REG_INTM1_DETACH_MASK (0x1 << SM5502_REG_INTM1_DETACH_SHIFT)
115#define SM5502_REG_INTM1_KP_MASK (0x1 << SM5502_REG_INTM1_KP_SHIFT)
116#define SM5502_REG_INTM1_LKP_MASK (0x1 << SM5502_REG_INTM1_LKP_SHIFT)
117#define SM5502_REG_INTM1_LKR_MASK (0x1 << SM5502_REG_INTM1_LKR_SHIFT)
118#define SM5502_REG_INTM1_OVP_EVENT_MASK (0x1 << SM5502_REG_INTM1_OVP_EVENT_SHIFT)
119#define SM5502_REG_INTM1_OCP_EVENT_MASK (0x1 << SM5502_REG_INTM1_OCP_EVENT_SHIFT)
120#define SM5502_REG_INTM1_OVP_OCP_DIS_MASK (0x1 << SM5502_REG_INTM1_OVP_OCP_DIS_SHIFT)
121
122#define SM5502_REG_INTM2_VBUS_DET_SHIFT 0
123#define SM5502_REG_INTM2_REV_ACCE_SHIFT 1
124#define SM5502_REG_INTM2_ADC_CHG_SHIFT 2
125#define SM5502_REG_INTM2_STUCK_KEY_SHIFT 3
126#define SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT 4
127#define SM5502_REG_INTM2_MHL_SHIFT 5
128#define SM5502_REG_INTM2_VBUS_DET_MASK (0x1 << SM5502_REG_INTM2_VBUS_DET_SHIFT)
129#define SM5502_REG_INTM2_REV_ACCE_MASK (0x1 << SM5502_REG_INTM2_REV_ACCE_SHIFT)
130#define SM5502_REG_INTM2_ADC_CHG_MASK (0x1 << SM5502_REG_INTM2_ADC_CHG_SHIFT)
131#define SM5502_REG_INTM2_STUCK_KEY_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_SHIFT)
132#define SM5502_REG_INTM2_STUCK_KEY_RCV_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT)
133#define SM5502_REG_INTM2_MHL_MASK (0x1 << SM5502_REG_INTM2_MHL_SHIFT)
134
135#define SM5502_REG_ADC_SHIFT 0
136#define SM5502_REG_ADC_MASK (0x1f << SM5502_REG_ADC_SHIFT)
137
138#define SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT 4
139#define SM5502_REG_TIMING_SET1_KEY_PRESS_MASK (0xf << SM5502_REG_TIMING_SET1_KEY_PRESS_SHIFT)
140#define TIMING_KEY_PRESS_100MS 0x0
141#define TIMING_KEY_PRESS_200MS 0x1
142#define TIMING_KEY_PRESS_300MS 0x2
143#define TIMING_KEY_PRESS_400MS 0x3
144#define TIMING_KEY_PRESS_500MS 0x4
145#define TIMING_KEY_PRESS_600MS 0x5
146#define TIMING_KEY_PRESS_700MS 0x6
147#define TIMING_KEY_PRESS_800MS 0x7
148#define TIMING_KEY_PRESS_900MS 0x8
149#define TIMING_KEY_PRESS_1000MS 0x9
150#define SM5502_REG_TIMING_SET1_ADC_DET_SHIFT 0
151#define SM5502_REG_TIMING_SET1_ADC_DET_MASK (0xf << SM5502_REG_TIMING_SET1_ADC_DET_SHIFT)
152#define TIMING_ADC_DET_50MS 0x0
153#define TIMING_ADC_DET_100MS 0x1
154#define TIMING_ADC_DET_150MS 0x2
155#define TIMING_ADC_DET_200MS 0x3
156#define TIMING_ADC_DET_300MS 0x4
157#define TIMING_ADC_DET_400MS 0x5
158#define TIMING_ADC_DET_500MS 0x6
159#define TIMING_ADC_DET_600MS 0x7
160#define TIMING_ADC_DET_700MS 0x8
161#define TIMING_ADC_DET_800MS 0x9
162#define TIMING_ADC_DET_900MS 0xA
163#define TIMING_ADC_DET_1000MS 0xB
164
165#define SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT 4
166#define SM5502_REG_TIMING_SET2_SW_WAIT_MASK (0xf << SM5502_REG_TIMING_SET2_SW_WAIT_SHIFT)
167#define TIMING_SW_WAIT_10MS 0x0
168#define TIMING_SW_WAIT_30MS 0x1
169#define TIMING_SW_WAIT_50MS 0x2
170#define TIMING_SW_WAIT_70MS 0x3
171#define TIMING_SW_WAIT_90MS 0x4
172#define TIMING_SW_WAIT_110MS 0x5
173#define TIMING_SW_WAIT_130MS 0x6
174#define TIMING_SW_WAIT_150MS 0x7
175#define TIMING_SW_WAIT_170MS 0x8
176#define TIMING_SW_WAIT_190MS 0x9
177#define TIMING_SW_WAIT_210MS 0xA
178#define SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT 0
179#define SM5502_REG_TIMING_SET2_LONG_KEY_MASK (0xf << SM5502_REG_TIMING_SET2_LONG_KEY_SHIFT)
180#define TIMING_LONG_KEY_300MS 0x0
181#define TIMING_LONG_KEY_400MS 0x1
182#define TIMING_LONG_KEY_500MS 0x2
183#define TIMING_LONG_KEY_600MS 0x3
184#define TIMING_LONG_KEY_700MS 0x4
185#define TIMING_LONG_KEY_800MS 0x5
186#define TIMING_LONG_KEY_900MS 0x6
187#define TIMING_LONG_KEY_1000MS 0x7
188#define TIMING_LONG_KEY_1100MS 0x8
189#define TIMING_LONG_KEY_1200MS 0x9
190#define TIMING_LONG_KEY_1300MS 0xA
191#define TIMING_LONG_KEY_1400MS 0xB
192#define TIMING_LONG_KEY_1500MS 0xC
193
194#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT 0
195#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT 1
196#define SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT 2
197#define SM5502_REG_DEV_TYPE1_UART_SHIFT 3
198#define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT 4
199#define SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT 5
200#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT 6
201#define SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT 7
202#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_MASK (0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE1_SHIFT)
203#define SM5502_REG_DEV_TYPE1_AUDIO_TYPE1__MASK (0x1 << SM5502_REG_DEV_TYPE1_AUDIO_TYPE2_SHIFT)
204#define SM5502_REG_DEV_TYPE1_USB_SDP_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_SDP_SHIFT)
205#define SM5502_REG_DEV_TYPE1_UART_MASK (0x1 << SM5502_REG_DEV_TYPE1_UART_SHIFT)
206#define SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_MASK (0x1 << SM5502_REG_DEV_TYPE1_CAR_KIT_CHARGER_SHIFT)
207#define SM5502_REG_DEV_TYPE1_USB_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_CHG_SHIFT)
208#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT)
209#define SM5502_REG_DEV_TYPE1_USB_OTG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT)
210
211#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT 0
212#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT 1
213#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT 2
214#define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT 3
215#define SM5502_REG_DEV_TYPE2_PPD_SHIFT 4
216#define SM5502_REG_DEV_TYPE2_TTY_SHIFT 5
217#define SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT 6
218#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT)
219#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT)
220#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT)
221#define SM5502_REG_DEV_TYPE2_JIG_UART_OFF_MASK (0x1 << SM5502_REG_DEV_TYPE2_JIG_UART_OFF_SHIFT)
222#define SM5502_REG_DEV_TYPE2_PPD_MASK (0x1 << SM5502_REG_DEV_TYPE2_PPD_SHIFT)
223#define SM5502_REG_DEV_TYPE2_TTY_MASK (0x1 << SM5502_REG_DEV_TYPE2_TTY_SHIFT)
224#define SM5502_REG_DEV_TYPE2_AV_CABLE_MASK (0x1 << SM5502_REG_DEV_TYPE2_AV_CABLE_SHIFT)
225
226#define SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT 0
227#define SM5502_REG_MANUAL_SW1_DP_SHIFT 2
228#define SM5502_REG_MANUAL_SW1_DM_SHIFT 5
229#define SM5502_REG_MANUAL_SW1_VBUSIN_MASK (0x3 << SM5502_REG_MANUAL_SW1_VBUSIN_SHIFT)
230#define SM5502_REG_MANUAL_SW1_DP_MASK (0x7 << SM5502_REG_MANUAL_SW1_DP_SHIFT)
231#define SM5502_REG_MANUAL_SW1_DM_MASK (0x7 << SM5502_REG_MANUAL_SW1_DM_SHIFT)
232#define VBUSIN_SWITCH_OPEN 0x0
233#define VBUSIN_SWITCH_VBUSOUT 0x1
234#define VBUSIN_SWITCH_MIC 0x2
235#define VBUSIN_SWITCH_VBUSOUT_WITH_USB 0x3
236#define DM_DP_CON_SWITCH_OPEN 0x0
237#define DM_DP_CON_SWITCH_USB 0x1
238#define DM_DP_CON_SWITCH_AUDIO 0x2
239#define DM_DP_CON_SWITCH_UART 0x3
240#define DM_DP_SWITCH_OPEN ((DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
241 | (DM_DP_CON_SWITCH_OPEN <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
242#define DM_DP_SWITCH_USB ((DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
243 | (DM_DP_CON_SWITCH_USB <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
244#define DM_DP_SWITCH_AUDIO ((DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
245 | (DM_DP_CON_SWITCH_AUDIO <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
246#define DM_DP_SWITCH_UART ((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \
247 | (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT))
248
249/* SM5502 Interrupts */
250enum sm5502_irq {
251 /* INT1 */
252 SM5502_IRQ_INT1_ATTACH,
253 SM5502_IRQ_INT1_DETACH,
254 SM5502_IRQ_INT1_KP,
255 SM5502_IRQ_INT1_LKP,
256 SM5502_IRQ_INT1_LKR,
257 SM5502_IRQ_INT1_OVP_EVENT,
258 SM5502_IRQ_INT1_OCP_EVENT,
259 SM5502_IRQ_INT1_OVP_OCP_DIS,
260
261 /* INT2 */
262 SM5502_IRQ_INT2_VBUS_DET,
263 SM5502_IRQ_INT2_REV_ACCE,
264 SM5502_IRQ_INT2_ADC_CHG,
265 SM5502_IRQ_INT2_STUCK_KEY,
266 SM5502_IRQ_INT2_STUCK_KEY_RCV,
267 SM5502_IRQ_INT2_MHL,
268
269 SM5502_IRQ_NUM,
270};
271
272#define SM5502_IRQ_INT1_ATTACH_MASK BIT(0)
273#define SM5502_IRQ_INT1_DETACH_MASK BIT(1)
274#define SM5502_IRQ_INT1_KP_MASK BIT(2)
275#define SM5502_IRQ_INT1_LKP_MASK BIT(3)
276#define SM5502_IRQ_INT1_LKR_MASK BIT(4)
277#define SM5502_IRQ_INT1_OVP_EVENT_MASK BIT(5)
278#define SM5502_IRQ_INT1_OCP_EVENT_MASK BIT(6)
279#define SM5502_IRQ_INT1_OVP_OCP_DIS_MASK BIT(7)
280#define SM5502_IRQ_INT2_VBUS_DET_MASK BIT(0)
281#define SM5502_IRQ_INT2_REV_ACCE_MASK BIT(1)
282#define SM5502_IRQ_INT2_ADC_CHG_MASK BIT(2)
283#define SM5502_IRQ_INT2_STUCK_KEY_MASK BIT(3)
284#define SM5502_IRQ_INT2_STUCK_KEY_RCV_MASK BIT(4)
285#define SM5502_IRQ_INT2_MHL_MASK BIT(5)
286
287#endif /* __LINUX_EXTCON_SM5502_H */
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index 6ff0b0b42d47..860313a33a43 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -15,8 +15,9 @@
15#include <linux/types.h> 15#include <linux/types.h>
16 16
17#define F2FS_SUPER_OFFSET 1024 /* byte-size offset */ 17#define F2FS_SUPER_OFFSET 1024 /* byte-size offset */
18#define F2FS_LOG_SECTOR_SIZE 9 /* 9 bits for 512 byte */ 18#define F2FS_MIN_LOG_SECTOR_SIZE 9 /* 9 bits for 512 bytes */
19#define F2FS_LOG_SECTORS_PER_BLOCK 3 /* 4KB: F2FS_BLKSIZE */ 19#define F2FS_MAX_LOG_SECTOR_SIZE 12 /* 12 bits for 4096 bytes */
20#define F2FS_LOG_SECTORS_PER_BLOCK 3 /* log number for sector/blk */
20#define F2FS_BLKSIZE 4096 /* support only 4KB block */ 21#define F2FS_BLKSIZE 4096 /* support only 4KB block */
21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */ 22#define F2FS_MAX_EXTENSION 64 /* # of extension entries */
22#define F2FS_BLK_ALIGN(x) (((x) + F2FS_BLKSIZE - 1) / F2FS_BLKSIZE) 23#define F2FS_BLK_ALIGN(x) (((x) + F2FS_BLKSIZE - 1) / F2FS_BLKSIZE)
@@ -24,6 +25,9 @@
24#define NULL_ADDR ((block_t)0) /* used as block_t addresses */ 25#define NULL_ADDR ((block_t)0) /* used as block_t addresses */
25#define NEW_ADDR ((block_t)-1) /* used as block_t addresses */ 26#define NEW_ADDR ((block_t)-1) /* used as block_t addresses */
26 27
28/* 0, 1(node nid), 2(meta nid) are reserved node id */
29#define F2FS_RESERVED_NODE_NUM 3
30
27#define F2FS_ROOT_INO(sbi) (sbi->root_ino_num) 31#define F2FS_ROOT_INO(sbi) (sbi->root_ino_num)
28#define F2FS_NODE_INO(sbi) (sbi->node_ino_num) 32#define F2FS_NODE_INO(sbi) (sbi->node_ino_num)
29#define F2FS_META_INO(sbi) (sbi->meta_ino_num) 33#define F2FS_META_INO(sbi) (sbi->meta_ino_num)
@@ -82,11 +86,14 @@ struct f2fs_super_block {
82/* 86/*
83 * For checkpoint 87 * For checkpoint
84 */ 88 */
89#define CP_FSCK_FLAG 0x00000010
85#define CP_ERROR_FLAG 0x00000008 90#define CP_ERROR_FLAG 0x00000008
86#define CP_COMPACT_SUM_FLAG 0x00000004 91#define CP_COMPACT_SUM_FLAG 0x00000004
87#define CP_ORPHAN_PRESENT_FLAG 0x00000002 92#define CP_ORPHAN_PRESENT_FLAG 0x00000002
88#define CP_UMOUNT_FLAG 0x00000001 93#define CP_UMOUNT_FLAG 0x00000001
89 94
95#define F2FS_CP_PACKS 2 /* # of checkpoint packs */
96
90struct f2fs_checkpoint { 97struct f2fs_checkpoint {
91 __le64 checkpoint_ver; /* checkpoint block version number */ 98 __le64 checkpoint_ver; /* checkpoint block version number */
92 __le64 user_block_count; /* # of user blocks */ 99 __le64 user_block_count; /* # of user blocks */
@@ -123,6 +130,9 @@ struct f2fs_checkpoint {
123 */ 130 */
124#define F2FS_ORPHANS_PER_BLOCK 1020 131#define F2FS_ORPHANS_PER_BLOCK 1020
125 132
133#define GET_ORPHAN_BLOCKS(n) ((n + F2FS_ORPHANS_PER_BLOCK - 1) / \
134 F2FS_ORPHANS_PER_BLOCK)
135
126struct f2fs_orphan_block { 136struct f2fs_orphan_block {
127 __le32 ino[F2FS_ORPHANS_PER_BLOCK]; /* inode numbers */ 137 __le32 ino[F2FS_ORPHANS_PER_BLOCK]; /* inode numbers */
128 __le32 reserved; /* reserved */ 138 __le32 reserved; /* reserved */
@@ -144,6 +154,7 @@ struct f2fs_extent {
144#define F2FS_NAME_LEN 255 154#define F2FS_NAME_LEN 255
145#define F2FS_INLINE_XATTR_ADDRS 50 /* 200 bytes for inline xattrs */ 155#define F2FS_INLINE_XATTR_ADDRS 50 /* 200 bytes for inline xattrs */
146#define DEF_ADDRS_PER_INODE 923 /* Address Pointers in an Inode */ 156#define DEF_ADDRS_PER_INODE 923 /* Address Pointers in an Inode */
157#define DEF_NIDS_PER_INODE 5 /* Node IDs in an Inode */
147#define ADDRS_PER_INODE(fi) addrs_per_inode(fi) 158#define ADDRS_PER_INODE(fi) addrs_per_inode(fi)
148#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ 159#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */
149#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */ 160#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */
@@ -163,8 +174,9 @@ struct f2fs_extent {
163#define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \ 174#define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \
164 F2FS_INLINE_XATTR_ADDRS - 1)) 175 F2FS_INLINE_XATTR_ADDRS - 1))
165 176
166#define INLINE_DATA_OFFSET (PAGE_CACHE_SIZE - sizeof(struct node_footer) \ 177#define INLINE_DATA_OFFSET (PAGE_CACHE_SIZE - sizeof(struct node_footer) -\
167 - sizeof(__le32) * (DEF_ADDRS_PER_INODE + 5 - 1)) 178 sizeof(__le32) * (DEF_ADDRS_PER_INODE + \
179 DEF_NIDS_PER_INODE - 1))
168 180
169struct f2fs_inode { 181struct f2fs_inode {
170 __le16 i_mode; /* file mode */ 182 __le16 i_mode; /* file mode */
@@ -194,7 +206,7 @@ struct f2fs_inode {
194 206
195 __le32 i_addr[DEF_ADDRS_PER_INODE]; /* Pointers to data blocks */ 207 __le32 i_addr[DEF_ADDRS_PER_INODE]; /* Pointers to data blocks */
196 208
197 __le32 i_nid[5]; /* direct(2), indirect(2), 209 __le32 i_nid[DEF_NIDS_PER_INODE]; /* direct(2), indirect(2),
198 double_indirect(1) node id */ 210 double_indirect(1) node id */
199} __packed; 211} __packed;
200 212
diff --git a/include/linux/fb.h b/include/linux/fb.h
index b6bfda99add3..09bb7a18d287 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -553,7 +553,7 @@ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
553#define fb_memcpy_fromfb sbus_memcpy_fromio 553#define fb_memcpy_fromfb sbus_memcpy_fromio
554#define fb_memcpy_tofb sbus_memcpy_toio 554#define fb_memcpy_tofb sbus_memcpy_toio
555 555
556#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__) 556#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__) || defined(__arm__)
557 557
558#define fb_readb __raw_readb 558#define fb_readb __raw_readb
559#define fb_readw __raw_readw 559#define fb_readw __raw_readw
diff --git a/include/linux/filter.h b/include/linux/filter.h
index a5227ab8ccb1..ca95abd2bed1 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -4,58 +4,24 @@
4#ifndef __LINUX_FILTER_H__ 4#ifndef __LINUX_FILTER_H__
5#define __LINUX_FILTER_H__ 5#define __LINUX_FILTER_H__
6 6
7#include <stdarg.h>
8
7#include <linux/atomic.h> 9#include <linux/atomic.h>
8#include <linux/compat.h> 10#include <linux/compat.h>
9#include <linux/skbuff.h> 11#include <linux/skbuff.h>
12#include <linux/linkage.h>
13#include <linux/printk.h>
10#include <linux/workqueue.h> 14#include <linux/workqueue.h>
11#include <uapi/linux/filter.h>
12 15
13/* Internally used and optimized filter representation with extended 16#include <asm/cacheflush.h>
14 * instruction set based on top of classic BPF.
15 */
16 17
17/* instruction classes */ 18#include <uapi/linux/filter.h>
18#define BPF_ALU64 0x07 /* alu mode in double word width */ 19#include <uapi/linux/bpf.h>
19
20/* ld/ldx fields */
21#define BPF_DW 0x18 /* double word */
22#define BPF_XADD 0xc0 /* exclusive add */
23
24/* alu/jmp fields */
25#define BPF_MOV 0xb0 /* mov reg to reg */
26#define BPF_ARSH 0xc0 /* sign extending arithmetic shift right */
27
28/* change endianness of a register */
29#define BPF_END 0xd0 /* flags for endianness conversion: */
30#define BPF_TO_LE 0x00 /* convert to little-endian */
31#define BPF_TO_BE 0x08 /* convert to big-endian */
32#define BPF_FROM_LE BPF_TO_LE
33#define BPF_FROM_BE BPF_TO_BE
34
35#define BPF_JNE 0x50 /* jump != */
36#define BPF_JSGT 0x60 /* SGT is signed '>', GT in x86 */
37#define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */
38#define BPF_CALL 0x80 /* function call */
39#define BPF_EXIT 0x90 /* function return */
40
41/* Register numbers */
42enum {
43 BPF_REG_0 = 0,
44 BPF_REG_1,
45 BPF_REG_2,
46 BPF_REG_3,
47 BPF_REG_4,
48 BPF_REG_5,
49 BPF_REG_6,
50 BPF_REG_7,
51 BPF_REG_8,
52 BPF_REG_9,
53 BPF_REG_10,
54 __MAX_BPF_REG,
55};
56 20
57/* BPF has 10 general purpose 64-bit registers and stack frame. */ 21struct sk_buff;
58#define MAX_BPF_REG __MAX_BPF_REG 22struct sock;
23struct seccomp_data;
24struct bpf_prog_aux;
59 25
60/* ArgX, context and stack frame pointer register positions. Note, 26/* ArgX, context and stack frame pointer register positions. Note,
61 * Arg1, Arg2, Arg3, etc are used as argument mappings of function 27 * Arg1, Arg2, Arg3, etc are used as argument mappings of function
@@ -161,6 +127,30 @@ enum {
161 .off = 0, \ 127 .off = 0, \
162 .imm = IMM }) 128 .imm = IMM })
163 129
130/* BPF_LD_IMM64 macro encodes single 'load 64-bit immediate' insn */
131#define BPF_LD_IMM64(DST, IMM) \
132 BPF_LD_IMM64_RAW(DST, 0, IMM)
133
134#define BPF_LD_IMM64_RAW(DST, SRC, IMM) \
135 ((struct bpf_insn) { \
136 .code = BPF_LD | BPF_DW | BPF_IMM, \
137 .dst_reg = DST, \
138 .src_reg = SRC, \
139 .off = 0, \
140 .imm = (__u32) (IMM) }), \
141 ((struct bpf_insn) { \
142 .code = 0, /* zero is reserved opcode */ \
143 .dst_reg = 0, \
144 .src_reg = 0, \
145 .off = 0, \
146 .imm = ((__u64) (IMM)) >> 32 })
147
148#define BPF_PSEUDO_MAP_FD 1
149
150/* pseudo BPF_LD_IMM64 insn used to refer to process-local map_fd */
151#define BPF_LD_MAP_FD(DST, MAP_FD) \
152 BPF_LD_IMM64_RAW(DST, BPF_PSEUDO_MAP_FD, MAP_FD)
153
164/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */ 154/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */
165 155
166#define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \ 156#define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \
@@ -299,14 +289,6 @@ enum {
299#define SK_RUN_FILTER(filter, ctx) \ 289#define SK_RUN_FILTER(filter, ctx) \
300 (*filter->prog->bpf_func)(ctx, filter->prog->insnsi) 290 (*filter->prog->bpf_func)(ctx, filter->prog->insnsi)
301 291
302struct bpf_insn {
303 __u8 code; /* opcode */
304 __u8 dst_reg:4; /* dest register */
305 __u8 src_reg:4; /* source register */
306 __s16 off; /* signed offset */
307 __s32 imm; /* signed immediate constant */
308};
309
310#ifdef CONFIG_COMPAT 292#ifdef CONFIG_COMPAT
311/* A struct sock_filter is architecture independent. */ 293/* A struct sock_filter is architecture independent. */
312struct compat_sock_fprog { 294struct compat_sock_fprog {
@@ -320,20 +302,23 @@ struct sock_fprog_kern {
320 struct sock_filter *filter; 302 struct sock_filter *filter;
321}; 303};
322 304
323struct sk_buff; 305struct bpf_binary_header {
324struct sock; 306 unsigned int pages;
325struct seccomp_data; 307 u8 image[];
308};
326 309
327struct bpf_prog { 310struct bpf_prog {
328 u32 jited:1, /* Is our filter JIT'ed? */ 311 u16 pages; /* Number of allocated pages */
329 len:31; /* Number of filter blocks */ 312 bool jited; /* Is our filter JIT'ed? */
313 u32 len; /* Number of filter blocks */
330 struct sock_fprog_kern *orig_prog; /* Original BPF program */ 314 struct sock_fprog_kern *orig_prog; /* Original BPF program */
315 struct bpf_prog_aux *aux; /* Auxiliary fields */
331 unsigned int (*bpf_func)(const struct sk_buff *skb, 316 unsigned int (*bpf_func)(const struct sk_buff *skb,
332 const struct bpf_insn *filter); 317 const struct bpf_insn *filter);
318 /* Instructions for interpreter */
333 union { 319 union {
334 struct sock_filter insns[0]; 320 struct sock_filter insns[0];
335 struct bpf_insn insnsi[0]; 321 struct bpf_insn insnsi[0];
336 struct work_struct work;
337 }; 322 };
338}; 323};
339 324
@@ -353,6 +338,26 @@ static inline unsigned int bpf_prog_size(unsigned int proglen)
353 338
354#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) 339#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0]))
355 340
341#ifdef CONFIG_DEBUG_SET_MODULE_RONX
342static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
343{
344 set_memory_ro((unsigned long)fp, fp->pages);
345}
346
347static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)
348{
349 set_memory_rw((unsigned long)fp, fp->pages);
350}
351#else
352static inline void bpf_prog_lock_ro(struct bpf_prog *fp)
353{
354}
355
356static inline void bpf_prog_unlock_ro(struct bpf_prog *fp)
357{
358}
359#endif /* CONFIG_DEBUG_SET_MODULE_RONX */
360
356int sk_filter(struct sock *sk, struct sk_buff *skb); 361int sk_filter(struct sock *sk, struct sk_buff *skb);
357 362
358void bpf_prog_select_runtime(struct bpf_prog *fp); 363void bpf_prog_select_runtime(struct bpf_prog *fp);
@@ -361,6 +366,17 @@ void bpf_prog_free(struct bpf_prog *fp);
361int bpf_convert_filter(struct sock_filter *prog, int len, 366int bpf_convert_filter(struct sock_filter *prog, int len,
362 struct bpf_insn *new_prog, int *new_len); 367 struct bpf_insn *new_prog, int *new_len);
363 368
369struct bpf_prog *bpf_prog_alloc(unsigned int size, gfp_t gfp_extra_flags);
370struct bpf_prog *bpf_prog_realloc(struct bpf_prog *fp_old, unsigned int size,
371 gfp_t gfp_extra_flags);
372void __bpf_prog_free(struct bpf_prog *fp);
373
374static inline void bpf_prog_unlock_free(struct bpf_prog *fp)
375{
376 bpf_prog_unlock_ro(fp);
377 __bpf_prog_free(fp);
378}
379
364int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog); 380int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog);
365void bpf_prog_destroy(struct bpf_prog *fp); 381void bpf_prog_destroy(struct bpf_prog *fp);
366 382
@@ -377,6 +393,38 @@ void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp);
377u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); 393u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);
378void bpf_int_jit_compile(struct bpf_prog *fp); 394void bpf_int_jit_compile(struct bpf_prog *fp);
379 395
396#ifdef CONFIG_BPF_JIT
397typedef void (*bpf_jit_fill_hole_t)(void *area, unsigned int size);
398
399struct bpf_binary_header *
400bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr,
401 unsigned int alignment,
402 bpf_jit_fill_hole_t bpf_fill_ill_insns);
403void bpf_jit_binary_free(struct bpf_binary_header *hdr);
404
405void bpf_jit_compile(struct bpf_prog *fp);
406void bpf_jit_free(struct bpf_prog *fp);
407
408static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
409 u32 pass, void *image)
410{
411 pr_err("flen=%u proglen=%u pass=%u image=%pK\n",
412 flen, proglen, pass, image);
413 if (image)
414 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
415 16, 1, image, proglen, false);
416}
417#else
418static inline void bpf_jit_compile(struct bpf_prog *fp)
419{
420}
421
422static inline void bpf_jit_free(struct bpf_prog *fp)
423{
424 bpf_prog_unlock_free(fp);
425}
426#endif /* CONFIG_BPF_JIT */
427
380#define BPF_ANC BIT(15) 428#define BPF_ANC BIT(15)
381 429
382static inline u16 bpf_anc_helper(const struct sock_filter *ftest) 430static inline u16 bpf_anc_helper(const struct sock_filter *ftest)
@@ -424,36 +472,6 @@ static inline void *bpf_load_pointer(const struct sk_buff *skb, int k,
424 return bpf_internal_load_pointer_neg_helper(skb, k, size); 472 return bpf_internal_load_pointer_neg_helper(skb, k, size);
425} 473}
426 474
427#ifdef CONFIG_BPF_JIT
428#include <stdarg.h>
429#include <linux/linkage.h>
430#include <linux/printk.h>
431
432void bpf_jit_compile(struct bpf_prog *fp);
433void bpf_jit_free(struct bpf_prog *fp);
434
435static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
436 u32 pass, void *image)
437{
438 pr_err("flen=%u proglen=%u pass=%u image=%pK\n",
439 flen, proglen, pass, image);
440 if (image)
441 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
442 16, 1, image, proglen, false);
443}
444#else
445#include <linux/slab.h>
446
447static inline void bpf_jit_compile(struct bpf_prog *fp)
448{
449}
450
451static inline void bpf_jit_free(struct bpf_prog *fp)
452{
453 kfree(fp);
454}
455#endif /* CONFIG_BPF_JIT */
456
457static inline int bpf_tell_extensions(void) 475static inline int bpf_tell_extensions(void)
458{ 476{
459 return SKF_AD_MAX; 477 return SKF_AD_MAX;
diff --git a/include/linux/flex_proportions.h b/include/linux/flex_proportions.h
index 4ebc49fae391..0d348e011a6e 100644
--- a/include/linux/flex_proportions.h
+++ b/include/linux/flex_proportions.h
@@ -10,6 +10,7 @@
10#include <linux/percpu_counter.h> 10#include <linux/percpu_counter.h>
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/seqlock.h> 12#include <linux/seqlock.h>
13#include <linux/gfp.h>
13 14
14/* 15/*
15 * When maximum proportion of some event type is specified, this is the 16 * When maximum proportion of some event type is specified, this is the
@@ -32,7 +33,7 @@ struct fprop_global {
32 seqcount_t sequence; 33 seqcount_t sequence;
33}; 34};
34 35
35int fprop_global_init(struct fprop_global *p); 36int fprop_global_init(struct fprop_global *p, gfp_t gfp);
36void fprop_global_destroy(struct fprop_global *p); 37void fprop_global_destroy(struct fprop_global *p);
37bool fprop_new_period(struct fprop_global *p, int periods); 38bool fprop_new_period(struct fprop_global *p, int periods);
38 39
@@ -79,7 +80,7 @@ struct fprop_local_percpu {
79 raw_spinlock_t lock; /* Protect period and numerator */ 80 raw_spinlock_t lock; /* Protect period and numerator */
80}; 81};
81 82
82int fprop_local_init_percpu(struct fprop_local_percpu *pl); 83int fprop_local_init_percpu(struct fprop_local_percpu *pl, gfp_t gfp);
83void fprop_local_destroy_percpu(struct fprop_local_percpu *pl); 84void fprop_local_destroy_percpu(struct fprop_local_percpu *pl);
84void __fprop_inc_percpu(struct fprop_global *p, struct fprop_local_percpu *pl); 85void __fprop_inc_percpu(struct fprop_global *p, struct fprop_local_percpu *pl);
85void __fprop_inc_percpu_max(struct fprop_global *p, struct fprop_local_percpu *pl, 86void __fprop_inc_percpu_max(struct fprop_global *p, struct fprop_local_percpu *pl,
diff --git a/include/linux/font.h b/include/linux/font.h
index 40a24ab41b36..d6821769dd1e 100644
--- a/include/linux/font.h
+++ b/include/linux/font.h
@@ -31,6 +31,7 @@ struct font_desc {
31#define SUN12x22_IDX 7 31#define SUN12x22_IDX 7
32#define ACORN8x8_IDX 8 32#define ACORN8x8_IDX 8
33#define MINI4x6_IDX 9 33#define MINI4x6_IDX 9
34#define FONT6x10_IDX 10
34 35
35extern const struct font_desc font_vga_8x8, 36extern const struct font_desc font_vga_8x8,
36 font_vga_8x16, 37 font_vga_8x16,
@@ -41,7 +42,8 @@ extern const struct font_desc font_vga_8x8,
41 font_sun_8x16, 42 font_sun_8x16,
42 font_sun_12x22, 43 font_sun_12x22,
43 font_acorn_8x8, 44 font_acorn_8x8,
44 font_mini_4x6; 45 font_mini_4x6,
46 font_6x10;
45 47
46/* Find a font with a specific name */ 48/* Find a font with a specific name */
47 49
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2daccaf4b547..9ab779e8a63c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -192,8 +192,6 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
192#define READ 0 192#define READ 0
193#define WRITE RW_MASK 193#define WRITE RW_MASK
194#define READA RWA_MASK 194#define READA RWA_MASK
195#define KERNEL_READ (READ|REQ_KERNEL)
196#define KERNEL_WRITE (WRITE|REQ_KERNEL)
197 195
198#define READ_SYNC (READ | REQ_SYNC) 196#define READ_SYNC (READ | REQ_SYNC)
199#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE) 197#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE)
@@ -225,6 +223,13 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
225#define ATTR_TIMES_SET (1 << 16) 223#define ATTR_TIMES_SET (1 << 16)
226 224
227/* 225/*
226 * Whiteout is represented by a char device. The following constants define the
227 * mode and device number to use.
228 */
229#define WHITEOUT_MODE 0
230#define WHITEOUT_DEV 0
231
232/*
228 * This is the Inode Attributes structure, used for notify_change(). It 233 * This is the Inode Attributes structure, used for notify_change(). It
229 * uses the above definitions as flags, to know which values have changed. 234 * uses the above definitions as flags, to know which values have changed.
230 * Also, in this manner, a Filesystem can look at only the values it cares 235 * Also, in this manner, a Filesystem can look at only the values it cares
@@ -256,6 +261,12 @@ struct iattr {
256 */ 261 */
257#include <linux/quota.h> 262#include <linux/quota.h>
258 263
264/*
265 * Maximum number of layers of fs stack. Needs to be limited to
266 * prevent kernel stack overflow
267 */
268#define FILESYSTEM_MAX_STACK_DEPTH 2
269
259/** 270/**
260 * enum positive_aop_returns - aop return codes with specific semantics 271 * enum positive_aop_returns - aop return codes with specific semantics
261 * 272 *
@@ -387,7 +398,7 @@ struct address_space {
387 struct inode *host; /* owner: inode, block_device */ 398 struct inode *host; /* owner: inode, block_device */
388 struct radix_tree_root page_tree; /* radix tree of all pages */ 399 struct radix_tree_root page_tree; /* radix tree of all pages */
389 spinlock_t tree_lock; /* and lock protecting it */ 400 spinlock_t tree_lock; /* and lock protecting it */
390 unsigned int i_mmap_writable;/* count VM_SHARED mappings */ 401 atomic_t i_mmap_writable;/* count VM_SHARED mappings */
391 struct rb_root i_mmap; /* tree of private and shared mappings */ 402 struct rb_root i_mmap; /* tree of private and shared mappings */
392 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ 403 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
393 struct mutex i_mmap_mutex; /* protect tree, count, list */ 404 struct mutex i_mmap_mutex; /* protect tree, count, list */
@@ -470,10 +481,35 @@ static inline int mapping_mapped(struct address_space *mapping)
470 * Note that i_mmap_writable counts all VM_SHARED vmas: do_mmap_pgoff 481 * Note that i_mmap_writable counts all VM_SHARED vmas: do_mmap_pgoff
471 * marks vma as VM_SHARED if it is shared, and the file was opened for 482 * marks vma as VM_SHARED if it is shared, and the file was opened for
472 * writing i.e. vma may be mprotected writable even if now readonly. 483 * writing i.e. vma may be mprotected writable even if now readonly.
484 *
485 * If i_mmap_writable is negative, no new writable mappings are allowed. You
486 * can only deny writable mappings, if none exists right now.
473 */ 487 */
474static inline int mapping_writably_mapped(struct address_space *mapping) 488static inline int mapping_writably_mapped(struct address_space *mapping)
475{ 489{
476 return mapping->i_mmap_writable != 0; 490 return atomic_read(&mapping->i_mmap_writable) > 0;
491}
492
493static inline int mapping_map_writable(struct address_space *mapping)
494{
495 return atomic_inc_unless_negative(&mapping->i_mmap_writable) ?
496 0 : -EPERM;
497}
498
499static inline void mapping_unmap_writable(struct address_space *mapping)
500{
501 atomic_dec(&mapping->i_mmap_writable);
502}
503
504static inline int mapping_deny_writable(struct address_space *mapping)
505{
506 return atomic_dec_unless_positive(&mapping->i_mmap_writable) ?
507 0 : -EBUSY;
508}
509
510static inline void mapping_allow_writable(struct address_space *mapping)
511{
512 atomic_inc(&mapping->i_mmap_writable);
477} 513}
478 514
479/* 515/*
@@ -603,11 +639,13 @@ static inline int inode_unhashed(struct inode *inode)
603 * 2: child/target 639 * 2: child/target
604 * 3: xattr 640 * 3: xattr
605 * 4: second non-directory 641 * 4: second non-directory
606 * The last is for certain operations (such as rename) which lock two 642 * 5: second parent (when locking independent directories in rename)
643 *
644 * I_MUTEX_NONDIR2 is for certain operations (such as rename) which lock two
607 * non-directories at once. 645 * non-directories at once.
608 * 646 *
609 * The locking order between these classes is 647 * The locking order between these classes is
610 * parent -> child -> normal -> xattr -> second non-directory 648 * parent[2] -> child -> grandchild -> normal -> xattr -> second non-directory
611 */ 649 */
612enum inode_i_mutex_lock_class 650enum inode_i_mutex_lock_class
613{ 651{
@@ -615,7 +653,8 @@ enum inode_i_mutex_lock_class
615 I_MUTEX_PARENT, 653 I_MUTEX_PARENT,
616 I_MUTEX_CHILD, 654 I_MUTEX_CHILD,
617 I_MUTEX_XATTR, 655 I_MUTEX_XATTR,
618 I_MUTEX_NONDIR2 656 I_MUTEX_NONDIR2,
657 I_MUTEX_PARENT2,
619}; 658};
620 659
621void lock_two_nondirectories(struct inode *, struct inode*); 660void lock_two_nondirectories(struct inode *, struct inode*);
@@ -826,13 +865,7 @@ static inline struct file *get_file(struct file *f)
826 */ 865 */
827#define FILE_LOCK_DEFERRED 1 866#define FILE_LOCK_DEFERRED 1
828 867
829/* 868/* legacy typedef, should eventually be removed */
830 * The POSIX file lock owner is determined by
831 * the "struct files_struct" in the thread group
832 * (or NULL for no owner - BSD locks).
833 *
834 * Lockd stuffs a "host" pointer into this.
835 */
836typedef void *fl_owner_t; 869typedef void *fl_owner_t;
837 870
838struct file_lock_operations { 871struct file_lock_operations {
@@ -843,10 +876,13 @@ struct file_lock_operations {
843struct lock_manager_operations { 876struct lock_manager_operations {
844 int (*lm_compare_owner)(struct file_lock *, struct file_lock *); 877 int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
845 unsigned long (*lm_owner_key)(struct file_lock *); 878 unsigned long (*lm_owner_key)(struct file_lock *);
879 void (*lm_get_owner)(struct file_lock *, struct file_lock *);
880 void (*lm_put_owner)(struct file_lock *);
846 void (*lm_notify)(struct file_lock *); /* unblock callback */ 881 void (*lm_notify)(struct file_lock *); /* unblock callback */
847 int (*lm_grant)(struct file_lock *, struct file_lock *, int); 882 int (*lm_grant)(struct file_lock *, int);
848 void (*lm_break)(struct file_lock *); 883 bool (*lm_break)(struct file_lock *);
849 int (*lm_change)(struct file_lock **, int); 884 int (*lm_change)(struct file_lock **, int, struct list_head *);
885 void (*lm_setup)(struct file_lock *, void **);
850}; 886};
851 887
852struct lock_manager { 888struct lock_manager {
@@ -941,7 +977,7 @@ void locks_free_lock(struct file_lock *fl);
941extern void locks_init_lock(struct file_lock *); 977extern void locks_init_lock(struct file_lock *);
942extern struct file_lock * locks_alloc_lock(void); 978extern struct file_lock * locks_alloc_lock(void);
943extern void locks_copy_lock(struct file_lock *, struct file_lock *); 979extern void locks_copy_lock(struct file_lock *, struct file_lock *);
944extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); 980extern void locks_copy_conflock(struct file_lock *, struct file_lock *);
945extern void locks_remove_posix(struct file *, fl_owner_t); 981extern void locks_remove_posix(struct file *, fl_owner_t);
946extern void locks_remove_file(struct file *); 982extern void locks_remove_file(struct file *);
947extern void locks_release_private(struct file_lock *); 983extern void locks_release_private(struct file_lock *);
@@ -955,11 +991,9 @@ extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
955extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 991extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
956extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); 992extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type);
957extern void lease_get_mtime(struct inode *, struct timespec *time); 993extern void lease_get_mtime(struct inode *, struct timespec *time);
958extern int generic_setlease(struct file *, long, struct file_lock **); 994extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
959extern int vfs_setlease(struct file *, long, struct file_lock **); 995extern int vfs_setlease(struct file *, long, struct file_lock **, void **);
960extern int lease_modify(struct file_lock **, int); 996extern int lease_modify(struct file_lock **, int, struct list_head *);
961extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
962extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
963#else /* !CONFIG_FILE_LOCKING */ 997#else /* !CONFIG_FILE_LOCKING */
964static inline int fcntl_getlk(struct file *file, unsigned int cmd, 998static inline int fcntl_getlk(struct file *file, unsigned int cmd,
965 struct flock __user *user) 999 struct flock __user *user)
@@ -988,12 +1022,12 @@ static inline int fcntl_setlk64(unsigned int fd, struct file *file,
988#endif 1022#endif
989static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg) 1023static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
990{ 1024{
991 return 0; 1025 return -EINVAL;
992} 1026}
993 1027
994static inline int fcntl_getlease(struct file *filp) 1028static inline int fcntl_getlease(struct file *filp)
995{ 1029{
996 return 0; 1030 return F_UNLCK;
997} 1031}
998 1032
999static inline void locks_init_lock(struct file_lock *fl) 1033static inline void locks_init_lock(struct file_lock *fl)
@@ -1001,7 +1035,7 @@ static inline void locks_init_lock(struct file_lock *fl)
1001 return; 1035 return;
1002} 1036}
1003 1037
1004static inline void __locks_copy_lock(struct file_lock *new, struct file_lock *fl) 1038static inline void locks_copy_conflock(struct file_lock *new, struct file_lock *fl)
1005{ 1039{
1006 return; 1040 return;
1007} 1041}
@@ -1075,33 +1109,22 @@ static inline void lease_get_mtime(struct inode *inode, struct timespec *time)
1075} 1109}
1076 1110
1077static inline int generic_setlease(struct file *filp, long arg, 1111static inline int generic_setlease(struct file *filp, long arg,
1078 struct file_lock **flp) 1112 struct file_lock **flp, void **priv)
1079{ 1113{
1080 return -EINVAL; 1114 return -EINVAL;
1081} 1115}
1082 1116
1083static inline int vfs_setlease(struct file *filp, long arg, 1117static inline int vfs_setlease(struct file *filp, long arg,
1084 struct file_lock **lease) 1118 struct file_lock **lease, void **priv)
1085{ 1119{
1086 return -EINVAL; 1120 return -EINVAL;
1087} 1121}
1088 1122
1089static inline int lease_modify(struct file_lock **before, int arg) 1123static inline int lease_modify(struct file_lock **before, int arg,
1124 struct list_head *dispose)
1090{ 1125{
1091 return -EINVAL; 1126 return -EINVAL;
1092} 1127}
1093
1094static inline int lock_may_read(struct inode *inode, loff_t start,
1095 unsigned long len)
1096{
1097 return 1;
1098}
1099
1100static inline int lock_may_write(struct inode *inode, loff_t start,
1101 unsigned long len)
1102{
1103 return 1;
1104}
1105#endif /* !CONFIG_FILE_LOCKING */ 1128#endif /* !CONFIG_FILE_LOCKING */
1106 1129
1107 1130
@@ -1126,8 +1149,8 @@ extern void fasync_free(struct fasync_struct *);
1126/* can be called from interrupts */ 1149/* can be called from interrupts */
1127extern void kill_fasync(struct fasync_struct **, int, int); 1150extern void kill_fasync(struct fasync_struct **, int, int);
1128 1151
1129extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force); 1152extern void __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
1130extern int f_setown(struct file *filp, unsigned long arg, int force); 1153extern void f_setown(struct file *filp, unsigned long arg, int force);
1131extern void f_delown(struct file *filp); 1154extern void f_delown(struct file *filp);
1132extern pid_t f_getown(struct file *filp); 1155extern pid_t f_getown(struct file *filp);
1133extern int send_sigurg(struct fown_struct *fown); 1156extern int send_sigurg(struct fown_struct *fown);
@@ -1250,6 +1273,7 @@ struct super_block {
1250 1273
1251 /* AIO completions deferred from interrupt context */ 1274 /* AIO completions deferred from interrupt context */
1252 struct workqueue_struct *s_dio_done_wq; 1275 struct workqueue_struct *s_dio_done_wq;
1276 struct hlist_head s_pins;
1253 1277
1254 /* 1278 /*
1255 * Keep the lru lists last in the structure so they always sit on their 1279 * Keep the lru lists last in the structure so they always sit on their
@@ -1258,6 +1282,11 @@ struct super_block {
1258 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp; 1282 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp;
1259 struct list_lru s_inode_lru ____cacheline_aligned_in_smp; 1283 struct list_lru s_inode_lru ____cacheline_aligned_in_smp;
1260 struct rcu_head rcu; 1284 struct rcu_head rcu;
1285
1286 /*
1287 * Indicates how deep in a filesystem stack this SB is
1288 */
1289 int s_stack_depth;
1261}; 1290};
1262 1291
1263extern struct timespec current_fs_time(struct super_block *sb); 1292extern struct timespec current_fs_time(struct super_block *sb);
@@ -1390,6 +1419,7 @@ extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct ino
1390extern int vfs_rmdir(struct inode *, struct dentry *); 1419extern int vfs_rmdir(struct inode *, struct dentry *);
1391extern int vfs_unlink(struct inode *, struct dentry *, struct inode **); 1420extern int vfs_unlink(struct inode *, struct dentry *, struct inode **);
1392extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int); 1421extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int);
1422extern int vfs_whiteout(struct inode *, struct dentry *);
1393 1423
1394/* 1424/*
1395 * VFS dentry helper functions. 1425 * VFS dentry helper functions.
@@ -1480,7 +1510,7 @@ struct file_operations {
1480 int (*flock) (struct file *, int, struct file_lock *); 1510 int (*flock) (struct file *, int, struct file_lock *);
1481 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); 1511 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
1482 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); 1512 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
1483 int (*setlease)(struct file *, long, struct file_lock **); 1513 int (*setlease)(struct file *, long, struct file_lock **, void **);
1484 long (*fallocate)(struct file *file, int mode, loff_t offset, 1514 long (*fallocate)(struct file *file, int mode, loff_t offset,
1485 loff_t len); 1515 loff_t len);
1486 int (*show_fdinfo)(struct seq_file *m, struct file *f); 1516 int (*show_fdinfo)(struct seq_file *m, struct file *f);
@@ -1520,6 +1550,9 @@ struct inode_operations {
1520 umode_t create_mode, int *opened); 1550 umode_t create_mode, int *opened);
1521 int (*tmpfile) (struct inode *, struct dentry *, umode_t); 1551 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
1522 int (*set_acl)(struct inode *, struct posix_acl *, int); 1552 int (*set_acl)(struct inode *, struct posix_acl *, int);
1553
1554 /* WARNING: probably going away soon, do not use! */
1555 int (*dentry_open)(struct dentry *, struct file *, const struct cred *);
1523} ____cacheline_aligned; 1556} ____cacheline_aligned;
1524 1557
1525ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, 1558ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
@@ -1617,6 +1650,9 @@ struct super_operations {
1617#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT) 1650#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT)
1618#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC) 1651#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC)
1619 1652
1653#define IS_WHITEOUT(inode) (S_ISCHR(inode->i_mode) && \
1654 (inode)->i_rdev == WHITEOUT_DEV)
1655
1620/* 1656/*
1621 * Inode state bits. Protected by inode->i_lock 1657 * Inode state bits. Protected by inode->i_lock
1622 * 1658 *
@@ -1829,7 +1865,8 @@ extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data);
1829extern void kern_unmount(struct vfsmount *mnt); 1865extern void kern_unmount(struct vfsmount *mnt);
1830extern int may_umount_tree(struct vfsmount *); 1866extern int may_umount_tree(struct vfsmount *);
1831extern int may_umount(struct vfsmount *); 1867extern int may_umount(struct vfsmount *);
1832extern long do_mount(const char *, const char *, const char *, unsigned long, void *); 1868extern long do_mount(const char *, const char __user *,
1869 const char *, unsigned long, void *);
1833extern struct vfsmount *collect_mounts(struct path *); 1870extern struct vfsmount *collect_mounts(struct path *);
1834extern void drop_collected_mounts(struct vfsmount *); 1871extern void drop_collected_mounts(struct vfsmount *);
1835extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1872extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
@@ -1848,7 +1885,7 @@ extern int current_umask(void);
1848extern void ihold(struct inode * inode); 1885extern void ihold(struct inode * inode);
1849extern void iput(struct inode *); 1886extern void iput(struct inode *);
1850 1887
1851static inline struct inode *file_inode(struct file *f) 1888static inline struct inode *file_inode(const struct file *f)
1852{ 1889{
1853 return f->f_inode; 1890 return f->f_inode;
1854} 1891}
@@ -2031,6 +2068,7 @@ extern struct file *file_open_name(struct filename *, int, umode_t);
2031extern struct file *filp_open(const char *, int, umode_t); 2068extern struct file *filp_open(const char *, int, umode_t);
2032extern struct file *file_open_root(struct dentry *, struct vfsmount *, 2069extern struct file *file_open_root(struct dentry *, struct vfsmount *,
2033 const char *, int); 2070 const char *, int);
2071extern int vfs_open(const struct path *, struct file *, const struct cred *);
2034extern struct file * dentry_open(const struct path *, int, const struct cred *); 2072extern struct file * dentry_open(const struct path *, int, const struct cred *);
2035extern int filp_close(struct file *, fl_owner_t id); 2073extern int filp_close(struct file *, fl_owner_t id);
2036 2074
@@ -2244,7 +2282,9 @@ extern sector_t bmap(struct inode *, sector_t);
2244#endif 2282#endif
2245extern int notify_change(struct dentry *, struct iattr *, struct inode **); 2283extern int notify_change(struct dentry *, struct iattr *, struct inode **);
2246extern int inode_permission(struct inode *, int); 2284extern int inode_permission(struct inode *, int);
2285extern int __inode_permission(struct inode *, int);
2247extern int generic_permission(struct inode *, int); 2286extern int generic_permission(struct inode *, int);
2287extern int __check_sticky(struct inode *dir, struct inode *inode);
2248 2288
2249static inline bool execute_ok(struct inode *inode) 2289static inline bool execute_ok(struct inode *inode)
2250{ 2290{
@@ -2335,6 +2375,7 @@ extern int do_pipe_flags(int *, int);
2335 2375
2336extern int kernel_read(struct file *, loff_t, char *, unsigned long); 2376extern int kernel_read(struct file *, loff_t, char *, unsigned long);
2337extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t); 2377extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t);
2378extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *);
2338extern struct file * open_exec(const char *); 2379extern struct file * open_exec(const char *);
2339 2380
2340/* fs/dcache.c -- generic fs support functions */ 2381/* fs/dcache.c -- generic fs support functions */
@@ -2428,6 +2469,7 @@ extern ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, lo
2428extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); 2469extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2429 2470
2430/* fs/block_dev.c */ 2471/* fs/block_dev.c */
2472extern ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to);
2431extern ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from); 2473extern ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from);
2432extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, 2474extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
2433 int datasync); 2475 int datasync);
@@ -2442,6 +2484,9 @@ extern ssize_t iter_file_splice_write(struct pipe_inode_info *,
2442 struct file *, loff_t *, size_t, unsigned int); 2484 struct file *, loff_t *, size_t, unsigned int);
2443extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, 2485extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
2444 struct file *out, loff_t *, size_t len, unsigned int flags); 2486 struct file *out, loff_t *, size_t len, unsigned int flags);
2487extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
2488 loff_t *opos, size_t len, unsigned int flags);
2489
2445 2490
2446extern void 2491extern void
2447file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 2492file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
@@ -2584,6 +2629,7 @@ extern int simple_write_end(struct file *file, struct address_space *mapping,
2584 struct page *page, void *fsdata); 2629 struct page *page, void *fsdata);
2585extern int always_delete_dentry(const struct dentry *); 2630extern int always_delete_dentry(const struct dentry *);
2586extern struct inode *alloc_anon_inode(struct super_block *); 2631extern struct inode *alloc_anon_inode(struct super_block *);
2632extern int simple_nosetlease(struct file *, long, struct file_lock **, void **);
2587extern const struct dentry_operations simple_dentry_operations; 2633extern const struct dentry_operations simple_dentry_operations;
2588 2634
2589extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); 2635extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
@@ -2688,7 +2734,7 @@ static const struct file_operations __fops = { \
2688 .read = simple_attr_read, \ 2734 .read = simple_attr_read, \
2689 .write = simple_attr_write, \ 2735 .write = simple_attr_write, \
2690 .llseek = generic_file_llseek, \ 2736 .llseek = generic_file_llseek, \
2691}; 2737}
2692 2738
2693static inline __printf(1, 2) 2739static inline __printf(1, 2)
2694void __simple_attr_check_format(const char *fmt, ...) 2740void __simple_attr_check_format(const char *fmt, ...)
@@ -2726,6 +2772,14 @@ static inline int is_sxid(umode_t mode)
2726 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); 2772 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
2727} 2773}
2728 2774
2775static inline int check_sticky(struct inode *dir, struct inode *inode)
2776{
2777 if (!(dir->i_mode & S_ISVTX))
2778 return 0;
2779
2780 return __check_sticky(dir, inode);
2781}
2782
2729static inline void inode_has_no_xattr(struct inode *inode) 2783static inline void inode_has_no_xattr(struct inode *inode)
2730{ 2784{
2731 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC)) 2785 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC))
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index efb05961bdd8..77d783f71527 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -139,7 +139,6 @@ struct fs_platform_info {
139 int rx_ring, tx_ring; /* number of buffers on rx */ 139 int rx_ring, tx_ring; /* number of buffers on rx */
140 __u8 macaddr[ETH_ALEN]; /* mac address */ 140 __u8 macaddr[ETH_ALEN]; /* mac address */
141 int rx_copybreak; /* limit we copy small frames */ 141 int rx_copybreak; /* limit we copy small frames */
142 int use_napi; /* use NAPI */
143 int napi_weight; /* NAPI weight */ 142 int napi_weight; /* NAPI weight */
144 143
145 int use_rmii; /* use RMII mode */ 144 int use_rmii; /* use RMII mode */
diff --git a/include/linux/fs_pin.h b/include/linux/fs_pin.h
new file mode 100644
index 000000000000..f66525e72ccf
--- /dev/null
+++ b/include/linux/fs_pin.h
@@ -0,0 +1,17 @@
1#include <linux/fs.h>
2
3struct fs_pin {
4 atomic_long_t count;
5 union {
6 struct {
7 struct hlist_node s_list;
8 struct hlist_node m_list;
9 };
10 struct rcu_head rcu;
11 };
12 void (*kill)(struct fs_pin *);
13};
14
15void pin_put(struct fs_pin *);
16void pin_remove(struct fs_pin *);
17void pin_insert(struct fs_pin *, struct vfsmount *);
diff --git a/include/linux/fsl_ifc.h b/include/linux/fsl_ifc.h
index f49ddb1b2273..84d60cb841b1 100644
--- a/include/linux/fsl_ifc.h
+++ b/include/linux/fsl_ifc.h
@@ -781,13 +781,13 @@ struct fsl_ifc_regs {
781 __be32 amask; 781 __be32 amask;
782 u32 res4[0x2]; 782 u32 res4[0x2];
783 } amask_cs[FSL_IFC_BANK_COUNT]; 783 } amask_cs[FSL_IFC_BANK_COUNT];
784 u32 res5[0x17]; 784 u32 res5[0x18];
785 struct { 785 struct {
786 __be32 csor_ext;
787 __be32 csor; 786 __be32 csor;
787 __be32 csor_ext;
788 u32 res6; 788 u32 res6;
789 } csor_cs[FSL_IFC_BANK_COUNT]; 789 } csor_cs[FSL_IFC_BANK_COUNT];
790 u32 res7[0x19]; 790 u32 res7[0x18];
791 struct { 791 struct {
792 __be32 ftim[4]; 792 __be32 ftim[4];
793 u32 res8[0x8]; 793 u32 res8[0x8];
diff --git a/include/linux/fsldma.h b/include/linux/fsldma.h
new file mode 100644
index 000000000000..b213c02963c9
--- /dev/null
+++ b/include/linux/fsldma.h
@@ -0,0 +1,13 @@
1/*
2 * This is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 */
7
8#ifndef FSL_DMA_H
9#define FSL_DMA_H
10/* fsl dma API for enxternal start */
11int fsl_dma_external_start(struct dma_chan *dchan, int enable);
12
13#endif
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index fc7718c6bd3e..ca060d7c4fa6 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -322,16 +322,18 @@ extern int fsnotify_fasync(int fd, struct file *file, int on);
322extern void fsnotify_destroy_event(struct fsnotify_group *group, 322extern void fsnotify_destroy_event(struct fsnotify_group *group,
323 struct fsnotify_event *event); 323 struct fsnotify_event *event);
324/* attach the event to the group notification queue */ 324/* attach the event to the group notification queue */
325extern int fsnotify_add_notify_event(struct fsnotify_group *group, 325extern int fsnotify_add_event(struct fsnotify_group *group,
326 struct fsnotify_event *event, 326 struct fsnotify_event *event,
327 int (*merge)(struct list_head *, 327 int (*merge)(struct list_head *,
328 struct fsnotify_event *)); 328 struct fsnotify_event *));
329/* Remove passed event from groups notification queue */
330extern void fsnotify_remove_event(struct fsnotify_group *group, struct fsnotify_event *event);
329/* true if the group notification queue is empty */ 331/* true if the group notification queue is empty */
330extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group); 332extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
331/* return, but do not dequeue the first event on the notification queue */ 333/* return, but do not dequeue the first event on the notification queue */
332extern struct fsnotify_event *fsnotify_peek_notify_event(struct fsnotify_group *group); 334extern struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group);
333/* return AND dequeue the first event on the notification queue */ 335/* return AND dequeue the first event on the notification queue */
334extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group); 336extern struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group);
335 337
336/* functions used to manipulate the marks attached to inodes */ 338/* functions used to manipulate the marks attached to inodes */
337 339
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 6bb5e3f2a3b4..662697babd48 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -56,6 +56,8 @@ struct ftrace_ops;
56typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip, 56typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
57 struct ftrace_ops *op, struct pt_regs *regs); 57 struct ftrace_ops *op, struct pt_regs *regs);
58 58
59ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops);
60
59/* 61/*
60 * FTRACE_OPS_FL_* bits denote the state of ftrace_ops struct and are 62 * FTRACE_OPS_FL_* bits denote the state of ftrace_ops struct and are
61 * set in the flags member. 63 * set in the flags member.
@@ -89,6 +91,9 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
89 * INITIALIZED - The ftrace_ops has already been initialized (first use time 91 * INITIALIZED - The ftrace_ops has already been initialized (first use time
90 * register_ftrace_function() is called, it will initialized the ops) 92 * register_ftrace_function() is called, it will initialized the ops)
91 * DELETED - The ops are being deleted, do not let them be registered again. 93 * DELETED - The ops are being deleted, do not let them be registered again.
94 * ADDING - The ops is in the process of being added.
95 * REMOVING - The ops is in the process of being removed.
96 * MODIFYING - The ops is in the process of changing its filter functions.
92 */ 97 */
93enum { 98enum {
94 FTRACE_OPS_FL_ENABLED = 1 << 0, 99 FTRACE_OPS_FL_ENABLED = 1 << 0,
@@ -100,8 +105,20 @@ enum {
100 FTRACE_OPS_FL_STUB = 1 << 6, 105 FTRACE_OPS_FL_STUB = 1 << 6,
101 FTRACE_OPS_FL_INITIALIZED = 1 << 7, 106 FTRACE_OPS_FL_INITIALIZED = 1 << 7,
102 FTRACE_OPS_FL_DELETED = 1 << 8, 107 FTRACE_OPS_FL_DELETED = 1 << 8,
108 FTRACE_OPS_FL_ADDING = 1 << 9,
109 FTRACE_OPS_FL_REMOVING = 1 << 10,
110 FTRACE_OPS_FL_MODIFYING = 1 << 11,
103}; 111};
104 112
113#ifdef CONFIG_DYNAMIC_FTRACE
114/* The hash used to know what functions callbacks trace */
115struct ftrace_ops_hash {
116 struct ftrace_hash *notrace_hash;
117 struct ftrace_hash *filter_hash;
118 struct mutex regex_lock;
119};
120#endif
121
105/* 122/*
106 * Note, ftrace_ops can be referenced outside of RCU protection. 123 * Note, ftrace_ops can be referenced outside of RCU protection.
107 * (Although, for perf, the control ops prevent that). If ftrace_ops is 124 * (Although, for perf, the control ops prevent that). If ftrace_ops is
@@ -121,10 +138,9 @@ struct ftrace_ops {
121 int __percpu *disabled; 138 int __percpu *disabled;
122#ifdef CONFIG_DYNAMIC_FTRACE 139#ifdef CONFIG_DYNAMIC_FTRACE
123 int nr_trampolines; 140 int nr_trampolines;
124 struct ftrace_hash *notrace_hash; 141 struct ftrace_ops_hash local_hash;
125 struct ftrace_hash *filter_hash; 142 struct ftrace_ops_hash *func_hash;
126 struct ftrace_hash *tramp_hash; 143 struct ftrace_ops_hash old_hash;
127 struct mutex regex_lock;
128 unsigned long trampoline; 144 unsigned long trampoline;
129#endif 145#endif
130}; 146};
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 06c6faa9e5cc..28672e87e910 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -571,40 +571,6 @@ do { \
571 __trace_printk(ip, fmt, ##args); \ 571 __trace_printk(ip, fmt, ##args); \
572} while (0) 572} while (0)
573 573
574/**
575 * tracepoint_string - register constant persistent string to trace system
576 * @str - a constant persistent string that will be referenced in tracepoints
577 *
578 * If constant strings are being used in tracepoints, it is faster and
579 * more efficient to just save the pointer to the string and reference
580 * that with a printf "%s" instead of saving the string in the ring buffer
581 * and wasting space and time.
582 *
583 * The problem with the above approach is that userspace tools that read
584 * the binary output of the trace buffers do not have access to the string.
585 * Instead they just show the address of the string which is not very
586 * useful to users.
587 *
588 * With tracepoint_string(), the string will be registered to the tracing
589 * system and exported to userspace via the debugfs/tracing/printk_formats
590 * file that maps the string address to the string text. This way userspace
591 * tools that read the binary buffers have a way to map the pointers to
592 * the ASCII strings they represent.
593 *
594 * The @str used must be a constant string and persistent as it would not
595 * make sense to show a string that no longer exists. But it is still fine
596 * to be used with modules, because when modules are unloaded, if they
597 * had tracepoints, the ring buffers are cleared too. As long as the string
598 * does not change during the life of the module, it is fine to use
599 * tracepoint_string() within a module.
600 */
601#define tracepoint_string(str) \
602 ({ \
603 static const char *___tp_str __tracepoint_string = str; \
604 ___tp_str; \
605 })
606#define __tracepoint_string __attribute__((section("__tracepoint_str")))
607
608#ifdef CONFIG_PERF_EVENTS 574#ifdef CONFIG_PERF_EVENTS
609struct perf_event; 575struct perf_event;
610 576
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index 1c2fdaa2ffc3..1ccaab44abcc 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -110,6 +110,10 @@ extern void gen_pool_set_algo(struct gen_pool *pool, genpool_algo_t algo,
110extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size, 110extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size,
111 unsigned long start, unsigned int nr, void *data); 111 unsigned long start, unsigned int nr, void *data);
112 112
113extern unsigned long gen_pool_first_fit_order_align(unsigned long *map,
114 unsigned long size, unsigned long start, unsigned int nr,
115 void *data);
116
113extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size, 117extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size,
114 unsigned long start, unsigned int nr, void *data); 118 unsigned long start, unsigned int nr, void *data);
115 119
@@ -117,6 +121,9 @@ extern struct gen_pool *devm_gen_pool_create(struct device *dev,
117 int min_alloc_order, int nid); 121 int min_alloc_order, int nid);
118extern struct gen_pool *dev_get_gen_pool(struct device *dev); 122extern struct gen_pool *dev_get_gen_pool(struct device *dev);
119 123
124bool addr_in_gen_pool(struct gen_pool *pool, unsigned long start,
125 size_t size);
126
120#ifdef CONFIG_OF 127#ifdef CONFIG_OF
121extern struct gen_pool *of_get_named_gen_pool(struct device_node *np, 128extern struct gen_pool *of_get_named_gen_pool(struct device_node *np,
122 const char *propname, int index); 129 const char *propname, int index);
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h
index c0894dd8827b..667c31101b8b 100644
--- a/include/linux/genl_magic_func.h
+++ b/include/linux/genl_magic_func.h
@@ -178,12 +178,12 @@ static int s_name ## _from_attrs_for_change(struct s_name *s, \
178#define __assign(attr_nr, attr_flag, name, nla_type, type, assignment...) \ 178#define __assign(attr_nr, attr_flag, name, nla_type, type, assignment...) \
179 nla = ntb[attr_nr]; \ 179 nla = ntb[attr_nr]; \
180 if (nla) { \ 180 if (nla) { \
181 if (exclude_invariants && ((attr_flag) & DRBD_F_INVARIANT)) { \ 181 if (exclude_invariants && !!((attr_flag) & DRBD_F_INVARIANT)) { \
182 pr_info("<< must not change invariant attr: %s\n", #name); \ 182 pr_info("<< must not change invariant attr: %s\n", #name); \
183 return -EEXIST; \ 183 return -EEXIST; \
184 } \ 184 } \
185 assignment; \ 185 assignment; \
186 } else if (exclude_invariants && ((attr_flag) & DRBD_F_INVARIANT)) { \ 186 } else if (exclude_invariants && !!((attr_flag) & DRBD_F_INVARIANT)) { \
187 /* attribute missing from payload, */ \ 187 /* attribute missing from payload, */ \
188 /* which was expected */ \ 188 /* which was expected */ \
189 } else if ((attr_flag) & DRBD_F_REQUIRED) { \ 189 } else if ((attr_flag) & DRBD_F_REQUIRED) { \
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 6eb1fb37de9a..41b30fd4d041 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -156,7 +156,7 @@ struct vm_area_struct;
156#define GFP_DMA32 __GFP_DMA32 156#define GFP_DMA32 __GFP_DMA32
157 157
158/* Convert GFP flags to their corresponding migrate type */ 158/* Convert GFP flags to their corresponding migrate type */
159static inline int allocflags_to_migratetype(gfp_t gfp_flags) 159static inline int gfpflags_to_migratetype(const gfp_t gfp_flags)
160{ 160{
161 WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK); 161 WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK);
162 162
@@ -360,7 +360,7 @@ extern unsigned long get_zeroed_page(gfp_t gfp_mask);
360void *alloc_pages_exact(size_t size, gfp_t gfp_mask); 360void *alloc_pages_exact(size_t size, gfp_t gfp_mask);
361void free_pages_exact(void *virt, size_t size); 361void free_pages_exact(void *virt, size_t size);
362/* This is different from alloc_pages_exact_node !!! */ 362/* This is different from alloc_pages_exact_node !!! */
363void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask); 363void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask);
364 364
365#define __get_free_page(gfp_mask) \ 365#define __get_free_page(gfp_mask) \
366 __get_free_pages((gfp_mask), 0) 366 __get_free_pages((gfp_mask), 0)
diff --git a/include/linux/glob.h b/include/linux/glob.h
new file mode 100644
index 000000000000..861d8347d08e
--- /dev/null
+++ b/include/linux/glob.h
@@ -0,0 +1,9 @@
1#ifndef _LINUX_GLOB_H
2#define _LINUX_GLOB_H
3
4#include <linux/types.h> /* For bool */
5#include <linux/compiler.h> /* For __pure */
6
7bool __pure glob_match(char const *pat, char const *str);
8
9#endif /* _LINUX_GLOB_H */
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 05e53ccb708b..12f146fa6604 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -16,33 +16,54 @@ struct device;
16 */ 16 */
17struct gpio_desc; 17struct gpio_desc;
18 18
19#define GPIOD_FLAGS_BIT_DIR_SET BIT(0)
20#define GPIOD_FLAGS_BIT_DIR_OUT BIT(1)
21#define GPIOD_FLAGS_BIT_DIR_VAL BIT(2)
22
23/**
24 * Optional flags that can be passed to one of gpiod_* to configure direction
25 * and output value. These values cannot be OR'd.
26 */
27enum gpiod_flags {
28 GPIOD_ASIS = 0,
29 GPIOD_IN = GPIOD_FLAGS_BIT_DIR_SET,
30 GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT,
31 GPIOD_OUT_HIGH = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT |
32 GPIOD_FLAGS_BIT_DIR_VAL,
33};
34
19#ifdef CONFIG_GPIOLIB 35#ifdef CONFIG_GPIOLIB
20 36
21/* Acquire and dispose GPIOs */ 37/* Acquire and dispose GPIOs */
22struct gpio_desc *__must_check gpiod_get(struct device *dev, 38struct gpio_desc *__must_check __gpiod_get(struct device *dev,
23 const char *con_id); 39 const char *con_id,
24struct gpio_desc *__must_check gpiod_get_index(struct device *dev, 40 enum gpiod_flags flags);
41struct gpio_desc *__must_check __gpiod_get_index(struct device *dev,
25 const char *con_id, 42 const char *con_id,
26 unsigned int idx); 43 unsigned int idx,
27struct gpio_desc *__must_check gpiod_get_optional(struct device *dev, 44 enum gpiod_flags flags);
28 const char *con_id); 45struct gpio_desc *__must_check __gpiod_get_optional(struct device *dev,
29struct gpio_desc *__must_check gpiod_get_index_optional(struct device *dev, 46 const char *con_id,
47 enum gpiod_flags flags);
48struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev,
30 const char *con_id, 49 const char *con_id,
31 unsigned int index); 50 unsigned int index,
32 51 enum gpiod_flags flags);
33void gpiod_put(struct gpio_desc *desc); 52void gpiod_put(struct gpio_desc *desc);
34 53
35struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, 54struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev,
36 const char *con_id); 55 const char *con_id,
37struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, 56 enum gpiod_flags flags);
57struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev,
38 const char *con_id, 58 const char *con_id,
39 unsigned int idx); 59 unsigned int idx,
40struct gpio_desc *__must_check devm_gpiod_get_optional(struct device *dev, 60 enum gpiod_flags flags);
41 const char *con_id); 61struct gpio_desc *__must_check __devm_gpiod_get_optional(struct device *dev,
62 const char *con_id,
63 enum gpiod_flags flags);
42struct gpio_desc *__must_check 64struct gpio_desc *__must_check
43devm_gpiod_get_index_optional(struct device *dev, const char *con_id, 65__devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
44 unsigned int index); 66 unsigned int index, enum gpiod_flags flags);
45
46void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); 67void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
47 68
48int gpiod_get_direction(const struct gpio_desc *desc); 69int gpiod_get_direction(const struct gpio_desc *desc);
@@ -75,27 +96,31 @@ int desc_to_gpio(const struct gpio_desc *desc);
75 96
76#else /* CONFIG_GPIOLIB */ 97#else /* CONFIG_GPIOLIB */
77 98
78static inline struct gpio_desc *__must_check gpiod_get(struct device *dev, 99static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev,
79 const char *con_id) 100 const char *con_id,
101 enum gpiod_flags flags)
80{ 102{
81 return ERR_PTR(-ENOSYS); 103 return ERR_PTR(-ENOSYS);
82} 104}
83static inline struct gpio_desc *__must_check gpiod_get_index(struct device *dev, 105static inline struct gpio_desc *__must_check
84 const char *con_id, 106__gpiod_get_index(struct device *dev,
85 unsigned int idx) 107 const char *con_id,
108 unsigned int idx,
109 enum gpiod_flags flags)
86{ 110{
87 return ERR_PTR(-ENOSYS); 111 return ERR_PTR(-ENOSYS);
88} 112}
89 113
90static inline struct gpio_desc *__must_check 114static inline struct gpio_desc *__must_check
91gpiod_get_optional(struct device *dev, const char *con_id) 115__gpiod_get_optional(struct device *dev, const char *con_id,
116 enum gpiod_flags flags)
92{ 117{
93 return ERR_PTR(-ENOSYS); 118 return ERR_PTR(-ENOSYS);
94} 119}
95 120
96static inline struct gpio_desc *__must_check 121static inline struct gpio_desc *__must_check
97gpiod_get_index_optional(struct device *dev, const char *con_id, 122__gpiod_get_index_optional(struct device *dev, const char *con_id,
98 unsigned int index) 123 unsigned int index, enum gpiod_flags flags)
99{ 124{
100 return ERR_PTR(-ENOSYS); 125 return ERR_PTR(-ENOSYS);
101} 126}
@@ -108,28 +133,33 @@ static inline void gpiod_put(struct gpio_desc *desc)
108 WARN_ON(1); 133 WARN_ON(1);
109} 134}
110 135
111static inline struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, 136static inline struct gpio_desc *__must_check
112 const char *con_id) 137__devm_gpiod_get(struct device *dev,
138 const char *con_id,
139 enum gpiod_flags flags)
113{ 140{
114 return ERR_PTR(-ENOSYS); 141 return ERR_PTR(-ENOSYS);
115} 142}
116static inline 143static inline
117struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, 144struct gpio_desc *__must_check
118 const char *con_id, 145__devm_gpiod_get_index(struct device *dev,
119 unsigned int idx) 146 const char *con_id,
147 unsigned int idx,
148 enum gpiod_flags flags)
120{ 149{
121 return ERR_PTR(-ENOSYS); 150 return ERR_PTR(-ENOSYS);
122} 151}
123 152
124static inline struct gpio_desc *__must_check 153static inline struct gpio_desc *__must_check
125devm_gpiod_get_optional(struct device *dev, const char *con_id) 154__devm_gpiod_get_optional(struct device *dev, const char *con_id,
155 enum gpiod_flags flags)
126{ 156{
127 return ERR_PTR(-ENOSYS); 157 return ERR_PTR(-ENOSYS);
128} 158}
129 159
130static inline struct gpio_desc *__must_check 160static inline struct gpio_desc *__must_check
131devm_gpiod_get_index_optional(struct device *dev, const char *con_id, 161__devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
132 unsigned int index) 162 unsigned int index, enum gpiod_flags flags)
133{ 163{
134 return ERR_PTR(-ENOSYS); 164 return ERR_PTR(-ENOSYS);
135} 165}
@@ -254,9 +284,43 @@ static inline int desc_to_gpio(const struct gpio_desc *desc)
254 return -EINVAL; 284 return -EINVAL;
255} 285}
256 286
257
258#endif /* CONFIG_GPIOLIB */ 287#endif /* CONFIG_GPIOLIB */
259 288
289/*
290 * Vararg-hacks! This is done to transition the kernel to always pass
291 * the options flags argument to the below functions. During a transition
292 * phase these vararg macros make both old-and-newstyle code compile,
293 * but when all calls to the elder API are removed, these should go away
294 * and the __gpiod_get() etc functions above be renamed just gpiod_get()
295 * etc.
296 */
297#define __gpiod_get(dev, con_id, flags, ...) __gpiod_get(dev, con_id, flags)
298#define gpiod_get(varargs...) __gpiod_get(varargs, 0)
299#define __gpiod_get_index(dev, con_id, index, flags, ...) \
300 __gpiod_get_index(dev, con_id, index, flags)
301#define gpiod_get_index(varargs...) __gpiod_get_index(varargs, 0)
302#define __gpiod_get_optional(dev, con_id, flags, ...) \
303 __gpiod_get_optional(dev, con_id, flags)
304#define gpiod_get_optional(varargs...) __gpiod_get_optional(varargs, 0)
305#define __gpiod_get_index_optional(dev, con_id, index, flags, ...) \
306 __gpiod_get_index_optional(dev, con_id, index, flags)
307#define gpiod_get_index_optional(varargs...) \
308 __gpiod_get_index_optional(varargs, 0)
309#define __devm_gpiod_get(dev, con_id, flags, ...) \
310 __devm_gpiod_get(dev, con_id, flags)
311#define devm_gpiod_get(varargs...) __devm_gpiod_get(varargs, 0)
312#define __devm_gpiod_get_index(dev, con_id, index, flags, ...) \
313 __devm_gpiod_get_index(dev, con_id, index, flags)
314#define devm_gpiod_get_index(varargs...) __devm_gpiod_get_index(varargs, 0)
315#define __devm_gpiod_get_optional(dev, con_id, flags, ...) \
316 __devm_gpiod_get_optional(dev, con_id, flags)
317#define devm_gpiod_get_optional(varargs...) \
318 __devm_gpiod_get_optional(varargs, 0)
319#define __devm_gpiod_get_index_optional(dev, con_id, index, flags, ...) \
320 __devm_gpiod_get_index_optional(dev, con_id, index, flags)
321#define devm_gpiod_get_index_optional(varargs...) \
322 __devm_gpiod_get_index_optional(varargs, 0)
323
260#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) 324#if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
261 325
262int gpiod_export(struct gpio_desc *desc, bool direction_may_change); 326int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 4fcd60913a42..249db3057e4d 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -56,6 +56,8 @@ struct seq_file;
56 * as the chip access may sleep when e.g. reading out the IRQ status 56 * as the chip access may sleep when e.g. reading out the IRQ status
57 * registers. 57 * registers.
58 * @exported: flags if the gpiochip is exported for use from sysfs. Private. 58 * @exported: flags if the gpiochip is exported for use from sysfs. Private.
59 * @irq_not_threaded: flag must be set if @can_sleep is set but the
60 * IRQs don't need to be threaded
59 * 61 *
60 * A gpio_chip can help platforms abstract various sources of GPIOs so 62 * A gpio_chip can help platforms abstract various sources of GPIOs so
61 * they can all be accessed through a common programing interface. 63 * they can all be accessed through a common programing interface.
@@ -101,6 +103,7 @@ struct gpio_chip {
101 struct gpio_desc *desc; 103 struct gpio_desc *desc;
102 const char *const *names; 104 const char *const *names;
103 bool can_sleep; 105 bool can_sleep;
106 bool irq_not_threaded;
104 bool exported; 107 bool exported;
105 108
106#ifdef CONFIG_GPIOLIB_IRQCHIP 109#ifdef CONFIG_GPIOLIB_IRQCHIP
@@ -141,73 +144,16 @@ extern const char *gpiochip_is_requested(struct gpio_chip *chip,
141 144
142/* add/remove chips */ 145/* add/remove chips */
143extern int gpiochip_add(struct gpio_chip *chip); 146extern int gpiochip_add(struct gpio_chip *chip);
144extern int __must_check gpiochip_remove(struct gpio_chip *chip); 147extern void gpiochip_remove(struct gpio_chip *chip);
145extern struct gpio_chip *gpiochip_find(void *data, 148extern struct gpio_chip *gpiochip_find(void *data,
146 int (*match)(struct gpio_chip *chip, void *data)); 149 int (*match)(struct gpio_chip *chip, void *data));
147 150
148/* lock/unlock as IRQ */ 151/* lock/unlock as IRQ */
149int gpiod_lock_as_irq(struct gpio_desc *desc); 152int gpio_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
150void gpiod_unlock_as_irq(struct gpio_desc *desc); 153void gpio_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
151 154
152struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc); 155struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
153 156
154struct gpio_desc *gpiochip_get_desc(struct gpio_chip *chip,
155 u16 hwnum);
156
157enum gpio_lookup_flags {
158 GPIO_ACTIVE_HIGH = (0 << 0),
159 GPIO_ACTIVE_LOW = (1 << 0),
160 GPIO_OPEN_DRAIN = (1 << 1),
161 GPIO_OPEN_SOURCE = (1 << 2),
162};
163
164/**
165 * struct gpiod_lookup - lookup table
166 * @chip_label: name of the chip the GPIO belongs to
167 * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO
168 * @con_id: name of the GPIO from the device's point of view
169 * @idx: index of the GPIO in case several GPIOs share the same name
170 * @flags: mask of GPIO_* values
171 *
172 * gpiod_lookup is a lookup table for associating GPIOs to specific devices and
173 * functions using platform data.
174 */
175struct gpiod_lookup {
176 const char *chip_label;
177 u16 chip_hwnum;
178 const char *con_id;
179 unsigned int idx;
180 enum gpio_lookup_flags flags;
181};
182
183struct gpiod_lookup_table {
184 struct list_head list;
185 const char *dev_id;
186 struct gpiod_lookup table[];
187};
188
189/*
190 * Simple definition of a single GPIO under a con_id
191 */
192#define GPIO_LOOKUP(_chip_label, _chip_hwnum, _con_id, _flags) \
193 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, 0, _flags)
194
195/*
196 * Use this macro if you need to have several GPIOs under the same con_id.
197 * Each GPIO needs to use a different index and can be accessed using
198 * gpiod_get_index()
199 */
200#define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, _idx, _flags) \
201{ \
202 .chip_label = _chip_label, \
203 .chip_hwnum = _chip_hwnum, \
204 .con_id = _con_id, \
205 .idx = _idx, \
206 .flags = _flags, \
207}
208
209void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
210
211#ifdef CONFIG_GPIOLIB_IRQCHIP 157#ifdef CONFIG_GPIOLIB_IRQCHIP
212 158
213void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip, 159void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,
@@ -223,6 +169,10 @@ int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
223 169
224#endif /* CONFIG_GPIOLIB_IRQCHIP */ 170#endif /* CONFIG_GPIOLIB_IRQCHIP */
225 171
172struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum,
173 const char *label);
174void gpiochip_free_own_desc(struct gpio_desc *desc);
175
226#else /* CONFIG_GPIOLIB */ 176#else /* CONFIG_GPIOLIB */
227 177
228static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) 178static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
diff --git a/include/linux/gpio/machine.h b/include/linux/gpio/machine.h
new file mode 100644
index 000000000000..e2706140eaff
--- /dev/null
+++ b/include/linux/gpio/machine.h
@@ -0,0 +1,61 @@
1#ifndef __LINUX_GPIO_MACHINE_H
2#define __LINUX_GPIO_MACHINE_H
3
4#include <linux/types.h>
5#include <linux/list.h>
6
7enum gpio_lookup_flags {
8 GPIO_ACTIVE_HIGH = (0 << 0),
9 GPIO_ACTIVE_LOW = (1 << 0),
10 GPIO_OPEN_DRAIN = (1 << 1),
11 GPIO_OPEN_SOURCE = (1 << 2),
12};
13
14/**
15 * struct gpiod_lookup - lookup table
16 * @chip_label: name of the chip the GPIO belongs to
17 * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO
18 * @con_id: name of the GPIO from the device's point of view
19 * @idx: index of the GPIO in case several GPIOs share the same name
20 * @flags: mask of GPIO_* values
21 *
22 * gpiod_lookup is a lookup table for associating GPIOs to specific devices and
23 * functions using platform data.
24 */
25struct gpiod_lookup {
26 const char *chip_label;
27 u16 chip_hwnum;
28 const char *con_id;
29 unsigned int idx;
30 enum gpio_lookup_flags flags;
31};
32
33struct gpiod_lookup_table {
34 struct list_head list;
35 const char *dev_id;
36 struct gpiod_lookup table[];
37};
38
39/*
40 * Simple definition of a single GPIO under a con_id
41 */
42#define GPIO_LOOKUP(_chip_label, _chip_hwnum, _con_id, _flags) \
43 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, 0, _flags)
44
45/*
46 * Use this macro if you need to have several GPIOs under the same con_id.
47 * Each GPIO needs to use a different index and can be accessed using
48 * gpiod_get_index()
49 */
50#define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, _idx, _flags) \
51{ \
52 .chip_label = _chip_label, \
53 .chip_hwnum = _chip_hwnum, \
54 .con_id = _con_id, \
55 .idx = _idx, \
56 .flags = _flags, \
57}
58
59void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
60
61#endif /* __LINUX_GPIO_MACHINE_H */
diff --git a/include/linux/hash.h b/include/linux/hash.h
index bd1754c7ecef..d0494c399392 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -37,6 +37,9 @@ static __always_inline u64 hash_64(u64 val, unsigned int bits)
37{ 37{
38 u64 hash = val; 38 u64 hash = val;
39 39
40#if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64
41 hash = hash * GOLDEN_RATIO_PRIME_64;
42#else
40 /* Sigh, gcc can't optimise this alone like it does for 32 bits. */ 43 /* Sigh, gcc can't optimise this alone like it does for 32 bits. */
41 u64 n = hash; 44 u64 n = hash;
42 n <<= 18; 45 n <<= 18;
@@ -51,6 +54,7 @@ static __always_inline u64 hash_64(u64 val, unsigned int bits)
51 hash += n; 54 hash += n;
52 n <<= 2; 55 n <<= 2;
53 hash += n; 56 hash += n;
57#endif
54 58
55 /* High bits are more random, so use them. */ 59 /* High bits are more random, so use them. */
56 return hash >> (64 - bits); 60 return hash >> (64 - bits);
diff --git a/include/linux/hid.h b/include/linux/hid.h
index fca74f1d5c84..78ea9bf941cd 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -265,6 +265,7 @@ struct hid_item {
265#define HID_CONNECT_HIDDEV 0x08 265#define HID_CONNECT_HIDDEV 0x08
266#define HID_CONNECT_HIDDEV_FORCE 0x10 266#define HID_CONNECT_HIDDEV_FORCE 0x10
267#define HID_CONNECT_FF 0x20 267#define HID_CONNECT_FF 0x20
268#define HID_CONNECT_DRIVER 0x40
268#define HID_CONNECT_DEFAULT (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| \ 269#define HID_CONNECT_DEFAULT (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| \
269 HID_CONNECT_HIDDEV|HID_CONNECT_FF) 270 HID_CONNECT_HIDDEV|HID_CONNECT_FF)
270 271
@@ -287,6 +288,7 @@ struct hid_item {
287#define HID_QUIRK_HIDINPUT_FORCE 0x00000080 288#define HID_QUIRK_HIDINPUT_FORCE 0x00000080
288#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100 289#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100
289#define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200 290#define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200
291#define HID_QUIRK_ALWAYS_POLL 0x00000400
290#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 292#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
291#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID 0x00020000 293#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID 0x00020000
292#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP 0x00040000 294#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP 0x00040000
@@ -312,6 +314,11 @@ struct hid_item {
312#define HID_GROUP_RMI 0x0100 314#define HID_GROUP_RMI 0x0100
313 315
314/* 316/*
317 * Vendor specific HID device groups
318 */
319#define HID_GROUP_WACOM 0x0101
320
321/*
315 * This is the global environment of the parser. This information is 322 * This is the global environment of the parser. This information is
316 * persistent for main-items. The global environment can be saved and 323 * persistent for main-items. The global environment can be saved and
317 * restored with PUSH/POP statements. 324 * restored with PUSH/POP statements.
@@ -435,6 +442,7 @@ struct hid_output_fifo {
435#define HID_CLAIMED_INPUT 1 442#define HID_CLAIMED_INPUT 1
436#define HID_CLAIMED_HIDDEV 2 443#define HID_CLAIMED_HIDDEV 2
437#define HID_CLAIMED_HIDRAW 4 444#define HID_CLAIMED_HIDRAW 4
445#define HID_CLAIMED_DRIVER 8
438 446
439#define HID_STAT_ADDED 1 447#define HID_STAT_ADDED 1
440#define HID_STAT_PARSED 2 448#define HID_STAT_PARSED 2
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 7fb31da45d03..9286a46b7d69 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -93,7 +93,7 @@ static inline int kmap_atomic_idx_push(void)
93 93
94#ifdef CONFIG_DEBUG_HIGHMEM 94#ifdef CONFIG_DEBUG_HIGHMEM
95 WARN_ON_ONCE(in_irq() && !irqs_disabled()); 95 WARN_ON_ONCE(in_irq() && !irqs_disabled());
96 BUG_ON(idx > KM_TYPE_NR); 96 BUG_ON(idx >= KM_TYPE_NR);
97#endif 97#endif
98 return idx; 98 return idx;
99} 99}
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index d2b52999e771..bb9840fd1e18 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -164,12 +164,15 @@ int host1x_job_submit(struct host1x_job *job);
164 */ 164 */
165 165
166struct host1x_reloc { 166struct host1x_reloc {
167 struct host1x_bo *cmdbuf; 167 struct {
168 u32 cmdbuf_offset; 168 struct host1x_bo *bo;
169 struct host1x_bo *target; 169 unsigned long offset;
170 u32 target_offset; 170 } cmdbuf;
171 u32 shift; 171 struct {
172 u32 pad; 172 struct host1x_bo *bo;
173 unsigned long offset;
174 } target;
175 unsigned long shift;
173}; 176};
174 177
175struct host1x_job { 178struct host1x_job {
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index b826239bdce0..ad9051bab267 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -93,10 +93,6 @@ extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
93#endif /* CONFIG_DEBUG_VM */ 93#endif /* CONFIG_DEBUG_VM */
94 94
95extern unsigned long transparent_hugepage_flags; 95extern unsigned long transparent_hugepage_flags;
96extern int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
97 pmd_t *dst_pmd, pmd_t *src_pmd,
98 struct vm_area_struct *vma,
99 unsigned long addr, unsigned long end);
100extern int split_huge_page_to_list(struct page *page, struct list_head *list); 96extern int split_huge_page_to_list(struct page *page, struct list_head *list);
101static inline int split_huge_page(struct page *page) 97static inline int split_huge_page(struct page *page)
102{ 98{
@@ -136,7 +132,7 @@ extern int __pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma,
136static inline int pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma, 132static inline int pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma,
137 spinlock_t **ptl) 133 spinlock_t **ptl)
138{ 134{
139 VM_BUG_ON(!rwsem_is_locked(&vma->vm_mm->mmap_sem)); 135 VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma);
140 if (pmd_trans_huge(*pmd)) 136 if (pmd_trans_huge(*pmd))
141 return __pmd_trans_huge_lock(pmd, vma, ptl); 137 return __pmd_trans_huge_lock(pmd, vma, ptl);
142 else 138 else
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index a23c096b3080..6e6d338641fe 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -87,7 +87,6 @@ pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
87#endif 87#endif
88 88
89extern unsigned long hugepages_treat_as_movable; 89extern unsigned long hugepages_treat_as_movable;
90extern const unsigned long hugetlb_zero, hugetlb_infinity;
91extern int sysctl_hugetlb_shm_group; 90extern int sysctl_hugetlb_shm_group;
92extern struct list_head huge_boot_pages; 91extern struct list_head huge_boot_pages;
93 92
diff --git a/include/linux/i2c/atmel_mxt_ts.h b/include/linux/i2c/atmel_mxt_ts.h
index 3891dc1de21c..02bf6ea31701 100644
--- a/include/linux/i2c/atmel_mxt_ts.h
+++ b/include/linux/i2c/atmel_mxt_ts.h
@@ -17,9 +17,6 @@
17 17
18/* The platform data for the Atmel maXTouch touchscreen driver */ 18/* The platform data for the Atmel maXTouch touchscreen driver */
19struct mxt_platform_data { 19struct mxt_platform_data {
20 const u8 *config;
21 size_t config_length;
22 u32 config_crc;
23 unsigned long irqflags; 20 unsigned long irqflags;
24 u8 t19_num_keys; 21 u8 t19_num_keys;
25 const unsigned int *t19_keymap; 22 const unsigned int *t19_keymap;
diff --git a/include/linux/i2c/s6000.h b/include/linux/i2c/s6000.h
deleted file mode 100644
index d9b34bfdae76..000000000000
--- a/include/linux/i2c/s6000.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __LINUX_I2C_S6000_H
2#define __LINUX_I2C_S6000_H
3
4struct s6_i2c_platform_data {
5 const char *clock; /* the clock to use */
6 int bus_num; /* the bus number to register */
7};
8
9#endif
10
diff --git a/include/linux/i82593.h b/include/linux/i82593.h
deleted file mode 100644
index afac5c7a323d..000000000000
--- a/include/linux/i82593.h
+++ /dev/null
@@ -1,229 +0,0 @@
1/*
2 * Definitions for Intel 82593 CSMA/CD Core LAN Controller
3 * The definitions are taken from the 1992 users manual with Intel
4 * order number 297125-001.
5 *
6 * /usr/src/pc/RCS/i82593.h,v 1.1 1996/07/17 15:23:12 root Exp
7 *
8 * Copyright 1994, Anders Klemets <klemets@it.kth.se>
9 *
10 * HISTORY
11 * i82593.h,v
12 * Revision 1.4 2005/11/4 09:15:00 baroniunas
13 * Modified copyright with permission of author as follows:
14 *
15 * "If I82539.H is the only file with my copyright statement
16 * that is included in the Source Forge project, then you have
17 * my approval to change the copyright statement to be a GPL
18 * license, in the way you proposed on October 10."
19 *
20 * Revision 1.1 1996/07/17 15:23:12 root
21 * Initial revision
22 *
23 * Revision 1.3 1995/04/05 15:13:58 adj
24 * Initial alpha release
25 *
26 * Revision 1.2 1994/06/16 23:57:31 klemets
27 * Mirrored all the fields in the configuration block.
28 *
29 * Revision 1.1 1994/06/02 20:25:34 klemets
30 * Initial revision
31 *
32 *
33 */
34#ifndef _I82593_H
35#define _I82593_H
36
37/* Intel 82593 CSMA/CD Core LAN Controller */
38
39/* Port 0 Command Register definitions */
40
41/* Execution operations */
42#define OP0_NOP 0 /* CHNL = 0 */
43#define OP0_SWIT_TO_PORT_1 0 /* CHNL = 1 */
44#define OP0_IA_SETUP 1
45#define OP0_CONFIGURE 2
46#define OP0_MC_SETUP 3
47#define OP0_TRANSMIT 4
48#define OP0_TDR 5
49#define OP0_DUMP 6
50#define OP0_DIAGNOSE 7
51#define OP0_TRANSMIT_NO_CRC 9
52#define OP0_RETRANSMIT 12
53#define OP0_ABORT 13
54/* Reception operations */
55#define OP0_RCV_ENABLE 8
56#define OP0_RCV_DISABLE 10
57#define OP0_STOP_RCV 11
58/* Status pointer control operations */
59#define OP0_FIX_PTR 15 /* CHNL = 1 */
60#define OP0_RLS_PTR 15 /* CHNL = 0 */
61#define OP0_RESET 14
62
63#define CR0_CHNL (1 << 4) /* 0=Channel 0, 1=Channel 1 */
64#define CR0_STATUS_0 0x00
65#define CR0_STATUS_1 0x20
66#define CR0_STATUS_2 0x40
67#define CR0_STATUS_3 0x60
68#define CR0_INT_ACK (1 << 7) /* 0=No ack, 1=acknowledge */
69
70/* Port 0 Status Register definitions */
71
72#define SR0_NO_RESULT 0 /* dummy */
73#define SR0_EVENT_MASK 0x0f
74#define SR0_IA_SETUP_DONE 1
75#define SR0_CONFIGURE_DONE 2
76#define SR0_MC_SETUP_DONE 3
77#define SR0_TRANSMIT_DONE 4
78#define SR0_TDR_DONE 5
79#define SR0_DUMP_DONE 6
80#define SR0_DIAGNOSE_PASSED 7
81#define SR0_TRANSMIT_NO_CRC_DONE 9
82#define SR0_RETRANSMIT_DONE 12
83#define SR0_EXECUTION_ABORTED 13
84#define SR0_END_OF_FRAME 8
85#define SR0_RECEPTION_ABORTED 10
86#define SR0_DIAGNOSE_FAILED 15
87#define SR0_STOP_REG_HIT 11
88
89#define SR0_CHNL (1 << 4)
90#define SR0_EXECUTION (1 << 5)
91#define SR0_RECEPTION (1 << 6)
92#define SR0_INTERRUPT (1 << 7)
93#define SR0_BOTH_RX_TX (SR0_EXECUTION | SR0_RECEPTION)
94
95#define SR3_EXEC_STATE_MASK 0x03
96#define SR3_EXEC_IDLE 0
97#define SR3_TX_ABORT_IN_PROGRESS 1
98#define SR3_EXEC_ACTIVE 2
99#define SR3_ABORT_IN_PROGRESS 3
100#define SR3_EXEC_CHNL (1 << 2)
101#define SR3_STP_ON_NO_RSRC (1 << 3)
102#define SR3_RCVING_NO_RSRC (1 << 4)
103#define SR3_RCV_STATE_MASK 0x60
104#define SR3_RCV_IDLE 0x00
105#define SR3_RCV_READY 0x20
106#define SR3_RCV_ACTIVE 0x40
107#define SR3_RCV_STOP_IN_PROG 0x60
108#define SR3_RCV_CHNL (1 << 7)
109
110/* Port 1 Command Register definitions */
111
112#define OP1_NOP 0
113#define OP1_SWIT_TO_PORT_0 1
114#define OP1_INT_DISABLE 2
115#define OP1_INT_ENABLE 3
116#define OP1_SET_TS 5
117#define OP1_RST_TS 7
118#define OP1_POWER_DOWN 8
119#define OP1_RESET_RING_MNGMT 11
120#define OP1_RESET 14
121#define OP1_SEL_RST 15
122
123#define CR1_STATUS_4 0x00
124#define CR1_STATUS_5 0x20
125#define CR1_STATUS_6 0x40
126#define CR1_STOP_REG_UPDATE (1 << 7)
127
128/* Receive frame status bits */
129
130#define RX_RCLD (1 << 0)
131#define RX_IA_MATCH (1 << 1)
132#define RX_NO_AD_MATCH (1 << 2)
133#define RX_NO_SFD (1 << 3)
134#define RX_SRT_FRM (1 << 7)
135#define RX_OVRRUN (1 << 8)
136#define RX_ALG_ERR (1 << 10)
137#define RX_CRC_ERR (1 << 11)
138#define RX_LEN_ERR (1 << 12)
139#define RX_RCV_OK (1 << 13)
140#define RX_TYP_LEN (1 << 15)
141
142/* Transmit status bits */
143
144#define TX_NCOL_MASK 0x0f
145#define TX_FRTL (1 << 4)
146#define TX_MAX_COL (1 << 5)
147#define TX_HRT_BEAT (1 << 6)
148#define TX_DEFER (1 << 7)
149#define TX_UND_RUN (1 << 8)
150#define TX_LOST_CTS (1 << 9)
151#define TX_LOST_CRS (1 << 10)
152#define TX_LTCOL (1 << 11)
153#define TX_OK (1 << 13)
154#define TX_COLL (1 << 15)
155
156struct i82593_conf_block {
157 u_char fifo_limit : 4,
158 forgnesi : 1,
159 fifo_32 : 1,
160 d6mod : 1,
161 throttle_enb : 1;
162 u_char throttle : 6,
163 cntrxint : 1,
164 contin : 1;
165 u_char addr_len : 3,
166 acloc : 1,
167 preamb_len : 2,
168 loopback : 2;
169 u_char lin_prio : 3,
170 tbofstop : 1,
171 exp_prio : 3,
172 bof_met : 1;
173 u_char : 4,
174 ifrm_spc : 4;
175 u_char : 5,
176 slottim_low : 3;
177 u_char slottim_hi : 3,
178 : 1,
179 max_retr : 4;
180 u_char prmisc : 1,
181 bc_dis : 1,
182 : 1,
183 crs_1 : 1,
184 nocrc_ins : 1,
185 crc_1632 : 1,
186 : 1,
187 crs_cdt : 1;
188 u_char cs_filter : 3,
189 crs_src : 1,
190 cd_filter : 3,
191 : 1;
192 u_char : 2,
193 min_fr_len : 6;
194 u_char lng_typ : 1,
195 lng_fld : 1,
196 rxcrc_xf : 1,
197 artx : 1,
198 sarec : 1,
199 tx_jabber : 1, /* why is this called max_len in the manual? */
200 hash_1 : 1,
201 lbpkpol : 1;
202 u_char : 6,
203 fdx : 1,
204 : 1;
205 u_char dummy_6 : 6, /* supposed to be ones */
206 mult_ia : 1,
207 dis_bof : 1;
208 u_char dummy_1 : 1, /* supposed to be one */
209 tx_ifs_retrig : 2,
210 mc_all : 1,
211 rcv_mon : 2,
212 frag_acpt : 1,
213 tstrttrs : 1;
214 u_char fretx : 1,
215 runt_eop : 1,
216 hw_sw_pin : 1,
217 big_endn : 1,
218 syncrqs : 1,
219 sttlen : 1,
220 tx_eop : 1,
221 rx_eop : 1;
222 u_char rbuf_size : 5,
223 rcvstop : 1,
224 : 2;
225};
226
227#define I82593_MAX_MULTICAST_ADDRESSES 128 /* Hardware hashed filter */
228
229#endif /* _I82593_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 63ab3873c5ed..b1be39c76931 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -6,6 +6,7 @@
6 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> 6 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
7 * Copyright (c) 2005, Devicescape Software, Inc. 7 * Copyright (c) 2005, Devicescape Software, Inc.
8 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net> 8 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
9 * Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
@@ -165,8 +166,12 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
165 166
166#define IEEE80211_MAX_MESH_ID_LEN 32 167#define IEEE80211_MAX_MESH_ID_LEN 32
167 168
169#define IEEE80211_FIRST_TSPEC_TSID 8
168#define IEEE80211_NUM_TIDS 16 170#define IEEE80211_NUM_TIDS 16
169 171
172/* number of user priorities 802.11 uses */
173#define IEEE80211_NUM_UPS 8
174
170#define IEEE80211_QOS_CTL_LEN 2 175#define IEEE80211_QOS_CTL_LEN 2
171/* 1d tag mask */ 176/* 1d tag mask */
172#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 177#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
@@ -838,6 +843,16 @@ enum ieee80211_vht_opmode_bits {
838 843
839#define WLAN_SA_QUERY_TR_ID_LEN 2 844#define WLAN_SA_QUERY_TR_ID_LEN 2
840 845
846/**
847 * struct ieee80211_tpc_report_ie
848 *
849 * This structure refers to "TPC Report element"
850 */
851struct ieee80211_tpc_report_ie {
852 u8 tx_power;
853 u8 link_margin;
854} __packed;
855
841struct ieee80211_mgmt { 856struct ieee80211_mgmt {
842 __le16 frame_control; 857 __le16 frame_control;
843 __le16 duration; 858 __le16 duration;
@@ -973,6 +988,13 @@ struct ieee80211_mgmt {
973 u8 action_code; 988 u8 action_code;
974 u8 operating_mode; 989 u8 operating_mode;
975 } __packed vht_opmode_notif; 990 } __packed vht_opmode_notif;
991 struct {
992 u8 action_code;
993 u8 dialog_token;
994 u8 tpc_elem_id;
995 u8 tpc_elem_length;
996 struct ieee80211_tpc_report_ie tpc;
997 } __packed tpc_report;
976 } u; 998 } u;
977 } __packed action; 999 } __packed action;
978 } u; 1000 } u;
@@ -1806,7 +1828,8 @@ enum ieee80211_eid {
1806 WLAN_EID_DMG_TSPEC = 146, 1828 WLAN_EID_DMG_TSPEC = 146,
1807 WLAN_EID_DMG_AT = 147, 1829 WLAN_EID_DMG_AT = 147,
1808 WLAN_EID_DMG_CAP = 148, 1830 WLAN_EID_DMG_CAP = 148,
1809 /* 149-150 reserved for Cisco */ 1831 /* 149 reserved for Cisco */
1832 WLAN_EID_CISCO_VENDOR_SPECIFIC = 150,
1810 WLAN_EID_DMG_OPERATION = 151, 1833 WLAN_EID_DMG_OPERATION = 151,
1811 WLAN_EID_DMG_BSS_PARAM_CHANGE = 152, 1834 WLAN_EID_DMG_BSS_PARAM_CHANGE = 152,
1812 WLAN_EID_DMG_BEAM_REFINEMENT = 153, 1835 WLAN_EID_DMG_BEAM_REFINEMENT = 153,
@@ -1865,6 +1888,7 @@ enum ieee80211_category {
1865 WLAN_CATEGORY_DLS = 2, 1888 WLAN_CATEGORY_DLS = 2,
1866 WLAN_CATEGORY_BACK = 3, 1889 WLAN_CATEGORY_BACK = 3,
1867 WLAN_CATEGORY_PUBLIC = 4, 1890 WLAN_CATEGORY_PUBLIC = 4,
1891 WLAN_CATEGORY_RADIO_MEASUREMENT = 5,
1868 WLAN_CATEGORY_HT = 7, 1892 WLAN_CATEGORY_HT = 7,
1869 WLAN_CATEGORY_SA_QUERY = 8, 1893 WLAN_CATEGORY_SA_QUERY = 8,
1870 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9, 1894 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
@@ -2378,4 +2402,51 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
2378#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024)) 2402#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024))
2379#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x)) 2403#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x))
2380 2404
2405/**
2406 * ieee80211_action_contains_tpc - checks if the frame contains TPC element
2407 * @skb: the skb containing the frame, length will be checked
2408 *
2409 * This function checks if it's either TPC report action frame or Link
2410 * Measurement report action frame as defined in IEEE Std. 802.11-2012 8.5.2.5
2411 * and 8.5.7.5 accordingly.
2412 */
2413static inline bool ieee80211_action_contains_tpc(struct sk_buff *skb)
2414{
2415 struct ieee80211_mgmt *mgmt = (void *)skb->data;
2416
2417 if (!ieee80211_is_action(mgmt->frame_control))
2418 return false;
2419
2420 if (skb->len < IEEE80211_MIN_ACTION_SIZE +
2421 sizeof(mgmt->u.action.u.tpc_report))
2422 return false;
2423
2424 /*
2425 * TPC report - check that:
2426 * category = 0 (Spectrum Management) or 5 (Radio Measurement)
2427 * spectrum management action = 3 (TPC/Link Measurement report)
2428 * TPC report EID = 35
2429 * TPC report element length = 2
2430 *
2431 * The spectrum management's tpc_report struct is used here both for
2432 * parsing tpc_report and radio measurement's link measurement report
2433 * frame, since the relevant part is identical in both frames.
2434 */
2435 if (mgmt->u.action.category != WLAN_CATEGORY_SPECTRUM_MGMT &&
2436 mgmt->u.action.category != WLAN_CATEGORY_RADIO_MEASUREMENT)
2437 return false;
2438
2439 /* both spectrum mgmt and link measurement have same action code */
2440 if (mgmt->u.action.u.tpc_report.action_code !=
2441 WLAN_ACTION_SPCT_TPC_RPRT)
2442 return false;
2443
2444 if (mgmt->u.action.u.tpc_report.tpc_elem_id != WLAN_EID_TPC_REPORT ||
2445 mgmt->u.action.u.tpc_report.tpc_elem_length !=
2446 sizeof(struct ieee80211_tpc_report_ie))
2447 return false;
2448
2449 return true;
2450}
2451
2381#endif /* LINUX_IEEE80211_H */ 2452#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 6b2c7cf352a5..6f6929ea8a0c 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -60,6 +60,7 @@ struct macvlan_dev {
60#ifdef CONFIG_NET_POLL_CONTROLLER 60#ifdef CONFIG_NET_POLL_CONTROLLER
61 struct netpoll *netpoll; 61 struct netpoll *netpoll;
62#endif 62#endif
63 unsigned int macaddr_count;
63}; 64};
64 65
65static inline void macvlan_count_rx(const struct macvlan_dev *vlan, 66static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 4967916fe4ac..d69f0577a319 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -187,7 +187,6 @@ vlan_dev_get_egress_qos_mask(struct net_device *dev, u32 skprio)
187} 187}
188 188
189extern bool vlan_do_receive(struct sk_buff **skb); 189extern bool vlan_do_receive(struct sk_buff **skb);
190extern struct sk_buff *vlan_untag(struct sk_buff *skb);
191 190
192extern int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid); 191extern int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid);
193extern void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid); 192extern void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid);
@@ -241,11 +240,6 @@ static inline bool vlan_do_receive(struct sk_buff **skb)
241 return false; 240 return false;
242} 241}
243 242
244static inline struct sk_buff *vlan_untag(struct sk_buff *skb)
245{
246 return skb;
247}
248
249static inline int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid) 243static inline int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid)
250{ 244{
251 return 0; 245 return 0;
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index f47550d75f85..2c677afeea47 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -39,6 +39,7 @@ static inline struct igmpv3_query *
39 39
40extern int sysctl_igmp_max_memberships; 40extern int sysctl_igmp_max_memberships;
41extern int sysctl_igmp_max_msf; 41extern int sysctl_igmp_max_msf;
42extern int sysctl_igmp_qrv;
42 43
43struct ip_sf_socklist { 44struct ip_sf_socklist {
44 unsigned int sl_max; 45 unsigned int sl_max;
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index 4b79ffe7b188..fa76c79a52a1 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -84,10 +84,12 @@ static inline void iio_trigger_put(struct iio_trigger *trig)
84 put_device(&trig->dev); 84 put_device(&trig->dev);
85} 85}
86 86
87static inline void iio_trigger_get(struct iio_trigger *trig) 87static inline struct iio_trigger *iio_trigger_get(struct iio_trigger *trig)
88{ 88{
89 get_device(&trig->dev); 89 get_device(&trig->dev);
90 __module_get(trig->ops->owner); 90 __module_get(trig->ops->owner);
91
92 return trig;
91} 93}
92 94
93/** 95/**
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 7cf5e9b32550..120ccc53fcb7 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -15,7 +15,7 @@ struct linux_binprm;
15 15
16#ifdef CONFIG_IMA 16#ifdef CONFIG_IMA
17extern int ima_bprm_check(struct linux_binprm *bprm); 17extern int ima_bprm_check(struct linux_binprm *bprm);
18extern int ima_file_check(struct file *file, int mask); 18extern int ima_file_check(struct file *file, int mask, int opened);
19extern void ima_file_free(struct file *file); 19extern void ima_file_free(struct file *file);
20extern int ima_file_mmap(struct file *file, unsigned long prot); 20extern int ima_file_mmap(struct file *file, unsigned long prot);
21extern int ima_module_check(struct file *file); 21extern int ima_module_check(struct file *file);
@@ -27,7 +27,7 @@ static inline int ima_bprm_check(struct linux_binprm *bprm)
27 return 0; 27 return 0;
28} 28}
29 29
30static inline int ima_file_check(struct file *file, int mask) 30static inline int ima_file_check(struct file *file, int mask, int opened)
31{ 31{
32 return 0; 32 return 0;
33} 33}
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 2bb4c4f3531a..77fc43f8fb72 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -111,12 +111,21 @@ extern struct group_info init_groups;
111#ifdef CONFIG_PREEMPT_RCU 111#ifdef CONFIG_PREEMPT_RCU
112#define INIT_TASK_RCU_PREEMPT(tsk) \ 112#define INIT_TASK_RCU_PREEMPT(tsk) \
113 .rcu_read_lock_nesting = 0, \ 113 .rcu_read_lock_nesting = 0, \
114 .rcu_read_unlock_special = 0, \ 114 .rcu_read_unlock_special.s = 0, \
115 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \ 115 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \
116 INIT_TASK_RCU_TREE_PREEMPT() 116 INIT_TASK_RCU_TREE_PREEMPT()
117#else 117#else
118#define INIT_TASK_RCU_PREEMPT(tsk) 118#define INIT_TASK_RCU_PREEMPT(tsk)
119#endif 119#endif
120#ifdef CONFIG_TASKS_RCU
121#define INIT_TASK_RCU_TASKS(tsk) \
122 .rcu_tasks_holdout = false, \
123 .rcu_tasks_holdout_list = \
124 LIST_HEAD_INIT(tsk.rcu_tasks_holdout_list), \
125 .rcu_tasks_idle_cpu = -1,
126#else
127#define INIT_TASK_RCU_TASKS(tsk)
128#endif
120 129
121extern struct cred init_cred; 130extern struct cred init_cred;
122 131
@@ -224,6 +233,7 @@ extern struct task_group root_task_group;
224 INIT_FTRACE_GRAPH \ 233 INIT_FTRACE_GRAPH \
225 INIT_TRACE_RECURSION \ 234 INIT_TRACE_RECURSION \
226 INIT_TASK_RCU_PREEMPT(tsk) \ 235 INIT_TASK_RCU_PREEMPT(tsk) \
236 INIT_TASK_RCU_TASKS(tsk) \
227 INIT_CPUSET_SEQ(tsk) \ 237 INIT_CPUSET_SEQ(tsk) \
228 INIT_RT_MUTEXES(tsk) \ 238 INIT_RT_MUTEXES(tsk) \
229 INIT_VTIME(tsk) \ 239 INIT_VTIME(tsk) \
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
index 1b1dfa80d9ff..f583ff639776 100644
--- a/include/linux/input/mt.h
+++ b/include/linux/input/mt.h
@@ -105,6 +105,7 @@ void input_mt_report_slot_state(struct input_dev *dev,
105 105
106void input_mt_report_finger_count(struct input_dev *dev, int count); 106void input_mt_report_finger_count(struct input_dev *dev, int count);
107void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count); 107void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count);
108void input_mt_drop_unused(struct input_dev *dev);
108 109
109void input_mt_sync_frame(struct input_dev *dev); 110void input_mt_sync_frame(struct input_dev *dev);
110 111
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
index 160cf353aa39..7bae83b7c396 100644
--- a/include/linux/input/pixcir_ts.h
+++ b/include/linux/input/pixcir_ts.h
@@ -43,10 +43,22 @@ enum pixcir_int_mode {
43#define PIXCIR_INT_ENABLE (1UL << 3) 43#define PIXCIR_INT_ENABLE (1UL << 3)
44#define PIXCIR_INT_POL_HIGH (1UL << 2) 44#define PIXCIR_INT_POL_HIGH (1UL << 2)
45 45
46/**
47 * struct pixcir_irc_chip_data - chip related data
48 * @max_fingers: Max number of fingers reported simultaneously by h/w
49 * @has_hw_ids: Hardware supports finger tracking IDs
50 *
51 */
52struct pixcir_i2c_chip_data {
53 u8 max_fingers;
54 bool has_hw_ids;
55};
56
46struct pixcir_ts_platform_data { 57struct pixcir_ts_platform_data {
47 int x_max; 58 int x_max;
48 int y_max; 59 int y_max;
49 int gpio_attb; /* GPIO connected to ATTB line */ 60 int gpio_attb; /* GPIO connected to ATTB line */
61 struct pixcir_i2c_chip_data chip;
50}; 62};
51 63
52#endif 64#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 698ad053d064..69517a24bc50 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -193,11 +193,6 @@ extern void irq_wake_thread(unsigned int irq, void *dev_id);
193/* The following three functions are for the core kernel use only. */ 193/* The following three functions are for the core kernel use only. */
194extern void suspend_device_irqs(void); 194extern void suspend_device_irqs(void);
195extern void resume_device_irqs(void); 195extern void resume_device_irqs(void);
196#ifdef CONFIG_PM_SLEEP
197extern int check_wakeup_irqs(void);
198#else
199static inline int check_wakeup_irqs(void) { return 0; }
200#endif
201 196
202/** 197/**
203 * struct irq_affinity_notify - context for notification of IRQ affinity changes 198 * struct irq_affinity_notify - context for notification of IRQ affinity changes
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 20f9a527922a..e6a7c9ff72f2 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -57,8 +57,11 @@ struct iommu_domain {
57 struct iommu_domain_geometry geometry; 57 struct iommu_domain_geometry geometry;
58}; 58};
59 59
60#define IOMMU_CAP_CACHE_COHERENCY 0x1 60enum iommu_cap {
61#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ 61 IOMMU_CAP_CACHE_COHERENCY, /* IOMMU can enforce cache coherent DMA
62 transactions */
63 IOMMU_CAP_INTR_REMAP, /* IOMMU supports interrupt isolation */
64};
62 65
63/* 66/*
64 * Following constraints are specifc to FSL_PAMUV1: 67 * Following constraints are specifc to FSL_PAMUV1:
@@ -80,6 +83,7 @@ enum iommu_attr {
80 DOMAIN_ATTR_FSL_PAMU_STASH, 83 DOMAIN_ATTR_FSL_PAMU_STASH,
81 DOMAIN_ATTR_FSL_PAMU_ENABLE, 84 DOMAIN_ATTR_FSL_PAMU_ENABLE,
82 DOMAIN_ATTR_FSL_PAMUV1, 85 DOMAIN_ATTR_FSL_PAMUV1,
86 DOMAIN_ATTR_NESTING, /* two stages of translation */
83 DOMAIN_ATTR_MAX, 87 DOMAIN_ATTR_MAX,
84}; 88};
85 89
@@ -94,7 +98,6 @@ enum iommu_attr {
94 * @map: map a physically contiguous memory region to an iommu domain 98 * @map: map a physically contiguous memory region to an iommu domain
95 * @unmap: unmap a physically contiguous memory region from an iommu domain 99 * @unmap: unmap a physically contiguous memory region from an iommu domain
96 * @iova_to_phys: translate iova to physical address 100 * @iova_to_phys: translate iova to physical address
97 * @domain_has_cap: domain capabilities query
98 * @add_device: add device to iommu grouping 101 * @add_device: add device to iommu grouping
99 * @remove_device: remove device from iommu grouping 102 * @remove_device: remove device from iommu grouping
100 * @domain_get_attr: Query domain attributes 103 * @domain_get_attr: Query domain attributes
@@ -102,6 +105,7 @@ enum iommu_attr {
102 * @pgsize_bitmap: bitmap of supported page sizes 105 * @pgsize_bitmap: bitmap of supported page sizes
103 */ 106 */
104struct iommu_ops { 107struct iommu_ops {
108 bool (*capable)(enum iommu_cap);
105 int (*domain_init)(struct iommu_domain *domain); 109 int (*domain_init)(struct iommu_domain *domain);
106 void (*domain_destroy)(struct iommu_domain *domain); 110 void (*domain_destroy)(struct iommu_domain *domain);
107 int (*attach_dev)(struct iommu_domain *domain, struct device *dev); 111 int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
@@ -111,8 +115,6 @@ struct iommu_ops {
111 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, 115 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
112 size_t size); 116 size_t size);
113 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova); 117 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova);
114 int (*domain_has_cap)(struct iommu_domain *domain,
115 unsigned long cap);
116 int (*add_device)(struct device *dev); 118 int (*add_device)(struct device *dev);
117 void (*remove_device)(struct device *dev); 119 void (*remove_device)(struct device *dev);
118 int (*device_group)(struct device *dev, unsigned int *groupid); 120 int (*device_group)(struct device *dev, unsigned int *groupid);
@@ -142,6 +144,7 @@ struct iommu_ops {
142 144
143extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops); 145extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops);
144extern bool iommu_present(struct bus_type *bus); 146extern bool iommu_present(struct bus_type *bus);
147extern bool iommu_capable(struct bus_type *bus, enum iommu_cap cap);
145extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); 148extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
146extern struct iommu_group *iommu_group_get_by_id(int id); 149extern struct iommu_group *iommu_group_get_by_id(int id);
147extern void iommu_domain_free(struct iommu_domain *domain); 150extern void iommu_domain_free(struct iommu_domain *domain);
@@ -154,8 +157,6 @@ extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
154extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, 157extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
155 size_t size); 158 size_t size);
156extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); 159extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
157extern int iommu_domain_has_cap(struct iommu_domain *domain,
158 unsigned long cap);
159extern void iommu_set_fault_handler(struct iommu_domain *domain, 160extern void iommu_set_fault_handler(struct iommu_domain *domain,
160 iommu_fault_handler_t handler, void *token); 161 iommu_fault_handler_t handler, void *token);
161 162
@@ -250,6 +251,11 @@ static inline bool iommu_present(struct bus_type *bus)
250 return false; 251 return false;
251} 252}
252 253
254static inline bool iommu_capable(struct bus_type *bus, enum iommu_cap cap)
255{
256 return false;
257}
258
253static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) 259static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
254{ 260{
255 return NULL; 261 return NULL;
@@ -304,12 +310,6 @@ static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_ad
304 return 0; 310 return 0;
305} 311}
306 312
307static inline int iommu_domain_has_cap(struct iommu_domain *domain,
308 unsigned long cap)
309{
310 return 0;
311}
312
313static inline void iommu_set_fault_handler(struct iommu_domain *domain, 313static inline void iommu_set_fault_handler(struct iommu_domain *domain,
314 iommu_fault_handler_t handler, void *token) 314 iommu_fault_handler_t handler, void *token)
315{ 315{
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 5e3a906cc089..2c5250222278 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -215,6 +215,11 @@ static inline int __deprecated check_region(resource_size_t s,
215 215
216/* Wrappers for managed devices */ 216/* Wrappers for managed devices */
217struct device; 217struct device;
218
219extern int devm_request_resource(struct device *dev, struct resource *root,
220 struct resource *new);
221extern void devm_release_resource(struct device *dev, struct resource *new);
222
218#define devm_request_region(dev,start,n,name) \ 223#define devm_request_region(dev,start,n,name) \
219 __devm_request_region(dev, &ioport_resource, (start), (n), (name)) 224 __devm_request_region(dev, &ioport_resource, (start), (n), (name))
220#define devm_request_mem_region(dev,start,n,name) \ 225#define devm_request_mem_region(dev,start,n,name) \
@@ -237,6 +242,12 @@ extern int iomem_is_exclusive(u64 addr);
237extern int 242extern int
238walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, 243walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
239 void *arg, int (*func)(unsigned long, unsigned long, void *)); 244 void *arg, int (*func)(unsigned long, unsigned long, void *));
245extern int
246walk_system_ram_res(u64 start, u64 end, void *arg,
247 int (*func)(u64, u64, void *));
248extern int
249walk_iomem_res(char *name, unsigned long flags, u64 start, u64 end, void *arg,
250 int (*func)(u64, u64, void *));
240 251
241/* True if any part of r1 overlaps r2 */ 252/* True if any part of r1 overlaps r2 */
242static inline bool resource_overlaps(struct resource *r1, struct resource *r2) 253static inline bool resource_overlaps(struct resource *r1, struct resource *r2)
diff --git a/include/linux/ipack.h b/include/linux/ipack.h
index 1888e06ddf64..8bddc3fbdddf 100644
--- a/include/linux/ipack.h
+++ b/include/linux/ipack.h
@@ -172,6 +172,7 @@ struct ipack_bus_ops {
172 * @ops: bus operations for the mezzanine drivers 172 * @ops: bus operations for the mezzanine drivers
173 */ 173 */
174struct ipack_bus_device { 174struct ipack_bus_device {
175 struct module *owner;
175 struct device *parent; 176 struct device *parent;
176 int slots; 177 int slots;
177 int bus_nr; 178 int bus_nr;
@@ -189,7 +190,8 @@ struct ipack_bus_device {
189 * available bus device in ipack. 190 * available bus device in ipack.
190 */ 191 */
191struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots, 192struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots,
192 const struct ipack_bus_ops *ops); 193 const struct ipack_bus_ops *ops,
194 struct module *owner);
193 195
194/** 196/**
195 * ipack_bus_unregister -- unregister an ipack bus 197 * ipack_bus_unregister -- unregister an ipack bus
@@ -265,3 +267,23 @@ void ipack_put_device(struct ipack_device *dev);
265 .format = (_format), \ 267 .format = (_format), \
266 .vendor = (vend), \ 268 .vendor = (vend), \
267 .device = (dev) 269 .device = (dev)
270
271/**
272 * ipack_get_carrier - it increase the carrier ref. counter of
273 * the carrier module
274 * @dev: mezzanine device which wants to get the carrier
275 */
276static inline int ipack_get_carrier(struct ipack_device *dev)
277{
278 return try_module_get(dev->bus->owner);
279}
280
281/**
282 * ipack_get_carrier - it decrease the carrier ref. counter of
283 * the carrier module
284 * @dev: mezzanine device which wants to get the carrier
285 */
286static inline void ipack_put_carrier(struct ipack_device *dev)
287{
288 module_put(dev->bus->owner);
289}
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 62af59242ddc..03f48d936f66 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -173,6 +173,7 @@ struct irq_data {
173 * IRQD_IRQ_DISABLED - Disabled state of the interrupt 173 * IRQD_IRQ_DISABLED - Disabled state of the interrupt
174 * IRQD_IRQ_MASKED - Masked state of the interrupt 174 * IRQD_IRQ_MASKED - Masked state of the interrupt
175 * IRQD_IRQ_INPROGRESS - In progress state of the interrupt 175 * IRQD_IRQ_INPROGRESS - In progress state of the interrupt
176 * IRQD_WAKEUP_ARMED - Wakeup mode armed
176 */ 177 */
177enum { 178enum {
178 IRQD_TRIGGER_MASK = 0xf, 179 IRQD_TRIGGER_MASK = 0xf,
@@ -186,6 +187,7 @@ enum {
186 IRQD_IRQ_DISABLED = (1 << 16), 187 IRQD_IRQ_DISABLED = (1 << 16),
187 IRQD_IRQ_MASKED = (1 << 17), 188 IRQD_IRQ_MASKED = (1 << 17),
188 IRQD_IRQ_INPROGRESS = (1 << 18), 189 IRQD_IRQ_INPROGRESS = (1 << 18),
190 IRQD_WAKEUP_ARMED = (1 << 19),
189}; 191};
190 192
191static inline bool irqd_is_setaffinity_pending(struct irq_data *d) 193static inline bool irqd_is_setaffinity_pending(struct irq_data *d)
@@ -257,6 +259,12 @@ static inline bool irqd_irq_inprogress(struct irq_data *d)
257 return d->state_use_accessors & IRQD_IRQ_INPROGRESS; 259 return d->state_use_accessors & IRQD_IRQ_INPROGRESS;
258} 260}
259 261
262static inline bool irqd_is_wakeup_armed(struct irq_data *d)
263{
264 return d->state_use_accessors & IRQD_WAKEUP_ARMED;
265}
266
267
260/* 268/*
261 * Functions for chained handlers which can be enabled/disabled by the 269 * Functions for chained handlers which can be enabled/disabled by the
262 * standard disable_irq/enable_irq calls. Must be called with 270 * standard disable_irq/enable_irq calls. Must be called with
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index bf9422c3aefe..bf3fe719c7ce 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -39,9 +39,12 @@ bool irq_work_queue_on(struct irq_work *work, int cpu);
39#endif 39#endif
40 40
41void irq_work_run(void); 41void irq_work_run(void);
42void irq_work_tick(void);
42void irq_work_sync(struct irq_work *work); 43void irq_work_sync(struct irq_work *work);
43 44
44#ifdef CONFIG_IRQ_WORK 45#ifdef CONFIG_IRQ_WORK
46#include <asm/irq_work.h>
47
45bool irq_work_needs_cpu(void); 48bool irq_work_needs_cpu(void);
46#else 49#else
47static inline bool irq_work_needs_cpu(void) { return false; } 50static inline bool irq_work_needs_cpu(void) { return false; }
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 45e2d8c15bd2..13eed92c7d24 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -21,7 +21,11 @@
21#define GIC_CPU_ACTIVEPRIO 0xd0 21#define GIC_CPU_ACTIVEPRIO 0xd0
22#define GIC_CPU_IDENT 0xfc 22#define GIC_CPU_IDENT 0xfc
23 23
24#define GICC_ENABLE 0x1
25#define GICC_INT_PRI_THRESHOLD 0xf0
24#define GICC_IAR_INT_ID_MASK 0x3ff 26#define GICC_IAR_INT_ID_MASK 0x3ff
27#define GICC_INT_SPURIOUS 1023
28#define GICC_DIS_BYPASS_MASK 0x1e0
25 29
26#define GIC_DIST_CTRL 0x000 30#define GIC_DIST_CTRL 0x000
27#define GIC_DIST_CTR 0x004 31#define GIC_DIST_CTR 0x004
@@ -39,6 +43,18 @@
39#define GIC_DIST_SGI_PENDING_CLEAR 0xf10 43#define GIC_DIST_SGI_PENDING_CLEAR 0xf10
40#define GIC_DIST_SGI_PENDING_SET 0xf20 44#define GIC_DIST_SGI_PENDING_SET 0xf20
41 45
46#define GICD_ENABLE 0x1
47#define GICD_DISABLE 0x0
48#define GICD_INT_ACTLOW_LVLTRIG 0x0
49#define GICD_INT_EN_CLR_X32 0xffffffff
50#define GICD_INT_EN_SET_SGI 0x0000ffff
51#define GICD_INT_EN_CLR_PPI 0xffff0000
52#define GICD_INT_DEF_PRI 0xa0
53#define GICD_INT_DEF_PRI_X4 ((GICD_INT_DEF_PRI << 24) |\
54 (GICD_INT_DEF_PRI << 16) |\
55 (GICD_INT_DEF_PRI << 8) |\
56 GICD_INT_DEF_PRI)
57
42#define GICH_HCR 0x0 58#define GICH_HCR 0x0
43#define GICH_VTR 0x4 59#define GICH_VTR 0x4
44#define GICH_VMCR 0x8 60#define GICH_VMCR 0x8
diff --git a/include/linux/irqchip/irq-omap-intc.h b/include/linux/irqchip/irq-omap-intc.h
new file mode 100644
index 000000000000..e06b370cfc0d
--- /dev/null
+++ b/include/linux/irqchip/irq-omap-intc.h
@@ -0,0 +1,32 @@
1/**
2 * irq-omap-intc.h - INTC Idle Functions
3 *
4 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Author: Felipe Balbi <balbi@ti.com>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 of
10 * the License as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H
19#define __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H
20
21void omap2_init_irq(void);
22void omap3_init_irq(void);
23void ti81xx_init_irq(void);
24
25int omap_irq_pending(void);
26void omap_intc_save_context(void);
27void omap_intc_restore_context(void);
28void omap3_intc_suspend(void);
29void omap3_intc_prepare_idle(void);
30void omap3_intc_resume_idle(void);
31
32#endif /* __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H */
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 472c021a2d4f..faf433af425e 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -12,6 +12,8 @@ struct irq_affinity_notify;
12struct proc_dir_entry; 12struct proc_dir_entry;
13struct module; 13struct module;
14struct irq_desc; 14struct irq_desc;
15struct irq_domain;
16struct pt_regs;
15 17
16/** 18/**
17 * struct irq_desc - interrupt descriptor 19 * struct irq_desc - interrupt descriptor
@@ -36,6 +38,11 @@ struct irq_desc;
36 * @threads_oneshot: bitfield to handle shared oneshot threads 38 * @threads_oneshot: bitfield to handle shared oneshot threads
37 * @threads_active: number of irqaction threads currently running 39 * @threads_active: number of irqaction threads currently running
38 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers 40 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
41 * @nr_actions: number of installed actions on this descriptor
42 * @no_suspend_depth: number of irqactions on a irq descriptor with
43 * IRQF_NO_SUSPEND set
44 * @force_resume_depth: number of irqactions on a irq descriptor with
45 * IRQF_FORCE_RESUME set
39 * @dir: /proc/irq/ procfs entry 46 * @dir: /proc/irq/ procfs entry
40 * @name: flow handler name for /proc/interrupts output 47 * @name: flow handler name for /proc/interrupts output
41 */ 48 */
@@ -68,6 +75,11 @@ struct irq_desc {
68 unsigned long threads_oneshot; 75 unsigned long threads_oneshot;
69 atomic_t threads_active; 76 atomic_t threads_active;
70 wait_queue_head_t wait_for_threads; 77 wait_queue_head_t wait_for_threads;
78#ifdef CONFIG_PM_SLEEP
79 unsigned int nr_actions;
80 unsigned int no_suspend_depth;
81 unsigned int force_resume_depth;
82#endif
71#ifdef CONFIG_PROC_FS 83#ifdef CONFIG_PROC_FS
72 struct proc_dir_entry *dir; 84 struct proc_dir_entry *dir;
73#endif 85#endif
@@ -118,6 +130,23 @@ static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *de
118 130
119int generic_handle_irq(unsigned int irq); 131int generic_handle_irq(unsigned int irq);
120 132
133#ifdef CONFIG_HANDLE_DOMAIN_IRQ
134/*
135 * Convert a HW interrupt number to a logical one using a IRQ domain,
136 * and handle the result interrupt number. Return -EINVAL if
137 * conversion failed. Providing a NULL domain indicates that the
138 * conversion has already been done.
139 */
140int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
141 bool lookup, struct pt_regs *regs);
142
143static inline int handle_domain_irq(struct irq_domain *domain,
144 unsigned int hwirq, struct pt_regs *regs)
145{
146 return __handle_domain_irq(domain, hwirq, true, regs);
147}
148#endif
149
121/* Test to see if a driver has successfully requested an irq */ 150/* Test to see if a driver has successfully requested an irq */
122static inline int irq_has_action(unsigned int irq) 151static inline int irq_has_action(unsigned int irq)
123{ 152{
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index d5b50a19463c..704b9a599b26 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -159,7 +159,11 @@ typedef struct journal_header_s
159 * journal_block_tag (in the descriptor). The other h_chksum* fields are 159 * journal_block_tag (in the descriptor). The other h_chksum* fields are
160 * not used. 160 * not used.
161 * 161 *
162 * Checksum v1 and v2 are mutually exclusive features. 162 * If FEATURE_INCOMPAT_CSUM_V3 is set, the descriptor block uses
163 * journal_block_tag3_t to store a full 32-bit checksum. Everything else
164 * is the same as v2.
165 *
166 * Checksum v1, v2, and v3 are mutually exclusive features.
163 */ 167 */
164struct commit_header { 168struct commit_header {
165 __be32 h_magic; 169 __be32 h_magic;
@@ -179,6 +183,14 @@ struct commit_header {
179 * raw struct shouldn't be used for pointer math or sizeof() - use 183 * raw struct shouldn't be used for pointer math or sizeof() - use
180 * journal_tag_bytes(journal) instead to compute this. 184 * journal_tag_bytes(journal) instead to compute this.
181 */ 185 */
186typedef struct journal_block_tag3_s
187{
188 __be32 t_blocknr; /* The on-disk block number */
189 __be32 t_flags; /* See below */
190 __be32 t_blocknr_high; /* most-significant high 32bits. */
191 __be32 t_checksum; /* crc32c(uuid+seq+block) */
192} journal_block_tag3_t;
193
182typedef struct journal_block_tag_s 194typedef struct journal_block_tag_s
183{ 195{
184 __be32 t_blocknr; /* The on-disk block number */ 196 __be32 t_blocknr; /* The on-disk block number */
@@ -187,9 +199,6 @@ typedef struct journal_block_tag_s
187 __be32 t_blocknr_high; /* most-significant high 32bits. */ 199 __be32 t_blocknr_high; /* most-significant high 32bits. */
188} journal_block_tag_t; 200} journal_block_tag_t;
189 201
190#define JBD2_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high))
191#define JBD2_TAG_SIZE64 (sizeof(journal_block_tag_t))
192
193/* Tail of descriptor block, for checksumming */ 202/* Tail of descriptor block, for checksumming */
194struct jbd2_journal_block_tail { 203struct jbd2_journal_block_tail {
195 __be32 t_checksum; /* crc32c(uuid+descr_block) */ 204 __be32 t_checksum; /* crc32c(uuid+descr_block) */
@@ -284,6 +293,7 @@ typedef struct journal_superblock_s
284#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002 293#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002
285#define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004 294#define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004
286#define JBD2_FEATURE_INCOMPAT_CSUM_V2 0x00000008 295#define JBD2_FEATURE_INCOMPAT_CSUM_V2 0x00000008
296#define JBD2_FEATURE_INCOMPAT_CSUM_V3 0x00000010
287 297
288/* Features known to this kernel version: */ 298/* Features known to this kernel version: */
289#define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM 299#define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM
@@ -291,7 +301,8 @@ typedef struct journal_superblock_s
291#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \ 301#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \
292 JBD2_FEATURE_INCOMPAT_64BIT | \ 302 JBD2_FEATURE_INCOMPAT_64BIT | \
293 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | \ 303 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | \
294 JBD2_FEATURE_INCOMPAT_CSUM_V2) 304 JBD2_FEATURE_INCOMPAT_CSUM_V2 | \
305 JBD2_FEATURE_INCOMPAT_CSUM_V3)
295 306
296#ifdef __KERNEL__ 307#ifdef __KERNEL__
297 308
@@ -1031,7 +1042,7 @@ void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
1031extern void jbd2_journal_commit_transaction(journal_t *); 1042extern void jbd2_journal_commit_transaction(journal_t *);
1032 1043
1033/* Checkpoint list management */ 1044/* Checkpoint list management */
1034int __jbd2_journal_clean_checkpoint_list(journal_t *journal); 1045void __jbd2_journal_clean_checkpoint_list(journal_t *journal);
1035int __jbd2_journal_remove_checkpoint(struct journal_head *); 1046int __jbd2_journal_remove_checkpoint(struct journal_head *);
1036void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *); 1047void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);
1037 1048
@@ -1296,6 +1307,15 @@ static inline int tid_geq(tid_t x, tid_t y)
1296extern int jbd2_journal_blocks_per_page(struct inode *inode); 1307extern int jbd2_journal_blocks_per_page(struct inode *inode);
1297extern size_t journal_tag_bytes(journal_t *journal); 1308extern size_t journal_tag_bytes(journal_t *journal);
1298 1309
1310static inline int jbd2_journal_has_csum_v2or3(journal_t *journal)
1311{
1312 if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2) ||
1313 JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3))
1314 return 1;
1315
1316 return 0;
1317}
1318
1299/* 1319/*
1300 * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for 1320 * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for
1301 * transaction control blocks. 1321 * transaction control blocks.
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 1f44466c1e9d..c367cbdf73ab 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -258,23 +258,11 @@ extern unsigned long preset_lpj;
258#define SEC_JIFFIE_SC (32 - SHIFT_HZ) 258#define SEC_JIFFIE_SC (32 - SHIFT_HZ)
259#endif 259#endif
260#define NSEC_JIFFIE_SC (SEC_JIFFIE_SC + 29) 260#define NSEC_JIFFIE_SC (SEC_JIFFIE_SC + 29)
261#define USEC_JIFFIE_SC (SEC_JIFFIE_SC + 19)
262#define SEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) +\ 261#define SEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) +\
263 TICK_NSEC -1) / (u64)TICK_NSEC)) 262 TICK_NSEC -1) / (u64)TICK_NSEC))
264 263
265#define NSEC_CONVERSION ((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) +\ 264#define NSEC_CONVERSION ((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) +\
266 TICK_NSEC -1) / (u64)TICK_NSEC)) 265 TICK_NSEC -1) / (u64)TICK_NSEC))
267#define USEC_CONVERSION \
268 ((unsigned long)((((u64)NSEC_PER_USEC << USEC_JIFFIE_SC) +\
269 TICK_NSEC -1) / (u64)TICK_NSEC))
270/*
271 * USEC_ROUND is used in the timeval to jiffie conversion. See there
272 * for more details. It is the scaled resolution rounding value. Note
273 * that it is a 64-bit value. Since, when it is applied, we are already
274 * in jiffies (albit scaled), it is nothing but the bits we will shift
275 * off.
276 */
277#define USEC_ROUND (u64)(((u64)1 << USEC_JIFFIE_SC) - 1)
278/* 266/*
279 * The maximum jiffie value is (MAX_INT >> 1). Here we translate that 267 * The maximum jiffie value is (MAX_INT >> 1). Here we translate that
280 * into seconds. The 64-bit case will overflow if we are not careful, 268 * into seconds. The 64-bit case will overflow if we are not careful,
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 784304b222b3..98f923b6a0ea 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -8,28 +8,28 @@
8 * Copyright (C) 2011-2012 Peter Zijlstra <pzijlstr@redhat.com> 8 * Copyright (C) 2011-2012 Peter Zijlstra <pzijlstr@redhat.com>
9 * 9 *
10 * Jump labels provide an interface to generate dynamic branches using 10 * Jump labels provide an interface to generate dynamic branches using
11 * self-modifying code. Assuming toolchain and architecture support the result 11 * self-modifying code. Assuming toolchain and architecture support, the result
12 * of a "if (static_key_false(&key))" statement is a unconditional branch (which 12 * of a "if (static_key_false(&key))" statement is an unconditional branch (which
13 * defaults to false - and the true block is placed out of line). 13 * defaults to false - and the true block is placed out of line).
14 * 14 *
15 * However at runtime we can change the branch target using 15 * However at runtime we can change the branch target using
16 * static_key_slow_{inc,dec}(). These function as a 'reference' count on the key 16 * static_key_slow_{inc,dec}(). These function as a 'reference' count on the key
17 * object and for as long as there are references all branches referring to 17 * object, and for as long as there are references all branches referring to
18 * that particular key will point to the (out of line) true block. 18 * that particular key will point to the (out of line) true block.
19 * 19 *
20 * Since this relies on modifying code the static_key_slow_{inc,dec}() functions 20 * Since this relies on modifying code, the static_key_slow_{inc,dec}() functions
21 * must be considered absolute slow paths (machine wide synchronization etc.). 21 * must be considered absolute slow paths (machine wide synchronization etc.).
22 * OTOH, since the affected branches are unconditional their runtime overhead 22 * OTOH, since the affected branches are unconditional, their runtime overhead
23 * will be absolutely minimal, esp. in the default (off) case where the total 23 * will be absolutely minimal, esp. in the default (off) case where the total
24 * effect is a single NOP of appropriate size. The on case will patch in a jump 24 * effect is a single NOP of appropriate size. The on case will patch in a jump
25 * to the out-of-line block. 25 * to the out-of-line block.
26 * 26 *
27 * When the control is directly exposed to userspace it is prudent to delay the 27 * When the control is directly exposed to userspace, it is prudent to delay the
28 * decrement to avoid high frequency code modifications which can (and do) 28 * decrement to avoid high frequency code modifications which can (and do)
29 * cause significant performance degradation. Struct static_key_deferred and 29 * cause significant performance degradation. Struct static_key_deferred and
30 * static_key_slow_dec_deferred() provide for this. 30 * static_key_slow_dec_deferred() provide for this.
31 * 31 *
32 * Lacking toolchain and or architecture support, it falls back to a simple 32 * Lacking toolchain and or architecture support, jump labels fall back to a simple
33 * conditional branch. 33 * conditional branch.
34 * 34 *
35 * struct static_key my_key = STATIC_KEY_INIT_TRUE; 35 * struct static_key my_key = STATIC_KEY_INIT_TRUE;
@@ -43,8 +43,7 @@
43 * 43 *
44 * Not initializing the key (static data is initialized to 0s anyway) is the 44 * Not initializing the key (static data is initialized to 0s anyway) is the
45 * same as using STATIC_KEY_INIT_FALSE. 45 * same as using STATIC_KEY_INIT_FALSE.
46 * 46 */
47*/
48 47
49#include <linux/types.h> 48#include <linux/types.h>
50#include <linux/compiler.h> 49#include <linux/compiler.h>
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index a9e2268ecccb..3d770f5564b8 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -376,10 +376,6 @@ extern unsigned long simple_strtoul(const char *,char **,unsigned int);
376extern long simple_strtol(const char *,char **,unsigned int); 376extern long simple_strtol(const char *,char **,unsigned int);
377extern unsigned long long simple_strtoull(const char *,char **,unsigned int); 377extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
378extern long long simple_strtoll(const char *,char **,unsigned int); 378extern long long simple_strtoll(const char *,char **,unsigned int);
379#define strict_strtoul kstrtoul
380#define strict_strtol kstrtol
381#define strict_strtoull kstrtoull
382#define strict_strtoll kstrtoll
383 379
384extern int num_to_str(char *buf, int size, unsigned long long num); 380extern int num_to_str(char *buf, int size, unsigned long long num);
385 381
@@ -407,6 +403,7 @@ int vsscanf(const char *, const char *, va_list);
407extern int get_option(char **str, int *pint); 403extern int get_option(char **str, int *pint);
408extern char *get_options(const char *str, int nints, int *ints); 404extern char *get_options(const char *str, int nints, int *ints);
409extern unsigned long long memparse(const char *ptr, char **retptr); 405extern unsigned long long memparse(const char *ptr, char **retptr);
406extern bool parse_option_str(const char *str, const char *option);
410 407
411extern int core_kernel_text(unsigned long addr); 408extern int core_kernel_text(unsigned long addr);
412extern int core_kernel_data(unsigned long addr); 409extern int core_kernel_data(unsigned long addr);
@@ -470,6 +467,7 @@ extern enum system_states {
470#define TAINT_FIRMWARE_WORKAROUND 11 467#define TAINT_FIRMWARE_WORKAROUND 11
471#define TAINT_OOT_MODULE 12 468#define TAINT_OOT_MODULE 12
472#define TAINT_UNSIGNED_MODULE 13 469#define TAINT_UNSIGNED_MODULE 13
470#define TAINT_SOFTLOCKUP 14
473 471
474extern const char hex_asc[]; 472extern const char hex_asc[];
475#define hex_asc_lo(x) hex_asc[((x) & 0x0f)] 473#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
@@ -493,13 +491,9 @@ static inline char *hex_byte_pack_upper(char *buf, u8 byte)
493 return buf; 491 return buf;
494} 492}
495 493
496static inline char * __deprecated pack_hex_byte(char *buf, u8 byte)
497{
498 return hex_byte_pack(buf, byte);
499}
500
501extern int hex_to_bin(char ch); 494extern int hex_to_bin(char ch);
502extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); 495extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
496extern char *bin2hex(char *dst, const void *src, size_t count);
503 497
504bool mac_pton(const char *s, u8 *mac); 498bool mac_pton(const char *s, u8 *mac);
505 499
@@ -719,23 +713,8 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
719 (void) (&_max1 == &_max2); \ 713 (void) (&_max1 == &_max2); \
720 _max1 > _max2 ? _max1 : _max2; }) 714 _max1 > _max2 ? _max1 : _max2; })
721 715
722#define min3(x, y, z) ({ \ 716#define min3(x, y, z) min((typeof(x))min(x, y), z)
723 typeof(x) _min1 = (x); \ 717#define max3(x, y, z) max((typeof(x))max(x, y), z)
724 typeof(y) _min2 = (y); \
725 typeof(z) _min3 = (z); \
726 (void) (&_min1 == &_min2); \
727 (void) (&_min1 == &_min3); \
728 _min1 < _min2 ? (_min1 < _min3 ? _min1 : _min3) : \
729 (_min2 < _min3 ? _min2 : _min3); })
730
731#define max3(x, y, z) ({ \
732 typeof(x) _max1 = (x); \
733 typeof(y) _max2 = (y); \
734 typeof(z) _max3 = (z); \
735 (void) (&_max1 == &_max2); \
736 (void) (&_max1 == &_max3); \
737 _max1 > _max2 ? (_max1 > _max3 ? _max1 : _max3) : \
738 (_max2 > _max3 ? _max2 : _max3); })
739 718
740/** 719/**
741 * min_not_zero - return the minimum that is _not_ zero, unless both are zero 720 * min_not_zero - return the minimum that is _not_ zero, unless both are zero
@@ -750,20 +729,13 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
750/** 729/**
751 * clamp - return a value clamped to a given range with strict typechecking 730 * clamp - return a value clamped to a given range with strict typechecking
752 * @val: current value 731 * @val: current value
753 * @min: minimum allowable value 732 * @lo: lowest allowable value
754 * @max: maximum allowable value 733 * @hi: highest allowable value
755 * 734 *
756 * This macro does strict typechecking of min/max to make sure they are of the 735 * This macro does strict typechecking of lo/hi to make sure they are of the
757 * same type as val. See the unnecessary pointer comparisons. 736 * same type as val. See the unnecessary pointer comparisons.
758 */ 737 */
759#define clamp(val, min, max) ({ \ 738#define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi)
760 typeof(val) __val = (val); \
761 typeof(min) __min = (min); \
762 typeof(max) __max = (max); \
763 (void) (&__val == &__min); \
764 (void) (&__val == &__max); \
765 __val = __val < __min ? __min: __val; \
766 __val > __max ? __max: __val; })
767 739
768/* 740/*
769 * ..and if you can't take the strict 741 * ..and if you can't take the strict
@@ -785,36 +757,26 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
785 * clamp_t - return a value clamped to a given range using a given type 757 * clamp_t - return a value clamped to a given range using a given type
786 * @type: the type of variable to use 758 * @type: the type of variable to use
787 * @val: current value 759 * @val: current value
788 * @min: minimum allowable value 760 * @lo: minimum allowable value
789 * @max: maximum allowable value 761 * @hi: maximum allowable value
790 * 762 *
791 * This macro does no typechecking and uses temporary variables of type 763 * This macro does no typechecking and uses temporary variables of type
792 * 'type' to make all the comparisons. 764 * 'type' to make all the comparisons.
793 */ 765 */
794#define clamp_t(type, val, min, max) ({ \ 766#define clamp_t(type, val, lo, hi) min_t(type, max_t(type, val, lo), hi)
795 type __val = (val); \
796 type __min = (min); \
797 type __max = (max); \
798 __val = __val < __min ? __min: __val; \
799 __val > __max ? __max: __val; })
800 767
801/** 768/**
802 * clamp_val - return a value clamped to a given range using val's type 769 * clamp_val - return a value clamped to a given range using val's type
803 * @val: current value 770 * @val: current value
804 * @min: minimum allowable value 771 * @lo: minimum allowable value
805 * @max: maximum allowable value 772 * @hi: maximum allowable value
806 * 773 *
807 * This macro does no typechecking and uses temporary variables of whatever 774 * This macro does no typechecking and uses temporary variables of whatever
808 * type the input argument 'val' is. This is useful when val is an unsigned 775 * type the input argument 'val' is. This is useful when val is an unsigned
809 * type and min and max are literals that will otherwise be assigned a signed 776 * type and min and max are literals that will otherwise be assigned a signed
810 * integer type. 777 * integer type.
811 */ 778 */
812#define clamp_val(val, min, max) ({ \ 779#define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi)
813 typeof(val) __val = (val); \
814 typeof(val) __min = (min); \
815 typeof(val) __max = (max); \
816 __val = __val < __min ? __min: __val; \
817 __val > __max ? __max: __val; })
818 780
819 781
820/* 782/*
@@ -849,5 +811,7 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
849 /* User perms >= group perms >= other perms */ \ 811 /* User perms >= group perms >= other perms */ \
850 BUILD_BUG_ON_ZERO(((perms) >> 6) < (((perms) >> 3) & 7)) + \ 812 BUILD_BUG_ON_ZERO(((perms) >> 6) < (((perms) >> 3) & 7)) + \
851 BUILD_BUG_ON_ZERO((((perms) >> 3) & 7) < ((perms) & 7)) + \ 813 BUILD_BUG_ON_ZERO((((perms) >> 3) & 7) < ((perms) & 7)) + \
814 /* Other writable? Generally considered a bad idea. */ \
815 BUILD_BUG_ON_ZERO((perms) & 2) + \
852 (perms)) 816 (perms))
853#endif 817#endif
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index ecbc52f9ff77..8422b4ed6882 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -44,8 +44,8 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);
44DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat); 44DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
45 45
46/* Must have preemption disabled for this to be meaningful. */ 46/* Must have preemption disabled for this to be meaningful. */
47#define kstat_this_cpu (&__get_cpu_var(kstat)) 47#define kstat_this_cpu this_cpu_ptr(&kstat)
48#define kcpustat_this_cpu (&__get_cpu_var(kernel_cpustat)) 48#define kcpustat_this_cpu this_cpu_ptr(&kernel_cpustat)
49#define kstat_cpu(cpu) per_cpu(kstat, cpu) 49#define kstat_cpu(cpu) per_cpu(kstat, cpu)
50#define kcpustat_cpu(cpu) per_cpu(kernel_cpustat, cpu) 50#define kcpustat_cpu(cpu) per_cpu(kernel_cpustat, cpu)
51 51
diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h
index 9be37da93680..e985ba679c4a 100644
--- a/include/linux/kernelcapi.h
+++ b/include/linux/kernelcapi.h
@@ -41,7 +41,7 @@ u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]);
41u16 capi20_get_version(u32 contr, struct capi_version *verp); 41u16 capi20_get_version(u32 contr, struct capi_version *verp);
42u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]); 42u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
43u16 capi20_get_profile(u32 contr, struct capi_profile *profp); 43u16 capi20_get_profile(u32 contr, struct capi_profile *profp);
44int capi20_manufacturer(unsigned int cmd, void __user *data); 44int capi20_manufacturer(unsigned long cmd, void __user *data);
45 45
46#define CAPICTR_UP 0 46#define CAPICTR_UP 0
47#define CAPICTR_DOWN 1 47#define CAPICTR_DOWN 1
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index a75641930049..9d957b7ae095 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -10,6 +10,7 @@
10#include <linux/ioport.h> 10#include <linux/ioport.h>
11#include <linux/elfcore.h> 11#include <linux/elfcore.h>
12#include <linux/elf.h> 12#include <linux/elf.h>
13#include <linux/module.h>
13#include <asm/kexec.h> 14#include <asm/kexec.h>
14 15
15/* Verify architecture specific macros are defined */ 16/* Verify architecture specific macros are defined */
@@ -69,7 +70,18 @@ typedef unsigned long kimage_entry_t;
69#define IND_SOURCE 0x8 70#define IND_SOURCE 0x8
70 71
71struct kexec_segment { 72struct kexec_segment {
72 void __user *buf; 73 /*
74 * This pointer can point to user memory if kexec_load() system
75 * call is used or will point to kernel memory if
76 * kexec_file_load() system call is used.
77 *
78 * Use ->buf when expecting to deal with user memory and use ->kbuf
79 * when expecting to deal with kernel memory.
80 */
81 union {
82 void __user *buf;
83 void *kbuf;
84 };
73 size_t bufsz; 85 size_t bufsz;
74 unsigned long mem; 86 unsigned long mem;
75 size_t memsz; 87 size_t memsz;
@@ -84,6 +96,27 @@ struct compat_kexec_segment {
84}; 96};
85#endif 97#endif
86 98
99struct kexec_sha_region {
100 unsigned long start;
101 unsigned long len;
102};
103
104struct purgatory_info {
105 /* Pointer to elf header of read only purgatory */
106 Elf_Ehdr *ehdr;
107
108 /* Pointer to purgatory sechdrs which are modifiable */
109 Elf_Shdr *sechdrs;
110 /*
111 * Temporary buffer location where purgatory is loaded and relocated
112 * This memory can be freed post image load
113 */
114 void *purgatory_buf;
115
116 /* Address where purgatory is finally loaded and is executed from */
117 unsigned long purgatory_load_addr;
118};
119
87struct kimage { 120struct kimage {
88 kimage_entry_t head; 121 kimage_entry_t head;
89 kimage_entry_t *entry; 122 kimage_entry_t *entry;
@@ -100,7 +133,7 @@ struct kimage {
100 133
101 struct list_head control_pages; 134 struct list_head control_pages;
102 struct list_head dest_pages; 135 struct list_head dest_pages;
103 struct list_head unuseable_pages; 136 struct list_head unusable_pages;
104 137
105 /* Address of next control page to allocate for crash kernels. */ 138 /* Address of next control page to allocate for crash kernels. */
106 unsigned long control_page; 139 unsigned long control_page;
@@ -110,13 +143,64 @@ struct kimage {
110#define KEXEC_TYPE_DEFAULT 0 143#define KEXEC_TYPE_DEFAULT 0
111#define KEXEC_TYPE_CRASH 1 144#define KEXEC_TYPE_CRASH 1
112 unsigned int preserve_context : 1; 145 unsigned int preserve_context : 1;
146 /* If set, we are using file mode kexec syscall */
147 unsigned int file_mode:1;
113 148
114#ifdef ARCH_HAS_KIMAGE_ARCH 149#ifdef ARCH_HAS_KIMAGE_ARCH
115 struct kimage_arch arch; 150 struct kimage_arch arch;
116#endif 151#endif
152
153 /* Additional fields for file based kexec syscall */
154 void *kernel_buf;
155 unsigned long kernel_buf_len;
156
157 void *initrd_buf;
158 unsigned long initrd_buf_len;
159
160 char *cmdline_buf;
161 unsigned long cmdline_buf_len;
162
163 /* File operations provided by image loader */
164 struct kexec_file_ops *fops;
165
166 /* Image loader handling the kernel can store a pointer here */
167 void *image_loader_data;
168
169 /* Information for loading purgatory */
170 struct purgatory_info purgatory_info;
117}; 171};
118 172
173/*
174 * Keeps track of buffer parameters as provided by caller for requesting
175 * memory placement of buffer.
176 */
177struct kexec_buf {
178 struct kimage *image;
179 char *buffer;
180 unsigned long bufsz;
181 unsigned long mem;
182 unsigned long memsz;
183 unsigned long buf_align;
184 unsigned long buf_min;
185 unsigned long buf_max;
186 bool top_down; /* allocate from top of memory hole */
187};
119 188
189typedef int (kexec_probe_t)(const char *kernel_buf, unsigned long kernel_size);
190typedef void *(kexec_load_t)(struct kimage *image, char *kernel_buf,
191 unsigned long kernel_len, char *initrd,
192 unsigned long initrd_len, char *cmdline,
193 unsigned long cmdline_len);
194typedef int (kexec_cleanup_t)(void *loader_data);
195typedef int (kexec_verify_sig_t)(const char *kernel_buf,
196 unsigned long kernel_len);
197
198struct kexec_file_ops {
199 kexec_probe_t *probe;
200 kexec_load_t *load;
201 kexec_cleanup_t *cleanup;
202 kexec_verify_sig_t *verify_sig;
203};
120 204
121/* kexec interface functions */ 205/* kexec interface functions */
122extern void machine_kexec(struct kimage *image); 206extern void machine_kexec(struct kimage *image);
@@ -127,8 +211,21 @@ extern asmlinkage long sys_kexec_load(unsigned long entry,
127 struct kexec_segment __user *segments, 211 struct kexec_segment __user *segments,
128 unsigned long flags); 212 unsigned long flags);
129extern int kernel_kexec(void); 213extern int kernel_kexec(void);
214extern int kexec_add_buffer(struct kimage *image, char *buffer,
215 unsigned long bufsz, unsigned long memsz,
216 unsigned long buf_align, unsigned long buf_min,
217 unsigned long buf_max, bool top_down,
218 unsigned long *load_addr);
130extern struct page *kimage_alloc_control_pages(struct kimage *image, 219extern struct page *kimage_alloc_control_pages(struct kimage *image,
131 unsigned int order); 220 unsigned int order);
221extern int kexec_load_purgatory(struct kimage *image, unsigned long min,
222 unsigned long max, int top_down,
223 unsigned long *load_addr);
224extern int kexec_purgatory_get_set_symbol(struct kimage *image,
225 const char *name, void *buf,
226 unsigned int size, bool get_value);
227extern void *kexec_purgatory_get_symbol_addr(struct kimage *image,
228 const char *name);
132extern void crash_kexec(struct pt_regs *); 229extern void crash_kexec(struct pt_regs *);
133int kexec_should_crash(struct task_struct *); 230int kexec_should_crash(struct task_struct *);
134void crash_save_cpu(struct pt_regs *regs, int cpu); 231void crash_save_cpu(struct pt_regs *regs, int cpu);
@@ -177,6 +274,10 @@ extern int kexec_load_disabled;
177#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT) 274#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)
178#endif 275#endif
179 276
277/* List of defined/legal kexec file flags */
278#define KEXEC_FILE_FLAGS (KEXEC_FILE_UNLOAD | KEXEC_FILE_ON_CRASH | \
279 KEXEC_FILE_NO_INITRAMFS)
280
180#define VMCOREINFO_BYTES (4096) 281#define VMCOREINFO_BYTES (4096)
181#define VMCOREINFO_NOTE_NAME "VMCOREINFO" 282#define VMCOREINFO_NOTE_NAME "VMCOREINFO"
182#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4) 283#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4)
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index 44792ee649de..ff9f1d394235 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -53,6 +53,24 @@ typedef int (*request_key_actor_t)(struct key_construction *key,
53 const char *op, void *aux); 53 const char *op, void *aux);
54 54
55/* 55/*
56 * Preparsed matching criterion.
57 */
58struct key_match_data {
59 /* Comparison function, defaults to exact description match, but can be
60 * overridden by type->match_preparse(). Should return true if a match
61 * is found and false if not.
62 */
63 bool (*cmp)(const struct key *key,
64 const struct key_match_data *match_data);
65
66 const void *raw_data; /* Raw match data */
67 void *preparsed; /* For ->match_preparse() to stash stuff */
68 unsigned lookup_type; /* Type of lookup for this search. */
69#define KEYRING_SEARCH_LOOKUP_DIRECT 0x0000 /* Direct lookup by description. */
70#define KEYRING_SEARCH_LOOKUP_ITERATE 0x0001 /* Iterative search. */
71};
72
73/*
56 * kernel managed key type definition 74 * kernel managed key type definition
57 */ 75 */
58struct key_type { 76struct key_type {
@@ -65,11 +83,6 @@ struct key_type {
65 */ 83 */
66 size_t def_datalen; 84 size_t def_datalen;
67 85
68 /* Default key search algorithm. */
69 unsigned def_lookup_type;
70#define KEYRING_SEARCH_LOOKUP_DIRECT 0x0000 /* Direct lookup by description. */
71#define KEYRING_SEARCH_LOOKUP_ITERATE 0x0001 /* Iterative search. */
72
73 /* vet a description */ 86 /* vet a description */
74 int (*vet_description)(const char *description); 87 int (*vet_description)(const char *description);
75 88
@@ -96,8 +109,15 @@ struct key_type {
96 */ 109 */
97 int (*update)(struct key *key, struct key_preparsed_payload *prep); 110 int (*update)(struct key *key, struct key_preparsed_payload *prep);
98 111
99 /* match a key against a description */ 112 /* Preparse the data supplied to ->match() (optional). The
100 int (*match)(const struct key *key, const void *desc); 113 * data to be preparsed can be found in match_data->raw_data.
114 * The lookup type can also be set by this function.
115 */
116 int (*match_preparse)(struct key_match_data *match_data);
117
118 /* Free preparsed match data (optional). This should be supplied it
119 * ->match_preparse() is supplied. */
120 void (*match_free)(struct key_match_data *match_data);
101 121
102 /* clear some of the data from a key on revokation (optional) 122 /* clear some of the data from a key on revokation (optional)
103 * - the key's semaphore will be write-locked by the caller 123 * - the key's semaphore will be write-locked by the caller
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 6b06d378f3df..e465bb15912d 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -283,7 +283,7 @@ struct kgdb_io {
283 283
284extern struct kgdb_arch arch_kgdb_ops; 284extern struct kgdb_arch arch_kgdb_ops;
285 285
286extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs); 286extern unsigned long kgdb_arch_pc(int exception, struct pt_regs *regs);
287 287
288#ifdef CONFIG_SERIAL_KGDB_NMI 288#ifdef CONFIG_SERIAL_KGDB_NMI
289extern int kgdb_register_nmi_console(void); 289extern int kgdb_register_nmi_console(void);
diff --git a/include/linux/khugepaged.h b/include/linux/khugepaged.h
index 6b394f0b5148..eeb307985715 100644
--- a/include/linux/khugepaged.h
+++ b/include/linux/khugepaged.h
@@ -6,7 +6,8 @@
6#ifdef CONFIG_TRANSPARENT_HUGEPAGE 6#ifdef CONFIG_TRANSPARENT_HUGEPAGE
7extern int __khugepaged_enter(struct mm_struct *mm); 7extern int __khugepaged_enter(struct mm_struct *mm);
8extern void __khugepaged_exit(struct mm_struct *mm); 8extern void __khugepaged_exit(struct mm_struct *mm);
9extern int khugepaged_enter_vma_merge(struct vm_area_struct *vma); 9extern int khugepaged_enter_vma_merge(struct vm_area_struct *vma,
10 unsigned long vm_flags);
10 11
11#define khugepaged_enabled() \ 12#define khugepaged_enabled() \
12 (transparent_hugepage_flags & \ 13 (transparent_hugepage_flags & \
@@ -35,13 +36,13 @@ static inline void khugepaged_exit(struct mm_struct *mm)
35 __khugepaged_exit(mm); 36 __khugepaged_exit(mm);
36} 37}
37 38
38static inline int khugepaged_enter(struct vm_area_struct *vma) 39static inline int khugepaged_enter(struct vm_area_struct *vma,
40 unsigned long vm_flags)
39{ 41{
40 if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags)) 42 if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags))
41 if ((khugepaged_always() || 43 if ((khugepaged_always() ||
42 (khugepaged_req_madv() && 44 (khugepaged_req_madv() && (vm_flags & VM_HUGEPAGE))) &&
43 vma->vm_flags & VM_HUGEPAGE)) && 45 !(vm_flags & VM_NOHUGEPAGE))
44 !(vma->vm_flags & VM_NOHUGEPAGE))
45 if (__khugepaged_enter(vma->vm_mm)) 46 if (__khugepaged_enter(vma->vm_mm))
46 return -ENOMEM; 47 return -ENOMEM;
47 return 0; 48 return 0;
@@ -54,11 +55,13 @@ static inline int khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm)
54static inline void khugepaged_exit(struct mm_struct *mm) 55static inline void khugepaged_exit(struct mm_struct *mm)
55{ 56{
56} 57}
57static inline int khugepaged_enter(struct vm_area_struct *vma) 58static inline int khugepaged_enter(struct vm_area_struct *vma,
59 unsigned long vm_flags)
58{ 60{
59 return 0; 61 return 0;
60} 62}
61static inline int khugepaged_enter_vma_merge(struct vm_area_struct *vma) 63static inline int khugepaged_enter_vma_merge(struct vm_area_struct *vma,
64 unsigned long vm_flags)
62{ 65{
63 return 0; 66 return 0;
64} 67}
diff --git a/include/linux/klist.h b/include/linux/klist.h
index a370ce57cf1d..61e5b723ae73 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -44,7 +44,7 @@ struct klist_node {
44 44
45extern void klist_add_tail(struct klist_node *n, struct klist *k); 45extern void klist_add_tail(struct klist_node *n, struct klist *k);
46extern void klist_add_head(struct klist_node *n, struct klist *k); 46extern void klist_add_head(struct klist_node *n, struct klist *k);
47extern void klist_add_after(struct klist_node *n, struct klist_node *pos); 47extern void klist_add_behind(struct klist_node *n, struct klist_node *pos);
48extern void klist_add_before(struct klist_node *n, struct klist_node *pos); 48extern void klist_add_before(struct klist_node *n, struct klist_node *pos);
49 49
50extern void klist_del(struct klist_node *n); 50extern void klist_del(struct klist_node *n);
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ec4e3bd83d47..ea53b04993f2 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -136,12 +136,11 @@ static inline bool is_error_page(struct page *page)
136#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22 136#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22
137#define KVM_REQ_ENABLE_IBS 23 137#define KVM_REQ_ENABLE_IBS 23
138#define KVM_REQ_DISABLE_IBS 24 138#define KVM_REQ_DISABLE_IBS 24
139#define KVM_REQ_APIC_PAGE_RELOAD 25
139 140
140#define KVM_USERSPACE_IRQ_SOURCE_ID 0 141#define KVM_USERSPACE_IRQ_SOURCE_ID 0
141#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 142#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
142 143
143struct kvm;
144struct kvm_vcpu;
145extern struct kmem_cache *kvm_vcpu_cache; 144extern struct kmem_cache *kvm_vcpu_cache;
146 145
147extern spinlock_t kvm_lock; 146extern spinlock_t kvm_lock;
@@ -200,6 +199,17 @@ int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, unsigned long hva,
200int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu); 199int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu);
201#endif 200#endif
202 201
202/*
203 * Carry out a gup that requires IO. Allow the mm to relinquish the mmap
204 * semaphore if the filemap/swap has to wait on a page lock. pagep == NULL
205 * controls whether we retry the gup one more time to completion in that case.
206 * Typically this is called after a FAULT_FLAG_RETRY_NOWAIT in the main tdp
207 * handler.
208 */
209int kvm_get_user_page_io(struct task_struct *tsk, struct mm_struct *mm,
210 unsigned long addr, bool write_fault,
211 struct page **pagep);
212
203enum { 213enum {
204 OUTSIDE_GUEST_MODE, 214 OUTSIDE_GUEST_MODE,
205 IN_GUEST_MODE, 215 IN_GUEST_MODE,
@@ -325,25 +335,6 @@ struct kvm_kernel_irq_routing_entry {
325 struct hlist_node link; 335 struct hlist_node link;
326}; 336};
327 337
328#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
329
330struct kvm_irq_routing_table {
331 int chip[KVM_NR_IRQCHIPS][KVM_IRQCHIP_NUM_PINS];
332 struct kvm_kernel_irq_routing_entry *rt_entries;
333 u32 nr_rt_entries;
334 /*
335 * Array indexed by gsi. Each entry contains list of irq chips
336 * the gsi is connected to.
337 */
338 struct hlist_head map[0];
339};
340
341#else
342
343struct kvm_irq_routing_table {};
344
345#endif
346
347#ifndef KVM_PRIVATE_MEM_SLOTS 338#ifndef KVM_PRIVATE_MEM_SLOTS
348#define KVM_PRIVATE_MEM_SLOTS 0 339#define KVM_PRIVATE_MEM_SLOTS 0
349#endif 340#endif
@@ -401,11 +392,12 @@ struct kvm {
401 struct mutex irq_lock; 392 struct mutex irq_lock;
402#ifdef CONFIG_HAVE_KVM_IRQCHIP 393#ifdef CONFIG_HAVE_KVM_IRQCHIP
403 /* 394 /*
404 * Update side is protected by irq_lock and, 395 * Update side is protected by irq_lock.
405 * if configured, irqfds.lock.
406 */ 396 */
407 struct kvm_irq_routing_table __rcu *irq_routing; 397 struct kvm_irq_routing_table __rcu *irq_routing;
408 struct hlist_head mask_notifier_list; 398 struct hlist_head mask_notifier_list;
399#endif
400#ifdef CONFIG_HAVE_KVM_IRQFD
409 struct hlist_head irq_ack_notifier_list; 401 struct hlist_head irq_ack_notifier_list;
410#endif 402#endif
411 403
@@ -455,7 +447,7 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
455int __must_check vcpu_load(struct kvm_vcpu *vcpu); 447int __must_check vcpu_load(struct kvm_vcpu *vcpu);
456void vcpu_put(struct kvm_vcpu *vcpu); 448void vcpu_put(struct kvm_vcpu *vcpu);
457 449
458#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING 450#ifdef CONFIG_HAVE_KVM_IRQFD
459int kvm_irqfd_init(void); 451int kvm_irqfd_init(void);
460void kvm_irqfd_exit(void); 452void kvm_irqfd_exit(void);
461#else 453#else
@@ -544,6 +536,8 @@ struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
544unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); 536unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
545unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable); 537unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable);
546unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn); 538unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn);
539unsigned long gfn_to_hva_memslot_prot(struct kvm_memory_slot *slot, gfn_t gfn,
540 bool *writable);
547void kvm_release_page_clean(struct page *page); 541void kvm_release_page_clean(struct page *page);
548void kvm_release_page_dirty(struct page *page); 542void kvm_release_page_dirty(struct page *page);
549void kvm_set_page_accessed(struct page *page); 543void kvm_set_page_accessed(struct page *page);
@@ -595,6 +589,7 @@ void kvm_flush_remote_tlbs(struct kvm *kvm);
595void kvm_reload_remote_mmus(struct kvm *kvm); 589void kvm_reload_remote_mmus(struct kvm *kvm);
596void kvm_make_mclock_inprogress_request(struct kvm *kvm); 590void kvm_make_mclock_inprogress_request(struct kvm *kvm);
597void kvm_make_scan_ioapic_request(struct kvm *kvm); 591void kvm_make_scan_ioapic_request(struct kvm *kvm);
592bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req);
598 593
599long kvm_arch_dev_ioctl(struct file *filp, 594long kvm_arch_dev_ioctl(struct file *filp,
600 unsigned int ioctl, unsigned long arg); 595 unsigned int ioctl, unsigned long arg);
@@ -602,7 +597,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
602 unsigned int ioctl, unsigned long arg); 597 unsigned int ioctl, unsigned long arg);
603int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf); 598int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf);
604 599
605int kvm_dev_ioctl_check_extension(long ext); 600int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext);
606 601
607int kvm_get_dirty_log(struct kvm *kvm, 602int kvm_get_dirty_log(struct kvm *kvm,
608 struct kvm_dirty_log *log, int *is_dirty); 603 struct kvm_dirty_log *log, int *is_dirty);
@@ -640,6 +635,8 @@ void kvm_arch_exit(void);
640int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu); 635int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu);
641void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu); 636void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu);
642 637
638void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu);
639
643void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu); 640void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu);
644void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu); 641void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
645void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu); 642void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
@@ -648,8 +645,8 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu);
648int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu); 645int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu);
649void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu); 646void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu);
650 647
651int kvm_arch_hardware_enable(void *garbage); 648int kvm_arch_hardware_enable(void);
652void kvm_arch_hardware_disable(void *garbage); 649void kvm_arch_hardware_disable(void);
653int kvm_arch_hardware_setup(void); 650int kvm_arch_hardware_setup(void);
654void kvm_arch_hardware_unsetup(void); 651void kvm_arch_hardware_unsetup(void);
655void kvm_arch_check_processor_compat(void *rtn); 652void kvm_arch_check_processor_compat(void *rtn);
@@ -752,6 +749,10 @@ void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,
752void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin, 749void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin,
753 bool mask); 750 bool mask);
754 751
752int kvm_irq_map_gsi(struct kvm *kvm,
753 struct kvm_kernel_irq_routing_entry *entries, int gsi);
754int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin);
755
755int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level, 756int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level,
756 bool line_status); 757 bool line_status);
757int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level); 758int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level);
@@ -942,28 +943,27 @@ int kvm_set_irq_routing(struct kvm *kvm,
942 const struct kvm_irq_routing_entry *entries, 943 const struct kvm_irq_routing_entry *entries,
943 unsigned nr, 944 unsigned nr,
944 unsigned flags); 945 unsigned flags);
945int kvm_set_routing_entry(struct kvm_irq_routing_table *rt, 946int kvm_set_routing_entry(struct kvm_kernel_irq_routing_entry *e,
946 struct kvm_kernel_irq_routing_entry *e,
947 const struct kvm_irq_routing_entry *ue); 947 const struct kvm_irq_routing_entry *ue);
948void kvm_free_irq_routing(struct kvm *kvm); 948void kvm_free_irq_routing(struct kvm *kvm);
949 949
950int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi);
951
952#else 950#else
953 951
954static inline void kvm_free_irq_routing(struct kvm *kvm) {} 952static inline void kvm_free_irq_routing(struct kvm *kvm) {}
955 953
956#endif 954#endif
957 955
956int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi);
957
958#ifdef CONFIG_HAVE_KVM_EVENTFD 958#ifdef CONFIG_HAVE_KVM_EVENTFD
959 959
960void kvm_eventfd_init(struct kvm *kvm); 960void kvm_eventfd_init(struct kvm *kvm);
961int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args); 961int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
962 962
963#ifdef CONFIG_HAVE_KVM_IRQCHIP 963#ifdef CONFIG_HAVE_KVM_IRQFD
964int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args); 964int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args);
965void kvm_irqfd_release(struct kvm *kvm); 965void kvm_irqfd_release(struct kvm *kvm);
966void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *); 966void kvm_irq_routing_update(struct kvm *);
967#else 967#else
968static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args) 968static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
969{ 969{
@@ -985,10 +985,8 @@ static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
985static inline void kvm_irqfd_release(struct kvm *kvm) {} 985static inline void kvm_irqfd_release(struct kvm *kvm) {}
986 986
987#ifdef CONFIG_HAVE_KVM_IRQCHIP 987#ifdef CONFIG_HAVE_KVM_IRQCHIP
988static inline void kvm_irq_routing_update(struct kvm *kvm, 988static inline void kvm_irq_routing_update(struct kvm *kvm)
989 struct kvm_irq_routing_table *irq_rt)
990{ 989{
991 rcu_assign_pointer(kvm->irq_routing, irq_rt);
992} 990}
993#endif 991#endif
994 992
@@ -1049,8 +1047,6 @@ static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
1049 1047
1050extern bool kvm_rebooting; 1048extern bool kvm_rebooting;
1051 1049
1052struct kvm_device_ops;
1053
1054struct kvm_device { 1050struct kvm_device {
1055 struct kvm_device_ops *ops; 1051 struct kvm_device_ops *ops;
1056 struct kvm *kvm; 1052 struct kvm *kvm;
@@ -1083,12 +1079,11 @@ struct kvm_device_ops {
1083void kvm_device_get(struct kvm_device *dev); 1079void kvm_device_get(struct kvm_device *dev);
1084void kvm_device_put(struct kvm_device *dev); 1080void kvm_device_put(struct kvm_device *dev);
1085struct kvm_device *kvm_device_from_filp(struct file *filp); 1081struct kvm_device *kvm_device_from_filp(struct file *filp);
1082int kvm_register_device_ops(struct kvm_device_ops *ops, u32 type);
1083void kvm_unregister_device_ops(u32 type);
1086 1084
1087extern struct kvm_device_ops kvm_mpic_ops; 1085extern struct kvm_device_ops kvm_mpic_ops;
1088extern struct kvm_device_ops kvm_xics_ops; 1086extern struct kvm_device_ops kvm_xics_ops;
1089extern struct kvm_device_ops kvm_vfio_ops;
1090extern struct kvm_device_ops kvm_arm_vgic_v2_ops;
1091extern struct kvm_device_ops kvm_flic_ops;
1092 1087
1093#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT 1088#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
1094 1089
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index b0bcce0ddc95..b606bb689a3e 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -17,6 +17,20 @@
17#ifndef __KVM_TYPES_H__ 17#ifndef __KVM_TYPES_H__
18#define __KVM_TYPES_H__ 18#define __KVM_TYPES_H__
19 19
20struct kvm;
21struct kvm_async_pf;
22struct kvm_device_ops;
23struct kvm_interrupt;
24struct kvm_irq_routing_table;
25struct kvm_memory_slot;
26struct kvm_one_reg;
27struct kvm_run;
28struct kvm_userspace_memory_region;
29struct kvm_vcpu;
30struct kvm_vcpu_init;
31
32enum kvm_mr_change;
33
20#include <asm/types.h> 34#include <asm/types.h>
21 35
22/* 36/*
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 0287ab296689..a57611d0c94e 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -13,8 +13,8 @@
13#define __LINUX_LEDS_H_INCLUDED 13#define __LINUX_LEDS_H_INCLUDED
14 14
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/spinlock.h>
17#include <linux/rwsem.h> 16#include <linux/rwsem.h>
17#include <linux/spinlock.h>
18#include <linux/timer.h> 18#include <linux/timer.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20 20
@@ -31,8 +31,8 @@ enum led_brightness {
31 31
32struct led_classdev { 32struct led_classdev {
33 const char *name; 33 const char *name;
34 int brightness; 34 enum led_brightness brightness;
35 int max_brightness; 35 enum led_brightness max_brightness;
36 int flags; 36 int flags;
37 37
38 /* Lower 16 bits reflect status */ 38 /* Lower 16 bits reflect status */
@@ -63,6 +63,8 @@ struct led_classdev {
63 unsigned long *delay_off); 63 unsigned long *delay_off);
64 64
65 struct device *dev; 65 struct device *dev;
66 const struct attribute_group **groups;
67
66 struct list_head node; /* LED Device list */ 68 struct list_head node; /* LED Device list */
67 const char *default_trigger; /* Trigger to use */ 69 const char *default_trigger; /* Trigger to use */
68 70
@@ -138,6 +140,16 @@ extern void led_blink_set_oneshot(struct led_classdev *led_cdev,
138 */ 140 */
139extern void led_set_brightness(struct led_classdev *led_cdev, 141extern void led_set_brightness(struct led_classdev *led_cdev,
140 enum led_brightness brightness); 142 enum led_brightness brightness);
143/**
144 * led_update_brightness - update LED brightness
145 * @led_cdev: the LED to query
146 *
147 * Get an LED's current brightness and update led_cdev->brightness
148 * member with the obtained value.
149 *
150 * Returns: 0 on success or negative error value on failure
151 */
152extern int led_update_brightness(struct led_classdev *led_cdev);
141 153
142/* 154/*
143 * LED Triggers 155 * LED Triggers
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 92abb497ab14..bd5fefeaf548 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1404,14 +1404,14 @@ static inline int sata_srst_pmp(struct ata_link *link)
1404 * printk helpers 1404 * printk helpers
1405 */ 1405 */
1406__printf(3, 4) 1406__printf(3, 4)
1407int ata_port_printk(const struct ata_port *ap, const char *level, 1407void ata_port_printk(const struct ata_port *ap, const char *level,
1408 const char *fmt, ...); 1408 const char *fmt, ...);
1409__printf(3, 4) 1409__printf(3, 4)
1410int ata_link_printk(const struct ata_link *link, const char *level, 1410void ata_link_printk(const struct ata_link *link, const char *level,
1411 const char *fmt, ...); 1411 const char *fmt, ...);
1412__printf(3, 4) 1412__printf(3, 4)
1413int ata_dev_printk(const struct ata_device *dev, const char *level, 1413void ata_dev_printk(const struct ata_device *dev, const char *level,
1414 const char *fmt, ...); 1414 const char *fmt, ...);
1415 1415
1416#define ata_port_err(ap, fmt, ...) \ 1416#define ata_port_err(ap, fmt, ...) \
1417 ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__) 1417 ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__)
diff --git a/include/linux/list.h b/include/linux/list.h
index ef9594171062..f33f831eb3c8 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -5,6 +5,7 @@
5#include <linux/stddef.h> 5#include <linux/stddef.h>
6#include <linux/poison.h> 6#include <linux/poison.h>
7#include <linux/const.h> 7#include <linux/const.h>
8#include <linux/kernel.h>
8 9
9/* 10/*
10 * Simple doubly linked list implementation. 11 * Simple doubly linked list implementation.
@@ -654,15 +655,15 @@ static inline void hlist_add_before(struct hlist_node *n,
654 *(n->pprev) = n; 655 *(n->pprev) = n;
655} 656}
656 657
657static inline void hlist_add_after(struct hlist_node *n, 658static inline void hlist_add_behind(struct hlist_node *n,
658 struct hlist_node *next) 659 struct hlist_node *prev)
659{ 660{
660 next->next = n->next; 661 n->next = prev->next;
661 n->next = next; 662 prev->next = n;
662 next->pprev = &n->next; 663 n->pprev = &prev->next;
663 664
664 if(next->next) 665 if (n->next)
665 next->next->pprev = &next->next; 666 n->next->pprev = &n->next;
666} 667}
667 668
668/* after that we'll appear to be on some hlist and hlist_del will work */ 669/* after that we'll appear to be on some hlist and hlist_del will work */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 219d79627c05..ff82a32871b5 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -178,7 +178,6 @@ struct nlm_block {
178 unsigned char b_granted; /* VFS granted lock */ 178 unsigned char b_granted; /* VFS granted lock */
179 struct nlm_file * b_file; /* file in question */ 179 struct nlm_file * b_file; /* file in question */
180 struct cache_req * b_cache_req; /* deferred request handling */ 180 struct cache_req * b_cache_req; /* deferred request handling */
181 struct file_lock * b_fl; /* set for GETLK */
182 struct cache_deferred_req * b_deferred_req; 181 struct cache_deferred_req * b_deferred_req;
183 unsigned int b_flags; /* block flags */ 182 unsigned int b_flags; /* block flags */
184#define B_QUEUED 1 /* lock queued */ 183#define B_QUEUED 1 /* lock queued */
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 008388f920d7..74ab23176e9b 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> 4 * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
5 * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> 5 * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
6 * 6 *
7 * see Documentation/lockdep-design.txt for more details. 7 * see Documentation/locking/lockdep-design.txt for more details.
8 */ 8 */
9#ifndef __LINUX_LOCKDEP_H 9#ifndef __LINUX_LOCKDEP_H
10#define __LINUX_LOCKDEP_H 10#define __LINUX_LOCKDEP_H
@@ -362,6 +362,10 @@ extern void lockdep_trace_alloc(gfp_t mask);
362 WARN_ON(debug_locks && !lockdep_is_held(l)); \ 362 WARN_ON(debug_locks && !lockdep_is_held(l)); \
363 } while (0) 363 } while (0)
364 364
365#define lockdep_assert_held_once(l) do { \
366 WARN_ON_ONCE(debug_locks && !lockdep_is_held(l)); \
367 } while (0)
368
365#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion) 369#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
366 370
367#else /* !CONFIG_LOCKDEP */ 371#else /* !CONFIG_LOCKDEP */
@@ -412,6 +416,7 @@ struct lock_class_key { };
412#define lockdep_depth(tsk) (0) 416#define lockdep_depth(tsk) (0)
413 417
414#define lockdep_assert_held(l) do { (void)(l); } while (0) 418#define lockdep_assert_held(l) do { (void)(l); } while (0)
419#define lockdep_assert_held_once(l) do { (void)(l); } while (0)
415 420
416#define lockdep_recursing(tsk) (0) 421#define lockdep_recursing(tsk) (0)
417 422
@@ -505,6 +510,7 @@ static inline void print_irqtrace_events(struct task_struct *curr)
505 510
506#define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_) 511#define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_)
507#define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_) 512#define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_)
513#define lock_map_acquire_tryread(l) lock_acquire_shared_recursive(l, 0, 1, NULL, _THIS_IP_)
508#define lock_map_release(l) lock_release(l, 1, _THIS_IP_) 514#define lock_map_release(l) lock_release(l, 1, _THIS_IP_)
509 515
510#ifdef CONFIG_PROVE_LOCKING 516#ifdef CONFIG_PROVE_LOCKING
diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h
new file mode 100644
index 000000000000..307d9cab2026
--- /dev/null
+++ b/include/linux/mailbox_client.h
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2013-2014 Linaro Ltd.
3 * Author: Jassi Brar <jassisinghbrar@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef __MAILBOX_CLIENT_H
11#define __MAILBOX_CLIENT_H
12
13#include <linux/of.h>
14#include <linux/device.h>
15
16struct mbox_chan;
17
18/**
19 * struct mbox_client - User of a mailbox
20 * @dev: The client device
21 * @tx_block: If the mbox_send_message should block until data is
22 * transmitted.
23 * @tx_tout: Max block period in ms before TX is assumed failure
24 * @knows_txdone: If the client could run the TX state machine. Usually
25 * if the client receives some ACK packet for transmission.
26 * Unused if the controller already has TX_Done/RTR IRQ.
27 * @rx_callback: Atomic callback to provide client the data received
28 * @tx_done: Atomic callback to tell client of data transmission
29 */
30struct mbox_client {
31 struct device *dev;
32 bool tx_block;
33 unsigned long tx_tout;
34 bool knows_txdone;
35
36 void (*rx_callback)(struct mbox_client *cl, void *mssg);
37 void (*tx_done)(struct mbox_client *cl, void *mssg, int r);
38};
39
40struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index);
41int mbox_send_message(struct mbox_chan *chan, void *mssg);
42void mbox_client_txdone(struct mbox_chan *chan, int r); /* atomic */
43bool mbox_client_peek_data(struct mbox_chan *chan); /* atomic */
44void mbox_free_channel(struct mbox_chan *chan); /* may sleep */
45
46#endif /* __MAILBOX_CLIENT_H */
diff --git a/include/linux/mailbox_controller.h b/include/linux/mailbox_controller.h
new file mode 100644
index 000000000000..d4cf96f07cfc
--- /dev/null
+++ b/include/linux/mailbox_controller.h
@@ -0,0 +1,133 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 */
6
7#ifndef __MAILBOX_CONTROLLER_H
8#define __MAILBOX_CONTROLLER_H
9
10#include <linux/of.h>
11#include <linux/types.h>
12#include <linux/timer.h>
13#include <linux/device.h>
14#include <linux/completion.h>
15
16struct mbox_chan;
17
18/**
19 * struct mbox_chan_ops - methods to control mailbox channels
20 * @send_data: The API asks the MBOX controller driver, in atomic
21 * context try to transmit a message on the bus. Returns 0 if
22 * data is accepted for transmission, -EBUSY while rejecting
23 * if the remote hasn't yet read the last data sent. Actual
24 * transmission of data is reported by the controller via
25 * mbox_chan_txdone (if it has some TX ACK irq). It must not
26 * sleep.
27 * @startup: Called when a client requests the chan. The controller
28 * could ask clients for additional parameters of communication
29 * to be provided via client's chan_data. This call may
30 * block. After this call the Controller must forward any
31 * data received on the chan by calling mbox_chan_received_data.
32 * The controller may do stuff that need to sleep.
33 * @shutdown: Called when a client relinquishes control of a chan.
34 * This call may block too. The controller must not forward
35 * any received data anymore.
36 * The controller may do stuff that need to sleep.
37 * @last_tx_done: If the controller sets 'txdone_poll', the API calls
38 * this to poll status of last TX. The controller must
39 * give priority to IRQ method over polling and never
40 * set both txdone_poll and txdone_irq. Only in polling
41 * mode 'send_data' is expected to return -EBUSY.
42 * The controller may do stuff that need to sleep/block.
43 * Used only if txdone_poll:=true && txdone_irq:=false
44 * @peek_data: Atomic check for any received data. Return true if controller
45 * has some data to push to the client. False otherwise.
46 */
47struct mbox_chan_ops {
48 int (*send_data)(struct mbox_chan *chan, void *data);
49 int (*startup)(struct mbox_chan *chan);
50 void (*shutdown)(struct mbox_chan *chan);
51 bool (*last_tx_done)(struct mbox_chan *chan);
52 bool (*peek_data)(struct mbox_chan *chan);
53};
54
55/**
56 * struct mbox_controller - Controller of a class of communication channels
57 * @dev: Device backing this controller
58 * @ops: Operators that work on each communication chan
59 * @chans: Array of channels
60 * @num_chans: Number of channels in the 'chans' array.
61 * @txdone_irq: Indicates if the controller can report to API when
62 * the last transmitted data was read by the remote.
63 * Eg, if it has some TX ACK irq.
64 * @txdone_poll: If the controller can read but not report the TX
65 * done. Ex, some register shows the TX status but
66 * no interrupt rises. Ignored if 'txdone_irq' is set.
67 * @txpoll_period: If 'txdone_poll' is in effect, the API polls for
68 * last TX's status after these many millisecs
69 * @of_xlate: Controller driver specific mapping of channel via DT
70 * @poll: API private. Used to poll for TXDONE on all channels.
71 * @node: API private. To hook into list of controllers.
72 */
73struct mbox_controller {
74 struct device *dev;
75 struct mbox_chan_ops *ops;
76 struct mbox_chan *chans;
77 int num_chans;
78 bool txdone_irq;
79 bool txdone_poll;
80 unsigned txpoll_period;
81 struct mbox_chan *(*of_xlate)(struct mbox_controller *mbox,
82 const struct of_phandle_args *sp);
83 /* Internal to API */
84 struct timer_list poll;
85 struct list_head node;
86};
87
88/*
89 * The length of circular buffer for queuing messages from a client.
90 * 'msg_count' tracks the number of buffered messages while 'msg_free'
91 * is the index where the next message would be buffered.
92 * We shouldn't need it too big because every transfer is interrupt
93 * triggered and if we have lots of data to transfer, the interrupt
94 * latencies are going to be the bottleneck, not the buffer length.
95 * Besides, mbox_send_message could be called from atomic context and
96 * the client could also queue another message from the notifier 'tx_done'
97 * of the last transfer done.
98 * REVISIT: If too many platforms see the "Try increasing MBOX_TX_QUEUE_LEN"
99 * print, it needs to be taken from config option or somesuch.
100 */
101#define MBOX_TX_QUEUE_LEN 20
102
103/**
104 * struct mbox_chan - s/w representation of a communication chan
105 * @mbox: Pointer to the parent/provider of this channel
106 * @txdone_method: Way to detect TXDone chosen by the API
107 * @cl: Pointer to the current owner of this channel
108 * @tx_complete: Transmission completion
109 * @active_req: Currently active request hook
110 * @msg_count: No. of mssg currently queued
111 * @msg_free: Index of next available mssg slot
112 * @msg_data: Hook for data packet
113 * @lock: Serialise access to the channel
114 * @con_priv: Hook for controller driver to attach private data
115 */
116struct mbox_chan {
117 struct mbox_controller *mbox;
118 unsigned txdone_method;
119 struct mbox_client *cl;
120 struct completion tx_complete;
121 void *active_req;
122 unsigned msg_count, msg_free;
123 void *msg_data[MBOX_TX_QUEUE_LEN];
124 spinlock_t lock; /* Serialise access to the channel */
125 void *con_priv;
126};
127
128int mbox_controller_register(struct mbox_controller *mbox); /* can sleep */
129void mbox_controller_unregister(struct mbox_controller *mbox); /* can sleep */
130void mbox_chan_received_data(struct mbox_chan *chan, void *data); /* atomic */
131void mbox_chan_txdone(struct mbox_chan *chan, int r); /* atomic */
132
133#endif /* __MAILBOX_CONTROLLER_H */
diff --git a/include/linux/mei_cl_bus.h b/include/linux/mei_cl_bus.h
index d14af7b722ef..164aad1f9f12 100644
--- a/include/linux/mei_cl_bus.h
+++ b/include/linux/mei_cl_bus.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/device.h> 4#include <linux/device.h>
5#include <linux/uuid.h> 5#include <linux/uuid.h>
6#include <linux/mod_devicetable.h>
6 7
7struct mei_cl_device; 8struct mei_cl_device;
8 9
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index b660e05b63d4..e8cc45307f8f 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -249,7 +249,7 @@ phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
249/* 249/*
250 * Set the allocation direction to bottom-up or top-down. 250 * Set the allocation direction to bottom-up or top-down.
251 */ 251 */
252static inline void memblock_set_bottom_up(bool enable) 252static inline void __init memblock_set_bottom_up(bool enable)
253{ 253{
254 memblock.bottom_up = enable; 254 memblock.bottom_up = enable;
255} 255}
@@ -264,7 +264,7 @@ static inline bool memblock_bottom_up(void)
264 return memblock.bottom_up; 264 return memblock.bottom_up;
265} 265}
266#else 266#else
267static inline void memblock_set_bottom_up(bool enable) {} 267static inline void __init memblock_set_bottom_up(bool enable) {}
268static inline bool memblock_bottom_up(void) { return false; } 268static inline bool memblock_bottom_up(void) { return false; }
269#endif 269#endif
270 270
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index eb65d29516ca..6b75640ef5ab 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -54,39 +54,20 @@ struct mem_cgroup_reclaim_cookie {
54}; 54};
55 55
56#ifdef CONFIG_MEMCG 56#ifdef CONFIG_MEMCG
57/* 57int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm,
58 * All "charge" functions with gfp_mask should use GFP_KERNEL or 58 gfp_t gfp_mask, struct mem_cgroup **memcgp);
59 * (gfp_mask & GFP_RECLAIM_MASK). In current implementatin, memcg doesn't 59void mem_cgroup_commit_charge(struct page *page, struct mem_cgroup *memcg,
60 * alloc memory but reclaims memory from all available zones. So, "where I want 60 bool lrucare);
61 * memory from" bits of gfp_mask has no meaning. So any bits of that field is 61void mem_cgroup_cancel_charge(struct page *page, struct mem_cgroup *memcg);
62 * available but adding a rule is better. charge functions' gfp_mask should 62void mem_cgroup_uncharge(struct page *page);
63 * be set to GFP_KERNEL or gfp_mask & GFP_RECLAIM_MASK for avoiding ambiguous 63void mem_cgroup_uncharge_list(struct list_head *page_list);
64 * codes.
65 * (Of course, if memcg does memory allocation in future, GFP_KERNEL is sane.)
66 */
67 64
68extern int mem_cgroup_charge_anon(struct page *page, struct mm_struct *mm, 65void mem_cgroup_migrate(struct page *oldpage, struct page *newpage,
69 gfp_t gfp_mask); 66 bool lrucare);
70/* for swap handling */
71extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
72 struct page *page, gfp_t mask, struct mem_cgroup **memcgp);
73extern void mem_cgroup_commit_charge_swapin(struct page *page,
74 struct mem_cgroup *memcg);
75extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg);
76
77extern int mem_cgroup_charge_file(struct page *page, struct mm_struct *mm,
78 gfp_t gfp_mask);
79 67
80struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *); 68struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *);
81struct lruvec *mem_cgroup_page_lruvec(struct page *, struct zone *); 69struct lruvec *mem_cgroup_page_lruvec(struct page *, struct zone *);
82 70
83/* For coalescing uncharge for reducing memcg' overhead*/
84extern void mem_cgroup_uncharge_start(void);
85extern void mem_cgroup_uncharge_end(void);
86
87extern void mem_cgroup_uncharge_page(struct page *page);
88extern void mem_cgroup_uncharge_cache_page(struct page *page);
89
90bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg, 71bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg,
91 struct mem_cgroup *memcg); 72 struct mem_cgroup *memcg);
92bool task_in_mem_cgroup(struct task_struct *task, 73bool task_in_mem_cgroup(struct task_struct *task,
@@ -113,12 +94,6 @@ bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg)
113 94
114extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg); 95extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg);
115 96
116extern void
117mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
118 struct mem_cgroup **memcgp);
119extern void mem_cgroup_end_migration(struct mem_cgroup *memcg,
120 struct page *oldpage, struct page *newpage, bool migration_ok);
121
122struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *, 97struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *,
123 struct mem_cgroup *, 98 struct mem_cgroup *,
124 struct mem_cgroup_reclaim_cookie *); 99 struct mem_cgroup_reclaim_cookie *);
@@ -133,8 +108,6 @@ unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list);
133void mem_cgroup_update_lru_size(struct lruvec *, enum lru_list, int); 108void mem_cgroup_update_lru_size(struct lruvec *, enum lru_list, int);
134extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, 109extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
135 struct task_struct *p); 110 struct task_struct *p);
136extern void mem_cgroup_replace_page_cache(struct page *oldpage,
137 struct page *newpage);
138 111
139static inline void mem_cgroup_oom_enable(void) 112static inline void mem_cgroup_oom_enable(void)
140{ 113{
@@ -166,48 +139,23 @@ static inline bool mem_cgroup_disabled(void)
166 return false; 139 return false;
167} 140}
168 141
169void __mem_cgroup_begin_update_page_stat(struct page *page, bool *locked, 142struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page, bool *locked,
170 unsigned long *flags); 143 unsigned long *flags);
171 144void mem_cgroup_end_page_stat(struct mem_cgroup *memcg, bool locked,
172extern atomic_t memcg_moving; 145 unsigned long flags);
173 146void mem_cgroup_update_page_stat(struct mem_cgroup *memcg,
174static inline void mem_cgroup_begin_update_page_stat(struct page *page, 147 enum mem_cgroup_stat_index idx, int val);
175 bool *locked, unsigned long *flags)
176{
177 if (mem_cgroup_disabled())
178 return;
179 rcu_read_lock();
180 *locked = false;
181 if (atomic_read(&memcg_moving))
182 __mem_cgroup_begin_update_page_stat(page, locked, flags);
183}
184
185void __mem_cgroup_end_update_page_stat(struct page *page,
186 unsigned long *flags);
187static inline void mem_cgroup_end_update_page_stat(struct page *page,
188 bool *locked, unsigned long *flags)
189{
190 if (mem_cgroup_disabled())
191 return;
192 if (*locked)
193 __mem_cgroup_end_update_page_stat(page, flags);
194 rcu_read_unlock();
195}
196
197void mem_cgroup_update_page_stat(struct page *page,
198 enum mem_cgroup_stat_index idx,
199 int val);
200 148
201static inline void mem_cgroup_inc_page_stat(struct page *page, 149static inline void mem_cgroup_inc_page_stat(struct mem_cgroup *memcg,
202 enum mem_cgroup_stat_index idx) 150 enum mem_cgroup_stat_index idx)
203{ 151{
204 mem_cgroup_update_page_stat(page, idx, 1); 152 mem_cgroup_update_page_stat(memcg, idx, 1);
205} 153}
206 154
207static inline void mem_cgroup_dec_page_stat(struct page *page, 155static inline void mem_cgroup_dec_page_stat(struct mem_cgroup *memcg,
208 enum mem_cgroup_stat_index idx) 156 enum mem_cgroup_stat_index idx)
209{ 157{
210 mem_cgroup_update_page_stat(page, idx, -1); 158 mem_cgroup_update_page_stat(memcg, idx, -1);
211} 159}
212 160
213unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, 161unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
@@ -233,46 +181,36 @@ void mem_cgroup_print_bad_page(struct page *page);
233#else /* CONFIG_MEMCG */ 181#else /* CONFIG_MEMCG */
234struct mem_cgroup; 182struct mem_cgroup;
235 183
236static inline int mem_cgroup_charge_anon(struct page *page, 184static inline int mem_cgroup_try_charge(struct page *page, struct mm_struct *mm,
237 struct mm_struct *mm, gfp_t gfp_mask) 185 gfp_t gfp_mask,
238{ 186 struct mem_cgroup **memcgp)
239 return 0;
240}
241
242static inline int mem_cgroup_charge_file(struct page *page,
243 struct mm_struct *mm, gfp_t gfp_mask)
244{ 187{
188 *memcgp = NULL;
245 return 0; 189 return 0;
246} 190}
247 191
248static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm, 192static inline void mem_cgroup_commit_charge(struct page *page,
249 struct page *page, gfp_t gfp_mask, struct mem_cgroup **memcgp) 193 struct mem_cgroup *memcg,
250{ 194 bool lrucare)
251 return 0;
252}
253
254static inline void mem_cgroup_commit_charge_swapin(struct page *page,
255 struct mem_cgroup *memcg)
256{
257}
258
259static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg)
260{ 195{
261} 196}
262 197
263static inline void mem_cgroup_uncharge_start(void) 198static inline void mem_cgroup_cancel_charge(struct page *page,
199 struct mem_cgroup *memcg)
264{ 200{
265} 201}
266 202
267static inline void mem_cgroup_uncharge_end(void) 203static inline void mem_cgroup_uncharge(struct page *page)
268{ 204{
269} 205}
270 206
271static inline void mem_cgroup_uncharge_page(struct page *page) 207static inline void mem_cgroup_uncharge_list(struct list_head *page_list)
272{ 208{
273} 209}
274 210
275static inline void mem_cgroup_uncharge_cache_page(struct page *page) 211static inline void mem_cgroup_migrate(struct page *oldpage,
212 struct page *newpage,
213 bool lrucare)
276{ 214{
277} 215}
278 216
@@ -311,17 +249,6 @@ static inline struct cgroup_subsys_state
311 return NULL; 249 return NULL;
312} 250}
313 251
314static inline void
315mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
316 struct mem_cgroup **memcgp)
317{
318}
319
320static inline void mem_cgroup_end_migration(struct mem_cgroup *memcg,
321 struct page *oldpage, struct page *newpage, bool migration_ok)
322{
323}
324
325static inline struct mem_cgroup * 252static inline struct mem_cgroup *
326mem_cgroup_iter(struct mem_cgroup *root, 253mem_cgroup_iter(struct mem_cgroup *root,
327 struct mem_cgroup *prev, 254 struct mem_cgroup *prev,
@@ -363,13 +290,14 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
363{ 290{
364} 291}
365 292
366static inline void mem_cgroup_begin_update_page_stat(struct page *page, 293static inline struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page,
367 bool *locked, unsigned long *flags) 294 bool *locked, unsigned long *flags)
368{ 295{
296 return NULL;
369} 297}
370 298
371static inline void mem_cgroup_end_update_page_stat(struct page *page, 299static inline void mem_cgroup_end_page_stat(struct mem_cgroup *memcg,
372 bool *locked, unsigned long *flags) 300 bool locked, unsigned long flags)
373{ 301{
374} 302}
375 303
@@ -391,12 +319,12 @@ static inline bool mem_cgroup_oom_synchronize(bool wait)
391 return false; 319 return false;
392} 320}
393 321
394static inline void mem_cgroup_inc_page_stat(struct page *page, 322static inline void mem_cgroup_inc_page_stat(struct mem_cgroup *memcg,
395 enum mem_cgroup_stat_index idx) 323 enum mem_cgroup_stat_index idx)
396{ 324{
397} 325}
398 326
399static inline void mem_cgroup_dec_page_stat(struct page *page, 327static inline void mem_cgroup_dec_page_stat(struct mem_cgroup *memcg,
400 enum mem_cgroup_stat_index idx) 328 enum mem_cgroup_stat_index idx)
401{ 329{
402} 330}
@@ -417,10 +345,6 @@ static inline
417void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx) 345void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
418{ 346{
419} 347}
420static inline void mem_cgroup_replace_page_cache(struct page *oldpage,
421 struct page *newpage)
422{
423}
424#endif /* CONFIG_MEMCG */ 348#endif /* CONFIG_MEMCG */
425 349
426#if !defined(CONFIG_MEMCG) || !defined(CONFIG_DEBUG_VM) 350#if !defined(CONFIG_MEMCG) || !defined(CONFIG_DEBUG_VM)
@@ -492,11 +416,6 @@ void __memcg_kmem_uncharge_pages(struct page *page, int order);
492 416
493int memcg_cache_id(struct mem_cgroup *memcg); 417int memcg_cache_id(struct mem_cgroup *memcg);
494 418
495int memcg_alloc_cache_params(struct mem_cgroup *memcg, struct kmem_cache *s,
496 struct kmem_cache *root_cache);
497void memcg_free_cache_params(struct kmem_cache *s);
498
499int memcg_update_cache_size(struct kmem_cache *s, int num_groups);
500void memcg_update_array_size(int num_groups); 419void memcg_update_array_size(int num_groups);
501 420
502struct kmem_cache * 421struct kmem_cache *
@@ -626,16 +545,6 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg)
626 return -1; 545 return -1;
627} 546}
628 547
629static inline int memcg_alloc_cache_params(struct mem_cgroup *memcg,
630 struct kmem_cache *s, struct kmem_cache *root_cache)
631{
632 return 0;
633}
634
635static inline void memcg_free_cache_params(struct kmem_cache *s)
636{
637}
638
639static inline struct kmem_cache * 548static inline struct kmem_cache *
640memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp) 549memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
641{ 550{
diff --git a/include/linux/memory.h b/include/linux/memory.h
index bb7384e3c3d8..8b8d8d12348e 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -35,7 +35,7 @@ struct memory_block {
35}; 35};
36 36
37int arch_get_memory_phys_device(unsigned long start_pfn); 37int arch_get_memory_phys_device(unsigned long start_pfn);
38unsigned long __weak memory_block_size_bytes(void); 38unsigned long memory_block_size_bytes(void);
39 39
40/* These states are exposed to userspace as text strings in sysfs */ 40/* These states are exposed to userspace as text strings in sysfs */
41#define MEM_ONLINE (1<<0) /* exposed to userspace */ 41#define MEM_ONLINE (1<<0) /* exposed to userspace */
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 010d125bffbf..8f1a41951df9 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -26,11 +26,12 @@ enum {
26 MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO, 26 MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO,
27}; 27};
28 28
29/* Types for control the zone type of onlined memory */ 29/* Types for control the zone type of onlined and offlined memory */
30enum { 30enum {
31 ONLINE_KEEP, 31 MMOP_OFFLINE = -1,
32 ONLINE_KERNEL, 32 MMOP_ONLINE_KEEP,
33 ONLINE_MOVABLE, 33 MMOP_ONLINE_KERNEL,
34 MMOP_ONLINE_MOVABLE,
34}; 35};
35 36
36/* 37/*
@@ -83,6 +84,7 @@ extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages);
83extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); 84extern int add_one_highpage(struct page *page, int pfn, int bad_ppro);
84/* VM interface that may be used by firmware interface */ 85/* VM interface that may be used by firmware interface */
85extern int online_pages(unsigned long, unsigned long, int); 86extern int online_pages(unsigned long, unsigned long, int);
87extern int test_pages_in_a_zone(unsigned long, unsigned long);
86extern void __offline_isolated_pages(unsigned long, unsigned long); 88extern void __offline_isolated_pages(unsigned long, unsigned long);
87 89
88typedef void (*online_page_callback_t)(struct page *page); 90typedef void (*online_page_callback_t)(struct page *page);
@@ -258,6 +260,7 @@ static inline void remove_memory(int nid, u64 start, u64 size) {}
258extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn, 260extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
259 void *arg, int (*func)(struct memory_block *, void *)); 261 void *arg, int (*func)(struct memory_block *, void *));
260extern int add_memory(int nid, u64 start, u64 size); 262extern int add_memory(int nid, u64 start, u64 size);
263extern int zone_for_memory(int nid, u64 start, u64 size, int zone_default);
261extern int arch_add_memory(int nid, u64 start, u64 size); 264extern int arch_add_memory(int nid, u64 start, u64 size);
262extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); 265extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
263extern bool is_memblock_offlined(struct memory_block *mem); 266extern bool is_memblock_offlined(struct memory_block *mem);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index f230a978e6ba..3d385c81c153 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -134,9 +134,10 @@ void mpol_free_shared_policy(struct shared_policy *p);
134struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, 134struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
135 unsigned long idx); 135 unsigned long idx);
136 136
137struct mempolicy *get_vma_policy(struct task_struct *tsk, 137struct mempolicy *get_task_policy(struct task_struct *p);
138 struct vm_area_struct *vma, unsigned long addr); 138struct mempolicy *__get_vma_policy(struct vm_area_struct *vma,
139bool vma_policy_mof(struct task_struct *task, struct vm_area_struct *vma); 139 unsigned long addr);
140bool vma_policy_mof(struct vm_area_struct *vma);
140 141
141extern void numa_default_policy(void); 142extern void numa_default_policy(void);
142extern void numa_policy_init(void); 143extern void numa_policy_init(void);
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 4e7fe7417fc9..9475fee2bfc5 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -505,6 +505,7 @@ static inline int is_ab9540_2p0_or_earlier(struct ab8500 *ab)
505void ab8500_override_turn_on_stat(u8 mask, u8 set); 505void ab8500_override_turn_on_stat(u8 mask, u8 set);
506 506
507#ifdef CONFIG_AB8500_DEBUG 507#ifdef CONFIG_AB8500_DEBUG
508extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
508void ab8500_dump_all_banks(struct device *dev); 509void ab8500_dump_all_banks(struct device *dev);
509void ab8500_debug_register_interrupt(int line); 510void ab8500_debug_register_interrupt(int line);
510#else 511#else
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index a614b33d0a39..f34723f7663c 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -18,7 +18,7 @@
18#include <linux/regulator/consumer.h> 18#include <linux/regulator/consumer.h>
19#include <linux/mfd/arizona/pdata.h> 19#include <linux/mfd/arizona/pdata.h>
20 20
21#define ARIZONA_MAX_CORE_SUPPLIES 3 21#define ARIZONA_MAX_CORE_SUPPLIES 2
22 22
23enum arizona_type { 23enum arizona_type {
24 WM5102 = 1, 24 WM5102 = 1,
@@ -46,8 +46,8 @@ enum arizona_type {
46#define ARIZONA_IRQ_DSP_IRQ6 17 46#define ARIZONA_IRQ_DSP_IRQ6 17
47#define ARIZONA_IRQ_DSP_IRQ7 18 47#define ARIZONA_IRQ_DSP_IRQ7 18
48#define ARIZONA_IRQ_DSP_IRQ8 19 48#define ARIZONA_IRQ_DSP_IRQ8 19
49#define ARIZONA_IRQ_SPK_SHUTDOWN_WARN 20 49#define ARIZONA_IRQ_SPK_OVERHEAT_WARN 20
50#define ARIZONA_IRQ_SPK_SHUTDOWN 21 50#define ARIZONA_IRQ_SPK_OVERHEAT 21
51#define ARIZONA_IRQ_MICDET 22 51#define ARIZONA_IRQ_MICDET 22
52#define ARIZONA_IRQ_HPDET 23 52#define ARIZONA_IRQ_HPDET 23
53#define ARIZONA_IRQ_WSEQ_DONE 24 53#define ARIZONA_IRQ_WSEQ_DONE 24
@@ -78,8 +78,31 @@ enum arizona_type {
78#define ARIZONA_IRQ_FLL1_CLOCK_OK 49 78#define ARIZONA_IRQ_FLL1_CLOCK_OK 49
79#define ARIZONA_IRQ_MICD_CLAMP_RISE 50 79#define ARIZONA_IRQ_MICD_CLAMP_RISE 50
80#define ARIZONA_IRQ_MICD_CLAMP_FALL 51 80#define ARIZONA_IRQ_MICD_CLAMP_FALL 51
81 81#define ARIZONA_IRQ_HP3R_DONE 52
82#define ARIZONA_NUM_IRQ 52 82#define ARIZONA_IRQ_HP3L_DONE 53
83#define ARIZONA_IRQ_HP2R_DONE 54
84#define ARIZONA_IRQ_HP2L_DONE 55
85#define ARIZONA_IRQ_HP1R_DONE 56
86#define ARIZONA_IRQ_HP1L_DONE 57
87#define ARIZONA_IRQ_ISRC3_CFG_ERR 58
88#define ARIZONA_IRQ_DSP_SHARED_WR_COLL 59
89#define ARIZONA_IRQ_SPK_SHUTDOWN 60
90#define ARIZONA_IRQ_SPK1R_SHORT 61
91#define ARIZONA_IRQ_SPK1L_SHORT 62
92#define ARIZONA_IRQ_HP3R_SC_NEG 63
93#define ARIZONA_IRQ_HP3R_SC_POS 64
94#define ARIZONA_IRQ_HP3L_SC_NEG 65
95#define ARIZONA_IRQ_HP3L_SC_POS 66
96#define ARIZONA_IRQ_HP2R_SC_NEG 67
97#define ARIZONA_IRQ_HP2R_SC_POS 68
98#define ARIZONA_IRQ_HP2L_SC_NEG 69
99#define ARIZONA_IRQ_HP2L_SC_POS 70
100#define ARIZONA_IRQ_HP1R_SC_NEG 71
101#define ARIZONA_IRQ_HP1R_SC_POS 72
102#define ARIZONA_IRQ_HP1L_SC_NEG 73
103#define ARIZONA_IRQ_HP1L_SC_POS 74
104
105#define ARIZONA_NUM_IRQ 75
83 106
84struct snd_soc_dapm_context; 107struct snd_soc_dapm_context;
85 108
@@ -109,6 +132,8 @@ struct arizona {
109 struct mutex clk_lock; 132 struct mutex clk_lock;
110 int clk32k_ref; 133 int clk32k_ref;
111 134
135 bool ctrlif_error;
136
112 struct snd_soc_dapm_context *dapm; 137 struct snd_soc_dapm_context *dapm;
113 138
114 int tdm_width[ARIZONA_MAX_AIF]; 139 int tdm_width[ARIZONA_MAX_AIF];
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 7204d8138b24..c0b075f6bc35 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -27,6 +27,7 @@
27#define ARIZONA_WRITE_SEQUENCER_CTRL_0 0x16 27#define ARIZONA_WRITE_SEQUENCER_CTRL_0 0x16
28#define ARIZONA_WRITE_SEQUENCER_CTRL_1 0x17 28#define ARIZONA_WRITE_SEQUENCER_CTRL_1 0x17
29#define ARIZONA_WRITE_SEQUENCER_CTRL_2 0x18 29#define ARIZONA_WRITE_SEQUENCER_CTRL_2 0x18
30#define ARIZONA_WRITE_SEQUENCER_CTRL_3 0x19
30#define ARIZONA_WRITE_SEQUENCER_PROM 0x1A 31#define ARIZONA_WRITE_SEQUENCER_PROM 0x1A
31#define ARIZONA_TONE_GENERATOR_1 0x20 32#define ARIZONA_TONE_GENERATOR_1 0x20
32#define ARIZONA_TONE_GENERATOR_2 0x21 33#define ARIZONA_TONE_GENERATOR_2 0x21
@@ -70,7 +71,9 @@
70#define ARIZONA_SAMPLE_RATE_3_STATUS 0x10C 71#define ARIZONA_SAMPLE_RATE_3_STATUS 0x10C
71#define ARIZONA_ASYNC_CLOCK_1 0x112 72#define ARIZONA_ASYNC_CLOCK_1 0x112
72#define ARIZONA_ASYNC_SAMPLE_RATE_1 0x113 73#define ARIZONA_ASYNC_SAMPLE_RATE_1 0x113
74#define ARIZONA_ASYNC_SAMPLE_RATE_2 0x114
73#define ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS 0x11B 75#define ARIZONA_ASYNC_SAMPLE_RATE_1_STATUS 0x11B
76#define ARIZONA_ASYNC_SAMPLE_RATE_2_STATUS 0x11C
74#define ARIZONA_OUTPUT_SYSTEM_CLOCK 0x149 77#define ARIZONA_OUTPUT_SYSTEM_CLOCK 0x149
75#define ARIZONA_OUTPUT_ASYNC_CLOCK 0x14A 78#define ARIZONA_OUTPUT_ASYNC_CLOCK 0x14A
76#define ARIZONA_RATE_ESTIMATOR_1 0x152 79#define ARIZONA_RATE_ESTIMATOR_1 0x152
@@ -878,22 +881,26 @@
878#define ARIZONA_INTERRUPT_STATUS_3 0xD02 881#define ARIZONA_INTERRUPT_STATUS_3 0xD02
879#define ARIZONA_INTERRUPT_STATUS_4 0xD03 882#define ARIZONA_INTERRUPT_STATUS_4 0xD03
880#define ARIZONA_INTERRUPT_STATUS_5 0xD04 883#define ARIZONA_INTERRUPT_STATUS_5 0xD04
884#define ARIZONA_INTERRUPT_STATUS_6 0xD05
881#define ARIZONA_INTERRUPT_STATUS_1_MASK 0xD08 885#define ARIZONA_INTERRUPT_STATUS_1_MASK 0xD08
882#define ARIZONA_INTERRUPT_STATUS_2_MASK 0xD09 886#define ARIZONA_INTERRUPT_STATUS_2_MASK 0xD09
883#define ARIZONA_INTERRUPT_STATUS_3_MASK 0xD0A 887#define ARIZONA_INTERRUPT_STATUS_3_MASK 0xD0A
884#define ARIZONA_INTERRUPT_STATUS_4_MASK 0xD0B 888#define ARIZONA_INTERRUPT_STATUS_4_MASK 0xD0B
885#define ARIZONA_INTERRUPT_STATUS_5_MASK 0xD0C 889#define ARIZONA_INTERRUPT_STATUS_5_MASK 0xD0C
890#define ARIZONA_INTERRUPT_STATUS_6_MASK 0xD0D
886#define ARIZONA_INTERRUPT_CONTROL 0xD0F 891#define ARIZONA_INTERRUPT_CONTROL 0xD0F
887#define ARIZONA_IRQ2_STATUS_1 0xD10 892#define ARIZONA_IRQ2_STATUS_1 0xD10
888#define ARIZONA_IRQ2_STATUS_2 0xD11 893#define ARIZONA_IRQ2_STATUS_2 0xD11
889#define ARIZONA_IRQ2_STATUS_3 0xD12 894#define ARIZONA_IRQ2_STATUS_3 0xD12
890#define ARIZONA_IRQ2_STATUS_4 0xD13 895#define ARIZONA_IRQ2_STATUS_4 0xD13
891#define ARIZONA_IRQ2_STATUS_5 0xD14 896#define ARIZONA_IRQ2_STATUS_5 0xD14
897#define ARIZONA_IRQ2_STATUS_6 0xD15
892#define ARIZONA_IRQ2_STATUS_1_MASK 0xD18 898#define ARIZONA_IRQ2_STATUS_1_MASK 0xD18
893#define ARIZONA_IRQ2_STATUS_2_MASK 0xD19 899#define ARIZONA_IRQ2_STATUS_2_MASK 0xD19
894#define ARIZONA_IRQ2_STATUS_3_MASK 0xD1A 900#define ARIZONA_IRQ2_STATUS_3_MASK 0xD1A
895#define ARIZONA_IRQ2_STATUS_4_MASK 0xD1B 901#define ARIZONA_IRQ2_STATUS_4_MASK 0xD1B
896#define ARIZONA_IRQ2_STATUS_5_MASK 0xD1C 902#define ARIZONA_IRQ2_STATUS_5_MASK 0xD1C
903#define ARIZONA_IRQ2_STATUS_6_MASK 0xD1D
897#define ARIZONA_IRQ2_CONTROL 0xD1F 904#define ARIZONA_IRQ2_CONTROL 0xD1F
898#define ARIZONA_INTERRUPT_RAW_STATUS_2 0xD20 905#define ARIZONA_INTERRUPT_RAW_STATUS_2 0xD20
899#define ARIZONA_INTERRUPT_RAW_STATUS_3 0xD21 906#define ARIZONA_INTERRUPT_RAW_STATUS_3 0xD21
@@ -902,6 +909,7 @@
902#define ARIZONA_INTERRUPT_RAW_STATUS_6 0xD24 909#define ARIZONA_INTERRUPT_RAW_STATUS_6 0xD24
903#define ARIZONA_INTERRUPT_RAW_STATUS_7 0xD25 910#define ARIZONA_INTERRUPT_RAW_STATUS_7 0xD25
904#define ARIZONA_INTERRUPT_RAW_STATUS_8 0xD26 911#define ARIZONA_INTERRUPT_RAW_STATUS_8 0xD26
912#define ARIZONA_INTERRUPT_RAW_STATUS_9 0xD28
905#define ARIZONA_IRQ_PIN_STATUS 0xD40 913#define ARIZONA_IRQ_PIN_STATUS 0xD40
906#define ARIZONA_ADSP2_IRQ0 0xD41 914#define ARIZONA_ADSP2_IRQ0 0xD41
907#define ARIZONA_AOD_WKUP_AND_TRIG 0xD50 915#define ARIZONA_AOD_WKUP_AND_TRIG 0xD50
@@ -1659,16 +1667,30 @@
1659/* 1667/*
1660 * R275 (0x113) - Async sample rate 1 1668 * R275 (0x113) - Async sample rate 1
1661 */ 1669 */
1662#define ARIZONA_ASYNC_SAMPLE_RATE_MASK 0x001F /* ASYNC_SAMPLE_RATE - [4:0] */ 1670#define ARIZONA_ASYNC_SAMPLE_RATE_1_MASK 0x001F /* ASYNC_SAMPLE_RATE_1 - [4:0] */
1663#define ARIZONA_ASYNC_SAMPLE_RATE_SHIFT 0 /* ASYNC_SAMPLE_RATE - [4:0] */ 1671#define ARIZONA_ASYNC_SAMPLE_RATE_1_SHIFT 0 /* ASYNC_SAMPLE_RATE_1 - [4:0] */
1664#define ARIZONA_ASYNC_SAMPLE_RATE_WIDTH 5 /* ASYNC_SAMPLE_RATE - [4:0] */ 1672#define ARIZONA_ASYNC_SAMPLE_RATE_1_WIDTH 5 /* ASYNC_SAMPLE_RATE_1 - [4:0] */
1673
1674/*
1675 * R276 (0x114) - Async sample rate 2
1676 */
1677#define ARIZONA_ASYNC_SAMPLE_RATE_2_MASK 0x001F /* ASYNC_SAMPLE_RATE_2 - [4:0] */
1678#define ARIZONA_ASYNC_SAMPLE_RATE_2_SHIFT 0 /* ASYNC_SAMPLE_RATE_2 - [4:0] */
1679#define ARIZONA_ASYNC_SAMPLE_RATE_2_WIDTH 5 /* ASYNC_SAMPLE_RATE_2 - [4:0] */
1665 1680
1666/* 1681/*
1667 * R283 (0x11B) - Async sample rate 1 status 1682 * R283 (0x11B) - Async sample rate 1 status
1668 */ 1683 */
1669#define ARIZONA_ASYNC_SAMPLE_RATE_STS_MASK 0x001F /* ASYNC_SAMPLE_RATE_STS - [4:0] */ 1684#define ARIZONA_ASYNC_SAMPLE_RATE_1_STS_MASK 0x001F /* ASYNC_SAMPLE_RATE_1_STS - [4:0] */
1670#define ARIZONA_ASYNC_SAMPLE_RATE_STS_SHIFT 0 /* ASYNC_SAMPLE_RATE_STS - [4:0] */ 1685#define ARIZONA_ASYNC_SAMPLE_RATE_1_STS_SHIFT 0 /* ASYNC_SAMPLE_RATE_1_STS - [4:0] */
1671#define ARIZONA_ASYNC_SAMPLE_RATE_STS_WIDTH 5 /* ASYNC_SAMPLE_RATE_STS - [4:0] */ 1686#define ARIZONA_ASYNC_SAMPLE_RATE_1_STS_WIDTH 5 /* ASYNC_SAMPLE_RATE_1_STS - [4:0] */
1687
1688/*
1689 * R284 (0x11C) - Async sample rate 2 status
1690 */
1691#define ARIZONA_ASYNC_SAMPLE_RATE_2_STS_MASK 0x001F /* ASYNC_SAMPLE_RATE_2_STS - [4:0] */
1692#define ARIZONA_ASYNC_SAMPLE_RATE_2_STS_SHIFT 0 /* ASYNC_SAMPLE_RATE_2_STS - [4:0] */
1693#define ARIZONA_ASYNC_SAMPLE_RATE_2_STS_WIDTH 5 /* ASYNC_SAMPLE_RATE_2_STS - [4:0] */
1672 1694
1673/* 1695/*
1674 * R329 (0x149) - Output system clock 1696 * R329 (0x149) - Output system clock
@@ -4691,14 +4713,14 @@
4691/* 4713/*
4692 * R3330 (0xD02) - Interrupt Status 3 4714 * R3330 (0xD02) - Interrupt Status 3
4693 */ 4715 */
4694#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1 0x8000 /* SPK_SHUTDOWN_WARN_EINT1 */ 4716#define ARIZONA_SPK_OVERHEAT_WARN_EINT1 0x8000 /* SPK_OVERHEAT_WARN_EINT1 */
4695#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1_MASK 0x8000 /* SPK_SHUTDOWN_WARN_EINT1 */ 4717#define ARIZONA_SPK_OVERHEAT_WARN_EINT1_MASK 0x8000 /* SPK_OVERHEAD_WARN_EINT1 */
4696#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1_SHIFT 15 /* SPK_SHUTDOWN_WARN_EINT1 */ 4718#define ARIZONA_SPK_OVERHEAT_WARN_EINT1_SHIFT 15 /* SPK_OVERHEAT_WARN_EINT1 */
4697#define ARIZONA_SPK_SHUTDOWN_WARN_EINT1_WIDTH 1 /* SPK_SHUTDOWN_WARN_EINT1 */ 4719#define ARIZONA_SPK_OVERHEAT_WARN_EINT1_WIDTH 1 /* SPK_OVERHEAT_WARN_EINT1 */
4698#define ARIZONA_SPK_SHUTDOWN_EINT1 0x4000 /* SPK_SHUTDOWN_EINT1 */ 4720#define ARIZONA_SPK_OVERHEAT_EINT1 0x4000 /* SPK_OVERHEAT_EINT1 */
4699#define ARIZONA_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* SPK_SHUTDOWN_EINT1 */ 4721#define ARIZONA_SPK_OVERHEAT_EINT1_MASK 0x4000 /* SPK_OVERHEAT_EINT1 */
4700#define ARIZONA_SPK_SHUTDOWN_EINT1_SHIFT 14 /* SPK_SHUTDOWN_EINT1 */ 4722#define ARIZONA_SPK_OVERHEAT_EINT1_SHIFT 14 /* SPK_OVERHEAT_EINT1 */
4701#define ARIZONA_SPK_SHUTDOWN_EINT1_WIDTH 1 /* SPK_SHUTDOWN_EINT1 */ 4723#define ARIZONA_SPK_OVERHEAT_EINT1_WIDTH 1 /* SPK_OVERHEAT_EINT1 */
4702#define ARIZONA_HPDET_EINT1 0x2000 /* HPDET_EINT1 */ 4724#define ARIZONA_HPDET_EINT1 0x2000 /* HPDET_EINT1 */
4703#define ARIZONA_HPDET_EINT1_MASK 0x2000 /* HPDET_EINT1 */ 4725#define ARIZONA_HPDET_EINT1_MASK 0x2000 /* HPDET_EINT1 */
4704#define ARIZONA_HPDET_EINT1_SHIFT 13 /* HPDET_EINT1 */ 4726#define ARIZONA_HPDET_EINT1_SHIFT 13 /* HPDET_EINT1 */
@@ -4795,6 +4817,77 @@
4795#define ARIZONA_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* ISRC2_CFG_ERR_EINT1 */ 4817#define ARIZONA_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* ISRC2_CFG_ERR_EINT1 */
4796#define ARIZONA_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* ISRC2_CFG_ERR_EINT1 */ 4818#define ARIZONA_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* ISRC2_CFG_ERR_EINT1 */
4797#define ARIZONA_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* ISRC2_CFG_ERR_EINT1 */ 4819#define ARIZONA_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* ISRC2_CFG_ERR_EINT1 */
4820#define ARIZONA_HP3R_DONE_EINT1 0x0020 /* HP3R_DONE_EINT1 */
4821#define ARIZONA_HP3R_DONE_EINT1_MASK 0x0020 /* HP3R_DONE_EINT1 */
4822#define ARIZONA_HP3R_DONE_EINT1_SHIFT 5 /* HP3R_DONE_EINT1 */
4823#define ARIZONA_HP3R_DONE_EINT1_WIDTH 1 /* HP3R_DONE_EINT1 */
4824#define ARIZONA_HP3L_DONE_EINT1 0x0010 /* HP3L_DONE_EINT1 */
4825#define ARIZONA_HP3L_DONE_EINT1_MASK 0x0010 /* HP3L_DONE_EINT1 */
4826#define ARIZONA_HP3L_DONE_EINT1_SHIFT 4 /* HP3L_DONE_EINT1 */
4827#define ARIZONA_HP3L_DONE_EINT1_WIDTH 1 /* HP3L_DONE_EINT1 */
4828#define ARIZONA_HP2R_DONE_EINT1 0x0008 /* HP2R_DONE_EINT1 */
4829#define ARIZONA_HP2R_DONE_EINT1_MASK 0x0008 /* HP2R_DONE_EINT1 */
4830#define ARIZONA_HP2R_DONE_EINT1_SHIFT 3 /* HP2R_DONE_EINT1 */
4831#define ARIZONA_HP2R_DONE_EINT1_WIDTH 1 /* HP2R_DONE_EINT1 */
4832#define ARIZONA_HP2L_DONE_EINT1 0x0004 /* HP2L_DONE_EINT1 */
4833#define ARIZONA_HP2L_DONE_EINT1_MASK 0x0004 /* HP2L_DONE_EINT1 */
4834#define ARIZONA_HP2L_DONE_EINT1_SHIFT 2 /* HP2L_DONE_EINT1 */
4835#define ARIZONA_HP2L_DONE_EINT1_WIDTH 1 /* HP2L_DONE_EINT1 */
4836#define ARIZONA_HP1R_DONE_EINT1 0x0002 /* HP1R_DONE_EINT1 */
4837#define ARIZONA_HP1R_DONE_EINT1_MASK 0x0002 /* HP1R_DONE_EINT1 */
4838#define ARIZONA_HP1R_DONE_EINT1_SHIFT 1 /* HP1R_DONE_EINT1 */
4839#define ARIZONA_HP1R_DONE_EINT1_WIDTH 1 /* HP1R_DONE_EINT1 */
4840#define ARIZONA_HP1L_DONE_EINT1 0x0001 /* HP1L_DONE_EINT1 */
4841#define ARIZONA_HP1L_DONE_EINT1_MASK 0x0001 /* HP1L_DONE_EINT1 */
4842#define ARIZONA_HP1L_DONE_EINT1_SHIFT 0 /* HP1L_DONE_EINT1 */
4843#define ARIZONA_HP1L_DONE_EINT1_WIDTH 1 /* HP1L_DONE_EINT1 */
4844
4845/*
4846 * R3331 (0xD03) - Interrupt Status 4 (Alternate layout)
4847 *
4848 * Alternate layout used on later devices, note only fields that have moved
4849 * are specified
4850 */
4851#define ARIZONA_V2_AIF3_ERR_EINT1 0x8000 /* AIF3_ERR_EINT1 */
4852#define ARIZONA_V2_AIF3_ERR_EINT1_MASK 0x8000 /* AIF3_ERR_EINT1 */
4853#define ARIZONA_V2_AIF3_ERR_EINT1_SHIFT 15 /* AIF3_ERR_EINT1 */
4854#define ARIZONA_V2_AIF3_ERR_EINT1_WIDTH 1 /* AIF3_ERR_EINT1 */
4855#define ARIZONA_V2_AIF2_ERR_EINT1 0x4000 /* AIF2_ERR_EINT1 */
4856#define ARIZONA_V2_AIF2_ERR_EINT1_MASK 0x4000 /* AIF2_ERR_EINT1 */
4857#define ARIZONA_V2_AIF2_ERR_EINT1_SHIFT 14 /* AIF2_ERR_EINT1 */
4858#define ARIZONA_V2_AIF2_ERR_EINT1_WIDTH 1 /* AIF2_ERR_EINT1 */
4859#define ARIZONA_V2_AIF1_ERR_EINT1 0x2000 /* AIF1_ERR_EINT1 */
4860#define ARIZONA_V2_AIF1_ERR_EINT1_MASK 0x2000 /* AIF1_ERR_EINT1 */
4861#define ARIZONA_V2_AIF1_ERR_EINT1_SHIFT 13 /* AIF1_ERR_EINT1 */
4862#define ARIZONA_V2_AIF1_ERR_EINT1_WIDTH 1 /* AIF1_ERR_EINT1 */
4863#define ARIZONA_V2_CTRLIF_ERR_EINT1 0x1000 /* CTRLIF_ERR_EINT1 */
4864#define ARIZONA_V2_CTRLIF_ERR_EINT1_MASK 0x1000 /* CTRLIF_ERR_EINT1 */
4865#define ARIZONA_V2_CTRLIF_ERR_EINT1_SHIFT 12 /* CTRLIF_ERR_EINT1 */
4866#define ARIZONA_V2_CTRLIF_ERR_EINT1_WIDTH 1 /* CTRLIF_ERR_EINT1 */
4867#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1 0x0800 /* MIXER_DROPPED_SAMPLE_EINT1 */
4868#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1_MASK 0x0800 /* MIXER_DROPPED_SAMPLE_EINT1 */
4869#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1_SHIFT 11 /* MIXER_DROPPED_SAMPLE_EINT1 */
4870#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT1_WIDTH 1 /* MIXER_DROPPED_SAMPLE_EINT1 */
4871#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1 0x0400 /* ASYNC_CLK_ENA_LOW_EINT1 */
4872#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1_MASK 0x0400 /* ASYNC_CLK_ENA_LOW_EINT1 */
4873#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1_SHIFT 10 /* ASYNC_CLK_ENA_LOW_EINT1 */
4874#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT1_WIDTH 1 /* ASYNC_CLK_ENA_LOW_EINT1 */
4875#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1 0x0200 /* SYSCLK_ENA_LOW_EINT1 */
4876#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1_MASK 0x0200 /* SYSCLK_ENA_LOW_EINT1 */
4877#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1_SHIFT 9 /* SYSCLK_ENA_LOW_EINT1 */
4878#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT1_WIDTH 1 /* SYSCLK_ENA_LOW_EINT1 */
4879#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1 0x0100 /* ISRC1_CFG_ERR_EINT1 */
4880#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1_MASK 0x0100 /* ISRC1_CFG_ERR_EINT1 */
4881#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1_SHIFT 8 /* ISRC1_CFG_ERR_EINT1 */
4882#define ARIZONA_V2_ISRC1_CFG_ERR_EINT1_WIDTH 1 /* ISRC1_CFG_ERR_EINT1 */
4883#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1 0x0080 /* ISRC2_CFG_ERR_EINT1 */
4884#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1_MASK 0x0080 /* ISRC2_CFG_ERR_EINT1 */
4885#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1_SHIFT 7 /* ISRC2_CFG_ERR_EINT1 */
4886#define ARIZONA_V2_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* ISRC2_CFG_ERR_EINT1 */
4887#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1 0x0040 /* ISRC3_CFG_ERR_EINT1 */
4888#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1_MASK 0x0040 /* ISRC3_CFG_ERR_EINT1 */
4889#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1_SHIFT 6 /* ISRC3_CFG_ERR_EINT1 */
4890#define ARIZONA_V2_ISRC3_CFG_ERR_EINT1_WIDTH 1 /* ISRC3_CFG_ERR_EINT1 */
4798 4891
4799/* 4892/*
4800 * R3332 (0xD04) - Interrupt Status 5 4893 * R3332 (0xD04) - Interrupt Status 5
@@ -4821,6 +4914,85 @@
4821#define ARIZONA_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* FLL1_CLOCK_OK_EINT1 */ 4914#define ARIZONA_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* FLL1_CLOCK_OK_EINT1 */
4822 4915
4823/* 4916/*
4917 * R3332 (0xD05) - Interrupt Status 5 (Alternate layout)
4918 *
4919 * Alternate layout used on later devices, note only fields that have moved
4920 * are specified
4921 */
4922#define ARIZONA_V2_ASRC_CFG_ERR_EINT1 0x0008 /* ASRC_CFG_ERR_EINT1 */
4923#define ARIZONA_V2_ASRC_CFG_ERR_EINT1_MASK 0x0008 /* ASRC_CFG_ERR_EINT1 */
4924#define ARIZONA_V2_ASRC_CFG_ERR_EINT1_SHIFT 3 /* ASRC_CFG_ERR_EINT1 */
4925#define ARIZONA_V2_ASRC_CFG_ERR_EINT1_WIDTH 1 /* ASRC_CFG_ERR_EINT1 */
4926
4927/*
4928 * R3333 (0xD05) - Interrupt Status 6
4929 */
4930#define ARIZONA_DSP_SHARED_WR_COLL_EINT1 0x8000 /* DSP_SHARED_WR_COLL_EINT1 */
4931#define ARIZONA_DSP_SHARED_WR_COLL_EINT1_MASK 0x8000 /* DSP_SHARED_WR_COLL_EINT1 */
4932#define ARIZONA_DSP_SHARED_WR_COLL_EINT1_SHIFT 15 /* DSP_SHARED_WR_COLL_EINT1 */
4933#define ARIZONA_DSP_SHARED_WR_COLL_EINT1_WIDTH 1 /* DSP_SHARED_WR_COLL_EINT1 */
4934#define ARIZONA_SPK_SHUTDOWN_EINT1 0x4000 /* SPK_SHUTDOWN_EINT1 */
4935#define ARIZONA_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* SPK_SHUTDOWN_EINT1 */
4936#define ARIZONA_SPK_SHUTDOWN_EINT1_SHIFT 14 /* SPK_SHUTDOWN_EINT1 */
4937#define ARIZONA_SPK_SHUTDOWN_EINT1_WIDTH 1 /* SPK_SHUTDOWN_EINT1 */
4938#define ARIZONA_SPK1R_SHORT_EINT1 0x2000 /* SPK1R_SHORT_EINT1 */
4939#define ARIZONA_SPK1R_SHORT_EINT1_MASK 0x2000 /* SPK1R_SHORT_EINT1 */
4940#define ARIZONA_SPK1R_SHORT_EINT1_SHIFT 13 /* SPK1R_SHORT_EINT1 */
4941#define ARIZONA_SPK1R_SHORT_EINT1_WIDTH 1 /* SPK1R_SHORT_EINT1 */
4942#define ARIZONA_SPK1L_SHORT_EINT1 0x1000 /* SPK1L_SHORT_EINT1 */
4943#define ARIZONA_SPK1L_SHORT_EINT1_MASK 0x1000 /* SPK1L_SHORT_EINT1 */
4944#define ARIZONA_SPK1L_SHORT_EINT1_SHIFT 12 /* SPK1L_SHORT_EINT1 */
4945#define ARIZONA_SPK1L_SHORT_EINT1_WIDTH 1 /* SPK1L_SHORT_EINT1 */
4946#define ARIZONA_HP3R_SC_NEG_EINT1 0x0800 /* HP3R_SC_NEG_EINT1 */
4947#define ARIZONA_HP3R_SC_NEG_EINT1_MASK 0x0800 /* HP3R_SC_NEG_EINT1 */
4948#define ARIZONA_HP3R_SC_NEG_EINT1_SHIFT 11 /* HP3R_SC_NEG_EINT1 */
4949#define ARIZONA_HP3R_SC_NEG_EINT1_WIDTH 1 /* HP3R_SC_NEG_EINT1 */
4950#define ARIZONA_HP3R_SC_POS_EINT1 0x0400 /* HP3R_SC_POS_EINT1 */
4951#define ARIZONA_HP3R_SC_POS_EINT1_MASK 0x0400 /* HP3R_SC_POS_EINT1 */
4952#define ARIZONA_HP3R_SC_POS_EINT1_SHIFT 10 /* HP3R_SC_POS_EINT1 */
4953#define ARIZONA_HP3R_SC_POS_EINT1_WIDTH 1 /* HP3R_SC_POS_EINT1 */
4954#define ARIZONA_HP3L_SC_NEG_EINT1 0x0200 /* HP3L_SC_NEG_EINT1 */
4955#define ARIZONA_HP3L_SC_NEG_EINT1_MASK 0x0200 /* HP3L_SC_NEG_EINT1 */
4956#define ARIZONA_HP3L_SC_NEG_EINT1_SHIFT 9 /* HP3L_SC_NEG_EINT1 */
4957#define ARIZONA_HP3L_SC_NEG_EINT1_WIDTH 1 /* HP3L_SC_NEG_EINT1 */
4958#define ARIZONA_HP3L_SC_POS_EINT1 0x0100 /* HP3L_SC_POS_EINT1 */
4959#define ARIZONA_HP3L_SC_POS_EINT1_MASK 0x0100 /* HP3L_SC_POS_EINT1 */
4960#define ARIZONA_HP3L_SC_POS_EINT1_SHIFT 8 /* HP3L_SC_POS_EINT1 */
4961#define ARIZONA_HP3L_SC_POS_EINT1_WIDTH 1 /* HP3L_SC_POS_EINT1 */
4962#define ARIZONA_HP2R_SC_NEG_EINT1 0x0080 /* HP2R_SC_NEG_EINT1 */
4963#define ARIZONA_HP2R_SC_NEG_EINT1_MASK 0x0080 /* HP2R_SC_NEG_EINT1 */
4964#define ARIZONA_HP2R_SC_NEG_EINT1_SHIFT 7 /* HP2R_SC_NEG_EINT1 */
4965#define ARIZONA_HP2R_SC_NEG_EINT1_WIDTH 1 /* HP2R_SC_NEG_EINT1 */
4966#define ARIZONA_HP2R_SC_POS_EINT1 0x0040 /* HP2R_SC_POS_EINT1 */
4967#define ARIZONA_HP2R_SC_POS_EINT1_MASK 0x0040 /* HP2R_SC_POS_EINT1 */
4968#define ARIZONA_HP2R_SC_POS_EINT1_SHIFT 6 /* HP2R_SC_POS_EINT1 */
4969#define ARIZONA_HP2R_SC_POS_EINT1_WIDTH 1 /* HP2R_SC_POS_EINT1 */
4970#define ARIZONA_HP2L_SC_NEG_EINT1 0x0020 /* HP2L_SC_NEG_EINT1 */
4971#define ARIZONA_HP2L_SC_NEG_EINT1_MASK 0x0020 /* HP2L_SC_NEG_EINT1 */
4972#define ARIZONA_HP2L_SC_NEG_EINT1_SHIFT 5 /* HP2L_SC_NEG_EINT1 */
4973#define ARIZONA_HP2L_SC_NEG_EINT1_WIDTH 1 /* HP2L_SC_NEG_EINT1 */
4974#define ARIZONA_HP2L_SC_POS_EINT1 0x0010 /* HP2L_SC_POS_EINT1 */
4975#define ARIZONA_HP2L_SC_POS_EINT1_MASK 0x0010 /* HP2L_SC_POS_EINT1 */
4976#define ARIZONA_HP2L_SC_POS_EINT1_SHIFT 4 /* HP2L_SC_POS_EINT1 */
4977#define ARIZONA_HP2L_SC_POS_EINT1_WIDTH 1 /* HP2L_SC_POS_EINT1 */
4978#define ARIZONA_HP1R_SC_NEG_EINT1 0x0008 /* HP1R_SC_NEG_EINT1 */
4979#define ARIZONA_HP1R_SC_NEG_EINT1_MASK 0x0008 /* HP1R_SC_NEG_EINT1 */
4980#define ARIZONA_HP1R_SC_NEG_EINT1_SHIFT 3 /* HP1R_SC_NEG_EINT1 */
4981#define ARIZONA_HP1R_SC_NEG_EINT1_WIDTH 1 /* HP1R_SC_NEG_EINT1 */
4982#define ARIZONA_HP1R_SC_POS_EINT1 0x0004 /* HP1R_SC_POS_EINT1 */
4983#define ARIZONA_HP1R_SC_POS_EINT1_MASK 0x0004 /* HP1R_SC_POS_EINT1 */
4984#define ARIZONA_HP1R_SC_POS_EINT1_SHIFT 2 /* HP1R_SC_POS_EINT1 */
4985#define ARIZONA_HP1R_SC_POS_EINT1_WIDTH 1 /* HP1R_SC_POS_EINT1 */
4986#define ARIZONA_HP1L_SC_NEG_EINT1 0x0002 /* HP1L_SC_NEG_EINT1 */
4987#define ARIZONA_HP1L_SC_NEG_EINT1_MASK 0x0002 /* HP1L_SC_NEG_EINT1 */
4988#define ARIZONA_HP1L_SC_NEG_EINT1_SHIFT 1 /* HP1L_SC_NEG_EINT1 */
4989#define ARIZONA_HP1L_SC_NEG_EINT1_WIDTH 1 /* HP1L_SC_NEG_EINT1 */
4990#define ARIZONA_HP1L_SC_POS_EINT1 0x0001 /* HP1L_SC_POS_EINT1 */
4991#define ARIZONA_HP1L_SC_POS_EINT1_MASK 0x0001 /* HP1L_SC_POS_EINT1 */
4992#define ARIZONA_HP1L_SC_POS_EINT1_SHIFT 0 /* HP1L_SC_POS_EINT1 */
4993#define ARIZONA_HP1L_SC_POS_EINT1_WIDTH 1 /* HP1L_SC_POS_EINT1 */
4994
4995/*
4824 * R3336 (0xD08) - Interrupt Status 1 Mask 4996 * R3336 (0xD08) - Interrupt Status 1 Mask
4825 */ 4997 */
4826#define ARIZONA_IM_GP4_EINT1 0x0008 /* IM_GP4_EINT1 */ 4998#define ARIZONA_IM_GP4_EINT1 0x0008 /* IM_GP4_EINT1 */
@@ -4859,14 +5031,14 @@
4859/* 5031/*
4860 * R3338 (0xD0A) - Interrupt Status 3 Mask 5032 * R3338 (0xD0A) - Interrupt Status 3 Mask
4861 */ 5033 */
4862#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5034#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4863#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1_MASK 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5035#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1_MASK 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4864#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1_SHIFT 15 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5036#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1_SHIFT 15 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4865#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT1_WIDTH 1 /* IM_SPK_SHUTDOWN_WARN_EINT1 */ 5037#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT1_WIDTH 1 /* IM_SPK_OVERHEAT_WARN_EINT1 */
4866#define ARIZONA_IM_SPK_SHUTDOWN_EINT1 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */ 5038#define ARIZONA_IM_SPK_OVERHEAT_EINT1 0x4000 /* IM_SPK_OVERHEAT_EINT1 */
4867#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */ 5039#define ARIZONA_IM_SPK_OVERHEAT_EINT1_MASK 0x4000 /* IM_SPK_OVERHEAT_EINT1 */
4868#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT1 */ 5040#define ARIZONA_IM_SPK_OVERHEAT_EINT1_SHIFT 14 /* IM_SPK_OVERHEAT_EINT1 */
4869#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT1 */ 5041#define ARIZONA_IM_SPK_OVERHEAT_EINT1_WIDTH 1 /* IM_SPK_OVERHEAT_EINT1 */
4870#define ARIZONA_IM_HPDET_EINT1 0x2000 /* IM_HPDET_EINT1 */ 5042#define ARIZONA_IM_HPDET_EINT1 0x2000 /* IM_HPDET_EINT1 */
4871#define ARIZONA_IM_HPDET_EINT1_MASK 0x2000 /* IM_HPDET_EINT1 */ 5043#define ARIZONA_IM_HPDET_EINT1_MASK 0x2000 /* IM_HPDET_EINT1 */
4872#define ARIZONA_IM_HPDET_EINT1_SHIFT 13 /* IM_HPDET_EINT1 */ 5044#define ARIZONA_IM_HPDET_EINT1_SHIFT 13 /* IM_HPDET_EINT1 */
@@ -4963,6 +5135,77 @@
4963#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT1 */ 5135#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT1 */
4964#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT1 */ 5136#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT1 */
4965#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT1 */ 5137#define ARIZONA_IM_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT1 */
5138#define ARIZONA_IM_HP3R_DONE_EINT1 0x0020 /* IM_HP3R_DONE_EINT1 */
5139#define ARIZONA_IM_HP3R_DONE_EINT1_MASK 0x0020 /* IM_HP3R_DONE_EINT1 */
5140#define ARIZONA_IM_HP3R_DONE_EINT1_SHIFT 5 /* IM_HP3R_DONE_EINT1 */
5141#define ARIZONA_IM_HP3R_DONE_EINT1_WIDTH 1 /* IM_HP3R_DONE_EINT1 */
5142#define ARIZONA_IM_HP3L_DONE_EINT1 0x0010 /* IM_HP3L_DONE_EINT1 */
5143#define ARIZONA_IM_HP3L_DONE_EINT1_MASK 0x0010 /* IM_HP3L_DONE_EINT1 */
5144#define ARIZONA_IM_HP3L_DONE_EINT1_SHIFT 4 /* IM_HP3L_DONE_EINT1 */
5145#define ARIZONA_IM_HP3L_DONE_EINT1_WIDTH 1 /* IM_HP3L_DONE_EINT1 */
5146#define ARIZONA_IM_HP2R_DONE_EINT1 0x0008 /* IM_HP2R_DONE_EINT1 */
5147#define ARIZONA_IM_HP2R_DONE_EINT1_MASK 0x0008 /* IM_HP2R_DONE_EINT1 */
5148#define ARIZONA_IM_HP2R_DONE_EINT1_SHIFT 3 /* IM_HP2R_DONE_EINT1 */
5149#define ARIZONA_IM_HP2R_DONE_EINT1_WIDTH 1 /* IM_HP2R_DONE_EINT1 */
5150#define ARIZONA_IM_HP2L_DONE_EINT1 0x0004 /* IM_HP2L_DONE_EINT1 */
5151#define ARIZONA_IM_HP2L_DONE_EINT1_MASK 0x0004 /* IM_HP2L_DONE_EINT1 */
5152#define ARIZONA_IM_HP2L_DONE_EINT1_SHIFT 2 /* IM_HP2L_DONE_EINT1 */
5153#define ARIZONA_IM_HP2L_DONE_EINT1_WIDTH 1 /* IM_HP2L_DONE_EINT1 */
5154#define ARIZONA_IM_HP1R_DONE_EINT1 0x0002 /* IM_HP1R_DONE_EINT1 */
5155#define ARIZONA_IM_HP1R_DONE_EINT1_MASK 0x0002 /* IM_HP1R_DONE_EINT1 */
5156#define ARIZONA_IM_HP1R_DONE_EINT1_SHIFT 1 /* IM_HP1R_DONE_EINT1 */
5157#define ARIZONA_IM_HP1R_DONE_EINT1_WIDTH 1 /* IM_HP1R_DONE_EINT1 */
5158#define ARIZONA_IM_HP1L_DONE_EINT1 0x0001 /* IM_HP1L_DONE_EINT1 */
5159#define ARIZONA_IM_HP1L_DONE_EINT1_MASK 0x0001 /* IM_HP1L_DONE_EINT1 */
5160#define ARIZONA_IM_HP1L_DONE_EINT1_SHIFT 0 /* IM_HP1L_DONE_EINT1 */
5161#define ARIZONA_IM_HP1L_DONE_EINT1_WIDTH 1 /* IM_HP1L_DONE_EINT1 */
5162
5163/*
5164 * R3339 (0xD0B) - Interrupt Status 4 Mask (Alternate layout)
5165 *
5166 * Alternate layout used on later devices, note only fields that have moved
5167 * are specified
5168 */
5169#define ARIZONA_V2_IM_AIF3_ERR_EINT1 0x8000 /* IM_AIF3_ERR_EINT1 */
5170#define ARIZONA_V2_IM_AIF3_ERR_EINT1_MASK 0x8000 /* IM_AIF3_ERR_EINT1 */
5171#define ARIZONA_V2_IM_AIF3_ERR_EINT1_SHIFT 15 /* IM_AIF3_ERR_EINT1 */
5172#define ARIZONA_V2_IM_AIF3_ERR_EINT1_WIDTH 1 /* IM_AIF3_ERR_EINT1 */
5173#define ARIZONA_V2_IM_AIF2_ERR_EINT1 0x4000 /* IM_AIF2_ERR_EINT1 */
5174#define ARIZONA_V2_IM_AIF2_ERR_EINT1_MASK 0x4000 /* IM_AIF2_ERR_EINT1 */
5175#define ARIZONA_V2_IM_AIF2_ERR_EINT1_SHIFT 14 /* IM_AIF2_ERR_EINT1 */
5176#define ARIZONA_V2_IM_AIF2_ERR_EINT1_WIDTH 1 /* IM_AIF2_ERR_EINT1 */
5177#define ARIZONA_V2_IM_AIF1_ERR_EINT1 0x2000 /* IM_AIF1_ERR_EINT1 */
5178#define ARIZONA_V2_IM_AIF1_ERR_EINT1_MASK 0x2000 /* IM_AIF1_ERR_EINT1 */
5179#define ARIZONA_V2_IM_AIF1_ERR_EINT1_SHIFT 13 /* IM_AIF1_ERR_EINT1 */
5180#define ARIZONA_V2_IM_AIF1_ERR_EINT1_WIDTH 1 /* IM_AIF1_ERR_EINT1 */
5181#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1 0x1000 /* IM_CTRLIF_ERR_EINT1 */
5182#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1_MASK 0x1000 /* IM_CTRLIF_ERR_EINT1 */
5183#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1_SHIFT 12 /* IM_CTRLIF_ERR_EINT1 */
5184#define ARIZONA_V2_IM_CTRLIF_ERR_EINT1_WIDTH 1 /* IM_CTRLIF_ERR_EINT1 */
5185#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5186#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1_MASK 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5187#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1_SHIFT 11 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5188#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT1_WIDTH 1 /* IM_MIXER_DROPPED_SAMPLE_EINT1 */
5189#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5190#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1_MASK 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5191#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1_SHIFT 10 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5192#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT1_WIDTH 1 /* IM_ASYNC_CLK_ENA_LOW_EINT1 */
5193#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1 0x0200 /* IM_SYSCLK_ENA_LOW_EINT1 */
5194#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1_MASK 0x0200 /* IM_SYSCLK_ENA_LOW_EINT1 */
5195#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1_SHIFT 9 /* IM_SYSCLK_ENA_LOW_EINT1 */
5196#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT1_WIDTH 1 /* IM_SYSCLK_ENA_LOW_EINT1 */
5197#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1 0x0100 /* IM_ISRC1_CFG_ERR_EINT1 */
5198#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1_MASK 0x0100 /* IM_ISRC1_CFG_ERR_EINT1 */
5199#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1_SHIFT 8 /* IM_ISRC1_CFG_ERR_EINT1 */
5200#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC1_CFG_ERR_EINT1 */
5201#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1 0x0080 /* IM_ISRC2_CFG_ERR_EINT1 */
5202#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1_MASK 0x0080 /* IM_ISRC2_CFG_ERR_EINT1 */
5203#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1_SHIFT 7 /* IM_ISRC2_CFG_ERR_EINT1 */
5204#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT1 */
5205#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1 0x0040 /* IM_ISRC3_CFG_ERR_EINT1 */
5206#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1_MASK 0x0040 /* IM_ISRC3_CFG_ERR_EINT1 */
5207#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1_SHIFT 6 /* IM_ISRC3_CFG_ERR_EINT1 */
5208#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT1_WIDTH 1 /* IM_ISRC3_CFG_ERR_EINT1 */
4966 5209
4967/* 5210/*
4968 * R3340 (0xD0C) - Interrupt Status 5 Mask 5211 * R3340 (0xD0C) - Interrupt Status 5 Mask
@@ -4989,6 +5232,85 @@
4989#define ARIZONA_IM_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT1 */ 5232#define ARIZONA_IM_FLL1_CLOCK_OK_EINT1_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT1 */
4990 5233
4991/* 5234/*
5235 * R3340 (0xD0C) - Interrupt Status 5 Mask (Alternate layout)
5236 *
5237 * Alternate layout used on later devices, note only fields that have moved
5238 * are specified
5239 */
5240#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1 0x0008 /* IM_ASRC_CFG_ERR_EINT1 */
5241#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1_MASK 0x0008 /* IM_ASRC_CFG_ERR_EINT1 */
5242#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1_SHIFT 3 /* IM_ASRC_CFG_ERR_EINT1 */
5243#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT1_WIDTH 1 /* IM_ASRC_CFG_ERR_EINT1 */
5244
5245/*
5246 * R3341 (0xD0D) - Interrupt Status 6 Mask
5247 */
5248#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5249#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1_MASK 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5250#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1_SHIFT 15 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5251#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT1_WIDTH 1 /* IM_DSP_SHARED_WR_COLL_EINT1 */
5252#define ARIZONA_IM_SPK_SHUTDOWN_EINT1 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */
5253#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT1 */
5254#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT1 */
5255#define ARIZONA_IM_SPK_SHUTDOWN_EINT1_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT1 */
5256#define ARIZONA_IM_SPK1R_SHORT_EINT1 0x2000 /* IM_SPK1R_SHORT_EINT1 */
5257#define ARIZONA_IM_SPK1R_SHORT_EINT1_MASK 0x2000 /* IM_SPK1R_SHORT_EINT1 */
5258#define ARIZONA_IM_SPK1R_SHORT_EINT1_SHIFT 13 /* IM_SPK1R_SHORT_EINT1 */
5259#define ARIZONA_IM_SPK1R_SHORT_EINT1_WIDTH 1 /* IM_SPK1R_SHORT_EINT1 */
5260#define ARIZONA_IM_SPK1L_SHORT_EINT1 0x1000 /* IM_SPK1L_SHORT_EINT1 */
5261#define ARIZONA_IM_SPK1L_SHORT_EINT1_MASK 0x1000 /* IM_SPK1L_SHORT_EINT1 */
5262#define ARIZONA_IM_SPK1L_SHORT_EINT1_SHIFT 12 /* IM_SPK1L_SHORT_EINT1 */
5263#define ARIZONA_IM_SPK1L_SHORT_EINT1_WIDTH 1 /* IM_SPK1L_SHORT_EINT1 */
5264#define ARIZONA_IM_HP3R_SC_NEG_EINT1 0x0800 /* IM_HP3R_SC_NEG_EINT1 */
5265#define ARIZONA_IM_HP3R_SC_NEG_EINT1_MASK 0x0800 /* IM_HP3R_SC_NEG_EINT1 */
5266#define ARIZONA_IM_HP3R_SC_NEG_EINT1_SHIFT 11 /* IM_HP3R_SC_NEG_EINT1 */
5267#define ARIZONA_IM_HP3R_SC_NEG_EINT1_WIDTH 1 /* IM_HP3R_SC_NEG_EINT1 */
5268#define ARIZONA_IM_HP3R_SC_POS_EINT1 0x0400 /* IM_HP3R_SC_POS_EINT1 */
5269#define ARIZONA_IM_HP3R_SC_POS_EINT1_MASK 0x0400 /* IM_HP3R_SC_POS_EINT1 */
5270#define ARIZONA_IM_HP3R_SC_POS_EINT1_SHIFT 10 /* IM_HP3R_SC_POS_EINT1 */
5271#define ARIZONA_IM_HP3R_SC_POS_EINT1_WIDTH 1 /* IM_HP3R_SC_POS_EINT1 */
5272#define ARIZONA_IM_HP3L_SC_NEG_EINT1 0x0200 /* IM_HP3L_SC_NEG_EINT1 */
5273#define ARIZONA_IM_HP3L_SC_NEG_EINT1_MASK 0x0200 /* IM_HP3L_SC_NEG_EINT1 */
5274#define ARIZONA_IM_HP3L_SC_NEG_EINT1_SHIFT 9 /* IM_HP3L_SC_NEG_EINT1 */
5275#define ARIZONA_IM_HP3L_SC_NEG_EINT1_WIDTH 1 /* IM_HP3L_SC_NEG_EINT1 */
5276#define ARIZONA_IM_HP3L_SC_POS_EINT1 0x0100 /* IM_HP3L_SC_POS_EINT1 */
5277#define ARIZONA_IM_HP3L_SC_POS_EINT1_MASK 0x0100 /* IM_HP3L_SC_POS_EINT1 */
5278#define ARIZONA_IM_HP3L_SC_POS_EINT1_SHIFT 8 /* IM_HP3L_SC_POS_EINT1 */
5279#define ARIZONA_IM_HP3L_SC_POS_EINT1_WIDTH 1 /* IM_HP3L_SC_POS_EINT1 */
5280#define ARIZONA_IM_HP2R_SC_NEG_EINT1 0x0080 /* IM_HP2R_SC_NEG_EINT1 */
5281#define ARIZONA_IM_HP2R_SC_NEG_EINT1_MASK 0x0080 /* IM_HP2R_SC_NEG_EINT1 */
5282#define ARIZONA_IM_HP2R_SC_NEG_EINT1_SHIFT 7 /* IM_HP2R_SC_NEG_EINT1 */
5283#define ARIZONA_IM_HP2R_SC_NEG_EINT1_WIDTH 1 /* IM_HP2R_SC_NEG_EINT1 */
5284#define ARIZONA_IM_HP2R_SC_POS_EINT1 0x0040 /* IM_HP2R_SC_POS_EINT1 */
5285#define ARIZONA_IM_HP2R_SC_POS_EINT1_MASK 0x0040 /* IM_HP2R_SC_POS_EINT1 */
5286#define ARIZONA_IM_HP2R_SC_POS_EINT1_SHIFT 6 /* IM_HP2R_SC_POS_EINT1 */
5287#define ARIZONA_IM_HP2R_SC_POS_EINT1_WIDTH 1 /* IM_HP2R_SC_POS_EINT1 */
5288#define ARIZONA_IM_HP2L_SC_NEG_EINT1 0x0020 /* IM_HP2L_SC_NEG_EINT1 */
5289#define ARIZONA_IM_HP2L_SC_NEG_EINT1_MASK 0x0020 /* IM_HP2L_SC_NEG_EINT1 */
5290#define ARIZONA_IM_HP2L_SC_NEG_EINT1_SHIFT 5 /* IM_HP2L_SC_NEG_EINT1 */
5291#define ARIZONA_IM_HP2L_SC_NEG_EINT1_WIDTH 1 /* IM_HP2L_SC_NEG_EINT1 */
5292#define ARIZONA_IM_HP2L_SC_POS_EINT1 0x0010 /* IM_HP2L_SC_POS_EINT1 */
5293#define ARIZONA_IM_HP2L_SC_POS_EINT1_MASK 0x0010 /* IM_HP2L_SC_POS_EINT1 */
5294#define ARIZONA_IM_HP2L_SC_POS_EINT1_SHIFT 4 /* IM_HP2L_SC_POS_EINT1 */
5295#define ARIZONA_IM_HP2L_SC_POS_EINT1_WIDTH 1 /* IM_HP2L_SC_POS_EINT1 */
5296#define ARIZONA_IM_HP1R_SC_NEG_EINT1 0x0008 /* IM_HP1R_SC_NEG_EINT1 */
5297#define ARIZONA_IM_HP1R_SC_NEG_EINT1_MASK 0x0008 /* IM_HP1R_SC_NEG_EINT1 */
5298#define ARIZONA_IM_HP1R_SC_NEG_EINT1_SHIFT 3 /* IM_HP1R_SC_NEG_EINT1 */
5299#define ARIZONA_IM_HP1R_SC_NEG_EINT1_WIDTH 1 /* IM_HP1R_SC_NEG_EINT1 */
5300#define ARIZONA_IM_HP1R_SC_POS_EINT1 0x0004 /* IM_HP1R_SC_POS_EINT1 */
5301#define ARIZONA_IM_HP1R_SC_POS_EINT1_MASK 0x0004 /* IM_HP1R_SC_POS_EINT1 */
5302#define ARIZONA_IM_HP1R_SC_POS_EINT1_SHIFT 2 /* IM_HP1R_SC_POS_EINT1 */
5303#define ARIZONA_IM_HP1R_SC_POS_EINT1_WIDTH 1 /* IM_HP1R_SC_POS_EINT1 */
5304#define ARIZONA_IM_HP1L_SC_NEG_EINT1 0x0002 /* IM_HP1L_SC_NEG_EINT1 */
5305#define ARIZONA_IM_HP1L_SC_NEG_EINT1_MASK 0x0002 /* IM_HP1L_SC_NEG_EINT1 */
5306#define ARIZONA_IM_HP1L_SC_NEG_EINT1_SHIFT 1 /* IM_HP1L_SC_NEG_EINT1 */
5307#define ARIZONA_IM_HP1L_SC_NEG_EINT1_WIDTH 1 /* IM_HP1L_SC_NEG_EINT1 */
5308#define ARIZONA_IM_HP1L_SC_POS_EINT1 0x0001 /* IM_HP1L_SC_POS_EINT1 */
5309#define ARIZONA_IM_HP1L_SC_POS_EINT1_MASK 0x0001 /* IM_HP1L_SC_POS_EINT1 */
5310#define ARIZONA_IM_HP1L_SC_POS_EINT1_SHIFT 0 /* IM_HP1L_SC_POS_EINT1 */
5311#define ARIZONA_IM_HP1L_SC_POS_EINT1_WIDTH 1 /* IM_HP1L_SC_POS_EINT1 */
5312
5313/*
4992 * R3343 (0xD0F) - Interrupt Control 5314 * R3343 (0xD0F) - Interrupt Control
4993 */ 5315 */
4994#define ARIZONA_IM_IRQ1 0x0001 /* IM_IRQ1 */ 5316#define ARIZONA_IM_IRQ1 0x0001 /* IM_IRQ1 */
@@ -5035,14 +5357,14 @@
5035/* 5357/*
5036 * R3346 (0xD12) - IRQ2 Status 3 5358 * R3346 (0xD12) - IRQ2 Status 3
5037 */ 5359 */
5038#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2 0x8000 /* SPK_SHUTDOWN_WARN_EINT2 */ 5360#define ARIZONA_SPK_OVERHEAT_WARN_EINT2 0x8000 /* SPK_OVERHEAT_WARN_EINT2 */
5039#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2_MASK 0x8000 /* SPK_SHUTDOWN_WARN_EINT2 */ 5361#define ARIZONA_SPK_OVERHEAT_WARN_EINT2_MASK 0x8000 /* SPK_OVERHEAT_WARN_EINT2 */
5040#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2_SHIFT 15 /* SPK_SHUTDOWN_WARN_EINT2 */ 5362#define ARIZONA_SPK_OVERHEAT_WARN_EINT2_SHIFT 15 /* SPK_OVERHEAT_WARN_EINT2 */
5041#define ARIZONA_SPK_SHUTDOWN_WARN_EINT2_WIDTH 1 /* SPK_SHUTDOWN_WARN_EINT2 */ 5363#define ARIZONA_SPK_OVERHEAT_WARN_EINT2_WIDTH 1 /* SPK_OVERHEAT_WARN_EINT2 */
5042#define ARIZONA_SPK_SHUTDOWN_EINT2 0x4000 /* SPK_SHUTDOWN_EINT2 */ 5364#define ARIZONA_SPK_OVERHEAT_EINT2 0x4000 /* SPK_OVERHEAT_EINT2 */
5043#define ARIZONA_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* SPK_SHUTDOWN_EINT2 */ 5365#define ARIZONA_SPK_OVERHEAT_EINT2_MASK 0x4000 /* SPK_OVERHEAT_EINT2 */
5044#define ARIZONA_SPK_SHUTDOWN_EINT2_SHIFT 14 /* SPK_SHUTDOWN_EINT2 */ 5366#define ARIZONA_SPK_OVERHEAT_EINT2_SHIFT 14 /* SPK_OVERHEAT_EINT2 */
5045#define ARIZONA_SPK_SHUTDOWN_EINT2_WIDTH 1 /* SPK_SHUTDOWN_EINT2 */ 5367#define ARIZONA_SPK_OVERHEAT_EINT2_WIDTH 1 /* SPK_OVERHEAT_EINT2 */
5046#define ARIZONA_HPDET_EINT2 0x2000 /* HPDET_EINT2 */ 5368#define ARIZONA_HPDET_EINT2 0x2000 /* HPDET_EINT2 */
5047#define ARIZONA_HPDET_EINT2_MASK 0x2000 /* HPDET_EINT2 */ 5369#define ARIZONA_HPDET_EINT2_MASK 0x2000 /* HPDET_EINT2 */
5048#define ARIZONA_HPDET_EINT2_SHIFT 13 /* HPDET_EINT2 */ 5370#define ARIZONA_HPDET_EINT2_SHIFT 13 /* HPDET_EINT2 */
@@ -5139,6 +5461,77 @@
5139#define ARIZONA_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* ISRC2_CFG_ERR_EINT2 */ 5461#define ARIZONA_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* ISRC2_CFG_ERR_EINT2 */
5140#define ARIZONA_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* ISRC2_CFG_ERR_EINT2 */ 5462#define ARIZONA_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* ISRC2_CFG_ERR_EINT2 */
5141#define ARIZONA_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* ISRC2_CFG_ERR_EINT2 */ 5463#define ARIZONA_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* ISRC2_CFG_ERR_EINT2 */
5464#define ARIZONA_HP3R_DONE_EINT2 0x0020 /* HP3R_DONE_EINT2 */
5465#define ARIZONA_HP3R_DONE_EINT2_MASK 0x0020 /* HP3R_DONE_EINT2 */
5466#define ARIZONA_HP3R_DONE_EINT2_SHIFT 5 /* HP3R_DONE_EINT2 */
5467#define ARIZONA_HP3R_DONE_EINT2_WIDTH 1 /* HP3R_DONE_EINT2 */
5468#define ARIZONA_HP3L_DONE_EINT2 0x0010 /* HP3L_DONE_EINT2 */
5469#define ARIZONA_HP3L_DONE_EINT2_MASK 0x0010 /* HP3L_DONE_EINT2 */
5470#define ARIZONA_HP3L_DONE_EINT2_SHIFT 4 /* HP3L_DONE_EINT2 */
5471#define ARIZONA_HP3L_DONE_EINT2_WIDTH 1 /* HP3L_DONE_EINT2 */
5472#define ARIZONA_HP2R_DONE_EINT2 0x0008 /* HP2R_DONE_EINT2 */
5473#define ARIZONA_HP2R_DONE_EINT2_MASK 0x0008 /* HP2R_DONE_EINT2 */
5474#define ARIZONA_HP2R_DONE_EINT2_SHIFT 3 /* HP2R_DONE_EINT2 */
5475#define ARIZONA_HP2R_DONE_EINT2_WIDTH 1 /* HP2R_DONE_EINT2 */
5476#define ARIZONA_HP2L_DONE_EINT2 0x0004 /* HP2L_DONE_EINT2 */
5477#define ARIZONA_HP2L_DONE_EINT2_MASK 0x0004 /* HP2L_DONE_EINT2 */
5478#define ARIZONA_HP2L_DONE_EINT2_SHIFT 2 /* HP2L_DONE_EINT2 */
5479#define ARIZONA_HP2L_DONE_EINT2_WIDTH 1 /* HP2L_DONE_EINT2 */
5480#define ARIZONA_HP1R_DONE_EINT2 0x0002 /* HP1R_DONE_EINT2 */
5481#define ARIZONA_HP1R_DONE_EINT2_MASK 0x0002 /* HP1R_DONE_EINT2 */
5482#define ARIZONA_HP1R_DONE_EINT2_SHIFT 1 /* HP1R_DONE_EINT2 */
5483#define ARIZONA_HP1R_DONE_EINT2_WIDTH 1 /* HP1R_DONE_EINT2 */
5484#define ARIZONA_HP1L_DONE_EINT2 0x0001 /* HP1L_DONE_EINT2 */
5485#define ARIZONA_HP1L_DONE_EINT2_MASK 0x0001 /* HP1L_DONE_EINT2 */
5486#define ARIZONA_HP1L_DONE_EINT2_SHIFT 0 /* HP1L_DONE_EINT2 */
5487#define ARIZONA_HP1L_DONE_EINT2_WIDTH 1 /* HP1L_DONE_EINT2 */
5488
5489/*
5490 * R3347 (0xD13) - IRQ2 Status 4 (Alternate layout)
5491 *
5492 * Alternate layout used on later devices, note only fields that have moved
5493 * are specified
5494 */
5495#define ARIZONA_V2_AIF3_ERR_EINT2 0x8000 /* AIF3_ERR_EINT2 */
5496#define ARIZONA_V2_AIF3_ERR_EINT2_MASK 0x8000 /* AIF3_ERR_EINT2 */
5497#define ARIZONA_V2_AIF3_ERR_EINT2_SHIFT 15 /* AIF3_ERR_EINT2 */
5498#define ARIZONA_V2_AIF3_ERR_EINT2_WIDTH 1 /* AIF3_ERR_EINT2 */
5499#define ARIZONA_V2_AIF2_ERR_EINT2 0x4000 /* AIF2_ERR_EINT2 */
5500#define ARIZONA_V2_AIF2_ERR_EINT2_MASK 0x4000 /* AIF2_ERR_EINT2 */
5501#define ARIZONA_V2_AIF2_ERR_EINT2_SHIFT 14 /* AIF2_ERR_EINT2 */
5502#define ARIZONA_V2_AIF2_ERR_EINT2_WIDTH 1 /* AIF2_ERR_EINT2 */
5503#define ARIZONA_V2_AIF1_ERR_EINT2 0x2000 /* AIF1_ERR_EINT2 */
5504#define ARIZONA_V2_AIF1_ERR_EINT2_MASK 0x2000 /* AIF1_ERR_EINT2 */
5505#define ARIZONA_V2_AIF1_ERR_EINT2_SHIFT 13 /* AIF1_ERR_EINT2 */
5506#define ARIZONA_V2_AIF1_ERR_EINT2_WIDTH 1 /* AIF1_ERR_EINT2 */
5507#define ARIZONA_V2_CTRLIF_ERR_EINT2 0x1000 /* CTRLIF_ERR_EINT2 */
5508#define ARIZONA_V2_CTRLIF_ERR_EINT2_MASK 0x1000 /* CTRLIF_ERR_EINT2 */
5509#define ARIZONA_V2_CTRLIF_ERR_EINT2_SHIFT 12 /* CTRLIF_ERR_EINT2 */
5510#define ARIZONA_V2_CTRLIF_ERR_EINT2_WIDTH 1 /* CTRLIF_ERR_EINT2 */
5511#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2 0x0800 /* MIXER_DROPPED_SAMPLE_EINT2 */
5512#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2_MASK 0x0800 /* MIXER_DROPPED_SAMPLE_EINT2 */
5513#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2_SHIFT 11 /* MIXER_DROPPED_SAMPLE_EINT2 */
5514#define ARIZONA_V2_MIXER_DROPPED_SAMPLE_EINT2_WIDTH 1 /* MIXER_DROPPED_SAMPLE_EINT2 */
5515#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2 0x0400 /* ASYNC_CLK_ENA_LOW_EINT2 */
5516#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2_MASK 0x0400 /* ASYNC_CLK_ENA_LOW_EINT2 */
5517#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2_SHIFT 10 /* ASYNC_CLK_ENA_LOW_EINT2 */
5518#define ARIZONA_V2_ASYNC_CLK_ENA_LOW_EINT2_WIDTH 1 /* ASYNC_CLK_ENA_LOW_EINT2 */
5519#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2 0x0200 /* SYSCLK_ENA_LOW_EINT2 */
5520#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2_MASK 0x0200 /* SYSCLK_ENA_LOW_EINT2 */
5521#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2_SHIFT 9 /* SYSCLK_ENA_LOW_EINT2 */
5522#define ARIZONA_V2_SYSCLK_ENA_LOW_EINT2_WIDTH 1 /* SYSCLK_ENA_LOW_EINT2 */
5523#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2 0x0100 /* ISRC1_CFG_ERR_EINT2 */
5524#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2_MASK 0x0100 /* ISRC1_CFG_ERR_EINT2 */
5525#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2_SHIFT 8 /* ISRC1_CFG_ERR_EINT2 */
5526#define ARIZONA_V2_ISRC1_CFG_ERR_EINT2_WIDTH 1 /* ISRC1_CFG_ERR_EINT2 */
5527#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2 0x0080 /* ISRC2_CFG_ERR_EINT2 */
5528#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2_MASK 0x0080 /* ISRC2_CFG_ERR_EINT2 */
5529#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2_SHIFT 7 /* ISRC2_CFG_ERR_EINT2 */
5530#define ARIZONA_V2_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* ISRC2_CFG_ERR_EINT2 */
5531#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2 0x0040 /* ISRC3_CFG_ERR_EINT2 */
5532#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2_MASK 0x0040 /* ISRC3_CFG_ERR_EINT2 */
5533#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2_SHIFT 6 /* ISRC3_CFG_ERR_EINT2 */
5534#define ARIZONA_V2_ISRC3_CFG_ERR_EINT2_WIDTH 1 /* ISRC3_CFG_ERR_EINT2 */
5142 5535
5143/* 5536/*
5144 * R3348 (0xD14) - IRQ2 Status 5 5537 * R3348 (0xD14) - IRQ2 Status 5
@@ -5165,6 +5558,85 @@
5165#define ARIZONA_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* FLL1_CLOCK_OK_EINT2 */ 5558#define ARIZONA_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* FLL1_CLOCK_OK_EINT2 */
5166 5559
5167/* 5560/*
5561 * R3348 (0xD14) - IRQ2 Status 5 (Alternate layout)
5562 *
5563 * Alternate layout used on later devices, note only fields that have moved
5564 * are specified
5565 */
5566#define ARIZONA_V2_ASRC_CFG_ERR_EINT2 0x0008 /* ASRC_CFG_ERR_EINT2 */
5567#define ARIZONA_V2_ASRC_CFG_ERR_EINT2_MASK 0x0008 /* ASRC_CFG_ERR_EINT2 */
5568#define ARIZONA_V2_ASRC_CFG_ERR_EINT2_SHIFT 3 /* ASRC_CFG_ERR_EINT2 */
5569#define ARIZONA_V2_ASRC_CFG_ERR_EINT2_WIDTH 1 /* ASRC_CFG_ERR_EINT2 */
5570
5571/*
5572 * R3349 (0xD15) - IRQ2 Status 6
5573 */
5574#define ARIZONA_DSP_SHARED_WR_COLL_EINT2 0x8000 /* DSP_SHARED_WR_COLL_EINT2 */
5575#define ARIZONA_DSP_SHARED_WR_COLL_EINT2_MASK 0x8000 /* DSP_SHARED_WR_COLL_EINT2 */
5576#define ARIZONA_DSP_SHARED_WR_COLL_EINT2_SHIFT 15 /* DSP_SHARED_WR_COLL_EINT2 */
5577#define ARIZONA_DSP_SHARED_WR_COLL_EINT2_WIDTH 1 /* DSP_SHARED_WR_COLL_EINT2 */
5578#define ARIZONA_SPK_SHUTDOWN_EINT2 0x4000 /* SPK_SHUTDOWN_EINT2 */
5579#define ARIZONA_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* SPK_SHUTDOWN_EINT2 */
5580#define ARIZONA_SPK_SHUTDOWN_EINT2_SHIFT 14 /* SPK_SHUTDOWN_EINT2 */
5581#define ARIZONA_SPK_SHUTDOWN_EINT2_WIDTH 1 /* SPK_SHUTDOWN_EINT2 */
5582#define ARIZONA_SPK1R_SHORT_EINT2 0x2000 /* SPK1R_SHORT_EINT2 */
5583#define ARIZONA_SPK1R_SHORT_EINT2_MASK 0x2000 /* SPK1R_SHORT_EINT2 */
5584#define ARIZONA_SPK1R_SHORT_EINT2_SHIFT 13 /* SPK1R_SHORT_EINT2 */
5585#define ARIZONA_SPK1R_SHORT_EINT2_WIDTH 1 /* SPK1R_SHORT_EINT2 */
5586#define ARIZONA_SPK1L_SHORT_EINT2 0x1000 /* SPK1L_SHORT_EINT2 */
5587#define ARIZONA_SPK1L_SHORT_EINT2_MASK 0x1000 /* SPK1L_SHORT_EINT2 */
5588#define ARIZONA_SPK1L_SHORT_EINT2_SHIFT 12 /* SPK1L_SHORT_EINT2 */
5589#define ARIZONA_SPK1L_SHORT_EINT2_WIDTH 1 /* SPK1L_SHORT_EINT2 */
5590#define ARIZONA_HP3R_SC_NEG_EINT2 0x0800 /* HP3R_SC_NEG_EINT2 */
5591#define ARIZONA_HP3R_SC_NEG_EINT2_MASK 0x0800 /* HP3R_SC_NEG_EINT2 */
5592#define ARIZONA_HP3R_SC_NEG_EINT2_SHIFT 11 /* HP3R_SC_NEG_EINT2 */
5593#define ARIZONA_HP3R_SC_NEG_EINT2_WIDTH 1 /* HP3R_SC_NEG_EINT2 */
5594#define ARIZONA_HP3R_SC_POS_EINT2 0x0400 /* HP3R_SC_POS_EINT2 */
5595#define ARIZONA_HP3R_SC_POS_EINT2_MASK 0x0400 /* HP3R_SC_POS_EINT2 */
5596#define ARIZONA_HP3R_SC_POS_EINT2_SHIFT 10 /* HP3R_SC_POS_EINT2 */
5597#define ARIZONA_HP3R_SC_POS_EINT2_WIDTH 1 /* HP3R_SC_POS_EINT2 */
5598#define ARIZONA_HP3L_SC_NEG_EINT2 0x0200 /* HP3L_SC_NEG_EINT2 */
5599#define ARIZONA_HP3L_SC_NEG_EINT2_MASK 0x0200 /* HP3L_SC_NEG_EINT2 */
5600#define ARIZONA_HP3L_SC_NEG_EINT2_SHIFT 9 /* HP3L_SC_NEG_EINT2 */
5601#define ARIZONA_HP3L_SC_NEG_EINT2_WIDTH 1 /* HP3L_SC_NEG_EINT2 */
5602#define ARIZONA_HP3L_SC_POS_EINT2 0x0100 /* HP3L_SC_POS_EINT2 */
5603#define ARIZONA_HP3L_SC_POS_EINT2_MASK 0x0100 /* HP3L_SC_POS_EINT2 */
5604#define ARIZONA_HP3L_SC_POS_EINT2_SHIFT 8 /* HP3L_SC_POS_EINT2 */
5605#define ARIZONA_HP3L_SC_POS_EINT2_WIDTH 1 /* HP3L_SC_POS_EINT2 */
5606#define ARIZONA_HP2R_SC_NEG_EINT2 0x0080 /* HP2R_SC_NEG_EINT2 */
5607#define ARIZONA_HP2R_SC_NEG_EINT2_MASK 0x0080 /* HP2R_SC_NEG_EINT2 */
5608#define ARIZONA_HP2R_SC_NEG_EINT2_SHIFT 7 /* HP2R_SC_NEG_EINT2 */
5609#define ARIZONA_HP2R_SC_NEG_EINT2_WIDTH 1 /* HP2R_SC_NEG_EINT2 */
5610#define ARIZONA_HP2R_SC_POS_EINT2 0x0040 /* HP2R_SC_POS_EINT2 */
5611#define ARIZONA_HP2R_SC_POS_EINT2_MASK 0x0040 /* HP2R_SC_POS_EINT2 */
5612#define ARIZONA_HP2R_SC_POS_EINT2_SHIFT 6 /* HP2R_SC_POS_EINT2 */
5613#define ARIZONA_HP2R_SC_POS_EINT2_WIDTH 1 /* HP2R_SC_POS_EINT2 */
5614#define ARIZONA_HP2L_SC_NEG_EINT2 0x0020 /* HP2L_SC_NEG_EINT2 */
5615#define ARIZONA_HP2L_SC_NEG_EINT2_MASK 0x0020 /* HP2L_SC_NEG_EINT2 */
5616#define ARIZONA_HP2L_SC_NEG_EINT2_SHIFT 5 /* HP2L_SC_NEG_EINT2 */
5617#define ARIZONA_HP2L_SC_NEG_EINT2_WIDTH 1 /* HP2L_SC_NEG_EINT2 */
5618#define ARIZONA_HP2L_SC_POS_EINT2 0x0010 /* HP2L_SC_POS_EINT2 */
5619#define ARIZONA_HP2L_SC_POS_EINT2_MASK 0x0010 /* HP2L_SC_POS_EINT2 */
5620#define ARIZONA_HP2L_SC_POS_EINT2_SHIFT 4 /* HP2L_SC_POS_EINT2 */
5621#define ARIZONA_HP2L_SC_POS_EINT2_WIDTH 1 /* HP2L_SC_POS_EINT2 */
5622#define ARIZONA_HP1R_SC_NEG_EINT2 0x0008 /* HP1R_SC_NEG_EINT2 */
5623#define ARIZONA_HP1R_SC_NEG_EINT2_MASK 0x0008 /* HP1R_SC_NEG_EINT2 */
5624#define ARIZONA_HP1R_SC_NEG_EINT2_SHIFT 3 /* HP1R_SC_NEG_EINT2 */
5625#define ARIZONA_HP1R_SC_NEG_EINT2_WIDTH 1 /* HP1R_SC_NEG_EINT2 */
5626#define ARIZONA_HP1R_SC_POS_EINT2 0x0004 /* HP1R_SC_POS_EINT2 */
5627#define ARIZONA_HP1R_SC_POS_EINT2_MASK 0x0004 /* HP1R_SC_POS_EINT2 */
5628#define ARIZONA_HP1R_SC_POS_EINT2_SHIFT 2 /* HP1R_SC_POS_EINT2 */
5629#define ARIZONA_HP1R_SC_POS_EINT2_WIDTH 1 /* HP1R_SC_POS_EINT2 */
5630#define ARIZONA_HP1L_SC_NEG_EINT2 0x0002 /* HP1L_SC_NEG_EINT2 */
5631#define ARIZONA_HP1L_SC_NEG_EINT2_MASK 0x0002 /* HP1L_SC_NEG_EINT2 */
5632#define ARIZONA_HP1L_SC_NEG_EINT2_SHIFT 1 /* HP1L_SC_NEG_EINT2 */
5633#define ARIZONA_HP1L_SC_NEG_EINT2_WIDTH 1 /* HP1L_SC_NEG_EINT2 */
5634#define ARIZONA_HP1L_SC_POS_EINT2 0x0001 /* HP1L_SC_POS_EINT2 */
5635#define ARIZONA_HP1L_SC_POS_EINT2_MASK 0x0001 /* HP1L_SC_POS_EINT2 */
5636#define ARIZONA_HP1L_SC_POS_EINT2_SHIFT 0 /* HP1L_SC_POS_EINT2 */
5637#define ARIZONA_HP1L_SC_POS_EINT2_WIDTH 1 /* HP1L_SC_POS_EINT2 */
5638
5639/*
5168 * R3352 (0xD18) - IRQ2 Status 1 Mask 5640 * R3352 (0xD18) - IRQ2 Status 1 Mask
5169 */ 5641 */
5170#define ARIZONA_IM_GP4_EINT2 0x0008 /* IM_GP4_EINT2 */ 5642#define ARIZONA_IM_GP4_EINT2 0x0008 /* IM_GP4_EINT2 */
@@ -5203,14 +5675,14 @@
5203/* 5675/*
5204 * R3354 (0xD1A) - IRQ2 Status 3 Mask 5676 * R3354 (0xD1A) - IRQ2 Status 3 Mask
5205 */ 5677 */
5206#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5678#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5207#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2_MASK 0x8000 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5679#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2_MASK 0x8000 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5208#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2_SHIFT 15 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5680#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2_SHIFT 15 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5209#define ARIZONA_IM_SPK_SHUTDOWN_WARN_EINT2_WIDTH 1 /* IM_SPK_SHUTDOWN_WARN_EINT2 */ 5681#define ARIZONA_IM_SPK_OVERHEAT_WARN_EINT2_WIDTH 1 /* IM_SPK_OVERHEAT_WARN_EINT2 */
5210#define ARIZONA_IM_SPK_SHUTDOWN_EINT2 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */ 5682#define ARIZONA_IM_SPK_OVERHEAT_EINT2 0x4000 /* IM_SPK_OVERHEAT_EINT2 */
5211#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */ 5683#define ARIZONA_IM_SPK_OVERHEAT_EINT2_MASK 0x4000 /* IM_SPK_OVERHEAT_EINT2 */
5212#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT2 */ 5684#define ARIZONA_IM_SPK_OVERHEAT_EINT2_SHIFT 14 /* IM_SPK_OVERHEAT_EINT2 */
5213#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT2 */ 5685#define ARIZONA_IM_SPK_OVERHEAT_EINT2_WIDTH 1 /* IM_SPK_OVERHEAT_EINT2 */
5214#define ARIZONA_IM_HPDET_EINT2 0x2000 /* IM_HPDET_EINT2 */ 5686#define ARIZONA_IM_HPDET_EINT2 0x2000 /* IM_HPDET_EINT2 */
5215#define ARIZONA_IM_HPDET_EINT2_MASK 0x2000 /* IM_HPDET_EINT2 */ 5687#define ARIZONA_IM_HPDET_EINT2_MASK 0x2000 /* IM_HPDET_EINT2 */
5216#define ARIZONA_IM_HPDET_EINT2_SHIFT 13 /* IM_HPDET_EINT2 */ 5688#define ARIZONA_IM_HPDET_EINT2_SHIFT 13 /* IM_HPDET_EINT2 */
@@ -5307,6 +5779,77 @@
5307#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT2 */ 5779#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_MASK 0x0040 /* IM_ISRC2_CFG_ERR_EINT2 */
5308#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT2 */ 5780#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_SHIFT 6 /* IM_ISRC2_CFG_ERR_EINT2 */
5309#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT2 */ 5781#define ARIZONA_IM_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT2 */
5782#define ARIZONA_IM_HP3R_DONE_EINT2 0x0020 /* IM_HP3R_DONE_EINT2 */
5783#define ARIZONA_IM_HP3R_DONE_EINT2_MASK 0x0020 /* IM_HP3R_DONE_EINT2 */
5784#define ARIZONA_IM_HP3R_DONE_EINT2_SHIFT 5 /* IM_HP3R_DONE_EINT2 */
5785#define ARIZONA_IM_HP3R_DONE_EINT2_WIDTH 1 /* IM_HP3R_DONE_EINT2 */
5786#define ARIZONA_IM_HP3L_DONE_EINT2 0x0010 /* IM_HP3L_DONE_EINT2 */
5787#define ARIZONA_IM_HP3L_DONE_EINT2_MASK 0x0010 /* IM_HP3L_DONE_EINT2 */
5788#define ARIZONA_IM_HP3L_DONE_EINT2_SHIFT 4 /* IM_HP3L_DONE_EINT2 */
5789#define ARIZONA_IM_HP3L_DONE_EINT2_WIDTH 1 /* IM_HP3L_DONE_EINT2 */
5790#define ARIZONA_IM_HP2R_DONE_EINT2 0x0008 /* IM_HP2R_DONE_EINT2 */
5791#define ARIZONA_IM_HP2R_DONE_EINT2_MASK 0x0008 /* IM_HP2R_DONE_EINT2 */
5792#define ARIZONA_IM_HP2R_DONE_EINT2_SHIFT 3 /* IM_HP2R_DONE_EINT2 */
5793#define ARIZONA_IM_HP2R_DONE_EINT2_WIDTH 1 /* IM_HP2R_DONE_EINT2 */
5794#define ARIZONA_IM_HP2L_DONE_EINT2 0x0004 /* IM_HP2L_DONE_EINT2 */
5795#define ARIZONA_IM_HP2L_DONE_EINT2_MASK 0x0004 /* IM_HP2L_DONE_EINT2 */
5796#define ARIZONA_IM_HP2L_DONE_EINT2_SHIFT 2 /* IM_HP2L_DONE_EINT2 */
5797#define ARIZONA_IM_HP2L_DONE_EINT2_WIDTH 1 /* IM_HP2L_DONE_EINT2 */
5798#define ARIZONA_IM_HP1R_DONE_EINT2 0x0002 /* IM_HP1R_DONE_EINT2 */
5799#define ARIZONA_IM_HP1R_DONE_EINT2_MASK 0x0002 /* IM_HP1R_DONE_EINT2 */
5800#define ARIZONA_IM_HP1R_DONE_EINT2_SHIFT 1 /* IM_HP1R_DONE_EINT2 */
5801#define ARIZONA_IM_HP1R_DONE_EINT2_WIDTH 1 /* IM_HP1R_DONE_EINT2 */
5802#define ARIZONA_IM_HP1L_DONE_EINT2 0x0001 /* IM_HP1L_DONE_EINT2 */
5803#define ARIZONA_IM_HP1L_DONE_EINT2_MASK 0x0001 /* IM_HP1L_DONE_EINT2 */
5804#define ARIZONA_IM_HP1L_DONE_EINT2_SHIFT 0 /* IM_HP1L_DONE_EINT2 */
5805#define ARIZONA_IM_HP1L_DONE_EINT2_WIDTH 1 /* IM_HP1L_DONE_EINT2 */
5806
5807/*
5808 * R3355 (0xD1B) - IRQ2 Status 4 Mask (Alternate layout)
5809 *
5810 * Alternate layout used on later devices, note only fields that have moved
5811 * are specified
5812 */
5813#define ARIZONA_V2_IM_AIF3_ERR_EINT2 0x8000 /* IM_AIF3_ERR_EINT2 */
5814#define ARIZONA_V2_IM_AIF3_ERR_EINT2_MASK 0x8000 /* IM_AIF3_ERR_EINT2 */
5815#define ARIZONA_V2_IM_AIF3_ERR_EINT2_SHIFT 15 /* IM_AIF3_ERR_EINT2 */
5816#define ARIZONA_V2_IM_AIF3_ERR_EINT2_WIDTH 1 /* IM_AIF3_ERR_EINT2 */
5817#define ARIZONA_V2_IM_AIF2_ERR_EINT2 0x4000 /* IM_AIF2_ERR_EINT2 */
5818#define ARIZONA_V2_IM_AIF2_ERR_EINT2_MASK 0x4000 /* IM_AIF2_ERR_EINT2 */
5819#define ARIZONA_V2_IM_AIF2_ERR_EINT2_SHIFT 14 /* IM_AIF2_ERR_EINT2 */
5820#define ARIZONA_V2_IM_AIF2_ERR_EINT2_WIDTH 1 /* IM_AIF2_ERR_EINT2 */
5821#define ARIZONA_V2_IM_AIF1_ERR_EINT2 0x2000 /* IM_AIF1_ERR_EINT2 */
5822#define ARIZONA_V2_IM_AIF1_ERR_EINT2_MASK 0x2000 /* IM_AIF1_ERR_EINT2 */
5823#define ARIZONA_V2_IM_AIF1_ERR_EINT2_SHIFT 13 /* IM_AIF1_ERR_EINT2 */
5824#define ARIZONA_V2_IM_AIF1_ERR_EINT2_WIDTH 1 /* IM_AIF1_ERR_EINT2 */
5825#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2 0x1000 /* IM_CTRLIF_ERR_EINT2 */
5826#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2_MASK 0x1000 /* IM_CTRLIF_ERR_EINT2 */
5827#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2_SHIFT 12 /* IM_CTRLIF_ERR_EINT2 */
5828#define ARIZONA_V2_IM_CTRLIF_ERR_EINT2_WIDTH 1 /* IM_CTRLIF_ERR_EINT2 */
5829#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5830#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2_MASK 0x0800 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5831#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2_SHIFT 11 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5832#define ARIZONA_V2_IM_MIXER_DROPPED_SAMPLE_EINT2_WIDTH 1 /* IM_MIXER_DROPPED_SAMPLE_EINT2 */
5833#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5834#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2_MASK 0x0400 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5835#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2_SHIFT 10 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5836#define ARIZONA_V2_IM_ASYNC_CLK_ENA_LOW_EINT2_WIDTH 1 /* IM_ASYNC_CLK_ENA_LOW_EINT2 */
5837#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2 0x0200 /* IM_SYSCLK_ENA_LOW_EINT2 */
5838#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2_MASK 0x0200 /* IM_SYSCLK_ENA_LOW_EINT2 */
5839#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2_SHIFT 9 /* IM_SYSCLK_ENA_LOW_EINT2 */
5840#define ARIZONA_V2_IM_SYSCLK_ENA_LOW_EINT2_WIDTH 1 /* IM_SYSCLK_ENA_LOW_EINT2 */
5841#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2 0x0100 /* IM_ISRC1_CFG_ERR_EINT2 */
5842#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2_MASK 0x0100 /* IM_ISRC1_CFG_ERR_EINT2 */
5843#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2_SHIFT 8 /* IM_ISRC1_CFG_ERR_EINT2 */
5844#define ARIZONA_V2_IM_ISRC1_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC1_CFG_ERR_EINT2 */
5845#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2 0x0080 /* IM_ISRC2_CFG_ERR_EINT2 */
5846#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2_MASK 0x0080 /* IM_ISRC2_CFG_ERR_EINT2 */
5847#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2_SHIFT 7 /* IM_ISRC2_CFG_ERR_EINT2 */
5848#define ARIZONA_V2_IM_ISRC2_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC2_CFG_ERR_EINT2 */
5849#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2 0x0040 /* IM_ISRC3_CFG_ERR_EINT2 */
5850#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2_MASK 0x0040 /* IM_ISRC3_CFG_ERR_EINT2 */
5851#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2_SHIFT 6 /* IM_ISRC3_CFG_ERR_EINT2 */
5852#define ARIZONA_V2_IM_ISRC3_CFG_ERR_EINT2_WIDTH 1 /* IM_ISRC3_CFG_ERR_EINT2 */
5310 5853
5311/* 5854/*
5312 * R3356 (0xD1C) - IRQ2 Status 5 Mask 5855 * R3356 (0xD1C) - IRQ2 Status 5 Mask
@@ -5334,6 +5877,85 @@
5334#define ARIZONA_IM_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT2 */ 5877#define ARIZONA_IM_FLL1_CLOCK_OK_EINT2_WIDTH 1 /* IM_FLL1_CLOCK_OK_EINT2 */
5335 5878
5336/* 5879/*
5880 * R3340 (0xD0C) - Interrupt Status 5 Mask (Alternate layout)
5881 *
5882 * Alternate layout used on later devices, note only fields that have moved
5883 * are specified
5884 */
5885#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2 0x0008 /* IM_ASRC_CFG_ERR_EINT2 */
5886#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2_MASK 0x0008 /* IM_ASRC_CFG_ERR_EINT2 */
5887#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2_SHIFT 3 /* IM_ASRC_CFG_ERR_EINT2 */
5888#define ARIZONA_V2_IM_ASRC_CFG_ERR_EINT2_WIDTH 1 /* IM_ASRC_CFG_ERR_EINT2 */
5889
5890/*
5891 * R3357 (0xD1D) - IRQ2 Status 6 Mask
5892 */
5893#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5894#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2_MASK 0x8000 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5895#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2_SHIFT 15 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5896#define ARIZONA_IM_DSP_SHARED_WR_COLL_EINT2_WIDTH 1 /* IM_DSP_SHARED_WR_COLL_EINT2 */
5897#define ARIZONA_IM_SPK_SHUTDOWN_EINT2 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */
5898#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_MASK 0x4000 /* IM_SPK_SHUTDOWN_EINT2 */
5899#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_SHIFT 14 /* IM_SPK_SHUTDOWN_EINT2 */
5900#define ARIZONA_IM_SPK_SHUTDOWN_EINT2_WIDTH 1 /* IM_SPK_SHUTDOWN_EINT2 */
5901#define ARIZONA_IM_SPK1R_SHORT_EINT2 0x2000 /* IM_SPK1R_SHORT_EINT2 */
5902#define ARIZONA_IM_SPK1R_SHORT_EINT2_MASK 0x2000 /* IM_SPK1R_SHORT_EINT2 */
5903#define ARIZONA_IM_SPK1R_SHORT_EINT2_SHIFT 13 /* IM_SPK1R_SHORT_EINT2 */
5904#define ARIZONA_IM_SPK1R_SHORT_EINT2_WIDTH 1 /* IM_SPK1R_SHORT_EINT2 */
5905#define ARIZONA_IM_SPK1L_SHORT_EINT2 0x1000 /* IM_SPK1L_SHORT_EINT2 */
5906#define ARIZONA_IM_SPK1L_SHORT_EINT2_MASK 0x1000 /* IM_SPK1L_SHORT_EINT2 */
5907#define ARIZONA_IM_SPK1L_SHORT_EINT2_SHIFT 12 /* IM_SPK1L_SHORT_EINT2 */
5908#define ARIZONA_IM_SPK1L_SHORT_EINT2_WIDTH 1 /* IM_SPK1L_SHORT_EINT2 */
5909#define ARIZONA_IM_HP3R_SC_NEG_EINT2 0x0800 /* IM_HP3R_SC_NEG_EINT2 */
5910#define ARIZONA_IM_HP3R_SC_NEG_EINT2_MASK 0x0800 /* IM_HP3R_SC_NEG_EINT2 */
5911#define ARIZONA_IM_HP3R_SC_NEG_EINT2_SHIFT 11 /* IM_HP3R_SC_NEG_EINT2 */
5912#define ARIZONA_IM_HP3R_SC_NEG_EINT2_WIDTH 1 /* IM_HP3R_SC_NEG_EINT2 */
5913#define ARIZONA_IM_HP3R_SC_POS_EINT2 0x0400 /* IM_HP3R_SC_POS_EINT2 */
5914#define ARIZONA_IM_HP3R_SC_POS_EINT2_MASK 0x0400 /* IM_HP3R_SC_POS_EINT2 */
5915#define ARIZONA_IM_HP3R_SC_POS_EINT2_SHIFT 10 /* IM_HP3R_SC_POS_EINT2 */
5916#define ARIZONA_IM_HP3R_SC_POS_EINT2_WIDTH 1 /* IM_HP3R_SC_POS_EINT2 */
5917#define ARIZONA_IM_HP3L_SC_NEG_EINT2 0x0200 /* IM_HP3L_SC_NEG_EINT2 */
5918#define ARIZONA_IM_HP3L_SC_NEG_EINT2_MASK 0x0200 /* IM_HP3L_SC_NEG_EINT2 */
5919#define ARIZONA_IM_HP3L_SC_NEG_EINT2_SHIFT 9 /* IM_HP3L_SC_NEG_EINT2 */
5920#define ARIZONA_IM_HP3L_SC_NEG_EINT2_WIDTH 1 /* IM_HP3L_SC_NEG_EINT2 */
5921#define ARIZONA_IM_HP3L_SC_POS_EINT2 0x0100 /* IM_HP3L_SC_POS_EINT2 */
5922#define ARIZONA_IM_HP3L_SC_POS_EINT2_MASK 0x0100 /* IM_HP3L_SC_POS_EINT2 */
5923#define ARIZONA_IM_HP3L_SC_POS_EINT2_SHIFT 8 /* IM_HP3L_SC_POS_EINT2 */
5924#define ARIZONA_IM_HP3L_SC_POS_EINT2_WIDTH 1 /* IM_HP3L_SC_POS_EINT2 */
5925#define ARIZONA_IM_HP2R_SC_NEG_EINT2 0x0080 /* IM_HP2R_SC_NEG_EINT2 */
5926#define ARIZONA_IM_HP2R_SC_NEG_EINT2_MASK 0x0080 /* IM_HP2R_SC_NEG_EINT2 */
5927#define ARIZONA_IM_HP2R_SC_NEG_EINT2_SHIFT 7 /* IM_HP2R_SC_NEG_EINT2 */
5928#define ARIZONA_IM_HP2R_SC_NEG_EINT2_WIDTH 1 /* IM_HP2R_SC_NEG_EINT2 */
5929#define ARIZONA_IM_HP2R_SC_POS_EINT2 0x0040 /* IM_HP2R_SC_POS_EINT2 */
5930#define ARIZONA_IM_HP2R_SC_POS_EINT2_MASK 0x0040 /* IM_HP2R_SC_POS_EINT2 */
5931#define ARIZONA_IM_HP2R_SC_POS_EINT2_SHIFT 6 /* IM_HP2R_SC_POS_EINT2 */
5932#define ARIZONA_IM_HP2R_SC_POS_EINT2_WIDTH 1 /* IM_HP2R_SC_POS_EINT2 */
5933#define ARIZONA_IM_HP2L_SC_NEG_EINT2 0x0020 /* IM_HP2L_SC_NEG_EINT2 */
5934#define ARIZONA_IM_HP2L_SC_NEG_EINT2_MASK 0x0020 /* IM_HP2L_SC_NEG_EINT2 */
5935#define ARIZONA_IM_HP2L_SC_NEG_EINT2_SHIFT 5 /* IM_HP2L_SC_NEG_EINT2 */
5936#define ARIZONA_IM_HP2L_SC_NEG_EINT2_WIDTH 1 /* IM_HP2L_SC_NEG_EINT2 */
5937#define ARIZONA_IM_HP2L_SC_POS_EINT2 0x0010 /* IM_HP2L_SC_POS_EINT2 */
5938#define ARIZONA_IM_HP2L_SC_POS_EINT2_MASK 0x0010 /* IM_HP2L_SC_POS_EINT2 */
5939#define ARIZONA_IM_HP2L_SC_POS_EINT2_SHIFT 4 /* IM_HP2L_SC_POS_EINT2 */
5940#define ARIZONA_IM_HP2L_SC_POS_EINT2_WIDTH 1 /* IM_HP2L_SC_POS_EINT2 */
5941#define ARIZONA_IM_HP1R_SC_NEG_EINT2 0x0008 /* IM_HP1R_SC_NEG_EINT2 */
5942#define ARIZONA_IM_HP1R_SC_NEG_EINT2_MASK 0x0008 /* IM_HP1R_SC_NEG_EINT2 */
5943#define ARIZONA_IM_HP1R_SC_NEG_EINT2_SHIFT 3 /* IM_HP1R_SC_NEG_EINT2 */
5944#define ARIZONA_IM_HP1R_SC_NEG_EINT2_WIDTH 1 /* IM_HP1R_SC_NEG_EINT2 */
5945#define ARIZONA_IM_HP1R_SC_POS_EINT2 0x0004 /* IM_HP1R_SC_POS_EINT2 */
5946#define ARIZONA_IM_HP1R_SC_POS_EINT2_MASK 0x0004 /* IM_HP1R_SC_POS_EINT2 */
5947#define ARIZONA_IM_HP1R_SC_POS_EINT2_SHIFT 2 /* IM_HP1R_SC_POS_EINT2 */
5948#define ARIZONA_IM_HP1R_SC_POS_EINT2_WIDTH 1 /* IM_HP1R_SC_POS_EINT2 */
5949#define ARIZONA_IM_HP1L_SC_NEG_EINT2 0x0002 /* IM_HP1L_SC_NEG_EINT2 */
5950#define ARIZONA_IM_HP1L_SC_NEG_EINT2_MASK 0x0002 /* IM_HP1L_SC_NEG_EINT2 */
5951#define ARIZONA_IM_HP1L_SC_NEG_EINT2_SHIFT 1 /* IM_HP1L_SC_NEG_EINT2 */
5952#define ARIZONA_IM_HP1L_SC_NEG_EINT2_WIDTH 1 /* IM_HP1L_SC_NEG_EINT2 */
5953#define ARIZONA_IM_HP1L_SC_POS_EINT2 0x0001 /* IM_HP1L_SC_POS_EINT2 */
5954#define ARIZONA_IM_HP1L_SC_POS_EINT2_MASK 0x0001 /* IM_HP1L_SC_POS_EINT2 */
5955#define ARIZONA_IM_HP1L_SC_POS_EINT2_SHIFT 0 /* IM_HP1L_SC_POS_EINT2 */
5956#define ARIZONA_IM_HP1L_SC_POS_EINT2_WIDTH 1 /* IM_HP1L_SC_POS_EINT2 */
5957
5958/*
5337 * R3359 (0xD1F) - IRQ2 Control 5959 * R3359 (0xD1F) - IRQ2 Control
5338 */ 5960 */
5339#define ARIZONA_IM_IRQ2 0x0001 /* IM_IRQ2 */ 5961#define ARIZONA_IM_IRQ2 0x0001 /* IM_IRQ2 */
@@ -5360,14 +5982,14 @@
5360/* 5982/*
5361 * R3361 (0xD21) - Interrupt Raw Status 3 5983 * R3361 (0xD21) - Interrupt Raw Status 3
5362 */ 5984 */
5363#define ARIZONA_SPK_SHUTDOWN_WARN_STS 0x8000 /* SPK_SHUTDOWN_WARN_STS */ 5985#define ARIZONA_SPK_OVERHEAT_WARN_STS 0x8000 /* SPK_OVERHEAT_WARN_STS */
5364#define ARIZONA_SPK_SHUTDOWN_WARN_STS_MASK 0x8000 /* SPK_SHUTDOWN_WARN_STS */ 5986#define ARIZONA_SPK_OVERHEAT_WARN_STS_MASK 0x8000 /* SPK_OVERHEAT_WARN_STS */
5365#define ARIZONA_SPK_SHUTDOWN_WARN_STS_SHIFT 15 /* SPK_SHUTDOWN_WARN_STS */ 5987#define ARIZONA_SPK_OVERHEAT_WARN_STS_SHIFT 15 /* SPK_OVERHEAT_WARN_STS */
5366#define ARIZONA_SPK_SHUTDOWN_WARN_STS_WIDTH 1 /* SPK_SHUTDOWN_WARN_STS */ 5988#define ARIZONA_SPK_OVERHEAT_WARN_STS_WIDTH 1 /* SPK_OVERHEAT_WARN_STS */
5367#define ARIZONA_SPK_SHUTDOWN_STS 0x4000 /* SPK_SHUTDOWN_STS */ 5989#define ARIZONA_SPK_OVERHEAT_STS 0x4000 /* SPK_OVERHEAT_STS */
5368#define ARIZONA_SPK_SHUTDOWN_STS_MASK 0x4000 /* SPK_SHUTDOWN_STS */ 5990#define ARIZONA_SPK_OVERHEAT_STS_MASK 0x4000 /* SPK_OVERHEAT_STS */
5369#define ARIZONA_SPK_SHUTDOWN_STS_SHIFT 14 /* SPK_SHUTDOWN_STS */ 5991#define ARIZONA_SPK_OVERHEAT_STS_SHIFT 14 /* SPK_OVERHEAT_STS */
5370#define ARIZONA_SPK_SHUTDOWN_STS_WIDTH 1 /* SPK_SHUTDOWN_STS */ 5992#define ARIZONA_SPK_OVERHEAT_STS_WIDTH 1 /* SPK_OVERHEAT_STS */
5371#define ARIZONA_HPDET_STS 0x2000 /* HPDET_STS */ 5993#define ARIZONA_HPDET_STS 0x2000 /* HPDET_STS */
5372#define ARIZONA_HPDET_STS_MASK 0x2000 /* HPDET_STS */ 5994#define ARIZONA_HPDET_STS_MASK 0x2000 /* HPDET_STS */
5373#define ARIZONA_HPDET_STS_SHIFT 13 /* HPDET_STS */ 5995#define ARIZONA_HPDET_STS_SHIFT 13 /* HPDET_STS */
@@ -5464,6 +6086,30 @@
5464#define ARIZONA_ISRC2_CFG_ERR_STS_MASK 0x0040 /* ISRC2_CFG_ERR_STS */ 6086#define ARIZONA_ISRC2_CFG_ERR_STS_MASK 0x0040 /* ISRC2_CFG_ERR_STS */
5465#define ARIZONA_ISRC2_CFG_ERR_STS_SHIFT 6 /* ISRC2_CFG_ERR_STS */ 6087#define ARIZONA_ISRC2_CFG_ERR_STS_SHIFT 6 /* ISRC2_CFG_ERR_STS */
5466#define ARIZONA_ISRC2_CFG_ERR_STS_WIDTH 1 /* ISRC2_CFG_ERR_STS */ 6088#define ARIZONA_ISRC2_CFG_ERR_STS_WIDTH 1 /* ISRC2_CFG_ERR_STS */
6089#define ARIZONA_HP3R_DONE_STS 0x0020 /* HP3R_DONE_STS */
6090#define ARIZONA_HP3R_DONE_STS_MASK 0x0020 /* HP3R_DONE_STS */
6091#define ARIZONA_HP3R_DONE_STS_SHIFT 5 /* HP3R_DONE_STS */
6092#define ARIZONA_HP3R_DONE_STS_WIDTH 1 /* HP3R_DONE_STS */
6093#define ARIZONA_HP3L_DONE_STS 0x0010 /* HP3L_DONE_STS */
6094#define ARIZONA_HP3L_DONE_STS_MASK 0x0010 /* HP3L_DONE_STS */
6095#define ARIZONA_HP3L_DONE_STS_SHIFT 4 /* HP3L_DONE_STS */
6096#define ARIZONA_HP3L_DONE_STS_WIDTH 1 /* HP3L_DONE_STS */
6097#define ARIZONA_HP2R_DONE_STS 0x0008 /* HP2R_DONE_STS */
6098#define ARIZONA_HP2R_DONE_STS_MASK 0x0008 /* HP2R_DONE_STS */
6099#define ARIZONA_HP2R_DONE_STS_SHIFT 3 /* HP2R_DONE_STS */
6100#define ARIZONA_HP2R_DONE_STS_WIDTH 1 /* HP2R_DONE_STS */
6101#define ARIZONA_HP2L_DONE_STS 0x0004 /* HP2L_DONE_STS */
6102#define ARIZONA_HP2L_DONE_STS_MASK 0x0004 /* HP2L_DONE_STS */
6103#define ARIZONA_HP2L_DONE_STS_SHIFT 2 /* HP2L_DONE_STS */
6104#define ARIZONA_HP2L_DONE_STS_WIDTH 1 /* HP2L_DONE_STS */
6105#define ARIZONA_HP1R_DONE_STS 0x0002 /* HP1R_DONE_STS */
6106#define ARIZONA_HP1R_DONE_STS_MASK 0x0002 /* HP1R_DONE_STS */
6107#define ARIZONA_HP1R_DONE_STS_SHIFT 1 /* HP1R_DONE_STS */
6108#define ARIZONA_HP1R_DONE_STS_WIDTH 1 /* HP1R_DONE_STS */
6109#define ARIZONA_HP1L_DONE_STS 0x0001 /* HP1L_DONE_STS */
6110#define ARIZONA_HP1L_DONE_STS_MASK 0x0001 /* HP1L_DONE_STS */
6111#define ARIZONA_HP1L_DONE_STS_SHIFT 0 /* HP1L_DONE_STS */
6112#define ARIZONA_HP1L_DONE_STS_WIDTH 1 /* HP1L_DONE_STS */
5467 6113
5468/* 6114/*
5469 * R3363 (0xD23) - Interrupt Raw Status 5 6115 * R3363 (0xD23) - Interrupt Raw Status 5
@@ -5580,6 +6226,10 @@
5580#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_MASK 0x0008 /* ADSP2_1_OVERCLOCKED_STS */ 6226#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_MASK 0x0008 /* ADSP2_1_OVERCLOCKED_STS */
5581#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_SHIFT 3 /* ADSP2_1_OVERCLOCKED_STS */ 6227#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_SHIFT 3 /* ADSP2_1_OVERCLOCKED_STS */
5582#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_WIDTH 1 /* ADSP2_1_OVERCLOCKED_STS */ 6228#define ARIZONA_ADSP2_1_OVERCLOCKED_STS_WIDTH 1 /* ADSP2_1_OVERCLOCKED_STS */
6229#define ARIZONA_ISRC3_OVERCLOCKED_STS 0x0004 /* ISRC3_OVERCLOCKED_STS */
6230#define ARIZONA_ISRC3_OVERCLOCKED_STS_MASK 0x0004 /* ISRC3_OVERCLOCKED_STS */
6231#define ARIZONA_ISRC3_OVERCLOCKED_STS_SHIFT 2 /* ISRC3_OVERCLOCKED_STS */
6232#define ARIZONA_ISRC3_OVERCLOCKED_STS_WIDTH 1 /* ISRC3_OVERCLOCKED_STS */
5583#define ARIZONA_ISRC2_OVERCLOCKED_STS 0x0002 /* ISRC2_OVERCLOCKED_STS */ 6233#define ARIZONA_ISRC2_OVERCLOCKED_STS 0x0002 /* ISRC2_OVERCLOCKED_STS */
5584#define ARIZONA_ISRC2_OVERCLOCKED_STS_MASK 0x0002 /* ISRC2_OVERCLOCKED_STS */ 6234#define ARIZONA_ISRC2_OVERCLOCKED_STS_MASK 0x0002 /* ISRC2_OVERCLOCKED_STS */
5585#define ARIZONA_ISRC2_OVERCLOCKED_STS_SHIFT 1 /* ISRC2_OVERCLOCKED_STS */ 6235#define ARIZONA_ISRC2_OVERCLOCKED_STS_SHIFT 1 /* ISRC2_OVERCLOCKED_STS */
@@ -5604,6 +6254,10 @@
5604#define ARIZONA_AIF1_UNDERCLOCKED_STS_MASK 0x0100 /* AIF1_UNDERCLOCKED_STS */ 6254#define ARIZONA_AIF1_UNDERCLOCKED_STS_MASK 0x0100 /* AIF1_UNDERCLOCKED_STS */
5605#define ARIZONA_AIF1_UNDERCLOCKED_STS_SHIFT 8 /* AIF1_UNDERCLOCKED_STS */ 6255#define ARIZONA_AIF1_UNDERCLOCKED_STS_SHIFT 8 /* AIF1_UNDERCLOCKED_STS */
5606#define ARIZONA_AIF1_UNDERCLOCKED_STS_WIDTH 1 /* AIF1_UNDERCLOCKED_STS */ 6256#define ARIZONA_AIF1_UNDERCLOCKED_STS_WIDTH 1 /* AIF1_UNDERCLOCKED_STS */
6257#define ARIZONA_ISRC3_UNDERCLOCKED_STS 0x0080 /* ISRC3_UNDERCLOCKED_STS */
6258#define ARIZONA_ISRC3_UNDERCLOCKED_STS_MASK 0x0080 /* ISRC3_UNDERCLOCKED_STS */
6259#define ARIZONA_ISRC3_UNDERCLOCKED_STS_SHIFT 7 /* ISRC3_UNDERCLOCKED_STS */
6260#define ARIZONA_ISRC3_UNDERCLOCKED_STS_WIDTH 1 /* ISRC3_UNDERCLOCKED_STS */
5607#define ARIZONA_ISRC2_UNDERCLOCKED_STS 0x0040 /* ISRC2_UNDERCLOCKED_STS */ 6261#define ARIZONA_ISRC2_UNDERCLOCKED_STS 0x0040 /* ISRC2_UNDERCLOCKED_STS */
5608#define ARIZONA_ISRC2_UNDERCLOCKED_STS_MASK 0x0040 /* ISRC2_UNDERCLOCKED_STS */ 6262#define ARIZONA_ISRC2_UNDERCLOCKED_STS_MASK 0x0040 /* ISRC2_UNDERCLOCKED_STS */
5609#define ARIZONA_ISRC2_UNDERCLOCKED_STS_SHIFT 6 /* ISRC2_UNDERCLOCKED_STS */ 6263#define ARIZONA_ISRC2_UNDERCLOCKED_STS_SHIFT 6 /* ISRC2_UNDERCLOCKED_STS */
@@ -5634,6 +6288,74 @@
5634#define ARIZONA_MIXER_UNDERCLOCKED_STS_WIDTH 1 /* MIXER_UNDERCLOCKED_STS */ 6288#define ARIZONA_MIXER_UNDERCLOCKED_STS_WIDTH 1 /* MIXER_UNDERCLOCKED_STS */
5635 6289
5636/* 6290/*
6291 * R3368 (0xD28) - Interrupt Raw Status 9
6292 */
6293#define ARIZONA_DSP_SHARED_WR_COLL_STS 0x8000 /* DSP_SHARED_WR_COLL_STS */
6294#define ARIZONA_DSP_SHARED_WR_COLL_STS_MASK 0x8000 /* DSP_SHARED_WR_COLL_STS */
6295#define ARIZONA_DSP_SHARED_WR_COLL_STS_SHIFT 15 /* DSP_SHARED_WR_COLL_STS */
6296#define ARIZONA_DSP_SHARED_WR_COLL_STS_WIDTH 1 /* DSP_SHARED_WR_COLL_STS */
6297#define ARIZONA_SPK_SHUTDOWN_STS 0x4000 /* SPK_SHUTDOWN_STS */
6298#define ARIZONA_SPK_SHUTDOWN_STS_MASK 0x4000 /* SPK_SHUTDOWN_STS */
6299#define ARIZONA_SPK_SHUTDOWN_STS_SHIFT 14 /* SPK_SHUTDOWN_STS */
6300#define ARIZONA_SPK_SHUTDOWN_STS_WIDTH 1 /* SPK_SHUTDOWN_STS */
6301#define ARIZONA_SPK1R_SHORT_STS 0x2000 /* SPK1R_SHORT_STS */
6302#define ARIZONA_SPK1R_SHORT_STS_MASK 0x2000 /* SPK1R_SHORT_STS */
6303#define ARIZONA_SPK1R_SHORT_STS_SHIFT 13 /* SPK1R_SHORT_STS */
6304#define ARIZONA_SPK1R_SHORT_STS_WIDTH 1 /* SPK1R_SHORT_STS */
6305#define ARIZONA_SPK1L_SHORT_STS 0x1000 /* SPK1L_SHORT_STS */
6306#define ARIZONA_SPK1L_SHORT_STS_MASK 0x1000 /* SPK1L_SHORT_STS */
6307#define ARIZONA_SPK1L_SHORT_STS_SHIFT 12 /* SPK1L_SHORT_STS */
6308#define ARIZONA_SPK1L_SHORT_STS_WIDTH 1 /* SPK1L_SHORT_STS */
6309#define ARIZONA_HP3R_SC_NEG_STS 0x0800 /* HP3R_SC_NEG_STS */
6310#define ARIZONA_HP3R_SC_NEG_STS_MASK 0x0800 /* HP3R_SC_NEG_STS */
6311#define ARIZONA_HP3R_SC_NEG_STS_SHIFT 11 /* HP3R_SC_NEG_STS */
6312#define ARIZONA_HP3R_SC_NEG_STS_WIDTH 1 /* HP3R_SC_NEG_STS */
6313#define ARIZONA_HP3R_SC_POS_STS 0x0400 /* HP3R_SC_POS_STS */
6314#define ARIZONA_HP3R_SC_POS_STS_MASK 0x0400 /* HP3R_SC_POS_STS */
6315#define ARIZONA_HP3R_SC_POS_STS_SHIFT 10 /* HP3R_SC_POS_STS */
6316#define ARIZONA_HP3R_SC_POS_STS_WIDTH 1 /* HP3R_SC_POS_STS */
6317#define ARIZONA_HP3L_SC_NEG_STS 0x0200 /* HP3L_SC_NEG_STS */
6318#define ARIZONA_HP3L_SC_NEG_STS_MASK 0x0200 /* HP3L_SC_NEG_STS */
6319#define ARIZONA_HP3L_SC_NEG_STS_SHIFT 9 /* HP3L_SC_NEG_STS */
6320#define ARIZONA_HP3L_SC_NEG_STS_WIDTH 1 /* HP3L_SC_NEG_STS */
6321#define ARIZONA_HP3L_SC_POS_STS 0x0100 /* HP3L_SC_POS_STS */
6322#define ARIZONA_HP3L_SC_POS_STS_MASK 0x0100 /* HP3L_SC_POS_STS */
6323#define ARIZONA_HP3L_SC_POS_STS_SHIFT 8 /* HP3L_SC_POS_STS */
6324#define ARIZONA_HP3L_SC_POS_STS_WIDTH 1 /* HP3L_SC_POS_STS */
6325#define ARIZONA_HP2R_SC_NEG_STS 0x0080 /* HP2R_SC_NEG_STS */
6326#define ARIZONA_HP2R_SC_NEG_STS_MASK 0x0080 /* HP2R_SC_NEG_STS */
6327#define ARIZONA_HP2R_SC_NEG_STS_SHIFT 7 /* HP2R_SC_NEG_STS */
6328#define ARIZONA_HP2R_SC_NEG_STS_WIDTH 1 /* HP2R_SC_NEG_STS */
6329#define ARIZONA_HP2R_SC_POS_STS 0x0040 /* HP2R_SC_POS_STS */
6330#define ARIZONA_HP2R_SC_POS_STS_MASK 0x0040 /* HP2R_SC_POS_STS */
6331#define ARIZONA_HP2R_SC_POS_STS_SHIFT 6 /* HP2R_SC_POS_STS */
6332#define ARIZONA_HP2R_SC_POS_STS_WIDTH 1 /* HP2R_SC_POS_STS */
6333#define ARIZONA_HP2L_SC_NEG_STS 0x0020 /* HP2L_SC_NEG_STS */
6334#define ARIZONA_HP2L_SC_NEG_STS_MASK 0x0020 /* HP2L_SC_NEG_STS */
6335#define ARIZONA_HP2L_SC_NEG_STS_SHIFT 5 /* HP2L_SC_NEG_STS */
6336#define ARIZONA_HP2L_SC_NEG_STS_WIDTH 1 /* HP2L_SC_NEG_STS */
6337#define ARIZONA_HP2L_SC_POS_STS 0x0010 /* HP2L_SC_POS_STS */
6338#define ARIZONA_HP2L_SC_POS_STS_MASK 0x0010 /* HP2L_SC_POS_STS */
6339#define ARIZONA_HP2L_SC_POS_STS_SHIFT 4 /* HP2L_SC_POS_STS */
6340#define ARIZONA_HP2L_SC_POS_STS_WIDTH 1 /* HP2L_SC_POS_STS */
6341#define ARIZONA_HP1R_SC_NEG_STS 0x0008 /* HP1R_SC_NEG_STS */
6342#define ARIZONA_HP1R_SC_NEG_STS_MASK 0x0008 /* HP1R_SC_NEG_STS */
6343#define ARIZONA_HP1R_SC_NEG_STS_SHIFT 3 /* HP1R_SC_NEG_STS */
6344#define ARIZONA_HP1R_SC_NEG_STS_WIDTH 1 /* HP1R_SC_NEG_STS */
6345#define ARIZONA_HP1R_SC_POS_STS 0x0004 /* HP1R_SC_POS_STS */
6346#define ARIZONA_HP1R_SC_POS_STS_MASK 0x0004 /* HP1R_SC_POS_STS */
6347#define ARIZONA_HP1R_SC_POS_STS_SHIFT 2 /* HP1R_SC_POS_STS */
6348#define ARIZONA_HP1R_SC_POS_STS_WIDTH 1 /* HP1R_SC_POS_STS */
6349#define ARIZONA_HP1L_SC_NEG_STS 0x0002 /* HP1L_SC_NEG_STS */
6350#define ARIZONA_HP1L_SC_NEG_STS_MASK 0x0002 /* HP1L_SC_NEG_STS */
6351#define ARIZONA_HP1L_SC_NEG_STS_SHIFT 1 /* HP1L_SC_NEG_STS */
6352#define ARIZONA_HP1L_SC_NEG_STS_WIDTH 1 /* HP1L_SC_NEG_STS */
6353#define ARIZONA_HP1L_SC_POS_STS 0x0001 /* HP1L_SC_POS_STS */
6354#define ARIZONA_HP1L_SC_POS_STS_MASK 0x0001 /* HP1L_SC_POS_STS */
6355#define ARIZONA_HP1L_SC_POS_STS_SHIFT 0 /* HP1L_SC_POS_STS */
6356#define ARIZONA_HP1L_SC_POS_STS_WIDTH 1 /* HP1L_SC_POS_STS */
6357
6358/*
5637 * R3392 (0xD40) - IRQ Pin Status 6359 * R3392 (0xD40) - IRQ Pin Status
5638 */ 6360 */
5639#define ARIZONA_IRQ2_STS 0x0002 /* IRQ2_STS */ 6361#define ARIZONA_IRQ2_STS 0x0002 /* IRQ2_STS */
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index f543de91ce19..73e1709d4c09 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -44,6 +44,9 @@ struct mfd_cell {
44 */ 44 */
45 const char *of_compatible; 45 const char *of_compatible;
46 46
47 /* Matches ACPI PNP id, either _HID or _CID */
48 const char *acpi_pnpid;
49
47 /* 50 /*
48 * These resources can be specified relative to the parent device. 51 * These resources can be specified relative to the parent device.
49 * For accessing hardware you should use resources from the platform dev 52 * For accessing hardware you should use resources from the platform dev
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 887ef4f7bef7..0e166b92f5b4 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -16,7 +16,9 @@
16#ifndef __LINUX_MFD_CROS_EC_H 16#ifndef __LINUX_MFD_CROS_EC_H
17#define __LINUX_MFD_CROS_EC_H 17#define __LINUX_MFD_CROS_EC_H
18 18
19#include <linux/notifier.h>
19#include <linux/mfd/cros_ec_commands.h> 20#include <linux/mfd/cros_ec_commands.h>
21#include <linux/mutex.h>
20 22
21/* 23/*
22 * Command interface between EC and AP, for LPC, I2C and SPI interfaces. 24 * Command interface between EC and AP, for LPC, I2C and SPI interfaces.
@@ -33,83 +35,76 @@ enum {
33 EC_MSG_TX_PROTO_BYTES, 35 EC_MSG_TX_PROTO_BYTES,
34}; 36};
35 37
36/** 38/*
37 * struct cros_ec_msg - A message sent to the EC, and its reply
38 *
39 * @version: Command version number (often 0) 39 * @version: Command version number (often 0)
40 * @cmd: Command to send (EC_CMD_...) 40 * @command: Command to send (EC_CMD_...)
41 * @out_buf: Outgoing payload (to EC) 41 * @outdata: Outgoing data to EC
42 * @outlen: Outgoing length 42 * @outsize: Outgoing length in bytes
43 * @in_buf: Incoming payload (from EC) 43 * @indata: Where to put the incoming data from EC
44 * @in_len: Incoming length 44 * @insize: Max number of bytes to accept from EC
45 * @result: EC's response to the command (separate from communication failure)
45 */ 46 */
46struct cros_ec_msg { 47struct cros_ec_command {
47 u8 version; 48 uint32_t version;
48 u8 cmd; 49 uint32_t command;
49 uint8_t *out_buf; 50 uint8_t *outdata;
50 int out_len; 51 uint32_t outsize;
51 uint8_t *in_buf; 52 uint8_t *indata;
52 int in_len; 53 uint32_t insize;
54 uint32_t result;
53}; 55};
54 56
55/** 57/**
56 * struct cros_ec_device - Information about a ChromeOS EC device 58 * struct cros_ec_device - Information about a ChromeOS EC device
57 * 59 *
58 * @name: Name of this EC interface 60 * @ec_name: name of EC device (e.g. 'chromeos-ec')
61 * @phys_name: name of physical comms layer (e.g. 'i2c-4')
62 * @dev: Device pointer
63 * @was_wake_device: true if this device was set to wake the system from
64 * sleep at the last suspend
65 *
59 * @priv: Private data 66 * @priv: Private data
60 * @irq: Interrupt to use 67 * @irq: Interrupt to use
61 * @din: input buffer (from EC) 68 * @din: input buffer (for data from EC)
62 * @dout: output buffer (to EC) 69 * @dout: output buffer (for data to EC)
63 * \note 70 * \note
64 * These two buffers will always be dword-aligned and include enough 71 * These two buffers will always be dword-aligned and include enough
65 * space for up to 7 word-alignment bytes also, so we can ensure that 72 * space for up to 7 word-alignment bytes also, so we can ensure that
66 * the body of the message is always dword-aligned (64-bit). 73 * the body of the message is always dword-aligned (64-bit).
67 *
68 * We use this alignment to keep ARM and x86 happy. Probably word 74 * We use this alignment to keep ARM and x86 happy. Probably word
69 * alignment would be OK, there might be a small performance advantage 75 * alignment would be OK, there might be a small performance advantage
70 * to using dword. 76 * to using dword.
71 * @din_size: size of din buffer 77 * @din_size: size of din buffer to allocate (zero to use static din)
72 * @dout_size: size of dout buffer 78 * @dout_size: size of dout buffer to allocate (zero to use static dout)
73 * @command_send: send a command
74 * @command_recv: receive a command
75 * @ec_name: name of EC device (e.g. 'chromeos-ec')
76 * @phys_name: name of physical comms layer (e.g. 'i2c-4')
77 * @parent: pointer to parent device (e.g. i2c or spi device) 79 * @parent: pointer to parent device (e.g. i2c or spi device)
78 * @dev: Device pointer
79 * dev_lock: Lock to prevent concurrent access
80 * @wake_enabled: true if this device can wake the system from sleep 80 * @wake_enabled: true if this device can wake the system from sleep
81 * @was_wake_device: true if this device was set to wake the system from 81 * @cmd_xfer: send command to EC and get response
82 * sleep at the last suspend 82 * Returns the number of bytes received if the communication succeeded, but
83 * @event_notifier: interrupt event notifier for transport devices 83 * that doesn't mean the EC was happy with the command. The caller
84 * should check msg.result for the EC's result code.
85 * @lock: one transaction at a time
84 */ 86 */
85struct cros_ec_device { 87struct cros_ec_device {
86 const char *name; 88
89 /* These are used by other drivers that want to talk to the EC */
90 const char *ec_name;
91 const char *phys_name;
92 struct device *dev;
93 bool was_wake_device;
94 struct class *cros_class;
95
96 /* These are used to implement the platform-specific interface */
87 void *priv; 97 void *priv;
88 int irq; 98 int irq;
89 uint8_t *din; 99 uint8_t *din;
90 uint8_t *dout; 100 uint8_t *dout;
91 int din_size; 101 int din_size;
92 int dout_size; 102 int dout_size;
93 int (*command_send)(struct cros_ec_device *ec,
94 uint16_t cmd, void *out_buf, int out_len);
95 int (*command_recv)(struct cros_ec_device *ec,
96 uint16_t cmd, void *in_buf, int in_len);
97 int (*command_sendrecv)(struct cros_ec_device *ec,
98 uint16_t cmd, void *out_buf, int out_len,
99 void *in_buf, int in_len);
100 int (*command_xfer)(struct cros_ec_device *ec,
101 struct cros_ec_msg *msg);
102
103 const char *ec_name;
104 const char *phys_name;
105 struct device *parent; 103 struct device *parent;
106
107 /* These are --private-- fields - do not assign */
108 struct device *dev;
109 struct mutex dev_lock;
110 bool wake_enabled; 104 bool wake_enabled;
111 bool was_wake_device; 105 int (*cmd_xfer)(struct cros_ec_device *ec,
112 struct blocking_notifier_head event_notifier; 106 struct cros_ec_command *msg);
107 struct mutex lock;
113}; 108};
114 109
115/** 110/**
@@ -143,13 +138,36 @@ int cros_ec_resume(struct cros_ec_device *ec_dev);
143 * @msg: Message to write 138 * @msg: Message to write
144 */ 139 */
145int cros_ec_prepare_tx(struct cros_ec_device *ec_dev, 140int cros_ec_prepare_tx(struct cros_ec_device *ec_dev,
146 struct cros_ec_msg *msg); 141 struct cros_ec_command *msg);
142
143/**
144 * cros_ec_check_result - Check ec_msg->result
145 *
146 * This is used by ChromeOS EC drivers to check the ec_msg->result for
147 * errors and to warn about them.
148 *
149 * @ec_dev: EC device
150 * @msg: Message to check
151 */
152int cros_ec_check_result(struct cros_ec_device *ec_dev,
153 struct cros_ec_command *msg);
154
155/**
156 * cros_ec_cmd_xfer - Send a command to the ChromeOS EC
157 *
158 * Call this to send a command to the ChromeOS EC. This should be used
159 * instead of calling the EC's cmd_xfer() callback directly.
160 *
161 * @ec_dev: EC device
162 * @msg: Message to write
163 */
164int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev,
165 struct cros_ec_command *msg);
147 166
148/** 167/**
149 * cros_ec_remove - Remove a ChromeOS EC 168 * cros_ec_remove - Remove a ChromeOS EC
150 * 169 *
151 * Call this to deregister a ChromeOS EC. After this you should call 170 * Call this to deregister a ChromeOS EC, then clean up any private data.
152 * cros_ec_free().
153 * 171 *
154 * @ec_dev: Device to register 172 * @ec_dev: Device to register
155 * @return 0 if ok, -ve on error 173 * @return 0 if ok, -ve on error
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 7853a6410d14..a49cd41feea7 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -1928,9 +1928,6 @@ struct ec_response_power_info {
1928 1928
1929#define EC_CMD_I2C_PASSTHRU 0x9e 1929#define EC_CMD_I2C_PASSTHRU 0x9e
1930 1930
1931/* Slave address is 10 (not 7) bit */
1932#define EC_I2C_FLAG_10BIT (1 << 16)
1933
1934/* Read data; if not present, message is a write */ 1931/* Read data; if not present, message is a write */
1935#define EC_I2C_FLAG_READ (1 << 15) 1932#define EC_I2C_FLAG_READ (1 << 15)
1936 1933
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index bba65f51a0b5..c18a4c19d6fc 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -211,7 +211,7 @@ static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
211int da9052_device_init(struct da9052 *da9052, u8 chip_id); 211int da9052_device_init(struct da9052 *da9052, u8 chip_id);
212void da9052_device_exit(struct da9052 *da9052); 212void da9052_device_exit(struct da9052 *da9052);
213 213
214extern struct regmap_config da9052_regmap_config; 214extern const struct regmap_config da9052_regmap_config;
215 215
216int da9052_irq_init(struct da9052 *da9052); 216int da9052_irq_init(struct da9052 *da9052);
217int da9052_irq_exit(struct da9052 *da9052); 217int da9052_irq_exit(struct da9052 *da9052);
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
index 00a9aac5d1e8..b92a3262f8f6 100644
--- a/include/linux/mfd/da9063/core.h
+++ b/include/linux/mfd/da9063/core.h
@@ -34,7 +34,8 @@ enum da9063_models {
34}; 34};
35 35
36enum da9063_variant_codes { 36enum da9063_variant_codes {
37 PMIC_DA9063_BB = 0x5 37 PMIC_DA9063_AD = 0x3,
38 PMIC_DA9063_BB = 0x5,
38}; 39};
39 40
40/* Interrupts */ 41/* Interrupts */
diff --git a/include/linux/mfd/da9063/registers.h b/include/linux/mfd/da9063/registers.h
index 09a85c699da1..2e0ba6d5fbc3 100644
--- a/include/linux/mfd/da9063/registers.h
+++ b/include/linux/mfd/da9063/registers.h
@@ -104,16 +104,27 @@
104#define DA9063_REG_COUNT_D 0x43 104#define DA9063_REG_COUNT_D 0x43
105#define DA9063_REG_COUNT_MO 0x44 105#define DA9063_REG_COUNT_MO 0x44
106#define DA9063_REG_COUNT_Y 0x45 106#define DA9063_REG_COUNT_Y 0x45
107#define DA9063_REG_ALARM_S 0x46 107
108#define DA9063_REG_ALARM_MI 0x47 108#define DA9063_AD_REG_ALARM_MI 0x46
109#define DA9063_REG_ALARM_H 0x48 109#define DA9063_AD_REG_ALARM_H 0x47
110#define DA9063_REG_ALARM_D 0x49 110#define DA9063_AD_REG_ALARM_D 0x48
111#define DA9063_REG_ALARM_MO 0x4A 111#define DA9063_AD_REG_ALARM_MO 0x49
112#define DA9063_REG_ALARM_Y 0x4B 112#define DA9063_AD_REG_ALARM_Y 0x4A
113#define DA9063_REG_SECOND_A 0x4C 113#define DA9063_AD_REG_SECOND_A 0x4B
114#define DA9063_REG_SECOND_B 0x4D 114#define DA9063_AD_REG_SECOND_B 0x4C
115#define DA9063_REG_SECOND_C 0x4E 115#define DA9063_AD_REG_SECOND_C 0x4D
116#define DA9063_REG_SECOND_D 0x4F 116#define DA9063_AD_REG_SECOND_D 0x4E
117
118#define DA9063_BB_REG_ALARM_S 0x46
119#define DA9063_BB_REG_ALARM_MI 0x47
120#define DA9063_BB_REG_ALARM_H 0x48
121#define DA9063_BB_REG_ALARM_D 0x49
122#define DA9063_BB_REG_ALARM_MO 0x4A
123#define DA9063_BB_REG_ALARM_Y 0x4B
124#define DA9063_BB_REG_SECOND_A 0x4C
125#define DA9063_BB_REG_SECOND_B 0x4D
126#define DA9063_BB_REG_SECOND_C 0x4E
127#define DA9063_BB_REG_SECOND_D 0x4F
117 128
118/* Sequencer Control Registers */ 129/* Sequencer Control Registers */
119#define DA9063_REG_SEQ 0x81 130#define DA9063_REG_SEQ 0x81
@@ -223,37 +234,67 @@
223#define DA9063_REG_CONFIG_J 0x10F 234#define DA9063_REG_CONFIG_J 0x10F
224#define DA9063_REG_CONFIG_K 0x110 235#define DA9063_REG_CONFIG_K 0x110
225#define DA9063_REG_CONFIG_L 0x111 236#define DA9063_REG_CONFIG_L 0x111
226#define DA9063_REG_CONFIG_M 0x112 237
227#define DA9063_REG_CONFIG_N 0x113 238#define DA9063_AD_REG_MON_REG_1 0x112
228 239#define DA9063_AD_REG_MON_REG_2 0x113
229#define DA9063_REG_MON_REG_1 0x114 240#define DA9063_AD_REG_MON_REG_3 0x114
230#define DA9063_REG_MON_REG_2 0x115 241#define DA9063_AD_REG_MON_REG_4 0x115
231#define DA9063_REG_MON_REG_3 0x116 242#define DA9063_AD_REG_MON_REG_5 0x116
232#define DA9063_REG_MON_REG_4 0x117 243#define DA9063_AD_REG_MON_REG_6 0x117
233#define DA9063_REG_MON_REG_5 0x11E 244#define DA9063_AD_REG_TRIM_CLDR 0x118
234#define DA9063_REG_MON_REG_6 0x11F 245
235#define DA9063_REG_TRIM_CLDR 0x120 246#define DA9063_AD_REG_GP_ID_0 0x119
247#define DA9063_AD_REG_GP_ID_1 0x11A
248#define DA9063_AD_REG_GP_ID_2 0x11B
249#define DA9063_AD_REG_GP_ID_3 0x11C
250#define DA9063_AD_REG_GP_ID_4 0x11D
251#define DA9063_AD_REG_GP_ID_5 0x11E
252#define DA9063_AD_REG_GP_ID_6 0x11F
253#define DA9063_AD_REG_GP_ID_7 0x120
254#define DA9063_AD_REG_GP_ID_8 0x121
255#define DA9063_AD_REG_GP_ID_9 0x122
256#define DA9063_AD_REG_GP_ID_10 0x123
257#define DA9063_AD_REG_GP_ID_11 0x124
258#define DA9063_AD_REG_GP_ID_12 0x125
259#define DA9063_AD_REG_GP_ID_13 0x126
260#define DA9063_AD_REG_GP_ID_14 0x127
261#define DA9063_AD_REG_GP_ID_15 0x128
262#define DA9063_AD_REG_GP_ID_16 0x129
263#define DA9063_AD_REG_GP_ID_17 0x12A
264#define DA9063_AD_REG_GP_ID_18 0x12B
265#define DA9063_AD_REG_GP_ID_19 0x12C
266
267#define DA9063_BB_REG_CONFIG_M 0x112
268#define DA9063_BB_REG_CONFIG_N 0x113
269
270#define DA9063_BB_REG_MON_REG_1 0x114
271#define DA9063_BB_REG_MON_REG_2 0x115
272#define DA9063_BB_REG_MON_REG_3 0x116
273#define DA9063_BB_REG_MON_REG_4 0x117
274#define DA9063_BB_REG_MON_REG_5 0x11E
275#define DA9063_BB_REG_MON_REG_6 0x11F
276#define DA9063_BB_REG_TRIM_CLDR 0x120
236/* General Purpose Registers */ 277/* General Purpose Registers */
237#define DA9063_REG_GP_ID_0 0x121 278#define DA9063_BB_REG_GP_ID_0 0x121
238#define DA9063_REG_GP_ID_1 0x122 279#define DA9063_BB_REG_GP_ID_1 0x122
239#define DA9063_REG_GP_ID_2 0x123 280#define DA9063_BB_REG_GP_ID_2 0x123
240#define DA9063_REG_GP_ID_3 0x124 281#define DA9063_BB_REG_GP_ID_3 0x124
241#define DA9063_REG_GP_ID_4 0x125 282#define DA9063_BB_REG_GP_ID_4 0x125
242#define DA9063_REG_GP_ID_5 0x126 283#define DA9063_BB_REG_GP_ID_5 0x126
243#define DA9063_REG_GP_ID_6 0x127 284#define DA9063_BB_REG_GP_ID_6 0x127
244#define DA9063_REG_GP_ID_7 0x128 285#define DA9063_BB_REG_GP_ID_7 0x128
245#define DA9063_REG_GP_ID_8 0x129 286#define DA9063_BB_REG_GP_ID_8 0x129
246#define DA9063_REG_GP_ID_9 0x12A 287#define DA9063_BB_REG_GP_ID_9 0x12A
247#define DA9063_REG_GP_ID_10 0x12B 288#define DA9063_BB_REG_GP_ID_10 0x12B
248#define DA9063_REG_GP_ID_11 0x12C 289#define DA9063_BB_REG_GP_ID_11 0x12C
249#define DA9063_REG_GP_ID_12 0x12D 290#define DA9063_BB_REG_GP_ID_12 0x12D
250#define DA9063_REG_GP_ID_13 0x12E 291#define DA9063_BB_REG_GP_ID_13 0x12E
251#define DA9063_REG_GP_ID_14 0x12F 292#define DA9063_BB_REG_GP_ID_14 0x12F
252#define DA9063_REG_GP_ID_15 0x130 293#define DA9063_BB_REG_GP_ID_15 0x130
253#define DA9063_REG_GP_ID_16 0x131 294#define DA9063_BB_REG_GP_ID_16 0x131
254#define DA9063_REG_GP_ID_17 0x132 295#define DA9063_BB_REG_GP_ID_17 0x132
255#define DA9063_REG_GP_ID_18 0x133 296#define DA9063_BB_REG_GP_ID_18 0x133
256#define DA9063_REG_GP_ID_19 0x134 297#define DA9063_BB_REG_GP_ID_19 0x134
257 298
258/* Chip ID and variant */ 299/* Chip ID and variant */
259#define DA9063_REG_CHIP_ID 0x181 300#define DA9063_REG_CHIP_ID 0x181
@@ -404,10 +445,10 @@
404/* DA9063_REG_CONTROL_B (addr=0x0F) */ 445/* DA9063_REG_CONTROL_B (addr=0x0F) */
405#define DA9063_CHG_SEL 0x01 446#define DA9063_CHG_SEL 0x01
406#define DA9063_WATCHDOG_PD 0x02 447#define DA9063_WATCHDOG_PD 0x02
407#define DA9063_RESET_BLINKING 0x04 448#define DA9063_BB_RESET_BLINKING 0x04
408#define DA9063_NRES_MODE 0x08 449#define DA9063_NRES_MODE 0x08
409#define DA9063_NONKEY_LOCK 0x10 450#define DA9063_NONKEY_LOCK 0x10
410#define DA9063_BUCK_SLOWSTART 0x80 451#define DA9063_BB_BUCK_SLOWSTART 0x80
411 452
412/* DA9063_REG_CONTROL_C (addr=0x10) */ 453/* DA9063_REG_CONTROL_C (addr=0x10) */
413#define DA9063_DEBOUNCING_MASK 0x07 454#define DA9063_DEBOUNCING_MASK 0x07
@@ -467,7 +508,7 @@
467#define DA9063_GPADC_PAUSE 0x02 508#define DA9063_GPADC_PAUSE 0x02
468#define DA9063_PMIF_DIS 0x04 509#define DA9063_PMIF_DIS 0x04
469#define DA9063_HS2WIRE_DIS 0x08 510#define DA9063_HS2WIRE_DIS 0x08
470#define DA9063_CLDR_PAUSE 0x10 511#define DA9063_BB_CLDR_PAUSE 0x10
471#define DA9063_BBAT_DIS 0x20 512#define DA9063_BBAT_DIS 0x20
472#define DA9063_OUT_32K_PAUSE 0x40 513#define DA9063_OUT_32K_PAUSE 0x40
473#define DA9063_PMCONT_DIS 0x80 514#define DA9063_PMCONT_DIS 0x80
@@ -844,7 +885,7 @@
844#define DA9063_MONITOR 0x40 885#define DA9063_MONITOR 0x40
845 886
846/* DA9063_REG_ALARM_S (addr=0x46) */ 887/* DA9063_REG_ALARM_S (addr=0x46) */
847#define DA9063_ALARM_S_MASK 0x3F 888#define DA9063_BB_ALARM_S_MASK 0x3F
848#define DA9063_ALARM_STATUS_ALARM 0x80 889#define DA9063_ALARM_STATUS_ALARM 0x80
849#define DA9063_ALARM_STATUS_TICK 0x40 890#define DA9063_ALARM_STATUS_TICK 0x40
850/* DA9063_REG_ALARM_MI (addr=0x47) */ 891/* DA9063_REG_ALARM_MI (addr=0x47) */
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h
index 5166935ce66d..cb01496bfa49 100644
--- a/include/linux/mfd/davinci_voicecodec.h
+++ b/include/linux/mfd/davinci_voicecodec.h
@@ -21,7 +21,7 @@
21 */ 21 */
22 22
23#ifndef __LINUX_MFD_DAVINCI_VOICECODEC_H_ 23#ifndef __LINUX_MFD_DAVINCI_VOICECODEC_H_
24#define __LINUX_MFD_DAVINIC_VOICECODEC_H_ 24#define __LINUX_MFD_DAVINCI_VOICECODEC_H_
25 25
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
diff --git a/include/linux/mfd/hi6421-pmic.h b/include/linux/mfd/hi6421-pmic.h
new file mode 100644
index 000000000000..587273e35acf
--- /dev/null
+++ b/include/linux/mfd/hi6421-pmic.h
@@ -0,0 +1,41 @@
1/*
2 * Header file for device driver Hi6421 PMIC
3 *
4 * Copyright (c) <2011-2014> HiSilicon Technologies Co., Ltd.
5 * http://www.hisilicon.com
6 * Copyright (c) <2013-2014> Linaro Ltd.
7 * http://www.linaro.org
8 *
9 * Author: Guodong Xu <guodong.xu@linaro.org>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#ifndef __HI6421_PMIC_H
17#define __HI6421_PMIC_H
18
19/* Hi6421 registers are mapped to memory bus in 4 bytes stride */
20#define HI6421_REG_TO_BUS_ADDR(x) (x << 2)
21
22/* Hi6421 maximum register number */
23#define HI6421_REG_MAX 0xFF
24
25/* Hi6421 OCP (over current protection) and DEB (debounce) control register */
26#define HI6421_OCP_DEB_CTRL_REG HI6421_REG_TO_BUS_ADDR(0x51)
27#define HI6421_OCP_DEB_SEL_MASK 0x0C
28#define HI6421_OCP_DEB_SEL_8MS 0x00
29#define HI6421_OCP_DEB_SEL_16MS 0x04
30#define HI6421_OCP_DEB_SEL_32MS 0x08
31#define HI6421_OCP_DEB_SEL_64MS 0x0C
32#define HI6421_OCP_EN_DEBOUNCE_MASK 0x02
33#define HI6421_OCP_EN_DEBOUNCE_ENABLE 0x02
34#define HI6421_OCP_AUTO_STOP_MASK 0x01
35#define HI6421_OCP_AUTO_STOP_ENABLE 0x01
36
37struct hi6421_pmic {
38 struct regmap *regmap;
39};
40
41#endif /* __HI6421_PMIC_H */
diff --git a/include/linux/mfd/intel_soc_pmic.h b/include/linux/mfd/intel_soc_pmic.h
new file mode 100644
index 000000000000..abcbfcf32d10
--- /dev/null
+++ b/include/linux/mfd/intel_soc_pmic.h
@@ -0,0 +1,30 @@
1/*
2 * intel_soc_pmic.h - Intel SoC PMIC Driver
3 *
4 * Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * Author: Yang, Bin <bin.yang@intel.com>
16 * Author: Zhu, Lejun <lejun.zhu@linux.intel.com>
17 */
18
19#ifndef __INTEL_SOC_PMIC_H__
20#define __INTEL_SOC_PMIC_H__
21
22#include <linux/regmap.h>
23
24struct intel_soc_pmic {
25 int irq;
26 struct regmap *regmap;
27 struct regmap_irq_chip_data *irq_chip_data;
28};
29
30#endif /* __INTEL_SOC_PMIC_H__ */
diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
index 499253604026..f01c1fae4d84 100644
--- a/include/linux/mfd/max14577-private.h
+++ b/include/linux/mfd/max14577-private.h
@@ -72,15 +72,33 @@ enum max14577_muic_reg {
72 MAX14577_MUIC_REG_END, 72 MAX14577_MUIC_REG_END,
73}; 73};
74 74
75/*
76 * Combined charger types for max14577 and max77836.
77 *
78 * On max14577 three lower bits map to STATUS2/CHGTYP field.
79 * However the max77836 has different two last values of STATUS2/CHGTYP.
80 * To indicate the difference enum has two additional values for max77836.
81 * These values are just a register value bitwise OR with 0x8.
82 */
75enum max14577_muic_charger_type { 83enum max14577_muic_charger_type {
76 MAX14577_CHARGER_TYPE_NONE = 0, 84 MAX14577_CHARGER_TYPE_NONE = 0x0,
77 MAX14577_CHARGER_TYPE_USB, 85 MAX14577_CHARGER_TYPE_USB = 0x1,
78 MAX14577_CHARGER_TYPE_DOWNSTREAM_PORT, 86 MAX14577_CHARGER_TYPE_DOWNSTREAM_PORT = 0x2,
79 MAX14577_CHARGER_TYPE_DEDICATED_CHG, 87 MAX14577_CHARGER_TYPE_DEDICATED_CHG = 0x3,
80 MAX14577_CHARGER_TYPE_SPECIAL_500MA, 88 MAX14577_CHARGER_TYPE_SPECIAL_500MA = 0x4,
81 MAX14577_CHARGER_TYPE_SPECIAL_1A, 89 /* Special 1A or 2A charger */
82 MAX14577_CHARGER_TYPE_RESERVED, 90 MAX14577_CHARGER_TYPE_SPECIAL_1A = 0x5,
83 MAX14577_CHARGER_TYPE_DEAD_BATTERY = 7, 91 /* max14577: reserved, used on max77836 */
92 MAX14577_CHARGER_TYPE_RESERVED = 0x6,
93 /* max14577: dead-battery charing with maximum current 100mA */
94 MAX14577_CHARGER_TYPE_DEAD_BATTERY = 0x7,
95 /*
96 * max77836: special charger (bias on D+/D-),
97 * matches register value of 0x6
98 */
99 MAX77836_CHARGER_TYPE_SPECIAL_BIAS = 0xe,
100 /* max77836: reserved, register value 0x7 */
101 MAX77836_CHARGER_TYPE_RESERVED = 0xf,
84}; 102};
85 103
86/* MAX14577 interrupts */ 104/* MAX14577 interrupts */
@@ -121,13 +139,15 @@ enum max14577_muic_charger_type {
121#define STATUS2_CHGTYP_SHIFT 0 139#define STATUS2_CHGTYP_SHIFT 0
122#define STATUS2_CHGDETRUN_SHIFT 3 140#define STATUS2_CHGDETRUN_SHIFT 3
123#define STATUS2_DCDTMR_SHIFT 4 141#define STATUS2_DCDTMR_SHIFT 4
124#define STATUS2_DBCHG_SHIFT 5 142#define MAX14577_STATUS2_DBCHG_SHIFT 5
143#define MAX77836_STATUS2_DXOVP_SHIFT 5
125#define STATUS2_VBVOLT_SHIFT 6 144#define STATUS2_VBVOLT_SHIFT 6
126#define MAX77836_STATUS2_VIDRM_SHIFT 7 145#define MAX77836_STATUS2_VIDRM_SHIFT 7
127#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT) 146#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT)
128#define STATUS2_CHGDETRUN_MASK BIT(STATUS2_CHGDETRUN_SHIFT) 147#define STATUS2_CHGDETRUN_MASK BIT(STATUS2_CHGDETRUN_SHIFT)
129#define STATUS2_DCDTMR_MASK BIT(STATUS2_DCDTMR_SHIFT) 148#define STATUS2_DCDTMR_MASK BIT(STATUS2_DCDTMR_SHIFT)
130#define STATUS2_DBCHG_MASK BIT(STATUS2_DBCHG_SHIFT) 149#define MAX14577_STATUS2_DBCHG_MASK BIT(MAX14577_STATUS2_DBCHG_SHIFT)
150#define MAX77836_STATUS2_DXOVP_MASK BIT(MAX77836_STATUS2_DXOVP_SHIFT)
131#define STATUS2_VBVOLT_MASK BIT(STATUS2_VBVOLT_SHIFT) 151#define STATUS2_VBVOLT_MASK BIT(STATUS2_VBVOLT_SHIFT)
132#define MAX77836_STATUS2_VIDRM_MASK BIT(MAX77836_STATUS2_VIDRM_SHIFT) 152#define MAX77836_STATUS2_VIDRM_MASK BIT(MAX77836_STATUS2_VIDRM_SHIFT)
133 153
@@ -177,9 +197,11 @@ enum max14577_muic_charger_type {
177#define CTRL3_JIGSET_SHIFT 0 197#define CTRL3_JIGSET_SHIFT 0
178#define CTRL3_BOOTSET_SHIFT 2 198#define CTRL3_BOOTSET_SHIFT 2
179#define CTRL3_ADCDBSET_SHIFT 4 199#define CTRL3_ADCDBSET_SHIFT 4
200#define CTRL3_WBTH_SHIFT 6
180#define CTRL3_JIGSET_MASK (0x3 << CTRL3_JIGSET_SHIFT) 201#define CTRL3_JIGSET_MASK (0x3 << CTRL3_JIGSET_SHIFT)
181#define CTRL3_BOOTSET_MASK (0x3 << CTRL3_BOOTSET_SHIFT) 202#define CTRL3_BOOTSET_MASK (0x3 << CTRL3_BOOTSET_SHIFT)
182#define CTRL3_ADCDBSET_MASK (0x3 << CTRL3_ADCDBSET_SHIFT) 203#define CTRL3_ADCDBSET_MASK (0x3 << CTRL3_ADCDBSET_SHIFT)
204#define CTRL3_WBTH_MASK (0x3 << CTRL3_WBTH_SHIFT)
183 205
184/* Slave addr = 0x4A: Charger */ 206/* Slave addr = 0x4A: Charger */
185enum max14577_charger_reg { 207enum max14577_charger_reg {
@@ -210,16 +232,20 @@ enum max14577_charger_reg {
210#define CDETCTRL1_CHGTYPMAN_SHIFT 1 232#define CDETCTRL1_CHGTYPMAN_SHIFT 1
211#define CDETCTRL1_DCDEN_SHIFT 2 233#define CDETCTRL1_DCDEN_SHIFT 2
212#define CDETCTRL1_DCD2SCT_SHIFT 3 234#define CDETCTRL1_DCD2SCT_SHIFT 3
213#define CDETCTRL1_DCHKTM_SHIFT 4 235#define MAX14577_CDETCTRL1_DCHKTM_SHIFT 4
214#define CDETCTRL1_DBEXIT_SHIFT 5 236#define MAX77836_CDETCTRL1_CDLY_SHIFT 4
237#define MAX14577_CDETCTRL1_DBEXIT_SHIFT 5
238#define MAX77836_CDETCTRL1_DCDCPL_SHIFT 5
215#define CDETCTRL1_DBIDLE_SHIFT 6 239#define CDETCTRL1_DBIDLE_SHIFT 6
216#define CDETCTRL1_CDPDET_SHIFT 7 240#define CDETCTRL1_CDPDET_SHIFT 7
217#define CDETCTRL1_CHGDETEN_MASK BIT(CDETCTRL1_CHGDETEN_SHIFT) 241#define CDETCTRL1_CHGDETEN_MASK BIT(CDETCTRL1_CHGDETEN_SHIFT)
218#define CDETCTRL1_CHGTYPMAN_MASK BIT(CDETCTRL1_CHGTYPMAN_SHIFT) 242#define CDETCTRL1_CHGTYPMAN_MASK BIT(CDETCTRL1_CHGTYPMAN_SHIFT)
219#define CDETCTRL1_DCDEN_MASK BIT(CDETCTRL1_DCDEN_SHIFT) 243#define CDETCTRL1_DCDEN_MASK BIT(CDETCTRL1_DCDEN_SHIFT)
220#define CDETCTRL1_DCD2SCT_MASK BIT(CDETCTRL1_DCD2SCT_SHIFT) 244#define CDETCTRL1_DCD2SCT_MASK BIT(CDETCTRL1_DCD2SCT_SHIFT)
221#define CDETCTRL1_DCHKTM_MASK BIT(CDETCTRL1_DCHKTM_SHIFT) 245#define MAX14577_CDETCTRL1_DCHKTM_MASK BIT(MAX14577_CDETCTRL1_DCHKTM_SHIFT)
222#define CDETCTRL1_DBEXIT_MASK BIT(CDETCTRL1_DBEXIT_SHIFT) 246#define MAX77836_CDETCTRL1_CDDLY_MASK BIT(MAX77836_CDETCTRL1_CDDLY_SHIFT)
247#define MAX14577_CDETCTRL1_DBEXIT_MASK BIT(MAX14577_CDETCTRL1_DBEXIT_SHIFT)
248#define MAX77836_CDETCTRL1_DCDCPL_MASK BIT(MAX77836_CDETCTRL1_DCDCPL_SHIFT)
223#define CDETCTRL1_DBIDLE_MASK BIT(CDETCTRL1_DBIDLE_SHIFT) 249#define CDETCTRL1_DBIDLE_MASK BIT(CDETCTRL1_DBIDLE_SHIFT)
224#define CDETCTRL1_CDPDET_MASK BIT(CDETCTRL1_CDPDET_SHIFT) 250#define CDETCTRL1_CDPDET_MASK BIT(CDETCTRL1_CDPDET_SHIFT)
225 251
@@ -255,17 +281,36 @@ enum max14577_charger_reg {
255#define CHGCTRL7_OTPCGHCVS_SHIFT 0 281#define CHGCTRL7_OTPCGHCVS_SHIFT 0
256#define CHGCTRL7_OTPCGHCVS_MASK (0x3 << CHGCTRL7_OTPCGHCVS_SHIFT) 282#define CHGCTRL7_OTPCGHCVS_MASK (0x3 << CHGCTRL7_OTPCGHCVS_SHIFT)
257 283
258/* MAX14577 regulator current limits (as in CHGCTRL4 register), uA */ 284/* MAX14577 charger current limits (as in CHGCTRL4 register), uA */
259#define MAX14577_REGULATOR_CURRENT_LIMIT_MIN 90000 285#define MAX14577_CHARGER_CURRENT_LIMIT_MIN 90000U
260#define MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START 200000 286#define MAX14577_CHARGER_CURRENT_LIMIT_HIGH_START 200000U
261#define MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP 50000 287#define MAX14577_CHARGER_CURRENT_LIMIT_HIGH_STEP 50000U
262#define MAX14577_REGULATOR_CURRENT_LIMIT_MAX 950000 288#define MAX14577_CHARGER_CURRENT_LIMIT_MAX 950000U
263 289
264/* MAX77836 regulator current limits (as in CHGCTRL4 register), uA */ 290/* MAX77836 charger current limits (as in CHGCTRL4 register), uA */
265#define MAX77836_REGULATOR_CURRENT_LIMIT_MIN 45000 291#define MAX77836_CHARGER_CURRENT_LIMIT_MIN 45000U
266#define MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_START 100000 292#define MAX77836_CHARGER_CURRENT_LIMIT_HIGH_START 100000U
267#define MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_STEP 25000 293#define MAX77836_CHARGER_CURRENT_LIMIT_HIGH_STEP 25000U
268#define MAX77836_REGULATOR_CURRENT_LIMIT_MAX 475000 294#define MAX77836_CHARGER_CURRENT_LIMIT_MAX 475000U
295
296/*
297 * MAX14577 charger End-Of-Charge current limits
298 * (as in CHGCTRL5 register), uA
299 */
300#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_MIN 50000U
301#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_STEP 10000U
302#define MAX14577_CHARGER_EOC_CURRENT_LIMIT_MAX 200000U
303
304/*
305 * MAX14577/MAX77836 Battery Constant Voltage
306 * (as in CHGCTRL3 register), uV
307 */
308#define MAXIM_CHARGER_CONSTANT_VOLTAGE_MIN 4000000U
309#define MAXIM_CHARGER_CONSTANT_VOLTAGE_STEP 20000U
310#define MAXIM_CHARGER_CONSTANT_VOLTAGE_MAX 4350000U
311
312/* Default value for fast charge timer, in hours */
313#define MAXIM_CHARGER_FAST_CHARGE_TIMER_DEFAULT 5
269 314
270/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */ 315/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */
271#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000 316#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000
diff --git a/include/linux/mfd/max14577.h b/include/linux/mfd/max14577.h
index c83fbed1c7b6..ccfaf952c31b 100644
--- a/include/linux/mfd/max14577.h
+++ b/include/linux/mfd/max14577.h
@@ -54,6 +54,13 @@ struct max14577_regulator_platform_data {
54 struct device_node *of_node; 54 struct device_node *of_node;
55}; 55};
56 56
57struct max14577_charger_platform_data {
58 u32 constant_uvolt;
59 u32 fast_charge_uamp;
60 u32 eoc_uamp;
61 u32 ovp_uvolt;
62};
63
57/* 64/*
58 * MAX14577 MFD platform data 65 * MAX14577 MFD platform data
59 */ 66 */
@@ -74,4 +81,27 @@ struct max14577_platform_data {
74 struct max14577_regulator_platform_data *regulators; 81 struct max14577_regulator_platform_data *regulators;
75}; 82};
76 83
84/*
85 * Valid limits of current for max14577 and max77836 chargers.
86 * They must correspond to MBCICHWRCL and MBCICHWRCH fields in CHGCTRL4
87 * register for given chipset.
88 */
89struct maxim_charger_current {
90 /* Minimal current, set in CHGCTRL4/MBCICHWRCL, uA */
91 unsigned int min;
92 /*
93 * Minimal current when high setting is active,
94 * set in CHGCTRL4/MBCICHWRCH, uA
95 */
96 unsigned int high_start;
97 /* Value of one step in high setting, uA */
98 unsigned int high_step;
99 /* Maximum current of high setting, uA */
100 unsigned int max;
101};
102
103extern const struct maxim_charger_current maxim_charger_currents[];
104extern int maxim_charger_calc_reg_current(const struct maxim_charger_current *limits,
105 unsigned int min_ua, unsigned int max_ua, u8 *dst);
106
77#endif /* __MAX14577_H__ */ 107#endif /* __MAX14577_H__ */
diff --git a/include/linux/mfd/max77686-private.h b/include/linux/mfd/max77686-private.h
index 8c75a9c8dfab..960b92ad450d 100644
--- a/include/linux/mfd/max77686-private.h
+++ b/include/linux/mfd/max77686-private.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * max77686-private.h - Voltage regulator driver for the Maxim 77686 2 * max77686-private.h - Voltage regulator driver for the Maxim 77686/802
3 * 3 *
4 * Copyright (C) 2012 Samsung Electrnoics 4 * Copyright (C) 2012 Samsung Electrnoics
5 * Chiwoong Byun <woong.byun@samsung.com> 5 * Chiwoong Byun <woong.byun@samsung.com>
@@ -28,6 +28,7 @@
28 28
29#define MAX77686_REG_INVALID (0xff) 29#define MAX77686_REG_INVALID (0xff)
30 30
31/* MAX77686 PMIC registers */
31enum max77686_pmic_reg { 32enum max77686_pmic_reg {
32 MAX77686_REG_DEVICE_ID = 0x00, 33 MAX77686_REG_DEVICE_ID = 0x00,
33 MAX77686_REG_INTSRC = 0x01, 34 MAX77686_REG_INTSRC = 0x01,
@@ -181,8 +182,209 @@ enum max77686_rtc_reg {
181 MAX77686_ALARM2_DATE = 0x1B, 182 MAX77686_ALARM2_DATE = 0x1B,
182}; 183};
183 184
184#define MAX77686_IRQSRC_PMIC (0) 185/* MAX77802 PMIC registers */
185#define MAX77686_IRQSRC_RTC (1 << 0) 186enum max77802_pmic_reg {
187 MAX77802_REG_DEVICE_ID = 0x00,
188 MAX77802_REG_INTSRC = 0x01,
189 MAX77802_REG_INT1 = 0x02,
190 MAX77802_REG_INT2 = 0x03,
191
192 MAX77802_REG_INT1MSK = 0x04,
193 MAX77802_REG_INT2MSK = 0x05,
194
195 MAX77802_REG_STATUS1 = 0x06,
196 MAX77802_REG_STATUS2 = 0x07,
197
198 MAX77802_REG_PWRON = 0x08,
199 /* Reserved: 0x09 */
200 MAX77802_REG_MRSTB = 0x0A,
201 MAX77802_REG_EPWRHOLD = 0x0B,
202 /* Reserved: 0x0C-0x0D */
203 MAX77802_REG_BOOSTCTRL = 0x0E,
204 MAX77802_REG_BOOSTOUT = 0x0F,
205
206 MAX77802_REG_BUCK1CTRL = 0x10,
207 MAX77802_REG_BUCK1DVS1 = 0x11,
208 MAX77802_REG_BUCK1DVS2 = 0x12,
209 MAX77802_REG_BUCK1DVS3 = 0x13,
210 MAX77802_REG_BUCK1DVS4 = 0x14,
211 MAX77802_REG_BUCK1DVS5 = 0x15,
212 MAX77802_REG_BUCK1DVS6 = 0x16,
213 MAX77802_REG_BUCK1DVS7 = 0x17,
214 MAX77802_REG_BUCK1DVS8 = 0x18,
215 /* Reserved: 0x19 */
216 MAX77802_REG_BUCK2CTRL1 = 0x1A,
217 MAX77802_REG_BUCK2CTRL2 = 0x1B,
218 MAX77802_REG_BUCK2PHTRAN = 0x1C,
219 MAX77802_REG_BUCK2DVS1 = 0x1D,
220 MAX77802_REG_BUCK2DVS2 = 0x1E,
221 MAX77802_REG_BUCK2DVS3 = 0x1F,
222 MAX77802_REG_BUCK2DVS4 = 0x20,
223 MAX77802_REG_BUCK2DVS5 = 0x21,
224 MAX77802_REG_BUCK2DVS6 = 0x22,
225 MAX77802_REG_BUCK2DVS7 = 0x23,
226 MAX77802_REG_BUCK2DVS8 = 0x24,
227 /* Reserved: 0x25-0x26 */
228 MAX77802_REG_BUCK3CTRL1 = 0x27,
229 MAX77802_REG_BUCK3DVS1 = 0x28,
230 MAX77802_REG_BUCK3DVS2 = 0x29,
231 MAX77802_REG_BUCK3DVS3 = 0x2A,
232 MAX77802_REG_BUCK3DVS4 = 0x2B,
233 MAX77802_REG_BUCK3DVS5 = 0x2C,
234 MAX77802_REG_BUCK3DVS6 = 0x2D,
235 MAX77802_REG_BUCK3DVS7 = 0x2E,
236 MAX77802_REG_BUCK3DVS8 = 0x2F,
237 /* Reserved: 0x30-0x36 */
238 MAX77802_REG_BUCK4CTRL1 = 0x37,
239 MAX77802_REG_BUCK4DVS1 = 0x38,
240 MAX77802_REG_BUCK4DVS2 = 0x39,
241 MAX77802_REG_BUCK4DVS3 = 0x3A,
242 MAX77802_REG_BUCK4DVS4 = 0x3B,
243 MAX77802_REG_BUCK4DVS5 = 0x3C,
244 MAX77802_REG_BUCK4DVS6 = 0x3D,
245 MAX77802_REG_BUCK4DVS7 = 0x3E,
246 MAX77802_REG_BUCK4DVS8 = 0x3F,
247 /* Reserved: 0x40 */
248 MAX77802_REG_BUCK5CTRL = 0x41,
249 MAX77802_REG_BUCK5OUT = 0x42,
250 /* Reserved: 0x43 */
251 MAX77802_REG_BUCK6CTRL = 0x44,
252 MAX77802_REG_BUCK6DVS1 = 0x45,
253 MAX77802_REG_BUCK6DVS2 = 0x46,
254 MAX77802_REG_BUCK6DVS3 = 0x47,
255 MAX77802_REG_BUCK6DVS4 = 0x48,
256 MAX77802_REG_BUCK6DVS5 = 0x49,
257 MAX77802_REG_BUCK6DVS6 = 0x4A,
258 MAX77802_REG_BUCK6DVS7 = 0x4B,
259 MAX77802_REG_BUCK6DVS8 = 0x4C,
260 /* Reserved: 0x4D */
261 MAX77802_REG_BUCK7CTRL = 0x4E,
262 MAX77802_REG_BUCK7OUT = 0x4F,
263 /* Reserved: 0x50 */
264 MAX77802_REG_BUCK8CTRL = 0x51,
265 MAX77802_REG_BUCK8OUT = 0x52,
266 /* Reserved: 0x53 */
267 MAX77802_REG_BUCK9CTRL = 0x54,
268 MAX77802_REG_BUCK9OUT = 0x55,
269 /* Reserved: 0x56 */
270 MAX77802_REG_BUCK10CTRL = 0x57,
271 MAX77802_REG_BUCK10OUT = 0x58,
272
273 /* Reserved: 0x59-0x5F */
274
275 MAX77802_REG_LDO1CTRL1 = 0x60,
276 MAX77802_REG_LDO2CTRL1 = 0x61,
277 MAX77802_REG_LDO3CTRL1 = 0x62,
278 MAX77802_REG_LDO4CTRL1 = 0x63,
279 MAX77802_REG_LDO5CTRL1 = 0x64,
280 MAX77802_REG_LDO6CTRL1 = 0x65,
281 MAX77802_REG_LDO7CTRL1 = 0x66,
282 MAX77802_REG_LDO8CTRL1 = 0x67,
283 MAX77802_REG_LDO9CTRL1 = 0x68,
284 MAX77802_REG_LDO10CTRL1 = 0x69,
285 MAX77802_REG_LDO11CTRL1 = 0x6A,
286 MAX77802_REG_LDO12CTRL1 = 0x6B,
287 MAX77802_REG_LDO13CTRL1 = 0x6C,
288 MAX77802_REG_LDO14CTRL1 = 0x6D,
289 MAX77802_REG_LDO15CTRL1 = 0x6E,
290 /* Reserved: 0x6F */
291 MAX77802_REG_LDO17CTRL1 = 0x70,
292 MAX77802_REG_LDO18CTRL1 = 0x71,
293 MAX77802_REG_LDO19CTRL1 = 0x72,
294 MAX77802_REG_LDO20CTRL1 = 0x73,
295 MAX77802_REG_LDO21CTRL1 = 0x74,
296 MAX77802_REG_LDO22CTRL1 = 0x75,
297 MAX77802_REG_LDO23CTRL1 = 0x76,
298 MAX77802_REG_LDO24CTRL1 = 0x77,
299 MAX77802_REG_LDO25CTRL1 = 0x78,
300 MAX77802_REG_LDO26CTRL1 = 0x79,
301 MAX77802_REG_LDO27CTRL1 = 0x7A,
302 MAX77802_REG_LDO28CTRL1 = 0x7B,
303 MAX77802_REG_LDO29CTRL1 = 0x7C,
304 MAX77802_REG_LDO30CTRL1 = 0x7D,
305 /* Reserved: 0x7E */
306 MAX77802_REG_LDO32CTRL1 = 0x7F,
307 MAX77802_REG_LDO33CTRL1 = 0x80,
308 MAX77802_REG_LDO34CTRL1 = 0x81,
309 MAX77802_REG_LDO35CTRL1 = 0x82,
310 /* Reserved: 0x83-0x8F */
311 MAX77802_REG_LDO1CTRL2 = 0x90,
312 MAX77802_REG_LDO2CTRL2 = 0x91,
313 MAX77802_REG_LDO3CTRL2 = 0x92,
314 MAX77802_REG_LDO4CTRL2 = 0x93,
315 MAX77802_REG_LDO5CTRL2 = 0x94,
316 MAX77802_REG_LDO6CTRL2 = 0x95,
317 MAX77802_REG_LDO7CTRL2 = 0x96,
318 MAX77802_REG_LDO8CTRL2 = 0x97,
319 MAX77802_REG_LDO9CTRL2 = 0x98,
320 MAX77802_REG_LDO10CTRL2 = 0x99,
321 MAX77802_REG_LDO11CTRL2 = 0x9A,
322 MAX77802_REG_LDO12CTRL2 = 0x9B,
323 MAX77802_REG_LDO13CTRL2 = 0x9C,
324 MAX77802_REG_LDO14CTRL2 = 0x9D,
325 MAX77802_REG_LDO15CTRL2 = 0x9E,
326 /* Reserved: 0x9F */
327 MAX77802_REG_LDO17CTRL2 = 0xA0,
328 MAX77802_REG_LDO18CTRL2 = 0xA1,
329 MAX77802_REG_LDO19CTRL2 = 0xA2,
330 MAX77802_REG_LDO20CTRL2 = 0xA3,
331 MAX77802_REG_LDO21CTRL2 = 0xA4,
332 MAX77802_REG_LDO22CTRL2 = 0xA5,
333 MAX77802_REG_LDO23CTRL2 = 0xA6,
334 MAX77802_REG_LDO24CTRL2 = 0xA7,
335 MAX77802_REG_LDO25CTRL2 = 0xA8,
336 MAX77802_REG_LDO26CTRL2 = 0xA9,
337 MAX77802_REG_LDO27CTRL2 = 0xAA,
338 MAX77802_REG_LDO28CTRL2 = 0xAB,
339 MAX77802_REG_LDO29CTRL2 = 0xAC,
340 MAX77802_REG_LDO30CTRL2 = 0xAD,
341 /* Reserved: 0xAE */
342 MAX77802_REG_LDO32CTRL2 = 0xAF,
343 MAX77802_REG_LDO33CTRL2 = 0xB0,
344 MAX77802_REG_LDO34CTRL2 = 0xB1,
345 MAX77802_REG_LDO35CTRL2 = 0xB2,
346 /* Reserved: 0xB3 */
347
348 MAX77802_REG_BBAT_CHG = 0xB4,
349 MAX77802_REG_32KHZ = 0xB5,
350
351 MAX77802_REG_PMIC_END = 0xB6,
352};
353
354enum max77802_rtc_reg {
355 MAX77802_RTC_INT = 0xC0,
356 MAX77802_RTC_INTM = 0xC1,
357 MAX77802_RTC_CONTROLM = 0xC2,
358 MAX77802_RTC_CONTROL = 0xC3,
359 MAX77802_RTC_UPDATE0 = 0xC4,
360 MAX77802_RTC_UPDATE1 = 0xC5,
361 MAX77802_WTSR_SMPL_CNTL = 0xC6,
362 MAX77802_RTC_SEC = 0xC7,
363 MAX77802_RTC_MIN = 0xC8,
364 MAX77802_RTC_HOUR = 0xC9,
365 MAX77802_RTC_WEEKDAY = 0xCA,
366 MAX77802_RTC_MONTH = 0xCB,
367 MAX77802_RTC_YEAR = 0xCC,
368 MAX77802_RTC_DATE = 0xCD,
369 MAX77802_RTC_AE1 = 0xCE,
370 MAX77802_ALARM1_SEC = 0xCF,
371 MAX77802_ALARM1_MIN = 0xD0,
372 MAX77802_ALARM1_HOUR = 0xD1,
373 MAX77802_ALARM1_WEEKDAY = 0xD2,
374 MAX77802_ALARM1_MONTH = 0xD3,
375 MAX77802_ALARM1_YEAR = 0xD4,
376 MAX77802_ALARM1_DATE = 0xD5,
377 MAX77802_RTC_AE2 = 0xD6,
378 MAX77802_ALARM2_SEC = 0xD7,
379 MAX77802_ALARM2_MIN = 0xD8,
380 MAX77802_ALARM2_HOUR = 0xD9,
381 MAX77802_ALARM2_WEEKDAY = 0xDA,
382 MAX77802_ALARM2_MONTH = 0xDB,
383 MAX77802_ALARM2_YEAR = 0xDC,
384 MAX77802_ALARM2_DATE = 0xDD,
385
386 MAX77802_RTC_END = 0xDF,
387};
186 388
187enum max77686_irq_source { 389enum max77686_irq_source {
188 PMIC_INT1 = 0, 390 PMIC_INT1 = 0,
@@ -205,30 +407,46 @@ enum max77686_irq {
205 MAX77686_PMICIRQ_140C, 407 MAX77686_PMICIRQ_140C,
206 MAX77686_PMICIRQ_120C, 408 MAX77686_PMICIRQ_120C,
207 409
208 MAX77686_RTCIRQ_RTC60S, 410 MAX77686_RTCIRQ_RTC60S = 0,
209 MAX77686_RTCIRQ_RTCA1, 411 MAX77686_RTCIRQ_RTCA1,
210 MAX77686_RTCIRQ_RTCA2, 412 MAX77686_RTCIRQ_RTCA2,
211 MAX77686_RTCIRQ_SMPL, 413 MAX77686_RTCIRQ_SMPL,
212 MAX77686_RTCIRQ_RTC1S, 414 MAX77686_RTCIRQ_RTC1S,
213 MAX77686_RTCIRQ_WTSR, 415 MAX77686_RTCIRQ_WTSR,
214
215 MAX77686_IRQ_NR,
216}; 416};
217 417
418#define MAX77686_INT1_PWRONF_MSK BIT(0)
419#define MAX77686_INT1_PWRONR_MSK BIT(1)
420#define MAX77686_INT1_JIGONBF_MSK BIT(2)
421#define MAX77686_INT1_JIGONBR_MSK BIT(3)
422#define MAX77686_INT1_ACOKBF_MSK BIT(4)
423#define MAX77686_INT1_ACOKBR_MSK BIT(5)
424#define MAX77686_INT1_ONKEY1S_MSK BIT(6)
425#define MAX77686_INT1_MRSTB_MSK BIT(7)
426
427#define MAX77686_INT2_140C_MSK BIT(0)
428#define MAX77686_INT2_120C_MSK BIT(1)
429
430#define MAX77686_RTCINT_RTC60S_MSK BIT(0)
431#define MAX77686_RTCINT_RTCA1_MSK BIT(1)
432#define MAX77686_RTCINT_RTCA2_MSK BIT(2)
433#define MAX77686_RTCINT_SMPL_MSK BIT(3)
434#define MAX77686_RTCINT_RTC1S_MSK BIT(4)
435#define MAX77686_RTCINT_WTSR_MSK BIT(5)
436
218struct max77686_dev { 437struct max77686_dev {
219 struct device *dev; 438 struct device *dev;
220 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */ 439 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
221 struct i2c_client *rtc; /* slave addr 0x0c */ 440 struct i2c_client *rtc; /* slave addr 0x0c */
222 441
223 int type; 442 unsigned long type;
224 443
225 struct regmap *regmap; /* regmap for mfd */ 444 struct regmap *regmap; /* regmap for mfd */
226 struct regmap *rtc_regmap; /* regmap for rtc */ 445 struct regmap *rtc_regmap; /* regmap for rtc */
227 446 struct regmap_irq_chip_data *irq_data;
228 struct irq_domain *irq_domain; 447 struct regmap_irq_chip_data *rtc_irq_data;
229 448
230 int irq; 449 int irq;
231 int irq_gpio;
232 bool wakeup; 450 bool wakeup;
233 struct mutex irqlock; 451 struct mutex irqlock;
234 int irq_masks_cur[MAX77686_IRQ_GROUP_NR]; 452 int irq_masks_cur[MAX77686_IRQ_GROUP_NR];
@@ -237,6 +455,7 @@ struct max77686_dev {
237 455
238enum max77686_types { 456enum max77686_types {
239 TYPE_MAX77686, 457 TYPE_MAX77686,
458 TYPE_MAX77802,
240}; 459};
241 460
242extern int max77686_irq_init(struct max77686_dev *max77686); 461extern int max77686_irq_init(struct max77686_dev *max77686);
diff --git a/include/linux/mfd/max77686.h b/include/linux/mfd/max77686.h
index 46c0f320ed76..7e6dc4b2b795 100644
--- a/include/linux/mfd/max77686.h
+++ b/include/linux/mfd/max77686.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * max77686.h - Driver for the Maxim 77686 2 * max77686.h - Driver for the Maxim 77686/802
3 * 3 *
4 * Copyright (C) 2012 Samsung Electrnoics 4 * Copyright (C) 2012 Samsung Electrnoics
5 * Chiwoong Byun <woong.byun@samsung.com> 5 * Chiwoong Byun <woong.byun@samsung.com>
@@ -71,6 +71,54 @@ enum max77686_regulators {
71 MAX77686_REG_MAX, 71 MAX77686_REG_MAX,
72}; 72};
73 73
74/* MAX77802 regulator IDs */
75enum max77802_regulators {
76 MAX77802_BUCK1 = 0,
77 MAX77802_BUCK2,
78 MAX77802_BUCK3,
79 MAX77802_BUCK4,
80 MAX77802_BUCK5,
81 MAX77802_BUCK6,
82 MAX77802_BUCK7,
83 MAX77802_BUCK8,
84 MAX77802_BUCK9,
85 MAX77802_BUCK10,
86 MAX77802_LDO1,
87 MAX77802_LDO2,
88 MAX77802_LDO3,
89 MAX77802_LDO4,
90 MAX77802_LDO5,
91 MAX77802_LDO6,
92 MAX77802_LDO7,
93 MAX77802_LDO8,
94 MAX77802_LDO9,
95 MAX77802_LDO10,
96 MAX77802_LDO11,
97 MAX77802_LDO12,
98 MAX77802_LDO13,
99 MAX77802_LDO14,
100 MAX77802_LDO15,
101 MAX77802_LDO17,
102 MAX77802_LDO18,
103 MAX77802_LDO19,
104 MAX77802_LDO20,
105 MAX77802_LDO21,
106 MAX77802_LDO23,
107 MAX77802_LDO24,
108 MAX77802_LDO25,
109 MAX77802_LDO26,
110 MAX77802_LDO27,
111 MAX77802_LDO28,
112 MAX77802_LDO29,
113 MAX77802_LDO30,
114 MAX77802_LDO32,
115 MAX77802_LDO33,
116 MAX77802_LDO34,
117 MAX77802_LDO35,
118
119 MAX77802_REG_MAX,
120};
121
74struct max77686_regulator_data { 122struct max77686_regulator_data {
75 int id; 123 int id;
76 struct regulator_init_data *initdata; 124 struct regulator_init_data *initdata;
@@ -83,14 +131,19 @@ enum max77686_opmode {
83 MAX77686_OPMODE_STANDBY, 131 MAX77686_OPMODE_STANDBY,
84}; 132};
85 133
134enum max77802_opmode {
135 MAX77802_OPMODE_OFF,
136 MAX77802_OPMODE_STANDBY,
137 MAX77802_OPMODE_LP,
138 MAX77802_OPMODE_NORMAL,
139};
140
86struct max77686_opmode_data { 141struct max77686_opmode_data {
87 int id; 142 int id;
88 int mode; 143 int mode;
89}; 144};
90 145
91struct max77686_platform_data { 146struct max77686_platform_data {
92 /* IRQ */
93 int irq_gpio;
94 int ono; 147 int ono;
95 int wakeup; 148 int wakeup;
96 149
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index c466ff3e16b8..582e67f34054 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -46,7 +46,7 @@ enum max77693_pmic_reg {
46 MAX77693_LED_REG_VOUT_FLASH2 = 0x0C, 46 MAX77693_LED_REG_VOUT_FLASH2 = 0x0C,
47 MAX77693_LED_REG_FLASH_INT = 0x0E, 47 MAX77693_LED_REG_FLASH_INT = 0x0E,
48 MAX77693_LED_REG_FLASH_INT_MASK = 0x0F, 48 MAX77693_LED_REG_FLASH_INT_MASK = 0x0F,
49 MAX77693_LED_REG_FLASH_INT_STATUS = 0x10, 49 MAX77693_LED_REG_FLASH_STATUS = 0x10,
50 50
51 MAX77693_PMIC_REG_PMIC_ID1 = 0x20, 51 MAX77693_PMIC_REG_PMIC_ID1 = 0x20,
52 MAX77693_PMIC_REG_PMIC_ID2 = 0x21, 52 MAX77693_PMIC_REG_PMIC_ID2 = 0x21,
@@ -85,6 +85,65 @@ enum max77693_pmic_reg {
85 MAX77693_PMIC_REG_END, 85 MAX77693_PMIC_REG_END,
86}; 86};
87 87
88/* MAX77693 ITORCH register */
89#define TORCH_IOUT1_SHIFT 0
90#define TORCH_IOUT2_SHIFT 4
91#define TORCH_IOUT_MIN 15625
92#define TORCH_IOUT_MAX 250000
93#define TORCH_IOUT_STEP 15625
94
95/* MAX77693 IFLASH1 and IFLASH2 registers */
96#define FLASH_IOUT_MIN 15625
97#define FLASH_IOUT_MAX_1LED 1000000
98#define FLASH_IOUT_MAX_2LEDS 625000
99#define FLASH_IOUT_STEP 15625
100
101/* MAX77693 TORCH_TIMER register */
102#define TORCH_TMR_NO_TIMER 0x40
103#define TORCH_TIMEOUT_MIN 262000
104#define TORCH_TIMEOUT_MAX 15728000
105
106/* MAX77693 FLASH_TIMER register */
107#define FLASH_TMR_LEVEL 0x80
108#define FLASH_TIMEOUT_MIN 62500
109#define FLASH_TIMEOUT_MAX 1000000
110#define FLASH_TIMEOUT_STEP 62500
111
112/* MAX77693 FLASH_EN register */
113#define FLASH_EN_OFF 0x0
114#define FLASH_EN_FLASH 0x1
115#define FLASH_EN_TORCH 0x2
116#define FLASH_EN_ON 0x3
117#define FLASH_EN_SHIFT(x) (6 - ((x) - 1) * 2)
118#define TORCH_EN_SHIFT(x) (2 - ((x) - 1) * 2)
119
120/* MAX77693 MAX_FLASH1 register */
121#define MAX_FLASH1_MAX_FL_EN 0x80
122#define MAX_FLASH1_VSYS_MIN 2400
123#define MAX_FLASH1_VSYS_MAX 3400
124#define MAX_FLASH1_VSYS_STEP 33
125
126/* MAX77693 VOUT_CNTL register */
127#define FLASH_BOOST_FIXED 0x04
128#define FLASH_BOOST_LEDNUM_2 0x80
129
130/* MAX77693 VOUT_FLASH1 register */
131#define FLASH_VOUT_MIN 3300
132#define FLASH_VOUT_MAX 5500
133#define FLASH_VOUT_STEP 25
134#define FLASH_VOUT_RMIN 0x0c
135
136/* MAX77693 FLASH_STATUS register */
137#define FLASH_STATUS_FLASH_ON BIT(3)
138#define FLASH_STATUS_TORCH_ON BIT(2)
139
140/* MAX77693 FLASH_INT register */
141#define FLASH_INT_FLED2_OPEN BIT(0)
142#define FLASH_INT_FLED2_SHORT BIT(1)
143#define FLASH_INT_FLED1_OPEN BIT(2)
144#define FLASH_INT_FLED1_SHORT BIT(3)
145#define FLASH_INT_OVER_CURRENT BIT(4)
146
88/* MAX77693 CHG_CNFG_00 register */ 147/* MAX77693 CHG_CNFG_00 register */
89#define CHG_CNFG_00_CHG_MASK 0x1 148#define CHG_CNFG_00_CHG_MASK 0x1
90#define CHG_CNFG_00_BUCK_MASK 0x4 149#define CHG_CNFG_00_BUCK_MASK 0x4
@@ -251,6 +310,15 @@ enum max77693_haptic_reg {
251 MAX77693_HAPTIC_REG_END, 310 MAX77693_HAPTIC_REG_END,
252}; 311};
253 312
313/* max77693-pmic LSCNFG configuraton register */
314#define MAX77693_PMIC_LOW_SYS_MASK 0x80
315#define MAX77693_PMIC_LOW_SYS_SHIFT 7
316
317/* max77693-haptic configuration register */
318#define MAX77693_CONFIG2_MODE 7
319#define MAX77693_CONFIG2_MEN 6
320#define MAX77693_CONFIG2_HTYP 5
321
254enum max77693_irq_source { 322enum max77693_irq_source {
255 LED_INT = 0, 323 LED_INT = 0,
256 TOPSYS_INT, 324 TOPSYS_INT,
@@ -262,6 +330,13 @@ enum max77693_irq_source {
262 MAX77693_IRQ_GROUP_NR, 330 MAX77693_IRQ_GROUP_NR,
263}; 331};
264 332
333#define SRC_IRQ_CHARGER BIT(0)
334#define SRC_IRQ_TOP BIT(1)
335#define SRC_IRQ_FLASH BIT(2)
336#define SRC_IRQ_MUIC BIT(3)
337#define SRC_IRQ_ALL (SRC_IRQ_CHARGER | SRC_IRQ_TOP \
338 | SRC_IRQ_FLASH | SRC_IRQ_MUIC)
339
265#define LED_IRQ_FLED2_OPEN BIT(0) 340#define LED_IRQ_FLED2_OPEN BIT(0)
266#define LED_IRQ_FLED2_SHORT BIT(1) 341#define LED_IRQ_FLED2_SHORT BIT(1)
267#define LED_IRQ_FLED1_OPEN BIT(2) 342#define LED_IRQ_FLED1_OPEN BIT(2)
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index 3f3dc45f93ee..f0b6585cd874 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -63,6 +63,45 @@ struct max77693_muic_platform_data {
63 int path_uart; 63 int path_uart;
64}; 64};
65 65
66/* MAX77693 led flash */
67
68/* triggers */
69enum max77693_led_trigger {
70 MAX77693_LED_TRIG_OFF,
71 MAX77693_LED_TRIG_FLASH,
72 MAX77693_LED_TRIG_TORCH,
73 MAX77693_LED_TRIG_EXT,
74 MAX77693_LED_TRIG_SOFT,
75};
76
77/* trigger types */
78enum max77693_led_trigger_type {
79 MAX77693_LED_TRIG_TYPE_EDGE,
80 MAX77693_LED_TRIG_TYPE_LEVEL,
81};
82
83/* boost modes */
84enum max77693_led_boost_mode {
85 MAX77693_LED_BOOST_NONE,
86 MAX77693_LED_BOOST_ADAPTIVE,
87 MAX77693_LED_BOOST_FIXED,
88};
89
90struct max77693_led_platform_data {
91 u32 fleds[2];
92 u32 iout_torch[2];
93 u32 iout_flash[2];
94 u32 trigger[2];
95 u32 trigger_type[2];
96 u32 num_leds;
97 u32 boost_mode;
98 u32 flash_timeout;
99 u32 boost_vout;
100 u32 low_vsys;
101};
102
103/* MAX77693 */
104
66struct max77693_platform_data { 105struct max77693_platform_data {
67 /* regulator data */ 106 /* regulator data */
68 struct max77693_regulator_data *regulators; 107 struct max77693_regulator_data *regulators;
@@ -70,5 +109,6 @@ struct max77693_platform_data {
70 109
71 /* muic data */ 110 /* muic data */
72 struct max77693_muic_platform_data *muic_data; 111 struct max77693_muic_platform_data *muic_data;
112 struct max77693_led_platform_data *led_data;
73}; 113};
74#endif /* __LINUX_MFD_MAX77693_H */ 114#endif /* __LINUX_MFD_MAX77693_H */
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
index a8eeda773a7b..4ff6137d8d67 100644
--- a/include/linux/mfd/mc13783.h
+++ b/include/linux/mfd/mc13783.h
@@ -86,6 +86,5 @@
86#define MC13783_IRQ_HSL 43 86#define MC13783_IRQ_HSL 43
87#define MC13783_IRQ_ALSPTH 44 87#define MC13783_IRQ_ALSPTH 44
88#define MC13783_IRQ_AHSSHORT 45 88#define MC13783_IRQ_AHSSHORT 45
89#define MC13783_NUM_IRQ MC13XXX_NUM_IRQ
90 89
91#endif /* ifndef __LINUX_MFD_MC13783_H */ 90#endif /* ifndef __LINUX_MFD_MC13783_H */
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index d63b1d309106..638222e43e48 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -23,15 +23,10 @@ int mc13xxx_reg_rmw(struct mc13xxx *mc13xxx, unsigned int offset,
23 23
24int mc13xxx_irq_request(struct mc13xxx *mc13xxx, int irq, 24int mc13xxx_irq_request(struct mc13xxx *mc13xxx, int irq,
25 irq_handler_t handler, const char *name, void *dev); 25 irq_handler_t handler, const char *name, void *dev);
26int mc13xxx_irq_request_nounmask(struct mc13xxx *mc13xxx, int irq,
27 irq_handler_t handler, const char *name, void *dev);
28int mc13xxx_irq_free(struct mc13xxx *mc13xxx, int irq, void *dev); 26int mc13xxx_irq_free(struct mc13xxx *mc13xxx, int irq, void *dev);
29 27
30int mc13xxx_irq_mask(struct mc13xxx *mc13xxx, int irq);
31int mc13xxx_irq_unmask(struct mc13xxx *mc13xxx, int irq);
32int mc13xxx_irq_status(struct mc13xxx *mc13xxx, int irq, 28int mc13xxx_irq_status(struct mc13xxx *mc13xxx, int irq,
33 int *enabled, int *pending); 29 int *enabled, int *pending);
34int mc13xxx_irq_ack(struct mc13xxx *mc13xxx, int irq);
35 30
36int mc13xxx_get_flags(struct mc13xxx *mc13xxx); 31int mc13xxx_get_flags(struct mc13xxx *mc13xxx);
37 32
@@ -39,6 +34,22 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
39 unsigned int mode, unsigned int channel, 34 unsigned int mode, unsigned int channel,
40 u8 ato, bool atox, unsigned int *sample); 35 u8 ato, bool atox, unsigned int *sample);
41 36
37/* Deprecated calls */
38static inline int mc13xxx_irq_ack(struct mc13xxx *mc13xxx, int irq)
39{
40 return 0;
41}
42
43static inline int mc13xxx_irq_request_nounmask(struct mc13xxx *mc13xxx, int irq,
44 irq_handler_t handler,
45 const char *name, void *dev)
46{
47 return mc13xxx_irq_request(mc13xxx, irq, handler, name, dev);
48}
49
50int mc13xxx_irq_mask(struct mc13xxx *mc13xxx, int irq);
51int mc13xxx_irq_unmask(struct mc13xxx *mc13xxx, int irq);
52
42#define MC13783_AUDIO_RX0 36 53#define MC13783_AUDIO_RX0 36
43#define MC13783_AUDIO_RX1 37 54#define MC13783_AUDIO_RX1 37
44#define MC13783_AUDIO_TX 38 55#define MC13783_AUDIO_TX 38
@@ -68,8 +79,6 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
68#define MC13XXX_IRQ_THWARNH 37 79#define MC13XXX_IRQ_THWARNH 37
69#define MC13XXX_IRQ_CLK 38 80#define MC13XXX_IRQ_CLK 38
70 81
71#define MC13XXX_NUM_IRQ 46
72
73struct regulator_init_data; 82struct regulator_init_data;
74 83
75struct mc13xxx_regulator_init_data { 84struct mc13xxx_regulator_init_data {
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
new file mode 100644
index 000000000000..fb09312d854b
--- /dev/null
+++ b/include/linux/mfd/rk808.h
@@ -0,0 +1,196 @@
1/*
2 * rk808.h for Rockchip RK808
3 *
4 * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
5 *
6 * Author: Chris Zhong <zyw@rock-chips.com>
7 * Author: Zhang Qing <zhangqing@rock-chips.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms and conditions of the GNU General Public License,
11 * version 2, as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 */
18
19#ifndef __LINUX_REGULATOR_rk808_H
20#define __LINUX_REGULATOR_rk808_H
21
22#include <linux/regulator/machine.h>
23#include <linux/regmap.h>
24
25/*
26 * rk808 Global Register Map.
27 */
28
29#define RK808_DCDC1 0 /* (0+RK808_START) */
30#define RK808_LDO1 4 /* (4+RK808_START) */
31#define RK808_NUM_REGULATORS 14
32
33enum rk808_reg {
34 RK808_ID_DCDC1,
35 RK808_ID_DCDC2,
36 RK808_ID_DCDC3,
37 RK808_ID_DCDC4,
38 RK808_ID_LDO1,
39 RK808_ID_LDO2,
40 RK808_ID_LDO3,
41 RK808_ID_LDO4,
42 RK808_ID_LDO5,
43 RK808_ID_LDO6,
44 RK808_ID_LDO7,
45 RK808_ID_LDO8,
46 RK808_ID_SWITCH1,
47 RK808_ID_SWITCH2,
48};
49
50#define RK808_SECONDS_REG 0x00
51#define RK808_MINUTES_REG 0x01
52#define RK808_HOURS_REG 0x02
53#define RK808_DAYS_REG 0x03
54#define RK808_MONTHS_REG 0x04
55#define RK808_YEARS_REG 0x05
56#define RK808_WEEKS_REG 0x06
57#define RK808_ALARM_SECONDS_REG 0x08
58#define RK808_ALARM_MINUTES_REG 0x09
59#define RK808_ALARM_HOURS_REG 0x0a
60#define RK808_ALARM_DAYS_REG 0x0b
61#define RK808_ALARM_MONTHS_REG 0x0c
62#define RK808_ALARM_YEARS_REG 0x0d
63#define RK808_RTC_CTRL_REG 0x10
64#define RK808_RTC_STATUS_REG 0x11
65#define RK808_RTC_INT_REG 0x12
66#define RK808_RTC_COMP_LSB_REG 0x13
67#define RK808_RTC_COMP_MSB_REG 0x14
68#define RK808_CLK32OUT_REG 0x20
69#define RK808_VB_MON_REG 0x21
70#define RK808_THERMAL_REG 0x22
71#define RK808_DCDC_EN_REG 0x23
72#define RK808_LDO_EN_REG 0x24
73#define RK808_SLEEP_SET_OFF_REG1 0x25
74#define RK808_SLEEP_SET_OFF_REG2 0x26
75#define RK808_DCDC_UV_STS_REG 0x27
76#define RK808_DCDC_UV_ACT_REG 0x28
77#define RK808_LDO_UV_STS_REG 0x29
78#define RK808_LDO_UV_ACT_REG 0x2a
79#define RK808_DCDC_PG_REG 0x2b
80#define RK808_LDO_PG_REG 0x2c
81#define RK808_VOUT_MON_TDB_REG 0x2d
82#define RK808_BUCK1_CONFIG_REG 0x2e
83#define RK808_BUCK1_ON_VSEL_REG 0x2f
84#define RK808_BUCK1_SLP_VSEL_REG 0x30
85#define RK808_BUCK1_DVS_VSEL_REG 0x31
86#define RK808_BUCK2_CONFIG_REG 0x32
87#define RK808_BUCK2_ON_VSEL_REG 0x33
88#define RK808_BUCK2_SLP_VSEL_REG 0x34
89#define RK808_BUCK2_DVS_VSEL_REG 0x35
90#define RK808_BUCK3_CONFIG_REG 0x36
91#define RK808_BUCK4_CONFIG_REG 0x37
92#define RK808_BUCK4_ON_VSEL_REG 0x38
93#define RK808_BUCK4_SLP_VSEL_REG 0x39
94#define RK808_BOOST_CONFIG_REG 0x3a
95#define RK808_LDO1_ON_VSEL_REG 0x3b
96#define RK808_LDO1_SLP_VSEL_REG 0x3c
97#define RK808_LDO2_ON_VSEL_REG 0x3d
98#define RK808_LDO2_SLP_VSEL_REG 0x3e
99#define RK808_LDO3_ON_VSEL_REG 0x3f
100#define RK808_LDO3_SLP_VSEL_REG 0x40
101#define RK808_LDO4_ON_VSEL_REG 0x41
102#define RK808_LDO4_SLP_VSEL_REG 0x42
103#define RK808_LDO5_ON_VSEL_REG 0x43
104#define RK808_LDO5_SLP_VSEL_REG 0x44
105#define RK808_LDO6_ON_VSEL_REG 0x45
106#define RK808_LDO6_SLP_VSEL_REG 0x46
107#define RK808_LDO7_ON_VSEL_REG 0x47
108#define RK808_LDO7_SLP_VSEL_REG 0x48
109#define RK808_LDO8_ON_VSEL_REG 0x49
110#define RK808_LDO8_SLP_VSEL_REG 0x4a
111#define RK808_DEVCTRL_REG 0x4b
112#define RK808_INT_STS_REG1 0x4c
113#define RK808_INT_STS_MSK_REG1 0x4d
114#define RK808_INT_STS_REG2 0x4e
115#define RK808_INT_STS_MSK_REG2 0x4f
116#define RK808_IO_POL_REG 0x50
117
118/* IRQ Definitions */
119#define RK808_IRQ_VOUT_LO 0
120#define RK808_IRQ_VB_LO 1
121#define RK808_IRQ_PWRON 2
122#define RK808_IRQ_PWRON_LP 3
123#define RK808_IRQ_HOTDIE 4
124#define RK808_IRQ_RTC_ALARM 5
125#define RK808_IRQ_RTC_PERIOD 6
126#define RK808_IRQ_PLUG_IN_INT 7
127#define RK808_IRQ_PLUG_OUT_INT 8
128#define RK808_NUM_IRQ 9
129
130#define RK808_IRQ_VOUT_LO_MSK BIT(0)
131#define RK808_IRQ_VB_LO_MSK BIT(1)
132#define RK808_IRQ_PWRON_MSK BIT(2)
133#define RK808_IRQ_PWRON_LP_MSK BIT(3)
134#define RK808_IRQ_HOTDIE_MSK BIT(4)
135#define RK808_IRQ_RTC_ALARM_MSK BIT(5)
136#define RK808_IRQ_RTC_PERIOD_MSK BIT(6)
137#define RK808_IRQ_PLUG_IN_INT_MSK BIT(0)
138#define RK808_IRQ_PLUG_OUT_INT_MSK BIT(1)
139
140#define RK808_VBAT_LOW_2V8 0x00
141#define RK808_VBAT_LOW_2V9 0x01
142#define RK808_VBAT_LOW_3V0 0x02
143#define RK808_VBAT_LOW_3V1 0x03
144#define RK808_VBAT_LOW_3V2 0x04
145#define RK808_VBAT_LOW_3V3 0x05
146#define RK808_VBAT_LOW_3V4 0x06
147#define RK808_VBAT_LOW_3V5 0x07
148#define VBAT_LOW_VOL_MASK (0x07 << 0)
149#define EN_VABT_LOW_SHUT_DOWN (0x00 << 4)
150#define EN_VBAT_LOW_IRQ (0x1 << 4)
151#define VBAT_LOW_ACT_MASK (0x1 << 4)
152
153#define BUCK_ILMIN_MASK (7 << 0)
154#define BOOST_ILMIN_MASK (7 << 0)
155#define BUCK1_RATE_MASK (3 << 3)
156#define BUCK2_RATE_MASK (3 << 3)
157#define MASK_ALL 0xff
158
159#define SWITCH2_EN BIT(6)
160#define SWITCH1_EN BIT(5)
161#define DEV_OFF_RST BIT(3)
162
163#define VB_LO_ACT BIT(4)
164#define VB_LO_SEL_3500MV (7 << 0)
165
166#define VOUT_LO_INT BIT(0)
167#define CLK32KOUT2_EN BIT(0)
168
169enum {
170 BUCK_ILMIN_50MA,
171 BUCK_ILMIN_100MA,
172 BUCK_ILMIN_150MA,
173 BUCK_ILMIN_200MA,
174 BUCK_ILMIN_250MA,
175 BUCK_ILMIN_300MA,
176 BUCK_ILMIN_350MA,
177 BUCK_ILMIN_400MA,
178};
179
180enum {
181 BOOST_ILMIN_75MA,
182 BOOST_ILMIN_100MA,
183 BOOST_ILMIN_125MA,
184 BOOST_ILMIN_150MA,
185 BOOST_ILMIN_175MA,
186 BOOST_ILMIN_200MA,
187 BOOST_ILMIN_225MA,
188 BOOST_ILMIN_250MA,
189};
190
191struct rk808 {
192 struct i2c_client *i2c;
193 struct regmap_irq_chip_data *irq_data;
194 struct regmap *regmap;
195};
196#endif /* __LINUX_REGULATOR_rk808_H */
diff --git a/include/linux/mfd/rn5t618.h b/include/linux/mfd/rn5t618.h
new file mode 100644
index 000000000000..c72d5344f3b3
--- /dev/null
+++ b/include/linux/mfd/rn5t618.h
@@ -0,0 +1,228 @@
1/*
2 * MFD core driver for Ricoh RN5T618 PMIC
3 *
4 * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * You should have received a copy of the GNU General Public License
11 * along with this program. If not, see <http://www.gnu.org/licenses/>.
12 */
13
14#ifndef __LINUX_MFD_RN5T618_H
15#define __LINUX_MFD_RN5T618_H
16
17#include <linux/regmap.h>
18
19#define RN5T618_LSIVER 0x00
20#define RN5T618_OTPVER 0x01
21#define RN5T618_IODAC 0x02
22#define RN5T618_VINDAC 0x03
23#define RN5T618_CPUCNT 0x06
24#define RN5T618_PSWR 0x07
25#define RN5T618_PONHIS 0x09
26#define RN5T618_POFFHIS 0x0a
27#define RN5T618_WATCHDOG 0x0b
28#define RN5T618_WATCHDOGCNT 0x0c
29#define RN5T618_PWRFUNC 0x0d
30#define RN5T618_SLPCNT 0x0e
31#define RN5T618_REPCNT 0x0f
32#define RN5T618_PWRONTIMSET 0x10
33#define RN5T618_NOETIMSETCNT 0x11
34#define RN5T618_PWRIREN 0x12
35#define RN5T618_PWRIRQ 0x13
36#define RN5T618_PWRMON 0x14
37#define RN5T618_PWRIRSEL 0x15
38#define RN5T618_DC1_SLOT 0x16
39#define RN5T618_DC2_SLOT 0x17
40#define RN5T618_DC3_SLOT 0x18
41#define RN5T618_LDO1_SLOT 0x1b
42#define RN5T618_LDO2_SLOT 0x1c
43#define RN5T618_LDO3_SLOT 0x1d
44#define RN5T618_LDO4_SLOT 0x1e
45#define RN5T618_LDO5_SLOT 0x1f
46#define RN5T618_PSO0_SLOT 0x25
47#define RN5T618_PSO1_SLOT 0x26
48#define RN5T618_PSO2_SLOT 0x27
49#define RN5T618_PSO3_SLOT 0x28
50#define RN5T618_LDORTC1_SLOT 0x2a
51#define RN5T618_DC1CTL 0x2c
52#define RN5T618_DC1CTL2 0x2d
53#define RN5T618_DC2CTL 0x2e
54#define RN5T618_DC2CTL2 0x2f
55#define RN5T618_DC3CTL 0x30
56#define RN5T618_DC3CTL2 0x31
57#define RN5T618_DC1DAC 0x36
58#define RN5T618_DC2DAC 0x37
59#define RN5T618_DC3DAC 0x38
60#define RN5T618_DC1DAC_SLP 0x3b
61#define RN5T618_DC2DAC_SLP 0x3c
62#define RN5T618_DC3DAC_SLP 0x3d
63#define RN5T618_DCIREN 0x40
64#define RN5T618_DCIRQ 0x41
65#define RN5T618_DCIRMON 0x42
66#define RN5T618_LDOEN1 0x44
67#define RN5T618_LDOEN2 0x45
68#define RN5T618_LDODIS 0x46
69#define RN5T618_LDO1DAC 0x4c
70#define RN5T618_LDO2DAC 0x4d
71#define RN5T618_LDO3DAC 0x4e
72#define RN5T618_LDO4DAC 0x4f
73#define RN5T618_LDO5DAC 0x50
74#define RN5T618_LDORTCDAC 0x56
75#define RN5T618_LDORTC2DAC 0x57
76#define RN5T618_LDO1DAC_SLP 0x58
77#define RN5T618_LDO2DAC_SLP 0x59
78#define RN5T618_LDO3DAC_SLP 0x5a
79#define RN5T618_LDO4DAC_SLP 0x5b
80#define RN5T618_LDO5DAC_SLP 0x5c
81#define RN5T618_ADCCNT1 0x64
82#define RN5T618_ADCCNT2 0x65
83#define RN5T618_ADCCNT3 0x66
84#define RN5T618_ILIMDATAH 0x68
85#define RN5T618_ILIMDATAL 0x69
86#define RN5T618_VBATDATAH 0x6a
87#define RN5T618_VBATDATAL 0x6b
88#define RN5T618_VADPDATAH 0x6c
89#define RN5T618_VADPDATAL 0x6d
90#define RN5T618_VUSBDATAH 0x6e
91#define RN5T618_VUSBDATAL 0x6f
92#define RN5T618_VSYSDATAH 0x70
93#define RN5T618_VSYSDATAL 0x71
94#define RN5T618_VTHMDATAH 0x72
95#define RN5T618_VTHMDATAL 0x73
96#define RN5T618_AIN1DATAH 0x74
97#define RN5T618_AIN1DATAL 0x75
98#define RN5T618_AIN0DATAH 0x76
99#define RN5T618_AIN0DATAL 0x77
100#define RN5T618_ILIMTHL 0x78
101#define RN5T618_ILIMTHH 0x79
102#define RN5T618_VBATTHL 0x7a
103#define RN5T618_VBATTHH 0x7b
104#define RN5T618_VADPTHL 0x7c
105#define RN5T618_VADPTHH 0x7d
106#define RN5T618_VUSBTHL 0x7e
107#define RN5T618_VUSBTHH 0x7f
108#define RN5T618_VSYSTHL 0x80
109#define RN5T618_VSYSTHH 0x81
110#define RN5T618_VTHMTHL 0x82
111#define RN5T618_VTHMTHH 0x83
112#define RN5T618_AIN1THL 0x84
113#define RN5T618_AIN1THH 0x85
114#define RN5T618_AIN0THL 0x86
115#define RN5T618_AIN0THH 0x87
116#define RN5T618_EN_ADCIR1 0x88
117#define RN5T618_EN_ADCIR2 0x89
118#define RN5T618_EN_ADCIR3 0x8a
119#define RN5T618_IR_ADC1 0x8c
120#define RN5T618_IR_ADC2 0x8d
121#define RN5T618_IR_ADC3 0x8e
122#define RN5T618_IOSEL 0x90
123#define RN5T618_IOOUT 0x91
124#define RN5T618_GPEDGE1 0x92
125#define RN5T618_GPEDGE2 0x93
126#define RN5T618_EN_GPIR 0x94
127#define RN5T618_IR_GPR 0x95
128#define RN5T618_IR_GPF 0x96
129#define RN5T618_MON_IOIN 0x97
130#define RN5T618_GPLED_FUNC 0x98
131#define RN5T618_INTPOL 0x9c
132#define RN5T618_INTEN 0x9d
133#define RN5T618_INTMON 0x9e
134#define RN5T618_PREVINDAC 0xb0
135#define RN5T618_BATDAC 0xb1
136#define RN5T618_CHGCTL1 0xb3
137#define RN5T618_CHGCTL2 0xb4
138#define RN5T618_VSYSSET 0xb5
139#define RN5T618_REGISET1 0xb6
140#define RN5T618_REGISET2 0xb7
141#define RN5T618_CHGISET 0xb8
142#define RN5T618_TIMSET 0xb9
143#define RN5T618_BATSET1 0xba
144#define RN5T618_BATSET2 0xbb
145#define RN5T618_DIESET 0xbc
146#define RN5T618_CHGSTATE 0xbd
147#define RN5T618_CHGCTRL_IRFMASK 0xbe
148#define RN5T618_CHGSTAT_IRFMASK1 0xbf
149#define RN5T618_CHGSTAT_IRFMASK2 0xc0
150#define RN5T618_CHGERR_IRFMASK 0xc1
151#define RN5T618_CHGCTRL_IRR 0xc2
152#define RN5T618_CHGSTAT_IRR1 0xc3
153#define RN5T618_CHGSTAT_IRR2 0xc4
154#define RN5T618_CHGERR_IRR 0xc5
155#define RN5T618_CHGCTRL_MONI 0xc6
156#define RN5T618_CHGSTAT_MONI1 0xc7
157#define RN5T618_CHGSTAT_MONI2 0xc8
158#define RN5T618_CHGERR_MONI 0xc9
159#define RN5T618_CHGCTRL_DETMOD1 0xca
160#define RN5T618_CHGCTRL_DETMOD2 0xcb
161#define RN5T618_CHGSTAT_DETMOD1 0xcc
162#define RN5T618_CHGSTAT_DETMOD2 0xcd
163#define RN5T618_CHGSTAT_DETMOD3 0xce
164#define RN5T618_CHGERR_DETMOD1 0xcf
165#define RN5T618_CHGERR_DETMOD2 0xd0
166#define RN5T618_CHGOSCCTL 0xd4
167#define RN5T618_CHGOSCSCORESET1 0xd5
168#define RN5T618_CHGOSCSCORESET2 0xd6
169#define RN5T618_CHGOSCSCORESET3 0xd7
170#define RN5T618_CHGOSCFREQSET1 0xd8
171#define RN5T618_CHGOSCFREQSET2 0xd9
172#define RN5T618_CONTROL 0xe0
173#define RN5T618_SOC 0xe1
174#define RN5T618_RE_CAP_H 0xe2
175#define RN5T618_RE_CAP_L 0xe3
176#define RN5T618_FA_CAP_H 0xe4
177#define RN5T618_FA_CAP_L 0xe5
178#define RN5T618_AGE 0xe6
179#define RN5T618_TT_EMPTY_H 0xe7
180#define RN5T618_TT_EMPTY_L 0xe8
181#define RN5T618_TT_FULL_H 0xe9
182#define RN5T618_TT_FULL_L 0xea
183#define RN5T618_VOLTAGE_1 0xeb
184#define RN5T618_VOLTAGE_0 0xec
185#define RN5T618_TEMP_1 0xed
186#define RN5T618_TEMP_0 0xee
187#define RN5T618_CC_CTRL 0xef
188#define RN5T618_CC_COUNT2 0xf0
189#define RN5T618_CC_COUNT1 0xf1
190#define RN5T618_CC_COUNT0 0xf2
191#define RN5T618_CC_SUMREG3 0xf3
192#define RN5T618_CC_SUMREG2 0xf4
193#define RN5T618_CC_SUMREG1 0xf5
194#define RN5T618_CC_SUMREG0 0xf6
195#define RN5T618_CC_OFFREG1 0xf7
196#define RN5T618_CC_OFFREG0 0xf8
197#define RN5T618_CC_GAINREG1 0xf9
198#define RN5T618_CC_GAINREG0 0xfa
199#define RN5T618_CC_AVEREG1 0xfb
200#define RN5T618_CC_AVEREG0 0xfc
201#define RN5T618_MAX_REG 0xfc
202
203#define RN5T618_REPCNT_REPWRON BIT(0)
204#define RN5T618_SLPCNT_SWPWROFF BIT(0)
205#define RN5T618_WATCHDOG_WDOGEN BIT(2)
206#define RN5T618_WATCHDOG_WDOGTIM_M (BIT(0) | BIT(1))
207#define RN5T618_WATCHDOG_WDOGTIM_S 0
208#define RN5T618_PWRIRQ_IR_WDOG BIT(6)
209
210enum {
211 RN5T618_DCDC1,
212 RN5T618_DCDC2,
213 RN5T618_DCDC3,
214 RN5T618_LDO1,
215 RN5T618_LDO2,
216 RN5T618_LDO3,
217 RN5T618_LDO4,
218 RN5T618_LDO5,
219 RN5T618_LDORTC1,
220 RN5T618_LDORTC2,
221 RN5T618_REG_NUM,
222};
223
224struct rn5t618 {
225 struct regmap *regmap;
226};
227
228#endif /* __LINUX_MFD_RN5T618_H */
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index a3835976f7c6..74346d5e7899 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -943,6 +943,12 @@ void rtsx_pci_send_cmd_no_wait(struct rtsx_pcr *pcr);
943int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout); 943int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout);
944int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist, 944int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist,
945 int num_sg, bool read, int timeout); 945 int num_sg, bool read, int timeout);
946int rtsx_pci_dma_map_sg(struct rtsx_pcr *pcr, struct scatterlist *sglist,
947 int num_sg, bool read);
948void rtsx_pci_dma_unmap_sg(struct rtsx_pcr *pcr, struct scatterlist *sglist,
949 int num_sg, bool read);
950int rtsx_pci_dma_transfer(struct rtsx_pcr *pcr, struct scatterlist *sglist,
951 int count, bool read, int timeout);
946int rtsx_pci_read_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len); 952int rtsx_pci_read_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len);
947int rtsx_pci_write_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len); 953int rtsx_pci_write_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len);
948int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card); 954int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card);
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 47d84242940b..1825edacbda7 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -14,6 +14,27 @@
14#ifndef __LINUX_MFD_SEC_CORE_H 14#ifndef __LINUX_MFD_SEC_CORE_H
15#define __LINUX_MFD_SEC_CORE_H 15#define __LINUX_MFD_SEC_CORE_H
16 16
17/* Macros to represent minimum voltages for LDO/BUCK */
18#define MIN_3000_MV 3000000
19#define MIN_2500_MV 2500000
20#define MIN_2000_MV 2000000
21#define MIN_1800_MV 1800000
22#define MIN_1500_MV 1500000
23#define MIN_1400_MV 1400000
24#define MIN_1000_MV 1000000
25
26#define MIN_900_MV 900000
27#define MIN_850_MV 850000
28#define MIN_800_MV 800000
29#define MIN_750_MV 750000
30#define MIN_600_MV 600000
31
32/* Macros to represent steps for LDO/BUCK */
33#define STEP_50_MV 50000
34#define STEP_25_MV 25000
35#define STEP_12_5_MV 12500
36#define STEP_6_25_MV 6250
37
17enum sec_device_type { 38enum sec_device_type {
18 S5M8751X, 39 S5M8751X,
19 S5M8763X, 40 S5M8763X,
@@ -21,6 +42,7 @@ enum sec_device_type {
21 S2MPA01, 42 S2MPA01,
22 S2MPS11X, 43 S2MPS11X,
23 S2MPS14X, 44 S2MPS14X,
45 S2MPU02,
24}; 46};
25 47
26/** 48/**
diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/irq.h
index 1224f447356b..f35af7361b60 100644
--- a/include/linux/mfd/samsung/irq.h
+++ b/include/linux/mfd/samsung/irq.h
@@ -129,6 +129,30 @@ enum s2mps14_irq {
129 S2MPS14_IRQ_NR, 129 S2MPS14_IRQ_NR,
130}; 130};
131 131
132enum s2mpu02_irq {
133 S2MPU02_IRQ_PWRONF,
134 S2MPU02_IRQ_PWRONR,
135 S2MPU02_IRQ_JIGONBF,
136 S2MPU02_IRQ_JIGONBR,
137 S2MPU02_IRQ_ACOKBF,
138 S2MPU02_IRQ_ACOKBR,
139 S2MPU02_IRQ_PWRON1S,
140 S2MPU02_IRQ_MRB,
141
142 S2MPU02_IRQ_RTC60S,
143 S2MPU02_IRQ_RTCA1,
144 S2MPU02_IRQ_RTCA0,
145 S2MPU02_IRQ_SMPL,
146 S2MPU02_IRQ_RTC1S,
147 S2MPU02_IRQ_WTSR,
148
149 S2MPU02_IRQ_INT120C,
150 S2MPU02_IRQ_INT140C,
151 S2MPU02_IRQ_TSD,
152
153 S2MPU02_IRQ_NR,
154};
155
132/* Masks for interrupts are the same as in s2mps11 */ 156/* Masks for interrupts are the same as in s2mps11 */
133#define S2MPS14_IRQ_TSD_MASK (1 << 2) 157#define S2MPS14_IRQ_TSD_MASK (1 << 2)
134 158
diff --git a/include/linux/mfd/samsung/s2mpa01.h b/include/linux/mfd/samsung/s2mpa01.h
index fbc63bc0d6a2..2766108bca2f 100644
--- a/include/linux/mfd/samsung/s2mpa01.h
+++ b/include/linux/mfd/samsung/s2mpa01.h
@@ -155,18 +155,6 @@ enum s2mpa01_regulators {
155 S2MPA01_REGULATOR_MAX, 155 S2MPA01_REGULATOR_MAX,
156}; 156};
157 157
158#define S2MPA01_BUCK_MIN1 600000
159#define S2MPA01_BUCK_MIN2 800000
160#define S2MPA01_BUCK_MIN3 1000000
161#define S2MPA01_BUCK_MIN4 1500000
162#define S2MPA01_LDO_MIN 800000
163
164#define S2MPA01_BUCK_STEP1 6250
165#define S2MPA01_BUCK_STEP2 12500
166
167#define S2MPA01_LDO_STEP1 50000
168#define S2MPA01_LDO_STEP2 25000
169
170#define S2MPA01_LDO_VSEL_MASK 0x3F 158#define S2MPA01_LDO_VSEL_MASK 0x3F
171#define S2MPA01_BUCK_VSEL_MASK 0xFF 159#define S2MPA01_BUCK_VSEL_MASK 0xFF
172#define S2MPA01_ENABLE_MASK (0x03 << S2MPA01_ENABLE_SHIFT) 160#define S2MPA01_ENABLE_MASK (0x03 << S2MPA01_ENABLE_SHIFT)
diff --git a/include/linux/mfd/samsung/s2mps11.h b/include/linux/mfd/samsung/s2mps11.h
index b3ddf98dec37..7981a9d77d3f 100644
--- a/include/linux/mfd/samsung/s2mps11.h
+++ b/include/linux/mfd/samsung/s2mps11.h
@@ -171,15 +171,6 @@ enum s2mps11_regulators {
171 S2MPS11_REGULATOR_MAX, 171 S2MPS11_REGULATOR_MAX,
172}; 172};
173 173
174#define S2MPS11_BUCK_MIN1 600000
175#define S2MPS11_BUCK_MIN2 750000
176#define S2MPS11_BUCK_MIN3 3000000
177#define S2MPS11_LDO_MIN 800000
178#define S2MPS11_BUCK_STEP1 6250
179#define S2MPS11_BUCK_STEP2 12500
180#define S2MPS11_BUCK_STEP3 25000
181#define S2MPS11_LDO_STEP1 50000
182#define S2MPS11_LDO_STEP2 25000
183#define S2MPS11_LDO_VSEL_MASK 0x3F 174#define S2MPS11_LDO_VSEL_MASK 0x3F
184#define S2MPS11_BUCK_VSEL_MASK 0xFF 175#define S2MPS11_BUCK_VSEL_MASK 0xFF
185#define S2MPS11_ENABLE_MASK (0x03 << S2MPS11_ENABLE_SHIFT) 176#define S2MPS11_ENABLE_MASK (0x03 << S2MPS11_ENABLE_SHIFT)
diff --git a/include/linux/mfd/samsung/s2mps14.h b/include/linux/mfd/samsung/s2mps14.h
index 900cd7a04314..c92f4782afb5 100644
--- a/include/linux/mfd/samsung/s2mps14.h
+++ b/include/linux/mfd/samsung/s2mps14.h
@@ -123,10 +123,6 @@ enum s2mps14_regulators {
123}; 123};
124 124
125/* Regulator constraints for BUCKx */ 125/* Regulator constraints for BUCKx */
126#define S2MPS14_BUCK1235_MIN_600MV 600000
127#define S2MPS14_BUCK4_MIN_1400MV 1400000
128#define S2MPS14_BUCK1235_STEP_6_25MV 6250
129#define S2MPS14_BUCK4_STEP_12_5MV 12500
130#define S2MPS14_BUCK1235_START_SEL 0x20 126#define S2MPS14_BUCK1235_START_SEL 0x20
131#define S2MPS14_BUCK4_START_SEL 0x40 127#define S2MPS14_BUCK4_START_SEL 0x40
132/* 128/*
@@ -136,12 +132,6 @@ enum s2mps14_regulators {
136 */ 132 */
137#define S2MPS14_BUCK_RAMP_DELAY 12500 133#define S2MPS14_BUCK_RAMP_DELAY 12500
138 134
139/* Regulator constraints for different types of LDOx */
140#define S2MPS14_LDO_MIN_800MV 800000
141#define S2MPS14_LDO_MIN_1800MV 1800000
142#define S2MPS14_LDO_STEP_12_5MV 12500
143#define S2MPS14_LDO_STEP_25MV 25000
144
145#define S2MPS14_LDO_VSEL_MASK 0x3F 135#define S2MPS14_LDO_VSEL_MASK 0x3F
146#define S2MPS14_BUCK_VSEL_MASK 0xFF 136#define S2MPS14_BUCK_VSEL_MASK 0xFF
147#define S2MPS14_ENABLE_MASK (0x03 << S2MPS14_ENABLE_SHIFT) 137#define S2MPS14_ENABLE_MASK (0x03 << S2MPS14_ENABLE_SHIFT)
diff --git a/include/linux/mfd/samsung/s2mpu02.h b/include/linux/mfd/samsung/s2mpu02.h
new file mode 100644
index 000000000000..47ae9bc583a7
--- /dev/null
+++ b/include/linux/mfd/samsung/s2mpu02.h
@@ -0,0 +1,201 @@
1/*
2 * s2mpu02.h
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#ifndef __LINUX_MFD_S2MPU02_H
20#define __LINUX_MFD_S2MPU02_H
21
22/* S2MPU02 registers */
23enum S2MPU02_reg {
24 S2MPU02_REG_ID,
25 S2MPU02_REG_INT1,
26 S2MPU02_REG_INT2,
27 S2MPU02_REG_INT3,
28 S2MPU02_REG_INT1M,
29 S2MPU02_REG_INT2M,
30 S2MPU02_REG_INT3M,
31 S2MPU02_REG_ST1,
32 S2MPU02_REG_ST2,
33 S2MPU02_REG_PWRONSRC,
34 S2MPU02_REG_OFFSRC,
35 S2MPU02_REG_BU_CHG,
36 S2MPU02_REG_RTCCTRL,
37 S2MPU02_REG_PMCTRL1,
38 S2MPU02_REG_RSVD1,
39 S2MPU02_REG_RSVD2,
40 S2MPU02_REG_RSVD3,
41 S2MPU02_REG_RSVD4,
42 S2MPU02_REG_RSVD5,
43 S2MPU02_REG_RSVD6,
44 S2MPU02_REG_RSVD7,
45 S2MPU02_REG_WRSTEN,
46 S2MPU02_REG_RSVD8,
47 S2MPU02_REG_RSVD9,
48 S2MPU02_REG_RSVD10,
49 S2MPU02_REG_B1CTRL1,
50 S2MPU02_REG_B1CTRL2,
51 S2MPU02_REG_B2CTRL1,
52 S2MPU02_REG_B2CTRL2,
53 S2MPU02_REG_B3CTRL1,
54 S2MPU02_REG_B3CTRL2,
55 S2MPU02_REG_B4CTRL1,
56 S2MPU02_REG_B4CTRL2,
57 S2MPU02_REG_B5CTRL1,
58 S2MPU02_REG_B5CTRL2,
59 S2MPU02_REG_B5CTRL3,
60 S2MPU02_REG_B5CTRL4,
61 S2MPU02_REG_B5CTRL5,
62 S2MPU02_REG_B6CTRL1,
63 S2MPU02_REG_B6CTRL2,
64 S2MPU02_REG_B7CTRL1,
65 S2MPU02_REG_B7CTRL2,
66 S2MPU02_REG_RAMP1,
67 S2MPU02_REG_RAMP2,
68 S2MPU02_REG_L1CTRL,
69 S2MPU02_REG_L2CTRL1,
70 S2MPU02_REG_L2CTRL2,
71 S2MPU02_REG_L2CTRL3,
72 S2MPU02_REG_L2CTRL4,
73 S2MPU02_REG_L3CTRL,
74 S2MPU02_REG_L4CTRL,
75 S2MPU02_REG_L5CTRL,
76 S2MPU02_REG_L6CTRL,
77 S2MPU02_REG_L7CTRL,
78 S2MPU02_REG_L8CTRL,
79 S2MPU02_REG_L9CTRL,
80 S2MPU02_REG_L10CTRL,
81 S2MPU02_REG_L11CTRL,
82 S2MPU02_REG_L12CTRL,
83 S2MPU02_REG_L13CTRL,
84 S2MPU02_REG_L14CTRL,
85 S2MPU02_REG_L15CTRL,
86 S2MPU02_REG_L16CTRL,
87 S2MPU02_REG_L17CTRL,
88 S2MPU02_REG_L18CTRL,
89 S2MPU02_REG_L19CTRL,
90 S2MPU02_REG_L20CTRL,
91 S2MPU02_REG_L21CTRL,
92 S2MPU02_REG_L22CTRL,
93 S2MPU02_REG_L23CTRL,
94 S2MPU02_REG_L24CTRL,
95 S2MPU02_REG_L25CTRL,
96 S2MPU02_REG_L26CTRL,
97 S2MPU02_REG_L27CTRL,
98 S2MPU02_REG_L28CTRL,
99 S2MPU02_REG_LDODSCH1,
100 S2MPU02_REG_LDODSCH2,
101 S2MPU02_REG_LDODSCH3,
102 S2MPU02_REG_LDODSCH4,
103 S2MPU02_REG_SELMIF,
104 S2MPU02_REG_RSVD11,
105 S2MPU02_REG_RSVD12,
106 S2MPU02_REG_RSVD13,
107 S2MPU02_REG_DVSSEL,
108 S2MPU02_REG_DVSPTR,
109 S2MPU02_REG_DVSDATA,
110};
111
112/* S2MPU02 regulator ids */
113enum S2MPU02_regulators {
114 S2MPU02_LDO1,
115 S2MPU02_LDO2,
116 S2MPU02_LDO3,
117 S2MPU02_LDO4,
118 S2MPU02_LDO5,
119 S2MPU02_LDO6,
120 S2MPU02_LDO7,
121 S2MPU02_LDO8,
122 S2MPU02_LDO9,
123 S2MPU02_LDO10,
124 S2MPU02_LDO11,
125 S2MPU02_LDO12,
126 S2MPU02_LDO13,
127 S2MPU02_LDO14,
128 S2MPU02_LDO15,
129 S2MPU02_LDO16,
130 S2MPU02_LDO17,
131 S2MPU02_LDO18,
132 S2MPU02_LDO19,
133 S2MPU02_LDO20,
134 S2MPU02_LDO21,
135 S2MPU02_LDO22,
136 S2MPU02_LDO23,
137 S2MPU02_LDO24,
138 S2MPU02_LDO25,
139 S2MPU02_LDO26,
140 S2MPU02_LDO27,
141 S2MPU02_LDO28,
142 S2MPU02_BUCK1,
143 S2MPU02_BUCK2,
144 S2MPU02_BUCK3,
145 S2MPU02_BUCK4,
146 S2MPU02_BUCK5,
147 S2MPU02_BUCK6,
148 S2MPU02_BUCK7,
149
150 S2MPU02_REGULATOR_MAX,
151};
152
153/* Regulator constraints for BUCKx */
154#define S2MPU02_BUCK1234_MIN_600MV 600000
155#define S2MPU02_BUCK5_MIN_1081_25MV 1081250
156#define S2MPU02_BUCK6_MIN_1700MV 1700000
157#define S2MPU02_BUCK7_MIN_900MV 900000
158
159#define S2MPU02_BUCK1234_STEP_6_25MV 6250
160#define S2MPU02_BUCK5_STEP_6_25MV 6250
161#define S2MPU02_BUCK6_STEP_2_50MV 2500
162#define S2MPU02_BUCK7_STEP_6_25MV 6250
163
164#define S2MPU02_BUCK1234_START_SEL 0x00
165#define S2MPU02_BUCK5_START_SEL 0x4D
166#define S2MPU02_BUCK6_START_SEL 0x28
167#define S2MPU02_BUCK7_START_SEL 0x30
168
169#define S2MPU02_BUCK_RAMP_DELAY 12500
170
171/* Regulator constraints for different types of LDOx */
172#define S2MPU02_LDO_MIN_900MV 900000
173#define S2MPU02_LDO_MIN_1050MV 1050000
174#define S2MPU02_LDO_MIN_1600MV 1600000
175#define S2MPU02_LDO_STEP_12_5MV 12500
176#define S2MPU02_LDO_STEP_25MV 25000
177#define S2MPU02_LDO_STEP_50MV 50000
178
179#define S2MPU02_LDO_GROUP1_START_SEL 0x8
180#define S2MPU02_LDO_GROUP2_START_SEL 0xA
181#define S2MPU02_LDO_GROUP3_START_SEL 0x10
182
183#define S2MPU02_LDO_VSEL_MASK 0x3F
184#define S2MPU02_BUCK_VSEL_MASK 0xFF
185#define S2MPU02_ENABLE_MASK (0x03 << S2MPU02_ENABLE_SHIFT)
186#define S2MPU02_ENABLE_SHIFT 6
187
188/* On/Off controlled by PWREN */
189#define S2MPU02_ENABLE_SUSPEND (0x01 << S2MPU02_ENABLE_SHIFT)
190#define S2MPU02_DISABLE_SUSPEND (0x11 << S2MPU02_ENABLE_SHIFT)
191#define S2MPU02_LDO_N_VOLTAGES (S2MPU02_LDO_VSEL_MASK + 1)
192#define S2MPU02_BUCK_N_VOLTAGES (S2MPU02_BUCK_VSEL_MASK + 1)
193
194/* RAMP delay for BUCK1234*/
195#define S2MPU02_BUCK1_RAMP_SHIFT 6
196#define S2MPU02_BUCK2_RAMP_SHIFT 4
197#define S2MPU02_BUCK3_RAMP_SHIFT 2
198#define S2MPU02_BUCK4_RAMP_SHIFT 0
199#define S2MPU02_BUCK1234_RAMP_MASK 0x3
200
201#endif /* __LINUX_MFD_S2MPU02_H */
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index fb96c84dada5..e2e70053470e 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -155,6 +155,7 @@ struct ti_tscadc_dev {
155 void __iomem *tscadc_base; 155 void __iomem *tscadc_base;
156 int irq; 156 int irq;
157 int used_cells; /* 1-2 */ 157 int used_cells; /* 1-2 */
158 int tsc_wires;
158 int tsc_cell; /* -1 if not used */ 159 int tsc_cell; /* -1 if not used */
159 int adc_cell; /* -1 if not used */ 160 int adc_cell; /* -1 if not used */
160 struct mfd_cell cells[TSCADC_CELLS]; 161 struct mfd_cell cells[TSCADC_CELLS];
diff --git a/include/linux/mfd/ti_ssp.h b/include/linux/mfd/ti_ssp.h
deleted file mode 100644
index dbb4b43bd20e..000000000000
--- a/include/linux/mfd/ti_ssp.h
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * Sequencer Serial Port (SSP) driver for Texas Instruments' SoCs
3 *
4 * Copyright (C) 2010 Texas Instruments Inc
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __TI_SSP_H__
22#define __TI_SSP_H__
23
24struct ti_ssp_dev_data {
25 const char *dev_name;
26 void *pdata;
27 size_t pdata_size;
28};
29
30struct ti_ssp_data {
31 unsigned long out_clock;
32 struct ti_ssp_dev_data dev_data[2];
33};
34
35struct ti_ssp_spi_data {
36 unsigned long iosel;
37 int num_cs;
38 void (*select)(int cs);
39};
40
41/*
42 * Sequencer port IO pin configuration bits. These do not correlate 1-1 with
43 * the hardware. The iosel field in the port data combines iosel1 and iosel2,
44 * and is therefore not a direct map to register space. It is best to use the
45 * macros below to construct iosel values.
46 *
47 * least significant 16 bits --> iosel1
48 * most significant 16 bits --> iosel2
49 */
50
51#define SSP_IN 0x0000
52#define SSP_DATA 0x0001
53#define SSP_CLOCK 0x0002
54#define SSP_CHIPSEL 0x0003
55#define SSP_OUT 0x0004
56#define SSP_PIN_SEL(pin, v) ((v) << ((pin) * 3))
57#define SSP_PIN_MASK(pin) SSP_PIN_SEL(pin, 0x7)
58#define SSP_INPUT_SEL(pin) ((pin) << 16)
59
60/* Sequencer port config bits */
61#define SSP_EARLY_DIN BIT(8)
62#define SSP_DELAY_DOUT BIT(9)
63
64/* Sequence map definitions */
65#define SSP_CLK_HIGH BIT(0)
66#define SSP_CLK_LOW 0
67#define SSP_DATA_HIGH BIT(1)
68#define SSP_DATA_LOW 0
69#define SSP_CS_HIGH BIT(2)
70#define SSP_CS_LOW 0
71#define SSP_OUT_MODE BIT(3)
72#define SSP_IN_MODE 0
73#define SSP_DATA_REG BIT(4)
74#define SSP_ADDR_REG 0
75
76#define SSP_OPCODE_DIRECT ((0x0) << 5)
77#define SSP_OPCODE_TOGGLE ((0x1) << 5)
78#define SSP_OPCODE_SHIFT ((0x2) << 5)
79#define SSP_OPCODE_BRANCH0 ((0x4) << 5)
80#define SSP_OPCODE_BRANCH1 ((0x5) << 5)
81#define SSP_OPCODE_BRANCH ((0x6) << 5)
82#define SSP_OPCODE_STOP ((0x7) << 5)
83#define SSP_BRANCH(addr) ((addr) << 8)
84#define SSP_COUNT(cycles) ((cycles) << 8)
85
86int ti_ssp_raw_read(struct device *dev);
87int ti_ssp_raw_write(struct device *dev, u32 val);
88int ti_ssp_load(struct device *dev, int offs, u32* prog, int len);
89int ti_ssp_run(struct device *dev, u32 pc, u32 input, u32 *output);
90int ti_ssp_set_mode(struct device *dev, int mode);
91int ti_ssp_set_iosel(struct device *dev, u32 iosel);
92
93#endif /* __TI_SSP_H__ */
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 8f6f2e91e7ae..57388171610d 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -5,6 +5,7 @@
5#include <linux/fb.h> 5#include <linux/fb.h>
6#include <linux/io.h> 6#include <linux/io.h>
7#include <linux/jiffies.h> 7#include <linux/jiffies.h>
8#include <linux/mmc/card.h>
8#include <linux/platform_device.h> 9#include <linux/platform_device.h>
9#include <linux/pm_runtime.h> 10#include <linux/pm_runtime.h>
10 11
@@ -83,6 +84,27 @@
83 */ 84 */
84#define TMIO_MMC_HAVE_HIGH_REG (1 << 6) 85#define TMIO_MMC_HAVE_HIGH_REG (1 << 6)
85 86
87/*
88 * Some controllers have CMD12 automatically
89 * issue/non-issue register
90 */
91#define TMIO_MMC_HAVE_CMD12_CTRL (1 << 7)
92
93/*
94 * Some controllers needs to set 1 on SDIO status reserved bits
95 */
96#define TMIO_MMC_SDIO_STATUS_QUIRK (1 << 8)
97
98/*
99 * Some controllers have DMA enable/disable register
100 */
101#define TMIO_MMC_HAVE_CTL_DMA_REG (1 << 9)
102
103/*
104 * Some controllers allows to set SDx actual clock
105 */
106#define TMIO_MMC_CLK_ACTUAL (1 << 10)
107
86int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); 108int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
87int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); 109int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
88void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state); 110void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
@@ -96,6 +118,7 @@ struct tmio_mmc_dma {
96 int slave_id_tx; 118 int slave_id_tx;
97 int slave_id_rx; 119 int slave_id_rx;
98 int alignment_shift; 120 int alignment_shift;
121 dma_addr_t dma_rx_offset;
99 bool (*filter)(struct dma_chan *chan, void *arg); 122 bool (*filter)(struct dma_chan *chan, void *arg);
100}; 123};
101 124
@@ -120,6 +143,8 @@ struct tmio_mmc_data {
120 /* clock management callbacks */ 143 /* clock management callbacks */
121 int (*clk_enable)(struct platform_device *pdev, unsigned int *f); 144 int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
122 void (*clk_disable)(struct platform_device *pdev); 145 void (*clk_disable)(struct platform_device *pdev);
146 int (*multi_io_quirk)(struct mmc_card *card,
147 unsigned int direction, int blk_size);
123}; 148};
124 149
125/* 150/*
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
index 95d6938737fd..ac7fba44d7e4 100644
--- a/include/linux/mfd/tps65217.h
+++ b/include/linux/mfd/tps65217.h
@@ -60,6 +60,8 @@
60#define TPS65217_REG_SEQ5 0X1D 60#define TPS65217_REG_SEQ5 0X1D
61#define TPS65217_REG_SEQ6 0X1E 61#define TPS65217_REG_SEQ6 0X1E
62 62
63#define TPS65217_REG_MAX TPS65217_REG_SEQ6
64
63/* Register field definitions */ 65/* Register field definitions */
64#define TPS65217_CHIPID_CHIP_MASK 0xF0 66#define TPS65217_CHIPID_CHIP_MASK 0xF0
65#define TPS65217_CHIPID_REV_MASK 0x0F 67#define TPS65217_CHIPID_REV_MASK 0x0F
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 16c2335c2856..6483a6fdce59 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -892,7 +892,7 @@ struct tps65910 {
892 struct device *dev; 892 struct device *dev;
893 struct i2c_client *i2c_client; 893 struct i2c_client *i2c_client;
894 struct regmap *regmap; 894 struct regmap *regmap;
895 unsigned int id; 895 unsigned long id;
896 896
897 /* Client devices */ 897 /* Client devices */
898 struct tps65910_pmic *pmic; 898 struct tps65910_pmic *pmic;
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 2e5b194b9b19..53d33dee70e1 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -37,6 +37,7 @@
37 37
38/* struct phy_device dev_flags definitions */ 38/* struct phy_device dev_flags definitions */
39#define MICREL_PHY_50MHZ_CLK 0x00000001 39#define MICREL_PHY_50MHZ_CLK 0x00000001
40#define MICREL_PHY_25MHZ_CLK 0x00000002
40 41
41#define MICREL_KSZ9021_EXTREG_CTRL 0xB 42#define MICREL_KSZ9021_EXTREG_CTRL 0xB
42#define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC 43#define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index a2901c414664..01aad3ed89ec 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -13,18 +13,9 @@ typedef void free_page_t(struct page *page, unsigned long private);
13 * Return values from addresss_space_operations.migratepage(): 13 * Return values from addresss_space_operations.migratepage():
14 * - negative errno on page migration failure; 14 * - negative errno on page migration failure;
15 * - zero on page migration success; 15 * - zero on page migration success;
16 *
17 * The balloon page migration introduces this special case where a 'distinct'
18 * return code is used to flag a successful page migration to unmap_and_move().
19 * This approach is necessary because page migration can race against balloon
20 * deflation procedure, and for such case we could introduce a nasty page leak
21 * if a successfully migrated balloon page gets released concurrently with
22 * migration's unmap_and_move() wrap-up steps.
23 */ 16 */
24#define MIGRATEPAGE_SUCCESS 0 17#define MIGRATEPAGE_SUCCESS 0
25#define MIGRATEPAGE_BALLOON_SUCCESS 1 /* special ret code for balloon page 18
26 * sucessful migration case.
27 */
28enum migrate_reason { 19enum migrate_reason {
29 MR_COMPACTION, 20 MR_COMPACTION,
30 MR_MEMORY_FAILURE, 21 MR_MEMORY_FAILURE,
@@ -82,9 +73,6 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
82 return -ENOSYS; 73 return -ENOSYS;
83} 74}
84 75
85/* Possible settings for the migrate_page() method in address_operations */
86#define migrate_page NULL
87
88#endif /* CONFIG_MIGRATION */ 76#endif /* CONFIG_MIGRATION */
89 77
90#ifdef CONFIG_NUMA_BALANCING 78#ifdef CONFIG_NUMA_BALANCING
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index c8450366c130..379c02648ab3 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -116,6 +116,7 @@ enum {
116 /* special QP and management commands */ 116 /* special QP and management commands */
117 MLX4_CMD_CONF_SPECIAL_QP = 0x23, 117 MLX4_CMD_CONF_SPECIAL_QP = 0x23,
118 MLX4_CMD_MAD_IFC = 0x24, 118 MLX4_CMD_MAD_IFC = 0x24,
119 MLX4_CMD_MAD_DEMUX = 0x203,
119 120
120 /* multicast commands */ 121 /* multicast commands */
121 MLX4_CMD_READ_MCG = 0x25, 122 MLX4_CMD_READ_MCG = 0x25,
@@ -186,6 +187,12 @@ enum {
186}; 187};
187 188
188enum { 189enum {
190 MLX4_CMD_MAD_DEMUX_CONFIG = 0,
191 MLX4_CMD_MAD_DEMUX_QUERY_STATE = 1,
192 MLX4_CMD_MAD_DEMUX_QUERY_RESTR = 2, /* Query mad demux restrictions */
193};
194
195enum {
189 MLX4_CMD_WRAPPED, 196 MLX4_CMD_WRAPPED,
190 MLX4_CMD_NATIVE 197 MLX4_CMD_NATIVE
191}; 198};
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index e15b1544ea83..37e4404d0227 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -38,6 +38,7 @@
38#include <linux/completion.h> 38#include <linux/completion.h>
39#include <linux/radix-tree.h> 39#include <linux/radix-tree.h>
40#include <linux/cpu_rmap.h> 40#include <linux/cpu_rmap.h>
41#include <linux/crash_dump.h>
41 42
42#include <linux/atomic.h> 43#include <linux/atomic.h>
43 44
@@ -183,19 +184,25 @@ enum {
183 MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 8, 184 MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 8,
184 MLX4_DEV_CAP_FLAG2_DMFS_IPOIB = 1LL << 9, 185 MLX4_DEV_CAP_FLAG2_DMFS_IPOIB = 1LL << 9,
185 MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10, 186 MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10,
187 MLX4_DEV_CAP_FLAG2_MAD_DEMUX = 1LL << 11,
188 MLX4_DEV_CAP_FLAG2_CQE_STRIDE = 1LL << 12,
189 MLX4_DEV_CAP_FLAG2_EQE_STRIDE = 1LL << 13
186}; 190};
187 191
188enum { 192enum {
189 MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0, 193 MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0,
190 MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1 194 MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1,
195 MLX4_DEV_CAP_CQE_STRIDE_ENABLED = 1LL << 2,
196 MLX4_DEV_CAP_EQE_STRIDE_ENABLED = 1LL << 3
191}; 197};
192 198
193enum { 199enum {
194 MLX4_USER_DEV_CAP_64B_CQE = 1L << 0 200 MLX4_USER_DEV_CAP_LARGE_CQE = 1L << 0
195}; 201};
196 202
197enum { 203enum {
198 MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0 204 MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0,
205 MLX4_FUNC_CAP_EQE_CQE_STRIDE = 1L << 1
199}; 206};
200 207
201 208
@@ -208,6 +215,7 @@ enum {
208 MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, 215 MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9,
209 MLX4_BMME_FLAG_RESERVED_LKEY = 1 << 10, 216 MLX4_BMME_FLAG_RESERVED_LKEY = 1 << 10,
210 MLX4_BMME_FLAG_FAST_REG_WR = 1 << 11, 217 MLX4_BMME_FLAG_FAST_REG_WR = 1 << 11,
218 MLX4_BMME_FLAG_VSD_INIT2RTR = 1 << 28,
211}; 219};
212 220
213enum mlx4_event { 221enum mlx4_event {
@@ -273,6 +281,7 @@ enum {
273 MLX4_PERM_REMOTE_WRITE = 1 << 13, 281 MLX4_PERM_REMOTE_WRITE = 1 << 13,
274 MLX4_PERM_ATOMIC = 1 << 14, 282 MLX4_PERM_ATOMIC = 1 << 14,
275 MLX4_PERM_BIND_MW = 1 << 15, 283 MLX4_PERM_BIND_MW = 1 << 15,
284 MLX4_PERM_MASK = 0xFC00
276}; 285};
277 286
278enum { 287enum {
@@ -574,7 +583,7 @@ struct mlx4_uar {
574}; 583};
575 584
576struct mlx4_bf { 585struct mlx4_bf {
577 unsigned long offset; 586 unsigned int offset;
578 int buf_size; 587 int buf_size;
579 struct mlx4_uar *uar; 588 struct mlx4_uar *uar;
580 void __iomem *reg; 589 void __iomem *reg;
@@ -698,6 +707,7 @@ struct mlx4_dev {
698 u64 regid_promisc_array[MLX4_MAX_PORTS + 1]; 707 u64 regid_promisc_array[MLX4_MAX_PORTS + 1];
699 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1]; 708 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1];
700 struct mlx4_vf_dev *dev_vfs; 709 struct mlx4_vf_dev *dev_vfs;
710 int nvfs[MLX4_MAX_PORTS + 1];
701}; 711};
702 712
703struct mlx4_eqe { 713struct mlx4_eqe {
@@ -1194,6 +1204,9 @@ int mlx4_map_sw_to_hw_steering_id(struct mlx4_dev *dev,
1194 enum mlx4_net_trans_rule_id id); 1204 enum mlx4_net_trans_rule_id id);
1195int mlx4_hw_rule_sz(struct mlx4_dev *dev, enum mlx4_net_trans_rule_id id); 1205int mlx4_hw_rule_sz(struct mlx4_dev *dev, enum mlx4_net_trans_rule_id id);
1196 1206
1207int mlx4_tunnel_steer_add(struct mlx4_dev *dev, unsigned char *addr,
1208 int port, int qpn, u16 prio, u64 *reg_id);
1209
1197void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port, 1210void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port,
1198 int i, int val); 1211 int i, int val);
1199 1212
@@ -1254,11 +1267,26 @@ int mlx4_vf_smi_enabled(struct mlx4_dev *dev, int slave, int port);
1254int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port); 1267int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port);
1255int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port, 1268int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port,
1256 int enable); 1269 int enable);
1270int mlx4_mr_hw_get_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr,
1271 struct mlx4_mpt_entry ***mpt_entry);
1272int mlx4_mr_hw_write_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr,
1273 struct mlx4_mpt_entry **mpt_entry);
1274int mlx4_mr_hw_change_pd(struct mlx4_dev *dev, struct mlx4_mpt_entry *mpt_entry,
1275 u32 pdn);
1276int mlx4_mr_hw_change_access(struct mlx4_dev *dev,
1277 struct mlx4_mpt_entry *mpt_entry,
1278 u32 access);
1279void mlx4_mr_hw_put_mpt(struct mlx4_dev *dev,
1280 struct mlx4_mpt_entry **mpt_entry);
1281void mlx4_mr_rereg_mem_cleanup(struct mlx4_dev *dev, struct mlx4_mr *mr);
1282int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr,
1283 u64 iova, u64 size, int npages,
1284 int page_shift, struct mlx4_mpt_entry *mpt_entry);
1257 1285
1258/* Returns true if running in low memory profile (kdump kernel) */ 1286/* Returns true if running in low memory profile (kdump kernel) */
1259static inline bool mlx4_low_memory_profile(void) 1287static inline bool mlx4_low_memory_profile(void)
1260{ 1288{
1261 return reset_devices; 1289 return is_kdump_kernel();
1262} 1290}
1263 1291
1264#endif /* MLX4_DEVICE_H */ 1292#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 7040dc98ff8b..5f4e36cf0091 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -56,7 +56,8 @@ enum mlx4_qp_optpar {
56 MLX4_QP_OPTPAR_RNR_RETRY = 1 << 13, 56 MLX4_QP_OPTPAR_RNR_RETRY = 1 << 13,
57 MLX4_QP_OPTPAR_ACK_TIMEOUT = 1 << 14, 57 MLX4_QP_OPTPAR_ACK_TIMEOUT = 1 << 14,
58 MLX4_QP_OPTPAR_SCHED_QUEUE = 1 << 16, 58 MLX4_QP_OPTPAR_SCHED_QUEUE = 1 << 16,
59 MLX4_QP_OPTPAR_COUNTER_INDEX = 1 << 20 59 MLX4_QP_OPTPAR_COUNTER_INDEX = 1 << 20,
60 MLX4_QP_OPTPAR_VLAN_STRIPPING = 1 << 21,
60}; 61};
61 62
62enum mlx4_qp_state { 63enum mlx4_qp_state {
@@ -423,13 +424,20 @@ struct mlx4_wqe_inline_seg {
423 424
424enum mlx4_update_qp_attr { 425enum mlx4_update_qp_attr {
425 MLX4_UPDATE_QP_SMAC = 1 << 0, 426 MLX4_UPDATE_QP_SMAC = 1 << 0,
427 MLX4_UPDATE_QP_VSD = 1 << 2,
428 MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 2) - 1
429};
430
431enum mlx4_update_qp_params_flags {
432 MLX4_UPDATE_QP_PARAMS_FLAGS_VSD_ENABLE = 1 << 0,
426}; 433};
427 434
428struct mlx4_update_qp_params { 435struct mlx4_update_qp_params {
429 u8 smac_index; 436 u8 smac_index;
437 u32 flags;
430}; 438};
431 439
432int mlx4_update_qp(struct mlx4_dev *dev, struct mlx4_qp *qp, 440int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,
433 enum mlx4_update_qp_attr attr, 441 enum mlx4_update_qp_attr attr,
434 struct mlx4_update_qp_params *params); 442 struct mlx4_update_qp_params *params);
435int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 443int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 334947151dfc..1d67fd32e71c 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -44,6 +44,50 @@
44#error Host endianness not defined 44#error Host endianness not defined
45#endif 45#endif
46 46
47/* helper macros */
48#define __mlx5_nullp(typ) ((struct mlx5_ifc_##typ##_bits *)0)
49#define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld)
50#define __mlx5_bit_off(typ, fld) ((unsigned)(unsigned long)(&(__mlx5_nullp(typ)->fld)))
51#define __mlx5_dw_off(typ, fld) (__mlx5_bit_off(typ, fld) / 32)
52#define __mlx5_64_off(typ, fld) (__mlx5_bit_off(typ, fld) / 64)
53#define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0x1f))
54#define __mlx5_mask(typ, fld) ((u32)((1ull << __mlx5_bit_sz(typ, fld)) - 1))
55#define __mlx5_dw_mask(typ, fld) (__mlx5_mask(typ, fld) << __mlx5_dw_bit_off(typ, fld))
56#define __mlx5_st_sz_bits(typ) sizeof(struct mlx5_ifc_##typ##_bits)
57
58#define MLX5_FLD_SZ_BYTES(typ, fld) (__mlx5_bit_sz(typ, fld) / 8)
59#define MLX5_ST_SZ_BYTES(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 8)
60#define MLX5_ST_SZ_DW(typ) (sizeof(struct mlx5_ifc_##typ##_bits) / 32)
61#define MLX5_BYTE_OFF(typ, fld) (__mlx5_bit_off(typ, fld) / 8)
62#define MLX5_ADDR_OF(typ, p, fld) ((char *)(p) + MLX5_BYTE_OFF(typ, fld))
63
64/* insert a value to a struct */
65#define MLX5_SET(typ, p, fld, v) do { \
66 BUILD_BUG_ON(__mlx5_st_sz_bits(typ) % 32); \
67 *((__be32 *)(p) + __mlx5_dw_off(typ, fld)) = \
68 cpu_to_be32((be32_to_cpu(*((__be32 *)(p) + __mlx5_dw_off(typ, fld))) & \
69 (~__mlx5_dw_mask(typ, fld))) | (((v) & __mlx5_mask(typ, fld)) \
70 << __mlx5_dw_bit_off(typ, fld))); \
71} while (0)
72
73#define MLX5_GET(typ, p, fld) ((be32_to_cpu(*((__be32 *)(p) +\
74__mlx5_dw_off(typ, fld))) >> __mlx5_dw_bit_off(typ, fld)) & \
75__mlx5_mask(typ, fld))
76
77#define MLX5_GET_PR(typ, p, fld) ({ \
78 u32 ___t = MLX5_GET(typ, p, fld); \
79 pr_debug(#fld " = 0x%x\n", ___t); \
80 ___t; \
81})
82
83#define MLX5_SET64(typ, p, fld, v) do { \
84 BUILD_BUG_ON(__mlx5_bit_sz(typ, fld) != 64); \
85 BUILD_BUG_ON(__mlx5_bit_off(typ, fld) % 64); \
86 *((__be64 *)(p) + __mlx5_64_off(typ, fld)) = cpu_to_be64(v); \
87} while (0)
88
89#define MLX5_GET64(typ, p, fld) be64_to_cpu(*((__be64 *)(p) + __mlx5_64_off(typ, fld)))
90
47enum { 91enum {
48 MLX5_MAX_COMMANDS = 32, 92 MLX5_MAX_COMMANDS = 32,
49 MLX5_CMD_DATA_BLOCK_SIZE = 512, 93 MLX5_CMD_DATA_BLOCK_SIZE = 512,
@@ -71,6 +115,11 @@ enum {
71}; 115};
72 116
73enum { 117enum {
118 MLX5_MIN_PKEY_TABLE_SIZE = 128,
119 MLX5_MAX_LOG_PKEY_TABLE = 5,
120};
121
122enum {
74 MLX5_PERM_LOCAL_READ = 1 << 2, 123 MLX5_PERM_LOCAL_READ = 1 << 2,
75 MLX5_PERM_LOCAL_WRITE = 1 << 3, 124 MLX5_PERM_LOCAL_WRITE = 1 << 3,
76 MLX5_PERM_REMOTE_READ = 1 << 4, 125 MLX5_PERM_REMOTE_READ = 1 << 4,
@@ -184,10 +233,10 @@ enum {
184 MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29, 233 MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29,
185 MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30, 234 MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30,
186 MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32, 235 MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32,
236 MLX5_DEV_CAP_FLAG_DCT = 1LL << 37,
187 MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38, 237 MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38,
188 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39, 238 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39,
189 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40, 239 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
190 MLX5_DEV_CAP_FLAG_DCT = 1LL << 41,
191 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46, 240 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46,
192}; 241};
193 242
@@ -243,10 +292,14 @@ enum {
243}; 292};
244 293
245enum { 294enum {
246 MLX5_CAP_OFF_DCT = 41,
247 MLX5_CAP_OFF_CMDIF_CSUM = 46, 295 MLX5_CAP_OFF_CMDIF_CSUM = 46,
248}; 296};
249 297
298enum {
299 HCA_CAP_OPMOD_GET_MAX = 0,
300 HCA_CAP_OPMOD_GET_CUR = 1,
301};
302
250struct mlx5_inbox_hdr { 303struct mlx5_inbox_hdr {
251 __be16 opcode; 304 __be16 opcode;
252 u8 rsvd[4]; 305 u8 rsvd[4];
@@ -274,101 +327,6 @@ struct mlx5_cmd_query_adapter_mbox_out {
274 u8 vsd_psid[16]; 327 u8 vsd_psid[16];
275}; 328};
276 329
277struct mlx5_hca_cap {
278 u8 rsvd1[16];
279 u8 log_max_srq_sz;
280 u8 log_max_qp_sz;
281 u8 rsvd2;
282 u8 log_max_qp;
283 u8 log_max_strq_sz;
284 u8 log_max_srqs;
285 u8 rsvd4[2];
286 u8 rsvd5;
287 u8 log_max_cq_sz;
288 u8 rsvd6;
289 u8 log_max_cq;
290 u8 log_max_eq_sz;
291 u8 log_max_mkey;
292 u8 rsvd7;
293 u8 log_max_eq;
294 u8 max_indirection;
295 u8 log_max_mrw_sz;
296 u8 log_max_bsf_list_sz;
297 u8 log_max_klm_list_sz;
298 u8 rsvd_8_0;
299 u8 log_max_ra_req_dc;
300 u8 rsvd_8_1;
301 u8 log_max_ra_res_dc;
302 u8 rsvd9;
303 u8 log_max_ra_req_qp;
304 u8 rsvd10;
305 u8 log_max_ra_res_qp;
306 u8 rsvd11[4];
307 __be16 max_qp_count;
308 __be16 rsvd12;
309 u8 rsvd13;
310 u8 local_ca_ack_delay;
311 u8 rsvd14;
312 u8 num_ports;
313 u8 log_max_msg;
314 u8 rsvd15[3];
315 __be16 stat_rate_support;
316 u8 rsvd16[2];
317 __be64 flags;
318 u8 rsvd17;
319 u8 uar_sz;
320 u8 rsvd18;
321 u8 log_pg_sz;
322 __be16 bf_log_bf_reg_size;
323 u8 rsvd19[4];
324 __be16 max_desc_sz_sq;
325 u8 rsvd20[2];
326 __be16 max_desc_sz_rq;
327 u8 rsvd21[2];
328 __be16 max_desc_sz_sq_dc;
329 __be32 max_qp_mcg;
330 u8 rsvd22[3];
331 u8 log_max_mcg;
332 u8 rsvd23;
333 u8 log_max_pd;
334 u8 rsvd24;
335 u8 log_max_xrcd;
336 u8 rsvd25[42];
337 __be16 log_uar_page_sz;
338 u8 rsvd26[28];
339 u8 log_max_atomic_size_qp;
340 u8 rsvd27[2];
341 u8 log_max_atomic_size_dc;
342 u8 rsvd28[76];
343};
344
345
346struct mlx5_cmd_query_hca_cap_mbox_in {
347 struct mlx5_inbox_hdr hdr;
348 u8 rsvd[8];
349};
350
351
352struct mlx5_cmd_query_hca_cap_mbox_out {
353 struct mlx5_outbox_hdr hdr;
354 u8 rsvd0[8];
355 struct mlx5_hca_cap hca_cap;
356};
357
358
359struct mlx5_cmd_set_hca_cap_mbox_in {
360 struct mlx5_inbox_hdr hdr;
361 u8 rsvd[8];
362 struct mlx5_hca_cap hca_cap;
363};
364
365
366struct mlx5_cmd_set_hca_cap_mbox_out {
367 struct mlx5_outbox_hdr hdr;
368 u8 rsvd0[8];
369};
370
371
372struct mlx5_cmd_init_hca_mbox_in { 330struct mlx5_cmd_init_hca_mbox_in {
373 struct mlx5_inbox_hdr hdr; 331 struct mlx5_inbox_hdr hdr;
374 u8 rsvd0[2]; 332 u8 rsvd0[2];
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index b88e9b46d957..246310dc8bef 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -44,6 +44,7 @@
44 44
45#include <linux/mlx5/device.h> 45#include <linux/mlx5/device.h>
46#include <linux/mlx5/doorbell.h> 46#include <linux/mlx5/doorbell.h>
47#include <linux/mlx5/mlx5_ifc.h>
47 48
48enum { 49enum {
49 MLX5_BOARD_ID_LEN = 64, 50 MLX5_BOARD_ID_LEN = 64,
@@ -99,81 +100,6 @@ enum {
99}; 100};
100 101
101enum { 102enum {
102 MLX5_CMD_OP_QUERY_HCA_CAP = 0x100,
103 MLX5_CMD_OP_QUERY_ADAPTER = 0x101,
104 MLX5_CMD_OP_INIT_HCA = 0x102,
105 MLX5_CMD_OP_TEARDOWN_HCA = 0x103,
106 MLX5_CMD_OP_ENABLE_HCA = 0x104,
107 MLX5_CMD_OP_DISABLE_HCA = 0x105,
108 MLX5_CMD_OP_QUERY_PAGES = 0x107,
109 MLX5_CMD_OP_MANAGE_PAGES = 0x108,
110 MLX5_CMD_OP_SET_HCA_CAP = 0x109,
111
112 MLX5_CMD_OP_CREATE_MKEY = 0x200,
113 MLX5_CMD_OP_QUERY_MKEY = 0x201,
114 MLX5_CMD_OP_DESTROY_MKEY = 0x202,
115 MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS = 0x203,
116
117 MLX5_CMD_OP_CREATE_EQ = 0x301,
118 MLX5_CMD_OP_DESTROY_EQ = 0x302,
119 MLX5_CMD_OP_QUERY_EQ = 0x303,
120
121 MLX5_CMD_OP_CREATE_CQ = 0x400,
122 MLX5_CMD_OP_DESTROY_CQ = 0x401,
123 MLX5_CMD_OP_QUERY_CQ = 0x402,
124 MLX5_CMD_OP_MODIFY_CQ = 0x403,
125
126 MLX5_CMD_OP_CREATE_QP = 0x500,
127 MLX5_CMD_OP_DESTROY_QP = 0x501,
128 MLX5_CMD_OP_RST2INIT_QP = 0x502,
129 MLX5_CMD_OP_INIT2RTR_QP = 0x503,
130 MLX5_CMD_OP_RTR2RTS_QP = 0x504,
131 MLX5_CMD_OP_RTS2RTS_QP = 0x505,
132 MLX5_CMD_OP_SQERR2RTS_QP = 0x506,
133 MLX5_CMD_OP_2ERR_QP = 0x507,
134 MLX5_CMD_OP_RTS2SQD_QP = 0x508,
135 MLX5_CMD_OP_SQD2RTS_QP = 0x509,
136 MLX5_CMD_OP_2RST_QP = 0x50a,
137 MLX5_CMD_OP_QUERY_QP = 0x50b,
138 MLX5_CMD_OP_CONF_SQP = 0x50c,
139 MLX5_CMD_OP_MAD_IFC = 0x50d,
140 MLX5_CMD_OP_INIT2INIT_QP = 0x50e,
141 MLX5_CMD_OP_SUSPEND_QP = 0x50f,
142 MLX5_CMD_OP_UNSUSPEND_QP = 0x510,
143 MLX5_CMD_OP_SQD2SQD_QP = 0x511,
144 MLX5_CMD_OP_ALLOC_QP_COUNTER_SET = 0x512,
145 MLX5_CMD_OP_DEALLOC_QP_COUNTER_SET = 0x513,
146 MLX5_CMD_OP_QUERY_QP_COUNTER_SET = 0x514,
147
148 MLX5_CMD_OP_CREATE_PSV = 0x600,
149 MLX5_CMD_OP_DESTROY_PSV = 0x601,
150 MLX5_CMD_OP_QUERY_PSV = 0x602,
151 MLX5_CMD_OP_QUERY_SIG_RULE_TABLE = 0x603,
152 MLX5_CMD_OP_QUERY_BLOCK_SIZE_TABLE = 0x604,
153
154 MLX5_CMD_OP_CREATE_SRQ = 0x700,
155 MLX5_CMD_OP_DESTROY_SRQ = 0x701,
156 MLX5_CMD_OP_QUERY_SRQ = 0x702,
157 MLX5_CMD_OP_ARM_RQ = 0x703,
158 MLX5_CMD_OP_RESIZE_SRQ = 0x704,
159
160 MLX5_CMD_OP_ALLOC_PD = 0x800,
161 MLX5_CMD_OP_DEALLOC_PD = 0x801,
162 MLX5_CMD_OP_ALLOC_UAR = 0x802,
163 MLX5_CMD_OP_DEALLOC_UAR = 0x803,
164
165 MLX5_CMD_OP_ATTACH_TO_MCG = 0x806,
166 MLX5_CMD_OP_DETACH_FROM_MCG = 0x807,
167
168
169 MLX5_CMD_OP_ALLOC_XRCD = 0x80e,
170 MLX5_CMD_OP_DEALLOC_XRCD = 0x80f,
171
172 MLX5_CMD_OP_ACCESS_REG = 0x805,
173 MLX5_CMD_OP_MAX = 0x810,
174};
175
176enum {
177 MLX5_REG_PCAP = 0x5001, 103 MLX5_REG_PCAP = 0x5001,
178 MLX5_REG_PMTU = 0x5003, 104 MLX5_REG_PMTU = 0x5003,
179 MLX5_REG_PTYS = 0x5004, 105 MLX5_REG_PTYS = 0x5004,
@@ -335,23 +261,30 @@ struct mlx5_port_caps {
335 int pkey_table_len; 261 int pkey_table_len;
336}; 262};
337 263
338struct mlx5_caps { 264struct mlx5_general_caps {
339 u8 log_max_eq; 265 u8 log_max_eq;
340 u8 log_max_cq; 266 u8 log_max_cq;
341 u8 log_max_qp; 267 u8 log_max_qp;
342 u8 log_max_mkey; 268 u8 log_max_mkey;
343 u8 log_max_pd; 269 u8 log_max_pd;
344 u8 log_max_srq; 270 u8 log_max_srq;
271 u8 log_max_strq;
272 u8 log_max_mrw_sz;
273 u8 log_max_bsf_list_size;
274 u8 log_max_klm_list_size;
345 u32 max_cqes; 275 u32 max_cqes;
346 int max_wqes; 276 int max_wqes;
277 u32 max_eqes;
278 u32 max_indirection;
347 int max_sq_desc_sz; 279 int max_sq_desc_sz;
348 int max_rq_desc_sz; 280 int max_rq_desc_sz;
281 int max_dc_sq_desc_sz;
349 u64 flags; 282 u64 flags;
350 u16 stat_rate_support; 283 u16 stat_rate_support;
351 int log_max_msg; 284 int log_max_msg;
352 int num_ports; 285 int num_ports;
353 int max_ra_res_qp; 286 u8 log_max_ra_res_qp;
354 int max_ra_req_qp; 287 u8 log_max_ra_req_qp;
355 int max_srq_wqes; 288 int max_srq_wqes;
356 int bf_reg_size; 289 int bf_reg_size;
357 int bf_regs_per_page; 290 int bf_regs_per_page;
@@ -363,6 +296,19 @@ struct mlx5_caps {
363 u8 log_max_mcg; 296 u8 log_max_mcg;
364 u32 max_qp_mcg; 297 u32 max_qp_mcg;
365 int min_page_sz; 298 int min_page_sz;
299 int pd_cap;
300 u32 max_qp_counters;
301 u32 pkey_table_size;
302 u8 log_max_ra_req_dc;
303 u8 log_max_ra_res_dc;
304 u32 uar_sz;
305 u8 min_log_pg_sz;
306 u8 log_max_xrcd;
307 u16 log_uar_page_sz;
308};
309
310struct mlx5_caps {
311 struct mlx5_general_caps gen;
366}; 312};
367 313
368struct mlx5_cmd_mailbox { 314struct mlx5_cmd_mailbox {
@@ -429,6 +375,16 @@ struct mlx5_core_mr {
429 u32 pd; 375 u32 pd;
430}; 376};
431 377
378enum mlx5_res_type {
379 MLX5_RES_QP,
380};
381
382struct mlx5_core_rsc_common {
383 enum mlx5_res_type res;
384 atomic_t refcount;
385 struct completion free;
386};
387
432struct mlx5_core_srq { 388struct mlx5_core_srq {
433 u32 srqn; 389 u32 srqn;
434 int max; 390 int max;
@@ -695,6 +651,9 @@ void mlx5_cmd_cleanup(struct mlx5_core_dev *dev);
695void mlx5_cmd_use_events(struct mlx5_core_dev *dev); 651void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
696void mlx5_cmd_use_polling(struct mlx5_core_dev *dev); 652void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);
697int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr); 653int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr);
654int mlx5_cmd_status_to_err_v2(void *ptr);
655int mlx5_core_get_caps(struct mlx5_core_dev *dev, struct mlx5_caps *caps,
656 u16 opmod);
698int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, 657int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
699 int out_size); 658 int out_size);
700int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size, 659int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size,
@@ -751,7 +710,7 @@ int mlx5_eq_init(struct mlx5_core_dev *dev);
751void mlx5_eq_cleanup(struct mlx5_core_dev *dev); 710void mlx5_eq_cleanup(struct mlx5_core_dev *dev);
752void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas); 711void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas);
753void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn); 712void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn);
754void mlx5_qp_event(struct mlx5_core_dev *dev, u32 qpn, int event_type); 713void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type);
755void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); 714void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type);
756struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); 715struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn);
757void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector); 716void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector);
@@ -788,6 +747,7 @@ void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);
788int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn, 747int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn,
789 int npsvs, u32 *sig_index); 748 int npsvs, u32 *sig_index);
790int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num); 749int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num);
750void mlx5_core_put_rsc(struct mlx5_core_rsc_common *common);
791 751
792static inline u32 mlx5_mkey_to_idx(u32 mkey) 752static inline u32 mlx5_mkey_to_idx(u32 mkey)
793{ 753{
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
new file mode 100644
index 000000000000..5f48b8f592c5
--- /dev/null
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -0,0 +1,349 @@
1/*
2 * Copyright (c) 2014, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_IFC_H
34#define MLX5_IFC_H
35
36enum {
37 MLX5_CMD_OP_QUERY_HCA_CAP = 0x100,
38 MLX5_CMD_OP_QUERY_ADAPTER = 0x101,
39 MLX5_CMD_OP_INIT_HCA = 0x102,
40 MLX5_CMD_OP_TEARDOWN_HCA = 0x103,
41 MLX5_CMD_OP_ENABLE_HCA = 0x104,
42 MLX5_CMD_OP_DISABLE_HCA = 0x105,
43 MLX5_CMD_OP_QUERY_PAGES = 0x107,
44 MLX5_CMD_OP_MANAGE_PAGES = 0x108,
45 MLX5_CMD_OP_SET_HCA_CAP = 0x109,
46 MLX5_CMD_OP_CREATE_MKEY = 0x200,
47 MLX5_CMD_OP_QUERY_MKEY = 0x201,
48 MLX5_CMD_OP_DESTROY_MKEY = 0x202,
49 MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS = 0x203,
50 MLX5_CMD_OP_PAGE_FAULT_RESUME = 0x204,
51 MLX5_CMD_OP_CREATE_EQ = 0x301,
52 MLX5_CMD_OP_DESTROY_EQ = 0x302,
53 MLX5_CMD_OP_QUERY_EQ = 0x303,
54 MLX5_CMD_OP_GEN_EQE = 0x304,
55 MLX5_CMD_OP_CREATE_CQ = 0x400,
56 MLX5_CMD_OP_DESTROY_CQ = 0x401,
57 MLX5_CMD_OP_QUERY_CQ = 0x402,
58 MLX5_CMD_OP_MODIFY_CQ = 0x403,
59 MLX5_CMD_OP_CREATE_QP = 0x500,
60 MLX5_CMD_OP_DESTROY_QP = 0x501,
61 MLX5_CMD_OP_RST2INIT_QP = 0x502,
62 MLX5_CMD_OP_INIT2RTR_QP = 0x503,
63 MLX5_CMD_OP_RTR2RTS_QP = 0x504,
64 MLX5_CMD_OP_RTS2RTS_QP = 0x505,
65 MLX5_CMD_OP_SQERR2RTS_QP = 0x506,
66 MLX5_CMD_OP_2ERR_QP = 0x507,
67 MLX5_CMD_OP_2RST_QP = 0x50a,
68 MLX5_CMD_OP_QUERY_QP = 0x50b,
69 MLX5_CMD_OP_INIT2INIT_QP = 0x50e,
70 MLX5_CMD_OP_CREATE_PSV = 0x600,
71 MLX5_CMD_OP_DESTROY_PSV = 0x601,
72 MLX5_CMD_OP_CREATE_SRQ = 0x700,
73 MLX5_CMD_OP_DESTROY_SRQ = 0x701,
74 MLX5_CMD_OP_QUERY_SRQ = 0x702,
75 MLX5_CMD_OP_ARM_RQ = 0x703,
76 MLX5_CMD_OP_RESIZE_SRQ = 0x704,
77 MLX5_CMD_OP_CREATE_DCT = 0x710,
78 MLX5_CMD_OP_DESTROY_DCT = 0x711,
79 MLX5_CMD_OP_DRAIN_DCT = 0x712,
80 MLX5_CMD_OP_QUERY_DCT = 0x713,
81 MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION = 0x714,
82 MLX5_CMD_OP_QUERY_VPORT_STATE = 0x750,
83 MLX5_CMD_OP_MODIFY_VPORT_STATE = 0x751,
84 MLX5_CMD_OP_QUERY_ESW_VPORT_CONTEXT = 0x752,
85 MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT = 0x753,
86 MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT = 0x754,
87 MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT = 0x755,
88 MLX5_CMD_OP_QUERY_RCOE_ADDRESS = 0x760,
89 MLX5_CMD_OP_SET_ROCE_ADDRESS = 0x761,
90 MLX5_CMD_OP_QUERY_VPORT_COUNTER = 0x770,
91 MLX5_CMD_OP_ALLOC_Q_COUNTER = 0x771,
92 MLX5_CMD_OP_DEALLOC_Q_COUNTER = 0x772,
93 MLX5_CMD_OP_QUERY_Q_COUNTER = 0x773,
94 MLX5_CMD_OP_ALLOC_PD = 0x800,
95 MLX5_CMD_OP_DEALLOC_PD = 0x801,
96 MLX5_CMD_OP_ALLOC_UAR = 0x802,
97 MLX5_CMD_OP_DEALLOC_UAR = 0x803,
98 MLX5_CMD_OP_CONFIG_INT_MODERATION = 0x804,
99 MLX5_CMD_OP_ACCESS_REG = 0x805,
100 MLX5_CMD_OP_ATTACH_TO_MCG = 0x806,
101 MLX5_CMD_OP_DETACH_FROM_MCG = 0x807,
102 MLX5_CMD_OP_GET_DROPPED_PACKET_LOG = 0x80a,
103 MLX5_CMD_OP_MAD_IFC = 0x50d,
104 MLX5_CMD_OP_QUERY_MAD_DEMUX = 0x80b,
105 MLX5_CMD_OP_SET_MAD_DEMUX = 0x80c,
106 MLX5_CMD_OP_NOP = 0x80d,
107 MLX5_CMD_OP_ALLOC_XRCD = 0x80e,
108 MLX5_CMD_OP_DEALLOC_XRCD = 0x80f,
109 MLX5_CMD_OP_SET_BURST_SIZE = 0x812,
110 MLX5_CMD_OP_QUERY_BURST_SZIE = 0x813,
111 MLX5_CMD_OP_ACTIVATE_TRACER = 0x814,
112 MLX5_CMD_OP_DEACTIVATE_TRACER = 0x815,
113 MLX5_CMD_OP_CREATE_SNIFFER_RULE = 0x820,
114 MLX5_CMD_OP_DESTROY_SNIFFER_RULE = 0x821,
115 MLX5_CMD_OP_QUERY_CONG_PARAMS = 0x822,
116 MLX5_CMD_OP_MODIFY_CONG_PARAMS = 0x823,
117 MLX5_CMD_OP_QUERY_CONG_STATISTICS = 0x824,
118 MLX5_CMD_OP_CREATE_TIR = 0x900,
119 MLX5_CMD_OP_MODIFY_TIR = 0x901,
120 MLX5_CMD_OP_DESTROY_TIR = 0x902,
121 MLX5_CMD_OP_QUERY_TIR = 0x903,
122 MLX5_CMD_OP_CREATE_TIS = 0x912,
123 MLX5_CMD_OP_MODIFY_TIS = 0x913,
124 MLX5_CMD_OP_DESTROY_TIS = 0x914,
125 MLX5_CMD_OP_QUERY_TIS = 0x915,
126 MLX5_CMD_OP_CREATE_SQ = 0x904,
127 MLX5_CMD_OP_MODIFY_SQ = 0x905,
128 MLX5_CMD_OP_DESTROY_SQ = 0x906,
129 MLX5_CMD_OP_QUERY_SQ = 0x907,
130 MLX5_CMD_OP_CREATE_RQ = 0x908,
131 MLX5_CMD_OP_MODIFY_RQ = 0x909,
132 MLX5_CMD_OP_DESTROY_RQ = 0x90a,
133 MLX5_CMD_OP_QUERY_RQ = 0x90b,
134 MLX5_CMD_OP_CREATE_RMP = 0x90c,
135 MLX5_CMD_OP_MODIFY_RMP = 0x90d,
136 MLX5_CMD_OP_DESTROY_RMP = 0x90e,
137 MLX5_CMD_OP_QUERY_RMP = 0x90f,
138 MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY = 0x910,
139 MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY = 0x911,
140 MLX5_CMD_OP_MAX = 0x911
141};
142
143struct mlx5_ifc_cmd_hca_cap_bits {
144 u8 reserved_0[0x80];
145
146 u8 log_max_srq_sz[0x8];
147 u8 log_max_qp_sz[0x8];
148 u8 reserved_1[0xb];
149 u8 log_max_qp[0x5];
150
151 u8 log_max_strq_sz[0x8];
152 u8 reserved_2[0x3];
153 u8 log_max_srqs[0x5];
154 u8 reserved_3[0x10];
155
156 u8 reserved_4[0x8];
157 u8 log_max_cq_sz[0x8];
158 u8 reserved_5[0xb];
159 u8 log_max_cq[0x5];
160
161 u8 log_max_eq_sz[0x8];
162 u8 reserved_6[0x2];
163 u8 log_max_mkey[0x6];
164 u8 reserved_7[0xc];
165 u8 log_max_eq[0x4];
166
167 u8 max_indirection[0x8];
168 u8 reserved_8[0x1];
169 u8 log_max_mrw_sz[0x7];
170 u8 reserved_9[0x2];
171 u8 log_max_bsf_list_size[0x6];
172 u8 reserved_10[0x2];
173 u8 log_max_klm_list_size[0x6];
174
175 u8 reserved_11[0xa];
176 u8 log_max_ra_req_dc[0x6];
177 u8 reserved_12[0xa];
178 u8 log_max_ra_res_dc[0x6];
179
180 u8 reserved_13[0xa];
181 u8 log_max_ra_req_qp[0x6];
182 u8 reserved_14[0xa];
183 u8 log_max_ra_res_qp[0x6];
184
185 u8 pad_cap[0x1];
186 u8 cc_query_allowed[0x1];
187 u8 cc_modify_allowed[0x1];
188 u8 reserved_15[0x1d];
189
190 u8 reserved_16[0x6];
191 u8 max_qp_cnt[0xa];
192 u8 pkey_table_size[0x10];
193
194 u8 eswitch_owner[0x1];
195 u8 reserved_17[0xa];
196 u8 local_ca_ack_delay[0x5];
197 u8 reserved_18[0x8];
198 u8 num_ports[0x8];
199
200 u8 reserved_19[0x3];
201 u8 log_max_msg[0x5];
202 u8 reserved_20[0x18];
203
204 u8 stat_rate_support[0x10];
205 u8 reserved_21[0x10];
206
207 u8 reserved_22[0x10];
208 u8 cmdif_checksum[0x2];
209 u8 sigerr_cqe[0x1];
210 u8 reserved_23[0x1];
211 u8 wq_signature[0x1];
212 u8 sctr_data_cqe[0x1];
213 u8 reserved_24[0x1];
214 u8 sho[0x1];
215 u8 tph[0x1];
216 u8 rf[0x1];
217 u8 dc[0x1];
218 u8 reserved_25[0x2];
219 u8 roce[0x1];
220 u8 atomic[0x1];
221 u8 rsz_srq[0x1];
222
223 u8 cq_oi[0x1];
224 u8 cq_resize[0x1];
225 u8 cq_moderation[0x1];
226 u8 sniffer_rule_flow[0x1];
227 u8 sniffer_rule_vport[0x1];
228 u8 sniffer_rule_phy[0x1];
229 u8 reserved_26[0x1];
230 u8 pg[0x1];
231 u8 block_lb_mc[0x1];
232 u8 reserved_27[0x3];
233 u8 cd[0x1];
234 u8 reserved_28[0x1];
235 u8 apm[0x1];
236 u8 reserved_29[0x7];
237 u8 qkv[0x1];
238 u8 pkv[0x1];
239 u8 reserved_30[0x4];
240 u8 xrc[0x1];
241 u8 ud[0x1];
242 u8 uc[0x1];
243 u8 rc[0x1];
244
245 u8 reserved_31[0xa];
246 u8 uar_sz[0x6];
247 u8 reserved_32[0x8];
248 u8 log_pg_sz[0x8];
249
250 u8 bf[0x1];
251 u8 reserved_33[0xa];
252 u8 log_bf_reg_size[0x5];
253 u8 reserved_34[0x10];
254
255 u8 reserved_35[0x10];
256 u8 max_wqe_sz_sq[0x10];
257
258 u8 reserved_36[0x10];
259 u8 max_wqe_sz_rq[0x10];
260
261 u8 reserved_37[0x10];
262 u8 max_wqe_sz_sq_dc[0x10];
263
264 u8 reserved_38[0x7];
265 u8 max_qp_mcg[0x19];
266
267 u8 reserved_39[0x18];
268 u8 log_max_mcg[0x8];
269
270 u8 reserved_40[0xb];
271 u8 log_max_pd[0x5];
272 u8 reserved_41[0xb];
273 u8 log_max_xrcd[0x5];
274
275 u8 reserved_42[0x20];
276
277 u8 reserved_43[0x3];
278 u8 log_max_rq[0x5];
279 u8 reserved_44[0x3];
280 u8 log_max_sq[0x5];
281 u8 reserved_45[0x3];
282 u8 log_max_tir[0x5];
283 u8 reserved_46[0x3];
284 u8 log_max_tis[0x5];
285
286 u8 reserved_47[0x13];
287 u8 log_max_rq_per_tir[0x5];
288 u8 reserved_48[0x3];
289 u8 log_max_tis_per_sq[0x5];
290
291 u8 reserved_49[0xe0];
292
293 u8 reserved_50[0x10];
294 u8 log_uar_page_sz[0x10];
295
296 u8 reserved_51[0x100];
297
298 u8 reserved_52[0x1f];
299 u8 cqe_zip[0x1];
300
301 u8 cqe_zip_timeout[0x10];
302 u8 cqe_zip_max_num[0x10];
303
304 u8 reserved_53[0x220];
305};
306
307struct mlx5_ifc_set_hca_cap_in_bits {
308 u8 opcode[0x10];
309 u8 reserved_0[0x10];
310
311 u8 reserved_1[0x10];
312 u8 op_mod[0x10];
313
314 u8 reserved_2[0x40];
315
316 struct mlx5_ifc_cmd_hca_cap_bits hca_capability_struct;
317};
318
319struct mlx5_ifc_query_hca_cap_in_bits {
320 u8 opcode[0x10];
321 u8 reserved_0[0x10];
322
323 u8 reserved_1[0x10];
324 u8 op_mod[0x10];
325
326 u8 reserved_2[0x40];
327};
328
329struct mlx5_ifc_query_hca_cap_out_bits {
330 u8 status[0x8];
331 u8 reserved_0[0x18];
332
333 u8 syndrome[0x20];
334
335 u8 reserved_1[0x40];
336
337 u8 capability_struct[256][0x8];
338};
339
340struct mlx5_ifc_set_hca_cap_out_bits {
341 u8 status[0x8];
342 u8 reserved_0[0x18];
343
344 u8 syndrome[0x20];
345
346 u8 reserved_1[0x40];
347};
348
349#endif /* MLX5_IFC_H */
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index 9709b30e2d69..3fa075daeb1d 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -40,6 +40,15 @@
40#define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 5) 40#define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 5)
41#define MLX5_DIF_SIZE 8 41#define MLX5_DIF_SIZE 8
42#define MLX5_STRIDE_BLOCK_OP 0x400 42#define MLX5_STRIDE_BLOCK_OP 0x400
43#define MLX5_CPY_GRD_MASK 0xc0
44#define MLX5_CPY_APP_MASK 0x30
45#define MLX5_CPY_REF_MASK 0x0f
46#define MLX5_BSF_INC_REFTAG (1 << 6)
47#define MLX5_BSF_INL_VALID (1 << 15)
48#define MLX5_BSF_REFRESH_DIF (1 << 14)
49#define MLX5_BSF_REPEAT_BLOCK (1 << 7)
50#define MLX5_BSF_APPTAG_ESCAPE 0x1
51#define MLX5_BSF_APPREF_ESCAPE 0x2
43 52
44enum mlx5_qp_optpar { 53enum mlx5_qp_optpar {
45 MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0, 54 MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0,
@@ -287,6 +296,22 @@ struct mlx5_wqe_inline_seg {
287 __be32 byte_count; 296 __be32 byte_count;
288}; 297};
289 298
299enum mlx5_sig_type {
300 MLX5_DIF_CRC = 0x1,
301 MLX5_DIF_IPCS = 0x2,
302};
303
304struct mlx5_bsf_inl {
305 __be16 vld_refresh;
306 __be16 dif_apptag;
307 __be32 dif_reftag;
308 u8 sig_type;
309 u8 rp_inv_seed;
310 u8 rsvd[3];
311 u8 dif_inc_ref_guard_check;
312 __be16 dif_app_bitmask_check;
313};
314
290struct mlx5_bsf { 315struct mlx5_bsf {
291 struct mlx5_bsf_basic { 316 struct mlx5_bsf_basic {
292 u8 bsf_size_sbs; 317 u8 bsf_size_sbs;
@@ -310,14 +335,8 @@ struct mlx5_bsf {
310 __be32 w_tfs_psv; 335 __be32 w_tfs_psv;
311 __be32 m_tfs_psv; 336 __be32 m_tfs_psv;
312 } ext; 337 } ext;
313 struct mlx5_bsf_inl { 338 struct mlx5_bsf_inl w_inl;
314 __be32 w_inl_vld; 339 struct mlx5_bsf_inl m_inl;
315 __be32 w_rsvd;
316 __be64 w_block_format;
317 __be32 m_inl_vld;
318 __be32 m_rsvd;
319 __be64 m_block_format;
320 } inl;
321}; 340};
322 341
323struct mlx5_klm { 342struct mlx5_klm {
@@ -342,10 +361,9 @@ struct mlx5_stride_block_ctrl_seg {
342}; 361};
343 362
344struct mlx5_core_qp { 363struct mlx5_core_qp {
364 struct mlx5_core_rsc_common common; /* must be first */
345 void (*event) (struct mlx5_core_qp *, int); 365 void (*event) (struct mlx5_core_qp *, int);
346 int qpn; 366 int qpn;
347 atomic_t refcount;
348 struct completion free;
349 struct mlx5_rsc_debug *dbg; 367 struct mlx5_rsc_debug *dbg;
350 int pid; 368 int pid;
351}; 369};
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e03dd29145a0..b46461116cd2 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -18,6 +18,7 @@
18#include <linux/pfn.h> 18#include <linux/pfn.h>
19#include <linux/bit_spinlock.h> 19#include <linux/bit_spinlock.h>
20#include <linux/shrinker.h> 20#include <linux/shrinker.h>
21#include <linux/resource.h>
21 22
22struct mempolicy; 23struct mempolicy;
23struct anon_vma; 24struct anon_vma;
@@ -346,6 +347,7 @@ static inline int put_page_unless_one(struct page *page)
346} 347}
347 348
348extern int page_is_ram(unsigned long pfn); 349extern int page_is_ram(unsigned long pfn);
350extern int region_is_ram(resource_size_t phys_addr, unsigned long size);
349 351
350/* Support for virtually mapped pages */ 352/* Support for virtually mapped pages */
351struct page *vmalloc_to_page(const void *addr); 353struct page *vmalloc_to_page(const void *addr);
@@ -553,6 +555,25 @@ static inline void __ClearPageBuddy(struct page *page)
553 atomic_set(&page->_mapcount, -1); 555 atomic_set(&page->_mapcount, -1);
554} 556}
555 557
558#define PAGE_BALLOON_MAPCOUNT_VALUE (-256)
559
560static inline int PageBalloon(struct page *page)
561{
562 return atomic_read(&page->_mapcount) == PAGE_BALLOON_MAPCOUNT_VALUE;
563}
564
565static inline void __SetPageBalloon(struct page *page)
566{
567 VM_BUG_ON_PAGE(atomic_read(&page->_mapcount) != -1, page);
568 atomic_set(&page->_mapcount, PAGE_BALLOON_MAPCOUNT_VALUE);
569}
570
571static inline void __ClearPageBalloon(struct page *page)
572{
573 VM_BUG_ON_PAGE(!PageBalloon(page), page);
574 atomic_set(&page->_mapcount, -1);
575}
576
556void put_page(struct page *page); 577void put_page(struct page *page);
557void put_pages_list(struct list_head *pages); 578void put_pages_list(struct list_head *pages);
558 579
@@ -1155,6 +1176,7 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
1155 1176
1156extern void truncate_pagecache(struct inode *inode, loff_t new); 1177extern void truncate_pagecache(struct inode *inode, loff_t new);
1157extern void truncate_setsize(struct inode *inode, loff_t newsize); 1178extern void truncate_setsize(struct inode *inode, loff_t newsize);
1179void pagecache_isize_extended(struct inode *inode, loff_t from, loff_t to);
1158void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end); 1180void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end);
1159int truncate_inode_page(struct address_space *mapping, struct page *page); 1181int truncate_inode_page(struct address_space *mapping, struct page *page);
1160int generic_error_remove_page(struct address_space *mapping, struct page *page); 1182int generic_error_remove_page(struct address_space *mapping, struct page *page);
@@ -1213,7 +1235,6 @@ int __set_page_dirty_no_writeback(struct page *page);
1213int redirty_page_for_writepage(struct writeback_control *wbc, 1235int redirty_page_for_writepage(struct writeback_control *wbc,
1214 struct page *page); 1236 struct page *page);
1215void account_page_dirtied(struct page *page, struct address_space *mapping); 1237void account_page_dirtied(struct page *page, struct address_space *mapping);
1216void account_page_writeback(struct page *page);
1217int set_page_dirty(struct page *page); 1238int set_page_dirty(struct page *page);
1218int set_page_dirty_lock(struct page *page); 1239int set_page_dirty_lock(struct page *page);
1219int clear_page_dirty_for_io(struct page *page); 1240int clear_page_dirty_for_io(struct page *page);
@@ -1247,8 +1268,8 @@ static inline int stack_guard_page_end(struct vm_area_struct *vma,
1247 !vma_growsup(vma->vm_next, addr); 1268 !vma_growsup(vma->vm_next, addr);
1248} 1269}
1249 1270
1250extern pid_t 1271extern struct task_struct *task_of_stack(struct task_struct *task,
1251vm_is_stack(struct task_struct *task, struct vm_area_struct *vma, int in_group); 1272 struct vm_area_struct *vma, bool in_group);
1252 1273
1253extern unsigned long move_page_tables(struct vm_area_struct *vma, 1274extern unsigned long move_page_tables(struct vm_area_struct *vma,
1254 unsigned long old_addr, struct vm_area_struct *new_vma, 1275 unsigned long old_addr, struct vm_area_struct *new_vma,
@@ -1780,6 +1801,20 @@ extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
1780 bool *need_rmap_locks); 1801 bool *need_rmap_locks);
1781extern void exit_mmap(struct mm_struct *); 1802extern void exit_mmap(struct mm_struct *);
1782 1803
1804static inline int check_data_rlimit(unsigned long rlim,
1805 unsigned long new,
1806 unsigned long start,
1807 unsigned long end_data,
1808 unsigned long start_data)
1809{
1810 if (rlim < RLIM_INFINITY) {
1811 if (((new - start) + (end_data - start_data)) > rlim)
1812 return -ENOSPC;
1813 }
1814
1815 return 0;
1816}
1817
1783extern int mm_take_all_locks(struct mm_struct *mm); 1818extern int mm_take_all_locks(struct mm_struct *mm);
1784extern void mm_drop_all_locks(struct mm_struct *mm); 1819extern void mm_drop_all_locks(struct mm_struct *mm);
1785 1820
@@ -1939,11 +1974,16 @@ static inline struct vm_area_struct *find_exact_vma(struct mm_struct *mm,
1939 1974
1940#ifdef CONFIG_MMU 1975#ifdef CONFIG_MMU
1941pgprot_t vm_get_page_prot(unsigned long vm_flags); 1976pgprot_t vm_get_page_prot(unsigned long vm_flags);
1977void vma_set_page_prot(struct vm_area_struct *vma);
1942#else 1978#else
1943static inline pgprot_t vm_get_page_prot(unsigned long vm_flags) 1979static inline pgprot_t vm_get_page_prot(unsigned long vm_flags)
1944{ 1980{
1945 return __pgprot(0); 1981 return __pgprot(0);
1946} 1982}
1983static inline void vma_set_page_prot(struct vm_area_struct *vma)
1984{
1985 vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
1986}
1947#endif 1987#endif
1948 1988
1949#ifdef CONFIG_NUMA_BALANCING 1989#ifdef CONFIG_NUMA_BALANCING
@@ -1985,6 +2025,7 @@ static inline struct page *follow_page(struct vm_area_struct *vma,
1985#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ 2025#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */
1986#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */ 2026#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */
1987#define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */ 2027#define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */
2028#define FOLL_TRIED 0x800 /* a retry, previous pass started an IO */
1988 2029
1989typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, 2030typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
1990 void *data); 2031 void *data);
@@ -2014,13 +2055,20 @@ static inline bool kernel_page_present(struct page *page) { return true; }
2014#endif /* CONFIG_HIBERNATION */ 2055#endif /* CONFIG_HIBERNATION */
2015#endif 2056#endif
2016 2057
2058#ifdef __HAVE_ARCH_GATE_AREA
2017extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm); 2059extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm);
2018#ifdef __HAVE_ARCH_GATE_AREA 2060extern int in_gate_area_no_mm(unsigned long addr);
2019int in_gate_area_no_mm(unsigned long addr); 2061extern int in_gate_area(struct mm_struct *mm, unsigned long addr);
2020int in_gate_area(struct mm_struct *mm, unsigned long addr);
2021#else 2062#else
2022int in_gate_area_no_mm(unsigned long addr); 2063static inline struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
2023#define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);}) 2064{
2065 return NULL;
2066}
2067static inline int in_gate_area_no_mm(unsigned long addr) { return 0; }
2068static inline int in_gate_area(struct mm_struct *mm, unsigned long addr)
2069{
2070 return 0;
2071}
2024#endif /* __HAVE_ARCH_GATE_AREA */ 2072#endif /* __HAVE_ARCH_GATE_AREA */
2025 2073
2026#ifdef CONFIG_SYSCTL 2074#ifdef CONFIG_SYSCTL
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 796deac19fcf..6e0b286649f1 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -461,6 +461,7 @@ static inline void mm_init_cpumask(struct mm_struct *mm)
461#ifdef CONFIG_CPUMASK_OFFSTACK 461#ifdef CONFIG_CPUMASK_OFFSTACK
462 mm->cpu_vm_mask_var = &mm->cpumask_allocation; 462 mm->cpu_vm_mask_var = &mm->cpumask_allocation;
463#endif 463#endif
464 cpumask_clear(mm->cpu_vm_mask_var);
464} 465}
465 466
466/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */ 467/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index d424b9de3aff..b0692d28f8e6 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -42,7 +42,8 @@ struct mmc_csd {
42 unsigned int read_partial:1, 42 unsigned int read_partial:1,
43 read_misalign:1, 43 read_misalign:1,
44 write_partial:1, 44 write_partial:1,
45 write_misalign:1; 45 write_misalign:1,
46 dsr_imp:1;
46}; 47};
47 48
48struct mmc_ext_csd { 49struct mmc_ext_csd {
@@ -74,7 +75,7 @@ struct mmc_ext_csd {
74 unsigned int sec_trim_mult; /* Secure trim multiplier */ 75 unsigned int sec_trim_mult; /* Secure trim multiplier */
75 unsigned int sec_erase_mult; /* Secure erase multiplier */ 76 unsigned int sec_erase_mult; /* Secure erase multiplier */
76 unsigned int trim_timeout; /* In milliseconds */ 77 unsigned int trim_timeout; /* In milliseconds */
77 bool enhanced_area_en; /* enable bit */ 78 bool partition_setting_completed; /* enable bit */
78 unsigned long long enhanced_area_offset; /* Units: Byte */ 79 unsigned long long enhanced_area_offset; /* Units: Byte */
79 unsigned int enhanced_area_size; /* Units: KB */ 80 unsigned int enhanced_area_size; /* Units: KB */
80 unsigned int cache_size; /* Units: KB */ 81 unsigned int cache_size; /* Units: KB */
@@ -214,11 +215,12 @@ enum mmc_blk_status {
214}; 215};
215 216
216/* The number of MMC physical partitions. These consist of: 217/* The number of MMC physical partitions. These consist of:
217 * boot partitions (2), general purpose partitions (4) in MMC v4.4. 218 * boot partitions (2), general purpose partitions (4) and
219 * RPMB partition (1) in MMC v4.4.
218 */ 220 */
219#define MMC_NUM_BOOT_PARTITION 2 221#define MMC_NUM_BOOT_PARTITION 2
220#define MMC_NUM_GP_PARTITION 4 222#define MMC_NUM_GP_PARTITION 4
221#define MMC_NUM_PHY_PARTITION 6 223#define MMC_NUM_PHY_PARTITION 7
222#define MAX_MMC_PART_NAME_LEN 20 224#define MAX_MMC_PART_NAME_LEN 20
223 225
224/* 226/*
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index babaea93bca6..001366927cf4 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -26,6 +26,8 @@ enum dw_mci_state {
26 STATE_DATA_BUSY, 26 STATE_DATA_BUSY,
27 STATE_SENDING_STOP, 27 STATE_SENDING_STOP,
28 STATE_DATA_ERROR, 28 STATE_DATA_ERROR,
29 STATE_SENDING_CMD11,
30 STATE_WAITING_CMD11_DONE,
29}; 31};
30 32
31enum { 33enum {
@@ -188,7 +190,7 @@ struct dw_mci {
188 /* Workaround flags */ 190 /* Workaround flags */
189 u32 quirks; 191 u32 quirks;
190 192
191 struct regulator *vmmc; /* Power regulator */ 193 bool vqmmc_enabled;
192 unsigned long irq_flags; /* IRQ flags */ 194 unsigned long irq_flags; /* IRQ flags */
193 int irq; 195 int irq;
194}; 196};
@@ -213,6 +215,8 @@ struct dw_mci_dma_ops {
213#define DW_MCI_QUIRK_HIGHSPEED BIT(2) 215#define DW_MCI_QUIRK_HIGHSPEED BIT(2)
214/* Unreliable card detection */ 216/* Unreliable card detection */
215#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3) 217#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)
218/* No write protect */
219#define DW_MCI_QUIRK_NO_WRITE_PROTECT BIT(4)
216 220
217/* Slot level quirks */ 221/* Slot level quirks */
218/* This slot has no write protect */ 222/* This slot has no write protect */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 7960424d0bc0..df0c15396bbf 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -42,6 +42,7 @@ struct mmc_ios {
42#define MMC_POWER_OFF 0 42#define MMC_POWER_OFF 0
43#define MMC_POWER_UP 1 43#define MMC_POWER_UP 1
44#define MMC_POWER_ON 2 44#define MMC_POWER_ON 2
45#define MMC_POWER_UNDEFINED 3
45 46
46 unsigned char bus_width; /* data bus width */ 47 unsigned char bus_width; /* data bus width */
47 48
@@ -139,6 +140,13 @@ struct mmc_host_ops {
139 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); 140 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
140 void (*hw_reset)(struct mmc_host *host); 141 void (*hw_reset)(struct mmc_host *host);
141 void (*card_event)(struct mmc_host *host); 142 void (*card_event)(struct mmc_host *host);
143
144 /*
145 * Optional callback to support controllers with HW issues for multiple
146 * I/O. Returns the number of supported blocks for the request.
147 */
148 int (*multi_io_quirk)(struct mmc_card *card,
149 unsigned int direction, int blk_size);
142}; 150};
143 151
144struct mmc_card; 152struct mmc_card;
@@ -265,7 +273,6 @@ struct mmc_host {
265 273
266#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */ 274#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
267#define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */ 275#define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */
268#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
269#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */ 276#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
270#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */ 277#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */
271#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ 278#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
@@ -365,6 +372,9 @@ struct mmc_host {
365 372
366 unsigned int slotno; /* used for sdio acpi binding */ 373 unsigned int slotno; /* used for sdio acpi binding */
367 374
375 int dsr_req; /* DSR value is valid */
376 u32 dsr; /* optional driver stage (DSR) value */
377
368 unsigned long private[0] ____cacheline_aligned; 378 unsigned long private[0] ____cacheline_aligned;
369}; 379};
370 380
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 64ec963ed347..1cd00b3a75b9 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -53,6 +53,11 @@
53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */ 53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */
54#define MMC_SEND_TUNING_BLOCK_HS200 21 /* adtc R1 */ 54#define MMC_SEND_TUNING_BLOCK_HS200 21 /* adtc R1 */
55 55
56#define MMC_TUNING_BLK_PATTERN_4BIT_SIZE 64
57#define MMC_TUNING_BLK_PATTERN_8BIT_SIZE 128
58extern const u8 tuning_blk_pattern_4bit[MMC_TUNING_BLK_PATTERN_4BIT_SIZE];
59extern const u8 tuning_blk_pattern_8bit[MMC_TUNING_BLK_PATTERN_8BIT_SIZE];
60
56 /* class 3 */ 61 /* class 3 */
57#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */ 62#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */
58 63
@@ -281,6 +286,7 @@ struct _mmc_csd {
281#define EXT_CSD_EXP_EVENTS_CTRL 56 /* R/W, 2 bytes */ 286#define EXT_CSD_EXP_EVENTS_CTRL 56 /* R/W, 2 bytes */
282#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */ 287#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */
283#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */ 288#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */
289#define EXT_CSD_PARTITION_SETTING_COMPLETED 155 /* R/W */
284#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ 290#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
285#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ 291#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
286#define EXT_CSD_HPI_MGMT 161 /* R/W */ 292#define EXT_CSD_HPI_MGMT 161 /* R/W */
@@ -349,6 +355,7 @@ struct _mmc_csd {
349#define EXT_CSD_PART_CONFIG_ACC_RPMB (0x3) 355#define EXT_CSD_PART_CONFIG_ACC_RPMB (0x3)
350#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4) 356#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4)
351 357
358#define EXT_CSD_PART_SETTING_COMPLETED (0x1)
352#define EXT_CSD_PART_SUPPORT_PART_EN (0x1) 359#define EXT_CSD_PART_SUPPORT_PART_EN (0x1)
353 360
354#define EXT_CSD_CMD_SET_NORMAL (1<<0) 361#define EXT_CSD_CMD_SET_NORMAL (1<<0)
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 08abe9941884..dba793e3a331 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -98,15 +98,14 @@ struct sdhci_host {
98#define SDHCI_QUIRK2_BROKEN_HS200 (1<<6) 98#define SDHCI_QUIRK2_BROKEN_HS200 (1<<6)
99/* Controller does not support DDR50 */ 99/* Controller does not support DDR50 */
100#define SDHCI_QUIRK2_BROKEN_DDR50 (1<<7) 100#define SDHCI_QUIRK2_BROKEN_DDR50 (1<<7)
101/* Stop command (CMD12) can set Transfer Complete when not using MMC_RSP_BUSY */
102#define SDHCI_QUIRK2_STOP_WITH_TC (1<<8)
101 103
102 int irq; /* Device IRQ */ 104 int irq; /* Device IRQ */
103 void __iomem *ioaddr; /* Mapped address */ 105 void __iomem *ioaddr; /* Mapped address */
104 106
105 const struct sdhci_ops *ops; /* Low level hw interface */ 107 const struct sdhci_ops *ops; /* Low level hw interface */
106 108
107 struct regulator *vmmc; /* Power regulator (vmmc) */
108 struct regulator *vqmmc; /* Signaling regulator (vccq) */
109
110 /* Internal data */ 109 /* Internal data */
111 struct mmc_host *mmc; /* MMC structure */ 110 struct mmc_host *mmc; /* MMC structure */
112 u64 dma_mask; /* custom DMA mask */ 111 u64 dma_mask; /* custom DMA mask */
@@ -149,6 +148,7 @@ struct sdhci_host {
149 struct mmc_command *cmd; /* Current command */ 148 struct mmc_command *cmd; /* Current command */
150 struct mmc_data *data; /* Current data request */ 149 struct mmc_data *data; /* Current data request */
151 unsigned int data_early:1; /* Data finished before cmd */ 150 unsigned int data_early:1; /* Data finished before cmd */
151 unsigned int busy_handle:1; /* Handling the order of Busy-end */
152 152
153 struct sg_mapping_iter sg_miter; /* SG state for PIO */ 153 struct sg_mapping_iter sg_miter; /* SG state for PIO */
154 unsigned int blocks; /* remaining PIO blocks */ 154 unsigned int blocks; /* remaining PIO blocks */
diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h
index d2433381e828..e56fa24c9322 100644
--- a/include/linux/mmc/slot-gpio.h
+++ b/include/linux/mmc/slot-gpio.h
@@ -24,7 +24,10 @@ void mmc_gpio_free_cd(struct mmc_host *host);
24 24
25int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id, 25int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id,
26 unsigned int idx, bool override_active_level, 26 unsigned int idx, bool override_active_level,
27 unsigned int debounce); 27 unsigned int debounce, bool *gpio_invert);
28int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id,
29 unsigned int idx, bool override_active_level,
30 unsigned int debounce, bool *gpio_invert);
28void mmc_gpiod_free_cd(struct mmc_host *host); 31void mmc_gpiod_free_cd(struct mmc_host *host);
29void mmc_gpiod_request_cd_irq(struct mmc_host *host); 32void mmc_gpiod_request_cd_irq(struct mmc_host *host);
30 33
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index edd82a105220..877ef226f90f 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -4,10 +4,14 @@
4#include <linux/stringify.h> 4#include <linux/stringify.h>
5 5
6struct page; 6struct page;
7struct vm_area_struct;
8struct mm_struct;
7 9
8extern void dump_page(struct page *page, const char *reason); 10extern void dump_page(struct page *page, const char *reason);
9extern void dump_page_badflags(struct page *page, const char *reason, 11extern void dump_page_badflags(struct page *page, const char *reason,
10 unsigned long badflags); 12 unsigned long badflags);
13void dump_vma(const struct vm_area_struct *vma);
14void dump_mm(const struct mm_struct *mm);
11 15
12#ifdef CONFIG_DEBUG_VM 16#ifdef CONFIG_DEBUG_VM
13#define VM_BUG_ON(cond) BUG_ON(cond) 17#define VM_BUG_ON(cond) BUG_ON(cond)
@@ -18,13 +22,31 @@ extern void dump_page_badflags(struct page *page, const char *reason,
18 BUG(); \ 22 BUG(); \
19 } \ 23 } \
20 } while (0) 24 } while (0)
25#define VM_BUG_ON_VMA(cond, vma) \
26 do { \
27 if (unlikely(cond)) { \
28 dump_vma(vma); \
29 BUG(); \
30 } \
31 } while (0)
32#define VM_BUG_ON_MM(cond, mm) \
33 do { \
34 if (unlikely(cond)) { \
35 dump_mm(mm); \
36 BUG(); \
37 } \
38 } while (0)
21#define VM_WARN_ON(cond) WARN_ON(cond) 39#define VM_WARN_ON(cond) WARN_ON(cond)
22#define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond) 40#define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond)
41#define VM_WARN_ONCE(cond, format...) WARN_ONCE(cond, format)
23#else 42#else
24#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond) 43#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
25#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond) 44#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
45#define VM_BUG_ON_VMA(cond, vma) VM_BUG_ON(cond)
46#define VM_BUG_ON_MM(cond, mm) VM_BUG_ON(cond)
26#define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond) 47#define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond)
27#define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond) 48#define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond)
49#define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond)
28#endif 50#endif
29 51
30#ifdef CONFIG_DEBUG_VIRTUAL 52#ifdef CONFIG_DEBUG_VIRTUAL
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index deca87452528..88787bb4b3b9 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -57,10 +57,13 @@ struct mmu_notifier_ops {
57 * pte. This way the VM will provide proper aging to the 57 * pte. This way the VM will provide proper aging to the
58 * accesses to the page through the secondary MMUs and not 58 * accesses to the page through the secondary MMUs and not
59 * only to the ones through the Linux pte. 59 * only to the ones through the Linux pte.
60 * Start-end is necessary in case the secondary MMU is mapping the page
61 * at a smaller granularity than the primary MMU.
60 */ 62 */
61 int (*clear_flush_young)(struct mmu_notifier *mn, 63 int (*clear_flush_young)(struct mmu_notifier *mn,
62 struct mm_struct *mm, 64 struct mm_struct *mm,
63 unsigned long address); 65 unsigned long start,
66 unsigned long end);
64 67
65 /* 68 /*
66 * test_young is called to check the young/accessed bitflag in 69 * test_young is called to check the young/accessed bitflag in
@@ -170,10 +173,13 @@ extern int __mmu_notifier_register(struct mmu_notifier *mn,
170 struct mm_struct *mm); 173 struct mm_struct *mm);
171extern void mmu_notifier_unregister(struct mmu_notifier *mn, 174extern void mmu_notifier_unregister(struct mmu_notifier *mn,
172 struct mm_struct *mm); 175 struct mm_struct *mm);
176extern void mmu_notifier_unregister_no_release(struct mmu_notifier *mn,
177 struct mm_struct *mm);
173extern void __mmu_notifier_mm_destroy(struct mm_struct *mm); 178extern void __mmu_notifier_mm_destroy(struct mm_struct *mm);
174extern void __mmu_notifier_release(struct mm_struct *mm); 179extern void __mmu_notifier_release(struct mm_struct *mm);
175extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm, 180extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm,
176 unsigned long address); 181 unsigned long start,
182 unsigned long end);
177extern int __mmu_notifier_test_young(struct mm_struct *mm, 183extern int __mmu_notifier_test_young(struct mm_struct *mm,
178 unsigned long address); 184 unsigned long address);
179extern void __mmu_notifier_change_pte(struct mm_struct *mm, 185extern void __mmu_notifier_change_pte(struct mm_struct *mm,
@@ -192,10 +198,11 @@ static inline void mmu_notifier_release(struct mm_struct *mm)
192} 198}
193 199
194static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm, 200static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
195 unsigned long address) 201 unsigned long start,
202 unsigned long end)
196{ 203{
197 if (mm_has_notifiers(mm)) 204 if (mm_has_notifiers(mm))
198 return __mmu_notifier_clear_flush_young(mm, address); 205 return __mmu_notifier_clear_flush_young(mm, start, end);
199 return 0; 206 return 0;
200} 207}
201 208
@@ -253,7 +260,9 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
253 unsigned long ___address = __address; \ 260 unsigned long ___address = __address; \
254 __young = ptep_clear_flush_young(___vma, ___address, __ptep); \ 261 __young = ptep_clear_flush_young(___vma, ___address, __ptep); \
255 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \ 262 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \
256 ___address); \ 263 ___address, \
264 ___address + \
265 PAGE_SIZE); \
257 __young; \ 266 __young; \
258}) 267})
259 268
@@ -264,7 +273,9 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
264 unsigned long ___address = __address; \ 273 unsigned long ___address = __address; \
265 __young = pmdp_clear_flush_young(___vma, ___address, __pmdp); \ 274 __young = pmdp_clear_flush_young(___vma, ___address, __pmdp); \
266 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \ 275 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \
267 ___address); \ 276 ___address, \
277 ___address + \
278 PMD_SIZE); \
268 __young; \ 279 __young; \
269}) 280})
270 281
@@ -288,6 +299,10 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
288 set_pte_at(___mm, ___address, __ptep, ___pte); \ 299 set_pte_at(___mm, ___address, __ptep, ___pte); \
289}) 300})
290 301
302extern void mmu_notifier_call_srcu(struct rcu_head *rcu,
303 void (*func)(struct rcu_head *rcu));
304extern void mmu_notifier_synchronize(void);
305
291#else /* CONFIG_MMU_NOTIFIER */ 306#else /* CONFIG_MMU_NOTIFIER */
292 307
293static inline void mmu_notifier_release(struct mm_struct *mm) 308static inline void mmu_notifier_release(struct mm_struct *mm)
@@ -295,7 +310,8 @@ static inline void mmu_notifier_release(struct mm_struct *mm)
295} 310}
296 311
297static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm, 312static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
298 unsigned long address) 313 unsigned long start,
314 unsigned long end)
299{ 315{
300 return 0; 316 return 0;
301} 317}
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 6cbd1b6c3d20..ffe66e381c04 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -143,6 +143,7 @@ enum zone_stat_item {
143 NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */ 143 NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */
144 NR_DIRTIED, /* page dirtyings since bootup */ 144 NR_DIRTIED, /* page dirtyings since bootup */
145 NR_WRITTEN, /* page writings since bootup */ 145 NR_WRITTEN, /* page writings since bootup */
146 NR_PAGES_SCANNED, /* pages scanned since last reclaim */
146#ifdef CONFIG_NUMA 147#ifdef CONFIG_NUMA
147 NUMA_HIT, /* allocated in intended node */ 148 NUMA_HIT, /* allocated in intended node */
148 NUMA_MISS, /* allocated in non intended node */ 149 NUMA_MISS, /* allocated in non intended node */
@@ -324,19 +325,12 @@ enum zone_type {
324#ifndef __GENERATING_BOUNDS_H 325#ifndef __GENERATING_BOUNDS_H
325 326
326struct zone { 327struct zone {
327 /* Fields commonly accessed by the page allocator */ 328 /* Read-mostly fields */
328 329
329 /* zone watermarks, access with *_wmark_pages(zone) macros */ 330 /* zone watermarks, access with *_wmark_pages(zone) macros */
330 unsigned long watermark[NR_WMARK]; 331 unsigned long watermark[NR_WMARK];
331 332
332 /* 333 /*
333 * When free pages are below this point, additional steps are taken
334 * when reading the number of free pages to avoid per-cpu counter
335 * drift allowing watermarks to be breached
336 */
337 unsigned long percpu_drift_mark;
338
339 /*
340 * We don't know if the memory that we're going to allocate will be freeable 334 * We don't know if the memory that we're going to allocate will be freeable
341 * or/and it will be released eventually, so to avoid totally wasting several 335 * or/and it will be released eventually, so to avoid totally wasting several
342 * GB of ram we must reserve some of the lower zone memory (otherwise we risk 336 * GB of ram we must reserve some of the lower zone memory (otherwise we risk
@@ -344,41 +338,26 @@ struct zone {
344 * on the higher zones). This array is recalculated at runtime if the 338 * on the higher zones). This array is recalculated at runtime if the
345 * sysctl_lowmem_reserve_ratio sysctl changes. 339 * sysctl_lowmem_reserve_ratio sysctl changes.
346 */ 340 */
347 unsigned long lowmem_reserve[MAX_NR_ZONES]; 341 long lowmem_reserve[MAX_NR_ZONES];
348
349 /*
350 * This is a per-zone reserve of pages that should not be
351 * considered dirtyable memory.
352 */
353 unsigned long dirty_balance_reserve;
354 342
355#ifdef CONFIG_NUMA 343#ifdef CONFIG_NUMA
356 int node; 344 int node;
345#endif
346
357 /* 347 /*
358 * zone reclaim becomes active if more unmapped pages exist. 348 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on
349 * this zone's LRU. Maintained by the pageout code.
359 */ 350 */
360 unsigned long min_unmapped_pages; 351 unsigned int inactive_ratio;
361 unsigned long min_slab_pages; 352
362#endif 353 struct pglist_data *zone_pgdat;
363 struct per_cpu_pageset __percpu *pageset; 354 struct per_cpu_pageset __percpu *pageset;
355
364 /* 356 /*
365 * free areas of different sizes 357 * This is a per-zone reserve of pages that should not be
358 * considered dirtyable memory.
366 */ 359 */
367 spinlock_t lock; 360 unsigned long dirty_balance_reserve;
368#if defined CONFIG_COMPACTION || defined CONFIG_CMA
369 /* Set to true when the PG_migrate_skip bits should be cleared */
370 bool compact_blockskip_flush;
371
372 /* pfn where compaction free scanner should start */
373 unsigned long compact_cached_free_pfn;
374 /* pfn where async and sync compaction migration scanner should start */
375 unsigned long compact_cached_migrate_pfn[2];
376#endif
377#ifdef CONFIG_MEMORY_HOTPLUG
378 /* see spanned/present_pages for more description */
379 seqlock_t span_seqlock;
380#endif
381 struct free_area free_area[MAX_ORDER];
382 361
383#ifndef CONFIG_SPARSEMEM 362#ifndef CONFIG_SPARSEMEM
384 /* 363 /*
@@ -388,74 +367,14 @@ struct zone {
388 unsigned long *pageblock_flags; 367 unsigned long *pageblock_flags;
389#endif /* CONFIG_SPARSEMEM */ 368#endif /* CONFIG_SPARSEMEM */
390 369
391#ifdef CONFIG_COMPACTION 370#ifdef CONFIG_NUMA
392 /*
393 * On compaction failure, 1<<compact_defer_shift compactions
394 * are skipped before trying again. The number attempted since
395 * last failure is tracked with compact_considered.
396 */
397 unsigned int compact_considered;
398 unsigned int compact_defer_shift;
399 int compact_order_failed;
400#endif
401
402 ZONE_PADDING(_pad1_)
403
404 /* Fields commonly accessed by the page reclaim scanner */
405 spinlock_t lru_lock;
406 struct lruvec lruvec;
407
408 /* Evictions & activations on the inactive file list */
409 atomic_long_t inactive_age;
410
411 unsigned long pages_scanned; /* since last reclaim */
412 unsigned long flags; /* zone flags, see below */
413
414 /* Zone statistics */
415 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
416
417 /*
418 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on
419 * this zone's LRU. Maintained by the pageout code.
420 */
421 unsigned int inactive_ratio;
422
423
424 ZONE_PADDING(_pad2_)
425 /* Rarely used or read-mostly fields */
426
427 /* 371 /*
428 * wait_table -- the array holding the hash table 372 * zone reclaim becomes active if more unmapped pages exist.
429 * wait_table_hash_nr_entries -- the size of the hash table array
430 * wait_table_bits -- wait_table_size == (1 << wait_table_bits)
431 *
432 * The purpose of all these is to keep track of the people
433 * waiting for a page to become available and make them
434 * runnable again when possible. The trouble is that this
435 * consumes a lot of space, especially when so few things
436 * wait on pages at a given time. So instead of using
437 * per-page waitqueues, we use a waitqueue hash table.
438 *
439 * The bucket discipline is to sleep on the same queue when
440 * colliding and wake all in that wait queue when removing.
441 * When something wakes, it must check to be sure its page is
442 * truly available, a la thundering herd. The cost of a
443 * collision is great, but given the expected load of the
444 * table, they should be so rare as to be outweighed by the
445 * benefits from the saved space.
446 *
447 * __wait_on_page_locked() and unlock_page() in mm/filemap.c, are the
448 * primary users of these fields, and in mm/page_alloc.c
449 * free_area_init_core() performs the initialization of them.
450 */ 373 */
451 wait_queue_head_t * wait_table; 374 unsigned long min_unmapped_pages;
452 unsigned long wait_table_hash_nr_entries; 375 unsigned long min_slab_pages;
453 unsigned long wait_table_bits; 376#endif /* CONFIG_NUMA */
454 377
455 /*
456 * Discontig memory support fields.
457 */
458 struct pglist_data *zone_pgdat;
459 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */ 378 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */
460 unsigned long zone_start_pfn; 379 unsigned long zone_start_pfn;
461 380
@@ -500,9 +419,11 @@ struct zone {
500 * adjust_managed_page_count() should be used instead of directly 419 * adjust_managed_page_count() should be used instead of directly
501 * touching zone->managed_pages and totalram_pages. 420 * touching zone->managed_pages and totalram_pages.
502 */ 421 */
422 unsigned long managed_pages;
503 unsigned long spanned_pages; 423 unsigned long spanned_pages;
504 unsigned long present_pages; 424 unsigned long present_pages;
505 unsigned long managed_pages; 425
426 const char *name;
506 427
507 /* 428 /*
508 * Number of MIGRATE_RESEVE page block. To maintain for just 429 * Number of MIGRATE_RESEVE page block. To maintain for just
@@ -510,66 +431,120 @@ struct zone {
510 */ 431 */
511 int nr_migrate_reserve_block; 432 int nr_migrate_reserve_block;
512 433
434#ifdef CONFIG_MEMORY_ISOLATION
513 /* 435 /*
514 * rarely used fields: 436 * Number of isolated pageblock. It is used to solve incorrect
437 * freepage counting problem due to racy retrieving migratetype
438 * of pageblock. Protected by zone->lock.
515 */ 439 */
516 const char *name; 440 unsigned long nr_isolate_pageblock;
441#endif
442
443#ifdef CONFIG_MEMORY_HOTPLUG
444 /* see spanned/present_pages for more description */
445 seqlock_t span_seqlock;
446#endif
447
448 /*
449 * wait_table -- the array holding the hash table
450 * wait_table_hash_nr_entries -- the size of the hash table array
451 * wait_table_bits -- wait_table_size == (1 << wait_table_bits)
452 *
453 * The purpose of all these is to keep track of the people
454 * waiting for a page to become available and make them
455 * runnable again when possible. The trouble is that this
456 * consumes a lot of space, especially when so few things
457 * wait on pages at a given time. So instead of using
458 * per-page waitqueues, we use a waitqueue hash table.
459 *
460 * The bucket discipline is to sleep on the same queue when
461 * colliding and wake all in that wait queue when removing.
462 * When something wakes, it must check to be sure its page is
463 * truly available, a la thundering herd. The cost of a
464 * collision is great, but given the expected load of the
465 * table, they should be so rare as to be outweighed by the
466 * benefits from the saved space.
467 *
468 * __wait_on_page_locked() and unlock_page() in mm/filemap.c, are the
469 * primary users of these fields, and in mm/page_alloc.c
470 * free_area_init_core() performs the initialization of them.
471 */
472 wait_queue_head_t *wait_table;
473 unsigned long wait_table_hash_nr_entries;
474 unsigned long wait_table_bits;
475
476 ZONE_PADDING(_pad1_)
477
478 /* Write-intensive fields used from the page allocator */
479 spinlock_t lock;
480
481 /* free areas of different sizes */
482 struct free_area free_area[MAX_ORDER];
483
484 /* zone flags, see below */
485 unsigned long flags;
486
487 ZONE_PADDING(_pad2_)
488
489 /* Write-intensive fields used by page reclaim */
490
491 /* Fields commonly accessed by the page reclaim scanner */
492 spinlock_t lru_lock;
493 struct lruvec lruvec;
494
495 /* Evictions & activations on the inactive file list */
496 atomic_long_t inactive_age;
497
498 /*
499 * When free pages are below this point, additional steps are taken
500 * when reading the number of free pages to avoid per-cpu counter
501 * drift allowing watermarks to be breached
502 */
503 unsigned long percpu_drift_mark;
504
505#if defined CONFIG_COMPACTION || defined CONFIG_CMA
506 /* pfn where compaction free scanner should start */
507 unsigned long compact_cached_free_pfn;
508 /* pfn where async and sync compaction migration scanner should start */
509 unsigned long compact_cached_migrate_pfn[2];
510#endif
511
512#ifdef CONFIG_COMPACTION
513 /*
514 * On compaction failure, 1<<compact_defer_shift compactions
515 * are skipped before trying again. The number attempted since
516 * last failure is tracked with compact_considered.
517 */
518 unsigned int compact_considered;
519 unsigned int compact_defer_shift;
520 int compact_order_failed;
521#endif
522
523#if defined CONFIG_COMPACTION || defined CONFIG_CMA
524 /* Set to true when the PG_migrate_skip bits should be cleared */
525 bool compact_blockskip_flush;
526#endif
527
528 ZONE_PADDING(_pad3_)
529 /* Zone statistics */
530 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
517} ____cacheline_internodealigned_in_smp; 531} ____cacheline_internodealigned_in_smp;
518 532
519typedef enum { 533enum zone_flags {
520 ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */ 534 ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */
521 ZONE_OOM_LOCKED, /* zone is in OOM killer zonelist */ 535 ZONE_OOM_LOCKED, /* zone is in OOM killer zonelist */
522 ZONE_CONGESTED, /* zone has many dirty pages backed by 536 ZONE_CONGESTED, /* zone has many dirty pages backed by
523 * a congested BDI 537 * a congested BDI
524 */ 538 */
525 ZONE_TAIL_LRU_DIRTY, /* reclaim scanning has recently found 539 ZONE_DIRTY, /* reclaim scanning has recently found
526 * many dirty file pages at the tail 540 * many dirty file pages at the tail
527 * of the LRU. 541 * of the LRU.
528 */ 542 */
529 ZONE_WRITEBACK, /* reclaim scanning has recently found 543 ZONE_WRITEBACK, /* reclaim scanning has recently found
530 * many pages under writeback 544 * many pages under writeback
531 */ 545 */
532} zone_flags_t; 546 ZONE_FAIR_DEPLETED, /* fair zone policy batch depleted */
533 547};
534static inline void zone_set_flag(struct zone *zone, zone_flags_t flag)
535{
536 set_bit(flag, &zone->flags);
537}
538
539static inline int zone_test_and_set_flag(struct zone *zone, zone_flags_t flag)
540{
541 return test_and_set_bit(flag, &zone->flags);
542}
543
544static inline void zone_clear_flag(struct zone *zone, zone_flags_t flag)
545{
546 clear_bit(flag, &zone->flags);
547}
548
549static inline int zone_is_reclaim_congested(const struct zone *zone)
550{
551 return test_bit(ZONE_CONGESTED, &zone->flags);
552}
553
554static inline int zone_is_reclaim_dirty(const struct zone *zone)
555{
556 return test_bit(ZONE_TAIL_LRU_DIRTY, &zone->flags);
557}
558
559static inline int zone_is_reclaim_writeback(const struct zone *zone)
560{
561 return test_bit(ZONE_WRITEBACK, &zone->flags);
562}
563
564static inline int zone_is_reclaim_locked(const struct zone *zone)
565{
566 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags);
567}
568
569static inline int zone_is_oom_locked(const struct zone *zone)
570{
571 return test_bit(ZONE_OOM_LOCKED, &zone->flags);
572}
573 548
574static inline unsigned long zone_end_pfn(const struct zone *zone) 549static inline unsigned long zone_end_pfn(const struct zone *zone)
575{ 550{
@@ -872,6 +847,8 @@ static inline int zone_movable_is_highmem(void)
872{ 847{
873#if defined(CONFIG_HIGHMEM) && defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) 848#if defined(CONFIG_HIGHMEM) && defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
874 return movable_zone == ZONE_HIGHMEM; 849 return movable_zone == ZONE_HIGHMEM;
850#elif defined(CONFIG_HIGHMEM)
851 return (ZONE_MOVABLE - 1) == ZONE_HIGHMEM;
875#else 852#else
876 return 0; 853 return 0;
877#endif 854#endif
diff --git a/include/linux/module.h b/include/linux/module.h
index f520a767c86c..71f282a4e307 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -396,18 +396,25 @@ bool is_module_address(unsigned long addr);
396bool is_module_percpu_address(unsigned long addr); 396bool is_module_percpu_address(unsigned long addr);
397bool is_module_text_address(unsigned long addr); 397bool is_module_text_address(unsigned long addr);
398 398
399static inline int within_module_core(unsigned long addr, const struct module *mod) 399static inline bool within_module_core(unsigned long addr,
400 const struct module *mod)
400{ 401{
401 return (unsigned long)mod->module_core <= addr && 402 return (unsigned long)mod->module_core <= addr &&
402 addr < (unsigned long)mod->module_core + mod->core_size; 403 addr < (unsigned long)mod->module_core + mod->core_size;
403} 404}
404 405
405static inline int within_module_init(unsigned long addr, const struct module *mod) 406static inline bool within_module_init(unsigned long addr,
407 const struct module *mod)
406{ 408{
407 return (unsigned long)mod->module_init <= addr && 409 return (unsigned long)mod->module_init <= addr &&
408 addr < (unsigned long)mod->module_init + mod->init_size; 410 addr < (unsigned long)mod->module_init + mod->init_size;
409} 411}
410 412
413static inline bool within_module(unsigned long addr, const struct module *mod)
414{
415 return within_module_init(addr, mod) || within_module_core(addr, mod);
416}
417
411/* Search for module by name: must hold module_mutex. */ 418/* Search for module by name: must hold module_mutex. */
412struct module *find_module(const char *name); 419struct module *find_module(const char *name);
413 420
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index 560ca53a75fa..7eeb9bbfb816 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -45,7 +45,8 @@ static inline int apply_relocate(Elf_Shdr *sechdrs,
45 unsigned int relsec, 45 unsigned int relsec,
46 struct module *me) 46 struct module *me)
47{ 47{
48 printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name); 48 printk(KERN_ERR "module %s: REL relocation unsupported\n",
49 module_name(me));
49 return -ENOEXEC; 50 return -ENOEXEC;
50} 51}
51#endif 52#endif
@@ -67,7 +68,8 @@ static inline int apply_relocate_add(Elf_Shdr *sechdrs,
67 unsigned int relsec, 68 unsigned int relsec,
68 struct module *me) 69 struct module *me)
69{ 70{
70 printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name); 71 printk(KERN_ERR "module %s: REL relocation unsupported\n",
72 module_name(me));
71 return -ENOEXEC; 73 return -ENOEXEC;
72} 74}
73#endif 75#endif
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 494f99e852da..1c9effa25e26 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -42,7 +42,7 @@ struct kernel_param;
42 * NOARG - the parameter allows for no argument (foo instead of foo=1) 42 * NOARG - the parameter allows for no argument (foo instead of foo=1)
43 */ 43 */
44enum { 44enum {
45 KERNEL_PARAM_FL_NOARG = (1 << 0) 45 KERNEL_PARAM_OPS_FL_NOARG = (1 << 0)
46}; 46};
47 47
48struct kernel_param_ops { 48struct kernel_param_ops {
@@ -56,11 +56,21 @@ struct kernel_param_ops {
56 void (*free)(void *arg); 56 void (*free)(void *arg);
57}; 57};
58 58
59/*
60 * Flags available for kernel_param
61 *
62 * UNSAFE - the parameter is dangerous and setting it will taint the kernel
63 */
64enum {
65 KERNEL_PARAM_FL_UNSAFE = (1 << 0)
66};
67
59struct kernel_param { 68struct kernel_param {
60 const char *name; 69 const char *name;
61 const struct kernel_param_ops *ops; 70 const struct kernel_param_ops *ops;
62 u16 perm; 71 u16 perm;
63 s16 level; 72 s8 level;
73 u8 flags;
64 union { 74 union {
65 void *arg; 75 void *arg;
66 const struct kparam_string *str; 76 const struct kparam_string *str;
@@ -68,6 +78,8 @@ struct kernel_param {
68 }; 78 };
69}; 79};
70 80
81extern const struct kernel_param __start___param[], __stop___param[];
82
71/* Special one for strings we want to copy into */ 83/* Special one for strings we want to copy into */
72struct kparam_string { 84struct kparam_string {
73 unsigned int maxlen; 85 unsigned int maxlen;
@@ -113,6 +125,12 @@ struct kparam_array
113 module_param_named(name, name, type, perm) 125 module_param_named(name, name, type, perm)
114 126
115/** 127/**
128 * module_param_unsafe - same as module_param but taints kernel
129 */
130#define module_param_unsafe(name, type, perm) \
131 module_param_named_unsafe(name, name, type, perm)
132
133/**
116 * module_param_named - typesafe helper for a renamed module/cmdline parameter 134 * module_param_named - typesafe helper for a renamed module/cmdline parameter
117 * @name: a valid C identifier which is the parameter name. 135 * @name: a valid C identifier which is the parameter name.
118 * @value: the actual lvalue to alter. 136 * @value: the actual lvalue to alter.
@@ -129,6 +147,14 @@ struct kparam_array
129 __MODULE_PARM_TYPE(name, #type) 147 __MODULE_PARM_TYPE(name, #type)
130 148
131/** 149/**
150 * module_param_named_unsafe - same as module_param_named but taints kernel
151 */
152#define module_param_named_unsafe(name, value, type, perm) \
153 param_check_##type(name, &(value)); \
154 module_param_cb_unsafe(name, &param_ops_##type, &value, perm); \
155 __MODULE_PARM_TYPE(name, #type)
156
157/**
132 * module_param_cb - general callback for a module/cmdline parameter 158 * module_param_cb - general callback for a module/cmdline parameter
133 * @name: a valid C identifier which is the parameter name. 159 * @name: a valid C identifier which is the parameter name.
134 * @ops: the set & get operations for this parameter. 160 * @ops: the set & get operations for this parameter.
@@ -137,7 +163,11 @@ struct kparam_array
137 * The ops can have NULL set or get functions. 163 * The ops can have NULL set or get functions.
138 */ 164 */
139#define module_param_cb(name, ops, arg, perm) \ 165#define module_param_cb(name, ops, arg, perm) \
140 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1) 166 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0)
167
168#define module_param_cb_unsafe(name, ops, arg, perm) \
169 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \
170 KERNEL_PARAM_FL_UNSAFE)
141 171
142/** 172/**
143 * <level>_param_cb - general callback for a module/cmdline parameter 173 * <level>_param_cb - general callback for a module/cmdline parameter
@@ -149,7 +179,7 @@ struct kparam_array
149 * The ops can have NULL set or get functions. 179 * The ops can have NULL set or get functions.
150 */ 180 */
151#define __level_param_cb(name, ops, arg, perm, level) \ 181#define __level_param_cb(name, ops, arg, perm, level) \
152 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level) 182 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level, 0)
153 183
154#define core_param_cb(name, ops, arg, perm) \ 184#define core_param_cb(name, ops, arg, perm) \
155 __level_param_cb(name, ops, arg, perm, 1) 185 __level_param_cb(name, ops, arg, perm, 1)
@@ -184,22 +214,22 @@ struct kparam_array
184 214
185/* This is the fundamental function for registering boot/module 215/* This is the fundamental function for registering boot/module
186 parameters. */ 216 parameters. */
187#define __module_param_call(prefix, name, ops, arg, perm, level) \ 217#define __module_param_call(prefix, name, ops, arg, perm, level, flags) \
188 /* Default value instead of permissions? */ \ 218 /* Default value instead of permissions? */ \
189 static const char __param_str_##name[] = prefix #name; \ 219 static const char __param_str_##name[] = prefix #name; \
190 static struct kernel_param __moduleparam_const __param_##name \ 220 static struct kernel_param __moduleparam_const __param_##name \
191 __used \ 221 __used \
192 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 222 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
193 = { __param_str_##name, ops, VERIFY_OCTAL_PERMISSIONS(perm), \ 223 = { __param_str_##name, ops, VERIFY_OCTAL_PERMISSIONS(perm), \
194 level, { arg } } 224 level, flags, { arg } }
195 225
196/* Obsolete - use module_param_cb() */ 226/* Obsolete - use module_param_cb() */
197#define module_param_call(name, set, get, arg, perm) \ 227#define module_param_call(name, set, get, arg, perm) \
198 static struct kernel_param_ops __param_ops_##name = \ 228 static struct kernel_param_ops __param_ops_##name = \
199 { 0, (void *)set, (void *)get }; \ 229 { .flags = 0, (void *)set, (void *)get }; \
200 __module_param_call(MODULE_PARAM_PREFIX, \ 230 __module_param_call(MODULE_PARAM_PREFIX, \
201 name, &__param_ops_##name, arg, \ 231 name, &__param_ops_##name, arg, \
202 (perm) + sizeof(__check_old_set_param(set))*0, -1) 232 (perm) + sizeof(__check_old_set_param(set))*0, -1, 0)
203 233
204/* We don't get oldget: it's often a new-style param_get_uint, etc. */ 234/* We don't get oldget: it's often a new-style param_get_uint, etc. */
205static inline int 235static inline int
@@ -279,7 +309,7 @@ static inline void __kernel_param_unlock(void)
279 */ 309 */
280#define core_param(name, var, type, perm) \ 310#define core_param(name, var, type, perm) \
281 param_check_##type(name, &(var)); \ 311 param_check_##type(name, &(var)); \
282 __module_param_call("", name, &param_ops_##type, &var, perm, -1) 312 __module_param_call("", name, &param_ops_##type, &var, perm, -1, 0)
283#endif /* !MODULE */ 313#endif /* !MODULE */
284 314
285/** 315/**
@@ -297,7 +327,7 @@ static inline void __kernel_param_unlock(void)
297 = { len, string }; \ 327 = { len, string }; \
298 __module_param_call(MODULE_PARAM_PREFIX, name, \ 328 __module_param_call(MODULE_PARAM_PREFIX, name, \
299 &param_ops_string, \ 329 &param_ops_string, \
300 .str = &__param_string_##name, perm, -1); \ 330 .str = &__param_string_##name, perm, -1, 0);\
301 __MODULE_PARM_TYPE(name, "string") 331 __MODULE_PARM_TYPE(name, "string")
302 332
303/** 333/**
@@ -444,7 +474,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp);
444 __module_param_call(MODULE_PARAM_PREFIX, name, \ 474 __module_param_call(MODULE_PARAM_PREFIX, name, \
445 &param_array_ops, \ 475 &param_array_ops, \
446 .arr = &__param_arr_##name, \ 476 .arr = &__param_arr_##name, \
447 perm, -1); \ 477 perm, -1, 0); \
448 __MODULE_PARM_TYPE(name, "array of " #type) 478 __MODULE_PARM_TYPE(name, "array of " #type)
449 479
450extern struct kernel_param_ops param_array_ops; 480extern struct kernel_param_ops param_array_ops;
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 839bac270904..c2c561dc0114 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -42,13 +42,20 @@ struct mnt_namespace;
42 * flag, consider how it interacts with shared mounts. 42 * flag, consider how it interacts with shared mounts.
43 */ 43 */
44#define MNT_SHARED_MASK (MNT_UNBINDABLE) 44#define MNT_SHARED_MASK (MNT_UNBINDABLE)
45#define MNT_PROPAGATION_MASK (MNT_SHARED | MNT_UNBINDABLE) 45#define MNT_USER_SETTABLE_MASK (MNT_NOSUID | MNT_NODEV | MNT_NOEXEC \
46 | MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME \
47 | MNT_READONLY)
48#define MNT_ATIME_MASK (MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME )
46 49
47#define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \ 50#define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \
48 MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED) 51 MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED)
49 52
50#define MNT_INTERNAL 0x4000 53#define MNT_INTERNAL 0x4000
51 54
55#define MNT_LOCK_ATIME 0x040000
56#define MNT_LOCK_NOEXEC 0x080000
57#define MNT_LOCK_NOSUID 0x100000
58#define MNT_LOCK_NODEV 0x200000
52#define MNT_LOCK_READONLY 0x400000 59#define MNT_LOCK_READONLY 0x400000
53#define MNT_LOCKED 0x800000 60#define MNT_LOCKED 0x800000
54#define MNT_DOOMED 0x1000000 61#define MNT_DOOMED 0x1000000
@@ -62,6 +69,7 @@ struct vfsmount {
62}; 69};
63 70
64struct file; /* forward dec */ 71struct file; /* forward dec */
72struct path;
65 73
66extern int mnt_want_write(struct vfsmount *mnt); 74extern int mnt_want_write(struct vfsmount *mnt);
67extern int mnt_want_write_file(struct file *file); 75extern int mnt_want_write_file(struct file *file);
@@ -70,10 +78,12 @@ extern void mnt_drop_write(struct vfsmount *mnt);
70extern void mnt_drop_write_file(struct file *file); 78extern void mnt_drop_write_file(struct file *file);
71extern void mntput(struct vfsmount *mnt); 79extern void mntput(struct vfsmount *mnt);
72extern struct vfsmount *mntget(struct vfsmount *mnt); 80extern struct vfsmount *mntget(struct vfsmount *mnt);
73extern void mnt_pin(struct vfsmount *mnt); 81extern struct vfsmount *mnt_clone_internal(struct path *path);
74extern void mnt_unpin(struct vfsmount *mnt);
75extern int __mnt_is_readonly(struct vfsmount *mnt); 82extern int __mnt_is_readonly(struct vfsmount *mnt);
76 83
84struct path;
85extern struct vfsmount *clone_private_mount(struct path *path);
86
77struct file_system_type; 87struct file_system_type;
78extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, 88extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
79 int flags, const char *name, 89 int flags, const char *name,
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 8103f32f6d87..44f4746d033b 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -29,7 +29,6 @@ struct msi_desc {
29 __u8 multi_cap : 3; /* log2 num of messages supported */ 29 __u8 multi_cap : 3; /* log2 num of messages supported */
30 __u8 maskbit : 1; /* mask-pending bit supported ? */ 30 __u8 maskbit : 1; /* mask-pending bit supported ? */
31 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 31 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
32 __u8 pos; /* Location of the msi capability */
33 __u16 entry_nr; /* specific enabled entry */ 32 __u16 entry_nr; /* specific enabled entry */
34 unsigned default_irq; /* default pre-assigned irq */ 33 unsigned default_irq; /* default pre-assigned irq */
35 } msi_attrib; 34 } msi_attrib;
@@ -47,8 +46,6 @@ struct msi_desc {
47 46
48 /* Last set MSI message */ 47 /* Last set MSI message */
49 struct msi_msg msg; 48 struct msi_msg msg;
50
51 struct kobject kobj;
52}; 49};
53 50
54/* 51/*
@@ -60,7 +57,6 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
60void arch_teardown_msi_irq(unsigned int irq); 57void arch_teardown_msi_irq(unsigned int irq);
61int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 58int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
62void arch_teardown_msi_irqs(struct pci_dev *dev); 59void arch_teardown_msi_irqs(struct pci_dev *dev);
63int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);
64void arch_restore_msi_irqs(struct pci_dev *dev); 60void arch_restore_msi_irqs(struct pci_dev *dev);
65 61
66void default_teardown_msi_irqs(struct pci_dev *dev); 62void default_teardown_msi_irqs(struct pci_dev *dev);
@@ -77,8 +73,6 @@ struct msi_chip {
77 int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev, 73 int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev,
78 struct msi_desc *desc); 74 struct msi_desc *desc);
79 void (*teardown_irq)(struct msi_chip *chip, unsigned int irq); 75 void (*teardown_irq)(struct msi_chip *chip, unsigned int irq);
80 int (*check_device)(struct msi_chip *chip, struct pci_dev *dev,
81 int nvec, int type);
82}; 76};
83 77
84#endif /* LINUX_MSI_H */ 78#endif /* LINUX_MSI_H */
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 37ef6b194089..299d7d31fe53 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -153,7 +153,7 @@ struct cfi_ident {
153 uint16_t MaxBufWriteSize; 153 uint16_t MaxBufWriteSize;
154 uint8_t NumEraseRegions; 154 uint8_t NumEraseRegions;
155 uint32_t EraseRegionInfo[0]; /* Not host ordered */ 155 uint32_t EraseRegionInfo[0]; /* Not host ordered */
156} __attribute__((packed)); 156} __packed;
157 157
158/* Extended Query Structure for both PRI and ALT */ 158/* Extended Query Structure for both PRI and ALT */
159 159
@@ -161,7 +161,7 @@ struct cfi_extquery {
161 uint8_t pri[3]; 161 uint8_t pri[3];
162 uint8_t MajorVersion; 162 uint8_t MajorVersion;
163 uint8_t MinorVersion; 163 uint8_t MinorVersion;
164} __attribute__((packed)); 164} __packed;
165 165
166/* Vendor-Specific PRI for Intel/Sharp Extended Command Set (0x0001) */ 166/* Vendor-Specific PRI for Intel/Sharp Extended Command Set (0x0001) */
167 167
@@ -180,7 +180,7 @@ struct cfi_pri_intelext {
180 uint8_t FactProtRegSize; 180 uint8_t FactProtRegSize;
181 uint8_t UserProtRegSize; 181 uint8_t UserProtRegSize;
182 uint8_t extra[0]; 182 uint8_t extra[0];
183} __attribute__((packed)); 183} __packed;
184 184
185struct cfi_intelext_otpinfo { 185struct cfi_intelext_otpinfo {
186 uint32_t ProtRegAddr; 186 uint32_t ProtRegAddr;
@@ -188,7 +188,7 @@ struct cfi_intelext_otpinfo {
188 uint8_t FactProtRegSize; 188 uint8_t FactProtRegSize;
189 uint16_t UserGroups; 189 uint16_t UserGroups;
190 uint8_t UserProtRegSize; 190 uint8_t UserProtRegSize;
191} __attribute__((packed)); 191} __packed;
192 192
193struct cfi_intelext_blockinfo { 193struct cfi_intelext_blockinfo {
194 uint16_t NumIdentBlocks; 194 uint16_t NumIdentBlocks;
@@ -196,7 +196,7 @@ struct cfi_intelext_blockinfo {
196 uint16_t MinBlockEraseCycles; 196 uint16_t MinBlockEraseCycles;
197 uint8_t BitsPerCell; 197 uint8_t BitsPerCell;
198 uint8_t BlockCap; 198 uint8_t BlockCap;
199} __attribute__((packed)); 199} __packed;
200 200
201struct cfi_intelext_regioninfo { 201struct cfi_intelext_regioninfo {
202 uint16_t NumIdentPartitions; 202 uint16_t NumIdentPartitions;
@@ -205,7 +205,7 @@ struct cfi_intelext_regioninfo {
205 uint8_t NumOpAllowedSimEraMode; 205 uint8_t NumOpAllowedSimEraMode;
206 uint8_t NumBlockTypes; 206 uint8_t NumBlockTypes;
207 struct cfi_intelext_blockinfo BlockTypes[1]; 207 struct cfi_intelext_blockinfo BlockTypes[1];
208} __attribute__((packed)); 208} __packed;
209 209
210struct cfi_intelext_programming_regioninfo { 210struct cfi_intelext_programming_regioninfo {
211 uint8_t ProgRegShift; 211 uint8_t ProgRegShift;
@@ -214,7 +214,7 @@ struct cfi_intelext_programming_regioninfo {
214 uint8_t Reserved2; 214 uint8_t Reserved2;
215 uint8_t ControlInvalid; 215 uint8_t ControlInvalid;
216 uint8_t Reserved3; 216 uint8_t Reserved3;
217} __attribute__((packed)); 217} __packed;
218 218
219/* Vendor-Specific PRI for AMD/Fujitsu Extended Command Set (0x0002) */ 219/* Vendor-Specific PRI for AMD/Fujitsu Extended Command Set (0x0002) */
220 220
@@ -233,7 +233,7 @@ struct cfi_pri_amdstd {
233 uint8_t VppMin; 233 uint8_t VppMin;
234 uint8_t VppMax; 234 uint8_t VppMax;
235 uint8_t TopBottom; 235 uint8_t TopBottom;
236} __attribute__((packed)); 236} __packed;
237 237
238/* Vendor-Specific PRI for Atmel chips (command set 0x0002) */ 238/* Vendor-Specific PRI for Atmel chips (command set 0x0002) */
239 239
@@ -245,18 +245,18 @@ struct cfi_pri_atmel {
245 uint8_t BottomBoot; 245 uint8_t BottomBoot;
246 uint8_t BurstMode; 246 uint8_t BurstMode;
247 uint8_t PageMode; 247 uint8_t PageMode;
248} __attribute__((packed)); 248} __packed;
249 249
250struct cfi_pri_query { 250struct cfi_pri_query {
251 uint8_t NumFields; 251 uint8_t NumFields;
252 uint32_t ProtField[1]; /* Not host ordered */ 252 uint32_t ProtField[1]; /* Not host ordered */
253} __attribute__((packed)); 253} __packed;
254 254
255struct cfi_bri_query { 255struct cfi_bri_query {
256 uint8_t PageModeReadCap; 256 uint8_t PageModeReadCap;
257 uint8_t NumFields; 257 uint8_t NumFields;
258 uint32_t ConfField[1]; /* Not host ordered */ 258 uint32_t ConfField[1]; /* Not host ordered */
259} __attribute__((packed)); 259} __packed;
260 260
261#define P_ID_NONE 0x0000 261#define P_ID_NONE 0x0000
262#define P_ID_INTEL_EXT 0x0001 262#define P_ID_INTEL_EXT 0x0001
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index a1b0b4c8fd79..031ff3a9a0bd 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -222,6 +222,7 @@ struct mtd_info {
222 int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 222 int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
223 int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 223 int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
224 int (*_is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 224 int (*_is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
225 int (*_block_isreserved) (struct mtd_info *mtd, loff_t ofs);
225 int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs); 226 int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs);
226 int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs); 227 int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs);
227 int (*_suspend) (struct mtd_info *mtd); 228 int (*_suspend) (struct mtd_info *mtd);
@@ -302,6 +303,7 @@ static inline void mtd_sync(struct mtd_info *mtd)
302int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); 303int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
303int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); 304int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
304int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len); 305int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len);
306int mtd_block_isreserved(struct mtd_info *mtd, loff_t ofs);
305int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs); 307int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs);
306int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs); 308int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs);
307 309
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 2f0af2891f0f..e4d451e4600b 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -587,6 +587,11 @@ struct nand_buffers {
587 * @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds, 587 * @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds,
588 * also from the datasheet. It is the recommended ECC step 588 * also from the datasheet. It is the recommended ECC step
589 * size, if known; if unknown, set to zero. 589 * size, if known; if unknown, set to zero.
590 * @onfi_timing_mode_default: [INTERN] default ONFI timing mode. This field is
591 * either deduced from the datasheet if the NAND
592 * chip is not ONFI compliant or set to 0 if it is
593 * (an ONFI chip is always configured in mode 0
594 * after a NAND reset)
590 * @numchips: [INTERN] number of physical chips 595 * @numchips: [INTERN] number of physical chips
591 * @chipsize: [INTERN] the size of one chip for multichip arrays 596 * @chipsize: [INTERN] the size of one chip for multichip arrays
592 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 597 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
@@ -671,6 +676,7 @@ struct nand_chip {
671 uint8_t bits_per_cell; 676 uint8_t bits_per_cell;
672 uint16_t ecc_strength_ds; 677 uint16_t ecc_strength_ds;
673 uint16_t ecc_step_ds; 678 uint16_t ecc_step_ds;
679 int onfi_timing_mode_default;
674 int badblockpos; 680 int badblockpos;
675 int badblockbits; 681 int badblockbits;
676 682
@@ -766,12 +772,17 @@ struct nand_chip {
766 * @options: stores various chip bit options 772 * @options: stores various chip bit options
767 * @id_len: The valid length of the @id. 773 * @id_len: The valid length of the @id.
768 * @oobsize: OOB size 774 * @oobsize: OOB size
775 * @ecc: ECC correctability and step information from the datasheet.
769 * @ecc.strength_ds: The ECC correctability from the datasheet, same as the 776 * @ecc.strength_ds: The ECC correctability from the datasheet, same as the
770 * @ecc_strength_ds in nand_chip{}. 777 * @ecc_strength_ds in nand_chip{}.
771 * @ecc.step_ds: The ECC step required by the @ecc.strength_ds, same as the 778 * @ecc.step_ds: The ECC step required by the @ecc.strength_ds, same as the
772 * @ecc_step_ds in nand_chip{}, also from the datasheet. 779 * @ecc_step_ds in nand_chip{}, also from the datasheet.
773 * For example, the "4bit ECC for each 512Byte" can be set with 780 * For example, the "4bit ECC for each 512Byte" can be set with
774 * NAND_ECC_INFO(4, 512). 781 * NAND_ECC_INFO(4, 512).
782 * @onfi_timing_mode_default: the default ONFI timing mode entered after a NAND
783 * reset. Should be deduced from timings described
784 * in the datasheet.
785 *
775 */ 786 */
776struct nand_flash_dev { 787struct nand_flash_dev {
777 char *name; 788 char *name;
@@ -792,6 +803,7 @@ struct nand_flash_dev {
792 uint16_t strength_ds; 803 uint16_t strength_ds;
793 uint16_t step_ds; 804 uint16_t step_ds;
794 } ecc; 805 } ecc;
806 int onfi_timing_mode_default;
795}; 807};
796 808
797/** 809/**
@@ -810,6 +822,7 @@ extern struct nand_manufacturers nand_manuf_ids[];
810extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); 822extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd);
811extern int nand_default_bbt(struct mtd_info *mtd); 823extern int nand_default_bbt(struct mtd_info *mtd);
812extern int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs); 824extern int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs);
825extern int nand_isreserved_bbt(struct mtd_info *mtd, loff_t offs);
813extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt); 826extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt);
814extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, 827extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
815 int allowbbt); 828 int allowbbt);
@@ -947,4 +960,56 @@ static inline int jedec_feature(struct nand_chip *chip)
947 return chip->jedec_version ? le16_to_cpu(chip->jedec_params.features) 960 return chip->jedec_version ? le16_to_cpu(chip->jedec_params.features)
948 : 0; 961 : 0;
949} 962}
963
964/*
965 * struct nand_sdr_timings - SDR NAND chip timings
966 *
967 * This struct defines the timing requirements of a SDR NAND chip.
968 * These informations can be found in every NAND datasheets and the timings
969 * meaning are described in the ONFI specifications:
970 * www.onfi.org/~/media/ONFI/specs/onfi_3_1_spec.pdf (chapter 4.15 Timing
971 * Parameters)
972 *
973 * All these timings are expressed in picoseconds.
974 */
975
976struct nand_sdr_timings {
977 u32 tALH_min;
978 u32 tADL_min;
979 u32 tALS_min;
980 u32 tAR_min;
981 u32 tCEA_max;
982 u32 tCEH_min;
983 u32 tCH_min;
984 u32 tCHZ_max;
985 u32 tCLH_min;
986 u32 tCLR_min;
987 u32 tCLS_min;
988 u32 tCOH_min;
989 u32 tCS_min;
990 u32 tDH_min;
991 u32 tDS_min;
992 u32 tFEAT_max;
993 u32 tIR_min;
994 u32 tITC_max;
995 u32 tRC_min;
996 u32 tREA_max;
997 u32 tREH_min;
998 u32 tRHOH_min;
999 u32 tRHW_min;
1000 u32 tRHZ_max;
1001 u32 tRLOH_min;
1002 u32 tRP_min;
1003 u32 tRR_min;
1004 u64 tRST_max;
1005 u32 tWB_max;
1006 u32 tWC_min;
1007 u32 tWH_min;
1008 u32 tWHR_min;
1009 u32 tWP_min;
1010 u32 tWW_min;
1011};
1012
1013/* get timing characteristics from ONFI timing mode. */
1014const struct nand_sdr_timings *onfi_async_timing_mode_to_sdr_timings(int mode);
950#endif /* __LINUX_MTD_NAND_H */ 1015#endif /* __LINUX_MTD_NAND_H */
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 53241842a7ab..046a0a2e4c4e 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -34,6 +34,7 @@
34#define SPINOR_OP_SE 0xd8 /* Sector erase (usually 64KiB) */ 34#define SPINOR_OP_SE 0xd8 /* Sector erase (usually 64KiB) */
35#define SPINOR_OP_RDID 0x9f /* Read JEDEC ID */ 35#define SPINOR_OP_RDID 0x9f /* Read JEDEC ID */
36#define SPINOR_OP_RDCR 0x35 /* Read configuration register */ 36#define SPINOR_OP_RDCR 0x35 /* Read configuration register */
37#define SPINOR_OP_RDFSR 0x70 /* Read flag status register */
37 38
38/* 4-byte address opcodes - used on Spansion and some Macronix flashes. */ 39/* 4-byte address opcodes - used on Spansion and some Macronix flashes. */
39#define SPINOR_OP_READ4 0x13 /* Read data bytes (low frequency) */ 40#define SPINOR_OP_READ4 0x13 /* Read data bytes (low frequency) */
@@ -66,6 +67,9 @@
66 67
67#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */ 68#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */
68 69
70/* Flag Status Register bits */
71#define FSR_READY 0x80
72
69/* Configuration Register bits. */ 73/* Configuration Register bits. */
70#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */ 74#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */
71 75
@@ -183,32 +187,17 @@ struct spi_nor {
183/** 187/**
184 * spi_nor_scan() - scan the SPI NOR 188 * spi_nor_scan() - scan the SPI NOR
185 * @nor: the spi_nor structure 189 * @nor: the spi_nor structure
186 * @id: the spi_device_id provided by the driver 190 * @name: the chip type name
187 * @mode: the read mode supported by the driver 191 * @mode: the read mode supported by the driver
188 * 192 *
189 * The drivers can use this fuction to scan the SPI NOR. 193 * The drivers can use this fuction to scan the SPI NOR.
190 * In the scanning, it will try to get all the necessary information to 194 * In the scanning, it will try to get all the necessary information to
191 * fill the mtd_info{} and the spi_nor{}. 195 * fill the mtd_info{} and the spi_nor{}.
192 * 196 *
193 * The board may assigns a spi_device_id with @id which be used to compared with 197 * The chip type name can be provided through the @name parameter.
194 * the spi_device_id detected by the scanning.
195 * 198 *
196 * Return: 0 for success, others for failure. 199 * Return: 0 for success, others for failure.
197 */ 200 */
198int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, 201int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode);
199 enum read_mode mode);
200extern const struct spi_device_id spi_nor_ids[];
201
202/**
203 * spi_nor_match_id() - find the spi_device_id by the name
204 * @name: the name of the spi_device_id
205 *
206 * The drivers use this function to find the spi_device_id
207 * specified by the @name.
208 *
209 * Return: returns the right spi_device_id pointer on success,
210 * and returns NULL on failure.
211 */
212const struct spi_device_id *spi_nor_match_id(char *name);
213 202
214#endif 203#endif
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 8d5535c58cc2..cc31498fc526 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -52,7 +52,7 @@ struct mutex {
52 atomic_t count; 52 atomic_t count;
53 spinlock_t wait_lock; 53 spinlock_t wait_lock;
54 struct list_head wait_list; 54 struct list_head wait_list;
55#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP) 55#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER)
56 struct task_struct *owner; 56 struct task_struct *owner;
57#endif 57#endif
58#ifdef CONFIG_MUTEX_SPIN_ON_OWNER 58#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
@@ -133,7 +133,7 @@ static inline int mutex_is_locked(struct mutex *lock)
133 133
134/* 134/*
135 * See kernel/locking/mutex.c for detailed documentation of these APIs. 135 * See kernel/locking/mutex.c for detailed documentation of these APIs.
136 * Also see Documentation/mutex-design.txt. 136 * Also see Documentation/locking/mutex-design.txt.
137 */ 137 */
138#ifdef CONFIG_DEBUG_LOCK_ALLOC 138#ifdef CONFIG_DEBUG_LOCK_ALLOC
139extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); 139extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
diff --git a/include/linux/mvebu-pmsu.h b/include/linux/mvebu-pmsu.h
new file mode 100644
index 000000000000..b918d07efe23
--- /dev/null
+++ b/include/linux/mvebu-pmsu.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2012 Marvell
3 *
4 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __MVEBU_PMSU_H__
12#define __MVEBU_PMSU_H__
13
14#ifdef CONFIG_MACH_MVEBU_V7
15int mvebu_pmsu_dfs_request(int cpu);
16#else
17static inline int mvebu_pmsu_dfs_request(int cpu) { return -ENODEV; }
18#endif
19
20#endif /* __MVEBU_PMSU_H__ */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 38377392d082..74fd5d37f15a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -30,6 +30,7 @@
30#include <linux/bug.h> 30#include <linux/bug.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/atomic.h> 32#include <linux/atomic.h>
33#include <linux/prefetch.h>
33#include <asm/cache.h> 34#include <asm/cache.h>
34#include <asm/byteorder.h> 35#include <asm/byteorder.h>
35 36
@@ -543,7 +544,7 @@ struct netdev_queue {
543 * read mostly part 544 * read mostly part
544 */ 545 */
545 struct net_device *dev; 546 struct net_device *dev;
546 struct Qdisc *qdisc; 547 struct Qdisc __rcu *qdisc;
547 struct Qdisc *qdisc_sleeping; 548 struct Qdisc *qdisc_sleeping;
548#ifdef CONFIG_SYSFS 549#ifdef CONFIG_SYSFS
549 struct kobject kobj; 550 struct kobject kobj;
@@ -997,6 +998,12 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
997 * Callback to use for xmit over the accelerated station. This 998 * Callback to use for xmit over the accelerated station. This
998 * is used in place of ndo_start_xmit on accelerated net 999 * is used in place of ndo_start_xmit on accelerated net
999 * devices. 1000 * devices.
1001 * bool (*ndo_gso_check) (struct sk_buff *skb,
1002 * struct net_device *dev);
1003 * Called by core transmit path to determine if device is capable of
1004 * performing GSO on a packet. The device returns true if it is
1005 * able to GSO the packet, false otherwise. If the return value is
1006 * false the stack will do software GSO.
1000 */ 1007 */
1001struct net_device_ops { 1008struct net_device_ops {
1002 int (*ndo_init)(struct net_device *dev); 1009 int (*ndo_init)(struct net_device *dev);
@@ -1146,6 +1153,8 @@ struct net_device_ops {
1146 struct net_device *dev, 1153 struct net_device *dev,
1147 void *priv); 1154 void *priv);
1148 int (*ndo_get_lock_subclass)(struct net_device *dev); 1155 int (*ndo_get_lock_subclass)(struct net_device *dev);
1156 bool (*ndo_gso_check) (struct sk_buff *skb,
1157 struct net_device *dev);
1149}; 1158};
1150 1159
1151/** 1160/**
@@ -1206,6 +1215,7 @@ enum netdev_priv_flags {
1206 IFF_SUPP_NOFCS = 1<<19, 1215 IFF_SUPP_NOFCS = 1<<19,
1207 IFF_LIVE_ADDR_CHANGE = 1<<20, 1216 IFF_LIVE_ADDR_CHANGE = 1<<20,
1208 IFF_MACVLAN = 1<<21, 1217 IFF_MACVLAN = 1<<21,
1218 IFF_XMIT_DST_RELEASE_PERM = 1<<22,
1209}; 1219};
1210 1220
1211#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN 1221#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -1230,6 +1240,7 @@ enum netdev_priv_flags {
1230#define IFF_SUPP_NOFCS IFF_SUPP_NOFCS 1240#define IFF_SUPP_NOFCS IFF_SUPP_NOFCS
1231#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE 1241#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE
1232#define IFF_MACVLAN IFF_MACVLAN 1242#define IFF_MACVLAN IFF_MACVLAN
1243#define IFF_XMIT_DST_RELEASE_PERM IFF_XMIT_DST_RELEASE_PERM
1233 1244
1234/** 1245/**
1235 * struct net_device - The DEVICE structure. 1246 * struct net_device - The DEVICE structure.
@@ -1416,6 +1427,8 @@ enum netdev_priv_flags {
1416 * @gso_max_size: Maximum size of generic segmentation offload 1427 * @gso_max_size: Maximum size of generic segmentation offload
1417 * @gso_max_segs: Maximum number of segments that can be passed to the 1428 * @gso_max_segs: Maximum number of segments that can be passed to the
1418 * NIC for GSO 1429 * NIC for GSO
1430 * @gso_min_segs: Minimum number of segments that can be passed to the
1431 * NIC for GSO
1419 * 1432 *
1420 * @dcbnl_ops: Data Center Bridging netlink ops 1433 * @dcbnl_ops: Data Center Bridging netlink ops
1421 * @num_tc: Number of traffic classes in the net device 1434 * @num_tc: Number of traffic classes in the net device
@@ -1666,7 +1679,7 @@ struct net_device {
1666 unsigned int gso_max_size; 1679 unsigned int gso_max_size;
1667#define GSO_MAX_SEGS 65535 1680#define GSO_MAX_SEGS 65535
1668 u16 gso_max_segs; 1681 u16 gso_max_segs;
1669 1682 u16 gso_min_segs;
1670#ifdef CONFIG_DCB 1683#ifdef CONFIG_DCB
1671 const struct dcbnl_rtnl_ops *dcbnl_ops; 1684 const struct dcbnl_rtnl_ops *dcbnl_ops;
1672#endif 1685#endif
@@ -1747,6 +1760,12 @@ struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
1747 return &dev->_tx[index]; 1760 return &dev->_tx[index];
1748} 1761}
1749 1762
1763static inline struct netdev_queue *skb_get_tx_queue(const struct net_device *dev,
1764 const struct sk_buff *skb)
1765{
1766 return netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
1767}
1768
1750static inline void netdev_for_each_tx_queue(struct net_device *dev, 1769static inline void netdev_for_each_tx_queue(struct net_device *dev,
1751 void (*f)(struct net_device *, 1770 void (*f)(struct net_device *,
1752 struct netdev_queue *, 1771 struct netdev_queue *,
@@ -1781,24 +1800,13 @@ void dev_net_set(struct net_device *dev, struct net *net)
1781#endif 1800#endif
1782} 1801}
1783 1802
1784static inline bool netdev_uses_dsa_tags(struct net_device *dev) 1803static inline bool netdev_uses_dsa(struct net_device *dev)
1785{ 1804{
1786#ifdef CONFIG_NET_DSA_TAG_DSA 1805#if IS_ENABLED(CONFIG_NET_DSA)
1787 if (dev->dsa_ptr != NULL)
1788 return dsa_uses_dsa_tags(dev->dsa_ptr);
1789#endif
1790
1791 return 0;
1792}
1793
1794static inline bool netdev_uses_trailer_tags(struct net_device *dev)
1795{
1796#ifdef CONFIG_NET_DSA_TAG_TRAILER
1797 if (dev->dsa_ptr != NULL) 1806 if (dev->dsa_ptr != NULL)
1798 return dsa_uses_trailer_tags(dev->dsa_ptr); 1807 return dsa_uses_tagged_protocol(dev->dsa_ptr);
1799#endif 1808#endif
1800 1809 return false;
1801 return 0;
1802} 1810}
1803 1811
1804/** 1812/**
@@ -1879,11 +1887,20 @@ struct napi_gro_cb {
1879 /* jiffies when first packet was created/queued */ 1887 /* jiffies when first packet was created/queued */
1880 unsigned long age; 1888 unsigned long age;
1881 1889
1882 /* Used in ipv6_gro_receive() */ 1890 /* Used in ipv6_gro_receive() and foo-over-udp */
1883 u16 proto; 1891 u16 proto;
1884 1892
1885 /* Used in udp_gro_receive */ 1893 /* Used in udp_gro_receive */
1886 u16 udp_mark; 1894 u8 udp_mark:1;
1895
1896 /* GRO checksum is valid */
1897 u8 csum_valid:1;
1898
1899 /* Number of checksums via CHECKSUM_UNNECESSARY */
1900 u8 csum_cnt:3;
1901
1902 /* Used in foo-over-udp, set in udp[46]_gro_receive */
1903 u8 is_ipv6:1;
1887 1904
1888 /* used to support CHECKSUM_COMPLETE for tunneling protocols */ 1905 /* used to support CHECKSUM_COMPLETE for tunneling protocols */
1889 __wsum csum; 1906 __wsum csum;
@@ -1910,7 +1927,6 @@ struct packet_type {
1910struct offload_callbacks { 1927struct offload_callbacks {
1911 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1928 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
1912 netdev_features_t features); 1929 netdev_features_t features);
1913 int (*gso_send_check)(struct sk_buff *skb);
1914 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1930 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1915 struct sk_buff *skb); 1931 struct sk_buff *skb);
1916 int (*gro_complete)(struct sk_buff *skb, int nhoff); 1932 int (*gro_complete)(struct sk_buff *skb, int nhoff);
@@ -1924,6 +1940,7 @@ struct packet_offload {
1924 1940
1925struct udp_offload { 1941struct udp_offload {
1926 __be16 port; 1942 __be16 port;
1943 u8 ipproto;
1927 struct offload_callbacks callbacks; 1944 struct offload_callbacks callbacks;
1928}; 1945};
1929 1946
@@ -1982,6 +1999,7 @@ struct pcpu_sw_netstats {
1982#define NETDEV_CHANGEUPPER 0x0015 1999#define NETDEV_CHANGEUPPER 0x0015
1983#define NETDEV_RESEND_IGMP 0x0016 2000#define NETDEV_RESEND_IGMP 0x0016
1984#define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */ 2001#define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */
2002#define NETDEV_CHANGEINFODATA 0x0018
1985 2003
1986int register_netdevice_notifier(struct notifier_block *nb); 2004int register_netdevice_notifier(struct notifier_block *nb);
1987int unregister_netdevice_notifier(struct notifier_block *nb); 2005int unregister_netdevice_notifier(struct notifier_block *nb);
@@ -2074,8 +2092,8 @@ void __dev_remove_pack(struct packet_type *pt);
2074void dev_add_offload(struct packet_offload *po); 2092void dev_add_offload(struct packet_offload *po);
2075void dev_remove_offload(struct packet_offload *po); 2093void dev_remove_offload(struct packet_offload *po);
2076 2094
2077struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, 2095struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags,
2078 unsigned short mask); 2096 unsigned short mask);
2079struct net_device *dev_get_by_name(struct net *net, const char *name); 2097struct net_device *dev_get_by_name(struct net *net, const char *name);
2080struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); 2098struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);
2081struct net_device *__dev_get_by_name(struct net *net, const char *name); 2099struct net_device *__dev_get_by_name(struct net *net, const char *name);
@@ -2153,11 +2171,97 @@ static inline void *skb_gro_network_header(struct sk_buff *skb)
2153static inline void skb_gro_postpull_rcsum(struct sk_buff *skb, 2171static inline void skb_gro_postpull_rcsum(struct sk_buff *skb,
2154 const void *start, unsigned int len) 2172 const void *start, unsigned int len)
2155{ 2173{
2156 if (skb->ip_summed == CHECKSUM_COMPLETE) 2174 if (NAPI_GRO_CB(skb)->csum_valid)
2157 NAPI_GRO_CB(skb)->csum = csum_sub(NAPI_GRO_CB(skb)->csum, 2175 NAPI_GRO_CB(skb)->csum = csum_sub(NAPI_GRO_CB(skb)->csum,
2158 csum_partial(start, len, 0)); 2176 csum_partial(start, len, 0));
2159} 2177}
2160 2178
2179/* GRO checksum functions. These are logical equivalents of the normal
2180 * checksum functions (in skbuff.h) except that they operate on the GRO
2181 * offsets and fields in sk_buff.
2182 */
2183
2184__sum16 __skb_gro_checksum_complete(struct sk_buff *skb);
2185
2186static inline bool __skb_gro_checksum_validate_needed(struct sk_buff *skb,
2187 bool zero_okay,
2188 __sum16 check)
2189{
2190 return (skb->ip_summed != CHECKSUM_PARTIAL &&
2191 NAPI_GRO_CB(skb)->csum_cnt == 0 &&
2192 (!zero_okay || check));
2193}
2194
2195static inline __sum16 __skb_gro_checksum_validate_complete(struct sk_buff *skb,
2196 __wsum psum)
2197{
2198 if (NAPI_GRO_CB(skb)->csum_valid &&
2199 !csum_fold(csum_add(psum, NAPI_GRO_CB(skb)->csum)))
2200 return 0;
2201
2202 NAPI_GRO_CB(skb)->csum = psum;
2203
2204 return __skb_gro_checksum_complete(skb);
2205}
2206
2207static inline void skb_gro_incr_csum_unnecessary(struct sk_buff *skb)
2208{
2209 if (NAPI_GRO_CB(skb)->csum_cnt > 0) {
2210 /* Consume a checksum from CHECKSUM_UNNECESSARY */
2211 NAPI_GRO_CB(skb)->csum_cnt--;
2212 } else {
2213 /* Update skb for CHECKSUM_UNNECESSARY and csum_level when we
2214 * verified a new top level checksum or an encapsulated one
2215 * during GRO. This saves work if we fallback to normal path.
2216 */
2217 __skb_incr_checksum_unnecessary(skb);
2218 }
2219}
2220
2221#define __skb_gro_checksum_validate(skb, proto, zero_okay, check, \
2222 compute_pseudo) \
2223({ \
2224 __sum16 __ret = 0; \
2225 if (__skb_gro_checksum_validate_needed(skb, zero_okay, check)) \
2226 __ret = __skb_gro_checksum_validate_complete(skb, \
2227 compute_pseudo(skb, proto)); \
2228 if (__ret) \
2229 __skb_mark_checksum_bad(skb); \
2230 else \
2231 skb_gro_incr_csum_unnecessary(skb); \
2232 __ret; \
2233})
2234
2235#define skb_gro_checksum_validate(skb, proto, compute_pseudo) \
2236 __skb_gro_checksum_validate(skb, proto, false, 0, compute_pseudo)
2237
2238#define skb_gro_checksum_validate_zero_check(skb, proto, check, \
2239 compute_pseudo) \
2240 __skb_gro_checksum_validate(skb, proto, true, check, compute_pseudo)
2241
2242#define skb_gro_checksum_simple_validate(skb) \
2243 __skb_gro_checksum_validate(skb, 0, false, 0, null_compute_pseudo)
2244
2245static inline bool __skb_gro_checksum_convert_check(struct sk_buff *skb)
2246{
2247 return (NAPI_GRO_CB(skb)->csum_cnt == 0 &&
2248 !NAPI_GRO_CB(skb)->csum_valid);
2249}
2250
2251static inline void __skb_gro_checksum_convert(struct sk_buff *skb,
2252 __sum16 check, __wsum pseudo)
2253{
2254 NAPI_GRO_CB(skb)->csum = ~pseudo;
2255 NAPI_GRO_CB(skb)->csum_valid = 1;
2256}
2257
2258#define skb_gro_checksum_try_convert(skb, proto, check, compute_pseudo) \
2259do { \
2260 if (__skb_gro_checksum_convert_check(skb)) \
2261 __skb_gro_checksum_convert(skb, check, \
2262 compute_pseudo(skb, proto)); \
2263} while (0)
2264
2161static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 2265static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
2162 unsigned short type, 2266 unsigned short type,
2163 const void *daddr, const void *saddr, 2267 const void *daddr, const void *saddr,
@@ -2261,12 +2365,7 @@ static inline void input_queue_tail_incr_save(struct softnet_data *sd,
2261DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); 2365DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
2262 2366
2263void __netif_schedule(struct Qdisc *q); 2367void __netif_schedule(struct Qdisc *q);
2264 2368void netif_schedule_queue(struct netdev_queue *txq);
2265static inline void netif_schedule_queue(struct netdev_queue *txq)
2266{
2267 if (!(txq->state & QUEUE_STATE_ANY_XOFF))
2268 __netif_schedule(txq->qdisc);
2269}
2270 2369
2271static inline void netif_tx_schedule_all(struct net_device *dev) 2370static inline void netif_tx_schedule_all(struct net_device *dev)
2272{ 2371{
@@ -2302,11 +2401,7 @@ static inline void netif_tx_start_all_queues(struct net_device *dev)
2302 } 2401 }
2303} 2402}
2304 2403
2305static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue) 2404void netif_tx_wake_queue(struct netdev_queue *dev_queue);
2306{
2307 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state))
2308 __netif_schedule(dev_queue->qdisc);
2309}
2310 2405
2311/** 2406/**
2312 * netif_wake_queue - restart transmit 2407 * netif_wake_queue - restart transmit
@@ -2394,6 +2489,34 @@ netif_xmit_frozen_or_drv_stopped(const struct netdev_queue *dev_queue)
2394 return dev_queue->state & QUEUE_STATE_DRV_XOFF_OR_FROZEN; 2489 return dev_queue->state & QUEUE_STATE_DRV_XOFF_OR_FROZEN;
2395} 2490}
2396 2491
2492/**
2493 * netdev_txq_bql_enqueue_prefetchw - prefetch bql data for write
2494 * @dev_queue: pointer to transmit queue
2495 *
2496 * BQL enabled drivers might use this helper in their ndo_start_xmit(),
2497 * to give appropriate hint to the cpu.
2498 */
2499static inline void netdev_txq_bql_enqueue_prefetchw(struct netdev_queue *dev_queue)
2500{
2501#ifdef CONFIG_BQL
2502 prefetchw(&dev_queue->dql.num_queued);
2503#endif
2504}
2505
2506/**
2507 * netdev_txq_bql_complete_prefetchw - prefetch bql data for write
2508 * @dev_queue: pointer to transmit queue
2509 *
2510 * BQL enabled drivers might use this helper in their TX completion path,
2511 * to give appropriate hint to the cpu.
2512 */
2513static inline void netdev_txq_bql_complete_prefetchw(struct netdev_queue *dev_queue)
2514{
2515#ifdef CONFIG_BQL
2516 prefetchw(&dev_queue->dql.limit);
2517#endif
2518}
2519
2397static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, 2520static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
2398 unsigned int bytes) 2521 unsigned int bytes)
2399{ 2522{
@@ -2578,19 +2701,7 @@ static inline bool netif_subqueue_stopped(const struct net_device *dev,
2578 return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); 2701 return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb));
2579} 2702}
2580 2703
2581/** 2704void netif_wake_subqueue(struct net_device *dev, u16 queue_index);
2582 * netif_wake_subqueue - allow sending packets on subqueue
2583 * @dev: network device
2584 * @queue_index: sub queue index
2585 *
2586 * Resume individual transmit queue of a device with multiple transmit queues.
2587 */
2588static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
2589{
2590 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
2591 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state))
2592 __netif_schedule(txq->qdisc);
2593}
2594 2705
2595#ifdef CONFIG_XPS 2706#ifdef CONFIG_XPS
2596int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask, 2707int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
@@ -2754,8 +2865,9 @@ int dev_set_mac_address(struct net_device *, struct sockaddr *);
2754int dev_change_carrier(struct net_device *, bool new_carrier); 2865int dev_change_carrier(struct net_device *, bool new_carrier);
2755int dev_get_phys_port_id(struct net_device *dev, 2866int dev_get_phys_port_id(struct net_device *dev,
2756 struct netdev_phys_port_id *ppid); 2867 struct netdev_phys_port_id *ppid);
2757int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2868struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
2758 struct netdev_queue *txq); 2869struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2870 struct netdev_queue *txq, int *ret);
2759int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2871int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2760int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2872int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2761bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb); 2873bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb);
@@ -3176,7 +3288,7 @@ static inline int __dev_uc_sync(struct net_device *dev,
3176} 3288}
3177 3289
3178/** 3290/**
3179 * __dev_uc_unsync - Remove synchonized addresses from device 3291 * __dev_uc_unsync - Remove synchronized addresses from device
3180 * @dev: device to sync 3292 * @dev: device to sync
3181 * @unsync: function to call if address should be removed 3293 * @unsync: function to call if address should be removed
3182 * 3294 *
@@ -3220,7 +3332,7 @@ static inline int __dev_mc_sync(struct net_device *dev,
3220} 3332}
3221 3333
3222/** 3334/**
3223 * __dev_mc_unsync - Remove synchonized addresses from device 3335 * __dev_mc_unsync - Remove synchronized addresses from device
3224 * @dev: device to sync 3336 * @dev: device to sync
3225 * @unsync: function to call if address should be removed 3337 * @unsync: function to call if address should be removed
3226 * 3338 *
@@ -3357,6 +3469,27 @@ int __init dev_proc_init(void);
3357#define dev_proc_init() 0 3469#define dev_proc_init() 0
3358#endif 3470#endif
3359 3471
3472static inline netdev_tx_t __netdev_start_xmit(const struct net_device_ops *ops,
3473 struct sk_buff *skb, struct net_device *dev,
3474 bool more)
3475{
3476 skb->xmit_more = more ? 1 : 0;
3477 return ops->ndo_start_xmit(skb, dev);
3478}
3479
3480static inline netdev_tx_t netdev_start_xmit(struct sk_buff *skb, struct net_device *dev,
3481 struct netdev_queue *txq, bool more)
3482{
3483 const struct net_device_ops *ops = dev->netdev_ops;
3484 int rc;
3485
3486 rc = __netdev_start_xmit(ops, skb, dev, more);
3487 if (rc == NETDEV_TX_OK)
3488 txq_trans_update(txq);
3489
3490 return rc;
3491}
3492
3360int netdev_class_create_file_ns(struct class_attribute *class_attr, 3493int netdev_class_create_file_ns(struct class_attribute *class_attr,
3361 const void *ns); 3494 const void *ns);
3362void netdev_class_remove_file_ns(struct class_attribute *class_attr, 3495void netdev_class_remove_file_ns(struct class_attribute *class_attr,
@@ -3447,10 +3580,12 @@ static inline bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features)
3447 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 3580 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
3448} 3581}
3449 3582
3450static inline bool netif_needs_gso(struct sk_buff *skb, 3583static inline bool netif_needs_gso(struct net_device *dev, struct sk_buff *skb,
3451 netdev_features_t features) 3584 netdev_features_t features)
3452{ 3585{
3453 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || 3586 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
3587 (dev->netdev_ops->ndo_gso_check &&
3588 !dev->netdev_ops->ndo_gso_check(skb, dev)) ||
3454 unlikely((skb->ip_summed != CHECKSUM_PARTIAL) && 3589 unlikely((skb->ip_summed != CHECKSUM_PARTIAL) &&
3455 (skb->ip_summed != CHECKSUM_UNNECESSARY))); 3590 (skb->ip_summed != CHECKSUM_UNNECESSARY)));
3456} 3591}
@@ -3494,6 +3629,12 @@ static inline bool netif_supports_nofcs(struct net_device *dev)
3494 return dev->priv_flags & IFF_SUPP_NOFCS; 3629 return dev->priv_flags & IFF_SUPP_NOFCS;
3495} 3630}
3496 3631
3632/* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */
3633static inline void netif_keep_dst(struct net_device *dev)
3634{
3635 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM);
3636}
3637
3497extern struct pernet_operations __net_initdata loopback_net_ops; 3638extern struct pernet_operations __net_initdata loopback_net_ops;
3498 3639
3499/* Logging, debugging and troubleshooting/diagnostic helpers. */ 3640/* Logging, debugging and troubleshooting/diagnostic helpers. */
@@ -3523,22 +3664,22 @@ static inline const char *netdev_reg_state(const struct net_device *dev)
3523} 3664}
3524 3665
3525__printf(3, 4) 3666__printf(3, 4)
3526int netdev_printk(const char *level, const struct net_device *dev, 3667void netdev_printk(const char *level, const struct net_device *dev,
3527 const char *format, ...); 3668 const char *format, ...);
3528__printf(2, 3) 3669__printf(2, 3)
3529int netdev_emerg(const struct net_device *dev, const char *format, ...); 3670void netdev_emerg(const struct net_device *dev, const char *format, ...);
3530__printf(2, 3) 3671__printf(2, 3)
3531int netdev_alert(const struct net_device *dev, const char *format, ...); 3672void netdev_alert(const struct net_device *dev, const char *format, ...);
3532__printf(2, 3) 3673__printf(2, 3)
3533int netdev_crit(const struct net_device *dev, const char *format, ...); 3674void netdev_crit(const struct net_device *dev, const char *format, ...);
3534__printf(2, 3) 3675__printf(2, 3)
3535int netdev_err(const struct net_device *dev, const char *format, ...); 3676void netdev_err(const struct net_device *dev, const char *format, ...);
3536__printf(2, 3) 3677__printf(2, 3)
3537int netdev_warn(const struct net_device *dev, const char *format, ...); 3678void netdev_warn(const struct net_device *dev, const char *format, ...);
3538__printf(2, 3) 3679__printf(2, 3)
3539int netdev_notice(const struct net_device *dev, const char *format, ...); 3680void netdev_notice(const struct net_device *dev, const char *format, ...);
3540__printf(2, 3) 3681__printf(2, 3)
3541int netdev_info(const struct net_device *dev, const char *format, ...); 3682void netdev_info(const struct net_device *dev, const char *format, ...);
3542 3683
3543#define MODULE_ALIAS_NETDEV(device) \ 3684#define MODULE_ALIAS_NETDEV(device) \
3544 MODULE_ALIAS("netdev-" device) 3685 MODULE_ALIAS("netdev-" device)
@@ -3556,7 +3697,6 @@ do { \
3556({ \ 3697({ \
3557 if (0) \ 3698 if (0) \
3558 netdev_printk(KERN_DEBUG, __dev, format, ##args); \ 3699 netdev_printk(KERN_DEBUG, __dev, format, ##args); \
3559 0; \
3560}) 3700})
3561#endif 3701#endif
3562 3702
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 2077489f9887..2517ece98820 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -9,6 +9,7 @@
9#include <linux/in6.h> 9#include <linux/in6.h>
10#include <linux/wait.h> 10#include <linux/wait.h>
11#include <linux/list.h> 11#include <linux/list.h>
12#include <linux/static_key.h>
12#include <uapi/linux/netfilter.h> 13#include <uapi/linux/netfilter.h>
13#ifdef CONFIG_NETFILTER 14#ifdef CONFIG_NETFILTER
14static inline int NF_DROP_GETERR(int verdict) 15static inline int NF_DROP_GETERR(int verdict)
@@ -99,9 +100,9 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg);
99 100
100extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 101extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
101 102
102#if defined(CONFIG_JUMP_LABEL) 103#ifdef HAVE_JUMP_LABEL
103#include <linux/static_key.h>
104extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 104extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
105
105static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook) 106static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
106{ 107{
107 if (__builtin_constant_p(pf) && 108 if (__builtin_constant_p(pf) &&
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 96afc29184be..f1606fa6132d 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -57,6 +57,8 @@ enum ip_set_extension {
57 IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER), 57 IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER),
58 IPSET_EXT_BIT_COMMENT = 2, 58 IPSET_EXT_BIT_COMMENT = 2,
59 IPSET_EXT_COMMENT = (1 << IPSET_EXT_BIT_COMMENT), 59 IPSET_EXT_COMMENT = (1 << IPSET_EXT_BIT_COMMENT),
60 IPSET_EXT_BIT_SKBINFO = 3,
61 IPSET_EXT_SKBINFO = (1 << IPSET_EXT_BIT_SKBINFO),
60 /* Mark set with an extension which needs to call destroy */ 62 /* Mark set with an extension which needs to call destroy */
61 IPSET_EXT_BIT_DESTROY = 7, 63 IPSET_EXT_BIT_DESTROY = 7,
62 IPSET_EXT_DESTROY = (1 << IPSET_EXT_BIT_DESTROY), 64 IPSET_EXT_DESTROY = (1 << IPSET_EXT_BIT_DESTROY),
@@ -65,12 +67,14 @@ enum ip_set_extension {
65#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT) 67#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT)
66#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER) 68#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER)
67#define SET_WITH_COMMENT(s) ((s)->extensions & IPSET_EXT_COMMENT) 69#define SET_WITH_COMMENT(s) ((s)->extensions & IPSET_EXT_COMMENT)
70#define SET_WITH_SKBINFO(s) ((s)->extensions & IPSET_EXT_SKBINFO)
68#define SET_WITH_FORCEADD(s) ((s)->flags & IPSET_CREATE_FLAG_FORCEADD) 71#define SET_WITH_FORCEADD(s) ((s)->flags & IPSET_CREATE_FLAG_FORCEADD)
69 72
70/* Extension id, in size order */ 73/* Extension id, in size order */
71enum ip_set_ext_id { 74enum ip_set_ext_id {
72 IPSET_EXT_ID_COUNTER = 0, 75 IPSET_EXT_ID_COUNTER = 0,
73 IPSET_EXT_ID_TIMEOUT, 76 IPSET_EXT_ID_TIMEOUT,
77 IPSET_EXT_ID_SKBINFO,
74 IPSET_EXT_ID_COMMENT, 78 IPSET_EXT_ID_COMMENT,
75 IPSET_EXT_ID_MAX, 79 IPSET_EXT_ID_MAX,
76}; 80};
@@ -92,6 +96,10 @@ struct ip_set_ext {
92 u64 packets; 96 u64 packets;
93 u64 bytes; 97 u64 bytes;
94 u32 timeout; 98 u32 timeout;
99 u32 skbmark;
100 u32 skbmarkmask;
101 u32 skbprio;
102 u16 skbqueue;
95 char *comment; 103 char *comment;
96}; 104};
97 105
@@ -104,6 +112,13 @@ struct ip_set_comment {
104 char *str; 112 char *str;
105}; 113};
106 114
115struct ip_set_skbinfo {
116 u32 skbmark;
117 u32 skbmarkmask;
118 u32 skbprio;
119 u16 skbqueue;
120};
121
107struct ip_set; 122struct ip_set;
108 123
109#define ext_timeout(e, s) \ 124#define ext_timeout(e, s) \
@@ -112,7 +127,8 @@ struct ip_set;
112(struct ip_set_counter *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COUNTER]) 127(struct ip_set_counter *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COUNTER])
113#define ext_comment(e, s) \ 128#define ext_comment(e, s) \
114(struct ip_set_comment *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COMMENT]) 129(struct ip_set_comment *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_COMMENT])
115 130#define ext_skbinfo(e, s) \
131(struct ip_set_skbinfo *)(((void *)(e)) + (s)->offset[IPSET_EXT_ID_SKBINFO])
116 132
117typedef int (*ipset_adtfn)(struct ip_set *set, void *value, 133typedef int (*ipset_adtfn)(struct ip_set *set, void *value,
118 const struct ip_set_ext *ext, 134 const struct ip_set_ext *ext,
@@ -256,6 +272,8 @@ ip_set_put_flags(struct sk_buff *skb, struct ip_set *set)
256 cadt_flags |= IPSET_FLAG_WITH_COUNTERS; 272 cadt_flags |= IPSET_FLAG_WITH_COUNTERS;
257 if (SET_WITH_COMMENT(set)) 273 if (SET_WITH_COMMENT(set))
258 cadt_flags |= IPSET_FLAG_WITH_COMMENT; 274 cadt_flags |= IPSET_FLAG_WITH_COMMENT;
275 if (SET_WITH_SKBINFO(set))
276 cadt_flags |= IPSET_FLAG_WITH_SKBINFO;
259 if (SET_WITH_FORCEADD(set)) 277 if (SET_WITH_FORCEADD(set))
260 cadt_flags |= IPSET_FLAG_WITH_FORCEADD; 278 cadt_flags |= IPSET_FLAG_WITH_FORCEADD;
261 279
@@ -304,6 +322,43 @@ ip_set_update_counter(struct ip_set_counter *counter,
304 } 322 }
305} 323}
306 324
325static inline void
326ip_set_get_skbinfo(struct ip_set_skbinfo *skbinfo,
327 const struct ip_set_ext *ext,
328 struct ip_set_ext *mext, u32 flags)
329{
330 mext->skbmark = skbinfo->skbmark;
331 mext->skbmarkmask = skbinfo->skbmarkmask;
332 mext->skbprio = skbinfo->skbprio;
333 mext->skbqueue = skbinfo->skbqueue;
334}
335static inline bool
336ip_set_put_skbinfo(struct sk_buff *skb, struct ip_set_skbinfo *skbinfo)
337{
338 /* Send nonzero parameters only */
339 return ((skbinfo->skbmark || skbinfo->skbmarkmask) &&
340 nla_put_net64(skb, IPSET_ATTR_SKBMARK,
341 cpu_to_be64((u64)skbinfo->skbmark << 32 |
342 skbinfo->skbmarkmask))) ||
343 (skbinfo->skbprio &&
344 nla_put_net32(skb, IPSET_ATTR_SKBPRIO,
345 cpu_to_be32(skbinfo->skbprio))) ||
346 (skbinfo->skbqueue &&
347 nla_put_net16(skb, IPSET_ATTR_SKBQUEUE,
348 cpu_to_be16(skbinfo->skbqueue)));
349
350}
351
352static inline void
353ip_set_init_skbinfo(struct ip_set_skbinfo *skbinfo,
354 const struct ip_set_ext *ext)
355{
356 skbinfo->skbmark = ext->skbmark;
357 skbinfo->skbmarkmask = ext->skbmarkmask;
358 skbinfo->skbprio = ext->skbprio;
359 skbinfo->skbqueue = ext->skbqueue;
360}
361
307static inline bool 362static inline bool
308ip_set_put_counter(struct sk_buff *skb, struct ip_set_counter *counter) 363ip_set_put_counter(struct sk_buff *skb, struct ip_set_counter *counter)
309{ 364{
@@ -497,6 +552,9 @@ ip_set_put_extensions(struct sk_buff *skb, const struct ip_set *set,
497 if (SET_WITH_COMMENT(set) && 552 if (SET_WITH_COMMENT(set) &&
498 ip_set_put_comment(skb, ext_comment(e, set))) 553 ip_set_put_comment(skb, ext_comment(e, set)))
499 return -EMSGSIZE; 554 return -EMSGSIZE;
555 if (SET_WITH_SKBINFO(set) &&
556 ip_set_put_skbinfo(skb, ext_skbinfo(e, set)))
557 return -EMSGSIZE;
500 return 0; 558 return 0;
501} 559}
502 560
diff --git a/include/linux/netfilter/ipset/ip_set_list.h b/include/linux/netfilter/ipset/ip_set_list.h
index 68c2aea897f5..fe2622a00151 100644
--- a/include/linux/netfilter/ipset/ip_set_list.h
+++ b/include/linux/netfilter/ipset/ip_set_list.h
@@ -6,5 +6,6 @@
6 6
7#define IP_SET_LIST_DEFAULT_SIZE 8 7#define IP_SET_LIST_DEFAULT_SIZE 8
8#define IP_SET_LIST_MIN_SIZE 4 8#define IP_SET_LIST_MIN_SIZE 4
9#define IP_SET_LIST_MAX_SIZE 65536
9 10
10#endif /* __IP_SET_LIST_H */ 11#endif /* __IP_SET_LIST_H */
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 8ab1c278b66d..c755e4971fa3 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -15,7 +15,7 @@ enum nf_br_hook_priorities {
15 NF_BR_PRI_LAST = INT_MAX, 15 NF_BR_PRI_LAST = INT_MAX,
16}; 16};
17 17
18#ifdef CONFIG_BRIDGE_NETFILTER 18#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
19 19
20#define BRNF_PKT_TYPE 0x01 20#define BRNF_PKT_TYPE 0x01
21#define BRNF_BRIDGED_DNAT 0x02 21#define BRNF_BRIDGED_DNAT 0x02
@@ -24,16 +24,6 @@ enum nf_br_hook_priorities {
24#define BRNF_8021Q 0x10 24#define BRNF_8021Q 0x10
25#define BRNF_PPPoE 0x20 25#define BRNF_PPPoE 0x20
26 26
27/* Only used in br_forward.c */
28int nf_bridge_copy_header(struct sk_buff *skb);
29static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
30{
31 if (skb->nf_bridge &&
32 skb->nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT))
33 return nf_bridge_copy_header(skb);
34 return 0;
35}
36
37static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb) 27static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
38{ 28{
39 switch (skb->protocol) { 29 switch (skb->protocol) {
@@ -46,6 +36,44 @@ static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
46 } 36 }
47} 37}
48 38
39static inline void nf_bridge_update_protocol(struct sk_buff *skb)
40{
41 if (skb->nf_bridge->mask & BRNF_8021Q)
42 skb->protocol = htons(ETH_P_8021Q);
43 else if (skb->nf_bridge->mask & BRNF_PPPoE)
44 skb->protocol = htons(ETH_P_PPP_SES);
45}
46
47/* Fill in the header for fragmented IP packets handled by
48 * the IPv4 connection tracking code.
49 *
50 * Only used in br_forward.c
51 */
52static inline int nf_bridge_copy_header(struct sk_buff *skb)
53{
54 int err;
55 unsigned int header_size;
56
57 nf_bridge_update_protocol(skb);
58 header_size = ETH_HLEN + nf_bridge_encap_header_len(skb);
59 err = skb_cow_head(skb, header_size);
60 if (err)
61 return err;
62
63 skb_copy_to_linear_data_offset(skb, -header_size,
64 skb->nf_bridge->data, header_size);
65 __skb_push(skb, nf_bridge_encap_header_len(skb));
66 return 0;
67}
68
69static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
70{
71 if (skb->nf_bridge &&
72 skb->nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT))
73 return nf_bridge_copy_header(skb);
74 return 0;
75}
76
49static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb) 77static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
50{ 78{
51 if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE)) 79 if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE))
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index a1e3064a8d99..356acc2846fd 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -110,6 +110,20 @@ enum nfs_opnum4 {
110 OP_DESTROY_CLIENTID = 57, 110 OP_DESTROY_CLIENTID = 57,
111 OP_RECLAIM_COMPLETE = 58, 111 OP_RECLAIM_COMPLETE = 58,
112 112
113 /* nfs42 */
114 OP_ALLOCATE = 59,
115 OP_COPY = 60,
116 OP_COPY_NOTIFY = 61,
117 OP_DEALLOCATE = 62,
118 OP_IO_ADVISE = 63,
119 OP_LAYOUTERROR = 64,
120 OP_LAYOUTSTATS = 65,
121 OP_OFFLOAD_CANCEL = 66,
122 OP_OFFLOAD_STATUS = 67,
123 OP_READ_PLUS = 68,
124 OP_SEEK = 69,
125 OP_WRITE_SAME = 70,
126
113 OP_ILLEGAL = 10044, 127 OP_ILLEGAL = 10044,
114}; 128};
115 129
@@ -117,10 +131,10 @@ enum nfs_opnum4 {
117Needs to be updated if more operations are defined in future.*/ 131Needs to be updated if more operations are defined in future.*/
118 132
119#define FIRST_NFS4_OP OP_ACCESS 133#define FIRST_NFS4_OP OP_ACCESS
120#define LAST_NFS4_OP OP_RECLAIM_COMPLETE 134#define LAST_NFS4_OP OP_WRITE_SAME
121#define LAST_NFS40_OP OP_RELEASE_LOCKOWNER 135#define LAST_NFS40_OP OP_RELEASE_LOCKOWNER
122#define LAST_NFS41_OP OP_RECLAIM_COMPLETE 136#define LAST_NFS41_OP OP_RECLAIM_COMPLETE
123#define LAST_NFS42_OP OP_RECLAIM_COMPLETE 137#define LAST_NFS42_OP OP_WRITE_SAME
124 138
125enum nfsstat4 { 139enum nfsstat4 {
126 NFS4_OK = 0, 140 NFS4_OK = 0,
@@ -235,10 +249,11 @@ enum nfsstat4 {
235 /* nfs42 */ 249 /* nfs42 */
236 NFS4ERR_PARTNER_NOTSUPP = 10088, 250 NFS4ERR_PARTNER_NOTSUPP = 10088,
237 NFS4ERR_PARTNER_NO_AUTH = 10089, 251 NFS4ERR_PARTNER_NO_AUTH = 10089,
238 NFS4ERR_METADATA_NOTSUPP = 10090, 252 NFS4ERR_UNION_NOTSUPP = 10090,
239 NFS4ERR_OFFLOAD_DENIED = 10091, 253 NFS4ERR_OFFLOAD_DENIED = 10091,
240 NFS4ERR_WRONG_LFS = 10092, 254 NFS4ERR_WRONG_LFS = 10092,
241 NFS4ERR_BADLABEL = 10093, 255 NFS4ERR_BADLABEL = 10093,
256 NFS4ERR_OFFLOAD_NO_REQS = 10094,
242}; 257};
243 258
244static inline bool seqid_mutating_err(u32 err) 259static inline bool seqid_mutating_err(u32 err)
@@ -472,6 +487,9 @@ enum {
472 NFSPROC4_CLNT_GETDEVICELIST, 487 NFSPROC4_CLNT_GETDEVICELIST,
473 NFSPROC4_CLNT_BIND_CONN_TO_SESSION, 488 NFSPROC4_CLNT_BIND_CONN_TO_SESSION,
474 NFSPROC4_CLNT_DESTROY_CLIENTID, 489 NFSPROC4_CLNT_DESTROY_CLIENTID,
490
491 /* nfs42 */
492 NFSPROC4_CLNT_SEEK,
475}; 493};
476 494
477/* nfs41 types */ 495/* nfs41 types */
@@ -535,4 +553,9 @@ struct nfs4_deviceid {
535 char data[NFS4_DEVICEID4_SIZE]; 553 char data[NFS4_DEVICEID4_SIZE];
536}; 554};
537 555
556enum data_content4 {
557 NFS4_CONTENT_DATA = 0,
558 NFS4_CONTENT_HOLE = 1,
559};
560
538#endif 561#endif
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index e30f6059ecd6..c72d1ad41ad4 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -52,6 +52,7 @@ struct nfs_access_entry {
52 unsigned long jiffies; 52 unsigned long jiffies;
53 struct rpc_cred * cred; 53 struct rpc_cred * cred;
54 int mask; 54 int mask;
55 struct rcu_head rcu_head;
55}; 56};
56 57
57struct nfs_lockowner { 58struct nfs_lockowner {
@@ -352,6 +353,7 @@ extern int nfs_release(struct inode *, struct file *);
352extern int nfs_attribute_timeout(struct inode *inode); 353extern int nfs_attribute_timeout(struct inode *inode);
353extern int nfs_attribute_cache_expired(struct inode *inode); 354extern int nfs_attribute_cache_expired(struct inode *inode);
354extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 355extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
356extern int nfs_revalidate_inode_rcu(struct nfs_server *server, struct inode *inode);
355extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 357extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
356extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 358extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
357extern int nfs_setattr(struct dentry *, struct iattr *); 359extern int nfs_setattr(struct dentry *, struct iattr *);
@@ -441,31 +443,15 @@ static inline struct rpc_cred *nfs_file_cred(struct file *file)
441} 443}
442 444
443/* 445/*
444 * linux/fs/nfs/xattr.c
445 */
446#ifdef CONFIG_NFS_V3_ACL
447extern ssize_t nfs3_listxattr(struct dentry *, char *, size_t);
448extern ssize_t nfs3_getxattr(struct dentry *, const char *, void *, size_t);
449extern int nfs3_setxattr(struct dentry *, const char *,
450 const void *, size_t, int);
451extern int nfs3_removexattr (struct dentry *, const char *name);
452#else
453# define nfs3_listxattr NULL
454# define nfs3_getxattr NULL
455# define nfs3_setxattr NULL
456# define nfs3_removexattr NULL
457#endif
458
459/*
460 * linux/fs/nfs/direct.c 446 * linux/fs/nfs/direct.c
461 */ 447 */
462extern ssize_t nfs_direct_IO(int, struct kiocb *, struct iov_iter *, loff_t); 448extern ssize_t nfs_direct_IO(int, struct kiocb *, struct iov_iter *, loff_t);
463extern ssize_t nfs_file_direct_read(struct kiocb *iocb, 449extern ssize_t nfs_file_direct_read(struct kiocb *iocb,
464 struct iov_iter *iter, 450 struct iov_iter *iter,
465 loff_t pos, bool uio); 451 loff_t pos);
466extern ssize_t nfs_file_direct_write(struct kiocb *iocb, 452extern ssize_t nfs_file_direct_write(struct kiocb *iocb,
467 struct iov_iter *iter, 453 struct iov_iter *iter,
468 loff_t pos, bool uio); 454 loff_t pos);
469 455
470/* 456/*
471 * linux/fs/nfs/dir.c 457 * linux/fs/nfs/dir.c
@@ -527,17 +513,9 @@ extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned
527extern int nfs_wb_all(struct inode *inode); 513extern int nfs_wb_all(struct inode *inode);
528extern int nfs_wb_page(struct inode *inode, struct page* page); 514extern int nfs_wb_page(struct inode *inode, struct page* page);
529extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 515extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
530#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
531extern int nfs_commit_inode(struct inode *, int); 516extern int nfs_commit_inode(struct inode *, int);
532extern struct nfs_commit_data *nfs_commitdata_alloc(void); 517extern struct nfs_commit_data *nfs_commitdata_alloc(void);
533extern void nfs_commit_free(struct nfs_commit_data *data); 518extern void nfs_commit_free(struct nfs_commit_data *data);
534#else
535static inline int
536nfs_commit_inode(struct inode *inode, int how)
537{
538 return 0;
539}
540#endif
541 519
542static inline int 520static inline int
543nfs_have_writebacks(struct inode *inode) 521nfs_have_writebacks(struct inode *inode)
@@ -555,23 +533,6 @@ extern int nfs_readpage_async(struct nfs_open_context *, struct inode *,
555 struct page *); 533 struct page *);
556 534
557/* 535/*
558 * linux/fs/nfs3proc.c
559 */
560#ifdef CONFIG_NFS_V3_ACL
561extern struct posix_acl *nfs3_get_acl(struct inode *inode, int type);
562extern int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type);
563extern int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
564 struct posix_acl *dfacl);
565extern const struct xattr_handler *nfs3_xattr_handlers[];
566#else
567static inline int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
568 struct posix_acl *dfacl)
569{
570 return 0;
571}
572#endif /* CONFIG_NFS_V3_ACL */
573
574/*
575 * inline functions 536 * inline functions
576 */ 537 */
577 538
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 1150ea41b626..a32ba0d7a98f 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -45,6 +45,7 @@ struct nfs_client {
45 struct sockaddr_storage cl_addr; /* server identifier */ 45 struct sockaddr_storage cl_addr; /* server identifier */
46 size_t cl_addrlen; 46 size_t cl_addrlen;
47 char * cl_hostname; /* hostname of server */ 47 char * cl_hostname; /* hostname of server */
48 char * cl_acceptor; /* GSSAPI acceptor name */
48 struct list_head cl_share_link; /* link in global client list */ 49 struct list_head cl_share_link; /* link in global client list */
49 struct list_head cl_superblocks; /* List of nfs_server structs */ 50 struct list_head cl_superblocks; /* List of nfs_server structs */
50 51
@@ -229,5 +230,6 @@ struct nfs_server {
229#define NFS_CAP_STATEID_NFSV41 (1U << 16) 230#define NFS_CAP_STATEID_NFSV41 (1U << 16)
230#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17) 231#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17)
231#define NFS_CAP_SECURITY_LABEL (1U << 18) 232#define NFS_CAP_SECURITY_LABEL (1U << 18)
233#define NFS_CAP_SEEK (1U << 19)
232 234
233#endif 235#endif
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 7d9096d95d4a..6c3e06ee2fb7 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -26,7 +26,7 @@ enum {
26 PG_MAPPED, /* page private set for buffered io */ 26 PG_MAPPED, /* page private set for buffered io */
27 PG_CLEAN, /* write succeeded */ 27 PG_CLEAN, /* write succeeded */
28 PG_COMMIT_TO_DS, /* used by pnfs layouts */ 28 PG_COMMIT_TO_DS, /* used by pnfs layouts */
29 PG_INODE_REF, /* extra ref held by inode (head req only) */ 29 PG_INODE_REF, /* extra ref held by inode when in writeback */
30 PG_HEADLOCK, /* page group lock of wb_head */ 30 PG_HEADLOCK, /* page group lock of wb_head */
31 PG_TEARDOWN, /* page group sync for destroy */ 31 PG_TEARDOWN, /* page group sync for destroy */
32 PG_UNLOCKPAGE, /* page group sync bit in read path */ 32 PG_UNLOCKPAGE, /* page group sync bit in read path */
@@ -62,12 +62,13 @@ struct nfs_pageio_ops {
62 62
63struct nfs_rw_ops { 63struct nfs_rw_ops {
64 const fmode_t rw_mode; 64 const fmode_t rw_mode;
65 struct nfs_rw_header *(*rw_alloc_header)(void); 65 struct nfs_pgio_header *(*rw_alloc_header)(void);
66 void (*rw_free_header)(struct nfs_rw_header *); 66 void (*rw_free_header)(struct nfs_pgio_header *);
67 void (*rw_release)(struct nfs_pgio_data *); 67 void (*rw_release)(struct nfs_pgio_header *);
68 int (*rw_done)(struct rpc_task *, struct nfs_pgio_data *, struct inode *); 68 int (*rw_done)(struct rpc_task *, struct nfs_pgio_header *,
69 void (*rw_result)(struct rpc_task *, struct nfs_pgio_data *); 69 struct inode *);
70 void (*rw_initiate)(struct nfs_pgio_data *, struct rpc_message *, 70 void (*rw_result)(struct rpc_task *, struct nfs_pgio_header *);
71 void (*rw_initiate)(struct nfs_pgio_header *, struct rpc_message *,
71 struct rpc_task_setup *, int); 72 struct rpc_task_setup *, int);
72}; 73};
73 74
@@ -111,6 +112,8 @@ extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
111 int how); 112 int how);
112extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *, 113extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *,
113 struct nfs_page *); 114 struct nfs_page *);
115extern int nfs_pageio_resend(struct nfs_pageio_descriptor *,
116 struct nfs_pgio_header *);
114extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc); 117extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc);
115extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t); 118extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t);
116extern size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, 119extern size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc,
@@ -119,7 +122,8 @@ extern size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc,
119extern int nfs_wait_on_request(struct nfs_page *); 122extern int nfs_wait_on_request(struct nfs_page *);
120extern void nfs_unlock_request(struct nfs_page *req); 123extern void nfs_unlock_request(struct nfs_page *req);
121extern void nfs_unlock_and_release_request(struct nfs_page *); 124extern void nfs_unlock_and_release_request(struct nfs_page *);
122extern void nfs_page_group_lock(struct nfs_page *); 125extern int nfs_page_group_lock(struct nfs_page *, bool);
126extern void nfs_page_group_lock_wait(struct nfs_page *);
123extern void nfs_page_group_unlock(struct nfs_page *); 127extern void nfs_page_group_unlock(struct nfs_page *);
124extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int); 128extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int);
125 129
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 9a1396e70310..47ebb4fafd87 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -252,17 +252,6 @@ struct nfs4_layoutget {
252 gfp_t gfp_flags; 252 gfp_t gfp_flags;
253}; 253};
254 254
255struct nfs4_getdevicelist_args {
256 struct nfs4_sequence_args seq_args;
257 const struct nfs_fh *fh;
258 u32 layoutclass;
259};
260
261struct nfs4_getdevicelist_res {
262 struct nfs4_sequence_res seq_res;
263 struct pnfs_devicelist *devlist;
264};
265
266struct nfs4_getdeviceinfo_args { 255struct nfs4_getdeviceinfo_args {
267 struct nfs4_sequence_args seq_args; 256 struct nfs4_sequence_args seq_args;
268 struct pnfs_device *pdev; 257 struct pnfs_device *pdev;
@@ -279,6 +268,9 @@ struct nfs4_layoutcommit_args {
279 __u64 lastbytewritten; 268 __u64 lastbytewritten;
280 struct inode *inode; 269 struct inode *inode;
281 const u32 *bitmask; 270 const u32 *bitmask;
271 size_t layoutupdate_len;
272 struct page *layoutupdate_page;
273 struct page **layoutupdate_pages;
282}; 274};
283 275
284struct nfs4_layoutcommit_res { 276struct nfs4_layoutcommit_res {
@@ -993,6 +985,7 @@ struct nfs4_setclientid {
993 unsigned int sc_uaddr_len; 985 unsigned int sc_uaddr_len;
994 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1]; 986 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
995 u32 sc_cb_ident; 987 u32 sc_cb_ident;
988 struct rpc_cred *sc_cred;
996}; 989};
997 990
998struct nfs4_setclientid_res { 991struct nfs4_setclientid_res {
@@ -1231,13 +1224,43 @@ struct nfs41_free_stateid_res {
1231 unsigned int status; 1224 unsigned int status;
1232}; 1225};
1233 1226
1227static inline void
1228nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1229{
1230 kfree(cinfo->buckets);
1231}
1232
1234#else 1233#else
1235 1234
1236struct pnfs_ds_commit_info { 1235struct pnfs_ds_commit_info {
1237}; 1236};
1238 1237
1238static inline void
1239nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1240{
1241}
1242
1239#endif /* CONFIG_NFS_V4_1 */ 1243#endif /* CONFIG_NFS_V4_1 */
1240 1244
1245#ifdef CONFIG_NFS_V4_2
1246struct nfs42_seek_args {
1247 struct nfs4_sequence_args seq_args;
1248
1249 struct nfs_fh *sa_fh;
1250 nfs4_stateid sa_stateid;
1251 u64 sa_offset;
1252 u32 sa_what;
1253};
1254
1255struct nfs42_seek_res {
1256 struct nfs4_sequence_res seq_res;
1257 unsigned int status;
1258
1259 u32 sr_eof;
1260 u64 sr_offset;
1261};
1262#endif
1263
1241struct nfs_page; 1264struct nfs_page;
1242 1265
1243#define NFS_PAGEVEC_SIZE (8U) 1266#define NFS_PAGEVEC_SIZE (8U)
@@ -1253,18 +1276,12 @@ enum {
1253 NFS_IOHDR_ERROR = 0, 1276 NFS_IOHDR_ERROR = 0,
1254 NFS_IOHDR_EOF, 1277 NFS_IOHDR_EOF,
1255 NFS_IOHDR_REDO, 1278 NFS_IOHDR_REDO,
1256 NFS_IOHDR_NEED_COMMIT,
1257 NFS_IOHDR_NEED_RESCHED,
1258}; 1279};
1259 1280
1260struct nfs_pgio_data;
1261
1262struct nfs_pgio_header { 1281struct nfs_pgio_header {
1263 struct inode *inode; 1282 struct inode *inode;
1264 struct rpc_cred *cred; 1283 struct rpc_cred *cred;
1265 struct list_head pages; 1284 struct list_head pages;
1266 struct nfs_pgio_data *data;
1267 atomic_t refcnt;
1268 struct nfs_page *req; 1285 struct nfs_page *req;
1269 struct nfs_writeverf verf; /* Used for writes */ 1286 struct nfs_writeverf verf; /* Used for writes */
1270 struct pnfs_layout_segment *lseg; 1287 struct pnfs_layout_segment *lseg;
@@ -1281,28 +1298,22 @@ struct nfs_pgio_header {
1281 int error; /* merge with pnfs_error */ 1298 int error; /* merge with pnfs_error */
1282 unsigned long good_bytes; /* boundary of good data */ 1299 unsigned long good_bytes; /* boundary of good data */
1283 unsigned long flags; 1300 unsigned long flags;
1284};
1285 1301
1286struct nfs_pgio_data { 1302 /*
1287 struct nfs_pgio_header *header; 1303 * rpc data
1304 */
1288 struct rpc_task task; 1305 struct rpc_task task;
1289 struct nfs_fattr fattr; 1306 struct nfs_fattr fattr;
1290 struct nfs_writeverf verf; /* Used for writes */
1291 struct nfs_pgio_args args; /* argument struct */ 1307 struct nfs_pgio_args args; /* argument struct */
1292 struct nfs_pgio_res res; /* result struct */ 1308 struct nfs_pgio_res res; /* result struct */
1293 unsigned long timestamp; /* For lease renewal */ 1309 unsigned long timestamp; /* For lease renewal */
1294 int (*pgio_done_cb) (struct rpc_task *task, struct nfs_pgio_data *data); 1310 int (*pgio_done_cb)(struct rpc_task *, struct nfs_pgio_header *);
1295 __u64 mds_offset; /* Filelayout dense stripe */ 1311 __u64 mds_offset; /* Filelayout dense stripe */
1296 struct nfs_page_array pages; 1312 struct nfs_page_array page_array;
1297 struct nfs_client *ds_clp; /* pNFS data server */ 1313 struct nfs_client *ds_clp; /* pNFS data server */
1298 int ds_idx; /* ds index if ds_clp is set */ 1314 int ds_idx; /* ds index if ds_clp is set */
1299}; 1315};
1300 1316
1301struct nfs_rw_header {
1302 struct nfs_pgio_header header;
1303 struct nfs_pgio_data rpc_data;
1304};
1305
1306struct nfs_mds_commit_info { 1317struct nfs_mds_commit_info {
1307 atomic_t rpcs_out; 1318 atomic_t rpcs_out;
1308 unsigned long ncommit; 1319 unsigned long ncommit;
@@ -1339,6 +1350,7 @@ struct nfs_commit_data {
1339 struct pnfs_layout_segment *lseg; 1350 struct pnfs_layout_segment *lseg;
1340 struct nfs_client *ds_clp; /* pNFS data server */ 1351 struct nfs_client *ds_clp; /* pNFS data server */
1341 int ds_commit_index; 1352 int ds_commit_index;
1353 loff_t lwb;
1342 const struct rpc_call_ops *mds_ops; 1354 const struct rpc_call_ops *mds_ops;
1343 const struct nfs_commit_completion_ops *completion_ops; 1355 const struct nfs_commit_completion_ops *completion_ops;
1344 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data); 1356 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
@@ -1357,6 +1369,7 @@ struct nfs_unlinkdata {
1357 struct inode *dir; 1369 struct inode *dir;
1358 struct rpc_cred *cred; 1370 struct rpc_cred *cred;
1359 struct nfs_fattr dir_attr; 1371 struct nfs_fattr dir_attr;
1372 long timeout;
1360}; 1373};
1361 1374
1362struct nfs_renamedata { 1375struct nfs_renamedata {
@@ -1370,6 +1383,7 @@ struct nfs_renamedata {
1370 struct dentry *new_dentry; 1383 struct dentry *new_dentry;
1371 struct nfs_fattr new_fattr; 1384 struct nfs_fattr new_fattr;
1372 void (*complete)(struct rpc_task *, struct nfs_renamedata *); 1385 void (*complete)(struct rpc_task *, struct nfs_renamedata *);
1386 long timeout;
1373}; 1387};
1374 1388
1375struct nfs_access_entry; 1389struct nfs_access_entry;
@@ -1432,11 +1446,12 @@ struct nfs_rpc_ops {
1432 struct nfs_pathconf *); 1446 struct nfs_pathconf *);
1433 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 1447 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1434 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int); 1448 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
1435 int (*pgio_rpc_prepare)(struct rpc_task *, struct nfs_pgio_data *); 1449 int (*pgio_rpc_prepare)(struct rpc_task *,
1436 void (*read_setup) (struct nfs_pgio_data *, struct rpc_message *); 1450 struct nfs_pgio_header *);
1437 int (*read_done) (struct rpc_task *, struct nfs_pgio_data *); 1451 void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *);
1438 void (*write_setup) (struct nfs_pgio_data *, struct rpc_message *); 1452 int (*read_done)(struct rpc_task *, struct nfs_pgio_header *);
1439 int (*write_done) (struct rpc_task *, struct nfs_pgio_data *); 1453 void (*write_setup)(struct nfs_pgio_header *, struct rpc_message *);
1454 int (*write_done)(struct rpc_task *, struct nfs_pgio_header *);
1440 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *); 1455 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
1441 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *); 1456 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
1442 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *); 1457 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 1d2a6ab6b8bb..9b2022ab4d85 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -24,6 +24,19 @@ static inline void touch_nmi_watchdog(void)
24} 24}
25#endif 25#endif
26 26
27#if defined(CONFIG_HARDLOCKUP_DETECTOR)
28extern void watchdog_enable_hardlockup_detector(bool val);
29extern bool watchdog_hardlockup_detector_is_enabled(void);
30#else
31static inline void watchdog_enable_hardlockup_detector(bool val)
32{
33}
34static inline bool watchdog_hardlockup_detector_is_enabled(void)
35{
36 return true;
37}
38#endif
39
27/* 40/*
28 * Create trigger_all_cpu_backtrace() out of the arch-provided 41 * Create trigger_all_cpu_backtrace() out of the arch-provided
29 * base function. Return whether such support was available, 42 * base function. Return whether such support was available,
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 58b9a02c38d2..83a6aeda899d 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -430,7 +430,15 @@ static inline int num_node_state(enum node_states state)
430 for_each_node_mask((__node), node_states[__state]) 430 for_each_node_mask((__node), node_states[__state])
431 431
432#define first_online_node first_node(node_states[N_ONLINE]) 432#define first_online_node first_node(node_states[N_ONLINE])
433#define next_online_node(nid) next_node((nid), node_states[N_ONLINE]) 433#define first_memory_node first_node(node_states[N_MEMORY])
434static inline int next_online_node(int nid)
435{
436 return next_node(nid, node_states[N_ONLINE]);
437}
438static inline int next_memory_node(int nid)
439{
440 return next_node(nid, node_states[N_MEMORY]);
441}
434 442
435extern int nr_node_ids; 443extern int nr_node_ids;
436extern int nr_online_nodes; 444extern int nr_online_nodes;
@@ -471,6 +479,7 @@ static inline int num_node_state(enum node_states state)
471 for ( (node) = 0; (node) == 0; (node) = 1) 479 for ( (node) = 0; (node) == 0; (node) = 1)
472 480
473#define first_online_node 0 481#define first_online_node 0
482#define first_memory_node 0
474#define next_online_node(nid) (MAX_NUMNODES) 483#define next_online_node(nid) (MAX_NUMNODES)
475#define nr_node_ids 1 484#define nr_node_ids 1
476#define nr_online_nodes 1 485#define nr_online_nodes 1
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index b4ec59d159ac..35fa08fd7739 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -40,32 +40,28 @@ extern struct nsproxy init_nsproxy;
40 * the namespaces access rules are: 40 * the namespaces access rules are:
41 * 41 *
42 * 1. only current task is allowed to change tsk->nsproxy pointer or 42 * 1. only current task is allowed to change tsk->nsproxy pointer or
43 * any pointer on the nsproxy itself 43 * any pointer on the nsproxy itself. Current must hold the task_lock
44 * when changing tsk->nsproxy.
44 * 45 *
45 * 2. when accessing (i.e. reading) current task's namespaces - no 46 * 2. when accessing (i.e. reading) current task's namespaces - no
46 * precautions should be taken - just dereference the pointers 47 * precautions should be taken - just dereference the pointers
47 * 48 *
48 * 3. the access to other task namespaces is performed like this 49 * 3. the access to other task namespaces is performed like this
49 * rcu_read_lock(); 50 * task_lock(task);
50 * nsproxy = task_nsproxy(tsk); 51 * nsproxy = task->nsproxy;
51 * if (nsproxy != NULL) { 52 * if (nsproxy != NULL) {
52 * / * 53 * / *
53 * * work with the namespaces here 54 * * work with the namespaces here
54 * * e.g. get the reference on one of them 55 * * e.g. get the reference on one of them
55 * * / 56 * * /
56 * } / * 57 * } / *
57 * * NULL task_nsproxy() means that this task is 58 * * NULL task->nsproxy means that this task is
58 * * almost dead (zombie) 59 * * almost dead (zombie)
59 * * / 60 * * /
60 * rcu_read_unlock(); 61 * task_unlock(task);
61 * 62 *
62 */ 63 */
63 64
64static inline struct nsproxy *task_nsproxy(struct task_struct *tsk)
65{
66 return rcu_dereference(tsk->nsproxy);
67}
68
69int copy_namespaces(unsigned long flags, struct task_struct *tsk); 65int copy_namespaces(unsigned long flags, struct task_struct *tsk);
70void exit_task_namespaces(struct task_struct *tsk); 66void exit_task_namespaces(struct task_struct *tsk);
71void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new); 67void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new);
diff --git a/include/linux/of.h b/include/linux/of.h
index 196b34c1ef4e..29f0adc5f3e4 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -74,8 +74,6 @@ struct of_phandle_args {
74 uint32_t args[MAX_PHANDLE_ARGS]; 74 uint32_t args[MAX_PHANDLE_ARGS];
75}; 75};
76 76
77extern int of_node_add(struct device_node *node);
78
79/* initialize a node */ 77/* initialize a node */
80extern struct kobj_type of_node_ktype; 78extern struct kobj_type of_node_ktype;
81static inline void of_node_init(struct device_node *node) 79static inline void of_node_init(struct device_node *node)
@@ -113,6 +111,7 @@ static inline void of_node_put(struct device_node *node) { }
113extern struct device_node *of_allnodes; 111extern struct device_node *of_allnodes;
114extern struct device_node *of_chosen; 112extern struct device_node *of_chosen;
115extern struct device_node *of_aliases; 113extern struct device_node *of_aliases;
114extern struct device_node *of_stdout;
116extern raw_spinlock_t devtree_lock; 115extern raw_spinlock_t devtree_lock;
117 116
118static inline bool of_have_populated_dt(void) 117static inline bool of_have_populated_dt(void)
@@ -204,6 +203,7 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
204#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ 203#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
205#define OF_DETACHED 2 /* node has been detached from the device tree */ 204#define OF_DETACHED 2 /* node has been detached from the device tree */
206#define OF_POPULATED 3 /* device already created for the node */ 205#define OF_POPULATED 3 /* device already created for the node */
206#define OF_POPULATED_BUS 4 /* of_platform_populate recursed to children of this node */
207 207
208#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) 208#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
209#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) 209#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
@@ -267,14 +267,12 @@ extern int of_property_read_u64(const struct device_node *np,
267extern int of_property_read_string(struct device_node *np, 267extern int of_property_read_string(struct device_node *np,
268 const char *propname, 268 const char *propname,
269 const char **out_string); 269 const char **out_string);
270extern int of_property_read_string_index(struct device_node *np,
271 const char *propname,
272 int index, const char **output);
273extern int of_property_match_string(struct device_node *np, 270extern int of_property_match_string(struct device_node *np,
274 const char *propname, 271 const char *propname,
275 const char *string); 272 const char *string);
276extern int of_property_count_strings(struct device_node *np, 273extern int of_property_read_string_helper(struct device_node *np,
277 const char *propname); 274 const char *propname,
275 const char **out_strs, size_t sz, int index);
278extern int of_device_is_compatible(const struct device_node *device, 276extern int of_device_is_compatible(const struct device_node *device,
279 const char *); 277 const char *);
280extern int of_device_is_available(const struct device_node *device); 278extern int of_device_is_available(const struct device_node *device);
@@ -322,6 +320,7 @@ extern int of_update_property(struct device_node *np, struct property *newprop);
322struct of_prop_reconfig { 320struct of_prop_reconfig {
323 struct device_node *dn; 321 struct device_node *dn;
324 struct property *prop; 322 struct property *prop;
323 struct property *old_prop;
325}; 324};
326 325
327extern int of_reconfig_notifier_register(struct notifier_block *); 326extern int of_reconfig_notifier_register(struct notifier_block *);
@@ -352,7 +351,7 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
352 */ 351 */
353const char *of_prop_next_string(struct property *prop, const char *cur); 352const char *of_prop_next_string(struct property *prop, const char *cur);
354 353
355int of_device_is_stdout_path(struct device_node *dn); 354bool of_console_check(struct device_node *dn, char *name, int index);
356 355
357#else /* CONFIG_OF */ 356#else /* CONFIG_OF */
358 357
@@ -485,15 +484,9 @@ static inline int of_property_read_string(struct device_node *np,
485 return -ENOSYS; 484 return -ENOSYS;
486} 485}
487 486
488static inline int of_property_read_string_index(struct device_node *np, 487static inline int of_property_read_string_helper(struct device_node *np,
489 const char *propname, int index, 488 const char *propname,
490 const char **out_string) 489 const char **out_strs, size_t sz, int index)
491{
492 return -ENOSYS;
493}
494
495static inline int of_property_count_strings(struct device_node *np,
496 const char *propname)
497{ 490{
498 return -ENOSYS; 491 return -ENOSYS;
499} 492}
@@ -564,9 +557,9 @@ static inline int of_machine_is_compatible(const char *compat)
564 return 0; 557 return 0;
565} 558}
566 559
567static inline int of_device_is_stdout_path(struct device_node *dn) 560static inline bool of_console_check(const struct device_node *dn, const char *name, int index)
568{ 561{
569 return 0; 562 return false;
570} 563}
571 564
572static inline const __be32 *of_prop_next_u32(struct property *prop, 565static inline const __be32 *of_prop_next_u32(struct property *prop,
@@ -667,6 +660,70 @@ static inline int of_property_count_u64_elems(const struct device_node *np,
667} 660}
668 661
669/** 662/**
663 * of_property_read_string_array() - Read an array of strings from a multiple
664 * strings property.
665 * @np: device node from which the property value is to be read.
666 * @propname: name of the property to be searched.
667 * @out_strs: output array of string pointers.
668 * @sz: number of array elements to read.
669 *
670 * Search for a property in a device tree node and retrieve a list of
671 * terminated string values (pointer to data, not a copy) in that property.
672 *
673 * If @out_strs is NULL, the number of strings in the property is returned.
674 */
675static inline int of_property_read_string_array(struct device_node *np,
676 const char *propname, const char **out_strs,
677 size_t sz)
678{
679 return of_property_read_string_helper(np, propname, out_strs, sz, 0);
680}
681
682/**
683 * of_property_count_strings() - Find and return the number of strings from a
684 * multiple strings property.
685 * @np: device node from which the property value is to be read.
686 * @propname: name of the property to be searched.
687 *
688 * Search for a property in a device tree node and retrieve the number of null
689 * terminated string contain in it. Returns the number of strings on
690 * success, -EINVAL if the property does not exist, -ENODATA if property
691 * does not have a value, and -EILSEQ if the string is not null-terminated
692 * within the length of the property data.
693 */
694static inline int of_property_count_strings(struct device_node *np,
695 const char *propname)
696{
697 return of_property_read_string_helper(np, propname, NULL, 0, 0);
698}
699
700/**
701 * of_property_read_string_index() - Find and read a string from a multiple
702 * strings property.
703 * @np: device node from which the property value is to be read.
704 * @propname: name of the property to be searched.
705 * @index: index of the string in the list of strings
706 * @out_string: pointer to null terminated return string, modified only if
707 * return value is 0.
708 *
709 * Search for a property in a device tree node and retrieve a null
710 * terminated string value (pointer to data, not a copy) in the list of strings
711 * contained in that property.
712 * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
713 * property does not have a value, and -EILSEQ if the string is not
714 * null-terminated within the length of the property data.
715 *
716 * The out_string pointer is modified only if a valid string can be decoded.
717 */
718static inline int of_property_read_string_index(struct device_node *np,
719 const char *propname,
720 int index, const char **output)
721{
722 int rc = of_property_read_string_helper(np, propname, output, 1, index);
723 return rc < 0 ? rc : 0;
724}
725
726/**
670 * of_property_read_bool - Findfrom a property 727 * of_property_read_bool - Findfrom a property
671 * @np: device node from which the property value is to be read. 728 * @np: device node from which the property value is to be read.
672 * @propname: name of the property to be searched. 729 * @propname: name of the property to be searched.
@@ -786,4 +843,83 @@ typedef void (*of_init_fn_1)(struct device_node *);
786#define OF_DECLARE_2(table, name, compat, fn) \ 843#define OF_DECLARE_2(table, name, compat, fn) \
787 _OF_DECLARE(table, name, compat, fn, of_init_fn_2) 844 _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
788 845
846/**
847 * struct of_changeset_entry - Holds a changeset entry
848 *
849 * @node: list_head for the log list
850 * @action: notifier action
851 * @np: pointer to the device node affected
852 * @prop: pointer to the property affected
853 * @old_prop: hold a pointer to the original property
854 *
855 * Every modification of the device tree during a changeset
856 * is held in a list of of_changeset_entry structures.
857 * That way we can recover from a partial application, or we can
858 * revert the changeset
859 */
860struct of_changeset_entry {
861 struct list_head node;
862 unsigned long action;
863 struct device_node *np;
864 struct property *prop;
865 struct property *old_prop;
866};
867
868/**
869 * struct of_changeset - changeset tracker structure
870 *
871 * @entries: list_head for the changeset entries
872 *
873 * changesets are a convenient way to apply bulk changes to the
874 * live tree. In case of an error, changes are rolled-back.
875 * changesets live on after initial application, and if not
876 * destroyed after use, they can be reverted in one single call.
877 */
878struct of_changeset {
879 struct list_head entries;
880};
881
882#ifdef CONFIG_OF_DYNAMIC
883extern void of_changeset_init(struct of_changeset *ocs);
884extern void of_changeset_destroy(struct of_changeset *ocs);
885extern int of_changeset_apply(struct of_changeset *ocs);
886extern int of_changeset_revert(struct of_changeset *ocs);
887extern int of_changeset_action(struct of_changeset *ocs,
888 unsigned long action, struct device_node *np,
889 struct property *prop);
890
891static inline int of_changeset_attach_node(struct of_changeset *ocs,
892 struct device_node *np)
893{
894 return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL);
895}
896
897static inline int of_changeset_detach_node(struct of_changeset *ocs,
898 struct device_node *np)
899{
900 return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL);
901}
902
903static inline int of_changeset_add_property(struct of_changeset *ocs,
904 struct device_node *np, struct property *prop)
905{
906 return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop);
907}
908
909static inline int of_changeset_remove_property(struct of_changeset *ocs,
910 struct device_node *np, struct property *prop)
911{
912 return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop);
913}
914
915static inline int of_changeset_update_property(struct of_changeset *ocs,
916 struct device_node *np, struct property *prop)
917{
918 return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop);
919}
920#endif
921
922/* CONFIG_OF_RESOLVE api */
923extern int of_resolve_phandles(struct device_node *tree);
924
789#endif /* _LINUX_OF_H */ 925#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index fb7b7221e063..8cb14eb393d6 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -23,17 +23,6 @@ struct of_pci_range {
23#define for_each_of_pci_range(parser, range) \ 23#define for_each_of_pci_range(parser, range) \
24 for (; of_pci_range_parser_one(parser, range);) 24 for (; of_pci_range_parser_one(parser, range);)
25 25
26static inline void of_pci_range_to_resource(struct of_pci_range *range,
27 struct device_node *np,
28 struct resource *res)
29{
30 res->flags = range->flags;
31 res->start = range->cpu_addr;
32 res->end = range->cpu_addr + range->size - 1;
33 res->parent = res->child = res->sibling = NULL;
34 res->name = np->full_name;
35}
36
37/* Translate a DMA address from device space to CPU space */ 26/* Translate a DMA address from device space to CPU space */
38extern u64 of_translate_dma_address(struct device_node *dev, 27extern u64 of_translate_dma_address(struct device_node *dev,
39 const __be32 *in_addr); 28 const __be32 *in_addr);
@@ -55,7 +44,9 @@ extern void __iomem *of_iomap(struct device_node *device, int index);
55extern const __be32 *of_get_address(struct device_node *dev, int index, 44extern const __be32 *of_get_address(struct device_node *dev, int index,
56 u64 *size, unsigned int *flags); 45 u64 *size, unsigned int *flags);
57 46
47extern int pci_register_io_range(phys_addr_t addr, resource_size_t size);
58extern unsigned long pci_address_to_pio(phys_addr_t addr); 48extern unsigned long pci_address_to_pio(phys_addr_t addr);
49extern phys_addr_t pci_pio_to_address(unsigned long pio);
59 50
60extern int of_pci_range_parser_init(struct of_pci_range_parser *parser, 51extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
61 struct device_node *node); 52 struct device_node *node);
@@ -80,6 +71,11 @@ static inline const __be32 *of_get_address(struct device_node *dev, int index,
80 return NULL; 71 return NULL;
81} 72}
82 73
74static inline phys_addr_t pci_pio_to_address(unsigned long pio)
75{
76 return 0;
77}
78
83static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser, 79static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser,
84 struct device_node *node) 80 struct device_node *node)
85{ 81{
@@ -138,6 +134,9 @@ extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
138 u64 *size, unsigned int *flags); 134 u64 *size, unsigned int *flags);
139extern int of_pci_address_to_resource(struct device_node *dev, int bar, 135extern int of_pci_address_to_resource(struct device_node *dev, int bar,
140 struct resource *r); 136 struct resource *r);
137extern int of_pci_range_to_resource(struct of_pci_range *range,
138 struct device_node *np,
139 struct resource *res);
141#else /* CONFIG_OF_ADDRESS && CONFIG_PCI */ 140#else /* CONFIG_OF_ADDRESS && CONFIG_PCI */
142static inline int of_pci_address_to_resource(struct device_node *dev, int bar, 141static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
143 struct resource *r) 142 struct resource *r)
@@ -150,6 +149,12 @@ static inline const __be32 *of_get_pci_address(struct device_node *dev,
150{ 149{
151 return NULL; 150 return NULL;
152} 151}
152static inline int of_pci_range_to_resource(struct of_pci_range *range,
153 struct device_node *np,
154 struct resource *res)
155{
156 return -ENOSYS;
157}
153#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ 158#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
154 159
155#endif /* __OF_ADDRESS_H */ 160#endif /* __OF_ADDRESS_H */
diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h
index ae36298ba076..56bc026c143f 100644
--- a/include/linux/of_dma.h
+++ b/include/linux/of_dma.h
@@ -41,6 +41,8 @@ extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
41 const char *name); 41 const char *name);
42extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec, 42extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
43 struct of_dma *ofdma); 43 struct of_dma *ofdma);
44extern struct dma_chan *of_dma_xlate_by_chan_id(struct of_phandle_args *dma_spec,
45 struct of_dma *ofdma);
44#else 46#else
45static inline int of_dma_controller_register(struct device_node *np, 47static inline int of_dma_controller_register(struct device_node *np,
46 struct dma_chan *(*of_dma_xlate) 48 struct dma_chan *(*of_dma_xlate)
@@ -66,6 +68,8 @@ static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_s
66 return NULL; 68 return NULL;
67} 69}
68 70
71#define of_dma_xlate_by_chan_id NULL
72
69#endif 73#endif
70 74
71#endif /* __LINUX_OF_DMA_H */ 75#endif /* __LINUX_OF_DMA_H */
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index dde3a4a0fa5d..1fd207e7a847 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -15,6 +15,7 @@ struct device_node *of_pci_find_child_device(struct device_node *parent,
15int of_pci_get_devfn(struct device_node *np); 15int of_pci_get_devfn(struct device_node *np);
16int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin); 16int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin);
17int of_pci_parse_bus_range(struct device_node *node, struct resource *res); 17int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
18int of_get_pci_domain_nr(struct device_node *node);
18#else 19#else
19static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) 20static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
20{ 21{
@@ -43,6 +44,18 @@ of_pci_parse_bus_range(struct device_node *node, struct resource *res)
43{ 44{
44 return -EINVAL; 45 return -EINVAL;
45} 46}
47
48static inline int
49of_get_pci_domain_nr(struct device_node *node)
50{
51 return -1;
52}
53#endif
54
55#if defined(CONFIG_OF_ADDRESS)
56int of_pci_get_host_bridge_resources(struct device_node *dev,
57 unsigned char busno, unsigned char bus_max,
58 struct list_head *resources, resource_size_t *io_base);
46#endif 59#endif
47 60
48#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI) 61#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI)
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index d96e1badbee0..c2b0627a2317 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -72,7 +72,7 @@ extern int of_platform_populate(struct device_node *root,
72 const struct of_device_id *matches, 72 const struct of_device_id *matches,
73 const struct of_dev_auxdata *lookup, 73 const struct of_dev_auxdata *lookup,
74 struct device *parent); 74 struct device *parent);
75extern int of_platform_depopulate(struct device *parent); 75extern void of_platform_depopulate(struct device *parent);
76#else 76#else
77static inline int of_platform_populate(struct device_node *root, 77static inline int of_platform_populate(struct device_node *root,
78 const struct of_device_id *matches, 78 const struct of_device_id *matches,
@@ -81,10 +81,7 @@ static inline int of_platform_populate(struct device_node *root,
81{ 81{
82 return -ENODEV; 82 return -ENODEV;
83} 83}
84static inline int of_platform_depopulate(struct device *parent) 84static inline void of_platform_depopulate(struct device *parent) { }
85{
86 return -ENODEV;
87}
88#endif 85#endif
89 86
90#endif /* _LINUX_OF_PLATFORM_H */ 87#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
index 4669ddfdd5af..ad2f67054372 100644
--- a/include/linux/of_reserved_mem.h
+++ b/include/linux/of_reserved_mem.h
@@ -8,6 +8,7 @@ struct reserved_mem_ops;
8struct reserved_mem { 8struct reserved_mem {
9 const char *name; 9 const char *name;
10 unsigned long fdt_node; 10 unsigned long fdt_node;
11 unsigned long phandle;
11 const struct reserved_mem_ops *ops; 12 const struct reserved_mem_ops *ops;
12 phys_addr_t base; 13 phys_addr_t base;
13 phys_addr_t size; 14 phys_addr_t size;
@@ -15,7 +16,7 @@ struct reserved_mem {
15}; 16};
16 17
17struct reserved_mem_ops { 18struct reserved_mem_ops {
18 void (*device_init)(struct reserved_mem *rmem, 19 int (*device_init)(struct reserved_mem *rmem,
19 struct device *dev); 20 struct device *dev);
20 void (*device_release)(struct reserved_mem *rmem, 21 void (*device_release)(struct reserved_mem *rmem,
21 struct device *dev); 22 struct device *dev);
@@ -27,10 +28,19 @@ typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
27 _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn) 28 _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn)
28 29
29#ifdef CONFIG_OF_RESERVED_MEM 30#ifdef CONFIG_OF_RESERVED_MEM
31int of_reserved_mem_device_init(struct device *dev);
32void of_reserved_mem_device_release(struct device *dev);
33
30void fdt_init_reserved_mem(void); 34void fdt_init_reserved_mem(void);
31void fdt_reserved_mem_save_node(unsigned long node, const char *uname, 35void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
32 phys_addr_t base, phys_addr_t size); 36 phys_addr_t base, phys_addr_t size);
33#else 37#else
38static inline int of_reserved_mem_device_init(struct device *dev)
39{
40 return -ENOSYS;
41}
42static inline void of_reserved_mem_device_release(struct device *pdev) { }
43
34static inline void fdt_init_reserved_mem(void) { } 44static inline void fdt_init_reserved_mem(void) { }
35static inline void fdt_reserved_mem_save_node(unsigned long node, 45static inline void fdt_reserved_mem_save_node(unsigned long node,
36 const char *uname, phys_addr_t base, phys_addr_t size) { } 46 const char *uname, phys_addr_t base, phys_addr_t size) { }
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 88e6ea4a5d36..e5a70132a240 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -130,6 +130,7 @@
130#define IS_WORD_16 BIT(0xd) 130#define IS_WORD_16 BIT(0xd)
131#define ENABLE_16XX_MODE BIT(0xe) 131#define ENABLE_16XX_MODE BIT(0xe)
132#define HS_CHANNELS_RESERVED BIT(0xf) 132#define HS_CHANNELS_RESERVED BIT(0xf)
133#define DMA_ENGINE_HANDLE_IRQ BIT(0x10)
133 134
134/* Defines for DMA Capabilities */ 135/* Defines for DMA Capabilities */
135#define DMA_HAS_TRANSPARENT_CAPS (0x1 << 18) 136#define DMA_HAS_TRANSPARENT_CAPS (0x1 << 18)
@@ -305,15 +306,12 @@ extern void omap_set_dma_transfer_params(int lch, int data_type,
305 int elem_count, int frame_count, 306 int elem_count, int frame_count,
306 int sync_mode, 307 int sync_mode,
307 int dma_trigger, int src_or_dst_synch); 308 int dma_trigger, int src_or_dst_synch);
308extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode,
309 u32 color);
310extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode); 309extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode);
311extern void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode); 310extern void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode);
312 311
313extern void omap_set_dma_src_params(int lch, int src_port, int src_amode, 312extern void omap_set_dma_src_params(int lch, int src_port, int src_amode,
314 unsigned long src_start, 313 unsigned long src_start,
315 int src_ei, int src_fi); 314 int src_ei, int src_fi);
316extern void omap_set_dma_src_index(int lch, int eidx, int fidx);
317extern void omap_set_dma_src_data_pack(int lch, int enable); 315extern void omap_set_dma_src_data_pack(int lch, int enable);
318extern void omap_set_dma_src_burst_mode(int lch, 316extern void omap_set_dma_src_burst_mode(int lch,
319 enum omap_dma_burst_mode burst_mode); 317 enum omap_dma_burst_mode burst_mode);
@@ -321,7 +319,6 @@ extern void omap_set_dma_src_burst_mode(int lch,
321extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, 319extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
322 unsigned long dest_start, 320 unsigned long dest_start,
323 int dst_ei, int dst_fi); 321 int dst_ei, int dst_fi);
324extern void omap_set_dma_dest_index(int lch, int eidx, int fidx);
325extern void omap_set_dma_dest_data_pack(int lch, int enable); 322extern void omap_set_dma_dest_data_pack(int lch, int enable);
326extern void omap_set_dma_dest_burst_mode(int lch, 323extern void omap_set_dma_dest_burst_mode(int lch,
327 enum omap_dma_burst_mode burst_mode); 324 enum omap_dma_burst_mode burst_mode);
@@ -330,52 +327,19 @@ extern void omap_set_dma_params(int lch,
330 struct omap_dma_channel_params *params); 327 struct omap_dma_channel_params *params);
331 328
332extern void omap_dma_link_lch(int lch_head, int lch_queue); 329extern void omap_dma_link_lch(int lch_head, int lch_queue);
333extern void omap_dma_unlink_lch(int lch_head, int lch_queue);
334 330
335extern int omap_set_dma_callback(int lch, 331extern int omap_set_dma_callback(int lch,
336 void (*callback)(int lch, u16 ch_status, void *data), 332 void (*callback)(int lch, u16 ch_status, void *data),
337 void *data); 333 void *data);
338extern dma_addr_t omap_get_dma_src_pos(int lch); 334extern dma_addr_t omap_get_dma_src_pos(int lch);
339extern dma_addr_t omap_get_dma_dst_pos(int lch); 335extern dma_addr_t omap_get_dma_dst_pos(int lch);
340extern void omap_clear_dma(int lch);
341extern int omap_get_dma_active_status(int lch); 336extern int omap_get_dma_active_status(int lch);
342extern int omap_dma_running(void); 337extern int omap_dma_running(void);
343extern void omap_dma_set_global_params(int arb_rate, int max_fifo_depth, 338extern void omap_dma_set_global_params(int arb_rate, int max_fifo_depth,
344 int tparams); 339 int tparams);
345extern int omap_dma_set_prio_lch(int lch, unsigned char read_prio,
346 unsigned char write_prio);
347extern void omap_set_dma_dst_endian_type(int lch, enum end_type etype);
348extern void omap_set_dma_src_endian_type(int lch, enum end_type etype);
349extern int omap_get_dma_index(int lch, int *ei, int *fi);
350
351void omap_dma_global_context_save(void); 340void omap_dma_global_context_save(void);
352void omap_dma_global_context_restore(void); 341void omap_dma_global_context_restore(void);
353 342
354extern void omap_dma_disable_irq(int lch);
355
356/* Chaining APIs */
357#ifndef CONFIG_ARCH_OMAP1
358extern int omap_request_dma_chain(int dev_id, const char *dev_name,
359 void (*callback) (int lch, u16 ch_status,
360 void *data),
361 int *chain_id, int no_of_chans,
362 int chain_mode,
363 struct omap_dma_channel_params params);
364extern int omap_free_dma_chain(int chain_id);
365extern int omap_dma_chain_a_transfer(int chain_id, int src_start,
366 int dest_start, int elem_count,
367 int frame_count, void *callbk_data);
368extern int omap_start_dma_chain_transfers(int chain_id);
369extern int omap_stop_dma_chain_transfers(int chain_id);
370extern int omap_get_dma_chain_index(int chain_id, int *ei, int *fi);
371extern int omap_get_dma_chain_dst_pos(int chain_id);
372extern int omap_get_dma_chain_src_pos(int chain_id);
373
374extern int omap_modify_dma_chain_params(int chain_id,
375 struct omap_dma_channel_params params);
376extern int omap_dma_chain_status(int chain_id);
377#endif
378
379#if defined(CONFIG_ARCH_OMAP1) && IS_ENABLED(CONFIG_FB_OMAP) 343#if defined(CONFIG_ARCH_OMAP1) && IS_ENABLED(CONFIG_FB_OMAP)
380#include <mach/lcd_dma.h> 344#include <mach/lcd_dma.h>
381#else 345#else
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 4cd62677feb9..e8d6e1058723 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -50,13 +50,16 @@ static inline bool oom_task_origin(const struct task_struct *p)
50extern unsigned long oom_badness(struct task_struct *p, 50extern unsigned long oom_badness(struct task_struct *p,
51 struct mem_cgroup *memcg, const nodemask_t *nodemask, 51 struct mem_cgroup *memcg, const nodemask_t *nodemask,
52 unsigned long totalpages); 52 unsigned long totalpages);
53
54extern int oom_kills_count(void);
55extern void note_oom_kill(void);
53extern void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, 56extern void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
54 unsigned int points, unsigned long totalpages, 57 unsigned int points, unsigned long totalpages,
55 struct mem_cgroup *memcg, nodemask_t *nodemask, 58 struct mem_cgroup *memcg, nodemask_t *nodemask,
56 const char *message); 59 const char *message);
57 60
58extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 61extern bool oom_zonelist_trylock(struct zonelist *zonelist, gfp_t gfp_flags);
59extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 62extern void oom_zonelist_unlock(struct zonelist *zonelist, gfp_t gfp_flags);
60 63
61extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask, 64extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask,
62 int order, const nodemask_t *nodemask); 65 int order, const nodemask_t *nodemask);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 8304959ad336..e1f5fcd79792 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -171,13 +171,12 @@ static inline int __TestClearPage##uname(struct page *page) \
171#define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \ 171#define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
172 __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname) 172 __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname)
173 173
174#define PAGEFLAG_FALSE(uname) \
175static inline int Page##uname(const struct page *page) \
176 { return 0; }
177
178#define TESTSCFLAG(uname, lname) \ 174#define TESTSCFLAG(uname, lname) \
179 TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname) 175 TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname)
180 176
177#define TESTPAGEFLAG_FALSE(uname) \
178static inline int Page##uname(const struct page *page) { return 0; }
179
181#define SETPAGEFLAG_NOOP(uname) \ 180#define SETPAGEFLAG_NOOP(uname) \
182static inline void SetPage##uname(struct page *page) { } 181static inline void SetPage##uname(struct page *page) { }
183 182
@@ -187,12 +186,21 @@ static inline void ClearPage##uname(struct page *page) { }
187#define __CLEARPAGEFLAG_NOOP(uname) \ 186#define __CLEARPAGEFLAG_NOOP(uname) \
188static inline void __ClearPage##uname(struct page *page) { } 187static inline void __ClearPage##uname(struct page *page) { }
189 188
189#define TESTSETFLAG_FALSE(uname) \
190static inline int TestSetPage##uname(struct page *page) { return 0; }
191
190#define TESTCLEARFLAG_FALSE(uname) \ 192#define TESTCLEARFLAG_FALSE(uname) \
191static inline int TestClearPage##uname(struct page *page) { return 0; } 193static inline int TestClearPage##uname(struct page *page) { return 0; }
192 194
193#define __TESTCLEARFLAG_FALSE(uname) \ 195#define __TESTCLEARFLAG_FALSE(uname) \
194static inline int __TestClearPage##uname(struct page *page) { return 0; } 196static inline int __TestClearPage##uname(struct page *page) { return 0; }
195 197
198#define PAGEFLAG_FALSE(uname) TESTPAGEFLAG_FALSE(uname) \
199 SETPAGEFLAG_NOOP(uname) CLEARPAGEFLAG_NOOP(uname)
200
201#define TESTSCFLAG_FALSE(uname) \
202 TESTSETFLAG_FALSE(uname) TESTCLEARFLAG_FALSE(uname)
203
196struct page; /* forward declaration */ 204struct page; /* forward declaration */
197 205
198TESTPAGEFLAG(Locked, locked) 206TESTPAGEFLAG(Locked, locked)
@@ -248,7 +256,6 @@ PAGEFLAG_FALSE(HighMem)
248PAGEFLAG(SwapCache, swapcache) 256PAGEFLAG(SwapCache, swapcache)
249#else 257#else
250PAGEFLAG_FALSE(SwapCache) 258PAGEFLAG_FALSE(SwapCache)
251 SETPAGEFLAG_NOOP(SwapCache) CLEARPAGEFLAG_NOOP(SwapCache)
252#endif 259#endif
253 260
254PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) 261PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
@@ -258,8 +265,8 @@ PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
258PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) 265PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked)
259 TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked) 266 TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked)
260#else 267#else
261PAGEFLAG_FALSE(Mlocked) SETPAGEFLAG_NOOP(Mlocked) 268PAGEFLAG_FALSE(Mlocked) __CLEARPAGEFLAG_NOOP(Mlocked)
262 TESTCLEARFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked) 269 TESTSCFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked)
263#endif 270#endif
264 271
265#ifdef CONFIG_ARCH_USES_PG_UNCACHED 272#ifdef CONFIG_ARCH_USES_PG_UNCACHED
diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index 3fff8e774067..2dc1e1697b45 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -2,6 +2,10 @@
2#define __LINUX_PAGEISOLATION_H 2#define __LINUX_PAGEISOLATION_H
3 3
4#ifdef CONFIG_MEMORY_ISOLATION 4#ifdef CONFIG_MEMORY_ISOLATION
5static inline bool has_isolate_pageblock(struct zone *zone)
6{
7 return zone->nr_isolate_pageblock;
8}
5static inline bool is_migrate_isolate_page(struct page *page) 9static inline bool is_migrate_isolate_page(struct page *page)
6{ 10{
7 return get_pageblock_migratetype(page) == MIGRATE_ISOLATE; 11 return get_pageblock_migratetype(page) == MIGRATE_ISOLATE;
@@ -11,6 +15,10 @@ static inline bool is_migrate_isolate(int migratetype)
11 return migratetype == MIGRATE_ISOLATE; 15 return migratetype == MIGRATE_ISOLATE;
12} 16}
13#else 17#else
18static inline bool has_isolate_pageblock(struct zone *zone)
19{
20 return false;
21}
14static inline bool is_migrate_isolate_page(struct page *page) 22static inline bool is_migrate_isolate_page(struct page *page)
15{ 23{
16 return false; 24 return false;
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 777a524716db..5c831f1eca79 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -3,17 +3,15 @@
3 3
4enum { 4enum {
5 /* flags for mem_cgroup */ 5 /* flags for mem_cgroup */
6 PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */ 6 PCG_USED = 0x01, /* This page is charged to a memcg */
7 PCG_USED, /* this object is in use. */ 7 PCG_MEM = 0x02, /* This page holds a memory charge */
8 PCG_MIGRATION, /* under page migration */ 8 PCG_MEMSW = 0x04, /* This page holds a memory+swap charge */
9 __NR_PCG_FLAGS,
10}; 9};
11 10
12#ifndef __GENERATING_BOUNDS_H 11struct pglist_data;
13#include <generated/bounds.h>
14 12
15#ifdef CONFIG_MEMCG 13#ifdef CONFIG_MEMCG
16#include <linux/bit_spinlock.h> 14struct mem_cgroup;
17 15
18/* 16/*
19 * Page Cgroup can be considered as an extended mem_map. 17 * Page Cgroup can be considered as an extended mem_map.
@@ -27,65 +25,30 @@ struct page_cgroup {
27 struct mem_cgroup *mem_cgroup; 25 struct mem_cgroup *mem_cgroup;
28}; 26};
29 27
30void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat); 28extern void pgdat_page_cgroup_init(struct pglist_data *pgdat);
31 29
32#ifdef CONFIG_SPARSEMEM 30#ifdef CONFIG_SPARSEMEM
33static inline void __init page_cgroup_init_flatmem(void) 31static inline void page_cgroup_init_flatmem(void)
34{ 32{
35} 33}
36extern void __init page_cgroup_init(void); 34extern void page_cgroup_init(void);
37#else 35#else
38void __init page_cgroup_init_flatmem(void); 36extern void page_cgroup_init_flatmem(void);
39static inline void __init page_cgroup_init(void) 37static inline void page_cgroup_init(void)
40{ 38{
41} 39}
42#endif 40#endif
43 41
44struct page_cgroup *lookup_page_cgroup(struct page *page); 42struct page_cgroup *lookup_page_cgroup(struct page *page);
45struct page *lookup_cgroup_page(struct page_cgroup *pc);
46
47#define TESTPCGFLAG(uname, lname) \
48static inline int PageCgroup##uname(struct page_cgroup *pc) \
49 { return test_bit(PCG_##lname, &pc->flags); }
50
51#define SETPCGFLAG(uname, lname) \
52static inline void SetPageCgroup##uname(struct page_cgroup *pc)\
53 { set_bit(PCG_##lname, &pc->flags); }
54
55#define CLEARPCGFLAG(uname, lname) \
56static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \
57 { clear_bit(PCG_##lname, &pc->flags); }
58
59#define TESTCLEARPCGFLAG(uname, lname) \
60static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \
61 { return test_and_clear_bit(PCG_##lname, &pc->flags); }
62
63TESTPCGFLAG(Used, USED)
64CLEARPCGFLAG(Used, USED)
65SETPCGFLAG(Used, USED)
66
67SETPCGFLAG(Migration, MIGRATION)
68CLEARPCGFLAG(Migration, MIGRATION)
69TESTPCGFLAG(Migration, MIGRATION)
70 43
71static inline void lock_page_cgroup(struct page_cgroup *pc) 44static inline int PageCgroupUsed(struct page_cgroup *pc)
72{ 45{
73 /* 46 return !!(pc->flags & PCG_USED);
74 * Don't take this lock in IRQ context.
75 * This lock is for pc->mem_cgroup, USED, MIGRATION
76 */
77 bit_spin_lock(PCG_LOCK, &pc->flags);
78} 47}
79 48#else /* !CONFIG_MEMCG */
80static inline void unlock_page_cgroup(struct page_cgroup *pc)
81{
82 bit_spin_unlock(PCG_LOCK, &pc->flags);
83}
84
85#else /* CONFIG_MEMCG */
86struct page_cgroup; 49struct page_cgroup;
87 50
88static inline void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat) 51static inline void pgdat_page_cgroup_init(struct pglist_data *pgdat)
89{ 52{
90} 53}
91 54
@@ -98,10 +61,9 @@ static inline void page_cgroup_init(void)
98{ 61{
99} 62}
100 63
101static inline void __init page_cgroup_init_flatmem(void) 64static inline void page_cgroup_init_flatmem(void)
102{ 65{
103} 66}
104
105#endif /* CONFIG_MEMCG */ 67#endif /* CONFIG_MEMCG */
106 68
107#include <linux/swap.h> 69#include <linux/swap.h>
@@ -140,6 +102,4 @@ static inline void swap_cgroup_swapoff(int type)
140 102
141#endif /* CONFIG_MEMCG_SWAP */ 103#endif /* CONFIG_MEMCG_SWAP */
142 104
143#endif /* !__GENERATING_BOUNDS_H */
144
145#endif /* __LINUX_PAGE_CGROUP_H */ 105#endif /* __LINUX_PAGE_CGROUP_H */
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index bf657ff3208c..7ea069cd3257 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -24,8 +24,7 @@ enum mapping_flags {
24 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */ 24 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */
25 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */ 25 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */
26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */ 26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */
27 AS_BALLOON_MAP = __GFP_BITS_SHIFT + 4, /* balloon page special map */ 27 AS_EXITING = __GFP_BITS_SHIFT + 4, /* final truncate in progress */
28 AS_EXITING = __GFP_BITS_SHIFT + 5, /* final truncate in progress */
29}; 28};
30 29
31static inline void mapping_set_error(struct address_space *mapping, int error) 30static inline void mapping_set_error(struct address_space *mapping, int error)
@@ -55,21 +54,6 @@ static inline int mapping_unevictable(struct address_space *mapping)
55 return !!mapping; 54 return !!mapping;
56} 55}
57 56
58static inline void mapping_set_balloon(struct address_space *mapping)
59{
60 set_bit(AS_BALLOON_MAP, &mapping->flags);
61}
62
63static inline void mapping_clear_balloon(struct address_space *mapping)
64{
65 clear_bit(AS_BALLOON_MAP, &mapping->flags);
66}
67
68static inline int mapping_balloon(struct address_space *mapping)
69{
70 return mapping && test_bit(AS_BALLOON_MAP, &mapping->flags);
71}
72
73static inline void mapping_set_exiting(struct address_space *mapping) 57static inline void mapping_set_exiting(struct address_space *mapping)
74{ 58{
75 set_bit(AS_EXITING, &mapping->flags); 59 set_bit(AS_EXITING, &mapping->flags);
@@ -484,6 +468,9 @@ static inline int lock_page_killable(struct page *page)
484/* 468/*
485 * lock_page_or_retry - Lock the page, unless this would block and the 469 * lock_page_or_retry - Lock the page, unless this would block and the
486 * caller indicated that it can handle a retry. 470 * caller indicated that it can handle a retry.
471 *
472 * Return value and mmap_sem implications depend on flags; see
473 * __lock_page_or_retry().
487 */ 474 */
488static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm, 475static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm,
489 unsigned int flags) 476 unsigned int flags)
@@ -493,12 +480,14 @@ static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm,
493} 480}
494 481
495/* 482/*
496 * This is exported only for wait_on_page_locked/wait_on_page_writeback. 483 * This is exported only for wait_on_page_locked/wait_on_page_writeback,
497 * Never use this directly! 484 * and for filesystems which need to wait on PG_private.
498 */ 485 */
499extern void wait_on_page_bit(struct page *page, int bit_nr); 486extern void wait_on_page_bit(struct page *page, int bit_nr);
500 487
501extern int wait_on_page_bit_killable(struct page *page, int bit_nr); 488extern int wait_on_page_bit_killable(struct page *page, int bit_nr);
489extern int wait_on_page_bit_killable_timeout(struct page *page,
490 int bit_nr, unsigned long timeout);
502 491
503static inline int wait_on_page_locked_killable(struct page *page) 492static inline int wait_on_page_locked_killable(struct page *page)
504{ 493{
@@ -507,6 +496,12 @@ static inline int wait_on_page_locked_killable(struct page *page)
507 return 0; 496 return 0;
508} 497}
509 498
499extern wait_queue_head_t *page_waitqueue(struct page *page);
500static inline void wake_up_page(struct page *page, int bit)
501{
502 __wake_up_bit(page_waitqueue(page), &page->flags, bit);
503}
504
510/* 505/*
511 * Wait for a page to be unlocked. 506 * Wait for a page to be unlocked.
512 * 507 *
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 64dacb7288a6..24c7728ca681 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -41,8 +41,13 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
41 41
42 if (pci_is_root_bus(pbus)) 42 if (pci_is_root_bus(pbus))
43 dev = pbus->bridge; 43 dev = pbus->bridge;
44 else 44 else {
45 /* If pbus is a virtual bus, there is no bridge to it */
46 if (!pbus->self)
47 return NULL;
48
45 dev = &pbus->self->dev; 49 dev = &pbus->self->dev;
50 }
46 51
47 return ACPI_HANDLE(dev); 52 return ACPI_HANDLE(dev);
48} 53}
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 61978a460841..5be8db45e368 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -45,7 +45,7 @@
45 * In the interest of not exposing interfaces to user-space unnecessarily, 45 * In the interest of not exposing interfaces to user-space unnecessarily,
46 * the following kernel-only defines are being added here. 46 * the following kernel-only defines are being added here.
47 */ 47 */
48#define PCI_DEVID(bus, devfn) ((((u16)bus) << 8) | devfn) 48#define PCI_DEVID(bus, devfn) ((((u16)(bus)) << 8) | (devfn))
49/* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */ 49/* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */
50#define PCI_BUS_NUM(x) (((x) >> 8) & 0xff) 50#define PCI_BUS_NUM(x) (((x) >> 8) & 0xff)
51 51
@@ -303,6 +303,7 @@ struct pci_dev {
303 D3cold, not set for devices 303 D3cold, not set for devices
304 powered on/off by the 304 powered on/off by the
305 corresponding bridge */ 305 corresponding bridge */
306 unsigned int ignore_hotplug:1; /* Ignore hotplug events */
306 unsigned int d3_delay; /* D3->D0 transition time in ms */ 307 unsigned int d3_delay; /* D3->D0 transition time in ms */
307 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ 308 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */
308 309
@@ -456,6 +457,9 @@ struct pci_bus {
456 unsigned char primary; /* number of primary bridge */ 457 unsigned char primary; /* number of primary bridge */
457 unsigned char max_bus_speed; /* enum pci_bus_speed */ 458 unsigned char max_bus_speed; /* enum pci_bus_speed */
458 unsigned char cur_bus_speed; /* enum pci_bus_speed */ 459 unsigned char cur_bus_speed; /* enum pci_bus_speed */
460#ifdef CONFIG_PCI_DOMAINS_GENERIC
461 int domain_nr;
462#endif
459 463
460 char name[48]; 464 char name[48];
461 465
@@ -1021,6 +1025,11 @@ bool pci_dev_run_wake(struct pci_dev *dev);
1021bool pci_check_pme_status(struct pci_dev *dev); 1025bool pci_check_pme_status(struct pci_dev *dev);
1022void pci_pme_wakeup_bus(struct pci_bus *bus); 1026void pci_pme_wakeup_bus(struct pci_bus *bus);
1023 1027
1028static inline void pci_ignore_hotplug(struct pci_dev *dev)
1029{
1030 dev->ignore_hotplug = 1;
1031}
1032
1024static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, 1033static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
1025 bool enable) 1034 bool enable)
1026{ 1035{
@@ -1097,6 +1106,9 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
1097 resource_size_t), 1106 resource_size_t),
1098 void *alignf_data); 1107 void *alignf_data);
1099 1108
1109
1110int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr);
1111
1100static inline dma_addr_t pci_bus_address(struct pci_dev *pdev, int bar) 1112static inline dma_addr_t pci_bus_address(struct pci_dev *pdev, int bar)
1101{ 1113{
1102 struct pci_bus_region region; 1114 struct pci_bus_region region;
@@ -1282,12 +1294,32 @@ void pci_cfg_access_unlock(struct pci_dev *dev);
1282 */ 1294 */
1283#ifdef CONFIG_PCI_DOMAINS 1295#ifdef CONFIG_PCI_DOMAINS
1284extern int pci_domains_supported; 1296extern int pci_domains_supported;
1297int pci_get_new_domain_nr(void);
1285#else 1298#else
1286enum { pci_domains_supported = 0 }; 1299enum { pci_domains_supported = 0 };
1287static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } 1300static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
1288static inline int pci_proc_domain(struct pci_bus *bus) { return 0; } 1301static inline int pci_proc_domain(struct pci_bus *bus) { return 0; }
1302static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
1289#endif /* CONFIG_PCI_DOMAINS */ 1303#endif /* CONFIG_PCI_DOMAINS */
1290 1304
1305/*
1306 * Generic implementation for PCI domain support. If your
1307 * architecture does not need custom management of PCI
1308 * domains then this implementation will be used
1309 */
1310#ifdef CONFIG_PCI_DOMAINS_GENERIC
1311static inline int pci_domain_nr(struct pci_bus *bus)
1312{
1313 return bus->domain_nr;
1314}
1315void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent);
1316#else
1317static inline void pci_bus_assign_domain_nr(struct pci_bus *bus,
1318 struct device *parent)
1319{
1320}
1321#endif
1322
1291/* some architectures require additional setup to direct VGA traffic */ 1323/* some architectures require additional setup to direct VGA traffic */
1292typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, 1324typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode,
1293 unsigned int command_bits, u32 flags); 1325 unsigned int command_bits, u32 flags);
@@ -1396,6 +1428,7 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
1396 1428
1397static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } 1429static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
1398static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) { return NULL; } 1430static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) { return NULL; }
1431static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }
1399 1432
1400#define dev_is_pci(d) (false) 1433#define dev_is_pci(d) (false)
1401#define dev_is_pf(d) (false) 1434#define dev_is_pf(d) (false)
@@ -1557,16 +1590,11 @@ enum pci_fixup_pass {
1557 1590
1558#ifdef CONFIG_PCI_QUIRKS 1591#ifdef CONFIG_PCI_QUIRKS
1559void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1592void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
1560struct pci_dev *pci_get_dma_source(struct pci_dev *dev);
1561int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); 1593int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags);
1562void pci_dev_specific_enable_acs(struct pci_dev *dev); 1594void pci_dev_specific_enable_acs(struct pci_dev *dev);
1563#else 1595#else
1564static inline void pci_fixup_device(enum pci_fixup_pass pass, 1596static inline void pci_fixup_device(enum pci_fixup_pass pass,
1565 struct pci_dev *dev) { } 1597 struct pci_dev *dev) { }
1566static inline struct pci_dev *pci_get_dma_source(struct pci_dev *dev)
1567{
1568 return pci_dev_get(dev);
1569}
1570static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev, 1598static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev,
1571 u16 acs_flags) 1599 u16 acs_flags)
1572{ 1600{
@@ -1701,7 +1729,7 @@ bool pci_acs_path_enabled(struct pci_dev *start,
1701 struct pci_dev *end, u16 acs_flags); 1729 struct pci_dev *end, u16 acs_flags);
1702 1730
1703#define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */ 1731#define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */
1704#define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT) 1732#define PCI_VPD_LRDT_ID(x) ((x) | PCI_VPD_LRDT)
1705 1733
1706/* Large Resource Data Type Tag Item Names */ 1734/* Large Resource Data Type Tag Item Names */
1707#define PCI_VPD_LTIN_ID_STRING 0x02 /* Identifier String */ 1735#define PCI_VPD_LTIN_ID_STRING 0x02 /* Identifier String */
@@ -1828,15 +1856,17 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,
1828 int (*fn)(struct pci_dev *pdev, 1856 int (*fn)(struct pci_dev *pdev,
1829 u16 alias, void *data), void *data); 1857 u16 alias, void *data), void *data);
1830 1858
1831/** 1859/* helper functions for operation of device flag */
1832 * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device 1860static inline void pci_set_dev_assigned(struct pci_dev *pdev)
1833 * @pdev: the PCI device 1861{
1834 * 1862 pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
1835 * if the device is PCIE, return NULL 1863}
1836 * if the device isn't connected to a PCIe bridge (that is its parent is a 1864static inline void pci_clear_dev_assigned(struct pci_dev *pdev)
1837 * legacy PCI bridge and the bridge is directly connected to bus 0), return its 1865{
1838 * parent 1866 pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
1839 */ 1867}
1840struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev); 1868static inline bool pci_is_dev_assigned(struct pci_dev *pdev)
1841 1869{
1870 return (pdev->dev_flags & PCI_DEV_FLAGS_ASSIGNED) == PCI_DEV_FLAGS_ASSIGNED;
1871}
1842#endif /* LINUX_PCI_H */ 1872#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 5f2e559af6b0..2706ee9a4327 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -187,6 +187,4 @@ static inline int pci_get_hp_params(struct pci_dev *dev,
187 return -ENODEV; 187 return -ENODEV;
188} 188}
189#endif 189#endif
190
191void pci_configure_slot(struct pci_dev *dev);
192#endif 190#endif
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 6ed0bb73a864..1fa99a301817 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2245,6 +2245,8 @@
2245#define PCI_VENDOR_ID_MORETON 0x15aa 2245#define PCI_VENDOR_ID_MORETON 0x15aa
2246#define PCI_DEVICE_ID_RASTEL_2PORT 0x2000 2246#define PCI_DEVICE_ID_RASTEL_2PORT 0x2000
2247 2247
2248#define PCI_VENDOR_ID_VMWARE 0x15ad
2249
2248#define PCI_VENDOR_ID_ZOLTRIX 0x15b0 2250#define PCI_VENDOR_ID_ZOLTRIX 0x15b0
2249#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0 2251#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0
2250 2252
@@ -2536,6 +2538,7 @@
2536#define PCI_DEVICE_ID_INTEL_EESSC 0x0008 2538#define PCI_DEVICE_ID_INTEL_EESSC 0x0008
2537#define PCI_DEVICE_ID_INTEL_SNB_IMC 0x0100 2539#define PCI_DEVICE_ID_INTEL_SNB_IMC 0x0100
2538#define PCI_DEVICE_ID_INTEL_IVB_IMC 0x0154 2540#define PCI_DEVICE_ID_INTEL_IVB_IMC 0x0154
2541#define PCI_DEVICE_ID_INTEL_IVB_E3_IMC 0x0150
2539#define PCI_DEVICE_ID_INTEL_HSW_IMC 0x0c00 2542#define PCI_DEVICE_ID_INTEL_HSW_IMC 0x0c00
2540#define PCI_DEVICE_ID_INTEL_PXHD_0 0x0320 2543#define PCI_DEVICE_ID_INTEL_PXHD_0 0x0320
2541#define PCI_DEVICE_ID_INTEL_PXHD_1 0x0321 2544#define PCI_DEVICE_ID_INTEL_PXHD_1 0x0321
@@ -2557,6 +2560,7 @@
2557#define PCI_DEVICE_ID_INTEL_MFD_EMMC0 0x0823 2560#define PCI_DEVICE_ID_INTEL_MFD_EMMC0 0x0823
2558#define PCI_DEVICE_ID_INTEL_MFD_EMMC1 0x0824 2561#define PCI_DEVICE_ID_INTEL_MFD_EMMC1 0x0824
2559#define PCI_DEVICE_ID_INTEL_MRST_SD2 0x084F 2562#define PCI_DEVICE_ID_INTEL_MRST_SD2 0x084F
2563#define PCI_DEVICE_ID_INTEL_QUARK_X1000_ILB 0x095E
2560#define PCI_DEVICE_ID_INTEL_I960 0x0960 2564#define PCI_DEVICE_ID_INTEL_I960 0x0960
2561#define PCI_DEVICE_ID_INTEL_I960RM 0x0962 2565#define PCI_DEVICE_ID_INTEL_I960RM 0x0962
2562#define PCI_DEVICE_ID_INTEL_CENTERTON_ILB 0x0c60 2566#define PCI_DEVICE_ID_INTEL_CENTERTON_ILB 0x0c60
@@ -2818,7 +2822,22 @@
2818#define PCI_DEVICE_ID_INTEL_UNC_R2PCIE 0x3c43 2822#define PCI_DEVICE_ID_INTEL_UNC_R2PCIE 0x3c43
2819#define PCI_DEVICE_ID_INTEL_UNC_R3QPI0 0x3c44 2823#define PCI_DEVICE_ID_INTEL_UNC_R3QPI0 0x3c44
2820#define PCI_DEVICE_ID_INTEL_UNC_R3QPI1 0x3c45 2824#define PCI_DEVICE_ID_INTEL_UNC_R3QPI1 0x3c45
2825#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_RAS 0x3c71 /* 15.1 */
2826#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_ERR0 0x3c72 /* 16.2 */
2827#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_ERR1 0x3c73 /* 16.3 */
2828#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_ERR2 0x3c76 /* 16.6 */
2829#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_ERR3 0x3c77 /* 16.7 */
2830#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_HA0 0x3ca0 /* 14.0 */
2831#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TA 0x3ca8 /* 15.0 */
2832#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD0 0x3caa /* 15.2 */
2833#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD1 0x3cab /* 15.3 */
2834#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD2 0x3cac /* 15.4 */
2835#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD3 0x3cad /* 15.5 */
2836#define PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_DDRIO 0x3cb8 /* 17.0 */
2821#define PCI_DEVICE_ID_INTEL_JAKETOWN_UBOX 0x3ce0 2837#define PCI_DEVICE_ID_INTEL_JAKETOWN_UBOX 0x3ce0
2838#define PCI_DEVICE_ID_INTEL_SBRIDGE_SAD0 0x3cf4 /* 12.6 */
2839#define PCI_DEVICE_ID_INTEL_SBRIDGE_BR 0x3cf5 /* 13.6 */
2840#define PCI_DEVICE_ID_INTEL_SBRIDGE_SAD1 0x3cf6 /* 12.7 */
2822#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2841#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2823#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 2842#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0
2824#define PCI_DEVICE_ID_INTEL_5100_19 0x65f3 2843#define PCI_DEVICE_ID_INTEL_5100_19 0x65f3
@@ -2860,6 +2879,7 @@
2860#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 2879#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601
2861#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119 2880#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119
2862#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a 2881#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a
2882#define PCI_DEVICE_ID_INTEL_E6XX_CU 0x8183
2863#define PCI_DEVICE_ID_INTEL_ITC_LPC 0x8186 2883#define PCI_DEVICE_ID_INTEL_ITC_LPC 0x8186
2864#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 2884#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4
2865#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 2885#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index cfd56046ecec..420032d41d27 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -257,9 +257,6 @@ do { \
257#define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var))) 257#define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var)))
258#define __get_cpu_var(var) (*this_cpu_ptr(&(var))) 258#define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
259 259
260/* keep until we have removed all uses of __this_cpu_ptr */
261#define __this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
262
263/* 260/*
264 * Must be an lvalue. Since @var must be a simple identifier, 261 * Must be an lvalue. Since @var must be a simple identifier,
265 * we force a syntax error here if it isn't. 262 * we force a syntax error here if it isn't.
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
index 652fd64cab5e..d5c89e0dd0e6 100644
--- a/include/linux/percpu-refcount.h
+++ b/include/linux/percpu-refcount.h
@@ -13,7 +13,7 @@
13 * 13 *
14 * The refcount will have a range of 0 to ((1U << 31) - 1), i.e. one bit less 14 * The refcount will have a range of 0 to ((1U << 31) - 1), i.e. one bit less
15 * than an atomic_t - this is because of the way shutdown works, see 15 * than an atomic_t - this is because of the way shutdown works, see
16 * percpu_ref_kill()/PCPU_COUNT_BIAS. 16 * percpu_ref_kill()/PERCPU_COUNT_BIAS.
17 * 17 *
18 * Before you call percpu_ref_kill(), percpu_ref_put() does not check for the 18 * Before you call percpu_ref_kill(), percpu_ref_put() does not check for the
19 * refcount hitting 0 - it can't, if it was in percpu mode. percpu_ref_kill() 19 * refcount hitting 0 - it can't, if it was in percpu mode. percpu_ref_kill()
@@ -49,28 +49,60 @@
49#include <linux/kernel.h> 49#include <linux/kernel.h>
50#include <linux/percpu.h> 50#include <linux/percpu.h>
51#include <linux/rcupdate.h> 51#include <linux/rcupdate.h>
52#include <linux/gfp.h>
52 53
53struct percpu_ref; 54struct percpu_ref;
54typedef void (percpu_ref_func_t)(struct percpu_ref *); 55typedef void (percpu_ref_func_t)(struct percpu_ref *);
55 56
57/* flags set in the lower bits of percpu_ref->percpu_count_ptr */
58enum {
59 __PERCPU_REF_ATOMIC = 1LU << 0, /* operating in atomic mode */
60 __PERCPU_REF_DEAD = 1LU << 1, /* (being) killed */
61 __PERCPU_REF_ATOMIC_DEAD = __PERCPU_REF_ATOMIC | __PERCPU_REF_DEAD,
62
63 __PERCPU_REF_FLAG_BITS = 2,
64};
65
66/* @flags for percpu_ref_init() */
67enum {
68 /*
69 * Start w/ ref == 1 in atomic mode. Can be switched to percpu
70 * operation using percpu_ref_switch_to_percpu(). If initialized
71 * with this flag, the ref will stay in atomic mode until
72 * percpu_ref_switch_to_percpu() is invoked on it.
73 */
74 PERCPU_REF_INIT_ATOMIC = 1 << 0,
75
76 /*
77 * Start dead w/ ref == 0 in atomic mode. Must be revived with
78 * percpu_ref_reinit() before used. Implies INIT_ATOMIC.
79 */
80 PERCPU_REF_INIT_DEAD = 1 << 1,
81};
82
56struct percpu_ref { 83struct percpu_ref {
57 atomic_t count; 84 atomic_long_t count;
58 /* 85 /*
59 * The low bit of the pointer indicates whether the ref is in percpu 86 * The low bit of the pointer indicates whether the ref is in percpu
60 * mode; if set, then get/put will manipulate the atomic_t. 87 * mode; if set, then get/put will manipulate the atomic_t.
61 */ 88 */
62 unsigned long pcpu_count_ptr; 89 unsigned long percpu_count_ptr;
63 percpu_ref_func_t *release; 90 percpu_ref_func_t *release;
64 percpu_ref_func_t *confirm_kill; 91 percpu_ref_func_t *confirm_switch;
92 bool force_atomic:1;
65 struct rcu_head rcu; 93 struct rcu_head rcu;
66}; 94};
67 95
68int __must_check percpu_ref_init(struct percpu_ref *ref, 96int __must_check percpu_ref_init(struct percpu_ref *ref,
69 percpu_ref_func_t *release); 97 percpu_ref_func_t *release, unsigned int flags,
70void percpu_ref_reinit(struct percpu_ref *ref); 98 gfp_t gfp);
71void percpu_ref_exit(struct percpu_ref *ref); 99void percpu_ref_exit(struct percpu_ref *ref);
100void percpu_ref_switch_to_atomic(struct percpu_ref *ref,
101 percpu_ref_func_t *confirm_switch);
102void percpu_ref_switch_to_percpu(struct percpu_ref *ref);
72void percpu_ref_kill_and_confirm(struct percpu_ref *ref, 103void percpu_ref_kill_and_confirm(struct percpu_ref *ref,
73 percpu_ref_func_t *confirm_kill); 104 percpu_ref_func_t *confirm_kill);
105void percpu_ref_reinit(struct percpu_ref *ref);
74 106
75/** 107/**
76 * percpu_ref_kill - drop the initial ref 108 * percpu_ref_kill - drop the initial ref
@@ -87,26 +119,24 @@ static inline void percpu_ref_kill(struct percpu_ref *ref)
87 return percpu_ref_kill_and_confirm(ref, NULL); 119 return percpu_ref_kill_and_confirm(ref, NULL);
88} 120}
89 121
90#define PCPU_REF_DEAD 1
91
92/* 122/*
93 * Internal helper. Don't use outside percpu-refcount proper. The 123 * Internal helper. Don't use outside percpu-refcount proper. The
94 * function doesn't return the pointer and let the caller test it for NULL 124 * function doesn't return the pointer and let the caller test it for NULL
95 * because doing so forces the compiler to generate two conditional 125 * because doing so forces the compiler to generate two conditional
96 * branches as it can't assume that @ref->pcpu_count is not NULL. 126 * branches as it can't assume that @ref->percpu_count is not NULL.
97 */ 127 */
98static inline bool __pcpu_ref_alive(struct percpu_ref *ref, 128static inline bool __ref_is_percpu(struct percpu_ref *ref,
99 unsigned __percpu **pcpu_countp) 129 unsigned long __percpu **percpu_countp)
100{ 130{
101 unsigned long pcpu_ptr = ACCESS_ONCE(ref->pcpu_count_ptr); 131 unsigned long percpu_ptr = ACCESS_ONCE(ref->percpu_count_ptr);
102 132
103 /* paired with smp_store_release() in percpu_ref_reinit() */ 133 /* paired with smp_store_release() in percpu_ref_reinit() */
104 smp_read_barrier_depends(); 134 smp_read_barrier_depends();
105 135
106 if (unlikely(pcpu_ptr & PCPU_REF_DEAD)) 136 if (unlikely(percpu_ptr & __PERCPU_REF_ATOMIC))
107 return false; 137 return false;
108 138
109 *pcpu_countp = (unsigned __percpu *)pcpu_ptr; 139 *percpu_countp = (unsigned long __percpu *)percpu_ptr;
110 return true; 140 return true;
111} 141}
112 142
@@ -114,18 +144,20 @@ static inline bool __pcpu_ref_alive(struct percpu_ref *ref,
114 * percpu_ref_get - increment a percpu refcount 144 * percpu_ref_get - increment a percpu refcount
115 * @ref: percpu_ref to get 145 * @ref: percpu_ref to get
116 * 146 *
117 * Analagous to atomic_inc(). 147 * Analagous to atomic_long_inc().
118 */ 148 *
149 * This function is safe to call as long as @ref is between init and exit.
150 */
119static inline void percpu_ref_get(struct percpu_ref *ref) 151static inline void percpu_ref_get(struct percpu_ref *ref)
120{ 152{
121 unsigned __percpu *pcpu_count; 153 unsigned long __percpu *percpu_count;
122 154
123 rcu_read_lock_sched(); 155 rcu_read_lock_sched();
124 156
125 if (__pcpu_ref_alive(ref, &pcpu_count)) 157 if (__ref_is_percpu(ref, &percpu_count))
126 this_cpu_inc(*pcpu_count); 158 this_cpu_inc(*percpu_count);
127 else 159 else
128 atomic_inc(&ref->count); 160 atomic_long_inc(&ref->count);
129 161
130 rcu_read_unlock_sched(); 162 rcu_read_unlock_sched();
131} 163}
@@ -137,20 +169,20 @@ static inline void percpu_ref_get(struct percpu_ref *ref)
137 * Increment a percpu refcount unless its count already reached zero. 169 * Increment a percpu refcount unless its count already reached zero.
138 * Returns %true on success; %false on failure. 170 * Returns %true on success; %false on failure.
139 * 171 *
140 * The caller is responsible for ensuring that @ref stays accessible. 172 * This function is safe to call as long as @ref is between init and exit.
141 */ 173 */
142static inline bool percpu_ref_tryget(struct percpu_ref *ref) 174static inline bool percpu_ref_tryget(struct percpu_ref *ref)
143{ 175{
144 unsigned __percpu *pcpu_count; 176 unsigned long __percpu *percpu_count;
145 int ret = false; 177 int ret;
146 178
147 rcu_read_lock_sched(); 179 rcu_read_lock_sched();
148 180
149 if (__pcpu_ref_alive(ref, &pcpu_count)) { 181 if (__ref_is_percpu(ref, &percpu_count)) {
150 this_cpu_inc(*pcpu_count); 182 this_cpu_inc(*percpu_count);
151 ret = true; 183 ret = true;
152 } else { 184 } else {
153 ret = atomic_inc_not_zero(&ref->count); 185 ret = atomic_long_inc_not_zero(&ref->count);
154 } 186 }
155 187
156 rcu_read_unlock_sched(); 188 rcu_read_unlock_sched();
@@ -165,23 +197,26 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref)
165 * Increment a percpu refcount unless it has already been killed. Returns 197 * Increment a percpu refcount unless it has already been killed. Returns
166 * %true on success; %false on failure. 198 * %true on success; %false on failure.
167 * 199 *
168 * Completion of percpu_ref_kill() in itself doesn't guarantee that tryget 200 * Completion of percpu_ref_kill() in itself doesn't guarantee that this
169 * will fail. For such guarantee, percpu_ref_kill_and_confirm() should be 201 * function will fail. For such guarantee, percpu_ref_kill_and_confirm()
170 * used. After the confirm_kill callback is invoked, it's guaranteed that 202 * should be used. After the confirm_kill callback is invoked, it's
171 * no new reference will be given out by percpu_ref_tryget(). 203 * guaranteed that no new reference will be given out by
204 * percpu_ref_tryget_live().
172 * 205 *
173 * The caller is responsible for ensuring that @ref stays accessible. 206 * This function is safe to call as long as @ref is between init and exit.
174 */ 207 */
175static inline bool percpu_ref_tryget_live(struct percpu_ref *ref) 208static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)
176{ 209{
177 unsigned __percpu *pcpu_count; 210 unsigned long __percpu *percpu_count;
178 int ret = false; 211 int ret = false;
179 212
180 rcu_read_lock_sched(); 213 rcu_read_lock_sched();
181 214
182 if (__pcpu_ref_alive(ref, &pcpu_count)) { 215 if (__ref_is_percpu(ref, &percpu_count)) {
183 this_cpu_inc(*pcpu_count); 216 this_cpu_inc(*percpu_count);
184 ret = true; 217 ret = true;
218 } else if (!(ACCESS_ONCE(ref->percpu_count_ptr) & __PERCPU_REF_DEAD)) {
219 ret = atomic_long_inc_not_zero(&ref->count);
185 } 220 }
186 221
187 rcu_read_unlock_sched(); 222 rcu_read_unlock_sched();
@@ -195,16 +230,18 @@ static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)
195 * 230 *
196 * Decrement the refcount, and if 0, call the release function (which was passed 231 * Decrement the refcount, and if 0, call the release function (which was passed
197 * to percpu_ref_init()) 232 * to percpu_ref_init())
233 *
234 * This function is safe to call as long as @ref is between init and exit.
198 */ 235 */
199static inline void percpu_ref_put(struct percpu_ref *ref) 236static inline void percpu_ref_put(struct percpu_ref *ref)
200{ 237{
201 unsigned __percpu *pcpu_count; 238 unsigned long __percpu *percpu_count;
202 239
203 rcu_read_lock_sched(); 240 rcu_read_lock_sched();
204 241
205 if (__pcpu_ref_alive(ref, &pcpu_count)) 242 if (__ref_is_percpu(ref, &percpu_count))
206 this_cpu_dec(*pcpu_count); 243 this_cpu_dec(*percpu_count);
207 else if (unlikely(atomic_dec_and_test(&ref->count))) 244 else if (unlikely(atomic_long_dec_and_test(&ref->count)))
208 ref->release(ref); 245 ref->release(ref);
209 246
210 rcu_read_unlock_sched(); 247 rcu_read_unlock_sched();
@@ -215,14 +252,16 @@ static inline void percpu_ref_put(struct percpu_ref *ref)
215 * @ref: percpu_ref to test 252 * @ref: percpu_ref to test
216 * 253 *
217 * Returns %true if @ref reached zero. 254 * Returns %true if @ref reached zero.
255 *
256 * This function is safe to call as long as @ref is between init and exit.
218 */ 257 */
219static inline bool percpu_ref_is_zero(struct percpu_ref *ref) 258static inline bool percpu_ref_is_zero(struct percpu_ref *ref)
220{ 259{
221 unsigned __percpu *pcpu_count; 260 unsigned long __percpu *percpu_count;
222 261
223 if (__pcpu_ref_alive(ref, &pcpu_count)) 262 if (__ref_is_percpu(ref, &percpu_count))
224 return false; 263 return false;
225 return !atomic_read(&ref->count); 264 return !atomic_long_read(&ref->count);
226} 265}
227 266
228#endif 267#endif
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 6f61b61b7996..a3aa63e47637 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -48,9 +48,9 @@
48 * intelligent way to determine this would be nice. 48 * intelligent way to determine this would be nice.
49 */ 49 */
50#if BITS_PER_LONG > 32 50#if BITS_PER_LONG > 32
51#define PERCPU_DYNAMIC_RESERVE (20 << 10) 51#define PERCPU_DYNAMIC_RESERVE (28 << 10)
52#else 52#else
53#define PERCPU_DYNAMIC_RESERVE (12 << 10) 53#define PERCPU_DYNAMIC_RESERVE (20 << 10)
54#endif 54#endif
55 55
56extern void *pcpu_base_addr; 56extern void *pcpu_base_addr;
@@ -122,11 +122,16 @@ extern void __init setup_per_cpu_areas(void);
122#endif 122#endif
123extern void __init percpu_init_late(void); 123extern void __init percpu_init_late(void);
124 124
125extern void __percpu *__alloc_percpu_gfp(size_t size, size_t align, gfp_t gfp);
125extern void __percpu *__alloc_percpu(size_t size, size_t align); 126extern void __percpu *__alloc_percpu(size_t size, size_t align);
126extern void free_percpu(void __percpu *__pdata); 127extern void free_percpu(void __percpu *__pdata);
127extern phys_addr_t per_cpu_ptr_to_phys(void *addr); 128extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
128 129
129#define alloc_percpu(type) \ 130#define alloc_percpu_gfp(type, gfp) \
130 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) 131 (typeof(type) __percpu *)__alloc_percpu_gfp(sizeof(type), \
132 __alignof__(type), gfp)
133#define alloc_percpu(type) \
134 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), \
135 __alignof__(type))
131 136
132#endif /* __LINUX_PERCPU_H */ 137#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index d5dd4657c8d6..50e50095c8d1 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -12,6 +12,7 @@
12#include <linux/threads.h> 12#include <linux/threads.h>
13#include <linux/percpu.h> 13#include <linux/percpu.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/gfp.h>
15 16
16#ifdef CONFIG_SMP 17#ifdef CONFIG_SMP
17 18
@@ -26,14 +27,14 @@ struct percpu_counter {
26 27
27extern int percpu_counter_batch; 28extern int percpu_counter_batch;
28 29
29int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, 30int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, gfp_t gfp,
30 struct lock_class_key *key); 31 struct lock_class_key *key);
31 32
32#define percpu_counter_init(fbc, value) \ 33#define percpu_counter_init(fbc, value, gfp) \
33 ({ \ 34 ({ \
34 static struct lock_class_key __key; \ 35 static struct lock_class_key __key; \
35 \ 36 \
36 __percpu_counter_init(fbc, value, &__key); \ 37 __percpu_counter_init(fbc, value, gfp, &__key); \
37 }) 38 })
38 39
39void percpu_counter_destroy(struct percpu_counter *fbc); 40void percpu_counter_destroy(struct percpu_counter *fbc);
@@ -89,7 +90,8 @@ struct percpu_counter {
89 s64 count; 90 s64 count;
90}; 91};
91 92
92static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount) 93static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount,
94 gfp_t gfp)
93{ 95{
94 fbc->count = amount; 96 fbc->count = amount;
95 return 0; 97 return 0;
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 707617a8c0f6..893a0d07986f 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -52,6 +52,7 @@ struct perf_guest_info_callbacks {
52#include <linux/atomic.h> 52#include <linux/atomic.h>
53#include <linux/sysfs.h> 53#include <linux/sysfs.h>
54#include <linux/perf_regs.h> 54#include <linux/perf_regs.h>
55#include <linux/workqueue.h>
55#include <asm/local.h> 56#include <asm/local.h>
56 57
57struct perf_callchain_entry { 58struct perf_callchain_entry {
@@ -268,6 +269,7 @@ struct pmu {
268 * enum perf_event_active_state - the states of a event 269 * enum perf_event_active_state - the states of a event
269 */ 270 */
270enum perf_event_active_state { 271enum perf_event_active_state {
272 PERF_EVENT_STATE_EXIT = -3,
271 PERF_EVENT_STATE_ERROR = -2, 273 PERF_EVENT_STATE_ERROR = -2,
272 PERF_EVENT_STATE_OFF = -1, 274 PERF_EVENT_STATE_OFF = -1,
273 PERF_EVENT_STATE_INACTIVE = 0, 275 PERF_EVENT_STATE_INACTIVE = 0,
@@ -507,6 +509,9 @@ struct perf_event_context {
507 int nr_cgroups; /* cgroup evts */ 509 int nr_cgroups; /* cgroup evts */
508 int nr_branch_stack; /* branch_stack evt */ 510 int nr_branch_stack; /* branch_stack evt */
509 struct rcu_head rcu_head; 511 struct rcu_head rcu_head;
512
513 struct delayed_work orphans_remove;
514 bool orphans_remove_sched;
510}; 515};
511 516
512/* 517/*
@@ -604,6 +609,13 @@ struct perf_sample_data {
604 u64 txn; 609 u64 txn;
605}; 610};
606 611
612/* default value for data source */
613#define PERF_MEM_NA (PERF_MEM_S(OP, NA) |\
614 PERF_MEM_S(LVL, NA) |\
615 PERF_MEM_S(SNOOP, NA) |\
616 PERF_MEM_S(LOCK, NA) |\
617 PERF_MEM_S(TLB, NA))
618
607static inline void perf_sample_data_init(struct perf_sample_data *data, 619static inline void perf_sample_data_init(struct perf_sample_data *data,
608 u64 addr, u64 period) 620 u64 addr, u64 period)
609{ 621{
@@ -616,7 +628,7 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
616 data->regs_user.regs = NULL; 628 data->regs_user.regs = NULL;
617 data->stack_user_size = 0; 629 data->stack_user_size = 0;
618 data->weight = 0; 630 data->weight = 0;
619 data->data_src.val = 0; 631 data->data_src.val = PERF_MEM_NA;
620 data->txn = 0; 632 data->txn = 0;
621} 633}
622 634
diff --git a/include/linux/phonedev.h b/include/linux/phonedev.h
deleted file mode 100644
index 4269de99e320..000000000000
--- a/include/linux/phonedev.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef __LINUX_PHONEDEV_H
2#define __LINUX_PHONEDEV_H
3
4#include <linux/types.h>
5
6#ifdef __KERNEL__
7
8#include <linux/poll.h>
9
10struct phone_device {
11 struct phone_device *next;
12 const struct file_operations *f_op;
13 int (*open) (struct phone_device *, struct file *);
14 int board; /* Device private index */
15 int minor;
16};
17
18extern int phonedev_init(void);
19#define PHONE_MAJOR 100
20extern int phone_register_device(struct phone_device *, int unit);
21#define PHONE_UNIT_ANY -1
22extern void phone_unregister_device(struct phone_device *);
23
24#endif
25#endif
diff --git a/include/linux/phy.h b/include/linux/phy.h
index ed39956b5613..d090cfcaa167 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -598,6 +598,19 @@ static inline int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)
598} 598}
599 599
600/** 600/**
601 * phy_read_mmd_indirect - reads data from the MMD registers
602 * @phydev: The PHY device bus
603 * @prtad: MMD Address
604 * @devad: MMD DEVAD
605 * @addr: PHY address on the MII bus
606 *
607 * Description: it reads data from the MMD registers (clause 22 to access to
608 * clause 45) of the specified phy address.
609 */
610int phy_read_mmd_indirect(struct phy_device *phydev, int prtad,
611 int devad, int addr);
612
613/**
601 * phy_read - Convenience function for reading a given PHY register 614 * phy_read - Convenience function for reading a given PHY register
602 * @phydev: the phy_device struct 615 * @phydev: the phy_device struct
603 * @regnum: register number to read 616 * @regnum: register number to read
@@ -668,6 +681,20 @@ static inline int phy_write_mmd(struct phy_device *phydev, int devad,
668 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 681 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
669} 682}
670 683
684/**
685 * phy_write_mmd_indirect - writes data to the MMD registers
686 * @phydev: The PHY device
687 * @prtad: MMD Address
688 * @devad: MMD DEVAD
689 * @addr: PHY address on the MII bus
690 * @data: data to write in the MMD register
691 *
692 * Description: Write data from the MMD registers of the specified
693 * phy address.
694 */
695void phy_write_mmd_indirect(struct phy_device *phydev, int prtad,
696 int devad, int addr, u32 data);
697
671struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, 698struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
672 bool is_c45, 699 bool is_c45,
673 struct phy_c45_device_ids *c45_ids); 700 struct phy_c45_device_ids *c45_ids);
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index ae612acebb53..f2ca1b459377 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -14,34 +14,35 @@ struct device_node;
14#ifdef CONFIG_FIXED_PHY 14#ifdef CONFIG_FIXED_PHY
15extern int fixed_phy_add(unsigned int irq, int phy_id, 15extern int fixed_phy_add(unsigned int irq, int phy_id,
16 struct fixed_phy_status *status); 16 struct fixed_phy_status *status);
17extern int fixed_phy_register(unsigned int irq, 17extern struct phy_device *fixed_phy_register(unsigned int irq,
18 struct fixed_phy_status *status, 18 struct fixed_phy_status *status,
19 struct device_node *np); 19 struct device_node *np);
20extern void fixed_phy_del(int phy_addr); 20extern void fixed_phy_del(int phy_addr);
21extern int fixed_phy_set_link_update(struct phy_device *phydev,
22 int (*link_update)(struct net_device *,
23 struct fixed_phy_status *));
21#else 24#else
22static inline int fixed_phy_add(unsigned int irq, int phy_id, 25static inline int fixed_phy_add(unsigned int irq, int phy_id,
23 struct fixed_phy_status *status) 26 struct fixed_phy_status *status)
24{ 27{
25 return -ENODEV; 28 return -ENODEV;
26} 29}
27static inline int fixed_phy_register(unsigned int irq, 30static inline struct phy_device *fixed_phy_register(unsigned int irq,
28 struct fixed_phy_status *status, 31 struct fixed_phy_status *status,
29 struct device_node *np) 32 struct device_node *np)
30{ 33{
31 return -ENODEV; 34 return ERR_PTR(-ENODEV);
32} 35}
33static inline int fixed_phy_del(int phy_addr) 36static inline int fixed_phy_del(int phy_addr)
34{ 37{
35 return -ENODEV; 38 return -ENODEV;
36} 39}
37#endif /* CONFIG_FIXED_PHY */ 40static inline int fixed_phy_set_link_update(struct phy_device *phydev,
38
39/*
40 * This function issued only by fixed_phy-aware drivers, no need
41 * protect it with #ifdef
42 */
43extern int fixed_phy_set_link_update(struct phy_device *phydev,
44 int (*link_update)(struct net_device *, 41 int (*link_update)(struct net_device *,
45 struct fixed_phy_status *)); 42 struct fixed_phy_status *))
43{
44 return -ENODEV;
45}
46#endif /* CONFIG_FIXED_PHY */
46 47
47#endif /* __PHY_FIXED_H */ 48#endif /* __PHY_FIXED_H */
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 7246ef3d4455..1997ffc295a7 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -33,6 +33,7 @@ struct pid_namespace {
33#ifdef CONFIG_PROC_FS 33#ifdef CONFIG_PROC_FS
34 struct vfsmount *proc_mnt; 34 struct vfsmount *proc_mnt;
35 struct dentry *proc_self; 35 struct dentry *proc_self;
36 struct dentry *proc_thread_self;
36#endif 37#endif
37#ifdef CONFIG_BSD_PROCESS_ACCT 38#ifdef CONFIG_BSD_PROCESS_ACCT
38 struct bsd_acct_struct *bacct; 39 struct bsd_acct_struct *bacct;
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index a15f10727eb8..d578a60eff23 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -57,7 +57,7 @@
57 * which are then pulled up with an external resistor. Setting this 57 * which are then pulled up with an external resistor. Setting this
58 * config will enable open drain mode, the argument is ignored. 58 * config will enable open drain mode, the argument is ignored.
59 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source 59 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source
60 * (open emitter). Setting this config will enable open drain mode, the 60 * (open emitter). Setting this config will enable open source mode, the
61 * argument is ignored. 61 * argument is ignored.
62 * @PIN_CONFIG_DRIVE_STRENGTH: the pin will sink or source at most the current 62 * @PIN_CONFIG_DRIVE_STRENGTH: the pin will sink or source at most the current
63 * passed as argument. The argument is in mA. 63 * passed as argument. The argument is in mA.
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index c15395031cb3..511bda9ed4bf 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -39,13 +39,12 @@ struct pinctrl_dev;
39 * name can be used with the generic @pinctrl_ops to retrieve the 39 * name can be used with the generic @pinctrl_ops to retrieve the
40 * actual pins affected. The applicable groups will be returned in 40 * actual pins affected. The applicable groups will be returned in
41 * @groups and the number of groups in @num_groups 41 * @groups and the number of groups in @num_groups
42 * @enable: enable a certain muxing function with a certain pin group. The 42 * @set_mux: enable a certain muxing function with a certain pin group. The
43 * driver does not need to figure out whether enabling this function 43 * driver does not need to figure out whether enabling this function
44 * conflicts some other use of the pins in that group, such collisions 44 * conflicts some other use of the pins in that group, such collisions
45 * are handled by the pinmux subsystem. The @func_selector selects a 45 * are handled by the pinmux subsystem. The @func_selector selects a
46 * certain function whereas @group_selector selects a certain set of pins 46 * certain function whereas @group_selector selects a certain set of pins
47 * to be used. On simple controllers the latter argument may be ignored 47 * to be used. On simple controllers the latter argument may be ignored
48 * @disable: disable a certain muxing selector with a certain pin group
49 * @gpio_request_enable: requests and enables GPIO on a certain pin. 48 * @gpio_request_enable: requests and enables GPIO on a certain pin.
50 * Implement this only if you can mux every pin individually as GPIO. The 49 * Implement this only if you can mux every pin individually as GPIO. The
51 * affected GPIO range is passed along with an offset(pin number) into that 50 * affected GPIO range is passed along with an offset(pin number) into that
@@ -68,10 +67,8 @@ struct pinmux_ops {
68 unsigned selector, 67 unsigned selector,
69 const char * const **groups, 68 const char * const **groups,
70 unsigned * const num_groups); 69 unsigned * const num_groups);
71 int (*enable) (struct pinctrl_dev *pctldev, unsigned func_selector, 70 int (*set_mux) (struct pinctrl_dev *pctldev, unsigned func_selector,
72 unsigned group_selector); 71 unsigned group_selector);
73 void (*disable) (struct pinctrl_dev *pctldev, unsigned func_selector,
74 unsigned group_selector);
75 int (*gpio_request_enable) (struct pinctrl_dev *pctldev, 72 int (*gpio_request_enable) (struct pinctrl_dev *pctldev,
76 struct pinctrl_gpio_range *range, 73 struct pinctrl_gpio_range *range,
77 unsigned offset); 74 unsigned offset);
diff --git a/include/linux/mailbox.h b/include/linux/pl320-ipc.h
index 5161f63ec1c8..5161f63ec1c8 100644
--- a/include/linux/mailbox.h
+++ b/include/linux/pl320-ipc.h
diff --git a/include/linux/platform_data/camera-mx1.h b/include/linux/platform_data/camera-mx1.h
deleted file mode 100644
index 4fd6c70314b4..000000000000
--- a/include/linux/platform_data/camera-mx1.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * mx1_camera.h - i.MX1/i.MXL camera driver header file
3 *
4 * Copyright (c) 2008, Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 * Copyright (C) 2009, Darius Augulis <augulis.darius@gmail.com>
6 *
7 * Based on PXA camera.h file:
8 * Copyright (C) 2003, Intel Corporation
9 * Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#ifndef __ASM_ARCH_CAMERA_H_
17#define __ASM_ARCH_CAMERA_H_
18
19#define MX1_CAMERA_DATA_HIGH 1
20#define MX1_CAMERA_PCLK_RISING 2
21#define MX1_CAMERA_VSYNC_HIGH 4
22
23extern unsigned char mx1_camera_sof_fiq_start, mx1_camera_sof_fiq_end;
24
25/**
26 * struct mx1_camera_pdata - i.MX1/i.MXL camera platform data
27 * @mclk_10khz: master clock frequency in 10kHz units
28 * @flags: MX1 camera platform flags
29 */
30struct mx1_camera_pdata {
31 unsigned long mclk_10khz;
32 unsigned long flags;
33};
34
35#endif /* __ASM_ARCH_CAMERA_H_ */
diff --git a/include/linux/platform_data/dma-dw.h b/include/linux/platform_data/dma-dw.h
new file mode 100644
index 000000000000..d8155c005242
--- /dev/null
+++ b/include/linux/platform_data/dma-dw.h
@@ -0,0 +1,59 @@
1/*
2 * Driver for the Synopsys DesignWare DMA Controller
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 * Copyright (C) 2010-2011 ST Microelectronics
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef _PLATFORM_DATA_DMA_DW_H
12#define _PLATFORM_DATA_DMA_DW_H
13
14#include <linux/device.h>
15
16/**
17 * struct dw_dma_slave - Controller-specific information about a slave
18 *
19 * @dma_dev: required DMA master device. Depricated.
20 * @src_id: src request line
21 * @dst_id: dst request line
22 * @src_master: src master for transfers on allocated channel.
23 * @dst_master: dest master for transfers on allocated channel.
24 */
25struct dw_dma_slave {
26 struct device *dma_dev;
27 u8 src_id;
28 u8 dst_id;
29 u8 src_master;
30 u8 dst_master;
31};
32
33/**
34 * struct dw_dma_platform_data - Controller configuration parameters
35 * @nr_channels: Number of channels supported by hardware (max 8)
36 * @is_private: The device channels should be marked as private and not for
37 * by the general purpose DMA channel allocator.
38 * @chan_allocation_order: Allocate channels starting from 0 or 7
39 * @chan_priority: Set channel priority increasing from 0 to 7 or 7 to 0.
40 * @block_size: Maximum block size supported by the controller
41 * @nr_masters: Number of AHB masters supported by the controller
42 * @data_width: Maximum data width supported by hardware per AHB master
43 * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
44 */
45struct dw_dma_platform_data {
46 unsigned int nr_channels;
47 bool is_private;
48#define CHAN_ALLOCATION_ASCENDING 0 /* zero to seven */
49#define CHAN_ALLOCATION_DESCENDING 1 /* seven to zero */
50 unsigned char chan_allocation_order;
51#define CHAN_PRIORITY_ASCENDING 0 /* chan0 highest */
52#define CHAN_PRIORITY_DESCENDING 1 /* chan7 highest */
53 unsigned char chan_priority;
54 unsigned short block_size;
55 unsigned char nr_masters;
56 unsigned char data_width[4];
57};
58
59#endif /* _PLATFORM_DATA_DMA_DW_H */
diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h
index d05542aafa3e..6a1357d31871 100644
--- a/include/linux/platform_data/dma-imx.h
+++ b/include/linux/platform_data/dma-imx.h
@@ -40,6 +40,7 @@ enum sdma_peripheral_type {
40 IMX_DMATYPE_ASRC, /* ASRC */ 40 IMX_DMATYPE_ASRC, /* ASRC */
41 IMX_DMATYPE_ESAI, /* ESAI */ 41 IMX_DMATYPE_ESAI, /* ESAI */
42 IMX_DMATYPE_SSI_DUAL, /* SSI Dual FIFO */ 42 IMX_DMATYPE_SSI_DUAL, /* SSI Dual FIFO */
43 IMX_DMATYPE_ASRC_SP, /* Shared ASRC */
43}; 44};
44 45
45enum imx_dma_prio { 46enum imx_dma_prio {
diff --git a/include/linux/platform_data/drv260x-pdata.h b/include/linux/platform_data/drv260x-pdata.h
new file mode 100644
index 000000000000..0a03b0944411
--- /dev/null
+++ b/include/linux/platform_data/drv260x-pdata.h
@@ -0,0 +1,28 @@
1/*
2 * Platform data for DRV260X haptics driver family
3 *
4 * Author: Dan Murphy <dmurphy@ti.com>
5 *
6 * Copyright: (C) 2014 Texas Instruments, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18#ifndef _LINUX_DRV260X_PDATA_H
19#define _LINUX_DRV260X_PDATA_H
20
21struct drv260x_platform_data {
22 u32 library_selection;
23 u32 mode;
24 u32 vib_rated_voltage;
25 u32 vib_overdrive_voltage;
26};
27
28#endif
diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h
index eb8d5627d080..bdb2710e2aab 100644
--- a/include/linux/platform_data/edma.h
+++ b/include/linux/platform_data/edma.h
@@ -150,6 +150,8 @@ void edma_clear_event(unsigned channel);
150void edma_pause(unsigned channel); 150void edma_pause(unsigned channel);
151void edma_resume(unsigned channel); 151void edma_resume(unsigned channel);
152 152
153void edma_assign_channel_eventq(unsigned channel, enum dma_event_q eventq_no);
154
153struct edma_rsv_info { 155struct edma_rsv_info {
154 156
155 const s16 (*rsv_chans)[2]; 157 const s16 (*rsv_chans)[2];
diff --git a/include/linux/platform_data/elm.h b/include/linux/platform_data/elm.h
index 780d1e97f620..b8686c00f15f 100644
--- a/include/linux/platform_data/elm.h
+++ b/include/linux/platform_data/elm.h
@@ -42,8 +42,24 @@ struct elm_errorvec {
42 int error_loc[16]; 42 int error_loc[16];
43}; 43};
44 44
45#if IS_ENABLED(CONFIG_MTD_NAND_OMAP_BCH)
45void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc, 46void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
46 struct elm_errorvec *err_vec); 47 struct elm_errorvec *err_vec);
47int elm_config(struct device *dev, enum bch_ecc bch_type, 48int elm_config(struct device *dev, enum bch_ecc bch_type,
48 int ecc_steps, int ecc_step_size, int ecc_syndrome_size); 49 int ecc_steps, int ecc_step_size, int ecc_syndrome_size);
50#else
51static inline void
52elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
53 struct elm_errorvec *err_vec)
54{
55}
56
57static inline int elm_config(struct device *dev, enum bch_ecc bch_type,
58 int ecc_steps, int ecc_step_size,
59 int ecc_syndrome_size)
60{
61 return -ENOSYS;
62}
63#endif /* CONFIG_MTD_NAND_ECC_BCH */
64
49#endif /* __ELM_H */ 65#endif /* __ELM_H */
diff --git a/include/linux/tegra-cpuidle.h b/include/linux/platform_data/gpio-dwapb.h
index 9c6286bbf662..28702c849af1 100644
--- a/include/linux/tegra-cpuidle.h
+++ b/include/linux/platform_data/gpio-dwapb.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. 2 * Copyright(c) 2014 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -11,15 +11,22 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#ifndef __LINUX_TEGRA_CPUIDLE_H__ 14#ifndef GPIO_DW_APB_H
15#define __LINUX_TEGRA_CPUIDLE_H__ 15#define GPIO_DW_APB_H
16 16
17#ifdef CONFIG_CPU_IDLE 17struct dwapb_port_property {
18void tegra_cpuidle_pcie_irqs_in_use(void); 18 struct device_node *node;
19#else 19 const char *name;
20static inline void tegra_cpuidle_pcie_irqs_in_use(void) 20 unsigned int idx;
21{ 21 unsigned int ngpio;
22} 22 unsigned int gpio_base;
23#endif 23 unsigned int irq;
24 bool irq_shared;
25};
26
27struct dwapb_platform_data {
28 struct dwapb_port_property *properties;
29 unsigned int nports;
30};
24 31
25#endif 32#endif
diff --git a/include/linux/tegra-ahb.h b/include/linux/platform_data/i2c-designware.h
index f1cd075ceee1..7a61fb27c25b 100644
--- a/include/linux/tegra-ahb.h
+++ b/include/linux/platform_data/i2c-designware.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. 2 * Copyright(c) 2014 Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -11,9 +11,11 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#ifndef __LINUX_AHB_H__ 14#ifndef I2C_DESIGNWARE_H
15#define __LINUX_AHB_H__ 15#define I2C_DESIGNWARE_H
16 16
17extern int tegra_ahb_enable_smmu(struct device_node *ahb); 17struct dw_i2c_platform_data {
18 unsigned int i2c_scl_freq;
19};
18 20
19#endif /* __LINUX_AHB_H__ */ 21#endif
diff --git a/include/linux/platform_data/isl9305.h b/include/linux/platform_data/isl9305.h
new file mode 100644
index 000000000000..1419133fa69e
--- /dev/null
+++ b/include/linux/platform_data/isl9305.h
@@ -0,0 +1,30 @@
1/*
2 * isl9305 - Intersil ISL9305 DCDC regulator
3 *
4 * Copyright 2014 Linaro Ltd
5 *
6 * Author: Mark Brown <broonie@kernel.org>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#ifndef __ISL9305_H
15#define __ISL9305_H
16
17#define ISL9305_DCD1 0
18#define ISL9305_DCD2 1
19#define ISL9305_LDO1 2
20#define ISL9305_LDO2 3
21
22#define ISL9305_MAX_REGULATOR ISL9305_LDO2
23
24struct regulator_init_data;
25
26struct isl9305_pdata {
27 struct regulator_init_data *init_data[ISL9305_MAX_REGULATOR];
28};
29
30#endif
diff --git a/include/linux/platform_data/mmc-omap.h b/include/linux/platform_data/mmc-omap.h
index 2bf1b30cb5dc..51e70cf25cbc 100644
--- a/include/linux/platform_data/mmc-omap.h
+++ b/include/linux/platform_data/mmc-omap.h
@@ -28,6 +28,7 @@
28 */ 28 */
29#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0) 29#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
30#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1) 30#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
31#define OMAP_HSMMC_SWAKEUP_MISSING BIT(2)
31 32
32struct mmc_card; 33struct mmc_card;
33 34
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
index 660c029d694f..090bbab0130a 100644
--- a/include/linux/platform_data/mtd-nand-omap2.h
+++ b/include/linux/platform_data/mtd-nand-omap2.h
@@ -21,8 +21,17 @@ enum nand_io {
21}; 21};
22 22
23enum omap_ecc { 23enum omap_ecc {
24 /* 1-bit ECC calculation by GPMC, Error detection by Software */ 24 /*
25 OMAP_ECC_HAM1_CODE_HW = 0, 25 * 1-bit ECC: calculation and correction by SW
26 * ECC stored at end of spare area
27 */
28 OMAP_ECC_HAM1_CODE_SW = 0,
29
30 /*
31 * 1-bit ECC: calculation by GPMC, Error detection by Software
32 * ECC layout compatible with ROM code layout
33 */
34 OMAP_ECC_HAM1_CODE_HW,
26 /* 4-bit ECC calculation by GPMC, Error detection by Software */ 35 /* 4-bit ECC calculation by GPMC, Error detection by Software */
27 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW, 36 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW,
28 /* 4-bit ECC calculation by GPMC, Error detection by ELM */ 37 /* 4-bit ECC calculation by GPMC, Error detection by ELM */
@@ -62,6 +71,7 @@ struct omap_nand_platform_data {
62 struct mtd_partition *parts; 71 struct mtd_partition *parts;
63 int nr_parts; 72 int nr_parts;
64 bool dev_ready; 73 bool dev_ready;
74 bool flash_bbt;
65 enum nand_io xfer_type; 75 enum nand_io xfer_type;
66 int devsize; 76 int devsize;
67 enum omap_ecc ecc_opt; 77 enum omap_ecc ecc_opt;
diff --git a/include/linux/platform_data/rcar-du.h b/include/linux/platform_data/rcar-du.h
index 1a2e9901a22e..a5f045e1d8fe 100644
--- a/include/linux/platform_data/rcar-du.h
+++ b/include/linux/platform_data/rcar-du.h
@@ -14,7 +14,7 @@
14#ifndef __RCAR_DU_H__ 14#ifndef __RCAR_DU_H__
15#define __RCAR_DU_H__ 15#define __RCAR_DU_H__
16 16
17#include <drm/drm_mode.h> 17#include <video/videomode.h>
18 18
19enum rcar_du_output { 19enum rcar_du_output {
20 RCAR_DU_OUTPUT_DPAD0, 20 RCAR_DU_OUTPUT_DPAD0,
@@ -35,7 +35,7 @@ enum rcar_du_encoder_type {
35struct rcar_du_panel_data { 35struct rcar_du_panel_data {
36 unsigned int width_mm; /* Panel width in mm */ 36 unsigned int width_mm; /* Panel width in mm */
37 unsigned int height_mm; /* Panel height in mm */ 37 unsigned int height_mm; /* Panel height in mm */
38 struct drm_mode_modeinfo mode; 38 struct videomode mode;
39}; 39};
40 40
41struct rcar_du_connector_lvds_data { 41struct rcar_du_connector_lvds_data {
diff --git a/include/linux/platform_data/samsung-usbphy.h b/include/linux/platform_data/samsung-usbphy.h
deleted file mode 100644
index 1bd24cba982b..000000000000
--- a/include/linux/platform_data/samsung-usbphy.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics Co.Ltd
3 * http://www.samsung.com/
4 * Author: Praveen Paneri <p.paneri@samsung.com>
5 *
6 * Defines platform data for samsung usb phy driver.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#ifndef __SAMSUNG_USBPHY_PLATFORM_H
15#define __SAMSUNG_USBPHY_PLATFORM_H
16
17/**
18 * samsung_usbphy_data - Platform data for USB PHY driver.
19 * @pmu_isolation: Function to control usb phy isolation in PMU.
20 */
21struct samsung_usbphy_data {
22 void (*pmu_isolation)(int on);
23};
24
25extern void samsung_usbphy_set_pdata(struct samsung_usbphy_data *pd);
26
27#endif /* __SAMSUNG_USBPHY_PLATFORM_H */
diff --git a/include/linux/platform_data/tegra_emc.h b/include/linux/platform_data/tegra_emc.h
deleted file mode 100644
index df67505e98f8..000000000000
--- a/include/linux/platform_data/tegra_emc.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * Copyright (C) 2011 Google, Inc.
3 *
4 * Author:
5 * Colin Cross <ccross@android.com>
6 * Olof Johansson <olof@lixom.net>
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#ifndef __TEGRA_EMC_H_
20#define __TEGRA_EMC_H_
21
22#define TEGRA_EMC_NUM_REGS 46
23
24struct tegra_emc_table {
25 unsigned long rate;
26 u32 regs[TEGRA_EMC_NUM_REGS];
27};
28
29struct tegra_emc_pdata {
30 int num_tables;
31 struct tegra_emc_table *tables;
32};
33
34#endif
diff --git a/include/linux/platform_data/usb-ehci-mxc.h b/include/linux/platform_data/usb-ehci-mxc.h
index 7eb9d1329671..157e71f79f99 100644
--- a/include/linux/platform_data/usb-ehci-mxc.h
+++ b/include/linux/platform_data/usb-ehci-mxc.h
@@ -1,46 +1,6 @@
1#ifndef __INCLUDE_ASM_ARCH_MXC_EHCI_H 1#ifndef __INCLUDE_ASM_ARCH_MXC_EHCI_H
2#define __INCLUDE_ASM_ARCH_MXC_EHCI_H 2#define __INCLUDE_ASM_ARCH_MXC_EHCI_H
3 3
4/* values for portsc field */
5#define MXC_EHCI_PHY_LOW_POWER_SUSPEND (1 << 23)
6#define MXC_EHCI_FORCE_FS (1 << 24)
7#define MXC_EHCI_UTMI_8BIT (0 << 28)
8#define MXC_EHCI_UTMI_16BIT (1 << 28)
9#define MXC_EHCI_SERIAL (1 << 29)
10#define MXC_EHCI_MODE_UTMI (0 << 30)
11#define MXC_EHCI_MODE_PHILIPS (1 << 30)
12#define MXC_EHCI_MODE_ULPI (2 << 30)
13#define MXC_EHCI_MODE_SERIAL (3 << 30)
14
15/* values for flags field */
16#define MXC_EHCI_INTERFACE_DIFF_UNI (0 << 0)
17#define MXC_EHCI_INTERFACE_DIFF_BI (1 << 0)
18#define MXC_EHCI_INTERFACE_SINGLE_UNI (2 << 0)
19#define MXC_EHCI_INTERFACE_SINGLE_BI (3 << 0)
20#define MXC_EHCI_INTERFACE_MASK (0xf)
21
22#define MXC_EHCI_POWER_PINS_ENABLED (1 << 5)
23#define MXC_EHCI_PWR_PIN_ACTIVE_HIGH (1 << 6)
24#define MXC_EHCI_OC_PIN_ACTIVE_LOW (1 << 7)
25#define MXC_EHCI_TTL_ENABLED (1 << 8)
26
27#define MXC_EHCI_INTERNAL_PHY (1 << 9)
28#define MXC_EHCI_IPPUE_DOWN (1 << 10)
29#define MXC_EHCI_IPPUE_UP (1 << 11)
30#define MXC_EHCI_WAKEUP_ENABLED (1 << 12)
31#define MXC_EHCI_ITC_NO_THRESHOLD (1 << 13)
32
33#define MXC_USBCTRL_OFFSET 0
34#define MXC_USB_PHY_CTR_FUNC_OFFSET 0x8
35#define MXC_USB_PHY_CTR_FUNC2_OFFSET 0xc
36#define MXC_USBH2CTRL_OFFSET 0x14
37
38#define MX5_USBOTHER_REGS_OFFSET 0x800
39
40/* USB_PHY_CTRL_FUNC2*/
41#define MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK 0x3
42#define MX5_USB_UTMI_PHYCTRL1_PLLDIV_SHIFT 0
43
44struct mxc_usbh_platform_data { 4struct mxc_usbh_platform_data {
45 int (*init)(struct platform_device *pdev); 5 int (*init)(struct platform_device *pdev);
46 int (*exit)(struct platform_device *pdev); 6 int (*exit)(struct platform_device *pdev);
@@ -49,11 +9,5 @@ struct mxc_usbh_platform_data {
49 struct usb_phy *otg; 9 struct usb_phy *otg;
50}; 10};
51 11
52int mx51_initialize_usb_hw(int port, unsigned int flags);
53int mx25_initialize_usb_hw(int port, unsigned int flags);
54int mx31_initialize_usb_hw(int port, unsigned int flags);
55int mx35_initialize_usb_hw(int port, unsigned int flags);
56int mx27_initialize_usb_hw(int port, unsigned int flags);
57
58#endif /* __INCLUDE_ASM_ARCH_MXC_EHCI_H */ 12#endif /* __INCLUDE_ASM_ARCH_MXC_EHCI_H */
59 13
diff --git a/include/linux/platform_data/usb-imx_udc.h b/include/linux/platform_data/usb-imx_udc.h
deleted file mode 100644
index be273371f34a..000000000000
--- a/include/linux/platform_data/usb-imx_udc.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * Copyright (C) 2008 Darius Augulis <augulis.darius@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __ASM_ARCH_MXC_USB
16#define __ASM_ARCH_MXC_USB
17
18struct imxusb_platform_data {
19 int (*init)(struct device *);
20 void (*exit)(struct device *);
21};
22
23#endif /* __ASM_ARCH_MXC_USB */
diff --git a/include/linux/platform_data/video-clcd-versatile.h b/include/linux/platform_data/video-clcd-versatile.h
new file mode 100644
index 000000000000..09ccf182af4d
--- /dev/null
+++ b/include/linux/platform_data/video-clcd-versatile.h
@@ -0,0 +1,27 @@
1#ifndef PLAT_CLCD_H
2#define PLAT_CLCD_H
3
4#ifdef CONFIG_PLAT_VERSATILE_CLCD
5struct clcd_panel *versatile_clcd_get_panel(const char *);
6int versatile_clcd_setup_dma(struct clcd_fb *, unsigned long);
7int versatile_clcd_mmap_dma(struct clcd_fb *, struct vm_area_struct *);
8void versatile_clcd_remove_dma(struct clcd_fb *);
9#else
10static inline struct clcd_panel *versatile_clcd_get_panel(const char *s)
11{
12 return NULL;
13}
14static inline int versatile_clcd_setup_dma(struct clcd_fb *fb, unsigned long framesize)
15{
16 return -ENODEV;
17}
18static inline int versatile_clcd_mmap_dma(struct clcd_fb *fb, struct vm_area_struct *vm)
19{
20 return -ENODEV;
21}
22static inline void versatile_clcd_remove_dma(struct clcd_fb *fb)
23{
24}
25#endif
26
27#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 72c0fe098a27..383fd68aaee1 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -619,6 +619,7 @@ extern int dev_pm_put_subsys_data(struct device *dev);
619 */ 619 */
620struct dev_pm_domain { 620struct dev_pm_domain {
621 struct dev_pm_ops ops; 621 struct dev_pm_ops ops;
622 void (*detach)(struct device *dev, bool power_off);
622}; 623};
623 624
624/* 625/*
@@ -679,12 +680,16 @@ struct dev_pm_domain {
679extern void device_pm_lock(void); 680extern void device_pm_lock(void);
680extern void dpm_resume_start(pm_message_t state); 681extern void dpm_resume_start(pm_message_t state);
681extern void dpm_resume_end(pm_message_t state); 682extern void dpm_resume_end(pm_message_t state);
683extern void dpm_resume_noirq(pm_message_t state);
684extern void dpm_resume_early(pm_message_t state);
682extern void dpm_resume(pm_message_t state); 685extern void dpm_resume(pm_message_t state);
683extern void dpm_complete(pm_message_t state); 686extern void dpm_complete(pm_message_t state);
684 687
685extern void device_pm_unlock(void); 688extern void device_pm_unlock(void);
686extern int dpm_suspend_end(pm_message_t state); 689extern int dpm_suspend_end(pm_message_t state);
687extern int dpm_suspend_start(pm_message_t state); 690extern int dpm_suspend_start(pm_message_t state);
691extern int dpm_suspend_noirq(pm_message_t state);
692extern int dpm_suspend_late(pm_message_t state);
688extern int dpm_suspend(pm_message_t state); 693extern int dpm_suspend(pm_message_t state);
689extern int dpm_prepare(pm_message_t state); 694extern int dpm_prepare(pm_message_t state);
690 695
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 7c1d252b20c0..2e0e06daf8c0 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -35,18 +35,10 @@ struct gpd_dev_ops {
35 int (*stop)(struct device *dev); 35 int (*stop)(struct device *dev);
36 int (*save_state)(struct device *dev); 36 int (*save_state)(struct device *dev);
37 int (*restore_state)(struct device *dev); 37 int (*restore_state)(struct device *dev);
38 int (*suspend)(struct device *dev);
39 int (*suspend_late)(struct device *dev);
40 int (*resume_early)(struct device *dev);
41 int (*resume)(struct device *dev);
42 int (*freeze)(struct device *dev);
43 int (*freeze_late)(struct device *dev);
44 int (*thaw_early)(struct device *dev);
45 int (*thaw)(struct device *dev);
46 bool (*active_wakeup)(struct device *dev); 38 bool (*active_wakeup)(struct device *dev);
47}; 39};
48 40
49struct gpd_cpu_data { 41struct gpd_cpuidle_data {
50 unsigned int saved_exit_latency; 42 unsigned int saved_exit_latency;
51 struct cpuidle_state *idle_state; 43 struct cpuidle_state *idle_state;
52}; 44};
@@ -60,7 +52,7 @@ struct generic_pm_domain {
60 struct mutex lock; 52 struct mutex lock;
61 struct dev_power_governor *gov; 53 struct dev_power_governor *gov;
62 struct work_struct power_off_work; 54 struct work_struct power_off_work;
63 char *name; 55 const char *name;
64 unsigned int in_progress; /* Number of devices being suspended now */ 56 unsigned int in_progress; /* Number of devices being suspended now */
65 atomic_t sd_count; /* Number of subdomains with power "on" */ 57 atomic_t sd_count; /* Number of subdomains with power "on" */
66 enum gpd_status status; /* Current state of the domain */ 58 enum gpd_status status; /* Current state of the domain */
@@ -71,7 +63,6 @@ struct generic_pm_domain {
71 unsigned int suspended_count; /* System suspend device counter */ 63 unsigned int suspended_count; /* System suspend device counter */
72 unsigned int prepared_count; /* Suspend counter of prepared devices */ 64 unsigned int prepared_count; /* Suspend counter of prepared devices */
73 bool suspend_power_off; /* Power status before system suspend */ 65 bool suspend_power_off; /* Power status before system suspend */
74 bool dev_irq_safe; /* Device callbacks are IRQ-safe */
75 int (*power_off)(struct generic_pm_domain *domain); 66 int (*power_off)(struct generic_pm_domain *domain);
76 s64 power_off_latency_ns; 67 s64 power_off_latency_ns;
77 int (*power_on)(struct generic_pm_domain *domain); 68 int (*power_on)(struct generic_pm_domain *domain);
@@ -80,8 +71,11 @@ struct generic_pm_domain {
80 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ 71 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
81 bool max_off_time_changed; 72 bool max_off_time_changed;
82 bool cached_power_down_ok; 73 bool cached_power_down_ok;
83 struct device_node *of_node; /* Node in device tree */ 74 struct gpd_cpuidle_data *cpuidle_data;
84 struct gpd_cpu_data *cpu_data; 75 int (*attach_dev)(struct generic_pm_domain *domain,
76 struct device *dev);
77 void (*detach_dev)(struct generic_pm_domain *domain,
78 struct device *dev);
85}; 79};
86 80
87static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) 81static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
@@ -108,12 +102,11 @@ struct gpd_timing_data {
108 102
109struct generic_pm_domain_data { 103struct generic_pm_domain_data {
110 struct pm_domain_data base; 104 struct pm_domain_data base;
111 struct gpd_dev_ops ops;
112 struct gpd_timing_data td; 105 struct gpd_timing_data td;
113 struct notifier_block nb; 106 struct notifier_block nb;
114 struct mutex lock; 107 struct mutex lock;
115 unsigned int refcount; 108 unsigned int refcount;
116 bool need_restore; 109 int need_restore;
117}; 110};
118 111
119#ifdef CONFIG_PM_GENERIC_DOMAINS 112#ifdef CONFIG_PM_GENERIC_DOMAINS
@@ -127,17 +120,11 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
127 return to_gpd_data(dev->power.subsys_data->domain_data); 120 return to_gpd_data(dev->power.subsys_data->domain_data);
128} 121}
129 122
130extern struct dev_power_governor simple_qos_governor;
131
132extern struct generic_pm_domain *dev_to_genpd(struct device *dev); 123extern struct generic_pm_domain *dev_to_genpd(struct device *dev);
133extern int __pm_genpd_add_device(struct generic_pm_domain *genpd, 124extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
134 struct device *dev, 125 struct device *dev,
135 struct gpd_timing_data *td); 126 struct gpd_timing_data *td);
136 127
137extern int __pm_genpd_of_add_device(struct device_node *genpd_node,
138 struct device *dev,
139 struct gpd_timing_data *td);
140
141extern int __pm_genpd_name_add_device(const char *domain_name, 128extern int __pm_genpd_name_add_device(const char *domain_name,
142 struct device *dev, 129 struct device *dev,
143 struct gpd_timing_data *td); 130 struct gpd_timing_data *td);
@@ -151,10 +138,6 @@ extern int pm_genpd_add_subdomain_names(const char *master_name,
151 const char *subdomain_name); 138 const char *subdomain_name);
152extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 139extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
153 struct generic_pm_domain *target); 140 struct generic_pm_domain *target);
154extern int pm_genpd_add_callbacks(struct device *dev,
155 struct gpd_dev_ops *ops,
156 struct gpd_timing_data *td);
157extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td);
158extern int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state); 141extern int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state);
159extern int pm_genpd_name_attach_cpuidle(const char *name, int state); 142extern int pm_genpd_name_attach_cpuidle(const char *name, int state);
160extern int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd); 143extern int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd);
@@ -165,8 +148,7 @@ extern void pm_genpd_init(struct generic_pm_domain *genpd,
165extern int pm_genpd_poweron(struct generic_pm_domain *genpd); 148extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
166extern int pm_genpd_name_poweron(const char *domain_name); 149extern int pm_genpd_name_poweron(const char *domain_name);
167 150
168extern bool default_stop_ok(struct device *dev); 151extern struct dev_power_governor simple_qos_governor;
169
170extern struct dev_power_governor pm_domain_always_on_gov; 152extern struct dev_power_governor pm_domain_always_on_gov;
171#else 153#else
172 154
@@ -184,12 +166,6 @@ static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
184{ 166{
185 return -ENOSYS; 167 return -ENOSYS;
186} 168}
187static inline int __pm_genpd_of_add_device(struct device_node *genpd_node,
188 struct device *dev,
189 struct gpd_timing_data *td)
190{
191 return -ENOSYS;
192}
193static inline int __pm_genpd_name_add_device(const char *domain_name, 169static inline int __pm_genpd_name_add_device(const char *domain_name,
194 struct device *dev, 170 struct device *dev,
195 struct gpd_timing_data *td) 171 struct gpd_timing_data *td)
@@ -217,16 +193,6 @@ static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
217{ 193{
218 return -ENOSYS; 194 return -ENOSYS;
219} 195}
220static inline int pm_genpd_add_callbacks(struct device *dev,
221 struct gpd_dev_ops *ops,
222 struct gpd_timing_data *td)
223{
224 return -ENOSYS;
225}
226static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td)
227{
228 return -ENOSYS;
229}
230static inline int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int st) 196static inline int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int st)
231{ 197{
232 return -ENOSYS; 198 return -ENOSYS;
@@ -255,10 +221,6 @@ static inline int pm_genpd_name_poweron(const char *domain_name)
255{ 221{
256 return -ENOSYS; 222 return -ENOSYS;
257} 223}
258static inline bool default_stop_ok(struct device *dev)
259{
260 return false;
261}
262#define simple_qos_governor NULL 224#define simple_qos_governor NULL
263#define pm_domain_always_on_gov NULL 225#define pm_domain_always_on_gov NULL
264#endif 226#endif
@@ -269,45 +231,87 @@ static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
269 return __pm_genpd_add_device(genpd, dev, NULL); 231 return __pm_genpd_add_device(genpd, dev, NULL);
270} 232}
271 233
272static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
273 struct device *dev)
274{
275 return __pm_genpd_of_add_device(genpd_node, dev, NULL);
276}
277
278static inline int pm_genpd_name_add_device(const char *domain_name, 234static inline int pm_genpd_name_add_device(const char *domain_name,
279 struct device *dev) 235 struct device *dev)
280{ 236{
281 return __pm_genpd_name_add_device(domain_name, dev, NULL); 237 return __pm_genpd_name_add_device(domain_name, dev, NULL);
282} 238}
283 239
284static inline int pm_genpd_remove_callbacks(struct device *dev)
285{
286 return __pm_genpd_remove_callbacks(dev, true);
287}
288
289#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME 240#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME
290extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd);
291extern void pm_genpd_poweroff_unused(void); 241extern void pm_genpd_poweroff_unused(void);
292#else 242#else
293static inline void genpd_queue_power_off_work(struct generic_pm_domain *gpd) {}
294static inline void pm_genpd_poweroff_unused(void) {} 243static inline void pm_genpd_poweroff_unused(void) {}
295#endif 244#endif
296 245
297#ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP 246#ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP
298extern void pm_genpd_syscore_switch(struct device *dev, bool suspend); 247extern void pm_genpd_syscore_poweroff(struct device *dev);
248extern void pm_genpd_syscore_poweron(struct device *dev);
299#else 249#else
300static inline void pm_genpd_syscore_switch(struct device *dev, bool suspend) {} 250static inline void pm_genpd_syscore_poweroff(struct device *dev) {}
251static inline void pm_genpd_syscore_poweron(struct device *dev) {}
301#endif 252#endif
302 253
303static inline void pm_genpd_syscore_poweroff(struct device *dev) 254/* OF PM domain providers */
255struct of_device_id;
256
257struct genpd_onecell_data {
258 struct generic_pm_domain **domains;
259 unsigned int num_domains;
260};
261
262typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
263 void *data);
264
265#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
266int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
267 void *data);
268void of_genpd_del_provider(struct device_node *np);
269
270struct generic_pm_domain *__of_genpd_xlate_simple(
271 struct of_phandle_args *genpdspec,
272 void *data);
273struct generic_pm_domain *__of_genpd_xlate_onecell(
274 struct of_phandle_args *genpdspec,
275 void *data);
276
277int genpd_dev_pm_attach(struct device *dev);
278#else /* !CONFIG_PM_GENERIC_DOMAINS_OF */
279static inline int __of_genpd_add_provider(struct device_node *np,
280 genpd_xlate_t xlate, void *data)
281{
282 return 0;
283}
284static inline void of_genpd_del_provider(struct device_node *np) {}
285
286#define __of_genpd_xlate_simple NULL
287#define __of_genpd_xlate_onecell NULL
288
289static inline int genpd_dev_pm_attach(struct device *dev)
290{
291 return -ENODEV;
292}
293#endif /* CONFIG_PM_GENERIC_DOMAINS_OF */
294
295static inline int of_genpd_add_provider_simple(struct device_node *np,
296 struct generic_pm_domain *genpd)
297{
298 return __of_genpd_add_provider(np, __of_genpd_xlate_simple, genpd);
299}
300static inline int of_genpd_add_provider_onecell(struct device_node *np,
301 struct genpd_onecell_data *data)
304{ 302{
305 pm_genpd_syscore_switch(dev, true); 303 return __of_genpd_add_provider(np, __of_genpd_xlate_onecell, data);
306} 304}
307 305
308static inline void pm_genpd_syscore_poweron(struct device *dev) 306#ifdef CONFIG_PM
307extern int dev_pm_domain_attach(struct device *dev, bool power_on);
308extern void dev_pm_domain_detach(struct device *dev, bool power_off);
309#else
310static inline int dev_pm_domain_attach(struct device *dev, bool power_on)
309{ 311{
310 pm_genpd_syscore_switch(dev, false); 312 return -ENODEV;
311} 313}
314static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {}
315#endif
312 316
313#endif /* _LINUX_PM_DOMAIN_H */ 317#endif /* _LINUX_PM_DOMAIN_H */
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 9ab4bf7c4646..636e82834506 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -15,6 +15,7 @@ enum {
15 PM_QOS_CPU_DMA_LATENCY, 15 PM_QOS_CPU_DMA_LATENCY,
16 PM_QOS_NETWORK_LATENCY, 16 PM_QOS_NETWORK_LATENCY,
17 PM_QOS_NETWORK_THROUGHPUT, 17 PM_QOS_NETWORK_THROUGHPUT,
18 PM_QOS_MEMORY_BANDWIDTH,
18 19
19 /* insert new class ID */ 20 /* insert new class ID */
20 PM_QOS_NUM_CLASSES, 21 PM_QOS_NUM_CLASSES,
@@ -32,6 +33,7 @@ enum pm_qos_flags_status {
32#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 33#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
33#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 34#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
34#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 35#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
36#define PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE 0
35#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0 37#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0
36#define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 38#define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0
37#define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) 39#define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1)
@@ -69,7 +71,8 @@ struct dev_pm_qos_request {
69enum pm_qos_type { 71enum pm_qos_type {
70 PM_QOS_UNITIALIZED, 72 PM_QOS_UNITIALIZED,
71 PM_QOS_MAX, /* return the largest value */ 73 PM_QOS_MAX, /* return the largest value */
72 PM_QOS_MIN /* return the smallest value */ 74 PM_QOS_MIN, /* return the smallest value */
75 PM_QOS_SUM /* return the sum */
73}; 76};
74 77
75/* 78/*
diff --git a/include/linux/pnfs_osd_xdr.h b/include/linux/pnfs_osd_xdr.h
index fe25876c1a5d..17d7d0d20eca 100644
--- a/include/linux/pnfs_osd_xdr.h
+++ b/include/linux/pnfs_osd_xdr.h
@@ -5,7 +5,7 @@
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Benny Halevy <bhalevy@panasas.com> 7 * Benny Halevy <bhalevy@panasas.com>
8 * Boaz Harrosh <bharrosh@panasas.com> 8 * Boaz Harrosh <ooo@electrozaur.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 11 * it under the terms of the GNU General Public License version 2
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h
index 07e7945a1ff2..e97fc656a058 100644
--- a/include/linux/power/charger-manager.h
+++ b/include/linux/power/charger-manager.h
@@ -253,9 +253,6 @@ struct charger_manager {
253 struct device *dev; 253 struct device *dev;
254 struct charger_desc *desc; 254 struct charger_desc *desc;
255 255
256 struct power_supply *fuel_gauge;
257 struct power_supply **charger_stat;
258
259#ifdef CONFIG_THERMAL 256#ifdef CONFIG_THERMAL
260 struct thermal_zone_device *tzd_batt; 257 struct thermal_zone_device *tzd_batt;
261#endif 258#endif
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index f3dea41dbcd2..096dbced02ac 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -18,8 +18,6 @@
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/notifier.h> 19#include <linux/notifier.h>
20 20
21struct device;
22
23/* 21/*
24 * All voltages, currents, charges, energies, time and temperatures in uV, 22 * All voltages, currents, charges, energies, time and temperatures in uV,
25 * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise 23 * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise
@@ -102,9 +100,11 @@ enum power_supply_property {
102 POWER_SUPPLY_PROP_VOLTAGE_NOW, 100 POWER_SUPPLY_PROP_VOLTAGE_NOW,
103 POWER_SUPPLY_PROP_VOLTAGE_AVG, 101 POWER_SUPPLY_PROP_VOLTAGE_AVG,
104 POWER_SUPPLY_PROP_VOLTAGE_OCV, 102 POWER_SUPPLY_PROP_VOLTAGE_OCV,
103 POWER_SUPPLY_PROP_VOLTAGE_BOOT,
105 POWER_SUPPLY_PROP_CURRENT_MAX, 104 POWER_SUPPLY_PROP_CURRENT_MAX,
106 POWER_SUPPLY_PROP_CURRENT_NOW, 105 POWER_SUPPLY_PROP_CURRENT_NOW,
107 POWER_SUPPLY_PROP_CURRENT_AVG, 106 POWER_SUPPLY_PROP_CURRENT_AVG,
107 POWER_SUPPLY_PROP_CURRENT_BOOT,
108 POWER_SUPPLY_PROP_POWER_NOW, 108 POWER_SUPPLY_PROP_POWER_NOW,
109 POWER_SUPPLY_PROP_POWER_AVG, 109 POWER_SUPPLY_PROP_POWER_AVG,
110 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, 110 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
@@ -146,6 +146,7 @@ enum power_supply_property {
146 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */ 146 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */
147 POWER_SUPPLY_PROP_SCOPE, 147 POWER_SUPPLY_PROP_SCOPE,
148 POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT, 148 POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
149 POWER_SUPPLY_PROP_CALIBRATE,
149 /* Properties of type `const char *' */ 150 /* Properties of type `const char *' */
150 POWER_SUPPLY_PROP_MODEL_NAME, 151 POWER_SUPPLY_PROP_MODEL_NAME,
151 POWER_SUPPLY_PROP_MANUFACTURER, 152 POWER_SUPPLY_PROP_MANUFACTURER,
@@ -172,6 +173,7 @@ union power_supply_propval {
172 const char *strval; 173 const char *strval;
173}; 174};
174 175
176struct device;
175struct device_node; 177struct device_node;
176 178
177struct power_supply { 179struct power_supply {
@@ -198,6 +200,12 @@ struct power_supply {
198 void (*external_power_changed)(struct power_supply *psy); 200 void (*external_power_changed)(struct power_supply *psy);
199 void (*set_charged)(struct power_supply *psy); 201 void (*set_charged)(struct power_supply *psy);
200 202
203 /*
204 * Set if thermal zone should not be created for this power supply.
205 * For example for virtual supplies forwarding calls to actual
206 * sensors or other supplies.
207 */
208 bool no_thermal;
201 /* For APM emulation, think legacy userspace. */ 209 /* For APM emulation, think legacy userspace. */
202 int use_for_apm; 210 int use_for_apm;
203 211
@@ -291,6 +299,7 @@ static inline bool power_supply_is_amp_property(enum power_supply_property psp)
291 case POWER_SUPPLY_PROP_CURRENT_MAX: 299 case POWER_SUPPLY_PROP_CURRENT_MAX:
292 case POWER_SUPPLY_PROP_CURRENT_NOW: 300 case POWER_SUPPLY_PROP_CURRENT_NOW:
293 case POWER_SUPPLY_PROP_CURRENT_AVG: 301 case POWER_SUPPLY_PROP_CURRENT_AVG:
302 case POWER_SUPPLY_PROP_CURRENT_BOOT:
294 return 1; 303 return 1;
295 default: 304 default:
296 break; 305 break;
@@ -315,6 +324,7 @@ static inline bool power_supply_is_watt_property(enum power_supply_property psp)
315 case POWER_SUPPLY_PROP_VOLTAGE_NOW: 324 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
316 case POWER_SUPPLY_PROP_VOLTAGE_AVG: 325 case POWER_SUPPLY_PROP_VOLTAGE_AVG:
317 case POWER_SUPPLY_PROP_VOLTAGE_OCV: 326 case POWER_SUPPLY_PROP_VOLTAGE_OCV:
327 case POWER_SUPPLY_PROP_VOLTAGE_BOOT:
318 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: 328 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
319 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX: 329 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
320 case POWER_SUPPLY_PROP_POWER_NOW: 330 case POWER_SUPPLY_PROP_POWER_NOW:
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 319ff7e53efb..d78125f73ac4 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -10,6 +10,9 @@
10extern const char linux_banner[]; 10extern const char linux_banner[];
11extern const char linux_proc_banner[]; 11extern const char linux_proc_banner[];
12 12
13extern char *log_buf_addr_get(void);
14extern u32 log_buf_len_get(void);
15
13static inline int printk_get_level(const char *buffer) 16static inline int printk_get_level(const char *buffer)
14{ 17{
15 if (buffer[0] == KERN_SOH_ASCII && buffer[1]) { 18 if (buffer[0] == KERN_SOH_ASCII && buffer[1]) {
@@ -31,7 +34,7 @@ static inline const char *printk_skip_level(const char *buffer)
31} 34}
32 35
33/* printk's without a loglevel use this.. */ 36/* printk's without a loglevel use this.. */
34#define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL 37#define MESSAGE_LOGLEVEL_DEFAULT CONFIG_MESSAGE_LOGLEVEL_DEFAULT
35 38
36/* We show everything that is MORE important than this.. */ 39/* We show everything that is MORE important than this.. */
37#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */ 40#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */
diff --git a/include/linux/prio_heap.h b/include/linux/prio_heap.h
deleted file mode 100644
index 08094350f26a..000000000000
--- a/include/linux/prio_heap.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _LINUX_PRIO_HEAP_H
2#define _LINUX_PRIO_HEAP_H
3
4/*
5 * Simple insertion-only static-sized priority heap containing
6 * pointers, based on CLR, chapter 7
7 */
8
9#include <linux/gfp.h>
10
11/**
12 * struct ptr_heap - simple static-sized priority heap
13 * @ptrs - pointer to data area
14 * @max - max number of elements that can be stored in @ptrs
15 * @size - current number of valid elements in @ptrs (in the range 0..@size-1
16 * @gt: comparison operator, which should implement "greater than"
17 */
18struct ptr_heap {
19 void **ptrs;
20 int max;
21 int size;
22 int (*gt)(void *, void *);
23};
24
25/**
26 * heap_init - initialize an empty heap with a given memory size
27 * @heap: the heap structure to be initialized
28 * @size: amount of memory to use in bytes
29 * @gfp_mask: mask to pass to kmalloc()
30 * @gt: comparison operator, which should implement "greater than"
31 */
32extern int heap_init(struct ptr_heap *heap, size_t size, gfp_t gfp_mask,
33 int (*gt)(void *, void *));
34
35/**
36 * heap_free - release a heap's storage
37 * @heap: the heap structure whose data should be released
38 */
39void heap_free(struct ptr_heap *heap);
40
41/**
42 * heap_insert - insert a value into the heap and return any overflowed value
43 * @heap: the heap to be operated on
44 * @p: the pointer to be inserted
45 *
46 * Attempts to insert the given value into the priority heap. If the
47 * heap is full prior to the insertion, then the resulting heap will
48 * consist of the smallest @max elements of the original heap and the
49 * new element; the greatest element will be removed from the heap and
50 * returned. Note that the returned element will be the new element
51 * (i.e. no change to the heap) if the new element is greater than all
52 * elements currently in the heap.
53 */
54extern void *heap_insert(struct ptr_heap *heap, void *p);
55
56
57
58#endif /* _LINUX_PRIO_HEAP_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 9d117f61d976..b97bf2ef996e 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -74,6 +74,8 @@ static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *p
74 74
75#endif /* CONFIG_PROC_FS */ 75#endif /* CONFIG_PROC_FS */
76 76
77struct net;
78
77static inline struct proc_dir_entry *proc_net_mkdir( 79static inline struct proc_dir_entry *proc_net_mkdir(
78 struct net *net, const char *name, struct proc_dir_entry *parent) 80 struct net *net, const char *name, struct proc_dir_entry *parent)
79{ 81{
diff --git a/include/linux/proportions.h b/include/linux/proportions.h
index 26a8a4ed9b07..00e8e8fa7358 100644
--- a/include/linux/proportions.h
+++ b/include/linux/proportions.h
@@ -12,6 +12,7 @@
12#include <linux/percpu_counter.h> 12#include <linux/percpu_counter.h>
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/mutex.h> 14#include <linux/mutex.h>
15#include <linux/gfp.h>
15 16
16struct prop_global { 17struct prop_global {
17 /* 18 /*
@@ -40,7 +41,7 @@ struct prop_descriptor {
40 struct mutex mutex; /* serialize the prop_global switch */ 41 struct mutex mutex; /* serialize the prop_global switch */
41}; 42};
42 43
43int prop_descriptor_init(struct prop_descriptor *pd, int shift); 44int prop_descriptor_init(struct prop_descriptor *pd, int shift, gfp_t gfp);
44void prop_change_shift(struct prop_descriptor *pd, int new_shift); 45void prop_change_shift(struct prop_descriptor *pd, int new_shift);
45 46
46/* 47/*
@@ -61,7 +62,7 @@ struct prop_local_percpu {
61 raw_spinlock_t lock; /* protect the snapshot state */ 62 raw_spinlock_t lock; /* protect the snapshot state */
62}; 63};
63 64
64int prop_local_init_percpu(struct prop_local_percpu *pl); 65int prop_local_init_percpu(struct prop_local_percpu *pl, gfp_t gfp);
65void prop_local_destroy_percpu(struct prop_local_percpu *pl); 66void prop_local_destroy_percpu(struct prop_local_percpu *pl);
66void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl); 67void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl);
67void prop_fraction_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl, 68void prop_fraction_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl,
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 0f3c5d38da1f..80d345a3524c 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -390,7 +390,6 @@ struct quota_info {
390 unsigned int flags; /* Flags for diskquotas on this device */ 390 unsigned int flags; /* Flags for diskquotas on this device */
391 struct mutex dqio_mutex; /* lock device while I/O in progress */ 391 struct mutex dqio_mutex; /* lock device while I/O in progress */
392 struct mutex dqonoff_mutex; /* Serialize quotaon & quotaoff */ 392 struct mutex dqonoff_mutex; /* Serialize quotaon & quotaoff */
393 struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */
394 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ 393 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */
395 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ 394 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
396 const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ 395 const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
diff --git a/include/linux/random.h b/include/linux/random.h
index 57fbbffd77a0..b05856e16b75 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -26,7 +26,7 @@ unsigned int get_random_int(void);
26unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len); 26unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
27 27
28u32 prandom_u32(void); 28u32 prandom_u32(void);
29void prandom_bytes(void *buf, int nbytes); 29void prandom_bytes(void *buf, size_t nbytes);
30void prandom_seed(u32 seed); 30void prandom_seed(u32 seed);
31void prandom_reseed_late(void); 31void prandom_reseed_late(void);
32 32
@@ -35,7 +35,7 @@ struct rnd_state {
35}; 35};
36 36
37u32 prandom_u32_state(struct rnd_state *state); 37u32 prandom_u32_state(struct rnd_state *state);
38void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes); 38void prandom_bytes_state(struct rnd_state *state, void *buf, size_t nbytes);
39 39
40/** 40/**
41 * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro) 41 * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro)
diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h
index fea49b5da12a..378c5ee75f78 100644
--- a/include/linux/rbtree_augmented.h
+++ b/include/linux/rbtree_augmented.h
@@ -43,6 +43,16 @@ struct rb_augment_callbacks {
43 43
44extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root, 44extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root,
45 void (*augment_rotate)(struct rb_node *old, struct rb_node *new)); 45 void (*augment_rotate)(struct rb_node *old, struct rb_node *new));
46/*
47 * Fixup the rbtree and update the augmented information when rebalancing.
48 *
49 * On insertion, the user must update the augmented information on the path
50 * leading to the inserted node, then call rb_link_node() as usual and
51 * rb_augment_inserted() instead of the usual rb_insert_color() call.
52 * If rb_augment_inserted() rebalances the rbtree, it will callback into
53 * a user provided function to update the augmented information on the
54 * affected subtrees.
55 */
46static inline void 56static inline void
47rb_insert_augmented(struct rb_node *node, struct rb_root *root, 57rb_insert_augmented(struct rb_node *node, struct rb_root *root,
48 const struct rb_augment_callbacks *augment) 58 const struct rb_augment_callbacks *augment)
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 8183b46fbaa2..372ad5e0dcb8 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -432,9 +432,9 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
432} 432}
433 433
434/** 434/**
435 * hlist_add_after_rcu 435 * hlist_add_behind_rcu
436 * @prev: the existing element to add the new element after.
437 * @n: the new element to add to the hash list. 436 * @n: the new element to add to the hash list.
437 * @prev: the existing element to add the new element after.
438 * 438 *
439 * Description: 439 * Description:
440 * Adds the specified element to the specified hlist 440 * Adds the specified element to the specified hlist
@@ -449,8 +449,8 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
449 * hlist_for_each_entry_rcu(), used to prevent memory-consistency 449 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
450 * problems on Alpha CPUs. 450 * problems on Alpha CPUs.
451 */ 451 */
452static inline void hlist_add_after_rcu(struct hlist_node *prev, 452static inline void hlist_add_behind_rcu(struct hlist_node *n,
453 struct hlist_node *n) 453 struct hlist_node *prev)
454{ 454{
455 n->next = prev->next; 455 n->next = prev->next;
456 n->pprev = &prev->next; 456 n->pprev = &prev->next;
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index d231aa17b1d7..53ff1a752d7e 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -47,14 +47,12 @@
47#include <asm/barrier.h> 47#include <asm/barrier.h>
48 48
49extern int rcu_expedited; /* for sysctl */ 49extern int rcu_expedited; /* for sysctl */
50#ifdef CONFIG_RCU_TORTURE_TEST
51extern int rcutorture_runnable; /* for sysctl */
52#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
53 50
54enum rcutorture_type { 51enum rcutorture_type {
55 RCU_FLAVOR, 52 RCU_FLAVOR,
56 RCU_BH_FLAVOR, 53 RCU_BH_FLAVOR,
57 RCU_SCHED_FLAVOR, 54 RCU_SCHED_FLAVOR,
55 RCU_TASKS_FLAVOR,
58 SRCU_FLAVOR, 56 SRCU_FLAVOR,
59 INVALID_RCU_FLAVOR 57 INVALID_RCU_FLAVOR
60}; 58};
@@ -197,6 +195,28 @@ void call_rcu_sched(struct rcu_head *head,
197 195
198void synchronize_sched(void); 196void synchronize_sched(void);
199 197
198/**
199 * call_rcu_tasks() - Queue an RCU for invocation task-based grace period
200 * @head: structure to be used for queueing the RCU updates.
201 * @func: actual callback function to be invoked after the grace period
202 *
203 * The callback function will be invoked some time after a full grace
204 * period elapses, in other words after all currently executing RCU
205 * read-side critical sections have completed. call_rcu_tasks() assumes
206 * that the read-side critical sections end at a voluntary context
207 * switch (not a preemption!), entry into idle, or transition to usermode
208 * execution. As such, there are no read-side primitives analogous to
209 * rcu_read_lock() and rcu_read_unlock() because this primitive is intended
210 * to determine that all tasks have passed through a safe state, not so
211 * much for data-strcuture synchronization.
212 *
213 * See the description of call_rcu() for more detailed information on
214 * memory ordering guarantees.
215 */
216void call_rcu_tasks(struct rcu_head *head, void (*func)(struct rcu_head *head));
217void synchronize_rcu_tasks(void);
218void rcu_barrier_tasks(void);
219
200#ifdef CONFIG_PREEMPT_RCU 220#ifdef CONFIG_PREEMPT_RCU
201 221
202void __rcu_read_lock(void); 222void __rcu_read_lock(void);
@@ -238,8 +258,8 @@ static inline int rcu_preempt_depth(void)
238 258
239/* Internal to kernel */ 259/* Internal to kernel */
240void rcu_init(void); 260void rcu_init(void);
241void rcu_sched_qs(int cpu); 261void rcu_sched_qs(void);
242void rcu_bh_qs(int cpu); 262void rcu_bh_qs(void);
243void rcu_check_callbacks(int cpu, int user); 263void rcu_check_callbacks(int cpu, int user);
244struct notifier_block; 264struct notifier_block;
245void rcu_idle_enter(void); 265void rcu_idle_enter(void);
@@ -269,6 +289,14 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
269 struct task_struct *next) { } 289 struct task_struct *next) { }
270#endif /* CONFIG_RCU_USER_QS */ 290#endif /* CONFIG_RCU_USER_QS */
271 291
292#ifdef CONFIG_RCU_NOCB_CPU
293void rcu_init_nohz(void);
294#else /* #ifdef CONFIG_RCU_NOCB_CPU */
295static inline void rcu_init_nohz(void)
296{
297}
298#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
299
272/** 300/**
273 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers 301 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers
274 * @a: Code that RCU needs to pay attention to. 302 * @a: Code that RCU needs to pay attention to.
@@ -294,6 +322,36 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
294 rcu_irq_exit(); \ 322 rcu_irq_exit(); \
295 } while (0) 323 } while (0)
296 324
325/*
326 * Note a voluntary context switch for RCU-tasks benefit. This is a
327 * macro rather than an inline function to avoid #include hell.
328 */
329#ifdef CONFIG_TASKS_RCU
330#define TASKS_RCU(x) x
331extern struct srcu_struct tasks_rcu_exit_srcu;
332#define rcu_note_voluntary_context_switch(t) \
333 do { \
334 if (ACCESS_ONCE((t)->rcu_tasks_holdout)) \
335 ACCESS_ONCE((t)->rcu_tasks_holdout) = false; \
336 } while (0)
337#else /* #ifdef CONFIG_TASKS_RCU */
338#define TASKS_RCU(x) do { } while (0)
339#define rcu_note_voluntary_context_switch(t) do { } while (0)
340#endif /* #else #ifdef CONFIG_TASKS_RCU */
341
342/**
343 * cond_resched_rcu_qs - Report potential quiescent states to RCU
344 *
345 * This macro resembles cond_resched(), except that it is defined to
346 * report potential quiescent states to RCU-tasks even if the cond_resched()
347 * machinery were to be shut off, as some advocate for PREEMPT kernels.
348 */
349#define cond_resched_rcu_qs() \
350do { \
351 rcu_note_voluntary_context_switch(current); \
352 cond_resched(); \
353} while (0)
354
297#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) 355#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP)
298bool __rcu_is_watching(void); 356bool __rcu_is_watching(void);
299#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */ 357#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
@@ -349,7 +407,7 @@ bool rcu_lockdep_current_cpu_online(void);
349#else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ 407#else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
350static inline bool rcu_lockdep_current_cpu_online(void) 408static inline bool rcu_lockdep_current_cpu_online(void)
351{ 409{
352 return 1; 410 return true;
353} 411}
354#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ 412#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
355 413
@@ -371,41 +429,7 @@ extern struct lockdep_map rcu_sched_lock_map;
371extern struct lockdep_map rcu_callback_map; 429extern struct lockdep_map rcu_callback_map;
372int debug_lockdep_rcu_enabled(void); 430int debug_lockdep_rcu_enabled(void);
373 431
374/** 432int rcu_read_lock_held(void);
375 * rcu_read_lock_held() - might we be in RCU read-side critical section?
376 *
377 * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU
378 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC,
379 * this assumes we are in an RCU read-side critical section unless it can
380 * prove otherwise. This is useful for debug checks in functions that
381 * require that they be called within an RCU read-side critical section.
382 *
383 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
384 * and while lockdep is disabled.
385 *
386 * Note that rcu_read_lock() and the matching rcu_read_unlock() must
387 * occur in the same context, for example, it is illegal to invoke
388 * rcu_read_unlock() in process context if the matching rcu_read_lock()
389 * was invoked from within an irq handler.
390 *
391 * Note that rcu_read_lock() is disallowed if the CPU is either idle or
392 * offline from an RCU perspective, so check for those as well.
393 */
394static inline int rcu_read_lock_held(void)
395{
396 if (!debug_lockdep_rcu_enabled())
397 return 1;
398 if (!rcu_is_watching())
399 return 0;
400 if (!rcu_lockdep_current_cpu_online())
401 return 0;
402 return lock_is_held(&rcu_lock_map);
403}
404
405/*
406 * rcu_read_lock_bh_held() is defined out of line to avoid #include-file
407 * hell.
408 */
409int rcu_read_lock_bh_held(void); 433int rcu_read_lock_bh_held(void);
410 434
411/** 435/**
@@ -593,6 +617,21 @@ static inline void rcu_preempt_sleep_check(void)
593#define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v) 617#define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v)
594 618
595/** 619/**
620 * lockless_dereference() - safely load a pointer for later dereference
621 * @p: The pointer to load
622 *
623 * Similar to rcu_dereference(), but for situations where the pointed-to
624 * object's lifetime is managed by something other than RCU. That
625 * "something other" might be reference counting or simple immortality.
626 */
627#define lockless_dereference(p) \
628({ \
629 typeof(p) _________p1 = ACCESS_ONCE(p); \
630 smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
631 (_________p1); \
632})
633
634/**
596 * rcu_assign_pointer() - assign to RCU-protected pointer 635 * rcu_assign_pointer() - assign to RCU-protected pointer
597 * @p: pointer to assign to 636 * @p: pointer to assign to
598 * @v: value to assign (publish) 637 * @v: value to assign (publish)
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index d40a6a451330..38cc5b1e252d 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -80,7 +80,7 @@ static inline void kfree_call_rcu(struct rcu_head *head,
80 80
81static inline void rcu_note_context_switch(int cpu) 81static inline void rcu_note_context_switch(int cpu)
82{ 82{
83 rcu_sched_qs(cpu); 83 rcu_sched_qs();
84} 84}
85 85
86/* 86/*
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 48bf152761c7..67fc8fcdc4b0 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -38,6 +38,9 @@ extern int reboot_force;
38extern int register_reboot_notifier(struct notifier_block *); 38extern int register_reboot_notifier(struct notifier_block *);
39extern int unregister_reboot_notifier(struct notifier_block *); 39extern int unregister_reboot_notifier(struct notifier_block *);
40 40
41extern int register_restart_handler(struct notifier_block *);
42extern int unregister_restart_handler(struct notifier_block *);
43extern void do_kernel_restart(char *cmd);
41 44
42/* 45/*
43 * Architecture-specific implementations of sys_reboot commands. 46 * Architecture-specific implementations of sys_reboot commands.
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index f8a8733068a7..f540b1496e2f 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -35,6 +35,8 @@
35#ifndef __LINUX_REGULATOR_CONSUMER_H_ 35#ifndef __LINUX_REGULATOR_CONSUMER_H_
36#define __LINUX_REGULATOR_CONSUMER_H_ 36#define __LINUX_REGULATOR_CONSUMER_H_
37 37
38#include <linux/err.h>
39
38struct device; 40struct device;
39struct notifier_block; 41struct notifier_block;
40struct regmap; 42struct regmap;
@@ -93,7 +95,12 @@ struct regmap;
93 * OVER_TEMP Regulator over temp. 95 * OVER_TEMP Regulator over temp.
94 * FORCE_DISABLE Regulator forcibly shut down by software. 96 * FORCE_DISABLE Regulator forcibly shut down by software.
95 * VOLTAGE_CHANGE Regulator voltage changed. 97 * VOLTAGE_CHANGE Regulator voltage changed.
98 * Data passed is old voltage cast to (void *).
96 * DISABLE Regulator was disabled. 99 * DISABLE Regulator was disabled.
100 * PRE_VOLTAGE_CHANGE Regulator is about to have voltage changed.
101 * Data passed is "struct pre_voltage_change_data"
102 * ABORT_VOLTAGE_CHANGE Regulator voltage change failed for some reason.
103 * Data passed is old voltage cast to (void *).
97 * 104 *
98 * NOTE: These events can be OR'ed together when passed into handler. 105 * NOTE: These events can be OR'ed together when passed into handler.
99 */ 106 */
@@ -106,6 +113,21 @@ struct regmap;
106#define REGULATOR_EVENT_FORCE_DISABLE 0x20 113#define REGULATOR_EVENT_FORCE_DISABLE 0x20
107#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40 114#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40
108#define REGULATOR_EVENT_DISABLE 0x80 115#define REGULATOR_EVENT_DISABLE 0x80
116#define REGULATOR_EVENT_PRE_VOLTAGE_CHANGE 0x100
117#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x200
118
119/**
120 * struct pre_voltage_change_data - Data sent with PRE_VOLTAGE_CHANGE event
121 *
122 * @old_uV: Current voltage before change.
123 * @min_uV: Min voltage we'll change to.
124 * @max_uV: Max voltage we'll change to.
125 */
126struct pre_voltage_change_data {
127 unsigned long old_uV;
128 unsigned long min_uV;
129 unsigned long max_uV;
130};
109 131
110struct regulator; 132struct regulator;
111 133
diff --git a/include/linux/regulator/da9211.h b/include/linux/regulator/da9211.h
index 0981ce0e72cc..5479394fefce 100644
--- a/include/linux/regulator/da9211.h
+++ b/include/linux/regulator/da9211.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * da9211.h - Regulator device driver for DA9211 2 * da9211.h - Regulator device driver for DA9211/DA9213
3 * Copyright (C) 2014 Dialog Semiconductor Ltd. 3 * Copyright (C) 2014 Dialog Semiconductor Ltd.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
@@ -20,6 +20,11 @@
20 20
21#define DA9211_MAX_REGULATORS 2 21#define DA9211_MAX_REGULATORS 2
22 22
23enum da9211_chip_id {
24 DA9211,
25 DA9213,
26};
27
23struct da9211_pdata { 28struct da9211_pdata {
24 /* 29 /*
25 * Number of buck 30 * Number of buck
@@ -27,6 +32,6 @@ struct da9211_pdata {
27 * 2 : 2 phase 2 buck 32 * 2 : 2 phase 2 buck
28 */ 33 */
29 int num_buck; 34 int num_buck;
30 struct regulator_init_data *init_data; 35 struct regulator_init_data *init_data[DA9211_MAX_REGULATORS];
31}; 36};
32#endif 37#endif
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index bbe03a1924c0..fc0ee0ce8325 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -203,6 +203,8 @@ enum regulator_type {
203 * 203 *
204 * @name: Identifying name for the regulator. 204 * @name: Identifying name for the regulator.
205 * @supply_name: Identifying the regulator supply 205 * @supply_name: Identifying the regulator supply
206 * @of_match: Name used to identify regulator in DT.
207 * @regulators_node: Name of node containing regulator definitions in DT.
206 * @id: Numerical identifier for the regulator. 208 * @id: Numerical identifier for the regulator.
207 * @ops: Regulator operations table. 209 * @ops: Regulator operations table.
208 * @irq: Interrupt number for the regulator. 210 * @irq: Interrupt number for the regulator.
@@ -218,6 +220,8 @@ enum regulator_type {
218 * @linear_min_sel: Minimal selector for starting linear mapping 220 * @linear_min_sel: Minimal selector for starting linear mapping
219 * @fixed_uV: Fixed voltage of rails. 221 * @fixed_uV: Fixed voltage of rails.
220 * @ramp_delay: Time to settle down after voltage change (unit: uV/us) 222 * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
223 * @linear_ranges: A constant table of possible voltage ranges.
224 * @n_linear_ranges: Number of entries in the @linear_ranges table.
221 * @volt_table: Voltage mapping table (if table based mapping) 225 * @volt_table: Voltage mapping table (if table based mapping)
222 * 226 *
223 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ 227 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
@@ -238,14 +242,17 @@ enum regulator_type {
238 * @bypass_val_off: Disabling value for control when using regmap set_bypass 242 * @bypass_val_off: Disabling value for control when using regmap set_bypass
239 * 243 *
240 * @enable_time: Time taken for initial enable of regulator (in uS). 244 * @enable_time: Time taken for initial enable of regulator (in uS).
245 * @off_on_delay: guard time (in uS), before re-enabling a regulator
241 */ 246 */
242struct regulator_desc { 247struct regulator_desc {
243 const char *name; 248 const char *name;
244 const char *supply_name; 249 const char *supply_name;
250 const char *of_match;
251 const char *regulators_node;
245 int id; 252 int id;
246 bool continuous_voltage_range; 253 bool continuous_voltage_range;
247 unsigned n_voltages; 254 unsigned n_voltages;
248 struct regulator_ops *ops; 255 const struct regulator_ops *ops;
249 int irq; 256 int irq;
250 enum regulator_type type; 257 enum regulator_type type;
251 struct module *owner; 258 struct module *owner;
@@ -276,6 +283,8 @@ struct regulator_desc {
276 unsigned int bypass_val_off; 283 unsigned int bypass_val_off;
277 284
278 unsigned int enable_time; 285 unsigned int enable_time;
286
287 unsigned int off_on_delay;
279}; 288};
280 289
281/** 290/**
@@ -348,6 +357,9 @@ struct regulator_dev {
348 357
349 struct regulator_enable_gpio *ena_pin; 358 struct regulator_enable_gpio *ena_pin;
350 unsigned int ena_gpio_state:1; 359 unsigned int ena_gpio_state:1;
360
361 /* time when this regulator was disabled last time */
362 unsigned long last_off_jiffy;
351}; 363};
352 364
353struct regulator_dev * 365struct regulator_dev *
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 730e638c5589..0b08d05d470b 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -85,6 +85,7 @@ struct regulator_state {
85 * bootloader then it will be enabled when the constraints are 85 * bootloader then it will be enabled when the constraints are
86 * applied. 86 * applied.
87 * @apply_uV: Apply the voltage constraint when initialising. 87 * @apply_uV: Apply the voltage constraint when initialising.
88 * @ramp_disable: Disable ramp delay when initialising or when setting voltage.
88 * 89 *
89 * @input_uV: Input voltage for regulator when supplied by another regulator. 90 * @input_uV: Input voltage for regulator when supplied by another regulator.
90 * 91 *
diff --git a/include/linux/regulator/max1586.h b/include/linux/regulator/max1586.h
index de9a7fae20be..cedd0febe882 100644
--- a/include/linux/regulator/max1586.h
+++ b/include/linux/regulator/max1586.h
@@ -40,7 +40,7 @@
40 */ 40 */
41struct max1586_subdev_data { 41struct max1586_subdev_data {
42 int id; 42 int id;
43 char *name; 43 const char *name;
44 struct regulator_init_data *platform_data; 44 struct regulator_init_data *platform_data;
45}; 45};
46 46
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 9cda293c867d..fb298e9d6d3a 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -21,7 +21,7 @@
21#include <linux/rculist.h> 21#include <linux/rculist.h>
22 22
23struct rhash_head { 23struct rhash_head {
24 struct rhash_head *next; 24 struct rhash_head __rcu *next;
25}; 25};
26 26
27#define INIT_HASH_HEAD(ptr) ((ptr)->next = NULL) 27#define INIT_HASH_HEAD(ptr) ((ptr)->next = NULL)
@@ -44,6 +44,7 @@ struct rhashtable;
44 * @head_offset: Offset of rhash_head in struct to be hashed 44 * @head_offset: Offset of rhash_head in struct to be hashed
45 * @hash_rnd: Seed to use while hashing 45 * @hash_rnd: Seed to use while hashing
46 * @max_shift: Maximum number of shifts while expanding 46 * @max_shift: Maximum number of shifts while expanding
47 * @min_shift: Minimum number of shifts while shrinking
47 * @hashfn: Function to hash key 48 * @hashfn: Function to hash key
48 * @obj_hashfn: Function to hash object 49 * @obj_hashfn: Function to hash object
49 * @grow_decision: If defined, may return true if table should expand 50 * @grow_decision: If defined, may return true if table should expand
@@ -57,6 +58,7 @@ struct rhashtable_params {
57 size_t head_offset; 58 size_t head_offset;
58 u32 hash_rnd; 59 u32 hash_rnd;
59 size_t max_shift; 60 size_t max_shift;
61 size_t min_shift;
60 rht_hashfn_t hashfn; 62 rht_hashfn_t hashfn;
61 rht_obj_hashfn_t obj_hashfn; 63 rht_obj_hashfn_t obj_hashfn;
62 bool (*grow_decision)(const struct rhashtable *ht, 64 bool (*grow_decision)(const struct rhashtable *ht,
@@ -97,7 +99,7 @@ u32 rhashtable_obj_hashfn(const struct rhashtable *ht, void *ptr);
97void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node, gfp_t); 99void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node, gfp_t);
98bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node, gfp_t); 100bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node, gfp_t);
99void rhashtable_remove_pprev(struct rhashtable *ht, struct rhash_head *obj, 101void rhashtable_remove_pprev(struct rhashtable *ht, struct rhash_head *obj,
100 struct rhash_head **pprev, gfp_t flags); 102 struct rhash_head __rcu **pprev, gfp_t flags);
101 103
102bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size); 104bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size);
103bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size); 105bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size);
@@ -117,18 +119,12 @@ void rhashtable_destroy(const struct rhashtable *ht);
117#define rht_dereference_rcu(p, ht) \ 119#define rht_dereference_rcu(p, ht) \
118 rcu_dereference_check(p, lockdep_rht_mutex_is_held(ht)) 120 rcu_dereference_check(p, lockdep_rht_mutex_is_held(ht))
119 121
120/* Internal, use rht_obj() instead */
121#define rht_entry(ptr, type, member) container_of(ptr, type, member) 122#define rht_entry(ptr, type, member) container_of(ptr, type, member)
122#define rht_entry_safe(ptr, type, member) \ 123#define rht_entry_safe(ptr, type, member) \
123({ \ 124({ \
124 typeof(ptr) __ptr = (ptr); \ 125 typeof(ptr) __ptr = (ptr); \
125 __ptr ? rht_entry(__ptr, type, member) : NULL; \ 126 __ptr ? rht_entry(__ptr, type, member) : NULL; \
126}) 127})
127#define rht_entry_safe_rcu(ptr, type, member) \
128({ \
129 typeof(*ptr) __rcu *__ptr = (typeof(*ptr) __rcu __force *)ptr; \
130 __ptr ? container_of((typeof(ptr))rcu_dereference_raw(__ptr), type, member) : NULL; \
131})
132 128
133#define rht_next_entry_safe(pos, ht, member) \ 129#define rht_next_entry_safe(pos, ht, member) \
134({ \ 130({ \
@@ -205,9 +201,10 @@ void rhashtable_destroy(const struct rhashtable *ht);
205 * traversal is guarded by rcu_read_lock(). 201 * traversal is guarded by rcu_read_lock().
206 */ 202 */
207#define rht_for_each_entry_rcu(pos, head, member) \ 203#define rht_for_each_entry_rcu(pos, head, member) \
208 for (pos = rht_entry_safe_rcu(head, typeof(*(pos)), member); \ 204 for (pos = rht_entry_safe(rcu_dereference_raw(head), \
205 typeof(*(pos)), member); \
209 pos; \ 206 pos; \
210 pos = rht_entry_safe_rcu((pos)->member.next, \ 207 pos = rht_entry_safe(rcu_dereference_raw((pos)->member.next), \
211 typeof(*(pos)), member)) 208 typeof(*(pos)), member))
212 209
213#endif /* _LINUX_RHASHTABLE_H */ 210#endif /* _LINUX_RHASHTABLE_H */
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 49a4d6f59108..e2c13cd863bd 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -97,7 +97,7 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k
97 __ring_buffer_alloc((size), (flags), &__key); \ 97 __ring_buffer_alloc((size), (flags), &__key); \
98}) 98})
99 99
100int ring_buffer_wait(struct ring_buffer *buffer, int cpu); 100int ring_buffer_wait(struct ring_buffer *buffer, int cpu, bool full);
101int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, 101int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu,
102 struct file *filp, poll_table *poll_table); 102 struct file *filp, poll_table *poll_table);
103 103
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 5059994fe297..9fc2f213e74f 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -384,11 +384,16 @@ void rio_dev_put(struct rio_dev *);
384 384
385#ifdef CONFIG_RAPIDIO_DMA_ENGINE 385#ifdef CONFIG_RAPIDIO_DMA_ENGINE
386extern struct dma_chan *rio_request_dma(struct rio_dev *rdev); 386extern struct dma_chan *rio_request_dma(struct rio_dev *rdev);
387extern struct dma_chan *rio_request_mport_dma(struct rio_mport *mport);
387extern void rio_release_dma(struct dma_chan *dchan); 388extern void rio_release_dma(struct dma_chan *dchan);
388extern struct dma_async_tx_descriptor *rio_dma_prep_slave_sg( 389extern struct dma_async_tx_descriptor *rio_dma_prep_slave_sg(
389 struct rio_dev *rdev, struct dma_chan *dchan, 390 struct rio_dev *rdev, struct dma_chan *dchan,
390 struct rio_dma_data *data, 391 struct rio_dma_data *data,
391 enum dma_transfer_direction direction, unsigned long flags); 392 enum dma_transfer_direction direction, unsigned long flags);
393extern struct dma_async_tx_descriptor *rio_dma_prep_xfer(
394 struct dma_chan *dchan, u16 destid,
395 struct rio_dma_data *data,
396 enum dma_transfer_direction direction, unsigned long flags);
392#endif 397#endif
393 398
394/** 399/**
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index be574506e6a9..c0c2bce6b0b7 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -150,7 +150,7 @@ int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *);
150static inline void anon_vma_merge(struct vm_area_struct *vma, 150static inline void anon_vma_merge(struct vm_area_struct *vma,
151 struct vm_area_struct *next) 151 struct vm_area_struct *next)
152{ 152{
153 VM_BUG_ON(vma->anon_vma != next->anon_vma); 153 VM_BUG_ON_VMA(vma->anon_vma != next->anon_vma, vma);
154 unlink_anon_vmas(next); 154 unlink_anon_vmas(next);
155} 155}
156 156
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 167bae7bdfa4..6cacbce1a06c 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -47,6 +47,16 @@ static inline int lockdep_rtnl_is_held(void)
47 rcu_dereference_check(p, lockdep_rtnl_is_held()) 47 rcu_dereference_check(p, lockdep_rtnl_is_held())
48 48
49/** 49/**
50 * rcu_dereference_bh_rtnl - rcu_dereference_bh with debug checking
51 * @p: The pointer to read, prior to dereference
52 *
53 * Do an rcu_dereference_bh(p), but check caller either holds rcu_read_lock_bh()
54 * or RTNL. Note : Please prefer rtnl_dereference() or rcu_dereference_bh()
55 */
56#define rcu_dereference_bh_rtnl(p) \
57 rcu_dereference_bh_check(p, lockdep_rtnl_is_held())
58
59/**
50 * rtnl_dereference - fetch RCU pointer when updates are prevented by RTNL 60 * rtnl_dereference - fetch RCU pointer when updates are prevented by RTNL
51 * @p: The pointer to read, prior to dereferencing 61 * @p: The pointer to read, prior to dereferencing
52 * 62 *
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 035d3c57fc8a..8f498cdde280 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -149,7 +149,7 @@ extern void downgrade_write(struct rw_semaphore *sem);
149 * static then another method for expressing nested locking is 149 * static then another method for expressing nested locking is
150 * the explicit definition of lock class keys and the use of 150 * the explicit definition of lock class keys and the use of
151 * lockdep_set_class() at lock initialization time. 151 * lockdep_set_class() at lock initialization time.
152 * See Documentation/lockdep-design.txt for more details.) 152 * See Documentation/locking/lockdep-design.txt for more details.)
153 */ 153 */
154extern void down_read_nested(struct rw_semaphore *sem, int subclass); 154extern void down_read_nested(struct rw_semaphore *sem, int subclass);
155extern void down_write_nested(struct rw_semaphore *sem, int subclass); 155extern void down_write_nested(struct rw_semaphore *sem, int subclass);
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index f4ec8bbcb372..ed8f9e70df9b 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -136,7 +136,7 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
136static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents, 136static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
137 struct scatterlist *sgl) 137 struct scatterlist *sgl)
138{ 138{
139#ifndef ARCH_HAS_SG_CHAIN 139#ifndef CONFIG_ARCH_HAS_SG_CHAIN
140 BUG(); 140 BUG();
141#endif 141#endif
142 142
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7c19d552dc3f..5e344bbe63ec 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -33,6 +33,7 @@ struct sched_param {
33 33
34#include <linux/smp.h> 34#include <linux/smp.h>
35#include <linux/sem.h> 35#include <linux/sem.h>
36#include <linux/shm.h>
36#include <linux/signal.h> 37#include <linux/signal.h>
37#include <linux/compiler.h> 38#include <linux/compiler.h>
38#include <linux/completion.h> 39#include <linux/completion.h>
@@ -56,6 +57,7 @@ struct sched_param {
56#include <linux/llist.h> 57#include <linux/llist.h>
57#include <linux/uidgid.h> 58#include <linux/uidgid.h>
58#include <linux/gfp.h> 59#include <linux/gfp.h>
60#include <linux/magic.h>
59 61
60#include <asm/processor.h> 62#include <asm/processor.h>
61 63
@@ -166,10 +168,10 @@ extern int nr_threads;
166DECLARE_PER_CPU(unsigned long, process_counts); 168DECLARE_PER_CPU(unsigned long, process_counts);
167extern int nr_processes(void); 169extern int nr_processes(void);
168extern unsigned long nr_running(void); 170extern unsigned long nr_running(void);
171extern bool single_task_running(void);
169extern unsigned long nr_iowait(void); 172extern unsigned long nr_iowait(void);
170extern unsigned long nr_iowait_cpu(int cpu); 173extern unsigned long nr_iowait_cpu(int cpu);
171extern unsigned long this_cpu_load(void); 174extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load);
172
173 175
174extern void calc_global_load(unsigned long ticks); 176extern void calc_global_load(unsigned long ticks);
175extern void update_cpu_load_nohz(void); 177extern void update_cpu_load_nohz(void);
@@ -645,6 +647,7 @@ struct signal_struct {
645 * Live threads maintain their own counters and add to these 647 * Live threads maintain their own counters and add to these
646 * in __exit_signal, except for the group leader. 648 * in __exit_signal, except for the group leader.
647 */ 649 */
650 seqlock_t stats_lock;
648 cputime_t utime, stime, cutime, cstime; 651 cputime_t utime, stime, cutime, cstime;
649 cputime_t gtime; 652 cputime_t gtime;
650 cputime_t cgtime; 653 cputime_t cgtime;
@@ -1023,6 +1026,7 @@ struct sched_domain_topology_level {
1023extern struct sched_domain_topology_level *sched_domain_topology; 1026extern struct sched_domain_topology_level *sched_domain_topology;
1024 1027
1025extern void set_sched_topology(struct sched_domain_topology_level *tl); 1028extern void set_sched_topology(struct sched_domain_topology_level *tl);
1029extern void wake_up_if_idle(int cpu);
1026 1030
1027#ifdef CONFIG_SCHED_DEBUG 1031#ifdef CONFIG_SCHED_DEBUG
1028# define SD_INIT_NAME(type) .name = #type 1032# define SD_INIT_NAME(type) .name = #type
@@ -1212,6 +1216,13 @@ struct sched_dl_entity {
1212 struct hrtimer dl_timer; 1216 struct hrtimer dl_timer;
1213}; 1217};
1214 1218
1219union rcu_special {
1220 struct {
1221 bool blocked;
1222 bool need_qs;
1223 } b;
1224 short s;
1225};
1215struct rcu_node; 1226struct rcu_node;
1216 1227
1217enum perf_event_task_context { 1228enum perf_event_task_context {
@@ -1264,12 +1275,18 @@ struct task_struct {
1264 1275
1265#ifdef CONFIG_PREEMPT_RCU 1276#ifdef CONFIG_PREEMPT_RCU
1266 int rcu_read_lock_nesting; 1277 int rcu_read_lock_nesting;
1267 char rcu_read_unlock_special; 1278 union rcu_special rcu_read_unlock_special;
1268 struct list_head rcu_node_entry; 1279 struct list_head rcu_node_entry;
1269#endif /* #ifdef CONFIG_PREEMPT_RCU */ 1280#endif /* #ifdef CONFIG_PREEMPT_RCU */
1270#ifdef CONFIG_TREE_PREEMPT_RCU 1281#ifdef CONFIG_TREE_PREEMPT_RCU
1271 struct rcu_node *rcu_blocked_node; 1282 struct rcu_node *rcu_blocked_node;
1272#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ 1283#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
1284#ifdef CONFIG_TASKS_RCU
1285 unsigned long rcu_tasks_nvcsw;
1286 bool rcu_tasks_holdout;
1287 struct list_head rcu_tasks_holdout_list;
1288 int rcu_tasks_idle_cpu;
1289#endif /* #ifdef CONFIG_TASKS_RCU */
1273 1290
1274#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 1291#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
1275 struct sched_info sched_info; 1292 struct sched_info sched_info;
@@ -1385,6 +1402,7 @@ struct task_struct {
1385#ifdef CONFIG_SYSVIPC 1402#ifdef CONFIG_SYSVIPC
1386/* ipc stuff */ 1403/* ipc stuff */
1387 struct sysv_sem sysvsem; 1404 struct sysv_sem sysvsem;
1405 struct sysv_shm sysvshm;
1388#endif 1406#endif
1389#ifdef CONFIG_DETECT_HUNG_TASK 1407#ifdef CONFIG_DETECT_HUNG_TASK
1390/* hung task detection */ 1408/* hung task detection */
@@ -1628,12 +1646,6 @@ struct task_struct {
1628 unsigned long trace_recursion; 1646 unsigned long trace_recursion;
1629#endif /* CONFIG_TRACING */ 1647#endif /* CONFIG_TRACING */
1630#ifdef CONFIG_MEMCG /* memcg uses this to do batch job */ 1648#ifdef CONFIG_MEMCG /* memcg uses this to do batch job */
1631 struct memcg_batch_info {
1632 int do_batch; /* incremented when batch uncharge started */
1633 struct mem_cgroup *memcg; /* target memcg of uncharge */
1634 unsigned long nr_pages; /* uncharged usage */
1635 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */
1636 } memcg_batch;
1637 unsigned int memcg_kmem_skip_account; 1649 unsigned int memcg_kmem_skip_account;
1638 struct memcg_oom_info { 1650 struct memcg_oom_info {
1639 struct mem_cgroup *memcg; 1651 struct mem_cgroup *memcg;
@@ -1908,8 +1920,6 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1908#define PF_KTHREAD 0x00200000 /* I am a kernel thread */ 1920#define PF_KTHREAD 0x00200000 /* I am a kernel thread */
1909#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ 1921#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */
1910#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ 1922#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */
1911#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */
1912#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
1913#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */ 1923#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */
1914#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ 1924#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
1915#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1925#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
@@ -1941,11 +1951,13 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1941#define tsk_used_math(p) ((p)->flags & PF_USED_MATH) 1951#define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
1942#define used_math() tsk_used_math(current) 1952#define used_math() tsk_used_math(current)
1943 1953
1944/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags */ 1954/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags
1955 * __GFP_FS is also cleared as it implies __GFP_IO.
1956 */
1945static inline gfp_t memalloc_noio_flags(gfp_t flags) 1957static inline gfp_t memalloc_noio_flags(gfp_t flags)
1946{ 1958{
1947 if (unlikely(current->flags & PF_MEMALLOC_NOIO)) 1959 if (unlikely(current->flags & PF_MEMALLOC_NOIO))
1948 flags &= ~__GFP_IO; 1960 flags &= ~(__GFP_IO | __GFP_FS);
1949 return flags; 1961 return flags;
1950} 1962}
1951 1963
@@ -1962,17 +1974,31 @@ static inline void memalloc_noio_restore(unsigned int flags)
1962} 1974}
1963 1975
1964/* Per-process atomic flags. */ 1976/* Per-process atomic flags. */
1965#define PFA_NO_NEW_PRIVS 0x00000001 /* May not gain new privileges. */ 1977#define PFA_NO_NEW_PRIVS 0 /* May not gain new privileges. */
1978#define PFA_SPREAD_PAGE 1 /* Spread page cache over cpuset */
1979#define PFA_SPREAD_SLAB 2 /* Spread some slab caches over cpuset */
1966 1980
1967static inline bool task_no_new_privs(struct task_struct *p)
1968{
1969 return test_bit(PFA_NO_NEW_PRIVS, &p->atomic_flags);
1970}
1971 1981
1972static inline void task_set_no_new_privs(struct task_struct *p) 1982#define TASK_PFA_TEST(name, func) \
1973{ 1983 static inline bool task_##func(struct task_struct *p) \
1974 set_bit(PFA_NO_NEW_PRIVS, &p->atomic_flags); 1984 { return test_bit(PFA_##name, &p->atomic_flags); }
1975} 1985#define TASK_PFA_SET(name, func) \
1986 static inline void task_set_##func(struct task_struct *p) \
1987 { set_bit(PFA_##name, &p->atomic_flags); }
1988#define TASK_PFA_CLEAR(name, func) \
1989 static inline void task_clear_##func(struct task_struct *p) \
1990 { clear_bit(PFA_##name, &p->atomic_flags); }
1991
1992TASK_PFA_TEST(NO_NEW_PRIVS, no_new_privs)
1993TASK_PFA_SET(NO_NEW_PRIVS, no_new_privs)
1994
1995TASK_PFA_TEST(SPREAD_PAGE, spread_page)
1996TASK_PFA_SET(SPREAD_PAGE, spread_page)
1997TASK_PFA_CLEAR(SPREAD_PAGE, spread_page)
1998
1999TASK_PFA_TEST(SPREAD_SLAB, spread_slab)
2000TASK_PFA_SET(SPREAD_SLAB, spread_slab)
2001TASK_PFA_CLEAR(SPREAD_SLAB, spread_slab)
1976 2002
1977/* 2003/*
1978 * task->jobctl flags 2004 * task->jobctl flags
@@ -2004,29 +2030,21 @@ extern void task_clear_jobctl_trapping(struct task_struct *task);
2004extern void task_clear_jobctl_pending(struct task_struct *task, 2030extern void task_clear_jobctl_pending(struct task_struct *task,
2005 unsigned int mask); 2031 unsigned int mask);
2006 2032
2007#ifdef CONFIG_PREEMPT_RCU
2008
2009#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */
2010#define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */
2011
2012static inline void rcu_copy_process(struct task_struct *p) 2033static inline void rcu_copy_process(struct task_struct *p)
2013{ 2034{
2035#ifdef CONFIG_PREEMPT_RCU
2014 p->rcu_read_lock_nesting = 0; 2036 p->rcu_read_lock_nesting = 0;
2015 p->rcu_read_unlock_special = 0; 2037 p->rcu_read_unlock_special.s = 0;
2016#ifdef CONFIG_TREE_PREEMPT_RCU
2017 p->rcu_blocked_node = NULL; 2038 p->rcu_blocked_node = NULL;
2018#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
2019 INIT_LIST_HEAD(&p->rcu_node_entry); 2039 INIT_LIST_HEAD(&p->rcu_node_entry);
2040#endif /* #ifdef CONFIG_PREEMPT_RCU */
2041#ifdef CONFIG_TASKS_RCU
2042 p->rcu_tasks_holdout = false;
2043 INIT_LIST_HEAD(&p->rcu_tasks_holdout_list);
2044 p->rcu_tasks_idle_cpu = -1;
2045#endif /* #ifdef CONFIG_TASKS_RCU */
2020} 2046}
2021 2047
2022#else
2023
2024static inline void rcu_copy_process(struct task_struct *p)
2025{
2026}
2027
2028#endif
2029
2030static inline void tsk_restore_flags(struct task_struct *task, 2048static inline void tsk_restore_flags(struct task_struct *task,
2031 unsigned long orig_flags, unsigned long flags) 2049 unsigned long orig_flags, unsigned long flags)
2032{ 2050{
@@ -2364,8 +2382,10 @@ static inline int on_sig_stack(unsigned long sp)
2364 2382
2365static inline int sas_ss_flags(unsigned long sp) 2383static inline int sas_ss_flags(unsigned long sp)
2366{ 2384{
2367 return (current->sas_ss_size == 0 ? SS_DISABLE 2385 if (!current->sas_ss_size)
2368 : on_sig_stack(sp) ? SS_ONSTACK : 0); 2386 return SS_DISABLE;
2387
2388 return on_sig_stack(sp) ? SS_ONSTACK : 0;
2369} 2389}
2370 2390
2371static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig) 2391static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig)
@@ -2611,12 +2631,27 @@ static inline void setup_thread_stack(struct task_struct *p, struct task_struct
2611 task_thread_info(p)->task = p; 2631 task_thread_info(p)->task = p;
2612} 2632}
2613 2633
2634/*
2635 * Return the address of the last usable long on the stack.
2636 *
2637 * When the stack grows down, this is just above the thread
2638 * info struct. Going any lower will corrupt the threadinfo.
2639 *
2640 * When the stack grows up, this is the highest address.
2641 * Beyond that position, we corrupt data on the next page.
2642 */
2614static inline unsigned long *end_of_stack(struct task_struct *p) 2643static inline unsigned long *end_of_stack(struct task_struct *p)
2615{ 2644{
2645#ifdef CONFIG_STACK_GROWSUP
2646 return (unsigned long *)((unsigned long)task_thread_info(p) + THREAD_SIZE) - 1;
2647#else
2616 return (unsigned long *)(task_thread_info(p) + 1); 2648 return (unsigned long *)(task_thread_info(p) + 1);
2649#endif
2617} 2650}
2618 2651
2619#endif 2652#endif
2653#define task_stack_end_corrupted(task) \
2654 (*(end_of_stack(task)) != STACK_END_MAGIC)
2620 2655
2621static inline int object_is_on_stack(void *obj) 2656static inline int object_is_on_stack(void *obj)
2622{ 2657{
@@ -2639,6 +2674,7 @@ static inline unsigned long stack_not_used(struct task_struct *p)
2639 return (unsigned long)n - (unsigned long)end_of_stack(p); 2674 return (unsigned long)n - (unsigned long)end_of_stack(p);
2640} 2675}
2641#endif 2676#endif
2677extern void set_task_stack_end_magic(struct task_struct *tsk);
2642 2678
2643/* set thread flags in other task's structures 2679/* set thread flags in other task's structures
2644 * - see asm/thread_info.h for TIF_xxxx flags available 2680 * - see asm/thread_info.h for TIF_xxxx flags available
@@ -2967,15 +3003,10 @@ static inline void inc_syscw(struct task_struct *tsk)
2967 3003
2968#ifdef CONFIG_MEMCG 3004#ifdef CONFIG_MEMCG
2969extern void mm_update_next_owner(struct mm_struct *mm); 3005extern void mm_update_next_owner(struct mm_struct *mm);
2970extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p);
2971#else 3006#else
2972static inline void mm_update_next_owner(struct mm_struct *mm) 3007static inline void mm_update_next_owner(struct mm_struct *mm)
2973{ 3008{
2974} 3009}
2975
2976static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
2977{
2978}
2979#endif /* CONFIG_MEMCG */ 3010#endif /* CONFIG_MEMCG */
2980 3011
2981static inline unsigned long task_rlimit(const struct task_struct *tsk, 3012static inline unsigned long task_rlimit(const struct task_struct *tsk,
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index 005bf3e38db5..f0f8bad54be9 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -5,12 +5,4 @@
5 5
6extern struct screen_info screen_info; 6extern struct screen_info screen_info;
7 7
8#define ORIG_X (screen_info.orig_x)
9#define ORIG_Y (screen_info.orig_y)
10#define ORIG_VIDEO_MODE (screen_info.orig_video_mode)
11#define ORIG_VIDEO_COLS (screen_info.orig_video_cols)
12#define ORIG_VIDEO_EGA_BX (screen_info.orig_video_ega_bx)
13#define ORIG_VIDEO_LINES (screen_info.orig_video_lines)
14#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA)
15#define ORIG_VIDEO_POINTS (screen_info.orig_video_points)
16#endif /* _SCREEN_INFO_H */ 8#endif /* _SCREEN_INFO_H */
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 5d586a45a319..a19ddacdac30 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -27,19 +27,23 @@ struct seccomp {
27 struct seccomp_filter *filter; 27 struct seccomp_filter *filter;
28}; 28};
29 29
30extern int __secure_computing(int); 30#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
31static inline int secure_computing(int this_syscall) 31extern int __secure_computing(void);
32static inline int secure_computing(void)
32{ 33{
33 if (unlikely(test_thread_flag(TIF_SECCOMP))) 34 if (unlikely(test_thread_flag(TIF_SECCOMP)))
34 return __secure_computing(this_syscall); 35 return __secure_computing();
35 return 0; 36 return 0;
36} 37}
37 38
38/* A wrapper for architectures supporting only SECCOMP_MODE_STRICT. */ 39#define SECCOMP_PHASE1_OK 0
39static inline void secure_computing_strict(int this_syscall) 40#define SECCOMP_PHASE1_SKIP 1
40{ 41
41 BUG_ON(secure_computing(this_syscall) != 0); 42extern u32 seccomp_phase1(struct seccomp_data *sd);
42} 43int seccomp_phase2(u32 phase1_result);
44#else
45extern void secure_computing_strict(int this_syscall);
46#endif
43 47
44extern long prctl_get_seccomp(void); 48extern long prctl_get_seccomp(void);
45extern long prctl_set_seccomp(unsigned long, char __user *); 49extern long prctl_set_seccomp(unsigned long, char __user *);
@@ -56,8 +60,11 @@ static inline int seccomp_mode(struct seccomp *s)
56struct seccomp { }; 60struct seccomp { };
57struct seccomp_filter { }; 61struct seccomp_filter { };
58 62
59static inline int secure_computing(int this_syscall) { return 0; } 63#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
64static inline int secure_computing(void) { return 0; }
65#else
60static inline void secure_computing_strict(int this_syscall) { return; } 66static inline void secure_computing_strict(int this_syscall) { return; }
67#endif
61 68
62static inline long prctl_get_seccomp(void) 69static inline long prctl_get_seccomp(void)
63{ 70{
diff --git a/include/linux/security.h b/include/linux/security.h
index 623f90e5f38d..ba96471c11ba 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1559,7 +1559,7 @@ struct security_operations {
1559 int (*file_lock) (struct file *file, unsigned int cmd); 1559 int (*file_lock) (struct file *file, unsigned int cmd);
1560 int (*file_fcntl) (struct file *file, unsigned int cmd, 1560 int (*file_fcntl) (struct file *file, unsigned int cmd,
1561 unsigned long arg); 1561 unsigned long arg);
1562 int (*file_set_fowner) (struct file *file); 1562 void (*file_set_fowner) (struct file *file);
1563 int (*file_send_sigiotask) (struct task_struct *tsk, 1563 int (*file_send_sigiotask) (struct task_struct *tsk,
1564 struct fown_struct *fown, int sig); 1564 struct fown_struct *fown, int sig);
1565 int (*file_receive) (struct file *file); 1565 int (*file_receive) (struct file *file);
@@ -1834,7 +1834,7 @@ int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
1834 unsigned long prot); 1834 unsigned long prot);
1835int security_file_lock(struct file *file, unsigned int cmd); 1835int security_file_lock(struct file *file, unsigned int cmd);
1836int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg); 1836int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
1837int security_file_set_fowner(struct file *file); 1837void security_file_set_fowner(struct file *file);
1838int security_file_send_sigiotask(struct task_struct *tsk, 1838int security_file_send_sigiotask(struct task_struct *tsk,
1839 struct fown_struct *fown, int sig); 1839 struct fown_struct *fown, int sig);
1840int security_file_receive(struct file *file); 1840int security_file_receive(struct file *file);
@@ -2108,7 +2108,7 @@ static inline int security_dentry_init_security(struct dentry *dentry,
2108static inline int security_inode_init_security(struct inode *inode, 2108static inline int security_inode_init_security(struct inode *inode,
2109 struct inode *dir, 2109 struct inode *dir,
2110 const struct qstr *qstr, 2110 const struct qstr *qstr,
2111 const initxattrs initxattrs, 2111 const initxattrs xattrs,
2112 void *fs_data) 2112 void *fs_data)
2113{ 2113{
2114 return 0; 2114 return 0;
@@ -2312,9 +2312,9 @@ static inline int security_file_fcntl(struct file *file, unsigned int cmd,
2312 return 0; 2312 return 0;
2313} 2313}
2314 2314
2315static inline int security_file_set_fowner(struct file *file) 2315static inline void security_file_set_fowner(struct file *file)
2316{ 2316{
2317 return 0; 2317 return;
2318} 2318}
2319 2319
2320static inline int security_file_send_sigiotask(struct task_struct *tsk, 2320static inline int security_file_send_sigiotask(struct task_struct *tsk,
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index cc359636cfa3..f5df8f687b4d 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -456,4 +456,23 @@ read_sequnlock_excl_irqrestore(seqlock_t *sl, unsigned long flags)
456 spin_unlock_irqrestore(&sl->lock, flags); 456 spin_unlock_irqrestore(&sl->lock, flags);
457} 457}
458 458
459static inline unsigned long
460read_seqbegin_or_lock_irqsave(seqlock_t *lock, int *seq)
461{
462 unsigned long flags = 0;
463
464 if (!(*seq & 1)) /* Even */
465 *seq = read_seqbegin(lock);
466 else /* Odd */
467 read_seqlock_excl_irqsave(lock, flags);
468
469 return flags;
470}
471
472static inline void
473done_seqretry_irqrestore(seqlock_t *lock, int seq, unsigned long flags)
474{
475 if (seq & 1)
476 read_sequnlock_excl_irqrestore(lock, flags);
477}
459#endif /* __LINUX_SEQLOCK_H */ 478#endif /* __LINUX_SEQLOCK_H */
diff --git a/include/linux/seqno-fence.h b/include/linux/seqno-fence.h
index 3d6003de4b0d..a1ba6a5ccdd6 100644
--- a/include/linux/seqno-fence.h
+++ b/include/linux/seqno-fence.h
@@ -62,6 +62,7 @@ to_seqno_fence(struct fence *fence)
62 * @context: the execution context this fence is a part of 62 * @context: the execution context this fence is a part of
63 * @seqno_ofs: the offset within @sync_buf 63 * @seqno_ofs: the offset within @sync_buf
64 * @seqno: the sequence # to signal on 64 * @seqno: the sequence # to signal on
65 * @cond: fence wait condition
65 * @ops: the fence_ops for operations on this seqno fence 66 * @ops: the fence_ops for operations on this seqno fence
66 * 67 *
67 * This function initializes a struct seqno_fence with passed parameters, 68 * This function initializes a struct seqno_fence with passed parameters,
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index f93649e22c43..3df10d5f154b 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -84,6 +84,7 @@ struct uart_8250_port {
84 unsigned char mcr_mask; /* mask of user bits */ 84 unsigned char mcr_mask; /* mask of user bits */
85 unsigned char mcr_force; /* mask of forced bits */ 85 unsigned char mcr_force; /* mask of forced bits */
86 unsigned char cur_iotype; /* Running I/O type */ 86 unsigned char cur_iotype; /* Running I/O type */
87 unsigned int rpm_tx_active;
87 88
88 /* 89 /*
89 * Some bits in registers are cleared on a read, so they must 90 * Some bits in registers are cleared on a read, so they must
@@ -96,10 +97,13 @@ struct uart_8250_port {
96 unsigned char msr_saved_flags; 97 unsigned char msr_saved_flags;
97 98
98 struct uart_8250_dma *dma; 99 struct uart_8250_dma *dma;
100 struct serial_rs485 rs485;
99 101
100 /* 8250 specific callbacks */ 102 /* 8250 specific callbacks */
101 int (*dl_read)(struct uart_8250_port *); 103 int (*dl_read)(struct uart_8250_port *);
102 void (*dl_write)(struct uart_8250_port *, int); 104 void (*dl_write)(struct uart_8250_port *, int);
105 int (*rs485_config)(struct uart_8250_port *,
106 struct serial_rs485 *rs485);
103}; 107};
104 108
105static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up) 109static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up)
@@ -121,6 +125,8 @@ extern void serial8250_early_out(struct uart_port *port, int offset, int value);
121extern int setup_early_serial8250_console(char *cmdline); 125extern int setup_early_serial8250_console(char *cmdline);
122extern void serial8250_do_set_termios(struct uart_port *port, 126extern void serial8250_do_set_termios(struct uart_port *port,
123 struct ktermios *termios, struct ktermios *old); 127 struct ktermios *termios, struct ktermios *old);
128extern int serial8250_do_startup(struct uart_port *port);
129extern void serial8250_do_shutdown(struct uart_port *port);
124extern void serial8250_do_pm(struct uart_port *port, unsigned int state, 130extern void serial8250_do_pm(struct uart_port *port, unsigned int state,
125 unsigned int oldstate); 131 unsigned int oldstate);
126extern int fsl8250_handle_irq(struct uart_port *port); 132extern int fsl8250_handle_irq(struct uart_port *port);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index cf3a1e789bf5..21c2e05c1bc3 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -112,6 +112,7 @@ struct uart_icount {
112}; 112};
113 113
114typedef unsigned int __bitwise__ upf_t; 114typedef unsigned int __bitwise__ upf_t;
115typedef unsigned int __bitwise__ upstat_t;
115 116
116struct uart_port { 117struct uart_port {
117 spinlock_t lock; /* port lock */ 118 spinlock_t lock; /* port lock */
@@ -122,6 +123,10 @@ struct uart_port {
122 void (*set_termios)(struct uart_port *, 123 void (*set_termios)(struct uart_port *,
123 struct ktermios *new, 124 struct ktermios *new,
124 struct ktermios *old); 125 struct ktermios *old);
126 int (*startup)(struct uart_port *port);
127 void (*shutdown)(struct uart_port *port);
128 void (*throttle)(struct uart_port *port);
129 void (*unthrottle)(struct uart_port *port);
125 int (*handle_irq)(struct uart_port *); 130 int (*handle_irq)(struct uart_port *);
126 void (*pm)(struct uart_port *, unsigned int state, 131 void (*pm)(struct uart_port *, unsigned int state,
127 unsigned int old); 132 unsigned int old);
@@ -152,6 +157,7 @@ struct uart_port {
152 unsigned long sysrq; /* sysrq timeout */ 157 unsigned long sysrq; /* sysrq timeout */
153#endif 158#endif
154 159
160 /* flags must be updated while holding port mutex */
155 upf_t flags; 161 upf_t flags;
156 162
157#define UPF_FOURPORT ((__force upf_t) (1 << 1)) 163#define UPF_FOURPORT ((__force upf_t) (1 << 1))
@@ -187,6 +193,13 @@ struct uart_port {
187#define UPF_CHANGE_MASK ((__force upf_t) (0x17fff)) 193#define UPF_CHANGE_MASK ((__force upf_t) (0x17fff))
188#define UPF_USR_MASK ((__force upf_t) (UPF_SPD_MASK|UPF_LOW_LATENCY)) 194#define UPF_USR_MASK ((__force upf_t) (UPF_SPD_MASK|UPF_LOW_LATENCY))
189 195
196 /* status must be updated while holding port lock */
197 upstat_t status;
198
199#define UPSTAT_CTS_ENABLE ((__force upstat_t) (1 << 0))
200#define UPSTAT_DCD_ENABLE ((__force upstat_t) (1 << 1))
201
202 int hw_stopped; /* sw-assisted CTS flow state */
190 unsigned int mctrl; /* current modem ctrl settings */ 203 unsigned int mctrl; /* current modem ctrl settings */
191 unsigned int timeout; /* character-based timeout */ 204 unsigned int timeout; /* character-based timeout */
192 unsigned int type; /* port type */ 205 unsigned int type; /* port type */
@@ -347,11 +360,16 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
347static inline int uart_tx_stopped(struct uart_port *port) 360static inline int uart_tx_stopped(struct uart_port *port)
348{ 361{
349 struct tty_struct *tty = port->state->port.tty; 362 struct tty_struct *tty = port->state->port.tty;
350 if(tty->stopped || tty->hw_stopped) 363 if (tty->stopped || port->hw_stopped)
351 return 1; 364 return 1;
352 return 0; 365 return 0;
353} 366}
354 367
368static inline bool uart_cts_enabled(struct uart_port *uport)
369{
370 return uport->status & UPSTAT_CTS_ENABLE;
371}
372
355/* 373/*
356 * The following are helper functions for the low level drivers. 374 * The following are helper functions for the low level drivers.
357 */ 375 */
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
index b7b43b82231e..56b97eed28a4 100644
--- a/include/linux/sh_dma.h
+++ b/include/linux/sh_dma.h
@@ -95,19 +95,21 @@ struct sh_dmae_pdata {
95}; 95};
96 96
97/* DMAOR definitions */ 97/* DMAOR definitions */
98#define DMAOR_AE 0x00000004 98#define DMAOR_AE 0x00000004 /* Address Error Flag */
99#define DMAOR_NMIF 0x00000002 99#define DMAOR_NMIF 0x00000002
100#define DMAOR_DME 0x00000001 100#define DMAOR_DME 0x00000001 /* DMA Master Enable */
101 101
102/* Definitions for the SuperH DMAC */ 102/* Definitions for the SuperH DMAC */
103#define DM_INC 0x00004000 103#define DM_INC 0x00004000 /* Destination addresses are incremented */
104#define DM_DEC 0x00008000 104#define DM_DEC 0x00008000 /* Destination addresses are decremented */
105#define DM_FIX 0x0000c000 105#define DM_FIX 0x0000c000 /* Destination address is fixed */
106#define SM_INC 0x00001000 106#define SM_INC 0x00001000 /* Source addresses are incremented */
107#define SM_DEC 0x00002000 107#define SM_DEC 0x00002000 /* Source addresses are decremented */
108#define SM_FIX 0x00003000 108#define SM_FIX 0x00003000 /* Source address is fixed */
109#define CHCR_DE 0x00000001 109#define RS_AUTO 0x00000400 /* Auto Request */
110#define CHCR_TE 0x00000002 110#define RS_ERS 0x00000800 /* DMA extended resource selector */
111#define CHCR_IE 0x00000004 111#define CHCR_DE 0x00000001 /* DMA Enable */
112#define CHCR_TE 0x00000002 /* Transfer End Flag */
113#define CHCR_IE 0x00000004 /* Interrupt Enable */
112 114
113#endif 115#endif
diff --git a/include/linux/shm.h b/include/linux/shm.h
index 57d77709fbe2..6fb801686ad6 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_SHM_H_ 1#ifndef _LINUX_SHM_H_
2#define _LINUX_SHM_H_ 2#define _LINUX_SHM_H_
3 3
4#include <linux/list.h>
4#include <asm/page.h> 5#include <asm/page.h>
5#include <uapi/linux/shm.h> 6#include <uapi/linux/shm.h>
6#include <asm/shmparam.h> 7#include <asm/shmparam.h>
@@ -20,6 +21,7 @@ struct shmid_kernel /* private to the kernel */
20 21
21 /* The task created the shm object. NULL if the task is dead. */ 22 /* The task created the shm object. NULL if the task is dead. */
22 struct task_struct *shm_creator; 23 struct task_struct *shm_creator;
24 struct list_head shm_clist; /* list by creator */
23}; 25};
24 26
25/* shm_mode upper byte flags */ 27/* shm_mode upper byte flags */
@@ -44,11 +46,20 @@ struct shmid_kernel /* private to the kernel */
44#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT) 46#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT)
45 47
46#ifdef CONFIG_SYSVIPC 48#ifdef CONFIG_SYSVIPC
49struct sysv_shm {
50 struct list_head shm_clist;
51};
52
47long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr, 53long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr,
48 unsigned long shmlba); 54 unsigned long shmlba);
49extern int is_file_shm_hugepages(struct file *file); 55int is_file_shm_hugepages(struct file *file);
50extern void exit_shm(struct task_struct *task); 56void exit_shm(struct task_struct *task);
57#define shm_init_task(task) INIT_LIST_HEAD(&(task)->sysvshm.shm_clist)
51#else 58#else
59struct sysv_shm {
60 /* empty */
61};
62
52static inline long do_shmat(int shmid, char __user *shmaddr, 63static inline long do_shmat(int shmid, char __user *shmaddr,
53 int shmflg, unsigned long *addr, 64 int shmflg, unsigned long *addr,
54 unsigned long shmlba) 65 unsigned long shmlba)
@@ -62,6 +73,9 @@ static inline int is_file_shm_hugepages(struct file *file)
62static inline void exit_shm(struct task_struct *task) 73static inline void exit_shm(struct task_struct *task)
63{ 74{
64} 75}
76static inline void shm_init_task(struct task_struct *task)
77{
78}
65#endif 79#endif
66 80
67#endif /* _LINUX_SHM_H_ */ 81#endif /* _LINUX_SHM_H_ */
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 4d1771c2d29f..50777b5b1e4c 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -1,6 +1,7 @@
1#ifndef __SHMEM_FS_H 1#ifndef __SHMEM_FS_H
2#define __SHMEM_FS_H 2#define __SHMEM_FS_H
3 3
4#include <linux/file.h>
4#include <linux/swap.h> 5#include <linux/swap.h>
5#include <linux/mempolicy.h> 6#include <linux/mempolicy.h>
6#include <linux/pagemap.h> 7#include <linux/pagemap.h>
@@ -11,6 +12,7 @@
11 12
12struct shmem_inode_info { 13struct shmem_inode_info {
13 spinlock_t lock; 14 spinlock_t lock;
15 unsigned int seals; /* shmem seals */
14 unsigned long flags; 16 unsigned long flags;
15 unsigned long alloced; /* data pages alloced to file */ 17 unsigned long alloced; /* data pages alloced to file */
16 union { 18 union {
@@ -65,4 +67,19 @@ static inline struct page *shmem_read_mapping_page(
65 mapping_gfp_mask(mapping)); 67 mapping_gfp_mask(mapping));
66} 68}
67 69
70#ifdef CONFIG_TMPFS
71
72extern int shmem_add_seals(struct file *file, unsigned int seals);
73extern int shmem_get_seals(struct file *file);
74extern long shmem_fcntl(struct file *file, unsigned int cmd, unsigned long arg);
75
76#else
77
78static inline long shmem_fcntl(struct file *f, unsigned int c, unsigned long a)
79{
80 return -EINVAL;
81}
82
83#endif
84
68#endif 85#endif
diff --git a/include/linux/signal.h b/include/linux/signal.h
index c9e65360c49a..ab1e0392b5ac 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -2,6 +2,7 @@
2#define _LINUX_SIGNAL_H 2#define _LINUX_SIGNAL_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/bug.h>
5#include <uapi/linux/signal.h> 6#include <uapi/linux/signal.h>
6 7
7struct task_struct; 8struct task_struct;
@@ -67,7 +68,6 @@ static inline int sigismember(sigset_t *set, int _sig)
67 68
68static inline int sigisemptyset(sigset_t *set) 69static inline int sigisemptyset(sigset_t *set)
69{ 70{
70 extern void _NSIG_WORDS_is_unsupported_size(void);
71 switch (_NSIG_WORDS) { 71 switch (_NSIG_WORDS) {
72 case 4: 72 case 4:
73 return (set->sig[3] | set->sig[2] | 73 return (set->sig[3] | set->sig[2] |
@@ -77,7 +77,7 @@ static inline int sigisemptyset(sigset_t *set)
77 case 1: 77 case 1:
78 return set->sig[0] == 0; 78 return set->sig[0] == 0;
79 default: 79 default:
80 _NSIG_WORDS_is_unsupported_size(); 80 BUILD_BUG();
81 return 0; 81 return 0;
82 } 82 }
83} 83}
@@ -90,24 +90,23 @@ static inline int sigisemptyset(sigset_t *set)
90#define _SIG_SET_BINOP(name, op) \ 90#define _SIG_SET_BINOP(name, op) \
91static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \ 91static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \
92{ \ 92{ \
93 extern void _NSIG_WORDS_is_unsupported_size(void); \
94 unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \ 93 unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \
95 \ 94 \
96 switch (_NSIG_WORDS) { \ 95 switch (_NSIG_WORDS) { \
97 case 4: \ 96 case 4: \
98 a3 = a->sig[3]; a2 = a->sig[2]; \ 97 a3 = a->sig[3]; a2 = a->sig[2]; \
99 b3 = b->sig[3]; b2 = b->sig[2]; \ 98 b3 = b->sig[3]; b2 = b->sig[2]; \
100 r->sig[3] = op(a3, b3); \ 99 r->sig[3] = op(a3, b3); \
101 r->sig[2] = op(a2, b2); \ 100 r->sig[2] = op(a2, b2); \
102 case 2: \ 101 case 2: \
103 a1 = a->sig[1]; b1 = b->sig[1]; \ 102 a1 = a->sig[1]; b1 = b->sig[1]; \
104 r->sig[1] = op(a1, b1); \ 103 r->sig[1] = op(a1, b1); \
105 case 1: \ 104 case 1: \
106 a0 = a->sig[0]; b0 = b->sig[0]; \ 105 a0 = a->sig[0]; b0 = b->sig[0]; \
107 r->sig[0] = op(a0, b0); \ 106 r->sig[0] = op(a0, b0); \
108 break; \ 107 break; \
109 default: \ 108 default: \
110 _NSIG_WORDS_is_unsupported_size(); \ 109 BUILD_BUG(); \
111 } \ 110 } \
112} 111}
113 112
@@ -128,16 +127,14 @@ _SIG_SET_BINOP(sigandnsets, _sig_andn)
128#define _SIG_SET_OP(name, op) \ 127#define _SIG_SET_OP(name, op) \
129static inline void name(sigset_t *set) \ 128static inline void name(sigset_t *set) \
130{ \ 129{ \
131 extern void _NSIG_WORDS_is_unsupported_size(void); \
132 \
133 switch (_NSIG_WORDS) { \ 130 switch (_NSIG_WORDS) { \
134 case 4: set->sig[3] = op(set->sig[3]); \ 131 case 4: set->sig[3] = op(set->sig[3]); \
135 set->sig[2] = op(set->sig[2]); \ 132 set->sig[2] = op(set->sig[2]); \
136 case 2: set->sig[1] = op(set->sig[1]); \ 133 case 2: set->sig[1] = op(set->sig[1]); \
137 case 1: set->sig[0] = op(set->sig[0]); \ 134 case 1: set->sig[0] = op(set->sig[0]); \
138 break; \ 135 break; \
139 default: \ 136 default: \
140 _NSIG_WORDS_is_unsupported_size(); \ 137 BUILD_BUG(); \
141 } \ 138 } \
142} 139}
143 140
@@ -280,9 +277,8 @@ struct ksignal {
280 int sig; 277 int sig;
281}; 278};
282 279
283extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 280extern int get_signal(struct ksignal *ksig);
284extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping); 281extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
285extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping);
286extern void exit_signals(struct task_struct *tsk); 282extern void exit_signals(struct task_struct *tsk);
287extern void kernel_sigaction(int, __sighandler_t); 283extern void kernel_sigaction(int, __sighandler_t);
288 284
@@ -301,18 +297,6 @@ static inline void disallow_signal(int sig)
301 kernel_sigaction(sig, SIG_IGN); 297 kernel_sigaction(sig, SIG_IGN);
302} 298}
303 299
304/*
305 * Eventually that'll replace get_signal_to_deliver(); macro for now,
306 * to avoid nastiness with include order.
307 */
308#define get_signal(ksig) \
309({ \
310 struct ksignal *p = (ksig); \
311 p->sig = get_signal_to_deliver(&p->info, &p->ka, \
312 signal_pt_regs(), NULL);\
313 p->sig > 0; \
314})
315
316extern struct kmem_cache *sighand_cachep; 300extern struct kmem_cache *sighand_cachep;
317 301
318int unhandled_signal(struct task_struct *tsk, int sig); 302int unhandled_signal(struct task_struct *tsk, int sig);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 11c270551d25..6c8b6f604e76 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -28,7 +28,6 @@
28#include <linux/textsearch.h> 28#include <linux/textsearch.h>
29#include <net/checksum.h> 29#include <net/checksum.h>
30#include <linux/rcupdate.h> 30#include <linux/rcupdate.h>
31#include <linux/dmaengine.h>
32#include <linux/hrtimer.h> 31#include <linux/hrtimer.h>
33#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
34#include <linux/netdev_features.h> 33#include <linux/netdev_features.h>
@@ -47,11 +46,29 @@
47 * 46 *
48 * The hardware you're dealing with doesn't calculate the full checksum 47 * The hardware you're dealing with doesn't calculate the full checksum
49 * (as in CHECKSUM_COMPLETE), but it does parse headers and verify checksums 48 * (as in CHECKSUM_COMPLETE), but it does parse headers and verify checksums
50 * for specific protocols e.g. TCP/UDP/SCTP, then, for such packets it will 49 * for specific protocols. For such packets it will set CHECKSUM_UNNECESSARY
51 * set CHECKSUM_UNNECESSARY if their checksums are okay. skb->csum is still 50 * if their checksums are okay. skb->csum is still undefined in this case
52 * undefined in this case though. It is a bad option, but, unfortunately, 51 * though. It is a bad option, but, unfortunately, nowadays most vendors do
53 * nowadays most vendors do this. Apparently with the secret goal to sell 52 * this. Apparently with the secret goal to sell you new devices, when you
54 * you new devices, when you will add new protocol to your host, f.e. IPv6 8) 53 * will add new protocol to your host, f.e. IPv6 8)
54 *
55 * CHECKSUM_UNNECESSARY is applicable to following protocols:
56 * TCP: IPv6 and IPv4.
57 * UDP: IPv4 and IPv6. A device may apply CHECKSUM_UNNECESSARY to a
58 * zero UDP checksum for either IPv4 or IPv6, the networking stack
59 * may perform further validation in this case.
60 * GRE: only if the checksum is present in the header.
61 * SCTP: indicates the CRC in SCTP header has been validated.
62 *
63 * skb->csum_level indicates the number of consecutive checksums found in
64 * the packet minus one that have been verified as CHECKSUM_UNNECESSARY.
65 * For instance if a device receives an IPv6->UDP->GRE->IPv4->TCP packet
66 * and a device is able to verify the checksums for UDP (possibly zero),
67 * GRE (checksum flag is set), and TCP-- skb->csum_level would be set to
68 * two. If the device were only able to verify the UDP checksum and not
69 * GRE, either because it doesn't support GRE checksum of because GRE
70 * checksum is bad, skb->csum_level would be set to zero (TCP checksum is
71 * not considered in this case).
55 * 72 *
56 * CHECKSUM_COMPLETE: 73 * CHECKSUM_COMPLETE:
57 * 74 *
@@ -112,6 +129,9 @@
112#define CHECKSUM_COMPLETE 2 129#define CHECKSUM_COMPLETE 2
113#define CHECKSUM_PARTIAL 3 130#define CHECKSUM_PARTIAL 3
114 131
132/* Maximum value in skb->csum_level */
133#define SKB_MAX_CSUM_LEVEL 3
134
115#define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES) 135#define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES)
116#define SKB_WITH_OVERHEAD(X) \ 136#define SKB_WITH_OVERHEAD(X) \
117 ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) 137 ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
@@ -135,7 +155,7 @@ struct nf_conntrack {
135}; 155};
136#endif 156#endif
137 157
138#ifdef CONFIG_BRIDGE_NETFILTER 158#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
139struct nf_bridge_info { 159struct nf_bridge_info {
140 atomic_t use; 160 atomic_t use;
141 unsigned int mask; 161 unsigned int mask;
@@ -318,9 +338,10 @@ struct skb_shared_info {
318 338
319 339
320enum { 340enum {
321 SKB_FCLONE_UNAVAILABLE, 341 SKB_FCLONE_UNAVAILABLE, /* skb has no fclone (from head_cache) */
322 SKB_FCLONE_ORIG, 342 SKB_FCLONE_ORIG, /* orig skb (from fclone_cache) */
323 SKB_FCLONE_CLONE, 343 SKB_FCLONE_CLONE, /* companion fclone skb (from fclone_cache) */
344 SKB_FCLONE_FREE, /* this companion fclone skb is available */
324}; 345};
325 346
326enum { 347enum {
@@ -452,6 +473,7 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
452 * @tc_verd: traffic control verdict 473 * @tc_verd: traffic control verdict
453 * @hash: the packet hash 474 * @hash: the packet hash
454 * @queue_mapping: Queue mapping for multiqueue devices 475 * @queue_mapping: Queue mapping for multiqueue devices
476 * @xmit_more: More SKBs are pending for this queue
455 * @ndisc_nodetype: router type (from link layer) 477 * @ndisc_nodetype: router type (from link layer)
456 * @ooo_okay: allow the mapping of a socket to a queue to be changed 478 * @ooo_okay: allow the mapping of a socket to a queue to be changed
457 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport 479 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport
@@ -460,8 +482,6 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
460 * @wifi_acked_valid: wifi_acked was set 482 * @wifi_acked_valid: wifi_acked was set
461 * @wifi_acked: whether frame was acked on wifi or not 483 * @wifi_acked: whether frame was acked on wifi or not
462 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS 484 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
463 * @dma_cookie: a cookie to one of several possible DMA operations
464 * done by skb DMA functions
465 * @napi_id: id of the NAPI struct this skb came from 485 * @napi_id: id of the NAPI struct this skb came from
466 * @secmark: security marking 486 * @secmark: security marking
467 * @mark: Generic packet mark 487 * @mark: Generic packet mark
@@ -505,87 +525,101 @@ struct sk_buff {
505 char cb[48] __aligned(8); 525 char cb[48] __aligned(8);
506 526
507 unsigned long _skb_refdst; 527 unsigned long _skb_refdst;
528 void (*destructor)(struct sk_buff *skb);
508#ifdef CONFIG_XFRM 529#ifdef CONFIG_XFRM
509 struct sec_path *sp; 530 struct sec_path *sp;
510#endif 531#endif
532#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
533 struct nf_conntrack *nfct;
534#endif
535#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
536 struct nf_bridge_info *nf_bridge;
537#endif
511 unsigned int len, 538 unsigned int len,
512 data_len; 539 data_len;
513 __u16 mac_len, 540 __u16 mac_len,
514 hdr_len; 541 hdr_len;
515 union { 542
516 __wsum csum; 543 /* Following fields are _not_ copied in __copy_skb_header()
517 struct { 544 * Note that queue_mapping is here mostly to fill a hole.
518 __u16 csum_start; 545 */
519 __u16 csum_offset;
520 };
521 };
522 __u32 priority;
523 kmemcheck_bitfield_begin(flags1); 546 kmemcheck_bitfield_begin(flags1);
524 __u8 ignore_df:1, 547 __u16 queue_mapping;
525 cloned:1, 548 __u8 cloned:1,
526 ip_summed:2,
527 nohdr:1, 549 nohdr:1,
528 nfctinfo:3;
529 __u8 pkt_type:3,
530 fclone:2, 550 fclone:2,
531 ipvs_property:1,
532 peeked:1, 551 peeked:1,
533 nf_trace:1; 552 head_frag:1,
553 xmit_more:1;
554 /* one bit hole */
534 kmemcheck_bitfield_end(flags1); 555 kmemcheck_bitfield_end(flags1);
535 __be16 protocol;
536 556
537 void (*destructor)(struct sk_buff *skb); 557 /* fields enclosed in headers_start/headers_end are copied
538#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 558 * using a single memcpy() in __copy_skb_header()
539 struct nf_conntrack *nfct; 559 */
540#endif 560 /* private: */
541#ifdef CONFIG_BRIDGE_NETFILTER 561 __u32 headers_start[0];
542 struct nf_bridge_info *nf_bridge; 562 /* public: */
543#endif
544
545 int skb_iif;
546
547 __u32 hash;
548
549 __be16 vlan_proto;
550 __u16 vlan_tci;
551 563
552#ifdef CONFIG_NET_SCHED 564/* if you move pkt_type around you also must adapt those constants */
553 __u16 tc_index; /* traffic control index */ 565#ifdef __BIG_ENDIAN_BITFIELD
554#ifdef CONFIG_NET_CLS_ACT 566#define PKT_TYPE_MAX (7 << 5)
555 __u16 tc_verd; /* traffic control verdict */ 567#else
556#endif 568#define PKT_TYPE_MAX 7
557#endif 569#endif
570#define PKT_TYPE_OFFSET() offsetof(struct sk_buff, __pkt_type_offset)
558 571
559 __u16 queue_mapping; 572 __u8 __pkt_type_offset[0];
560 kmemcheck_bitfield_begin(flags2); 573 __u8 pkt_type:3;
561#ifdef CONFIG_IPV6_NDISC_NODETYPE
562 __u8 ndisc_nodetype:2;
563#endif
564 __u8 pfmemalloc:1; 574 __u8 pfmemalloc:1;
575 __u8 ignore_df:1;
576 __u8 nfctinfo:3;
577
578 __u8 nf_trace:1;
579 __u8 ip_summed:2;
565 __u8 ooo_okay:1; 580 __u8 ooo_okay:1;
566 __u8 l4_hash:1; 581 __u8 l4_hash:1;
567 __u8 sw_hash:1; 582 __u8 sw_hash:1;
568 __u8 wifi_acked_valid:1; 583 __u8 wifi_acked_valid:1;
569 __u8 wifi_acked:1; 584 __u8 wifi_acked:1;
585
570 __u8 no_fcs:1; 586 __u8 no_fcs:1;
571 __u8 head_frag:1; 587 /* Indicates the inner headers are valid in the skbuff. */
572 /* Encapsulation protocol and NIC drivers should use
573 * this flag to indicate to each other if the skb contains
574 * encapsulated packet or not and maybe use the inner packet
575 * headers if needed
576 */
577 __u8 encapsulation:1; 588 __u8 encapsulation:1;
578 __u8 encap_hdr_csum:1; 589 __u8 encap_hdr_csum:1;
579 __u8 csum_valid:1; 590 __u8 csum_valid:1;
580 __u8 csum_complete_sw:1; 591 __u8 csum_complete_sw:1;
581 /* 2/4 bit hole (depending on ndisc_nodetype presence) */ 592 __u8 csum_level:2;
582 kmemcheck_bitfield_end(flags2); 593 __u8 csum_bad:1;
594
595#ifdef CONFIG_IPV6_NDISC_NODETYPE
596 __u8 ndisc_nodetype:2;
597#endif
598 __u8 ipvs_property:1;
599 __u8 inner_protocol_type:1;
600 /* 4 or 6 bit hole */
601
602#ifdef CONFIG_NET_SCHED
603 __u16 tc_index; /* traffic control index */
604#ifdef CONFIG_NET_CLS_ACT
605 __u16 tc_verd; /* traffic control verdict */
606#endif
607#endif
583 608
584#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL
585 union { 609 union {
586 unsigned int napi_id; 610 __wsum csum;
587 dma_cookie_t dma_cookie; 611 struct {
612 __u16 csum_start;
613 __u16 csum_offset;
614 };
588 }; 615 };
616 __u32 priority;
617 int skb_iif;
618 __u32 hash;
619 __be16 vlan_proto;
620 __u16 vlan_tci;
621#ifdef CONFIG_NET_RX_BUSY_POLL
622 unsigned int napi_id;
589#endif 623#endif
590#ifdef CONFIG_NETWORK_SECMARK 624#ifdef CONFIG_NETWORK_SECMARK
591 __u32 secmark; 625 __u32 secmark;
@@ -596,13 +630,24 @@ struct sk_buff {
596 __u32 reserved_tailroom; 630 __u32 reserved_tailroom;
597 }; 631 };
598 632
599 __be16 inner_protocol; 633 union {
634 __be16 inner_protocol;
635 __u8 inner_ipproto;
636 };
637
600 __u16 inner_transport_header; 638 __u16 inner_transport_header;
601 __u16 inner_network_header; 639 __u16 inner_network_header;
602 __u16 inner_mac_header; 640 __u16 inner_mac_header;
641
642 __be16 protocol;
603 __u16 transport_header; 643 __u16 transport_header;
604 __u16 network_header; 644 __u16 network_header;
605 __u16 mac_header; 645 __u16 mac_header;
646
647 /* private: */
648 __u32 headers_end[0];
649 /* public: */
650
606 /* These elements must be at the end, see alloc_skb() for details. */ 651 /* These elements must be at the end, see alloc_skb() for details. */
607 sk_buff_data_t tail; 652 sk_buff_data_t tail;
608 sk_buff_data_t end; 653 sk_buff_data_t end;
@@ -734,6 +779,41 @@ static inline struct sk_buff *alloc_skb(unsigned int size,
734 return __alloc_skb(size, priority, 0, NUMA_NO_NODE); 779 return __alloc_skb(size, priority, 0, NUMA_NO_NODE);
735} 780}
736 781
782struct sk_buff *alloc_skb_with_frags(unsigned long header_len,
783 unsigned long data_len,
784 int max_page_order,
785 int *errcode,
786 gfp_t gfp_mask);
787
788/* Layout of fast clones : [skb1][skb2][fclone_ref] */
789struct sk_buff_fclones {
790 struct sk_buff skb1;
791
792 struct sk_buff skb2;
793
794 atomic_t fclone_ref;
795};
796
797/**
798 * skb_fclone_busy - check if fclone is busy
799 * @skb: buffer
800 *
801 * Returns true is skb is a fast clone, and its clone is not freed.
802 * Some drivers call skb_orphan() in their ndo_start_xmit(),
803 * so we also check that this didnt happen.
804 */
805static inline bool skb_fclone_busy(const struct sock *sk,
806 const struct sk_buff *skb)
807{
808 const struct sk_buff_fclones *fclones;
809
810 fclones = container_of(skb, struct sk_buff_fclones, skb1);
811
812 return skb->fclone == SKB_FCLONE_ORIG &&
813 fclones->skb2.fclone == SKB_FCLONE_CLONE &&
814 fclones->skb2.sk == sk;
815}
816
737static inline struct sk_buff *alloc_skb_fclone(unsigned int size, 817static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
738 gfp_t priority) 818 gfp_t priority)
739{ 819{
@@ -1042,6 +1122,7 @@ static inline int skb_header_cloned(const struct sk_buff *skb)
1042 * Drop a reference to the header part of the buffer. This is done 1122 * Drop a reference to the header part of the buffer. This is done
1043 * by acquiring a payload reference. You must not read from the header 1123 * by acquiring a payload reference. You must not read from the header
1044 * part of skb->data after this. 1124 * part of skb->data after this.
1125 * Note : Check if you can use __skb_header_release() instead.
1045 */ 1126 */
1046static inline void skb_header_release(struct sk_buff *skb) 1127static inline void skb_header_release(struct sk_buff *skb)
1047{ 1128{
@@ -1051,6 +1132,20 @@ static inline void skb_header_release(struct sk_buff *skb)
1051} 1132}
1052 1133
1053/** 1134/**
1135 * __skb_header_release - release reference to header
1136 * @skb: buffer to operate on
1137 *
1138 * Variant of skb_header_release() assuming skb is private to caller.
1139 * We can avoid one atomic operation.
1140 */
1141static inline void __skb_header_release(struct sk_buff *skb)
1142{
1143 skb->nohdr = 1;
1144 atomic_set(&skb_shinfo(skb)->dataref, 1 + (1 << SKB_DATAREF_SHIFT));
1145}
1146
1147
1148/**
1054 * skb_shared - is the buffer shared 1149 * skb_shared - is the buffer shared
1055 * @skb: buffer to check 1150 * @skb: buffer to check
1056 * 1151 *
@@ -1116,7 +1211,12 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
1116 might_sleep_if(pri & __GFP_WAIT); 1211 might_sleep_if(pri & __GFP_WAIT);
1117 if (skb_cloned(skb)) { 1212 if (skb_cloned(skb)) {
1118 struct sk_buff *nskb = skb_copy(skb, pri); 1213 struct sk_buff *nskb = skb_copy(skb, pri);
1119 kfree_skb(skb); /* Free our shared copy */ 1214
1215 /* Free our shared copy */
1216 if (likely(nskb))
1217 consume_skb(skb);
1218 else
1219 kfree_skb(skb);
1120 skb = nskb; 1220 skb = nskb;
1121 } 1221 }
1122 return skb; 1222 return skb;
@@ -1675,6 +1775,23 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
1675 skb->tail += len; 1775 skb->tail += len;
1676} 1776}
1677 1777
1778#define ENCAP_TYPE_ETHER 0
1779#define ENCAP_TYPE_IPPROTO 1
1780
1781static inline void skb_set_inner_protocol(struct sk_buff *skb,
1782 __be16 protocol)
1783{
1784 skb->inner_protocol = protocol;
1785 skb->inner_protocol_type = ENCAP_TYPE_ETHER;
1786}
1787
1788static inline void skb_set_inner_ipproto(struct sk_buff *skb,
1789 __u8 ipproto)
1790{
1791 skb->inner_ipproto = ipproto;
1792 skb->inner_protocol_type = ENCAP_TYPE_IPPROTO;
1793}
1794
1678static inline void skb_reset_inner_headers(struct sk_buff *skb) 1795static inline void skb_reset_inner_headers(struct sk_buff *skb)
1679{ 1796{
1680 skb->inner_mac_header = skb->mac_header; 1797 skb->inner_mac_header = skb->mac_header;
@@ -1860,18 +1977,6 @@ static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len)
1860 return pskb_may_pull(skb, skb_network_offset(skb) + len); 1977 return pskb_may_pull(skb, skb_network_offset(skb) + len);
1861} 1978}
1862 1979
1863static inline void skb_pop_rcv_encapsulation(struct sk_buff *skb)
1864{
1865 /* Only continue with checksum unnecessary if device indicated
1866 * it is valid across encapsulation (skb->encapsulation was set).
1867 */
1868 if (skb->ip_summed == CHECKSUM_UNNECESSARY && !skb->encapsulation)
1869 skb->ip_summed = CHECKSUM_NONE;
1870
1871 skb->encapsulation = 0;
1872 skb->csum_valid = 0;
1873}
1874
1875/* 1980/*
1876 * CPUs often take a performance hit when accessing unaligned memory 1981 * CPUs often take a performance hit when accessing unaligned memory
1877 * locations. The actual performance hit varies, it can be small if the 1982 * locations. The actual performance hit varies, it can be small if the
@@ -2555,6 +2660,7 @@ int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen);
2555void skb_scrub_packet(struct sk_buff *skb, bool xnet); 2660void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2556unsigned int skb_gso_transport_seglen(const struct sk_buff *skb); 2661unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
2557struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features); 2662struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
2663struct sk_buff *skb_vlan_untag(struct sk_buff *skb);
2558 2664
2559struct skb_checksum_ops { 2665struct skb_checksum_ops {
2560 __wsum (*update)(const void *mem, int len, __wsum wsum); 2666 __wsum (*update)(const void *mem, int len, __wsum wsum);
@@ -2566,20 +2672,26 @@ __wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
2566__wsum skb_checksum(const struct sk_buff *skb, int offset, int len, 2672__wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
2567 __wsum csum); 2673 __wsum csum);
2568 2674
2569static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 2675static inline void *__skb_header_pointer(const struct sk_buff *skb, int offset,
2570 int len, void *buffer) 2676 int len, void *data, int hlen, void *buffer)
2571{ 2677{
2572 int hlen = skb_headlen(skb);
2573
2574 if (hlen - offset >= len) 2678 if (hlen - offset >= len)
2575 return skb->data + offset; 2679 return data + offset;
2576 2680
2577 if (skb_copy_bits(skb, offset, buffer, len) < 0) 2681 if (!skb ||
2682 skb_copy_bits(skb, offset, buffer, len) < 0)
2578 return NULL; 2683 return NULL;
2579 2684
2580 return buffer; 2685 return buffer;
2581} 2686}
2582 2687
2688static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
2689 int len, void *buffer)
2690{
2691 return __skb_header_pointer(skb, offset, len, skb->data,
2692 skb_headlen(skb), buffer);
2693}
2694
2583/** 2695/**
2584 * skb_needs_linearize - check if we need to linearize a given skb 2696 * skb_needs_linearize - check if we need to linearize a given skb
2585 * depending on the given device features. 2697 * depending on the given device features.
@@ -2670,6 +2782,8 @@ static inline ktime_t net_invalid_timestamp(void)
2670 return ktime_set(0, 0); 2782 return ktime_set(0, 0);
2671} 2783}
2672 2784
2785struct sk_buff *skb_clone_sk(struct sk_buff *skb);
2786
2673#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING 2787#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
2674 2788
2675void skb_clone_tx_timestamp(struct sk_buff *skb); 2789void skb_clone_tx_timestamp(struct sk_buff *skb);
@@ -2785,6 +2899,42 @@ static inline __sum16 skb_checksum_complete(struct sk_buff *skb)
2785 0 : __skb_checksum_complete(skb); 2899 0 : __skb_checksum_complete(skb);
2786} 2900}
2787 2901
2902static inline void __skb_decr_checksum_unnecessary(struct sk_buff *skb)
2903{
2904 if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
2905 if (skb->csum_level == 0)
2906 skb->ip_summed = CHECKSUM_NONE;
2907 else
2908 skb->csum_level--;
2909 }
2910}
2911
2912static inline void __skb_incr_checksum_unnecessary(struct sk_buff *skb)
2913{
2914 if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
2915 if (skb->csum_level < SKB_MAX_CSUM_LEVEL)
2916 skb->csum_level++;
2917 } else if (skb->ip_summed == CHECKSUM_NONE) {
2918 skb->ip_summed = CHECKSUM_UNNECESSARY;
2919 skb->csum_level = 0;
2920 }
2921}
2922
2923static inline void __skb_mark_checksum_bad(struct sk_buff *skb)
2924{
2925 /* Mark current checksum as bad (typically called from GRO
2926 * path). In the case that ip_summed is CHECKSUM_NONE
2927 * this must be the first checksum encountered in the packet.
2928 * When ip_summed is CHECKSUM_UNNECESSARY, this is the first
2929 * checksum after the last one validated. For UDP, a zero
2930 * checksum can not be marked as bad.
2931 */
2932
2933 if (skb->ip_summed == CHECKSUM_NONE ||
2934 skb->ip_summed == CHECKSUM_UNNECESSARY)
2935 skb->csum_bad = 1;
2936}
2937
2788/* Check if we need to perform checksum complete validation. 2938/* Check if we need to perform checksum complete validation.
2789 * 2939 *
2790 * Returns true if checksum complete is needed, false otherwise 2940 * Returns true if checksum complete is needed, false otherwise
@@ -2796,6 +2946,7 @@ static inline bool __skb_checksum_validate_needed(struct sk_buff *skb,
2796{ 2946{
2797 if (skb_csum_unnecessary(skb) || (zero_okay && !check)) { 2947 if (skb_csum_unnecessary(skb) || (zero_okay && !check)) {
2798 skb->csum_valid = 1; 2948 skb->csum_valid = 1;
2949 __skb_decr_checksum_unnecessary(skb);
2799 return false; 2950 return false;
2800 } 2951 }
2801 2952
@@ -2825,6 +2976,9 @@ static inline __sum16 __skb_checksum_validate_complete(struct sk_buff *skb,
2825 skb->csum_valid = 1; 2976 skb->csum_valid = 1;
2826 return 0; 2977 return 0;
2827 } 2978 }
2979 } else if (skb->csum_bad) {
2980 /* ip_summed == CHECKSUM_NONE in this case */
2981 return 1;
2828 } 2982 }
2829 2983
2830 skb->csum = psum; 2984 skb->csum = psum;
@@ -2882,6 +3036,26 @@ static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto)
2882#define skb_checksum_simple_validate(skb) \ 3036#define skb_checksum_simple_validate(skb) \
2883 __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo) 3037 __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo)
2884 3038
3039static inline bool __skb_checksum_convert_check(struct sk_buff *skb)
3040{
3041 return (skb->ip_summed == CHECKSUM_NONE &&
3042 skb->csum_valid && !skb->csum_bad);
3043}
3044
3045static inline void __skb_checksum_convert(struct sk_buff *skb,
3046 __sum16 check, __wsum pseudo)
3047{
3048 skb->csum = ~pseudo;
3049 skb->ip_summed = CHECKSUM_COMPLETE;
3050}
3051
3052#define skb_checksum_try_convert(skb, proto, check, compute_pseudo) \
3053do { \
3054 if (__skb_checksum_convert_check(skb)) \
3055 __skb_checksum_convert(skb, check, \
3056 compute_pseudo(skb, proto)); \
3057} while (0)
3058
2885#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 3059#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2886void nf_conntrack_destroy(struct nf_conntrack *nfct); 3060void nf_conntrack_destroy(struct nf_conntrack *nfct);
2887static inline void nf_conntrack_put(struct nf_conntrack *nfct) 3061static inline void nf_conntrack_put(struct nf_conntrack *nfct)
@@ -2895,7 +3069,7 @@ static inline void nf_conntrack_get(struct nf_conntrack *nfct)
2895 atomic_inc(&nfct->use); 3069 atomic_inc(&nfct->use);
2896} 3070}
2897#endif 3071#endif
2898#ifdef CONFIG_BRIDGE_NETFILTER 3072#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
2899static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge) 3073static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
2900{ 3074{
2901 if (nf_bridge && atomic_dec_and_test(&nf_bridge->use)) 3075 if (nf_bridge && atomic_dec_and_test(&nf_bridge->use))
@@ -2913,7 +3087,7 @@ static inline void nf_reset(struct sk_buff *skb)
2913 nf_conntrack_put(skb->nfct); 3087 nf_conntrack_put(skb->nfct);
2914 skb->nfct = NULL; 3088 skb->nfct = NULL;
2915#endif 3089#endif
2916#ifdef CONFIG_BRIDGE_NETFILTER 3090#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
2917 nf_bridge_put(skb->nf_bridge); 3091 nf_bridge_put(skb->nf_bridge);
2918 skb->nf_bridge = NULL; 3092 skb->nf_bridge = NULL;
2919#endif 3093#endif
@@ -2927,19 +3101,22 @@ static inline void nf_reset_trace(struct sk_buff *skb)
2927} 3101}
2928 3102
2929/* Note: This doesn't put any conntrack and bridge info in dst. */ 3103/* Note: This doesn't put any conntrack and bridge info in dst. */
2930static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src) 3104static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src,
3105 bool copy)
2931{ 3106{
2932#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 3107#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2933 dst->nfct = src->nfct; 3108 dst->nfct = src->nfct;
2934 nf_conntrack_get(src->nfct); 3109 nf_conntrack_get(src->nfct);
2935 dst->nfctinfo = src->nfctinfo; 3110 if (copy)
3111 dst->nfctinfo = src->nfctinfo;
2936#endif 3112#endif
2937#ifdef CONFIG_BRIDGE_NETFILTER 3113#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
2938 dst->nf_bridge = src->nf_bridge; 3114 dst->nf_bridge = src->nf_bridge;
2939 nf_bridge_get(src->nf_bridge); 3115 nf_bridge_get(src->nf_bridge);
2940#endif 3116#endif
2941#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) || defined(CONFIG_NF_TABLES) 3117#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) || defined(CONFIG_NF_TABLES)
2942 dst->nf_trace = src->nf_trace; 3118 if (copy)
3119 dst->nf_trace = src->nf_trace;
2943#endif 3120#endif
2944} 3121}
2945 3122
@@ -2948,10 +3125,10 @@ static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src)
2948#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 3125#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2949 nf_conntrack_put(dst->nfct); 3126 nf_conntrack_put(dst->nfct);
2950#endif 3127#endif
2951#ifdef CONFIG_BRIDGE_NETFILTER 3128#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
2952 nf_bridge_put(dst->nf_bridge); 3129 nf_bridge_put(dst->nf_bridge);
2953#endif 3130#endif
2954 __nf_copy(dst, src); 3131 __nf_copy(dst, src, true);
2955} 3132}
2956 3133
2957#ifdef CONFIG_NETWORK_SECMARK 3134#ifdef CONFIG_NETWORK_SECMARK
@@ -3136,7 +3313,9 @@ bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
3136 3313
3137int skb_checksum_setup(struct sk_buff *skb, bool recalculate); 3314int skb_checksum_setup(struct sk_buff *skb, bool recalculate);
3138 3315
3139u32 __skb_get_poff(const struct sk_buff *skb); 3316u32 skb_get_poff(const struct sk_buff *skb);
3317u32 __skb_get_poff(const struct sk_buff *skb, void *data,
3318 const struct flow_keys *keys, int hlen);
3140 3319
3141/** 3320/**
3142 * skb_head_is_locked - Determine if the skb->head is locked down 3321 * skb_head_is_locked - Determine if the skb->head is locked down
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 1d9abb7d22a0..c265bec6a57d 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -158,31 +158,6 @@ size_t ksize(const void *);
158#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) 158#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
159#endif 159#endif
160 160
161#ifdef CONFIG_SLOB
162/*
163 * Common fields provided in kmem_cache by all slab allocators
164 * This struct is either used directly by the allocator (SLOB)
165 * or the allocator must include definitions for all fields
166 * provided in kmem_cache_common in their definition of kmem_cache.
167 *
168 * Once we can do anonymous structs (C11 standard) we could put a
169 * anonymous struct definition in these allocators so that the
170 * separate allocations in the kmem_cache structure of SLAB and
171 * SLUB is no longer needed.
172 */
173struct kmem_cache {
174 unsigned int object_size;/* The original size of the object */
175 unsigned int size; /* The aligned/padded/added on size */
176 unsigned int align; /* Alignment as calculated */
177 unsigned long flags; /* Active flags on the slab */
178 const char *name; /* Slab name for sysfs */
179 int refcount; /* Use counter */
180 void (*ctor)(void *); /* Called on object slot creation */
181 struct list_head list; /* List of all slab caches on the system */
182};
183
184#endif /* CONFIG_SLOB */
185
186/* 161/*
187 * Kmalloc array related definitions 162 * Kmalloc array related definitions
188 */ 163 */
@@ -363,14 +338,6 @@ kmem_cache_alloc_node_trace(struct kmem_cache *s,
363} 338}
364#endif /* CONFIG_TRACING */ 339#endif /* CONFIG_TRACING */
365 340
366#ifdef CONFIG_SLAB
367#include <linux/slab_def.h>
368#endif
369
370#ifdef CONFIG_SLUB
371#include <linux/slub_def.h>
372#endif
373
374extern void *kmalloc_order(size_t size, gfp_t flags, unsigned int order); 341extern void *kmalloc_order(size_t size, gfp_t flags, unsigned int order);
375 342
376#ifdef CONFIG_TRACING 343#ifdef CONFIG_TRACING
@@ -582,37 +549,15 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
582 * allocator where we care about the real place the memory allocation 549 * allocator where we care about the real place the memory allocation
583 * request comes from. 550 * request comes from.
584 */ 551 */
585#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
586 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \
587 (defined(CONFIG_SLOB) && defined(CONFIG_TRACING))
588extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long); 552extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
589#define kmalloc_track_caller(size, flags) \ 553#define kmalloc_track_caller(size, flags) \
590 __kmalloc_track_caller(size, flags, _RET_IP_) 554 __kmalloc_track_caller(size, flags, _RET_IP_)
591#else
592#define kmalloc_track_caller(size, flags) \
593 __kmalloc(size, flags)
594#endif /* DEBUG_SLAB */
595 555
596#ifdef CONFIG_NUMA 556#ifdef CONFIG_NUMA
597/*
598 * kmalloc_node_track_caller is a special version of kmalloc_node that
599 * records the calling function of the routine calling it for slab leak
600 * tracking instead of just the calling function (confusing, eh?).
601 * It's useful when the call to kmalloc_node comes from a widely-used
602 * standard allocator where we care about the real place the memory
603 * allocation request comes from.
604 */
605#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
606 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \
607 (defined(CONFIG_SLOB) && defined(CONFIG_TRACING))
608extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long); 557extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long);
609#define kmalloc_node_track_caller(size, flags, node) \ 558#define kmalloc_node_track_caller(size, flags, node) \
610 __kmalloc_node_track_caller(size, flags, node, \ 559 __kmalloc_node_track_caller(size, flags, node, \
611 _RET_IP_) 560 _RET_IP_)
612#else
613#define kmalloc_node_track_caller(size, flags, node) \
614 __kmalloc_node(size, flags, node)
615#endif
616 561
617#else /* CONFIG_NUMA */ 562#else /* CONFIG_NUMA */
618 563
@@ -650,14 +595,7 @@ static inline void *kzalloc_node(size_t size, gfp_t flags, int node)
650 return kmalloc_node(size, flags | __GFP_ZERO, node); 595 return kmalloc_node(size, flags | __GFP_ZERO, node);
651} 596}
652 597
653/* 598unsigned int kmem_cache_size(struct kmem_cache *s);
654 * Determine the size of a slab object
655 */
656static inline unsigned int kmem_cache_size(struct kmem_cache *s)
657{
658 return s->object_size;
659}
660
661void __init kmem_cache_init_late(void); 599void __init kmem_cache_init_late(void);
662 600
663#endif /* _LINUX_SLAB_H */ 601#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 8235dfbb3b05..b869d1662ba3 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -8,6 +8,8 @@
8 */ 8 */
9 9
10struct kmem_cache { 10struct kmem_cache {
11 struct array_cache __percpu *cpu_cache;
12
11/* 1) Cache tunables. Protected by slab_mutex */ 13/* 1) Cache tunables. Protected by slab_mutex */
12 unsigned int batchcount; 14 unsigned int batchcount;
13 unsigned int limit; 15 unsigned int limit;
@@ -71,23 +73,7 @@ struct kmem_cache {
71 struct memcg_cache_params *memcg_params; 73 struct memcg_cache_params *memcg_params;
72#endif 74#endif
73 75
74/* 6) per-cpu/per-node data, touched during every alloc/free */ 76 struct kmem_cache_node *node[MAX_NUMNODES];
75 /*
76 * We put array[] at the end of kmem_cache, because we want to size
77 * this array to nr_cpu_ids slots instead of NR_CPUS
78 * (see kmem_cache_init())
79 * We still use [NR_CPUS] and not [1] or [0] because cache_cache
80 * is statically defined, so we reserve the max number of cpus.
81 *
82 * We also need to guarantee that the list is able to accomodate a
83 * pointer for each node since "nodelists" uses the remainder of
84 * available pointers.
85 */
86 struct kmem_cache_node **node;
87 struct array_cache *array[NR_CPUS + MAX_NUMNODES];
88 /*
89 * Do not add fields after array[]
90 */
91}; 77};
92 78
93#endif /* _LINUX_SLAB_DEF_H */ 79#endif /* _LINUX_SLAB_DEF_H */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 34347f26be9b..93dff5fff524 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -100,6 +100,7 @@ int smp_call_function_any(const struct cpumask *mask,
100 smp_call_func_t func, void *info, int wait); 100 smp_call_func_t func, void *info, int wait);
101 101
102void kick_all_cpus_sync(void); 102void kick_all_cpus_sync(void);
103void wake_up_all_idle_cpus(void);
103 104
104/* 105/*
105 * Generic and arch helpers 106 * Generic and arch helpers
@@ -148,6 +149,7 @@ smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,
148} 149}
149 150
150static inline void kick_all_cpus_sync(void) { } 151static inline void kick_all_cpus_sync(void) { }
152static inline void wake_up_all_idle_cpus(void) { }
151 153
152#endif /* !SMP */ 154#endif /* !SMP */
153 155
diff --git a/include/linux/soc/ti/knav_dma.h b/include/linux/soc/ti/knav_dma.h
new file mode 100644
index 000000000000..dad035c16d94
--- /dev/null
+++ b/include/linux/soc/ti/knav_dma.h
@@ -0,0 +1,175 @@
1/*
2 * Copyright (C) 2014 Texas Instruments Incorporated
3 * Authors: Sandeep Nair <sandeep_n@ti.com
4 * Cyril Chemparathy <cyril@ti.com
5 Santosh Shilimkar <santosh.shilimkar@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__
18#define __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__
19
20/*
21 * PKTDMA descriptor manipulation macros for host packet descriptor
22 */
23#define MASK(x) (BIT(x) - 1)
24#define KNAV_DMA_DESC_PKT_LEN_MASK MASK(22)
25#define KNAV_DMA_DESC_PKT_LEN_SHIFT 0
26#define KNAV_DMA_DESC_PS_INFO_IN_SOP BIT(22)
27#define KNAV_DMA_DESC_PS_INFO_IN_DESC 0
28#define KNAV_DMA_DESC_TAG_MASK MASK(8)
29#define KNAV_DMA_DESC_SAG_HI_SHIFT 24
30#define KNAV_DMA_DESC_STAG_LO_SHIFT 16
31#define KNAV_DMA_DESC_DTAG_HI_SHIFT 8
32#define KNAV_DMA_DESC_DTAG_LO_SHIFT 0
33#define KNAV_DMA_DESC_HAS_EPIB BIT(31)
34#define KNAV_DMA_DESC_NO_EPIB 0
35#define KNAV_DMA_DESC_PSLEN_SHIFT 24
36#define KNAV_DMA_DESC_PSLEN_MASK MASK(6)
37#define KNAV_DMA_DESC_ERR_FLAG_SHIFT 20
38#define KNAV_DMA_DESC_ERR_FLAG_MASK MASK(4)
39#define KNAV_DMA_DESC_PSFLAG_SHIFT 16
40#define KNAV_DMA_DESC_PSFLAG_MASK MASK(4)
41#define KNAV_DMA_DESC_RETQ_SHIFT 0
42#define KNAV_DMA_DESC_RETQ_MASK MASK(14)
43#define KNAV_DMA_DESC_BUF_LEN_MASK MASK(22)
44
45#define KNAV_DMA_NUM_EPIB_WORDS 4
46#define KNAV_DMA_NUM_PS_WORDS 16
47#define KNAV_DMA_FDQ_PER_CHAN 4
48
49/* Tx channel scheduling priority */
50enum knav_dma_tx_priority {
51 DMA_PRIO_HIGH = 0,
52 DMA_PRIO_MED_H,
53 DMA_PRIO_MED_L,
54 DMA_PRIO_LOW
55};
56
57/* Rx channel error handling mode during buffer starvation */
58enum knav_dma_rx_err_mode {
59 DMA_DROP = 0,
60 DMA_RETRY
61};
62
63/* Rx flow size threshold configuration */
64enum knav_dma_rx_thresholds {
65 DMA_THRESH_NONE = 0,
66 DMA_THRESH_0 = 1,
67 DMA_THRESH_0_1 = 3,
68 DMA_THRESH_0_1_2 = 7
69};
70
71/* Descriptor type */
72enum knav_dma_desc_type {
73 DMA_DESC_HOST = 0,
74 DMA_DESC_MONOLITHIC = 2
75};
76
77/**
78 * struct knav_dma_tx_cfg: Tx channel configuration
79 * @filt_einfo: Filter extended packet info
80 * @filt_pswords: Filter PS words present
81 * @knav_dma_tx_priority: Tx channel scheduling priority
82 */
83struct knav_dma_tx_cfg {
84 bool filt_einfo;
85 bool filt_pswords;
86 enum knav_dma_tx_priority priority;
87};
88
89/**
90 * struct knav_dma_rx_cfg: Rx flow configuration
91 * @einfo_present: Extended packet info present
92 * @psinfo_present: PS words present
93 * @knav_dma_rx_err_mode: Error during buffer starvation
94 * @knav_dma_desc_type: Host or Monolithic desc
95 * @psinfo_at_sop: PS word located at start of packet
96 * @sop_offset: Start of packet offset
97 * @dst_q: Destination queue for a given flow
98 * @thresh: Rx flow size threshold
99 * @fdq[]: Free desc Queue array
100 * @sz_thresh0: RX packet size threshold 0
101 * @sz_thresh1: RX packet size threshold 1
102 * @sz_thresh2: RX packet size threshold 2
103 */
104struct knav_dma_rx_cfg {
105 bool einfo_present;
106 bool psinfo_present;
107 enum knav_dma_rx_err_mode err_mode;
108 enum knav_dma_desc_type desc_type;
109 bool psinfo_at_sop;
110 unsigned int sop_offset;
111 unsigned int dst_q;
112 enum knav_dma_rx_thresholds thresh;
113 unsigned int fdq[KNAV_DMA_FDQ_PER_CHAN];
114 unsigned int sz_thresh0;
115 unsigned int sz_thresh1;
116 unsigned int sz_thresh2;
117};
118
119/**
120 * struct knav_dma_cfg: Pktdma channel configuration
121 * @sl_cfg: Slave configuration
122 * @tx: Tx channel configuration
123 * @rx: Rx flow configuration
124 */
125struct knav_dma_cfg {
126 enum dma_transfer_direction direction;
127 union {
128 struct knav_dma_tx_cfg tx;
129 struct knav_dma_rx_cfg rx;
130 } u;
131};
132
133/**
134 * struct knav_dma_desc: Host packet descriptor layout
135 * @desc_info: Descriptor information like id, type, length
136 * @tag_info: Flow tag info written in during RX
137 * @packet_info: Queue Manager, policy, flags etc
138 * @buff_len: Buffer length in bytes
139 * @buff: Buffer pointer
140 * @next_desc: For chaining the descriptors
141 * @orig_len: length since 'buff_len' can be overwritten
142 * @orig_buff: buff pointer since 'buff' can be overwritten
143 * @epib: Extended packet info block
144 * @psdata: Protocol specific
145 */
146struct knav_dma_desc {
147 u32 desc_info;
148 u32 tag_info;
149 u32 packet_info;
150 u32 buff_len;
151 u32 buff;
152 u32 next_desc;
153 u32 orig_len;
154 u32 orig_buff;
155 u32 epib[KNAV_DMA_NUM_EPIB_WORDS];
156 u32 psdata[KNAV_DMA_NUM_PS_WORDS];
157 u32 pad[4];
158} ____cacheline_aligned;
159
160#if IS_ENABLED(CONFIG_KEYSTONE_NAVIGATOR_DMA)
161void *knav_dma_open_channel(struct device *dev, const char *name,
162 struct knav_dma_cfg *config);
163void knav_dma_close_channel(void *channel);
164#else
165static inline void *knav_dma_open_channel(struct device *dev, const char *name,
166 struct knav_dma_cfg *config)
167{
168 return (void *) NULL;
169}
170static inline void knav_dma_close_channel(void *channel)
171{}
172
173#endif
174
175#endif /* __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__ */
diff --git a/include/linux/soc/ti/knav_qmss.h b/include/linux/soc/ti/knav_qmss.h
new file mode 100644
index 000000000000..9f0ebb3bad27
--- /dev/null
+++ b/include/linux/soc/ti/knav_qmss.h
@@ -0,0 +1,90 @@
1/*
2 * Keystone Navigator Queue Management Sub-System header
3 *
4 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
5 * Author: Sandeep Nair <sandeep_n@ti.com>
6 * Cyril Chemparathy <cyril@ti.com>
7 * Santosh Shilimkar <santosh.shilimkar@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#ifndef __SOC_TI_KNAV_QMSS_H__
20#define __SOC_TI_KNAV_QMSS_H__
21
22#include <linux/err.h>
23#include <linux/time.h>
24#include <linux/atomic.h>
25#include <linux/device.h>
26#include <linux/fcntl.h>
27#include <linux/dma-mapping.h>
28
29/* queue types */
30#define KNAV_QUEUE_QPEND ((unsigned)-2) /* interruptible qpend queue */
31#define KNAV_QUEUE_ACC ((unsigned)-3) /* Accumulated queue */
32#define KNAV_QUEUE_GP ((unsigned)-4) /* General purpose queue */
33
34/* queue flags */
35#define KNAV_QUEUE_SHARED 0x0001 /* Queue can be shared */
36
37/**
38 * enum knav_queue_ctrl_cmd - queue operations.
39 * @KNAV_QUEUE_GET_ID: Get the ID number for an open queue
40 * @KNAV_QUEUE_FLUSH: forcibly empty a queue if possible
41 * @KNAV_QUEUE_SET_NOTIFIER: Set a notifier callback to a queue handle.
42 * @KNAV_QUEUE_ENABLE_NOTIFY: Enable notifier callback for a queue handle.
43 * @KNAV_QUEUE_DISABLE_NOTIFY: Disable notifier callback for a queue handle.
44 * @KNAV_QUEUE_GET_COUNT: Get number of queues.
45 */
46enum knav_queue_ctrl_cmd {
47 KNAV_QUEUE_GET_ID,
48 KNAV_QUEUE_FLUSH,
49 KNAV_QUEUE_SET_NOTIFIER,
50 KNAV_QUEUE_ENABLE_NOTIFY,
51 KNAV_QUEUE_DISABLE_NOTIFY,
52 KNAV_QUEUE_GET_COUNT
53};
54
55/* Queue notifier callback prototype */
56typedef void (*knav_queue_notify_fn)(void *arg);
57
58/**
59 * struct knav_queue_notify_config: Notifier configuration
60 * @fn: Notifier function
61 * @fn_arg: Notifier function arguments
62 */
63struct knav_queue_notify_config {
64 knav_queue_notify_fn fn;
65 void *fn_arg;
66};
67
68void *knav_queue_open(const char *name, unsigned id,
69 unsigned flags);
70void knav_queue_close(void *qhandle);
71int knav_queue_device_control(void *qhandle,
72 enum knav_queue_ctrl_cmd cmd,
73 unsigned long arg);
74dma_addr_t knav_queue_pop(void *qhandle, unsigned *size);
75int knav_queue_push(void *qhandle, dma_addr_t dma,
76 unsigned size, unsigned flags);
77
78void *knav_pool_create(const char *name,
79 int num_desc, int region_id);
80void knav_pool_destroy(void *ph);
81int knav_pool_count(void *ph);
82void *knav_pool_desc_get(void *ph);
83void knav_pool_desc_put(void *ph, void *desc);
84int knav_pool_desc_map(void *ph, void *desc, unsigned size,
85 dma_addr_t *dma, unsigned *dma_sz);
86void *knav_pool_desc_unmap(void *ph, dma_addr_t dma, unsigned dma_sz);
87dma_addr_t knav_pool_desc_virt_to_dma(void *ph, void *virt);
88void *knav_pool_desc_dma_to_virt(void *ph, dma_addr_t dma);
89
90#endif /* __SOC_TI_KNAV_QMSS_H__ */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index ec538fc287a6..bb9b83640070 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -256,7 +256,7 @@ struct ucred {
256#define MSG_EOF MSG_FIN 256#define MSG_EOF MSG_FIN
257 257
258#define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */ 258#define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */
259#define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file 259#define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exec for file
260 descriptor received through 260 descriptor received through
261 SCM_RIGHTS */ 261 SCM_RIGHTS */
262#if defined(CONFIG_COMPAT) 262#if defined(CONFIG_COMPAT)
diff --git a/include/linux/spi/mcp23s08.h b/include/linux/spi/mcp23s08.h
index 2d676d5aaa89..aa07d7b32568 100644
--- a/include/linux/spi/mcp23s08.h
+++ b/include/linux/spi/mcp23s08.h
@@ -22,4 +22,22 @@ struct mcp23s08_platform_data {
22 * base to base+15 (or base+31 for s17 variant). 22 * base to base+15 (or base+31 for s17 variant).
23 */ 23 */
24 unsigned base; 24 unsigned base;
25 /* Marks the device as a interrupt controller.
26 * NOTE: The interrupt functionality is only supported for i2c
27 * versions of the chips. The spi chips can also do the interrupts,
28 * but this is not supported by the linux driver yet.
29 */
30 bool irq_controller;
31
32 /* Sets the mirror flag in the IOCON register. Devices
33 * with two interrupt outputs (these are the devices ending with 17 and
34 * those that have 16 IOs) have two IO banks: IO 0-7 form bank 1 and
35 * IO 8-15 are bank 2. These chips have two different interrupt outputs:
36 * One for bank 1 and another for bank 2. If irq-mirror is set, both
37 * interrupts are generated regardless of the bank that an input change
38 * occurred on. If it is not set, the interrupt are only generated for
39 * the bank they belong to.
40 * On devices with only one interrupt output this property is useless.
41 */
42 bool mirror;
25}; 43};
diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h
index 82d5111cd0c2..d5a316550177 100644
--- a/include/linux/spi/pxa2xx_spi.h
+++ b/include/linux/spi/pxa2xx_spi.h
@@ -23,6 +23,8 @@
23#define PXA2XX_CS_ASSERT (0x01) 23#define PXA2XX_CS_ASSERT (0x01)
24#define PXA2XX_CS_DEASSERT (0x02) 24#define PXA2XX_CS_DEASSERT (0x02)
25 25
26struct dma_chan;
27
26/* device.platform_data for SSP controller devices */ 28/* device.platform_data for SSP controller devices */
27struct pxa2xx_spi_master { 29struct pxa2xx_spi_master {
28 u32 clock_enable; 30 u32 clock_enable;
@@ -30,10 +32,9 @@ struct pxa2xx_spi_master {
30 u8 enable_dma; 32 u8 enable_dma;
31 33
32 /* DMA engine specific config */ 34 /* DMA engine specific config */
33 int rx_chan_id; 35 bool (*dma_filter)(struct dma_chan *chan, void *param);
34 int tx_chan_id; 36 void *tx_param;
35 int rx_slave_id; 37 void *rx_param;
36 int tx_slave_id;
37 38
38 /* For non-PXA arches */ 39 /* For non-PXA arches */
39 struct ssp_device ssp; 40 struct ssp_device ssp;
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index e713543336f1..46d188a9947c 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -253,6 +253,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
253 * the device whose settings are being modified. 253 * the device whose settings are being modified.
254 * @transfer: adds a message to the controller's transfer queue. 254 * @transfer: adds a message to the controller's transfer queue.
255 * @cleanup: frees controller-specific state 255 * @cleanup: frees controller-specific state
256 * @can_dma: determine whether this master supports DMA
256 * @queued: whether this master is providing an internal message queue 257 * @queued: whether this master is providing an internal message queue
257 * @kworker: thread struct for message pump 258 * @kworker: thread struct for message pump
258 * @kworker_task: pointer to task for message pump kworker thread 259 * @kworker_task: pointer to task for message pump kworker thread
@@ -262,6 +263,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
262 * @cur_msg: the currently in-flight message 263 * @cur_msg: the currently in-flight message
263 * @cur_msg_prepared: spi_prepare_message was called for the currently 264 * @cur_msg_prepared: spi_prepare_message was called for the currently
264 * in-flight message 265 * in-flight message
266 * @cur_msg_mapped: message has been mapped for DMA
265 * @xfer_completion: used by core transfer_one_message() 267 * @xfer_completion: used by core transfer_one_message()
266 * @busy: message pump is busy 268 * @busy: message pump is busy
267 * @running: message pump is running 269 * @running: message pump is running
@@ -299,6 +301,10 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
299 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS 301 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
300 * number. Any individual value may be -ENOENT for CS lines that 302 * number. Any individual value may be -ENOENT for CS lines that
301 * are not GPIOs (driven by the SPI controller itself). 303 * are not GPIOs (driven by the SPI controller itself).
304 * @dma_tx: DMA transmit channel
305 * @dma_rx: DMA receive channel
306 * @dummy_rx: dummy receive buffer for full-duplex devices
307 * @dummy_tx: dummy transmit buffer for full-duplex devices
302 * 308 *
303 * Each SPI master controller can communicate with one or more @spi_device 309 * Each SPI master controller can communicate with one or more @spi_device
304 * children. These make a small bus, sharing MOSI, MISO and SCK signals 310 * children. These make a small bus, sharing MOSI, MISO and SCK signals
@@ -632,6 +638,7 @@ struct spi_transfer {
632 * addresses for each transfer buffer 638 * addresses for each transfer buffer
633 * @complete: called to report transaction completions 639 * @complete: called to report transaction completions
634 * @context: the argument to complete() when it's called 640 * @context: the argument to complete() when it's called
641 * @frame_length: the total number of bytes in the message
635 * @actual_length: the total number of bytes that were transferred in all 642 * @actual_length: the total number of bytes that were transferred in all
636 * successful segments 643 * successful segments
637 * @status: zero for success, else negative errno 644 * @status: zero for success, else negative errno
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 3f2867ff0ced..262ba4ef9a8e 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -197,7 +197,13 @@ static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock)
197 _raw_spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \ 197 _raw_spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \
198 } while (0) 198 } while (0)
199#else 199#else
200# define raw_spin_lock_nested(lock, subclass) _raw_spin_lock(lock) 200/*
201 * Always evaluate the 'subclass' argument to avoid that the compiler
202 * warns about set-but-not-used variables when building with
203 * CONFIG_DEBUG_LOCK_ALLOC=n and with W=1.
204 */
205# define raw_spin_lock_nested(lock, subclass) \
206 _raw_spin_lock(((void)(subclass), (lock)))
201# define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock) 207# define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock)
202#endif 208#endif
203 209
diff --git a/include/linux/string.h b/include/linux/string.h
index d36977e029af..2e22a2e58f3a 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -41,7 +41,7 @@ extern int strcmp(const char *,const char *);
41extern int strncmp(const char *,const char *,__kernel_size_t); 41extern int strncmp(const char *,const char *,__kernel_size_t);
42#endif 42#endif
43#ifndef __HAVE_ARCH_STRNICMP 43#ifndef __HAVE_ARCH_STRNICMP
44extern int strnicmp(const char *, const char *, __kernel_size_t); 44#define strnicmp strncasecmp
45#endif 45#endif
46#ifndef __HAVE_ARCH_STRCASECMP 46#ifndef __HAVE_ARCH_STRCASECMP
47extern int strcasecmp(const char *s1, const char *s2); 47extern int strcasecmp(const char *s1, const char *s2);
@@ -132,7 +132,7 @@ int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4);
132#endif 132#endif
133 133
134extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, 134extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
135 const void *from, size_t available); 135 const void *from, size_t available);
136 136
137/** 137/**
138 * strstarts - does @str start with @prefix? 138 * strstarts - does @str start with @prefix?
@@ -144,7 +144,8 @@ static inline bool strstarts(const char *str, const char *prefix)
144 return strncmp(str, prefix, strlen(prefix)) == 0; 144 return strncmp(str, prefix, strlen(prefix)) == 0;
145} 145}
146 146
147extern size_t memweight(const void *ptr, size_t bytes); 147size_t memweight(const void *ptr, size_t bytes);
148void memzero_explicit(void *s, size_t count);
148 149
149/** 150/**
150 * kbasename - return the last part of a pathname. 151 * kbasename - return the last part of a pathname.
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index 3eeee9672a4a..6eb567ac56bc 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -20,40 +20,6 @@ int string_get_size(u64 size, enum string_size_units units,
20#define UNESCAPE_ANY \ 20#define UNESCAPE_ANY \
21 (UNESCAPE_SPACE | UNESCAPE_OCTAL | UNESCAPE_HEX | UNESCAPE_SPECIAL) 21 (UNESCAPE_SPACE | UNESCAPE_OCTAL | UNESCAPE_HEX | UNESCAPE_SPECIAL)
22 22
23/**
24 * string_unescape - unquote characters in the given string
25 * @src: source buffer (escaped)
26 * @dst: destination buffer (unescaped)
27 * @size: size of the destination buffer (0 to unlimit)
28 * @flags: combination of the flags (bitwise OR):
29 * %UNESCAPE_SPACE:
30 * '\f' - form feed
31 * '\n' - new line
32 * '\r' - carriage return
33 * '\t' - horizontal tab
34 * '\v' - vertical tab
35 * %UNESCAPE_OCTAL:
36 * '\NNN' - byte with octal value NNN (1 to 3 digits)
37 * %UNESCAPE_HEX:
38 * '\xHH' - byte with hexadecimal value HH (1 to 2 digits)
39 * %UNESCAPE_SPECIAL:
40 * '\"' - double quote
41 * '\\' - backslash
42 * '\a' - alert (BEL)
43 * '\e' - escape
44 * %UNESCAPE_ANY:
45 * all previous together
46 *
47 * Returns amount of characters processed to the destination buffer excluding
48 * trailing '\0'.
49 *
50 * Because the size of the output will be the same as or less than the size of
51 * the input, the transformation may be performed in place.
52 *
53 * Caller must provide valid source and destination pointers. Be aware that
54 * destination buffer will always be NULL-terminated. Source string must be
55 * NULL-terminated as well.
56 */
57int string_unescape(char *src, char *dst, size_t size, unsigned int flags); 23int string_unescape(char *src, char *dst, size_t size, unsigned int flags);
58 24
59static inline int string_unescape_inplace(char *buf, unsigned int flags) 25static inline int string_unescape_inplace(char *buf, unsigned int flags)
@@ -71,4 +37,35 @@ static inline int string_unescape_any_inplace(char *buf)
71 return string_unescape_any(buf, buf, 0); 37 return string_unescape_any(buf, buf, 0);
72} 38}
73 39
40#define ESCAPE_SPACE 0x01
41#define ESCAPE_SPECIAL 0x02
42#define ESCAPE_NULL 0x04
43#define ESCAPE_OCTAL 0x08
44#define ESCAPE_ANY \
45 (ESCAPE_SPACE | ESCAPE_OCTAL | ESCAPE_SPECIAL | ESCAPE_NULL)
46#define ESCAPE_NP 0x10
47#define ESCAPE_ANY_NP (ESCAPE_ANY | ESCAPE_NP)
48#define ESCAPE_HEX 0x20
49
50int string_escape_mem(const char *src, size_t isz, char **dst, size_t osz,
51 unsigned int flags, const char *esc);
52
53static inline int string_escape_mem_any_np(const char *src, size_t isz,
54 char **dst, size_t osz, const char *esc)
55{
56 return string_escape_mem(src, isz, dst, osz, ESCAPE_ANY_NP, esc);
57}
58
59static inline int string_escape_str(const char *src, char **dst, size_t sz,
60 unsigned int flags, const char *esc)
61{
62 return string_escape_mem(src, strlen(src), dst, sz, flags, esc);
63}
64
65static inline int string_escape_str_any_np(const char *src, char **dst,
66 size_t sz, const char *esc)
67{
68 return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, esc);
69}
70
74#endif 71#endif
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 790be1472792..8e030075fe79 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -103,6 +103,7 @@ struct rpc_auth_create_args {
103 103
104/* Flags for rpcauth_lookupcred() */ 104/* Flags for rpcauth_lookupcred() */
105#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */ 105#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */
106#define RPCAUTH_LOOKUP_RCU 0x02 /* lock-less lookup */
106 107
107/* 108/*
108 * Client authentication ops 109 * Client authentication ops
@@ -140,6 +141,7 @@ struct rpc_credops {
140 void *, __be32 *, void *); 141 void *, __be32 *, void *);
141 int (*crkey_timeout)(struct rpc_cred *); 142 int (*crkey_timeout)(struct rpc_cred *);
142 bool (*crkey_to_expire)(struct rpc_cred *); 143 bool (*crkey_to_expire)(struct rpc_cred *);
144 char * (*crstringify_acceptor)(struct rpc_cred *);
143}; 145};
144 146
145extern const struct rpc_authops authunix_ops; 147extern const struct rpc_authops authunix_ops;
@@ -153,6 +155,7 @@ void rpc_destroy_generic_auth(void);
153void rpc_destroy_authunix(void); 155void rpc_destroy_authunix(void);
154 156
155struct rpc_cred * rpc_lookup_cred(void); 157struct rpc_cred * rpc_lookup_cred(void);
158struct rpc_cred * rpc_lookup_cred_nonblock(void);
156struct rpc_cred * rpc_lookup_machine_cred(const char *service_name); 159struct rpc_cred * rpc_lookup_machine_cred(const char *service_name);
157int rpcauth_register(const struct rpc_authops *); 160int rpcauth_register(const struct rpc_authops *);
158int rpcauth_unregister(const struct rpc_authops *); 161int rpcauth_unregister(const struct rpc_authops *);
@@ -182,6 +185,7 @@ void rpcauth_clear_credcache(struct rpc_cred_cache *);
182int rpcauth_key_timeout_notify(struct rpc_auth *, 185int rpcauth_key_timeout_notify(struct rpc_auth *,
183 struct rpc_cred *); 186 struct rpc_cred *);
184bool rpcauth_cred_key_to_expire(struct rpc_cred *); 187bool rpcauth_cred_key_to_expire(struct rpc_cred *);
188char * rpcauth_stringify_acceptor(struct rpc_cred *);
185 189
186static inline 190static inline
187struct rpc_cred * get_rpccred(struct rpc_cred *cred) 191struct rpc_cred * get_rpccred(struct rpc_cred *cred)
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index f1cfd4c85cd0..36eebc451b41 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -69,8 +69,9 @@ struct gss_cl_ctx {
69 enum rpc_gss_proc gc_proc; 69 enum rpc_gss_proc gc_proc;
70 u32 gc_seq; 70 u32 gc_seq;
71 spinlock_t gc_seq_lock; 71 spinlock_t gc_seq_lock;
72 struct gss_ctx __rcu *gc_gss_ctx; 72 struct gss_ctx *gc_gss_ctx;
73 struct xdr_netobj gc_wire_ctx; 73 struct xdr_netobj gc_wire_ctx;
74 struct xdr_netobj gc_acceptor;
74 u32 gc_win; 75 u32 gc_win;
75 unsigned long gc_expiry; 76 unsigned long gc_expiry;
76 struct rcu_head gc_rcu; 77 struct rcu_head gc_rcu;
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index 5af2931cf58d..df02a4188487 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -81,7 +81,7 @@ struct gss_krb5_enctype {
81 struct xdr_netobj *in, 81 struct xdr_netobj *in,
82 struct xdr_netobj *out); /* complete key generation */ 82 struct xdr_netobj *out); /* complete key generation */
83 u32 (*encrypt_v2) (struct krb5_ctx *kctx, u32 offset, 83 u32 (*encrypt_v2) (struct krb5_ctx *kctx, u32 offset,
84 struct xdr_buf *buf, int ec, 84 struct xdr_buf *buf,
85 struct page **pages); /* v2 encryption function */ 85 struct page **pages); /* v2 encryption function */
86 u32 (*decrypt_v2) (struct krb5_ctx *kctx, u32 offset, 86 u32 (*decrypt_v2) (struct krb5_ctx *kctx, u32 offset,
87 struct xdr_buf *buf, u32 *headskip, 87 struct xdr_buf *buf, u32 *headskip,
@@ -310,7 +310,7 @@ gss_krb5_aes_make_key(const struct gss_krb5_enctype *gk5e,
310 310
311u32 311u32
312gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset, 312gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset,
313 struct xdr_buf *buf, int ec, 313 struct xdr_buf *buf,
314 struct page **pages); 314 struct page **pages);
315 315
316u32 316u32
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 1bc7cd05b22e..21678464883a 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -236,7 +236,7 @@ struct svc_rqst {
236 struct svc_cred rq_cred; /* auth info */ 236 struct svc_cred rq_cred; /* auth info */
237 void * rq_xprt_ctxt; /* transport specific context ptr */ 237 void * rq_xprt_ctxt; /* transport specific context ptr */
238 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ 238 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */
239 int rq_usedeferral; /* use deferral */ 239 bool rq_usedeferral; /* use deferral */
240 240
241 size_t rq_xprt_hlen; /* xprt header len */ 241 size_t rq_xprt_hlen; /* xprt header len */
242 struct xdr_buf rq_arg; 242 struct xdr_buf rq_arg;
@@ -277,10 +277,9 @@ struct svc_rqst {
277 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */ 277 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */
278 int rq_cachetype; 278 int rq_cachetype;
279 struct svc_cacherep * rq_cacherep; /* cache info */ 279 struct svc_cacherep * rq_cacherep; /* cache info */
280 int rq_splice_ok; /* turned off in gss privacy 280 bool rq_splice_ok; /* turned off in gss privacy
281 * to prevent encrypting page 281 * to prevent encrypting page
282 * cache pages */ 282 * cache pages */
283 wait_queue_head_t rq_wait; /* synchronization */
284 struct task_struct *rq_task; /* service thread */ 283 struct task_struct *rq_task; /* service thread */
285}; 284};
286 285
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index 5cf99a016368..975da754c778 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -174,8 +174,7 @@ struct svcxprt_rdma {
174 * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ. */ 174 * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ. */
175#define RPCRDMA_ORD (64/4) 175#define RPCRDMA_ORD (64/4)
176#define RPCRDMA_SQ_DEPTH_MULT 8 176#define RPCRDMA_SQ_DEPTH_MULT 8
177#define RPCRDMA_MAX_THREADS 16 177#define RPCRDMA_MAX_REQUESTS 32
178#define RPCRDMA_MAX_REQUESTS 16
179#define RPCRDMA_MAX_REQ_SIZE 4096 178#define RPCRDMA_MAX_REQ_SIZE 4096
180 179
181/* svc_rdma_marshal.c */ 180/* svc_rdma_marshal.c */
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 7235040a19b2..ce6e4182a5b2 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -25,6 +25,7 @@ struct svc_xprt_ops {
25 void (*xpo_detach)(struct svc_xprt *); 25 void (*xpo_detach)(struct svc_xprt *);
26 void (*xpo_free)(struct svc_xprt *); 26 void (*xpo_free)(struct svc_xprt *);
27 int (*xpo_secure_port)(struct svc_rqst *); 27 int (*xpo_secure_port)(struct svc_rqst *);
28 void (*xpo_adjust_wspace)(struct svc_xprt *);
28}; 29};
29 30
30struct svc_xprt_class { 31struct svc_xprt_class {
@@ -33,6 +34,7 @@ struct svc_xprt_class {
33 struct svc_xprt_ops *xcl_ops; 34 struct svc_xprt_ops *xcl_ops;
34 struct list_head xcl_list; 35 struct list_head xcl_list;
35 u32 xcl_max_payload; 36 u32 xcl_max_payload;
37 int xcl_ident;
36}; 38};
37 39
38/* 40/*
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index fcbfe8783243..cf391eef2e6d 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -357,6 +357,7 @@ int xs_swapper(struct rpc_xprt *xprt, int enable);
357#define XPRT_CONNECTION_ABORT (7) 357#define XPRT_CONNECTION_ABORT (7)
358#define XPRT_CONNECTION_CLOSE (8) 358#define XPRT_CONNECTION_CLOSE (8)
359#define XPRT_CONGESTED (9) 359#define XPRT_CONGESTED (9)
360#define XPRT_CONNECTION_REUSE (10)
360 361
361static inline void xprt_set_connected(struct rpc_xprt *xprt) 362static inline void xprt_set_connected(struct rpc_xprt *xprt)
362{ 363{
diff --git a/include/linux/sunrpc/xprtrdma.h b/include/linux/sunrpc/xprtrdma.h
index c2f04e1ae159..64a0a0a97b23 100644
--- a/include/linux/sunrpc/xprtrdma.h
+++ b/include/linux/sunrpc/xprtrdma.h
@@ -62,8 +62,6 @@
62#define RPCRDMA_INLINE_PAD_THRESH (512)/* payload threshold to pad (bytes) */ 62#define RPCRDMA_INLINE_PAD_THRESH (512)/* payload threshold to pad (bytes) */
63 63
64/* memory registration strategies */ 64/* memory registration strategies */
65#define RPCRDMA_PERSISTENT_REGISTRATION (1)
66
67enum rpcrdma_memreg { 65enum rpcrdma_memreg {
68 RPCRDMA_BOUNCEBUFFERS = 0, 66 RPCRDMA_BOUNCEBUFFERS = 0,
69 RPCRDMA_REGISTER, 67 RPCRDMA_REGISTER,
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 519064e0c943..3388c1b6f7d8 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -189,6 +189,8 @@ struct platform_suspend_ops {
189 189
190struct platform_freeze_ops { 190struct platform_freeze_ops {
191 int (*begin)(void); 191 int (*begin)(void);
192 int (*prepare)(void);
193 void (*restore)(void);
192 void (*end)(void); 194 void (*end)(void);
193}; 195};
194 196
@@ -371,6 +373,8 @@ extern int unregister_pm_notifier(struct notifier_block *nb);
371extern bool events_check_enabled; 373extern bool events_check_enabled;
372 374
373extern bool pm_wakeup_pending(void); 375extern bool pm_wakeup_pending(void);
376extern void pm_system_wakeup(void);
377extern void pm_wakeup_clear(void);
374extern bool pm_get_wakeup_count(unsigned int *count, bool block); 378extern bool pm_get_wakeup_count(unsigned int *count, bool block);
375extern bool pm_save_wakeup_count(unsigned int count); 379extern bool pm_save_wakeup_count(unsigned int count);
376extern void pm_wakep_autosleep_enabled(bool set); 380extern void pm_wakep_autosleep_enabled(bool set);
@@ -418,6 +422,8 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
418#define pm_notifier(fn, pri) do { (void)(fn); } while (0) 422#define pm_notifier(fn, pri) do { (void)(fn); } while (0)
419 423
420static inline bool pm_wakeup_pending(void) { return false; } 424static inline bool pm_wakeup_pending(void) { return false; }
425static inline void pm_system_wakeup(void) {}
426static inline void pm_wakeup_clear(void) {}
421 427
422static inline void lock_system_sleep(void) {} 428static inline void lock_system_sleep(void) {}
423static inline void unlock_system_sleep(void) {} 429static inline void unlock_system_sleep(void) {}
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 4bdbee80eede..37a585beef5c 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -311,7 +311,6 @@ extern void lru_add_page_tail(struct page *page, struct page *page_tail,
311 struct lruvec *lruvec, struct list_head *head); 311 struct lruvec *lruvec, struct list_head *head);
312extern void activate_page(struct page *); 312extern void activate_page(struct page *);
313extern void mark_page_accessed(struct page *); 313extern void mark_page_accessed(struct page *);
314extern void init_page_accessed(struct page *page);
315extern void lru_add_drain(void); 314extern void lru_add_drain(void);
316extern void lru_add_drain_cpu(int cpu); 315extern void lru_add_drain_cpu(int cpu);
317extern void lru_add_drain_all(void); 316extern void lru_add_drain_all(void);
@@ -321,12 +320,17 @@ extern void swap_setup(void);
321 320
322extern void add_page_to_unevictable_list(struct page *page); 321extern void add_page_to_unevictable_list(struct page *page);
323 322
323extern void lru_cache_add_active_or_unevictable(struct page *page,
324 struct vm_area_struct *vma);
325
324/* linux/mm/vmscan.c */ 326/* linux/mm/vmscan.c */
325extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 327extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
326 gfp_t gfp_mask, nodemask_t *mask); 328 gfp_t gfp_mask, nodemask_t *mask);
327extern int __isolate_lru_page(struct page *page, isolate_mode_t mode); 329extern int __isolate_lru_page(struct page *page, isolate_mode_t mode);
328extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 330extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
329 gfp_t gfp_mask, bool noswap); 331 unsigned long nr_pages,
332 gfp_t gfp_mask,
333 bool may_swap);
330extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, 334extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
331 gfp_t gfp_mask, bool noswap, 335 gfp_t gfp_mask, bool noswap,
332 struct zone *zone, 336 struct zone *zone,
@@ -352,22 +356,6 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
352extern int page_evictable(struct page *page); 356extern int page_evictable(struct page *page);
353extern void check_move_unevictable_pages(struct page **, int nr_pages); 357extern void check_move_unevictable_pages(struct page **, int nr_pages);
354 358
355extern unsigned long scan_unevictable_pages;
356extern int scan_unevictable_handler(struct ctl_table *, int,
357 void __user *, size_t *, loff_t *);
358#ifdef CONFIG_NUMA
359extern int scan_unevictable_register_node(struct node *node);
360extern void scan_unevictable_unregister_node(struct node *node);
361#else
362static inline int scan_unevictable_register_node(struct node *node)
363{
364 return 0;
365}
366static inline void scan_unevictable_unregister_node(struct node *node)
367{
368}
369#endif
370
371extern int kswapd_run(int nid); 359extern int kswapd_run(int nid);
372extern void kswapd_stop(int nid); 360extern void kswapd_stop(int nid);
373#ifdef CONFIG_MEMCG 361#ifdef CONFIG_MEMCG
@@ -379,9 +367,13 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
379} 367}
380#endif 368#endif
381#ifdef CONFIG_MEMCG_SWAP 369#ifdef CONFIG_MEMCG_SWAP
382extern void mem_cgroup_uncharge_swap(swp_entry_t ent); 370extern void mem_cgroup_swapout(struct page *page, swp_entry_t entry);
371extern void mem_cgroup_uncharge_swap(swp_entry_t entry);
383#else 372#else
384static inline void mem_cgroup_uncharge_swap(swp_entry_t ent) 373static inline void mem_cgroup_swapout(struct page *page, swp_entry_t entry)
374{
375}
376static inline void mem_cgroup_uncharge_swap(swp_entry_t entry)
385{ 377{
386} 378}
387#endif 379#endif
@@ -441,7 +433,7 @@ extern void swap_shmem_alloc(swp_entry_t);
441extern int swap_duplicate(swp_entry_t); 433extern int swap_duplicate(swp_entry_t);
442extern int swapcache_prepare(swp_entry_t); 434extern int swapcache_prepare(swp_entry_t);
443extern void swap_free(swp_entry_t); 435extern void swap_free(swp_entry_t);
444extern void swapcache_free(swp_entry_t, struct page *page); 436extern void swapcache_free(swp_entry_t);
445extern int free_swap_and_cache(swp_entry_t); 437extern int free_swap_and_cache(swp_entry_t);
446extern int swap_type_of(dev_t, sector_t, struct block_device **); 438extern int swap_type_of(dev_t, sector_t, struct block_device **);
447extern unsigned int count_swap_pages(int, int); 439extern unsigned int count_swap_pages(int, int);
@@ -505,7 +497,7 @@ static inline void swap_free(swp_entry_t swp)
505{ 497{
506} 498}
507 499
508static inline void swapcache_free(swp_entry_t swp, struct page *page) 500static inline void swapcache_free(swp_entry_t swp)
509{ 501{
510} 502}
511 503
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 701daff5d899..bda9b81357cc 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -65,6 +65,7 @@ struct old_linux_dirent;
65struct perf_event_attr; 65struct perf_event_attr;
66struct file_handle; 66struct file_handle;
67struct sigaltstack; 67struct sigaltstack;
68union bpf_attr;
68 69
69#include <linux/types.h> 70#include <linux/types.h>
70#include <linux/aio_abi.h> 71#include <linux/aio_abi.h>
@@ -317,6 +318,10 @@ asmlinkage long sys_restart_syscall(void);
317asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments, 318asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
318 struct kexec_segment __user *segments, 319 struct kexec_segment __user *segments,
319 unsigned long flags); 320 unsigned long flags);
321asmlinkage long sys_kexec_file_load(int kernel_fd, int initrd_fd,
322 unsigned long cmdline_len,
323 const char __user *cmdline_ptr,
324 unsigned long flags);
320 325
321asmlinkage long sys_exit(int error_code); 326asmlinkage long sys_exit(int error_code);
322asmlinkage long sys_exit_group(int error_code); 327asmlinkage long sys_exit_group(int error_code);
@@ -802,6 +807,7 @@ asmlinkage long sys_timerfd_settime(int ufd, int flags,
802asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr); 807asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr);
803asmlinkage long sys_eventfd(unsigned int count); 808asmlinkage long sys_eventfd(unsigned int count);
804asmlinkage long sys_eventfd2(unsigned int count, int flags); 809asmlinkage long sys_eventfd2(unsigned int count, int flags);
810asmlinkage long sys_memfd_create(const char __user *uname_ptr, unsigned int flags);
805asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len); 811asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len);
806asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int); 812asmlinkage long sys_old_readdir(unsigned int, struct old_linux_dirent __user *, unsigned int);
807asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *, 813asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
@@ -870,5 +876,5 @@ asmlinkage long sys_seccomp(unsigned int op, unsigned int flags,
870 const char __user *uargs); 876 const char __user *uargs);
871asmlinkage long sys_getrandom(char __user *buf, size_t count, 877asmlinkage long sys_getrandom(char __user *buf, size_t count,
872 unsigned int flags); 878 unsigned int flags);
873 879asmlinkage long sys_bpf(int cmd, union bpf_attr *attr, unsigned int size);
874#endif 880#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 14a8ff2de11e..b7361f831226 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -34,8 +34,6 @@ struct ctl_table_root;
34struct ctl_table_header; 34struct ctl_table_header;
35struct ctl_dir; 35struct ctl_dir;
36 36
37typedef struct ctl_table ctl_table;
38
39typedef int proc_handler (struct ctl_table *ctl, int write, 37typedef int proc_handler (struct ctl_table *ctl, int write,
40 void __user *buffer, size_t *lenp, loff_t *ppos); 38 void __user *buffer, size_t *lenp, loff_t *ppos);
41 39
diff --git a/include/linux/t10-pi.h b/include/linux/t10-pi.h
new file mode 100644
index 000000000000..6a8b9942632d
--- /dev/null
+++ b/include/linux/t10-pi.h
@@ -0,0 +1,22 @@
1#ifndef _LINUX_T10_PI_H
2#define _LINUX_T10_PI_H
3
4#include <linux/types.h>
5#include <linux/blkdev.h>
6
7/*
8 * T10 Protection Information tuple.
9 */
10struct t10_pi_tuple {
11 __be16 guard_tag; /* Checksum */
12 __be16 app_tag; /* Opaque storage */
13 __be32 ref_tag; /* Target LBA or indirect LBA */
14};
15
16
17extern struct blk_integrity t10_pi_type1_crc;
18extern struct blk_integrity t10_pi_type1_ip;
19extern struct blk_integrity t10_pi_type3_crc;
20extern struct blk_integrity t10_pi_type3_ip;
21
22#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index fa5258f322e7..c2dee7deefa8 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -19,7 +19,6 @@
19 19
20 20
21#include <linux/skbuff.h> 21#include <linux/skbuff.h>
22#include <linux/dmaengine.h>
23#include <net/sock.h> 22#include <net/sock.h>
24#include <net/inet_connection_sock.h> 23#include <net/inet_connection_sock.h>
25#include <net/inet_timewait_sock.h> 24#include <net/inet_timewait_sock.h>
@@ -166,13 +165,6 @@ struct tcp_sock {
166 struct iovec *iov; 165 struct iovec *iov;
167 int memory; 166 int memory;
168 int len; 167 int len;
169#ifdef CONFIG_NET_DMA
170 /* members for async copy */
171 struct dma_chan *dma_chan;
172 int wakeup;
173 struct dma_pinned_list *pinned_list;
174 dma_cookie_t dma_cookie;
175#endif
176 } ucopy; 168 } ucopy;
177 169
178 u32 snd_wl1; /* Sequence for window update */ 170 u32 snd_wl1; /* Sequence for window update */
@@ -276,7 +268,7 @@ struct tcp_sock {
276 u32 retrans_stamp; /* Timestamp of the last retransmit, 268 u32 retrans_stamp; /* Timestamp of the last retransmit,
277 * also used in SYN-SENT to remember stamp of 269 * also used in SYN-SENT to remember stamp of
278 * the first SYN. */ 270 * the first SYN. */
279 u32 undo_marker; /* tracking retrans started here. */ 271 u32 undo_marker; /* snd_una upon a new recovery episode. */
280 int undo_retrans; /* number of undoable retransmissions. */ 272 int undo_retrans; /* number of undoable retransmissions. */
281 u32 total_retrans; /* Total retransmits for entire connection */ 273 u32 total_retrans; /* Total retransmits for entire connection */
282 274
diff --git a/include/linux/tegra-powergate.h b/include/linux/tegra-powergate.h
deleted file mode 100644
index 46f0a07812b4..000000000000
--- a/include/linux/tegra-powergate.h
+++ /dev/null
@@ -1,134 +0,0 @@
1/*
2 * Copyright (c) 2010 Google, Inc
3 *
4 * Author:
5 * Colin Cross <ccross@google.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef _MACH_TEGRA_POWERGATE_H_
19#define _MACH_TEGRA_POWERGATE_H_
20
21struct clk;
22struct reset_control;
23
24#define TEGRA_POWERGATE_CPU 0
25#define TEGRA_POWERGATE_3D 1
26#define TEGRA_POWERGATE_VENC 2
27#define TEGRA_POWERGATE_PCIE 3
28#define TEGRA_POWERGATE_VDEC 4
29#define TEGRA_POWERGATE_L2 5
30#define TEGRA_POWERGATE_MPE 6
31#define TEGRA_POWERGATE_HEG 7
32#define TEGRA_POWERGATE_SATA 8
33#define TEGRA_POWERGATE_CPU1 9
34#define TEGRA_POWERGATE_CPU2 10
35#define TEGRA_POWERGATE_CPU3 11
36#define TEGRA_POWERGATE_CELP 12
37#define TEGRA_POWERGATE_3D1 13
38#define TEGRA_POWERGATE_CPU0 14
39#define TEGRA_POWERGATE_C0NC 15
40#define TEGRA_POWERGATE_C1NC 16
41#define TEGRA_POWERGATE_SOR 17
42#define TEGRA_POWERGATE_DIS 18
43#define TEGRA_POWERGATE_DISB 19
44#define TEGRA_POWERGATE_XUSBA 20
45#define TEGRA_POWERGATE_XUSBB 21
46#define TEGRA_POWERGATE_XUSBC 22
47#define TEGRA_POWERGATE_VIC 23
48#define TEGRA_POWERGATE_IRAM 24
49
50#define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D
51
52#define TEGRA_IO_RAIL_CSIA 0
53#define TEGRA_IO_RAIL_CSIB 1
54#define TEGRA_IO_RAIL_DSI 2
55#define TEGRA_IO_RAIL_MIPI_BIAS 3
56#define TEGRA_IO_RAIL_PEX_BIAS 4
57#define TEGRA_IO_RAIL_PEX_CLK1 5
58#define TEGRA_IO_RAIL_PEX_CLK2 6
59#define TEGRA_IO_RAIL_USB0 9
60#define TEGRA_IO_RAIL_USB1 10
61#define TEGRA_IO_RAIL_USB2 11
62#define TEGRA_IO_RAIL_USB_BIAS 12
63#define TEGRA_IO_RAIL_NAND 13
64#define TEGRA_IO_RAIL_UART 14
65#define TEGRA_IO_RAIL_BB 15
66#define TEGRA_IO_RAIL_AUDIO 17
67#define TEGRA_IO_RAIL_HSIC 19
68#define TEGRA_IO_RAIL_COMP 22
69#define TEGRA_IO_RAIL_HDMI 28
70#define TEGRA_IO_RAIL_PEX_CNTRL 32
71#define TEGRA_IO_RAIL_SDMMC1 33
72#define TEGRA_IO_RAIL_SDMMC3 34
73#define TEGRA_IO_RAIL_SDMMC4 35
74#define TEGRA_IO_RAIL_CAM 36
75#define TEGRA_IO_RAIL_RES 37
76#define TEGRA_IO_RAIL_HV 38
77#define TEGRA_IO_RAIL_DSIB 39
78#define TEGRA_IO_RAIL_DSIC 40
79#define TEGRA_IO_RAIL_DSID 41
80#define TEGRA_IO_RAIL_CSIE 44
81#define TEGRA_IO_RAIL_LVDS 57
82#define TEGRA_IO_RAIL_SYS_DDC 58
83
84#ifdef CONFIG_ARCH_TEGRA
85int tegra_powergate_is_powered(int id);
86int tegra_powergate_power_on(int id);
87int tegra_powergate_power_off(int id);
88int tegra_powergate_remove_clamping(int id);
89
90/* Must be called with clk disabled, and returns with clk enabled */
91int tegra_powergate_sequence_power_up(int id, struct clk *clk,
92 struct reset_control *rst);
93
94int tegra_io_rail_power_on(int id);
95int tegra_io_rail_power_off(int id);
96#else
97static inline int tegra_powergate_is_powered(int id)
98{
99 return -ENOSYS;
100}
101
102static inline int tegra_powergate_power_on(int id)
103{
104 return -ENOSYS;
105}
106
107static inline int tegra_powergate_power_off(int id)
108{
109 return -ENOSYS;
110}
111
112static inline int tegra_powergate_remove_clamping(int id)
113{
114 return -ENOSYS;
115}
116
117static inline int tegra_powergate_sequence_power_up(int id, struct clk *clk,
118 struct reset_control *rst)
119{
120 return -ENOSYS;
121}
122
123static inline int tegra_io_rail_power_on(int id)
124{
125 return -ENOSYS;
126}
127
128static inline int tegra_io_rail_power_off(int id)
129{
130 return -ENOSYS;
131}
132#endif
133
134#endif /* _MACH_TEGRA_POWERGATE_H_ */
diff --git a/include/linux/tegra-soc.h b/include/linux/tegra-soc.h
deleted file mode 100644
index 95f611d78f3a..000000000000
--- a/include/linux/tegra-soc.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __LINUX_TEGRA_SOC_H_
18#define __LINUX_TEGRA_SOC_H_
19
20u32 tegra_read_chipid(void);
21
22#endif /* __LINUX_TEGRA_SOC_H_ */
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index f7e11c7ea7d9..ef90838b36a0 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -44,6 +44,10 @@
44#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \ 44#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \
45 ((long)t-2732+5)/10 : ((long)t-2732-5)/10) 45 ((long)t-2732+5)/10 : ((long)t-2732-5)/10)
46#define CELSIUS_TO_KELVIN(t) ((t)*10+2732) 46#define CELSIUS_TO_KELVIN(t) ((t)*10+2732)
47#define DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, off) (((t) - (off)) * 100)
48#define DECI_KELVIN_TO_MILLICELSIUS(t) DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, 2732)
49#define MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, off) (((t) / 100) + (off))
50#define MILLICELSIUS_TO_DECI_KELVIN(t) MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, 2732)
47 51
48/* Adding event notification support elements */ 52/* Adding event notification support elements */
49#define THERMAL_GENL_FAMILY_NAME "thermal_event" 53#define THERMAL_GENL_FAMILY_NAME "thermal_event"
@@ -158,6 +162,42 @@ struct thermal_attr {
158 char name[THERMAL_NAME_LENGTH]; 162 char name[THERMAL_NAME_LENGTH];
159}; 163};
160 164
165/**
166 * struct thermal_zone_device - structure for a thermal zone
167 * @id: unique id number for each thermal zone
168 * @type: the thermal zone device type
169 * @device: &struct device for this thermal zone
170 * @trip_temp_attrs: attributes for trip points for sysfs: trip temperature
171 * @trip_type_attrs: attributes for trip points for sysfs: trip type
172 * @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis
173 * @devdata: private pointer for device private data
174 * @trips: number of trip points the thermal zone supports
175 * @passive_delay: number of milliseconds to wait between polls when
176 * performing passive cooling. Currenty only used by the
177 * step-wise governor
178 * @polling_delay: number of milliseconds to wait between polls when
179 * checking whether trip points have been crossed (0 for
180 * interrupt driven systems)
181 * @temperature: current temperature. This is only for core code,
182 * drivers should use thermal_zone_get_temp() to get the
183 * current temperature
184 * @last_temperature: previous temperature read
185 * @emul_temperature: emulated temperature when using CONFIG_THERMAL_EMULATION
186 * @passive: 1 if you've crossed a passive trip point, 0 otherwise.
187 * Currenty only used by the step-wise governor.
188 * @forced_passive: If > 0, temperature at which to switch on all ACPI
189 * processor cooling devices. Currently only used by the
190 * step-wise governor.
191 * @ops: operations this &thermal_zone_device supports
192 * @tzp: thermal zone parameters
193 * @governor: pointer to the governor for this thermal zone
194 * @thermal_instances: list of &struct thermal_instance of this thermal zone
195 * @idr: &struct idr to generate unique id for this zone's cooling
196 * devices
197 * @lock: lock to protect thermal_instances list
198 * @node: node in thermal_tz_list (in thermal_core.c)
199 * @poll_queue: delayed work for polling
200 */
161struct thermal_zone_device { 201struct thermal_zone_device {
162 int id; 202 int id;
163 char type[THERMAL_NAME_LENGTH]; 203 char type[THERMAL_NAME_LENGTH];
@@ -179,12 +219,18 @@ struct thermal_zone_device {
179 struct thermal_governor *governor; 219 struct thermal_governor *governor;
180 struct list_head thermal_instances; 220 struct list_head thermal_instances;
181 struct idr idr; 221 struct idr idr;
182 struct mutex lock; /* protect thermal_instances list */ 222 struct mutex lock;
183 struct list_head node; 223 struct list_head node;
184 struct delayed_work poll_queue; 224 struct delayed_work poll_queue;
185}; 225};
186 226
187/* Structure that holds thermal governor information */ 227/**
228 * struct thermal_governor - structure that holds thermal governor information
229 * @name: name of the governor
230 * @throttle: callback called for every trip point even if temperature is
231 * below the trip point temperature
232 * @governor_list: node in thermal_governor_list (in thermal_core.c)
233 */
188struct thermal_governor { 234struct thermal_governor {
189 char name[THERMAL_NAME_LENGTH]; 235 char name[THERMAL_NAME_LENGTH];
190 int (*throttle)(struct thermal_zone_device *tz, int trip); 236 int (*throttle)(struct thermal_zone_device *tz, int trip);
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
index 932b76392248..884d6263e962 100644
--- a/include/linux/ti_wilink_st.h
+++ b/include/linux/ti_wilink_st.h
@@ -268,7 +268,7 @@ struct kim_data_s {
268 struct st_data_s *core_data; 268 struct st_data_s *core_data;
269 struct chip_version version; 269 struct chip_version version;
270 unsigned char ldisc_install; 270 unsigned char ldisc_install;
271 unsigned char dev_name[UART_DEV_NAME_LEN]; 271 unsigned char dev_name[UART_DEV_NAME_LEN + 1];
272 unsigned char flow_cntrl; 272 unsigned char flow_cntrl;
273 unsigned long baud_rate; 273 unsigned long baud_rate;
274}; 274};
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 059052306831..eda850ca757a 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -108,7 +108,7 @@ extern struct tick_sched *tick_get_tick_sched(int cpu);
108extern void tick_irq_enter(void); 108extern void tick_irq_enter(void);
109extern int tick_oneshot_mode_active(void); 109extern int tick_oneshot_mode_active(void);
110# ifndef arch_needs_cpu 110# ifndef arch_needs_cpu
111# define arch_needs_cpu(cpu) (0) 111# define arch_needs_cpu() (0)
112# endif 112# endif
113# else 113# else
114static inline void tick_clock_notify(void) { } 114static inline void tick_clock_notify(void) { }
@@ -181,19 +181,12 @@ static inline bool tick_nohz_full_cpu(int cpu)
181 return cpumask_test_cpu(cpu, tick_nohz_full_mask); 181 return cpumask_test_cpu(cpu, tick_nohz_full_mask);
182} 182}
183 183
184extern void tick_nohz_init(void);
185extern void __tick_nohz_full_check(void); 184extern void __tick_nohz_full_check(void);
185extern void tick_nohz_full_kick(void);
186extern void tick_nohz_full_kick_cpu(int cpu); 186extern void tick_nohz_full_kick_cpu(int cpu);
187
188static inline void tick_nohz_full_kick(void)
189{
190 tick_nohz_full_kick_cpu(smp_processor_id());
191}
192
193extern void tick_nohz_full_kick_all(void); 187extern void tick_nohz_full_kick_all(void);
194extern void __tick_nohz_task_switch(struct task_struct *tsk); 188extern void __tick_nohz_task_switch(struct task_struct *tsk);
195#else 189#else
196static inline void tick_nohz_init(void) { }
197static inline bool tick_nohz_full_enabled(void) { return false; } 190static inline bool tick_nohz_full_enabled(void) { return false; }
198static inline bool tick_nohz_full_cpu(int cpu) { return false; } 191static inline bool tick_nohz_full_cpu(int cpu) { return false; }
199static inline void __tick_nohz_full_check(void) { } 192static inline void __tick_nohz_full_check(void) { }
diff --git a/include/linux/topology.h b/include/linux/topology.h
index dda6ee521e74..909b6e43b694 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -119,11 +119,20 @@ static inline int numa_node_id(void)
119 * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem(). 119 * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem().
120 */ 120 */
121DECLARE_PER_CPU(int, _numa_mem_); 121DECLARE_PER_CPU(int, _numa_mem_);
122extern int _node_numa_mem_[MAX_NUMNODES];
122 123
123#ifndef set_numa_mem 124#ifndef set_numa_mem
124static inline void set_numa_mem(int node) 125static inline void set_numa_mem(int node)
125{ 126{
126 this_cpu_write(_numa_mem_, node); 127 this_cpu_write(_numa_mem_, node);
128 _node_numa_mem_[numa_node_id()] = node;
129}
130#endif
131
132#ifndef node_to_mem_node
133static inline int node_to_mem_node(int node)
134{
135 return _node_numa_mem_[node];
127} 136}
128#endif 137#endif
129 138
@@ -146,6 +155,7 @@ static inline int cpu_to_mem(int cpu)
146static inline void set_cpu_numa_mem(int cpu, int node) 155static inline void set_cpu_numa_mem(int cpu, int node)
147{ 156{
148 per_cpu(_numa_mem_, cpu) = node; 157 per_cpu(_numa_mem_, cpu) = node;
158 _node_numa_mem_[cpu_to_node(cpu)] = node;
149} 159}
150#endif 160#endif
151 161
@@ -159,6 +169,13 @@ static inline int numa_mem_id(void)
159} 169}
160#endif 170#endif
161 171
172#ifndef node_to_mem_node
173static inline int node_to_mem_node(int node)
174{
175 return node;
176}
177#endif
178
162#ifndef cpu_to_mem 179#ifndef cpu_to_mem
163static inline int cpu_to_mem(int cpu) 180static inline int cpu_to_mem(int cpu)
164{ 181{
diff --git a/include/linux/torture.h b/include/linux/torture.h
index 5ca58fcbaf1b..7759fc3c622d 100644
--- a/include/linux/torture.h
+++ b/include/linux/torture.h
@@ -51,7 +51,7 @@
51 51
52/* Definitions for online/offline exerciser. */ 52/* Definitions for online/offline exerciser. */
53int torture_onoff_init(long ooholdoff, long oointerval); 53int torture_onoff_init(long ooholdoff, long oointerval);
54char *torture_onoff_stats(char *page); 54void torture_onoff_stats(void);
55bool torture_onoff_failures(void); 55bool torture_onoff_failures(void);
56 56
57/* Low-rider random number generator. */ 57/* Low-rider random number generator. */
@@ -77,7 +77,8 @@ int torture_stutter_init(int s);
77/* Initialization and cleanup. */ 77/* Initialization and cleanup. */
78bool torture_init_begin(char *ttype, bool v, int *runnable); 78bool torture_init_begin(char *ttype, bool v, int *runnable);
79void torture_init_end(void); 79void torture_init_end(void);
80bool torture_cleanup(void); 80bool torture_cleanup_begin(void);
81void torture_cleanup_end(void);
81bool torture_must_stop(void); 82bool torture_must_stop(void);
82bool torture_must_stop_irq(void); 83bool torture_must_stop_irq(void);
83void torture_kthread_stopping(char *title); 84void torture_kthread_stopping(char *title);
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 6f8ab7da27c4..84d497297c5f 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -133,10 +133,6 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
133 133
134/** 134/**
135 * tracehook_signal_handler - signal handler setup is complete 135 * tracehook_signal_handler - signal handler setup is complete
136 * @sig: number of signal being delivered
137 * @info: siginfo_t of signal being delivered
138 * @ka: sigaction setting that chose the handler
139 * @regs: user register state
140 * @stepping: nonzero if debugger single-step or block-step in use 136 * @stepping: nonzero if debugger single-step or block-step in use
141 * 137 *
142 * Called by the arch code after a signal handler has been set up. 138 * Called by the arch code after a signal handler has been set up.
@@ -146,9 +142,7 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
146 * Called without locks, shortly before returning to user mode 142 * Called without locks, shortly before returning to user mode
147 * (or handling more signals). 143 * (or handling more signals).
148 */ 144 */
149static inline void tracehook_signal_handler(int sig, siginfo_t *info, 145static inline void tracehook_signal_handler(int stepping)
150 const struct k_sigaction *ka,
151 struct pt_regs *regs, int stepping)
152{ 146{
153 if (stepping) 147 if (stepping)
154 ptrace_notify(SIGTRAP); 148 ptrace_notify(SIGTRAP);
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 2e2a5f7717e5..e08e21e5f601 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -157,6 +157,12 @@ extern void syscall_unregfunc(void);
157 * Make sure the alignment of the structure in the __tracepoints section will 157 * Make sure the alignment of the structure in the __tracepoints section will
158 * not add unwanted padding between the beginning of the section and the 158 * not add unwanted padding between the beginning of the section and the
159 * structure. Force alignment to the same alignment as the section start. 159 * structure. Force alignment to the same alignment as the section start.
160 *
161 * When lockdep is enabled, we make sure to always do the RCU portions of
162 * the tracepoint code, regardless of whether tracing is on or we match the
163 * condition. This lets us find RCU issues triggered with tracepoints even
164 * when this tracepoint is off. This code has no purpose other than poking
165 * RCU a bit.
160 */ 166 */
161#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ 167#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
162 extern struct tracepoint __tracepoint_##name; \ 168 extern struct tracepoint __tracepoint_##name; \
@@ -167,6 +173,11 @@ extern void syscall_unregfunc(void);
167 TP_PROTO(data_proto), \ 173 TP_PROTO(data_proto), \
168 TP_ARGS(data_args), \ 174 TP_ARGS(data_args), \
169 TP_CONDITION(cond),,); \ 175 TP_CONDITION(cond),,); \
176 if (IS_ENABLED(CONFIG_LOCKDEP)) { \
177 rcu_read_lock_sched_notrace(); \
178 rcu_dereference_sched(__tracepoint_##name.funcs);\
179 rcu_read_unlock_sched_notrace(); \
180 } \
170 } \ 181 } \
171 __DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \ 182 __DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \
172 PARAMS(cond), PARAMS(data_proto), PARAMS(data_args)) \ 183 PARAMS(cond), PARAMS(data_proto), PARAMS(data_args)) \
@@ -249,6 +260,50 @@ extern void syscall_unregfunc(void);
249 260
250#endif /* CONFIG_TRACEPOINTS */ 261#endif /* CONFIG_TRACEPOINTS */
251 262
263#ifdef CONFIG_TRACING
264/**
265 * tracepoint_string - register constant persistent string to trace system
266 * @str - a constant persistent string that will be referenced in tracepoints
267 *
268 * If constant strings are being used in tracepoints, it is faster and
269 * more efficient to just save the pointer to the string and reference
270 * that with a printf "%s" instead of saving the string in the ring buffer
271 * and wasting space and time.
272 *
273 * The problem with the above approach is that userspace tools that read
274 * the binary output of the trace buffers do not have access to the string.
275 * Instead they just show the address of the string which is not very
276 * useful to users.
277 *
278 * With tracepoint_string(), the string will be registered to the tracing
279 * system and exported to userspace via the debugfs/tracing/printk_formats
280 * file that maps the string address to the string text. This way userspace
281 * tools that read the binary buffers have a way to map the pointers to
282 * the ASCII strings they represent.
283 *
284 * The @str used must be a constant string and persistent as it would not
285 * make sense to show a string that no longer exists. But it is still fine
286 * to be used with modules, because when modules are unloaded, if they
287 * had tracepoints, the ring buffers are cleared too. As long as the string
288 * does not change during the life of the module, it is fine to use
289 * tracepoint_string() within a module.
290 */
291#define tracepoint_string(str) \
292 ({ \
293 static const char *___tp_str __tracepoint_string = str; \
294 ___tp_str; \
295 })
296#define __tracepoint_string __attribute__((section("__tracepoint_str")))
297#else
298/*
299 * tracepoint_string() is used to save the string address for userspace
300 * tracing tools. When tracing isn't configured, there's no need to save
301 * anything.
302 */
303# define tracepoint_string(str) str
304# define __tracepoint_string
305#endif
306
252/* 307/*
253 * The need for the DECLARE_TRACE_NOARGS() is to handle the prototype 308 * The need for the DECLARE_TRACE_NOARGS() is to handle the prototype
254 * (void). "void" is a special value in a function prototype and can 309 * (void). "void" is a special value in a function prototype and can
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 84132942902a..5171ef8f7b85 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -252,6 +252,7 @@ struct tty_struct {
252 struct rw_semaphore termios_rwsem; 252 struct rw_semaphore termios_rwsem;
253 struct mutex winsize_mutex; 253 struct mutex winsize_mutex;
254 spinlock_t ctrl_lock; 254 spinlock_t ctrl_lock;
255 spinlock_t flow_lock;
255 /* Termios values are protected by the termios rwsem */ 256 /* Termios values are protected by the termios rwsem */
256 struct ktermios termios, termios_locked; 257 struct ktermios termios, termios_locked;
257 struct termiox *termiox; /* May be NULL for unsupported */ 258 struct termiox *termiox; /* May be NULL for unsupported */
@@ -261,8 +262,13 @@ struct tty_struct {
261 unsigned long flags; 262 unsigned long flags;
262 int count; 263 int count;
263 struct winsize winsize; /* winsize_mutex */ 264 struct winsize winsize; /* winsize_mutex */
264 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 265 unsigned long stopped:1, /* flow_lock */
265 unsigned char ctrl_status; /* ctrl_lock */ 266 flow_stopped:1,
267 unused:BITS_PER_LONG - 2;
268 int hw_stopped;
269 unsigned long ctrl_status:8, /* ctrl_lock */
270 packet:1,
271 unused_ctrl:BITS_PER_LONG - 9;
266 unsigned int receive_room; /* Bytes free for queue */ 272 unsigned int receive_room; /* Bytes free for queue */
267 int flow_change; 273 int flow_change;
268 274
@@ -397,7 +403,9 @@ extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
397extern char *tty_name(struct tty_struct *tty, char *buf); 403extern char *tty_name(struct tty_struct *tty, char *buf);
398extern void tty_wait_until_sent(struct tty_struct *tty, long timeout); 404extern void tty_wait_until_sent(struct tty_struct *tty, long timeout);
399extern int tty_check_change(struct tty_struct *tty); 405extern int tty_check_change(struct tty_struct *tty);
406extern void __stop_tty(struct tty_struct *tty);
400extern void stop_tty(struct tty_struct *tty); 407extern void stop_tty(struct tty_struct *tty);
408extern void __start_tty(struct tty_struct *tty);
401extern void start_tty(struct tty_struct *tty); 409extern void start_tty(struct tty_struct *tty);
402extern int tty_register_driver(struct tty_driver *driver); 410extern int tty_register_driver(struct tty_driver *driver);
403extern int tty_unregister_driver(struct tty_driver *driver); 411extern int tty_unregister_driver(struct tty_driver *driver);
@@ -411,6 +419,7 @@ extern void tty_unregister_device(struct tty_driver *driver, unsigned index);
411extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, 419extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
412 int buflen); 420 int buflen);
413extern void tty_write_message(struct tty_struct *tty, char *msg); 421extern void tty_write_message(struct tty_struct *tty, char *msg);
422extern int tty_send_xchar(struct tty_struct *tty, char ch);
414extern int tty_put_char(struct tty_struct *tty, unsigned char c); 423extern int tty_put_char(struct tty_struct *tty, unsigned char c);
415extern int tty_chars_in_buffer(struct tty_struct *tty); 424extern int tty_chars_in_buffer(struct tty_struct *tty);
416extern int tty_write_room(struct tty_struct *tty); 425extern int tty_write_room(struct tty_struct *tty);
@@ -495,8 +504,6 @@ extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty);
495extern struct mutex tty_mutex; 504extern struct mutex tty_mutex;
496extern spinlock_t tty_files_lock; 505extern spinlock_t tty_files_lock;
497 506
498extern void tty_write_unlock(struct tty_struct *tty);
499extern int tty_write_lock(struct tty_struct *tty, int ndelay);
500#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock)) 507#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock))
501 508
502extern void tty_port_init(struct tty_port *port); 509extern void tty_port_init(struct tty_port *port);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index e48c608a8fa8..92e337c18839 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -152,6 +152,8 @@
152 * This routine notifies the tty driver that it should stop 152 * This routine notifies the tty driver that it should stop
153 * outputting characters to the tty device. 153 * outputting characters to the tty device.
154 * 154 *
155 * Called with ->flow_lock held. Serialized with start() method.
156 *
155 * Optional: 157 * Optional:
156 * 158 *
157 * Note: Call stop_tty not this method. 159 * Note: Call stop_tty not this method.
@@ -161,6 +163,8 @@
161 * This routine notifies the tty driver that it resume sending 163 * This routine notifies the tty driver that it resume sending
162 * characters to the tty device. 164 * characters to the tty device.
163 * 165 *
166 * Called with ->flow_lock held. Serialized with stop() method.
167 *
164 * Optional: 168 * Optional:
165 * 169 *
166 * Note: Call start_tty not this method. 170 * Note: Call start_tty not this method.
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 247cfdcc4b08..ee3277593222 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -49,7 +49,11 @@ struct udp_sock {
49 unsigned int corkflag; /* Cork is required */ 49 unsigned int corkflag; /* Cork is required */
50 __u8 encap_type; /* Is this an Encapsulation socket? */ 50 __u8 encap_type; /* Is this an Encapsulation socket? */
51 unsigned char no_check6_tx:1,/* Send zero UDP6 checksums on TX? */ 51 unsigned char no_check6_tx:1,/* Send zero UDP6 checksums on TX? */
52 no_check6_rx:1;/* Allow zero UDP6 checksums on RX? */ 52 no_check6_rx:1,/* Allow zero UDP6 checksums on RX? */
53 convert_csum:1;/* On receive, convert checksum
54 * unnecessary to checksum complete
55 * if possible.
56 */
53 /* 57 /*
54 * Following member retains the information to create a UDP header 58 * Following member retains the information to create a UDP header
55 * when the socket is uncorked. 59 * when the socket is uncorked.
@@ -98,6 +102,16 @@ static inline bool udp_get_no_check6_rx(struct sock *sk)
98 return udp_sk(sk)->no_check6_rx; 102 return udp_sk(sk)->no_check6_rx;
99} 103}
100 104
105static inline void udp_set_convert_csum(struct sock *sk, bool val)
106{
107 udp_sk(sk)->convert_csum = val;
108}
109
110static inline bool udp_get_convert_csum(struct sock *sk)
111{
112 return udp_sk(sk)->convert_csum;
113}
114
101#define udp_portaddr_for_each_entry(__sk, node, list) \ 115#define udp_portaddr_for_each_entry(__sk, node, list) \
102 hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node) 116 hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node)
103 117
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 09a7cffc224e..9b1581414cd4 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -80,11 +80,14 @@ size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
80 struct iov_iter *i); 80 struct iov_iter *i);
81size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes, 81size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes,
82 struct iov_iter *i); 82 struct iov_iter *i);
83size_t copy_to_iter(void *addr, size_t bytes, struct iov_iter *i);
84size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i);
85size_t iov_iter_zero(size_t bytes, struct iov_iter *);
83unsigned long iov_iter_alignment(const struct iov_iter *i); 86unsigned long iov_iter_alignment(const struct iov_iter *i);
84void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, 87void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov,
85 unsigned long nr_segs, size_t count); 88 unsigned long nr_segs, size_t count);
86ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, 89ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
87 size_t maxsize, size_t *start); 90 size_t maxsize, unsigned maxpages, size_t *start);
88ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, 91ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages,
89 size_t maxsize, size_t *start); 92 size_t maxsize, size_t *start);
90int iov_iter_npages(const struct iov_iter *i, int maxpages); 93int iov_iter_npages(const struct iov_iter *i, int maxpages);
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 1ad4724458de..baa81718d985 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -63,7 +63,17 @@ struct uio_port {
63 63
64#define MAX_UIO_PORT_REGIONS 5 64#define MAX_UIO_PORT_REGIONS 5
65 65
66struct uio_device; 66struct uio_device {
67 struct module *owner;
68 struct device *dev;
69 int minor;
70 atomic_t event;
71 struct fasync_struct *async_queue;
72 wait_queue_head_t wait;
73 struct uio_info *info;
74 struct kobject *map_dir;
75 struct kobject *portio_dir;
76};
67 77
68/** 78/**
69 * struct uio_info - UIO device capabilities 79 * struct uio_info - UIO device capabilities
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 4f844c6b03ee..60beb5dc7977 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -98,11 +98,11 @@ struct uprobes_state {
98 struct xol_area *xol_area; 98 struct xol_area *xol_area;
99}; 99};
100 100
101extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 101extern int set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
102extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 102extern int set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
103extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 103extern bool is_swbp_insn(uprobe_opcode_t *insn);
104extern bool __weak is_trap_insn(uprobe_opcode_t *insn); 104extern bool is_trap_insn(uprobe_opcode_t *insn);
105extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); 105extern unsigned long uprobe_get_swbp_addr(struct pt_regs *regs);
106extern unsigned long uprobe_get_trap_addr(struct pt_regs *regs); 106extern unsigned long uprobe_get_trap_addr(struct pt_regs *regs);
107extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t); 107extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t);
108extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 108extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
@@ -128,8 +128,8 @@ extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
128extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data); 128extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
129extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs); 129extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
130extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs); 130extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
131extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs); 131extern bool arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs);
132extern void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr, 132extern void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
133 void *src, unsigned long len); 133 void *src, unsigned long len);
134#else /* !CONFIG_UPROBES */ 134#else /* !CONFIG_UPROBES */
135struct uprobes_state { 135struct uprobes_state {
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d2465bc0e73c..447a7e2fc19b 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1862,6 +1862,18 @@ extern void usb_unregister_notify(struct notifier_block *nb);
1862/* debugfs stuff */ 1862/* debugfs stuff */
1863extern struct dentry *usb_debug_root; 1863extern struct dentry *usb_debug_root;
1864 1864
1865/* LED triggers */
1866enum usb_led_event {
1867 USB_LED_EVENT_HOST = 0,
1868 USB_LED_EVENT_GADGET = 1,
1869};
1870
1871#ifdef CONFIG_USB_LED_TRIG
1872extern void usb_led_activity(enum usb_led_event ev);
1873#else
1874static inline void usb_led_activity(enum usb_led_event ev) {}
1875#endif
1876
1865#endif /* __KERNEL__ */ 1877#endif /* __KERNEL__ */
1866 1878
1867#endif 1879#endif
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index bbe779f640be..e14c09a45c5a 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -31,6 +31,7 @@ struct ci_hdrc_platform_data {
31#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 31#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
32 void (*notify_event) (struct ci_hdrc *ci, unsigned event); 32 void (*notify_event) (struct ci_hdrc *ci, unsigned event);
33 struct regulator *reg_vbus; 33 struct regulator *reg_vbus;
34 bool tpl_support;
34}; 35};
35 36
36/* Default offset of capability registers */ 37/* Default offset of capability registers */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index c3a61853cd13..522cafe26790 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -345,12 +345,13 @@ static inline int usb_ep_queue(struct usb_ep *ep,
345 * @ep:the endpoint associated with the request 345 * @ep:the endpoint associated with the request
346 * @req:the request being canceled 346 * @req:the request being canceled
347 * 347 *
348 * if the request is still active on the endpoint, it is dequeued and its 348 * If the request is still active on the endpoint, it is dequeued and its
349 * completion routine is called (with status -ECONNRESET); else a negative 349 * completion routine is called (with status -ECONNRESET); else a negative
350 * error code is returned. 350 * error code is returned. This is guaranteed to happen before the call to
351 * usb_ep_dequeue() returns.
351 * 352 *
352 * note that some hardware can't clear out write fifos (to unlink the request 353 * Note that some hardware can't clear out write fifos (to unlink the request
353 * at the head of the queue) except as part of disconnecting from usb. such 354 * at the head of the queue) except as part of disconnecting from usb. Such
354 * restrictions prevent drivers from supporting configuration changes, 355 * restrictions prevent drivers from supporting configuration changes,
355 * even to configuration zero (a "chapter 9" requirement). 356 * even to configuration zero (a "chapter 9" requirement).
356 */ 357 */
@@ -816,6 +817,8 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
816 * Called in a context that permits sleeping. 817 * Called in a context that permits sleeping.
817 * @suspend: Invoked on USB suspend. May be called in_interrupt. 818 * @suspend: Invoked on USB suspend. May be called in_interrupt.
818 * @resume: Invoked on USB resume. May be called in_interrupt. 819 * @resume: Invoked on USB resume. May be called in_interrupt.
820 * @reset: Invoked on USB bus reset. It is mandatory for all gadget drivers
821 * and should be called in_interrupt.
819 * @driver: Driver model state for this driver. 822 * @driver: Driver model state for this driver.
820 * 823 *
821 * Devices are disabled till a gadget driver successfully bind()s, which 824 * Devices are disabled till a gadget driver successfully bind()s, which
@@ -873,6 +876,7 @@ struct usb_gadget_driver {
873 void (*disconnect)(struct usb_gadget *); 876 void (*disconnect)(struct usb_gadget *);
874 void (*suspend)(struct usb_gadget *); 877 void (*suspend)(struct usb_gadget *);
875 void (*resume)(struct usb_gadget *); 878 void (*resume)(struct usb_gadget *);
879 void (*reset)(struct usb_gadget *);
876 880
877 /* FIXME support safe rmmod */ 881 /* FIXME support safe rmmod */
878 struct device_driver driver; 882 struct device_driver driver;
@@ -1013,6 +1017,20 @@ extern void usb_gadget_set_state(struct usb_gadget *gadget,
1013 1017
1014/*-------------------------------------------------------------------------*/ 1018/*-------------------------------------------------------------------------*/
1015 1019
1020/* utility to tell udc core that the bus reset occurs */
1021extern void usb_gadget_udc_reset(struct usb_gadget *gadget,
1022 struct usb_gadget_driver *driver);
1023
1024/*-------------------------------------------------------------------------*/
1025
1026/* utility to give requests back to the gadget layer */
1027
1028extern void usb_gadget_giveback_request(struct usb_ep *ep,
1029 struct usb_request *req);
1030
1031
1032/*-------------------------------------------------------------------------*/
1033
1016/* utility wrapping a simple endpoint selection policy */ 1034/* utility wrapping a simple endpoint selection policy */
1017 1035
1018extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, 1036extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 485cd5e2100c..cd96a2bc3388 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -106,7 +106,8 @@ struct usb_hcd {
106 * OTG and some Host controllers need software interaction with phys; 106 * OTG and some Host controllers need software interaction with phys;
107 * other external phys should be software-transparent 107 * other external phys should be software-transparent
108 */ 108 */
109 struct usb_phy *phy; 109 struct usb_phy *usb_phy;
110 struct phy *phy;
110 111
111 /* Flags that need to be manipulated atomically because they can 112 /* Flags that need to be manipulated atomically because they can
112 * change while the host controller is running. Always use 113 * change while the host controller is running. Always use
@@ -144,6 +145,7 @@ struct usb_hcd {
144 unsigned has_tt:1; /* Integrated TT in root hub */ 145 unsigned has_tt:1; /* Integrated TT in root hub */
145 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */ 146 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */
146 unsigned can_do_streams:1; /* HC supports streams */ 147 unsigned can_do_streams:1; /* HC supports streams */
148 unsigned tpl_support:1; /* OTG & EH TPL support */
147 149
148 unsigned int irq; /* irq allocated */ 150 unsigned int irq; /* irq allocated */
149 void __iomem *regs; /* device memory/io */ 151 void __iomem *regs; /* device memory/io */
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
index 8c38aa26b3bb..cfe0528cdbb1 100644
--- a/include/linux/usb/of.h
+++ b/include/linux/usb/of.h
@@ -14,6 +14,7 @@
14#if IS_ENABLED(CONFIG_OF) 14#if IS_ENABLED(CONFIG_OF)
15enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np); 15enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np);
16enum usb_device_speed of_usb_get_maximum_speed(struct device_node *np); 16enum usb_device_speed of_usb_get_maximum_speed(struct device_node *np);
17bool of_usb_host_tpl_support(struct device_node *np);
17#else 18#else
18static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np) 19static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
19{ 20{
@@ -25,6 +26,10 @@ of_usb_get_maximum_speed(struct device_node *np)
25{ 26{
26 return USB_SPEED_UNKNOWN; 27 return USB_SPEED_UNKNOWN;
27} 28}
29static inline bool of_usb_host_tpl_support(struct device_node *np)
30{
31 return false;
32}
28#endif 33#endif
29 34
30#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT) 35#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT)
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 55a17b188daa..9948c874e3f1 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -8,27 +8,27 @@
8#define __LINUX_USB_QUIRKS_H 8#define __LINUX_USB_QUIRKS_H
9 9
10/* string descriptors must not be fetched using a 255-byte read */ 10/* string descriptors must not be fetched using a 255-byte read */
11#define USB_QUIRK_STRING_FETCH_255 0x00000001 11#define USB_QUIRK_STRING_FETCH_255 BIT(0)
12 12
13/* device can't resume correctly so reset it instead */ 13/* device can't resume correctly so reset it instead */
14#define USB_QUIRK_RESET_RESUME 0x00000002 14#define USB_QUIRK_RESET_RESUME BIT(1)
15 15
16/* device can't handle Set-Interface requests */ 16/* device can't handle Set-Interface requests */
17#define USB_QUIRK_NO_SET_INTF 0x00000004 17#define USB_QUIRK_NO_SET_INTF BIT(2)
18 18
19/* device can't handle its Configuration or Interface strings */ 19/* device can't handle its Configuration or Interface strings */
20#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008 20#define USB_QUIRK_CONFIG_INTF_STRINGS BIT(3)
21 21
22/* device can't be reset(e.g morph devices), don't use reset */ 22/* device can't be reset(e.g morph devices), don't use reset */
23#define USB_QUIRK_RESET 0x00000010 23#define USB_QUIRK_RESET BIT(4)
24 24
25/* device has more interface descriptions than the bNumInterfaces count, 25/* device has more interface descriptions than the bNumInterfaces count,
26 and can't handle talking to these interfaces */ 26 and can't handle talking to these interfaces */
27#define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020 27#define USB_QUIRK_HONOR_BNUMINTERFACES BIT(5)
28 28
29/* device needs a pause during initialization, after we read the device 29/* device needs a pause during initialization, after we read the device
30 descriptor */ 30 descriptor */
31#define USB_QUIRK_DELAY_INIT 0x00000040 31#define USB_QUIRK_DELAY_INIT BIT(6)
32 32
33/* 33/*
34 * For high speed and super speed interupt endpoints, the USB 2.0 and 34 * For high speed and super speed interupt endpoints, the USB 2.0 and
@@ -39,6 +39,12 @@
39 * Devices with this quirk report their bInterval as the result of this 39 * Devices with this quirk report their bInterval as the result of this
40 * calculation instead of the exponent variable used in the calculation. 40 * calculation instead of the exponent variable used in the calculation.
41 */ 41 */
42#define USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL 0x00000080 42#define USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL BIT(7)
43
44/* device can't handle device_qualifier descriptor requests */
45#define USB_QUIRK_DEVICE_QUALIFIER BIT(8)
46
47/* device generates spurious wakeup, ignore remote wakeup capability */
48#define USB_QUIRK_IGNORE_REMOTE_WAKEUP BIT(9)
43 49
44#endif /* __LINUX_USB_QUIRKS_H */ 50#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 26088feb6608..d9a4905e01d0 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -78,6 +78,7 @@ struct usbnet {
78# define EVENT_NO_RUNTIME_PM 9 78# define EVENT_NO_RUNTIME_PM 9
79# define EVENT_RX_KILL 10 79# define EVENT_RX_KILL 10
80# define EVENT_LINK_CHANGE 11 80# define EVENT_LINK_CHANGE 11
81# define EVENT_SET_RX_MODE 12
81}; 82};
82 83
83static inline struct usb_driver *driver_of(struct usb_interface *intf) 84static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -159,6 +160,9 @@ struct driver_info {
159 /* called by minidriver when receiving indication */ 160 /* called by minidriver when receiving indication */
160 void (*indication)(struct usbnet *dev, void *ind, int indlen); 161 void (*indication)(struct usbnet *dev, void *ind, int indlen);
161 162
163 /* rx mode change (device changes address list filtering) */
164 void (*set_rx_mode)(struct usbnet *dev);
165
162 /* for new devices, use the descriptor-reading code instead */ 166 /* for new devices, use the descriptor-reading code instead */
163 int in; /* rx endpoint */ 167 int in; /* rx endpoint */
164 int out; /* tx endpoint */ 168 int out; /* tx endpoint */
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 9b7de1b46437..a7f2604c5f25 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -73,6 +73,10 @@
73 /* Device advertises UAS but it is broken */ \ 73 /* Device advertises UAS but it is broken */ \
74 US_FLAG(BROKEN_FUA, 0x01000000) \ 74 US_FLAG(BROKEN_FUA, 0x01000000) \
75 /* Cannot handle FUA in WRITE or READ CDBs */ \ 75 /* Cannot handle FUA in WRITE or READ CDBs */ \
76 US_FLAG(NO_ATA_1X, 0x02000000) \
77 /* Cannot handle ATA_12 or ATA_16 CDBs */ \
78 US_FLAG(NO_REPORT_OPCODES, 0x04000000) \
79 /* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \
76 80
77#define US_FLAG(name, value) US_FL_##name = value , 81#define US_FLAG(name, value) US_FL_##name = value ,
78enum { US_DO_ALL_FLAGS }; 82enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 4836ba3c1cd8..e95372654f09 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -57,9 +57,9 @@ static inline void put_user_ns(struct user_namespace *ns)
57} 57}
58 58
59struct seq_operations; 59struct seq_operations;
60extern struct seq_operations proc_uid_seq_operations; 60extern const struct seq_operations proc_uid_seq_operations;
61extern struct seq_operations proc_gid_seq_operations; 61extern const struct seq_operations proc_gid_seq_operations;
62extern struct seq_operations proc_projid_seq_operations; 62extern const struct seq_operations proc_projid_seq_operations;
63extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *); 63extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *);
64extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *); 64extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *);
65extern ssize_t proc_projid_map_write(struct file *, const char __user *, size_t, loff_t *); 65extern ssize_t proc_projid_map_write(struct file *, const char __user *, size_t, loff_t *);
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 8ec980b5e3af..d3204115f15d 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -98,4 +98,27 @@ extern int vfio_external_user_iommu_id(struct vfio_group *group);
98extern long vfio_external_check_extension(struct vfio_group *group, 98extern long vfio_external_check_extension(struct vfio_group *group,
99 unsigned long arg); 99 unsigned long arg);
100 100
101struct pci_dev;
102#ifdef CONFIG_EEH
103extern void vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
104extern void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
105extern long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
106 unsigned int cmd,
107 unsigned long arg);
108#else
109static inline void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
110{
111}
112
113static inline void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
114{
115}
116
117static inline long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
118 unsigned int cmd,
119 unsigned long arg)
120{
121 return -ENOTTY;
122}
123#endif /* CONFIG_EEH */
101#endif /* VFIO_H */ 124#endif /* VFIO_H */
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index 502073a53dd3..b483abd34493 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -64,6 +64,7 @@ int vga_switcheroo_get_client_state(struct pci_dev *dev);
64void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic); 64void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic);
65 65
66int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain); 66int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain);
67void vga_switcheroo_fini_domain_pm_ops(struct device *dev);
67int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain); 68int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain);
68#else 69#else
69 70
@@ -82,6 +83,7 @@ static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return
82static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {} 83static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {}
83 84
84static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } 85static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; }
86static inline void vga_switcheroo_fini_domain_pm_ops(struct device *dev) {}
85static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } 87static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; }
86 88
87#endif 89#endif
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 2c02f3a8d2ba..c37bd4d06739 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -182,7 +182,6 @@ extern void vga_put(struct pci_dev *pdev, unsigned int rsrc);
182 * vga_get()... 182 * vga_get()...
183 */ 183 */
184 184
185#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
186#ifdef CONFIG_VGA_ARB 185#ifdef CONFIG_VGA_ARB
187extern struct pci_dev *vga_default_device(void); 186extern struct pci_dev *vga_default_device(void);
188extern void vga_set_default_device(struct pci_dev *pdev); 187extern void vga_set_default_device(struct pci_dev *pdev);
@@ -190,7 +189,6 @@ extern void vga_set_default_device(struct pci_dev *pdev);
190static inline struct pci_dev *vga_default_device(void) { return NULL; }; 189static inline struct pci_dev *vga_default_device(void) { return NULL; };
191static inline void vga_set_default_device(struct pci_dev *pdev) { }; 190static inline void vga_set_default_device(struct pci_dev *pdev) { };
192#endif 191#endif
193#endif
194 192
195/** 193/**
196 * vga_conflicts 194 * vga_conflicts
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index b46671e28de2..65261a7244fc 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -78,6 +78,10 @@ bool virtqueue_is_broken(struct virtqueue *vq);
78/** 78/**
79 * virtio_device - representation of a device using virtio 79 * virtio_device - representation of a device using virtio
80 * @index: unique position on the virtio bus 80 * @index: unique position on the virtio bus
81 * @failed: saved value for CONFIG_S_FAILED bit (for restore)
82 * @config_enabled: configuration change reporting enabled
83 * @config_change_pending: configuration change reported while disabled
84 * @config_lock: protects configuration change reporting
81 * @dev: underlying device. 85 * @dev: underlying device.
82 * @id: the device type identification (used to match it with a driver). 86 * @id: the device type identification (used to match it with a driver).
83 * @config: the configuration ops for this device. 87 * @config: the configuration ops for this device.
@@ -88,6 +92,10 @@ bool virtqueue_is_broken(struct virtqueue *vq);
88 */ 92 */
89struct virtio_device { 93struct virtio_device {
90 int index; 94 int index;
95 bool failed;
96 bool config_enabled;
97 bool config_change_pending;
98 spinlock_t config_lock;
91 struct device dev; 99 struct device dev;
92 struct virtio_device_id id; 100 struct virtio_device_id id;
93 const struct virtio_config_ops *config; 101 const struct virtio_config_ops *config;
@@ -108,6 +116,12 @@ void unregister_virtio_device(struct virtio_device *dev);
108 116
109void virtio_break_device(struct virtio_device *dev); 117void virtio_break_device(struct virtio_device *dev);
110 118
119void virtio_config_changed(struct virtio_device *dev);
120#ifdef CONFIG_PM_SLEEP
121int virtio_device_freeze(struct virtio_device *dev);
122int virtio_device_restore(struct virtio_device *dev);
123#endif
124
111/** 125/**
112 * virtio_driver - operations for a virtio I/O driver 126 * virtio_driver - operations for a virtio I/O driver
113 * @driver: underlying device driver (populate name and owner). 127 * @driver: underlying device driver (populate name and owner).
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index e8f8f71e843c..7f4ef66873ef 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -109,6 +109,23 @@ struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
109 return vq; 109 return vq;
110} 110}
111 111
112/**
113 * virtio_device_ready - enable vq use in probe function
114 * @vdev: the device
115 *
116 * Driver must call this to use vqs in the probe function.
117 *
118 * Note: vqs are enabled automatically after probe returns.
119 */
120static inline
121void virtio_device_ready(struct virtio_device *dev)
122{
123 unsigned status = dev->config->get_status(dev);
124
125 BUG_ON(status & VIRTIO_CONFIG_S_DRIVER_OK);
126 dev->config->set_status(dev, status | VIRTIO_CONFIG_S_DRIVER_OK);
127}
128
112static inline 129static inline
113const char *virtio_bus_name(struct virtio_device *vdev) 130const char *virtio_bus_name(struct virtio_device *vdev)
114{ 131{
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index ced92345c963..730334cdf037 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -72,6 +72,13 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
72 THP_ZERO_PAGE_ALLOC, 72 THP_ZERO_PAGE_ALLOC,
73 THP_ZERO_PAGE_ALLOC_FAILED, 73 THP_ZERO_PAGE_ALLOC_FAILED,
74#endif 74#endif
75#ifdef CONFIG_MEMORY_BALLOON
76 BALLOON_INFLATE,
77 BALLOON_DEFLATE,
78#ifdef CONFIG_BALLOON_COMPACTION
79 BALLOON_MIGRATE,
80#endif
81#endif
75#ifdef CONFIG_DEBUG_TLBFLUSH 82#ifdef CONFIG_DEBUG_TLBFLUSH
76#ifdef CONFIG_SMP 83#ifdef CONFIG_SMP
77 NR_TLB_REMOTE_FLUSH, /* cpu tried to flush others' tlbs */ 84 NR_TLB_REMOTE_FLUSH, /* cpu tried to flush others' tlbs */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 4b8a89189a29..b87696fdf06a 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -113,7 +113,7 @@ extern struct vm_struct *remove_vm_area(const void *addr);
113extern struct vm_struct *find_vm_area(const void *addr); 113extern struct vm_struct *find_vm_area(const void *addr);
114 114
115extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 115extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
116 struct page ***pages); 116 struct page **pages);
117#ifdef CONFIG_MMU 117#ifdef CONFIG_MMU
118extern int map_kernel_range_noflush(unsigned long start, unsigned long size, 118extern int map_kernel_range_noflush(unsigned long start, unsigned long size,
119 pgprot_t prot, struct page **pages); 119 pgprot_t prot, struct page **pages);
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 6fb1ba5f9b2f..e4a8eb9312ea 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -25,7 +25,7 @@ struct wait_bit_key {
25 void *flags; 25 void *flags;
26 int bit_nr; 26 int bit_nr;
27#define WAIT_ATOMIC_T_BIT_NR -1 27#define WAIT_ATOMIC_T_BIT_NR -1
28 unsigned long private; 28 unsigned long timeout;
29}; 29};
30 30
31struct wait_bit_queue { 31struct wait_bit_queue {
@@ -154,6 +154,7 @@ int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, wait_bit_ac
154void wake_up_bit(void *, int); 154void wake_up_bit(void *, int);
155void wake_up_atomic_t(atomic_t *); 155void wake_up_atomic_t(atomic_t *);
156int out_of_line_wait_on_bit(void *, int, wait_bit_action_f *, unsigned); 156int out_of_line_wait_on_bit(void *, int, wait_bit_action_f *, unsigned);
157int out_of_line_wait_on_bit_timeout(void *, int, wait_bit_action_f *, unsigned, unsigned long);
157int out_of_line_wait_on_bit_lock(void *, int, wait_bit_action_f *, unsigned); 158int out_of_line_wait_on_bit_lock(void *, int, wait_bit_action_f *, unsigned);
158int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned); 159int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned);
159wait_queue_head_t *bit_waitqueue(void *, int); 160wait_queue_head_t *bit_waitqueue(void *, int);
@@ -280,9 +281,11 @@ do { \
280 * wake_up() has to be called after changing any variable that could 281 * wake_up() has to be called after changing any variable that could
281 * change the result of the wait condition. 282 * change the result of the wait condition.
282 * 283 *
283 * The function returns 0 if the @timeout elapsed, or the remaining 284 * Returns:
284 * jiffies (at least 1) if the @condition evaluated to %true before 285 * 0 if the @condition evaluated to %false after the @timeout elapsed,
285 * the @timeout elapsed. 286 * 1 if the @condition evaluated to %true after the @timeout elapsed,
287 * or the remaining jiffies (at least 1) if the @condition evaluated
288 * to %true before the @timeout elapsed.
286 */ 289 */
287#define wait_event_timeout(wq, condition, timeout) \ 290#define wait_event_timeout(wq, condition, timeout) \
288({ \ 291({ \
@@ -363,9 +366,11 @@ do { \
363 * change the result of the wait condition. 366 * change the result of the wait condition.
364 * 367 *
365 * Returns: 368 * Returns:
366 * 0 if the @timeout elapsed, -%ERESTARTSYS if it was interrupted by 369 * 0 if the @condition evaluated to %false after the @timeout elapsed,
367 * a signal, or the remaining jiffies (at least 1) if the @condition 370 * 1 if the @condition evaluated to %true after the @timeout elapsed,
368 * evaluated to %true before the @timeout elapsed. 371 * the remaining jiffies (at least 1) if the @condition evaluated
372 * to %true before the @timeout elapsed, or -%ERESTARTSYS if it was
373 * interrupted by a signal.
369 */ 374 */
370#define wait_event_interruptible_timeout(wq, condition, timeout) \ 375#define wait_event_interruptible_timeout(wq, condition, timeout) \
371({ \ 376({ \
@@ -859,6 +864,8 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
859 864
860extern int bit_wait(struct wait_bit_key *); 865extern int bit_wait(struct wait_bit_key *);
861extern int bit_wait_io(struct wait_bit_key *); 866extern int bit_wait_io(struct wait_bit_key *);
867extern int bit_wait_timeout(struct wait_bit_key *);
868extern int bit_wait_io_timeout(struct wait_bit_key *);
862 869
863/** 870/**
864 * wait_on_bit - wait for a bit to be cleared 871 * wait_on_bit - wait for a bit to be cleared
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 2a3038ee17a3..395b70e0eccf 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -97,13 +97,8 @@ struct watchdog_device {
97#define WDOG_UNREGISTERED 4 /* Has the device been unregistered */ 97#define WDOG_UNREGISTERED 4 /* Has the device been unregistered */
98}; 98};
99 99
100#ifdef CONFIG_WATCHDOG_NOWAYOUT 100#define WATCHDOG_NOWAYOUT IS_BUILTIN(CONFIG_WATCHDOG_NOWAYOUT)
101#define WATCHDOG_NOWAYOUT 1 101#define WATCHDOG_NOWAYOUT_INIT_STATUS (WATCHDOG_NOWAYOUT << WDOG_NO_WAY_OUT)
102#define WATCHDOG_NOWAYOUT_INIT_STATUS (1 << WDOG_NO_WAY_OUT)
103#else
104#define WATCHDOG_NOWAYOUT 0
105#define WATCHDOG_NOWAYOUT_INIT_STATUS 0
106#endif
107 102
108/* Use the following function to check whether or not the watchdog is active */ 103/* Use the following function to check whether or not the watchdog is active */
109static inline bool watchdog_active(struct watchdog_device *wdd) 104static inline bool watchdog_active(struct watchdog_device *wdd)
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index a0cc2e95ed1b..b996e6cde6bb 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -419,7 +419,7 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
419 alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \ 419 alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \
420 1, (name)) 420 1, (name))
421#define create_singlethread_workqueue(name) \ 421#define create_singlethread_workqueue(name) \
422 alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM, 1, (name)) 422 alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name)
423 423
424extern void destroy_workqueue(struct workqueue_struct *wq); 424extern void destroy_workqueue(struct workqueue_struct *wq);
425 425
diff --git a/include/linux/zbud.h b/include/linux/zbud.h
index 13af0d450bf6..f9d41a6e361f 100644
--- a/include/linux/zbud.h
+++ b/include/linux/zbud.h
@@ -11,7 +11,7 @@ struct zbud_ops {
11 11
12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops); 12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops);
13void zbud_destroy_pool(struct zbud_pool *pool); 13void zbud_destroy_pool(struct zbud_pool *pool);
14int zbud_alloc(struct zbud_pool *pool, unsigned int size, gfp_t gfp, 14int zbud_alloc(struct zbud_pool *pool, size_t size, gfp_t gfp,
15 unsigned long *handle); 15 unsigned long *handle);
16void zbud_free(struct zbud_pool *pool, unsigned long handle); 16void zbud_free(struct zbud_pool *pool, unsigned long handle);
17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries); 17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries);
diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 9c5a6b4de0a3..92dbbd3f6c75 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -83,11 +83,11 @@ struct internal_state;
83 83
84typedef struct z_stream_s { 84typedef struct z_stream_s {
85 const Byte *next_in; /* next input byte */ 85 const Byte *next_in; /* next input byte */
86 uInt avail_in; /* number of bytes available at next_in */ 86 uLong avail_in; /* number of bytes available at next_in */
87 uLong total_in; /* total nb of input bytes read so far */ 87 uLong total_in; /* total nb of input bytes read so far */
88 88
89 Byte *next_out; /* next output byte should be put there */ 89 Byte *next_out; /* next output byte should be put there */
90 uInt avail_out; /* remaining free space at next_out */ 90 uLong avail_out; /* remaining free space at next_out */
91 uLong total_out; /* total nb of bytes output so far */ 91 uLong total_out; /* total nb of bytes output so far */
92 92
93 char *msg; /* last error message, NULL if no error */ 93 char *msg; /* last error message, NULL if no error */
@@ -493,64 +493,6 @@ extern int deflateInit2 (z_streamp strm,
493 method). msg is set to null if there is no error message. deflateInit2 does 493 method). msg is set to null if there is no error message. deflateInit2 does
494 not perform any compression: this will be done by deflate(). 494 not perform any compression: this will be done by deflate().
495*/ 495*/
496
497#if 0
498extern int zlib_deflateSetDictionary (z_streamp strm,
499 const Byte *dictionary,
500 uInt dictLength);
501#endif
502/*
503 Initializes the compression dictionary from the given byte sequence
504 without producing any compressed output. This function must be called
505 immediately after deflateInit, deflateInit2 or deflateReset, before any
506 call of deflate. The compressor and decompressor must use exactly the same
507 dictionary (see inflateSetDictionary).
508
509 The dictionary should consist of strings (byte sequences) that are likely
510 to be encountered later in the data to be compressed, with the most commonly
511 used strings preferably put towards the end of the dictionary. Using a
512 dictionary is most useful when the data to be compressed is short and can be
513 predicted with good accuracy; the data can then be compressed better than
514 with the default empty dictionary.
515
516 Depending on the size of the compression data structures selected by
517 deflateInit or deflateInit2, a part of the dictionary may in effect be
518 discarded, for example if the dictionary is larger than the window size in
519 deflate or deflate2. Thus the strings most likely to be useful should be
520 put at the end of the dictionary, not at the front.
521
522 Upon return of this function, strm->adler is set to the Adler32 value
523 of the dictionary; the decompressor may later use this value to determine
524 which dictionary has been used by the compressor. (The Adler32 value
525 applies to the whole dictionary even if only a subset of the dictionary is
526 actually used by the compressor.)
527
528 deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
529 parameter is invalid (such as NULL dictionary) or the stream state is
530 inconsistent (for example if deflate has already been called for this stream
531 or if the compression method is bsort). deflateSetDictionary does not
532 perform any compression: this will be done by deflate().
533*/
534
535#if 0
536extern int zlib_deflateCopy (z_streamp dest, z_streamp source);
537#endif
538
539/*
540 Sets the destination stream as a complete copy of the source stream.
541
542 This function can be useful when several compression strategies will be
543 tried, for example when there are several ways of pre-processing the input
544 data with a filter. The streams that will be discarded should then be freed
545 by calling deflateEnd. Note that deflateCopy duplicates the internal
546 compression state which can be quite large, so this strategy is slow and
547 can consume lots of memory.
548
549 deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
550 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
551 (such as zalloc being NULL). msg is left unchanged in both source and
552 destination.
553*/
554 496
555extern int zlib_deflateReset (z_streamp strm); 497extern int zlib_deflateReset (z_streamp strm);
556/* 498/*
@@ -568,27 +510,6 @@ static inline unsigned long deflateBound(unsigned long s)
568 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11; 510 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11;
569} 511}
570 512
571#if 0
572extern int zlib_deflateParams (z_streamp strm, int level, int strategy);
573#endif
574/*
575 Dynamically update the compression level and compression strategy. The
576 interpretation of level and strategy is as in deflateInit2. This can be
577 used to switch between compression and straight copy of the input data, or
578 to switch to a different kind of input data requiring a different
579 strategy. If the compression level is changed, the input available so far
580 is compressed with the old level (and may be flushed); the new level will
581 take effect only at the next call of deflate().
582
583 Before the call of deflateParams, the stream state must be set as for
584 a call of deflate(), since the currently available input may have to
585 be compressed and flushed. In particular, strm->avail_out must be non-zero.
586
587 deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
588 stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
589 if strm->avail_out was zero.
590*/
591
592/* 513/*
593extern int inflateInit2 (z_streamp strm, int windowBits); 514extern int inflateInit2 (z_streamp strm, int windowBits);
594 515
@@ -631,45 +552,6 @@ extern int inflateInit2 (z_streamp strm, int windowBits);
631 and avail_out are unchanged.) 552 and avail_out are unchanged.)
632*/ 553*/
633 554
634extern int zlib_inflateSetDictionary (z_streamp strm,
635 const Byte *dictionary,
636 uInt dictLength);
637/*
638 Initializes the decompression dictionary from the given uncompressed byte
639 sequence. This function must be called immediately after a call of inflate,
640 if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
641 can be determined from the adler32 value returned by that call of inflate.
642 The compressor and decompressor must use exactly the same dictionary (see
643 deflateSetDictionary). For raw inflate, this function can be called
644 immediately after inflateInit2() or inflateReset() and before any call of
645 inflate() to set the dictionary. The application must insure that the
646 dictionary that was used for compression is provided.
647
648 inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
649 parameter is invalid (such as NULL dictionary) or the stream state is
650 inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
651 expected one (incorrect adler32 value). inflateSetDictionary does not
652 perform any decompression: this will be done by subsequent calls of
653 inflate().
654*/
655
656#if 0
657extern int zlib_inflateSync (z_streamp strm);
658#endif
659/*
660 Skips invalid compressed data until a full flush point (see above the
661 description of deflate with Z_FULL_FLUSH) can be found, or until all
662 available input is skipped. No output is provided.
663
664 inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
665 if no more input was provided, Z_DATA_ERROR if no flush point has been found,
666 or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
667 case, the application may save the current current value of total_in which
668 indicates where valid compressed data was found. In the error case, the
669 application may repeatedly call inflateSync, providing more input each time,
670 until success or end of the input data.
671*/
672
673extern int zlib_inflateReset (z_streamp strm); 555extern int zlib_inflateReset (z_streamp strm);
674/* 556/*
675 This function is equivalent to inflateEnd followed by inflateInit, 557 This function is equivalent to inflateEnd followed by inflateInit,
diff --git a/include/linux/zpool.h b/include/linux/zpool.h
new file mode 100644
index 000000000000..f14bd75f08b3
--- /dev/null
+++ b/include/linux/zpool.h
@@ -0,0 +1,106 @@
1/*
2 * zpool memory storage api
3 *
4 * Copyright (C) 2014 Dan Streetman
5 *
6 * This is a common frontend for the zbud and zsmalloc memory
7 * storage pool implementations. Typically, this is used to
8 * store compressed memory.
9 */
10
11#ifndef _ZPOOL_H_
12#define _ZPOOL_H_
13
14struct zpool;
15
16struct zpool_ops {
17 int (*evict)(struct zpool *pool, unsigned long handle);
18};
19
20/*
21 * Control how a handle is mapped. It will be ignored if the
22 * implementation does not support it. Its use is optional.
23 * Note that this does not refer to memory protection, it
24 * refers to how the memory will be copied in/out if copying
25 * is necessary during mapping; read-write is the safest as
26 * it copies the existing memory in on map, and copies the
27 * changed memory back out on unmap. Write-only does not copy
28 * in the memory and should only be used for initialization.
29 * If in doubt, use ZPOOL_MM_DEFAULT which is read-write.
30 */
31enum zpool_mapmode {
32 ZPOOL_MM_RW, /* normal read-write mapping */
33 ZPOOL_MM_RO, /* read-only (no copy-out at unmap time) */
34 ZPOOL_MM_WO, /* write-only (no copy-in at map time) */
35
36 ZPOOL_MM_DEFAULT = ZPOOL_MM_RW
37};
38
39struct zpool *zpool_create_pool(char *type, gfp_t gfp, struct zpool_ops *ops);
40
41char *zpool_get_type(struct zpool *pool);
42
43void zpool_destroy_pool(struct zpool *pool);
44
45int zpool_malloc(struct zpool *pool, size_t size, gfp_t gfp,
46 unsigned long *handle);
47
48void zpool_free(struct zpool *pool, unsigned long handle);
49
50int zpool_shrink(struct zpool *pool, unsigned int pages,
51 unsigned int *reclaimed);
52
53void *zpool_map_handle(struct zpool *pool, unsigned long handle,
54 enum zpool_mapmode mm);
55
56void zpool_unmap_handle(struct zpool *pool, unsigned long handle);
57
58u64 zpool_get_total_size(struct zpool *pool);
59
60
61/**
62 * struct zpool_driver - driver implementation for zpool
63 * @type: name of the driver.
64 * @list: entry in the list of zpool drivers.
65 * @create: create a new pool.
66 * @destroy: destroy a pool.
67 * @malloc: allocate mem from a pool.
68 * @free: free mem from a pool.
69 * @shrink: shrink the pool.
70 * @map: map a handle.
71 * @unmap: unmap a handle.
72 * @total_size: get total size of a pool.
73 *
74 * This is created by a zpool implementation and registered
75 * with zpool.
76 */
77struct zpool_driver {
78 char *type;
79 struct module *owner;
80 atomic_t refcount;
81 struct list_head list;
82
83 void *(*create)(gfp_t gfp, struct zpool_ops *ops);
84 void (*destroy)(void *pool);
85
86 int (*malloc)(void *pool, size_t size, gfp_t gfp,
87 unsigned long *handle);
88 void (*free)(void *pool, unsigned long handle);
89
90 int (*shrink)(void *pool, unsigned int pages,
91 unsigned int *reclaimed);
92
93 void *(*map)(void *pool, unsigned long handle,
94 enum zpool_mapmode mm);
95 void (*unmap)(void *pool, unsigned long handle);
96
97 u64 (*total_size)(void *pool);
98};
99
100void zpool_register_driver(struct zpool_driver *driver);
101
102int zpool_unregister_driver(struct zpool_driver *driver);
103
104int zpool_evict(void *pool, unsigned long handle);
105
106#endif
diff --git a/include/linux/zsmalloc.h b/include/linux/zsmalloc.h
index e44d634e7fb7..05c214760977 100644
--- a/include/linux/zsmalloc.h
+++ b/include/linux/zsmalloc.h
@@ -46,6 +46,6 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle,
46 enum zs_mapmode mm); 46 enum zs_mapmode mm);
47void zs_unmap_object(struct zs_pool *pool, unsigned long handle); 47void zs_unmap_object(struct zs_pool *pool, unsigned long handle);
48 48
49u64 zs_get_total_size_bytes(struct zs_pool *pool); 49unsigned long zs_get_total_pages(struct zs_pool *pool);
50 50
51#endif 51#endif