aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2013-11-14 20:38:05 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2013-11-14 20:38:05 -0500
commit42249094f79422fbf5ed4b54eeb48ff096809b8f (patch)
tree91e6850c8c7e8cc284cf8bb6363f8662f84011f4 /include/linux
parent936816161978ca716a56c5e553c68f25972b1e3a (diff)
parent2c027b7c48a888ab173ba45babb4525e278375d9 (diff)
Merge branch 'next' into for-linus
Merge first round of changes for 3.13 merge window.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h10
-rw-r--r--include/linux/aer.h22
-rw-r--r--include/linux/aio.h21
-rw-r--r--include/linux/alarmtimer.h4
-rw-r--r--include/linux/amba/pl080.h1
-rw-r--r--include/linux/amba/pl08x.h8
-rw-r--r--include/linux/anon_inodes.h3
-rw-r--r--include/linux/arm-cci.h61
-rw-r--r--include/linux/async_tx.h4
-rw-r--r--include/linux/ata.h123
-rw-r--r--include/linux/atmel-ssc.h2
-rw-r--r--include/linux/atmel_serial.h2
-rw-r--r--include/linux/audit.h26
-rw-r--r--include/linux/backing-dev.h3
-rw-r--r--include/linux/backlight.h6
-rw-r--r--include/linux/balloon_compaction.h25
-rw-r--r--include/linux/bcma/bcma.h18
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h55
-rw-r--r--include/linux/bcma/bcma_driver_pci.h25
-rw-r--r--include/linux/binfmts.h2
-rw-r--r--include/linux/bio.h4
-rw-r--r--include/linux/blkdev.h11
-rw-r--r--include/linux/bootmem.h2
-rw-r--r--include/linux/buffer_head.h8
-rw-r--r--include/linux/can/platform/flexcan.h20
-rw-r--r--include/linux/can/platform/mcp251x.h15
-rw-r--r--include/linux/capability.h1
-rw-r--r--include/linux/ceph/decode.h5
-rw-r--r--include/linux/ceph/osd_client.h3
-rw-r--r--include/linux/cgroup.h489
-rw-r--r--include/linux/cgroup_subsys.h45
-rw-r--r--include/linux/clk-private.h3
-rw-r--r--include/linux/clk-provider.h93
-rw-r--r--include/linux/clk/tegra.h6
-rw-r--r--include/linux/clk/zynq.h8
-rw-r--r--include/linux/clockchips.h5
-rw-r--r--include/linux/clocksource.h8
-rw-r--r--include/linux/cmdline-parser.h43
-rw-r--r--include/linux/coda.h1
-rw-r--r--include/linux/compat.h8
-rw-r--r--include/linux/completion.h2
-rw-r--r--include/linux/console.h3
-rw-r--r--include/linux/context_tracking.h103
-rw-r--r--include/linux/context_tracking_state.h39
-rw-r--r--include/linux/cpu.h14
-rw-r--r--include/linux/cpu_cooling.h4
-rw-r--r--include/linux/cpu_rmap.h3
-rw-r--r--include/linux/cpufreq.h397
-rw-r--r--include/linux/cpuidle.h15
-rw-r--r--include/linux/crash_dump.h9
-rw-r--r--include/linux/crc-t10dif.h4
-rw-r--r--include/linux/dcache.h76
-rw-r--r--include/linux/debug_locks.h4
-rw-r--r--include/linux/debugfs.h9
-rw-r--r--include/linux/debugobjects.h6
-rw-r--r--include/linux/decompress/unlz4.h10
-rw-r--r--include/linux/devfreq.h2
-rw-r--r--include/linux/device-mapper.h18
-rw-r--r--include/linux/device.h97
-rw-r--r--include/linux/dm9000.h4
-rw-r--r--include/linux/dma-contiguous.h64
-rw-r--r--include/linux/dma-mapping.h5
-rw-r--r--include/linux/dma/mmp-pdma.h15
-rw-r--r--include/linux/dmaengine.h59
-rw-r--r--include/linux/drbd.h6
-rw-r--r--include/linux/drbd_genl.h2
-rw-r--r--include/linux/drbd_limits.h9
-rw-r--r--include/linux/dw_apb_timer.h2
-rw-r--r--include/linux/edac.h7
-rw-r--r--include/linux/efi.h32
-rw-r--r--include/linux/elevator.h6
-rw-r--r--include/linux/err.h13
-rw-r--r--include/linux/etherdevice.h15
-rw-r--r--include/linux/eventfd.h3
-rw-r--r--include/linux/extcon/of_extcon.h31
-rw-r--r--include/linux/f2fs_fs.h24
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/filter.h5
-rw-r--r--include/linux/firewire.h3
-rw-r--r--include/linux/firmware.h11
-rw-r--r--include/linux/fmc-sdb.h36
-rw-r--r--include/linux/fmc.h237
-rw-r--r--include/linux/freezer.h171
-rw-r--r--include/linux/fs.h151
-rw-r--r--include/linux/fs_enet_pd.h6
-rw-r--r--include/linux/fs_struct.h11
-rw-r--r--include/linux/fscache-cache.h179
-rw-r--r--include/linux/fscache.h42
-rw-r--r--include/linux/fsl/mxs-dma.h20
-rw-r--r--include/linux/fsnotify.h8
-rw-r--r--include/linux/ftrace.h9
-rw-r--r--include/linux/ftrace_event.h46
-rw-r--r--include/linux/genalloc.h4
-rw-r--r--include/linux/gfp.h2
-rw-r--r--include/linux/hardirq.h123
-rw-r--r--include/linux/hdmi.h53
-rw-r--r--include/linux/hid-sensor-hub.h2
-rw-r--r--include/linux/hid-sensor-ids.h2
-rw-r--r--include/linux/hid.h20
-rw-r--r--include/linux/hidraw.h1
-rw-r--r--include/linux/huge_mm.h11
-rw-r--r--include/linux/hugetlb.h47
-rw-r--r--include/linux/hyperv.h104
-rw-r--r--include/linux/i2c.h24
-rw-r--r--include/linux/i2c/i2c-hid.h3
-rw-r--r--include/linux/i2c/pxa-i2c.h3
-rw-r--r--include/linux/i2c/twl.h31
-rw-r--r--include/linux/ieee80211.h82
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_macvlan.h12
-rw-r--r--include/linux/if_team.h29
-rw-r--r--include/linux/if_vlan.h7
-rw-r--r--include/linux/igmp.h2
-rw-r--r--include/linux/iio/common/st_sensors.h38
-rw-r--r--include/linux/iio/frequency/adf4350.h4
-rw-r--r--include/linux/iio/iio.h58
-rw-r--r--include/linux/iio/sysfs.h5
-rw-r--r--include/linux/iio/trigger.h3
-rw-r--r--include/linux/inetdevice.h39
-rw-r--r--include/linux/init.h20
-rw-r--r--include/linux/input/ti_am335x_tsc.h23
-rw-r--r--include/linux/intel-iommu.h2
-rw-r--r--include/linux/interrupt.h75
-rw-r--r--include/linux/io.h25
-rw-r--r--include/linux/iommu.h16
-rw-r--r--include/linux/ipc_namespace.h2
-rw-r--r--include/linux/ipmi-fru.h135
-rw-r--r--include/linux/ipv6.h4
-rw-r--r--include/linux/irq.h62
-rw-r--r--include/linux/irqchip.h4
-rw-r--r--include/linux/irqchip/arm-gic.h1
-rw-r--r--include/linux/irqchip/mmp.h6
-rw-r--r--include/linux/irqdesc.h3
-rw-r--r--include/linux/irqdomain.h140
-rw-r--r--include/linux/irqnr.h19
-rw-r--r--include/linux/jbd.h45
-rw-r--r--include/linux/jbd2.h175
-rw-r--r--include/linux/jbd_common.h26
-rw-r--r--include/linux/jiffies.h12
-rw-r--r--include/linux/jump_label.h28
-rw-r--r--include/linux/jump_label_ratelimit.h34
-rw-r--r--include/linux/kbd_kern.h3
-rw-r--r--include/linux/kernel.h27
-rw-r--r--include/linux/kernel_stat.h34
-rw-r--r--include/linux/kobject.h4
-rw-r--r--include/linux/kobject_ns.h2
-rw-r--r--include/linux/kprobes.h34
-rw-r--r--include/linux/ktime.h51
-rw-r--r--include/linux/kvm_host.h55
-rw-r--r--include/linux/lcd.h5
-rw-r--r--include/linux/libata.h125
-rw-r--r--include/linux/list.h11
-rw-r--r--include/linux/list_lru.h131
-rw-r--r--include/linux/llist.h42
-rw-r--r--include/linux/lockdep.h92
-rw-r--r--include/linux/lockref.h39
-rw-r--r--include/linux/loop.h85
-rw-r--r--include/linux/lz4.h87
-rw-r--r--include/linux/marvell_phy.h2
-rw-r--r--include/linux/math64.h19
-rw-r--r--include/linux/mbus.h16
-rw-r--r--include/linux/memblock.h2
-rw-r--r--include/linux/memcontrol.h104
-rw-r--r--include/linux/memory.h14
-rw-r--r--include/linux/memory_hotplug.h14
-rw-r--r--include/linux/mempolicy.h11
-rw-r--r--include/linux/mfd/88pm80x.h17
-rw-r--r--include/linux/mfd/abx500/ab8500-sysctrl.h4
-rw-r--r--include/linux/mfd/abx500/ab8500.h2
-rw-r--r--include/linux/mfd/arizona/core.h4
-rw-r--r--include/linux/mfd/arizona/gpio.h96
-rw-r--r--include/linux/mfd/arizona/pdata.h2
-rw-r--r--include/linux/mfd/arizona/registers.h47
-rw-r--r--include/linux/mfd/da9063/core.h93
-rw-r--r--include/linux/mfd/da9063/pdata.h111
-rw-r--r--include/linux/mfd/da9063/registers.h1028
-rw-r--r--include/linux/mfd/davinci_voicecodec.h8
-rw-r--r--include/linux/mfd/dbx500-prcmu.h12
-rw-r--r--include/linux/mfd/kempld.h125
-rw-r--r--include/linux/mfd/max77693-private.h13
-rw-r--r--include/linux/mfd/max77693.h18
-rw-r--r--include/linux/mfd/max8998-private.h7
-rw-r--r--include/linux/mfd/max8998.h20
-rw-r--r--include/linux/mfd/mc13xxx.h100
-rw-r--r--include/linux/mfd/mcp.h2
-rw-r--r--include/linux/mfd/palmas.h142
-rw-r--r--include/linux/mfd/rtsx_common.h3
-rw-r--r--include/linux/mfd/rtsx_pci.h67
-rw-r--r--include/linux/mfd/samsung/core.h6
-rw-r--r--include/linux/mfd/samsung/s2mps11.h18
-rw-r--r--include/linux/mfd/syscon/clps711x.h94
-rw-r--r--include/linux/mfd/syscon/imx6q-iomuxc-gpr.h137
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h52
-rw-r--r--include/linux/mfd/tmio.h6
-rw-r--r--include/linux/mfd/tps65217.h19
-rw-r--r--include/linux/mfd/twl6040.h9
-rw-r--r--include/linux/mfd/ucb1x00.h1
-rw-r--r--include/linux/mfd/wm8994/core.h2
-rw-r--r--include/linux/mfd/wm8994/pdata.h10
-rw-r--r--include/linux/mfd/wm8994/registers.h8
-rw-r--r--include/linux/micrel_phy.h6
-rw-r--r--include/linux/migrate.h8
-rw-r--r--include/linux/mlx4/cmd.h4
-rw-r--r--include/linux/mlx4/device.h20
-rw-r--r--include/linux/mlx4/qp.h41
-rw-r--r--include/linux/mlx5/cmd.h51
-rw-r--r--include/linux/mlx5/cq.h165
-rw-r--r--include/linux/mlx5/device.h911
-rw-r--r--include/linux/mlx5/doorbell.h79
-rw-r--r--include/linux/mlx5/driver.h768
-rw-r--r--include/linux/mlx5/qp.h467
-rw-r--r--include/linux/mlx5/srq.h41
-rw-r--r--include/linux/mm.h91
-rw-r--r--include/linux/mm_inline.h1
-rw-r--r--include/linux/mm_types.h9
-rw-r--r--include/linux/mman.h8
-rw-r--r--include/linux/mmc/card.h11
-rw-r--r--include/linux/mmc/core.h7
-rw-r--r--include/linux/mmc/host.h12
-rw-r--r--include/linux/mmc/sdhci.h7
-rw-r--r--include/linux/mmc/sh_mmcif.h6
-rw-r--r--include/linux/mmc/sh_mobile_sdhi.h2
-rw-r--r--include/linux/mmc/slot-gpio.h3
-rw-r--r--include/linux/mmzone.h70
-rw-r--r--include/linux/mod_devicetable.h30
-rw-r--r--include/linux/module.h6
-rw-r--r--include/linux/moduleparam.h15
-rw-r--r--include/linux/mount.h1
-rw-r--r--include/linux/msi.h22
-rw-r--r--include/linux/mtd/bbm.h2
-rw-r--r--include/linux/mtd/fsmc.h1
-rw-r--r--include/linux/mtd/mtd.h3
-rw-r--r--include/linux/mtd/nand.h83
-rw-r--r--include/linux/mutex-debug.h1
-rw-r--r--include/linux/mutex.h11
-rw-r--r--include/linux/mv643xx_eth.h5
-rw-r--r--include/linux/namei.h3
-rw-r--r--include/linux/nbd.h1
-rw-r--r--include/linux/net.h6
-rw-r--r--include/linux/netdev_features.h4
-rw-r--r--include/linux/netdevice.h166
-rw-r--r--include/linux/netfilter.h17
-rw-r--r--include/linux/netfilter/ipset/ip_set.h6
-rw-r--r--include/linux/netfilter/xt_HMARK.h50
-rw-r--r--include/linux/netfilter/xt_rpfilter.h23
-rw-r--r--include/linux/netlink.h27
-rw-r--r--include/linux/netpoll.h4
-rw-r--r--include/linux/nfs4.h22
-rw-r--r--include/linux/nfs_fs.h29
-rw-r--r--include/linux/nfs_fs_sb.h21
-rw-r--r--include/linux/nfs_xdr.h48
-rw-r--r--include/linux/nmi.h2
-rw-r--r--include/linux/nodemask.h11
-rw-r--r--include/linux/nsproxy.h6
-rw-r--r--include/linux/nvme.h466
-rw-r--r--include/linux/of.h63
-rw-r--r--include/linux/of_address.h48
-rw-r--r--include/linux/of_device.h21
-rw-r--r--include/linux/of_dma.h1
-rw-r--r--include/linux/of_fdt.h6
-rw-r--r--include/linux/of_i2c.h46
-rw-r--r--include/linux/of_irq.h20
-rw-r--r--include/linux/of_net.h4
-rw-r--r--include/linux/of_pci.h14
-rw-r--r--include/linux/of_platform.h35
-rw-r--r--include/linux/of_reserved_mem.h14
-rw-r--r--include/linux/olpc-ec.h1
-rw-r--r--include/linux/omap-mailbox.h29
-rw-r--r--include/linux/oprofile.h16
-rw-r--r--include/linux/pageblock-flags.h6
-rw-r--r--include/linux/pagevec.h34
-rw-r--r--include/linux/pci-acpi.h10
-rw-r--r--include/linux/pci.h36
-rw-r--r--include/linux/pci_hotplug.h17
-rw-r--r--include/linux/pci_ids.h14
-rw-r--r--include/linux/percpu-defs.h5
-rw-r--r--include/linux/percpu-refcount.h174
-rw-r--r--include/linux/percpu_ida.h60
-rw-r--r--include/linux/perf_event.h48
-rw-r--r--include/linux/phy.h27
-rw-r--r--include/linux/pid.h6
-rw-r--r--include/linux/pinctrl/consumer.h77
-rw-r--r--include/linux/pinctrl/devinfo.h4
-rw-r--r--include/linux/pinctrl/pinconf-generic.h58
-rw-r--r--include/linux/pinctrl/pinconf.h8
-rw-r--r--include/linux/pinctrl/pinctrl.h4
-rw-r--r--include/linux/platform_data/ad7303.h21
-rw-r--r--include/linux/platform_data/asoc-s3c.h1
-rw-r--r--include/linux/platform_data/at91_adc.h4
-rw-r--r--include/linux/platform_data/atmel.h4
-rw-r--r--include/linux/platform_data/bd6107.h19
-rw-r--r--include/linux/platform_data/brcmfmac-sdio.h11
-rw-r--r--include/linux/platform_data/camera-mx3.h4
-rw-r--r--include/linux/platform_data/camera-rcar.h25
-rw-r--r--include/linux/platform_data/clk-ux500.h6
-rw-r--r--include/linux/platform_data/cpsw.h44
-rw-r--r--include/linux/platform_data/dma-atmel.h4
-rw-r--r--include/linux/platform_data/dma-imx.h6
-rw-r--r--include/linux/platform_data/dma-rcar-hpbdma.h103
-rw-r--r--include/linux/platform_data/dma-ste-dma40.h41
-rw-r--r--include/linux/platform_data/edma.h185
-rw-r--r--include/linux/platform_data/efm32-spi.h14
-rw-r--r--include/linux/platform_data/exynos_thermal.h119
-rw-r--r--include/linux/platform_data/g762.h (renamed from include/linux/clk/mvebu.h)23
-rw-r--r--include/linux/platform_data/gpio-em.h1
-rw-r--r--include/linux/platform_data/gpio-rcar.h5
-rw-r--r--include/linux/platform_data/gpio_backlight.h21
-rw-r--r--include/linux/platform_data/leds-lp55xx.h10
-rw-r--r--include/linux/platform_data/leds-pca963x.h (renamed from include/linux/platform_data/leds-pca9633.h)25
-rw-r--r--include/linux/platform_data/leds-renesas-tpu.h14
-rw-r--r--include/linux/platform_data/lv5207lp.h19
-rw-r--r--include/linux/platform_data/mailbox-omap.h58
-rw-r--r--include/linux/platform_data/max310x.h9
-rw-r--r--include/linux/platform_data/mmc-esdhc-imx.h1
-rw-r--r--include/linux/platform_data/mmc-pxamci.h2
-rw-r--r--include/linux/platform_data/mtd-nand-pxa3xx.h13
-rw-r--r--include/linux/platform_data/net-cw1200.h81
-rw-r--r--include/linux/platform_data/omap-abe-twl6040.h49
-rw-r--r--include/linux/platform_data/omap_ocp2scp.h31
-rw-r--r--include/linux/platform_data/pca953x.h (renamed from include/linux/i2c/pca953x.h)0
-rw-r--r--include/linux/platform_data/pinctrl-coh901.h22
-rw-r--r--include/linux/platform_data/pinctrl-nomadik.h24
-rw-r--r--include/linux/platform_data/pwm-renesas-tpu.h16
-rw-r--r--include/linux/platform_data/rcar-du.h74
-rw-r--r--include/linux/platform_data/remoteproc-omap.h2
-rw-r--r--include/linux/platform_data/serial-sccnxp.h3
-rw-r--r--include/linux/platform_data/si5351.h18
-rw-r--r--include/linux/platform_data/simplefb.h64
-rw-r--r--include/linux/platform_data/spi-davinci.h2
-rw-r--r--include/linux/platform_data/ssm2518.h22
-rw-r--r--include/linux/platform_data/st_sensors_pdata.h24
-rw-r--r--include/linux/platform_data/ti_am335x_adc.h14
-rw-r--r--include/linux/platform_data/usb-musb-ux500.h5
-rw-r--r--include/linux/platform_data/usb-rcar-phy.h28
-rw-r--r--include/linux/platform_data/usb3503.h5
-rw-r--r--include/linux/platform_data/vsp1.h25
-rw-r--r--include/linux/platform_data/zforce_ts.h (renamed from include/linux/platform_data/tegra_usb.h)28
-rw-r--r--include/linux/platform_device.h11
-rw-r--r--include/linux/pm_runtime.h2
-rw-r--r--include/linux/pm_wakeup.h4
-rw-r--r--include/linux/posix-timers.h16
-rw-r--r--include/linux/power/bq24190_charger.h16
-rw-r--r--include/linux/power/smartreflex.h10
-rw-r--r--include/linux/power/twl4030_madc_battery.h39
-rw-r--r--include/linux/power_supply.h7
-rw-r--r--include/linux/pps_kernel.h2
-rw-r--r--include/linux/preempt.h18
-rw-r--r--include/linux/preempt_mask.h122
-rw-r--r--include/linux/printk.h2
-rw-r--r--include/linux/pstore.h14
-rw-r--r--include/linux/ptrace.h10
-rw-r--r--include/linux/pvclock_gtod.h7
-rw-r--r--include/linux/pwm.h29
-rw-r--r--include/linux/pxa2xx_ssp.h11
-rw-r--r--include/linux/quota.h1
-rw-r--r--include/linux/quotaops.h15
-rw-r--r--include/linux/radix-tree.h1
-rw-r--r--include/linux/raid/pq.h6
-rw-r--r--include/linux/ramfs.h2
-rw-r--r--include/linux/rbtree.h22
-rw-r--r--include/linux/rculist.h5
-rw-r--r--include/linux/rcupdate.h31
-rw-r--r--include/linux/rcutiny.h41
-rw-r--r--include/linux/rcutree.h3
-rw-r--r--include/linux/reboot.h27
-rw-r--r--include/linux/regmap.h55
-rw-r--r--include/linux/regulator/ab8500.h4
-rw-r--r--include/linux/regulator/consumer.h33
-rw-r--r--include/linux/regulator/driver.h27
-rw-r--r--include/linux/regulator/fan53555.h1
-rw-r--r--include/linux/regulator/machine.h1
-rw-r--r--include/linux/regulator/max8660.h2
-rw-r--r--include/linux/regulator/pfuze100.h44
-rw-r--r--include/linux/res_counter.h2
-rw-r--r--include/linux/reservation.h62
-rw-r--r--include/linux/rio.h82
-rw-r--r--include/linux/rio_ids.h2
-rw-r--r--include/linux/scatterlist.h8
-rw-r--r--include/linux/sched.h58
-rw-r--r--include/linux/sched_clock.h21
-rw-r--r--include/linux/sdb.h159
-rw-r--r--include/linux/security.h68
-rw-r--r--include/linux/sem.h6
-rw-r--r--include/linux/seq_file.h6
-rw-r--r--include/linux/seqlock.h68
-rw-r--r--include/linux/serial_core.h7
-rw-r--r--include/linux/serial_sci.h12
-rw-r--r--include/linux/sh_dma.h57
-rw-r--r--include/linux/sh_eth.h10
-rw-r--r--include/linux/shdma-base.h10
-rw-r--r--include/linux/shrinker.h54
-rw-r--r--include/linux/signal.h8
-rw-r--r--include/linux/skbuff.h157
-rw-r--r--include/linux/slab.h205
-rw-r--r--include/linux/slab_def.h106
-rw-r--r--include/linux/slob_def.h39
-rw-r--r--include/linux/slub_def.h110
-rw-r--r--include/linux/smp.h84
-rw-r--r--include/linux/smsc911x.h3
-rw-r--r--include/linux/socket.h4
-rw-r--r--include/linux/spi/mmc_spi.h19
-rw-r--r--include/linux/spi/spi.h37
-rw-r--r--include/linux/spi/spi_bitbang.h5
-rw-r--r--include/linux/spi/xilinx_spi.h1
-rw-r--r--include/linux/spinlock.h14
-rw-r--r--include/linux/spinlock_api_smp.h2
-rw-r--r--include/linux/spinlock_up.h2
-rw-r--r--include/linux/splice.h1
-rw-r--r--include/linux/srcu.h43
-rw-r--r--include/linux/ssb/ssb_driver_mips.h15
-rw-r--r--include/linux/ssb/ssb_regs.h1
-rw-r--r--include/linux/stmmac.h5
-rw-r--r--include/linux/sunrpc/auth.h28
-rw-r--r--include/linux/sunrpc/cache.h63
-rw-r--r--include/linux/sunrpc/clnt.h6
-rw-r--r--include/linux/sunrpc/gss_api.h2
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h43
-rw-r--r--include/linux/sunrpc/sched.h23
-rw-r--r--include/linux/sunrpc/svc.h1
-rw-r--r--include/linux/sunrpc/svcauth.h11
-rw-r--r--include/linux/suspend.h1
-rw-r--r--include/linux/swap.h78
-rw-r--r--include/linux/swapops.h5
-rw-r--r--include/linux/syscalls.h6
-rw-r--r--include/linux/sysfs.h94
-rw-r--r--include/linux/syslog.h4
-rw-r--r--include/linux/tcp.h3
-rw-r--r--include/linux/tegra-cpuidle.h25
-rw-r--r--include/linux/thermal.h18
-rw-r--r--include/linux/tick.h49
-rw-r--r--include/linux/time-armada-370-xp.h18
-rw-r--r--include/linux/timex.h1
-rw-r--r--include/linux/tpm.h2
-rw-r--r--include/linux/tracepoint.h6
-rw-r--r--include/linux/tty.h69
-rw-r--r--include/linux/tty_flip.h8
-rw-r--r--include/linux/tty_ldisc.h68
-rw-r--r--include/linux/usb.h64
-rw-r--r--include/linux/usb/chipidea.h36
-rw-r--r--include/linux/usb/dwc3-omap.h30
-rw-r--r--include/linux/usb/ehci_pdriver.h4
-rw-r--r--include/linux/usb/gadget.h4
-rw-r--r--include/linux/usb/hcd.h20
-rw-r--r--include/linux/usb/of.h40
-rw-r--r--include/linux/usb/otg.h7
-rw-r--r--include/linux/usb/phy.h27
-rw-r--r--include/linux/usb/serial.h15
-rw-r--r--include/linux/usb/tegra_usb_phy.h45
-rw-r--r--include/linux/usb/usb_phy_gen_xceiv.h (renamed from include/linux/usb/nop-usb-xceiv.h)4
-rw-r--r--include/linux/usb/usbnet.h5
-rw-r--r--include/linux/usb/wusb-wa.h18
-rw-r--r--include/linux/user_namespace.h5
-rw-r--r--include/linux/uwb/spec.h5
-rw-r--r--include/linux/vexpress.h1
-rw-r--r--include/linux/vfio.h7
-rw-r--r--include/linux/vga_switcheroo.h13
-rw-r--r--include/linux/vgaarb.h7
-rw-r--r--include/linux/virtio.h11
-rw-r--r--include/linux/virtio_ring.h1
-rw-r--r--include/linux/vm_event_item.h6
-rw-r--r--include/linux/vmalloc.h16
-rw-r--r--include/linux/vmpressure.h9
-rw-r--r--include/linux/vmstat.h4
-rw-r--r--include/linux/vt_kern.h2
-rw-r--r--include/linux/vtime.h78
-rw-r--r--include/linux/wait.h81
-rw-r--r--include/linux/workqueue.h49
-rw-r--r--include/linux/writeback.h11
-rw-r--r--include/linux/ww_mutex.h378
-rw-r--r--include/linux/xattr.h2
-rw-r--r--include/linux/zbud.h22
472 files changed, 13428 insertions, 4668 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 17b5b5967641..a5db4aeefa36 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -352,8 +352,7 @@ extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
352 352
353/* Enable _OST when all relevant hotplug operations are enabled */ 353/* Enable _OST when all relevant hotplug operations are enabled */
354#if defined(CONFIG_ACPI_HOTPLUG_CPU) && \ 354#if defined(CONFIG_ACPI_HOTPLUG_CPU) && \
355 (defined(CONFIG_ACPI_HOTPLUG_MEMORY) || \ 355 defined(CONFIG_ACPI_HOTPLUG_MEMORY) && \
356 defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)) && \
357 defined(CONFIG_ACPI_CONTAINER) 356 defined(CONFIG_ACPI_CONTAINER)
358#define ACPI_HOTPLUG_OST 357#define ACPI_HOTPLUG_OST
359#endif 358#endif
@@ -482,6 +481,13 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
482 481
483acpi_status acpi_os_prepare_sleep(u8 sleep_state, 482acpi_status acpi_os_prepare_sleep(u8 sleep_state,
484 u32 pm1a_control, u32 pm1b_control); 483 u32 pm1a_control, u32 pm1b_control);
484
485void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
486 u32 val_a, u32 val_b));
487
488acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
489 u32 val_a, u32 val_b);
490
485#ifdef CONFIG_X86 491#ifdef CONFIG_X86
486void arch_reserve_mem_area(acpi_physical_address addr, size_t size); 492void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
487#else 493#else
diff --git a/include/linux/aer.h b/include/linux/aer.h
index 737f90ab4b62..4dbaa7081530 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -7,6 +7,10 @@
7#ifndef _AER_H_ 7#ifndef _AER_H_
8#define _AER_H_ 8#define _AER_H_
9 9
10#define AER_NONFATAL 0
11#define AER_FATAL 1
12#define AER_CORRECTABLE 2
13
10struct aer_header_log_regs { 14struct aer_header_log_regs {
11 unsigned int dw0; 15 unsigned int dw0;
12 unsigned int dw1; 16 unsigned int dw1;
@@ -31,9 +35,9 @@ struct aer_capability_regs {
31 35
32#if defined(CONFIG_PCIEAER) 36#if defined(CONFIG_PCIEAER)
33/* pci-e port driver needs this function to enable aer */ 37/* pci-e port driver needs this function to enable aer */
34extern int pci_enable_pcie_error_reporting(struct pci_dev *dev); 38int pci_enable_pcie_error_reporting(struct pci_dev *dev);
35extern int pci_disable_pcie_error_reporting(struct pci_dev *dev); 39int pci_disable_pcie_error_reporting(struct pci_dev *dev);
36extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); 40int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
37#else 41#else
38static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev) 42static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev)
39{ 43{
@@ -49,11 +53,11 @@ static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
49} 53}
50#endif 54#endif
51 55
52extern void cper_print_aer(struct pci_dev *dev, 56void cper_print_aer(struct pci_dev *dev, int cper_severity,
53 int cper_severity, struct aer_capability_regs *aer); 57 struct aer_capability_regs *aer);
54extern int cper_severity_to_aer(int cper_severity); 58int cper_severity_to_aer(int cper_severity);
55extern void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, 59void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
56 int severity, 60 int severity,
57 struct aer_capability_regs *aer_regs); 61 struct aer_capability_regs *aer_regs);
58#endif //_AER_H_ 62#endif //_AER_H_
59 63
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 1bdf965339f9..d9c92daa3944 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -27,15 +27,13 @@ struct kiocb;
27 */ 27 */
28#define KIOCB_CANCELLED ((void *) (~0ULL)) 28#define KIOCB_CANCELLED ((void *) (~0ULL))
29 29
30typedef int (kiocb_cancel_fn)(struct kiocb *, struct io_event *); 30typedef int (kiocb_cancel_fn)(struct kiocb *);
31 31
32struct kiocb { 32struct kiocb {
33 atomic_t ki_users;
34
35 struct file *ki_filp; 33 struct file *ki_filp;
36 struct kioctx *ki_ctx; /* NULL for sync ops */ 34 struct kioctx *ki_ctx; /* NULL for sync ops */
37 kiocb_cancel_fn *ki_cancel; 35 kiocb_cancel_fn *ki_cancel;
38 void (*ki_dtor)(struct kiocb *); 36 void *private;
39 37
40 union { 38 union {
41 void __user *user; 39 void __user *user;
@@ -44,17 +42,7 @@ struct kiocb {
44 42
45 __u64 ki_user_data; /* user's data for completion */ 43 __u64 ki_user_data; /* user's data for completion */
46 loff_t ki_pos; 44 loff_t ki_pos;
47 45 size_t ki_nbytes; /* copy of iocb->aio_nbytes */
48 void *private;
49 /* State that we remember to be able to restart/retry */
50 unsigned short ki_opcode;
51 size_t ki_nbytes; /* copy of iocb->aio_nbytes */
52 char __user *ki_buf; /* remaining iocb->aio_buf */
53 size_t ki_left; /* remaining bytes */
54 struct iovec ki_inline_vec; /* inline vector */
55 struct iovec *ki_iovec;
56 unsigned long ki_nr_segs;
57 unsigned long ki_cur_seg;
58 46
59 struct list_head ki_list; /* the aio core uses this 47 struct list_head ki_list; /* the aio core uses this
60 * for cancellation */ 48 * for cancellation */
@@ -74,7 +62,6 @@ static inline bool is_sync_kiocb(struct kiocb *kiocb)
74static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp) 62static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
75{ 63{
76 *kiocb = (struct kiocb) { 64 *kiocb = (struct kiocb) {
77 .ki_users = ATOMIC_INIT(1),
78 .ki_ctx = NULL, 65 .ki_ctx = NULL,
79 .ki_filp = filp, 66 .ki_filp = filp,
80 .ki_obj.tsk = current, 67 .ki_obj.tsk = current,
@@ -84,7 +71,6 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
84/* prototypes */ 71/* prototypes */
85#ifdef CONFIG_AIO 72#ifdef CONFIG_AIO
86extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb); 73extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);
87extern void aio_put_req(struct kiocb *iocb);
88extern void aio_complete(struct kiocb *iocb, long res, long res2); 74extern void aio_complete(struct kiocb *iocb, long res, long res2);
89struct mm_struct; 75struct mm_struct;
90extern void exit_aio(struct mm_struct *mm); 76extern void exit_aio(struct mm_struct *mm);
@@ -93,7 +79,6 @@ extern long do_io_submit(aio_context_t ctx_id, long nr,
93void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel); 79void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel);
94#else 80#else
95static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; } 81static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }
96static inline void aio_put_req(struct kiocb *iocb) { }
97static inline void aio_complete(struct kiocb *iocb, long res, long res2) { } 82static inline void aio_complete(struct kiocb *iocb, long res, long res2) { }
98struct mm_struct; 83struct mm_struct;
99static inline void exit_aio(struct mm_struct *mm) { } 84static inline void exit_aio(struct mm_struct *mm) { }
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h
index 9069694e70eb..a899402a5a0e 100644
--- a/include/linux/alarmtimer.h
+++ b/include/linux/alarmtimer.h
@@ -44,10 +44,14 @@ struct alarm {
44void alarm_init(struct alarm *alarm, enum alarmtimer_type type, 44void alarm_init(struct alarm *alarm, enum alarmtimer_type type,
45 enum alarmtimer_restart (*function)(struct alarm *, ktime_t)); 45 enum alarmtimer_restart (*function)(struct alarm *, ktime_t));
46int alarm_start(struct alarm *alarm, ktime_t start); 46int alarm_start(struct alarm *alarm, ktime_t start);
47int alarm_start_relative(struct alarm *alarm, ktime_t start);
48void alarm_restart(struct alarm *alarm);
47int alarm_try_to_cancel(struct alarm *alarm); 49int alarm_try_to_cancel(struct alarm *alarm);
48int alarm_cancel(struct alarm *alarm); 50int alarm_cancel(struct alarm *alarm);
49 51
50u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval); 52u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval);
53u64 alarm_forward_now(struct alarm *alarm, ktime_t interval);
54ktime_t alarm_expires_remaining(const struct alarm *alarm);
51 55
52/* Provide way to access the rtc device being used by alarmtimers */ 56/* Provide way to access the rtc device being used by alarmtimers */
53struct rtc_device *alarmtimer_get_rtcdev(void); 57struct rtc_device *alarmtimer_get_rtcdev(void);
diff --git a/include/linux/amba/pl080.h b/include/linux/amba/pl080.h
index 3e7b62fbefbd..91b84a7f0539 100644
--- a/include/linux/amba/pl080.h
+++ b/include/linux/amba/pl080.h
@@ -87,6 +87,7 @@
87#define PL080_CONTROL_SB_SIZE_MASK (0x7 << 12) 87#define PL080_CONTROL_SB_SIZE_MASK (0x7 << 12)
88#define PL080_CONTROL_SB_SIZE_SHIFT (12) 88#define PL080_CONTROL_SB_SIZE_SHIFT (12)
89#define PL080_CONTROL_TRANSFER_SIZE_MASK (0xfff << 0) 89#define PL080_CONTROL_TRANSFER_SIZE_MASK (0xfff << 0)
90#define PL080S_CONTROL_TRANSFER_SIZE_MASK (0x1ffffff << 0)
90#define PL080_CONTROL_TRANSFER_SIZE_SHIFT (0) 91#define PL080_CONTROL_TRANSFER_SIZE_SHIFT (0)
91 92
92#define PL080_BSIZE_1 (0x0) 93#define PL080_BSIZE_1 (0x0)
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
index 2a5f64a11b77..10fe2a211c2e 100644
--- a/include/linux/amba/pl08x.h
+++ b/include/linux/amba/pl08x.h
@@ -76,11 +76,11 @@ struct pl08x_channel_data {
76 * platform, all inclusive, including multiplexed channels. The available 76 * platform, all inclusive, including multiplexed channels. The available
77 * physical channels will be multiplexed around these signals as they are 77 * physical channels will be multiplexed around these signals as they are
78 * requested, just enumerate all possible channels. 78 * requested, just enumerate all possible channels.
79 * @get_signal: request a physical signal to be used for a DMA transfer 79 * @get_xfer_signal: request a physical signal to be used for a DMA transfer
80 * immediately: if there is some multiplexing or similar blocking the use 80 * immediately: if there is some multiplexing or similar blocking the use
81 * of the channel the transfer can be denied by returning less than zero, 81 * of the channel the transfer can be denied by returning less than zero,
82 * else it returns the allocated signal number 82 * else it returns the allocated signal number
83 * @put_signal: indicate to the platform that this physical signal is not 83 * @put_xfer_signal: indicate to the platform that this physical signal is not
84 * running any DMA transfer and multiplexing can be recycled 84 * running any DMA transfer and multiplexing can be recycled
85 * @lli_buses: buses which LLIs can be fetched from: PL08X_AHB1 | PL08X_AHB2 85 * @lli_buses: buses which LLIs can be fetched from: PL08X_AHB1 | PL08X_AHB2
86 * @mem_buses: buses which memory can be accessed from: PL08X_AHB1 | PL08X_AHB2 86 * @mem_buses: buses which memory can be accessed from: PL08X_AHB1 | PL08X_AHB2
@@ -89,8 +89,8 @@ struct pl08x_platform_data {
89 const struct pl08x_channel_data *slave_channels; 89 const struct pl08x_channel_data *slave_channels;
90 unsigned int num_slave_channels; 90 unsigned int num_slave_channels;
91 struct pl08x_channel_data memcpy_channel; 91 struct pl08x_channel_data memcpy_channel;
92 int (*get_signal)(const struct pl08x_channel_data *); 92 int (*get_xfer_signal)(const struct pl08x_channel_data *);
93 void (*put_signal)(const struct pl08x_channel_data *, int); 93 void (*put_xfer_signal)(const struct pl08x_channel_data *, int);
94 u8 lli_buses; 94 u8 lli_buses;
95 u8 mem_buses; 95 u8 mem_buses;
96}; 96};
diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h
index 8013a45242fe..cf573c22b81e 100644
--- a/include/linux/anon_inodes.h
+++ b/include/linux/anon_inodes.h
@@ -13,6 +13,9 @@ struct file_operations;
13struct file *anon_inode_getfile(const char *name, 13struct file *anon_inode_getfile(const char *name,
14 const struct file_operations *fops, 14 const struct file_operations *fops,
15 void *priv, int flags); 15 void *priv, int flags);
16struct file *anon_inode_getfile_private(const char *name,
17 const struct file_operations *fops,
18 void *priv, int flags);
16int anon_inode_getfd(const char *name, const struct file_operations *fops, 19int anon_inode_getfd(const char *name, const struct file_operations *fops,
17 void *priv, int flags); 20 void *priv, int flags);
18 21
diff --git a/include/linux/arm-cci.h b/include/linux/arm-cci.h
new file mode 100644
index 000000000000..79d6edf446d5
--- /dev/null
+++ b/include/linux/arm-cci.h
@@ -0,0 +1,61 @@
1/*
2 * CCI cache coherent interconnect support
3 *
4 * Copyright (C) 2013 ARM Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __LINUX_ARM_CCI_H
22#define __LINUX_ARM_CCI_H
23
24#include <linux/errno.h>
25#include <linux/types.h>
26
27struct device_node;
28
29#ifdef CONFIG_ARM_CCI
30extern bool cci_probed(void);
31extern int cci_ace_get_port(struct device_node *dn);
32extern int cci_disable_port_by_cpu(u64 mpidr);
33extern int __cci_control_port_by_device(struct device_node *dn, bool enable);
34extern int __cci_control_port_by_index(u32 port, bool enable);
35#else
36static inline bool cci_probed(void) { return false; }
37static inline int cci_ace_get_port(struct device_node *dn)
38{
39 return -ENODEV;
40}
41static inline int cci_disable_port_by_cpu(u64 mpidr) { return -ENODEV; }
42static inline int __cci_control_port_by_device(struct device_node *dn,
43 bool enable)
44{
45 return -ENODEV;
46}
47static inline int __cci_control_port_by_index(u32 port, bool enable)
48{
49 return -ENODEV;
50}
51#endif
52#define cci_disable_port_by_device(dev) \
53 __cci_control_port_by_device(dev, false)
54#define cci_enable_port_by_device(dev) \
55 __cci_control_port_by_device(dev, true)
56#define cci_disable_port_by_index(dev) \
57 __cci_control_port_by_index(dev, false)
58#define cci_enable_port_by_index(dev) \
59 __cci_control_port_by_index(dev, true)
60
61#endif
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index a1c486a88e88..179b38ffd351 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -182,10 +182,6 @@ async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset,
182 unsigned int src_offset, size_t len, 182 unsigned int src_offset, size_t len,
183 struct async_submit_ctl *submit); 183 struct async_submit_ctl *submit);
184 184
185struct dma_async_tx_descriptor *
186async_memset(struct page *dest, int val, unsigned int offset,
187 size_t len, struct async_submit_ctl *submit);
188
189struct dma_async_tx_descriptor *async_trigger_callback(struct async_submit_ctl *submit); 185struct dma_async_tx_descriptor *async_trigger_callback(struct async_submit_ctl *submit);
190 186
191struct dma_async_tx_descriptor * 187struct dma_async_tx_descriptor *
diff --git a/include/linux/ata.h b/include/linux/ata.h
index ee0bd9524055..bf4c69ca76df 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -239,6 +239,8 @@ enum {
239 ATA_CMD_WRITE_QUEUED_FUA_EXT = 0x3E, 239 ATA_CMD_WRITE_QUEUED_FUA_EXT = 0x3E,
240 ATA_CMD_FPDMA_READ = 0x60, 240 ATA_CMD_FPDMA_READ = 0x60,
241 ATA_CMD_FPDMA_WRITE = 0x61, 241 ATA_CMD_FPDMA_WRITE = 0x61,
242 ATA_CMD_FPDMA_SEND = 0x64,
243 ATA_CMD_FPDMA_RECV = 0x65,
242 ATA_CMD_PIO_READ = 0x20, 244 ATA_CMD_PIO_READ = 0x20,
243 ATA_CMD_PIO_READ_EXT = 0x24, 245 ATA_CMD_PIO_READ_EXT = 0x24,
244 ATA_CMD_PIO_WRITE = 0x30, 246 ATA_CMD_PIO_WRITE = 0x30,
@@ -293,8 +295,13 @@ enum {
293 /* marked obsolete in the ATA/ATAPI-7 spec */ 295 /* marked obsolete in the ATA/ATAPI-7 spec */
294 ATA_CMD_RESTORE = 0x10, 296 ATA_CMD_RESTORE = 0x10,
295 297
298 /* Subcmds for ATA_CMD_FPDMA_SEND */
299 ATA_SUBCMD_FPDMA_SEND_DSM = 0x00,
300 ATA_SUBCMD_FPDMA_SEND_WR_LOG_DMA_EXT = 0x02,
301
296 /* READ_LOG_EXT pages */ 302 /* READ_LOG_EXT pages */
297 ATA_LOG_SATA_NCQ = 0x10, 303 ATA_LOG_SATA_NCQ = 0x10,
304 ATA_LOG_NCQ_SEND_RECV = 0x13,
298 ATA_LOG_SATA_ID_DEV_DATA = 0x30, 305 ATA_LOG_SATA_ID_DEV_DATA = 0x30,
299 ATA_LOG_SATA_SETTINGS = 0x08, 306 ATA_LOG_SATA_SETTINGS = 0x08,
300 ATA_LOG_DEVSLP_OFFSET = 0x30, 307 ATA_LOG_DEVSLP_OFFSET = 0x30,
@@ -305,6 +312,15 @@ enum {
305 ATA_LOG_DEVSLP_VALID = 0x07, 312 ATA_LOG_DEVSLP_VALID = 0x07,
306 ATA_LOG_DEVSLP_VALID_MASK = 0x80, 313 ATA_LOG_DEVSLP_VALID_MASK = 0x80,
307 314
315 /* NCQ send and receive log */
316 ATA_LOG_NCQ_SEND_RECV_SUBCMDS_OFFSET = 0x00,
317 ATA_LOG_NCQ_SEND_RECV_SUBCMDS_DSM = (1 << 0),
318 ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET = 0x04,
319 ATA_LOG_NCQ_SEND_RECV_DSM_TRIM = (1 << 0),
320 ATA_LOG_NCQ_SEND_RECV_RD_LOG_OFFSET = 0x08,
321 ATA_LOG_NCQ_SEND_RECV_WR_LOG_OFFSET = 0x0C,
322 ATA_LOG_NCQ_SEND_RECV_SIZE = 0x10,
323
308 /* READ/WRITE LONG (obsolete) */ 324 /* READ/WRITE LONG (obsolete) */
309 ATA_CMD_READ_LONG = 0x22, 325 ATA_CMD_READ_LONG = 0x22,
310 ATA_CMD_READ_LONG_ONCE = 0x23, 326 ATA_CMD_READ_LONG_ONCE = 0x23,
@@ -446,22 +462,6 @@ enum {
446 SERR_TRANS_ST_ERROR = (1 << 24), /* Transport state trans. error */ 462 SERR_TRANS_ST_ERROR = (1 << 24), /* Transport state trans. error */
447 SERR_UNRECOG_FIS = (1 << 25), /* Unrecognized FIS */ 463 SERR_UNRECOG_FIS = (1 << 25), /* Unrecognized FIS */
448 SERR_DEV_XCHG = (1 << 26), /* device exchanged */ 464 SERR_DEV_XCHG = (1 << 26), /* device exchanged */
449
450 /* struct ata_taskfile flags */
451 ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */
452 ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */
453 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */
454 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
455 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
456 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
457 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */
458
459 /* protocol flags */
460 ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */
461 ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */
462 ATA_PROT_FLAG_DATA = ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA,
463 ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */
464 ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */
465}; 465};
466 466
467enum ata_tf_protocols { 467enum ata_tf_protocols {
@@ -488,83 +488,6 @@ struct ata_bmdma_prd {
488 __le32 flags_len; 488 __le32 flags_len;
489}; 489};
490 490
491struct ata_taskfile {
492 unsigned long flags; /* ATA_TFLAG_xxx */
493 u8 protocol; /* ATA_PROT_xxx */
494
495 u8 ctl; /* control reg */
496
497 u8 hob_feature; /* additional data */
498 u8 hob_nsect; /* to support LBA48 */
499 u8 hob_lbal;
500 u8 hob_lbam;
501 u8 hob_lbah;
502
503 u8 feature;
504 u8 nsect;
505 u8 lbal;
506 u8 lbam;
507 u8 lbah;
508
509 u8 device;
510
511 u8 command; /* IO operation */
512};
513
514/*
515 * protocol tests
516 */
517static inline unsigned int ata_prot_flags(u8 prot)
518{
519 switch (prot) {
520 case ATA_PROT_NODATA:
521 return 0;
522 case ATA_PROT_PIO:
523 return ATA_PROT_FLAG_PIO;
524 case ATA_PROT_DMA:
525 return ATA_PROT_FLAG_DMA;
526 case ATA_PROT_NCQ:
527 return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ;
528 case ATAPI_PROT_NODATA:
529 return ATA_PROT_FLAG_ATAPI;
530 case ATAPI_PROT_PIO:
531 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO;
532 case ATAPI_PROT_DMA:
533 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA;
534 }
535 return 0;
536}
537
538static inline int ata_is_atapi(u8 prot)
539{
540 return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI;
541}
542
543static inline int ata_is_nodata(u8 prot)
544{
545 return !(ata_prot_flags(prot) & ATA_PROT_FLAG_DATA);
546}
547
548static inline int ata_is_pio(u8 prot)
549{
550 return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO;
551}
552
553static inline int ata_is_dma(u8 prot)
554{
555 return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA;
556}
557
558static inline int ata_is_ncq(u8 prot)
559{
560 return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ;
561}
562
563static inline int ata_is_data(u8 prot)
564{
565 return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA;
566}
567
568/* 491/*
569 * id tests 492 * id tests
570 */ 493 */
@@ -865,6 +788,11 @@ static inline int ata_id_rotation_rate(const u16 *id)
865 return val; 788 return val;
866} 789}
867 790
791static inline bool ata_id_has_ncq_send_and_recv(const u16 *id)
792{
793 return id[ATA_ID_SATA_CAPABILITY_2] & BIT(6);
794}
795
868static inline bool ata_id_has_trim(const u16 *id) 796static inline bool ata_id_has_trim(const u16 *id)
869{ 797{
870 if (ata_id_major_version(id) >= 7 && 798 if (ata_id_major_version(id) >= 7 &&
@@ -1060,15 +988,6 @@ static inline unsigned ata_set_lba_range_entries(void *_buffer,
1060 return used_bytes; 988 return used_bytes;
1061} 989}
1062 990
1063static inline int is_multi_taskfile(struct ata_taskfile *tf)
1064{
1065 return (tf->command == ATA_CMD_READ_MULTI) ||
1066 (tf->command == ATA_CMD_WRITE_MULTI) ||
1067 (tf->command == ATA_CMD_READ_MULTI_EXT) ||
1068 (tf->command == ATA_CMD_WRITE_MULTI_EXT) ||
1069 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT);
1070}
1071
1072static inline bool ata_ok(u8 status) 991static inline bool ata_ok(u8 status)
1073{ 992{
1074 return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) 993 return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR))
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
index deb0ae58b99b..66a0e5384edd 100644
--- a/include/linux/atmel-ssc.h
+++ b/include/linux/atmel-ssc.h
@@ -11,7 +11,7 @@ struct atmel_ssc_platform_data {
11 11
12struct ssc_device { 12struct ssc_device {
13 struct list_head list; 13 struct list_head list;
14 resource_size_t phybase; 14 dma_addr_t phybase;
15 void __iomem *regs; 15 void __iomem *regs;
16 struct platform_device *pdev; 16 struct platform_device *pdev;
17 struct atmel_ssc_platform_data *pdata; 17 struct atmel_ssc_platform_data *pdata;
diff --git a/include/linux/atmel_serial.h b/include/linux/atmel_serial.h
index fd6833764d72..be201ca2990c 100644
--- a/include/linux/atmel_serial.h
+++ b/include/linux/atmel_serial.h
@@ -124,4 +124,6 @@
124#define ATMEL_US_NER 0x44 /* Number of Errors Register */ 124#define ATMEL_US_NER 0x44 /* Number of Errors Register */
125#define ATMEL_US_IF 0x4c /* IrDA Filter Register */ 125#define ATMEL_US_IF 0x4c /* IrDA Filter Register */
126 126
127#define ATMEL_US_NAME 0xf0 /* Ip Name */
128
127#endif 129#endif
diff --git a/include/linux/audit.h b/include/linux/audit.h
index b20b03852f21..729a4d165bcc 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -103,8 +103,11 @@ extern void __audit_syscall_exit(int ret_success, long ret_value);
103extern struct filename *__audit_reusename(const __user char *uptr); 103extern struct filename *__audit_reusename(const __user char *uptr);
104extern void __audit_getname(struct filename *name); 104extern void __audit_getname(struct filename *name);
105extern void audit_putname(struct filename *name); 105extern void audit_putname(struct filename *name);
106
107#define AUDIT_INODE_PARENT 1 /* dentry represents the parent */
108#define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */
106extern void __audit_inode(struct filename *name, const struct dentry *dentry, 109extern void __audit_inode(struct filename *name, const struct dentry *dentry,
107 unsigned int parent); 110 unsigned int flags);
108extern void __audit_inode_child(const struct inode *parent, 111extern void __audit_inode_child(const struct inode *parent,
109 const struct dentry *dentry, 112 const struct dentry *dentry,
110 const unsigned char type); 113 const unsigned char type);
@@ -148,10 +151,22 @@ static inline void audit_getname(struct filename *name)
148 if (unlikely(!audit_dummy_context())) 151 if (unlikely(!audit_dummy_context()))
149 __audit_getname(name); 152 __audit_getname(name);
150} 153}
151static inline void audit_inode(struct filename *name, const struct dentry *dentry, 154static inline void audit_inode(struct filename *name,
155 const struct dentry *dentry,
152 unsigned int parent) { 156 unsigned int parent) {
157 if (unlikely(!audit_dummy_context())) {
158 unsigned int flags = 0;
159 if (parent)
160 flags |= AUDIT_INODE_PARENT;
161 __audit_inode(name, dentry, flags);
162 }
163}
164static inline void audit_inode_parent_hidden(struct filename *name,
165 const struct dentry *dentry)
166{
153 if (unlikely(!audit_dummy_context())) 167 if (unlikely(!audit_dummy_context()))
154 __audit_inode(name, dentry, parent); 168 __audit_inode(name, dentry,
169 AUDIT_INODE_PARENT | AUDIT_INODE_HIDDEN);
155} 170}
156static inline void audit_inode_child(const struct inode *parent, 171static inline void audit_inode_child(const struct inode *parent,
157 const struct dentry *dentry, 172 const struct dentry *dentry,
@@ -311,7 +326,7 @@ static inline void audit_putname(struct filename *name)
311{ } 326{ }
312static inline void __audit_inode(struct filename *name, 327static inline void __audit_inode(struct filename *name,
313 const struct dentry *dentry, 328 const struct dentry *dentry,
314 unsigned int parent) 329 unsigned int flags)
315{ } 330{ }
316static inline void __audit_inode_child(const struct inode *parent, 331static inline void __audit_inode_child(const struct inode *parent,
317 const struct dentry *dentry, 332 const struct dentry *dentry,
@@ -321,6 +336,9 @@ static inline void audit_inode(struct filename *name,
321 const struct dentry *dentry, 336 const struct dentry *dentry,
322 unsigned int parent) 337 unsigned int parent)
323{ } 338{ }
339static inline void audit_inode_parent_hidden(struct filename *name,
340 const struct dentry *dentry)
341{ }
324static inline void audit_inode_child(const struct inode *parent, 342static inline void audit_inode_child(const struct inode *parent,
325 const struct dentry *dentry, 343 const struct dentry *dentry,
326 const unsigned char type) 344 const unsigned char type)
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index c3881553f7d1..5f66d519a726 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -243,6 +243,8 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
243 * BDI_CAP_EXEC_MAP: Can be mapped for execution 243 * BDI_CAP_EXEC_MAP: Can be mapped for execution
244 * 244 *
245 * BDI_CAP_SWAP_BACKED: Count shmem/tmpfs objects as swap-backed. 245 * BDI_CAP_SWAP_BACKED: Count shmem/tmpfs objects as swap-backed.
246 *
247 * BDI_CAP_STRICTLIMIT: Keep number of dirty pages below bdi threshold.
246 */ 248 */
247#define BDI_CAP_NO_ACCT_DIRTY 0x00000001 249#define BDI_CAP_NO_ACCT_DIRTY 0x00000001
248#define BDI_CAP_NO_WRITEBACK 0x00000002 250#define BDI_CAP_NO_WRITEBACK 0x00000002
@@ -254,6 +256,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
254#define BDI_CAP_NO_ACCT_WB 0x00000080 256#define BDI_CAP_NO_ACCT_WB 0x00000080
255#define BDI_CAP_SWAP_BACKED 0x00000100 257#define BDI_CAP_SWAP_BACKED 0x00000100
256#define BDI_CAP_STABLE_WRITES 0x00000200 258#define BDI_CAP_STABLE_WRITES 0x00000200
259#define BDI_CAP_STRICTLIMIT 0x00000400
257 260
258#define BDI_CAP_VMFLAGS \ 261#define BDI_CAP_VMFLAGS \
259 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) 262 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP)
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index da9a0825e007..53b77949c79d 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -114,7 +114,13 @@ static inline void backlight_update_status(struct backlight_device *bd)
114extern struct backlight_device *backlight_device_register(const char *name, 114extern struct backlight_device *backlight_device_register(const char *name,
115 struct device *dev, void *devdata, const struct backlight_ops *ops, 115 struct device *dev, void *devdata, const struct backlight_ops *ops,
116 const struct backlight_properties *props); 116 const struct backlight_properties *props);
117extern struct backlight_device *devm_backlight_device_register(
118 struct device *dev, const char *name, struct device *parent,
119 void *devdata, const struct backlight_ops *ops,
120 const struct backlight_properties *props);
117extern void backlight_device_unregister(struct backlight_device *bd); 121extern void backlight_device_unregister(struct backlight_device *bd);
122extern void devm_backlight_device_unregister(struct device *dev,
123 struct backlight_device *bd);
118extern void backlight_force_update(struct backlight_device *bd, 124extern void backlight_force_update(struct backlight_device *bd,
119 enum backlight_update_reason reason); 125 enum backlight_update_reason reason);
120 126
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index f7f1d7169b11..089743ade734 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -159,6 +159,26 @@ static inline bool balloon_page_movable(struct page *page)
159} 159}
160 160
161/* 161/*
162 * isolated_balloon_page - identify an isolated balloon page on private
163 * 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 */
171static inline bool isolated_balloon_page(struct page *page)
172{
173 /* Already isolated balloon pages, by default, have a raised refcount */
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}
180
181/*
162 * balloon_page_insert - insert a page into the balloon's page list and make 182 * balloon_page_insert - insert a page into the balloon's page list and make
163 * the page->mapping assignment accordingly. 183 * the page->mapping assignment accordingly.
164 * @page : page to be assigned as a 'balloon page' 184 * @page : page to be assigned as a 'balloon page'
@@ -243,6 +263,11 @@ static inline bool balloon_page_movable(struct page *page)
243 return false; 263 return false;
244} 264}
245 265
266static inline bool isolated_balloon_page(struct page *page)
267{
268 return false;
269}
270
246static inline bool balloon_page_isolate(struct page *page) 271static inline bool balloon_page_isolate(struct page *page)
247{ 272{
248 return false; 273 return false;
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 2e34db82a643..4d043c30216f 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -72,7 +72,19 @@ struct bcma_host_ops {
72/* Core-ID values. */ 72/* Core-ID values. */
73#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */ 73#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */
74#define BCMA_CORE_4706_CHIPCOMMON 0x500 74#define BCMA_CORE_4706_CHIPCOMMON 0x500
75#define BCMA_CORE_PCIEG2 0x501
76#define BCMA_CORE_DMA 0x502
77#define BCMA_CORE_SDIO3 0x503
78#define BCMA_CORE_USB20 0x504
79#define BCMA_CORE_USB30 0x505
80#define BCMA_CORE_A9JTAG 0x506
81#define BCMA_CORE_DDR23 0x507
82#define BCMA_CORE_ROM 0x508
83#define BCMA_CORE_NAND 0x509
84#define BCMA_CORE_QSPI 0x50A
85#define BCMA_CORE_CHIPCOMMON_B 0x50B
75#define BCMA_CORE_4706_SOC_RAM 0x50E 86#define BCMA_CORE_4706_SOC_RAM 0x50E
87#define BCMA_CORE_ARMCA9 0x510
76#define BCMA_CORE_4706_MAC_GBIT 0x52D 88#define BCMA_CORE_4706_MAC_GBIT 0x52D
77#define BCMA_CORE_AMEMC 0x52E /* DDR1/2 memory controller core */ 89#define BCMA_CORE_AMEMC 0x52E /* DDR1/2 memory controller core */
78#define BCMA_CORE_ALTA 0x534 /* I2S core */ 90#define BCMA_CORE_ALTA 0x534 /* I2S core */
@@ -144,6 +156,7 @@ struct bcma_host_ops {
144 156
145/* Chip IDs of PCIe devices */ 157/* Chip IDs of PCIe devices */
146#define BCMA_CHIP_ID_BCM4313 0x4313 158#define BCMA_CHIP_ID_BCM4313 0x4313
159#define BCMA_CHIP_ID_BCM43142 43142
147#define BCMA_CHIP_ID_BCM43224 43224 160#define BCMA_CHIP_ID_BCM43224 43224
148#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8 161#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8
149#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa 162#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa
@@ -176,6 +189,11 @@ struct bcma_host_ops {
176#define BCMA_PKG_ID_BCM5357 11 189#define BCMA_PKG_ID_BCM5357 11
177#define BCMA_CHIP_ID_BCM53572 53572 190#define BCMA_CHIP_ID_BCM53572 53572
178#define BCMA_PKG_ID_BCM47188 9 191#define BCMA_PKG_ID_BCM47188 9
192#define BCMA_CHIP_ID_BCM4707 53010
193#define BCMA_PKG_ID_BCM4707 1
194#define BCMA_PKG_ID_BCM4708 2
195#define BCMA_PKG_ID_BCM4709 0
196#define BCMA_CHIP_ID_BCM53018 53018
179 197
180/* Board types (on PCI usually equals to the subsystem dev id) */ 198/* Board types (on PCI usually equals to the subsystem dev id) */
181/* BCM4313 */ 199/* BCM4313 */
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index b8b09eac60a4..c49e1a159e6e 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -330,6 +330,8 @@
330#define BCMA_CC_PMU_CAP 0x0604 /* PMU capabilities */ 330#define BCMA_CC_PMU_CAP 0x0604 /* PMU capabilities */
331#define BCMA_CC_PMU_CAP_REVISION 0x000000FF /* Revision mask */ 331#define BCMA_CC_PMU_CAP_REVISION 0x000000FF /* Revision mask */
332#define BCMA_CC_PMU_STAT 0x0608 /* PMU status */ 332#define BCMA_CC_PMU_STAT 0x0608 /* PMU status */
333#define BCMA_CC_PMU_STAT_EXT_LPO_AVAIL 0x00000100
334#define BCMA_CC_PMU_STAT_WDRESET 0x00000080
333#define BCMA_CC_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */ 335#define BCMA_CC_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */
334#define BCMA_CC_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */ 336#define BCMA_CC_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */
335#define BCMA_CC_PMU_STAT_HAVEALP 0x00000008 /* ALP available */ 337#define BCMA_CC_PMU_STAT_HAVEALP 0x00000008 /* ALP available */
@@ -355,6 +357,11 @@
355#define BCMA_CC_REGCTL_DATA 0x065C 357#define BCMA_CC_REGCTL_DATA 0x065C
356#define BCMA_CC_PLLCTL_ADDR 0x0660 358#define BCMA_CC_PLLCTL_ADDR 0x0660
357#define BCMA_CC_PLLCTL_DATA 0x0664 359#define BCMA_CC_PLLCTL_DATA 0x0664
360#define BCMA_CC_PMU_STRAPOPT 0x0668 /* (corerev >= 28) */
361#define BCMA_CC_PMU_XTAL_FREQ 0x066C /* (pmurev >= 10) */
362#define BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK 0x00001FFF
363#define BCMA_CC_PMU_XTAL_FREQ_MEASURE_MASK 0x80000000
364#define BCMA_CC_PMU_XTAL_FREQ_MEASURE_SHIFT 31
358#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */ 365#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */
359/* NAND flash MLC controller registers (corerev >= 38) */ 366/* NAND flash MLC controller registers (corerev >= 38) */
360#define BCMA_CC_NAND_REVISION 0x0C00 367#define BCMA_CC_NAND_REVISION 0x0C00
@@ -435,6 +442,23 @@
435#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_MASK 0x00000007 442#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_MASK 0x00000007
436#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_SHIFT 0 443#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_SHIFT 0
437 444
445/* PMU rev 15 */
446#define BCMA_CC_PMU15_PLL_PLLCTL0 0
447#define BCMA_CC_PMU15_PLL_PC0_CLKSEL_MASK 0x00000003
448#define BCMA_CC_PMU15_PLL_PC0_CLKSEL_SHIFT 0
449#define BCMA_CC_PMU15_PLL_PC0_FREQTGT_MASK 0x003FFFFC
450#define BCMA_CC_PMU15_PLL_PC0_FREQTGT_SHIFT 2
451#define BCMA_CC_PMU15_PLL_PC0_PRESCALE_MASK 0x00C00000
452#define BCMA_CC_PMU15_PLL_PC0_PRESCALE_SHIFT 22
453#define BCMA_CC_PMU15_PLL_PC0_KPCTRL_MASK 0x07000000
454#define BCMA_CC_PMU15_PLL_PC0_KPCTRL_SHIFT 24
455#define BCMA_CC_PMU15_PLL_PC0_FCNTCTRL_MASK 0x38000000
456#define BCMA_CC_PMU15_PLL_PC0_FCNTCTRL_SHIFT 27
457#define BCMA_CC_PMU15_PLL_PC0_FDCMODE_MASK 0x40000000
458#define BCMA_CC_PMU15_PLL_PC0_FDCMODE_SHIFT 30
459#define BCMA_CC_PMU15_PLL_PC0_CTRLBIAS_MASK 0x80000000
460#define BCMA_CC_PMU15_PLL_PC0_CTRLBIAS_SHIFT 31
461
438/* ALP clock on pre-PMU chips */ 462/* ALP clock on pre-PMU chips */
439#define BCMA_CC_PMU_ALP_CLOCK 20000000 463#define BCMA_CC_PMU_ALP_CLOCK 20000000
440/* HT clock for systems with PMU-enabled chipcommon */ 464/* HT clock for systems with PMU-enabled chipcommon */
@@ -507,6 +531,37 @@
507#define BCMA_CHIPCTL_5357_I2S_PINS_ENABLE BIT(18) 531#define BCMA_CHIPCTL_5357_I2S_PINS_ENABLE BIT(18)
508#define BCMA_CHIPCTL_5357_I2CSPI_PINS_ENABLE BIT(19) 532#define BCMA_CHIPCTL_5357_I2CSPI_PINS_ENABLE BIT(19)
509 533
534#define BCMA_RES_4314_LPLDO_PU BIT(0)
535#define BCMA_RES_4314_PMU_SLEEP_DIS BIT(1)
536#define BCMA_RES_4314_PMU_BG_PU BIT(2)
537#define BCMA_RES_4314_CBUCK_LPOM_PU BIT(3)
538#define BCMA_RES_4314_CBUCK_PFM_PU BIT(4)
539#define BCMA_RES_4314_CLDO_PU BIT(5)
540#define BCMA_RES_4314_LPLDO2_LVM BIT(6)
541#define BCMA_RES_4314_WL_PMU_PU BIT(7)
542#define BCMA_RES_4314_LNLDO_PU BIT(8)
543#define BCMA_RES_4314_LDO3P3_PU BIT(9)
544#define BCMA_RES_4314_OTP_PU BIT(10)
545#define BCMA_RES_4314_XTAL_PU BIT(11)
546#define BCMA_RES_4314_WL_PWRSW_PU BIT(12)
547#define BCMA_RES_4314_LQ_AVAIL BIT(13)
548#define BCMA_RES_4314_LOGIC_RET BIT(14)
549#define BCMA_RES_4314_MEM_SLEEP BIT(15)
550#define BCMA_RES_4314_MACPHY_RET BIT(16)
551#define BCMA_RES_4314_WL_CORE_READY BIT(17)
552#define BCMA_RES_4314_ILP_REQ BIT(18)
553#define BCMA_RES_4314_ALP_AVAIL BIT(19)
554#define BCMA_RES_4314_MISC_PWRSW_PU BIT(20)
555#define BCMA_RES_4314_SYNTH_PWRSW_PU BIT(21)
556#define BCMA_RES_4314_RX_PWRSW_PU BIT(22)
557#define BCMA_RES_4314_RADIO_PU BIT(23)
558#define BCMA_RES_4314_VCO_LDO_PU BIT(24)
559#define BCMA_RES_4314_AFE_LDO_PU BIT(25)
560#define BCMA_RES_4314_RX_LDO_PU BIT(26)
561#define BCMA_RES_4314_TX_LDO_PU BIT(27)
562#define BCMA_RES_4314_HT_AVAIL BIT(28)
563#define BCMA_RES_4314_MACPHY_CLK_AVAIL BIT(29)
564
510/* Data for the PMU, if available. 565/* Data for the PMU, if available.
511 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) 566 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU)
512 */ 567 */
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 424760f01b9d..0333e605ea0d 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -181,10 +181,31 @@ struct pci_dev;
181 181
182#define BCMA_CORE_PCI_CFG_DEVCTRL 0xd8 182#define BCMA_CORE_PCI_CFG_DEVCTRL 0xd8
183 183
184#define BCMA_CORE_PCI_
185
186/* MDIO devices (SERDES modules) */
187#define BCMA_CORE_PCI_MDIO_IEEE0 0x000
188#define BCMA_CORE_PCI_MDIO_IEEE1 0x001
189#define BCMA_CORE_PCI_MDIO_BLK0 0x800
190#define BCMA_CORE_PCI_MDIO_BLK1 0x801
191#define BCMA_CORE_PCI_MDIO_BLK1_MGMT0 0x16
192#define BCMA_CORE_PCI_MDIO_BLK1_MGMT1 0x17
193#define BCMA_CORE_PCI_MDIO_BLK1_MGMT2 0x18
194#define BCMA_CORE_PCI_MDIO_BLK1_MGMT3 0x19
195#define BCMA_CORE_PCI_MDIO_BLK1_MGMT4 0x1A
196#define BCMA_CORE_PCI_MDIO_BLK2 0x802
197#define BCMA_CORE_PCI_MDIO_BLK3 0x803
198#define BCMA_CORE_PCI_MDIO_BLK4 0x804
199#define BCMA_CORE_PCI_MDIO_TXPLL 0x808 /* TXPLL register block idx */
200#define BCMA_CORE_PCI_MDIO_TXCTRL0 0x820
201#define BCMA_CORE_PCI_MDIO_SERDESID 0x831
202#define BCMA_CORE_PCI_MDIO_RXCTRL0 0x840
203
184/* PCIE Root Capability Register bits (Host mode only) */ 204/* PCIE Root Capability Register bits (Host mode only) */
185#define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001 205#define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001
186 206
187struct bcma_drv_pci; 207struct bcma_drv_pci;
208struct bcma_bus;
188 209
189#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE 210#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
190struct bcma_drv_pci_host { 211struct bcma_drv_pci_host {
@@ -219,7 +240,9 @@ struct bcma_drv_pci {
219extern void bcma_core_pci_init(struct bcma_drv_pci *pc); 240extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
220extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, 241extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
221 struct bcma_device *core, bool enable); 242 struct bcma_device *core, bool enable);
222extern void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend); 243extern void bcma_core_pci_up(struct bcma_bus *bus);
244extern void bcma_core_pci_down(struct bcma_bus *bus);
245extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
223 246
224extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); 247extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
225extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); 248extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 70cf138690e9..e8112ae50531 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -31,7 +31,7 @@ struct linux_binprm {
31#ifdef __alpha__ 31#ifdef __alpha__
32 unsigned int taso:1; 32 unsigned int taso:1;
33#endif 33#endif
34 unsigned int recursion_depth; 34 unsigned int recursion_depth; /* only for search_binary_handler() */
35 struct file * file; 35 struct file * file;
36 struct cred *cred; /* new credentials */ 36 struct cred *cred; /* new credentials */
37 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */ 37 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index ef24466d8f82..ec48bac5b039 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -97,11 +97,11 @@ static inline void *bio_data(struct bio *bio)
97 * permanent PIO fall back, user is probably better off disabling highmem 97 * permanent PIO fall back, user is probably better off disabling highmem
98 * I/O completely on that queue (see ide-dma for example) 98 * I/O completely on that queue (see ide-dma for example)
99 */ 99 */
100#define __bio_kmap_atomic(bio, idx, kmtype) \ 100#define __bio_kmap_atomic(bio, idx) \
101 (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \ 101 (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \
102 bio_iovec_idx((bio), (idx))->bv_offset) 102 bio_iovec_idx((bio), (idx))->bv_offset)
103 103
104#define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr) 104#define __bio_kunmap_atomic(addr) kunmap_atomic(addr)
105 105
106/* 106/*
107 * merge helpers etc 107 * merge helpers etc
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2fdb4a451b49..0e6f765aa1f5 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -862,6 +862,17 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
862 return blk_queue_get_max_sectors(q, rq->cmd_flags); 862 return blk_queue_get_max_sectors(q, rq->cmd_flags);
863} 863}
864 864
865static inline unsigned int blk_rq_count_bios(struct request *rq)
866{
867 unsigned int nr_bios = 0;
868 struct bio *bio;
869
870 __rq_for_each_bio(bio, rq)
871 nr_bios++;
872
873 return nr_bios;
874}
875
865/* 876/*
866 * Request issue related functions. 877 * Request issue related functions.
867 */ 878 */
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 5f0b0e1f7c08..f1f07d31a3af 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -44,8 +44,8 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
44 unsigned long endpfn); 44 unsigned long endpfn);
45extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); 45extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
46 46
47extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
48extern unsigned long free_all_bootmem(void); 47extern unsigned long free_all_bootmem(void);
48extern void reset_all_zones_managed_pages(void);
49 49
50extern void free_bootmem_node(pg_data_t *pgdat, 50extern void free_bootmem_node(pg_data_t *pgdat,
51 unsigned long addr, 51 unsigned long addr,
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 9e52b0626b39..d77797a52b7b 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -36,6 +36,7 @@ enum bh_state_bits {
36 BH_Quiet, /* Buffer Error Prinks to be quiet */ 36 BH_Quiet, /* Buffer Error Prinks to be quiet */
37 BH_Meta, /* Buffer contains metadata */ 37 BH_Meta, /* Buffer contains metadata */
38 BH_Prio, /* Buffer should be submitted with REQ_PRIO */ 38 BH_Prio, /* Buffer should be submitted with REQ_PRIO */
39 BH_Defer_Completion, /* Defer AIO completion to workqueue */
39 40
40 BH_PrivateStart,/* not a state bit, but the first bit available 41 BH_PrivateStart,/* not a state bit, but the first bit available
41 * for private allocation by other entities 42 * for private allocation by other entities
@@ -128,6 +129,7 @@ BUFFER_FNS(Write_EIO, write_io_error)
128BUFFER_FNS(Unwritten, unwritten) 129BUFFER_FNS(Unwritten, unwritten)
129BUFFER_FNS(Meta, meta) 130BUFFER_FNS(Meta, meta)
130BUFFER_FNS(Prio, prio) 131BUFFER_FNS(Prio, prio)
132BUFFER_FNS(Defer_Completion, defer_completion)
131 133
132#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) 134#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
133 135
@@ -139,6 +141,9 @@ BUFFER_FNS(Prio, prio)
139 }) 141 })
140#define page_has_buffers(page) PagePrivate(page) 142#define page_has_buffers(page) PagePrivate(page)
141 143
144void buffer_check_dirty_writeback(struct page *page,
145 bool *dirty, bool *writeback);
146
142/* 147/*
143 * Declarations 148 * Declarations
144 */ 149 */
@@ -198,7 +203,8 @@ extern int buffer_heads_over_limit;
198 * Generic address_space_operations implementations for buffer_head-backed 203 * Generic address_space_operations implementations for buffer_head-backed
199 * address_spaces. 204 * address_spaces.
200 */ 205 */
201void block_invalidatepage(struct page *page, unsigned long offset); 206void block_invalidatepage(struct page *page, unsigned int offset,
207 unsigned int length);
202int block_write_full_page(struct page *page, get_block_t *get_block, 208int block_write_full_page(struct page *page, get_block_t *get_block,
203 struct writeback_control *wbc); 209 struct writeback_control *wbc);
204int block_write_full_page_endio(struct page *page, get_block_t *get_block, 210int block_write_full_page_endio(struct page *page, get_block_t *get_block,
diff --git a/include/linux/can/platform/flexcan.h b/include/linux/can/platform/flexcan.h
deleted file mode 100644
index 72b713ab57e9..000000000000
--- a/include/linux/can/platform/flexcan.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Copyright (C) 2010 Marc Kleine-Budde <kernel@pengutronix.de>
3 *
4 * This file is released under the GPLv2
5 *
6 */
7
8#ifndef __CAN_PLATFORM_FLEXCAN_H
9#define __CAN_PLATFORM_FLEXCAN_H
10
11/**
12 * struct flexcan_platform_data - flex CAN controller platform data
13 * @transceiver_enable: - called to power on/off the transceiver
14 *
15 */
16struct flexcan_platform_data {
17 void (*transceiver_switch)(int enable);
18};
19
20#endif /* __CAN_PLATFORM_FLEXCAN_H */
diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h
index 089fe43211a4..dc029dba7a03 100644
--- a/include/linux/can/platform/mcp251x.h
+++ b/include/linux/can/platform/mcp251x.h
@@ -9,26 +9,13 @@
9 9
10#include <linux/spi/spi.h> 10#include <linux/spi/spi.h>
11 11
12/** 12/*
13 * struct mcp251x_platform_data - MCP251X SPI CAN controller platform data 13 * struct mcp251x_platform_data - MCP251X SPI CAN controller platform data
14 * @oscillator_frequency: - oscillator frequency in Hz 14 * @oscillator_frequency: - oscillator frequency in Hz
15 * @irq_flags: - IRQF configuration flags
16 * @board_specific_setup: - called before probing the chip (power,reset)
17 * @transceiver_enable: - called to power on/off the transceiver
18 * @power_enable: - called to power on/off the mcp *and* the
19 * transceiver
20 *
21 * Please note that you should define power_enable or transceiver_enable or
22 * none of them. Defining both of them is no use.
23 *
24 */ 15 */
25 16
26struct mcp251x_platform_data { 17struct mcp251x_platform_data {
27 unsigned long oscillator_frequency; 18 unsigned long oscillator_frequency;
28 unsigned long irq_flags;
29 int (*board_specific_setup)(struct spi_device *spi);
30 int (*transceiver_enable)(int enable);
31 int (*power_enable) (int enable);
32}; 19};
33 20
34#endif /* __CAN_PLATFORM_MCP251X_H__ */ 21#endif /* __CAN_PLATFORM_MCP251X_H__ */
diff --git a/include/linux/capability.h b/include/linux/capability.h
index d9a4f7f40f32..a6ee1f9a5018 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -210,7 +210,6 @@ extern bool has_ns_capability_noaudit(struct task_struct *t,
210 struct user_namespace *ns, int cap); 210 struct user_namespace *ns, int cap);
211extern bool capable(int cap); 211extern bool capable(int cap);
212extern bool ns_capable(struct user_namespace *ns, int cap); 212extern bool ns_capable(struct user_namespace *ns, int cap);
213extern bool nsown_capable(int cap);
214extern bool inode_capable(const struct inode *inode, int cap); 213extern bool inode_capable(const struct inode *inode, int cap);
215extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap); 214extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap);
216 215
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index 379f71508995..0442c3d800f0 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -160,11 +160,6 @@ static inline void ceph_decode_timespec(struct timespec *ts,
160static inline void ceph_encode_timespec(struct ceph_timespec *tv, 160static inline void ceph_encode_timespec(struct ceph_timespec *tv,
161 const struct timespec *ts) 161 const struct timespec *ts)
162{ 162{
163 BUG_ON(ts->tv_sec < 0);
164 BUG_ON(ts->tv_sec > (__kernel_time_t)U32_MAX);
165 BUG_ON(ts->tv_nsec < 0);
166 BUG_ON(ts->tv_nsec > (long)U32_MAX);
167
168 tv->tv_sec = cpu_to_le32((u32)ts->tv_sec); 163 tv->tv_sec = cpu_to_le32((u32)ts->tv_sec);
169 tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec); 164 tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec);
170} 165}
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 186db0bf4951..8f47625a0661 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -145,7 +145,6 @@ struct ceph_osd_request {
145 s32 r_reply_op_result[CEPH_OSD_MAX_OP]; 145 s32 r_reply_op_result[CEPH_OSD_MAX_OP];
146 int r_got_reply; 146 int r_got_reply;
147 int r_linger; 147 int r_linger;
148 int r_completed;
149 148
150 struct ceph_osd_client *r_osdc; 149 struct ceph_osd_client *r_osdc;
151 struct kref r_kref; 150 struct kref r_kref;
@@ -336,6 +335,8 @@ extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc,
336 struct ceph_osd_request *req); 335 struct ceph_osd_request *req);
337extern void ceph_osdc_sync(struct ceph_osd_client *osdc); 336extern void ceph_osdc_sync(struct ceph_osd_client *osdc);
338 337
338extern void ceph_osdc_flush_notifies(struct ceph_osd_client *osdc);
339
339extern int ceph_osdc_readpages(struct ceph_osd_client *osdc, 340extern int ceph_osdc_readpages(struct ceph_osd_client *osdc,
340 struct ceph_vino vino, 341 struct ceph_vino vino,
341 struct ceph_file_layout *layout, 342 struct ceph_file_layout *layout,
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 8bda1294c035..3561d305b1e0 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -20,6 +20,7 @@
20#include <linux/workqueue.h> 20#include <linux/workqueue.h>
21#include <linux/xattr.h> 21#include <linux/xattr.h>
22#include <linux/fs.h> 22#include <linux/fs.h>
23#include <linux/percpu-refcount.h>
23 24
24#ifdef CONFIG_CGROUPS 25#ifdef CONFIG_CGROUPS
25 26
@@ -65,27 +66,25 @@ enum cgroup_subsys_id {
65 66
66/* Per-subsystem/per-cgroup state maintained by the system. */ 67/* Per-subsystem/per-cgroup state maintained by the system. */
67struct cgroup_subsys_state { 68struct cgroup_subsys_state {
68 /* 69 /* the cgroup that this css is attached to */
69 * The cgroup that this subsystem is attached to. Useful
70 * for subsystems that want to know about the cgroup
71 * hierarchy structure
72 */
73 struct cgroup *cgroup; 70 struct cgroup *cgroup;
74 71
75 /* 72 /* the cgroup subsystem that this css is attached to */
76 * State maintained by the cgroup system to allow subsystems 73 struct cgroup_subsys *ss;
77 * to be "busy". Should be accessed via css_get(), 74
78 * css_tryget() and css_put(). 75 /* reference count - access via css_[try]get() and css_put() */
79 */ 76 struct percpu_ref refcnt;
80 77
81 atomic_t refcnt; 78 /* the parent css */
79 struct cgroup_subsys_state *parent;
82 80
83 unsigned long flags; 81 unsigned long flags;
84 /* ID for this css, if possible */ 82 /* ID for this css, if possible */
85 struct css_id __rcu *id; 83 struct css_id __rcu *id;
86 84
87 /* Used to put @cgroup->dentry on the last css_put() */ 85 /* percpu_ref killing and RCU release */
88 struct work_struct dput_work; 86 struct rcu_head rcu_head;
87 struct work_struct destroy_work;
89}; 88};
90 89
91/* bits in struct cgroup_subsys_state flags field */ 90/* bits in struct cgroup_subsys_state flags field */
@@ -94,56 +93,52 @@ enum {
94 CSS_ONLINE = (1 << 1), /* between ->css_online() and ->css_offline() */ 93 CSS_ONLINE = (1 << 1), /* between ->css_online() and ->css_offline() */
95}; 94};
96 95
97/* Caller must verify that the css is not for root cgroup */ 96/**
98static inline void __css_get(struct cgroup_subsys_state *css, int count) 97 * css_get - obtain a reference on the specified css
99{ 98 * @css: target css
100 atomic_add(count, &css->refcnt); 99 *
101} 100 * The caller must already have a reference.
102
103/*
104 * Call css_get() to hold a reference on the css; it can be used
105 * for a reference obtained via:
106 * - an existing ref-counted reference to the css
107 * - task->cgroups for a locked task
108 */ 101 */
109
110static inline void css_get(struct cgroup_subsys_state *css) 102static inline void css_get(struct cgroup_subsys_state *css)
111{ 103{
112 /* We don't need to reference count the root state */ 104 /* We don't need to reference count the root state */
113 if (!(css->flags & CSS_ROOT)) 105 if (!(css->flags & CSS_ROOT))
114 __css_get(css, 1); 106 percpu_ref_get(&css->refcnt);
115} 107}
116 108
117/* 109/**
118 * Call css_tryget() to take a reference on a css if your existing 110 * css_tryget - try to obtain a reference on the specified css
119 * (known-valid) reference isn't already ref-counted. Returns false if 111 * @css: target css
120 * the css has been destroyed. 112 *
113 * Obtain a reference on @css if it's alive. The caller naturally needs to
114 * ensure that @css is accessible but doesn't have to be holding a
115 * reference on it - IOW, RCU protected access is good enough for this
116 * function. Returns %true if a reference count was successfully obtained;
117 * %false otherwise.
121 */ 118 */
122
123extern bool __css_tryget(struct cgroup_subsys_state *css);
124static inline bool css_tryget(struct cgroup_subsys_state *css) 119static inline bool css_tryget(struct cgroup_subsys_state *css)
125{ 120{
126 if (css->flags & CSS_ROOT) 121 if (css->flags & CSS_ROOT)
127 return true; 122 return true;
128 return __css_tryget(css); 123 return percpu_ref_tryget(&css->refcnt);
129} 124}
130 125
131/* 126/**
132 * css_put() should be called to release a reference taken by 127 * css_put - put a css reference
133 * css_get() or css_tryget() 128 * @css: target css
129 *
130 * Put a reference obtained via css_get() and css_tryget().
134 */ 131 */
135
136extern void __css_put(struct cgroup_subsys_state *css);
137static inline void css_put(struct cgroup_subsys_state *css) 132static inline void css_put(struct cgroup_subsys_state *css)
138{ 133{
139 if (!(css->flags & CSS_ROOT)) 134 if (!(css->flags & CSS_ROOT))
140 __css_put(css); 135 percpu_ref_put(&css->refcnt);
141} 136}
142 137
143/* bits in struct cgroup flags field */ 138/* bits in struct cgroup flags field */
144enum { 139enum {
145 /* Control Group is dead */ 140 /* Control Group is dead */
146 CGRP_REMOVED, 141 CGRP_DEAD,
147 /* 142 /*
148 * Control Group has previously had a child cgroup or a task, 143 * Control Group has previously had a child cgroup or a task,
149 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) 144 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
@@ -170,12 +165,15 @@ struct cgroup {
170 unsigned long flags; /* "unsigned long" so bitops work */ 165 unsigned long flags; /* "unsigned long" so bitops work */
171 166
172 /* 167 /*
173 * count users of this cgroup. >0 means busy, but doesn't 168 * idr allocated in-hierarchy ID.
174 * necessarily indicate the number of tasks in the cgroup 169 *
170 * The ID of the root cgroup is always 0, and a new cgroup
171 * will be assigned with a smallest available ID.
175 */ 172 */
176 atomic_t count; 173 int id;
177 174
178 int id; /* ida allocated in-hierarchy ID */ 175 /* the number of attached css's */
176 int nr_css;
179 177
180 /* 178 /*
181 * We link our 'sibling' struct into our parent's 'children'. 179 * We link our 'sibling' struct into our parent's 'children'.
@@ -189,6 +187,14 @@ struct cgroup {
189 struct dentry *dentry; /* cgroup fs entry, RCU protected */ 187 struct dentry *dentry; /* cgroup fs entry, RCU protected */
190 188
191 /* 189 /*
190 * Monotonically increasing unique serial number which defines a
191 * uniform order among all cgroups. It's guaranteed that all
192 * ->children lists are in the ascending order of ->serial_nr.
193 * It's used to allow interrupting and resuming iterations.
194 */
195 u64 serial_nr;
196
197 /*
192 * This is a copy of dentry->d_name, and it's needed because 198 * This is a copy of dentry->d_name, and it's needed because
193 * we can't use dentry->d_name in cgroup_path(). 199 * we can't use dentry->d_name in cgroup_path().
194 * 200 *
@@ -202,18 +208,15 @@ struct cgroup {
202 struct cgroup_name __rcu *name; 208 struct cgroup_name __rcu *name;
203 209
204 /* Private pointers for each registered subsystem */ 210 /* Private pointers for each registered subsystem */
205 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 211 struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT];
206 212
207 struct cgroupfs_root *root; 213 struct cgroupfs_root *root;
208 214
209 /* 215 /*
210 * List of cg_cgroup_links pointing at css_sets with 216 * List of cgrp_cset_links pointing at css_sets with tasks in this
211 * tasks in this cgroup. Protected by css_set_lock 217 * cgroup. Protected by css_set_lock.
212 */ 218 */
213 struct list_head css_sets; 219 struct list_head cset_links;
214
215 struct list_head allcg_node; /* cgroupfs_root->allcg_list */
216 struct list_head cft_q_node; /* used during cftype add/rm */
217 220
218 /* 221 /*
219 * Linked list running through all cgroups that can 222 * Linked list running through all cgroups that can
@@ -229,9 +232,12 @@ struct cgroup {
229 struct list_head pidlists; 232 struct list_head pidlists;
230 struct mutex pidlist_mutex; 233 struct mutex pidlist_mutex;
231 234
232 /* For RCU-protected deletion */ 235 /* dummy css with NULL ->ss, points back to this cgroup */
236 struct cgroup_subsys_state dummy_css;
237
238 /* For css percpu_ref killing and RCU-protected deletion */
233 struct rcu_head rcu_head; 239 struct rcu_head rcu_head;
234 struct work_struct free_work; 240 struct work_struct destroy_work;
235 241
236 /* List of events which userspace want to receive */ 242 /* List of events which userspace want to receive */
237 struct list_head event_list; 243 struct list_head event_list;
@@ -269,18 +275,35 @@ enum {
269 * 275 *
270 * - Remount is disallowed. 276 * - Remount is disallowed.
271 * 277 *
278 * - rename(2) is disallowed.
279 *
280 * - "tasks" is removed. Everything should be at process
281 * granularity. Use "cgroup.procs" instead.
282 *
283 * - "release_agent" and "notify_on_release" are removed.
284 * Replacement notification mechanism will be implemented.
285 *
286 * - cpuset: tasks will be kept in empty cpusets when hotplug happens
287 * and take masks of ancestors with non-empty cpus/mems, instead of
288 * being moved to an ancestor.
289 *
290 * - cpuset: a task can be moved into an empty cpuset, and again it
291 * takes masks of ancestors.
292 *
272 * - memcg: use_hierarchy is on by default and the cgroup file for 293 * - memcg: use_hierarchy is on by default and the cgroup file for
273 * the flag is not created. 294 * the flag is not created.
274 * 295 *
275 * The followings are planned changes. 296 * - blkcg: blk-throttle becomes properly hierarchical.
276 *
277 * - release_agent will be disallowed once replacement notification
278 * mechanism is implemented.
279 */ 297 */
280 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0), 298 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0),
281 299
282 CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */ 300 CGRP_ROOT_NOPREFIX = (1 << 1), /* mounted subsystems have no named prefix */
283 CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */ 301 CGRP_ROOT_XATTR = (1 << 2), /* supports extended attributes */
302
303 /* mount options live below bit 16 */
304 CGRP_ROOT_OPTION_MASK = (1 << 16) - 1,
305
306 CGRP_ROOT_SUBSYS_BOUND = (1 << 16), /* subsystems finished binding */
284}; 307};
285 308
286/* 309/*
@@ -291,18 +314,12 @@ enum {
291struct cgroupfs_root { 314struct cgroupfs_root {
292 struct super_block *sb; 315 struct super_block *sb;
293 316
294 /* 317 /* The bitmask of subsystems attached to this hierarchy */
295 * The bitmask of subsystems intended to be attached to this
296 * hierarchy
297 */
298 unsigned long subsys_mask; 318 unsigned long subsys_mask;
299 319
300 /* Unique id for this hierarchy. */ 320 /* Unique id for this hierarchy. */
301 int hierarchy_id; 321 int hierarchy_id;
302 322
303 /* The bitmask of subsystems currently attached to this hierarchy */
304 unsigned long actual_subsys_mask;
305
306 /* A list running through the attached subsystems */ 323 /* A list running through the attached subsystems */
307 struct list_head subsys_list; 324 struct list_head subsys_list;
308 325
@@ -315,14 +332,11 @@ struct cgroupfs_root {
315 /* A list running through the active hierarchies */ 332 /* A list running through the active hierarchies */
316 struct list_head root_list; 333 struct list_head root_list;
317 334
318 /* All cgroups on this root, cgroup_mutex protected */
319 struct list_head allcg_list;
320
321 /* Hierarchy-specific flags */ 335 /* Hierarchy-specific flags */
322 unsigned long flags; 336 unsigned long flags;
323 337
324 /* IDs for cgroups in this hierarchy */ 338 /* IDs for cgroups in this hierarchy */
325 struct ida cgroup_ida; 339 struct idr cgroup_idr;
326 340
327 /* The path to use for release notifications. */ 341 /* The path to use for release notifications. */
328 char release_agent_path[PATH_MAX]; 342 char release_agent_path[PATH_MAX];
@@ -357,11 +371,10 @@ struct css_set {
357 struct list_head tasks; 371 struct list_head tasks;
358 372
359 /* 373 /*
360 * List of cg_cgroup_link objects on link chains from 374 * List of cgrp_cset_links pointing at cgroups referenced from this
361 * cgroups referenced from this css_set. Protected by 375 * css_set. Protected by css_set_lock.
362 * css_set_lock
363 */ 376 */
364 struct list_head cg_links; 377 struct list_head cgrp_links;
365 378
366 /* 379 /*
367 * Set of subsystem states, one for each subsystem. This array 380 * Set of subsystem states, one for each subsystem. This array
@@ -394,9 +407,12 @@ struct cgroup_map_cb {
394 */ 407 */
395 408
396/* cftype->flags */ 409/* cftype->flags */
397#define CFTYPE_ONLY_ON_ROOT (1U << 0) /* only create on root cg */ 410enum {
398#define CFTYPE_NOT_ON_ROOT (1U << 1) /* don't create on root cg */ 411 CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */
399#define CFTYPE_INSANE (1U << 2) /* don't create if sane_behavior */ 412 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */
413 CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */
414 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */
415};
400 416
401#define MAX_CFTYPE_NAME 64 417#define MAX_CFTYPE_NAME 64
402 418
@@ -423,35 +439,41 @@ struct cftype {
423 /* CFTYPE_* flags */ 439 /* CFTYPE_* flags */
424 unsigned int flags; 440 unsigned int flags;
425 441
442 /*
443 * The subsys this file belongs to. Initialized automatically
444 * during registration. NULL for cgroup core files.
445 */
446 struct cgroup_subsys *ss;
447
426 int (*open)(struct inode *inode, struct file *file); 448 int (*open)(struct inode *inode, struct file *file);
427 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, 449 ssize_t (*read)(struct cgroup_subsys_state *css, struct cftype *cft,
428 struct file *file, 450 struct file *file,
429 char __user *buf, size_t nbytes, loff_t *ppos); 451 char __user *buf, size_t nbytes, loff_t *ppos);
430 /* 452 /*
431 * read_u64() is a shortcut for the common case of returning a 453 * read_u64() is a shortcut for the common case of returning a
432 * single integer. Use it in place of read() 454 * single integer. Use it in place of read()
433 */ 455 */
434 u64 (*read_u64)(struct cgroup *cgrp, struct cftype *cft); 456 u64 (*read_u64)(struct cgroup_subsys_state *css, struct cftype *cft);
435 /* 457 /*
436 * read_s64() is a signed version of read_u64() 458 * read_s64() is a signed version of read_u64()
437 */ 459 */
438 s64 (*read_s64)(struct cgroup *cgrp, struct cftype *cft); 460 s64 (*read_s64)(struct cgroup_subsys_state *css, struct cftype *cft);
439 /* 461 /*
440 * read_map() is used for defining a map of key/value 462 * read_map() is used for defining a map of key/value
441 * pairs. It should call cb->fill(cb, key, value) for each 463 * pairs. It should call cb->fill(cb, key, value) for each
442 * entry. The key/value pairs (and their ordering) should not 464 * entry. The key/value pairs (and their ordering) should not
443 * change between reboots. 465 * change between reboots.
444 */ 466 */
445 int (*read_map)(struct cgroup *cont, struct cftype *cft, 467 int (*read_map)(struct cgroup_subsys_state *css, struct cftype *cft,
446 struct cgroup_map_cb *cb); 468 struct cgroup_map_cb *cb);
447 /* 469 /*
448 * read_seq_string() is used for outputting a simple sequence 470 * read_seq_string() is used for outputting a simple sequence
449 * using seqfile. 471 * using seqfile.
450 */ 472 */
451 int (*read_seq_string)(struct cgroup *cont, struct cftype *cft, 473 int (*read_seq_string)(struct cgroup_subsys_state *css,
452 struct seq_file *m); 474 struct cftype *cft, struct seq_file *m);
453 475
454 ssize_t (*write)(struct cgroup *cgrp, struct cftype *cft, 476 ssize_t (*write)(struct cgroup_subsys_state *css, struct cftype *cft,
455 struct file *file, 477 struct file *file,
456 const char __user *buf, size_t nbytes, loff_t *ppos); 478 const char __user *buf, size_t nbytes, loff_t *ppos);
457 479
@@ -460,18 +482,20 @@ struct cftype {
460 * a single integer (as parsed by simple_strtoull) from 482 * a single integer (as parsed by simple_strtoull) from
461 * userspace. Use in place of write(); return 0 or error. 483 * userspace. Use in place of write(); return 0 or error.
462 */ 484 */
463 int (*write_u64)(struct cgroup *cgrp, struct cftype *cft, u64 val); 485 int (*write_u64)(struct cgroup_subsys_state *css, struct cftype *cft,
486 u64 val);
464 /* 487 /*
465 * write_s64() is a signed version of write_u64() 488 * write_s64() is a signed version of write_u64()
466 */ 489 */
467 int (*write_s64)(struct cgroup *cgrp, struct cftype *cft, s64 val); 490 int (*write_s64)(struct cgroup_subsys_state *css, struct cftype *cft,
491 s64 val);
468 492
469 /* 493 /*
470 * write_string() is passed a nul-terminated kernelspace 494 * write_string() is passed a nul-terminated kernelspace
471 * buffer of maximum length determined by max_write_len. 495 * buffer of maximum length determined by max_write_len.
472 * Returns 0 or -ve error code. 496 * Returns 0 or -ve error code.
473 */ 497 */
474 int (*write_string)(struct cgroup *cgrp, struct cftype *cft, 498 int (*write_string)(struct cgroup_subsys_state *css, struct cftype *cft,
475 const char *buffer); 499 const char *buffer);
476 /* 500 /*
477 * trigger() callback can be used to get some kick from the 501 * trigger() callback can be used to get some kick from the
@@ -479,7 +503,7 @@ struct cftype {
479 * at all. The private field can be used to determine the 503 * at all. The private field can be used to determine the
480 * kick type for multiplexing. 504 * kick type for multiplexing.
481 */ 505 */
482 int (*trigger)(struct cgroup *cgrp, unsigned int event); 506 int (*trigger)(struct cgroup_subsys_state *css, unsigned int event);
483 507
484 int (*release)(struct inode *inode, struct file *file); 508 int (*release)(struct inode *inode, struct file *file);
485 509
@@ -489,16 +513,18 @@ struct cftype {
489 * you want to provide this functionality. Use eventfd_signal() 513 * you want to provide this functionality. Use eventfd_signal()
490 * on eventfd to send notification to userspace. 514 * on eventfd to send notification to userspace.
491 */ 515 */
492 int (*register_event)(struct cgroup *cgrp, struct cftype *cft, 516 int (*register_event)(struct cgroup_subsys_state *css,
493 struct eventfd_ctx *eventfd, const char *args); 517 struct cftype *cft, struct eventfd_ctx *eventfd,
518 const char *args);
494 /* 519 /*
495 * unregister_event() callback will be called when userspace 520 * unregister_event() callback will be called when userspace
496 * closes the eventfd or on cgroup removing. 521 * closes the eventfd or on cgroup removing.
497 * This callback must be implemented, if you want provide 522 * This callback must be implemented, if you want provide
498 * notification functionality. 523 * notification functionality.
499 */ 524 */
500 void (*unregister_event)(struct cgroup *cgrp, struct cftype *cft, 525 void (*unregister_event)(struct cgroup_subsys_state *css,
501 struct eventfd_ctx *eventfd); 526 struct cftype *cft,
527 struct eventfd_ctx *eventfd);
502}; 528};
503 529
504/* 530/*
@@ -511,15 +537,6 @@ struct cftype_set {
511 struct cftype *cfts; 537 struct cftype *cfts;
512}; 538};
513 539
514struct cgroup_scanner {
515 struct cgroup *cg;
516 int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan);
517 void (*process_task)(struct task_struct *p,
518 struct cgroup_scanner *scan);
519 struct ptr_heap *heap;
520 void *data;
521};
522
523/* 540/*
524 * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This 541 * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This
525 * function can be called as long as @cgrp is accessible. 542 * function can be called as long as @cgrp is accessible.
@@ -536,12 +553,12 @@ static inline const char *cgroup_name(const struct cgroup *cgrp)
536} 553}
537 554
538int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 555int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
539int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 556int cgroup_rm_cftypes(struct cftype *cfts);
540 557
541int cgroup_is_removed(const struct cgroup *cgrp);
542bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); 558bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);
543 559
544int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen); 560int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
561int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen);
545 562
546int cgroup_task_count(const struct cgroup *cgrp); 563int cgroup_task_count(const struct cgroup *cgrp);
547 564
@@ -552,20 +569,22 @@ int cgroup_task_count(const struct cgroup *cgrp);
552struct cgroup_taskset; 569struct cgroup_taskset;
553struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset); 570struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset);
554struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset); 571struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset);
555struct cgroup *cgroup_taskset_cur_cgroup(struct cgroup_taskset *tset); 572struct cgroup_subsys_state *cgroup_taskset_cur_css(struct cgroup_taskset *tset,
573 int subsys_id);
556int cgroup_taskset_size(struct cgroup_taskset *tset); 574int cgroup_taskset_size(struct cgroup_taskset *tset);
557 575
558/** 576/**
559 * cgroup_taskset_for_each - iterate cgroup_taskset 577 * cgroup_taskset_for_each - iterate cgroup_taskset
560 * @task: the loop cursor 578 * @task: the loop cursor
561 * @skip_cgrp: skip if task's cgroup matches this, %NULL to iterate through all 579 * @skip_css: skip if task's css matches this, %NULL to iterate through all
562 * @tset: taskset to iterate 580 * @tset: taskset to iterate
563 */ 581 */
564#define cgroup_taskset_for_each(task, skip_cgrp, tset) \ 582#define cgroup_taskset_for_each(task, skip_css, tset) \
565 for ((task) = cgroup_taskset_first((tset)); (task); \ 583 for ((task) = cgroup_taskset_first((tset)); (task); \
566 (task) = cgroup_taskset_next((tset))) \ 584 (task) = cgroup_taskset_next((tset))) \
567 if (!(skip_cgrp) || \ 585 if (!(skip_css) || \
568 cgroup_taskset_cur_cgroup((tset)) != (skip_cgrp)) 586 cgroup_taskset_cur_css((tset), \
587 (skip_css)->ss->subsys_id) != (skip_css))
569 588
570/* 589/*
571 * Control Group subsystem type. 590 * Control Group subsystem type.
@@ -573,18 +592,22 @@ int cgroup_taskset_size(struct cgroup_taskset *tset);
573 */ 592 */
574 593
575struct cgroup_subsys { 594struct cgroup_subsys {
576 struct cgroup_subsys_state *(*css_alloc)(struct cgroup *cgrp); 595 struct cgroup_subsys_state *(*css_alloc)(struct cgroup_subsys_state *parent_css);
577 int (*css_online)(struct cgroup *cgrp); 596 int (*css_online)(struct cgroup_subsys_state *css);
578 void (*css_offline)(struct cgroup *cgrp); 597 void (*css_offline)(struct cgroup_subsys_state *css);
579 void (*css_free)(struct cgroup *cgrp); 598 void (*css_free)(struct cgroup_subsys_state *css);
580 599
581 int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 600 int (*can_attach)(struct cgroup_subsys_state *css,
582 void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 601 struct cgroup_taskset *tset);
583 void (*attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 602 void (*cancel_attach)(struct cgroup_subsys_state *css,
603 struct cgroup_taskset *tset);
604 void (*attach)(struct cgroup_subsys_state *css,
605 struct cgroup_taskset *tset);
584 void (*fork)(struct task_struct *task); 606 void (*fork)(struct task_struct *task);
585 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp, 607 void (*exit)(struct cgroup_subsys_state *css,
608 struct cgroup_subsys_state *old_css,
586 struct task_struct *task); 609 struct task_struct *task);
587 void (*bind)(struct cgroup *root); 610 void (*bind)(struct cgroup_subsys_state *root_css);
588 611
589 int subsys_id; 612 int subsys_id;
590 int disabled; 613 int disabled;
@@ -640,95 +663,153 @@ struct cgroup_subsys {
640#undef IS_SUBSYS_ENABLED 663#undef IS_SUBSYS_ENABLED
641#undef SUBSYS 664#undef SUBSYS
642 665
643static inline struct cgroup_subsys_state *cgroup_subsys_state( 666/**
644 struct cgroup *cgrp, int subsys_id) 667 * css_parent - find the parent css
668 * @css: the target cgroup_subsys_state
669 *
670 * Return the parent css of @css. This function is guaranteed to return
671 * non-NULL parent as long as @css isn't the root.
672 */
673static inline
674struct cgroup_subsys_state *css_parent(struct cgroup_subsys_state *css)
645{ 675{
646 return cgrp->subsys[subsys_id]; 676 return css->parent;
647} 677}
648 678
649/* 679/**
650 * function to get the cgroup_subsys_state which allows for extra 680 * task_css_set_check - obtain a task's css_set with extra access conditions
651 * rcu_dereference_check() conditions, such as locks used during the 681 * @task: the task to obtain css_set for
652 * cgroup_subsys::attach() methods. 682 * @__c: extra condition expression to be passed to rcu_dereference_check()
683 *
684 * A task's css_set is RCU protected, initialized and exited while holding
685 * task_lock(), and can only be modified while holding both cgroup_mutex
686 * and task_lock() while the task is alive. This macro verifies that the
687 * caller is inside proper critical section and returns @task's css_set.
688 *
689 * The caller can also specify additional allowed conditions via @__c, such
690 * as locks used during the cgroup_subsys::attach() methods.
653 */ 691 */
654#ifdef CONFIG_PROVE_RCU 692#ifdef CONFIG_PROVE_RCU
655extern struct mutex cgroup_mutex; 693extern struct mutex cgroup_mutex;
656#define task_subsys_state_check(task, subsys_id, __c) \ 694#define task_css_set_check(task, __c) \
657 rcu_dereference_check((task)->cgroups->subsys[(subsys_id)], \ 695 rcu_dereference_check((task)->cgroups, \
658 lockdep_is_held(&(task)->alloc_lock) || \ 696 lockdep_is_held(&(task)->alloc_lock) || \
659 lockdep_is_held(&cgroup_mutex) || (__c)) 697 lockdep_is_held(&cgroup_mutex) || (__c))
660#else 698#else
661#define task_subsys_state_check(task, subsys_id, __c) \ 699#define task_css_set_check(task, __c) \
662 rcu_dereference((task)->cgroups->subsys[(subsys_id)]) 700 rcu_dereference((task)->cgroups)
663#endif 701#endif
664 702
665static inline struct cgroup_subsys_state * 703/**
666task_subsys_state(struct task_struct *task, int subsys_id) 704 * task_css_check - obtain css for (task, subsys) w/ extra access conds
705 * @task: the target task
706 * @subsys_id: the target subsystem ID
707 * @__c: extra condition expression to be passed to rcu_dereference_check()
708 *
709 * Return the cgroup_subsys_state for the (@task, @subsys_id) pair. The
710 * synchronization rules are the same as task_css_set_check().
711 */
712#define task_css_check(task, subsys_id, __c) \
713 task_css_set_check((task), (__c))->subsys[(subsys_id)]
714
715/**
716 * task_css_set - obtain a task's css_set
717 * @task: the task to obtain css_set for
718 *
719 * See task_css_set_check().
720 */
721static inline struct css_set *task_css_set(struct task_struct *task)
667{ 722{
668 return task_subsys_state_check(task, subsys_id, false); 723 return task_css_set_check(task, false);
669} 724}
670 725
671static inline struct cgroup* task_cgroup(struct task_struct *task, 726/**
672 int subsys_id) 727 * task_css - obtain css for (task, subsys)
728 * @task: the target task
729 * @subsys_id: the target subsystem ID
730 *
731 * See task_css_check().
732 */
733static inline struct cgroup_subsys_state *task_css(struct task_struct *task,
734 int subsys_id)
735{
736 return task_css_check(task, subsys_id, false);
737}
738
739static inline struct cgroup *task_cgroup(struct task_struct *task,
740 int subsys_id)
673{ 741{
674 return task_subsys_state(task, subsys_id)->cgroup; 742 return task_css(task, subsys_id)->cgroup;
675} 743}
676 744
745struct cgroup_subsys_state *css_next_child(struct cgroup_subsys_state *pos,
746 struct cgroup_subsys_state *parent);
747
748struct cgroup_subsys_state *css_from_id(int id, struct cgroup_subsys *ss);
749
677/** 750/**
678 * cgroup_for_each_child - iterate through children of a cgroup 751 * css_for_each_child - iterate through children of a css
679 * @pos: the cgroup * to use as the loop cursor 752 * @pos: the css * to use as the loop cursor
680 * @cgroup: cgroup whose children to walk 753 * @parent: css whose children to walk
681 * 754 *
682 * Walk @cgroup's children. Must be called under rcu_read_lock(). A child 755 * Walk @parent's children. Must be called under rcu_read_lock(). A child
683 * cgroup which hasn't finished ->css_online() or already has finished 756 * css which hasn't finished ->css_online() or already has finished
684 * ->css_offline() may show up during traversal and it's each subsystem's 757 * ->css_offline() may show up during traversal and it's each subsystem's
685 * responsibility to verify that each @pos is alive. 758 * responsibility to verify that each @pos is alive.
686 * 759 *
687 * If a subsystem synchronizes against the parent in its ->css_online() and 760 * If a subsystem synchronizes against the parent in its ->css_online() and
688 * before starting iterating, a cgroup which finished ->css_online() is 761 * before starting iterating, a css which finished ->css_online() is
689 * guaranteed to be visible in the future iterations. 762 * guaranteed to be visible in the future iterations.
763 *
764 * It is allowed to temporarily drop RCU read lock during iteration. The
765 * caller is responsible for ensuring that @pos remains accessible until
766 * the start of the next iteration by, for example, bumping the css refcnt.
690 */ 767 */
691#define cgroup_for_each_child(pos, cgroup) \ 768#define css_for_each_child(pos, parent) \
692 list_for_each_entry_rcu(pos, &(cgroup)->children, sibling) 769 for ((pos) = css_next_child(NULL, (parent)); (pos); \
770 (pos) = css_next_child((pos), (parent)))
771
772struct cgroup_subsys_state *
773css_next_descendant_pre(struct cgroup_subsys_state *pos,
774 struct cgroup_subsys_state *css);
693 775
694struct cgroup *cgroup_next_descendant_pre(struct cgroup *pos, 776struct cgroup_subsys_state *
695 struct cgroup *cgroup); 777css_rightmost_descendant(struct cgroup_subsys_state *pos);
696struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos);
697 778
698/** 779/**
699 * cgroup_for_each_descendant_pre - pre-order walk of a cgroup's descendants 780 * css_for_each_descendant_pre - pre-order walk of a css's descendants
700 * @pos: the cgroup * to use as the loop cursor 781 * @pos: the css * to use as the loop cursor
701 * @cgroup: cgroup whose descendants to walk 782 * @root: css whose descendants to walk
702 * 783 *
703 * Walk @cgroup's descendants. Must be called under rcu_read_lock(). A 784 * Walk @root's descendants. @root is included in the iteration and the
704 * descendant cgroup which hasn't finished ->css_online() or already has 785 * first node to be visited. Must be called under rcu_read_lock(). A
786 * descendant css which hasn't finished ->css_online() or already has
705 * finished ->css_offline() may show up during traversal and it's each 787 * finished ->css_offline() may show up during traversal and it's each
706 * subsystem's responsibility to verify that each @pos is alive. 788 * subsystem's responsibility to verify that each @pos is alive.
707 * 789 *
708 * If a subsystem synchronizes against the parent in its ->css_online() and 790 * If a subsystem synchronizes against the parent in its ->css_online() and
709 * before starting iterating, and synchronizes against @pos on each 791 * before starting iterating, and synchronizes against @pos on each
710 * iteration, any descendant cgroup which finished ->css_online() is 792 * iteration, any descendant css which finished ->css_online() is
711 * guaranteed to be visible in the future iterations. 793 * guaranteed to be visible in the future iterations.
712 * 794 *
713 * In other words, the following guarantees that a descendant can't escape 795 * In other words, the following guarantees that a descendant can't escape
714 * state updates of its ancestors. 796 * state updates of its ancestors.
715 * 797 *
716 * my_online(@cgrp) 798 * my_online(@css)
717 * { 799 * {
718 * Lock @cgrp->parent and @cgrp; 800 * Lock @css's parent and @css;
719 * Inherit state from @cgrp->parent; 801 * Inherit state from the parent;
720 * Unlock both. 802 * Unlock both.
721 * } 803 * }
722 * 804 *
723 * my_update_state(@cgrp) 805 * my_update_state(@css)
724 * { 806 * {
725 * Lock @cgrp; 807 * css_for_each_descendant_pre(@pos, @css) {
726 * Update @cgrp's state;
727 * Unlock @cgrp;
728 *
729 * cgroup_for_each_descendant_pre(@pos, @cgrp) {
730 * Lock @pos; 808 * Lock @pos;
731 * Verify @pos is alive and inherit state from @pos->parent; 809 * if (@pos == @css)
810 * Update @css's state;
811 * else
812 * Verify @pos is alive and inherit state from its parent;
732 * Unlock @pos; 813 * Unlock @pos;
733 * } 814 * }
734 * } 815 * }
@@ -739,8 +820,7 @@ struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos);
739 * visible by walking order and, as long as inheriting operations to the 820 * visible by walking order and, as long as inheriting operations to the
740 * same @pos are atomic to each other, multiple updates racing each other 821 * same @pos are atomic to each other, multiple updates racing each other
741 * still result in the correct state. It's guaranateed that at least one 822 * still result in the correct state. It's guaranateed that at least one
742 * inheritance happens for any cgroup after the latest update to its 823 * inheritance happens for any css after the latest update to its parent.
743 * parent.
744 * 824 *
745 * If checking parent's state requires locking the parent, each inheriting 825 * If checking parent's state requires locking the parent, each inheriting
746 * iteration should lock and unlock both @pos->parent and @pos. 826 * iteration should lock and unlock both @pos->parent and @pos.
@@ -748,53 +828,50 @@ struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos);
748 * Alternatively, a subsystem may choose to use a single global lock to 828 * Alternatively, a subsystem may choose to use a single global lock to
749 * synchronize ->css_online() and ->css_offline() against tree-walking 829 * synchronize ->css_online() and ->css_offline() against tree-walking
750 * operations. 830 * operations.
831 *
832 * It is allowed to temporarily drop RCU read lock during iteration. The
833 * caller is responsible for ensuring that @pos remains accessible until
834 * the start of the next iteration by, for example, bumping the css refcnt.
751 */ 835 */
752#define cgroup_for_each_descendant_pre(pos, cgroup) \ 836#define css_for_each_descendant_pre(pos, css) \
753 for (pos = cgroup_next_descendant_pre(NULL, (cgroup)); (pos); \ 837 for ((pos) = css_next_descendant_pre(NULL, (css)); (pos); \
754 pos = cgroup_next_descendant_pre((pos), (cgroup))) 838 (pos) = css_next_descendant_pre((pos), (css)))
755 839
756struct cgroup *cgroup_next_descendant_post(struct cgroup *pos, 840struct cgroup_subsys_state *
757 struct cgroup *cgroup); 841css_next_descendant_post(struct cgroup_subsys_state *pos,
842 struct cgroup_subsys_state *css);
758 843
759/** 844/**
760 * cgroup_for_each_descendant_post - post-order walk of a cgroup's descendants 845 * css_for_each_descendant_post - post-order walk of a css's descendants
761 * @pos: the cgroup * to use as the loop cursor 846 * @pos: the css * to use as the loop cursor
762 * @cgroup: cgroup whose descendants to walk 847 * @css: css whose descendants to walk
763 * 848 *
764 * Similar to cgroup_for_each_descendant_pre() but performs post-order 849 * Similar to css_for_each_descendant_pre() but performs post-order
765 * traversal instead. Note that the walk visibility guarantee described in 850 * traversal instead. @root is included in the iteration and the last
766 * pre-order walk doesn't apply the same to post-order walks. 851 * node to be visited. Note that the walk visibility guarantee described
852 * in pre-order walk doesn't apply the same to post-order walks.
767 */ 853 */
768#define cgroup_for_each_descendant_post(pos, cgroup) \ 854#define css_for_each_descendant_post(pos, css) \
769 for (pos = cgroup_next_descendant_post(NULL, (cgroup)); (pos); \ 855 for ((pos) = css_next_descendant_post(NULL, (css)); (pos); \
770 pos = cgroup_next_descendant_post((pos), (cgroup))) 856 (pos) = css_next_descendant_post((pos), (css)))
771 857
772/* A cgroup_iter should be treated as an opaque object */ 858/* A css_task_iter should be treated as an opaque object */
773struct cgroup_iter { 859struct css_task_iter {
774 struct list_head *cg_link; 860 struct cgroup_subsys_state *origin_css;
775 struct list_head *task; 861 struct list_head *cset_link;
862 struct list_head *task;
776}; 863};
777 864
778/* 865void css_task_iter_start(struct cgroup_subsys_state *css,
779 * To iterate across the tasks in a cgroup: 866 struct css_task_iter *it);
780 * 867struct task_struct *css_task_iter_next(struct css_task_iter *it);
781 * 1) call cgroup_iter_start to initialize an iterator 868void css_task_iter_end(struct css_task_iter *it);
782 * 869
783 * 2) call cgroup_iter_next() to retrieve member tasks until it 870int css_scan_tasks(struct cgroup_subsys_state *css,
784 * returns NULL or until you want to end the iteration 871 bool (*test)(struct task_struct *, void *),
785 * 872 void (*process)(struct task_struct *, void *),
786 * 3) call cgroup_iter_end() to destroy the iterator. 873 void *data, struct ptr_heap *heap);
787 * 874
788 * Or, call cgroup_scan_tasks() to iterate through every task in a
789 * cgroup - cgroup_scan_tasks() holds the css_set_lock when calling
790 * the test_task() callback, but not while calling the process_task()
791 * callback.
792 */
793void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it);
794struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
795 struct cgroup_iter *it);
796void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
797int cgroup_scan_tasks(struct cgroup_scanner *scan);
798int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); 875int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
799int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); 876int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
800 877
@@ -827,8 +904,8 @@ bool css_is_ancestor(struct cgroup_subsys_state *cg,
827 904
828/* Get id and depth of css */ 905/* Get id and depth of css */
829unsigned short css_id(struct cgroup_subsys_state *css); 906unsigned short css_id(struct cgroup_subsys_state *css);
830unsigned short css_depth(struct cgroup_subsys_state *css); 907struct cgroup_subsys_state *css_from_dir(struct dentry *dentry,
831struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id); 908 struct cgroup_subsys *ss);
832 909
833#else /* !CONFIG_CGROUPS */ 910#else /* !CONFIG_CGROUPS */
834 911
@@ -838,8 +915,6 @@ static inline void cgroup_fork(struct task_struct *p) {}
838static inline void cgroup_post_fork(struct task_struct *p) {} 915static inline void cgroup_post_fork(struct task_struct *p) {}
839static inline void cgroup_exit(struct task_struct *p, int callbacks) {} 916static inline void cgroup_exit(struct task_struct *p, int callbacks) {}
840 917
841static inline void cgroup_lock(void) {}
842static inline void cgroup_unlock(void) {}
843static inline int cgroupstats_build(struct cgroupstats *stats, 918static inline int cgroupstats_build(struct cgroupstats *stats,
844 struct dentry *dentry) 919 struct dentry *dentry)
845{ 920{
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 6e7ec64b69ab..b613ffd402d1 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -1,86 +1,55 @@
1/* Add subsystem definitions of the form SUBSYS(<name>) in this 1/*
2 * file. Surround each one by a line of comment markers so that 2 * List of cgroup subsystems.
3 * patches don't collide 3 *
4 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS.
4 */ 5 */
5
6/* */
7
8/* */
9
10#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS) 6#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS)
11SUBSYS(cpuset) 7SUBSYS(cpuset)
12#endif 8#endif
13 9
14/* */
15
16#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG) 10#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG)
17SUBSYS(debug) 11SUBSYS(debug)
18#endif 12#endif
19 13
20/* */
21
22#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED) 14#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED)
23SUBSYS(cpu_cgroup) 15SUBSYS(cpu_cgroup)
24#endif 16#endif
25 17
26/* */
27
28#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT) 18#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT)
29SUBSYS(cpuacct) 19SUBSYS(cpuacct)
30#endif 20#endif
31 21
32/* */
33
34#if IS_SUBSYS_ENABLED(CONFIG_MEMCG) 22#if IS_SUBSYS_ENABLED(CONFIG_MEMCG)
35SUBSYS(mem_cgroup) 23SUBSYS(mem_cgroup)
36#endif 24#endif
37 25
38/* */
39
40#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE) 26#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE)
41SUBSYS(devices) 27SUBSYS(devices)
42#endif 28#endif
43 29
44/* */
45
46#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER) 30#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER)
47SUBSYS(freezer) 31SUBSYS(freezer)
48#endif 32#endif
49 33
50/* */
51
52#if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP) 34#if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP)
53SUBSYS(net_cls) 35SUBSYS(net_cls)
54#endif 36#endif
55 37
56/* */
57
58#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP) 38#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP)
59SUBSYS(blkio) 39SUBSYS(blkio)
60#endif 40#endif
61 41
62/* */
63
64#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF) 42#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF)
65SUBSYS(perf) 43SUBSYS(perf)
66#endif 44#endif
67 45
68/* */
69
70#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP) 46#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP)
71SUBSYS(net_prio) 47SUBSYS(net_prio)
72#endif 48#endif
73 49
74/* */
75
76#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB) 50#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB)
77SUBSYS(hugetlb) 51SUBSYS(hugetlb)
78#endif 52#endif
79 53/*
80/* */ 54 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS.
81 55 */
82#ifdef CONFIG_CGROUP_BCACHE
83SUBSYS(bcache)
84#endif
85
86/* */
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
index dd7adff76e81..8138c94409f3 100644
--- a/include/linux/clk-private.h
+++ b/include/linux/clk-private.h
@@ -33,8 +33,11 @@ struct clk {
33 const char **parent_names; 33 const char **parent_names;
34 struct clk **parents; 34 struct clk **parents;
35 u8 num_parents; 35 u8 num_parents;
36 u8 new_parent_index;
36 unsigned long rate; 37 unsigned long rate;
37 unsigned long new_rate; 38 unsigned long new_rate;
39 struct clk *new_parent;
40 struct clk *new_child;
38 unsigned long flags; 41 unsigned long flags;
39 unsigned int enable_count; 42 unsigned int enable_count;
40 unsigned int prepare_count; 43 unsigned int prepare_count;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 11860985fecb..73bdb69f0c08 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -12,6 +12,7 @@
12#define __LINUX_CLK_PROVIDER_H 12#define __LINUX_CLK_PROVIDER_H
13 13
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/io.h>
15 16
16#ifdef CONFIG_COMMON_CLK 17#ifdef CONFIG_COMMON_CLK
17 18
@@ -27,6 +28,7 @@
27#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */ 28#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */
28#define CLK_IS_BASIC BIT(5) /* Basic clk, can't do a to_clk_foo() */ 29#define CLK_IS_BASIC BIT(5) /* Basic clk, can't do a to_clk_foo() */
29#define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */ 30#define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */
31#define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */
30 32
31struct clk_hw; 33struct clk_hw;
32 34
@@ -79,6 +81,10 @@ struct clk_hw;
79 * @round_rate: Given a target rate as input, returns the closest rate actually 81 * @round_rate: Given a target rate as input, returns the closest rate actually
80 * supported by the clock. 82 * supported by the clock.
81 * 83 *
84 * @determine_rate: Given a target rate as input, returns the closest rate
85 * actually supported by the clock, and optionally the parent clock
86 * that should be used to provide the clock rate.
87 *
82 * @get_parent: Queries the hardware to determine the parent of a clock. The 88 * @get_parent: Queries the hardware to determine the parent of a clock. The
83 * return value is a u8 which specifies the index corresponding to 89 * return value is a u8 which specifies the index corresponding to
84 * the parent clock. This index can be applied to either the 90 * the parent clock. This index can be applied to either the
@@ -126,6 +132,9 @@ struct clk_ops {
126 unsigned long parent_rate); 132 unsigned long parent_rate);
127 long (*round_rate)(struct clk_hw *hw, unsigned long, 133 long (*round_rate)(struct clk_hw *hw, unsigned long,
128 unsigned long *); 134 unsigned long *);
135 long (*determine_rate)(struct clk_hw *hw, unsigned long rate,
136 unsigned long *best_parent_rate,
137 struct clk **best_parent_clk);
129 int (*set_parent)(struct clk_hw *hw, u8 index); 138 int (*set_parent)(struct clk_hw *hw, u8 index);
130 u8 (*get_parent)(struct clk_hw *hw); 139 u8 (*get_parent)(struct clk_hw *hw);
131 int (*set_rate)(struct clk_hw *hw, unsigned long, 140 int (*set_rate)(struct clk_hw *hw, unsigned long,
@@ -210,6 +219,10 @@ void of_fixed_clk_setup(struct device_node *np);
210 * CLK_GATE_SET_TO_DISABLE - by default this clock sets the bit at bit_idx to 219 * CLK_GATE_SET_TO_DISABLE - by default this clock sets the bit at bit_idx to
211 * enable the clock. Setting this flag does the opposite: setting the bit 220 * enable the clock. Setting this flag does the opposite: setting the bit
212 * disable the clock and clearing it enables the clock 221 * disable the clock and clearing it enables the clock
222 * CLK_GATE_HIWORD_MASK - The gate settings are only in lower 16-bit
223 * of this register, and mask of gate bits are in higher 16-bit of this
224 * register. While setting the gate bits, higher 16-bit should also be
225 * updated to indicate changing gate bits.
213 */ 226 */
214struct clk_gate { 227struct clk_gate {
215 struct clk_hw hw; 228 struct clk_hw hw;
@@ -220,6 +233,7 @@ struct clk_gate {
220}; 233};
221 234
222#define CLK_GATE_SET_TO_DISABLE BIT(0) 235#define CLK_GATE_SET_TO_DISABLE BIT(0)
236#define CLK_GATE_HIWORD_MASK BIT(1)
223 237
224extern const struct clk_ops clk_gate_ops; 238extern const struct clk_ops clk_gate_ops;
225struct clk *clk_register_gate(struct device *dev, const char *name, 239struct clk *clk_register_gate(struct device *dev, const char *name,
@@ -257,6 +271,10 @@ struct clk_div_table {
257 * Some hardware implementations gracefully handle this case and allow a 271 * Some hardware implementations gracefully handle this case and allow a
258 * zero divisor by not modifying their input clock 272 * zero divisor by not modifying their input clock
259 * (divide by one / bypass). 273 * (divide by one / bypass).
274 * CLK_DIVIDER_HIWORD_MASK - The divider settings are only in lower 16-bit
275 * of this register, and mask of divider bits are in higher 16-bit of this
276 * register. While setting the divider bits, higher 16-bit should also be
277 * updated to indicate changing divider bits.
260 */ 278 */
261struct clk_divider { 279struct clk_divider {
262 struct clk_hw hw; 280 struct clk_hw hw;
@@ -271,6 +289,7 @@ struct clk_divider {
271#define CLK_DIVIDER_ONE_BASED BIT(0) 289#define CLK_DIVIDER_ONE_BASED BIT(0)
272#define CLK_DIVIDER_POWER_OF_TWO BIT(1) 290#define CLK_DIVIDER_POWER_OF_TWO BIT(1)
273#define CLK_DIVIDER_ALLOW_ZERO BIT(2) 291#define CLK_DIVIDER_ALLOW_ZERO BIT(2)
292#define CLK_DIVIDER_HIWORD_MASK BIT(3)
274 293
275extern const struct clk_ops clk_divider_ops; 294extern const struct clk_ops clk_divider_ops;
276struct clk *clk_register_divider(struct device *dev, const char *name, 295struct clk *clk_register_divider(struct device *dev, const char *name,
@@ -299,6 +318,10 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name,
299 * Flags: 318 * Flags:
300 * CLK_MUX_INDEX_ONE - register index starts at 1, not 0 319 * CLK_MUX_INDEX_ONE - register index starts at 1, not 0
301 * CLK_MUX_INDEX_BIT - register index is a single bit (power of two) 320 * CLK_MUX_INDEX_BIT - register index is a single bit (power of two)
321 * CLK_MUX_HIWORD_MASK - The mux settings are only in lower 16-bit of this
322 * register, and mask of mux bits are in higher 16-bit of this register.
323 * While setting the mux bits, higher 16-bit should also be updated to
324 * indicate changing mux bits.
302 */ 325 */
303struct clk_mux { 326struct clk_mux {
304 struct clk_hw hw; 327 struct clk_hw hw;
@@ -312,8 +335,11 @@ struct clk_mux {
312 335
313#define CLK_MUX_INDEX_ONE BIT(0) 336#define CLK_MUX_INDEX_ONE BIT(0)
314#define CLK_MUX_INDEX_BIT BIT(1) 337#define CLK_MUX_INDEX_BIT BIT(1)
338#define CLK_MUX_HIWORD_MASK BIT(2)
339#define CLK_MUX_READ_ONLY BIT(3) /* mux setting cannot be changed */
315 340
316extern const struct clk_ops clk_mux_ops; 341extern const struct clk_ops clk_mux_ops;
342extern const struct clk_ops clk_mux_ro_ops;
317 343
318struct clk *clk_register_mux(struct device *dev, const char *name, 344struct clk *clk_register_mux(struct device *dev, const char *name,
319 const char **parent_names, u8 num_parents, unsigned long flags, 345 const char **parent_names, u8 num_parents, unsigned long flags,
@@ -403,6 +429,7 @@ const char *__clk_get_name(struct clk *clk);
403struct clk_hw *__clk_get_hw(struct clk *clk); 429struct clk_hw *__clk_get_hw(struct clk *clk);
404u8 __clk_get_num_parents(struct clk *clk); 430u8 __clk_get_num_parents(struct clk *clk);
405struct clk *__clk_get_parent(struct clk *clk); 431struct clk *__clk_get_parent(struct clk *clk);
432struct clk *clk_get_parent_by_index(struct clk *clk, u8 index);
406unsigned int __clk_get_enable_count(struct clk *clk); 433unsigned int __clk_get_enable_count(struct clk *clk);
407unsigned int __clk_get_prepare_count(struct clk *clk); 434unsigned int __clk_get_prepare_count(struct clk *clk);
408unsigned long __clk_get_rate(struct clk *clk); 435unsigned long __clk_get_rate(struct clk *clk);
@@ -410,6 +437,9 @@ unsigned long __clk_get_flags(struct clk *clk);
410bool __clk_is_prepared(struct clk *clk); 437bool __clk_is_prepared(struct clk *clk);
411bool __clk_is_enabled(struct clk *clk); 438bool __clk_is_enabled(struct clk *clk);
412struct clk *__clk_lookup(const char *name); 439struct clk *__clk_lookup(const char *name);
440long __clk_mux_determine_rate(struct clk_hw *hw, unsigned long rate,
441 unsigned long *best_parent_rate,
442 struct clk **best_parent_p);
413 443
414/* 444/*
415 * FIXME clock api without lock protection 445 * FIXME clock api without lock protection
@@ -423,6 +453,17 @@ struct of_device_id;
423 453
424typedef void (*of_clk_init_cb_t)(struct device_node *); 454typedef void (*of_clk_init_cb_t)(struct device_node *);
425 455
456struct clk_onecell_data {
457 struct clk **clks;
458 unsigned int clk_num;
459};
460
461#define CLK_OF_DECLARE(name, compat, fn) \
462 static const struct of_device_id __clk_of_table_##name \
463 __used __section(__clk_of_table) \
464 = { .compatible = compat, .data = fn };
465
466#ifdef CONFIG_OF
426int of_clk_add_provider(struct device_node *np, 467int of_clk_add_provider(struct device_node *np,
427 struct clk *(*clk_src_get)(struct of_phandle_args *args, 468 struct clk *(*clk_src_get)(struct of_phandle_args *args,
428 void *data), 469 void *data),
@@ -430,19 +471,55 @@ int of_clk_add_provider(struct device_node *np,
430void of_clk_del_provider(struct device_node *np); 471void of_clk_del_provider(struct device_node *np);
431struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, 472struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
432 void *data); 473 void *data);
433struct clk_onecell_data {
434 struct clk **clks;
435 unsigned int clk_num;
436};
437struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); 474struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
438const char *of_clk_get_parent_name(struct device_node *np, int index); 475const char *of_clk_get_parent_name(struct device_node *np, int index);
439 476
440void of_clk_init(const struct of_device_id *matches); 477void of_clk_init(const struct of_device_id *matches);
441 478
442#define CLK_OF_DECLARE(name, compat, fn) \ 479#else /* !CONFIG_OF */
443 static const struct of_device_id __clk_of_table_##name \ 480
444 __used __section(__clk_of_table) \ 481static inline int of_clk_add_provider(struct device_node *np,
445 = { .compatible = compat, .data = fn }; 482 struct clk *(*clk_src_get)(struct of_phandle_args *args,
483 void *data),
484 void *data)
485{
486 return 0;
487}
488#define of_clk_del_provider(np) \
489 { while (0); }
490static inline struct clk *of_clk_src_simple_get(
491 struct of_phandle_args *clkspec, void *data)
492{
493 return ERR_PTR(-ENOENT);
494}
495static inline struct clk *of_clk_src_onecell_get(
496 struct of_phandle_args *clkspec, void *data)
497{
498 return ERR_PTR(-ENOENT);
499}
500static inline const char *of_clk_get_parent_name(struct device_node *np,
501 int index)
502{
503 return NULL;
504}
505#define of_clk_init(matches) \
506 { while (0); }
507#endif /* CONFIG_OF */
508
509/*
510 * wrap access to peripherals in accessor routines
511 * for improved portability across platforms
512 */
513
514static inline u32 clk_readl(u32 __iomem *reg)
515{
516 return readl(reg);
517}
518
519static inline void clk_writel(u32 val, u32 __iomem *reg)
520{
521 writel(val, reg);
522}
446 523
447#endif /* CONFIG_COMMON_CLK */ 524#endif /* CONFIG_COMMON_CLK */
448#endif /* CLK_PROVIDER_H */ 525#endif /* CLK_PROVIDER_H */
diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h
index 642789baec74..23a0ceee831f 100644
--- a/include/linux/clk/tegra.h
+++ b/include/linux/clk/tegra.h
@@ -120,9 +120,13 @@ static inline void tegra_cpu_clock_resume(void)
120} 120}
121#endif 121#endif
122 122
123#ifdef CONFIG_ARCH_TEGRA
123void tegra_periph_reset_deassert(struct clk *c); 124void tegra_periph_reset_deassert(struct clk *c);
124void tegra_periph_reset_assert(struct clk *c); 125void tegra_periph_reset_assert(struct clk *c);
125void tegra_clocks_init(void); 126#else
127static inline void tegra_periph_reset_deassert(struct clk *c) {}
128static inline void tegra_periph_reset_assert(struct clk *c) {}
129#endif
126void tegra_clocks_apply_init_table(void); 130void tegra_clocks_apply_init_table(void);
127 131
128#endif /* __LINUX_CLK_TEGRA_H_ */ 132#endif /* __LINUX_CLK_TEGRA_H_ */
diff --git a/include/linux/clk/zynq.h b/include/linux/clk/zynq.h
index 56be7cd9aa8b..e062d317ccce 100644
--- a/include/linux/clk/zynq.h
+++ b/include/linux/clk/zynq.h
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (C) 2013 Xilinx Inc.
2 * Copyright (C) 2012 National Instruments 3 * Copyright (C) 2012 National Instruments
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
@@ -19,6 +20,11 @@
19#ifndef __LINUX_CLK_ZYNQ_H_ 20#ifndef __LINUX_CLK_ZYNQ_H_
20#define __LINUX_CLK_ZYNQ_H_ 21#define __LINUX_CLK_ZYNQ_H_
21 22
22void __init xilinx_zynq_clocks_init(void __iomem *slcr); 23#include <linux/spinlock.h>
23 24
25void zynq_clock_init(void __iomem *slcr);
26
27struct clk *clk_register_zynq_pll(const char *name, const char *parent,
28 void __iomem *pll_ctrl, void __iomem *pll_status, u8 lock_index,
29 spinlock_t *lock);
24#endif 30#endif
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 963d71431388..0857922e8ad0 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -30,6 +30,7 @@ enum clock_event_nofitiers {
30#include <linux/notifier.h> 30#include <linux/notifier.h>
31 31
32struct clock_event_device; 32struct clock_event_device;
33struct module;
33 34
34/* Clock event mode commands */ 35/* Clock event mode commands */
35enum clock_event_mode { 36enum clock_event_mode {
@@ -83,6 +84,7 @@ enum clock_event_mode {
83 * @irq: IRQ number (only for non CPU local devices) 84 * @irq: IRQ number (only for non CPU local devices)
84 * @cpumask: cpumask to indicate for which CPUs this device works 85 * @cpumask: cpumask to indicate for which CPUs this device works
85 * @list: list head for the management code 86 * @list: list head for the management code
87 * @owner: module reference
86 */ 88 */
87struct clock_event_device { 89struct clock_event_device {
88 void (*event_handler)(struct clock_event_device *); 90 void (*event_handler)(struct clock_event_device *);
@@ -112,6 +114,7 @@ struct clock_event_device {
112 int irq; 114 int irq;
113 const struct cpumask *cpumask; 115 const struct cpumask *cpumask;
114 struct list_head list; 116 struct list_head list;
117 struct module *owner;
115} ____cacheline_aligned; 118} ____cacheline_aligned;
116 119
117/* 120/*
@@ -138,6 +141,7 @@ static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec,
138extern u64 clockevent_delta2ns(unsigned long latch, 141extern u64 clockevent_delta2ns(unsigned long latch,
139 struct clock_event_device *evt); 142 struct clock_event_device *evt);
140extern void clockevents_register_device(struct clock_event_device *dev); 143extern void clockevents_register_device(struct clock_event_device *dev);
144extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu);
141 145
142extern void clockevents_config(struct clock_event_device *dev, u32 freq); 146extern void clockevents_config(struct clock_event_device *dev, u32 freq);
143extern void clockevents_config_and_register(struct clock_event_device *dev, 147extern void clockevents_config_and_register(struct clock_event_device *dev,
@@ -150,7 +154,6 @@ extern void clockevents_exchange_device(struct clock_event_device *old,
150 struct clock_event_device *new); 154 struct clock_event_device *new);
151extern void clockevents_set_mode(struct clock_event_device *dev, 155extern void clockevents_set_mode(struct clock_event_device *dev,
152 enum clock_event_mode mode); 156 enum clock_event_mode mode);
153extern int clockevents_register_notifier(struct notifier_block *nb);
154extern int clockevents_program_event(struct clock_event_device *dev, 157extern int clockevents_program_event(struct clock_event_device *dev,
155 ktime_t expires, bool force); 158 ktime_t expires, bool force);
156 159
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 7279b94c01da..dbbf8aa7731b 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -21,6 +21,7 @@
21/* clocksource cycle base type */ 21/* clocksource cycle base type */
22typedef u64 cycle_t; 22typedef u64 cycle_t;
23struct clocksource; 23struct clocksource;
24struct module;
24 25
25#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA 26#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA
26#include <asm/clocksource.h> 27#include <asm/clocksource.h>
@@ -162,6 +163,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
162 * @suspend: suspend function for the clocksource, if necessary 163 * @suspend: suspend function for the clocksource, if necessary
163 * @resume: resume function for the clocksource, if necessary 164 * @resume: resume function for the clocksource, if necessary
164 * @cycle_last: most recent cycle counter value seen by ::read() 165 * @cycle_last: most recent cycle counter value seen by ::read()
166 * @owner: module reference, must be set by clocksource in modules
165 */ 167 */
166struct clocksource { 168struct clocksource {
167 /* 169 /*
@@ -195,6 +197,7 @@ struct clocksource {
195 cycle_t cs_last; 197 cycle_t cs_last;
196 cycle_t wd_last; 198 cycle_t wd_last;
197#endif 199#endif
200 struct module *owner;
198} ____cacheline_aligned; 201} ____cacheline_aligned;
199 202
200/* 203/*
@@ -207,6 +210,7 @@ struct clocksource {
207#define CLOCK_SOURCE_VALID_FOR_HRES 0x20 210#define CLOCK_SOURCE_VALID_FOR_HRES 0x20
208#define CLOCK_SOURCE_UNSTABLE 0x40 211#define CLOCK_SOURCE_UNSTABLE 0x40
209#define CLOCK_SOURCE_SUSPEND_NONSTOP 0x80 212#define CLOCK_SOURCE_SUSPEND_NONSTOP 0x80
213#define CLOCK_SOURCE_RESELECT 0x100
210 214
211/* simplify initialization of mask field */ 215/* simplify initialization of mask field */
212#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) 216#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
@@ -279,7 +283,7 @@ static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
279 283
280 284
281extern int clocksource_register(struct clocksource*); 285extern int clocksource_register(struct clocksource*);
282extern void clocksource_unregister(struct clocksource*); 286extern int clocksource_unregister(struct clocksource*);
283extern void clocksource_touch_watchdog(void); 287extern void clocksource_touch_watchdog(void);
284extern struct clocksource* clocksource_get_next(void); 288extern struct clocksource* clocksource_get_next(void);
285extern void clocksource_change_rating(struct clocksource *cs, int rating); 289extern void clocksource_change_rating(struct clocksource *cs, int rating);
@@ -321,7 +325,7 @@ static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz)
321} 325}
322 326
323 327
324extern void timekeeping_notify(struct clocksource *clock); 328extern int timekeeping_notify(struct clocksource *clock);
325 329
326extern cycle_t clocksource_mmio_readl_up(struct clocksource *); 330extern cycle_t clocksource_mmio_readl_up(struct clocksource *);
327extern cycle_t clocksource_mmio_readl_down(struct clocksource *); 331extern cycle_t clocksource_mmio_readl_down(struct clocksource *);
diff --git a/include/linux/cmdline-parser.h b/include/linux/cmdline-parser.h
new file mode 100644
index 000000000000..98e892ef6d5a
--- /dev/null
+++ b/include/linux/cmdline-parser.h
@@ -0,0 +1,43 @@
1/*
2 * Parsing command line, get the partitions information.
3 *
4 * Written by Cai Zhiyong <caizhiyong@huawei.com>
5 *
6 */
7#ifndef CMDLINEPARSEH
8#define CMDLINEPARSEH
9
10#include <linux/blkdev.h>
11
12/* partition flags */
13#define PF_RDONLY 0x01 /* Device is read only */
14#define PF_POWERUP_LOCK 0x02 /* Always locked after reset */
15
16struct cmdline_subpart {
17 char name[BDEVNAME_SIZE]; /* partition name, such as 'rootfs' */
18 sector_t from;
19 sector_t size;
20 int flags;
21 struct cmdline_subpart *next_subpart;
22};
23
24struct cmdline_parts {
25 char name[BDEVNAME_SIZE]; /* block device, such as 'mmcblk0' */
26 unsigned int nr_subparts;
27 struct cmdline_subpart *subpart;
28 struct cmdline_parts *next_parts;
29};
30
31void cmdline_parts_free(struct cmdline_parts **parts);
32
33int cmdline_parts_parse(struct cmdline_parts **parts, const char *cmdline);
34
35struct cmdline_parts *cmdline_parts_find(struct cmdline_parts *parts,
36 const char *bdev);
37
38void cmdline_parts_set(struct cmdline_parts *parts, sector_t disk_size,
39 int slot,
40 int (*add_part)(int, struct cmdline_subpart *, void *),
41 void *param);
42
43#endif /* CMDLINEPARSEH */
diff --git a/include/linux/coda.h b/include/linux/coda.h
index cff544f81105..d30209b9cef8 100644
--- a/include/linux/coda.h
+++ b/include/linux/coda.h
@@ -60,7 +60,6 @@ Mellon the rights to redistribute these changes without encumbrance.
60 60
61#if defined(__linux__) 61#if defined(__linux__)
62typedef unsigned long long u_quad_t; 62typedef unsigned long long u_quad_t;
63#else
64#endif 63#endif
65#include <uapi/linux/coda.h> 64#include <uapi/linux/coda.h>
66#endif 65#endif
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 7f0c1dd09079..345da00a86e0 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -43,6 +43,7 @@
43#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ 43#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
44 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ 44 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
45 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ 45 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
46 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__));\
46 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\ 47 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\
47 { \ 48 { \
48 return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \ 49 return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \
@@ -669,6 +670,13 @@ asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
669 670
670int compat_restore_altstack(const compat_stack_t __user *uss); 671int compat_restore_altstack(const compat_stack_t __user *uss);
671int __compat_save_altstack(compat_stack_t __user *, unsigned long); 672int __compat_save_altstack(compat_stack_t __user *, unsigned long);
673#define compat_save_altstack_ex(uss, sp) do { \
674 compat_stack_t __user *__uss = uss; \
675 struct task_struct *t = current; \
676 put_user_ex(ptr_to_compat((void __user *)t->sas_ss_sp), &__uss->ss_sp); \
677 put_user_ex(sas_ss_flags(sp), &__uss->ss_flags); \
678 put_user_ex(t->sas_ss_size, &__uss->ss_size); \
679} while (0);
672 680
673asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, 681asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
674 struct compat_timespec __user *interval); 682 struct compat_timespec __user *interval);
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 33f0280fd533..3cd574d5b19e 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -5,7 +5,7 @@
5 * (C) Copyright 2001 Linus Torvalds 5 * (C) Copyright 2001 Linus Torvalds
6 * 6 *
7 * Atomic wait-for-completion handler data structures. 7 * Atomic wait-for-completion handler data structures.
8 * See kernel/sched.c for details. 8 * See kernel/sched/core.c for details.
9 */ 9 */
10 10
11#include <linux/wait.h> 11#include <linux/wait.h>
diff --git a/include/linux/console.h b/include/linux/console.h
index 73bab0f58af5..7571a16bd653 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -75,10 +75,7 @@ extern const struct consw newport_con; /* SGI Newport console */
75extern const struct consw prom_con; /* SPARC PROM console */ 75extern const struct consw prom_con; /* SPARC PROM console */
76 76
77int con_is_bound(const struct consw *csw); 77int con_is_bound(const struct consw *csw);
78int register_con_driver(const struct consw *csw, int first, int last);
79int unregister_con_driver(const struct consw *csw);
80int do_unregister_con_driver(const struct consw *csw); 78int do_unregister_con_driver(const struct consw *csw);
81int take_over_console(const struct consw *sw, int first, int last, int deflt);
82int do_take_over_console(const struct consw *sw, int first, int last, int deflt); 79int do_take_over_console(const struct consw *sw, int first, int last, int deflt);
83void give_up_console(const struct consw *sw); 80void give_up_console(const struct consw *sw);
84#ifdef CONFIG_HW_CONSOLE 81#ifdef CONFIG_HW_CONSOLE
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 365f4a61bf04..158158704c30 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -2,59 +2,59 @@
2#define _LINUX_CONTEXT_TRACKING_H 2#define _LINUX_CONTEXT_TRACKING_H
3 3
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/percpu.h> 5#include <linux/vtime.h>
6#include <linux/context_tracking_state.h>
6#include <asm/ptrace.h> 7#include <asm/ptrace.h>
7 8
8struct context_tracking {
9 /*
10 * When active is false, probes are unset in order
11 * to minimize overhead: TIF flags are cleared
12 * and calls to user_enter/exit are ignored. This
13 * may be further optimized using static keys.
14 */
15 bool active;
16 enum ctx_state {
17 IN_KERNEL = 0,
18 IN_USER,
19 } state;
20};
21 9
22#ifdef CONFIG_CONTEXT_TRACKING 10#ifdef CONFIG_CONTEXT_TRACKING
23DECLARE_PER_CPU(struct context_tracking, context_tracking); 11extern void context_tracking_cpu_set(int cpu);
24 12
25static inline bool context_tracking_in_user(void) 13extern void context_tracking_user_enter(void);
14extern void context_tracking_user_exit(void);
15extern void __context_tracking_task_switch(struct task_struct *prev,
16 struct task_struct *next);
17
18static inline void user_enter(void)
26{ 19{
27 return __this_cpu_read(context_tracking.state) == IN_USER; 20 if (static_key_false(&context_tracking_enabled))
28} 21 context_tracking_user_enter();
29 22
30static inline bool context_tracking_active(void) 23}
24static inline void user_exit(void)
31{ 25{
32 return __this_cpu_read(context_tracking.active); 26 if (static_key_false(&context_tracking_enabled))
27 context_tracking_user_exit();
33} 28}
34 29
35extern void user_enter(void);
36extern void user_exit(void);
37
38static inline enum ctx_state exception_enter(void) 30static inline enum ctx_state exception_enter(void)
39{ 31{
40 enum ctx_state prev_ctx; 32 enum ctx_state prev_ctx;
41 33
34 if (!static_key_false(&context_tracking_enabled))
35 return 0;
36
42 prev_ctx = this_cpu_read(context_tracking.state); 37 prev_ctx = this_cpu_read(context_tracking.state);
43 user_exit(); 38 context_tracking_user_exit();
44 39
45 return prev_ctx; 40 return prev_ctx;
46} 41}
47 42
48static inline void exception_exit(enum ctx_state prev_ctx) 43static inline void exception_exit(enum ctx_state prev_ctx)
49{ 44{
50 if (prev_ctx == IN_USER) 45 if (static_key_false(&context_tracking_enabled)) {
51 user_enter(); 46 if (prev_ctx == IN_USER)
47 context_tracking_user_enter();
48 }
52} 49}
53 50
54extern void context_tracking_task_switch(struct task_struct *prev, 51static inline void context_tracking_task_switch(struct task_struct *prev,
55 struct task_struct *next); 52 struct task_struct *next)
53{
54 if (static_key_false(&context_tracking_enabled))
55 __context_tracking_task_switch(prev, next);
56}
56#else 57#else
57static inline bool context_tracking_in_user(void) { return false; }
58static inline void user_enter(void) { } 58static inline void user_enter(void) { }
59static inline void user_exit(void) { } 59static inline void user_exit(void) { }
60static inline enum ctx_state exception_enter(void) { return 0; } 60static inline enum ctx_state exception_enter(void) { return 0; }
@@ -63,4 +63,49 @@ static inline void context_tracking_task_switch(struct task_struct *prev,
63 struct task_struct *next) { } 63 struct task_struct *next) { }
64#endif /* !CONFIG_CONTEXT_TRACKING */ 64#endif /* !CONFIG_CONTEXT_TRACKING */
65 65
66
67#ifdef CONFIG_CONTEXT_TRACKING_FORCE
68extern void context_tracking_init(void);
69#else
70static inline void context_tracking_init(void) { }
71#endif /* CONFIG_CONTEXT_TRACKING_FORCE */
72
73
74#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
75static inline void guest_enter(void)
76{
77 if (vtime_accounting_enabled())
78 vtime_guest_enter(current);
79 else
80 current->flags |= PF_VCPU;
81}
82
83static inline void guest_exit(void)
84{
85 if (vtime_accounting_enabled())
86 vtime_guest_exit(current);
87 else
88 current->flags &= ~PF_VCPU;
89}
90
91#else
92static inline void guest_enter(void)
93{
94 /*
95 * This is running in ioctl context so its safe
96 * to assume that it's the stime pending cputime
97 * to flush.
98 */
99 vtime_account_system(current);
100 current->flags |= PF_VCPU;
101}
102
103static inline void guest_exit(void)
104{
105 /* Flush the guest cputime we spent on the guest */
106 vtime_account_system(current);
107 current->flags &= ~PF_VCPU;
108}
109#endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */
110
66#endif 111#endif
diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
new file mode 100644
index 000000000000..0f1979d0674f
--- /dev/null
+++ b/include/linux/context_tracking_state.h
@@ -0,0 +1,39 @@
1#ifndef _LINUX_CONTEXT_TRACKING_STATE_H
2#define _LINUX_CONTEXT_TRACKING_STATE_H
3
4#include <linux/percpu.h>
5#include <linux/static_key.h>
6
7struct context_tracking {
8 /*
9 * When active is false, probes are unset in order
10 * to minimize overhead: TIF flags are cleared
11 * and calls to user_enter/exit are ignored. This
12 * may be further optimized using static keys.
13 */
14 bool active;
15 enum ctx_state {
16 IN_KERNEL = 0,
17 IN_USER,
18 } state;
19};
20
21#ifdef CONFIG_CONTEXT_TRACKING
22extern struct static_key context_tracking_enabled;
23DECLARE_PER_CPU(struct context_tracking, context_tracking);
24
25static inline bool context_tracking_in_user(void)
26{
27 return __this_cpu_read(context_tracking.state) == IN_USER;
28}
29
30static inline bool context_tracking_active(void)
31{
32 return __this_cpu_read(context_tracking.active);
33}
34#else
35static inline bool context_tracking_in_user(void) { return false; }
36static inline bool context_tracking_active(void) { return false; }
37#endif /* CONFIG_CONTEXT_TRACKING */
38
39#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index c6f6e0839b61..801ff9e73679 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -6,9 +6,8 @@
6 * definitions of processors. 6 * definitions of processors.
7 * 7 *
8 * Basic handling of the devices is done in drivers/base/cpu.c 8 * Basic handling of the devices is done in drivers/base/cpu.c
9 * and system devices are handled in drivers/base/sys.c.
10 * 9 *
11 * CPUs are exported via sysfs in the class/cpu/devices/ 10 * CPUs are exported via sysfs in the devices/system/cpu
12 * directory. 11 * directory.
13 */ 12 */
14#ifndef _LINUX_CPU_H_ 13#ifndef _LINUX_CPU_H_
@@ -29,6 +28,7 @@ struct cpu {
29extern int register_cpu(struct cpu *cpu, int num); 28extern int register_cpu(struct cpu *cpu, int num);
30extern struct device *get_cpu_device(unsigned cpu); 29extern struct device *get_cpu_device(unsigned cpu);
31extern bool cpu_is_hotpluggable(unsigned cpu); 30extern bool cpu_is_hotpluggable(unsigned cpu);
31extern bool arch_match_cpu_phys_id(int cpu, u64 phys_id);
32 32
33extern int cpu_add_dev_attr(struct device_attribute *attr); 33extern int cpu_add_dev_attr(struct device_attribute *attr);
34extern void cpu_remove_dev_attr(struct device_attribute *attr); 34extern void cpu_remove_dev_attr(struct device_attribute *attr);
@@ -115,7 +115,7 @@ enum {
115/* Need to know about CPUs going up/down? */ 115/* Need to know about CPUs going up/down? */
116#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) 116#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE)
117#define cpu_notifier(fn, pri) { \ 117#define cpu_notifier(fn, pri) { \
118 static struct notifier_block fn##_nb __cpuinitdata = \ 118 static struct notifier_block fn##_nb = \
119 { .notifier_call = fn, .priority = pri }; \ 119 { .notifier_call = fn, .priority = pri }; \
120 register_cpu_notifier(&fn##_nb); \ 120 register_cpu_notifier(&fn##_nb); \
121} 121}
@@ -173,8 +173,12 @@ extern struct bus_type cpu_subsys;
173#ifdef CONFIG_HOTPLUG_CPU 173#ifdef CONFIG_HOTPLUG_CPU
174/* Stop CPUs going up and down. */ 174/* Stop CPUs going up and down. */
175 175
176extern void cpu_hotplug_begin(void);
177extern void cpu_hotplug_done(void);
176extern void get_online_cpus(void); 178extern void get_online_cpus(void);
177extern void put_online_cpus(void); 179extern void put_online_cpus(void);
180extern void cpu_hotplug_disable(void);
181extern void cpu_hotplug_enable(void);
178#define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri) 182#define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri)
179#define register_hotcpu_notifier(nb) register_cpu_notifier(nb) 183#define register_hotcpu_notifier(nb) register_cpu_notifier(nb)
180#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) 184#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
@@ -196,8 +200,12 @@ static inline void cpu_hotplug_driver_unlock(void)
196 200
197#else /* CONFIG_HOTPLUG_CPU */ 201#else /* CONFIG_HOTPLUG_CPU */
198 202
203static inline void cpu_hotplug_begin(void) {}
204static inline void cpu_hotplug_done(void) {}
199#define get_online_cpus() do { } while (0) 205#define get_online_cpus() do { } while (0)
200#define put_online_cpus() do { } while (0) 206#define put_online_cpus() do { } while (0)
207#define cpu_hotplug_disable() do { } while (0)
208#define cpu_hotplug_enable() do { } while (0)
201#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0) 209#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
202/* These aren't inline functions due to a GCC bug. */ 210/* These aren't inline functions due to a GCC bug. */
203#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; }) 211#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h
index 282e27028418..a5d52eea8232 100644
--- a/include/linux/cpu_cooling.h
+++ b/include/linux/cpu_cooling.h
@@ -41,7 +41,7 @@ cpufreq_cooling_register(const struct cpumask *clip_cpus);
41 */ 41 */
42void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); 42void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
43 43
44unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int); 44unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq);
45#else /* !CONFIG_CPU_THERMAL */ 45#else /* !CONFIG_CPU_THERMAL */
46static inline struct thermal_cooling_device * 46static inline struct thermal_cooling_device *
47cpufreq_cooling_register(const struct cpumask *clip_cpus) 47cpufreq_cooling_register(const struct cpumask *clip_cpus)
@@ -54,7 +54,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
54 return; 54 return;
55} 55}
56static inline 56static inline
57unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int) 57unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq)
58{ 58{
59 return THERMAL_CSTATE_INVALID; 59 return THERMAL_CSTATE_INVALID;
60} 60}
diff --git a/include/linux/cpu_rmap.h b/include/linux/cpu_rmap.h
index 1739510d8994..bdd18caa6c94 100644
--- a/include/linux/cpu_rmap.h
+++ b/include/linux/cpu_rmap.h
@@ -52,8 +52,6 @@ static inline void *cpu_rmap_lookup_obj(struct cpu_rmap *rmap, unsigned int cpu)
52 return rmap->obj[rmap->near[cpu].index]; 52 return rmap->obj[rmap->near[cpu].index];
53} 53}
54 54
55#ifdef CONFIG_GENERIC_HARDIRQS
56
57/** 55/**
58 * alloc_irq_cpu_rmap - allocate CPU affinity reverse-map for IRQs 56 * alloc_irq_cpu_rmap - allocate CPU affinity reverse-map for IRQs
59 * @size: Number of objects to be mapped 57 * @size: Number of objects to be mapped
@@ -68,5 +66,4 @@ extern void free_irq_cpu_rmap(struct cpu_rmap *rmap);
68 66
69extern int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq); 67extern int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq);
70 68
71#endif
72#endif /* __LINUX_CPU_RMAP_H */ 69#endif /* __LINUX_CPU_RMAP_H */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 037d36ae63e5..fcabc42d66ab 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * linux/include/linux/cpufreq.h 2 * linux/include/linux/cpufreq.h
3 * 3 *
4 * Copyright (C) 2001 Russell King 4 * Copyright (C) 2001 Russell King
5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> 5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -11,68 +11,36 @@
11#ifndef _LINUX_CPUFREQ_H 11#ifndef _LINUX_CPUFREQ_H
12#define _LINUX_CPUFREQ_H 12#define _LINUX_CPUFREQ_H
13 13
14#include <asm/cputime.h> 14#include <linux/cpumask.h>
15#include <linux/mutex.h> 15#include <linux/completion.h>
16#include <linux/notifier.h>
17#include <linux/threads.h>
18#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/notifier.h>
19#include <linux/sysfs.h> 18#include <linux/sysfs.h>
20#include <linux/completion.h>
21#include <linux/workqueue.h>
22#include <linux/cpumask.h>
23#include <asm/div64.h>
24
25#define CPUFREQ_NAME_LEN 16
26/* Print length for names. Extra 1 space for accomodating '\n' in prints */
27#define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1)
28
29 19
30/********************************************************************* 20/*********************************************************************
31 * CPUFREQ NOTIFIER INTERFACE * 21 * CPUFREQ INTERFACE *
32 *********************************************************************/ 22 *********************************************************************/
33 23/*
34#define CPUFREQ_TRANSITION_NOTIFIER (0) 24 * Frequency values here are CPU kHz
35#define CPUFREQ_POLICY_NOTIFIER (1) 25 *
36
37#ifdef CONFIG_CPU_FREQ
38int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
39int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
40extern void disable_cpufreq(void);
41#else /* CONFIG_CPU_FREQ */
42static inline int cpufreq_register_notifier(struct notifier_block *nb,
43 unsigned int list)
44{
45 return 0;
46}
47static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
48 unsigned int list)
49{
50 return 0;
51}
52static inline void disable_cpufreq(void) { }
53#endif /* CONFIG_CPU_FREQ */
54
55/* if (cpufreq_driver->target) exists, the ->governor decides what frequency
56 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these
57 * two generic policies are available:
58 */
59
60#define CPUFREQ_POLICY_POWERSAVE (1)
61#define CPUFREQ_POLICY_PERFORMANCE (2)
62
63/* Frequency values here are CPU kHz so that hardware which doesn't run
64 * with some frequencies can complain without having to guess what per
65 * cent / per mille means.
66 * Maximum transition latency is in nanoseconds - if it's unknown, 26 * Maximum transition latency is in nanoseconds - if it's unknown,
67 * CPUFREQ_ETERNAL shall be used. 27 * CPUFREQ_ETERNAL shall be used.
68 */ 28 */
69 29
30#define CPUFREQ_ETERNAL (-1)
31#define CPUFREQ_NAME_LEN 16
32/* Print length for names. Extra 1 space for accomodating '\n' in prints */
33#define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1)
34
70struct cpufreq_governor; 35struct cpufreq_governor;
71 36
72/* /sys/devices/system/cpu/cpufreq: entry point for global variables */ 37struct cpufreq_freqs {
73extern struct kobject *cpufreq_global_kobject; 38 unsigned int cpu; /* cpu nr */
39 unsigned int old;
40 unsigned int new;
41 u8 flags; /* flags of cpufreq_driver, see below. */
42};
74 43
75#define CPUFREQ_ETERNAL (-1)
76struct cpufreq_cpuinfo { 44struct cpufreq_cpuinfo {
77 unsigned int max_freq; 45 unsigned int max_freq;
78 unsigned int min_freq; 46 unsigned int min_freq;
@@ -107,129 +75,109 @@ struct cpufreq_policy {
107 unsigned int policy; /* see above */ 75 unsigned int policy; /* see above */
108 struct cpufreq_governor *governor; /* see below */ 76 struct cpufreq_governor *governor; /* see below */
109 void *governor_data; 77 void *governor_data;
78 bool governor_enabled; /* governor start/stop flag */
110 79
111 struct work_struct update; /* if update_policy() needs to be 80 struct work_struct update; /* if update_policy() needs to be
112 * called, but you're in IRQ context */ 81 * called, but you're in IRQ context */
113 82
114 struct cpufreq_real_policy user_policy; 83 struct cpufreq_real_policy user_policy;
115 84
85 struct list_head policy_list;
116 struct kobject kobj; 86 struct kobject kobj;
117 struct completion kobj_unregister; 87 struct completion kobj_unregister;
118}; 88};
119 89
120#define CPUFREQ_ADJUST (0)
121#define CPUFREQ_INCOMPATIBLE (1)
122#define CPUFREQ_NOTIFY (2)
123#define CPUFREQ_START (3)
124#define CPUFREQ_UPDATE_POLICY_CPU (4)
125
126/* Only for ACPI */ 90/* Only for ACPI */
127#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */ 91#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
128#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */ 92#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */
129#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */ 93#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */
130#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/ 94#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/
131 95
96struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
97void cpufreq_cpu_put(struct cpufreq_policy *policy);
98
132static inline bool policy_is_shared(struct cpufreq_policy *policy) 99static inline bool policy_is_shared(struct cpufreq_policy *policy)
133{ 100{
134 return cpumask_weight(policy->cpus) > 1; 101 return cpumask_weight(policy->cpus) > 1;
135} 102}
136 103
137/******************** cpufreq transition notifiers *******************/ 104/* /sys/devices/system/cpu/cpufreq: entry point for global variables */
138 105extern struct kobject *cpufreq_global_kobject;
139#define CPUFREQ_PRECHANGE (0) 106int cpufreq_get_global_kobject(void);
140#define CPUFREQ_POSTCHANGE (1) 107void cpufreq_put_global_kobject(void);
141#define CPUFREQ_RESUMECHANGE (8) 108int cpufreq_sysfs_create_file(const struct attribute *attr);
142#define CPUFREQ_SUSPENDCHANGE (9) 109void cpufreq_sysfs_remove_file(const struct attribute *attr);
143
144struct cpufreq_freqs {
145 unsigned int cpu; /* cpu nr */
146 unsigned int old;
147 unsigned int new;
148 u8 flags; /* flags of cpufreq_driver, see below. */
149};
150 110
111#ifdef CONFIG_CPU_FREQ
112unsigned int cpufreq_get(unsigned int cpu);
113unsigned int cpufreq_quick_get(unsigned int cpu);
114unsigned int cpufreq_quick_get_max(unsigned int cpu);
115void disable_cpufreq(void);
151 116
152/** 117u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);
153 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch safe) 118int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
154 * @old: old value 119int cpufreq_update_policy(unsigned int cpu);
155 * @div: divisor 120bool have_governor_per_policy(void);
156 * @mult: multiplier 121struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
157 * 122#else
158 * 123static inline unsigned int cpufreq_get(unsigned int cpu)
159 * new = old * mult / div
160 */
161static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mult)
162{ 124{
163#if BITS_PER_LONG == 32 125 return 0;
164 126}
165 u64 result = ((u64) old) * ((u64) mult); 127static inline unsigned int cpufreq_quick_get(unsigned int cpu)
166 do_div(result, div); 128{
167 return (unsigned long) result; 129 return 0;
168 130}
169#elif BITS_PER_LONG == 64 131static inline unsigned int cpufreq_quick_get_max(unsigned int cpu)
170 132{
171 unsigned long result = old * ((u64) mult); 133 return 0;
172 result /= div; 134}
173 return result; 135static inline void disable_cpufreq(void) { }
174
175#endif 136#endif
176};
177 137
178/********************************************************************* 138/*********************************************************************
179 * CPUFREQ GOVERNORS * 139 * CPUFREQ DRIVER INTERFACE *
180 *********************************************************************/ 140 *********************************************************************/
181 141
182#define CPUFREQ_GOV_START 1 142#define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */
183#define CPUFREQ_GOV_STOP 2 143#define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */
184#define CPUFREQ_GOV_LIMITS 3
185#define CPUFREQ_GOV_POLICY_INIT 4
186#define CPUFREQ_GOV_POLICY_EXIT 5
187 144
188struct cpufreq_governor { 145struct freq_attr {
189 char name[CPUFREQ_NAME_LEN]; 146 struct attribute attr;
190 int initialized; 147 ssize_t (*show)(struct cpufreq_policy *, char *);
191 int (*governor) (struct cpufreq_policy *policy, 148 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count);
192 unsigned int event);
193 ssize_t (*show_setspeed) (struct cpufreq_policy *policy,
194 char *buf);
195 int (*store_setspeed) (struct cpufreq_policy *policy,
196 unsigned int freq);
197 unsigned int max_transition_latency; /* HW must be able to switch to
198 next freq faster than this value in nano secs or we
199 will fallback to performance governor */
200 struct list_head governor_list;
201 struct module *owner;
202}; 149};
203 150
204/* 151#define cpufreq_freq_attr_ro(_name) \
205 * Pass a target to the cpufreq driver. 152static struct freq_attr _name = \
206 */ 153__ATTR(_name, 0444, show_##_name, NULL)
207extern int cpufreq_driver_target(struct cpufreq_policy *policy,
208 unsigned int target_freq,
209 unsigned int relation);
210extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
211 unsigned int target_freq,
212 unsigned int relation);
213
214 154
215extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy, 155#define cpufreq_freq_attr_ro_perm(_name, _perm) \
216 unsigned int cpu); 156static struct freq_attr _name = \
157__ATTR(_name, _perm, show_##_name, NULL)
217 158
218int cpufreq_register_governor(struct cpufreq_governor *governor); 159#define cpufreq_freq_attr_rw(_name) \
219void cpufreq_unregister_governor(struct cpufreq_governor *governor); 160static struct freq_attr _name = \
161__ATTR(_name, 0644, show_##_name, store_##_name)
220 162
163struct global_attr {
164 struct attribute attr;
165 ssize_t (*show)(struct kobject *kobj,
166 struct attribute *attr, char *buf);
167 ssize_t (*store)(struct kobject *a, struct attribute *b,
168 const char *c, size_t count);
169};
221 170
222/********************************************************************* 171#define define_one_global_ro(_name) \
223 * CPUFREQ DRIVER INTERFACE * 172static struct global_attr _name = \
224 *********************************************************************/ 173__ATTR(_name, 0444, show_##_name, NULL)
225 174
226#define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */ 175#define define_one_global_rw(_name) \
227#define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */ 176static struct global_attr _name = \
177__ATTR(_name, 0644, show_##_name, store_##_name)
228 178
229struct freq_attr;
230 179
231struct cpufreq_driver { 180struct cpufreq_driver {
232 struct module *owner;
233 char name[CPUFREQ_NAME_LEN]; 181 char name[CPUFREQ_NAME_LEN];
234 u8 flags; 182 u8 flags;
235 /* 183 /*
@@ -254,8 +202,6 @@ struct cpufreq_driver {
254 unsigned int (*get) (unsigned int cpu); 202 unsigned int (*get) (unsigned int cpu);
255 203
256 /* optional */ 204 /* optional */
257 unsigned int (*getavg) (struct cpufreq_policy *policy,
258 unsigned int cpu);
259 int (*bios_limit) (int cpu, unsigned int *limit); 205 int (*bios_limit) (int cpu, unsigned int *limit);
260 206
261 int (*exit) (struct cpufreq_policy *policy); 207 int (*exit) (struct cpufreq_policy *policy);
@@ -265,7 +211,6 @@ struct cpufreq_driver {
265}; 211};
266 212
267/* flags */ 213/* flags */
268
269#define CPUFREQ_STICKY 0x01 /* the driver isn't removed even if 214#define CPUFREQ_STICKY 0x01 /* the driver isn't removed even if
270 * all ->init() calls failed */ 215 * all ->init() calls failed */
271#define CPUFREQ_CONST_LOOPS 0x02 /* loops_per_jiffy or other kernel 216#define CPUFREQ_CONST_LOOPS 0x02 /* loops_per_jiffy or other kernel
@@ -277,11 +222,10 @@ struct cpufreq_driver {
277int cpufreq_register_driver(struct cpufreq_driver *driver_data); 222int cpufreq_register_driver(struct cpufreq_driver *driver_data);
278int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); 223int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
279 224
225const char *cpufreq_get_current_driver(void);
280 226
281void cpufreq_notify_transition(struct cpufreq_policy *policy, 227static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
282 struct cpufreq_freqs *freqs, unsigned int state); 228 unsigned int min, unsigned int max)
283
284static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max)
285{ 229{
286 if (policy->min < min) 230 if (policy->min < min)
287 policy->min = min; 231 policy->min = min;
@@ -296,86 +240,121 @@ static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, u
296 return; 240 return;
297} 241}
298 242
299struct freq_attr { 243/*********************************************************************
300 struct attribute attr; 244 * CPUFREQ NOTIFIER INTERFACE *
301 ssize_t (*show)(struct cpufreq_policy *, char *); 245 *********************************************************************/
302 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count);
303};
304
305#define cpufreq_freq_attr_ro(_name) \
306static struct freq_attr _name = \
307__ATTR(_name, 0444, show_##_name, NULL)
308
309#define cpufreq_freq_attr_ro_perm(_name, _perm) \
310static struct freq_attr _name = \
311__ATTR(_name, _perm, show_##_name, NULL)
312
313#define cpufreq_freq_attr_rw(_name) \
314static struct freq_attr _name = \
315__ATTR(_name, 0644, show_##_name, store_##_name)
316 246
317struct global_attr { 247#define CPUFREQ_TRANSITION_NOTIFIER (0)
318 struct attribute attr; 248#define CPUFREQ_POLICY_NOTIFIER (1)
319 ssize_t (*show)(struct kobject *kobj,
320 struct attribute *attr, char *buf);
321 ssize_t (*store)(struct kobject *a, struct attribute *b,
322 const char *c, size_t count);
323};
324 249
325#define define_one_global_ro(_name) \ 250/* Transition notifiers */
326static struct global_attr _name = \ 251#define CPUFREQ_PRECHANGE (0)
327__ATTR(_name, 0444, show_##_name, NULL) 252#define CPUFREQ_POSTCHANGE (1)
253#define CPUFREQ_RESUMECHANGE (8)
254#define CPUFREQ_SUSPENDCHANGE (9)
328 255
329#define define_one_global_rw(_name) \ 256/* Policy Notifiers */
330static struct global_attr _name = \ 257#define CPUFREQ_ADJUST (0)
331__ATTR(_name, 0644, show_##_name, store_##_name) 258#define CPUFREQ_INCOMPATIBLE (1)
259#define CPUFREQ_NOTIFY (2)
260#define CPUFREQ_START (3)
261#define CPUFREQ_UPDATE_POLICY_CPU (4)
332 262
333struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu); 263#ifdef CONFIG_CPU_FREQ
334void cpufreq_cpu_put(struct cpufreq_policy *data); 264int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
335const char *cpufreq_get_current_driver(void); 265int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
336 266
337/********************************************************************* 267void cpufreq_notify_transition(struct cpufreq_policy *policy,
338 * CPUFREQ 2.6. INTERFACE * 268 struct cpufreq_freqs *freqs, unsigned int state);
339 *********************************************************************/
340int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
341int cpufreq_update_policy(unsigned int cpu);
342bool have_governor_per_policy(void);
343 269
344#ifdef CONFIG_CPU_FREQ 270#else /* CONFIG_CPU_FREQ */
345/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ 271static inline int cpufreq_register_notifier(struct notifier_block *nb,
346unsigned int cpufreq_get(unsigned int cpu); 272 unsigned int list)
347#else
348static inline unsigned int cpufreq_get(unsigned int cpu)
349{ 273{
350 return 0; 274 return 0;
351} 275}
352#endif 276static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
353 277 unsigned int list)
354/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */
355#ifdef CONFIG_CPU_FREQ
356unsigned int cpufreq_quick_get(unsigned int cpu);
357unsigned int cpufreq_quick_get_max(unsigned int cpu);
358#else
359static inline unsigned int cpufreq_quick_get(unsigned int cpu)
360{ 278{
361 return 0; 279 return 0;
362} 280}
363static inline unsigned int cpufreq_quick_get_max(unsigned int cpu) 281#endif /* !CONFIG_CPU_FREQ */
282
283/**
284 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch
285 * safe)
286 * @old: old value
287 * @div: divisor
288 * @mult: multiplier
289 *
290 *
291 * new = old * mult / div
292 */
293static inline unsigned long cpufreq_scale(unsigned long old, u_int div,
294 u_int mult)
364{ 295{
365 return 0; 296#if BITS_PER_LONG == 32
366} 297 u64 result = ((u64) old) * ((u64) mult);
367#endif 298 do_div(result, div);
299 return (unsigned long) result;
368 300
301#elif BITS_PER_LONG == 64
302 unsigned long result = old * ((u64) mult);
303 result /= div;
304 return result;
305#endif
306}
369 307
370/********************************************************************* 308/*********************************************************************
371 * CPUFREQ DEFAULT GOVERNOR * 309 * CPUFREQ GOVERNORS *
372 *********************************************************************/ 310 *********************************************************************/
373 311
312/*
313 * If (cpufreq_driver->target) exists, the ->governor decides what frequency
314 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these
315 * two generic policies are available:
316 */
317#define CPUFREQ_POLICY_POWERSAVE (1)
318#define CPUFREQ_POLICY_PERFORMANCE (2)
319
320/* Governor Events */
321#define CPUFREQ_GOV_START 1
322#define CPUFREQ_GOV_STOP 2
323#define CPUFREQ_GOV_LIMITS 3
324#define CPUFREQ_GOV_POLICY_INIT 4
325#define CPUFREQ_GOV_POLICY_EXIT 5
326
327struct cpufreq_governor {
328 char name[CPUFREQ_NAME_LEN];
329 int initialized;
330 int (*governor) (struct cpufreq_policy *policy,
331 unsigned int event);
332 ssize_t (*show_setspeed) (struct cpufreq_policy *policy,
333 char *buf);
334 int (*store_setspeed) (struct cpufreq_policy *policy,
335 unsigned int freq);
336 unsigned int max_transition_latency; /* HW must be able to switch to
337 next freq faster than this value in nano secs or we
338 will fallback to performance governor */
339 struct list_head governor_list;
340 struct module *owner;
341};
374 342
343/* Pass a target to the cpufreq driver */
344int cpufreq_driver_target(struct cpufreq_policy *policy,
345 unsigned int target_freq,
346 unsigned int relation);
347int __cpufreq_driver_target(struct cpufreq_policy *policy,
348 unsigned int target_freq,
349 unsigned int relation);
350int cpufreq_register_governor(struct cpufreq_governor *governor);
351void cpufreq_unregister_governor(struct cpufreq_governor *governor);
352
353/* CPUFREQ DEFAULT GOVERNOR */
375/* 354/*
376 Performance governor is fallback governor if any other gov failed to 355 * Performance governor is fallback governor if any other gov failed to auto
377 auto load due latency restrictions 356 * load due latency restrictions
378*/ 357 */
379#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE 358#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE
380extern struct cpufreq_governor cpufreq_gov_performance; 359extern struct cpufreq_governor cpufreq_gov_performance;
381#endif 360#endif
@@ -395,7 +374,6 @@ extern struct cpufreq_governor cpufreq_gov_conservative;
395#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative) 374#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative)
396#endif 375#endif
397 376
398
399/********************************************************************* 377/*********************************************************************
400 * FREQUENCY TABLE HELPERS * 378 * FREQUENCY TABLE HELPERS *
401 *********************************************************************/ 379 *********************************************************************/
@@ -404,7 +382,7 @@ extern struct cpufreq_governor cpufreq_gov_conservative;
404#define CPUFREQ_TABLE_END ~1 382#define CPUFREQ_TABLE_END ~1
405 383
406struct cpufreq_frequency_table { 384struct cpufreq_frequency_table {
407 unsigned int index; /* any */ 385 unsigned int driver_data; /* driver specific data, not used by core */
408 unsigned int frequency; /* kHz - doesn't need to be in ascending 386 unsigned int frequency; /* kHz - doesn't need to be in ascending
409 * order */ 387 * order */
410}; 388};
@@ -421,15 +399,16 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
421 unsigned int relation, 399 unsigned int relation,
422 unsigned int *index); 400 unsigned int *index);
423 401
424/* the following 3 funtions are for cpufreq core use only */ 402void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy);
403ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf);
404
405/* the following funtion is for cpufreq core use only */
425struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu); 406struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
426 407
427/* the following are really really optional */ 408/* the following are really really optional */
428extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; 409extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
429
430void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, 410void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
431 unsigned int cpu); 411 unsigned int cpu);
432void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy);
433
434void cpufreq_frequency_table_put_attr(unsigned int cpu); 412void cpufreq_frequency_table_put_attr(unsigned int cpu);
413
435#endif /* _LINUX_CPUFREQ_H */ 414#endif /* _LINUX_CPUFREQ_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 8f0406230a0a..781addc66f03 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -13,8 +13,6 @@
13 13
14#include <linux/percpu.h> 14#include <linux/percpu.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/kobject.h>
17#include <linux/completion.h>
18#include <linux/hrtimer.h> 16#include <linux/hrtimer.h>
19 17
20#define CPUIDLE_STATE_MAX 10 18#define CPUIDLE_STATE_MAX 10
@@ -61,6 +59,10 @@ struct cpuidle_state {
61 59
62#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) 60#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
63 61
62struct cpuidle_device_kobj;
63struct cpuidle_state_kobj;
64struct cpuidle_driver_kobj;
65
64struct cpuidle_device { 66struct cpuidle_device {
65 unsigned int registered:1; 67 unsigned int registered:1;
66 unsigned int enabled:1; 68 unsigned int enabled:1;
@@ -71,9 +73,8 @@ struct cpuidle_device {
71 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; 73 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX];
72 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; 74 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
73 struct cpuidle_driver_kobj *kobj_driver; 75 struct cpuidle_driver_kobj *kobj_driver;
76 struct cpuidle_device_kobj *kobj_dev;
74 struct list_head device_list; 77 struct list_head device_list;
75 struct kobject kobj;
76 struct completion kobj_unregister;
77 78
78#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED 79#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
79 int safe_state_index; 80 int safe_state_index;
@@ -111,6 +112,9 @@ struct cpuidle_driver {
111 struct cpuidle_state states[CPUIDLE_STATE_MAX]; 112 struct cpuidle_state states[CPUIDLE_STATE_MAX];
112 int state_count; 113 int state_count;
113 int safe_state_index; 114 int safe_state_index;
115
116 /* the driver handles the cpus in cpumask */
117 struct cpumask *cpumask;
114}; 118};
115 119
116#ifdef CONFIG_CPU_IDLE 120#ifdef CONFIG_CPU_IDLE
@@ -135,9 +139,6 @@ extern void cpuidle_disable_device(struct cpuidle_device *dev);
135extern int cpuidle_play_dead(void); 139extern int cpuidle_play_dead(void);
136 140
137extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); 141extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
138extern int cpuidle_register_cpu_driver(struct cpuidle_driver *drv, int cpu);
139extern void cpuidle_unregister_cpu_driver(struct cpuidle_driver *drv, int cpu);
140
141#else 142#else
142static inline void disable_cpuidle(void) { } 143static inline void disable_cpuidle(void) { }
143static inline int cpuidle_idle_call(void) { return -ENODEV; } 144static inline int cpuidle_idle_call(void) { return -ENODEV; }
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 37e4f8da7cdf..fe68a5a98583 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -12,6 +12,15 @@
12extern unsigned long long elfcorehdr_addr; 12extern unsigned long long elfcorehdr_addr;
13extern unsigned long long elfcorehdr_size; 13extern unsigned long long elfcorehdr_size;
14 14
15extern int __weak elfcorehdr_alloc(unsigned long long *addr,
16 unsigned long long *size);
17extern void __weak elfcorehdr_free(unsigned long long addr);
18extern ssize_t __weak elfcorehdr_read(char *buf, size_t count, u64 *ppos);
19extern ssize_t __weak elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos);
20extern int __weak remap_oldmem_pfn_range(struct vm_area_struct *vma,
21 unsigned long from, unsigned long pfn,
22 unsigned long size, pgprot_t prot);
23
15extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 24extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
16 unsigned long, int); 25 unsigned long, int);
17 26
diff --git a/include/linux/crc-t10dif.h b/include/linux/crc-t10dif.h
index a9c96d865ee7..b3cb71f0d3b0 100644
--- a/include/linux/crc-t10dif.h
+++ b/include/linux/crc-t10dif.h
@@ -3,6 +3,10 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#define CRC_T10DIF_DIGEST_SIZE 2
7#define CRC_T10DIF_BLOCK_SIZE 1
8
9__u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer, size_t len);
6__u16 crc_t10dif(unsigned char const *, size_t); 10__u16 crc_t10dif(unsigned char const *, size_t);
7 11
8#endif 12#endif
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 1a6bb81f0fe5..59066e0b4ff1 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -9,6 +9,7 @@
9#include <linux/seqlock.h> 9#include <linux/seqlock.h>
10#include <linux/cache.h> 10#include <linux/cache.h>
11#include <linux/rcupdate.h> 11#include <linux/rcupdate.h>
12#include <linux/lockref.h>
12 13
13struct nameidata; 14struct nameidata;
14struct path; 15struct path;
@@ -54,11 +55,11 @@ struct qstr {
54#define hashlen_len(hashlen) ((u32)((hashlen) >> 32)) 55#define hashlen_len(hashlen) ((u32)((hashlen) >> 32))
55 56
56struct dentry_stat_t { 57struct dentry_stat_t {
57 int nr_dentry; 58 long nr_dentry;
58 int nr_unused; 59 long nr_unused;
59 int age_limit; /* age in seconds */ 60 long age_limit; /* age in seconds */
60 int want_pages; /* pages requested by system */ 61 long want_pages; /* pages requested by system */
61 int dummy[2]; 62 long dummy[2];
62}; 63};
63extern struct dentry_stat_t dentry_stat; 64extern struct dentry_stat_t dentry_stat;
64 65
@@ -100,6 +101,8 @@ extern unsigned int full_name_hash(const unsigned char *, unsigned int);
100# endif 101# endif
101#endif 102#endif
102 103
104#define d_lock d_lockref.lock
105
103struct dentry { 106struct dentry {
104 /* RCU lookup touched fields */ 107 /* RCU lookup touched fields */
105 unsigned int d_flags; /* protected by d_lock */ 108 unsigned int d_flags; /* protected by d_lock */
@@ -112,8 +115,7 @@ struct dentry {
112 unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */ 115 unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */
113 116
114 /* Ref lookup also touches following */ 117 /* Ref lookup also touches following */
115 unsigned int d_count; /* protected by d_lock */ 118 struct lockref d_lockref; /* per-dentry lock and refcount */
116 spinlock_t d_lock; /* per dentry lock */
117 const struct dentry_operations *d_op; 119 const struct dentry_operations *d_op;
118 struct super_block *d_sb; /* The root of the dentry tree */ 120 struct super_block *d_sb; /* The root of the dentry tree */
119 unsigned long d_time; /* used by d_revalidate */ 121 unsigned long d_time; /* used by d_revalidate */
@@ -146,10 +148,8 @@ enum dentry_d_lock_class
146struct dentry_operations { 148struct dentry_operations {
147 int (*d_revalidate)(struct dentry *, unsigned int); 149 int (*d_revalidate)(struct dentry *, unsigned int);
148 int (*d_weak_revalidate)(struct dentry *, unsigned int); 150 int (*d_weak_revalidate)(struct dentry *, unsigned int);
149 int (*d_hash)(const struct dentry *, const struct inode *, 151 int (*d_hash)(const struct dentry *, struct qstr *);
150 struct qstr *); 152 int (*d_compare)(const struct dentry *, const struct dentry *,
151 int (*d_compare)(const struct dentry *, const struct inode *,
152 const struct dentry *, const struct inode *,
153 unsigned int, const char *, const struct qstr *); 153 unsigned int, const char *, const struct qstr *);
154 int (*d_delete)(const struct dentry *); 154 int (*d_delete)(const struct dentry *);
155 void (*d_release)(struct dentry *); 155 void (*d_release)(struct dentry *);
@@ -208,11 +208,12 @@ struct dentry_operations {
208#define DCACHE_MANAGED_DENTRY \ 208#define DCACHE_MANAGED_DENTRY \
209 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) 209 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
210 210
211#define DCACHE_LRU_LIST 0x80000
211#define DCACHE_DENTRY_KILLED 0x100000 212#define DCACHE_DENTRY_KILLED 0x100000
212 213
213extern seqlock_t rename_lock; 214extern seqlock_t rename_lock;
214 215
215static inline int dname_external(struct dentry *dentry) 216static inline int dname_external(const struct dentry *dentry)
216{ 217{
217 return dentry->d_name.name != dentry->d_iname; 218 return dentry->d_name.name != dentry->d_iname;
218} 219}
@@ -246,11 +247,14 @@ extern struct dentry * d_make_root(struct inode *);
246/* <clickety>-<click> the ramfs-type tree */ 247/* <clickety>-<click> the ramfs-type tree */
247extern void d_genocide(struct dentry *); 248extern void d_genocide(struct dentry *);
248 249
250extern void d_tmpfile(struct dentry *, struct inode *);
251
249extern struct dentry *d_find_alias(struct inode *); 252extern struct dentry *d_find_alias(struct inode *);
250extern void d_prune_aliases(struct inode *); 253extern void d_prune_aliases(struct inode *);
251 254
252/* test whether we have any submounts in a subdir tree */ 255/* test whether we have any submounts in a subdir tree */
253extern int have_submounts(struct dentry *); 256extern int have_submounts(struct dentry *);
257extern int check_submounts_and_drop(struct dentry *);
254 258
255/* 259/*
256 * This adds the entry to the hash queues. 260 * This adds the entry to the hash queues.
@@ -300,29 +304,11 @@ extern struct dentry *d_lookup(const struct dentry *, const struct qstr *);
300extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); 304extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
301extern struct dentry *__d_lookup(const struct dentry *, const struct qstr *); 305extern struct dentry *__d_lookup(const struct dentry *, const struct qstr *);
302extern struct dentry *__d_lookup_rcu(const struct dentry *parent, 306extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
303 const struct qstr *name, 307 const struct qstr *name, unsigned *seq);
304 unsigned *seq, struct inode *inode);
305 308
306/** 309static inline unsigned d_count(const struct dentry *dentry)
307 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok
308 * @dentry: dentry to take a ref on
309 * @seq: seqcount to verify against
310 * Returns: 0 on failure, else 1.
311 *
312 * __d_rcu_to_refcount operates on a dentry,seq pair that was returned
313 * by __d_lookup_rcu, to get a reference on an rcu-walk dentry.
314 */
315static inline int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq)
316{ 310{
317 int ret = 0; 311 return dentry->d_lockref.count;
318
319 assert_spin_locked(&dentry->d_lock);
320 if (!read_seqcount_retry(&dentry->d_seq, seq)) {
321 ret = 1;
322 dentry->d_count++;
323 }
324
325 return ret;
326} 312}
327 313
328/* validate "insecure" dentry pointer */ 314/* validate "insecure" dentry pointer */
@@ -332,6 +318,7 @@ extern int d_validate(struct dentry *, struct dentry *);
332 * helper function for dentry_operations.d_dname() members 318 * helper function for dentry_operations.d_dname() members
333 */ 319 */
334extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); 320extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
321extern char *simple_dname(struct dentry *, char *, int);
335 322
336extern char *__d_path(const struct path *, const struct path *, char *, int); 323extern char *__d_path(const struct path *, const struct path *, char *, int);
337extern char *d_absolute_path(const struct path *, char *, int); 324extern char *d_absolute_path(const struct path *, char *, int);
@@ -352,17 +339,14 @@ extern char *dentry_path(struct dentry *, char *, int);
352static inline struct dentry *dget_dlock(struct dentry *dentry) 339static inline struct dentry *dget_dlock(struct dentry *dentry)
353{ 340{
354 if (dentry) 341 if (dentry)
355 dentry->d_count++; 342 dentry->d_lockref.count++;
356 return dentry; 343 return dentry;
357} 344}
358 345
359static inline struct dentry *dget(struct dentry *dentry) 346static inline struct dentry *dget(struct dentry *dentry)
360{ 347{
361 if (dentry) { 348 if (dentry)
362 spin_lock(&dentry->d_lock); 349 lockref_get(&dentry->d_lockref);
363 dget_dlock(dentry);
364 spin_unlock(&dentry->d_lock);
365 }
366 return dentry; 350 return dentry;
367} 351}
368 352
@@ -375,17 +359,17 @@ extern struct dentry *dget_parent(struct dentry *dentry);
375 * Returns true if the dentry passed is not currently hashed. 359 * Returns true if the dentry passed is not currently hashed.
376 */ 360 */
377 361
378static inline int d_unhashed(struct dentry *dentry) 362static inline int d_unhashed(const struct dentry *dentry)
379{ 363{
380 return hlist_bl_unhashed(&dentry->d_hash); 364 return hlist_bl_unhashed(&dentry->d_hash);
381} 365}
382 366
383static inline int d_unlinked(struct dentry *dentry) 367static inline int d_unlinked(const struct dentry *dentry)
384{ 368{
385 return d_unhashed(dentry) && !IS_ROOT(dentry); 369 return d_unhashed(dentry) && !IS_ROOT(dentry);
386} 370}
387 371
388static inline int cant_mount(struct dentry *dentry) 372static inline int cant_mount(const struct dentry *dentry)
389{ 373{
390 return (dentry->d_flags & DCACHE_CANT_MOUNT); 374 return (dentry->d_flags & DCACHE_CANT_MOUNT);
391} 375}
@@ -399,16 +383,20 @@ static inline void dont_mount(struct dentry *dentry)
399 383
400extern void dput(struct dentry *); 384extern void dput(struct dentry *);
401 385
402static inline bool d_managed(struct dentry *dentry) 386static inline bool d_managed(const struct dentry *dentry)
403{ 387{
404 return dentry->d_flags & DCACHE_MANAGED_DENTRY; 388 return dentry->d_flags & DCACHE_MANAGED_DENTRY;
405} 389}
406 390
407static inline bool d_mountpoint(struct dentry *dentry) 391static inline bool d_mountpoint(const struct dentry *dentry)
408{ 392{
409 return dentry->d_flags & DCACHE_MOUNTED; 393 return dentry->d_flags & DCACHE_MOUNTED;
410} 394}
411 395
412extern int sysctl_vfs_cache_pressure; 396extern int sysctl_vfs_cache_pressure;
413 397
398static inline unsigned long vfs_pressure_ratio(unsigned long val)
399{
400 return mult_frac(val, sysctl_vfs_cache_pressure, 100);
401}
414#endif /* __LINUX_DCACHE_H */ 402#endif /* __LINUX_DCACHE_H */
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 21ca773f77bf..822c1354f3a6 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -51,7 +51,7 @@ struct task_struct;
51extern void debug_show_all_locks(void); 51extern void debug_show_all_locks(void);
52extern void debug_show_held_locks(struct task_struct *task); 52extern void debug_show_held_locks(struct task_struct *task);
53extern void debug_check_no_locks_freed(const void *from, unsigned long len); 53extern void debug_check_no_locks_freed(const void *from, unsigned long len);
54extern void debug_check_no_locks_held(struct task_struct *task); 54extern void debug_check_no_locks_held(void);
55#else 55#else
56static inline void debug_show_all_locks(void) 56static inline void debug_show_all_locks(void)
57{ 57{
@@ -67,7 +67,7 @@ debug_check_no_locks_freed(const void *from, unsigned long len)
67} 67}
68 68
69static inline void 69static inline void
70debug_check_no_locks_held(struct task_struct *task) 70debug_check_no_locks_held(void)
71{ 71{
72} 72}
73#endif 73#endif
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 63f2465807d4..263489d0788d 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -79,6 +79,8 @@ struct dentry *debugfs_create_x64(const char *name, umode_t mode,
79 struct dentry *parent, u64 *value); 79 struct dentry *parent, u64 *value);
80struct dentry *debugfs_create_size_t(const char *name, umode_t mode, 80struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
81 struct dentry *parent, size_t *value); 81 struct dentry *parent, size_t *value);
82struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode,
83 struct dentry *parent, atomic_t *value);
82struct dentry *debugfs_create_bool(const char *name, umode_t mode, 84struct dentry *debugfs_create_bool(const char *name, umode_t mode,
83 struct dentry *parent, u32 *value); 85 struct dentry *parent, u32 *value);
84 86
@@ -190,6 +192,13 @@ static inline struct dentry *debugfs_create_x32(const char *name, umode_t mode,
190 return ERR_PTR(-ENODEV); 192 return ERR_PTR(-ENODEV);
191} 193}
192 194
195static inline struct dentry *debugfs_create_x64(const char *name, umode_t mode,
196 struct dentry *parent,
197 u64 *value)
198{
199 return ERR_PTR(-ENODEV);
200}
201
193static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode, 202static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
194 struct dentry *parent, 203 struct dentry *parent,
195 size_t *value) 204 size_t *value)
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
index 0e5f5785d9f2..98ffcbd4888e 100644
--- a/include/linux/debugobjects.h
+++ b/include/linux/debugobjects.h
@@ -63,7 +63,7 @@ struct debug_obj_descr {
63extern void debug_object_init (void *addr, struct debug_obj_descr *descr); 63extern void debug_object_init (void *addr, struct debug_obj_descr *descr);
64extern void 64extern void
65debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr); 65debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr);
66extern void debug_object_activate (void *addr, struct debug_obj_descr *descr); 66extern int debug_object_activate (void *addr, struct debug_obj_descr *descr);
67extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr); 67extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr);
68extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr); 68extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr);
69extern void debug_object_free (void *addr, struct debug_obj_descr *descr); 69extern void debug_object_free (void *addr, struct debug_obj_descr *descr);
@@ -85,8 +85,8 @@ static inline void
85debug_object_init (void *addr, struct debug_obj_descr *descr) { } 85debug_object_init (void *addr, struct debug_obj_descr *descr) { }
86static inline void 86static inline void
87debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr) { } 87debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr) { }
88static inline void 88static inline int
89debug_object_activate (void *addr, struct debug_obj_descr *descr) { } 89debug_object_activate (void *addr, struct debug_obj_descr *descr) { return 0; }
90static inline void 90static inline void
91debug_object_deactivate(void *addr, struct debug_obj_descr *descr) { } 91debug_object_deactivate(void *addr, struct debug_obj_descr *descr) { }
92static inline void 92static inline void
diff --git a/include/linux/decompress/unlz4.h b/include/linux/decompress/unlz4.h
new file mode 100644
index 000000000000..d5b68bf3ec92
--- /dev/null
+++ b/include/linux/decompress/unlz4.h
@@ -0,0 +1,10 @@
1#ifndef DECOMPRESS_UNLZ4_H
2#define DECOMPRESS_UNLZ4_H
3
4int unlz4(unsigned char *inbuf, int len,
5 int(*fill)(void*, unsigned int),
6 int(*flush)(void*, unsigned int),
7 unsigned char *output,
8 int *pos,
9 void(*error)(char *x));
10#endif
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index fe8c4476f7e4..5f1ab92107e6 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -181,6 +181,8 @@ extern struct devfreq *devfreq_add_device(struct device *dev,
181 const char *governor_name, 181 const char *governor_name,
182 void *data); 182 void *data);
183extern int devfreq_remove_device(struct devfreq *devfreq); 183extern int devfreq_remove_device(struct devfreq *devfreq);
184
185/* Supposed to be called by PM_SLEEP/PM_RUNTIME callbacks */
184extern int devfreq_suspend_device(struct devfreq *devfreq); 186extern int devfreq_suspend_device(struct devfreq *devfreq);
185extern int devfreq_resume_device(struct devfreq *devfreq); 187extern int devfreq_resume_device(struct devfreq *devfreq);
186 188
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 3cd32478f2fd..ed419c62dde1 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -10,6 +10,7 @@
10 10
11#include <linux/bio.h> 11#include <linux/bio.h>
12#include <linux/blkdev.h> 12#include <linux/blkdev.h>
13#include <linux/math64.h>
13#include <linux/ratelimit.h> 14#include <linux/ratelimit.h>
14 15
15struct dm_dev; 16struct dm_dev;
@@ -405,13 +406,14 @@ int dm_noflush_suspending(struct dm_target *ti);
405union map_info *dm_get_mapinfo(struct bio *bio); 406union map_info *dm_get_mapinfo(struct bio *bio);
406union map_info *dm_get_rq_mapinfo(struct request *rq); 407union map_info *dm_get_rq_mapinfo(struct request *rq);
407 408
409struct queue_limits *dm_get_queue_limits(struct mapped_device *md);
410
408/* 411/*
409 * Geometry functions. 412 * Geometry functions.
410 */ 413 */
411int dm_get_geometry(struct mapped_device *md, struct hd_geometry *geo); 414int dm_get_geometry(struct mapped_device *md, struct hd_geometry *geo);
412int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo); 415int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo);
413 416
414
415/*----------------------------------------------------------------- 417/*-----------------------------------------------------------------
416 * Functions for manipulating device-mapper tables. 418 * Functions for manipulating device-mapper tables.
417 *---------------------------------------------------------------*/ 419 *---------------------------------------------------------------*/
@@ -446,9 +448,9 @@ int __must_check dm_set_target_max_io_len(struct dm_target *ti, sector_t len);
446/* 448/*
447 * Table reference counting. 449 * Table reference counting.
448 */ 450 */
449struct dm_table *dm_get_live_table(struct mapped_device *md); 451struct dm_table *dm_get_live_table(struct mapped_device *md, int *srcu_idx);
450void dm_table_get(struct dm_table *t); 452void dm_put_live_table(struct mapped_device *md, int srcu_idx);
451void dm_table_put(struct dm_table *t); 453void dm_sync_table(struct mapped_device *md);
452 454
453/* 455/*
454 * Queries 456 * Queries
@@ -550,6 +552,14 @@ extern struct ratelimit_state dm_ratelimit_state;
550#define DM_MAPIO_REMAPPED 1 552#define DM_MAPIO_REMAPPED 1
551#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE 553#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE
552 554
555#define dm_sector_div64(x, y)( \
556{ \
557 u64 _res; \
558 (x) = div64_u64_rem(x, y, &_res); \
559 _res; \
560} \
561)
562
553/* 563/*
554 * Ceiling(n / sz) 564 * Ceiling(n / sz)
555 */ 565 */
diff --git a/include/linux/device.h b/include/linux/device.h
index c0a126125325..2a9d6ed59579 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -47,7 +47,11 @@ struct bus_attribute {
47}; 47};
48 48
49#define BUS_ATTR(_name, _mode, _show, _store) \ 49#define BUS_ATTR(_name, _mode, _show, _store) \
50struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) 50 struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store)
51#define BUS_ATTR_RW(_name) \
52 struct bus_attribute bus_attr_##_name = __ATTR_RW(_name)
53#define BUS_ATTR_RO(_name) \
54 struct bus_attribute bus_attr_##_name = __ATTR_RO(_name)
51 55
52extern int __must_check bus_create_file(struct bus_type *, 56extern int __must_check bus_create_file(struct bus_type *,
53 struct bus_attribute *); 57 struct bus_attribute *);
@@ -62,6 +66,9 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
62 * @bus_attrs: Default attributes of the bus. 66 * @bus_attrs: Default attributes of the bus.
63 * @dev_attrs: Default attributes of the devices on the bus. 67 * @dev_attrs: Default attributes of the devices on the bus.
64 * @drv_attrs: Default attributes of the device drivers on the bus. 68 * @drv_attrs: Default attributes of the device drivers on the bus.
69 * @bus_groups: Default attributes of the bus.
70 * @dev_groups: Default attributes of the devices on the bus.
71 * @drv_groups: Default attributes of the device drivers on the bus.
65 * @match: Called, perhaps multiple times, whenever a new device or driver 72 * @match: Called, perhaps multiple times, whenever a new device or driver
66 * is added for this bus. It should return a nonzero value if the 73 * is added for this bus. It should return a nonzero value if the
67 * given device can be handled by the given driver. 74 * given device can be handled by the given driver.
@@ -71,6 +78,10 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
71 * the specific driver's probe to initial the matched device. 78 * the specific driver's probe to initial the matched device.
72 * @remove: Called when a device removed from this bus. 79 * @remove: Called when a device removed from this bus.
73 * @shutdown: Called at shut-down time to quiesce the device. 80 * @shutdown: Called at shut-down time to quiesce the device.
81 *
82 * @online: Called to put the device back online (after offlining it).
83 * @offline: Called to put the device offline for hot-removal. May fail.
84 *
74 * @suspend: Called when a device on this bus wants to go to sleep mode. 85 * @suspend: Called when a device on this bus wants to go to sleep mode.
75 * @resume: Called to bring a device on this bus out of sleep mode. 86 * @resume: Called to bring a device on this bus out of sleep mode.
76 * @pm: Power management operations of this bus, callback the specific 87 * @pm: Power management operations of this bus, callback the specific
@@ -80,6 +91,7 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
80 * bus-specific setup 91 * bus-specific setup
81 * @p: The private data of the driver core, only the driver core can 92 * @p: The private data of the driver core, only the driver core can
82 * touch this. 93 * touch this.
94 * @lock_key: Lock class key for use by the lock validator
83 * 95 *
84 * A bus is a channel between the processor and one or more devices. For the 96 * A bus is a channel between the processor and one or more devices. For the
85 * purposes of the device model, all devices are connected via a bus, even if 97 * purposes of the device model, all devices are connected via a bus, even if
@@ -94,9 +106,12 @@ struct bus_type {
94 const char *name; 106 const char *name;
95 const char *dev_name; 107 const char *dev_name;
96 struct device *dev_root; 108 struct device *dev_root;
97 struct bus_attribute *bus_attrs; 109 struct bus_attribute *bus_attrs; /* use bus_groups instead */
98 struct device_attribute *dev_attrs; 110 struct device_attribute *dev_attrs; /* use dev_groups instead */
99 struct driver_attribute *drv_attrs; 111 struct driver_attribute *drv_attrs; /* use drv_groups instead */
112 const struct attribute_group **bus_groups;
113 const struct attribute_group **dev_groups;
114 const struct attribute_group **drv_groups;
100 115
101 int (*match)(struct device *dev, struct device_driver *drv); 116 int (*match)(struct device *dev, struct device_driver *drv);
102 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 117 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
@@ -104,6 +119,9 @@ struct bus_type {
104 int (*remove)(struct device *dev); 119 int (*remove)(struct device *dev);
105 void (*shutdown)(struct device *dev); 120 void (*shutdown)(struct device *dev);
106 121
122 int (*online)(struct device *dev);
123 int (*offline)(struct device *dev);
124
107 int (*suspend)(struct device *dev, pm_message_t state); 125 int (*suspend)(struct device *dev, pm_message_t state);
108 int (*resume)(struct device *dev); 126 int (*resume)(struct device *dev);
109 127
@@ -253,9 +271,14 @@ struct driver_attribute {
253 size_t count); 271 size_t count);
254}; 272};
255 273
256#define DRIVER_ATTR(_name, _mode, _show, _store) \ 274#define DRIVER_ATTR(_name, _mode, _show, _store) \
257struct driver_attribute driver_attr_##_name = \ 275 struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store)
258 __ATTR(_name, _mode, _show, _store) 276#define DRIVER_ATTR_RW(_name) \
277 struct driver_attribute driver_attr_##_name = __ATTR_RW(_name)
278#define DRIVER_ATTR_RO(_name) \
279 struct driver_attribute driver_attr_##_name = __ATTR_RO(_name)
280#define DRIVER_ATTR_WO(_name) \
281 struct driver_attribute driver_attr_##_name = __ATTR_WO(_name)
259 282
260extern int __must_check driver_create_file(struct device_driver *driver, 283extern int __must_check driver_create_file(struct device_driver *driver,
261 const struct driver_attribute *attr); 284 const struct driver_attribute *attr);
@@ -305,6 +328,7 @@ int subsys_virtual_register(struct bus_type *subsys,
305 * @name: Name of the class. 328 * @name: Name of the class.
306 * @owner: The module owner. 329 * @owner: The module owner.
307 * @class_attrs: Default attributes of this class. 330 * @class_attrs: Default attributes of this class.
331 * @dev_groups: Default attributes of the devices that belong to the class.
308 * @dev_attrs: Default attributes of the devices belong to the class. 332 * @dev_attrs: Default attributes of the devices belong to the class.
309 * @dev_bin_attrs: Default binary attributes of the devices belong to the class. 333 * @dev_bin_attrs: Default binary attributes of the devices belong to the class.
310 * @dev_kobj: The kobject that represents this class and links it into the hierarchy. 334 * @dev_kobj: The kobject that represents this class and links it into the hierarchy.
@@ -334,7 +358,8 @@ struct class {
334 struct module *owner; 358 struct module *owner;
335 359
336 struct class_attribute *class_attrs; 360 struct class_attribute *class_attrs;
337 struct device_attribute *dev_attrs; 361 struct device_attribute *dev_attrs; /* use dev_groups instead */
362 const struct attribute_group **dev_groups;
338 struct bin_attribute *dev_bin_attrs; 363 struct bin_attribute *dev_bin_attrs;
339 struct kobject *dev_kobj; 364 struct kobject *dev_kobj;
340 365
@@ -406,8 +431,12 @@ struct class_attribute {
406 const struct class_attribute *attr); 431 const struct class_attribute *attr);
407}; 432};
408 433
409#define CLASS_ATTR(_name, _mode, _show, _store) \ 434#define CLASS_ATTR(_name, _mode, _show, _store) \
410struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store) 435 struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store)
436#define CLASS_ATTR_RW(_name) \
437 struct class_attribute class_attr_##_name = __ATTR_RW(_name)
438#define CLASS_ATTR_RO(_name) \
439 struct class_attribute class_attr_##_name = __ATTR_RO(_name)
411 440
412extern int __must_check class_create_file(struct class *class, 441extern int __must_check class_create_file(struct class *class,
413 const struct class_attribute *attr); 442 const struct class_attribute *attr);
@@ -415,7 +444,6 @@ extern void class_remove_file(struct class *class,
415 const struct class_attribute *attr); 444 const struct class_attribute *attr);
416 445
417/* Simple class attribute that is just a static string */ 446/* Simple class attribute that is just a static string */
418
419struct class_attribute_string { 447struct class_attribute_string {
420 struct class_attribute attr; 448 struct class_attribute attr;
421 char *str; 449 char *str;
@@ -504,6 +532,12 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
504 532
505#define DEVICE_ATTR(_name, _mode, _show, _store) \ 533#define DEVICE_ATTR(_name, _mode, _show, _store) \
506 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 534 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
535#define DEVICE_ATTR_RW(_name) \
536 struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
537#define DEVICE_ATTR_RO(_name) \
538 struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
539#define DEVICE_ATTR_WO(_name) \
540 struct device_attribute dev_attr_##_name = __ATTR_WO(_name)
507#define DEVICE_ULONG_ATTR(_name, _mode, _var) \ 541#define DEVICE_ULONG_ATTR(_name, _mode, _var) \
508 struct dev_ext_attribute dev_attr_##_name = \ 542 struct dev_ext_attribute dev_attr_##_name = \
509 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 543 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
@@ -635,6 +669,7 @@ struct acpi_dev_node {
635 * segment limitations. 669 * segment limitations.
636 * @dma_pools: Dma pools (if dma'ble device). 670 * @dma_pools: Dma pools (if dma'ble device).
637 * @dma_mem: Internal for coherent mem override. 671 * @dma_mem: Internal for coherent mem override.
672 * @cma_area: Contiguous memory area for dma allocations
638 * @archdata: For arch-specific additions. 673 * @archdata: For arch-specific additions.
639 * @of_node: Associated device tree node. 674 * @of_node: Associated device tree node.
640 * @acpi_node: Associated ACPI device node. 675 * @acpi_node: Associated ACPI device node.
@@ -648,6 +683,10 @@ struct acpi_dev_node {
648 * @release: Callback to free the device after all references have 683 * @release: Callback to free the device after all references have
649 * gone away. This should be set by the allocator of the 684 * gone away. This should be set by the allocator of the
650 * device (i.e. the bus driver that discovered the device). 685 * device (i.e. the bus driver that discovered the device).
686 * @iommu_group: IOMMU group the device belongs to.
687 *
688 * @offline_disabled: If set, the device is permanently online.
689 * @offline: Set after successful invocation of bus type's .offline().
651 * 690 *
652 * At the lowest level, every device in a Linux system is represented by an 691 * At the lowest level, every device in a Linux system is represented by an
653 * instance of struct device. The device structure contains the information 692 * instance of struct device. The device structure contains the information
@@ -698,7 +737,7 @@ struct device {
698 737
699 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 738 struct dma_coherent_mem *dma_mem; /* internal for coherent mem
700 override */ 739 override */
701#ifdef CONFIG_CMA 740#ifdef CONFIG_DMA_CMA
702 struct cma *cma_area; /* contiguous memory area for dma 741 struct cma *cma_area; /* contiguous memory area for dma
703 allocations */ 742 allocations */
704#endif 743#endif
@@ -720,6 +759,9 @@ struct device {
720 759
721 void (*release)(struct device *dev); 760 void (*release)(struct device *dev);
722 struct iommu_group *iommu_group; 761 struct iommu_group *iommu_group;
762
763 bool offline_disabled:1;
764 bool offline:1;
723}; 765};
724 766
725static inline struct device *kobj_to_dev(struct kobject *kobj) 767static inline struct device *kobj_to_dev(struct kobject *kobj)
@@ -856,6 +898,16 @@ extern const char *device_get_devnode(struct device *dev,
856extern void *dev_get_drvdata(const struct device *dev); 898extern void *dev_get_drvdata(const struct device *dev);
857extern int dev_set_drvdata(struct device *dev, void *data); 899extern int dev_set_drvdata(struct device *dev, void *data);
858 900
901static inline bool device_supports_offline(struct device *dev)
902{
903 return dev->bus && dev->bus->offline && dev->bus->online;
904}
905
906extern void lock_device_hotplug(void);
907extern void unlock_device_hotplug(void);
908extern int lock_device_hotplug_sysfs(void);
909extern int device_offline(struct device *dev);
910extern int device_online(struct device *dev);
859/* 911/*
860 * Root device objects for grouping under /sys/devices 912 * Root device objects for grouping under /sys/devices
861 */ 913 */
@@ -899,6 +951,11 @@ extern __printf(5, 6)
899struct device *device_create(struct class *cls, struct device *parent, 951struct device *device_create(struct class *cls, struct device *parent,
900 dev_t devt, void *drvdata, 952 dev_t devt, void *drvdata,
901 const char *fmt, ...); 953 const char *fmt, ...);
954extern __printf(6, 7)
955struct device *device_create_with_groups(struct class *cls,
956 struct device *parent, dev_t devt, void *drvdata,
957 const struct attribute_group **groups,
958 const char *fmt, ...);
902extern void device_destroy(struct class *cls, dev_t devt); 959extern void device_destroy(struct class *cls, dev_t devt);
903 960
904/* 961/*
@@ -1053,7 +1110,8 @@ do { \
1053 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__) 1110 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
1054#define dev_info_ratelimited(dev, fmt, ...) \ 1111#define dev_info_ratelimited(dev, fmt, ...) \
1055 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__) 1112 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
1056#if defined(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG) 1113#if defined(CONFIG_DYNAMIC_DEBUG)
1114/* descriptor check is first to prevent flooding with "callbacks suppressed" */
1057#define dev_dbg_ratelimited(dev, fmt, ...) \ 1115#define dev_dbg_ratelimited(dev, fmt, ...) \
1058do { \ 1116do { \
1059 static DEFINE_RATELIMIT_STATE(_rs, \ 1117 static DEFINE_RATELIMIT_STATE(_rs, \
@@ -1062,8 +1120,17 @@ do { \
1062 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 1120 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
1063 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ 1121 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
1064 __ratelimit(&_rs)) \ 1122 __ratelimit(&_rs)) \
1065 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ 1123 __dynamic_dev_dbg(&descriptor, dev, fmt, \
1066 ##__VA_ARGS__); \ 1124 ##__VA_ARGS__); \
1125} while (0)
1126#elif defined(DEBUG)
1127#define dev_dbg_ratelimited(dev, fmt, ...) \
1128do { \
1129 static DEFINE_RATELIMIT_STATE(_rs, \
1130 DEFAULT_RATELIMIT_INTERVAL, \
1131 DEFAULT_RATELIMIT_BURST); \
1132 if (__ratelimit(&_rs)) \
1133 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
1067} while (0) 1134} while (0)
1068#else 1135#else
1069#define dev_dbg_ratelimited(dev, fmt, ...) \ 1136#define dev_dbg_ratelimited(dev, fmt, ...) \
diff --git a/include/linux/dm9000.h b/include/linux/dm9000.h
index 96e87693d933..841925fbfe8a 100644
--- a/include/linux/dm9000.h
+++ b/include/linux/dm9000.h
@@ -14,6 +14,8 @@
14#ifndef __DM9000_PLATFORM_DATA 14#ifndef __DM9000_PLATFORM_DATA
15#define __DM9000_PLATFORM_DATA __FILE__ 15#define __DM9000_PLATFORM_DATA __FILE__
16 16
17#include <linux/if_ether.h>
18
17/* IO control flags */ 19/* IO control flags */
18 20
19#define DM9000_PLATF_8BITONLY (0x0001) 21#define DM9000_PLATF_8BITONLY (0x0001)
@@ -27,7 +29,7 @@
27 29
28struct dm9000_plat_data { 30struct dm9000_plat_data {
29 unsigned int flags; 31 unsigned int flags;
30 unsigned char dev_addr[6]; 32 unsigned char dev_addr[ETH_ALEN];
31 33
32 /* allow replacement IO routines */ 34 /* allow replacement IO routines */
33 35
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
index 01b5c84be828..3b28f937d959 100644
--- a/include/linux/dma-contiguous.h
+++ b/include/linux/dma-contiguous.h
@@ -57,7 +57,7 @@ struct cma;
57struct page; 57struct page;
58struct device; 58struct device;
59 59
60#ifdef CONFIG_CMA 60#ifdef CONFIG_DMA_CMA
61 61
62/* 62/*
63 * There is always at least global CMA area and a few optional device 63 * There is always at least global CMA area and a few optional device
@@ -67,9 +67,53 @@ struct device;
67 67
68extern struct cma *dma_contiguous_default_area; 68extern struct cma *dma_contiguous_default_area;
69 69
70static inline struct cma *dev_get_cma_area(struct device *dev)
71{
72 if (dev && dev->cma_area)
73 return dev->cma_area;
74 return dma_contiguous_default_area;
75}
76
77static inline void dev_set_cma_area(struct device *dev, struct cma *cma)
78{
79 if (dev)
80 dev->cma_area = cma;
81}
82
83static inline void dma_contiguous_set_default(struct cma *cma)
84{
85 dma_contiguous_default_area = cma;
86}
87
70void dma_contiguous_reserve(phys_addr_t addr_limit); 88void dma_contiguous_reserve(phys_addr_t addr_limit);
71int dma_declare_contiguous(struct device *dev, phys_addr_t size, 89
72 phys_addr_t base, phys_addr_t limit); 90int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
91 phys_addr_t limit, struct cma **res_cma);
92
93/**
94 * dma_declare_contiguous() - reserve area for contiguous memory handling
95 * for particular device
96 * @dev: Pointer to device structure.
97 * @size: Size of the reserved memory.
98 * @base: Start address of the reserved memory (optional, 0 for any).
99 * @limit: End address of the reserved memory (optional, 0 for any).
100 *
101 * This function reserves memory for specified device. It should be
102 * called by board specific code when early allocator (memblock or bootmem)
103 * is still activate.
104 */
105
106static inline int dma_declare_contiguous(struct device *dev, phys_addr_t size,
107 phys_addr_t base, phys_addr_t limit)
108{
109 struct cma *cma;
110 int ret;
111 ret = dma_contiguous_reserve_area(size, base, limit, &cma);
112 if (ret == 0)
113 dev_set_cma_area(dev, cma);
114
115 return ret;
116}
73 117
74struct page *dma_alloc_from_contiguous(struct device *dev, int count, 118struct page *dma_alloc_from_contiguous(struct device *dev, int count,
75 unsigned int order); 119 unsigned int order);
@@ -80,8 +124,22 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages,
80 124
81#define MAX_CMA_AREAS (0) 125#define MAX_CMA_AREAS (0)
82 126
127static inline struct cma *dev_get_cma_area(struct device *dev)
128{
129 return NULL;
130}
131
132static inline void dev_set_cma_area(struct device *dev, struct cma *cma) { }
133
134static inline void dma_contiguous_set_default(struct cma *cma) { }
135
83static inline void dma_contiguous_reserve(phys_addr_t limit) { } 136static inline void dma_contiguous_reserve(phys_addr_t limit) { }
84 137
138static inline int dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
139 phys_addr_t limit, struct cma **res_cma) {
140 return -ENOSYS;
141}
142
85static inline 143static inline
86int dma_declare_contiguous(struct device *dev, phys_addr_t size, 144int dma_declare_contiguous(struct device *dev, phys_addr_t size,
87 phys_addr_t base, phys_addr_t limit) 145 phys_addr_t base, phys_addr_t limit)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 94af41858513..3a8d0a2af607 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -132,9 +132,8 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)
132static inline void *dma_zalloc_coherent(struct device *dev, size_t size, 132static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
133 dma_addr_t *dma_handle, gfp_t flag) 133 dma_addr_t *dma_handle, gfp_t flag)
134{ 134{
135 void *ret = dma_alloc_coherent(dev, size, dma_handle, flag); 135 void *ret = dma_alloc_coherent(dev, size, dma_handle,
136 if (ret) 136 flag | __GFP_ZERO);
137 memset(ret, 0, size);
138 return ret; 137 return ret;
139} 138}
140 139
diff --git a/include/linux/dma/mmp-pdma.h b/include/linux/dma/mmp-pdma.h
new file mode 100644
index 000000000000..2dc9b2bc18fc
--- /dev/null
+++ b/include/linux/dma/mmp-pdma.h
@@ -0,0 +1,15 @@
1#ifndef _MMP_PDMA_H_
2#define _MMP_PDMA_H_
3
4struct dma_chan;
5
6#ifdef CONFIG_MMP_PDMA
7bool mmp_pdma_filter_fn(struct dma_chan *chan, void *param);
8#else
9static inline bool mmp_pdma_filter_fn(struct dma_chan *chan, void *param)
10{
11 return false;
12}
13#endif
14
15#endif /* _MMP_PDMA_H_ */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 96d3e4ab11a9..0bc727534108 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -38,7 +38,10 @@ typedef s32 dma_cookie_t;
38#define DMA_MIN_COOKIE 1 38#define DMA_MIN_COOKIE 1
39#define DMA_MAX_COOKIE INT_MAX 39#define DMA_MAX_COOKIE INT_MAX
40 40
41#define dma_submit_error(cookie) ((cookie) < 0 ? 1 : 0) 41static inline int dma_submit_error(dma_cookie_t cookie)
42{
43 return cookie < 0 ? cookie : 0;
44}
42 45
43/** 46/**
44 * enum dma_status - DMA transaction status 47 * enum dma_status - DMA transaction status
@@ -66,7 +69,6 @@ enum dma_transaction_type {
66 DMA_PQ, 69 DMA_PQ,
67 DMA_XOR_VAL, 70 DMA_XOR_VAL,
68 DMA_PQ_VAL, 71 DMA_PQ_VAL,
69 DMA_MEMSET,
70 DMA_INTERRUPT, 72 DMA_INTERRUPT,
71 DMA_SG, 73 DMA_SG,
72 DMA_PRIVATE, 74 DMA_PRIVATE,
@@ -371,6 +373,25 @@ struct dma_slave_config {
371 unsigned int slave_id; 373 unsigned int slave_id;
372}; 374};
373 375
376/* struct dma_slave_caps - expose capabilities of a slave channel only
377 *
378 * @src_addr_widths: bit mask of src addr widths the channel supports
379 * @dstn_addr_widths: bit mask of dstn addr widths the channel supports
380 * @directions: bit mask of slave direction the channel supported
381 * since the enum dma_transfer_direction is not defined as bits for each
382 * type of direction, the dma controller should fill (1 << <TYPE>) and same
383 * should be checked by controller as well
384 * @cmd_pause: true, if pause and thereby resume is supported
385 * @cmd_terminate: true, if terminate cmd is supported
386 */
387struct dma_slave_caps {
388 u32 src_addr_widths;
389 u32 dstn_addr_widths;
390 u32 directions;
391 bool cmd_pause;
392 bool cmd_terminate;
393};
394
374static inline const char *dma_chan_name(struct dma_chan *chan) 395static inline const char *dma_chan_name(struct dma_chan *chan)
375{ 396{
376 return dev_name(&chan->dev->device); 397 return dev_name(&chan->dev->device);
@@ -520,7 +541,6 @@ struct dma_tx_state {
520 * @device_prep_dma_xor_val: prepares a xor validation operation 541 * @device_prep_dma_xor_val: prepares a xor validation operation
521 * @device_prep_dma_pq: prepares a pq operation 542 * @device_prep_dma_pq: prepares a pq operation
522 * @device_prep_dma_pq_val: prepares a pqzero_sum operation 543 * @device_prep_dma_pq_val: prepares a pqzero_sum operation
523 * @device_prep_dma_memset: prepares a memset operation
524 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 544 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
525 * @device_prep_slave_sg: prepares a slave dma operation 545 * @device_prep_slave_sg: prepares a slave dma operation
526 * @device_prep_dma_cyclic: prepare a cyclic dma operation suitable for audio. 546 * @device_prep_dma_cyclic: prepare a cyclic dma operation suitable for audio.
@@ -534,6 +554,7 @@ struct dma_tx_state {
534 * struct with auxiliary transfer status information, otherwise the call 554 * struct with auxiliary transfer status information, otherwise the call
535 * will just return a simple status code 555 * will just return a simple status code
536 * @device_issue_pending: push pending transactions to hardware 556 * @device_issue_pending: push pending transactions to hardware
557 * @device_slave_caps: return the slave channel capabilities
537 */ 558 */
538struct dma_device { 559struct dma_device {
539 560
@@ -573,9 +594,6 @@ struct dma_device {
573 struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src, 594 struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
574 unsigned int src_cnt, const unsigned char *scf, size_t len, 595 unsigned int src_cnt, const unsigned char *scf, size_t len,
575 enum sum_check_flags *pqres, unsigned long flags); 596 enum sum_check_flags *pqres, unsigned long flags);
576 struct dma_async_tx_descriptor *(*device_prep_dma_memset)(
577 struct dma_chan *chan, dma_addr_t dest, int value, size_t len,
578 unsigned long flags);
579 struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)( 597 struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)(
580 struct dma_chan *chan, unsigned long flags); 598 struct dma_chan *chan, unsigned long flags);
581 struct dma_async_tx_descriptor *(*device_prep_dma_sg)( 599 struct dma_async_tx_descriptor *(*device_prep_dma_sg)(
@@ -602,6 +620,7 @@ struct dma_device {
602 dma_cookie_t cookie, 620 dma_cookie_t cookie,
603 struct dma_tx_state *txstate); 621 struct dma_tx_state *txstate);
604 void (*device_issue_pending)(struct dma_chan *chan); 622 void (*device_issue_pending)(struct dma_chan *chan);
623 int (*device_slave_caps)(struct dma_chan *chan, struct dma_slave_caps *caps);
605}; 624};
606 625
607static inline int dmaengine_device_control(struct dma_chan *chan, 626static inline int dmaengine_device_control(struct dma_chan *chan,
@@ -675,6 +694,21 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma(
675 return chan->device->device_prep_interleaved_dma(chan, xt, flags); 694 return chan->device->device_prep_interleaved_dma(chan, xt, flags);
676} 695}
677 696
697static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
698{
699 if (!chan || !caps)
700 return -EINVAL;
701
702 /* check if the channel supports slave transactions */
703 if (!test_bit(DMA_SLAVE, chan->device->cap_mask.bits))
704 return -ENXIO;
705
706 if (chan->device->device_slave_caps)
707 return chan->device->device_slave_caps(chan, caps);
708
709 return -ENXIO;
710}
711
678static inline int dmaengine_terminate_all(struct dma_chan *chan) 712static inline int dmaengine_terminate_all(struct dma_chan *chan)
679{ 713{
680 return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); 714 return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0);
@@ -963,8 +997,9 @@ dma_set_tx_state(struct dma_tx_state *st, dma_cookie_t last, dma_cookie_t used,
963 } 997 }
964} 998}
965 999
966enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
967#ifdef CONFIG_DMA_ENGINE 1000#ifdef CONFIG_DMA_ENGINE
1001struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type);
1002enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
968enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); 1003enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
969void dma_issue_pending_all(void); 1004void dma_issue_pending_all(void);
970struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, 1005struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
@@ -972,6 +1007,14 @@ struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
972struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name); 1007struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name);
973void dma_release_channel(struct dma_chan *chan); 1008void dma_release_channel(struct dma_chan *chan);
974#else 1009#else
1010static inline struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type)
1011{
1012 return NULL;
1013}
1014static inline enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie)
1015{
1016 return DMA_SUCCESS;
1017}
975static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) 1018static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
976{ 1019{
977 return DMA_SUCCESS; 1020 return DMA_SUCCESS;
@@ -999,7 +1042,7 @@ static inline void dma_release_channel(struct dma_chan *chan)
999int dma_async_device_register(struct dma_device *device); 1042int dma_async_device_register(struct dma_device *device);
1000void dma_async_device_unregister(struct dma_device *device); 1043void dma_async_device_unregister(struct dma_device *device);
1001void dma_run_dependencies(struct dma_async_tx_descriptor *tx); 1044void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
1002struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); 1045struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
1003struct dma_chan *net_dma_find_channel(void); 1046struct dma_chan *net_dma_find_channel(void);
1004#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) 1047#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
1005#define dma_request_slave_channel_compat(mask, x, y, dev, name) \ 1048#define dma_request_slave_channel_compat(mask, x, y, dev, name) \
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 1b4d4ee1168f..de7d74ab3de6 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -177,7 +177,11 @@ enum drbd_ret_code {
177 ERR_NEED_APV_100 = 163, 177 ERR_NEED_APV_100 = 163,
178 ERR_NEED_ALLOW_TWO_PRI = 164, 178 ERR_NEED_ALLOW_TWO_PRI = 164,
179 ERR_MD_UNCLEAN = 165, 179 ERR_MD_UNCLEAN = 165,
180 180 ERR_MD_LAYOUT_CONNECTED = 166,
181 ERR_MD_LAYOUT_TOO_BIG = 167,
182 ERR_MD_LAYOUT_TOO_SMALL = 168,
183 ERR_MD_LAYOUT_NO_FIT = 169,
184 ERR_IMPLICIT_SHRINK = 170,
181 /* insert new ones above this line */ 185 /* insert new ones above this line */
182 AFTER_LAST_ERR_CODE 186 AFTER_LAST_ERR_CODE
183}; 187};
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
index d0d8fac8a6e4..e8c44572b8cb 100644
--- a/include/linux/drbd_genl.h
+++ b/include/linux/drbd_genl.h
@@ -181,6 +181,8 @@ GENL_struct(DRBD_NLA_RESIZE_PARMS, 7, resize_parms,
181 __u64_field(1, DRBD_GENLA_F_MANDATORY, resize_size) 181 __u64_field(1, DRBD_GENLA_F_MANDATORY, resize_size)
182 __flg_field(2, DRBD_GENLA_F_MANDATORY, resize_force) 182 __flg_field(2, DRBD_GENLA_F_MANDATORY, resize_force)
183 __flg_field(3, DRBD_GENLA_F_MANDATORY, no_resync) 183 __flg_field(3, DRBD_GENLA_F_MANDATORY, no_resync)
184 __u32_field_def(4, 0 /* OPTIONAL */, al_stripes, DRBD_AL_STRIPES_DEF)
185 __u32_field_def(5, 0 /* OPTIONAL */, al_stripe_size, DRBD_AL_STRIPE_SIZE_DEF)
184) 186)
185 187
186GENL_struct(DRBD_NLA_STATE_INFO, 8, state_info, 188GENL_struct(DRBD_NLA_STATE_INFO, 8, state_info,
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 1fedf2b17cc8..17e50bb00521 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -215,4 +215,13 @@
215#define DRBD_ALWAYS_ASBP_DEF 0 215#define DRBD_ALWAYS_ASBP_DEF 0
216#define DRBD_USE_RLE_DEF 1 216#define DRBD_USE_RLE_DEF 1
217 217
218#define DRBD_AL_STRIPES_MIN 1
219#define DRBD_AL_STRIPES_MAX 1024
220#define DRBD_AL_STRIPES_DEF 1
221#define DRBD_AL_STRIPES_SCALE '1'
222
223#define DRBD_AL_STRIPE_SIZE_MIN 4
224#define DRBD_AL_STRIPE_SIZE_MAX 16777216
225#define DRBD_AL_STRIPE_SIZE_DEF 32
226#define DRBD_AL_STRIPE_SIZE_SCALE 'k' /* kilobytes */
218#endif 227#endif
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h
index dd755ce2a5eb..1f79b20918b1 100644
--- a/include/linux/dw_apb_timer.h
+++ b/include/linux/dw_apb_timer.h
@@ -51,7 +51,5 @@ dw_apb_clocksource_init(unsigned rating, const char *name, void __iomem *base,
51void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs); 51void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs);
52void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs); 52void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs);
53cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs); 53cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs);
54void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs);
55 54
56extern void dw_apb_timer_init(void);
57#endif /* __DW_APB_TIMER_H__ */ 55#endif /* __DW_APB_TIMER_H__ */
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 0b763276f619..5c6d7fbaf89e 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -622,7 +622,7 @@ struct edac_raw_error_desc {
622 */ 622 */
623struct mem_ctl_info { 623struct mem_ctl_info {
624 struct device dev; 624 struct device dev;
625 struct bus_type bus; 625 struct bus_type *bus;
626 626
627 struct list_head link; /* for global list of mem_ctl_info structs */ 627 struct list_head link; /* for global list of mem_ctl_info structs */
628 628
@@ -742,4 +742,9 @@ struct mem_ctl_info {
742#endif 742#endif
743}; 743};
744 744
745/*
746 * Maximum number of memory controllers in the coherent fabric.
747 */
748#define EDAC_MAX_MCS 16
749
745#endif 750#endif
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 2bc0ad78d058..5f8f176154f7 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -287,20 +287,20 @@ typedef struct {
287 287
288typedef struct { 288typedef struct {
289 efi_table_hdr_t hdr; 289 efi_table_hdr_t hdr;
290 unsigned long get_time; 290 void *get_time;
291 unsigned long set_time; 291 void *set_time;
292 unsigned long get_wakeup_time; 292 void *get_wakeup_time;
293 unsigned long set_wakeup_time; 293 void *set_wakeup_time;
294 unsigned long set_virtual_address_map; 294 void *set_virtual_address_map;
295 unsigned long convert_pointer; 295 void *convert_pointer;
296 unsigned long get_variable; 296 void *get_variable;
297 unsigned long get_next_variable; 297 void *get_next_variable;
298 unsigned long set_variable; 298 void *set_variable;
299 unsigned long get_next_high_mono_count; 299 void *get_next_high_mono_count;
300 unsigned long reset_system; 300 void *reset_system;
301 unsigned long update_capsule; 301 void *update_capsule;
302 unsigned long query_capsule_caps; 302 void *query_capsule_caps;
303 unsigned long query_variable_info; 303 void *query_variable_info;
304} efi_runtime_services_t; 304} efi_runtime_services_t;
305 305
306typedef efi_status_t efi_get_time_t (efi_time_t *tm, efi_time_cap_t *tc); 306typedef efi_status_t efi_get_time_t (efi_time_t *tm, efi_time_cap_t *tc);
@@ -594,8 +594,8 @@ extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size);
594extern int __init efi_uart_console_only (void); 594extern int __init efi_uart_console_only (void);
595extern void efi_initialize_iomem_resources(struct resource *code_resource, 595extern void efi_initialize_iomem_resources(struct resource *code_resource,
596 struct resource *data_resource, struct resource *bss_resource); 596 struct resource *data_resource, struct resource *bss_resource);
597extern unsigned long efi_get_time(void); 597extern void efi_get_time(struct timespec *now);
598extern int efi_set_rtc_mmss(unsigned long nowtime); 598extern int efi_set_rtc_mmss(const struct timespec *now);
599extern void efi_reserve_boot_services(void); 599extern void efi_reserve_boot_services(void);
600extern struct efi_memory_map memmap; 600extern struct efi_memory_map memmap;
601 601
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index acd0312d46fb..306dd8cd0b6f 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -7,6 +7,7 @@
7#ifdef CONFIG_BLOCK 7#ifdef CONFIG_BLOCK
8 8
9struct io_cq; 9struct io_cq;
10struct elevator_type;
10 11
11typedef int (elevator_merge_fn) (struct request_queue *, struct request **, 12typedef int (elevator_merge_fn) (struct request_queue *, struct request **,
12 struct bio *); 13 struct bio *);
@@ -35,7 +36,8 @@ typedef void (elevator_put_req_fn) (struct request *);
35typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *); 36typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *);
36typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *); 37typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *);
37 38
38typedef int (elevator_init_fn) (struct request_queue *); 39typedef int (elevator_init_fn) (struct request_queue *,
40 struct elevator_type *e);
39typedef void (elevator_exit_fn) (struct elevator_queue *); 41typedef void (elevator_exit_fn) (struct elevator_queue *);
40 42
41struct elevator_ops 43struct elevator_ops
@@ -155,6 +157,8 @@ extern int elevator_init(struct request_queue *, char *);
155extern void elevator_exit(struct elevator_queue *); 157extern void elevator_exit(struct elevator_queue *);
156extern int elevator_change(struct request_queue *, const char *); 158extern int elevator_change(struct request_queue *, const char *);
157extern bool elv_rq_merge_ok(struct request *, struct bio *); 159extern bool elv_rq_merge_ok(struct request *, struct bio *);
160extern struct elevator_queue *elevator_alloc(struct request_queue *,
161 struct elevator_type *);
158 162
159/* 163/*
160 * Helper functions. 164 * Helper functions.
diff --git a/include/linux/err.h b/include/linux/err.h
index f2edce25a76b..15f92e072450 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -24,17 +24,17 @@ static inline void * __must_check ERR_PTR(long error)
24 return (void *) error; 24 return (void *) error;
25} 25}
26 26
27static inline long __must_check PTR_ERR(const void *ptr) 27static inline long __must_check PTR_ERR(__force const void *ptr)
28{ 28{
29 return (long) ptr; 29 return (long) ptr;
30} 30}
31 31
32static inline long __must_check IS_ERR(const void *ptr) 32static inline long __must_check IS_ERR(__force const void *ptr)
33{ 33{
34 return IS_ERR_VALUE((unsigned long)ptr); 34 return IS_ERR_VALUE((unsigned long)ptr);
35} 35}
36 36
37static inline long __must_check IS_ERR_OR_NULL(const void *ptr) 37static inline long __must_check IS_ERR_OR_NULL(__force const void *ptr)
38{ 38{
39 return !ptr || IS_ERR_VALUE((unsigned long)ptr); 39 return !ptr || IS_ERR_VALUE((unsigned long)ptr);
40} 40}
@@ -46,13 +46,13 @@ static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
46 * Explicitly cast an error-valued pointer to another pointer type in such a 46 * Explicitly cast an error-valued pointer to another pointer type in such a
47 * way as to make it clear that's what's going on. 47 * way as to make it clear that's what's going on.
48 */ 48 */
49static inline void * __must_check ERR_CAST(const void *ptr) 49static inline void * __must_check ERR_CAST(__force const void *ptr)
50{ 50{
51 /* cast away the const */ 51 /* cast away the const */
52 return (void *) ptr; 52 return (void *) ptr;
53} 53}
54 54
55static inline int __must_check PTR_RET(const void *ptr) 55static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
56{ 56{
57 if (IS_ERR(ptr)) 57 if (IS_ERR(ptr))
58 return PTR_ERR(ptr); 58 return PTR_ERR(ptr);
@@ -60,6 +60,9 @@ static inline int __must_check PTR_RET(const void *ptr)
60 return 0; 60 return 0;
61} 61}
62 62
63/* Deprecated */
64#define PTR_RET(p) PTR_ERR_OR_ZERO(p)
65
63#endif 66#endif
64 67
65#endif /* _LINUX_ERR_H */ 68#endif /* _LINUX_ERR_H */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index c623861964e4..d8b512496e50 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -199,6 +199,21 @@ static inline void eth_hw_addr_random(struct net_device *dev)
199} 199}
200 200
201/** 201/**
202 * eth_hw_addr_inherit - Copy dev_addr from another net_device
203 * @dst: pointer to net_device to copy dev_addr to
204 * @src: pointer to net_device to copy dev_addr from
205 *
206 * Copy the Ethernet address from one net_device to another along with
207 * the address attributes (addr_assign_type).
208 */
209static inline void eth_hw_addr_inherit(struct net_device *dst,
210 struct net_device *src)
211{
212 dst->addr_assign_type = src->addr_assign_type;
213 memcpy(dst->dev_addr, src->dev_addr, ETH_ALEN);
214}
215
216/**
202 * compare_ether_addr - Compare two Ethernet addresses 217 * compare_ether_addr - Compare two Ethernet addresses
203 * @addr1: Pointer to a six-byte array containing the Ethernet address 218 * @addr1: Pointer to a six-byte array containing the Ethernet address
204 * @addr2: Pointer other six-byte array containing the Ethernet address 219 * @addr2: Pointer other six-byte array containing the Ethernet address
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index cf5d2af61b81..ff0b981f078e 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -9,7 +9,6 @@
9#define _LINUX_EVENTFD_H 9#define _LINUX_EVENTFD_H
10 10
11#include <linux/fcntl.h> 11#include <linux/fcntl.h>
12#include <linux/file.h>
13#include <linux/wait.h> 12#include <linux/wait.h>
14 13
15/* 14/*
@@ -26,6 +25,8 @@
26#define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK) 25#define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK)
27#define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE) 26#define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE)
28 27
28struct file;
29
29#ifdef CONFIG_EVENTFD 30#ifdef CONFIG_EVENTFD
30 31
31struct file *eventfd_file_create(unsigned int count, int flags); 32struct file *eventfd_file_create(unsigned int count, int flags);
diff --git a/include/linux/extcon/of_extcon.h b/include/linux/extcon/of_extcon.h
new file mode 100644
index 000000000000..0ebfeff1b55d
--- /dev/null
+++ b/include/linux/extcon/of_extcon.h
@@ -0,0 +1,31 @@
1/*
2 * OF helpers for External connector (extcon) framework
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 * Kishon Vijay Abraham I <kishon@ti.com>
6 *
7 * Copyright (C) 2013 Samsung Electronics
8 * Chanwoo Choi <cw00.choi@samsung.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef __LINUX_OF_EXTCON_H
17#define __LINUX_OF_EXTCON_H
18
19#include <linux/err.h>
20
21#if IS_ENABLED(CONFIG_OF_EXTCON)
22extern struct extcon_dev
23 *of_extcon_get_extcon_dev(struct device *dev, int index);
24#else
25static inline struct extcon_dev
26 *of_extcon_get_extcon_dev(struct device *dev, int index)
27{
28 return ERR_PTR(-ENOSYS);
29}
30#endif /* CONFIG_OF_EXTCON */
31#endif /* __LINUX_OF_EXTCON_H */
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index df6fab82f87e..bb942f6d5702 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -20,8 +20,8 @@
20#define F2FS_BLKSIZE 4096 /* support only 4KB block */ 20#define F2FS_BLKSIZE 4096 /* support only 4KB block */
21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */ 21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */
22 22
23#define NULL_ADDR 0x0U 23#define NULL_ADDR ((block_t)0) /* used as block_t addresses */
24#define NEW_ADDR -1U 24#define NEW_ADDR ((block_t)-1) /* used as block_t addresses */
25 25
26#define F2FS_ROOT_INO(sbi) (sbi->root_ino_num) 26#define F2FS_ROOT_INO(sbi) (sbi->root_ino_num)
27#define F2FS_NODE_INO(sbi) (sbi->node_ino_num) 27#define F2FS_NODE_INO(sbi) (sbi->node_ino_num)
@@ -140,14 +140,24 @@ struct f2fs_extent {
140} __packed; 140} __packed;
141 141
142#define F2FS_NAME_LEN 255 142#define F2FS_NAME_LEN 255
143#define ADDRS_PER_INODE 923 /* Address Pointers in an Inode */ 143#define F2FS_INLINE_XATTR_ADDRS 50 /* 200 bytes for inline xattrs */
144#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ 144#define DEF_ADDRS_PER_INODE 923 /* Address Pointers in an Inode */
145#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */ 145#define ADDRS_PER_INODE(fi) addrs_per_inode(fi)
146#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */
147#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */
148
149#define NODE_DIR1_BLOCK (DEF_ADDRS_PER_INODE + 1)
150#define NODE_DIR2_BLOCK (DEF_ADDRS_PER_INODE + 2)
151#define NODE_IND1_BLOCK (DEF_ADDRS_PER_INODE + 3)
152#define NODE_IND2_BLOCK (DEF_ADDRS_PER_INODE + 4)
153#define NODE_DIND_BLOCK (DEF_ADDRS_PER_INODE + 5)
154
155#define F2FS_INLINE_XATTR 0x01 /* file inline xattr flag */
146 156
147struct f2fs_inode { 157struct f2fs_inode {
148 __le16 i_mode; /* file mode */ 158 __le16 i_mode; /* file mode */
149 __u8 i_advise; /* file hints */ 159 __u8 i_advise; /* file hints */
150 __u8 i_reserved; /* reserved */ 160 __u8 i_inline; /* file inline flags */
151 __le32 i_uid; /* user ID */ 161 __le32 i_uid; /* user ID */
152 __le32 i_gid; /* group ID */ 162 __le32 i_gid; /* group ID */
153 __le32 i_links; /* links count */ 163 __le32 i_links; /* links count */
@@ -170,7 +180,7 @@ struct f2fs_inode {
170 180
171 struct f2fs_extent i_ext; /* caching a largest extent */ 181 struct f2fs_extent i_ext; /* caching a largest extent */
172 182
173 __le32 i_addr[ADDRS_PER_INODE]; /* Pointers to data blocks */ 183 __le32 i_addr[DEF_ADDRS_PER_INODE]; /* Pointers to data blocks */
174 184
175 __le32 i_nid[5]; /* direct(2), indirect(2), 185 __le32 i_nid[5]; /* direct(2), indirect(2),
176 double_indirect(1) node id */ 186 double_indirect(1) node id */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index d49c60f5aa4c..ffac70aab3e9 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -624,7 +624,7 @@ extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u3
624extern void fb_set_suspend(struct fb_info *info, int state); 624extern void fb_set_suspend(struct fb_info *info, int state);
625extern int fb_get_color_depth(struct fb_var_screeninfo *var, 625extern int fb_get_color_depth(struct fb_var_screeninfo *var,
626 struct fb_fix_screeninfo *fix); 626 struct fb_fix_screeninfo *fix);
627extern int fb_get_options(char *name, char **option); 627extern int fb_get_options(const char *name, char **option);
628extern int fb_new_modelist(struct fb_info *info); 628extern int fb_new_modelist(struct fb_info *info);
629 629
630extern struct fb_info *registered_fb[FB_MAX]; 630extern struct fb_info *registered_fb[FB_MAX];
diff --git a/include/linux/filter.h b/include/linux/filter.h
index c050dcc322a4..a6ac84871d6d 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -46,6 +46,7 @@ extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
46extern int sk_detach_filter(struct sock *sk); 46extern int sk_detach_filter(struct sock *sk);
47extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen); 47extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen);
48extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len); 48extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len);
49extern void sk_decode_filter(struct sock_filter *filt, struct sock_filter *to);
49 50
50#ifdef CONFIG_BPF_JIT 51#ifdef CONFIG_BPF_JIT
51#include <stdarg.h> 52#include <stdarg.h>
@@ -58,10 +59,10 @@ extern void bpf_jit_free(struct sk_filter *fp);
58static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, 59static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
59 u32 pass, void *image) 60 u32 pass, void *image)
60{ 61{
61 pr_err("flen=%u proglen=%u pass=%u image=%p\n", 62 pr_err("flen=%u proglen=%u pass=%u image=%pK\n",
62 flen, proglen, pass, image); 63 flen, proglen, pass, image);
63 if (image) 64 if (image)
64 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_ADDRESS, 65 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
65 16, 1, image, proglen, false); 66 16, 1, image, proglen, false);
66} 67}
67#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) 68#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns)
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 191501afd7fb..5d7782e42b8f 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -251,8 +251,10 @@ struct ieee1394_device_id;
251 251
252struct fw_driver { 252struct fw_driver {
253 struct device_driver driver; 253 struct device_driver driver;
254 int (*probe)(struct fw_unit *unit, const struct ieee1394_device_id *id);
254 /* Called when the parent device sits through a bus reset. */ 255 /* Called when the parent device sits through a bus reset. */
255 void (*update)(struct fw_unit *unit); 256 void (*update)(struct fw_unit *unit);
257 void (*remove)(struct fw_unit *unit);
256 const struct ieee1394_device_id *id_table; 258 const struct ieee1394_device_id *id_table;
257}; 259};
258 260
@@ -434,6 +436,7 @@ struct fw_iso_context {
434 int type; 436 int type;
435 int channel; 437 int channel;
436 int speed; 438 int speed;
439 bool drop_overflow_headers;
437 size_t header_size; 440 size_t header_size;
438 union { 441 union {
439 fw_iso_callback_t sc; 442 fw_iso_callback_t sc;
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index e4279fedb93a..e154c1005cd1 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -47,8 +47,6 @@ int request_firmware_nowait(
47 void (*cont)(const struct firmware *fw, void *context)); 47 void (*cont)(const struct firmware *fw, void *context));
48 48
49void release_firmware(const struct firmware *fw); 49void release_firmware(const struct firmware *fw);
50int cache_firmware(const char *name);
51int uncache_firmware(const char *name);
52#else 50#else
53static inline int request_firmware(const struct firmware **fw, 51static inline int request_firmware(const struct firmware **fw,
54 const char *name, 52 const char *name,
@@ -68,15 +66,6 @@ static inline void release_firmware(const struct firmware *fw)
68{ 66{
69} 67}
70 68
71static inline int cache_firmware(const char *name)
72{
73 return -ENOENT;
74}
75
76static inline int uncache_firmware(const char *name)
77{
78 return -EINVAL;
79}
80#endif 69#endif
81 70
82#endif 71#endif
diff --git a/include/linux/fmc-sdb.h b/include/linux/fmc-sdb.h
new file mode 100644
index 000000000000..1974317a9b3d
--- /dev/null
+++ b/include/linux/fmc-sdb.h
@@ -0,0 +1,36 @@
1/*
2 * This file is separate from sdb.h, because I want that one to remain
3 * unchanged (as far as possible) from the official sdb distribution
4 *
5 * This file and associated functionality are a playground for me to
6 * understand stuff which will later be implemented in more generic places.
7 */
8#include <linux/sdb.h>
9
10/* This is the union of all currently defined types */
11union sdb_record {
12 struct sdb_interconnect ic;
13 struct sdb_device dev;
14 struct sdb_bridge bridge;
15 struct sdb_integration integr;
16 struct sdb_empty empty;
17};
18
19struct fmc_device;
20
21/* Every sdb table is turned into this structure */
22struct sdb_array {
23 int len;
24 int level;
25 unsigned long baseaddr;
26 struct fmc_device *fmc; /* the device that hosts it */
27 struct sdb_array *parent; /* NULL at root */
28 union sdb_record *record; /* copies of the struct */
29 struct sdb_array **subtree; /* only valid for bridge items */
30};
31
32extern int fmc_scan_sdb_tree(struct fmc_device *fmc, unsigned long address);
33extern void fmc_show_sdb_tree(const struct fmc_device *fmc);
34extern signed long fmc_find_sdb_device(struct sdb_array *tree, uint64_t vendor,
35 uint32_t device, unsigned long *sz);
36extern int fmc_free_sdb_tree(struct fmc_device *fmc);
diff --git a/include/linux/fmc.h b/include/linux/fmc.h
new file mode 100644
index 000000000000..a5f0aa5c2a8d
--- /dev/null
+++ b/include/linux/fmc.h
@@ -0,0 +1,237 @@
1/*
2 * Copyright (C) 2012 CERN (www.cern.ch)
3 * Author: Alessandro Rubini <rubini@gnudd.com>
4 *
5 * Released according to the GNU GPL, version 2 or any later version.
6 *
7 * This work is part of the White Rabbit project, a research effort led
8 * by CERN, the European Institute for Nuclear Research.
9 */
10#ifndef __LINUX_FMC_H__
11#define __LINUX_FMC_H__
12#include <linux/types.h>
13#include <linux/moduleparam.h>
14#include <linux/device.h>
15#include <linux/list.h>
16#include <linux/interrupt.h>
17#include <linux/io.h>
18
19struct fmc_device;
20struct fmc_driver;
21
22/*
23 * This bus abstraction is developed separately from drivers, so we need
24 * to check the version of the data structures we receive.
25 */
26
27#define FMC_MAJOR 3
28#define FMC_MINOR 0
29#define FMC_VERSION ((FMC_MAJOR << 16) | FMC_MINOR)
30#define __FMC_MAJOR(x) ((x) >> 16)
31#define __FMC_MINOR(x) ((x) & 0xffff)
32
33/*
34 * The device identification, as defined by the IPMI FRU (Field Replaceable
35 * Unit) includes four different strings to describe the device. Here we
36 * only match the "Board Manufacturer" and the "Board Product Name",
37 * ignoring the "Board Serial Number" and "Board Part Number". All 4 are
38 * expected to be strings, so they are treated as zero-terminated C strings.
39 * Unspecified string (NULL) means "any", so if both are unspecified this
40 * is a catch-all driver. So null entries are allowed and we use array
41 * and length. This is unlike pci and usb that use null-terminated arrays
42 */
43struct fmc_fru_id {
44 char *manufacturer;
45 char *product_name;
46};
47
48/*
49 * If the FPGA is already programmed (think Etherbone or the second
50 * SVEC slot), we can match on SDB devices in the memory image. This
51 * match uses an array of devices that must all be present, and the
52 * match is based on vendor and device only. Further checks are expected
53 * to happen in the probe function. Zero means "any" and catch-all is allowed.
54 */
55struct fmc_sdb_one_id {
56 uint64_t vendor;
57 uint32_t device;
58};
59struct fmc_sdb_id {
60 struct fmc_sdb_one_id *cores;
61 int cores_nr;
62};
63
64struct fmc_device_id {
65 struct fmc_fru_id *fru_id;
66 int fru_id_nr;
67 struct fmc_sdb_id *sdb_id;
68 int sdb_id_nr;
69};
70
71/* This sizes the module_param_array used by generic module parameters */
72#define FMC_MAX_CARDS 32
73
74/* The driver is a pretty simple thing */
75struct fmc_driver {
76 unsigned long version;
77 struct device_driver driver;
78 int (*probe)(struct fmc_device *);
79 int (*remove)(struct fmc_device *);
80 const struct fmc_device_id id_table;
81 /* What follows is for generic module parameters */
82 int busid_n;
83 int busid_val[FMC_MAX_CARDS];
84 int gw_n;
85 char *gw_val[FMC_MAX_CARDS];
86};
87#define to_fmc_driver(x) container_of((x), struct fmc_driver, driver)
88
89/* These are the generic parameters, that drivers may instantiate */
90#define FMC_PARAM_BUSID(_d) \
91 module_param_array_named(busid, _d.busid_val, int, &_d.busid_n, 0444)
92#define FMC_PARAM_GATEWARE(_d) \
93 module_param_array_named(gateware, _d.gw_val, charp, &_d.gw_n, 0444)
94
95/*
96 * Drivers may need to configure gpio pins in the carrier. To read input
97 * (a very uncommon operation, and definitely not in the hot paths), just
98 * configure one gpio only and get 0 or 1 as retval of the config method
99 */
100struct fmc_gpio {
101 char *carrier_name; /* name or NULL for virtual pins */
102 int gpio;
103 int _gpio; /* internal use by the carrier */
104 int mode; /* GPIOF_DIR_OUT etc, from <linux/gpio.h> */
105 int irqmode; /* IRQF_TRIGGER_LOW and so on */
106};
107
108/* The numbering of gpio pins allows access to raw pins or virtual roles */
109#define FMC_GPIO_RAW(x) (x) /* 4096 of them */
110#define __FMC_GPIO_IS_RAW(x) ((x) < 0x1000)
111#define FMC_GPIO_IRQ(x) ((x) + 0x1000) /* 256 of them */
112#define FMC_GPIO_LED(x) ((x) + 0x1100) /* 256 of them */
113#define FMC_GPIO_KEY(x) ((x) + 0x1200) /* 256 of them */
114#define FMC_GPIO_TP(x) ((x) + 0x1300) /* 256 of them */
115#define FMC_GPIO_USER(x) ((x) + 0x1400) /* 256 of them */
116/* We may add SCL and SDA, or other roles if the need arises */
117
118/* GPIOF_DIR_IN etc are missing before 3.0. copy from <linux/gpio.h> */
119#ifndef GPIOF_DIR_IN
120# define GPIOF_DIR_OUT (0 << 0)
121# define GPIOF_DIR_IN (1 << 0)
122# define GPIOF_INIT_LOW (0 << 1)
123# define GPIOF_INIT_HIGH (1 << 1)
124#endif
125
126/*
127 * The operations are offered by each carrier and should make driver
128 * design completely independent of the carrier. Named GPIO pins may be
129 * the exception.
130 */
131struct fmc_operations {
132 uint32_t (*read32)(struct fmc_device *fmc, int offset);
133 void (*write32)(struct fmc_device *fmc, uint32_t value, int offset);
134 int (*validate)(struct fmc_device *fmc, struct fmc_driver *drv);
135 int (*reprogram)(struct fmc_device *f, struct fmc_driver *d, char *gw);
136 int (*irq_request)(struct fmc_device *fmc, irq_handler_t h,
137 char *name, int flags);
138 void (*irq_ack)(struct fmc_device *fmc);
139 int (*irq_free)(struct fmc_device *fmc);
140 int (*gpio_config)(struct fmc_device *fmc, struct fmc_gpio *gpio,
141 int ngpio);
142 int (*read_ee)(struct fmc_device *fmc, int pos, void *d, int l);
143 int (*write_ee)(struct fmc_device *fmc, int pos, const void *d, int l);
144};
145
146/* Prefer this helper rather than calling of fmc->reprogram directly */
147extern int fmc_reprogram(struct fmc_device *f, struct fmc_driver *d, char *gw,
148 int sdb_entry);
149
150/*
151 * The device reports all information needed to access hw.
152 *
153 * If we have eeprom_len and not contents, the core reads it.
154 * Then, parsing of identifiers is done by the core which fills fmc_fru_id..
155 * Similarly a device that must be matched based on SDB cores must
156 * fill the entry point and the core will scan the bus (FIXME: sdb match)
157 */
158struct fmc_device {
159 unsigned long version;
160 unsigned long flags;
161 struct module *owner; /* char device must pin it */
162 struct fmc_fru_id id; /* for EEPROM-based match */
163 struct fmc_operations *op; /* carrier-provided */
164 int irq; /* according to host bus. 0 == none */
165 int eeprom_len; /* Usually 8kB, may be less */
166 int eeprom_addr; /* 0x50, 0x52 etc */
167 uint8_t *eeprom; /* Full contents or leading part */
168 char *carrier_name; /* "SPEC" or similar, for special use */
169 void *carrier_data; /* "struct spec *" or equivalent */
170 __iomem void *fpga_base; /* May be NULL (Etherbone) */
171 __iomem void *slot_base; /* Set by the driver */
172 struct fmc_device **devarray; /* Allocated by the bus */
173 int slot_id; /* Index in the slot array */
174 int nr_slots; /* Number of slots in this carrier */
175 unsigned long memlen; /* Used for the char device */
176 struct device dev; /* For Linux use */
177 struct device *hwdev; /* The underlying hardware device */
178 unsigned long sdbfs_entry;
179 struct sdb_array *sdb;
180 uint32_t device_id; /* Filled by the device */
181 char *mezzanine_name; /* Defaults to ``fmc'' */
182 void *mezzanine_data;
183};
184#define to_fmc_device(x) container_of((x), struct fmc_device, dev)
185
186#define FMC_DEVICE_HAS_GOLDEN 1
187#define FMC_DEVICE_HAS_CUSTOM 2
188#define FMC_DEVICE_NO_MEZZANINE 4
189#define FMC_DEVICE_MATCH_SDB 8 /* fmc-core must scan sdb in fpga */
190
191/*
192 * If fpga_base can be used, the carrier offers no readl/writel methods, and
193 * this expands to a single, fast, I/O access.
194 */
195static inline uint32_t fmc_readl(struct fmc_device *fmc, int offset)
196{
197 if (unlikely(fmc->op->read32))
198 return fmc->op->read32(fmc, offset);
199 return readl(fmc->fpga_base + offset);
200}
201static inline void fmc_writel(struct fmc_device *fmc, uint32_t val, int off)
202{
203 if (unlikely(fmc->op->write32))
204 fmc->op->write32(fmc, val, off);
205 else
206 writel(val, fmc->fpga_base + off);
207}
208
209/* pci-like naming */
210static inline void *fmc_get_drvdata(const struct fmc_device *fmc)
211{
212 return dev_get_drvdata(&fmc->dev);
213}
214
215static inline void fmc_set_drvdata(struct fmc_device *fmc, void *data)
216{
217 dev_set_drvdata(&fmc->dev, data);
218}
219
220/* The 4 access points */
221extern int fmc_driver_register(struct fmc_driver *drv);
222extern void fmc_driver_unregister(struct fmc_driver *drv);
223extern int fmc_device_register(struct fmc_device *tdev);
224extern void fmc_device_unregister(struct fmc_device *tdev);
225
226/* Two more for device sets, all driven by the same FPGA */
227extern int fmc_device_register_n(struct fmc_device **devs, int n);
228extern void fmc_device_unregister_n(struct fmc_device **devs, int n);
229
230/* Internal cross-calls between files; not exported to other modules */
231extern int fmc_match(struct device *dev, struct device_driver *drv);
232extern int fmc_fill_id_info(struct fmc_device *fmc);
233extern void fmc_free_id_info(struct fmc_device *fmc);
234extern void fmc_dump_eeprom(const struct fmc_device *fmc);
235extern void fmc_dump_sdb(const struct fmc_device *fmc);
236
237#endif /* __LINUX_FMC_H__ */
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index e70df40d84f6..7fd81b8c4897 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -3,6 +3,7 @@
3#ifndef FREEZER_H_INCLUDED 3#ifndef FREEZER_H_INCLUDED
4#define FREEZER_H_INCLUDED 4#define FREEZER_H_INCLUDED
5 5
6#include <linux/debug_locks.h>
6#include <linux/sched.h> 7#include <linux/sched.h>
7#include <linux/wait.h> 8#include <linux/wait.h>
8#include <linux/atomic.h> 9#include <linux/atomic.h>
@@ -46,7 +47,11 @@ extern int freeze_kernel_threads(void);
46extern void thaw_processes(void); 47extern void thaw_processes(void);
47extern void thaw_kernel_threads(void); 48extern void thaw_kernel_threads(void);
48 49
49static inline bool try_to_freeze(void) 50/*
51 * DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION
52 * If try_to_freeze causes a lockdep warning it means the caller may deadlock
53 */
54static inline bool try_to_freeze_unsafe(void)
50{ 55{
51 might_sleep(); 56 might_sleep();
52 if (likely(!freezing(current))) 57 if (likely(!freezing(current)))
@@ -54,6 +59,13 @@ static inline bool try_to_freeze(void)
54 return __refrigerator(false); 59 return __refrigerator(false);
55} 60}
56 61
62static inline bool try_to_freeze(void)
63{
64 if (!(current->flags & PF_NOFREEZE))
65 debug_check_no_locks_held();
66 return try_to_freeze_unsafe();
67}
68
57extern bool freeze_task(struct task_struct *p); 69extern bool freeze_task(struct task_struct *p);
58extern bool set_freezable(void); 70extern bool set_freezable(void);
59 71
@@ -115,6 +127,14 @@ static inline void freezer_count(void)
115 try_to_freeze(); 127 try_to_freeze();
116} 128}
117 129
130/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
131static inline void freezer_count_unsafe(void)
132{
133 current->flags &= ~PF_FREEZER_SKIP;
134 smp_mb();
135 try_to_freeze_unsafe();
136}
137
118/** 138/**
119 * freezer_should_skip - whether to skip a task when determining frozen 139 * freezer_should_skip - whether to skip a task when determining frozen
120 * state is reached 140 * state is reached
@@ -139,28 +159,86 @@ static inline bool freezer_should_skip(struct task_struct *p)
139} 159}
140 160
141/* 161/*
142 * These macros are intended to be used whenever you want allow a sleeping 162 * These functions are intended to be used whenever you want allow a sleeping
143 * task to be frozen. Note that neither return any clear indication of 163 * task to be frozen. Note that neither return any clear indication of
144 * whether a freeze event happened while in this function. 164 * whether a freeze event happened while in this function.
145 */ 165 */
146 166
147/* Like schedule(), but should not block the freezer. */ 167/* Like schedule(), but should not block the freezer. */
148#define freezable_schedule() \ 168static inline void freezable_schedule(void)
149({ \ 169{
150 freezer_do_not_count(); \ 170 freezer_do_not_count();
151 schedule(); \ 171 schedule();
152 freezer_count(); \ 172 freezer_count();
153}) 173}
174
175/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
176static inline void freezable_schedule_unsafe(void)
177{
178 freezer_do_not_count();
179 schedule();
180 freezer_count_unsafe();
181}
182
183/*
184 * Like freezable_schedule_timeout(), but should not block the freezer. Do not
185 * call this with locks held.
186 */
187static inline long freezable_schedule_timeout(long timeout)
188{
189 long __retval;
190 freezer_do_not_count();
191 __retval = schedule_timeout(timeout);
192 freezer_count();
193 return __retval;
194}
195
196/*
197 * Like schedule_timeout_interruptible(), but should not block the freezer. Do not
198 * call this with locks held.
199 */
200static inline long freezable_schedule_timeout_interruptible(long timeout)
201{
202 long __retval;
203 freezer_do_not_count();
204 __retval = schedule_timeout_interruptible(timeout);
205 freezer_count();
206 return __retval;
207}
154 208
155/* Like schedule_timeout_killable(), but should not block the freezer. */ 209/* Like schedule_timeout_killable(), but should not block the freezer. */
156#define freezable_schedule_timeout_killable(timeout) \ 210static inline long freezable_schedule_timeout_killable(long timeout)
157({ \ 211{
158 long __retval; \ 212 long __retval;
159 freezer_do_not_count(); \ 213 freezer_do_not_count();
160 __retval = schedule_timeout_killable(timeout); \ 214 __retval = schedule_timeout_killable(timeout);
161 freezer_count(); \ 215 freezer_count();
162 __retval; \ 216 return __retval;
163}) 217}
218
219/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
220static inline long freezable_schedule_timeout_killable_unsafe(long timeout)
221{
222 long __retval;
223 freezer_do_not_count();
224 __retval = schedule_timeout_killable(timeout);
225 freezer_count_unsafe();
226 return __retval;
227}
228
229/*
230 * Like schedule_hrtimeout_range(), but should not block the freezer. Do not
231 * call this with locks held.
232 */
233static inline int freezable_schedule_hrtimeout_range(ktime_t *expires,
234 unsigned long delta, const enum hrtimer_mode mode)
235{
236 int __retval;
237 freezer_do_not_count();
238 __retval = schedule_hrtimeout_range(expires, delta, mode);
239 freezer_count();
240 return __retval;
241}
164 242
165/* 243/*
166 * Freezer-friendly wrappers around wait_event_interruptible(), 244 * Freezer-friendly wrappers around wait_event_interruptible(),
@@ -177,33 +255,45 @@ static inline bool freezer_should_skip(struct task_struct *p)
177 __retval; \ 255 __retval; \
178}) 256})
179 257
258/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
259#define wait_event_freezekillable_unsafe(wq, condition) \
260({ \
261 int __retval; \
262 freezer_do_not_count(); \
263 __retval = wait_event_killable(wq, (condition)); \
264 freezer_count_unsafe(); \
265 __retval; \
266})
267
180#define wait_event_freezable(wq, condition) \ 268#define wait_event_freezable(wq, condition) \
181({ \ 269({ \
182 int __retval; \ 270 int __retval; \
183 for (;;) { \ 271 freezer_do_not_count(); \
184 __retval = wait_event_interruptible(wq, \ 272 __retval = wait_event_interruptible(wq, (condition)); \
185 (condition) || freezing(current)); \ 273 freezer_count(); \
186 if (__retval || (condition)) \
187 break; \
188 try_to_freeze(); \
189 } \
190 __retval; \ 274 __retval; \
191}) 275})
192 276
193#define wait_event_freezable_timeout(wq, condition, timeout) \ 277#define wait_event_freezable_timeout(wq, condition, timeout) \
194({ \ 278({ \
195 long __retval = timeout; \ 279 long __retval = timeout; \
196 for (;;) { \ 280 freezer_do_not_count(); \
197 __retval = wait_event_interruptible_timeout(wq, \ 281 __retval = wait_event_interruptible_timeout(wq, (condition), \
198 (condition) || freezing(current), \ 282 __retval); \
199 __retval); \ 283 freezer_count(); \
200 if (__retval <= 0 || (condition)) \
201 break; \
202 try_to_freeze(); \
203 } \
204 __retval; \ 284 __retval; \
205}) 285})
206 286
287#define wait_event_freezable_exclusive(wq, condition) \
288({ \
289 int __retval; \
290 freezer_do_not_count(); \
291 __retval = wait_event_interruptible_exclusive(wq, condition); \
292 freezer_count(); \
293 __retval; \
294})
295
296
207#else /* !CONFIG_FREEZER */ 297#else /* !CONFIG_FREEZER */
208static inline bool frozen(struct task_struct *p) { return false; } 298static inline bool frozen(struct task_struct *p) { return false; }
209static inline bool freezing(struct task_struct *p) { return false; } 299static inline bool freezing(struct task_struct *p) { return false; }
@@ -225,18 +315,37 @@ static inline void set_freezable(void) {}
225 315
226#define freezable_schedule() schedule() 316#define freezable_schedule() schedule()
227 317
318#define freezable_schedule_unsafe() schedule()
319
320#define freezable_schedule_timeout(timeout) schedule_timeout(timeout)
321
322#define freezable_schedule_timeout_interruptible(timeout) \
323 schedule_timeout_interruptible(timeout)
324
228#define freezable_schedule_timeout_killable(timeout) \ 325#define freezable_schedule_timeout_killable(timeout) \
229 schedule_timeout_killable(timeout) 326 schedule_timeout_killable(timeout)
230 327
328#define freezable_schedule_timeout_killable_unsafe(timeout) \
329 schedule_timeout_killable(timeout)
330
331#define freezable_schedule_hrtimeout_range(expires, delta, mode) \
332 schedule_hrtimeout_range(expires, delta, mode)
333
231#define wait_event_freezable(wq, condition) \ 334#define wait_event_freezable(wq, condition) \
232 wait_event_interruptible(wq, condition) 335 wait_event_interruptible(wq, condition)
233 336
234#define wait_event_freezable_timeout(wq, condition, timeout) \ 337#define wait_event_freezable_timeout(wq, condition, timeout) \
235 wait_event_interruptible_timeout(wq, condition, timeout) 338 wait_event_interruptible_timeout(wq, condition, timeout)
236 339
340#define wait_event_freezable_exclusive(wq, condition) \
341 wait_event_interruptible_exclusive(wq, condition)
342
237#define wait_event_freezekillable(wq, condition) \ 343#define wait_event_freezekillable(wq, condition) \
238 wait_event_killable(wq, condition) 344 wait_event_killable(wq, condition)
239 345
346#define wait_event_freezekillable_unsafe(wq, condition) \
347 wait_event_killable(wq, condition)
348
240#endif /* !CONFIG_FREEZER */ 349#endif /* !CONFIG_FREEZER */
241 350
242#endif /* FREEZER_H_INCLUDED */ 351#endif /* FREEZER_H_INCLUDED */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 43db02e9c9fa..3f40547ba191 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -10,6 +10,8 @@
10#include <linux/stat.h> 10#include <linux/stat.h>
11#include <linux/cache.h> 11#include <linux/cache.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/list_lru.h>
14#include <linux/llist.h>
13#include <linux/radix-tree.h> 15#include <linux/radix-tree.h>
14#include <linux/rbtree.h> 16#include <linux/rbtree.h>
15#include <linux/init.h> 17#include <linux/init.h>
@@ -45,6 +47,7 @@ struct vfsmount;
45struct cred; 47struct cred;
46struct swap_info_struct; 48struct swap_info_struct;
47struct seq_file; 49struct seq_file;
50struct workqueue_struct;
48 51
49extern void __init inode_init(void); 52extern void __init inode_init(void);
50extern void __init inode_init_early(void); 53extern void __init inode_init_early(void);
@@ -62,8 +65,7 @@ struct buffer_head;
62typedef int (get_block_t)(struct inode *inode, sector_t iblock, 65typedef int (get_block_t)(struct inode *inode, sector_t iblock,
63 struct buffer_head *bh_result, int create); 66 struct buffer_head *bh_result, int create);
64typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, 67typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
65 ssize_t bytes, void *private, int ret, 68 ssize_t bytes, void *private);
66 bool is_async);
67 69
68#define MAY_EXEC 0x00000001 70#define MAY_EXEC 0x00000001
69#define MAY_WRITE 0x00000002 71#define MAY_WRITE 0x00000002
@@ -364,7 +366,7 @@ struct address_space_operations {
364 366
365 /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ 367 /* Unfortunately this kludge is needed for FIBMAP. Don't use it */
366 sector_t (*bmap)(struct address_space *, sector_t); 368 sector_t (*bmap)(struct address_space *, sector_t);
367 void (*invalidatepage) (struct page *, unsigned long); 369 void (*invalidatepage) (struct page *, unsigned int, unsigned int);
368 int (*releasepage) (struct page *, gfp_t); 370 int (*releasepage) (struct page *, gfp_t);
369 void (*freepage)(struct page *); 371 void (*freepage)(struct page *);
370 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 372 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
@@ -372,14 +374,15 @@ struct address_space_operations {
372 int (*get_xip_mem)(struct address_space *, pgoff_t, int, 374 int (*get_xip_mem)(struct address_space *, pgoff_t, int,
373 void **, unsigned long *); 375 void **, unsigned long *);
374 /* 376 /*
375 * migrate the contents of a page to the specified target. If sync 377 * migrate the contents of a page to the specified target. If
376 * is false, it must not block. 378 * migrate_mode is MIGRATE_ASYNC, it must not block.
377 */ 379 */
378 int (*migratepage) (struct address_space *, 380 int (*migratepage) (struct address_space *,
379 struct page *, struct page *, enum migrate_mode); 381 struct page *, struct page *, enum migrate_mode);
380 int (*launder_page) (struct page *); 382 int (*launder_page) (struct page *);
381 int (*is_partially_uptodate) (struct page *, read_descriptor_t *, 383 int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
382 unsigned long); 384 unsigned long);
385 void (*is_dirty_writeback) (struct page *, bool *, bool *);
383 int (*error_remove_page)(struct address_space *, struct page *); 386 int (*error_remove_page)(struct address_space *, struct page *);
384 387
385 /* swapfile support */ 388 /* swapfile support */
@@ -767,6 +770,7 @@ struct file {
767 */ 770 */
768 union { 771 union {
769 struct list_head fu_list; 772 struct list_head fu_list;
773 struct llist_node fu_llist;
770 struct rcu_head fu_rcuhead; 774 struct rcu_head fu_rcuhead;
771 } f_u; 775 } f_u;
772 struct path f_path; 776 struct path f_path;
@@ -908,6 +912,7 @@ struct file_lock_operations {
908 912
909struct lock_manager_operations { 913struct lock_manager_operations {
910 int (*lm_compare_owner)(struct file_lock *, struct file_lock *); 914 int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
915 unsigned long (*lm_owner_key)(struct file_lock *);
911 void (*lm_notify)(struct file_lock *); /* unblock callback */ 916 void (*lm_notify)(struct file_lock *); /* unblock callback */
912 int (*lm_grant)(struct file_lock *, struct file_lock *, int); 917 int (*lm_grant)(struct file_lock *, struct file_lock *, int);
913 void (*lm_break)(struct file_lock *); 918 void (*lm_break)(struct file_lock *);
@@ -926,14 +931,33 @@ int locks_in_grace(struct net *);
926/* that will die - we need it for nfs_lock_info */ 931/* that will die - we need it for nfs_lock_info */
927#include <linux/nfs_fs_i.h> 932#include <linux/nfs_fs_i.h>
928 933
934/*
935 * struct file_lock represents a generic "file lock". It's used to represent
936 * POSIX byte range locks, BSD (flock) locks, and leases. It's important to
937 * note that the same struct is used to represent both a request for a lock and
938 * the lock itself, but the same object is never used for both.
939 *
940 * FIXME: should we create a separate "struct lock_request" to help distinguish
941 * these two uses?
942 *
943 * The i_flock list is ordered by:
944 *
945 * 1) lock type -- FL_LEASEs first, then FL_FLOCK, and finally FL_POSIX
946 * 2) lock owner
947 * 3) lock range start
948 * 4) lock range end
949 *
950 * Obviously, the last two criteria only matter for POSIX locks.
951 */
929struct file_lock { 952struct file_lock {
930 struct file_lock *fl_next; /* singly linked list for this inode */ 953 struct file_lock *fl_next; /* singly linked list for this inode */
931 struct list_head fl_link; /* doubly linked list of all locks */ 954 struct hlist_node fl_link; /* node in global lists */
932 struct list_head fl_block; /* circular list of blocked processes */ 955 struct list_head fl_block; /* circular list of blocked processes */
933 fl_owner_t fl_owner; 956 fl_owner_t fl_owner;
934 unsigned int fl_flags; 957 unsigned int fl_flags;
935 unsigned char fl_type; 958 unsigned char fl_type;
936 unsigned int fl_pid; 959 unsigned int fl_pid;
960 int fl_link_cpu; /* what cpu's list is this on? */
937 struct pid *fl_nspid; 961 struct pid *fl_nspid;
938 wait_queue_head_t fl_wait; 962 wait_queue_head_t fl_wait;
939 struct file *fl_file; 963 struct file *fl_file;
@@ -994,7 +1018,7 @@ extern void locks_release_private(struct file_lock *);
994extern void posix_test_lock(struct file *, struct file_lock *); 1018extern void posix_test_lock(struct file *, struct file_lock *);
995extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); 1019extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
996extern int posix_lock_file_wait(struct file *, struct file_lock *); 1020extern int posix_lock_file_wait(struct file *, struct file_lock *);
997extern int posix_unblock_lock(struct file *, struct file_lock *); 1021extern int posix_unblock_lock(struct file_lock *);
998extern int vfs_test_lock(struct file *, struct file_lock *); 1022extern int vfs_test_lock(struct file *, struct file_lock *);
999extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); 1023extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
1000extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); 1024extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
@@ -1006,9 +1030,6 @@ extern int vfs_setlease(struct file *, long, struct file_lock **);
1006extern int lease_modify(struct file_lock **, int); 1030extern int lease_modify(struct file_lock **, int);
1007extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 1031extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1008extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 1032extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1009extern void locks_delete_block(struct file_lock *waiter);
1010extern void lock_flocks(void);
1011extern void unlock_flocks(void);
1012#else /* !CONFIG_FILE_LOCKING */ 1033#else /* !CONFIG_FILE_LOCKING */
1013static inline int fcntl_getlk(struct file *file, struct flock __user *user) 1034static inline int fcntl_getlk(struct file *file, struct flock __user *user)
1014{ 1035{
@@ -1084,8 +1105,7 @@ static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl)
1084 return -ENOLCK; 1105 return -ENOLCK;
1085} 1106}
1086 1107
1087static inline int posix_unblock_lock(struct file *filp, 1108static inline int posix_unblock_lock(struct file_lock *waiter)
1088 struct file_lock *waiter)
1089{ 1109{
1090 return -ENOENT; 1110 return -ENOENT;
1091} 1111}
@@ -1150,19 +1170,6 @@ static inline int lock_may_write(struct inode *inode, loff_t start,
1150{ 1170{
1151 return 1; 1171 return 1;
1152} 1172}
1153
1154static inline void locks_delete_block(struct file_lock *waiter)
1155{
1156}
1157
1158static inline void lock_flocks(void)
1159{
1160}
1161
1162static inline void unlock_flocks(void)
1163{
1164}
1165
1166#endif /* !CONFIG_FILE_LOCKING */ 1173#endif /* !CONFIG_FILE_LOCKING */
1167 1174
1168 1175
@@ -1263,15 +1270,6 @@ struct super_block {
1263 struct list_head s_files; 1270 struct list_head s_files;
1264#endif 1271#endif
1265 struct list_head s_mounts; /* list of mounts; _not_ for fs use */ 1272 struct list_head s_mounts; /* list of mounts; _not_ for fs use */
1266 /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */
1267 struct list_head s_dentry_lru; /* unused dentry lru */
1268 int s_nr_dentry_unused; /* # of dentry on lru */
1269
1270 /* s_inode_lru_lock protects s_inode_lru and s_nr_inodes_unused */
1271 spinlock_t s_inode_lru_lock ____cacheline_aligned_in_smp;
1272 struct list_head s_inode_lru; /* unused inode lru */
1273 int s_nr_inodes_unused; /* # of inodes on lru */
1274
1275 struct block_device *s_bdev; 1273 struct block_device *s_bdev;
1276 struct backing_dev_info *s_bdi; 1274 struct backing_dev_info *s_bdi;
1277 struct mtd_info *s_mtd; 1275 struct mtd_info *s_mtd;
@@ -1322,11 +1320,17 @@ struct super_block {
1322 1320
1323 /* Being remounted read-only */ 1321 /* Being remounted read-only */
1324 int s_readonly_remount; 1322 int s_readonly_remount;
1325};
1326 1323
1327/* superblock cache pruning functions */ 1324 /* AIO completions deferred from interrupt context */
1328extern void prune_icache_sb(struct super_block *sb, int nr_to_scan); 1325 struct workqueue_struct *s_dio_done_wq;
1329extern void prune_dcache_sb(struct super_block *sb, int nr_to_scan); 1326
1327 /*
1328 * Keep the lru lists last in the structure so they always sit on their
1329 * own individual cachelines.
1330 */
1331 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp;
1332 struct list_lru s_inode_lru ____cacheline_aligned_in_smp;
1333};
1330 1334
1331extern struct timespec current_fs_time(struct super_block *sb); 1335extern struct timespec current_fs_time(struct super_block *sb);
1332 1336
@@ -1506,6 +1510,11 @@ int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags);
1506 * to have different dirent layouts depending on the binary type. 1510 * to have different dirent layouts depending on the binary type.
1507 */ 1511 */
1508typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); 1512typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
1513struct dir_context {
1514 const filldir_t actor;
1515 loff_t pos;
1516};
1517
1509struct block_device_operations; 1518struct block_device_operations;
1510 1519
1511/* These macros are for out of kernel modules to test that 1520/* These macros are for out of kernel modules to test that
@@ -1521,7 +1530,7 @@ struct file_operations {
1521 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); 1530 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
1522 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 1531 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1523 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 1532 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1524 int (*readdir) (struct file *, void *, filldir_t); 1533 int (*iterate) (struct file *, struct dir_context *);
1525 unsigned int (*poll) (struct file *, struct poll_table_struct *); 1534 unsigned int (*poll) (struct file *, struct poll_table_struct *);
1526 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 1535 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
1527 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 1536 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
@@ -1575,6 +1584,7 @@ struct inode_operations {
1575 int (*atomic_open)(struct inode *, struct dentry *, 1584 int (*atomic_open)(struct inode *, struct dentry *,
1576 struct file *, unsigned open_flag, 1585 struct file *, unsigned open_flag,
1577 umode_t create_mode, int *opened); 1586 umode_t create_mode, int *opened);
1587 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
1578} ____cacheline_aligned; 1588} ____cacheline_aligned;
1579 1589
1580ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, 1590ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
@@ -1614,8 +1624,8 @@ struct super_operations {
1614 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1624 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
1615#endif 1625#endif
1616 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); 1626 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
1617 int (*nr_cached_objects)(struct super_block *); 1627 long (*nr_cached_objects)(struct super_block *, int);
1618 void (*free_cached_objects)(struct super_block *, int); 1628 long (*free_cached_objects)(struct super_block *, long, int);
1619}; 1629};
1620 1630
1621/* 1631/*
@@ -1738,6 +1748,7 @@ struct super_operations {
1738#define I_REFERENCED (1 << 8) 1748#define I_REFERENCED (1 << 8)
1739#define __I_DIO_WAKEUP 9 1749#define __I_DIO_WAKEUP 9
1740#define I_DIO_WAKEUP (1 << I_DIO_WAKEUP) 1750#define I_DIO_WAKEUP (1 << I_DIO_WAKEUP)
1751#define I_LINKABLE (1 << 10)
1741 1752
1742#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) 1753#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
1743 1754
@@ -1791,7 +1802,7 @@ enum file_time_flags {
1791 S_VERSION = 8, 1802 S_VERSION = 8,
1792}; 1803};
1793 1804
1794extern void touch_atime(struct path *); 1805extern void touch_atime(const struct path *);
1795static inline void file_accessed(struct file *file) 1806static inline void file_accessed(struct file *file)
1796{ 1807{
1797 if (!(file->f_flags & O_NOATIME)) 1808 if (!(file->f_flags & O_NOATIME))
@@ -1884,6 +1895,7 @@ extern int vfs_ustat(dev_t, struct kstatfs *);
1884extern int freeze_super(struct super_block *super); 1895extern int freeze_super(struct super_block *super);
1885extern int thaw_super(struct super_block *super); 1896extern int thaw_super(struct super_block *super);
1886extern bool our_mnt(struct vfsmount *mnt); 1897extern bool our_mnt(struct vfsmount *mnt);
1898extern bool fs_fully_visible(struct file_system_type *);
1887 1899
1888extern int current_umask(void); 1900extern int current_umask(void);
1889 1901
@@ -1891,7 +1903,6 @@ extern int current_umask(void);
1891extern struct kobject *fs_kobj; 1903extern struct kobject *fs_kobj;
1892 1904
1893#define MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK) 1905#define MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK)
1894extern int rw_verify_area(int, struct file *, loff_t *, size_t);
1895 1906
1896#define FLOCK_VERIFY_READ 1 1907#define FLOCK_VERIFY_READ 1
1897#define FLOCK_VERIFY_WRITE 2 1908#define FLOCK_VERIFY_WRITE 2
@@ -2058,6 +2069,7 @@ extern struct super_block *freeze_bdev(struct block_device *);
2058extern void emergency_thaw_all(void); 2069extern void emergency_thaw_all(void);
2059extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); 2070extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
2060extern int fsync_bdev(struct block_device *); 2071extern int fsync_bdev(struct block_device *);
2072extern int sb_is_blkdev_sb(struct super_block *sb);
2061#else 2073#else
2062static inline void bd_forget(struct inode *inode) {} 2074static inline void bd_forget(struct inode *inode) {}
2063static inline int sync_blockdev(struct block_device *bdev) { return 0; } 2075static inline int sync_blockdev(struct block_device *bdev) { return 0; }
@@ -2077,6 +2089,11 @@ static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
2077static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg) 2089static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg)
2078{ 2090{
2079} 2091}
2092
2093static inline int sb_is_blkdev_sb(struct super_block *sb)
2094{
2095 return 0;
2096}
2080#endif 2097#endif
2081extern int sync_filesystem(struct super_block *); 2098extern int sync_filesystem(struct super_block *);
2082extern const struct file_operations def_blk_fops; 2099extern const struct file_operations def_blk_fops;
@@ -2304,7 +2321,6 @@ extern struct file * open_exec(const char *);
2304/* fs/dcache.c -- generic fs support functions */ 2321/* fs/dcache.c -- generic fs support functions */
2305extern int is_subdir(struct dentry *, struct dentry *); 2322extern int is_subdir(struct dentry *, struct dentry *);
2306extern int path_is_under(struct path *, struct path *); 2323extern int path_is_under(struct path *, struct path *);
2307extern ino_t find_inode_number(struct dentry *, struct qstr *);
2308 2324
2309#include <linux/err.h> 2325#include <linux/err.h>
2310 2326
@@ -2414,16 +2430,17 @@ extern ssize_t generic_file_splice_write(struct pipe_inode_info *,
2414 struct file *, loff_t *, size_t, unsigned int); 2430 struct file *, loff_t *, size_t, unsigned int);
2415extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, 2431extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
2416 struct file *out, loff_t *, size_t len, unsigned int flags); 2432 struct file *out, loff_t *, size_t len, unsigned int flags);
2417extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
2418 size_t len, unsigned int flags);
2419 2433
2420extern void 2434extern void
2421file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 2435file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
2422extern loff_t noop_llseek(struct file *file, loff_t offset, int whence); 2436extern loff_t noop_llseek(struct file *file, loff_t offset, int whence);
2423extern loff_t no_llseek(struct file *file, loff_t offset, int whence); 2437extern loff_t no_llseek(struct file *file, loff_t offset, int whence);
2438extern loff_t vfs_setpos(struct file *file, loff_t offset, loff_t maxsize);
2424extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence); 2439extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence);
2425extern loff_t generic_file_llseek_size(struct file *file, loff_t offset, 2440extern loff_t generic_file_llseek_size(struct file *file, loff_t offset,
2426 int whence, loff_t maxsize, loff_t eof); 2441 int whence, loff_t maxsize, loff_t eof);
2442extern loff_t fixed_size_llseek(struct file *file, loff_t offset,
2443 int whence, loff_t size);
2427extern int generic_file_open(struct inode * inode, struct file * filp); 2444extern int generic_file_open(struct inode * inode, struct file * filp);
2428extern int nonseekable_open(struct inode * inode, struct file * filp); 2445extern int nonseekable_open(struct inode * inode, struct file * filp);
2429 2446
@@ -2478,7 +2495,6 @@ extern const struct file_operations generic_ro_fops;
2478#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) 2495#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
2479 2496
2480extern int vfs_readlink(struct dentry *, char __user *, int, const char *); 2497extern int vfs_readlink(struct dentry *, char __user *, int, const char *);
2481extern int vfs_follow_link(struct nameidata *, const char *);
2482extern int page_readlink(struct dentry *, char __user *, int); 2498extern int page_readlink(struct dentry *, char __user *, int);
2483extern void *page_follow_link_light(struct dentry *, struct nameidata *); 2499extern void *page_follow_link_light(struct dentry *, struct nameidata *);
2484extern void page_put_link(struct dentry *, struct nameidata *, void *); 2500extern void page_put_link(struct dentry *, struct nameidata *, void *);
@@ -2491,11 +2507,13 @@ extern void generic_fillattr(struct inode *, struct kstat *);
2491extern int vfs_getattr(struct path *, struct kstat *); 2507extern int vfs_getattr(struct path *, struct kstat *);
2492void __inode_add_bytes(struct inode *inode, loff_t bytes); 2508void __inode_add_bytes(struct inode *inode, loff_t bytes);
2493void inode_add_bytes(struct inode *inode, loff_t bytes); 2509void inode_add_bytes(struct inode *inode, loff_t bytes);
2510void __inode_sub_bytes(struct inode *inode, loff_t bytes);
2494void inode_sub_bytes(struct inode *inode, loff_t bytes); 2511void inode_sub_bytes(struct inode *inode, loff_t bytes);
2495loff_t inode_get_bytes(struct inode *inode); 2512loff_t inode_get_bytes(struct inode *inode);
2496void inode_set_bytes(struct inode *inode, loff_t bytes); 2513void inode_set_bytes(struct inode *inode, loff_t bytes);
2497 2514
2498extern int vfs_readdir(struct file *, filldir_t, void *); 2515extern int vfs_readdir(struct file *, filldir_t, void *);
2516extern int iterate_dir(struct file *, struct dir_context *);
2499 2517
2500extern int vfs_stat(const char __user *, struct kstat *); 2518extern int vfs_stat(const char __user *, struct kstat *);
2501extern int vfs_lstat(const char __user *, struct kstat *); 2519extern int vfs_lstat(const char __user *, struct kstat *);
@@ -2526,7 +2544,7 @@ extern void iterate_supers_type(struct file_system_type *,
2526extern int dcache_dir_open(struct inode *, struct file *); 2544extern int dcache_dir_open(struct inode *, struct file *);
2527extern int dcache_dir_close(struct inode *, struct file *); 2545extern int dcache_dir_close(struct inode *, struct file *);
2528extern loff_t dcache_dir_lseek(struct file *, loff_t, int); 2546extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
2529extern int dcache_readdir(struct file *, void *, filldir_t); 2547extern int dcache_readdir(struct file *, struct dir_context *);
2530extern int simple_setattr(struct dentry *, struct iattr *); 2548extern int simple_setattr(struct dentry *, struct iattr *);
2531extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2549extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
2532extern int simple_statfs(struct dentry *, struct kstatfs *); 2550extern int simple_statfs(struct dentry *, struct kstatfs *);
@@ -2690,4 +2708,41 @@ static inline void inode_has_no_xattr(struct inode *inode)
2690 inode->i_flags |= S_NOSEC; 2708 inode->i_flags |= S_NOSEC;
2691} 2709}
2692 2710
2711static inline bool dir_emit(struct dir_context *ctx,
2712 const char *name, int namelen,
2713 u64 ino, unsigned type)
2714{
2715 return ctx->actor(ctx, name, namelen, ctx->pos, ino, type) == 0;
2716}
2717static inline bool dir_emit_dot(struct file *file, struct dir_context *ctx)
2718{
2719 return ctx->actor(ctx, ".", 1, ctx->pos,
2720 file->f_path.dentry->d_inode->i_ino, DT_DIR) == 0;
2721}
2722static inline bool dir_emit_dotdot(struct file *file, struct dir_context *ctx)
2723{
2724 return ctx->actor(ctx, "..", 2, ctx->pos,
2725 parent_ino(file->f_path.dentry), DT_DIR) == 0;
2726}
2727static inline bool dir_emit_dots(struct file *file, struct dir_context *ctx)
2728{
2729 if (ctx->pos == 0) {
2730 if (!dir_emit_dot(file, ctx))
2731 return false;
2732 ctx->pos = 1;
2733 }
2734 if (ctx->pos == 1) {
2735 if (!dir_emit_dotdot(file, ctx))
2736 return false;
2737 ctx->pos = 2;
2738 }
2739 return true;
2740}
2741static inline bool dir_relax(struct inode *inode)
2742{
2743 mutex_unlock(&inode->i_mutex);
2744 mutex_lock(&inode->i_mutex);
2745 return !IS_DEADDIR(inode);
2746}
2747
2693#endif /* _LINUX_FS_H */ 2748#endif /* _LINUX_FS_H */
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index 51b793466ff3..efb05961bdd8 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -16,8 +16,10 @@
16#ifndef FS_ENET_PD_H 16#ifndef FS_ENET_PD_H
17#define FS_ENET_PD_H 17#define FS_ENET_PD_H
18 18
19#include <linux/clk.h>
19#include <linux/string.h> 20#include <linux/string.h>
20#include <linux/of_mdio.h> 21#include <linux/of_mdio.h>
22#include <linux/if_ether.h>
21#include <asm/types.h> 23#include <asm/types.h>
22 24
23#define FS_ENET_NAME "fs_enet" 25#define FS_ENET_NAME "fs_enet"
@@ -135,13 +137,15 @@ struct fs_platform_info {
135 const struct fs_mii_bus_info *bus_info; 137 const struct fs_mii_bus_info *bus_info;
136 138
137 int rx_ring, tx_ring; /* number of buffers on rx */ 139 int rx_ring, tx_ring; /* number of buffers on rx */
138 __u8 macaddr[6]; /* mac address */ 140 __u8 macaddr[ETH_ALEN]; /* mac address */
139 int rx_copybreak; /* limit we copy small frames */ 141 int rx_copybreak; /* limit we copy small frames */
140 int use_napi; /* use NAPI */ 142 int use_napi; /* use NAPI */
141 int napi_weight; /* NAPI weight */ 143 int napi_weight; /* NAPI weight */
142 144
143 int use_rmii; /* use RMII mode */ 145 int use_rmii; /* use RMII mode */
144 int has_phy; /* if the network is phy container as well...*/ 146 int has_phy; /* if the network is phy container as well...*/
147
148 struct clk *clk_per; /* 'per' clock for register access */
145}; 149};
146struct fs_mii_fec_platform_info { 150struct fs_mii_fec_platform_info {
147 u32 irq[32]; 151 u32 irq[32];
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 2b93a9a5a1e6..0efc3e62843a 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -39,17 +39,6 @@ static inline void get_fs_pwd(struct fs_struct *fs, struct path *pwd)
39 spin_unlock(&fs->lock); 39 spin_unlock(&fs->lock);
40} 40}
41 41
42static inline void get_fs_root_and_pwd(struct fs_struct *fs, struct path *root,
43 struct path *pwd)
44{
45 spin_lock(&fs->lock);
46 *root = fs->root;
47 path_get(root);
48 *pwd = fs->pwd;
49 path_get(pwd);
50 spin_unlock(&fs->lock);
51}
52
53extern bool current_chrooted(void); 42extern bool current_chrooted(void);
54 43
55#endif /* _LINUX_FS_STRUCT_H */ 44#endif /* _LINUX_FS_STRUCT_H */
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index 5dfa0aa216b6..7823e9ef995e 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -97,7 +97,8 @@ struct fscache_operation {
97#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */ 97#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */
98#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */ 98#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */
99#define FSCACHE_OP_DEC_READ_CNT 6 /* decrement object->n_reads on destruction */ 99#define FSCACHE_OP_DEC_READ_CNT 6 /* decrement object->n_reads on destruction */
100#define FSCACHE_OP_KEEP_FLAGS 0x0070 /* flags to keep when repurposing an op */ 100#define FSCACHE_OP_UNUSE_COOKIE 7 /* call fscache_unuse_cookie() on completion */
101#define FSCACHE_OP_KEEP_FLAGS 0x00f0 /* flags to keep when repurposing an op */
101 102
102 enum fscache_operation_state state; 103 enum fscache_operation_state state;
103 atomic_t usage; 104 atomic_t usage;
@@ -150,7 +151,7 @@ struct fscache_retrieval {
150 void *context; /* netfs read context (pinned) */ 151 void *context; /* netfs read context (pinned) */
151 struct list_head to_do; /* list of things to be done by the backend */ 152 struct list_head to_do; /* list of things to be done by the backend */
152 unsigned long start_time; /* time at which retrieval started */ 153 unsigned long start_time; /* time at which retrieval started */
153 unsigned n_pages; /* number of pages to be retrieved */ 154 atomic_t n_pages; /* number of pages to be retrieved */
154}; 155};
155 156
156typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op, 157typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op,
@@ -194,15 +195,14 @@ static inline void fscache_enqueue_retrieval(struct fscache_retrieval *op)
194static inline void fscache_retrieval_complete(struct fscache_retrieval *op, 195static inline void fscache_retrieval_complete(struct fscache_retrieval *op,
195 int n_pages) 196 int n_pages)
196{ 197{
197 op->n_pages -= n_pages; 198 atomic_sub(n_pages, &op->n_pages);
198 if (op->n_pages <= 0) 199 if (atomic_read(&op->n_pages) <= 0)
199 fscache_op_complete(&op->op, true); 200 fscache_op_complete(&op->op, true);
200} 201}
201 202
202/** 203/**
203 * fscache_put_retrieval - Drop a reference to a retrieval operation 204 * fscache_put_retrieval - Drop a reference to a retrieval operation
204 * @op: The retrieval operation affected 205 * @op: The retrieval operation affected
205 * @n_pages: The number of pages to account for
206 * 206 *
207 * Drop a reference to a retrieval operation. 207 * Drop a reference to a retrieval operation.
208 */ 208 */
@@ -251,6 +251,10 @@ struct fscache_cache_ops {
251 /* unpin an object in the cache */ 251 /* unpin an object in the cache */
252 void (*unpin_object)(struct fscache_object *object); 252 void (*unpin_object)(struct fscache_object *object);
253 253
254 /* check the consistency between the backing cache and the FS-Cache
255 * cookie */
256 bool (*check_consistency)(struct fscache_operation *op);
257
254 /* store the updated auxiliary data on an object */ 258 /* store the updated auxiliary data on an object */
255 void (*update_object)(struct fscache_object *object); 259 void (*update_object)(struct fscache_object *object);
256 260
@@ -314,6 +318,7 @@ struct fscache_cache_ops {
314struct fscache_cookie { 318struct fscache_cookie {
315 atomic_t usage; /* number of users of this cookie */ 319 atomic_t usage; /* number of users of this cookie */
316 atomic_t n_children; /* number of children of this cookie */ 320 atomic_t n_children; /* number of children of this cookie */
321 atomic_t n_active; /* number of active users of netfs ptrs */
317 spinlock_t lock; 322 spinlock_t lock;
318 spinlock_t stores_lock; /* lock on page store tree */ 323 spinlock_t stores_lock; /* lock on page store tree */
319 struct hlist_head backing_objects; /* object(s) backing this file/index */ 324 struct hlist_head backing_objects; /* object(s) backing this file/index */
@@ -326,13 +331,11 @@ struct fscache_cookie {
326 331
327 unsigned long flags; 332 unsigned long flags;
328#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */ 333#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */
329#define FSCACHE_COOKIE_CREATING 1 /* T if non-index object being created still */ 334#define FSCACHE_COOKIE_NO_DATA_YET 1 /* T if new object with no cached data yet */
330#define FSCACHE_COOKIE_NO_DATA_YET 2 /* T if new object with no cached data yet */ 335#define FSCACHE_COOKIE_UNAVAILABLE 2 /* T if cookie is unavailable (error, etc) */
331#define FSCACHE_COOKIE_PENDING_FILL 3 /* T if pending initial fill on object */ 336#define FSCACHE_COOKIE_INVALIDATING 3 /* T if cookie is being invalidated */
332#define FSCACHE_COOKIE_FILLING 4 /* T if filling object incrementally */ 337#define FSCACHE_COOKIE_RELINQUISHED 4 /* T if cookie has been relinquished */
333#define FSCACHE_COOKIE_UNAVAILABLE 5 /* T if cookie is unavailable (error, etc) */ 338#define FSCACHE_COOKIE_RETIRED 5 /* T if cookie was retired */
334#define FSCACHE_COOKIE_WAITING_ON_READS 6 /* T if cookie is waiting on reads */
335#define FSCACHE_COOKIE_INVALIDATING 7 /* T if cookie is being invalidated */
336}; 339};
337 340
338extern struct fscache_cookie fscache_fsdef_index; 341extern struct fscache_cookie fscache_fsdef_index;
@@ -341,45 +344,40 @@ extern struct fscache_cookie fscache_fsdef_index;
341 * Event list for fscache_object::{event_mask,events} 344 * Event list for fscache_object::{event_mask,events}
342 */ 345 */
343enum { 346enum {
344 FSCACHE_OBJECT_EV_REQUEUE, /* T if object should be requeued */ 347 FSCACHE_OBJECT_EV_NEW_CHILD, /* T if object has a new child */
348 FSCACHE_OBJECT_EV_PARENT_READY, /* T if object's parent is ready */
345 FSCACHE_OBJECT_EV_UPDATE, /* T if object should be updated */ 349 FSCACHE_OBJECT_EV_UPDATE, /* T if object should be updated */
346 FSCACHE_OBJECT_EV_INVALIDATE, /* T if cache requested object invalidation */ 350 FSCACHE_OBJECT_EV_INVALIDATE, /* T if cache requested object invalidation */
347 FSCACHE_OBJECT_EV_CLEARED, /* T if accessors all gone */ 351 FSCACHE_OBJECT_EV_CLEARED, /* T if accessors all gone */
348 FSCACHE_OBJECT_EV_ERROR, /* T if fatal error occurred during processing */ 352 FSCACHE_OBJECT_EV_ERROR, /* T if fatal error occurred during processing */
349 FSCACHE_OBJECT_EV_RELEASE, /* T if netfs requested object release */ 353 FSCACHE_OBJECT_EV_KILL, /* T if netfs relinquished or cache withdrew object */
350 FSCACHE_OBJECT_EV_RETIRE, /* T if netfs requested object retirement */
351 FSCACHE_OBJECT_EV_WITHDRAW, /* T if cache requested object withdrawal */
352 NR_FSCACHE_OBJECT_EVENTS 354 NR_FSCACHE_OBJECT_EVENTS
353}; 355};
354 356
355#define FSCACHE_OBJECT_EVENTS_MASK ((1UL << NR_FSCACHE_OBJECT_EVENTS) - 1) 357#define FSCACHE_OBJECT_EVENTS_MASK ((1UL << NR_FSCACHE_OBJECT_EVENTS) - 1)
356 358
357/* 359/*
360 * States for object state machine.
361 */
362struct fscache_transition {
363 unsigned long events;
364 const struct fscache_state *transit_to;
365};
366
367struct fscache_state {
368 char name[24];
369 char short_name[8];
370 const struct fscache_state *(*work)(struct fscache_object *object,
371 int event);
372 const struct fscache_transition transitions[];
373};
374
375/*
358 * on-disk cache file or index handle 376 * on-disk cache file or index handle
359 */ 377 */
360struct fscache_object { 378struct fscache_object {
361 enum fscache_object_state { 379 const struct fscache_state *state; /* Object state machine state */
362 FSCACHE_OBJECT_INIT, /* object in initial unbound state */ 380 const struct fscache_transition *oob_table; /* OOB state transition table */
363 FSCACHE_OBJECT_LOOKING_UP, /* looking up object */
364 FSCACHE_OBJECT_CREATING, /* creating object */
365
366 /* active states */
367 FSCACHE_OBJECT_AVAILABLE, /* cleaning up object after creation */
368 FSCACHE_OBJECT_ACTIVE, /* object is usable */
369 FSCACHE_OBJECT_INVALIDATING, /* object is invalidating */
370 FSCACHE_OBJECT_UPDATING, /* object is updating */
371
372 /* terminal states */
373 FSCACHE_OBJECT_DYING, /* object waiting for accessors to finish */
374 FSCACHE_OBJECT_LC_DYING, /* object cleaning up after lookup/create */
375 FSCACHE_OBJECT_ABORT_INIT, /* abort the init state */
376 FSCACHE_OBJECT_RELEASING, /* releasing object */
377 FSCACHE_OBJECT_RECYCLING, /* retiring object */
378 FSCACHE_OBJECT_WITHDRAWING, /* withdrawing object */
379 FSCACHE_OBJECT_DEAD, /* object is now dead */
380 FSCACHE_OBJECT__NSTATES
381 } state;
382
383 int debug_id; /* debugging ID */ 381 int debug_id; /* debugging ID */
384 int n_children; /* number of child objects */ 382 int n_children; /* number of child objects */
385 int n_ops; /* number of extant ops on object */ 383 int n_ops; /* number of extant ops on object */
@@ -390,6 +388,7 @@ struct fscache_object {
390 spinlock_t lock; /* state and operations lock */ 388 spinlock_t lock; /* state and operations lock */
391 389
392 unsigned long lookup_jif; /* time at which lookup started */ 390 unsigned long lookup_jif; /* time at which lookup started */
391 unsigned long oob_event_mask; /* OOB events this object is interested in */
393 unsigned long event_mask; /* events this object is interested in */ 392 unsigned long event_mask; /* events this object is interested in */
394 unsigned long events; /* events to be processed by this object 393 unsigned long events; /* events to be processed by this object
395 * (order is important - using fls) */ 394 * (order is important - using fls) */
@@ -398,6 +397,9 @@ struct fscache_object {
398#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */ 397#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */
399#define FSCACHE_OBJECT_PENDING_WRITE 1 /* T if object has pending write */ 398#define FSCACHE_OBJECT_PENDING_WRITE 1 /* T if object has pending write */
400#define FSCACHE_OBJECT_WAITING 2 /* T if object is waiting on its parent */ 399#define FSCACHE_OBJECT_WAITING 2 /* T if object is waiting on its parent */
400#define FSCACHE_OBJECT_IS_LIVE 3 /* T if object is not withdrawn or relinquished */
401#define FSCACHE_OBJECT_IS_LOOKED_UP 4 /* T if object has been looked up */
402#define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */
401 403
402 struct list_head cache_link; /* link in cache->object_list */ 404 struct list_head cache_link; /* link in cache->object_list */
403 struct hlist_node cookie_link; /* link in cookie->backing_objects */ 405 struct hlist_node cookie_link; /* link in cookie->backing_objects */
@@ -415,62 +417,40 @@ struct fscache_object {
415 loff_t store_limit_l; /* current storage limit */ 417 loff_t store_limit_l; /* current storage limit */
416}; 418};
417 419
418extern const char *fscache_object_states[]; 420extern void fscache_object_init(struct fscache_object *, struct fscache_cookie *,
421 struct fscache_cache *);
422extern void fscache_object_destroy(struct fscache_object *);
419 423
420#define fscache_object_is_active(obj) \ 424extern void fscache_object_lookup_negative(struct fscache_object *object);
421 (!test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \ 425extern void fscache_obtained_object(struct fscache_object *object);
422 (obj)->state >= FSCACHE_OBJECT_AVAILABLE && \
423 (obj)->state < FSCACHE_OBJECT_DYING)
424 426
425#define fscache_object_is_dead(obj) \ 427static inline bool fscache_object_is_live(struct fscache_object *object)
426 (test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \ 428{
427 (obj)->state >= FSCACHE_OBJECT_DYING) 429 return test_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags);
430}
428 431
429extern void fscache_object_work_func(struct work_struct *work); 432static inline bool fscache_object_is_dying(struct fscache_object *object)
433{
434 return !fscache_object_is_live(object);
435}
430 436
431/** 437static inline bool fscache_object_is_available(struct fscache_object *object)
432 * fscache_object_init - Initialise a cache object description
433 * @object: Object description
434 *
435 * Initialise a cache object description to its basic values.
436 *
437 * See Documentation/filesystems/caching/backend-api.txt for a complete
438 * description.
439 */
440static inline
441void fscache_object_init(struct fscache_object *object,
442 struct fscache_cookie *cookie,
443 struct fscache_cache *cache)
444{ 438{
445 atomic_inc(&cache->object_count); 439 return test_bit(FSCACHE_OBJECT_IS_AVAILABLE, &object->flags);
446
447 object->state = FSCACHE_OBJECT_INIT;
448 spin_lock_init(&object->lock);
449 INIT_LIST_HEAD(&object->cache_link);
450 INIT_HLIST_NODE(&object->cookie_link);
451 INIT_WORK(&object->work, fscache_object_work_func);
452 INIT_LIST_HEAD(&object->dependents);
453 INIT_LIST_HEAD(&object->dep_link);
454 INIT_LIST_HEAD(&object->pending_ops);
455 object->n_children = 0;
456 object->n_ops = object->n_in_progress = object->n_exclusive = 0;
457 object->events = object->event_mask = 0;
458 object->flags = 0;
459 object->store_limit = 0;
460 object->store_limit_l = 0;
461 object->cache = cache;
462 object->cookie = cookie;
463 object->parent = NULL;
464} 440}
465 441
466extern void fscache_object_lookup_negative(struct fscache_object *object); 442static inline bool fscache_object_is_active(struct fscache_object *object)
467extern void fscache_obtained_object(struct fscache_object *object); 443{
444 return fscache_object_is_available(object) &&
445 fscache_object_is_live(object) &&
446 !test_bit(FSCACHE_IOERROR, &object->cache->flags);
447}
468 448
469#ifdef CONFIG_FSCACHE_OBJECT_LIST 449static inline bool fscache_object_is_dead(struct fscache_object *object)
470extern void fscache_object_destroy(struct fscache_object *object); 450{
471#else 451 return fscache_object_is_dying(object) &&
472#define fscache_object_destroy(object) do {} while(0) 452 test_bit(FSCACHE_IOERROR, &object->cache->flags);
473#endif 453}
474 454
475/** 455/**
476 * fscache_object_destroyed - Note destruction of an object in a cache 456 * fscache_object_destroyed - Note destruction of an object in a cache
@@ -531,6 +511,33 @@ static inline void fscache_end_io(struct fscache_retrieval *op,
531 op->end_io_func(page, op->context, error); 511 op->end_io_func(page, op->context, error);
532} 512}
533 513
514/**
515 * fscache_use_cookie - Request usage of cookie attached to an object
516 * @object: Object description
517 *
518 * Request usage of the cookie attached to an object. NULL is returned if the
519 * relinquishment had reduced the cookie usage count to 0.
520 */
521static inline bool fscache_use_cookie(struct fscache_object *object)
522{
523 struct fscache_cookie *cookie = object->cookie;
524 return atomic_inc_not_zero(&cookie->n_active) != 0;
525}
526
527/**
528 * fscache_unuse_cookie - Cease usage of cookie attached to an object
529 * @object: Object description
530 *
531 * Cease usage of the cookie attached to an object. When the users count
532 * reaches zero then the cookie relinquishment will be permitted to proceed.
533 */
534static inline void fscache_unuse_cookie(struct fscache_object *object)
535{
536 struct fscache_cookie *cookie = object->cookie;
537 if (atomic_dec_and_test(&cookie->n_active))
538 wake_up_atomic_t(&cookie->n_active);
539}
540
534/* 541/*
535 * out-of-line cache backend functions 542 * out-of-line cache backend functions
536 */ 543 */
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 7a086235da4b..19b46458e4e8 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -183,6 +183,7 @@ extern struct fscache_cookie *__fscache_acquire_cookie(
183 const struct fscache_cookie_def *, 183 const struct fscache_cookie_def *,
184 void *); 184 void *);
185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int); 185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int);
186extern int __fscache_check_consistency(struct fscache_cookie *);
186extern void __fscache_update_cookie(struct fscache_cookie *); 187extern void __fscache_update_cookie(struct fscache_cookie *);
187extern int __fscache_attr_changed(struct fscache_cookie *); 188extern int __fscache_attr_changed(struct fscache_cookie *);
188extern void __fscache_invalidate(struct fscache_cookie *); 189extern void __fscache_invalidate(struct fscache_cookie *);
@@ -208,6 +209,8 @@ extern bool __fscache_maybe_release_page(struct fscache_cookie *, struct page *,
208 gfp_t); 209 gfp_t);
209extern void __fscache_uncache_all_inode_pages(struct fscache_cookie *, 210extern void __fscache_uncache_all_inode_pages(struct fscache_cookie *,
210 struct inode *); 211 struct inode *);
212extern void __fscache_readpages_cancel(struct fscache_cookie *cookie,
213 struct list_head *pages);
211 214
212/** 215/**
213 * fscache_register_netfs - Register a filesystem as desiring caching services 216 * fscache_register_netfs - Register a filesystem as desiring caching services
@@ -326,6 +329,25 @@ void fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire)
326} 329}
327 330
328/** 331/**
332 * fscache_check_consistency - Request that if the cache is updated
333 * @cookie: The cookie representing the cache object
334 *
335 * Request an consistency check from fscache, which passes the request
336 * to the backing cache.
337 *
338 * Returns 0 if consistent and -ESTALE if inconsistent. May also
339 * return -ENOMEM and -ERESTARTSYS.
340 */
341static inline
342int fscache_check_consistency(struct fscache_cookie *cookie)
343{
344 if (fscache_cookie_valid(cookie))
345 return __fscache_check_consistency(cookie);
346 else
347 return 0;
348}
349
350/**
329 * fscache_update_cookie - Request that a cache object be updated 351 * fscache_update_cookie - Request that a cache object be updated
330 * @cookie: The cookie representing the cache object 352 * @cookie: The cookie representing the cache object
331 * 353 *
@@ -570,6 +592,26 @@ int fscache_alloc_page(struct fscache_cookie *cookie,
570} 592}
571 593
572/** 594/**
595 * fscache_readpages_cancel - Cancel read/alloc on pages
596 * @cookie: The cookie representing the inode's cache object.
597 * @pages: The netfs pages that we canceled write on in readpages()
598 *
599 * Uncache/unreserve the pages reserved earlier in readpages() via
600 * fscache_readpages_or_alloc() and similar. In most successful caches in
601 * readpages() this doesn't do anything. In cases when the underlying netfs's
602 * readahead failed we need to clean up the pagelist (unmark and uncache).
603 *
604 * This function may sleep as it may have to clean up disk state.
605 */
606static inline
607void fscache_readpages_cancel(struct fscache_cookie *cookie,
608 struct list_head *pages)
609{
610 if (fscache_cookie_valid(cookie))
611 __fscache_readpages_cancel(cookie, pages);
612}
613
614/**
573 * fscache_write_page - Request storage of a page in the cache 615 * fscache_write_page - Request storage of a page in the cache
574 * @cookie: The cookie representing the cache object 616 * @cookie: The cookie representing the cache object
575 * @page: The netfs page to store 617 * @page: The netfs page to store
diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
deleted file mode 100644
index 55d870238399..000000000000
--- a/include/linux/fsl/mxs-dma.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __MACH_MXS_DMA_H__
10#define __MACH_MXS_DMA_H__
11
12#include <linux/dmaengine.h>
13
14struct mxs_dma_data {
15 int chan_irq;
16};
17
18extern int mxs_dma_is_apbh(struct dma_chan *chan);
19extern int mxs_dma_is_apbx(struct dma_chan *chan);
20#endif /* __MACH_MXS_DMA_H__ */
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index a78680a92dba..1c804b057fb1 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -38,7 +38,7 @@ static inline int fsnotify_parent(struct path *path, struct dentry *dentry, __u3
38static inline int fsnotify_perm(struct file *file, int mask) 38static inline int fsnotify_perm(struct file *file, int mask)
39{ 39{
40 struct path *path = &file->f_path; 40 struct path *path = &file->f_path;
41 struct inode *inode = path->dentry->d_inode; 41 struct inode *inode = file_inode(file);
42 __u32 fsnotify_mask = 0; 42 __u32 fsnotify_mask = 0;
43 int ret; 43 int ret;
44 44
@@ -192,7 +192,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
192static inline void fsnotify_access(struct file *file) 192static inline void fsnotify_access(struct file *file)
193{ 193{
194 struct path *path = &file->f_path; 194 struct path *path = &file->f_path;
195 struct inode *inode = path->dentry->d_inode; 195 struct inode *inode = file_inode(file);
196 __u32 mask = FS_ACCESS; 196 __u32 mask = FS_ACCESS;
197 197
198 if (S_ISDIR(inode->i_mode)) 198 if (S_ISDIR(inode->i_mode))
@@ -210,7 +210,7 @@ static inline void fsnotify_access(struct file *file)
210static inline void fsnotify_modify(struct file *file) 210static inline void fsnotify_modify(struct file *file)
211{ 211{
212 struct path *path = &file->f_path; 212 struct path *path = &file->f_path;
213 struct inode *inode = path->dentry->d_inode; 213 struct inode *inode = file_inode(file);
214 __u32 mask = FS_MODIFY; 214 __u32 mask = FS_MODIFY;
215 215
216 if (S_ISDIR(inode->i_mode)) 216 if (S_ISDIR(inode->i_mode))
@@ -228,7 +228,7 @@ static inline void fsnotify_modify(struct file *file)
228static inline void fsnotify_open(struct file *file) 228static inline void fsnotify_open(struct file *file)
229{ 229{
230 struct path *path = &file->f_path; 230 struct path *path = &file->f_path;
231 struct inode *inode = path->dentry->d_inode; 231 struct inode *inode = file_inode(file);
232 __u32 mask = FS_OPEN; 232 __u32 mask = FS_OPEN;
233 233
234 if (S_ISDIR(inode->i_mode)) 234 if (S_ISDIR(inode->i_mode))
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 99d0fbcbaf79..9f15c0064c50 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -566,10 +566,6 @@ static inline ssize_t ftrace_filter_write(struct file *file, const char __user *
566 size_t cnt, loff_t *ppos) { return -ENODEV; } 566 size_t cnt, loff_t *ppos) { return -ENODEV; }
567static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf, 567static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
568 size_t cnt, loff_t *ppos) { return -ENODEV; } 568 size_t cnt, loff_t *ppos) { return -ENODEV; }
569static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence)
570{
571 return -ENODEV;
572}
573static inline int 569static inline int
574ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; } 570ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; }
575#endif /* CONFIG_DYNAMIC_FTRACE */ 571#endif /* CONFIG_DYNAMIC_FTRACE */
@@ -828,10 +824,15 @@ enum ftrace_dump_mode;
828 824
829extern enum ftrace_dump_mode ftrace_dump_on_oops; 825extern enum ftrace_dump_mode ftrace_dump_on_oops;
830 826
827extern void disable_trace_on_warning(void);
828extern int __disable_trace_on_warning;
829
831#ifdef CONFIG_PREEMPT 830#ifdef CONFIG_PREEMPT
832#define INIT_TRACE_RECURSION .trace_recursion = 0, 831#define INIT_TRACE_RECURSION .trace_recursion = 0,
833#endif 832#endif
834 833
834#else /* CONFIG_TRACING */
835static inline void disable_trace_on_warning(void) { }
835#endif /* CONFIG_TRACING */ 836#endif /* CONFIG_TRACING */
836 837
837#ifndef INIT_TRACE_RECURSION 838#ifndef INIT_TRACE_RECURSION
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 4372658c73ae..5eaa746735ff 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -78,6 +78,11 @@ struct trace_iterator {
78 /* trace_seq for __print_flags() and __print_symbolic() etc. */ 78 /* trace_seq for __print_flags() and __print_symbolic() etc. */
79 struct trace_seq tmp_seq; 79 struct trace_seq tmp_seq;
80 80
81 cpumask_var_t started;
82
83 /* it's true when current open file is snapshot */
84 bool snapshot;
85
81 /* The below is zeroed out in pipe_read */ 86 /* The below is zeroed out in pipe_read */
82 struct trace_seq seq; 87 struct trace_seq seq;
83 struct trace_entry *ent; 88 struct trace_entry *ent;
@@ -90,10 +95,7 @@ struct trace_iterator {
90 loff_t pos; 95 loff_t pos;
91 long idx; 96 long idx;
92 97
93 cpumask_var_t started; 98 /* All new field here will be zeroed out in pipe_read */
94
95 /* it's true when current open file is snapshot */
96 bool snapshot;
97}; 99};
98 100
99enum trace_iter_flags { 101enum trace_iter_flags {
@@ -332,7 +334,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type,
332 const char *name, int offset, int size, 334 const char *name, int offset, int size,
333 int is_signed, int filter_type); 335 int is_signed, int filter_type);
334extern int trace_add_event_call(struct ftrace_event_call *call); 336extern int trace_add_event_call(struct ftrace_event_call *call);
335extern void trace_remove_event_call(struct ftrace_event_call *call); 337extern int trace_remove_event_call(struct ftrace_event_call *call);
336 338
337#define is_signed_type(type) (((type)(-1)) < (type)1) 339#define is_signed_type(type) (((type)(-1)) < (type)1)
338 340
@@ -357,6 +359,40 @@ do { \
357 __trace_printk(ip, fmt, ##args); \ 359 __trace_printk(ip, fmt, ##args); \
358} while (0) 360} while (0)
359 361
362/**
363 * tracepoint_string - register constant persistent string to trace system
364 * @str - a constant persistent string that will be referenced in tracepoints
365 *
366 * If constant strings are being used in tracepoints, it is faster and
367 * more efficient to just save the pointer to the string and reference
368 * that with a printf "%s" instead of saving the string in the ring buffer
369 * and wasting space and time.
370 *
371 * The problem with the above approach is that userspace tools that read
372 * the binary output of the trace buffers do not have access to the string.
373 * Instead they just show the address of the string which is not very
374 * useful to users.
375 *
376 * With tracepoint_string(), the string will be registered to the tracing
377 * system and exported to userspace via the debugfs/tracing/printk_formats
378 * file that maps the string address to the string text. This way userspace
379 * tools that read the binary buffers have a way to map the pointers to
380 * the ASCII strings they represent.
381 *
382 * The @str used must be a constant string and persistent as it would not
383 * make sense to show a string that no longer exists. But it is still fine
384 * to be used with modules, because when modules are unloaded, if they
385 * had tracepoints, the ring buffers are cleared too. As long as the string
386 * does not change during the life of the module, it is fine to use
387 * tracepoint_string() within a module.
388 */
389#define tracepoint_string(str) \
390 ({ \
391 static const char *___tp_str __tracepoint_string = str; \
392 ___tp_str; \
393 })
394#define __tracepoint_string __attribute__((section("__tracepoint_str")))
395
360#ifdef CONFIG_PERF_EVENTS 396#ifdef CONFIG_PERF_EVENTS
361struct perf_event; 397struct perf_event;
362 398
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index 661d374aeb2d..f8d41cb1cbe0 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -66,8 +66,8 @@ struct gen_pool_chunk {
66 struct list_head next_chunk; /* next chunk in pool */ 66 struct list_head next_chunk; /* next chunk in pool */
67 atomic_t avail; 67 atomic_t avail;
68 phys_addr_t phys_addr; /* physical starting address of memory chunk */ 68 phys_addr_t phys_addr; /* physical starting address of memory chunk */
69 unsigned long start_addr; /* starting address of memory chunk */ 69 unsigned long start_addr; /* start address of memory chunk */
70 unsigned long end_addr; /* ending address of memory chunk */ 70 unsigned long end_addr; /* end address of memory chunk (inclusive) */
71 unsigned long bits[0]; /* bitmap for allocating memory chunk */ 71 unsigned long bits[0]; /* bitmap for allocating memory chunk */
72}; 72};
73 73
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 0f615eb23d05..9b4dd491f7e8 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -209,7 +209,7 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
209 * 0x9 => DMA or NORMAL (MOVABLE+DMA) 209 * 0x9 => DMA or NORMAL (MOVABLE+DMA)
210 * 0xa => MOVABLE (Movable is valid only if HIGHMEM is set too) 210 * 0xa => MOVABLE (Movable is valid only if HIGHMEM is set too)
211 * 0xb => BAD (MOVABLE+HIGHMEM+DMA) 211 * 0xb => BAD (MOVABLE+HIGHMEM+DMA)
212 * 0xc => DMA32 (MOVABLE+HIGHMEM+DMA32) 212 * 0xc => DMA32 (MOVABLE+DMA32)
213 * 0xd => BAD (MOVABLE+DMA32+DMA) 213 * 0xd => BAD (MOVABLE+DMA32+DMA)
214 * 0xe => BAD (MOVABLE+DMA32+HIGHMEM) 214 * 0xe => BAD (MOVABLE+DMA32+HIGHMEM)
215 * 0xf => BAD (MOVABLE+DMA32+HIGHMEM+DMA) 215 * 0xf => BAD (MOVABLE+DMA32+HIGHMEM+DMA)
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index c1d6555d2567..1e041063b226 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -1,134 +1,15 @@
1#ifndef LINUX_HARDIRQ_H 1#ifndef LINUX_HARDIRQ_H
2#define LINUX_HARDIRQ_H 2#define LINUX_HARDIRQ_H
3 3
4#include <linux/preempt.h> 4#include <linux/preempt_mask.h>
5#include <linux/lockdep.h> 5#include <linux/lockdep.h>
6#include <linux/ftrace_irq.h> 6#include <linux/ftrace_irq.h>
7#include <linux/vtime.h> 7#include <linux/vtime.h>
8#include <asm/hardirq.h>
9 8
10/*
11 * We put the hardirq and softirq counter into the preemption
12 * counter. The bitmask has the following meaning:
13 *
14 * - bits 0-7 are the preemption count (max preemption depth: 256)
15 * - bits 8-15 are the softirq count (max # of softirqs: 256)
16 *
17 * The hardirq count can in theory reach the same as NR_IRQS.
18 * In reality, the number of nested IRQS is limited to the stack
19 * size as well. For archs with over 1000 IRQS it is not practical
20 * to expect that they will all nest. We give a max of 10 bits for
21 * hardirq nesting. An arch may choose to give less than 10 bits.
22 * m68k expects it to be 8.
23 *
24 * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024)
25 * - bit 26 is the NMI_MASK
26 * - bit 27 is the PREEMPT_ACTIVE flag
27 *
28 * PREEMPT_MASK: 0x000000ff
29 * SOFTIRQ_MASK: 0x0000ff00
30 * HARDIRQ_MASK: 0x03ff0000
31 * NMI_MASK: 0x04000000
32 */
33#define PREEMPT_BITS 8
34#define SOFTIRQ_BITS 8
35#define NMI_BITS 1
36
37#define MAX_HARDIRQ_BITS 10
38
39#ifndef HARDIRQ_BITS
40# define HARDIRQ_BITS MAX_HARDIRQ_BITS
41#endif
42
43#if HARDIRQ_BITS > MAX_HARDIRQ_BITS
44#error HARDIRQ_BITS too high!
45#endif
46
47#define PREEMPT_SHIFT 0
48#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS)
49#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS)
50#define NMI_SHIFT (HARDIRQ_SHIFT + HARDIRQ_BITS)
51
52#define __IRQ_MASK(x) ((1UL << (x))-1)
53
54#define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
55#define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
56#define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
57#define NMI_MASK (__IRQ_MASK(NMI_BITS) << NMI_SHIFT)
58 9
59#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT)
60#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT)
61#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
62#define NMI_OFFSET (1UL << NMI_SHIFT)
63
64#define SOFTIRQ_DISABLE_OFFSET (2 * SOFTIRQ_OFFSET)
65
66#ifndef PREEMPT_ACTIVE
67#define PREEMPT_ACTIVE_BITS 1
68#define PREEMPT_ACTIVE_SHIFT (NMI_SHIFT + NMI_BITS)
69#define PREEMPT_ACTIVE (__IRQ_MASK(PREEMPT_ACTIVE_BITS) << PREEMPT_ACTIVE_SHIFT)
70#endif
71
72#if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS))
73#error PREEMPT_ACTIVE is too low!
74#endif
75
76#define hardirq_count() (preempt_count() & HARDIRQ_MASK)
77#define softirq_count() (preempt_count() & SOFTIRQ_MASK)
78#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK \
79 | NMI_MASK))
80
81/*
82 * Are we doing bottom half or hardware interrupt processing?
83 * Are we in a softirq context? Interrupt context?
84 * in_softirq - Are we currently processing softirq or have bh disabled?
85 * in_serving_softirq - Are we currently processing softirq?
86 */
87#define in_irq() (hardirq_count())
88#define in_softirq() (softirq_count())
89#define in_interrupt() (irq_count())
90#define in_serving_softirq() (softirq_count() & SOFTIRQ_OFFSET)
91
92/*
93 * Are we in NMI context?
94 */
95#define in_nmi() (preempt_count() & NMI_MASK)
96
97#if defined(CONFIG_PREEMPT_COUNT)
98# define PREEMPT_CHECK_OFFSET 1
99#else
100# define PREEMPT_CHECK_OFFSET 0
101#endif
102
103/*
104 * Are we running in atomic context? WARNING: this macro cannot
105 * always detect atomic context; in particular, it cannot know about
106 * held spinlocks in non-preemptible kernels. Thus it should not be
107 * used in the general case to determine whether sleeping is possible.
108 * Do not use in_atomic() in driver code.
109 */
110#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
111
112/*
113 * Check whether we were atomic before we did preempt_disable():
114 * (used by the scheduler, *after* releasing the kernel lock)
115 */
116#define in_atomic_preempt_off() \
117 ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET)
118
119#ifdef CONFIG_PREEMPT_COUNT
120# define preemptible() (preempt_count() == 0 && !irqs_disabled())
121#else
122# define preemptible() 0
123#endif
124
125#if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
126extern void synchronize_irq(unsigned int irq); 10extern void synchronize_irq(unsigned int irq);
127#else
128# define synchronize_irq(irq) barrier()
129#endif
130 11
131#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU) 12#if defined(CONFIG_TINY_RCU)
132 13
133static inline void rcu_nmi_enter(void) 14static inline void rcu_nmi_enter(void)
134{ 15{
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 3b589440ecfe..9231be9e90a2 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -18,11 +18,21 @@ enum hdmi_infoframe_type {
18 HDMI_INFOFRAME_TYPE_AUDIO = 0x84, 18 HDMI_INFOFRAME_TYPE_AUDIO = 0x84,
19}; 19};
20 20
21#define HDMI_IEEE_OUI 0x000c03
21#define HDMI_INFOFRAME_HEADER_SIZE 4 22#define HDMI_INFOFRAME_HEADER_SIZE 4
22#define HDMI_AVI_INFOFRAME_SIZE 13 23#define HDMI_AVI_INFOFRAME_SIZE 13
23#define HDMI_SPD_INFOFRAME_SIZE 25 24#define HDMI_SPD_INFOFRAME_SIZE 25
24#define HDMI_AUDIO_INFOFRAME_SIZE 10 25#define HDMI_AUDIO_INFOFRAME_SIZE 10
25 26
27#define HDMI_INFOFRAME_SIZE(type) \
28 (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE)
29
30struct hdmi_any_infoframe {
31 enum hdmi_infoframe_type type;
32 unsigned char version;
33 unsigned char length;
34};
35
26enum hdmi_colorspace { 36enum hdmi_colorspace {
27 HDMI_COLORSPACE_RGB, 37 HDMI_COLORSPACE_RGB,
28 HDMI_COLORSPACE_YUV422, 38 HDMI_COLORSPACE_YUV422,
@@ -100,9 +110,6 @@ struct hdmi_avi_infoframe {
100 unsigned char version; 110 unsigned char version;
101 unsigned char length; 111 unsigned char length;
102 enum hdmi_colorspace colorspace; 112 enum hdmi_colorspace colorspace;
103 bool active_info_valid;
104 bool horizontal_bar_valid;
105 bool vertical_bar_valid;
106 enum hdmi_scan_mode scan_mode; 113 enum hdmi_scan_mode scan_mode;
107 enum hdmi_colorimetry colorimetry; 114 enum hdmi_colorimetry colorimetry;
108 enum hdmi_picture_aspect picture_aspect; 115 enum hdmi_picture_aspect picture_aspect;
@@ -218,14 +225,52 @@ int hdmi_audio_infoframe_init(struct hdmi_audio_infoframe *frame);
218ssize_t hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe *frame, 225ssize_t hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe *frame,
219 void *buffer, size_t size); 226 void *buffer, size_t size);
220 227
228enum hdmi_3d_structure {
229 HDMI_3D_STRUCTURE_INVALID = -1,
230 HDMI_3D_STRUCTURE_FRAME_PACKING = 0,
231 HDMI_3D_STRUCTURE_FIELD_ALTERNATIVE,
232 HDMI_3D_STRUCTURE_LINE_ALTERNATIVE,
233 HDMI_3D_STRUCTURE_SIDE_BY_SIDE_FULL,
234 HDMI_3D_STRUCTURE_L_DEPTH,
235 HDMI_3D_STRUCTURE_L_DEPTH_GFX_GFX_DEPTH,
236 HDMI_3D_STRUCTURE_TOP_AND_BOTTOM,
237 HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF = 8,
238};
239
240
221struct hdmi_vendor_infoframe { 241struct hdmi_vendor_infoframe {
222 enum hdmi_infoframe_type type; 242 enum hdmi_infoframe_type type;
223 unsigned char version; 243 unsigned char version;
224 unsigned char length; 244 unsigned char length;
225 u8 data[27]; 245 unsigned int oui;
246 u8 vic;
247 enum hdmi_3d_structure s3d_struct;
248 unsigned int s3d_ext_data;
226}; 249};
227 250
251int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame);
228ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, 252ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
229 void *buffer, size_t size); 253 void *buffer, size_t size);
230 254
255union hdmi_vendor_any_infoframe {
256 struct {
257 enum hdmi_infoframe_type type;
258 unsigned char version;
259 unsigned char length;
260 unsigned int oui;
261 } any;
262 struct hdmi_vendor_infoframe hdmi;
263};
264
265union hdmi_infoframe {
266 struct hdmi_any_infoframe any;
267 struct hdmi_avi_infoframe avi;
268 struct hdmi_spd_infoframe spd;
269 union hdmi_vendor_any_infoframe vendor;
270 struct hdmi_audio_infoframe audio;
271};
272
273ssize_t
274hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, size_t size);
275
231#endif /* _DRM_HDMI_H */ 276#endif /* _DRM_HDMI_H */
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index ecefb7311dd6..32ba45158d39 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -172,7 +172,7 @@ struct hid_sensor_common {
172 struct hid_sensor_hub_attribute_info sensitivity; 172 struct hid_sensor_hub_attribute_info sensitivity;
173}; 173};
174 174
175/*Convert from hid unit expo to regular exponent*/ 175/* Convert from hid unit expo to regular exponent */
176static inline int hid_sensor_convert_exponent(int unit_expo) 176static inline int hid_sensor_convert_exponent(int unit_expo)
177{ 177{
178 if (unit_expo < 0x08) 178 if (unit_expo < 0x08)
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 6f24446e7669..4f945d3ed49f 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -37,7 +37,7 @@
37#define HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS 0x200458 37#define HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS 0x200458
38#define HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS 0x200459 38#define HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS 0x200459
39 39
40/*ORIENTATION: Compass 3D: (200083) */ 40/* ORIENTATION: Compass 3D: (200083) */
41#define HID_USAGE_SENSOR_COMPASS_3D 0x200083 41#define HID_USAGE_SENSOR_COMPASS_3D 0x200083
42#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING 0x200471 42#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING 0x200471
43#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_X 0x200472 43#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_X 0x200472
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 0c48991b0402..31b9d299ef6c 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -252,6 +252,8 @@ struct hid_item {
252#define HID_OUTPUT_REPORT 1 252#define HID_OUTPUT_REPORT 1
253#define HID_FEATURE_REPORT 2 253#define HID_FEATURE_REPORT 2
254 254
255#define HID_REPORT_TYPES 3
256
255/* 257/*
256 * HID connect requests 258 * HID connect requests
257 */ 259 */
@@ -283,6 +285,7 @@ struct hid_item {
283#define HID_QUIRK_MULTI_INPUT 0x00000040 285#define HID_QUIRK_MULTI_INPUT 0x00000040
284#define HID_QUIRK_HIDINPUT_FORCE 0x00000080 286#define HID_QUIRK_HIDINPUT_FORCE 0x00000080
285#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100 287#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100
288#define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200
286#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 289#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
287#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 290#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
288#define HID_QUIRK_NO_INIT_REPORTS 0x20000000 291#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
@@ -295,6 +298,7 @@ struct hid_item {
295#define HID_GROUP_GENERIC 0x0001 298#define HID_GROUP_GENERIC 0x0001
296#define HID_GROUP_MULTITOUCH 0x0002 299#define HID_GROUP_MULTITOUCH 0x0002
297#define HID_GROUP_SENSOR_HUB 0x0003 300#define HID_GROUP_SENSOR_HUB 0x0003
301#define HID_GROUP_MULTITOUCH_WIN_8 0x0004
298 302
299/* 303/*
300 * This is the global environment of the parser. This information is 304 * This is the global environment of the parser. This information is
@@ -393,14 +397,14 @@ struct hid_report {
393 struct hid_device *device; /* associated device */ 397 struct hid_device *device; /* associated device */
394}; 398};
395 399
400#define HID_MAX_IDS 256
401
396struct hid_report_enum { 402struct hid_report_enum {
397 unsigned numbered; 403 unsigned numbered;
398 struct list_head report_list; 404 struct list_head report_list;
399 struct hid_report *report_id_hash[256]; 405 struct hid_report *report_id_hash[HID_MAX_IDS];
400}; 406};
401 407
402#define HID_REPORT_TYPES 3
403
404#define HID_MIN_BUFFER_SIZE 64 /* make sure there is at least a packet size of space */ 408#define HID_MIN_BUFFER_SIZE 64 /* make sure there is at least a packet size of space */
405#define HID_MAX_BUFFER_SIZE 4096 /* 4kb */ 409#define HID_MAX_BUFFER_SIZE 4096 /* 4kb */
406#define HID_CONTROL_FIFO_SIZE 256 /* to init devices with >100 reports */ 410#define HID_CONTROL_FIFO_SIZE 256 /* to init devices with >100 reports */
@@ -456,6 +460,7 @@ struct hid_device { /* device report descriptor */
456 enum hid_type type; /* device type (mouse, kbd, ...) */ 460 enum hid_type type; /* device type (mouse, kbd, ...) */
457 unsigned country; /* HID country */ 461 unsigned country; /* HID country */
458 struct hid_report_enum report_enum[HID_REPORT_TYPES]; 462 struct hid_report_enum report_enum[HID_REPORT_TYPES];
463 struct work_struct led_work; /* delayed LED worker */
459 464
460 struct semaphore driver_lock; /* protects the current driver, except during input */ 465 struct semaphore driver_lock; /* protects the current driver, except during input */
461 struct semaphore driver_input_lock; /* protects the current driver */ 466 struct semaphore driver_input_lock; /* protects the current driver */
@@ -532,6 +537,8 @@ static inline void hid_set_drvdata(struct hid_device *hdev, void *data)
532#define HID_GLOBAL_STACK_SIZE 4 537#define HID_GLOBAL_STACK_SIZE 4
533#define HID_COLLECTION_STACK_SIZE 4 538#define HID_COLLECTION_STACK_SIZE 4
534 539
540#define HID_SCAN_FLAG_MT_WIN_8 0x00000001
541
535struct hid_parser { 542struct hid_parser {
536 struct hid_global global; 543 struct hid_global global;
537 struct hid_global global_stack[HID_GLOBAL_STACK_SIZE]; 544 struct hid_global global_stack[HID_GLOBAL_STACK_SIZE];
@@ -540,6 +547,7 @@ struct hid_parser {
540 unsigned collection_stack[HID_COLLECTION_STACK_SIZE]; 547 unsigned collection_stack[HID_COLLECTION_STACK_SIZE];
541 unsigned collection_stack_ptr; 548 unsigned collection_stack_ptr;
542 struct hid_device *device; 549 struct hid_device *device;
550 unsigned scan_flags;
543}; 551};
544 552
545struct hid_class_descriptor { 553struct hid_class_descriptor {
@@ -744,9 +752,14 @@ struct hid_field *hidinput_get_led_field(struct hid_device *hid);
744unsigned int hidinput_count_leds(struct hid_device *hid); 752unsigned int hidinput_count_leds(struct hid_device *hid);
745__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code); 753__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
746void hid_output_report(struct hid_report *report, __u8 *data); 754void hid_output_report(struct hid_report *report, __u8 *data);
755u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags);
747struct hid_device *hid_allocate_device(void); 756struct hid_device *hid_allocate_device(void);
748struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 757struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
749int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 758int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
759struct hid_report *hid_validate_values(struct hid_device *hid,
760 unsigned int type, unsigned int id,
761 unsigned int field_index,
762 unsigned int report_counts);
750int hid_open_report(struct hid_device *device); 763int hid_open_report(struct hid_device *device);
751int hid_check_keys_pressed(struct hid_device *hid); 764int hid_check_keys_pressed(struct hid_device *hid);
752int hid_connect(struct hid_device *hid, unsigned int connect_mask); 765int hid_connect(struct hid_device *hid, unsigned int connect_mask);
@@ -989,7 +1002,6 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
989u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); 1002u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct);
990int usbhid_quirks_init(char **quirks_param); 1003int usbhid_quirks_init(char **quirks_param);
991void usbhid_quirks_exit(void); 1004void usbhid_quirks_exit(void);
992void usbhid_set_leds(struct hid_device *hid);
993 1005
994#ifdef CONFIG_HID_PID 1006#ifdef CONFIG_HID_PID
995int hid_pidff_init(struct hid_device *hid); 1007int hid_pidff_init(struct hid_device *hid);
diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h
index 2451662c728a..ddf52612eed8 100644
--- a/include/linux/hidraw.h
+++ b/include/linux/hidraw.h
@@ -23,6 +23,7 @@ struct hidraw {
23 wait_queue_head_t wait; 23 wait_queue_head_t wait;
24 struct hid_device *hid; 24 struct hid_device *hid;
25 struct device *dev; 25 struct device *dev;
26 spinlock_t list_lock;
26 struct list_head list; 27 struct list_head list;
27}; 28};
28 29
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 528454c2caa9..3935428c57cf 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -60,9 +60,9 @@ extern pmd_t *page_check_address_pmd(struct page *page,
60#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER) 60#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
61 61
62#ifdef CONFIG_TRANSPARENT_HUGEPAGE 62#ifdef CONFIG_TRANSPARENT_HUGEPAGE
63#define HPAGE_PMD_SHIFT HPAGE_SHIFT 63#define HPAGE_PMD_SHIFT PMD_SHIFT
64#define HPAGE_PMD_MASK HPAGE_MASK 64#define HPAGE_PMD_SIZE ((1UL) << HPAGE_PMD_SHIFT)
65#define HPAGE_PMD_SIZE HPAGE_SIZE 65#define HPAGE_PMD_MASK (~(HPAGE_PMD_SIZE - 1))
66 66
67extern bool is_vma_temporary_stack(struct vm_area_struct *vma); 67extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
68 68
@@ -96,9 +96,6 @@ extern int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
96 pmd_t *dst_pmd, pmd_t *src_pmd, 96 pmd_t *dst_pmd, pmd_t *src_pmd,
97 struct vm_area_struct *vma, 97 struct vm_area_struct *vma,
98 unsigned long addr, unsigned long end); 98 unsigned long addr, unsigned long end);
99extern int handle_pte_fault(struct mm_struct *mm,
100 struct vm_area_struct *vma, unsigned long address,
101 pte_t *pte, pmd_t *pmd, unsigned int flags);
102extern int split_huge_page_to_list(struct page *page, struct list_head *list); 99extern int split_huge_page_to_list(struct page *page, struct list_head *list);
103static inline int split_huge_page(struct page *page) 100static inline int split_huge_page(struct page *page)
104{ 101{
@@ -123,7 +120,7 @@ extern void __split_huge_page_pmd(struct vm_area_struct *vma,
123 } while (0) 120 } while (0)
124extern void split_huge_page_pmd_mm(struct mm_struct *mm, unsigned long address, 121extern void split_huge_page_pmd_mm(struct mm_struct *mm, unsigned long address,
125 pmd_t *pmd); 122 pmd_t *pmd);
126#if HPAGE_PMD_ORDER > MAX_ORDER 123#if HPAGE_PMD_ORDER >= MAX_ORDER
127#error "hugepages can't be allocated by the buddy allocator" 124#error "hugepages can't be allocated by the buddy allocator"
128#endif 125#endif
129extern int hugepage_madvise(struct vm_area_struct *vma, 126extern int hugepage_madvise(struct vm_area_struct *vma,
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 6b4890fa57e7..0393270466c3 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -55,7 +55,6 @@ void __unmap_hugepage_range_final(struct mmu_gather *tlb,
55void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, 55void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
56 unsigned long start, unsigned long end, 56 unsigned long start, unsigned long end,
57 struct page *ref_page); 57 struct page *ref_page);
58int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
59void hugetlb_report_meminfo(struct seq_file *); 58void hugetlb_report_meminfo(struct seq_file *);
60int hugetlb_report_node_meminfo(int, char *); 59int hugetlb_report_node_meminfo(int, char *);
61void hugetlb_show_meminfo(void); 60void hugetlb_show_meminfo(void);
@@ -67,8 +66,15 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to,
67 vm_flags_t vm_flags); 66 vm_flags_t vm_flags);
68void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed); 67void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
69int dequeue_hwpoisoned_huge_page(struct page *page); 68int dequeue_hwpoisoned_huge_page(struct page *page);
69bool isolate_huge_page(struct page *page, struct list_head *list);
70void putback_active_hugepage(struct page *page);
71bool is_hugepage_active(struct page *page);
70void copy_huge_page(struct page *dst, struct page *src); 72void copy_huge_page(struct page *dst, struct page *src);
71 73
74#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
75pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
76#endif
77
72extern unsigned long hugepages_treat_as_movable; 78extern unsigned long hugepages_treat_as_movable;
73extern const unsigned long hugetlb_zero, hugetlb_infinity; 79extern const unsigned long hugetlb_zero, hugetlb_infinity;
74extern int sysctl_hugetlb_shm_group; 80extern int sysctl_hugetlb_shm_group;
@@ -110,7 +116,6 @@ static inline unsigned long hugetlb_total_pages(void)
110#define follow_hugetlb_page(m,v,p,vs,a,b,i,w) ({ BUG(); 0; }) 116#define follow_hugetlb_page(m,v,p,vs,a,b,i,w) ({ BUG(); 0; })
111#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) 117#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL)
112#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) 118#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; })
113#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; })
114static inline void hugetlb_report_meminfo(struct seq_file *m) 119static inline void hugetlb_report_meminfo(struct seq_file *m)
115{ 120{
116} 121}
@@ -132,6 +137,9 @@ static inline int dequeue_hwpoisoned_huge_page(struct page *page)
132 return 0; 137 return 0;
133} 138}
134 139
140#define isolate_huge_page(p, l) false
141#define putback_active_hugepage(p) do {} while (0)
142#define is_hugepage_active(x) false
135static inline void copy_huge_page(struct page *dst, struct page *src) 143static inline void copy_huge_page(struct page *dst, struct page *src)
136{ 144{
137} 145}
@@ -259,6 +267,8 @@ struct huge_bootmem_page {
259}; 267};
260 268
261struct page *alloc_huge_page_node(struct hstate *h, int nid); 269struct page *alloc_huge_page_node(struct hstate *h, int nid);
270struct page *alloc_huge_page_noerr(struct vm_area_struct *vma,
271 unsigned long addr, int avoid_reserve);
262 272
263/* arch callback */ 273/* arch callback */
264int __init alloc_bootmem_huge_page(struct hstate *h); 274int __init alloc_bootmem_huge_page(struct hstate *h);
@@ -358,9 +368,34 @@ static inline int hstate_index(struct hstate *h)
358 return h - hstates; 368 return h - hstates;
359} 369}
360 370
371pgoff_t __basepage_index(struct page *page);
372
373/* Return page->index in PAGE_SIZE units */
374static inline pgoff_t basepage_index(struct page *page)
375{
376 if (!PageCompound(page))
377 return page->index;
378
379 return __basepage_index(page);
380}
381
382extern void dissolve_free_huge_pages(unsigned long start_pfn,
383 unsigned long end_pfn);
384int pmd_huge_support(void);
385/*
386 * Currently hugepage migration is enabled only for pmd-based hugepage.
387 * This function will be updated when hugepage migration is more widely
388 * supported.
389 */
390static inline int hugepage_migration_support(struct hstate *h)
391{
392 return pmd_huge_support() && (huge_page_shift(h) == PMD_SHIFT);
393}
394
361#else /* CONFIG_HUGETLB_PAGE */ 395#else /* CONFIG_HUGETLB_PAGE */
362struct hstate {}; 396struct hstate {};
363#define alloc_huge_page_node(h, nid) NULL 397#define alloc_huge_page_node(h, nid) NULL
398#define alloc_huge_page_noerr(v, a, r) NULL
364#define alloc_bootmem_huge_page(h) NULL 399#define alloc_bootmem_huge_page(h) NULL
365#define hstate_file(f) NULL 400#define hstate_file(f) NULL
366#define hstate_sizelog(s) NULL 401#define hstate_sizelog(s) NULL
@@ -378,6 +413,14 @@ static inline unsigned int pages_per_huge_page(struct hstate *h)
378} 413}
379#define hstate_index_to_shift(index) 0 414#define hstate_index_to_shift(index) 0
380#define hstate_index(h) 0 415#define hstate_index(h) 0
416
417static inline pgoff_t basepage_index(struct page *page)
418{
419 return page->index;
420}
421#define dissolve_free_huge_pages(s, e) do {} while (0)
422#define pmd_huge_support() 0
423#define hugepage_migration_support(h) 0
381#endif /* CONFIG_HUGETLB_PAGE */ 424#endif /* CONFIG_HUGETLB_PAGE */
382 425
383#endif /* _LINUX_HUGETLB_H */ 426#endif /* _LINUX_HUGETLB_H */
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index c2559847d7ee..d98503bde7e9 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -27,6 +27,17 @@
27 27
28#include <linux/types.h> 28#include <linux/types.h>
29 29
30/*
31 * Framework version for util services.
32 */
33#define UTIL_FW_MINOR 0
34
35#define UTIL_WS2K8_FW_MAJOR 1
36#define UTIL_WS2K8_FW_VERSION (UTIL_WS2K8_FW_MAJOR << 16 | UTIL_FW_MINOR)
37
38#define UTIL_FW_MAJOR 3
39#define UTIL_FW_VERSION (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)
40
30 41
31/* 42/*
32 * Implementation of host controlled snapshot of the guest. 43 * Implementation of host controlled snapshot of the guest.
@@ -455,27 +466,6 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
455 *read = dsize - *write; 466 *read = dsize - *write;
456} 467}
457 468
458
459/*
460 * We use the same version numbering for all Hyper-V modules.
461 *
462 * Definition of versioning is as follows;
463 *
464 * Major Number Changes for these scenarios;
465 * 1. When a new version of Windows Hyper-V
466 * is released.
467 * 2. A Major change has occurred in the
468 * Linux IC's.
469 * (For example the merge for the first time
470 * into the kernel) Every time the Major Number
471 * changes, the Revision number is reset to 0.
472 * Minor Number Changes when new functionality is added
473 * to the Linux IC's that is not a bug fix.
474 *
475 * 3.1 - Added completed hv_utils driver. Shutdown/Heartbeat/Timesync
476 */
477#define HV_DRV_VERSION "3.1"
478
479/* 469/*
480 * VMBUS version is 32 bit entity broken up into 470 * VMBUS version is 32 bit entity broken up into
481 * two 16 bit quantities: major_number. minor_number. 471 * two 16 bit quantities: major_number. minor_number.
@@ -909,6 +899,7 @@ enum vmbus_channel_state {
909 CHANNEL_OFFER_STATE, 899 CHANNEL_OFFER_STATE,
910 CHANNEL_OPENING_STATE, 900 CHANNEL_OPENING_STATE,
911 CHANNEL_OPEN_STATE, 901 CHANNEL_OPEN_STATE,
902 CHANNEL_OPENED_STATE,
912}; 903};
913 904
914struct vmbus_channel_debug_info { 905struct vmbus_channel_debug_info {
@@ -1046,6 +1037,38 @@ struct vmbus_channel {
1046 * preserve the earlier behavior. 1037 * preserve the earlier behavior.
1047 */ 1038 */
1048 u32 target_vp; 1039 u32 target_vp;
1040 /*
1041 * Support for sub-channels. For high performance devices,
1042 * it will be useful to have multiple sub-channels to support
1043 * a scalable communication infrastructure with the host.
1044 * The support for sub-channels is implemented as an extention
1045 * to the current infrastructure.
1046 * The initial offer is considered the primary channel and this
1047 * offer message will indicate if the host supports sub-channels.
1048 * The guest is free to ask for sub-channels to be offerred and can
1049 * open these sub-channels as a normal "primary" channel. However,
1050 * all sub-channels will have the same type and instance guids as the
1051 * primary channel. Requests sent on a given channel will result in a
1052 * response on the same channel.
1053 */
1054
1055 /*
1056 * Sub-channel creation callback. This callback will be called in
1057 * process context when a sub-channel offer is received from the host.
1058 * The guest can open the sub-channel in the context of this callback.
1059 */
1060 void (*sc_creation_callback)(struct vmbus_channel *new_sc);
1061
1062 spinlock_t sc_lock;
1063 /*
1064 * All Sub-channels of a primary channel are linked here.
1065 */
1066 struct list_head sc_list;
1067 /*
1068 * The primary channel this sub-channel belongs to.
1069 * This will be NULL for the primary channel.
1070 */
1071 struct vmbus_channel *primary_channel;
1049}; 1072};
1050 1073
1051static inline void set_channel_read_state(struct vmbus_channel *c, bool state) 1074static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
@@ -1057,6 +1080,34 @@ void vmbus_onmessage(void *context);
1057 1080
1058int vmbus_request_offers(void); 1081int vmbus_request_offers(void);
1059 1082
1083/*
1084 * APIs for managing sub-channels.
1085 */
1086
1087void vmbus_set_sc_create_callback(struct vmbus_channel *primary_channel,
1088 void (*sc_cr_cb)(struct vmbus_channel *new_sc));
1089
1090/*
1091 * Retrieve the (sub) channel on which to send an outgoing request.
1092 * When a primary channel has multiple sub-channels, we choose a
1093 * channel whose VCPU binding is closest to the VCPU on which
1094 * this call is being made.
1095 */
1096struct vmbus_channel *vmbus_get_outgoing_channel(struct vmbus_channel *primary);
1097
1098/*
1099 * Check if sub-channels have already been offerred. This API will be useful
1100 * when the driver is unloaded after establishing sub-channels. In this case,
1101 * when the driver is re-loaded, the driver would have to check if the
1102 * subchannels have already been established before attempting to request
1103 * the creation of sub-channels.
1104 * This function returns TRUE to indicate that subchannels have already been
1105 * created.
1106 * This function should be invoked after setting the callback function for
1107 * sub-channel creation.
1108 */
1109bool vmbus_are_subchannels_present(struct vmbus_channel *primary);
1110
1060/* The format must be the same as struct vmdata_gpa_direct */ 1111/* The format must be the same as struct vmdata_gpa_direct */
1061struct vmbus_channel_packet_page_buffer { 1112struct vmbus_channel_packet_page_buffer {
1062 u16 type; 1113 u16 type;
@@ -1327,6 +1378,15 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
1327 0x8e, 0x77, 0x05, 0x58, 0xeb, 0x10, 0x73, 0xf8 \ 1378 0x8e, 0x77, 0x05, 0x58, 0xeb, 0x10, 0x73, 0xf8 \
1328 } 1379 }
1329 1380
1381/*
1382 * Synthetic FC GUID
1383 * {2f9bcc4a-0069-4af3-b76b-6fd0be528cda}
1384 */
1385#define HV_SYNTHFC_GUID \
1386 .guid = { \
1387 0x4A, 0xCC, 0x9B, 0x2F, 0x69, 0x00, 0xF3, 0x4A, \
1388 0xB7, 0x6B, 0x6F, 0xD0, 0xBE, 0x52, 0x8C, 0xDA \
1389 }
1330 1390
1331/* 1391/*
1332 * Common header for Hyper-V ICs 1392 * Common header for Hyper-V ICs
@@ -1424,7 +1484,7 @@ struct hyperv_service_callback {
1424}; 1484};
1425 1485
1426#define MAX_SRV_VER 0x7ffffff 1486#define MAX_SRV_VER 0x7ffffff
1427extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, 1487extern bool vmbus_prep_negotiate_resp(struct icmsg_hdr *,
1428 struct icmsg_negotiate *, u8 *, int, 1488 struct icmsg_negotiate *, u8 *, int,
1429 int); 1489 int);
1430 1490
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index e988fa935b3c..2ab11dc38077 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -447,11 +447,13 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
447static inline struct i2c_adapter * 447static inline struct i2c_adapter *
448i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter) 448i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
449{ 449{
450#if IS_ENABLED(I2C_MUX)
450 struct device *parent = adapter->dev.parent; 451 struct device *parent = adapter->dev.parent;
451 452
452 if (parent != NULL && parent->type == &i2c_adapter_type) 453 if (parent != NULL && parent->type == &i2c_adapter_type)
453 return to_i2c_adapter(parent); 454 return to_i2c_adapter(parent);
454 else 455 else
456#endif
455 return NULL; 457 return NULL;
456} 458}
457 459
@@ -542,10 +544,24 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
542 544
543#endif /* I2C */ 545#endif /* I2C */
544 546
545#if IS_ENABLED(CONFIG_ACPI_I2C) 547#if IS_ENABLED(CONFIG_OF)
546extern void acpi_i2c_register_devices(struct i2c_adapter *adap); 548/* must call put_device() when done with returned i2c_client device */
549extern struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
550
551/* must call put_device() when done with returned i2c_adapter device */
552extern struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node);
553
547#else 554#else
548static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) {} 555
549#endif 556static inline struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
557{
558 return NULL;
559}
560
561static inline struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
562{
563 return NULL;
564}
565#endif /* CONFIG_OF */
550 566
551#endif /* _LINUX_I2C_H */ 567#endif /* _LINUX_I2C_H */
diff --git a/include/linux/i2c/i2c-hid.h b/include/linux/i2c/i2c-hid.h
index 60e411d764d4..7aa901d92058 100644
--- a/include/linux/i2c/i2c-hid.h
+++ b/include/linux/i2c/i2c-hid.h
@@ -19,7 +19,8 @@
19 * @hid_descriptor_address: i2c register where the HID descriptor is stored. 19 * @hid_descriptor_address: i2c register where the HID descriptor is stored.
20 * 20 *
21 * Note that it is the responsibility of the platform driver (or the acpi 5.0 21 * Note that it is the responsibility of the platform driver (or the acpi 5.0
22 * driver) to setup the irq related to the gpio in the struct i2c_board_info. 22 * driver, or the flattened device tree) to setup the irq related to the gpio in
23 * the struct i2c_board_info.
23 * The platform driver should also setup the gpio according to the device: 24 * The platform driver should also setup the gpio according to the device:
24 * 25 *
25 * A typical example is the following: 26 * A typical example is the following:
diff --git a/include/linux/i2c/pxa-i2c.h b/include/linux/i2c/pxa-i2c.h
index 1a9f65e6ec0f..53aab243cbd8 100644
--- a/include/linux/i2c/pxa-i2c.h
+++ b/include/linux/i2c/pxa-i2c.h
@@ -67,6 +67,9 @@ struct i2c_pxa_platform_data {
67 unsigned int class; 67 unsigned int class;
68 unsigned int use_pio :1; 68 unsigned int use_pio :1;
69 unsigned int fast_mode :1; 69 unsigned int fast_mode :1;
70 unsigned int high_mode:1;
71 unsigned char master_code;
72 unsigned long rate;
70}; 73};
71 74
72extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info); 75extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 488debbef895..81cbbdb96aae 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -658,7 +658,6 @@ struct twl4030_power_data {
658 bool use_poweroff; /* Board is wired for TWL poweroff */ 658 bool use_poweroff; /* Board is wired for TWL poweroff */
659}; 659};
660 660
661extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
662extern int twl4030_remove_script(u8 flags); 661extern int twl4030_remove_script(u8 flags);
663extern void twl4030_power_off(void); 662extern void twl4030_power_off(void);
664 663
@@ -726,7 +725,7 @@ struct twl4030_platform_data {
726 struct regulator_init_data *clk32kg; 725 struct regulator_init_data *clk32kg;
727 struct regulator_init_data *v1v8; 726 struct regulator_init_data *v1v8;
728 struct regulator_init_data *v2v1; 727 struct regulator_init_data *v2v1;
729 /* TWL6025 LDO regulators */ 728 /* TWL6032 LDO regulators */
730 struct regulator_init_data *ldo1; 729 struct regulator_init_data *ldo1;
731 struct regulator_init_data *ldo2; 730 struct regulator_init_data *ldo2;
732 struct regulator_init_data *ldo3; 731 struct regulator_init_data *ldo3;
@@ -736,7 +735,7 @@ struct twl4030_platform_data {
736 struct regulator_init_data *ldo7; 735 struct regulator_init_data *ldo7;
737 struct regulator_init_data *ldoln; 736 struct regulator_init_data *ldoln;
738 struct regulator_init_data *ldousb; 737 struct regulator_init_data *ldousb;
739 /* TWL6025 DCDC regulators */ 738 /* TWL6032 DCDC regulators */
740 struct regulator_init_data *smps3; 739 struct regulator_init_data *smps3;
741 struct regulator_init_data *smps4; 740 struct regulator_init_data *smps4;
742 struct regulator_init_data *vio6025; 741 struct regulator_init_data *vio6025;
@@ -753,7 +752,7 @@ struct twl_regulator_driver_data {
753#define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */ 752#define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */
754#define TWL5031 BIT(2) /* twl5031 has different registers */ 753#define TWL5031 BIT(2) /* twl5031 has different registers */
755#define TWL6030_CLASS BIT(3) /* TWL6030 class */ 754#define TWL6030_CLASS BIT(3) /* TWL6030 class */
756#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */ 755#define TWL6032_SUBCLASS BIT(4) /* TWL6032 has changed registers */
757#define TWL4030_ALLOW_UNSUPPORTED BIT(5) /* Some voltages are possible 756#define TWL4030_ALLOW_UNSUPPORTED BIT(5) /* Some voltages are possible
758 * but not officially supported. 757 * but not officially supported.
759 * This flag is necessary to 758 * This flag is necessary to
@@ -840,20 +839,20 @@ static inline int twl4030charger_usb_en(int enable) { return 0; }
840#define TWL6030_REG_CLK32KG 48 839#define TWL6030_REG_CLK32KG 48
841 840
842/* LDOs on 6025 have different names */ 841/* LDOs on 6025 have different names */
843#define TWL6025_REG_LDO2 49 842#define TWL6032_REG_LDO2 49
844#define TWL6025_REG_LDO4 50 843#define TWL6032_REG_LDO4 50
845#define TWL6025_REG_LDO3 51 844#define TWL6032_REG_LDO3 51
846#define TWL6025_REG_LDO5 52 845#define TWL6032_REG_LDO5 52
847#define TWL6025_REG_LDO1 53 846#define TWL6032_REG_LDO1 53
848#define TWL6025_REG_LDO7 54 847#define TWL6032_REG_LDO7 54
849#define TWL6025_REG_LDO6 55 848#define TWL6032_REG_LDO6 55
850#define TWL6025_REG_LDOLN 56 849#define TWL6032_REG_LDOLN 56
851#define TWL6025_REG_LDOUSB 57 850#define TWL6032_REG_LDOUSB 57
852 851
853/* 6025 DCDC supplies */ 852/* 6025 DCDC supplies */
854#define TWL6025_REG_SMPS3 58 853#define TWL6032_REG_SMPS3 58
855#define TWL6025_REG_SMPS4 59 854#define TWL6032_REG_SMPS4 59
856#define TWL6025_REG_VIO 60 855#define TWL6032_REG_VIO 60
857 856
858 857
859#endif /* End of __TWL4030_H */ 858#endif /* End of __TWL4030_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 06b0ed0154a4..a5b598a79bec 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -16,6 +16,7 @@
16#define LINUX_IEEE80211_H 16#define LINUX_IEEE80211_H
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/if_ether.h>
19#include <asm/byteorder.h> 20#include <asm/byteorder.h>
20 21
21/* 22/*
@@ -146,6 +147,7 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
146#define IEEE80211_MAX_RTS_THRESHOLD 2353 147#define IEEE80211_MAX_RTS_THRESHOLD 2353
147#define IEEE80211_MAX_AID 2007 148#define IEEE80211_MAX_AID 2007
148#define IEEE80211_MAX_TIM_LEN 251 149#define IEEE80211_MAX_TIM_LEN 251
150#define IEEE80211_MAX_MESH_PEERINGS 63
149/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 151/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
150 6.2.1.1.2. 152 6.2.1.1.2.
151 153
@@ -208,28 +210,28 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
208struct ieee80211_hdr { 210struct ieee80211_hdr {
209 __le16 frame_control; 211 __le16 frame_control;
210 __le16 duration_id; 212 __le16 duration_id;
211 u8 addr1[6]; 213 u8 addr1[ETH_ALEN];
212 u8 addr2[6]; 214 u8 addr2[ETH_ALEN];
213 u8 addr3[6]; 215 u8 addr3[ETH_ALEN];
214 __le16 seq_ctrl; 216 __le16 seq_ctrl;
215 u8 addr4[6]; 217 u8 addr4[ETH_ALEN];
216} __packed __aligned(2); 218} __packed __aligned(2);
217 219
218struct ieee80211_hdr_3addr { 220struct ieee80211_hdr_3addr {
219 __le16 frame_control; 221 __le16 frame_control;
220 __le16 duration_id; 222 __le16 duration_id;
221 u8 addr1[6]; 223 u8 addr1[ETH_ALEN];
222 u8 addr2[6]; 224 u8 addr2[ETH_ALEN];
223 u8 addr3[6]; 225 u8 addr3[ETH_ALEN];
224 __le16 seq_ctrl; 226 __le16 seq_ctrl;
225} __packed __aligned(2); 227} __packed __aligned(2);
226 228
227struct ieee80211_qos_hdr { 229struct ieee80211_qos_hdr {
228 __le16 frame_control; 230 __le16 frame_control;
229 __le16 duration_id; 231 __le16 duration_id;
230 u8 addr1[6]; 232 u8 addr1[ETH_ALEN];
231 u8 addr2[6]; 233 u8 addr2[ETH_ALEN];
232 u8 addr3[6]; 234 u8 addr3[ETH_ALEN];
233 __le16 seq_ctrl; 235 __le16 seq_ctrl;
234 __le16 qos_ctrl; 236 __le16 qos_ctrl;
235} __packed __aligned(2); 237} __packed __aligned(2);
@@ -607,8 +609,8 @@ struct ieee80211s_hdr {
607 u8 flags; 609 u8 flags;
608 u8 ttl; 610 u8 ttl;
609 __le32 seqnum; 611 __le32 seqnum;
610 u8 eaddr1[6]; 612 u8 eaddr1[ETH_ALEN];
611 u8 eaddr2[6]; 613 u8 eaddr2[ETH_ALEN];
612} __packed __aligned(2); 614} __packed __aligned(2);
613 615
614/* Mesh flags */ 616/* Mesh flags */
@@ -757,7 +759,7 @@ struct ieee80211_rann_ie {
757 u8 rann_flags; 759 u8 rann_flags;
758 u8 rann_hopcount; 760 u8 rann_hopcount;
759 u8 rann_ttl; 761 u8 rann_ttl;
760 u8 rann_addr[6]; 762 u8 rann_addr[ETH_ALEN];
761 __le32 rann_seq; 763 __le32 rann_seq;
762 __le32 rann_interval; 764 __le32 rann_interval;
763 __le32 rann_metric; 765 __le32 rann_metric;
@@ -801,9 +803,9 @@ enum ieee80211_vht_opmode_bits {
801struct ieee80211_mgmt { 803struct ieee80211_mgmt {
802 __le16 frame_control; 804 __le16 frame_control;
803 __le16 duration; 805 __le16 duration;
804 u8 da[6]; 806 u8 da[ETH_ALEN];
805 u8 sa[6]; 807 u8 sa[ETH_ALEN];
806 u8 bssid[6]; 808 u8 bssid[ETH_ALEN];
807 __le16 seq_ctrl; 809 __le16 seq_ctrl;
808 union { 810 union {
809 struct { 811 struct {
@@ -832,7 +834,7 @@ struct ieee80211_mgmt {
832 struct { 834 struct {
833 __le16 capab_info; 835 __le16 capab_info;
834 __le16 listen_interval; 836 __le16 listen_interval;
835 u8 current_ap[6]; 837 u8 current_ap[ETH_ALEN];
836 /* followed by SSID and Supported rates */ 838 /* followed by SSID and Supported rates */
837 u8 variable[0]; 839 u8 variable[0];
838 } __packed reassoc_req; 840 } __packed reassoc_req;
@@ -965,21 +967,21 @@ struct ieee80211_vendor_ie {
965struct ieee80211_rts { 967struct ieee80211_rts {
966 __le16 frame_control; 968 __le16 frame_control;
967 __le16 duration; 969 __le16 duration;
968 u8 ra[6]; 970 u8 ra[ETH_ALEN];
969 u8 ta[6]; 971 u8 ta[ETH_ALEN];
970} __packed __aligned(2); 972} __packed __aligned(2);
971 973
972struct ieee80211_cts { 974struct ieee80211_cts {
973 __le16 frame_control; 975 __le16 frame_control;
974 __le16 duration; 976 __le16 duration;
975 u8 ra[6]; 977 u8 ra[ETH_ALEN];
976} __packed __aligned(2); 978} __packed __aligned(2);
977 979
978struct ieee80211_pspoll { 980struct ieee80211_pspoll {
979 __le16 frame_control; 981 __le16 frame_control;
980 __le16 aid; 982 __le16 aid;
981 u8 bssid[6]; 983 u8 bssid[ETH_ALEN];
982 u8 ta[6]; 984 u8 ta[ETH_ALEN];
983} __packed __aligned(2); 985} __packed __aligned(2);
984 986
985/* TDLS */ 987/* TDLS */
@@ -988,14 +990,14 @@ struct ieee80211_pspoll {
988struct ieee80211_tdls_lnkie { 990struct ieee80211_tdls_lnkie {
989 u8 ie_type; /* Link Identifier IE */ 991 u8 ie_type; /* Link Identifier IE */
990 u8 ie_len; 992 u8 ie_len;
991 u8 bssid[6]; 993 u8 bssid[ETH_ALEN];
992 u8 init_sta[6]; 994 u8 init_sta[ETH_ALEN];
993 u8 resp_sta[6]; 995 u8 resp_sta[ETH_ALEN];
994} __packed; 996} __packed;
995 997
996struct ieee80211_tdls_data { 998struct ieee80211_tdls_data {
997 u8 da[6]; 999 u8 da[ETH_ALEN];
998 u8 sa[6]; 1000 u8 sa[ETH_ALEN];
999 __be16 ether_type; 1001 __be16 ether_type;
1000 u8 payload_type; 1002 u8 payload_type;
1001 u8 category; 1003 u8 category;
@@ -1089,8 +1091,8 @@ struct ieee80211_p2p_noa_attr {
1089struct ieee80211_bar { 1091struct ieee80211_bar {
1090 __le16 frame_control; 1092 __le16 frame_control;
1091 __le16 duration; 1093 __le16 duration;
1092 __u8 ra[6]; 1094 __u8 ra[ETH_ALEN];
1093 __u8 ta[6]; 1095 __u8 ta[ETH_ALEN];
1094 __le16 control; 1096 __le16 control;
1095 __le16 start_seq_num; 1097 __le16 start_seq_num;
1096} __packed; 1098} __packed;
@@ -1708,6 +1710,10 @@ enum ieee80211_eid {
1708 WLAN_EID_OPMODE_NOTIF = 199, 1710 WLAN_EID_OPMODE_NOTIF = 199,
1709 WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194, 1711 WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194,
1710 WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196, 1712 WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196,
1713 WLAN_EID_EXTENDED_BSS_LOAD = 193,
1714 WLAN_EID_VHT_TX_POWER_ENVELOPE = 195,
1715 WLAN_EID_AID = 197,
1716 WLAN_EID_QUIET_CHANNEL = 198,
1711 1717
1712 /* 802.11ad */ 1718 /* 802.11ad */
1713 WLAN_EID_NON_TX_BSSID_CAP = 83, 1719 WLAN_EID_NON_TX_BSSID_CAP = 83,
@@ -1829,6 +1835,15 @@ enum ieee80211_key_len {
1829 WLAN_KEY_LEN_AES_CMAC = 16, 1835 WLAN_KEY_LEN_AES_CMAC = 16,
1830}; 1836};
1831 1837
1838#define IEEE80211_WEP_IV_LEN 4
1839#define IEEE80211_WEP_ICV_LEN 4
1840#define IEEE80211_CCMP_HDR_LEN 8
1841#define IEEE80211_CCMP_MIC_LEN 8
1842#define IEEE80211_CCMP_PN_LEN 6
1843#define IEEE80211_TKIP_IV_LEN 8
1844#define IEEE80211_TKIP_ICV_LEN 4
1845#define IEEE80211_CMAC_PN_LEN 6
1846
1832/* Public action codes */ 1847/* Public action codes */
1833enum ieee80211_pub_actioncode { 1848enum ieee80211_pub_actioncode {
1834 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4, 1849 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4,
@@ -1850,6 +1865,11 @@ enum ieee80211_tdls_actioncode {
1850 WLAN_TDLS_DISCOVERY_REQUEST = 10, 1865 WLAN_TDLS_DISCOVERY_REQUEST = 10,
1851}; 1866};
1852 1867
1868/* Interworking capabilities are set in 7th bit of 4th byte of the
1869 * @WLAN_EID_EXT_CAPABILITY information element
1870 */
1871#define WLAN_EXT_CAPA4_INTERWORKING_ENABLED BIT(7)
1872
1853/* 1873/*
1854 * TDLS capabililites to be enabled in the 5th byte of the 1874 * TDLS capabililites to be enabled in the 5th byte of the
1855 * @WLAN_EID_EXT_CAPABILITY information element 1875 * @WLAN_EID_EXT_CAPABILITY information element
@@ -2269,4 +2289,8 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
2269 return !!(tim->virtual_map[index] & mask); 2289 return !!(tim->virtual_map[index] & mask);
2270} 2290}
2271 2291
2292/* convert time units */
2293#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024))
2294#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x))
2295
2272#endif /* LINUX_IEEE80211_H */ 2296#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 12b4d55a02af..d5569734f672 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -30,7 +30,6 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
30 30
31int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); 31int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
32 32
33int mac_pton(const char *s, u8 *mac);
34extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); 33extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
35 34
36#endif /* _LINUX_IF_ETHER_H */ 35#endif /* _LINUX_IF_ETHER_H */
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index c3f817c3eb45..a86784dec3d3 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -12,5 +12,6 @@ struct ifla_vf_info {
12 __u32 qos; 12 __u32 qos;
13 __u32 tx_rate; 13 __u32 tx_rate;
14 __u32 spoofchk; 14 __u32 spoofchk;
15 __u32 linkstate;
15}; 16};
16#endif /* _LINUX_IF_LINK_H */ 17#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 84dde1dd1da4..ddd33fd5904d 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -8,7 +8,7 @@
8#include <net/netlink.h> 8#include <net/netlink.h>
9#include <linux/u64_stats_sync.h> 9#include <linux/u64_stats_sync.h>
10 10
11#if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE) 11#if IS_ENABLED(CONFIG_MACVTAP)
12struct socket *macvtap_get_socket(struct file *); 12struct socket *macvtap_get_socket(struct file *);
13#else 13#else
14#include <linux/err.h> 14#include <linux/err.h>
@@ -50,7 +50,7 @@ struct macvlan_pcpu_stats {
50 * Maximum times a macvtap device can be opened. This can be used to 50 * Maximum times a macvtap device can be opened. This can be used to
51 * configure the number of receive queue, e.g. for multiqueue virtio. 51 * configure the number of receive queue, e.g. for multiqueue virtio.
52 */ 52 */
53#define MAX_MACVTAP_QUEUES (NR_CPUS < 16 ? NR_CPUS : 16) 53#define MAX_MACVTAP_QUEUES 16
54 54
55#define MACVLAN_MC_FILTER_BITS 8 55#define MACVLAN_MC_FILTER_BITS 8
56#define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS) 56#define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS)
@@ -65,12 +65,18 @@ struct macvlan_dev {
65 65
66 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ); 66 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ);
67 67
68 netdev_features_t set_features;
68 enum macvlan_mode mode; 69 enum macvlan_mode mode;
69 u16 flags; 70 u16 flags;
70 int (*receive)(struct sk_buff *skb); 71 int (*receive)(struct sk_buff *skb);
71 int (*forward)(struct net_device *dev, struct sk_buff *skb); 72 int (*forward)(struct net_device *dev, struct sk_buff *skb);
72 struct macvtap_queue *taps[MAX_MACVTAP_QUEUES]; 73 /* This array tracks active taps. */
74 struct macvtap_queue __rcu *taps[MAX_MACVTAP_QUEUES];
75 /* This list tracks all taps (both enabled and disabled) */
76 struct list_head queue_list;
73 int numvtaps; 77 int numvtaps;
78 int numqueues;
79 netdev_features_t tap_features;
74 int minor; 80 int minor;
75}; 81};
76 82
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 4474557904f6..a899dc24be15 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -10,9 +10,9 @@
10#ifndef _LINUX_IF_TEAM_H_ 10#ifndef _LINUX_IF_TEAM_H_
11#define _LINUX_IF_TEAM_H_ 11#define _LINUX_IF_TEAM_H_
12 12
13
14#include <linux/netpoll.h> 13#include <linux/netpoll.h>
15#include <net/sch_generic.h> 14#include <net/sch_generic.h>
15#include <linux/types.h>
16#include <uapi/linux/if_team.h> 16#include <uapi/linux/if_team.h>
17 17
18struct team_pcpu_stats { 18struct team_pcpu_stats {
@@ -69,6 +69,7 @@ struct team_port {
69 s32 priority; /* lower number ~ higher priority */ 69 s32 priority; /* lower number ~ higher priority */
70 u16 queue_id; 70 u16 queue_id;
71 struct list_head qom_list; /* node in queue override mapping list */ 71 struct list_head qom_list; /* node in queue override mapping list */
72 struct rcu_head rcu;
72 long mode_priv[0]; 73 long mode_priv[0];
73}; 74};
74 75
@@ -193,6 +194,18 @@ struct team {
193 bool user_carrier_enabled; 194 bool user_carrier_enabled;
194 bool queue_override_enabled; 195 bool queue_override_enabled;
195 struct list_head *qom_lists; /* array of queue override mapping lists */ 196 struct list_head *qom_lists; /* array of queue override mapping lists */
197 struct {
198 unsigned int count;
199 unsigned int interval; /* in ms */
200 atomic_t count_pending;
201 struct delayed_work dw;
202 } notify_peers;
203 struct {
204 unsigned int count;
205 unsigned int interval; /* in ms */
206 atomic_t count_pending;
207 struct delayed_work dw;
208 } mcast_rejoin;
196 long mode_priv[TEAM_MODE_PRIV_LONGS]; 209 long mode_priv[TEAM_MODE_PRIV_LONGS];
197}; 210};
198 211
@@ -228,6 +241,16 @@ static inline struct team_port *team_get_port_by_index(struct team *team,
228 return port; 241 return port;
229 return NULL; 242 return NULL;
230} 243}
244
245static inline int team_num_to_port_index(struct team *team, int num)
246{
247 int en_port_count = ACCESS_ONCE(team->en_port_count);
248
249 if (unlikely(!en_port_count))
250 return 0;
251 return num % en_port_count;
252}
253
231static inline struct team_port *team_get_port_by_index_rcu(struct team *team, 254static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
232 int port_index) 255 int port_index)
233{ 256{
@@ -249,12 +272,12 @@ team_get_first_port_txable_rcu(struct team *team, struct team_port *port)
249 return port; 272 return port;
250 cur = port; 273 cur = port;
251 list_for_each_entry_continue_rcu(cur, &team->port_list, list) 274 list_for_each_entry_continue_rcu(cur, &team->port_list, list)
252 if (team_port_txable(port)) 275 if (team_port_txable(cur))
253 return cur; 276 return cur;
254 list_for_each_entry_rcu(cur, &team->port_list, list) { 277 list_for_each_entry_rcu(cur, &team->port_list, list) {
255 if (cur == port) 278 if (cur == port)
256 break; 279 break;
257 if (team_port_txable(port)) 280 if (team_port_txable(cur))
258 return cur; 281 return cur;
259 } 282 }
260 return NULL; 283 return NULL;
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 52bd03b38962..715c343f7c00 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -44,7 +44,7 @@ struct vlan_hdr {
44 * struct vlan_ethhdr - vlan ethernet header (ethhdr + vlan_hdr) 44 * struct vlan_ethhdr - vlan ethernet header (ethhdr + vlan_hdr)
45 * @h_dest: destination ethernet address 45 * @h_dest: destination ethernet address
46 * @h_source: source ethernet address 46 * @h_source: source ethernet address
47 * @h_vlan_proto: ethernet protocol (always 0x8100) 47 * @h_vlan_proto: ethernet protocol
48 * @h_vlan_TCI: priority and VLAN ID 48 * @h_vlan_TCI: priority and VLAN ID
49 * @h_vlan_encapsulated_proto: packet type ID or len 49 * @h_vlan_encapsulated_proto: packet type ID or len
50 */ 50 */
@@ -79,9 +79,8 @@ static inline int is_vlan_dev(struct net_device *dev)
79} 79}
80 80
81#define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT) 81#define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT)
82#define vlan_tx_nonzero_tag_present(__skb) \
83 (vlan_tx_tag_present(__skb) && ((__skb)->vlan_tci & VLAN_VID_MASK))
84#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) 82#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
83#define vlan_tx_tag_get_id(__skb) ((__skb)->vlan_tci & VLAN_VID_MASK)
85 84
86#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 85#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
87 86
@@ -243,8 +242,6 @@ static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
243 return skb; 242 return skb;
244} 243}
245 244
246#define HAVE_VLAN_PUT_TAG
247
248/** 245/**
249 * vlan_put_tag - inserts VLAN tag according to device features 246 * vlan_put_tag - inserts VLAN tag according to device features
250 * @skb: skbuff to tag 247 * @skb: skbuff to tag
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 7f2bf1518480..f47550d75f85 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -84,6 +84,7 @@ struct ip_mc_list {
84 struct ip_mc_list *next; 84 struct ip_mc_list *next;
85 struct ip_mc_list __rcu *next_rcu; 85 struct ip_mc_list __rcu *next_rcu;
86 }; 86 };
87 struct ip_mc_list __rcu *next_hash;
87 struct timer_list timer; 88 struct timer_list timer;
88 int users; 89 int users;
89 atomic_t refcnt; 90 atomic_t refcnt;
@@ -128,6 +129,5 @@ extern void ip_mc_unmap(struct in_device *);
128extern void ip_mc_remap(struct in_device *); 129extern void ip_mc_remap(struct in_device *);
129extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr); 130extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
130extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr); 131extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
131extern void ip_mc_rejoin_groups(struct in_device *in_dev);
132 132
133#endif 133#endif
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 172c5b23cb84..e51f65480ea5 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -17,6 +17,8 @@
17#include <linux/iio/trigger.h> 17#include <linux/iio/trigger.h>
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19 19
20#include <linux/platform_data/st_sensors_pdata.h>
21
20#define ST_SENSORS_TX_MAX_LENGTH 2 22#define ST_SENSORS_TX_MAX_LENGTH 2
21#define ST_SENSORS_RX_MAX_LENGTH 6 23#define ST_SENSORS_RX_MAX_LENGTH 6
22 24
@@ -24,14 +26,10 @@
24#define ST_SENSORS_FULLSCALE_AVL_MAX 10 26#define ST_SENSORS_FULLSCALE_AVL_MAX 10
25 27
26#define ST_SENSORS_NUMBER_ALL_CHANNELS 4 28#define ST_SENSORS_NUMBER_ALL_CHANNELS 4
27#define ST_SENSORS_NUMBER_DATA_CHANNELS 3
28#define ST_SENSORS_ENABLE_ALL_AXIS 0x07 29#define ST_SENSORS_ENABLE_ALL_AXIS 0x07
29#define ST_SENSORS_BYTE_FOR_CHANNEL 2
30#define ST_SENSORS_SCAN_X 0 30#define ST_SENSORS_SCAN_X 0
31#define ST_SENSORS_SCAN_Y 1 31#define ST_SENSORS_SCAN_Y 1
32#define ST_SENSORS_SCAN_Z 2 32#define ST_SENSORS_SCAN_Z 2
33#define ST_SENSORS_DEFAULT_12_REALBITS 12
34#define ST_SENSORS_DEFAULT_16_REALBITS 16
35#define ST_SENSORS_DEFAULT_POWER_ON_VALUE 0x01 33#define ST_SENSORS_DEFAULT_POWER_ON_VALUE 0x01
36#define ST_SENSORS_DEFAULT_POWER_OFF_VALUE 0x00 34#define ST_SENSORS_DEFAULT_POWER_OFF_VALUE 0x00
37#define ST_SENSORS_DEFAULT_WAI_ADDRESS 0x0f 35#define ST_SENSORS_DEFAULT_WAI_ADDRESS 0x0f
@@ -42,20 +40,20 @@
42#define ST_SENSORS_MAX_NAME 17 40#define ST_SENSORS_MAX_NAME 17
43#define ST_SENSORS_MAX_4WAI 7 41#define ST_SENSORS_MAX_4WAI 7
44 42
45#define ST_SENSORS_LSM_CHANNELS(device_type, index, mod, endian, bits, addr) \ 43#define ST_SENSORS_LSM_CHANNELS(device_type, mask, index, mod, \
44 ch2, s, endian, rbits, sbits, addr) \
46{ \ 45{ \
47 .type = device_type, \ 46 .type = device_type, \
48 .modified = 1, \ 47 .modified = mod, \
49 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 48 .info_mask_separate = mask, \
50 BIT(IIO_CHAN_INFO_SCALE), \
51 .scan_index = index, \ 49 .scan_index = index, \
52 .channel2 = mod, \ 50 .channel2 = ch2, \
53 .address = addr, \ 51 .address = addr, \
54 .scan_type = { \ 52 .scan_type = { \
55 .sign = 's', \ 53 .sign = s, \
56 .realbits = bits, \ 54 .realbits = rbits, \
57 .shift = 16 - bits, \ 55 .shift = sbits - rbits, \
58 .storagebits = 16, \ 56 .storagebits = sbits, \
59 .endianness = endian, \ 57 .endianness = endian, \
60 }, \ 58 }, \
61} 59}
@@ -122,14 +120,16 @@ struct st_sensor_bdu {
122/** 120/**
123 * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt 121 * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt
124 * @addr: address of the register. 122 * @addr: address of the register.
125 * @mask: mask to write the on/off value. 123 * @mask_int1: mask to enable/disable IRQ on INT1 pin.
124 * @mask_int2: mask to enable/disable IRQ on INT2 pin.
126 * struct ig1 - represents the Interrupt Generator 1 of sensors. 125 * struct ig1 - represents the Interrupt Generator 1 of sensors.
127 * @en_addr: address of the enable ig1 register. 126 * @en_addr: address of the enable ig1 register.
128 * @en_mask: mask to write the on/off value for enable. 127 * @en_mask: mask to write the on/off value for enable.
129 */ 128 */
130struct st_sensor_data_ready_irq { 129struct st_sensor_data_ready_irq {
131 u8 addr; 130 u8 addr;
132 u8 mask; 131 u8 mask_int1;
132 u8 mask_int2;
133 struct { 133 struct {
134 u8 en_addr; 134 u8 en_addr;
135 u8 en_mask; 135 u8 en_mask;
@@ -204,6 +204,8 @@ struct st_sensors {
204 * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread. 204 * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
205 * @buffer_data: Data used by buffer part. 205 * @buffer_data: Data used by buffer part.
206 * @odr: Output data rate of the sensor [Hz]. 206 * @odr: Output data rate of the sensor [Hz].
207 * num_data_channels: Number of data channels used in buffer.
208 * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2).
207 * @get_irq_data_ready: Function to get the IRQ used for data ready signal. 209 * @get_irq_data_ready: Function to get the IRQ used for data ready signal.
208 * @tf: Transfer function structure used by I/O operations. 210 * @tf: Transfer function structure used by I/O operations.
209 * @tb: Transfer buffers and mutex used by I/O operations. 211 * @tb: Transfer buffers and mutex used by I/O operations.
@@ -220,6 +222,9 @@ struct st_sensor_data {
220 char *buffer_data; 222 char *buffer_data;
221 223
222 unsigned int odr; 224 unsigned int odr;
225 unsigned int num_data_channels;
226
227 u8 drdy_int_pin;
223 228
224 unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev); 229 unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev);
225 230
@@ -251,7 +256,8 @@ static inline void st_sensors_deallocate_trigger(struct iio_dev *indio_dev)
251} 256}
252#endif 257#endif
253 258
254int st_sensors_init_sensor(struct iio_dev *indio_dev); 259int st_sensors_init_sensor(struct iio_dev *indio_dev,
260 struct st_sensors_platform_data *pdata);
255 261
256int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable); 262int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable);
257 263
diff --git a/include/linux/iio/frequency/adf4350.h b/include/linux/iio/frequency/adf4350.h
index be91f344d5fc..ffd8c8f90928 100644
--- a/include/linux/iio/frequency/adf4350.h
+++ b/include/linux/iio/frequency/adf4350.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * ADF4350/ADF4351 SPI PLL driver 2 * ADF4350/ADF4351 SPI PLL driver
3 * 3 *
4 * Copyright 2012 Analog Devices Inc. 4 * Copyright 2012-2013 Analog Devices Inc.
5 * 5 *
6 * Licensed under the GPL-2. 6 * Licensed under the GPL-2.
7 */ 7 */
@@ -41,7 +41,7 @@
41#define ADF4350_REG2_RDIV2_EN (1 << 24) 41#define ADF4350_REG2_RDIV2_EN (1 << 24)
42#define ADF4350_REG2_RMULT2_EN (1 << 25) 42#define ADF4350_REG2_RMULT2_EN (1 << 25)
43#define ADF4350_REG2_MUXOUT(x) ((x) << 26) 43#define ADF4350_REG2_MUXOUT(x) ((x) << 26)
44#define ADF4350_REG2_NOISE_MODE(x) ((x) << 29) 44#define ADF4350_REG2_NOISE_MODE(x) (((unsigned)(x)) << 29)
45#define ADF4350_MUXOUT_THREESTATE 0 45#define ADF4350_MUXOUT_THREESTATE 0
46#define ADF4350_MUXOUT_DVDD 1 46#define ADF4350_MUXOUT_DVDD 1
47#define ADF4350_MUXOUT_GND 2 47#define ADF4350_MUXOUT_GND 2
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 8d171f427632..2103cc32a5fb 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -211,8 +211,8 @@ struct iio_chan_spec {
211static inline bool iio_channel_has_info(const struct iio_chan_spec *chan, 211static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
212 enum iio_chan_info_enum type) 212 enum iio_chan_info_enum type)
213{ 213{
214 return (chan->info_mask_separate & type) | 214 return (chan->info_mask_separate & BIT(type)) |
215 (chan->info_mask_shared_by_type & type); 215 (chan->info_mask_shared_by_type & BIT(type));
216} 216}
217 217
218#define IIO_ST(si, rb, sb, sh) \ 218#define IIO_ST(si, rb, sb, sh) \
@@ -532,6 +532,60 @@ static inline struct iio_dev *iio_priv_to_dev(void *priv)
532void iio_device_free(struct iio_dev *indio_dev); 532void iio_device_free(struct iio_dev *indio_dev);
533 533
534/** 534/**
535 * devm_iio_device_alloc - Resource-managed iio_device_alloc()
536 * @dev: Device to allocate iio_dev for
537 * @sizeof_priv: Space to allocate for private structure.
538 *
539 * Managed iio_device_alloc. iio_dev allocated with this function is
540 * automatically freed on driver detach.
541 *
542 * If an iio_dev allocated with this function needs to be freed separately,
543 * devm_iio_device_free() must be used.
544 *
545 * RETURNS:
546 * Pointer to allocated iio_dev on success, NULL on failure.
547 */
548struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv);
549
550/**
551 * devm_iio_device_free - Resource-managed iio_device_free()
552 * @dev: Device this iio_dev belongs to
553 * @indio_dev: the iio_dev associated with the device
554 *
555 * Free iio_dev allocated with devm_iio_device_alloc().
556 */
557void devm_iio_device_free(struct device *dev, struct iio_dev *indio_dev);
558
559/**
560 * devm_iio_trigger_alloc - Resource-managed iio_trigger_alloc()
561 * @dev: Device to allocate iio_trigger for
562 * @fmt: trigger name format. If it includes format
563 * specifiers, the additional arguments following
564 * format are formatted and inserted in the resulting
565 * string replacing their respective specifiers.
566 *
567 * Managed iio_trigger_alloc. iio_trigger allocated with this function is
568 * automatically freed on driver detach.
569 *
570 * If an iio_trigger allocated with this function needs to be freed separately,
571 * devm_iio_trigger_free() must be used.
572 *
573 * RETURNS:
574 * Pointer to allocated iio_trigger on success, NULL on failure.
575 */
576struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
577 const char *fmt, ...);
578
579/**
580 * devm_iio_trigger_free - Resource-managed iio_trigger_free()
581 * @dev: Device this iio_dev belongs to
582 * @iio_trig: the iio_trigger associated with the device
583 *
584 * Free iio_trigger allocated with devm_iio_trigger_alloc().
585 */
586void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig);
587
588/**
535 * iio_buffer_enabled() - helper function to test if the buffer is enabled 589 * iio_buffer_enabled() - helper function to test if the buffer is enabled
536 * @indio_dev: IIO device structure for device 590 * @indio_dev: IIO device structure for device
537 **/ 591 **/
diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
index b7a934b9431b..2958c960003a 100644
--- a/include/linux/iio/sysfs.h
+++ b/include/linux/iio/sysfs.h
@@ -73,11 +73,6 @@ struct iio_const_attr {
73 .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)} 73 .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
74 74
75/* Generic attributes of onetype or another */ 75/* Generic attributes of onetype or another */
76/**
77 * IIO_DEV_ATTR_RESET: resets the device
78 **/
79#define IIO_DEV_ATTR_RESET(_store) \
80 IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, _store, 0)
81 76
82/** 77/**
83 * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency 78 * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index 3869c525b052..369cf2cd5144 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -8,6 +8,7 @@
8 */ 8 */
9#include <linux/irq.h> 9#include <linux/irq.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/atomic.h>
11 12
12#ifndef _IIO_TRIGGER_H_ 13#ifndef _IIO_TRIGGER_H_
13#define _IIO_TRIGGER_H_ 14#define _IIO_TRIGGER_H_
@@ -61,7 +62,7 @@ struct iio_trigger {
61 62
62 struct list_head list; 63 struct list_head list;
63 struct list_head alloc_list; 64 struct list_head alloc_list;
64 int use_count; 65 atomic_t use_count;
65 66
66 struct irq_chip subirq_chip; 67 struct irq_chip subirq_chip;
67 int subirq_base; 68 int subirq_base;
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index ea1e3b863890..79640e015a86 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -5,57 +5,30 @@
5 5
6#include <linux/bitmap.h> 6#include <linux/bitmap.h>
7#include <linux/if.h> 7#include <linux/if.h>
8#include <linux/ip.h>
8#include <linux/netdevice.h> 9#include <linux/netdevice.h>
9#include <linux/rcupdate.h> 10#include <linux/rcupdate.h>
10#include <linux/timer.h> 11#include <linux/timer.h>
11#include <linux/sysctl.h> 12#include <linux/sysctl.h>
12#include <linux/rtnetlink.h> 13#include <linux/rtnetlink.h>
13 14
14enum
15{
16 IPV4_DEVCONF_FORWARDING=1,
17 IPV4_DEVCONF_MC_FORWARDING,
18 IPV4_DEVCONF_PROXY_ARP,
19 IPV4_DEVCONF_ACCEPT_REDIRECTS,
20 IPV4_DEVCONF_SECURE_REDIRECTS,
21 IPV4_DEVCONF_SEND_REDIRECTS,
22 IPV4_DEVCONF_SHARED_MEDIA,
23 IPV4_DEVCONF_RP_FILTER,
24 IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE,
25 IPV4_DEVCONF_BOOTP_RELAY,
26 IPV4_DEVCONF_LOG_MARTIANS,
27 IPV4_DEVCONF_TAG,
28 IPV4_DEVCONF_ARPFILTER,
29 IPV4_DEVCONF_MEDIUM_ID,
30 IPV4_DEVCONF_NOXFRM,
31 IPV4_DEVCONF_NOPOLICY,
32 IPV4_DEVCONF_FORCE_IGMP_VERSION,
33 IPV4_DEVCONF_ARP_ANNOUNCE,
34 IPV4_DEVCONF_ARP_IGNORE,
35 IPV4_DEVCONF_PROMOTE_SECONDARIES,
36 IPV4_DEVCONF_ARP_ACCEPT,
37 IPV4_DEVCONF_ARP_NOTIFY,
38 IPV4_DEVCONF_ACCEPT_LOCAL,
39 IPV4_DEVCONF_SRC_VMARK,
40 IPV4_DEVCONF_PROXY_ARP_PVLAN,
41 IPV4_DEVCONF_ROUTE_LOCALNET,
42 __IPV4_DEVCONF_MAX
43};
44
45#define IPV4_DEVCONF_MAX (__IPV4_DEVCONF_MAX - 1)
46
47struct ipv4_devconf { 15struct ipv4_devconf {
48 void *sysctl; 16 void *sysctl;
49 int data[IPV4_DEVCONF_MAX]; 17 int data[IPV4_DEVCONF_MAX];
50 DECLARE_BITMAP(state, IPV4_DEVCONF_MAX); 18 DECLARE_BITMAP(state, IPV4_DEVCONF_MAX);
51}; 19};
52 20
21#define MC_HASH_SZ_LOG 9
22
53struct in_device { 23struct in_device {
54 struct net_device *dev; 24 struct net_device *dev;
55 atomic_t refcnt; 25 atomic_t refcnt;
56 int dead; 26 int dead;
57 struct in_ifaddr *ifa_list; /* IP ifaddr chain */ 27 struct in_ifaddr *ifa_list; /* IP ifaddr chain */
28
58 struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */ 29 struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */
30 struct ip_mc_list __rcu * __rcu *mc_hash;
31
59 int mc_count; /* Number of installed mcasts */ 32 int mc_count; /* Number of installed mcasts */
60 spinlock_t mc_tomb_lock; 33 spinlock_t mc_tomb_lock;
61 struct ip_mc_list *mc_tomb; 34 struct ip_mc_list *mc_tomb;
diff --git a/include/linux/init.h b/include/linux/init.h
index 861814710d52..f1c27a71d03c 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -93,13 +93,13 @@
93 93
94#define __exit __section(.exit.text) __exitused __cold notrace 94#define __exit __section(.exit.text) __exitused __cold notrace
95 95
96/* Used for HOTPLUG_CPU */ 96/* temporary, until all users are removed */
97#define __cpuinit __section(.cpuinit.text) __cold notrace 97#define __cpuinit
98#define __cpuinitdata __section(.cpuinit.data) 98#define __cpuinitdata
99#define __cpuinitconst __constsection(.cpuinit.rodata) 99#define __cpuinitconst
100#define __cpuexit __section(.cpuexit.text) __exitused __cold notrace 100#define __cpuexit
101#define __cpuexitdata __section(.cpuexit.data) 101#define __cpuexitdata
102#define __cpuexitconst __constsection(.cpuexit.rodata) 102#define __cpuexitconst
103 103
104/* Used for MEMORY_HOTPLUG */ 104/* Used for MEMORY_HOTPLUG */
105#define __meminit __section(.meminit.text) __cold notrace 105#define __meminit __section(.meminit.text) __cold notrace
@@ -118,9 +118,8 @@
118#define __INITRODATA .section ".init.rodata","a",%progbits 118#define __INITRODATA .section ".init.rodata","a",%progbits
119#define __FINITDATA .previous 119#define __FINITDATA .previous
120 120
121#define __CPUINIT .section ".cpuinit.text", "ax" 121/* temporary, until all users are removed */
122#define __CPUINITDATA .section ".cpuinit.data", "aw" 122#define __CPUINIT
123#define __CPUINITRODATA .section ".cpuinit.rodata", "a"
124 123
125#define __MEMINIT .section ".meminit.text", "ax" 124#define __MEMINIT .section ".meminit.text", "ax"
126#define __MEMINITDATA .section ".meminit.data", "aw" 125#define __MEMINITDATA .section ".meminit.data", "aw"
@@ -154,6 +153,7 @@ extern unsigned int reset_devices;
154void setup_arch(char **); 153void setup_arch(char **);
155void prepare_namespace(void); 154void prepare_namespace(void);
156void __init load_default_modules(void); 155void __init load_default_modules(void);
156int __init init_rootfs(void);
157 157
158extern void (*late_time_init)(void); 158extern void (*late_time_init)(void);
159 159
diff --git a/include/linux/input/ti_am335x_tsc.h b/include/linux/input/ti_am335x_tsc.h
deleted file mode 100644
index 49269a2aa329..000000000000
--- a/include/linux/input/ti_am335x_tsc.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef __LINUX_TI_AM335X_TSC_H
2#define __LINUX_TI_AM335X_TSC_H
3
4/**
5 * struct tsc_data Touchscreen wire configuration
6 * @wires: Wires refer to application modes
7 * i.e. 4/5/8 wire touchscreen support
8 * on the platform.
9 * @x_plate_resistance: X plate resistance.
10 * @steps_to_configure: The sequencer supports a total of
11 * 16 programmable steps.
12 * A step configured to read a single
13 * co-ordinate value, can be applied
14 * more number of times for better results.
15 */
16
17struct tsc_data {
18 int wires;
19 int x_plate_resistance;
20 int steps_to_configure;
21};
22
23#endif
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 78e2ada50cd5..d380c5e68008 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -55,7 +55,7 @@
55#define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */ 55#define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */
56#define DMAR_IQ_SHIFT 4 /* Invalidation queue head/tail shift */ 56#define DMAR_IQ_SHIFT 4 /* Invalidation queue head/tail shift */
57#define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */ 57#define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */
58#define DMAR_ICS_REG 0x98 /* Invalidation complete status register */ 58#define DMAR_ICS_REG 0x9c /* Invalidation complete status register */
59#define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */ 59#define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */
60 60
61#define OFFSET_STRIDE (9) 61#define OFFSET_STRIDE (9)
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 5fa5afeeb759..5e865b554940 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -120,7 +120,6 @@ struct irqaction {
120 120
121extern irqreturn_t no_action(int cpl, void *dev_id); 121extern irqreturn_t no_action(int cpl, void *dev_id);
122 122
123#ifdef CONFIG_GENERIC_HARDIRQS
124extern int __must_check 123extern int __must_check
125request_threaded_irq(unsigned int irq, irq_handler_t handler, 124request_threaded_irq(unsigned int irq, irq_handler_t handler,
126 irq_handler_t thread_fn, 125 irq_handler_t thread_fn,
@@ -140,40 +139,6 @@ request_any_context_irq(unsigned int irq, irq_handler_t handler,
140extern int __must_check 139extern int __must_check
141request_percpu_irq(unsigned int irq, irq_handler_t handler, 140request_percpu_irq(unsigned int irq, irq_handler_t handler,
142 const char *devname, void __percpu *percpu_dev_id); 141 const char *devname, void __percpu *percpu_dev_id);
143#else
144
145extern int __must_check
146request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
147 const char *name, void *dev);
148
149/*
150 * Special function to avoid ifdeffery in kernel/irq/devres.c which
151 * gets magically built by GENERIC_HARDIRQS=n architectures (sparc,
152 * m68k). I really love these $@%#!* obvious Makefile references:
153 * ../../../kernel/irq/devres.o
154 */
155static inline int __must_check
156request_threaded_irq(unsigned int irq, irq_handler_t handler,
157 irq_handler_t thread_fn,
158 unsigned long flags, const char *name, void *dev)
159{
160 return request_irq(irq, handler, flags, name, dev);
161}
162
163static inline int __must_check
164request_any_context_irq(unsigned int irq, irq_handler_t handler,
165 unsigned long flags, const char *name, void *dev_id)
166{
167 return request_irq(irq, handler, flags, name, dev_id);
168}
169
170static inline int __must_check
171request_percpu_irq(unsigned int irq, irq_handler_t handler,
172 const char *devname, void __percpu *percpu_dev_id)
173{
174 return request_irq(irq, handler, 0, devname, percpu_dev_id);
175}
176#endif
177 142
178extern void free_irq(unsigned int, void *); 143extern void free_irq(unsigned int, void *);
179extern void free_percpu_irq(unsigned int, void __percpu *); 144extern void free_percpu_irq(unsigned int, void __percpu *);
@@ -221,7 +186,6 @@ extern void enable_irq(unsigned int irq);
221extern void enable_percpu_irq(unsigned int irq, unsigned int type); 186extern void enable_percpu_irq(unsigned int irq, unsigned int type);
222 187
223/* The following three functions are for the core kernel use only. */ 188/* The following three functions are for the core kernel use only. */
224#ifdef CONFIG_GENERIC_HARDIRQS
225extern void suspend_device_irqs(void); 189extern void suspend_device_irqs(void);
226extern void resume_device_irqs(void); 190extern void resume_device_irqs(void);
227#ifdef CONFIG_PM_SLEEP 191#ifdef CONFIG_PM_SLEEP
@@ -229,13 +193,8 @@ extern int check_wakeup_irqs(void);
229#else 193#else
230static inline int check_wakeup_irqs(void) { return 0; } 194static inline int check_wakeup_irqs(void) { return 0; }
231#endif 195#endif
232#else
233static inline void suspend_device_irqs(void) { };
234static inline void resume_device_irqs(void) { };
235static inline int check_wakeup_irqs(void) { return 0; }
236#endif
237 196
238#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) 197#if defined(CONFIG_SMP)
239 198
240extern cpumask_var_t irq_default_affinity; 199extern cpumask_var_t irq_default_affinity;
241 200
@@ -287,9 +246,8 @@ static inline int irq_set_affinity_hint(unsigned int irq,
287{ 246{
288 return -EINVAL; 247 return -EINVAL;
289} 248}
290#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */ 249#endif /* CONFIG_SMP */
291 250
292#ifdef CONFIG_GENERIC_HARDIRQS
293/* 251/*
294 * Special lockdep variants of irq disabling/enabling. 252 * Special lockdep variants of irq disabling/enabling.
295 * These should be used for locking constructs that 253 * These should be used for locking constructs that
@@ -354,33 +312,6 @@ static inline int disable_irq_wake(unsigned int irq)
354 return irq_set_irq_wake(irq, 0); 312 return irq_set_irq_wake(irq, 0);
355} 313}
356 314
357#else /* !CONFIG_GENERIC_HARDIRQS */
358/*
359 * NOTE: non-genirq architectures, if they want to support the lock
360 * validator need to define the methods below in their asm/irq.h
361 * files, under an #ifdef CONFIG_LOCKDEP section.
362 */
363#ifndef CONFIG_LOCKDEP
364# define disable_irq_nosync_lockdep(irq) disable_irq_nosync(irq)
365# define disable_irq_nosync_lockdep_irqsave(irq, flags) \
366 disable_irq_nosync(irq)
367# define disable_irq_lockdep(irq) disable_irq(irq)
368# define enable_irq_lockdep(irq) enable_irq(irq)
369# define enable_irq_lockdep_irqrestore(irq, flags) \
370 enable_irq(irq)
371# endif
372
373static inline int enable_irq_wake(unsigned int irq)
374{
375 return 0;
376}
377
378static inline int disable_irq_wake(unsigned int irq)
379{
380 return 0;
381}
382#endif /* CONFIG_GENERIC_HARDIRQS */
383
384 315
385#ifdef CONFIG_IRQ_FORCED_THREADING 316#ifdef CONFIG_IRQ_FORCED_THREADING
386extern bool force_irqthreads; 317extern bool force_irqthreads;
@@ -655,7 +586,7 @@ void tasklet_hrtimer_cancel(struct tasklet_hrtimer *ttimer)
655 * if more than one irq occurred. 586 * if more than one irq occurred.
656 */ 587 */
657 588
658#if defined(CONFIG_GENERIC_HARDIRQS) && !defined(CONFIG_GENERIC_IRQ_PROBE) 589#if !defined(CONFIG_GENERIC_IRQ_PROBE)
659static inline unsigned long probe_irq_on(void) 590static inline unsigned long probe_irq_on(void)
660{ 591{
661 return 0; 592 return 0;
diff --git a/include/linux/io.h b/include/linux/io.h
index 069e4075f872..f4f42faec686 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -76,4 +76,29 @@ void devm_ioremap_release(struct device *dev, void *res);
76#define arch_has_dev_port() (1) 76#define arch_has_dev_port() (1)
77#endif 77#endif
78 78
79/*
80 * Some systems (x86 without PAT) have a somewhat reliable way to mark a
81 * physical address range such that uncached mappings will actually
82 * end up write-combining. This facility should be used in conjunction
83 * with pgprot_writecombine, ioremap-wc, or set_memory_wc, since it has
84 * no effect if the per-page mechanisms are functional.
85 * (On x86 without PAT, these functions manipulate MTRRs.)
86 *
87 * arch_phys_del_wc(0) or arch_phys_del_wc(any error code) is guaranteed
88 * to have no effect.
89 */
90#ifndef arch_phys_wc_add
91static inline int __must_check arch_phys_wc_add(unsigned long base,
92 unsigned long size)
93{
94 return 0; /* It worked (i.e. did nothing). */
95}
96
97static inline void arch_phys_wc_del(int handle)
98{
99}
100
101#define arch_phys_wc_add arch_phys_wc_add
102#endif
103
79#endif /* _LINUX_IO_H */ 104#endif /* _LINUX_IO_H */
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 3aeb7305e2f5..7ea319e95b47 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -58,10 +58,26 @@ struct iommu_domain {
58#define IOMMU_CAP_CACHE_COHERENCY 0x1 58#define IOMMU_CAP_CACHE_COHERENCY 0x1
59#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ 59#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */
60 60
61/*
62 * Following constraints are specifc to FSL_PAMUV1:
63 * -aperture must be power of 2, and naturally aligned
64 * -number of windows must be power of 2, and address space size
65 * of each window is determined by aperture size / # of windows
66 * -the actual size of the mapped region of a window must be power
67 * of 2 starting with 4KB and physical address must be naturally
68 * aligned.
69 * DOMAIN_ATTR_FSL_PAMUV1 corresponds to the above mentioned contraints.
70 * The caller can invoke iommu_domain_get_attr to check if the underlying
71 * iommu implementation supports these constraints.
72 */
73
61enum iommu_attr { 74enum iommu_attr {
62 DOMAIN_ATTR_GEOMETRY, 75 DOMAIN_ATTR_GEOMETRY,
63 DOMAIN_ATTR_PAGING, 76 DOMAIN_ATTR_PAGING,
64 DOMAIN_ATTR_WINDOWS, 77 DOMAIN_ATTR_WINDOWS,
78 DOMAIN_ATTR_FSL_PAMU_STASH,
79 DOMAIN_ATTR_FSL_PAMU_ENABLE,
80 DOMAIN_ATTR_FSL_PAMUV1,
65 DOMAIN_ATTR_MAX, 81 DOMAIN_ATTR_MAX,
66}; 82};
67 83
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index c4d870b0d5e6..19c19a5eee29 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -22,7 +22,7 @@ struct ipc_ids {
22 int in_use; 22 int in_use;
23 unsigned short seq; 23 unsigned short seq;
24 unsigned short seq_max; 24 unsigned short seq_max;
25 struct rw_semaphore rw_mutex; 25 struct rw_semaphore rwsem;
26 struct idr ipcs_idr; 26 struct idr ipcs_idr;
27 int next_id; 27 int next_id;
28}; 28};
diff --git a/include/linux/ipmi-fru.h b/include/linux/ipmi-fru.h
new file mode 100644
index 000000000000..4d3a76380e32
--- /dev/null
+++ b/include/linux/ipmi-fru.h
@@ -0,0 +1,135 @@
1/*
2 * Copyright (C) 2012 CERN (www.cern.ch)
3 * Author: Alessandro Rubini <rubini@gnudd.com>
4 *
5 * Released according to the GNU GPL, version 2 or any later version.
6 *
7 * This work is part of the White Rabbit project, a research effort led
8 * by CERN, the European Institute for Nuclear Research.
9 */
10#ifndef __LINUX_IPMI_FRU_H__
11#define __LINUX_IPMI_FRU_H__
12#ifdef __KERNEL__
13# include <linux/types.h>
14# include <linux/string.h>
15#else
16# include <stdint.h>
17# include <string.h>
18#endif
19
20/*
21 * These structures match the unaligned crap we have in FRU1011.pdf
22 * (http://download.intel.com/design/servers/ipmi/FRU1011.pdf)
23 */
24
25/* chapter 8, page 5 */
26struct fru_common_header {
27 uint8_t format; /* 0x01 */
28 uint8_t internal_use_off; /* multiple of 8 bytes */
29 uint8_t chassis_info_off; /* multiple of 8 bytes */
30 uint8_t board_area_off; /* multiple of 8 bytes */
31 uint8_t product_area_off; /* multiple of 8 bytes */
32 uint8_t multirecord_off; /* multiple of 8 bytes */
33 uint8_t pad; /* must be 0 */
34 uint8_t checksum; /* sum modulo 256 must be 0 */
35};
36
37/* chapter 9, page 5 -- internal_use: not used by us */
38
39/* chapter 10, page 6 -- chassis info: not used by us */
40
41/* chapter 13, page 9 -- used by board_info_area below */
42struct fru_type_length {
43 uint8_t type_length;
44 uint8_t data[0];
45};
46
47/* chapter 11, page 7 */
48struct fru_board_info_area {
49 uint8_t format; /* 0x01 */
50 uint8_t area_len; /* multiple of 8 bytes */
51 uint8_t language; /* I hope it's 0 */
52 uint8_t mfg_date[3]; /* LSB, minutes since 1996-01-01 */
53 struct fru_type_length tl[0]; /* type-length stuff follows */
54
55 /*
56 * the TL there are in order:
57 * Board Manufacturer
58 * Board Product Name
59 * Board Serial Number
60 * Board Part Number
61 * FRU File ID (may be null)
62 * more manufacturer-specific stuff
63 * 0xc1 as a terminator
64 * 0x00 pad to a multiple of 8 bytes - 1
65 * checksum (sum of all stuff module 256 must be zero)
66 */
67};
68
69enum fru_type {
70 FRU_TYPE_BINARY = 0x00,
71 FRU_TYPE_BCDPLUS = 0x40,
72 FRU_TYPE_ASCII6 = 0x80,
73 FRU_TYPE_ASCII = 0xc0, /* not ascii: depends on language */
74};
75
76/*
77 * some helpers
78 */
79static inline struct fru_board_info_area *fru_get_board_area(
80 const struct fru_common_header *header)
81{
82 /* we know for sure that the header is 8 bytes in size */
83 return (struct fru_board_info_area *)(header + header->board_area_off);
84}
85
86static inline int fru_type(struct fru_type_length *tl)
87{
88 return tl->type_length & 0xc0;
89}
90
91static inline int fru_length(struct fru_type_length *tl)
92{
93 return (tl->type_length & 0x3f) + 1; /* len of whole record */
94}
95
96/* assume ascii-latin1 encoding */
97static inline int fru_strlen(struct fru_type_length *tl)
98{
99 return fru_length(tl) - 1;
100}
101
102static inline char *fru_strcpy(char *dest, struct fru_type_length *tl)
103{
104 int len = fru_strlen(tl);
105 memcpy(dest, tl->data, len);
106 dest[len] = '\0';
107 return dest;
108}
109
110static inline struct fru_type_length *fru_next_tl(struct fru_type_length *tl)
111{
112 return tl + fru_length(tl);
113}
114
115static inline int fru_is_eof(struct fru_type_length *tl)
116{
117 return tl->type_length == 0xc1;
118}
119
120/*
121 * External functions defined in fru-parse.c.
122 */
123extern int fru_header_cksum_ok(struct fru_common_header *header);
124extern int fru_bia_cksum_ok(struct fru_board_info_area *bia);
125
126/* All these 4 return allocated strings by calling fru_alloc() */
127extern char *fru_get_board_manufacturer(struct fru_common_header *header);
128extern char *fru_get_product_name(struct fru_common_header *header);
129extern char *fru_get_serial_number(struct fru_common_header *header);
130extern char *fru_get_part_number(struct fru_common_header *header);
131
132/* This must be defined by the caller of the above functions */
133extern void *fru_alloc(size_t size);
134
135#endif /* __LINUX_IMPI_FRU_H__ */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 850e95bc766c..28ea38439313 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -19,6 +19,8 @@ struct ipv6_devconf {
19 __s32 rtr_solicit_interval; 19 __s32 rtr_solicit_interval;
20 __s32 rtr_solicit_delay; 20 __s32 rtr_solicit_delay;
21 __s32 force_mld_version; 21 __s32 force_mld_version;
22 __s32 mldv1_unsolicited_report_interval;
23 __s32 mldv2_unsolicited_report_interval;
22#ifdef CONFIG_IPV6_PRIVACY 24#ifdef CONFIG_IPV6_PRIVACY
23 __s32 use_tempaddr; 25 __s32 use_tempaddr;
24 __s32 temp_valid_lft; 26 __s32 temp_valid_lft;
@@ -48,6 +50,7 @@ struct ipv6_devconf {
48 __s32 accept_dad; 50 __s32 accept_dad;
49 __s32 force_tllao; 51 __s32 force_tllao;
50 __s32 ndisc_notify; 52 __s32 ndisc_notify;
53 __s32 suppress_frag_ndisc;
51 void *sysctl; 54 void *sysctl;
52}; 55};
53 56
@@ -101,6 +104,7 @@ struct inet6_skb_parm {
101#define IP6SKB_FORWARDED 2 104#define IP6SKB_FORWARDED 2
102#define IP6SKB_REROUTED 4 105#define IP6SKB_REROUTED 4
103#define IP6SKB_ROUTERALERT 8 106#define IP6SKB_ROUTERALERT 8
107#define IP6SKB_FRAGMENTED 16
104}; 108};
105 109
106#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 110#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
diff --git a/include/linux/irq.h b/include/linux/irq.h
index bc4e06611958..56bb0dc8b7d4 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -119,6 +119,7 @@ struct irq_domain;
119 119
120/** 120/**
121 * struct irq_data - per irq and irq chip data passed down to chip functions 121 * struct irq_data - per irq and irq chip data passed down to chip functions
122 * @mask: precomputed bitmask for accessing the chip registers
122 * @irq: interrupt number 123 * @irq: interrupt number
123 * @hwirq: hardware interrupt number, local to the interrupt domain 124 * @hwirq: hardware interrupt number, local to the interrupt domain
124 * @node: node index useful for balancing 125 * @node: node index useful for balancing
@@ -138,6 +139,7 @@ struct irq_domain;
138 * irq_data. 139 * irq_data.
139 */ 140 */
140struct irq_data { 141struct irq_data {
142 u32 mask;
141 unsigned int irq; 143 unsigned int irq;
142 unsigned long hwirq; 144 unsigned long hwirq;
143 unsigned int node; 145 unsigned int node;
@@ -294,6 +296,7 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
294 * @irq_suspend: function called from core code on suspend once per chip 296 * @irq_suspend: function called from core code on suspend once per chip
295 * @irq_resume: function called from core code on resume once per chip 297 * @irq_resume: function called from core code on resume once per chip
296 * @irq_pm_shutdown: function called from core code on shutdown once per chip 298 * @irq_pm_shutdown: function called from core code on shutdown once per chip
299 * @irq_calc_mask: Optional function to set irq_data.mask for special cases
297 * @irq_print_chip: optional to print special chip info in show_interrupts 300 * @irq_print_chip: optional to print special chip info in show_interrupts
298 * @flags: chip specific flags 301 * @flags: chip specific flags
299 */ 302 */
@@ -325,6 +328,8 @@ struct irq_chip {
325 void (*irq_resume)(struct irq_data *data); 328 void (*irq_resume)(struct irq_data *data);
326 void (*irq_pm_shutdown)(struct irq_data *data); 329 void (*irq_pm_shutdown)(struct irq_data *data);
327 330
331 void (*irq_calc_mask)(struct irq_data *data);
332
328 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p); 333 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p);
329 334
330 unsigned long flags; 335 unsigned long flags;
@@ -377,8 +382,6 @@ extern void irq_cpu_online(void);
377extern void irq_cpu_offline(void); 382extern void irq_cpu_offline(void);
378extern int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *cpumask); 383extern int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *cpumask);
379 384
380#ifdef CONFIG_GENERIC_HARDIRQS
381
382#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ) 385#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ)
383void irq_move_irq(struct irq_data *data); 386void irq_move_irq(struct irq_data *data);
384void irq_move_masked_irq(struct irq_data *data); 387void irq_move_masked_irq(struct irq_data *data);
@@ -579,6 +582,12 @@ static inline struct msi_desc *irq_data_get_msi(struct irq_data *d)
579 return d->msi_desc; 582 return d->msi_desc;
580} 583}
581 584
585static inline u32 irq_get_trigger_type(unsigned int irq)
586{
587 struct irq_data *d = irq_get_irq_data(irq);
588 return d ? irqd_get_trigger_type(d) : 0;
589}
590
582int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node, 591int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,
583 struct module *owner); 592 struct module *owner);
584 593
@@ -644,6 +653,8 @@ struct irq_chip_regs {
644 * @regs: Register offsets for this chip 653 * @regs: Register offsets for this chip
645 * @handler: Flow handler associated with this chip 654 * @handler: Flow handler associated with this chip
646 * @type: Chip can handle these flow types 655 * @type: Chip can handle these flow types
656 * @mask_cache_priv: Cached mask register private to the chip type
657 * @mask_cache: Pointer to cached mask register
647 * 658 *
648 * A irq_generic_chip can have several instances of irq_chip_type when 659 * A irq_generic_chip can have several instances of irq_chip_type when
649 * it requires different functions and register offsets for different 660 * it requires different functions and register offsets for different
@@ -654,6 +665,8 @@ struct irq_chip_type {
654 struct irq_chip_regs regs; 665 struct irq_chip_regs regs;
655 irq_flow_handler_t handler; 666 irq_flow_handler_t handler;
656 u32 type; 667 u32 type;
668 u32 mask_cache_priv;
669 u32 *mask_cache;
657}; 670};
658 671
659/** 672/**
@@ -662,13 +675,16 @@ struct irq_chip_type {
662 * @reg_base: Register base address (virtual) 675 * @reg_base: Register base address (virtual)
663 * @irq_base: Interrupt base nr for this chip 676 * @irq_base: Interrupt base nr for this chip
664 * @irq_cnt: Number of interrupts handled by this chip 677 * @irq_cnt: Number of interrupts handled by this chip
665 * @mask_cache: Cached mask register 678 * @mask_cache: Cached mask register shared between all chip types
666 * @type_cache: Cached type register 679 * @type_cache: Cached type register
667 * @polarity_cache: Cached polarity register 680 * @polarity_cache: Cached polarity register
668 * @wake_enabled: Interrupt can wakeup from suspend 681 * @wake_enabled: Interrupt can wakeup from suspend
669 * @wake_active: Interrupt is marked as an wakeup from suspend source 682 * @wake_active: Interrupt is marked as an wakeup from suspend source
670 * @num_ct: Number of available irq_chip_type instances (usually 1) 683 * @num_ct: Number of available irq_chip_type instances (usually 1)
671 * @private: Private data for non generic chip callbacks 684 * @private: Private data for non generic chip callbacks
685 * @installed: bitfield to denote installed interrupts
686 * @unused: bitfield to denote unused interrupts
687 * @domain: irq domain pointer
672 * @list: List head for keeping track of instances 688 * @list: List head for keeping track of instances
673 * @chip_types: Array of interrupt irq_chip_types 689 * @chip_types: Array of interrupt irq_chip_types
674 * 690 *
@@ -690,6 +706,9 @@ struct irq_chip_generic {
690 u32 wake_active; 706 u32 wake_active;
691 unsigned int num_ct; 707 unsigned int num_ct;
692 void *private; 708 void *private;
709 unsigned long installed;
710 unsigned long unused;
711 struct irq_domain *domain;
693 struct list_head list; 712 struct list_head list;
694 struct irq_chip_type chip_types[0]; 713 struct irq_chip_type chip_types[0];
695}; 714};
@@ -700,10 +719,32 @@ struct irq_chip_generic {
700 * @IRQ_GC_INIT_NESTED_LOCK: Set the lock class of the irqs to nested for 719 * @IRQ_GC_INIT_NESTED_LOCK: Set the lock class of the irqs to nested for
701 * irq chips which need to call irq_set_wake() on 720 * irq chips which need to call irq_set_wake() on
702 * the parent irq. Usually GPIO implementations 721 * the parent irq. Usually GPIO implementations
722 * @IRQ_GC_MASK_CACHE_PER_TYPE: Mask cache is chip type private
723 * @IRQ_GC_NO_MASK: Do not calculate irq_data->mask
703 */ 724 */
704enum irq_gc_flags { 725enum irq_gc_flags {
705 IRQ_GC_INIT_MASK_CACHE = 1 << 0, 726 IRQ_GC_INIT_MASK_CACHE = 1 << 0,
706 IRQ_GC_INIT_NESTED_LOCK = 1 << 1, 727 IRQ_GC_INIT_NESTED_LOCK = 1 << 1,
728 IRQ_GC_MASK_CACHE_PER_TYPE = 1 << 2,
729 IRQ_GC_NO_MASK = 1 << 3,
730};
731
732/*
733 * struct irq_domain_chip_generic - Generic irq chip data structure for irq domains
734 * @irqs_per_chip: Number of interrupts per chip
735 * @num_chips: Number of chips
736 * @irq_flags_to_set: IRQ* flags to set on irq setup
737 * @irq_flags_to_clear: IRQ* flags to clear on irq setup
738 * @gc_flags: Generic chip specific setup flags
739 * @gc: Array of pointers to generic interrupt chips
740 */
741struct irq_domain_chip_generic {
742 unsigned int irqs_per_chip;
743 unsigned int num_chips;
744 unsigned int irq_flags_to_clear;
745 unsigned int irq_flags_to_set;
746 enum irq_gc_flags gc_flags;
747 struct irq_chip_generic *gc[0];
707}; 748};
708 749
709/* Generic chip callback functions */ 750/* Generic chip callback functions */
@@ -729,6 +770,14 @@ int irq_setup_alt_chip(struct irq_data *d, unsigned int type);
729void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk, 770void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk,
730 unsigned int clr, unsigned int set); 771 unsigned int clr, unsigned int set);
731 772
773struct irq_chip_generic *irq_get_domain_generic_chip(struct irq_domain *d, unsigned int hw_irq);
774int irq_alloc_domain_generic_chips(struct irq_domain *d, int irqs_per_chip,
775 int num_ct, const char *name,
776 irq_flow_handler_t handler,
777 unsigned int clr, unsigned int set,
778 enum irq_gc_flags flags);
779
780
732static inline struct irq_chip_type *irq_data_get_chip_type(struct irq_data *d) 781static inline struct irq_chip_type *irq_data_get_chip_type(struct irq_data *d)
733{ 782{
734 return container_of(d->chip, struct irq_chip_type, chip); 783 return container_of(d->chip, struct irq_chip_type, chip);
@@ -751,11 +800,4 @@ static inline void irq_gc_lock(struct irq_chip_generic *gc) { }
751static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } 800static inline void irq_gc_unlock(struct irq_chip_generic *gc) { }
752#endif 801#endif
753 802
754#else /* !CONFIG_GENERIC_HARDIRQS */
755
756extern struct msi_desc *irq_get_msi_desc(unsigned int irq);
757extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry);
758
759#endif /* CONFIG_GENERIC_HARDIRQS */
760
761#endif /* _LINUX_IRQ_H */ 803#endif /* _LINUX_IRQ_H */
diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h
index e0006f1d35a0..14d79131f53d 100644
--- a/include/linux/irqchip.h
+++ b/include/linux/irqchip.h
@@ -11,6 +11,10 @@
11#ifndef _LINUX_IRQCHIP_H 11#ifndef _LINUX_IRQCHIP_H
12#define _LINUX_IRQCHIP_H 12#define _LINUX_IRQCHIP_H
13 13
14#ifdef CONFIG_IRQCHIP
14void irqchip_init(void); 15void irqchip_init(void);
16#else
17static inline void irqchip_init(void) {}
18#endif
15 19
16#endif 20#endif
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 3e203eb23cc7..0e5d9ecdb2b6 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -66,6 +66,7 @@ extern struct irq_chip gic_arch_extn;
66void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *, 66void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *,
67 u32 offset, struct device_node *); 67 u32 offset, struct device_node *);
68void gic_cascade_irq(unsigned int gic_nr, unsigned int irq); 68void gic_cascade_irq(unsigned int gic_nr, unsigned int irq);
69void gic_cpu_if_down(void);
69 70
70static inline void gic_init(unsigned int nr, int start, 71static inline void gic_init(unsigned int nr, int start,
71 void __iomem *dist , void __iomem *cpu) 72 void __iomem *dist , void __iomem *cpu)
diff --git a/include/linux/irqchip/mmp.h b/include/linux/irqchip/mmp.h
new file mode 100644
index 000000000000..c78a8921185d
--- /dev/null
+++ b/include/linux/irqchip/mmp.h
@@ -0,0 +1,6 @@
1#ifndef __IRQCHIP_MMP_H
2#define __IRQCHIP_MMP_H
3
4extern struct irq_chip icu_irq_chip;
5
6#endif /* __IRQCHIP_MMP_H */
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 623325e2ff97..56fb646909dc 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -76,8 +76,6 @@ struct irq_desc {
76extern struct irq_desc irq_desc[NR_IRQS]; 76extern struct irq_desc irq_desc[NR_IRQS];
77#endif 77#endif
78 78
79#ifdef CONFIG_GENERIC_HARDIRQS
80
81static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc) 79static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc)
82{ 80{
83 return &desc->irq_data; 81 return &desc->irq_data;
@@ -173,6 +171,5 @@ __irq_set_preflow_handler(unsigned int irq, irq_preflow_handler_t handler)
173 desc->preflow_handler = handler; 171 desc->preflow_handler = handler;
174} 172}
175#endif 173#endif
176#endif
177 174
178#endif 175#endif
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 0d5b17bf5e51..c983ed18c332 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -66,52 +66,55 @@ struct irq_domain_ops {
66 unsigned long *out_hwirq, unsigned int *out_type); 66 unsigned long *out_hwirq, unsigned int *out_type);
67}; 67};
68 68
69extern struct irq_domain_ops irq_generic_chip_ops;
70
71struct irq_domain_chip_generic;
72
69/** 73/**
70 * struct irq_domain - Hardware interrupt number translation object 74 * struct irq_domain - Hardware interrupt number translation object
71 * @link: Element in global irq_domain list. 75 * @link: Element in global irq_domain list.
72 * @revmap_type: Method used for reverse mapping hwirq numbers to linux irq. This 76 * @name: Name of interrupt domain
73 * will be one of the IRQ_DOMAIN_MAP_* values.
74 * @revmap_data: Revmap method specific data.
75 * @ops: pointer to irq_domain methods 77 * @ops: pointer to irq_domain methods
76 * @host_data: private data pointer for use by owner. Not touched by irq_domain 78 * @host_data: private data pointer for use by owner. Not touched by irq_domain
77 * core code. 79 * core code.
78 * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator 80 *
79 * of the irq_domain is responsible for allocating the array of 81 * Optional elements
80 * irq_desc structures. 82 * @of_node: Pointer to device tree nodes associated with the irq_domain. Used
81 * @nr_irq: Number of irqs managed by the irq domain 83 * when decoding device tree interrupt specifiers.
82 * @hwirq_base: Starting number for hwirqs managed by the irq domain 84 * @gc: Pointer to a list of generic chips. There is a helper function for
83 * @of_node: (optional) Pointer to device tree nodes associated with the 85 * setting up one or more generic chips for interrupt controllers
84 * irq_domain. Used when decoding device tree interrupt specifiers. 86 * drivers using the generic chip library which uses this pointer.
87 *
88 * Revmap data, used internally by irq_domain
89 * @revmap_direct_max_irq: The largest hwirq that can be set for controllers that
90 * support direct mapping
91 * @revmap_size: Size of the linear map table @linear_revmap[]
92 * @revmap_tree: Radix map tree for hwirqs that don't fit in the linear map
93 * @linear_revmap: Linear table of hwirq->virq reverse mappings
85 */ 94 */
86struct irq_domain { 95struct irq_domain {
87 struct list_head link; 96 struct list_head link;
88 97 const char *name;
89 /* type of reverse mapping_technique */
90 unsigned int revmap_type;
91 union {
92 struct {
93 unsigned int size;
94 unsigned int first_irq;
95 irq_hw_number_t first_hwirq;
96 } legacy;
97 struct {
98 unsigned int size;
99 unsigned int *revmap;
100 } linear;
101 struct {
102 unsigned int max_irq;
103 } nomap;
104 struct radix_tree_root tree;
105 } revmap_data;
106 const struct irq_domain_ops *ops; 98 const struct irq_domain_ops *ops;
107 void *host_data; 99 void *host_data;
108 irq_hw_number_t inval_irq;
109 100
110 /* Optional device node pointer */ 101 /* Optional data */
111 struct device_node *of_node; 102 struct device_node *of_node;
103 struct irq_domain_chip_generic *gc;
104
105 /* reverse map data. The linear map gets appended to the irq_domain */
106 irq_hw_number_t hwirq_max;
107 unsigned int revmap_direct_max_irq;
108 unsigned int revmap_size;
109 struct radix_tree_root revmap_tree;
110 unsigned int linear_revmap[];
112}; 111};
113 112
114#ifdef CONFIG_IRQ_DOMAIN 113#ifdef CONFIG_IRQ_DOMAIN
114struct irq_domain *__irq_domain_add(struct device_node *of_node, int size,
115 irq_hw_number_t hwirq_max, int direct_max,
116 const struct irq_domain_ops *ops,
117 void *host_data);
115struct irq_domain *irq_domain_add_simple(struct device_node *of_node, 118struct irq_domain *irq_domain_add_simple(struct device_node *of_node,
116 unsigned int size, 119 unsigned int size,
117 unsigned int first_irq, 120 unsigned int first_irq,
@@ -123,21 +126,30 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
123 irq_hw_number_t first_hwirq, 126 irq_hw_number_t first_hwirq,
124 const struct irq_domain_ops *ops, 127 const struct irq_domain_ops *ops,
125 void *host_data); 128 void *host_data);
126struct irq_domain *irq_domain_add_linear(struct device_node *of_node, 129extern struct irq_domain *irq_find_host(struct device_node *node);
130extern void irq_set_default_host(struct irq_domain *host);
131
132/**
133 * irq_domain_add_linear() - Allocate and register a linear revmap irq_domain.
134 * @of_node: pointer to interrupt controller's device tree node.
135 * @size: Number of interrupts in the domain.
136 * @ops: map/unmap domain callbacks
137 * @host_data: Controller private data pointer
138 */
139static inline struct irq_domain *irq_domain_add_linear(struct device_node *of_node,
127 unsigned int size, 140 unsigned int size,
128 const struct irq_domain_ops *ops, 141 const struct irq_domain_ops *ops,
129 void *host_data); 142 void *host_data)
130struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, 143{
144 return __irq_domain_add(of_node, size, size, 0, ops, host_data);
145}
146static inline struct irq_domain *irq_domain_add_nomap(struct device_node *of_node,
131 unsigned int max_irq, 147 unsigned int max_irq,
132 const struct irq_domain_ops *ops, 148 const struct irq_domain_ops *ops,
133 void *host_data); 149 void *host_data)
134struct irq_domain *irq_domain_add_tree(struct device_node *of_node, 150{
135 const struct irq_domain_ops *ops, 151 return __irq_domain_add(of_node, 0, max_irq, max_irq, ops, host_data);
136 void *host_data); 152}
137
138extern struct irq_domain *irq_find_host(struct device_node *node);
139extern void irq_set_default_host(struct irq_domain *host);
140
141static inline struct irq_domain *irq_domain_add_legacy_isa( 153static inline struct irq_domain *irq_domain_add_legacy_isa(
142 struct device_node *of_node, 154 struct device_node *of_node,
143 const struct irq_domain_ops *ops, 155 const struct irq_domain_ops *ops,
@@ -146,21 +158,40 @@ static inline struct irq_domain *irq_domain_add_legacy_isa(
146 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops, 158 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops,
147 host_data); 159 host_data);
148} 160}
161static inline struct irq_domain *irq_domain_add_tree(struct device_node *of_node,
162 const struct irq_domain_ops *ops,
163 void *host_data)
164{
165 return __irq_domain_add(of_node, 0, ~0, 0, ops, host_data);
166}
149 167
150extern void irq_domain_remove(struct irq_domain *host); 168extern void irq_domain_remove(struct irq_domain *host);
151 169
152extern int irq_domain_associate_many(struct irq_domain *domain, 170extern int irq_domain_associate(struct irq_domain *domain, unsigned int irq,
153 unsigned int irq_base, 171 irq_hw_number_t hwirq);
154 irq_hw_number_t hwirq_base, int count); 172extern void irq_domain_associate_many(struct irq_domain *domain,
155static inline int irq_domain_associate(struct irq_domain *domain, unsigned int irq, 173 unsigned int irq_base,
156 irq_hw_number_t hwirq) 174 irq_hw_number_t hwirq_base, int count);
157{
158 return irq_domain_associate_many(domain, irq, hwirq, 1);
159}
160 175
161extern unsigned int irq_create_mapping(struct irq_domain *host, 176extern unsigned int irq_create_mapping(struct irq_domain *host,
162 irq_hw_number_t hwirq); 177 irq_hw_number_t hwirq);
163extern void irq_dispose_mapping(unsigned int virq); 178extern void irq_dispose_mapping(unsigned int virq);
179
180/**
181 * irq_linear_revmap() - Find a linux irq from a hw irq number.
182 * @domain: domain owning this hardware interrupt
183 * @hwirq: hardware irq number in that domain space
184 *
185 * This is a fast path alternative to irq_find_mapping() that can be
186 * called directly by irq controller code to save a handful of
187 * instructions. It is always safe to call, but won't find irqs mapped
188 * using the radix tree.
189 */
190static inline unsigned int irq_linear_revmap(struct irq_domain *domain,
191 irq_hw_number_t hwirq)
192{
193 return hwirq < domain->revmap_size ? domain->linear_revmap[hwirq] : 0;
194}
164extern unsigned int irq_find_mapping(struct irq_domain *host, 195extern unsigned int irq_find_mapping(struct irq_domain *host,
165 irq_hw_number_t hwirq); 196 irq_hw_number_t hwirq);
166extern unsigned int irq_create_direct_mapping(struct irq_domain *host); 197extern unsigned int irq_create_direct_mapping(struct irq_domain *host);
@@ -174,9 +205,6 @@ static inline int irq_create_identity_mapping(struct irq_domain *host,
174 return irq_create_strict_mappings(host, hwirq, hwirq, 1); 205 return irq_create_strict_mappings(host, hwirq, hwirq, 1);
175} 206}
176 207
177extern unsigned int irq_linear_revmap(struct irq_domain *host,
178 irq_hw_number_t hwirq);
179
180extern const struct irq_domain_ops irq_domain_simple_ops; 208extern const struct irq_domain_ops irq_domain_simple_ops;
181 209
182/* stock xlate functions */ 210/* stock xlate functions */
@@ -190,14 +218,6 @@ int irq_domain_xlate_onetwocell(struct irq_domain *d, struct device_node *ctrlr,
190 const u32 *intspec, unsigned int intsize, 218 const u32 *intspec, unsigned int intsize,
191 irq_hw_number_t *out_hwirq, unsigned int *out_type); 219 irq_hw_number_t *out_hwirq, unsigned int *out_type);
192 220
193#if defined(CONFIG_OF_IRQ)
194extern void irq_domain_generate_simple(const struct of_device_id *match,
195 u64 phys_base, unsigned int irq_start);
196#else /* CONFIG_OF_IRQ */
197static inline void irq_domain_generate_simple(const struct of_device_id *match,
198 u64 phys_base, unsigned int irq_start) { }
199#endif /* !CONFIG_OF_IRQ */
200
201#else /* CONFIG_IRQ_DOMAIN */ 221#else /* CONFIG_IRQ_DOMAIN */
202static inline void irq_dispose_mapping(unsigned int virq) { } 222static inline void irq_dispose_mapping(unsigned int virq) { }
203#endif /* !CONFIG_IRQ_DOMAIN */ 223#endif /* !CONFIG_IRQ_DOMAIN */
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
index 0a2dc46cdaf6..fdd5cc16c9c4 100644
--- a/include/linux/irqnr.h
+++ b/include/linux/irqnr.h
@@ -4,23 +4,6 @@
4#include <uapi/linux/irqnr.h> 4#include <uapi/linux/irqnr.h>
5 5
6 6
7#ifndef CONFIG_GENERIC_HARDIRQS
8#include <asm/irq.h>
9
10/*
11 * Wrappers for non-genirq architectures:
12 */
13#define nr_irqs NR_IRQS
14#define irq_to_desc(irq) (&irq_desc[irq])
15
16# define for_each_irq_desc(irq, desc) \
17 for (irq = 0; irq < nr_irqs; irq++)
18
19# define for_each_irq_desc_reverse(irq, desc) \
20 for (irq = nr_irqs - 1; irq >= 0; irq--)
21
22#else /* CONFIG_GENERIC_HARDIRQS */
23
24extern int nr_irqs; 7extern int nr_irqs;
25extern struct irq_desc *irq_to_desc(unsigned int irq); 8extern struct irq_desc *irq_to_desc(unsigned int irq);
26unsigned int irq_get_next_irq(unsigned int offset); 9unsigned int irq_get_next_irq(unsigned int offset);
@@ -50,8 +33,6 @@ unsigned int irq_get_next_irq(unsigned int offset);
50 for (irq = irq_get_next_irq(0); irq < nr_irqs; \ 33 for (irq = irq_get_next_irq(0); irq < nr_irqs; \
51 irq = irq_get_next_irq(irq + 1)) 34 irq = irq_get_next_irq(irq + 1))
52 35
53#endif /* CONFIG_GENERIC_HARDIRQS */
54
55#define for_each_irq_nr(irq) \ 36#define for_each_irq_nr(irq) \
56 for (irq = 0; irq < nr_irqs; irq++) 37 for (irq = 0; irq < nr_irqs; irq++)
57 38
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 7e0b622503c4..31229e0be90b 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -27,7 +27,6 @@
27#include <linux/buffer_head.h> 27#include <linux/buffer_head.h>
28#include <linux/journal-head.h> 28#include <linux/journal-head.h>
29#include <linux/stddef.h> 29#include <linux/stddef.h>
30#include <linux/bit_spinlock.h>
31#include <linux/mutex.h> 30#include <linux/mutex.h>
32#include <linux/timer.h> 31#include <linux/timer.h>
33#include <linux/lockdep.h> 32#include <linux/lockdep.h>
@@ -58,16 +57,13 @@
58#define JBD_EXPENSIVE_CHECKING 57#define JBD_EXPENSIVE_CHECKING
59extern u8 journal_enable_debug; 58extern u8 journal_enable_debug;
60 59
61#define jbd_debug(n, f, a...) \ 60void __jbd_debug(int level, const char *file, const char *func,
62 do { \ 61 unsigned int line, const char *fmt, ...);
63 if ((n) <= journal_enable_debug) { \ 62
64 printk (KERN_DEBUG "(%s, %d): %s: ", \ 63#define jbd_debug(n, fmt, a...) \
65 __FILE__, __LINE__, __func__); \ 64 __jbd_debug((n), __FILE__, __func__, __LINE__, (fmt), ##a)
66 printk (f, ## a); \
67 } \
68 } while (0)
69#else 65#else
70#define jbd_debug(f, a...) /**/ 66#define jbd_debug(n, fmt, a...) /**/
71#endif 67#endif
72 68
73static inline void *jbd_alloc(size_t size, gfp_t flags) 69static inline void *jbd_alloc(size_t size, gfp_t flags)
@@ -78,7 +74,7 @@ static inline void *jbd_alloc(size_t size, gfp_t flags)
78static inline void jbd_free(void *ptr, size_t size) 74static inline void jbd_free(void *ptr, size_t size)
79{ 75{
80 free_pages((unsigned long)ptr, get_order(size)); 76 free_pages((unsigned long)ptr, get_order(size));
81}; 77}
82 78
83#define JFS_MIN_JOURNAL_BLOCKS 1024 79#define JFS_MIN_JOURNAL_BLOCKS 1024
84 80
@@ -244,6 +240,31 @@ typedef struct journal_superblock_s
244 240
245#include <linux/fs.h> 241#include <linux/fs.h>
246#include <linux/sched.h> 242#include <linux/sched.h>
243
244enum jbd_state_bits {
245 BH_JBD /* Has an attached ext3 journal_head */
246 = BH_PrivateStart,
247 BH_JWrite, /* Being written to log (@@@ DEBUGGING) */
248 BH_Freed, /* Has been freed (truncated) */
249 BH_Revoked, /* Has been revoked from the log */
250 BH_RevokeValid, /* Revoked flag is valid */
251 BH_JBDDirty, /* Is dirty but journaled */
252 BH_State, /* Pins most journal_head state */
253 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
254 BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */
255 BH_JBDPrivateStart, /* First bit available for private use by FS */
256};
257
258BUFFER_FNS(JBD, jbd)
259BUFFER_FNS(JWrite, jwrite)
260BUFFER_FNS(JBDDirty, jbddirty)
261TAS_BUFFER_FNS(JBDDirty, jbddirty)
262BUFFER_FNS(Revoked, revoked)
263TAS_BUFFER_FNS(Revoked, revoked)
264BUFFER_FNS(RevokeValid, revokevalid)
265TAS_BUFFER_FNS(RevokeValid, revokevalid)
266BUFFER_FNS(Freed, freed)
267
247#include <linux/jbd_common.h> 268#include <linux/jbd_common.h>
248 269
249#define J_ASSERT(assert) BUG_ON(!(assert)) 270#define J_ASSERT(assert) BUG_ON(!(assert))
@@ -840,7 +861,7 @@ extern void journal_release_buffer (handle_t *, struct buffer_head *);
840extern int journal_forget (handle_t *, struct buffer_head *); 861extern int journal_forget (handle_t *, struct buffer_head *);
841extern void journal_sync_buffer (struct buffer_head *); 862extern void journal_sync_buffer (struct buffer_head *);
842extern void journal_invalidatepage(journal_t *, 863extern void journal_invalidatepage(journal_t *,
843 struct page *, unsigned long); 864 struct page *, unsigned int, unsigned int);
844extern int journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); 865extern int journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
845extern int journal_stop(handle_t *); 866extern int journal_stop(handle_t *);
846extern int journal_flush (journal_t *); 867extern int journal_flush (journal_t *);
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 6e051f472edb..d5b50a19463c 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -26,7 +26,6 @@
26#include <linux/buffer_head.h> 26#include <linux/buffer_head.h>
27#include <linux/journal-head.h> 27#include <linux/journal-head.h>
28#include <linux/stddef.h> 28#include <linux/stddef.h>
29#include <linux/bit_spinlock.h>
30#include <linux/mutex.h> 29#include <linux/mutex.h>
31#include <linux/timer.h> 30#include <linux/timer.h>
32#include <linux/slab.h> 31#include <linux/slab.h>
@@ -57,17 +56,13 @@
57 */ 56 */
58#define JBD2_EXPENSIVE_CHECKING 57#define JBD2_EXPENSIVE_CHECKING
59extern ushort jbd2_journal_enable_debug; 58extern ushort jbd2_journal_enable_debug;
59void __jbd2_debug(int level, const char *file, const char *func,
60 unsigned int line, const char *fmt, ...);
60 61
61#define jbd_debug(n, f, a...) \ 62#define jbd_debug(n, fmt, a...) \
62 do { \ 63 __jbd2_debug((n), __FILE__, __func__, __LINE__, (fmt), ##a)
63 if ((n) <= jbd2_journal_enable_debug) { \
64 printk (KERN_DEBUG "(%s, %d): %s: ", \
65 __FILE__, __LINE__, __func__); \
66 printk (f, ## a); \
67 } \
68 } while (0)
69#else 64#else
70#define jbd_debug(f, a...) /**/ 65#define jbd_debug(n, fmt, a...) /**/
71#endif 66#endif
72 67
73extern void *jbd2_alloc(size_t size, gfp_t flags); 68extern void *jbd2_alloc(size_t size, gfp_t flags);
@@ -302,6 +297,34 @@ typedef struct journal_superblock_s
302 297
303#include <linux/fs.h> 298#include <linux/fs.h>
304#include <linux/sched.h> 299#include <linux/sched.h>
300
301enum jbd_state_bits {
302 BH_JBD /* Has an attached ext3 journal_head */
303 = BH_PrivateStart,
304 BH_JWrite, /* Being written to log (@@@ DEBUGGING) */
305 BH_Freed, /* Has been freed (truncated) */
306 BH_Revoked, /* Has been revoked from the log */
307 BH_RevokeValid, /* Revoked flag is valid */
308 BH_JBDDirty, /* Is dirty but journaled */
309 BH_State, /* Pins most journal_head state */
310 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
311 BH_Shadow, /* IO on shadow buffer is running */
312 BH_Verified, /* Metadata block has been verified ok */
313 BH_JBDPrivateStart, /* First bit available for private use by FS */
314};
315
316BUFFER_FNS(JBD, jbd)
317BUFFER_FNS(JWrite, jwrite)
318BUFFER_FNS(JBDDirty, jbddirty)
319TAS_BUFFER_FNS(JBDDirty, jbddirty)
320BUFFER_FNS(Revoked, revoked)
321TAS_BUFFER_FNS(Revoked, revoked)
322BUFFER_FNS(RevokeValid, revokevalid)
323TAS_BUFFER_FNS(RevokeValid, revokevalid)
324BUFFER_FNS(Freed, freed)
325BUFFER_FNS(Shadow, shadow)
326BUFFER_FNS(Verified, verified)
327
305#include <linux/jbd_common.h> 328#include <linux/jbd_common.h>
306 329
307#define J_ASSERT(assert) BUG_ON(!(assert)) 330#define J_ASSERT(assert) BUG_ON(!(assert))
@@ -382,8 +405,15 @@ struct jbd2_revoke_table_s;
382 405
383struct jbd2_journal_handle 406struct jbd2_journal_handle
384{ 407{
385 /* Which compound transaction is this update a part of? */ 408 union {
386 transaction_t *h_transaction; 409 /* Which compound transaction is this update a part of? */
410 transaction_t *h_transaction;
411 /* Which journal handle belongs to - used iff h_reserved set */
412 journal_t *h_journal;
413 };
414
415 /* Handle reserved for finishing the logical operation */
416 handle_t *h_rsv_handle;
387 417
388 /* Number of remaining buffers we are allowed to dirty: */ 418 /* Number of remaining buffers we are allowed to dirty: */
389 int h_buffer_credits; 419 int h_buffer_credits;
@@ -398,6 +428,7 @@ struct jbd2_journal_handle
398 /* Flags [no locking] */ 428 /* Flags [no locking] */
399 unsigned int h_sync: 1; /* sync-on-close */ 429 unsigned int h_sync: 1; /* sync-on-close */
400 unsigned int h_jdata: 1; /* force data journaling */ 430 unsigned int h_jdata: 1; /* force data journaling */
431 unsigned int h_reserved: 1; /* handle with reserved credits */
401 unsigned int h_aborted: 1; /* fatal error on handle */ 432 unsigned int h_aborted: 1; /* fatal error on handle */
402 unsigned int h_type: 8; /* for handle statistics */ 433 unsigned int h_type: 8; /* for handle statistics */
403 unsigned int h_line_no: 16; /* for handle statistics */ 434 unsigned int h_line_no: 16; /* for handle statistics */
@@ -524,12 +555,6 @@ struct transaction_s
524 struct journal_head *t_checkpoint_io_list; 555 struct journal_head *t_checkpoint_io_list;
525 556
526 /* 557 /*
527 * Doubly-linked circular list of temporary buffers currently undergoing
528 * IO in the log [j_list_lock]
529 */
530 struct journal_head *t_iobuf_list;
531
532 /*
533 * Doubly-linked circular list of metadata buffers being shadowed by log 558 * Doubly-linked circular list of metadata buffers being shadowed by log
534 * IO. The IO buffers on the iobuf list and the shadow buffers on this 559 * IO. The IO buffers on the iobuf list and the shadow buffers on this
535 * list match each other one for one at all times. [j_list_lock] 560 * list match each other one for one at all times. [j_list_lock]
@@ -537,12 +562,6 @@ struct transaction_s
537 struct journal_head *t_shadow_list; 562 struct journal_head *t_shadow_list;
538 563
539 /* 564 /*
540 * Doubly-linked circular list of control buffers being written to the
541 * log. [j_list_lock]
542 */
543 struct journal_head *t_log_list;
544
545 /*
546 * List of inodes whose data we've modified in data=ordered mode. 565 * List of inodes whose data we've modified in data=ordered mode.
547 * [j_list_lock] 566 * [j_list_lock]
548 */ 567 */
@@ -671,11 +690,10 @@ jbd2_time_diff(unsigned long start, unsigned long end)
671 * waiting for checkpointing 690 * waiting for checkpointing
672 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction 691 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction
673 * to start committing, or for a barrier lock to be released 692 * to start committing, or for a barrier lock to be released
674 * @j_wait_logspace: Wait queue for waiting for checkpointing to complete
675 * @j_wait_done_commit: Wait queue for waiting for commit to complete 693 * @j_wait_done_commit: Wait queue for waiting for commit to complete
676 * @j_wait_checkpoint: Wait queue to trigger checkpointing
677 * @j_wait_commit: Wait queue to trigger commit 694 * @j_wait_commit: Wait queue to trigger commit
678 * @j_wait_updates: Wait queue to wait for updates to complete 695 * @j_wait_updates: Wait queue to wait for updates to complete
696 * @j_wait_reserved: Wait queue to wait for reserved buffer credits to drop
679 * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints 697 * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints
680 * @j_head: Journal head - identifies the first unused block in the journal 698 * @j_head: Journal head - identifies the first unused block in the journal
681 * @j_tail: Journal tail - identifies the oldest still-used block in the 699 * @j_tail: Journal tail - identifies the oldest still-used block in the
@@ -689,6 +707,7 @@ jbd2_time_diff(unsigned long start, unsigned long end)
689 * journal 707 * journal
690 * @j_fs_dev: Device which holds the client fs. For internal journal this will 708 * @j_fs_dev: Device which holds the client fs. For internal journal this will
691 * be equal to j_dev 709 * be equal to j_dev
710 * @j_reserved_credits: Number of buffers reserved from the running transaction
692 * @j_maxlen: Total maximum capacity of the journal region on disk. 711 * @j_maxlen: Total maximum capacity of the journal region on disk.
693 * @j_list_lock: Protects the buffer lists and internal buffer state. 712 * @j_list_lock: Protects the buffer lists and internal buffer state.
694 * @j_inode: Optional inode where we store the journal. If present, all journal 713 * @j_inode: Optional inode where we store the journal. If present, all journal
@@ -778,21 +797,18 @@ struct journal_s
778 */ 797 */
779 wait_queue_head_t j_wait_transaction_locked; 798 wait_queue_head_t j_wait_transaction_locked;
780 799
781 /* Wait queue for waiting for checkpointing to complete */
782 wait_queue_head_t j_wait_logspace;
783
784 /* Wait queue for waiting for commit to complete */ 800 /* Wait queue for waiting for commit to complete */
785 wait_queue_head_t j_wait_done_commit; 801 wait_queue_head_t j_wait_done_commit;
786 802
787 /* Wait queue to trigger checkpointing */
788 wait_queue_head_t j_wait_checkpoint;
789
790 /* Wait queue to trigger commit */ 803 /* Wait queue to trigger commit */
791 wait_queue_head_t j_wait_commit; 804 wait_queue_head_t j_wait_commit;
792 805
793 /* Wait queue to wait for updates to complete */ 806 /* Wait queue to wait for updates to complete */
794 wait_queue_head_t j_wait_updates; 807 wait_queue_head_t j_wait_updates;
795 808
809 /* Wait queue to wait for reserved buffer credits to drop */
810 wait_queue_head_t j_wait_reserved;
811
796 /* Semaphore for locking against concurrent checkpoints */ 812 /* Semaphore for locking against concurrent checkpoints */
797 struct mutex j_checkpoint_mutex; 813 struct mutex j_checkpoint_mutex;
798 814
@@ -847,6 +863,9 @@ struct journal_s
847 /* Total maximum capacity of the journal region on disk. */ 863 /* Total maximum capacity of the journal region on disk. */
848 unsigned int j_maxlen; 864 unsigned int j_maxlen;
849 865
866 /* Number of buffers reserved from the running transaction */
867 atomic_t j_reserved_credits;
868
850 /* 869 /*
851 * Protects the buffer lists and internal buffer state. 870 * Protects the buffer lists and internal buffer state.
852 */ 871 */
@@ -991,9 +1010,17 @@ extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, i
991extern void __journal_free_buffer(struct journal_head *bh); 1010extern void __journal_free_buffer(struct journal_head *bh);
992extern void jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int); 1011extern void jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int);
993extern void __journal_clean_data_list(transaction_t *transaction); 1012extern void __journal_clean_data_list(transaction_t *transaction);
1013static inline void jbd2_file_log_bh(struct list_head *head, struct buffer_head *bh)
1014{
1015 list_add_tail(&bh->b_assoc_buffers, head);
1016}
1017static inline void jbd2_unfile_log_bh(struct buffer_head *bh)
1018{
1019 list_del_init(&bh->b_assoc_buffers);
1020}
994 1021
995/* Log buffer allocation */ 1022/* Log buffer allocation */
996extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *); 1023struct buffer_head *jbd2_journal_get_descriptor_buffer(journal_t *journal);
997int jbd2_journal_next_log_block(journal_t *, unsigned long long *); 1024int jbd2_journal_next_log_block(journal_t *, unsigned long long *);
998int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid, 1025int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid,
999 unsigned long *block); 1026 unsigned long *block);
@@ -1039,11 +1066,10 @@ extern void jbd2_buffer_abort_trigger(struct journal_head *jh,
1039 struct jbd2_buffer_trigger_type *triggers); 1066 struct jbd2_buffer_trigger_type *triggers);
1040 1067
1041/* Buffer IO */ 1068/* Buffer IO */
1042extern int 1069extern int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
1043jbd2_journal_write_metadata_buffer(transaction_t *transaction, 1070 struct journal_head *jh_in,
1044 struct journal_head *jh_in, 1071 struct buffer_head **bh_out,
1045 struct journal_head **jh_out, 1072 sector_t blocknr);
1046 unsigned long long blocknr);
1047 1073
1048/* Transaction locking */ 1074/* Transaction locking */
1049extern void __wait_on_journal (journal_t *); 1075extern void __wait_on_journal (journal_t *);
@@ -1076,10 +1102,14 @@ static inline handle_t *journal_current_handle(void)
1076 */ 1102 */
1077 1103
1078extern handle_t *jbd2_journal_start(journal_t *, int nblocks); 1104extern handle_t *jbd2_journal_start(journal_t *, int nblocks);
1079extern handle_t *jbd2__journal_start(journal_t *, int nblocks, gfp_t gfp_mask, 1105extern handle_t *jbd2__journal_start(journal_t *, int blocks, int rsv_blocks,
1080 unsigned int type, unsigned int line_no); 1106 gfp_t gfp_mask, unsigned int type,
1107 unsigned int line_no);
1081extern int jbd2_journal_restart(handle_t *, int nblocks); 1108extern int jbd2_journal_restart(handle_t *, int nblocks);
1082extern int jbd2__journal_restart(handle_t *, int nblocks, gfp_t gfp_mask); 1109extern int jbd2__journal_restart(handle_t *, int nblocks, gfp_t gfp_mask);
1110extern int jbd2_journal_start_reserved(handle_t *handle,
1111 unsigned int type, unsigned int line_no);
1112extern void jbd2_journal_free_reserved(handle_t *handle);
1083extern int jbd2_journal_extend (handle_t *, int nblocks); 1113extern int jbd2_journal_extend (handle_t *, int nblocks);
1084extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); 1114extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
1085extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); 1115extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
@@ -1090,7 +1120,7 @@ extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
1090extern int jbd2_journal_forget (handle_t *, struct buffer_head *); 1120extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
1091extern void journal_sync_buffer (struct buffer_head *); 1121extern void journal_sync_buffer (struct buffer_head *);
1092extern int jbd2_journal_invalidatepage(journal_t *, 1122extern int jbd2_journal_invalidatepage(journal_t *,
1093 struct page *, unsigned long); 1123 struct page *, unsigned int, unsigned int);
1094extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); 1124extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
1095extern int jbd2_journal_stop(handle_t *); 1125extern int jbd2_journal_stop(handle_t *);
1096extern int jbd2_journal_flush (journal_t *); 1126extern int jbd2_journal_flush (journal_t *);
@@ -1125,6 +1155,7 @@ extern void jbd2_journal_ack_err (journal_t *);
1125extern int jbd2_journal_clear_err (journal_t *); 1155extern int jbd2_journal_clear_err (journal_t *);
1126extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); 1156extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
1127extern int jbd2_journal_force_commit(journal_t *); 1157extern int jbd2_journal_force_commit(journal_t *);
1158extern int jbd2_journal_force_commit_nested(journal_t *);
1128extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode); 1159extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);
1129extern int jbd2_journal_begin_ordered_truncate(journal_t *journal, 1160extern int jbd2_journal_begin_ordered_truncate(journal_t *journal,
1130 struct jbd2_inode *inode, loff_t new_size); 1161 struct jbd2_inode *inode, loff_t new_size);
@@ -1178,8 +1209,10 @@ extern int jbd2_journal_init_revoke_caches(void);
1178extern void jbd2_journal_destroy_revoke(journal_t *); 1209extern void jbd2_journal_destroy_revoke(journal_t *);
1179extern int jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *); 1210extern int jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *);
1180extern int jbd2_journal_cancel_revoke(handle_t *, struct journal_head *); 1211extern int jbd2_journal_cancel_revoke(handle_t *, struct journal_head *);
1181extern void jbd2_journal_write_revoke_records(journal_t *, 1212extern void jbd2_journal_write_revoke_records(journal_t *journal,
1182 transaction_t *, int); 1213 transaction_t *transaction,
1214 struct list_head *log_bufs,
1215 int write_op);
1183 1216
1184/* Recovery revoke support */ 1217/* Recovery revoke support */
1185extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t); 1218extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t);
@@ -1195,11 +1228,9 @@ extern void jbd2_clear_buffer_revoked_flags(journal_t *journal);
1195 * transitions on demand. 1228 * transitions on demand.
1196 */ 1229 */
1197 1230
1198int __jbd2_log_space_left(journal_t *); /* Called with journal locked */
1199int jbd2_log_start_commit(journal_t *journal, tid_t tid); 1231int jbd2_log_start_commit(journal_t *journal, tid_t tid);
1200int __jbd2_log_start_commit(journal_t *journal, tid_t tid); 1232int __jbd2_log_start_commit(journal_t *journal, tid_t tid);
1201int jbd2_journal_start_commit(journal_t *journal, tid_t *tid); 1233int jbd2_journal_start_commit(journal_t *journal, tid_t *tid);
1202int jbd2_journal_force_commit_nested(journal_t *journal);
1203int jbd2_log_wait_commit(journal_t *journal, tid_t tid); 1234int jbd2_log_wait_commit(journal_t *journal, tid_t tid);
1204int jbd2_complete_transaction(journal_t *journal, tid_t tid); 1235int jbd2_complete_transaction(journal_t *journal, tid_t tid);
1205int jbd2_log_do_checkpoint(journal_t *journal); 1236int jbd2_log_do_checkpoint(journal_t *journal);
@@ -1235,7 +1266,7 @@ static inline int is_journal_aborted(journal_t *journal)
1235 1266
1236static inline int is_handle_aborted(handle_t *handle) 1267static inline int is_handle_aborted(handle_t *handle)
1237{ 1268{
1238 if (handle->h_aborted) 1269 if (handle->h_aborted || !handle->h_transaction)
1239 return 1; 1270 return 1;
1240 return is_journal_aborted(handle->h_transaction->t_journal); 1271 return is_journal_aborted(handle->h_transaction->t_journal);
1241} 1272}
@@ -1266,16 +1297,37 @@ extern int jbd2_journal_blocks_per_page(struct inode *inode);
1266extern size_t journal_tag_bytes(journal_t *journal); 1297extern size_t journal_tag_bytes(journal_t *journal);
1267 1298
1268/* 1299/*
1300 * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for
1301 * transaction control blocks.
1302 */
1303#define JBD2_CONTROL_BLOCKS_SHIFT 5
1304
1305/*
1269 * Return the minimum number of blocks which must be free in the journal 1306 * Return the minimum number of blocks which must be free in the journal
1270 * before a new transaction may be started. Must be called under j_state_lock. 1307 * before a new transaction may be started. Must be called under j_state_lock.
1271 */ 1308 */
1272static inline int jbd_space_needed(journal_t *journal) 1309static inline int jbd2_space_needed(journal_t *journal)
1273{ 1310{
1274 int nblocks = journal->j_max_transaction_buffers; 1311 int nblocks = journal->j_max_transaction_buffers;
1275 if (journal->j_committing_transaction) 1312 return nblocks + (nblocks >> JBD2_CONTROL_BLOCKS_SHIFT);
1276 nblocks += atomic_read(&journal->j_committing_transaction-> 1313}
1277 t_outstanding_credits); 1314
1278 return nblocks; 1315/*
1316 * Return number of free blocks in the log. Must be called under j_state_lock.
1317 */
1318static inline unsigned long jbd2_log_space_left(journal_t *journal)
1319{
1320 /* Allow for rounding errors */
1321 unsigned long free = journal->j_free - 32;
1322
1323 if (journal->j_committing_transaction) {
1324 unsigned long committing = atomic_read(&journal->
1325 j_committing_transaction->t_outstanding_credits);
1326
1327 /* Transaction + control blocks */
1328 free -= committing + (committing >> JBD2_CONTROL_BLOCKS_SHIFT);
1329 }
1330 return free;
1279} 1331}
1280 1332
1281/* 1333/*
@@ -1286,11 +1338,9 @@ static inline int jbd_space_needed(journal_t *journal)
1286#define BJ_None 0 /* Not journaled */ 1338#define BJ_None 0 /* Not journaled */
1287#define BJ_Metadata 1 /* Normal journaled metadata */ 1339#define BJ_Metadata 1 /* Normal journaled metadata */
1288#define BJ_Forget 2 /* Buffer superseded by this transaction */ 1340#define BJ_Forget 2 /* Buffer superseded by this transaction */
1289#define BJ_IO 3 /* Buffer is for temporary IO use */ 1341#define BJ_Shadow 3 /* Buffer contents being shadowed to the log */
1290#define BJ_Shadow 4 /* Buffer contents being shadowed to the log */ 1342#define BJ_Reserved 4 /* Buffer is reserved for access by journal */
1291#define BJ_LogCtl 5 /* Buffer contains log descriptors */ 1343#define BJ_Types 5
1292#define BJ_Reserved 6 /* Buffer is reserved for access by journal */
1293#define BJ_Types 7
1294 1344
1295extern int jbd_blocks_per_page(struct inode *inode); 1345extern int jbd_blocks_per_page(struct inode *inode);
1296 1346
@@ -1319,6 +1369,19 @@ static inline u32 jbd2_chksum(journal_t *journal, u32 crc,
1319 return *(u32 *)desc.ctx; 1369 return *(u32 *)desc.ctx;
1320} 1370}
1321 1371
1372/* Return most recent uncommitted transaction */
1373static inline tid_t jbd2_get_latest_transaction(journal_t *journal)
1374{
1375 tid_t tid;
1376
1377 read_lock(&journal->j_state_lock);
1378 tid = journal->j_commit_request;
1379 if (journal->j_running_transaction)
1380 tid = journal->j_running_transaction->t_tid;
1381 read_unlock(&journal->j_state_lock);
1382 return tid;
1383}
1384
1322#ifdef __KERNEL__ 1385#ifdef __KERNEL__
1323 1386
1324#define buffer_trace_init(bh) do {} while (0) 1387#define buffer_trace_init(bh) do {} while (0)
diff --git a/include/linux/jbd_common.h b/include/linux/jbd_common.h
index 6133679bc4c0..3dc53432355f 100644
--- a/include/linux/jbd_common.h
+++ b/include/linux/jbd_common.h
@@ -1,31 +1,7 @@
1#ifndef _LINUX_JBD_STATE_H 1#ifndef _LINUX_JBD_STATE_H
2#define _LINUX_JBD_STATE_H 2#define _LINUX_JBD_STATE_H
3 3
4enum jbd_state_bits { 4#include <linux/bit_spinlock.h>
5 BH_JBD /* Has an attached ext3 journal_head */
6 = BH_PrivateStart,
7 BH_JWrite, /* Being written to log (@@@ DEBUGGING) */
8 BH_Freed, /* Has been freed (truncated) */
9 BH_Revoked, /* Has been revoked from the log */
10 BH_RevokeValid, /* Revoked flag is valid */
11 BH_JBDDirty, /* Is dirty but journaled */
12 BH_State, /* Pins most journal_head state */
13 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
14 BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */
15 BH_Verified, /* Metadata block has been verified ok */
16 BH_JBDPrivateStart, /* First bit available for private use by FS */
17};
18
19BUFFER_FNS(JBD, jbd)
20BUFFER_FNS(JWrite, jwrite)
21BUFFER_FNS(JBDDirty, jbddirty)
22TAS_BUFFER_FNS(JBDDirty, jbddirty)
23BUFFER_FNS(Revoked, revoked)
24TAS_BUFFER_FNS(Revoked, revoked)
25BUFFER_FNS(RevokeValid, revokevalid)
26TAS_BUFFER_FNS(RevokeValid, revokevalid)
27BUFFER_FNS(Freed, freed)
28BUFFER_FNS(Verified, verified)
29 5
30static inline struct buffer_head *jh2bh(struct journal_head *jh) 6static inline struct buffer_head *jh2bh(struct journal_head *jh)
31{ 7{
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 8fb8edf12417..d235e88cfd7c 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -101,13 +101,13 @@ static inline u64 get_jiffies_64(void)
101#define time_after(a,b) \ 101#define time_after(a,b) \
102 (typecheck(unsigned long, a) && \ 102 (typecheck(unsigned long, a) && \
103 typecheck(unsigned long, b) && \ 103 typecheck(unsigned long, b) && \
104 ((long)(b) - (long)(a) < 0)) 104 ((long)((b) - (a)) < 0))
105#define time_before(a,b) time_after(b,a) 105#define time_before(a,b) time_after(b,a)
106 106
107#define time_after_eq(a,b) \ 107#define time_after_eq(a,b) \
108 (typecheck(unsigned long, a) && \ 108 (typecheck(unsigned long, a) && \
109 typecheck(unsigned long, b) && \ 109 typecheck(unsigned long, b) && \
110 ((long)(a) - (long)(b) >= 0)) 110 ((long)((a) - (b)) >= 0))
111#define time_before_eq(a,b) time_after_eq(b,a) 111#define time_before_eq(a,b) time_after_eq(b,a)
112 112
113/* 113/*
@@ -130,15 +130,19 @@ static inline u64 get_jiffies_64(void)
130#define time_after64(a,b) \ 130#define time_after64(a,b) \
131 (typecheck(__u64, a) && \ 131 (typecheck(__u64, a) && \
132 typecheck(__u64, b) && \ 132 typecheck(__u64, b) && \
133 ((__s64)(b) - (__s64)(a) < 0)) 133 ((__s64)((b) - (a)) < 0))
134#define time_before64(a,b) time_after64(b,a) 134#define time_before64(a,b) time_after64(b,a)
135 135
136#define time_after_eq64(a,b) \ 136#define time_after_eq64(a,b) \
137 (typecheck(__u64, a) && \ 137 (typecheck(__u64, a) && \
138 typecheck(__u64, b) && \ 138 typecheck(__u64, b) && \
139 ((__s64)(a) - (__s64)(b) >= 0)) 139 ((__s64)((a) - (b)) >= 0))
140#define time_before_eq64(a,b) time_after_eq64(b,a) 140#define time_before_eq64(a,b) time_after_eq64(b,a)
141 141
142#define time_in_range64(a, b, c) \
143 (time_after_eq64(a, b) && \
144 time_before_eq64(a, c))
145
142/* 146/*
143 * These four macros compare jiffies and 'a' for convenience. 147 * These four macros compare jiffies and 'a' for convenience.
144 */ 148 */
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 0976fc46d1e0..a5079072da66 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -48,7 +48,6 @@
48 48
49#include <linux/types.h> 49#include <linux/types.h>
50#include <linux/compiler.h> 50#include <linux/compiler.h>
51#include <linux/workqueue.h>
52 51
53#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) 52#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
54 53
@@ -61,12 +60,6 @@ struct static_key {
61#endif 60#endif
62}; 61};
63 62
64struct static_key_deferred {
65 struct static_key key;
66 unsigned long timeout;
67 struct delayed_work work;
68};
69
70# include <asm/jump_label.h> 63# include <asm/jump_label.h>
71# define HAVE_JUMP_LABEL 64# define HAVE_JUMP_LABEL
72#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */ 65#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */
@@ -78,6 +71,7 @@ enum jump_label_type {
78 71
79struct module; 72struct module;
80 73
74#include <linux/atomic.h>
81#ifdef HAVE_JUMP_LABEL 75#ifdef HAVE_JUMP_LABEL
82 76
83#define JUMP_LABEL_TRUE_BRANCH 1UL 77#define JUMP_LABEL_TRUE_BRANCH 1UL
@@ -119,10 +113,7 @@ extern void arch_jump_label_transform_static(struct jump_entry *entry,
119extern int jump_label_text_reserved(void *start, void *end); 113extern int jump_label_text_reserved(void *start, void *end);
120extern void static_key_slow_inc(struct static_key *key); 114extern void static_key_slow_inc(struct static_key *key);
121extern void static_key_slow_dec(struct static_key *key); 115extern void static_key_slow_dec(struct static_key *key);
122extern void static_key_slow_dec_deferred(struct static_key_deferred *key);
123extern void jump_label_apply_nops(struct module *mod); 116extern void jump_label_apply_nops(struct module *mod);
124extern void
125jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl);
126 117
127#define STATIC_KEY_INIT_TRUE ((struct static_key) \ 118#define STATIC_KEY_INIT_TRUE ((struct static_key) \
128 { .enabled = ATOMIC_INIT(1), .entries = (void *)1 }) 119 { .enabled = ATOMIC_INIT(1), .entries = (void *)1 })
@@ -131,8 +122,6 @@ jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl);
131 122
132#else /* !HAVE_JUMP_LABEL */ 123#else /* !HAVE_JUMP_LABEL */
133 124
134#include <linux/atomic.h>
135
136struct static_key { 125struct static_key {
137 atomic_t enabled; 126 atomic_t enabled;
138}; 127};
@@ -141,10 +130,6 @@ static __always_inline void jump_label_init(void)
141{ 130{
142} 131}
143 132
144struct static_key_deferred {
145 struct static_key key;
146};
147
148static __always_inline bool static_key_false(struct static_key *key) 133static __always_inline bool static_key_false(struct static_key *key)
149{ 134{
150 if (unlikely(atomic_read(&key->enabled)) > 0) 135 if (unlikely(atomic_read(&key->enabled)) > 0)
@@ -169,11 +154,6 @@ static inline void static_key_slow_dec(struct static_key *key)
169 atomic_dec(&key->enabled); 154 atomic_dec(&key->enabled);
170} 155}
171 156
172static inline void static_key_slow_dec_deferred(struct static_key_deferred *key)
173{
174 static_key_slow_dec(&key->key);
175}
176
177static inline int jump_label_text_reserved(void *start, void *end) 157static inline int jump_label_text_reserved(void *start, void *end)
178{ 158{
179 return 0; 159 return 0;
@@ -187,12 +167,6 @@ static inline int jump_label_apply_nops(struct module *mod)
187 return 0; 167 return 0;
188} 168}
189 169
190static inline void
191jump_label_rate_limit(struct static_key_deferred *key,
192 unsigned long rl)
193{
194}
195
196#define STATIC_KEY_INIT_TRUE ((struct static_key) \ 170#define STATIC_KEY_INIT_TRUE ((struct static_key) \
197 { .enabled = ATOMIC_INIT(1) }) 171 { .enabled = ATOMIC_INIT(1) })
198#define STATIC_KEY_INIT_FALSE ((struct static_key) \ 172#define STATIC_KEY_INIT_FALSE ((struct static_key) \
diff --git a/include/linux/jump_label_ratelimit.h b/include/linux/jump_label_ratelimit.h
new file mode 100644
index 000000000000..113788389b3d
--- /dev/null
+++ b/include/linux/jump_label_ratelimit.h
@@ -0,0 +1,34 @@
1#ifndef _LINUX_JUMP_LABEL_RATELIMIT_H
2#define _LINUX_JUMP_LABEL_RATELIMIT_H
3
4#include <linux/jump_label.h>
5#include <linux/workqueue.h>
6
7#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
8struct static_key_deferred {
9 struct static_key key;
10 unsigned long timeout;
11 struct delayed_work work;
12};
13#endif
14
15#ifdef HAVE_JUMP_LABEL
16extern void static_key_slow_dec_deferred(struct static_key_deferred *key);
17extern void
18jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl);
19
20#else /* !HAVE_JUMP_LABEL */
21struct static_key_deferred {
22 struct static_key key;
23};
24static inline void static_key_slow_dec_deferred(struct static_key_deferred *key)
25{
26 static_key_slow_dec(&key->key);
27}
28static inline void
29jump_label_rate_limit(struct static_key_deferred *key,
30 unsigned long rl)
31{
32}
33#endif /* HAVE_JUMP_LABEL */
34#endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index b7c8cdc1d422..cbfb171bbcba 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -36,10 +36,9 @@ struct kbd_struct {
36#define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */ 36#define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */
37 unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */ 37 unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */
38 38
39 unsigned char ledmode:2; /* one 2-bit value */ 39 unsigned char ledmode:1;
40#define LED_SHOW_FLAGS 0 /* traditional state */ 40#define LED_SHOW_FLAGS 0 /* traditional state */
41#define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */ 41#define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */
42#define LED_SHOW_MEM 2 /* `heartbeat': peek into memory */
43 42
44 unsigned char ledflagstate:4; /* flags, not lights */ 43 unsigned char ledflagstate:4; /* flags, not lights */
45 unsigned char default_ledflagstate:4; 44 unsigned char default_ledflagstate:4;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e9ef6d6b51d5..672ddc4de4af 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -193,13 +193,10 @@ extern int _cond_resched(void);
193 (__x < 0) ? -__x : __x; \ 193 (__x < 0) ? -__x : __x; \
194 }) 194 })
195 195
196#ifdef CONFIG_PROVE_LOCKING 196#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP)
197void might_fault(void); 197void might_fault(void);
198#else 198#else
199static inline void might_fault(void) 199static inline void might_fault(void) { }
200{
201 might_sleep();
202}
203#endif 200#endif
204 201
205extern struct atomic_notifier_head panic_notifier_list; 202extern struct atomic_notifier_head panic_notifier_list;
@@ -442,6 +439,17 @@ static inline char *hex_byte_pack(char *buf, u8 byte)
442 return buf; 439 return buf;
443} 440}
444 441
442extern const char hex_asc_upper[];
443#define hex_asc_upper_lo(x) hex_asc_upper[((x) & 0x0f)]
444#define hex_asc_upper_hi(x) hex_asc_upper[((x) & 0xf0) >> 4]
445
446static inline char *hex_byte_pack_upper(char *buf, u8 byte)
447{
448 *buf++ = hex_asc_upper_hi(byte);
449 *buf++ = hex_asc_upper_lo(byte);
450 return buf;
451}
452
445static inline char * __deprecated pack_hex_byte(char *buf, u8 byte) 453static inline char * __deprecated pack_hex_byte(char *buf, u8 byte)
446{ 454{
447 return hex_byte_pack(buf, byte); 455 return hex_byte_pack(buf, byte);
@@ -450,6 +458,8 @@ static inline char * __deprecated pack_hex_byte(char *buf, u8 byte)
450extern int hex_to_bin(char ch); 458extern int hex_to_bin(char ch);
451extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); 459extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
452 460
461int mac_pton(const char *s, u8 *mac);
462
453/* 463/*
454 * General tracing related utility functions - trace_printk(), 464 * General tracing related utility functions - trace_printk(),
455 * tracing_on/tracing_off and tracing_start()/tracing_stop 465 * tracing_on/tracing_off and tracing_start()/tracing_stop
@@ -562,9 +572,6 @@ int __trace_bprintk(unsigned long ip, const char *fmt, ...);
562extern __printf(2, 3) 572extern __printf(2, 3)
563int __trace_printk(unsigned long ip, const char *fmt, ...); 573int __trace_printk(unsigned long ip, const char *fmt, ...);
564 574
565extern int __trace_bputs(unsigned long ip, const char *str);
566extern int __trace_puts(unsigned long ip, const char *str, int size);
567
568/** 575/**
569 * trace_puts - write a string into the ftrace buffer 576 * trace_puts - write a string into the ftrace buffer
570 * @str: the string to record 577 * @str: the string to record
@@ -600,6 +607,8 @@ extern int __trace_puts(unsigned long ip, const char *str, int size);
600 else \ 607 else \
601 __trace_puts(_THIS_IP_, str, strlen(str)); \ 608 __trace_puts(_THIS_IP_, str, strlen(str)); \
602}) 609})
610extern int __trace_bputs(unsigned long ip, const char *str);
611extern int __trace_puts(unsigned long ip, const char *str, int size);
603 612
604extern void trace_dump_stack(int skip); 613extern void trace_dump_stack(int skip);
605 614
@@ -631,7 +640,7 @@ extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
631static inline void tracing_start(void) { } 640static inline void tracing_start(void) { }
632static inline void tracing_stop(void) { } 641static inline void tracing_stop(void) { }
633static inline void ftrace_off_permanent(void) { } 642static inline void ftrace_off_permanent(void) { }
634static inline void trace_dump_stack(void) { } 643static inline void trace_dump_stack(int skip) { }
635 644
636static inline void tracing_on(void) { } 645static inline void tracing_on(void) { }
637static inline void tracing_off(void) { } 646static inline void tracing_off(void) { }
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index ed5f6ed6eb77..51c72be4a7c3 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -36,9 +36,6 @@ struct kernel_cpustat {
36}; 36};
37 37
38struct kernel_stat { 38struct kernel_stat {
39#ifndef CONFIG_GENERIC_HARDIRQS
40 unsigned int irqs[NR_IRQS];
41#endif
42 unsigned long irqs_sum; 39 unsigned long irqs_sum;
43 unsigned int softirqs[NR_SOFTIRQS]; 40 unsigned int softirqs[NR_SOFTIRQS];
44}; 41};
@@ -54,22 +51,6 @@ DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
54 51
55extern unsigned long long nr_context_switches(void); 52extern unsigned long long nr_context_switches(void);
56 53
57#ifndef CONFIG_GENERIC_HARDIRQS
58
59struct irq_desc;
60
61static inline void kstat_incr_irqs_this_cpu(unsigned int irq,
62 struct irq_desc *desc)
63{
64 __this_cpu_inc(kstat.irqs[irq]);
65 __this_cpu_inc(kstat.irqs_sum);
66}
67
68static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
69{
70 return kstat_cpu(cpu).irqs[irq];
71}
72#else
73#include <linux/irq.h> 54#include <linux/irq.h>
74extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); 55extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu);
75 56
@@ -79,8 +60,6 @@ do { \
79 __this_cpu_inc(kstat.irqs_sum); \ 60 __this_cpu_inc(kstat.irqs_sum); \
80} while (0) 61} while (0)
81 62
82#endif
83
84static inline void kstat_incr_softirqs_this_cpu(unsigned int irq) 63static inline void kstat_incr_softirqs_this_cpu(unsigned int irq)
85{ 64{
86 __this_cpu_inc(kstat.softirqs[irq]); 65 __this_cpu_inc(kstat.softirqs[irq]);
@@ -94,20 +73,7 @@ static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu)
94/* 73/*
95 * Number of interrupts per specific IRQ source, since bootup 74 * Number of interrupts per specific IRQ source, since bootup
96 */ 75 */
97#ifndef CONFIG_GENERIC_HARDIRQS
98static inline unsigned int kstat_irqs(unsigned int irq)
99{
100 unsigned int sum = 0;
101 int cpu;
102
103 for_each_possible_cpu(cpu)
104 sum += kstat_irqs_cpu(irq, cpu);
105
106 return sum;
107}
108#else
109extern unsigned int kstat_irqs(unsigned int irq); 76extern unsigned int kstat_irqs(unsigned int irq);
110#endif
111 77
112/* 78/*
113 * Number of interrupts per cpu, since bootup 79 * Number of interrupts per cpu, since bootup
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 939b11268c86..de6dcbcc6ef7 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -26,6 +26,7 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/wait.h> 27#include <linux/wait.h>
28#include <linux/atomic.h> 28#include <linux/atomic.h>
29#include <linux/workqueue.h>
29 30
30#define UEVENT_HELPER_PATH_LEN 256 31#define UEVENT_HELPER_PATH_LEN 256
31#define UEVENT_NUM_ENVP 32 /* number of env pointers */ 32#define UEVENT_NUM_ENVP 32 /* number of env pointers */
@@ -65,6 +66,9 @@ struct kobject {
65 struct kobj_type *ktype; 66 struct kobj_type *ktype;
66 struct sysfs_dirent *sd; 67 struct sysfs_dirent *sd;
67 struct kref kref; 68 struct kref kref;
69#ifdef CONFIG_DEBUG_KOBJECT_RELEASE
70 struct delayed_work release;
71#endif
68 unsigned int state_initialized:1; 72 unsigned int state_initialized:1;
69 unsigned int state_in_sysfs:1; 73 unsigned int state_in_sysfs:1;
70 unsigned int state_add_uevent_sent:1; 74 unsigned int state_add_uevent_sent:1;
diff --git a/include/linux/kobject_ns.h b/include/linux/kobject_ns.h
index f66b065a8b5f..df32d2508290 100644
--- a/include/linux/kobject_ns.h
+++ b/include/linux/kobject_ns.h
@@ -39,6 +39,7 @@ enum kobj_ns_type {
39 */ 39 */
40struct kobj_ns_type_operations { 40struct kobj_ns_type_operations {
41 enum kobj_ns_type type; 41 enum kobj_ns_type type;
42 bool (*current_may_mount)(void);
42 void *(*grab_current_ns)(void); 43 void *(*grab_current_ns)(void);
43 const void *(*netlink_ns)(struct sock *sk); 44 const void *(*netlink_ns)(struct sock *sk);
44 const void *(*initial_ns)(void); 45 const void *(*initial_ns)(void);
@@ -50,6 +51,7 @@ int kobj_ns_type_registered(enum kobj_ns_type type);
50const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent); 51const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent);
51const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj); 52const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj);
52 53
54bool kobj_ns_current_may_mount(enum kobj_ns_type type);
53void *kobj_ns_grab_current(enum kobj_ns_type type); 55void *kobj_ns_grab_current(enum kobj_ns_type type);
54const void *kobj_ns_netlink(enum kobj_ns_type type, struct sock *sk); 56const void *kobj_ns_netlink(enum kobj_ns_type type, struct sock *sk);
55const void *kobj_ns_initial(enum kobj_ns_type type); 57const void *kobj_ns_initial(enum kobj_ns_type type);
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index ca1d27a0d6a6..925eaf28fca9 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -264,10 +264,36 @@ extern void arch_arm_kprobe(struct kprobe *p);
264extern void arch_disarm_kprobe(struct kprobe *p); 264extern void arch_disarm_kprobe(struct kprobe *p);
265extern int arch_init_kprobes(void); 265extern int arch_init_kprobes(void);
266extern void show_registers(struct pt_regs *regs); 266extern void show_registers(struct pt_regs *regs);
267extern kprobe_opcode_t *get_insn_slot(void);
268extern void free_insn_slot(kprobe_opcode_t *slot, int dirty);
269extern void kprobes_inc_nmissed_count(struct kprobe *p); 267extern void kprobes_inc_nmissed_count(struct kprobe *p);
270 268
269struct kprobe_insn_cache {
270 struct mutex mutex;
271 void *(*alloc)(void); /* allocate insn page */
272 void (*free)(void *); /* free insn page */
273 struct list_head pages; /* list of kprobe_insn_page */
274 size_t insn_size; /* size of instruction slot */
275 int nr_garbage;
276};
277
278extern kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c);
279extern void __free_insn_slot(struct kprobe_insn_cache *c,
280 kprobe_opcode_t *slot, int dirty);
281
282#define DEFINE_INSN_CACHE_OPS(__name) \
283extern struct kprobe_insn_cache kprobe_##__name##_slots; \
284 \
285static inline kprobe_opcode_t *get_##__name##_slot(void) \
286{ \
287 return __get_insn_slot(&kprobe_##__name##_slots); \
288} \
289 \
290static inline void free_##__name##_slot(kprobe_opcode_t *slot, int dirty)\
291{ \
292 __free_insn_slot(&kprobe_##__name##_slots, slot, dirty); \
293} \
294
295DEFINE_INSN_CACHE_OPS(insn);
296
271#ifdef CONFIG_OPTPROBES 297#ifdef CONFIG_OPTPROBES
272/* 298/*
273 * Internal structure for direct jump optimized probe 299 * Internal structure for direct jump optimized probe
@@ -287,13 +313,13 @@ extern void arch_optimize_kprobes(struct list_head *oplist);
287extern void arch_unoptimize_kprobes(struct list_head *oplist, 313extern void arch_unoptimize_kprobes(struct list_head *oplist,
288 struct list_head *done_list); 314 struct list_head *done_list);
289extern void arch_unoptimize_kprobe(struct optimized_kprobe *op); 315extern void arch_unoptimize_kprobe(struct optimized_kprobe *op);
290extern kprobe_opcode_t *get_optinsn_slot(void);
291extern void free_optinsn_slot(kprobe_opcode_t *slot, int dirty);
292extern int arch_within_optimized_kprobe(struct optimized_kprobe *op, 316extern int arch_within_optimized_kprobe(struct optimized_kprobe *op,
293 unsigned long addr); 317 unsigned long addr);
294 318
295extern void opt_pre_handler(struct kprobe *p, struct pt_regs *regs); 319extern void opt_pre_handler(struct kprobe *p, struct pt_regs *regs);
296 320
321DEFINE_INSN_CACHE_OPS(optinsn);
322
297#ifdef CONFIG_SYSCTL 323#ifdef CONFIG_SYSCTL
298extern int sysctl_kprobes_optimization; 324extern int sysctl_kprobes_optimization;
299extern int proc_kprobes_optimization_handler(struct ctl_table *table, 325extern int proc_kprobes_optimization_handler(struct ctl_table *table,
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index bbca12804d12..31c0cd1c941a 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -69,7 +69,7 @@ typedef union ktime ktime_t; /* Kill this */
69 * @secs: seconds to set 69 * @secs: seconds to set
70 * @nsecs: nanoseconds to set 70 * @nsecs: nanoseconds to set
71 * 71 *
72 * Return the ktime_t representation of the value 72 * Return: The ktime_t representation of the value.
73 */ 73 */
74static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) 74static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
75{ 75{
@@ -151,7 +151,7 @@ static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
151 * @lhs: minuend 151 * @lhs: minuend
152 * @rhs: subtrahend 152 * @rhs: subtrahend
153 * 153 *
154 * Returns the remainder of the subtraction 154 * Return: The remainder of the subtraction.
155 */ 155 */
156static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs) 156static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
157{ 157{
@@ -169,7 +169,7 @@ static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
169 * @add1: addend1 169 * @add1: addend1
170 * @add2: addend2 170 * @add2: addend2
171 * 171 *
172 * Returns the sum of @add1 and @add2. 172 * Return: The sum of @add1 and @add2.
173 */ 173 */
174static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2) 174static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
175{ 175{
@@ -195,7 +195,7 @@ static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
195 * @kt: addend 195 * @kt: addend
196 * @nsec: the scalar nsec value to add 196 * @nsec: the scalar nsec value to add
197 * 197 *
198 * Returns the sum of @kt and @nsec in ktime_t format 198 * Return: The sum of @kt and @nsec in ktime_t format.
199 */ 199 */
200extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec); 200extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
201 201
@@ -204,7 +204,7 @@ extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
204 * @kt: minuend 204 * @kt: minuend
205 * @nsec: the scalar nsec value to subtract 205 * @nsec: the scalar nsec value to subtract
206 * 206 *
207 * Returns the subtraction of @nsec from @kt in ktime_t format 207 * Return: The subtraction of @nsec from @kt in ktime_t format.
208 */ 208 */
209extern ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec); 209extern ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec);
210 210
@@ -212,7 +212,7 @@ extern ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec);
212 * timespec_to_ktime - convert a timespec to ktime_t format 212 * timespec_to_ktime - convert a timespec to ktime_t format
213 * @ts: the timespec variable to convert 213 * @ts: the timespec variable to convert
214 * 214 *
215 * Returns a ktime_t variable with the converted timespec value 215 * Return: A ktime_t variable with the converted timespec value.
216 */ 216 */
217static inline ktime_t timespec_to_ktime(const struct timespec ts) 217static inline ktime_t timespec_to_ktime(const struct timespec ts)
218{ 218{
@@ -224,19 +224,20 @@ static inline ktime_t timespec_to_ktime(const struct timespec ts)
224 * timeval_to_ktime - convert a timeval to ktime_t format 224 * timeval_to_ktime - convert a timeval to ktime_t format
225 * @tv: the timeval variable to convert 225 * @tv: the timeval variable to convert
226 * 226 *
227 * Returns a ktime_t variable with the converted timeval value 227 * Return: A ktime_t variable with the converted timeval value.
228 */ 228 */
229static inline ktime_t timeval_to_ktime(const struct timeval tv) 229static inline ktime_t timeval_to_ktime(const struct timeval tv)
230{ 230{
231 return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec, 231 return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec,
232 .nsec = (s32)tv.tv_usec * 1000 } }; 232 .nsec = (s32)(tv.tv_usec *
233 NSEC_PER_USEC) } };
233} 234}
234 235
235/** 236/**
236 * ktime_to_timespec - convert a ktime_t variable to timespec format 237 * ktime_to_timespec - convert a ktime_t variable to timespec format
237 * @kt: the ktime_t variable to convert 238 * @kt: the ktime_t variable to convert
238 * 239 *
239 * Returns the timespec representation of the ktime value 240 * Return: The timespec representation of the ktime value.
240 */ 241 */
241static inline struct timespec ktime_to_timespec(const ktime_t kt) 242static inline struct timespec ktime_to_timespec(const ktime_t kt)
242{ 243{
@@ -248,7 +249,7 @@ static inline struct timespec ktime_to_timespec(const ktime_t kt)
248 * ktime_to_timeval - convert a ktime_t variable to timeval format 249 * ktime_to_timeval - convert a ktime_t variable to timeval format
249 * @kt: the ktime_t variable to convert 250 * @kt: the ktime_t variable to convert
250 * 251 *
251 * Returns the timeval representation of the ktime value 252 * Return: The timeval representation of the ktime value.
252 */ 253 */
253static inline struct timeval ktime_to_timeval(const ktime_t kt) 254static inline struct timeval ktime_to_timeval(const ktime_t kt)
254{ 255{
@@ -261,7 +262,7 @@ static inline struct timeval ktime_to_timeval(const ktime_t kt)
261 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds 262 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds
262 * @kt: the ktime_t variable to convert 263 * @kt: the ktime_t variable to convert
263 * 264 *
264 * Returns the scalar nanoseconds representation of @kt 265 * Return: The scalar nanoseconds representation of @kt.
265 */ 266 */
266static inline s64 ktime_to_ns(const ktime_t kt) 267static inline s64 ktime_to_ns(const ktime_t kt)
267{ 268{
@@ -275,7 +276,9 @@ static inline s64 ktime_to_ns(const ktime_t kt)
275 * @cmp1: comparable1 276 * @cmp1: comparable1
276 * @cmp2: comparable2 277 * @cmp2: comparable2
277 * 278 *
278 * Compare two ktime_t variables, returns 1 if equal 279 * Compare two ktime_t variables.
280 *
281 * Return: 1 if equal.
279 */ 282 */
280static inline int ktime_equal(const ktime_t cmp1, const ktime_t cmp2) 283static inline int ktime_equal(const ktime_t cmp1, const ktime_t cmp2)
281{ 284{
@@ -287,7 +290,7 @@ static inline int ktime_equal(const ktime_t cmp1, const ktime_t cmp2)
287 * @cmp1: comparable1 290 * @cmp1: comparable1
288 * @cmp2: comparable2 291 * @cmp2: comparable2
289 * 292 *
290 * Returns ... 293 * Return: ...
291 * cmp1 < cmp2: return <0 294 * cmp1 < cmp2: return <0
292 * cmp1 == cmp2: return 0 295 * cmp1 == cmp2: return 0
293 * cmp1 > cmp2: return >0 296 * cmp1 > cmp2: return >0
@@ -320,12 +323,17 @@ static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier)
320 323
321static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec) 324static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec)
322{ 325{
323 return ktime_add_ns(kt, usec * 1000); 326 return ktime_add_ns(kt, usec * NSEC_PER_USEC);
327}
328
329static inline ktime_t ktime_add_ms(const ktime_t kt, const u64 msec)
330{
331 return ktime_add_ns(kt, msec * NSEC_PER_MSEC);
324} 332}
325 333
326static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec) 334static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
327{ 335{
328 return ktime_sub_ns(kt, usec * 1000); 336 return ktime_sub_ns(kt, usec * NSEC_PER_USEC);
329} 337}
330 338
331extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); 339extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);
@@ -336,9 +344,10 @@ extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);
336 * @kt: the ktime_t variable to convert 344 * @kt: the ktime_t variable to convert
337 * @ts: the timespec variable to store the result in 345 * @ts: the timespec variable to store the result in
338 * 346 *
339 * Returns true if there was a successful conversion, false if kt was 0. 347 * Return: %true if there was a successful conversion, %false if kt was 0.
340 */ 348 */
341static inline bool ktime_to_timespec_cond(const ktime_t kt, struct timespec *ts) 349static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt,
350 struct timespec *ts)
342{ 351{
343 if (kt.tv64) { 352 if (kt.tv64) {
344 *ts = ktime_to_timespec(kt); 353 *ts = ktime_to_timespec(kt);
@@ -366,7 +375,15 @@ extern void ktime_get_ts(struct timespec *ts);
366static inline ktime_t ns_to_ktime(u64 ns) 375static inline ktime_t ns_to_ktime(u64 ns)
367{ 376{
368 static const ktime_t ktime_zero = { .tv64 = 0 }; 377 static const ktime_t ktime_zero = { .tv64 = 0 };
378
369 return ktime_add_ns(ktime_zero, ns); 379 return ktime_add_ns(ktime_zero, ns);
370} 380}
371 381
382static inline ktime_t ms_to_ktime(u64 ms)
383{
384 static const ktime_t ktime_zero = { .tv64 = 0 };
385
386 return ktime_add_ms(ktime_zero, ms);
387}
388
372#endif 389#endif
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index f0eea07d2c2b..0fbbc7aa02cb 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -23,6 +23,7 @@
23#include <linux/ratelimit.h> 23#include <linux/ratelimit.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/irqflags.h> 25#include <linux/irqflags.h>
26#include <linux/context_tracking.h>
26#include <asm/signal.h> 27#include <asm/signal.h>
27 28
28#include <linux/kvm.h> 29#include <linux/kvm.h>
@@ -84,6 +85,12 @@ static inline bool is_noslot_pfn(pfn_t pfn)
84 return pfn == KVM_PFN_NOSLOT; 85 return pfn == KVM_PFN_NOSLOT;
85} 86}
86 87
88/*
89 * architectures with KVM_HVA_ERR_BAD other than PAGE_OFFSET (e.g. s390)
90 * provide own defines and kvm_is_error_hva
91 */
92#ifndef KVM_HVA_ERR_BAD
93
87#define KVM_HVA_ERR_BAD (PAGE_OFFSET) 94#define KVM_HVA_ERR_BAD (PAGE_OFFSET)
88#define KVM_HVA_ERR_RO_BAD (PAGE_OFFSET + PAGE_SIZE) 95#define KVM_HVA_ERR_RO_BAD (PAGE_OFFSET + PAGE_SIZE)
89 96
@@ -92,6 +99,8 @@ static inline bool kvm_is_error_hva(unsigned long addr)
92 return addr >= PAGE_OFFSET; 99 return addr >= PAGE_OFFSET;
93} 100}
94 101
102#endif
103
95#define KVM_ERR_PTR_BAD_PAGE (ERR_PTR(-ENOENT)) 104#define KVM_ERR_PTR_BAD_PAGE (ERR_PTR(-ENOENT))
96 105
97static inline bool is_error_page(struct page *page) 106static inline bool is_error_page(struct page *page)
@@ -124,6 +133,7 @@ static inline bool is_error_page(struct page *page)
124#define KVM_REQ_MCLOCK_INPROGRESS 19 133#define KVM_REQ_MCLOCK_INPROGRESS 19
125#define KVM_REQ_EPR_EXIT 20 134#define KVM_REQ_EPR_EXIT 20
126#define KVM_REQ_SCAN_IOAPIC 21 135#define KVM_REQ_SCAN_IOAPIC 21
136#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22
127 137
128#define KVM_USERSPACE_IRQ_SOURCE_ID 0 138#define KVM_USERSPACE_IRQ_SOURCE_ID 0
129#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 139#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
@@ -144,7 +154,8 @@ struct kvm_io_range {
144#define NR_IOBUS_DEVS 1000 154#define NR_IOBUS_DEVS 1000
145 155
146struct kvm_io_bus { 156struct kvm_io_bus {
147 int dev_count; 157 int dev_count;
158 int ioeventfd_count;
148 struct kvm_io_range range[]; 159 struct kvm_io_range range[];
149}; 160};
150 161
@@ -157,8 +168,12 @@ enum kvm_bus {
157 168
158int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, 169int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
159 int len, const void *val); 170 int len, const void *val);
171int kvm_io_bus_write_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
172 int len, const void *val, long cookie);
160int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len, 173int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len,
161 void *val); 174 void *val);
175int kvm_io_bus_read_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
176 int len, void *val, long cookie);
162int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, 177int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
163 int len, struct kvm_io_device *dev); 178 int len, struct kvm_io_device *dev);
164int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, 179int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
@@ -496,6 +511,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
496void kvm_arch_free_memslot(struct kvm_memory_slot *free, 511void kvm_arch_free_memslot(struct kvm_memory_slot *free,
497 struct kvm_memory_slot *dont); 512 struct kvm_memory_slot *dont);
498int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages); 513int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages);
514void kvm_arch_memslots_updated(struct kvm *kvm);
499int kvm_arch_prepare_memory_region(struct kvm *kvm, 515int kvm_arch_prepare_memory_region(struct kvm *kvm,
500 struct kvm_memory_slot *memslot, 516 struct kvm_memory_slot *memslot,
501 struct kvm_userspace_memory_region *mem, 517 struct kvm_userspace_memory_region *mem,
@@ -517,6 +533,7 @@ int gfn_to_page_many_atomic(struct kvm *kvm, gfn_t gfn, struct page **pages,
517 533
518struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); 534struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
519unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); 535unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
536unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable);
520unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn); 537unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn);
521void kvm_release_page_clean(struct page *page); 538void kvm_release_page_clean(struct page *page);
522void kvm_release_page_dirty(struct page *page); 539void kvm_release_page_dirty(struct page *page);
@@ -760,42 +777,6 @@ static inline int kvm_iommu_unmap_guest(struct kvm *kvm)
760} 777}
761#endif 778#endif
762 779
763static inline void __guest_enter(void)
764{
765 /*
766 * This is running in ioctl context so we can avoid
767 * the call to vtime_account() with its unnecessary idle check.
768 */
769 vtime_account_system(current);
770 current->flags |= PF_VCPU;
771}
772
773static inline void __guest_exit(void)
774{
775 /*
776 * This is running in ioctl context so we can avoid
777 * the call to vtime_account() with its unnecessary idle check.
778 */
779 vtime_account_system(current);
780 current->flags &= ~PF_VCPU;
781}
782
783#ifdef CONFIG_CONTEXT_TRACKING
784extern void guest_enter(void);
785extern void guest_exit(void);
786
787#else /* !CONFIG_CONTEXT_TRACKING */
788static inline void guest_enter(void)
789{
790 __guest_enter();
791}
792
793static inline void guest_exit(void)
794{
795 __guest_exit();
796}
797#endif /* !CONFIG_CONTEXT_TRACKING */
798
799static inline void kvm_guest_enter(void) 780static inline void kvm_guest_enter(void)
800{ 781{
801 unsigned long flags; 782 unsigned long flags;
diff --git a/include/linux/lcd.h b/include/linux/lcd.h
index e00c3b0ebc6b..504f6246f38f 100644
--- a/include/linux/lcd.h
+++ b/include/linux/lcd.h
@@ -112,7 +112,12 @@ static inline void lcd_set_power(struct lcd_device *ld, int power)
112 112
113extern struct lcd_device *lcd_device_register(const char *name, 113extern struct lcd_device *lcd_device_register(const char *name,
114 struct device *parent, void *devdata, struct lcd_ops *ops); 114 struct device *parent, void *devdata, struct lcd_ops *ops);
115extern struct lcd_device *devm_lcd_device_register(struct device *dev,
116 const char *name, struct device *parent,
117 void *devdata, struct lcd_ops *ops);
115extern void lcd_device_unregister(struct lcd_device *ld); 118extern void lcd_device_unregister(struct lcd_device *ld);
119extern void devm_lcd_device_unregister(struct device *dev,
120 struct lcd_device *ld);
116 121
117#define to_lcd_device(obj) container_of(obj, struct lcd_device, dev) 122#define to_lcd_device(obj) container_of(obj, struct lcd_device, dev)
118 123
diff --git a/include/linux/libata.h b/include/linux/libata.h
index eae7a053dc51..0e23c26485f4 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -138,6 +138,22 @@ enum {
138 ATA_SHT_THIS_ID = -1, 138 ATA_SHT_THIS_ID = -1,
139 ATA_SHT_USE_CLUSTERING = 1, 139 ATA_SHT_USE_CLUSTERING = 1,
140 140
141 /* struct ata_taskfile flags */
142 ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */
143 ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */
144 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */
145 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
146 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
147 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
148 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */
149
150 /* protocol flags */
151 ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */
152 ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */
153 ATA_PROT_FLAG_DATA = ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA,
154 ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */
155 ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */
156
141 /* struct ata_device stuff */ 157 /* struct ata_device stuff */
142 ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */ 158 ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */
143 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */ 159 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */
@@ -156,6 +172,7 @@ enum {
156 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ 172 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */
157 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ 173 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */
158 ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */ 174 ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */
175 ATA_DFLAG_NCQ_SEND_RECV = (1 << 19), /* device supports NCQ SEND and RECV */
159 ATA_DFLAG_INIT_MASK = (1 << 24) - 1, 176 ATA_DFLAG_INIT_MASK = (1 << 24) - 1,
160 177
161 ATA_DFLAG_DETACH = (1 << 24), 178 ATA_DFLAG_DETACH = (1 << 24),
@@ -207,6 +224,7 @@ enum {
207 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ 224 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
208 ATA_FLAG_AN = (1 << 18), /* controller supports AN */ 225 ATA_FLAG_AN = (1 << 18), /* controller supports AN */
209 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ 226 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */
227 ATA_FLAG_FPDMA_AUX = (1 << 20), /* controller supports H2DFIS aux field */
210 ATA_FLAG_EM = (1 << 21), /* driver supports enclosure 228 ATA_FLAG_EM = (1 << 21), /* driver supports enclosure
211 * management */ 229 * management */
212 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity 230 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
@@ -399,6 +417,7 @@ enum {
399 ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */ 417 ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */
400 ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */ 418 ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */
401 ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17), /* Set max sects to 65535 */ 419 ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17), /* Set max sects to 65535 */
420 ATA_HORKAGE_ATAPI_DMADIR = (1 << 18), /* device requires dmadir */
402 421
403 /* DMA mask for user DMA control: User visible values; DO NOT 422 /* DMA mask for user DMA control: User visible values; DO NOT
404 renumber */ 423 renumber */
@@ -517,6 +536,33 @@ enum sw_activity {
517 BLINK_OFF, 536 BLINK_OFF,
518}; 537};
519 538
539struct ata_taskfile {
540 unsigned long flags; /* ATA_TFLAG_xxx */
541 u8 protocol; /* ATA_PROT_xxx */
542
543 u8 ctl; /* control reg */
544
545 u8 hob_feature; /* additional data */
546 u8 hob_nsect; /* to support LBA48 */
547 u8 hob_lbal;
548 u8 hob_lbam;
549 u8 hob_lbah;
550
551 u8 feature;
552 u8 nsect;
553 u8 lbal;
554 u8 lbam;
555 u8 lbah;
556
557 u8 device;
558
559 u8 command; /* IO operation */
560
561 u32 auxiliary; /* auxiliary field */
562 /* from SATA 3.1 and */
563 /* ATA-8 ACS-3 */
564};
565
520#ifdef CONFIG_ATA_SFF 566#ifdef CONFIG_ATA_SFF
521struct ata_ioports { 567struct ata_ioports {
522 void __iomem *cmd_addr; 568 void __iomem *cmd_addr;
@@ -659,6 +705,9 @@ struct ata_device {
659 /* DEVSLP Timing Variables from Identify Device Data Log */ 705 /* DEVSLP Timing Variables from Identify Device Data Log */
660 u8 devslp_timing[ATA_LOG_DEVSLP_SIZE]; 706 u8 devslp_timing[ATA_LOG_DEVSLP_SIZE];
661 707
708 /* NCQ send and receive log subcommand support */
709 u8 ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_SIZE];
710
662 /* error history */ 711 /* error history */
663 int spdn_cnt; 712 int spdn_cnt;
664 /* ering is CLEAR_END, read comment above CLEAR_END */ 713 /* ering is CLEAR_END, read comment above CLEAR_END */
@@ -746,6 +795,7 @@ struct ata_port {
746 /* Flags that change dynamically, protected by ap->lock */ 795 /* Flags that change dynamically, protected by ap->lock */
747 unsigned int pflags; /* ATA_PFLAG_xxx */ 796 unsigned int pflags; /* ATA_PFLAG_xxx */
748 unsigned int print_id; /* user visible unique port ID */ 797 unsigned int print_id; /* user visible unique port ID */
798 unsigned int local_port_no; /* host local port num */
749 unsigned int port_no; /* 0 based port no. inside the host */ 799 unsigned int port_no; /* 0 based port no. inside the host */
750 800
751#ifdef CONFIG_ATA_SFF 801#ifdef CONFIG_ATA_SFF
@@ -908,6 +958,9 @@ struct ata_port_operations {
908 ssize_t (*sw_activity_show)(struct ata_device *dev, char *buf); 958 ssize_t (*sw_activity_show)(struct ata_device *dev, char *buf);
909 ssize_t (*sw_activity_store)(struct ata_device *dev, 959 ssize_t (*sw_activity_store)(struct ata_device *dev,
910 enum sw_activity val); 960 enum sw_activity val);
961 ssize_t (*transmit_led_message)(struct ata_port *ap, u32 state,
962 ssize_t size);
963
911 /* 964 /*
912 * Obsolete 965 * Obsolete
913 */ 966 */
@@ -954,6 +1007,69 @@ extern const unsigned long sata_deb_timing_long[];
954extern struct ata_port_operations ata_dummy_port_ops; 1007extern struct ata_port_operations ata_dummy_port_ops;
955extern const struct ata_port_info ata_dummy_port_info; 1008extern const struct ata_port_info ata_dummy_port_info;
956 1009
1010/*
1011 * protocol tests
1012 */
1013static inline unsigned int ata_prot_flags(u8 prot)
1014{
1015 switch (prot) {
1016 case ATA_PROT_NODATA:
1017 return 0;
1018 case ATA_PROT_PIO:
1019 return ATA_PROT_FLAG_PIO;
1020 case ATA_PROT_DMA:
1021 return ATA_PROT_FLAG_DMA;
1022 case ATA_PROT_NCQ:
1023 return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ;
1024 case ATAPI_PROT_NODATA:
1025 return ATA_PROT_FLAG_ATAPI;
1026 case ATAPI_PROT_PIO:
1027 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO;
1028 case ATAPI_PROT_DMA:
1029 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA;
1030 }
1031 return 0;
1032}
1033
1034static inline int ata_is_atapi(u8 prot)
1035{
1036 return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI;
1037}
1038
1039static inline int ata_is_nodata(u8 prot)
1040{
1041 return !(ata_prot_flags(prot) & ATA_PROT_FLAG_DATA);
1042}
1043
1044static inline int ata_is_pio(u8 prot)
1045{
1046 return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO;
1047}
1048
1049static inline int ata_is_dma(u8 prot)
1050{
1051 return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA;
1052}
1053
1054static inline int ata_is_ncq(u8 prot)
1055{
1056 return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ;
1057}
1058
1059static inline int ata_is_data(u8 prot)
1060{
1061 return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA;
1062}
1063
1064static inline int is_multi_taskfile(struct ata_taskfile *tf)
1065{
1066 return (tf->command == ATA_CMD_READ_MULTI) ||
1067 (tf->command == ATA_CMD_WRITE_MULTI) ||
1068 (tf->command == ATA_CMD_READ_MULTI_EXT) ||
1069 (tf->command == ATA_CMD_WRITE_MULTI_EXT) ||
1070 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT);
1071}
1072
957static inline const unsigned long * 1073static inline const unsigned long *
958sata_ehc_deb_timing(struct ata_eh_context *ehc) 1074sata_ehc_deb_timing(struct ata_eh_context *ehc)
959{ 1075{
@@ -1137,8 +1253,6 @@ int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm);
1137int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm); 1253int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm);
1138unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev, 1254unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev,
1139 const struct ata_acpi_gtm *gtm); 1255 const struct ata_acpi_gtm *gtm);
1140acpi_handle ata_ap_acpi_handle(struct ata_port *ap);
1141acpi_handle ata_dev_acpi_handle(struct ata_device *dev);
1142int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm); 1256int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm);
1143#else 1257#else
1144static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) 1258static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
@@ -1492,6 +1606,13 @@ static inline int ata_ncq_enabled(struct ata_device *dev)
1492 ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; 1606 ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ;
1493} 1607}
1494 1608
1609static inline bool ata_fpdma_dsm_supported(struct ata_device *dev)
1610{
1611 return (dev->flags & ATA_DFLAG_NCQ_SEND_RECV) &&
1612 (dev->ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET] &
1613 ATA_LOG_NCQ_SEND_RECV_DSM_TRIM);
1614}
1615
1495static inline void ata_qc_set_polling(struct ata_queued_cmd *qc) 1616static inline void ata_qc_set_polling(struct ata_queued_cmd *qc)
1496{ 1617{
1497 qc->tf.ctl |= ATA_NIEN; 1618 qc->tf.ctl |= ATA_NIEN;
diff --git a/include/linux/list.h b/include/linux/list.h
index b83e5657365a..f4d8a2f12a33 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -381,17 +381,6 @@ static inline void list_splice_tail_init(struct list_head *list,
381 for (pos = (head)->next; pos != (head); pos = pos->next) 381 for (pos = (head)->next; pos != (head); pos = pos->next)
382 382
383/** 383/**
384 * __list_for_each - iterate over a list
385 * @pos: the &struct list_head to use as a loop cursor.
386 * @head: the head for your list.
387 *
388 * This variant doesn't differ from list_for_each() any more.
389 * We don't do prefetching in either case.
390 */
391#define __list_for_each(pos, head) \
392 for (pos = (head)->next; pos != (head); pos = pos->next)
393
394/**
395 * list_for_each_prev - iterate over a list backwards 384 * list_for_each_prev - iterate over a list backwards
396 * @pos: the &struct list_head to use as a loop cursor. 385 * @pos: the &struct list_head to use as a loop cursor.
397 * @head: the head for your list. 386 * @head: the head for your list.
diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h
new file mode 100644
index 000000000000..3ce541753c88
--- /dev/null
+++ b/include/linux/list_lru.h
@@ -0,0 +1,131 @@
1/*
2 * Copyright (c) 2013 Red Hat, Inc. and Parallels Inc. All rights reserved.
3 * Authors: David Chinner and Glauber Costa
4 *
5 * Generic LRU infrastructure
6 */
7#ifndef _LRU_LIST_H
8#define _LRU_LIST_H
9
10#include <linux/list.h>
11#include <linux/nodemask.h>
12
13/* list_lru_walk_cb has to always return one of those */
14enum lru_status {
15 LRU_REMOVED, /* item removed from list */
16 LRU_ROTATE, /* item referenced, give another pass */
17 LRU_SKIP, /* item cannot be locked, skip */
18 LRU_RETRY, /* item not freeable. May drop the lock
19 internally, but has to return locked. */
20};
21
22struct list_lru_node {
23 spinlock_t lock;
24 struct list_head list;
25 /* kept as signed so we can catch imbalance bugs */
26 long nr_items;
27} ____cacheline_aligned_in_smp;
28
29struct list_lru {
30 struct list_lru_node *node;
31 nodemask_t active_nodes;
32};
33
34void list_lru_destroy(struct list_lru *lru);
35int list_lru_init(struct list_lru *lru);
36
37/**
38 * list_lru_add: add an element to the lru list's tail
39 * @list_lru: the lru pointer
40 * @item: the item to be added.
41 *
42 * If the element is already part of a list, this function returns doing
43 * nothing. Therefore the caller does not need to keep state about whether or
44 * not the element already belongs in the list and is allowed to lazy update
45 * it. Note however that this is valid for *a* list, not *this* list. If
46 * the caller organize itself in a way that elements can be in more than
47 * one type of list, it is up to the caller to fully remove the item from
48 * the previous list (with list_lru_del() for instance) before moving it
49 * to @list_lru
50 *
51 * Return value: true if the list was updated, false otherwise
52 */
53bool list_lru_add(struct list_lru *lru, struct list_head *item);
54
55/**
56 * list_lru_del: delete an element to the lru list
57 * @list_lru: the lru pointer
58 * @item: the item to be deleted.
59 *
60 * This function works analogously as list_lru_add in terms of list
61 * manipulation. The comments about an element already pertaining to
62 * a list are also valid for list_lru_del.
63 *
64 * Return value: true if the list was updated, false otherwise
65 */
66bool list_lru_del(struct list_lru *lru, struct list_head *item);
67
68/**
69 * list_lru_count_node: return the number of objects currently held by @lru
70 * @lru: the lru pointer.
71 * @nid: the node id to count from.
72 *
73 * Always return a non-negative number, 0 for empty lists. There is no
74 * guarantee that the list is not updated while the count is being computed.
75 * Callers that want such a guarantee need to provide an outer lock.
76 */
77unsigned long list_lru_count_node(struct list_lru *lru, int nid);
78static inline unsigned long list_lru_count(struct list_lru *lru)
79{
80 long count = 0;
81 int nid;
82
83 for_each_node_mask(nid, lru->active_nodes)
84 count += list_lru_count_node(lru, nid);
85
86 return count;
87}
88
89typedef enum lru_status
90(*list_lru_walk_cb)(struct list_head *item, spinlock_t *lock, void *cb_arg);
91/**
92 * list_lru_walk_node: walk a list_lru, isolating and disposing freeable items.
93 * @lru: the lru pointer.
94 * @nid: the node id to scan from.
95 * @isolate: callback function that is resposible for deciding what to do with
96 * the item currently being scanned
97 * @cb_arg: opaque type that will be passed to @isolate
98 * @nr_to_walk: how many items to scan.
99 *
100 * This function will scan all elements in a particular list_lru, calling the
101 * @isolate callback for each of those items, along with the current list
102 * spinlock and a caller-provided opaque. The @isolate callback can choose to
103 * drop the lock internally, but *must* return with the lock held. The callback
104 * will return an enum lru_status telling the list_lru infrastructure what to
105 * do with the object being scanned.
106 *
107 * Please note that nr_to_walk does not mean how many objects will be freed,
108 * just how many objects will be scanned.
109 *
110 * Return value: the number of objects effectively removed from the LRU.
111 */
112unsigned long list_lru_walk_node(struct list_lru *lru, int nid,
113 list_lru_walk_cb isolate, void *cb_arg,
114 unsigned long *nr_to_walk);
115
116static inline unsigned long
117list_lru_walk(struct list_lru *lru, list_lru_walk_cb isolate,
118 void *cb_arg, unsigned long nr_to_walk)
119{
120 long isolated = 0;
121 int nid;
122
123 for_each_node_mask(nid, lru->active_nodes) {
124 isolated += list_lru_walk_node(lru, nid, isolate,
125 cb_arg, &nr_to_walk);
126 if (nr_to_walk <= 0)
127 break;
128 }
129 return isolated;
130}
131#endif /* _LRU_LIST_H */
diff --git a/include/linux/llist.h b/include/linux/llist.h
index a5199f6d0e82..8828a78dec9a 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -125,6 +125,29 @@ static inline void init_llist_head(struct llist_head *list)
125 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member)) 125 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member))
126 126
127/** 127/**
128 * llist_for_each_entry_safe - iterate over some deleted entries of lock-less list of given type
129 * safe against removal of list entry
130 * @pos: the type * to use as a loop cursor.
131 * @n: another type * to use as temporary storage
132 * @node: the first entry of deleted list entries.
133 * @member: the name of the llist_node with the struct.
134 *
135 * In general, some entries of the lock-less list can be traversed
136 * safely only after being removed from list, so start with an entry
137 * instead of list head.
138 *
139 * If being used on entries deleted from lock-less list directly, the
140 * traverse order is from the newest to the oldest added entry. If
141 * you want to traverse from the oldest to the newest, you must
142 * reverse the order by yourself before traversing.
143 */
144#define llist_for_each_entry_safe(pos, n, node, member) \
145 for (pos = llist_entry((node), typeof(*pos), member); \
146 &pos->member != NULL && \
147 (n = llist_entry(pos->member.next, typeof(*n), member), true); \
148 pos = n)
149
150/**
128 * llist_empty - tests whether a lock-less list is empty 151 * llist_empty - tests whether a lock-less list is empty
129 * @head: the list to test 152 * @head: the list to test
130 * 153 *
@@ -142,6 +165,9 @@ static inline struct llist_node *llist_next(struct llist_node *node)
142 return node->next; 165 return node->next;
143} 166}
144 167
168extern bool llist_add_batch(struct llist_node *new_first,
169 struct llist_node *new_last,
170 struct llist_head *head);
145/** 171/**
146 * llist_add - add a new entry 172 * llist_add - add a new entry
147 * @new: new entry to be added 173 * @new: new entry to be added
@@ -151,18 +177,7 @@ static inline struct llist_node *llist_next(struct llist_node *node)
151 */ 177 */
152static inline bool llist_add(struct llist_node *new, struct llist_head *head) 178static inline bool llist_add(struct llist_node *new, struct llist_head *head)
153{ 179{
154 struct llist_node *entry, *old_entry; 180 return llist_add_batch(new, new, head);
155
156 entry = head->first;
157 for (;;) {
158 old_entry = entry;
159 new->next = entry;
160 entry = cmpxchg(&head->first, old_entry, new);
161 if (entry == old_entry)
162 break;
163 }
164
165 return old_entry == NULL;
166} 181}
167 182
168/** 183/**
@@ -178,9 +193,6 @@ static inline struct llist_node *llist_del_all(struct llist_head *head)
178 return xchg(&head->first, NULL); 193 return xchg(&head->first, NULL);
179} 194}
180 195
181extern bool llist_add_batch(struct llist_node *new_first,
182 struct llist_node *new_last,
183 struct llist_head *head);
184extern struct llist_node *llist_del_first(struct llist_head *head); 196extern struct llist_node *llist_del_first(struct llist_head *head);
185 197
186#endif /* LLIST_H */ 198#endif /* LLIST_H */
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index f1e877b79ed8..cfc2f119779a 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -365,7 +365,7 @@ extern void lockdep_trace_alloc(gfp_t mask);
365 365
366#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion) 366#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
367 367
368#else /* !LOCKDEP */ 368#else /* !CONFIG_LOCKDEP */
369 369
370static inline void lockdep_off(void) 370static inline void lockdep_off(void)
371{ 371{
@@ -479,82 +479,36 @@ static inline void print_irqtrace_events(struct task_struct *curr)
479 * on the per lock-class debug mode: 479 * on the per lock-class debug mode:
480 */ 480 */
481 481
482#ifdef CONFIG_DEBUG_LOCK_ALLOC 482#ifdef CONFIG_PROVE_LOCKING
483# ifdef CONFIG_PROVE_LOCKING 483 #define lock_acquire_exclusive(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i)
484# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) 484 #define lock_acquire_shared(l, s, t, n, i) lock_acquire(l, s, t, 1, 2, n, i)
485# define spin_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i) 485 #define lock_acquire_shared_recursive(l, s, t, n, i) lock_acquire(l, s, t, 2, 2, n, i)
486# else
487# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
488# define spin_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, NULL, i)
489# endif
490# define spin_release(l, n, i) lock_release(l, n, i)
491#else 486#else
492# define spin_acquire(l, s, t, i) do { } while (0) 487 #define lock_acquire_exclusive(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, n, i)
493# define spin_release(l, n, i) do { } while (0) 488 #define lock_acquire_shared(l, s, t, n, i) lock_acquire(l, s, t, 1, 1, n, i)
489 #define lock_acquire_shared_recursive(l, s, t, n, i) lock_acquire(l, s, t, 2, 1, n, i)
494#endif 490#endif
495 491
496#ifdef CONFIG_DEBUG_LOCK_ALLOC 492#define spin_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
497# ifdef CONFIG_PROVE_LOCKING 493#define spin_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i)
498# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) 494#define spin_release(l, n, i) lock_release(l, n, i)
499# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 2, NULL, i)
500# else
501# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
502# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 1, NULL, i)
503# endif
504# define rwlock_release(l, n, i) lock_release(l, n, i)
505#else
506# define rwlock_acquire(l, s, t, i) do { } while (0)
507# define rwlock_acquire_read(l, s, t, i) do { } while (0)
508# define rwlock_release(l, n, i) do { } while (0)
509#endif
510 495
511#ifdef CONFIG_DEBUG_LOCK_ALLOC 496#define rwlock_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
512# ifdef CONFIG_PROVE_LOCKING 497#define rwlock_acquire_read(l, s, t, i) lock_acquire_shared_recursive(l, s, t, NULL, i)
513# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) 498#define rwlock_release(l, n, i) lock_release(l, n, i)
514# define mutex_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i)
515# else
516# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
517# define mutex_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, n, i)
518# endif
519# define mutex_release(l, n, i) lock_release(l, n, i)
520#else
521# define mutex_acquire(l, s, t, i) do { } while (0)
522# define mutex_acquire_nest(l, s, t, n, i) do { } while (0)
523# define mutex_release(l, n, i) do { } while (0)
524#endif
525 499
526#ifdef CONFIG_DEBUG_LOCK_ALLOC 500#define mutex_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
527# ifdef CONFIG_PROVE_LOCKING 501#define mutex_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i)
528# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) 502#define mutex_release(l, n, i) lock_release(l, n, i)
529# define rwsem_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i) 503
530# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, NULL, i) 504#define rwsem_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
531# else 505#define rwsem_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i)
532# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i) 506#define rwsem_acquire_read(l, s, t, i) lock_acquire_shared(l, s, t, NULL, i)
533# define rwsem_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, n, i)
534# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, NULL, i)
535# endif
536# define rwsem_release(l, n, i) lock_release(l, n, i) 507# define rwsem_release(l, n, i) lock_release(l, n, i)
537#else
538# define rwsem_acquire(l, s, t, i) do { } while (0)
539# define rwsem_acquire_nest(l, s, t, n, i) do { } while (0)
540# define rwsem_acquire_read(l, s, t, i) do { } while (0)
541# define rwsem_release(l, n, i) do { } while (0)
542#endif
543 508
544#ifdef CONFIG_DEBUG_LOCK_ALLOC 509#define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_)
545# ifdef CONFIG_PROVE_LOCKING 510#define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_)
546# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_)
547# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 2, NULL, _THIS_IP_)
548# else
549# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_)
550# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 1, NULL, _THIS_IP_)
551# endif
552# define lock_map_release(l) lock_release(l, 1, _THIS_IP_) 511# define lock_map_release(l) lock_release(l, 1, _THIS_IP_)
553#else
554# define lock_map_acquire(l) do { } while (0)
555# define lock_map_acquire_read(l) do { } while (0)
556# define lock_map_release(l) do { } while (0)
557#endif
558 512
559#ifdef CONFIG_PROVE_LOCKING 513#ifdef CONFIG_PROVE_LOCKING
560# define might_lock(lock) \ 514# define might_lock(lock) \
diff --git a/include/linux/lockref.h b/include/linux/lockref.h
new file mode 100644
index 000000000000..f279ed9a9163
--- /dev/null
+++ b/include/linux/lockref.h
@@ -0,0 +1,39 @@
1#ifndef __LINUX_LOCKREF_H
2#define __LINUX_LOCKREF_H
3
4/*
5 * Locked reference counts.
6 *
7 * These are different from just plain atomic refcounts in that they
8 * are atomic with respect to the spinlock that goes with them. In
9 * particular, there can be implementations that don't actually get
10 * the spinlock for the common decrement/increment operations, but they
11 * still have to check that the operation is done semantically as if
12 * the spinlock had been taken (using a cmpxchg operation that covers
13 * both the lock and the count word, or using memory transactions, for
14 * example).
15 */
16
17#include <linux/spinlock.h>
18
19struct lockref {
20 union {
21#ifdef CONFIG_CMPXCHG_LOCKREF
22 aligned_u64 lock_count;
23#endif
24 struct {
25 spinlock_t lock;
26 unsigned int count;
27 };
28 };
29};
30
31extern void lockref_get(struct lockref *);
32extern int lockref_get_not_zero(struct lockref *);
33extern int lockref_get_or_lock(struct lockref *);
34extern int lockref_put_or_lock(struct lockref *);
35
36extern void lockref_mark_dead(struct lockref *);
37extern int lockref_get_not_dead(struct lockref *);
38
39#endif /* __LINUX_LOCKREF_H */
diff --git a/include/linux/loop.h b/include/linux/loop.h
deleted file mode 100644
index 460b60fa7adf..000000000000
--- a/include/linux/loop.h
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * include/linux/loop.h
3 *
4 * Written by Theodore Ts'o, 3/29/93.
5 *
6 * Copyright 1993 by Theodore Ts'o. Redistribution of this file is
7 * permitted under the GNU General Public License.
8 */
9#ifndef _LINUX_LOOP_H
10#define _LINUX_LOOP_H
11
12#include <linux/bio.h>
13#include <linux/blkdev.h>
14#include <linux/spinlock.h>
15#include <linux/mutex.h>
16#include <uapi/linux/loop.h>
17
18/* Possible states of device */
19enum {
20 Lo_unbound,
21 Lo_bound,
22 Lo_rundown,
23};
24
25struct loop_func_table;
26
27struct loop_device {
28 int lo_number;
29 int lo_refcnt;
30 loff_t lo_offset;
31 loff_t lo_sizelimit;
32 int lo_flags;
33 int (*transfer)(struct loop_device *, int cmd,
34 struct page *raw_page, unsigned raw_off,
35 struct page *loop_page, unsigned loop_off,
36 int size, sector_t real_block);
37 char lo_file_name[LO_NAME_SIZE];
38 char lo_crypt_name[LO_NAME_SIZE];
39 char lo_encrypt_key[LO_KEY_SIZE];
40 int lo_encrypt_key_size;
41 struct loop_func_table *lo_encryption;
42 __u32 lo_init[2];
43 kuid_t lo_key_owner; /* Who set the key */
44 int (*ioctl)(struct loop_device *, int cmd,
45 unsigned long arg);
46
47 struct file * lo_backing_file;
48 struct block_device *lo_device;
49 unsigned lo_blocksize;
50 void *key_data;
51
52 gfp_t old_gfp_mask;
53
54 spinlock_t lo_lock;
55 struct bio_list lo_bio_list;
56 unsigned int lo_bio_count;
57 int lo_state;
58 struct mutex lo_ctl_mutex;
59 struct task_struct *lo_thread;
60 wait_queue_head_t lo_event;
61 /* wait queue for incoming requests */
62 wait_queue_head_t lo_req_wait;
63
64 struct request_queue *lo_queue;
65 struct gendisk *lo_disk;
66};
67
68/* Support for loadable transfer modules */
69struct loop_func_table {
70 int number; /* filter type */
71 int (*transfer)(struct loop_device *lo, int cmd,
72 struct page *raw_page, unsigned raw_off,
73 struct page *loop_page, unsigned loop_off,
74 int size, sector_t real_block);
75 int (*init)(struct loop_device *, const struct loop_info64 *);
76 /* release is called from loop_unregister_transfer or clr_fd */
77 int (*release)(struct loop_device *);
78 int (*ioctl)(struct loop_device *, int cmd, unsigned long arg);
79 struct module *owner;
80};
81
82int loop_register_transfer(struct loop_func_table *funcs);
83int loop_unregister_transfer(int number);
84
85#endif
diff --git a/include/linux/lz4.h b/include/linux/lz4.h
new file mode 100644
index 000000000000..4356686b0a39
--- /dev/null
+++ b/include/linux/lz4.h
@@ -0,0 +1,87 @@
1#ifndef __LZ4_H__
2#define __LZ4_H__
3/*
4 * LZ4 Kernel Interface
5 *
6 * Copyright (C) 2013, LG Electronics, Kyungsik Lee <kyungsik.lee@lge.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#define LZ4_MEM_COMPRESS (4096 * sizeof(unsigned char *))
13#define LZ4HC_MEM_COMPRESS (65538 * sizeof(unsigned char *))
14
15/*
16 * lz4_compressbound()
17 * Provides the maximum size that LZ4 may output in a "worst case" scenario
18 * (input data not compressible)
19 */
20static inline size_t lz4_compressbound(size_t isize)
21{
22 return isize + (isize / 255) + 16;
23}
24
25/*
26 * lz4_compress()
27 * src : source address of the original data
28 * src_len : size of the original data
29 * dst : output buffer address of the compressed data
30 * This requires 'dst' of size LZ4_COMPRESSBOUND.
31 * dst_len : is the output size, which is returned after compress done
32 * workmem : address of the working memory.
33 * This requires 'workmem' of size LZ4_MEM_COMPRESS.
34 * return : Success if return 0
35 * Error if return (< 0)
36 * note : Destination buffer and workmem must be already allocated with
37 * the defined size.
38 */
39int lz4_compress(const unsigned char *src, size_t src_len,
40 unsigned char *dst, size_t *dst_len, void *wrkmem);
41
42 /*
43 * lz4hc_compress()
44 * src : source address of the original data
45 * src_len : size of the original data
46 * dst : output buffer address of the compressed data
47 * This requires 'dst' of size LZ4_COMPRESSBOUND.
48 * dst_len : is the output size, which is returned after compress done
49 * workmem : address of the working memory.
50 * This requires 'workmem' of size LZ4HC_MEM_COMPRESS.
51 * return : Success if return 0
52 * Error if return (< 0)
53 * note : Destination buffer and workmem must be already allocated with
54 * the defined size.
55 */
56int lz4hc_compress(const unsigned char *src, size_t src_len,
57 unsigned char *dst, size_t *dst_len, void *wrkmem);
58
59/*
60 * lz4_decompress()
61 * src : source address of the compressed data
62 * src_len : is the input size, whcih is returned after decompress done
63 * dest : output buffer address of the decompressed data
64 * actual_dest_len: is the size of uncompressed data, supposing it's known
65 * return : Success if return 0
66 * Error if return (< 0)
67 * note : Destination buffer must be already allocated.
68 * slightly faster than lz4_decompress_unknownoutputsize()
69 */
70int lz4_decompress(const unsigned char *src, size_t *src_len,
71 unsigned char *dest, size_t actual_dest_len);
72
73/*
74 * lz4_decompress_unknownoutputsize()
75 * src : source address of the compressed data
76 * src_len : is the input size, therefore the compressed size
77 * dest : output buffer address of the decompressed data
78 * dest_len: is the max size of the destination buffer, which is
79 * returned with actual size of decompressed data after
80 * decompress done
81 * return : Success if return 0
82 * Error if return (< 0)
83 * note : Destination buffer must be already allocated.
84 */
85int lz4_decompress_unknownoutputsize(const unsigned char *src, size_t src_len,
86 unsigned char *dest, size_t *dest_len);
87#endif
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index dd3c34ebca9a..8e9a029e093d 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -14,6 +14,8 @@
14#define MARVELL_PHY_ID_88E1149R 0x01410e50 14#define MARVELL_PHY_ID_88E1149R 0x01410e50
15#define MARVELL_PHY_ID_88E1240 0x01410e30 15#define MARVELL_PHY_ID_88E1240 0x01410e30
16#define MARVELL_PHY_ID_88E1318S 0x01410e90 16#define MARVELL_PHY_ID_88E1318S 0x01410e90
17#define MARVELL_PHY_ID_88E1116R 0x01410e40
18#define MARVELL_PHY_ID_88E1510 0x01410dd0
17 19
18/* struct phy_device dev_flags definitions */ 20/* struct phy_device dev_flags definitions */
19#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001 21#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001
diff --git a/include/linux/math64.h b/include/linux/math64.h
index b8ba85544721..69ed5f5e9f6e 100644
--- a/include/linux/math64.h
+++ b/include/linux/math64.h
@@ -6,7 +6,8 @@
6 6
7#if BITS_PER_LONG == 64 7#if BITS_PER_LONG == 64
8 8
9#define div64_long(x,y) div64_s64((x),(y)) 9#define div64_long(x, y) div64_s64((x), (y))
10#define div64_ul(x, y) div64_u64((x), (y))
10 11
11/** 12/**
12 * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder 13 * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder
@@ -30,6 +31,15 @@ static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)
30} 31}
31 32
32/** 33/**
34 * div64_u64_rem - unsigned 64bit divide with 64bit divisor and remainder
35 */
36static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder)
37{
38 *remainder = dividend % divisor;
39 return dividend / divisor;
40}
41
42/**
33 * div64_u64 - unsigned 64bit divide with 64bit divisor 43 * div64_u64 - unsigned 64bit divide with 64bit divisor
34 */ 44 */
35static inline u64 div64_u64(u64 dividend, u64 divisor) 45static inline u64 div64_u64(u64 dividend, u64 divisor)
@@ -47,7 +57,8 @@ static inline s64 div64_s64(s64 dividend, s64 divisor)
47 57
48#elif BITS_PER_LONG == 32 58#elif BITS_PER_LONG == 32
49 59
50#define div64_long(x,y) div_s64((x),(y)) 60#define div64_long(x, y) div_s64((x), (y))
61#define div64_ul(x, y) div_u64((x), (y))
51 62
52#ifndef div_u64_rem 63#ifndef div_u64_rem
53static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) 64static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
@@ -61,6 +72,10 @@ static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
61extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder); 72extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);
62#endif 73#endif
63 74
75#ifndef div64_u64_rem
76extern u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder);
77#endif
78
64#ifndef div64_u64 79#ifndef div64_u64
65extern u64 div64_u64(u64 dividend, u64 divisor); 80extern u64 div64_u64(u64 dividend, u64 divisor);
66#endif 81#endif
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index dba482e31a13..345b8c53b897 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -11,6 +11,8 @@
11#ifndef __LINUX_MBUS_H 11#ifndef __LINUX_MBUS_H
12#define __LINUX_MBUS_H 12#define __LINUX_MBUS_H
13 13
14struct resource;
15
14struct mbus_dram_target_info 16struct mbus_dram_target_info
15{ 17{
16 /* 18 /*
@@ -59,14 +61,18 @@ static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
59} 61}
60#endif 62#endif
61 63
62int mvebu_mbus_add_window_remap_flags(const char *devname, phys_addr_t base, 64void mvebu_mbus_get_pcie_mem_aperture(struct resource *res);
63 size_t size, phys_addr_t remap, 65void mvebu_mbus_get_pcie_io_aperture(struct resource *res);
64 unsigned int flags); 66int mvebu_mbus_add_window_remap_by_id(unsigned int target,
65int mvebu_mbus_add_window(const char *devname, phys_addr_t base, 67 unsigned int attribute,
66 size_t size); 68 phys_addr_t base, size_t size,
69 phys_addr_t remap);
70int mvebu_mbus_add_window_by_id(unsigned int target, unsigned int attribute,
71 phys_addr_t base, size_t size);
67int mvebu_mbus_del_window(phys_addr_t base, size_t size); 72int mvebu_mbus_del_window(phys_addr_t base, size_t size);
68int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base, 73int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base,
69 size_t mbus_size, phys_addr_t sdram_phys_base, 74 size_t mbus_size, phys_addr_t sdram_phys_base,
70 size_t sdram_size); 75 size_t sdram_size);
76int mvebu_mbus_dt_init(void);
71 77
72#endif /* __LINUX_MBUS_H */ 78#endif /* __LINUX_MBUS_H */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index f388203db7e8..31e95acddb4d 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -60,6 +60,8 @@ int memblock_reserve(phys_addr_t base, phys_addr_t size);
60void memblock_trim_memory(phys_addr_t align); 60void memblock_trim_memory(phys_addr_t align);
61 61
62#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 62#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
63int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn,
64 unsigned long *end_pfn);
63void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, 65void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
64 unsigned long *out_end_pfn, int *out_nid); 66 unsigned long *out_end_pfn, int *out_nid);
65 67
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index d6183f06d8c1..ecc82b37c4cc 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -30,9 +30,21 @@ struct page;
30struct mm_struct; 30struct mm_struct;
31struct kmem_cache; 31struct kmem_cache;
32 32
33/* Stats that can be updated by kernel. */ 33/*
34enum mem_cgroup_page_stat_item { 34 * The corresponding mem_cgroup_stat_names is defined in mm/memcontrol.c,
35 MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */ 35 * These two lists should keep in accord with each other.
36 */
37enum mem_cgroup_stat_index {
38 /*
39 * For MEM_CONTAINER_TYPE_ALL, usage = pagecache + rss.
40 */
41 MEM_CGROUP_STAT_CACHE, /* # of pages charged as cache */
42 MEM_CGROUP_STAT_RSS, /* # of pages charged as anon rss */
43 MEM_CGROUP_STAT_RSS_HUGE, /* # of pages charged as anon huge */
44 MEM_CGROUP_STAT_FILE_MAPPED, /* # of pages charged as file rss */
45 MEM_CGROUP_STAT_WRITEBACK, /* # of pages under writeback */
46 MEM_CGROUP_STAT_SWAP, /* # of pages, swapped out */
47 MEM_CGROUP_STAT_NSTATS,
36}; 48};
37 49
38struct mem_cgroup_reclaim_cookie { 50struct mem_cgroup_reclaim_cookie {
@@ -77,14 +89,15 @@ extern void mem_cgroup_uncharge_cache_page(struct page *page);
77 89
78bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg, 90bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg,
79 struct mem_cgroup *memcg); 91 struct mem_cgroup *memcg);
80int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg); 92bool task_in_mem_cgroup(struct task_struct *task,
93 const struct mem_cgroup *memcg);
81 94
82extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); 95extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
83extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); 96extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
84extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm); 97extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm);
85 98
86extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg); 99extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg);
87extern struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont); 100extern struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *css);
88 101
89static inline 102static inline
90bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg) 103bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg)
@@ -124,6 +137,48 @@ extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
124extern void mem_cgroup_replace_page_cache(struct page *oldpage, 137extern void mem_cgroup_replace_page_cache(struct page *oldpage,
125 struct page *newpage); 138 struct page *newpage);
126 139
140/**
141 * mem_cgroup_toggle_oom - toggle the memcg OOM killer for the current task
142 * @new: true to enable, false to disable
143 *
144 * Toggle whether a failed memcg charge should invoke the OOM killer
145 * or just return -ENOMEM. Returns the previous toggle state.
146 *
147 * NOTE: Any path that enables the OOM killer before charging must
148 * call mem_cgroup_oom_synchronize() afterward to finalize the
149 * OOM handling and clean up.
150 */
151static inline bool mem_cgroup_toggle_oom(bool new)
152{
153 bool old;
154
155 old = current->memcg_oom.may_oom;
156 current->memcg_oom.may_oom = new;
157
158 return old;
159}
160
161static inline void mem_cgroup_enable_oom(void)
162{
163 bool old = mem_cgroup_toggle_oom(true);
164
165 WARN_ON(old == true);
166}
167
168static inline void mem_cgroup_disable_oom(void)
169{
170 bool old = mem_cgroup_toggle_oom(false);
171
172 WARN_ON(old == false);
173}
174
175static inline bool task_in_memcg_oom(struct task_struct *p)
176{
177 return p->memcg_oom.in_memcg_oom;
178}
179
180bool mem_cgroup_oom_synchronize(void);
181
127#ifdef CONFIG_MEMCG_SWAP 182#ifdef CONFIG_MEMCG_SWAP
128extern int do_swap_account; 183extern int do_swap_account;
129#endif 184#endif
@@ -164,17 +219,17 @@ static inline void mem_cgroup_end_update_page_stat(struct page *page,
164} 219}
165 220
166void mem_cgroup_update_page_stat(struct page *page, 221void mem_cgroup_update_page_stat(struct page *page,
167 enum mem_cgroup_page_stat_item idx, 222 enum mem_cgroup_stat_index idx,
168 int val); 223 int val);
169 224
170static inline void mem_cgroup_inc_page_stat(struct page *page, 225static inline void mem_cgroup_inc_page_stat(struct page *page,
171 enum mem_cgroup_page_stat_item idx) 226 enum mem_cgroup_stat_index idx)
172{ 227{
173 mem_cgroup_update_page_stat(page, idx, 1); 228 mem_cgroup_update_page_stat(page, idx, 1);
174} 229}
175 230
176static inline void mem_cgroup_dec_page_stat(struct page *page, 231static inline void mem_cgroup_dec_page_stat(struct page *page,
177 enum mem_cgroup_page_stat_item idx) 232 enum mem_cgroup_stat_index idx)
178{ 233{
179 mem_cgroup_update_page_stat(page, idx, -1); 234 mem_cgroup_update_page_stat(page, idx, -1);
180} 235}
@@ -273,10 +328,10 @@ static inline bool mm_match_cgroup(struct mm_struct *mm,
273 return true; 328 return true;
274} 329}
275 330
276static inline int task_in_mem_cgroup(struct task_struct *task, 331static inline bool task_in_mem_cgroup(struct task_struct *task,
277 const struct mem_cgroup *memcg) 332 const struct mem_cgroup *memcg)
278{ 333{
279 return 1; 334 return true;
280} 335}
281 336
282static inline struct cgroup_subsys_state 337static inline struct cgroup_subsys_state
@@ -347,13 +402,36 @@ static inline void mem_cgroup_end_update_page_stat(struct page *page,
347{ 402{
348} 403}
349 404
405static inline bool mem_cgroup_toggle_oom(bool new)
406{
407 return false;
408}
409
410static inline void mem_cgroup_enable_oom(void)
411{
412}
413
414static inline void mem_cgroup_disable_oom(void)
415{
416}
417
418static inline bool task_in_memcg_oom(struct task_struct *p)
419{
420 return false;
421}
422
423static inline bool mem_cgroup_oom_synchronize(void)
424{
425 return false;
426}
427
350static inline void mem_cgroup_inc_page_stat(struct page *page, 428static inline void mem_cgroup_inc_page_stat(struct page *page,
351 enum mem_cgroup_page_stat_item idx) 429 enum mem_cgroup_stat_index idx)
352{ 430{
353} 431}
354 432
355static inline void mem_cgroup_dec_page_stat(struct page *page, 433static inline void mem_cgroup_dec_page_stat(struct page *page,
356 enum mem_cgroup_page_stat_item idx) 434 enum mem_cgroup_stat_index idx)
357{ 435{
358} 436}
359 437
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 85c31a8e2904..9a6bbf76452d 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -25,16 +25,9 @@
25struct memory_block { 25struct memory_block {
26 unsigned long start_section_nr; 26 unsigned long start_section_nr;
27 unsigned long end_section_nr; 27 unsigned long end_section_nr;
28 unsigned long state; 28 unsigned long state; /* serialized by the dev->lock */
29 int section_count; 29 int section_count; /* serialized by mem_sysfs_mutex */
30 30 int online_type; /* for passing data to online routine */
31 /*
32 * This serializes all state change requests. It isn't
33 * held during creation because the control files are
34 * created long after the critical areas during
35 * initialization.
36 */
37 struct mutex state_mutex;
38 int phys_device; /* to which fru does this belong? */ 31 int phys_device; /* to which fru does this belong? */
39 void *hw; /* optional pointer to fw/hw data */ 32 void *hw; /* optional pointer to fw/hw data */
40 int (*phys_callback)(struct memory_block *); 33 int (*phys_callback)(struct memory_block *);
@@ -125,7 +118,6 @@ extern struct memory_block *find_memory_block_hinted(struct mem_section *,
125 struct memory_block *); 118 struct memory_block *);
126extern struct memory_block *find_memory_block(struct mem_section *); 119extern struct memory_block *find_memory_block(struct mem_section *);
127#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) 120#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
128enum mem_add_context { BOOT, HOTPLUG };
129#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ 121#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
130 122
131#ifdef CONFIG_MEMORY_HOTPLUG 123#ifdef CONFIG_MEMORY_HOTPLUG
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 3e622c610925..dd38e62b84d2 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -234,6 +234,8 @@ static inline void unlock_memory_hotplug(void) {}
234 234
235extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); 235extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
236extern void try_offline_node(int nid); 236extern void try_offline_node(int nid);
237extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
238extern void remove_memory(int nid, u64 start, u64 size);
237 239
238#else 240#else
239static inline int is_mem_section_removable(unsigned long pfn, 241static inline int is_mem_section_removable(unsigned long pfn,
@@ -243,15 +245,23 @@ static inline int is_mem_section_removable(unsigned long pfn,
243} 245}
244 246
245static inline void try_offline_node(int nid) {} 247static inline void try_offline_node(int nid) {}
248
249static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
250{
251 return -EINVAL;
252}
253
254static inline void remove_memory(int nid, u64 start, u64 size) {}
246#endif /* CONFIG_MEMORY_HOTREMOVE */ 255#endif /* CONFIG_MEMORY_HOTREMOVE */
247 256
257extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
258 void *arg, int (*func)(struct memory_block *, void *));
248extern int mem_online_node(int nid); 259extern int mem_online_node(int nid);
249extern int add_memory(int nid, u64 start, u64 size); 260extern int add_memory(int nid, u64 start, u64 size);
250extern int arch_add_memory(int nid, u64 start, u64 size); 261extern int arch_add_memory(int nid, u64 start, u64 size);
251extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); 262extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
252extern int offline_memory_block(struct memory_block *mem);
253extern bool is_memblock_offlined(struct memory_block *mem); 263extern bool is_memblock_offlined(struct memory_block *mem);
254extern int remove_memory(int nid, u64 start, u64 size); 264extern void remove_memory(int nid, u64 start, u64 size);
255extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, 265extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
256 int nr_pages); 266 int nr_pages);
257extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms); 267extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 0d7df39a5885..da6716b9e3fe 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -91,7 +91,6 @@ static inline struct mempolicy *mpol_dup(struct mempolicy *pol)
91} 91}
92 92
93#define vma_policy(vma) ((vma)->vm_policy) 93#define vma_policy(vma) ((vma)->vm_policy)
94#define vma_set_policy(vma, pol) ((vma)->vm_policy = (pol))
95 94
96static inline void mpol_get(struct mempolicy *pol) 95static inline void mpol_get(struct mempolicy *pol)
97{ 96{
@@ -126,6 +125,7 @@ struct shared_policy {
126 spinlock_t lock; 125 spinlock_t lock;
127}; 126};
128 127
128int vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst);
129void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol); 129void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol);
130int mpol_set_shared_policy(struct shared_policy *info, 130int mpol_set_shared_policy(struct shared_policy *info,
131 struct vm_area_struct *vma, 131 struct vm_area_struct *vma,
@@ -173,7 +173,7 @@ extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);
173/* Check if a vma is migratable */ 173/* Check if a vma is migratable */
174static inline int vma_migratable(struct vm_area_struct *vma) 174static inline int vma_migratable(struct vm_area_struct *vma)
175{ 175{
176 if (vma->vm_flags & (VM_IO | VM_HUGETLB | VM_PFNMAP)) 176 if (vma->vm_flags & (VM_IO | VM_PFNMAP))
177 return 0; 177 return 0;
178 /* 178 /*
179 * Migration allocates pages in the highest zone. If we cannot 179 * Migration allocates pages in the highest zone. If we cannot
@@ -240,7 +240,12 @@ mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx)
240} 240}
241 241
242#define vma_policy(vma) NULL 242#define vma_policy(vma) NULL
243#define vma_set_policy(vma, pol) do {} while(0) 243
244static inline int
245vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst)
246{
247 return 0;
248}
244 249
245static inline void numa_policy_init(void) 250static inline void numa_policy_init(void)
246{ 251{
diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h
index e94537befabd..97cb283cc8e1 100644
--- a/include/linux/mfd/88pm80x.h
+++ b/include/linux/mfd/88pm80x.h
@@ -17,7 +17,6 @@
17#include <linux/regmap.h> 17#include <linux/regmap.h>
18#include <linux/atomic.h> 18#include <linux/atomic.h>
19 19
20#define PM80X_VERSION_MASK (0xFF) /* 80X chip ID mask */
21enum { 20enum {
22 CHIP_INVALID = 0, 21 CHIP_INVALID = 0,
23 CHIP_PM800, 22 CHIP_PM800,
@@ -299,8 +298,7 @@ struct pm80x_chip {
299 struct regmap *regmap; 298 struct regmap *regmap;
300 struct regmap_irq_chip *regmap_irq_chip; 299 struct regmap_irq_chip *regmap_irq_chip;
301 struct regmap_irq_chip_data *irq_data; 300 struct regmap_irq_chip_data *irq_data;
302 unsigned char version; 301 int type;
303 int id;
304 int irq; 302 int irq;
305 int irq_mode; 303 int irq_mode;
306 unsigned long wu_flag; 304 unsigned long wu_flag;
@@ -309,8 +307,14 @@ struct pm80x_chip {
309 307
310struct pm80x_platform_data { 308struct pm80x_platform_data {
311 struct pm80x_rtc_pdata *rtc; 309 struct pm80x_rtc_pdata *rtc;
312 unsigned short power_page_addr; /* power page I2C address */ 310 /*
313 unsigned short gpadc_page_addr; /* gpadc page I2C address */ 311 * For the regulator not defined, set regulators[not_defined] to be
312 * NULL. num_regulators are the number of regulators supposed to be
313 * initialized. If all regulators are not defined, set num_regulators
314 * to be 0.
315 */
316 struct regulator_init_data *regulators[PM800_ID_RG_MAX];
317 unsigned int num_regulators;
314 int irq_mode; /* Clear interrupt by read/write(0/1) */ 318 int irq_mode; /* Clear interrupt by read/write(0/1) */
315 int batt_det; /* enable/disable */ 319 int batt_det; /* enable/disable */
316 int (*plat_config)(struct pm80x_chip *chip, 320 int (*plat_config)(struct pm80x_chip *chip,
@@ -363,7 +367,6 @@ static inline int pm80x_dev_resume(struct device *dev)
363} 367}
364#endif 368#endif
365 369
366extern int pm80x_init(struct i2c_client *client, 370extern int pm80x_init(struct i2c_client *client);
367 const struct i2c_device_id *id);
368extern int pm80x_deinit(void); 371extern int pm80x_deinit(void);
369#endif /* __LINUX_MFD_88PM80X_H */ 372#endif /* __LINUX_MFD_88PM80X_H */
diff --git a/include/linux/mfd/abx500/ab8500-sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h
index 990bc93f46e1..adba89d9c660 100644
--- a/include/linux/mfd/abx500/ab8500-sysctrl.h
+++ b/include/linux/mfd/abx500/ab8500-sysctrl.h
@@ -278,8 +278,8 @@ struct ab8500_sysctrl_platform_data {
278 278
279#define AB9540_SYSCLK12CONFCTRL_PLL26TO38ENA BIT(0) 279#define AB9540_SYSCLK12CONFCTRL_PLL26TO38ENA BIT(0)
280#define AB9540_SYSCLK12CONFCTRL_SYSCLK12USBMUXSEL BIT(1) 280#define AB9540_SYSCLK12CONFCTRL_SYSCLK12USBMUXSEL BIT(1)
281#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL_MASK 0x0C 281#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL0 BIT(2)
282#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL_SHIFT 2 282#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL1 BIT(3)
283#define AB9540_SYSCLK12CONFCTRL_SYSCLK12BUFMUX BIT(4) 283#define AB9540_SYSCLK12CONFCTRL_SYSCLK12BUFMUX BIT(4)
284#define AB9540_SYSCLK12CONFCTRL_SYSCLK12PLLMUX BIT(5) 284#define AB9540_SYSCLK12CONFCTRL_SYSCLK12PLLMUX BIT(5)
285#define AB9540_SYSCLK12CONFCTRL_SYSCLK2MUXVALID BIT(6) 285#define AB9540_SYSCLK12CONFCTRL_SYSCLK2MUXVALID BIT(6)
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 0390d5943ed6..f4acd898dac9 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -291,6 +291,8 @@ enum ab8500_version {
291#define AB8540_INT_FSYNC2R 213 291#define AB8540_INT_FSYNC2R 213
292#define AB8540_INT_BITCLK2F 214 292#define AB8540_INT_BITCLK2F 214
293#define AB8540_INT_BITCLK2R 215 293#define AB8540_INT_BITCLK2R 215
294/* ab8540_irq_regoffset[27] -> IT[Source|Latch|Mask]33 */
295#define AB8540_INT_RTC_1S 216
294 296
295/* 297/*
296 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the 298 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index cc281368dc55..5cf8b91ce996 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -23,6 +23,7 @@
23enum arizona_type { 23enum arizona_type {
24 WM5102 = 1, 24 WM5102 = 1,
25 WM5110 = 2, 25 WM5110 = 2,
26 WM8997 = 3,
26}; 27};
27 28
28#define ARIZONA_IRQ_GP1 0 29#define ARIZONA_IRQ_GP1 0
@@ -95,6 +96,8 @@ struct arizona {
95 96
96 struct arizona_pdata pdata; 97 struct arizona_pdata pdata;
97 98
99 unsigned int external_dcvdd:1;
100
98 int irq; 101 int irq;
99 struct irq_domain *virq; 102 struct irq_domain *virq;
100 struct regmap_irq_chip_data *aod_irq_chip; 103 struct regmap_irq_chip_data *aod_irq_chip;
@@ -119,5 +122,6 @@ int arizona_set_irq_wake(struct arizona *arizona, int irq, int on);
119 122
120int wm5102_patch(struct arizona *arizona); 123int wm5102_patch(struct arizona *arizona);
121int wm5110_patch(struct arizona *arizona); 124int wm5110_patch(struct arizona *arizona);
125int wm8997_patch(struct arizona *arizona);
122 126
123#endif 127#endif
diff --git a/include/linux/mfd/arizona/gpio.h b/include/linux/mfd/arizona/gpio.h
new file mode 100644
index 000000000000..d2146bb74f89
--- /dev/null
+++ b/include/linux/mfd/arizona/gpio.h
@@ -0,0 +1,96 @@
1/*
2 * GPIO configuration for Arizona devices
3 *
4 * Copyright 2013 Wolfson Microelectronics. PLC.
5 *
6 * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef _ARIZONA_GPIO_H
14#define _ARIZONA_GPIO_H
15
16#define ARIZONA_GP_FN_TXLRCLK 0x00
17#define ARIZONA_GP_FN_GPIO 0x01
18#define ARIZONA_GP_FN_IRQ1 0x02
19#define ARIZONA_GP_FN_IRQ2 0x03
20#define ARIZONA_GP_FN_OPCLK 0x04
21#define ARIZONA_GP_FN_FLL1_OUT 0x05
22#define ARIZONA_GP_FN_FLL2_OUT 0x06
23#define ARIZONA_GP_FN_PWM1 0x08
24#define ARIZONA_GP_FN_PWM2 0x09
25#define ARIZONA_GP_FN_SYSCLK_UNDERCLOCKED 0x0A
26#define ARIZONA_GP_FN_ASYNCCLK_UNDERCLOCKED 0x0B
27#define ARIZONA_GP_FN_FLL1_LOCK 0x0C
28#define ARIZONA_GP_FN_FLL2_LOCK 0x0D
29#define ARIZONA_GP_FN_FLL1_CLOCK_OK 0x0F
30#define ARIZONA_GP_FN_FLL2_CLOCK_OK 0x10
31#define ARIZONA_GP_FN_HEADPHONE_DET 0x12
32#define ARIZONA_GP_FN_MIC_DET 0x13
33#define ARIZONA_GP_FN_WSEQ_STATUS 0x15
34#define ARIZONA_GP_FN_CIF_ADDRESS_ERROR 0x16
35#define ARIZONA_GP_FN_ASRC1_LOCK 0x1A
36#define ARIZONA_GP_FN_ASRC2_LOCK 0x1B
37#define ARIZONA_GP_FN_ASRC_CONFIG_ERROR 0x1C
38#define ARIZONA_GP_FN_DRC1_SIGNAL_DETECT 0x1D
39#define ARIZONA_GP_FN_DRC1_ANTICLIP 0x1E
40#define ARIZONA_GP_FN_DRC1_DECAY 0x1F
41#define ARIZONA_GP_FN_DRC1_NOISE 0x20
42#define ARIZONA_GP_FN_DRC1_QUICK_RELEASE 0x21
43#define ARIZONA_GP_FN_DRC2_SIGNAL_DETECT 0x22
44#define ARIZONA_GP_FN_DRC2_ANTICLIP 0x23
45#define ARIZONA_GP_FN_DRC2_DECAY 0x24
46#define ARIZONA_GP_FN_DRC2_NOISE 0x25
47#define ARIZONA_GP_FN_DRC2_QUICK_RELEASE 0x26
48#define ARIZONA_GP_FN_MIXER_DROPPED_SAMPLE 0x27
49#define ARIZONA_GP_FN_AIF1_CONFIG_ERROR 0x28
50#define ARIZONA_GP_FN_AIF2_CONFIG_ERROR 0x29
51#define ARIZONA_GP_FN_AIF3_CONFIG_ERROR 0x2A
52#define ARIZONA_GP_FN_SPK_TEMP_SHUTDOWN 0x2B
53#define ARIZONA_GP_FN_SPK_TEMP_WARNING 0x2C
54#define ARIZONA_GP_FN_UNDERCLOCKED 0x2D
55#define ARIZONA_GP_FN_OVERCLOCKED 0x2E
56#define ARIZONA_GP_FN_DSP_IRQ1 0x35
57#define ARIZONA_GP_FN_DSP_IRQ2 0x36
58#define ARIZONA_GP_FN_ASYNC_OPCLK 0x3D
59#define ARIZONA_GP_FN_BOOT_DONE 0x44
60#define ARIZONA_GP_FN_DSP1_RAM_READY 0x45
61#define ARIZONA_GP_FN_SYSCLK_ENA_STATUS 0x4B
62#define ARIZONA_GP_FN_ASYNCCLK_ENA_STATUS 0x4C
63
64#define ARIZONA_GPN_DIR 0x8000 /* GPN_DIR */
65#define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */
66#define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */
67#define ARIZONA_GPN_DIR_WIDTH 1 /* GPN_DIR */
68#define ARIZONA_GPN_PU 0x4000 /* GPN_PU */
69#define ARIZONA_GPN_PU_MASK 0x4000 /* GPN_PU */
70#define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */
71#define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */
72#define ARIZONA_GPN_PD 0x2000 /* GPN_PD */
73#define ARIZONA_GPN_PD_MASK 0x2000 /* GPN_PD */
74#define ARIZONA_GPN_PD_SHIFT 13 /* GPN_PD */
75#define ARIZONA_GPN_PD_WIDTH 1 /* GPN_PD */
76#define ARIZONA_GPN_LVL 0x0800 /* GPN_LVL */
77#define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */
78#define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */
79#define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */
80#define ARIZONA_GPN_POL 0x0400 /* GPN_POL */
81#define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */
82#define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */
83#define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */
84#define ARIZONA_GPN_OP_CFG 0x0200 /* GPN_OP_CFG */
85#define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */
86#define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */
87#define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */
88#define ARIZONA_GPN_DB 0x0100 /* GPN_DB */
89#define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */
90#define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */
91#define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */
92#define ARIZONA_GPN_FN_MASK 0x007F /* GPN_DB */
93#define ARIZONA_GPN_FN_SHIFT 0 /* GPN_DB */
94#define ARIZONA_GPN_FN_WIDTH 7 /* GPN_DB */
95
96#endif
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 80dead1f7100..12a5c135c746 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -77,7 +77,7 @@ struct arizona_micbias {
77 int mV; /** Regulated voltage */ 77 int mV; /** Regulated voltage */
78 unsigned int ext_cap:1; /** External capacitor fitted */ 78 unsigned int ext_cap:1; /** External capacitor fitted */
79 unsigned int discharge:1; /** Actively discharge */ 79 unsigned int discharge:1; /** Actively discharge */
80 unsigned int fast_start:1; /** Enable aggressive startup ramp rate */ 80 unsigned int soft_start:1; /** Disable aggressive startup ramp rate */
81 unsigned int bypass:1; /** Use bypass mode */ 81 unsigned int bypass:1; /** Use bypass mode */
82}; 82};
83 83
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 715b6ba3d52a..4706d3d46e56 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -215,6 +215,9 @@
215#define ARIZONA_DAC_DIGITAL_VOLUME_6R 0x43D 215#define ARIZONA_DAC_DIGITAL_VOLUME_6R 0x43D
216#define ARIZONA_DAC_VOLUME_LIMIT_6R 0x43E 216#define ARIZONA_DAC_VOLUME_LIMIT_6R 0x43E
217#define ARIZONA_NOISE_GATE_SELECT_6R 0x43F 217#define ARIZONA_NOISE_GATE_SELECT_6R 0x43F
218#define ARIZONA_DRE_ENABLE 0x440
219#define ARIZONA_DRE_CONTROL_2 0x442
220#define ARIZONA_DRE_CONTROL_3 0x443
218#define ARIZONA_DAC_AEC_CONTROL_1 0x450 221#define ARIZONA_DAC_AEC_CONTROL_1 0x450
219#define ARIZONA_NOISE_GATE_CONTROL 0x458 222#define ARIZONA_NOISE_GATE_CONTROL 0x458
220#define ARIZONA_PDM_SPK1_CTRL_1 0x490 223#define ARIZONA_PDM_SPK1_CTRL_1 0x490
@@ -1002,6 +1005,7 @@
1002#define ARIZONA_DSP2_CLOCKING_1 0x1201 1005#define ARIZONA_DSP2_CLOCKING_1 0x1201
1003#define ARIZONA_DSP2_STATUS_1 0x1204 1006#define ARIZONA_DSP2_STATUS_1 0x1204
1004#define ARIZONA_DSP2_STATUS_2 0x1205 1007#define ARIZONA_DSP2_STATUS_2 0x1205
1008#define ARIZONA_DSP2_STATUS_3 0x1206
1005#define ARIZONA_DSP2_SCRATCH_0 0x1240 1009#define ARIZONA_DSP2_SCRATCH_0 0x1240
1006#define ARIZONA_DSP2_SCRATCH_1 0x1241 1010#define ARIZONA_DSP2_SCRATCH_1 0x1241
1007#define ARIZONA_DSP2_SCRATCH_2 0x1242 1011#define ARIZONA_DSP2_SCRATCH_2 0x1242
@@ -1010,6 +1014,7 @@
1010#define ARIZONA_DSP3_CLOCKING_1 0x1301 1014#define ARIZONA_DSP3_CLOCKING_1 0x1301
1011#define ARIZONA_DSP3_STATUS_1 0x1304 1015#define ARIZONA_DSP3_STATUS_1 0x1304
1012#define ARIZONA_DSP3_STATUS_2 0x1305 1016#define ARIZONA_DSP3_STATUS_2 0x1305
1017#define ARIZONA_DSP3_STATUS_3 0x1306
1013#define ARIZONA_DSP3_SCRATCH_0 0x1340 1018#define ARIZONA_DSP3_SCRATCH_0 0x1340
1014#define ARIZONA_DSP3_SCRATCH_1 0x1341 1019#define ARIZONA_DSP3_SCRATCH_1 0x1341
1015#define ARIZONA_DSP3_SCRATCH_2 0x1342 1020#define ARIZONA_DSP3_SCRATCH_2 0x1342
@@ -1018,6 +1023,7 @@
1018#define ARIZONA_DSP4_CLOCKING_1 0x1401 1023#define ARIZONA_DSP4_CLOCKING_1 0x1401
1019#define ARIZONA_DSP4_STATUS_1 0x1404 1024#define ARIZONA_DSP4_STATUS_1 0x1404
1020#define ARIZONA_DSP4_STATUS_2 0x1405 1025#define ARIZONA_DSP4_STATUS_2 0x1405
1026#define ARIZONA_DSP4_STATUS_3 0x1406
1021#define ARIZONA_DSP4_SCRATCH_0 0x1440 1027#define ARIZONA_DSP4_SCRATCH_0 0x1440
1022#define ARIZONA_DSP4_SCRATCH_1 0x1441 1028#define ARIZONA_DSP4_SCRATCH_1 0x1441
1023#define ARIZONA_DSP4_SCRATCH_2 0x1442 1029#define ARIZONA_DSP4_SCRATCH_2 0x1442
@@ -3130,6 +3136,47 @@
3130#define ARIZONA_OUT6R_NGATE_SRC_WIDTH 12 /* OUT6R_NGATE_SRC - [11:0] */ 3136#define ARIZONA_OUT6R_NGATE_SRC_WIDTH 12 /* OUT6R_NGATE_SRC - [11:0] */
3131 3137
3132/* 3138/*
3139 * R1088 (0x440) - DRE Enable
3140 */
3141#define ARIZONA_DRE3L_ENA 0x0010 /* DRE3L_ENA */
3142#define ARIZONA_DRE3L_ENA_MASK 0x0010 /* DRE3L_ENA */
3143#define ARIZONA_DRE3L_ENA_SHIFT 4 /* DRE3L_ENA */
3144#define ARIZONA_DRE3L_ENA_WIDTH 1 /* DRE3L_ENA */
3145#define ARIZONA_DRE2R_ENA 0x0008 /* DRE2R_ENA */
3146#define ARIZONA_DRE2R_ENA_MASK 0x0008 /* DRE2R_ENA */
3147#define ARIZONA_DRE2R_ENA_SHIFT 3 /* DRE2R_ENA */
3148#define ARIZONA_DRE2R_ENA_WIDTH 1 /* DRE2R_ENA */
3149#define ARIZONA_DRE2L_ENA 0x0004 /* DRE2L_ENA */
3150#define ARIZONA_DRE2L_ENA_MASK 0x0004 /* DRE2L_ENA */
3151#define ARIZONA_DRE2L_ENA_SHIFT 2 /* DRE2L_ENA */
3152#define ARIZONA_DRE2L_ENA_WIDTH 1 /* DRE2L_ENA */
3153#define ARIZONA_DRE1R_ENA 0x0002 /* DRE1R_ENA */
3154#define ARIZONA_DRE1R_ENA_MASK 0x0002 /* DRE1R_ENA */
3155#define ARIZONA_DRE1R_ENA_SHIFT 1 /* DRE1R_ENA */
3156#define ARIZONA_DRE1R_ENA_WIDTH 1 /* DRE1R_ENA */
3157#define ARIZONA_DRE1L_ENA 0x0001 /* DRE1L_ENA */
3158#define ARIZONA_DRE1L_ENA_MASK 0x0001 /* DRE1L_ENA */
3159#define ARIZONA_DRE1L_ENA_SHIFT 0 /* DRE1L_ENA */
3160#define ARIZONA_DRE1L_ENA_WIDTH 1 /* DRE1L_ENA */
3161
3162/*
3163 * R1090 (0x442) - DRE Control 2
3164 */
3165#define ARIZONA_DRE_T_LOW_MASK 0x3F00 /* DRE_T_LOW - [13:8] */
3166#define ARIZONA_DRE_T_LOW_SHIFT 8 /* DRE_T_LOW - [13:8] */
3167#define ARIZONA_DRE_T_LOW_WIDTH 6 /* DRE_T_LOW - [13:8] */
3168
3169/*
3170 * R1091 (0x443) - DRE Control 3
3171 */
3172#define ARIZONA_DRE_GAIN_SHIFT_MASK 0xC000 /* DRE_GAIN_SHIFT - [15:14] */
3173#define ARIZONA_DRE_GAIN_SHIFT_SHIFT 14 /* DRE_GAIN_SHIFT - [15:14] */
3174#define ARIZONA_DRE_GAIN_SHIFT_WIDTH 2 /* DRE_GAIN_SHIFT - [15:14] */
3175#define ARIZONA_DRE_LOW_LEVEL_ABS_MASK 0x000F /* LOW_LEVEL_ABS - [3:0] */
3176#define ARIZONA_DRE_LOW_LEVEL_ABS_SHIFT 0 /* LOW_LEVEL_ABS - [3:0] */
3177#define ARIZONA_DRE_LOW_LEVEL_ABS_WIDTH 4 /* LOW_LEVEL_ABS - [3:0] */
3178
3179/*
3133 * R1104 (0x450) - DAC AEC Control 1 3180 * R1104 (0x450) - DAC AEC Control 1
3134 */ 3181 */
3135#define ARIZONA_AEC_LOOPBACK_SRC_MASK 0x003C /* AEC_LOOPBACK_SRC - [5:2] */ 3182#define ARIZONA_AEC_LOOPBACK_SRC_MASK 0x003C /* AEC_LOOPBACK_SRC - [5:2] */
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
new file mode 100644
index 000000000000..2d2a0af675fd
--- /dev/null
+++ b/include/linux/mfd/da9063/core.h
@@ -0,0 +1,93 @@
1/*
2 * Definitions for DA9063 MFD driver
3 *
4 * Copyright 2012 Dialog Semiconductor Ltd.
5 *
6 * Author: Michal Hajduk <michal.hajduk@diasemi.com>
7 * Krystian Garbaciak <krystian.garbaciak@diasemi.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15
16#ifndef __MFD_DA9063_CORE_H__
17#define __MFD_DA9063_CORE_H__
18
19#include <linux/interrupt.h>
20#include <linux/mfd/da9063/registers.h>
21
22/* DA9063 modules */
23#define DA9063_DRVNAME_CORE "da9063-core"
24#define DA9063_DRVNAME_REGULATORS "da9063-regulators"
25#define DA9063_DRVNAME_LEDS "da9063-leds"
26#define DA9063_DRVNAME_WATCHDOG "da9063-watchdog"
27#define DA9063_DRVNAME_HWMON "da9063-hwmon"
28#define DA9063_DRVNAME_ONKEY "da9063-onkey"
29#define DA9063_DRVNAME_RTC "da9063-rtc"
30#define DA9063_DRVNAME_VIBRATION "da9063-vibration"
31
32enum da9063_models {
33 PMIC_DA9063 = 0x61,
34};
35
36/* Interrupts */
37enum da9063_irqs {
38 DA9063_IRQ_ONKEY = 0,
39 DA9063_IRQ_ALARM,
40 DA9063_IRQ_TICK,
41 DA9063_IRQ_ADC_RDY,
42 DA9063_IRQ_SEQ_RDY,
43 DA9063_IRQ_WAKE,
44 DA9063_IRQ_TEMP,
45 DA9063_IRQ_COMP_1V2,
46 DA9063_IRQ_LDO_LIM,
47 DA9063_IRQ_REG_UVOV,
48 DA9063_IRQ_VDD_MON,
49 DA9063_IRQ_WARN,
50 DA9063_IRQ_GPI0,
51 DA9063_IRQ_GPI1,
52 DA9063_IRQ_GPI2,
53 DA9063_IRQ_GPI3,
54 DA9063_IRQ_GPI4,
55 DA9063_IRQ_GPI5,
56 DA9063_IRQ_GPI6,
57 DA9063_IRQ_GPI7,
58 DA9063_IRQ_GPI8,
59 DA9063_IRQ_GPI9,
60 DA9063_IRQ_GPI10,
61 DA9063_IRQ_GPI11,
62 DA9063_IRQ_GPI12,
63 DA9063_IRQ_GPI13,
64 DA9063_IRQ_GPI14,
65 DA9063_IRQ_GPI15,
66};
67
68#define DA9063_IRQ_BASE_OFFSET 0
69#define DA9063_NUM_IRQ (DA9063_IRQ_GPI15 + 1 - DA9063_IRQ_BASE_OFFSET)
70
71struct da9063 {
72 /* Device */
73 struct device *dev;
74 unsigned short model;
75 unsigned short revision;
76 unsigned int flags;
77
78 /* Control interface */
79 struct regmap *regmap;
80
81 /* Interrupts */
82 int chip_irq;
83 unsigned int irq_base;
84 struct regmap_irq_chip_data *regmap_irq;
85};
86
87int da9063_device_init(struct da9063 *da9063, unsigned int irq);
88int da9063_irq_init(struct da9063 *da9063);
89
90void da9063_device_exit(struct da9063 *da9063);
91void da9063_irq_exit(struct da9063 *da9063);
92
93#endif /* __MFD_DA9063_CORE_H__ */
diff --git a/include/linux/mfd/da9063/pdata.h b/include/linux/mfd/da9063/pdata.h
new file mode 100644
index 000000000000..95c8742215a7
--- /dev/null
+++ b/include/linux/mfd/da9063/pdata.h
@@ -0,0 +1,111 @@
1/*
2 * Platform configuration options for DA9063
3 *
4 * Copyright 2012 Dialog Semiconductor Ltd.
5 *
6 * Author: Michal Hajduk <michal.hajduk@diasemi.com>
7 * Author: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15
16#ifndef __MFD_DA9063_PDATA_H__
17#define __MFD_DA9063_PDATA_H__
18
19#include <linux/regulator/machine.h>
20
21/*
22 * Regulator configuration
23 */
24/* DA9063 regulator IDs */
25enum {
26 /* BUCKs */
27 DA9063_ID_BCORE1,
28 DA9063_ID_BCORE2,
29 DA9063_ID_BPRO,
30 DA9063_ID_BMEM,
31 DA9063_ID_BIO,
32 DA9063_ID_BPERI,
33
34 /* BCORE1 and BCORE2 in merged mode */
35 DA9063_ID_BCORES_MERGED,
36 /* BMEM and BIO in merged mode */
37 DA9063_ID_BMEM_BIO_MERGED,
38 /* When two BUCKs are merged, they cannot be reused separately */
39
40 /* LDOs */
41 DA9063_ID_LDO1,
42 DA9063_ID_LDO2,
43 DA9063_ID_LDO3,
44 DA9063_ID_LDO4,
45 DA9063_ID_LDO5,
46 DA9063_ID_LDO6,
47 DA9063_ID_LDO7,
48 DA9063_ID_LDO8,
49 DA9063_ID_LDO9,
50 DA9063_ID_LDO10,
51 DA9063_ID_LDO11,
52};
53
54/* Regulators platform data */
55struct da9063_regulator_data {
56 int id;
57 struct regulator_init_data *initdata;
58};
59
60struct da9063_regulators_pdata {
61 unsigned n_regulators;
62 struct da9063_regulator_data *regulator_data;
63};
64
65
66/*
67 * RGB LED configuration
68 */
69/* LED IDs for flags in struct led_info. */
70enum {
71 DA9063_GPIO11_LED,
72 DA9063_GPIO14_LED,
73 DA9063_GPIO15_LED,
74
75 DA9063_LED_NUM
76};
77#define DA9063_LED_ID_MASK 0x3
78
79/* LED polarity for flags in struct led_info. */
80#define DA9063_LED_HIGH_LEVEL_ACTIVE 0x0
81#define DA9063_LED_LOW_LEVEL_ACTIVE 0x4
82
83
84/*
85 * General PMIC configuration
86 */
87/* HWMON ADC channels configuration */
88#define DA9063_FLG_FORCE_IN0_MANUAL_MODE 0x0010
89#define DA9063_FLG_FORCE_IN0_AUTO_MODE 0x0020
90#define DA9063_FLG_FORCE_IN1_MANUAL_MODE 0x0040
91#define DA9063_FLG_FORCE_IN1_AUTO_MODE 0x0080
92#define DA9063_FLG_FORCE_IN2_MANUAL_MODE 0x0100
93#define DA9063_FLG_FORCE_IN2_AUTO_MODE 0x0200
94#define DA9063_FLG_FORCE_IN3_MANUAL_MODE 0x0400
95#define DA9063_FLG_FORCE_IN3_AUTO_MODE 0x0800
96
97/* Disable register caching. */
98#define DA9063_FLG_NO_CACHE 0x0008
99
100struct da9063;
101
102/* DA9063 platform data */
103struct da9063_pdata {
104 int (*init)(struct da9063 *da9063);
105 int irq_base;
106 unsigned flags;
107 struct da9063_regulators_pdata *regulators_pdata;
108 struct led_platform_data *leds_pdata;
109};
110
111#endif /* __MFD_DA9063_PDATA_H__ */
diff --git a/include/linux/mfd/da9063/registers.h b/include/linux/mfd/da9063/registers.h
new file mode 100644
index 000000000000..5834813fb5f3
--- /dev/null
+++ b/include/linux/mfd/da9063/registers.h
@@ -0,0 +1,1028 @@
1/*
2 * Registers definition for DA9063 modules
3 *
4 * Copyright 2012 Dialog Semiconductor Ltd.
5 *
6 * Author: Michal Hajduk <michal.hajduk@diasemi.com>
7 * Krystian Garbaciak <krystian.garbaciak@diasemi.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15
16#ifndef _DA9063_REG_H
17#define _DA9063_REG_H
18
19#define DA9063_I2C_PAGE_SEL_SHIFT 1
20
21#define DA9063_EVENT_REG_NUM 4
22#define DA9210_EVENT_REG_NUM 2
23#define DA9063_EXT_EVENT_REG_NUM (DA9063_EVENT_REG_NUM + \
24 DA9210_EVENT_REG_NUM)
25
26/* Page selection I2C or SPI always in the begining of any page. */
27/* Page 0 : I2C access 0x000 - 0x0FF SPI access 0x000 - 0x07F */
28/* Page 1 : SPI access 0x080 - 0x0FF */
29/* Page 2 : I2C access 0x100 - 0x1FF SPI access 0x100 - 0x17F */
30/* Page 3 : SPI access 0x180 - 0x1FF */
31#define DA9063_REG_PAGE_CON 0x00
32
33/* System Control and Event Registers */
34#define DA9063_REG_STATUS_A 0x01
35#define DA9063_REG_STATUS_B 0x02
36#define DA9063_REG_STATUS_C 0x03
37#define DA9063_REG_STATUS_D 0x04
38#define DA9063_REG_FAULT_LOG 0x05
39#define DA9063_REG_EVENT_A 0x06
40#define DA9063_REG_EVENT_B 0x07
41#define DA9063_REG_EVENT_C 0x08
42#define DA9063_REG_EVENT_D 0x09
43#define DA9063_REG_IRQ_MASK_A 0x0A
44#define DA9063_REG_IRQ_MASK_B 0x0B
45#define DA9063_REG_IRQ_MASK_C 0x0C
46#define DA9063_REG_IRQ_MASK_D 0x0D
47#define DA9063_REG_CONTROL_A 0x0E
48#define DA9063_REG_CONTROL_B 0x0F
49#define DA9063_REG_CONTROL_C 0x10
50#define DA9063_REG_CONTROL_D 0x11
51#define DA9063_REG_CONTROL_E 0x12
52#define DA9063_REG_CONTROL_F 0x13
53#define DA9063_REG_PD_DIS 0x14
54
55/* GPIO Control Registers */
56#define DA9063_REG_GPIO_0_1 0x15
57#define DA9063_REG_GPIO_2_3 0x16
58#define DA9063_REG_GPIO_4_5 0x17
59#define DA9063_REG_GPIO_6_7 0x18
60#define DA9063_REG_GPIO_8_9 0x19
61#define DA9063_REG_GPIO_10_11 0x1A
62#define DA9063_REG_GPIO_12_13 0x1B
63#define DA9063_REG_GPIO_14_15 0x1C
64#define DA9063_REG_GPIO_MODE_0_7 0x1D
65#define DA9063_REG_GPIO_MODE_8_15 0x1E
66#define DA9063_REG_GPIO_SWITCH_CONT 0x1F
67
68/* Regulator Control Registers */
69#define DA9063_REG_BCORE2_CONT 0x20
70#define DA9063_REG_BCORE1_CONT 0x21
71#define DA9063_REG_BPRO_CONT 0x22
72#define DA9063_REG_BMEM_CONT 0x23
73#define DA9063_REG_BIO_CONT 0x24
74#define DA9063_REG_BPERI_CONT 0x25
75#define DA9063_REG_LDO1_CONT 0x26
76#define DA9063_REG_LDO2_CONT 0x27
77#define DA9063_REG_LDO3_CONT 0x28
78#define DA9063_REG_LDO4_CONT 0x29
79#define DA9063_REG_LDO5_CONT 0x2A
80#define DA9063_REG_LDO6_CONT 0x2B
81#define DA9063_REG_LDO7_CONT 0x2C
82#define DA9063_REG_LDO8_CONT 0x2D
83#define DA9063_REG_LDO9_CONT 0x2E
84#define DA9063_REG_LDO10_CONT 0x2F
85#define DA9063_REG_LDO11_CONT 0x30
86#define DA9063_REG_VIB 0x31
87#define DA9063_REG_DVC_1 0x32
88#define DA9063_REG_DVC_2 0x33
89
90/* GP-ADC Control Registers */
91#define DA9063_REG_ADC_MAN 0x34
92#define DA9063_REG_ADC_CONT 0x35
93#define DA9063_REG_VSYS_MON 0x36
94#define DA9063_REG_ADC_RES_L 0x37
95#define DA9063_REG_ADC_RES_H 0x38
96#define DA9063_REG_VSYS_RES 0x39
97#define DA9063_REG_ADCIN1_RES 0x3A
98#define DA9063_REG_ADCIN2_RES 0x3B
99#define DA9063_REG_ADCIN3_RES 0x3C
100#define DA9063_REG_MON1_RES 0x3D
101#define DA9063_REG_MON2_RES 0x3E
102#define DA9063_REG_MON3_RES 0x3F
103
104/* RTC Calendar and Alarm Registers */
105#define DA9063_REG_COUNT_S 0x40
106#define DA9063_REG_COUNT_MI 0x41
107#define DA9063_REG_COUNT_H 0x42
108#define DA9063_REG_COUNT_D 0x43
109#define DA9063_REG_COUNT_MO 0x44
110#define DA9063_REG_COUNT_Y 0x45
111#define DA9063_REG_ALARM_MI 0x46
112#define DA9063_REG_ALARM_H 0x47
113#define DA9063_REG_ALARM_D 0x48
114#define DA9063_REG_ALARM_MO 0x49
115#define DA9063_REG_ALARM_Y 0x4A
116#define DA9063_REG_SECOND_A 0x4B
117#define DA9063_REG_SECOND_B 0x4C
118#define DA9063_REG_SECOND_C 0x4D
119#define DA9063_REG_SECOND_D 0x4E
120
121/* Sequencer Control Registers */
122#define DA9063_REG_SEQ 0x81
123#define DA9063_REG_SEQ_TIMER 0x82
124#define DA9063_REG_ID_2_1 0x83
125#define DA9063_REG_ID_4_3 0x84
126#define DA9063_REG_ID_6_5 0x85
127#define DA9063_REG_ID_8_7 0x86
128#define DA9063_REG_ID_10_9 0x87
129#define DA9063_REG_ID_12_11 0x88
130#define DA9063_REG_ID_14_13 0x89
131#define DA9063_REG_ID_16_15 0x8A
132#define DA9063_REG_ID_18_17 0x8B
133#define DA9063_REG_ID_20_19 0x8C
134#define DA9063_REG_ID_22_21 0x8D
135#define DA9063_REG_ID_24_23 0x8E
136#define DA9063_REG_ID_26_25 0x8F
137#define DA9063_REG_ID_28_27 0x90
138#define DA9063_REG_ID_30_29 0x91
139#define DA9063_REG_ID_32_31 0x92
140#define DA9063_REG_SEQ_A 0x95
141#define DA9063_REG_SEQ_B 0x96
142#define DA9063_REG_WAIT 0x97
143#define DA9063_REG_EN_32K 0x98
144#define DA9063_REG_RESET 0x99
145
146/* Regulator Setting Registers */
147#define DA9063_REG_BUCK_ILIM_A 0x9A
148#define DA9063_REG_BUCK_ILIM_B 0x9B
149#define DA9063_REG_BUCK_ILIM_C 0x9C
150#define DA9063_REG_BCORE2_CFG 0x9D
151#define DA9063_REG_BCORE1_CFG 0x9E
152#define DA9063_REG_BPRO_CFG 0x9F
153#define DA9063_REG_BIO_CFG 0xA0
154#define DA9063_REG_BMEM_CFG 0xA1
155#define DA9063_REG_BPERI_CFG 0xA2
156#define DA9063_REG_VBCORE2_A 0xA3
157#define DA9063_REG_VBCORE1_A 0xA4
158#define DA9063_REG_VBPRO_A 0xA5
159#define DA9063_REG_VBMEM_A 0xA6
160#define DA9063_REG_VBIO_A 0xA7
161#define DA9063_REG_VBPERI_A 0xA8
162#define DA9063_REG_VLDO1_A 0xA9
163#define DA9063_REG_VLDO2_A 0xAA
164#define DA9063_REG_VLDO3_A 0xAB
165#define DA9063_REG_VLDO4_A 0xAC
166#define DA9063_REG_VLDO5_A 0xAD
167#define DA9063_REG_VLDO6_A 0xAE
168#define DA9063_REG_VLDO7_A 0xAF
169#define DA9063_REG_VLDO8_A 0xB0
170#define DA9063_REG_VLDO9_A 0xB1
171#define DA9063_REG_VLDO10_A 0xB2
172#define DA9063_REG_VLDO11_A 0xB3
173#define DA9063_REG_VBCORE2_B 0xB4
174#define DA9063_REG_VBCORE1_B 0xB5
175#define DA9063_REG_VBPRO_B 0xB6
176#define DA9063_REG_VBMEM_B 0xB7
177#define DA9063_REG_VBIO_B 0xB8
178#define DA9063_REG_VBPERI_B 0xB9
179#define DA9063_REG_VLDO1_B 0xBA
180#define DA9063_REG_VLDO2_B 0xBB
181#define DA9063_REG_VLDO3_B 0xBC
182#define DA9063_REG_VLDO4_B 0xBD
183#define DA9063_REG_VLDO5_B 0xBE
184#define DA9063_REG_VLDO6_B 0xBF
185#define DA9063_REG_VLDO7_B 0xC0
186#define DA9063_REG_VLDO8_B 0xC1
187#define DA9063_REG_VLDO9_B 0xC2
188#define DA9063_REG_VLDO10_B 0xC3
189#define DA9063_REG_VLDO11_B 0xC4
190
191/* Backup Battery Charger Control Register */
192#define DA9063_REG_BBAT_CONT 0xC5
193
194/* GPIO PWM (LED) */
195#define DA9063_REG_GPO11_LED 0xC6
196#define DA9063_REG_GPO14_LED 0xC7
197#define DA9063_REG_GPO15_LED 0xC8
198
199/* GP-ADC Threshold Registers */
200#define DA9063_REG_ADC_CFG 0xC9
201#define DA9063_REG_AUTO1_HIGH 0xCA
202#define DA9063_REG_AUTO1_LOW 0xCB
203#define DA9063_REG_AUTO2_HIGH 0xCC
204#define DA9063_REG_AUTO2_LOW 0xCD
205#define DA9063_REG_AUTO3_HIGH 0xCE
206#define DA9063_REG_AUTO3_LOW 0xCF
207
208/* DA9063 Configuration registers */
209/* OTP */
210#define DA9063_REG_OPT_COUNT 0x101
211#define DA9063_REG_OPT_ADDR 0x102
212#define DA9063_REG_OPT_DATA 0x103
213
214/* Customer Trim and Configuration */
215#define DA9063_REG_T_OFFSET 0x104
216#define DA9063_REG_INTERFACE 0x105
217#define DA9063_REG_CONFIG_A 0x106
218#define DA9063_REG_CONFIG_B 0x107
219#define DA9063_REG_CONFIG_C 0x108
220#define DA9063_REG_CONFIG_D 0x109
221#define DA9063_REG_CONFIG_E 0x10A
222#define DA9063_REG_CONFIG_F 0x10B
223#define DA9063_REG_CONFIG_G 0x10C
224#define DA9063_REG_CONFIG_H 0x10D
225#define DA9063_REG_CONFIG_I 0x10E
226#define DA9063_REG_CONFIG_J 0x10F
227#define DA9063_REG_CONFIG_K 0x110
228#define DA9063_REG_CONFIG_L 0x111
229#define DA9063_REG_MON_REG_1 0x112
230#define DA9063_REG_MON_REG_2 0x113
231#define DA9063_REG_MON_REG_3 0x114
232#define DA9063_REG_MON_REG_4 0x115
233#define DA9063_REG_MON_REG_5 0x116
234#define DA9063_REG_MON_REG_6 0x117
235#define DA9063_REG_TRIM_CLDR 0x118
236
237/* General Purpose Registers */
238#define DA9063_REG_GP_ID_0 0x119
239#define DA9063_REG_GP_ID_1 0x11A
240#define DA9063_REG_GP_ID_2 0x11B
241#define DA9063_REG_GP_ID_3 0x11C
242#define DA9063_REG_GP_ID_4 0x11D
243#define DA9063_REG_GP_ID_5 0x11E
244#define DA9063_REG_GP_ID_6 0x11F
245#define DA9063_REG_GP_ID_7 0x120
246#define DA9063_REG_GP_ID_8 0x121
247#define DA9063_REG_GP_ID_9 0x122
248#define DA9063_REG_GP_ID_10 0x123
249#define DA9063_REG_GP_ID_11 0x124
250#define DA9063_REG_GP_ID_12 0x125
251#define DA9063_REG_GP_ID_13 0x126
252#define DA9063_REG_GP_ID_14 0x127
253#define DA9063_REG_GP_ID_15 0x128
254#define DA9063_REG_GP_ID_16 0x129
255#define DA9063_REG_GP_ID_17 0x12A
256#define DA9063_REG_GP_ID_18 0x12B
257#define DA9063_REG_GP_ID_19 0x12C
258
259/* Chip ID and variant */
260#define DA9063_REG_CHIP_ID 0x181
261#define DA9063_REG_CHIP_VARIANT 0x182
262
263/*
264 * PMIC registers bits
265 */
266/* DA9063_REG_PAGE_CON (addr=0x00) */
267#define DA9063_PEG_PAGE_SHIFT 0
268#define DA9063_REG_PAGE_MASK 0x07
269#define DA9063_REG_PAGE0 0x00
270#define DA9063_REG_PAGE2 0x02
271#define DA9063_PAGE_WRITE_MODE 0x00
272#define DA9063_REPEAT_WRITE_MODE 0x40
273#define DA9063_PAGE_REVERT 0x80
274
275/* DA9063_REG_STATUS_A (addr=0x01) */
276#define DA9063_NONKEY 0x01
277#define DA9063_WAKE 0x02
278#define DA9063_DVC_BUSY 0x04
279#define DA9063_COMP_1V2 0x08
280
281/* DA9063_REG_STATUS_B (addr=0x02) */
282#define DA9063_GPI0 0x01
283#define DA9063_GPI1 0x02
284#define DA9063_GPI2 0x04
285#define DA9063_GPI3 0x08
286#define DA9063_GPI4 0x10
287#define DA9063_GPI5 0x20
288#define DA9063_GPI6 0x40
289#define DA9063_GPI7 0x80
290
291/* DA9063_REG_STATUS_C (addr=0x03) */
292#define DA9063_GPI8 0x01
293#define DA9063_GPI9 0x02
294#define DA9063_GPI10 0x04
295#define DA9063_GPI11 0x08
296#define DA9063_GPI12 0x10
297#define DA9063_GPI13 0x20
298#define DA9063_GPI14 0x40
299#define DA9063_GPI15 0x80
300
301/* DA9063_REG_STATUS_D (addr=0x04) */
302#define DA9063_LDO3_LIM 0x08
303#define DA9063_LDO4_LIM 0x10
304#define DA9063_LDO7_LIM 0x20
305#define DA9063_LDO8_LIM 0x40
306#define DA9063_LDO11_LIM 0x80
307
308/* DA9063_REG_FAULT_LOG (addr=0x05) */
309#define DA9063_TWD_ERROR 0x01
310#define DA9063_POR 0x02
311#define DA9063_VDD_FAULT 0x04
312#define DA9063_VDD_START 0x08
313#define DA9063_TEMP_CRIT 0x10
314#define DA9063_KEY_RESET 0x20
315#define DA9063_NSHUTDOWN 0x40
316#define DA9063_WAIT_SHUT 0x80
317
318/* DA9063_REG_EVENT_A (addr=0x06) */
319#define DA9063_E_NONKEY 0x01
320#define DA9063_E_ALARM 0x02
321#define DA9063_E_TICK 0x04
322#define DA9063_E_ADC_RDY 0x08
323#define DA9063_E_SEQ_RDY 0x10
324#define DA9063_EVENTS_B 0x20
325#define DA9063_EVENTS_C 0x40
326#define DA9063_EVENTS_D 0x80
327
328/* DA9063_REG_EVENT_B (addr=0x07) */
329#define DA9063_E_WAKE 0x01
330#define DA9063_E_TEMP 0x02
331#define DA9063_E_COMP_1V2 0x04
332#define DA9063_E_LDO_LIM 0x08
333#define DA9063_E_REG_UVOV 0x10
334#define DA9063_E_DVC_RDY 0x20
335#define DA9063_E_VDD_MON 0x40
336#define DA9063_E_VDD_WARN 0x80
337
338/* DA9063_REG_EVENT_C (addr=0x08) */
339#define DA9063_E_GPI0 0x01
340#define DA9063_E_GPI1 0x02
341#define DA9063_E_GPI2 0x04
342#define DA9063_E_GPI3 0x08
343#define DA9063_E_GPI4 0x10
344#define DA9063_E_GPI5 0x20
345#define DA9063_E_GPI6 0x40
346#define DA9063_E_GPI7 0x80
347
348/* DA9063_REG_EVENT_D (addr=0x09) */
349#define DA9063_E_GPI8 0x01
350#define DA9063_E_GPI9 0x02
351#define DA9063_E_GPI10 0x04
352#define DA9063_E_GPI11 0x08
353#define DA9063_E_GPI12 0x10
354#define DA9063_E_GPI13 0x20
355#define DA9063_E_GPI14 0x40
356#define DA9063_E_GPI15 0x80
357
358/* DA9063_REG_IRQ_MASK_A (addr=0x0A) */
359#define DA9063_M_ONKEY 0x01
360#define DA9063_M_ALARM 0x02
361#define DA9063_M_TICK 0x04
362#define DA9063_M_ADC_RDY 0x08
363#define DA9063_M_SEQ_RDY 0x10
364
365/* DA9063_REG_IRQ_MASK_B (addr=0x0B) */
366#define DA9063_M_WAKE 0x01
367#define DA9063_M_TEMP 0x02
368#define DA9063_M_COMP_1V2 0x04
369#define DA9063_M_LDO_LIM 0x08
370#define DA9063_M_UVOV 0x10
371#define DA9063_M_DVC_RDY 0x20
372#define DA9063_M_VDD_MON 0x40
373#define DA9063_M_VDD_WARN 0x80
374
375/* DA9063_REG_IRQ_MASK_C (addr=0x0C) */
376#define DA9063_M_GPI0 0x01
377#define DA9063_M_GPI1 0x02
378#define DA9063_M_GPI2 0x04
379#define DA9063_M_GPI3 0x08
380#define DA9063_M_GPI4 0x10
381#define DA9063_M_GPI5 0x20
382#define DA9063_M_GPI6 0x40
383#define DA9063_M_GPI7 0x80
384
385/* DA9063_REG_IRQ_MASK_D (addr=0x0D) */
386#define DA9063_M_GPI8 0x01
387#define DA9063_M_GPI9 0x02
388#define DA9063_M_GPI10 0x04
389#define DA9063_M_GPI11 0x08
390#define DA9063_M_GPI12 0x10
391#define DA9063_M_GPI13 0x20
392#define DA9063_M_GPI14 0x40
393#define DA9063_M_GPI15 0x80
394
395/* DA9063_REG_CONTROL_A (addr=0x0E) */
396#define DA9063_SYSTEM_EN 0x01
397#define DA9063_POWER_EN 0x02
398#define DA9063_POWER1_EN 0x04
399#define DA9063_STANDBY 0x08
400#define DA9063_M_SYSTEM_EN 0x10
401#define DA9063_M_POWER_EN 0x20
402#define DA9063_M_POWER1_EN 0x40
403#define DA9063_CP_EN 0x80
404
405/* DA9063_REG_CONTROL_B (addr=0x0F) */
406#define DA9063_CHG_SEL 0x01
407#define DA9063_WATCHDOG_PD 0x02
408#define DA9063_NRES_MODE 0x08
409#define DA9063_NONKEY_LOCK 0x10
410
411/* DA9063_REG_CONTROL_C (addr=0x10) */
412#define DA9063_DEBOUNCING_MASK 0x07
413#define DA9063_DEBOUNCING_OFF 0x0
414#define DA9063_DEBOUNCING_0MS1 0x1
415#define DA9063_DEBOUNCING_1MS 0x2
416#define DA9063_DEBOUNCING_10MS24 0x3
417#define DA9063_DEBOUNCING_51MS2 0x4
418#define DA9063_DEBOUNCING_256MS 0x5
419#define DA9063_DEBOUNCING_512MS 0x6
420#define DA9063_DEBOUNCING_1024MS 0x7
421
422#define DA9063_AUTO_BOOT 0x08
423#define DA9063_OTPREAD_EN 0x10
424#define DA9063_SLEW_RATE_MASK 0x60
425#define DA9063_SLEW_RATE_4US 0x00
426#define DA9063_SLEW_RATE_3US 0x20
427#define DA9063_SLEW_RATE_1US 0x40
428#define DA9063_SLEW_RATE_0US5 0x60
429#define DA9063_DEF_SUPPLY 0x80
430
431/* DA9063_REG_CONTROL_D (addr=0x11) */
432#define DA9063_TWDSCALE_MASK 0x07
433#define DA9063_BLINK_FRQ_MASK 0x38
434#define DA9063_BLINK_FRQ_OFF 0x00
435#define DA9063_BLINK_FRQ_1S0 0x08
436#define DA9063_BLINK_FRQ_2S0 0x10
437#define DA9063_BLINK_FRQ_4S0 0x18
438#define DA9063_BLINK_FRQ_0S18 0x20
439#define DA9063_BLINK_FRQ_2S0_VDD 0x28
440#define DA9063_BLINK_FRQ_4S0_VDD 0x30
441#define DA9063_BLINK_FRQ_0S18_VDD 0x38
442
443#define DA9063_BLINK_DUR_MASK 0xC0
444#define DA9063_BLINK_DUR_10MS 0x00
445#define DA9063_BLINK_DUR_20MS 0x40
446#define DA9063_BLINK_DUR_40MS 0x80
447#define DA9063_BLINK_DUR_20MSDBL 0xC0
448
449/* DA9063_REG_CONTROL_E (addr=0x12) */
450#define DA9063_RTC_MODE_PD 0x01
451#define DA9063_RTC_MODE_SD 0x02
452#define DA9063_RTC_EN 0x04
453#define DA9063_ECO_MODE 0x08
454#define DA9063_PM_FB1_PIN 0x10
455#define DA9063_PM_FB2_PIN 0x20
456#define DA9063_PM_FB3_PIN 0x40
457#define DA9063_V_LOCK 0x80
458
459/* DA9063_REG_CONTROL_F (addr=0x13) */
460#define DA9063_WATCHDOG 0x01
461#define DA9063_SHUTDOWN 0x02
462#define DA9063_WAKE_UP 0x04
463
464/* DA9063_REG_PD_DIS (addr=0x14) */
465#define DA9063_GPI_DIS 0x01
466#define DA9063_GPADC_PAUSE 0x02
467#define DA9063_PMIF_DIS 0x04
468#define DA9063_HS2WIRE_DIS 0x08
469#define DA9063_BBAT_DIS 0x20
470#define DA9063_OUT_32K_PAUSE 0x40
471#define DA9063_PMCONT_DIS 0x80
472
473/* DA9063_REG_GPIO_0_1 (addr=0x15) */
474#define DA9063_GPIO0_PIN_MASK 0x03
475#define DA9063_GPIO0_PIN_ADCIN1 0x00
476#define DA9063_GPIO0_PIN_GPI 0x01
477#define DA9063_GPIO0_PIN_GPO_OD 0x02
478#define DA9063_GPIO0_PIN_GPO 0x03
479#define DA9063_GPIO0_TYPE 0x04
480#define DA9063_GPIO0_TYPE_GPI_ACT_LOW 0x00
481#define DA9063_GPIO0_TYPE_GPO_VDD_IO1 0x00
482#define DA9063_GPIO0_TYPE_GPI_ACT_HIGH 0x04
483#define DA9063_GPIO0_TYPE_GPO_VDD_IO2 0x04
484#define DA9063_GPIO0_NO_WAKEUP 0x08
485#define DA9063_GPIO1_PIN_MASK 0x30
486#define DA9063_GPIO1_PIN_ADCIN2_COMP 0x00
487#define DA9063_GPIO1_PIN_GPI 0x10
488#define DA9063_GPIO1_PIN_GPO_OD 0x20
489#define DA9063_GPIO1_PIN_GPO 0x30
490#define DA9063_GPIO1_TYPE 0x40
491#define DA9063_GPIO1_TYPE_GPI_ACT_LOW 0x00
492#define DA9063_GPIO1_TYPE_GPO_VDD_IO1 0x00
493#define DA9063_GPIO1_TYPE_GPI_ACT_HIGH 0x04
494#define DA9063_GPIO1_TYPE_GPO_VDD_IO2 0x04
495#define DA9063_GPIO1_NO_WAKEUP 0x80
496
497/* DA9063_REG_GPIO_2_3 (addr=0x16) */
498#define DA9063_GPIO2_PIN_MASK 0x03
499#define DA9063_GPIO2_PIN_ADCIN3 0x00
500#define DA9063_GPIO2_PIN_GPI 0x01
501#define DA9063_GPIO2_PIN_GPO_PSS 0x02
502#define DA9063_GPIO2_PIN_GPO 0x03
503#define DA9063_GPIO2_TYPE 0x04
504#define DA9063_GPIO2_TYPE_GPI_ACT_LOW 0x00
505#define DA9063_GPIO2_TYPE_GPO_VDD_IO1 0x00
506#define DA9063_GPIO2_TYPE_GPI_ACT_HIGH 0x04
507#define DA9063_GPIO2_TYPE_GPO_VDD_IO2 0x04
508#define DA9063_GPIO2_NO_WAKEUP 0x08
509#define DA9063_GPIO3_PIN_MASK 0x30
510#define DA9063_GPIO3_PIN_CORE_SW_G 0x00
511#define DA9063_GPIO3_PIN_GPI 0x10
512#define DA9063_GPIO3_PIN_GPO_OD 0x20
513#define DA9063_GPIO3_PIN_GPO 0x30
514#define DA9063_GPIO3_TYPE 0x40
515#define DA9063_GPIO3_TYPE_GPI_ACT_LOW 0x00
516#define DA9063_GPIO3_TYPE_GPO_VDD_IO1 0x00
517#define DA9063_GPIO3_TYPE_GPI_ACT_HIGH 0x04
518#define DA9063_GPIO3_TYPE_GPO_VDD_IO2 0x04
519#define DA9063_GPIO3_NO_WAKEUP 0x80
520
521/* DA9063_REG_GPIO_4_5 (addr=0x17) */
522#define DA9063_GPIO4_PIN_MASK 0x03
523#define DA9063_GPIO4_PIN_CORE_SW_S 0x00
524#define DA9063_GPIO4_PIN_GPI 0x01
525#define DA9063_GPIO4_PIN_GPO_OD 0x02
526#define DA9063_GPIO4_PIN_GPO 0x03
527#define DA9063_GPIO4_TYPE 0x04
528#define DA9063_GPIO4_TYPE_GPI_ACT_LOW 0x00
529#define DA9063_GPIO4_TYPE_GPO_VDD_IO1 0x00
530#define DA9063_GPIO4_TYPE_GPI_ACT_HIGH 0x04
531#define DA9063_GPIO4_TYPE_GPO_VDD_IO2 0x04
532#define DA9063_GPIO4_NO_WAKEUP 0x08
533#define DA9063_GPIO5_PIN_MASK 0x30
534#define DA9063_GPIO5_PIN_PERI_SW_G 0x00
535#define DA9063_GPIO5_PIN_GPI 0x10
536#define DA9063_GPIO5_PIN_GPO_OD 0x20
537#define DA9063_GPIO5_PIN_GPO 0x30
538#define DA9063_GPIO5_TYPE 0x40
539#define DA9063_GPIO5_TYPE_GPI_ACT_LOW 0x00
540#define DA9063_GPIO5_TYPE_GPO_VDD_IO1 0x00
541#define DA9063_GPIO5_TYPE_GPI_ACT_HIGH 0x04
542#define DA9063_GPIO5_TYPE_GPO_VDD_IO2 0x04
543#define DA9063_GPIO5_NO_WAKEUP 0x80
544
545/* DA9063_REG_GPIO_6_7 (addr=0x18) */
546#define DA9063_GPIO6_PIN_MASK 0x03
547#define DA9063_GPIO6_PIN_PERI_SW_S 0x00
548#define DA9063_GPIO6_PIN_GPI 0x01
549#define DA9063_GPIO6_PIN_GPO_OD 0x02
550#define DA9063_GPIO6_PIN_GPO 0x03
551#define DA9063_GPIO6_TYPE 0x04
552#define DA9063_GPIO6_TYPE_GPI_ACT_LOW 0x00
553#define DA9063_GPIO6_TYPE_GPO_VDD_IO1 0x00
554#define DA9063_GPIO6_TYPE_GPI_ACT_HIGH 0x04
555#define DA9063_GPIO6_TYPE_GPO_VDD_IO2 0x04
556#define DA9063_GPIO6_NO_WAKEUP 0x08
557#define DA9063_GPIO7_PIN_MASK 0x30
558#define DA9063_GPIO7_PIN_GPI 0x10
559#define DA9063_GPIO7_PIN_GPO_PSS 0x20
560#define DA9063_GPIO7_PIN_GPO 0x30
561#define DA9063_GPIO7_TYPE 0x40
562#define DA9063_GPIO7_TYPE_GPI_ACT_LOW 0x00
563#define DA9063_GPIO7_TYPE_GPO_VDD_IO1 0x00
564#define DA9063_GPIO7_TYPE_GPI_ACT_HIGH 0x04
565#define DA9063_GPIO7_TYPE_GPO_VDD_IO2 0x04
566#define DA9063_GPIO7_NO_WAKEUP 0x80
567
568/* DA9063_REG_GPIO_8_9 (addr=0x19) */
569#define DA9063_GPIO8_PIN_MASK 0x03
570#define DA9063_GPIO8_PIN_GPI_SYS_EN 0x00
571#define DA9063_GPIO8_PIN_GPI 0x01
572#define DA9063_GPIO8_PIN_GPO_PSS 0x02
573#define DA9063_GPIO8_PIN_GPO 0x03
574#define DA9063_GPIO8_TYPE 0x04
575#define DA9063_GPIO8_TYPE_GPI_ACT_LOW 0x00
576#define DA9063_GPIO8_TYPE_GPO_VDD_IO1 0x00
577#define DA9063_GPIO8_TYPE_GPI_ACT_HIGH 0x04
578#define DA9063_GPIO8_TYPE_GPO_VDD_IO2 0x04
579#define DA9063_GPIO8_NO_WAKEUP 0x08
580#define DA9063_GPIO9_PIN_MASK 0x30
581#define DA9063_GPIO9_PIN_GPI_PWR_EN 0x00
582#define DA9063_GPIO9_PIN_GPI 0x10
583#define DA9063_GPIO9_PIN_GPO_PSS 0x20
584#define DA9063_GPIO9_PIN_GPO 0x30
585#define DA9063_GPIO9_TYPE 0x40
586#define DA9063_GPIO9_TYPE_GPI_ACT_LOW 0x00
587#define DA9063_GPIO9_TYPE_GPO_VDD_IO1 0x00
588#define DA9063_GPIO9_TYPE_GPI_ACT_HIGH 0x04
589#define DA9063_GPIO9_TYPE_GPO_VDD_IO2 0x04
590#define DA9063_GPIO9_NO_WAKEUP 0x80
591
592/* DA9063_REG_GPIO_10_11 (addr=0x1A) */
593#define DA9063_GPIO10_PIN_MASK 0x03
594#define DA9063_GPIO10_PIN_GPI_PWR1_EN 0x00
595#define DA9063_GPIO10_PIN_GPI 0x01
596#define DA9063_GPIO10_PIN_GPO_OD 0x02
597#define DA9063_GPIO10_PIN_GPO 0x03
598#define DA9063_GPIO10_TYPE 0x04
599#define DA9063_GPIO10_TYPE_GPI_ACT_LOW 0x00
600#define DA9063_GPIO10_TYPE_GPO_VDD_IO1 0x00
601#define DA9063_GPIO10_TYPE_GPI_ACT_HIGH 0x04
602#define DA9063_GPIO10_TYPE_GPO_VDD_IO2 0x04
603#define DA9063_GPIO10_NO_WAKEUP 0x08
604#define DA9063_GPIO11_PIN_MASK 0x30
605#define DA9063_GPIO11_PIN_GPO_OD 0x00
606#define DA9063_GPIO11_PIN_GPI 0x10
607#define DA9063_GPIO11_PIN_GPO_PSS 0x20
608#define DA9063_GPIO11_PIN_GPO 0x30
609#define DA9063_GPIO11_TYPE 0x40
610#define DA9063_GPIO11_TYPE_GPI_ACT_LOW 0x00
611#define DA9063_GPIO11_TYPE_GPO_VDD_IO1 0x00
612#define DA9063_GPIO11_TYPE_GPI_ACT_HIGH 0x04
613#define DA9063_GPIO11_TYPE_GPO_VDD_IO2 0x04
614#define DA9063_GPIO11_NO_WAKEUP 0x80
615
616/* DA9063_REG_GPIO_12_13 (addr=0x1B) */
617#define DA9063_GPIO12_PIN_MASK 0x03
618#define DA9063_GPIO12_PIN_NVDDFLT_OUT 0x00
619#define DA9063_GPIO12_PIN_GPI 0x01
620#define DA9063_GPIO12_PIN_VSYSMON_OUT 0x02
621#define DA9063_GPIO12_PIN_GPO 0x03
622#define DA9063_GPIO12_TYPE 0x04
623#define DA9063_GPIO12_TYPE_GPI_ACT_LOW 0x00
624#define DA9063_GPIO12_TYPE_GPO_VDD_IO1 0x00
625#define DA9063_GPIO12_TYPE_GPI_ACT_HIGH 0x04
626#define DA9063_GPIO12_TYPE_GPO_VDD_IO2 0x04
627#define DA9063_GPIO12_NO_WAKEUP 0x08
628#define DA9063_GPIO13_PIN_MASK 0x30
629#define DA9063_GPIO13_PIN_GPFB1_OUT 0x00
630#define DA9063_GPIO13_PIN_GPI 0x10
631#define DA9063_GPIO13_PIN_GPFB1_OUTOD 0x20
632#define DA9063_GPIO13_PIN_GPO 0x30
633#define DA9063_GPIO13_TYPE 0x40
634#define DA9063_GPIO13_TYPE_GPFB1_OUT 0x00
635#define DA9063_GPIO13_TYPE_GPI 0x00
636#define DA9063_GPIO13_TYPE_GPFB1_OUTOD 0x04
637#define DA9063_GPIO13_TYPE_GPO 0x04
638#define DA9063_GPIO13_NO_WAKEUP 0x80
639
640/* DA9063_REG_GPIO_14_15 (addr=0x1C) */
641#define DA9063_GPIO14_PIN_MASK 0x03
642#define DA9063_GPIO14_PIN_GPO_OD 0x00
643#define DA9063_GPIO14_PIN_GPI 0x01
644#define DA9063_GPIO14_PIN_HS2DATA 0x02
645#define DA9063_GPIO14_PIN_GPO 0x03
646#define DA9063_GPIO14_TYPE 0x04
647#define DA9063_GPIO14_TYPE_GPI_ACT_LOW 0x00
648#define DA9063_GPIO14_TYPE_GPO_VDD_IO1 0x00
649#define DA9063_GPIO14_TYPE_GPI_ACT_HIGH 0x04
650#define DA9063_GPIO14_TYPE_GPO_VDD_IO2 0x04
651#define DA9063_GPIO14_NO_WAKEUP 0x08
652#define DA9063_GPIO15_PIN_MASK 0x30
653#define DA9063_GPIO15_PIN_GPO_OD 0x00
654#define DA9063_GPIO15_PIN_GPI 0x10
655#define DA9063_GPIO15_PIN_GPO 0x30
656#define DA9063_GPIO15_TYPE 0x40
657#define DA9063_GPIO15_TYPE_GPFB1_OUT 0x00
658#define DA9063_GPIO15_TYPE_GPI 0x00
659#define DA9063_GPIO15_TYPE_GPFB1_OUTOD 0x04
660#define DA9063_GPIO15_TYPE_GPO 0x04
661#define DA9063_GPIO15_NO_WAKEUP 0x80
662
663/* DA9063_REG_GPIO_MODE_0_7 (addr=0x1D) */
664#define DA9063_GPIO0_MODE 0x01
665#define DA9063_GPIO1_MODE 0x02
666#define DA9063_GPIO2_MODE 0x04
667#define DA9063_GPIO3_MODE 0x08
668#define DA9063_GPIO4_MODE 0x10
669#define DA9063_GPIO5_MODE 0x20
670#define DA9063_GPIO6_MODE 0x40
671#define DA9063_GPIO7_MODE 0x80
672
673/* DA9063_REG_GPIO_MODE_8_15 (addr=0x1E) */
674#define DA9063_GPIO8_MODE 0x01
675#define DA9063_GPIO9_MODE 0x02
676#define DA9063_GPIO10_MODE 0x04
677#define DA9063_GPIO11_MODE 0x08
678#define DA9063_GPIO11_MODE_LED_ACT_HIGH 0x00
679#define DA9063_GPIO11_MODE_LED_ACT_LOW 0x08
680#define DA9063_GPIO12_MODE 0x10
681#define DA9063_GPIO13_MODE 0x20
682#define DA9063_GPIO14_MODE 0x40
683#define DA9063_GPIO14_MODE_LED_ACT_HIGH 0x00
684#define DA9063_GPIO14_MODE_LED_ACT_LOW 0x40
685#define DA9063_GPIO15_MODE 0x80
686#define DA9063_GPIO15_MODE_LED_ACT_HIGH 0x00
687#define DA9063_GPIO15_MODE_LED_ACT_LOW 0x80
688
689/* DA9063_REG_SWITCH_CONT (addr=0x1F) */
690#define DA9063_CORE_SW_GPI_MASK 0x03
691#define DA9063_CORE_SW_GPI_OFF 0x00
692#define DA9063_CORE_SW_GPI_GPIO1 0x01
693#define DA9063_CORE_SW_GPI_GPIO2 0x02
694#define DA9063_CORE_SW_GPI_GPIO13 0x03
695#define DA9063_PERI_SW_GPI_MASK 0x0C
696#define DA9063_PERI_SW_GPI_OFF 0x00
697#define DA9063_PERI_SW_GPI_GPIO1 0x04
698#define DA9063_PERI_SW_GPI_GPIO2 0x08
699#define DA9063_PERI_SW_GPI_GPIO13 0x0C
700#define DA9063_SWITCH_SR_MASK 0x30
701#define DA9063_SWITCH_SR_1MV 0x00
702#define DA9063_SWITCH_SR_5MV 0x10
703#define DA9063_SWITCH_SR_10MV 0x20
704#define DA9063_SWITCH_SR_50MV 0x30
705#define DA9063_SWITCH_SR_DIS 0x40
706#define DA9063_CP_EN_MODE 0x80
707
708/* DA9063_REGL_Bxxxx_CONT common bits (addr=0x20-0x25) */
709#define DA9063_BUCK_EN 0x01
710#define DA9063_BUCK_GPI_MASK 0x06
711#define DA9063_BUCK_GPI_OFF 0x00
712#define DA9063_BUCK_GPI_GPIO1 0x02
713#define DA9063_BUCK_GPI_GPIO2 0x04
714#define DA9063_BUCK_GPI_GPIO13 0x06
715#define DA9063_BUCK_CONF 0x08
716#define DA9063_VBUCK_GPI_MASK 0x60
717#define DA9063_VBUCK_GPI_OFF 0x00
718#define DA9063_VBUCK_GPI_GPIO1 0x20
719#define DA9063_VBUCK_GPI_GPIO2 0x40
720#define DA9063_VBUCK_GPI_GPIO13 0x60
721
722/* DA9063_REG_BCORE1_CONT specific bits (addr=0x21) */
723#define DA9063_CORE_SW_EN 0x10
724#define DA9063_CORE_SW_CONF 0x80
725
726/* DA9063_REG_BPERI_CONT specific bits (addr=0x25) */
727#define DA9063_PERI_SW_EN 0x10
728#define DA9063_PERI_SW_CONF 0x80
729
730/* DA9063_REG_LDOx_CONT common bits (addr=0x26-0x30) */
731#define DA9063_LDO_EN 0x01
732#define DA9063_LDO_GPI_MASK 0x06
733#define DA9063_LDO_GPI_OFF 0x00
734#define DA9063_LDO_GPI_GPIO1 0x02
735#define DA9063_LDO_GPI_GPIO2 0x04
736#define DA9063_LDO_GPI_GPIO13 0x06
737#define DA9063_LDO_PD_DIS 0x08
738#define DA9063_VLDO_GPI_MASK 0x60
739#define DA9063_VLDO_GPI_OFF 0x00
740#define DA9063_VLDO_GPI_GPIO1 0x20
741#define DA9063_VLDO_GPI_GPIO2 0x40
742#define DA9063_VLDO_GPI_GPIO13 0x60
743#define DA9063_LDO_CONF 0x80
744
745/* DA9063_REG_LDO5_CONT specific bits (addr=0x2A) */
746#define DA9063_VLDO5_SEL 0x10
747
748/* DA9063_REG_LDO6_CONT specific bits (addr=0x2B) */
749#define DA9063_VLDO6_SEL 0x10
750
751/* DA9063_REG_LDO7_CONT specific bits (addr=0x2C) */
752#define DA9063_VLDO7_SEL 0x10
753
754/* DA9063_REG_LDO8_CONT specific bits (addr=0x2D) */
755#define DA9063_VLDO8_SEL 0x10
756
757/* DA9063_REG_LDO9_CONT specific bits (addr=0x2E) */
758#define DA9063_VLDO9_SEL 0x10
759
760/* DA9063_REG_LDO10_CONT specific bits (addr=0x2F) */
761#define DA9063_VLDO10_SEL 0x10
762
763/* DA9063_REG_LDO11_CONT specific bits (addr=0x30) */
764#define DA9063_VLDO11_SEL 0x10
765
766/* DA9063_REG_VIB (addr=0x31) */
767#define DA9063_VIB_SET_MASK 0x3F
768#define DA9063_VIB_SET_OFF 0
769#define DA9063_VIB_SET_MAX 0x3F
770
771/* DA9063_REG_DVC_1 (addr=0x32) */
772#define DA9063_VBCORE1_SEL 0x01
773#define DA9063_VBCORE2_SEL 0x02
774#define DA9063_VBPRO_SEL 0x04
775#define DA9063_VBMEM_SEL 0x08
776#define DA9063_VBPERI_SEL 0x10
777#define DA9063_VLDO1_SEL 0x20
778#define DA9063_VLDO2_SEL 0x40
779#define DA9063_VLDO3_SEL 0x80
780
781/* DA9063_REG_DVC_2 (addr=0x33) */
782#define DA9063_VBIO_SEL 0x01
783#define DA9063_VLDO4_SEL 0x80
784
785/* DA9063_REG_ADC_MAN (addr=0x34) */
786#define DA9063_ADC_MUX_MASK 0x0F
787#define DA9063_ADC_MUX_VSYS 0x00
788#define DA9063_ADC_MUX_ADCIN1 0x01
789#define DA9063_ADC_MUX_ADCIN2 0x02
790#define DA9063_ADC_MUX_ADCIN3 0x03
791#define DA9063_ADC_MUX_T_SENSE 0x04
792#define DA9063_ADC_MUX_VBBAT 0x05
793#define DA9063_ADC_MUX_LDO_G1 0x08
794#define DA9063_ADC_MUX_LDO_G2 0x09
795#define DA9063_ADC_MUX_LDO_G3 0x0A
796#define DA9063_ADC_MAN 0x10
797#define DA9063_ADC_MODE 0x20
798
799/* DA9063_REG_ADC_CONT (addr=0x35) */
800#define DA9063_ADC_AUTO_VSYS_EN 0x01
801#define DA9063_ADC_AUTO_AD1_EN 0x02
802#define DA9063_ADC_AUTO_AD2_EN 0x04
803#define DA9063_ADC_AUTO_AD3_EN 0x08
804#define DA9063_ADC_AD1_ISRC_EN 0x10
805#define DA9063_ADC_AD2_ISRC_EN 0x20
806#define DA9063_ADC_AD3_ISRC_EN 0x40
807#define DA9063_COMP1V2_EN 0x80
808
809/* DA9063_REG_VSYS_MON (addr=0x36) */
810#define DA9063_VSYS_VAL_MASK 0xFF
811#define DA9063_VSYS_VAL_BASE 0x00
812
813/* DA9063_REG_ADC_RES_L (addr=0x37) */
814#define DA9063_ADC_RES_L_BITS 2
815#define DA9063_ADC_RES_L_MASK 0xC0
816
817/* DA9063_REG_ADC_RES_H (addr=0x38) */
818#define DA9063_ADC_RES_M_BITS 8
819#define DA9063_ADC_RES_M_MASK 0xFF
820
821/* DA9063_REG_(xxx_RES/ADC_RES_H) (addr=0x39-0x3F) */
822#define DA9063_ADC_VAL_MASK 0xFF
823
824/* DA9063_REG_COUNT_S (addr=0x40) */
825#define DA9063_RTC_READ 0x80
826#define DA9063_COUNT_SEC_MASK 0x3F
827
828/* DA9063_REG_COUNT_MI (addr=0x41) */
829#define DA9063_COUNT_MIN_MASK 0x3F
830
831/* DA9063_REG_COUNT_H (addr=0x42) */
832#define DA9063_COUNT_HOUR_MASK 0x1F
833
834/* DA9063_REG_COUNT_D (addr=0x43) */
835#define DA9063_COUNT_DAY_MASK 0x1F
836
837/* DA9063_REG_COUNT_MO (addr=0x44) */
838#define DA9063_COUNT_MONTH_MASK 0x0F
839
840/* DA9063_REG_COUNT_Y (addr=0x45) */
841#define DA9063_COUNT_YEAR_MASK 0x3F
842#define DA9063_MONITOR 0x40
843
844/* DA9063_REG_ALARM_MI (addr=0x46) */
845#define DA9063_ALARM_STATUS_ALARM 0x80
846#define DA9063_ALARM_STATUS_TICK 0x40
847#define DA9063_ALARM_MIN_MASK 0x3F
848
849/* DA9063_REG_ALARM_H (addr=0x47) */
850#define DA9063_ALARM_HOUR_MASK 0x1F
851
852/* DA9063_REG_ALARM_D (addr=0x48) */
853#define DA9063_ALARM_DAY_MASK 0x1F
854
855/* DA9063_REG_ALARM_MO (addr=0x49) */
856#define DA9063_TICK_WAKE 0x20
857#define DA9063_TICK_TYPE 0x10
858#define DA9063_TICK_TYPE_SEC 0x00
859#define DA9063_TICK_TYPE_MIN 0x10
860#define DA9063_ALARM_MONTH_MASK 0x0F
861
862/* DA9063_REG_ALARM_Y (addr=0x4A) */
863#define DA9063_TICK_ON 0x80
864#define DA9063_ALARM_ON 0x40
865#define DA9063_ALARM_YEAR_MASK 0x3F
866
867/* DA9063_REG_WAIT (addr=0x97)*/
868#define DA9063_REG_WAIT_TIME_MASK 0xF
869#define DA9063_WAIT_TIME_0_US 0x0
870#define DA9063_WAIT_TIME_512_US 0x1
871#define DA9063_WAIT_TIME_1_MS 0x2
872#define DA9063_WAIT_TIME_2_MS 0x3
873#define DA9063_WAIT_TIME_4_1_MS 0x4
874#define DA9063_WAIT_TIME_8_2_MS 0x5
875#define DA9063_WAIT_TIME_16_4_MS 0x6
876#define DA9063_WAIT_TIME_32_8_MS 0x7
877#define DA9063_WAIT_TIME_65_5_MS 0x8
878#define DA9063_WAIT_TIME_128_MS 0x9
879#define DA9063_WAIT_TIME_256_MS 0xA
880#define DA9063_WAIT_TIME_512_MS 0xB
881#define DA9063_WAIT_TIME_1_S 0xC
882#define DA9063_WAIT_TIME_2_1_S 0xD
883
884/* DA9063_REG_EN_32K (addr=0x98)*/
885#define DA9063_STABILIZ_TIME_MASK 0x7
886#define DA9063_CRYSTAL 0x08
887#define DA9063_DELAY_MODE 0x10
888#define DA9063_OUT_CLOCK 0x20
889#define DA9063_RTC_CLOCK 0x40
890#define DA9063_OUT_32K_EN 0x80
891
892/* DA9063_REG_CHIP_VARIANT */
893#define DA9063_CHIP_VARIANT_SHIFT 4
894
895/* DA9063_REG_BUCK_ILIM_A (addr=0x9A) */
896#define DA9063_BIO_ILIM_MASK 0x0F
897#define DA9063_BMEM_ILIM_MASK 0xF0
898
899/* DA9063_REG_BUCK_ILIM_B (addr=0x9B) */
900#define DA9063_BPRO_ILIM_MASK 0x0F
901#define DA9063_BPERI_ILIM_MASK 0xF0
902
903/* DA9063_REG_BUCK_ILIM_C (addr=0x9C) */
904#define DA9063_BCORE1_ILIM_MASK 0x0F
905#define DA9063_BCORE2_ILIM_MASK 0xF0
906
907/* DA9063_REG_Bxxxx_CFG common bits (addr=0x9D-0xA2) */
908#define DA9063_BUCK_FB_MASK 0x07
909#define DA9063_BUCK_PD_DIS_SHIFT 5
910#define DA9063_BUCK_MODE_MASK 0xC0
911#define DA9063_BUCK_MODE_MANUAL 0x00
912#define DA9063_BUCK_MODE_SLEEP 0x40
913#define DA9063_BUCK_MODE_SYNC 0x80
914#define DA9063_BUCK_MODE_AUTO 0xC0
915
916/* DA9063_REG_BPRO_CFG (addr=0x9F) */
917#define DA9063_BPRO_VTTR_EN 0x08
918#define DA9063_BPRO_VTT_EN 0x10
919
920/* DA9063_REG_VBxxxx_A/B (addr=0xA3-0xA8, 0xB4-0xB9) */
921#define DA9063_VBUCK_MASK 0x7F
922#define DA9063_VBUCK_BIAS 0
923#define DA9063_BUCK_SL 0x80
924
925/* DA9063_REG_VLDOx_A/B (addr=0xA9-0x3, 0xBA-0xC4) */
926#define DA9063_LDO_SL 0x80
927
928/* DA9063_REG_VLDO1_A/B (addr=0xA9, 0xBA) */
929#define DA9063_VLDO1_MASK 0x3F
930#define DA9063_VLDO1_BIAS 0
931
932/* DA9063_REG_VLDO2_A/B (addr=0xAA, 0xBB) */
933#define DA9063_VLDO2_MASK 0x3F
934#define DA9063_VLDO2_BIAS 0
935
936/* DA9063_REG_VLDO3_A/B (addr=0xAB, 0xBC) */
937#define DA9063_VLDO3_MASK 0x7F
938#define DA9063_VLDO3_BIAS 0
939
940/* DA9063_REG_VLDO4_A/B (addr=0xAC, 0xBD) */
941#define DA9063_VLDO4_MASK 0x7F
942#define DA9063_VLDO4_BIAS 0
943
944/* DA9063_REG_VLDO5_A/B (addr=0xAD, 0xBE) */
945#define DA9063_VLDO5_MASK 0x3F
946#define DA9063_VLDO5_BIAS 2
947
948/* DA9063_REG_VLDO6_A/B (addr=0xAE, 0xBF) */
949#define DA9063_VLDO6_MASK 0x3F
950#define DA9063_VLDO6_BIAS 2
951
952/* DA9063_REG_VLDO7_A/B (addr=0xAF, 0xC0) */
953#define DA9063_VLDO7_MASK 0x3F
954#define DA9063_VLDO7_BIAS 2
955
956/* DA9063_REG_VLDO8_A/B (addr=0xB0, 0xC1) */
957#define DA9063_VLDO8_MASK 0x3F
958#define DA9063_VLDO8_BIAS 2
959
960/* DA9063_REG_VLDO9_A/B (addr=0xB1, 0xC2) */
961#define DA9063_VLDO9_MASK 0x3F
962#define DA9063_VLDO9_BIAS 3
963
964/* DA9063_REG_VLDO10_A/B (addr=0xB2, 0xC3) */
965#define DA9063_VLDO10_MASK 0x3F
966#define DA9063_VLDO10_BIAS 2
967
968/* DA9063_REG_VLDO11_A/B (addr=0xB3, 0xC4) */
969#define DA9063_VLDO11_MASK 0x3F
970#define DA9063_VLDO11_BIAS 2
971
972/* DA9063_REG_GPO11_LED (addr=0xC6) */
973/* DA9063_REG_GPO14_LED (addr=0xC7) */
974/* DA9063_REG_GPO15_LED (addr=0xC8) */
975#define DA9063_GPIO_DIM 0x80
976#define DA9063_GPIO_PWM_MASK 0x7F
977
978/* DA9063_REG_CONFIG_H (addr=0x10D) */
979#define DA9063_PWM_CLK_MASK 0x01
980#define DA9063_PWM_CLK_PWM2MHZ 0x00
981#define DA9063_PWM_CLK_PWM1MHZ 0x01
982#define DA9063_LDO8_MODE_MASK 0x02
983#define DA9063_LDO8_MODE_LDO 0
984#define DA9063_LDO8_MODE_VIBR 0x02
985#define DA9063_MERGE_SENSE_MASK 0x04
986#define DA9063_MERGE_SENSE_GP_FB2 0x00
987#define DA9063_MERGE_SENSE_GPIO4 0x04
988#define DA9063_BCORE_MERGE 0x08
989#define DA9063_BPRO_OD 0x10
990#define DA9063_BCORE2_OD 0x20
991#define DA9063_BCORE1_OD 0x40
992#define DA9063_BUCK_MERGE 0x80
993
994/* DA9063_REG_CONFIG_I (addr=0x10E) */
995#define DA9063_NONKEY_PIN_MASK 0x03
996#define DA9063_NONKEY_PIN_PORT 0x00
997#define DA9063_NONKEY_PIN_SWDOWN 0x01
998#define DA9063_NONKEY_PIN_AUTODOWN 0x02
999#define DA9063_NONKEY_PIN_AUTOFLPRT 0x03
1000
1001/* DA9063_REG_MON_REG_5 (addr=0x116) */
1002#define DA9063_MON_A8_IDX_MASK 0x07
1003#define DA9063_MON_A8_IDX_NONE 0x00
1004#define DA9063_MON_A8_IDX_BCORE1 0x01
1005#define DA9063_MON_A8_IDX_BCORE2 0x02
1006#define DA9063_MON_A8_IDX_BPRO 0x03
1007#define DA9063_MON_A8_IDX_LDO3 0x04
1008#define DA9063_MON_A8_IDX_LDO4 0x05
1009#define DA9063_MON_A8_IDX_LDO11 0x06
1010#define DA9063_MON_A9_IDX_MASK 0x70
1011#define DA9063_MON_A9_IDX_NONE 0x00
1012#define DA9063_MON_A9_IDX_BIO 0x01
1013#define DA9063_MON_A9_IDX_BMEM 0x02
1014#define DA9063_MON_A9_IDX_BPERI 0x03
1015#define DA9063_MON_A9_IDX_LDO1 0x04
1016#define DA9063_MON_A9_IDX_LDO2 0x05
1017#define DA9063_MON_A9_IDX_LDO5 0x06
1018
1019/* DA9063_REG_MON_REG_6 (addr=0x117) */
1020#define DA9063_MON_A10_IDX_MASK 0x07
1021#define DA9063_MON_A10_IDX_NONE 0x00
1022#define DA9063_MON_A10_IDX_LDO6 0x01
1023#define DA9063_MON_A10_IDX_LDO7 0x02
1024#define DA9063_MON_A10_IDX_LDO8 0x03
1025#define DA9063_MON_A10_IDX_LDO9 0x04
1026#define DA9063_MON_A10_IDX_LDO10 0x05
1027
1028#endif /* _DA9063_REG_H */
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h
index 0ab61320ffa8..5166935ce66d 100644
--- a/include/linux/mfd/davinci_voicecodec.h
+++ b/include/linux/mfd/davinci_voicecodec.h
@@ -26,8 +26,11 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/mfd/core.h> 28#include <linux/mfd/core.h>
29#include <linux/platform_data/edma.h>
29 30
30#include <mach/edma.h> 31#include <mach/hardware.h>
32
33struct regmap;
31 34
32/* 35/*
33 * Register values. 36 * Register values.
@@ -112,8 +115,7 @@ struct davinci_vc {
112 115
113 /* Memory resources */ 116 /* Memory resources */
114 void __iomem *base; 117 void __iomem *base;
115 resource_size_t pbase; 118 struct regmap *regmap;
116 size_t base_size;
117 119
118 /* MFD cells */ 120 /* MFD cells */
119 struct mfd_cell cells[DAVINCI_VC_CELLS]; 121 struct mfd_cell cells[DAVINCI_VC_CELLS];
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index 689e6a0d9c99..ca0790fba2f5 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -134,6 +134,11 @@ enum prcmu_clock {
134 PRCMU_SIACLK, 134 PRCMU_SIACLK,
135 PRCMU_SVACLK, 135 PRCMU_SVACLK,
136 PRCMU_ACLK, 136 PRCMU_ACLK,
137 PRCMU_HVACLK, /* Ux540 only */
138 PRCMU_G1CLK, /* Ux540 only */
139 PRCMU_SDMMCHCLK,
140 PRCMU_CAMCLK,
141 PRCMU_BML8580CLK,
137 PRCMU_NUM_REG_CLOCKS, 142 PRCMU_NUM_REG_CLOCKS,
138 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS, 143 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS,
139 PRCMU_CDCLK, 144 PRCMU_CDCLK,
@@ -148,6 +153,13 @@ enum prcmu_clock {
148 PRCMU_DSI0ESCCLK, 153 PRCMU_DSI0ESCCLK,
149 PRCMU_DSI1ESCCLK, 154 PRCMU_DSI1ESCCLK,
150 PRCMU_DSI2ESCCLK, 155 PRCMU_DSI2ESCCLK,
156 /* LCD DSI PLL - Ux540 only */
157 PRCMU_PLLDSI_LCD,
158 PRCMU_DSI0CLK_LCD,
159 PRCMU_DSI1CLK_LCD,
160 PRCMU_DSI0ESCCLK_LCD,
161 PRCMU_DSI1ESCCLK_LCD,
162 PRCMU_DSI2ESCCLK_LCD,
151}; 163};
152 164
153/** 165/**
diff --git a/include/linux/mfd/kempld.h b/include/linux/mfd/kempld.h
new file mode 100644
index 000000000000..b911ef3add03
--- /dev/null
+++ b/include/linux/mfd/kempld.h
@@ -0,0 +1,125 @@
1/*
2 * Kontron PLD driver definitions
3 *
4 * Copyright (c) 2010-2012 Kontron Europe GmbH
5 * Author: Michael Brunner <michael.brunner@kontron.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License 2 as published
9 * by the Free Software Foundation.
10 */
11
12#ifndef _LINUX_MFD_KEMPLD_H_
13#define _LINUX_MFD_KEMPLD_H_
14
15/* kempld register definitions */
16#define KEMPLD_IOINDEX 0xa80
17#define KEMPLD_IODATA 0xa81
18#define KEMPLD_MUTEX_KEY 0x80
19#define KEMPLD_VERSION 0x00
20#define KEMPLD_VERSION_LSB 0x00
21#define KEMPLD_VERSION_MSB 0x01
22#define KEMPLD_VERSION_GET_MINOR(x) (x & 0x1f)
23#define KEMPLD_VERSION_GET_MAJOR(x) ((x >> 5) & 0x1f)
24#define KEMPLD_VERSION_GET_NUMBER(x) ((x >> 10) & 0xf)
25#define KEMPLD_VERSION_GET_TYPE(x) ((x >> 14) & 0x3)
26#define KEMPLD_BUILDNR 0x02
27#define KEMPLD_BUILDNR_LSB 0x02
28#define KEMPLD_BUILDNR_MSB 0x03
29#define KEMPLD_FEATURE 0x04
30#define KEMPLD_FEATURE_LSB 0x04
31#define KEMPLD_FEATURE_MSB 0x05
32#define KEMPLD_FEATURE_BIT_I2C (1 << 0)
33#define KEMPLD_FEATURE_BIT_WATCHDOG (1 << 1)
34#define KEMPLD_FEATURE_BIT_GPIO (1 << 2)
35#define KEMPLD_FEATURE_MASK_UART (7 << 3)
36#define KEMPLD_FEATURE_BIT_NMI (1 << 8)
37#define KEMPLD_FEATURE_BIT_SMI (1 << 9)
38#define KEMPLD_FEATURE_BIT_SCI (1 << 10)
39#define KEMPLD_SPEC 0x06
40#define KEMPLD_SPEC_GET_MINOR(x) (x & 0x0f)
41#define KEMPLD_SPEC_GET_MAJOR(x) ((x >> 4) & 0x0f)
42#define KEMPLD_IRQ_GPIO 0x35
43#define KEMPLD_IRQ_I2C 0x36
44#define KEMPLD_CFG 0x37
45#define KEMPLD_CFG_GPIO_I2C_MUX (1 << 0)
46#define KEMPLD_CFG_BIOS_WP (1 << 7)
47
48#define KEMPLD_CLK 33333333
49
50#define KEMPLD_TYPE_RELEASE 0x0
51#define KEMPLD_TYPE_DEBUG 0x1
52#define KEMPLD_TYPE_CUSTOM 0x2
53
54/**
55 * struct kempld_info - PLD device information structure
56 * @major: PLD major revision
57 * @minor: PLD minor revision
58 * @buildnr: PLD build number
59 * @number: PLD board specific index
60 * @type: PLD type
61 * @spec_major: PLD FW specification major revision
62 * @spec_minor: PLD FW specification minor revision
63 */
64struct kempld_info {
65 unsigned int major;
66 unsigned int minor;
67 unsigned int buildnr;
68 unsigned int number;
69 unsigned int type;
70 unsigned int spec_major;
71 unsigned int spec_minor;
72};
73
74/**
75 * struct kempld_device_data - Internal representation of the PLD device
76 * @io_base: Pointer to the IO memory
77 * @io_index: Pointer to the IO index register
78 * @io_data: Pointer to the IO data register
79 * @pld_clock: PLD clock frequency
80 * @feature_mask: PLD feature mask
81 * @dev: Pointer to kernel device structure
82 * @info: KEMPLD info structure
83 * @lock: PLD mutex
84 */
85struct kempld_device_data {
86 void __iomem *io_base;
87 void __iomem *io_index;
88 void __iomem *io_data;
89 u32 pld_clock;
90 u32 feature_mask;
91 struct device *dev;
92 struct kempld_info info;
93 struct mutex lock;
94};
95
96/**
97 * struct kempld_platform_data - PLD hardware configuration structure
98 * @pld_clock: PLD clock frequency
99 * @gpio_base GPIO base pin number
100 * @ioresource: IO addresses of the PLD
101 * @get_mutex: PLD specific get_mutex callback
102 * @release_mutex: PLD specific release_mutex callback
103 * @get_info: PLD specific get_info callback
104 * @register_cells: PLD specific register_cells callback
105 */
106struct kempld_platform_data {
107 u32 pld_clock;
108 int gpio_base;
109 struct resource *ioresource;
110 void (*get_hardware_mutex) (struct kempld_device_data *);
111 void (*release_hardware_mutex) (struct kempld_device_data *);
112 int (*get_info) (struct kempld_device_data *);
113 int (*register_cells) (struct kempld_device_data *);
114};
115
116extern void kempld_get_mutex(struct kempld_device_data *pld);
117extern void kempld_release_mutex(struct kempld_device_data *pld);
118extern u8 kempld_read8(struct kempld_device_data *pld, u8 index);
119extern void kempld_write8(struct kempld_device_data *pld, u8 index, u8 data);
120extern u16 kempld_read16(struct kempld_device_data *pld, u8 index);
121extern void kempld_write16(struct kempld_device_data *pld, u8 index, u16 data);
122extern u32 kempld_read32(struct kempld_device_data *pld, u8 index);
123extern void kempld_write32(struct kempld_device_data *pld, u8 index, u32 data);
124
125#endif /* _LINUX_MFD_KEMPLD_H_ */
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 1aa4f13cdfa6..244fb0d51589 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -85,6 +85,19 @@ enum max77693_pmic_reg {
85 MAX77693_PMIC_REG_END, 85 MAX77693_PMIC_REG_END,
86}; 86};
87 87
88/* MAX77693 CHG_CNFG_00 register */
89#define CHG_CNFG_00_CHG_MASK 0x1
90#define CHG_CNFG_00_BUCK_MASK 0x4
91
92/* MAX77693 CHG_CNFG_09 Register */
93#define CHG_CNFG_09_CHGIN_ILIM_MASK 0x7F
94
95/* MAX77693 CHG_CTRL Register */
96#define SAFEOUT_CTRL_SAFEOUT1_MASK 0x3
97#define SAFEOUT_CTRL_SAFEOUT2_MASK 0xC
98#define SAFEOUT_CTRL_ENSAFEOUT1_MASK 0x40
99#define SAFEOUT_CTRL_ENSAFEOUT2_MASK 0x80
100
88/* Slave addr = 0x4A: MUIC */ 101/* Slave addr = 0x4A: MUIC */
89enum max77693_muic_reg { 102enum max77693_muic_reg {
90 MAX77693_MUIC_REG_ID = 0x00, 103 MAX77693_MUIC_REG_ID = 0x00,
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index 3109a6c5c948..676f0f388992 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -30,6 +30,20 @@
30#ifndef __LINUX_MFD_MAX77693_H 30#ifndef __LINUX_MFD_MAX77693_H
31#define __LINUX_MFD_MAX77693_H 31#define __LINUX_MFD_MAX77693_H
32 32
33/* MAX77686 regulator IDs */
34enum max77693_regulators {
35 MAX77693_ESAFEOUT1 = 0,
36 MAX77693_ESAFEOUT2,
37 MAX77693_CHARGER,
38 MAX77693_REG_MAX,
39};
40
41struct max77693_regulator_data {
42 int id;
43 struct regulator_init_data *initdata;
44 struct device_node *of_node;
45};
46
33struct max77693_reg_data { 47struct max77693_reg_data {
34 u8 addr; 48 u8 addr;
35 u8 data; 49 u8 data;
@@ -52,6 +66,10 @@ struct max77693_muic_platform_data {
52struct max77693_platform_data { 66struct max77693_platform_data {
53 int wakeup; 67 int wakeup;
54 68
69 /* regulator data */
70 struct max77693_regulator_data *regulators;
71 int num_regulators;
72
55 /* muic data */ 73 /* muic data */
56 struct max77693_muic_platform_data *muic_data; 74 struct max77693_muic_platform_data *muic_data;
57}; 75};
diff --git a/include/linux/mfd/max8998-private.h b/include/linux/mfd/max8998-private.h
index effa5d3b96ae..84844e0a5704 100644
--- a/include/linux/mfd/max8998-private.h
+++ b/include/linux/mfd/max8998-private.h
@@ -132,9 +132,12 @@ enum {
132 132
133#define MAX8998_ENRAMP (1 << 4) 133#define MAX8998_ENRAMP (1 << 4)
134 134
135struct irq_domain;
136
135/** 137/**
136 * struct max8998_dev - max8998 master device for sub-drivers 138 * struct max8998_dev - max8998 master device for sub-drivers
137 * @dev: master device of the chip (can be used to access platform data) 139 * @dev: master device of the chip (can be used to access platform data)
140 * @pdata: platform data for the driver and subdrivers
138 * @i2c: i2c client private data for regulator 141 * @i2c: i2c client private data for regulator
139 * @rtc: i2c client private data for rtc 142 * @rtc: i2c client private data for rtc
140 * @iolock: mutex for serializing io access 143 * @iolock: mutex for serializing io access
@@ -148,12 +151,14 @@ enum {
148 */ 151 */
149struct max8998_dev { 152struct max8998_dev {
150 struct device *dev; 153 struct device *dev;
154 struct max8998_platform_data *pdata;
151 struct i2c_client *i2c; 155 struct i2c_client *i2c;
152 struct i2c_client *rtc; 156 struct i2c_client *rtc;
153 struct mutex iolock; 157 struct mutex iolock;
154 struct mutex irqlock; 158 struct mutex irqlock;
155 159
156 int irq_base; 160 unsigned int irq_base;
161 struct irq_domain *irq_domain;
157 int irq; 162 int irq;
158 int ono; 163 int ono;
159 u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS]; 164 u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS];
diff --git a/include/linux/mfd/max8998.h b/include/linux/mfd/max8998.h
index 6823548d0c0a..e3956a654cbc 100644
--- a/include/linux/mfd/max8998.h
+++ b/include/linux/mfd/max8998.h
@@ -58,10 +58,12 @@ enum {
58 * max8998_regulator_data - regulator data 58 * max8998_regulator_data - regulator data
59 * @id: regulator id 59 * @id: regulator id
60 * @initdata: regulator init data (contraints, supplies, ...) 60 * @initdata: regulator init data (contraints, supplies, ...)
61 * @reg_node: DT node of regulator (unused on non-DT platforms)
61 */ 62 */
62struct max8998_regulator_data { 63struct max8998_regulator_data {
63 int id; 64 int id;
64 struct regulator_init_data *initdata; 65 struct regulator_init_data *initdata;
66 struct device_node *reg_node;
65}; 67};
66 68
67/** 69/**
@@ -73,12 +75,8 @@ struct max8998_regulator_data {
73 * @buck_voltage_lock: Do NOT change the values of the following six 75 * @buck_voltage_lock: Do NOT change the values of the following six
74 * registers set by buck?_voltage?. The voltage of BUCK1/2 cannot 76 * registers set by buck?_voltage?. The voltage of BUCK1/2 cannot
75 * be other than the preset values. 77 * be other than the preset values.
76 * @buck1_voltage1: BUCK1 DVS mode 1 voltage register 78 * @buck1_voltage: BUCK1 DVS mode 1 voltage registers
77 * @buck1_voltage2: BUCK1 DVS mode 2 voltage register 79 * @buck2_voltage: BUCK2 DVS mode 2 voltage registers
78 * @buck1_voltage3: BUCK1 DVS mode 3 voltage register
79 * @buck1_voltage4: BUCK1 DVS mode 4 voltage register
80 * @buck2_voltage1: BUCK2 DVS mode 1 voltage register
81 * @buck2_voltage2: BUCK2 DVS mode 2 voltage register
82 * @buck1_set1: BUCK1 gpio pin 1 to set output voltage 80 * @buck1_set1: BUCK1 gpio pin 1 to set output voltage
83 * @buck1_set2: BUCK1 gpio pin 2 to set output voltage 81 * @buck1_set2: BUCK1 gpio pin 2 to set output voltage
84 * @buck1_default_idx: Default for BUCK1 gpio pin 1, 2 82 * @buck1_default_idx: Default for BUCK1 gpio pin 1, 2
@@ -100,15 +98,11 @@ struct max8998_regulator_data {
100struct max8998_platform_data { 98struct max8998_platform_data {
101 struct max8998_regulator_data *regulators; 99 struct max8998_regulator_data *regulators;
102 int num_regulators; 100 int num_regulators;
103 int irq_base; 101 unsigned int irq_base;
104 int ono; 102 int ono;
105 bool buck_voltage_lock; 103 bool buck_voltage_lock;
106 int buck1_voltage1; 104 int buck1_voltage[4];
107 int buck1_voltage2; 105 int buck2_voltage[2];
108 int buck1_voltage3;
109 int buck1_voltage4;
110 int buck2_voltage1;
111 int buck2_voltage2;
112 int buck1_set1; 106 int buck1_set1;
113 int buck1_set2; 107 int buck1_set2;
114 int buck1_default_idx; 108 int buck1_default_idx;
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index bf070755982e..41ed59276c00 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -78,20 +78,30 @@ struct mc13xxx_regulator_platform_data {
78 struct mc13xxx_regulator_init_data *regulators; 78 struct mc13xxx_regulator_init_data *regulators;
79}; 79};
80 80
81enum {
82 /* MC13783 LED IDs */
83 MC13783_LED_MD,
84 MC13783_LED_AD,
85 MC13783_LED_KP,
86 MC13783_LED_R1,
87 MC13783_LED_G1,
88 MC13783_LED_B1,
89 MC13783_LED_R2,
90 MC13783_LED_G2,
91 MC13783_LED_B2,
92 MC13783_LED_R3,
93 MC13783_LED_G3,
94 MC13783_LED_B3,
95 /* MC13892 LED IDs */
96 MC13892_LED_MD,
97 MC13892_LED_AD,
98 MC13892_LED_KP,
99 MC13892_LED_R,
100 MC13892_LED_G,
101 MC13892_LED_B,
102};
103
81struct mc13xxx_led_platform_data { 104struct mc13xxx_led_platform_data {
82#define MC13783_LED_MD 0
83#define MC13783_LED_AD 1
84#define MC13783_LED_KP 2
85#define MC13783_LED_R1 3
86#define MC13783_LED_G1 4
87#define MC13783_LED_B1 5
88#define MC13783_LED_R2 6
89#define MC13783_LED_G2 7
90#define MC13783_LED_B2 8
91#define MC13783_LED_R3 9
92#define MC13783_LED_G3 10
93#define MC13783_LED_B3 11
94#define MC13783_LED_MAX MC13783_LED_B3
95 int id; 105 int id;
96 const char *name; 106 const char *name;
97 const char *default_trigger; 107 const char *default_trigger;
@@ -100,46 +110,36 @@ struct mc13xxx_led_platform_data {
100 char max_current; 110 char max_current;
101}; 111};
102 112
113#define MAX_LED_CONTROL_REGS 6
114
103struct mc13xxx_leds_platform_data { 115struct mc13xxx_leds_platform_data {
104 int num_leds;
105 struct mc13xxx_led_platform_data *led; 116 struct mc13xxx_led_platform_data *led;
117 int num_leds;
106 118
107#define MC13783_LED_TRIODE_MD (1 << 0) 119/* LED Control 0 */
108#define MC13783_LED_TRIODE_AD (1 << 1) 120#define MC13783_LED_C0_ENABLE (1 << 0)
109#define MC13783_LED_TRIODE_KP (1 << 2) 121#define MC13783_LED_C0_TRIODE_MD (1 << 7)
110#define MC13783_LED_BOOST_EN (1 << 3) 122#define MC13783_LED_C0_TRIODE_AD (1 << 8)
111#define MC13783_LED_TC1HALF (1 << 4) 123#define MC13783_LED_C0_TRIODE_KP (1 << 9)
112#define MC13783_LED_SLEWLIMTC (1 << 5) 124#define MC13783_LED_C0_BOOST (1 << 10)
113#define MC13783_LED_SLEWLIMBL (1 << 6) 125#define MC13783_LED_C0_ABMODE(x) (((x) & 0x7) << 11)
114#define MC13783_LED_TRIODE_TC1 (1 << 7) 126#define MC13783_LED_C0_ABREF(x) (((x) & 0x3) << 14)
115#define MC13783_LED_TRIODE_TC2 (1 << 8) 127/* LED Control 1 */
116#define MC13783_LED_TRIODE_TC3 (1 << 9) 128#define MC13783_LED_C1_TC1HALF (1 << 18)
117 int flags; 129#define MC13783_LED_C1_SLEWLIM (1 << 23)
118 130/* LED Control 2 */
119#define MC13783_LED_AB_DISABLED 0 131#define MC13783_LED_C2_PERIOD(x) (((x) & 0x3) << 21)
120#define MC13783_LED_AB_MD1 1 132#define MC13783_LED_C2_SLEWLIM (1 << 23)
121#define MC13783_LED_AB_MD12 2 133/* LED Control 3 */
122#define MC13783_LED_AB_MD123 3 134#define MC13783_LED_C3_PERIOD(x) (((x) & 0x3) << 21)
123#define MC13783_LED_AB_MD1234 4 135#define MC13783_LED_C3_TRIODE_TC1 (1 << 23)
124#define MC13783_LED_AB_MD1234_AD1 5 136/* LED Control 4 */
125#define MC13783_LED_AB_MD1234_AD12 6 137#define MC13783_LED_C4_PERIOD(x) (((x) & 0x3) << 21)
126#define MC13783_LED_AB_MD1_AD 7 138#define MC13783_LED_C4_TRIODE_TC2 (1 << 23)
127 char abmode; 139/* LED Control 5 */
128 140#define MC13783_LED_C5_PERIOD(x) (((x) & 0x3) << 21)
129#define MC13783_LED_ABREF_200MV 0 141#define MC13783_LED_C5_TRIODE_TC3 (1 << 23)
130#define MC13783_LED_ABREF_400MV 1 142 u32 led_control[MAX_LED_CONTROL_REGS];
131#define MC13783_LED_ABREF_600MV 2
132#define MC13783_LED_ABREF_800MV 3
133 char abref;
134
135#define MC13783_LED_PERIOD_10MS 0
136#define MC13783_LED_PERIOD_100MS 1
137#define MC13783_LED_PERIOD_500MS 2
138#define MC13783_LED_PERIOD_2S 3
139 char bl_period;
140 char tc1_period;
141 char tc2_period;
142 char tc3_period;
143}; 143};
144 144
145struct mc13xxx_buttons_platform_data { 145struct mc13xxx_buttons_platform_data {
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h
index a9e8bd157673..f682953043ba 100644
--- a/include/linux/mfd/mcp.h
+++ b/include/linux/mfd/mcp.h
@@ -10,6 +10,8 @@
10#ifndef MCP_H 10#ifndef MCP_H
11#define MCP_H 11#define MCP_H
12 12
13#include <linux/device.h>
14
13struct mcp_ops; 15struct mcp_ops;
14 16
15struct mcp { 17struct mcp {
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 8f21daf62fb5..9974e387e483 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -20,6 +20,8 @@
20#include <linux/leds.h> 20#include <linux/leds.h>
21#include <linux/regmap.h> 21#include <linux/regmap.h>
22#include <linux/regulator/driver.h> 22#include <linux/regulator/driver.h>
23#include <linux/extcon.h>
24#include <linux/usb/phy_companion.h>
23 25
24#define PALMAS_NUM_CLIENTS 3 26#define PALMAS_NUM_CLIENTS 3
25 27
@@ -32,11 +34,30 @@
32 ((a) == PALMAS_CHIP_ID)) 34 ((a) == PALMAS_CHIP_ID))
33#define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID) 35#define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID)
34 36
37/**
38 * Palmas PMIC feature types
39 *
40 * PALMAS_PMIC_FEATURE_SMPS10_BOOST - used when the PMIC provides SMPS10_BOOST
41 * regulator.
42 *
43 * PALMAS_PMIC_HAS(b, f) - macro to check if a bandgap device is capable of a
44 * specific feature (above) or not. Return non-zero, if yes.
45 */
46#define PALMAS_PMIC_FEATURE_SMPS10_BOOST BIT(0)
47#define PALMAS_PMIC_HAS(b, f) \
48 ((b)->features & PALMAS_PMIC_FEATURE_ ## f)
49
35struct palmas_pmic; 50struct palmas_pmic;
36struct palmas_gpadc; 51struct palmas_gpadc;
37struct palmas_resource; 52struct palmas_resource;
38struct palmas_usb; 53struct palmas_usb;
39 54
55enum palmas_usb_state {
56 PALMAS_USB_STATE_DISCONNECT,
57 PALMAS_USB_STATE_VBUS,
58 PALMAS_USB_STATE_ID,
59};
60
40struct palmas { 61struct palmas {
41 struct device *dev; 62 struct device *dev;
42 63
@@ -46,6 +67,7 @@ struct palmas {
46 /* Stored chip id */ 67 /* Stored chip id */
47 int id; 68 int id;
48 69
70 unsigned int features;
49 /* IRQ Data */ 71 /* IRQ Data */
50 int irq; 72 int irq;
51 u32 irq_mask; 73 u32 irq_mask;
@@ -138,7 +160,8 @@ enum palmas_regulators {
138 PALMAS_REG_SMPS7, 160 PALMAS_REG_SMPS7,
139 PALMAS_REG_SMPS8, 161 PALMAS_REG_SMPS8,
140 PALMAS_REG_SMPS9, 162 PALMAS_REG_SMPS9,
141 PALMAS_REG_SMPS10, 163 PALMAS_REG_SMPS10_OUT2,
164 PALMAS_REG_SMPS10_OUT1,
142 /* LDO regulators */ 165 /* LDO regulators */
143 PALMAS_REG_LDO1, 166 PALMAS_REG_LDO1,
144 PALMAS_REG_LDO2, 167 PALMAS_REG_LDO2,
@@ -161,6 +184,50 @@ enum palmas_regulators {
161 PALMAS_NUM_REGS, 184 PALMAS_NUM_REGS,
162}; 185};
163 186
187/* External controll signal name */
188enum {
189 PALMAS_EXT_CONTROL_ENABLE1 = 0x1,
190 PALMAS_EXT_CONTROL_ENABLE2 = 0x2,
191 PALMAS_EXT_CONTROL_NSLEEP = 0x4,
192};
193
194/*
195 * Palmas device resources can be controlled externally for
196 * enabling/disabling it rather than register write through i2c.
197 * Add the external controlled requestor ID for different resources.
198 */
199enum palmas_external_requestor_id {
200 PALMAS_EXTERNAL_REQSTR_ID_REGEN1,
201 PALMAS_EXTERNAL_REQSTR_ID_REGEN2,
202 PALMAS_EXTERNAL_REQSTR_ID_SYSEN1,
203 PALMAS_EXTERNAL_REQSTR_ID_SYSEN2,
204 PALMAS_EXTERNAL_REQSTR_ID_CLK32KG,
205 PALMAS_EXTERNAL_REQSTR_ID_CLK32KGAUDIO,
206 PALMAS_EXTERNAL_REQSTR_ID_REGEN3,
207 PALMAS_EXTERNAL_REQSTR_ID_SMPS12,
208 PALMAS_EXTERNAL_REQSTR_ID_SMPS3,
209 PALMAS_EXTERNAL_REQSTR_ID_SMPS45,
210 PALMAS_EXTERNAL_REQSTR_ID_SMPS6,
211 PALMAS_EXTERNAL_REQSTR_ID_SMPS7,
212 PALMAS_EXTERNAL_REQSTR_ID_SMPS8,
213 PALMAS_EXTERNAL_REQSTR_ID_SMPS9,
214 PALMAS_EXTERNAL_REQSTR_ID_SMPS10,
215 PALMAS_EXTERNAL_REQSTR_ID_LDO1,
216 PALMAS_EXTERNAL_REQSTR_ID_LDO2,
217 PALMAS_EXTERNAL_REQSTR_ID_LDO3,
218 PALMAS_EXTERNAL_REQSTR_ID_LDO4,
219 PALMAS_EXTERNAL_REQSTR_ID_LDO5,
220 PALMAS_EXTERNAL_REQSTR_ID_LDO6,
221 PALMAS_EXTERNAL_REQSTR_ID_LDO7,
222 PALMAS_EXTERNAL_REQSTR_ID_LDO8,
223 PALMAS_EXTERNAL_REQSTR_ID_LDO9,
224 PALMAS_EXTERNAL_REQSTR_ID_LDOLN,
225 PALMAS_EXTERNAL_REQSTR_ID_LDOUSB,
226
227 /* Last entry */
228 PALMAS_EXTERNAL_REQSTR_ID_MAX,
229};
230
164struct palmas_pmic_platform_data { 231struct palmas_pmic_platform_data {
165 /* An array of pointers to regulator init data indexed by regulator 232 /* An array of pointers to regulator init data indexed by regulator
166 * ID 233 * ID
@@ -180,9 +247,6 @@ struct palmas_pmic_platform_data {
180}; 247};
181 248
182struct palmas_usb_platform_data { 249struct palmas_usb_platform_data {
183 /* Set this if platform wishes its own vbus control */
184 int no_control_vbus;
185
186 /* Do we enable the wakeup comparator on probe */ 250 /* Do we enable the wakeup comparator on probe */
187 int wakeup; 251 int wakeup;
188}; 252};
@@ -239,6 +303,7 @@ struct palmas_platform_data {
239 */ 303 */
240 int mux_from_pdata; 304 int mux_from_pdata;
241 u8 pad1, pad2; 305 u8 pad1, pad2;
306 bool pm_off;
242 307
243 struct palmas_pmic_platform_data *pmic_pdata; 308 struct palmas_pmic_platform_data *pmic_pdata;
244 struct palmas_gpadc_platform_data *gpadc_pdata; 309 struct palmas_gpadc_platform_data *gpadc_pdata;
@@ -336,9 +401,9 @@ struct palmas_pmic {
336 int smps123; 401 int smps123;
337 int smps457; 402 int smps457;
338 403
339 int range[PALMAS_REG_SMPS10]; 404 int range[PALMAS_REG_SMPS10_OUT1];
340 unsigned int ramp_delay[PALMAS_REG_SMPS10]; 405 unsigned int ramp_delay[PALMAS_REG_SMPS10_OUT1];
341 unsigned int current_reg_mode[PALMAS_REG_SMPS10]; 406 unsigned int current_reg_mode[PALMAS_REG_SMPS10_OUT1];
342}; 407};
343 408
344struct palmas_resource { 409struct palmas_resource {
@@ -350,22 +415,17 @@ struct palmas_usb {
350 struct palmas *palmas; 415 struct palmas *palmas;
351 struct device *dev; 416 struct device *dev;
352 417
353 /* for vbus reporting with irqs disabled */ 418 struct extcon_dev edev;
354 spinlock_t lock;
355
356 struct regulator *vbus_reg;
357
358 /* used to set vbus, in atomic path */
359 struct work_struct set_vbus_work;
360 419
361 int irq1; 420 int id_otg_irq;
362 int irq2; 421 int id_irq;
363 int irq3; 422 int vbus_otg_irq;
364 int irq4; 423 int vbus_irq;
365 424
366 int vbus_enable; 425 enum palmas_usb_state linkstat;
367 426 int wakeup;
368 u8 linkstat; 427 bool enable_vbus_detection;
428 bool enable_id_detection;
369}; 429};
370 430
371#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator) 431#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator)
@@ -433,7 +493,7 @@ enum usb_irq_events {
433#define PALMAS_DVFS_BASE 0x180 493#define PALMAS_DVFS_BASE 0x180
434#define PALMAS_PMU_CONTROL_BASE 0x1A0 494#define PALMAS_PMU_CONTROL_BASE 0x1A0
435#define PALMAS_RESOURCE_BASE 0x1D4 495#define PALMAS_RESOURCE_BASE 0x1D4
436#define PALMAS_PU_PD_OD_BASE 0x1F4 496#define PALMAS_PU_PD_OD_BASE 0x1F0
437#define PALMAS_LED_BASE 0x200 497#define PALMAS_LED_BASE 0x200
438#define PALMAS_INTERRUPT_BASE 0x210 498#define PALMAS_INTERRUPT_BASE 0x210
439#define PALMAS_USB_OTG_BASE 0x250 499#define PALMAS_USB_OTG_BASE 0x250
@@ -1718,16 +1778,20 @@ enum usb_irq_events {
1718#define PALMAS_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0 1778#define PALMAS_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0
1719 1779
1720/* Registers for function PAD_CONTROL */ 1780/* Registers for function PAD_CONTROL */
1721#define PALMAS_PU_PD_INPUT_CTRL1 0x0 1781#define PALMAS_OD_OUTPUT_CTRL2 0x2
1722#define PALMAS_PU_PD_INPUT_CTRL2 0x1 1782#define PALMAS_POLARITY_CTRL2 0x3
1723#define PALMAS_PU_PD_INPUT_CTRL3 0x2 1783#define PALMAS_PU_PD_INPUT_CTRL1 0x4
1724#define PALMAS_OD_OUTPUT_CTRL 0x4 1784#define PALMAS_PU_PD_INPUT_CTRL2 0x5
1725#define PALMAS_POLARITY_CTRL 0x5 1785#define PALMAS_PU_PD_INPUT_CTRL3 0x6
1726#define PALMAS_PRIMARY_SECONDARY_PAD1 0x6 1786#define PALMAS_PU_PD_INPUT_CTRL5 0x7
1727#define PALMAS_PRIMARY_SECONDARY_PAD2 0x7 1787#define PALMAS_OD_OUTPUT_CTRL 0x8
1728#define PALMAS_I2C_SPI 0x8 1788#define PALMAS_POLARITY_CTRL 0x9
1729#define PALMAS_PU_PD_INPUT_CTRL4 0x9 1789#define PALMAS_PRIMARY_SECONDARY_PAD1 0xA
1730#define PALMAS_PRIMARY_SECONDARY_PAD3 0xA 1790#define PALMAS_PRIMARY_SECONDARY_PAD2 0xB
1791#define PALMAS_I2C_SPI 0xC
1792#define PALMAS_PU_PD_INPUT_CTRL4 0xD
1793#define PALMAS_PRIMARY_SECONDARY_PAD3 0xE
1794#define PALMAS_PRIMARY_SECONDARY_PAD4 0xF
1731 1795
1732/* Bit definitions for PU_PD_INPUT_CTRL1 */ 1796/* Bit definitions for PU_PD_INPUT_CTRL1 */
1733#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD 0x40 1797#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD 0x40
@@ -2485,6 +2549,15 @@ enum usb_irq_events {
2485#define PALMAS_PU_PD_GPIO_CTRL1 0x6 2549#define PALMAS_PU_PD_GPIO_CTRL1 0x6
2486#define PALMAS_PU_PD_GPIO_CTRL2 0x7 2550#define PALMAS_PU_PD_GPIO_CTRL2 0x7
2487#define PALMAS_OD_OUTPUT_GPIO_CTRL 0x8 2551#define PALMAS_OD_OUTPUT_GPIO_CTRL 0x8
2552#define PALMAS_GPIO_DATA_IN2 0x9
2553#define PALMAS_GPIO_DATA_DIR2 0x0A
2554#define PALMAS_GPIO_DATA_OUT2 0x0B
2555#define PALMAS_GPIO_DEBOUNCE_EN2 0x0C
2556#define PALMAS_GPIO_CLEAR_DATA_OUT2 0x0D
2557#define PALMAS_GPIO_SET_DATA_OUT2 0x0E
2558#define PALMAS_PU_PD_GPIO_CTRL3 0x0F
2559#define PALMAS_PU_PD_GPIO_CTRL4 0x10
2560#define PALMAS_OD_OUTPUT_GPIO_CTRL2 0x11
2488 2561
2489/* Bit definitions for GPIO_DATA_IN */ 2562/* Bit definitions for GPIO_DATA_IN */
2490#define PALMAS_GPIO_DATA_IN_GPIO_7_IN 0x80 2563#define PALMAS_GPIO_DATA_IN_GPIO_7_IN 0x80
@@ -2850,4 +2923,9 @@ static inline int palmas_irq_get_virq(struct palmas *palmas, int irq)
2850 return regmap_irq_get_virq(palmas->irq_data, irq); 2923 return regmap_irq_get_virq(palmas->irq_data, irq);
2851} 2924}
2852 2925
2926
2927int palmas_ext_control_req_config(struct palmas *palmas,
2928 enum palmas_external_requestor_id ext_control_req_id,
2929 int ext_ctrl, bool enable);
2930
2853#endif /* __LINUX_MFD_PALMAS_H */ 2931#endif /* __LINUX_MFD_PALMAS_H */
diff --git a/include/linux/mfd/rtsx_common.h b/include/linux/mfd/rtsx_common.h
index 2b13970596f5..443176ee1ab0 100644
--- a/include/linux/mfd/rtsx_common.h
+++ b/include/linux/mfd/rtsx_common.h
@@ -1,6 +1,6 @@
1/* Driver for Realtek driver-based card reader 1/* Driver for Realtek driver-based card reader
2 * 2 *
3 * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved. 3 * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -17,7 +17,6 @@
17 * 17 *
18 * Author: 18 * Author:
19 * Wei WANG <wei_wang@realsil.com.cn> 19 * Wei WANG <wei_wang@realsil.com.cn>
20 * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
21 */ 20 */
22 21
23#ifndef __RTSX_COMMON_H 22#ifndef __RTSX_COMMON_H
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 86bc635f8385..d1382dfbeff0 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -1,6 +1,6 @@
1/* Driver for Realtek PCI-Express card reader 1/* Driver for Realtek PCI-Express card reader
2 * 2 *
3 * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved. 3 * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -17,7 +17,6 @@
17 * 17 *
18 * Author: 18 * Author:
19 * Wei WANG <wei_wang@realsil.com.cn> 19 * Wei WANG <wei_wang@realsil.com.cn>
20 * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
21 */ 20 */
22 21
23#ifndef __RTSX_PCI_H 22#ifndef __RTSX_PCI_H
@@ -25,8 +24,7 @@
25 24
26#include <linux/sched.h> 25#include <linux/sched.h>
27#include <linux/pci.h> 26#include <linux/pci.h>
28 27#include <linux/mfd/rtsx_common.h>
29#include "rtsx_common.h"
30 28
31#define MAX_RW_REG_CNT 1024 29#define MAX_RW_REG_CNT 1024
32 30
@@ -184,11 +182,26 @@
184#define CARD_SHARE_BAROSSA_SD 0x01 182#define CARD_SHARE_BAROSSA_SD 0x01
185#define CARD_SHARE_BAROSSA_MS 0x02 183#define CARD_SHARE_BAROSSA_MS 0x02
186 184
185/* CARD_DRIVE_SEL */
186#define MS_DRIVE_8mA (0x01 << 6)
187#define MMC_DRIVE_8mA (0x01 << 4)
188#define XD_DRIVE_8mA (0x01 << 2)
189#define GPIO_DRIVE_8mA 0x01
190#define RTS5209_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
191 XD_DRIVE_8mA | GPIO_DRIVE_8mA)
192#define RTL8411_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
193 XD_DRIVE_8mA)
194#define RTSX_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | GPIO_DRIVE_8mA)
195
187/* SD30_DRIVE_SEL */ 196/* SD30_DRIVE_SEL */
188#define DRIVER_TYPE_A 0x05 197#define DRIVER_TYPE_A 0x05
189#define DRIVER_TYPE_B 0x03 198#define DRIVER_TYPE_B 0x03
190#define DRIVER_TYPE_C 0x02 199#define DRIVER_TYPE_C 0x02
191#define DRIVER_TYPE_D 0x01 200#define DRIVER_TYPE_D 0x01
201#define CFG_DRIVER_TYPE_A 0x02
202#define CFG_DRIVER_TYPE_B 0x03
203#define CFG_DRIVER_TYPE_C 0x01
204#define CFG_DRIVER_TYPE_D 0x00
192 205
193/* FPDCTL */ 206/* FPDCTL */
194#define SSC_POWER_DOWN 0x01 207#define SSC_POWER_DOWN 0x01
@@ -521,6 +534,10 @@
521#define SAMPLE_VAR_CLK0 (0x01 << 4) 534#define SAMPLE_VAR_CLK0 (0x01 << 4)
522#define SAMPLE_VAR_CLK1 (0x02 << 4) 535#define SAMPLE_VAR_CLK1 (0x02 << 4)
523 536
537/* HOST_SLEEP_STATE */
538#define HOST_ENTER_S1 1
539#define HOST_ENTER_S3 2
540
524#define MS_CFG 0xFD40 541#define MS_CFG 0xFD40
525#define MS_TPC 0xFD41 542#define MS_TPC 0xFD41
526#define MS_TRANS_CFG 0xFD42 543#define MS_TRANS_CFG 0xFD42
@@ -575,6 +592,7 @@
575 592
576#define CARD_PWR_CTL 0xFD50 593#define CARD_PWR_CTL 0xFD50
577#define CARD_CLK_SWITCH 0xFD51 594#define CARD_CLK_SWITCH 0xFD51
595#define RTL8411B_PACKAGE_MODE 0xFD51
578#define CARD_SHARE_MODE 0xFD52 596#define CARD_SHARE_MODE 0xFD52
579#define CARD_DRIVE_SEL 0xFD53 597#define CARD_DRIVE_SEL 0xFD53
580#define CARD_STOP 0xFD54 598#define CARD_STOP 0xFD54
@@ -668,6 +686,7 @@
668#define PME_FORCE_CTL 0xFE56 686#define PME_FORCE_CTL 0xFE56
669#define ASPM_FORCE_CTL 0xFE57 687#define ASPM_FORCE_CTL 0xFE57
670#define PM_CLK_FORCE_CTL 0xFE58 688#define PM_CLK_FORCE_CTL 0xFE58
689#define FUNC_FORCE_CTL 0xFE59
671#define PERST_GLITCH_WIDTH 0xFE5C 690#define PERST_GLITCH_WIDTH 0xFE5C
672#define CHANGE_LINK_STATE 0xFE5B 691#define CHANGE_LINK_STATE 0xFE5B
673#define RESET_LOAD_REG 0xFE5E 692#define RESET_LOAD_REG 0xFE5E
@@ -683,6 +702,13 @@
683 702
684#define DUMMY_REG_RESET_0 0xFE90 703#define DUMMY_REG_RESET_0 0xFE90
685 704
705#define AUTOLOAD_CFG_BASE 0xFF00
706
707#define PM_CTRL1 0xFF44
708#define PM_CTRL2 0xFF45
709#define PM_CTRL3 0xFF46
710#define PM_CTRL4 0xFF47
711
686/* Memory mapping */ 712/* Memory mapping */
687#define SRAM_BASE 0xE600 713#define SRAM_BASE 0xE600
688#define RBUF_BASE 0xF400 714#define RBUF_BASE 0xF400
@@ -725,6 +751,11 @@
725#define PHY_FLD4 0x1E 751#define PHY_FLD4 0x1E
726#define PHY_DUM_REG 0x1F 752#define PHY_DUM_REG 0x1F
727 753
754#define LCTLR 0x80
755#define PCR_SETTING_REG1 0x724
756#define PCR_SETTING_REG2 0x814
757#define PCR_SETTING_REG3 0x747
758
728#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) 759#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0)
729 760
730struct rtsx_pcr; 761struct rtsx_pcr;
@@ -746,6 +777,8 @@ struct pcr_ops {
746 u8 voltage); 777 u8 voltage);
747 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr); 778 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr);
748 int (*conv_clk_and_div_n)(int clk, int dir); 779 int (*conv_clk_and_div_n)(int clk, int dir);
780 void (*fetch_vendor_settings)(struct rtsx_pcr *pcr);
781 void (*force_power_down)(struct rtsx_pcr *pcr, u8 pm_state);
749}; 782};
750 783
751enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN}; 784enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
@@ -787,7 +820,6 @@ struct rtsx_pcr {
787 struct completion *finish_me; 820 struct completion *finish_me;
788 821
789 unsigned int cur_clock; 822 unsigned int cur_clock;
790 bool ms_pmos;
791 bool remove_pci; 823 bool remove_pci;
792 bool msi_en; 824 bool msi_en;
793 825
@@ -805,6 +837,19 @@ struct rtsx_pcr {
805#define IC_VER_D 3 837#define IC_VER_D 3
806 u8 ic_version; 838 u8 ic_version;
807 839
840 u8 sd30_drive_sel_1v8;
841 u8 sd30_drive_sel_3v3;
842 u8 card_drive_sel;
843#define ASPM_L1_EN 0x02
844 u8 aspm_en;
845
846#define PCR_MS_PMOS (1 << 0)
847#define PCR_REVERSE_SOCKET (1 << 1)
848 u32 flags;
849
850 u32 tx_initial_phase;
851 u32 rx_initial_phase;
852
808 const u32 *sd_pull_ctl_enable_tbl; 853 const u32 *sd_pull_ctl_enable_tbl;
809 const u32 *sd_pull_ctl_disable_tbl; 854 const u32 *sd_pull_ctl_disable_tbl;
810 const u32 *ms_pull_ctl_enable_tbl; 855 const u32 *ms_pull_ctl_enable_tbl;
@@ -821,6 +866,18 @@ struct rtsx_pcr {
821#define PCI_VID(pcr) ((pcr)->pci->vendor) 866#define PCI_VID(pcr) ((pcr)->pci->vendor)
822#define PCI_PID(pcr) ((pcr)->pci->device) 867#define PCI_PID(pcr) ((pcr)->pci->device)
823 868
869#define SDR104_PHASE(val) ((val) & 0xFF)
870#define SDR50_PHASE(val) (((val) >> 8) & 0xFF)
871#define DDR50_PHASE(val) (((val) >> 16) & 0xFF)
872#define SDR104_TX_PHASE(pcr) SDR104_PHASE((pcr)->tx_initial_phase)
873#define SDR50_TX_PHASE(pcr) SDR50_PHASE((pcr)->tx_initial_phase)
874#define DDR50_TX_PHASE(pcr) DDR50_PHASE((pcr)->tx_initial_phase)
875#define SDR104_RX_PHASE(pcr) SDR104_PHASE((pcr)->rx_initial_phase)
876#define SDR50_RX_PHASE(pcr) SDR50_PHASE((pcr)->rx_initial_phase)
877#define DDR50_RX_PHASE(pcr) DDR50_PHASE((pcr)->rx_initial_phase)
878#define SET_CLOCK_PHASE(sdr104, sdr50, ddr50) \
879 (((ddr50) << 16) | ((sdr50) << 8) | (sdr104))
880
824void rtsx_pci_start_run(struct rtsx_pcr *pcr); 881void rtsx_pci_start_run(struct rtsx_pcr *pcr);
825int rtsx_pci_write_register(struct rtsx_pcr *pcr, u16 addr, u8 mask, u8 data); 882int rtsx_pci_write_register(struct rtsx_pcr *pcr, u16 addr, u8 mask, u8 data);
826int rtsx_pci_read_register(struct rtsx_pcr *pcr, u16 addr, u8 *data); 883int rtsx_pci_read_register(struct rtsx_pcr *pcr, u16 addr, u8 *data);
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index f0f4de3b4ccc..378ae8a04c6a 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -14,8 +14,6 @@
14#ifndef __LINUX_MFD_SEC_CORE_H 14#ifndef __LINUX_MFD_SEC_CORE_H
15#define __LINUX_MFD_SEC_CORE_H 15#define __LINUX_MFD_SEC_CORE_H
16 16
17#define NUM_IRQ_REGS 4
18
19enum sec_device_type { 17enum sec_device_type {
20 S5M8751X, 18 S5M8751X,
21 S5M8763X, 19 S5M8763X,
@@ -44,8 +42,6 @@ struct sec_pmic_dev {
44 struct regmap *regmap; 42 struct regmap *regmap;
45 struct i2c_client *i2c; 43 struct i2c_client *i2c;
46 struct i2c_client *rtc; 44 struct i2c_client *rtc;
47 struct mutex iolock;
48 struct mutex irqlock;
49 45
50 int device_type; 46 int device_type;
51 int irq_base; 47 int irq_base;
@@ -53,8 +49,6 @@ struct sec_pmic_dev {
53 struct regmap_irq_chip_data *irq_data; 49 struct regmap_irq_chip_data *irq_data;
54 50
55 int ono; 51 int ono;
56 u8 irq_masks_cur[NUM_IRQ_REGS];
57 u8 irq_masks_cache[NUM_IRQ_REGS];
58 int type; 52 int type;
59 bool wakeup; 53 bool wakeup;
60}; 54};
diff --git a/include/linux/mfd/samsung/s2mps11.h b/include/linux/mfd/samsung/s2mps11.h
index ad2252f239d7..b3ddf98dec37 100644
--- a/include/linux/mfd/samsung/s2mps11.h
+++ b/include/linux/mfd/samsung/s2mps11.h
@@ -167,11 +167,8 @@ enum s2mps11_regulators {
167 S2MPS11_BUCK8, 167 S2MPS11_BUCK8,
168 S2MPS11_BUCK9, 168 S2MPS11_BUCK9,
169 S2MPS11_BUCK10, 169 S2MPS11_BUCK10,
170 S2MPS11_AP_EN32KHZ,
171 S2MPS11_CP_EN32KHZ,
172 S2MPS11_BT_EN32KHZ,
173 170
174 S2MPS11_REG_MAX, 171 S2MPS11_REGULATOR_MAX,
175}; 172};
176 173
177#define S2MPS11_BUCK_MIN1 600000 174#define S2MPS11_BUCK_MIN1 600000
@@ -189,8 +186,19 @@ enum s2mps11_regulators {
189#define S2MPS11_ENABLE_SHIFT 0x06 186#define S2MPS11_ENABLE_SHIFT 0x06
190#define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1) 187#define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1)
191#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1) 188#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)
189#define S2MPS11_RAMP_DELAY 25000 /* uV/us */
192 190
191
192#define S2MPS11_BUCK2_RAMP_SHIFT 6
193#define S2MPS11_BUCK34_RAMP_SHIFT 4
194#define S2MPS11_BUCK5_RAMP_SHIFT 6
195#define S2MPS11_BUCK16_RAMP_SHIFT 4
196#define S2MPS11_BUCK7810_RAMP_SHIFT 2
197#define S2MPS11_BUCK9_RAMP_SHIFT 0
198#define S2MPS11_BUCK2_RAMP_EN_SHIFT 3
199#define S2MPS11_BUCK3_RAMP_EN_SHIFT 2
200#define S2MPS11_BUCK4_RAMP_EN_SHIFT 1
201#define S2MPS11_BUCK6_RAMP_EN_SHIFT 0
193#define S2MPS11_PMIC_EN_SHIFT 6 202#define S2MPS11_PMIC_EN_SHIFT 6
194#define S2MPS11_REGULATOR_MAX (S2MPS11_REG_MAX - 3)
195 203
196#endif /* __LINUX_MFD_S2MPS11_H */ 204#endif /* __LINUX_MFD_S2MPS11_H */
diff --git a/include/linux/mfd/syscon/clps711x.h b/include/linux/mfd/syscon/clps711x.h
new file mode 100644
index 000000000000..26355abae515
--- /dev/null
+++ b/include/linux/mfd/syscon/clps711x.h
@@ -0,0 +1,94 @@
1/*
2 * CLPS711X system register bits definitions
3 *
4 * Copyright (C) 2013 Alexander Shiyan <shc_work@mail.ru>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef _LINUX_MFD_SYSCON_CLPS711X_H_
13#define _LINUX_MFD_SYSCON_CLPS711X_H_
14
15#define SYSCON_OFFSET (0x00)
16#define SYSFLG_OFFSET (0x40)
17
18#define SYSCON1_KBDSCAN(x) ((x) & 15)
19#define SYSCON1_KBDSCAN_MASK (15)
20#define SYSCON1_TC1M (1 << 4)
21#define SYSCON1_TC1S (1 << 5)
22#define SYSCON1_TC2M (1 << 6)
23#define SYSCON1_TC2S (1 << 7)
24#define SYSCON1_BZTOG (1 << 9)
25#define SYSCON1_BZMOD (1 << 10)
26#define SYSCON1_DBGEN (1 << 11)
27#define SYSCON1_LCDEN (1 << 12)
28#define SYSCON1_CDENTX (1 << 13)
29#define SYSCON1_CDENRX (1 << 14)
30#define SYSCON1_SIREN (1 << 15)
31#define SYSCON1_ADCKSEL(x) (((x) & 3) << 16)
32#define SYSCON1_ADCKSEL_MASK (3 << 16)
33#define SYSCON1_EXCKEN (1 << 18)
34#define SYSCON1_WAKEDIS (1 << 19)
35#define SYSCON1_IRTXM (1 << 20)
36
37#define SYSCON2_SERSEL (1 << 0)
38#define SYSCON2_KBD6 (1 << 1)
39#define SYSCON2_DRAMZ (1 << 2)
40#define SYSCON2_KBWEN (1 << 3)
41#define SYSCON2_SS2TXEN (1 << 4)
42#define SYSCON2_PCCARD1 (1 << 5)
43#define SYSCON2_PCCARD2 (1 << 6)
44#define SYSCON2_SS2RXEN (1 << 7)
45#define SYSCON2_SS2MAEN (1 << 9)
46#define SYSCON2_OSTB (1 << 12)
47#define SYSCON2_CLKENSL (1 << 13)
48#define SYSCON2_BUZFREQ (1 << 14)
49
50#define SYSCON3_ADCCON (1 << 0)
51#define SYSCON3_CLKCTL0 (1 << 1)
52#define SYSCON3_CLKCTL1 (1 << 2)
53#define SYSCON3_DAISEL (1 << 3)
54#define SYSCON3_ADCCKNSEN (1 << 4)
55#define SYSCON3_VERSN(x) (((x) >> 5) & 7)
56#define SYSCON3_VERSN_MASK (7 << 5)
57#define SYSCON3_FASTWAKE (1 << 8)
58#define SYSCON3_DAIEN (1 << 9)
59#define SYSCON3_128FS SYSCON3_DAIEN
60#define SYSCON3_ENPD67 (1 << 10)
61
62#define SYSCON_UARTEN (1 << 8)
63
64#define SYSFLG1_MCDR (1 << 0)
65#define SYSFLG1_DCDET (1 << 1)
66#define SYSFLG1_WUDR (1 << 2)
67#define SYSFLG1_WUON (1 << 3)
68#define SYSFLG1_CTS (1 << 8)
69#define SYSFLG1_DSR (1 << 9)
70#define SYSFLG1_DCD (1 << 10)
71#define SYSFLG1_NBFLG (1 << 12)
72#define SYSFLG1_RSTFLG (1 << 13)
73#define SYSFLG1_PFFLG (1 << 14)
74#define SYSFLG1_CLDFLG (1 << 15)
75#define SYSFLG1_CRXFE (1 << 24)
76#define SYSFLG1_CTXFF (1 << 25)
77#define SYSFLG1_SSIBUSY (1 << 26)
78#define SYSFLG1_ID (1 << 29)
79#define SYSFLG1_VERID(x) (((x) >> 30) & 3)
80#define SYSFLG1_VERID_MASK (3 << 30)
81
82#define SYSFLG2_SSRXOF (1 << 0)
83#define SYSFLG2_RESVAL (1 << 1)
84#define SYSFLG2_RESFRM (1 << 2)
85#define SYSFLG2_SS2RXFE (1 << 3)
86#define SYSFLG2_SS2TXFF (1 << 4)
87#define SYSFLG2_SS2TXUF (1 << 5)
88#define SYSFLG2_CKMODE (1 << 6)
89
90#define SYSFLG_UBUSY (1 << 11)
91#define SYSFLG_URXFE (1 << 22)
92#define SYSFLG_UTXFF (1 << 23)
93
94#endif
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
index dab34a1deb2c..b6bdcd66c07d 100644
--- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -103,15 +103,15 @@
103#define IMX6Q_GPR1_EXC_MON_MASK BIT(22) 103#define IMX6Q_GPR1_EXC_MON_MASK BIT(22)
104#define IMX6Q_GPR1_EXC_MON_OKAY 0x0 104#define IMX6Q_GPR1_EXC_MON_OKAY 0x0
105#define IMX6Q_GPR1_EXC_MON_SLVE BIT(22) 105#define IMX6Q_GPR1_EXC_MON_SLVE BIT(22)
106#define IMX6Q_GPR1_MIPI_IPU2_SEL_MASK BIT(21) 106#define IMX6Q_GPR1_ENET_CLK_SEL_MASK BIT(21)
107#define IMX6Q_GPR1_MIPI_IPU2_SEL_GASKET 0x0 107#define IMX6Q_GPR1_ENET_CLK_SEL_PAD 0
108#define IMX6Q_GPR1_MIPI_IPU2_SEL_IOMUX BIT(21) 108#define IMX6Q_GPR1_ENET_CLK_SEL_ANATOP BIT(21)
109#define IMX6Q_GPR1_MIPI_IPU1_MUX_MASK BIT(20) 109#define IMX6Q_GPR1_MIPI_IPU2_MUX_MASK BIT(20)
110#define IMX6Q_GPR1_MIPI_IPU1_MUX_GASKET 0x0
111#define IMX6Q_GPR1_MIPI_IPU1_MUX_IOMUX BIT(20)
112#define IMX6Q_GPR1_MIPI_IPU2_MUX_MASK BIT(19)
113#define IMX6Q_GPR1_MIPI_IPU2_MUX_GASKET 0x0 110#define IMX6Q_GPR1_MIPI_IPU2_MUX_GASKET 0x0
114#define IMX6Q_GPR1_MIPI_IPU2_MUX_IOMUX BIT(19) 111#define IMX6Q_GPR1_MIPI_IPU2_MUX_IOMUX BIT(20)
112#define IMX6Q_GPR1_MIPI_IPU1_MUX_MASK BIT(19)
113#define IMX6Q_GPR1_MIPI_IPU1_MUX_GASKET 0x0
114#define IMX6Q_GPR1_MIPI_IPU1_MUX_IOMUX BIT(19)
115#define IMX6Q_GPR1_PCIE_TEST_PD BIT(18) 115#define IMX6Q_GPR1_PCIE_TEST_PD BIT(18)
116#define IMX6Q_GPR1_IPU_VPU_MUX_MASK BIT(17) 116#define IMX6Q_GPR1_IPU_VPU_MUX_MASK BIT(17)
117#define IMX6Q_GPR1_IPU_VPU_MUX_IPU1 0x0 117#define IMX6Q_GPR1_IPU_VPU_MUX_IPU1 0x0
@@ -279,41 +279,88 @@
279#define IMX6Q_GPR13_CAN2_STOP_REQ BIT(29) 279#define IMX6Q_GPR13_CAN2_STOP_REQ BIT(29)
280#define IMX6Q_GPR13_CAN1_STOP_REQ BIT(28) 280#define IMX6Q_GPR13_CAN1_STOP_REQ BIT(28)
281#define IMX6Q_GPR13_ENET_STOP_REQ BIT(27) 281#define IMX6Q_GPR13_ENET_STOP_REQ BIT(27)
282#define IMX6Q_GPR13_SATA_PHY_8_MASK (0x7 << 24) 282#define IMX6Q_GPR13_SATA_RX_EQ_VAL_MASK (0x7 << 24)
283#define IMX6Q_GPR13_SATA_PHY_8_0_5_DB (0x0 << 24) 283#define IMX6Q_GPR13_SATA_RX_EQ_VAL_0_5_DB (0x0 << 24)
284#define IMX6Q_GPR13_SATA_PHY_8_1_0_DB (0x1 << 24) 284#define IMX6Q_GPR13_SATA_RX_EQ_VAL_1_0_DB (0x1 << 24)
285#define IMX6Q_GPR13_SATA_PHY_8_1_5_DB (0x2 << 24) 285#define IMX6Q_GPR13_SATA_RX_EQ_VAL_1_5_DB (0x2 << 24)
286#define IMX6Q_GPR13_SATA_PHY_8_2_0_DB (0x3 << 24) 286#define IMX6Q_GPR13_SATA_RX_EQ_VAL_2_0_DB (0x3 << 24)
287#define IMX6Q_GPR13_SATA_PHY_8_2_5_DB (0x4 << 24) 287#define IMX6Q_GPR13_SATA_RX_EQ_VAL_2_5_DB (0x4 << 24)
288#define IMX6Q_GPR13_SATA_PHY_8_3_0_DB (0x5 << 24) 288#define IMX6Q_GPR13_SATA_RX_EQ_VAL_3_0_DB (0x5 << 24)
289#define IMX6Q_GPR13_SATA_PHY_8_3_5_DB (0x6 << 24) 289#define IMX6Q_GPR13_SATA_RX_EQ_VAL_3_5_DB (0x6 << 24)
290#define IMX6Q_GPR13_SATA_PHY_8_4_0_DB (0x7 << 24) 290#define IMX6Q_GPR13_SATA_RX_EQ_VAL_4_0_DB (0x7 << 24)
291#define IMX6Q_GPR13_SATA_PHY_7_MASK (0x1f << 19) 291#define IMX6Q_GPR13_SATA_RX_LOS_LVL_MASK (0x1f << 19)
292#define IMX6Q_GPR13_SATA_PHY_7_SATA1I (0x10 << 19) 292#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1I (0x10 << 19)
293#define IMX6Q_GPR13_SATA_PHY_7_SATA1M (0x10 << 19) 293#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1M (0x10 << 19)
294#define IMX6Q_GPR13_SATA_PHY_7_SATA1X (0x1a << 19) 294#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1X (0x1a << 19)
295#define IMX6Q_GPR13_SATA_PHY_7_SATA2I (0x12 << 19) 295#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2I (0x12 << 19)
296#define IMX6Q_GPR13_SATA_PHY_7_SATA2M (0x12 << 19) 296#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2M (0x12 << 19)
297#define IMX6Q_GPR13_SATA_PHY_7_SATA2X (0x1a << 19) 297#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2X (0x1a << 19)
298#define IMX6Q_GPR13_SATA_PHY_6_MASK (0x7 << 16) 298#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_MASK (0x7 << 16)
299#define IMX6Q_GPR13_SATA_SPEED_MASK BIT(15) 299#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_1P_1F (0x0 << 16)
300#define IMX6Q_GPR13_SATA_SPEED_1P5G 0x0 300#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_2F (0x1 << 16)
301#define IMX6Q_GPR13_SATA_SPEED_3P0G BIT(15) 301#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_1P_4F (0x2 << 16)
302#define IMX6Q_GPR13_SATA_PHY_5 BIT(14) 302#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_4F (0x3 << 16)
303#define IMX6Q_GPR13_SATA_PHY_4_MASK (0x7 << 11) 303#define IMX6Q_GPR13_SATA_SPD_MODE_MASK BIT(15)
304#define IMX6Q_GPR13_SATA_PHY_4_16_16 (0x0 << 11) 304#define IMX6Q_GPR13_SATA_SPD_MODE_1P5G 0x0
305#define IMX6Q_GPR13_SATA_PHY_4_14_16 (0x1 << 11) 305#define IMX6Q_GPR13_SATA_SPD_MODE_3P0G BIT(15)
306#define IMX6Q_GPR13_SATA_PHY_4_12_16 (0x2 << 11) 306#define IMX6Q_GPR13_SATA_MPLL_SS_EN BIT(14)
307#define IMX6Q_GPR13_SATA_PHY_4_10_16 (0x3 << 11) 307#define IMX6Q_GPR13_SATA_TX_ATTEN_MASK (0x7 << 11)
308#define IMX6Q_GPR13_SATA_PHY_4_9_16 (0x4 << 11) 308#define IMX6Q_GPR13_SATA_TX_ATTEN_16_16 (0x0 << 11)
309#define IMX6Q_GPR13_SATA_PHY_4_8_16 (0x5 << 11) 309#define IMX6Q_GPR13_SATA_TX_ATTEN_14_16 (0x1 << 11)
310#define IMX6Q_GPR13_SATA_PHY_3_MASK (0xf << 7) 310#define IMX6Q_GPR13_SATA_TX_ATTEN_12_16 (0x2 << 11)
311#define IMX6Q_GPR13_SATA_PHY_3_OFF 0x7 311#define IMX6Q_GPR13_SATA_TX_ATTEN_10_16 (0x3 << 11)
312#define IMX6Q_GPR13_SATA_PHY_2_MASK (0x1f << 2) 312#define IMX6Q_GPR13_SATA_TX_ATTEN_9_16 (0x4 << 11)
313#define IMX6Q_GPR13_SATA_PHY_2_OFF 0x2 313#define IMX6Q_GPR13_SATA_TX_ATTEN_8_16 (0x5 << 11)
314#define IMX6Q_GPR13_SATA_PHY_1_MASK (0x3 << 0) 314#define IMX6Q_GPR13_SATA_TX_BOOST_MASK (0xf << 7)
315#define IMX6Q_GPR13_SATA_PHY_1_FAST (0x0 << 0) 315#define IMX6Q_GPR13_SATA_TX_BOOST_0_00_DB (0x0 << 7)
316#define IMX6Q_GPR13_SATA_PHY_1_MED (0x1 << 0) 316#define IMX6Q_GPR13_SATA_TX_BOOST_0_37_DB (0x1 << 7)
317#define IMX6Q_GPR13_SATA_PHY_1_SLOW (0x2 << 0) 317#define IMX6Q_GPR13_SATA_TX_BOOST_0_74_DB (0x2 << 7)
318 318#define IMX6Q_GPR13_SATA_TX_BOOST_1_11_DB (0x3 << 7)
319#define IMX6Q_GPR13_SATA_TX_BOOST_1_48_DB (0x4 << 7)
320#define IMX6Q_GPR13_SATA_TX_BOOST_1_85_DB (0x5 << 7)
321#define IMX6Q_GPR13_SATA_TX_BOOST_2_22_DB (0x6 << 7)
322#define IMX6Q_GPR13_SATA_TX_BOOST_2_59_DB (0x7 << 7)
323#define IMX6Q_GPR13_SATA_TX_BOOST_2_96_DB (0x8 << 7)
324#define IMX6Q_GPR13_SATA_TX_BOOST_3_33_DB (0x9 << 7)
325#define IMX6Q_GPR13_SATA_TX_BOOST_3_70_DB (0xa << 7)
326#define IMX6Q_GPR13_SATA_TX_BOOST_4_07_DB (0xb << 7)
327#define IMX6Q_GPR13_SATA_TX_BOOST_4_44_DB (0xc << 7)
328#define IMX6Q_GPR13_SATA_TX_BOOST_4_81_DB (0xd << 7)
329#define IMX6Q_GPR13_SATA_TX_BOOST_5_28_DB (0xe << 7)
330#define IMX6Q_GPR13_SATA_TX_BOOST_5_75_DB (0xf << 7)
331#define IMX6Q_GPR13_SATA_TX_LVL_MASK (0x1f << 2)
332#define IMX6Q_GPR13_SATA_TX_LVL_0_937_V (0x00 << 2)
333#define IMX6Q_GPR13_SATA_TX_LVL_0_947_V (0x01 << 2)
334#define IMX6Q_GPR13_SATA_TX_LVL_0_957_V (0x02 << 2)
335#define IMX6Q_GPR13_SATA_TX_LVL_0_966_V (0x03 << 2)
336#define IMX6Q_GPR13_SATA_TX_LVL_0_976_V (0x04 << 2)
337#define IMX6Q_GPR13_SATA_TX_LVL_0_986_V (0x05 << 2)
338#define IMX6Q_GPR13_SATA_TX_LVL_0_996_V (0x06 << 2)
339#define IMX6Q_GPR13_SATA_TX_LVL_1_005_V (0x07 << 2)
340#define IMX6Q_GPR13_SATA_TX_LVL_1_015_V (0x08 << 2)
341#define IMX6Q_GPR13_SATA_TX_LVL_1_025_V (0x09 << 2)
342#define IMX6Q_GPR13_SATA_TX_LVL_1_035_V (0x0a << 2)
343#define IMX6Q_GPR13_SATA_TX_LVL_1_045_V (0x0b << 2)
344#define IMX6Q_GPR13_SATA_TX_LVL_1_054_V (0x0c << 2)
345#define IMX6Q_GPR13_SATA_TX_LVL_1_064_V (0x0d << 2)
346#define IMX6Q_GPR13_SATA_TX_LVL_1_074_V (0x0e << 2)
347#define IMX6Q_GPR13_SATA_TX_LVL_1_084_V (0x0f << 2)
348#define IMX6Q_GPR13_SATA_TX_LVL_1_094_V (0x10 << 2)
349#define IMX6Q_GPR13_SATA_TX_LVL_1_104_V (0x11 << 2)
350#define IMX6Q_GPR13_SATA_TX_LVL_1_113_V (0x12 << 2)
351#define IMX6Q_GPR13_SATA_TX_LVL_1_123_V (0x13 << 2)
352#define IMX6Q_GPR13_SATA_TX_LVL_1_133_V (0x14 << 2)
353#define IMX6Q_GPR13_SATA_TX_LVL_1_143_V (0x15 << 2)
354#define IMX6Q_GPR13_SATA_TX_LVL_1_152_V (0x16 << 2)
355#define IMX6Q_GPR13_SATA_TX_LVL_1_162_V (0x17 << 2)
356#define IMX6Q_GPR13_SATA_TX_LVL_1_172_V (0x18 << 2)
357#define IMX6Q_GPR13_SATA_TX_LVL_1_182_V (0x19 << 2)
358#define IMX6Q_GPR13_SATA_TX_LVL_1_191_V (0x1a << 2)
359#define IMX6Q_GPR13_SATA_TX_LVL_1_201_V (0x1b << 2)
360#define IMX6Q_GPR13_SATA_TX_LVL_1_211_V (0x1c << 2)
361#define IMX6Q_GPR13_SATA_TX_LVL_1_221_V (0x1d << 2)
362#define IMX6Q_GPR13_SATA_TX_LVL_1_230_V (0x1e << 2)
363#define IMX6Q_GPR13_SATA_TX_LVL_1_240_V (0x1f << 2)
364#define IMX6Q_GPR13_SATA_MPLL_CLK_EN BIT(1)
365#define IMX6Q_GPR13_SATA_TX_EDGE_RATE BIT(0)
319#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */ 366#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index c79ad5d2f271..25f2c611ab01 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -30,8 +30,8 @@
30#define REG_IDLECONFIG 0x058 30#define REG_IDLECONFIG 0x058
31#define REG_CHARGECONFIG 0x05C 31#define REG_CHARGECONFIG 0x05C
32#define REG_CHARGEDELAY 0x060 32#define REG_CHARGEDELAY 0x060
33#define REG_STEPCONFIG(n) (0x64 + ((n - 1) * 8)) 33#define REG_STEPCONFIG(n) (0x64 + ((n) * 8))
34#define REG_STEPDELAY(n) (0x68 + ((n - 1) * 8)) 34#define REG_STEPDELAY(n) (0x68 + ((n) * 8))
35#define REG_FIFO0CNT 0xE4 35#define REG_FIFO0CNT 0xE4
36#define REG_FIFO0THR 0xE8 36#define REG_FIFO0THR 0xE8
37#define REG_FIFO1CNT 0xF0 37#define REG_FIFO1CNT 0xF0
@@ -46,8 +46,6 @@
46/* Step Enable */ 46/* Step Enable */
47#define STEPENB_MASK (0x1FFFF << 0) 47#define STEPENB_MASK (0x1FFFF << 0)
48#define STEPENB(val) ((val) << 0) 48#define STEPENB(val) ((val) << 0)
49#define STPENB_STEPENB STEPENB(0x1FFFF)
50#define STPENB_STEPENB_TC STEPENB(0x1FFF)
51 49
52/* IRQ enable */ 50/* IRQ enable */
53#define IRQENB_HW_PEN BIT(0) 51#define IRQENB_HW_PEN BIT(0)
@@ -73,8 +71,6 @@
73#define STEPCONFIG_INM_ADCREFM STEPCONFIG_INM(8) 71#define STEPCONFIG_INM_ADCREFM STEPCONFIG_INM(8)
74#define STEPCONFIG_INP_MASK (0xF << 19) 72#define STEPCONFIG_INP_MASK (0xF << 19)
75#define STEPCONFIG_INP(val) ((val) << 19) 73#define STEPCONFIG_INP(val) ((val) << 19)
76#define STEPCONFIG_INP_AN2 STEPCONFIG_INP(2)
77#define STEPCONFIG_INP_AN3 STEPCONFIG_INP(3)
78#define STEPCONFIG_INP_AN4 STEPCONFIG_INP(4) 74#define STEPCONFIG_INP_AN4 STEPCONFIG_INP(4)
79#define STEPCONFIG_INP_ADCREFM STEPCONFIG_INP(8) 75#define STEPCONFIG_INP_ADCREFM STEPCONFIG_INP(8)
80#define STEPCONFIG_FIFO1 BIT(26) 76#define STEPCONFIG_FIFO1 BIT(26)
@@ -96,7 +92,6 @@
96#define STEPCHARGE_INM_AN1 STEPCHARGE_INM(1) 92#define STEPCHARGE_INM_AN1 STEPCHARGE_INM(1)
97#define STEPCHARGE_INP_MASK (0xF << 19) 93#define STEPCHARGE_INP_MASK (0xF << 19)
98#define STEPCHARGE_INP(val) ((val) << 19) 94#define STEPCHARGE_INP(val) ((val) << 19)
99#define STEPCHARGE_INP_AN1 STEPCHARGE_INP(1)
100#define STEPCHARGE_RFM_MASK (3 << 23) 95#define STEPCHARGE_RFM_MASK (3 << 23)
101#define STEPCHARGE_RFM(val) ((val) << 23) 96#define STEPCHARGE_RFM(val) ((val) << 23)
102#define STEPCHARGE_RFM_XNUR STEPCHARGE_RFM(1) 97#define STEPCHARGE_RFM_XNUR STEPCHARGE_RFM(1)
@@ -118,29 +113,39 @@
118#define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3) 113#define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3)
119#define CNTRLREG_TSCENB BIT(7) 114#define CNTRLREG_TSCENB BIT(7)
120 115
116/* FIFO READ Register */
117#define FIFOREAD_DATA_MASK (0xfff << 0)
118#define FIFOREAD_CHNLID_MASK (0xf << 16)
119
120/* Sequencer Status */
121#define SEQ_STATUS BIT(5)
122
121#define ADC_CLK 3000000 123#define ADC_CLK 3000000
122#define MAX_CLK_DIV 7
123#define TOTAL_STEPS 16 124#define TOTAL_STEPS 16
124#define TOTAL_CHANNELS 8 125#define TOTAL_CHANNELS 8
125 126
126#define TSCADC_CELLS 2 127/*
127 128* ADC runs at 3MHz, and it takes
128enum tscadc_cells { 129* 15 cycles to latch one data output.
129 TSC_CELL, 130* Hence the idle time for ADC to
130 ADC_CELL, 131* process one sample data would be
131}; 132* around 5 micro seconds.
133*/
134#define IDLE_TIMEOUT 5 /* microsec */
132 135
133struct mfd_tscadc_board { 136#define TSCADC_CELLS 2
134 struct tsc_data *tsc_init;
135 struct adc_data *adc_init;
136};
137 137
138struct ti_tscadc_dev { 138struct ti_tscadc_dev {
139 struct device *dev; 139 struct device *dev;
140 struct regmap *regmap_tscadc; 140 struct regmap *regmap_tscadc;
141 void __iomem *tscadc_base; 141 void __iomem *tscadc_base;
142 int irq; 142 int irq;
143 int used_cells; /* 1-2 */
144 int tsc_cell; /* -1 if not used */
145 int adc_cell; /* -1 if not used */
143 struct mfd_cell cells[TSCADC_CELLS]; 146 struct mfd_cell cells[TSCADC_CELLS];
147 u32 reg_se_cache;
148 spinlock_t reg_lock;
144 149
145 /* tsc device */ 150 /* tsc device */
146 struct titsc *tsc; 151 struct titsc *tsc;
@@ -149,4 +154,15 @@ struct ti_tscadc_dev {
149 struct adc_device *adc; 154 struct adc_device *adc;
150}; 155};
151 156
157static inline struct ti_tscadc_dev *ti_tscadc_dev_get(struct platform_device *p)
158{
159 struct ti_tscadc_dev **tscadc_dev = p->dev.platform_data;
160
161 return *tscadc_dev;
162}
163
164void am335x_tsc_se_update(struct ti_tscadc_dev *tsadc);
165void am335x_tsc_se_set(struct ti_tscadc_dev *tsadc, u32 val);
166void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val);
167
152#endif 168#endif
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 99bf3e665997..b22883d60500 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -81,10 +81,15 @@ int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
81void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state); 81void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
82void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state); 82void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
83 83
84struct dma_chan;
85
84struct tmio_mmc_dma { 86struct tmio_mmc_dma {
85 void *chan_priv_tx; 87 void *chan_priv_tx;
86 void *chan_priv_rx; 88 void *chan_priv_rx;
89 int slave_id_tx;
90 int slave_id_rx;
87 int alignment_shift; 91 int alignment_shift;
92 bool (*filter)(struct dma_chan *chan, void *arg);
88}; 93};
89 94
90struct tmio_mmc_host; 95struct tmio_mmc_host;
@@ -103,7 +108,6 @@ struct tmio_mmc_data {
103 unsigned int cd_gpio; 108 unsigned int cd_gpio;
104 void (*set_pwr)(struct platform_device *host, int state); 109 void (*set_pwr)(struct platform_device *host, int state);
105 void (*set_clk_div)(struct platform_device *host, int state); 110 void (*set_clk_div)(struct platform_device *host, int state);
106 int (*get_cd)(struct platform_device *host);
107 int (*write16_hook)(struct tmio_mmc_host *host, int addr); 111 int (*write16_hook)(struct tmio_mmc_host *host, int addr);
108 /* clock management callbacks */ 112 /* clock management callbacks */
109 int (*clk_enable)(struct platform_device *pdev, unsigned int *f); 113 int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
index 29eab2bd3dfa..a5a7f0130e96 100644
--- a/include/linux/mfd/tps65217.h
+++ b/include/linux/mfd/tps65217.h
@@ -244,24 +244,6 @@ struct tps65217_board {
244}; 244};
245 245
246/** 246/**
247 * struct tps_info - packages regulator constraints
248 * @name: Voltage regulator name
249 * @min_uV: minimum micro volts
250 * @max_uV: minimum micro volts
251 * @vsel_to_uv: Function pointer to get voltage from selector
252 * @uv_to_vsel: Function pointer to get selector from voltage
253 *
254 * This data is used to check the regualtor voltage limits while setting.
255 */
256struct tps_info {
257 const char *name;
258 int min_uV;
259 int max_uV;
260 int (*vsel_to_uv)(unsigned int vsel);
261 int (*uv_to_vsel)(int uV, unsigned int *vsel);
262};
263
264/**
265 * struct tps65217 - tps65217 sub-driver chip access routines 247 * struct tps65217 - tps65217 sub-driver chip access routines
266 * 248 *
267 * Device data may be used to access the TPS65217 chip 249 * Device data may be used to access the TPS65217 chip
@@ -273,7 +255,6 @@ struct tps65217 {
273 unsigned int id; 255 unsigned int id;
274 struct regulator_desc desc[TPS65217_NUM_REGULATOR]; 256 struct regulator_desc desc[TPS65217_NUM_REGULATOR];
275 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR]; 257 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR];
276 struct tps_info *info[TPS65217_NUM_REGULATOR];
277 struct regmap *regmap; 258 struct regmap *regmap;
278}; 259};
279 260
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 94ac944d12f0..81f639bc1ae6 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -125,8 +125,15 @@
125 125
126#define TWL6040_HSDACENA (1 << 0) 126#define TWL6040_HSDACENA (1 << 0)
127#define TWL6040_HSDACMODE (1 << 1) 127#define TWL6040_HSDACMODE (1 << 1)
128#define TWL6040_HSDRVENA (1 << 2)
128#define TWL6040_HSDRVMODE (1 << 3) 129#define TWL6040_HSDRVMODE (1 << 3)
129 130
131/* HFLCTL/R (0x14/0x16) fields */
132
133#define TWL6040_HFDACENA (1 << 0)
134#define TWL6040_HFPGAENA (1 << 1)
135#define TWL6040_HFDRVENA (1 << 4)
136
130/* VIBCTLL/R (0x18/0x1A) fields */ 137/* VIBCTLL/R (0x18/0x1A) fields */
131 138
132#define TWL6040_VIBENA (1 << 0) 139#define TWL6040_VIBENA (1 << 0)
@@ -178,6 +185,7 @@
178 185
179#define TWL6040_GPO_MAX 3 186#define TWL6040_GPO_MAX 3
180 187
188/* TODO: All platform data struct can be removed */
181struct twl6040_codec_data { 189struct twl6040_codec_data {
182 u16 hs_left_step; 190 u16 hs_left_step;
183 u16 hs_right_step; 191 u16 hs_right_step;
@@ -222,7 +230,6 @@ struct twl6040 {
222 int audpwron; 230 int audpwron;
223 int power_count; 231 int power_count;
224 int rev; 232 int rev;
225 u8 vibra_ctrl_cache[2];
226 233
227 /* PLL configuration */ 234 /* PLL configuration */
228 int pll; 235 int pll;
diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h
index 28af41756360..88f90cbf8e6a 100644
--- a/include/linux/mfd/ucb1x00.h
+++ b/include/linux/mfd/ucb1x00.h
@@ -10,6 +10,7 @@
10#ifndef UCB1200_H 10#ifndef UCB1200_H
11#define UCB1200_H 11#define UCB1200_H
12 12
13#include <linux/device.h>
13#include <linux/mfd/mcp.h> 14#include <linux/mfd/mcp.h>
14#include <linux/gpio.h> 15#include <linux/gpio.h>
15#include <linux/mutex.h> 16#include <linux/mutex.h>
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index ae5c249530b4..40854ac0ba3d 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -29,6 +29,7 @@ enum wm8994_type {
29 29
30struct regulator_dev; 30struct regulator_dev;
31struct regulator_bulk_data; 31struct regulator_bulk_data;
32struct irq_domain;
32 33
33#define WM8994_NUM_GPIO_REGS 11 34#define WM8994_NUM_GPIO_REGS 11
34#define WM8994_NUM_LDO_REGS 2 35#define WM8994_NUM_LDO_REGS 2
@@ -73,6 +74,7 @@ struct wm8994 {
73 74
74 int irq; 75 int irq;
75 struct regmap_irq_chip_data *irq_data; 76 struct regmap_irq_chip_data *irq_data;
77 struct irq_domain *edge_irq;
76 78
77 /* Used over suspend/resume */ 79 /* Used over suspend/resume */
78 bool suspended; 80 bool suspended;
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 68e776594889..90c60524a496 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -182,6 +182,11 @@ struct wm8994_pdata {
182 */ 182 */
183 int micdet_delay; 183 int micdet_delay;
184 184
185 /* Delay between microphone detect completing and reporting on
186 * insert (specified in ms)
187 */
188 int mic_id_delay;
189
185 /* IRQ for microphone detection if brought out directly as a 190 /* IRQ for microphone detection if brought out directly as a
186 * signal. 191 * signal.
187 */ 192 */
@@ -223,6 +228,11 @@ struct wm8994_pdata {
223 * lines is mastered. 228 * lines is mastered.
224 */ 229 */
225 int max_channels_clocked[WM8994_NUM_AIF]; 230 int max_channels_clocked[WM8994_NUM_AIF];
231
232 /**
233 * GPIO for the IRQ pin if host only supports edge triggering
234 */
235 int irq_gpio;
226}; 236};
227 237
228#endif 238#endif
diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h
index 053548961c15..db8cef3d5321 100644
--- a/include/linux/mfd/wm8994/registers.h
+++ b/include/linux/mfd/wm8994/registers.h
@@ -2668,6 +2668,10 @@
2668/* 2668/*
2669 * R772 (0x304) - AIF1ADC LRCLK 2669 * R772 (0x304) - AIF1ADC LRCLK
2670 */ 2670 */
2671#define WM8958_AIF1_LRCLK_INV 0x1000 /* AIF1_LRCLK_INV */
2672#define WM8958_AIF1_LRCLK_INV_MASK 0x1000 /* AIF1_LRCLK_INV */
2673#define WM8958_AIF1_LRCLK_INV_SHIFT 12 /* AIF1_LRCLK_INV */
2674#define WM8958_AIF1_LRCLK_INV_WIDTH 1 /* AIF1_LRCLK_INV */
2671#define WM8994_AIF1ADC_LRCLK_DIR 0x0800 /* AIF1ADC_LRCLK_DIR */ 2675#define WM8994_AIF1ADC_LRCLK_DIR 0x0800 /* AIF1ADC_LRCLK_DIR */
2672#define WM8994_AIF1ADC_LRCLK_DIR_MASK 0x0800 /* AIF1ADC_LRCLK_DIR */ 2676#define WM8994_AIF1ADC_LRCLK_DIR_MASK 0x0800 /* AIF1ADC_LRCLK_DIR */
2673#define WM8994_AIF1ADC_LRCLK_DIR_SHIFT 11 /* AIF1ADC_LRCLK_DIR */ 2677#define WM8994_AIF1ADC_LRCLK_DIR_SHIFT 11 /* AIF1ADC_LRCLK_DIR */
@@ -2679,6 +2683,10 @@
2679/* 2683/*
2680 * R773 (0x305) - AIF1DAC LRCLK 2684 * R773 (0x305) - AIF1DAC LRCLK
2681 */ 2685 */
2686#define WM8958_AIF1_LRCLK_INV 0x1000 /* AIF1_LRCLK_INV */
2687#define WM8958_AIF1_LRCLK_INV_MASK 0x1000 /* AIF1_LRCLK_INV */
2688#define WM8958_AIF1_LRCLK_INV_SHIFT 12 /* AIF1_LRCLK_INV */
2689#define WM8958_AIF1_LRCLK_INV_WIDTH 1 /* AIF1_LRCLK_INV */
2682#define WM8994_AIF1DAC_LRCLK_DIR 0x0800 /* AIF1DAC_LRCLK_DIR */ 2690#define WM8994_AIF1DAC_LRCLK_DIR 0x0800 /* AIF1DAC_LRCLK_DIR */
2683#define WM8994_AIF1DAC_LRCLK_DIR_MASK 0x0800 /* AIF1DAC_LRCLK_DIR */ 2691#define WM8994_AIF1DAC_LRCLK_DIR_MASK 0x0800 /* AIF1DAC_LRCLK_DIR */
2684#define WM8994_AIF1DAC_LRCLK_DIR_SHIFT 11 /* AIF1DAC_LRCLK_DIR */ 2692#define WM8994_AIF1DAC_LRCLK_DIR_SHIFT 11 /* AIF1DAC_LRCLK_DIR */
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 8752dbbc6135..ad05ce60c1c9 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -17,6 +17,7 @@
17 17
18#define PHY_ID_KSZ8873MLL 0x000e7237 18#define PHY_ID_KSZ8873MLL 0x000e7237
19#define PHY_ID_KSZ9021 0x00221610 19#define PHY_ID_KSZ9021 0x00221610
20#define PHY_ID_KSZ9021RLRN 0x00221611
20#define PHY_ID_KS8737 0x00221720 21#define PHY_ID_KS8737 0x00221720
21#define PHY_ID_KSZ8021 0x00221555 22#define PHY_ID_KSZ8021 0x00221555
22#define PHY_ID_KSZ8031 0x00221556 23#define PHY_ID_KSZ8031 0x00221556
@@ -35,4 +36,9 @@
35/* struct phy_device dev_flags definitions */ 36/* struct phy_device dev_flags definitions */
36#define MICREL_PHY_50MHZ_CLK 0x00000001 37#define MICREL_PHY_50MHZ_CLK 0x00000001
37 38
39#define MICREL_KSZ9021_EXTREG_CTRL 0xB
40#define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC
41#define MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW 0x104
42#define MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW 0x105
43
38#endif /* _MICREL_PHY_H */ 44#endif /* _MICREL_PHY_H */
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index a405d3dc0f61..8d3c57fdf221 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -41,8 +41,6 @@ extern int migrate_page(struct address_space *,
41 struct page *, struct page *, enum migrate_mode); 41 struct page *, struct page *, enum migrate_mode);
42extern int migrate_pages(struct list_head *l, new_page_t x, 42extern int migrate_pages(struct list_head *l, new_page_t x,
43 unsigned long private, enum migrate_mode mode, int reason); 43 unsigned long private, enum migrate_mode mode, int reason);
44extern int migrate_huge_page(struct page *, new_page_t x,
45 unsigned long private, enum migrate_mode mode);
46 44
47extern int fail_migrate_page(struct address_space *, 45extern int fail_migrate_page(struct address_space *,
48 struct page *, struct page *); 46 struct page *, struct page *);
@@ -55,6 +53,9 @@ extern int migrate_vmas(struct mm_struct *mm,
55extern void migrate_page_copy(struct page *newpage, struct page *page); 53extern void migrate_page_copy(struct page *newpage, struct page *page);
56extern int migrate_huge_page_move_mapping(struct address_space *mapping, 54extern int migrate_huge_page_move_mapping(struct address_space *mapping,
57 struct page *newpage, struct page *page); 55 struct page *newpage, struct page *page);
56extern int migrate_page_move_mapping(struct address_space *mapping,
57 struct page *newpage, struct page *page,
58 struct buffer_head *head, enum migrate_mode mode);
58#else 59#else
59 60
60static inline void putback_lru_pages(struct list_head *l) {} 61static inline void putback_lru_pages(struct list_head *l) {}
@@ -62,9 +63,6 @@ static inline void putback_movable_pages(struct list_head *l) {}
62static inline int migrate_pages(struct list_head *l, new_page_t x, 63static inline int migrate_pages(struct list_head *l, new_page_t x,
63 unsigned long private, enum migrate_mode mode, int reason) 64 unsigned long private, enum migrate_mode mode, int reason)
64 { return -ENOSYS; } 65 { return -ENOSYS; }
65static inline int migrate_huge_page(struct page *page, new_page_t x,
66 unsigned long private, enum migrate_mode mode)
67 { return -ENOSYS; }
68 66
69static inline int migrate_prep(void) { return -ENOSYS; } 67static inline int migrate_prep(void) { return -ENOSYS; }
70static inline int migrate_prep_local(void) { return -ENOSYS; } 68static inline int migrate_prep_local(void) { return -ENOSYS; }
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index adf6e0648f20..cd1fdf75103b 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -69,6 +69,7 @@ enum {
69 MLX4_CMD_SET_ICM_SIZE = 0xffd, 69 MLX4_CMD_SET_ICM_SIZE = 0xffd,
70 /*master notify fw on finish for slave's flr*/ 70 /*master notify fw on finish for slave's flr*/
71 MLX4_CMD_INFORM_FLR_DONE = 0x5b, 71 MLX4_CMD_INFORM_FLR_DONE = 0x5b,
72 MLX4_CMD_GET_OP_REQ = 0x59,
72 73
73 /* TPT commands */ 74 /* TPT commands */
74 MLX4_CMD_SW2HW_MPT = 0xd, 75 MLX4_CMD_SW2HW_MPT = 0xd,
@@ -111,6 +112,7 @@ enum {
111 MLX4_CMD_INIT2INIT_QP = 0x2d, 112 MLX4_CMD_INIT2INIT_QP = 0x2d,
112 MLX4_CMD_SUSPEND_QP = 0x32, 113 MLX4_CMD_SUSPEND_QP = 0x32,
113 MLX4_CMD_UNSUSPEND_QP = 0x33, 114 MLX4_CMD_UNSUSPEND_QP = 0x33,
115 MLX4_CMD_UPDATE_QP = 0x61,
114 /* special QP and management commands */ 116 /* special QP and management commands */
115 MLX4_CMD_CONF_SPECIAL_QP = 0x23, 117 MLX4_CMD_CONF_SPECIAL_QP = 0x23,
116 MLX4_CMD_MAD_IFC = 0x24, 118 MLX4_CMD_MAD_IFC = 0x24,
@@ -237,7 +239,7 @@ int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac);
237int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos); 239int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
238int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); 240int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
239int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); 241int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf);
240 242int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state);
241 243
242#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) 244#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8)
243 245
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index a51b0134ce18..24ce6bdd540e 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -33,6 +33,7 @@
33#ifndef MLX4_DEVICE_H 33#ifndef MLX4_DEVICE_H
34#define MLX4_DEVICE_H 34#define MLX4_DEVICE_H
35 35
36#include <linux/if_ether.h>
36#include <linux/pci.h> 37#include <linux/pci.h>
37#include <linux/completion.h> 38#include <linux/completion.h>
38#include <linux/radix-tree.h> 39#include <linux/radix-tree.h>
@@ -157,7 +158,8 @@ enum {
157 MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4, 158 MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4,
158 MLX4_DEV_CAP_FLAG2_TS = 1LL << 5, 159 MLX4_DEV_CAP_FLAG2_TS = 1LL << 5,
159 MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6, 160 MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6,
160 MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7 161 MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7,
162 MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 8
161}; 163};
162 164
163enum { 165enum {
@@ -206,6 +208,7 @@ enum mlx4_event {
206 MLX4_EVENT_TYPE_CMD = 0x0a, 208 MLX4_EVENT_TYPE_CMD = 0x0a,
207 MLX4_EVENT_TYPE_VEP_UPDATE = 0x19, 209 MLX4_EVENT_TYPE_VEP_UPDATE = 0x19,
208 MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18, 210 MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18,
211 MLX4_EVENT_TYPE_OP_REQUIRED = 0x1a,
209 MLX4_EVENT_TYPE_FATAL_WARNING = 0x1b, 212 MLX4_EVENT_TYPE_FATAL_WARNING = 0x1b,
210 MLX4_EVENT_TYPE_FLR_EVENT = 0x1c, 213 MLX4_EVENT_TYPE_FLR_EVENT = 0x1c,
211 MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT = 0x1d, 214 MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT = 0x1d,
@@ -618,7 +621,7 @@ struct mlx4_eth_av {
618 u8 dgid[16]; 621 u8 dgid[16];
619 u32 reserved4[2]; 622 u32 reserved4[2];
620 __be16 vlan; 623 __be16 vlan;
621 u8 mac[6]; 624 u8 mac[ETH_ALEN];
622}; 625};
623 626
624union mlx4_ext_av { 627union mlx4_ext_av {
@@ -912,10 +915,10 @@ enum mlx4_net_trans_promisc_mode {
912}; 915};
913 916
914struct mlx4_spec_eth { 917struct mlx4_spec_eth {
915 u8 dst_mac[6]; 918 u8 dst_mac[ETH_ALEN];
916 u8 dst_mac_msk[6]; 919 u8 dst_mac_msk[ETH_ALEN];
917 u8 src_mac[6]; 920 u8 src_mac[ETH_ALEN];
918 u8 src_mac_msk[6]; 921 u8 src_mac_msk[ETH_ALEN];
919 u8 ether_type_enable; 922 u8 ether_type_enable;
920 __be16 ether_type; 923 __be16 ether_type;
921 __be16 vlan_id_msk; 924 __be16 vlan_id_msk;
@@ -1051,11 +1054,6 @@ struct _rule_hw {
1051 }; 1054 };
1052}; 1055};
1053 1056
1054/* translating DMFS verbs sniffer rule to the FW API would need two reg IDs */
1055struct mlx4_flow_handle {
1056 u64 reg_id[2];
1057};
1058
1059int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port, u32 qpn, 1057int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port, u32 qpn,
1060 enum mlx4_net_trans_promisc_mode mode); 1058 enum mlx4_net_trans_promisc_mode mode);
1061int mlx4_flow_steer_promisc_remove(struct mlx4_dev *dev, u8 port, 1059int mlx4_flow_steer_promisc_remove(struct mlx4_dev *dev, u8 port,
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 352eec9df1b8..6d351473c292 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -34,6 +34,7 @@
34#define MLX4_QP_H 34#define MLX4_QP_H
35 35
36#include <linux/types.h> 36#include <linux/types.h>
37#include <linux/if_ether.h>
37 38
38#include <linux/mlx4/device.h> 39#include <linux/mlx4/device.h>
39 40
@@ -143,7 +144,7 @@ struct mlx4_qp_path {
143 u8 feup; 144 u8 feup;
144 u8 fvl_rx; 145 u8 fvl_rx;
145 u8 reserved4[2]; 146 u8 reserved4[2];
146 u8 dmac[6]; 147 u8 dmac[ETH_ALEN];
147}; 148};
148 149
149enum { /* fl */ 150enum { /* fl */
@@ -152,6 +153,8 @@ enum { /* fl */
152}; 153};
153enum { /* vlan_control */ 154enum { /* vlan_control */
154 MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED = 1 << 6, 155 MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED = 1 << 6,
156 MLX4_VLAN_CTRL_ETH_TX_BLOCK_PRIO_TAGGED = 1 << 5, /* 802.1p priority tag */
157 MLX4_VLAN_CTRL_ETH_TX_BLOCK_UNTAGGED = 1 << 4,
155 MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED = 1 << 2, 158 MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED = 1 << 2,
156 MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED = 1 << 1, /* 802.1p priority tag */ 159 MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED = 1 << 1, /* 802.1p priority tag */
157 MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED = 1 << 0 160 MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED = 1 << 0
@@ -206,6 +209,40 @@ struct mlx4_qp_context {
206 u32 reserved5[10]; 209 u32 reserved5[10];
207}; 210};
208 211
212struct mlx4_update_qp_context {
213 __be64 qp_mask;
214 __be64 primary_addr_path_mask;
215 __be64 secondary_addr_path_mask;
216 u64 reserved1;
217 struct mlx4_qp_context qp_context;
218 u64 reserved2[58];
219};
220
221enum {
222 MLX4_UPD_QP_MASK_PM_STATE = 32,
223 MLX4_UPD_QP_MASK_VSD = 33,
224};
225
226enum {
227 MLX4_UPD_QP_PATH_MASK_PKEY_INDEX = 0 + 32,
228 MLX4_UPD_QP_PATH_MASK_FSM = 1 + 32,
229 MLX4_UPD_QP_PATH_MASK_MAC_INDEX = 2 + 32,
230 MLX4_UPD_QP_PATH_MASK_FVL = 3 + 32,
231 MLX4_UPD_QP_PATH_MASK_CV = 4 + 32,
232 MLX4_UPD_QP_PATH_MASK_VLAN_INDEX = 5 + 32,
233 MLX4_UPD_QP_PATH_MASK_ETH_HIDE_CQE_VLAN = 6 + 32,
234 MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_UNTAGGED = 7 + 32,
235 MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_1P = 8 + 32,
236 MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_TAGGED = 9 + 32,
237 MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_UNTAGGED = 10 + 32,
238 MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_1P = 11 + 32,
239 MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_TAGGED = 12 + 32,
240 MLX4_UPD_QP_PATH_MASK_FEUP = 13 + 32,
241 MLX4_UPD_QP_PATH_MASK_SCHED_QUEUE = 14 + 32,
242 MLX4_UPD_QP_PATH_MASK_IF_COUNTER_INDEX = 15 + 32,
243 MLX4_UPD_QP_PATH_MASK_FVL_RX = 16 + 32,
244};
245
209enum { /* param3 */ 246enum { /* param3 */
210 MLX4_STRIP_VLAN = 1 << 30 247 MLX4_STRIP_VLAN = 1 << 30
211}; 248};
@@ -282,7 +319,7 @@ struct mlx4_wqe_datagram_seg {
282 __be32 dqpn; 319 __be32 dqpn;
283 __be32 qkey; 320 __be32 qkey;
284 __be16 vlan; 321 __be16 vlan;
285 u8 mac[6]; 322 u8 mac[ETH_ALEN];
286}; 323};
287 324
288struct mlx4_wqe_lso_seg { 325struct mlx4_wqe_lso_seg {
diff --git a/include/linux/mlx5/cmd.h b/include/linux/mlx5/cmd.h
new file mode 100644
index 000000000000..2826a4b6071e
--- /dev/null
+++ b/include/linux/mlx5/cmd.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_CMD_H
34#define MLX5_CMD_H
35
36#include <linux/types.h>
37
38struct manage_pages_layout {
39 u64 ptr;
40 u32 reserved;
41 u16 num_entries;
42 u16 func_id;
43};
44
45
46struct mlx5_cmd_alloc_uar_imm_out {
47 u32 rsvd[3];
48 u32 uarn;
49};
50
51#endif /* MLX5_CMD_H */
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h
new file mode 100644
index 000000000000..3db67f73d96d
--- /dev/null
+++ b/include/linux/mlx5/cq.h
@@ -0,0 +1,165 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_CORE_CQ_H
34#define MLX5_CORE_CQ_H
35
36#include <rdma/ib_verbs.h>
37#include <linux/mlx5/driver.h>
38
39
40struct mlx5_core_cq {
41 u32 cqn;
42 int cqe_sz;
43 __be32 *set_ci_db;
44 __be32 *arm_db;
45 atomic_t refcount;
46 struct completion free;
47 unsigned vector;
48 int irqn;
49 void (*comp) (struct mlx5_core_cq *);
50 void (*event) (struct mlx5_core_cq *, enum mlx5_event);
51 struct mlx5_uar *uar;
52 u32 cons_index;
53 unsigned arm_sn;
54 struct mlx5_rsc_debug *dbg;
55 int pid;
56};
57
58
59enum {
60 MLX5_CQE_SYNDROME_LOCAL_LENGTH_ERR = 0x01,
61 MLX5_CQE_SYNDROME_LOCAL_QP_OP_ERR = 0x02,
62 MLX5_CQE_SYNDROME_LOCAL_PROT_ERR = 0x04,
63 MLX5_CQE_SYNDROME_WR_FLUSH_ERR = 0x05,
64 MLX5_CQE_SYNDROME_MW_BIND_ERR = 0x06,
65 MLX5_CQE_SYNDROME_BAD_RESP_ERR = 0x10,
66 MLX5_CQE_SYNDROME_LOCAL_ACCESS_ERR = 0x11,
67 MLX5_CQE_SYNDROME_REMOTE_INVAL_REQ_ERR = 0x12,
68 MLX5_CQE_SYNDROME_REMOTE_ACCESS_ERR = 0x13,
69 MLX5_CQE_SYNDROME_REMOTE_OP_ERR = 0x14,
70 MLX5_CQE_SYNDROME_TRANSPORT_RETRY_EXC_ERR = 0x15,
71 MLX5_CQE_SYNDROME_RNR_RETRY_EXC_ERR = 0x16,
72 MLX5_CQE_SYNDROME_REMOTE_ABORTED_ERR = 0x22,
73};
74
75enum {
76 MLX5_CQE_OWNER_MASK = 1,
77 MLX5_CQE_REQ = 0,
78 MLX5_CQE_RESP_WR_IMM = 1,
79 MLX5_CQE_RESP_SEND = 2,
80 MLX5_CQE_RESP_SEND_IMM = 3,
81 MLX5_CQE_RESP_SEND_INV = 4,
82 MLX5_CQE_RESIZE_CQ = 0xff, /* TBD */
83 MLX5_CQE_REQ_ERR = 13,
84 MLX5_CQE_RESP_ERR = 14,
85};
86
87enum {
88 MLX5_CQ_MODIFY_RESEIZE = 0,
89 MLX5_CQ_MODIFY_MODER = 1,
90 MLX5_CQ_MODIFY_MAPPING = 2,
91};
92
93struct mlx5_cq_modify_params {
94 int type;
95 union {
96 struct {
97 u32 page_offset;
98 u8 log_cq_size;
99 } resize;
100
101 struct {
102 } moder;
103
104 struct {
105 } mapping;
106 } params;
107};
108
109enum {
110 CQE_SIZE_64 = 0,
111 CQE_SIZE_128 = 1,
112};
113
114static inline int cqe_sz_to_mlx_sz(u8 size)
115{
116 return size == 64 ? CQE_SIZE_64 : CQE_SIZE_128;
117}
118
119static inline void mlx5_cq_set_ci(struct mlx5_core_cq *cq)
120{
121 *cq->set_ci_db = cpu_to_be32(cq->cons_index & 0xffffff);
122}
123
124enum {
125 MLX5_CQ_DB_REQ_NOT_SOL = 1 << 24,
126 MLX5_CQ_DB_REQ_NOT = 0 << 24
127};
128
129static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd,
130 void __iomem *uar_page,
131 spinlock_t *doorbell_lock)
132{
133 __be32 doorbell[2];
134 u32 sn;
135 u32 ci;
136
137 sn = cq->arm_sn & 3;
138 ci = cq->cons_index & 0xffffff;
139
140 *cq->arm_db = cpu_to_be32(sn << 28 | cmd | ci);
141
142 /* Make sure that the doorbell record in host memory is
143 * written before ringing the doorbell via PCI MMIO.
144 */
145 wmb();
146
147 doorbell[0] = cpu_to_be32(sn << 28 | cmd | ci);
148 doorbell[1] = cpu_to_be32(cq->cqn);
149
150 mlx5_write64(doorbell, uar_page + MLX5_CQ_DOORBELL, doorbell_lock);
151}
152
153int mlx5_init_cq_table(struct mlx5_core_dev *dev);
154void mlx5_cleanup_cq_table(struct mlx5_core_dev *dev);
155int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
156 struct mlx5_create_cq_mbox_in *in, int inlen);
157int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
158int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
159 struct mlx5_query_cq_mbox_out *out);
160int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
161 int type, struct mlx5_cq_modify_params *params);
162int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
163void mlx5_debug_cq_remove(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
164
165#endif /* MLX5_CORE_CQ_H */
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
new file mode 100644
index 000000000000..68029b30c3dc
--- /dev/null
+++ b/include/linux/mlx5/device.h
@@ -0,0 +1,911 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_DEVICE_H
34#define MLX5_DEVICE_H
35
36#include <linux/types.h>
37#include <rdma/ib_verbs.h>
38
39#if defined(__LITTLE_ENDIAN)
40#define MLX5_SET_HOST_ENDIANNESS 0
41#elif defined(__BIG_ENDIAN)
42#define MLX5_SET_HOST_ENDIANNESS 0x80
43#else
44#error Host endianness not defined
45#endif
46
47enum {
48 MLX5_MAX_COMMANDS = 32,
49 MLX5_CMD_DATA_BLOCK_SIZE = 512,
50 MLX5_PCI_CMD_XPORT = 7,
51};
52
53enum {
54 MLX5_EXTENDED_UD_AV = 0x80000000,
55};
56
57enum {
58 MLX5_CQ_STATE_ARMED = 9,
59 MLX5_CQ_STATE_ALWAYS_ARMED = 0xb,
60 MLX5_CQ_STATE_FIRED = 0xa,
61};
62
63enum {
64 MLX5_STAT_RATE_OFFSET = 5,
65};
66
67enum {
68 MLX5_INLINE_SEG = 0x80000000,
69};
70
71enum {
72 MLX5_PERM_LOCAL_READ = 1 << 2,
73 MLX5_PERM_LOCAL_WRITE = 1 << 3,
74 MLX5_PERM_REMOTE_READ = 1 << 4,
75 MLX5_PERM_REMOTE_WRITE = 1 << 5,
76 MLX5_PERM_ATOMIC = 1 << 6,
77 MLX5_PERM_UMR_EN = 1 << 7,
78};
79
80enum {
81 MLX5_PCIE_CTRL_SMALL_FENCE = 1 << 0,
82 MLX5_PCIE_CTRL_RELAXED_ORDERING = 1 << 2,
83 MLX5_PCIE_CTRL_NO_SNOOP = 1 << 3,
84 MLX5_PCIE_CTRL_TLP_PROCE_EN = 1 << 6,
85 MLX5_PCIE_CTRL_TPH_MASK = 3 << 4,
86};
87
88enum {
89 MLX5_ACCESS_MODE_PA = 0,
90 MLX5_ACCESS_MODE_MTT = 1,
91 MLX5_ACCESS_MODE_KLM = 2
92};
93
94enum {
95 MLX5_MKEY_REMOTE_INVAL = 1 << 24,
96 MLX5_MKEY_FLAG_SYNC_UMR = 1 << 29,
97 MLX5_MKEY_BSF_EN = 1 << 30,
98 MLX5_MKEY_LEN64 = 1 << 31,
99};
100
101enum {
102 MLX5_EN_RD = (u64)1,
103 MLX5_EN_WR = (u64)2
104};
105
106enum {
107 MLX5_BF_REGS_PER_PAGE = 4,
108 MLX5_MAX_UAR_PAGES = 1 << 8,
109 MLX5_MAX_UUARS = MLX5_MAX_UAR_PAGES * MLX5_BF_REGS_PER_PAGE,
110};
111
112enum {
113 MLX5_MKEY_MASK_LEN = 1ull << 0,
114 MLX5_MKEY_MASK_PAGE_SIZE = 1ull << 1,
115 MLX5_MKEY_MASK_START_ADDR = 1ull << 6,
116 MLX5_MKEY_MASK_PD = 1ull << 7,
117 MLX5_MKEY_MASK_EN_RINVAL = 1ull << 8,
118 MLX5_MKEY_MASK_BSF_EN = 1ull << 12,
119 MLX5_MKEY_MASK_KEY = 1ull << 13,
120 MLX5_MKEY_MASK_QPN = 1ull << 14,
121 MLX5_MKEY_MASK_LR = 1ull << 17,
122 MLX5_MKEY_MASK_LW = 1ull << 18,
123 MLX5_MKEY_MASK_RR = 1ull << 19,
124 MLX5_MKEY_MASK_RW = 1ull << 20,
125 MLX5_MKEY_MASK_A = 1ull << 21,
126 MLX5_MKEY_MASK_SMALL_FENCE = 1ull << 23,
127 MLX5_MKEY_MASK_FREE = 1ull << 29,
128};
129
130enum mlx5_event {
131 MLX5_EVENT_TYPE_COMP = 0x0,
132
133 MLX5_EVENT_TYPE_PATH_MIG = 0x01,
134 MLX5_EVENT_TYPE_COMM_EST = 0x02,
135 MLX5_EVENT_TYPE_SQ_DRAINED = 0x03,
136 MLX5_EVENT_TYPE_SRQ_LAST_WQE = 0x13,
137 MLX5_EVENT_TYPE_SRQ_RQ_LIMIT = 0x14,
138
139 MLX5_EVENT_TYPE_CQ_ERROR = 0x04,
140 MLX5_EVENT_TYPE_WQ_CATAS_ERROR = 0x05,
141 MLX5_EVENT_TYPE_PATH_MIG_FAILED = 0x07,
142 MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR = 0x10,
143 MLX5_EVENT_TYPE_WQ_ACCESS_ERROR = 0x11,
144 MLX5_EVENT_TYPE_SRQ_CATAS_ERROR = 0x12,
145
146 MLX5_EVENT_TYPE_INTERNAL_ERROR = 0x08,
147 MLX5_EVENT_TYPE_PORT_CHANGE = 0x09,
148 MLX5_EVENT_TYPE_GPIO_EVENT = 0x15,
149 MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19,
150
151 MLX5_EVENT_TYPE_DB_BF_CONGESTION = 0x1a,
152 MLX5_EVENT_TYPE_STALL_EVENT = 0x1b,
153
154 MLX5_EVENT_TYPE_CMD = 0x0a,
155 MLX5_EVENT_TYPE_PAGE_REQUEST = 0xb,
156};
157
158enum {
159 MLX5_PORT_CHANGE_SUBTYPE_DOWN = 1,
160 MLX5_PORT_CHANGE_SUBTYPE_ACTIVE = 4,
161 MLX5_PORT_CHANGE_SUBTYPE_INITIALIZED = 5,
162 MLX5_PORT_CHANGE_SUBTYPE_LID = 6,
163 MLX5_PORT_CHANGE_SUBTYPE_PKEY = 7,
164 MLX5_PORT_CHANGE_SUBTYPE_GUID = 8,
165 MLX5_PORT_CHANGE_SUBTYPE_CLIENT_REREG = 9,
166};
167
168enum {
169 MLX5_DEV_CAP_FLAG_RC = 1LL << 0,
170 MLX5_DEV_CAP_FLAG_UC = 1LL << 1,
171 MLX5_DEV_CAP_FLAG_UD = 1LL << 2,
172 MLX5_DEV_CAP_FLAG_XRC = 1LL << 3,
173 MLX5_DEV_CAP_FLAG_SRQ = 1LL << 6,
174 MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8,
175 MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9,
176 MLX5_DEV_CAP_FLAG_APM = 1LL << 17,
177 MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18,
178 MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24,
179 MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32,
180 MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38,
181 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39,
182 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
183 MLX5_DEV_CAP_FLAG_DCT = 1LL << 41,
184 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 1LL << 46,
185};
186
187enum {
188 MLX5_OPCODE_NOP = 0x00,
189 MLX5_OPCODE_SEND_INVAL = 0x01,
190 MLX5_OPCODE_RDMA_WRITE = 0x08,
191 MLX5_OPCODE_RDMA_WRITE_IMM = 0x09,
192 MLX5_OPCODE_SEND = 0x0a,
193 MLX5_OPCODE_SEND_IMM = 0x0b,
194 MLX5_OPCODE_RDMA_READ = 0x10,
195 MLX5_OPCODE_ATOMIC_CS = 0x11,
196 MLX5_OPCODE_ATOMIC_FA = 0x12,
197 MLX5_OPCODE_ATOMIC_MASKED_CS = 0x14,
198 MLX5_OPCODE_ATOMIC_MASKED_FA = 0x15,
199 MLX5_OPCODE_BIND_MW = 0x18,
200 MLX5_OPCODE_CONFIG_CMD = 0x1f,
201
202 MLX5_RECV_OPCODE_RDMA_WRITE_IMM = 0x00,
203 MLX5_RECV_OPCODE_SEND = 0x01,
204 MLX5_RECV_OPCODE_SEND_IMM = 0x02,
205 MLX5_RECV_OPCODE_SEND_INVAL = 0x03,
206
207 MLX5_CQE_OPCODE_ERROR = 0x1e,
208 MLX5_CQE_OPCODE_RESIZE = 0x16,
209
210 MLX5_OPCODE_SET_PSV = 0x20,
211 MLX5_OPCODE_GET_PSV = 0x21,
212 MLX5_OPCODE_CHECK_PSV = 0x22,
213 MLX5_OPCODE_RGET_PSV = 0x26,
214 MLX5_OPCODE_RCHECK_PSV = 0x27,
215
216 MLX5_OPCODE_UMR = 0x25,
217
218};
219
220enum {
221 MLX5_SET_PORT_RESET_QKEY = 0,
222 MLX5_SET_PORT_GUID0 = 16,
223 MLX5_SET_PORT_NODE_GUID = 17,
224 MLX5_SET_PORT_SYS_GUID = 18,
225 MLX5_SET_PORT_GID_TABLE = 19,
226 MLX5_SET_PORT_PKEY_TABLE = 20,
227};
228
229enum {
230 MLX5_MAX_PAGE_SHIFT = 31
231};
232
233struct mlx5_inbox_hdr {
234 __be16 opcode;
235 u8 rsvd[4];
236 __be16 opmod;
237};
238
239struct mlx5_outbox_hdr {
240 u8 status;
241 u8 rsvd[3];
242 __be32 syndrome;
243};
244
245struct mlx5_cmd_query_adapter_mbox_in {
246 struct mlx5_inbox_hdr hdr;
247 u8 rsvd[8];
248};
249
250struct mlx5_cmd_query_adapter_mbox_out {
251 struct mlx5_outbox_hdr hdr;
252 u8 rsvd0[24];
253 u8 intapin;
254 u8 rsvd1[13];
255 __be16 vsd_vendor_id;
256 u8 vsd[208];
257 u8 vsd_psid[16];
258};
259
260struct mlx5_hca_cap {
261 u8 rsvd1[16];
262 u8 log_max_srq_sz;
263 u8 log_max_qp_sz;
264 u8 rsvd2;
265 u8 log_max_qp;
266 u8 log_max_strq_sz;
267 u8 log_max_srqs;
268 u8 rsvd4[2];
269 u8 rsvd5;
270 u8 log_max_cq_sz;
271 u8 rsvd6;
272 u8 log_max_cq;
273 u8 log_max_eq_sz;
274 u8 log_max_mkey;
275 u8 rsvd7;
276 u8 log_max_eq;
277 u8 max_indirection;
278 u8 log_max_mrw_sz;
279 u8 log_max_bsf_list_sz;
280 u8 log_max_klm_list_sz;
281 u8 rsvd_8_0;
282 u8 log_max_ra_req_dc;
283 u8 rsvd_8_1;
284 u8 log_max_ra_res_dc;
285 u8 rsvd9;
286 u8 log_max_ra_req_qp;
287 u8 rsvd10;
288 u8 log_max_ra_res_qp;
289 u8 rsvd11[4];
290 __be16 max_qp_count;
291 __be16 rsvd12;
292 u8 rsvd13;
293 u8 local_ca_ack_delay;
294 u8 rsvd14;
295 u8 num_ports;
296 u8 log_max_msg;
297 u8 rsvd15[3];
298 __be16 stat_rate_support;
299 u8 rsvd16[2];
300 __be64 flags;
301 u8 rsvd17;
302 u8 uar_sz;
303 u8 rsvd18;
304 u8 log_pg_sz;
305 __be16 bf_log_bf_reg_size;
306 u8 rsvd19[4];
307 __be16 max_desc_sz_sq;
308 u8 rsvd20[2];
309 __be16 max_desc_sz_rq;
310 u8 rsvd21[2];
311 __be16 max_desc_sz_sq_dc;
312 __be32 max_qp_mcg;
313 u8 rsvd22[3];
314 u8 log_max_mcg;
315 u8 rsvd23;
316 u8 log_max_pd;
317 u8 rsvd24;
318 u8 log_max_xrcd;
319 u8 rsvd25[42];
320 __be16 log_uar_page_sz;
321 u8 rsvd26[28];
322 u8 log_msx_atomic_size_qp;
323 u8 rsvd27[2];
324 u8 log_msx_atomic_size_dc;
325 u8 rsvd28[76];
326};
327
328
329struct mlx5_cmd_query_hca_cap_mbox_in {
330 struct mlx5_inbox_hdr hdr;
331 u8 rsvd[8];
332};
333
334
335struct mlx5_cmd_query_hca_cap_mbox_out {
336 struct mlx5_outbox_hdr hdr;
337 u8 rsvd0[8];
338 struct mlx5_hca_cap hca_cap;
339};
340
341
342struct mlx5_cmd_set_hca_cap_mbox_in {
343 struct mlx5_inbox_hdr hdr;
344 u8 rsvd[8];
345 struct mlx5_hca_cap hca_cap;
346};
347
348
349struct mlx5_cmd_set_hca_cap_mbox_out {
350 struct mlx5_outbox_hdr hdr;
351 u8 rsvd0[8];
352};
353
354
355struct mlx5_cmd_init_hca_mbox_in {
356 struct mlx5_inbox_hdr hdr;
357 u8 rsvd0[2];
358 __be16 profile;
359 u8 rsvd1[4];
360};
361
362struct mlx5_cmd_init_hca_mbox_out {
363 struct mlx5_outbox_hdr hdr;
364 u8 rsvd[8];
365};
366
367struct mlx5_cmd_teardown_hca_mbox_in {
368 struct mlx5_inbox_hdr hdr;
369 u8 rsvd0[2];
370 __be16 profile;
371 u8 rsvd1[4];
372};
373
374struct mlx5_cmd_teardown_hca_mbox_out {
375 struct mlx5_outbox_hdr hdr;
376 u8 rsvd[8];
377};
378
379struct mlx5_cmd_layout {
380 u8 type;
381 u8 rsvd0[3];
382 __be32 inlen;
383 __be64 in_ptr;
384 __be32 in[4];
385 __be32 out[4];
386 __be64 out_ptr;
387 __be32 outlen;
388 u8 token;
389 u8 sig;
390 u8 rsvd1;
391 u8 status_own;
392};
393
394
395struct health_buffer {
396 __be32 assert_var[5];
397 __be32 rsvd0[3];
398 __be32 assert_exit_ptr;
399 __be32 assert_callra;
400 __be32 rsvd1[2];
401 __be32 fw_ver;
402 __be32 hw_id;
403 __be32 rsvd2;
404 u8 irisc_index;
405 u8 synd;
406 __be16 ext_sync;
407};
408
409struct mlx5_init_seg {
410 __be32 fw_rev;
411 __be32 cmdif_rev_fw_sub;
412 __be32 rsvd0[2];
413 __be32 cmdq_addr_h;
414 __be32 cmdq_addr_l_sz;
415 __be32 cmd_dbell;
416 __be32 rsvd1[121];
417 struct health_buffer health;
418 __be32 rsvd2[884];
419 __be32 health_counter;
420 __be32 rsvd3[1023];
421 __be64 ieee1588_clk;
422 __be32 ieee1588_clk_type;
423 __be32 clr_intx;
424};
425
426struct mlx5_eqe_comp {
427 __be32 reserved[6];
428 __be32 cqn;
429};
430
431struct mlx5_eqe_qp_srq {
432 __be32 reserved[6];
433 __be32 qp_srq_n;
434};
435
436struct mlx5_eqe_cq_err {
437 __be32 cqn;
438 u8 reserved1[7];
439 u8 syndrome;
440};
441
442struct mlx5_eqe_dropped_packet {
443};
444
445struct mlx5_eqe_port_state {
446 u8 reserved0[8];
447 u8 port;
448};
449
450struct mlx5_eqe_gpio {
451 __be32 reserved0[2];
452 __be64 gpio_event;
453};
454
455struct mlx5_eqe_congestion {
456 u8 type;
457 u8 rsvd0;
458 u8 congestion_level;
459};
460
461struct mlx5_eqe_stall_vl {
462 u8 rsvd0[3];
463 u8 port_vl;
464};
465
466struct mlx5_eqe_cmd {
467 __be32 vector;
468 __be32 rsvd[6];
469};
470
471struct mlx5_eqe_page_req {
472 u8 rsvd0[2];
473 __be16 func_id;
474 __be32 num_pages;
475 __be32 rsvd1[5];
476};
477
478union ev_data {
479 __be32 raw[7];
480 struct mlx5_eqe_cmd cmd;
481 struct mlx5_eqe_comp comp;
482 struct mlx5_eqe_qp_srq qp_srq;
483 struct mlx5_eqe_cq_err cq_err;
484 struct mlx5_eqe_dropped_packet dp;
485 struct mlx5_eqe_port_state port;
486 struct mlx5_eqe_gpio gpio;
487 struct mlx5_eqe_congestion cong;
488 struct mlx5_eqe_stall_vl stall_vl;
489 struct mlx5_eqe_page_req req_pages;
490} __packed;
491
492struct mlx5_eqe {
493 u8 rsvd0;
494 u8 type;
495 u8 rsvd1;
496 u8 sub_type;
497 __be32 rsvd2[7];
498 union ev_data data;
499 __be16 rsvd3;
500 u8 signature;
501 u8 owner;
502} __packed;
503
504struct mlx5_cmd_prot_block {
505 u8 data[MLX5_CMD_DATA_BLOCK_SIZE];
506 u8 rsvd0[48];
507 __be64 next;
508 __be32 block_num;
509 u8 rsvd1;
510 u8 token;
511 u8 ctrl_sig;
512 u8 sig;
513};
514
515struct mlx5_err_cqe {
516 u8 rsvd0[32];
517 __be32 srqn;
518 u8 rsvd1[18];
519 u8 vendor_err_synd;
520 u8 syndrome;
521 __be32 s_wqe_opcode_qpn;
522 __be16 wqe_counter;
523 u8 signature;
524 u8 op_own;
525};
526
527struct mlx5_cqe64 {
528 u8 rsvd0[17];
529 u8 ml_path;
530 u8 rsvd20[4];
531 __be16 slid;
532 __be32 flags_rqpn;
533 u8 rsvd28[4];
534 __be32 srqn;
535 __be32 imm_inval_pkey;
536 u8 rsvd40[4];
537 __be32 byte_cnt;
538 __be64 timestamp;
539 __be32 sop_drop_qpn;
540 __be16 wqe_counter;
541 u8 signature;
542 u8 op_own;
543};
544
545struct mlx5_wqe_srq_next_seg {
546 u8 rsvd0[2];
547 __be16 next_wqe_index;
548 u8 signature;
549 u8 rsvd1[11];
550};
551
552union mlx5_ext_cqe {
553 struct ib_grh grh;
554 u8 inl[64];
555};
556
557struct mlx5_cqe128 {
558 union mlx5_ext_cqe inl_grh;
559 struct mlx5_cqe64 cqe64;
560};
561
562struct mlx5_srq_ctx {
563 u8 state_log_sz;
564 u8 rsvd0[3];
565 __be32 flags_xrcd;
566 __be32 pgoff_cqn;
567 u8 rsvd1[4];
568 u8 log_pg_sz;
569 u8 rsvd2[7];
570 __be32 pd;
571 __be16 lwm;
572 __be16 wqe_cnt;
573 u8 rsvd3[8];
574 __be64 db_record;
575};
576
577struct mlx5_create_srq_mbox_in {
578 struct mlx5_inbox_hdr hdr;
579 __be32 input_srqn;
580 u8 rsvd0[4];
581 struct mlx5_srq_ctx ctx;
582 u8 rsvd1[208];
583 __be64 pas[0];
584};
585
586struct mlx5_create_srq_mbox_out {
587 struct mlx5_outbox_hdr hdr;
588 __be32 srqn;
589 u8 rsvd[4];
590};
591
592struct mlx5_destroy_srq_mbox_in {
593 struct mlx5_inbox_hdr hdr;
594 __be32 srqn;
595 u8 rsvd[4];
596};
597
598struct mlx5_destroy_srq_mbox_out {
599 struct mlx5_outbox_hdr hdr;
600 u8 rsvd[8];
601};
602
603struct mlx5_query_srq_mbox_in {
604 struct mlx5_inbox_hdr hdr;
605 __be32 srqn;
606 u8 rsvd0[4];
607};
608
609struct mlx5_query_srq_mbox_out {
610 struct mlx5_outbox_hdr hdr;
611 u8 rsvd0[8];
612 struct mlx5_srq_ctx ctx;
613 u8 rsvd1[32];
614 __be64 pas[0];
615};
616
617struct mlx5_arm_srq_mbox_in {
618 struct mlx5_inbox_hdr hdr;
619 __be32 srqn;
620 __be16 rsvd;
621 __be16 lwm;
622};
623
624struct mlx5_arm_srq_mbox_out {
625 struct mlx5_outbox_hdr hdr;
626 u8 rsvd[8];
627};
628
629struct mlx5_cq_context {
630 u8 status;
631 u8 cqe_sz_flags;
632 u8 st;
633 u8 rsvd3;
634 u8 rsvd4[6];
635 __be16 page_offset;
636 __be32 log_sz_usr_page;
637 __be16 cq_period;
638 __be16 cq_max_count;
639 __be16 rsvd20;
640 __be16 c_eqn;
641 u8 log_pg_sz;
642 u8 rsvd25[7];
643 __be32 last_notified_index;
644 __be32 solicit_producer_index;
645 __be32 consumer_counter;
646 __be32 producer_counter;
647 u8 rsvd48[8];
648 __be64 db_record_addr;
649};
650
651struct mlx5_create_cq_mbox_in {
652 struct mlx5_inbox_hdr hdr;
653 __be32 input_cqn;
654 u8 rsvdx[4];
655 struct mlx5_cq_context ctx;
656 u8 rsvd6[192];
657 __be64 pas[0];
658};
659
660struct mlx5_create_cq_mbox_out {
661 struct mlx5_outbox_hdr hdr;
662 __be32 cqn;
663 u8 rsvd0[4];
664};
665
666struct mlx5_destroy_cq_mbox_in {
667 struct mlx5_inbox_hdr hdr;
668 __be32 cqn;
669 u8 rsvd0[4];
670};
671
672struct mlx5_destroy_cq_mbox_out {
673 struct mlx5_outbox_hdr hdr;
674 u8 rsvd0[8];
675};
676
677struct mlx5_query_cq_mbox_in {
678 struct mlx5_inbox_hdr hdr;
679 __be32 cqn;
680 u8 rsvd0[4];
681};
682
683struct mlx5_query_cq_mbox_out {
684 struct mlx5_outbox_hdr hdr;
685 u8 rsvd0[8];
686 struct mlx5_cq_context ctx;
687 u8 rsvd6[16];
688 __be64 pas[0];
689};
690
691struct mlx5_enable_hca_mbox_in {
692 struct mlx5_inbox_hdr hdr;
693 u8 rsvd[8];
694};
695
696struct mlx5_enable_hca_mbox_out {
697 struct mlx5_outbox_hdr hdr;
698 u8 rsvd[8];
699};
700
701struct mlx5_disable_hca_mbox_in {
702 struct mlx5_inbox_hdr hdr;
703 u8 rsvd[8];
704};
705
706struct mlx5_disable_hca_mbox_out {
707 struct mlx5_outbox_hdr hdr;
708 u8 rsvd[8];
709};
710
711struct mlx5_eq_context {
712 u8 status;
713 u8 ec_oi;
714 u8 st;
715 u8 rsvd2[7];
716 __be16 page_pffset;
717 __be32 log_sz_usr_page;
718 u8 rsvd3[7];
719 u8 intr;
720 u8 log_page_size;
721 u8 rsvd4[15];
722 __be32 consumer_counter;
723 __be32 produser_counter;
724 u8 rsvd5[16];
725};
726
727struct mlx5_create_eq_mbox_in {
728 struct mlx5_inbox_hdr hdr;
729 u8 rsvd0[3];
730 u8 input_eqn;
731 u8 rsvd1[4];
732 struct mlx5_eq_context ctx;
733 u8 rsvd2[8];
734 __be64 events_mask;
735 u8 rsvd3[176];
736 __be64 pas[0];
737};
738
739struct mlx5_create_eq_mbox_out {
740 struct mlx5_outbox_hdr hdr;
741 u8 rsvd0[3];
742 u8 eq_number;
743 u8 rsvd1[4];
744};
745
746struct mlx5_destroy_eq_mbox_in {
747 struct mlx5_inbox_hdr hdr;
748 u8 rsvd0[3];
749 u8 eqn;
750 u8 rsvd1[4];
751};
752
753struct mlx5_destroy_eq_mbox_out {
754 struct mlx5_outbox_hdr hdr;
755 u8 rsvd[8];
756};
757
758struct mlx5_map_eq_mbox_in {
759 struct mlx5_inbox_hdr hdr;
760 __be64 mask;
761 u8 mu;
762 u8 rsvd0[2];
763 u8 eqn;
764 u8 rsvd1[24];
765};
766
767struct mlx5_map_eq_mbox_out {
768 struct mlx5_outbox_hdr hdr;
769 u8 rsvd[8];
770};
771
772struct mlx5_query_eq_mbox_in {
773 struct mlx5_inbox_hdr hdr;
774 u8 rsvd0[3];
775 u8 eqn;
776 u8 rsvd1[4];
777};
778
779struct mlx5_query_eq_mbox_out {
780 struct mlx5_outbox_hdr hdr;
781 u8 rsvd[8];
782 struct mlx5_eq_context ctx;
783};
784
785struct mlx5_mkey_seg {
786 /* This is a two bit field occupying bits 31-30.
787 * bit 31 is always 0,
788 * bit 30 is zero for regular MRs and 1 (e.g free) for UMRs that do not have tanslation
789 */
790 u8 status;
791 u8 pcie_control;
792 u8 flags;
793 u8 version;
794 __be32 qpn_mkey7_0;
795 u8 rsvd1[4];
796 __be32 flags_pd;
797 __be64 start_addr;
798 __be64 len;
799 __be32 bsfs_octo_size;
800 u8 rsvd2[16];
801 __be32 xlt_oct_size;
802 u8 rsvd3[3];
803 u8 log2_page_size;
804 u8 rsvd4[4];
805};
806
807struct mlx5_query_special_ctxs_mbox_in {
808 struct mlx5_inbox_hdr hdr;
809 u8 rsvd[8];
810};
811
812struct mlx5_query_special_ctxs_mbox_out {
813 struct mlx5_outbox_hdr hdr;
814 __be32 dump_fill_mkey;
815 __be32 reserved_lkey;
816};
817
818struct mlx5_create_mkey_mbox_in {
819 struct mlx5_inbox_hdr hdr;
820 __be32 input_mkey_index;
821 u8 rsvd0[4];
822 struct mlx5_mkey_seg seg;
823 u8 rsvd1[16];
824 __be32 xlat_oct_act_size;
825 __be32 bsf_coto_act_size;
826 u8 rsvd2[168];
827 __be64 pas[0];
828};
829
830struct mlx5_create_mkey_mbox_out {
831 struct mlx5_outbox_hdr hdr;
832 __be32 mkey;
833 u8 rsvd[4];
834};
835
836struct mlx5_destroy_mkey_mbox_in {
837 struct mlx5_inbox_hdr hdr;
838 __be32 mkey;
839 u8 rsvd[4];
840};
841
842struct mlx5_destroy_mkey_mbox_out {
843 struct mlx5_outbox_hdr hdr;
844 u8 rsvd[8];
845};
846
847struct mlx5_query_mkey_mbox_in {
848 struct mlx5_inbox_hdr hdr;
849 __be32 mkey;
850};
851
852struct mlx5_query_mkey_mbox_out {
853 struct mlx5_outbox_hdr hdr;
854 __be64 pas[0];
855};
856
857struct mlx5_modify_mkey_mbox_in {
858 struct mlx5_inbox_hdr hdr;
859 __be32 mkey;
860 __be64 pas[0];
861};
862
863struct mlx5_modify_mkey_mbox_out {
864 struct mlx5_outbox_hdr hdr;
865};
866
867struct mlx5_dump_mkey_mbox_in {
868 struct mlx5_inbox_hdr hdr;
869};
870
871struct mlx5_dump_mkey_mbox_out {
872 struct mlx5_outbox_hdr hdr;
873 __be32 mkey;
874};
875
876struct mlx5_mad_ifc_mbox_in {
877 struct mlx5_inbox_hdr hdr;
878 __be16 remote_lid;
879 u8 rsvd0;
880 u8 port;
881 u8 rsvd1[4];
882 u8 data[256];
883};
884
885struct mlx5_mad_ifc_mbox_out {
886 struct mlx5_outbox_hdr hdr;
887 u8 rsvd[8];
888 u8 data[256];
889};
890
891struct mlx5_access_reg_mbox_in {
892 struct mlx5_inbox_hdr hdr;
893 u8 rsvd0[2];
894 __be16 register_id;
895 __be32 arg;
896 __be32 data[0];
897};
898
899struct mlx5_access_reg_mbox_out {
900 struct mlx5_outbox_hdr hdr;
901 u8 rsvd[8];
902 __be32 data[0];
903};
904
905#define MLX5_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
906
907enum {
908 MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0
909};
910
911#endif /* MLX5_DEVICE_H */
diff --git a/include/linux/mlx5/doorbell.h b/include/linux/mlx5/doorbell.h
new file mode 100644
index 000000000000..163a818411e7
--- /dev/null
+++ b/include/linux/mlx5/doorbell.h
@@ -0,0 +1,79 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_DOORBELL_H
34#define MLX5_DOORBELL_H
35
36#define MLX5_BF_OFFSET 0x800
37#define MLX5_CQ_DOORBELL 0x20
38
39#if BITS_PER_LONG == 64
40/* Assume that we can just write a 64-bit doorbell atomically. s390
41 * actually doesn't have writeq() but S/390 systems don't even have
42 * PCI so we won't worry about it.
43 */
44
45#define MLX5_DECLARE_DOORBELL_LOCK(name)
46#define MLX5_INIT_DOORBELL_LOCK(ptr) do { } while (0)
47#define MLX5_GET_DOORBELL_LOCK(ptr) (NULL)
48
49static inline void mlx5_write64(__be32 val[2], void __iomem *dest,
50 spinlock_t *doorbell_lock)
51{
52 __raw_writeq(*(u64 *)val, dest);
53}
54
55#else
56
57/* Just fall back to a spinlock to protect the doorbell if
58 * BITS_PER_LONG is 32 -- there's no portable way to do atomic 64-bit
59 * MMIO writes.
60 */
61
62#define MLX5_DECLARE_DOORBELL_LOCK(name) spinlock_t name;
63#define MLX5_INIT_DOORBELL_LOCK(ptr) spin_lock_init(ptr)
64#define MLX5_GET_DOORBELL_LOCK(ptr) (ptr)
65
66static inline void mlx5_write64(__be32 val[2], void __iomem *dest,
67 spinlock_t *doorbell_lock)
68{
69 unsigned long flags;
70
71 spin_lock_irqsave(doorbell_lock, flags);
72 __raw_writel((__force u32) val[0], dest);
73 __raw_writel((__force u32) val[1], dest + 4);
74 spin_unlock_irqrestore(doorbell_lock, flags);
75}
76
77#endif
78
79#endif /* MLX5_DOORBELL_H */
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
new file mode 100644
index 000000000000..8888381fc150
--- /dev/null
+++ b/include/linux/mlx5/driver.h
@@ -0,0 +1,768 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_DRIVER_H
34#define MLX5_DRIVER_H
35
36#include <linux/kernel.h>
37#include <linux/completion.h>
38#include <linux/pci.h>
39#include <linux/spinlock_types.h>
40#include <linux/semaphore.h>
41#include <linux/vmalloc.h>
42#include <linux/radix-tree.h>
43#include <linux/mlx5/device.h>
44#include <linux/mlx5/doorbell.h>
45
46enum {
47 MLX5_BOARD_ID_LEN = 64,
48 MLX5_MAX_NAME_LEN = 16,
49};
50
51enum {
52 /* one minute for the sake of bringup. Generally, commands must always
53 * complete and we may need to increase this timeout value
54 */
55 MLX5_CMD_TIMEOUT_MSEC = 7200 * 1000,
56 MLX5_CMD_WQ_MAX_NAME = 32,
57};
58
59enum {
60 CMD_OWNER_SW = 0x0,
61 CMD_OWNER_HW = 0x1,
62 CMD_STATUS_SUCCESS = 0,
63};
64
65enum mlx5_sqp_t {
66 MLX5_SQP_SMI = 0,
67 MLX5_SQP_GSI = 1,
68 MLX5_SQP_IEEE_1588 = 2,
69 MLX5_SQP_SNIFFER = 3,
70 MLX5_SQP_SYNC_UMR = 4,
71};
72
73enum {
74 MLX5_MAX_PORTS = 2,
75};
76
77enum {
78 MLX5_EQ_VEC_PAGES = 0,
79 MLX5_EQ_VEC_CMD = 1,
80 MLX5_EQ_VEC_ASYNC = 2,
81 MLX5_EQ_VEC_COMP_BASE,
82};
83
84enum {
85 MLX5_MAX_EQ_NAME = 20
86};
87
88enum {
89 MLX5_ATOMIC_MODE_IB_COMP = 1 << 16,
90 MLX5_ATOMIC_MODE_CX = 2 << 16,
91 MLX5_ATOMIC_MODE_8B = 3 << 16,
92 MLX5_ATOMIC_MODE_16B = 4 << 16,
93 MLX5_ATOMIC_MODE_32B = 5 << 16,
94 MLX5_ATOMIC_MODE_64B = 6 << 16,
95 MLX5_ATOMIC_MODE_128B = 7 << 16,
96 MLX5_ATOMIC_MODE_256B = 8 << 16,
97};
98
99enum {
100 MLX5_CMD_OP_QUERY_HCA_CAP = 0x100,
101 MLX5_CMD_OP_QUERY_ADAPTER = 0x101,
102 MLX5_CMD_OP_INIT_HCA = 0x102,
103 MLX5_CMD_OP_TEARDOWN_HCA = 0x103,
104 MLX5_CMD_OP_ENABLE_HCA = 0x104,
105 MLX5_CMD_OP_DISABLE_HCA = 0x105,
106 MLX5_CMD_OP_QUERY_PAGES = 0x107,
107 MLX5_CMD_OP_MANAGE_PAGES = 0x108,
108 MLX5_CMD_OP_SET_HCA_CAP = 0x109,
109
110 MLX5_CMD_OP_CREATE_MKEY = 0x200,
111 MLX5_CMD_OP_QUERY_MKEY = 0x201,
112 MLX5_CMD_OP_DESTROY_MKEY = 0x202,
113 MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS = 0x203,
114
115 MLX5_CMD_OP_CREATE_EQ = 0x301,
116 MLX5_CMD_OP_DESTROY_EQ = 0x302,
117 MLX5_CMD_OP_QUERY_EQ = 0x303,
118
119 MLX5_CMD_OP_CREATE_CQ = 0x400,
120 MLX5_CMD_OP_DESTROY_CQ = 0x401,
121 MLX5_CMD_OP_QUERY_CQ = 0x402,
122 MLX5_CMD_OP_MODIFY_CQ = 0x403,
123
124 MLX5_CMD_OP_CREATE_QP = 0x500,
125 MLX5_CMD_OP_DESTROY_QP = 0x501,
126 MLX5_CMD_OP_RST2INIT_QP = 0x502,
127 MLX5_CMD_OP_INIT2RTR_QP = 0x503,
128 MLX5_CMD_OP_RTR2RTS_QP = 0x504,
129 MLX5_CMD_OP_RTS2RTS_QP = 0x505,
130 MLX5_CMD_OP_SQERR2RTS_QP = 0x506,
131 MLX5_CMD_OP_2ERR_QP = 0x507,
132 MLX5_CMD_OP_RTS2SQD_QP = 0x508,
133 MLX5_CMD_OP_SQD2RTS_QP = 0x509,
134 MLX5_CMD_OP_2RST_QP = 0x50a,
135 MLX5_CMD_OP_QUERY_QP = 0x50b,
136 MLX5_CMD_OP_CONF_SQP = 0x50c,
137 MLX5_CMD_OP_MAD_IFC = 0x50d,
138 MLX5_CMD_OP_INIT2INIT_QP = 0x50e,
139 MLX5_CMD_OP_SUSPEND_QP = 0x50f,
140 MLX5_CMD_OP_UNSUSPEND_QP = 0x510,
141 MLX5_CMD_OP_SQD2SQD_QP = 0x511,
142 MLX5_CMD_OP_ALLOC_QP_COUNTER_SET = 0x512,
143 MLX5_CMD_OP_DEALLOC_QP_COUNTER_SET = 0x513,
144 MLX5_CMD_OP_QUERY_QP_COUNTER_SET = 0x514,
145
146 MLX5_CMD_OP_CREATE_PSV = 0x600,
147 MLX5_CMD_OP_DESTROY_PSV = 0x601,
148 MLX5_CMD_OP_QUERY_PSV = 0x602,
149 MLX5_CMD_OP_QUERY_SIG_RULE_TABLE = 0x603,
150 MLX5_CMD_OP_QUERY_BLOCK_SIZE_TABLE = 0x604,
151
152 MLX5_CMD_OP_CREATE_SRQ = 0x700,
153 MLX5_CMD_OP_DESTROY_SRQ = 0x701,
154 MLX5_CMD_OP_QUERY_SRQ = 0x702,
155 MLX5_CMD_OP_ARM_RQ = 0x703,
156 MLX5_CMD_OP_RESIZE_SRQ = 0x704,
157
158 MLX5_CMD_OP_ALLOC_PD = 0x800,
159 MLX5_CMD_OP_DEALLOC_PD = 0x801,
160 MLX5_CMD_OP_ALLOC_UAR = 0x802,
161 MLX5_CMD_OP_DEALLOC_UAR = 0x803,
162
163 MLX5_CMD_OP_ATTACH_TO_MCG = 0x806,
164 MLX5_CMD_OP_DETACH_FROM_MCG = 0x807,
165
166
167 MLX5_CMD_OP_ALLOC_XRCD = 0x80e,
168 MLX5_CMD_OP_DEALLOC_XRCD = 0x80f,
169
170 MLX5_CMD_OP_ACCESS_REG = 0x805,
171 MLX5_CMD_OP_MAX = 0x810,
172};
173
174enum {
175 MLX5_REG_PCAP = 0x5001,
176 MLX5_REG_PMTU = 0x5003,
177 MLX5_REG_PTYS = 0x5004,
178 MLX5_REG_PAOS = 0x5006,
179 MLX5_REG_PMAOS = 0x5012,
180 MLX5_REG_PUDE = 0x5009,
181 MLX5_REG_PMPE = 0x5010,
182 MLX5_REG_PELC = 0x500e,
183 MLX5_REG_PMLP = 0, /* TBD */
184 MLX5_REG_NODE_DESC = 0x6001,
185 MLX5_REG_HOST_ENDIANNESS = 0x7004,
186};
187
188enum dbg_rsc_type {
189 MLX5_DBG_RSC_QP,
190 MLX5_DBG_RSC_EQ,
191 MLX5_DBG_RSC_CQ,
192};
193
194struct mlx5_field_desc {
195 struct dentry *dent;
196 int i;
197};
198
199struct mlx5_rsc_debug {
200 struct mlx5_core_dev *dev;
201 void *object;
202 enum dbg_rsc_type type;
203 struct dentry *root;
204 struct mlx5_field_desc fields[0];
205};
206
207enum mlx5_dev_event {
208 MLX5_DEV_EVENT_SYS_ERROR,
209 MLX5_DEV_EVENT_PORT_UP,
210 MLX5_DEV_EVENT_PORT_DOWN,
211 MLX5_DEV_EVENT_PORT_INITIALIZED,
212 MLX5_DEV_EVENT_LID_CHANGE,
213 MLX5_DEV_EVENT_PKEY_CHANGE,
214 MLX5_DEV_EVENT_GUID_CHANGE,
215 MLX5_DEV_EVENT_CLIENT_REREG,
216};
217
218struct mlx5_uuar_info {
219 struct mlx5_uar *uars;
220 int num_uars;
221 int num_low_latency_uuars;
222 unsigned long *bitmap;
223 unsigned int *count;
224 struct mlx5_bf *bfs;
225
226 /*
227 * protect uuar allocation data structs
228 */
229 struct mutex lock;
230};
231
232struct mlx5_bf {
233 void __iomem *reg;
234 void __iomem *regreg;
235 int buf_size;
236 struct mlx5_uar *uar;
237 unsigned long offset;
238 int need_lock;
239 /* protect blue flame buffer selection when needed
240 */
241 spinlock_t lock;
242
243 /* serialize 64 bit writes when done as two 32 bit accesses
244 */
245 spinlock_t lock32;
246 int uuarn;
247};
248
249struct mlx5_cmd_first {
250 __be32 data[4];
251};
252
253struct mlx5_cmd_msg {
254 struct list_head list;
255 struct cache_ent *cache;
256 u32 len;
257 struct mlx5_cmd_first first;
258 struct mlx5_cmd_mailbox *next;
259};
260
261struct mlx5_cmd_debug {
262 struct dentry *dbg_root;
263 struct dentry *dbg_in;
264 struct dentry *dbg_out;
265 struct dentry *dbg_outlen;
266 struct dentry *dbg_status;
267 struct dentry *dbg_run;
268 void *in_msg;
269 void *out_msg;
270 u8 status;
271 u16 inlen;
272 u16 outlen;
273};
274
275struct cache_ent {
276 /* protect block chain allocations
277 */
278 spinlock_t lock;
279 struct list_head head;
280};
281
282struct cmd_msg_cache {
283 struct cache_ent large;
284 struct cache_ent med;
285
286};
287
288struct mlx5_cmd_stats {
289 u64 sum;
290 u64 n;
291 struct dentry *root;
292 struct dentry *avg;
293 struct dentry *count;
294 /* protect command average calculations */
295 spinlock_t lock;
296};
297
298struct mlx5_cmd {
299 void *cmd_buf;
300 dma_addr_t dma;
301 u16 cmdif_rev;
302 u8 log_sz;
303 u8 log_stride;
304 int max_reg_cmds;
305 int events;
306 u32 __iomem *vector;
307
308 /* protect command queue allocations
309 */
310 spinlock_t alloc_lock;
311
312 /* protect token allocations
313 */
314 spinlock_t token_lock;
315 u8 token;
316 unsigned long bitmask;
317 char wq_name[MLX5_CMD_WQ_MAX_NAME];
318 struct workqueue_struct *wq;
319 struct semaphore sem;
320 struct semaphore pages_sem;
321 int mode;
322 struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS];
323 struct pci_pool *pool;
324 struct mlx5_cmd_debug dbg;
325 struct cmd_msg_cache cache;
326 int checksum_disabled;
327 struct mlx5_cmd_stats stats[MLX5_CMD_OP_MAX];
328};
329
330struct mlx5_port_caps {
331 int gid_table_len;
332 int pkey_table_len;
333};
334
335struct mlx5_caps {
336 u8 log_max_eq;
337 u8 log_max_cq;
338 u8 log_max_qp;
339 u8 log_max_mkey;
340 u8 log_max_pd;
341 u8 log_max_srq;
342 u32 max_cqes;
343 int max_wqes;
344 int max_sq_desc_sz;
345 int max_rq_desc_sz;
346 u64 flags;
347 u16 stat_rate_support;
348 int log_max_msg;
349 int num_ports;
350 int max_ra_res_qp;
351 int max_ra_req_qp;
352 int max_srq_wqes;
353 int bf_reg_size;
354 int bf_regs_per_page;
355 struct mlx5_port_caps port[MLX5_MAX_PORTS];
356 u8 ext_port_cap[MLX5_MAX_PORTS];
357 int max_vf;
358 u32 reserved_lkey;
359 u8 local_ca_ack_delay;
360 u8 log_max_mcg;
361 u32 max_qp_mcg;
362 int min_page_sz;
363};
364
365struct mlx5_cmd_mailbox {
366 void *buf;
367 dma_addr_t dma;
368 struct mlx5_cmd_mailbox *next;
369};
370
371struct mlx5_buf_list {
372 void *buf;
373 dma_addr_t map;
374};
375
376struct mlx5_buf {
377 struct mlx5_buf_list direct;
378 struct mlx5_buf_list *page_list;
379 int nbufs;
380 int npages;
381 int page_shift;
382 int size;
383};
384
385struct mlx5_eq {
386 struct mlx5_core_dev *dev;
387 __be32 __iomem *doorbell;
388 u32 cons_index;
389 struct mlx5_buf buf;
390 int size;
391 u8 irqn;
392 u8 eqn;
393 int nent;
394 u64 mask;
395 char name[MLX5_MAX_EQ_NAME];
396 struct list_head list;
397 int index;
398 struct mlx5_rsc_debug *dbg;
399};
400
401
402struct mlx5_core_mr {
403 u64 iova;
404 u64 size;
405 u32 key;
406 u32 pd;
407 u32 access;
408};
409
410struct mlx5_core_srq {
411 u32 srqn;
412 int max;
413 int max_gs;
414 int max_avail_gather;
415 int wqe_shift;
416 void (*event) (struct mlx5_core_srq *, enum mlx5_event);
417
418 atomic_t refcount;
419 struct completion free;
420};
421
422struct mlx5_eq_table {
423 void __iomem *update_ci;
424 void __iomem *update_arm_ci;
425 struct list_head *comp_eq_head;
426 struct mlx5_eq pages_eq;
427 struct mlx5_eq async_eq;
428 struct mlx5_eq cmd_eq;
429 struct msix_entry *msix_arr;
430 int num_comp_vectors;
431 /* protect EQs list
432 */
433 spinlock_t lock;
434};
435
436struct mlx5_uar {
437 u32 index;
438 struct list_head bf_list;
439 unsigned free_bf_bmap;
440 void __iomem *wc_map;
441 void __iomem *map;
442};
443
444
445struct mlx5_core_health {
446 struct health_buffer __iomem *health;
447 __be32 __iomem *health_counter;
448 struct timer_list timer;
449 struct list_head list;
450 u32 prev;
451 int miss_counter;
452};
453
454struct mlx5_cq_table {
455 /* protect radix tree
456 */
457 spinlock_t lock;
458 struct radix_tree_root tree;
459};
460
461struct mlx5_qp_table {
462 /* protect radix tree
463 */
464 spinlock_t lock;
465 struct radix_tree_root tree;
466};
467
468struct mlx5_srq_table {
469 /* protect radix tree
470 */
471 spinlock_t lock;
472 struct radix_tree_root tree;
473};
474
475struct mlx5_priv {
476 char name[MLX5_MAX_NAME_LEN];
477 struct mlx5_eq_table eq_table;
478 struct mlx5_uuar_info uuari;
479 MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock);
480
481 /* pages stuff */
482 struct workqueue_struct *pg_wq;
483 struct rb_root page_root;
484 int fw_pages;
485 int reg_pages;
486
487 struct mlx5_core_health health;
488
489 struct mlx5_srq_table srq_table;
490
491 /* start: qp staff */
492 struct mlx5_qp_table qp_table;
493 struct dentry *qp_debugfs;
494 struct dentry *eq_debugfs;
495 struct dentry *cq_debugfs;
496 struct dentry *cmdif_debugfs;
497 /* end: qp staff */
498
499 /* start: cq staff */
500 struct mlx5_cq_table cq_table;
501 /* end: cq staff */
502
503 /* start: alloc staff */
504 struct mutex pgdir_mutex;
505 struct list_head pgdir_list;
506 /* end: alloc staff */
507 struct dentry *dbg_root;
508
509 /* protect mkey key part */
510 spinlock_t mkey_lock;
511 u8 mkey_key;
512};
513
514struct mlx5_core_dev {
515 struct pci_dev *pdev;
516 u8 rev_id;
517 char board_id[MLX5_BOARD_ID_LEN];
518 struct mlx5_cmd cmd;
519 struct mlx5_caps caps;
520 phys_addr_t iseg_base;
521 struct mlx5_init_seg __iomem *iseg;
522 void (*event) (struct mlx5_core_dev *dev,
523 enum mlx5_dev_event event,
524 void *data);
525 struct mlx5_priv priv;
526 struct mlx5_profile *profile;
527 atomic_t num_qps;
528};
529
530struct mlx5_db {
531 __be32 *db;
532 union {
533 struct mlx5_db_pgdir *pgdir;
534 struct mlx5_ib_user_db_page *user_page;
535 } u;
536 dma_addr_t dma;
537 int index;
538};
539
540enum {
541 MLX5_DB_PER_PAGE = PAGE_SIZE / L1_CACHE_BYTES,
542};
543
544enum {
545 MLX5_COMP_EQ_SIZE = 1024,
546};
547
548struct mlx5_db_pgdir {
549 struct list_head list;
550 DECLARE_BITMAP(bitmap, MLX5_DB_PER_PAGE);
551 __be32 *db_page;
552 dma_addr_t db_dma;
553};
554
555typedef void (*mlx5_cmd_cbk_t)(int status, void *context);
556
557struct mlx5_cmd_work_ent {
558 struct mlx5_cmd_msg *in;
559 struct mlx5_cmd_msg *out;
560 mlx5_cmd_cbk_t callback;
561 void *context;
562 int idx;
563 struct completion done;
564 struct mlx5_cmd *cmd;
565 struct work_struct work;
566 struct mlx5_cmd_layout *lay;
567 int ret;
568 int page_queue;
569 u8 status;
570 u8 token;
571 struct timespec ts1;
572 struct timespec ts2;
573};
574
575struct mlx5_pas {
576 u64 pa;
577 u8 log_sz;
578};
579
580static inline void *mlx5_buf_offset(struct mlx5_buf *buf, int offset)
581{
582 if (likely(BITS_PER_LONG == 64 || buf->nbufs == 1))
583 return buf->direct.buf + offset;
584 else
585 return buf->page_list[offset >> PAGE_SHIFT].buf +
586 (offset & (PAGE_SIZE - 1));
587}
588
589extern struct workqueue_struct *mlx5_core_wq;
590
591#define STRUCT_FIELD(header, field) \
592 .struct_offset_bytes = offsetof(struct ib_unpacked_ ## header, field), \
593 .struct_size_bytes = sizeof((struct ib_unpacked_ ## header *)0)->field
594
595struct ib_field {
596 size_t struct_offset_bytes;
597 size_t struct_size_bytes;
598 int offset_bits;
599 int size_bits;
600};
601
602static inline struct mlx5_core_dev *pci2mlx5_core_dev(struct pci_dev *pdev)
603{
604 return pci_get_drvdata(pdev);
605}
606
607extern struct dentry *mlx5_debugfs_root;
608
609static inline u16 fw_rev_maj(struct mlx5_core_dev *dev)
610{
611 return ioread32be(&dev->iseg->fw_rev) & 0xffff;
612}
613
614static inline u16 fw_rev_min(struct mlx5_core_dev *dev)
615{
616 return ioread32be(&dev->iseg->fw_rev) >> 16;
617}
618
619static inline u16 fw_rev_sub(struct mlx5_core_dev *dev)
620{
621 return ioread32be(&dev->iseg->cmdif_rev_fw_sub) & 0xffff;
622}
623
624static inline u16 cmdif_rev(struct mlx5_core_dev *dev)
625{
626 return ioread32be(&dev->iseg->cmdif_rev_fw_sub) >> 16;
627}
628
629static inline void *mlx5_vzalloc(unsigned long size)
630{
631 void *rtn;
632
633 rtn = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
634 if (!rtn)
635 rtn = vzalloc(size);
636 return rtn;
637}
638
639static inline void mlx5_vfree(const void *addr)
640{
641 if (addr && is_vmalloc_addr(addr))
642 vfree(addr);
643 else
644 kfree(addr);
645}
646
647int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev);
648void mlx5_dev_cleanup(struct mlx5_core_dev *dev);
649int mlx5_cmd_init(struct mlx5_core_dev *dev);
650void mlx5_cmd_cleanup(struct mlx5_core_dev *dev);
651void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
652void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);
653int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr);
654int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
655 int out_size);
656int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn);
657int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn);
658int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari);
659int mlx5_free_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari);
660void mlx5_health_cleanup(void);
661void __init mlx5_health_init(void);
662void mlx5_start_health_poll(struct mlx5_core_dev *dev);
663void mlx5_stop_health_poll(struct mlx5_core_dev *dev);
664int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct,
665 struct mlx5_buf *buf);
666void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf);
667struct mlx5_cmd_mailbox *mlx5_alloc_cmd_mailbox_chain(struct mlx5_core_dev *dev,
668 gfp_t flags, int npages);
669void mlx5_free_cmd_mailbox_chain(struct mlx5_core_dev *dev,
670 struct mlx5_cmd_mailbox *head);
671int mlx5_core_create_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
672 struct mlx5_create_srq_mbox_in *in, int inlen);
673int mlx5_core_destroy_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq);
674int mlx5_core_query_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
675 struct mlx5_query_srq_mbox_out *out);
676int mlx5_core_arm_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
677 u16 lwm, int is_srq);
678int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
679 struct mlx5_create_mkey_mbox_in *in, int inlen);
680int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr);
681int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
682 struct mlx5_query_mkey_mbox_out *out, int outlen);
683int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
684 u32 *mkey);
685int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn);
686int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn);
687int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb,
688 u16 opmod, int port);
689void mlx5_pagealloc_init(struct mlx5_core_dev *dev);
690void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev);
691int mlx5_pagealloc_start(struct mlx5_core_dev *dev);
692void mlx5_pagealloc_stop(struct mlx5_core_dev *dev);
693void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id,
694 s32 npages);
695int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot);
696int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev);
697void mlx5_register_debugfs(void);
698void mlx5_unregister_debugfs(void);
699int mlx5_eq_init(struct mlx5_core_dev *dev);
700void mlx5_eq_cleanup(struct mlx5_core_dev *dev);
701void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas);
702void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn);
703void mlx5_qp_event(struct mlx5_core_dev *dev, u32 qpn, int event_type);
704void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type);
705struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn);
706void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector);
707void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type);
708int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
709 int nent, u64 mask, const char *name, struct mlx5_uar *uar);
710int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
711int mlx5_start_eqs(struct mlx5_core_dev *dev);
712int mlx5_stop_eqs(struct mlx5_core_dev *dev);
713int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
714int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
715
716int mlx5_qp_debugfs_init(struct mlx5_core_dev *dev);
717void mlx5_qp_debugfs_cleanup(struct mlx5_core_dev *dev);
718int mlx5_core_access_reg(struct mlx5_core_dev *dev, void *data_in,
719 int size_in, void *data_out, int size_out,
720 u16 reg_num, int arg, int write);
721int mlx5_set_port_caps(struct mlx5_core_dev *dev, int port_num, u32 caps);
722
723int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
724void mlx5_debug_eq_remove(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
725int mlx5_core_eq_query(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
726 struct mlx5_query_eq_mbox_out *out, int outlen);
727int mlx5_eq_debugfs_init(struct mlx5_core_dev *dev);
728void mlx5_eq_debugfs_cleanup(struct mlx5_core_dev *dev);
729int mlx5_cq_debugfs_init(struct mlx5_core_dev *dev);
730void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev);
731int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db);
732void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db);
733
734const char *mlx5_command_str(int command);
735int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev);
736void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);
737
738static inline u32 mlx5_mkey_to_idx(u32 mkey)
739{
740 return mkey >> 8;
741}
742
743static inline u32 mlx5_idx_to_mkey(u32 mkey_idx)
744{
745 return mkey_idx << 8;
746}
747
748enum {
749 MLX5_PROF_MASK_QP_SIZE = (u64)1 << 0,
750 MLX5_PROF_MASK_CMDIF_CSUM = (u64)1 << 1,
751 MLX5_PROF_MASK_MR_CACHE = (u64)1 << 2,
752};
753
754enum {
755 MAX_MR_CACHE_ENTRIES = 16,
756};
757
758struct mlx5_profile {
759 u64 mask;
760 u32 log_max_qp;
761 int cmdif_csum;
762 struct {
763 int size;
764 int limit;
765 } mr_cache[MAX_MR_CACHE_ENTRIES];
766};
767
768#endif /* MLX5_DRIVER_H */
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
new file mode 100644
index 000000000000..d9e3eacb3a7f
--- /dev/null
+++ b/include/linux/mlx5/qp.h
@@ -0,0 +1,467 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_QP_H
34#define MLX5_QP_H
35
36#include <linux/mlx5/device.h>
37#include <linux/mlx5/driver.h>
38
39#define MLX5_INVALID_LKEY 0x100
40
41enum mlx5_qp_optpar {
42 MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0,
43 MLX5_QP_OPTPAR_RRE = 1 << 1,
44 MLX5_QP_OPTPAR_RAE = 1 << 2,
45 MLX5_QP_OPTPAR_RWE = 1 << 3,
46 MLX5_QP_OPTPAR_PKEY_INDEX = 1 << 4,
47 MLX5_QP_OPTPAR_Q_KEY = 1 << 5,
48 MLX5_QP_OPTPAR_RNR_TIMEOUT = 1 << 6,
49 MLX5_QP_OPTPAR_PRIMARY_ADDR_PATH = 1 << 7,
50 MLX5_QP_OPTPAR_SRA_MAX = 1 << 8,
51 MLX5_QP_OPTPAR_RRA_MAX = 1 << 9,
52 MLX5_QP_OPTPAR_PM_STATE = 1 << 10,
53 MLX5_QP_OPTPAR_RETRY_COUNT = 1 << 12,
54 MLX5_QP_OPTPAR_RNR_RETRY = 1 << 13,
55 MLX5_QP_OPTPAR_ACK_TIMEOUT = 1 << 14,
56 MLX5_QP_OPTPAR_PRI_PORT = 1 << 16,
57 MLX5_QP_OPTPAR_SRQN = 1 << 18,
58 MLX5_QP_OPTPAR_CQN_RCV = 1 << 19,
59 MLX5_QP_OPTPAR_DC_HS = 1 << 20,
60 MLX5_QP_OPTPAR_DC_KEY = 1 << 21,
61};
62
63enum mlx5_qp_state {
64 MLX5_QP_STATE_RST = 0,
65 MLX5_QP_STATE_INIT = 1,
66 MLX5_QP_STATE_RTR = 2,
67 MLX5_QP_STATE_RTS = 3,
68 MLX5_QP_STATE_SQER = 4,
69 MLX5_QP_STATE_SQD = 5,
70 MLX5_QP_STATE_ERR = 6,
71 MLX5_QP_STATE_SQ_DRAINING = 7,
72 MLX5_QP_STATE_SUSPENDED = 9,
73 MLX5_QP_NUM_STATE
74};
75
76enum {
77 MLX5_QP_ST_RC = 0x0,
78 MLX5_QP_ST_UC = 0x1,
79 MLX5_QP_ST_UD = 0x2,
80 MLX5_QP_ST_XRC = 0x3,
81 MLX5_QP_ST_MLX = 0x4,
82 MLX5_QP_ST_DCI = 0x5,
83 MLX5_QP_ST_DCT = 0x6,
84 MLX5_QP_ST_QP0 = 0x7,
85 MLX5_QP_ST_QP1 = 0x8,
86 MLX5_QP_ST_RAW_ETHERTYPE = 0x9,
87 MLX5_QP_ST_RAW_IPV6 = 0xa,
88 MLX5_QP_ST_SNIFFER = 0xb,
89 MLX5_QP_ST_SYNC_UMR = 0xe,
90 MLX5_QP_ST_PTP_1588 = 0xd,
91 MLX5_QP_ST_REG_UMR = 0xc,
92 MLX5_QP_ST_MAX
93};
94
95enum {
96 MLX5_QP_PM_MIGRATED = 0x3,
97 MLX5_QP_PM_ARMED = 0x0,
98 MLX5_QP_PM_REARM = 0x1
99};
100
101enum {
102 MLX5_NON_ZERO_RQ = 0 << 24,
103 MLX5_SRQ_RQ = 1 << 24,
104 MLX5_CRQ_RQ = 2 << 24,
105 MLX5_ZERO_LEN_RQ = 3 << 24
106};
107
108enum {
109 /* params1 */
110 MLX5_QP_BIT_SRE = 1 << 15,
111 MLX5_QP_BIT_SWE = 1 << 14,
112 MLX5_QP_BIT_SAE = 1 << 13,
113 /* params2 */
114 MLX5_QP_BIT_RRE = 1 << 15,
115 MLX5_QP_BIT_RWE = 1 << 14,
116 MLX5_QP_BIT_RAE = 1 << 13,
117 MLX5_QP_BIT_RIC = 1 << 4,
118};
119
120enum {
121 MLX5_WQE_CTRL_CQ_UPDATE = 2 << 2,
122 MLX5_WQE_CTRL_SOLICITED = 1 << 1,
123};
124
125enum {
126 MLX5_SEND_WQE_BB = 64,
127};
128
129enum {
130 MLX5_WQE_FMR_PERM_LOCAL_READ = 1 << 27,
131 MLX5_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28,
132 MLX5_WQE_FMR_PERM_REMOTE_READ = 1 << 29,
133 MLX5_WQE_FMR_PERM_REMOTE_WRITE = 1 << 30,
134 MLX5_WQE_FMR_PERM_ATOMIC = 1 << 31
135};
136
137enum {
138 MLX5_FENCE_MODE_NONE = 0 << 5,
139 MLX5_FENCE_MODE_INITIATOR_SMALL = 1 << 5,
140 MLX5_FENCE_MODE_STRONG_ORDERING = 3 << 5,
141 MLX5_FENCE_MODE_SMALL_AND_FENCE = 4 << 5,
142};
143
144enum {
145 MLX5_QP_LAT_SENSITIVE = 1 << 28,
146 MLX5_QP_ENABLE_SIG = 1 << 31,
147};
148
149enum {
150 MLX5_RCV_DBR = 0,
151 MLX5_SND_DBR = 1,
152};
153
154struct mlx5_wqe_fmr_seg {
155 __be32 flags;
156 __be32 mem_key;
157 __be64 buf_list;
158 __be64 start_addr;
159 __be64 reg_len;
160 __be32 offset;
161 __be32 page_size;
162 u32 reserved[2];
163};
164
165struct mlx5_wqe_ctrl_seg {
166 __be32 opmod_idx_opcode;
167 __be32 qpn_ds;
168 u8 signature;
169 u8 rsvd[2];
170 u8 fm_ce_se;
171 __be32 imm;
172};
173
174struct mlx5_wqe_xrc_seg {
175 __be32 xrc_srqn;
176 u8 rsvd[12];
177};
178
179struct mlx5_wqe_masked_atomic_seg {
180 __be64 swap_add;
181 __be64 compare;
182 __be64 swap_add_mask;
183 __be64 compare_mask;
184};
185
186struct mlx5_av {
187 union {
188 struct {
189 __be32 qkey;
190 __be32 reserved;
191 } qkey;
192 __be64 dc_key;
193 } key;
194 __be32 dqp_dct;
195 u8 stat_rate_sl;
196 u8 fl_mlid;
197 __be16 rlid;
198 u8 reserved0[10];
199 u8 tclass;
200 u8 hop_limit;
201 __be32 grh_gid_fl;
202 u8 rgid[16];
203};
204
205struct mlx5_wqe_datagram_seg {
206 struct mlx5_av av;
207};
208
209struct mlx5_wqe_raddr_seg {
210 __be64 raddr;
211 __be32 rkey;
212 u32 reserved;
213};
214
215struct mlx5_wqe_atomic_seg {
216 __be64 swap_add;
217 __be64 compare;
218};
219
220struct mlx5_wqe_data_seg {
221 __be32 byte_count;
222 __be32 lkey;
223 __be64 addr;
224};
225
226struct mlx5_wqe_umr_ctrl_seg {
227 u8 flags;
228 u8 rsvd0[3];
229 __be16 klm_octowords;
230 __be16 bsf_octowords;
231 __be64 mkey_mask;
232 u8 rsvd1[32];
233};
234
235struct mlx5_seg_set_psv {
236 __be32 psv_num;
237 __be16 syndrome;
238 __be16 status;
239 __be32 transient_sig;
240 __be32 ref_tag;
241};
242
243struct mlx5_seg_get_psv {
244 u8 rsvd[19];
245 u8 num_psv;
246 __be32 l_key;
247 __be64 va;
248 __be32 psv_index[4];
249};
250
251struct mlx5_seg_check_psv {
252 u8 rsvd0[2];
253 __be16 err_coalescing_op;
254 u8 rsvd1[2];
255 __be16 xport_err_op;
256 u8 rsvd2[2];
257 __be16 xport_err_mask;
258 u8 rsvd3[7];
259 u8 num_psv;
260 __be32 l_key;
261 __be64 va;
262 __be32 psv_index[4];
263};
264
265struct mlx5_rwqe_sig {
266 u8 rsvd0[4];
267 u8 signature;
268 u8 rsvd1[11];
269};
270
271struct mlx5_wqe_signature_seg {
272 u8 rsvd0[4];
273 u8 signature;
274 u8 rsvd1[11];
275};
276
277struct mlx5_wqe_inline_seg {
278 __be32 byte_count;
279};
280
281struct mlx5_core_qp {
282 void (*event) (struct mlx5_core_qp *, int);
283 int qpn;
284 atomic_t refcount;
285 struct completion free;
286 struct mlx5_rsc_debug *dbg;
287 int pid;
288};
289
290struct mlx5_qp_path {
291 u8 fl;
292 u8 rsvd3;
293 u8 free_ar;
294 u8 pkey_index;
295 u8 rsvd0;
296 u8 grh_mlid;
297 __be16 rlid;
298 u8 ackto_lt;
299 u8 mgid_index;
300 u8 static_rate;
301 u8 hop_limit;
302 __be32 tclass_flowlabel;
303 u8 rgid[16];
304 u8 rsvd1[4];
305 u8 sl;
306 u8 port;
307 u8 rsvd2[6];
308};
309
310struct mlx5_qp_context {
311 __be32 flags;
312 __be32 flags_pd;
313 u8 mtu_msgmax;
314 u8 rq_size_stride;
315 __be16 sq_crq_size;
316 __be32 qp_counter_set_usr_page;
317 __be32 wire_qpn;
318 __be32 log_pg_sz_remote_qpn;
319 struct mlx5_qp_path pri_path;
320 struct mlx5_qp_path alt_path;
321 __be32 params1;
322 u8 reserved2[4];
323 __be32 next_send_psn;
324 __be32 cqn_send;
325 u8 reserved3[8];
326 __be32 last_acked_psn;
327 __be32 ssn;
328 __be32 params2;
329 __be32 rnr_nextrecvpsn;
330 __be32 xrcd;
331 __be32 cqn_recv;
332 __be64 db_rec_addr;
333 __be32 qkey;
334 __be32 rq_type_srqn;
335 __be32 rmsn;
336 __be16 hw_sq_wqe_counter;
337 __be16 sw_sq_wqe_counter;
338 __be16 hw_rcyclic_byte_counter;
339 __be16 hw_rq_counter;
340 __be16 sw_rcyclic_byte_counter;
341 __be16 sw_rq_counter;
342 u8 rsvd0[5];
343 u8 cgs;
344 u8 cs_req;
345 u8 cs_res;
346 __be64 dc_access_key;
347 u8 rsvd1[24];
348};
349
350struct mlx5_create_qp_mbox_in {
351 struct mlx5_inbox_hdr hdr;
352 __be32 input_qpn;
353 u8 rsvd0[4];
354 __be32 opt_param_mask;
355 u8 rsvd1[4];
356 struct mlx5_qp_context ctx;
357 u8 rsvd3[16];
358 __be64 pas[0];
359};
360
361struct mlx5_create_qp_mbox_out {
362 struct mlx5_outbox_hdr hdr;
363 __be32 qpn;
364 u8 rsvd0[4];
365};
366
367struct mlx5_destroy_qp_mbox_in {
368 struct mlx5_inbox_hdr hdr;
369 __be32 qpn;
370 u8 rsvd0[4];
371};
372
373struct mlx5_destroy_qp_mbox_out {
374 struct mlx5_outbox_hdr hdr;
375 u8 rsvd0[8];
376};
377
378struct mlx5_modify_qp_mbox_in {
379 struct mlx5_inbox_hdr hdr;
380 __be32 qpn;
381 u8 rsvd1[4];
382 __be32 optparam;
383 u8 rsvd0[4];
384 struct mlx5_qp_context ctx;
385};
386
387struct mlx5_modify_qp_mbox_out {
388 struct mlx5_outbox_hdr hdr;
389 u8 rsvd0[8];
390};
391
392struct mlx5_query_qp_mbox_in {
393 struct mlx5_inbox_hdr hdr;
394 __be32 qpn;
395 u8 rsvd[4];
396};
397
398struct mlx5_query_qp_mbox_out {
399 struct mlx5_outbox_hdr hdr;
400 u8 rsvd1[8];
401 __be32 optparam;
402 u8 rsvd0[4];
403 struct mlx5_qp_context ctx;
404 u8 rsvd2[16];
405 __be64 pas[0];
406};
407
408struct mlx5_conf_sqp_mbox_in {
409 struct mlx5_inbox_hdr hdr;
410 __be32 qpn;
411 u8 rsvd[3];
412 u8 type;
413};
414
415struct mlx5_conf_sqp_mbox_out {
416 struct mlx5_outbox_hdr hdr;
417 u8 rsvd[8];
418};
419
420struct mlx5_alloc_xrcd_mbox_in {
421 struct mlx5_inbox_hdr hdr;
422 u8 rsvd[8];
423};
424
425struct mlx5_alloc_xrcd_mbox_out {
426 struct mlx5_outbox_hdr hdr;
427 __be32 xrcdn;
428 u8 rsvd[4];
429};
430
431struct mlx5_dealloc_xrcd_mbox_in {
432 struct mlx5_inbox_hdr hdr;
433 __be32 xrcdn;
434 u8 rsvd[4];
435};
436
437struct mlx5_dealloc_xrcd_mbox_out {
438 struct mlx5_outbox_hdr hdr;
439 u8 rsvd[8];
440};
441
442static inline struct mlx5_core_qp *__mlx5_qp_lookup(struct mlx5_core_dev *dev, u32 qpn)
443{
444 return radix_tree_lookup(&dev->priv.qp_table.tree, qpn);
445}
446
447int mlx5_core_create_qp(struct mlx5_core_dev *dev,
448 struct mlx5_core_qp *qp,
449 struct mlx5_create_qp_mbox_in *in,
450 int inlen);
451int mlx5_core_qp_modify(struct mlx5_core_dev *dev, enum mlx5_qp_state cur_state,
452 enum mlx5_qp_state new_state,
453 struct mlx5_modify_qp_mbox_in *in, int sqd_event,
454 struct mlx5_core_qp *qp);
455int mlx5_core_destroy_qp(struct mlx5_core_dev *dev,
456 struct mlx5_core_qp *qp);
457int mlx5_core_qp_query(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp,
458 struct mlx5_query_qp_mbox_out *out, int outlen);
459
460int mlx5_core_xrcd_alloc(struct mlx5_core_dev *dev, u32 *xrcdn);
461int mlx5_core_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn);
462void mlx5_init_qp_table(struct mlx5_core_dev *dev);
463void mlx5_cleanup_qp_table(struct mlx5_core_dev *dev);
464int mlx5_debug_qp_add(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp);
465void mlx5_debug_qp_remove(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp);
466
467#endif /* MLX5_QP_H */
diff --git a/include/linux/mlx5/srq.h b/include/linux/mlx5/srq.h
new file mode 100644
index 000000000000..e1a363a33663
--- /dev/null
+++ b/include/linux/mlx5/srq.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_SRQ_H
34#define MLX5_SRQ_H
35
36#include <linux/mlx5/driver.h>
37
38void mlx5_init_srq_table(struct mlx5_core_dev *dev);
39void mlx5_cleanup_srq_table(struct mlx5_core_dev *dev);
40
41#endif /* MLX5_SRQ_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e0c8528a41a4..8b6e55ee8855 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -25,11 +25,17 @@ struct file_ra_state;
25struct user_struct; 25struct user_struct;
26struct writeback_control; 26struct writeback_control;
27 27
28#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */ 28#ifndef CONFIG_NEED_MULTIPLE_NODES /* Don't use mapnrs, do it properly */
29extern unsigned long max_mapnr; 29extern unsigned long max_mapnr;
30
31static inline void set_max_mapnr(unsigned long limit)
32{
33 max_mapnr = limit;
34}
35#else
36static inline void set_max_mapnr(unsigned long limit) { }
30#endif 37#endif
31 38
32extern unsigned long num_physpages;
33extern unsigned long totalram_pages; 39extern unsigned long totalram_pages;
34extern void * high_memory; 40extern void * high_memory;
35extern int page_cluster; 41extern int page_cluster;
@@ -52,6 +58,9 @@ extern unsigned long sysctl_admin_reserve_kbytes;
52/* to align the pointer to the (next) page boundary */ 58/* to align the pointer to the (next) page boundary */
53#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) 59#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
54 60
61/* test whether an address (unsigned long or pointer) is aligned to PAGE_SIZE */
62#define PAGE_ALIGNED(addr) IS_ALIGNED((unsigned long)addr, PAGE_SIZE)
63
55/* 64/*
56 * Linux kernel virtual memory manager primitives. 65 * Linux kernel virtual memory manager primitives.
57 * The idea being to have a "virtual" mm in the same way 66 * The idea being to have a "virtual" mm in the same way
@@ -106,6 +115,12 @@ extern unsigned int kobjsize(const void *objp);
106#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */ 115#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */
107#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */ 116#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */
108 117
118#ifdef CONFIG_MEM_SOFT_DIRTY
119# define VM_SOFTDIRTY 0x08000000 /* Not soft dirty clean area */
120#else
121# define VM_SOFTDIRTY 0
122#endif
123
109#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ 124#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
110#define VM_HUGEPAGE 0x20000000 /* MADV_HUGEPAGE marked this vma */ 125#define VM_HUGEPAGE 0x20000000 /* MADV_HUGEPAGE marked this vma */
111#define VM_NOHUGEPAGE 0x40000000 /* MADV_NOHUGEPAGE marked this vma */ 126#define VM_NOHUGEPAGE 0x40000000 /* MADV_NOHUGEPAGE marked this vma */
@@ -142,12 +157,6 @@ extern unsigned int kobjsize(const void *objp);
142#define VM_STACK_FLAGS (VM_GROWSDOWN | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT) 157#define VM_STACK_FLAGS (VM_GROWSDOWN | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT)
143#endif 158#endif
144 159
145#define VM_READHINTMASK (VM_SEQ_READ | VM_RAND_READ)
146#define VM_ClearReadHint(v) (v)->vm_flags &= ~VM_READHINTMASK
147#define VM_NormalReadHint(v) (!((v)->vm_flags & VM_READHINTMASK))
148#define VM_SequentialReadHint(v) ((v)->vm_flags & VM_SEQ_READ)
149#define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ)
150
151/* 160/*
152 * Special vmas that are non-mergable, non-mlock()able. 161 * Special vmas that are non-mergable, non-mlock()able.
153 * Note: mm/huge_memory.c VM_NO_THP depends on this definition. 162 * Note: mm/huge_memory.c VM_NO_THP depends on this definition.
@@ -167,6 +176,7 @@ extern pgprot_t protection_map[16];
167#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */ 176#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */
168#define FAULT_FLAG_KILLABLE 0x20 /* The fault task is in SIGKILL killable region */ 177#define FAULT_FLAG_KILLABLE 0x20 /* The fault task is in SIGKILL killable region */
169#define FAULT_FLAG_TRIED 0x40 /* second try */ 178#define FAULT_FLAG_TRIED 0x40 /* second try */
179#define FAULT_FLAG_USER 0x80 /* The fault originated in userspace */
170 180
171/* 181/*
172 * vm_fault is filled by the the pagefault handler and passed to the vma's 182 * vm_fault is filled by the the pagefault handler and passed to the vma's
@@ -486,20 +496,6 @@ static inline int compound_order(struct page *page)
486 return (unsigned long)page[1].lru.prev; 496 return (unsigned long)page[1].lru.prev;
487} 497}
488 498
489static inline int compound_trans_order(struct page *page)
490{
491 int order;
492 unsigned long flags;
493
494 if (!PageHead(page))
495 return 0;
496
497 flags = compound_lock_irqsave(page);
498 order = compound_order(page);
499 compound_unlock_irqrestore(page, flags);
500 return order;
501}
502
503static inline void set_compound_order(struct page *page, unsigned long order) 499static inline void set_compound_order(struct page *page, unsigned long order)
504{ 500{
505 page[1].lru.prev = (void *)order; 501 page[1].lru.prev = (void *)order;
@@ -634,12 +630,12 @@ static inline enum zone_type page_zonenum(const struct page *page)
634#endif 630#endif
635 631
636/* 632/*
637 * The identification function is only used by the buddy allocator for 633 * The identification function is mainly used by the buddy allocator for
638 * determining if two pages could be buddies. We are not really 634 * determining if two pages could be buddies. We are not really identifying
639 * identifying a zone since we could be using a the section number 635 * the zone since we could be using the section number id if we do not have
640 * id if we have not node id available in page flags. 636 * node id available in page flags.
641 * We guarantee only that it will return the same value for two 637 * We only guarantee that it will return the same value for two combinable
642 * combinable pages in a zone. 638 * pages in a zone.
643 */ 639 */
644static inline int page_zone_id(struct page *page) 640static inline int page_zone_id(struct page *page)
645{ 641{
@@ -881,11 +877,12 @@ static inline int page_mapped(struct page *page)
881#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */ 877#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */
882#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */ 878#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */
883#define VM_FAULT_RETRY 0x0400 /* ->fault blocked, must retry */ 879#define VM_FAULT_RETRY 0x0400 /* ->fault blocked, must retry */
880#define VM_FAULT_FALLBACK 0x0800 /* huge page fault failed, fall back to small */
884 881
885#define VM_FAULT_HWPOISON_LARGE_MASK 0xf000 /* encodes hpage index for large hwpoison */ 882#define VM_FAULT_HWPOISON_LARGE_MASK 0xf000 /* encodes hpage index for large hwpoison */
886 883
887#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON | \ 884#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON | \
888 VM_FAULT_HWPOISON_LARGE) 885 VM_FAULT_FALLBACK | VM_FAULT_HWPOISON_LARGE)
889 886
890/* Encode hstate index for a hwpoisoned large page */ 887/* Encode hstate index for a hwpoisoned large page */
891#define VM_FAULT_SET_HINDEX(x) ((x) << 12) 888#define VM_FAULT_SET_HINDEX(x) ((x) << 12)
@@ -989,7 +986,7 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
989 unmap_mapping_range(mapping, holebegin, holelen, 0); 986 unmap_mapping_range(mapping, holebegin, holelen, 0);
990} 987}
991 988
992extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new); 989extern void truncate_pagecache(struct inode *inode, loff_t new);
993extern void truncate_setsize(struct inode *inode, loff_t newsize); 990extern void truncate_setsize(struct inode *inode, loff_t newsize);
994void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end); 991void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end);
995int truncate_inode_page(struct address_space *mapping, struct page *page); 992int truncate_inode_page(struct address_space *mapping, struct page *page);
@@ -1041,7 +1038,8 @@ int get_kernel_page(unsigned long start, int write, struct page **pages);
1041struct page *get_dump_page(unsigned long addr); 1038struct page *get_dump_page(unsigned long addr);
1042 1039
1043extern int try_to_release_page(struct page * page, gfp_t gfp_mask); 1040extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
1044extern void do_invalidatepage(struct page *page, unsigned long offset); 1041extern void do_invalidatepage(struct page *page, unsigned int offset,
1042 unsigned int length);
1045 1043
1046int __set_page_dirty_nobuffers(struct page *page); 1044int __set_page_dirty_nobuffers(struct page *page);
1047int __set_page_dirty_no_writeback(struct page *page); 1045int __set_page_dirty_no_writeback(struct page *page);
@@ -1304,11 +1302,12 @@ extern void free_initmem(void);
1304/* 1302/*
1305 * Free reserved pages within range [PAGE_ALIGN(start), end & PAGE_MASK) 1303 * Free reserved pages within range [PAGE_ALIGN(start), end & PAGE_MASK)
1306 * into the buddy system. The freed pages will be poisoned with pattern 1304 * into the buddy system. The freed pages will be poisoned with pattern
1307 * "poison" if it's non-zero. 1305 * "poison" if it's within range [0, UCHAR_MAX].
1308 * Return pages freed into the buddy system. 1306 * Return pages freed into the buddy system.
1309 */ 1307 */
1310extern unsigned long free_reserved_area(unsigned long start, unsigned long end, 1308extern unsigned long free_reserved_area(void *start, void *end,
1311 int poison, char *s); 1309 int poison, char *s);
1310
1312#ifdef CONFIG_HIGHMEM 1311#ifdef CONFIG_HIGHMEM
1313/* 1312/*
1314 * Free a highmem page into the buddy system, adjusting totalhigh_pages 1313 * Free a highmem page into the buddy system, adjusting totalhigh_pages
@@ -1317,10 +1316,8 @@ extern unsigned long free_reserved_area(unsigned long start, unsigned long end,
1317extern void free_highmem_page(struct page *page); 1316extern void free_highmem_page(struct page *page);
1318#endif 1317#endif
1319 1318
1320static inline void adjust_managed_page_count(struct page *page, long count) 1319extern void adjust_managed_page_count(struct page *page, long count);
1321{ 1320extern void mem_init_print_info(const char *str);
1322 totalram_pages += count;
1323}
1324 1321
1325/* Free the reserved page into the buddy system, so it gets managed. */ 1322/* Free the reserved page into the buddy system, so it gets managed. */
1326static inline void __free_reserved_page(struct page *page) 1323static inline void __free_reserved_page(struct page *page)
@@ -1344,18 +1341,29 @@ static inline void mark_page_reserved(struct page *page)
1344 1341
1345/* 1342/*
1346 * Default method to free all the __init memory into the buddy system. 1343 * Default method to free all the __init memory into the buddy system.
1347 * The freed pages will be poisoned with pattern "poison" if it is 1344 * The freed pages will be poisoned with pattern "poison" if it's within
1348 * non-zero. Return pages freed into the buddy system. 1345 * range [0, UCHAR_MAX].
1346 * Return pages freed into the buddy system.
1349 */ 1347 */
1350static inline unsigned long free_initmem_default(int poison) 1348static inline unsigned long free_initmem_default(int poison)
1351{ 1349{
1352 extern char __init_begin[], __init_end[]; 1350 extern char __init_begin[], __init_end[];
1353 1351
1354 return free_reserved_area(PAGE_ALIGN((unsigned long)&__init_begin) , 1352 return free_reserved_area(&__init_begin, &__init_end,
1355 ((unsigned long)&__init_end) & PAGE_MASK,
1356 poison, "unused kernel"); 1353 poison, "unused kernel");
1357} 1354}
1358 1355
1356static inline unsigned long get_num_physpages(void)
1357{
1358 int nid;
1359 unsigned long phys_pages = 0;
1360
1361 for_each_online_node(nid)
1362 phys_pages += node_present_pages(nid);
1363
1364 return phys_pages;
1365}
1366
1359#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 1367#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
1360/* 1368/*
1361 * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its 1369 * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its
@@ -1784,6 +1792,7 @@ enum mf_flags {
1784 MF_COUNT_INCREASED = 1 << 0, 1792 MF_COUNT_INCREASED = 1 << 0,
1785 MF_ACTION_REQUIRED = 1 << 1, 1793 MF_ACTION_REQUIRED = 1 << 1,
1786 MF_MUST_KILL = 1 << 2, 1794 MF_MUST_KILL = 1 << 2,
1795 MF_SOFT_OFFLINE = 1 << 3,
1787}; 1796};
1788extern int memory_failure(unsigned long pfn, int trapno, int flags); 1797extern int memory_failure(unsigned long pfn, int trapno, int flags);
1789extern void memory_failure_queue(unsigned long pfn, int trapno, int flags); 1798extern void memory_failure_queue(unsigned long pfn, int trapno, int flags);
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 1397ccf81e91..cf55945c83fb 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -2,6 +2,7 @@
2#define LINUX_MM_INLINE_H 2#define LINUX_MM_INLINE_H
3 3
4#include <linux/huge_mm.h> 4#include <linux/huge_mm.h>
5#include <linux/swap.h>
5 6
6/** 7/**
7 * page_is_file_cache - should the page be on a file LRU or anon LRU? 8 * page_is_file_cache - should the page be on a file LRU or anon LRU?
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index ace9a5f01c64..d9851eeb6e1d 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -322,6 +322,7 @@ struct mm_rss_stat {
322 atomic_long_t count[NR_MM_COUNTERS]; 322 atomic_long_t count[NR_MM_COUNTERS];
323}; 323};
324 324
325struct kioctx_table;
325struct mm_struct { 326struct mm_struct {
326 struct vm_area_struct * mmap; /* list of VMAs */ 327 struct vm_area_struct * mmap; /* list of VMAs */
327 struct rb_root mm_rb; 328 struct rb_root mm_rb;
@@ -330,12 +331,10 @@ struct mm_struct {
330 unsigned long (*get_unmapped_area) (struct file *filp, 331 unsigned long (*get_unmapped_area) (struct file *filp,
331 unsigned long addr, unsigned long len, 332 unsigned long addr, unsigned long len,
332 unsigned long pgoff, unsigned long flags); 333 unsigned long pgoff, unsigned long flags);
333 void (*unmap_area) (struct mm_struct *mm, unsigned long addr);
334#endif 334#endif
335 unsigned long mmap_base; /* base of mmap area */ 335 unsigned long mmap_base; /* base of mmap area */
336 unsigned long mmap_legacy_base; /* base of mmap area in bottom-up allocations */
336 unsigned long task_size; /* size of task vm space */ 337 unsigned long task_size; /* size of task vm space */
337 unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */
338 unsigned long free_area_cache; /* first hole of size cached_hole_size or larger */
339 unsigned long highest_vm_end; /* highest vma end address */ 338 unsigned long highest_vm_end; /* highest vma end address */
340 pgd_t * pgd; 339 pgd_t * pgd;
341 atomic_t mm_users; /* How many users with user space? */ 340 atomic_t mm_users; /* How many users with user space? */
@@ -385,8 +384,8 @@ struct mm_struct {
385 384
386 struct core_state *core_state; /* coredumping support */ 385 struct core_state *core_state; /* coredumping support */
387#ifdef CONFIG_AIO 386#ifdef CONFIG_AIO
388 spinlock_t ioctx_lock; 387 spinlock_t ioctx_lock;
389 struct hlist_head ioctx_list; 388 struct kioctx_table __rcu *ioctx_table;
390#endif 389#endif
391#ifdef CONFIG_MM_OWNER 390#ifdef CONFIG_MM_OWNER
392 /* 391 /*
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 9aa863da287f..92dc257251e4 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -11,11 +11,17 @@ extern int sysctl_overcommit_memory;
11extern int sysctl_overcommit_ratio; 11extern int sysctl_overcommit_ratio;
12extern struct percpu_counter vm_committed_as; 12extern struct percpu_counter vm_committed_as;
13 13
14#ifdef CONFIG_SMP
15extern s32 vm_committed_as_batch;
16#else
17#define vm_committed_as_batch 0
18#endif
19
14unsigned long vm_memory_committed(void); 20unsigned long vm_memory_committed(void);
15 21
16static inline void vm_acct_memory(long pages) 22static inline void vm_acct_memory(long pages)
17{ 23{
18 percpu_counter_add(&vm_committed_as, pages); 24 __percpu_counter_add(&vm_committed_as, pages, vm_committed_as_batch);
19} 25}
20 26
21static inline void vm_unacct_memory(long pages) 27static inline void vm_unacct_memory(long pages)
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index f31725ba49f3..842de3e21e70 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -94,7 +94,11 @@ struct mmc_ext_csd {
94 u8 raw_ext_csd_structure; /* 194 */ 94 u8 raw_ext_csd_structure; /* 194 */
95 u8 raw_card_type; /* 196 */ 95 u8 raw_card_type; /* 196 */
96 u8 out_of_int_time; /* 198 */ 96 u8 out_of_int_time; /* 198 */
97 u8 raw_s_a_timeout; /* 217 */ 97 u8 raw_pwr_cl_52_195; /* 200 */
98 u8 raw_pwr_cl_26_195; /* 201 */
99 u8 raw_pwr_cl_52_360; /* 202 */
100 u8 raw_pwr_cl_26_360; /* 203 */
101 u8 raw_s_a_timeout; /* 217 */
98 u8 raw_hc_erase_gap_size; /* 221 */ 102 u8 raw_hc_erase_gap_size; /* 221 */
99 u8 raw_erase_timeout_mult; /* 223 */ 103 u8 raw_erase_timeout_mult; /* 223 */
100 u8 raw_hc_erase_grp_size; /* 224 */ 104 u8 raw_hc_erase_grp_size; /* 224 */
@@ -102,6 +106,10 @@ struct mmc_ext_csd {
102 u8 raw_sec_erase_mult; /* 230 */ 106 u8 raw_sec_erase_mult; /* 230 */
103 u8 raw_sec_feature_support;/* 231 */ 107 u8 raw_sec_feature_support;/* 231 */
104 u8 raw_trim_mult; /* 232 */ 108 u8 raw_trim_mult; /* 232 */
109 u8 raw_pwr_cl_200_195; /* 236 */
110 u8 raw_pwr_cl_200_360; /* 237 */
111 u8 raw_pwr_cl_ddr_52_195; /* 238 */
112 u8 raw_pwr_cl_ddr_52_360; /* 239 */
105 u8 raw_bkops_status; /* 246 */ 113 u8 raw_bkops_status; /* 246 */
106 u8 raw_sectors[4]; /* 212 - 4 bytes */ 114 u8 raw_sectors[4]; /* 212 - 4 bytes */
107 115
@@ -512,6 +520,7 @@ struct mmc_driver {
512 void (*remove)(struct mmc_card *); 520 void (*remove)(struct mmc_card *);
513 int (*suspend)(struct mmc_card *); 521 int (*suspend)(struct mmc_card *);
514 int (*resume)(struct mmc_card *); 522 int (*resume)(struct mmc_card *);
523 void (*shutdown)(struct mmc_card *);
515}; 524};
516 525
517extern int mmc_register_driver(struct mmc_driver *); 526extern int mmc_register_driver(struct mmc_driver *);
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 39613b9a6fc5..da51bec578c3 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -96,6 +96,8 @@ struct mmc_command {
96 */ 96 */
97 97
98 unsigned int cmd_timeout_ms; /* in milliseconds */ 98 unsigned int cmd_timeout_ms; /* in milliseconds */
99 /* Set this flag only for blocking sanitize request */
100 bool sanitize_busy;
99 101
100 struct mmc_data *data; /* data segment associated with cmd */ 102 struct mmc_data *data; /* data segment associated with cmd */
101 struct mmc_request *mrq; /* associated request */ 103 struct mmc_request *mrq; /* associated request */
@@ -188,6 +190,9 @@ extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
188extern void mmc_release_host(struct mmc_host *host); 190extern void mmc_release_host(struct mmc_host *host);
189extern int mmc_try_claim_host(struct mmc_host *host); 191extern int mmc_try_claim_host(struct mmc_host *host);
190 192
193extern void mmc_get_card(struct mmc_card *card);
194extern void mmc_put_card(struct mmc_card *card);
195
191extern int mmc_flush_cache(struct mmc_card *); 196extern int mmc_flush_cache(struct mmc_card *);
192 197
193extern int mmc_detect_card_removed(struct mmc_host *host); 198extern int mmc_detect_card_removed(struct mmc_host *host);
@@ -203,6 +208,8 @@ static inline void mmc_claim_host(struct mmc_host *host)
203 __mmc_claim_host(host, NULL); 208 __mmc_claim_host(host, NULL);
204} 209}
205 210
211struct device_node;
206extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max); 212extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
213extern int mmc_of_parse_voltage(struct device_node *np, u32 *mask);
207 214
208#endif /* LINUX_MMC_CORE_H */ 215#endif /* LINUX_MMC_CORE_H */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index e326ae2882a0..3b0c33ae13e1 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -239,7 +239,7 @@ struct mmc_host {
239#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ 239#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
240#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ 240#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
241#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ 241#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */
242 242#define MMC_CAP_AGGRESSIVE_PM (1 << 7) /* Suspend (e)MMC/SD at idle */
243#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ 243#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
244#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ 244#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
245#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ 245#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */
@@ -264,7 +264,7 @@ struct mmc_host {
264 264
265#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */ 265#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
266#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */ 266#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
267#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */ 267#define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */
268#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */ 268#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
269#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */ 269#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */
270#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */ 270#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
@@ -272,7 +272,6 @@ struct mmc_host {
272#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ 272#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
273 MMC_CAP2_HS200_1_2V_SDR) 273 MMC_CAP2_HS200_1_2V_SDR)
274#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */ 274#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */
275#define MMC_CAP2_DETECT_ON_ERR (1 << 8) /* On I/O err check card removal */
276#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */ 275#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */
277#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */ 276#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
278#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */ 277#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
@@ -281,6 +280,7 @@ struct mmc_host {
281#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \ 280#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
282 MMC_CAP2_PACKED_WR) 281 MMC_CAP2_PACKED_WR)
283#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */ 282#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
283#define MMC_CAP2_SANITIZE (1 << 15) /* Support Sanitize */
284 284
285 mmc_pm_flag_t pm_caps; /* supported pm features */ 285 mmc_pm_flag_t pm_caps; /* supported pm features */
286 286
@@ -369,7 +369,7 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *);
369int mmc_add_host(struct mmc_host *); 369int mmc_add_host(struct mmc_host *);
370void mmc_remove_host(struct mmc_host *); 370void mmc_remove_host(struct mmc_host *);
371void mmc_free_host(struct mmc_host *); 371void mmc_free_host(struct mmc_host *);
372void mmc_of_parse(struct mmc_host *host); 372int mmc_of_parse(struct mmc_host *host);
373 373
374static inline void *mmc_priv(struct mmc_host *host) 374static inline void *mmc_priv(struct mmc_host *host)
375{ 375{
@@ -425,10 +425,6 @@ static inline int mmc_regulator_get_supply(struct mmc_host *mmc)
425} 425}
426#endif 426#endif
427 427
428int mmc_card_awake(struct mmc_host *host);
429int mmc_card_sleep(struct mmc_host *host);
430int mmc_card_can_sleep(struct mmc_host *host);
431
432int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); 428int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
433 429
434/* Module parameter */ 430/* Module parameter */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index b838ffc49e4a..3e781b8c0be7 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -95,6 +95,9 @@ struct sdhci_host {
95/* The system physically doesn't support 1.8v, even if the host does */ 95/* The system physically doesn't support 1.8v, even if the host does */
96#define SDHCI_QUIRK2_NO_1_8_V (1<<2) 96#define SDHCI_QUIRK2_NO_1_8_V (1<<2)
97#define SDHCI_QUIRK2_PRESET_VALUE_BROKEN (1<<3) 97#define SDHCI_QUIRK2_PRESET_VALUE_BROKEN (1<<3)
98#define SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON (1<<4)
99/* Controller has a non-standard host control register */
100#define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1<<5)
98 101
99 int irq; /* Device IRQ */ 102 int irq; /* Device IRQ */
100 void __iomem *ioaddr; /* Mapped address */ 103 void __iomem *ioaddr; /* Mapped address */
@@ -126,7 +129,7 @@ struct sdhci_host {
126#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ 129#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */
127#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */ 130#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */
128#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ 131#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */
129#define SDHCI_HS200_NEEDS_TUNING (1<<10) /* HS200 needs tuning */ 132#define SDHCI_SDR104_NEEDS_TUNING (1<<10) /* SDR104/HS200 needs tuning */
130#define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */ 133#define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */
131 134
132 unsigned int version; /* SDHCI spec. version */ 135 unsigned int version; /* SDHCI spec. version */
@@ -139,6 +142,7 @@ struct sdhci_host {
139 u8 pwr; /* Current voltage */ 142 u8 pwr; /* Current voltage */
140 143
141 bool runtime_suspended; /* Host is runtime suspended */ 144 bool runtime_suspended; /* Host is runtime suspended */
145 bool bus_on; /* Bus power prevents runtime suspend */
142 146
143 struct mmc_request *mrq; /* Current request */ 147 struct mmc_request *mrq; /* Current request */
144 struct mmc_command *cmd; /* Current command */ 148 struct mmc_command *cmd; /* Current command */
@@ -167,6 +171,7 @@ struct sdhci_host {
167 unsigned int ocr_avail_sdio; /* OCR bit masks */ 171 unsigned int ocr_avail_sdio; /* OCR bit masks */
168 unsigned int ocr_avail_sd; 172 unsigned int ocr_avail_sd;
169 unsigned int ocr_avail_mmc; 173 unsigned int ocr_avail_mmc;
174 u32 ocr_mask; /* available voltages */
170 175
171 wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */ 176 wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */
172 unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */ 177 unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index e7d5dd67bb74..ccd8fb2cad52 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -16,7 +16,6 @@
16 16
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/sh_dma.h>
20 19
21/* 20/*
22 * MMCIF : CE_CLK_CTRL [19:16] 21 * MMCIF : CE_CLK_CTRL [19:16]
@@ -33,12 +32,12 @@
33 */ 32 */
34 33
35struct sh_mmcif_plat_data { 34struct sh_mmcif_plat_data {
36 void (*set_pwr)(struct platform_device *pdev, int state);
37 void (*down_pwr)(struct platform_device *pdev);
38 int (*get_cd)(struct platform_device *pdef); 35 int (*get_cd)(struct platform_device *pdef);
39 unsigned int slave_id_tx; /* embedded slave_id_[tr]x */ 36 unsigned int slave_id_tx; /* embedded slave_id_[tr]x */
40 unsigned int slave_id_rx; 37 unsigned int slave_id_rx;
41 bool use_cd_gpio : 1; 38 bool use_cd_gpio : 1;
39 bool ccs_unsupported : 1;
40 bool clk_ctrl2_present : 1;
42 unsigned int cd_gpio; 41 unsigned int cd_gpio;
43 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ 42 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */
44 unsigned long caps; 43 unsigned long caps;
@@ -62,6 +61,7 @@ struct sh_mmcif_plat_data {
62#define MMCIF_CE_INT_MASK 0x00000044 61#define MMCIF_CE_INT_MASK 0x00000044
63#define MMCIF_CE_HOST_STS1 0x00000048 62#define MMCIF_CE_HOST_STS1 0x00000048
64#define MMCIF_CE_HOST_STS2 0x0000004C 63#define MMCIF_CE_HOST_STS2 0x0000004C
64#define MMCIF_CE_CLK_CTRL2 0x00000070
65#define MMCIF_CE_VERSION 0x0000007C 65#define MMCIF_CE_VERSION 0x0000007C
66 66
67/* CE_BUF_ACC */ 67/* CE_BUF_ACC */
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index b76bcf0621f6..68927ae50845 100644
--- a/include/linux/mmc/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
@@ -25,8 +25,6 @@ struct sh_mobile_sdhi_info {
25 unsigned long tmio_caps2; 25 unsigned long tmio_caps2;
26 u32 tmio_ocr_mask; /* available MMC voltages */ 26 u32 tmio_ocr_mask; /* available MMC voltages */
27 unsigned int cd_gpio; 27 unsigned int cd_gpio;
28 void (*set_pwr)(struct platform_device *pdev, int state);
29 int (*get_cd)(struct platform_device *pdev);
30 28
31 /* callbacks for board specific setup code */ 29 /* callbacks for board specific setup code */
32 int (*init)(struct platform_device *pdev, 30 int (*init)(struct platform_device *pdev,
diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h
index 7d88d27bfafa..b0c73e4cacea 100644
--- a/include/linux/mmc/slot-gpio.h
+++ b/include/linux/mmc/slot-gpio.h
@@ -18,7 +18,8 @@ int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio);
18void mmc_gpio_free_ro(struct mmc_host *host); 18void mmc_gpio_free_ro(struct mmc_host *host);
19 19
20int mmc_gpio_get_cd(struct mmc_host *host); 20int mmc_gpio_get_cd(struct mmc_host *host);
21int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio); 21int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio,
22 unsigned int debounce);
22void mmc_gpio_free_cd(struct mmc_host *host); 23void mmc_gpio_free_cd(struct mmc_host *host);
23 24
24#endif 25#endif
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 5c76737d836b..bd791e452ad7 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -105,6 +105,7 @@ struct zone_padding {
105enum zone_stat_item { 105enum zone_stat_item {
106 /* First 128 byte cacheline (assuming 64 bit words) */ 106 /* First 128 byte cacheline (assuming 64 bit words) */
107 NR_FREE_PAGES, 107 NR_FREE_PAGES,
108 NR_ALLOC_BATCH,
108 NR_LRU_BASE, 109 NR_LRU_BASE,
109 NR_INACTIVE_ANON = NR_LRU_BASE, /* must match order of LRU_[IN]ACTIVE */ 110 NR_INACTIVE_ANON = NR_LRU_BASE, /* must match order of LRU_[IN]ACTIVE */
110 NR_ACTIVE_ANON, /* " " " " " */ 111 NR_ACTIVE_ANON, /* " " " " " */
@@ -352,7 +353,6 @@ struct zone {
352 * free areas of different sizes 353 * free areas of different sizes
353 */ 354 */
354 spinlock_t lock; 355 spinlock_t lock;
355 int all_unreclaimable; /* All pages pinned */
356#if defined CONFIG_COMPACTION || defined CONFIG_CMA 356#if defined CONFIG_COMPACTION || defined CONFIG_CMA
357 /* Set to true when the PG_migrate_skip bits should be cleared */ 357 /* Set to true when the PG_migrate_skip bits should be cleared */
358 bool compact_blockskip_flush; 358 bool compact_blockskip_flush;
@@ -474,10 +474,16 @@ struct zone {
474 * frequently read in proximity to zone->lock. It's good to 474 * frequently read in proximity to zone->lock. It's good to
475 * give them a chance of being in the same cacheline. 475 * give them a chance of being in the same cacheline.
476 * 476 *
477 * Write access to present_pages and managed_pages at runtime should 477 * Write access to present_pages at runtime should be protected by
478 * be protected by lock_memory_hotplug()/unlock_memory_hotplug(). 478 * lock_memory_hotplug()/unlock_memory_hotplug(). Any reader who can't
479 * Any reader who can't tolerant drift of present_pages and 479 * tolerant drift of present_pages should hold memory hotplug lock to
480 * managed_pages should hold memory hotplug lock to get a stable value. 480 * get a stable value.
481 *
482 * Read access to managed_pages should be safe because it's unsigned
483 * long. Write access to zone->managed_pages and totalram_pages are
484 * protected by managed_page_count_lock at runtime. Idealy only
485 * adjust_managed_page_count() should be used instead of directly
486 * touching zone->managed_pages and totalram_pages.
481 */ 487 */
482 unsigned long spanned_pages; 488 unsigned long spanned_pages;
483 unsigned long present_pages; 489 unsigned long present_pages;
@@ -495,6 +501,13 @@ typedef enum {
495 ZONE_CONGESTED, /* zone has many dirty pages backed by 501 ZONE_CONGESTED, /* zone has many dirty pages backed by
496 * a congested BDI 502 * a congested BDI
497 */ 503 */
504 ZONE_TAIL_LRU_DIRTY, /* reclaim scanning has recently found
505 * many dirty file pages at the tail
506 * of the LRU.
507 */
508 ZONE_WRITEBACK, /* reclaim scanning has recently found
509 * many pages under writeback
510 */
498} zone_flags_t; 511} zone_flags_t;
499 512
500static inline void zone_set_flag(struct zone *zone, zone_flags_t flag) 513static inline void zone_set_flag(struct zone *zone, zone_flags_t flag)
@@ -517,6 +530,16 @@ static inline int zone_is_reclaim_congested(const struct zone *zone)
517 return test_bit(ZONE_CONGESTED, &zone->flags); 530 return test_bit(ZONE_CONGESTED, &zone->flags);
518} 531}
519 532
533static inline int zone_is_reclaim_dirty(const struct zone *zone)
534{
535 return test_bit(ZONE_TAIL_LRU_DIRTY, &zone->flags);
536}
537
538static inline int zone_is_reclaim_writeback(const struct zone *zone)
539{
540 return test_bit(ZONE_WRITEBACK, &zone->flags);
541}
542
520static inline int zone_is_reclaim_locked(const struct zone *zone) 543static inline int zone_is_reclaim_locked(const struct zone *zone)
521{ 544{
522 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags); 545 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags);
@@ -716,7 +739,10 @@ typedef struct pglist_data {
716 * or node_spanned_pages stay constant. Holding this will also 739 * or node_spanned_pages stay constant. Holding this will also
717 * guarantee that any pfn_valid() stays that way. 740 * guarantee that any pfn_valid() stays that way.
718 * 741 *
719 * Nests above zone->lock and zone->size_seqlock. 742 * pgdat_resize_lock() and pgdat_resize_unlock() are provided to
743 * manipulate node_size_lock without checking for CONFIG_MEMORY_HOTPLUG.
744 *
745 * Nests above zone->lock and zone->span_seqlock
720 */ 746 */
721 spinlock_t node_size_lock; 747 spinlock_t node_size_lock;
722#endif 748#endif
@@ -843,11 +869,6 @@ static inline int is_highmem_idx(enum zone_type idx)
843#endif 869#endif
844} 870}
845 871
846static inline int is_normal_idx(enum zone_type idx)
847{
848 return (idx == ZONE_NORMAL);
849}
850
851/** 872/**
852 * is_highmem - helper function to quickly check if a struct zone is a 873 * is_highmem - helper function to quickly check if a struct zone is a
853 * highmem zone or not. This is an attempt to keep references 874 * highmem zone or not. This is an attempt to keep references
@@ -866,29 +887,6 @@ static inline int is_highmem(struct zone *zone)
866#endif 887#endif
867} 888}
868 889
869static inline int is_normal(struct zone *zone)
870{
871 return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL;
872}
873
874static inline int is_dma32(struct zone *zone)
875{
876#ifdef CONFIG_ZONE_DMA32
877 return zone == zone->zone_pgdat->node_zones + ZONE_DMA32;
878#else
879 return 0;
880#endif
881}
882
883static inline int is_dma(struct zone *zone)
884{
885#ifdef CONFIG_ZONE_DMA
886 return zone == zone->zone_pgdat->node_zones + ZONE_DMA;
887#else
888 return 0;
889#endif
890}
891
892/* These two functions are used to setup the per zone pages min values */ 890/* These two functions are used to setup the per zone pages min values */
893struct ctl_table; 891struct ctl_table;
894int min_free_kbytes_sysctl_handler(struct ctl_table *, int, 892int min_free_kbytes_sysctl_handler(struct ctl_table *, int,
@@ -1111,6 +1109,10 @@ struct mem_section {
1111 struct page_cgroup *page_cgroup; 1109 struct page_cgroup *page_cgroup;
1112 unsigned long pad; 1110 unsigned long pad;
1113#endif 1111#endif
1112 /*
1113 * WARNING: mem_section must be a power-of-2 in size for the
1114 * calculation and use of SECTION_ROOT_MASK to make sense.
1115 */
1114}; 1116};
1115 1117
1116#ifdef CONFIG_SPARSEMEM_EXTREME 1118#ifdef CONFIG_SPARSEMEM_EXTREME
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index b508016fb76d..45e921401b06 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -361,7 +361,8 @@ struct ssb_device_id {
361 __u16 vendor; 361 __u16 vendor;
362 __u16 coreid; 362 __u16 coreid;
363 __u8 revision; 363 __u8 revision;
364}; 364 __u8 __pad;
365} __attribute__((packed, aligned(2)));
365#define SSB_DEVICE(_vendor, _coreid, _revision) \ 366#define SSB_DEVICE(_vendor, _coreid, _revision) \
366 { .vendor = _vendor, .coreid = _coreid, .revision = _revision, } 367 { .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
367#define SSB_DEVTABLE_END \ 368#define SSB_DEVTABLE_END \
@@ -377,7 +378,7 @@ struct bcma_device_id {
377 __u16 id; 378 __u16 id;
378 __u8 rev; 379 __u8 rev;
379 __u8 class; 380 __u8 class;
380}; 381} __attribute__((packed,aligned(2)));
381#define BCMA_CORE(_manuf, _id, _rev, _class) \ 382#define BCMA_CORE(_manuf, _id, _rev, _class) \
382 { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, } 383 { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, }
383#define BCMA_CORETABLE_END \ 384#define BCMA_CORETABLE_END \
@@ -456,7 +457,8 @@ enum dmi_field {
456}; 457};
457 458
458struct dmi_strmatch { 459struct dmi_strmatch {
459 unsigned char slot; 460 unsigned char slot:7;
461 unsigned char exact_match:1;
460 char substr[79]; 462 char substr[79];
461}; 463};
462 464
@@ -474,7 +476,8 @@ struct dmi_system_id {
474 */ 476 */
475#define dmi_device_id dmi_system_id 477#define dmi_device_id dmi_system_id
476 478
477#define DMI_MATCH(a, b) { a, b } 479#define DMI_MATCH(a, b) { .slot = a, .substr = b }
480#define DMI_EXACT_MATCH(a, b) { .slot = a, .substr = b, .exact_match = 1 }
478 481
479#define PLATFORM_NAME_SIZE 20 482#define PLATFORM_NAME_SIZE 20
480#define PLATFORM_MODULE_PREFIX "platform:" 483#define PLATFORM_MODULE_PREFIX "platform:"
@@ -577,4 +580,23 @@ struct mei_cl_device_id {
577 kernel_ulong_t driver_info; 580 kernel_ulong_t driver_info;
578}; 581};
579 582
583/* RapidIO */
584
585#define RIO_ANY_ID 0xffff
586
587/**
588 * struct rio_device_id - RIO device identifier
589 * @did: RapidIO device ID
590 * @vid: RapidIO vendor ID
591 * @asm_did: RapidIO assembly device ID
592 * @asm_vid: RapidIO assembly vendor ID
593 *
594 * Identifies a RapidIO device based on both the device/vendor IDs and
595 * the assembly device/vendor IDs.
596 */
597struct rio_device_id {
598 __u16 did, vid;
599 __u16 asm_did, asm_vid;
600};
601
580#endif /* LINUX_MOD_DEVICETABLE_H */ 602#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 46f1ea01e6f6..05f2447f8c15 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -42,6 +42,7 @@ struct module_kobject {
42 struct module *mod; 42 struct module *mod;
43 struct kobject *drivers_dir; 43 struct kobject *drivers_dir;
44 struct module_param_attrs *mp; 44 struct module_param_attrs *mp;
45 struct completion *kobj_completion;
45}; 46};
46 47
47struct module_attribute { 48struct module_attribute {
@@ -97,6 +98,11 @@ extern const struct gtype##_id __mod_##gtype##_table \
97/* For userspace: you can also call me... */ 98/* For userspace: you can also call me... */
98#define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias) 99#define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
99 100
101/* Soft module dependencies. See man modprobe.d for details.
102 * Example: MODULE_SOFTDEP("pre: module-foo module-bar post: module-baz")
103 */
104#define MODULE_SOFTDEP(_softdep) MODULE_INFO(softdep, _softdep)
105
100/* 106/*
101 * The following license idents are currently accepted as indicating free 107 * The following license idents are currently accepted as indicating free
102 * software modules 108 * software modules
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 137b4198fc03..c3eb102a9cc8 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -36,7 +36,18 @@ static const char __UNIQUE_ID(name)[] \
36 36
37struct kernel_param; 37struct kernel_param;
38 38
39/*
40 * Flags available for kernel_param_ops
41 *
42 * NOARG - the parameter allows for no argument (foo instead of foo=1)
43 */
44enum {
45 KERNEL_PARAM_FL_NOARG = (1 << 0)
46};
47
39struct kernel_param_ops { 48struct kernel_param_ops {
49 /* How the ops should behave */
50 unsigned int flags;
40 /* Returns 0, or -errno. arg is in kp->arg. */ 51 /* Returns 0, or -errno. arg is in kp->arg. */
41 int (*set)(const char *val, const struct kernel_param *kp); 52 int (*set)(const char *val, const struct kernel_param *kp);
42 /* Returns length written or -errno. Buffer is 4k (ie. be short!) */ 53 /* Returns length written or -errno. Buffer is 4k (ie. be short!) */
@@ -187,7 +198,7 @@ struct kparam_array
187/* Obsolete - use module_param_cb() */ 198/* Obsolete - use module_param_cb() */
188#define module_param_call(name, set, get, arg, perm) \ 199#define module_param_call(name, set, get, arg, perm) \
189 static struct kernel_param_ops __param_ops_##name = \ 200 static struct kernel_param_ops __param_ops_##name = \
190 { (void *)set, (void *)get }; \ 201 { 0, (void *)set, (void *)get }; \
191 __module_param_call(MODULE_PARAM_PREFIX, \ 202 __module_param_call(MODULE_PARAM_PREFIX, \
192 name, &__param_ops_##name, arg, \ 203 name, &__param_ops_##name, arg, \
193 (perm) + sizeof(__check_old_set_param(set))*0, -1) 204 (perm) + sizeof(__check_old_set_param(set))*0, -1)
@@ -439,7 +450,7 @@ extern struct kernel_param_ops param_ops_string;
439extern int param_set_copystring(const char *val, const struct kernel_param *); 450extern int param_set_copystring(const char *val, const struct kernel_param *);
440extern int param_get_string(char *buffer, const struct kernel_param *kp); 451extern int param_get_string(char *buffer, const struct kernel_param *kp);
441 452
442/* for exporting parameters in /sys/parameters */ 453/* for exporting parameters in /sys/module/.../parameters */
443 454
444struct module; 455struct module;
445 456
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 73005f9957ea..38cd98f112a0 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -48,6 +48,7 @@ struct mnt_namespace;
48#define MNT_INTERNAL 0x4000 48#define MNT_INTERNAL 0x4000
49 49
50#define MNT_LOCK_READONLY 0x400000 50#define MNT_LOCK_READONLY 0x400000
51#define MNT_LOCKED 0x800000
51 52
52struct vfsmount { 53struct vfsmount {
53 struct dentry *mnt_root; /* root of the mounted tree */ 54 struct dentry *mnt_root; /* root of the mounted tree */
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 20c2d6dd5d25..b17ead818aec 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -35,6 +35,7 @@ struct msi_desc {
35 35
36 u32 masked; /* mask bits */ 36 u32 masked; /* mask bits */
37 unsigned int irq; 37 unsigned int irq;
38 unsigned int nvec_used; /* number of messages */
38 struct list_head list; 39 struct list_head list;
39 40
40 union { 41 union {
@@ -50,12 +51,31 @@ struct msi_desc {
50}; 51};
51 52
52/* 53/*
53 * The arch hook for setup up msi irqs 54 * The arch hooks to setup up msi irqs. Those functions are
55 * implemented as weak symbols so that they /can/ be overriden by
56 * architecture specific code if needed.
54 */ 57 */
55int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); 58int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
56void arch_teardown_msi_irq(unsigned int irq); 59void arch_teardown_msi_irq(unsigned int irq);
57int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 60int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
58void arch_teardown_msi_irqs(struct pci_dev *dev); 61void arch_teardown_msi_irqs(struct pci_dev *dev);
59int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); 62int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);
63void arch_restore_msi_irqs(struct pci_dev *dev, int irq);
64
65void default_teardown_msi_irqs(struct pci_dev *dev);
66void default_restore_msi_irqs(struct pci_dev *dev, int irq);
67
68struct msi_chip {
69 struct module *owner;
70 struct device *dev;
71 struct device_node *of_node;
72 struct list_head list;
73
74 int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev,
75 struct msi_desc *desc);
76 void (*teardown_irq)(struct msi_chip *chip, unsigned int irq);
77 int (*check_device)(struct msi_chip *chip, struct pci_dev *dev,
78 int nvec, int type);
79};
60 80
61#endif /* LINUX_MSI_H */ 81#endif /* LINUX_MSI_H */
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 211ff67e8b0d..95fc482cef36 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -93,8 +93,6 @@ struct nand_bbt_descr {
93#define NAND_BBT_CREATE_EMPTY 0x00000400 93#define NAND_BBT_CREATE_EMPTY 0x00000400
94/* Search good / bad pattern through all pages of a block */ 94/* Search good / bad pattern through all pages of a block */
95#define NAND_BBT_SCANALLPAGES 0x00000800 95#define NAND_BBT_SCANALLPAGES 0x00000800
96/* Scan block empty during good / bad block scan */
97#define NAND_BBT_SCANEMPTY 0x00001000
98/* Write bbt if neccecary */ 96/* Write bbt if neccecary */
99#define NAND_BBT_WRITE 0x00002000 97#define NAND_BBT_WRITE 0x00002000
100/* Read and write back block contents when writing bbt */ 98/* Read and write back block contents when writing bbt */
diff --git a/include/linux/mtd/fsmc.h b/include/linux/mtd/fsmc.h
index d6ed61ef451d..c8be32e9fc49 100644
--- a/include/linux/mtd/fsmc.h
+++ b/include/linux/mtd/fsmc.h
@@ -137,6 +137,7 @@ enum access_mode {
137 137
138/** 138/**
139 * fsmc_nand_platform_data - platform specific NAND controller config 139 * fsmc_nand_platform_data - platform specific NAND controller config
140 * @nand_timings: timing setup for the physical NAND interface
140 * @partitions: partition table for the platform, use a default fallback 141 * @partitions: partition table for the platform, use a default fallback
141 * if this is NULL 142 * if this is NULL
142 * @nr_partitions: the number of partitions in the previous entry 143 * @nr_partitions: the number of partitions in the previous entry
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index a5cf4e8d6818..f9bfe526d310 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -173,6 +173,9 @@ struct mtd_info {
173 /* ECC layout structure pointer - read only! */ 173 /* ECC layout structure pointer - read only! */
174 struct nand_ecclayout *ecclayout; 174 struct nand_ecclayout *ecclayout;
175 175
176 /* the ecc step size. */
177 unsigned int ecc_step_size;
178
176 /* max number of correctible bit errors per ecc step */ 179 /* max number of correctible bit errors per ecc step */
177 unsigned int ecc_strength; 180 unsigned int ecc_strength;
178 181
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index ab6363443ce8..ac8e89d5a792 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -56,7 +56,7 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
56 * is supported now. If you add a chip with bigger oobsize/page 56 * is supported now. If you add a chip with bigger oobsize/page
57 * adjust this accordingly. 57 * adjust this accordingly.
58 */ 58 */
59#define NAND_MAX_OOBSIZE 640 59#define NAND_MAX_OOBSIZE 744
60#define NAND_MAX_PAGESIZE 8192 60#define NAND_MAX_PAGESIZE 8192
61 61
62/* 62/*
@@ -202,6 +202,10 @@ typedef enum {
202/* Keep gcc happy */ 202/* Keep gcc happy */
203struct nand_chip; 203struct nand_chip;
204 204
205/* ONFI features */
206#define ONFI_FEATURE_16_BIT_BUS (1 << 0)
207#define ONFI_FEATURE_EXT_PARAM_PAGE (1 << 7)
208
205/* ONFI timing mode, used in both asynchronous and synchronous mode */ 209/* ONFI timing mode, used in both asynchronous and synchronous mode */
206#define ONFI_TIMING_MODE_0 (1 << 0) 210#define ONFI_TIMING_MODE_0 (1 << 0)
207#define ONFI_TIMING_MODE_1 (1 << 1) 211#define ONFI_TIMING_MODE_1 (1 << 1)
@@ -217,6 +221,9 @@ struct nand_chip;
217/* ONFI subfeature parameters length */ 221/* ONFI subfeature parameters length */
218#define ONFI_SUBFEATURE_PARAM_LEN 4 222#define ONFI_SUBFEATURE_PARAM_LEN 4
219 223
224/* ONFI optional commands SET/GET FEATURES supported? */
225#define ONFI_OPT_CMD_SET_GET_FEATURES (1 << 2)
226
220struct nand_onfi_params { 227struct nand_onfi_params {
221 /* rev info and features block */ 228 /* rev info and features block */
222 /* 'O' 'N' 'F' 'I' */ 229 /* 'O' 'N' 'F' 'I' */
@@ -224,7 +231,10 @@ struct nand_onfi_params {
224 __le16 revision; 231 __le16 revision;
225 __le16 features; 232 __le16 features;
226 __le16 opt_cmd; 233 __le16 opt_cmd;
227 u8 reserved[22]; 234 u8 reserved0[2];
235 __le16 ext_param_page_length; /* since ONFI 2.1 */
236 u8 num_of_param_pages; /* since ONFI 2.1 */
237 u8 reserved1[17];
228 238
229 /* manufacturer information block */ 239 /* manufacturer information block */
230 char manufacturer[12]; 240 char manufacturer[12];
@@ -281,6 +291,40 @@ struct nand_onfi_params {
281 291
282#define ONFI_CRC_BASE 0x4F4E 292#define ONFI_CRC_BASE 0x4F4E
283 293
294/* Extended ECC information Block Definition (since ONFI 2.1) */
295struct onfi_ext_ecc_info {
296 u8 ecc_bits;
297 u8 codeword_size;
298 __le16 bb_per_lun;
299 __le16 block_endurance;
300 u8 reserved[2];
301} __packed;
302
303#define ONFI_SECTION_TYPE_0 0 /* Unused section. */
304#define ONFI_SECTION_TYPE_1 1 /* for additional sections. */
305#define ONFI_SECTION_TYPE_2 2 /* for ECC information. */
306struct onfi_ext_section {
307 u8 type;
308 u8 length;
309} __packed;
310
311#define ONFI_EXT_SECTION_MAX 8
312
313/* Extended Parameter Page Definition (since ONFI 2.1) */
314struct onfi_ext_param_page {
315 __le16 crc;
316 u8 sig[4]; /* 'E' 'P' 'P' 'S' */
317 u8 reserved0[10];
318 struct onfi_ext_section sections[ONFI_EXT_SECTION_MAX];
319
320 /*
321 * The actual size of the Extended Parameter Page is in
322 * @ext_param_page_length of nand_onfi_params{}.
323 * The following are the variable length sections.
324 * So we do not add any fields below. Please see the ONFI spec.
325 */
326} __packed;
327
284/** 328/**
285 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices 329 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices
286 * @lock: protection lock 330 * @lock: protection lock
@@ -390,8 +434,8 @@ struct nand_buffers {
390 * @write_buf: [REPLACEABLE] write data from the buffer to the chip 434 * @write_buf: [REPLACEABLE] write data from the buffer to the chip
391 * @read_buf: [REPLACEABLE] read data from the chip into the buffer 435 * @read_buf: [REPLACEABLE] read data from the chip into the buffer
392 * @select_chip: [REPLACEABLE] select chip nr 436 * @select_chip: [REPLACEABLE] select chip nr
393 * @block_bad: [REPLACEABLE] check, if the block is bad 437 * @block_bad: [REPLACEABLE] check if a block is bad, using OOB markers
394 * @block_markbad: [REPLACEABLE] mark the block bad 438 * @block_markbad: [REPLACEABLE] mark a block bad
395 * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific function for controlling 439 * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific function for controlling
396 * ALE/CLE/nCE. Also used to write command and address 440 * ALE/CLE/nCE. Also used to write command and address
397 * @init_size: [BOARDSPECIFIC] hardwarespecific function for setting 441 * @init_size: [BOARDSPECIFIC] hardwarespecific function for setting
@@ -434,6 +478,12 @@ struct nand_buffers {
434 * bad block marker position; i.e., BBM == 11110111b is 478 * bad block marker position; i.e., BBM == 11110111b is
435 * not bad when badblockbits == 7 479 * not bad when badblockbits == 7
436 * @cellinfo: [INTERN] MLC/multichip data from chip ident 480 * @cellinfo: [INTERN] MLC/multichip data from chip ident
481 * @ecc_strength_ds: [INTERN] ECC correctability from the datasheet.
482 * Minimum amount of bit errors per @ecc_step_ds guaranteed
483 * to be correctable. If unknown, set to zero.
484 * @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds,
485 * also from the datasheet. It is the recommended ECC step
486 * size, if known; if unknown, set to zero.
437 * @numchips: [INTERN] number of physical chips 487 * @numchips: [INTERN] number of physical chips
438 * @chipsize: [INTERN] the size of one chip for multichip arrays 488 * @chipsize: [INTERN] the size of one chip for multichip arrays
439 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 489 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
@@ -510,6 +560,8 @@ struct nand_chip {
510 unsigned int pagebuf_bitflips; 560 unsigned int pagebuf_bitflips;
511 int subpagesize; 561 int subpagesize;
512 uint8_t cellinfo; 562 uint8_t cellinfo;
563 uint16_t ecc_strength_ds;
564 uint16_t ecc_step_ds;
513 int badblockpos; 565 int badblockpos;
514 int badblockbits; 566 int badblockbits;
515 567
@@ -576,6 +628,11 @@ struct nand_chip {
576 { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \ 628 { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \
577 .options = (opts) } 629 .options = (opts) }
578 630
631#define NAND_ECC_INFO(_strength, _step) \
632 { .strength_ds = (_strength), .step_ds = (_step) }
633#define NAND_ECC_STRENGTH(type) ((type)->ecc.strength_ds)
634#define NAND_ECC_STEP(type) ((type)->ecc.step_ds)
635
579/** 636/**
580 * struct nand_flash_dev - NAND Flash Device ID Structure 637 * struct nand_flash_dev - NAND Flash Device ID Structure
581 * @name: a human-readable name of the NAND chip 638 * @name: a human-readable name of the NAND chip
@@ -593,6 +650,12 @@ struct nand_chip {
593 * @options: stores various chip bit options 650 * @options: stores various chip bit options
594 * @id_len: The valid length of the @id. 651 * @id_len: The valid length of the @id.
595 * @oobsize: OOB size 652 * @oobsize: OOB size
653 * @ecc.strength_ds: The ECC correctability from the datasheet, same as the
654 * @ecc_strength_ds in nand_chip{}.
655 * @ecc.step_ds: The ECC step required by the @ecc.strength_ds, same as the
656 * @ecc_step_ds in nand_chip{}, also from the datasheet.
657 * For example, the "4bit ECC for each 512Byte" can be set with
658 * NAND_ECC_INFO(4, 512).
596 */ 659 */
597struct nand_flash_dev { 660struct nand_flash_dev {
598 char *name; 661 char *name;
@@ -609,6 +672,10 @@ struct nand_flash_dev {
609 unsigned int options; 672 unsigned int options;
610 uint16_t id_len; 673 uint16_t id_len;
611 uint16_t oobsize; 674 uint16_t oobsize;
675 struct {
676 uint16_t strength_ds;
677 uint16_t step_ds;
678 } ecc;
612}; 679};
613 680
614/** 681/**
@@ -625,8 +692,8 @@ extern struct nand_flash_dev nand_flash_ids[];
625extern struct nand_manufacturers nand_manuf_ids[]; 692extern struct nand_manufacturers nand_manuf_ids[];
626 693
627extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); 694extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd);
628extern int nand_update_bbt(struct mtd_info *mtd, loff_t offs);
629extern int nand_default_bbt(struct mtd_info *mtd); 695extern int nand_default_bbt(struct mtd_info *mtd);
696extern int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs);
630extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt); 697extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt);
631extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, 698extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
632 int allowbbt); 699 int allowbbt);
@@ -708,6 +775,12 @@ struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd)
708 return chip->priv; 775 return chip->priv;
709} 776}
710 777
778/* return the supported features. */
779static inline int onfi_feature(struct nand_chip *chip)
780{
781 return chip->onfi_version ? le16_to_cpu(chip->onfi_params.features) : 0;
782}
783
711/* return the supported asynchronous timing mode. */ 784/* return the supported asynchronous timing mode. */
712static inline int onfi_get_async_timing_mode(struct nand_chip *chip) 785static inline int onfi_get_async_timing_mode(struct nand_chip *chip)
713{ 786{
diff --git a/include/linux/mutex-debug.h b/include/linux/mutex-debug.h
index 731d77d6e155..4ac8b1977b73 100644
--- a/include/linux/mutex-debug.h
+++ b/include/linux/mutex-debug.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/linkage.h> 4#include <linux/linkage.h>
5#include <linux/lockdep.h> 5#include <linux/lockdep.h>
6#include <linux/debug_locks.h>
6 7
7/* 8/*
8 * Mutexes - debugging helpers: 9 * Mutexes - debugging helpers:
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 433da8a1a426..bab49da8a0f0 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -10,12 +10,13 @@
10#ifndef __LINUX_MUTEX_H 10#ifndef __LINUX_MUTEX_H
11#define __LINUX_MUTEX_H 11#define __LINUX_MUTEX_H
12 12
13#include <asm/current.h>
13#include <linux/list.h> 14#include <linux/list.h>
14#include <linux/spinlock_types.h> 15#include <linux/spinlock_types.h>
15#include <linux/linkage.h> 16#include <linux/linkage.h>
16#include <linux/lockdep.h> 17#include <linux/lockdep.h>
17
18#include <linux/atomic.h> 18#include <linux/atomic.h>
19#include <asm/processor.h>
19 20
20/* 21/*
21 * Simple, straightforward mutexes with strict semantics: 22 * Simple, straightforward mutexes with strict semantics:
@@ -136,6 +137,7 @@ static inline int mutex_is_locked(struct mutex *lock)
136#ifdef CONFIG_DEBUG_LOCK_ALLOC 137#ifdef CONFIG_DEBUG_LOCK_ALLOC
137extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); 138extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
138extern void _mutex_lock_nest_lock(struct mutex *lock, struct lockdep_map *nest_lock); 139extern void _mutex_lock_nest_lock(struct mutex *lock, struct lockdep_map *nest_lock);
140
139extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock, 141extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock,
140 unsigned int subclass); 142 unsigned int subclass);
141extern int __must_check mutex_lock_killable_nested(struct mutex *lock, 143extern int __must_check mutex_lock_killable_nested(struct mutex *lock,
@@ -147,7 +149,7 @@ extern int __must_check mutex_lock_killable_nested(struct mutex *lock,
147 149
148#define mutex_lock_nest_lock(lock, nest_lock) \ 150#define mutex_lock_nest_lock(lock, nest_lock) \
149do { \ 151do { \
150 typecheck(struct lockdep_map *, &(nest_lock)->dep_map); \ 152 typecheck(struct lockdep_map *, &(nest_lock)->dep_map); \
151 _mutex_lock_nest_lock(lock, &(nest_lock)->dep_map); \ 153 _mutex_lock_nest_lock(lock, &(nest_lock)->dep_map); \
152} while (0) 154} while (0)
153 155
@@ -170,10 +172,11 @@ extern int __must_check mutex_lock_killable(struct mutex *lock);
170 */ 172 */
171extern int mutex_trylock(struct mutex *lock); 173extern int mutex_trylock(struct mutex *lock);
172extern void mutex_unlock(struct mutex *lock); 174extern void mutex_unlock(struct mutex *lock);
175
173extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); 176extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
174 177
175#ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX 178#ifndef arch_mutex_cpu_relax
176#define arch_mutex_cpu_relax() cpu_relax() 179# define arch_mutex_cpu_relax() cpu_relax()
177#endif 180#endif
178 181
179#endif 182#endif
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 141d395bbb5f..61a0da38d0cb 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -6,6 +6,7 @@
6#define __LINUX_MV643XX_ETH_H 6#define __LINUX_MV643XX_ETH_H
7 7
8#include <linux/mbus.h> 8#include <linux/mbus.h>
9#include <linux/if_ether.h>
9 10
10#define MV643XX_ETH_SHARED_NAME "mv643xx_eth" 11#define MV643XX_ETH_SHARED_NAME "mv643xx_eth"
11#define MV643XX_ETH_NAME "mv643xx_eth_port" 12#define MV643XX_ETH_NAME "mv643xx_eth_port"
@@ -30,6 +31,7 @@ struct mv643xx_eth_shared_platform_data {
30#define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x)) 31#define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x))
31#define MV643XX_ETH_PHY_NONE 0xff 32#define MV643XX_ETH_PHY_NONE 0xff
32 33
34struct device_node;
33struct mv643xx_eth_platform_data { 35struct mv643xx_eth_platform_data {
34 /* 36 /*
35 * Pointer back to our parent instance, and our port number. 37 * Pointer back to our parent instance, and our port number.
@@ -41,12 +43,13 @@ struct mv643xx_eth_platform_data {
41 * Whether a PHY is present, and if yes, at which address. 43 * Whether a PHY is present, and if yes, at which address.
42 */ 44 */
43 int phy_addr; 45 int phy_addr;
46 struct device_node *phy_node;
44 47
45 /* 48 /*
46 * Use this MAC address if it is valid, overriding the 49 * Use this MAC address if it is valid, overriding the
47 * address that is already in the hardware. 50 * address that is already in the hardware.
48 */ 51 */
49 u8 mac_addr[6]; 52 u8 mac_addr[ETH_ALEN];
50 53
51 /* 54 /*
52 * If speed is 0, autonegotiation is enabled. 55 * If speed is 0, autonegotiation is enabled.
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 5a5ff57ceed4..8e47bc7a1665 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -70,8 +70,7 @@ extern struct dentry *kern_path_create(int, const char *, struct path *, unsigne
70extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int); 70extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int);
71extern void done_path_create(struct path *, struct dentry *); 71extern void done_path_create(struct path *, struct dentry *);
72extern struct dentry *kern_path_locked(const char *, struct path *); 72extern struct dentry *kern_path_locked(const char *, struct path *);
73extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 73extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int);
74 const char *, unsigned int, struct path *);
75 74
76extern struct dentry *lookup_one_len(const char *, struct dentry *, int); 75extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
77 76
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 4871170a04a0..ae4981ebd18e 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -41,6 +41,7 @@ struct nbd_device {
41 u64 bytesize; 41 u64 bytesize;
42 pid_t pid; /* pid of nbd-client, if attached */ 42 pid_t pid; /* pid of nbd-client, if attached */
43 int xmit_timeout; 43 int xmit_timeout;
44 int disconnect; /* a disconnect has been requested by user */
44}; 45};
45 46
46#endif 47#endif
diff --git a/include/linux/net.h b/include/linux/net.h
index 99c9f0c103c2..4f27575ce1d6 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -79,9 +79,9 @@ enum sock_type {
79#endif /* ARCH_HAS_SOCKET_TYPES */ 79#endif /* ARCH_HAS_SOCKET_TYPES */
80 80
81enum sock_shutdown_cmd { 81enum sock_shutdown_cmd {
82 SHUT_RD = 0, 82 SHUT_RD,
83 SHUT_WR = 1, 83 SHUT_WR,
84 SHUT_RDWR = 2, 84 SHUT_RDWR,
85}; 85};
86 86
87struct socket_wq { 87struct socket_wq {
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 09906b7ca47d..a2a89a5c7be5 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -43,8 +43,9 @@ enum {
43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */ 43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */
44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */ 44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */
45 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */ 45 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */
46 NETIF_F_GSO_MPLS_BIT, /* ... MPLS segmentation */
46 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */ 47 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */
47 NETIF_F_GSO_UDP_TUNNEL_BIT, 48 NETIF_F_GSO_MPLS_BIT,
48 49
49 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ 50 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
50 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */ 51 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
@@ -107,6 +108,7 @@ enum {
107#define NETIF_F_RXALL __NETIF_F(RXALL) 108#define NETIF_F_RXALL __NETIF_F(RXALL)
108#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE) 109#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE)
109#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL) 110#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL)
111#define NETIF_F_GSO_MPLS __NETIF_F(GSO_MPLS)
110#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER) 112#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)
111#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) 113#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
112#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) 114#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 60584b185a0c..3de49aca4519 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -324,12 +324,15 @@ struct napi_struct {
324 struct sk_buff *gro_list; 324 struct sk_buff *gro_list;
325 struct sk_buff *skb; 325 struct sk_buff *skb;
326 struct list_head dev_list; 326 struct list_head dev_list;
327 struct hlist_node napi_hash_node;
328 unsigned int napi_id;
327}; 329};
328 330
329enum { 331enum {
330 NAPI_STATE_SCHED, /* Poll is scheduled */ 332 NAPI_STATE_SCHED, /* Poll is scheduled */
331 NAPI_STATE_DISABLE, /* Disable pending */ 333 NAPI_STATE_DISABLE, /* Disable pending */
332 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ 334 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */
335 NAPI_STATE_HASHED, /* In NAPI hash */
333}; 336};
334 337
335enum gro_result { 338enum gro_result {
@@ -446,6 +449,32 @@ extern void __napi_complete(struct napi_struct *n);
446extern void napi_complete(struct napi_struct *n); 449extern void napi_complete(struct napi_struct *n);
447 450
448/** 451/**
452 * napi_by_id - lookup a NAPI by napi_id
453 * @napi_id: hashed napi_id
454 *
455 * lookup @napi_id in napi_hash table
456 * must be called under rcu_read_lock()
457 */
458extern struct napi_struct *napi_by_id(unsigned int napi_id);
459
460/**
461 * napi_hash_add - add a NAPI to global hashtable
462 * @napi: napi context
463 *
464 * generate a new napi_id and store a @napi under it in napi_hash
465 */
466extern void napi_hash_add(struct napi_struct *napi);
467
468/**
469 * napi_hash_del - remove a NAPI from global table
470 * @napi: napi context
471 *
472 * Warning: caller must observe rcu grace period
473 * before freeing memory containing @napi
474 */
475extern void napi_hash_del(struct napi_struct *napi);
476
477/**
449 * napi_disable - prevent NAPI from scheduling 478 * napi_disable - prevent NAPI from scheduling
450 * @n: napi context 479 * @n: napi context
451 * 480 *
@@ -699,6 +728,16 @@ struct netdev_fcoe_hbainfo {
699}; 728};
700#endif 729#endif
701 730
731#define MAX_PHYS_PORT_ID_LEN 32
732
733/* This structure holds a unique identifier to identify the
734 * physical port used by a netdevice.
735 */
736struct netdev_phys_port_id {
737 unsigned char id[MAX_PHYS_PORT_ID_LEN];
738 unsigned char id_len;
739};
740
702/* 741/*
703 * This structure defines the management hooks for network devices. 742 * This structure defines the management hooks for network devices.
704 * The following hooks can be defined; unless noted otherwise, they are 743 * The following hooks can be defined; unless noted otherwise, they are
@@ -800,6 +839,7 @@ struct netdev_fcoe_hbainfo {
800 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); 839 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting);
801 * int (*ndo_get_vf_config)(struct net_device *dev, 840 * int (*ndo_get_vf_config)(struct net_device *dev,
802 * int vf, struct ifla_vf_info *ivf); 841 * int vf, struct ifla_vf_info *ivf);
842 * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state);
803 * int (*ndo_set_vf_port)(struct net_device *dev, int vf, 843 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
804 * struct nlattr *port[]); 844 * struct nlattr *port[]);
805 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); 845 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
@@ -902,6 +942,25 @@ struct netdev_fcoe_hbainfo {
902 * that determine carrier state from physical hardware properties (eg 942 * that determine carrier state from physical hardware properties (eg
903 * network cables) or protocol-dependent mechanisms (eg 943 * network cables) or protocol-dependent mechanisms (eg
904 * USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function. 944 * USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function.
945 *
946 * int (*ndo_get_phys_port_id)(struct net_device *dev,
947 * struct netdev_phys_port_id *ppid);
948 * Called to get ID of physical port of this device. If driver does
949 * not implement this, it is assumed that the hw is not able to have
950 * multiple net devices on single physical port.
951 *
952 * void (*ndo_add_vxlan_port)(struct net_device *dev,
953 * sa_family_t sa_family, __be16 port);
954 * Called by vxlan to notiy a driver about the UDP port and socket
955 * address family that vxlan is listnening to. It is called only when
956 * a new port starts listening. The operation is protected by the
957 * vxlan_net->sock_lock.
958 *
959 * void (*ndo_del_vxlan_port)(struct net_device *dev,
960 * sa_family_t sa_family, __be16 port);
961 * Called by vxlan to notify the driver about a UDP port and socket
962 * address family that vxlan is not listening to anymore. The operation
963 * is protected by the vxlan_net->sock_lock.
905 */ 964 */
906struct net_device_ops { 965struct net_device_ops {
907 int (*ndo_init)(struct net_device *dev); 966 int (*ndo_init)(struct net_device *dev);
@@ -943,6 +1002,9 @@ struct net_device_ops {
943 gfp_t gfp); 1002 gfp_t gfp);
944 void (*ndo_netpoll_cleanup)(struct net_device *dev); 1003 void (*ndo_netpoll_cleanup)(struct net_device *dev);
945#endif 1004#endif
1005#ifdef CONFIG_NET_RX_BUSY_POLL
1006 int (*ndo_busy_poll)(struct napi_struct *dev);
1007#endif
946 int (*ndo_set_vf_mac)(struct net_device *dev, 1008 int (*ndo_set_vf_mac)(struct net_device *dev,
947 int queue, u8 *mac); 1009 int queue, u8 *mac);
948 int (*ndo_set_vf_vlan)(struct net_device *dev, 1010 int (*ndo_set_vf_vlan)(struct net_device *dev,
@@ -954,6 +1016,8 @@ struct net_device_ops {
954 int (*ndo_get_vf_config)(struct net_device *dev, 1016 int (*ndo_get_vf_config)(struct net_device *dev,
955 int vf, 1017 int vf,
956 struct ifla_vf_info *ivf); 1018 struct ifla_vf_info *ivf);
1019 int (*ndo_set_vf_link_state)(struct net_device *dev,
1020 int vf, int link_state);
957 int (*ndo_set_vf_port)(struct net_device *dev, 1021 int (*ndo_set_vf_port)(struct net_device *dev,
958 int vf, 1022 int vf,
959 struct nlattr *port[]); 1023 struct nlattr *port[]);
@@ -1025,6 +1089,14 @@ struct net_device_ops {
1025 struct nlmsghdr *nlh); 1089 struct nlmsghdr *nlh);
1026 int (*ndo_change_carrier)(struct net_device *dev, 1090 int (*ndo_change_carrier)(struct net_device *dev,
1027 bool new_carrier); 1091 bool new_carrier);
1092 int (*ndo_get_phys_port_id)(struct net_device *dev,
1093 struct netdev_phys_port_id *ppid);
1094 void (*ndo_add_vxlan_port)(struct net_device *dev,
1095 sa_family_t sa_family,
1096 __be16 port);
1097 void (*ndo_del_vxlan_port)(struct net_device *dev,
1098 sa_family_t sa_family,
1099 __be16 port);
1028}; 1100};
1029 1101
1030/* 1102/*
@@ -1072,6 +1144,7 @@ struct net_device {
1072 struct list_head napi_list; 1144 struct list_head napi_list;
1073 struct list_head unreg_list; 1145 struct list_head unreg_list;
1074 struct list_head upper_dev_list; /* List of upper devices */ 1146 struct list_head upper_dev_list; /* List of upper devices */
1147 struct list_head lower_dev_list;
1075 1148
1076 1149
1077 /* currently active device features */ 1150 /* currently active device features */
@@ -1088,6 +1161,8 @@ struct net_device {
1088 * need to set them appropriately. 1161 * need to set them appropriately.
1089 */ 1162 */
1090 netdev_features_t hw_enc_features; 1163 netdev_features_t hw_enc_features;
1164 /* mask of fetures inheritable by MPLS */
1165 netdev_features_t mpls_features;
1091 1166
1092 /* Interface index. Unique device identifier */ 1167 /* Interface index. Unique device identifier */
1093 int ifindex; 1168 int ifindex;
@@ -1140,8 +1215,10 @@ struct net_device {
1140 unsigned char addr_assign_type; /* hw address assignment type */ 1215 unsigned char addr_assign_type; /* hw address assignment type */
1141 unsigned char addr_len; /* hardware address length */ 1216 unsigned char addr_len; /* hardware address length */
1142 unsigned char neigh_priv_len; 1217 unsigned char neigh_priv_len;
1143 unsigned short dev_id; /* for shared network cards */ 1218 unsigned short dev_id; /* Used to differentiate devices
1144 1219 * that share the same link
1220 * layer address
1221 */
1145 spinlock_t addr_list_lock; 1222 spinlock_t addr_list_lock;
1146 struct netdev_hw_addr_list uc; /* Unicast mac addresses */ 1223 struct netdev_hw_addr_list uc; /* Unicast mac addresses */
1147 struct netdev_hw_addr_list mc; /* Multicast mac addresses */ 1224 struct netdev_hw_addr_list mc; /* Multicast mac addresses */
@@ -1593,17 +1670,40 @@ struct packet_offload {
1593#define NETDEV_RELEASE 0x0012 1670#define NETDEV_RELEASE 0x0012
1594#define NETDEV_NOTIFY_PEERS 0x0013 1671#define NETDEV_NOTIFY_PEERS 0x0013
1595#define NETDEV_JOIN 0x0014 1672#define NETDEV_JOIN 0x0014
1673#define NETDEV_CHANGEUPPER 0x0015
1674#define NETDEV_RESEND_IGMP 0x0016
1596 1675
1597extern int register_netdevice_notifier(struct notifier_block *nb); 1676extern int register_netdevice_notifier(struct notifier_block *nb);
1598extern int unregister_netdevice_notifier(struct notifier_block *nb); 1677extern int unregister_netdevice_notifier(struct notifier_block *nb);
1599extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1600 1678
1679struct netdev_notifier_info {
1680 struct net_device *dev;
1681};
1601 1682
1602extern rwlock_t dev_base_lock; /* Device list lock */ 1683struct netdev_notifier_change_info {
1684 struct netdev_notifier_info info; /* must be first */
1685 unsigned int flags_changed;
1686};
1603 1687
1604extern seqcount_t devnet_rename_seq; /* Device rename seq */ 1688static inline void netdev_notifier_info_init(struct netdev_notifier_info *info,
1689 struct net_device *dev)
1690{
1691 info->dev = dev;
1692}
1693
1694static inline struct net_device *
1695netdev_notifier_info_to_dev(const struct netdev_notifier_info *info)
1696{
1697 return info->dev;
1698}
1699
1700extern int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev,
1701 struct netdev_notifier_info *info);
1702extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1605 1703
1606 1704
1705extern rwlock_t dev_base_lock; /* Device list lock */
1706
1607#define for_each_netdev(net, d) \ 1707#define for_each_netdev(net, d) \
1608 list_for_each_entry(d, &(net)->dev_base_head, dev_list) 1708 list_for_each_entry(d, &(net)->dev_base_head, dev_list)
1609#define for_each_netdev_reverse(net, d) \ 1709#define for_each_netdev_reverse(net, d) \
@@ -1695,6 +1795,7 @@ extern int init_dummy_netdev(struct net_device *dev);
1695extern struct net_device *dev_get_by_index(struct net *net, int ifindex); 1795extern struct net_device *dev_get_by_index(struct net *net, int ifindex);
1696extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); 1796extern struct net_device *__dev_get_by_index(struct net *net, int ifindex);
1697extern struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); 1797extern struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
1798extern int netdev_get_name(struct net *net, char *name, int ifindex);
1698extern int dev_restart(struct net_device *dev); 1799extern int dev_restart(struct net_device *dev);
1699#ifdef CONFIG_NETPOLL_TRAP 1800#ifdef CONFIG_NETPOLL_TRAP
1700extern int netpoll_trap(void); 1801extern int netpoll_trap(void);
@@ -1778,6 +1879,19 @@ static inline int unregister_gifconf(unsigned int family)
1778 return register_gifconf(family, NULL); 1879 return register_gifconf(family, NULL);
1779} 1880}
1780 1881
1882#ifdef CONFIG_NET_FLOW_LIMIT
1883#define FLOW_LIMIT_HISTORY (1 << 7) /* must be ^2 and !overflow buckets */
1884struct sd_flow_limit {
1885 u64 count;
1886 unsigned int num_buckets;
1887 unsigned int history_head;
1888 u16 history[FLOW_LIMIT_HISTORY];
1889 u8 buckets[];
1890};
1891
1892extern int netdev_flow_limit_table_len;
1893#endif /* CONFIG_NET_FLOW_LIMIT */
1894
1781/* 1895/*
1782 * Incoming packets are placed on per-cpu queues 1896 * Incoming packets are placed on per-cpu queues
1783 */ 1897 */
@@ -1807,6 +1921,10 @@ struct softnet_data {
1807 unsigned int dropped; 1921 unsigned int dropped;
1808 struct sk_buff_head input_pkt_queue; 1922 struct sk_buff_head input_pkt_queue;
1809 struct napi_struct backlog; 1923 struct napi_struct backlog;
1924
1925#ifdef CONFIG_NET_FLOW_LIMIT
1926 struct sd_flow_limit __rcu *flow_limit;
1927#endif
1810}; 1928};
1811 1929
1812static inline void input_queue_head_incr(struct softnet_data *sd) 1930static inline void input_queue_head_incr(struct softnet_data *sd)
@@ -1983,6 +2101,15 @@ static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
1983#endif 2101#endif
1984} 2102}
1985 2103
2104/**
2105 * netdev_sent_queue - report the number of bytes queued to hardware
2106 * @dev: network device
2107 * @bytes: number of bytes queued to the hardware device queue
2108 *
2109 * Report the number of bytes queued for sending/completion to the network
2110 * device hardware queue. @bytes should be a good approximation and should
2111 * exactly match netdev_completed_queue() @bytes
2112 */
1986static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes) 2113static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes)
1987{ 2114{
1988 netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes); 2115 netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes);
@@ -2012,6 +2139,16 @@ static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
2012#endif 2139#endif
2013} 2140}
2014 2141
2142/**
2143 * netdev_completed_queue - report bytes and packets completed by device
2144 * @dev: network device
2145 * @pkts: actual number of packets sent over the medium
2146 * @bytes: actual number of bytes sent over the medium
2147 *
2148 * Report the number of bytes and packets transmitted by the network device
2149 * hardware queue over the physical medium, @bytes must exactly match the
2150 * @bytes amount passed to netdev_sent_queue()
2151 */
2015static inline void netdev_completed_queue(struct net_device *dev, 2152static inline void netdev_completed_queue(struct net_device *dev,
2016 unsigned int pkts, unsigned int bytes) 2153 unsigned int pkts, unsigned int bytes)
2017{ 2154{
@@ -2026,6 +2163,13 @@ static inline void netdev_tx_reset_queue(struct netdev_queue *q)
2026#endif 2163#endif
2027} 2164}
2028 2165
2166/**
2167 * netdev_reset_queue - reset the packets and bytes count of a network device
2168 * @dev_queue: network device
2169 *
2170 * Reset the bytes and packet count of a network device and clear the
2171 * software flow control OFF bit for this network device
2172 */
2029static inline void netdev_reset_queue(struct net_device *dev_queue) 2173static inline void netdev_reset_queue(struct net_device *dev_queue)
2030{ 2174{
2031 netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0)); 2175 netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0));
@@ -2235,6 +2379,8 @@ extern int dev_set_mac_address(struct net_device *,
2235 struct sockaddr *); 2379 struct sockaddr *);
2236extern int dev_change_carrier(struct net_device *, 2380extern int dev_change_carrier(struct net_device *,
2237 bool new_carrier); 2381 bool new_carrier);
2382extern int dev_get_phys_port_id(struct net_device *dev,
2383 struct netdev_phys_port_id *ppid);
2238extern int dev_hard_start_xmit(struct sk_buff *skb, 2384extern int dev_hard_start_xmit(struct sk_buff *skb,
2239 struct net_device *dev, 2385 struct net_device *dev,
2240 struct netdev_queue *txq); 2386 struct netdev_queue *txq);
@@ -2667,6 +2813,16 @@ extern int bpf_jit_enable;
2667extern bool netdev_has_upper_dev(struct net_device *dev, 2813extern bool netdev_has_upper_dev(struct net_device *dev,
2668 struct net_device *upper_dev); 2814 struct net_device *upper_dev);
2669extern bool netdev_has_any_upper_dev(struct net_device *dev); 2815extern bool netdev_has_any_upper_dev(struct net_device *dev);
2816extern struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
2817 struct list_head **iter);
2818
2819/* iterate through upper list, must be called under RCU read lock */
2820#define netdev_for_each_upper_dev_rcu(dev, upper, iter) \
2821 for (iter = &(dev)->upper_dev_list, \
2822 upper = netdev_upper_get_next_dev_rcu(dev, &(iter)); \
2823 upper; \
2824 upper = netdev_upper_get_next_dev_rcu(dev, &(iter)))
2825
2670extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev); 2826extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
2671extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev); 2827extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
2672extern int netdev_upper_dev_link(struct net_device *dev, 2828extern int netdev_upper_dev_link(struct net_device *dev,
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 0060fde3160e..708fe72ab913 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -35,7 +35,7 @@ static inline void nf_inet_addr_mask(const union nf_inet_addr *a1,
35 result->all[3] = a1->all[3] & mask->all[3]; 35 result->all[3] = a1->all[3] & mask->all[3];
36} 36}
37 37
38extern void netfilter_init(void); 38extern int netfilter_init(void);
39 39
40/* Largest hook number + 1 */ 40/* Largest hook number + 1 */
41#define NF_MAX_HOOKS 8 41#define NF_MAX_HOOKS 8
@@ -314,25 +314,24 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
314#endif /*CONFIG_NETFILTER*/ 314#endif /*CONFIG_NETFILTER*/
315 315
316#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 316#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
317extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *) __rcu; 317extern void (*ip_ct_attach)(struct sk_buff *, const struct sk_buff *) __rcu;
318extern void nf_ct_attach(struct sk_buff *, struct sk_buff *); 318extern void nf_ct_attach(struct sk_buff *, const struct sk_buff *);
319extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu; 319extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu;
320 320
321struct nf_conn; 321struct nf_conn;
322enum ip_conntrack_info;
322struct nlattr; 323struct nlattr;
323 324
324struct nfq_ct_hook { 325struct nfq_ct_hook {
325 size_t (*build_size)(const struct nf_conn *ct); 326 size_t (*build_size)(const struct nf_conn *ct);
326 int (*build)(struct sk_buff *skb, struct nf_conn *ct); 327 int (*build)(struct sk_buff *skb, struct nf_conn *ct);
327 int (*parse)(const struct nlattr *attr, struct nf_conn *ct); 328 int (*parse)(const struct nlattr *attr, struct nf_conn *ct);
328}; 329 int (*attach_expect)(const struct nlattr *attr, struct nf_conn *ct,
329extern struct nfq_ct_hook __rcu *nfq_ct_hook; 330 u32 portid, u32 report);
330
331struct nfq_ct_nat_hook {
332 void (*seq_adjust)(struct sk_buff *skb, struct nf_conn *ct, 331 void (*seq_adjust)(struct sk_buff *skb, struct nf_conn *ct,
333 u32 ctinfo, int off); 332 enum ip_conntrack_info ctinfo, s32 off);
334}; 333};
335extern struct nfq_ct_nat_hook __rcu *nfq_ct_nat_hook; 334extern struct nfq_ct_hook __rcu *nfq_ct_hook;
336#else 335#else
337static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 336static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
338#endif 337#endif
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index d80e2753847c..9ac9fbde7b61 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -296,10 +296,12 @@ ip_set_eexist(int ret, u32 flags)
296 296
297/* Match elements marked with nomatch */ 297/* Match elements marked with nomatch */
298static inline bool 298static inline bool
299ip_set_enomatch(int ret, u32 flags, enum ipset_adt adt) 299ip_set_enomatch(int ret, u32 flags, enum ipset_adt adt, struct ip_set *set)
300{ 300{
301 return adt == IPSET_TEST && 301 return adt == IPSET_TEST &&
302 ret == -ENOTEMPTY && ((flags >> 16) & IPSET_FLAG_NOMATCH); 302 (set->type->features & IPSET_TYPE_NOMATCH) &&
303 ((flags >> 16) & IPSET_FLAG_NOMATCH) &&
304 (ret > 0 || ret == -ENOTEMPTY);
303} 305}
304 306
305/* Check the NLA_F_NET_BYTEORDER flag */ 307/* Check the NLA_F_NET_BYTEORDER flag */
diff --git a/include/linux/netfilter/xt_HMARK.h b/include/linux/netfilter/xt_HMARK.h
deleted file mode 100644
index 826fc5807577..000000000000
--- a/include/linux/netfilter/xt_HMARK.h
+++ /dev/null
@@ -1,50 +0,0 @@
1#ifndef XT_HMARK_H_
2#define XT_HMARK_H_
3
4#include <linux/types.h>
5
6enum {
7 XT_HMARK_SADDR_MASK,
8 XT_HMARK_DADDR_MASK,
9 XT_HMARK_SPI,
10 XT_HMARK_SPI_MASK,
11 XT_HMARK_SPORT,
12 XT_HMARK_DPORT,
13 XT_HMARK_SPORT_MASK,
14 XT_HMARK_DPORT_MASK,
15 XT_HMARK_PROTO_MASK,
16 XT_HMARK_RND,
17 XT_HMARK_MODULUS,
18 XT_HMARK_OFFSET,
19 XT_HMARK_CT,
20 XT_HMARK_METHOD_L3,
21 XT_HMARK_METHOD_L3_4,
22};
23#define XT_HMARK_FLAG(flag) (1 << flag)
24
25union hmark_ports {
26 struct {
27 __u16 src;
28 __u16 dst;
29 } p16;
30 struct {
31 __be16 src;
32 __be16 dst;
33 } b16;
34 __u32 v32;
35 __be32 b32;
36};
37
38struct xt_hmark_info {
39 union nf_inet_addr src_mask;
40 union nf_inet_addr dst_mask;
41 union hmark_ports port_mask;
42 union hmark_ports port_set;
43 __u32 flags;
44 __u16 proto_mask;
45 __u32 hashrnd;
46 __u32 hmodulus;
47 __u32 hoffset; /* Mark offset to start from */
48};
49
50#endif /* XT_HMARK_H_ */
diff --git a/include/linux/netfilter/xt_rpfilter.h b/include/linux/netfilter/xt_rpfilter.h
deleted file mode 100644
index 8358d4f71952..000000000000
--- a/include/linux/netfilter/xt_rpfilter.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _XT_RPATH_H
2#define _XT_RPATH_H
3
4#include <linux/types.h>
5
6enum {
7 XT_RPFILTER_LOOSE = 1 << 0,
8 XT_RPFILTER_VALID_MARK = 1 << 1,
9 XT_RPFILTER_ACCEPT_LOCAL = 1 << 2,
10 XT_RPFILTER_INVERT = 1 << 3,
11#ifdef __KERNEL__
12 XT_RPFILTER_OPTION_MASK = XT_RPFILTER_LOOSE |
13 XT_RPFILTER_VALID_MARK |
14 XT_RPFILTER_ACCEPT_LOCAL |
15 XT_RPFILTER_INVERT,
16#endif
17};
18
19struct xt_rpfilter_info {
20 __u8 flags;
21};
22
23#endif
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 6358da5eeee8..7a6c396a263b 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -46,6 +46,7 @@ struct netlink_kernel_cfg {
46 void (*input)(struct sk_buff *skb); 46 void (*input)(struct sk_buff *skb);
47 struct mutex *cb_mutex; 47 struct mutex *cb_mutex;
48 void (*bind)(int group); 48 void (*bind)(int group);
49 bool (*compare)(struct net *net, struct sock *sk);
49}; 50};
50 51
51extern struct sock *__netlink_kernel_create(struct net *net, int unit, 52extern struct sock *__netlink_kernel_create(struct net *net, int unit,
@@ -84,6 +85,22 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb,
84void netlink_detachskb(struct sock *sk, struct sk_buff *skb); 85void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
85int netlink_sendskb(struct sock *sk, struct sk_buff *skb); 86int netlink_sendskb(struct sock *sk, struct sk_buff *skb);
86 87
88static inline struct sk_buff *
89netlink_skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
90{
91 struct sk_buff *nskb;
92
93 nskb = skb_clone(skb, gfp_mask);
94 if (!nskb)
95 return NULL;
96
97 /* This is a large skb, set destructor callback to release head */
98 if (is_vmalloc_addr(skb->head))
99 nskb->destructor = skb->destructor;
100
101 return nskb;
102}
103
87/* 104/*
88 * skb should fit one page. This choice is good for headerless malloc. 105 * skb should fit one page. This choice is good for headerless malloc.
89 * But we should limit to 8K so that userspace does not have to 106 * But we should limit to 8K so that userspace does not have to
@@ -144,4 +161,14 @@ static inline int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
144 return __netlink_dump_start(ssk, skb, nlh, control); 161 return __netlink_dump_start(ssk, skb, nlh, control);
145} 162}
146 163
164struct netlink_tap {
165 struct net_device *dev;
166 struct module *module;
167 struct list_head list;
168};
169
170extern int netlink_add_tap(struct netlink_tap *nt);
171extern int __netlink_remove_tap(struct netlink_tap *nt);
172extern int netlink_remove_tap(struct netlink_tap *nt);
173
147#endif /* __LINUX_NETLINK_H */ 174#endif /* __LINUX_NETLINK_H */
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index fa2cb76a7029..f3c7c24bec1c 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -53,10 +53,10 @@ struct netpoll_info {
53}; 53};
54 54
55#ifdef CONFIG_NETPOLL 55#ifdef CONFIG_NETPOLL
56extern int netpoll_rx_disable(struct net_device *dev); 56extern void netpoll_rx_disable(struct net_device *dev);
57extern void netpoll_rx_enable(struct net_device *dev); 57extern void netpoll_rx_enable(struct net_device *dev);
58#else 58#else
59static inline int netpoll_rx_disable(struct net_device *dev) { return 0; } 59static inline void netpoll_rx_disable(struct net_device *dev) { return; }
60static inline void netpoll_rx_enable(struct net_device *dev) { return; } 60static inline void netpoll_rx_enable(struct net_device *dev) { return; }
61#endif 61#endif
62 62
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 7b8fc73810ad..e36dee52f224 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -32,6 +32,15 @@ struct nfs4_acl {
32 struct nfs4_ace aces[0]; 32 struct nfs4_ace aces[0];
33}; 33};
34 34
35#define NFS4_MAXLABELLEN 2048
36
37struct nfs4_label {
38 uint32_t lfs;
39 uint32_t pi;
40 u32 len;
41 char *label;
42};
43
35typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; 44typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier;
36 45
37struct nfs_stateid4 { 46struct nfs_stateid4 {
@@ -219,6 +228,14 @@ enum nfsstat4 {
219 NFS4ERR_REJECT_DELEG = 10085, /* on callback */ 228 NFS4ERR_REJECT_DELEG = 10085, /* on callback */
220 NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */ 229 NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */
221 NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */ 230 NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */
231
232 /* nfs42 */
233 NFS4ERR_PARTNER_NOTSUPP = 10088,
234 NFS4ERR_PARTNER_NO_AUTH = 10089,
235 NFS4ERR_METADATA_NOTSUPP = 10090,
236 NFS4ERR_OFFLOAD_DENIED = 10091,
237 NFS4ERR_WRONG_LFS = 10092,
238 NFS4ERR_BADLABEL = 10093,
222}; 239};
223 240
224static inline bool seqid_mutating_err(u32 err) 241static inline bool seqid_mutating_err(u32 err)
@@ -378,6 +395,7 @@ enum lock_type4 {
378#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) 395#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30)
379#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) 396#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)
380#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) 397#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4)
398#define FATTR4_WORD2_SECURITY_LABEL (1UL << 17)
381 399
382/* MDS threshold bitmap bits */ 400/* MDS threshold bitmap bits */
383#define THRESHOLD_RD (1UL << 0) 401#define THRESHOLD_RD (1UL << 0)
@@ -390,11 +408,15 @@ enum lock_type4 {
390#define NFS4_VERSION 4 408#define NFS4_VERSION 4
391#define NFS4_MINOR_VERSION 0 409#define NFS4_MINOR_VERSION 0
392 410
411#if defined(CONFIG_NFS_V4_2)
412#define NFS4_MAX_MINOR_VERSION 2
413#else
393#if defined(CONFIG_NFS_V4_1) 414#if defined(CONFIG_NFS_V4_1)
394#define NFS4_MAX_MINOR_VERSION 1 415#define NFS4_MAX_MINOR_VERSION 1
395#else 416#else
396#define NFS4_MAX_MINOR_VERSION 0 417#define NFS4_MAX_MINOR_VERSION 0
397#endif /* CONFIG_NFS_V4_1 */ 418#endif /* CONFIG_NFS_V4_1 */
419#endif /* CONFIG_NFS_V4_2 */
398 420
399#define NFS4_DEBUG 1 421#define NFS4_DEBUG 1
400 422
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index fc01d5cb4cf1..3ea4cde8701c 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -207,6 +207,7 @@ struct nfs_inode {
207#define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */ 207#define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */
208#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */ 208#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */
209#define NFS_INO_REVAL_FORCED 0x0040 /* force revalidation ignoring a delegation */ 209#define NFS_INO_REVAL_FORCED 0x0040 /* force revalidation ignoring a delegation */
210#define NFS_INO_INVALID_LABEL 0x0080 /* cached label is invalid */
210 211
211/* 212/*
212 * Bit offsets in flags field 213 * Bit offsets in flags field
@@ -336,7 +337,7 @@ extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping);
336extern void nfs_zap_caches(struct inode *); 337extern void nfs_zap_caches(struct inode *);
337extern void nfs_invalidate_atime(struct inode *); 338extern void nfs_invalidate_atime(struct inode *);
338extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, 339extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,
339 struct nfs_fattr *); 340 struct nfs_fattr *, struct nfs4_label *);
340extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); 341extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
341extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); 342extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr);
342extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); 343extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr);
@@ -347,15 +348,19 @@ extern int nfs_permission(struct inode *, int);
347extern int nfs_open(struct inode *, struct file *); 348extern int nfs_open(struct inode *, struct file *);
348extern int nfs_release(struct inode *, struct file *); 349extern int nfs_release(struct inode *, struct file *);
349extern int nfs_attribute_timeout(struct inode *inode); 350extern int nfs_attribute_timeout(struct inode *inode);
351extern int nfs_attribute_cache_expired(struct inode *inode);
350extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 352extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
351extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 353extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
352extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 354extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
353extern int nfs_setattr(struct dentry *, struct iattr *); 355extern int nfs_setattr(struct dentry *, struct iattr *);
354extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 356extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
357extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr,
358 struct nfs4_label *label);
355extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 359extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
356extern void put_nfs_open_context(struct nfs_open_context *ctx); 360extern void put_nfs_open_context(struct nfs_open_context *ctx);
357extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); 361extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode);
358extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode); 362extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode);
363extern void nfs_inode_attach_open_context(struct nfs_open_context *ctx);
359extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); 364extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
360extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx); 365extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx);
361extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); 366extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx);
@@ -468,7 +473,8 @@ extern const struct file_operations nfs_dir_operations;
468extern const struct dentry_operations nfs_dentry_operations; 473extern const struct dentry_operations nfs_dentry_operations;
469 474
470extern void nfs_force_lookup_revalidate(struct inode *dir); 475extern void nfs_force_lookup_revalidate(struct inode *dir);
471extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 476extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh,
477 struct nfs_fattr *fattr, struct nfs4_label *label);
472extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags); 478extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags);
473extern void nfs_access_zap_cache(struct inode *inode); 479extern void nfs_access_zap_cache(struct inode *inode);
474 480
@@ -497,9 +503,28 @@ extern int nfs_mountpoint_expiry_timeout;
497extern void nfs_release_automount_timer(void); 503extern void nfs_release_automount_timer(void);
498 504
499/* 505/*
506 * linux/fs/nfs/nfs4proc.c
507 */
508#ifdef CONFIG_NFS_V4_SECURITY_LABEL
509extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags);
510static inline void nfs4_label_free(struct nfs4_label *label)
511{
512 if (label) {
513 kfree(label->label);
514 kfree(label);
515 }
516 return;
517}
518#else
519static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; }
520static inline void nfs4_label_free(void *label) {}
521#endif
522
523/*
500 * linux/fs/nfs/unlink.c 524 * linux/fs/nfs/unlink.c
501 */ 525 */
502extern void nfs_complete_unlink(struct dentry *dentry, struct inode *); 526extern void nfs_complete_unlink(struct dentry *dentry, struct inode *);
527extern void nfs_wait_on_sillyrename(struct dentry *dentry);
503extern void nfs_block_sillyrename(struct dentry *dentry); 528extern void nfs_block_sillyrename(struct dentry *dentry);
504extern void nfs_unblock_sillyrename(struct dentry *dentry); 529extern void nfs_unblock_sillyrename(struct dentry *dentry);
505extern int nfs_sillyrename(struct inode *dir, struct dentry *dentry); 530extern int nfs_sillyrename(struct inode *dir, struct dentry *dentry);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 3b7fa2abecca..b8cedced50c9 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -56,6 +56,7 @@ struct nfs_client {
56 struct rpc_cred *cl_machine_cred; 56 struct rpc_cred *cl_machine_cred;
57 57
58#if IS_ENABLED(CONFIG_NFS_V4) 58#if IS_ENABLED(CONFIG_NFS_V4)
59 struct list_head cl_ds_clients; /* auth flavor data servers */
59 u64 cl_clientid; /* constant */ 60 u64 cl_clientid; /* constant */
60 nfs4_verifier cl_confirm; /* Clientid verifier */ 61 nfs4_verifier cl_confirm; /* Clientid verifier */
61 unsigned long cl_state; 62 unsigned long cl_state;
@@ -78,6 +79,9 @@ struct nfs_client {
78 u32 cl_cb_ident; /* v4.0 callback identifier */ 79 u32 cl_cb_ident; /* v4.0 callback identifier */
79 const struct nfs4_minor_version_ops *cl_mvops; 80 const struct nfs4_minor_version_ops *cl_mvops;
80 81
82 /* NFSv4.0 transport blocking */
83 struct nfs4_slot_table *cl_slot_tbl;
84
81 /* The sequence id to use for the next CREATE_SESSION */ 85 /* The sequence id to use for the next CREATE_SESSION */
82 u32 cl_seqid; 86 u32 cl_seqid;
83 /* The flags used for obtaining the clientid during EXCHANGE_ID */ 87 /* The flags used for obtaining the clientid during EXCHANGE_ID */
@@ -87,6 +91,15 @@ struct nfs_client {
87 struct nfs41_server_owner *cl_serverowner; 91 struct nfs41_server_owner *cl_serverowner;
88 struct nfs41_server_scope *cl_serverscope; 92 struct nfs41_server_scope *cl_serverscope;
89 struct nfs41_impl_id *cl_implid; 93 struct nfs41_impl_id *cl_implid;
94 /* nfs 4.1+ state protection modes: */
95 unsigned long cl_sp4_flags;
96#define NFS_SP4_MACH_CRED_MINIMAL 1 /* Minimal sp4_mach_cred - state ops
97 * must use machine cred */
98#define NFS_SP4_MACH_CRED_CLEANUP 2 /* CLOSE and LOCKU */
99#define NFS_SP4_MACH_CRED_SECINFO 3 /* SECINFO and SECINFO_NO_NAME */
100#define NFS_SP4_MACH_CRED_STATEID 4 /* TEST_STATEID and FREE_STATEID */
101#define NFS_SP4_MACH_CRED_WRITE 5 /* WRITE */
102#define NFS_SP4_MACH_CRED_COMMIT 6 /* COMMIT */
90#endif /* CONFIG_NFS_V4 */ 103#endif /* CONFIG_NFS_V4 */
91 104
92#ifdef CONFIG_NFS_FSCACHE 105#ifdef CONFIG_NFS_FSCACHE
@@ -146,7 +159,12 @@ struct nfs_server {
146 u32 attr_bitmask[3];/* V4 bitmask representing the set 159 u32 attr_bitmask[3];/* V4 bitmask representing the set
147 of attributes supported on this 160 of attributes supported on this
148 filesystem */ 161 filesystem */
149 u32 cache_consistency_bitmask[2]; 162 u32 attr_bitmask_nl[3];
163 /* V4 bitmask representing the
164 set of attributes supported
165 on this filesystem excluding
166 the label support bit. */
167 u32 cache_consistency_bitmask[3];
150 /* V4 bitmask representing the subset 168 /* V4 bitmask representing the subset
151 of change attribute, size, ctime 169 of change attribute, size, ctime
152 and mtime attributes supported by 170 and mtime attributes supported by
@@ -200,5 +218,6 @@ struct nfs_server {
200#define NFS_CAP_UIDGID_NOMAP (1U << 15) 218#define NFS_CAP_UIDGID_NOMAP (1U << 15)
201#define NFS_CAP_STATEID_NFSV41 (1U << 16) 219#define NFS_CAP_STATEID_NFSV41 (1U << 16)
202#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17) 220#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17)
221#define NFS_CAP_SECURITY_LABEL (1U << 18)
203 222
204#endif 223#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 104b62f23ee0..49f52c8f4422 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -101,6 +101,7 @@ struct nfs_fattr {
101#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22) 101#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
102#define NFS_ATTR_FATTR_OWNER_NAME (1U << 23) 102#define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
103#define NFS_ATTR_FATTR_GROUP_NAME (1U << 24) 103#define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
104#define NFS_ATTR_FATTR_V4_SECURITY_LABEL (1U << 25)
104 105
105#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ 106#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
106 | NFS_ATTR_FATTR_MODE \ 107 | NFS_ATTR_FATTR_MODE \
@@ -120,7 +121,8 @@ struct nfs_fattr {
120#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \ 121#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
121 | NFS_ATTR_FATTR_SPACE_USED) 122 | NFS_ATTR_FATTR_SPACE_USED)
122#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \ 123#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
123 | NFS_ATTR_FATTR_SPACE_USED) 124 | NFS_ATTR_FATTR_SPACE_USED \
125 | NFS_ATTR_FATTR_V4_SECURITY_LABEL)
124 126
125/* 127/*
126 * Info on the file system 128 * Info on the file system
@@ -246,6 +248,7 @@ struct nfs4_layoutget_res {
246struct nfs4_layoutget { 248struct nfs4_layoutget {
247 struct nfs4_layoutget_args args; 249 struct nfs4_layoutget_args args;
248 struct nfs4_layoutget_res res; 250 struct nfs4_layoutget_res res;
251 struct rpc_cred *cred;
249 gfp_t gfp_flags; 252 gfp_t gfp_flags;
250}; 253};
251 254
@@ -347,6 +350,7 @@ struct nfs_openargs {
347 const u32 * open_bitmap; 350 const u32 * open_bitmap;
348 __u32 claim; 351 __u32 claim;
349 enum createmode4 createmode; 352 enum createmode4 createmode;
353 const struct nfs4_label *label;
350}; 354};
351 355
352struct nfs_openres { 356struct nfs_openres {
@@ -356,6 +360,7 @@ struct nfs_openres {
356 struct nfs4_change_info cinfo; 360 struct nfs4_change_info cinfo;
357 __u32 rflags; 361 __u32 rflags;
358 struct nfs_fattr * f_attr; 362 struct nfs_fattr * f_attr;
363 struct nfs4_label *f_label;
359 struct nfs_seqid * seqid; 364 struct nfs_seqid * seqid;
360 const struct nfs_server *server; 365 const struct nfs_server *server;
361 fmode_t delegation_type; 366 fmode_t delegation_type;
@@ -598,6 +603,7 @@ struct nfs_entry {
598 int eof; 603 int eof;
599 struct nfs_fh * fh; 604 struct nfs_fh * fh;
600 struct nfs_fattr * fattr; 605 struct nfs_fattr * fattr;
606 struct nfs4_label *label;
601 unsigned char d_type; 607 unsigned char d_type;
602 struct nfs_server * server; 608 struct nfs_server * server;
603}; 609};
@@ -630,6 +636,7 @@ struct nfs_setattrargs {
630 struct iattr * iap; 636 struct iattr * iap;
631 const struct nfs_server * server; /* Needed for name mapping */ 637 const struct nfs_server * server; /* Needed for name mapping */
632 const u32 * bitmask; 638 const u32 * bitmask;
639 const struct nfs4_label *label;
633}; 640};
634 641
635struct nfs_setaclargs { 642struct nfs_setaclargs {
@@ -665,6 +672,7 @@ struct nfs_getaclres {
665struct nfs_setattrres { 672struct nfs_setattrres {
666 struct nfs4_sequence_res seq_res; 673 struct nfs4_sequence_res seq_res;
667 struct nfs_fattr * fattr; 674 struct nfs_fattr * fattr;
675 struct nfs4_label *label;
668 const struct nfs_server * server; 676 const struct nfs_server * server;
669}; 677};
670 678
@@ -862,6 +870,7 @@ struct nfs4_create_arg {
862 const struct iattr * attrs; 870 const struct iattr * attrs;
863 const struct nfs_fh * dir_fh; 871 const struct nfs_fh * dir_fh;
864 const u32 * bitmask; 872 const u32 * bitmask;
873 const struct nfs4_label *label;
865}; 874};
866 875
867struct nfs4_create_res { 876struct nfs4_create_res {
@@ -869,6 +878,7 @@ struct nfs4_create_res {
869 const struct nfs_server * server; 878 const struct nfs_server * server;
870 struct nfs_fh * fh; 879 struct nfs_fh * fh;
871 struct nfs_fattr * fattr; 880 struct nfs_fattr * fattr;
881 struct nfs4_label *label;
872 struct nfs4_change_info dir_cinfo; 882 struct nfs4_change_info dir_cinfo;
873}; 883};
874 884
@@ -893,6 +903,7 @@ struct nfs4_getattr_res {
893 struct nfs4_sequence_res seq_res; 903 struct nfs4_sequence_res seq_res;
894 const struct nfs_server * server; 904 const struct nfs_server * server;
895 struct nfs_fattr * fattr; 905 struct nfs_fattr * fattr;
906 struct nfs4_label *label;
896}; 907};
897 908
898struct nfs4_link_arg { 909struct nfs4_link_arg {
@@ -907,6 +918,7 @@ struct nfs4_link_res {
907 struct nfs4_sequence_res seq_res; 918 struct nfs4_sequence_res seq_res;
908 const struct nfs_server * server; 919 const struct nfs_server * server;
909 struct nfs_fattr * fattr; 920 struct nfs_fattr * fattr;
921 struct nfs4_label *label;
910 struct nfs4_change_info cinfo; 922 struct nfs4_change_info cinfo;
911 struct nfs_fattr * dir_attr; 923 struct nfs_fattr * dir_attr;
912}; 924};
@@ -924,6 +936,7 @@ struct nfs4_lookup_res {
924 const struct nfs_server * server; 936 const struct nfs_server * server;
925 struct nfs_fattr * fattr; 937 struct nfs_fattr * fattr;
926 struct nfs_fh * fh; 938 struct nfs_fh * fh;
939 struct nfs4_label *label;
927}; 940};
928 941
929struct nfs4_lookup_root_arg { 942struct nfs4_lookup_root_arg {
@@ -1094,6 +1107,23 @@ struct pnfs_ds_commit_info {
1094 struct pnfs_commit_bucket *buckets; 1107 struct pnfs_commit_bucket *buckets;
1095}; 1108};
1096 1109
1110#define NFS4_OP_MAP_NUM_LONGS \
1111 DIV_ROUND_UP(LAST_NFS4_OP, 8 * sizeof(unsigned long))
1112#define NFS4_OP_MAP_NUM_WORDS \
1113 (NFS4_OP_MAP_NUM_LONGS * sizeof(unsigned long) / sizeof(u32))
1114struct nfs4_op_map {
1115 union {
1116 unsigned long longs[NFS4_OP_MAP_NUM_LONGS];
1117 u32 words[NFS4_OP_MAP_NUM_WORDS];
1118 } u;
1119};
1120
1121struct nfs41_state_protection {
1122 u32 how;
1123 struct nfs4_op_map enforce;
1124 struct nfs4_op_map allow;
1125};
1126
1097#define NFS4_EXCHANGE_ID_LEN (48) 1127#define NFS4_EXCHANGE_ID_LEN (48)
1098struct nfs41_exchange_id_args { 1128struct nfs41_exchange_id_args {
1099 struct nfs_client *client; 1129 struct nfs_client *client;
@@ -1101,6 +1131,7 @@ struct nfs41_exchange_id_args {
1101 unsigned int id_len; 1131 unsigned int id_len;
1102 char id[NFS4_EXCHANGE_ID_LEN]; 1132 char id[NFS4_EXCHANGE_ID_LEN];
1103 u32 flags; 1133 u32 flags;
1134 struct nfs41_state_protection state_protect;
1104}; 1135};
1105 1136
1106struct nfs41_server_owner { 1137struct nfs41_server_owner {
@@ -1133,6 +1164,7 @@ struct nfs41_exchange_id_res {
1133 struct nfs41_server_owner *server_owner; 1164 struct nfs41_server_owner *server_owner;
1134 struct nfs41_server_scope *server_scope; 1165 struct nfs41_server_scope *server_scope;
1135 struct nfs41_impl_id *impl_id; 1166 struct nfs41_impl_id *impl_id;
1167 struct nfs41_state_protection state_protect;
1136}; 1168};
1137 1169
1138struct nfs41_create_session_args { 1170struct nfs41_create_session_args {
@@ -1366,11 +1398,12 @@ struct nfs_rpc_ops {
1366 struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *, 1398 struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *,
1367 struct nfs_subversion *); 1399 struct nfs_subversion *);
1368 int (*getattr) (struct nfs_server *, struct nfs_fh *, 1400 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1369 struct nfs_fattr *); 1401 struct nfs_fattr *, struct nfs4_label *);
1370 int (*setattr) (struct dentry *, struct nfs_fattr *, 1402 int (*setattr) (struct dentry *, struct nfs_fattr *,
1371 struct iattr *); 1403 struct iattr *);
1372 int (*lookup) (struct inode *, struct qstr *, 1404 int (*lookup) (struct inode *, struct qstr *,
1373 struct nfs_fh *, struct nfs_fattr *); 1405 struct nfs_fh *, struct nfs_fattr *,
1406 struct nfs4_label *);
1374 int (*access) (struct inode *, struct nfs_access_entry *); 1407 int (*access) (struct inode *, struct nfs_access_entry *);
1375 int (*readlink)(struct inode *, struct page *, unsigned int, 1408 int (*readlink)(struct inode *, struct page *, unsigned int,
1376 unsigned int); 1409 unsigned int);
@@ -1405,12 +1438,12 @@ struct nfs_rpc_ops {
1405 void (*read_setup) (struct nfs_read_data *, struct rpc_message *); 1438 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
1406 void (*read_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, 1439 void (*read_pageio_init)(struct nfs_pageio_descriptor *, struct inode *,
1407 const struct nfs_pgio_completion_ops *); 1440 const struct nfs_pgio_completion_ops *);
1408 void (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *); 1441 int (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *);
1409 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 1442 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
1410 void (*write_setup) (struct nfs_write_data *, struct rpc_message *); 1443 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
1411 void (*write_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, int, 1444 void (*write_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, int,
1412 const struct nfs_pgio_completion_ops *); 1445 const struct nfs_pgio_completion_ops *);
1413 void (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *); 1446 int (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *);
1414 int (*write_done) (struct rpc_task *, struct nfs_write_data *); 1447 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
1415 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *); 1448 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
1416 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *); 1449 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
@@ -1422,13 +1455,14 @@ struct nfs_rpc_ops {
1422 struct inode * (*open_context) (struct inode *dir, 1455 struct inode * (*open_context) (struct inode *dir,
1423 struct nfs_open_context *ctx, 1456 struct nfs_open_context *ctx,
1424 int open_flags, 1457 int open_flags,
1425 struct iattr *iattr); 1458 struct iattr *iattr,
1459 int *);
1426 int (*have_delegation)(struct inode *, fmode_t); 1460 int (*have_delegation)(struct inode *, fmode_t);
1427 int (*return_delegation)(struct inode *); 1461 int (*return_delegation)(struct inode *);
1428 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *); 1462 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);
1429 struct nfs_client * 1463 struct nfs_client *
1430 (*init_client) (struct nfs_client *, const struct rpc_timeout *, 1464 (*init_client) (struct nfs_client *, const struct rpc_timeout *,
1431 const char *, rpc_authflavor_t); 1465 const char *);
1432 void (*free_client) (struct nfs_client *); 1466 void (*free_client) (struct nfs_client *);
1433 struct nfs_server *(*create_server)(struct nfs_mount_info *, struct nfs_subversion *); 1467 struct nfs_server *(*create_server)(struct nfs_mount_info *, struct nfs_subversion *);
1434 struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *, 1468 struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index db50840e6355..6a45fb583ff1 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -46,7 +46,7 @@ static inline bool trigger_all_cpu_backtrace(void)
46#ifdef CONFIG_LOCKUP_DETECTOR 46#ifdef CONFIG_LOCKUP_DETECTOR
47int hw_nmi_is_cpu_stuck(struct pt_regs *); 47int hw_nmi_is_cpu_stuck(struct pt_regs *);
48u64 hw_nmi_get_sample_period(int watchdog_thresh); 48u64 hw_nmi_get_sample_period(int watchdog_thresh);
49extern int watchdog_enabled; 49extern int watchdog_user_enabled;
50extern int watchdog_thresh; 50extern int watchdog_thresh;
51struct ctl_table; 51struct ctl_table;
52extern int proc_dowatchdog(struct ctl_table *, int , 52extern int proc_dowatchdog(struct ctl_table *, int ,
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 4e2cbfa640b7..58b9a02c38d2 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -98,8 +98,17 @@
98typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; 98typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;
99extern nodemask_t _unused_nodemask_arg_; 99extern nodemask_t _unused_nodemask_arg_;
100 100
101/*
102 * The inline keyword gives the compiler room to decide to inline, or
103 * not inline a function as it sees best. However, as these functions
104 * are called in both __init and non-__init functions, if they are not
105 * inlined we will end up with a section mis-match error (of the type of
106 * freeable items not being freed). So we must use __always_inline here
107 * to fix the problem. If other functions in the future also end up in
108 * this situation they will also need to be annotated as __always_inline
109 */
101#define node_set(node, dst) __node_set((node), &(dst)) 110#define node_set(node, dst) __node_set((node), &(dst))
102static inline void __node_set(int node, volatile nodemask_t *dstp) 111static __always_inline void __node_set(int node, volatile nodemask_t *dstp)
103{ 112{
104 set_bit(node, dstp->bits); 113 set_bit(node, dstp->bits);
105} 114}
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index 10e5947491c7..b4ec59d159ac 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -14,6 +14,10 @@ struct fs_struct;
14 * A structure to contain pointers to all per-process 14 * A structure to contain pointers to all per-process
15 * namespaces - fs (mount), uts, network, sysvipc, etc. 15 * namespaces - fs (mount), uts, network, sysvipc, etc.
16 * 16 *
17 * The pid namespace is an exception -- it's accessed using
18 * task_active_pid_ns. The pid namespace here is the
19 * namespace that children will use.
20 *
17 * 'count' is the number of tasks holding a reference. 21 * 'count' is the number of tasks holding a reference.
18 * The count for each namespace, then, will be the number 22 * The count for each namespace, then, will be the number
19 * of nsproxies pointing to it, not the number of tasks. 23 * of nsproxies pointing to it, not the number of tasks.
@@ -27,7 +31,7 @@ struct nsproxy {
27 struct uts_namespace *uts_ns; 31 struct uts_namespace *uts_ns;
28 struct ipc_namespace *ipc_ns; 32 struct ipc_namespace *ipc_ns;
29 struct mnt_namespace *mnt_ns; 33 struct mnt_namespace *mnt_ns;
30 struct pid_namespace *pid_ns; 34 struct pid_namespace *pid_ns_for_children;
31 struct net *net_ns; 35 struct net *net_ns;
32}; 36};
33extern struct nsproxy init_nsproxy; 37extern struct nsproxy init_nsproxy;
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index f451c8d6e231..26ebcf41c213 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Definitions for the NVM Express interface 2 * Definitions for the NVM Express interface
3 * Copyright (c) 2011, Intel Corporation. 3 * Copyright (c) 2011-2013, Intel Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License, 6 * under the terms and conditions of the GNU General Public License,
@@ -19,7 +19,10 @@
19#ifndef _LINUX_NVME_H 19#ifndef _LINUX_NVME_H
20#define _LINUX_NVME_H 20#define _LINUX_NVME_H
21 21
22#include <linux/types.h> 22#include <uapi/linux/nvme.h>
23#include <linux/pci.h>
24#include <linux/miscdevice.h>
25#include <linux/kref.h>
23 26
24struct nvme_bar { 27struct nvme_bar {
25 __u64 cap; /* Controller Capabilities */ 28 __u64 cap; /* Controller Capabilities */
@@ -50,6 +53,7 @@ enum {
50 NVME_CC_SHN_NONE = 0 << 14, 53 NVME_CC_SHN_NONE = 0 << 14,
51 NVME_CC_SHN_NORMAL = 1 << 14, 54 NVME_CC_SHN_NORMAL = 1 << 14,
52 NVME_CC_SHN_ABRUPT = 2 << 14, 55 NVME_CC_SHN_ABRUPT = 2 << 14,
56 NVME_CC_SHN_MASK = 3 << 14,
53 NVME_CC_IOSQES = 6 << 16, 57 NVME_CC_IOSQES = 6 << 16,
54 NVME_CC_IOCQES = 4 << 20, 58 NVME_CC_IOCQES = 4 << 20,
55 NVME_CSTS_RDY = 1 << 0, 59 NVME_CSTS_RDY = 1 << 0,
@@ -57,462 +61,11 @@ enum {
57 NVME_CSTS_SHST_NORMAL = 0 << 2, 61 NVME_CSTS_SHST_NORMAL = 0 << 2,
58 NVME_CSTS_SHST_OCCUR = 1 << 2, 62 NVME_CSTS_SHST_OCCUR = 1 << 2,
59 NVME_CSTS_SHST_CMPLT = 2 << 2, 63 NVME_CSTS_SHST_CMPLT = 2 << 2,
60}; 64 NVME_CSTS_SHST_MASK = 3 << 2,
61
62struct nvme_id_power_state {
63 __le16 max_power; /* centiwatts */
64 __u16 rsvd2;
65 __le32 entry_lat; /* microseconds */
66 __le32 exit_lat; /* microseconds */
67 __u8 read_tput;
68 __u8 read_lat;
69 __u8 write_tput;
70 __u8 write_lat;
71 __u8 rsvd16[16];
72}; 65};
73 66
74#define NVME_VS(major, minor) (major << 16 | minor) 67#define NVME_VS(major, minor) (major << 16 | minor)
75 68
76struct nvme_id_ctrl {
77 __le16 vid;
78 __le16 ssvid;
79 char sn[20];
80 char mn[40];
81 char fr[8];
82 __u8 rab;
83 __u8 ieee[3];
84 __u8 mic;
85 __u8 mdts;
86 __u8 rsvd78[178];
87 __le16 oacs;
88 __u8 acl;
89 __u8 aerl;
90 __u8 frmw;
91 __u8 lpa;
92 __u8 elpe;
93 __u8 npss;
94 __u8 rsvd264[248];
95 __u8 sqes;
96 __u8 cqes;
97 __u8 rsvd514[2];
98 __le32 nn;
99 __le16 oncs;
100 __le16 fuses;
101 __u8 fna;
102 __u8 vwc;
103 __le16 awun;
104 __le16 awupf;
105 __u8 rsvd530[1518];
106 struct nvme_id_power_state psd[32];
107 __u8 vs[1024];
108};
109
110enum {
111 NVME_CTRL_ONCS_COMPARE = 1 << 0,
112 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1,
113 NVME_CTRL_ONCS_DSM = 1 << 2,
114};
115
116struct nvme_lbaf {
117 __le16 ms;
118 __u8 ds;
119 __u8 rp;
120};
121
122struct nvme_id_ns {
123 __le64 nsze;
124 __le64 ncap;
125 __le64 nuse;
126 __u8 nsfeat;
127 __u8 nlbaf;
128 __u8 flbas;
129 __u8 mc;
130 __u8 dpc;
131 __u8 dps;
132 __u8 rsvd30[98];
133 struct nvme_lbaf lbaf[16];
134 __u8 rsvd192[192];
135 __u8 vs[3712];
136};
137
138enum {
139 NVME_NS_FEAT_THIN = 1 << 0,
140 NVME_LBAF_RP_BEST = 0,
141 NVME_LBAF_RP_BETTER = 1,
142 NVME_LBAF_RP_GOOD = 2,
143 NVME_LBAF_RP_DEGRADED = 3,
144};
145
146struct nvme_smart_log {
147 __u8 critical_warning;
148 __u8 temperature[2];
149 __u8 avail_spare;
150 __u8 spare_thresh;
151 __u8 percent_used;
152 __u8 rsvd6[26];
153 __u8 data_units_read[16];
154 __u8 data_units_written[16];
155 __u8 host_reads[16];
156 __u8 host_writes[16];
157 __u8 ctrl_busy_time[16];
158 __u8 power_cycles[16];
159 __u8 power_on_hours[16];
160 __u8 unsafe_shutdowns[16];
161 __u8 media_errors[16];
162 __u8 num_err_log_entries[16];
163 __u8 rsvd192[320];
164};
165
166enum {
167 NVME_SMART_CRIT_SPARE = 1 << 0,
168 NVME_SMART_CRIT_TEMPERATURE = 1 << 1,
169 NVME_SMART_CRIT_RELIABILITY = 1 << 2,
170 NVME_SMART_CRIT_MEDIA = 1 << 3,
171 NVME_SMART_CRIT_VOLATILE_MEMORY = 1 << 4,
172};
173
174struct nvme_lba_range_type {
175 __u8 type;
176 __u8 attributes;
177 __u8 rsvd2[14];
178 __u64 slba;
179 __u64 nlb;
180 __u8 guid[16];
181 __u8 rsvd48[16];
182};
183
184enum {
185 NVME_LBART_TYPE_FS = 0x01,
186 NVME_LBART_TYPE_RAID = 0x02,
187 NVME_LBART_TYPE_CACHE = 0x03,
188 NVME_LBART_TYPE_SWAP = 0x04,
189
190 NVME_LBART_ATTRIB_TEMP = 1 << 0,
191 NVME_LBART_ATTRIB_HIDE = 1 << 1,
192};
193
194/* I/O commands */
195
196enum nvme_opcode {
197 nvme_cmd_flush = 0x00,
198 nvme_cmd_write = 0x01,
199 nvme_cmd_read = 0x02,
200 nvme_cmd_write_uncor = 0x04,
201 nvme_cmd_compare = 0x05,
202 nvme_cmd_dsm = 0x09,
203};
204
205struct nvme_common_command {
206 __u8 opcode;
207 __u8 flags;
208 __u16 command_id;
209 __le32 nsid;
210 __le32 cdw2[2];
211 __le64 metadata;
212 __le64 prp1;
213 __le64 prp2;
214 __le32 cdw10[6];
215};
216
217struct nvme_rw_command {
218 __u8 opcode;
219 __u8 flags;
220 __u16 command_id;
221 __le32 nsid;
222 __u64 rsvd2;
223 __le64 metadata;
224 __le64 prp1;
225 __le64 prp2;
226 __le64 slba;
227 __le16 length;
228 __le16 control;
229 __le32 dsmgmt;
230 __le32 reftag;
231 __le16 apptag;
232 __le16 appmask;
233};
234
235enum {
236 NVME_RW_LR = 1 << 15,
237 NVME_RW_FUA = 1 << 14,
238 NVME_RW_DSM_FREQ_UNSPEC = 0,
239 NVME_RW_DSM_FREQ_TYPICAL = 1,
240 NVME_RW_DSM_FREQ_RARE = 2,
241 NVME_RW_DSM_FREQ_READS = 3,
242 NVME_RW_DSM_FREQ_WRITES = 4,
243 NVME_RW_DSM_FREQ_RW = 5,
244 NVME_RW_DSM_FREQ_ONCE = 6,
245 NVME_RW_DSM_FREQ_PREFETCH = 7,
246 NVME_RW_DSM_FREQ_TEMP = 8,
247 NVME_RW_DSM_LATENCY_NONE = 0 << 4,
248 NVME_RW_DSM_LATENCY_IDLE = 1 << 4,
249 NVME_RW_DSM_LATENCY_NORM = 2 << 4,
250 NVME_RW_DSM_LATENCY_LOW = 3 << 4,
251 NVME_RW_DSM_SEQ_REQ = 1 << 6,
252 NVME_RW_DSM_COMPRESSED = 1 << 7,
253};
254
255struct nvme_dsm_cmd {
256 __u8 opcode;
257 __u8 flags;
258 __u16 command_id;
259 __le32 nsid;
260 __u64 rsvd2[2];
261 __le64 prp1;
262 __le64 prp2;
263 __le32 nr;
264 __le32 attributes;
265 __u32 rsvd12[4];
266};
267
268enum {
269 NVME_DSMGMT_IDR = 1 << 0,
270 NVME_DSMGMT_IDW = 1 << 1,
271 NVME_DSMGMT_AD = 1 << 2,
272};
273
274struct nvme_dsm_range {
275 __le32 cattr;
276 __le32 nlb;
277 __le64 slba;
278};
279
280/* Admin commands */
281
282enum nvme_admin_opcode {
283 nvme_admin_delete_sq = 0x00,
284 nvme_admin_create_sq = 0x01,
285 nvme_admin_get_log_page = 0x02,
286 nvme_admin_delete_cq = 0x04,
287 nvme_admin_create_cq = 0x05,
288 nvme_admin_identify = 0x06,
289 nvme_admin_abort_cmd = 0x08,
290 nvme_admin_set_features = 0x09,
291 nvme_admin_get_features = 0x0a,
292 nvme_admin_async_event = 0x0c,
293 nvme_admin_activate_fw = 0x10,
294 nvme_admin_download_fw = 0x11,
295 nvme_admin_format_nvm = 0x80,
296 nvme_admin_security_send = 0x81,
297 nvme_admin_security_recv = 0x82,
298};
299
300enum {
301 NVME_QUEUE_PHYS_CONTIG = (1 << 0),
302 NVME_CQ_IRQ_ENABLED = (1 << 1),
303 NVME_SQ_PRIO_URGENT = (0 << 1),
304 NVME_SQ_PRIO_HIGH = (1 << 1),
305 NVME_SQ_PRIO_MEDIUM = (2 << 1),
306 NVME_SQ_PRIO_LOW = (3 << 1),
307 NVME_FEAT_ARBITRATION = 0x01,
308 NVME_FEAT_POWER_MGMT = 0x02,
309 NVME_FEAT_LBA_RANGE = 0x03,
310 NVME_FEAT_TEMP_THRESH = 0x04,
311 NVME_FEAT_ERR_RECOVERY = 0x05,
312 NVME_FEAT_VOLATILE_WC = 0x06,
313 NVME_FEAT_NUM_QUEUES = 0x07,
314 NVME_FEAT_IRQ_COALESCE = 0x08,
315 NVME_FEAT_IRQ_CONFIG = 0x09,
316 NVME_FEAT_WRITE_ATOMIC = 0x0a,
317 NVME_FEAT_ASYNC_EVENT = 0x0b,
318 NVME_FEAT_SW_PROGRESS = 0x0c,
319 NVME_FWACT_REPL = (0 << 3),
320 NVME_FWACT_REPL_ACTV = (1 << 3),
321 NVME_FWACT_ACTV = (2 << 3),
322};
323
324struct nvme_identify {
325 __u8 opcode;
326 __u8 flags;
327 __u16 command_id;
328 __le32 nsid;
329 __u64 rsvd2[2];
330 __le64 prp1;
331 __le64 prp2;
332 __le32 cns;
333 __u32 rsvd11[5];
334};
335
336struct nvme_features {
337 __u8 opcode;
338 __u8 flags;
339 __u16 command_id;
340 __le32 nsid;
341 __u64 rsvd2[2];
342 __le64 prp1;
343 __le64 prp2;
344 __le32 fid;
345 __le32 dword11;
346 __u32 rsvd12[4];
347};
348
349struct nvme_create_cq {
350 __u8 opcode;
351 __u8 flags;
352 __u16 command_id;
353 __u32 rsvd1[5];
354 __le64 prp1;
355 __u64 rsvd8;
356 __le16 cqid;
357 __le16 qsize;
358 __le16 cq_flags;
359 __le16 irq_vector;
360 __u32 rsvd12[4];
361};
362
363struct nvme_create_sq {
364 __u8 opcode;
365 __u8 flags;
366 __u16 command_id;
367 __u32 rsvd1[5];
368 __le64 prp1;
369 __u64 rsvd8;
370 __le16 sqid;
371 __le16 qsize;
372 __le16 sq_flags;
373 __le16 cqid;
374 __u32 rsvd12[4];
375};
376
377struct nvme_delete_queue {
378 __u8 opcode;
379 __u8 flags;
380 __u16 command_id;
381 __u32 rsvd1[9];
382 __le16 qid;
383 __u16 rsvd10;
384 __u32 rsvd11[5];
385};
386
387struct nvme_download_firmware {
388 __u8 opcode;
389 __u8 flags;
390 __u16 command_id;
391 __u32 rsvd1[5];
392 __le64 prp1;
393 __le64 prp2;
394 __le32 numd;
395 __le32 offset;
396 __u32 rsvd12[4];
397};
398
399struct nvme_format_cmd {
400 __u8 opcode;
401 __u8 flags;
402 __u16 command_id;
403 __le32 nsid;
404 __u64 rsvd2[4];
405 __le32 cdw10;
406 __u32 rsvd11[5];
407};
408
409struct nvme_command {
410 union {
411 struct nvme_common_command common;
412 struct nvme_rw_command rw;
413 struct nvme_identify identify;
414 struct nvme_features features;
415 struct nvme_create_cq create_cq;
416 struct nvme_create_sq create_sq;
417 struct nvme_delete_queue delete_queue;
418 struct nvme_download_firmware dlfw;
419 struct nvme_format_cmd format;
420 struct nvme_dsm_cmd dsm;
421 };
422};
423
424enum {
425 NVME_SC_SUCCESS = 0x0,
426 NVME_SC_INVALID_OPCODE = 0x1,
427 NVME_SC_INVALID_FIELD = 0x2,
428 NVME_SC_CMDID_CONFLICT = 0x3,
429 NVME_SC_DATA_XFER_ERROR = 0x4,
430 NVME_SC_POWER_LOSS = 0x5,
431 NVME_SC_INTERNAL = 0x6,
432 NVME_SC_ABORT_REQ = 0x7,
433 NVME_SC_ABORT_QUEUE = 0x8,
434 NVME_SC_FUSED_FAIL = 0x9,
435 NVME_SC_FUSED_MISSING = 0xa,
436 NVME_SC_INVALID_NS = 0xb,
437 NVME_SC_CMD_SEQ_ERROR = 0xc,
438 NVME_SC_LBA_RANGE = 0x80,
439 NVME_SC_CAP_EXCEEDED = 0x81,
440 NVME_SC_NS_NOT_READY = 0x82,
441 NVME_SC_CQ_INVALID = 0x100,
442 NVME_SC_QID_INVALID = 0x101,
443 NVME_SC_QUEUE_SIZE = 0x102,
444 NVME_SC_ABORT_LIMIT = 0x103,
445 NVME_SC_ABORT_MISSING = 0x104,
446 NVME_SC_ASYNC_LIMIT = 0x105,
447 NVME_SC_FIRMWARE_SLOT = 0x106,
448 NVME_SC_FIRMWARE_IMAGE = 0x107,
449 NVME_SC_INVALID_VECTOR = 0x108,
450 NVME_SC_INVALID_LOG_PAGE = 0x109,
451 NVME_SC_INVALID_FORMAT = 0x10a,
452 NVME_SC_BAD_ATTRIBUTES = 0x180,
453 NVME_SC_WRITE_FAULT = 0x280,
454 NVME_SC_READ_ERROR = 0x281,
455 NVME_SC_GUARD_CHECK = 0x282,
456 NVME_SC_APPTAG_CHECK = 0x283,
457 NVME_SC_REFTAG_CHECK = 0x284,
458 NVME_SC_COMPARE_FAILED = 0x285,
459 NVME_SC_ACCESS_DENIED = 0x286,
460};
461
462struct nvme_completion {
463 __le32 result; /* Used by admin commands to return data */
464 __u32 rsvd;
465 __le16 sq_head; /* how much of this queue may be reclaimed */
466 __le16 sq_id; /* submission queue that generated this entry */
467 __u16 command_id; /* of the command which completed */
468 __le16 status; /* did the command fail, and if so, why? */
469};
470
471struct nvme_user_io {
472 __u8 opcode;
473 __u8 flags;
474 __u16 control;
475 __u16 nblocks;
476 __u16 rsvd;
477 __u64 metadata;
478 __u64 addr;
479 __u64 slba;
480 __u32 dsmgmt;
481 __u32 reftag;
482 __u16 apptag;
483 __u16 appmask;
484};
485
486struct nvme_admin_cmd {
487 __u8 opcode;
488 __u8 flags;
489 __u16 rsvd1;
490 __u32 nsid;
491 __u32 cdw2;
492 __u32 cdw3;
493 __u64 metadata;
494 __u64 addr;
495 __u32 metadata_len;
496 __u32 data_len;
497 __u32 cdw10;
498 __u32 cdw11;
499 __u32 cdw12;
500 __u32 cdw13;
501 __u32 cdw14;
502 __u32 cdw15;
503 __u32 timeout_ms;
504 __u32 result;
505};
506
507#define NVME_IOCTL_ID _IO('N', 0x40)
508#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd)
509#define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io)
510
511#ifdef __KERNEL__
512#include <linux/pci.h>
513#include <linux/miscdevice.h>
514#include <linux/kref.h>
515
516#define NVME_IO_TIMEOUT (5 * HZ) 69#define NVME_IO_TIMEOUT (5 * HZ)
517 70
518/* 71/*
@@ -553,7 +106,7 @@ struct nvme_ns {
553 struct request_queue *queue; 106 struct request_queue *queue;
554 struct gendisk *disk; 107 struct gendisk *disk;
555 108
556 int ns_id; 109 unsigned ns_id;
557 int lba_shift; 110 int lba_shift;
558 int ms; 111 int ms;
559 u64 mode_select_num_blocks; 112 u64 mode_select_num_blocks;
@@ -572,6 +125,7 @@ struct nvme_iod {
572 int offset; /* Of PRP list */ 125 int offset; /* Of PRP list */
573 int nents; /* Used in scatterlist */ 126 int nents; /* Used in scatterlist */
574 int length; /* Of data, in bytes */ 127 int length; /* Of data, in bytes */
128 unsigned long start_time;
575 dma_addr_t first_dma; 129 dma_addr_t first_dma;
576 struct scatterlist sg[0]; 130 struct scatterlist sg[0];
577}; 131};
@@ -613,6 +167,4 @@ struct sg_io_hdr;
613int nvme_sg_io(struct nvme_ns *ns, struct sg_io_hdr __user *u_hdr); 167int nvme_sg_io(struct nvme_ns *ns, struct sg_io_hdr __user *u_hdr);
614int nvme_sg_get_version_num(int __user *ip); 168int nvme_sg_get_version_num(int __user *ip);
615 169
616#endif
617
618#endif /* _LINUX_NVME_H */ 170#endif /* _LINUX_NVME_H */
diff --git a/include/linux/of.h b/include/linux/of.h
index 1fd08ca23106..f95aee391e30 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -266,6 +266,7 @@ extern int of_device_is_available(const struct device_node *device);
266extern const void *of_get_property(const struct device_node *node, 266extern const void *of_get_property(const struct device_node *node,
267 const char *name, 267 const char *name,
268 int *lenp); 268 int *lenp);
269extern struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
269#define for_each_property_of_node(dn, pp) \ 270#define for_each_property_of_node(dn, pp) \
270 for (pp = dn->properties; pp != NULL; pp = pp->next) 271 for (pp = dn->properties; pp != NULL; pp = pp->next)
271 272
@@ -280,6 +281,9 @@ extern struct device_node *of_parse_phandle(const struct device_node *np,
280extern int of_parse_phandle_with_args(const struct device_node *np, 281extern int of_parse_phandle_with_args(const struct device_node *np,
281 const char *list_name, const char *cells_name, int index, 282 const char *list_name, const char *cells_name, int index,
282 struct of_phandle_args *out_args); 283 struct of_phandle_args *out_args);
284extern int of_parse_phandle_with_fixed_args(const struct device_node *np,
285 const char *list_name, int cells_count, int index,
286 struct of_phandle_args *out_args);
283extern int of_count_phandle_with_args(const struct device_node *np, 287extern int of_count_phandle_with_args(const struct device_node *np,
284 const char *list_name, const char *cells_name); 288 const char *list_name, const char *cells_name);
285 289
@@ -323,12 +327,6 @@ extern int of_detach_node(struct device_node *);
323 */ 327 */
324const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, 328const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
325 u32 *pu); 329 u32 *pu);
326#define of_property_for_each_u32(np, propname, prop, p, u) \
327 for (prop = of_find_property(np, propname, NULL), \
328 p = of_prop_next_u32(prop, NULL, &u); \
329 p; \
330 p = of_prop_next_u32(prop, p, &u))
331
332/* 330/*
333 * struct property *prop; 331 * struct property *prop;
334 * const char *s; 332 * const char *s;
@@ -337,11 +335,8 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
337 * printk("String value: %s\n", s); 335 * printk("String value: %s\n", s);
338 */ 336 */
339const char *of_prop_next_string(struct property *prop, const char *cur); 337const char *of_prop_next_string(struct property *prop, const char *cur);
340#define of_property_for_each_string(np, propname, prop, s) \ 338
341 for (prop = of_find_property(np, propname, NULL), \ 339int of_device_is_stdout_path(struct device_node *dn);
342 s = of_prop_next_string(prop, NULL); \
343 s; \
344 s = of_prop_next_string(prop, s))
345 340
346#else /* CONFIG_OF */ 341#else /* CONFIG_OF */
347 342
@@ -459,6 +454,12 @@ static inline const void *of_get_property(const struct device_node *node,
459 return NULL; 454 return NULL;
460} 455}
461 456
457static inline struct device_node *of_get_cpu_node(int cpu,
458 unsigned int *thread)
459{
460 return NULL;
461}
462
462static inline int of_property_read_u64(const struct device_node *np, 463static inline int of_property_read_u64(const struct device_node *np,
463 const char *propname, u64 *out_value) 464 const char *propname, u64 *out_value)
464{ 465{
@@ -488,6 +489,13 @@ static inline int of_parse_phandle_with_args(struct device_node *np,
488 return -ENOSYS; 489 return -ENOSYS;
489} 490}
490 491
492static inline int of_parse_phandle_with_fixed_args(const struct device_node *np,
493 const char *list_name, int cells_count, int index,
494 struct of_phandle_args *out_args)
495{
496 return -ENOSYS;
497}
498
491static inline int of_count_phandle_with_args(struct device_node *np, 499static inline int of_count_phandle_with_args(struct device_node *np,
492 const char *list_name, 500 const char *list_name,
493 const char *cells_name) 501 const char *cells_name)
@@ -505,12 +513,25 @@ static inline int of_machine_is_compatible(const char *compat)
505 return 0; 513 return 0;
506} 514}
507 515
516static inline int of_device_is_stdout_path(struct device_node *dn)
517{
518 return 0;
519}
520
521static inline const __be32 *of_prop_next_u32(struct property *prop,
522 const __be32 *cur, u32 *pu)
523{
524 return NULL;
525}
526
527static inline const char *of_prop_next_string(struct property *prop,
528 const char *cur)
529{
530 return NULL;
531}
532
508#define of_match_ptr(_ptr) NULL 533#define of_match_ptr(_ptr) NULL
509#define of_match_node(_matches, _node) NULL 534#define of_match_node(_matches, _node) NULL
510#define of_property_for_each_u32(np, propname, prop, p, u) \
511 while (0)
512#define of_property_for_each_string(np, propname, prop, s) \
513 while (0)
514#endif /* CONFIG_OF */ 535#endif /* CONFIG_OF */
515 536
516#ifndef of_node_to_nid 537#ifndef of_node_to_nid
@@ -559,6 +580,18 @@ static inline int of_property_read_u32(const struct device_node *np,
559 return of_property_read_u32_array(np, propname, out_value, 1); 580 return of_property_read_u32_array(np, propname, out_value, 1);
560} 581}
561 582
583#define of_property_for_each_u32(np, propname, prop, p, u) \
584 for (prop = of_find_property(np, propname, NULL), \
585 p = of_prop_next_u32(prop, NULL, &u); \
586 p; \
587 p = of_prop_next_u32(prop, p, &u))
588
589#define of_property_for_each_string(np, propname, prop, s) \
590 for (prop = of_find_property(np, propname, NULL), \
591 s = of_prop_next_string(prop, NULL); \
592 s; \
593 s = of_prop_next_string(prop, s))
594
562#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE) 595#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE)
563extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); 596extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
564extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); 597extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 0506eb53519b..4c2e6f26432c 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -4,6 +4,36 @@
4#include <linux/errno.h> 4#include <linux/errno.h>
5#include <linux/of.h> 5#include <linux/of.h>
6 6
7struct of_pci_range_parser {
8 struct device_node *node;
9 const __be32 *range;
10 const __be32 *end;
11 int np;
12 int pna;
13};
14
15struct of_pci_range {
16 u32 pci_space;
17 u64 pci_addr;
18 u64 cpu_addr;
19 u64 size;
20 u32 flags;
21};
22
23#define for_each_of_pci_range(parser, range) \
24 for (; of_pci_range_parser_one(parser, range);)
25
26static inline void of_pci_range_to_resource(struct of_pci_range *range,
27 struct device_node *np,
28 struct resource *res)
29{
30 res->flags = range->flags;
31 res->start = range->cpu_addr;
32 res->end = range->cpu_addr + range->size - 1;
33 res->parent = res->child = res->sibling = NULL;
34 res->name = np->full_name;
35}
36
7#ifdef CONFIG_OF_ADDRESS 37#ifdef CONFIG_OF_ADDRESS
8extern u64 of_translate_address(struct device_node *np, const __be32 *addr); 38extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
9extern bool of_can_translate_address(struct device_node *dev); 39extern bool of_can_translate_address(struct device_node *dev);
@@ -27,6 +57,11 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
27#define pci_address_to_pio pci_address_to_pio 57#define pci_address_to_pio pci_address_to_pio
28#endif 58#endif
29 59
60extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
61 struct device_node *node);
62extern struct of_pci_range *of_pci_range_parser_one(
63 struct of_pci_range_parser *parser,
64 struct of_pci_range *range);
30#else /* CONFIG_OF_ADDRESS */ 65#else /* CONFIG_OF_ADDRESS */
31#ifndef of_address_to_resource 66#ifndef of_address_to_resource
32static inline int of_address_to_resource(struct device_node *dev, int index, 67static inline int of_address_to_resource(struct device_node *dev, int index,
@@ -53,6 +88,19 @@ static inline const __be32 *of_get_address(struct device_node *dev, int index,
53{ 88{
54 return NULL; 89 return NULL;
55} 90}
91
92static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser,
93 struct device_node *node)
94{
95 return -1;
96}
97
98static inline struct of_pci_range *of_pci_range_parser_one(
99 struct of_pci_range_parser *parser,
100 struct of_pci_range *range)
101{
102 return NULL;
103}
56#endif /* CONFIG_OF_ADDRESS */ 104#endif /* CONFIG_OF_ADDRESS */
57 105
58 106
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 901b7435e890..82ce324fdce7 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -1,15 +1,16 @@
1#ifndef _LINUX_OF_DEVICE_H 1#ifndef _LINUX_OF_DEVICE_H
2#define _LINUX_OF_DEVICE_H 2#define _LINUX_OF_DEVICE_H
3 3
4#include <linux/cpu.h>
4#include <linux/platform_device.h> 5#include <linux/platform_device.h>
5#include <linux/of_platform.h> /* temporary until merge */ 6#include <linux/of_platform.h> /* temporary until merge */
6 7
7#ifdef CONFIG_OF_DEVICE
8#include <linux/of.h> 8#include <linux/of.h>
9#include <linux/mod_devicetable.h> 9#include <linux/mod_devicetable.h>
10 10
11struct device; 11struct device;
12 12
13#ifdef CONFIG_OF
13extern const struct of_device_id *of_match_device( 14extern const struct of_device_id *of_match_device(
14 const struct of_device_id *matches, const struct device *dev); 15 const struct of_device_id *matches, const struct device *dev);
15extern void of_device_make_bus_id(struct device *dev); 16extern void of_device_make_bus_id(struct device *dev);
@@ -43,7 +44,16 @@ static inline void of_device_node_put(struct device *dev)
43 of_node_put(dev->of_node); 44 of_node_put(dev->of_node);
44} 45}
45 46
46#else /* CONFIG_OF_DEVICE */ 47static inline struct device_node *of_cpu_device_node_get(int cpu)
48{
49 struct device *cpu_dev;
50 cpu_dev = get_cpu_device(cpu);
51 if (!cpu_dev)
52 return NULL;
53 return of_node_get(cpu_dev->of_node);
54}
55
56#else /* CONFIG_OF */
47 57
48static inline int of_driver_match_device(struct device *dev, 58static inline int of_driver_match_device(struct device *dev,
49 struct device_driver *drv) 59 struct device_driver *drv)
@@ -67,6 +77,11 @@ static inline const struct of_device_id *of_match_device(
67{ 77{
68 return NULL; 78 return NULL;
69} 79}
70#endif /* CONFIG_OF_DEVICE */ 80
81static inline struct device_node *of_cpu_device_node_get(int cpu)
82{
83 return NULL;
84}
85#endif /* CONFIG_OF */
71 86
72#endif /* _LINUX_OF_DEVICE_H */ 87#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h
index 364dda734877..ae36298ba076 100644
--- a/include/linux/of_dma.h
+++ b/include/linux/of_dma.h
@@ -21,7 +21,6 @@ struct device_node;
21struct of_dma { 21struct of_dma {
22 struct list_head of_dma_controllers; 22 struct list_head of_dma_controllers;
23 struct device_node *of_node; 23 struct device_node *of_node;
24 int of_dma_nbcells;
25 struct dma_chan *(*of_dma_xlate) 24 struct dma_chan *(*of_dma_xlate)
26 (struct of_phandle_args *, struct of_dma *); 25 (struct of_phandle_args *, struct of_dma *);
27 void *of_dma_data; 26 void *of_dma_data;
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index ed136ad698ce..a478c62a2aab 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -90,6 +90,9 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
90extern int of_flat_dt_is_compatible(unsigned long node, const char *name); 90extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
91extern int of_flat_dt_match(unsigned long node, const char *const *matches); 91extern int of_flat_dt_match(unsigned long node, const char *const *matches);
92extern unsigned long of_get_flat_dt_root(void); 92extern unsigned long of_get_flat_dt_root(void);
93extern int of_scan_flat_dt_by_path(const char *path,
94 int (*it)(unsigned long node, const char *name, int depth, void *data),
95 void *data);
93 96
94extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, 97extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
95 int depth, void *data); 98 int depth, void *data);
@@ -106,8 +109,7 @@ extern u64 dt_mem_next_cell(int s, __be32 **cellp);
106 * physical addresses. 109 * physical addresses.
107 */ 110 */
108#ifdef CONFIG_BLK_DEV_INITRD 111#ifdef CONFIG_BLK_DEV_INITRD
109extern void early_init_dt_setup_initrd_arch(unsigned long start, 112extern void early_init_dt_setup_initrd_arch(u64 start, u64 end);
110 unsigned long end);
111#endif 113#endif
112 114
113/* Early flat tree scan hooks */ 115/* Early flat tree scan hooks */
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
deleted file mode 100644
index cfb545cd86b5..000000000000
--- a/include/linux/of_i2c.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * Generic I2C API implementation for PowerPC.
3 *
4 * Copyright (c) 2008 Jochen Friedrich <jochen@scram.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef __LINUX_OF_I2C_H
13#define __LINUX_OF_I2C_H
14
15#if defined(CONFIG_OF_I2C) || defined(CONFIG_OF_I2C_MODULE)
16#include <linux/i2c.h>
17
18extern void of_i2c_register_devices(struct i2c_adapter *adap);
19
20/* must call put_device() when done with returned i2c_client device */
21extern struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
22
23/* must call put_device() when done with returned i2c_adapter device */
24extern struct i2c_adapter *of_find_i2c_adapter_by_node(
25 struct device_node *node);
26
27#else
28static inline void of_i2c_register_devices(struct i2c_adapter *adap)
29{
30 return;
31}
32
33static inline struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
34{
35 return NULL;
36}
37
38/* must call put_device() when done with returned i2c_adapter device */
39static inline struct i2c_adapter *of_find_i2c_adapter_by_node(
40 struct device_node *node)
41{
42 return NULL;
43}
44#endif /* CONFIG_OF_I2C */
45
46#endif /* __LINUX_OF_I2C_H */
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index 535cecf1e02f..fcd63baee5f2 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -1,8 +1,6 @@
1#ifndef __OF_IRQ_H 1#ifndef __OF_IRQ_H
2#define __OF_IRQ_H 2#define __OF_IRQ_H
3 3
4#if defined(CONFIG_OF)
5struct of_irq;
6#include <linux/types.h> 4#include <linux/types.h>
7#include <linux/errno.h> 5#include <linux/errno.h>
8#include <linux/irq.h> 6#include <linux/irq.h>
@@ -10,14 +8,6 @@ struct of_irq;
10#include <linux/ioport.h> 8#include <linux/ioport.h>
11#include <linux/of.h> 9#include <linux/of.h>
12 10
13/*
14 * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
15 * implements it differently. However, the prototype is the same for all,
16 * so declare it here regardless of the CONFIG_OF_IRQ setting.
17 */
18extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
19
20#if defined(CONFIG_OF_IRQ)
21/** 11/**
22 * of_irq - container for device_node/irq_specifier pair for an irq controller 12 * of_irq - container for device_node/irq_specifier pair for an irq controller
23 * @controller: pointer to interrupt controller device tree node 13 * @controller: pointer to interrupt controller device tree node
@@ -71,11 +61,17 @@ extern int of_irq_to_resource(struct device_node *dev, int index,
71extern int of_irq_count(struct device_node *dev); 61extern int of_irq_count(struct device_node *dev);
72extern int of_irq_to_resource_table(struct device_node *dev, 62extern int of_irq_to_resource_table(struct device_node *dev,
73 struct resource *res, int nr_irqs); 63 struct resource *res, int nr_irqs);
74extern struct device_node *of_irq_find_parent(struct device_node *child);
75 64
76extern void of_irq_init(const struct of_device_id *matches); 65extern void of_irq_init(const struct of_device_id *matches);
77 66
78#endif /* CONFIG_OF_IRQ */ 67#if defined(CONFIG_OF)
68/*
69 * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
70 * implements it differently. However, the prototype is the same for all,
71 * so declare it here regardless of the CONFIG_OF_IRQ setting.
72 */
73extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
74extern struct device_node *of_irq_find_parent(struct device_node *child);
79 75
80#else /* !CONFIG_OF */ 76#else /* !CONFIG_OF */
81static inline unsigned int irq_of_parse_and_map(struct device_node *dev, 77static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
diff --git a/include/linux/of_net.h b/include/linux/of_net.h
index 61bf53b02779..34597c8c1a4c 100644
--- a/include/linux/of_net.h
+++ b/include/linux/of_net.h
@@ -9,10 +9,10 @@
9 9
10#ifdef CONFIG_OF_NET 10#ifdef CONFIG_OF_NET
11#include <linux/of.h> 11#include <linux/of.h>
12extern const int of_get_phy_mode(struct device_node *np); 12extern int of_get_phy_mode(struct device_node *np);
13extern const void *of_get_mac_address(struct device_node *np); 13extern const void *of_get_mac_address(struct device_node *np);
14#else 14#else
15static inline const int of_get_phy_mode(struct device_node *np) 15static inline int of_get_phy_mode(struct device_node *np)
16{ 16{
17 return -ENODEV; 17 return -ENODEV;
18} 18}
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index bb115deb7612..fd9c408631a0 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -2,6 +2,7 @@
2#define __OF_PCI_H 2#define __OF_PCI_H
3 3
4#include <linux/pci.h> 4#include <linux/pci.h>
5#include <linux/msi.h>
5 6
6struct pci_dev; 7struct pci_dev;
7struct of_irq; 8struct of_irq;
@@ -10,5 +11,18 @@ int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq);
10struct device_node; 11struct device_node;
11struct device_node *of_pci_find_child_device(struct device_node *parent, 12struct device_node *of_pci_find_child_device(struct device_node *parent,
12 unsigned int devfn); 13 unsigned int devfn);
14int of_pci_get_devfn(struct device_node *np);
15int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
16
17#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI)
18int of_pci_msi_chip_add(struct msi_chip *chip);
19void of_pci_msi_chip_remove(struct msi_chip *chip);
20struct msi_chip *of_pci_find_msi_chip_by_node(struct device_node *of_node);
21#else
22static inline int of_pci_msi_chip_add(struct msi_chip *chip) { return -EINVAL; }
23static inline void of_pci_msi_chip_remove(struct msi_chip *chip) { }
24static inline struct msi_chip *
25of_pci_find_msi_chip_by_node(struct device_node *of_node) { return NULL; }
26#endif
13 27
14#endif 28#endif
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 2a93b64a3869..05cb4a928252 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -13,8 +13,6 @@
13 13
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/mod_devicetable.h> 15#include <linux/mod_devicetable.h>
16
17#ifdef CONFIG_OF_DEVICE
18#include <linux/pm.h> 16#include <linux/pm.h>
19#include <linux/of_device.h> 17#include <linux/of_device.h>
20#include <linux/platform_device.h> 18#include <linux/platform_device.h>
@@ -53,27 +51,6 @@ struct of_dev_auxdata {
53 { .compatible = _compat, .phys_addr = _phys, .name = _name, \ 51 { .compatible = _compat, .phys_addr = _phys, .name = _name, \
54 .platform_data = _pdata } 52 .platform_data = _pdata }
55 53
56/**
57 * of_platform_driver - Legacy of-aware driver for platform devices.
58 *
59 * An of_platform_driver driver is attached to a basic platform_device on
60 * the ibm ebus (ibmebus_bus_type).
61 */
62struct of_platform_driver
63{
64 int (*probe)(struct platform_device* dev,
65 const struct of_device_id *match);
66 int (*remove)(struct platform_device* dev);
67
68 int (*suspend)(struct platform_device* dev, pm_message_t state);
69 int (*resume)(struct platform_device* dev);
70 int (*shutdown)(struct platform_device* dev);
71
72 struct device_driver driver;
73};
74#define to_of_platform_driver(drv) \
75 container_of(drv,struct of_platform_driver, driver)
76
77extern const struct of_device_id of_default_bus_match_table[]; 54extern const struct of_device_id of_default_bus_match_table[];
78 55
79/* Platform drivers register/unregister */ 56/* Platform drivers register/unregister */
@@ -82,7 +59,6 @@ extern struct platform_device *of_device_alloc(struct device_node *np,
82 struct device *parent); 59 struct device *parent);
83extern struct platform_device *of_find_device_by_node(struct device_node *np); 60extern struct platform_device *of_find_device_by_node(struct device_node *np);
84 61
85#ifdef CONFIG_OF_ADDRESS /* device reg helpers depend on OF_ADDRESS */
86/* Platform devices and busses creation */ 62/* Platform devices and busses creation */
87extern struct platform_device *of_platform_device_create(struct device_node *np, 63extern struct platform_device *of_platform_device_create(struct device_node *np,
88 const char *bus_id, 64 const char *bus_id,
@@ -91,17 +67,12 @@ extern struct platform_device *of_platform_device_create(struct device_node *np,
91extern int of_platform_bus_probe(struct device_node *root, 67extern int of_platform_bus_probe(struct device_node *root,
92 const struct of_device_id *matches, 68 const struct of_device_id *matches,
93 struct device *parent); 69 struct device *parent);
70#ifdef CONFIG_OF_ADDRESS
94extern int of_platform_populate(struct device_node *root, 71extern int of_platform_populate(struct device_node *root,
95 const struct of_device_id *matches, 72 const struct of_device_id *matches,
96 const struct of_dev_auxdata *lookup, 73 const struct of_dev_auxdata *lookup,
97 struct device *parent); 74 struct device *parent);
98#endif /* CONFIG_OF_ADDRESS */ 75#else
99
100#endif /* CONFIG_OF_DEVICE */
101
102#if !defined(CONFIG_OF_ADDRESS)
103struct of_dev_auxdata;
104struct device_node;
105static inline int of_platform_populate(struct device_node *root, 76static inline int of_platform_populate(struct device_node *root,
106 const struct of_device_id *matches, 77 const struct of_device_id *matches,
107 const struct of_dev_auxdata *lookup, 78 const struct of_dev_auxdata *lookup,
@@ -109,6 +80,6 @@ static inline int of_platform_populate(struct device_node *root,
109{ 80{
110 return -ENODEV; 81 return -ENODEV;
111} 82}
112#endif /* !CONFIG_OF_ADDRESS */ 83#endif
113 84
114#endif /* _LINUX_OF_PLATFORM_H */ 85#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
new file mode 100644
index 000000000000..c84128255814
--- /dev/null
+++ b/include/linux/of_reserved_mem.h
@@ -0,0 +1,14 @@
1#ifndef __OF_RESERVED_MEM_H
2#define __OF_RESERVED_MEM_H
3
4#ifdef CONFIG_OF_RESERVED_MEM
5void of_reserved_mem_device_init(struct device *dev);
6void of_reserved_mem_device_release(struct device *dev);
7void early_init_dt_scan_reserved_mem(void);
8#else
9static inline void of_reserved_mem_device_init(struct device *dev) { }
10static inline void of_reserved_mem_device_release(struct device *dev) { }
11static inline void early_init_dt_scan_reserved_mem(void) { }
12#endif
13
14#endif /* __OF_RESERVED_MEM_H */
diff --git a/include/linux/olpc-ec.h b/include/linux/olpc-ec.h
index 5bb6e760aa61..2925df3ce78a 100644
--- a/include/linux/olpc-ec.h
+++ b/include/linux/olpc-ec.h
@@ -6,6 +6,7 @@
6#define EC_WRITE_SCI_MASK 0x1b 6#define EC_WRITE_SCI_MASK 0x1b
7#define EC_WAKE_UP_WLAN 0x24 7#define EC_WAKE_UP_WLAN 0x24
8#define EC_WLAN_LEAVE_RESET 0x25 8#define EC_WLAN_LEAVE_RESET 0x25
9#define EC_DCON_POWER_MODE 0x26
9#define EC_READ_EB_MODE 0x2a 10#define EC_READ_EB_MODE 0x2a
10#define EC_SET_SCI_INHIBIT 0x32 11#define EC_SET_SCI_INHIBIT 0x32
11#define EC_SET_SCI_INHIBIT_RELEASE 0x34 12#define EC_SET_SCI_INHIBIT_RELEASE 0x34
diff --git a/include/linux/omap-mailbox.h b/include/linux/omap-mailbox.h
new file mode 100644
index 000000000000..f8322d9cd235
--- /dev/null
+++ b/include/linux/omap-mailbox.h
@@ -0,0 +1,29 @@
1/*
2 * omap-mailbox: interprocessor communication module for OMAP
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef OMAP_MAILBOX_H
10#define OMAP_MAILBOX_H
11
12typedef u32 mbox_msg_t;
13struct omap_mbox;
14
15typedef int __bitwise omap_mbox_irq_t;
16#define IRQ_TX ((__force omap_mbox_irq_t) 1)
17#define IRQ_RX ((__force omap_mbox_irq_t) 2)
18
19int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg);
20
21struct omap_mbox *omap_mbox_get(const char *, struct notifier_block *nb);
22void omap_mbox_put(struct omap_mbox *mbox, struct notifier_block *nb);
23
24void omap_mbox_save_ctx(struct omap_mbox *mbox);
25void omap_mbox_restore_ctx(struct omap_mbox *mbox);
26void omap_mbox_enable_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq);
27void omap_mbox_disable_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq);
28
29#endif /* OMAP_MAILBOX_H */
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index a4c562453f6b..b2a0f15f11fe 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -42,7 +42,6 @@
42#define IBS_FETCH_CODE 13 42#define IBS_FETCH_CODE 13
43#define IBS_OP_CODE 14 43#define IBS_OP_CODE 14
44 44
45struct super_block;
46struct dentry; 45struct dentry;
47struct file_operations; 46struct file_operations;
48struct pt_regs; 47struct pt_regs;
@@ -51,7 +50,7 @@ struct pt_regs;
51struct oprofile_operations { 50struct oprofile_operations {
52 /* create any necessary configuration files in the oprofile fs. 51 /* create any necessary configuration files in the oprofile fs.
53 * Optional. */ 52 * Optional. */
54 int (*create_files)(struct super_block * sb, struct dentry * root); 53 int (*create_files)(struct dentry * root);
55 /* Do any necessary interrupt setup. Optional. */ 54 /* Do any necessary interrupt setup. Optional. */
56 int (*setup)(void); 55 int (*setup)(void);
57 /* Do any necessary interrupt shutdown. Optional. */ 56 /* Do any necessary interrupt shutdown. Optional. */
@@ -125,27 +124,26 @@ void oprofile_add_trace(unsigned long eip);
125 * Create a file of the given name as a child of the given root, with 124 * Create a file of the given name as a child of the given root, with
126 * the specified file operations. 125 * the specified file operations.
127 */ 126 */
128int oprofilefs_create_file(struct super_block * sb, struct dentry * root, 127int oprofilefs_create_file(struct dentry * root,
129 char const * name, const struct file_operations * fops); 128 char const * name, const struct file_operations * fops);
130 129
131int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root, 130int oprofilefs_create_file_perm(struct dentry * root,
132 char const * name, const struct file_operations * fops, int perm); 131 char const * name, const struct file_operations * fops, int perm);
133 132
134/** Create a file for read/write access to an unsigned long. */ 133/** Create a file for read/write access to an unsigned long. */
135int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root, 134int oprofilefs_create_ulong(struct dentry * root,
136 char const * name, ulong * val); 135 char const * name, ulong * val);
137 136
138/** Create a file for read-only access to an unsigned long. */ 137/** Create a file for read-only access to an unsigned long. */
139int oprofilefs_create_ro_ulong(struct super_block * sb, struct dentry * root, 138int oprofilefs_create_ro_ulong(struct dentry * root,
140 char const * name, ulong * val); 139 char const * name, ulong * val);
141 140
142/** Create a file for read-only access to an atomic_t. */ 141/** Create a file for read-only access to an atomic_t. */
143int oprofilefs_create_ro_atomic(struct super_block * sb, struct dentry * root, 142int oprofilefs_create_ro_atomic(struct dentry * root,
144 char const * name, atomic_t * val); 143 char const * name, atomic_t * val);
145 144
146/** create a directory */ 145/** create a directory */
147struct dentry * oprofilefs_mkdir(struct super_block * sb, struct dentry * root, 146struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name);
148 char const * name);
149 147
150/** 148/**
151 * Write the given asciz string to the given user buffer @buf, updating *offset 149 * Write the given asciz string to the given user buffer @buf, updating *offset
diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
index be655e4a2a75..2ee8cd2466b5 100644
--- a/include/linux/pageblock-flags.h
+++ b/include/linux/pageblock-flags.h
@@ -80,10 +80,4 @@ void set_pageblock_flags_group(struct page *page, unsigned long flags,
80 PB_migrate_skip) 80 PB_migrate_skip)
81#endif /* CONFIG_COMPACTION */ 81#endif /* CONFIG_COMPACTION */
82 82
83#define get_pageblock_flags(page) \
84 get_pageblock_flags_group(page, 0, PB_migrate_end)
85#define set_pageblock_flags(page, flags) \
86 set_pageblock_flags_group(page, flags, \
87 0, PB_migrate_end)
88
89#endif /* PAGEBLOCK_FLAGS_H */ 83#endif /* PAGEBLOCK_FLAGS_H */
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index 2aa12b8499c0..e4dbfab37729 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -21,7 +21,7 @@ struct pagevec {
21}; 21};
22 22
23void __pagevec_release(struct pagevec *pvec); 23void __pagevec_release(struct pagevec *pvec);
24void __pagevec_lru_add(struct pagevec *pvec, enum lru_list lru); 24void __pagevec_lru_add(struct pagevec *pvec);
25unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, 25unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping,
26 pgoff_t start, unsigned nr_pages); 26 pgoff_t start, unsigned nr_pages);
27unsigned pagevec_lookup_tag(struct pagevec *pvec, 27unsigned pagevec_lookup_tag(struct pagevec *pvec,
@@ -64,36 +64,4 @@ static inline void pagevec_release(struct pagevec *pvec)
64 __pagevec_release(pvec); 64 __pagevec_release(pvec);
65} 65}
66 66
67static inline void __pagevec_lru_add_anon(struct pagevec *pvec)
68{
69 __pagevec_lru_add(pvec, LRU_INACTIVE_ANON);
70}
71
72static inline void __pagevec_lru_add_active_anon(struct pagevec *pvec)
73{
74 __pagevec_lru_add(pvec, LRU_ACTIVE_ANON);
75}
76
77static inline void __pagevec_lru_add_file(struct pagevec *pvec)
78{
79 __pagevec_lru_add(pvec, LRU_INACTIVE_FILE);
80}
81
82static inline void __pagevec_lru_add_active_file(struct pagevec *pvec)
83{
84 __pagevec_lru_add(pvec, LRU_ACTIVE_FILE);
85}
86
87static inline void pagevec_lru_add_file(struct pagevec *pvec)
88{
89 if (pagevec_count(pvec))
90 __pagevec_lru_add_file(pvec);
91}
92
93static inline void pagevec_lru_add_anon(struct pagevec *pvec)
94{
95 if (pagevec_count(pvec))
96 __pagevec_lru_add_anon(pvec);
97}
98
99#endif /* _LINUX_PAGEVEC_H */ 67#endif /* _LINUX_PAGEVEC_H */
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 170447977278..d006f0ca60f4 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -47,24 +47,22 @@ void acpi_pci_remove_bus(struct pci_bus *bus);
47 47
48#ifdef CONFIG_ACPI_PCI_SLOT 48#ifdef CONFIG_ACPI_PCI_SLOT
49void acpi_pci_slot_init(void); 49void acpi_pci_slot_init(void);
50void acpi_pci_slot_enumerate(struct pci_bus *bus, acpi_handle handle); 50void acpi_pci_slot_enumerate(struct pci_bus *bus);
51void acpi_pci_slot_remove(struct pci_bus *bus); 51void acpi_pci_slot_remove(struct pci_bus *bus);
52#else 52#else
53static inline void acpi_pci_slot_init(void) { } 53static inline void acpi_pci_slot_init(void) { }
54static inline void acpi_pci_slot_enumerate(struct pci_bus *bus, 54static inline void acpi_pci_slot_enumerate(struct pci_bus *bus) { }
55 acpi_handle handle) { }
56static inline void acpi_pci_slot_remove(struct pci_bus *bus) { } 55static inline void acpi_pci_slot_remove(struct pci_bus *bus) { }
57#endif 56#endif
58 57
59#ifdef CONFIG_HOTPLUG_PCI_ACPI 58#ifdef CONFIG_HOTPLUG_PCI_ACPI
60void acpiphp_init(void); 59void acpiphp_init(void);
61void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle); 60void acpiphp_enumerate_slots(struct pci_bus *bus);
62void acpiphp_remove_slots(struct pci_bus *bus); 61void acpiphp_remove_slots(struct pci_bus *bus);
63void acpiphp_check_host_bridge(acpi_handle handle); 62void acpiphp_check_host_bridge(acpi_handle handle);
64#else 63#else
65static inline void acpiphp_init(void) { } 64static inline void acpiphp_init(void) { }
66static inline void acpiphp_enumerate_slots(struct pci_bus *bus, 65static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { }
67 acpi_handle handle) { }
68static inline void acpiphp_remove_slots(struct pci_bus *bus) { } 66static inline void acpiphp_remove_slots(struct pci_bus *bus) { }
69static inline void acpiphp_check_host_bridge(acpi_handle handle) { } 67static inline void acpiphp_check_host_bridge(acpi_handle handle) { }
70#endif 68#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3a24e4ff3248..da172f956ad6 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -183,6 +183,19 @@ enum pci_bus_flags {
183 PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, 183 PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2,
184}; 184};
185 185
186/* These values come from the PCI Express Spec */
187enum pcie_link_width {
188 PCIE_LNK_WIDTH_RESRV = 0x00,
189 PCIE_LNK_X1 = 0x01,
190 PCIE_LNK_X2 = 0x02,
191 PCIE_LNK_X4 = 0x04,
192 PCIE_LNK_X8 = 0x08,
193 PCIE_LNK_X12 = 0x0C,
194 PCIE_LNK_X16 = 0x10,
195 PCIE_LNK_X32 = 0x20,
196 PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
197};
198
186/* Based on the PCI Hotplug Spec, but some values are made up by us */ 199/* Based on the PCI Hotplug Spec, but some values are made up by us */
187enum pci_bus_speed { 200enum pci_bus_speed {
188 PCI_SPEED_33MHz = 0x00, 201 PCI_SPEED_33MHz = 0x00,
@@ -364,7 +377,8 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
364 return dev; 377 return dev;
365} 378}
366 379
367struct pci_dev *alloc_pci_dev(void); 380struct pci_dev *pci_alloc_dev(struct pci_bus *bus);
381struct pci_dev * __deprecated alloc_pci_dev(void);
368 382
369#define to_pci_dev(n) container_of(n, struct pci_dev, dev) 383#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
370#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) 384#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
@@ -432,6 +446,7 @@ struct pci_bus {
432 struct resource busn_res; /* bus numbers routed to this bus */ 446 struct resource busn_res; /* bus numbers routed to this bus */
433 447
434 struct pci_ops *ops; /* configuration access functions */ 448 struct pci_ops *ops; /* configuration access functions */
449 struct msi_chip *msi; /* MSI controller */
435 void *sysdata; /* hook for sys-specific extension */ 450 void *sysdata; /* hook for sys-specific extension */
436 struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */ 451 struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */
437 452
@@ -674,7 +689,7 @@ struct pci_driver {
674/* these external functions are only available when PCI support is enabled */ 689/* these external functions are only available when PCI support is enabled */
675#ifdef CONFIG_PCI 690#ifdef CONFIG_PCI
676 691
677void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss); 692void pcie_bus_configure_settings(struct pci_bus *bus);
678 693
679enum pcie_bus_config_types { 694enum pcie_bus_config_types {
680 PCIE_BUS_TUNE_OFF, 695 PCIE_BUS_TUNE_OFF,
@@ -913,6 +928,7 @@ bool pci_check_and_unmask_intx(struct pci_dev *dev);
913void pci_msi_off(struct pci_dev *dev); 928void pci_msi_off(struct pci_dev *dev);
914int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); 929int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size);
915int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); 930int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask);
931int pci_wait_for_pending_transaction(struct pci_dev *dev);
916int pcix_get_max_mmrbc(struct pci_dev *dev); 932int pcix_get_max_mmrbc(struct pci_dev *dev);
917int pcix_get_mmrbc(struct pci_dev *dev); 933int pcix_get_mmrbc(struct pci_dev *dev);
918int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); 934int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
@@ -920,9 +936,16 @@ int pcie_get_readrq(struct pci_dev *dev);
920int pcie_set_readrq(struct pci_dev *dev, int rq); 936int pcie_set_readrq(struct pci_dev *dev, int rq);
921int pcie_get_mps(struct pci_dev *dev); 937int pcie_get_mps(struct pci_dev *dev);
922int pcie_set_mps(struct pci_dev *dev, int mps); 938int pcie_set_mps(struct pci_dev *dev, int mps);
939int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed,
940 enum pcie_link_width *width);
923int __pci_reset_function(struct pci_dev *dev); 941int __pci_reset_function(struct pci_dev *dev);
924int __pci_reset_function_locked(struct pci_dev *dev); 942int __pci_reset_function_locked(struct pci_dev *dev);
925int pci_reset_function(struct pci_dev *dev); 943int pci_reset_function(struct pci_dev *dev);
944int pci_probe_reset_slot(struct pci_slot *slot);
945int pci_reset_slot(struct pci_slot *slot);
946int pci_probe_reset_bus(struct pci_bus *bus);
947int pci_reset_bus(struct pci_bus *bus);
948void pci_reset_bridge_secondary_bus(struct pci_dev *dev);
926void pci_update_resource(struct pci_dev *dev, int resno); 949void pci_update_resource(struct pci_dev *dev, int resno);
927int __must_check pci_assign_resource(struct pci_dev *dev, int i); 950int __must_check pci_assign_resource(struct pci_dev *dev, int i);
928int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); 951int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
@@ -1002,6 +1025,7 @@ int pci_claim_resource(struct pci_dev *, int);
1002void pci_assign_unassigned_resources(void); 1025void pci_assign_unassigned_resources(void);
1003void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); 1026void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge);
1004void pci_assign_unassigned_bus_resources(struct pci_bus *bus); 1027void pci_assign_unassigned_bus_resources(struct pci_bus *bus);
1028void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus);
1005void pdev_enable_device(struct pci_dev *); 1029void pdev_enable_device(struct pci_dev *);
1006int pci_enable_resources(struct pci_dev *, int mask); 1030int pci_enable_resources(struct pci_dev *, int mask);
1007void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 1031void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
@@ -1018,6 +1042,8 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
1018void pci_release_selected_regions(struct pci_dev *, int); 1042void pci_release_selected_regions(struct pci_dev *, int);
1019 1043
1020/* drivers/pci/bus.c */ 1044/* drivers/pci/bus.c */
1045struct pci_bus *pci_bus_get(struct pci_bus *bus);
1046void pci_bus_put(struct pci_bus *bus);
1021void pci_add_resource(struct list_head *resources, struct resource *res); 1047void pci_add_resource(struct list_head *resources, struct resource *res);
1022void pci_add_resource_offset(struct list_head *resources, struct resource *res, 1048void pci_add_resource_offset(struct list_head *resources, struct resource *res,
1023 resource_size_t offset); 1049 resource_size_t offset);
@@ -1040,7 +1066,6 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
1040 resource_size_t, 1066 resource_size_t,
1041 resource_size_t), 1067 resource_size_t),
1042 void *alignf_data); 1068 void *alignf_data);
1043void pci_enable_bridges(struct pci_bus *bus);
1044 1069
1045/* Proper probing supporting hot-pluggable devices */ 1070/* Proper probing supporting hot-pluggable devices */
1046int __must_check __pci_register_driver(struct pci_driver *, struct module *, 1071int __must_check __pci_register_driver(struct pci_driver *, struct module *,
@@ -1643,6 +1668,11 @@ void pcibios_set_master(struct pci_dev *dev);
1643int pcibios_set_pcie_reset_state(struct pci_dev *dev, 1668int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1644 enum pcie_reset_state state); 1669 enum pcie_reset_state state);
1645int pcibios_add_device(struct pci_dev *dev); 1670int pcibios_add_device(struct pci_dev *dev);
1671void pcibios_release_device(struct pci_dev *dev);
1672
1673#ifdef CONFIG_HIBERNATE_CALLBACKS
1674extern struct dev_pm_ops pcibios_pm_ops;
1675#endif
1646 1676
1647#ifdef CONFIG_PCI_MMCONFIG 1677#ifdef CONFIG_PCI_MMCONFIG
1648void __init pci_mmcfg_early_init(void); 1678void __init pci_mmcfg_early_init(void);
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 8db71dcd6337..430dd963707b 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -28,19 +28,6 @@
28#ifndef _PCI_HOTPLUG_H 28#ifndef _PCI_HOTPLUG_H
29#define _PCI_HOTPLUG_H 29#define _PCI_HOTPLUG_H
30 30
31/* These values come from the PCI Express Spec */
32enum pcie_link_width {
33 PCIE_LNK_WIDTH_RESRV = 0x00,
34 PCIE_LNK_X1 = 0x01,
35 PCIE_LNK_X2 = 0x02,
36 PCIE_LNK_X4 = 0x04,
37 PCIE_LNK_X8 = 0x08,
38 PCIE_LNK_X12 = 0x0C,
39 PCIE_LNK_X16 = 0x10,
40 PCIE_LNK_X32 = 0x20,
41 PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
42};
43
44/** 31/**
45 * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use 32 * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use
46 * @owner: The module owner of this structure 33 * @owner: The module owner of this structure
@@ -63,6 +50,9 @@ enum pcie_link_width {
63 * @get_adapter_status: Called to get see if an adapter is present in the slot or not. 50 * @get_adapter_status: Called to get see if an adapter is present in the slot or not.
64 * If this field is NULL, the value passed in the struct hotplug_slot_info 51 * If this field is NULL, the value passed in the struct hotplug_slot_info
65 * will be used when this value is requested by a user. 52 * will be used when this value is requested by a user.
53 * @reset_slot: Optional interface to allow override of a bus reset for the
54 * slot for cases where a secondary bus reset can result in spurious
55 * hotplug events or where a slot can be reset independent of the bus.
66 * 56 *
67 * The table of function pointers that is passed to the hotplug pci core by a 57 * The table of function pointers that is passed to the hotplug pci core by a
68 * hotplug pci driver. These functions are called by the hotplug pci core when 58 * hotplug pci driver. These functions are called by the hotplug pci core when
@@ -80,6 +70,7 @@ struct hotplug_slot_ops {
80 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value); 70 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value);
81 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value); 71 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value);
82 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value); 72 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value);
73 int (*reset_slot) (struct hotplug_slot *slot, int probe);
83}; 74};
84 75
85/** 76/**
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index c12916248469..97fbecdd7a40 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -518,6 +518,8 @@
518#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 518#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303
519#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 519#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304
520#define PCI_DEVICE_ID_AMD_15H_M10H_F3 0x1403 520#define PCI_DEVICE_ID_AMD_15H_M10H_F3 0x1403
521#define PCI_DEVICE_ID_AMD_15H_M30H_NB_F3 0x141d
522#define PCI_DEVICE_ID_AMD_15H_M30H_NB_F4 0x141e
521#define PCI_DEVICE_ID_AMD_15H_NB_F0 0x1600 523#define PCI_DEVICE_ID_AMD_15H_NB_F0 0x1600
522#define PCI_DEVICE_ID_AMD_15H_NB_F1 0x1601 524#define PCI_DEVICE_ID_AMD_15H_NB_F1 0x1601
523#define PCI_DEVICE_ID_AMD_15H_NB_F2 0x1602 525#define PCI_DEVICE_ID_AMD_15H_NB_F2 0x1602
@@ -556,7 +558,6 @@
556#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450 558#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450
557#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451 559#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451
558#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458 560#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458
559#define PCI_DEVICE_ID_AMD_HUDSON2_SMBUS 0x780b
560#define PCI_DEVICE_ID_AMD_CS5535_IDE 0x208F 561#define PCI_DEVICE_ID_AMD_CS5535_IDE 0x208F
561#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090 562#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090
562#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091 563#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091
@@ -568,8 +569,9 @@
568#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A 569#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
569#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081 570#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081
570#define PCI_DEVICE_ID_AMD_LX_AES 0x2082 571#define PCI_DEVICE_ID_AMD_LX_AES 0x2082
571#define PCI_DEVICE_ID_AMD_HUDSON2_IDE 0x780c
572#define PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE 0x7800 572#define PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE 0x7800
573#define PCI_DEVICE_ID_AMD_HUDSON2_SMBUS 0x780b
574#define PCI_DEVICE_ID_AMD_HUDSON2_IDE 0x780c
573 575
574#define PCI_VENDOR_ID_TRIDENT 0x1023 576#define PCI_VENDOR_ID_TRIDENT 0x1023
575#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 577#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
@@ -756,6 +758,7 @@
756#define PCI_DEVICE_ID_HP_CISSE 0x323a 758#define PCI_DEVICE_ID_HP_CISSE 0x323a
757#define PCI_DEVICE_ID_HP_CISSF 0x323b 759#define PCI_DEVICE_ID_HP_CISSF 0x323b
758#define PCI_DEVICE_ID_HP_CISSH 0x323c 760#define PCI_DEVICE_ID_HP_CISSH 0x323c
761#define PCI_DEVICE_ID_HP_CISSI 0x3239
759#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031 762#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031
760 763
761#define PCI_VENDOR_ID_PCTECH 0x1042 764#define PCI_VENDOR_ID_PCTECH 0x1042
@@ -1311,6 +1314,8 @@
1311#define PCI_DEVICE_ID_IMS_TT128 0x9128 1314#define PCI_DEVICE_ID_IMS_TT128 0x9128
1312#define PCI_DEVICE_ID_IMS_TT3D 0x9135 1315#define PCI_DEVICE_ID_IMS_TT3D 0x9135
1313 1316
1317#define PCI_VENDOR_ID_AMCC 0x10e8
1318
1314#define PCI_VENDOR_ID_INTERG 0x10ea 1319#define PCI_VENDOR_ID_INTERG 0x10ea
1315#define PCI_DEVICE_ID_INTERG_1682 0x1682 1320#define PCI_DEVICE_ID_INTERG_1682 0x1682
1316#define PCI_DEVICE_ID_INTERG_2000 0x2000 1321#define PCI_DEVICE_ID_INTERG_2000 0x2000
@@ -2256,12 +2261,10 @@
2256/* 2261/*
2257 * ADDI-DATA GmbH communication cards <info@addi-data.com> 2262 * ADDI-DATA GmbH communication cards <info@addi-data.com>
2258 */ 2263 */
2259#define PCI_VENDOR_ID_ADDIDATA_OLD 0x10E8
2260#define PCI_VENDOR_ID_ADDIDATA 0x15B8 2264#define PCI_VENDOR_ID_ADDIDATA 0x15B8
2261#define PCI_DEVICE_ID_ADDIDATA_APCI7500 0x7000 2265#define PCI_DEVICE_ID_ADDIDATA_APCI7500 0x7000
2262#define PCI_DEVICE_ID_ADDIDATA_APCI7420 0x7001 2266#define PCI_DEVICE_ID_ADDIDATA_APCI7420 0x7001
2263#define PCI_DEVICE_ID_ADDIDATA_APCI7300 0x7002 2267#define PCI_DEVICE_ID_ADDIDATA_APCI7300 0x7002
2264#define PCI_DEVICE_ID_ADDIDATA_APCI7800 0x818E
2265#define PCI_DEVICE_ID_ADDIDATA_APCI7500_2 0x7009 2268#define PCI_DEVICE_ID_ADDIDATA_APCI7500_2 0x7009
2266#define PCI_DEVICE_ID_ADDIDATA_APCI7420_2 0x700A 2269#define PCI_DEVICE_ID_ADDIDATA_APCI7420_2 0x700A
2267#define PCI_DEVICE_ID_ADDIDATA_APCI7300_2 0x700B 2270#define PCI_DEVICE_ID_ADDIDATA_APCI7300_2 0x700B
@@ -2476,6 +2479,9 @@
2476 2479
2477#define PCI_VENDOR_ID_ASMEDIA 0x1b21 2480#define PCI_VENDOR_ID_ASMEDIA 0x1b21
2478 2481
2482#define PCI_VENDOR_ID_CIRCUITCO 0x1cc8
2483#define PCI_SUBSYSTEM_ID_CIRCUITCO_MINNOWBOARD 0x0001
2484
2479#define PCI_VENDOR_ID_TEKRAM 0x1de1 2485#define PCI_VENDOR_ID_TEKRAM 0x1de1
2480#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 2486#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
2481 2487
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 27ef6b190ea6..57e890abe1f0 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -22,9 +22,12 @@
22 * Macro which verifies @ptr is a percpu pointer without evaluating 22 * Macro which verifies @ptr is a percpu pointer without evaluating
23 * @ptr. This is to be used in percpu accessors to verify that the 23 * @ptr. This is to be used in percpu accessors to verify that the
24 * input parameter is a percpu pointer. 24 * input parameter is a percpu pointer.
25 *
26 * + 0 is required in order to convert the pointer type from a
27 * potential array type to a pointer to a single item of the array.
25 */ 28 */
26#define __verify_pcpu_ptr(ptr) do { \ 29#define __verify_pcpu_ptr(ptr) do { \
27 const void __percpu *__vpp_verify = (typeof(ptr))NULL; \ 30 const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
28 (void)__vpp_verify; \ 31 (void)__vpp_verify; \
29} while (0) 32} while (0)
30 33
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
new file mode 100644
index 000000000000..95961f0bf62d
--- /dev/null
+++ b/include/linux/percpu-refcount.h
@@ -0,0 +1,174 @@
1/*
2 * Percpu refcounts:
3 * (C) 2012 Google, Inc.
4 * Author: Kent Overstreet <koverstreet@google.com>
5 *
6 * This implements a refcount with similar semantics to atomic_t - atomic_inc(),
7 * atomic_dec_and_test() - but percpu.
8 *
9 * There's one important difference between percpu refs and normal atomic_t
10 * refcounts; you have to keep track of your initial refcount, and then when you
11 * start shutting down you call percpu_ref_kill() _before_ dropping the initial
12 * refcount.
13 *
14 * The refcount will have a range of 0 to ((1U << 31) - 1), i.e. one bit less
15 * than an atomic_t - this is because of the way shutdown works, see
16 * percpu_ref_kill()/PCPU_COUNT_BIAS.
17 *
18 * Before you call percpu_ref_kill(), percpu_ref_put() does not check for the
19 * refcount hitting 0 - it can't, if it was in percpu mode. percpu_ref_kill()
20 * puts the ref back in single atomic_t mode, collecting the per cpu refs and
21 * issuing the appropriate barriers, and then marks the ref as shutting down so
22 * that percpu_ref_put() will check for the ref hitting 0. After it returns,
23 * it's safe to drop the initial ref.
24 *
25 * USAGE:
26 *
27 * See fs/aio.c for some example usage; it's used there for struct kioctx, which
28 * is created when userspaces calls io_setup(), and destroyed when userspace
29 * calls io_destroy() or the process exits.
30 *
31 * In the aio code, kill_ioctx() is called when we wish to destroy a kioctx; it
32 * calls percpu_ref_kill(), then hlist_del_rcu() and sychronize_rcu() to remove
33 * the kioctx from the proccess's list of kioctxs - after that, there can't be
34 * any new users of the kioctx (from lookup_ioctx()) and it's then safe to drop
35 * the initial ref with percpu_ref_put().
36 *
37 * Code that does a two stage shutdown like this often needs some kind of
38 * explicit synchronization to ensure the initial refcount can only be dropped
39 * once - percpu_ref_kill() does this for you, it returns true once and false if
40 * someone else already called it. The aio code uses it this way, but it's not
41 * necessary if the code has some other mechanism to synchronize teardown.
42 * around.
43 */
44
45#ifndef _LINUX_PERCPU_REFCOUNT_H
46#define _LINUX_PERCPU_REFCOUNT_H
47
48#include <linux/atomic.h>
49#include <linux/kernel.h>
50#include <linux/percpu.h>
51#include <linux/rcupdate.h>
52
53struct percpu_ref;
54typedef void (percpu_ref_func_t)(struct percpu_ref *);
55
56struct percpu_ref {
57 atomic_t count;
58 /*
59 * The low bit of the pointer indicates whether the ref is in percpu
60 * mode; if set, then get/put will manipulate the atomic_t (this is a
61 * hack because we need to keep the pointer around for
62 * percpu_ref_kill_rcu())
63 */
64 unsigned __percpu *pcpu_count;
65 percpu_ref_func_t *release;
66 percpu_ref_func_t *confirm_kill;
67 struct rcu_head rcu;
68};
69
70int __must_check percpu_ref_init(struct percpu_ref *ref,
71 percpu_ref_func_t *release);
72void percpu_ref_cancel_init(struct percpu_ref *ref);
73void percpu_ref_kill_and_confirm(struct percpu_ref *ref,
74 percpu_ref_func_t *confirm_kill);
75
76/**
77 * percpu_ref_kill - drop the initial ref
78 * @ref: percpu_ref to kill
79 *
80 * Must be used to drop the initial ref on a percpu refcount; must be called
81 * precisely once before shutdown.
82 *
83 * Puts @ref in non percpu mode, then does a call_rcu() before gathering up the
84 * percpu counters and dropping the initial ref.
85 */
86static inline void percpu_ref_kill(struct percpu_ref *ref)
87{
88 return percpu_ref_kill_and_confirm(ref, NULL);
89}
90
91#define PCPU_STATUS_BITS 2
92#define PCPU_STATUS_MASK ((1 << PCPU_STATUS_BITS) - 1)
93#define PCPU_REF_PTR 0
94#define PCPU_REF_DEAD 1
95
96#define REF_STATUS(count) (((unsigned long) count) & PCPU_STATUS_MASK)
97
98/**
99 * percpu_ref_get - increment a percpu refcount
100 * @ref: percpu_ref to get
101 *
102 * Analagous to atomic_inc().
103 */
104static inline void percpu_ref_get(struct percpu_ref *ref)
105{
106 unsigned __percpu *pcpu_count;
107
108 rcu_read_lock_sched();
109
110 pcpu_count = ACCESS_ONCE(ref->pcpu_count);
111
112 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR))
113 __this_cpu_inc(*pcpu_count);
114 else
115 atomic_inc(&ref->count);
116
117 rcu_read_unlock_sched();
118}
119
120/**
121 * percpu_ref_tryget - try to increment a percpu refcount
122 * @ref: percpu_ref to try-get
123 *
124 * Increment a percpu refcount unless it has already been killed. Returns
125 * %true on success; %false on failure.
126 *
127 * Completion of percpu_ref_kill() in itself doesn't guarantee that tryget
128 * will fail. For such guarantee, percpu_ref_kill_and_confirm() should be
129 * used. After the confirm_kill callback is invoked, it's guaranteed that
130 * no new reference will be given out by percpu_ref_tryget().
131 */
132static inline bool percpu_ref_tryget(struct percpu_ref *ref)
133{
134 unsigned __percpu *pcpu_count;
135 int ret = false;
136
137 rcu_read_lock_sched();
138
139 pcpu_count = ACCESS_ONCE(ref->pcpu_count);
140
141 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) {
142 __this_cpu_inc(*pcpu_count);
143 ret = true;
144 }
145
146 rcu_read_unlock_sched();
147
148 return ret;
149}
150
151/**
152 * percpu_ref_put - decrement a percpu refcount
153 * @ref: percpu_ref to put
154 *
155 * Decrement the refcount, and if 0, call the release function (which was passed
156 * to percpu_ref_init())
157 */
158static inline void percpu_ref_put(struct percpu_ref *ref)
159{
160 unsigned __percpu *pcpu_count;
161
162 rcu_read_lock_sched();
163
164 pcpu_count = ACCESS_ONCE(ref->pcpu_count);
165
166 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR))
167 __this_cpu_dec(*pcpu_count);
168 else if (unlikely(atomic_dec_and_test(&ref->count)))
169 ref->release(ref);
170
171 rcu_read_unlock_sched();
172}
173
174#endif
diff --git a/include/linux/percpu_ida.h b/include/linux/percpu_ida.h
new file mode 100644
index 000000000000..0b23edbee309
--- /dev/null
+++ b/include/linux/percpu_ida.h
@@ -0,0 +1,60 @@
1#ifndef __PERCPU_IDA_H__
2#define __PERCPU_IDA_H__
3
4#include <linux/types.h>
5#include <linux/bitops.h>
6#include <linux/init.h>
7#include <linux/spinlock_types.h>
8#include <linux/wait.h>
9#include <linux/cpumask.h>
10
11struct percpu_ida_cpu;
12
13struct percpu_ida {
14 /*
15 * number of tags available to be allocated, as passed to
16 * percpu_ida_init()
17 */
18 unsigned nr_tags;
19
20 struct percpu_ida_cpu __percpu *tag_cpu;
21
22 /*
23 * Bitmap of cpus that (may) have tags on their percpu freelists:
24 * steal_tags() uses this to decide when to steal tags, and which cpus
25 * to try stealing from.
26 *
27 * It's ok for a freelist to be empty when its bit is set - steal_tags()
28 * will just keep looking - but the bitmap _must_ be set whenever a
29 * percpu freelist does have tags.
30 */
31 cpumask_t cpus_have_tags;
32
33 struct {
34 spinlock_t lock;
35 /*
36 * When we go to steal tags from another cpu (see steal_tags()),
37 * we want to pick a cpu at random. Cycling through them every
38 * time we steal is a bit easier and more or less equivalent:
39 */
40 unsigned cpu_last_stolen;
41
42 /* For sleeping on allocation failure */
43 wait_queue_head_t wait;
44
45 /*
46 * Global freelist - it's a stack where nr_free points to the
47 * top
48 */
49 unsigned nr_free;
50 unsigned *freelist;
51 } ____cacheline_aligned_in_smp;
52};
53
54int percpu_ida_alloc(struct percpu_ida *pool, gfp_t gfp);
55void percpu_ida_free(struct percpu_ida *pool, unsigned tag);
56
57void percpu_ida_destroy(struct percpu_ida *pool);
58int percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags);
59
60#endif /* __PERCPU_IDA_H__ */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f463a46424e2..866e85c5eb94 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -48,6 +48,7 @@ struct perf_guest_info_callbacks {
48#include <linux/cpu.h> 48#include <linux/cpu.h>
49#include <linux/irq_work.h> 49#include <linux/irq_work.h>
50#include <linux/static_key.h> 50#include <linux/static_key.h>
51#include <linux/jump_label_ratelimit.h>
51#include <linux/atomic.h> 52#include <linux/atomic.h>
52#include <linux/sysfs.h> 53#include <linux/sysfs.h>
53#include <linux/perf_regs.h> 54#include <linux/perf_regs.h>
@@ -64,25 +65,6 @@ struct perf_raw_record {
64}; 65};
65 66
66/* 67/*
67 * single taken branch record layout:
68 *
69 * from: source instruction (may not always be a branch insn)
70 * to: branch target
71 * mispred: branch target was mispredicted
72 * predicted: branch target was predicted
73 *
74 * support for mispred, predicted is optional. In case it
75 * is not supported mispred = predicted = 0.
76 */
77struct perf_branch_entry {
78 __u64 from;
79 __u64 to;
80 __u64 mispred:1, /* target mispredicted */
81 predicted:1,/* target predicted */
82 reserved:62;
83};
84
85/*
86 * branch stack layout: 68 * branch stack layout:
87 * nr: number of taken branches stored in entries[] 69 * nr: number of taken branches stored in entries[]
88 * 70 *
@@ -113,6 +95,8 @@ struct hw_perf_event_extra {
113 int idx; /* index in shared_regs->regs[] */ 95 int idx; /* index in shared_regs->regs[] */
114}; 96};
115 97
98struct event_constraint;
99
116/** 100/**
117 * struct hw_perf_event - performance event hardware details: 101 * struct hw_perf_event - performance event hardware details:
118 */ 102 */
@@ -131,6 +115,8 @@ struct hw_perf_event {
131 115
132 struct hw_perf_event_extra extra_reg; 116 struct hw_perf_event_extra extra_reg;
133 struct hw_perf_event_extra branch_reg; 117 struct hw_perf_event_extra branch_reg;
118
119 struct event_constraint *constraint;
134 }; 120 };
135 struct { /* software */ 121 struct { /* software */
136 struct hrtimer hrtimer; 122 struct hrtimer hrtimer;
@@ -188,12 +174,13 @@ struct pmu {
188 174
189 struct device *dev; 175 struct device *dev;
190 const struct attribute_group **attr_groups; 176 const struct attribute_group **attr_groups;
191 char *name; 177 const char *name;
192 int type; 178 int type;
193 179
194 int * __percpu pmu_disable_count; 180 int * __percpu pmu_disable_count;
195 struct perf_cpu_context * __percpu pmu_cpu_context; 181 struct perf_cpu_context * __percpu pmu_cpu_context;
196 int task_ctx_nr; 182 int task_ctx_nr;
183 int hrtimer_interval_ms;
197 184
198 /* 185 /*
199 * Fully disable/enable this PMU, can be used to protect from the PMI 186 * Fully disable/enable this PMU, can be used to protect from the PMI
@@ -389,8 +376,7 @@ struct perf_event {
389 /* mmap bits */ 376 /* mmap bits */
390 struct mutex mmap_mutex; 377 struct mutex mmap_mutex;
391 atomic_t mmap_count; 378 atomic_t mmap_count;
392 int mmap_locked; 379
393 struct user_struct *mmap_user;
394 struct ring_buffer *rb; 380 struct ring_buffer *rb;
395 struct list_head rb_entry; 381 struct list_head rb_entry;
396 382
@@ -501,8 +487,9 @@ struct perf_cpu_context {
501 struct perf_event_context *task_ctx; 487 struct perf_event_context *task_ctx;
502 int active_oncpu; 488 int active_oncpu;
503 int exclusive; 489 int exclusive;
490 struct hrtimer hrtimer;
491 ktime_t hrtimer_interval;
504 struct list_head rotation_list; 492 struct list_head rotation_list;
505 int jiffies_interval;
506 struct pmu *unique_pmu; 493 struct pmu *unique_pmu;
507 struct perf_cgroup *cgrp; 494 struct perf_cgroup *cgrp;
508}; 495};
@@ -518,7 +505,7 @@ struct perf_output_handle {
518 505
519#ifdef CONFIG_PERF_EVENTS 506#ifdef CONFIG_PERF_EVENTS
520 507
521extern int perf_pmu_register(struct pmu *pmu, char *name, int type); 508extern int perf_pmu_register(struct pmu *pmu, const char *name, int type);
522extern void perf_pmu_unregister(struct pmu *pmu); 509extern void perf_pmu_unregister(struct pmu *pmu);
523 510
524extern int perf_num_counters(void); 511extern int perf_num_counters(void);
@@ -696,10 +683,17 @@ static inline void perf_callchain_store(struct perf_callchain_entry *entry, u64
696extern int sysctl_perf_event_paranoid; 683extern int sysctl_perf_event_paranoid;
697extern int sysctl_perf_event_mlock; 684extern int sysctl_perf_event_mlock;
698extern int sysctl_perf_event_sample_rate; 685extern int sysctl_perf_event_sample_rate;
686extern int sysctl_perf_cpu_time_max_percent;
687
688extern void perf_sample_event_took(u64 sample_len_ns);
699 689
700extern int perf_proc_update_handler(struct ctl_table *table, int write, 690extern int perf_proc_update_handler(struct ctl_table *table, int write,
701 void __user *buffer, size_t *lenp, 691 void __user *buffer, size_t *lenp,
702 loff_t *ppos); 692 loff_t *ppos);
693extern int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write,
694 void __user *buffer, size_t *lenp,
695 loff_t *ppos);
696
703 697
704static inline bool perf_paranoid_tracepoint_raw(void) 698static inline bool perf_paranoid_tracepoint_raw(void)
705{ 699{
@@ -743,6 +737,7 @@ extern unsigned int perf_output_skip(struct perf_output_handle *handle,
743 unsigned int len); 737 unsigned int len);
744extern int perf_swevent_get_recursion_context(void); 738extern int perf_swevent_get_recursion_context(void);
745extern void perf_swevent_put_recursion_context(int rctx); 739extern void perf_swevent_put_recursion_context(int rctx);
740extern u64 perf_swevent_set_period(struct perf_event *event);
746extern void perf_event_enable(struct perf_event *event); 741extern void perf_event_enable(struct perf_event *event);
747extern void perf_event_disable(struct perf_event *event); 742extern void perf_event_disable(struct perf_event *event);
748extern int __perf_event_disable(void *info); 743extern int __perf_event_disable(void *info);
@@ -782,6 +777,7 @@ static inline void perf_event_fork(struct task_struct *tsk) { }
782static inline void perf_event_init(void) { } 777static inline void perf_event_init(void) { }
783static inline int perf_swevent_get_recursion_context(void) { return -1; } 778static inline int perf_swevent_get_recursion_context(void) { return -1; }
784static inline void perf_swevent_put_recursion_context(int rctx) { } 779static inline void perf_swevent_put_recursion_context(int rctx) { }
780static inline u64 perf_swevent_set_period(struct perf_event *event) { return 0; }
785static inline void perf_event_enable(struct perf_event *event) { } 781static inline void perf_event_enable(struct perf_event *event) { }
786static inline void perf_event_disable(struct perf_event *event) { } 782static inline void perf_event_disable(struct perf_event *event) { }
787static inline int __perf_event_disable(void *info) { return -1; } 783static inline int __perf_event_disable(void *info) { return -1; }
@@ -803,11 +799,11 @@ static inline void perf_restore_debug_store(void) { }
803#define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x)) 799#define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x))
804 800
805/* 801/*
806 * This has to have a higher priority than migration_notifier in sched.c. 802 * This has to have a higher priority than migration_notifier in sched/core.c.
807 */ 803 */
808#define perf_cpu_notifier(fn) \ 804#define perf_cpu_notifier(fn) \
809do { \ 805do { \
810 static struct notifier_block fn##_nb __cpuinitdata = \ 806 static struct notifier_block fn##_nb = \
811 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \ 807 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \
812 unsigned long cpu = smp_processor_id(); \ 808 unsigned long cpu = smp_processor_id(); \
813 unsigned long flags; \ 809 unsigned long flags; \
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 9e11039dd7a3..64ab823f7b74 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -49,6 +49,7 @@
49 49
50#define PHY_HAS_INTERRUPT 0x00000001 50#define PHY_HAS_INTERRUPT 0x00000001
51#define PHY_HAS_MAGICANEG 0x00000002 51#define PHY_HAS_MAGICANEG 0x00000002
52#define PHY_IS_INTERNAL 0x00000004
52 53
53/* Interface Mode definitions */ 54/* Interface Mode definitions */
54typedef enum { 55typedef enum {
@@ -57,6 +58,7 @@ typedef enum {
57 PHY_INTERFACE_MODE_GMII, 58 PHY_INTERFACE_MODE_GMII,
58 PHY_INTERFACE_MODE_SGMII, 59 PHY_INTERFACE_MODE_SGMII,
59 PHY_INTERFACE_MODE_TBI, 60 PHY_INTERFACE_MODE_TBI,
61 PHY_INTERFACE_MODE_REVMII,
60 PHY_INTERFACE_MODE_RMII, 62 PHY_INTERFACE_MODE_RMII,
61 PHY_INTERFACE_MODE_RGMII, 63 PHY_INTERFACE_MODE_RGMII,
62 PHY_INTERFACE_MODE_RGMII_ID, 64 PHY_INTERFACE_MODE_RGMII_ID,
@@ -261,6 +263,7 @@ struct phy_c45_device_ids {
261 * phy_id: UID for this device found during discovery 263 * phy_id: UID for this device found during discovery
262 * c45_ids: 802.3-c45 Device Identifers if is_c45. 264 * c45_ids: 802.3-c45 Device Identifers if is_c45.
263 * is_c45: Set to true if this phy uses clause 45 addressing. 265 * is_c45: Set to true if this phy uses clause 45 addressing.
266 * is_internal: Set to true if this phy is internal to a MAC.
264 * state: state of the PHY for management purposes 267 * state: state of the PHY for management purposes
265 * dev_flags: Device-specific flags used by the PHY driver. 268 * dev_flags: Device-specific flags used by the PHY driver.
266 * addr: Bus address of PHY 269 * addr: Bus address of PHY
@@ -298,6 +301,7 @@ struct phy_device {
298 301
299 struct phy_c45_device_ids c45_ids; 302 struct phy_c45_device_ids c45_ids;
300 bool is_c45; 303 bool is_c45;
304 bool is_internal;
301 305
302 enum phy_state state; 306 enum phy_state state;
303 307
@@ -508,6 +512,27 @@ static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)
508 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 512 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
509} 513}
510 514
515/**
516 * phy_interrupt_is_valid - Convenience function for testing a given PHY irq
517 * @phydev: the phy_device struct
518 *
519 * NOTE: must be kept in sync with addition/removal of PHY_POLL and
520 * PHY_IGNORE_INTERRUPT
521 */
522static inline bool phy_interrupt_is_valid(struct phy_device *phydev)
523{
524 return phydev->irq != PHY_POLL && phydev->irq != PHY_IGNORE_INTERRUPT;
525}
526
527/**
528 * phy_is_internal - Convenience function for testing if a PHY is internal
529 * @phydev: the phy_device struct
530 */
531static inline bool phy_is_internal(struct phy_device *phydev)
532{
533 return phydev->is_internal;
534}
535
511struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, 536struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
512 bool is_c45, struct phy_c45_device_ids *c45_ids); 537 bool is_c45, struct phy_c45_device_ids *c45_ids);
513struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); 538struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
@@ -545,6 +570,8 @@ void phy_drivers_unregister(struct phy_driver *drv, int n);
545int phy_driver_register(struct phy_driver *new_driver); 570int phy_driver_register(struct phy_driver *new_driver);
546int phy_drivers_register(struct phy_driver *new_driver, int n); 571int phy_drivers_register(struct phy_driver *new_driver, int n);
547void phy_state_machine(struct work_struct *work); 572void phy_state_machine(struct work_struct *work);
573void phy_change(struct work_struct *work);
574void phy_mac_interrupt(struct phy_device *phydev, int new_link);
548void phy_start_machine(struct phy_device *phydev, 575void phy_start_machine(struct phy_device *phydev,
549 void (*handler)(struct net_device *)); 576 void (*handler)(struct net_device *));
550void phy_stop_machine(struct phy_device *phydev); 577void phy_stop_machine(struct phy_device *phydev);
diff --git a/include/linux/pid.h b/include/linux/pid.h
index a089a3c447fc..23705a53abba 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -86,11 +86,9 @@ extern struct task_struct *get_pid_task(struct pid *pid, enum pid_type);
86extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type); 86extern struct pid *get_task_pid(struct task_struct *task, enum pid_type type);
87 87
88/* 88/*
89 * attach_pid() and detach_pid() must be called with the tasklist_lock 89 * these helpers must be called with the tasklist_lock write-held.
90 * write-held.
91 */ 90 */
92extern void attach_pid(struct task_struct *task, enum pid_type type, 91extern void attach_pid(struct task_struct *task, enum pid_type);
93 struct pid *pid);
94extern void detach_pid(struct task_struct *task, enum pid_type); 92extern void detach_pid(struct task_struct *task, enum pid_type);
95extern void change_pid(struct task_struct *task, enum pid_type, 93extern void change_pid(struct task_struct *task, enum pid_type,
96 struct pid *pid); 94 struct pid *pid);
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 4aad3cea69ae..18eccefea06e 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -40,6 +40,25 @@ extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
40extern struct pinctrl * __must_check devm_pinctrl_get(struct device *dev); 40extern struct pinctrl * __must_check devm_pinctrl_get(struct device *dev);
41extern void devm_pinctrl_put(struct pinctrl *p); 41extern void devm_pinctrl_put(struct pinctrl *p);
42 42
43#ifdef CONFIG_PM
44extern int pinctrl_pm_select_default_state(struct device *dev);
45extern int pinctrl_pm_select_sleep_state(struct device *dev);
46extern int pinctrl_pm_select_idle_state(struct device *dev);
47#else
48static inline int pinctrl_pm_select_default_state(struct device *dev)
49{
50 return 0;
51}
52static inline int pinctrl_pm_select_sleep_state(struct device *dev)
53{
54 return 0;
55}
56static inline int pinctrl_pm_select_idle_state(struct device *dev)
57{
58 return 0;
59}
60#endif
61
43#else /* !CONFIG_PINCTRL */ 62#else /* !CONFIG_PINCTRL */
44 63
45static inline int pinctrl_request_gpio(unsigned gpio) 64static inline int pinctrl_request_gpio(unsigned gpio)
@@ -92,6 +111,21 @@ static inline void devm_pinctrl_put(struct pinctrl *p)
92{ 111{
93} 112}
94 113
114static inline int pinctrl_pm_select_default_state(struct device *dev)
115{
116 return 0;
117}
118
119static inline int pinctrl_pm_select_sleep_state(struct device *dev)
120{
121 return 0;
122}
123
124static inline int pinctrl_pm_select_idle_state(struct device *dev)
125{
126 return 0;
127}
128
95#endif /* CONFIG_PINCTRL */ 129#endif /* CONFIG_PINCTRL */
96 130
97static inline struct pinctrl * __must_check pinctrl_get_select( 131static inline struct pinctrl * __must_check pinctrl_get_select(
@@ -158,47 +192,4 @@ static inline struct pinctrl * __must_check devm_pinctrl_get_select_default(
158 return devm_pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT); 192 return devm_pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
159} 193}
160 194
161#ifdef CONFIG_PINCONF
162
163extern int pin_config_get(const char *dev_name, const char *name,
164 unsigned long *config);
165extern int pin_config_set(const char *dev_name, const char *name,
166 unsigned long config);
167extern int pin_config_group_get(const char *dev_name,
168 const char *pin_group,
169 unsigned long *config);
170extern int pin_config_group_set(const char *dev_name,
171 const char *pin_group,
172 unsigned long config);
173
174#else
175
176static inline int pin_config_get(const char *dev_name, const char *name,
177 unsigned long *config)
178{
179 return 0;
180}
181
182static inline int pin_config_set(const char *dev_name, const char *name,
183 unsigned long config)
184{
185 return 0;
186}
187
188static inline int pin_config_group_get(const char *dev_name,
189 const char *pin_group,
190 unsigned long *config)
191{
192 return 0;
193}
194
195static inline int pin_config_group_set(const char *dev_name,
196 const char *pin_group,
197 unsigned long config)
198{
199 return 0;
200}
201
202#endif
203
204#endif /* __LINUX_PINCTRL_CONSUMER_H */ 195#endif /* __LINUX_PINCTRL_CONSUMER_H */
diff --git a/include/linux/pinctrl/devinfo.h b/include/linux/pinctrl/devinfo.h
index 6e5f8a985ea7..281cb91ddcf5 100644
--- a/include/linux/pinctrl/devinfo.h
+++ b/include/linux/pinctrl/devinfo.h
@@ -28,6 +28,10 @@
28struct dev_pin_info { 28struct dev_pin_info {
29 struct pinctrl *p; 29 struct pinctrl *p;
30 struct pinctrl_state *default_state; 30 struct pinctrl_state *default_state;
31#ifdef CONFIG_PM
32 struct pinctrl_state *sleep_state;
33 struct pinctrl_state *idle_state;
34#endif
31}; 35};
32 36
33extern int pinctrl_bind_pins(struct device *dev); 37extern int pinctrl_bind_pins(struct device *dev);
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index 6aa238096622..fb90ef5eb038 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -29,12 +29,25 @@
29 * if for example some other pin is going to drive the signal connected 29 * if for example some other pin is going to drive the signal connected
30 * to it for a while. Pins used for input are usually always high 30 * to it for a while. Pins used for input are usually always high
31 * impedance. 31 * impedance.
32 * @PIN_CONFIG_BIAS_BUS_HOLD: the pin will be set to weakly latch so that it
33 * weakly drives the last value on a tristate bus, also known as a "bus
34 * holder", "bus keeper" or "repeater". This allows another device on the
35 * bus to change the value by driving the bus high or low and switching to
36 * tristate. The argument is ignored.
32 * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high 37 * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high
33 * impedance to VDD). If the argument is != 0 pull-up is enabled, 38 * impedance to VDD). If the argument is != 0 pull-up is enabled,
34 * if it is 0, pull-up is disabled. 39 * if it is 0, pull-up is total, i.e. the pin is connected to VDD.
35 * @PIN_CONFIG_BIAS_PULL_DOWN: the pin will be pulled down (usually with high 40 * @PIN_CONFIG_BIAS_PULL_DOWN: the pin will be pulled down (usually with high
36 * impedance to GROUND). If the argument is != 0 pull-down is enabled, 41 * impedance to GROUND). If the argument is != 0 pull-down is enabled,
37 * if it is 0, pull-down is disabled. 42 * if it is 0, pull-down is total, i.e. the pin is connected to GROUND.
43 * @PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: the pin will be pulled up or down based
44 * on embedded knowledge of the controller hardware, like current mux
45 * function. The pull direction and possibly strength too will normally
46 * be decided completely inside the hardware block and not be readable
47 * from the kernel side.
48 * If the argument is != 0 pull up/down is enabled, if it is 0, the
49 * configuration is ignored. The proper way to disable it is to use
50 * @PIN_CONFIG_BIAS_DISABLE.
38 * @PIN_CONFIG_DRIVE_PUSH_PULL: the pin will be driven actively high and 51 * @PIN_CONFIG_DRIVE_PUSH_PULL: the pin will be driven actively high and
39 * low, this is the most typical case and is typically achieved with two 52 * low, this is the most typical case and is typically achieved with two
40 * active transistors on the output. Setting this config will enable 53 * active transistors on the output. Setting this config will enable
@@ -57,14 +70,14 @@
57 * setting pins to this mode. 70 * setting pins to this mode.
58 * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode, 71 * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode,
59 * which means it will wait for signals to settle when reading inputs. The 72 * which means it will wait for signals to settle when reading inputs. The
60 * argument gives the debounce time on a custom format. Setting the 73 * argument gives the debounce time in usecs. Setting the
61 * argument to zero turns debouncing off. 74 * argument to zero turns debouncing off.
62 * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power 75 * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power
63 * supplies, the argument to this parameter (on a custom format) tells 76 * supplies, the argument to this parameter (on a custom format) tells
64 * the driver which alternative power source to use. 77 * the driver which alternative power source to use.
65 * @PIN_CONFIG_SLEW_RATE: if the pin can select slew rate, the argument to 78 * @PIN_CONFIG_SLEW_RATE: if the pin can select slew rate, the argument to
66 * this parameter (on a custom format) tells the driver which alternative 79 * this parameter (on a custom format) tells the driver which alternative
67 * slew rate to use. 80 * slew rate to use.
68 * @PIN_CONFIG_LOW_POWER_MODE: this will configure the pin for low power 81 * @PIN_CONFIG_LOW_POWER_MODE: this will configure the pin for low power
69 * operation, if several modes of operation are supported these can be 82 * operation, if several modes of operation are supported these can be
70 * passed in the argument on a custom form, else just use argument 1 83 * passed in the argument on a custom form, else just use argument 1
@@ -78,8 +91,10 @@
78enum pin_config_param { 91enum pin_config_param {
79 PIN_CONFIG_BIAS_DISABLE, 92 PIN_CONFIG_BIAS_DISABLE,
80 PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 93 PIN_CONFIG_BIAS_HIGH_IMPEDANCE,
94 PIN_CONFIG_BIAS_BUS_HOLD,
81 PIN_CONFIG_BIAS_PULL_UP, 95 PIN_CONFIG_BIAS_PULL_UP,
82 PIN_CONFIG_BIAS_PULL_DOWN, 96 PIN_CONFIG_BIAS_PULL_DOWN,
97 PIN_CONFIG_BIAS_PULL_PIN_DEFAULT,
83 PIN_CONFIG_DRIVE_PUSH_PULL, 98 PIN_CONFIG_DRIVE_PUSH_PULL,
84 PIN_CONFIG_DRIVE_OPEN_DRAIN, 99 PIN_CONFIG_DRIVE_OPEN_DRAIN,
85 PIN_CONFIG_DRIVE_OPEN_SOURCE, 100 PIN_CONFIG_DRIVE_OPEN_SOURCE,
@@ -122,6 +137,39 @@ static inline unsigned long pinconf_to_config_packed(enum pin_config_param param
122 return PIN_CONF_PACKED(param, argument); 137 return PIN_CONF_PACKED(param, argument);
123} 138}
124 139
140#ifdef CONFIG_OF
141
142#include <linux/device.h>
143#include <linux/pinctrl/machine.h>
144struct pinctrl_dev;
145struct pinctrl_map;
146
147int pinconf_generic_dt_subnode_to_map(struct pinctrl_dev *pctldev,
148 struct device_node *np, struct pinctrl_map **map,
149 unsigned *reserved_maps, unsigned *num_maps,
150 enum pinctrl_map_type type);
151int pinconf_generic_dt_node_to_map(struct pinctrl_dev *pctldev,
152 struct device_node *np_config, struct pinctrl_map **map,
153 unsigned *num_maps, enum pinctrl_map_type type);
154
155static inline int pinconf_generic_dt_node_to_map_group(
156 struct pinctrl_dev *pctldev, struct device_node *np_config,
157 struct pinctrl_map **map, unsigned *num_maps)
158{
159 return pinconf_generic_dt_node_to_map(pctldev, np_config, map, num_maps,
160 PIN_MAP_TYPE_CONFIGS_GROUP);
161}
162
163static inline int pinconf_generic_dt_node_to_map_pin(
164 struct pinctrl_dev *pctldev, struct device_node *np_config,
165 struct pinctrl_map **map, unsigned *num_maps)
166{
167 return pinconf_generic_dt_node_to_map(pctldev, np_config, map, num_maps,
168 PIN_MAP_TYPE_CONFIGS_PIN);
169}
170
171#endif
172
125#endif /* CONFIG_GENERIC_PINCONF */ 173#endif /* CONFIG_GENERIC_PINCONF */
126 174
127#endif /* __LINUX_PINCTRL_PINCONF_GENERIC_H */ 175#endif /* __LINUX_PINCTRL_PINCONF_GENERIC_H */
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
index 1ad4f31ef6b8..09eb80f2574a 100644
--- a/include/linux/pinctrl/pinconf.h
+++ b/include/linux/pinctrl/pinconf.h
@@ -30,7 +30,7 @@ struct seq_file;
30 * @pin_config_set: configure an individual pin 30 * @pin_config_set: configure an individual pin
31 * @pin_config_group_get: get configurations for an entire pin group 31 * @pin_config_group_get: get configurations for an entire pin group
32 * @pin_config_group_set: configure all pins in a group 32 * @pin_config_group_set: configure all pins in a group
33 * @pin_config_group_dbg_set: optional debugfs to modify a pin configuration 33 * @pin_config_dbg_parse_modify: optional debugfs to modify a pin configuration
34 * @pin_config_dbg_show: optional debugfs display hook that will provide 34 * @pin_config_dbg_show: optional debugfs display hook that will provide
35 * per-device info for a certain pin in debugfs 35 * per-device info for a certain pin in debugfs
36 * @pin_config_group_dbg_show: optional debugfs display hook that will provide 36 * @pin_config_group_dbg_show: optional debugfs display hook that will provide
@@ -47,13 +47,15 @@ struct pinconf_ops {
47 unsigned long *config); 47 unsigned long *config);
48 int (*pin_config_set) (struct pinctrl_dev *pctldev, 48 int (*pin_config_set) (struct pinctrl_dev *pctldev,
49 unsigned pin, 49 unsigned pin,
50 unsigned long config); 50 unsigned long *configs,
51 unsigned num_configs);
51 int (*pin_config_group_get) (struct pinctrl_dev *pctldev, 52 int (*pin_config_group_get) (struct pinctrl_dev *pctldev,
52 unsigned selector, 53 unsigned selector,
53 unsigned long *config); 54 unsigned long *config);
54 int (*pin_config_group_set) (struct pinctrl_dev *pctldev, 55 int (*pin_config_group_set) (struct pinctrl_dev *pctldev,
55 unsigned selector, 56 unsigned selector,
56 unsigned long config); 57 unsigned long *configs,
58 unsigned num_configs);
57 int (*pin_config_dbg_parse_modify) (struct pinctrl_dev *pctldev, 59 int (*pin_config_dbg_parse_modify) (struct pinctrl_dev *pctldev,
58 const char *arg, 60 const char *arg,
59 unsigned long *config); 61 unsigned long *config);
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 2c2a9e8d8578..5979147d2bda 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -49,7 +49,8 @@ struct pinctrl_pin_desc {
49 * @name: a name for the chip in this range 49 * @name: a name for the chip in this range
50 * @id: an ID number for the chip in this range 50 * @id: an ID number for the chip in this range
51 * @base: base offset of the GPIO range 51 * @base: base offset of the GPIO range
52 * @pin_base: base pin number of the GPIO range 52 * @pin_base: base pin number of the GPIO range if pins == NULL
53 * @pins: enumeration of pins in GPIO range or NULL
53 * @npins: number of pins in the GPIO range, including the base number 54 * @npins: number of pins in the GPIO range, including the base number
54 * @gc: an optional pointer to a gpio_chip 55 * @gc: an optional pointer to a gpio_chip
55 */ 56 */
@@ -59,6 +60,7 @@ struct pinctrl_gpio_range {
59 unsigned int id; 60 unsigned int id;
60 unsigned int base; 61 unsigned int base;
61 unsigned int pin_base; 62 unsigned int pin_base;
63 unsigned const *pins;
62 unsigned int npins; 64 unsigned int npins;
63 struct gpio_chip *gc; 65 struct gpio_chip *gc;
64}; 66};
diff --git a/include/linux/platform_data/ad7303.h b/include/linux/platform_data/ad7303.h
new file mode 100644
index 000000000000..de6a7a6b4bbf
--- /dev/null
+++ b/include/linux/platform_data/ad7303.h
@@ -0,0 +1,21 @@
1/*
2 * Analog Devices AD7303 DAC driver
3 *
4 * Copyright 2013 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2.
7 */
8
9#ifndef __IIO_ADC_AD7303_H__
10#define __IIO_ADC_AD7303_H__
11
12/**
13 * struct ad7303_platform_data - AD7303 platform data
14 * @use_external_ref: If set to true use an external voltage reference connected
15 * to the REF pin, otherwise use the internal reference derived from Vdd.
16 */
17struct ad7303_platform_data {
18 bool use_external_ref;
19};
20
21#endif
diff --git a/include/linux/platform_data/asoc-s3c.h b/include/linux/platform_data/asoc-s3c.h
index 88272591a895..9efc04dd255a 100644
--- a/include/linux/platform_data/asoc-s3c.h
+++ b/include/linux/platform_data/asoc-s3c.h
@@ -36,6 +36,7 @@ struct samsung_i2s {
36 */ 36 */
37#define QUIRK_NO_MUXPSR (1 << 2) 37#define QUIRK_NO_MUXPSR (1 << 2)
38#define QUIRK_NEED_RSTCLR (1 << 3) 38#define QUIRK_NEED_RSTCLR (1 << 3)
39#define QUIRK_SUPPORTS_TDM (1 << 4)
39 /* Quirks of the I2S controller */ 40 /* Quirks of the I2S controller */
40 u32 quirks; 41 u32 quirks;
41 dma_addr_t idma_addr; 42 dma_addr_t idma_addr;
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
index e15745b4f3a5..b3ca1e94e0c8 100644
--- a/include/linux/platform_data/at91_adc.h
+++ b/include/linux/platform_data/at91_adc.h
@@ -14,12 +14,16 @@
14 (Interruptions registers mostly) 14 (Interruptions registers mostly)
15 * @status_register: Offset of the Interrupt Status Register 15 * @status_register: Offset of the Interrupt Status Register
16 * @trigger_register: Offset of the Trigger setup register 16 * @trigger_register: Offset of the Trigger setup register
17 * @mr_prescal_mask: Mask of the PRESCAL field in the adc MR register
18 * @mr_startup_mask: Mask of the STARTUP field in the adc MR register
17 */ 19 */
18struct at91_adc_reg_desc { 20struct at91_adc_reg_desc {
19 u8 channel_base; 21 u8 channel_base;
20 u32 drdy_mask; 22 u32 drdy_mask;
21 u8 status_register; 23 u8 status_register;
22 u8 trigger_register; 24 u8 trigger_register;
25 u32 mr_prescal_mask;
26 u32 mr_startup_mask;
23}; 27};
24 28
25/** 29/**
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index 6a293b7fff3b..cea9f70133c5 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -71,6 +71,10 @@ struct atmel_nand_data {
71 u8 on_flash_bbt; /* bbt on flash */ 71 u8 on_flash_bbt; /* bbt on flash */
72 struct mtd_partition *parts; 72 struct mtd_partition *parts;
73 unsigned int num_parts; 73 unsigned int num_parts;
74 bool has_dma; /* support dma transfer */
75
76 /* default is false, only for at32ap7000 chip is true */
77 bool need_reset_workaround;
74}; 78};
75 79
76 /* Serial */ 80 /* Serial */
diff --git a/include/linux/platform_data/bd6107.h b/include/linux/platform_data/bd6107.h
new file mode 100644
index 000000000000..671d6502d241
--- /dev/null
+++ b/include/linux/platform_data/bd6107.h
@@ -0,0 +1,19 @@
1/*
2 * bd6107.h - Rohm BD6107 LEDs Driver
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __BD6107_H__
9#define __BD6107_H__
10
11struct device;
12
13struct bd6107_platform_data {
14 struct device *fbdev;
15 int reset; /* Reset GPIO */
16 unsigned int def_value;
17};
18
19#endif
diff --git a/include/linux/platform_data/brcmfmac-sdio.h b/include/linux/platform_data/brcmfmac-sdio.h
index 1ade657d5fc1..e75dcbf2b230 100644
--- a/include/linux/platform_data/brcmfmac-sdio.h
+++ b/include/linux/platform_data/brcmfmac-sdio.h
@@ -90,6 +90,14 @@ void __init brcmfmac_init_pdata(void)
90 * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are 90 * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are
91 * used for registering the irq using request_irq function. 91 * used for registering the irq using request_irq function.
92 * 92 *
93 * broken_sg_support: flag for broken sg list support of SDIO host controller.
94 * Set this to true if the SDIO host controller has higher align requirement
95 * than 32 bytes for each scatterlist item.
96 *
97 * sd_head_align: alignment requirement for start of data buffer
98 *
99 * sd_sgentry_align: length alignment requirement for each sg entry
100 *
93 * power_on: This function is called by the brcmfmac when the module gets 101 * power_on: This function is called by the brcmfmac when the module gets
94 * loaded. This can be particularly useful for low power devices. The platform 102 * loaded. This can be particularly useful for low power devices. The platform
95 * spcific routine may for example decide to power up the complete device. 103 * spcific routine may for example decide to power up the complete device.
@@ -116,6 +124,9 @@ struct brcmfmac_sdio_platform_data {
116 bool oob_irq_supported; 124 bool oob_irq_supported;
117 unsigned int oob_irq_nr; 125 unsigned int oob_irq_nr;
118 unsigned long oob_irq_flags; 126 unsigned long oob_irq_flags;
127 bool broken_sg_support;
128 unsigned short sd_head_align;
129 unsigned short sd_sgentry_align;
119 void (*power_on)(void); 130 void (*power_on)(void);
120 void (*power_off)(void); 131 void (*power_off)(void);
121 void (*reset)(void); 132 void (*reset)(void);
diff --git a/include/linux/platform_data/camera-mx3.h b/include/linux/platform_data/camera-mx3.h
index f226ee3777e1..a910dadc8258 100644
--- a/include/linux/platform_data/camera-mx3.h
+++ b/include/linux/platform_data/camera-mx3.h
@@ -33,6 +33,8 @@
33#define MX3_CAMERA_DATAWIDTH_MASK (MX3_CAMERA_DATAWIDTH_4 | MX3_CAMERA_DATAWIDTH_8 | \ 33#define MX3_CAMERA_DATAWIDTH_MASK (MX3_CAMERA_DATAWIDTH_4 | MX3_CAMERA_DATAWIDTH_8 | \
34 MX3_CAMERA_DATAWIDTH_10 | MX3_CAMERA_DATAWIDTH_15) 34 MX3_CAMERA_DATAWIDTH_10 | MX3_CAMERA_DATAWIDTH_15)
35 35
36struct v4l2_async_subdev;
37
36/** 38/**
37 * struct mx3_camera_pdata - i.MX3x camera platform data 39 * struct mx3_camera_pdata - i.MX3x camera platform data
38 * @flags: MX3_CAMERA_* flags 40 * @flags: MX3_CAMERA_* flags
@@ -43,6 +45,8 @@ struct mx3_camera_pdata {
43 unsigned long flags; 45 unsigned long flags;
44 unsigned long mclk_10khz; 46 unsigned long mclk_10khz;
45 struct device *dma_dev; 47 struct device *dma_dev;
48 struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */
49 int *asd_sizes; /* 0-terminated array of asd group sizes */
46}; 50};
47 51
48#endif 52#endif
diff --git a/include/linux/platform_data/camera-rcar.h b/include/linux/platform_data/camera-rcar.h
new file mode 100644
index 000000000000..dfc83c581593
--- /dev/null
+++ b/include/linux/platform_data/camera-rcar.h
@@ -0,0 +1,25 @@
1/*
2 * Platform data for Renesas R-Car VIN soc-camera driver
3 *
4 * Copyright (C) 2011-2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Cogent Embedded, Inc., <source@cogentembedded.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
13#ifndef __CAMERA_RCAR_H_
14#define __CAMERA_RCAR_H_
15
16#define RCAR_VIN_HSYNC_ACTIVE_LOW (1 << 0)
17#define RCAR_VIN_VSYNC_ACTIVE_LOW (1 << 1)
18#define RCAR_VIN_BT601 (1 << 2)
19#define RCAR_VIN_BT656 (1 << 3)
20
21struct rcar_vin_platform_data {
22 unsigned int flags;
23};
24
25#endif /* __CAMERA_RCAR_H_ */
diff --git a/include/linux/platform_data/clk-ux500.h b/include/linux/platform_data/clk-ux500.h
index 320d9c39ea0a..9d98f3aaa16c 100644
--- a/include/linux/platform_data/clk-ux500.h
+++ b/include/linux/platform_data/clk-ux500.h
@@ -12,7 +12,9 @@
12 12
13void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base, 13void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
14 u32 clkrst5_base, u32 clkrst6_base); 14 u32 clkrst5_base, u32 clkrst6_base);
15void u9540_clk_init(void); 15void u9540_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
16void u8540_clk_init(void); 16 u32 clkrst5_base, u32 clkrst6_base);
17void u8540_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
18 u32 clkrst5_base, u32 clkrst6_base);
17 19
18#endif /* __CLK_UX500_H */ 20#endif /* __CLK_UX500_H */
diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h
deleted file mode 100644
index bb3cd58d71e3..000000000000
--- a/include/linux/platform_data/cpsw.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * Texas Instruments Ethernet Switch Driver
3 *
4 * Copyright (C) 2012 Texas Instruments
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 as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#ifndef __CPSW_H__
16#define __CPSW_H__
17
18#include <linux/if_ether.h>
19
20struct cpsw_slave_data {
21 char phy_id[MII_BUS_ID_SIZE];
22 int phy_if;
23 u8 mac_addr[ETH_ALEN];
24 u16 dual_emac_res_vlan; /* Reserved VLAN for DualEMAC */
25
26};
27
28struct cpsw_platform_data {
29 u32 ss_reg_ofs; /* Subsystem control register offset */
30 u32 channels; /* number of cpdma channels (symmetric) */
31 u32 slaves; /* number of slave cpgmac ports */
32 struct cpsw_slave_data *slave_data;
33 u32 active_slave; /* time stamping, ethtool and SIOCGMIIPHY slave */
34 u32 cpts_clock_mult; /* convert input clock ticks to nanoseconds */
35 u32 cpts_clock_shift; /* convert input clock ticks to nanoseconds */
36 u32 ale_entries; /* ale table size */
37 u32 bd_ram_size; /*buffer descriptor ram size */
38 u32 rx_descs; /* Number of Rx Descriptios */
39 u32 mac_control; /* Mac control register */
40 u16 default_vlan; /* Def VLAN for ALE lookup in VLAN aware mode*/
41 bool dual_emac; /* Enable Dual EMAC mode */
42};
43
44#endif /* __CPSW_H__ */
diff --git a/include/linux/platform_data/dma-atmel.h b/include/linux/platform_data/dma-atmel.h
index cab0997be3de..e95f19c65873 100644
--- a/include/linux/platform_data/dma-atmel.h
+++ b/include/linux/platform_data/dma-atmel.h
@@ -35,16 +35,20 @@ struct at_dma_slave {
35 35
36 36
37/* Platform-configurable bits in CFG */ 37/* Platform-configurable bits in CFG */
38#define ATC_PER_MSB(h) ((0x30U & (h)) >> 4) /* Extract most significant bits of a handshaking identifier */
39
38#define ATC_SRC_PER(h) (0xFU & (h)) /* Channel src rq associated with periph handshaking ifc h */ 40#define ATC_SRC_PER(h) (0xFU & (h)) /* Channel src rq associated with periph handshaking ifc h */
39#define ATC_DST_PER(h) ((0xFU & (h)) << 4) /* Channel dst rq associated with periph handshaking ifc h */ 41#define ATC_DST_PER(h) ((0xFU & (h)) << 4) /* Channel dst rq associated with periph handshaking ifc h */
40#define ATC_SRC_REP (0x1 << 8) /* Source Replay Mod */ 42#define ATC_SRC_REP (0x1 << 8) /* Source Replay Mod */
41#define ATC_SRC_H2SEL (0x1 << 9) /* Source Handshaking Mod */ 43#define ATC_SRC_H2SEL (0x1 << 9) /* Source Handshaking Mod */
42#define ATC_SRC_H2SEL_SW (0x0 << 9) 44#define ATC_SRC_H2SEL_SW (0x0 << 9)
43#define ATC_SRC_H2SEL_HW (0x1 << 9) 45#define ATC_SRC_H2SEL_HW (0x1 << 9)
46#define ATC_SRC_PER_MSB(h) (ATC_PER_MSB(h) << 10) /* Channel src rq (most significant bits) */
44#define ATC_DST_REP (0x1 << 12) /* Destination Replay Mod */ 47#define ATC_DST_REP (0x1 << 12) /* Destination Replay Mod */
45#define ATC_DST_H2SEL (0x1 << 13) /* Destination Handshaking Mod */ 48#define ATC_DST_H2SEL (0x1 << 13) /* Destination Handshaking Mod */
46#define ATC_DST_H2SEL_SW (0x0 << 13) 49#define ATC_DST_H2SEL_SW (0x0 << 13)
47#define ATC_DST_H2SEL_HW (0x1 << 13) 50#define ATC_DST_H2SEL_HW (0x1 << 13)
51#define ATC_DST_PER_MSB(h) (ATC_PER_MSB(h) << 14) /* Channel dst rq (most significant bits) */
48#define ATC_SOD (0x1 << 16) /* Stop On Done */ 52#define ATC_SOD (0x1 << 16) /* Stop On Done */
49#define ATC_LOCK_IF (0x1 << 20) /* Interface Lock */ 53#define ATC_LOCK_IF (0x1 << 20) /* Interface Lock */
50#define ATC_LOCK_B (0x1 << 21) /* AHB Bus Lock */ 54#define ATC_LOCK_B (0x1 << 21) /* AHB Bus Lock */
diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h
index f6d30cc1cb77..beac6b8b6a7b 100644
--- a/include/linux/platform_data/dma-imx.h
+++ b/include/linux/platform_data/dma-imx.h
@@ -60,10 +60,8 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan)
60 60
61static inline int imx_dma_is_general_purpose(struct dma_chan *chan) 61static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
62{ 62{
63 return strstr(dev_name(chan->device->dev), "sdma") || 63 return !strcmp(chan->device->dev->driver->name, "imx-sdma") ||
64 !strcmp(dev_name(chan->device->dev), "imx1-dma") || 64 !strcmp(chan->device->dev->driver->name, "imx-dma");
65 !strcmp(dev_name(chan->device->dev), "imx21-dma") ||
66 !strcmp(dev_name(chan->device->dev), "imx27-dma");
67} 65}
68 66
69#endif 67#endif
diff --git a/include/linux/platform_data/dma-rcar-hpbdma.h b/include/linux/platform_data/dma-rcar-hpbdma.h
new file mode 100644
index 000000000000..648b8ea61a22
--- /dev/null
+++ b/include/linux/platform_data/dma-rcar-hpbdma.h
@@ -0,0 +1,103 @@
1/*
2 * Copyright (C) 2011-2013 Renesas Electronics Corporation
3 * Copyright (C) 2013 Cogent Embedded, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation.
8 */
9
10#ifndef __DMA_RCAR_HPBDMA_H
11#define __DMA_RCAR_HPBDMA_H
12
13#include <linux/bitops.h>
14#include <linux/types.h>
15
16/* Transmit sizes and respective register values */
17enum {
18 XMIT_SZ_8BIT = 0,
19 XMIT_SZ_16BIT = 1,
20 XMIT_SZ_32BIT = 2,
21 XMIT_SZ_MAX
22};
23
24/* DMA control register (DCR) bits */
25#define HPB_DMAE_DCR_DTAMD (1u << 26)
26#define HPB_DMAE_DCR_DTAC (1u << 25)
27#define HPB_DMAE_DCR_DTAU (1u << 24)
28#define HPB_DMAE_DCR_DTAU1 (1u << 23)
29#define HPB_DMAE_DCR_SWMD (1u << 22)
30#define HPB_DMAE_DCR_BTMD (1u << 21)
31#define HPB_DMAE_DCR_PKMD (1u << 20)
32#define HPB_DMAE_DCR_CT (1u << 18)
33#define HPB_DMAE_DCR_ACMD (1u << 17)
34#define HPB_DMAE_DCR_DIP (1u << 16)
35#define HPB_DMAE_DCR_SMDL (1u << 13)
36#define HPB_DMAE_DCR_SPDAM (1u << 12)
37#define HPB_DMAE_DCR_SDRMD_MASK (3u << 10)
38#define HPB_DMAE_DCR_SDRMD_MOD (0u << 10)
39#define HPB_DMAE_DCR_SDRMD_AUTO (1u << 10)
40#define HPB_DMAE_DCR_SDRMD_TIMER (2u << 10)
41#define HPB_DMAE_DCR_SPDS_MASK (3u << 8)
42#define HPB_DMAE_DCR_SPDS_8BIT (0u << 8)
43#define HPB_DMAE_DCR_SPDS_16BIT (1u << 8)
44#define HPB_DMAE_DCR_SPDS_32BIT (2u << 8)
45#define HPB_DMAE_DCR_DMDL (1u << 5)
46#define HPB_DMAE_DCR_DPDAM (1u << 4)
47#define HPB_DMAE_DCR_DDRMD_MASK (3u << 2)
48#define HPB_DMAE_DCR_DDRMD_MOD (0u << 2)
49#define HPB_DMAE_DCR_DDRMD_AUTO (1u << 2)
50#define HPB_DMAE_DCR_DDRMD_TIMER (2u << 2)
51#define HPB_DMAE_DCR_DPDS_MASK (3u << 0)
52#define HPB_DMAE_DCR_DPDS_8BIT (0u << 0)
53#define HPB_DMAE_DCR_DPDS_16BIT (1u << 0)
54#define HPB_DMAE_DCR_DPDS_32BIT (2u << 0)
55
56/* Asynchronous reset register (ASYNCRSTR) bits */
57#define HPB_DMAE_ASYNCRSTR_ASRST41 BIT(10)
58#define HPB_DMAE_ASYNCRSTR_ASRST40 BIT(9)
59#define HPB_DMAE_ASYNCRSTR_ASRST39 BIT(8)
60#define HPB_DMAE_ASYNCRSTR_ASRST27 BIT(7)
61#define HPB_DMAE_ASYNCRSTR_ASRST26 BIT(6)
62#define HPB_DMAE_ASYNCRSTR_ASRST25 BIT(5)
63#define HPB_DMAE_ASYNCRSTR_ASRST24 BIT(4)
64#define HPB_DMAE_ASYNCRSTR_ASRST23 BIT(3)
65#define HPB_DMAE_ASYNCRSTR_ASRST22 BIT(2)
66#define HPB_DMAE_ASYNCRSTR_ASRST21 BIT(1)
67#define HPB_DMAE_ASYNCRSTR_ASRST20 BIT(0)
68
69struct hpb_dmae_slave_config {
70 unsigned int id;
71 dma_addr_t addr;
72 u32 dcr;
73 u32 port;
74 u32 rstr;
75 u32 mdr;
76 u32 mdm;
77 u32 flags;
78#define HPB_DMAE_SET_ASYNC_RESET BIT(0)
79#define HPB_DMAE_SET_ASYNC_MODE BIT(1)
80 u32 dma_ch;
81};
82
83#define HPB_DMAE_CHANNEL(_irq, _s_id) \
84{ \
85 .ch_irq = _irq, \
86 .s_id = _s_id, \
87}
88
89struct hpb_dmae_channel {
90 unsigned int ch_irq;
91 unsigned int s_id;
92};
93
94struct hpb_dmae_pdata {
95 const struct hpb_dmae_slave_config *slaves;
96 int num_slaves;
97 const struct hpb_dmae_channel *channels;
98 int num_channels;
99 const unsigned int ts_shift[XMIT_SZ_MAX];
100 int num_hw_channels;
101};
102
103#endif
diff --git a/include/linux/platform_data/dma-ste-dma40.h b/include/linux/platform_data/dma-ste-dma40.h
index 4b781014b0a0..1bb9b1852256 100644
--- a/include/linux/platform_data/dma-ste-dma40.h
+++ b/include/linux/platform_data/dma-ste-dma40.h
@@ -70,23 +70,8 @@ enum stedma40_flow_ctrl {
70 STEDMA40_FLOW_CTRL, 70 STEDMA40_FLOW_CTRL,
71}; 71};
72 72
73enum stedma40_periph_data_width {
74 STEDMA40_BYTE_WIDTH = STEDMA40_ESIZE_8_BIT,
75 STEDMA40_HALFWORD_WIDTH = STEDMA40_ESIZE_16_BIT,
76 STEDMA40_WORD_WIDTH = STEDMA40_ESIZE_32_BIT,
77 STEDMA40_DOUBLEWORD_WIDTH = STEDMA40_ESIZE_64_BIT
78};
79
80enum stedma40_xfer_dir {
81 STEDMA40_MEM_TO_MEM = 1,
82 STEDMA40_MEM_TO_PERIPH,
83 STEDMA40_PERIPH_TO_MEM,
84 STEDMA40_PERIPH_TO_PERIPH
85};
86
87
88/** 73/**
89 * struct stedma40_chan_cfg - dst/src channel configuration 74 * struct stedma40_half_channel_info - dst/src channel configuration
90 * 75 *
91 * @big_endian: true if the src/dst should be read as big endian 76 * @big_endian: true if the src/dst should be read as big endian
92 * @data_width: Data width of the src/dst hardware 77 * @data_width: Data width of the src/dst hardware
@@ -95,7 +80,7 @@ enum stedma40_xfer_dir {
95 */ 80 */
96struct stedma40_half_channel_info { 81struct stedma40_half_channel_info {
97 bool big_endian; 82 bool big_endian;
98 enum stedma40_periph_data_width data_width; 83 enum dma_slave_buswidth data_width;
99 int psize; 84 int psize;
100 enum stedma40_flow_ctrl flow_ctrl; 85 enum stedma40_flow_ctrl flow_ctrl;
101}; 86};
@@ -109,8 +94,7 @@ struct stedma40_half_channel_info {
109 * version 3+, i.e DB8500v2+ 94 * version 3+, i.e DB8500v2+
110 * @mode: channel mode: physical, logical, or operation 95 * @mode: channel mode: physical, logical, or operation
111 * @mode_opt: options for the chosen channel mode 96 * @mode_opt: options for the chosen channel mode
112 * @src_dev_type: Src device type 97 * @dev_type: src/dst device type (driver uses dir to figure out which)
113 * @dst_dev_type: Dst device type
114 * @src_info: Parameters for dst half channel 98 * @src_info: Parameters for dst half channel
115 * @dst_info: Parameters for dst half channel 99 * @dst_info: Parameters for dst half channel
116 * @use_fixed_channel: if true, use physical channel specified by phy_channel 100 * @use_fixed_channel: if true, use physical channel specified by phy_channel
@@ -121,13 +105,12 @@ struct stedma40_half_channel_info {
121 * 105 *
122 */ 106 */
123struct stedma40_chan_cfg { 107struct stedma40_chan_cfg {
124 enum stedma40_xfer_dir dir; 108 enum dma_transfer_direction dir;
125 bool high_priority; 109 bool high_priority;
126 bool realtime; 110 bool realtime;
127 enum stedma40_mode mode; 111 enum stedma40_mode mode;
128 enum stedma40_mode_opt mode_opt; 112 enum stedma40_mode_opt mode_opt;
129 int src_dev_type; 113 int dev_type;
130 int dst_dev_type;
131 struct stedma40_half_channel_info src_info; 114 struct stedma40_half_channel_info src_info;
132 struct stedma40_half_channel_info dst_info; 115 struct stedma40_half_channel_info dst_info;
133 116
@@ -138,13 +121,8 @@ struct stedma40_chan_cfg {
138/** 121/**
139 * struct stedma40_platform_data - Configuration struct for the dma device. 122 * struct stedma40_platform_data - Configuration struct for the dma device.
140 * 123 *
141 * @dev_len: length of dev_tx and dev_rx
142 * @dev_tx: mapping between destination event line and io address 124 * @dev_tx: mapping between destination event line and io address
143 * @dev_rx: mapping between source event line and io address 125 * @dev_rx: mapping between source event line and io address
144 * @memcpy: list of memcpy event lines
145 * @memcpy_len: length of memcpy
146 * @memcpy_conf_phy: default configuration of physical channel memcpy
147 * @memcpy_conf_log: default configuration of logical channel memcpy
148 * @disabled_channels: A vector, ending with -1, that marks physical channels 126 * @disabled_channels: A vector, ending with -1, that marks physical channels
149 * that are for different reasons not available for the driver. 127 * that are for different reasons not available for the driver.
150 * @soft_lli_chans: A vector, that marks physical channels will use LLI by SW 128 * @soft_lli_chans: A vector, that marks physical channels will use LLI by SW
@@ -154,22 +132,17 @@ struct stedma40_chan_cfg {
154 * @num_of_soft_lli_chans: The number of channels that needs to be configured 132 * @num_of_soft_lli_chans: The number of channels that needs to be configured
155 * to use SoftLLI. 133 * to use SoftLLI.
156 * @use_esram_lcla: flag for mapping the lcla into esram region 134 * @use_esram_lcla: flag for mapping the lcla into esram region
135 * @num_of_memcpy_chans: The number of channels reserved for memcpy.
157 * @num_of_phy_chans: The number of physical channels implemented in HW. 136 * @num_of_phy_chans: The number of physical channels implemented in HW.
158 * 0 means reading the number of channels from DMA HW but this is only valid 137 * 0 means reading the number of channels from DMA HW but this is only valid
159 * for 'multiple of 4' channels, like 8. 138 * for 'multiple of 4' channels, like 8.
160 */ 139 */
161struct stedma40_platform_data { 140struct stedma40_platform_data {
162 u32 dev_len;
163 const dma_addr_t *dev_tx;
164 const dma_addr_t *dev_rx;
165 int *memcpy;
166 u32 memcpy_len;
167 struct stedma40_chan_cfg *memcpy_conf_phy;
168 struct stedma40_chan_cfg *memcpy_conf_log;
169 int disabled_channels[STEDMA40_MAX_PHYS]; 141 int disabled_channels[STEDMA40_MAX_PHYS];
170 int *soft_lli_chans; 142 int *soft_lli_chans;
171 int num_of_soft_lli_chans; 143 int num_of_soft_lli_chans;
172 bool use_esram_lcla; 144 bool use_esram_lcla;
145 int num_of_memcpy_chans;
173 int num_of_phy_chans; 146 int num_of_phy_chans;
174}; 147};
175 148
diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h
new file mode 100644
index 000000000000..179fb91bb5f2
--- /dev/null
+++ b/include/linux/platform_data/edma.h
@@ -0,0 +1,185 @@
1/*
2 * TI EDMA definitions
3 *
4 * Copyright (C) 2006-2013 Texas Instruments.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12/*
13 * This EDMA3 programming framework exposes two basic kinds of resource:
14 *
15 * Channel Triggers transfers, usually from a hardware event but
16 * also manually or by "chaining" from DMA completions.
17 * Each channel is coupled to a Parameter RAM (PaRAM) slot.
18 *
19 * Slot Each PaRAM slot holds a DMA transfer descriptor (PaRAM
20 * "set"), source and destination addresses, a link to a
21 * next PaRAM slot (if any), options for the transfer, and
22 * instructions for updating those addresses. There are
23 * more than twice as many slots as event channels.
24 *
25 * Each PaRAM set describes a sequence of transfers, either for one large
26 * buffer or for several discontiguous smaller buffers. An EDMA transfer
27 * is driven only from a channel, which performs the transfers specified
28 * in its PaRAM slot until there are no more transfers. When that last
29 * transfer completes, the "link" field may be used to reload the channel's
30 * PaRAM slot with a new transfer descriptor.
31 *
32 * The EDMA Channel Controller (CC) maps requests from channels into physical
33 * Transfer Controller (TC) requests when the channel triggers (by hardware
34 * or software events, or by chaining). The two physical DMA channels provided
35 * by the TCs are thus shared by many logical channels.
36 *
37 * DaVinci hardware also has a "QDMA" mechanism which is not currently
38 * supported through this interface. (DSP firmware uses it though.)
39 */
40
41#ifndef EDMA_H_
42#define EDMA_H_
43
44/* PaRAM slots are laid out like this */
45struct edmacc_param {
46 unsigned int opt;
47 unsigned int src;
48 unsigned int a_b_cnt;
49 unsigned int dst;
50 unsigned int src_dst_bidx;
51 unsigned int link_bcntrld;
52 unsigned int src_dst_cidx;
53 unsigned int ccnt;
54};
55
56/* fields in edmacc_param.opt */
57#define SAM BIT(0)
58#define DAM BIT(1)
59#define SYNCDIM BIT(2)
60#define STATIC BIT(3)
61#define EDMA_FWID (0x07 << 8)
62#define TCCMODE BIT(11)
63#define EDMA_TCC(t) ((t) << 12)
64#define TCINTEN BIT(20)
65#define ITCINTEN BIT(21)
66#define TCCHEN BIT(22)
67#define ITCCHEN BIT(23)
68
69/*ch_status paramater of callback function possible values*/
70#define DMA_COMPLETE 1
71#define DMA_CC_ERROR 2
72#define DMA_TC1_ERROR 3
73#define DMA_TC2_ERROR 4
74
75enum address_mode {
76 INCR = 0,
77 FIFO = 1
78};
79
80enum fifo_width {
81 W8BIT = 0,
82 W16BIT = 1,
83 W32BIT = 2,
84 W64BIT = 3,
85 W128BIT = 4,
86 W256BIT = 5
87};
88
89enum dma_event_q {
90 EVENTQ_0 = 0,
91 EVENTQ_1 = 1,
92 EVENTQ_2 = 2,
93 EVENTQ_3 = 3,
94 EVENTQ_DEFAULT = -1
95};
96
97enum sync_dimension {
98 ASYNC = 0,
99 ABSYNC = 1
100};
101
102#define EDMA_CTLR_CHAN(ctlr, chan) (((ctlr) << 16) | (chan))
103#define EDMA_CTLR(i) ((i) >> 16)
104#define EDMA_CHAN_SLOT(i) ((i) & 0xffff)
105
106#define EDMA_CHANNEL_ANY -1 /* for edma_alloc_channel() */
107#define EDMA_SLOT_ANY -1 /* for edma_alloc_slot() */
108#define EDMA_CONT_PARAMS_ANY 1001
109#define EDMA_CONT_PARAMS_FIXED_EXACT 1002
110#define EDMA_CONT_PARAMS_FIXED_NOT_EXACT 1003
111
112#define EDMA_MAX_CC 2
113
114/* alloc/free DMA channels and their dedicated parameter RAM slots */
115int edma_alloc_channel(int channel,
116 void (*callback)(unsigned channel, u16 ch_status, void *data),
117 void *data, enum dma_event_q);
118void edma_free_channel(unsigned channel);
119
120/* alloc/free parameter RAM slots */
121int edma_alloc_slot(unsigned ctlr, int slot);
122void edma_free_slot(unsigned slot);
123
124/* alloc/free a set of contiguous parameter RAM slots */
125int edma_alloc_cont_slots(unsigned ctlr, unsigned int id, int slot, int count);
126int edma_free_cont_slots(unsigned slot, int count);
127
128/* calls that operate on part of a parameter RAM slot */
129void edma_set_src(unsigned slot, dma_addr_t src_port,
130 enum address_mode mode, enum fifo_width);
131void edma_set_dest(unsigned slot, dma_addr_t dest_port,
132 enum address_mode mode, enum fifo_width);
133void edma_get_position(unsigned slot, dma_addr_t *src, dma_addr_t *dst);
134void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx);
135void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx);
136void edma_set_transfer_params(unsigned slot, u16 acnt, u16 bcnt, u16 ccnt,
137 u16 bcnt_rld, enum sync_dimension sync_mode);
138void edma_link(unsigned from, unsigned to);
139void edma_unlink(unsigned from);
140
141/* calls that operate on an entire parameter RAM slot */
142void edma_write_slot(unsigned slot, const struct edmacc_param *params);
143void edma_read_slot(unsigned slot, struct edmacc_param *params);
144
145/* channel control operations */
146int edma_start(unsigned channel);
147void edma_stop(unsigned channel);
148void edma_clean_channel(unsigned channel);
149void edma_clear_event(unsigned channel);
150void edma_pause(unsigned channel);
151void edma_resume(unsigned channel);
152
153struct edma_rsv_info {
154
155 const s16 (*rsv_chans)[2];
156 const s16 (*rsv_slots)[2];
157};
158
159/* platform_data for EDMA driver */
160struct edma_soc_info {
161
162 /* how many dma resources of each type */
163 unsigned n_channel;
164 unsigned n_region;
165 unsigned n_slot;
166 unsigned n_tc;
167 unsigned n_cc;
168 /*
169 * Default queue is expected to be a low-priority queue.
170 * This way, long transfers on the default queue started
171 * by the codec engine will not cause audio defects.
172 */
173 enum dma_event_q default_queue;
174
175 /* Resource reservation for other cores */
176 struct edma_rsv_info *rsv;
177
178 s8 (*queue_tc_mapping)[2];
179 s8 (*queue_priority_mapping)[2];
180 const s16 (*xbar_chans)[2];
181};
182
183int edma_trigger_channel(unsigned);
184
185#endif
diff --git a/include/linux/platform_data/efm32-spi.h b/include/linux/platform_data/efm32-spi.h
new file mode 100644
index 000000000000..31b19ca1d73a
--- /dev/null
+++ b/include/linux/platform_data/efm32-spi.h
@@ -0,0 +1,14 @@
1#ifndef __LINUX_PLATFORM_DATA_EFM32_SPI_H__
2#define __LINUX_PLATFORM_DATA_EFM32_SPI_H__
3
4#include <linux/types.h>
5
6/**
7 * struct efm32_spi_pdata
8 * @location: pinmux location for the I/O pins (to be written to the ROUTE
9 * register)
10 */
11struct efm32_spi_pdata {
12 u8 location;
13};
14#endif /* ifndef __LINUX_PLATFORM_DATA_EFM32_SPI_H__ */
diff --git a/include/linux/platform_data/exynos_thermal.h b/include/linux/platform_data/exynos_thermal.h
deleted file mode 100644
index da7e6274b175..000000000000
--- a/include/linux/platform_data/exynos_thermal.h
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2 * exynos_thermal.h - Samsung EXYNOS TMU (Thermal Management Unit)
3 *
4 * Copyright (C) 2011 Samsung Electronics
5 * Donggeun Kim <dg77.kim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * 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 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef _LINUX_EXYNOS_THERMAL_H
23#define _LINUX_EXYNOS_THERMAL_H
24#include <linux/cpu_cooling.h>
25
26enum calibration_type {
27 TYPE_ONE_POINT_TRIMMING,
28 TYPE_TWO_POINT_TRIMMING,
29 TYPE_NONE,
30};
31
32enum soc_type {
33 SOC_ARCH_EXYNOS4210 = 1,
34 SOC_ARCH_EXYNOS,
35};
36/**
37 * struct freq_clip_table
38 * @freq_clip_max: maximum frequency allowed for this cooling state.
39 * @temp_level: Temperature level at which the temperature clipping will
40 * happen.
41 * @mask_val: cpumask of the allowed cpu's where the clipping will take place.
42 *
43 * This structure is required to be filled and passed to the
44 * cpufreq_cooling_unregister function.
45 */
46struct freq_clip_table {
47 unsigned int freq_clip_max;
48 unsigned int temp_level;
49 const struct cpumask *mask_val;
50};
51
52/**
53 * struct exynos_tmu_platform_data
54 * @threshold: basic temperature for generating interrupt
55 * 25 <= threshold <= 125 [unit: degree Celsius]
56 * @threshold_falling: differntial value for setting threshold
57 * of temperature falling interrupt.
58 * @trigger_levels: array for each interrupt levels
59 * [unit: degree Celsius]
60 * 0: temperature for trigger_level0 interrupt
61 * condition for trigger_level0 interrupt:
62 * current temperature > threshold + trigger_levels[0]
63 * 1: temperature for trigger_level1 interrupt
64 * condition for trigger_level1 interrupt:
65 * current temperature > threshold + trigger_levels[1]
66 * 2: temperature for trigger_level2 interrupt
67 * condition for trigger_level2 interrupt:
68 * current temperature > threshold + trigger_levels[2]
69 * 3: temperature for trigger_level3 interrupt
70 * condition for trigger_level3 interrupt:
71 * current temperature > threshold + trigger_levels[3]
72 * @trigger_level0_en:
73 * 1 = enable trigger_level0 interrupt,
74 * 0 = disable trigger_level0 interrupt
75 * @trigger_level1_en:
76 * 1 = enable trigger_level1 interrupt,
77 * 0 = disable trigger_level1 interrupt
78 * @trigger_level2_en:
79 * 1 = enable trigger_level2 interrupt,
80 * 0 = disable trigger_level2 interrupt
81 * @trigger_level3_en:
82 * 1 = enable trigger_level3 interrupt,
83 * 0 = disable trigger_level3 interrupt
84 * @gain: gain of amplifier in the positive-TC generator block
85 * 0 <= gain <= 15
86 * @reference_voltage: reference voltage of amplifier
87 * in the positive-TC generator block
88 * 0 <= reference_voltage <= 31
89 * @noise_cancel_mode: noise cancellation mode
90 * 000, 100, 101, 110 and 111 can be different modes
91 * @type: determines the type of SOC
92 * @efuse_value: platform defined fuse value
93 * @cal_type: calibration type for temperature
94 * @freq_clip_table: Table representing frequency reduction percentage.
95 * @freq_tab_count: Count of the above table as frequency reduction may
96 * applicable to only some of the trigger levels.
97 *
98 * This structure is required for configuration of exynos_tmu driver.
99 */
100struct exynos_tmu_platform_data {
101 u8 threshold;
102 u8 threshold_falling;
103 u8 trigger_levels[4];
104 bool trigger_level0_en;
105 bool trigger_level1_en;
106 bool trigger_level2_en;
107 bool trigger_level3_en;
108
109 u8 gain;
110 u8 reference_voltage;
111 u8 noise_cancel_mode;
112 u32 efuse_value;
113
114 enum calibration_type cal_type;
115 enum soc_type type;
116 struct freq_clip_table freq_tab[4];
117 unsigned int freq_tab_count;
118};
119#endif /* _LINUX_EXYNOS_THERMAL_H */
diff --git a/include/linux/clk/mvebu.h b/include/linux/platform_data/g762.h
index 8c4ae713b063..d3c51283764d 100644
--- a/include/linux/clk/mvebu.h
+++ b/include/linux/platform_data/g762.h
@@ -1,4 +1,8 @@
1/* 1/*
2 * Platform data structure for g762 fan controller driver
3 *
4 * Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org>
5 *
2 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
@@ -13,10 +17,21 @@
13 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 */ 19 */
20#ifndef __LINUX_PLATFORM_DATA_G762_H__
21#define __LINUX_PLATFORM_DATA_G762_H__
16 22
17#ifndef __CLK_MVEBU_H_ 23/*
18#define __CLK_MVEBU_H_ 24 * Following structure can be used to set g762 driver platform specific data
25 * during board init. Note that passing a sparse structure is possible but
26 * will result in non-specified attributes to be set to default value, hence
27 * overloading those installed during boot (e.g. by u-boot).
28 */
19 29
20void __init mvebu_clocks_init(void); 30struct g762_platform_data {
31 u32 fan_startv;
32 u32 fan_gear_mode;
33 u32 pwm_polarity;
34 u32 clk_freq;
35};
21 36
22#endif 37#endif /* __LINUX_PLATFORM_DATA_G762_H__ */
diff --git a/include/linux/platform_data/gpio-em.h b/include/linux/platform_data/gpio-em.h
index 573edfb046c4..7c5a519d2dcd 100644
--- a/include/linux/platform_data/gpio-em.h
+++ b/include/linux/platform_data/gpio-em.h
@@ -5,6 +5,7 @@ struct gpio_em_config {
5 unsigned int gpio_base; 5 unsigned int gpio_base;
6 unsigned int irq_base; 6 unsigned int irq_base;
7 unsigned int number_of_pins; 7 unsigned int number_of_pins;
8 const char *pctl_name;
8}; 9};
9 10
10#endif /* __GPIO_EM_H__ */ 11#endif /* __GPIO_EM_H__ */
diff --git a/include/linux/platform_data/gpio-rcar.h b/include/linux/platform_data/gpio-rcar.h
index b253f77a7ddf..2d8d69432813 100644
--- a/include/linux/platform_data/gpio-rcar.h
+++ b/include/linux/platform_data/gpio-rcar.h
@@ -17,10 +17,13 @@
17#define __GPIO_RCAR_H__ 17#define __GPIO_RCAR_H__
18 18
19struct gpio_rcar_config { 19struct gpio_rcar_config {
20 unsigned int gpio_base; 20 int gpio_base;
21 unsigned int irq_base; 21 unsigned int irq_base;
22 unsigned int number_of_pins; 22 unsigned int number_of_pins;
23 const char *pctl_name; 23 const char *pctl_name;
24 unsigned has_both_edge_trigger:1;
24}; 25};
25 26
27#define RCAR_GP_PIN(bank, pin) (((bank) * 32) + (pin))
28
26#endif /* __GPIO_RCAR_H__ */ 29#endif /* __GPIO_RCAR_H__ */
diff --git a/include/linux/platform_data/gpio_backlight.h b/include/linux/platform_data/gpio_backlight.h
new file mode 100644
index 000000000000..5ae0d9c80d4d
--- /dev/null
+++ b/include/linux/platform_data/gpio_backlight.h
@@ -0,0 +1,21 @@
1/*
2 * gpio_backlight.h - Simple GPIO-controlled backlight
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __GPIO_BACKLIGHT_H__
9#define __GPIO_BACKLIGHT_H__
10
11struct device;
12
13struct gpio_backlight_platform_data {
14 struct device *fbdev;
15 int gpio;
16 int def_value;
17 bool active_low;
18 const char *name;
19};
20
21#endif
diff --git a/include/linux/platform_data/leds-lp55xx.h b/include/linux/platform_data/leds-lp55xx.h
index 202e290faea8..51a2ff579d60 100644
--- a/include/linux/platform_data/leds-lp55xx.h
+++ b/include/linux/platform_data/leds-lp55xx.h
@@ -36,6 +36,13 @@ struct lp55xx_predef_pattern {
36 u8 size_b; 36 u8 size_b;
37}; 37};
38 38
39enum lp8501_pwr_sel {
40 LP8501_ALL_VDD, /* D1~9 are connected to VDD */
41 LP8501_6VDD_3VOUT, /* D1~6 with VDD, D7~9 with VOUT */
42 LP8501_3VDD_6VOUT, /* D1~6 with VOUT, D7~9 with VDD */
43 LP8501_ALL_VOUT, /* D1~9 are connected to VOUT */
44};
45
39/* 46/*
40 * struct lp55xx_platform_data 47 * struct lp55xx_platform_data
41 * @led_config : Configurable led class device 48 * @led_config : Configurable led class device
@@ -67,6 +74,9 @@ struct lp55xx_platform_data {
67 /* Predefined pattern data */ 74 /* Predefined pattern data */
68 struct lp55xx_predef_pattern *patterns; 75 struct lp55xx_predef_pattern *patterns;
69 unsigned int num_patterns; 76 unsigned int num_patterns;
77
78 /* LP8501 specific */
79 enum lp8501_pwr_sel pwr_sel;
70}; 80};
71 81
72#endif /* _LEDS_LP55XX_H */ 82#endif /* _LEDS_LP55XX_H */
diff --git a/include/linux/platform_data/leds-pca9633.h b/include/linux/platform_data/leds-pca963x.h
index c5bf29b6fa7f..e731f0036329 100644
--- a/include/linux/platform_data/leds-pca9633.h
+++ b/include/linux/platform_data/leds-pca963x.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * PCA9633 LED chip driver. 2 * PCA963X LED chip driver.
3 * 3 *
4 * Copyright 2012 bct electronic GmbH 4 * Copyright 2012 bct electronic GmbH
5 * Copyright 2013 Qtechnology A/S
5 * 6 *
6 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
@@ -18,18 +19,24 @@
18 * 02110-1301 USA 19 * 02110-1301 USA
19 */ 20 */
20 21
21#ifndef __LINUX_PCA9633_H 22#ifndef __LINUX_PCA963X_H
22#define __LINUX_PCA9633_H 23#define __LINUX_PCA963X_H
23#include <linux/leds.h> 24#include <linux/leds.h>
24 25
25enum pca9633_outdrv { 26enum pca963x_outdrv {
26 PCA9633_OPEN_DRAIN, 27 PCA963X_OPEN_DRAIN,
27 PCA9633_TOTEM_POLE, /* aka push-pull */ 28 PCA963X_TOTEM_POLE, /* aka push-pull */
28}; 29};
29 30
30struct pca9633_platform_data { 31enum pca963x_blink_type {
32 PCA963X_SW_BLINK,
33 PCA963X_HW_BLINK,
34};
35
36struct pca963x_platform_data {
31 struct led_platform_data leds; 37 struct led_platform_data leds;
32 enum pca9633_outdrv outdrv; 38 enum pca963x_outdrv outdrv;
39 enum pca963x_blink_type blink_type;
33}; 40};
34 41
35#endif /* __LINUX_PCA9633_H*/ 42#endif /* __LINUX_PCA963X_H*/
diff --git a/include/linux/platform_data/leds-renesas-tpu.h b/include/linux/platform_data/leds-renesas-tpu.h
deleted file mode 100644
index 055387086fc1..000000000000
--- a/include/linux/platform_data/leds-renesas-tpu.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __LEDS_RENESAS_TPU_H__
2#define __LEDS_RENESAS_TPU_H__
3
4struct led_renesas_tpu_config {
5 char *name;
6 unsigned pin_gpio_fn;
7 unsigned pin_gpio;
8 unsigned int channel_offset;
9 unsigned int timer_bit;
10 unsigned int max_brightness;
11 unsigned int refresh_rate;
12};
13
14#endif /* __LEDS_RENESAS_TPU_H__ */
diff --git a/include/linux/platform_data/lv5207lp.h b/include/linux/platform_data/lv5207lp.h
new file mode 100644
index 000000000000..7dc4d9a219a6
--- /dev/null
+++ b/include/linux/platform_data/lv5207lp.h
@@ -0,0 +1,19 @@
1/*
2 * lv5207lp.h - Sanyo LV5207LP LEDs Driver
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __LV5207LP_H__
9#define __LV5207LP_H__
10
11struct device;
12
13struct lv5207lp_platform_data {
14 struct device *fbdev;
15 unsigned int max_value;
16 unsigned int def_value;
17};
18
19#endif
diff --git a/include/linux/platform_data/mailbox-omap.h b/include/linux/platform_data/mailbox-omap.h
new file mode 100644
index 000000000000..4631dbb4255e
--- /dev/null
+++ b/include/linux/platform_data/mailbox-omap.h
@@ -0,0 +1,58 @@
1/*
2 * mailbox-omap.h
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef _PLAT_MAILBOX_H
17#define _PLAT_MAILBOX_H
18
19/* Interrupt register configuration types */
20#define MBOX_INTR_CFG_TYPE1 (0)
21#define MBOX_INTR_CFG_TYPE2 (1)
22
23/**
24 * struct omap_mbox_dev_info - OMAP mailbox device attribute info
25 * @name: name of the mailbox device
26 * @tx_id: mailbox queue id used for transmitting messages
27 * @rx_id: mailbox queue id on which messages are received
28 * @irq_id: irq identifier number to use from the hwmod data
29 * @usr_id: mailbox user id for identifying the interrupt into
30 * the MPU interrupt controller.
31 */
32struct omap_mbox_dev_info {
33 const char *name;
34 u32 tx_id;
35 u32 rx_id;
36 u32 irq_id;
37 u32 usr_id;
38};
39
40/**
41 * struct omap_mbox_pdata - OMAP mailbox platform data
42 * @intr_type: type of interrupt configuration registers used
43 while programming mailbox queue interrupts
44 * @num_users: number of users (processor devices) that the mailbox
45 * h/w block can interrupt
46 * @num_fifos: number of h/w fifos within the mailbox h/w block
47 * @info_cnt: number of mailbox devices for the platform
48 * @info: array of mailbox device attributes
49 */
50struct omap_mbox_pdata {
51 u32 intr_type;
52 u32 num_users;
53 u32 num_fifos;
54 u32 info_cnt;
55 struct omap_mbox_dev_info *info;
56};
57
58#endif /* _PLAT_MAILBOX_H */
diff --git a/include/linux/platform_data/max310x.h b/include/linux/platform_data/max310x.h
index 91648bf5fc5c..dd11dcd1a184 100644
--- a/include/linux/platform_data/max310x.h
+++ b/include/linux/platform_data/max310x.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Maxim (Dallas) MAX3107/8 serial driver 2 * Maxim (Dallas) MAX3107/8/9, MAX14830 serial driver
3 * 3 *
4 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru> 4 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru>
5 * 5 *
@@ -37,14 +37,13 @@
37 * }; 37 * };
38 */ 38 */
39 39
40#define MAX310X_MAX_UARTS 1 40#define MAX310X_MAX_UARTS 4
41 41
42/* MAX310X platform data structure */ 42/* MAX310X platform data structure */
43struct max310x_pdata { 43struct max310x_pdata {
44 /* Flags global to driver */ 44 /* Flags global to driver */
45 const u8 driver_flags:2; 45 const u8 driver_flags;
46#define MAX310X_EXT_CLK (0x00000001) /* External clock enable */ 46#define MAX310X_EXT_CLK (0x00000001) /* External clock enable */
47#define MAX310X_AUTOSLEEP (0x00000002) /* Enable AutoSleep mode */
48 /* Flags global to UART port */ 47 /* Flags global to UART port */
49 const u8 uart_flags[MAX310X_MAX_UARTS]; 48 const u8 uart_flags[MAX310X_MAX_UARTS];
50#define MAX310X_LOOPBACK (0x00000001) /* Loopback mode enable */ 49#define MAX310X_LOOPBACK (0x00000001) /* Loopback mode enable */
@@ -60,8 +59,6 @@ struct max310x_pdata {
60 void (*init)(void); 59 void (*init)(void);
61 /* Called before finish */ 60 /* Called before finish */
62 void (*exit)(void); 61 void (*exit)(void);
63 /* Suspend callback */
64 void (*suspend)(int do_suspend);
65}; 62};
66 63
67#endif 64#endif
diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h
index b4a0521ce411..d44912d81578 100644
--- a/include/linux/platform_data/mmc-esdhc-imx.h
+++ b/include/linux/platform_data/mmc-esdhc-imx.h
@@ -40,5 +40,6 @@ struct esdhc_platform_data {
40 enum wp_types wp_type; 40 enum wp_types wp_type;
41 enum cd_types cd_type; 41 enum cd_types cd_type;
42 int max_bus_width; 42 int max_bus_width;
43 unsigned int f_max;
43}; 44};
44#endif /* __ASM_ARCH_IMX_ESDHC_H */ 45#endif /* __ASM_ARCH_IMX_ESDHC_H */
diff --git a/include/linux/platform_data/mmc-pxamci.h b/include/linux/platform_data/mmc-pxamci.h
index 9eb515bb799d..1706b3597ce0 100644
--- a/include/linux/platform_data/mmc-pxamci.h
+++ b/include/linux/platform_data/mmc-pxamci.h
@@ -12,7 +12,7 @@ struct pxamci_platform_data {
12 unsigned long detect_delay_ms; /* delay in millisecond before detecting cards after interrupt */ 12 unsigned long detect_delay_ms; /* delay in millisecond before detecting cards after interrupt */
13 int (*init)(struct device *, irq_handler_t , void *); 13 int (*init)(struct device *, irq_handler_t , void *);
14 int (*get_ro)(struct device *); 14 int (*get_ro)(struct device *);
15 void (*setpower)(struct device *, unsigned int); 15 int (*setpower)(struct device *, unsigned int);
16 void (*exit)(struct device *, void *); 16 void (*exit)(struct device *, void *);
17 int gpio_card_detect; /* gpio detecting card insertion */ 17 int gpio_card_detect; /* gpio detecting card insertion */
18 int gpio_card_ro; /* gpio detecting read only toggle */ 18 int gpio_card_ro; /* gpio detecting read only toggle */
diff --git a/include/linux/platform_data/mtd-nand-pxa3xx.h b/include/linux/platform_data/mtd-nand-pxa3xx.h
index c42f39f20195..ffb801998e5d 100644
--- a/include/linux/platform_data/mtd-nand-pxa3xx.h
+++ b/include/linux/platform_data/mtd-nand-pxa3xx.h
@@ -16,19 +16,6 @@ struct pxa3xx_nand_timing {
16 unsigned int tAR; /* ND_ALE low to ND_nRE low delay */ 16 unsigned int tAR; /* ND_ALE low to ND_nRE low delay */
17}; 17};
18 18
19struct pxa3xx_nand_cmdset {
20 uint16_t read1;
21 uint16_t read2;
22 uint16_t program;
23 uint16_t read_status;
24 uint16_t read_id;
25 uint16_t erase;
26 uint16_t reset;
27 uint16_t lock;
28 uint16_t unlock;
29 uint16_t lock_status;
30};
31
32struct pxa3xx_nand_flash { 19struct pxa3xx_nand_flash {
33 char *name; 20 char *name;
34 uint32_t chip_id; 21 uint32_t chip_id;
diff --git a/include/linux/platform_data/net-cw1200.h b/include/linux/platform_data/net-cw1200.h
new file mode 100644
index 000000000000..c6fbc3ce4ab0
--- /dev/null
+++ b/include/linux/platform_data/net-cw1200.h
@@ -0,0 +1,81 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2011
3 *
4 * Author: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef CW1200_PLAT_H_INCLUDED
9#define CW1200_PLAT_H_INCLUDED
10
11struct cw1200_platform_data_spi {
12 u8 spi_bits_per_word; /* REQUIRED */
13 u16 ref_clk; /* REQUIRED (in KHz) */
14
15 /* All others are optional */
16 bool have_5ghz;
17 int reset; /* GPIO to RSTn signal (0 disables) */
18 int powerup; /* GPIO to POWERUP signal (0 disables) */
19 int (*power_ctrl)(const struct cw1200_platform_data_spi *pdata,
20 bool enable); /* Control 3v3 / 1v8 supply */
21 int (*clk_ctrl)(const struct cw1200_platform_data_spi *pdata,
22 bool enable); /* Control CLK32K */
23 const u8 *macaddr; /* if NULL, use cw1200_mac_template module parameter */
24 const char *sdd_file; /* if NULL, will use default for detected hw type */
25};
26
27struct cw1200_platform_data_sdio {
28 u16 ref_clk; /* REQUIRED (in KHz) */
29
30 /* All others are optional */
31 bool have_5ghz;
32 bool no_nptb; /* SDIO hardware does not support non-power-of-2-blocksizes */
33 int reset; /* GPIO to RSTn signal (0 disables) */
34 int powerup; /* GPIO to POWERUP signal (0 disables) */
35 int irq; /* IRQ line or 0 to use SDIO IRQ */
36 int (*power_ctrl)(const struct cw1200_platform_data_sdio *pdata,
37 bool enable); /* Control 3v3 / 1v8 supply */
38 int (*clk_ctrl)(const struct cw1200_platform_data_sdio *pdata,
39 bool enable); /* Control CLK32K */
40 const u8 *macaddr; /* if NULL, use cw1200_mac_template module parameter */
41 const char *sdd_file; /* if NULL, will use default for detected hw type */
42};
43
44
45/* An example of SPI support in your board setup file:
46
47 static struct cw1200_platform_data_spi cw1200_platform_data = {
48 .ref_clk = 38400,
49 .spi_bits_per_word = 16,
50 .reset = GPIO_RF_RESET,
51 .powerup = GPIO_RF_POWERUP,
52 .macaddr = wifi_mac_addr,
53 .sdd_file = "sdd_sagrad_1091_1098.bin",
54 };
55 static struct spi_board_info myboard_spi_devices[] __initdata = {
56 {
57 .modalias = "cw1200_wlan_spi",
58 .max_speed_hz = 52000000,
59 .bus_num = 0,
60 .irq = WIFI_IRQ,
61 .platform_data = &cw1200_platform_data,
62 .chip_select = 0,
63 },
64 };
65
66 */
67
68/* An example of SDIO support in your board setup file:
69
70 static struct cw1200_platform_data_sdio my_cw1200_platform_data = {
71 .ref_clk = 38400,
72 .have_5ghz = false,
73 .sdd_file = "sdd_myplatform.bin",
74 };
75 cw1200_sdio_set_platform_data(&my_cw1200_platform_data);
76
77 */
78
79void __init cw1200_sdio_set_platform_data(struct cw1200_platform_data_sdio *pdata);
80
81#endif /* CW1200_PLAT_H_INCLUDED */
diff --git a/include/linux/platform_data/omap-abe-twl6040.h b/include/linux/platform_data/omap-abe-twl6040.h
deleted file mode 100644
index 5d298ac10fc2..000000000000
--- a/include/linux/platform_data/omap-abe-twl6040.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/**
2 * omap-abe-twl6040.h - ASoC machine driver OMAP4+ devices, header.
3 *
4 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
5 * All rights reserved.
6 *
7 * Author: Peter Ujfalusi <peter.ujfalusi@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
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
23
24#ifndef _OMAP_ABE_TWL6040_H_
25#define _OMAP_ABE_TWL6040_H_
26
27/* To select if only one channel is connected in a stereo port */
28#define ABE_TWL6040_LEFT (1 << 0)
29#define ABE_TWL6040_RIGHT (1 << 1)
30
31struct omap_abe_twl6040_data {
32 char *card_name;
33 /* Feature flags for connected audio pins */
34 u8 has_hs;
35 u8 has_hf;
36 bool has_ep;
37 u8 has_aux;
38 u8 has_vibra;
39 bool has_dmic;
40 bool has_hsmic;
41 bool has_mainmic;
42 bool has_submic;
43 u8 has_afm;
44 /* Other features */
45 bool jack_detection; /* board can detect jack events */
46 int mclk_freq; /* MCLK frequency speed for twl6040 */
47};
48
49#endif /* _OMAP_ABE_TWL6040_H_ */
diff --git a/include/linux/platform_data/omap_ocp2scp.h b/include/linux/platform_data/omap_ocp2scp.h
deleted file mode 100644
index 5c6c3939355f..000000000000
--- a/include/linux/platform_data/omap_ocp2scp.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * omap_ocp2scp.h -- ocp2scp header file
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * Author: Kishon Vijay Abraham I <kishon@ti.com>
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#ifndef __DRIVERS_OMAP_OCP2SCP_H
20#define __DRIVERS_OMAP_OCP2SCP_H
21
22struct omap_ocp2scp_dev {
23 const char *drv_name;
24 struct resource *res;
25};
26
27struct omap_ocp2scp_platform_data {
28 int dev_cnt;
29 struct omap_ocp2scp_dev **devices;
30};
31#endif /* __DRIVERS_OMAP_OCP2SCP_H */
diff --git a/include/linux/i2c/pca953x.h b/include/linux/platform_data/pca953x.h
index 3c98dd4f901f..3c98dd4f901f 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/platform_data/pca953x.h
diff --git a/include/linux/platform_data/pinctrl-coh901.h b/include/linux/platform_data/pinctrl-coh901.h
deleted file mode 100644
index dfbc65d10484..000000000000
--- a/include/linux/platform_data/pinctrl-coh901.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (C) 2007-2012 ST-Ericsson AB
3 * License terms: GNU General Public License (GPL) version 2
4 * GPIO block resgister definitions and inline macros for
5 * U300 GPIO COH 901 335 or COH 901 571/3
6 * Author: Linus Walleij <linus.walleij@stericsson.com>
7 */
8
9#ifndef __MACH_U300_GPIO_U300_H
10#define __MACH_U300_GPIO_U300_H
11
12/**
13 * struct u300_gpio_platform - U300 GPIO platform data
14 * @ports: number of GPIO block ports
15 * @gpio_base: first GPIO number for this block (use a free range)
16 */
17struct u300_gpio_platform {
18 u8 ports;
19 int gpio_base;
20};
21
22#endif /* __MACH_U300_GPIO_U300_H */
diff --git a/include/linux/platform_data/pinctrl-nomadik.h b/include/linux/platform_data/pinctrl-nomadik.h
index f73b2f0c55b7..abf5bed84df3 100644
--- a/include/linux/platform_data/pinctrl-nomadik.h
+++ b/include/linux/platform_data/pinctrl-nomadik.h
@@ -226,30 +226,6 @@ enum nmk_gpio_slpm {
226 NMK_GPIO_SLPM_WAKEUP_DISABLE = NMK_GPIO_SLPM_NOCHANGE, 226 NMK_GPIO_SLPM_WAKEUP_DISABLE = NMK_GPIO_SLPM_NOCHANGE,
227}; 227};
228 228
229/* Older deprecated pin config API that should go away soon */
230extern int nmk_config_pin(pin_cfg_t cfg, bool sleep);
231extern int nmk_config_pins(pin_cfg_t *cfgs, int num);
232extern int nmk_config_pins_sleep(pin_cfg_t *cfgs, int num);
233extern int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode);
234extern int nmk_gpio_set_pull(int gpio, enum nmk_gpio_pull pull);
235#ifdef CONFIG_PINCTRL_NOMADIK
236extern int nmk_gpio_set_mode(int gpio, int gpio_mode);
237#else
238static inline int nmk_gpio_set_mode(int gpio, int gpio_mode)
239{
240 return -ENODEV;
241}
242#endif
243extern int nmk_gpio_get_mode(int gpio);
244
245extern void nmk_gpio_wakeups_suspend(void);
246extern void nmk_gpio_wakeups_resume(void);
247
248extern void nmk_gpio_clocks_enable(void);
249extern void nmk_gpio_clocks_disable(void);
250
251extern void nmk_gpio_read_pull(int gpio_bank, u32 *pull_up);
252
253/* 229/*
254 * Platform data to register a block: only the initial gpio/irq number. 230 * Platform data to register a block: only the initial gpio/irq number.
255 */ 231 */
diff --git a/include/linux/platform_data/pwm-renesas-tpu.h b/include/linux/platform_data/pwm-renesas-tpu.h
new file mode 100644
index 000000000000..a7220b10ddab
--- /dev/null
+++ b/include/linux/platform_data/pwm-renesas-tpu.h
@@ -0,0 +1,16 @@
1#ifndef __PWM_RENESAS_TPU_H__
2#define __PWM_RENESAS_TPU_H__
3
4#include <linux/pwm.h>
5
6#define TPU_CHANNEL_MAX 4
7
8struct tpu_pwm_channel_data {
9 enum pwm_polarity polarity;
10};
11
12struct tpu_pwm_platform_data {
13 struct tpu_pwm_channel_data channels[TPU_CHANNEL_MAX];
14};
15
16#endif /* __PWM_RENESAS_TPU_H__ */
diff --git a/include/linux/platform_data/rcar-du.h b/include/linux/platform_data/rcar-du.h
new file mode 100644
index 000000000000..1a2e9901a22e
--- /dev/null
+++ b/include/linux/platform_data/rcar-du.h
@@ -0,0 +1,74 @@
1/*
2 * rcar_du.h -- R-Car Display Unit DRM driver
3 *
4 * Copyright (C) 2013 Renesas Corporation
5 *
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __RCAR_DU_H__
15#define __RCAR_DU_H__
16
17#include <drm/drm_mode.h>
18
19enum rcar_du_output {
20 RCAR_DU_OUTPUT_DPAD0,
21 RCAR_DU_OUTPUT_DPAD1,
22 RCAR_DU_OUTPUT_LVDS0,
23 RCAR_DU_OUTPUT_LVDS1,
24 RCAR_DU_OUTPUT_TCON,
25 RCAR_DU_OUTPUT_MAX,
26};
27
28enum rcar_du_encoder_type {
29 RCAR_DU_ENCODER_UNUSED = 0,
30 RCAR_DU_ENCODER_NONE,
31 RCAR_DU_ENCODER_VGA,
32 RCAR_DU_ENCODER_LVDS,
33};
34
35struct rcar_du_panel_data {
36 unsigned int width_mm; /* Panel width in mm */
37 unsigned int height_mm; /* Panel height in mm */
38 struct drm_mode_modeinfo mode;
39};
40
41struct rcar_du_connector_lvds_data {
42 struct rcar_du_panel_data panel;
43};
44
45struct rcar_du_connector_vga_data {
46 /* TODO: Add DDC information for EDID retrieval */
47};
48
49/*
50 * struct rcar_du_encoder_data - Encoder platform data
51 * @type: the encoder type (RCAR_DU_ENCODER_*)
52 * @output: the DU output the connector is connected to (RCAR_DU_OUTPUT_*)
53 * @connector.lvds: platform data for LVDS connectors
54 * @connector.vga: platform data for VGA connectors
55 *
56 * Encoder platform data describes an on-board encoder, its associated DU SoC
57 * output, and the connector.
58 */
59struct rcar_du_encoder_data {
60 enum rcar_du_encoder_type type;
61 enum rcar_du_output output;
62
63 union {
64 struct rcar_du_connector_lvds_data lvds;
65 struct rcar_du_connector_vga_data vga;
66 } connector;
67};
68
69struct rcar_du_platform_data {
70 struct rcar_du_encoder_data *encoders;
71 unsigned int num_encoders;
72};
73
74#endif /* __RCAR_DU_H__ */
diff --git a/include/linux/platform_data/remoteproc-omap.h b/include/linux/platform_data/remoteproc-omap.h
index 3c1c6444ec4b..bfbd12b41162 100644
--- a/include/linux/platform_data/remoteproc-omap.h
+++ b/include/linux/platform_data/remoteproc-omap.h
@@ -50,7 +50,7 @@ void __init omap_rproc_reserve_cma(void);
50 50
51#else 51#else
52 52
53void __init omap_rproc_reserve_cma(void) 53static inline void __init omap_rproc_reserve_cma(void)
54{ 54{
55} 55}
56 56
diff --git a/include/linux/platform_data/serial-sccnxp.h b/include/linux/platform_data/serial-sccnxp.h
index bdc510d03245..af0c8c3b89ae 100644
--- a/include/linux/platform_data/serial-sccnxp.h
+++ b/include/linux/platform_data/serial-sccnxp.h
@@ -60,7 +60,6 @@
60 * }; 60 * };
61 * 61 *
62 * static struct sccnxp_pdata sc2892_info = { 62 * static struct sccnxp_pdata sc2892_info = {
63 * .frequency = 3686400,
64 * .mctrl_cfg[0] = MCTRL_SIG(DIR_OP, LINE_OP0), 63 * .mctrl_cfg[0] = MCTRL_SIG(DIR_OP, LINE_OP0),
65 * .mctrl_cfg[1] = MCTRL_SIG(DIR_OP, LINE_OP1), 64 * .mctrl_cfg[1] = MCTRL_SIG(DIR_OP, LINE_OP1),
66 * }; 65 * };
@@ -78,8 +77,6 @@
78 77
79/* SCCNXP platform data structure */ 78/* SCCNXP platform data structure */
80struct sccnxp_pdata { 79struct sccnxp_pdata {
81 /* Frequency (extrenal clock or crystal) */
82 int frequency;
83 /* Shift for A0 line */ 80 /* Shift for A0 line */
84 const u8 reg_shift; 81 const u8 reg_shift;
85 /* Modem control lines configuration */ 82 /* Modem control lines configuration */
diff --git a/include/linux/platform_data/si5351.h b/include/linux/platform_data/si5351.h
index 92dabcaf6499..54334393ab92 100644
--- a/include/linux/platform_data/si5351.h
+++ b/include/linux/platform_data/si5351.h
@@ -79,6 +79,23 @@ enum si5351_drive_strength {
79}; 79};
80 80
81/** 81/**
82 * enum si5351_disable_state - Si5351 clock output disable state
83 * @SI5351_DISABLE_DEFAULT: default, do not change eeprom config
84 * @SI5351_DISABLE_LOW: CLKx is set to a LOW state when disabled
85 * @SI5351_DISABLE_HIGH: CLKx is set to a HIGH state when disabled
86 * @SI5351_DISABLE_FLOATING: CLKx is set to a FLOATING state when
87 * disabled
88 * @SI5351_DISABLE_NEVER: CLKx is NEVER disabled
89 */
90enum si5351_disable_state {
91 SI5351_DISABLE_DEFAULT = 0,
92 SI5351_DISABLE_LOW,
93 SI5351_DISABLE_HIGH,
94 SI5351_DISABLE_FLOATING,
95 SI5351_DISABLE_NEVER,
96};
97
98/**
82 * struct si5351_clkout_config - Si5351 clock output configuration 99 * struct si5351_clkout_config - Si5351 clock output configuration
83 * @clkout: clkout number 100 * @clkout: clkout number
84 * @multisynth_src: multisynth source clock 101 * @multisynth_src: multisynth source clock
@@ -91,6 +108,7 @@ struct si5351_clkout_config {
91 enum si5351_multisynth_src multisynth_src; 108 enum si5351_multisynth_src multisynth_src;
92 enum si5351_clkout_src clkout_src; 109 enum si5351_clkout_src clkout_src;
93 enum si5351_drive_strength drive; 110 enum si5351_drive_strength drive;
111 enum si5351_disable_state disable_state;
94 bool pll_master; 112 bool pll_master;
95 unsigned long rate; 113 unsigned long rate;
96}; 114};
diff --git a/include/linux/platform_data/simplefb.h b/include/linux/platform_data/simplefb.h
new file mode 100644
index 000000000000..077303cedbf4
--- /dev/null
+++ b/include/linux/platform_data/simplefb.h
@@ -0,0 +1,64 @@
1/*
2 * simplefb.h - Simple Framebuffer Device
3 *
4 * Copyright (C) 2013 David Herrmann <dh.herrmann@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef __PLATFORM_DATA_SIMPLEFB_H__
13#define __PLATFORM_DATA_SIMPLEFB_H__
14
15#include <drm/drm_fourcc.h>
16#include <linux/fb.h>
17#include <linux/kernel.h>
18
19/* format array, use it to initialize a "struct simplefb_format" array */
20#define SIMPLEFB_FORMATS \
21{ \
22 { "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0}, DRM_FORMAT_RGB565 }, \
23 { "x1r5g5b5", 16, {10, 5}, {5, 5}, {0, 5}, {0, 0}, DRM_FORMAT_XRGB1555 }, \
24 { "a1r5g5b5", 16, {10, 5}, {5, 5}, {0, 5}, {15, 1}, DRM_FORMAT_ARGB1555 }, \
25 { "r8g8b8", 24, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_RGB888 }, \
26 { "x8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_XRGB8888 }, \
27 { "a8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {24, 8}, DRM_FORMAT_ARGB8888 }, \
28 { "a8b8g8r8", 32, {0, 8}, {8, 8}, {16, 8}, {24, 8}, DRM_FORMAT_ABGR8888 }, \
29 { "x2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {0, 0}, DRM_FORMAT_XRGB2101010 }, \
30 { "a2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {30, 2}, DRM_FORMAT_ARGB2101010 }, \
31}
32
33/*
34 * Data-Format for Simple-Framebuffers
35 * @name: unique 0-terminated name that can be used to identify the mode
36 * @red,green,blue: Offsets and sizes of the single RGB parts
37 * @transp: Offset and size of the alpha bits. length=0 means no alpha
38 * @fourcc: 32bit DRM four-CC code (see drm_fourcc.h)
39 */
40struct simplefb_format {
41 const char *name;
42 u32 bits_per_pixel;
43 struct fb_bitfield red;
44 struct fb_bitfield green;
45 struct fb_bitfield blue;
46 struct fb_bitfield transp;
47 u32 fourcc;
48};
49
50/*
51 * Simple-Framebuffer description
52 * If the arch-boot code creates simple-framebuffers without DT support, it
53 * can pass the width, height, stride and format via this platform-data object.
54 * The framebuffer location must be given as IORESOURCE_MEM resource.
55 * @format must be a format as described in "struct simplefb_format" above.
56 */
57struct simplefb_platform_data {
58 u32 width;
59 u32 height;
60 u32 stride;
61 const char *format;
62};
63
64#endif /* __PLATFORM_DATA_SIMPLEFB_H__ */
diff --git a/include/linux/platform_data/spi-davinci.h b/include/linux/platform_data/spi-davinci.h
index 7af305b37868..8dc2fa47a2aa 100644
--- a/include/linux/platform_data/spi-davinci.h
+++ b/include/linux/platform_data/spi-davinci.h
@@ -19,7 +19,7 @@
19#ifndef __ARCH_ARM_DAVINCI_SPI_H 19#ifndef __ARCH_ARM_DAVINCI_SPI_H
20#define __ARCH_ARM_DAVINCI_SPI_H 20#define __ARCH_ARM_DAVINCI_SPI_H
21 21
22#include <mach/edma.h> 22#include <linux/platform_data/edma.h>
23 23
24#define SPI_INTERN_CS 0xFF 24#define SPI_INTERN_CS 0xFF
25 25
diff --git a/include/linux/platform_data/ssm2518.h b/include/linux/platform_data/ssm2518.h
new file mode 100644
index 000000000000..9a8e3ea287e3
--- /dev/null
+++ b/include/linux/platform_data/ssm2518.h
@@ -0,0 +1,22 @@
1/*
2 * SSM2518 amplifier audio driver
3 *
4 * Copyright 2013 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2.
8 */
9
10#ifndef __LINUX_PLATFORM_DATA_SSM2518_H__
11#define __LINUX_PLATFORM_DATA_SSM2518_H__
12
13/**
14 * struct ssm2518_platform_data - Platform data for the ssm2518 driver
15 * @enable_gpio: GPIO connected to the nSD pin. Set to -1 if the nSD pin is
16 * hardwired.
17 */
18struct ssm2518_platform_data {
19 int enable_gpio;
20};
21
22#endif
diff --git a/include/linux/platform_data/st_sensors_pdata.h b/include/linux/platform_data/st_sensors_pdata.h
new file mode 100644
index 000000000000..753839187ba0
--- /dev/null
+++ b/include/linux/platform_data/st_sensors_pdata.h
@@ -0,0 +1,24 @@
1/*
2 * STMicroelectronics sensors platform-data driver
3 *
4 * Copyright 2013 STMicroelectronics Inc.
5 *
6 * Denis Ciocca <denis.ciocca@st.com>
7 *
8 * Licensed under the GPL-2.
9 */
10
11#ifndef ST_SENSORS_PDATA_H
12#define ST_SENSORS_PDATA_H
13
14/**
15 * struct st_sensors_platform_data - Platform data for the ST sensors
16 * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2).
17 * Available only for accelerometer and pressure sensors.
18 * Accelerometer DRDY on LSM330 available only on pin 1 (see datasheet).
19 */
20struct st_sensors_platform_data {
21 u8 drdy_int_pin;
22};
23
24#endif /* ST_SENSORS_PDATA_H */
diff --git a/include/linux/platform_data/ti_am335x_adc.h b/include/linux/platform_data/ti_am335x_adc.h
deleted file mode 100644
index e41d5834cb84..000000000000
--- a/include/linux/platform_data/ti_am335x_adc.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __LINUX_TI_AM335X_ADC_H
2#define __LINUX_TI_AM335X_ADC_H
3
4/**
5 * struct adc_data ADC Input information
6 * @adc_channels: Number of analog inputs
7 * available for ADC.
8 */
9
10struct adc_data {
11 unsigned int adc_channels;
12};
13
14#endif
diff --git a/include/linux/platform_data/usb-musb-ux500.h b/include/linux/platform_data/usb-musb-ux500.h
index 4c1cc50a595a..dd9c83ac7de0 100644
--- a/include/linux/platform_data/usb-musb-ux500.h
+++ b/include/linux/platform_data/usb-musb-ux500.h
@@ -9,14 +9,11 @@
9 9
10#include <linux/dmaengine.h> 10#include <linux/dmaengine.h>
11 11
12#define UX500_MUSB_DMA_NUM_RX_CHANNELS 8 12#define UX500_MUSB_DMA_NUM_RX_TX_CHANNELS 8
13#define UX500_MUSB_DMA_NUM_TX_CHANNELS 8
14 13
15struct ux500_musb_board_data { 14struct ux500_musb_board_data {
16 void **dma_rx_param_array; 15 void **dma_rx_param_array;
17 void **dma_tx_param_array; 16 void **dma_tx_param_array;
18 u32 num_rx_channels;
19 u32 num_tx_channels;
20 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 17 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
21}; 18};
22 19
diff --git a/include/linux/platform_data/usb-rcar-phy.h b/include/linux/platform_data/usb-rcar-phy.h
new file mode 100644
index 000000000000..8ec6964a32a5
--- /dev/null
+++ b/include/linux/platform_data/usb-rcar-phy.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright (C) 2013 Renesas Solutions Corp.
3 * Copyright (C) 2013 Cogent Embedded, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef __USB_RCAR_PHY_H
11#define __USB_RCAR_PHY_H
12
13#include <linux/types.h>
14
15struct rcar_phy_platform_data {
16 bool ferrite_bead:1; /* (R8A7778 only) */
17
18 bool port1_func:1; /* true: port 1 used by function, false: host */
19 unsigned penc1:1; /* Output of the PENC1 pin in function mode */
20 struct { /* Overcurrent pin control for ports 0..2 */
21 bool select_3_3v:1; /* true: USB_OVCn pin, false: OVCn pin */
22 /* Set to false on port 1 in function mode */
23 bool active_high:1; /* true: active high, false: active low */
24 /* Set to true on port 1 in function mode */
25 } ovc_pin[3]; /* (R8A7778 only has 2 ports) */
26};
27
28#endif /* __USB_RCAR_PHY_H */
diff --git a/include/linux/platform_data/usb3503.h b/include/linux/platform_data/usb3503.h
index 85dcc709f7e9..1d1b6ef871f6 100644
--- a/include/linux/platform_data/usb3503.h
+++ b/include/linux/platform_data/usb3503.h
@@ -3,6 +3,10 @@
3 3
4#define USB3503_I2C_NAME "usb3503" 4#define USB3503_I2C_NAME "usb3503"
5 5
6#define USB3503_OFF_PORT1 (1 << 1)
7#define USB3503_OFF_PORT2 (1 << 2)
8#define USB3503_OFF_PORT3 (1 << 3)
9
6enum usb3503_mode { 10enum usb3503_mode {
7 USB3503_MODE_UNKNOWN, 11 USB3503_MODE_UNKNOWN,
8 USB3503_MODE_HUB, 12 USB3503_MODE_HUB,
@@ -11,6 +15,7 @@ enum usb3503_mode {
11 15
12struct usb3503_platform_data { 16struct usb3503_platform_data {
13 enum usb3503_mode initial_mode; 17 enum usb3503_mode initial_mode;
18 u8 port_off_mask;
14 int gpio_intn; 19 int gpio_intn;
15 int gpio_connect; 20 int gpio_connect;
16 int gpio_reset; 21 int gpio_reset;
diff --git a/include/linux/platform_data/vsp1.h b/include/linux/platform_data/vsp1.h
new file mode 100644
index 000000000000..a73a456d7f11
--- /dev/null
+++ b/include/linux/platform_data/vsp1.h
@@ -0,0 +1,25 @@
1/*
2 * vsp1.h -- R-Car VSP1 Platform Data
3 *
4 * Copyright (C) 2013 Renesas Corporation
5 *
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13#ifndef __PLATFORM_VSP1_H__
14#define __PLATFORM_VSP1_H__
15
16#define VSP1_HAS_LIF (1 << 0)
17
18struct vsp1_platform_data {
19 unsigned int features;
20 unsigned int rpf_count;
21 unsigned int uds_count;
22 unsigned int wpf_count;
23};
24
25#endif /* __PLATFORM_VSP1_H__ */
diff --git a/include/linux/platform_data/tegra_usb.h b/include/linux/platform_data/zforce_ts.h
index 66c673fef408..0472ab2f6ede 100644
--- a/include/linux/platform_data/tegra_usb.h
+++ b/include/linux/platform_data/zforce_ts.h
@@ -1,5 +1,6 @@
1/* 1/* drivers/input/touchscreen/zforce.c
2 * Copyright (C) 2010 Google, Inc. 2 *
3 * Copyright (C) 2012-2013 MundoReader S.L.
3 * 4 *
4 * This software is licensed under the terms of the GNU General Public 5 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and 6 * License version 2, as published by the Free Software Foundation, and
@@ -9,24 +10,17 @@
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details. 12 * GNU General Public License for more details.
12 *
13 */ 13 */
14 14
15#ifndef _TEGRA_USB_H_ 15#ifndef _LINUX_INPUT_ZFORCE_TS_H
16#define _TEGRA_USB_H_ 16#define _LINUX_INPUT_ZFORCE_TS_H
17 17
18enum tegra_usb_operating_modes { 18struct zforce_ts_platdata {
19 TEGRA_USB_DEVICE, 19 int gpio_int;
20 TEGRA_USB_HOST, 20 int gpio_rst;
21 TEGRA_USB_OTG,
22};
23 21
24struct tegra_ehci_platform_data { 22 unsigned int x_max;
25 enum tegra_usb_operating_modes operating_mode; 23 unsigned int y_max;
26 /* power down the phy on bus suspend */
27 int power_down_on_bus_suspend;
28 void *phy_config;
29 int vbus_gpio;
30}; 24};
31 25
32#endif /* _TEGRA_USB_H_ */ 26#endif /* _LINUX_INPUT_ZFORCE_TS_H */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 9abf1db6aea6..ce8e4ffd78c7 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -180,7 +180,16 @@ struct platform_driver {
180 const struct platform_device_id *id_table; 180 const struct platform_device_id *id_table;
181}; 181};
182 182
183extern int platform_driver_register(struct platform_driver *); 183#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \
184 driver))
185
186/*
187 * use a macro to avoid include chaining to get THIS_MODULE
188 */
189#define platform_driver_register(drv) \
190 __platform_driver_register(drv, THIS_MODULE)
191extern int __platform_driver_register(struct platform_driver *,
192 struct module *);
184extern void platform_driver_unregister(struct platform_driver *); 193extern void platform_driver_unregister(struct platform_driver *);
185 194
186/* non-hotpluggable platform devices may use this so that probe() and 195/* non-hotpluggable platform devices may use this so that probe() and
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 7d7e09efff9b..6fa7cea25da9 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -37,7 +37,6 @@ extern void pm_runtime_enable(struct device *dev);
37extern void __pm_runtime_disable(struct device *dev, bool check_resume); 37extern void __pm_runtime_disable(struct device *dev, bool check_resume);
38extern void pm_runtime_allow(struct device *dev); 38extern void pm_runtime_allow(struct device *dev);
39extern void pm_runtime_forbid(struct device *dev); 39extern void pm_runtime_forbid(struct device *dev);
40extern int pm_generic_runtime_idle(struct device *dev);
41extern int pm_generic_runtime_suspend(struct device *dev); 40extern int pm_generic_runtime_suspend(struct device *dev);
42extern int pm_generic_runtime_resume(struct device *dev); 41extern int pm_generic_runtime_resume(struct device *dev);
43extern void pm_runtime_no_callbacks(struct device *dev); 42extern void pm_runtime_no_callbacks(struct device *dev);
@@ -143,7 +142,6 @@ static inline bool pm_runtime_active(struct device *dev) { return true; }
143static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } 142static inline bool pm_runtime_status_suspended(struct device *dev) { return false; }
144static inline bool pm_runtime_enabled(struct device *dev) { return false; } 143static inline bool pm_runtime_enabled(struct device *dev) { return false; }
145 144
146static inline int pm_generic_runtime_idle(struct device *dev) { return 0; }
147static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } 145static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
148static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } 146static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
149static inline void pm_runtime_no_callbacks(struct device *dev) {} 147static inline void pm_runtime_no_callbacks(struct device *dev) {}
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 569781faa504..a0f70808d7f4 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -36,8 +36,8 @@
36 * @last_time: Monotonic clock when the wakeup source's was touched last time. 36 * @last_time: Monotonic clock when the wakeup source's was touched last time.
37 * @prevent_sleep_time: Total time this source has been preventing autosleep. 37 * @prevent_sleep_time: Total time this source has been preventing autosleep.
38 * @event_count: Number of signaled wakeup events. 38 * @event_count: Number of signaled wakeup events.
39 * @active_count: Number of times the wakeup sorce was activated. 39 * @active_count: Number of times the wakeup source was activated.
40 * @relax_count: Number of times the wakeup sorce was deactivated. 40 * @relax_count: Number of times the wakeup source was deactivated.
41 * @expire_count: Number of times the wakeup source's timeout has expired. 41 * @expire_count: Number of times the wakeup source's timeout has expired.
42 * @wakeup_count: Number of times the wakeup source might abort suspend. 42 * @wakeup_count: Number of times the wakeup source might abort suspend.
43 * @active: Status of the wakeup source. 43 * @active: Status of the wakeup source.
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 7794d75ed155..907f3fd191ac 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -7,14 +7,20 @@
7#include <linux/timex.h> 7#include <linux/timex.h>
8#include <linux/alarmtimer.h> 8#include <linux/alarmtimer.h>
9 9
10union cpu_time_count { 10
11 cputime_t cpu; 11static inline unsigned long long cputime_to_expires(cputime_t expires)
12 unsigned long long sched; 12{
13}; 13 return (__force unsigned long long)expires;
14}
15
16static inline cputime_t expires_to_cputime(unsigned long long expires)
17{
18 return (__force cputime_t)expires;
19}
14 20
15struct cpu_timer_list { 21struct cpu_timer_list {
16 struct list_head entry; 22 struct list_head entry;
17 union cpu_time_count expires, incr; 23 unsigned long long expires, incr;
18 struct task_struct *task; 24 struct task_struct *task;
19 int firing; 25 int firing;
20}; 26};
diff --git a/include/linux/power/bq24190_charger.h b/include/linux/power/bq24190_charger.h
new file mode 100644
index 000000000000..9f0283721cbc
--- /dev/null
+++ b/include/linux/power/bq24190_charger.h
@@ -0,0 +1,16 @@
1/*
2 * Platform data for the TI bq24190 battery charger driver.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _BQ24190_CHARGER_H_
10#define _BQ24190_CHARGER_H_
11
12struct bq24190_platform_data {
13 unsigned int gpio_int; /* GPIO pin that's connected to INT# */
14};
15
16#endif
diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h
index c0f44c2b006d..d8b187c3925d 100644
--- a/include/linux/power/smartreflex.h
+++ b/include/linux/power/smartreflex.h
@@ -299,11 +299,11 @@ void omap_sr_disable_reset_volt(struct voltagedomain *voltdm);
299void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data); 299void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data);
300 300
301/* Smartreflex driver hooks to be called from Smartreflex class driver */ 301/* Smartreflex driver hooks to be called from Smartreflex class driver */
302int sr_enable(struct voltagedomain *voltdm, unsigned long volt); 302int sr_enable(struct omap_sr *sr, unsigned long volt);
303void sr_disable(struct voltagedomain *voltdm); 303void sr_disable(struct omap_sr *sr);
304int sr_configure_errgen(struct voltagedomain *voltdm); 304int sr_configure_errgen(struct omap_sr *sr);
305int sr_disable_errgen(struct voltagedomain *voltdm); 305int sr_disable_errgen(struct omap_sr *sr);
306int sr_configure_minmax(struct voltagedomain *voltdm); 306int sr_configure_minmax(struct omap_sr *sr);
307 307
308/* API to register the smartreflex class driver with the smartreflex driver */ 308/* API to register the smartreflex class driver with the smartreflex driver */
309int sr_register_class(struct omap_sr_class_data *class_data); 309int sr_register_class(struct omap_sr_class_data *class_data);
diff --git a/include/linux/power/twl4030_madc_battery.h b/include/linux/power/twl4030_madc_battery.h
new file mode 100644
index 000000000000..23110dc77726
--- /dev/null
+++ b/include/linux/power/twl4030_madc_battery.h
@@ -0,0 +1,39 @@
1/*
2 * Dumb driver for LiIon batteries using TWL4030 madc.
3 *
4 * Copyright 2013 Golden Delicious Computers
5 * Nikolaus Schaller <hns@goldelico.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 * You should have received a copy of the GNU General Public License along
13 * with this program; if not, write to the Free Software Foundation, Inc.,
14 * 675 Mass Ave, Cambridge, MA 02139, USA.
15 *
16 */
17
18#ifndef __TWL4030_MADC_BATTERY_H
19#define __TWL4030_MADC_BATTERY_H
20
21/*
22 * Usually we can assume 100% @ 4.15V and 0% @ 3.3V but curves differ for
23 * charging and discharging!
24 */
25
26struct twl4030_madc_bat_calibration {
27 short voltage; /* in mV - specify -1 for end of list */
28 short level; /* in percent (0 .. 100%) */
29};
30
31struct twl4030_madc_bat_platform_data {
32 unsigned int capacity; /* total capacity in uAh */
33 struct twl4030_madc_bat_calibration *charging;
34 int charging_size;
35 struct twl4030_madc_bat_calibration *discharging;
36 int discharging_size;
37};
38
39#endif
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 3828cefb4f65..5c2600630dc9 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/workqueue.h> 16#include <linux/workqueue.h>
17#include <linux/leds.h> 17#include <linux/leds.h>
18#include <linux/spinlock.h>
18 19
19struct device; 20struct device;
20 21
@@ -162,6 +163,8 @@ union power_supply_propval {
162 const char *strval; 163 const char *strval;
163}; 164};
164 165
166struct device_node;
167
165struct power_supply { 168struct power_supply {
166 const char *name; 169 const char *name;
167 enum power_supply_type type; 170 enum power_supply_type type;
@@ -173,9 +176,7 @@ struct power_supply {
173 176
174 char **supplied_from; 177 char **supplied_from;
175 size_t num_supplies; 178 size_t num_supplies;
176#ifdef CONFIG_OF
177 struct device_node *of_node; 179 struct device_node *of_node;
178#endif
179 180
180 int (*get_property)(struct power_supply *psy, 181 int (*get_property)(struct power_supply *psy,
181 enum power_supply_property psp, 182 enum power_supply_property psp,
@@ -194,6 +195,8 @@ struct power_supply {
194 /* private */ 195 /* private */
195 struct device *dev; 196 struct device *dev;
196 struct work_struct changed_work; 197 struct work_struct changed_work;
198 spinlock_t changed_lock;
199 bool changed;
197#ifdef CONFIG_THERMAL 200#ifdef CONFIG_THERMAL
198 struct thermal_zone_device *tzd; 201 struct thermal_zone_device *tzd;
199 struct thermal_cooling_device *tcd; 202 struct thermal_cooling_device *tcd;
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index 7db3eb93a079..1d2cd21242e8 100644
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -80,7 +80,7 @@ struct pps_device {
80 * Global variables 80 * Global variables
81 */ 81 */
82 82
83extern struct device_attribute pps_attrs[]; 83extern const struct attribute_group *pps_groups[];
84 84
85/* 85/*
86 * Internal functions. 86 * Internal functions.
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index 87a03c746f17..f5d4723cdb3d 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -33,9 +33,25 @@ do { \
33 preempt_schedule(); \ 33 preempt_schedule(); \
34} while (0) 34} while (0)
35 35
36#ifdef CONFIG_CONTEXT_TRACKING
37
38void preempt_schedule_context(void);
39
40#define preempt_check_resched_context() \
41do { \
42 if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
43 preempt_schedule_context(); \
44} while (0)
45#else
46
47#define preempt_check_resched_context() preempt_check_resched()
48
49#endif /* CONFIG_CONTEXT_TRACKING */
50
36#else /* !CONFIG_PREEMPT */ 51#else /* !CONFIG_PREEMPT */
37 52
38#define preempt_check_resched() do { } while (0) 53#define preempt_check_resched() do { } while (0)
54#define preempt_check_resched_context() do { } while (0)
39 55
40#endif /* CONFIG_PREEMPT */ 56#endif /* CONFIG_PREEMPT */
41 57
@@ -88,7 +104,7 @@ do { \
88do { \ 104do { \
89 preempt_enable_no_resched_notrace(); \ 105 preempt_enable_no_resched_notrace(); \
90 barrier(); \ 106 barrier(); \
91 preempt_check_resched(); \ 107 preempt_check_resched_context(); \
92} while (0) 108} while (0)
93 109
94#else /* !CONFIG_PREEMPT_COUNT */ 110#else /* !CONFIG_PREEMPT_COUNT */
diff --git a/include/linux/preempt_mask.h b/include/linux/preempt_mask.h
new file mode 100644
index 000000000000..931bc616219f
--- /dev/null
+++ b/include/linux/preempt_mask.h
@@ -0,0 +1,122 @@
1#ifndef LINUX_PREEMPT_MASK_H
2#define LINUX_PREEMPT_MASK_H
3
4#include <linux/preempt.h>
5#include <asm/hardirq.h>
6
7/*
8 * We put the hardirq and softirq counter into the preemption
9 * counter. The bitmask has the following meaning:
10 *
11 * - bits 0-7 are the preemption count (max preemption depth: 256)
12 * - bits 8-15 are the softirq count (max # of softirqs: 256)
13 *
14 * The hardirq count can in theory reach the same as NR_IRQS.
15 * In reality, the number of nested IRQS is limited to the stack
16 * size as well. For archs with over 1000 IRQS it is not practical
17 * to expect that they will all nest. We give a max of 10 bits for
18 * hardirq nesting. An arch may choose to give less than 10 bits.
19 * m68k expects it to be 8.
20 *
21 * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024)
22 * - bit 26 is the NMI_MASK
23 * - bit 27 is the PREEMPT_ACTIVE flag
24 *
25 * PREEMPT_MASK: 0x000000ff
26 * SOFTIRQ_MASK: 0x0000ff00
27 * HARDIRQ_MASK: 0x03ff0000
28 * NMI_MASK: 0x04000000
29 */
30#define PREEMPT_BITS 8
31#define SOFTIRQ_BITS 8
32#define NMI_BITS 1
33
34#define MAX_HARDIRQ_BITS 10
35
36#ifndef HARDIRQ_BITS
37# define HARDIRQ_BITS MAX_HARDIRQ_BITS
38#endif
39
40#if HARDIRQ_BITS > MAX_HARDIRQ_BITS
41#error HARDIRQ_BITS too high!
42#endif
43
44#define PREEMPT_SHIFT 0
45#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS)
46#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS)
47#define NMI_SHIFT (HARDIRQ_SHIFT + HARDIRQ_BITS)
48
49#define __IRQ_MASK(x) ((1UL << (x))-1)
50
51#define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
52#define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
53#define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
54#define NMI_MASK (__IRQ_MASK(NMI_BITS) << NMI_SHIFT)
55
56#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT)
57#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT)
58#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
59#define NMI_OFFSET (1UL << NMI_SHIFT)
60
61#define SOFTIRQ_DISABLE_OFFSET (2 * SOFTIRQ_OFFSET)
62
63#ifndef PREEMPT_ACTIVE
64#define PREEMPT_ACTIVE_BITS 1
65#define PREEMPT_ACTIVE_SHIFT (NMI_SHIFT + NMI_BITS)
66#define PREEMPT_ACTIVE (__IRQ_MASK(PREEMPT_ACTIVE_BITS) << PREEMPT_ACTIVE_SHIFT)
67#endif
68
69#if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS))
70#error PREEMPT_ACTIVE is too low!
71#endif
72
73#define hardirq_count() (preempt_count() & HARDIRQ_MASK)
74#define softirq_count() (preempt_count() & SOFTIRQ_MASK)
75#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK \
76 | NMI_MASK))
77
78/*
79 * Are we doing bottom half or hardware interrupt processing?
80 * Are we in a softirq context? Interrupt context?
81 * in_softirq - Are we currently processing softirq or have bh disabled?
82 * in_serving_softirq - Are we currently processing softirq?
83 */
84#define in_irq() (hardirq_count())
85#define in_softirq() (softirq_count())
86#define in_interrupt() (irq_count())
87#define in_serving_softirq() (softirq_count() & SOFTIRQ_OFFSET)
88
89/*
90 * Are we in NMI context?
91 */
92#define in_nmi() (preempt_count() & NMI_MASK)
93
94#if defined(CONFIG_PREEMPT_COUNT)
95# define PREEMPT_CHECK_OFFSET 1
96#else
97# define PREEMPT_CHECK_OFFSET 0
98#endif
99
100/*
101 * Are we running in atomic context? WARNING: this macro cannot
102 * always detect atomic context; in particular, it cannot know about
103 * held spinlocks in non-preemptible kernels. Thus it should not be
104 * used in the general case to determine whether sleeping is possible.
105 * Do not use in_atomic() in driver code.
106 */
107#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
108
109/*
110 * Check whether we were atomic before we did preempt_disable():
111 * (used by the scheduler, *after* releasing the kernel lock)
112 */
113#define in_atomic_preempt_off() \
114 ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET)
115
116#ifdef CONFIG_PREEMPT_COUNT
117# define preemptible() (preempt_count() == 0 && !irqs_disabled())
118#else
119# define preemptible() 0
120#endif
121
122#endif /* LINUX_PREEMPT_MASK_H */
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 22c7052e9372..e6131a782481 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -200,7 +200,7 @@ static inline void show_regs_print_info(const char *log_lvl)
200} 200}
201#endif 201#endif
202 202
203extern void dump_stack(void) __cold; 203extern asmlinkage void dump_stack(void) __cold;
204 204
205#ifndef pr_fmt 205#ifndef pr_fmt
206#define pr_fmt(fmt) fmt 206#define pr_fmt(fmt) fmt
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 75d01760c911..abd437d0a8a7 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -35,6 +35,10 @@ enum pstore_type_id {
35 PSTORE_TYPE_MCE = 1, 35 PSTORE_TYPE_MCE = 1,
36 PSTORE_TYPE_CONSOLE = 2, 36 PSTORE_TYPE_CONSOLE = 2,
37 PSTORE_TYPE_FTRACE = 3, 37 PSTORE_TYPE_FTRACE = 3,
38 /* PPC64 partition types */
39 PSTORE_TYPE_PPC_RTAS = 4,
40 PSTORE_TYPE_PPC_OF = 5,
41 PSTORE_TYPE_PPC_COMMON = 6,
38 PSTORE_TYPE_UNKNOWN = 255 42 PSTORE_TYPE_UNKNOWN = 255
39}; 43};
40 44
@@ -51,15 +55,15 @@ struct pstore_info {
51 int (*close)(struct pstore_info *psi); 55 int (*close)(struct pstore_info *psi);
52 ssize_t (*read)(u64 *id, enum pstore_type_id *type, 56 ssize_t (*read)(u64 *id, enum pstore_type_id *type,
53 int *count, struct timespec *time, char **buf, 57 int *count, struct timespec *time, char **buf,
54 struct pstore_info *psi); 58 bool *compressed, struct pstore_info *psi);
55 int (*write)(enum pstore_type_id type, 59 int (*write)(enum pstore_type_id type,
56 enum kmsg_dump_reason reason, u64 *id, 60 enum kmsg_dump_reason reason, u64 *id,
57 unsigned int part, int count, size_t size, 61 unsigned int part, int count, bool compressed,
58 struct pstore_info *psi); 62 size_t size, struct pstore_info *psi);
59 int (*write_buf)(enum pstore_type_id type, 63 int (*write_buf)(enum pstore_type_id type,
60 enum kmsg_dump_reason reason, u64 *id, 64 enum kmsg_dump_reason reason, u64 *id,
61 unsigned int part, const char *buf, size_t size, 65 unsigned int part, const char *buf, bool compressed,
62 struct pstore_info *psi); 66 size_t size, struct pstore_info *psi);
63 int (*erase)(enum pstore_type_id type, u64 id, 67 int (*erase)(enum pstore_type_id type, u64 id,
64 int count, struct timespec time, 68 int count, struct timespec time,
65 struct pstore_info *psi); 69 struct pstore_info *psi);
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 89573a33ab3c..07d0df6bf768 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -142,9 +142,6 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
142{ 142{
143 INIT_LIST_HEAD(&child->ptrace_entry); 143 INIT_LIST_HEAD(&child->ptrace_entry);
144 INIT_LIST_HEAD(&child->ptraced); 144 INIT_LIST_HEAD(&child->ptraced);
145#ifdef CONFIG_HAVE_HW_BREAKPOINT
146 atomic_set(&child->ptrace_bp_refcnt, 1);
147#endif
148 child->jobctl = 0; 145 child->jobctl = 0;
149 child->ptrace = 0; 146 child->ptrace = 0;
150 child->parent = child->real_parent; 147 child->parent = child->real_parent;
@@ -351,11 +348,4 @@ extern int task_current_syscall(struct task_struct *target, long *callno,
351 unsigned long args[6], unsigned int maxargs, 348 unsigned long args[6], unsigned int maxargs,
352 unsigned long *sp, unsigned long *pc); 349 unsigned long *sp, unsigned long *pc);
353 350
354#ifdef CONFIG_HAVE_HW_BREAKPOINT
355extern int ptrace_get_breakpoints(struct task_struct *tsk);
356extern void ptrace_put_breakpoints(struct task_struct *tsk);
357#else
358static inline void ptrace_put_breakpoints(struct task_struct *tsk) { }
359#endif /* CONFIG_HAVE_HW_BREAKPOINT */
360
361#endif 351#endif
diff --git a/include/linux/pvclock_gtod.h b/include/linux/pvclock_gtod.h
index 0ca75825b60d..a71d2dbd3610 100644
--- a/include/linux/pvclock_gtod.h
+++ b/include/linux/pvclock_gtod.h
@@ -3,6 +3,13 @@
3 3
4#include <linux/notifier.h> 4#include <linux/notifier.h>
5 5
6/*
7 * The pvclock gtod notifier is called when the system time is updated
8 * and is used to keep guest time synchronized with host time.
9 *
10 * The 'action' parameter in the notifier function is false (0), or
11 * true (non-zero) if system time was stepped.
12 */
6extern int pvclock_gtod_register_notifier(struct notifier_block *nb); 13extern int pvclock_gtod_register_notifier(struct notifier_block *nb);
7extern int pvclock_gtod_unregister_notifier(struct notifier_block *nb); 14extern int pvclock_gtod_unregister_notifier(struct notifier_block *nb);
8 15
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index a4df2042b79c..f0feafd184a0 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -76,6 +76,7 @@ enum pwm_polarity {
76enum { 76enum {
77 PWMF_REQUESTED = 1 << 0, 77 PWMF_REQUESTED = 1 << 0,
78 PWMF_ENABLED = 1 << 1, 78 PWMF_ENABLED = 1 << 1,
79 PWMF_EXPORTED = 1 << 2,
79}; 80};
80 81
81struct pwm_device { 82struct pwm_device {
@@ -86,7 +87,9 @@ struct pwm_device {
86 struct pwm_chip *chip; 87 struct pwm_chip *chip;
87 void *chip_data; 88 void *chip_data;
88 89
89 unsigned int period; /* in nanoseconds */ 90 unsigned int period; /* in nanoseconds */
91 unsigned int duty_cycle; /* in nanoseconds */
92 enum pwm_polarity polarity;
90}; 93};
91 94
92static inline void pwm_set_period(struct pwm_device *pwm, unsigned int period) 95static inline void pwm_set_period(struct pwm_device *pwm, unsigned int period)
@@ -100,6 +103,17 @@ static inline unsigned int pwm_get_period(struct pwm_device *pwm)
100 return pwm ? pwm->period : 0; 103 return pwm ? pwm->period : 0;
101} 104}
102 105
106static inline void pwm_set_duty_cycle(struct pwm_device *pwm, unsigned int duty)
107{
108 if (pwm)
109 pwm->duty_cycle = duty;
110}
111
112static inline unsigned int pwm_get_duty_cycle(struct pwm_device *pwm)
113{
114 return pwm ? pwm->duty_cycle : 0;
115}
116
103/* 117/*
104 * pwm_set_polarity - configure the polarity of a PWM signal 118 * pwm_set_polarity - configure the polarity of a PWM signal
105 */ 119 */
@@ -278,4 +292,17 @@ static inline void pwm_add_table(struct pwm_lookup *table, size_t num)
278} 292}
279#endif 293#endif
280 294
295#ifdef CONFIG_PWM_SYSFS
296void pwmchip_sysfs_export(struct pwm_chip *chip);
297void pwmchip_sysfs_unexport(struct pwm_chip *chip);
298#else
299static inline void pwmchip_sysfs_export(struct pwm_chip *chip)
300{
301}
302
303static inline void pwmchip_sysfs_unexport(struct pwm_chip *chip)
304{
305}
306#endif /* CONFIG_PWM_SYSFS */
307
281#endif /* __LINUX_PWM_H */ 308#endif /* __LINUX_PWM_H */
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
index 467cc6307b62..49444203328a 100644
--- a/include/linux/pxa2xx_ssp.h
+++ b/include/linux/pxa2xx_ssp.h
@@ -21,6 +21,8 @@
21 21
22#include <linux/list.h> 22#include <linux/list.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/of.h>
25
24 26
25/* 27/*
26 * SSP Serial Port Registers 28 * SSP Serial Port Registers
@@ -190,6 +192,8 @@ struct ssp_device {
190 int irq; 192 int irq;
191 int drcmr_rx; 193 int drcmr_rx;
192 int drcmr_tx; 194 int drcmr_tx;
195
196 struct device_node *of_node;
193}; 197};
194 198
195/** 199/**
@@ -218,11 +222,18 @@ static inline u32 pxa_ssp_read_reg(struct ssp_device *dev, u32 reg)
218#ifdef CONFIG_ARCH_PXA 222#ifdef CONFIG_ARCH_PXA
219struct ssp_device *pxa_ssp_request(int port, const char *label); 223struct ssp_device *pxa_ssp_request(int port, const char *label);
220void pxa_ssp_free(struct ssp_device *); 224void pxa_ssp_free(struct ssp_device *);
225struct ssp_device *pxa_ssp_request_of(const struct device_node *of_node,
226 const char *label);
221#else 227#else
222static inline struct ssp_device *pxa_ssp_request(int port, const char *label) 228static inline struct ssp_device *pxa_ssp_request(int port, const char *label)
223{ 229{
224 return NULL; 230 return NULL;
225} 231}
232static inline struct ssp_device *pxa_ssp_request_of(const struct device_node *n,
233 const char *name)
234{
235 return NULL;
236}
226static inline void pxa_ssp_free(struct ssp_device *ssp) {} 237static inline void pxa_ssp_free(struct ssp_device *ssp) {}
227#endif 238#endif
228 239
diff --git a/include/linux/quota.h b/include/linux/quota.h
index d13371134c59..cc7494a35429 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -328,6 +328,7 @@ struct quotactl_ops {
328 int (*set_dqblk)(struct super_block *, struct kqid, struct fs_disk_quota *); 328 int (*set_dqblk)(struct super_block *, struct kqid, struct fs_disk_quota *);
329 int (*get_xstate)(struct super_block *, struct fs_quota_stat *); 329 int (*get_xstate)(struct super_block *, struct fs_quota_stat *);
330 int (*set_xstate)(struct super_block *, unsigned int, int); 330 int (*set_xstate)(struct super_block *, unsigned int, int);
331 int (*get_xstatev)(struct super_block *, struct fs_quota_statv *);
331}; 332};
332 333
333struct quota_format_type { 334struct quota_format_type {
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 1c50093ae656..6965fe394c3b 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -41,6 +41,7 @@ void __quota_error(struct super_block *sb, const char *func,
41void inode_add_rsv_space(struct inode *inode, qsize_t number); 41void inode_add_rsv_space(struct inode *inode, qsize_t number);
42void inode_claim_rsv_space(struct inode *inode, qsize_t number); 42void inode_claim_rsv_space(struct inode *inode, qsize_t number);
43void inode_sub_rsv_space(struct inode *inode, qsize_t number); 43void inode_sub_rsv_space(struct inode *inode, qsize_t number);
44void inode_reclaim_rsv_space(struct inode *inode, qsize_t number);
44 45
45void dquot_initialize(struct inode *inode); 46void dquot_initialize(struct inode *inode);
46void dquot_drop(struct inode *inode); 47void dquot_drop(struct inode *inode);
@@ -59,6 +60,7 @@ int dquot_alloc_inode(const struct inode *inode);
59 60
60int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); 61int dquot_claim_space_nodirty(struct inode *inode, qsize_t number);
61void dquot_free_inode(const struct inode *inode); 62void dquot_free_inode(const struct inode *inode);
63void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number);
62 64
63int dquot_disable(struct super_block *sb, int type, unsigned int flags); 65int dquot_disable(struct super_block *sb, int type, unsigned int flags);
64/* Suspend quotas on remount RO */ 66/* Suspend quotas on remount RO */
@@ -238,6 +240,13 @@ static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
238 return 0; 240 return 0;
239} 241}
240 242
243static inline int dquot_reclaim_space_nodirty(struct inode *inode,
244 qsize_t number)
245{
246 inode_sub_bytes(inode, number);
247 return 0;
248}
249
241static inline int dquot_disable(struct super_block *sb, int type, 250static inline int dquot_disable(struct super_block *sb, int type,
242 unsigned int flags) 251 unsigned int flags)
243{ 252{
@@ -336,6 +345,12 @@ static inline int dquot_claim_block(struct inode *inode, qsize_t nr)
336 return ret; 345 return ret;
337} 346}
338 347
348static inline void dquot_reclaim_block(struct inode *inode, qsize_t nr)
349{
350 dquot_reclaim_space_nodirty(inode, nr << inode->i_blkbits);
351 mark_inode_dirty_sync(inode);
352}
353
339static inline void dquot_free_space_nodirty(struct inode *inode, qsize_t nr) 354static inline void dquot_free_space_nodirty(struct inode *inode, qsize_t nr)
340{ 355{
341 __dquot_free_space(inode, nr, 0); 356 __dquot_free_space(inode, nr, 0);
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index ffc444c38b0a..403940787be1 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -231,6 +231,7 @@ unsigned long radix_tree_next_hole(struct radix_tree_root *root,
231unsigned long radix_tree_prev_hole(struct radix_tree_root *root, 231unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
232 unsigned long index, unsigned long max_scan); 232 unsigned long index, unsigned long max_scan);
233int radix_tree_preload(gfp_t gfp_mask); 233int radix_tree_preload(gfp_t gfp_mask);
234int radix_tree_maybe_preload(gfp_t gfp_mask);
234void radix_tree_init(void); 235void radix_tree_init(void);
235void *radix_tree_tag_set(struct radix_tree_root *root, 236void *radix_tree_tag_set(struct radix_tree_root *root,
236 unsigned long index, unsigned int tag); 237 unsigned long index, unsigned int tag);
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 8dfaa2ce2e95..73069cb6c54a 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -101,6 +101,7 @@ extern const struct raid6_calls raid6_altivec8;
101extern const struct raid6_calls raid6_avx2x1; 101extern const struct raid6_calls raid6_avx2x1;
102extern const struct raid6_calls raid6_avx2x2; 102extern const struct raid6_calls raid6_avx2x2;
103extern const struct raid6_calls raid6_avx2x4; 103extern const struct raid6_calls raid6_avx2x4;
104extern const struct raid6_calls raid6_tilegx8;
104 105
105struct raid6_recov_calls { 106struct raid6_recov_calls {
106 void (*data2)(int, size_t, int, int, void **); 107 void (*data2)(int, size_t, int, int, void **);
@@ -114,6 +115,11 @@ extern const struct raid6_recov_calls raid6_recov_intx1;
114extern const struct raid6_recov_calls raid6_recov_ssse3; 115extern const struct raid6_recov_calls raid6_recov_ssse3;
115extern const struct raid6_recov_calls raid6_recov_avx2; 116extern const struct raid6_recov_calls raid6_recov_avx2;
116 117
118extern const struct raid6_calls raid6_neonx1;
119extern const struct raid6_calls raid6_neonx2;
120extern const struct raid6_calls raid6_neonx4;
121extern const struct raid6_calls raid6_neonx8;
122
117/* Algorithm list */ 123/* Algorithm list */
118extern const struct raid6_calls * const raid6_algos[]; 124extern const struct raid6_calls * const raid6_algos[];
119extern const struct raid6_recov_calls *const raid6_recov_algos[]; 125extern const struct raid6_recov_calls *const raid6_recov_algos[];
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 69e37c2d1ea5..753207c8ce20 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -25,7 +25,7 @@ extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma);
25 25
26extern const struct file_operations ramfs_file_operations; 26extern const struct file_operations ramfs_file_operations;
27extern const struct vm_operations_struct generic_file_vm_ops; 27extern const struct vm_operations_struct generic_file_vm_ops;
28extern int __init init_rootfs(void); 28extern int __init init_ramfs_fs(void);
29 29
30int ramfs_fill_super(struct super_block *sb, void *data, int silent); 30int ramfs_fill_super(struct super_block *sb, void *data, int silent);
31 31
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 0022c1bb1e26..aa870a4ddf54 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -68,6 +68,10 @@ extern struct rb_node *rb_prev(const struct rb_node *);
68extern struct rb_node *rb_first(const struct rb_root *); 68extern struct rb_node *rb_first(const struct rb_root *);
69extern struct rb_node *rb_last(const struct rb_root *); 69extern struct rb_node *rb_last(const struct rb_root *);
70 70
71/* Postorder iteration - always visit the parent after its children */
72extern struct rb_node *rb_first_postorder(const struct rb_root *);
73extern struct rb_node *rb_next_postorder(const struct rb_node *);
74
71/* Fast replacement of a single node without remove/rebalance/add/rebalance */ 75/* Fast replacement of a single node without remove/rebalance/add/rebalance */
72extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, 76extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
73 struct rb_root *root); 77 struct rb_root *root);
@@ -81,4 +85,22 @@ static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
81 *rb_link = node; 85 *rb_link = node;
82} 86}
83 87
88/**
89 * rbtree_postorder_for_each_entry_safe - iterate over rb_root in post order of
90 * given type safe against removal of rb_node entry
91 *
92 * @pos: the 'type *' to use as a loop cursor.
93 * @n: another 'type *' to use as temporary storage
94 * @root: 'rb_root *' of the rbtree.
95 * @field: the name of the rb_node field within 'type'.
96 */
97#define rbtree_postorder_for_each_entry_safe(pos, n, root, field) \
98 for (pos = rb_entry(rb_first_postorder(root), typeof(*pos), field),\
99 n = rb_entry(rb_next_postorder(&pos->field), \
100 typeof(*pos), field); \
101 &pos->field; \
102 pos = n, \
103 n = rb_entry(rb_next_postorder(&pos->field), \
104 typeof(*pos), field))
105
84#endif /* _LINUX_RBTREE_H */ 106#endif /* _LINUX_RBTREE_H */
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index f4b1001a4676..4106721c4e5e 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -267,8 +267,9 @@ static inline void list_splice_init_rcu(struct list_head *list,
267 */ 267 */
268#define list_first_or_null_rcu(ptr, type, member) \ 268#define list_first_or_null_rcu(ptr, type, member) \
269 ({struct list_head *__ptr = (ptr); \ 269 ({struct list_head *__ptr = (ptr); \
270 struct list_head __rcu *__next = list_next_rcu(__ptr); \ 270 struct list_head *__next = ACCESS_ONCE(__ptr->next); \
271 likely(__ptr != __next) ? container_of(__next, type, member) : NULL; \ 271 likely(__ptr != __next) ? \
272 list_entry_rcu(__next, type, member) : NULL; \
272 }) 273 })
273 274
274/** 275/**
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index ddcc7826d907..f1f1bc39346b 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -52,7 +52,7 @@ extern int rcutorture_runnable; /* for sysctl */
52#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 52#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
53extern void rcutorture_record_test_transition(void); 53extern void rcutorture_record_test_transition(void);
54extern void rcutorture_record_progress(unsigned long vernum); 54extern void rcutorture_record_progress(unsigned long vernum);
55extern void do_trace_rcu_torture_read(char *rcutorturename, 55extern void do_trace_rcu_torture_read(const char *rcutorturename,
56 struct rcu_head *rhp, 56 struct rcu_head *rhp,
57 unsigned long secs, 57 unsigned long secs,
58 unsigned long c_old, 58 unsigned long c_old,
@@ -65,7 +65,7 @@ static inline void rcutorture_record_progress(unsigned long vernum)
65{ 65{
66} 66}
67#ifdef CONFIG_RCU_TRACE 67#ifdef CONFIG_RCU_TRACE
68extern void do_trace_rcu_torture_read(char *rcutorturename, 68extern void do_trace_rcu_torture_read(const char *rcutorturename,
69 struct rcu_head *rhp, 69 struct rcu_head *rhp,
70 unsigned long secs, 70 unsigned long secs,
71 unsigned long c_old, 71 unsigned long c_old,
@@ -216,6 +216,7 @@ static inline int rcu_preempt_depth(void)
216#endif /* #else #ifdef CONFIG_PREEMPT_RCU */ 216#endif /* #else #ifdef CONFIG_PREEMPT_RCU */
217 217
218/* Internal to kernel */ 218/* Internal to kernel */
219extern void rcu_init(void);
219extern void rcu_sched_qs(int cpu); 220extern void rcu_sched_qs(int cpu);
220extern void rcu_bh_qs(int cpu); 221extern void rcu_bh_qs(int cpu);
221extern void rcu_check_callbacks(int cpu, int user); 222extern void rcu_check_callbacks(int cpu, int user);
@@ -228,19 +229,13 @@ extern void rcu_irq_exit(void);
228#ifdef CONFIG_RCU_USER_QS 229#ifdef CONFIG_RCU_USER_QS
229extern void rcu_user_enter(void); 230extern void rcu_user_enter(void);
230extern void rcu_user_exit(void); 231extern void rcu_user_exit(void);
231extern void rcu_user_enter_after_irq(void);
232extern void rcu_user_exit_after_irq(void);
233#else 232#else
234static inline void rcu_user_enter(void) { } 233static inline void rcu_user_enter(void) { }
235static inline void rcu_user_exit(void) { } 234static inline void rcu_user_exit(void) { }
236static inline void rcu_user_enter_after_irq(void) { }
237static inline void rcu_user_exit_after_irq(void) { }
238static inline void rcu_user_hooks_switch(struct task_struct *prev, 235static inline void rcu_user_hooks_switch(struct task_struct *prev,
239 struct task_struct *next) { } 236 struct task_struct *next) { }
240#endif /* CONFIG_RCU_USER_QS */ 237#endif /* CONFIG_RCU_USER_QS */
241 238
242extern void exit_rcu(void);
243
244/** 239/**
245 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers 240 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers
246 * @a: Code that RCU needs to pay attention to. 241 * @a: Code that RCU needs to pay attention to.
@@ -277,7 +272,7 @@ void wait_rcu_gp(call_rcu_func_t crf);
277 272
278#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 273#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
279#include <linux/rcutree.h> 274#include <linux/rcutree.h>
280#elif defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU) 275#elif defined(CONFIG_TINY_RCU)
281#include <linux/rcutiny.h> 276#include <linux/rcutiny.h>
282#else 277#else
283#error "Unknown RCU implementation specified to kernel configuration" 278#error "Unknown RCU implementation specified to kernel configuration"
@@ -1016,4 +1011,22 @@ static inline bool rcu_is_nocb_cpu(int cpu) { return false; }
1016#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */ 1011#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
1017 1012
1018 1013
1014/* Only for use by adaptive-ticks code. */
1015#ifdef CONFIG_NO_HZ_FULL_SYSIDLE
1016extern bool rcu_sys_is_idle(void);
1017extern void rcu_sysidle_force_exit(void);
1018#else /* #ifdef CONFIG_NO_HZ_FULL_SYSIDLE */
1019
1020static inline bool rcu_sys_is_idle(void)
1021{
1022 return false;
1023}
1024
1025static inline void rcu_sysidle_force_exit(void)
1026{
1027}
1028
1029#endif /* #else #ifdef CONFIG_NO_HZ_FULL_SYSIDLE */
1030
1031
1019#endif /* __LINUX_RCUPDATE_H */ 1032#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 4e56a9c69a35..e31005ee339e 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -27,10 +27,6 @@
27 27
28#include <linux/cache.h> 28#include <linux/cache.h>
29 29
30static inline void rcu_init(void)
31{
32}
33
34static inline void rcu_barrier_bh(void) 30static inline void rcu_barrier_bh(void)
35{ 31{
36 wait_rcu_gp(call_rcu_bh); 32 wait_rcu_gp(call_rcu_bh);
@@ -41,8 +37,6 @@ static inline void rcu_barrier_sched(void)
41 wait_rcu_gp(call_rcu_sched); 37 wait_rcu_gp(call_rcu_sched);
42} 38}
43 39
44#ifdef CONFIG_TINY_RCU
45
46static inline void synchronize_rcu_expedited(void) 40static inline void synchronize_rcu_expedited(void)
47{ 41{
48 synchronize_sched(); /* Only one CPU, so pretty fast anyway!!! */ 42 synchronize_sched(); /* Only one CPU, so pretty fast anyway!!! */
@@ -53,17 +47,6 @@ static inline void rcu_barrier(void)
53 rcu_barrier_sched(); /* Only one CPU, so only one list of callbacks! */ 47 rcu_barrier_sched(); /* Only one CPU, so only one list of callbacks! */
54} 48}
55 49
56#else /* #ifdef CONFIG_TINY_RCU */
57
58void synchronize_rcu_expedited(void);
59
60static inline void rcu_barrier(void)
61{
62 wait_rcu_gp(call_rcu);
63}
64
65#endif /* #else #ifdef CONFIG_TINY_RCU */
66
67static inline void synchronize_rcu_bh(void) 50static inline void synchronize_rcu_bh(void)
68{ 51{
69 synchronize_sched(); 52 synchronize_sched();
@@ -85,35 +68,15 @@ static inline void kfree_call_rcu(struct rcu_head *head,
85 call_rcu(head, func); 68 call_rcu(head, func);
86} 69}
87 70
88#ifdef CONFIG_TINY_RCU
89
90static inline void rcu_preempt_note_context_switch(void)
91{
92}
93
94static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies) 71static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
95{ 72{
96 *delta_jiffies = ULONG_MAX; 73 *delta_jiffies = ULONG_MAX;
97 return 0; 74 return 0;
98} 75}
99 76
100#else /* #ifdef CONFIG_TINY_RCU */
101
102void rcu_preempt_note_context_switch(void);
103int rcu_preempt_needs_cpu(void);
104
105static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
106{
107 *delta_jiffies = ULONG_MAX;
108 return rcu_preempt_needs_cpu();
109}
110
111#endif /* #else #ifdef CONFIG_TINY_RCU */
112
113static inline void rcu_note_context_switch(int cpu) 77static inline void rcu_note_context_switch(int cpu)
114{ 78{
115 rcu_sched_qs(cpu); 79 rcu_sched_qs(cpu);
116 rcu_preempt_note_context_switch();
117} 80}
118 81
119/* 82/*
@@ -156,6 +119,10 @@ static inline void rcu_cpu_stall_reset(void)
156{ 119{
157} 120}
158 121
122static inline void exit_rcu(void)
123{
124}
125
159#ifdef CONFIG_DEBUG_LOCK_ALLOC 126#ifdef CONFIG_DEBUG_LOCK_ALLOC
160extern int rcu_scheduler_active __read_mostly; 127extern int rcu_scheduler_active __read_mostly;
161extern void rcu_scheduler_starting(void); 128extern void rcu_scheduler_starting(void);
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 952b79339304..226169d1bd2b 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -30,7 +30,6 @@
30#ifndef __LINUX_RCUTREE_H 30#ifndef __LINUX_RCUTREE_H
31#define __LINUX_RCUTREE_H 31#define __LINUX_RCUTREE_H
32 32
33extern void rcu_init(void);
34extern void rcu_note_context_switch(int cpu); 33extern void rcu_note_context_switch(int cpu);
35extern int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies); 34extern int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies);
36extern void rcu_cpu_stall_reset(void); 35extern void rcu_cpu_stall_reset(void);
@@ -86,6 +85,8 @@ extern void rcu_force_quiescent_state(void);
86extern void rcu_bh_force_quiescent_state(void); 85extern void rcu_bh_force_quiescent_state(void);
87extern void rcu_sched_force_quiescent_state(void); 86extern void rcu_sched_force_quiescent_state(void);
88 87
88extern void exit_rcu(void);
89
89extern void rcu_scheduler_starting(void); 90extern void rcu_scheduler_starting(void);
90extern int rcu_scheduler_active __read_mostly; 91extern int rcu_scheduler_active __read_mostly;
91 92
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 23b36304cd88..8e00f9f6f963 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -10,6 +10,31 @@
10#define SYS_HALT 0x0002 /* Notify of system halt */ 10#define SYS_HALT 0x0002 /* Notify of system halt */
11#define SYS_POWER_OFF 0x0003 /* Notify of system power off */ 11#define SYS_POWER_OFF 0x0003 /* Notify of system power off */
12 12
13enum reboot_mode {
14 REBOOT_COLD = 0,
15 REBOOT_WARM,
16 REBOOT_HARD,
17 REBOOT_SOFT,
18 REBOOT_GPIO,
19};
20extern enum reboot_mode reboot_mode;
21
22enum reboot_type {
23 BOOT_TRIPLE = 't',
24 BOOT_KBD = 'k',
25 BOOT_BIOS = 'b',
26 BOOT_ACPI = 'a',
27 BOOT_EFI = 'e',
28 BOOT_CF9 = 'p',
29 BOOT_CF9_COND = 'q',
30};
31extern enum reboot_type reboot_type;
32
33extern int reboot_default;
34extern int reboot_cpu;
35extern int reboot_force;
36
37
13extern int register_reboot_notifier(struct notifier_block *); 38extern int register_reboot_notifier(struct notifier_block *);
14extern int unregister_reboot_notifier(struct notifier_block *); 39extern int unregister_reboot_notifier(struct notifier_block *);
15 40
@@ -26,7 +51,7 @@ extern void machine_shutdown(void);
26struct pt_regs; 51struct pt_regs;
27extern void machine_crash_shutdown(struct pt_regs *); 52extern void machine_crash_shutdown(struct pt_regs *);
28 53
29/* 54/*
30 * Architecture independent implemenations of sys_reboot commands. 55 * Architecture independent implemenations of sys_reboot commands.
31 */ 56 */
32 57
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 02d84e24b7c2..a10380bfbeac 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -15,6 +15,8 @@
15 15
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/rbtree.h> 17#include <linux/rbtree.h>
18#include <linux/err.h>
19#include <linux/bug.h>
18 20
19struct module; 21struct module;
20struct device; 22struct device;
@@ -23,6 +25,7 @@ struct irq_domain;
23struct spi_device; 25struct spi_device;
24struct regmap; 26struct regmap;
25struct regmap_range_cfg; 27struct regmap_range_cfg;
28struct regmap_field;
26 29
27/* An enum of all the supported cache types */ 30/* An enum of all the supported cache types */
28enum regcache_type { 31enum regcache_type {
@@ -394,10 +397,15 @@ bool regmap_can_raw_write(struct regmap *map);
394int regcache_sync(struct regmap *map); 397int regcache_sync(struct regmap *map);
395int regcache_sync_region(struct regmap *map, unsigned int min, 398int regcache_sync_region(struct regmap *map, unsigned int min,
396 unsigned int max); 399 unsigned int max);
400int regcache_drop_region(struct regmap *map, unsigned int min,
401 unsigned int max);
397void regcache_cache_only(struct regmap *map, bool enable); 402void regcache_cache_only(struct regmap *map, bool enable);
398void regcache_cache_bypass(struct regmap *map, bool enable); 403void regcache_cache_bypass(struct regmap *map, bool enable);
399void regcache_mark_dirty(struct regmap *map); 404void regcache_mark_dirty(struct regmap *map);
400 405
406bool regmap_check_range_table(struct regmap *map, unsigned int reg,
407 const struct regmap_access_table *table);
408
401int regmap_register_patch(struct regmap *map, const struct reg_default *regs, 409int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
402 int num_regs); 410 int num_regs);
403 411
@@ -412,6 +420,36 @@ bool regmap_reg_in_ranges(unsigned int reg,
412 unsigned int nranges); 420 unsigned int nranges);
413 421
414/** 422/**
423 * Description of an register field
424 *
425 * @reg: Offset of the register within the regmap bank
426 * @lsb: lsb of the register field.
427 * @reg: msb of the register field.
428 */
429struct reg_field {
430 unsigned int reg;
431 unsigned int lsb;
432 unsigned int msb;
433};
434
435#define REG_FIELD(_reg, _lsb, _msb) { \
436 .reg = _reg, \
437 .lsb = _lsb, \
438 .msb = _msb, \
439 }
440
441struct regmap_field *regmap_field_alloc(struct regmap *regmap,
442 struct reg_field reg_field);
443void regmap_field_free(struct regmap_field *field);
444
445struct regmap_field *devm_regmap_field_alloc(struct device *dev,
446 struct regmap *regmap, struct reg_field reg_field);
447void devm_regmap_field_free(struct device *dev, struct regmap_field *field);
448
449int regmap_field_read(struct regmap_field *field, unsigned int *val);
450int regmap_field_write(struct regmap_field *field, unsigned int val);
451
452/**
415 * Description of an IRQ for the generic regmap irq_chip. 453 * Description of an IRQ for the generic regmap irq_chip.
416 * 454 *
417 * @reg_offset: Offset of the status/mask register within the bank 455 * @reg_offset: Offset of the status/mask register within the bank
@@ -434,6 +472,9 @@ struct regmap_irq {
434 * @ack_base: Base ack address. If zero then the chip is clear on read. 472 * @ack_base: Base ack address. If zero then the chip is clear on read.
435 * @wake_base: Base address for wake enables. If zero unsupported. 473 * @wake_base: Base address for wake enables. If zero unsupported.
436 * @irq_reg_stride: Stride to use for chips where registers are not contiguous. 474 * @irq_reg_stride: Stride to use for chips where registers are not contiguous.
475 * @init_ack_masked: Ack all masked interrupts once during initalization.
476 * @mask_invert: Inverted mask register: cleared bits are masked out.
477 * @wake_invert: Inverted wake register: cleared bits are wake enabled.
437 * @runtime_pm: Hold a runtime PM lock on the device when accessing it. 478 * @runtime_pm: Hold a runtime PM lock on the device when accessing it.
438 * 479 *
439 * @num_regs: Number of registers in each control bank. 480 * @num_regs: Number of registers in each control bank.
@@ -449,9 +490,10 @@ struct regmap_irq_chip {
449 unsigned int ack_base; 490 unsigned int ack_base;
450 unsigned int wake_base; 491 unsigned int wake_base;
451 unsigned int irq_reg_stride; 492 unsigned int irq_reg_stride;
452 unsigned int mask_invert; 493 bool init_ack_masked:1;
453 unsigned int wake_invert; 494 bool mask_invert:1;
454 bool runtime_pm; 495 bool wake_invert:1;
496 bool runtime_pm:1;
455 497
456 int num_regs; 498 int num_regs;
457 499
@@ -562,6 +604,13 @@ static inline int regcache_sync_region(struct regmap *map, unsigned int min,
562 return -EINVAL; 604 return -EINVAL;
563} 605}
564 606
607static inline int regcache_drop_region(struct regmap *map, unsigned int min,
608 unsigned int max)
609{
610 WARN_ONCE(1, "regmap API is disabled");
611 return -EINVAL;
612}
613
565static inline void regcache_cache_only(struct regmap *map, bool enable) 614static inline void regcache_cache_only(struct regmap *map, bool enable)
566{ 615{
567 WARN_ONCE(1, "regmap API is disabled"); 616 WARN_ONCE(1, "regmap API is disabled");
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 7c5ff0c55773..75307447cef9 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -336,8 +336,4 @@ static inline int ab8500_regulator_debug_exit(struct platform_device *pdev)
336} 336}
337#endif 337#endif
338 338
339/* AB8500 external regulator functions. */
340int ab8500_ext_regulator_init(struct platform_device *pdev);
341void ab8500_ext_regulator_exit(struct platform_device *pdev);
342
343#endif 339#endif
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 145022a83085..27be915caa96 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -137,6 +137,12 @@ struct regulator *__must_check devm_regulator_get(struct device *dev,
137 const char *id); 137 const char *id);
138struct regulator *__must_check regulator_get_exclusive(struct device *dev, 138struct regulator *__must_check regulator_get_exclusive(struct device *dev,
139 const char *id); 139 const char *id);
140struct regulator *__must_check devm_regulator_get_exclusive(struct device *dev,
141 const char *id);
142struct regulator *__must_check regulator_get_optional(struct device *dev,
143 const char *id);
144struct regulator *__must_check devm_regulator_get_optional(struct device *dev,
145 const char *id);
140void regulator_put(struct regulator *regulator); 146void regulator_put(struct regulator *regulator);
141void devm_regulator_put(struct regulator *regulator); 147void devm_regulator_put(struct regulator *regulator);
142 148
@@ -165,6 +171,7 @@ int regulator_count_voltages(struct regulator *regulator);
165int regulator_list_voltage(struct regulator *regulator, unsigned selector); 171int regulator_list_voltage(struct regulator *regulator, unsigned selector);
166int regulator_is_supported_voltage(struct regulator *regulator, 172int regulator_is_supported_voltage(struct regulator *regulator,
167 int min_uV, int max_uV); 173 int min_uV, int max_uV);
174unsigned int regulator_get_linear_step(struct regulator *regulator);
168int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); 175int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
169int regulator_set_voltage_time(struct regulator *regulator, 176int regulator_set_voltage_time(struct regulator *regulator,
170 int old_uV, int new_uV); 177 int old_uV, int new_uV);
@@ -216,6 +223,25 @@ devm_regulator_get(struct device *dev, const char *id)
216 return NULL; 223 return NULL;
217} 224}
218 225
226static inline struct regulator *__must_check
227regulator_get_exclusive(struct device *dev, const char *id)
228{
229 return NULL;
230}
231
232static inline struct regulator *__must_check
233regulator_get_optional(struct device *dev, const char *id)
234{
235 return NULL;
236}
237
238
239static inline struct regulator *__must_check
240devm_regulator_get_optional(struct device *dev, const char *id)
241{
242 return NULL;
243}
244
219static inline void regulator_put(struct regulator *regulator) 245static inline void regulator_put(struct regulator *regulator)
220{ 246{
221} 247}
@@ -368,8 +394,11 @@ static inline int regulator_count_voltages(struct regulator *regulator)
368static inline int regulator_set_voltage_tol(struct regulator *regulator, 394static inline int regulator_set_voltage_tol(struct regulator *regulator,
369 int new_uV, int tol_uV) 395 int new_uV, int tol_uV)
370{ 396{
371 return regulator_set_voltage(regulator, 397 if (regulator_set_voltage(regulator, new_uV, new_uV + tol_uV) == 0)
372 new_uV - tol_uV, new_uV + tol_uV); 398 return 0;
399 else
400 return regulator_set_voltage(regulator,
401 new_uV - tol_uV, new_uV + tol_uV);
373} 402}
374 403
375static inline int regulator_is_supported_voltage_tol(struct regulator *regulator, 404static inline int regulator_is_supported_voltage_tol(struct regulator *regulator,
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 6700cc94bdd1..9bdad43ad228 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -40,6 +40,26 @@ enum regulator_status {
40}; 40};
41 41
42/** 42/**
43 * struct regulator_linear_range - specify linear voltage ranges
44 *
45 * Specify a range of voltages for regulator_map_linar_range() and
46 * regulator_list_linear_range().
47 *
48 * @min_uV: Lowest voltage in range
49 * @max_uV: Highest voltage in range
50 * @min_sel: Lowest selector for range
51 * @max_sel: Highest selector for range
52 * @uV_step: Step size
53 */
54struct regulator_linear_range {
55 unsigned int min_uV;
56 unsigned int max_uV;
57 unsigned int min_sel;
58 unsigned int max_sel;
59 unsigned int uV_step;
60};
61
62/**
43 * struct regulator_ops - regulator operations. 63 * struct regulator_ops - regulator operations.
44 * 64 *
45 * @enable: Configure the regulator as enabled. 65 * @enable: Configure the regulator as enabled.
@@ -223,6 +243,9 @@ struct regulator_desc {
223 unsigned int linear_min_sel; 243 unsigned int linear_min_sel;
224 unsigned int ramp_delay; 244 unsigned int ramp_delay;
225 245
246 const struct regulator_linear_range *linear_ranges;
247 int n_linear_ranges;
248
226 const unsigned int *volt_table; 249 const unsigned int *volt_table;
227 250
228 unsigned int vsel_reg; 251 unsigned int vsel_reg;
@@ -326,10 +349,14 @@ int regulator_mode_to_status(unsigned int);
326 349
327int regulator_list_voltage_linear(struct regulator_dev *rdev, 350int regulator_list_voltage_linear(struct regulator_dev *rdev,
328 unsigned int selector); 351 unsigned int selector);
352int regulator_list_voltage_linear_range(struct regulator_dev *rdev,
353 unsigned int selector);
329int regulator_list_voltage_table(struct regulator_dev *rdev, 354int regulator_list_voltage_table(struct regulator_dev *rdev,
330 unsigned int selector); 355 unsigned int selector);
331int regulator_map_voltage_linear(struct regulator_dev *rdev, 356int regulator_map_voltage_linear(struct regulator_dev *rdev,
332 int min_uV, int max_uV); 357 int min_uV, int max_uV);
358int regulator_map_voltage_linear_range(struct regulator_dev *rdev,
359 int min_uV, int max_uV);
333int regulator_map_voltage_iterate(struct regulator_dev *rdev, 360int regulator_map_voltage_iterate(struct regulator_dev *rdev,
334 int min_uV, int max_uV); 361 int min_uV, int max_uV);
335int regulator_map_voltage_ascend(struct regulator_dev *rdev, 362int regulator_map_voltage_ascend(struct regulator_dev *rdev,
diff --git a/include/linux/regulator/fan53555.h b/include/linux/regulator/fan53555.h
index 5c45c85d52ca..f13880e84d85 100644
--- a/include/linux/regulator/fan53555.h
+++ b/include/linux/regulator/fan53555.h
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#ifndef __FAN53555_H__ 13#ifndef __FAN53555_H__
14#define __FAN53555_H__
14 15
15/* VSEL ID */ 16/* VSEL ID */
16enum { 17enum {
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 36adbc82de6a..999b20ce06cf 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -134,6 +134,7 @@ struct regulation_constraints {
134 unsigned always_on:1; /* regulator never off when system is on */ 134 unsigned always_on:1; /* regulator never off when system is on */
135 unsigned boot_on:1; /* bootloader/firmware enabled regulator */ 135 unsigned boot_on:1; /* bootloader/firmware enabled regulator */
136 unsigned apply_uV:1; /* apply uV constraint if min == max */ 136 unsigned apply_uV:1; /* apply uV constraint if min == max */
137 unsigned ramp_disable:1; /* disable ramp delay */
137}; 138};
138 139
139/** 140/**
diff --git a/include/linux/regulator/max8660.h b/include/linux/regulator/max8660.h
index 9936763621c7..f8a6a4844864 100644
--- a/include/linux/regulator/max8660.h
+++ b/include/linux/regulator/max8660.h
@@ -39,7 +39,7 @@ enum {
39 */ 39 */
40struct max8660_subdev_data { 40struct max8660_subdev_data {
41 int id; 41 int id;
42 char *name; 42 const char *name;
43 struct regulator_init_data *platform_data; 43 struct regulator_init_data *platform_data;
44}; 44};
45 45
diff --git a/include/linux/regulator/pfuze100.h b/include/linux/regulator/pfuze100.h
new file mode 100644
index 000000000000..65d550bf3954
--- /dev/null
+++ b/include/linux/regulator/pfuze100.h
@@ -0,0 +1,44 @@
1/*
2 * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved.
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 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18#ifndef __LINUX_REG_PFUZE100_H
19#define __LINUX_REG_PFUZE100_H
20
21#define PFUZE100_SW1AB 0
22#define PFUZE100_SW1C 1
23#define PFUZE100_SW2 2
24#define PFUZE100_SW3A 3
25#define PFUZE100_SW3B 4
26#define PFUZE100_SW4 5
27#define PFUZE100_SWBST 6
28#define PFUZE100_VSNVS 7
29#define PFUZE100_VREFDDR 8
30#define PFUZE100_VGEN1 9
31#define PFUZE100_VGEN2 10
32#define PFUZE100_VGEN3 11
33#define PFUZE100_VGEN4 12
34#define PFUZE100_VGEN5 13
35#define PFUZE100_VGEN6 14
36#define PFUZE100_MAX_REGULATOR 15
37
38struct regulator_init_data;
39
40struct pfuze_regulator_platform_data {
41 struct regulator_init_data *init_data[PFUZE100_MAX_REGULATOR];
42};
43
44#endif /* __LINUX_REG_PFUZE100_H */
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 96a509b6be04..201a69749659 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -54,7 +54,7 @@ struct res_counter {
54 struct res_counter *parent; 54 struct res_counter *parent;
55}; 55};
56 56
57#define RESOURCE_MAX (unsigned long long)LLONG_MAX 57#define RES_COUNTER_MAX ULLONG_MAX
58 58
59/** 59/**
60 * Helpers to interact with userspace 60 * Helpers to interact with userspace
diff --git a/include/linux/reservation.h b/include/linux/reservation.h
new file mode 100644
index 000000000000..813dae960ebd
--- /dev/null
+++ b/include/linux/reservation.h
@@ -0,0 +1,62 @@
1/*
2 * Header file for reservations for dma-buf and ttm
3 *
4 * Copyright(C) 2011 Linaro Limited. All rights reserved.
5 * Copyright (C) 2012-2013 Canonical Ltd
6 * Copyright (C) 2012 Texas Instruments
7 *
8 * Authors:
9 * Rob Clark <rob.clark@linaro.org>
10 * Maarten Lankhorst <maarten.lankhorst@canonical.com>
11 * Thomas Hellstrom <thellstrom-at-vmware-dot-com>
12 *
13 * Based on bo.c which bears the following copyright notice,
14 * but is dual licensed:
15 *
16 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
17 * All Rights Reserved.
18 *
19 * Permission is hereby granted, free of charge, to any person obtaining a
20 * copy of this software and associated documentation files (the
21 * "Software"), to deal in the Software without restriction, including
22 * without limitation the rights to use, copy, modify, merge, publish,
23 * distribute, sub license, and/or sell copies of the Software, and to
24 * permit persons to whom the Software is furnished to do so, subject to
25 * the following conditions:
26 *
27 * The above copyright notice and this permission notice (including the
28 * next paragraph) shall be included in all copies or substantial portions
29 * of the Software.
30 *
31 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
34 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
35 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
36 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
37 * USE OR OTHER DEALINGS IN THE SOFTWARE.
38 */
39#ifndef _LINUX_RESERVATION_H
40#define _LINUX_RESERVATION_H
41
42#include <linux/ww_mutex.h>
43
44extern struct ww_class reservation_ww_class;
45
46struct reservation_object {
47 struct ww_mutex lock;
48};
49
50static inline void
51reservation_object_init(struct reservation_object *obj)
52{
53 ww_mutex_init(&obj->lock, &reservation_ww_class);
54}
55
56static inline void
57reservation_object_fini(struct reservation_object *obj)
58{
59 ww_mutex_destroy(&obj->lock);
60}
61
62#endif /* _LINUX_RESERVATION_H */
diff --git a/include/linux/rio.h b/include/linux/rio.h
index 18e099342e6f..b71d5738e683 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -20,6 +20,7 @@
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/rio_regs.h> 22#include <linux/rio_regs.h>
23#include <linux/mod_devicetable.h>
23#ifdef CONFIG_RAPIDIO_DMA_ENGINE 24#ifdef CONFIG_RAPIDIO_DMA_ENGINE
24#include <linux/dmaengine.h> 25#include <linux/dmaengine.h>
25#endif 26#endif
@@ -91,9 +92,24 @@ union rio_pw_msg;
91/** 92/**
92 * struct rio_switch - RIO switch info 93 * struct rio_switch - RIO switch info
93 * @node: Node in global list of switches 94 * @node: Node in global list of switches
94 * @switchid: Switch ID that is unique across a network
95 * @route_table: Copy of switch routing table 95 * @route_table: Copy of switch routing table
96 * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0 96 * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0
97 * @ops: pointer to switch-specific operations
98 * @lock: lock to serialize operations updates
99 * @nextdev: Array of per-port pointers to the next attached device
100 */
101struct rio_switch {
102 struct list_head node;
103 u8 *route_table;
104 u32 port_ok;
105 struct rio_switch_ops *ops;
106 spinlock_t lock;
107 struct rio_dev *nextdev[0];
108};
109
110/**
111 * struct rio_switch_ops - Per-switch operations
112 * @owner: The module owner of this structure
97 * @add_entry: Callback for switch-specific route add function 113 * @add_entry: Callback for switch-specific route add function
98 * @get_entry: Callback for switch-specific route get function 114 * @get_entry: Callback for switch-specific route get function
99 * @clr_table: Callback for switch-specific clear route table function 115 * @clr_table: Callback for switch-specific clear route table function
@@ -101,14 +117,12 @@ union rio_pw_msg;
101 * @get_domain: Callback for switch-specific domain get function 117 * @get_domain: Callback for switch-specific domain get function
102 * @em_init: Callback for switch-specific error management init function 118 * @em_init: Callback for switch-specific error management init function
103 * @em_handle: Callback for switch-specific error management handler function 119 * @em_handle: Callback for switch-specific error management handler function
104 * @sw_sysfs: Callback that initializes switch-specific sysfs attributes 120 *
105 * @nextdev: Array of per-port pointers to the next attached device 121 * Defines the operations that are necessary to initialize/control
122 * a particular RIO switch device.
106 */ 123 */
107struct rio_switch { 124struct rio_switch_ops {
108 struct list_head node; 125 struct module *owner;
109 u16 switchid;
110 u8 *route_table;
111 u32 port_ok;
112 int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, 126 int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
113 u16 table, u16 route_destid, u8 route_port); 127 u16 table, u16 route_destid, u8 route_port);
114 int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, 128 int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
@@ -121,8 +135,6 @@ struct rio_switch {
121 u8 *sw_domain); 135 u8 *sw_domain);
122 int (*em_init) (struct rio_dev *dev); 136 int (*em_init) (struct rio_dev *dev);
123 int (*em_handle) (struct rio_dev *dev, u8 swport); 137 int (*em_handle) (struct rio_dev *dev, u8 swport);
124 int (*sw_sysfs) (struct rio_dev *dev, int create);
125 struct rio_dev *nextdev[0];
126}; 138};
127 139
128/** 140/**
@@ -130,6 +142,7 @@ struct rio_switch {
130 * @global_list: Node in list of all RIO devices 142 * @global_list: Node in list of all RIO devices
131 * @net_list: Node in list of RIO devices in a network 143 * @net_list: Node in list of RIO devices in a network
132 * @net: Network this device is a part of 144 * @net: Network this device is a part of
145 * @do_enum: Enumeration flag
133 * @did: Device ID 146 * @did: Device ID
134 * @vid: Vendor ID 147 * @vid: Vendor ID
135 * @device_rev: Device revision 148 * @device_rev: Device revision
@@ -158,6 +171,7 @@ struct rio_dev {
158 struct list_head global_list; /* node in list of all RIO devices */ 171 struct list_head global_list; /* node in list of all RIO devices */
159 struct list_head net_list; /* node in per net list */ 172 struct list_head net_list; /* node in per net list */
160 struct rio_net *net; /* RIO net this device resides in */ 173 struct rio_net *net; /* RIO net this device resides in */
174 bool do_enum;
161 u16 did; 175 u16 did;
162 u16 vid; 176 u16 vid;
163 u32 device_rev; 177 u32 device_rev;
@@ -297,10 +311,6 @@ struct rio_net {
297 struct rio_id_table destid_table; /* destID allocation table */ 311 struct rio_id_table destid_table; /* destID allocation table */
298}; 312};
299 313
300/* Definitions used by switch sysfs initialization callback */
301#define RIO_SW_SYSFS_CREATE 1 /* Create switch attributes */
302#define RIO_SW_SYSFS_REMOVE 0 /* Remove switch attributes */
303
304/* Low-level architecture-dependent routines */ 314/* Low-level architecture-dependent routines */
305 315
306/** 316/**
@@ -385,35 +395,6 @@ struct rio_driver {
385 395
386#define to_rio_driver(drv) container_of(drv,struct rio_driver, driver) 396#define to_rio_driver(drv) container_of(drv,struct rio_driver, driver)
387 397
388/**
389 * struct rio_device_id - RIO device identifier
390 * @did: RIO device ID
391 * @vid: RIO vendor ID
392 * @asm_did: RIO assembly device ID
393 * @asm_vid: RIO assembly vendor ID
394 *
395 * Identifies a RIO device based on both the device/vendor IDs and
396 * the assembly device/vendor IDs.
397 */
398struct rio_device_id {
399 u16 did, vid;
400 u16 asm_did, asm_vid;
401};
402
403/**
404 * struct rio_switch_ops - Per-switch operations
405 * @vid: RIO vendor ID
406 * @did: RIO device ID
407 * @init_hook: Callback that performs switch device initialization
408 *
409 * Defines the operations that are necessary to initialize/control
410 * a particular RIO switch device.
411 */
412struct rio_switch_ops {
413 u16 vid, did;
414 int (*init_hook) (struct rio_dev *rdev, int do_enum);
415};
416
417union rio_pw_msg { 398union rio_pw_msg {
418 struct { 399 struct {
419 u32 comptag; /* Component Tag CSR */ 400 u32 comptag; /* Component Tag CSR */
@@ -468,14 +449,29 @@ static inline struct rio_mport *dma_to_mport(struct dma_device *ddev)
468 449
469/** 450/**
470 * struct rio_scan - RIO enumeration and discovery operations 451 * struct rio_scan - RIO enumeration and discovery operations
452 * @owner: The module owner of this structure
471 * @enumerate: Callback to perform RapidIO fabric enumeration. 453 * @enumerate: Callback to perform RapidIO fabric enumeration.
472 * @discover: Callback to perform RapidIO fabric discovery. 454 * @discover: Callback to perform RapidIO fabric discovery.
473 */ 455 */
474struct rio_scan { 456struct rio_scan {
457 struct module *owner;
475 int (*enumerate)(struct rio_mport *mport, u32 flags); 458 int (*enumerate)(struct rio_mport *mport, u32 flags);
476 int (*discover)(struct rio_mport *mport, u32 flags); 459 int (*discover)(struct rio_mport *mport, u32 flags);
477}; 460};
478 461
462/**
463 * struct rio_scan_node - list node to register RapidIO enumeration and
464 * discovery methods with RapidIO core.
465 * @mport_id: ID of an mport (net) serviced by this enumerator
466 * @node: node in global list of registered enumerators
467 * @ops: RIO enumeration and discovery operations
468 */
469struct rio_scan_node {
470 int mport_id;
471 struct list_head node;
472 struct rio_scan *ops;
473};
474
479/* Architecture and hardware-specific functions */ 475/* Architecture and hardware-specific functions */
480extern int rio_register_mport(struct rio_mport *); 476extern int rio_register_mport(struct rio_mport *);
481extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int); 477extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);
diff --git a/include/linux/rio_ids.h b/include/linux/rio_ids.h
index b66d13d1bdc0..2543bc163d54 100644
--- a/include/linux/rio_ids.h
+++ b/include/linux/rio_ids.h
@@ -13,8 +13,6 @@
13#ifndef LINUX_RIO_IDS_H 13#ifndef LINUX_RIO_IDS_H
14#define LINUX_RIO_IDS_H 14#define LINUX_RIO_IDS_H
15 15
16#define RIO_ANY_ID 0xffff
17
18#define RIO_VID_FREESCALE 0x0002 16#define RIO_VID_FREESCALE 0x0002
19#define RIO_DID_MPC8560 0x0003 17#define RIO_DID_MPC8560 0x0003
20 18
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 5951e3f38878..adae88f5b0ab 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -111,6 +111,9 @@ static inline struct page *sg_page(struct scatterlist *sg)
111static inline void sg_set_buf(struct scatterlist *sg, const void *buf, 111static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
112 unsigned int buflen) 112 unsigned int buflen)
113{ 113{
114#ifdef CONFIG_DEBUG_SG
115 BUG_ON(!virt_addr_valid(buf));
116#endif
114 sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf)); 117 sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
115} 118}
116 119
@@ -241,6 +244,11 @@ size_t sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents,
241size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents, 244size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents,
242 void *buf, size_t buflen); 245 void *buf, size_t buflen);
243 246
247size_t sg_pcopy_from_buffer(struct scatterlist *sgl, unsigned int nents,
248 void *buf, size_t buflen, off_t skip);
249size_t sg_pcopy_to_buffer(struct scatterlist *sgl, unsigned int nents,
250 void *buf, size_t buflen, off_t skip);
251
244/* 252/*
245 * Maximum number of entries that will be allocated in one piece, if 253 * Maximum number of entries that will be allocated in one piece, if
246 * a list larger than this is required then chaining will be utilized. 254 * a list larger than this is required then chaining will be utilized.
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 178a8d909f14..6682da36b293 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -107,14 +107,6 @@ extern unsigned long this_cpu_load(void);
107extern void calc_global_load(unsigned long ticks); 107extern void calc_global_load(unsigned long ticks);
108extern void update_cpu_load_nohz(void); 108extern void update_cpu_load_nohz(void);
109 109
110/* Notifier for when a task gets migrated to a new CPU */
111struct task_migration_notifier {
112 struct task_struct *task;
113 int from_cpu;
114 int to_cpu;
115};
116extern void register_task_migration_notifier(struct notifier_block *n);
117
118extern unsigned long get_parent_ip(unsigned long addr); 110extern unsigned long get_parent_ip(unsigned long addr);
119 111
120extern void dump_cpu_task(int cpu); 112extern void dump_cpu_task(int cpu);
@@ -322,8 +314,6 @@ extern unsigned long
322arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, 314arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
323 unsigned long len, unsigned long pgoff, 315 unsigned long len, unsigned long pgoff,
324 unsigned long flags); 316 unsigned long flags);
325extern void arch_unmap_area(struct mm_struct *, unsigned long);
326extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
327#else 317#else
328static inline void arch_pick_mmap_layout(struct mm_struct *mm) {} 318static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
329#endif 319#endif
@@ -924,7 +914,7 @@ struct load_weight {
924struct sched_avg { 914struct sched_avg {
925 /* 915 /*
926 * These sums represent an infinite geometric series and so are bound 916 * These sums represent an infinite geometric series and so are bound
927 * above by 1024/(1-y). Thus we only need a u32 to store them for for all 917 * above by 1024/(1-y). Thus we only need a u32 to store them for all
928 * choices of y < 1-2^(-32)*1024. 918 * choices of y < 1-2^(-32)*1024.
929 */ 919 */
930 u32 runnable_avg_sum, runnable_avg_period; 920 u32 runnable_avg_sum, runnable_avg_period;
@@ -994,12 +984,7 @@ struct sched_entity {
994 struct cfs_rq *my_q; 984 struct cfs_rq *my_q;
995#endif 985#endif
996 986
997/* 987#ifdef CONFIG_SMP
998 * Load-tracking only depends on SMP, FAIR_GROUP_SCHED dependency below may be
999 * removed when useful for applications beyond shares distribution (e.g.
1000 * load-balance).
1001 */
1002#if defined(CONFIG_SMP) && defined(CONFIG_FAIR_GROUP_SCHED)
1003 /* Per-entity load-tracking */ 988 /* Per-entity load-tracking */
1004 struct sched_avg avg; 989 struct sched_avg avg;
1005#endif 990#endif
@@ -1041,6 +1026,9 @@ struct task_struct {
1041#ifdef CONFIG_SMP 1026#ifdef CONFIG_SMP
1042 struct llist_node wake_entry; 1027 struct llist_node wake_entry;
1043 int on_cpu; 1028 int on_cpu;
1029 struct task_struct *last_wakee;
1030 unsigned long wakee_flips;
1031 unsigned long wakee_flip_decay_ts;
1044#endif 1032#endif
1045 int on_rq; 1033 int on_rq;
1046 1034
@@ -1405,9 +1393,13 @@ struct task_struct {
1405 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */ 1393 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */
1406 } memcg_batch; 1394 } memcg_batch;
1407 unsigned int memcg_kmem_skip_account; 1395 unsigned int memcg_kmem_skip_account;
1408#endif 1396 struct memcg_oom_info {
1409#ifdef CONFIG_HAVE_HW_BREAKPOINT 1397 unsigned int may_oom:1;
1410 atomic_t ptrace_bp_refcnt; 1398 unsigned int in_memcg_oom:1;
1399 unsigned int oom_locked:1;
1400 int wakeups;
1401 struct mem_cgroup *wait_on_memcg;
1402 } memcg_oom;
1411#endif 1403#endif
1412#ifdef CONFIG_UPROBES 1404#ifdef CONFIG_UPROBES
1413 struct uprobe_task *utask; 1405 struct uprobe_task *utask;
@@ -1542,6 +1534,8 @@ static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1542 * Test if a process is not yet dead (at most zombie state) 1534 * Test if a process is not yet dead (at most zombie state)
1543 * If pid_alive fails, then pointers within the task structure 1535 * If pid_alive fails, then pointers within the task structure
1544 * can be stale and must not be dereferenced. 1536 * can be stale and must not be dereferenced.
1537 *
1538 * Return: 1 if the process is alive. 0 otherwise.
1545 */ 1539 */
1546static inline int pid_alive(struct task_struct *p) 1540static inline int pid_alive(struct task_struct *p)
1547{ 1541{
@@ -1553,6 +1547,8 @@ static inline int pid_alive(struct task_struct *p)
1553 * @tsk: Task structure to be checked. 1547 * @tsk: Task structure to be checked.
1554 * 1548 *
1555 * Check if a task structure is the first user space task the kernel created. 1549 * Check if a task structure is the first user space task the kernel created.
1550 *
1551 * Return: 1 if the task structure is init. 0 otherwise.
1556 */ 1552 */
1557static inline int is_global_init(struct task_struct *tsk) 1553static inline int is_global_init(struct task_struct *tsk)
1558{ 1554{
@@ -1638,6 +1634,7 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1638#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1634#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1639#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1635#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1640#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ 1636#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
1637#define PF_SUSPEND_TASK 0x80000000 /* this thread called freeze_processes and should not be frozen */
1641 1638
1642/* 1639/*
1643 * Only the _current_ task can read/write to tsk->flags, but other 1640 * Only the _current_ task can read/write to tsk->flags, but other
@@ -1903,6 +1900,8 @@ extern struct task_struct *idle_task(int cpu);
1903/** 1900/**
1904 * is_idle_task - is the specified task an idle task? 1901 * is_idle_task - is the specified task an idle task?
1905 * @p: the task in question. 1902 * @p: the task in question.
1903 *
1904 * Return: 1 if @p is an idle task. 0 otherwise.
1906 */ 1905 */
1907static inline bool is_idle_task(const struct task_struct *p) 1906static inline bool is_idle_task(const struct task_struct *p)
1908{ 1907{
@@ -1955,8 +1954,6 @@ extern struct task_struct *find_task_by_vpid(pid_t nr);
1955extern struct task_struct *find_task_by_pid_ns(pid_t nr, 1954extern struct task_struct *find_task_by_pid_ns(pid_t nr,
1956 struct pid_namespace *ns); 1955 struct pid_namespace *ns);
1957 1956
1958extern void __set_special_pids(struct pid *pid);
1959
1960/* per-UID process charging. */ 1957/* per-UID process charging. */
1961extern struct user_struct * alloc_uid(kuid_t); 1958extern struct user_struct * alloc_uid(kuid_t);
1962static inline struct user_struct *get_uid(struct user_struct *u) 1959static inline struct user_struct *get_uid(struct user_struct *u)
@@ -2179,15 +2176,15 @@ static inline bool thread_group_leader(struct task_struct *p)
2179 * all we care about is that we have a task with the appropriate 2176 * all we care about is that we have a task with the appropriate
2180 * pid, we don't actually care if we have the right task. 2177 * pid, we don't actually care if we have the right task.
2181 */ 2178 */
2182static inline int has_group_leader_pid(struct task_struct *p) 2179static inline bool has_group_leader_pid(struct task_struct *p)
2183{ 2180{
2184 return p->pid == p->tgid; 2181 return task_pid(p) == p->signal->leader_pid;
2185} 2182}
2186 2183
2187static inline 2184static inline
2188int same_thread_group(struct task_struct *p1, struct task_struct *p2) 2185bool same_thread_group(struct task_struct *p1, struct task_struct *p2)
2189{ 2186{
2190 return p1->tgid == p2->tgid; 2187 return p1->signal == p2->signal;
2191} 2188}
2192 2189
2193static inline struct task_struct *next_thread(const struct task_struct *p) 2190static inline struct task_struct *next_thread(const struct task_struct *p)
@@ -2444,6 +2441,15 @@ extern int __cond_resched_softirq(void);
2444 __cond_resched_softirq(); \ 2441 __cond_resched_softirq(); \
2445}) 2442})
2446 2443
2444static inline void cond_resched_rcu(void)
2445{
2446#if defined(CONFIG_DEBUG_ATOMIC_SLEEP) || !defined(CONFIG_PREEMPT_RCU)
2447 rcu_read_unlock();
2448 cond_resched();
2449 rcu_read_lock();
2450#endif
2451}
2452
2447/* 2453/*
2448 * Does a critical section need to be broken due to another 2454 * Does a critical section need to be broken due to another
2449 * task waiting?: (technically does not depend on CONFIG_PREEMPT, 2455 * task waiting?: (technically does not depend on CONFIG_PREEMPT,
diff --git a/include/linux/sched_clock.h b/include/linux/sched_clock.h
new file mode 100644
index 000000000000..fa7922c80a41
--- /dev/null
+++ b/include/linux/sched_clock.h
@@ -0,0 +1,21 @@
1/*
2 * sched_clock.h: support for extending counters to full 64-bit ns counter
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef LINUX_SCHED_CLOCK
9#define LINUX_SCHED_CLOCK
10
11#ifdef CONFIG_GENERIC_SCHED_CLOCK
12extern void sched_clock_postinit(void);
13#else
14static inline void sched_clock_postinit(void) { }
15#endif
16
17extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
18
19extern unsigned long long (*sched_clock_func)(void);
20
21#endif
diff --git a/include/linux/sdb.h b/include/linux/sdb.h
new file mode 100644
index 000000000000..fbb76a46c8a5
--- /dev/null
+++ b/include/linux/sdb.h
@@ -0,0 +1,159 @@
1/*
2 * This is the official version 1.1 of sdb.h
3 */
4#ifndef __SDB_H__
5#define __SDB_H__
6#ifdef __KERNEL__
7#include <linux/types.h>
8#else
9#include <stdint.h>
10#endif
11
12/*
13 * All structures are 64 bytes long and are expected
14 * to live in an array, one for each interconnect.
15 * Most fields of the structures are shared among the
16 * various types, and most-specific fields are at the
17 * beginning (for alignment reasons, and to keep the
18 * magic number at the head of the interconnect record
19 */
20
21/* Product, 40 bytes at offset 24, 8-byte aligned
22 *
23 * device_id is vendor-assigned; version is device-specific,
24 * date is hex (e.g 0x20120501), name is UTF-8, blank-filled
25 * and not terminated with a 0 byte.
26 */
27struct sdb_product {
28 uint64_t vendor_id; /* 0x18..0x1f */
29 uint32_t device_id; /* 0x20..0x23 */
30 uint32_t version; /* 0x24..0x27 */
31 uint32_t date; /* 0x28..0x2b */
32 uint8_t name[19]; /* 0x2c..0x3e */
33 uint8_t record_type; /* 0x3f */
34};
35
36/*
37 * Component, 56 bytes at offset 8, 8-byte aligned
38 *
39 * The address range is first to last, inclusive
40 * (for example 0x100000 - 0x10ffff)
41 */
42struct sdb_component {
43 uint64_t addr_first; /* 0x08..0x0f */
44 uint64_t addr_last; /* 0x10..0x17 */
45 struct sdb_product product; /* 0x18..0x3f */
46};
47
48/* Type of the SDB record */
49enum sdb_record_type {
50 sdb_type_interconnect = 0x00,
51 sdb_type_device = 0x01,
52 sdb_type_bridge = 0x02,
53 sdb_type_integration = 0x80,
54 sdb_type_repo_url = 0x81,
55 sdb_type_synthesis = 0x82,
56 sdb_type_empty = 0xFF,
57};
58
59/* Type 0: interconnect (first of the array)
60 *
61 * sdb_records is the length of the table including this first
62 * record, version is 1. The bus type is enumerated later.
63 */
64#define SDB_MAGIC 0x5344422d /* "SDB-" */
65struct sdb_interconnect {
66 uint32_t sdb_magic; /* 0x00-0x03 */
67 uint16_t sdb_records; /* 0x04-0x05 */
68 uint8_t sdb_version; /* 0x06 */
69 uint8_t sdb_bus_type; /* 0x07 */
70 struct sdb_component sdb_component; /* 0x08-0x3f */
71};
72
73/* Type 1: device
74 *
75 * class is 0 for "custom device", other values are
76 * to be standardized; ABI version is for the driver,
77 * bus-specific bits are defined by each bus (see below)
78 */
79struct sdb_device {
80 uint16_t abi_class; /* 0x00-0x01 */
81 uint8_t abi_ver_major; /* 0x02 */
82 uint8_t abi_ver_minor; /* 0x03 */
83 uint32_t bus_specific; /* 0x04-0x07 */
84 struct sdb_component sdb_component; /* 0x08-0x3f */
85};
86
87/* Type 2: bridge
88 *
89 * child is the address of the nested SDB table
90 */
91struct sdb_bridge {
92 uint64_t sdb_child; /* 0x00-0x07 */
93 struct sdb_component sdb_component; /* 0x08-0x3f */
94};
95
96/* Type 0x80: integration
97 *
98 * all types with bit 7 set are meta-information, so
99 * software can ignore the types it doesn't know. Here we
100 * just provide product information for an aggregate device
101 */
102struct sdb_integration {
103 uint8_t reserved[24]; /* 0x00-0x17 */
104 struct sdb_product product; /* 0x08-0x3f */
105};
106
107/* Type 0x81: Top module repository url
108 *
109 * again, an informative field that software can ignore
110 */
111struct sdb_repo_url {
112 uint8_t repo_url[63]; /* 0x00-0x3e */
113 uint8_t record_type; /* 0x3f */
114};
115
116/* Type 0x82: Synthesis tool information
117 *
118 * this informative record
119 */
120struct sdb_synthesis {
121 uint8_t syn_name[16]; /* 0x00-0x0f */
122 uint8_t commit_id[16]; /* 0x10-0x1f */
123 uint8_t tool_name[8]; /* 0x20-0x27 */
124 uint32_t tool_version; /* 0x28-0x2b */
125 uint32_t date; /* 0x2c-0x2f */
126 uint8_t user_name[15]; /* 0x30-0x3e */
127 uint8_t record_type; /* 0x3f */
128};
129
130/* Type 0xff: empty
131 *
132 * this allows keeping empty slots during development,
133 * so they can be filled later with minimal efforts and
134 * no misleading description is ever shipped -- hopefully.
135 * It can also be used to pad a table to a desired length.
136 */
137struct sdb_empty {
138 uint8_t reserved[63]; /* 0x00-0x3e */
139 uint8_t record_type; /* 0x3f */
140};
141
142/* The type of bus, for bus-specific flags */
143enum sdb_bus_type {
144 sdb_wishbone = 0x00,
145 sdb_data = 0x01,
146};
147
148#define SDB_WB_WIDTH_MASK 0x0f
149#define SDB_WB_ACCESS8 0x01
150#define SDB_WB_ACCESS16 0x02
151#define SDB_WB_ACCESS32 0x04
152#define SDB_WB_ACCESS64 0x08
153#define SDB_WB_LITTLE_ENDIAN 0x80
154
155#define SDB_DATA_READ 0x04
156#define SDB_DATA_WRITE 0x02
157#define SDB_DATA_EXEC 0x01
158
159#endif /* __SDB_H__ */
diff --git a/include/linux/security.h b/include/linux/security.h
index 4686491852a7..9d37e2b9d3ec 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -26,6 +26,7 @@
26#include <linux/capability.h> 26#include <linux/capability.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/string.h>
29 30
30struct linux_binprm; 31struct linux_binprm;
31struct cred; 32struct cred;
@@ -60,6 +61,9 @@ struct mm_struct;
60#define SECURITY_CAP_NOAUDIT 0 61#define SECURITY_CAP_NOAUDIT 0
61#define SECURITY_CAP_AUDIT 1 62#define SECURITY_CAP_AUDIT 1
62 63
64/* LSM Agnostic defines for sb_set_mnt_opts */
65#define SECURITY_LSM_NATIVE_LABELS 1
66
63struct ctl_table; 67struct ctl_table;
64struct audit_krule; 68struct audit_krule;
65struct user_namespace; 69struct user_namespace;
@@ -306,6 +310,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
306 * Parse a string of security data filling in the opts structure 310 * Parse a string of security data filling in the opts structure
307 * @options string containing all mount options known by the LSM 311 * @options string containing all mount options known by the LSM
308 * @opts binary data structure usable by the LSM 312 * @opts binary data structure usable by the LSM
313 * @dentry_init_security:
314 * Compute a context for a dentry as the inode is not yet available
315 * since NFSv4 has no label backed by an EA anyway.
316 * @dentry dentry to use in calculating the context.
317 * @mode mode used to determine resource type.
318 * @name name of the last path component used to create file
319 * @ctx pointer to place the pointer to the resulting context in.
320 * @ctxlen point to place the length of the resulting context.
321 *
309 * 322 *
310 * Security hooks for inode operations. 323 * Security hooks for inode operations.
311 * 324 *
@@ -1313,6 +1326,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1313 * @pages contains the number of pages. 1326 * @pages contains the number of pages.
1314 * Return 0 if permission is granted. 1327 * Return 0 if permission is granted.
1315 * 1328 *
1329 * @ismaclabel:
1330 * Check if the extended attribute specified by @name
1331 * represents a MAC label. Returns 1 if name is a MAC
1332 * attribute otherwise returns 0.
1333 * @name full extended attribute name to check against
1334 * LSM as a MAC label.
1335 *
1316 * @secid_to_secctx: 1336 * @secid_to_secctx:
1317 * Convert secid to security context. If secdata is NULL the length of 1337 * Convert secid to security context. If secdata is NULL the length of
1318 * the result will be returned in seclen, but no secdata will be returned. 1338 * the result will be returned in seclen, but no secdata will be returned.
@@ -1392,7 +1412,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1392 * @ctxlen contains the length of @ctx. 1412 * @ctxlen contains the length of @ctx.
1393 * 1413 *
1394 * @inode_getsecctx: 1414 * @inode_getsecctx:
1395 * Returns a string containing all relevant security context information 1415 * On success, returns 0 and fills out @ctx and @ctxlen with the security
1416 * context for the given @inode.
1396 * 1417 *
1397 * @inode we wish to get the security context of. 1418 * @inode we wish to get the security context of.
1398 * @ctx is a pointer in which to place the allocated security context. 1419 * @ctx is a pointer in which to place the allocated security context.
@@ -1439,10 +1460,16 @@ struct security_operations {
1439 int (*sb_pivotroot) (struct path *old_path, 1460 int (*sb_pivotroot) (struct path *old_path,
1440 struct path *new_path); 1461 struct path *new_path);
1441 int (*sb_set_mnt_opts) (struct super_block *sb, 1462 int (*sb_set_mnt_opts) (struct super_block *sb,
1442 struct security_mnt_opts *opts); 1463 struct security_mnt_opts *opts,
1464 unsigned long kern_flags,
1465 unsigned long *set_kern_flags);
1443 int (*sb_clone_mnt_opts) (const struct super_block *oldsb, 1466 int (*sb_clone_mnt_opts) (const struct super_block *oldsb,
1444 struct super_block *newsb); 1467 struct super_block *newsb);
1445 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); 1468 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts);
1469 int (*dentry_init_security) (struct dentry *dentry, int mode,
1470 struct qstr *name, void **ctx,
1471 u32 *ctxlen);
1472
1446 1473
1447#ifdef CONFIG_SECURITY_PATH 1474#ifdef CONFIG_SECURITY_PATH
1448 int (*path_unlink) (struct path *dir, struct dentry *dentry); 1475 int (*path_unlink) (struct path *dir, struct dentry *dentry);
@@ -1465,7 +1492,7 @@ struct security_operations {
1465 int (*inode_alloc_security) (struct inode *inode); 1492 int (*inode_alloc_security) (struct inode *inode);
1466 void (*inode_free_security) (struct inode *inode); 1493 void (*inode_free_security) (struct inode *inode);
1467 int (*inode_init_security) (struct inode *inode, struct inode *dir, 1494 int (*inode_init_security) (struct inode *inode, struct inode *dir,
1468 const struct qstr *qstr, char **name, 1495 const struct qstr *qstr, const char **name,
1469 void **value, size_t *len); 1496 void **value, size_t *len);
1470 int (*inode_create) (struct inode *dir, 1497 int (*inode_create) (struct inode *dir,
1471 struct dentry *dentry, umode_t mode); 1498 struct dentry *dentry, umode_t mode);
@@ -1590,6 +1617,7 @@ struct security_operations {
1590 1617
1591 int (*getprocattr) (struct task_struct *p, char *name, char **value); 1618 int (*getprocattr) (struct task_struct *p, char *name, char **value);
1592 int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size); 1619 int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size);
1620 int (*ismaclabel) (const char *name);
1593 int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); 1621 int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen);
1594 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); 1622 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid);
1595 void (*release_secctx) (char *secdata, u32 seclen); 1623 void (*release_secctx) (char *secdata, u32 seclen);
@@ -1725,10 +1753,16 @@ int security_sb_mount(const char *dev_name, struct path *path,
1725 const char *type, unsigned long flags, void *data); 1753 const char *type, unsigned long flags, void *data);
1726int security_sb_umount(struct vfsmount *mnt, int flags); 1754int security_sb_umount(struct vfsmount *mnt, int flags);
1727int security_sb_pivotroot(struct path *old_path, struct path *new_path); 1755int security_sb_pivotroot(struct path *old_path, struct path *new_path);
1728int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); 1756int security_sb_set_mnt_opts(struct super_block *sb,
1757 struct security_mnt_opts *opts,
1758 unsigned long kern_flags,
1759 unsigned long *set_kern_flags);
1729int security_sb_clone_mnt_opts(const struct super_block *oldsb, 1760int security_sb_clone_mnt_opts(const struct super_block *oldsb,
1730 struct super_block *newsb); 1761 struct super_block *newsb);
1731int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); 1762int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts);
1763int security_dentry_init_security(struct dentry *dentry, int mode,
1764 struct qstr *name, void **ctx,
1765 u32 *ctxlen);
1732 1766
1733int security_inode_alloc(struct inode *inode); 1767int security_inode_alloc(struct inode *inode);
1734void security_inode_free(struct inode *inode); 1768void security_inode_free(struct inode *inode);
@@ -1736,7 +1770,7 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
1736 const struct qstr *qstr, 1770 const struct qstr *qstr,
1737 initxattrs initxattrs, void *fs_data); 1771 initxattrs initxattrs, void *fs_data);
1738int security_old_inode_init_security(struct inode *inode, struct inode *dir, 1772int security_old_inode_init_security(struct inode *inode, struct inode *dir,
1739 const struct qstr *qstr, char **name, 1773 const struct qstr *qstr, const char **name,
1740 void **value, size_t *len); 1774 void **value, size_t *len);
1741int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode); 1775int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode);
1742int security_inode_link(struct dentry *old_dentry, struct inode *dir, 1776int security_inode_link(struct dentry *old_dentry, struct inode *dir,
@@ -1840,6 +1874,7 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode);
1840int security_getprocattr(struct task_struct *p, char *name, char **value); 1874int security_getprocattr(struct task_struct *p, char *name, char **value);
1841int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); 1875int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
1842int security_netlink_send(struct sock *sk, struct sk_buff *skb); 1876int security_netlink_send(struct sock *sk, struct sk_buff *skb);
1877int security_ismaclabel(const char *name);
1843int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); 1878int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1844int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); 1879int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
1845void security_release_secctx(char *secdata, u32 seclen); 1880void security_release_secctx(char *secdata, u32 seclen);
@@ -2011,7 +2046,9 @@ static inline int security_sb_pivotroot(struct path *old_path,
2011} 2046}
2012 2047
2013static inline int security_sb_set_mnt_opts(struct super_block *sb, 2048static inline int security_sb_set_mnt_opts(struct super_block *sb,
2014 struct security_mnt_opts *opts) 2049 struct security_mnt_opts *opts,
2050 unsigned long kern_flags,
2051 unsigned long *set_kern_flags)
2015{ 2052{
2016 return 0; 2053 return 0;
2017} 2054}
@@ -2035,6 +2072,16 @@ static inline int security_inode_alloc(struct inode *inode)
2035static inline void security_inode_free(struct inode *inode) 2072static inline void security_inode_free(struct inode *inode)
2036{ } 2073{ }
2037 2074
2075static inline int security_dentry_init_security(struct dentry *dentry,
2076 int mode,
2077 struct qstr *name,
2078 void **ctx,
2079 u32 *ctxlen)
2080{
2081 return -EOPNOTSUPP;
2082}
2083
2084
2038static inline int security_inode_init_security(struct inode *inode, 2085static inline int security_inode_init_security(struct inode *inode,
2039 struct inode *dir, 2086 struct inode *dir,
2040 const struct qstr *qstr, 2087 const struct qstr *qstr,
@@ -2047,8 +2094,8 @@ static inline int security_inode_init_security(struct inode *inode,
2047static inline int security_old_inode_init_security(struct inode *inode, 2094static inline int security_old_inode_init_security(struct inode *inode,
2048 struct inode *dir, 2095 struct inode *dir,
2049 const struct qstr *qstr, 2096 const struct qstr *qstr,
2050 char **name, void **value, 2097 const char **name,
2051 size_t *len) 2098 void **value, size_t *len)
2052{ 2099{
2053 return -EOPNOTSUPP; 2100 return -EOPNOTSUPP;
2054} 2101}
@@ -2520,6 +2567,11 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
2520 return cap_netlink_send(sk, skb); 2567 return cap_netlink_send(sk, skb);
2521} 2568}
2522 2569
2570static inline int security_ismaclabel(const char *name)
2571{
2572 return 0;
2573}
2574
2523static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) 2575static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2524{ 2576{
2525 return -EOPNOTSUPP; 2577 return -EOPNOTSUPP;
diff --git a/include/linux/sem.h b/include/linux/sem.h
index 53d42650b193..976ce3a19f1b 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -12,10 +12,12 @@ struct task_struct;
12struct sem_array { 12struct sem_array {
13 struct kern_ipc_perm ____cacheline_aligned_in_smp 13 struct kern_ipc_perm ____cacheline_aligned_in_smp
14 sem_perm; /* permissions .. see ipc.h */ 14 sem_perm; /* permissions .. see ipc.h */
15 time_t sem_otime; /* last semop time */
16 time_t sem_ctime; /* last change time */ 15 time_t sem_ctime; /* last change time */
17 struct sem *sem_base; /* ptr to first semaphore in array */ 16 struct sem *sem_base; /* ptr to first semaphore in array */
18 struct list_head sem_pending; /* pending operations to be processed */ 17 struct list_head pending_alter; /* pending operations */
18 /* that alter the array */
19 struct list_head pending_const; /* pending complex operations */
20 /* that do not alter semvals */
19 struct list_head list_id; /* undo requests on this array */ 21 struct list_head list_id; /* undo requests on this array */
20 int sem_nsems; /* no. of semaphores in array */ 22 int sem_nsems; /* no. of semaphores in array */
21 int complex_count; /* pending complex operations */ 23 int complex_count; /* pending complex operations */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 2da29ac178fc..4e32edc8f506 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -173,4 +173,10 @@ extern struct hlist_node *seq_hlist_start_head_rcu(struct hlist_head *head,
173extern struct hlist_node *seq_hlist_next_rcu(void *v, 173extern struct hlist_node *seq_hlist_next_rcu(void *v,
174 struct hlist_head *head, 174 struct hlist_head *head,
175 loff_t *ppos); 175 loff_t *ppos);
176
177/* Helpers for iterating over per-cpu hlist_head-s in seq_files */
178extern struct hlist_node *seq_hlist_start_percpu(struct hlist_head __percpu *head, int *cpu, loff_t pos);
179
180extern struct hlist_node *seq_hlist_next_percpu(void *v, struct hlist_head __percpu *head, int *cpu, loff_t *pos);
181
176#endif 182#endif
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 18299057402f..21a209336e79 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -3,15 +3,21 @@
3/* 3/*
4 * Reader/writer consistent mechanism without starving writers. This type of 4 * Reader/writer consistent mechanism without starving writers. This type of
5 * lock for data where the reader wants a consistent set of information 5 * lock for data where the reader wants a consistent set of information
6 * and is willing to retry if the information changes. Readers never 6 * and is willing to retry if the information changes. There are two types
7 * block but they may have to retry if a writer is in 7 * of readers:
8 * progress. Writers do not wait for readers. 8 * 1. Sequence readers which never block a writer but they may have to retry
9 * if a writer is in progress by detecting change in sequence number.
10 * Writers do not wait for a sequence reader.
11 * 2. Locking readers which will wait if a writer or another locking reader
12 * is in progress. A locking reader in progress will also block a writer
13 * from going forward. Unlike the regular rwlock, the read lock here is
14 * exclusive so that only one locking reader can get it.
9 * 15 *
10 * This is not as cache friendly as brlock. Also, this will not work 16 * This is not as cache friendly as brlock. Also, this may not work well
11 * for data that contains pointers, because any writer could 17 * for data that contains pointers, because any writer could
12 * invalidate a pointer that a reader was following. 18 * invalidate a pointer that a reader was following.
13 * 19 *
14 * Expected reader usage: 20 * Expected non-blocking reader usage:
15 * do { 21 * do {
16 * seq = read_seqbegin(&foo); 22 * seq = read_seqbegin(&foo);
17 * ... 23 * ...
@@ -268,4 +274,56 @@ write_sequnlock_irqrestore(seqlock_t *sl, unsigned long flags)
268 spin_unlock_irqrestore(&sl->lock, flags); 274 spin_unlock_irqrestore(&sl->lock, flags);
269} 275}
270 276
277/*
278 * A locking reader exclusively locks out other writers and locking readers,
279 * but doesn't update the sequence number. Acts like a normal spin_lock/unlock.
280 * Don't need preempt_disable() because that is in the spin_lock already.
281 */
282static inline void read_seqlock_excl(seqlock_t *sl)
283{
284 spin_lock(&sl->lock);
285}
286
287static inline void read_sequnlock_excl(seqlock_t *sl)
288{
289 spin_unlock(&sl->lock);
290}
291
292static inline void read_seqlock_excl_bh(seqlock_t *sl)
293{
294 spin_lock_bh(&sl->lock);
295}
296
297static inline void read_sequnlock_excl_bh(seqlock_t *sl)
298{
299 spin_unlock_bh(&sl->lock);
300}
301
302static inline void read_seqlock_excl_irq(seqlock_t *sl)
303{
304 spin_lock_irq(&sl->lock);
305}
306
307static inline void read_sequnlock_excl_irq(seqlock_t *sl)
308{
309 spin_unlock_irq(&sl->lock);
310}
311
312static inline unsigned long __read_seqlock_excl_irqsave(seqlock_t *sl)
313{
314 unsigned long flags;
315
316 spin_lock_irqsave(&sl->lock, flags);
317 return flags;
318}
319
320#define read_seqlock_excl_irqsave(lock, flags) \
321 do { flags = __read_seqlock_excl_irqsave(lock); } while (0)
322
323static inline void
324read_sequnlock_excl_irqrestore(seqlock_t *sl, unsigned long flags)
325{
326 spin_unlock_irqrestore(&sl->lock, flags);
327}
328
271#endif /* __LINUX_SEQLOCK_H */ 329#endif /* __LINUX_SEQLOCK_H */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 87d4bbc773fc..b98291ac7f14 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -31,6 +31,13 @@
31#include <linux/sysrq.h> 31#include <linux/sysrq.h>
32#include <uapi/linux/serial_core.h> 32#include <uapi/linux/serial_core.h>
33 33
34#ifdef CONFIG_SERIAL_CORE_CONSOLE
35#define uart_console(port) \
36 ((port)->cons && (port)->cons->index == (port)->line)
37#else
38#define uart_console(port) (0)
39#endif
40
34struct uart_port; 41struct uart_port;
35struct serial_struct; 42struct serial_struct;
36struct device; 43struct device;
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index eb763adf9815..d34049712a4d 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -5,7 +5,7 @@
5#include <linux/sh_dma.h> 5#include <linux/sh_dma.h>
6 6
7/* 7/*
8 * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts) 8 * Generic header for SuperH (H)SCI(F) (used by sh/sh64/h8300 and related parts)
9 */ 9 */
10 10
11#define SCIx_NOT_SUPPORTED (-1) 11#define SCIx_NOT_SUPPORTED (-1)
@@ -16,6 +16,7 @@ enum {
16 SCBRR_ALGO_3, /* (((clk * 2) + 16 * bps) / (16 * bps) - 1) */ 16 SCBRR_ALGO_3, /* (((clk * 2) + 16 * bps) / (16 * bps) - 1) */
17 SCBRR_ALGO_4, /* (((clk * 2) + 16 * bps) / (32 * bps) - 1) */ 17 SCBRR_ALGO_4, /* (((clk * 2) + 16 * bps) / (32 * bps) - 1) */
18 SCBRR_ALGO_5, /* (((clk * 1000 / 32) / bps) - 1) */ 18 SCBRR_ALGO_5, /* (((clk * 1000 / 32) / bps) - 1) */
19 SCBRR_ALGO_6, /* HSCIF variable sample rate algorithm */
19}; 20};
20 21
21#define SCSCR_TIE (1 << 7) 22#define SCSCR_TIE (1 << 7)
@@ -37,7 +38,7 @@ enum {
37 38
38#define SCI_DEFAULT_ERROR_MASK (SCI_PER | SCI_FER) 39#define SCI_DEFAULT_ERROR_MASK (SCI_PER | SCI_FER)
39 40
40/* SCxSR SCIF */ 41/* SCxSR SCIF, HSCIF */
41#define SCIF_ER 0x0080 42#define SCIF_ER 0x0080
42#define SCIF_TEND 0x0040 43#define SCIF_TEND 0x0040
43#define SCIF_TDFE 0x0020 44#define SCIF_TDFE 0x0020
@@ -55,6 +56,9 @@ enum {
55#define SCSPTR_SPB2IO (1 << 1) 56#define SCSPTR_SPB2IO (1 << 1)
56#define SCSPTR_SPB2DT (1 << 0) 57#define SCSPTR_SPB2DT (1 << 0)
57 58
59/* HSSRR HSCIF */
60#define HSCIF_SRE 0x8000
61
58/* Offsets into the sci_port->irqs array */ 62/* Offsets into the sci_port->irqs array */
59enum { 63enum {
60 SCIx_ERI_IRQ, 64 SCIx_ERI_IRQ,
@@ -90,6 +94,7 @@ enum {
90 SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE, 94 SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
91 SCIx_SH4_SCIF_FIFODATA_REGTYPE, 95 SCIx_SH4_SCIF_FIFODATA_REGTYPE,
92 SCIx_SH7705_SCIF_REGTYPE, 96 SCIx_SH7705_SCIF_REGTYPE,
97 SCIx_HSCIF_REGTYPE,
93 98
94 SCIx_NR_REGTYPES, 99 SCIx_NR_REGTYPES,
95}; 100};
@@ -115,6 +120,7 @@ enum {
115 SCSMR, SCBRR, SCSCR, SCxSR, 120 SCSMR, SCBRR, SCSCR, SCxSR,
116 SCFCR, SCFDR, SCxTDR, SCxRDR, 121 SCFCR, SCFDR, SCxTDR, SCxRDR,
117 SCLSR, SCTFDR, SCRFDR, SCSPTR, 122 SCLSR, SCTFDR, SCRFDR, SCSPTR,
123 HSSRR,
118 124
119 SCIx_NR_REGS, 125 SCIx_NR_REGS,
120}; 126};
@@ -137,7 +143,7 @@ struct plat_sci_port {
137 unsigned long mapbase; /* resource base */ 143 unsigned long mapbase; /* resource base */
138 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ 144 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */
139 unsigned int gpios[SCIx_NR_FNS]; /* SCK, RXD, TXD, CTS, RTS */ 145 unsigned int gpios[SCIx_NR_FNS]; /* SCK, RXD, TXD, CTS, RTS */
140 unsigned int type; /* SCI / SCIF / IRDA */ 146 unsigned int type; /* SCI / SCIF / IRDA / HSCIF */
141 upf_t flags; /* UPF_* flags */ 147 upf_t flags; /* UPF_* flags */
142 unsigned long capabilities; /* Port features/capabilities */ 148 unsigned long capabilities; /* Port features/capabilities */
143 149
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
index b64d6bec6f90..b7b43b82231e 100644
--- a/include/linux/sh_dma.h
+++ b/include/linux/sh_dma.h
@@ -33,13 +33,44 @@ struct sh_dmae_slave_config {
33 char mid_rid; 33 char mid_rid;
34}; 34};
35 35
36/**
37 * struct sh_dmae_channel - DMAC channel platform data
38 * @offset: register offset within the main IOMEM resource
39 * @dmars: channel DMARS register offset
40 * @chclr_offset: channel CHCLR register offset
41 * @dmars_bit: channel DMARS field offset within the register
42 * @chclr_bit: bit position, to be set to reset the channel
43 */
36struct sh_dmae_channel { 44struct sh_dmae_channel {
37 unsigned int offset; 45 unsigned int offset;
38 unsigned int dmars; 46 unsigned int dmars;
39 unsigned int dmars_bit;
40 unsigned int chclr_offset; 47 unsigned int chclr_offset;
48 unsigned char dmars_bit;
49 unsigned char chclr_bit;
41}; 50};
42 51
52/**
53 * struct sh_dmae_pdata - DMAC platform data
54 * @slave: array of slaves
55 * @slave_num: number of slaves in the above array
56 * @channel: array of DMA channels
57 * @channel_num: number of channels in the above array
58 * @ts_low_shift: shift of the low part of the TS field
59 * @ts_low_mask: low TS field mask
60 * @ts_high_shift: additional shift of the high part of the TS field
61 * @ts_high_mask: high TS field mask
62 * @ts_shift: array of Transfer Size shifts, indexed by TS value
63 * @ts_shift_num: number of shifts in the above array
64 * @dmaor_init: DMAOR initialisation value
65 * @chcr_offset: CHCR address offset
66 * @chcr_ie_bit: CHCR Interrupt Enable bit
67 * @dmaor_is_32bit: DMAOR is a 32-bit register
68 * @needs_tend_set: the TEND register has to be set
69 * @no_dmars: DMAC has no DMARS registers
70 * @chclr_present: DMAC has one or several CHCLR registers
71 * @chclr_bitwise: channel CHCLR registers are bitwise
72 * @slave_only: DMAC cannot be used for MEMCPY
73 */
43struct sh_dmae_pdata { 74struct sh_dmae_pdata {
44 const struct sh_dmae_slave_config *slave; 75 const struct sh_dmae_slave_config *slave;
45 int slave_num; 76 int slave_num;
@@ -59,46 +90,24 @@ struct sh_dmae_pdata {
59 unsigned int needs_tend_set:1; 90 unsigned int needs_tend_set:1;
60 unsigned int no_dmars:1; 91 unsigned int no_dmars:1;
61 unsigned int chclr_present:1; 92 unsigned int chclr_present:1;
93 unsigned int chclr_bitwise:1;
62 unsigned int slave_only:1; 94 unsigned int slave_only:1;
63}; 95};
64 96
65/* DMA register */
66#define SAR 0x00
67#define DAR 0x04
68#define TCR 0x08
69#define CHCR 0x0C
70#define DMAOR 0x40
71
72#define TEND 0x18 /* USB-DMAC */
73
74/* DMAOR definitions */ 97/* DMAOR definitions */
75#define DMAOR_AE 0x00000004 98#define DMAOR_AE 0x00000004
76#define DMAOR_NMIF 0x00000002 99#define DMAOR_NMIF 0x00000002
77#define DMAOR_DME 0x00000001 100#define DMAOR_DME 0x00000001
78 101
79/* Definitions for the SuperH DMAC */ 102/* Definitions for the SuperH DMAC */
80#define REQ_L 0x00000000
81#define REQ_E 0x00080000
82#define RACK_H 0x00000000
83#define RACK_L 0x00040000
84#define ACK_R 0x00000000
85#define ACK_W 0x00020000
86#define ACK_H 0x00000000
87#define ACK_L 0x00010000
88#define DM_INC 0x00004000 103#define DM_INC 0x00004000
89#define DM_DEC 0x00008000 104#define DM_DEC 0x00008000
90#define DM_FIX 0x0000c000 105#define DM_FIX 0x0000c000
91#define SM_INC 0x00001000 106#define SM_INC 0x00001000
92#define SM_DEC 0x00002000 107#define SM_DEC 0x00002000
93#define SM_FIX 0x00003000 108#define SM_FIX 0x00003000
94#define RS_IN 0x00000200
95#define RS_OUT 0x00000300
96#define TS_BLK 0x00000040
97#define TM_BUR 0x00000020
98#define CHCR_DE 0x00000001 109#define CHCR_DE 0x00000001
99#define CHCR_TE 0x00000002 110#define CHCR_TE 0x00000002
100#define CHCR_IE 0x00000004 111#define CHCR_IE 0x00000004
101 112
102bool shdma_chan_filter(struct dma_chan *chan, void *arg);
103
104#endif 113#endif
diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h
index fc305713fc6d..90b5e30c2f22 100644
--- a/include/linux/sh_eth.h
+++ b/include/linux/sh_eth.h
@@ -2,23 +2,17 @@
2#define __ASM_SH_ETH_H__ 2#define __ASM_SH_ETH_H__
3 3
4#include <linux/phy.h> 4#include <linux/phy.h>
5#include <linux/if_ether.h>
5 6
6enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN}; 7enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN};
7enum {
8 SH_ETH_REG_GIGABIT,
9 SH_ETH_REG_FAST_RCAR,
10 SH_ETH_REG_FAST_SH4,
11 SH_ETH_REG_FAST_SH3_SH2
12};
13 8
14struct sh_eth_plat_data { 9struct sh_eth_plat_data {
15 int phy; 10 int phy;
16 int edmac_endian; 11 int edmac_endian;
17 int register_type;
18 phy_interface_t phy_interface; 12 phy_interface_t phy_interface;
19 void (*set_mdio_gate)(void *addr); 13 void (*set_mdio_gate)(void *addr);
20 14
21 unsigned char mac_addr[6]; 15 unsigned char mac_addr[ETH_ALEN];
22 unsigned no_ether_link:1; 16 unsigned no_ether_link:1;
23 unsigned ether_link_active_low:1; 17 unsigned ether_link_active_low:1;
24 unsigned needs_init:1; 18 unsigned needs_init:1;
diff --git a/include/linux/shdma-base.h b/include/linux/shdma-base.h
index a3728bf66f0e..f92c0a43c54c 100644
--- a/include/linux/shdma-base.h
+++ b/include/linux/shdma-base.h
@@ -68,6 +68,8 @@ struct shdma_chan {
68 int id; /* Raw id of this channel */ 68 int id; /* Raw id of this channel */
69 int irq; /* Channel IRQ */ 69 int irq; /* Channel IRQ */
70 int slave_id; /* Client ID for slave DMA */ 70 int slave_id; /* Client ID for slave DMA */
71 int hw_req; /* DMA request line for slave DMA - same
72 * as MID/RID, used with DT */
71 enum shdma_pm_state pm_state; 73 enum shdma_pm_state pm_state;
72}; 74};
73 75
@@ -94,7 +96,7 @@ struct shdma_ops {
94 dma_addr_t (*slave_addr)(struct shdma_chan *); 96 dma_addr_t (*slave_addr)(struct shdma_chan *);
95 int (*desc_setup)(struct shdma_chan *, struct shdma_desc *, 97 int (*desc_setup)(struct shdma_chan *, struct shdma_desc *,
96 dma_addr_t, dma_addr_t, size_t *); 98 dma_addr_t, dma_addr_t, size_t *);
97 int (*set_slave)(struct shdma_chan *, int, bool); 99 int (*set_slave)(struct shdma_chan *, int, dma_addr_t, bool);
98 void (*setup_xfer)(struct shdma_chan *, int); 100 void (*setup_xfer)(struct shdma_chan *, int);
99 void (*start_xfer)(struct shdma_chan *, struct shdma_desc *); 101 void (*start_xfer)(struct shdma_chan *, struct shdma_desc *);
100 struct shdma_desc *(*embedded_desc)(void *, int); 102 struct shdma_desc *(*embedded_desc)(void *, int);
@@ -114,7 +116,6 @@ struct shdma_dev {
114 116
115int shdma_request_irq(struct shdma_chan *, int, 117int shdma_request_irq(struct shdma_chan *, int,
116 unsigned long, const char *); 118 unsigned long, const char *);
117void shdma_free_irq(struct shdma_chan *);
118bool shdma_reset(struct shdma_dev *sdev); 119bool shdma_reset(struct shdma_dev *sdev);
119void shdma_chan_probe(struct shdma_dev *sdev, 120void shdma_chan_probe(struct shdma_dev *sdev,
120 struct shdma_chan *schan, int id); 121 struct shdma_chan *schan, int id);
@@ -122,5 +123,10 @@ void shdma_chan_remove(struct shdma_chan *schan);
122int shdma_init(struct device *dev, struct shdma_dev *sdev, 123int shdma_init(struct device *dev, struct shdma_dev *sdev,
123 int chan_num); 124 int chan_num);
124void shdma_cleanup(struct shdma_dev *sdev); 125void shdma_cleanup(struct shdma_dev *sdev);
126#if IS_ENABLED(CONFIG_SH_DMAE_BASE)
127bool shdma_chan_filter(struct dma_chan *chan, void *arg);
128#else
129#define shdma_chan_filter NULL
130#endif
125 131
126#endif 132#endif
diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
index ac6b8ee07825..68c097077ef0 100644
--- a/include/linux/shrinker.h
+++ b/include/linux/shrinker.h
@@ -4,39 +4,67 @@
4/* 4/*
5 * This struct is used to pass information from page reclaim to the shrinkers. 5 * This struct is used to pass information from page reclaim to the shrinkers.
6 * We consolidate the values for easier extention later. 6 * We consolidate the values for easier extention later.
7 *
8 * The 'gfpmask' refers to the allocation we are currently trying to
9 * fulfil.
7 */ 10 */
8struct shrink_control { 11struct shrink_control {
9 gfp_t gfp_mask; 12 gfp_t gfp_mask;
10 13
11 /* How many slab objects shrinker() should scan and try to reclaim */ 14 /*
15 * How many objects scan_objects should scan and try to reclaim.
16 * This is reset before every call, so it is safe for callees
17 * to modify.
18 */
12 unsigned long nr_to_scan; 19 unsigned long nr_to_scan;
20
21 /* shrink from these nodes */
22 nodemask_t nodes_to_scan;
23 /* current node being shrunk (for NUMA aware shrinkers) */
24 int nid;
13}; 25};
14 26
27#define SHRINK_STOP (~0UL)
15/* 28/*
16 * A callback you can register to apply pressure to ageable caches. 29 * A callback you can register to apply pressure to ageable caches.
17 * 30 *
18 * 'sc' is passed shrink_control which includes a count 'nr_to_scan' 31 * @count_objects should return the number of freeable items in the cache. If
19 * and a 'gfpmask'. It should look through the least-recently-used 32 * there are no objects to free or the number of freeable items cannot be
20 * 'nr_to_scan' entries and attempt to free them up. It should return 33 * determined, it should return 0. No deadlock checks should be done during the
21 * the number of objects which remain in the cache. If it returns -1, it means 34 * count callback - the shrinker relies on aggregating scan counts that couldn't
22 * it cannot do any scanning at this time (eg. there is a risk of deadlock). 35 * be executed due to potential deadlocks to be run at a later call when the
36 * deadlock condition is no longer pending.
23 * 37 *
24 * The 'gfpmask' refers to the allocation we are currently trying to 38 * @scan_objects will only be called if @count_objects returned a non-zero
25 * fulfil. 39 * value for the number of freeable objects. The callout should scan the cache
40 * and attempt to free items from the cache. It should then return the number
41 * of objects freed during the scan, or SHRINK_STOP if progress cannot be made
42 * due to potential deadlocks. If SHRINK_STOP is returned, then no further
43 * attempts to call the @scan_objects will be made from the current reclaim
44 * context.
26 * 45 *
27 * Note that 'shrink' will be passed nr_to_scan == 0 when the VM is 46 * @flags determine the shrinker abilities, like numa awareness
28 * querying the cache size, so a fastpath for that case is appropriate.
29 */ 47 */
30struct shrinker { 48struct shrinker {
31 int (*shrink)(struct shrinker *, struct shrink_control *sc); 49 unsigned long (*count_objects)(struct shrinker *,
50 struct shrink_control *sc);
51 unsigned long (*scan_objects)(struct shrinker *,
52 struct shrink_control *sc);
53
32 int seeks; /* seeks to recreate an obj */ 54 int seeks; /* seeks to recreate an obj */
33 long batch; /* reclaim batch size, 0 = default */ 55 long batch; /* reclaim batch size, 0 = default */
56 unsigned long flags;
34 57
35 /* These are for internal use */ 58 /* These are for internal use */
36 struct list_head list; 59 struct list_head list;
37 atomic_long_t nr_in_batch; /* objs pending delete */ 60 /* objs pending delete, per node */
61 atomic_long_t *nr_deferred;
38}; 62};
39#define DEFAULT_SEEKS 2 /* A good number if you don't know better. */ 63#define DEFAULT_SEEKS 2 /* A good number if you don't know better. */
40extern void register_shrinker(struct shrinker *); 64
65/* Flags */
66#define SHRINKER_NUMA_AWARE (1 << 0)
67
68extern int register_shrinker(struct shrinker *);
41extern void unregister_shrinker(struct shrinker *); 69extern void unregister_shrinker(struct shrinker *);
42#endif 70#endif
diff --git a/include/linux/signal.h b/include/linux/signal.h
index d897484730c0..2ac423bdb676 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -434,6 +434,14 @@ void signals_init(void);
434int restore_altstack(const stack_t __user *); 434int restore_altstack(const stack_t __user *);
435int __save_altstack(stack_t __user *, unsigned long); 435int __save_altstack(stack_t __user *, unsigned long);
436 436
437#define save_altstack_ex(uss, sp) do { \
438 stack_t __user *__uss = uss; \
439 struct task_struct *t = current; \
440 put_user_ex((void __user *)t->sas_ss_sp, &__uss->ss_sp); \
441 put_user_ex(sas_ss_flags(sp), &__uss->ss_flags); \
442 put_user_ex(t->sas_ss_size, &__uss->ss_size); \
443} while (0);
444
437#ifdef CONFIG_PROC_FS 445#ifdef CONFIG_PROC_FS
438struct seq_file; 446struct seq_file;
439extern void render_sigset_t(struct seq_file *, const char *, sigset_t *); 447extern void render_sigset_t(struct seq_file *, const char *, sigset_t *);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 9c676eae3968..c2d89335f637 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -319,6 +319,8 @@ enum {
319 SKB_GSO_GRE = 1 << 6, 319 SKB_GSO_GRE = 1 << 6,
320 320
321 SKB_GSO_UDP_TUNNEL = 1 << 7, 321 SKB_GSO_UDP_TUNNEL = 1 << 7,
322
323 SKB_GSO_MPLS = 1 << 8,
322}; 324};
323 325
324#if BITS_PER_LONG > 32 326#if BITS_PER_LONG > 32
@@ -384,11 +386,13 @@ typedef unsigned char *sk_buff_data_t;
384 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS 386 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
385 * @dma_cookie: a cookie to one of several possible DMA operations 387 * @dma_cookie: a cookie to one of several possible DMA operations
386 * done by skb DMA functions 388 * done by skb DMA functions
389 * @napi_id: id of the NAPI struct this skb came from
387 * @secmark: security marking 390 * @secmark: security marking
388 * @mark: Generic packet mark 391 * @mark: Generic packet mark
389 * @dropcount: total number of sk_receive_queue overflows 392 * @dropcount: total number of sk_receive_queue overflows
390 * @vlan_proto: vlan encapsulation protocol 393 * @vlan_proto: vlan encapsulation protocol
391 * @vlan_tci: vlan tag control information 394 * @vlan_tci: vlan tag control information
395 * @inner_protocol: Protocol (encapsulation)
392 * @inner_transport_header: Inner transport layer header (encapsulation) 396 * @inner_transport_header: Inner transport layer header (encapsulation)
393 * @inner_network_header: Network layer header (encapsulation) 397 * @inner_network_header: Network layer header (encapsulation)
394 * @inner_mac_header: Link layer header (encapsulation) 398 * @inner_mac_header: Link layer header (encapsulation)
@@ -494,11 +498,14 @@ struct sk_buff {
494 * headers if needed 498 * headers if needed
495 */ 499 */
496 __u8 encapsulation:1; 500 __u8 encapsulation:1;
497 /* 7/9 bit hole (depending on ndisc_nodetype presence) */ 501 /* 6/8 bit hole (depending on ndisc_nodetype presence) */
498 kmemcheck_bitfield_end(flags2); 502 kmemcheck_bitfield_end(flags2);
499 503
500#ifdef CONFIG_NET_DMA 504#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL
501 dma_cookie_t dma_cookie; 505 union {
506 unsigned int napi_id;
507 dma_cookie_t dma_cookie;
508 };
502#endif 509#endif
503#ifdef CONFIG_NETWORK_SECMARK 510#ifdef CONFIG_NETWORK_SECMARK
504 __u32 secmark; 511 __u32 secmark;
@@ -509,12 +516,13 @@ struct sk_buff {
509 __u32 reserved_tailroom; 516 __u32 reserved_tailroom;
510 }; 517 };
511 518
512 sk_buff_data_t inner_transport_header; 519 __be16 inner_protocol;
513 sk_buff_data_t inner_network_header; 520 __u16 inner_transport_header;
514 sk_buff_data_t inner_mac_header; 521 __u16 inner_network_header;
515 sk_buff_data_t transport_header; 522 __u16 inner_mac_header;
516 sk_buff_data_t network_header; 523 __u16 transport_header;
517 sk_buff_data_t mac_header; 524 __u16 network_header;
525 __u16 mac_header;
518 /* These elements must be at the end, see alloc_skb() for details. */ 526 /* These elements must be at the end, see alloc_skb() for details. */
519 sk_buff_data_t tail; 527 sk_buff_data_t tail;
520 sk_buff_data_t end; 528 sk_buff_data_t end;
@@ -627,6 +635,7 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb)
627} 635}
628 636
629extern void kfree_skb(struct sk_buff *skb); 637extern void kfree_skb(struct sk_buff *skb);
638extern void kfree_skb_list(struct sk_buff *segs);
630extern void skb_tx_error(struct sk_buff *skb); 639extern void skb_tx_error(struct sk_buff *skb);
631extern void consume_skb(struct sk_buff *skb); 640extern void consume_skb(struct sk_buff *skb);
632extern void __kfree_skb(struct sk_buff *skb); 641extern void __kfree_skb(struct sk_buff *skb);
@@ -1387,6 +1396,7 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
1387 skb_reset_tail_pointer(skb); 1396 skb_reset_tail_pointer(skb);
1388 skb->tail += offset; 1397 skb->tail += offset;
1389} 1398}
1399
1390#else /* NET_SKBUFF_DATA_USES_OFFSET */ 1400#else /* NET_SKBUFF_DATA_USES_OFFSET */
1391static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) 1401static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
1392{ 1402{
@@ -1527,7 +1537,6 @@ static inline void skb_reset_mac_len(struct sk_buff *skb)
1527 skb->mac_len = skb->network_header - skb->mac_header; 1537 skb->mac_len = skb->network_header - skb->mac_header;
1528} 1538}
1529 1539
1530#ifdef NET_SKBUFF_DATA_USES_OFFSET
1531static inline unsigned char *skb_inner_transport_header(const struct sk_buff 1540static inline unsigned char *skb_inner_transport_header(const struct sk_buff
1532 *skb) 1541 *skb)
1533{ 1542{
@@ -1581,7 +1590,7 @@ static inline void skb_set_inner_mac_header(struct sk_buff *skb,
1581} 1590}
1582static inline bool skb_transport_header_was_set(const struct sk_buff *skb) 1591static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1583{ 1592{
1584 return skb->transport_header != ~0U; 1593 return skb->transport_header != (typeof(skb->transport_header))~0U;
1585} 1594}
1586 1595
1587static inline unsigned char *skb_transport_header(const struct sk_buff *skb) 1596static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
@@ -1624,7 +1633,7 @@ static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1624 1633
1625static inline int skb_mac_header_was_set(const struct sk_buff *skb) 1634static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1626{ 1635{
1627 return skb->mac_header != ~0U; 1636 return skb->mac_header != (typeof(skb->mac_header))~0U;
1628} 1637}
1629 1638
1630static inline void skb_reset_mac_header(struct sk_buff *skb) 1639static inline void skb_reset_mac_header(struct sk_buff *skb)
@@ -1638,112 +1647,6 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1638 skb->mac_header += offset; 1647 skb->mac_header += offset;
1639} 1648}
1640 1649
1641#else /* NET_SKBUFF_DATA_USES_OFFSET */
1642static inline unsigned char *skb_inner_transport_header(const struct sk_buff
1643 *skb)
1644{
1645 return skb->inner_transport_header;
1646}
1647
1648static inline void skb_reset_inner_transport_header(struct sk_buff *skb)
1649{
1650 skb->inner_transport_header = skb->data;
1651}
1652
1653static inline void skb_set_inner_transport_header(struct sk_buff *skb,
1654 const int offset)
1655{
1656 skb->inner_transport_header = skb->data + offset;
1657}
1658
1659static inline unsigned char *skb_inner_network_header(const struct sk_buff *skb)
1660{
1661 return skb->inner_network_header;
1662}
1663
1664static inline void skb_reset_inner_network_header(struct sk_buff *skb)
1665{
1666 skb->inner_network_header = skb->data;
1667}
1668
1669static inline void skb_set_inner_network_header(struct sk_buff *skb,
1670 const int offset)
1671{
1672 skb->inner_network_header = skb->data + offset;
1673}
1674
1675static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb)
1676{
1677 return skb->inner_mac_header;
1678}
1679
1680static inline void skb_reset_inner_mac_header(struct sk_buff *skb)
1681{
1682 skb->inner_mac_header = skb->data;
1683}
1684
1685static inline void skb_set_inner_mac_header(struct sk_buff *skb,
1686 const int offset)
1687{
1688 skb->inner_mac_header = skb->data + offset;
1689}
1690static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1691{
1692 return skb->transport_header != NULL;
1693}
1694
1695static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1696{
1697 return skb->transport_header;
1698}
1699
1700static inline void skb_reset_transport_header(struct sk_buff *skb)
1701{
1702 skb->transport_header = skb->data;
1703}
1704
1705static inline void skb_set_transport_header(struct sk_buff *skb,
1706 const int offset)
1707{
1708 skb->transport_header = skb->data + offset;
1709}
1710
1711static inline unsigned char *skb_network_header(const struct sk_buff *skb)
1712{
1713 return skb->network_header;
1714}
1715
1716static inline void skb_reset_network_header(struct sk_buff *skb)
1717{
1718 skb->network_header = skb->data;
1719}
1720
1721static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
1722{
1723 skb->network_header = skb->data + offset;
1724}
1725
1726static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1727{
1728 return skb->mac_header;
1729}
1730
1731static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1732{
1733 return skb->mac_header != NULL;
1734}
1735
1736static inline void skb_reset_mac_header(struct sk_buff *skb)
1737{
1738 skb->mac_header = skb->data;
1739}
1740
1741static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1742{
1743 skb->mac_header = skb->data + offset;
1744}
1745#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1746
1747static inline void skb_probe_transport_header(struct sk_buff *skb, 1650static inline void skb_probe_transport_header(struct sk_buff *skb,
1748 const int offset_hint) 1651 const int offset_hint)
1749{ 1652{
@@ -1902,10 +1805,13 @@ static inline void pskb_trim_unique(struct sk_buff *skb, unsigned int len)
1902 */ 1805 */
1903static inline void skb_orphan(struct sk_buff *skb) 1806static inline void skb_orphan(struct sk_buff *skb)
1904{ 1807{
1905 if (skb->destructor) 1808 if (skb->destructor) {
1906 skb->destructor(skb); 1809 skb->destructor(skb);
1907 skb->destructor = NULL; 1810 skb->destructor = NULL;
1908 skb->sk = NULL; 1811 skb->sk = NULL;
1812 } else {
1813 BUG_ON(skb->sk);
1814 }
1909} 1815}
1910 1816
1911/** 1817/**
@@ -1999,8 +1905,8 @@ static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
1999 return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC); 1905 return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC);
2000} 1906}
2001 1907
2002/* 1908/**
2003 * __skb_alloc_page - allocate pages for ps-rx on a skb and preserve pfmemalloc data 1909 * __skb_alloc_pages - allocate pages for ps-rx on a skb and preserve pfmemalloc data
2004 * @gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for network packet RX 1910 * @gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for network packet RX
2005 * @skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used 1911 * @skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used
2006 * @order: size of the allocation 1912 * @order: size of the allocation
@@ -2453,6 +2359,10 @@ extern int skb_copy_datagram_from_iovec(struct sk_buff *skb,
2453 const struct iovec *from, 2359 const struct iovec *from,
2454 int from_offset, 2360 int from_offset,
2455 int len); 2361 int len);
2362extern int zerocopy_sg_from_iovec(struct sk_buff *skb,
2363 const struct iovec *frm,
2364 int offset,
2365 size_t count);
2456extern int skb_copy_datagram_const_iovec(const struct sk_buff *from, 2366extern int skb_copy_datagram_const_iovec(const struct sk_buff *from,
2457 int offset, 2367 int offset,
2458 const struct iovec *to, 2368 const struct iovec *to,
@@ -2482,6 +2392,7 @@ extern void skb_split(struct sk_buff *skb,
2482 struct sk_buff *skb1, const u32 len); 2392 struct sk_buff *skb1, const u32 len);
2483extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, 2393extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
2484 int shiftlen); 2394 int shiftlen);
2395extern void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2485 2396
2486extern struct sk_buff *skb_segment(struct sk_buff *skb, 2397extern struct sk_buff *skb_segment(struct sk_buff *skb,
2487 netdev_features_t features); 2398 netdev_features_t features);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 0c621752caa6..74f105847d13 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -4,6 +4,8 @@
4 * (C) SGI 2006, Christoph Lameter 4 * (C) SGI 2006, Christoph Lameter
5 * Cleaned up and restructured to ease the addition of alternative 5 * Cleaned up and restructured to ease the addition of alternative
6 * implementations of SLAB allocators. 6 * implementations of SLAB allocators.
7 * (C) Linux Foundation 2008-2013
8 * Unified interface for all slab allocators
7 */ 9 */
8 10
9#ifndef _LINUX_SLAB_H 11#ifndef _LINUX_SLAB_H
@@ -94,6 +96,7 @@
94#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \ 96#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \
95 (unsigned long)ZERO_SIZE_PTR) 97 (unsigned long)ZERO_SIZE_PTR)
96 98
99#include <linux/kmemleak.h>
97 100
98struct mem_cgroup; 101struct mem_cgroup;
99/* 102/*
@@ -169,11 +172,7 @@ struct kmem_cache {
169 struct list_head list; /* List of all slab caches on the system */ 172 struct list_head list; /* List of all slab caches on the system */
170}; 173};
171 174
172#define KMALLOC_MAX_SIZE (1UL << 30) 175#endif /* CONFIG_SLOB */
173
174#include <linux/slob_def.h>
175
176#else /* CONFIG_SLOB */
177 176
178/* 177/*
179 * Kmalloc array related definitions 178 * Kmalloc array related definitions
@@ -195,7 +194,9 @@ struct kmem_cache {
195#ifndef KMALLOC_SHIFT_LOW 194#ifndef KMALLOC_SHIFT_LOW
196#define KMALLOC_SHIFT_LOW 5 195#define KMALLOC_SHIFT_LOW 5
197#endif 196#endif
198#else 197#endif
198
199#ifdef CONFIG_SLUB
199/* 200/*
200 * SLUB allocates up to order 2 pages directly and otherwise 201 * SLUB allocates up to order 2 pages directly and otherwise
201 * passes the request to the page allocator. 202 * passes the request to the page allocator.
@@ -207,6 +208,19 @@ struct kmem_cache {
207#endif 208#endif
208#endif 209#endif
209 210
211#ifdef CONFIG_SLOB
212/*
213 * SLOB passes all page size and larger requests to the page allocator.
214 * No kmalloc array is necessary since objects of different sizes can
215 * be allocated from the same page.
216 */
217#define KMALLOC_SHIFT_MAX 30
218#define KMALLOC_SHIFT_HIGH PAGE_SHIFT
219#ifndef KMALLOC_SHIFT_LOW
220#define KMALLOC_SHIFT_LOW 3
221#endif
222#endif
223
210/* Maximum allocatable size */ 224/* Maximum allocatable size */
211#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX) 225#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX)
212/* Maximum size for which we actually use a slab cache */ 226/* Maximum size for which we actually use a slab cache */
@@ -221,6 +235,7 @@ struct kmem_cache {
221#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW) 235#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
222#endif 236#endif
223 237
238#ifndef CONFIG_SLOB
224extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1]; 239extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1];
225#ifdef CONFIG_ZONE_DMA 240#ifdef CONFIG_ZONE_DMA
226extern struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1]; 241extern struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1];
@@ -275,14 +290,121 @@ static __always_inline int kmalloc_index(size_t size)
275 /* Will never be reached. Needed because the compiler may complain */ 290 /* Will never be reached. Needed because the compiler may complain */
276 return -1; 291 return -1;
277} 292}
293#endif /* !CONFIG_SLOB */
294
295void *__kmalloc(size_t size, gfp_t flags);
296void *kmem_cache_alloc(struct kmem_cache *, gfp_t flags);
297
298#ifdef CONFIG_NUMA
299void *__kmalloc_node(size_t size, gfp_t flags, int node);
300void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
301#else
302static __always_inline void *__kmalloc_node(size_t size, gfp_t flags, int node)
303{
304 return __kmalloc(size, flags);
305}
306
307static __always_inline void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t flags, int node)
308{
309 return kmem_cache_alloc(s, flags);
310}
311#endif
312
313#ifdef CONFIG_TRACING
314extern void *kmem_cache_alloc_trace(struct kmem_cache *, gfp_t, size_t);
315
316#ifdef CONFIG_NUMA
317extern void *kmem_cache_alloc_node_trace(struct kmem_cache *s,
318 gfp_t gfpflags,
319 int node, size_t size);
320#else
321static __always_inline void *
322kmem_cache_alloc_node_trace(struct kmem_cache *s,
323 gfp_t gfpflags,
324 int node, size_t size)
325{
326 return kmem_cache_alloc_trace(s, gfpflags, size);
327}
328#endif /* CONFIG_NUMA */
329
330#else /* CONFIG_TRACING */
331static __always_inline void *kmem_cache_alloc_trace(struct kmem_cache *s,
332 gfp_t flags, size_t size)
333{
334 return kmem_cache_alloc(s, flags);
335}
336
337static __always_inline void *
338kmem_cache_alloc_node_trace(struct kmem_cache *s,
339 gfp_t gfpflags,
340 int node, size_t size)
341{
342 return kmem_cache_alloc_node(s, gfpflags, node);
343}
344#endif /* CONFIG_TRACING */
278 345
279#ifdef CONFIG_SLAB 346#ifdef CONFIG_SLAB
280#include <linux/slab_def.h> 347#include <linux/slab_def.h>
281#elif defined(CONFIG_SLUB) 348#endif
349
350#ifdef CONFIG_SLUB
282#include <linux/slub_def.h> 351#include <linux/slub_def.h>
352#endif
353
354static __always_inline void *
355kmalloc_order(size_t size, gfp_t flags, unsigned int order)
356{
357 void *ret;
358
359 flags |= (__GFP_COMP | __GFP_KMEMCG);
360 ret = (void *) __get_free_pages(flags, order);
361 kmemleak_alloc(ret, size, 1, flags);
362 return ret;
363}
364
365#ifdef CONFIG_TRACING
366extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order);
283#else 367#else
284#error "Unknown slab allocator" 368static __always_inline void *
369kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order)
370{
371 return kmalloc_order(size, flags, order);
372}
373#endif
374
375static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
376{
377 unsigned int order = get_order(size);
378 return kmalloc_order_trace(size, flags, order);
379}
380
381/**
382 * kmalloc - allocate memory
383 * @size: how many bytes of memory are required.
384 * @flags: the type of memory to allocate (see kcalloc).
385 *
386 * kmalloc is the normal method of allocating memory
387 * for objects smaller than page size in the kernel.
388 */
389static __always_inline void *kmalloc(size_t size, gfp_t flags)
390{
391 if (__builtin_constant_p(size)) {
392 if (size > KMALLOC_MAX_CACHE_SIZE)
393 return kmalloc_large(size, flags);
394#ifndef CONFIG_SLOB
395 if (!(flags & GFP_DMA)) {
396 int index = kmalloc_index(size);
397
398 if (!index)
399 return ZERO_SIZE_PTR;
400
401 return kmem_cache_alloc_trace(kmalloc_caches[index],
402 flags, size);
403 }
285#endif 404#endif
405 }
406 return __kmalloc(size, flags);
407}
286 408
287/* 409/*
288 * Determine size used for the nth kmalloc cache. 410 * Determine size used for the nth kmalloc cache.
@@ -291,6 +413,7 @@ static __always_inline int kmalloc_index(size_t size)
291 */ 413 */
292static __always_inline int kmalloc_size(int n) 414static __always_inline int kmalloc_size(int n)
293{ 415{
416#ifndef CONFIG_SLOB
294 if (n > 2) 417 if (n > 2)
295 return 1 << n; 418 return 1 << n;
296 419
@@ -299,10 +422,26 @@ static __always_inline int kmalloc_size(int n)
299 422
300 if (n == 2 && KMALLOC_MIN_SIZE <= 64) 423 if (n == 2 && KMALLOC_MIN_SIZE <= 64)
301 return 192; 424 return 192;
302 425#endif
303 return 0; 426 return 0;
304} 427}
305#endif /* !CONFIG_SLOB */ 428
429static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
430{
431#ifndef CONFIG_SLOB
432 if (__builtin_constant_p(size) &&
433 size <= KMALLOC_MAX_CACHE_SIZE && !(flags & GFP_DMA)) {
434 int i = kmalloc_index(size);
435
436 if (!i)
437 return ZERO_SIZE_PTR;
438
439 return kmem_cache_alloc_node_trace(kmalloc_caches[i],
440 flags, node, size);
441 }
442#endif
443 return __kmalloc_node(size, flags, node);
444}
306 445
307/* 446/*
308 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment. 447 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment.
@@ -356,9 +495,8 @@ int cache_show(struct kmem_cache *s, struct seq_file *m);
356void print_slabinfo_header(struct seq_file *m); 495void print_slabinfo_header(struct seq_file *m);
357 496
358/** 497/**
359 * kmalloc_array - allocate memory for an array. 498 * kmalloc - allocate memory
360 * @n: number of elements. 499 * @size: how many bytes of memory are required.
361 * @size: element size.
362 * @flags: the type of memory to allocate. 500 * @flags: the type of memory to allocate.
363 * 501 *
364 * The @flags argument may be one of: 502 * The @flags argument may be one of:
@@ -405,6 +543,17 @@ void print_slabinfo_header(struct seq_file *m);
405 * There are other flags available as well, but these are not intended 543 * There are other flags available as well, but these are not intended
406 * for general use, and so are not documented here. For a full list of 544 * for general use, and so are not documented here. For a full list of
407 * potential flags, always refer to linux/gfp.h. 545 * potential flags, always refer to linux/gfp.h.
546 *
547 * kmalloc is the normal method of allocating memory
548 * in the kernel.
549 */
550static __always_inline void *kmalloc(size_t size, gfp_t flags);
551
552/**
553 * kmalloc_array - allocate memory for an array.
554 * @n: number of elements.
555 * @size: element size.
556 * @flags: the type of memory to allocate (see kmalloc).
408 */ 557 */
409static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) 558static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
410{ 559{
@@ -424,36 +573,6 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
424 return kmalloc_array(n, size, flags | __GFP_ZERO); 573 return kmalloc_array(n, size, flags | __GFP_ZERO);
425} 574}
426 575
427#if !defined(CONFIG_NUMA) && !defined(CONFIG_SLOB)
428/**
429 * kmalloc_node - allocate memory from a specific node
430 * @size: how many bytes of memory are required.
431 * @flags: the type of memory to allocate (see kcalloc).
432 * @node: node to allocate from.
433 *
434 * kmalloc() for non-local nodes, used to allocate from a specific node
435 * if available. Equivalent to kmalloc() in the non-NUMA single-node
436 * case.
437 */
438static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
439{
440 return kmalloc(size, flags);
441}
442
443static inline void *__kmalloc_node(size_t size, gfp_t flags, int node)
444{
445 return __kmalloc(size, flags);
446}
447
448void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
449
450static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
451 gfp_t flags, int node)
452{
453 return kmem_cache_alloc(cachep, flags);
454}
455#endif /* !CONFIG_NUMA && !CONFIG_SLOB */
456
457/* 576/*
458 * kmalloc_track_caller is a special version of kmalloc that records the 577 * kmalloc_track_caller is a special version of kmalloc that records the
459 * calling function of the routine calling it for slab leak tracking instead 578 * calling function of the routine calling it for slab leak tracking instead
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index cd401580bdd3..e9346b4f1ef4 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -3,20 +3,6 @@
3 3
4/* 4/*
5 * Definitions unique to the original Linux SLAB allocator. 5 * Definitions unique to the original Linux SLAB allocator.
6 *
7 * What we provide here is a way to optimize the frequent kmalloc
8 * calls in the kernel by selecting the appropriate general cache
9 * if kmalloc was called with a size that can be established at
10 * compile time.
11 */
12
13#include <linux/init.h>
14#include <linux/compiler.h>
15
16/*
17 * struct kmem_cache
18 *
19 * manages a cache.
20 */ 6 */
21 7
22struct kmem_cache { 8struct kmem_cache {
@@ -102,96 +88,4 @@ struct kmem_cache {
102 */ 88 */
103}; 89};
104 90
105void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
106void *__kmalloc(size_t size, gfp_t flags);
107
108#ifdef CONFIG_TRACING
109extern void *kmem_cache_alloc_trace(struct kmem_cache *, gfp_t, size_t);
110#else
111static __always_inline void *
112kmem_cache_alloc_trace(struct kmem_cache *cachep, gfp_t flags, size_t size)
113{
114 return kmem_cache_alloc(cachep, flags);
115}
116#endif
117
118static __always_inline void *kmalloc(size_t size, gfp_t flags)
119{
120 struct kmem_cache *cachep;
121 void *ret;
122
123 if (__builtin_constant_p(size)) {
124 int i;
125
126 if (!size)
127 return ZERO_SIZE_PTR;
128
129 if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
130 return NULL;
131
132 i = kmalloc_index(size);
133
134#ifdef CONFIG_ZONE_DMA
135 if (flags & GFP_DMA)
136 cachep = kmalloc_dma_caches[i];
137 else
138#endif
139 cachep = kmalloc_caches[i];
140
141 ret = kmem_cache_alloc_trace(cachep, flags, size);
142
143 return ret;
144 }
145 return __kmalloc(size, flags);
146}
147
148#ifdef CONFIG_NUMA
149extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
150extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
151
152#ifdef CONFIG_TRACING
153extern void *kmem_cache_alloc_node_trace(struct kmem_cache *cachep,
154 gfp_t flags,
155 int nodeid,
156 size_t size);
157#else
158static __always_inline void *
159kmem_cache_alloc_node_trace(struct kmem_cache *cachep,
160 gfp_t flags,
161 int nodeid,
162 size_t size)
163{
164 return kmem_cache_alloc_node(cachep, flags, nodeid);
165}
166#endif
167
168static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
169{
170 struct kmem_cache *cachep;
171
172 if (__builtin_constant_p(size)) {
173 int i;
174
175 if (!size)
176 return ZERO_SIZE_PTR;
177
178 if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
179 return NULL;
180
181 i = kmalloc_index(size);
182
183#ifdef CONFIG_ZONE_DMA
184 if (flags & GFP_DMA)
185 cachep = kmalloc_dma_caches[i];
186 else
187#endif
188 cachep = kmalloc_caches[i];
189
190 return kmem_cache_alloc_node_trace(cachep, flags, node, size);
191 }
192 return __kmalloc_node(size, flags, node);
193}
194
195#endif /* CONFIG_NUMA */
196
197#endif /* _LINUX_SLAB_DEF_H */ 91#endif /* _LINUX_SLAB_DEF_H */
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
deleted file mode 100644
index f28e14a12e3f..000000000000
--- a/include/linux/slob_def.h
+++ /dev/null
@@ -1,39 +0,0 @@
1#ifndef __LINUX_SLOB_DEF_H
2#define __LINUX_SLOB_DEF_H
3
4#include <linux/numa.h>
5
6void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
7
8static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep,
9 gfp_t flags)
10{
11 return kmem_cache_alloc_node(cachep, flags, NUMA_NO_NODE);
12}
13
14void *__kmalloc_node(size_t size, gfp_t flags, int node);
15
16static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
17{
18 return __kmalloc_node(size, flags, node);
19}
20
21/**
22 * kmalloc - allocate memory
23 * @size: how many bytes of memory are required.
24 * @flags: the type of memory to allocate (see kcalloc).
25 *
26 * kmalloc is the normal method of allocating memory
27 * in the kernel.
28 */
29static __always_inline void *kmalloc(size_t size, gfp_t flags)
30{
31 return __kmalloc_node(size, flags, NUMA_NO_NODE);
32}
33
34static __always_inline void *__kmalloc(size_t size, gfp_t flags)
35{
36 return kmalloc(size, flags);
37}
38
39#endif /* __LINUX_SLOB_DEF_H */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 027276fa8713..cc0b67eada42 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -6,14 +6,8 @@
6 * 6 *
7 * (C) 2007 SGI, Christoph Lameter 7 * (C) 2007 SGI, Christoph Lameter
8 */ 8 */
9#include <linux/types.h>
10#include <linux/gfp.h>
11#include <linux/bug.h>
12#include <linux/workqueue.h>
13#include <linux/kobject.h> 9#include <linux/kobject.h>
14 10
15#include <linux/kmemleak.h>
16
17enum stat_item { 11enum stat_item {
18 ALLOC_FASTPATH, /* Allocation from cpu slab */ 12 ALLOC_FASTPATH, /* Allocation from cpu slab */
19 ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */ 13 ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */
@@ -104,108 +98,4 @@ struct kmem_cache {
104 struct kmem_cache_node *node[MAX_NUMNODES]; 98 struct kmem_cache_node *node[MAX_NUMNODES];
105}; 99};
106 100
107void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
108void *__kmalloc(size_t size, gfp_t flags);
109
110static __always_inline void *
111kmalloc_order(size_t size, gfp_t flags, unsigned int order)
112{
113 void *ret;
114
115 flags |= (__GFP_COMP | __GFP_KMEMCG);
116 ret = (void *) __get_free_pages(flags, order);
117 kmemleak_alloc(ret, size, 1, flags);
118 return ret;
119}
120
121/**
122 * Calling this on allocated memory will check that the memory
123 * is expected to be in use, and print warnings if not.
124 */
125#ifdef CONFIG_SLUB_DEBUG
126extern bool verify_mem_not_deleted(const void *x);
127#else
128static inline bool verify_mem_not_deleted(const void *x)
129{
130 return true;
131}
132#endif
133
134#ifdef CONFIG_TRACING
135extern void *
136kmem_cache_alloc_trace(struct kmem_cache *s, gfp_t gfpflags, size_t size);
137extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order);
138#else
139static __always_inline void *
140kmem_cache_alloc_trace(struct kmem_cache *s, gfp_t gfpflags, size_t size)
141{
142 return kmem_cache_alloc(s, gfpflags);
143}
144
145static __always_inline void *
146kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order)
147{
148 return kmalloc_order(size, flags, order);
149}
150#endif
151
152static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
153{
154 unsigned int order = get_order(size);
155 return kmalloc_order_trace(size, flags, order);
156}
157
158static __always_inline void *kmalloc(size_t size, gfp_t flags)
159{
160 if (__builtin_constant_p(size)) {
161 if (size > KMALLOC_MAX_CACHE_SIZE)
162 return kmalloc_large(size, flags);
163
164 if (!(flags & GFP_DMA)) {
165 int index = kmalloc_index(size);
166
167 if (!index)
168 return ZERO_SIZE_PTR;
169
170 return kmem_cache_alloc_trace(kmalloc_caches[index],
171 flags, size);
172 }
173 }
174 return __kmalloc(size, flags);
175}
176
177#ifdef CONFIG_NUMA
178void *__kmalloc_node(size_t size, gfp_t flags, int node);
179void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
180
181#ifdef CONFIG_TRACING
182extern void *kmem_cache_alloc_node_trace(struct kmem_cache *s,
183 gfp_t gfpflags,
184 int node, size_t size);
185#else
186static __always_inline void *
187kmem_cache_alloc_node_trace(struct kmem_cache *s,
188 gfp_t gfpflags,
189 int node, size_t size)
190{
191 return kmem_cache_alloc_node(s, gfpflags, node);
192}
193#endif
194
195static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
196{
197 if (__builtin_constant_p(size) &&
198 size <= KMALLOC_MAX_CACHE_SIZE && !(flags & GFP_DMA)) {
199 int index = kmalloc_index(size);
200
201 if (!index)
202 return ZERO_SIZE_PTR;
203
204 return kmem_cache_alloc_node_trace(kmalloc_caches[index],
205 flags, node, size);
206 }
207 return __kmalloc_node(size, flags, node);
208}
209#endif
210
211#endif /* _LINUX_SLUB_DEF_H */ 101#endif /* _LINUX_SLUB_DEF_H */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index e6564c1dc552..731f5237d5f4 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -28,6 +28,27 @@ extern unsigned int total_cpus;
28int smp_call_function_single(int cpuid, smp_call_func_t func, void *info, 28int smp_call_function_single(int cpuid, smp_call_func_t func, void *info,
29 int wait); 29 int wait);
30 30
31/*
32 * Call a function on all processors
33 */
34int on_each_cpu(smp_call_func_t func, void *info, int wait);
35
36/*
37 * Call a function on processors specified by mask, which might include
38 * the local one.
39 */
40void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func,
41 void *info, bool wait);
42
43/*
44 * Call a function on each processor for which the supplied function
45 * cond_func returns a positive value. This may include the local
46 * processor.
47 */
48void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
49 smp_call_func_t func, void *info, bool wait,
50 gfp_t gfp_flags);
51
31#ifdef CONFIG_SMP 52#ifdef CONFIG_SMP
32 53
33#include <linux/preempt.h> 54#include <linux/preempt.h>
@@ -95,27 +116,6 @@ static inline void call_function_init(void) { }
95#endif 116#endif
96 117
97/* 118/*
98 * Call a function on all processors
99 */
100int on_each_cpu(smp_call_func_t func, void *info, int wait);
101
102/*
103 * Call a function on processors specified by mask, which might include
104 * the local one.
105 */
106void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func,
107 void *info, bool wait);
108
109/*
110 * Call a function on each processor for which the supplied function
111 * cond_func returns a positive value. This may include the local
112 * processor.
113 */
114void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
115 smp_call_func_t func, void *info, bool wait,
116 gfp_t gfp_flags);
117
118/*
119 * Mark the boot cpu "online" so that it can call console drivers in 119 * Mark the boot cpu "online" so that it can call console drivers in
120 * printk() and can access its per-cpu storage. 120 * printk() and can access its per-cpu storage.
121 */ 121 */
@@ -139,42 +139,6 @@ static inline int up_smp_call_function(smp_call_func_t func, void *info)
139} 139}
140#define smp_call_function(func, info, wait) \ 140#define smp_call_function(func, info, wait) \
141 (up_smp_call_function(func, info)) 141 (up_smp_call_function(func, info))
142#define on_each_cpu(func,info,wait) \
143 ({ \
144 local_irq_disable(); \
145 func(info); \
146 local_irq_enable(); \
147 0; \
148 })
149/*
150 * Note we still need to test the mask even for UP
151 * because we actually can get an empty mask from
152 * code that on SMP might call us without the local
153 * CPU in the mask.
154 */
155#define on_each_cpu_mask(mask, func, info, wait) \
156 do { \
157 if (cpumask_test_cpu(0, (mask))) { \
158 local_irq_disable(); \
159 (func)(info); \
160 local_irq_enable(); \
161 } \
162 } while (0)
163/*
164 * Preemption is disabled here to make sure the cond_func is called under the
165 * same condtions in UP and SMP.
166 */
167#define on_each_cpu_cond(cond_func, func, info, wait, gfp_flags)\
168 do { \
169 void *__info = (info); \
170 preempt_disable(); \
171 if ((cond_func)(0, __info)) { \
172 local_irq_disable(); \
173 (func)(__info); \
174 local_irq_enable(); \
175 } \
176 preempt_enable(); \
177 } while (0)
178 142
179static inline void smp_send_reschedule(int cpu) { } 143static inline void smp_send_reschedule(int cpu) { }
180#define smp_prepare_boot_cpu() do {} while (0) 144#define smp_prepare_boot_cpu() do {} while (0)
@@ -191,6 +155,12 @@ smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,
191 155
192static inline void kick_all_cpus_sync(void) { } 156static inline void kick_all_cpus_sync(void) { }
193 157
158static inline void __smp_call_function_single(int cpuid,
159 struct call_single_data *data, int wait)
160{
161 on_each_cpu(data->func, data->info, wait);
162}
163
194#endif /* !SMP */ 164#endif /* !SMP */
195 165
196/* 166/*
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
index 4dde70e74822..eec3efd19beb 100644
--- a/include/linux/smsc911x.h
+++ b/include/linux/smsc911x.h
@@ -22,6 +22,7 @@
22#define __LINUX_SMSC911X_H__ 22#define __LINUX_SMSC911X_H__
23 23
24#include <linux/phy.h> 24#include <linux/phy.h>
25#include <linux/if_ether.h>
25 26
26/* platform_device configuration data, should be assigned to 27/* platform_device configuration data, should be assigned to
27 * the platform_device's dev.platform_data */ 28 * the platform_device's dev.platform_data */
@@ -31,7 +32,7 @@ struct smsc911x_platform_config {
31 unsigned int flags; 32 unsigned int flags;
32 unsigned int shift; 33 unsigned int shift;
33 phy_interface_t phy_interface; 34 phy_interface_t phy_interface;
34 unsigned char mac[6]; 35 unsigned char mac[ETH_ALEN];
35}; 36};
36 37
37/* Constants for platform_device irq polarity configuration */ 38/* Constants for platform_device irq polarity configuration */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index b10ce4b341ea..445ef7519dc2 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -167,6 +167,7 @@ struct ucred {
167#define AF_PPPOX 24 /* PPPoX sockets */ 167#define AF_PPPOX 24 /* PPPoX sockets */
168#define AF_WANPIPE 25 /* Wanpipe API Sockets */ 168#define AF_WANPIPE 25 /* Wanpipe API Sockets */
169#define AF_LLC 26 /* Linux LLC */ 169#define AF_LLC 26 /* Linux LLC */
170#define AF_IB 27 /* Native InfiniBand address */
170#define AF_CAN 29 /* Controller Area Network */ 171#define AF_CAN 29 /* Controller Area Network */
171#define AF_TIPC 30 /* TIPC sockets */ 172#define AF_TIPC 30 /* TIPC sockets */
172#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 173#define AF_BLUETOOTH 31 /* Bluetooth sockets */
@@ -211,6 +212,7 @@ struct ucred {
211#define PF_PPPOX AF_PPPOX 212#define PF_PPPOX AF_PPPOX
212#define PF_WANPIPE AF_WANPIPE 213#define PF_WANPIPE AF_WANPIPE
213#define PF_LLC AF_LLC 214#define PF_LLC AF_LLC
215#define PF_IB AF_IB
214#define PF_CAN AF_CAN 216#define PF_CAN AF_CAN
215#define PF_TIPC AF_TIPC 217#define PF_TIPC AF_TIPC
216#define PF_BLUETOOTH AF_BLUETOOTH 218#define PF_BLUETOOTH AF_BLUETOOTH
@@ -311,6 +313,8 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
311 struct iovec *iov, 313 struct iovec *iov,
312 int offset, 314 int offset,
313 unsigned int len, __wsum *csump); 315 unsigned int len, __wsum *csump);
316extern unsigned long iov_pages(const struct iovec *iov, int offset,
317 unsigned long nr_segs);
314 318
315extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode); 319extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode);
316extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, 320extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h
index 32be8dbdf191..274bc0fa00af 100644
--- a/include/linux/spi/mmc_spi.h
+++ b/include/linux/spi/mmc_spi.h
@@ -7,6 +7,11 @@
7struct device; 7struct device;
8struct mmc_host; 8struct mmc_host;
9 9
10#define MMC_SPI_USE_CD_GPIO (1 << 0)
11#define MMC_SPI_USE_RO_GPIO (1 << 1)
12#define MMC_SPI_CD_GPIO_ACTIVE_LOW (1 << 2)
13#define MMC_SPI_RO_GPIO_ACTIVE_LOW (1 << 3)
14
10/* Put this in platform_data of a device being used to manage an MMC/SD 15/* Put this in platform_data of a device being used to manage an MMC/SD
11 * card slot. (Modeled after PXA mmc glue; see that for usage examples.) 16 * card slot. (Modeled after PXA mmc glue; see that for usage examples.)
12 * 17 *
@@ -21,17 +26,19 @@ struct mmc_spi_platform_data {
21 void *); 26 void *);
22 void (*exit)(struct device *, void *); 27 void (*exit)(struct device *, void *);
23 28
24 /* sense switch on sd cards */
25 int (*get_ro)(struct device *);
26
27 /* 29 /*
28 * If board does not use CD interrupts, driver can optimize polling 30 * Card Detect and Read Only GPIOs. To enable debouncing on the card
29 * using this function. 31 * detect GPIO, set the cd_debounce to the debounce time in
32 * microseconds.
30 */ 33 */
31 int (*get_cd)(struct device *); 34 unsigned int flags;
35 unsigned int cd_gpio;
36 unsigned int cd_debounce;
37 unsigned int ro_gpio;
32 38
33 /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */ 39 /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */
34 unsigned long caps; 40 unsigned long caps;
41 unsigned long caps2;
35 42
36 /* how long to debounce card detect, in msecs */ 43 /* how long to debounce card detect, in msecs */
37 u16 detect_delay; 44 u16 detect_delay;
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 6ff26c8db7b9..887116dbce2c 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -74,7 +74,7 @@ struct spi_device {
74 struct spi_master *master; 74 struct spi_master *master;
75 u32 max_speed_hz; 75 u32 max_speed_hz;
76 u8 chip_select; 76 u8 chip_select;
77 u8 mode; 77 u16 mode;
78#define SPI_CPHA 0x01 /* clock phase */ 78#define SPI_CPHA 0x01 /* clock phase */
79#define SPI_CPOL 0x02 /* clock polarity */ 79#define SPI_CPOL 0x02 /* clock polarity */
80#define SPI_MODE_0 (0|0) /* (original MicroWire) */ 80#define SPI_MODE_0 (0|0) /* (original MicroWire) */
@@ -87,6 +87,10 @@ struct spi_device {
87#define SPI_LOOP 0x20 /* loopback mode */ 87#define SPI_LOOP 0x20 /* loopback mode */
88#define SPI_NO_CS 0x40 /* 1 dev/bus, no chipselect */ 88#define SPI_NO_CS 0x40 /* 1 dev/bus, no chipselect */
89#define SPI_READY 0x80 /* slave pulls low to pause */ 89#define SPI_READY 0x80 /* slave pulls low to pause */
90#define SPI_TX_DUAL 0x100 /* transmit with 2 wires */
91#define SPI_TX_QUAD 0x200 /* transmit with 4 wires */
92#define SPI_RX_DUAL 0x400 /* receive with 2 wires */
93#define SPI_RX_QUAD 0x800 /* receive with 4 wires */
90 u8 bits_per_word; 94 u8 bits_per_word;
91 int irq; 95 int irq;
92 void *controller_state; 96 void *controller_state;
@@ -233,6 +237,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
233 * suported. If set, the SPI core will reject any transfer with an 237 * suported. If set, the SPI core will reject any transfer with an
234 * unsupported bits_per_word. If not set, this value is simply ignored, 238 * unsupported bits_per_word. If not set, this value is simply ignored,
235 * and it's up to the individual driver to perform any validation. 239 * and it's up to the individual driver to perform any validation.
240 * @min_speed_hz: Lowest supported transfer speed
241 * @max_speed_hz: Highest supported transfer speed
236 * @flags: other constraints relevant to this driver 242 * @flags: other constraints relevant to this driver
237 * @bus_lock_spinlock: spinlock for SPI bus locking 243 * @bus_lock_spinlock: spinlock for SPI bus locking
238 * @bus_lock_mutex: mutex for SPI bus locking 244 * @bus_lock_mutex: mutex for SPI bus locking
@@ -254,6 +260,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
254 * @busy: message pump is busy 260 * @busy: message pump is busy
255 * @running: message pump is running 261 * @running: message pump is running
256 * @rt: whether this queue is set to run as a realtime task 262 * @rt: whether this queue is set to run as a realtime task
263 * @auto_runtime_pm: the core should ensure a runtime PM reference is held
264 * while the hardware is prepared, using the parent
265 * device for the spidev
257 * @prepare_transfer_hardware: a message will soon arrive from the queue 266 * @prepare_transfer_hardware: a message will soon arrive from the queue
258 * so the subsystem requests the driver to prepare the transfer hardware 267 * so the subsystem requests the driver to prepare the transfer hardware
259 * by issuing this call 268 * by issuing this call
@@ -308,6 +317,13 @@ struct spi_master {
308 317
309 /* bitmask of supported bits_per_word for transfers */ 318 /* bitmask of supported bits_per_word for transfers */
310 u32 bits_per_word_mask; 319 u32 bits_per_word_mask;
320#define SPI_BPW_MASK(bits) BIT((bits) - 1)
321#define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0U : (BIT(bits) - 1))
322#define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1))
323
324 /* limits on transfer speed */
325 u32 min_speed_hz;
326 u32 max_speed_hz;
311 327
312 /* other constraints relevant to this driver */ 328 /* other constraints relevant to this driver */
313 u16 flags; 329 u16 flags;
@@ -371,11 +387,13 @@ struct spi_master {
371 bool busy; 387 bool busy;
372 bool running; 388 bool running;
373 bool rt; 389 bool rt;
390 bool auto_runtime_pm;
374 391
375 int (*prepare_transfer_hardware)(struct spi_master *master); 392 int (*prepare_transfer_hardware)(struct spi_master *master);
376 int (*transfer_one_message)(struct spi_master *master, 393 int (*transfer_one_message)(struct spi_master *master,
377 struct spi_message *mesg); 394 struct spi_message *mesg);
378 int (*unprepare_transfer_hardware)(struct spi_master *master); 395 int (*unprepare_transfer_hardware)(struct spi_master *master);
396
379 /* gpio chip select */ 397 /* gpio chip select */
380 int *cs_gpios; 398 int *cs_gpios;
381}; 399};
@@ -445,6 +463,10 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
445 * @rx_buf: data to be read (dma-safe memory), or NULL 463 * @rx_buf: data to be read (dma-safe memory), or NULL
446 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped 464 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped
447 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped 465 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped
466 * @tx_nbits: number of bits used for writting. If 0 the default
467 * (SPI_NBITS_SINGLE) is used.
468 * @rx_nbits: number of bits used for reading. If 0 the default
469 * (SPI_NBITS_SINGLE) is used.
448 * @len: size of rx and tx buffers (in bytes) 470 * @len: size of rx and tx buffers (in bytes)
449 * @speed_hz: Select a speed other than the device default for this 471 * @speed_hz: Select a speed other than the device default for this
450 * transfer. If 0 the default (from @spi_device) is used. 472 * transfer. If 0 the default (from @spi_device) is used.
@@ -499,6 +521,11 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
499 * by the results of previous messages and where the whole transaction 521 * by the results of previous messages and where the whole transaction
500 * ends when the chipselect goes intactive. 522 * ends when the chipselect goes intactive.
501 * 523 *
524 * When SPI can transfer in 1x,2x or 4x. It can get this tranfer information
525 * from device through @tx_nbits and @rx_nbits. In Bi-direction, these
526 * two should both be set. User can set transfer mode with SPI_NBITS_SINGLE(1x)
527 * SPI_NBITS_DUAL(2x) and SPI_NBITS_QUAD(4x) to support these three transfer.
528 *
502 * The code that submits an spi_message (and its spi_transfers) 529 * The code that submits an spi_message (and its spi_transfers)
503 * to the lower layers is responsible for managing its memory. 530 * to the lower layers is responsible for managing its memory.
504 * Zero-initialize every field you don't set up explicitly, to 531 * Zero-initialize every field you don't set up explicitly, to
@@ -519,6 +546,11 @@ struct spi_transfer {
519 dma_addr_t rx_dma; 546 dma_addr_t rx_dma;
520 547
521 unsigned cs_change:1; 548 unsigned cs_change:1;
549 u8 tx_nbits;
550 u8 rx_nbits;
551#define SPI_NBITS_SINGLE 0x01 /* 1bit transfer */
552#define SPI_NBITS_DUAL 0x02 /* 2bits transfer */
553#define SPI_NBITS_QUAD 0x04 /* 4bits transfer */
522 u8 bits_per_word; 554 u8 bits_per_word;
523 u16 delay_usecs; 555 u16 delay_usecs;
524 u32 speed_hz; 556 u32 speed_hz;
@@ -575,6 +607,7 @@ struct spi_message {
575 /* completion is reported through a callback */ 607 /* completion is reported through a callback */
576 void (*complete)(void *context); 608 void (*complete)(void *context);
577 void *context; 609 void *context;
610 unsigned frame_length;
578 unsigned actual_length; 611 unsigned actual_length;
579 int status; 612 int status;
580 613
@@ -866,7 +899,7 @@ struct spi_board_info {
866 /* mode becomes spi_device.mode, and is essential for chips 899 /* mode becomes spi_device.mode, and is essential for chips
867 * where the default of SPI_CS_HIGH = 0 is wrong. 900 * where the default of SPI_CS_HIGH = 0 is wrong.
868 */ 901 */
869 u8 mode; 902 u16 mode;
870 903
871 /* ... may need additional spi_device chip config data here. 904 /* ... may need additional spi_device chip config data here.
872 * avoid stuff protocol drivers can set; but include stuff 905 * avoid stuff protocol drivers can set; but include stuff
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index f987a2bee16a..daebaba886aa 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -4,11 +4,7 @@
4#include <linux/workqueue.h> 4#include <linux/workqueue.h>
5 5
6struct spi_bitbang { 6struct spi_bitbang {
7 struct workqueue_struct *workqueue;
8 struct work_struct work;
9
10 spinlock_t lock; 7 spinlock_t lock;
11 struct list_head queue;
12 u8 busy; 8 u8 busy;
13 u8 use_dma; 9 u8 use_dma;
14 u8 flags; /* extra spi->mode support */ 10 u8 flags; /* extra spi->mode support */
@@ -41,7 +37,6 @@ struct spi_bitbang {
41 */ 37 */
42extern int spi_bitbang_setup(struct spi_device *spi); 38extern int spi_bitbang_setup(struct spi_device *spi);
43extern void spi_bitbang_cleanup(struct spi_device *spi); 39extern void spi_bitbang_cleanup(struct spi_device *spi);
44extern int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m);
45extern int spi_bitbang_setup_transfer(struct spi_device *spi, 40extern int spi_bitbang_setup_transfer(struct spi_device *spi,
46 struct spi_transfer *t); 41 struct spi_transfer *t);
47 42
diff --git a/include/linux/spi/xilinx_spi.h b/include/linux/spi/xilinx_spi.h
index 6f17278810b0..333ecdfee0d9 100644
--- a/include/linux/spi/xilinx_spi.h
+++ b/include/linux/spi/xilinx_spi.h
@@ -11,7 +11,6 @@
11 */ 11 */
12struct xspi_platform_data { 12struct xspi_platform_data {
13 u16 num_chipselect; 13 u16 num_chipselect;
14 bool little_endian;
15 u8 bits_per_word; 14 u8 bits_per_word;
16 struct spi_board_info *devices; 15 struct spi_board_info *devices;
17 u8 num_devices; 16 u8 num_devices;
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 7d537ced949a..75f34949d9ab 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -117,9 +117,17 @@ do { \
117#endif /*arch_spin_is_contended*/ 117#endif /*arch_spin_is_contended*/
118#endif 118#endif
119 119
120/* The lock does not imply full memory barrier. */ 120/*
121#ifndef ARCH_HAS_SMP_MB_AFTER_LOCK 121 * Despite its name it doesn't necessarily has to be a full barrier.
122static inline void smp_mb__after_lock(void) { smp_mb(); } 122 * It should only guarantee that a STORE before the critical section
123 * can not be reordered with a LOAD inside this section.
124 * spin_lock() is the one-way barrier, this LOAD can not escape out
125 * of the region. So the default implementation simply ensures that
126 * a STORE can not move into the critical section, smp_wmb() should
127 * serialize it with another STORE done by spin_lock().
128 */
129#ifndef smp_mb__before_spinlock
130#define smp_mb__before_spinlock() smp_wmb()
123#endif 131#endif
124 132
125/** 133/**
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index 51df117abe46..bdb9993f0fda 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -144,7 +144,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
144 LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); 144 LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock);
145} 145}
146 146
147#endif /* CONFIG_PREEMPT */ 147#endif /* !CONFIG_GENERIC_LOCKBREAK || CONFIG_DEBUG_LOCK_ALLOC */
148 148
149static inline void __raw_spin_unlock(raw_spinlock_t *lock) 149static inline void __raw_spin_unlock(raw_spinlock_t *lock)
150{ 150{
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h
index e2369c167dbd..8b3ac0d718eb 100644
--- a/include/linux/spinlock_up.h
+++ b/include/linux/spinlock_up.h
@@ -67,7 +67,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)
67 67
68#else /* DEBUG_SPINLOCK */ 68#else /* DEBUG_SPINLOCK */
69#define arch_spin_is_locked(lock) ((void)(lock), 0) 69#define arch_spin_is_locked(lock) ((void)(lock), 0)
70/* for sched.c and kernel_lock.c: */ 70/* for sched/core.c and kernel_lock.c: */
71# define arch_spin_lock(lock) do { barrier(); (void)(lock); } while (0) 71# define arch_spin_lock(lock) do { barrier(); (void)(lock); } while (0)
72# define arch_spin_lock_flags(lock, flags) do { barrier(); (void)(lock); } while (0) 72# define arch_spin_lock_flags(lock, flags) do { barrier(); (void)(lock); } while (0)
73# define arch_spin_unlock(lock) do { barrier(); (void)(lock); } while (0) 73# define arch_spin_unlock(lock) do { barrier(); (void)(lock); } while (0)
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 09a545a7dfa3..74575cbf2d6f 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -35,6 +35,7 @@ struct splice_desc {
35 void *data; /* cookie */ 35 void *data; /* cookie */
36 } u; 36 } u;
37 loff_t pos; /* file position */ 37 loff_t pos; /* file position */
38 loff_t *opos; /* sendfile: output position */
38 size_t num_spliced; /* number of bytes already spliced */ 39 size_t num_spliced; /* number of bytes already spliced */
39 bool need_wakeup; /* need to wake up writer */ 40 bool need_wakeup; /* need to wake up writer */
40}; 41};
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 04f4121a23ae..c114614ed172 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -237,47 +237,4 @@ static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
237 __srcu_read_unlock(sp, idx); 237 __srcu_read_unlock(sp, idx);
238} 238}
239 239
240/**
241 * srcu_read_lock_raw - register a new reader for an SRCU-protected structure.
242 * @sp: srcu_struct in which to register the new reader.
243 *
244 * Enter an SRCU read-side critical section. Similar to srcu_read_lock(),
245 * but avoids the RCU-lockdep checking. This means that it is legal to
246 * use srcu_read_lock_raw() in one context, for example, in an exception
247 * handler, and then have the matching srcu_read_unlock_raw() in another
248 * context, for example in the task that took the exception.
249 *
250 * However, the entire SRCU read-side critical section must reside within a
251 * single task. For example, beware of using srcu_read_lock_raw() in
252 * a device interrupt handler and srcu_read_unlock() in the interrupted
253 * task: This will not work if interrupts are threaded.
254 */
255static inline int srcu_read_lock_raw(struct srcu_struct *sp)
256{
257 unsigned long flags;
258 int ret;
259
260 local_irq_save(flags);
261 ret = __srcu_read_lock(sp);
262 local_irq_restore(flags);
263 return ret;
264}
265
266/**
267 * srcu_read_unlock_raw - unregister reader from an SRCU-protected structure.
268 * @sp: srcu_struct in which to unregister the old reader.
269 * @idx: return value from corresponding srcu_read_lock_raw().
270 *
271 * Exit an SRCU read-side critical section without lockdep-RCU checking.
272 * See srcu_read_lock_raw() for more details.
273 */
274static inline void srcu_read_unlock_raw(struct srcu_struct *sp, int idx)
275{
276 unsigned long flags;
277
278 local_irq_save(flags);
279 __srcu_read_unlock(sp, idx);
280 local_irq_restore(flags);
281}
282
283#endif 240#endif
diff --git a/include/linux/ssb/ssb_driver_mips.h b/include/linux/ssb/ssb_driver_mips.h
index afe79d40a99e..6535e4718fde 100644
--- a/include/linux/ssb/ssb_driver_mips.h
+++ b/include/linux/ssb/ssb_driver_mips.h
@@ -20,6 +20,18 @@ struct ssb_pflash {
20 u32 window_size; 20 u32 window_size;
21}; 21};
22 22
23#ifdef CONFIG_SSB_SFLASH
24struct ssb_sflash {
25 bool present;
26 u32 window;
27 u32 blocksize;
28 u16 numblocks;
29 u32 size;
30
31 void *priv;
32};
33#endif
34
23struct ssb_mipscore { 35struct ssb_mipscore {
24 struct ssb_device *dev; 36 struct ssb_device *dev;
25 37
@@ -27,6 +39,9 @@ struct ssb_mipscore {
27 struct ssb_serial_port serial_ports[4]; 39 struct ssb_serial_port serial_ports[4];
28 40
29 struct ssb_pflash pflash; 41 struct ssb_pflash pflash;
42#ifdef CONFIG_SSB_SFLASH
43 struct ssb_sflash sflash;
44#endif
30}; 45};
31 46
32extern void ssb_mipscore_init(struct ssb_mipscore *mcore); 47extern void ssb_mipscore_init(struct ssb_mipscore *mcore);
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 3a7256955b10..f9f931c89e3e 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -172,6 +172,7 @@
172#define SSB_SPROMSIZE_WORDS_R4 220 172#define SSB_SPROMSIZE_WORDS_R4 220
173#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16)) 173#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16))
174#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16)) 174#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16))
175#define SSB_SPROMSIZE_WORDS_R10 230
175#define SSB_SPROM_BASE1 0x1000 176#define SSB_SPROM_BASE1 0x1000
176#define SSB_SPROM_BASE31 0x0800 177#define SSB_SPROM_BASE31 0x0800
177#define SSB_SPROM_REVISION 0x007E 178#define SSB_SPROM_REVISION 0x007E
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index c1b3ed3fb787..bb5deb0feb6b 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -80,6 +80,10 @@ struct stmmac_mdio_bus_data {
80 unsigned int phy_mask; 80 unsigned int phy_mask;
81 int *irqs; 81 int *irqs;
82 int probed_phy_irq; 82 int probed_phy_irq;
83#ifdef CONFIG_OF
84 int reset_gpio, active_low;
85 u32 delays[3];
86#endif
83}; 87};
84 88
85struct stmmac_dma_cfg { 89struct stmmac_dma_cfg {
@@ -104,6 +108,7 @@ struct plat_stmmacenet_data {
104 int bugged_jumbo; 108 int bugged_jumbo;
105 int pmt; 109 int pmt;
106 int force_sf_dma_mode; 110 int force_sf_dma_mode;
111 int force_thresh_dma_mode;
107 int riwt_off; 112 int riwt_off;
108 void (*fix_mac_speed)(void *priv, unsigned int speed); 113 void (*fix_mac_speed)(void *priv, unsigned int speed);
109 void (*bus_setup)(void __iomem *ioaddr); 114 void (*bus_setup)(void __iomem *ioaddr);
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 0dd00f4f6810..790be1472792 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -24,12 +24,21 @@
24 24
25struct rpcsec_gss_info; 25struct rpcsec_gss_info;
26 26
27/* auth_cred ac_flags bits */
28enum {
29 RPC_CRED_NO_CRKEY_TIMEOUT = 0, /* underlying cred has no key timeout */
30 RPC_CRED_KEY_EXPIRE_SOON = 1, /* underlying cred key will expire soon */
31 RPC_CRED_NOTIFY_TIMEOUT = 2, /* nofity generic cred when underlying
32 key will expire soon */
33};
34
27/* Work around the lack of a VFS credential */ 35/* Work around the lack of a VFS credential */
28struct auth_cred { 36struct auth_cred {
29 kuid_t uid; 37 kuid_t uid;
30 kgid_t gid; 38 kgid_t gid;
31 struct group_info *group_info; 39 struct group_info *group_info;
32 const char *principal; 40 const char *principal;
41 unsigned long ac_flags;
33 unsigned char machine_cred : 1; 42 unsigned char machine_cred : 1;
34}; 43};
35 44
@@ -87,6 +96,11 @@ struct rpc_auth {
87 /* per-flavor data */ 96 /* per-flavor data */
88}; 97};
89 98
99struct rpc_auth_create_args {
100 rpc_authflavor_t pseudoflavor;
101 const char *target_name;
102};
103
90/* Flags for rpcauth_lookupcred() */ 104/* Flags for rpcauth_lookupcred() */
91#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */ 105#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */
92 106
@@ -97,17 +111,17 @@ struct rpc_authops {
97 struct module *owner; 111 struct module *owner;
98 rpc_authflavor_t au_flavor; /* flavor (RPC_AUTH_*) */ 112 rpc_authflavor_t au_flavor; /* flavor (RPC_AUTH_*) */
99 char * au_name; 113 char * au_name;
100 struct rpc_auth * (*create)(struct rpc_clnt *, rpc_authflavor_t); 114 struct rpc_auth * (*create)(struct rpc_auth_create_args *, struct rpc_clnt *);
101 void (*destroy)(struct rpc_auth *); 115 void (*destroy)(struct rpc_auth *);
102 116
103 struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int); 117 struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int);
104 struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int); 118 struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int);
105 int (*pipes_create)(struct rpc_auth *);
106 void (*pipes_destroy)(struct rpc_auth *);
107 int (*list_pseudoflavors)(rpc_authflavor_t *, int); 119 int (*list_pseudoflavors)(rpc_authflavor_t *, int);
108 rpc_authflavor_t (*info2flavor)(struct rpcsec_gss_info *); 120 rpc_authflavor_t (*info2flavor)(struct rpcsec_gss_info *);
109 int (*flavor2info)(rpc_authflavor_t, 121 int (*flavor2info)(rpc_authflavor_t,
110 struct rpcsec_gss_info *); 122 struct rpcsec_gss_info *);
123 int (*key_timeout)(struct rpc_auth *,
124 struct rpc_cred *);
111}; 125};
112 126
113struct rpc_credops { 127struct rpc_credops {
@@ -124,6 +138,8 @@ struct rpc_credops {
124 void *, __be32 *, void *); 138 void *, __be32 *, void *);
125 int (*crunwrap_resp)(struct rpc_task *, kxdrdproc_t, 139 int (*crunwrap_resp)(struct rpc_task *, kxdrdproc_t,
126 void *, __be32 *, void *); 140 void *, __be32 *, void *);
141 int (*crkey_timeout)(struct rpc_cred *);
142 bool (*crkey_to_expire)(struct rpc_cred *);
127}; 143};
128 144
129extern const struct rpc_authops authunix_ops; 145extern const struct rpc_authops authunix_ops;
@@ -140,7 +156,8 @@ struct rpc_cred * rpc_lookup_cred(void);
140struct rpc_cred * rpc_lookup_machine_cred(const char *service_name); 156struct rpc_cred * rpc_lookup_machine_cred(const char *service_name);
141int rpcauth_register(const struct rpc_authops *); 157int rpcauth_register(const struct rpc_authops *);
142int rpcauth_unregister(const struct rpc_authops *); 158int rpcauth_unregister(const struct rpc_authops *);
143struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); 159struct rpc_auth * rpcauth_create(struct rpc_auth_create_args *,
160 struct rpc_clnt *);
144void rpcauth_release(struct rpc_auth *); 161void rpcauth_release(struct rpc_auth *);
145rpc_authflavor_t rpcauth_get_pseudoflavor(rpc_authflavor_t, 162rpc_authflavor_t rpcauth_get_pseudoflavor(rpc_authflavor_t,
146 struct rpcsec_gss_info *); 163 struct rpcsec_gss_info *);
@@ -162,6 +179,9 @@ int rpcauth_uptodatecred(struct rpc_task *);
162int rpcauth_init_credcache(struct rpc_auth *); 179int rpcauth_init_credcache(struct rpc_auth *);
163void rpcauth_destroy_credcache(struct rpc_auth *); 180void rpcauth_destroy_credcache(struct rpc_auth *);
164void rpcauth_clear_credcache(struct rpc_cred_cache *); 181void rpcauth_clear_credcache(struct rpc_cred_cache *);
182int rpcauth_key_timeout_notify(struct rpc_auth *,
183 struct rpc_cred *);
184bool rpcauth_cred_key_to_expire(struct rpc_cred *);
165 185
166static inline 186static inline
167struct rpc_cred * get_rpccred(struct rpc_cred *cred) 187struct rpc_cred * get_rpccred(struct rpc_cred *cred)
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 303399b1ba59..437ddb6c4aef 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -57,6 +57,7 @@ struct cache_head {
57#define CACHE_VALID 0 /* Entry contains valid data */ 57#define CACHE_VALID 0 /* Entry contains valid data */
58#define CACHE_NEGATIVE 1 /* Negative entry - there is no match for the key */ 58#define CACHE_NEGATIVE 1 /* Negative entry - there is no match for the key */
59#define CACHE_PENDING 2 /* An upcall has been sent but no reply received yet*/ 59#define CACHE_PENDING 2 /* An upcall has been sent but no reply received yet*/
60#define CACHE_CLEANED 3 /* Entry has been cleaned from cache */
60 61
61#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */ 62#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */
62 63
@@ -148,6 +149,24 @@ struct cache_deferred_req {
148 int too_many); 149 int too_many);
149}; 150};
150 151
152/*
153 * timestamps kept in the cache are expressed in seconds
154 * since boot. This is the best for measuring differences in
155 * real time.
156 */
157static inline time_t seconds_since_boot(void)
158{
159 struct timespec boot;
160 getboottime(&boot);
161 return get_seconds() - boot.tv_sec;
162}
163
164static inline time_t convert_to_wallclock(time_t sinceboot)
165{
166 struct timespec boot;
167 getboottime(&boot);
168 return boot.tv_sec + sinceboot;
169}
151 170
152extern const struct file_operations cache_file_operations_pipefs; 171extern const struct file_operations cache_file_operations_pipefs;
153extern const struct file_operations content_file_operations_pipefs; 172extern const struct file_operations content_file_operations_pipefs;
@@ -181,15 +200,10 @@ static inline void cache_put(struct cache_head *h, struct cache_detail *cd)
181 kref_put(&h->ref, cd->cache_put); 200 kref_put(&h->ref, cd->cache_put);
182} 201}
183 202
184static inline int cache_valid(struct cache_head *h) 203static inline int cache_is_expired(struct cache_detail *detail, struct cache_head *h)
185{ 204{
186 /* If an item has been unhashed pending removal when 205 return (h->expiry_time < seconds_since_boot()) ||
187 * the refcount drops to 0, the expiry_time will be 206 (detail->flush_time > h->last_refresh);
188 * set to 0. We don't want to consider such items
189 * valid in this context even though CACHE_VALID is
190 * set.
191 */
192 return (h->expiry_time != 0 && test_bit(CACHE_VALID, &h->flags));
193} 207}
194 208
195extern int cache_check(struct cache_detail *detail, 209extern int cache_check(struct cache_detail *detail,
@@ -250,31 +264,30 @@ static inline int get_uint(char **bpp, unsigned int *anint)
250 return 0; 264 return 0;
251} 265}
252 266
253/* 267static inline int get_time(char **bpp, time_t *time)
254 * timestamps kept in the cache are expressed in seconds
255 * since boot. This is the best for measuring differences in
256 * real time.
257 */
258static inline time_t seconds_since_boot(void)
259{ 268{
260 struct timespec boot; 269 char buf[50];
261 getboottime(&boot); 270 long long ll;
262 return get_seconds() - boot.tv_sec; 271 int len = qword_get(bpp, buf, sizeof(buf));
263}
264 272
265static inline time_t convert_to_wallclock(time_t sinceboot) 273 if (len < 0)
266{ 274 return -EINVAL;
267 struct timespec boot; 275 if (len == 0)
268 getboottime(&boot); 276 return -ENOENT;
269 return boot.tv_sec + sinceboot; 277
278 if (kstrtoll(buf, 0, &ll))
279 return -EINVAL;
280
281 *time = (time_t)ll;
282 return 0;
270} 283}
271 284
272static inline time_t get_expiry(char **bpp) 285static inline time_t get_expiry(char **bpp)
273{ 286{
274 int rv; 287 time_t rv;
275 struct timespec boot; 288 struct timespec boot;
276 289
277 if (get_int(bpp, &rv)) 290 if (get_time(bpp, &rv))
278 return 0; 291 return 0;
279 if (rv < 0) 292 if (rv < 0)
280 return 0; 293 return 0;
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index bfe11be81f6f..6740801aa71a 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -21,6 +21,7 @@
21#include <linux/sunrpc/stats.h> 21#include <linux/sunrpc/stats.h>
22#include <linux/sunrpc/xdr.h> 22#include <linux/sunrpc/xdr.h>
23#include <linux/sunrpc/timer.h> 23#include <linux/sunrpc/timer.h>
24#include <linux/sunrpc/rpc_pipe_fs.h>
24#include <asm/signal.h> 25#include <asm/signal.h>
25#include <linux/path.h> 26#include <linux/path.h>
26#include <net/ipv6.h> 27#include <net/ipv6.h>
@@ -32,6 +33,7 @@ struct rpc_inode;
32 */ 33 */
33struct rpc_clnt { 34struct rpc_clnt {
34 atomic_t cl_count; /* Number of references */ 35 atomic_t cl_count; /* Number of references */
36 unsigned int cl_clid; /* client id */
35 struct list_head cl_clients; /* Global list of clients */ 37 struct list_head cl_clients; /* Global list of clients */
36 struct list_head cl_tasks; /* List of tasks */ 38 struct list_head cl_tasks; /* List of tasks */
37 spinlock_t cl_lock; /* spinlock */ 39 spinlock_t cl_lock; /* spinlock */
@@ -41,7 +43,6 @@ struct rpc_clnt {
41 cl_vers, /* RPC version number */ 43 cl_vers, /* RPC version number */
42 cl_maxproc; /* max procedure number */ 44 cl_maxproc; /* max procedure number */
43 45
44 const char * cl_protname; /* protocol name */
45 struct rpc_auth * cl_auth; /* authenticator */ 46 struct rpc_auth * cl_auth; /* authenticator */
46 struct rpc_stat * cl_stats; /* per-program statistics */ 47 struct rpc_stat * cl_stats; /* per-program statistics */
47 struct rpc_iostats * cl_metrics; /* per-client statistics */ 48 struct rpc_iostats * cl_metrics; /* per-client statistics */
@@ -56,12 +57,11 @@ struct rpc_clnt {
56 57
57 int cl_nodelen; /* nodename length */ 58 int cl_nodelen; /* nodename length */
58 char cl_nodename[UNX_MAXNODENAME]; 59 char cl_nodename[UNX_MAXNODENAME];
59 struct dentry * cl_dentry; 60 struct rpc_pipe_dir_head cl_pipedir_objects;
60 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 61 struct rpc_clnt * cl_parent; /* Points to parent of clones */
61 struct rpc_rtt cl_rtt_default; 62 struct rpc_rtt cl_rtt_default;
62 struct rpc_timeout cl_timeout_default; 63 struct rpc_timeout cl_timeout_default;
63 const struct rpc_program *cl_program; 64 const struct rpc_program *cl_program;
64 char *cl_principal; /* target to authenticate to */
65}; 65};
66 66
67/* 67/*
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 161463e59624..1f911ccb2a75 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -151,6 +151,8 @@ struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
151/* Fill in an array with a list of supported pseudoflavors */ 151/* Fill in an array with a list of supported pseudoflavors */
152int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int); 152int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int);
153 153
154struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
155
154/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a 156/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a
155 * corresponding call to gss_mech_put. */ 157 * corresponding call to gss_mech_put. */
156void gss_mech_put(struct gss_api_mech *); 158void gss_mech_put(struct gss_api_mech *);
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index a7b422b33eda..a353e0300b54 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -5,6 +5,26 @@
5 5
6#include <linux/workqueue.h> 6#include <linux/workqueue.h>
7 7
8struct rpc_pipe_dir_head {
9 struct list_head pdh_entries;
10 struct dentry *pdh_dentry;
11};
12
13struct rpc_pipe_dir_object_ops;
14struct rpc_pipe_dir_object {
15 struct list_head pdo_head;
16 const struct rpc_pipe_dir_object_ops *pdo_ops;
17
18 void *pdo_data;
19};
20
21struct rpc_pipe_dir_object_ops {
22 int (*create)(struct dentry *dir,
23 struct rpc_pipe_dir_object *pdo);
24 void (*destroy)(struct dentry *dir,
25 struct rpc_pipe_dir_object *pdo);
26};
27
8struct rpc_pipe_msg { 28struct rpc_pipe_msg {
9 struct list_head list; 29 struct list_head list;
10 void *data; 30 void *data;
@@ -73,12 +93,29 @@ extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *,
73extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *); 93extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *);
74 94
75struct rpc_clnt; 95struct rpc_clnt;
76extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *); 96extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *);
77extern int rpc_remove_client_dir(struct dentry *); 97extern int rpc_remove_client_dir(struct rpc_clnt *);
98
99extern void rpc_init_pipe_dir_head(struct rpc_pipe_dir_head *pdh);
100extern void rpc_init_pipe_dir_object(struct rpc_pipe_dir_object *pdo,
101 const struct rpc_pipe_dir_object_ops *pdo_ops,
102 void *pdo_data);
103extern int rpc_add_pipe_dir_object(struct net *net,
104 struct rpc_pipe_dir_head *pdh,
105 struct rpc_pipe_dir_object *pdo);
106extern void rpc_remove_pipe_dir_object(struct net *net,
107 struct rpc_pipe_dir_head *pdh,
108 struct rpc_pipe_dir_object *pdo);
109extern struct rpc_pipe_dir_object *rpc_find_or_alloc_pipe_dir_object(
110 struct net *net,
111 struct rpc_pipe_dir_head *pdh,
112 int (*match)(struct rpc_pipe_dir_object *, void *),
113 struct rpc_pipe_dir_object *(*alloc)(void *),
114 void *data);
78 115
79struct cache_detail; 116struct cache_detail;
80extern struct dentry *rpc_create_cache_dir(struct dentry *, 117extern struct dentry *rpc_create_cache_dir(struct dentry *,
81 struct qstr *, 118 const char *,
82 umode_t umode, 119 umode_t umode,
83 struct cache_detail *); 120 struct cache_detail *);
84extern void rpc_remove_cache_dir(struct dentry *); 121extern void rpc_remove_cache_dir(struct dentry *);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 84ca436b76c2..096ee58be11a 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -79,7 +79,7 @@ struct rpc_task {
79 unsigned short tk_flags; /* misc flags */ 79 unsigned short tk_flags; /* misc flags */
80 unsigned short tk_timeouts; /* maj timeouts */ 80 unsigned short tk_timeouts; /* maj timeouts */
81 81
82#ifdef RPC_DEBUG 82#if defined(RPC_DEBUG) || defined(RPC_TRACEPOINTS)
83 unsigned short tk_pid; /* debugging aid */ 83 unsigned short tk_pid; /* debugging aid */
84#endif 84#endif
85 unsigned char tk_priority : 2,/* Task priority */ 85 unsigned char tk_priority : 2,/* Task priority */
@@ -88,15 +88,6 @@ struct rpc_task {
88 tk_rebind_retry : 2; 88 tk_rebind_retry : 2;
89}; 89};
90 90
91/* support walking a list of tasks on a wait queue */
92#define task_for_each(task, pos, head) \
93 list_for_each(pos, head) \
94 if ((task=list_entry(pos, struct rpc_task, u.tk_wait.list)),1)
95
96#define task_for_first(task, head) \
97 if (!list_empty(head) && \
98 ((task=list_entry((head)->next, struct rpc_task, u.tk_wait.list)),1))
99
100typedef void (*rpc_action)(struct rpc_task *); 91typedef void (*rpc_action)(struct rpc_task *);
101 92
102struct rpc_call_ops { 93struct rpc_call_ops {
@@ -130,6 +121,7 @@ struct rpc_task_setup {
130#define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */ 121#define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */
131#define RPC_TASK_SENT 0x0800 /* message was sent */ 122#define RPC_TASK_SENT 0x0800 /* message was sent */
132#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ 123#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */
124#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */
133 125
134#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 126#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
135#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 127#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
@@ -238,7 +230,6 @@ struct rpc_task *rpc_wake_up_first(struct rpc_wait_queue *,
238 bool (*)(struct rpc_task *, void *), 230 bool (*)(struct rpc_task *, void *),
239 void *); 231 void *);
240void rpc_wake_up_status(struct rpc_wait_queue *, int); 232void rpc_wake_up_status(struct rpc_wait_queue *, int);
241int rpc_queue_empty(struct rpc_wait_queue *);
242void rpc_delay(struct rpc_task *, unsigned long); 233void rpc_delay(struct rpc_task *, unsigned long);
243void * rpc_malloc(struct rpc_task *, size_t); 234void * rpc_malloc(struct rpc_task *, size_t);
244void rpc_free(void *); 235void rpc_free(void *);
@@ -259,16 +250,6 @@ static inline int rpc_wait_for_completion_task(struct rpc_task *task)
259 return __rpc_wait_for_completion_task(task, NULL); 250 return __rpc_wait_for_completion_task(task, NULL);
260} 251}
261 252
262static inline void rpc_task_set_priority(struct rpc_task *task, unsigned char prio)
263{
264 task->tk_priority = prio - RPC_PRIORITY_LOW;
265}
266
267static inline int rpc_task_has_priority(struct rpc_task *task, unsigned char prio)
268{
269 return (task->tk_priority + RPC_PRIORITY_LOW == prio);
270}
271
272#if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS) 253#if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS)
273static inline const char * rpc_qname(const struct rpc_wait_queue *q) 254static inline const char * rpc_qname(const struct rpc_wait_queue *q)
274{ 255{
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 1f0216b9a6c9..6eecfc2e4f98 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -243,7 +243,6 @@ struct svc_rqst {
243 struct xdr_buf rq_res; 243 struct xdr_buf rq_res;
244 struct page * rq_pages[RPCSVC_MAXPAGES]; 244 struct page * rq_pages[RPCSVC_MAXPAGES];
245 struct page * *rq_respages; /* points into rq_pages */ 245 struct page * *rq_respages; /* points into rq_pages */
246 int rq_resused; /* number of pages used for result */
247 struct page * *rq_next_page; /* next reply page to use */ 246 struct page * *rq_next_page; /* next reply page to use */
248 247
249 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */ 248 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index ff374ab30839..8d71d6577459 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -14,6 +14,7 @@
14#include <linux/string.h> 14#include <linux/string.h>
15#include <linux/sunrpc/msg_prot.h> 15#include <linux/sunrpc/msg_prot.h>
16#include <linux/sunrpc/cache.h> 16#include <linux/sunrpc/cache.h>
17#include <linux/sunrpc/gss_api.h>
17#include <linux/hash.h> 18#include <linux/hash.h>
18#include <linux/cred.h> 19#include <linux/cred.h>
19 20
@@ -23,13 +24,23 @@ struct svc_cred {
23 struct group_info *cr_group_info; 24 struct group_info *cr_group_info;
24 u32 cr_flavor; /* pseudoflavor */ 25 u32 cr_flavor; /* pseudoflavor */
25 char *cr_principal; /* for gss */ 26 char *cr_principal; /* for gss */
27 struct gss_api_mech *cr_gss_mech;
26}; 28};
27 29
30static inline void init_svc_cred(struct svc_cred *cred)
31{
32 cred->cr_group_info = NULL;
33 cred->cr_principal = NULL;
34 cred->cr_gss_mech = NULL;
35}
36
28static inline void free_svc_cred(struct svc_cred *cred) 37static inline void free_svc_cred(struct svc_cred *cred)
29{ 38{
30 if (cred->cr_group_info) 39 if (cred->cr_group_info)
31 put_group_info(cred->cr_group_info); 40 put_group_info(cred->cr_group_info);
32 kfree(cred->cr_principal); 41 kfree(cred->cr_principal);
42 gss_mech_put(cred->cr_gss_mech);
43 init_svc_cred(cred);
33} 44}
34 45
35struct svc_rqst; /* forward decl */ 46struct svc_rqst; /* forward decl */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index d4e3f16d5e89..f73cabf59012 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -363,6 +363,7 @@ extern bool pm_wakeup_pending(void);
363extern bool pm_get_wakeup_count(unsigned int *count, bool block); 363extern bool pm_get_wakeup_count(unsigned int *count, bool block);
364extern bool pm_save_wakeup_count(unsigned int count); 364extern bool pm_save_wakeup_count(unsigned int count);
365extern void pm_wakep_autosleep_enabled(bool set); 365extern void pm_wakep_autosleep_enabled(bool set);
366extern void pm_print_active_wakeup_sources(void);
366 367
367static inline void lock_system_sleep(void) 368static inline void lock_system_sleep(void)
368{ 369{
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 1701ce4be746..46ba0c6c219f 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -10,6 +10,7 @@
10#include <linux/node.h> 10#include <linux/node.h>
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/atomic.h> 12#include <linux/atomic.h>
13#include <linux/page-flags.h>
13#include <asm/page.h> 14#include <asm/page.h>
14 15
15struct notifier_block; 16struct notifier_block;
@@ -19,10 +20,13 @@ struct bio;
19#define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */ 20#define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */
20#define SWAP_FLAG_PRIO_MASK 0x7fff 21#define SWAP_FLAG_PRIO_MASK 0x7fff
21#define SWAP_FLAG_PRIO_SHIFT 0 22#define SWAP_FLAG_PRIO_SHIFT 0
22#define SWAP_FLAG_DISCARD 0x10000 /* discard swap cluster after use */ 23#define SWAP_FLAG_DISCARD 0x10000 /* enable discard for swap */
24#define SWAP_FLAG_DISCARD_ONCE 0x20000 /* discard swap area at swapon-time */
25#define SWAP_FLAG_DISCARD_PAGES 0x40000 /* discard page-clusters after use */
23 26
24#define SWAP_FLAGS_VALID (SWAP_FLAG_PRIO_MASK | SWAP_FLAG_PREFER | \ 27#define SWAP_FLAGS_VALID (SWAP_FLAG_PRIO_MASK | SWAP_FLAG_PREFER | \
25 SWAP_FLAG_DISCARD) 28 SWAP_FLAG_DISCARD | SWAP_FLAG_DISCARD_ONCE | \
29 SWAP_FLAG_DISCARD_PAGES)
26 30
27static inline int current_is_kswapd(void) 31static inline int current_is_kswapd(void)
28{ 32{
@@ -146,14 +150,16 @@ struct swap_extent {
146enum { 150enum {
147 SWP_USED = (1 << 0), /* is slot in swap_info[] used? */ 151 SWP_USED = (1 << 0), /* is slot in swap_info[] used? */
148 SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */ 152 SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */
149 SWP_DISCARDABLE = (1 << 2), /* swapon+blkdev support discard */ 153 SWP_DISCARDABLE = (1 << 2), /* blkdev support discard */
150 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */ 154 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
151 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */ 155 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
152 SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */ 156 SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */
153 SWP_BLKDEV = (1 << 6), /* its a block device */ 157 SWP_BLKDEV = (1 << 6), /* its a block device */
154 SWP_FILE = (1 << 7), /* set after swap_activate success */ 158 SWP_FILE = (1 << 7), /* set after swap_activate success */
159 SWP_AREA_DISCARD = (1 << 8), /* single-time swap area discards */
160 SWP_PAGE_DISCARD = (1 << 9), /* freed swap page-cluster discards */
155 /* add others here before... */ 161 /* add others here before... */
156 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ 162 SWP_SCANNING = (1 << 10), /* refcount in scan_swap_map */
157}; 163};
158 164
159#define SWAP_CLUSTER_MAX 32UL 165#define SWAP_CLUSTER_MAX 32UL
@@ -176,6 +182,33 @@ enum {
176#define SWAP_MAP_SHMEM 0xbf /* Owned by shmem/tmpfs, in first swap_map */ 182#define SWAP_MAP_SHMEM 0xbf /* Owned by shmem/tmpfs, in first swap_map */
177 183
178/* 184/*
185 * We use this to track usage of a cluster. A cluster is a block of swap disk
186 * space with SWAPFILE_CLUSTER pages long and naturally aligns in disk. All
187 * free clusters are organized into a list. We fetch an entry from the list to
188 * get a free cluster.
189 *
190 * The data field stores next cluster if the cluster is free or cluster usage
191 * counter otherwise. The flags field determines if a cluster is free. This is
192 * protected by swap_info_struct.lock.
193 */
194struct swap_cluster_info {
195 unsigned int data:24;
196 unsigned int flags:8;
197};
198#define CLUSTER_FLAG_FREE 1 /* This cluster is free */
199#define CLUSTER_FLAG_NEXT_NULL 2 /* This cluster has no next cluster */
200
201/*
202 * We assign a cluster to each CPU, so each CPU can allocate swap entry from
203 * its own cluster and swapout sequentially. The purpose is to optimize swapout
204 * throughput.
205 */
206struct percpu_cluster {
207 struct swap_cluster_info index; /* Current cluster index */
208 unsigned int next; /* Likely next allocation offset */
209};
210
211/*
179 * The in-memory structure used to track swap areas. 212 * The in-memory structure used to track swap areas.
180 */ 213 */
181struct swap_info_struct { 214struct swap_info_struct {
@@ -185,14 +218,16 @@ struct swap_info_struct {
185 signed char next; /* next type on the swap list */ 218 signed char next; /* next type on the swap list */
186 unsigned int max; /* extent of the swap_map */ 219 unsigned int max; /* extent of the swap_map */
187 unsigned char *swap_map; /* vmalloc'ed array of usage counts */ 220 unsigned char *swap_map; /* vmalloc'ed array of usage counts */
221 struct swap_cluster_info *cluster_info; /* cluster info. Only for SSD */
222 struct swap_cluster_info free_cluster_head; /* free cluster list head */
223 struct swap_cluster_info free_cluster_tail; /* free cluster list tail */
188 unsigned int lowest_bit; /* index of first free in swap_map */ 224 unsigned int lowest_bit; /* index of first free in swap_map */
189 unsigned int highest_bit; /* index of last free in swap_map */ 225 unsigned int highest_bit; /* index of last free in swap_map */
190 unsigned int pages; /* total of usable pages of swap */ 226 unsigned int pages; /* total of usable pages of swap */
191 unsigned int inuse_pages; /* number of those currently in use */ 227 unsigned int inuse_pages; /* number of those currently in use */
192 unsigned int cluster_next; /* likely index for next allocation */ 228 unsigned int cluster_next; /* likely index for next allocation */
193 unsigned int cluster_nr; /* countdown to next cluster search */ 229 unsigned int cluster_nr; /* countdown to next cluster search */
194 unsigned int lowest_alloc; /* while preparing discard cluster */ 230 struct percpu_cluster __percpu *percpu_cluster; /* per cpu's swap location */
195 unsigned int highest_alloc; /* while preparing discard cluster */
196 struct swap_extent *curr_swap_extent; 231 struct swap_extent *curr_swap_extent;
197 struct swap_extent first_swap_extent; 232 struct swap_extent first_swap_extent;
198 struct block_device *bdev; /* swap device or bdev of swap file */ 233 struct block_device *bdev; /* swap device or bdev of swap file */
@@ -206,14 +241,18 @@ struct swap_info_struct {
206 * protect map scan related fields like 241 * protect map scan related fields like
207 * swap_map, lowest_bit, highest_bit, 242 * swap_map, lowest_bit, highest_bit,
208 * inuse_pages, cluster_next, 243 * inuse_pages, cluster_next,
209 * cluster_nr, lowest_alloc and 244 * cluster_nr, lowest_alloc,
210 * highest_alloc. other fields are only 245 * highest_alloc, free/discard cluster
211 * changed at swapon/swapoff, so are 246 * list. other fields are only changed
212 * protected by swap_lock. changing 247 * at swapon/swapoff, so are protected
213 * flags need hold this lock and 248 * by swap_lock. changing flags need
214 * swap_lock. If both locks need hold, 249 * hold this lock and swap_lock. If
215 * hold swap_lock first. 250 * both locks need hold, hold swap_lock
251 * first.
216 */ 252 */
253 struct work_struct discard_work; /* discard worker */
254 struct swap_cluster_info discard_cluster_head; /* list head of discard clusters */
255 struct swap_cluster_info discard_cluster_tail; /* list tail of discard clusters */
217}; 256};
218 257
219struct swap_list_t { 258struct swap_list_t {
@@ -233,15 +272,15 @@ extern unsigned long nr_free_pagecache_pages(void);
233 272
234 273
235/* linux/mm/swap.c */ 274/* linux/mm/swap.c */
236extern void __lru_cache_add(struct page *, enum lru_list lru); 275extern void __lru_cache_add(struct page *);
237extern void lru_cache_add_lru(struct page *, enum lru_list lru); 276extern void lru_cache_add(struct page *);
238extern void lru_add_page_tail(struct page *page, struct page *page_tail, 277extern void lru_add_page_tail(struct page *page, struct page *page_tail,
239 struct lruvec *lruvec, struct list_head *head); 278 struct lruvec *lruvec, struct list_head *head);
240extern void activate_page(struct page *); 279extern void activate_page(struct page *);
241extern void mark_page_accessed(struct page *); 280extern void mark_page_accessed(struct page *);
242extern void lru_add_drain(void); 281extern void lru_add_drain(void);
243extern void lru_add_drain_cpu(int cpu); 282extern void lru_add_drain_cpu(int cpu);
244extern int lru_add_drain_all(void); 283extern void lru_add_drain_all(void);
245extern void rotate_reclaimable_page(struct page *page); 284extern void rotate_reclaimable_page(struct page *page);
246extern void deactivate_page(struct page *page); 285extern void deactivate_page(struct page *page);
247extern void swap_setup(void); 286extern void swap_setup(void);
@@ -254,12 +293,14 @@ extern void add_page_to_unevictable_list(struct page *page);
254 */ 293 */
255static inline void lru_cache_add_anon(struct page *page) 294static inline void lru_cache_add_anon(struct page *page)
256{ 295{
257 __lru_cache_add(page, LRU_INACTIVE_ANON); 296 ClearPageActive(page);
297 __lru_cache_add(page);
258} 298}
259 299
260static inline void lru_cache_add_file(struct page *page) 300static inline void lru_cache_add_file(struct page *page)
261{ 301{
262 __lru_cache_add(page, LRU_INACTIVE_FILE); 302 ClearPageActive(page);
303 __lru_cache_add(page);
263} 304}
264 305
265/* linux/mm/vmscan.c */ 306/* linux/mm/vmscan.c */
@@ -406,6 +447,7 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
406 447
407#else /* CONFIG_SWAP */ 448#else /* CONFIG_SWAP */
408 449
450#define swap_address_space(entry) (NULL)
409#define get_nr_swap_pages() 0L 451#define get_nr_swap_pages() 0L
410#define total_swap_pages 0L 452#define total_swap_pages 0L
411#define total_swapcache_pages() 0UL 453#define total_swapcache_pages() 0UL
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 47ead515c811..8d4fa82bfb91 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -67,6 +67,8 @@ static inline swp_entry_t pte_to_swp_entry(pte_t pte)
67 swp_entry_t arch_entry; 67 swp_entry_t arch_entry;
68 68
69 BUG_ON(pte_file(pte)); 69 BUG_ON(pte_file(pte));
70 if (pte_swp_soft_dirty(pte))
71 pte = pte_swp_clear_soft_dirty(pte);
70 arch_entry = __pte_to_swp_entry(pte); 72 arch_entry = __pte_to_swp_entry(pte);
71 return swp_entry(__swp_type(arch_entry), __swp_offset(arch_entry)); 73 return swp_entry(__swp_type(arch_entry), __swp_offset(arch_entry));
72} 74}
@@ -137,6 +139,7 @@ static inline void make_migration_entry_read(swp_entry_t *entry)
137 139
138extern void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, 140extern void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
139 unsigned long address); 141 unsigned long address);
142extern void migration_entry_wait_huge(struct mm_struct *mm, pte_t *pte);
140#else 143#else
141 144
142#define make_migration_entry(page, write) swp_entry(0, 0) 145#define make_migration_entry(page, write) swp_entry(0, 0)
@@ -148,6 +151,8 @@ static inline int is_migration_entry(swp_entry_t swp)
148static inline void make_migration_entry_read(swp_entry_t *entryp) { } 151static inline void make_migration_entry_read(swp_entry_t *entryp) { }
149static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, 152static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
150 unsigned long address) { } 153 unsigned long address) { }
154static inline void migration_entry_wait_huge(struct mm_struct *mm,
155 pte_t *pte) { }
151static inline int is_write_migration_entry(swp_entry_t entry) 156static inline int is_write_migration_entry(swp_entry_t entry)
152{ 157{
153 return 0; 158 return 0;
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 4147d700a293..7fac04e7ff6e 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -186,6 +186,7 @@ extern struct trace_event_functions exit_syscall_print_funcs;
186#define __SYSCALL_DEFINEx(x, name, ...) \ 186#define __SYSCALL_DEFINEx(x, name, ...) \
187 asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ 187 asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
188 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ 188 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
189 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
189 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ 190 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
190 { \ 191 { \
191 long ret = SYSC##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \ 192 long ret = SYSC##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \
@@ -802,9 +803,14 @@ asmlinkage long sys_vfork(void);
802asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, int, 803asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, int,
803 int __user *); 804 int __user *);
804#else 805#else
806#ifdef CONFIG_CLONE_BACKWARDS3
807asmlinkage long sys_clone(unsigned long, unsigned long, int, int __user *,
808 int __user *, int);
809#else
805asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, 810asmlinkage long sys_clone(unsigned long, unsigned long, int __user *,
806 int __user *, int); 811 int __user *, int);
807#endif 812#endif
813#endif
808 814
809asmlinkage long sys_execve(const char __user *filename, 815asmlinkage long sys_execve(const char __user *filename,
810 const char __user *const __user *argv, 816 const char __user *const __user *argv,
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index e2cee22f578a..11baec7c9b26 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -17,10 +17,12 @@
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/lockdep.h> 18#include <linux/lockdep.h>
19#include <linux/kobject_ns.h> 19#include <linux/kobject_ns.h>
20#include <linux/stat.h>
20#include <linux/atomic.h> 21#include <linux/atomic.h>
21 22
22struct kobject; 23struct kobject;
23struct module; 24struct module;
25struct bin_attribute;
24enum kobj_ns_type; 26enum kobj_ns_type;
25 27
26struct attribute { 28struct attribute {
@@ -49,9 +51,9 @@ do { \
49 static struct lock_class_key __key; \ 51 static struct lock_class_key __key; \
50 \ 52 \
51 (attr)->key = &__key; \ 53 (attr)->key = &__key; \
52} while(0) 54} while (0)
53#else 55#else
54#define sysfs_attr_init(attr) do {} while(0) 56#define sysfs_attr_init(attr) do {} while (0)
55#endif 57#endif
56 58
57struct attribute_group { 59struct attribute_group {
@@ -59,26 +61,33 @@ struct attribute_group {
59 umode_t (*is_visible)(struct kobject *, 61 umode_t (*is_visible)(struct kobject *,
60 struct attribute *, int); 62 struct attribute *, int);
61 struct attribute **attrs; 63 struct attribute **attrs;
64 struct bin_attribute **bin_attrs;
62}; 65};
63 66
64
65
66/** 67/**
67 * Use these macros to make defining attributes easier. See include/linux/device.h 68 * Use these macros to make defining attributes easier. See include/linux/device.h
68 * for examples.. 69 * for examples..
69 */ 70 */
70 71
71#define __ATTR(_name,_mode,_show,_store) { \ 72#define __ATTR(_name, _mode, _show, _store) { \
72 .attr = {.name = __stringify(_name), .mode = _mode }, \ 73 .attr = {.name = __stringify(_name), .mode = _mode }, \
73 .show = _show, \ 74 .show = _show, \
74 .store = _store, \ 75 .store = _store, \
76}
77
78#define __ATTR_RO(_name) { \
79 .attr = { .name = __stringify(_name), .mode = S_IRUGO }, \
80 .show = _name##_show, \
75} 81}
76 82
77#define __ATTR_RO(_name) { \ 83#define __ATTR_WO(_name) { \
78 .attr = { .name = __stringify(_name), .mode = 0444 }, \ 84 .attr = { .name = __stringify(_name), .mode = S_IWUSR }, \
79 .show = _name##_show, \ 85 .store = _name##_store, \
80} 86}
81 87
88#define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO), \
89 _name##_show, _name##_store)
90
82#define __ATTR_NULL { .attr = { .name = NULL } } 91#define __ATTR_NULL { .attr = { .name = NULL } }
83 92
84#ifdef CONFIG_DEBUG_LOCK_ALLOC 93#ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -92,7 +101,17 @@ struct attribute_group {
92#define __ATTR_IGNORE_LOCKDEP __ATTR 101#define __ATTR_IGNORE_LOCKDEP __ATTR
93#endif 102#endif
94 103
95#define attr_name(_attr) (_attr).attr.name 104#define __ATTRIBUTE_GROUPS(_name) \
105static const struct attribute_group *_name##_groups[] = { \
106 &_name##_group, \
107 NULL, \
108}
109
110#define ATTRIBUTE_GROUPS(_name) \
111static const struct attribute_group _name##_group = { \
112 .attrs = _name##_attrs, \
113}; \
114__ATTRIBUTE_GROUPS(_name)
96 115
97struct file; 116struct file;
98struct vm_area_struct; 117struct vm_area_struct;
@@ -103,7 +122,7 @@ struct bin_attribute {
103 void *private; 122 void *private;
104 ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, 123 ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *,
105 char *, loff_t, size_t); 124 char *, loff_t, size_t);
106 ssize_t (*write)(struct file *,struct kobject *, struct bin_attribute *, 125 ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *,
107 char *, loff_t, size_t); 126 char *, loff_t, size_t);
108 int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr, 127 int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr,
109 struct vm_area_struct *vma); 128 struct vm_area_struct *vma);
@@ -121,9 +140,39 @@ struct bin_attribute {
121 */ 140 */
122#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr) 141#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr)
123 142
143/* macros to create static binary attributes easier */
144#define __BIN_ATTR(_name, _mode, _read, _write, _size) { \
145 .attr = { .name = __stringify(_name), .mode = _mode }, \
146 .read = _read, \
147 .write = _write, \
148 .size = _size, \
149}
150
151#define __BIN_ATTR_RO(_name, _size) { \
152 .attr = { .name = __stringify(_name), .mode = S_IRUGO }, \
153 .read = _name##_read, \
154 .size = _size, \
155}
156
157#define __BIN_ATTR_RW(_name, _size) __BIN_ATTR(_name, \
158 (S_IWUSR | S_IRUGO), _name##_read, \
159 _name##_write, _size)
160
161#define __BIN_ATTR_NULL __ATTR_NULL
162
163#define BIN_ATTR(_name, _mode, _read, _write, _size) \
164struct bin_attribute bin_attr_##_name = __BIN_ATTR(_name, _mode, _read, \
165 _write, _size)
166
167#define BIN_ATTR_RO(_name, _size) \
168struct bin_attribute bin_attr_##_name = __BIN_ATTR_RO(_name, _size)
169
170#define BIN_ATTR_RW(_name, _size) \
171struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size)
172
124struct sysfs_ops { 173struct sysfs_ops {
125 ssize_t (*show)(struct kobject *, struct attribute *,char *); 174 ssize_t (*show)(struct kobject *, struct attribute *, char *);
126 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 175 ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t);
127 const void *(*namespace)(struct kobject *, const struct attribute *); 176 const void *(*namespace)(struct kobject *, const struct attribute *);
128}; 177};
129 178
@@ -169,10 +218,14 @@ void sysfs_delete_link(struct kobject *dir, struct kobject *targ,
169 218
170int __must_check sysfs_create_group(struct kobject *kobj, 219int __must_check sysfs_create_group(struct kobject *kobj,
171 const struct attribute_group *grp); 220 const struct attribute_group *grp);
221int __must_check sysfs_create_groups(struct kobject *kobj,
222 const struct attribute_group **groups);
172int sysfs_update_group(struct kobject *kobj, 223int sysfs_update_group(struct kobject *kobj,
173 const struct attribute_group *grp); 224 const struct attribute_group *grp);
174void sysfs_remove_group(struct kobject *kobj, 225void sysfs_remove_group(struct kobject *kobj,
175 const struct attribute_group *grp); 226 const struct attribute_group *grp);
227void sysfs_remove_groups(struct kobject *kobj,
228 const struct attribute_group **groups);
176int sysfs_add_file_to_group(struct kobject *kobj, 229int sysfs_add_file_to_group(struct kobject *kobj,
177 const struct attribute *attr, const char *group); 230 const struct attribute *attr, const char *group);
178void sysfs_remove_file_from_group(struct kobject *kobj, 231void sysfs_remove_file_from_group(struct kobject *kobj,
@@ -297,6 +350,12 @@ static inline int sysfs_create_group(struct kobject *kobj,
297 return 0; 350 return 0;
298} 351}
299 352
353static inline int sysfs_create_groups(struct kobject *kobj,
354 const struct attribute_group **groups)
355{
356 return 0;
357}
358
300static inline int sysfs_update_group(struct kobject *kobj, 359static inline int sysfs_update_group(struct kobject *kobj,
301 const struct attribute_group *grp) 360 const struct attribute_group *grp)
302{ 361{
@@ -308,6 +367,11 @@ static inline void sysfs_remove_group(struct kobject *kobj,
308{ 367{
309} 368}
310 369
370static inline void sysfs_remove_groups(struct kobject *kobj,
371 const struct attribute_group **groups)
372{
373}
374
311static inline int sysfs_add_file_to_group(struct kobject *kobj, 375static inline int sysfs_add_file_to_group(struct kobject *kobj,
312 const struct attribute *attr, const char *group) 376 const struct attribute *attr, const char *group)
313{ 377{
diff --git a/include/linux/syslog.h b/include/linux/syslog.h
index 38911391a139..98a3153c0f96 100644
--- a/include/linux/syslog.h
+++ b/include/linux/syslog.h
@@ -44,8 +44,8 @@
44/* Return size of the log buffer */ 44/* Return size of the log buffer */
45#define SYSLOG_ACTION_SIZE_BUFFER 10 45#define SYSLOG_ACTION_SIZE_BUFFER 10
46 46
47#define SYSLOG_FROM_CALL 0 47#define SYSLOG_FROM_READER 0
48#define SYSLOG_FROM_FILE 1 48#define SYSLOG_FROM_PROC 1
49 49
50int do_syslog(int type, char __user *buf, int count, bool from_file); 50int do_syslog(int type, char __user *buf, int count, bool from_file);
51 51
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 5adbc33d1ab3..d68633452d9b 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -107,7 +107,6 @@ static inline void tcp_clear_options(struct tcp_options_received *rx_opt)
107 * only four options will fit in a standard TCP header */ 107 * only four options will fit in a standard TCP header */
108#define TCP_NUM_SACKS 4 108#define TCP_NUM_SACKS 4
109 109
110struct tcp_cookie_values;
111struct tcp_request_sock_ops; 110struct tcp_request_sock_ops;
112 111
113struct tcp_request_sock { 112struct tcp_request_sock {
@@ -238,6 +237,7 @@ struct tcp_sock {
238 237
239 u32 rcv_wnd; /* Current receiver window */ 238 u32 rcv_wnd; /* Current receiver window */
240 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 239 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
240 u32 notsent_lowat; /* TCP_NOTSENT_LOWAT */
241 u32 pushed_seq; /* Last pushed seq, required to talk to windows */ 241 u32 pushed_seq; /* Last pushed seq, required to talk to windows */
242 u32 lost_out; /* Lost packets */ 242 u32 lost_out; /* Lost packets */
243 u32 sacked_out; /* SACK'd packets */ 243 u32 sacked_out; /* SACK'd packets */
@@ -246,7 +246,6 @@ struct tcp_sock {
246 246
247 /* from STCP, retrans queue hinting */ 247 /* from STCP, retrans queue hinting */
248 struct sk_buff* lost_skb_hint; 248 struct sk_buff* lost_skb_hint;
249 struct sk_buff *scoreboard_skb_hint;
250 struct sk_buff *retransmit_skb_hint; 249 struct sk_buff *retransmit_skb_hint;
251 250
252 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 251 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
diff --git a/include/linux/tegra-cpuidle.h b/include/linux/tegra-cpuidle.h
new file mode 100644
index 000000000000..9c6286bbf662
--- /dev/null
+++ b/include/linux/tegra-cpuidle.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright (c) 2013, 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
14#ifndef __LINUX_TEGRA_CPUIDLE_H__
15#define __LINUX_TEGRA_CPUIDLE_H__
16
17#ifdef CONFIG_CPU_IDLE
18void tegra_cpuidle_pcie_irqs_in_use(void);
19#else
20static inline void tegra_cpuidle_pcie_irqs_in_use(void)
21{
22}
23#endif
24
25#endif
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index a386a1cbb6e1..b268d3cf7ae3 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -207,6 +207,16 @@ struct thermal_bind_params {
207 * See Documentation/thermal/sysfs-api.txt for more information. 207 * See Documentation/thermal/sysfs-api.txt for more information.
208 */ 208 */
209 int trip_mask; 209 int trip_mask;
210
211 /*
212 * This is an array of cooling state limits. Must have exactly
213 * 2 * thermal_zone.number_of_trip_points. It is an array consisting
214 * of tuples <lower-state upper-state> of state limits. Each trip
215 * will be associated with one state limit tuple when binding.
216 * A NULL pointer means <THERMAL_NO_LIMITS THERMAL_NO_LIMITS>
217 * on all trips.
218 */
219 unsigned long *binding_limits;
210 int (*match) (struct thermal_zone_device *tz, 220 int (*match) (struct thermal_zone_device *tz,
211 struct thermal_cooling_device *cdev); 221 struct thermal_cooling_device *cdev);
212}; 222};
@@ -214,6 +224,14 @@ struct thermal_bind_params {
214/* Structure to define Thermal Zone parameters */ 224/* Structure to define Thermal Zone parameters */
215struct thermal_zone_params { 225struct thermal_zone_params {
216 char governor_name[THERMAL_NAME_LENGTH]; 226 char governor_name[THERMAL_NAME_LENGTH];
227
228 /*
229 * a boolean to indicate if the thermal to hwmon sysfs interface
230 * is required. when no_hwmon == false, a hwmon sysfs interface
231 * will be created. when no_hwmon == true, nothing will be done
232 */
233 bool no_hwmon;
234
217 int num_tbps; /* Number of tbp entries */ 235 int num_tbps; /* Number of tbp entries */
218 struct thermal_bind_params *tbp; 236 struct thermal_bind_params *tbp;
219}; 237};
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 9180f4b85e6d..5128d33bbb39 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -10,6 +10,8 @@
10#include <linux/irqflags.h> 10#include <linux/irqflags.h>
11#include <linux/percpu.h> 11#include <linux/percpu.h>
12#include <linux/hrtimer.h> 12#include <linux/hrtimer.h>
13#include <linux/context_tracking_state.h>
14#include <linux/cpumask.h>
13 15
14#ifdef CONFIG_GENERIC_CLOCKEVENTS 16#ifdef CONFIG_GENERIC_CLOCKEVENTS
15 17
@@ -158,26 +160,51 @@ static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
158# endif /* !CONFIG_NO_HZ_COMMON */ 160# endif /* !CONFIG_NO_HZ_COMMON */
159 161
160#ifdef CONFIG_NO_HZ_FULL 162#ifdef CONFIG_NO_HZ_FULL
163extern bool tick_nohz_full_running;
164extern cpumask_var_t tick_nohz_full_mask;
165
166static inline bool tick_nohz_full_enabled(void)
167{
168 if (!static_key_false(&context_tracking_enabled))
169 return false;
170
171 return tick_nohz_full_running;
172}
173
174static inline bool tick_nohz_full_cpu(int cpu)
175{
176 if (!tick_nohz_full_enabled())
177 return false;
178
179 return cpumask_test_cpu(cpu, tick_nohz_full_mask);
180}
181
161extern void tick_nohz_init(void); 182extern void tick_nohz_init(void);
162extern int tick_nohz_full_cpu(int cpu); 183extern void __tick_nohz_full_check(void);
163extern void tick_nohz_full_check(void);
164extern void tick_nohz_full_kick(void); 184extern void tick_nohz_full_kick(void);
165extern void tick_nohz_full_kick_all(void); 185extern void tick_nohz_full_kick_all(void);
166extern void tick_nohz_task_switch(struct task_struct *tsk); 186extern void __tick_nohz_task_switch(struct task_struct *tsk);
167#else 187#else
168static inline void tick_nohz_init(void) { } 188static inline void tick_nohz_init(void) { }
169static inline int tick_nohz_full_cpu(int cpu) { return 0; } 189static inline bool tick_nohz_full_enabled(void) { return false; }
170static inline void tick_nohz_full_check(void) { } 190static inline bool tick_nohz_full_cpu(int cpu) { return false; }
191static inline void __tick_nohz_full_check(void) { }
171static inline void tick_nohz_full_kick(void) { } 192static inline void tick_nohz_full_kick(void) { }
172static inline void tick_nohz_full_kick_all(void) { } 193static inline void tick_nohz_full_kick_all(void) { }
173static inline void tick_nohz_task_switch(struct task_struct *tsk) { } 194static inline void __tick_nohz_task_switch(struct task_struct *tsk) { }
174#endif 195#endif
175 196
197static inline void tick_nohz_full_check(void)
198{
199 if (tick_nohz_full_enabled())
200 __tick_nohz_full_check();
201}
202
203static inline void tick_nohz_task_switch(struct task_struct *tsk)
204{
205 if (tick_nohz_full_enabled())
206 __tick_nohz_task_switch(tsk);
207}
176 208
177# ifdef CONFIG_CPU_IDLE_GOV_MENU
178extern void menu_hrtimer_cancel(void);
179# else
180static inline void menu_hrtimer_cancel(void) {}
181# endif /* CONFIG_CPU_IDLE_GOV_MENU */
182 209
183#endif 210#endif
diff --git a/include/linux/time-armada-370-xp.h b/include/linux/time-armada-370-xp.h
deleted file mode 100644
index dfdfdc03115b..000000000000
--- a/include/linux/time-armada-370-xp.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * Marvell Armada 370/XP SoC timer handling.
3 *
4 * Copyright (C) 2012 Marvell
5 *
6 * Lior Amsalem <alior@marvell.com>
7 * Gregory CLEMENT <gregory.clement@free-electrons.com>
8 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
9 *
10 */
11#ifndef __TIME_ARMADA_370_XPPRCMU_H
12#define __TIME_ARMADA_370_XPPRCMU_H
13
14#include <linux/init.h>
15
16void __init armada_370_xp_timer_init(void);
17
18#endif
diff --git a/include/linux/timex.h b/include/linux/timex.h
index b3726e61368e..dd3edd7dfc94 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -141,6 +141,7 @@ extern int do_adjtimex(struct timex *);
141extern void hardpps(const struct timespec *, const struct timespec *); 141extern void hardpps(const struct timespec *, const struct timespec *);
142 142
143int read_current_timer(unsigned long *timer_val); 143int read_current_timer(unsigned long *timer_val);
144void ntp_notify_cmos_timer(void);
144 145
145/* The clock frequency of the i8253/i8254 PIT */ 146/* The clock frequency of the i8253/i8254 PIT */
146#define PIT_TICK_RATE 1193182ul 147#define PIT_TICK_RATE 1193182ul
diff --git a/include/linux/tpm.h b/include/linux/tpm.h
index fcb627ff8d3e..9a9051bb1a03 100644
--- a/include/linux/tpm.h
+++ b/include/linux/tpm.h
@@ -22,6 +22,8 @@
22#ifndef __LINUX_TPM_H__ 22#ifndef __LINUX_TPM_H__
23#define __LINUX_TPM_H__ 23#define __LINUX_TPM_H__
24 24
25#define TPM_DIGEST_SIZE 20 /* Max TPM v1.2 PCR size */
26
25/* 27/*
26 * Chip num is this value or a valid tpm idx 28 * Chip num is this value or a valid tpm idx
27 */ 29 */
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 2f322c38bd4d..ebeab360d851 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -145,8 +145,8 @@ static inline void tracepoint_synchronize_unregister(void)
145 TP_PROTO(data_proto), \ 145 TP_PROTO(data_proto), \
146 TP_ARGS(data_args), \ 146 TP_ARGS(data_args), \
147 TP_CONDITION(cond), \ 147 TP_CONDITION(cond), \
148 rcu_idle_exit(), \ 148 rcu_irq_enter(), \
149 rcu_idle_enter()); \ 149 rcu_irq_exit()); \
150 } 150 }
151#else 151#else
152#define __DECLARE_TRACE_RCU(name, proto, args, cond, data_proto, data_args) 152#define __DECLARE_TRACE_RCU(name, proto, args, cond, data_proto, data_args)
@@ -378,6 +378,8 @@ static inline void tracepoint_synchronize_unregister(void)
378#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) 378#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
379#define DEFINE_EVENT(template, name, proto, args) \ 379#define DEFINE_EVENT(template, name, proto, args) \
380 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) 380 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
381#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg)\
382 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
381#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ 383#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
382 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) 384 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
383#define DEFINE_EVENT_CONDITION(template, name, proto, \ 385#define DEFINE_EVENT_CONDITION(template, name, proto, \
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 8780bd2a272a..64f864651d86 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -10,6 +10,8 @@
10#include <linux/mutex.h> 10#include <linux/mutex.h>
11#include <linux/tty_flags.h> 11#include <linux/tty_flags.h>
12#include <uapi/linux/tty.h> 12#include <uapi/linux/tty.h>
13#include <linux/rwsem.h>
14#include <linux/llist.h>
13 15
14 16
15 17
@@ -29,9 +31,10 @@
29#define __DISABLED_CHAR '\0' 31#define __DISABLED_CHAR '\0'
30 32
31struct tty_buffer { 33struct tty_buffer {
32 struct tty_buffer *next; 34 union {
33 char *char_buf_ptr; 35 struct tty_buffer *next;
34 unsigned char *flag_buf_ptr; 36 struct llist_node free;
37 };
35 int used; 38 int used;
36 int size; 39 int size;
37 int commit; 40 int commit;
@@ -40,25 +43,25 @@ struct tty_buffer {
40 unsigned long data[0]; 43 unsigned long data[0];
41}; 44};
42 45
43/* 46static inline unsigned char *char_buf_ptr(struct tty_buffer *b, int ofs)
44 * We default to dicing tty buffer allocations to this many characters 47{
45 * in order to avoid multiple page allocations. We know the size of 48 return ((unsigned char *)b->data) + ofs;
46 * tty_buffer itself but it must also be taken into account that the 49}
47 * the buffer is 256 byte aligned. See tty_buffer_find for the allocation
48 * logic this must match
49 */
50
51#define TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF)
52 50
51static inline char *flag_buf_ptr(struct tty_buffer *b, int ofs)
52{
53 return (char *)char_buf_ptr(b, ofs) + b->size;
54}
53 55
54struct tty_bufhead { 56struct tty_bufhead {
55 struct work_struct work;
56 spinlock_t lock;
57 struct tty_buffer *head; /* Queue head */ 57 struct tty_buffer *head; /* Queue head */
58 struct work_struct work;
59 struct mutex lock;
60 atomic_t priority;
61 struct tty_buffer sentinel;
62 struct llist_head free; /* Free queue head */
63 atomic_t memory_used; /* In-use buffers excluding free list */
58 struct tty_buffer *tail; /* Active buffer */ 64 struct tty_buffer *tail; /* Active buffer */
59 struct tty_buffer *free; /* Free queue head */
60 int memory_used; /* Buffer space used excluding
61 free queue */
62}; 65};
63/* 66/*
64 * When a break, frame error, or parity error happens, these codes are 67 * When a break, frame error, or parity error happens, these codes are
@@ -199,9 +202,6 @@ struct tty_port {
199 wait_queue_head_t close_wait; /* Close waiters */ 202 wait_queue_head_t close_wait; /* Close waiters */
200 wait_queue_head_t delta_msr_wait; /* Modem status change */ 203 wait_queue_head_t delta_msr_wait; /* Modem status change */
201 unsigned long flags; /* TTY flags ASY_*/ 204 unsigned long flags; /* TTY flags ASY_*/
202 unsigned long iflags; /* TTYP_ internal flags */
203#define TTYP_FLUSHING 1 /* Flushing to ldisc in progress */
204#define TTYP_FLUSHPENDING 2 /* Queued buffer flush pending */
205 unsigned char console:1, /* port is a console */ 205 unsigned char console:1, /* port is a console */
206 low_latency:1; /* direct buffer flush */ 206 low_latency:1; /* direct buffer flush */
207 struct mutex mutex; /* Locking */ 207 struct mutex mutex; /* Locking */
@@ -238,14 +238,16 @@ struct tty_struct {
238 int index; 238 int index;
239 239
240 /* Protects ldisc changes: Lock tty not pty */ 240 /* Protects ldisc changes: Lock tty not pty */
241 struct mutex ldisc_mutex; 241 struct ld_semaphore ldisc_sem;
242 struct tty_ldisc *ldisc; 242 struct tty_ldisc *ldisc;
243 243
244 struct mutex atomic_write_lock; 244 struct mutex atomic_write_lock;
245 struct mutex legacy_mutex; 245 struct mutex legacy_mutex;
246 struct mutex termios_mutex; 246 struct mutex throttle_mutex;
247 struct rw_semaphore termios_rwsem;
248 struct mutex winsize_mutex;
247 spinlock_t ctrl_lock; 249 spinlock_t ctrl_lock;
248 /* Termios values are protected by the termios mutex */ 250 /* Termios values are protected by the termios rwsem */
249 struct ktermios termios, termios_locked; 251 struct ktermios termios, termios_locked;
250 struct termiox *termiox; /* May be NULL for unsupported */ 252 struct termiox *termiox; /* May be NULL for unsupported */
251 char name[64]; 253 char name[64];
@@ -253,7 +255,7 @@ struct tty_struct {
253 struct pid *session; 255 struct pid *session;
254 unsigned long flags; 256 unsigned long flags;
255 int count; 257 int count;
256 struct winsize winsize; /* termios mutex */ 258 struct winsize winsize; /* winsize_mutex */
257 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 259 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
258 unsigned char ctrl_status; /* ctrl_lock */ 260 unsigned char ctrl_status; /* ctrl_lock */
259 unsigned int receive_room; /* Bytes free for queue */ 261 unsigned int receive_room; /* Bytes free for queue */
@@ -272,7 +274,6 @@ struct tty_struct {
272#define N_TTY_BUF_SIZE 4096 274#define N_TTY_BUF_SIZE 4096
273 275
274 unsigned char closing:1; 276 unsigned char closing:1;
275 unsigned short minimum_to_wake;
276 unsigned char *write_buf; 277 unsigned char *write_buf;
277 int write_cnt; 278 int write_cnt;
278 /* If the tty has a pending do_SAK, queue it here - akpm */ 279 /* If the tty has a pending do_SAK, queue it here - akpm */
@@ -304,13 +305,8 @@ struct tty_file_private {
304#define TTY_EXCLUSIVE 3 /* Exclusive open mode */ 305#define TTY_EXCLUSIVE 3 /* Exclusive open mode */
305#define TTY_DEBUG 4 /* Debugging */ 306#define TTY_DEBUG 4 /* Debugging */
306#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ 307#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */
307#define TTY_PUSH 6 /* n_tty private */
308#define TTY_CLOSING 7 /* ->close() in progress */ 308#define TTY_CLOSING 7 /* ->close() in progress */
309#define TTY_LDISC 9 /* Line discipline attached */
310#define TTY_LDISC_CHANGING 10 /* Line discipline changing */
311#define TTY_LDISC_OPEN 11 /* Line discipline is open */ 309#define TTY_LDISC_OPEN 11 /* Line discipline is open */
312#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */
313#define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */
314#define TTY_PTY_LOCK 16 /* pty private */ 310#define TTY_PTY_LOCK 16 /* pty private */
315#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 311#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
316#define TTY_HUPPED 18 /* Post driver->hangup() */ 312#define TTY_HUPPED 18 /* Post driver->hangup() */
@@ -562,6 +558,19 @@ extern void tty_ldisc_init(struct tty_struct *tty);
562extern void tty_ldisc_deinit(struct tty_struct *tty); 558extern void tty_ldisc_deinit(struct tty_struct *tty);
563extern void tty_ldisc_begin(void); 559extern void tty_ldisc_begin(void);
564 560
561static inline int tty_ldisc_receive_buf(struct tty_ldisc *ld, unsigned char *p,
562 char *f, int count)
563{
564 if (ld->ops->receive_buf2)
565 count = ld->ops->receive_buf2(ld->tty, p, f, count);
566 else {
567 count = min_t(int, count, ld->tty->receive_room);
568 if (count)
569 ld->ops->receive_buf(ld->tty, p, f, count);
570 }
571 return count;
572}
573
565 574
566/* n_tty.c */ 575/* n_tty.c */
567extern struct tty_ldisc_ops tty_ldisc_N_TTY; 576extern struct tty_ldisc_ops tty_ldisc_N_TTY;
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index e0f252633b47..21ddd7d9ea1f 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_TTY_FLIP_H 1#ifndef _LINUX_TTY_FLIP_H
2#define _LINUX_TTY_FLIP_H 2#define _LINUX_TTY_FLIP_H
3 3
4extern int tty_buffer_space_avail(struct tty_port *port);
4extern int tty_buffer_request_room(struct tty_port *port, size_t size); 5extern int tty_buffer_request_room(struct tty_port *port, size_t size);
5extern int tty_insert_flip_string_flags(struct tty_port *port, 6extern int tty_insert_flip_string_flags(struct tty_port *port,
6 const unsigned char *chars, const char *flags, size_t size); 7 const unsigned char *chars, const char *flags, size_t size);
@@ -18,8 +19,8 @@ static inline int tty_insert_flip_char(struct tty_port *port,
18{ 19{
19 struct tty_buffer *tb = port->buf.tail; 20 struct tty_buffer *tb = port->buf.tail;
20 if (tb && tb->used < tb->size) { 21 if (tb && tb->used < tb->size) {
21 tb->flag_buf_ptr[tb->used] = flag; 22 *flag_buf_ptr(tb, tb->used) = flag;
22 tb->char_buf_ptr[tb->used++] = ch; 23 *char_buf_ptr(tb, tb->used++) = ch;
23 return 1; 24 return 1;
24 } 25 }
25 return tty_insert_flip_string_flags(port, &ch, &flag, 1); 26 return tty_insert_flip_string_flags(port, &ch, &flag, 1);
@@ -31,4 +32,7 @@ static inline int tty_insert_flip_string(struct tty_port *port,
31 return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size); 32 return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size);
32} 33}
33 34
35extern void tty_buffer_lock_exclusive(struct tty_port *port);
36extern void tty_buffer_unlock_exclusive(struct tty_port *port);
37
34#endif /* _LINUX_TTY_FLIP_H */ 38#endif /* _LINUX_TTY_FLIP_H */
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 58390c73df8b..f15c898ff462 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -100,16 +100,78 @@
100 * seek to perform this action quickly but should wait until 100 * seek to perform this action quickly but should wait until
101 * any pending driver I/O is completed. 101 * any pending driver I/O is completed.
102 * 102 *
103 * void (*fasync)(struct tty_struct *, int on)
104 *
105 * Notify line discipline when signal-driven I/O is enabled or
106 * disabled.
107 *
103 * void (*dcd_change)(struct tty_struct *tty, unsigned int status) 108 * void (*dcd_change)(struct tty_struct *tty, unsigned int status)
104 * 109 *
105 * Tells the discipline that the DCD pin has changed its status. 110 * Tells the discipline that the DCD pin has changed its status.
106 * Used exclusively by the N_PPS (Pulse-Per-Second) line discipline. 111 * Used exclusively by the N_PPS (Pulse-Per-Second) line discipline.
112 *
113 * int (*receive_buf2)(struct tty_struct *, const unsigned char *cp,
114 * char *fp, int count);
115 *
116 * This function is called by the low-level tty driver to send
117 * characters received by the hardware to the line discpline for
118 * processing. <cp> is a pointer to the buffer of input
119 * character received by the device. <fp> is a pointer to a
120 * pointer of flag bytes which indicate whether a character was
121 * received with a parity error, etc.
122 * If assigned, prefer this function for automatic flow control.
107 */ 123 */
108 124
109#include <linux/fs.h> 125#include <linux/fs.h>
110#include <linux/wait.h> 126#include <linux/wait.h>
111#include <linux/wait.h> 127#include <linux/wait.h>
112 128
129
130/*
131 * the semaphore definition
132 */
133struct ld_semaphore {
134 long count;
135 raw_spinlock_t wait_lock;
136 unsigned int wait_readers;
137 struct list_head read_wait;
138 struct list_head write_wait;
139#ifdef CONFIG_DEBUG_LOCK_ALLOC
140 struct lockdep_map dep_map;
141#endif
142};
143
144extern void __init_ldsem(struct ld_semaphore *sem, const char *name,
145 struct lock_class_key *key);
146
147#define init_ldsem(sem) \
148do { \
149 static struct lock_class_key __key; \
150 \
151 __init_ldsem((sem), #sem, &__key); \
152} while (0)
153
154
155extern int ldsem_down_read(struct ld_semaphore *sem, long timeout);
156extern int ldsem_down_read_trylock(struct ld_semaphore *sem);
157extern int ldsem_down_write(struct ld_semaphore *sem, long timeout);
158extern int ldsem_down_write_trylock(struct ld_semaphore *sem);
159extern void ldsem_up_read(struct ld_semaphore *sem);
160extern void ldsem_up_write(struct ld_semaphore *sem);
161
162#ifdef CONFIG_DEBUG_LOCK_ALLOC
163extern int ldsem_down_read_nested(struct ld_semaphore *sem, int subclass,
164 long timeout);
165extern int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass,
166 long timeout);
167#else
168# define ldsem_down_read_nested(sem, subclass, timeout) \
169 ldsem_down_read(sem, timeout)
170# define ldsem_down_write_nested(sem, subclass, timeout) \
171 ldsem_down_write(sem, timeout)
172#endif
173
174
113struct tty_ldisc_ops { 175struct tty_ldisc_ops {
114 int magic; 176 int magic;
115 char *name; 177 char *name;
@@ -143,6 +205,9 @@ struct tty_ldisc_ops {
143 char *fp, int count); 205 char *fp, int count);
144 void (*write_wakeup)(struct tty_struct *); 206 void (*write_wakeup)(struct tty_struct *);
145 void (*dcd_change)(struct tty_struct *, unsigned int); 207 void (*dcd_change)(struct tty_struct *, unsigned int);
208 void (*fasync)(struct tty_struct *tty, int on);
209 int (*receive_buf2)(struct tty_struct *, const unsigned char *cp,
210 char *fp, int count);
146 211
147 struct module *owner; 212 struct module *owner;
148 213
@@ -151,8 +216,7 @@ struct tty_ldisc_ops {
151 216
152struct tty_ldisc { 217struct tty_ldisc {
153 struct tty_ldisc_ops *ops; 218 struct tty_ldisc_ops *ops;
154 atomic_t users; 219 struct tty_struct *tty;
155 wait_queue_head_t wq_idle;
156}; 220};
157 221
158#define TTY_LDISC_MAGIC 0x5403 222#define TTY_LDISC_MAGIC 0x5403
diff --git a/include/linux/usb.h b/include/linux/usb.h
index a0bee5a28d1a..001629cd1a97 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -337,6 +337,7 @@ struct usb_bus {
337 * the ep queue on a short transfer 337 * the ep queue on a short transfer
338 * with the URB_SHORT_NOT_OK flag set. 338 * with the URB_SHORT_NOT_OK flag set.
339 */ 339 */
340 unsigned no_sg_constraint:1; /* no sg constraint */
340 unsigned sg_tablesize; /* 0 or largest number of sg list entries */ 341 unsigned sg_tablesize; /* 0 or largest number of sg list entries */
341 342
342 int devnum_next; /* Next open device number in 343 int devnum_next; /* Next open device number in
@@ -367,17 +368,6 @@ struct usb_bus {
367 368
368/* ----------------------------------------------------------------------- */ 369/* ----------------------------------------------------------------------- */
369 370
370/* This is arbitrary.
371 * From USB 2.0 spec Table 11-13, offset 7, a hub can
372 * have up to 255 ports. The most yet reported is 10.
373 *
374 * Current Wireless USB host hardware (Intel i1480 for example) allows
375 * up to 22 devices to connect. Upcoming hardware might raise that
376 * limit. Because the arrays need to add a bit for hub status data, we
377 * do 31, so plus one evens out to four bytes.
378 */
379#define USB_MAXCHILDREN (31)
380
381struct usb_tt; 371struct usb_tt;
382 372
383enum usb_device_removable { 373enum usb_device_removable {
@@ -394,6 +384,22 @@ enum usb_port_connect_type {
394}; 384};
395 385
396/* 386/*
387 * USB 2.0 Link Power Management (LPM) parameters.
388 */
389struct usb2_lpm_parameters {
390 /* Best effort service latency indicate how long the host will drive
391 * resume on an exit from L1.
392 */
393 unsigned int besl;
394
395 /* Timeout value in microseconds for the L1 inactivity (LPM) timer.
396 * When the timer counts to zero, the parent hub will initiate a LPM
397 * transition to L1.
398 */
399 int timeout;
400};
401
402/*
397 * USB 3.0 Link Power Management (LPM) parameters. 403 * USB 3.0 Link Power Management (LPM) parameters.
398 * 404 *
399 * PEL and SEL are USB 3.0 Link PM latencies for device-initiated LPM exit. 405 * PEL and SEL are USB 3.0 Link PM latencies for device-initiated LPM exit.
@@ -468,6 +474,7 @@ struct usb3_lpm_parameters {
468 * @wusb: device is Wireless USB 474 * @wusb: device is Wireless USB
469 * @lpm_capable: device supports LPM 475 * @lpm_capable: device supports LPM
470 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM 476 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM
477 * @usb2_hw_lpm_besl_capable: device can perform USB2 hardware BESL LPM
471 * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled 478 * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled
472 * @usb3_lpm_enabled: USB3 hardware LPM enabled 479 * @usb3_lpm_enabled: USB3 hardware LPM enabled
473 * @string_langid: language ID for strings 480 * @string_langid: language ID for strings
@@ -487,6 +494,7 @@ struct usb3_lpm_parameters {
487 * specific data for the device. 494 * specific data for the device.
488 * @slot_id: Slot ID assigned by xHCI 495 * @slot_id: Slot ID assigned by xHCI
489 * @removable: Device can be physically removed from this port 496 * @removable: Device can be physically removed from this port
497 * @l1_params: best effor service latency for USB2 L1 LPM state, and L1 timeout.
490 * @u1_params: exit latencies for USB3 U1 LPM state, and hub-initiated timeout. 498 * @u1_params: exit latencies for USB3 U1 LPM state, and hub-initiated timeout.
491 * @u2_params: exit latencies for USB3 U2 LPM state, and hub-initiated timeout. 499 * @u2_params: exit latencies for USB3 U2 LPM state, and hub-initiated timeout.
492 * @lpm_disable_count: Ref count used by usb_disable_lpm() and usb_enable_lpm() 500 * @lpm_disable_count: Ref count used by usb_disable_lpm() and usb_enable_lpm()
@@ -538,6 +546,7 @@ struct usb_device {
538 unsigned wusb:1; 546 unsigned wusb:1;
539 unsigned lpm_capable:1; 547 unsigned lpm_capable:1;
540 unsigned usb2_hw_lpm_capable:1; 548 unsigned usb2_hw_lpm_capable:1;
549 unsigned usb2_hw_lpm_besl_capable:1;
541 unsigned usb2_hw_lpm_enabled:1; 550 unsigned usb2_hw_lpm_enabled:1;
542 unsigned usb3_lpm_enabled:1; 551 unsigned usb3_lpm_enabled:1;
543 int string_langid; 552 int string_langid;
@@ -566,6 +575,7 @@ struct usb_device {
566 struct wusb_dev *wusb_dev; 575 struct wusb_dev *wusb_dev;
567 int slot_id; 576 int slot_id;
568 enum usb_device_removable removable; 577 enum usb_device_removable removable;
578 struct usb2_lpm_parameters l1_params;
569 struct usb3_lpm_parameters u1_params; 579 struct usb3_lpm_parameters u1_params;
570 struct usb3_lpm_parameters u2_params; 580 struct usb3_lpm_parameters u2_params;
571 unsigned lpm_disable_count; 581 unsigned lpm_disable_count;
@@ -675,6 +685,11 @@ static inline bool usb_device_supports_ltm(struct usb_device *udev)
675 return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT; 685 return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT;
676} 686}
677 687
688static inline bool usb_device_no_sg_constraint(struct usb_device *udev)
689{
690 return udev && udev->bus && udev->bus->no_sg_constraint;
691}
692
678 693
679/*-------------------------------------------------------------------------*/ 694/*-------------------------------------------------------------------------*/
680 695
@@ -699,7 +714,10 @@ extern int usb_driver_claim_interface(struct usb_driver *driver,
699 * usb_interface_claimed - returns true iff an interface is claimed 714 * usb_interface_claimed - returns true iff an interface is claimed
700 * @iface: the interface being checked 715 * @iface: the interface being checked
701 * 716 *
702 * Returns true (nonzero) iff the interface is claimed, else false (zero). 717 * Return: %true (nonzero) iff the interface is claimed, else %false
718 * (zero).
719 *
720 * Note:
703 * Callers must own the driver model's usb bus readlock. So driver 721 * Callers must own the driver model's usb bus readlock. So driver
704 * probe() entries don't need extra locking, but other call contexts 722 * probe() entries don't need extra locking, but other call contexts
705 * may need to explicitly claim that lock. 723 * may need to explicitly claim that lock.
@@ -717,6 +735,7 @@ const struct usb_device_id *usb_match_id(struct usb_interface *interface,
717extern int usb_match_one_id(struct usb_interface *interface, 735extern int usb_match_one_id(struct usb_interface *interface,
718 const struct usb_device_id *id); 736 const struct usb_device_id *id);
719 737
738extern int usb_for_each_dev(void *data, int (*fn)(struct usb_device *, void *));
720extern struct usb_interface *usb_find_interface(struct usb_driver *drv, 739extern struct usb_interface *usb_find_interface(struct usb_driver *drv,
721 int minor); 740 int minor);
722extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev, 741extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev,
@@ -735,8 +754,9 @@ extern struct usb_host_interface *usb_find_alt_setting(
735 * @buf: where to put the string 754 * @buf: where to put the string
736 * @size: how big is "buf"? 755 * @size: how big is "buf"?
737 * 756 *
738 * Returns length of the string (> 0) or negative if size was too small. 757 * Return: Length of the string (> 0) or negative if size was too small.
739 * 758 *
759 * Note:
740 * This identifier is intended to be "stable", reflecting physical paths in 760 * This identifier is intended to be "stable", reflecting physical paths in
741 * hardware such as physical bus addresses for host controllers or ports on 761 * hardware such as physical bus addresses for host controllers or ports on
742 * USB hubs. That makes it stay the same until systems are physically 762 * USB hubs. That makes it stay the same until systems are physically
@@ -1237,7 +1257,9 @@ typedef void (*usb_complete_t)(struct urb *);
1237 * the device driver is saying that it provided this DMA address, 1257 * the device driver is saying that it provided this DMA address,
1238 * which the host controller driver should use in preference to the 1258 * which the host controller driver should use in preference to the
1239 * transfer_buffer. 1259 * transfer_buffer.
1240 * @sg: scatter gather buffer list 1260 * @sg: scatter gather buffer list, the buffer size of each element in
1261 * the list (except the last) must be divisible by the endpoint's
1262 * max packet size if no_sg_constraint isn't set in 'struct usb_bus'
1241 * @num_mapped_sgs: (internal) number of mapped sg entries 1263 * @num_mapped_sgs: (internal) number of mapped sg entries
1242 * @num_sgs: number of entries in the sg list 1264 * @num_sgs: number of entries in the sg list
1243 * @transfer_buffer_length: How big is transfer_buffer. The transfer may 1265 * @transfer_buffer_length: How big is transfer_buffer. The transfer may
@@ -1524,10 +1546,16 @@ static inline void usb_fill_int_urb(struct urb *urb,
1524 urb->transfer_buffer_length = buffer_length; 1546 urb->transfer_buffer_length = buffer_length;
1525 urb->complete = complete_fn; 1547 urb->complete = complete_fn;
1526 urb->context = context; 1548 urb->context = context;
1527 if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) 1549
1550 if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) {
1551 /* make sure interval is within allowed range */
1552 interval = clamp(interval, 1, 16);
1553
1528 urb->interval = 1 << (interval - 1); 1554 urb->interval = 1 << (interval - 1);
1529 else 1555 } else {
1530 urb->interval = interval; 1556 urb->interval = interval;
1557 }
1558
1531 urb->start_frame = -1; 1559 urb->start_frame = -1;
1532} 1560}
1533 1561
@@ -1560,7 +1588,7 @@ extern int usb_anchor_empty(struct usb_anchor *anchor);
1560 * usb_urb_dir_in - check if an URB describes an IN transfer 1588 * usb_urb_dir_in - check if an URB describes an IN transfer
1561 * @urb: URB to be checked 1589 * @urb: URB to be checked
1562 * 1590 *
1563 * Returns 1 if @urb describes an IN transfer (device-to-host), 1591 * Return: 1 if @urb describes an IN transfer (device-to-host),
1564 * otherwise 0. 1592 * otherwise 0.
1565 */ 1593 */
1566static inline int usb_urb_dir_in(struct urb *urb) 1594static inline int usb_urb_dir_in(struct urb *urb)
@@ -1572,7 +1600,7 @@ static inline int usb_urb_dir_in(struct urb *urb)
1572 * usb_urb_dir_out - check if an URB describes an OUT transfer 1600 * usb_urb_dir_out - check if an URB describes an OUT transfer
1573 * @urb: URB to be checked 1601 * @urb: URB to be checked
1574 * 1602 *
1575 * Returns 1 if @urb describes an OUT transfer (host-to-device), 1603 * Return: 1 if @urb describes an OUT transfer (host-to-device),
1576 * otherwise 0. 1604 * otherwise 0.
1577 */ 1605 */
1578static inline int usb_urb_dir_out(struct urb *urb) 1606static inline int usb_urb_dir_out(struct urb *urb)
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 544825dde823..7d399671a566 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -7,32 +7,38 @@
7 7
8#include <linux/usb/otg.h> 8#include <linux/usb/otg.h>
9 9
10struct ci13xxx; 10struct ci_hdrc;
11struct ci13xxx_platform_data { 11struct ci_hdrc_platform_data {
12 const char *name; 12 const char *name;
13 /* offset of the capability registers */ 13 /* offset of the capability registers */
14 uintptr_t capoffset; 14 uintptr_t capoffset;
15 unsigned power_budget; 15 unsigned power_budget;
16 struct usb_phy *phy; 16 struct usb_phy *phy;
17 enum usb_phy_interface phy_mode;
17 unsigned long flags; 18 unsigned long flags;
18#define CI13XXX_REGS_SHARED BIT(0) 19#define CI_HDRC_REGS_SHARED BIT(0)
19#define CI13XXX_REQUIRE_TRANSCEIVER BIT(1) 20#define CI_HDRC_REQUIRE_TRANSCEIVER BIT(1)
20#define CI13XXX_PULLUP_ON_VBUS BIT(2) 21#define CI_HDRC_DISABLE_STREAMING BIT(3)
21#define CI13XXX_DISABLE_STREAMING BIT(3) 22 /*
22 23 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1,
23#define CI13XXX_CONTROLLER_RESET_EVENT 0 24 * but otg is not supported (no register otgsc).
24#define CI13XXX_CONTROLLER_STOPPED_EVENT 1 25 */
25 void (*notify_event) (struct ci13xxx *ci, unsigned event); 26#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4)
27 enum usb_dr_mode dr_mode;
28#define CI_HDRC_CONTROLLER_RESET_EVENT 0
29#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
30 void (*notify_event) (struct ci_hdrc *ci, unsigned event);
31 struct regulator *reg_vbus;
26}; 32};
27 33
28/* Default offset of capability registers */ 34/* Default offset of capability registers */
29#define DEF_CAPOFFSET 0x100 35#define DEF_CAPOFFSET 0x100
30 36
31/* Add ci13xxx device */ 37/* Add ci hdrc device */
32struct platform_device *ci13xxx_add_device(struct device *dev, 38struct platform_device *ci_hdrc_add_device(struct device *dev,
33 struct resource *res, int nres, 39 struct resource *res, int nres,
34 struct ci13xxx_platform_data *platdata); 40 struct ci_hdrc_platform_data *platdata);
35/* Remove ci13xxx device */ 41/* Remove ci hdrc device */
36void ci13xxx_remove_device(struct platform_device *pdev); 42void ci_hdrc_remove_device(struct platform_device *pdev);
37 43
38#endif 44#endif
diff --git a/include/linux/usb/dwc3-omap.h b/include/linux/usb/dwc3-omap.h
deleted file mode 100644
index 5615f4d82724..000000000000
--- a/include/linux/usb/dwc3-omap.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * Copyright (C) 2013 by Texas Instruments
3 *
4 * The Inventra Controller Driver for Linux is free software; you
5 * can redistribute it and/or modify it under the terms of the GNU
6 * General Public License version 2 as published by the Free Software
7 * Foundation.
8 */
9
10#ifndef __DWC3_OMAP_H__
11#define __DWC3_OMAP_H__
12
13enum omap_dwc3_vbus_id_status {
14 OMAP_DWC3_UNKNOWN = 0,
15 OMAP_DWC3_ID_GROUND,
16 OMAP_DWC3_ID_FLOAT,
17 OMAP_DWC3_VBUS_VALID,
18 OMAP_DWC3_VBUS_OFF,
19};
20
21#if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE))
22extern int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status);
23#else
24static inline int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
25{
26 return -ENODEV;
27}
28#endif
29
30#endif /* __DWC3_OMAP_H__ */
diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h
index 99238b096f7e..7eb4dcd0d386 100644
--- a/include/linux/usb/ehci_pdriver.h
+++ b/include/linux/usb/ehci_pdriver.h
@@ -19,6 +19,9 @@
19#ifndef __USB_CORE_EHCI_PDRIVER_H 19#ifndef __USB_CORE_EHCI_PDRIVER_H
20#define __USB_CORE_EHCI_PDRIVER_H 20#define __USB_CORE_EHCI_PDRIVER_H
21 21
22struct platform_device;
23struct usb_hcd;
24
22/** 25/**
23 * struct usb_ehci_pdata - platform_data for generic ehci driver 26 * struct usb_ehci_pdata - platform_data for generic ehci driver
24 * 27 *
@@ -50,6 +53,7 @@ struct usb_ehci_pdata {
50 /* Turn on only VBUS suspend power and hotplug detection, 53 /* Turn on only VBUS suspend power and hotplug detection,
51 * turn off everything else */ 54 * turn off everything else */
52 void (*power_suspend)(struct platform_device *pdev); 55 void (*power_suspend)(struct platform_device *pdev);
56 int (*pre_setup)(struct usb_hcd *hcd);
53}; 57};
54 58
55#endif /* __USB_CORE_EHCI_PDRIVER_H */ 59#endif /* __USB_CORE_EHCI_PDRIVER_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index f1b0dca60f12..942ef5e053bf 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -22,6 +22,7 @@
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/scatterlist.h> 23#include <linux/scatterlist.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/workqueue.h>
25#include <linux/usb/ch9.h> 26#include <linux/usb/ch9.h>
26 27
27struct usb_ep; 28struct usb_ep;
@@ -475,6 +476,7 @@ struct usb_gadget_ops {
475 476
476/** 477/**
477 * struct usb_gadget - represents a usb slave device 478 * struct usb_gadget - represents a usb slave device
479 * @work: (internal use) Workqueue to be used for sysfs_notify()
478 * @ops: Function pointers used to access hardware-specific operations. 480 * @ops: Function pointers used to access hardware-specific operations.
479 * @ep0: Endpoint zero, used when reading or writing responses to 481 * @ep0: Endpoint zero, used when reading or writing responses to
480 * driver setup() requests 482 * driver setup() requests
@@ -520,6 +522,7 @@ struct usb_gadget_ops {
520 * device is acting as a B-Peripheral (so is_a_peripheral is false). 522 * device is acting as a B-Peripheral (so is_a_peripheral is false).
521 */ 523 */
522struct usb_gadget { 524struct usb_gadget {
525 struct work_struct work;
523 /* readonly to gadget driver */ 526 /* readonly to gadget driver */
524 const struct usb_gadget_ops *ops; 527 const struct usb_gadget_ops *ops;
525 struct usb_ep *ep0; 528 struct usb_ep *ep0;
@@ -538,6 +541,7 @@ struct usb_gadget {
538 unsigned out_epnum; 541 unsigned out_epnum;
539 unsigned in_epnum; 542 unsigned in_epnum;
540}; 543};
544#define work_to_gadget(w) (container_of((w), struct usb_gadget, work))
541 545
542static inline void set_gadget_data(struct usb_gadget *gadget, void *data) 546static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
543 { dev_set_drvdata(&gadget->dev, data); } 547 { dev_set_drvdata(&gadget->dev, data); }
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index f5f5c7dfda90..75efc45eaa2f 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -22,6 +22,7 @@
22#ifdef __KERNEL__ 22#ifdef __KERNEL__
23 23
24#include <linux/rwsem.h> 24#include <linux/rwsem.h>
25#include <linux/interrupt.h>
25 26
26#define MAX_TOPO_LEVEL 6 27#define MAX_TOPO_LEVEL 6
27 28
@@ -67,6 +68,13 @@
67 68
68/*-------------------------------------------------------------------------*/ 69/*-------------------------------------------------------------------------*/
69 70
71struct giveback_urb_bh {
72 bool running;
73 spinlock_t lock;
74 struct list_head head;
75 struct tasklet_struct bh;
76};
77
70struct usb_hcd { 78struct usb_hcd {
71 79
72 /* 80 /*
@@ -139,6 +147,9 @@ struct usb_hcd {
139 resource_size_t rsrc_len; /* memory/io resource length */ 147 resource_size_t rsrc_len; /* memory/io resource length */
140 unsigned power_budget; /* in mA, 0 = no limit */ 148 unsigned power_budget; /* in mA, 0 = no limit */
141 149
150 struct giveback_urb_bh high_prio_bh;
151 struct giveback_urb_bh low_prio_bh;
152
142 /* bandwidth_mutex should be taken before adding or removing 153 /* bandwidth_mutex should be taken before adding or removing
143 * any new bus bandwidth constraints: 154 * any new bus bandwidth constraints:
144 * 1. Before adding a configuration for a new device. 155 * 1. Before adding a configuration for a new device.
@@ -218,8 +229,10 @@ struct hc_driver {
218#define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */ 229#define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */
219#define HCD_USB11 0x0010 /* USB 1.1 */ 230#define HCD_USB11 0x0010 /* USB 1.1 */
220#define HCD_USB2 0x0020 /* USB 2.0 */ 231#define HCD_USB2 0x0020 /* USB 2.0 */
232#define HCD_USB25 0x0030 /* Wireless USB 1.0 (USB 2.5)*/
221#define HCD_USB3 0x0040 /* USB 3.0 */ 233#define HCD_USB3 0x0040 /* USB 3.0 */
222#define HCD_MASK 0x0070 234#define HCD_MASK 0x0070
235#define HCD_BH 0x0100 /* URB complete in BH context */
223 236
224 /* called to init HCD and root hub */ 237 /* called to init HCD and root hub */
225 int (*reset) (struct usb_hcd *hcd); 238 int (*reset) (struct usb_hcd *hcd);
@@ -360,6 +373,11 @@ struct hc_driver {
360 int (*find_raw_port_number)(struct usb_hcd *, int); 373 int (*find_raw_port_number)(struct usb_hcd *, int);
361}; 374};
362 375
376static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
377{
378 return hcd->driver->flags & HCD_BH;
379}
380
363extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); 381extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
364extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb, 382extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb,
365 int status); 383 int status);
@@ -410,7 +428,7 @@ extern int usb_hcd_pci_probe(struct pci_dev *dev,
410extern void usb_hcd_pci_remove(struct pci_dev *dev); 428extern void usb_hcd_pci_remove(struct pci_dev *dev);
411extern void usb_hcd_pci_shutdown(struct pci_dev *dev); 429extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
412 430
413#ifdef CONFIG_PM_SLEEP 431#ifdef CONFIG_PM
414extern const struct dev_pm_ops usb_hcd_pci_pm_ops; 432extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
415#endif 433#endif
416#endif /* CONFIG_PCI */ 434#endif /* CONFIG_PCI */
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
new file mode 100644
index 000000000000..8c38aa26b3bb
--- /dev/null
+++ b/include/linux/usb/of.h
@@ -0,0 +1,40 @@
1/*
2 * OF helpers for usb devices.
3 *
4 * This file is released under the GPLv2
5 */
6
7#ifndef __LINUX_USB_OF_H
8#define __LINUX_USB_OF_H
9
10#include <linux/usb/ch9.h>
11#include <linux/usb/otg.h>
12#include <linux/usb/phy.h>
13
14#if IS_ENABLED(CONFIG_OF)
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);
17#else
18static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
19{
20 return USB_DR_MODE_UNKNOWN;
21}
22
23static inline enum usb_device_speed
24of_usb_get_maximum_speed(struct device_node *np)
25{
26 return USB_SPEED_UNKNOWN;
27}
28#endif
29
30#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT)
31enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np);
32#else
33static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
34{
35 return USBPHY_INTERFACE_MODE_UNKNOWN;
36}
37
38#endif
39
40#endif /* __LINUX_USB_OF_H */
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 291e01ba32e5..154332b7c8c0 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -92,4 +92,11 @@ otg_start_srp(struct usb_otg *otg)
92/* for OTG controller drivers (and maybe other stuff) */ 92/* for OTG controller drivers (and maybe other stuff) */
93extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); 93extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
94 94
95enum usb_dr_mode {
96 USB_DR_MODE_UNKNOWN,
97 USB_DR_MODE_HOST,
98 USB_DR_MODE_PERIPHERAL,
99 USB_DR_MODE_OTG,
100};
101
95#endif /* __LINUX_USB_OTG_H */ 102#endif /* __LINUX_USB_OTG_H */
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 6b5978f57633..6c0b1c513db7 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -12,6 +12,15 @@
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13#include <linux/usb.h> 13#include <linux/usb.h>
14 14
15enum usb_phy_interface {
16 USBPHY_INTERFACE_MODE_UNKNOWN,
17 USBPHY_INTERFACE_MODE_UTMI,
18 USBPHY_INTERFACE_MODE_UTMIW,
19 USBPHY_INTERFACE_MODE_ULPI,
20 USBPHY_INTERFACE_MODE_SERIAL,
21 USBPHY_INTERFACE_MODE_HSIC,
22};
23
15enum usb_phy_events { 24enum usb_phy_events {
16 USB_EVENT_NONE, /* no events or cable disconnected */ 25 USB_EVENT_NONE, /* no events or cable disconnected */
17 USB_EVENT_VBUS, /* vbus valid event */ 26 USB_EVENT_VBUS, /* vbus valid event */
@@ -133,7 +142,7 @@ extern void usb_remove_phy(struct usb_phy *);
133/* helpers for direct access thru low-level io interface */ 142/* helpers for direct access thru low-level io interface */
134static inline int usb_phy_io_read(struct usb_phy *x, u32 reg) 143static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
135{ 144{
136 if (x->io_ops && x->io_ops->read) 145 if (x && x->io_ops && x->io_ops->read)
137 return x->io_ops->read(x, reg); 146 return x->io_ops->read(x, reg);
138 147
139 return -EINVAL; 148 return -EINVAL;
@@ -141,7 +150,7 @@ static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
141 150
142static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg) 151static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
143{ 152{
144 if (x->io_ops && x->io_ops->write) 153 if (x && x->io_ops && x->io_ops->write)
145 return x->io_ops->write(x, val, reg); 154 return x->io_ops->write(x, val, reg);
146 155
147 return -EINVAL; 156 return -EINVAL;
@@ -150,7 +159,7 @@ static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
150static inline int 159static inline int
151usb_phy_init(struct usb_phy *x) 160usb_phy_init(struct usb_phy *x)
152{ 161{
153 if (x->init) 162 if (x && x->init)
154 return x->init(x); 163 return x->init(x);
155 164
156 return 0; 165 return 0;
@@ -159,14 +168,14 @@ usb_phy_init(struct usb_phy *x)
159static inline void 168static inline void
160usb_phy_shutdown(struct usb_phy *x) 169usb_phy_shutdown(struct usb_phy *x)
161{ 170{
162 if (x->shutdown) 171 if (x && x->shutdown)
163 x->shutdown(x); 172 x->shutdown(x);
164} 173}
165 174
166static inline int 175static inline int
167usb_phy_vbus_on(struct usb_phy *x) 176usb_phy_vbus_on(struct usb_phy *x)
168{ 177{
169 if (!x->set_vbus) 178 if (!x || !x->set_vbus)
170 return 0; 179 return 0;
171 180
172 return x->set_vbus(x, true); 181 return x->set_vbus(x, true);
@@ -175,7 +184,7 @@ usb_phy_vbus_on(struct usb_phy *x)
175static inline int 184static inline int
176usb_phy_vbus_off(struct usb_phy *x) 185usb_phy_vbus_off(struct usb_phy *x)
177{ 186{
178 if (!x->set_vbus) 187 if (!x || !x->set_vbus)
179 return 0; 188 return 0;
180 189
181 return x->set_vbus(x, false); 190 return x->set_vbus(x, false);
@@ -249,7 +258,7 @@ usb_phy_set_power(struct usb_phy *x, unsigned mA)
249static inline int 258static inline int
250usb_phy_set_suspend(struct usb_phy *x, int suspend) 259usb_phy_set_suspend(struct usb_phy *x, int suspend)
251{ 260{
252 if (x->set_suspend != NULL) 261 if (x && x->set_suspend != NULL)
253 return x->set_suspend(x, suspend); 262 return x->set_suspend(x, suspend);
254 else 263 else
255 return 0; 264 return 0;
@@ -258,7 +267,7 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
258static inline int 267static inline int
259usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed) 268usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
260{ 269{
261 if (x->notify_connect) 270 if (x && x->notify_connect)
262 return x->notify_connect(x, speed); 271 return x->notify_connect(x, speed);
263 else 272 else
264 return 0; 273 return 0;
@@ -267,7 +276,7 @@ usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
267static inline int 276static inline int
268usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed) 277usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed)
269{ 278{
270 if (x->notify_disconnect) 279 if (x && x->notify_disconnect)
271 return x->notify_disconnect(x, speed); 280 return x->notify_disconnect(x, speed);
272 else 281 else
273 return 0; 282 return 0;
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 302ddf55d2da..d528b8045150 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -19,10 +19,6 @@
19#include <linux/sysrq.h> 19#include <linux/sysrq.h>
20#include <linux/kfifo.h> 20#include <linux/kfifo.h>
21 21
22#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
23#define SERIAL_TTY_MINORS 254 /* loads of devices :) */
24#define SERIAL_TTY_NO_MINOR 255 /* No minor was assigned */
25
26/* The maximum number of ports one device can grab at once */ 22/* The maximum number of ports one device can grab at once */
27#define MAX_NUM_PORTS 8 23#define MAX_NUM_PORTS 8
28 24
@@ -37,7 +33,8 @@
37 * @serial: pointer back to the struct usb_serial owner of this port. 33 * @serial: pointer back to the struct usb_serial owner of this port.
38 * @port: pointer to the corresponding tty_port for this port. 34 * @port: pointer to the corresponding tty_port for this port.
39 * @lock: spinlock to grab when updating portions of this structure. 35 * @lock: spinlock to grab when updating portions of this structure.
40 * @number: the number of the port (the minor number). 36 * @minor: the minor number of the port
37 * @port_number: the struct usb_serial port number of this port (starts at 0)
41 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. 38 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
42 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. 39 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
43 * @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe 40 * @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe
@@ -80,7 +77,8 @@ struct usb_serial_port {
80 struct usb_serial *serial; 77 struct usb_serial *serial;
81 struct tty_port port; 78 struct tty_port port;
82 spinlock_t lock; 79 spinlock_t lock;
83 unsigned char number; 80 u32 minor;
81 u8 port_number;
84 82
85 unsigned char *interrupt_in_buffer; 83 unsigned char *interrupt_in_buffer;
86 struct urb *interrupt_in_urb; 84 struct urb *interrupt_in_urb;
@@ -140,7 +138,6 @@ static inline void usb_set_serial_port_data(struct usb_serial_port *port,
140 * @dev: pointer to the struct usb_device for this device 138 * @dev: pointer to the struct usb_device for this device
141 * @type: pointer to the struct usb_serial_driver for this device 139 * @type: pointer to the struct usb_serial_driver for this device
142 * @interface: pointer to the struct usb_interface for this device 140 * @interface: pointer to the struct usb_interface for this device
143 * @minor: the starting minor number for this device
144 * @num_ports: the number of ports this device has 141 * @num_ports: the number of ports this device has
145 * @num_interrupt_in: number of interrupt in endpoints we have 142 * @num_interrupt_in: number of interrupt in endpoints we have
146 * @num_interrupt_out: number of interrupt out endpoints we have 143 * @num_interrupt_out: number of interrupt out endpoints we have
@@ -159,7 +156,7 @@ struct usb_serial {
159 unsigned char disconnected:1; 156 unsigned char disconnected:1;
160 unsigned char suspending:1; 157 unsigned char suspending:1;
161 unsigned char attached:1; 158 unsigned char attached:1;
162 unsigned char minor; 159 unsigned char minors_reserved:1;
163 unsigned char num_ports; 160 unsigned char num_ports;
164 unsigned char num_port_pointers; 161 unsigned char num_port_pointers;
165 char num_interrupt_in; 162 char num_interrupt_in;
@@ -319,7 +316,7 @@ static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
319#endif 316#endif
320 317
321/* Functions needed by other parts of the usbserial core */ 318/* Functions needed by other parts of the usbserial core */
322extern struct usb_serial *usb_serial_get_by_index(unsigned int minor); 319extern struct usb_serial_port *usb_serial_port_get_by_minor(unsigned int minor);
323extern void usb_serial_put(struct usb_serial *serial); 320extern void usb_serial_put(struct usb_serial *serial);
324extern int usb_serial_generic_open(struct tty_struct *tty, 321extern int usb_serial_generic_open(struct tty_struct *tty,
325 struct usb_serial_port *port); 322 struct usb_serial_port *port);
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
index 1b7519a8c0bf..1de16c324ec8 100644
--- a/include/linux/usb/tegra_usb_phy.h
+++ b/include/linux/usb/tegra_usb_phy.h
@@ -18,19 +18,36 @@
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/usb/otg.h> 19#include <linux/usb/otg.h>
20 20
21/*
22 * utmi_pll_config_in_car_module: true if the UTMI PLL configuration registers
23 * should be set up by clk-tegra, false if by the PHY code
24 * has_hostpc: true if the USB controller has the HOSTPC extension, which
25 * changes the location of the PHCD and PTS fields
26 * requires_usbmode_setup: true if the USBMODE register needs to be set to
27 * enter host mode
28 * requires_extra_tuning_parameters: true if xcvr_hsslew, hssquelch_level
29 * and hsdiscon_level should be set for adequate signal quality
30 */
31
32struct tegra_phy_soc_config {
33 bool utmi_pll_config_in_car_module;
34 bool has_hostpc;
35 bool requires_usbmode_setup;
36 bool requires_extra_tuning_parameters;
37};
38
21struct tegra_utmip_config { 39struct tegra_utmip_config {
22 u8 hssync_start_delay; 40 u8 hssync_start_delay;
23 u8 elastic_limit; 41 u8 elastic_limit;
24 u8 idle_wait_delay; 42 u8 idle_wait_delay;
25 u8 term_range_adj; 43 u8 term_range_adj;
44 bool xcvr_setup_use_fuses;
26 u8 xcvr_setup; 45 u8 xcvr_setup;
27 u8 xcvr_lsfslew; 46 u8 xcvr_lsfslew;
28 u8 xcvr_lsrslew; 47 u8 xcvr_lsrslew;
29}; 48 u8 xcvr_hsslew;
30 49 u8 hssquelch_level;
31struct tegra_ulpi_config { 50 u8 hsdiscon_level;
32 int reset_gpio;
33 const char *clk;
34}; 51};
35 52
36enum tegra_usb_phy_port_speed { 53enum tegra_usb_phy_port_speed {
@@ -39,11 +56,6 @@ enum tegra_usb_phy_port_speed {
39 TEGRA_USB_PHY_PORT_SPEED_HIGH, 56 TEGRA_USB_PHY_PORT_SPEED_HIGH,
40}; 57};
41 58
42enum tegra_usb_phy_mode {
43 TEGRA_USB_PHY_MODE_DEVICE,
44 TEGRA_USB_PHY_MODE_HOST,
45};
46
47struct tegra_xtal_freq; 59struct tegra_xtal_freq;
48 60
49struct tegra_usb_phy { 61struct tegra_usb_phy {
@@ -54,22 +66,17 @@ struct tegra_usb_phy {
54 struct clk *clk; 66 struct clk *clk;
55 struct clk *pll_u; 67 struct clk *pll_u;
56 struct clk *pad_clk; 68 struct clk *pad_clk;
57 enum tegra_usb_phy_mode mode; 69 struct regulator *vbus;
70 enum usb_dr_mode mode;
58 void *config; 71 void *config;
72 const struct tegra_phy_soc_config *soc_config;
59 struct usb_phy *ulpi; 73 struct usb_phy *ulpi;
60 struct usb_phy u_phy; 74 struct usb_phy u_phy;
61 struct device *dev;
62 bool is_legacy_phy; 75 bool is_legacy_phy;
63 bool is_ulpi_phy; 76 bool is_ulpi_phy;
64 void (*set_pts)(struct usb_phy *x, u8 pts_val); 77 int reset_gpio;
65 void (*set_phcd)(struct usb_phy *x, bool enable);
66}; 78};
67 79
68struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
69 void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode,
70 void (*set_pts)(struct usb_phy *x, u8 pts_val),
71 void (*set_phcd)(struct usb_phy *x, bool enable));
72
73void tegra_usb_phy_preresume(struct usb_phy *phy); 80void tegra_usb_phy_preresume(struct usb_phy *phy);
74 81
75void tegra_usb_phy_postresume(struct usb_phy *phy); 82void tegra_usb_phy_postresume(struct usb_phy *phy);
diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/usb_phy_gen_xceiv.h
index 148d35171aac..f9a7e7bc925b 100644
--- a/include/linux/usb/nop-usb-xceiv.h
+++ b/include/linux/usb/usb_phy_gen_xceiv.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/usb/otg.h> 4#include <linux/usb/otg.h>
5 5
6struct nop_usb_xceiv_platform_data { 6struct usb_phy_gen_xceiv_platform_data {
7 enum usb_phy_type type; 7 enum usb_phy_type type;
8 unsigned long clk_rate; 8 unsigned long clk_rate;
9 9
@@ -12,7 +12,7 @@ struct nop_usb_xceiv_platform_data {
12 unsigned int needs_reset:1; 12 unsigned int needs_reset:1;
13}; 13};
14 14
15#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) 15#if IS_ENABLED(CONFIG_NOP_USB_XCEIV)
16/* sometimes transceivers are accessed only through e.g. ULPI */ 16/* sometimes transceivers are accessed only through e.g. ULPI */
17extern void usb_nop_xceiv_register(void); 17extern void usb_nop_xceiv_register(void);
18extern void usb_nop_xceiv_unregister(void); 18extern void usb_nop_xceiv_unregister(void);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index f18d64129f99..e303eef94dd5 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -34,12 +34,15 @@ struct usbnet {
34 struct mutex phy_mutex; 34 struct mutex phy_mutex;
35 unsigned char suspend_count; 35 unsigned char suspend_count;
36 unsigned char pkt_cnt, pkt_err; 36 unsigned char pkt_cnt, pkt_err;
37 unsigned short rx_qlen, tx_qlen;
38 unsigned can_dma_sg:1;
37 39
38 /* i/o info: pipes etc */ 40 /* i/o info: pipes etc */
39 unsigned in, out; 41 unsigned in, out;
40 struct usb_host_endpoint *status; 42 struct usb_host_endpoint *status;
41 unsigned maxpacket; 43 unsigned maxpacket;
42 struct timer_list delay; 44 struct timer_list delay;
45 const char *padding_pkt;
43 46
44 /* protocol/interface state */ 47 /* protocol/interface state */
45 struct net_device *net; 48 struct net_device *net;
@@ -253,4 +256,6 @@ extern void usbnet_link_change(struct usbnet *, bool, bool);
253extern int usbnet_status_start(struct usbnet *dev, gfp_t mem_flags); 256extern int usbnet_status_start(struct usbnet *dev, gfp_t mem_flags);
254extern void usbnet_status_stop(struct usbnet *dev); 257extern void usbnet_status_stop(struct usbnet *dev);
255 258
259extern void usbnet_update_max_qlen(struct usbnet *dev);
260
256#endif /* __LINUX_USB_USBNET_H */ 261#endif /* __LINUX_USB_USBNET_H */
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h
index f9dec37f617b..4ff744e2b678 100644
--- a/include/linux/usb/wusb-wa.h
+++ b/include/linux/usb/wusb-wa.h
@@ -66,6 +66,7 @@ enum {
66 WA_ENABLE = 0x01, 66 WA_ENABLE = 0x01,
67 WA_RESET = 0x02, 67 WA_RESET = 0x02,
68 RPIPE_PAUSE = 0x1, 68 RPIPE_PAUSE = 0x1,
69 RPIPE_STALL = 0x2,
69}; 70};
70 71
71/* Responses from Get Status request ([WUSB] section 8.3.1.6) */ 72/* Responses from Get Status request ([WUSB] section 8.3.1.6) */
@@ -92,11 +93,20 @@ struct usb_rpipe_descriptor {
92 __le16 wRPipeIndex; 93 __le16 wRPipeIndex;
93 __le16 wRequests; 94 __le16 wRequests;
94 __le16 wBlocks; /* rw if 0 */ 95 __le16 wBlocks; /* rw if 0 */
95 __le16 wMaxPacketSize; /* rw? */ 96 __le16 wMaxPacketSize; /* rw */
96 u8 bHSHubAddress; /* reserved: 0 */ 97 union {
97 u8 bHSHubPort; /* ??? FIXME ??? */ 98 u8 dwa_bHSHubAddress; /* rw: DWA. */
99 u8 hwa_bMaxBurst; /* rw: HWA. */
100 };
101 union {
102 u8 dwa_bHSHubPort; /* rw: DWA. */
103 u8 hwa_bDeviceInfoIndex; /* rw: HWA. */
104 };
98 u8 bSpeed; /* rw: xfer rate 'enum uwb_phy_rate' */ 105 u8 bSpeed; /* rw: xfer rate 'enum uwb_phy_rate' */
99 u8 bDeviceAddress; /* rw: Target device address */ 106 union {
107 u8 dwa_bDeviceAddress; /* rw: DWA Target device address. */
108 u8 hwa_reserved; /* rw: HWA. */
109 };
100 u8 bEndpointAddress; /* rw: Target EP address */ 110 u8 bEndpointAddress; /* rw: Target EP address */
101 u8 bDataSequence; /* ro: Current Data sequence */ 111 u8 bDataSequence; /* ro: Current Data sequence */
102 __le32 dwCurrentWindow; /* ro */ 112 __le32 dwCurrentWindow; /* ro */
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index b6b215f13b45..4db29859464f 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -23,11 +23,10 @@ struct user_namespace {
23 struct uid_gid_map projid_map; 23 struct uid_gid_map projid_map;
24 atomic_t count; 24 atomic_t count;
25 struct user_namespace *parent; 25 struct user_namespace *parent;
26 int level;
26 kuid_t owner; 27 kuid_t owner;
27 kgid_t group; 28 kgid_t group;
28 unsigned int proc_inum; 29 unsigned int proc_inum;
29 bool may_mount_sysfs;
30 bool may_mount_proc;
31}; 30};
32 31
33extern struct user_namespace init_user_ns; 32extern struct user_namespace init_user_ns;
@@ -84,6 +83,4 @@ static inline void put_user_ns(struct user_namespace *ns)
84 83
85#endif 84#endif
86 85
87void update_mnt_policy(struct user_namespace *userns);
88
89#endif /* _LINUX_USER_H */ 86#endif /* _LINUX_USER_H */
diff --git a/include/linux/uwb/spec.h b/include/linux/uwb/spec.h
index b52e44f1bd33..0df24bfcdb38 100644
--- a/include/linux/uwb/spec.h
+++ b/include/linux/uwb/spec.h
@@ -32,6 +32,7 @@
32 32
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/bitmap.h> 34#include <linux/bitmap.h>
35#include <linux/if_ether.h>
35 36
36#define i1480_FW 0x00000303 37#define i1480_FW 0x00000303
37/* #define i1480_FW 0x00000302 */ 38/* #define i1480_FW 0x00000302 */
@@ -130,7 +131,7 @@ enum { UWB_DRP_BACKOFF_WIN_MAX = 16 };
130 * it is also used to define headers sent down and up the wire/radio). 131 * it is also used to define headers sent down and up the wire/radio).
131 */ 132 */
132struct uwb_mac_addr { 133struct uwb_mac_addr {
133 u8 data[6]; 134 u8 data[ETH_ALEN];
134} __attribute__((packed)); 135} __attribute__((packed));
135 136
136 137
@@ -568,7 +569,7 @@ struct uwb_rc_evt_confirm {
568/* Device Address Management event. [WHCI] section 3.1.3.2. */ 569/* Device Address Management event. [WHCI] section 3.1.3.2. */
569struct uwb_rc_evt_dev_addr_mgmt { 570struct uwb_rc_evt_dev_addr_mgmt {
570 struct uwb_rceb rceb; 571 struct uwb_rceb rceb;
571 u8 baAddr[6]; 572 u8 baAddr[ETH_ALEN];
572 u8 bResultCode; 573 u8 bResultCode;
573} __attribute__((packed)); 574} __attribute__((packed));
574 575
diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h
index ea7168a68081..617c01b8f74a 100644
--- a/include/linux/vexpress.h
+++ b/include/linux/vexpress.h
@@ -15,6 +15,7 @@
15#define _LINUX_VEXPRESS_H 15#define _LINUX_VEXPRESS_H
16 16
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/reboot.h>
18 19
19#define VEXPRESS_SITE_MB 0 20#define VEXPRESS_SITE_MB 0
20#define VEXPRESS_SITE_DB1 1 21#define VEXPRESS_SITE_DB1 1
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index ac8d488e4372..24579a0312a0 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -90,4 +90,11 @@ extern void vfio_unregister_iommu_driver(
90 TYPE tmp; \ 90 TYPE tmp; \
91 offsetof(TYPE, MEMBER) + sizeof(tmp.MEMBER); }) \ 91 offsetof(TYPE, MEMBER) + sizeof(tmp.MEMBER); }) \
92 92
93/*
94 * External user API
95 */
96extern struct vfio_group *vfio_group_get_external_user(struct file *filep);
97extern void vfio_group_put_external_user(struct vfio_group *group);
98extern int vfio_external_user_iommu_id(struct vfio_group *group);
99
93#endif /* VFIO_H */ 100#endif /* VFIO_H */
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index ddb419cf4530..502073a53dd3 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -45,7 +45,8 @@ struct vga_switcheroo_client_ops {
45#if defined(CONFIG_VGA_SWITCHEROO) 45#if defined(CONFIG_VGA_SWITCHEROO)
46void vga_switcheroo_unregister_client(struct pci_dev *dev); 46void vga_switcheroo_unregister_client(struct pci_dev *dev);
47int vga_switcheroo_register_client(struct pci_dev *dev, 47int vga_switcheroo_register_client(struct pci_dev *dev,
48 const struct vga_switcheroo_client_ops *ops); 48 const struct vga_switcheroo_client_ops *ops,
49 bool driver_power_control);
49int vga_switcheroo_register_audio_client(struct pci_dev *pdev, 50int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
50 const struct vga_switcheroo_client_ops *ops, 51 const struct vga_switcheroo_client_ops *ops,
51 int id, bool active); 52 int id, bool active);
@@ -60,11 +61,15 @@ int vga_switcheroo_process_delayed_switch(void);
60 61
61int vga_switcheroo_get_client_state(struct pci_dev *dev); 62int vga_switcheroo_get_client_state(struct pci_dev *dev);
62 63
64void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic);
65
66int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain);
67int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain);
63#else 68#else
64 69
65static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {} 70static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {}
66static inline int vga_switcheroo_register_client(struct pci_dev *dev, 71static inline int vga_switcheroo_register_client(struct pci_dev *dev,
67 const struct vga_switcheroo_client_ops *ops) { return 0; } 72 const struct vga_switcheroo_client_ops *ops, bool driver_power_control) { return 0; }
68static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {} 73static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {}
69static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; } 74static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; }
70static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev, 75static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
@@ -74,6 +79,10 @@ static inline void vga_switcheroo_unregister_handler(void) {}
74static inline int vga_switcheroo_process_delayed_switch(void) { return 0; } 79static inline int vga_switcheroo_process_delayed_switch(void) { return 0; }
75static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return VGA_SWITCHEROO_ON; } 80static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return VGA_SWITCHEROO_ON; }
76 81
82static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {}
83
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_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; }
77 86
78#endif 87#endif
79#endif /* _LINUX_VGA_SWITCHEROO_H_ */ 88#endif /* _LINUX_VGA_SWITCHEROO_H_ */
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 2c02f3a8d2ba..80cf8173a65b 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -65,8 +65,15 @@ struct pci_dev;
65 * out of the arbitration process (and can be safe to take 65 * out of the arbitration process (and can be safe to take
66 * interrupts at any time. 66 * interrupts at any time.
67 */ 67 */
68#if defined(CONFIG_VGA_ARB)
68extern void vga_set_legacy_decoding(struct pci_dev *pdev, 69extern void vga_set_legacy_decoding(struct pci_dev *pdev,
69 unsigned int decodes); 70 unsigned int decodes);
71#else
72static inline void vga_set_legacy_decoding(struct pci_dev *pdev,
73 unsigned int decodes)
74{
75}
76#endif
70 77
71/** 78/**
72 * vga_get - acquire & locks VGA resources 79 * vga_get - acquire & locks VGA resources
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 9ff8645b7e0b..36d36cc89329 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -34,13 +34,6 @@ struct virtqueue {
34 void *priv; 34 void *priv;
35}; 35};
36 36
37int virtqueue_add_buf(struct virtqueue *vq,
38 struct scatterlist sg[],
39 unsigned int out_num,
40 unsigned int in_num,
41 void *data,
42 gfp_t gfp);
43
44int virtqueue_add_outbuf(struct virtqueue *vq, 37int virtqueue_add_outbuf(struct virtqueue *vq,
45 struct scatterlist sg[], unsigned int num, 38 struct scatterlist sg[], unsigned int num,
46 void *data, 39 void *data,
@@ -70,6 +63,10 @@ void virtqueue_disable_cb(struct virtqueue *vq);
70 63
71bool virtqueue_enable_cb(struct virtqueue *vq); 64bool virtqueue_enable_cb(struct virtqueue *vq);
72 65
66unsigned virtqueue_enable_cb_prepare(struct virtqueue *vq);
67
68bool virtqueue_poll(struct virtqueue *vq, unsigned);
69
73bool virtqueue_enable_cb_delayed(struct virtqueue *vq); 70bool virtqueue_enable_cb_delayed(struct virtqueue *vq);
74 71
75void *virtqueue_detach_unused_buf(struct virtqueue *vq); 72void *virtqueue_detach_unused_buf(struct virtqueue *vq);
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index ca3ad41c2c82..b300787af8e0 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_VIRTIO_RING_H 1#ifndef _LINUX_VIRTIO_RING_H
2#define _LINUX_VIRTIO_RING_H 2#define _LINUX_VIRTIO_RING_H
3 3
4#include <asm/barrier.h>
4#include <linux/irqreturn.h> 5#include <linux/irqreturn.h>
5#include <uapi/linux/virtio_ring.h> 6#include <uapi/linux/virtio_ring.h>
6 7
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index bd6cf61142be..1855f0a22add 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -70,6 +70,12 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
70 THP_ZERO_PAGE_ALLOC, 70 THP_ZERO_PAGE_ALLOC,
71 THP_ZERO_PAGE_ALLOC_FAILED, 71 THP_ZERO_PAGE_ALLOC_FAILED,
72#endif 72#endif
73#ifdef CONFIG_SMP
74 NR_TLB_REMOTE_FLUSH, /* cpu tried to flush others' tlbs */
75 NR_TLB_REMOTE_FLUSH_RECEIVED,/* cpu received ipi for flush */
76#endif
77 NR_TLB_LOCAL_FLUSH_ALL,
78 NR_TLB_LOCAL_FLUSH_ONE,
73 NR_VM_EVENT_ITEMS 79 NR_VM_EVENT_ITEMS
74}; 80};
75 81
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 7d5773a99f20..4b8a89189a29 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -10,12 +10,12 @@
10struct vm_area_struct; /* vma defining user mapping in mm_types.h */ 10struct vm_area_struct; /* vma defining user mapping in mm_types.h */
11 11
12/* bits in flags of vmalloc's vm_struct below */ 12/* bits in flags of vmalloc's vm_struct below */
13#define VM_IOREMAP 0x00000001 /* ioremap() and friends */ 13#define VM_IOREMAP 0x00000001 /* ioremap() and friends */
14#define VM_ALLOC 0x00000002 /* vmalloc() */ 14#define VM_ALLOC 0x00000002 /* vmalloc() */
15#define VM_MAP 0x00000004 /* vmap()ed pages */ 15#define VM_MAP 0x00000004 /* vmap()ed pages */
16#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */ 16#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */
17#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */ 17#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */
18#define VM_UNLIST 0x00000020 /* vm_struct is not listed in vmlist */ 18#define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */
19/* bits [20..32] reserved for arch specific ioremap internals */ 19/* bits [20..32] reserved for arch specific ioremap internals */
20 20
21/* 21/*
@@ -82,6 +82,10 @@ extern void *vmap(struct page **pages, unsigned int count,
82 unsigned long flags, pgprot_t prot); 82 unsigned long flags, pgprot_t prot);
83extern void vunmap(const void *addr); 83extern void vunmap(const void *addr);
84 84
85extern int remap_vmalloc_range_partial(struct vm_area_struct *vma,
86 unsigned long uaddr, void *kaddr,
87 unsigned long size);
88
85extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, 89extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
86 unsigned long pgoff); 90 unsigned long pgoff);
87void vmalloc_sync_all(void); 91void vmalloc_sync_all(void);
diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h
index 76be077340ea..3f3788d49362 100644
--- a/include/linux/vmpressure.h
+++ b/include/linux/vmpressure.h
@@ -12,7 +12,7 @@ struct vmpressure {
12 unsigned long scanned; 12 unsigned long scanned;
13 unsigned long reclaimed; 13 unsigned long reclaimed;
14 /* The lock is used to keep the scanned/reclaimed above in sync. */ 14 /* The lock is used to keep the scanned/reclaimed above in sync. */
15 struct mutex sr_lock; 15 struct spinlock sr_lock;
16 16
17 /* The list of vmpressure_event structs. */ 17 /* The list of vmpressure_event structs. */
18 struct list_head events; 18 struct list_head events;
@@ -30,13 +30,16 @@ extern void vmpressure(gfp_t gfp, struct mem_cgroup *memcg,
30extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio); 30extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio);
31 31
32extern void vmpressure_init(struct vmpressure *vmpr); 32extern void vmpressure_init(struct vmpressure *vmpr);
33extern void vmpressure_cleanup(struct vmpressure *vmpr);
33extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg); 34extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg);
34extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr); 35extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr);
35extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css); 36extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css);
36extern int vmpressure_register_event(struct cgroup *cg, struct cftype *cft, 37extern int vmpressure_register_event(struct cgroup_subsys_state *css,
38 struct cftype *cft,
37 struct eventfd_ctx *eventfd, 39 struct eventfd_ctx *eventfd,
38 const char *args); 40 const char *args);
39extern void vmpressure_unregister_event(struct cgroup *cg, struct cftype *cft, 41extern void vmpressure_unregister_event(struct cgroup_subsys_state *css,
42 struct cftype *cft,
40 struct eventfd_ctx *eventfd); 43 struct eventfd_ctx *eventfd);
41#else 44#else
42static inline void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, 45static inline void vmpressure(gfp_t gfp, struct mem_cgroup *memcg,
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index c586679b6fef..e4b948080d20 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -143,7 +143,6 @@ static inline unsigned long zone_page_state_snapshot(struct zone *zone,
143} 143}
144 144
145extern unsigned long global_reclaimable_pages(void); 145extern unsigned long global_reclaimable_pages(void);
146extern unsigned long zone_reclaimable_pages(struct zone *zone);
147 146
148#ifdef CONFIG_NUMA 147#ifdef CONFIG_NUMA
149/* 148/*
@@ -198,7 +197,7 @@ extern void __inc_zone_state(struct zone *, enum zone_stat_item);
198extern void dec_zone_state(struct zone *, enum zone_stat_item); 197extern void dec_zone_state(struct zone *, enum zone_stat_item);
199extern void __dec_zone_state(struct zone *, enum zone_stat_item); 198extern void __dec_zone_state(struct zone *, enum zone_stat_item);
200 199
201void refresh_cpu_vm_stats(int); 200void cpu_vm_stats_fold(int cpu);
202void refresh_zone_stat_thresholds(void); 201void refresh_zone_stat_thresholds(void);
203 202
204void drain_zonestat(struct zone *zone, struct per_cpu_pageset *); 203void drain_zonestat(struct zone *zone, struct per_cpu_pageset *);
@@ -255,6 +254,7 @@ static inline void __dec_zone_page_state(struct page *page,
255 254
256static inline void refresh_cpu_vm_stats(int cpu) { } 255static inline void refresh_cpu_vm_stats(int cpu) { }
257static inline void refresh_zone_stat_thresholds(void) { } 256static inline void refresh_zone_stat_thresholds(void) { }
257static inline void cpu_vm_stats_fold(int cpu) { }
258 258
259static inline void drain_zonestat(struct zone *zone, 259static inline void drain_zonestat(struct zone *zone,
260 struct per_cpu_pageset *pset) { } 260 struct per_cpu_pageset *pset) { }
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 0d33fca48774..8d7634247fb4 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -133,8 +133,6 @@ void change_console(struct vc_data *new_vc);
133void reset_vc(struct vc_data *vc); 133void reset_vc(struct vc_data *vc);
134extern int do_unbind_con_driver(const struct consw *csw, int first, int last, 134extern int do_unbind_con_driver(const struct consw *csw, int first, int last,
135 int deflt); 135 int deflt);
136extern int unbind_con_driver(const struct consw *csw, int first, int last,
137 int deflt);
138int vty_init(const struct file_operations *console_fops); 136int vty_init(const struct file_operations *console_fops);
139 137
140static inline bool vt_force_oops_output(struct vc_data *vc) 138static inline bool vt_force_oops_output(struct vc_data *vc)
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index 71a5782d8c59..f5b72b364bda 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -1,18 +1,68 @@
1#ifndef _LINUX_KERNEL_VTIME_H 1#ifndef _LINUX_KERNEL_VTIME_H
2#define _LINUX_KERNEL_VTIME_H 2#define _LINUX_KERNEL_VTIME_H
3 3
4#include <linux/context_tracking_state.h>
5#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
6#include <asm/vtime.h>
7#endif
8
9
4struct task_struct; 10struct task_struct;
5 11
12/*
13 * vtime_accounting_enabled() definitions/declarations
14 */
15#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
16static inline bool vtime_accounting_enabled(void) { return true; }
17#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
18
19#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
20static inline bool vtime_accounting_enabled(void)
21{
22 if (static_key_false(&context_tracking_enabled)) {
23 if (context_tracking_active())
24 return true;
25 }
26
27 return false;
28}
29#endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */
30
31#ifndef CONFIG_VIRT_CPU_ACCOUNTING
32static inline bool vtime_accounting_enabled(void) { return false; }
33#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
34
35
36/*
37 * Common vtime APIs
38 */
6#ifdef CONFIG_VIRT_CPU_ACCOUNTING 39#ifdef CONFIG_VIRT_CPU_ACCOUNTING
40
41#ifdef __ARCH_HAS_VTIME_TASK_SWITCH
7extern void vtime_task_switch(struct task_struct *prev); 42extern void vtime_task_switch(struct task_struct *prev);
43#else
44extern void vtime_common_task_switch(struct task_struct *prev);
45static inline void vtime_task_switch(struct task_struct *prev)
46{
47 if (vtime_accounting_enabled())
48 vtime_common_task_switch(prev);
49}
50#endif /* __ARCH_HAS_VTIME_TASK_SWITCH */
51
8extern void vtime_account_system(struct task_struct *tsk); 52extern void vtime_account_system(struct task_struct *tsk);
9extern void vtime_account_idle(struct task_struct *tsk); 53extern void vtime_account_idle(struct task_struct *tsk);
10extern void vtime_account_user(struct task_struct *tsk); 54extern void vtime_account_user(struct task_struct *tsk);
11extern void vtime_account_irq_enter(struct task_struct *tsk);
12 55
13#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE 56#ifdef __ARCH_HAS_VTIME_ACCOUNT
14static inline bool vtime_accounting_enabled(void) { return true; } 57extern void vtime_account_irq_enter(struct task_struct *tsk);
15#endif 58#else
59extern void vtime_common_account_irq_enter(struct task_struct *tsk);
60static inline void vtime_account_irq_enter(struct task_struct *tsk)
61{
62 if (vtime_accounting_enabled())
63 vtime_common_account_irq_enter(tsk);
64}
65#endif /* __ARCH_HAS_VTIME_ACCOUNT */
16 66
17#else /* !CONFIG_VIRT_CPU_ACCOUNTING */ 67#else /* !CONFIG_VIRT_CPU_ACCOUNTING */
18 68
@@ -20,22 +70,28 @@ static inline void vtime_task_switch(struct task_struct *prev) { }
20static inline void vtime_account_system(struct task_struct *tsk) { } 70static inline void vtime_account_system(struct task_struct *tsk) { }
21static inline void vtime_account_user(struct task_struct *tsk) { } 71static inline void vtime_account_user(struct task_struct *tsk) { }
22static inline void vtime_account_irq_enter(struct task_struct *tsk) { } 72static inline void vtime_account_irq_enter(struct task_struct *tsk) { }
23static inline bool vtime_accounting_enabled(void) { return false; } 73#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
24#endif
25 74
26#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN 75#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
27extern void arch_vtime_task_switch(struct task_struct *tsk); 76extern void arch_vtime_task_switch(struct task_struct *tsk);
28extern void vtime_account_irq_exit(struct task_struct *tsk); 77extern void vtime_gen_account_irq_exit(struct task_struct *tsk);
29extern bool vtime_accounting_enabled(void); 78
79static inline void vtime_account_irq_exit(struct task_struct *tsk)
80{
81 if (vtime_accounting_enabled())
82 vtime_gen_account_irq_exit(tsk);
83}
84
30extern void vtime_user_enter(struct task_struct *tsk); 85extern void vtime_user_enter(struct task_struct *tsk);
86
31static inline void vtime_user_exit(struct task_struct *tsk) 87static inline void vtime_user_exit(struct task_struct *tsk)
32{ 88{
33 vtime_account_user(tsk); 89 vtime_account_user(tsk);
34} 90}
35extern void vtime_guest_enter(struct task_struct *tsk); 91extern void vtime_guest_enter(struct task_struct *tsk);
36extern void vtime_guest_exit(struct task_struct *tsk); 92extern void vtime_guest_exit(struct task_struct *tsk);
37extern void vtime_init_idle(struct task_struct *tsk); 93extern void vtime_init_idle(struct task_struct *tsk, int cpu);
38#else 94#else /* !CONFIG_VIRT_CPU_ACCOUNTING_GEN */
39static inline void vtime_account_irq_exit(struct task_struct *tsk) 95static inline void vtime_account_irq_exit(struct task_struct *tsk)
40{ 96{
41 /* On hard|softirq exit we always account to hard|softirq cputime */ 97 /* On hard|softirq exit we always account to hard|softirq cputime */
@@ -45,7 +101,7 @@ static inline void vtime_user_enter(struct task_struct *tsk) { }
45static inline void vtime_user_exit(struct task_struct *tsk) { } 101static inline void vtime_user_exit(struct task_struct *tsk) { }
46static inline void vtime_guest_enter(struct task_struct *tsk) { } 102static inline void vtime_guest_enter(struct task_struct *tsk) { }
47static inline void vtime_guest_exit(struct task_struct *tsk) { } 103static inline void vtime_guest_exit(struct task_struct *tsk) { }
48static inline void vtime_init_idle(struct task_struct *tsk) { } 104static inline void vtime_init_idle(struct task_struct *tsk, int cpu) { }
49#endif 105#endif
50 106
51#ifdef CONFIG_IRQ_TIME_ACCOUNTING 107#ifdef CONFIG_IRQ_TIME_ACCOUNTING
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 1133695eb067..a67fc1635592 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -23,6 +23,7 @@ struct __wait_queue {
23struct wait_bit_key { 23struct wait_bit_key {
24 void *flags; 24 void *flags;
25 int bit_nr; 25 int bit_nr;
26#define WAIT_ATOMIC_T_BIT_NR -1
26}; 27};
27 28
28struct wait_bit_queue { 29struct wait_bit_queue {
@@ -60,6 +61,9 @@ struct task_struct;
60#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ 61#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \
61 { .flags = word, .bit_nr = bit, } 62 { .flags = word, .bit_nr = bit, }
62 63
64#define __WAIT_ATOMIC_T_KEY_INITIALIZER(p) \
65 { .flags = p, .bit_nr = WAIT_ATOMIC_T_BIT_NR, }
66
63extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *); 67extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *);
64 68
65#define init_waitqueue_head(q) \ 69#define init_waitqueue_head(q) \
@@ -146,8 +150,10 @@ void __wake_up_bit(wait_queue_head_t *, void *, int);
146int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 150int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
147int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 151int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
148void wake_up_bit(void *, int); 152void wake_up_bit(void *, int);
153void wake_up_atomic_t(atomic_t *);
149int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned); 154int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned);
150int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned); 155int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned);
156int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned);
151wait_queue_head_t *bit_waitqueue(void *, int); 157wait_queue_head_t *bit_waitqueue(void *, int);
152 158
153#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) 159#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL)
@@ -805,6 +811,63 @@ do { \
805 __ret; \ 811 __ret; \
806}) 812})
807 813
814#define __wait_event_interruptible_lock_irq_timeout(wq, condition, \
815 lock, ret) \
816do { \
817 DEFINE_WAIT(__wait); \
818 \
819 for (;;) { \
820 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
821 if (condition) \
822 break; \
823 if (signal_pending(current)) { \
824 ret = -ERESTARTSYS; \
825 break; \
826 } \
827 spin_unlock_irq(&lock); \
828 ret = schedule_timeout(ret); \
829 spin_lock_irq(&lock); \
830 if (!ret) \
831 break; \
832 } \
833 finish_wait(&wq, &__wait); \
834} while (0)
835
836/**
837 * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets true or a timeout elapses.
838 * The condition is checked under the lock. This is expected
839 * to be called with the lock taken.
840 * @wq: the waitqueue to wait on
841 * @condition: a C expression for the event to wait for
842 * @lock: a locked spinlock_t, which will be released before schedule()
843 * and reacquired afterwards.
844 * @timeout: timeout, in jiffies
845 *
846 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
847 * @condition evaluates to true or signal is received. The @condition is
848 * checked each time the waitqueue @wq is woken up.
849 *
850 * wake_up() has to be called after changing any variable that could
851 * change the result of the wait condition.
852 *
853 * This is supposed to be called while holding the lock. The lock is
854 * dropped before going to sleep and is reacquired afterwards.
855 *
856 * The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it
857 * was interrupted by a signal, and the remaining jiffies otherwise
858 * if the condition evaluated to true before the timeout elapsed.
859 */
860#define wait_event_interruptible_lock_irq_timeout(wq, condition, lock, \
861 timeout) \
862({ \
863 int __ret = timeout; \
864 \
865 if (!(condition)) \
866 __wait_event_interruptible_lock_irq_timeout( \
867 wq, condition, lock, __ret); \
868 __ret; \
869})
870
808 871
809/* 872/*
810 * These are the old interfaces to sleep waiting for an event. 873 * These are the old interfaces to sleep waiting for an event.
@@ -902,5 +965,23 @@ static inline int wait_on_bit_lock(void *word, int bit,
902 return 0; 965 return 0;
903 return out_of_line_wait_on_bit_lock(word, bit, action, mode); 966 return out_of_line_wait_on_bit_lock(word, bit, action, mode);
904} 967}
968
969/**
970 * wait_on_atomic_t - Wait for an atomic_t to become 0
971 * @val: The atomic value being waited on, a kernel virtual address
972 * @action: the function used to sleep, which may take special actions
973 * @mode: the task state to sleep in
974 *
975 * Wait for an atomic_t to become 0. We abuse the bit-wait waitqueue table for
976 * the purpose of getting a waitqueue, but we set the key to a bit number
977 * outside of the target 'word'.
978 */
979static inline
980int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode)
981{
982 if (atomic_read(val) == 0)
983 return 0;
984 return out_of_line_wait_on_atomic_t(val, action, mode);
985}
905 986
906#endif 987#endif
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 623488fdc1f5..594521ba0d43 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -295,7 +295,12 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
295 * Documentation/workqueue.txt. 295 * Documentation/workqueue.txt.
296 */ 296 */
297enum { 297enum {
298 WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */ 298 /*
299 * All wqs are now non-reentrant making the following flag
300 * meaningless. Will be removed.
301 */
302 WQ_NON_REENTRANT = 1 << 0, /* DEPRECATED */
303
299 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */ 304 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */
300 WQ_FREEZABLE = 1 << 2, /* freeze during suspend */ 305 WQ_FREEZABLE = 1 << 2, /* freeze during suspend */
301 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ 306 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */
@@ -303,6 +308,33 @@ enum {
303 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ 308 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */
304 WQ_SYSFS = 1 << 6, /* visible in sysfs, see wq_sysfs_register() */ 309 WQ_SYSFS = 1 << 6, /* visible in sysfs, see wq_sysfs_register() */
305 310
311 /*
312 * Per-cpu workqueues are generally preferred because they tend to
313 * show better performance thanks to cache locality. Per-cpu
314 * workqueues exclude the scheduler from choosing the CPU to
315 * execute the worker threads, which has an unfortunate side effect
316 * of increasing power consumption.
317 *
318 * The scheduler considers a CPU idle if it doesn't have any task
319 * to execute and tries to keep idle cores idle to conserve power;
320 * however, for example, a per-cpu work item scheduled from an
321 * interrupt handler on an idle CPU will force the scheduler to
322 * excute the work item on that CPU breaking the idleness, which in
323 * turn may lead to more scheduling choices which are sub-optimal
324 * in terms of power consumption.
325 *
326 * Workqueues marked with WQ_POWER_EFFICIENT are per-cpu by default
327 * but become unbound if workqueue.power_efficient kernel param is
328 * specified. Per-cpu workqueues which are identified to
329 * contribute significantly to power-consumption are identified and
330 * marked with this flag and enabling the power_efficient mode
331 * leads to noticeable power saving at the cost of small
332 * performance disadvantage.
333 *
334 * http://thread.gmane.org/gmane.linux.kernel/1480396
335 */
336 WQ_POWER_EFFICIENT = 1 << 7,
337
306 __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */ 338 __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */
307 __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */ 339 __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */
308 340
@@ -333,11 +365,19 @@ enum {
333 * 365 *
334 * system_freezable_wq is equivalent to system_wq except that it's 366 * system_freezable_wq is equivalent to system_wq except that it's
335 * freezable. 367 * freezable.
368 *
369 * *_power_efficient_wq are inclined towards saving power and converted
370 * into WQ_UNBOUND variants if 'wq_power_efficient' is enabled; otherwise,
371 * they are same as their non-power-efficient counterparts - e.g.
372 * system_power_efficient_wq is identical to system_wq if
373 * 'wq_power_efficient' is disabled. See WQ_POWER_EFFICIENT for more info.
336 */ 374 */
337extern struct workqueue_struct *system_wq; 375extern struct workqueue_struct *system_wq;
338extern struct workqueue_struct *system_long_wq; 376extern struct workqueue_struct *system_long_wq;
339extern struct workqueue_struct *system_unbound_wq; 377extern struct workqueue_struct *system_unbound_wq;
340extern struct workqueue_struct *system_freezable_wq; 378extern struct workqueue_struct *system_freezable_wq;
379extern struct workqueue_struct *system_power_efficient_wq;
380extern struct workqueue_struct *system_freezable_power_efficient_wq;
341 381
342static inline struct workqueue_struct * __deprecated __system_nrt_wq(void) 382static inline struct workqueue_struct * __deprecated __system_nrt_wq(void)
343{ 383{
@@ -410,11 +450,12 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
410 alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args) 450 alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args)
411 451
412#define create_workqueue(name) \ 452#define create_workqueue(name) \
413 alloc_workqueue((name), WQ_MEM_RECLAIM, 1) 453 alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, (name))
414#define create_freezable_workqueue(name) \ 454#define create_freezable_workqueue(name) \
415 alloc_workqueue((name), WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1) 455 alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \
456 1, (name))
416#define create_singlethread_workqueue(name) \ 457#define create_singlethread_workqueue(name) \
417 alloc_workqueue((name), WQ_UNBOUND | WQ_MEM_RECLAIM, 1) 458 alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM, 1, (name))
418 459
419extern void destroy_workqueue(struct workqueue_struct *wq); 460extern void destroy_workqueue(struct workqueue_struct *wq);
420 461
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 579a5007c696..021b8a319b9e 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -47,11 +47,16 @@ enum wb_reason {
47 WB_REASON_LAPTOP_TIMER, 47 WB_REASON_LAPTOP_TIMER,
48 WB_REASON_FREE_MORE_MEM, 48 WB_REASON_FREE_MORE_MEM,
49 WB_REASON_FS_FREE_SPACE, 49 WB_REASON_FS_FREE_SPACE,
50 /*
51 * There is no bdi forker thread any more and works are done
52 * by emergency worker, however, this is TPs userland visible
53 * and we'll be exposing exactly the same information,
54 * so it has a mismatch name.
55 */
50 WB_REASON_FORKER_THREAD, 56 WB_REASON_FORKER_THREAD,
51 57
52 WB_REASON_MAX, 58 WB_REASON_MAX,
53}; 59};
54extern const char *wb_reason_name[];
55 60
56/* 61/*
57 * A control structure which tells the writeback code what to do. These are 62 * A control structure which tells the writeback code what to do. These are
@@ -78,6 +83,7 @@ struct writeback_control {
78 unsigned tagged_writepages:1; /* tag-and-write to avoid livelock */ 83 unsigned tagged_writepages:1; /* tag-and-write to avoid livelock */
79 unsigned for_reclaim:1; /* Invoked from the page allocator */ 84 unsigned for_reclaim:1; /* Invoked from the page allocator */
80 unsigned range_cyclic:1; /* range_start is cyclic */ 85 unsigned range_cyclic:1; /* range_start is cyclic */
86 unsigned for_sync:1; /* sync(2) WB_SYNC_ALL writeback */
81}; 87};
82 88
83/* 89/*
@@ -92,9 +98,6 @@ int try_to_writeback_inodes_sb(struct super_block *, enum wb_reason reason);
92int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr, 98int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
93 enum wb_reason reason); 99 enum wb_reason reason);
94void sync_inodes_sb(struct super_block *); 100void sync_inodes_sb(struct super_block *);
95long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
96 enum wb_reason reason);
97long wb_do_writeback(struct bdi_writeback *wb, int force_wait);
98void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); 101void wakeup_flusher_threads(long nr_pages, enum wb_reason reason);
99void inode_wait_for_writeback(struct inode *inode); 102void inode_wait_for_writeback(struct inode *inode);
100 103
diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
new file mode 100644
index 000000000000..760399a470bd
--- /dev/null
+++ b/include/linux/ww_mutex.h
@@ -0,0 +1,378 @@
1/*
2 * Wound/Wait Mutexes: blocking mutual exclusion locks with deadlock avoidance
3 *
4 * Original mutex implementation started by Ingo Molnar:
5 *
6 * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
7 *
8 * Wound/wait implementation:
9 * Copyright (C) 2013 Canonical Ltd.
10 *
11 * This file contains the main data structure and API definitions.
12 */
13
14#ifndef __LINUX_WW_MUTEX_H
15#define __LINUX_WW_MUTEX_H
16
17#include <linux/mutex.h>
18
19struct ww_class {
20 atomic_long_t stamp;
21 struct lock_class_key acquire_key;
22 struct lock_class_key mutex_key;
23 const char *acquire_name;
24 const char *mutex_name;
25};
26
27struct ww_acquire_ctx {
28 struct task_struct *task;
29 unsigned long stamp;
30 unsigned acquired;
31#ifdef CONFIG_DEBUG_MUTEXES
32 unsigned done_acquire;
33 struct ww_class *ww_class;
34 struct ww_mutex *contending_lock;
35#endif
36#ifdef CONFIG_DEBUG_LOCK_ALLOC
37 struct lockdep_map dep_map;
38#endif
39#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH
40 unsigned deadlock_inject_interval;
41 unsigned deadlock_inject_countdown;
42#endif
43};
44
45struct ww_mutex {
46 struct mutex base;
47 struct ww_acquire_ctx *ctx;
48#ifdef CONFIG_DEBUG_MUTEXES
49 struct ww_class *ww_class;
50#endif
51};
52
53#ifdef CONFIG_DEBUG_LOCK_ALLOC
54# define __WW_CLASS_MUTEX_INITIALIZER(lockname, ww_class) \
55 , .ww_class = &ww_class
56#else
57# define __WW_CLASS_MUTEX_INITIALIZER(lockname, ww_class)
58#endif
59
60#define __WW_CLASS_INITIALIZER(ww_class) \
61 { .stamp = ATOMIC_LONG_INIT(0) \
62 , .acquire_name = #ww_class "_acquire" \
63 , .mutex_name = #ww_class "_mutex" }
64
65#define __WW_MUTEX_INITIALIZER(lockname, class) \
66 { .base = { \__MUTEX_INITIALIZER(lockname) } \
67 __WW_CLASS_MUTEX_INITIALIZER(lockname, class) }
68
69#define DEFINE_WW_CLASS(classname) \
70 struct ww_class classname = __WW_CLASS_INITIALIZER(classname)
71
72#define DEFINE_WW_MUTEX(mutexname, ww_class) \
73 struct ww_mutex mutexname = __WW_MUTEX_INITIALIZER(mutexname, ww_class)
74
75/**
76 * ww_mutex_init - initialize the w/w mutex
77 * @lock: the mutex to be initialized
78 * @ww_class: the w/w class the mutex should belong to
79 *
80 * Initialize the w/w mutex to unlocked state and associate it with the given
81 * class.
82 *
83 * It is not allowed to initialize an already locked mutex.
84 */
85static inline void ww_mutex_init(struct ww_mutex *lock,
86 struct ww_class *ww_class)
87{
88 __mutex_init(&lock->base, ww_class->mutex_name, &ww_class->mutex_key);
89 lock->ctx = NULL;
90#ifdef CONFIG_DEBUG_MUTEXES
91 lock->ww_class = ww_class;
92#endif
93}
94
95/**
96 * ww_acquire_init - initialize a w/w acquire context
97 * @ctx: w/w acquire context to initialize
98 * @ww_class: w/w class of the context
99 *
100 * Initializes an context to acquire multiple mutexes of the given w/w class.
101 *
102 * Context-based w/w mutex acquiring can be done in any order whatsoever within
103 * a given lock class. Deadlocks will be detected and handled with the
104 * wait/wound logic.
105 *
106 * Mixing of context-based w/w mutex acquiring and single w/w mutex locking can
107 * result in undetected deadlocks and is so forbidden. Mixing different contexts
108 * for the same w/w class when acquiring mutexes can also result in undetected
109 * deadlocks, and is hence also forbidden. Both types of abuse will be caught by
110 * enabling CONFIG_PROVE_LOCKING.
111 *
112 * Nesting of acquire contexts for _different_ w/w classes is possible, subject
113 * to the usual locking rules between different lock classes.
114 *
115 * An acquire context must be released with ww_acquire_fini by the same task
116 * before the memory is freed. It is recommended to allocate the context itself
117 * on the stack.
118 */
119static inline void ww_acquire_init(struct ww_acquire_ctx *ctx,
120 struct ww_class *ww_class)
121{
122 ctx->task = current;
123 ctx->stamp = atomic_long_inc_return(&ww_class->stamp);
124 ctx->acquired = 0;
125#ifdef CONFIG_DEBUG_MUTEXES
126 ctx->ww_class = ww_class;
127 ctx->done_acquire = 0;
128 ctx->contending_lock = NULL;
129#endif
130#ifdef CONFIG_DEBUG_LOCK_ALLOC
131 debug_check_no_locks_freed((void *)ctx, sizeof(*ctx));
132 lockdep_init_map(&ctx->dep_map, ww_class->acquire_name,
133 &ww_class->acquire_key, 0);
134 mutex_acquire(&ctx->dep_map, 0, 0, _RET_IP_);
135#endif
136#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH
137 ctx->deadlock_inject_interval = 1;
138 ctx->deadlock_inject_countdown = ctx->stamp & 0xf;
139#endif
140}
141
142/**
143 * ww_acquire_done - marks the end of the acquire phase
144 * @ctx: the acquire context
145 *
146 * Marks the end of the acquire phase, any further w/w mutex lock calls using
147 * this context are forbidden.
148 *
149 * Calling this function is optional, it is just useful to document w/w mutex
150 * code and clearly designated the acquire phase from actually using the locked
151 * data structures.
152 */
153static inline void ww_acquire_done(struct ww_acquire_ctx *ctx)
154{
155#ifdef CONFIG_DEBUG_MUTEXES
156 lockdep_assert_held(ctx);
157
158 DEBUG_LOCKS_WARN_ON(ctx->done_acquire);
159 ctx->done_acquire = 1;
160#endif
161}
162
163/**
164 * ww_acquire_fini - releases a w/w acquire context
165 * @ctx: the acquire context to free
166 *
167 * Releases a w/w acquire context. This must be called _after_ all acquired w/w
168 * mutexes have been released with ww_mutex_unlock.
169 */
170static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx)
171{
172#ifdef CONFIG_DEBUG_MUTEXES
173 mutex_release(&ctx->dep_map, 0, _THIS_IP_);
174
175 DEBUG_LOCKS_WARN_ON(ctx->acquired);
176 if (!config_enabled(CONFIG_PROVE_LOCKING))
177 /*
178 * lockdep will normally handle this,
179 * but fail without anyway
180 */
181 ctx->done_acquire = 1;
182
183 if (!config_enabled(CONFIG_DEBUG_LOCK_ALLOC))
184 /* ensure ww_acquire_fini will still fail if called twice */
185 ctx->acquired = ~0U;
186#endif
187}
188
189extern int __must_check __ww_mutex_lock(struct ww_mutex *lock,
190 struct ww_acquire_ctx *ctx);
191extern int __must_check __ww_mutex_lock_interruptible(struct ww_mutex *lock,
192 struct ww_acquire_ctx *ctx);
193
194/**
195 * ww_mutex_lock - acquire the w/w mutex
196 * @lock: the mutex to be acquired
197 * @ctx: w/w acquire context, or NULL to acquire only a single lock.
198 *
199 * Lock the w/w mutex exclusively for this task.
200 *
201 * Deadlocks within a given w/w class of locks are detected and handled with the
202 * wait/wound algorithm. If the lock isn't immediately avaiable this function
203 * will either sleep until it is (wait case). Or it selects the current context
204 * for backing off by returning -EDEADLK (wound case). Trying to acquire the
205 * same lock with the same context twice is also detected and signalled by
206 * returning -EALREADY. Returns 0 if the mutex was successfully acquired.
207 *
208 * In the wound case the caller must release all currently held w/w mutexes for
209 * the given context and then wait for this contending lock to be available by
210 * calling ww_mutex_lock_slow. Alternatively callers can opt to not acquire this
211 * lock and proceed with trying to acquire further w/w mutexes (e.g. when
212 * scanning through lru lists trying to free resources).
213 *
214 * The mutex must later on be released by the same task that
215 * acquired it. The task may not exit without first unlocking the mutex. Also,
216 * kernel memory where the mutex resides must not be freed with the mutex still
217 * locked. The mutex must first be initialized (or statically defined) before it
218 * can be locked. memset()-ing the mutex to 0 is not allowed. The mutex must be
219 * of the same w/w lock class as was used to initialize the acquire context.
220 *
221 * A mutex acquired with this function must be released with ww_mutex_unlock.
222 */
223static inline int ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
224{
225 if (ctx)
226 return __ww_mutex_lock(lock, ctx);
227
228 mutex_lock(&lock->base);
229 return 0;
230}
231
232/**
233 * ww_mutex_lock_interruptible - acquire the w/w mutex, interruptible
234 * @lock: the mutex to be acquired
235 * @ctx: w/w acquire context
236 *
237 * Lock the w/w mutex exclusively for this task.
238 *
239 * Deadlocks within a given w/w class of locks are detected and handled with the
240 * wait/wound algorithm. If the lock isn't immediately avaiable this function
241 * will either sleep until it is (wait case). Or it selects the current context
242 * for backing off by returning -EDEADLK (wound case). Trying to acquire the
243 * same lock with the same context twice is also detected and signalled by
244 * returning -EALREADY. Returns 0 if the mutex was successfully acquired. If a
245 * signal arrives while waiting for the lock then this function returns -EINTR.
246 *
247 * In the wound case the caller must release all currently held w/w mutexes for
248 * the given context and then wait for this contending lock to be available by
249 * calling ww_mutex_lock_slow_interruptible. Alternatively callers can opt to
250 * not acquire this lock and proceed with trying to acquire further w/w mutexes
251 * (e.g. when scanning through lru lists trying to free resources).
252 *
253 * The mutex must later on be released by the same task that
254 * acquired it. The task may not exit without first unlocking the mutex. Also,
255 * kernel memory where the mutex resides must not be freed with the mutex still
256 * locked. The mutex must first be initialized (or statically defined) before it
257 * can be locked. memset()-ing the mutex to 0 is not allowed. The mutex must be
258 * of the same w/w lock class as was used to initialize the acquire context.
259 *
260 * A mutex acquired with this function must be released with ww_mutex_unlock.
261 */
262static inline int __must_check ww_mutex_lock_interruptible(struct ww_mutex *lock,
263 struct ww_acquire_ctx *ctx)
264{
265 if (ctx)
266 return __ww_mutex_lock_interruptible(lock, ctx);
267 else
268 return mutex_lock_interruptible(&lock->base);
269}
270
271/**
272 * ww_mutex_lock_slow - slowpath acquiring of the w/w mutex
273 * @lock: the mutex to be acquired
274 * @ctx: w/w acquire context
275 *
276 * Acquires a w/w mutex with the given context after a wound case. This function
277 * will sleep until the lock becomes available.
278 *
279 * The caller must have released all w/w mutexes already acquired with the
280 * context and then call this function on the contended lock.
281 *
282 * Afterwards the caller may continue to (re)acquire the other w/w mutexes it
283 * needs with ww_mutex_lock. Note that the -EALREADY return code from
284 * ww_mutex_lock can be used to avoid locking this contended mutex twice.
285 *
286 * It is forbidden to call this function with any other w/w mutexes associated
287 * with the context held. It is forbidden to call this on anything else than the
288 * contending mutex.
289 *
290 * Note that the slowpath lock acquiring can also be done by calling
291 * ww_mutex_lock directly. This function here is simply to help w/w mutex
292 * locking code readability by clearly denoting the slowpath.
293 */
294static inline void
295ww_mutex_lock_slow(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
296{
297 int ret;
298#ifdef CONFIG_DEBUG_MUTEXES
299 DEBUG_LOCKS_WARN_ON(!ctx->contending_lock);
300#endif
301 ret = ww_mutex_lock(lock, ctx);
302 (void)ret;
303}
304
305/**
306 * ww_mutex_lock_slow_interruptible - slowpath acquiring of the w/w mutex, interruptible
307 * @lock: the mutex to be acquired
308 * @ctx: w/w acquire context
309 *
310 * Acquires a w/w mutex with the given context after a wound case. This function
311 * will sleep until the lock becomes available and returns 0 when the lock has
312 * been acquired. If a signal arrives while waiting for the lock then this
313 * function returns -EINTR.
314 *
315 * The caller must have released all w/w mutexes already acquired with the
316 * context and then call this function on the contended lock.
317 *
318 * Afterwards the caller may continue to (re)acquire the other w/w mutexes it
319 * needs with ww_mutex_lock. Note that the -EALREADY return code from
320 * ww_mutex_lock can be used to avoid locking this contended mutex twice.
321 *
322 * It is forbidden to call this function with any other w/w mutexes associated
323 * with the given context held. It is forbidden to call this on anything else
324 * than the contending mutex.
325 *
326 * Note that the slowpath lock acquiring can also be done by calling
327 * ww_mutex_lock_interruptible directly. This function here is simply to help
328 * w/w mutex locking code readability by clearly denoting the slowpath.
329 */
330static inline int __must_check
331ww_mutex_lock_slow_interruptible(struct ww_mutex *lock,
332 struct ww_acquire_ctx *ctx)
333{
334#ifdef CONFIG_DEBUG_MUTEXES
335 DEBUG_LOCKS_WARN_ON(!ctx->contending_lock);
336#endif
337 return ww_mutex_lock_interruptible(lock, ctx);
338}
339
340extern void ww_mutex_unlock(struct ww_mutex *lock);
341
342/**
343 * ww_mutex_trylock - tries to acquire the w/w mutex without acquire context
344 * @lock: mutex to lock
345 *
346 * Trylocks a mutex without acquire context, so no deadlock detection is
347 * possible. Returns 1 if the mutex has been acquired successfully, 0 otherwise.
348 */
349static inline int __must_check ww_mutex_trylock(struct ww_mutex *lock)
350{
351 return mutex_trylock(&lock->base);
352}
353
354/***
355 * ww_mutex_destroy - mark a w/w mutex unusable
356 * @lock: the mutex to be destroyed
357 *
358 * This function marks the mutex uninitialized, and any subsequent
359 * use of the mutex is forbidden. The mutex must not be locked when
360 * this function is called.
361 */
362static inline void ww_mutex_destroy(struct ww_mutex *lock)
363{
364 mutex_destroy(&lock->base);
365}
366
367/**
368 * ww_mutex_is_locked - is the w/w mutex locked
369 * @lock: the mutex to be queried
370 *
371 * Returns 1 if the mutex is locked, 0 if unlocked.
372 */
373static inline bool ww_mutex_is_locked(struct ww_mutex *lock)
374{
375 return mutex_is_locked(&lock->base);
376}
377
378#endif
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index fdbafc6841cf..91b0a68d38dc 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -31,7 +31,7 @@ struct xattr_handler {
31}; 31};
32 32
33struct xattr { 33struct xattr {
34 char *name; 34 const char *name;
35 void *value; 35 void *value;
36 size_t value_len; 36 size_t value_len;
37}; 37};
diff --git a/include/linux/zbud.h b/include/linux/zbud.h
new file mode 100644
index 000000000000..2571a5cfa5fc
--- /dev/null
+++ b/include/linux/zbud.h
@@ -0,0 +1,22 @@
1#ifndef _ZBUD_H_
2#define _ZBUD_H_
3
4#include <linux/types.h>
5
6struct zbud_pool;
7
8struct zbud_ops {
9 int (*evict)(struct zbud_pool *pool, unsigned long handle);
10};
11
12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops);
13void zbud_destroy_pool(struct zbud_pool *pool);
14int zbud_alloc(struct zbud_pool *pool, int size, gfp_t gfp,
15 unsigned long *handle);
16void zbud_free(struct zbud_pool *pool, unsigned long handle);
17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries);
18void *zbud_map(struct zbud_pool *pool, unsigned long handle);
19void zbud_unmap(struct zbud_pool *pool, unsigned long handle);
20u64 zbud_get_pool_size(struct zbud_pool *pool);
21
22#endif /* _ZBUD_H_ */