summaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/ABI/testing/configfs-iio21
-rw-r--r--Documentation/ABI/testing/configfs-usb-gadget-sourcesink2
-rw-r--r--Documentation/ABI/testing/configfs-usb-gadget-tcm6
-rw-r--r--Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc24
-rw-r--r--Documentation/ABI/testing/sysfs-bus-usb27
-rw-r--r--Documentation/ABI/testing/sysfs-class-net-cdc_ncm19
-rw-r--r--Documentation/ABI/testing/sysfs-class-net-mesh4
-rw-r--r--Documentation/ABI/testing/sysfs-class-net-qmi23
-rw-r--r--Documentation/ABI/testing/sysfs-class-watchdog51
-rw-r--r--Documentation/ABI/testing/sysfs-fs-f2fs6
-rw-r--r--Documentation/ABI/testing/sysfs-kernel-livepatch6
-rw-r--r--Documentation/ABI/testing/sysfs-ptp2
-rw-r--r--Documentation/CodingStyle2
-rw-r--r--Documentation/DMA-API-HOWTO.txt10
-rw-r--r--Documentation/DMA-API.txt2
-rw-r--r--Documentation/DocBook/Makefile10
-rw-r--r--Documentation/DocBook/device-drivers.tmpl85
-rw-r--r--Documentation/DocBook/gpu.tmpl1003
-rw-r--r--Documentation/DocBook/iio.tmpl2
-rw-r--r--Documentation/DocBook/media/Makefile6
-rw-r--r--Documentation/DocBook/media/dvb/dvbproperty.xml2
-rw-r--r--Documentation/DocBook/media/dvb/examples.xml2
-rw-r--r--Documentation/DocBook/media/dvb/intro.xml2
-rw-r--r--Documentation/DocBook/media/v4l/capture.c.xml2
-rw-r--r--Documentation/DocBook/media/v4l/compat.xml2
-rw-r--r--Documentation/DocBook/media/v4l/io.xml10
-rw-r--r--Documentation/DocBook/media/v4l/media-controller.xml44
-rw-r--r--Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml104
-rw-r--r--Documentation/DocBook/media/v4l/media-ioc-enum-links.xml56
-rw-r--r--Documentation/DocBook/media/v4l/media-ioc-g-topology.xml394
-rw-r--r--Documentation/DocBook/media/v4l/media-types.xml240
-rw-r--r--Documentation/DocBook/media/v4l/v4l2.xml10
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-create-bufs.xml30
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-info.xml2
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml2
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-enumstd.xml2
-rw-r--r--Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml28
-rw-r--r--Documentation/DocBook/media_api.tmpl6
-rw-r--r--Documentation/DocBook/mtdnand.tmpl35
-rw-r--r--Documentation/HOWTO2
-rw-r--r--Documentation/Makefile2
-rw-r--r--Documentation/RCU/Design/Requirements/2013-08-is-it-dead.pngbin0 -> 100825 bytes
-rw-r--r--Documentation/RCU/Design/Requirements/GPpartitionReaders1.svg374
-rw-r--r--Documentation/RCU/Design/Requirements/RCUApplicability.svg237
-rw-r--r--Documentation/RCU/Design/Requirements/ReadersPartitionGP1.svg639
-rw-r--r--Documentation/RCU/Design/Requirements/Requirements.html2897
-rw-r--r--Documentation/RCU/Design/Requirements/Requirements.htmlx2741
-rwxr-xr-xDocumentation/RCU/Design/htmlqqz.sh108
-rw-r--r--Documentation/accounting/getdelays.c3
-rw-r--r--Documentation/arm/Marvell/README19
-rw-r--r--Documentation/arm/pxa/mfp.txt26
-rw-r--r--Documentation/arm64/silicon-errata.txt58
-rw-r--r--Documentation/block/cfq-iosched.txt15
-rw-r--r--Documentation/cgroup-v1/00-INDEX (renamed from Documentation/cgroups/00-INDEX)2
-rw-r--r--Documentation/cgroup-v1/blkio-controller.txt (renamed from Documentation/cgroups/blkio-controller.txt)82
-rw-r--r--Documentation/cgroup-v1/cgroups.txt (renamed from Documentation/cgroups/cgroups.txt)0
-rw-r--r--Documentation/cgroup-v1/cpuacct.txt (renamed from Documentation/cgroups/cpuacct.txt)0
-rw-r--r--Documentation/cgroup-v1/cpusets.txt (renamed from Documentation/cgroups/cpusets.txt)0
-rw-r--r--Documentation/cgroup-v1/devices.txt (renamed from Documentation/cgroups/devices.txt)0
-rw-r--r--Documentation/cgroup-v1/freezer-subsystem.txt (renamed from Documentation/cgroups/freezer-subsystem.txt)0
-rw-r--r--Documentation/cgroup-v1/hugetlb.txt (renamed from Documentation/cgroups/hugetlb.txt)0
-rw-r--r--Documentation/cgroup-v1/memcg_test.txt (renamed from Documentation/cgroups/memcg_test.txt)0
-rw-r--r--Documentation/cgroup-v1/memory.txt (renamed from Documentation/cgroups/memory.txt)0
-rw-r--r--Documentation/cgroup-v1/net_cls.txt (renamed from Documentation/cgroups/net_cls.txt)0
-rw-r--r--Documentation/cgroup-v1/net_prio.txt (renamed from Documentation/cgroups/net_prio.txt)0
-rw-r--r--Documentation/cgroup-v1/pids.txt (renamed from Documentation/cgroups/pids.txt)0
-rw-r--r--Documentation/cgroup-v2.txt1382
-rw-r--r--Documentation/cgroups/unified-hierarchy.txt647
-rw-r--r--Documentation/cpu-freq/intel-pstate.txt241
-rw-r--r--Documentation/cpu-freq/pcc-cpufreq.txt4
-rw-r--r--Documentation/cpu-hotplug.txt2
-rw-r--r--Documentation/device-mapper/verity.txt40
-rw-r--r--Documentation/devicetree/bindings/arm/arm,scpi.txt2
-rw-r--r--Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt4
-rw-r--r--Documentation/devicetree/bindings/arm/bcm/brcm,bcm4708.txt7
-rw-r--r--Documentation/devicetree/bindings/arm/bcm/brcm,nsp-cpu-method.txt39
-rw-r--r--Documentation/devicetree/bindings/arm/compulab-boards.txt25
-rw-r--r--Documentation/devicetree/bindings/arm/cpus.txt21
-rw-r--r--Documentation/devicetree/bindings/arm/fsl.txt4
-rw-r--r--Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt16
-rw-r--r--Documentation/devicetree/bindings/arm/l2c2x0.txt (renamed from Documentation/devicetree/bindings/arm/l2cc.txt)24
-rw-r--r--Documentation/devicetree/bindings/arm/marvell,kirkwood.txt2
-rw-r--r--Documentation/devicetree/bindings/arm/mediatek.txt4
-rw-r--r--Documentation/devicetree/bindings/arm/mediatek/mediatek,infracfg.txt2
-rw-r--r--Documentation/devicetree/bindings/arm/mediatek/mediatek,pericfg.txt2
-rw-r--r--Documentation/devicetree/bindings/arm/omap/omap.txt18
-rw-r--r--Documentation/devicetree/bindings/arm/pmu.txt5
-rw-r--r--Documentation/devicetree/bindings/arm/psci.txt25
-rw-r--r--Documentation/devicetree/bindings/arm/rockchip.txt26
-rw-r--r--Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt3
-rw-r--r--Documentation/devicetree/bindings/arm/scu.txt3
-rw-r--r--Documentation/devicetree/bindings/arm/secure.txt53
-rw-r--r--Documentation/devicetree/bindings/arm/shmobile.txt4
-rw-r--r--Documentation/devicetree/bindings/arm/technologic.txt6
-rw-r--r--Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt4
-rw-r--r--Documentation/devicetree/bindings/ata/sata_rcar.txt1
-rw-r--r--Documentation/devicetree/bindings/bus/uniphier-system-bus.txt66
-rw-r--r--Documentation/devicetree/bindings/clock/arm-syscon-icst.txt40
-rw-r--r--Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt31
-rw-r--r--Documentation/devicetree/bindings/clock/brcm,iproc-clocks.txt5
-rw-r--r--Documentation/devicetree/bindings/clock/cs2000-cp.txt22
-rw-r--r--Documentation/devicetree/bindings/clock/dove-divider-clock.txt28
-rw-r--r--Documentation/devicetree/bindings/clock/nvidia,tegra210-car.txt56
-rw-r--r--Documentation/devicetree/bindings/clock/nxp,lpc3220-clk.txt30
-rw-r--r--Documentation/devicetree/bindings/clock/nxp,lpc3220-usb-clk.txt22
-rw-r--r--Documentation/devicetree/bindings/clock/qcom,gcc.txt1
-rw-r--r--Documentation/devicetree/bindings/clock/qcom,mmcc.txt1
-rw-r--r--Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt4
-rw-r--r--Documentation/devicetree/bindings/clock/renesas,h8300-div-clock.txt2
-rw-r--r--Documentation/devicetree/bindings/clock/rockchip,rk3036-cru.txt56
-rw-r--r--Documentation/devicetree/bindings/clock/rockchip,rk3228-cru.txt58
-rw-r--r--Documentation/devicetree/bindings/clock/samsung,s2mps11.txt49
-rw-r--r--Documentation/devicetree/bindings/clock/sunxi.txt10
-rw-r--r--Documentation/devicetree/bindings/clock/tango4-clock.txt23
-rw-r--r--Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt2
-rw-r--r--Documentation/devicetree/bindings/cpufreq/cpufreq-dt.txt2
-rw-r--r--Documentation/devicetree/bindings/cpufreq/cpufreq-st.txt91
-rw-r--r--Documentation/devicetree/bindings/crypto/rockchip-crypto.txt29
-rw-r--r--Documentation/devicetree/bindings/display/bridge/tda998x.txt4
-rw-r--r--Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt54
-rw-r--r--Documentation/devicetree/bindings/display/exynos/exynos_dp.txt41
-rw-r--r--Documentation/devicetree/bindings/display/exynos/exynos_hdmi.txt7
-rw-r--r--Documentation/devicetree/bindings/display/msm/dsi.txt12
-rw-r--r--Documentation/devicetree/bindings/display/msm/mdp.txt26
-rw-r--r--Documentation/devicetree/bindings/display/panel/boe,tv080wum-nl0.txt7
-rw-r--r--Documentation/devicetree/bindings/display/panel/innolux,g121x1-l03.txt7
-rw-r--r--Documentation/devicetree/bindings/display/panel/kyo,tcg121xglp.txt7
-rw-r--r--Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt20
-rw-r--r--Documentation/devicetree/bindings/display/panel/qiaodian,qd43003c0-40.txt7
-rw-r--r--Documentation/devicetree/bindings/display/panel/sharp,ls043t1le01.txt22
-rw-r--r--Documentation/devicetree/bindings/display/panel/startek,startek-kd050c.txt4
-rw-r--r--Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt60
-rw-r--r--Documentation/devicetree/bindings/display/rockchip/rockchip-vop.txt1
-rw-r--r--Documentation/devicetree/bindings/display/simple-framebuffer.txt13
-rw-r--r--Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt13
-rw-r--r--Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt10
-rw-r--r--Documentation/devicetree/bindings/dma/stm32-dma.txt82
-rw-r--r--Documentation/devicetree/bindings/dma/ti-dma-crossbar.txt6
-rw-r--r--Documentation/devicetree/bindings/eeprom/eeprom.txt21
-rw-r--r--Documentation/devicetree/bindings/extcon/extcon-arizona.txt60
-rw-r--r--Documentation/devicetree/bindings/extcon/extcon-max3355.txt21
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio-pca953x.txt1
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio-sx150x.txt3
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio-tps65086.txt16
-rw-r--r--Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt2
-rw-r--r--Documentation/devicetree/bindings/i2c/i2c-at91.txt5
-rw-r--r--Documentation/devicetree/bindings/i2c/i2c-brcmstb.txt2
-rw-r--r--Documentation/devicetree/bindings/i2c/i2c-rcar.txt4
-rw-r--r--Documentation/devicetree/bindings/i2c/i2c.txt36
-rw-r--r--Documentation/devicetree/bindings/i2c/trivial-devices.txt16
-rw-r--r--Documentation/devicetree/bindings/iio/accel/mma8452.txt6
-rw-r--r--Documentation/devicetree/bindings/iio/adc/imx7d-adc.txt22
-rw-r--r--Documentation/devicetree/bindings/iio/adc/mcp320x.txt30
-rw-r--r--Documentation/devicetree/bindings/iio/adc/mcp3422.txt3
-rw-r--r--Documentation/devicetree/bindings/iio/adc/palmas-gpadc.txt48
-rw-r--r--Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt4
-rw-r--r--Documentation/devicetree/bindings/iio/adc/ti-ads8688.txt20
-rw-r--r--Documentation/devicetree/bindings/iio/health/max30100.txt21
-rw-r--r--Documentation/devicetree/bindings/iio/light/us5182d.txt11
-rw-r--r--Documentation/devicetree/bindings/iio/st-sensors.txt1
-rw-r--r--Documentation/devicetree/bindings/input/gpio-keys.txt1
-rw-r--r--Documentation/devicetree/bindings/input/touchscreen/goodix.txt14
-rw-r--r--Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt4
-rw-r--r--Documentation/devicetree/bindings/input/touchscreen/ts4800-ts.txt11
-rw-r--r--Documentation/devicetree/bindings/interrupt-controller/allwinner,sunxi-nmi.txt (renamed from Documentation/devicetree/bindings/interrupt-controller/allwinner,sun67i-sc-nmi.txt)2
-rw-r--r--Documentation/devicetree/bindings/interrupt-controller/arm,gic.txt1
-rw-r--r--Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt74
-rw-r--r--Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt1
-rw-r--r--Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt2
-rw-r--r--Documentation/devicetree/bindings/interrupt-controller/technologic,ts4800.txt16
-rw-r--r--Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt12
-rw-r--r--Documentation/devicetree/bindings/media/exynos5-gsc.txt4
-rw-r--r--Documentation/devicetree/bindings/media/i2c/adp1653.txt7
-rw-r--r--Documentation/devicetree/bindings/media/stih407-c8sectpfe.txt20
-rw-r--r--Documentation/devicetree/bindings/memory-controllers/ath79-ddr-controller.txt8
-rw-r--r--Documentation/devicetree/bindings/mfd/arizona.txt24
-rw-r--r--Documentation/devicetree/bindings/mfd/palmas.txt2
-rw-r--r--Documentation/devicetree/bindings/mfd/s2mpa01.txt90
-rw-r--r--Documentation/devicetree/bindings/mfd/s2mps11.txt153
-rw-r--r--Documentation/devicetree/bindings/mfd/samsung,sec-core.txt88
-rw-r--r--Documentation/devicetree/bindings/mfd/syscon.txt4
-rw-r--r--Documentation/devicetree/bindings/mmc/renesas,mmcif.txt1
-rw-r--r--Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt32
-rw-r--r--Documentation/devicetree/bindings/mtd/fsl-quadspi.txt3
-rw-r--r--Documentation/devicetree/bindings/mtd/ingenic,jz4780-nand.txt86
-rw-r--r--Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt56
-rw-r--r--Documentation/devicetree/bindings/mtd/mtk-quadspi.txt41
-rw-r--r--Documentation/devicetree/bindings/mtd/partition.txt2
-rw-r--r--Documentation/devicetree/bindings/net/cdns-emac.txt20
-rw-r--r--Documentation/devicetree/bindings/net/cpsw.txt6
-rw-r--r--Documentation/devicetree/bindings/net/dsa/dsa.txt3
-rw-r--r--Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt7
-rw-r--r--Documentation/devicetree/bindings/net/ieee802154/adf7242.txt18
-rw-r--r--Documentation/devicetree/bindings/net/macb.txt11
-rw-r--r--Documentation/devicetree/bindings/net/micrel-ksz90x1.txt17
-rw-r--r--Documentation/devicetree/bindings/net/nfc/st95hf.txt50
-rw-r--r--Documentation/devicetree/bindings/net/renesas,ravb.txt12
-rw-r--r--Documentation/devicetree/bindings/net/socfpga-dwmac.txt2
-rw-r--r--Documentation/devicetree/bindings/net/stmmac.txt25
-rw-r--r--Documentation/devicetree/bindings/opp/opp.txt132
-rw-r--r--Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt40
-rw-r--r--Documentation/devicetree/bindings/pci/hisilicon-pcie.txt8
-rw-r--r--Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt17
-rw-r--r--Documentation/devicetree/bindings/pci/qcom,pcie.txt233
-rw-r--r--Documentation/devicetree/bindings/pci/rcar-pci.txt14
-rw-r--r--Documentation/devicetree/bindings/phy/brcm,brcmstb-sata-phy.txt1
-rw-r--r--Documentation/devicetree/bindings/phy/phy-hi6220-usb.txt16
-rw-r--r--Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt39
-rw-r--r--Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt6
-rw-r--r--Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt1
-rw-r--r--Documentation/devicetree/bindings/phy/ti-phy.txt20
-rw-r--r--Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt3
-rw-r--r--Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt (renamed from Documentation/devicetree/bindings/pinctrl/brcm,cygnus-gpio.txt)9
-rw-r--r--Documentation/devicetree/bindings/pinctrl/brcm,nsp-gpio.txt80
-rw-r--r--Documentation/devicetree/bindings/pinctrl/lantiq,pinctrl-xway.txt110
-rw-r--r--Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt9
-rw-r--r--Documentation/devicetree/bindings/pinctrl/qcom,msm8996-pinctrl.txt199
-rw-r--r--Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.txt2
-rw-r--r--Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.txt1
-rw-r--r--Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt3
-rw-r--r--Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt1
-rw-r--r--Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt9
-rw-r--r--Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt18
-rw-r--r--Documentation/devicetree/bindings/regulator/lm363x-regulator.txt34
-rw-r--r--Documentation/devicetree/bindings/regulator/pv88060.txt124
-rw-r--r--Documentation/devicetree/bindings/regulator/pv88090.txt65
-rw-r--r--Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt (renamed from Documentation/devicetree/bindings/soc/qcom,smd-rpm.txt)84
-rw-r--r--Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt163
-rw-r--r--Documentation/devicetree/bindings/regulator/samsung,s2mpa01.txt79
-rw-r--r--Documentation/devicetree/bindings/regulator/samsung,s2mps11.txt102
-rw-r--r--Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt145
-rw-r--r--Documentation/devicetree/bindings/regulator/tps65217.txt10
-rw-r--r--Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt34
-rw-r--r--Documentation/devicetree/bindings/scsi/hisilicon-sas.txt69
-rw-r--r--Documentation/devicetree/bindings/serial/8250.txt1
-rw-r--r--Documentation/devicetree/bindings/serial/mtk-uart.txt14
-rw-r--r--Documentation/devicetree/bindings/serial/renesas,sci-serial.txt44
-rw-r--r--Documentation/devicetree/bindings/soc/bcm/raspberrypi,bcm2835-power.txt47
-rw-r--r--Documentation/devicetree/bindings/soc/dove/pmu.txt56
-rw-r--r--Documentation/devicetree/bindings/soc/mediatek/scpsys.txt12
-rw-r--r--Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt58
-rw-r--r--Documentation/devicetree/bindings/soc/qcom/qcom,smp2p.txt104
-rw-r--r--Documentation/devicetree/bindings/soc/qcom/qcom,smsm.txt104
-rw-r--r--Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt57
-rw-r--r--Documentation/devicetree/bindings/sound/ak4613.txt10
-rw-r--r--Documentation/devicetree/bindings/sound/atmel-classd.txt6
-rw-r--r--Documentation/devicetree/bindings/sound/atmel-pdmic.txt55
-rw-r--r--Documentation/devicetree/bindings/sound/da7218.txt104
-rw-r--r--Documentation/devicetree/bindings/sound/da7219.txt8
-rw-r--r--Documentation/devicetree/bindings/sound/fsl,asrc.txt5
-rw-r--r--Documentation/devicetree/bindings/sound/fsl,esai.txt5
-rw-r--r--Documentation/devicetree/bindings/sound/fsl,spdif.txt5
-rw-r--r--Documentation/devicetree/bindings/sound/img,i2s-in.txt47
-rw-r--r--Documentation/devicetree/bindings/sound/img,i2s-out.txt51
-rw-r--r--Documentation/devicetree/bindings/sound/img,parallel-out.txt44
-rw-r--r--Documentation/devicetree/bindings/sound/img,pistachio-internal-dac.txt18
-rw-r--r--Documentation/devicetree/bindings/sound/img,spdif-in.txt41
-rw-r--r--Documentation/devicetree/bindings/sound/img,spdif-out.txt44
-rw-r--r--Documentation/devicetree/bindings/sound/inno-rk3036.txt20
-rw-r--r--Documentation/devicetree/bindings/sound/pcm179x.txt (renamed from Documentation/devicetree/bindings/sound/pcm1792a.txt)2
-rw-r--r--Documentation/devicetree/bindings/sound/renesas,rsnd.txt82
-rw-r--r--Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt4
-rw-r--r--Documentation/devicetree/bindings/sound/rockchip-i2s.txt2
-rw-r--r--Documentation/devicetree/bindings/sound/rt5616.txt26
-rw-r--r--Documentation/devicetree/bindings/sound/rt5651.txt41
-rw-r--r--Documentation/devicetree/bindings/sound/rt5659.txt75
-rw-r--r--Documentation/devicetree/bindings/sound/rt5677.txt2
-rw-r--r--Documentation/devicetree/bindings/sound/sun4i-codec.txt3
-rw-r--r--Documentation/devicetree/bindings/sound/ti,pcm3168a.txt48
-rw-r--r--Documentation/devicetree/bindings/sound/wlf,wm8974.txt15
-rw-r--r--Documentation/devicetree/bindings/sound/wm8994.txt2
-rw-r--r--Documentation/devicetree/bindings/spi/sh-msiof.txt1
-rw-r--r--Documentation/devicetree/bindings/spi/spi-mt65xx.txt9
-rw-r--r--Documentation/devicetree/bindings/spi/ti_qspi.txt22
-rw-r--r--Documentation/devicetree/bindings/sram/rockchip-pmu-sram.txt (renamed from Documentation/devicetree/bindings/arm/rockchip/pmu-sram.txt)0
-rw-r--r--Documentation/devicetree/bindings/sram/rockchip-smp-sram.txt (renamed from Documentation/devicetree/bindings/arm/rockchip/smp-sram.txt)2
-rw-r--r--Documentation/devicetree/bindings/sram/samsung-sram.txt (renamed from Documentation/devicetree/bindings/arm/exynos/smp-sysram.txt)2
-rw-r--r--Documentation/devicetree/bindings/sram/sram.txt (renamed from Documentation/devicetree/bindings/misc/sram.txt)0
-rw-r--r--Documentation/devicetree/bindings/sram/sunxi-sram.txt (renamed from Documentation/devicetree/bindings/soc/sunxi/sram.txt)2
-rw-r--r--Documentation/devicetree/bindings/staging/ion/hi6220-ion.txt31
-rw-r--r--Documentation/devicetree/bindings/thermal/qoriq-thermal.txt63
-rw-r--r--Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt1
-rw-r--r--Documentation/devicetree/bindings/usb/dwc2.txt1
-rw-r--r--Documentation/devicetree/bindings/usb/dwc3-xilinx.txt33
-rw-r--r--Documentation/devicetree/bindings/usb/mt8173-xhci.txt51
-rw-r--r--Documentation/devicetree/bindings/usb/octeon-usb.txt62
-rw-r--r--Documentation/devicetree/bindings/usb/renesas_usb3.txt23
-rw-r--r--Documentation/devicetree/bindings/usb/renesas_usbhs.txt22
-rw-r--r--Documentation/devicetree/bindings/usb/usb-xhci.txt4
-rw-r--r--Documentation/devicetree/bindings/usb/usb3503.txt5
-rw-r--r--Documentation/devicetree/bindings/vendor-prefixes.txt8
-rw-r--r--Documentation/devicetree/bindings/watchdog/alphascale-asm9260.txt35
-rw-r--r--Documentation/devicetree/bindings/watchdog/meson-wdt.txt (renamed from Documentation/devicetree/bindings/watchdog/meson6-wdt.txt)2
-rw-r--r--Documentation/devicetree/bindings/watchdog/mt7621-wdt.txt12
-rw-r--r--Documentation/devicetree/bindings/watchdog/mtk-wdt.txt6
-rw-r--r--Documentation/devicetree/bindings/watchdog/sigma,smp8642-wdt.txt18
-rw-r--r--Documentation/devicetree/bindings/watchdog/sp805-wdt.txt31
-rw-r--r--Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt25
-rw-r--r--Documentation/devicetree/bindings/watchdog/ziirave-wdt.txt19
-rw-r--r--Documentation/dmaengine/client.txt59
-rw-r--r--Documentation/dmaengine/provider.txt20
-rw-r--r--Documentation/dvb/README.dvb-usb4
-rw-r--r--Documentation/dvb/faq.txt2
-rwxr-xr-xDocumentation/dvb/get_dvb_firmware22
-rw-r--r--Documentation/dvb/readme.txt10
-rw-r--r--Documentation/edac.txt10
-rw-r--r--Documentation/fault-injection/notifier-error-inject.txt25
-rw-r--r--Documentation/features/io/dma_map_attrs/arch-support.txt40
-rw-r--r--Documentation/features/seccomp/seccomp-filter/arch-support.txt2
-rw-r--r--Documentation/features/time/irq-time-acct/arch-support.txt2
-rw-r--r--Documentation/features/vm/pmdp_splitting_flush/arch-support.txt40
-rw-r--r--Documentation/filesystems/Locking6
-rw-r--r--Documentation/filesystems/configfs/configfs.txt57
-rw-r--r--Documentation/filesystems/f2fs.txt10
-rw-r--r--Documentation/filesystems/porting21
-rw-r--r--Documentation/filesystems/proc.txt25
-rw-r--r--Documentation/filesystems/sharedsubtree.txt2
-rw-r--r--Documentation/filesystems/tmpfs.txt8
-rw-r--r--Documentation/filesystems/vfat.txt10
-rw-r--r--Documentation/filesystems/vfs.txt21
-rw-r--r--Documentation/gpio/consumer.txt2
-rw-r--r--Documentation/gpio/driver.txt6
-rw-r--r--Documentation/gpio/drivers-on-gpio.txt6
-rw-r--r--Documentation/hwmon/htu2146
-rw-r--r--Documentation/hwmon/ltc381561
-rw-r--r--Documentation/iio/iio_configfs.txt93
-rw-r--r--Documentation/ioctl/botching-up-ioctls.txt6
-rw-r--r--Documentation/ja_JP/HOWTO3
-rw-r--r--Documentation/kernel-docs.txt2
-rw-r--r--Documentation/kernel-parameters.txt97
-rw-r--r--Documentation/ko_KR/HOWTO29
-rw-r--r--Documentation/leds/leds-class.txt13
-rw-r--r--Documentation/md-cluster.txt314
-rw-r--r--Documentation/media-framework.txt372
-rw-r--r--Documentation/memory-barriers.txt40
-rw-r--r--Documentation/mtd/nand_ecc.txt58
-rw-r--r--Documentation/networking/batman-adv.txt9
-rw-r--r--Documentation/networking/can.txt9
-rw-r--r--Documentation/networking/ip-sysctl.txt31
-rw-r--r--Documentation/networking/switchdev.txt8
-rw-r--r--Documentation/power/pci.txt2
-rw-r--r--Documentation/power/runtime_pm.txt6
-rw-r--r--Documentation/printk-formats.txt15
-rw-r--r--Documentation/s390/zfcpdump.txt22
-rw-r--r--Documentation/security/keys-trusted-encrypted.txt31
-rw-r--r--Documentation/sound/alsa/img,spdif-in.txt49
-rw-r--r--Documentation/spi/.gitignore2
-rw-r--r--Documentation/spi/00-INDEX4
-rw-r--r--Documentation/spi/Makefile8
-rw-r--r--Documentation/spi/spidev_fdx.c158
-rw-r--r--Documentation/spi/spidev_test.c318
-rw-r--r--Documentation/stable_kernel_rules.txt2
-rw-r--r--Documentation/sysctl/fs.txt23
-rw-r--r--Documentation/sysctl/kernel.txt30
-rw-r--r--Documentation/sysctl/vm.txt33
-rw-r--r--Documentation/thermal/sysfs-api.txt1
-rw-r--r--Documentation/trace/events-msr.txt37
-rw-r--r--Documentation/trace/postprocess/decode_msr.py37
-rw-r--r--Documentation/ubsan.txt84
-rw-r--r--Documentation/usb/chipidea.txt4
-rw-r--r--Documentation/usb/gadget-testing.txt4
-rw-r--r--Documentation/usb/power-management.txt11
-rw-r--r--Documentation/video4linux/API.html2
-rw-r--r--Documentation/video4linux/CARDLIST.em28xx4
-rw-r--r--Documentation/video4linux/fimc.txt6
-rw-r--r--Documentation/video4linux/omap4_camera.txt2
-rw-r--r--Documentation/video4linux/si4713.txt2
-rw-r--r--Documentation/video4linux/v4l2-framework.txt12
-rw-r--r--Documentation/video4linux/v4l2-pci-skeleton.c13
-rw-r--r--Documentation/virtual/kvm/api.txt41
-rw-r--r--Documentation/virtual/kvm/devices/vm.txt3
-rw-r--r--Documentation/virtual/kvm/mmu.txt4
-rw-r--r--Documentation/vm/slub.txt2
-rw-r--r--Documentation/vm/transhuge.txt151
-rw-r--r--Documentation/watchdog/watchdog-kernel-api.txt77
-rw-r--r--Documentation/zh_CN/video4linux/v4l2-framework.txt8
376 files changed, 16691 insertions, 4169 deletions
diff --git a/Documentation/ABI/testing/configfs-iio b/Documentation/ABI/testing/configfs-iio
new file mode 100644
index 000000000000..2483756fccf5
--- /dev/null
+++ b/Documentation/ABI/testing/configfs-iio
@@ -0,0 +1,21 @@
1What: /config/iio
2Date: October 2015
3KernelVersion: 4.4
4Contact: linux-iio@vger.kernel.org
5Description:
6 This represents Industrial IO configuration entry point
7 directory. It contains sub-groups corresponding to IIO
8 objects.
9
10What: /config/iio/triggers
11Date: October 2015
12KernelVersion: 4.4
13Description:
14 Industrial IO software triggers directory.
15
16What: /config/iio/triggers/hrtimers
17Date: October 2015
18KernelVersion: 4.4
19Description:
20 High resolution timers directory. Creating a directory here
21 will result in creating a hrtimer trigger in the IIO subsystem.
diff --git a/Documentation/ABI/testing/configfs-usb-gadget-sourcesink b/Documentation/ABI/testing/configfs-usb-gadget-sourcesink
index bc7ff731aa0c..f56335af2d88 100644
--- a/Documentation/ABI/testing/configfs-usb-gadget-sourcesink
+++ b/Documentation/ABI/testing/configfs-usb-gadget-sourcesink
@@ -10,3 +10,5 @@ Description:
10 isoc_mult - 0..2 (hs/ss only) 10 isoc_mult - 0..2 (hs/ss only)
11 isoc_maxburst - 0..15 (ss only) 11 isoc_maxburst - 0..15 (ss only)
12 buflen - buffer length 12 buflen - buffer length
13 bulk_qlen - depth of queue for bulk
14 iso_qlen - depth of queue for iso
diff --git a/Documentation/ABI/testing/configfs-usb-gadget-tcm b/Documentation/ABI/testing/configfs-usb-gadget-tcm
new file mode 100644
index 000000000000..a29ed2dd6173
--- /dev/null
+++ b/Documentation/ABI/testing/configfs-usb-gadget-tcm
@@ -0,0 +1,6 @@
1What: /config/usb-gadget/gadget/functions/tcm.name
2Date: Dec 2015
3KernelVersion: 4.5
4Description:
5 There are no attributes because all the configuration
6 is performed in the "target" subsystem of configfs.
diff --git a/Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc b/Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc
new file mode 100644
index 000000000000..8916f7ec6507
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc
@@ -0,0 +1,24 @@
1What: /sys/bus/iio/devices/iio:deviceX/in_allow_async_readout
2Date: December 2015
3KernelVersion: 4.4
4Contact: linux-iio@vger.kernel.org
5Description:
6 By default (value '0'), the capture thread checks for the Conversion
7 Ready Flag to being set prior to committing a new value to the sample
8 buffer. This synchronizes the in-chip conversion rate with the
9 in-driver readout rate at the cost of an additional register read.
10
11 Writing '1' will remove the polling for the Conversion Ready Flags to
12 save the additional i2c transaction, which will improve the bandwidth
13 available for reading data. However, samples can be occasionally skipped
14 or repeated, depending on the beat between the capture and conversion
15 rates.
16
17What: /sys/bus/iio/devices/iio:deviceX/in_shunt_resistor
18Date: December 2015
19KernelVersion: 4.4
20Contact: linux-iio@vger.kernel.org
21Description:
22 The value of the shunt resistor may be known only at runtime fom an
23 eeprom content read by a client application. This attribute allows to
24 set its value in ohms.
diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb
index 3a4abfc44f5e..0bd731cbb50c 100644
--- a/Documentation/ABI/testing/sysfs-bus-usb
+++ b/Documentation/ABI/testing/sysfs-bus-usb
@@ -134,19 +134,21 @@ Description:
134 enabled for the device. Developer can write y/Y/1 or n/N/0 to 134 enabled for the device. Developer can write y/Y/1 or n/N/0 to
135 the file to enable/disable the feature. 135 the file to enable/disable the feature.
136 136
137What: /sys/bus/usb/devices/.../power/usb3_hardware_lpm 137What: /sys/bus/usb/devices/.../power/usb3_hardware_lpm_u1
138Date: June 2015 138 /sys/bus/usb/devices/.../power/usb3_hardware_lpm_u2
139Date: November 2015
139Contact: Kevin Strasser <kevin.strasser@linux.intel.com> 140Contact: Kevin Strasser <kevin.strasser@linux.intel.com>
141 Lu Baolu <baolu.lu@linux.intel.com>
140Description: 142Description:
141 If CONFIG_PM is set and a USB 3.0 lpm-capable device is plugged 143 If CONFIG_PM is set and a USB 3.0 lpm-capable device is plugged
142 in to a xHCI host which supports link PM, it will check if U1 144 in to a xHCI host which supports link PM, it will check if U1
143 and U2 exit latencies have been set in the BOS descriptor; if 145 and U2 exit latencies have been set in the BOS descriptor; if
144 the check is is passed and the host supports USB3 hardware LPM, 146 the check is passed and the host supports USB3 hardware LPM,
145 USB3 hardware LPM will be enabled for the device and the USB 147 USB3 hardware LPM will be enabled for the device and the USB
146 device directory will contain a file named 148 device directory will contain two files named
147 power/usb3_hardware_lpm. The file holds a string value (enable 149 power/usb3_hardware_lpm_u1 and power/usb3_hardware_lpm_u2. These
148 or disable) indicating whether or not USB3 hardware LPM is 150 files hold a string value (enable or disable) indicating whether
149 enabled for the device. 151 or not USB3 hardware LPM U1 or U2 is enabled for the device.
150 152
151What: /sys/bus/usb/devices/.../removable 153What: /sys/bus/usb/devices/.../removable
152Date: February 2012 154Date: February 2012
@@ -187,6 +189,17 @@ Description:
187 The file will read "hotplug", "wired" and "not used" if the 189 The file will read "hotplug", "wired" and "not used" if the
188 information is available, and "unknown" otherwise. 190 information is available, and "unknown" otherwise.
189 191
192What: /sys/bus/usb/devices/.../(hub interface)/portX/usb3_lpm_permit
193Date: November 2015
194Contact: Lu Baolu <baolu.lu@linux.intel.com>
195Description:
196 Some USB3.0 devices are not friendly to USB3 LPM. usb3_lpm_permit
197 attribute allows enabling/disabling usb3 lpm of a port. It takes
198 effect both before and after a usb device is enumerated. Supported
199 values are "0" if both u1 and u2 are NOT permitted, "u1" if only u1
200 is permitted, "u2" if only u2 is permitted, "u1_u2" if both u1 and
201 u2 are permitted.
202
190What: /sys/bus/usb/devices/.../power/usb2_lpm_l1_timeout 203What: /sys/bus/usb/devices/.../power/usb2_lpm_l1_timeout
191Date: May 2013 204Date: May 2013
192Contact: Mathias Nyman <mathias.nyman@linux.intel.com> 205Contact: Mathias Nyman <mathias.nyman@linux.intel.com>
diff --git a/Documentation/ABI/testing/sysfs-class-net-cdc_ncm b/Documentation/ABI/testing/sysfs-class-net-cdc_ncm
index 5cedf72df358..f7be0e88b139 100644
--- a/Documentation/ABI/testing/sysfs-class-net-cdc_ncm
+++ b/Documentation/ABI/testing/sysfs-class-net-cdc_ncm
@@ -19,6 +19,25 @@ Description:
19 Set to 0 to pad all frames. Set greater than tx_max to 19 Set to 0 to pad all frames. Set greater than tx_max to
20 disable all padding. 20 disable all padding.
21 21
22What: /sys/class/net/<iface>/cdc_ncm/ndp_to_end
23Date: Dec 2015
24KernelVersion: 4.5
25Contact: Bjørn Mork <bjorn@mork.no>
26Description:
27 Boolean attribute showing the status of the "NDP to
28 end" quirk. Defaults to 'N', except for devices
29 already known to need it enabled.
30
31 The "NDP to end" quirk makes the driver place the NDP
32 (the packet index table) after the payload. The NCM
33 specification does not mandate this, but some devices
34 are known to be more restrictive. Write 'Y' to this
35 attribute for temporary testing of a suspect device
36 failing to work with the default driver settings.
37
38 A device entry should be added to the driver if this
39 quirk is found to be required.
40
22What: /sys/class/net/<iface>/cdc_ncm/rx_max 41What: /sys/class/net/<iface>/cdc_ncm/rx_max
23Date: May 2014 42Date: May 2014
24KernelVersion: 3.16 43KernelVersion: 3.16
diff --git a/Documentation/ABI/testing/sysfs-class-net-mesh b/Documentation/ABI/testing/sysfs-class-net-mesh
index c46406296631..c2b956d44a95 100644
--- a/Documentation/ABI/testing/sysfs-class-net-mesh
+++ b/Documentation/ABI/testing/sysfs-class-net-mesh
@@ -8,7 +8,7 @@ Description:
8 8
9What: /sys/class/net/<mesh_iface>/mesh/<vlan_subdir>/ap_isolation 9What: /sys/class/net/<mesh_iface>/mesh/<vlan_subdir>/ap_isolation
10Date: May 2011 10Date: May 2011
11Contact: Antonio Quartulli <antonio@meshcoding.com> 11Contact: Antonio Quartulli <a@unstable.cc>
12Description: 12Description:
13 Indicates whether the data traffic going from a 13 Indicates whether the data traffic going from a
14 wireless client to another wireless client will be 14 wireless client to another wireless client will be
@@ -70,7 +70,7 @@ Description:
70 70
71What: /sys/class/net/<mesh_iface>/mesh/isolation_mark 71What: /sys/class/net/<mesh_iface>/mesh/isolation_mark
72Date: Nov 2013 72Date: Nov 2013
73Contact: Antonio Quartulli <antonio@meshcoding.com> 73Contact: Antonio Quartulli <a@unstable.cc>
74Description: 74Description:
75 Defines the isolation mark (and its bitmask) which 75 Defines the isolation mark (and its bitmask) which
76 is used to classify clients as "isolated" by the 76 is used to classify clients as "isolated" by the
diff --git a/Documentation/ABI/testing/sysfs-class-net-qmi b/Documentation/ABI/testing/sysfs-class-net-qmi
new file mode 100644
index 000000000000..fa5a00bb1143
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-class-net-qmi
@@ -0,0 +1,23 @@
1What: /sys/class/net/<iface>/qmi/raw_ip
2Date: Dec 2015
3KernelVersion: 4.4
4Contact: Bjørn Mork <bjorn@mork.no>
5Description:
6 Boolean. Default: 'N'
7
8 Set this to 'Y' to change the network device link
9 framing from '802.3' to 'raw-ip'.
10
11 The netdev will change to reflect the link framing
12 mode. The netdev is an ordinary ethernet device in
13 '802.3' mode, and the driver expects to exchange
14 frames with an ethernet header over the USB link. The
15 netdev is a headerless p-t-p device in 'raw-ip' mode,
16 and the driver expects to echange IPv4 or IPv6 packets
17 without any L2 header over the USB link.
18
19 Userspace is in full control of firmware configuration
20 through the delegation of the QMI protocol. Userspace
21 is responsible for coordination of driver and firmware
22 link framing mode, changing this setting to 'Y' if the
23 firmware is configured for 'raw-ip' mode.
diff --git a/Documentation/ABI/testing/sysfs-class-watchdog b/Documentation/ABI/testing/sysfs-class-watchdog
new file mode 100644
index 000000000000..736046b33040
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-class-watchdog
@@ -0,0 +1,51 @@
1What: /sys/class/watchdog/watchdogn/bootstatus
2Date: August 2015
3Contact: Wim Van Sebroeck <wim@iguana.be>
4Description:
5 It is a read only file. It contains status of the watchdog
6 device at boot. It is equivalent to WDIOC_GETBOOTSTATUS of
7 ioctl interface.
8
9What: /sys/class/watchdog/watchdogn/identity
10Date: August 2015
11Contact: Wim Van Sebroeck <wim@iguana.be>
12Description:
13 It is a read only file. It contains identity string of
14 watchdog device.
15
16What: /sys/class/watchdog/watchdogn/nowayout
17Date: August 2015
18Contact: Wim Van Sebroeck <wim@iguana.be>
19Description:
20 It is a read only file. While reading, it gives '1' if that
21 device supports nowayout feature else, it gives '0'.
22
23What: /sys/class/watchdog/watchdogn/state
24Date: August 2015
25Contact: Wim Van Sebroeck <wim@iguana.be>
26Description:
27 It is a read only file. It gives active/inactive status of
28 watchdog device.
29
30What: /sys/class/watchdog/watchdogn/status
31Date: August 2015
32Contact: Wim Van Sebroeck <wim@iguana.be>
33Description:
34 It is a read only file. It contains watchdog device's
35 internal status bits. It is equivalent to WDIOC_GETSTATUS
36 of ioctl interface.
37
38What: /sys/class/watchdog/watchdogn/timeleft
39Date: August 2015
40Contact: Wim Van Sebroeck <wim@iguana.be>
41Description:
42 It is a read only file. It contains value of time left for
43 reset generation. It is equivalent to WDIOC_GETTIMELEFT of
44 ioctl interface.
45
46What: /sys/class/watchdog/watchdogn/timeout
47Date: August 2015
48Contact: Wim Van Sebroeck <wim@iguana.be>
49Description:
50 It is a read only file. It is read to know about current
51 value of timeout programmed.
diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
index 0345f2d1c727..e5200f354abf 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -87,6 +87,12 @@ Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
87Description: 87Description:
88 Controls the checkpoint timing. 88 Controls the checkpoint timing.
89 89
90What: /sys/fs/f2fs/<disk>/idle_interval
91Date: January 2016
92Contact: "Jaegeuk Kim" <jaegeuk@kernel.org>
93Description:
94 Controls the idle timing.
95
90What: /sys/fs/f2fs/<disk>/ra_nid_pages 96What: /sys/fs/f2fs/<disk>/ra_nid_pages
91Date: October 2015 97Date: October 2015
92Contact: "Chao Yu" <chao2.yu@samsung.com> 98Contact: "Chao Yu" <chao2.yu@samsung.com>
diff --git a/Documentation/ABI/testing/sysfs-kernel-livepatch b/Documentation/ABI/testing/sysfs-kernel-livepatch
index 5bf42a840b22..da87f43aec58 100644
--- a/Documentation/ABI/testing/sysfs-kernel-livepatch
+++ b/Documentation/ABI/testing/sysfs-kernel-livepatch
@@ -33,7 +33,7 @@ Description:
33 The object directory contains subdirectories for each function 33 The object directory contains subdirectories for each function
34 that is patched within the object. 34 that is patched within the object.
35 35
36What: /sys/kernel/livepatch/<patch>/<object>/<function> 36What: /sys/kernel/livepatch/<patch>/<object>/<function,sympos>
37Date: Nov 2014 37Date: Nov 2014
38KernelVersion: 3.19.0 38KernelVersion: 3.19.0
39Contact: live-patching@vger.kernel.org 39Contact: live-patching@vger.kernel.org
@@ -41,4 +41,8 @@ Description:
41 The function directory contains attributes regarding the 41 The function directory contains attributes regarding the
42 properties and state of the patched function. 42 properties and state of the patched function.
43 43
44 The directory name contains the patched function name and a
45 sympos number corresponding to the nth occurrence of the symbol
46 name in kallsyms for the patched object.
47
44 There are currently no such attributes. 48 There are currently no such attributes.
diff --git a/Documentation/ABI/testing/sysfs-ptp b/Documentation/ABI/testing/sysfs-ptp
index 44806a678f12..a17f817a9309 100644
--- a/Documentation/ABI/testing/sysfs-ptp
+++ b/Documentation/ABI/testing/sysfs-ptp
@@ -74,7 +74,7 @@ Description:
74 assignment may be changed by two writing numbers into 74 assignment may be changed by two writing numbers into
75 the file. 75 the file.
76 76
77What: /sys/class/ptp/ptpN/pps_avaiable 77What: /sys/class/ptp/ptpN/pps_available
78Date: September 2010 78Date: September 2010
79Contact: Richard Cochran <richardcochran@gmail.com> 79Contact: Richard Cochran <richardcochran@gmail.com>
80Description: 80Description:
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index c06f817b3091..db653774c0b7 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -430,7 +430,7 @@ The rationale for using gotos is:
430 return result; 430 return result;
431 } 431 }
432 432
433A common type of bug to be aware of it "one err bugs" which look like this: 433A common type of bug to be aware of is "one err bugs" which look like this:
434 434
435 err: 435 err:
436 kfree(foo->bar); 436 kfree(foo->bar);
diff --git a/Documentation/DMA-API-HOWTO.txt b/Documentation/DMA-API-HOWTO.txt
index d69b3fc64e14..781024ef9050 100644
--- a/Documentation/DMA-API-HOWTO.txt
+++ b/Documentation/DMA-API-HOWTO.txt
@@ -951,16 +951,6 @@ to "Closing".
951 alignment constraints (e.g. the alignment constraints about 64-bit 951 alignment constraints (e.g. the alignment constraints about 64-bit
952 objects). 952 objects).
953 953
9543) Supporting multiple types of IOMMUs
955
956 If your architecture needs to support multiple types of IOMMUs, you
957 can use include/linux/asm-generic/dma-mapping-common.h. It's a
958 library to support the DMA API with multiple types of IOMMUs. Lots
959 of architectures (x86, powerpc, sh, alpha, ia64, microblaze and
960 sparc) use it. Choose one to see how it can be used. If you need to
961 support multiple types of IOMMUs in a single system, the example of
962 x86 or powerpc helps.
963
964 Closing 954 Closing
965 955
966This document, and the API itself, would not be in its current 956This document, and the API itself, would not be in its current
diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
index 1e98a7e6bccc..45ef3f279c3b 100644
--- a/Documentation/DMA-API.txt
+++ b/Documentation/DMA-API.txt
@@ -236,7 +236,7 @@ are guaranteed also to be cache line boundaries).
236 236
237DMA_TO_DEVICE synchronisation must be done after the last modification 237DMA_TO_DEVICE synchronisation must be done after the last modification
238of the memory region by the software and before it is handed off to 238of the memory region by the software and before it is handed off to
239the driver. Once this primitive is used, memory covered by this 239the device. Once this primitive is used, memory covered by this
240primitive should be treated as read-only by the device. If the device 240primitive should be treated as read-only by the device. If the device
241may write to it at any point, it should be DMA_BIDIRECTIONAL (see 241may write to it at any point, it should be DMA_BIDIRECTIONAL (see
242below). 242below).
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index 91f6d89bb19f..d70f9b68174e 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -50,8 +50,7 @@ pdfdocs: $(PDF)
50 50
51HTML := $(sort $(patsubst %.xml, %.html, $(BOOKS))) 51HTML := $(sort $(patsubst %.xml, %.html, $(BOOKS)))
52htmldocs: $(HTML) 52htmldocs: $(HTML)
53 $(call build_main_index) 53 $(call cmd,build_main_index)
54 $(call build_images)
55 $(call install_media_images) 54 $(call install_media_images)
56 55
57MAN := $(patsubst %.xml, %.9, $(BOOKS)) 56MAN := $(patsubst %.xml, %.9, $(BOOKS))
@@ -139,7 +138,8 @@ quiet_cmd_db2pdf = PDF $@
139 138
140index = index.html 139index = index.html
141main_idx = $(obj)/$(index) 140main_idx = $(obj)/$(index)
142build_main_index = rm -rf $(main_idx); \ 141quiet_cmd_build_main_index = HTML $(main_idx)
142 cmd_build_main_index = rm -rf $(main_idx); \
143 echo '<h1>Linux Kernel HTML Documentation</h1>' >> $(main_idx) && \ 143 echo '<h1>Linux Kernel HTML Documentation</h1>' >> $(main_idx) && \
144 echo '<h2>Kernel Version: $(KERNELVERSION)</h2>' >> $(main_idx) && \ 144 echo '<h2>Kernel Version: $(KERNELVERSION)</h2>' >> $(main_idx) && \
145 cat $(HTML) >> $(main_idx) 145 cat $(HTML) >> $(main_idx)
@@ -227,6 +227,10 @@ dochelp:
227 @echo ' mandocs - man pages' 227 @echo ' mandocs - man pages'
228 @echo ' installmandocs - install man pages generated by mandocs' 228 @echo ' installmandocs - install man pages generated by mandocs'
229 @echo ' cleandocs - clean all generated DocBook files' 229 @echo ' cleandocs - clean all generated DocBook files'
230 @echo
231 @echo 'make DOCBOOKS="s1.xml s2.xml" [target] Generate only docs s1.xml s2.xml'
232 @echo ' valid values for DOCBOOKS are: $(DOCBOOKS)'
233
230 234
231### 235###
232# Temporary files left by various tools 236# Temporary files left by various tools
diff --git a/Documentation/DocBook/device-drivers.tmpl b/Documentation/DocBook/device-drivers.tmpl
index 42a2d8593e39..cdd8b24db68d 100644
--- a/Documentation/DocBook/device-drivers.tmpl
+++ b/Documentation/DocBook/device-drivers.tmpl
@@ -238,83 +238,32 @@ X!Isound/sound_firmware.c
238!Iinclude/media/videobuf2-memops.h 238!Iinclude/media/videobuf2-memops.h
239 </sect1> 239 </sect1>
240 <sect1><title>Digital TV (DVB) devices</title> 240 <sect1><title>Digital TV (DVB) devices</title>
241!Idrivers/media/dvb-core/dvb_ca_en50221.h 241 <sect1><title>Digital TV Common functions</title>
242!Idrivers/media/dvb-core/dvb_frontend.h
243!Idrivers/media/dvb-core/dvb_math.h 242!Idrivers/media/dvb-core/dvb_math.h
244!Idrivers/media/dvb-core/dvb_ringbuffer.h 243!Idrivers/media/dvb-core/dvb_ringbuffer.h
245!Idrivers/media/dvb-core/dvbdev.h 244!Idrivers/media/dvb-core/dvbdev.h
246 <sect1><title>Digital TV Demux API</title> 245 </sect1>
247 <para>The kernel demux API defines a driver-internal interface for 246 <sect1><title>Digital TV Frontend kABI</title>
248 registering low-level, hardware specific driver to a hardware 247!Pdrivers/media/dvb-core/dvb_frontend.h Digital TV Frontend
249 independent demux layer. It is only of interest for Digital TV 248!Idrivers/media/dvb-core/dvb_frontend.h
250 device driver writers. The header file for this API is named 249 </sect1>
251 <constant>demux.h</constant> and located in 250 <sect1><title>Digital TV Demux kABI</title>
252 <constant>drivers/media/dvb-core</constant>.</para> 251!Pdrivers/media/dvb-core/demux.h Digital TV Demux
253 252 <sect1><title>Demux Callback API</title>
254 <para>The demux API should be implemented for each demux in the 253!Pdrivers/media/dvb-core/demux.h Demux Callback
255 system. It is used to select the TS source of a demux and to manage 254 </sect1>
256 the demux resources. When the demux client allocates a resource via
257 the demux API, it receives a pointer to the API of that
258 resource.</para>
259 <para>Each demux receives its TS input from a DVB front-end or from
260 memory, as set via this demux API. In a system with more than one
261 front-end, the API can be used to select one of the DVB front-ends
262 as a TS source for a demux, unless this is fixed in the HW platform.
263 The demux API only controls front-ends regarding to their connections
264 with demuxes; the APIs used to set the other front-end parameters,
265 such as tuning, are not defined in this document.</para>
266 <para>The functions that implement the abstract interface demux should
267 be defined static or module private and registered to the Demux
268 core for external access. It is not necessary to implement every
269 function in the struct <constant>dmx_demux</constant>. For example,
270 a demux interface might support Section filtering, but not PES
271 filtering. The API client is expected to check the value of any
272 function pointer before calling the function: the value of NULL means
273 that the &#8220;function is not available&#8221;.</para>
274 <para>Whenever the functions of the demux API modify shared data,
275 the possibilities of lost update and race condition problems should
276 be addressed, e.g. by protecting parts of code with mutexes.</para>
277 <para>Note that functions called from a bottom half context must not
278 sleep. Even a simple memory allocation without using GFP_ATOMIC can
279 result in a kernel thread being put to sleep if swapping is needed.
280 For example, the Linux kernel calls the functions of a network device
281 interface from a bottom half context. Thus, if a demux API function
282 is called from network device code, the function must not sleep.
283 </para>
284 </sect1>
285
286 <section id="demux_callback_api">
287 <title>Demux Callback API</title>
288 <para>This kernel-space API comprises the callback functions that
289 deliver filtered data to the demux client. Unlike the other DVB
290 kABIs, these functions are provided by the client and called from
291 the demux code.</para>
292 <para>The function pointers of this abstract interface are not
293 packed into a structure as in the other demux APIs, because the
294 callback functions are registered and used independent of each
295 other. As an example, it is possible for the API client to provide
296 several callback functions for receiving TS packets and no
297 callbacks for PES packets or sections.</para>
298 <para>The functions that implement the callback API need not be
299 re-entrant: when a demux driver calls one of these functions,
300 the driver is not allowed to call the function again before
301 the original call returns. If a callback is triggered by a
302 hardware interrupt, it is recommended to use the Linux
303 &#8220;bottom half&#8221; mechanism or start a tasklet instead of
304 making the callback function call directly from a hardware
305 interrupt.</para>
306 <para>This mechanism is implemented by
307 <link linkend='API-dmx-ts-cb'>dmx_ts_cb()</link> and
308 <link linkend='API-dmx-section-cb'>dmx_section_cb()</link>.</para>
309 </section>
310
311!Idrivers/media/dvb-core/demux.h 255!Idrivers/media/dvb-core/demux.h
312 </sect1> 256 </sect1>
257 <sect1><title>Digital TV Conditional Access kABI</title>
258!Idrivers/media/dvb-core/dvb_ca_en50221.h
259 </sect1>
260 </sect1>
313 <sect1><title>Remote Controller devices</title> 261 <sect1><title>Remote Controller devices</title>
314!Iinclude/media/rc-core.h 262!Iinclude/media/rc-core.h
315!Iinclude/media/lirc_dev.h 263!Iinclude/media/lirc_dev.h
316 </sect1> 264 </sect1>
317 <sect1><title>Media Controller devices</title> 265 <sect1><title>Media Controller devices</title>
266!Pinclude/media/media-device.h Media Controller
318!Iinclude/media/media-device.h 267!Iinclude/media/media-device.h
319!Iinclude/media/media-devnode.h 268!Iinclude/media/media-devnode.h
320!Iinclude/media/media-entity.h 269!Iinclude/media/media-entity.h
diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
index 201dcd3c2e9d..a8669330b456 100644
--- a/Documentation/DocBook/gpu.tmpl
+++ b/Documentation/DocBook/gpu.tmpl
@@ -124,6 +124,43 @@
124 <para> 124 <para>
125 [Insert diagram of typical DRM stack here] 125 [Insert diagram of typical DRM stack here]
126 </para> 126 </para>
127 <sect1>
128 <title>Style Guidelines</title>
129 <para>
130 For consistency this documentation uses American English. Abbreviations
131 are written as all-uppercase, for example: DRM, KMS, IOCTL, CRTC, and so
132 on. To aid in reading, documentations make full use of the markup
133 characters kerneldoc provides: @parameter for function parameters, @member
134 for structure members, &amp;structure to reference structures and
135 function() for functions. These all get automatically hyperlinked if
136 kerneldoc for the referenced objects exists. When referencing entries in
137 function vtables please use -&gt;vfunc(). Note that kerneldoc does
138 not support referencing struct members directly, so please add a reference
139 to the vtable struct somewhere in the same paragraph or at least section.
140 </para>
141 <para>
142 Except in special situations (to separate locked from unlocked variants)
143 locking requirements for functions aren't documented in the kerneldoc.
144 Instead locking should be check at runtime using e.g.
145 <code>WARN_ON(!mutex_is_locked(...));</code>. Since it's much easier to
146 ignore documentation than runtime noise this provides more value. And on
147 top of that runtime checks do need to be updated when the locking rules
148 change, increasing the chances that they're correct. Within the
149 documentation the locking rules should be explained in the relevant
150 structures: Either in the comment for the lock explaining what it
151 protects, or data fields need a note about which lock protects them, or
152 both.
153 </para>
154 <para>
155 Functions which have a non-<code>void</code> return value should have a
156 section called "Returns" explaining the expected return values in
157 different cases and their meanings. Currently there's no consensus whether
158 that section name should be all upper-case or not, and whether it should
159 end in a colon or not. Go with the file-local style. Other common section
160 names are "Notes" with information for dangerous or tricky corner cases,
161 and "FIXME" where the interface could be cleaned up.
162 </para>
163 </sect1>
127 </chapter> 164 </chapter>
128 165
129 <!-- Internals --> 166 <!-- Internals -->
@@ -615,18 +652,6 @@ char *date;</synopsis>
615 <function>drm_gem_object_init</function>. Storage for private GEM 652 <function>drm_gem_object_init</function>. Storage for private GEM
616 objects must be managed by drivers. 653 objects must be managed by drivers.
617 </para> 654 </para>
618 <para>
619 Drivers that do not need to extend GEM objects with private information
620 can call the <function>drm_gem_object_alloc</function> function to
621 allocate and initialize a struct <structname>drm_gem_object</structname>
622 instance. The GEM core will call the optional driver
623 <methodname>gem_init_object</methodname> operation after initializing
624 the GEM object with <function>drm_gem_object_init</function>.
625 <synopsis>int (*gem_init_object) (struct drm_gem_object *obj);</synopsis>
626 </para>
627 <para>
628 No alloc-and-init function exists for private GEM objects.
629 </para>
630 </sect3> 655 </sect3>
631 <sect3> 656 <sect3>
632 <title>GEM Objects Lifetime</title> 657 <title>GEM Objects Lifetime</title>
@@ -635,10 +660,10 @@ char *date;</synopsis>
635 acquired and release by <function>calling drm_gem_object_reference</function> 660 acquired and release by <function>calling drm_gem_object_reference</function>
636 and <function>drm_gem_object_unreference</function> respectively. The 661 and <function>drm_gem_object_unreference</function> respectively. The
637 caller must hold the <structname>drm_device</structname> 662 caller must hold the <structname>drm_device</structname>
638 <structfield>struct_mutex</structfield> lock. As a convenience, GEM 663 <structfield>struct_mutex</structfield> lock when calling
639 provides the <function>drm_gem_object_reference_unlocked</function> and 664 <function>drm_gem_object_reference</function>. As a convenience, GEM
640 <function>drm_gem_object_unreference_unlocked</function> functions that 665 provides <function>drm_gem_object_unreference_unlocked</function>
641 can be called without holding the lock. 666 functions that can be called without holding the lock.
642 </para> 667 </para>
643 <para> 668 <para>
644 When the last reference to a GEM object is released the GEM core calls 669 When the last reference to a GEM object is released the GEM core calls
@@ -649,15 +674,9 @@ char *date;</synopsis>
649 </para> 674 </para>
650 <para> 675 <para>
651 <synopsis>void (*gem_free_object) (struct drm_gem_object *obj);</synopsis> 676 <synopsis>void (*gem_free_object) (struct drm_gem_object *obj);</synopsis>
652 Drivers are responsible for freeing all GEM object resources, including 677 Drivers are responsible for freeing all GEM object resources. This includes
653 the resources created by the GEM core. If an mmap offset has been 678 the resources created by the GEM core, which need to be released with
654 created for the object (in which case 679 <function>drm_gem_object_release</function>.
655 <structname>drm_gem_object</structname>::<structfield>map_list</structfield>::<structfield>map</structfield>
656 is not NULL) it must be freed by a call to
657 <function>drm_gem_free_mmap_offset</function>. The shmfs backing store
658 must be released by calling <function>drm_gem_object_release</function>
659 (that function can safely be called if no shmfs backing store has been
660 created).
661 </para> 680 </para>
662 </sect3> 681 </sect3>
663 <sect3> 682 <sect3>
@@ -740,17 +759,10 @@ char *date;</synopsis>
740 DRM identifies the GEM object to be mapped by a fake offset passed 759 DRM identifies the GEM object to be mapped by a fake offset passed
741 through the mmap offset argument. Prior to being mapped, a GEM object 760 through the mmap offset argument. Prior to being mapped, a GEM object
742 must thus be associated with a fake offset. To do so, drivers must call 761 must thus be associated with a fake offset. To do so, drivers must call
743 <function>drm_gem_create_mmap_offset</function> on the object. The 762 <function>drm_gem_create_mmap_offset</function> on the object.
744 function allocates a fake offset range from a pool and stores the
745 offset divided by PAGE_SIZE in
746 <literal>obj-&gt;map_list.hash.key</literal>. Care must be taken not to
747 call <function>drm_gem_create_mmap_offset</function> if a fake offset
748 has already been allocated for the object. This can be tested by
749 <literal>obj-&gt;map_list.map</literal> being non-NULL.
750 </para> 763 </para>
751 <para> 764 <para>
752 Once allocated, the fake offset value 765 Once allocated, the fake offset value
753 (<literal>obj-&gt;map_list.hash.key &lt;&lt; PAGE_SHIFT</literal>)
754 must be passed to the application in a driver-specific way and can then 766 must be passed to the application in a driver-specific way and can then
755 be used as the mmap offset argument. 767 be used as the mmap offset argument.
756 </para> 768 </para>
@@ -836,10 +848,11 @@ char *date;</synopsis>
836 abstracted from the client in libdrm. 848 abstracted from the client in libdrm.
837 </para> 849 </para>
838 </sect3> 850 </sect3>
839 <sect3> 851 </sect2>
840 <title>GEM Function Reference</title> 852 <sect2>
853 <title>GEM Function Reference</title>
841!Edrivers/gpu/drm/drm_gem.c 854!Edrivers/gpu/drm/drm_gem.c
842 </sect3> 855!Iinclude/drm/drm_gem.h
843 </sect2> 856 </sect2>
844 <sect2> 857 <sect2>
845 <title>VMA Offset Manager</title> 858 <title>VMA Offset Manager</title>
@@ -970,12 +983,10 @@ int max_width, max_height;</synopsis>
970 <sect2> 983 <sect2>
971 <title>Atomic Mode Setting Function Reference</title> 984 <title>Atomic Mode Setting Function Reference</title>
972!Edrivers/gpu/drm/drm_atomic.c 985!Edrivers/gpu/drm/drm_atomic.c
986!Idrivers/gpu/drm/drm_atomic.c
973 </sect2> 987 </sect2>
974 <sect2> 988 <sect2>
975 <title>Frame Buffer Creation</title> 989 <title>Frame Buffer Abstraction</title>
976 <synopsis>struct drm_framebuffer *(*fb_create)(struct drm_device *dev,
977 struct drm_file *file_priv,
978 struct drm_mode_fb_cmd2 *mode_cmd);</synopsis>
979 <para> 990 <para>
980 Frame buffers are abstract memory objects that provide a source of 991 Frame buffers are abstract memory objects that provide a source of
981 pixels to scanout to a CRTC. Applications explicitly request the 992 pixels to scanout to a CRTC. Applications explicitly request the
@@ -994,73 +1005,6 @@ int max_width, max_height;</synopsis>
994 and so expects TTM handles in the create ioctl and not GEM handles. 1005 and so expects TTM handles in the create ioctl and not GEM handles.
995 </para> 1006 </para>
996 <para> 1007 <para>
997 Drivers must first validate the requested frame buffer parameters passed
998 through the mode_cmd argument. In particular this is where invalid
999 sizes, pixel formats or pitches can be caught.
1000 </para>
1001 <para>
1002 If the parameters are deemed valid, drivers then create, initialize and
1003 return an instance of struct <structname>drm_framebuffer</structname>.
1004 If desired the instance can be embedded in a larger driver-specific
1005 structure. Drivers must fill its <structfield>width</structfield>,
1006 <structfield>height</structfield>, <structfield>pitches</structfield>,
1007 <structfield>offsets</structfield>, <structfield>depth</structfield>,
1008 <structfield>bits_per_pixel</structfield> and
1009 <structfield>pixel_format</structfield> fields from the values passed
1010 through the <parameter>drm_mode_fb_cmd2</parameter> argument. They
1011 should call the <function>drm_helper_mode_fill_fb_struct</function>
1012 helper function to do so.
1013 </para>
1014
1015 <para>
1016 The initialization of the new framebuffer instance is finalized with a
1017 call to <function>drm_framebuffer_init</function> which takes a pointer
1018 to DRM frame buffer operations (struct
1019 <structname>drm_framebuffer_funcs</structname>). Note that this function
1020 publishes the framebuffer and so from this point on it can be accessed
1021 concurrently from other threads. Hence it must be the last step in the
1022 driver's framebuffer initialization sequence. Frame buffer operations
1023 are
1024 <itemizedlist>
1025 <listitem>
1026 <synopsis>int (*create_handle)(struct drm_framebuffer *fb,
1027 struct drm_file *file_priv, unsigned int *handle);</synopsis>
1028 <para>
1029 Create a handle to the frame buffer underlying memory object. If
1030 the frame buffer uses a multi-plane format, the handle will
1031 reference the memory object associated with the first plane.
1032 </para>
1033 <para>
1034 Drivers call <function>drm_gem_handle_create</function> to create
1035 the handle.
1036 </para>
1037 </listitem>
1038 <listitem>
1039 <synopsis>void (*destroy)(struct drm_framebuffer *framebuffer);</synopsis>
1040 <para>
1041 Destroy the frame buffer object and frees all associated
1042 resources. Drivers must call
1043 <function>drm_framebuffer_cleanup</function> to free resources
1044 allocated by the DRM core for the frame buffer object, and must
1045 make sure to unreference all memory objects associated with the
1046 frame buffer. Handles created by the
1047 <methodname>create_handle</methodname> operation are released by
1048 the DRM core.
1049 </para>
1050 </listitem>
1051 <listitem>
1052 <synopsis>int (*dirty)(struct drm_framebuffer *framebuffer,
1053 struct drm_file *file_priv, unsigned flags, unsigned color,
1054 struct drm_clip_rect *clips, unsigned num_clips);</synopsis>
1055 <para>
1056 This optional operation notifies the driver that a region of the
1057 frame buffer has changed in response to a DRM_IOCTL_MODE_DIRTYFB
1058 ioctl call.
1059 </para>
1060 </listitem>
1061 </itemizedlist>
1062 </para>
1063 <para>
1064 The lifetime of a drm framebuffer is controlled with a reference count, 1008 The lifetime of a drm framebuffer is controlled with a reference count,
1065 drivers can grab additional references with 1009 drivers can grab additional references with
1066 <function>drm_framebuffer_reference</function>and drop them 1010 <function>drm_framebuffer_reference</function>and drop them
@@ -1197,137 +1141,6 @@ int max_width, max_height;</synopsis>
1197 pointer to CRTC functions. 1141 pointer to CRTC functions.
1198 </para> 1142 </para>
1199 </sect3> 1143 </sect3>
1200 <sect3 id="drm-kms-crtcops">
1201 <title>CRTC Operations</title>
1202 <sect4>
1203 <title>Set Configuration</title>
1204 <synopsis>int (*set_config)(struct drm_mode_set *set);</synopsis>
1205 <para>
1206 Apply a new CRTC configuration to the device. The configuration
1207 specifies a CRTC, a frame buffer to scan out from, a (x,y) position in
1208 the frame buffer, a display mode and an array of connectors to drive
1209 with the CRTC if possible.
1210 </para>
1211 <para>
1212 If the frame buffer specified in the configuration is NULL, the driver
1213 must detach all encoders connected to the CRTC and all connectors
1214 attached to those encoders and disable them.
1215 </para>
1216 <para>
1217 This operation is called with the mode config lock held.
1218 </para>
1219 <note><para>
1220 Note that the drm core has no notion of restoring the mode setting
1221 state after resume, since all resume handling is in the full
1222 responsibility of the driver. The common mode setting helper library
1223 though provides a helper which can be used for this:
1224 <function>drm_helper_resume_force_mode</function>.
1225 </para></note>
1226 </sect4>
1227 <sect4>
1228 <title>Page Flipping</title>
1229 <synopsis>int (*page_flip)(struct drm_crtc *crtc, struct drm_framebuffer *fb,
1230 struct drm_pending_vblank_event *event);</synopsis>
1231 <para>
1232 Schedule a page flip to the given frame buffer for the CRTC. This
1233 operation is called with the mode config mutex held.
1234 </para>
1235 <para>
1236 Page flipping is a synchronization mechanism that replaces the frame
1237 buffer being scanned out by the CRTC with a new frame buffer during
1238 vertical blanking, avoiding tearing. When an application requests a page
1239 flip the DRM core verifies that the new frame buffer is large enough to
1240 be scanned out by the CRTC in the currently configured mode and then
1241 calls the CRTC <methodname>page_flip</methodname> operation with a
1242 pointer to the new frame buffer.
1243 </para>
1244 <para>
1245 The <methodname>page_flip</methodname> operation schedules a page flip.
1246 Once any pending rendering targeting the new frame buffer has
1247 completed, the CRTC will be reprogrammed to display that frame buffer
1248 after the next vertical refresh. The operation must return immediately
1249 without waiting for rendering or page flip to complete and must block
1250 any new rendering to the frame buffer until the page flip completes.
1251 </para>
1252 <para>
1253 If a page flip can be successfully scheduled the driver must set the
1254 <code>drm_crtc-&gt;fb</code> field to the new framebuffer pointed to
1255 by <code>fb</code>. This is important so that the reference counting
1256 on framebuffers stays balanced.
1257 </para>
1258 <para>
1259 If a page flip is already pending, the
1260 <methodname>page_flip</methodname> operation must return
1261 -<errorname>EBUSY</errorname>.
1262 </para>
1263 <para>
1264 To synchronize page flip to vertical blanking the driver will likely
1265 need to enable vertical blanking interrupts. It should call
1266 <function>drm_vblank_get</function> for that purpose, and call
1267 <function>drm_vblank_put</function> after the page flip completes.
1268 </para>
1269 <para>
1270 If the application has requested to be notified when page flip completes
1271 the <methodname>page_flip</methodname> operation will be called with a
1272 non-NULL <parameter>event</parameter> argument pointing to a
1273 <structname>drm_pending_vblank_event</structname> instance. Upon page
1274 flip completion the driver must call <methodname>drm_send_vblank_event</methodname>
1275 to fill in the event and send to wake up any waiting processes.
1276 This can be performed with
1277 <programlisting><![CDATA[
1278 spin_lock_irqsave(&dev->event_lock, flags);
1279 ...
1280 drm_send_vblank_event(dev, pipe, event);
1281 spin_unlock_irqrestore(&dev->event_lock, flags);
1282 ]]></programlisting>
1283 </para>
1284 <note><para>
1285 FIXME: Could drivers that don't need to wait for rendering to complete
1286 just add the event to <literal>dev-&gt;vblank_event_list</literal> and
1287 let the DRM core handle everything, as for "normal" vertical blanking
1288 events?
1289 </para></note>
1290 <para>
1291 While waiting for the page flip to complete, the
1292 <literal>event-&gt;base.link</literal> list head can be used freely by
1293 the driver to store the pending event in a driver-specific list.
1294 </para>
1295 <para>
1296 If the file handle is closed before the event is signaled, drivers must
1297 take care to destroy the event in their
1298 <methodname>preclose</methodname> operation (and, if needed, call
1299 <function>drm_vblank_put</function>).
1300 </para>
1301 </sect4>
1302 <sect4>
1303 <title>Miscellaneous</title>
1304 <itemizedlist>
1305 <listitem>
1306 <synopsis>void (*set_property)(struct drm_crtc *crtc,
1307 struct drm_property *property, uint64_t value);</synopsis>
1308 <para>
1309 Set the value of the given CRTC property to
1310 <parameter>value</parameter>. See <xref linkend="drm-kms-properties"/>
1311 for more information about properties.
1312 </para>
1313 </listitem>
1314 <listitem>
1315 <synopsis>void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
1316 uint32_t start, uint32_t size);</synopsis>
1317 <para>
1318 Apply a gamma table to the device. The operation is optional.
1319 </para>
1320 </listitem>
1321 <listitem>
1322 <synopsis>void (*destroy)(struct drm_crtc *crtc);</synopsis>
1323 <para>
1324 Destroy the CRTC when not needed anymore. See
1325 <xref linkend="drm-kms-init"/>.
1326 </para>
1327 </listitem>
1328 </itemizedlist>
1329 </sect4>
1330 </sect3>
1331 </sect2> 1144 </sect2>
1332 <sect2> 1145 <sect2>
1333 <title>Planes (struct <structname>drm_plane</structname>)</title> 1146 <title>Planes (struct <structname>drm_plane</structname>)</title>
@@ -1344,7 +1157,7 @@ int max_width, max_height;</synopsis>
1344 <listitem> 1157 <listitem>
1345 DRM_PLANE_TYPE_PRIMARY represents a "main" plane for a CRTC. Primary 1158 DRM_PLANE_TYPE_PRIMARY represents a "main" plane for a CRTC. Primary
1346 planes are the planes operated upon by CRTC modesetting and flipping 1159 planes are the planes operated upon by CRTC modesetting and flipping
1347 operations described in <xref linkend="drm-kms-crtcops"/>. 1160 operations described in the page_flip hook in <structname>drm_crtc_funcs</structname>.
1348 </listitem> 1161 </listitem>
1349 <listitem> 1162 <listitem>
1350 DRM_PLANE_TYPE_CURSOR represents a "cursor" plane for a CRTC. Cursor 1163 DRM_PLANE_TYPE_CURSOR represents a "cursor" plane for a CRTC. Cursor
@@ -1381,52 +1194,6 @@ int max_width, max_height;</synopsis>
1381 primary plane with standard capabilities. 1194 primary plane with standard capabilities.
1382 </para> 1195 </para>
1383 </sect3> 1196 </sect3>
1384 <sect3>
1385 <title>Plane Operations</title>
1386 <itemizedlist>
1387 <listitem>
1388 <synopsis>int (*update_plane)(struct drm_plane *plane, struct drm_crtc *crtc,
1389 struct drm_framebuffer *fb, int crtc_x, int crtc_y,
1390 unsigned int crtc_w, unsigned int crtc_h,
1391 uint32_t src_x, uint32_t src_y,
1392 uint32_t src_w, uint32_t src_h);</synopsis>
1393 <para>
1394 Enable and configure the plane to use the given CRTC and frame buffer.
1395 </para>
1396 <para>
1397 The source rectangle in frame buffer memory coordinates is given by
1398 the <parameter>src_x</parameter>, <parameter>src_y</parameter>,
1399 <parameter>src_w</parameter> and <parameter>src_h</parameter>
1400 parameters (as 16.16 fixed point values). Devices that don't support
1401 subpixel plane coordinates can ignore the fractional part.
1402 </para>
1403 <para>
1404 The destination rectangle in CRTC coordinates is given by the
1405 <parameter>crtc_x</parameter>, <parameter>crtc_y</parameter>,
1406 <parameter>crtc_w</parameter> and <parameter>crtc_h</parameter>
1407 parameters (as integer values). Devices scale the source rectangle to
1408 the destination rectangle. If scaling is not supported, and the source
1409 rectangle size doesn't match the destination rectangle size, the
1410 driver must return a -<errorname>EINVAL</errorname> error.
1411 </para>
1412 </listitem>
1413 <listitem>
1414 <synopsis>int (*disable_plane)(struct drm_plane *plane);</synopsis>
1415 <para>
1416 Disable the plane. The DRM core calls this method in response to a
1417 DRM_IOCTL_MODE_SETPLANE ioctl call with the frame buffer ID set to 0.
1418 Disabled planes must not be processed by the CRTC.
1419 </para>
1420 </listitem>
1421 <listitem>
1422 <synopsis>void (*destroy)(struct drm_plane *plane);</synopsis>
1423 <para>
1424 Destroy the plane when not needed anymore. See
1425 <xref linkend="drm-kms-init"/>.
1426 </para>
1427 </listitem>
1428 </itemizedlist>
1429 </sect3>
1430 </sect2> 1197 </sect2>
1431 <sect2> 1198 <sect2>
1432 <title>Encoders (struct <structname>drm_encoder</structname>)</title> 1199 <title>Encoders (struct <structname>drm_encoder</structname>)</title>
@@ -1483,27 +1250,6 @@ int max_width, max_height;</synopsis>
1483 encoders they want to use to a CRTC. 1250 encoders they want to use to a CRTC.
1484 </para> 1251 </para>
1485 </sect3> 1252 </sect3>
1486 <sect3>
1487 <title>Encoder Operations</title>
1488 <itemizedlist>
1489 <listitem>
1490 <synopsis>void (*destroy)(struct drm_encoder *encoder);</synopsis>
1491 <para>
1492 Called to destroy the encoder when not needed anymore. See
1493 <xref linkend="drm-kms-init"/>.
1494 </para>
1495 </listitem>
1496 <listitem>
1497 <synopsis>void (*set_property)(struct drm_plane *plane,
1498 struct drm_property *property, uint64_t value);</synopsis>
1499 <para>
1500 Set the value of the given plane property to
1501 <parameter>value</parameter>. See <xref linkend="drm-kms-properties"/>
1502 for more information about properties.
1503 </para>
1504 </listitem>
1505 </itemizedlist>
1506 </sect3>
1507 </sect2> 1253 </sect2>
1508 <sect2> 1254 <sect2>
1509 <title>Connectors (struct <structname>drm_connector</structname>)</title> 1255 <title>Connectors (struct <structname>drm_connector</structname>)</title>
@@ -1707,27 +1453,6 @@ int max_width, max_height;</synopsis>
1707 connector_status_unknown. 1453 connector_status_unknown.
1708 </para> 1454 </para>
1709 </sect4> 1455 </sect4>
1710 <sect4>
1711 <title>Miscellaneous</title>
1712 <itemizedlist>
1713 <listitem>
1714 <synopsis>void (*set_property)(struct drm_connector *connector,
1715 struct drm_property *property, uint64_t value);</synopsis>
1716 <para>
1717 Set the value of the given connector property to
1718 <parameter>value</parameter>. See <xref linkend="drm-kms-properties"/>
1719 for more information about properties.
1720 </para>
1721 </listitem>
1722 <listitem>
1723 <synopsis>void (*destroy)(struct drm_connector *connector);</synopsis>
1724 <para>
1725 Destroy the connector when not needed anymore. See
1726 <xref linkend="drm-kms-init"/>.
1727 </para>
1728 </listitem>
1729 </itemizedlist>
1730 </sect4>
1731 </sect3> 1456 </sect3>
1732 </sect2> 1457 </sect2>
1733 <sect2> 1458 <sect2>
@@ -1854,462 +1579,6 @@ void intel_crt_init(struct drm_device *dev)
1854 entities. 1579 entities.
1855 </para> 1580 </para>
1856 <sect2> 1581 <sect2>
1857 <title>Helper Functions</title>
1858 <itemizedlist>
1859 <listitem>
1860 <synopsis>int drm_crtc_helper_set_config(struct drm_mode_set *set);</synopsis>
1861 <para>
1862 The <function>drm_crtc_helper_set_config</function> helper function
1863 is a CRTC <methodname>set_config</methodname> implementation. It
1864 first tries to locate the best encoder for each connector by calling
1865 the connector <methodname>best_encoder</methodname> helper
1866 operation.
1867 </para>
1868 <para>
1869 After locating the appropriate encoders, the helper function will
1870 call the <methodname>mode_fixup</methodname> encoder and CRTC helper
1871 operations to adjust the requested mode, or reject it completely in
1872 which case an error will be returned to the application. If the new
1873 configuration after mode adjustment is identical to the current
1874 configuration the helper function will return without performing any
1875 other operation.
1876 </para>
1877 <para>
1878 If the adjusted mode is identical to the current mode but changes to
1879 the frame buffer need to be applied, the
1880 <function>drm_crtc_helper_set_config</function> function will call
1881 the CRTC <methodname>mode_set_base</methodname> helper operation. If
1882 the adjusted mode differs from the current mode, or if the
1883 <methodname>mode_set_base</methodname> helper operation is not
1884 provided, the helper function performs a full mode set sequence by
1885 calling the <methodname>prepare</methodname>,
1886 <methodname>mode_set</methodname> and
1887 <methodname>commit</methodname> CRTC and encoder helper operations,
1888 in that order.
1889 </para>
1890 </listitem>
1891 <listitem>
1892 <synopsis>void drm_helper_connector_dpms(struct drm_connector *connector, int mode);</synopsis>
1893 <para>
1894 The <function>drm_helper_connector_dpms</function> helper function
1895 is a connector <methodname>dpms</methodname> implementation that
1896 tracks power state of connectors. To use the function, drivers must
1897 provide <methodname>dpms</methodname> helper operations for CRTCs
1898 and encoders to apply the DPMS state to the device.
1899 </para>
1900 <para>
1901 The mid-layer doesn't track the power state of CRTCs and encoders.
1902 The <methodname>dpms</methodname> helper operations can thus be
1903 called with a mode identical to the currently active mode.
1904 </para>
1905 </listitem>
1906 <listitem>
1907 <synopsis>int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
1908 uint32_t maxX, uint32_t maxY);</synopsis>
1909 <para>
1910 The <function>drm_helper_probe_single_connector_modes</function> helper
1911 function is a connector <methodname>fill_modes</methodname>
1912 implementation that updates the connection status for the connector
1913 and then retrieves a list of modes by calling the connector
1914 <methodname>get_modes</methodname> helper operation.
1915 </para>
1916 <para>
1917 If the helper operation returns no mode, and if the connector status
1918 is connector_status_connected, standard VESA DMT modes up to
1919 1024x768 are automatically added to the modes list by a call to
1920 <function>drm_add_modes_noedid</function>.
1921 </para>
1922 <para>
1923 The function then filters out modes larger than
1924 <parameter>max_width</parameter> and <parameter>max_height</parameter>
1925 if specified. It finally calls the optional connector
1926 <methodname>mode_valid</methodname> helper operation for each mode in
1927 the probed list to check whether the mode is valid for the connector.
1928 </para>
1929 </listitem>
1930 </itemizedlist>
1931 </sect2>
1932 <sect2>
1933 <title>CRTC Helper Operations</title>
1934 <itemizedlist>
1935 <listitem id="drm-helper-crtc-mode-fixup">
1936 <synopsis>bool (*mode_fixup)(struct drm_crtc *crtc,
1937 const struct drm_display_mode *mode,
1938 struct drm_display_mode *adjusted_mode);</synopsis>
1939 <para>
1940 Let CRTCs adjust the requested mode or reject it completely. This
1941 operation returns true if the mode is accepted (possibly after being
1942 adjusted) or false if it is rejected.
1943 </para>
1944 <para>
1945 The <methodname>mode_fixup</methodname> operation should reject the
1946 mode if it can't reasonably use it. The definition of "reasonable"
1947 is currently fuzzy in this context. One possible behaviour would be
1948 to set the adjusted mode to the panel timings when a fixed-mode
1949 panel is used with hardware capable of scaling. Another behaviour
1950 would be to accept any input mode and adjust it to the closest mode
1951 supported by the hardware (FIXME: This needs to be clarified).
1952 </para>
1953 </listitem>
1954 <listitem>
1955 <synopsis>int (*mode_set_base)(struct drm_crtc *crtc, int x, int y,
1956 struct drm_framebuffer *old_fb)</synopsis>
1957 <para>
1958 Move the CRTC on the current frame buffer (stored in
1959 <literal>crtc-&gt;fb</literal>) to position (x,y). Any of the frame
1960 buffer, x position or y position may have been modified.
1961 </para>
1962 <para>
1963 This helper operation is optional. If not provided, the
1964 <function>drm_crtc_helper_set_config</function> function will fall
1965 back to the <methodname>mode_set</methodname> helper operation.
1966 </para>
1967 <note><para>
1968 FIXME: Why are x and y passed as arguments, as they can be accessed
1969 through <literal>crtc-&gt;x</literal> and
1970 <literal>crtc-&gt;y</literal>?
1971 </para></note>
1972 </listitem>
1973 <listitem>
1974 <synopsis>void (*prepare)(struct drm_crtc *crtc);</synopsis>
1975 <para>
1976 Prepare the CRTC for mode setting. This operation is called after
1977 validating the requested mode. Drivers use it to perform
1978 device-specific operations required before setting the new mode.
1979 </para>
1980 </listitem>
1981 <listitem>
1982 <synopsis>int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode,
1983 struct drm_display_mode *adjusted_mode, int x, int y,
1984 struct drm_framebuffer *old_fb);</synopsis>
1985 <para>
1986 Set a new mode, position and frame buffer. Depending on the device
1987 requirements, the mode can be stored internally by the driver and
1988 applied in the <methodname>commit</methodname> operation, or
1989 programmed to the hardware immediately.
1990 </para>
1991 <para>
1992 The <methodname>mode_set</methodname> operation returns 0 on success
1993 or a negative error code if an error occurs.
1994 </para>
1995 </listitem>
1996 <listitem>
1997 <synopsis>void (*commit)(struct drm_crtc *crtc);</synopsis>
1998 <para>
1999 Commit a mode. This operation is called after setting the new mode.
2000 Upon return the device must use the new mode and be fully
2001 operational.
2002 </para>
2003 </listitem>
2004 </itemizedlist>
2005 </sect2>
2006 <sect2>
2007 <title>Encoder Helper Operations</title>
2008 <itemizedlist>
2009 <listitem>
2010 <synopsis>bool (*mode_fixup)(struct drm_encoder *encoder,
2011 const struct drm_display_mode *mode,
2012 struct drm_display_mode *adjusted_mode);</synopsis>
2013 <para>
2014 Let encoders adjust the requested mode or reject it completely. This
2015 operation returns true if the mode is accepted (possibly after being
2016 adjusted) or false if it is rejected. See the
2017 <link linkend="drm-helper-crtc-mode-fixup">mode_fixup CRTC helper
2018 operation</link> for an explanation of the allowed adjustments.
2019 </para>
2020 </listitem>
2021 <listitem>
2022 <synopsis>void (*prepare)(struct drm_encoder *encoder);</synopsis>
2023 <para>
2024 Prepare the encoder for mode setting. This operation is called after
2025 validating the requested mode. Drivers use it to perform
2026 device-specific operations required before setting the new mode.
2027 </para>
2028 </listitem>
2029 <listitem>
2030 <synopsis>void (*mode_set)(struct drm_encoder *encoder,
2031 struct drm_display_mode *mode,
2032 struct drm_display_mode *adjusted_mode);</synopsis>
2033 <para>
2034 Set a new mode. Depending on the device requirements, the mode can
2035 be stored internally by the driver and applied in the
2036 <methodname>commit</methodname> operation, or programmed to the
2037 hardware immediately.
2038 </para>
2039 </listitem>
2040 <listitem>
2041 <synopsis>void (*commit)(struct drm_encoder *encoder);</synopsis>
2042 <para>
2043 Commit a mode. This operation is called after setting the new mode.
2044 Upon return the device must use the new mode and be fully
2045 operational.
2046 </para>
2047 </listitem>
2048 </itemizedlist>
2049 </sect2>
2050 <sect2>
2051 <title>Connector Helper Operations</title>
2052 <itemizedlist>
2053 <listitem>
2054 <synopsis>struct drm_encoder *(*best_encoder)(struct drm_connector *connector);</synopsis>
2055 <para>
2056 Return a pointer to the best encoder for the connecter. Device that
2057 map connectors to encoders 1:1 simply return the pointer to the
2058 associated encoder. This operation is mandatory.
2059 </para>
2060 </listitem>
2061 <listitem>
2062 <synopsis>int (*get_modes)(struct drm_connector *connector);</synopsis>
2063 <para>
2064 Fill the connector's <structfield>probed_modes</structfield> list
2065 by parsing EDID data with <function>drm_add_edid_modes</function>,
2066 adding standard VESA DMT modes with <function>drm_add_modes_noedid</function>,
2067 or calling <function>drm_mode_probed_add</function> directly for every
2068 supported mode and return the number of modes it has detected. This
2069 operation is mandatory.
2070 </para>
2071 <para>
2072 Note that the caller function will automatically add standard VESA
2073 DMT modes up to 1024x768 if the <methodname>get_modes</methodname>
2074 helper operation returns no mode and if the connector status is
2075 connector_status_connected. There is no need to call
2076 <function>drm_add_edid_modes</function> manually in that case.
2077 </para>
2078 <para>
2079 When adding modes manually the driver creates each mode with a call to
2080 <function>drm_mode_create</function> and must fill the following fields.
2081 <itemizedlist>
2082 <listitem>
2083 <synopsis>__u32 type;</synopsis>
2084 <para>
2085 Mode type bitmask, a combination of
2086 <variablelist>
2087 <varlistentry>
2088 <term>DRM_MODE_TYPE_BUILTIN</term>
2089 <listitem><para>not used?</para></listitem>
2090 </varlistentry>
2091 <varlistentry>
2092 <term>DRM_MODE_TYPE_CLOCK_C</term>
2093 <listitem><para>not used?</para></listitem>
2094 </varlistentry>
2095 <varlistentry>
2096 <term>DRM_MODE_TYPE_CRTC_C</term>
2097 <listitem><para>not used?</para></listitem>
2098 </varlistentry>
2099 <varlistentry>
2100 <term>
2101 DRM_MODE_TYPE_PREFERRED - The preferred mode for the connector
2102 </term>
2103 <listitem>
2104 <para>not used?</para>
2105 </listitem>
2106 </varlistentry>
2107 <varlistentry>
2108 <term>DRM_MODE_TYPE_DEFAULT</term>
2109 <listitem><para>not used?</para></listitem>
2110 </varlistentry>
2111 <varlistentry>
2112 <term>DRM_MODE_TYPE_USERDEF</term>
2113 <listitem><para>not used?</para></listitem>
2114 </varlistentry>
2115 <varlistentry>
2116 <term>DRM_MODE_TYPE_DRIVER</term>
2117 <listitem>
2118 <para>
2119 The mode has been created by the driver (as opposed to
2120 to user-created modes).
2121 </para>
2122 </listitem>
2123 </varlistentry>
2124 </variablelist>
2125 Drivers must set the DRM_MODE_TYPE_DRIVER bit for all modes they
2126 create, and set the DRM_MODE_TYPE_PREFERRED bit for the preferred
2127 mode.
2128 </para>
2129 </listitem>
2130 <listitem>
2131 <synopsis>__u32 clock;</synopsis>
2132 <para>Pixel clock frequency in kHz unit</para>
2133 </listitem>
2134 <listitem>
2135 <synopsis>__u16 hdisplay, hsync_start, hsync_end, htotal;
2136 __u16 vdisplay, vsync_start, vsync_end, vtotal;</synopsis>
2137 <para>Horizontal and vertical timing information</para>
2138 <screen><![CDATA[
2139 Active Front Sync Back
2140 Region Porch Porch
2141 <-----------------------><----------------><-------------><-------------->
2142
2143 //////////////////////|
2144 ////////////////////// |
2145 ////////////////////// |.................. ................
2146 _______________
2147
2148 <----- [hv]display ----->
2149 <------------- [hv]sync_start ------------>
2150 <--------------------- [hv]sync_end --------------------->
2151 <-------------------------------- [hv]total ----------------------------->
2152]]></screen>
2153 </listitem>
2154 <listitem>
2155 <synopsis>__u16 hskew;
2156 __u16 vscan;</synopsis>
2157 <para>Unknown</para>
2158 </listitem>
2159 <listitem>
2160 <synopsis>__u32 flags;</synopsis>
2161 <para>
2162 Mode flags, a combination of
2163 <variablelist>
2164 <varlistentry>
2165 <term>DRM_MODE_FLAG_PHSYNC</term>
2166 <listitem><para>
2167 Horizontal sync is active high
2168 </para></listitem>
2169 </varlistentry>
2170 <varlistentry>
2171 <term>DRM_MODE_FLAG_NHSYNC</term>
2172 <listitem><para>
2173 Horizontal sync is active low
2174 </para></listitem>
2175 </varlistentry>
2176 <varlistentry>
2177 <term>DRM_MODE_FLAG_PVSYNC</term>
2178 <listitem><para>
2179 Vertical sync is active high
2180 </para></listitem>
2181 </varlistentry>
2182 <varlistentry>
2183 <term>DRM_MODE_FLAG_NVSYNC</term>
2184 <listitem><para>
2185 Vertical sync is active low
2186 </para></listitem>
2187 </varlistentry>
2188 <varlistentry>
2189 <term>DRM_MODE_FLAG_INTERLACE</term>
2190 <listitem><para>
2191 Mode is interlaced
2192 </para></listitem>
2193 </varlistentry>
2194 <varlistentry>
2195 <term>DRM_MODE_FLAG_DBLSCAN</term>
2196 <listitem><para>
2197 Mode uses doublescan
2198 </para></listitem>
2199 </varlistentry>
2200 <varlistentry>
2201 <term>DRM_MODE_FLAG_CSYNC</term>
2202 <listitem><para>
2203 Mode uses composite sync
2204 </para></listitem>
2205 </varlistentry>
2206 <varlistentry>
2207 <term>DRM_MODE_FLAG_PCSYNC</term>
2208 <listitem><para>
2209 Composite sync is active high
2210 </para></listitem>
2211 </varlistentry>
2212 <varlistentry>
2213 <term>DRM_MODE_FLAG_NCSYNC</term>
2214 <listitem><para>
2215 Composite sync is active low
2216 </para></listitem>
2217 </varlistentry>
2218 <varlistentry>
2219 <term>DRM_MODE_FLAG_HSKEW</term>
2220 <listitem><para>
2221 hskew provided (not used?)
2222 </para></listitem>
2223 </varlistentry>
2224 <varlistentry>
2225 <term>DRM_MODE_FLAG_BCAST</term>
2226 <listitem><para>
2227 not used?
2228 </para></listitem>
2229 </varlistentry>
2230 <varlistentry>
2231 <term>DRM_MODE_FLAG_PIXMUX</term>
2232 <listitem><para>
2233 not used?
2234 </para></listitem>
2235 </varlistentry>
2236 <varlistentry>
2237 <term>DRM_MODE_FLAG_DBLCLK</term>
2238 <listitem><para>
2239 not used?
2240 </para></listitem>
2241 </varlistentry>
2242 <varlistentry>
2243 <term>DRM_MODE_FLAG_CLKDIV2</term>
2244 <listitem><para>
2245 ?
2246 </para></listitem>
2247 </varlistentry>
2248 </variablelist>
2249 </para>
2250 <para>
2251 Note that modes marked with the INTERLACE or DBLSCAN flags will be
2252 filtered out by
2253 <function>drm_helper_probe_single_connector_modes</function> if
2254 the connector's <structfield>interlace_allowed</structfield> or
2255 <structfield>doublescan_allowed</structfield> field is set to 0.
2256 </para>
2257 </listitem>
2258 <listitem>
2259 <synopsis>char name[DRM_DISPLAY_MODE_LEN];</synopsis>
2260 <para>
2261 Mode name. The driver must call
2262 <function>drm_mode_set_name</function> to fill the mode name from
2263 <structfield>hdisplay</structfield>,
2264 <structfield>vdisplay</structfield> and interlace flag after
2265 filling the corresponding fields.
2266 </para>
2267 </listitem>
2268 </itemizedlist>
2269 </para>
2270 <para>
2271 The <structfield>vrefresh</structfield> value is computed by
2272 <function>drm_helper_probe_single_connector_modes</function>.
2273 </para>
2274 <para>
2275 When parsing EDID data, <function>drm_add_edid_modes</function> fills the
2276 connector <structfield>display_info</structfield>
2277 <structfield>width_mm</structfield> and
2278 <structfield>height_mm</structfield> fields. When creating modes
2279 manually the <methodname>get_modes</methodname> helper operation must
2280 set the <structfield>display_info</structfield>
2281 <structfield>width_mm</structfield> and
2282 <structfield>height_mm</structfield> fields if they haven't been set
2283 already (for instance at initialization time when a fixed-size panel is
2284 attached to the connector). The mode <structfield>width_mm</structfield>
2285 and <structfield>height_mm</structfield> fields are only used internally
2286 during EDID parsing and should not be set when creating modes manually.
2287 </para>
2288 </listitem>
2289 <listitem>
2290 <synopsis>int (*mode_valid)(struct drm_connector *connector,
2291 struct drm_display_mode *mode);</synopsis>
2292 <para>
2293 Verify whether a mode is valid for the connector. Return MODE_OK for
2294 supported modes and one of the enum drm_mode_status values (MODE_*)
2295 for unsupported modes. This operation is optional.
2296 </para>
2297 <para>
2298 As the mode rejection reason is currently not used beside for
2299 immediately removing the unsupported mode, an implementation can
2300 return MODE_BAD regardless of the exact reason why the mode is not
2301 valid.
2302 </para>
2303 <note><para>
2304 Note that the <methodname>mode_valid</methodname> helper operation is
2305 only called for modes detected by the device, and
2306 <emphasis>not</emphasis> for modes set by the user through the CRTC
2307 <methodname>set_config</methodname> operation.
2308 </para></note>
2309 </listitem>
2310 </itemizedlist>
2311 </sect2>
2312 <sect2>
2313 <title>Atomic Modeset Helper Functions Reference</title> 1582 <title>Atomic Modeset Helper Functions Reference</title>
2314 <sect3> 1583 <sect3>
2315 <title>Overview</title> 1584 <title>Overview</title>
@@ -2327,8 +1596,12 @@ void intel_crt_init(struct drm_device *dev)
2327!Edrivers/gpu/drm/drm_atomic_helper.c 1596!Edrivers/gpu/drm/drm_atomic_helper.c
2328 </sect2> 1597 </sect2>
2329 <sect2> 1598 <sect2>
2330 <title>Modeset Helper Functions Reference</title> 1599 <title>Modeset Helper Reference for Common Vtables</title>
2331!Iinclude/drm/drm_crtc_helper.h 1600!Iinclude/drm/drm_modeset_helper_vtables.h
1601!Pinclude/drm/drm_modeset_helper_vtables.h overview
1602 </sect2>
1603 <sect2>
1604 <title>Legacy CRTC/Modeset Helper Functions Reference</title>
2332!Edrivers/gpu/drm/drm_crtc_helper.c 1605!Edrivers/gpu/drm/drm_crtc_helper.c
2333!Pdrivers/gpu/drm/drm_crtc_helper.c overview 1606!Pdrivers/gpu/drm/drm_crtc_helper.c overview
2334 </sect2> 1607 </sect2>
@@ -4039,92 +3312,6 @@ int num_ioctls;</synopsis>
4039 <sect2> 3312 <sect2>
4040 <title>DPIO</title> 3313 <title>DPIO</title>
4041!Pdrivers/gpu/drm/i915/i915_reg.h DPIO 3314!Pdrivers/gpu/drm/i915/i915_reg.h DPIO
4042 <table id="dpiox2">
4043 <title>Dual channel PHY (VLV/CHV/BXT)</title>
4044 <tgroup cols="8">
4045 <colspec colname="c0" />
4046 <colspec colname="c1" />
4047 <colspec colname="c2" />
4048 <colspec colname="c3" />
4049 <colspec colname="c4" />
4050 <colspec colname="c5" />
4051 <colspec colname="c6" />
4052 <colspec colname="c7" />
4053 <spanspec spanname="ch0" namest="c0" nameend="c3" />
4054 <spanspec spanname="ch1" namest="c4" nameend="c7" />
4055 <spanspec spanname="ch0pcs01" namest="c0" nameend="c1" />
4056 <spanspec spanname="ch0pcs23" namest="c2" nameend="c3" />
4057 <spanspec spanname="ch1pcs01" namest="c4" nameend="c5" />
4058 <spanspec spanname="ch1pcs23" namest="c6" nameend="c7" />
4059 <thead>
4060 <row>
4061 <entry spanname="ch0">CH0</entry>
4062 <entry spanname="ch1">CH1</entry>
4063 </row>
4064 </thead>
4065 <tbody valign="top" align="center">
4066 <row>
4067 <entry spanname="ch0">CMN/PLL/REF</entry>
4068 <entry spanname="ch1">CMN/PLL/REF</entry>
4069 </row>
4070 <row>
4071 <entry spanname="ch0pcs01">PCS01</entry>
4072 <entry spanname="ch0pcs23">PCS23</entry>
4073 <entry spanname="ch1pcs01">PCS01</entry>
4074 <entry spanname="ch1pcs23">PCS23</entry>
4075 </row>
4076 <row>
4077 <entry>TX0</entry>
4078 <entry>TX1</entry>
4079 <entry>TX2</entry>
4080 <entry>TX3</entry>
4081 <entry>TX0</entry>
4082 <entry>TX1</entry>
4083 <entry>TX2</entry>
4084 <entry>TX3</entry>
4085 </row>
4086 <row>
4087 <entry spanname="ch0">DDI0</entry>
4088 <entry spanname="ch1">DDI1</entry>
4089 </row>
4090 </tbody>
4091 </tgroup>
4092 </table>
4093 <table id="dpiox1">
4094 <title>Single channel PHY (CHV/BXT)</title>
4095 <tgroup cols="4">
4096 <colspec colname="c0" />
4097 <colspec colname="c1" />
4098 <colspec colname="c2" />
4099 <colspec colname="c3" />
4100 <spanspec spanname="ch0" namest="c0" nameend="c3" />
4101 <spanspec spanname="ch0pcs01" namest="c0" nameend="c1" />
4102 <spanspec spanname="ch0pcs23" namest="c2" nameend="c3" />
4103 <thead>
4104 <row>
4105 <entry spanname="ch0">CH0</entry>
4106 </row>
4107 </thead>
4108 <tbody valign="top" align="center">
4109 <row>
4110 <entry spanname="ch0">CMN/PLL/REF</entry>
4111 </row>
4112 <row>
4113 <entry spanname="ch0pcs01">PCS01</entry>
4114 <entry spanname="ch0pcs23">PCS23</entry>
4115 </row>
4116 <row>
4117 <entry>TX0</entry>
4118 <entry>TX1</entry>
4119 <entry>TX2</entry>
4120 <entry>TX3</entry>
4121 </row>
4122 <row>
4123 <entry spanname="ch0">DDI2</entry>
4124 </row>
4125 </tbody>
4126 </tgroup>
4127 </table>
4128 </sect2> 3315 </sect2>
4129 3316
4130 <sect2> 3317 <sect2>
@@ -4201,17 +3388,21 @@ int num_ioctls;</synopsis>
4201 </sect2> 3388 </sect2>
4202 </sect1> 3389 </sect1>
4203 <sect1> 3390 <sect1>
4204 <title>GuC-based Command Submission</title> 3391 <title>GuC</title>
4205 <sect2> 3392 <sect2>
4206 <title>GuC</title> 3393 <title>GuC-specific firmware loader</title>
4207!Pdrivers/gpu/drm/i915/intel_guc_loader.c GuC-specific firmware loader 3394!Pdrivers/gpu/drm/i915/intel_guc_loader.c GuC-specific firmware loader
4208!Idrivers/gpu/drm/i915/intel_guc_loader.c 3395!Idrivers/gpu/drm/i915/intel_guc_loader.c
4209 </sect2> 3396 </sect2>
4210 <sect2> 3397 <sect2>
4211 <title>GuC Client</title> 3398 <title>GuC-based command submission</title>
4212!Pdrivers/gpu/drm/i915/i915_guc_submission.c GuC-based command submissison 3399!Pdrivers/gpu/drm/i915/i915_guc_submission.c GuC-based command submission
4213!Idrivers/gpu/drm/i915/i915_guc_submission.c 3400!Idrivers/gpu/drm/i915/i915_guc_submission.c
4214 </sect2> 3401 </sect2>
3402 <sect2>
3403 <title>GuC Firmware Layout</title>
3404!Pdrivers/gpu/drm/i915/intel_guc_fwif.h GuC Firmware Layout
3405 </sect2>
4215 </sect1> 3406 </sect1>
4216 3407
4217 <sect1> 3408 <sect1>
@@ -4246,41 +3437,63 @@ int num_ioctls;</synopsis>
4246 3437
4247 <chapter id="modes_of_use"> 3438 <chapter id="modes_of_use">
4248 <title>Modes of Use</title> 3439 <title>Modes of Use</title>
4249 <sect1> 3440 <sect1>
4250 <title>Manual switching and manual power control</title> 3441 <title>Manual switching and manual power control</title>
4251!Pdrivers/gpu/vga/vga_switcheroo.c Manual switching and manual power control 3442!Pdrivers/gpu/vga/vga_switcheroo.c Manual switching and manual power control
4252 </sect1> 3443 </sect1>
4253 <sect1> 3444 <sect1>
4254 <title>Driver power control</title> 3445 <title>Driver power control</title>
4255!Pdrivers/gpu/vga/vga_switcheroo.c Driver power control 3446!Pdrivers/gpu/vga/vga_switcheroo.c Driver power control
4256 </sect1> 3447 </sect1>
4257 </chapter> 3448 </chapter>
4258 3449
4259 <chapter id="pubfunctions"> 3450 <chapter id="api">
4260 <title>Public functions</title> 3451 <title>API</title>
3452 <sect1>
3453 <title>Public functions</title>
4261!Edrivers/gpu/vga/vga_switcheroo.c 3454!Edrivers/gpu/vga/vga_switcheroo.c
4262 </chapter> 3455 </sect1>
4263 3456 <sect1>
4264 <chapter id="pubstructures"> 3457 <title>Public structures</title>
4265 <title>Public structures</title>
4266!Finclude/linux/vga_switcheroo.h vga_switcheroo_handler 3458!Finclude/linux/vga_switcheroo.h vga_switcheroo_handler
4267!Finclude/linux/vga_switcheroo.h vga_switcheroo_client_ops 3459!Finclude/linux/vga_switcheroo.h vga_switcheroo_client_ops
4268 </chapter> 3460 </sect1>
4269 3461 <sect1>
4270 <chapter id="pubconstants"> 3462 <title>Public constants</title>
4271 <title>Public constants</title>
4272!Finclude/linux/vga_switcheroo.h vga_switcheroo_client_id 3463!Finclude/linux/vga_switcheroo.h vga_switcheroo_client_id
4273!Finclude/linux/vga_switcheroo.h vga_switcheroo_state 3464!Finclude/linux/vga_switcheroo.h vga_switcheroo_state
4274 </chapter> 3465 </sect1>
4275 3466 <sect1>
4276 <chapter id="privstructures"> 3467 <title>Private structures</title>
4277 <title>Private structures</title>
4278!Fdrivers/gpu/vga/vga_switcheroo.c vgasr_priv 3468!Fdrivers/gpu/vga/vga_switcheroo.c vgasr_priv
4279!Fdrivers/gpu/vga/vga_switcheroo.c vga_switcheroo_client 3469!Fdrivers/gpu/vga/vga_switcheroo.c vga_switcheroo_client
3470 </sect1>
3471 </chapter>
3472
3473 <chapter id="handlers">
3474 <title>Handlers</title>
3475 <sect1>
3476 <title>apple-gmux Handler</title>
3477!Pdrivers/platform/x86/apple-gmux.c Overview
3478!Pdrivers/platform/x86/apple-gmux.c Interrupt
3479 <sect2>
3480 <title>Graphics mux</title>
3481!Pdrivers/platform/x86/apple-gmux.c Graphics mux
3482 </sect2>
3483 <sect2>
3484 <title>Power control</title>
3485!Pdrivers/platform/x86/apple-gmux.c Power control
3486 </sect2>
3487 <sect2>
3488 <title>Backlight control</title>
3489!Pdrivers/platform/x86/apple-gmux.c Backlight control
3490 </sect2>
3491 </sect1>
4280 </chapter> 3492 </chapter>
4281 3493
4282!Cdrivers/gpu/vga/vga_switcheroo.c 3494!Cdrivers/gpu/vga/vga_switcheroo.c
4283!Cinclude/linux/vga_switcheroo.h 3495!Cinclude/linux/vga_switcheroo.h
3496!Cdrivers/platform/x86/apple-gmux.c
4284</part> 3497</part>
4285 3498
4286</book> 3499</book>
diff --git a/Documentation/DocBook/iio.tmpl b/Documentation/DocBook/iio.tmpl
index 98be322673da..f525bf56d1dd 100644
--- a/Documentation/DocBook/iio.tmpl
+++ b/Documentation/DocBook/iio.tmpl
@@ -458,7 +458,7 @@
458 .scan_type = { 458 .scan_type = {
459 .sign = 's', 459 .sign = 's',
460 .realbits = 12, 460 .realbits = 12,
461 .storgebits = 16, 461 .storagebits = 16,
462 .shift = 4, 462 .shift = 4,
463 .endianness = IIO_LE, 463 .endianness = IIO_LE,
464 }, 464 },
diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile
index 08527e7ea4d0..2840ff483d5a 100644
--- a/Documentation/DocBook/media/Makefile
+++ b/Documentation/DocBook/media/Makefile
@@ -199,8 +199,10 @@ DVB_DOCUMENTED = \
199# 199#
200 200
201install_media_images = \ 201install_media_images = \
202 $(Q)-mkdir $(MEDIA_OBJ_DIR)/media_api; \ 202 $(Q)if [ "x$(findstring media_api.xml,$(DOCBOOKS))" != "x" ]; then \
203 cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/*.svg $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api 203 mkdir -p $(MEDIA_OBJ_DIR)/media_api; \
204 cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/*.svg $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api; \
205 fi
204 206
205$(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64 207$(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64
206 $(Q)base64 -d $< >$@ 208 $(Q)base64 -d $< >$@
diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml
index 08227d4e9150..e579ae5088ae 100644
--- a/Documentation/DocBook/media/dvb/dvbproperty.xml
+++ b/Documentation/DocBook/media/dvb/dvbproperty.xml
@@ -76,7 +76,7 @@ int main(void)
76 76
77<para>NOTE: While it is possible to directly call the Kernel code like the 77<para>NOTE: While it is possible to directly call the Kernel code like the
78 above example, it is strongly recommended to use 78 above example, it is strongly recommended to use
79 <ulink url="http://linuxtv.org/docs/libdvbv5/index.html">libdvbv5</ulink>, 79 <ulink url="https://linuxtv.org/docs/libdvbv5/index.html">libdvbv5</ulink>,
80 as it provides abstraction to work with the supported digital TV standards 80 as it provides abstraction to work with the supported digital TV standards
81 and provides methods for usual operations like program scanning and to 81 and provides methods for usual operations like program scanning and to
82 read/write channel descriptor files.</para> 82 read/write channel descriptor files.</para>
diff --git a/Documentation/DocBook/media/dvb/examples.xml b/Documentation/DocBook/media/dvb/examples.xml
index c9f68c7183cc..837fb3b64b72 100644
--- a/Documentation/DocBook/media/dvb/examples.xml
+++ b/Documentation/DocBook/media/dvb/examples.xml
@@ -3,7 +3,7 @@
3</para> 3</para>
4<para>NOTE: This section is out of date, and the code below won't even 4<para>NOTE: This section is out of date, and the code below won't even
5 compile. Please refer to the 5 compile. Please refer to the
6 <ulink url="http://linuxtv.org/docs/libdvbv5/index.html">libdvbv5</ulink> 6 <ulink url="https://linuxtv.org/docs/libdvbv5/index.html">libdvbv5</ulink>
7 for updated/recommended examples. 7 for updated/recommended examples.
8</para> 8</para>
9 9
diff --git a/Documentation/DocBook/media/dvb/intro.xml b/Documentation/DocBook/media/dvb/intro.xml
index 51db15648099..b5b701f5d8c2 100644
--- a/Documentation/DocBook/media/dvb/intro.xml
+++ b/Documentation/DocBook/media/dvb/intro.xml
@@ -32,7 +32,7 @@ and filtering several section and PES data streams at the same time.
32new standard Linux DVB API. As a commitment to the development of 32new standard Linux DVB API. As a commitment to the development of
33terminals based on open standards, Nokia and Convergence made it 33terminals based on open standards, Nokia and Convergence made it
34available to all Linux developers and published it on 34available to all Linux developers and published it on
35<ulink url="http://www.linuxtv.org/" /> in September 2000. 35<ulink url="https://linuxtv.org" /> in September 2000.
36Convergence is the maintainer of the Linux DVB API. Together with the 36Convergence is the maintainer of the Linux DVB API. Together with the
37LinuxTV community (i.e. you, the reader of this document), the Linux DVB 37LinuxTV community (i.e. you, the reader of this document), the Linux DVB
38API will be constantly reviewed and improved. With the Linux driver for 38API will be constantly reviewed and improved. With the Linux driver for
diff --git a/Documentation/DocBook/media/v4l/capture.c.xml b/Documentation/DocBook/media/v4l/capture.c.xml
index 1c5c49a2de59..22126a991b34 100644
--- a/Documentation/DocBook/media/v4l/capture.c.xml
+++ b/Documentation/DocBook/media/v4l/capture.c.xml
@@ -5,7 +5,7 @@
5 * This program can be used and distributed without restrictions. 5 * This program can be used and distributed without restrictions.
6 * 6 *
7 * This program is provided with the V4L2 API 7 * This program is provided with the V4L2 API
8 * see http://linuxtv.org/docs.php for more information 8 * see https://linuxtv.org/docs.php for more information
9 */ 9 */
10 10
11#include &lt;stdio.h&gt; 11#include &lt;stdio.h&gt;
diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml
index 5701a08ed792..5399e8904715 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2666,7 +2666,7 @@ is useful to display images captured with V4L2 devices.</para>
2666 <para>V4L2 does not support digital terrestrial, cable or 2666 <para>V4L2 does not support digital terrestrial, cable or
2667satellite broadcast. A separate project aiming at digital receivers 2667satellite broadcast. A separate project aiming at digital receivers
2668exists. You can find its homepage at <ulink 2668exists. You can find its homepage at <ulink
2669url="http://linuxtv.org">http://linuxtv.org</ulink>. The Linux DVB API 2669url="https://linuxtv.org">https://linuxtv.org</ulink>. The Linux DVB API
2670has no connection to the V4L2 API except that drivers for hybrid 2670has no connection to the V4L2 API except that drivers for hybrid
2671hardware may support both.</para> 2671hardware may support both.</para>
2672 </section> 2672 </section>
diff --git a/Documentation/DocBook/media/v4l/io.xml b/Documentation/DocBook/media/v4l/io.xml
index da654031ef3f..144158b3a5ac 100644
--- a/Documentation/DocBook/media/v4l/io.xml
+++ b/Documentation/DocBook/media/v4l/io.xml
@@ -699,7 +699,7 @@ linkend="v4l2-buf-type" /></entry>
699buffer. It depends on the negotiated data format and may change with 699buffer. It depends on the negotiated data format and may change with
700each buffer for compressed variable size data like JPEG images. 700each buffer for compressed variable size data like JPEG images.
701Drivers must set this field when <structfield>type</structfield> 701Drivers must set this field when <structfield>type</structfield>
702refers to an input stream, applications when it refers to an output stream. 702refers to a capture stream, applications when it refers to an output stream.
703If the application sets this to 0 for an output stream, then 703If the application sets this to 0 for an output stream, then
704<structfield>bytesused</structfield> will be set to the size of the 704<structfield>bytesused</structfield> will be set to the size of the
705buffer (see the <structfield>length</structfield> field of this struct) by 705buffer (see the <structfield>length</structfield> field of this struct) by
@@ -720,14 +720,14 @@ linkend="buffer-flags" />.</entry>
720 <entry>Indicates the field order of the image in the 720 <entry>Indicates the field order of the image in the
721buffer, see <xref linkend="v4l2-field" />. This field is not used when 721buffer, see <xref linkend="v4l2-field" />. This field is not used when
722the buffer contains VBI data. Drivers must set it when 722the buffer contains VBI data. Drivers must set it when
723<structfield>type</structfield> refers to an input stream, 723<structfield>type</structfield> refers to a capture stream,
724applications when it refers to an output stream.</entry> 724applications when it refers to an output stream.</entry>
725 </row> 725 </row>
726 <row> 726 <row>
727 <entry>struct timeval</entry> 727 <entry>struct timeval</entry>
728 <entry><structfield>timestamp</structfield></entry> 728 <entry><structfield>timestamp</structfield></entry>
729 <entry></entry> 729 <entry></entry>
730 <entry><para>For input streams this is time when the first data 730 <entry><para>For capture streams this is time when the first data
731 byte was captured, as returned by the 731 byte was captured, as returned by the
732 <function>clock_gettime()</function> function for the relevant 732 <function>clock_gettime()</function> function for the relevant
733 clock id; see <constant>V4L2_BUF_FLAG_TIMESTAMP_*</constant> in 733 clock id; see <constant>V4L2_BUF_FLAG_TIMESTAMP_*</constant> in
@@ -866,7 +866,7 @@ must set this to 0.</entry>
866 <entry></entry> 866 <entry></entry>
867 <entry>The number of bytes occupied by data in the plane 867 <entry>The number of bytes occupied by data in the plane
868 (its payload). Drivers must set this field when <structfield>type</structfield> 868 (its payload). Drivers must set this field when <structfield>type</structfield>
869 refers to an input stream, applications when it refers to an output stream. 869 refers to a capture stream, applications when it refers to an output stream.
870 If the application sets this to 0 for an output stream, then 870 If the application sets this to 0 for an output stream, then
871 <structfield>bytesused</structfield> will be set to the size of the 871 <structfield>bytesused</structfield> will be set to the size of the
872 plane (see the <structfield>length</structfield> field of this struct) 872 plane (see the <structfield>length</structfield> field of this struct)
@@ -919,7 +919,7 @@ must set this to 0.</entry>
919 <entry></entry> 919 <entry></entry>
920 <entry>Offset in bytes to video data in the plane. 920 <entry>Offset in bytes to video data in the plane.
921 Drivers must set this field when <structfield>type</structfield> 921 Drivers must set this field when <structfield>type</structfield>
922 refers to an input stream, applications when it refers to an output stream. 922 refers to a capture stream, applications when it refers to an output stream.
923 Note that data_offset is included in <structfield>bytesused</structfield>. 923 Note that data_offset is included in <structfield>bytesused</structfield>.
924 So the size of the image in the plane is 924 So the size of the image in the plane is
925 <structfield>bytesused</structfield>-<structfield>data_offset</structfield> at 925 <structfield>bytesused</structfield>-<structfield>data_offset</structfield> at
diff --git a/Documentation/DocBook/media/v4l/media-controller.xml b/Documentation/DocBook/media/v4l/media-controller.xml
index 873ac3a621f0..5f2fc07a93d7 100644
--- a/Documentation/DocBook/media/v4l/media-controller.xml
+++ b/Documentation/DocBook/media/v4l/media-controller.xml
@@ -58,21 +58,36 @@
58 <title>Media device model</title> 58 <title>Media device model</title>
59 <para>Discovering a device internal topology, and configuring it at runtime, 59 <para>Discovering a device internal topology, and configuring it at runtime,
60 is one of the goals of the media controller API. To achieve this, hardware 60 is one of the goals of the media controller API. To achieve this, hardware
61 devices are modelled as an oriented graph of building blocks called entities 61 devices and Linux Kernel interfaces are modelled as graph objects on
62 connected through pads.</para> 62 an oriented graph. The object types that constitute the graph are:</para>
63 <para>An entity is a basic media hardware or software building block. It can 63 <itemizedlist>
64 correspond to a large variety of logical blocks such as physical hardware 64 <listitem><para>An <emphasis role="bold">entity</emphasis>
65 devices (CMOS sensor for instance), logical hardware devices (a building 65 is a basic media hardware or software building block. It can correspond to
66 block in a System-on-Chip image processing pipeline), DMA channels or 66 a large variety of logical blocks such as physical hardware devices
67 physical connectors.</para> 67 (CMOS sensor for instance), logical hardware devices (a building block in
68 <para>A pad is a connection endpoint through which an entity can interact 68 a System-on-Chip image processing pipeline), DMA channels or physical
69 with other entities. Data (not restricted to video) produced by an entity 69 connectors.</para></listitem>
70 flows from the entity's output to one or more entity inputs. Pads should not 70 <listitem><para>An <emphasis role="bold">interface</emphasis>
71 be confused with physical pins at chip boundaries.</para> 71 is a graph representation of a Linux Kernel userspace API interface,
72 <para>A link is a point-to-point oriented connection between two pads, 72 like a device node or a sysfs file that controls one or more entities
73 either on the same entity or on different entities. Data flows from a source 73 in the graph.</para></listitem>
74 pad to a sink pad.</para> 74 <listitem><para>A <emphasis role="bold">pad</emphasis>
75 is a data connection endpoint through which an entity can interact with
76 other entities. Data (not restricted to video) produced by an entity
77 flows from the entity's output to one or more entity inputs. Pads should
78 not be confused with physical pins at chip boundaries.</para></listitem>
79 <listitem><para>A <emphasis role="bold">data link</emphasis>
80 is a point-to-point oriented connection between two pads, either on the
81 same entity or on different entities. Data flows from a source pad to a
82 sink pad.</para></listitem>
83 <listitem><para>An <emphasis role="bold">interface link</emphasis>
84 is a point-to-point bidirectional control connection between a Linux
85 Kernel interface and an entity.m</para></listitem>
86 </itemizedlist>
75 </section> 87 </section>
88
89 <!-- All non-ioctl specific data types go here. -->
90 &sub-media-types;
76</chapter> 91</chapter>
77 92
78<appendix id="media-user-func"> 93<appendix id="media-user-func">
@@ -83,6 +98,7 @@
83 &sub-media-func-ioctl; 98 &sub-media-func-ioctl;
84 <!-- All ioctls go here. --> 99 <!-- All ioctls go here. -->
85 &sub-media-ioc-device-info; 100 &sub-media-ioc-device-info;
101 &sub-media-ioc-g-topology;
86 &sub-media-ioc-enum-entities; 102 &sub-media-ioc-enum-entities;
87 &sub-media-ioc-enum-links; 103 &sub-media-ioc-enum-links;
88 &sub-media-ioc-setup-link; 104 &sub-media-ioc-setup-link;
diff --git a/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml b/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml
index 5872f8bbf774..0c4f96bfc2de 100644
--- a/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml
+++ b/Documentation/DocBook/media/v4l/media-ioc-enum-entities.xml
@@ -59,15 +59,6 @@
59 <para>Entity IDs can be non-contiguous. Applications must 59 <para>Entity IDs can be non-contiguous. Applications must
60 <emphasis>not</emphasis> try to enumerate entities by calling 60 <emphasis>not</emphasis> try to enumerate entities by calling
61 MEDIA_IOC_ENUM_ENTITIES with increasing id's until they get an error.</para> 61 MEDIA_IOC_ENUM_ENTITIES with increasing id's until they get an error.</para>
62 <para>Two or more entities that share a common non-zero
63 <structfield>group_id</structfield> value are considered as logically
64 grouped. Groups are used to report
65 <itemizedlist>
66 <listitem><para>ALSA, VBI and video nodes that carry the same media
67 stream</para></listitem>
68 <listitem><para>lens and flash controllers associated with a sensor</para></listitem>
69 </itemizedlist>
70 </para>
71 62
72 <table pgwide="1" frame="none" id="media-entity-desc"> 63 <table pgwide="1" frame="none" id="media-entity-desc">
73 <title>struct <structname>media_entity_desc</structname></title> 64 <title>struct <structname>media_entity_desc</structname></title>
@@ -106,7 +97,7 @@
106 <entry><structfield>revision</structfield></entry> 97 <entry><structfield>revision</structfield></entry>
107 <entry></entry> 98 <entry></entry>
108 <entry></entry> 99 <entry></entry>
109 <entry>Entity revision in a driver/hardware specific format.</entry> 100 <entry>Entity revision. Always zero (obsolete)</entry>
110 </row> 101 </row>
111 <row> 102 <row>
112 <entry>__u32</entry> 103 <entry>__u32</entry>
@@ -120,7 +111,7 @@
120 <entry><structfield>group_id</structfield></entry> 111 <entry><structfield>group_id</structfield></entry>
121 <entry></entry> 112 <entry></entry>
122 <entry></entry> 113 <entry></entry>
123 <entry>Entity group ID</entry> 114 <entry>Entity group ID. Always zero (obsolete)</entry>
124 </row> 115 </row>
125 <row> 116 <row>
126 <entry>__u16</entry> 117 <entry>__u16</entry>
@@ -171,97 +162,6 @@
171 </tbody> 162 </tbody>
172 </tgroup> 163 </tgroup>
173 </table> 164 </table>
174
175 <table frame="none" pgwide="1" id="media-entity-type">
176 <title>Media entity types</title>
177 <tgroup cols="2">
178 <colspec colname="c1"/>
179 <colspec colname="c2"/>
180 <tbody valign="top">
181 <row>
182 <entry><constant>MEDIA_ENT_T_DEVNODE</constant></entry>
183 <entry>Unknown device node</entry>
184 </row>
185 <row>
186 <entry><constant>MEDIA_ENT_T_DEVNODE_V4L</constant></entry>
187 <entry>V4L video, radio or vbi device node</entry>
188 </row>
189 <row>
190 <entry><constant>MEDIA_ENT_T_DEVNODE_FB</constant></entry>
191 <entry>Frame buffer device node</entry>
192 </row>
193 <row>
194 <entry><constant>MEDIA_ENT_T_DEVNODE_ALSA</constant></entry>
195 <entry>ALSA card</entry>
196 </row>
197 <row>
198 <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_FE</constant></entry>
199 <entry>DVB frontend devnode</entry>
200 </row>
201 <row>
202 <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_DEMUX</constant></entry>
203 <entry>DVB demux devnode</entry>
204 </row>
205 <row>
206 <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_DVR</constant></entry>
207 <entry>DVB DVR devnode</entry>
208 </row>
209 <row>
210 <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_CA</constant></entry>
211 <entry>DVB CAM devnode</entry>
212 </row>
213 <row>
214 <entry><constant>MEDIA_ENT_T_DEVNODE_DVB_NET</constant></entry>
215 <entry>DVB network devnode</entry>
216 </row>
217 <row>
218 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV</constant></entry>
219 <entry>Unknown V4L sub-device</entry>
220 </row>
221 <row>
222 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_SENSOR</constant></entry>
223 <entry>Video sensor</entry>
224 </row>
225 <row>
226 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_FLASH</constant></entry>
227 <entry>Flash controller</entry>
228 </row>
229 <row>
230 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_LENS</constant></entry>
231 <entry>Lens controller</entry>
232 </row>
233 <row>
234 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_DECODER</constant></entry>
235 <entry>Video decoder, the basic function of the video decoder is to
236 accept analogue video from a wide variety of sources such as
237 broadcast, DVD players, cameras and video cassette recorders, in
238 either NTSC, PAL or HD format and still occasionally SECAM, separate
239 it into its component parts, luminance and chrominance, and output
240 it in some digital video standard, with appropriate embedded timing
241 signals.</entry>
242 </row>
243 <row>
244 <entry><constant>MEDIA_ENT_T_V4L2_SUBDEV_TUNER</constant></entry>
245 <entry>TV and/or radio tuner</entry>
246 </row>
247 </tbody>
248 </tgroup>
249 </table>
250
251 <table frame="none" pgwide="1" id="media-entity-flag">
252 <title>Media entity flags</title>
253 <tgroup cols="2">
254 <colspec colname="c1"/>
255 <colspec colname="c2"/>
256 <tbody valign="top">
257 <row>
258 <entry><constant>MEDIA_ENT_FL_DEFAULT</constant></entry>
259 <entry>Default entity for its type. Used to discover the default
260 audio, VBI and video devices, the default camera sensor, ...</entry>
261 </row>
262 </tbody>
263 </tgroup>
264 </table>
265 </refsect1> 165 </refsect1>
266 166
267 <refsect1> 167 <refsect1>
diff --git a/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml b/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml
index 74fb394ec667..2bbeea9f3e18 100644
--- a/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml
+++ b/Documentation/DocBook/media/v4l/media-ioc-enum-links.xml
@@ -118,35 +118,6 @@
118 </tgroup> 118 </tgroup>
119 </table> 119 </table>
120 120
121 <table frame="none" pgwide="1" id="media-pad-flag">
122 <title>Media pad flags</title>
123 <tgroup cols="2">
124 <colspec colname="c1"/>
125 <colspec colname="c2"/>
126 <tbody valign="top">
127 <row>
128 <entry><constant>MEDIA_PAD_FL_SINK</constant></entry>
129 <entry>Input pad, relative to the entity. Input pads sink data and
130 are targets of links.</entry>
131 </row>
132 <row>
133 <entry><constant>MEDIA_PAD_FL_SOURCE</constant></entry>
134 <entry>Output pad, relative to the entity. Output pads source data
135 and are origins of links.</entry>
136 </row>
137 <row>
138 <entry><constant>MEDIA_PAD_FL_MUST_CONNECT</constant></entry>
139 <entry>If this flag is set and the pad is linked to any other
140 pad, then at least one of those links must be enabled for the
141 entity to be able to stream. There could be temporary reasons
142 (e.g. device configuration dependent) for the pad to need
143 enabled links even when this flag isn't set; the absence of the
144 flag doesn't imply there is none.</entry>
145 </row>
146 </tbody>
147 </tgroup>
148 </table>
149
150 <table pgwide="1" frame="none" id="media-link-desc"> 121 <table pgwide="1" frame="none" id="media-link-desc">
151 <title>struct <structname>media_link_desc</structname></title> 122 <title>struct <structname>media_link_desc</structname></title>
152 <tgroup cols="3"> 123 <tgroup cols="3">
@@ -171,33 +142,6 @@
171 </tgroup> 142 </tgroup>
172 </table> 143 </table>
173 144
174 <table frame="none" pgwide="1" id="media-link-flag">
175 <title>Media link flags</title>
176 <tgroup cols="2">
177 <colspec colname="c1"/>
178 <colspec colname="c2"/>
179 <tbody valign="top">
180 <row>
181 <entry><constant>MEDIA_LNK_FL_ENABLED</constant></entry>
182 <entry>The link is enabled and can be used to transfer media data.
183 When two or more links target a sink pad, only one of them can be
184 enabled at a time.</entry>
185 </row>
186 <row>
187 <entry><constant>MEDIA_LNK_FL_IMMUTABLE</constant></entry>
188 <entry>The link enabled state can't be modified at runtime. An
189 immutable link is always enabled.</entry>
190 </row>
191 <row>
192 <entry><constant>MEDIA_LNK_FL_DYNAMIC</constant></entry>
193 <entry>The link enabled state can be modified during streaming. This
194 flag is set by drivers and is read-only for applications.</entry>
195 </row>
196 </tbody>
197 </tgroup>
198 </table>
199 <para>One and only one of <constant>MEDIA_PAD_FL_SINK</constant> and
200 <constant>MEDIA_PAD_FL_SOURCE</constant> must be set for every pad.</para>
201 </refsect1> 145 </refsect1>
202 146
203 <refsect1> 147 <refsect1>
diff --git a/Documentation/DocBook/media/v4l/media-ioc-g-topology.xml b/Documentation/DocBook/media/v4l/media-ioc-g-topology.xml
new file mode 100644
index 000000000000..63152ab9efba
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/media-ioc-g-topology.xml
@@ -0,0 +1,394 @@
1<refentry id="media-g-topology">
2 <refmeta>
3 <refentrytitle>ioctl MEDIA_IOC_G_TOPOLOGY</refentrytitle>
4 &manvol;
5 </refmeta>
6
7 <refnamediv>
8 <refname>MEDIA_IOC_G_TOPOLOGY</refname>
9 <refpurpose>Enumerate the graph topology and graph element properties</refpurpose>
10 </refnamediv>
11
12 <refsynopsisdiv>
13 <funcsynopsis>
14 <funcprototype>
15 <funcdef>int <function>ioctl</function></funcdef>
16 <paramdef>int <parameter>fd</parameter></paramdef>
17 <paramdef>int <parameter>request</parameter></paramdef>
18 <paramdef>struct media_v2_topology *<parameter>argp</parameter></paramdef>
19 </funcprototype>
20 </funcsynopsis>
21 </refsynopsisdiv>
22
23 <refsect1>
24 <title>Arguments</title>
25
26 <variablelist>
27 <varlistentry>
28 <term><parameter>fd</parameter></term>
29 <listitem>
30 <para>File descriptor returned by
31 <link linkend='media-func-open'><function>open()</function></link>.</para>
32 </listitem>
33 </varlistentry>
34 <varlistentry>
35 <term><parameter>request</parameter></term>
36 <listitem>
37 <para>MEDIA_IOC_G_TOPOLOGY</para>
38 </listitem>
39 </varlistentry>
40 <varlistentry>
41 <term><parameter>argp</parameter></term>
42 <listitem>
43 <para></para>
44 </listitem>
45 </varlistentry>
46 </variablelist>
47 </refsect1>
48
49 <refsect1>
50 <title>Description</title>
51
52 <para><emphasis role="bold">NOTE:</emphasis> This new ioctl is programmed to be added on Kernel 4.6. Its definition/arguments may change until its final version.</para>
53
54 <para>The typical usage of this ioctl is to call it twice.
55 On the first call, the structure defined at &media-v2-topology; should
56 be zeroed. At return, if no errors happen, this ioctl will return the
57 <constant>topology_version</constant> and the total number of entities,
58 interfaces, pads and links.</para>
59 <para>Before the second call, the userspace should allocate arrays to
60 store the graph elements that are desired, putting the pointers to them
61 at the ptr_entities, ptr_interfaces, ptr_links and/or ptr_pads, keeping
62 the other values untouched.</para>
63 <para>If the <constant>topology_version</constant> remains the same, the
64 ioctl should fill the desired arrays with the media graph elements.</para>
65
66 <table pgwide="1" frame="none" id="media-v2-topology">
67 <title>struct <structname>media_v2_topology</structname></title>
68 <tgroup cols="5">
69 <colspec colname="c1" />
70 <colspec colname="c2" />
71 <colspec colname="c3" />
72 <colspec colname="c4" />
73 <colspec colname="c5" />
74 <tbody valign="top">
75 <row>
76 <entry>__u64</entry>
77 <entry><structfield>topology_version</structfield></entry>
78 <entry></entry>
79 <entry></entry>
80 <entry>Version of the media graph topology. When the graph is
81 created, this field starts with zero. Every time a graph
82 element is added or removed, this field is
83 incremented.</entry>
84 </row>
85 <row>
86 <entry>__u64</entry>
87 <entry><structfield>num_entities</structfield></entry>
88 <entry></entry>
89 <entry></entry>
90 <entry>Number of entities in the graph</entry>
91 </row>
92 <row>
93 <entry>__u64</entry>
94 <entry><structfield>ptr_entities</structfield></entry>
95 <entry></entry>
96 <entry></entry>
97 <entry>A pointer to a memory area where the entities array
98 will be stored, converted to a 64-bits integer.
99 It can be zero. if zero, the ioctl won't store the
100 entities. It will just update
101 <constant>num_entities</constant></entry>
102 </row>
103 <row>
104 <entry>__u64</entry>
105 <entry><structfield>num_interfaces</structfield></entry>
106 <entry></entry>
107 <entry></entry>
108 <entry>Number of interfaces in the graph</entry>
109 </row>
110 <row>
111 <entry>__u64</entry>
112 <entry><structfield>ptr_interfaces</structfield></entry>
113 <entry></entry>
114 <entry></entry>
115 <entry>A pointer to a memory area where the interfaces array
116 will be stored, converted to a 64-bits integer.
117 It can be zero. if zero, the ioctl won't store the
118 interfaces. It will just update
119 <constant>num_interfaces</constant></entry>
120 </row>
121 <row>
122 <entry>__u64</entry>
123 <entry><structfield>num_pads</structfield></entry>
124 <entry></entry>
125 <entry></entry>
126 <entry>Total number of pads in the graph</entry>
127 </row>
128 <row>
129 <entry>__u64</entry>
130 <entry><structfield>ptr_pads</structfield></entry>
131 <entry></entry>
132 <entry></entry>
133 <entry>A pointer to a memory area where the pads array
134 will be stored, converted to a 64-bits integer.
135 It can be zero. if zero, the ioctl won't store the
136 pads. It will just update
137 <constant>num_pads</constant></entry>
138 </row>
139 <row>
140 <entry>__u64</entry>
141 <entry><structfield>num_links</structfield></entry>
142 <entry></entry>
143 <entry></entry>
144 <entry>Total number of data and interface links in the graph</entry>
145 </row>
146 <row>
147 <entry>__u64</entry>
148 <entry><structfield>ptr_links</structfield></entry>
149 <entry></entry>
150 <entry></entry>
151 <entry>A pointer to a memory area where the links array
152 will be stored, converted to a 64-bits integer.
153 It can be zero. if zero, the ioctl won't store the
154 links. It will just update
155 <constant>num_links</constant></entry>
156 </row>
157 </tbody>
158 </tgroup>
159 </table>
160
161 <table pgwide="1" frame="none" id="media-v2-entity">
162 <title>struct <structname>media_v2_entity</structname></title>
163 <tgroup cols="5">
164 <colspec colname="c1" />
165 <colspec colname="c2" />
166 <colspec colname="c3" />
167 <colspec colname="c4" />
168 <colspec colname="c5" />
169 <tbody valign="top">
170 <row>
171 <entry>__u32</entry>
172 <entry><structfield>id</structfield></entry>
173 <entry></entry>
174 <entry></entry>
175 <entry>Unique ID for the entity.</entry>
176 </row>
177 <row>
178 <entry>char</entry>
179 <entry><structfield>name</structfield>[64]</entry>
180 <entry></entry>
181 <entry></entry>
182 <entry>Entity name as an UTF-8 NULL-terminated string.</entry>
183 </row>
184 <row>
185 <entry>__u32</entry>
186 <entry><structfield>function</structfield></entry>
187 <entry></entry>
188 <entry></entry>
189 <entry>Entity main function, see <xref linkend="media-entity-type" /> for details.</entry>
190 </row>
191 <row>
192 <entry>__u32</entry>
193 <entry><structfield>reserved</structfield>[12]</entry>
194 <entry>Reserved for future extensions. Drivers and applications must
195 set this array to zero.</entry>
196 </row>
197 </tbody>
198 </tgroup>
199 </table>
200
201 <table pgwide="1" frame="none" id="media-v2-interface">
202 <title>struct <structname>media_v2_interface</structname></title>
203 <tgroup cols="5">
204 <colspec colname="c1" />
205 <colspec colname="c2" />
206 <colspec colname="c3" />
207 <colspec colname="c4" />
208 <colspec colname="c5" />
209 <tbody valign="top">
210 <row>
211 <entry>__u32</entry>
212 <entry><structfield>id</structfield></entry>
213 <entry></entry>
214 <entry></entry>
215 <entry>Unique ID for the interface.</entry>
216 </row>
217 <row>
218 <entry>__u32</entry>
219 <entry><structfield>intf_type</structfield></entry>
220 <entry></entry>
221 <entry></entry>
222 <entry>Interface type, see <xref linkend="media-intf-type" /> for details.</entry>
223 </row>
224 <row>
225 <entry>__u32</entry>
226 <entry><structfield>flags</structfield></entry>
227 <entry></entry>
228 <entry></entry>
229 <entry>Interface flags. Currently unused.</entry>
230 </row>
231 <row>
232 <entry>__u32</entry>
233 <entry><structfield>reserved</structfield>[9]</entry>
234 <entry></entry>
235 <entry></entry>
236 <entry>Reserved for future extensions. Drivers and applications must
237 set this array to zero.</entry>
238 </row>
239 <row>
240 <entry>struct media_v2_intf_devnode</entry>
241 <entry><structfield>devnode</structfield></entry>
242 <entry></entry>
243 <entry></entry>
244 <entry>Used only for device node interfaces. See <xref linkend="media-v2-intf-devnode" /> for details..</entry>
245 </row>
246 </tbody>
247 </tgroup>
248 </table>
249
250 <table pgwide="1" frame="none" id="media-v2-intf-devnode">
251 <title>struct <structname>media_v2_interface</structname></title>
252 <tgroup cols="5">
253 <colspec colname="c1" />
254 <colspec colname="c2" />
255 <colspec colname="c3" />
256 <colspec colname="c4" />
257 <colspec colname="c5" />
258 <tbody valign="top">
259 <row>
260 <entry>__u32</entry>
261 <entry><structfield>major</structfield></entry>
262 <entry></entry>
263 <entry></entry>
264 <entry>Device node major number.</entry>
265 </row>
266 <row>
267 <entry>__u32</entry>
268 <entry><structfield>minor</structfield></entry>
269 <entry></entry>
270 <entry></entry>
271 <entry>Device node minor number.</entry>
272 </row>
273 </tbody>
274 </tgroup>
275 </table>
276
277 <table pgwide="1" frame="none" id="media-v2-pad">
278 <title>struct <structname>media_v2_pad</structname></title>
279 <tgroup cols="5">
280 <colspec colname="c1" />
281 <colspec colname="c2" />
282 <colspec colname="c3" />
283 <colspec colname="c4" />
284 <colspec colname="c5" />
285 <tbody valign="top">
286 <row>
287 <entry>__u32</entry>
288 <entry><structfield>id</structfield></entry>
289 <entry></entry>
290 <entry></entry>
291 <entry>Unique ID for the pad.</entry>
292 </row>
293 <row>
294 <entry>__u32</entry>
295 <entry><structfield>entity_id</structfield></entry>
296 <entry></entry>
297 <entry></entry>
298 <entry>Unique ID for the entity where this pad belongs.</entry>
299 </row>
300 <row>
301 <entry>__u32</entry>
302 <entry><structfield>flags</structfield></entry>
303 <entry></entry>
304 <entry></entry>
305 <entry>Pad flags, see <xref linkend="media-pad-flag" /> for more details.</entry>
306 </row>
307 <row>
308 <entry>__u32</entry>
309 <entry><structfield>reserved</structfield>[9]</entry>
310 <entry></entry>
311 <entry></entry>
312 <entry>Reserved for future extensions. Drivers and applications must
313 set this array to zero.</entry>
314 </row>
315 </tbody>
316 </tgroup>
317 </table>
318
319 <table pgwide="1" frame="none" id="media-v2-link">
320 <title>struct <structname>media_v2_pad</structname></title>
321 <tgroup cols="5">
322 <colspec colname="c1" />
323 <colspec colname="c2" />
324 <colspec colname="c3" />
325 <colspec colname="c4" />
326 <colspec colname="c5" />
327 <tbody valign="top">
328 <row>
329 <entry>__u32</entry>
330 <entry><structfield>id</structfield></entry>
331 <entry></entry>
332 <entry></entry>
333 <entry>Unique ID for the pad.</entry>
334 </row>
335 <row>
336 <entry>__u32</entry>
337 <entry><structfield>source_id</structfield></entry>
338 <entry></entry>
339 <entry></entry>
340 <entry>
341 <para>On pad to pad links: unique ID for the source pad.</para>
342 <para>On interface to entity links: unique ID for the interface.</para>
343 </entry>
344 </row>
345 <row>
346 <entry>__u32</entry>
347 <entry><structfield>sink_id</structfield></entry>
348 <entry></entry>
349 <entry></entry>
350 <entry>
351 <para>On pad to pad links: unique ID for the sink pad.</para>
352 <para>On interface to entity links: unique ID for the entity.</para>
353 </entry>
354 </row>
355 <row>
356 <entry>__u32</entry>
357 <entry><structfield>flags</structfield></entry>
358 <entry></entry>
359 <entry></entry>
360 <entry>Link flags, see <xref linkend="media-link-flag" /> for more details.</entry>
361 </row>
362 <row>
363 <entry>__u32</entry>
364 <entry><structfield>reserved</structfield>[5]</entry>
365 <entry></entry>
366 <entry></entry>
367 <entry>Reserved for future extensions. Drivers and applications must
368 set this array to zero.</entry>
369 </row>
370 </tbody>
371 </tgroup>
372 </table>
373
374 </refsect1>
375
376 <refsect1>
377 &return-value;
378
379 <variablelist>
380 <varlistentry>
381 <term><errorcode>ENOSPC</errorcode></term>
382 <listitem>
383 <para>This is returned when either one or more of the num_entities,
384 num_interfaces, num_links or num_pads are non-zero and are smaller
385 than the actual number of elements inside the graph. This may happen
386 if the <constant>topology_version</constant> changed when compared
387 to the last time this ioctl was called. Userspace should usually
388 free the area for the pointers, zero the struct elements and call
389 this ioctl again.</para>
390 </listitem>
391 </varlistentry>
392 </variablelist>
393 </refsect1>
394</refentry>
diff --git a/Documentation/DocBook/media/v4l/media-types.xml b/Documentation/DocBook/media/v4l/media-types.xml
new file mode 100644
index 000000000000..1af384250910
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/media-types.xml
@@ -0,0 +1,240 @@
1<section id="media-controller-types">
2<title>Types and flags used to represent the media graph elements</title>
3
4 <table frame="none" pgwide="1" id="media-entity-type">
5 <title>Media entity types</title>
6 <tgroup cols="2">
7 <colspec colname="c1"/>
8 <colspec colname="c2"/>
9 <tbody valign="top">
10 <row>
11 <entry><constant>MEDIA_ENT_F_UNKNOWN</constant> and <constant>MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN</constant></entry>
12 <entry>Unknown entity. That generally indicates that
13 a driver didn't initialize properly the entity, with is a Kernel bug</entry>
14 </row>
15 <row>
16 <entry><constant>MEDIA_ENT_F_IO_V4L</constant></entry>
17 <entry>Data streaming input and/or output entity.</entry>
18 </row>
19 <row>
20 <entry><constant>MEDIA_ENT_F_IO_VBI</constant></entry>
21 <entry>V4L VBI streaming input or output entity</entry>
22 </row>
23 <row>
24 <entry><constant>MEDIA_ENT_F_IO_SWRADIO</constant></entry>
25 <entry>V4L Software Digital Radio (SDR) streaming input or output entity</entry>
26 </row>
27 <row>
28 <entry><constant>MEDIA_ENT_F_IO_DTV</constant></entry>
29 <entry>DVB Digital TV streaming input or output entity</entry>
30 </row>
31 <row>
32 <entry><constant>MEDIA_ENT_F_DTV_DEMOD</constant></entry>
33 <entry>Digital TV demodulator entity.</entry>
34 </row>
35 <row>
36 <entry><constant>MEDIA_ENT_F_TS_DEMUX</constant></entry>
37 <entry>MPEG Transport stream demux entity. Could be implemented on hardware or in Kernelspace by the Linux DVB subsystem.</entry>
38 </row>
39 <row>
40 <entry><constant>MEDIA_ENT_F_DTV_CA</constant></entry>
41 <entry>Digital TV Conditional Access module (CAM) entity</entry>
42 </row>
43 <row>
44 <entry><constant>MEDIA_ENT_F_DTV_NET_DECAP</constant></entry>
45 <entry>Digital TV network ULE/MLE desencapsulation entity. Could be implemented on hardware or in Kernelspace</entry>
46 </row>
47 <row>
48 <entry><constant>MEDIA_ENT_F_CONN_RF</constant></entry>
49 <entry>Connector for a Radio Frequency (RF) signal.</entry>
50 </row>
51 <row>
52 <entry><constant>MEDIA_ENT_F_CONN_SVIDEO</constant></entry>
53 <entry>Connector for a S-Video signal.</entry>
54 </row>
55 <row>
56 <entry><constant>MEDIA_ENT_F_CONN_COMPOSITE</constant></entry>
57 <entry>Connector for a RGB composite signal.</entry>
58 </row>
59 <row>
60 <entry><constant>MEDIA_ENT_F_CONN_TEST</constant></entry>
61 <entry>Connector for a test generator.</entry>
62 </row>
63 <row>
64 <entry><constant>MEDIA_ENT_F_CAM_SENSOR</constant></entry>
65 <entry>Camera video sensor entity.</entry>
66 </row>
67 <row>
68 <entry><constant>MEDIA_ENT_F_FLASH</constant></entry>
69 <entry>Flash controller entity.</entry>
70 </row>
71 <row>
72 <entry><constant>MEDIA_ENT_F_LENS</constant></entry>
73 <entry>Lens controller entity.</entry>
74 </row>
75 <row>
76 <entry><constant>MEDIA_ENT_F_ATV_DECODER</constant></entry>
77 <entry>Analog video decoder, the basic function of the video decoder
78 is to accept analogue video from a wide variety of sources such as
79 broadcast, DVD players, cameras and video cassette recorders, in
80 either NTSC, PAL, SECAM or HD format, separating the stream
81 into its component parts, luminance and chrominance, and output
82 it in some digital video standard, with appropriate timing
83 signals.</entry>
84 </row>
85 <row>
86 <entry><constant>MEDIA_ENT_F_TUNER</constant></entry>
87 <entry>Digital TV, analog TV, radio and/or software radio tuner.</entry>
88 </row>
89 </tbody>
90 </tgroup>
91 </table>
92
93 <table frame="none" pgwide="1" id="media-entity-flag">
94 <title>Media entity flags</title>
95 <tgroup cols="2">
96 <colspec colname="c1"/>
97 <colspec colname="c2"/>
98 <tbody valign="top">
99 <row>
100 <entry><constant>MEDIA_ENT_FL_DEFAULT</constant></entry>
101 <entry>Default entity for its type. Used to discover the default
102 audio, VBI and video devices, the default camera sensor, ...</entry>
103 </row>
104 <row>
105 <entry><constant>MEDIA_ENT_FL_CONNECTOR</constant></entry>
106 <entry>The entity represents a data conector</entry>
107 </row>
108 </tbody>
109 </tgroup>
110 </table>
111
112 <table frame="none" pgwide="1" id="media-intf-type">
113 <title>Media interface types</title>
114 <tgroup cols="3">
115 <colspec colname="c1"/>
116 <colspec colname="c2"/>
117 <colspec colname="c3"/>
118 <tbody valign="top">
119 <row>
120 <entry><constant>MEDIA_INTF_T_DVB_FE</constant></entry>
121 <entry>Device node interface for the Digital TV frontend</entry>
122 <entry>typically, /dev/dvb/adapter?/frontend?</entry>
123 </row>
124 <row>
125 <entry><constant>MEDIA_INTF_T_DVB_DEMUX</constant></entry>
126 <entry>Device node interface for the Digital TV demux</entry>
127 <entry>typically, /dev/dvb/adapter?/demux?</entry>
128 </row>
129 <row>
130 <entry><constant>MEDIA_INTF_T_DVB_DVR</constant></entry>
131 <entry>Device node interface for the Digital TV DVR</entry>
132 <entry>typically, /dev/dvb/adapter?/dvr?</entry>
133 </row>
134 <row>
135 <entry><constant>MEDIA_INTF_T_DVB_CA</constant></entry>
136 <entry>Device node interface for the Digital TV Conditional Access</entry>
137 <entry>typically, /dev/dvb/adapter?/ca?</entry>
138 </row>
139 <row>
140 <entry><constant>MEDIA_INTF_T_DVB_FE</constant></entry>
141 <entry>Device node interface for the Digital TV network control</entry>
142 <entry>typically, /dev/dvb/adapter?/net?</entry>
143 </row>
144 <row>
145 <entry><constant>MEDIA_INTF_T_V4L_VIDEO</constant></entry>
146 <entry>Device node interface for video (V4L)</entry>
147 <entry>typically, /dev/video?</entry>
148 </row>
149 <row>
150 <entry><constant>MEDIA_INTF_T_V4L_VBI</constant></entry>
151 <entry>Device node interface for VBI (V4L)</entry>
152 <entry>typically, /dev/vbi?</entry>
153 </row>
154 <row>
155 <entry><constant>MEDIA_INTF_T_V4L_RADIO</constant></entry>
156 <entry>Device node interface for radio (V4L)</entry>
157 <entry>typically, /dev/vbi?</entry>
158 </row>
159 <row>
160 <entry><constant>MEDIA_INTF_T_V4L_SUBDEV</constant></entry>
161 <entry>Device node interface for a V4L subdevice</entry>
162 <entry>typically, /dev/v4l-subdev?</entry>
163 </row>
164 <row>
165 <entry><constant>MEDIA_INTF_T_V4L_SWRADIO</constant></entry>
166 <entry>Device node interface for Software Defined Radio (V4L)</entry>
167 <entry>typically, /dev/swradio?</entry>
168 </row>
169 </tbody>
170 </tgroup>
171 </table>
172
173 <table frame="none" pgwide="1" id="media-pad-flag">
174 <title>Media pad flags</title>
175 <tgroup cols="2">
176 <colspec colname="c1"/>
177 <colspec colname="c2"/>
178 <tbody valign="top">
179 <row>
180 <entry><constant>MEDIA_PAD_FL_SINK</constant></entry>
181 <entry>Input pad, relative to the entity. Input pads sink data and
182 are targets of links.</entry>
183 </row>
184 <row>
185 <entry><constant>MEDIA_PAD_FL_SOURCE</constant></entry>
186 <entry>Output pad, relative to the entity. Output pads source data
187 and are origins of links.</entry>
188 </row>
189 <row>
190 <entry><constant>MEDIA_PAD_FL_MUST_CONNECT</constant></entry>
191 <entry>If this flag is set and the pad is linked to any other
192 pad, then at least one of those links must be enabled for the
193 entity to be able to stream. There could be temporary reasons
194 (e.g. device configuration dependent) for the pad to need
195 enabled links even when this flag isn't set; the absence of the
196 flag doesn't imply there is none.</entry>
197 </row>
198 </tbody>
199 </tgroup>
200 </table>
201
202 <para>One and only one of <constant>MEDIA_PAD_FL_SINK</constant> and
203 <constant>MEDIA_PAD_FL_SOURCE</constant> must be set for every pad.</para>
204
205 <table frame="none" pgwide="1" id="media-link-flag">
206 <title>Media link flags</title>
207 <tgroup cols="2">
208 <colspec colname="c1"/>
209 <colspec colname="c2"/>
210 <tbody valign="top">
211 <row>
212 <entry><constant>MEDIA_LNK_FL_ENABLED</constant></entry>
213 <entry>The link is enabled and can be used to transfer media data.
214 When two or more links target a sink pad, only one of them can be
215 enabled at a time.</entry>
216 </row>
217 <row>
218 <entry><constant>MEDIA_LNK_FL_IMMUTABLE</constant></entry>
219 <entry>The link enabled state can't be modified at runtime. An
220 immutable link is always enabled.</entry>
221 </row>
222 <row>
223 <entry><constant>MEDIA_LNK_FL_DYNAMIC</constant></entry>
224 <entry>The link enabled state can be modified during streaming. This
225 flag is set by drivers and is read-only for applications.</entry>
226 </row>
227 <row>
228 <entry><constant>MEDIA_LNK_FL_LINK_TYPE</constant></entry>
229 <entry><para>This is a bitmask that defines the type of the link.
230 Currently, two types of links are supported:</para>
231 <para><constant>MEDIA_LNK_FL_DATA_LINK</constant>
232 if the link is between two pads</para>
233 <para><constant>MEDIA_LNK_FL_INTERFACE_LINK</constant>
234 if the link is between an interface and an entity</para></entry>
235 </row>
236 </tbody>
237 </tgroup>
238 </table>
239
240</section>
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml
index 7e61643358de..42e626d6c936 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -152,6 +152,16 @@ structs, ioctls) must be noted in more detail in the history chapter
152(compat.xml), along with the possible impact on existing drivers and 152(compat.xml), along with the possible impact on existing drivers and
153applications. --> 153applications. -->
154 <revision> 154 <revision>
155 <revnumber>4.5</revnumber>
156 <date>2015-10-29</date>
157 <authorinitials>rr</authorinitials>
158 <revremark>Extend vidioc-g-ext-ctrls;. Replace ctrl_class with a new
159union with ctrl_class and which. Which is used to select the current value of
160the control or the default value.
161 </revremark>
162 </revision>
163
164 <revision>
155 <revnumber>4.4</revnumber> 165 <revnumber>4.4</revnumber>
156 <date>2015-05-26</date> 166 <date>2015-05-26</date>
157 <authorinitials>ap</authorinitials> 167 <authorinitials>ap</authorinitials>
diff --git a/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml b/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml
index 8ffe74f84af1..d81fa0d4016b 100644
--- a/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml
@@ -58,7 +58,7 @@
58 <para>This ioctl is used to create buffers for <link linkend="mmap">memory 58 <para>This ioctl is used to create buffers for <link linkend="mmap">memory
59mapped</link> or <link linkend="userp">user pointer</link> or <link 59mapped</link> or <link linkend="userp">user pointer</link> or <link
60linkend="dmabuf">DMA buffer</link> I/O. It can be used as an alternative or in 60linkend="dmabuf">DMA buffer</link> I/O. It can be used as an alternative or in
61addition to the <constant>VIDIOC_REQBUFS</constant> ioctl, when a tighter 61addition to the &VIDIOC-REQBUFS; ioctl, when a tighter
62control over buffers is required. This ioctl can be called multiple times to 62control over buffers is required. This ioctl can be called multiple times to
63create buffers of different sizes.</para> 63create buffers of different sizes.</para>
64 64
@@ -71,30 +71,28 @@ zeroed.</para>
71 71
72 <para>The <structfield>format</structfield> field specifies the image format 72 <para>The <structfield>format</structfield> field specifies the image format
73that the buffers must be able to handle. The application has to fill in this 73that the buffers must be able to handle. The application has to fill in this
74&v4l2-format;. Usually this will be done using the 74&v4l2-format;. Usually this will be done using the &VIDIOC-TRY-FMT; or &VIDIOC-G-FMT; ioctls
75<constant>VIDIOC_TRY_FMT</constant> or <constant>VIDIOC_G_FMT</constant> ioctl() 75to ensure that the requested format is supported by the driver.
76to ensure that the requested format is supported by the driver. Unsupported 76Based on the format's <structfield>type</structfield> field the requested buffer
77formats will result in an error.</para> 77size (for single-planar) or plane sizes (for multi-planar formats) will be
78used for the allocated buffers. The driver may return an error if the size(s)
79are not supported by the hardware (usually because they are too small).</para>
78 80
79 <para>The buffers created by this ioctl will have as minimum size the size 81 <para>The buffers created by this ioctl will have as minimum size the size
80defined by the <structfield>format.pix.sizeimage</structfield> field. If the 82defined by the <structfield>format.pix.sizeimage</structfield> field (or the
83corresponding fields for other format types). Usually if the
81<structfield>format.pix.sizeimage</structfield> field is less than the minimum 84<structfield>format.pix.sizeimage</structfield> field is less than the minimum
82required for the given format, then <structfield>sizeimage</structfield> will be 85required for the given format, then an error will be returned since drivers will
83increased by the driver to that minimum to allocate the buffers. If it is 86typically not allow this. If it is larger, then the value will be used as-is.
84larger, then the value will be used as-is. The same applies to the 87In other words, the driver may reject the requested size, but if it is accepted
85<structfield>sizeimage</structfield> field of the 88the driver will use it unchanged.</para>
86<structname>v4l2_plane_pix_format</structname> structure in the case of
87multiplanar formats.</para>
88 89
89 <para>When the ioctl is called with a pointer to this structure the driver 90 <para>When the ioctl is called with a pointer to this structure the driver
90will attempt to allocate up to the requested number of buffers and store the 91will attempt to allocate up to the requested number of buffers and store the
91actual number allocated and the starting index in the 92actual number allocated and the starting index in the
92<structfield>count</structfield> and the <structfield>index</structfield> fields 93<structfield>count</structfield> and the <structfield>index</structfield> fields
93respectively. On return <structfield>count</structfield> can be smaller than 94respectively. On return <structfield>count</structfield> can be smaller than
94the number requested. The driver may also increase buffer sizes if required, 95the number requested.</para>
95however, it will not update <structfield>sizeimage</structfield> field values.
96The user has to use <constant>VIDIOC_QUERYBUF</constant> to retrieve that
97information.</para>
98 96
99 <table pgwide="1" frame="none" id="v4l2-create-buffers"> 97 <table pgwide="1" frame="none" id="v4l2-create-buffers">
100 <title>struct <structname>v4l2_create_buffers</structname></title> 98 <title>struct <structname>v4l2_create_buffers</structname></title>
diff --git a/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-info.xml b/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-info.xml
index 4c4603c135fe..f14a3bb1afaa 100644
--- a/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-info.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-info.xml
@@ -99,7 +99,7 @@ if the driver supports writing registers to the device.</para>
99 <para>We recommended the <application>v4l2-dbg</application> 99 <para>We recommended the <application>v4l2-dbg</application>
100utility over calling this ioctl directly. It is available from the 100utility over calling this ioctl directly. It is available from the
101LinuxTV v4l-dvb repository; see <ulink 101LinuxTV v4l-dvb repository; see <ulink
102url="http://linuxtv.org/repo/">http://linuxtv.org/repo/</ulink> for 102url="https://linuxtv.org/repo/">https://linuxtv.org/repo/</ulink> for
103access instructions.</para> 103access instructions.</para>
104 104
105 <!-- Note for convenience vidioc-dbg-g-register.sgml 105 <!-- Note for convenience vidioc-dbg-g-register.sgml
diff --git a/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml b/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml
index 3d038e75d12b..5877f68a5820 100644
--- a/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml
@@ -117,7 +117,7 @@ However when a driver supports these ioctls it must also support
117 <para>We recommended the <application>v4l2-dbg</application> 117 <para>We recommended the <application>v4l2-dbg</application>
118utility over calling these ioctls directly. It is available from the 118utility over calling these ioctls directly. It is available from the
119LinuxTV v4l-dvb repository; see <ulink 119LinuxTV v4l-dvb repository; see <ulink
120url="http://linuxtv.org/repo/">http://linuxtv.org/repo/</ulink> for 120url="https://linuxtv.org/repo/">https://linuxtv.org/repo/</ulink> for
121access instructions.</para> 121access instructions.</para>
122 122
123 <!-- Note for convenience vidioc-dbg-g-chip-info.sgml 123 <!-- Note for convenience vidioc-dbg-g-chip-info.sgml
diff --git a/Documentation/DocBook/media/v4l/vidioc-enumstd.xml b/Documentation/DocBook/media/v4l/vidioc-enumstd.xml
index 8065099401d1..f18454e91752 100644
--- a/Documentation/DocBook/media/v4l/vidioc-enumstd.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-enumstd.xml
@@ -198,7 +198,7 @@ video4linux-list@redhat.com on 17 Oct 2002
198<constant>V4L2_STD_ATSC_16_VSB</constant> are U.S. terrestrial digital 198<constant>V4L2_STD_ATSC_16_VSB</constant> are U.S. terrestrial digital
199TV standards. Presently the V4L2 API does not support digital TV. See 199TV standards. Presently the V4L2 API does not support digital TV. See
200also the Linux DVB API at <ulink 200also the Linux DVB API at <ulink
201url="http://linuxtv.org">http://linuxtv.org</ulink>.</para> 201url="https://linuxtv.org">https://linuxtv.org</ulink>.</para>
202<para><programlisting> 202<para><programlisting>
203#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ 203#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
204 V4L2_STD_PAL_B1 |\ 204 V4L2_STD_PAL_B1 |\
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
index 842536aae8b4..eb82f7e7d06b 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
@@ -61,7 +61,7 @@ must belong to the same control class.</para>
61 61
62 <para>Applications must always fill in the 62 <para>Applications must always fill in the
63<structfield>count</structfield>, 63<structfield>count</structfield>,
64<structfield>ctrl_class</structfield>, 64<structfield>which</structfield>,
65<structfield>controls</structfield> and 65<structfield>controls</structfield> and
66<structfield>reserved</structfield> fields of &v4l2-ext-controls;, and 66<structfield>reserved</structfield> fields of &v4l2-ext-controls;, and
67initialize the &v4l2-ext-control; array pointed to by the 67initialize the &v4l2-ext-control; array pointed to by the
@@ -109,7 +109,7 @@ the driver whether wrong values are automatically adjusted to a valid
109value or if an error is returned.</para> 109value or if an error is returned.</para>
110 110
111 <para>When the <structfield>id</structfield> or 111 <para>When the <structfield>id</structfield> or
112<structfield>ctrl_class</structfield> is invalid drivers return an 112<structfield>which</structfield> is invalid drivers return an
113&EINVAL;. When the value is out of bounds drivers can choose to take 113&EINVAL;. When the value is out of bounds drivers can choose to take
114the closest valid value or return an &ERANGE;, whatever seems more 114the closest valid value or return an &ERANGE;, whatever seems more
115appropriate. In the first case the new value is set in 115appropriate. In the first case the new value is set in
@@ -223,7 +223,12 @@ Valid if <constant>V4L2_CTRL_FLAG_HAS_PAYLOAD</constant> is set for this control
223 <tgroup cols="3"> 223 <tgroup cols="3">
224 &cs-str; 224 &cs-str;
225 <tbody valign="top"> 225 <tbody valign="top">
226 <row>
227 <entry>union</entry>
228 <entry>(anonymous)</entry>
229 </row>
226 <row> 230 <row>
231 <entry></entry>
227 <entry>__u32</entry> 232 <entry>__u32</entry>
228 <entry><structfield>ctrl_class</structfield></entry> 233 <entry><structfield>ctrl_class</structfield></entry>
229 <entry>The control class to which all controls belong, see 234 <entry>The control class to which all controls belong, see
@@ -235,6 +240,23 @@ with a <structfield>count</structfield> of 0. If that succeeds, then the driver
235supports this feature.</entry> 240supports this feature.</entry>
236 </row> 241 </row>
237 <row> 242 <row>
243 <entry></entry>
244 <entry>__u32</entry>
245 <entry><structfield>which</structfield></entry>
246 <entry><para>Which value of the control to get/set/try. <constant>V4L2_CTRL_WHICH_CUR_VAL</constant>
247will return the current value of the control and <constant>V4L2_CTRL_WHICH_DEF_VAL</constant> will
248return the default value of the control. Please note that you can only get the default value of the
249control, you cannot set or try it.</para>
250<para>For backwards compatibility you can also use a control class here (see
251<xref linkend="ctrl-class" />). In that case all controls have to belong to that
252control class. This usage is deprecated, instead just use <constant>V4L2_CTRL_WHICH_CUR_VAL</constant>.
253There are some very old drivers that do not yet support <constant>V4L2_CTRL_WHICH_CUR_VAL</constant>
254and that require a control class here. You can test for such drivers by setting ctrl_class to
255<constant>V4L2_CTRL_WHICH_CUR_VAL</constant> and calling VIDIOC_TRY_EXT_CTRLS with a count of 0.
256If that fails, then the driver does not support <constant>V4L2_CTRL_WHICH_CUR_VAL</constant>.</para>
257</entry>
258 </row>
259 <row>
238 <entry>__u32</entry> 260 <entry>__u32</entry>
239 <entry><structfield>count</structfield></entry> 261 <entry><structfield>count</structfield></entry>
240 <entry>The number of controls in the controls array. May 262 <entry>The number of controls in the controls array. May
@@ -390,7 +412,7 @@ These controls are described in <xref linkend="rf-tuner-controls" />.</entry>
390 <listitem> 412 <listitem>
391 <para>The &v4l2-ext-control; <structfield>id</structfield> 413 <para>The &v4l2-ext-control; <structfield>id</structfield>
392is invalid, the &v4l2-ext-controls; 414is invalid, the &v4l2-ext-controls;
393<structfield>ctrl_class</structfield> is invalid, or the &v4l2-ext-control; 415<structfield>which</structfield> is invalid, or the &v4l2-ext-control;
394<structfield>value</structfield> was inappropriate (e.g. the given menu 416<structfield>value</structfield> was inappropriate (e.g. the given menu
395index is not supported by the driver). This error code is 417index is not supported by the driver). This error code is
396also returned by the <constant>VIDIOC_S_EXT_CTRLS</constant> and 418also returned by the <constant>VIDIOC_S_EXT_CTRLS</constant> and
diff --git a/Documentation/DocBook/media_api.tmpl b/Documentation/DocBook/media_api.tmpl
index 92037033f5eb..7b77e0f7b87d 100644
--- a/Documentation/DocBook/media_api.tmpl
+++ b/Documentation/DocBook/media_api.tmpl
@@ -19,10 +19,10 @@
19<!ENTITY cs-def "<colspec colname='c1' colwidth='3*' /><colspec colname='c2' colwidth='1*' /><colspec colname='c3' colwidth='4*' /><spanspec spanname='hspan' namest='c1' nameend='c3' />"> 19<!ENTITY cs-def "<colspec colname='c1' colwidth='3*' /><colspec colname='c2' colwidth='1*' /><colspec colname='c3' colwidth='4*' /><spanspec spanname='hspan' namest='c1' nameend='c3' />">
20 20
21<!-- Video for Linux mailing list address. --> 21<!-- Video for Linux mailing list address. -->
22<!ENTITY v4l-ml "<ulink url='http://www.linuxtv.org/lists.php'>http://www.linuxtv.org/lists.php</ulink>"> 22<!ENTITY v4l-ml "<ulink url='https://linuxtv.org/lists.php'>https://linuxtv.org/lists.php</ulink>">
23 23
24<!-- LinuxTV v4l-dvb repository. --> 24<!-- LinuxTV v4l-dvb repository. -->
25<!ENTITY v4l-dvb "<ulink url='http://linuxtv.org/repo/'>http://linuxtv.org/repo/</ulink>"> 25<!ENTITY v4l-dvb "<ulink url='https://linuxtv.org/repo/'>https://linuxtv.org/repo/</ulink>">
26<!ENTITY dash-ent-8 "<entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry>"> 26<!ENTITY dash-ent-8 "<entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry>">
27<!ENTITY dash-ent-10 "<entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry>"> 27<!ENTITY dash-ent-10 "<entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry>">
28<!ENTITY dash-ent-12 "<entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry>"> 28<!ENTITY dash-ent-12 "<entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry><entry>-</entry>">
@@ -91,7 +91,7 @@
91 components, like mixers, PCM capture, PCM playback, etc, which 91 components, like mixers, PCM capture, PCM playback, etc, which
92 are controlled via ALSA API.</para> 92 are controlled via ALSA API.</para>
93 <para>For additional information and for the latest development code, 93 <para>For additional information and for the latest development code,
94 see: <ulink url="http://linuxtv.org">http://linuxtv.org</ulink>.</para> 94 see: <ulink url="https://linuxtv.org">https://linuxtv.org</ulink>.</para>
95 <para>For discussing improvements, reporting troubles, sending new drivers, etc, please mail to: <ulink url="http://vger.kernel.org/vger-lists.html#linux-media">Linux Media Mailing List (LMML).</ulink>.</para> 95 <para>For discussing improvements, reporting troubles, sending new drivers, etc, please mail to: <ulink url="http://vger.kernel.org/vger-lists.html#linux-media">Linux Media Mailing List (LMML).</ulink>.</para>
96</preface> 96</preface>
97 97
diff --git a/Documentation/DocBook/mtdnand.tmpl b/Documentation/DocBook/mtdnand.tmpl
index 7da8f0402af5..b442921bca54 100644
--- a/Documentation/DocBook/mtdnand.tmpl
+++ b/Documentation/DocBook/mtdnand.tmpl
@@ -162,12 +162,15 @@
162 <sect1 id="Basic_defines"> 162 <sect1 id="Basic_defines">
163 <title>Basic defines</title> 163 <title>Basic defines</title>
164 <para> 164 <para>
165 At least you have to provide a mtd structure and 165 At least you have to provide a nand_chip structure
166 a storage for the ioremap'ed chip address. 166 and a storage for the ioremap'ed chip address.
167 You can allocate the mtd structure using kmalloc 167 You can allocate the nand_chip structure using
168 or you can allocate it statically. 168 kmalloc or you can allocate it statically.
169 In case of static allocation you have to allocate 169 The NAND chip structure embeds an mtd structure
170 a nand_chip structure too. 170 which will be registered to the MTD subsystem.
171 You can extract a pointer to the mtd structure
172 from a nand_chip pointer using the nand_to_mtd()
173 helper.
171 </para> 174 </para>
172 <para> 175 <para>
173 Kmalloc based example 176 Kmalloc based example
@@ -180,7 +183,6 @@ static void __iomem *baseaddr;
180 Static example 183 Static example
181 </para> 184 </para>
182 <programlisting> 185 <programlisting>
183static struct mtd_info board_mtd;
184static struct nand_chip board_chip; 186static struct nand_chip board_chip;
185static void __iomem *baseaddr; 187static void __iomem *baseaddr;
186 </programlisting> 188 </programlisting>
@@ -235,7 +237,7 @@ static void board_hwcontrol(struct mtd_info *mtd, int cmd)
235 <programlisting> 237 <programlisting>
236static void board_hwcontrol(struct mtd_info *mtd, int cmd) 238static void board_hwcontrol(struct mtd_info *mtd, int cmd)
237{ 239{
238 struct nand_chip *this = (struct nand_chip *) mtd->priv; 240 struct nand_chip *this = mtd_to_nand(mtd);
239 switch(cmd){ 241 switch(cmd){
240 case NAND_CTL_SETCLE: this->IO_ADDR_W |= CLE_ADRR_BIT; break; 242 case NAND_CTL_SETCLE: this->IO_ADDR_W |= CLE_ADRR_BIT; break;
241 case NAND_CTL_CLRCLE: this->IO_ADDR_W &amp;= ~CLE_ADRR_BIT; break; 243 case NAND_CTL_CLRCLE: this->IO_ADDR_W &amp;= ~CLE_ADRR_BIT; break;
@@ -274,13 +276,15 @@ static int __init board_init (void)
274 int err = 0; 276 int err = 0;
275 277
276 /* Allocate memory for MTD device structure and private data */ 278 /* Allocate memory for MTD device structure and private data */
277 board_mtd = kzalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL); 279 this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
278 if (!board_mtd) { 280 if (!this) {
279 printk ("Unable to allocate NAND MTD device structure.\n"); 281 printk ("Unable to allocate NAND MTD device structure.\n");
280 err = -ENOMEM; 282 err = -ENOMEM;
281 goto out; 283 goto out;
282 } 284 }
283 285
286 board_mtd = nand_to_mtd(this);
287
284 /* map physical address */ 288 /* map physical address */
285 baseaddr = ioremap(CHIP_PHYSICAL_ADDRESS, 1024); 289 baseaddr = ioremap(CHIP_PHYSICAL_ADDRESS, 1024);
286 if (!baseaddr) { 290 if (!baseaddr) {
@@ -289,11 +293,6 @@ static int __init board_init (void)
289 goto out_mtd; 293 goto out_mtd;
290 } 294 }
291 295
292 /* Get pointer to private data */
293 this = (struct nand_chip *) ();
294 /* Link the private data with the MTD structure */
295 board_mtd->priv = this;
296
297 /* Set address of NAND IO lines */ 296 /* Set address of NAND IO lines */
298 this->IO_ADDR_R = baseaddr; 297 this->IO_ADDR_R = baseaddr;
299 this->IO_ADDR_W = baseaddr; 298 this->IO_ADDR_W = baseaddr;
@@ -317,7 +316,7 @@ static int __init board_init (void)
317out_ior: 316out_ior:
318 iounmap(baseaddr); 317 iounmap(baseaddr);
319out_mtd: 318out_mtd:
320 kfree (board_mtd); 319 kfree (this);
321out: 320out:
322 return err; 321 return err;
323} 322}
@@ -343,7 +342,7 @@ static void __exit board_cleanup (void)
343 iounmap(baseaddr); 342 iounmap(baseaddr);
344 343
345 /* Free the MTD device structure */ 344 /* Free the MTD device structure */
346 kfree (board_mtd); 345 kfree (mtd_to_nand(board_mtd));
347} 346}
348module_exit(board_cleanup); 347module_exit(board_cleanup);
349#endif 348#endif
@@ -399,7 +398,7 @@ static void board_select_chip (struct mtd_info *mtd, int chip)
399 <programlisting> 398 <programlisting>
400static void board_select_chip (struct mtd_info *mtd, int chip) 399static void board_select_chip (struct mtd_info *mtd, int chip)
401{ 400{
402 struct nand_chip *this = (struct nand_chip *) mtd->priv; 401 struct nand_chip *this = mtd_to_nand(mtd);
403 402
404 /* Deselect all chips */ 403 /* Deselect all chips */
405 this->IO_ADDR_R &amp;= ~BOARD_NAND_ADDR_MASK; 404 this->IO_ADDR_R &amp;= ~BOARD_NAND_ADDR_MASK;
diff --git a/Documentation/HOWTO b/Documentation/HOWTO
index 21152d397b88..d5a699d5a551 100644
--- a/Documentation/HOWTO
+++ b/Documentation/HOWTO
@@ -209,7 +209,7 @@ tools. One such tool that is particularly recommended is the Linux
209Cross-Reference project, which is able to present source code in a 209Cross-Reference project, which is able to present source code in a
210self-referential, indexed webpage format. An excellent up-to-date 210self-referential, indexed webpage format. An excellent up-to-date
211repository of the kernel code may be found at: 211repository of the kernel code may be found at:
212 http://lxr.linux.no/+trees 212 http://lxr.free-electrons.com/
213 213
214 214
215The development process 215The development process
diff --git a/Documentation/Makefile b/Documentation/Makefile
index bc0548201755..1207d7907650 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,4 +1,4 @@
1subdir-y := accounting auxdisplay blackfin connector \ 1subdir-y := accounting auxdisplay blackfin connector \
2 filesystems filesystems ia64 laptops mic misc-devices \ 2 filesystems filesystems ia64 laptops mic misc-devices \
3 networking pcmcia prctl ptp spi timers vDSO video4linux \ 3 networking pcmcia prctl ptp timers vDSO video4linux \
4 watchdog 4 watchdog
diff --git a/Documentation/RCU/Design/Requirements/2013-08-is-it-dead.png b/Documentation/RCU/Design/Requirements/2013-08-is-it-dead.png
new file mode 100644
index 000000000000..7496a55e4e7b
--- /dev/null
+++ b/Documentation/RCU/Design/Requirements/2013-08-is-it-dead.png
Binary files differ
diff --git a/Documentation/RCU/Design/Requirements/GPpartitionReaders1.svg b/Documentation/RCU/Design/Requirements/GPpartitionReaders1.svg
new file mode 100644
index 000000000000..4b4014fda770
--- /dev/null
+++ b/Documentation/RCU/Design/Requirements/GPpartitionReaders1.svg
@@ -0,0 +1,374 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
4<svg
5 xmlns:dc="http://purl.org/dc/elements/1.1/"
6 xmlns:cc="http://creativecommons.org/ns#"
7 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8 xmlns:svg="http://www.w3.org/2000/svg"
9 xmlns="http://www.w3.org/2000/svg"
10 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12 width="447.99197"
13 height="428.19299"
14 id="svg2"
15 version="1.1"
16 inkscape:version="0.48.3.1 r9886"
17 sodipodi:docname="GPpartitionReaders1.svg">
18 <defs
19 id="defs4">
20 <marker
21 inkscape:stockid="Arrow2Lend"
22 orient="auto"
23 refY="0"
24 refX="0"
25 id="Arrow2Lend"
26 style="overflow:visible">
27 <path
28 id="path3792"
29 style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
30 d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
31 transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
32 inkscape:connector-curvature="0" />
33 </marker>
34 <marker
35 inkscape:stockid="Arrow2Lstart"
36 orient="auto"
37 refY="0"
38 refX="0"
39 id="Arrow2Lstart"
40 style="overflow:visible">
41 <path
42 id="path3789"
43 style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
44 d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
45 transform="matrix(1.1,0,0,1.1,1.1,0)"
46 inkscape:connector-curvature="0" />
47 </marker>
48 </defs>
49 <sodipodi:namedview
50 id="base"
51 pagecolor="#ffffff"
52 bordercolor="#666666"
53 borderopacity="1.0"
54 inkscape:pageopacity="0.0"
55 inkscape:pageshadow="2"
56 inkscape:zoom="1.6184291"
57 inkscape:cx="223.99599"
58 inkscape:cy="214.0965"
59 inkscape:document-units="px"
60 inkscape:current-layer="layer1"
61 showgrid="false"
62 inkscape:window-width="979"
63 inkscape:window-height="836"
64 inkscape:window-x="571"
65 inkscape:window-y="335"
66 inkscape:window-maximized="0"
67 fit-margin-top="5"
68 fit-margin-left="5"
69 fit-margin-right="5"
70 fit-margin-bottom="5" />
71 <metadata
72 id="metadata7">
73 <rdf:RDF>
74 <cc:Work
75 rdf:about="">
76 <dc:format>image/svg+xml</dc:format>
77 <dc:type
78 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
79 <dc:title></dc:title>
80 </cc:Work>
81 </rdf:RDF>
82 </metadata>
83 <g
84 inkscape:label="Layer 1"
85 inkscape:groupmode="layer"
86 id="layer1"
87 transform="translate(-28.441125,-185.60612)">
88 <flowRoot
89 xml:space="preserve"
90 id="flowRoot2985"
91 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"><flowRegion
92 id="flowRegion2987"><rect
93 id="rect2989"
94 width="82.85714"
95 height="11.428572"
96 x="240"
97 y="492.36218" /></flowRegion><flowPara
98 id="flowPara2991"></flowPara></flowRoot> <g
99 id="g4433"
100 transform="translate(2,0)">
101 <text
102 sodipodi:linespacing="125%"
103 id="text2993"
104 y="-261.66608"
105 x="412.12299"
106 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
107 xml:space="preserve"
108 transform="matrix(0,1,-1,0,0,0)"><tspan
109 y="-261.66608"
110 x="412.12299"
111 id="tspan2995"
112 sodipodi:role="line">synchronize_rcu()</tspan></text>
113 <g
114 id="g4417"
115 transform="matrix(0,1,-1,0,730.90257,222.4928)">
116 <path
117 style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:url(#Arrow2Lend)"
118 d="m 97.580736,477.4048 183.140664,0"
119 id="path2997"
120 inkscape:connector-curvature="0"
121 sodipodi:nodetypes="cc" />
122 <path
123 style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
124 d="m 96.752718,465.38398 0,22.62742"
125 id="path4397"
126 inkscape:connector-curvature="0"
127 sodipodi:nodetypes="cc" />
128 <path
129 style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
130 d="m 281.54942,465.38397 0,22.62742"
131 id="path4397-5"
132 inkscape:connector-curvature="0"
133 sodipodi:nodetypes="cc" />
134 </g>
135 </g>
136 <text
137 xml:space="preserve"
138 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
139 x="112.04738"
140 y="268.18076"
141 id="text4429"
142 sodipodi:linespacing="125%"><tspan
143 sodipodi:role="line"
144 id="tspan4431"
145 x="112.04738"
146 y="268.18076">WRITE_ONCE(a, 1);</tspan></text>
147 <text
148 xml:space="preserve"
149 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
150 x="112.04738"
151 y="439.13766"
152 id="text4441"
153 sodipodi:linespacing="125%"><tspan
154 sodipodi:role="line"
155 id="tspan4443"
156 x="112.04738"
157 y="439.13766">WRITE_ONCE(b, 1);</tspan></text>
158 <text
159 xml:space="preserve"
160 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
161 x="255.60869"
162 y="309.29346"
163 id="text4445"
164 sodipodi:linespacing="125%"><tspan
165 sodipodi:role="line"
166 id="tspan4447"
167 x="255.60869"
168 y="309.29346">r1 = READ_ONCE(a);</tspan></text>
169 <text
170 xml:space="preserve"
171 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
172 x="255.14423"
173 y="520.61786"
174 id="text4449"
175 sodipodi:linespacing="125%"><tspan
176 sodipodi:role="line"
177 id="tspan4451"
178 x="255.14423"
179 y="520.61786">WRITE_ONCE(c, 1);</tspan></text>
180 <text
181 xml:space="preserve"
182 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
183 x="396.10254"
184 y="384.71124"
185 id="text4453"
186 sodipodi:linespacing="125%"><tspan
187 sodipodi:role="line"
188 id="tspan4455"
189 x="396.10254"
190 y="384.71124">r2 = READ_ONCE(b);</tspan></text>
191 <text
192 xml:space="preserve"
193 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
194 x="396.10254"
195 y="582.13617"
196 id="text4457"
197 sodipodi:linespacing="125%"><tspan
198 sodipodi:role="line"
199 id="tspan4459"
200 x="396.10254"
201 y="582.13617">r3 = READ_ONCE(c);</tspan></text>
202 <text
203 xml:space="preserve"
204 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
205 x="112.08231"
206 y="213.91006"
207 id="text4461"
208 sodipodi:linespacing="125%"><tspan
209 sodipodi:role="line"
210 id="tspan4463"
211 x="112.08231"
212 y="213.91006">thread0()</tspan></text>
213 <text
214 xml:space="preserve"
215 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
216 x="252.34512"
217 y="213.91006"
218 id="text4461-6"
219 sodipodi:linespacing="125%"><tspan
220 sodipodi:role="line"
221 id="tspan4463-0"
222 x="252.34512"
223 y="213.91006">thread1()</tspan></text>
224 <text
225 xml:space="preserve"
226 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
227 x="396.42557"
228 y="213.91006"
229 id="text4461-2"
230 sodipodi:linespacing="125%"><tspan
231 sodipodi:role="line"
232 id="tspan4463-2"
233 x="396.42557"
234 y="213.91006">thread2()</tspan></text>
235 <rect
236 style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
237 id="rect4495"
238 width="436.28488"
239 height="416.4859"
240 x="34.648232"
241 y="191.10612" />
242 <path
243 style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
244 d="m 183.14066,191.10612 0,417.193 -0.70711,0"
245 id="path4497"
246 inkscape:connector-curvature="0" />
247 <path
248 style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
249 d="m 325.13867,191.10612 0,417.193 -0.70711,0"
250 id="path4497-5"
251 inkscape:connector-curvature="0" />
252 <text
253 xml:space="preserve"
254 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
255 x="111.75929"
256 y="251.53981"
257 id="text4429-8"
258 sodipodi:linespacing="125%"><tspan
259 sodipodi:role="line"
260 id="tspan4431-9"
261 x="111.75929"
262 y="251.53981">rcu_read_lock();</tspan></text>
263 <text
264 xml:space="preserve"
265 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
266 x="396.10254"
267 y="367.91556"
268 id="text4429-8-9"
269 sodipodi:linespacing="125%"><tspan
270 sodipodi:role="line"
271 id="tspan4431-9-4"
272 x="396.10254"
273 y="367.91556">rcu_read_lock();</tspan></text>
274 <text
275 xml:space="preserve"
276 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
277 x="396.10254"
278 y="597.40289"
279 id="text4429-8-9-3"
280 sodipodi:linespacing="125%"><tspan
281 sodipodi:role="line"
282 id="tspan4431-9-4-4"
283 x="396.10254"
284 y="597.40289">rcu_read_unlock();</tspan></text>
285 <text
286 xml:space="preserve"
287 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
288 x="111.75929"
289 y="453.15311"
290 id="text4429-8-9-3-1"
291 sodipodi:linespacing="125%"><tspan
292 sodipodi:role="line"
293 id="tspan4431-9-4-4-6"
294 x="111.75929"
295 y="453.15311">rcu_read_unlock();</tspan></text>
296 <path
297 style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
298 d="m 33.941125,227.87568 436.284885,0 0,0.7071"
299 id="path4608"
300 inkscape:connector-curvature="0" />
301 <text
302 xml:space="preserve"
303 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
304 x="394.94427"
305 y="345.66351"
306 id="text4648"
307 sodipodi:linespacing="125%"><tspan
308 sodipodi:role="line"
309 id="tspan4650"
310 x="394.94427"
311 y="345.66351">QS</tspan></text>
312 <path
313 sodipodi:type="arc"
314 style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
315 id="path4652"
316 sodipodi:cx="358.85669"
317 sodipodi:cy="142.87541"
318 sodipodi:rx="10.960155"
319 sodipodi:ry="10.253048"
320 d="m 358.86939,132.62237 a 10.960155,10.253048 0 1 1 -0.0228,0"
321 transform="translate(36.441125,199.60612)"
322 sodipodi:start="4.7135481"
323 sodipodi:end="10.994651"
324 sodipodi:open="true" />
325 <text
326 xml:space="preserve"
327 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
328 x="112.11968"
329 y="475.77856"
330 id="text4648-4"
331 sodipodi:linespacing="125%"><tspan
332 sodipodi:role="line"
333 id="tspan4650-4"
334 x="112.11968"
335 y="475.77856">QS</tspan></text>
336 <path
337 sodipodi:type="arc"
338 style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
339 id="path4652-7"
340 sodipodi:cx="358.85669"
341 sodipodi:cy="142.87541"
342 sodipodi:rx="10.960155"
343 sodipodi:ry="10.253048"
344 d="m 358.86939,132.62237 a 10.960155,10.253048 0 1 1 -0.0228,0"
345 transform="translate(-246.38346,329.72117)"
346 sodipodi:start="4.7135481"
347 sodipodi:end="10.994651"
348 sodipodi:open="true" />
349 <path
350 sodipodi:type="arc"
351 style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
352 id="path4652-7-7"
353 sodipodi:cx="358.85669"
354 sodipodi:cy="142.87541"
355 sodipodi:rx="10.960155"
356 sodipodi:ry="10.253048"
357 d="m 358.86939,132.62237 a 10.960155,10.253048 0 1 1 -0.0228,0"
358 transform="translate(-103.65246,202.90878)"
359 sodipodi:start="4.7135481"
360 sodipodi:end="10.994651"
361 sodipodi:open="true" />
362 <text
363 xml:space="preserve"
364 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
365 x="254.85066"
366 y="348.96619"
367 id="text4648-4-3"
368 sodipodi:linespacing="125%"><tspan
369 sodipodi:role="line"
370 id="tspan4650-4-5"
371 x="254.85066"
372 y="348.96619">QS</tspan></text>
373 </g>
374</svg>
diff --git a/Documentation/RCU/Design/Requirements/RCUApplicability.svg b/Documentation/RCU/Design/Requirements/RCUApplicability.svg
new file mode 100644
index 000000000000..ebcbeee391ed
--- /dev/null
+++ b/Documentation/RCU/Design/Requirements/RCUApplicability.svg
@@ -0,0 +1,237 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Creator: fig2dev Version 3.2 Patchlevel 5d -->
3
4<!-- CreationDate: Tue Mar 4 18:34:25 2014 -->
5
6<!-- Magnification: 3.000 -->
7
8<svg
9 xmlns:dc="http://purl.org/dc/elements/1.1/"
10 xmlns:cc="http://creativecommons.org/ns#"
11 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
12 xmlns:svg="http://www.w3.org/2000/svg"
13 xmlns="http://www.w3.org/2000/svg"
14 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
15 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
16 width="1089.1382"
17 height="668.21368"
18 viewBox="-2121 -36 14554.634 8876.4061"
19 id="svg2"
20 version="1.1"
21 inkscape:version="0.48.3.1 r9886"
22 sodipodi:docname="RCUApplicability.svg">
23 <metadata
24 id="metadata40">
25 <rdf:RDF>
26 <cc:Work
27 rdf:about="">
28 <dc:format>image/svg+xml</dc:format>
29 <dc:type
30 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
31 <dc:title />
32 </cc:Work>
33 </rdf:RDF>
34 </metadata>
35 <defs
36 id="defs38" />
37 <sodipodi:namedview
38 pagecolor="#ffffff"
39 bordercolor="#666666"
40 borderopacity="1"
41 objecttolerance="10"
42 gridtolerance="10"
43 guidetolerance="10"
44 inkscape:pageopacity="0"
45 inkscape:pageshadow="2"
46 inkscape:window-width="849"
47 inkscape:window-height="639"
48 id="namedview36"
49 showgrid="false"
50 inkscape:zoom="0.51326165"
51 inkscape:cx="544.56912"
52 inkscape:cy="334.10686"
53 inkscape:window-x="149"
54 inkscape:window-y="448"
55 inkscape:window-maximized="0"
56 inkscape:current-layer="g4"
57 fit-margin-top="5"
58 fit-margin-left="5"
59 fit-margin-right="5"
60 fit-margin-bottom="5" />
61 <g
62 style="fill:none;stroke-width:0.025in"
63 id="g4"
64 transform="translate(-2043.6828,14.791398)">
65 <!-- Line: box -->
66 <rect
67 x="0"
68 y="0"
69 width="14400"
70 height="8775"
71 rx="0"
72 style="fill:#ffa1a1;stroke:#000000;stroke-width:21;stroke-linecap:butt;stroke-linejoin:miter"
73 id="rect6" />
74 <!-- Line: box -->
75 <rect
76 x="1350"
77 y="0"
78 width="11700"
79 height="6075"
80 rx="0"
81 style="fill:#ffff00;stroke:#000000;stroke-width:21;stroke-linecap:butt;stroke-linejoin:miter"
82 id="rect8" />
83 <!-- Line: box -->
84 <rect
85 x="2700"
86 y="0"
87 width="9000"
88 height="4275"
89 rx="0"
90 style="fill:#00ff00;stroke:#000000;stroke-width:21;stroke-linecap:butt;stroke-linejoin:miter"
91 id="rect10" />
92 <!-- Line: box -->
93 <rect
94 x="4050"
95 y="0"
96 width="6300"
97 height="2475"
98 rx="0"
99 style="fill:#87cfff;stroke:#000000;stroke-width:21;stroke-linecap:butt;stroke-linejoin:miter"
100 id="rect12" />
101 <!-- Text -->
102 <text
103 xml:space="preserve"
104 x="7200"
105 y="900"
106 font-style="normal"
107 font-weight="normal"
108 font-size="324"
109 id="text14"
110 sodipodi:linespacing="125%"
111 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"><tspan
112 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"
113 id="tspan3017">Read-Mostly, Stale &amp;</tspan></text>
114 <!-- Text -->
115 <text
116 xml:space="preserve"
117 x="7200"
118 y="1350"
119 font-style="normal"
120 font-weight="normal"
121 font-size="324"
122 id="text16"
123 sodipodi:linespacing="125%"
124 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"><tspan
125 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"
126 id="tspan3019">Inconsistent Data OK</tspan></text>
127 <!-- Text -->
128 <text
129 xml:space="preserve"
130 x="7200"
131 y="1800"
132 font-style="normal"
133 font-weight="normal"
134 font-size="324"
135 id="text18"
136 sodipodi:linespacing="125%"
137 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"><tspan
138 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"
139 id="tspan3021">(RCU Works Great!!!)</tspan></text>
140 <!-- Text -->
141 <text
142 xml:space="preserve"
143 x="7200"
144 y="3825"
145 font-style="normal"
146 font-weight="normal"
147 font-size="324"
148 id="text20"
149 sodipodi:linespacing="125%"
150 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"><tspan
151 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"
152 id="tspan3023">(RCU Works Well)</tspan></text>
153 <!-- Text -->
154 <text
155 xml:space="preserve"
156 x="7200"
157 y="3375"
158 font-style="normal"
159 font-weight="normal"
160 font-size="324"
161 id="text22"
162 sodipodi:linespacing="125%"
163 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"><tspan
164 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"
165 id="tspan3025">Read-Mostly, Need Consistent Data</tspan></text>
166 <!-- Text -->
167 <text
168 xml:space="preserve"
169 x="7200"
170 y="5175"
171 font-style="normal"
172 font-weight="normal"
173 font-size="324"
174 id="text24"
175 sodipodi:linespacing="125%"
176 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"><tspan
177 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"
178 id="tspan3027">Read-Write, Need Consistent Data</tspan></text>
179 <!-- Text -->
180 <text
181 xml:space="preserve"
182 x="7200"
183 y="6975"
184 font-style="normal"
185 font-weight="normal"
186 font-size="324"
187 id="text26"
188 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"
189 sodipodi:linespacing="125%">Update-Mostly, Need Consistent Data</text>
190 <!-- Text -->
191 <text
192 xml:space="preserve"
193 x="7200"
194 y="5625"
195 font-style="normal"
196 font-weight="normal"
197 font-size="324"
198 id="text28"
199 sodipodi:linespacing="125%"
200 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"><tspan
201 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"
202 id="tspan3029">(RCU Might Be OK...)</tspan></text>
203 <!-- Text -->
204 <text
205 xml:space="preserve"
206 x="7200"
207 y="7875"
208 font-style="normal"
209 font-weight="normal"
210 font-size="324"
211 id="text30"
212 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"
213 sodipodi:linespacing="125%">(1) Provide Existence Guarantees For Update-Friendly Mechanisms</text>
214 <!-- Text -->
215 <text
216 xml:space="preserve"
217 x="7200"
218 y="8325"
219 font-style="normal"
220 font-weight="normal"
221 font-size="324"
222 id="text32"
223 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"
224 sodipodi:linespacing="125%">(2) Provide Wait-Free Read-Side Primitives for Real-Time Use)</text>
225 <!-- Text -->
226 <text
227 xml:space="preserve"
228 x="7200"
229 y="7425"
230 font-style="normal"
231 font-weight="normal"
232 font-size="324"
233 id="text34"
234 style="font-size:427.63009644px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#000000;font-family:Nimbus Sans L;-inkscape-font-specification:Nimbus Sans L"
235 sodipodi:linespacing="125%">(RCU is Very Unlikely to be the Right Tool For The Job, But it Can:</text>
236 </g>
237</svg>
diff --git a/Documentation/RCU/Design/Requirements/ReadersPartitionGP1.svg b/Documentation/RCU/Design/Requirements/ReadersPartitionGP1.svg
new file mode 100644
index 000000000000..48cd1623d4d4
--- /dev/null
+++ b/Documentation/RCU/Design/Requirements/ReadersPartitionGP1.svg
@@ -0,0 +1,639 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
4<svg
5 xmlns:dc="http://purl.org/dc/elements/1.1/"
6 xmlns:cc="http://creativecommons.org/ns#"
7 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8 xmlns:svg="http://www.w3.org/2000/svg"
9 xmlns="http://www.w3.org/2000/svg"
10 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12 width="735.25"
13 height="516.21875"
14 id="svg2"
15 version="1.1"
16 inkscape:version="0.48.3.1 r9886"
17 sodipodi:docname="ReadersPartitionGP1.svg">
18 <defs
19 id="defs4">
20 <marker
21 inkscape:stockid="Arrow2Lend"
22 orient="auto"
23 refY="0"
24 refX="0"
25 id="Arrow2Lend"
26 style="overflow:visible">
27 <path
28 id="path3792"
29 style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
30 d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
31 transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
32 inkscape:connector-curvature="0" />
33 </marker>
34 <marker
35 inkscape:stockid="Arrow2Lstart"
36 orient="auto"
37 refY="0"
38 refX="0"
39 id="Arrow2Lstart"
40 style="overflow:visible">
41 <path
42 id="path3789"
43 style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
44 d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
45 transform="matrix(1.1,0,0,1.1,1.1,0)"
46 inkscape:connector-curvature="0" />
47 </marker>
48 <marker
49 inkscape:stockid="Arrow2Lstart"
50 orient="auto"
51 refY="0"
52 refX="0"
53 id="Arrow2Lstart-4"
54 style="overflow:visible">
55 <path
56 id="path3789-9"
57 style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
58 d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
59 transform="matrix(1.1,0,0,1.1,1.1,0)"
60 inkscape:connector-curvature="0" />
61 </marker>
62 <marker
63 inkscape:stockid="Arrow2Lend"
64 orient="auto"
65 refY="0"
66 refX="0"
67 id="Arrow2Lend-4"
68 style="overflow:visible">
69 <path
70 id="path3792-4"
71 style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
72 d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
73 transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
74 inkscape:connector-curvature="0" />
75 </marker>
76 </defs>
77 <sodipodi:namedview
78 id="base"
79 pagecolor="#ffffff"
80 bordercolor="#666666"
81 borderopacity="1.0"
82 inkscape:pageopacity="0.0"
83 inkscape:pageshadow="2"
84 inkscape:zoom="1.3670394"
85 inkscape:cx="367.26465"
86 inkscape:cy="258.46182"
87 inkscape:document-units="px"
88 inkscape:current-layer="g4433-6"
89 showgrid="false"
90 inkscape:window-width="1351"
91 inkscape:window-height="836"
92 inkscape:window-x="438"
93 inkscape:window-y="335"
94 inkscape:window-maximized="0"
95 fit-margin-top="5"
96 fit-margin-left="5"
97 fit-margin-right="5"
98 fit-margin-bottom="5" />
99 <metadata
100 id="metadata7">
101 <rdf:RDF>
102 <cc:Work
103 rdf:about="">
104 <dc:format>image/svg+xml</dc:format>
105 <dc:type
106 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
107 <dc:title />
108 </cc:Work>
109 </rdf:RDF>
110 </metadata>
111 <g
112 inkscape:label="Layer 1"
113 inkscape:groupmode="layer"
114 id="layer1"
115 transform="translate(-29.15625,-185.59375)">
116 <flowRoot
117 xml:space="preserve"
118 id="flowRoot2985"
119 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"><flowRegion
120 id="flowRegion2987"><rect
121 id="rect2989"
122 width="82.85714"
123 height="11.428572"
124 x="240"
125 y="492.36218" /></flowRegion><flowPara
126 id="flowPara2991" /></flowRoot> <g
127 id="g4433"
128 transform="translate(2,-12)">
129 <text
130 sodipodi:linespacing="125%"
131 id="text2993"
132 y="-261.66608"
133 x="436.12299"
134 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
135 xml:space="preserve"
136 transform="matrix(0,1,-1,0,0,0)"><tspan
137 y="-261.66608"
138 x="436.12299"
139 id="tspan2995"
140 sodipodi:role="line">synchronize_rcu()</tspan></text>
141 <g
142 id="g4417"
143 transform="matrix(0,1,-1,0,730.90257,222.4928)">
144 <path
145 style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:url(#Arrow2Lend)"
146 d="M 97.580736,477.4048 327.57913,476.09759"
147 id="path2997"
148 inkscape:connector-curvature="0"
149 sodipodi:nodetypes="cc" />
150 <path
151 style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
152 d="m 96.752718,465.38398 0,22.62742"
153 id="path4397"
154 inkscape:connector-curvature="0"
155 sodipodi:nodetypes="cc" />
156 <path
157 style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
158 d="m 328.40703,465.38397 0,22.62742"
159 id="path4397-5"
160 inkscape:connector-curvature="0"
161 sodipodi:nodetypes="cc" />
162 </g>
163 </g>
164 <text
165 xml:space="preserve"
166 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
167 x="112.04738"
168 y="268.18076"
169 id="text4429"
170 sodipodi:linespacing="125%"><tspan
171 sodipodi:role="line"
172 id="tspan4431"
173 x="112.04738"
174 y="268.18076">WRITE_ONCE(a, 1);</tspan></text>
175 <text
176 xml:space="preserve"
177 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
178 x="112.04738"
179 y="487.13766"
180 id="text4441"
181 sodipodi:linespacing="125%"><tspan
182 sodipodi:role="line"
183 id="tspan4443"
184 x="112.04738"
185 y="487.13766">WRITE_ONCE(b, 1);</tspan></text>
186 <text
187 xml:space="preserve"
188 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
189 x="255.60869"
190 y="297.29346"
191 id="text4445"
192 sodipodi:linespacing="125%"><tspan
193 sodipodi:role="line"
194 id="tspan4447"
195 x="255.60869"
196 y="297.29346">r1 = READ_ONCE(a);</tspan></text>
197 <text
198 xml:space="preserve"
199 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
200 x="255.14423"
201 y="554.61786"
202 id="text4449"
203 sodipodi:linespacing="125%"><tspan
204 sodipodi:role="line"
205 id="tspan4451"
206 x="255.14423"
207 y="554.61786">WRITE_ONCE(c, 1);</tspan></text>
208 <text
209 xml:space="preserve"
210 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
211 x="396.10254"
212 y="370.71124"
213 id="text4453"
214 sodipodi:linespacing="125%"><tspan
215 sodipodi:role="line"
216 id="tspan4455"
217 x="396.10254"
218 y="370.71124">WRITE_ONCE(d, 1);</tspan></text>
219 <text
220 xml:space="preserve"
221 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
222 x="396.10254"
223 y="572.13617"
224 id="text4457"
225 sodipodi:linespacing="125%"><tspan
226 sodipodi:role="line"
227 id="tspan4459"
228 x="396.10254"
229 y="572.13617">r2 = READ_ONCE(c);</tspan></text>
230 <text
231 xml:space="preserve"
232 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
233 x="112.08231"
234 y="213.91006"
235 id="text4461"
236 sodipodi:linespacing="125%"><tspan
237 sodipodi:role="line"
238 id="tspan4463"
239 x="112.08231"
240 y="213.91006">thread0()</tspan></text>
241 <text
242 xml:space="preserve"
243 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
244 x="252.34512"
245 y="213.91006"
246 id="text4461-6"
247 sodipodi:linespacing="125%"><tspan
248 sodipodi:role="line"
249 id="tspan4463-0"
250 x="252.34512"
251 y="213.91006">thread1()</tspan></text>
252 <text
253 xml:space="preserve"
254 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
255 x="396.42557"
256 y="213.91006"
257 id="text4461-2"
258 sodipodi:linespacing="125%"><tspan
259 sodipodi:role="line"
260 id="tspan4463-2"
261 x="396.42557"
262 y="213.91006">thread2()</tspan></text>
263 <rect
264 style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
265 id="rect4495"
266 width="724.25244"
267 height="505.21201"
268 x="34.648232"
269 y="191.10612" />
270 <path
271 style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
272 d="m 183.14066,191.10612 0,504.24243"
273 id="path4497"
274 inkscape:connector-curvature="0"
275 sodipodi:nodetypes="cc" />
276 <path
277 style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
278 d="m 325.13867,191.10612 0,504.24243"
279 id="path4497-5"
280 inkscape:connector-curvature="0"
281 sodipodi:nodetypes="cc" />
282 <text
283 xml:space="preserve"
284 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
285 x="111.75929"
286 y="251.53981"
287 id="text4429-8"
288 sodipodi:linespacing="125%"><tspan
289 sodipodi:role="line"
290 id="tspan4431-9"
291 x="111.75929"
292 y="251.53981">rcu_read_lock();</tspan></text>
293 <text
294 xml:space="preserve"
295 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
296 x="396.10254"
297 y="353.91556"
298 id="text4429-8-9"
299 sodipodi:linespacing="125%"><tspan
300 sodipodi:role="line"
301 id="tspan4431-9-4"
302 x="396.10254"
303 y="353.91556">rcu_read_lock();</tspan></text>
304 <text
305 xml:space="preserve"
306 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
307 x="396.10254"
308 y="587.40289"
309 id="text4429-8-9-3"
310 sodipodi:linespacing="125%"><tspan
311 sodipodi:role="line"
312 id="tspan4431-9-4-4"
313 x="396.10254"
314 y="587.40289">rcu_read_unlock();</tspan></text>
315 <text
316 xml:space="preserve"
317 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
318 x="111.75929"
319 y="501.15311"
320 id="text4429-8-9-3-1"
321 sodipodi:linespacing="125%"><tspan
322 sodipodi:role="line"
323 id="tspan4431-9-4-4-6"
324 x="111.75929"
325 y="501.15311">rcu_read_unlock();</tspan></text>
326 <path
327 style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
328 d="m 33.941125,227.87568 724.941765,0"
329 id="path4608"
330 inkscape:connector-curvature="0"
331 sodipodi:nodetypes="cc" />
332 <text
333 xml:space="preserve"
334 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
335 x="394.94427"
336 y="331.66351"
337 id="text4648"
338 sodipodi:linespacing="125%"><tspan
339 sodipodi:role="line"
340 id="tspan4650"
341 x="394.94427"
342 y="331.66351">QS</tspan></text>
343 <path
344 sodipodi:type="arc"
345 style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
346 id="path4652"
347 sodipodi:cx="358.85669"
348 sodipodi:cy="142.87541"
349 sodipodi:rx="10.960155"
350 sodipodi:ry="10.253048"
351 d="m 358.86939,132.62237 a 10.960155,10.253048 0 1 1 -0.0228,0"
352 transform="translate(36.441125,185.60612)"
353 sodipodi:start="4.7135481"
354 sodipodi:end="10.994651"
355 sodipodi:open="true" />
356 <text
357 xml:space="preserve"
358 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
359 x="112.11968"
360 y="523.77856"
361 id="text4648-4"
362 sodipodi:linespacing="125%"><tspan
363 sodipodi:role="line"
364 id="tspan4650-4"
365 x="112.11968"
366 y="523.77856">QS</tspan></text>
367 <path
368 sodipodi:type="arc"
369 style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
370 id="path4652-7"
371 sodipodi:cx="358.85669"
372 sodipodi:cy="142.87541"
373 sodipodi:rx="10.960155"
374 sodipodi:ry="10.253048"
375 d="m 358.86939,132.62237 a 10.960155,10.253048 0 1 1 -0.0228,0"
376 transform="translate(-246.38346,377.72117)"
377 sodipodi:start="4.7135481"
378 sodipodi:end="10.994651"
379 sodipodi:open="true" />
380 <path
381 sodipodi:type="arc"
382 style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
383 id="path4652-7-7"
384 sodipodi:cx="358.85669"
385 sodipodi:cy="142.87541"
386 sodipodi:rx="10.960155"
387 sodipodi:ry="10.253048"
388 d="m 358.86939,132.62237 a 10.960155,10.253048 0 1 1 -0.0228,0"
389 transform="translate(-103.65246,190.90878)"
390 sodipodi:start="4.7135481"
391 sodipodi:end="10.994651"
392 sodipodi:open="true" />
393 <text
394 xml:space="preserve"
395 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
396 x="254.85066"
397 y="336.96619"
398 id="text4648-4-3"
399 sodipodi:linespacing="125%"><tspan
400 sodipodi:role="line"
401 id="tspan4650-4-5"
402 x="254.85066"
403 y="336.96619">QS</tspan></text>
404 <path
405 style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
406 d="m 470.93311,190.39903 0,504.24243"
407 id="path4497-5-6"
408 inkscape:connector-curvature="0"
409 sodipodi:nodetypes="cc" />
410 <path
411 style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
412 d="m 616.22755,190.38323 0,504.24243"
413 id="path4497-5-2"
414 inkscape:connector-curvature="0"
415 sodipodi:nodetypes="cc" />
416 <g
417 id="g4433-6"
418 transform="translate(288.0964,78.32827)">
419 <text
420 sodipodi:linespacing="125%"
421 id="text2993-7"
422 y="-261.66608"
423 x="440.12299"
424 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
425 xml:space="preserve"
426 transform="matrix(0,1,-1,0,0,0)"><tspan
427 y="-261.66608"
428 x="440.12299"
429 id="tspan2995-1"
430 sodipodi:role="line">synchronize_rcu()</tspan></text>
431 <g
432 id="g4417-1"
433 transform="matrix(0,1,-1,0,730.90257,222.4928)">
434 <path
435 style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:url(#Arrow2Lend)"
436 d="M 97.580736,477.4048 328.5624,477.07246"
437 id="path2997-2"
438 inkscape:connector-curvature="0"
439 sodipodi:nodetypes="cc" />
440 <path
441 style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
442 d="m 96.752718,465.38398 0,22.62742"
443 id="path4397-3"
444 inkscape:connector-curvature="0"
445 sodipodi:nodetypes="cc" />
446 <path
447 style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
448 d="m 329.39039,465.38397 0,22.62742"
449 id="path4397-5-4"
450 inkscape:connector-curvature="0"
451 sodipodi:nodetypes="cc" />
452 </g>
453 </g>
454 <text
455 xml:space="preserve"
456 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
457 x="541.70508"
458 y="387.6217"
459 id="text4445-0"
460 sodipodi:linespacing="125%"><tspan
461 sodipodi:role="line"
462 id="tspan4447-5"
463 x="541.70508"
464 y="387.6217">r3 = READ_ONCE(d);</tspan></text>
465 <text
466 xml:space="preserve"
467 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
468 x="541.2406"
469 y="646.94611"
470 id="text4449-6"
471 sodipodi:linespacing="125%"><tspan
472 sodipodi:role="line"
473 id="tspan4451-6"
474 x="541.2406"
475 y="646.94611">WRITE_ONCE(e, 1);</tspan></text>
476 <path
477 sodipodi:type="arc"
478 style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
479 id="path4652-7-7-5"
480 sodipodi:cx="358.85669"
481 sodipodi:cy="142.87541"
482 sodipodi:rx="10.960155"
483 sodipodi:ry="10.253048"
484 d="m 358.86939,132.62237 a 10.960155,10.253048 0 1 1 -0.0228,0"
485 transform="translate(182.44393,281.23704)"
486 sodipodi:start="4.7135481"
487 sodipodi:end="10.994651"
488 sodipodi:open="true" />
489 <text
490 xml:space="preserve"
491 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
492 x="540.94702"
493 y="427.29443"
494 id="text4648-4-3-1"
495 sodipodi:linespacing="125%"><tspan
496 sodipodi:role="line"
497 id="tspan4650-4-5-7"
498 x="540.94702"
499 y="427.29443">QS</tspan></text>
500 <text
501 xml:space="preserve"
502 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
503 x="686.27747"
504 y="461.83929"
505 id="text4453-7"
506 sodipodi:linespacing="125%"><tspan
507 sodipodi:role="line"
508 id="tspan4455-1"
509 x="686.27747"
510 y="461.83929">r4 = READ_ONCE(b);</tspan></text>
511 <text
512 xml:space="preserve"
513 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
514 x="686.27747"
515 y="669.26422"
516 id="text4457-9"
517 sodipodi:linespacing="125%"><tspan
518 sodipodi:role="line"
519 id="tspan4459-2"
520 x="686.27747"
521 y="669.26422">r5 = READ_ONCE(e);</tspan></text>
522 <text
523 xml:space="preserve"
524 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
525 x="686.27747"
526 y="445.04358"
527 id="text4429-8-9-33"
528 sodipodi:linespacing="125%"><tspan
529 sodipodi:role="line"
530 id="tspan4431-9-4-2"
531 x="686.27747"
532 y="445.04358">rcu_read_lock();</tspan></text>
533 <text
534 xml:space="preserve"
535 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
536 x="686.27747"
537 y="684.53094"
538 id="text4429-8-9-3-8"
539 sodipodi:linespacing="125%"><tspan
540 sodipodi:role="line"
541 id="tspan4431-9-4-4-5"
542 x="686.27747"
543 y="684.53094">rcu_read_unlock();</tspan></text>
544 <text
545 xml:space="preserve"
546 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
547 x="685.11914"
548 y="422.79153"
549 id="text4648-9"
550 sodipodi:linespacing="125%"><tspan
551 sodipodi:role="line"
552 id="tspan4650-7"
553 x="685.11914"
554 y="422.79153">QS</tspan></text>
555 <path
556 sodipodi:type="arc"
557 style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
558 id="path4652-8"
559 sodipodi:cx="358.85669"
560 sodipodi:cy="142.87541"
561 sodipodi:rx="10.960155"
562 sodipodi:ry="10.253048"
563 d="m 358.86939,132.62237 a 10.960155,10.253048 0 1 1 -0.0228,0"
564 transform="translate(326.61602,276.73415)"
565 sodipodi:start="4.7135481"
566 sodipodi:end="10.994651"
567 sodipodi:open="true" />
568 <text
569 xml:space="preserve"
570 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
571 x="397.85934"
572 y="609.59003"
573 id="text4648-5"
574 sodipodi:linespacing="125%"><tspan
575 sodipodi:role="line"
576 id="tspan4650-77"
577 x="397.85934"
578 y="609.59003">QS</tspan></text>
579 <path
580 sodipodi:type="arc"
581 style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
582 id="path4652-80"
583 sodipodi:cx="358.85669"
584 sodipodi:cy="142.87541"
585 sodipodi:rx="10.960155"
586 sodipodi:ry="10.253048"
587 d="m 358.86939,132.62237 a 10.960155,10.253048 0 1 1 -0.0228,0"
588 transform="translate(39.356201,463.53264)"
589 sodipodi:start="4.7135481"
590 sodipodi:end="10.994651"
591 sodipodi:open="true" />
592 <text
593 xml:space="preserve"
594 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
595 x="256.75986"
596 y="586.99133"
597 id="text4648-5-2"
598 sodipodi:linespacing="125%"><tspan
599 sodipodi:role="line"
600 id="tspan4650-77-7"
601 x="256.75986"
602 y="586.99133">QS</tspan></text>
603 <path
604 sodipodi:type="arc"
605 style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
606 id="path4652-80-5"
607 sodipodi:cx="358.85669"
608 sodipodi:cy="142.87541"
609 sodipodi:rx="10.960155"
610 sodipodi:ry="10.253048"
611 d="m 358.86939,132.62237 a 10.960155,10.253048 0 1 1 -0.0228,0"
612 transform="translate(-101.74328,440.93395)"
613 sodipodi:start="4.7135481"
614 sodipodi:end="10.994651"
615 sodipodi:open="true" />
616 <text
617 xml:space="preserve"
618 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
619 x="546.22791"
620 y="213.91006"
621 id="text4461-2-5"
622 sodipodi:linespacing="125%"><tspan
623 sodipodi:role="line"
624 id="tspan4463-2-6"
625 x="546.22791"
626 y="213.91006">thread3()</tspan></text>
627 <text
628 xml:space="preserve"
629 style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Symbol;-inkscape-font-specification:Symbol"
630 x="684.00067"
631 y="213.91006"
632 id="text4461-2-1"
633 sodipodi:linespacing="125%"><tspan
634 sodipodi:role="line"
635 id="tspan4463-2-0"
636 x="684.00067"
637 y="213.91006">thread4()</tspan></text>
638 </g>
639</svg>
diff --git a/Documentation/RCU/Design/Requirements/Requirements.html b/Documentation/RCU/Design/Requirements/Requirements.html
new file mode 100644
index 000000000000..a725f9900ec8
--- /dev/null
+++ b/Documentation/RCU/Design/Requirements/Requirements.html
@@ -0,0 +1,2897 @@
1<!-- DO NOT HAND EDIT. -->
2<!-- Instead, edit Documentation/RCU/Design/Requirements/Requirements.htmlx and run 'sh htmlqqz.sh Documentation/RCU/Design/Requirements/Requirements' -->
3<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
4 "http://www.w3.org/TR/html4/loose.dtd">
5 <html>
6 <head><title>A Tour Through RCU's Requirements [LWN.net]</title>
7 <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
8
9<h1>A Tour Through RCU's Requirements</h1>
10
11<p>Copyright IBM Corporation, 2015</p>
12<p>Author: Paul E.&nbsp;McKenney</p>
13<p><i>The initial version of this document appeared in the
14<a href="https://lwn.net/">LWN</a> articles
15<a href="https://lwn.net/Articles/652156/">here</a>,
16<a href="https://lwn.net/Articles/652677/">here</a>, and
17<a href="https://lwn.net/Articles/653326/">here</a>.</i></p>
18
19<h2>Introduction</h2>
20
21<p>
22Read-copy update (RCU) is a synchronization mechanism that is often
23used as a replacement for reader-writer locking.
24RCU is unusual in that updaters do not block readers,
25which means that RCU's read-side primitives can be exceedingly fast
26and scalable.
27In addition, updaters can make useful forward progress concurrently
28with readers.
29However, all this concurrency between RCU readers and updaters does raise
30the question of exactly what RCU readers are doing, which in turn
31raises the question of exactly what RCU's requirements are.
32
33<p>
34This document therefore summarizes RCU's requirements, and can be thought
35of as an informal, high-level specification for RCU.
36It is important to understand that RCU's specification is primarily
37empirical in nature;
38in fact, I learned about many of these requirements the hard way.
39This situation might cause some consternation, however, not only
40has this learning process been a lot of fun, but it has also been
41a great privilege to work with so many people willing to apply
42technologies in interesting new ways.
43
44<p>
45All that aside, here are the categories of currently known RCU requirements:
46</p>
47
48<ol>
49<li> <a href="#Fundamental Requirements">
50 Fundamental Requirements</a>
51<li> <a href="#Fundamental Non-Requirements">Fundamental Non-Requirements</a>
52<li> <a href="#Parallelism Facts of Life">
53 Parallelism Facts of Life</a>
54<li> <a href="#Quality-of-Implementation Requirements">
55 Quality-of-Implementation Requirements</a>
56<li> <a href="#Linux Kernel Complications">
57 Linux Kernel Complications</a>
58<li> <a href="#Software-Engineering Requirements">
59 Software-Engineering Requirements</a>
60<li> <a href="#Other RCU Flavors">
61 Other RCU Flavors</a>
62<li> <a href="#Possible Future Changes">
63 Possible Future Changes</a>
64</ol>
65
66<p>
67This is followed by a <a href="#Summary">summary</a>,
68which is in turn followed by the inevitable
69<a href="#Answers to Quick Quizzes">answers to the quick quizzes</a>.
70
71<h2><a name="Fundamental Requirements">Fundamental Requirements</a></h2>
72
73<p>
74RCU's fundamental requirements are the closest thing RCU has to hard
75mathematical requirements.
76These are:
77
78<ol>
79<li> <a href="#Grace-Period Guarantee">
80 Grace-Period Guarantee</a>
81<li> <a href="#Publish-Subscribe Guarantee">
82 Publish-Subscribe Guarantee</a>
83<li> <a href="#Memory-Barrier Guarantees">
84 Memory-Barrier Guarantees</a>
85<li> <a href="#RCU Primitives Guaranteed to Execute Unconditionally">
86 RCU Primitives Guaranteed to Execute Unconditionally</a>
87<li> <a href="#Guaranteed Read-to-Write Upgrade">
88 Guaranteed Read-to-Write Upgrade</a>
89</ol>
90
91<h3><a name="Grace-Period Guarantee">Grace-Period Guarantee</a></h3>
92
93<p>
94RCU's grace-period guarantee is unusual in being premeditated:
95Jack Slingwine and I had this guarantee firmly in mind when we started
96work on RCU (then called &ldquo;rclock&rdquo;) in the early 1990s.
97That said, the past two decades of experience with RCU have produced
98a much more detailed understanding of this guarantee.
99
100<p>
101RCU's grace-period guarantee allows updaters to wait for the completion
102of all pre-existing RCU read-side critical sections.
103An RCU read-side critical section
104begins with the marker <tt>rcu_read_lock()</tt> and ends with
105the marker <tt>rcu_read_unlock()</tt>.
106These markers may be nested, and RCU treats a nested set as one
107big RCU read-side critical section.
108Production-quality implementations of <tt>rcu_read_lock()</tt> and
109<tt>rcu_read_unlock()</tt> are extremely lightweight, and in
110fact have exactly zero overhead in Linux kernels built for production
111use with <tt>CONFIG_PREEMPT=n</tt>.
112
113<p>
114This guarantee allows ordering to be enforced with extremely low
115overhead to readers, for example:
116
117<blockquote>
118<pre>
119 1 int x, y;
120 2
121 3 void thread0(void)
122 4 {
123 5 rcu_read_lock();
124 6 r1 = READ_ONCE(x);
125 7 r2 = READ_ONCE(y);
126 8 rcu_read_unlock();
127 9 }
12810
12911 void thread1(void)
13012 {
13113 WRITE_ONCE(x, 1);
13214 synchronize_rcu();
13315 WRITE_ONCE(y, 1);
13416 }
135</pre>
136</blockquote>
137
138<p>
139Because the <tt>synchronize_rcu()</tt> on line&nbsp;14 waits for
140all pre-existing readers, any instance of <tt>thread0()</tt> that
141loads a value of zero from <tt>x</tt> must complete before
142<tt>thread1()</tt> stores to <tt>y</tt>, so that instance must
143also load a value of zero from <tt>y</tt>.
144Similarly, any instance of <tt>thread0()</tt> that loads a value of
145one from <tt>y</tt> must have started after the
146<tt>synchronize_rcu()</tt> started, and must therefore also load
147a value of one from <tt>x</tt>.
148Therefore, the outcome:
149<blockquote>
150<pre>
151(r1 == 0 &amp;&amp; r2 == 1)
152</pre>
153</blockquote>
154cannot happen.
155
156<p><a name="Quick Quiz 1"><b>Quick Quiz 1</b>:</a>
157Wait a minute!
158You said that updaters can make useful forward progress concurrently
159with readers, but pre-existing readers will block
160<tt>synchronize_rcu()</tt>!!!
161Just who are you trying to fool???
162<br><a href="#qq1answer">Answer</a>
163
164<p>
165This scenario resembles one of the first uses of RCU in
166<a href="https://en.wikipedia.org/wiki/DYNIX">DYNIX/ptx</a>,
167which managed a distributed lock manager's transition into
168a state suitable for handling recovery from node failure,
169more or less as follows:
170
171<blockquote>
172<pre>
173 1 #define STATE_NORMAL 0
174 2 #define STATE_WANT_RECOVERY 1
175 3 #define STATE_RECOVERING 2
176 4 #define STATE_WANT_NORMAL 3
177 5
178 6 int state = STATE_NORMAL;
179 7
180 8 void do_something_dlm(void)
181 9 {
18210 int state_snap;
18311
18412 rcu_read_lock();
18513 state_snap = READ_ONCE(state);
18614 if (state_snap == STATE_NORMAL)
18715 do_something();
18816 else
18917 do_something_carefully();
19018 rcu_read_unlock();
19119 }
19220
19321 void start_recovery(void)
19422 {
19523 WRITE_ONCE(state, STATE_WANT_RECOVERY);
19624 synchronize_rcu();
19725 WRITE_ONCE(state, STATE_RECOVERING);
19826 recovery();
19927 WRITE_ONCE(state, STATE_WANT_NORMAL);
20028 synchronize_rcu();
20129 WRITE_ONCE(state, STATE_NORMAL);
20230 }
203</pre>
204</blockquote>
205
206<p>
207The RCU read-side critical section in <tt>do_something_dlm()</tt>
208works with the <tt>synchronize_rcu()</tt> in <tt>start_recovery()</tt>
209to guarantee that <tt>do_something()</tt> never runs concurrently
210with <tt>recovery()</tt>, but with little or no synchronization
211overhead in <tt>do_something_dlm()</tt>.
212
213<p><a name="Quick Quiz 2"><b>Quick Quiz 2</b>:</a>
214Why is the <tt>synchronize_rcu()</tt> on line&nbsp;28 needed?
215<br><a href="#qq2answer">Answer</a>
216
217<p>
218In order to avoid fatal problems such as deadlocks,
219an RCU read-side critical section must not contain calls to
220<tt>synchronize_rcu()</tt>.
221Similarly, an RCU read-side critical section must not
222contain anything that waits, directly or indirectly, on completion of
223an invocation of <tt>synchronize_rcu()</tt>.
224
225<p>
226Although RCU's grace-period guarantee is useful in and of itself, with
227<a href="https://lwn.net/Articles/573497/">quite a few use cases</a>,
228it would be good to be able to use RCU to coordinate read-side
229access to linked data structures.
230For this, the grace-period guarantee is not sufficient, as can
231be seen in function <tt>add_gp_buggy()</tt> below.
232We will look at the reader's code later, but in the meantime, just think of
233the reader as locklessly picking up the <tt>gp</tt> pointer,
234and, if the value loaded is non-<tt>NULL</tt>, locklessly accessing the
235<tt>-&gt;a</tt> and <tt>-&gt;b</tt> fields.
236
237<blockquote>
238<pre>
239 1 bool add_gp_buggy(int a, int b)
240 2 {
241 3 p = kmalloc(sizeof(*p), GFP_KERNEL);
242 4 if (!p)
243 5 return -ENOMEM;
244 6 spin_lock(&amp;gp_lock);
245 7 if (rcu_access_pointer(gp)) {
246 8 spin_unlock(&amp;gp_lock);
247 9 return false;
24810 }
24911 p-&gt;a = a;
25012 p-&gt;b = a;
25113 gp = p; /* ORDERING BUG */
25214 spin_unlock(&amp;gp_lock);
25315 return true;
25416 }
255</pre>
256</blockquote>
257
258<p>
259The problem is that both the compiler and weakly ordered CPUs are within
260their rights to reorder this code as follows:
261
262<blockquote>
263<pre>
264 1 bool add_gp_buggy_optimized(int a, int b)
265 2 {
266 3 p = kmalloc(sizeof(*p), GFP_KERNEL);
267 4 if (!p)
268 5 return -ENOMEM;
269 6 spin_lock(&amp;gp_lock);
270 7 if (rcu_access_pointer(gp)) {
271 8 spin_unlock(&amp;gp_lock);
272 9 return false;
27310 }
274<b>11 gp = p; /* ORDERING BUG */
27512 p-&gt;a = a;
27613 p-&gt;b = a;</b>
27714 spin_unlock(&amp;gp_lock);
27815 return true;
27916 }
280</pre>
281</blockquote>
282
283<p>
284If an RCU reader fetches <tt>gp</tt> just after
285<tt>add_gp_buggy_optimized</tt> executes line&nbsp;11,
286it will see garbage in the <tt>-&gt;a</tt> and <tt>-&gt;b</tt>
287fields.
288And this is but one of many ways in which compiler and hardware optimizations
289could cause trouble.
290Therefore, we clearly need some way to prevent the compiler and the CPU from
291reordering in this manner, which brings us to the publish-subscribe
292guarantee discussed in the next section.
293
294<h3><a name="Publish-Subscribe Guarantee">Publish/Subscribe Guarantee</a></h3>
295
296<p>
297RCU's publish-subscribe guarantee allows data to be inserted
298into a linked data structure without disrupting RCU readers.
299The updater uses <tt>rcu_assign_pointer()</tt> to insert the
300new data, and readers use <tt>rcu_dereference()</tt> to
301access data, whether new or old.
302The following shows an example of insertion:
303
304<blockquote>
305<pre>
306 1 bool add_gp(int a, int b)
307 2 {
308 3 p = kmalloc(sizeof(*p), GFP_KERNEL);
309 4 if (!p)
310 5 return -ENOMEM;
311 6 spin_lock(&amp;gp_lock);
312 7 if (rcu_access_pointer(gp)) {
313 8 spin_unlock(&amp;gp_lock);
314 9 return false;
31510 }
31611 p-&gt;a = a;
31712 p-&gt;b = a;
31813 rcu_assign_pointer(gp, p);
31914 spin_unlock(&amp;gp_lock);
32015 return true;
32116 }
322</pre>
323</blockquote>
324
325<p>
326The <tt>rcu_assign_pointer()</tt> on line&nbsp;13 is conceptually
327equivalent to a simple assignment statement, but also guarantees
328that its assignment will
329happen after the two assignments in lines&nbsp;11 and&nbsp;12,
330similar to the C11 <tt>memory_order_release</tt> store operation.
331It also prevents any number of &ldquo;interesting&rdquo; compiler
332optimizations, for example, the use of <tt>gp</tt> as a scratch
333location immediately preceding the assignment.
334
335<p><a name="Quick Quiz 3"><b>Quick Quiz 3</b>:</a>
336But <tt>rcu_assign_pointer()</tt> does nothing to prevent the
337two assignments to <tt>p-&gt;a</tt> and <tt>p-&gt;b</tt>
338from being reordered.
339Can't that also cause problems?
340<br><a href="#qq3answer">Answer</a>
341
342<p>
343It is tempting to assume that the reader need not do anything special
344to control its accesses to the RCU-protected data,
345as shown in <tt>do_something_gp_buggy()</tt> below:
346
347<blockquote>
348<pre>
349 1 bool do_something_gp_buggy(void)
350 2 {
351 3 rcu_read_lock();
352 4 p = gp; /* OPTIMIZATIONS GALORE!!! */
353 5 if (p) {
354 6 do_something(p-&gt;a, p-&gt;b);
355 7 rcu_read_unlock();
356 8 return true;
357 9 }
35810 rcu_read_unlock();
35911 return false;
36012 }
361</pre>
362</blockquote>
363
364<p>
365However, this temptation must be resisted because there are a
366surprisingly large number of ways that the compiler
367(to say nothing of
368<a href="https://h71000.www7.hp.com/wizard/wiz_2637.html">DEC Alpha CPUs</a>)
369can trip this code up.
370For but one example, if the compiler were short of registers, it
371might choose to refetch from <tt>gp</tt> rather than keeping
372a separate copy in <tt>p</tt> as follows:
373
374<blockquote>
375<pre>
376 1 bool do_something_gp_buggy_optimized(void)
377 2 {
378 3 rcu_read_lock();
379 4 if (gp) { /* OPTIMIZATIONS GALORE!!! */
380<b> 5 do_something(gp-&gt;a, gp-&gt;b);</b>
381 6 rcu_read_unlock();
382 7 return true;
383 8 }
384 9 rcu_read_unlock();
38510 return false;
38611 }
387</pre>
388</blockquote>
389
390<p>
391If this function ran concurrently with a series of updates that
392replaced the current structure with a new one,
393the fetches of <tt>gp-&gt;a</tt>
394and <tt>gp-&gt;b</tt> might well come from two different structures,
395which could cause serious confusion.
396To prevent this (and much else besides), <tt>do_something_gp()</tt> uses
397<tt>rcu_dereference()</tt> to fetch from <tt>gp</tt>:
398
399<blockquote>
400<pre>
401 1 bool do_something_gp(void)
402 2 {
403 3 rcu_read_lock();
404 4 p = rcu_dereference(gp);
405 5 if (p) {
406 6 do_something(p-&gt;a, p-&gt;b);
407 7 rcu_read_unlock();
408 8 return true;
409 9 }
41010 rcu_read_unlock();
41111 return false;
41212 }
413</pre>
414</blockquote>
415
416<p>
417The <tt>rcu_dereference()</tt> uses volatile casts and (for DEC Alpha)
418memory barriers in the Linux kernel.
419Should a
420<a href="http://www.rdrop.com/users/paulmck/RCU/consume.2015.07.13a.pdf">high-quality implementation of C11 <tt>memory_order_consume</tt> [PDF]</a>
421ever appear, then <tt>rcu_dereference()</tt> could be implemented
422as a <tt>memory_order_consume</tt> load.
423Regardless of the exact implementation, a pointer fetched by
424<tt>rcu_dereference()</tt> may not be used outside of the
425outermost RCU read-side critical section containing that
426<tt>rcu_dereference()</tt>, unless protection of
427the corresponding data element has been passed from RCU to some
428other synchronization mechanism, most commonly locking or
429<a href="https://www.kernel.org/doc/Documentation/RCU/rcuref.txt">reference counting</a>.
430
431<p>
432In short, updaters use <tt>rcu_assign_pointer()</tt> and readers
433use <tt>rcu_dereference()</tt>, and these two RCU API elements
434work together to ensure that readers have a consistent view of
435newly added data elements.
436
437<p>
438Of course, it is also necessary to remove elements from RCU-protected
439data structures, for example, using the following process:
440
441<ol>
442<li> Remove the data element from the enclosing structure.
443<li> Wait for all pre-existing RCU read-side critical sections
444 to complete (because only pre-existing readers can possibly have
445 a reference to the newly removed data element).
446<li> At this point, only the updater has a reference to the
447 newly removed data element, so it can safely reclaim
448 the data element, for example, by passing it to <tt>kfree()</tt>.
449</ol>
450
451This process is implemented by <tt>remove_gp_synchronous()</tt>:
452
453<blockquote>
454<pre>
455 1 bool remove_gp_synchronous(void)
456 2 {
457 3 struct foo *p;
458 4
459 5 spin_lock(&amp;gp_lock);
460 6 p = rcu_access_pointer(gp);
461 7 if (!p) {
462 8 spin_unlock(&amp;gp_lock);
463 9 return false;
46410 }
46511 rcu_assign_pointer(gp, NULL);
46612 spin_unlock(&amp;gp_lock);
46713 synchronize_rcu();
46814 kfree(p);
46915 return true;
47016 }
471</pre>
472</blockquote>
473
474<p>
475This function is straightforward, with line&nbsp;13 waiting for a grace
476period before line&nbsp;14 frees the old data element.
477This waiting ensures that readers will reach line&nbsp;7 of
478<tt>do_something_gp()</tt> before the data element referenced by
479<tt>p</tt> is freed.
480The <tt>rcu_access_pointer()</tt> on line&nbsp;6 is similar to
481<tt>rcu_dereference()</tt>, except that:
482
483<ol>
484<li> The value returned by <tt>rcu_access_pointer()</tt>
485 cannot be dereferenced.
486 If you want to access the value pointed to as well as
487 the pointer itself, use <tt>rcu_dereference()</tt>
488 instead of <tt>rcu_access_pointer()</tt>.
489<li> The call to <tt>rcu_access_pointer()</tt> need not be
490 protected.
491 In contrast, <tt>rcu_dereference()</tt> must either be
492 within an RCU read-side critical section or in a code
493 segment where the pointer cannot change, for example, in
494 code protected by the corresponding update-side lock.
495</ol>
496
497<p><a name="Quick Quiz 4"><b>Quick Quiz 4</b>:</a>
498Without the <tt>rcu_dereference()</tt> or the
499<tt>rcu_access_pointer()</tt>, what destructive optimizations
500might the compiler make use of?
501<br><a href="#qq4answer">Answer</a>
502
503<p>
504In short, RCU's publish-subscribe guarantee is provided by the combination
505of <tt>rcu_assign_pointer()</tt> and <tt>rcu_dereference()</tt>.
506This guarantee allows data elements to be safely added to RCU-protected
507linked data structures without disrupting RCU readers.
508This guarantee can be used in combination with the grace-period
509guarantee to also allow data elements to be removed from RCU-protected
510linked data structures, again without disrupting RCU readers.
511
512<p>
513This guarantee was only partially premeditated.
514DYNIX/ptx used an explicit memory barrier for publication, but had nothing
515resembling <tt>rcu_dereference()</tt> for subscription, nor did it
516have anything resembling the <tt>smp_read_barrier_depends()</tt>
517that was later subsumed into <tt>rcu_dereference()</tt>.
518The need for these operations made itself known quite suddenly at a
519late-1990s meeting with the DEC Alpha architects, back in the days when
520DEC was still a free-standing company.
521It took the Alpha architects a good hour to convince me that any sort
522of barrier would ever be needed, and it then took me a good <i>two</i> hours
523to convince them that their documentation did not make this point clear.
524More recent work with the C and C++ standards committees have provided
525much education on tricks and traps from the compiler.
526In short, compilers were much less tricky in the early 1990s, but in
5272015, don't even think about omitting <tt>rcu_dereference()</tt>!
528
529<h3><a name="Memory-Barrier Guarantees">Memory-Barrier Guarantees</a></h3>
530
531<p>
532The previous section's simple linked-data-structure scenario clearly
533demonstrates the need for RCU's stringent memory-ordering guarantees on
534systems with more than one CPU:
535
536<ol>
537<li> Each CPU that has an RCU read-side critical section that
538 begins before <tt>synchronize_rcu()</tt> starts is
539 guaranteed to execute a full memory barrier between the time
540 that the RCU read-side critical section ends and the time that
541 <tt>synchronize_rcu()</tt> returns.
542 Without this guarantee, a pre-existing RCU read-side critical section
543 might hold a reference to the newly removed <tt>struct foo</tt>
544 after the <tt>kfree()</tt> on line&nbsp;14 of
545 <tt>remove_gp_synchronous()</tt>.
546<li> Each CPU that has an RCU read-side critical section that ends
547 after <tt>synchronize_rcu()</tt> returns is guaranteed
548 to execute a full memory barrier between the time that
549 <tt>synchronize_rcu()</tt> begins and the time that the RCU
550 read-side critical section begins.
551 Without this guarantee, a later RCU read-side critical section
552 running after the <tt>kfree()</tt> on line&nbsp;14 of
553 <tt>remove_gp_synchronous()</tt> might
554 later run <tt>do_something_gp()</tt> and find the
555 newly deleted <tt>struct foo</tt>.
556<li> If the task invoking <tt>synchronize_rcu()</tt> remains
557 on a given CPU, then that CPU is guaranteed to execute a full
558 memory barrier sometime during the execution of
559 <tt>synchronize_rcu()</tt>.
560 This guarantee ensures that the <tt>kfree()</tt> on
561 line&nbsp;14 of <tt>remove_gp_synchronous()</tt> really does
562 execute after the removal on line&nbsp;11.
563<li> If the task invoking <tt>synchronize_rcu()</tt> migrates
564 among a group of CPUs during that invocation, then each of the
565 CPUs in that group is guaranteed to execute a full memory barrier
566 sometime during the execution of <tt>synchronize_rcu()</tt>.
567 This guarantee also ensures that the <tt>kfree()</tt> on
568 line&nbsp;14 of <tt>remove_gp_synchronous()</tt> really does
569 execute after the removal on
570 line&nbsp;11, but also in the case where the thread executing the
571 <tt>synchronize_rcu()</tt> migrates in the meantime.
572</ol>
573
574<p><a name="Quick Quiz 5"><b>Quick Quiz 5</b>:</a>
575Given that multiple CPUs can start RCU read-side critical sections
576at any time without any ordering whatsoever, how can RCU possibly tell whether
577or not a given RCU read-side critical section starts before a
578given instance of <tt>synchronize_rcu()</tt>?
579<br><a href="#qq5answer">Answer</a>
580
581<p><a name="Quick Quiz 6"><b>Quick Quiz 6</b>:</a>
582The first and second guarantees require unbelievably strict ordering!
583Are all these memory barriers <i> really</i> required?
584<br><a href="#qq6answer">Answer</a>
585
586<p>
587Note that these memory-barrier requirements do not replace the fundamental
588RCU requirement that a grace period wait for all pre-existing readers.
589On the contrary, the memory barriers called out in this section must operate in
590such a way as to <i>enforce</i> this fundamental requirement.
591Of course, different implementations enforce this requirement in different
592ways, but enforce it they must.
593
594<h3><a name="RCU Primitives Guaranteed to Execute Unconditionally">RCU Primitives Guaranteed to Execute Unconditionally</a></h3>
595
596<p>
597The common-case RCU primitives are unconditional.
598They are invoked, they do their job, and they return, with no possibility
599of error, and no need to retry.
600This is a key RCU design philosophy.
601
602<p>
603However, this philosophy is pragmatic rather than pigheaded.
604If someone comes up with a good justification for a particular conditional
605RCU primitive, it might well be implemented and added.
606After all, this guarantee was reverse-engineered, not premeditated.
607The unconditional nature of the RCU primitives was initially an
608accident of implementation, and later experience with synchronization
609primitives with conditional primitives caused me to elevate this
610accident to a guarantee.
611Therefore, the justification for adding a conditional primitive to
612RCU would need to be based on detailed and compelling use cases.
613
614<h3><a name="Guaranteed Read-to-Write Upgrade">Guaranteed Read-to-Write Upgrade</a></h3>
615
616<p>
617As far as RCU is concerned, it is always possible to carry out an
618update within an RCU read-side critical section.
619For example, that RCU read-side critical section might search for
620a given data element, and then might acquire the update-side
621spinlock in order to update that element, all while remaining
622in that RCU read-side critical section.
623Of course, it is necessary to exit the RCU read-side critical section
624before invoking <tt>synchronize_rcu()</tt>, however, this
625inconvenience can be avoided through use of the
626<tt>call_rcu()</tt> and <tt>kfree_rcu()</tt> API members
627described later in this document.
628
629<p><a name="Quick Quiz 7"><b>Quick Quiz 7</b>:</a>
630But how does the upgrade-to-write operation exclude other readers?
631<br><a href="#qq7answer">Answer</a>
632
633<p>
634This guarantee allows lookup code to be shared between read-side
635and update-side code, and was premeditated, appearing in the earliest
636DYNIX/ptx RCU documentation.
637
638<h2><a name="Fundamental Non-Requirements">Fundamental Non-Requirements</a></h2>
639
640<p>
641RCU provides extremely lightweight readers, and its read-side guarantees,
642though quite useful, are correspondingly lightweight.
643It is therefore all too easy to assume that RCU is guaranteeing more
644than it really is.
645Of course, the list of things that RCU does not guarantee is infinitely
646long, however, the following sections list a few non-guarantees that
647have caused confusion.
648Except where otherwise noted, these non-guarantees were premeditated.
649
650<ol>
651<li> <a href="#Readers Impose Minimal Ordering">
652 Readers Impose Minimal Ordering</a>
653<li> <a href="#Readers Do Not Exclude Updaters">
654 Readers Do Not Exclude Updaters</a>
655<li> <a href="#Updaters Only Wait For Old Readers">
656 Updaters Only Wait For Old Readers</a>
657<li> <a href="#Grace Periods Don't Partition Read-Side Critical Sections">
658 Grace Periods Don't Partition Read-Side Critical Sections</a>
659<li> <a href="#Read-Side Critical Sections Don't Partition Grace Periods">
660 Read-Side Critical Sections Don't Partition Grace Periods</a>
661<li> <a href="#Disabling Preemption Does Not Block Grace Periods">
662 Disabling Preemption Does Not Block Grace Periods</a>
663</ol>
664
665<h3><a name="Readers Impose Minimal Ordering">Readers Impose Minimal Ordering</a></h3>
666
667<p>
668Reader-side markers such as <tt>rcu_read_lock()</tt> and
669<tt>rcu_read_unlock()</tt> provide absolutely no ordering guarantees
670except through their interaction with the grace-period APIs such as
671<tt>synchronize_rcu()</tt>.
672To see this, consider the following pair of threads:
673
674<blockquote>
675<pre>
676 1 void thread0(void)
677 2 {
678 3 rcu_read_lock();
679 4 WRITE_ONCE(x, 1);
680 5 rcu_read_unlock();
681 6 rcu_read_lock();
682 7 WRITE_ONCE(y, 1);
683 8 rcu_read_unlock();
684 9 }
68510
68611 void thread1(void)
68712 {
68813 rcu_read_lock();
68914 r1 = READ_ONCE(y);
69015 rcu_read_unlock();
69116 rcu_read_lock();
69217 r2 = READ_ONCE(x);
69318 rcu_read_unlock();
69419 }
695</pre>
696</blockquote>
697
698<p>
699After <tt>thread0()</tt> and <tt>thread1()</tt> execute
700concurrently, it is quite possible to have
701
702<blockquote>
703<pre>
704(r1 == 1 &amp;&amp; r2 == 0)
705</pre>
706</blockquote>
707
708(that is, <tt>y</tt> appears to have been assigned before <tt>x</tt>),
709which would not be possible if <tt>rcu_read_lock()</tt> and
710<tt>rcu_read_unlock()</tt> had much in the way of ordering
711properties.
712But they do not, so the CPU is within its rights
713to do significant reordering.
714This is by design: Any significant ordering constraints would slow down
715these fast-path APIs.
716
717<p><a name="Quick Quiz 8"><b>Quick Quiz 8</b>:</a>
718Can't the compiler also reorder this code?
719<br><a href="#qq8answer">Answer</a>
720
721<h3><a name="Readers Do Not Exclude Updaters">Readers Do Not Exclude Updaters</a></h3>
722
723<p>
724Neither <tt>rcu_read_lock()</tt> nor <tt>rcu_read_unlock()</tt>
725exclude updates.
726All they do is to prevent grace periods from ending.
727The following example illustrates this:
728
729<blockquote>
730<pre>
731 1 void thread0(void)
732 2 {
733 3 rcu_read_lock();
734 4 r1 = READ_ONCE(y);
735 5 if (r1) {
736 6 do_something_with_nonzero_x();
737 7 r2 = READ_ONCE(x);
738 8 WARN_ON(!r2); /* BUG!!! */
739 9 }
74010 rcu_read_unlock();
74111 }
74212
74313 void thread1(void)
74414 {
74515 spin_lock(&amp;my_lock);
74616 WRITE_ONCE(x, 1);
74717 WRITE_ONCE(y, 1);
74818 spin_unlock(&amp;my_lock);
74919 }
750</pre>
751</blockquote>
752
753<p>
754If the <tt>thread0()</tt> function's <tt>rcu_read_lock()</tt>
755excluded the <tt>thread1()</tt> function's update,
756the <tt>WARN_ON()</tt> could never fire.
757But the fact is that <tt>rcu_read_lock()</tt> does not exclude
758much of anything aside from subsequent grace periods, of which
759<tt>thread1()</tt> has none, so the
760<tt>WARN_ON()</tt> can and does fire.
761
762<h3><a name="Updaters Only Wait For Old Readers">Updaters Only Wait For Old Readers</a></h3>
763
764<p>
765It might be tempting to assume that after <tt>synchronize_rcu()</tt>
766completes, there are no readers executing.
767This temptation must be avoided because
768new readers can start immediately after <tt>synchronize_rcu()</tt>
769starts, and <tt>synchronize_rcu()</tt> is under no
770obligation to wait for these new readers.
771
772<p><a name="Quick Quiz 9"><b>Quick Quiz 9</b>:</a>
773Suppose that synchronize_rcu() did wait until all readers had completed.
774Would the updater be able to rely on this?
775<br><a href="#qq9answer">Answer</a>
776
777<h3><a name="Grace Periods Don't Partition Read-Side Critical Sections">
778Grace Periods Don't Partition Read-Side Critical Sections</a></h3>
779
780<p>
781It is tempting to assume that if any part of one RCU read-side critical
782section precedes a given grace period, and if any part of another RCU
783read-side critical section follows that same grace period, then all of
784the first RCU read-side critical section must precede all of the second.
785However, this just isn't the case: A single grace period does not
786partition the set of RCU read-side critical sections.
787An example of this situation can be illustrated as follows, where
788<tt>x</tt>, <tt>y</tt>, and <tt>z</tt> are initially all zero:
789
790<blockquote>
791<pre>
792 1 void thread0(void)
793 2 {
794 3 rcu_read_lock();
795 4 WRITE_ONCE(a, 1);
796 5 WRITE_ONCE(b, 1);
797 6 rcu_read_unlock();
798 7 }
799 8
800 9 void thread1(void)
80110 {
80211 r1 = READ_ONCE(a);
80312 synchronize_rcu();
80413 WRITE_ONCE(c, 1);
80514 }
80615
80716 void thread2(void)
80817 {
80918 rcu_read_lock();
81019 r2 = READ_ONCE(b);
81120 r3 = READ_ONCE(c);
81221 rcu_read_unlock();
81322 }
814</pre>
815</blockquote>
816
817<p>
818It turns out that the outcome:
819
820<blockquote>
821<pre>
822(r1 == 1 &amp;&amp; r2 == 0 &amp;&amp; r3 == 1)
823</pre>
824</blockquote>
825
826is entirely possible.
827The following figure show how this can happen, with each circled
828<tt>QS</tt> indicating the point at which RCU recorded a
829<i>quiescent state</i> for each thread, that is, a state in which
830RCU knows that the thread cannot be in the midst of an RCU read-side
831critical section that started before the current grace period:
832
833<p><img src="GPpartitionReaders1.svg" alt="GPpartitionReaders1.svg" width="60%"></p>
834
835<p>
836If it is necessary to partition RCU read-side critical sections in this
837manner, it is necessary to use two grace periods, where the first
838grace period is known to end before the second grace period starts:
839
840<blockquote>
841<pre>
842 1 void thread0(void)
843 2 {
844 3 rcu_read_lock();
845 4 WRITE_ONCE(a, 1);
846 5 WRITE_ONCE(b, 1);
847 6 rcu_read_unlock();
848 7 }
849 8
850 9 void thread1(void)
85110 {
85211 r1 = READ_ONCE(a);
85312 synchronize_rcu();
85413 WRITE_ONCE(c, 1);
85514 }
85615
85716 void thread2(void)
85817 {
85918 r2 = READ_ONCE(c);
86019 synchronize_rcu();
86120 WRITE_ONCE(d, 1);
86221 }
86322
86423 void thread3(void)
86524 {
86625 rcu_read_lock();
86726 r3 = READ_ONCE(b);
86827 r4 = READ_ONCE(d);
86928 rcu_read_unlock();
87029 }
871</pre>
872</blockquote>
873
874<p>
875Here, if <tt>(r1 == 1)</tt>, then
876<tt>thread0()</tt>'s write to <tt>b</tt> must happen
877before the end of <tt>thread1()</tt>'s grace period.
878If in addition <tt>(r4 == 1)</tt>, then
879<tt>thread3()</tt>'s read from <tt>b</tt> must happen
880after the beginning of <tt>thread2()</tt>'s grace period.
881If it is also the case that <tt>(r2 == 1)</tt>, then the
882end of <tt>thread1()</tt>'s grace period must precede the
883beginning of <tt>thread2()</tt>'s grace period.
884This mean that the two RCU read-side critical sections cannot overlap,
885guaranteeing that <tt>(r3 == 1)</tt>.
886As a result, the outcome:
887
888<blockquote>
889<pre>
890(r1 == 1 &amp;&amp; r2 == 1 &amp;&amp; r3 == 0 &amp;&amp; r4 == 1)
891</pre>
892</blockquote>
893
894cannot happen.
895
896<p>
897This non-requirement was also non-premeditated, but became apparent
898when studying RCU's interaction with memory ordering.
899
900<h3><a name="Read-Side Critical Sections Don't Partition Grace Periods">
901Read-Side Critical Sections Don't Partition Grace Periods</a></h3>
902
903<p>
904It is also tempting to assume that if an RCU read-side critical section
905happens between a pair of grace periods, then those grace periods cannot
906overlap.
907However, this temptation leads nowhere good, as can be illustrated by
908the following, with all variables initially zero:
909
910<blockquote>
911<pre>
912 1 void thread0(void)
913 2 {
914 3 rcu_read_lock();
915 4 WRITE_ONCE(a, 1);
916 5 WRITE_ONCE(b, 1);
917 6 rcu_read_unlock();
918 7 }
919 8
920 9 void thread1(void)
92110 {
92211 r1 = READ_ONCE(a);
92312 synchronize_rcu();
92413 WRITE_ONCE(c, 1);
92514 }
92615
92716 void thread2(void)
92817 {
92918 rcu_read_lock();
93019 WRITE_ONCE(d, 1);
93120 r2 = READ_ONCE(c);
93221 rcu_read_unlock();
93322 }
93423
93524 void thread3(void)
93625 {
93726 r3 = READ_ONCE(d);
93827 synchronize_rcu();
93928 WRITE_ONCE(e, 1);
94029 }
94130
94231 void thread4(void)
94332 {
94433 rcu_read_lock();
94534 r4 = READ_ONCE(b);
94635 r5 = READ_ONCE(e);
94736 rcu_read_unlock();
94837 }
949</pre>
950</blockquote>
951
952<p>
953In this case, the outcome:
954
955<blockquote>
956<pre>
957(r1 == 1 &amp;&amp; r2 == 1 &amp;&amp; r3 == 1 &amp;&amp; r4 == 0 &amp&amp; r5 == 1)
958</pre>
959</blockquote>
960
961is entirely possible, as illustrated below:
962
963<p><img src="ReadersPartitionGP1.svg" alt="ReadersPartitionGP1.svg" width="100%"></p>
964
965<p>
966Again, an RCU read-side critical section can overlap almost all of a
967given grace period, just so long as it does not overlap the entire
968grace period.
969As a result, an RCU read-side critical section cannot partition a pair
970of RCU grace periods.
971
972<p><a name="Quick Quiz 10"><b>Quick Quiz 10</b>:</a>
973How long a sequence of grace periods, each separated by an RCU read-side
974critical section, would be required to partition the RCU read-side
975critical sections at the beginning and end of the chain?
976<br><a href="#qq10answer">Answer</a>
977
978<h3><a name="Disabling Preemption Does Not Block Grace Periods">
979Disabling Preemption Does Not Block Grace Periods</a></h3>
980
981<p>
982There was a time when disabling preemption on any given CPU would block
983subsequent grace periods.
984However, this was an accident of implementation and is not a requirement.
985And in the current Linux-kernel implementation, disabling preemption
986on a given CPU in fact does not block grace periods, as Oleg Nesterov
987<a href="https://lkml.kernel.org/g/20150614193825.GA19582@redhat.com">demonstrated</a>.
988
989<p>
990If you need a preempt-disable region to block grace periods, you need to add
991<tt>rcu_read_lock()</tt> and <tt>rcu_read_unlock()</tt>, for example
992as follows:
993
994<blockquote>
995<pre>
996 1 preempt_disable();
997 2 rcu_read_lock();
998 3 do_something();
999 4 rcu_read_unlock();
1000 5 preempt_enable();
1001 6
1002 7 /* Spinlocks implicitly disable preemption. */
1003 8 spin_lock(&amp;mylock);
1004 9 rcu_read_lock();
100510 do_something();
100611 rcu_read_unlock();
100712 spin_unlock(&amp;mylock);
1008</pre>
1009</blockquote>
1010
1011<p>
1012In theory, you could enter the RCU read-side critical section first,
1013but it is more efficient to keep the entire RCU read-side critical
1014section contained in the preempt-disable region as shown above.
1015Of course, RCU read-side critical sections that extend outside of
1016preempt-disable regions will work correctly, but such critical sections
1017can be preempted, which forces <tt>rcu_read_unlock()</tt> to do
1018more work.
1019And no, this is <i>not</i> an invitation to enclose all of your RCU
1020read-side critical sections within preempt-disable regions, because
1021doing so would degrade real-time response.
1022
1023<p>
1024This non-requirement appeared with preemptible RCU.
1025If you need a grace period that waits on non-preemptible code regions, use
1026<a href="#Sched Flavor">RCU-sched</a>.
1027
1028<h2><a name="Parallelism Facts of Life">Parallelism Facts of Life</a></h2>
1029
1030<p>
1031These parallelism facts of life are by no means specific to RCU, but
1032the RCU implementation must abide by them.
1033They therefore bear repeating:
1034
1035<ol>
1036<li> Any CPU or task may be delayed at any time,
1037 and any attempts to avoid these delays by disabling
1038 preemption, interrupts, or whatever are completely futile.
1039 This is most obvious in preemptible user-level
1040 environments and in virtualized environments (where
1041 a given guest OS's VCPUs can be preempted at any time by
1042 the underlying hypervisor), but can also happen in bare-metal
1043 environments due to ECC errors, NMIs, and other hardware
1044 events.
1045 Although a delay of more than about 20 seconds can result
1046 in splats, the RCU implementation is obligated to use
1047 algorithms that can tolerate extremely long delays, but where
1048 &ldquo;extremely long&rdquo; is not long enough to allow
1049 wrap-around when incrementing a 64-bit counter.
1050<li> Both the compiler and the CPU can reorder memory accesses.
1051 Where it matters, RCU must use compiler directives and
1052 memory-barrier instructions to preserve ordering.
1053<li> Conflicting writes to memory locations in any given cache line
1054 will result in expensive cache misses.
1055 Greater numbers of concurrent writes and more-frequent
1056 concurrent writes will result in more dramatic slowdowns.
1057 RCU is therefore obligated to use algorithms that have
1058 sufficient locality to avoid significant performance and
1059 scalability problems.
1060<li> As a rough rule of thumb, only one CPU's worth of processing
1061 may be carried out under the protection of any given exclusive
1062 lock.
1063 RCU must therefore use scalable locking designs.
1064<li> Counters are finite, especially on 32-bit systems.
1065 RCU's use of counters must therefore tolerate counter wrap,
1066 or be designed such that counter wrap would take way more
1067 time than a single system is likely to run.
1068 An uptime of ten years is quite possible, a runtime
1069 of a century much less so.
1070 As an example of the latter, RCU's dyntick-idle nesting counter
1071 allows 54 bits for interrupt nesting level (this counter
1072 is 64 bits even on a 32-bit system).
1073 Overflowing this counter requires 2<sup>54</sup>
1074 half-interrupts on a given CPU without that CPU ever going idle.
1075 If a half-interrupt happened every microsecond, it would take
1076 570 years of runtime to overflow this counter, which is currently
1077 believed to be an acceptably long time.
1078<li> Linux systems can have thousands of CPUs running a single
1079 Linux kernel in a single shared-memory environment.
1080 RCU must therefore pay close attention to high-end scalability.
1081</ol>
1082
1083<p>
1084This last parallelism fact of life means that RCU must pay special
1085attention to the preceding facts of life.
1086The idea that Linux might scale to systems with thousands of CPUs would
1087have been met with some skepticism in the 1990s, but these requirements
1088would have otherwise have been unsurprising, even in the early 1990s.
1089
1090<h2><a name="Quality-of-Implementation Requirements">Quality-of-Implementation Requirements</a></h2>
1091
1092<p>
1093These sections list quality-of-implementation requirements.
1094Although an RCU implementation that ignores these requirements could
1095still be used, it would likely be subject to limitations that would
1096make it inappropriate for industrial-strength production use.
1097Classes of quality-of-implementation requirements are as follows:
1098
1099<ol>
1100<li> <a href="#Specialization">Specialization</a>
1101<li> <a href="#Performance and Scalability">Performance and Scalability</a>
1102<li> <a href="#Composability">Composability</a>
1103<li> <a href="#Corner Cases">Corner Cases</a>
1104</ol>
1105
1106<p>
1107These classes is covered in the following sections.
1108
1109<h3><a name="Specialization">Specialization</a></h3>
1110
1111<p>
1112RCU is and always has been intended primarily for read-mostly situations, as
1113illustrated by the following figure.
1114This means that RCU's read-side primitives are optimized, often at the
1115expense of its update-side primitives.
1116
1117<p><img src="RCUApplicability.svg" alt="RCUApplicability.svg" width="70%"></p>
1118
1119<p>
1120This focus on read-mostly situations means that RCU must interoperate
1121with other synchronization primitives.
1122For example, the <tt>add_gp()</tt> and <tt>remove_gp_synchronous()</tt>
1123examples discussed earlier use RCU to protect readers and locking to
1124coordinate updaters.
1125However, the need extends much farther, requiring that a variety of
1126synchronization primitives be legal within RCU read-side critical sections,
1127including spinlocks, sequence locks, atomic operations, reference
1128counters, and memory barriers.
1129
1130<p><a name="Quick Quiz 11"><b>Quick Quiz 11</b>:</a>
1131What about sleeping locks?
1132<br><a href="#qq11answer">Answer</a>
1133
1134<p>
1135It often comes as a surprise that many algorithms do not require a
1136consistent view of data, but many can function in that mode,
1137with network routing being the poster child.
1138Internet routing algorithms take significant time to propagate
1139updates, so that by the time an update arrives at a given system,
1140that system has been sending network traffic the wrong way for
1141a considerable length of time.
1142Having a few threads continue to send traffic the wrong way for a
1143few more milliseconds is clearly not a problem: In the worst case,
1144TCP retransmissions will eventually get the data where it needs to go.
1145In general, when tracking the state of the universe outside of the
1146computer, some level of inconsistency must be tolerated due to
1147speed-of-light delays if nothing else.
1148
1149<p>
1150Furthermore, uncertainty about external state is inherent in many cases.
1151For example, a pair of veternarians might use heartbeat to determine
1152whether or not a given cat was alive.
1153But how long should they wait after the last heartbeat to decide that
1154the cat is in fact dead?
1155Waiting less than 400 milliseconds makes no sense because this would
1156mean that a relaxed cat would be considered to cycle between death
1157and life more than 100 times per minute.
1158Moreover, just as with human beings, a cat's heart might stop for
1159some period of time, so the exact wait period is a judgment call.
1160One of our pair of veternarians might wait 30 seconds before pronouncing
1161the cat dead, while the other might insist on waiting a full minute.
1162The two veternarians would then disagree on the state of the cat during
1163the final 30 seconds of the minute following the last heartbeat, as
1164fancifully illustrated below:
1165
1166<p><img src="2013-08-is-it-dead.png" alt="2013-08-is-it-dead.png" width="431"></p>
1167
1168<p>
1169Interestingly enough, this same situation applies to hardware.
1170When push comes to shove, how do we tell whether or not some
1171external server has failed?
1172We send messages to it periodically, and declare it failed if we
1173don't receive a response within a given period of time.
1174Policy decisions can usually tolerate short
1175periods of inconsistency.
1176The policy was decided some time ago, and is only now being put into
1177effect, so a few milliseconds of delay is normally inconsequential.
1178
1179<p>
1180However, there are algorithms that absolutely must see consistent data.
1181For example, the translation between a user-level SystemV semaphore
1182ID to the corresponding in-kernel data structure is protected by RCU,
1183but it is absolutely forbidden to update a semaphore that has just been
1184removed.
1185In the Linux kernel, this need for consistency is accommodated by acquiring
1186spinlocks located in the in-kernel data structure from within
1187the RCU read-side critical section, and this is indicated by the
1188green box in the figure above.
1189Many other techniques may be used, and are in fact used within the
1190Linux kernel.
1191
1192<p>
1193In short, RCU is not required to maintain consistency, and other
1194mechanisms may be used in concert with RCU when consistency is required.
1195RCU's specialization allows it to do its job extremely well, and its
1196ability to interoperate with other synchronization mechanisms allows
1197the right mix of synchronization tools to be used for a given job.
1198
1199<h3><a name="Performance and Scalability">Performance and Scalability</a></h3>
1200
1201<p>
1202Energy efficiency is a critical component of performance today,
1203and Linux-kernel RCU implementations must therefore avoid unnecessarily
1204awakening idle CPUs.
1205I cannot claim that this requirement was premeditated.
1206In fact, I learned of it during a telephone conversation in which I
1207was given &ldquo;frank and open&rdquo; feedback on the importance
1208of energy efficiency in battery-powered systems and on specific
1209energy-efficiency shortcomings of the Linux-kernel RCU implementation.
1210In my experience, the battery-powered embedded community will consider
1211any unnecessary wakeups to be extremely unfriendly acts.
1212So much so that mere Linux-kernel-mailing-list posts are
1213insufficient to vent their ire.
1214
1215<p>
1216Memory consumption is not particularly important for in most
1217situations, and has become decreasingly
1218so as memory sizes have expanded and memory
1219costs have plummeted.
1220However, as I learned from Matt Mackall's
1221<a href="http://elinux.org/Linux_Tiny-FAQ">bloatwatch</a>
1222efforts, memory footprint is critically important on single-CPU systems with
1223non-preemptible (<tt>CONFIG_PREEMPT=n</tt>) kernels, and thus
1224<a href="https://lkml.kernel.org/g/20090113221724.GA15307@linux.vnet.ibm.com">tiny RCU</a>
1225was born.
1226Josh Triplett has since taken over the small-memory banner with his
1227<a href="https://tiny.wiki.kernel.org/">Linux kernel tinification</a>
1228project, which resulted in
1229<a href="#Sleepable RCU">SRCU</a>
1230becoming optional for those kernels not needing it.
1231
1232<p>
1233The remaining performance requirements are, for the most part,
1234unsurprising.
1235For example, in keeping with RCU's read-side specialization,
1236<tt>rcu_dereference()</tt> should have negligible overhead (for
1237example, suppression of a few minor compiler optimizations).
1238Similarly, in non-preemptible environments, <tt>rcu_read_lock()</tt> and
1239<tt>rcu_read_unlock()</tt> should have exactly zero overhead.
1240
1241<p>
1242In preemptible environments, in the case where the RCU read-side
1243critical section was not preempted (as will be the case for the
1244highest-priority real-time process), <tt>rcu_read_lock()</tt> and
1245<tt>rcu_read_unlock()</tt> should have minimal overhead.
1246In particular, they should not contain atomic read-modify-write
1247operations, memory-barrier instructions, preemption disabling,
1248interrupt disabling, or backwards branches.
1249However, in the case where the RCU read-side critical section was preempted,
1250<tt>rcu_read_unlock()</tt> may acquire spinlocks and disable interrupts.
1251This is why it is better to nest an RCU read-side critical section
1252within a preempt-disable region than vice versa, at least in cases
1253where that critical section is short enough to avoid unduly degrading
1254real-time latencies.
1255
1256<p>
1257The <tt>synchronize_rcu()</tt> grace-period-wait primitive is
1258optimized for throughput.
1259It may therefore incur several milliseconds of latency in addition to
1260the duration of the longest RCU read-side critical section.
1261On the other hand, multiple concurrent invocations of
1262<tt>synchronize_rcu()</tt> are required to use batching optimizations
1263so that they can be satisfied by a single underlying grace-period-wait
1264operation.
1265For example, in the Linux kernel, it is not unusual for a single
1266grace-period-wait operation to serve more than
1267<a href="https://www.usenix.org/conference/2004-usenix-annual-technical-conference/making-rcu-safe-deep-sub-millisecond-response">1,000 separate invocations</a>
1268of <tt>synchronize_rcu()</tt>, thus amortizing the per-invocation
1269overhead down to nearly zero.
1270However, the grace-period optimization is also required to avoid
1271measurable degradation of real-time scheduling and interrupt latencies.
1272
1273<p>
1274In some cases, the multi-millisecond <tt>synchronize_rcu()</tt>
1275latencies are unacceptable.
1276In these cases, <tt>synchronize_rcu_expedited()</tt> may be used
1277instead, reducing the grace-period latency down to a few tens of
1278microseconds on small systems, at least in cases where the RCU read-side
1279critical sections are short.
1280There are currently no special latency requirements for
1281<tt>synchronize_rcu_expedited()</tt> on large systems, but,
1282consistent with the empirical nature of the RCU specification,
1283that is subject to change.
1284However, there most definitely are scalability requirements:
1285A storm of <tt>synchronize_rcu_expedited()</tt> invocations on 4096
1286CPUs should at least make reasonable forward progress.
1287In return for its shorter latencies, <tt>synchronize_rcu_expedited()</tt>
1288is permitted to impose modest degradation of real-time latency
1289on non-idle online CPUs.
1290That said, it will likely be necessary to take further steps to reduce this
1291degradation, hopefully to roughly that of a scheduling-clock interrupt.
1292
1293<p>
1294There are a number of situations where even
1295<tt>synchronize_rcu_expedited()</tt>'s reduced grace-period
1296latency is unacceptable.
1297In these situations, the asynchronous <tt>call_rcu()</tt> can be
1298used in place of <tt>synchronize_rcu()</tt> as follows:
1299
1300<blockquote>
1301<pre>
1302 1 struct foo {
1303 2 int a;
1304 3 int b;
1305 4 struct rcu_head rh;
1306 5 };
1307 6
1308 7 static void remove_gp_cb(struct rcu_head *rhp)
1309 8 {
1310 9 struct foo *p = container_of(rhp, struct foo, rh);
131110
131211 kfree(p);
131312 }
131413
131514 bool remove_gp_asynchronous(void)
131615 {
131716 struct foo *p;
131817
131918 spin_lock(&amp;gp_lock);
132019 p = rcu_dereference(gp);
132120 if (!p) {
132221 spin_unlock(&amp;gp_lock);
132322 return false;
132423 }
132524 rcu_assign_pointer(gp, NULL);
132625 call_rcu(&amp;p-&gt;rh, remove_gp_cb);
132726 spin_unlock(&amp;gp_lock);
132827 return true;
132928 }
1330</pre>
1331</blockquote>
1332
1333<p>
1334A definition of <tt>struct foo</tt> is finally needed, and appears
1335on lines&nbsp;1-5.
1336The function <tt>remove_gp_cb()</tt> is passed to <tt>call_rcu()</tt>
1337on line&nbsp;25, and will be invoked after the end of a subsequent
1338grace period.
1339This gets the same effect as <tt>remove_gp_synchronous()</tt>,
1340but without forcing the updater to wait for a grace period to elapse.
1341The <tt>call_rcu()</tt> function may be used in a number of
1342situations where neither <tt>synchronize_rcu()</tt> nor
1343<tt>synchronize_rcu_expedited()</tt> would be legal,
1344including within preempt-disable code, <tt>local_bh_disable()</tt> code,
1345interrupt-disable code, and interrupt handlers.
1346However, even <tt>call_rcu()</tt> is illegal within NMI handlers.
1347The callback function (<tt>remove_gp_cb()</tt> in this case) will be
1348executed within softirq (software interrupt) environment within the
1349Linux kernel,
1350either within a real softirq handler or under the protection
1351of <tt>local_bh_disable()</tt>.
1352In both the Linux kernel and in userspace, it is bad practice to
1353write an RCU callback function that takes too long.
1354Long-running operations should be relegated to separate threads or
1355(in the Linux kernel) workqueues.
1356
1357<p><a name="Quick Quiz 12"><b>Quick Quiz 12</b>:</a>
1358Why does line&nbsp;19 use <tt>rcu_access_pointer()</tt>?
1359After all, <tt>call_rcu()</tt> on line&nbsp;25 stores into the
1360structure, which would interact badly with concurrent insertions.
1361Doesn't this mean that <tt>rcu_dereference()</tt> is required?
1362<br><a href="#qq12answer">Answer</a>
1363
1364<p>
1365However, all that <tt>remove_gp_cb()</tt> is doing is
1366invoking <tt>kfree()</tt> on the data element.
1367This is a common idiom, and is supported by <tt>kfree_rcu()</tt>,
1368which allows &ldquo;fire and forget&rdquo; operation as shown below:
1369
1370<blockquote>
1371<pre>
1372 1 struct foo {
1373 2 int a;
1374 3 int b;
1375 4 struct rcu_head rh;
1376 5 };
1377 6
1378 7 bool remove_gp_faf(void)
1379 8 {
1380 9 struct foo *p;
138110
138211 spin_lock(&amp;gp_lock);
138312 p = rcu_dereference(gp);
138413 if (!p) {
138514 spin_unlock(&amp;gp_lock);
138615 return false;
138716 }
138817 rcu_assign_pointer(gp, NULL);
138918 kfree_rcu(p, rh);
139019 spin_unlock(&amp;gp_lock);
139120 return true;
139221 }
1393</pre>
1394</blockquote>
1395
1396<p>
1397Note that <tt>remove_gp_faf()</tt> simply invokes
1398<tt>kfree_rcu()</tt> and proceeds, without any need to pay any
1399further attention to the subsequent grace period and <tt>kfree()</tt>.
1400It is permissible to invoke <tt>kfree_rcu()</tt> from the same
1401environments as for <tt>call_rcu()</tt>.
1402Interestingly enough, DYNIX/ptx had the equivalents of
1403<tt>call_rcu()</tt> and <tt>kfree_rcu()</tt>, but not
1404<tt>synchronize_rcu()</tt>.
1405This was due to the fact that RCU was not heavily used within DYNIX/ptx,
1406so the very few places that needed something like
1407<tt>synchronize_rcu()</tt> simply open-coded it.
1408
1409<p><a name="Quick Quiz 13"><b>Quick Quiz 13</b>:</a>
1410Earlier it was claimed that <tt>call_rcu()</tt> and
1411<tt>kfree_rcu()</tt> allowed updaters to avoid being blocked
1412by readers.
1413But how can that be correct, given that the invocation of the callback
1414and the freeing of the memory (respectively) must still wait for
1415a grace period to elapse?
1416<br><a href="#qq13answer">Answer</a>
1417
1418<p>
1419But what if the updater must wait for the completion of code to be
1420executed after the end of the grace period, but has other tasks
1421that can be carried out in the meantime?
1422The polling-style <tt>get_state_synchronize_rcu()</tt> and
1423<tt>cond_synchronize_rcu()</tt> functions may be used for this
1424purpose, as shown below:
1425
1426<blockquote>
1427<pre>
1428 1 bool remove_gp_poll(void)
1429 2 {
1430 3 struct foo *p;
1431 4 unsigned long s;
1432 5
1433 6 spin_lock(&amp;gp_lock);
1434 7 p = rcu_access_pointer(gp);
1435 8 if (!p) {
1436 9 spin_unlock(&amp;gp_lock);
143710 return false;
143811 }
143912 rcu_assign_pointer(gp, NULL);
144013 spin_unlock(&amp;gp_lock);
144114 s = get_state_synchronize_rcu();
144215 do_something_while_waiting();
144316 cond_synchronize_rcu(s);
144417 kfree(p);
144518 return true;
144619 }
1447</pre>
1448</blockquote>
1449
1450<p>
1451On line&nbsp;14, <tt>get_state_synchronize_rcu()</tt> obtains a
1452&ldquo;cookie&rdquo; from RCU,
1453then line&nbsp;15 carries out other tasks,
1454and finally, line&nbsp;16 returns immediately if a grace period has
1455elapsed in the meantime, but otherwise waits as required.
1456The need for <tt>get_state_synchronize_rcu</tt> and
1457<tt>cond_synchronize_rcu()</tt> has appeared quite recently,
1458so it is too early to tell whether they will stand the test of time.
1459
1460<p>
1461RCU thus provides a range of tools to allow updaters to strike the
1462required tradeoff between latency, flexibility and CPU overhead.
1463
1464<h3><a name="Composability">Composability</a></h3>
1465
1466<p>
1467Composability has received much attention in recent years, perhaps in part
1468due to the collision of multicore hardware with object-oriented techniques
1469designed in single-threaded environments for single-threaded use.
1470And in theory, RCU read-side critical sections may be composed, and in
1471fact may be nested arbitrarily deeply.
1472In practice, as with all real-world implementations of composable
1473constructs, there are limitations.
1474
1475<p>
1476Implementations of RCU for which <tt>rcu_read_lock()</tt>
1477and <tt>rcu_read_unlock()</tt> generate no code, such as
1478Linux-kernel RCU when <tt>CONFIG_PREEMPT=n</tt>, can be
1479nested arbitrarily deeply.
1480After all, there is no overhead.
1481Except that if all these instances of <tt>rcu_read_lock()</tt>
1482and <tt>rcu_read_unlock()</tt> are visible to the compiler,
1483compilation will eventually fail due to exhausting memory,
1484mass storage, or user patience, whichever comes first.
1485If the nesting is not visible to the compiler, as is the case with
1486mutually recursive functions each in its own translation unit,
1487stack overflow will result.
1488If the nesting takes the form of loops, either the control variable
1489will overflow or (in the Linux kernel) you will get an RCU CPU stall warning.
1490Nevertheless, this class of RCU implementations is one
1491of the most composable constructs in existence.
1492
1493<p>
1494RCU implementations that explicitly track nesting depth
1495are limited by the nesting-depth counter.
1496For example, the Linux kernel's preemptible RCU limits nesting to
1497<tt>INT_MAX</tt>.
1498This should suffice for almost all practical purposes.
1499That said, a consecutive pair of RCU read-side critical sections
1500between which there is an operation that waits for a grace period
1501cannot be enclosed in another RCU read-side critical section.
1502This is because it is not legal to wait for a grace period within
1503an RCU read-side critical section: To do so would result either
1504in deadlock or
1505in RCU implicitly splitting the enclosing RCU read-side critical
1506section, neither of which is conducive to a long-lived and prosperous
1507kernel.
1508
1509<p>
1510It is worth noting that RCU is not alone in limiting composability.
1511For example, many transactional-memory implementations prohibit
1512composing a pair of transactions separated by an irrevocable
1513operation (for example, a network receive operation).
1514For another example, lock-based critical sections can be composed
1515surprisingly freely, but only if deadlock is avoided.
1516
1517<p>
1518In short, although RCU read-side critical sections are highly composable,
1519care is required in some situations, just as is the case for any other
1520composable synchronization mechanism.
1521
1522<h3><a name="Corner Cases">Corner Cases</a></h3>
1523
1524<p>
1525A given RCU workload might have an endless and intense stream of
1526RCU read-side critical sections, perhaps even so intense that there
1527was never a point in time during which there was not at least one
1528RCU read-side critical section in flight.
1529RCU cannot allow this situation to block grace periods: As long as
1530all the RCU read-side critical sections are finite, grace periods
1531must also be finite.
1532
1533<p>
1534That said, preemptible RCU implementations could potentially result
1535in RCU read-side critical sections being preempted for long durations,
1536which has the effect of creating a long-duration RCU read-side
1537critical section.
1538This situation can arise only in heavily loaded systems, but systems using
1539real-time priorities are of course more vulnerable.
1540Therefore, RCU priority boosting is provided to help deal with this
1541case.
1542That said, the exact requirements on RCU priority boosting will likely
1543evolve as more experience accumulates.
1544
1545<p>
1546Other workloads might have very high update rates.
1547Although one can argue that such workloads should instead use
1548something other than RCU, the fact remains that RCU must
1549handle such workloads gracefully.
1550This requirement is another factor driving batching of grace periods,
1551but it is also the driving force behind the checks for large numbers
1552of queued RCU callbacks in the <tt>call_rcu()</tt> code path.
1553Finally, high update rates should not delay RCU read-side critical
1554sections, although some read-side delays can occur when using
1555<tt>synchronize_rcu_expedited()</tt>, courtesy of this function's use
1556of <tt>try_stop_cpus()</tt>.
1557(In the future, <tt>synchronize_rcu_expedited()</tt> will be
1558converted to use lighter-weight inter-processor interrupts (IPIs),
1559but this will still disturb readers, though to a much smaller degree.)
1560
1561<p>
1562Although all three of these corner cases were understood in the early
15631990s, a simple user-level test consisting of <tt>close(open(path))</tt>
1564in a tight loop
1565in the early 2000s suddenly provided a much deeper appreciation of the
1566high-update-rate corner case.
1567This test also motivated addition of some RCU code to react to high update
1568rates, for example, if a given CPU finds itself with more than 10,000
1569RCU callbacks queued, it will cause RCU to take evasive action by
1570more aggressively starting grace periods and more aggressively forcing
1571completion of grace-period processing.
1572This evasive action causes the grace period to complete more quickly,
1573but at the cost of restricting RCU's batching optimizations, thus
1574increasing the CPU overhead incurred by that grace period.
1575
1576<h2><a name="Software-Engineering Requirements">
1577Software-Engineering Requirements</a></h2>
1578
1579<p>
1580Between Murphy's Law and &ldquo;To err is human&rdquo;, it is necessary to
1581guard against mishaps and misuse:
1582
1583<ol>
1584<li> It is all too easy to forget to use <tt>rcu_read_lock()</tt>
1585 everywhere that it is needed, so kernels built with
1586 <tt>CONFIG_PROVE_RCU=y</tt> will spat if
1587 <tt>rcu_dereference()</tt> is used outside of an
1588 RCU read-side critical section.
1589 Update-side code can use <tt>rcu_dereference_protected()</tt>,
1590 which takes a
1591 <a href="https://lwn.net/Articles/371986/">lockdep expression</a>
1592 to indicate what is providing the protection.
1593 If the indicated protection is not provided, a lockdep splat
1594 is emitted.
1595
1596 <p>
1597 Code shared between readers and updaters can use
1598 <tt>rcu_dereference_check()</tt>, which also takes a
1599 lockdep expression, and emits a lockdep splat if neither
1600 <tt>rcu_read_lock()</tt> nor the indicated protection
1601 is in place.
1602 In addition, <tt>rcu_dereference_raw()</tt> is used in those
1603 (hopefully rare) cases where the required protection cannot
1604 be easily described.
1605 Finally, <tt>rcu_read_lock_held()</tt> is provided to
1606 allow a function to verify that it has been invoked within
1607 an RCU read-side critical section.
1608 I was made aware of this set of requirements shortly after Thomas
1609 Gleixner audited a number of RCU uses.
1610<li> A given function might wish to check for RCU-related preconditions
1611 upon entry, before using any other RCU API.
1612 The <tt>rcu_lockdep_assert()</tt> does this job,
1613 asserting the expression in kernels having lockdep enabled
1614 and doing nothing otherwise.
1615<li> It is also easy to forget to use <tt>rcu_assign_pointer()</tt>
1616 and <tt>rcu_dereference()</tt>, perhaps (incorrectly)
1617 substituting a simple assignment.
1618 To catch this sort of error, a given RCU-protected pointer may be
1619 tagged with <tt>__rcu</tt>, after which running sparse
1620 with <tt>CONFIG_SPARSE_RCU_POINTER=y</tt> will complain
1621 about simple-assignment accesses to that pointer.
1622 Arnd Bergmann made me aware of this requirement, and also
1623 supplied the needed
1624 <a href="https://lwn.net/Articles/376011/">patch series</a>.
1625<li> Kernels built with <tt>CONFIG_DEBUG_OBJECTS_RCU_HEAD=y</tt>
1626 will splat if a data element is passed to <tt>call_rcu()</tt>
1627 twice in a row, without a grace period in between.
1628 (This error is similar to a double free.)
1629 The corresponding <tt>rcu_head</tt> structures that are
1630 dynamically allocated are automatically tracked, but
1631 <tt>rcu_head</tt> structures allocated on the stack
1632 must be initialized with <tt>init_rcu_head_on_stack()</tt>
1633 and cleaned up with <tt>destroy_rcu_head_on_stack()</tt>.
1634 Similarly, statically allocated non-stack <tt>rcu_head</tt>
1635 structures must be initialized with <tt>init_rcu_head()</tt>
1636 and cleaned up with <tt>destroy_rcu_head()</tt>.
1637 Mathieu Desnoyers made me aware of this requirement, and also
1638 supplied the needed
1639 <a href="https://lkml.kernel.org/g/20100319013024.GA28456@Krystal">patch</a>.
1640<li> An infinite loop in an RCU read-side critical section will
1641 eventually trigger an RCU CPU stall warning splat, with
1642 the duration of &ldquo;eventually&rdquo; being controlled by the
1643 <tt>RCU_CPU_STALL_TIMEOUT</tt> <tt>Kconfig</tt> option, or,
1644 alternatively, by the
1645 <tt>rcupdate.rcu_cpu_stall_timeout</tt> boot/sysfs
1646 parameter.
1647 However, RCU is not obligated to produce this splat
1648 unless there is a grace period waiting on that particular
1649 RCU read-side critical section.
1650 <p>
1651 Some extreme workloads might intentionally delay
1652 RCU grace periods, and systems running those workloads can
1653 be booted with <tt>rcupdate.rcu_cpu_stall_suppress</tt>
1654 to suppress the splats.
1655 This kernel parameter may also be set via <tt>sysfs</tt>.
1656 Furthermore, RCU CPU stall warnings are counter-productive
1657 during sysrq dumps and during panics.
1658 RCU therefore supplies the <tt>rcu_sysrq_start()</tt> and
1659 <tt>rcu_sysrq_end()</tt> API members to be called before
1660 and after long sysrq dumps.
1661 RCU also supplies the <tt>rcu_panic()</tt> notifier that is
1662 automatically invoked at the beginning of a panic to suppress
1663 further RCU CPU stall warnings.
1664
1665 <p>
1666 This requirement made itself known in the early 1990s, pretty
1667 much the first time that it was necessary to debug a CPU stall.
1668 That said, the initial implementation in DYNIX/ptx was quite
1669 generic in comparison with that of Linux.
1670<li> Although it would be very good to detect pointers leaking out
1671 of RCU read-side critical sections, there is currently no
1672 good way of doing this.
1673 One complication is the need to distinguish between pointers
1674 leaking and pointers that have been handed off from RCU to
1675 some other synchronization mechanism, for example, reference
1676 counting.
1677<li> In kernels built with <tt>CONFIG_RCU_TRACE=y</tt>, RCU-related
1678 information is provided via both debugfs and event tracing.
1679<li> Open-coded use of <tt>rcu_assign_pointer()</tt> and
1680 <tt>rcu_dereference()</tt> to create typical linked
1681 data structures can be surprisingly error-prone.
1682 Therefore, RCU-protected
1683 <a href="https://lwn.net/Articles/609973/#RCU List APIs">linked lists</a>
1684 and, more recently, RCU-protected
1685 <a href="https://lwn.net/Articles/612100/">hash tables</a>
1686 are available.
1687 Many other special-purpose RCU-protected data structures are
1688 available in the Linux kernel and the userspace RCU library.
1689<li> Some linked structures are created at compile time, but still
1690 require <tt>__rcu</tt> checking.
1691 The <tt>RCU_POINTER_INITIALIZER()</tt> macro serves this
1692 purpose.
1693<li> It is not necessary to use <tt>rcu_assign_pointer()</tt>
1694 when creating linked structures that are to be published via
1695 a single external pointer.
1696 The <tt>RCU_INIT_POINTER()</tt> macro is provided for
1697 this task and also for assigning <tt>NULL</tt> pointers
1698 at runtime.
1699</ol>
1700
1701<p>
1702This not a hard-and-fast list: RCU's diagnostic capabilities will
1703continue to be guided by the number and type of usage bugs found
1704in real-world RCU usage.
1705
1706<h2><a name="Linux Kernel Complications">Linux Kernel Complications</a></h2>
1707
1708<p>
1709The Linux kernel provides an interesting environment for all kinds of
1710software, including RCU.
1711Some of the relevant points of interest are as follows:
1712
1713<ol>
1714<li> <a href="#Configuration">Configuration</a>.
1715<li> <a href="#Firmware Interface">Firmware Interface</a>.
1716<li> <a href="#Early Boot">Early Boot</a>.
1717<li> <a href="#Interrupts and NMIs">
1718 Interrupts and non-maskable interrupts (NMIs)</a>.
1719<li> <a href="#Loadable Modules">Loadable Modules</a>.
1720<li> <a href="#Hotplug CPU">Hotplug CPU</a>.
1721<li> <a href="#Scheduler and RCU">Scheduler and RCU</a>.
1722<li> <a href="#Tracing and RCU">Tracing and RCU</a>.
1723<li> <a href="#Energy Efficiency">Energy Efficiency</a>.
1724<li> <a href="#Memory Efficiency">Memory Efficiency</a>.
1725<li> <a href="#Performance, Scalability, Response Time, and Reliability">
1726 Performance, Scalability, Response Time, and Reliability</a>.
1727</ol>
1728
1729<p>
1730This list is probably incomplete, but it does give a feel for the
1731most notable Linux-kernel complications.
1732Each of the following sections covers one of the above topics.
1733
1734<h3><a name="Configuration">Configuration</a></h3>
1735
1736<p>
1737RCU's goal is automatic configuration, so that almost nobody
1738needs to worry about RCU's <tt>Kconfig</tt> options.
1739And for almost all users, RCU does in fact work well
1740&ldquo;out of the box.&rdquo;
1741
1742<p>
1743However, there are specialized use cases that are handled by
1744kernel boot parameters and <tt>Kconfig</tt> options.
1745Unfortunately, the <tt>Kconfig</tt> system will explicitly ask users
1746about new <tt>Kconfig</tt> options, which requires almost all of them
1747be hidden behind a <tt>CONFIG_RCU_EXPERT</tt> <tt>Kconfig</tt> option.
1748
1749<p>
1750This all should be quite obvious, but the fact remains that
1751Linus Torvalds recently had to
1752<a href="https://lkml.kernel.org/g/CA+55aFy4wcCwaL4okTs8wXhGZ5h-ibecy_Meg9C4MNQrUnwMcg@mail.gmail.com">remind</a>
1753me of this requirement.
1754
1755<h3><a name="Firmware Interface">Firmware Interface</a></h3>
1756
1757<p>
1758In many cases, kernel obtains information about the system from the
1759firmware, and sometimes things are lost in translation.
1760Or the translation is accurate, but the original message is bogus.
1761
1762<p>
1763For example, some systems' firmware overreports the number of CPUs,
1764sometimes by a large factor.
1765If RCU naively believed the firmware, as it used to do,
1766it would create too many per-CPU kthreads.
1767Although the resulting system will still run correctly, the extra
1768kthreads needlessly consume memory and can cause confusion
1769when they show up in <tt>ps</tt> listings.
1770
1771<p>
1772RCU must therefore wait for a given CPU to actually come online before
1773it can allow itself to believe that the CPU actually exists.
1774The resulting &ldquo;ghost CPUs&rdquo; (which are never going to
1775come online) cause a number of
1776<a href="https://paulmck.livejournal.com/37494.html">interesting complications</a>.
1777
1778<h3><a name="Early Boot">Early Boot</a></h3>
1779
1780<p>
1781The Linux kernel's boot sequence is an interesting process,
1782and RCU is used early, even before <tt>rcu_init()</tt>
1783is invoked.
1784In fact, a number of RCU's primitives can be used as soon as the
1785initial task's <tt>task_struct</tt> is available and the
1786boot CPU's per-CPU variables are set up.
1787The read-side primitives (<tt>rcu_read_lock()</tt>,
1788<tt>rcu_read_unlock()</tt>, <tt>rcu_dereference()</tt>,
1789and <tt>rcu_access_pointer()</tt>) will operate normally very early on,
1790as will <tt>rcu_assign_pointer()</tt>.
1791
1792<p>
1793Although <tt>call_rcu()</tt> may be invoked at any
1794time during boot, callbacks are not guaranteed to be invoked until after
1795the scheduler is fully up and running.
1796This delay in callback invocation is due to the fact that RCU does not
1797invoke callbacks until it is fully initialized, and this full initialization
1798cannot occur until after the scheduler has initialized itself to the
1799point where RCU can spawn and run its kthreads.
1800In theory, it would be possible to invoke callbacks earlier,
1801however, this is not a panacea because there would be severe restrictions
1802on what operations those callbacks could invoke.
1803
1804<p>
1805Perhaps surprisingly, <tt>synchronize_rcu()</tt>,
1806<a href="#Bottom-Half Flavor"><tt>synchronize_rcu_bh()</tt></a>
1807(<a href="#Bottom-Half Flavor">discussed below</a>),
1808and
1809<a href="#Sched Flavor"><tt>synchronize_sched()</tt></a>
1810will all operate normally
1811during very early boot, the reason being that there is only one CPU
1812and preemption is disabled.
1813This means that the call <tt>synchronize_rcu()</tt> (or friends)
1814itself is a quiescent
1815state and thus a grace period, so the early-boot implementation can
1816be a no-op.
1817
1818<p>
1819Both <tt>synchronize_rcu_bh()</tt> and <tt>synchronize_sched()</tt>
1820continue to operate normally through the remainder of boot, courtesy
1821of the fact that preemption is disabled across their RCU read-side
1822critical sections and also courtesy of the fact that there is still
1823only one CPU.
1824However, once the scheduler starts initializing, preemption is enabled.
1825There is still only a single CPU, but the fact that preemption is enabled
1826means that the no-op implementation of <tt>synchronize_rcu()</tt> no
1827longer works in <tt>CONFIG_PREEMPT=y</tt> kernels.
1828Therefore, as soon as the scheduler starts initializing, the early-boot
1829fastpath is disabled.
1830This means that <tt>synchronize_rcu()</tt> switches to its runtime
1831mode of operation where it posts callbacks, which in turn means that
1832any call to <tt>synchronize_rcu()</tt> will block until the corresponding
1833callback is invoked.
1834Unfortunately, the callback cannot be invoked until RCU's runtime
1835grace-period machinery is up and running, which cannot happen until
1836the scheduler has initialized itself sufficiently to allow RCU's
1837kthreads to be spawned.
1838Therefore, invoking <tt>synchronize_rcu()</tt> during scheduler
1839initialization can result in deadlock.
1840
1841<p><a name="Quick Quiz 14"><b>Quick Quiz 14</b>:</a>
1842So what happens with <tt>synchronize_rcu()</tt> during
1843scheduler initialization for <tt>CONFIG_PREEMPT=n</tt>
1844kernels?
1845<br><a href="#qq14answer">Answer</a>
1846
1847<p>
1848I learned of these boot-time requirements as a result of a series of
1849system hangs.
1850
1851<h3><a name="Interrupts and NMIs">Interrupts and NMIs</a></h3>
1852
1853<p>
1854The Linux kernel has interrupts, and RCU read-side critical sections are
1855legal within interrupt handlers and within interrupt-disabled regions
1856of code, as are invocations of <tt>call_rcu()</tt>.
1857
1858<p>
1859Some Linux-kernel architectures can enter an interrupt handler from
1860non-idle process context, and then just never leave it, instead stealthily
1861transitioning back to process context.
1862This trick is sometimes used to invoke system calls from inside the kernel.
1863These &ldquo;half-interrupts&rdquo; mean that RCU has to be very careful
1864about how it counts interrupt nesting levels.
1865I learned of this requirement the hard way during a rewrite
1866of RCU's dyntick-idle code.
1867
1868<p>
1869The Linux kernel has non-maskable interrupts (NMIs), and
1870RCU read-side critical sections are legal within NMI handlers.
1871Thankfully, RCU update-side primitives, including
1872<tt>call_rcu()</tt>, are prohibited within NMI handlers.
1873
1874<p>
1875The name notwithstanding, some Linux-kernel architectures
1876can have nested NMIs, which RCU must handle correctly.
1877Andy Lutomirski
1878<a href="https://lkml.kernel.org/g/CALCETrXLq1y7e_dKFPgou-FKHB6Pu-r8+t-6Ds+8=va7anBWDA@mail.gmail.com">surprised me</a>
1879with this requirement;
1880he also kindly surprised me with
1881<a href="https://lkml.kernel.org/g/CALCETrXSY9JpW3uE6H8WYk81sg56qasA2aqmjMPsq5dOtzso=g@mail.gmail.com">an algorithm</a>
1882that meets this requirement.
1883
1884<h3><a name="Loadable Modules">Loadable Modules</a></h3>
1885
1886<p>
1887The Linux kernel has loadable modules, and these modules can
1888also be unloaded.
1889After a given module has been unloaded, any attempt to call
1890one of its functions results in a segmentation fault.
1891The module-unload functions must therefore cancel any
1892delayed calls to loadable-module functions, for example,
1893any outstanding <tt>mod_timer()</tt> must be dealt with
1894via <tt>del_timer_sync()</tt> or similar.
1895
1896<p>
1897Unfortunately, there is no way to cancel an RCU callback;
1898once you invoke <tt>call_rcu()</tt>, the callback function is
1899going to eventually be invoked, unless the system goes down first.
1900Because it is normally considered socially irresponsible to crash the system
1901in response to a module unload request, we need some other way
1902to deal with in-flight RCU callbacks.
1903
1904<p>
1905RCU therefore provides
1906<tt><a href="https://lwn.net/Articles/217484/">rcu_barrier()</a></tt>,
1907which waits until all in-flight RCU callbacks have been invoked.
1908If a module uses <tt>call_rcu()</tt>, its exit function should therefore
1909prevent any future invocation of <tt>call_rcu()</tt>, then invoke
1910<tt>rcu_barrier()</tt>.
1911In theory, the underlying module-unload code could invoke
1912<tt>rcu_barrier()</tt> unconditionally, but in practice this would
1913incur unacceptable latencies.
1914
1915<p>
1916Nikita Danilov noted this requirement for an analogous filesystem-unmount
1917situation, and Dipankar Sarma incorporated <tt>rcu_barrier()</tt> into RCU.
1918The need for <tt>rcu_barrier()</tt> for module unloading became
1919apparent later.
1920
1921<h3><a name="Hotplug CPU">Hotplug CPU</a></h3>
1922
1923<p>
1924The Linux kernel supports CPU hotplug, which means that CPUs
1925can come and go.
1926It is of course illegal to use any RCU API member from an offline CPU.
1927This requirement was present from day one in DYNIX/ptx, but
1928on the other hand, the Linux kernel's CPU-hotplug implementation
1929is &ldquo;interesting.&rdquo;
1930
1931<p>
1932The Linux-kernel CPU-hotplug implementation has notifiers that
1933are used to allow the various kernel subsystems (including RCU)
1934to respond appropriately to a given CPU-hotplug operation.
1935Most RCU operations may be invoked from CPU-hotplug notifiers,
1936including even normal synchronous grace-period operations
1937such as <tt>synchronize_rcu()</tt>.
1938However, expedited grace-period operations such as
1939<tt>synchronize_rcu_expedited()</tt> are not supported,
1940due to the fact that current implementations block CPU-hotplug
1941operations, which could result in deadlock.
1942
1943<p>
1944In addition, all-callback-wait operations such as
1945<tt>rcu_barrier()</tt> are also not supported, due to the
1946fact that there are phases of CPU-hotplug operations where
1947the outgoing CPU's callbacks will not be invoked until after
1948the CPU-hotplug operation ends, which could also result in deadlock.
1949
1950<h3><a name="Scheduler and RCU">Scheduler and RCU</a></h3>
1951
1952<p>
1953RCU depends on the scheduler, and the scheduler uses RCU to
1954protect some of its data structures.
1955This means the scheduler is forbidden from acquiring
1956the runqueue locks and the priority-inheritance locks
1957in the middle of an outermost RCU read-side critical section unless either
1958(1)&nbsp;it releases them before exiting that same
1959RCU read-side critical section, or
1960(2)&nbsp;interrupts are disabled across
1961that entire RCU read-side critical section.
1962This same prohibition also applies (recursively!) to any lock that is acquired
1963while holding any lock to which this prohibition applies.
1964Adhering to this rule prevents preemptible RCU from invoking
1965<tt>rcu_read_unlock_special()</tt> while either runqueue or
1966priority-inheritance locks are held, thus avoiding deadlock.
1967
1968<p>
1969Prior to v4.4, it was only necessary to disable preemption across
1970RCU read-side critical sections that acquired scheduler locks.
1971In v4.4, expedited grace periods started using IPIs, and these
1972IPIs could force a <tt>rcu_read_unlock()</tt> to take the slowpath.
1973Therefore, this expedited-grace-period change required disabling of
1974interrupts, not just preemption.
1975
1976<p>
1977For RCU's part, the preemptible-RCU <tt>rcu_read_unlock()</tt>
1978implementation must be written carefully to avoid similar deadlocks.
1979In particular, <tt>rcu_read_unlock()</tt> must tolerate an
1980interrupt where the interrupt handler invokes both
1981<tt>rcu_read_lock()</tt> and <tt>rcu_read_unlock()</tt>.
1982This possibility requires <tt>rcu_read_unlock()</tt> to use
1983negative nesting levels to avoid destructive recursion via
1984interrupt handler's use of RCU.
1985
1986<p>
1987This pair of mutual scheduler-RCU requirements came as a
1988<a href="https://lwn.net/Articles/453002/">complete surprise</a>.
1989
1990<p>
1991As noted above, RCU makes use of kthreads, and it is necessary to
1992avoid excessive CPU-time accumulation by these kthreads.
1993This requirement was no surprise, but RCU's violation of it
1994when running context-switch-heavy workloads when built with
1995<tt>CONFIG_NO_HZ_FULL=y</tt>
1996<a href="http://www.rdrop.com/users/paulmck/scalability/paper/BareMetal.2015.01.15b.pdf">did come as a surprise [PDF]</a>.
1997RCU has made good progress towards meeting this requirement, even
1998for context-switch-have <tt>CONFIG_NO_HZ_FULL=y</tt> workloads,
1999but there is room for further improvement.
2000
2001<h3><a name="Tracing and RCU">Tracing and RCU</a></h3>
2002
2003<p>
2004It is possible to use tracing on RCU code, but tracing itself
2005uses RCU.
2006For this reason, <tt>rcu_dereference_raw_notrace()</tt>
2007is provided for use by tracing, which avoids the destructive
2008recursion that could otherwise ensue.
2009This API is also used by virtualization in some architectures,
2010where RCU readers execute in environments in which tracing
2011cannot be used.
2012The tracing folks both located the requirement and provided the
2013needed fix, so this surprise requirement was relatively painless.
2014
2015<h3><a name="Energy Efficiency">Energy Efficiency</a></h3>
2016
2017<p>
2018Interrupting idle CPUs is considered socially unacceptable,
2019especially by people with battery-powered embedded systems.
2020RCU therefore conserves energy by detecting which CPUs are
2021idle, including tracking CPUs that have been interrupted from idle.
2022This is a large part of the energy-efficiency requirement,
2023so I learned of this via an irate phone call.
2024
2025<p>
2026Because RCU avoids interrupting idle CPUs, it is illegal to
2027execute an RCU read-side critical section on an idle CPU.
2028(Kernels built with <tt>CONFIG_PROVE_RCU=y</tt> will splat
2029if you try it.)
2030The <tt>RCU_NONIDLE()</tt> macro and <tt>_rcuidle</tt>
2031event tracing is provided to work around this restriction.
2032In addition, <tt>rcu_is_watching()</tt> may be used to
2033test whether or not it is currently legal to run RCU read-side
2034critical sections on this CPU.
2035I learned of the need for diagnostics on the one hand
2036and <tt>RCU_NONIDLE()</tt> on the other while inspecting
2037idle-loop code.
2038Steven Rostedt supplied <tt>_rcuidle</tt> event tracing,
2039which is used quite heavily in the idle loop.
2040
2041<p>
2042It is similarly socially unacceptable to interrupt an
2043<tt>nohz_full</tt> CPU running in userspace.
2044RCU must therefore track <tt>nohz_full</tt> userspace
2045execution.
2046And in
2047<a href="https://lwn.net/Articles/558284/"><tt>CONFIG_NO_HZ_FULL_SYSIDLE=y</tt></a>
2048kernels, RCU must separately track idle CPUs on the one hand and
2049CPUs that are either idle or executing in userspace on the other.
2050In both cases, RCU must be able to sample state at two points in
2051time, and be able to determine whether or not some other CPU spent
2052any time idle and/or executing in userspace.
2053
2054<p>
2055These energy-efficiency requirements have proven quite difficult to
2056understand and to meet, for example, there have been more than five
2057clean-sheet rewrites of RCU's energy-efficiency code, the last of
2058which was finally able to demonstrate
2059<a href="http://www.rdrop.com/users/paulmck/realtime/paper/AMPenergy.2013.04.19a.pdf">real energy savings running on real hardware [PDF]</a>.
2060As noted earlier,
2061I learned of many of these requirements via angry phone calls:
2062Flaming me on the Linux-kernel mailing list was apparently not
2063sufficient to fully vent their ire at RCU's energy-efficiency bugs!
2064
2065<h3><a name="Memory Efficiency">Memory Efficiency</a></h3>
2066
2067<p>
2068Although small-memory non-realtime systems can simply use Tiny RCU,
2069code size is only one aspect of memory efficiency.
2070Another aspect is the size of the <tt>rcu_head</tt> structure
2071used by <tt>call_rcu()</tt> and <tt>kfree_rcu()</tt>.
2072Although this structure contains nothing more than a pair of pointers,
2073it does appear in many RCU-protected data structures, including
2074some that are size critical.
2075The <tt>page</tt> structure is a case in point, as evidenced by
2076the many occurrences of the <tt>union</tt> keyword within that structure.
2077
2078<p>
2079This need for memory efficiency is one reason that RCU uses hand-crafted
2080singly linked lists to track the <tt>rcu_head</tt> structures that
2081are waiting for a grace period to elapse.
2082It is also the reason why <tt>rcu_head</tt> structures do not contain
2083debug information, such as fields tracking the file and line of the
2084<tt>call_rcu()</tt> or <tt>kfree_rcu()</tt> that posted them.
2085Although this information might appear in debug-only kernel builds at some
2086point, in the meantime, the <tt>-&gt;func</tt> field will often provide
2087the needed debug information.
2088
2089<p>
2090However, in some cases, the need for memory efficiency leads to even
2091more extreme measures.
2092Returning to the <tt>page</tt> structure, the <tt>rcu_head</tt> field
2093shares storage with a great many other structures that are used at
2094various points in the corresponding page's lifetime.
2095In order to correctly resolve certain
2096<a href="https://lkml.kernel.org/g/1439976106-137226-1-git-send-email-kirill.shutemov@linux.intel.com">race conditions</a>,
2097the Linux kernel's memory-management subsystem needs a particular bit
2098to remain zero during all phases of grace-period processing,
2099and that bit happens to map to the bottom bit of the
2100<tt>rcu_head</tt> structure's <tt>-&gt;next</tt> field.
2101RCU makes this guarantee as long as <tt>call_rcu()</tt>
2102is used to post the callback, as opposed to <tt>kfree_rcu()</tt>
2103or some future &ldquo;lazy&rdquo;
2104variant of <tt>call_rcu()</tt> that might one day be created for
2105energy-efficiency purposes.
2106
2107<h3><a name="Performance, Scalability, Response Time, and Reliability">
2108Performance, Scalability, Response Time, and Reliability</a></h3>
2109
2110<p>
2111Expanding on the
2112<a href="#Performance and Scalability">earlier discussion</a>,
2113RCU is used heavily by hot code paths in performance-critical
2114portions of the Linux kernel's networking, security, virtualization,
2115and scheduling code paths.
2116RCU must therefore use efficient implementations, especially in its
2117read-side primitives.
2118To that end, it would be good if preemptible RCU's implementation
2119of <tt>rcu_read_lock()</tt> could be inlined, however, doing
2120this requires resolving <tt>#include</tt> issues with the
2121<tt>task_struct</tt> structure.
2122
2123<p>
2124The Linux kernel supports hardware configurations with up to
21254096 CPUs, which means that RCU must be extremely scalable.
2126Algorithms that involve frequent acquisitions of global locks or
2127frequent atomic operations on global variables simply cannot be
2128tolerated within the RCU implementation.
2129RCU therefore makes heavy use of a combining tree based on the
2130<tt>rcu_node</tt> structure.
2131RCU is required to tolerate all CPUs continuously invoking any
2132combination of RCU's runtime primitives with minimal per-operation
2133overhead.
2134In fact, in many cases, increasing load must <i>decrease</i> the
2135per-operation overhead, witness the batching optimizations for
2136<tt>synchronize_rcu()</tt>, <tt>call_rcu()</tt>,
2137<tt>synchronize_rcu_expedited()</tt>, and <tt>rcu_barrier()</tt>.
2138As a general rule, RCU must cheerfully accept whatever the
2139rest of the Linux kernel decides to throw at it.
2140
2141<p>
2142The Linux kernel is used for real-time workloads, especially
2143in conjunction with the
2144<a href="https://rt.wiki.kernel.org/index.php/Main_Page">-rt patchset</a>.
2145The real-time-latency response requirements are such that the
2146traditional approach of disabling preemption across RCU
2147read-side critical sections is inappropriate.
2148Kernels built with <tt>CONFIG_PREEMPT=y</tt> therefore
2149use an RCU implementation that allows RCU read-side critical
2150sections to be preempted.
2151This requirement made its presence known after users made it
2152clear that an earlier
2153<a href="https://lwn.net/Articles/107930/">real-time patch</a>
2154did not meet their needs, in conjunction with some
2155<a href="https://lkml.kernel.org/g/20050318002026.GA2693@us.ibm.com">RCU issues</a>
2156encountered by a very early version of the -rt patchset.
2157
2158<p>
2159In addition, RCU must make do with a sub-100-microsecond real-time latency
2160budget.
2161In fact, on smaller systems with the -rt patchset, the Linux kernel
2162provides sub-20-microsecond real-time latencies for the whole kernel,
2163including RCU.
2164RCU's scalability and latency must therefore be sufficient for
2165these sorts of configurations.
2166To my surprise, the sub-100-microsecond real-time latency budget
2167<a href="http://www.rdrop.com/users/paulmck/realtime/paper/bigrt.2013.01.31a.LCA.pdf">
2168applies to even the largest systems [PDF]</a>,
2169up to and including systems with 4096 CPUs.
2170This real-time requirement motivated the grace-period kthread, which
2171also simplified handling of a number of race conditions.
2172
2173<p>
2174Finally, RCU's status as a synchronization primitive means that
2175any RCU failure can result in arbitrary memory corruption that can be
2176extremely difficult to debug.
2177This means that RCU must be extremely reliable, which in
2178practice also means that RCU must have an aggressive stress-test
2179suite.
2180This stress-test suite is called <tt>rcutorture</tt>.
2181
2182<p>
2183Although the need for <tt>rcutorture</tt> was no surprise,
2184the current immense popularity of the Linux kernel is posing
2185interesting&mdash;and perhaps unprecedented&mdash;validation
2186challenges.
2187To see this, keep in mind that there are well over one billion
2188instances of the Linux kernel running today, given Android
2189smartphones, Linux-powered televisions, and servers.
2190This number can be expected to increase sharply with the advent of
2191the celebrated Internet of Things.
2192
2193<p>
2194Suppose that RCU contains a race condition that manifests on average
2195once per million years of runtime.
2196This bug will be occurring about three times per <i>day</i> across
2197the installed base.
2198RCU could simply hide behind hardware error rates, given that no one
2199should really expect their smartphone to last for a million years.
2200However, anyone taking too much comfort from this thought should
2201consider the fact that in most jurisdictions, a successful multi-year
2202test of a given mechanism, which might include a Linux kernel,
2203suffices for a number of types of safety-critical certifications.
2204In fact, rumor has it that the Linux kernel is already being used
2205in production for safety-critical applications.
2206I don't know about you, but I would feel quite bad if a bug in RCU
2207killed someone.
2208Which might explain my recent focus on validation and verification.
2209
2210<h2><a name="Other RCU Flavors">Other RCU Flavors</a></h2>
2211
2212<p>
2213One of the more surprising things about RCU is that there are now
2214no fewer than five <i>flavors</i>, or API families.
2215In addition, the primary flavor that has been the sole focus up to
2216this point has two different implementations, non-preemptible and
2217preemptible.
2218The other four flavors are listed below, with requirements for each
2219described in a separate section.
2220
2221<ol>
2222<li> <a href="#Bottom-Half Flavor">Bottom-Half Flavor</a>
2223<li> <a href="#Sched Flavor">Sched Flavor</a>
2224<li> <a href="#Sleepable RCU">Sleepable RCU</a>
2225<li> <a href="#Tasks RCU">Tasks RCU</a>
2226</ol>
2227
2228<h3><a name="Bottom-Half Flavor">Bottom-Half Flavor</a></h3>
2229
2230<p>
2231The softirq-disable (AKA &ldquo;bottom-half&rdquo;,
2232hence the &ldquo;_bh&rdquo; abbreviations)
2233flavor of RCU, or <i>RCU-bh</i>, was developed by
2234Dipankar Sarma to provide a flavor of RCU that could withstand the
2235network-based denial-of-service attacks researched by Robert
2236Olsson.
2237These attacks placed so much networking load on the system
2238that some of the CPUs never exited softirq execution,
2239which in turn prevented those CPUs from ever executing a context switch,
2240which, in the RCU implementation of that time, prevented grace periods
2241from ever ending.
2242The result was an out-of-memory condition and a system hang.
2243
2244<p>
2245The solution was the creation of RCU-bh, which does
2246<tt>local_bh_disable()</tt>
2247across its read-side critical sections, and which uses the transition
2248from one type of softirq processing to another as a quiescent state
2249in addition to context switch, idle, user mode, and offline.
2250This means that RCU-bh grace periods can complete even when some of
2251the CPUs execute in softirq indefinitely, thus allowing algorithms
2252based on RCU-bh to withstand network-based denial-of-service attacks.
2253
2254<p>
2255Because
2256<tt>rcu_read_lock_bh()</tt> and <tt>rcu_read_unlock_bh()</tt>
2257disable and re-enable softirq handlers, any attempt to start a softirq
2258handlers during the
2259RCU-bh read-side critical section will be deferred.
2260In this case, <tt>rcu_read_unlock_bh()</tt>
2261will invoke softirq processing, which can take considerable time.
2262One can of course argue that this softirq overhead should be associated
2263with the code following the RCU-bh read-side critical section rather
2264than <tt>rcu_read_unlock_bh()</tt>, but the fact
2265is that most profiling tools cannot be expected to make this sort
2266of fine distinction.
2267For example, suppose that a three-millisecond-long RCU-bh read-side
2268critical section executes during a time of heavy networking load.
2269There will very likely be an attempt to invoke at least one softirq
2270handler during that three milliseconds, but any such invocation will
2271be delayed until the time of the <tt>rcu_read_unlock_bh()</tt>.
2272This can of course make it appear at first glance as if
2273<tt>rcu_read_unlock_bh()</tt> was executing very slowly.
2274
2275<p>
2276The
2277<a href="https://lwn.net/Articles/609973/#RCU Per-Flavor API Table">RCU-bh API</a>
2278includes
2279<tt>rcu_read_lock_bh()</tt>,
2280<tt>rcu_read_unlock_bh()</tt>,
2281<tt>rcu_dereference_bh()</tt>,
2282<tt>rcu_dereference_bh_check()</tt>,
2283<tt>synchronize_rcu_bh()</tt>,
2284<tt>synchronize_rcu_bh_expedited()</tt>,
2285<tt>call_rcu_bh()</tt>,
2286<tt>rcu_barrier_bh()</tt>, and
2287<tt>rcu_read_lock_bh_held()</tt>.
2288
2289<h3><a name="Sched Flavor">Sched Flavor</a></h3>
2290
2291<p>
2292Before preemptible RCU, waiting for an RCU grace period had the
2293side effect of also waiting for all pre-existing interrupt
2294and NMI handlers.
2295However, there are legitimate preemptible-RCU implementations that
2296do not have this property, given that any point in the code outside
2297of an RCU read-side critical section can be a quiescent state.
2298Therefore, <i>RCU-sched</i> was created, which follows &ldquo;classic&rdquo;
2299RCU in that an RCU-sched grace period waits for for pre-existing
2300interrupt and NMI handlers.
2301In kernels built with <tt>CONFIG_PREEMPT=n</tt>, the RCU and RCU-sched
2302APIs have identical implementations, while kernels built with
2303<tt>CONFIG_PREEMPT=y</tt> provide a separate implementation for each.
2304
2305<p>
2306Note well that in <tt>CONFIG_PREEMPT=y</tt> kernels,
2307<tt>rcu_read_lock_sched()</tt> and <tt>rcu_read_unlock_sched()</tt>
2308disable and re-enable preemption, respectively.
2309This means that if there was a preemption attempt during the
2310RCU-sched read-side critical section, <tt>rcu_read_unlock_sched()</tt>
2311will enter the scheduler, with all the latency and overhead entailed.
2312Just as with <tt>rcu_read_unlock_bh()</tt>, this can make it look
2313as if <tt>rcu_read_unlock_sched()</tt> was executing very slowly.
2314However, the highest-priority task won't be preempted, so that task
2315will enjoy low-overhead <tt>rcu_read_unlock_sched()</tt> invocations.
2316
2317<p>
2318The
2319<a href="https://lwn.net/Articles/609973/#RCU Per-Flavor API Table">RCU-sched API</a>
2320includes
2321<tt>rcu_read_lock_sched()</tt>,
2322<tt>rcu_read_unlock_sched()</tt>,
2323<tt>rcu_read_lock_sched_notrace()</tt>,
2324<tt>rcu_read_unlock_sched_notrace()</tt>,
2325<tt>rcu_dereference_sched()</tt>,
2326<tt>rcu_dereference_sched_check()</tt>,
2327<tt>synchronize_sched()</tt>,
2328<tt>synchronize_rcu_sched_expedited()</tt>,
2329<tt>call_rcu_sched()</tt>,
2330<tt>rcu_barrier_sched()</tt>, and
2331<tt>rcu_read_lock_sched_held()</tt>.
2332However, anything that disables preemption also marks an RCU-sched
2333read-side critical section, including
2334<tt>preempt_disable()</tt> and <tt>preempt_enable()</tt>,
2335<tt>local_irq_save()</tt> and <tt>local_irq_restore()</tt>,
2336and so on.
2337
2338<h3><a name="Sleepable RCU">Sleepable RCU</a></h3>
2339
2340<p>
2341For well over a decade, someone saying &ldquo;I need to block within
2342an RCU read-side critical section&rdquo; was a reliable indication
2343that this someone did not understand RCU.
2344After all, if you are always blocking in an RCU read-side critical
2345section, you can probably afford to use a higher-overhead synchronization
2346mechanism.
2347However, that changed with the advent of the Linux kernel's notifiers,
2348whose RCU read-side critical
2349sections almost never sleep, but sometimes need to.
2350This resulted in the introduction of
2351<a href="https://lwn.net/Articles/202847/">sleepable RCU</a>,
2352or <i>SRCU</i>.
2353
2354<p>
2355SRCU allows different domains to be defined, with each such domain
2356defined by an instance of an <tt>srcu_struct</tt> structure.
2357A pointer to this structure must be passed in to each SRCU function,
2358for example, <tt>synchronize_srcu(&amp;ss)</tt>, where
2359<tt>ss</tt> is the <tt>srcu_struct</tt> structure.
2360The key benefit of these domains is that a slow SRCU reader in one
2361domain does not delay an SRCU grace period in some other domain.
2362That said, one consequence of these domains is that read-side code
2363must pass a &ldquo;cookie&rdquo; from <tt>srcu_read_lock()</tt>
2364to <tt>srcu_read_unlock()</tt>, for example, as follows:
2365
2366<blockquote>
2367<pre>
2368 1 int idx;
2369 2
2370 3 idx = srcu_read_lock(&amp;ss);
2371 4 do_something();
2372 5 srcu_read_unlock(&amp;ss, idx);
2373</pre>
2374</blockquote>
2375
2376<p>
2377As noted above, it is legal to block within SRCU read-side critical sections,
2378however, with great power comes great responsibility.
2379If you block forever in one of a given domain's SRCU read-side critical
2380sections, then that domain's grace periods will also be blocked forever.
2381Of course, one good way to block forever is to deadlock, which can
2382happen if any operation in a given domain's SRCU read-side critical
2383section can block waiting, either directly or indirectly, for that domain's
2384grace period to elapse.
2385For example, this results in a self-deadlock:
2386
2387<blockquote>
2388<pre>
2389 1 int idx;
2390 2
2391 3 idx = srcu_read_lock(&amp;ss);
2392 4 do_something();
2393 5 synchronize_srcu(&amp;ss);
2394 6 srcu_read_unlock(&amp;ss, idx);
2395</pre>
2396</blockquote>
2397
2398<p>
2399However, if line&nbsp;5 acquired a mutex that was held across
2400a <tt>synchronize_srcu()</tt> for domain <tt>ss</tt>,
2401deadlock would still be possible.
2402Furthermore, if line&nbsp;5 acquired a mutex that was held across
2403a <tt>synchronize_srcu()</tt> for some other domain <tt>ss1</tt>,
2404and if an <tt>ss1</tt>-domain SRCU read-side critical section
2405acquired another mutex that was held across as <tt>ss</tt>-domain
2406<tt>synchronize_srcu()</tt>,
2407deadlock would again be possible.
2408Such a deadlock cycle could extend across an arbitrarily large number
2409of different SRCU domains.
2410Again, with great power comes great responsibility.
2411
2412<p>
2413Unlike the other RCU flavors, SRCU read-side critical sections can
2414run on idle and even offline CPUs.
2415This ability requires that <tt>srcu_read_lock()</tt> and
2416<tt>srcu_read_unlock()</tt> contain memory barriers, which means
2417that SRCU readers will run a bit slower than would RCU readers.
2418It also motivates the <tt>smp_mb__after_srcu_read_unlock()</tt>
2419API, which, in combination with <tt>srcu_read_unlock()</tt>,
2420guarantees a full memory barrier.
2421
2422<p>
2423The
2424<a href="https://lwn.net/Articles/609973/#RCU Per-Flavor API Table">SRCU API</a>
2425includes
2426<tt>srcu_read_lock()</tt>,
2427<tt>srcu_read_unlock()</tt>,
2428<tt>srcu_dereference()</tt>,
2429<tt>srcu_dereference_check()</tt>,
2430<tt>synchronize_srcu()</tt>,
2431<tt>synchronize_srcu_expedited()</tt>,
2432<tt>call_srcu()</tt>,
2433<tt>srcu_barrier()</tt>, and
2434<tt>srcu_read_lock_held()</tt>.
2435It also includes
2436<tt>DEFINE_SRCU()</tt>,
2437<tt>DEFINE_STATIC_SRCU()</tt>, and
2438<tt>init_srcu_struct()</tt>
2439APIs for defining and initializing <tt>srcu_struct</tt> structures.
2440
2441<h3><a name="Tasks RCU">Tasks RCU</a></h3>
2442
2443<p>
2444Some forms of tracing use &ldquo;tramopolines&rdquo; to handle the
2445binary rewriting required to install different types of probes.
2446It would be good to be able to free old trampolines, which sounds
2447like a job for some form of RCU.
2448However, because it is necessary to be able to install a trace
2449anywhere in the code, it is not possible to use read-side markers
2450such as <tt>rcu_read_lock()</tt> and <tt>rcu_read_unlock()</tt>.
2451In addition, it does not work to have these markers in the trampoline
2452itself, because there would need to be instructions following
2453<tt>rcu_read_unlock()</tt>.
2454Although <tt>synchronize_rcu()</tt> would guarantee that execution
2455reached the <tt>rcu_read_unlock()</tt>, it would not be able to
2456guarantee that execution had completely left the trampoline.
2457
2458<p>
2459The solution, in the form of
2460<a href="https://lwn.net/Articles/607117/"><i>Tasks RCU</i></a>,
2461is to have implicit
2462read-side critical sections that are delimited by voluntary context
2463switches, that is, calls to <tt>schedule()</tt>,
2464<tt>cond_resched_rcu_qs()</tt>, and
2465<tt>synchronize_rcu_tasks()</tt>.
2466In addition, transitions to and from userspace execution also delimit
2467tasks-RCU read-side critical sections.
2468
2469<p>
2470The tasks-RCU API is quite compact, consisting only of
2471<tt>call_rcu_tasks()</tt>,
2472<tt>synchronize_rcu_tasks()</tt>, and
2473<tt>rcu_barrier_tasks()</tt>.
2474
2475<h2><a name="Possible Future Changes">Possible Future Changes</a></h2>
2476
2477<p>
2478One of the tricks that RCU uses to attain update-side scalability is
2479to increase grace-period latency with increasing numbers of CPUs.
2480If this becomes a serious problem, it will be necessary to rework the
2481grace-period state machine so as to avoid the need for the additional
2482latency.
2483
2484<p>
2485Expedited grace periods scan the CPUs, so their latency and overhead
2486increases with increasing numbers of CPUs.
2487If this becomes a serious problem on large systems, it will be necessary
2488to do some redesign to avoid this scalability problem.
2489
2490<p>
2491RCU disables CPU hotplug in a few places, perhaps most notably in the
2492expedited grace-period and <tt>rcu_barrier()</tt> operations.
2493If there is a strong reason to use expedited grace periods in CPU-hotplug
2494notifiers, it will be necessary to avoid disabling CPU hotplug.
2495This would introduce some complexity, so there had better be a <i>very</i>
2496good reason.
2497
2498<p>
2499The tradeoff between grace-period latency on the one hand and interruptions
2500of other CPUs on the other hand may need to be re-examined.
2501The desire is of course for zero grace-period latency as well as zero
2502interprocessor interrupts undertaken during an expedited grace period
2503operation.
2504While this ideal is unlikely to be achievable, it is quite possible that
2505further improvements can be made.
2506
2507<p>
2508The multiprocessor implementations of RCU use a combining tree that
2509groups CPUs so as to reduce lock contention and increase cache locality.
2510However, this combining tree does not spread its memory across NUMA
2511nodes nor does it align the CPU groups with hardware features such
2512as sockets or cores.
2513Such spreading and alignment is currently believed to be unnecessary
2514because the hotpath read-side primitives do not access the combining
2515tree, nor does <tt>call_rcu()</tt> in the common case.
2516If you believe that your architecture needs such spreading and alignment,
2517then your architecture should also benefit from the
2518<tt>rcutree.rcu_fanout_leaf</tt> boot parameter, which can be set
2519to the number of CPUs in a socket, NUMA node, or whatever.
2520If the number of CPUs is too large, use a fraction of the number of
2521CPUs.
2522If the number of CPUs is a large prime number, well, that certainly
2523is an &ldquo;interesting&rdquo; architectural choice!
2524More flexible arrangements might be considered, but only if
2525<tt>rcutree.rcu_fanout_leaf</tt> has proven inadequate, and only
2526if the inadequacy has been demonstrated by a carefully run and
2527realistic system-level workload.
2528
2529<p>
2530Please note that arrangements that require RCU to remap CPU numbers will
2531require extremely good demonstration of need and full exploration of
2532alternatives.
2533
2534<p>
2535There is an embarrassingly large number of flavors of RCU, and this
2536number has been increasing over time.
2537Perhaps it will be possible to combine some at some future date.
2538
2539<p>
2540RCU's various kthreads are reasonably recent additions.
2541It is quite likely that adjustments will be required to more gracefully
2542handle extreme loads.
2543It might also be necessary to be able to relate CPU utilization by
2544RCU's kthreads and softirq handlers to the code that instigated this
2545CPU utilization.
2546For example, RCU callback overhead might be charged back to the
2547originating <tt>call_rcu()</tt> instance, though probably not
2548in production kernels.
2549
2550<h2><a name="Summary">Summary</a></h2>
2551
2552<p>
2553This document has presented more than two decade's worth of RCU
2554requirements.
2555Given that the requirements keep changing, this will not be the last
2556word on this subject, but at least it serves to get an important
2557subset of the requirements set forth.
2558
2559<h2><a name="Acknowledgments">Acknowledgments</a></h2>
2560
2561I am grateful to Steven Rostedt, Lai Jiangshan, Ingo Molnar,
2562Oleg Nesterov, Borislav Petkov, Peter Zijlstra, Boqun Feng, and
2563Andy Lutomirski for their help in rendering
2564this article human readable, and to Michelle Rankin for her support
2565of this effort.
2566Other contributions are acknowledged in the Linux kernel's git archive.
2567The cartoon is copyright (c) 2013 by Melissa Broussard,
2568and is provided
2569under the terms of the Creative Commons Attribution-Share Alike 3.0
2570United States license.
2571
2572<h3><a name="Answers to Quick Quizzes">
2573Answers to Quick Quizzes</a></h3>
2574
2575<a name="qq1answer"></a>
2576<p><b>Quick Quiz 1</b>:
2577Wait a minute!
2578You said that updaters can make useful forward progress concurrently
2579with readers, but pre-existing readers will block
2580<tt>synchronize_rcu()</tt>!!!
2581Just who are you trying to fool???
2582
2583
2584</p><p><b>Answer</b>:
2585First, if updaters do not wish to be blocked by readers, they can use
2586<tt>call_rcu()</tt> or <tt>kfree_rcu()</tt>, which will
2587be discussed later.
2588Second, even when using <tt>synchronize_rcu()</tt>, the other
2589update-side code does run concurrently with readers, whether pre-existing
2590or not.
2591
2592
2593</p><p><a href="#Quick%20Quiz%201"><b>Back to Quick Quiz 1</b>.</a>
2594
2595<a name="qq2answer"></a>
2596<p><b>Quick Quiz 2</b>:
2597Why is the <tt>synchronize_rcu()</tt> on line&nbsp;28 needed?
2598
2599
2600</p><p><b>Answer</b>:
2601Without that extra grace period, memory reordering could result in
2602<tt>do_something_dlm()</tt> executing <tt>do_something()</tt>
2603concurrently with the last bits of <tt>recovery()</tt>.
2604
2605
2606</p><p><a href="#Quick%20Quiz%202"><b>Back to Quick Quiz 2</b>.</a>
2607
2608<a name="qq3answer"></a>
2609<p><b>Quick Quiz 3</b>:
2610But <tt>rcu_assign_pointer()</tt> does nothing to prevent the
2611two assignments to <tt>p-&gt;a</tt> and <tt>p-&gt;b</tt>
2612from being reordered.
2613Can't that also cause problems?
2614
2615
2616</p><p><b>Answer</b>:
2617No, it cannot.
2618The readers cannot see either of these two fields until
2619the assignment to <tt>gp</tt>, by which time both fields are
2620fully initialized.
2621So reordering the assignments
2622to <tt>p-&gt;a</tt> and <tt>p-&gt;b</tt> cannot possibly
2623cause any problems.
2624
2625
2626</p><p><a href="#Quick%20Quiz%203"><b>Back to Quick Quiz 3</b>.</a>
2627
2628<a name="qq4answer"></a>
2629<p><b>Quick Quiz 4</b>:
2630Without the <tt>rcu_dereference()</tt> or the
2631<tt>rcu_access_pointer()</tt>, what destructive optimizations
2632might the compiler make use of?
2633
2634
2635</p><p><b>Answer</b>:
2636Let's start with what happens to <tt>do_something_gp()</tt>
2637if it fails to use <tt>rcu_dereference()</tt>.
2638It could reuse a value formerly fetched from this same pointer.
2639It could also fetch the pointer from <tt>gp</tt> in a byte-at-a-time
2640manner, resulting in <i>load tearing</i>, in turn resulting a bytewise
2641mash-up of two distince pointer values.
2642It might even use value-speculation optimizations, where it makes a wrong
2643guess, but by the time it gets around to checking the value, an update
2644has changed the pointer to match the wrong guess.
2645Too bad about any dereferences that returned pre-initialization garbage
2646in the meantime!
2647
2648<p>
2649For <tt>remove_gp_synchronous()</tt>, as long as all modifications
2650to <tt>gp</tt> are carried out while holding <tt>gp_lock</tt>,
2651the above optimizations are harmless.
2652However,
2653with <tt>CONFIG_SPARSE_RCU_POINTER=y</tt>,
2654<tt>sparse</tt> will complain if you
2655define <tt>gp</tt> with <tt>__rcu</tt> and then
2656access it without using
2657either <tt>rcu_access_pointer()</tt> or <tt>rcu_dereference()</tt>.
2658
2659
2660</p><p><a href="#Quick%20Quiz%204"><b>Back to Quick Quiz 4</b>.</a>
2661
2662<a name="qq5answer"></a>
2663<p><b>Quick Quiz 5</b>:
2664Given that multiple CPUs can start RCU read-side critical sections
2665at any time without any ordering whatsoever, how can RCU possibly tell whether
2666or not a given RCU read-side critical section starts before a
2667given instance of <tt>synchronize_rcu()</tt>?
2668
2669
2670</p><p><b>Answer</b>:
2671If RCU cannot tell whether or not a given
2672RCU read-side critical section starts before a
2673given instance of <tt>synchronize_rcu()</tt>,
2674then it must assume that the RCU read-side critical section
2675started first.
2676In other words, a given instance of <tt>synchronize_rcu()</tt>
2677can avoid waiting on a given RCU read-side critical section only
2678if it can prove that <tt>synchronize_rcu()</tt> started first.
2679
2680
2681</p><p><a href="#Quick%20Quiz%205"><b>Back to Quick Quiz 5</b>.</a>
2682
2683<a name="qq6answer"></a>
2684<p><b>Quick Quiz 6</b>:
2685The first and second guarantees require unbelievably strict ordering!
2686Are all these memory barriers <i> really</i> required?
2687
2688
2689</p><p><b>Answer</b>:
2690Yes, they really are required.
2691To see why the first guarantee is required, consider the following
2692sequence of events:
2693
2694<ol>
2695<li> CPU 1: <tt>rcu_read_lock()</tt>
2696<li> CPU 1: <tt>q = rcu_dereference(gp);
2697 /* Very likely to return p. */</tt>
2698<li> CPU 0: <tt>list_del_rcu(p);</tt>
2699<li> CPU 0: <tt>synchronize_rcu()</tt> starts.
2700<li> CPU 1: <tt>do_something_with(q-&gt;a);
2701 /* No smp_mb(), so might happen after kfree(). */</tt>
2702<li> CPU 1: <tt>rcu_read_unlock()</tt>
2703<li> CPU 0: <tt>synchronize_rcu()</tt> returns.
2704<li> CPU 0: <tt>kfree(p);</tt>
2705</ol>
2706
2707<p>
2708Therefore, there absolutely must be a full memory barrier between the
2709end of the RCU read-side critical section and the end of the
2710grace period.
2711
2712<p>
2713The sequence of events demonstrating the necessity of the second rule
2714is roughly similar:
2715
2716<ol>
2717<li> CPU 0: <tt>list_del_rcu(p);</tt>
2718<li> CPU 0: <tt>synchronize_rcu()</tt> starts.
2719<li> CPU 1: <tt>rcu_read_lock()</tt>
2720<li> CPU 1: <tt>q = rcu_dereference(gp);
2721 /* Might return p if no memory barrier. */</tt>
2722<li> CPU 0: <tt>synchronize_rcu()</tt> returns.
2723<li> CPU 0: <tt>kfree(p);</tt>
2724<li> CPU 1: <tt>do_something_with(q-&gt;a); /* Boom!!! */</tt>
2725<li> CPU 1: <tt>rcu_read_unlock()</tt>
2726</ol>
2727
2728<p>
2729And similarly, without a memory barrier between the beginning of the
2730grace period and the beginning of the RCU read-side critical section,
2731CPU&nbsp;1 might end up accessing the freelist.
2732
2733<p>
2734The &ldquo;as if&rdquo; rule of course applies, so that any implementation
2735that acts as if the appropriate memory barriers were in place is a
2736correct implementation.
2737That said, it is much easier to fool yourself into believing that you have
2738adhered to the as-if rule than it is to actually adhere to it!
2739
2740
2741</p><p><a href="#Quick%20Quiz%206"><b>Back to Quick Quiz 6</b>.</a>
2742
2743<a name="qq7answer"></a>
2744<p><b>Quick Quiz 7</b>:
2745But how does the upgrade-to-write operation exclude other readers?
2746
2747
2748</p><p><b>Answer</b>:
2749It doesn't, just like normal RCU updates, which also do not exclude
2750RCU readers.
2751
2752
2753</p><p><a href="#Quick%20Quiz%207"><b>Back to Quick Quiz 7</b>.</a>
2754
2755<a name="qq8answer"></a>
2756<p><b>Quick Quiz 8</b>:
2757Can't the compiler also reorder this code?
2758
2759
2760</p><p><b>Answer</b>:
2761No, the volatile casts in <tt>READ_ONCE()</tt> and
2762<tt>WRITE_ONCE()</tt> prevent the compiler from reordering in
2763this particular case.
2764
2765
2766</p><p><a href="#Quick%20Quiz%208"><b>Back to Quick Quiz 8</b>.</a>
2767
2768<a name="qq9answer"></a>
2769<p><b>Quick Quiz 9</b>:
2770Suppose that synchronize_rcu() did wait until all readers had completed.
2771Would the updater be able to rely on this?
2772
2773
2774</p><p><b>Answer</b>:
2775No.
2776Even if <tt>synchronize_rcu()</tt> were to wait until
2777all readers had completed, a new reader might start immediately after
2778<tt>synchronize_rcu()</tt> completed.
2779Therefore, the code following
2780<tt>synchronize_rcu()</tt> cannot rely on there being no readers
2781in any case.
2782
2783
2784</p><p><a href="#Quick%20Quiz%209"><b>Back to Quick Quiz 9</b>.</a>
2785
2786<a name="qq10answer"></a>
2787<p><b>Quick Quiz 10</b>:
2788How long a sequence of grace periods, each separated by an RCU read-side
2789critical section, would be required to partition the RCU read-side
2790critical sections at the beginning and end of the chain?
2791
2792
2793</p><p><b>Answer</b>:
2794In theory, an infinite number.
2795In practice, an unknown number that is sensitive to both implementation
2796details and timing considerations.
2797Therefore, even in practice, RCU users must abide by the theoretical rather
2798than the practical answer.
2799
2800
2801</p><p><a href="#Quick%20Quiz%2010"><b>Back to Quick Quiz 10</b>.</a>
2802
2803<a name="qq11answer"></a>
2804<p><b>Quick Quiz 11</b>:
2805What about sleeping locks?
2806
2807
2808</p><p><b>Answer</b>:
2809These are forbidden within Linux-kernel RCU read-side critical sections
2810because it is not legal to place a quiescent state (in this case,
2811voluntary context switch) within an RCU read-side critical section.
2812However, sleeping locks may be used within userspace RCU read-side critical
2813sections, and also within Linux-kernel sleepable RCU
2814<a href="#Sleepable RCU">(SRCU)</a>
2815read-side critical sections.
2816In addition, the -rt patchset turns spinlocks into a sleeping locks so
2817that the corresponding critical sections can be preempted, which
2818also means that these sleeplockified spinlocks (but not other sleeping locks!)
2819may be acquire within -rt-Linux-kernel RCU read-side critical sections.
2820
2821<p>
2822Note that it <i>is</i> legal for a normal RCU read-side critical section
2823to conditionally acquire a sleeping locks (as in <tt>mutex_trylock()</tt>),
2824but only as long as it does not loop indefinitely attempting to
2825conditionally acquire that sleeping locks.
2826The key point is that things like <tt>mutex_trylock()</tt>
2827either return with the mutex held, or return an error indication if
2828the mutex was not immediately available.
2829Either way, <tt>mutex_trylock()</tt> returns immediately without sleeping.
2830
2831
2832</p><p><a href="#Quick%20Quiz%2011"><b>Back to Quick Quiz 11</b>.</a>
2833
2834<a name="qq12answer"></a>
2835<p><b>Quick Quiz 12</b>:
2836Why does line&nbsp;19 use <tt>rcu_access_pointer()</tt>?
2837After all, <tt>call_rcu()</tt> on line&nbsp;25 stores into the
2838structure, which would interact badly with concurrent insertions.
2839Doesn't this mean that <tt>rcu_dereference()</tt> is required?
2840
2841
2842</p><p><b>Answer</b>:
2843Presumably the <tt>-&gt;gp_lock</tt> acquired on line&nbsp;18 excludes
2844any changes, including any insertions that <tt>rcu_dereference()</tt>
2845would protect against.
2846Therefore, any insertions will be delayed until after <tt>-&gt;gp_lock</tt>
2847is released on line&nbsp;25, which in turn means that
2848<tt>rcu_access_pointer()</tt> suffices.
2849
2850
2851</p><p><a href="#Quick%20Quiz%2012"><b>Back to Quick Quiz 12</b>.</a>
2852
2853<a name="qq13answer"></a>
2854<p><b>Quick Quiz 13</b>:
2855Earlier it was claimed that <tt>call_rcu()</tt> and
2856<tt>kfree_rcu()</tt> allowed updaters to avoid being blocked
2857by readers.
2858But how can that be correct, given that the invocation of the callback
2859and the freeing of the memory (respectively) must still wait for
2860a grace period to elapse?
2861
2862
2863</p><p><b>Answer</b>:
2864We could define things this way, but keep in mind that this sort of
2865definition would say that updates in garbage-collected languages
2866cannot complete until the next time the garbage collector runs,
2867which does not seem at all reasonable.
2868The key point is that in most cases, an updater using either
2869<tt>call_rcu()</tt> or <tt>kfree_rcu()</tt> can proceed to the
2870next update as soon as it has invoked <tt>call_rcu()</tt> or
2871<tt>kfree_rcu()</tt>, without having to wait for a subsequent
2872grace period.
2873
2874
2875</p><p><a href="#Quick%20Quiz%2013"><b>Back to Quick Quiz 13</b>.</a>
2876
2877<a name="qq14answer"></a>
2878<p><b>Quick Quiz 14</b>:
2879So what happens with <tt>synchronize_rcu()</tt> during
2880scheduler initialization for <tt>CONFIG_PREEMPT=n</tt>
2881kernels?
2882
2883
2884</p><p><b>Answer</b>:
2885In <tt>CONFIG_PREEMPT=n</tt> kernel, <tt>synchronize_rcu()</tt>
2886maps directly to <tt>synchronize_sched()</tt>.
2887Therefore, <tt>synchronize_rcu()</tt> works normally throughout
2888boot in <tt>CONFIG_PREEMPT=n</tt> kernels.
2889However, your code must also work in <tt>CONFIG_PREEMPT=y</tt> kernels,
2890so it is still necessary to avoid invoking <tt>synchronize_rcu()</tt>
2891during scheduler initialization.
2892
2893
2894</p><p><a href="#Quick%20Quiz%2014"><b>Back to Quick Quiz 14</b>.</a>
2895
2896
2897</body></html>
diff --git a/Documentation/RCU/Design/Requirements/Requirements.htmlx b/Documentation/RCU/Design/Requirements/Requirements.htmlx
new file mode 100644
index 000000000000..3a97ba490c42
--- /dev/null
+++ b/Documentation/RCU/Design/Requirements/Requirements.htmlx
@@ -0,0 +1,2741 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3 <html>
4 <head><title>A Tour Through RCU's Requirements [LWN.net]</title>
5 <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
6
7<h1>A Tour Through RCU's Requirements</h1>
8
9<p>Copyright IBM Corporation, 2015</p>
10<p>Author: Paul E.&nbsp;McKenney</p>
11<p><i>The initial version of this document appeared in the
12<a href="https://lwn.net/">LWN</a> articles
13<a href="https://lwn.net/Articles/652156/">here</a>,
14<a href="https://lwn.net/Articles/652677/">here</a>, and
15<a href="https://lwn.net/Articles/653326/">here</a>.</i></p>
16
17<h2>Introduction</h2>
18
19<p>
20Read-copy update (RCU) is a synchronization mechanism that is often
21used as a replacement for reader-writer locking.
22RCU is unusual in that updaters do not block readers,
23which means that RCU's read-side primitives can be exceedingly fast
24and scalable.
25In addition, updaters can make useful forward progress concurrently
26with readers.
27However, all this concurrency between RCU readers and updaters does raise
28the question of exactly what RCU readers are doing, which in turn
29raises the question of exactly what RCU's requirements are.
30
31<p>
32This document therefore summarizes RCU's requirements, and can be thought
33of as an informal, high-level specification for RCU.
34It is important to understand that RCU's specification is primarily
35empirical in nature;
36in fact, I learned about many of these requirements the hard way.
37This situation might cause some consternation, however, not only
38has this learning process been a lot of fun, but it has also been
39a great privilege to work with so many people willing to apply
40technologies in interesting new ways.
41
42<p>
43All that aside, here are the categories of currently known RCU requirements:
44</p>
45
46<ol>
47<li> <a href="#Fundamental Requirements">
48 Fundamental Requirements</a>
49<li> <a href="#Fundamental Non-Requirements">Fundamental Non-Requirements</a>
50<li> <a href="#Parallelism Facts of Life">
51 Parallelism Facts of Life</a>
52<li> <a href="#Quality-of-Implementation Requirements">
53 Quality-of-Implementation Requirements</a>
54<li> <a href="#Linux Kernel Complications">
55 Linux Kernel Complications</a>
56<li> <a href="#Software-Engineering Requirements">
57 Software-Engineering Requirements</a>
58<li> <a href="#Other RCU Flavors">
59 Other RCU Flavors</a>
60<li> <a href="#Possible Future Changes">
61 Possible Future Changes</a>
62</ol>
63
64<p>
65This is followed by a <a href="#Summary">summary</a>,
66which is in turn followed by the inevitable
67<a href="#Answers to Quick Quizzes">answers to the quick quizzes</a>.
68
69<h2><a name="Fundamental Requirements">Fundamental Requirements</a></h2>
70
71<p>
72RCU's fundamental requirements are the closest thing RCU has to hard
73mathematical requirements.
74These are:
75
76<ol>
77<li> <a href="#Grace-Period Guarantee">
78 Grace-Period Guarantee</a>
79<li> <a href="#Publish-Subscribe Guarantee">
80 Publish-Subscribe Guarantee</a>
81<li> <a href="#Memory-Barrier Guarantees">
82 Memory-Barrier Guarantees</a>
83<li> <a href="#RCU Primitives Guaranteed to Execute Unconditionally">
84 RCU Primitives Guaranteed to Execute Unconditionally</a>
85<li> <a href="#Guaranteed Read-to-Write Upgrade">
86 Guaranteed Read-to-Write Upgrade</a>
87</ol>
88
89<h3><a name="Grace-Period Guarantee">Grace-Period Guarantee</a></h3>
90
91<p>
92RCU's grace-period guarantee is unusual in being premeditated:
93Jack Slingwine and I had this guarantee firmly in mind when we started
94work on RCU (then called &ldquo;rclock&rdquo;) in the early 1990s.
95That said, the past two decades of experience with RCU have produced
96a much more detailed understanding of this guarantee.
97
98<p>
99RCU's grace-period guarantee allows updaters to wait for the completion
100of all pre-existing RCU read-side critical sections.
101An RCU read-side critical section
102begins with the marker <tt>rcu_read_lock()</tt> and ends with
103the marker <tt>rcu_read_unlock()</tt>.
104These markers may be nested, and RCU treats a nested set as one
105big RCU read-side critical section.
106Production-quality implementations of <tt>rcu_read_lock()</tt> and
107<tt>rcu_read_unlock()</tt> are extremely lightweight, and in
108fact have exactly zero overhead in Linux kernels built for production
109use with <tt>CONFIG_PREEMPT=n</tt>.
110
111<p>
112This guarantee allows ordering to be enforced with extremely low
113overhead to readers, for example:
114
115<blockquote>
116<pre>
117 1 int x, y;
118 2
119 3 void thread0(void)
120 4 {
121 5 rcu_read_lock();
122 6 r1 = READ_ONCE(x);
123 7 r2 = READ_ONCE(y);
124 8 rcu_read_unlock();
125 9 }
12610
12711 void thread1(void)
12812 {
12913 WRITE_ONCE(x, 1);
13014 synchronize_rcu();
13115 WRITE_ONCE(y, 1);
13216 }
133</pre>
134</blockquote>
135
136<p>
137Because the <tt>synchronize_rcu()</tt> on line&nbsp;14 waits for
138all pre-existing readers, any instance of <tt>thread0()</tt> that
139loads a value of zero from <tt>x</tt> must complete before
140<tt>thread1()</tt> stores to <tt>y</tt>, so that instance must
141also load a value of zero from <tt>y</tt>.
142Similarly, any instance of <tt>thread0()</tt> that loads a value of
143one from <tt>y</tt> must have started after the
144<tt>synchronize_rcu()</tt> started, and must therefore also load
145a value of one from <tt>x</tt>.
146Therefore, the outcome:
147<blockquote>
148<pre>
149(r1 == 0 &amp;&amp; r2 == 1)
150</pre>
151</blockquote>
152cannot happen.
153
154<p>@@QQ@@
155Wait a minute!
156You said that updaters can make useful forward progress concurrently
157with readers, but pre-existing readers will block
158<tt>synchronize_rcu()</tt>!!!
159Just who are you trying to fool???
160<p>@@QQA@@
161First, if updaters do not wish to be blocked by readers, they can use
162<tt>call_rcu()</tt> or <tt>kfree_rcu()</tt>, which will
163be discussed later.
164Second, even when using <tt>synchronize_rcu()</tt>, the other
165update-side code does run concurrently with readers, whether pre-existing
166or not.
167<p>@@QQE@@
168
169<p>
170This scenario resembles one of the first uses of RCU in
171<a href="https://en.wikipedia.org/wiki/DYNIX">DYNIX/ptx</a>,
172which managed a distributed lock manager's transition into
173a state suitable for handling recovery from node failure,
174more or less as follows:
175
176<blockquote>
177<pre>
178 1 #define STATE_NORMAL 0
179 2 #define STATE_WANT_RECOVERY 1
180 3 #define STATE_RECOVERING 2
181 4 #define STATE_WANT_NORMAL 3
182 5
183 6 int state = STATE_NORMAL;
184 7
185 8 void do_something_dlm(void)
186 9 {
18710 int state_snap;
18811
18912 rcu_read_lock();
19013 state_snap = READ_ONCE(state);
19114 if (state_snap == STATE_NORMAL)
19215 do_something();
19316 else
19417 do_something_carefully();
19518 rcu_read_unlock();
19619 }
19720
19821 void start_recovery(void)
19922 {
20023 WRITE_ONCE(state, STATE_WANT_RECOVERY);
20124 synchronize_rcu();
20225 WRITE_ONCE(state, STATE_RECOVERING);
20326 recovery();
20427 WRITE_ONCE(state, STATE_WANT_NORMAL);
20528 synchronize_rcu();
20629 WRITE_ONCE(state, STATE_NORMAL);
20730 }
208</pre>
209</blockquote>
210
211<p>
212The RCU read-side critical section in <tt>do_something_dlm()</tt>
213works with the <tt>synchronize_rcu()</tt> in <tt>start_recovery()</tt>
214to guarantee that <tt>do_something()</tt> never runs concurrently
215with <tt>recovery()</tt>, but with little or no synchronization
216overhead in <tt>do_something_dlm()</tt>.
217
218<p>@@QQ@@
219Why is the <tt>synchronize_rcu()</tt> on line&nbsp;28 needed?
220<p>@@QQA@@
221Without that extra grace period, memory reordering could result in
222<tt>do_something_dlm()</tt> executing <tt>do_something()</tt>
223concurrently with the last bits of <tt>recovery()</tt>.
224<p>@@QQE@@
225
226<p>
227In order to avoid fatal problems such as deadlocks,
228an RCU read-side critical section must not contain calls to
229<tt>synchronize_rcu()</tt>.
230Similarly, an RCU read-side critical section must not
231contain anything that waits, directly or indirectly, on completion of
232an invocation of <tt>synchronize_rcu()</tt>.
233
234<p>
235Although RCU's grace-period guarantee is useful in and of itself, with
236<a href="https://lwn.net/Articles/573497/">quite a few use cases</a>,
237it would be good to be able to use RCU to coordinate read-side
238access to linked data structures.
239For this, the grace-period guarantee is not sufficient, as can
240be seen in function <tt>add_gp_buggy()</tt> below.
241We will look at the reader's code later, but in the meantime, just think of
242the reader as locklessly picking up the <tt>gp</tt> pointer,
243and, if the value loaded is non-<tt>NULL</tt>, locklessly accessing the
244<tt>-&gt;a</tt> and <tt>-&gt;b</tt> fields.
245
246<blockquote>
247<pre>
248 1 bool add_gp_buggy(int a, int b)
249 2 {
250 3 p = kmalloc(sizeof(*p), GFP_KERNEL);
251 4 if (!p)
252 5 return -ENOMEM;
253 6 spin_lock(&amp;gp_lock);
254 7 if (rcu_access_pointer(gp)) {
255 8 spin_unlock(&amp;gp_lock);
256 9 return false;
25710 }
25811 p-&gt;a = a;
25912 p-&gt;b = a;
26013 gp = p; /* ORDERING BUG */
26114 spin_unlock(&amp;gp_lock);
26215 return true;
26316 }
264</pre>
265</blockquote>
266
267<p>
268The problem is that both the compiler and weakly ordered CPUs are within
269their rights to reorder this code as follows:
270
271<blockquote>
272<pre>
273 1 bool add_gp_buggy_optimized(int a, int b)
274 2 {
275 3 p = kmalloc(sizeof(*p), GFP_KERNEL);
276 4 if (!p)
277 5 return -ENOMEM;
278 6 spin_lock(&amp;gp_lock);
279 7 if (rcu_access_pointer(gp)) {
280 8 spin_unlock(&amp;gp_lock);
281 9 return false;
28210 }
283<b>11 gp = p; /* ORDERING BUG */
28412 p-&gt;a = a;
28513 p-&gt;b = a;</b>
28614 spin_unlock(&amp;gp_lock);
28715 return true;
28816 }
289</pre>
290</blockquote>
291
292<p>
293If an RCU reader fetches <tt>gp</tt> just after
294<tt>add_gp_buggy_optimized</tt> executes line&nbsp;11,
295it will see garbage in the <tt>-&gt;a</tt> and <tt>-&gt;b</tt>
296fields.
297And this is but one of many ways in which compiler and hardware optimizations
298could cause trouble.
299Therefore, we clearly need some way to prevent the compiler and the CPU from
300reordering in this manner, which brings us to the publish-subscribe
301guarantee discussed in the next section.
302
303<h3><a name="Publish-Subscribe Guarantee">Publish/Subscribe Guarantee</a></h3>
304
305<p>
306RCU's publish-subscribe guarantee allows data to be inserted
307into a linked data structure without disrupting RCU readers.
308The updater uses <tt>rcu_assign_pointer()</tt> to insert the
309new data, and readers use <tt>rcu_dereference()</tt> to
310access data, whether new or old.
311The following shows an example of insertion:
312
313<blockquote>
314<pre>
315 1 bool add_gp(int a, int b)
316 2 {
317 3 p = kmalloc(sizeof(*p), GFP_KERNEL);
318 4 if (!p)
319 5 return -ENOMEM;
320 6 spin_lock(&amp;gp_lock);
321 7 if (rcu_access_pointer(gp)) {
322 8 spin_unlock(&amp;gp_lock);
323 9 return false;
32410 }
32511 p-&gt;a = a;
32612 p-&gt;b = a;
32713 rcu_assign_pointer(gp, p);
32814 spin_unlock(&amp;gp_lock);
32915 return true;
33016 }
331</pre>
332</blockquote>
333
334<p>
335The <tt>rcu_assign_pointer()</tt> on line&nbsp;13 is conceptually
336equivalent to a simple assignment statement, but also guarantees
337that its assignment will
338happen after the two assignments in lines&nbsp;11 and&nbsp;12,
339similar to the C11 <tt>memory_order_release</tt> store operation.
340It also prevents any number of &ldquo;interesting&rdquo; compiler
341optimizations, for example, the use of <tt>gp</tt> as a scratch
342location immediately preceding the assignment.
343
344<p>@@QQ@@
345But <tt>rcu_assign_pointer()</tt> does nothing to prevent the
346two assignments to <tt>p-&gt;a</tt> and <tt>p-&gt;b</tt>
347from being reordered.
348Can't that also cause problems?
349<p>@@QQA@@
350No, it cannot.
351The readers cannot see either of these two fields until
352the assignment to <tt>gp</tt>, by which time both fields are
353fully initialized.
354So reordering the assignments
355to <tt>p-&gt;a</tt> and <tt>p-&gt;b</tt> cannot possibly
356cause any problems.
357<p>@@QQE@@
358
359<p>
360It is tempting to assume that the reader need not do anything special
361to control its accesses to the RCU-protected data,
362as shown in <tt>do_something_gp_buggy()</tt> below:
363
364<blockquote>
365<pre>
366 1 bool do_something_gp_buggy(void)
367 2 {
368 3 rcu_read_lock();
369 4 p = gp; /* OPTIMIZATIONS GALORE!!! */
370 5 if (p) {
371 6 do_something(p-&gt;a, p-&gt;b);
372 7 rcu_read_unlock();
373 8 return true;
374 9 }
37510 rcu_read_unlock();
37611 return false;
37712 }
378</pre>
379</blockquote>
380
381<p>
382However, this temptation must be resisted because there are a
383surprisingly large number of ways that the compiler
384(to say nothing of
385<a href="https://h71000.www7.hp.com/wizard/wiz_2637.html">DEC Alpha CPUs</a>)
386can trip this code up.
387For but one example, if the compiler were short of registers, it
388might choose to refetch from <tt>gp</tt> rather than keeping
389a separate copy in <tt>p</tt> as follows:
390
391<blockquote>
392<pre>
393 1 bool do_something_gp_buggy_optimized(void)
394 2 {
395 3 rcu_read_lock();
396 4 if (gp) { /* OPTIMIZATIONS GALORE!!! */
397<b> 5 do_something(gp-&gt;a, gp-&gt;b);</b>
398 6 rcu_read_unlock();
399 7 return true;
400 8 }
401 9 rcu_read_unlock();
40210 return false;
40311 }
404</pre>
405</blockquote>
406
407<p>
408If this function ran concurrently with a series of updates that
409replaced the current structure with a new one,
410the fetches of <tt>gp-&gt;a</tt>
411and <tt>gp-&gt;b</tt> might well come from two different structures,
412which could cause serious confusion.
413To prevent this (and much else besides), <tt>do_something_gp()</tt> uses
414<tt>rcu_dereference()</tt> to fetch from <tt>gp</tt>:
415
416<blockquote>
417<pre>
418 1 bool do_something_gp(void)
419 2 {
420 3 rcu_read_lock();
421 4 p = rcu_dereference(gp);
422 5 if (p) {
423 6 do_something(p-&gt;a, p-&gt;b);
424 7 rcu_read_unlock();
425 8 return true;
426 9 }
42710 rcu_read_unlock();
42811 return false;
42912 }
430</pre>
431</blockquote>
432
433<p>
434The <tt>rcu_dereference()</tt> uses volatile casts and (for DEC Alpha)
435memory barriers in the Linux kernel.
436Should a
437<a href="http://www.rdrop.com/users/paulmck/RCU/consume.2015.07.13a.pdf">high-quality implementation of C11 <tt>memory_order_consume</tt> [PDF]</a>
438ever appear, then <tt>rcu_dereference()</tt> could be implemented
439as a <tt>memory_order_consume</tt> load.
440Regardless of the exact implementation, a pointer fetched by
441<tt>rcu_dereference()</tt> may not be used outside of the
442outermost RCU read-side critical section containing that
443<tt>rcu_dereference()</tt>, unless protection of
444the corresponding data element has been passed from RCU to some
445other synchronization mechanism, most commonly locking or
446<a href="https://www.kernel.org/doc/Documentation/RCU/rcuref.txt">reference counting</a>.
447
448<p>
449In short, updaters use <tt>rcu_assign_pointer()</tt> and readers
450use <tt>rcu_dereference()</tt>, and these two RCU API elements
451work together to ensure that readers have a consistent view of
452newly added data elements.
453
454<p>
455Of course, it is also necessary to remove elements from RCU-protected
456data structures, for example, using the following process:
457
458<ol>
459<li> Remove the data element from the enclosing structure.
460<li> Wait for all pre-existing RCU read-side critical sections
461 to complete (because only pre-existing readers can possibly have
462 a reference to the newly removed data element).
463<li> At this point, only the updater has a reference to the
464 newly removed data element, so it can safely reclaim
465 the data element, for example, by passing it to <tt>kfree()</tt>.
466</ol>
467
468This process is implemented by <tt>remove_gp_synchronous()</tt>:
469
470<blockquote>
471<pre>
472 1 bool remove_gp_synchronous(void)
473 2 {
474 3 struct foo *p;
475 4
476 5 spin_lock(&amp;gp_lock);
477 6 p = rcu_access_pointer(gp);
478 7 if (!p) {
479 8 spin_unlock(&amp;gp_lock);
480 9 return false;
48110 }
48211 rcu_assign_pointer(gp, NULL);
48312 spin_unlock(&amp;gp_lock);
48413 synchronize_rcu();
48514 kfree(p);
48615 return true;
48716 }
488</pre>
489</blockquote>
490
491<p>
492This function is straightforward, with line&nbsp;13 waiting for a grace
493period before line&nbsp;14 frees the old data element.
494This waiting ensures that readers will reach line&nbsp;7 of
495<tt>do_something_gp()</tt> before the data element referenced by
496<tt>p</tt> is freed.
497The <tt>rcu_access_pointer()</tt> on line&nbsp;6 is similar to
498<tt>rcu_dereference()</tt>, except that:
499
500<ol>
501<li> The value returned by <tt>rcu_access_pointer()</tt>
502 cannot be dereferenced.
503 If you want to access the value pointed to as well as
504 the pointer itself, use <tt>rcu_dereference()</tt>
505 instead of <tt>rcu_access_pointer()</tt>.
506<li> The call to <tt>rcu_access_pointer()</tt> need not be
507 protected.
508 In contrast, <tt>rcu_dereference()</tt> must either be
509 within an RCU read-side critical section or in a code
510 segment where the pointer cannot change, for example, in
511 code protected by the corresponding update-side lock.
512</ol>
513
514<p>@@QQ@@
515Without the <tt>rcu_dereference()</tt> or the
516<tt>rcu_access_pointer()</tt>, what destructive optimizations
517might the compiler make use of?
518<p>@@QQA@@
519Let's start with what happens to <tt>do_something_gp()</tt>
520if it fails to use <tt>rcu_dereference()</tt>.
521It could reuse a value formerly fetched from this same pointer.
522It could also fetch the pointer from <tt>gp</tt> in a byte-at-a-time
523manner, resulting in <i>load tearing</i>, in turn resulting a bytewise
524mash-up of two distince pointer values.
525It might even use value-speculation optimizations, where it makes a wrong
526guess, but by the time it gets around to checking the value, an update
527has changed the pointer to match the wrong guess.
528Too bad about any dereferences that returned pre-initialization garbage
529in the meantime!
530
531<p>
532For <tt>remove_gp_synchronous()</tt>, as long as all modifications
533to <tt>gp</tt> are carried out while holding <tt>gp_lock</tt>,
534the above optimizations are harmless.
535However,
536with <tt>CONFIG_SPARSE_RCU_POINTER=y</tt>,
537<tt>sparse</tt> will complain if you
538define <tt>gp</tt> with <tt>__rcu</tt> and then
539access it without using
540either <tt>rcu_access_pointer()</tt> or <tt>rcu_dereference()</tt>.
541<p>@@QQE@@
542
543<p>
544In short, RCU's publish-subscribe guarantee is provided by the combination
545of <tt>rcu_assign_pointer()</tt> and <tt>rcu_dereference()</tt>.
546This guarantee allows data elements to be safely added to RCU-protected
547linked data structures without disrupting RCU readers.
548This guarantee can be used in combination with the grace-period
549guarantee to also allow data elements to be removed from RCU-protected
550linked data structures, again without disrupting RCU readers.
551
552<p>
553This guarantee was only partially premeditated.
554DYNIX/ptx used an explicit memory barrier for publication, but had nothing
555resembling <tt>rcu_dereference()</tt> for subscription, nor did it
556have anything resembling the <tt>smp_read_barrier_depends()</tt>
557that was later subsumed into <tt>rcu_dereference()</tt>.
558The need for these operations made itself known quite suddenly at a
559late-1990s meeting with the DEC Alpha architects, back in the days when
560DEC was still a free-standing company.
561It took the Alpha architects a good hour to convince me that any sort
562of barrier would ever be needed, and it then took me a good <i>two</i> hours
563to convince them that their documentation did not make this point clear.
564More recent work with the C and C++ standards committees have provided
565much education on tricks and traps from the compiler.
566In short, compilers were much less tricky in the early 1990s, but in
5672015, don't even think about omitting <tt>rcu_dereference()</tt>!
568
569<h3><a name="Memory-Barrier Guarantees">Memory-Barrier Guarantees</a></h3>
570
571<p>
572The previous section's simple linked-data-structure scenario clearly
573demonstrates the need for RCU's stringent memory-ordering guarantees on
574systems with more than one CPU:
575
576<ol>
577<li> Each CPU that has an RCU read-side critical section that
578 begins before <tt>synchronize_rcu()</tt> starts is
579 guaranteed to execute a full memory barrier between the time
580 that the RCU read-side critical section ends and the time that
581 <tt>synchronize_rcu()</tt> returns.
582 Without this guarantee, a pre-existing RCU read-side critical section
583 might hold a reference to the newly removed <tt>struct foo</tt>
584 after the <tt>kfree()</tt> on line&nbsp;14 of
585 <tt>remove_gp_synchronous()</tt>.
586<li> Each CPU that has an RCU read-side critical section that ends
587 after <tt>synchronize_rcu()</tt> returns is guaranteed
588 to execute a full memory barrier between the time that
589 <tt>synchronize_rcu()</tt> begins and the time that the RCU
590 read-side critical section begins.
591 Without this guarantee, a later RCU read-side critical section
592 running after the <tt>kfree()</tt> on line&nbsp;14 of
593 <tt>remove_gp_synchronous()</tt> might
594 later run <tt>do_something_gp()</tt> and find the
595 newly deleted <tt>struct foo</tt>.
596<li> If the task invoking <tt>synchronize_rcu()</tt> remains
597 on a given CPU, then that CPU is guaranteed to execute a full
598 memory barrier sometime during the execution of
599 <tt>synchronize_rcu()</tt>.
600 This guarantee ensures that the <tt>kfree()</tt> on
601 line&nbsp;14 of <tt>remove_gp_synchronous()</tt> really does
602 execute after the removal on line&nbsp;11.
603<li> If the task invoking <tt>synchronize_rcu()</tt> migrates
604 among a group of CPUs during that invocation, then each of the
605 CPUs in that group is guaranteed to execute a full memory barrier
606 sometime during the execution of <tt>synchronize_rcu()</tt>.
607 This guarantee also ensures that the <tt>kfree()</tt> on
608 line&nbsp;14 of <tt>remove_gp_synchronous()</tt> really does
609 execute after the removal on
610 line&nbsp;11, but also in the case where the thread executing the
611 <tt>synchronize_rcu()</tt> migrates in the meantime.
612</ol>
613
614<p>@@QQ@@
615Given that multiple CPUs can start RCU read-side critical sections
616at any time without any ordering whatsoever, how can RCU possibly tell whether
617or not a given RCU read-side critical section starts before a
618given instance of <tt>synchronize_rcu()</tt>?
619<p>@@QQA@@
620If RCU cannot tell whether or not a given
621RCU read-side critical section starts before a
622given instance of <tt>synchronize_rcu()</tt>,
623then it must assume that the RCU read-side critical section
624started first.
625In other words, a given instance of <tt>synchronize_rcu()</tt>
626can avoid waiting on a given RCU read-side critical section only
627if it can prove that <tt>synchronize_rcu()</tt> started first.
628<p>@@QQE@@
629
630<p>@@QQ@@
631The first and second guarantees require unbelievably strict ordering!
632Are all these memory barriers <i> really</i> required?
633<p>@@QQA@@
634Yes, they really are required.
635To see why the first guarantee is required, consider the following
636sequence of events:
637
638<ol>
639<li> CPU 1: <tt>rcu_read_lock()</tt>
640<li> CPU 1: <tt>q = rcu_dereference(gp);
641 /* Very likely to return p. */</tt>
642<li> CPU 0: <tt>list_del_rcu(p);</tt>
643<li> CPU 0: <tt>synchronize_rcu()</tt> starts.
644<li> CPU 1: <tt>do_something_with(q-&gt;a);
645 /* No smp_mb(), so might happen after kfree(). */</tt>
646<li> CPU 1: <tt>rcu_read_unlock()</tt>
647<li> CPU 0: <tt>synchronize_rcu()</tt> returns.
648<li> CPU 0: <tt>kfree(p);</tt>
649</ol>
650
651<p>
652Therefore, there absolutely must be a full memory barrier between the
653end of the RCU read-side critical section and the end of the
654grace period.
655
656<p>
657The sequence of events demonstrating the necessity of the second rule
658is roughly similar:
659
660<ol>
661<li> CPU 0: <tt>list_del_rcu(p);</tt>
662<li> CPU 0: <tt>synchronize_rcu()</tt> starts.
663<li> CPU 1: <tt>rcu_read_lock()</tt>
664<li> CPU 1: <tt>q = rcu_dereference(gp);
665 /* Might return p if no memory barrier. */</tt>
666<li> CPU 0: <tt>synchronize_rcu()</tt> returns.
667<li> CPU 0: <tt>kfree(p);</tt>
668<li> CPU 1: <tt>do_something_with(q-&gt;a); /* Boom!!! */</tt>
669<li> CPU 1: <tt>rcu_read_unlock()</tt>
670</ol>
671
672<p>
673And similarly, without a memory barrier between the beginning of the
674grace period and the beginning of the RCU read-side critical section,
675CPU&nbsp;1 might end up accessing the freelist.
676
677<p>
678The &ldquo;as if&rdquo; rule of course applies, so that any implementation
679that acts as if the appropriate memory barriers were in place is a
680correct implementation.
681That said, it is much easier to fool yourself into believing that you have
682adhered to the as-if rule than it is to actually adhere to it!
683<p>@@QQE@@
684
685<p>
686Note that these memory-barrier requirements do not replace the fundamental
687RCU requirement that a grace period wait for all pre-existing readers.
688On the contrary, the memory barriers called out in this section must operate in
689such a way as to <i>enforce</i> this fundamental requirement.
690Of course, different implementations enforce this requirement in different
691ways, but enforce it they must.
692
693<h3><a name="RCU Primitives Guaranteed to Execute Unconditionally">RCU Primitives Guaranteed to Execute Unconditionally</a></h3>
694
695<p>
696The common-case RCU primitives are unconditional.
697They are invoked, they do their job, and they return, with no possibility
698of error, and no need to retry.
699This is a key RCU design philosophy.
700
701<p>
702However, this philosophy is pragmatic rather than pigheaded.
703If someone comes up with a good justification for a particular conditional
704RCU primitive, it might well be implemented and added.
705After all, this guarantee was reverse-engineered, not premeditated.
706The unconditional nature of the RCU primitives was initially an
707accident of implementation, and later experience with synchronization
708primitives with conditional primitives caused me to elevate this
709accident to a guarantee.
710Therefore, the justification for adding a conditional primitive to
711RCU would need to be based on detailed and compelling use cases.
712
713<h3><a name="Guaranteed Read-to-Write Upgrade">Guaranteed Read-to-Write Upgrade</a></h3>
714
715<p>
716As far as RCU is concerned, it is always possible to carry out an
717update within an RCU read-side critical section.
718For example, that RCU read-side critical section might search for
719a given data element, and then might acquire the update-side
720spinlock in order to update that element, all while remaining
721in that RCU read-side critical section.
722Of course, it is necessary to exit the RCU read-side critical section
723before invoking <tt>synchronize_rcu()</tt>, however, this
724inconvenience can be avoided through use of the
725<tt>call_rcu()</tt> and <tt>kfree_rcu()</tt> API members
726described later in this document.
727
728<p>@@QQ@@
729But how does the upgrade-to-write operation exclude other readers?
730<p>@@QQA@@
731It doesn't, just like normal RCU updates, which also do not exclude
732RCU readers.
733<p>@@QQE@@
734
735<p>
736This guarantee allows lookup code to be shared between read-side
737and update-side code, and was premeditated, appearing in the earliest
738DYNIX/ptx RCU documentation.
739
740<h2><a name="Fundamental Non-Requirements">Fundamental Non-Requirements</a></h2>
741
742<p>
743RCU provides extremely lightweight readers, and its read-side guarantees,
744though quite useful, are correspondingly lightweight.
745It is therefore all too easy to assume that RCU is guaranteeing more
746than it really is.
747Of course, the list of things that RCU does not guarantee is infinitely
748long, however, the following sections list a few non-guarantees that
749have caused confusion.
750Except where otherwise noted, these non-guarantees were premeditated.
751
752<ol>
753<li> <a href="#Readers Impose Minimal Ordering">
754 Readers Impose Minimal Ordering</a>
755<li> <a href="#Readers Do Not Exclude Updaters">
756 Readers Do Not Exclude Updaters</a>
757<li> <a href="#Updaters Only Wait For Old Readers">
758 Updaters Only Wait For Old Readers</a>
759<li> <a href="#Grace Periods Don't Partition Read-Side Critical Sections">
760 Grace Periods Don't Partition Read-Side Critical Sections</a>
761<li> <a href="#Read-Side Critical Sections Don't Partition Grace Periods">
762 Read-Side Critical Sections Don't Partition Grace Periods</a>
763<li> <a href="#Disabling Preemption Does Not Block Grace Periods">
764 Disabling Preemption Does Not Block Grace Periods</a>
765</ol>
766
767<h3><a name="Readers Impose Minimal Ordering">Readers Impose Minimal Ordering</a></h3>
768
769<p>
770Reader-side markers such as <tt>rcu_read_lock()</tt> and
771<tt>rcu_read_unlock()</tt> provide absolutely no ordering guarantees
772except through their interaction with the grace-period APIs such as
773<tt>synchronize_rcu()</tt>.
774To see this, consider the following pair of threads:
775
776<blockquote>
777<pre>
778 1 void thread0(void)
779 2 {
780 3 rcu_read_lock();
781 4 WRITE_ONCE(x, 1);
782 5 rcu_read_unlock();
783 6 rcu_read_lock();
784 7 WRITE_ONCE(y, 1);
785 8 rcu_read_unlock();
786 9 }
78710
78811 void thread1(void)
78912 {
79013 rcu_read_lock();
79114 r1 = READ_ONCE(y);
79215 rcu_read_unlock();
79316 rcu_read_lock();
79417 r2 = READ_ONCE(x);
79518 rcu_read_unlock();
79619 }
797</pre>
798</blockquote>
799
800<p>
801After <tt>thread0()</tt> and <tt>thread1()</tt> execute
802concurrently, it is quite possible to have
803
804<blockquote>
805<pre>
806(r1 == 1 &amp;&amp; r2 == 0)
807</pre>
808</blockquote>
809
810(that is, <tt>y</tt> appears to have been assigned before <tt>x</tt>),
811which would not be possible if <tt>rcu_read_lock()</tt> and
812<tt>rcu_read_unlock()</tt> had much in the way of ordering
813properties.
814But they do not, so the CPU is within its rights
815to do significant reordering.
816This is by design: Any significant ordering constraints would slow down
817these fast-path APIs.
818
819<p>@@QQ@@
820Can't the compiler also reorder this code?
821<p>@@QQA@@
822No, the volatile casts in <tt>READ_ONCE()</tt> and
823<tt>WRITE_ONCE()</tt> prevent the compiler from reordering in
824this particular case.
825<p>@@QQE@@
826
827<h3><a name="Readers Do Not Exclude Updaters">Readers Do Not Exclude Updaters</a></h3>
828
829<p>
830Neither <tt>rcu_read_lock()</tt> nor <tt>rcu_read_unlock()</tt>
831exclude updates.
832All they do is to prevent grace periods from ending.
833The following example illustrates this:
834
835<blockquote>
836<pre>
837 1 void thread0(void)
838 2 {
839 3 rcu_read_lock();
840 4 r1 = READ_ONCE(y);
841 5 if (r1) {
842 6 do_something_with_nonzero_x();
843 7 r2 = READ_ONCE(x);
844 8 WARN_ON(!r2); /* BUG!!! */
845 9 }
84610 rcu_read_unlock();
84711 }
84812
84913 void thread1(void)
85014 {
85115 spin_lock(&amp;my_lock);
85216 WRITE_ONCE(x, 1);
85317 WRITE_ONCE(y, 1);
85418 spin_unlock(&amp;my_lock);
85519 }
856</pre>
857</blockquote>
858
859<p>
860If the <tt>thread0()</tt> function's <tt>rcu_read_lock()</tt>
861excluded the <tt>thread1()</tt> function's update,
862the <tt>WARN_ON()</tt> could never fire.
863But the fact is that <tt>rcu_read_lock()</tt> does not exclude
864much of anything aside from subsequent grace periods, of which
865<tt>thread1()</tt> has none, so the
866<tt>WARN_ON()</tt> can and does fire.
867
868<h3><a name="Updaters Only Wait For Old Readers">Updaters Only Wait For Old Readers</a></h3>
869
870<p>
871It might be tempting to assume that after <tt>synchronize_rcu()</tt>
872completes, there are no readers executing.
873This temptation must be avoided because
874new readers can start immediately after <tt>synchronize_rcu()</tt>
875starts, and <tt>synchronize_rcu()</tt> is under no
876obligation to wait for these new readers.
877
878<p>@@QQ@@
879Suppose that synchronize_rcu() did wait until all readers had completed.
880Would the updater be able to rely on this?
881<p>@@QQA@@
882No.
883Even if <tt>synchronize_rcu()</tt> were to wait until
884all readers had completed, a new reader might start immediately after
885<tt>synchronize_rcu()</tt> completed.
886Therefore, the code following
887<tt>synchronize_rcu()</tt> cannot rely on there being no readers
888in any case.
889<p>@@QQE@@
890
891<h3><a name="Grace Periods Don't Partition Read-Side Critical Sections">
892Grace Periods Don't Partition Read-Side Critical Sections</a></h3>
893
894<p>
895It is tempting to assume that if any part of one RCU read-side critical
896section precedes a given grace period, and if any part of another RCU
897read-side critical section follows that same grace period, then all of
898the first RCU read-side critical section must precede all of the second.
899However, this just isn't the case: A single grace period does not
900partition the set of RCU read-side critical sections.
901An example of this situation can be illustrated as follows, where
902<tt>x</tt>, <tt>y</tt>, and <tt>z</tt> are initially all zero:
903
904<blockquote>
905<pre>
906 1 void thread0(void)
907 2 {
908 3 rcu_read_lock();
909 4 WRITE_ONCE(a, 1);
910 5 WRITE_ONCE(b, 1);
911 6 rcu_read_unlock();
912 7 }
913 8
914 9 void thread1(void)
91510 {
91611 r1 = READ_ONCE(a);
91712 synchronize_rcu();
91813 WRITE_ONCE(c, 1);
91914 }
92015
92116 void thread2(void)
92217 {
92318 rcu_read_lock();
92419 r2 = READ_ONCE(b);
92520 r3 = READ_ONCE(c);
92621 rcu_read_unlock();
92722 }
928</pre>
929</blockquote>
930
931<p>
932It turns out that the outcome:
933
934<blockquote>
935<pre>
936(r1 == 1 &amp;&amp; r2 == 0 &amp;&amp; r3 == 1)
937</pre>
938</blockquote>
939
940is entirely possible.
941The following figure show how this can happen, with each circled
942<tt>QS</tt> indicating the point at which RCU recorded a
943<i>quiescent state</i> for each thread, that is, a state in which
944RCU knows that the thread cannot be in the midst of an RCU read-side
945critical section that started before the current grace period:
946
947<p><img src="GPpartitionReaders1.svg" alt="GPpartitionReaders1.svg" width="60%"></p>
948
949<p>
950If it is necessary to partition RCU read-side critical sections in this
951manner, it is necessary to use two grace periods, where the first
952grace period is known to end before the second grace period starts:
953
954<blockquote>
955<pre>
956 1 void thread0(void)
957 2 {
958 3 rcu_read_lock();
959 4 WRITE_ONCE(a, 1);
960 5 WRITE_ONCE(b, 1);
961 6 rcu_read_unlock();
962 7 }
963 8
964 9 void thread1(void)
96510 {
96611 r1 = READ_ONCE(a);
96712 synchronize_rcu();
96813 WRITE_ONCE(c, 1);
96914 }
97015
97116 void thread2(void)
97217 {
97318 r2 = READ_ONCE(c);
97419 synchronize_rcu();
97520 WRITE_ONCE(d, 1);
97621 }
97722
97823 void thread3(void)
97924 {
98025 rcu_read_lock();
98126 r3 = READ_ONCE(b);
98227 r4 = READ_ONCE(d);
98328 rcu_read_unlock();
98429 }
985</pre>
986</blockquote>
987
988<p>
989Here, if <tt>(r1 == 1)</tt>, then
990<tt>thread0()</tt>'s write to <tt>b</tt> must happen
991before the end of <tt>thread1()</tt>'s grace period.
992If in addition <tt>(r4 == 1)</tt>, then
993<tt>thread3()</tt>'s read from <tt>b</tt> must happen
994after the beginning of <tt>thread2()</tt>'s grace period.
995If it is also the case that <tt>(r2 == 1)</tt>, then the
996end of <tt>thread1()</tt>'s grace period must precede the
997beginning of <tt>thread2()</tt>'s grace period.
998This mean that the two RCU read-side critical sections cannot overlap,
999guaranteeing that <tt>(r3 == 1)</tt>.
1000As a result, the outcome:
1001
1002<blockquote>
1003<pre>
1004(r1 == 1 &amp;&amp; r2 == 1 &amp;&amp; r3 == 0 &amp;&amp; r4 == 1)
1005</pre>
1006</blockquote>
1007
1008cannot happen.
1009
1010<p>
1011This non-requirement was also non-premeditated, but became apparent
1012when studying RCU's interaction with memory ordering.
1013
1014<h3><a name="Read-Side Critical Sections Don't Partition Grace Periods">
1015Read-Side Critical Sections Don't Partition Grace Periods</a></h3>
1016
1017<p>
1018It is also tempting to assume that if an RCU read-side critical section
1019happens between a pair of grace periods, then those grace periods cannot
1020overlap.
1021However, this temptation leads nowhere good, as can be illustrated by
1022the following, with all variables initially zero:
1023
1024<blockquote>
1025<pre>
1026 1 void thread0(void)
1027 2 {
1028 3 rcu_read_lock();
1029 4 WRITE_ONCE(a, 1);
1030 5 WRITE_ONCE(b, 1);
1031 6 rcu_read_unlock();
1032 7 }
1033 8
1034 9 void thread1(void)
103510 {
103611 r1 = READ_ONCE(a);
103712 synchronize_rcu();
103813 WRITE_ONCE(c, 1);
103914 }
104015
104116 void thread2(void)
104217 {
104318 rcu_read_lock();
104419 WRITE_ONCE(d, 1);
104520 r2 = READ_ONCE(c);
104621 rcu_read_unlock();
104722 }
104823
104924 void thread3(void)
105025 {
105126 r3 = READ_ONCE(d);
105227 synchronize_rcu();
105328 WRITE_ONCE(e, 1);
105429 }
105530
105631 void thread4(void)
105732 {
105833 rcu_read_lock();
105934 r4 = READ_ONCE(b);
106035 r5 = READ_ONCE(e);
106136 rcu_read_unlock();
106237 }
1063</pre>
1064</blockquote>
1065
1066<p>
1067In this case, the outcome:
1068
1069<blockquote>
1070<pre>
1071(r1 == 1 &amp;&amp; r2 == 1 &amp;&amp; r3 == 1 &amp;&amp; r4 == 0 &amp&amp; r5 == 1)
1072</pre>
1073</blockquote>
1074
1075is entirely possible, as illustrated below:
1076
1077<p><img src="ReadersPartitionGP1.svg" alt="ReadersPartitionGP1.svg" width="100%"></p>
1078
1079<p>
1080Again, an RCU read-side critical section can overlap almost all of a
1081given grace period, just so long as it does not overlap the entire
1082grace period.
1083As a result, an RCU read-side critical section cannot partition a pair
1084of RCU grace periods.
1085
1086<p>@@QQ@@
1087How long a sequence of grace periods, each separated by an RCU read-side
1088critical section, would be required to partition the RCU read-side
1089critical sections at the beginning and end of the chain?
1090<p>@@QQA@@
1091In theory, an infinite number.
1092In practice, an unknown number that is sensitive to both implementation
1093details and timing considerations.
1094Therefore, even in practice, RCU users must abide by the theoretical rather
1095than the practical answer.
1096<p>@@QQE@@
1097
1098<h3><a name="Disabling Preemption Does Not Block Grace Periods">
1099Disabling Preemption Does Not Block Grace Periods</a></h3>
1100
1101<p>
1102There was a time when disabling preemption on any given CPU would block
1103subsequent grace periods.
1104However, this was an accident of implementation and is not a requirement.
1105And in the current Linux-kernel implementation, disabling preemption
1106on a given CPU in fact does not block grace periods, as Oleg Nesterov
1107<a href="https://lkml.kernel.org/g/20150614193825.GA19582@redhat.com">demonstrated</a>.
1108
1109<p>
1110If you need a preempt-disable region to block grace periods, you need to add
1111<tt>rcu_read_lock()</tt> and <tt>rcu_read_unlock()</tt>, for example
1112as follows:
1113
1114<blockquote>
1115<pre>
1116 1 preempt_disable();
1117 2 rcu_read_lock();
1118 3 do_something();
1119 4 rcu_read_unlock();
1120 5 preempt_enable();
1121 6
1122 7 /* Spinlocks implicitly disable preemption. */
1123 8 spin_lock(&amp;mylock);
1124 9 rcu_read_lock();
112510 do_something();
112611 rcu_read_unlock();
112712 spin_unlock(&amp;mylock);
1128</pre>
1129</blockquote>
1130
1131<p>
1132In theory, you could enter the RCU read-side critical section first,
1133but it is more efficient to keep the entire RCU read-side critical
1134section contained in the preempt-disable region as shown above.
1135Of course, RCU read-side critical sections that extend outside of
1136preempt-disable regions will work correctly, but such critical sections
1137can be preempted, which forces <tt>rcu_read_unlock()</tt> to do
1138more work.
1139And no, this is <i>not</i> an invitation to enclose all of your RCU
1140read-side critical sections within preempt-disable regions, because
1141doing so would degrade real-time response.
1142
1143<p>
1144This non-requirement appeared with preemptible RCU.
1145If you need a grace period that waits on non-preemptible code regions, use
1146<a href="#Sched Flavor">RCU-sched</a>.
1147
1148<h2><a name="Parallelism Facts of Life">Parallelism Facts of Life</a></h2>
1149
1150<p>
1151These parallelism facts of life are by no means specific to RCU, but
1152the RCU implementation must abide by them.
1153They therefore bear repeating:
1154
1155<ol>
1156<li> Any CPU or task may be delayed at any time,
1157 and any attempts to avoid these delays by disabling
1158 preemption, interrupts, or whatever are completely futile.
1159 This is most obvious in preemptible user-level
1160 environments and in virtualized environments (where
1161 a given guest OS's VCPUs can be preempted at any time by
1162 the underlying hypervisor), but can also happen in bare-metal
1163 environments due to ECC errors, NMIs, and other hardware
1164 events.
1165 Although a delay of more than about 20 seconds can result
1166 in splats, the RCU implementation is obligated to use
1167 algorithms that can tolerate extremely long delays, but where
1168 &ldquo;extremely long&rdquo; is not long enough to allow
1169 wrap-around when incrementing a 64-bit counter.
1170<li> Both the compiler and the CPU can reorder memory accesses.
1171 Where it matters, RCU must use compiler directives and
1172 memory-barrier instructions to preserve ordering.
1173<li> Conflicting writes to memory locations in any given cache line
1174 will result in expensive cache misses.
1175 Greater numbers of concurrent writes and more-frequent
1176 concurrent writes will result in more dramatic slowdowns.
1177 RCU is therefore obligated to use algorithms that have
1178 sufficient locality to avoid significant performance and
1179 scalability problems.
1180<li> As a rough rule of thumb, only one CPU's worth of processing
1181 may be carried out under the protection of any given exclusive
1182 lock.
1183 RCU must therefore use scalable locking designs.
1184<li> Counters are finite, especially on 32-bit systems.
1185 RCU's use of counters must therefore tolerate counter wrap,
1186 or be designed such that counter wrap would take way more
1187 time than a single system is likely to run.
1188 An uptime of ten years is quite possible, a runtime
1189 of a century much less so.
1190 As an example of the latter, RCU's dyntick-idle nesting counter
1191 allows 54 bits for interrupt nesting level (this counter
1192 is 64 bits even on a 32-bit system).
1193 Overflowing this counter requires 2<sup>54</sup>
1194 half-interrupts on a given CPU without that CPU ever going idle.
1195 If a half-interrupt happened every microsecond, it would take
1196 570 years of runtime to overflow this counter, which is currently
1197 believed to be an acceptably long time.
1198<li> Linux systems can have thousands of CPUs running a single
1199 Linux kernel in a single shared-memory environment.
1200 RCU must therefore pay close attention to high-end scalability.
1201</ol>
1202
1203<p>
1204This last parallelism fact of life means that RCU must pay special
1205attention to the preceding facts of life.
1206The idea that Linux might scale to systems with thousands of CPUs would
1207have been met with some skepticism in the 1990s, but these requirements
1208would have otherwise have been unsurprising, even in the early 1990s.
1209
1210<h2><a name="Quality-of-Implementation Requirements">Quality-of-Implementation Requirements</a></h2>
1211
1212<p>
1213These sections list quality-of-implementation requirements.
1214Although an RCU implementation that ignores these requirements could
1215still be used, it would likely be subject to limitations that would
1216make it inappropriate for industrial-strength production use.
1217Classes of quality-of-implementation requirements are as follows:
1218
1219<ol>
1220<li> <a href="#Specialization">Specialization</a>
1221<li> <a href="#Performance and Scalability">Performance and Scalability</a>
1222<li> <a href="#Composability">Composability</a>
1223<li> <a href="#Corner Cases">Corner Cases</a>
1224</ol>
1225
1226<p>
1227These classes is covered in the following sections.
1228
1229<h3><a name="Specialization">Specialization</a></h3>
1230
1231<p>
1232RCU is and always has been intended primarily for read-mostly situations, as
1233illustrated by the following figure.
1234This means that RCU's read-side primitives are optimized, often at the
1235expense of its update-side primitives.
1236
1237<p><img src="RCUApplicability.svg" alt="RCUApplicability.svg" width="70%"></p>
1238
1239<p>
1240This focus on read-mostly situations means that RCU must interoperate
1241with other synchronization primitives.
1242For example, the <tt>add_gp()</tt> and <tt>remove_gp_synchronous()</tt>
1243examples discussed earlier use RCU to protect readers and locking to
1244coordinate updaters.
1245However, the need extends much farther, requiring that a variety of
1246synchronization primitives be legal within RCU read-side critical sections,
1247including spinlocks, sequence locks, atomic operations, reference
1248counters, and memory barriers.
1249
1250<p>@@QQ@@
1251What about sleeping locks?
1252<p>@@QQA@@
1253These are forbidden within Linux-kernel RCU read-side critical sections
1254because it is not legal to place a quiescent state (in this case,
1255voluntary context switch) within an RCU read-side critical section.
1256However, sleeping locks may be used within userspace RCU read-side critical
1257sections, and also within Linux-kernel sleepable RCU
1258<a href="#Sleepable RCU">(SRCU)</a>
1259read-side critical sections.
1260In addition, the -rt patchset turns spinlocks into a sleeping locks so
1261that the corresponding critical sections can be preempted, which
1262also means that these sleeplockified spinlocks (but not other sleeping locks!)
1263may be acquire within -rt-Linux-kernel RCU read-side critical sections.
1264
1265<p>
1266Note that it <i>is</i> legal for a normal RCU read-side critical section
1267to conditionally acquire a sleeping locks (as in <tt>mutex_trylock()</tt>),
1268but only as long as it does not loop indefinitely attempting to
1269conditionally acquire that sleeping locks.
1270The key point is that things like <tt>mutex_trylock()</tt>
1271either return with the mutex held, or return an error indication if
1272the mutex was not immediately available.
1273Either way, <tt>mutex_trylock()</tt> returns immediately without sleeping.
1274<p>@@QQE@@
1275
1276<p>
1277It often comes as a surprise that many algorithms do not require a
1278consistent view of data, but many can function in that mode,
1279with network routing being the poster child.
1280Internet routing algorithms take significant time to propagate
1281updates, so that by the time an update arrives at a given system,
1282that system has been sending network traffic the wrong way for
1283a considerable length of time.
1284Having a few threads continue to send traffic the wrong way for a
1285few more milliseconds is clearly not a problem: In the worst case,
1286TCP retransmissions will eventually get the data where it needs to go.
1287In general, when tracking the state of the universe outside of the
1288computer, some level of inconsistency must be tolerated due to
1289speed-of-light delays if nothing else.
1290
1291<p>
1292Furthermore, uncertainty about external state is inherent in many cases.
1293For example, a pair of veternarians might use heartbeat to determine
1294whether or not a given cat was alive.
1295But how long should they wait after the last heartbeat to decide that
1296the cat is in fact dead?
1297Waiting less than 400 milliseconds makes no sense because this would
1298mean that a relaxed cat would be considered to cycle between death
1299and life more than 100 times per minute.
1300Moreover, just as with human beings, a cat's heart might stop for
1301some period of time, so the exact wait period is a judgment call.
1302One of our pair of veternarians might wait 30 seconds before pronouncing
1303the cat dead, while the other might insist on waiting a full minute.
1304The two veternarians would then disagree on the state of the cat during
1305the final 30 seconds of the minute following the last heartbeat, as
1306fancifully illustrated below:
1307
1308<p><img src="2013-08-is-it-dead.png" alt="2013-08-is-it-dead.png" width="431"></p>
1309
1310<p>
1311Interestingly enough, this same situation applies to hardware.
1312When push comes to shove, how do we tell whether or not some
1313external server has failed?
1314We send messages to it periodically, and declare it failed if we
1315don't receive a response within a given period of time.
1316Policy decisions can usually tolerate short
1317periods of inconsistency.
1318The policy was decided some time ago, and is only now being put into
1319effect, so a few milliseconds of delay is normally inconsequential.
1320
1321<p>
1322However, there are algorithms that absolutely must see consistent data.
1323For example, the translation between a user-level SystemV semaphore
1324ID to the corresponding in-kernel data structure is protected by RCU,
1325but it is absolutely forbidden to update a semaphore that has just been
1326removed.
1327In the Linux kernel, this need for consistency is accommodated by acquiring
1328spinlocks located in the in-kernel data structure from within
1329the RCU read-side critical section, and this is indicated by the
1330green box in the figure above.
1331Many other techniques may be used, and are in fact used within the
1332Linux kernel.
1333
1334<p>
1335In short, RCU is not required to maintain consistency, and other
1336mechanisms may be used in concert with RCU when consistency is required.
1337RCU's specialization allows it to do its job extremely well, and its
1338ability to interoperate with other synchronization mechanisms allows
1339the right mix of synchronization tools to be used for a given job.
1340
1341<h3><a name="Performance and Scalability">Performance and Scalability</a></h3>
1342
1343<p>
1344Energy efficiency is a critical component of performance today,
1345and Linux-kernel RCU implementations must therefore avoid unnecessarily
1346awakening idle CPUs.
1347I cannot claim that this requirement was premeditated.
1348In fact, I learned of it during a telephone conversation in which I
1349was given &ldquo;frank and open&rdquo; feedback on the importance
1350of energy efficiency in battery-powered systems and on specific
1351energy-efficiency shortcomings of the Linux-kernel RCU implementation.
1352In my experience, the battery-powered embedded community will consider
1353any unnecessary wakeups to be extremely unfriendly acts.
1354So much so that mere Linux-kernel-mailing-list posts are
1355insufficient to vent their ire.
1356
1357<p>
1358Memory consumption is not particularly important for in most
1359situations, and has become decreasingly
1360so as memory sizes have expanded and memory
1361costs have plummeted.
1362However, as I learned from Matt Mackall's
1363<a href="http://elinux.org/Linux_Tiny-FAQ">bloatwatch</a>
1364efforts, memory footprint is critically important on single-CPU systems with
1365non-preemptible (<tt>CONFIG_PREEMPT=n</tt>) kernels, and thus
1366<a href="https://lkml.kernel.org/g/20090113221724.GA15307@linux.vnet.ibm.com">tiny RCU</a>
1367was born.
1368Josh Triplett has since taken over the small-memory banner with his
1369<a href="https://tiny.wiki.kernel.org/">Linux kernel tinification</a>
1370project, which resulted in
1371<a href="#Sleepable RCU">SRCU</a>
1372becoming optional for those kernels not needing it.
1373
1374<p>
1375The remaining performance requirements are, for the most part,
1376unsurprising.
1377For example, in keeping with RCU's read-side specialization,
1378<tt>rcu_dereference()</tt> should have negligible overhead (for
1379example, suppression of a few minor compiler optimizations).
1380Similarly, in non-preemptible environments, <tt>rcu_read_lock()</tt> and
1381<tt>rcu_read_unlock()</tt> should have exactly zero overhead.
1382
1383<p>
1384In preemptible environments, in the case where the RCU read-side
1385critical section was not preempted (as will be the case for the
1386highest-priority real-time process), <tt>rcu_read_lock()</tt> and
1387<tt>rcu_read_unlock()</tt> should have minimal overhead.
1388In particular, they should not contain atomic read-modify-write
1389operations, memory-barrier instructions, preemption disabling,
1390interrupt disabling, or backwards branches.
1391However, in the case where the RCU read-side critical section was preempted,
1392<tt>rcu_read_unlock()</tt> may acquire spinlocks and disable interrupts.
1393This is why it is better to nest an RCU read-side critical section
1394within a preempt-disable region than vice versa, at least in cases
1395where that critical section is short enough to avoid unduly degrading
1396real-time latencies.
1397
1398<p>
1399The <tt>synchronize_rcu()</tt> grace-period-wait primitive is
1400optimized for throughput.
1401It may therefore incur several milliseconds of latency in addition to
1402the duration of the longest RCU read-side critical section.
1403On the other hand, multiple concurrent invocations of
1404<tt>synchronize_rcu()</tt> are required to use batching optimizations
1405so that they can be satisfied by a single underlying grace-period-wait
1406operation.
1407For example, in the Linux kernel, it is not unusual for a single
1408grace-period-wait operation to serve more than
1409<a href="https://www.usenix.org/conference/2004-usenix-annual-technical-conference/making-rcu-safe-deep-sub-millisecond-response">1,000 separate invocations</a>
1410of <tt>synchronize_rcu()</tt>, thus amortizing the per-invocation
1411overhead down to nearly zero.
1412However, the grace-period optimization is also required to avoid
1413measurable degradation of real-time scheduling and interrupt latencies.
1414
1415<p>
1416In some cases, the multi-millisecond <tt>synchronize_rcu()</tt>
1417latencies are unacceptable.
1418In these cases, <tt>synchronize_rcu_expedited()</tt> may be used
1419instead, reducing the grace-period latency down to a few tens of
1420microseconds on small systems, at least in cases where the RCU read-side
1421critical sections are short.
1422There are currently no special latency requirements for
1423<tt>synchronize_rcu_expedited()</tt> on large systems, but,
1424consistent with the empirical nature of the RCU specification,
1425that is subject to change.
1426However, there most definitely are scalability requirements:
1427A storm of <tt>synchronize_rcu_expedited()</tt> invocations on 4096
1428CPUs should at least make reasonable forward progress.
1429In return for its shorter latencies, <tt>synchronize_rcu_expedited()</tt>
1430is permitted to impose modest degradation of real-time latency
1431on non-idle online CPUs.
1432That said, it will likely be necessary to take further steps to reduce this
1433degradation, hopefully to roughly that of a scheduling-clock interrupt.
1434
1435<p>
1436There are a number of situations where even
1437<tt>synchronize_rcu_expedited()</tt>'s reduced grace-period
1438latency is unacceptable.
1439In these situations, the asynchronous <tt>call_rcu()</tt> can be
1440used in place of <tt>synchronize_rcu()</tt> as follows:
1441
1442<blockquote>
1443<pre>
1444 1 struct foo {
1445 2 int a;
1446 3 int b;
1447 4 struct rcu_head rh;
1448 5 };
1449 6
1450 7 static void remove_gp_cb(struct rcu_head *rhp)
1451 8 {
1452 9 struct foo *p = container_of(rhp, struct foo, rh);
145310
145411 kfree(p);
145512 }
145613
145714 bool remove_gp_asynchronous(void)
145815 {
145916 struct foo *p;
146017
146118 spin_lock(&amp;gp_lock);
146219 p = rcu_dereference(gp);
146320 if (!p) {
146421 spin_unlock(&amp;gp_lock);
146522 return false;
146623 }
146724 rcu_assign_pointer(gp, NULL);
146825 call_rcu(&amp;p-&gt;rh, remove_gp_cb);
146926 spin_unlock(&amp;gp_lock);
147027 return true;
147128 }
1472</pre>
1473</blockquote>
1474
1475<p>
1476A definition of <tt>struct foo</tt> is finally needed, and appears
1477on lines&nbsp;1-5.
1478The function <tt>remove_gp_cb()</tt> is passed to <tt>call_rcu()</tt>
1479on line&nbsp;25, and will be invoked after the end of a subsequent
1480grace period.
1481This gets the same effect as <tt>remove_gp_synchronous()</tt>,
1482but without forcing the updater to wait for a grace period to elapse.
1483The <tt>call_rcu()</tt> function may be used in a number of
1484situations where neither <tt>synchronize_rcu()</tt> nor
1485<tt>synchronize_rcu_expedited()</tt> would be legal,
1486including within preempt-disable code, <tt>local_bh_disable()</tt> code,
1487interrupt-disable code, and interrupt handlers.
1488However, even <tt>call_rcu()</tt> is illegal within NMI handlers.
1489The callback function (<tt>remove_gp_cb()</tt> in this case) will be
1490executed within softirq (software interrupt) environment within the
1491Linux kernel,
1492either within a real softirq handler or under the protection
1493of <tt>local_bh_disable()</tt>.
1494In both the Linux kernel and in userspace, it is bad practice to
1495write an RCU callback function that takes too long.
1496Long-running operations should be relegated to separate threads or
1497(in the Linux kernel) workqueues.
1498
1499<p>@@QQ@@
1500Why does line&nbsp;19 use <tt>rcu_access_pointer()</tt>?
1501After all, <tt>call_rcu()</tt> on line&nbsp;25 stores into the
1502structure, which would interact badly with concurrent insertions.
1503Doesn't this mean that <tt>rcu_dereference()</tt> is required?
1504<p>@@QQA@@
1505Presumably the <tt>-&gt;gp_lock</tt> acquired on line&nbsp;18 excludes
1506any changes, including any insertions that <tt>rcu_dereference()</tt>
1507would protect against.
1508Therefore, any insertions will be delayed until after <tt>-&gt;gp_lock</tt>
1509is released on line&nbsp;25, which in turn means that
1510<tt>rcu_access_pointer()</tt> suffices.
1511<p>@@QQE@@
1512
1513<p>
1514However, all that <tt>remove_gp_cb()</tt> is doing is
1515invoking <tt>kfree()</tt> on the data element.
1516This is a common idiom, and is supported by <tt>kfree_rcu()</tt>,
1517which allows &ldquo;fire and forget&rdquo; operation as shown below:
1518
1519<blockquote>
1520<pre>
1521 1 struct foo {
1522 2 int a;
1523 3 int b;
1524 4 struct rcu_head rh;
1525 5 };
1526 6
1527 7 bool remove_gp_faf(void)
1528 8 {
1529 9 struct foo *p;
153010
153111 spin_lock(&amp;gp_lock);
153212 p = rcu_dereference(gp);
153313 if (!p) {
153414 spin_unlock(&amp;gp_lock);
153515 return false;
153616 }
153717 rcu_assign_pointer(gp, NULL);
153818 kfree_rcu(p, rh);
153919 spin_unlock(&amp;gp_lock);
154020 return true;
154121 }
1542</pre>
1543</blockquote>
1544
1545<p>
1546Note that <tt>remove_gp_faf()</tt> simply invokes
1547<tt>kfree_rcu()</tt> and proceeds, without any need to pay any
1548further attention to the subsequent grace period and <tt>kfree()</tt>.
1549It is permissible to invoke <tt>kfree_rcu()</tt> from the same
1550environments as for <tt>call_rcu()</tt>.
1551Interestingly enough, DYNIX/ptx had the equivalents of
1552<tt>call_rcu()</tt> and <tt>kfree_rcu()</tt>, but not
1553<tt>synchronize_rcu()</tt>.
1554This was due to the fact that RCU was not heavily used within DYNIX/ptx,
1555so the very few places that needed something like
1556<tt>synchronize_rcu()</tt> simply open-coded it.
1557
1558<p>@@QQ@@
1559Earlier it was claimed that <tt>call_rcu()</tt> and
1560<tt>kfree_rcu()</tt> allowed updaters to avoid being blocked
1561by readers.
1562But how can that be correct, given that the invocation of the callback
1563and the freeing of the memory (respectively) must still wait for
1564a grace period to elapse?
1565<p>@@QQA@@
1566We could define things this way, but keep in mind that this sort of
1567definition would say that updates in garbage-collected languages
1568cannot complete until the next time the garbage collector runs,
1569which does not seem at all reasonable.
1570The key point is that in most cases, an updater using either
1571<tt>call_rcu()</tt> or <tt>kfree_rcu()</tt> can proceed to the
1572next update as soon as it has invoked <tt>call_rcu()</tt> or
1573<tt>kfree_rcu()</tt>, without having to wait for a subsequent
1574grace period.
1575<p>@@QQE@@
1576
1577<p>
1578But what if the updater must wait for the completion of code to be
1579executed after the end of the grace period, but has other tasks
1580that can be carried out in the meantime?
1581The polling-style <tt>get_state_synchronize_rcu()</tt> and
1582<tt>cond_synchronize_rcu()</tt> functions may be used for this
1583purpose, as shown below:
1584
1585<blockquote>
1586<pre>
1587 1 bool remove_gp_poll(void)
1588 2 {
1589 3 struct foo *p;
1590 4 unsigned long s;
1591 5
1592 6 spin_lock(&amp;gp_lock);
1593 7 p = rcu_access_pointer(gp);
1594 8 if (!p) {
1595 9 spin_unlock(&amp;gp_lock);
159610 return false;
159711 }
159812 rcu_assign_pointer(gp, NULL);
159913 spin_unlock(&amp;gp_lock);
160014 s = get_state_synchronize_rcu();
160115 do_something_while_waiting();
160216 cond_synchronize_rcu(s);
160317 kfree(p);
160418 return true;
160519 }
1606</pre>
1607</blockquote>
1608
1609<p>
1610On line&nbsp;14, <tt>get_state_synchronize_rcu()</tt> obtains a
1611&ldquo;cookie&rdquo; from RCU,
1612then line&nbsp;15 carries out other tasks,
1613and finally, line&nbsp;16 returns immediately if a grace period has
1614elapsed in the meantime, but otherwise waits as required.
1615The need for <tt>get_state_synchronize_rcu</tt> and
1616<tt>cond_synchronize_rcu()</tt> has appeared quite recently,
1617so it is too early to tell whether they will stand the test of time.
1618
1619<p>
1620RCU thus provides a range of tools to allow updaters to strike the
1621required tradeoff between latency, flexibility and CPU overhead.
1622
1623<h3><a name="Composability">Composability</a></h3>
1624
1625<p>
1626Composability has received much attention in recent years, perhaps in part
1627due to the collision of multicore hardware with object-oriented techniques
1628designed in single-threaded environments for single-threaded use.
1629And in theory, RCU read-side critical sections may be composed, and in
1630fact may be nested arbitrarily deeply.
1631In practice, as with all real-world implementations of composable
1632constructs, there are limitations.
1633
1634<p>
1635Implementations of RCU for which <tt>rcu_read_lock()</tt>
1636and <tt>rcu_read_unlock()</tt> generate no code, such as
1637Linux-kernel RCU when <tt>CONFIG_PREEMPT=n</tt>, can be
1638nested arbitrarily deeply.
1639After all, there is no overhead.
1640Except that if all these instances of <tt>rcu_read_lock()</tt>
1641and <tt>rcu_read_unlock()</tt> are visible to the compiler,
1642compilation will eventually fail due to exhausting memory,
1643mass storage, or user patience, whichever comes first.
1644If the nesting is not visible to the compiler, as is the case with
1645mutually recursive functions each in its own translation unit,
1646stack overflow will result.
1647If the nesting takes the form of loops, either the control variable
1648will overflow or (in the Linux kernel) you will get an RCU CPU stall warning.
1649Nevertheless, this class of RCU implementations is one
1650of the most composable constructs in existence.
1651
1652<p>
1653RCU implementations that explicitly track nesting depth
1654are limited by the nesting-depth counter.
1655For example, the Linux kernel's preemptible RCU limits nesting to
1656<tt>INT_MAX</tt>.
1657This should suffice for almost all practical purposes.
1658That said, a consecutive pair of RCU read-side critical sections
1659between which there is an operation that waits for a grace period
1660cannot be enclosed in another RCU read-side critical section.
1661This is because it is not legal to wait for a grace period within
1662an RCU read-side critical section: To do so would result either
1663in deadlock or
1664in RCU implicitly splitting the enclosing RCU read-side critical
1665section, neither of which is conducive to a long-lived and prosperous
1666kernel.
1667
1668<p>
1669It is worth noting that RCU is not alone in limiting composability.
1670For example, many transactional-memory implementations prohibit
1671composing a pair of transactions separated by an irrevocable
1672operation (for example, a network receive operation).
1673For another example, lock-based critical sections can be composed
1674surprisingly freely, but only if deadlock is avoided.
1675
1676<p>
1677In short, although RCU read-side critical sections are highly composable,
1678care is required in some situations, just as is the case for any other
1679composable synchronization mechanism.
1680
1681<h3><a name="Corner Cases">Corner Cases</a></h3>
1682
1683<p>
1684A given RCU workload might have an endless and intense stream of
1685RCU read-side critical sections, perhaps even so intense that there
1686was never a point in time during which there was not at least one
1687RCU read-side critical section in flight.
1688RCU cannot allow this situation to block grace periods: As long as
1689all the RCU read-side critical sections are finite, grace periods
1690must also be finite.
1691
1692<p>
1693That said, preemptible RCU implementations could potentially result
1694in RCU read-side critical sections being preempted for long durations,
1695which has the effect of creating a long-duration RCU read-side
1696critical section.
1697This situation can arise only in heavily loaded systems, but systems using
1698real-time priorities are of course more vulnerable.
1699Therefore, RCU priority boosting is provided to help deal with this
1700case.
1701That said, the exact requirements on RCU priority boosting will likely
1702evolve as more experience accumulates.
1703
1704<p>
1705Other workloads might have very high update rates.
1706Although one can argue that such workloads should instead use
1707something other than RCU, the fact remains that RCU must
1708handle such workloads gracefully.
1709This requirement is another factor driving batching of grace periods,
1710but it is also the driving force behind the checks for large numbers
1711of queued RCU callbacks in the <tt>call_rcu()</tt> code path.
1712Finally, high update rates should not delay RCU read-side critical
1713sections, although some read-side delays can occur when using
1714<tt>synchronize_rcu_expedited()</tt>, courtesy of this function's use
1715of <tt>try_stop_cpus()</tt>.
1716(In the future, <tt>synchronize_rcu_expedited()</tt> will be
1717converted to use lighter-weight inter-processor interrupts (IPIs),
1718but this will still disturb readers, though to a much smaller degree.)
1719
1720<p>
1721Although all three of these corner cases were understood in the early
17221990s, a simple user-level test consisting of <tt>close(open(path))</tt>
1723in a tight loop
1724in the early 2000s suddenly provided a much deeper appreciation of the
1725high-update-rate corner case.
1726This test also motivated addition of some RCU code to react to high update
1727rates, for example, if a given CPU finds itself with more than 10,000
1728RCU callbacks queued, it will cause RCU to take evasive action by
1729more aggressively starting grace periods and more aggressively forcing
1730completion of grace-period processing.
1731This evasive action causes the grace period to complete more quickly,
1732but at the cost of restricting RCU's batching optimizations, thus
1733increasing the CPU overhead incurred by that grace period.
1734
1735<h2><a name="Software-Engineering Requirements">
1736Software-Engineering Requirements</a></h2>
1737
1738<p>
1739Between Murphy's Law and &ldquo;To err is human&rdquo;, it is necessary to
1740guard against mishaps and misuse:
1741
1742<ol>
1743<li> It is all too easy to forget to use <tt>rcu_read_lock()</tt>
1744 everywhere that it is needed, so kernels built with
1745 <tt>CONFIG_PROVE_RCU=y</tt> will spat if
1746 <tt>rcu_dereference()</tt> is used outside of an
1747 RCU read-side critical section.
1748 Update-side code can use <tt>rcu_dereference_protected()</tt>,
1749 which takes a
1750 <a href="https://lwn.net/Articles/371986/">lockdep expression</a>
1751 to indicate what is providing the protection.
1752 If the indicated protection is not provided, a lockdep splat
1753 is emitted.
1754
1755 <p>
1756 Code shared between readers and updaters can use
1757 <tt>rcu_dereference_check()</tt>, which also takes a
1758 lockdep expression, and emits a lockdep splat if neither
1759 <tt>rcu_read_lock()</tt> nor the indicated protection
1760 is in place.
1761 In addition, <tt>rcu_dereference_raw()</tt> is used in those
1762 (hopefully rare) cases where the required protection cannot
1763 be easily described.
1764 Finally, <tt>rcu_read_lock_held()</tt> is provided to
1765 allow a function to verify that it has been invoked within
1766 an RCU read-side critical section.
1767 I was made aware of this set of requirements shortly after Thomas
1768 Gleixner audited a number of RCU uses.
1769<li> A given function might wish to check for RCU-related preconditions
1770 upon entry, before using any other RCU API.
1771 The <tt>rcu_lockdep_assert()</tt> does this job,
1772 asserting the expression in kernels having lockdep enabled
1773 and doing nothing otherwise.
1774<li> It is also easy to forget to use <tt>rcu_assign_pointer()</tt>
1775 and <tt>rcu_dereference()</tt>, perhaps (incorrectly)
1776 substituting a simple assignment.
1777 To catch this sort of error, a given RCU-protected pointer may be
1778 tagged with <tt>__rcu</tt>, after which running sparse
1779 with <tt>CONFIG_SPARSE_RCU_POINTER=y</tt> will complain
1780 about simple-assignment accesses to that pointer.
1781 Arnd Bergmann made me aware of this requirement, and also
1782 supplied the needed
1783 <a href="https://lwn.net/Articles/376011/">patch series</a>.
1784<li> Kernels built with <tt>CONFIG_DEBUG_OBJECTS_RCU_HEAD=y</tt>
1785 will splat if a data element is passed to <tt>call_rcu()</tt>
1786 twice in a row, without a grace period in between.
1787 (This error is similar to a double free.)
1788 The corresponding <tt>rcu_head</tt> structures that are
1789 dynamically allocated are automatically tracked, but
1790 <tt>rcu_head</tt> structures allocated on the stack
1791 must be initialized with <tt>init_rcu_head_on_stack()</tt>
1792 and cleaned up with <tt>destroy_rcu_head_on_stack()</tt>.
1793 Similarly, statically allocated non-stack <tt>rcu_head</tt>
1794 structures must be initialized with <tt>init_rcu_head()</tt>
1795 and cleaned up with <tt>destroy_rcu_head()</tt>.
1796 Mathieu Desnoyers made me aware of this requirement, and also
1797 supplied the needed
1798 <a href="https://lkml.kernel.org/g/20100319013024.GA28456@Krystal">patch</a>.
1799<li> An infinite loop in an RCU read-side critical section will
1800 eventually trigger an RCU CPU stall warning splat, with
1801 the duration of &ldquo;eventually&rdquo; being controlled by the
1802 <tt>RCU_CPU_STALL_TIMEOUT</tt> <tt>Kconfig</tt> option, or,
1803 alternatively, by the
1804 <tt>rcupdate.rcu_cpu_stall_timeout</tt> boot/sysfs
1805 parameter.
1806 However, RCU is not obligated to produce this splat
1807 unless there is a grace period waiting on that particular
1808 RCU read-side critical section.
1809 <p>
1810 Some extreme workloads might intentionally delay
1811 RCU grace periods, and systems running those workloads can
1812 be booted with <tt>rcupdate.rcu_cpu_stall_suppress</tt>
1813 to suppress the splats.
1814 This kernel parameter may also be set via <tt>sysfs</tt>.
1815 Furthermore, RCU CPU stall warnings are counter-productive
1816 during sysrq dumps and during panics.
1817 RCU therefore supplies the <tt>rcu_sysrq_start()</tt> and
1818 <tt>rcu_sysrq_end()</tt> API members to be called before
1819 and after long sysrq dumps.
1820 RCU also supplies the <tt>rcu_panic()</tt> notifier that is
1821 automatically invoked at the beginning of a panic to suppress
1822 further RCU CPU stall warnings.
1823
1824 <p>
1825 This requirement made itself known in the early 1990s, pretty
1826 much the first time that it was necessary to debug a CPU stall.
1827 That said, the initial implementation in DYNIX/ptx was quite
1828 generic in comparison with that of Linux.
1829<li> Although it would be very good to detect pointers leaking out
1830 of RCU read-side critical sections, there is currently no
1831 good way of doing this.
1832 One complication is the need to distinguish between pointers
1833 leaking and pointers that have been handed off from RCU to
1834 some other synchronization mechanism, for example, reference
1835 counting.
1836<li> In kernels built with <tt>CONFIG_RCU_TRACE=y</tt>, RCU-related
1837 information is provided via both debugfs and event tracing.
1838<li> Open-coded use of <tt>rcu_assign_pointer()</tt> and
1839 <tt>rcu_dereference()</tt> to create typical linked
1840 data structures can be surprisingly error-prone.
1841 Therefore, RCU-protected
1842 <a href="https://lwn.net/Articles/609973/#RCU List APIs">linked lists</a>
1843 and, more recently, RCU-protected
1844 <a href="https://lwn.net/Articles/612100/">hash tables</a>
1845 are available.
1846 Many other special-purpose RCU-protected data structures are
1847 available in the Linux kernel and the userspace RCU library.
1848<li> Some linked structures are created at compile time, but still
1849 require <tt>__rcu</tt> checking.
1850 The <tt>RCU_POINTER_INITIALIZER()</tt> macro serves this
1851 purpose.
1852<li> It is not necessary to use <tt>rcu_assign_pointer()</tt>
1853 when creating linked structures that are to be published via
1854 a single external pointer.
1855 The <tt>RCU_INIT_POINTER()</tt> macro is provided for
1856 this task and also for assigning <tt>NULL</tt> pointers
1857 at runtime.
1858</ol>
1859
1860<p>
1861This not a hard-and-fast list: RCU's diagnostic capabilities will
1862continue to be guided by the number and type of usage bugs found
1863in real-world RCU usage.
1864
1865<h2><a name="Linux Kernel Complications">Linux Kernel Complications</a></h2>
1866
1867<p>
1868The Linux kernel provides an interesting environment for all kinds of
1869software, including RCU.
1870Some of the relevant points of interest are as follows:
1871
1872<ol>
1873<li> <a href="#Configuration">Configuration</a>.
1874<li> <a href="#Firmware Interface">Firmware Interface</a>.
1875<li> <a href="#Early Boot">Early Boot</a>.
1876<li> <a href="#Interrupts and NMIs">
1877 Interrupts and non-maskable interrupts (NMIs)</a>.
1878<li> <a href="#Loadable Modules">Loadable Modules</a>.
1879<li> <a href="#Hotplug CPU">Hotplug CPU</a>.
1880<li> <a href="#Scheduler and RCU">Scheduler and RCU</a>.
1881<li> <a href="#Tracing and RCU">Tracing and RCU</a>.
1882<li> <a href="#Energy Efficiency">Energy Efficiency</a>.
1883<li> <a href="#Memory Efficiency">Memory Efficiency</a>.
1884<li> <a href="#Performance, Scalability, Response Time, and Reliability">
1885 Performance, Scalability, Response Time, and Reliability</a>.
1886</ol>
1887
1888<p>
1889This list is probably incomplete, but it does give a feel for the
1890most notable Linux-kernel complications.
1891Each of the following sections covers one of the above topics.
1892
1893<h3><a name="Configuration">Configuration</a></h3>
1894
1895<p>
1896RCU's goal is automatic configuration, so that almost nobody
1897needs to worry about RCU's <tt>Kconfig</tt> options.
1898And for almost all users, RCU does in fact work well
1899&ldquo;out of the box.&rdquo;
1900
1901<p>
1902However, there are specialized use cases that are handled by
1903kernel boot parameters and <tt>Kconfig</tt> options.
1904Unfortunately, the <tt>Kconfig</tt> system will explicitly ask users
1905about new <tt>Kconfig</tt> options, which requires almost all of them
1906be hidden behind a <tt>CONFIG_RCU_EXPERT</tt> <tt>Kconfig</tt> option.
1907
1908<p>
1909This all should be quite obvious, but the fact remains that
1910Linus Torvalds recently had to
1911<a href="https://lkml.kernel.org/g/CA+55aFy4wcCwaL4okTs8wXhGZ5h-ibecy_Meg9C4MNQrUnwMcg@mail.gmail.com">remind</a>
1912me of this requirement.
1913
1914<h3><a name="Firmware Interface">Firmware Interface</a></h3>
1915
1916<p>
1917In many cases, kernel obtains information about the system from the
1918firmware, and sometimes things are lost in translation.
1919Or the translation is accurate, but the original message is bogus.
1920
1921<p>
1922For example, some systems' firmware overreports the number of CPUs,
1923sometimes by a large factor.
1924If RCU naively believed the firmware, as it used to do,
1925it would create too many per-CPU kthreads.
1926Although the resulting system will still run correctly, the extra
1927kthreads needlessly consume memory and can cause confusion
1928when they show up in <tt>ps</tt> listings.
1929
1930<p>
1931RCU must therefore wait for a given CPU to actually come online before
1932it can allow itself to believe that the CPU actually exists.
1933The resulting &ldquo;ghost CPUs&rdquo; (which are never going to
1934come online) cause a number of
1935<a href="https://paulmck.livejournal.com/37494.html">interesting complications</a>.
1936
1937<h3><a name="Early Boot">Early Boot</a></h3>
1938
1939<p>
1940The Linux kernel's boot sequence is an interesting process,
1941and RCU is used early, even before <tt>rcu_init()</tt>
1942is invoked.
1943In fact, a number of RCU's primitives can be used as soon as the
1944initial task's <tt>task_struct</tt> is available and the
1945boot CPU's per-CPU variables are set up.
1946The read-side primitives (<tt>rcu_read_lock()</tt>,
1947<tt>rcu_read_unlock()</tt>, <tt>rcu_dereference()</tt>,
1948and <tt>rcu_access_pointer()</tt>) will operate normally very early on,
1949as will <tt>rcu_assign_pointer()</tt>.
1950
1951<p>
1952Although <tt>call_rcu()</tt> may be invoked at any
1953time during boot, callbacks are not guaranteed to be invoked until after
1954the scheduler is fully up and running.
1955This delay in callback invocation is due to the fact that RCU does not
1956invoke callbacks until it is fully initialized, and this full initialization
1957cannot occur until after the scheduler has initialized itself to the
1958point where RCU can spawn and run its kthreads.
1959In theory, it would be possible to invoke callbacks earlier,
1960however, this is not a panacea because there would be severe restrictions
1961on what operations those callbacks could invoke.
1962
1963<p>
1964Perhaps surprisingly, <tt>synchronize_rcu()</tt>,
1965<a href="#Bottom-Half Flavor"><tt>synchronize_rcu_bh()</tt></a>
1966(<a href="#Bottom-Half Flavor">discussed below</a>),
1967and
1968<a href="#Sched Flavor"><tt>synchronize_sched()</tt></a>
1969will all operate normally
1970during very early boot, the reason being that there is only one CPU
1971and preemption is disabled.
1972This means that the call <tt>synchronize_rcu()</tt> (or friends)
1973itself is a quiescent
1974state and thus a grace period, so the early-boot implementation can
1975be a no-op.
1976
1977<p>
1978Both <tt>synchronize_rcu_bh()</tt> and <tt>synchronize_sched()</tt>
1979continue to operate normally through the remainder of boot, courtesy
1980of the fact that preemption is disabled across their RCU read-side
1981critical sections and also courtesy of the fact that there is still
1982only one CPU.
1983However, once the scheduler starts initializing, preemption is enabled.
1984There is still only a single CPU, but the fact that preemption is enabled
1985means that the no-op implementation of <tt>synchronize_rcu()</tt> no
1986longer works in <tt>CONFIG_PREEMPT=y</tt> kernels.
1987Therefore, as soon as the scheduler starts initializing, the early-boot
1988fastpath is disabled.
1989This means that <tt>synchronize_rcu()</tt> switches to its runtime
1990mode of operation where it posts callbacks, which in turn means that
1991any call to <tt>synchronize_rcu()</tt> will block until the corresponding
1992callback is invoked.
1993Unfortunately, the callback cannot be invoked until RCU's runtime
1994grace-period machinery is up and running, which cannot happen until
1995the scheduler has initialized itself sufficiently to allow RCU's
1996kthreads to be spawned.
1997Therefore, invoking <tt>synchronize_rcu()</tt> during scheduler
1998initialization can result in deadlock.
1999
2000<p>@@QQ@@
2001So what happens with <tt>synchronize_rcu()</tt> during
2002scheduler initialization for <tt>CONFIG_PREEMPT=n</tt>
2003kernels?
2004<p>@@QQA@@
2005In <tt>CONFIG_PREEMPT=n</tt> kernel, <tt>synchronize_rcu()</tt>
2006maps directly to <tt>synchronize_sched()</tt>.
2007Therefore, <tt>synchronize_rcu()</tt> works normally throughout
2008boot in <tt>CONFIG_PREEMPT=n</tt> kernels.
2009However, your code must also work in <tt>CONFIG_PREEMPT=y</tt> kernels,
2010so it is still necessary to avoid invoking <tt>synchronize_rcu()</tt>
2011during scheduler initialization.
2012<p>@@QQE@@
2013
2014<p>
2015I learned of these boot-time requirements as a result of a series of
2016system hangs.
2017
2018<h3><a name="Interrupts and NMIs">Interrupts and NMIs</a></h3>
2019
2020<p>
2021The Linux kernel has interrupts, and RCU read-side critical sections are
2022legal within interrupt handlers and within interrupt-disabled regions
2023of code, as are invocations of <tt>call_rcu()</tt>.
2024
2025<p>
2026Some Linux-kernel architectures can enter an interrupt handler from
2027non-idle process context, and then just never leave it, instead stealthily
2028transitioning back to process context.
2029This trick is sometimes used to invoke system calls from inside the kernel.
2030These &ldquo;half-interrupts&rdquo; mean that RCU has to be very careful
2031about how it counts interrupt nesting levels.
2032I learned of this requirement the hard way during a rewrite
2033of RCU's dyntick-idle code.
2034
2035<p>
2036The Linux kernel has non-maskable interrupts (NMIs), and
2037RCU read-side critical sections are legal within NMI handlers.
2038Thankfully, RCU update-side primitives, including
2039<tt>call_rcu()</tt>, are prohibited within NMI handlers.
2040
2041<p>
2042The name notwithstanding, some Linux-kernel architectures
2043can have nested NMIs, which RCU must handle correctly.
2044Andy Lutomirski
2045<a href="https://lkml.kernel.org/g/CALCETrXLq1y7e_dKFPgou-FKHB6Pu-r8+t-6Ds+8=va7anBWDA@mail.gmail.com">surprised me</a>
2046with this requirement;
2047he also kindly surprised me with
2048<a href="https://lkml.kernel.org/g/CALCETrXSY9JpW3uE6H8WYk81sg56qasA2aqmjMPsq5dOtzso=g@mail.gmail.com">an algorithm</a>
2049that meets this requirement.
2050
2051<h3><a name="Loadable Modules">Loadable Modules</a></h3>
2052
2053<p>
2054The Linux kernel has loadable modules, and these modules can
2055also be unloaded.
2056After a given module has been unloaded, any attempt to call
2057one of its functions results in a segmentation fault.
2058The module-unload functions must therefore cancel any
2059delayed calls to loadable-module functions, for example,
2060any outstanding <tt>mod_timer()</tt> must be dealt with
2061via <tt>del_timer_sync()</tt> or similar.
2062
2063<p>
2064Unfortunately, there is no way to cancel an RCU callback;
2065once you invoke <tt>call_rcu()</tt>, the callback function is
2066going to eventually be invoked, unless the system goes down first.
2067Because it is normally considered socially irresponsible to crash the system
2068in response to a module unload request, we need some other way
2069to deal with in-flight RCU callbacks.
2070
2071<p>
2072RCU therefore provides
2073<tt><a href="https://lwn.net/Articles/217484/">rcu_barrier()</a></tt>,
2074which waits until all in-flight RCU callbacks have been invoked.
2075If a module uses <tt>call_rcu()</tt>, its exit function should therefore
2076prevent any future invocation of <tt>call_rcu()</tt>, then invoke
2077<tt>rcu_barrier()</tt>.
2078In theory, the underlying module-unload code could invoke
2079<tt>rcu_barrier()</tt> unconditionally, but in practice this would
2080incur unacceptable latencies.
2081
2082<p>
2083Nikita Danilov noted this requirement for an analogous filesystem-unmount
2084situation, and Dipankar Sarma incorporated <tt>rcu_barrier()</tt> into RCU.
2085The need for <tt>rcu_barrier()</tt> for module unloading became
2086apparent later.
2087
2088<h3><a name="Hotplug CPU">Hotplug CPU</a></h3>
2089
2090<p>
2091The Linux kernel supports CPU hotplug, which means that CPUs
2092can come and go.
2093It is of course illegal to use any RCU API member from an offline CPU.
2094This requirement was present from day one in DYNIX/ptx, but
2095on the other hand, the Linux kernel's CPU-hotplug implementation
2096is &ldquo;interesting.&rdquo;
2097
2098<p>
2099The Linux-kernel CPU-hotplug implementation has notifiers that
2100are used to allow the various kernel subsystems (including RCU)
2101to respond appropriately to a given CPU-hotplug operation.
2102Most RCU operations may be invoked from CPU-hotplug notifiers,
2103including even normal synchronous grace-period operations
2104such as <tt>synchronize_rcu()</tt>.
2105However, expedited grace-period operations such as
2106<tt>synchronize_rcu_expedited()</tt> are not supported,
2107due to the fact that current implementations block CPU-hotplug
2108operations, which could result in deadlock.
2109
2110<p>
2111In addition, all-callback-wait operations such as
2112<tt>rcu_barrier()</tt> are also not supported, due to the
2113fact that there are phases of CPU-hotplug operations where
2114the outgoing CPU's callbacks will not be invoked until after
2115the CPU-hotplug operation ends, which could also result in deadlock.
2116
2117<h3><a name="Scheduler and RCU">Scheduler and RCU</a></h3>
2118
2119<p>
2120RCU depends on the scheduler, and the scheduler uses RCU to
2121protect some of its data structures.
2122This means the scheduler is forbidden from acquiring
2123the runqueue locks and the priority-inheritance locks
2124in the middle of an outermost RCU read-side critical section unless either
2125(1)&nbsp;it releases them before exiting that same
2126RCU read-side critical section, or
2127(2)&nbsp;interrupts are disabled across
2128that entire RCU read-side critical section.
2129This same prohibition also applies (recursively!) to any lock that is acquired
2130while holding any lock to which this prohibition applies.
2131Adhering to this rule prevents preemptible RCU from invoking
2132<tt>rcu_read_unlock_special()</tt> while either runqueue or
2133priority-inheritance locks are held, thus avoiding deadlock.
2134
2135<p>
2136Prior to v4.4, it was only necessary to disable preemption across
2137RCU read-side critical sections that acquired scheduler locks.
2138In v4.4, expedited grace periods started using IPIs, and these
2139IPIs could force a <tt>rcu_read_unlock()</tt> to take the slowpath.
2140Therefore, this expedited-grace-period change required disabling of
2141interrupts, not just preemption.
2142
2143<p>
2144For RCU's part, the preemptible-RCU <tt>rcu_read_unlock()</tt>
2145implementation must be written carefully to avoid similar deadlocks.
2146In particular, <tt>rcu_read_unlock()</tt> must tolerate an
2147interrupt where the interrupt handler invokes both
2148<tt>rcu_read_lock()</tt> and <tt>rcu_read_unlock()</tt>.
2149This possibility requires <tt>rcu_read_unlock()</tt> to use
2150negative nesting levels to avoid destructive recursion via
2151interrupt handler's use of RCU.
2152
2153<p>
2154This pair of mutual scheduler-RCU requirements came as a
2155<a href="https://lwn.net/Articles/453002/">complete surprise</a>.
2156
2157<p>
2158As noted above, RCU makes use of kthreads, and it is necessary to
2159avoid excessive CPU-time accumulation by these kthreads.
2160This requirement was no surprise, but RCU's violation of it
2161when running context-switch-heavy workloads when built with
2162<tt>CONFIG_NO_HZ_FULL=y</tt>
2163<a href="http://www.rdrop.com/users/paulmck/scalability/paper/BareMetal.2015.01.15b.pdf">did come as a surprise [PDF]</a>.
2164RCU has made good progress towards meeting this requirement, even
2165for context-switch-have <tt>CONFIG_NO_HZ_FULL=y</tt> workloads,
2166but there is room for further improvement.
2167
2168<h3><a name="Tracing and RCU">Tracing and RCU</a></h3>
2169
2170<p>
2171It is possible to use tracing on RCU code, but tracing itself
2172uses RCU.
2173For this reason, <tt>rcu_dereference_raw_notrace()</tt>
2174is provided for use by tracing, which avoids the destructive
2175recursion that could otherwise ensue.
2176This API is also used by virtualization in some architectures,
2177where RCU readers execute in environments in which tracing
2178cannot be used.
2179The tracing folks both located the requirement and provided the
2180needed fix, so this surprise requirement was relatively painless.
2181
2182<h3><a name="Energy Efficiency">Energy Efficiency</a></h3>
2183
2184<p>
2185Interrupting idle CPUs is considered socially unacceptable,
2186especially by people with battery-powered embedded systems.
2187RCU therefore conserves energy by detecting which CPUs are
2188idle, including tracking CPUs that have been interrupted from idle.
2189This is a large part of the energy-efficiency requirement,
2190so I learned of this via an irate phone call.
2191
2192<p>
2193Because RCU avoids interrupting idle CPUs, it is illegal to
2194execute an RCU read-side critical section on an idle CPU.
2195(Kernels built with <tt>CONFIG_PROVE_RCU=y</tt> will splat
2196if you try it.)
2197The <tt>RCU_NONIDLE()</tt> macro and <tt>_rcuidle</tt>
2198event tracing is provided to work around this restriction.
2199In addition, <tt>rcu_is_watching()</tt> may be used to
2200test whether or not it is currently legal to run RCU read-side
2201critical sections on this CPU.
2202I learned of the need for diagnostics on the one hand
2203and <tt>RCU_NONIDLE()</tt> on the other while inspecting
2204idle-loop code.
2205Steven Rostedt supplied <tt>_rcuidle</tt> event tracing,
2206which is used quite heavily in the idle loop.
2207
2208<p>
2209It is similarly socially unacceptable to interrupt an
2210<tt>nohz_full</tt> CPU running in userspace.
2211RCU must therefore track <tt>nohz_full</tt> userspace
2212execution.
2213And in
2214<a href="https://lwn.net/Articles/558284/"><tt>CONFIG_NO_HZ_FULL_SYSIDLE=y</tt></a>
2215kernels, RCU must separately track idle CPUs on the one hand and
2216CPUs that are either idle or executing in userspace on the other.
2217In both cases, RCU must be able to sample state at two points in
2218time, and be able to determine whether or not some other CPU spent
2219any time idle and/or executing in userspace.
2220
2221<p>
2222These energy-efficiency requirements have proven quite difficult to
2223understand and to meet, for example, there have been more than five
2224clean-sheet rewrites of RCU's energy-efficiency code, the last of
2225which was finally able to demonstrate
2226<a href="http://www.rdrop.com/users/paulmck/realtime/paper/AMPenergy.2013.04.19a.pdf">real energy savings running on real hardware [PDF]</a>.
2227As noted earlier,
2228I learned of many of these requirements via angry phone calls:
2229Flaming me on the Linux-kernel mailing list was apparently not
2230sufficient to fully vent their ire at RCU's energy-efficiency bugs!
2231
2232<h3><a name="Memory Efficiency">Memory Efficiency</a></h3>
2233
2234<p>
2235Although small-memory non-realtime systems can simply use Tiny RCU,
2236code size is only one aspect of memory efficiency.
2237Another aspect is the size of the <tt>rcu_head</tt> structure
2238used by <tt>call_rcu()</tt> and <tt>kfree_rcu()</tt>.
2239Although this structure contains nothing more than a pair of pointers,
2240it does appear in many RCU-protected data structures, including
2241some that are size critical.
2242The <tt>page</tt> structure is a case in point, as evidenced by
2243the many occurrences of the <tt>union</tt> keyword within that structure.
2244
2245<p>
2246This need for memory efficiency is one reason that RCU uses hand-crafted
2247singly linked lists to track the <tt>rcu_head</tt> structures that
2248are waiting for a grace period to elapse.
2249It is also the reason why <tt>rcu_head</tt> structures do not contain
2250debug information, such as fields tracking the file and line of the
2251<tt>call_rcu()</tt> or <tt>kfree_rcu()</tt> that posted them.
2252Although this information might appear in debug-only kernel builds at some
2253point, in the meantime, the <tt>-&gt;func</tt> field will often provide
2254the needed debug information.
2255
2256<p>
2257However, in some cases, the need for memory efficiency leads to even
2258more extreme measures.
2259Returning to the <tt>page</tt> structure, the <tt>rcu_head</tt> field
2260shares storage with a great many other structures that are used at
2261various points in the corresponding page's lifetime.
2262In order to correctly resolve certain
2263<a href="https://lkml.kernel.org/g/1439976106-137226-1-git-send-email-kirill.shutemov@linux.intel.com">race conditions</a>,
2264the Linux kernel's memory-management subsystem needs a particular bit
2265to remain zero during all phases of grace-period processing,
2266and that bit happens to map to the bottom bit of the
2267<tt>rcu_head</tt> structure's <tt>-&gt;next</tt> field.
2268RCU makes this guarantee as long as <tt>call_rcu()</tt>
2269is used to post the callback, as opposed to <tt>kfree_rcu()</tt>
2270or some future &ldquo;lazy&rdquo;
2271variant of <tt>call_rcu()</tt> that might one day be created for
2272energy-efficiency purposes.
2273
2274<h3><a name="Performance, Scalability, Response Time, and Reliability">
2275Performance, Scalability, Response Time, and Reliability</a></h3>
2276
2277<p>
2278Expanding on the
2279<a href="#Performance and Scalability">earlier discussion</a>,
2280RCU is used heavily by hot code paths in performance-critical
2281portions of the Linux kernel's networking, security, virtualization,
2282and scheduling code paths.
2283RCU must therefore use efficient implementations, especially in its
2284read-side primitives.
2285To that end, it would be good if preemptible RCU's implementation
2286of <tt>rcu_read_lock()</tt> could be inlined, however, doing
2287this requires resolving <tt>#include</tt> issues with the
2288<tt>task_struct</tt> structure.
2289
2290<p>
2291The Linux kernel supports hardware configurations with up to
22924096 CPUs, which means that RCU must be extremely scalable.
2293Algorithms that involve frequent acquisitions of global locks or
2294frequent atomic operations on global variables simply cannot be
2295tolerated within the RCU implementation.
2296RCU therefore makes heavy use of a combining tree based on the
2297<tt>rcu_node</tt> structure.
2298RCU is required to tolerate all CPUs continuously invoking any
2299combination of RCU's runtime primitives with minimal per-operation
2300overhead.
2301In fact, in many cases, increasing load must <i>decrease</i> the
2302per-operation overhead, witness the batching optimizations for
2303<tt>synchronize_rcu()</tt>, <tt>call_rcu()</tt>,
2304<tt>synchronize_rcu_expedited()</tt>, and <tt>rcu_barrier()</tt>.
2305As a general rule, RCU must cheerfully accept whatever the
2306rest of the Linux kernel decides to throw at it.
2307
2308<p>
2309The Linux kernel is used for real-time workloads, especially
2310in conjunction with the
2311<a href="https://rt.wiki.kernel.org/index.php/Main_Page">-rt patchset</a>.
2312The real-time-latency response requirements are such that the
2313traditional approach of disabling preemption across RCU
2314read-side critical sections is inappropriate.
2315Kernels built with <tt>CONFIG_PREEMPT=y</tt> therefore
2316use an RCU implementation that allows RCU read-side critical
2317sections to be preempted.
2318This requirement made its presence known after users made it
2319clear that an earlier
2320<a href="https://lwn.net/Articles/107930/">real-time patch</a>
2321did not meet their needs, in conjunction with some
2322<a href="https://lkml.kernel.org/g/20050318002026.GA2693@us.ibm.com">RCU issues</a>
2323encountered by a very early version of the -rt patchset.
2324
2325<p>
2326In addition, RCU must make do with a sub-100-microsecond real-time latency
2327budget.
2328In fact, on smaller systems with the -rt patchset, the Linux kernel
2329provides sub-20-microsecond real-time latencies for the whole kernel,
2330including RCU.
2331RCU's scalability and latency must therefore be sufficient for
2332these sorts of configurations.
2333To my surprise, the sub-100-microsecond real-time latency budget
2334<a href="http://www.rdrop.com/users/paulmck/realtime/paper/bigrt.2013.01.31a.LCA.pdf">
2335applies to even the largest systems [PDF]</a>,
2336up to and including systems with 4096 CPUs.
2337This real-time requirement motivated the grace-period kthread, which
2338also simplified handling of a number of race conditions.
2339
2340<p>
2341Finally, RCU's status as a synchronization primitive means that
2342any RCU failure can result in arbitrary memory corruption that can be
2343extremely difficult to debug.
2344This means that RCU must be extremely reliable, which in
2345practice also means that RCU must have an aggressive stress-test
2346suite.
2347This stress-test suite is called <tt>rcutorture</tt>.
2348
2349<p>
2350Although the need for <tt>rcutorture</tt> was no surprise,
2351the current immense popularity of the Linux kernel is posing
2352interesting&mdash;and perhaps unprecedented&mdash;validation
2353challenges.
2354To see this, keep in mind that there are well over one billion
2355instances of the Linux kernel running today, given Android
2356smartphones, Linux-powered televisions, and servers.
2357This number can be expected to increase sharply with the advent of
2358the celebrated Internet of Things.
2359
2360<p>
2361Suppose that RCU contains a race condition that manifests on average
2362once per million years of runtime.
2363This bug will be occurring about three times per <i>day</i> across
2364the installed base.
2365RCU could simply hide behind hardware error rates, given that no one
2366should really expect their smartphone to last for a million years.
2367However, anyone taking too much comfort from this thought should
2368consider the fact that in most jurisdictions, a successful multi-year
2369test of a given mechanism, which might include a Linux kernel,
2370suffices for a number of types of safety-critical certifications.
2371In fact, rumor has it that the Linux kernel is already being used
2372in production for safety-critical applications.
2373I don't know about you, but I would feel quite bad if a bug in RCU
2374killed someone.
2375Which might explain my recent focus on validation and verification.
2376
2377<h2><a name="Other RCU Flavors">Other RCU Flavors</a></h2>
2378
2379<p>
2380One of the more surprising things about RCU is that there are now
2381no fewer than five <i>flavors</i>, or API families.
2382In addition, the primary flavor that has been the sole focus up to
2383this point has two different implementations, non-preemptible and
2384preemptible.
2385The other four flavors are listed below, with requirements for each
2386described in a separate section.
2387
2388<ol>
2389<li> <a href="#Bottom-Half Flavor">Bottom-Half Flavor</a>
2390<li> <a href="#Sched Flavor">Sched Flavor</a>
2391<li> <a href="#Sleepable RCU">Sleepable RCU</a>
2392<li> <a href="#Tasks RCU">Tasks RCU</a>
2393</ol>
2394
2395<h3><a name="Bottom-Half Flavor">Bottom-Half Flavor</a></h3>
2396
2397<p>
2398The softirq-disable (AKA &ldquo;bottom-half&rdquo;,
2399hence the &ldquo;_bh&rdquo; abbreviations)
2400flavor of RCU, or <i>RCU-bh</i>, was developed by
2401Dipankar Sarma to provide a flavor of RCU that could withstand the
2402network-based denial-of-service attacks researched by Robert
2403Olsson.
2404These attacks placed so much networking load on the system
2405that some of the CPUs never exited softirq execution,
2406which in turn prevented those CPUs from ever executing a context switch,
2407which, in the RCU implementation of that time, prevented grace periods
2408from ever ending.
2409The result was an out-of-memory condition and a system hang.
2410
2411<p>
2412The solution was the creation of RCU-bh, which does
2413<tt>local_bh_disable()</tt>
2414across its read-side critical sections, and which uses the transition
2415from one type of softirq processing to another as a quiescent state
2416in addition to context switch, idle, user mode, and offline.
2417This means that RCU-bh grace periods can complete even when some of
2418the CPUs execute in softirq indefinitely, thus allowing algorithms
2419based on RCU-bh to withstand network-based denial-of-service attacks.
2420
2421<p>
2422Because
2423<tt>rcu_read_lock_bh()</tt> and <tt>rcu_read_unlock_bh()</tt>
2424disable and re-enable softirq handlers, any attempt to start a softirq
2425handlers during the
2426RCU-bh read-side critical section will be deferred.
2427In this case, <tt>rcu_read_unlock_bh()</tt>
2428will invoke softirq processing, which can take considerable time.
2429One can of course argue that this softirq overhead should be associated
2430with the code following the RCU-bh read-side critical section rather
2431than <tt>rcu_read_unlock_bh()</tt>, but the fact
2432is that most profiling tools cannot be expected to make this sort
2433of fine distinction.
2434For example, suppose that a three-millisecond-long RCU-bh read-side
2435critical section executes during a time of heavy networking load.
2436There will very likely be an attempt to invoke at least one softirq
2437handler during that three milliseconds, but any such invocation will
2438be delayed until the time of the <tt>rcu_read_unlock_bh()</tt>.
2439This can of course make it appear at first glance as if
2440<tt>rcu_read_unlock_bh()</tt> was executing very slowly.
2441
2442<p>
2443The
2444<a href="https://lwn.net/Articles/609973/#RCU Per-Flavor API Table">RCU-bh API</a>
2445includes
2446<tt>rcu_read_lock_bh()</tt>,
2447<tt>rcu_read_unlock_bh()</tt>,
2448<tt>rcu_dereference_bh()</tt>,
2449<tt>rcu_dereference_bh_check()</tt>,
2450<tt>synchronize_rcu_bh()</tt>,
2451<tt>synchronize_rcu_bh_expedited()</tt>,
2452<tt>call_rcu_bh()</tt>,
2453<tt>rcu_barrier_bh()</tt>, and
2454<tt>rcu_read_lock_bh_held()</tt>.
2455
2456<h3><a name="Sched Flavor">Sched Flavor</a></h3>
2457
2458<p>
2459Before preemptible RCU, waiting for an RCU grace period had the
2460side effect of also waiting for all pre-existing interrupt
2461and NMI handlers.
2462However, there are legitimate preemptible-RCU implementations that
2463do not have this property, given that any point in the code outside
2464of an RCU read-side critical section can be a quiescent state.
2465Therefore, <i>RCU-sched</i> was created, which follows &ldquo;classic&rdquo;
2466RCU in that an RCU-sched grace period waits for for pre-existing
2467interrupt and NMI handlers.
2468In kernels built with <tt>CONFIG_PREEMPT=n</tt>, the RCU and RCU-sched
2469APIs have identical implementations, while kernels built with
2470<tt>CONFIG_PREEMPT=y</tt> provide a separate implementation for each.
2471
2472<p>
2473Note well that in <tt>CONFIG_PREEMPT=y</tt> kernels,
2474<tt>rcu_read_lock_sched()</tt> and <tt>rcu_read_unlock_sched()</tt>
2475disable and re-enable preemption, respectively.
2476This means that if there was a preemption attempt during the
2477RCU-sched read-side critical section, <tt>rcu_read_unlock_sched()</tt>
2478will enter the scheduler, with all the latency and overhead entailed.
2479Just as with <tt>rcu_read_unlock_bh()</tt>, this can make it look
2480as if <tt>rcu_read_unlock_sched()</tt> was executing very slowly.
2481However, the highest-priority task won't be preempted, so that task
2482will enjoy low-overhead <tt>rcu_read_unlock_sched()</tt> invocations.
2483
2484<p>
2485The
2486<a href="https://lwn.net/Articles/609973/#RCU Per-Flavor API Table">RCU-sched API</a>
2487includes
2488<tt>rcu_read_lock_sched()</tt>,
2489<tt>rcu_read_unlock_sched()</tt>,
2490<tt>rcu_read_lock_sched_notrace()</tt>,
2491<tt>rcu_read_unlock_sched_notrace()</tt>,
2492<tt>rcu_dereference_sched()</tt>,
2493<tt>rcu_dereference_sched_check()</tt>,
2494<tt>synchronize_sched()</tt>,
2495<tt>synchronize_rcu_sched_expedited()</tt>,
2496<tt>call_rcu_sched()</tt>,
2497<tt>rcu_barrier_sched()</tt>, and
2498<tt>rcu_read_lock_sched_held()</tt>.
2499However, anything that disables preemption also marks an RCU-sched
2500read-side critical section, including
2501<tt>preempt_disable()</tt> and <tt>preempt_enable()</tt>,
2502<tt>local_irq_save()</tt> and <tt>local_irq_restore()</tt>,
2503and so on.
2504
2505<h3><a name="Sleepable RCU">Sleepable RCU</a></h3>
2506
2507<p>
2508For well over a decade, someone saying &ldquo;I need to block within
2509an RCU read-side critical section&rdquo; was a reliable indication
2510that this someone did not understand RCU.
2511After all, if you are always blocking in an RCU read-side critical
2512section, you can probably afford to use a higher-overhead synchronization
2513mechanism.
2514However, that changed with the advent of the Linux kernel's notifiers,
2515whose RCU read-side critical
2516sections almost never sleep, but sometimes need to.
2517This resulted in the introduction of
2518<a href="https://lwn.net/Articles/202847/">sleepable RCU</a>,
2519or <i>SRCU</i>.
2520
2521<p>
2522SRCU allows different domains to be defined, with each such domain
2523defined by an instance of an <tt>srcu_struct</tt> structure.
2524A pointer to this structure must be passed in to each SRCU function,
2525for example, <tt>synchronize_srcu(&amp;ss)</tt>, where
2526<tt>ss</tt> is the <tt>srcu_struct</tt> structure.
2527The key benefit of these domains is that a slow SRCU reader in one
2528domain does not delay an SRCU grace period in some other domain.
2529That said, one consequence of these domains is that read-side code
2530must pass a &ldquo;cookie&rdquo; from <tt>srcu_read_lock()</tt>
2531to <tt>srcu_read_unlock()</tt>, for example, as follows:
2532
2533<blockquote>
2534<pre>
2535 1 int idx;
2536 2
2537 3 idx = srcu_read_lock(&amp;ss);
2538 4 do_something();
2539 5 srcu_read_unlock(&amp;ss, idx);
2540</pre>
2541</blockquote>
2542
2543<p>
2544As noted above, it is legal to block within SRCU read-side critical sections,
2545however, with great power comes great responsibility.
2546If you block forever in one of a given domain's SRCU read-side critical
2547sections, then that domain's grace periods will also be blocked forever.
2548Of course, one good way to block forever is to deadlock, which can
2549happen if any operation in a given domain's SRCU read-side critical
2550section can block waiting, either directly or indirectly, for that domain's
2551grace period to elapse.
2552For example, this results in a self-deadlock:
2553
2554<blockquote>
2555<pre>
2556 1 int idx;
2557 2
2558 3 idx = srcu_read_lock(&amp;ss);
2559 4 do_something();
2560 5 synchronize_srcu(&amp;ss);
2561 6 srcu_read_unlock(&amp;ss, idx);
2562</pre>
2563</blockquote>
2564
2565<p>
2566However, if line&nbsp;5 acquired a mutex that was held across
2567a <tt>synchronize_srcu()</tt> for domain <tt>ss</tt>,
2568deadlock would still be possible.
2569Furthermore, if line&nbsp;5 acquired a mutex that was held across
2570a <tt>synchronize_srcu()</tt> for some other domain <tt>ss1</tt>,
2571and if an <tt>ss1</tt>-domain SRCU read-side critical section
2572acquired another mutex that was held across as <tt>ss</tt>-domain
2573<tt>synchronize_srcu()</tt>,
2574deadlock would again be possible.
2575Such a deadlock cycle could extend across an arbitrarily large number
2576of different SRCU domains.
2577Again, with great power comes great responsibility.
2578
2579<p>
2580Unlike the other RCU flavors, SRCU read-side critical sections can
2581run on idle and even offline CPUs.
2582This ability requires that <tt>srcu_read_lock()</tt> and
2583<tt>srcu_read_unlock()</tt> contain memory barriers, which means
2584that SRCU readers will run a bit slower than would RCU readers.
2585It also motivates the <tt>smp_mb__after_srcu_read_unlock()</tt>
2586API, which, in combination with <tt>srcu_read_unlock()</tt>,
2587guarantees a full memory barrier.
2588
2589<p>
2590The
2591<a href="https://lwn.net/Articles/609973/#RCU Per-Flavor API Table">SRCU API</a>
2592includes
2593<tt>srcu_read_lock()</tt>,
2594<tt>srcu_read_unlock()</tt>,
2595<tt>srcu_dereference()</tt>,
2596<tt>srcu_dereference_check()</tt>,
2597<tt>synchronize_srcu()</tt>,
2598<tt>synchronize_srcu_expedited()</tt>,
2599<tt>call_srcu()</tt>,
2600<tt>srcu_barrier()</tt>, and
2601<tt>srcu_read_lock_held()</tt>.
2602It also includes
2603<tt>DEFINE_SRCU()</tt>,
2604<tt>DEFINE_STATIC_SRCU()</tt>, and
2605<tt>init_srcu_struct()</tt>
2606APIs for defining and initializing <tt>srcu_struct</tt> structures.
2607
2608<h3><a name="Tasks RCU">Tasks RCU</a></h3>
2609
2610<p>
2611Some forms of tracing use &ldquo;tramopolines&rdquo; to handle the
2612binary rewriting required to install different types of probes.
2613It would be good to be able to free old trampolines, which sounds
2614like a job for some form of RCU.
2615However, because it is necessary to be able to install a trace
2616anywhere in the code, it is not possible to use read-side markers
2617such as <tt>rcu_read_lock()</tt> and <tt>rcu_read_unlock()</tt>.
2618In addition, it does not work to have these markers in the trampoline
2619itself, because there would need to be instructions following
2620<tt>rcu_read_unlock()</tt>.
2621Although <tt>synchronize_rcu()</tt> would guarantee that execution
2622reached the <tt>rcu_read_unlock()</tt>, it would not be able to
2623guarantee that execution had completely left the trampoline.
2624
2625<p>
2626The solution, in the form of
2627<a href="https://lwn.net/Articles/607117/"><i>Tasks RCU</i></a>,
2628is to have implicit
2629read-side critical sections that are delimited by voluntary context
2630switches, that is, calls to <tt>schedule()</tt>,
2631<tt>cond_resched_rcu_qs()</tt>, and
2632<tt>synchronize_rcu_tasks()</tt>.
2633In addition, transitions to and from userspace execution also delimit
2634tasks-RCU read-side critical sections.
2635
2636<p>
2637The tasks-RCU API is quite compact, consisting only of
2638<tt>call_rcu_tasks()</tt>,
2639<tt>synchronize_rcu_tasks()</tt>, and
2640<tt>rcu_barrier_tasks()</tt>.
2641
2642<h2><a name="Possible Future Changes">Possible Future Changes</a></h2>
2643
2644<p>
2645One of the tricks that RCU uses to attain update-side scalability is
2646to increase grace-period latency with increasing numbers of CPUs.
2647If this becomes a serious problem, it will be necessary to rework the
2648grace-period state machine so as to avoid the need for the additional
2649latency.
2650
2651<p>
2652Expedited grace periods scan the CPUs, so their latency and overhead
2653increases with increasing numbers of CPUs.
2654If this becomes a serious problem on large systems, it will be necessary
2655to do some redesign to avoid this scalability problem.
2656
2657<p>
2658RCU disables CPU hotplug in a few places, perhaps most notably in the
2659expedited grace-period and <tt>rcu_barrier()</tt> operations.
2660If there is a strong reason to use expedited grace periods in CPU-hotplug
2661notifiers, it will be necessary to avoid disabling CPU hotplug.
2662This would introduce some complexity, so there had better be a <i>very</i>
2663good reason.
2664
2665<p>
2666The tradeoff between grace-period latency on the one hand and interruptions
2667of other CPUs on the other hand may need to be re-examined.
2668The desire is of course for zero grace-period latency as well as zero
2669interprocessor interrupts undertaken during an expedited grace period
2670operation.
2671While this ideal is unlikely to be achievable, it is quite possible that
2672further improvements can be made.
2673
2674<p>
2675The multiprocessor implementations of RCU use a combining tree that
2676groups CPUs so as to reduce lock contention and increase cache locality.
2677However, this combining tree does not spread its memory across NUMA
2678nodes nor does it align the CPU groups with hardware features such
2679as sockets or cores.
2680Such spreading and alignment is currently believed to be unnecessary
2681because the hotpath read-side primitives do not access the combining
2682tree, nor does <tt>call_rcu()</tt> in the common case.
2683If you believe that your architecture needs such spreading and alignment,
2684then your architecture should also benefit from the
2685<tt>rcutree.rcu_fanout_leaf</tt> boot parameter, which can be set
2686to the number of CPUs in a socket, NUMA node, or whatever.
2687If the number of CPUs is too large, use a fraction of the number of
2688CPUs.
2689If the number of CPUs is a large prime number, well, that certainly
2690is an &ldquo;interesting&rdquo; architectural choice!
2691More flexible arrangements might be considered, but only if
2692<tt>rcutree.rcu_fanout_leaf</tt> has proven inadequate, and only
2693if the inadequacy has been demonstrated by a carefully run and
2694realistic system-level workload.
2695
2696<p>
2697Please note that arrangements that require RCU to remap CPU numbers will
2698require extremely good demonstration of need and full exploration of
2699alternatives.
2700
2701<p>
2702There is an embarrassingly large number of flavors of RCU, and this
2703number has been increasing over time.
2704Perhaps it will be possible to combine some at some future date.
2705
2706<p>
2707RCU's various kthreads are reasonably recent additions.
2708It is quite likely that adjustments will be required to more gracefully
2709handle extreme loads.
2710It might also be necessary to be able to relate CPU utilization by
2711RCU's kthreads and softirq handlers to the code that instigated this
2712CPU utilization.
2713For example, RCU callback overhead might be charged back to the
2714originating <tt>call_rcu()</tt> instance, though probably not
2715in production kernels.
2716
2717<h2><a name="Summary">Summary</a></h2>
2718
2719<p>
2720This document has presented more than two decade's worth of RCU
2721requirements.
2722Given that the requirements keep changing, this will not be the last
2723word on this subject, but at least it serves to get an important
2724subset of the requirements set forth.
2725
2726<h2><a name="Acknowledgments">Acknowledgments</a></h2>
2727
2728I am grateful to Steven Rostedt, Lai Jiangshan, Ingo Molnar,
2729Oleg Nesterov, Borislav Petkov, Peter Zijlstra, Boqun Feng, and
2730Andy Lutomirski for their help in rendering
2731this article human readable, and to Michelle Rankin for her support
2732of this effort.
2733Other contributions are acknowledged in the Linux kernel's git archive.
2734The cartoon is copyright (c) 2013 by Melissa Broussard,
2735and is provided
2736under the terms of the Creative Commons Attribution-Share Alike 3.0
2737United States license.
2738
2739<p>@@QQAL@@
2740
2741</body></html>
diff --git a/Documentation/RCU/Design/htmlqqz.sh b/Documentation/RCU/Design/htmlqqz.sh
new file mode 100755
index 000000000000..d354f069559b
--- /dev/null
+++ b/Documentation/RCU/Design/htmlqqz.sh
@@ -0,0 +1,108 @@
1#!/bin/sh
2#
3# Usage: sh htmlqqz.sh file
4#
5# Extracts and converts quick quizzes in a proto-HTML document file.htmlx.
6# Commands, all of which must be on a line by themselves:
7#
8# "<p>@@QQ@@": Start of a quick quiz.
9# "<p>@@QQA@@": Start of a quick-quiz answer.
10# "<p>@@QQE@@": End of a quick-quiz answer, and thus of the quick quiz.
11# "<p>@@QQAL@@": Place to put quick-quiz answer list.
12#
13# Places the result in file.html.
14#
15# This program is free software; you can redistribute it and/or modify
16# it under the terms of the GNU General Public License as published by
17# the Free Software Foundation; either version 2 of the License, or
18# (at your option) any later version.
19#
20# This program is distributed in the hope that it will be useful,
21# but WITHOUT ANY WARRANTY; without even the implied warranty of
22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23# GNU General Public License for more details.
24#
25# You should have received a copy of the GNU General Public License
26# along with this program; if not, you can access it online at
27# http://www.gnu.org/licenses/gpl-2.0.html.
28#
29# Copyright (c) 2013 Paul E. McKenney, IBM Corporation.
30
31fn=$1
32if test ! -r $fn.htmlx
33then
34 echo "Error: $fn.htmlx unreadable."
35 exit 1
36fi
37
38echo "<!-- DO NOT HAND EDIT. -->" > $fn.html
39echo "<!-- Instead, edit $fn.htmlx and run 'sh htmlqqz.sh $fn' -->" >> $fn.html
40awk < $fn.htmlx >> $fn.html '
41
42state == "" && $1 != "<p>@@QQ@@" && $1 != "<p>@@QQAL@@" {
43 print $0;
44 if ($0 ~ /^<p>@@QQ/)
45 print "Bad Quick Quiz command: " NR " (expected <p>@@QQ@@ or <p>@@QQAL@@)." > "/dev/stderr"
46 next;
47}
48
49state == "" && $1 == "<p>@@QQ@@" {
50 qqn++;
51 qqlineno = NR;
52 haveqq = 1;
53 state = "qq";
54 print "<p><a name=\"Quick Quiz " qqn "\"><b>Quick Quiz " qqn "</b>:</a>"
55 next;
56}
57
58state == "qq" && $1 != "<p>@@QQA@@" {
59 qq[qqn] = qq[qqn] $0 "\n";
60 print $0
61 if ($0 ~ /^<p>@@QQ/)
62 print "Bad Quick Quiz command: " NR ". (expected <p>@@QQA@@)" > "/dev/stderr"
63 next;
64}
65
66state == "qq" && $1 == "<p>@@QQA@@" {
67 state = "qqa";
68 print "<br><a href=\"#qq" qqn "answer\">Answer</a>"
69 next;
70}
71
72state == "qqa" && $1 != "<p>@@QQE@@" {
73 qqa[qqn] = qqa[qqn] $0 "\n";
74 if ($0 ~ /^<p>@@QQ/)
75 print "Bad Quick Quiz command: " NR " (expected <p>@@QQE@@)." > "/dev/stderr"
76 next;
77}
78
79state == "qqa" && $1 == "<p>@@QQE@@" {
80 state = "";
81 next;
82}
83
84state == "" && $1 == "<p>@@QQAL@@" {
85 haveqq = "";
86 print "<h3><a name=\"Answers to Quick Quizzes\">"
87 print "Answers to Quick Quizzes</a></h3>"
88 print "";
89 for (i = 1; i <= qqn; i++) {
90 print "<a name=\"qq" i "answer\"></a>"
91 print "<p><b>Quick Quiz " i "</b>:"
92 print qq[i];
93 print "";
94 print "</p><p><b>Answer</b>:"
95 print qqa[i];
96 print "";
97 print "</p><p><a href=\"#Quick%20Quiz%20" i "\"><b>Back to Quick Quiz " i "</b>.</a>"
98 print "";
99 }
100 next;
101}
102
103END {
104 if (state != "")
105 print "Unterminated Quick Quiz: " qqlineno "." > "/dev/stderr"
106 else if (haveqq)
107 print "Missing \"<p>@@QQAL@@\", no Quick Quiz." > "/dev/stderr"
108}'
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index f40578026a04..7785fb5eb93f 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -375,7 +375,8 @@ int main(int argc, char *argv[])
375 } 375 }
376 } 376 }
377 377
378 if ((nl_sd = create_nl_socket(NETLINK_GENERIC)) < 0) 378 nl_sd = create_nl_socket(NETLINK_GENERIC);
379 if (nl_sd < 0)
379 err(1, "error creating Netlink socket\n"); 380 err(1, "error creating Netlink socket\n");
380 381
381 382
diff --git a/Documentation/arm/Marvell/README b/Documentation/arm/Marvell/README
index 18a775d10172..ae89b67d8e23 100644
--- a/Documentation/arm/Marvell/README
+++ b/Documentation/arm/Marvell/README
@@ -233,29 +233,30 @@ MMP/MMP2 family (communication processor)
233 Linux kernel mach directory: arch/arm/mach-mmp 233 Linux kernel mach directory: arch/arm/mach-mmp
234 Linux kernel plat directory: arch/arm/plat-pxa 234 Linux kernel plat directory: arch/arm/plat-pxa
235 235
236Berlin family (Digital Entertainment) 236Berlin family (Multimedia Solutions)
237------------------------------------- 237-------------------------------------
238 238
239 Flavors: 239 Flavors:
240 88DE3005, Armada 1500-mini 240 88DE3005, Armada 1500 Mini
241 Design name: BG2CD 241 Design name: BG2CD
242 Core: ARM Cortex-A9, PL310 L2CC 242 Core: ARM Cortex-A9, PL310 L2CC
243 Homepage: http://www.marvell.com/digital-entertainment/armada-1500-mini/ 243 Homepage: http://www.marvell.com/multimedia-solutions/armada-1500-mini/
244 88DE3006, Armada 1500 Mini Plus
245 Design name: BG2CDP
246 Core: Dual Core ARM Cortex-A7
247 Homepage: http://www.marvell.com/multimedia-solutions/armada-1500-mini-plus/
244 88DE3100, Armada 1500 248 88DE3100, Armada 1500
245 Design name: BG2 249 Design name: BG2
246 Core: Marvell PJ4B (ARMv7), Tauros3 L2CC 250 Core: Marvell PJ4B (ARMv7), Tauros3 L2CC
247 Homepage: http://www.marvell.com/digital-entertainment/armada-1500/ 251 Product Brief: http://www.marvell.com/multimedia-solutions/armada-1500/assets/Marvell-ARMADA-1500-Product-Brief.pdf
248 Product Brief: http://www.marvell.com/digital-entertainment/armada-1500/assets/Marvell-ARMADA-1500-Product-Brief.pdf
249 88DE3114, Armada 1500 Pro 252 88DE3114, Armada 1500 Pro
250 Design name: BG2-Q 253 Design name: BG2Q
251 Core: Quad Core ARM Cortex-A9, PL310 L2CC 254 Core: Quad Core ARM Cortex-A9, PL310 L2CC
252 Homepage: http://www.marvell.com/digital-entertainment/armada-1500-pro/
253 Product Brief: http://www.marvell.com/digital-entertainment/armada-1500-pro/assets/Marvell_ARMADA_1500_PRO-01_product_brief.pdf
254 88DE???? 255 88DE????
255 Design name: BG3 256 Design name: BG3
256 Core: ARM Cortex-A15, CA15 integrated L2CC 257 Core: ARM Cortex-A15, CA15 integrated L2CC
257 258
258 Homepage: http://www.marvell.com/digital-entertainment/ 259 Homepage: http://www.marvell.com/multimedia-solutions/
259 Directory: arch/arm/mach-berlin 260 Directory: arch/arm/mach-berlin
260 261
261 Comments: 262 Comments:
diff --git a/Documentation/arm/pxa/mfp.txt b/Documentation/arm/pxa/mfp.txt
index a179e5bc02c9..0b7cab978c02 100644
--- a/Documentation/arm/pxa/mfp.txt
+++ b/Documentation/arm/pxa/mfp.txt
@@ -49,7 +49,7 @@ to this new MFP mechanism, here are several key points:
49 internal controllers like PWM, SSP and UART, with 128 internal signals 49 internal controllers like PWM, SSP and UART, with 128 internal signals
50 which can be routed to external through one or more MFPs (e.g. GPIO<0> 50 which can be routed to external through one or more MFPs (e.g. GPIO<0>
51 can be routed through either MFP_PIN_GPIO0 as well as MFP_PIN_GPIO0_2, 51 can be routed through either MFP_PIN_GPIO0 as well as MFP_PIN_GPIO0_2,
52 see arch/arm/mach-pxa/mach/include/mfp-pxa300.h) 52 see arch/arm/mach-pxa/mfp-pxa300.h)
53 53
54 2. Alternate function configuration is removed from this GPIO controller, 54 2. Alternate function configuration is removed from this GPIO controller,
55 the remaining functions are pure GPIO-specific, i.e. 55 the remaining functions are pure GPIO-specific, i.e.
@@ -76,11 +76,11 @@ For board code writers, here are some guidelines:
76 76
771. include ONE of the following header files in your <board>.c: 771. include ONE of the following header files in your <board>.c:
78 78
79 - #include <mach/mfp-pxa25x.h> 79 - #include "mfp-pxa25x.h"
80 - #include <mach/mfp-pxa27x.h> 80 - #include "mfp-pxa27x.h"
81 - #include <mach/mfp-pxa300.h> 81 - #include "mfp-pxa300.h"
82 - #include <mach/mfp-pxa320.h> 82 - #include "mfp-pxa320.h"
83 - #include <mach/mfp-pxa930.h> 83 - #include "mfp-pxa930.h"
84 84
85 NOTE: only one file in your <board>.c, depending on the processors used, 85 NOTE: only one file in your <board>.c, depending on the processors used,
86 because pin configuration definitions may conflict in these file (i.e. 86 because pin configuration definitions may conflict in these file (i.e.
@@ -203,20 +203,20 @@ make them effective there-after.
203 1. Unified pin definitions - enum constants for all configurable pins 203 1. Unified pin definitions - enum constants for all configurable pins
204 2. processor-neutral bit definitions for a possible MFP configuration 204 2. processor-neutral bit definitions for a possible MFP configuration
205 205
206 - arch/arm/mach-pxa/include/mach/mfp-pxa3xx.h 206 - arch/arm/mach-pxa/mfp-pxa3xx.h
207 207
208 for PXA3xx specific MFPR register bit definitions and PXA3xx common pin 208 for PXA3xx specific MFPR register bit definitions and PXA3xx common pin
209 configurations 209 configurations
210 210
211 - arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h 211 - arch/arm/mach-pxa/mfp-pxa2xx.h
212 212
213 for PXA2xx specific definitions and PXA25x/PXA27x common pin configurations 213 for PXA2xx specific definitions and PXA25x/PXA27x common pin configurations
214 214
215 - arch/arm/mach-pxa/include/mach/mfp-pxa25x.h 215 - arch/arm/mach-pxa/mfp-pxa25x.h
216 arch/arm/mach-pxa/include/mach/mfp-pxa27x.h 216 arch/arm/mach-pxa/mfp-pxa27x.h
217 arch/arm/mach-pxa/include/mach/mfp-pxa300.h 217 arch/arm/mach-pxa/mfp-pxa300.h
218 arch/arm/mach-pxa/include/mach/mfp-pxa320.h 218 arch/arm/mach-pxa/mfp-pxa320.h
219 arch/arm/mach-pxa/include/mach/mfp-pxa930.h 219 arch/arm/mach-pxa/mfp-pxa930.h
220 220
221 for processor specific definitions 221 for processor specific definitions
222 222
diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt
new file mode 100644
index 000000000000..58b71ddf9b60
--- /dev/null
+++ b/Documentation/arm64/silicon-errata.txt
@@ -0,0 +1,58 @@
1 Silicon Errata and Software Workarounds
2 =======================================
3
4Author: Will Deacon <will.deacon@arm.com>
5Date : 27 November 2015
6
7It is an unfortunate fact of life that hardware is often produced with
8so-called "errata", which can cause it to deviate from the architecture
9under specific circumstances. For hardware produced by ARM, these
10errata are broadly classified into the following categories:
11
12 Category A: A critical error without a viable workaround.
13 Category B: A significant or critical error with an acceptable
14 workaround.
15 Category C: A minor error that is not expected to occur under normal
16 operation.
17
18For more information, consult one of the "Software Developers Errata
19Notice" documents available on infocenter.arm.com (registration
20required).
21
22As far as Linux is concerned, Category B errata may require some special
23treatment in the operating system. For example, avoiding a particular
24sequence of code, or configuring the processor in a particular way. A
25less common situation may require similar actions in order to declassify
26a Category A erratum into a Category C erratum. These are collectively
27known as "software workarounds" and are only required in the minority of
28cases (e.g. those cases that both require a non-secure workaround *and*
29can be triggered by Linux).
30
31For software workarounds that may adversely impact systems unaffected by
32the erratum in question, a Kconfig entry is added under "Kernel
33Features" -> "ARM errata workarounds via the alternatives framework".
34These are enabled by default and patched in at runtime when an affected
35CPU is detected. For less-intrusive workarounds, a Kconfig option is not
36available and the code is structured (preferably with a comment) in such
37a way that the erratum will not be hit.
38
39This approach can make it slightly onerous to determine exactly which
40errata are worked around in an arbitrary kernel source tree, so this
41file acts as a registry of software workarounds in the Linux Kernel and
42will be updated when new workarounds are committed and backported to
43stable kernels.
44
45| Implementor | Component | Erratum ID | Kconfig |
46+----------------+-----------------+-----------------+-------------------------+
47| ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 |
48| ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 |
49| ARM | Cortex-A53 | #824069 | ARM64_ERRATUM_824069 |
50| ARM | Cortex-A53 | #819472 | ARM64_ERRATUM_819472 |
51| ARM | Cortex-A53 | #845719 | ARM64_ERRATUM_845719 |
52| ARM | Cortex-A53 | #843419 | ARM64_ERRATUM_843419 |
53| ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 |
54| ARM | Cortex-A57 | #852523 | N/A |
55| ARM | Cortex-A57 | #834220 | ARM64_ERRATUM_834220 |
56| | | | |
57| Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 |
58| Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 |
diff --git a/Documentation/block/cfq-iosched.txt b/Documentation/block/cfq-iosched.txt
index f3bc72945cbd..1e4f835a659d 100644
--- a/Documentation/block/cfq-iosched.txt
+++ b/Documentation/block/cfq-iosched.txt
@@ -81,14 +81,13 @@ on higher end storage.
81 81
82Default value for this parameter is 8ms. 82Default value for this parameter is 8ms.
83 83
84latency 84low_latency
85------- 85-----------
86This parameter is used to enable/disable the latency mode of the CFQ 86This parameter is used to enable/disable the low latency mode of the CFQ
87scheduler. If latency mode (called low_latency) is enabled, CFQ tries 87scheduler. If enabled, CFQ tries to recompute the slice time for each process
88to recompute the slice time for each process based on the target_latency set 88based on the target_latency set for the system. This favors fairness over
89for the system. This favors fairness over throughput. Disabling low 89throughput. Disabling low latency (setting it to 0) ignores target latency,
90latency (setting it to 0) ignores target latency, allowing each process in the 90allowing each process in the system to get a full time slice.
91system to get a full time slice.
92 91
93By default low latency mode is enabled. 92By default low latency mode is enabled.
94 93
diff --git a/Documentation/cgroups/00-INDEX b/Documentation/cgroup-v1/00-INDEX
index 3f5a40f57d4a..6ad425f7cf56 100644
--- a/Documentation/cgroups/00-INDEX
+++ b/Documentation/cgroup-v1/00-INDEX
@@ -24,7 +24,5 @@ net_prio.txt
24 - Network priority cgroups details and usages. 24 - Network priority cgroups details and usages.
25pids.txt 25pids.txt
26 - Process number cgroups details and usages. 26 - Process number cgroups details and usages.
27resource_counter.txt
28 - Resource Counter API.
29unified-hierarchy.txt 27unified-hierarchy.txt
30 - Description the new/next cgroup interface. 28 - Description the new/next cgroup interface.
diff --git a/Documentation/cgroups/blkio-controller.txt b/Documentation/cgroup-v1/blkio-controller.txt
index 52fa9f353342..673dc34d3f78 100644
--- a/Documentation/cgroups/blkio-controller.txt
+++ b/Documentation/cgroup-v1/blkio-controller.txt
@@ -84,8 +84,7 @@ Throttling/Upper Limit policy
84 84
85- Run dd to read a file and see if rate is throttled to 1MB/s or not. 85- Run dd to read a file and see if rate is throttled to 1MB/s or not.
86 86
87 # dd if=/mnt/common/zerofile of=/dev/null bs=4K count=1024 87 # dd iflag=direct if=/mnt/common/zerofile of=/dev/null bs=4K count=1024
88 # iflag=direct
89 1024+0 records in 88 1024+0 records in
90 1024+0 records out 89 1024+0 records out
91 4194304 bytes (4.2 MB) copied, 4.0001 s, 1.0 MB/s 90 4194304 bytes (4.2 MB) copied, 4.0001 s, 1.0 MB/s
@@ -374,82 +373,3 @@ One can experience an overall throughput drop if you have created multiple
374groups and put applications in that group which are not driving enough 373groups and put applications in that group which are not driving enough
375IO to keep disk busy. In that case set group_idle=0, and CFQ will not idle 374IO to keep disk busy. In that case set group_idle=0, and CFQ will not idle
376on individual groups and throughput should improve. 375on individual groups and throughput should improve.
377
378Writeback
379=========
380
381Page cache is dirtied through buffered writes and shared mmaps and
382written asynchronously to the backing filesystem by the writeback
383mechanism. Writeback sits between the memory and IO domains and
384regulates the proportion of dirty memory by balancing dirtying and
385write IOs.
386
387On traditional cgroup hierarchies, relationships between different
388controllers cannot be established making it impossible for writeback
389to operate accounting for cgroup resource restrictions and all
390writeback IOs are attributed to the root cgroup.
391
392If both the blkio and memory controllers are used on the v2 hierarchy
393and the filesystem supports cgroup writeback, writeback operations
394correctly follow the resource restrictions imposed by both memory and
395blkio controllers.
396
397Writeback examines both system-wide and per-cgroup dirty memory status
398and enforces the more restrictive of the two. Also, writeback control
399parameters which are absolute values - vm.dirty_bytes and
400vm.dirty_background_bytes - are distributed across cgroups according
401to their current writeback bandwidth.
402
403There's a peculiarity stemming from the discrepancy in ownership
404granularity between memory controller and writeback. While memory
405controller tracks ownership per page, writeback operates on inode
406basis. cgroup writeback bridges the gap by tracking ownership by
407inode but migrating ownership if too many foreign pages, pages which
408don't match the current inode ownership, have been encountered while
409writing back the inode.
410
411This is a conscious design choice as writeback operations are
412inherently tied to inodes making strictly following page ownership
413complicated and inefficient. The only use case which suffers from
414this compromise is multiple cgroups concurrently dirtying disjoint
415regions of the same inode, which is an unlikely use case and decided
416to be unsupported. Note that as memory controller assigns page
417ownership on the first use and doesn't update it until the page is
418released, even if cgroup writeback strictly follows page ownership,
419multiple cgroups dirtying overlapping areas wouldn't work as expected.
420In general, write-sharing an inode across multiple cgroups is not well
421supported.
422
423Filesystem support for cgroup writeback
424---------------------------------------
425
426A filesystem can make writeback IOs cgroup-aware by updating
427address_space_operations->writepage[s]() to annotate bio's using the
428following two functions.
429
430* wbc_init_bio(@wbc, @bio)
431
432 Should be called for each bio carrying writeback data and associates
433 the bio with the inode's owner cgroup. Can be called anytime
434 between bio allocation and submission.
435
436* wbc_account_io(@wbc, @page, @bytes)
437
438 Should be called for each data segment being written out. While
439 this function doesn't care exactly when it's called during the
440 writeback session, it's the easiest and most natural to call it as
441 data segments are added to a bio.
442
443With writeback bio's annotated, cgroup support can be enabled per
444super_block by setting MS_CGROUPWB in ->s_flags. This allows for
445selective disabling of cgroup writeback support which is helpful when
446certain filesystem features, e.g. journaled data mode, are
447incompatible.
448
449wbc_init_bio() binds the specified bio to its cgroup. Depending on
450the configuration, the bio may be executed at a lower priority and if
451the writeback session is holding shared resources, e.g. a journal
452entry, may lead to priority inversion. There is no one easy solution
453for the problem. Filesystems can try to work around specific problem
454cases by skipping wbc_init_bio() or using bio_associate_blkcg()
455directly.
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroup-v1/cgroups.txt
index c6256ae9885b..c6256ae9885b 100644
--- a/Documentation/cgroups/cgroups.txt
+++ b/Documentation/cgroup-v1/cgroups.txt
diff --git a/Documentation/cgroups/cpuacct.txt b/Documentation/cgroup-v1/cpuacct.txt
index 9d73cc0cadb9..9d73cc0cadb9 100644
--- a/Documentation/cgroups/cpuacct.txt
+++ b/Documentation/cgroup-v1/cpuacct.txt
diff --git a/Documentation/cgroups/cpusets.txt b/Documentation/cgroup-v1/cpusets.txt
index fdf7dff3f607..fdf7dff3f607 100644
--- a/Documentation/cgroups/cpusets.txt
+++ b/Documentation/cgroup-v1/cpusets.txt
diff --git a/Documentation/cgroups/devices.txt b/Documentation/cgroup-v1/devices.txt
index 3c1095ca02ea..3c1095ca02ea 100644
--- a/Documentation/cgroups/devices.txt
+++ b/Documentation/cgroup-v1/devices.txt
diff --git a/Documentation/cgroups/freezer-subsystem.txt b/Documentation/cgroup-v1/freezer-subsystem.txt
index e831cb2b8394..e831cb2b8394 100644
--- a/Documentation/cgroups/freezer-subsystem.txt
+++ b/Documentation/cgroup-v1/freezer-subsystem.txt
diff --git a/Documentation/cgroups/hugetlb.txt b/Documentation/cgroup-v1/hugetlb.txt
index 106245c3aecc..106245c3aecc 100644
--- a/Documentation/cgroups/hugetlb.txt
+++ b/Documentation/cgroup-v1/hugetlb.txt
diff --git a/Documentation/cgroups/memcg_test.txt b/Documentation/cgroup-v1/memcg_test.txt
index 8870b0212150..8870b0212150 100644
--- a/Documentation/cgroups/memcg_test.txt
+++ b/Documentation/cgroup-v1/memcg_test.txt
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroup-v1/memory.txt
index ff71e16cc752..ff71e16cc752 100644
--- a/Documentation/cgroups/memory.txt
+++ b/Documentation/cgroup-v1/memory.txt
diff --git a/Documentation/cgroups/net_cls.txt b/Documentation/cgroup-v1/net_cls.txt
index ec182346dea2..ec182346dea2 100644
--- a/Documentation/cgroups/net_cls.txt
+++ b/Documentation/cgroup-v1/net_cls.txt
diff --git a/Documentation/cgroups/net_prio.txt b/Documentation/cgroup-v1/net_prio.txt
index a82cbd28ea8a..a82cbd28ea8a 100644
--- a/Documentation/cgroups/net_prio.txt
+++ b/Documentation/cgroup-v1/net_prio.txt
diff --git a/Documentation/cgroups/pids.txt b/Documentation/cgroup-v1/pids.txt
index 1a078b5d281a..1a078b5d281a 100644
--- a/Documentation/cgroups/pids.txt
+++ b/Documentation/cgroup-v1/pids.txt
diff --git a/Documentation/cgroup-v2.txt b/Documentation/cgroup-v2.txt
new file mode 100644
index 000000000000..65b3eac8856c
--- /dev/null
+++ b/Documentation/cgroup-v2.txt
@@ -0,0 +1,1382 @@
1
2Control Group v2
3
4October, 2015 Tejun Heo <tj@kernel.org>
5
6This is the authoritative documentation on the design, interface and
7conventions of cgroup v2. It describes all userland-visible aspects
8of cgroup including core and specific controller behaviors. All
9future changes must be reflected in this document. Documentation for
10v1 is available under Documentation/cgroup-legacy/.
11
12CONTENTS
13
141. Introduction
15 1-1. Terminology
16 1-2. What is cgroup?
172. Basic Operations
18 2-1. Mounting
19 2-2. Organizing Processes
20 2-3. [Un]populated Notification
21 2-4. Controlling Controllers
22 2-4-1. Enabling and Disabling
23 2-4-2. Top-down Constraint
24 2-4-3. No Internal Process Constraint
25 2-5. Delegation
26 2-5-1. Model of Delegation
27 2-5-2. Delegation Containment
28 2-6. Guidelines
29 2-6-1. Organize Once and Control
30 2-6-2. Avoid Name Collisions
313. Resource Distribution Models
32 3-1. Weights
33 3-2. Limits
34 3-3. Protections
35 3-4. Allocations
364. Interface Files
37 4-1. Format
38 4-2. Conventions
39 4-3. Core Interface Files
405. Controllers
41 5-1. CPU
42 5-1-1. CPU Interface Files
43 5-2. Memory
44 5-2-1. Memory Interface Files
45 5-2-2. Usage Guidelines
46 5-2-3. Memory Ownership
47 5-3. IO
48 5-3-1. IO Interface Files
49 5-3-2. Writeback
50P. Information on Kernel Programming
51 P-1. Filesystem Support for Writeback
52D. Deprecated v1 Core Features
53R. Issues with v1 and Rationales for v2
54 R-1. Multiple Hierarchies
55 R-2. Thread Granularity
56 R-3. Competition Between Inner Nodes and Threads
57 R-4. Other Interface Issues
58 R-5. Controller Issues and Remedies
59 R-5-1. Memory
60
61
621. Introduction
63
641-1. Terminology
65
66"cgroup" stands for "control group" and is never capitalized. The
67singular form is used to designate the whole feature and also as a
68qualifier as in "cgroup controllers". When explicitly referring to
69multiple individual control groups, the plural form "cgroups" is used.
70
71
721-2. What is cgroup?
73
74cgroup is a mechanism to organize processes hierarchically and
75distribute system resources along the hierarchy in a controlled and
76configurable manner.
77
78cgroup is largely composed of two parts - the core and controllers.
79cgroup core is primarily responsible for hierarchically organizing
80processes. A cgroup controller is usually responsible for
81distributing a specific type of system resource along the hierarchy
82although there are utility controllers which serve purposes other than
83resource distribution.
84
85cgroups form a tree structure and every process in the system belongs
86to one and only one cgroup. All threads of a process belong to the
87same cgroup. On creation, all processes are put in the cgroup that
88the parent process belongs to at the time. A process can be migrated
89to another cgroup. Migration of a process doesn't affect already
90existing descendant processes.
91
92Following certain structural constraints, controllers may be enabled or
93disabled selectively on a cgroup. All controller behaviors are
94hierarchical - if a controller is enabled on a cgroup, it affects all
95processes which belong to the cgroups consisting the inclusive
96sub-hierarchy of the cgroup. When a controller is enabled on a nested
97cgroup, it always restricts the resource distribution further. The
98restrictions set closer to the root in the hierarchy can not be
99overridden from further away.
100
101
1022. Basic Operations
103
1042-1. Mounting
105
106Unlike v1, cgroup v2 has only single hierarchy. The cgroup v2
107hierarchy can be mounted with the following mount command.
108
109 # mount -t cgroup2 none $MOUNT_POINT
110
111cgroup2 filesystem has the magic number 0x63677270 ("cgrp"). All
112controllers which support v2 and are not bound to a v1 hierarchy are
113automatically bound to the v2 hierarchy and show up at the root.
114Controllers which are not in active use in the v2 hierarchy can be
115bound to other hierarchies. This allows mixing v2 hierarchy with the
116legacy v1 multiple hierarchies in a fully backward compatible way.
117
118A controller can be moved across hierarchies only after the controller
119is no longer referenced in its current hierarchy. Because per-cgroup
120controller states are destroyed asynchronously and controllers may
121have lingering references, a controller may not show up immediately on
122the v2 hierarchy after the final umount of the previous hierarchy.
123Similarly, a controller should be fully disabled to be moved out of
124the unified hierarchy and it may take some time for the disabled
125controller to become available for other hierarchies; furthermore, due
126to inter-controller dependencies, other controllers may need to be
127disabled too.
128
129While useful for development and manual configurations, moving
130controllers dynamically between the v2 and other hierarchies is
131strongly discouraged for production use. It is recommended to decide
132the hierarchies and controller associations before starting using the
133controllers after system boot.
134
135
1362-2. Organizing Processes
137
138Initially, only the root cgroup exists to which all processes belong.
139A child cgroup can be created by creating a sub-directory.
140
141 # mkdir $CGROUP_NAME
142
143A given cgroup may have multiple child cgroups forming a tree
144structure. Each cgroup has a read-writable interface file
145"cgroup.procs". When read, it lists the PIDs of all processes which
146belong to the cgroup one-per-line. The PIDs are not ordered and the
147same PID may show up more than once if the process got moved to
148another cgroup and then back or the PID got recycled while reading.
149
150A process can be migrated into a cgroup by writing its PID to the
151target cgroup's "cgroup.procs" file. Only one process can be migrated
152on a single write(2) call. If a process is composed of multiple
153threads, writing the PID of any thread migrates all threads of the
154process.
155
156When a process forks a child process, the new process is born into the
157cgroup that the forking process belongs to at the time of the
158operation. After exit, a process stays associated with the cgroup
159that it belonged to at the time of exit until it's reaped; however, a
160zombie process does not appear in "cgroup.procs" and thus can't be
161moved to another cgroup.
162
163A cgroup which doesn't have any children or live processes can be
164destroyed by removing the directory. Note that a cgroup which doesn't
165have any children and is associated only with zombie processes is
166considered empty and can be removed.
167
168 # rmdir $CGROUP_NAME
169
170"/proc/$PID/cgroup" lists a process's cgroup membership. If legacy
171cgroup is in use in the system, this file may contain multiple lines,
172one for each hierarchy. The entry for cgroup v2 is always in the
173format "0::$PATH".
174
175 # cat /proc/842/cgroup
176 ...
177 0::/test-cgroup/test-cgroup-nested
178
179If the process becomes a zombie and the cgroup it was associated with
180is removed subsequently, " (deleted)" is appended to the path.
181
182 # cat /proc/842/cgroup
183 ...
184 0::/test-cgroup/test-cgroup-nested (deleted)
185
186
1872-3. [Un]populated Notification
188
189Each non-root cgroup has a "cgroup.events" file which contains
190"populated" field indicating whether the cgroup's sub-hierarchy has
191live processes in it. Its value is 0 if there is no live process in
192the cgroup and its descendants; otherwise, 1. poll and [id]notify
193events are triggered when the value changes. This can be used, for
194example, to start a clean-up operation after all processes of a given
195sub-hierarchy have exited. The populated state updates and
196notifications are recursive. Consider the following sub-hierarchy
197where the numbers in the parentheses represent the numbers of processes
198in each cgroup.
199
200 A(4) - B(0) - C(1)
201 \ D(0)
202
203A, B and C's "populated" fields would be 1 while D's 0. After the one
204process in C exits, B and C's "populated" fields would flip to "0" and
205file modified events will be generated on the "cgroup.events" files of
206both cgroups.
207
208
2092-4. Controlling Controllers
210
2112-4-1. Enabling and Disabling
212
213Each cgroup has a "cgroup.controllers" file which lists all
214controllers available for the cgroup to enable.
215
216 # cat cgroup.controllers
217 cpu io memory
218
219No controller is enabled by default. Controllers can be enabled and
220disabled by writing to the "cgroup.subtree_control" file.
221
222 # echo "+cpu +memory -io" > cgroup.subtree_control
223
224Only controllers which are listed in "cgroup.controllers" can be
225enabled. When multiple operations are specified as above, either they
226all succeed or fail. If multiple operations on the same controller
227are specified, the last one is effective.
228
229Enabling a controller in a cgroup indicates that the distribution of
230the target resource across its immediate children will be controlled.
231Consider the following sub-hierarchy. The enabled controllers are
232listed in parentheses.
233
234 A(cpu,memory) - B(memory) - C()
235 \ D()
236
237As A has "cpu" and "memory" enabled, A will control the distribution
238of CPU cycles and memory to its children, in this case, B. As B has
239"memory" enabled but not "CPU", C and D will compete freely on CPU
240cycles but their division of memory available to B will be controlled.
241
242As a controller regulates the distribution of the target resource to
243the cgroup's children, enabling it creates the controller's interface
244files in the child cgroups. In the above example, enabling "cpu" on B
245would create the "cpu." prefixed controller interface files in C and
246D. Likewise, disabling "memory" from B would remove the "memory."
247prefixed controller interface files from C and D. This means that the
248controller interface files - anything which doesn't start with
249"cgroup." are owned by the parent rather than the cgroup itself.
250
251
2522-4-2. Top-down Constraint
253
254Resources are distributed top-down and a cgroup can further distribute
255a resource only if the resource has been distributed to it from the
256parent. This means that all non-root "cgroup.subtree_control" files
257can only contain controllers which are enabled in the parent's
258"cgroup.subtree_control" file. A controller can be enabled only if
259the parent has the controller enabled and a controller can't be
260disabled if one or more children have it enabled.
261
262
2632-4-3. No Internal Process Constraint
264
265Non-root cgroups can only distribute resources to their children when
266they don't have any processes of their own. In other words, only
267cgroups which don't contain any processes can have controllers enabled
268in their "cgroup.subtree_control" files.
269
270This guarantees that, when a controller is looking at the part of the
271hierarchy which has it enabled, processes are always only on the
272leaves. This rules out situations where child cgroups compete against
273internal processes of the parent.
274
275The root cgroup is exempt from this restriction. Root contains
276processes and anonymous resource consumption which can't be associated
277with any other cgroups and requires special treatment from most
278controllers. How resource consumption in the root cgroup is governed
279is up to each controller.
280
281Note that the restriction doesn't get in the way if there is no
282enabled controller in the cgroup's "cgroup.subtree_control". This is
283important as otherwise it wouldn't be possible to create children of a
284populated cgroup. To control resource distribution of a cgroup, the
285cgroup must create children and transfer all its processes to the
286children before enabling controllers in its "cgroup.subtree_control"
287file.
288
289
2902-5. Delegation
291
2922-5-1. Model of Delegation
293
294A cgroup can be delegated to a less privileged user by granting write
295access of the directory and its "cgroup.procs" file to the user. Note
296that resource control interface files in a given directory control the
297distribution of the parent's resources and thus must not be delegated
298along with the directory.
299
300Once delegated, the user can build sub-hierarchy under the directory,
301organize processes as it sees fit and further distribute the resources
302it received from the parent. The limits and other settings of all
303resource controllers are hierarchical and regardless of what happens
304in the delegated sub-hierarchy, nothing can escape the resource
305restrictions imposed by the parent.
306
307Currently, cgroup doesn't impose any restrictions on the number of
308cgroups in or nesting depth of a delegated sub-hierarchy; however,
309this may be limited explicitly in the future.
310
311
3122-5-2. Delegation Containment
313
314A delegated sub-hierarchy is contained in the sense that processes
315can't be moved into or out of the sub-hierarchy by the delegatee. For
316a process with a non-root euid to migrate a target process into a
317cgroup by writing its PID to the "cgroup.procs" file, the following
318conditions must be met.
319
320- The writer's euid must match either uid or suid of the target process.
321
322- The writer must have write access to the "cgroup.procs" file.
323
324- The writer must have write access to the "cgroup.procs" file of the
325 common ancestor of the source and destination cgroups.
326
327The above three constraints ensure that while a delegatee may migrate
328processes around freely in the delegated sub-hierarchy it can't pull
329in from or push out to outside the sub-hierarchy.
330
331For an example, let's assume cgroups C0 and C1 have been delegated to
332user U0 who created C00, C01 under C0 and C10 under C1 as follows and
333all processes under C0 and C1 belong to U0.
334
335 ~~~~~~~~~~~~~ - C0 - C00
336 ~ cgroup ~ \ C01
337 ~ hierarchy ~
338 ~~~~~~~~~~~~~ - C1 - C10
339
340Let's also say U0 wants to write the PID of a process which is
341currently in C10 into "C00/cgroup.procs". U0 has write access to the
342file and uid match on the process; however, the common ancestor of the
343source cgroup C10 and the destination cgroup C00 is above the points
344of delegation and U0 would not have write access to its "cgroup.procs"
345files and thus the write will be denied with -EACCES.
346
347
3482-6. Guidelines
349
3502-6-1. Organize Once and Control
351
352Migrating a process across cgroups is a relatively expensive operation
353and stateful resources such as memory are not moved together with the
354process. This is an explicit design decision as there often exist
355inherent trade-offs between migration and various hot paths in terms
356of synchronization cost.
357
358As such, migrating processes across cgroups frequently as a means to
359apply different resource restrictions is discouraged. A workload
360should be assigned to a cgroup according to the system's logical and
361resource structure once on start-up. Dynamic adjustments to resource
362distribution can be made by changing controller configuration through
363the interface files.
364
365
3662-6-2. Avoid Name Collisions
367
368Interface files for a cgroup and its children cgroups occupy the same
369directory and it is possible to create children cgroups which collide
370with interface files.
371
372All cgroup core interface files are prefixed with "cgroup." and each
373controller's interface files are prefixed with the controller name and
374a dot. A controller's name is composed of lower case alphabets and
375'_'s but never begins with an '_' so it can be used as the prefix
376character for collision avoidance. Also, interface file names won't
377start or end with terms which are often used in categorizing workloads
378such as job, service, slice, unit or workload.
379
380cgroup doesn't do anything to prevent name collisions and it's the
381user's responsibility to avoid them.
382
383
3843. Resource Distribution Models
385
386cgroup controllers implement several resource distribution schemes
387depending on the resource type and expected use cases. This section
388describes major schemes in use along with their expected behaviors.
389
390
3913-1. Weights
392
393A parent's resource is distributed by adding up the weights of all
394active children and giving each the fraction matching the ratio of its
395weight against the sum. As only children which can make use of the
396resource at the moment participate in the distribution, this is
397work-conserving. Due to the dynamic nature, this model is usually
398used for stateless resources.
399
400All weights are in the range [1, 10000] with the default at 100. This
401allows symmetric multiplicative biases in both directions at fine
402enough granularity while staying in the intuitive range.
403
404As long as the weight is in range, all configuration combinations are
405valid and there is no reason to reject configuration changes or
406process migrations.
407
408"cpu.weight" proportionally distributes CPU cycles to active children
409and is an example of this type.
410
411
4123-2. Limits
413
414A child can only consume upto the configured amount of the resource.
415Limits can be over-committed - the sum of the limits of children can
416exceed the amount of resource available to the parent.
417
418Limits are in the range [0, max] and defaults to "max", which is noop.
419
420As limits can be over-committed, all configuration combinations are
421valid and there is no reason to reject configuration changes or
422process migrations.
423
424"io.max" limits the maximum BPS and/or IOPS that a cgroup can consume
425on an IO device and is an example of this type.
426
427
4283-3. Protections
429
430A cgroup is protected to be allocated upto the configured amount of
431the resource if the usages of all its ancestors are under their
432protected levels. Protections can be hard guarantees or best effort
433soft boundaries. Protections can also be over-committed in which case
434only upto the amount available to the parent is protected among
435children.
436
437Protections are in the range [0, max] and defaults to 0, which is
438noop.
439
440As protections can be over-committed, all configuration combinations
441are valid and there is no reason to reject configuration changes or
442process migrations.
443
444"memory.low" implements best-effort memory protection and is an
445example of this type.
446
447
4483-4. Allocations
449
450A cgroup is exclusively allocated a certain amount of a finite
451resource. Allocations can't be over-committed - the sum of the
452allocations of children can not exceed the amount of resource
453available to the parent.
454
455Allocations are in the range [0, max] and defaults to 0, which is no
456resource.
457
458As allocations can't be over-committed, some configuration
459combinations are invalid and should be rejected. Also, if the
460resource is mandatory for execution of processes, process migrations
461may be rejected.
462
463"cpu.rt.max" hard-allocates realtime slices and is an example of this
464type.
465
466
4674. Interface Files
468
4694-1. Format
470
471All interface files should be in one of the following formats whenever
472possible.
473
474 New-line separated values
475 (when only one value can be written at once)
476
477 VAL0\n
478 VAL1\n
479 ...
480
481 Space separated values
482 (when read-only or multiple values can be written at once)
483
484 VAL0 VAL1 ...\n
485
486 Flat keyed
487
488 KEY0 VAL0\n
489 KEY1 VAL1\n
490 ...
491
492 Nested keyed
493
494 KEY0 SUB_KEY0=VAL00 SUB_KEY1=VAL01...
495 KEY1 SUB_KEY0=VAL10 SUB_KEY1=VAL11...
496 ...
497
498For a writable file, the format for writing should generally match
499reading; however, controllers may allow omitting later fields or
500implement restricted shortcuts for most common use cases.
501
502For both flat and nested keyed files, only the values for a single key
503can be written at a time. For nested keyed files, the sub key pairs
504may be specified in any order and not all pairs have to be specified.
505
506
5074-2. Conventions
508
509- Settings for a single feature should be contained in a single file.
510
511- The root cgroup should be exempt from resource control and thus
512 shouldn't have resource control interface files. Also,
513 informational files on the root cgroup which end up showing global
514 information available elsewhere shouldn't exist.
515
516- If a controller implements weight based resource distribution, its
517 interface file should be named "weight" and have the range [1,
518 10000] with 100 as the default. The values are chosen to allow
519 enough and symmetric bias in both directions while keeping it
520 intuitive (the default is 100%).
521
522- If a controller implements an absolute resource guarantee and/or
523 limit, the interface files should be named "min" and "max"
524 respectively. If a controller implements best effort resource
525 guarantee and/or limit, the interface files should be named "low"
526 and "high" respectively.
527
528 In the above four control files, the special token "max" should be
529 used to represent upward infinity for both reading and writing.
530
531- If a setting has a configurable default value and keyed specific
532 overrides, the default entry should be keyed with "default" and
533 appear as the first entry in the file.
534
535 The default value can be updated by writing either "default $VAL" or
536 "$VAL".
537
538 When writing to update a specific override, "default" can be used as
539 the value to indicate removal of the override. Override entries
540 with "default" as the value must not appear when read.
541
542 For example, a setting which is keyed by major:minor device numbers
543 with integer values may look like the following.
544
545 # cat cgroup-example-interface-file
546 default 150
547 8:0 300
548
549 The default value can be updated by
550
551 # echo 125 > cgroup-example-interface-file
552
553 or
554
555 # echo "default 125" > cgroup-example-interface-file
556
557 An override can be set by
558
559 # echo "8:16 170" > cgroup-example-interface-file
560
561 and cleared by
562
563 # echo "8:0 default" > cgroup-example-interface-file
564 # cat cgroup-example-interface-file
565 default 125
566 8:16 170
567
568- For events which are not very high frequency, an interface file
569 "events" should be created which lists event key value pairs.
570 Whenever a notifiable event happens, file modified event should be
571 generated on the file.
572
573
5744-3. Core Interface Files
575
576All cgroup core files are prefixed with "cgroup."
577
578 cgroup.procs
579
580 A read-write new-line separated values file which exists on
581 all cgroups.
582
583 When read, it lists the PIDs of all processes which belong to
584 the cgroup one-per-line. The PIDs are not ordered and the
585 same PID may show up more than once if the process got moved
586 to another cgroup and then back or the PID got recycled while
587 reading.
588
589 A PID can be written to migrate the process associated with
590 the PID to the cgroup. The writer should match all of the
591 following conditions.
592
593 - Its euid is either root or must match either uid or suid of
594 the target process.
595
596 - It must have write access to the "cgroup.procs" file.
597
598 - It must have write access to the "cgroup.procs" file of the
599 common ancestor of the source and destination cgroups.
600
601 When delegating a sub-hierarchy, write access to this file
602 should be granted along with the containing directory.
603
604 cgroup.controllers
605
606 A read-only space separated values file which exists on all
607 cgroups.
608
609 It shows space separated list of all controllers available to
610 the cgroup. The controllers are not ordered.
611
612 cgroup.subtree_control
613
614 A read-write space separated values file which exists on all
615 cgroups. Starts out empty.
616
617 When read, it shows space separated list of the controllers
618 which are enabled to control resource distribution from the
619 cgroup to its children.
620
621 Space separated list of controllers prefixed with '+' or '-'
622 can be written to enable or disable controllers. A controller
623 name prefixed with '+' enables the controller and '-'
624 disables. If a controller appears more than once on the list,
625 the last one is effective. When multiple enable and disable
626 operations are specified, either all succeed or all fail.
627
628 cgroup.events
629
630 A read-only flat-keyed file which exists on non-root cgroups.
631 The following entries are defined. Unless specified
632 otherwise, a value change in this file generates a file
633 modified event.
634
635 populated
636
637 1 if the cgroup or its descendants contains any live
638 processes; otherwise, 0.
639
640
6415. Controllers
642
6435-1. CPU
644
645[NOTE: The interface for the cpu controller hasn't been merged yet]
646
647The "cpu" controllers regulates distribution of CPU cycles. This
648controller implements weight and absolute bandwidth limit models for
649normal scheduling policy and absolute bandwidth allocation model for
650realtime scheduling policy.
651
652
6535-1-1. CPU Interface Files
654
655All time durations are in microseconds.
656
657 cpu.stat
658
659 A read-only flat-keyed file which exists on non-root cgroups.
660
661 It reports the following six stats.
662
663 usage_usec
664 user_usec
665 system_usec
666 nr_periods
667 nr_throttled
668 throttled_usec
669
670 cpu.weight
671
672 A read-write single value file which exists on non-root
673 cgroups. The default is "100".
674
675 The weight in the range [1, 10000].
676
677 cpu.max
678
679 A read-write two value file which exists on non-root cgroups.
680 The default is "max 100000".
681
682 The maximum bandwidth limit. It's in the following format.
683
684 $MAX $PERIOD
685
686 which indicates that the group may consume upto $MAX in each
687 $PERIOD duration. "max" for $MAX indicates no limit. If only
688 one number is written, $MAX is updated.
689
690 cpu.rt.max
691
692 [NOTE: The semantics of this file is still under discussion and the
693 interface hasn't been merged yet]
694
695 A read-write two value file which exists on all cgroups.
696 The default is "0 100000".
697
698 The maximum realtime runtime allocation. Over-committing
699 configurations are disallowed and process migrations are
700 rejected if not enough bandwidth is available. It's in the
701 following format.
702
703 $MAX $PERIOD
704
705 which indicates that the group may consume upto $MAX in each
706 $PERIOD duration. If only one number is written, $MAX is
707 updated.
708
709
7105-2. Memory
711
712The "memory" controller regulates distribution of memory. Memory is
713stateful and implements both limit and protection models. Due to the
714intertwining between memory usage and reclaim pressure and the
715stateful nature of memory, the distribution model is relatively
716complex.
717
718While not completely water-tight, all major memory usages by a given
719cgroup are tracked so that the total memory consumption can be
720accounted and controlled to a reasonable extent. Currently, the
721following types of memory usages are tracked.
722
723- Userland memory - page cache and anonymous memory.
724
725- Kernel data structures such as dentries and inodes.
726
727- TCP socket buffers.
728
729The above list may expand in the future for better coverage.
730
731
7325-2-1. Memory Interface Files
733
734All memory amounts are in bytes. If a value which is not aligned to
735PAGE_SIZE is written, the value may be rounded up to the closest
736PAGE_SIZE multiple when read back.
737
738 memory.current
739
740 A read-only single value file which exists on non-root
741 cgroups.
742
743 The total amount of memory currently being used by the cgroup
744 and its descendants.
745
746 memory.low
747
748 A read-write single value file which exists on non-root
749 cgroups. The default is "0".
750
751 Best-effort memory protection. If the memory usages of a
752 cgroup and all its ancestors are below their low boundaries,
753 the cgroup's memory won't be reclaimed unless memory can be
754 reclaimed from unprotected cgroups.
755
756 Putting more memory than generally available under this
757 protection is discouraged.
758
759 memory.high
760
761 A read-write single value file which exists on non-root
762 cgroups. The default is "max".
763
764 Memory usage throttle limit. This is the main mechanism to
765 control memory usage of a cgroup. If a cgroup's usage goes
766 over the high boundary, the processes of the cgroup are
767 throttled and put under heavy reclaim pressure.
768
769 Going over the high limit never invokes the OOM killer and
770 under extreme conditions the limit may be breached.
771
772 memory.max
773
774 A read-write single value file which exists on non-root
775 cgroups. The default is "max".
776
777 Memory usage hard limit. This is the final protection
778 mechanism. If a cgroup's memory usage reaches this limit and
779 can't be reduced, the OOM killer is invoked in the cgroup.
780 Under certain circumstances, the usage may go over the limit
781 temporarily.
782
783 This is the ultimate protection mechanism. As long as the
784 high limit is used and monitored properly, this limit's
785 utility is limited to providing the final safety net.
786
787 memory.events
788
789 A read-only flat-keyed file which exists on non-root cgroups.
790 The following entries are defined. Unless specified
791 otherwise, a value change in this file generates a file
792 modified event.
793
794 low
795
796 The number of times the cgroup is reclaimed due to
797 high memory pressure even though its usage is under
798 the low boundary. This usually indicates that the low
799 boundary is over-committed.
800
801 high
802
803 The number of times processes of the cgroup are
804 throttled and routed to perform direct memory reclaim
805 because the high memory boundary was exceeded. For a
806 cgroup whose memory usage is capped by the high limit
807 rather than global memory pressure, this event's
808 occurrences are expected.
809
810 max
811
812 The number of times the cgroup's memory usage was
813 about to go over the max boundary. If direct reclaim
814 fails to bring it down, the OOM killer is invoked.
815
816 oom
817
818 The number of times the OOM killer has been invoked in
819 the cgroup. This may not exactly match the number of
820 processes killed but should generally be close.
821
822 memory.stat
823
824 A read-only flat-keyed file which exists on non-root cgroups.
825
826 This breaks down the cgroup's memory footprint into different
827 types of memory, type-specific details, and other information
828 on the state and past events of the memory management system.
829
830 All memory amounts are in bytes.
831
832 The entries are ordered to be human readable, and new entries
833 can show up in the middle. Don't rely on items remaining in a
834 fixed position; use the keys to look up specific values!
835
836 anon
837
838 Amount of memory used in anonymous mappings such as
839 brk(), sbrk(), and mmap(MAP_ANONYMOUS)
840
841 file
842
843 Amount of memory used to cache filesystem data,
844 including tmpfs and shared memory.
845
846 file_mapped
847
848 Amount of cached filesystem data mapped with mmap()
849
850 file_dirty
851
852 Amount of cached filesystem data that was modified but
853 not yet written back to disk
854
855 file_writeback
856
857 Amount of cached filesystem data that was modified and
858 is currently being written back to disk
859
860 inactive_anon
861 active_anon
862 inactive_file
863 active_file
864 unevictable
865
866 Amount of memory, swap-backed and filesystem-backed,
867 on the internal memory management lists used by the
868 page reclaim algorithm
869
870 pgfault
871
872 Total number of page faults incurred
873
874 pgmajfault
875
876 Number of major page faults incurred
877
878 memory.swap.current
879
880 A read-only single value file which exists on non-root
881 cgroups.
882
883 The total amount of swap currently being used by the cgroup
884 and its descendants.
885
886 memory.swap.max
887
888 A read-write single value file which exists on non-root
889 cgroups. The default is "max".
890
891 Swap usage hard limit. If a cgroup's swap usage reaches this
892 limit, anonymous meomry of the cgroup will not be swapped out.
893
894
8955-2-2. General Usage
896
897"memory.high" is the main mechanism to control memory usage.
898Over-committing on high limit (sum of high limits > available memory)
899and letting global memory pressure to distribute memory according to
900usage is a viable strategy.
901
902Because breach of the high limit doesn't trigger the OOM killer but
903throttles the offending cgroup, a management agent has ample
904opportunities to monitor and take appropriate actions such as granting
905more memory or terminating the workload.
906
907Determining whether a cgroup has enough memory is not trivial as
908memory usage doesn't indicate whether the workload can benefit from
909more memory. For example, a workload which writes data received from
910network to a file can use all available memory but can also operate as
911performant with a small amount of memory. A measure of memory
912pressure - how much the workload is being impacted due to lack of
913memory - is necessary to determine whether a workload needs more
914memory; unfortunately, memory pressure monitoring mechanism isn't
915implemented yet.
916
917
9185-2-3. Memory Ownership
919
920A memory area is charged to the cgroup which instantiated it and stays
921charged to the cgroup until the area is released. Migrating a process
922to a different cgroup doesn't move the memory usages that it
923instantiated while in the previous cgroup to the new cgroup.
924
925A memory area may be used by processes belonging to different cgroups.
926To which cgroup the area will be charged is in-deterministic; however,
927over time, the memory area is likely to end up in a cgroup which has
928enough memory allowance to avoid high reclaim pressure.
929
930If a cgroup sweeps a considerable amount of memory which is expected
931to be accessed repeatedly by other cgroups, it may make sense to use
932POSIX_FADV_DONTNEED to relinquish the ownership of memory areas
933belonging to the affected files to ensure correct memory ownership.
934
935
9365-3. IO
937
938The "io" controller regulates the distribution of IO resources. This
939controller implements both weight based and absolute bandwidth or IOPS
940limit distribution; however, weight based distribution is available
941only if cfq-iosched is in use and neither scheme is available for
942blk-mq devices.
943
944
9455-3-1. IO Interface Files
946
947 io.stat
948
949 A read-only nested-keyed file which exists on non-root
950 cgroups.
951
952 Lines are keyed by $MAJ:$MIN device numbers and not ordered.
953 The following nested keys are defined.
954
955 rbytes Bytes read
956 wbytes Bytes written
957 rios Number of read IOs
958 wios Number of write IOs
959
960 An example read output follows.
961
962 8:16 rbytes=1459200 wbytes=314773504 rios=192 wios=353
963 8:0 rbytes=90430464 wbytes=299008000 rios=8950 wios=1252
964
965 io.weight
966
967 A read-write flat-keyed file which exists on non-root cgroups.
968 The default is "default 100".
969
970 The first line is the default weight applied to devices
971 without specific override. The rest are overrides keyed by
972 $MAJ:$MIN device numbers and not ordered. The weights are in
973 the range [1, 10000] and specifies the relative amount IO time
974 the cgroup can use in relation to its siblings.
975
976 The default weight can be updated by writing either "default
977 $WEIGHT" or simply "$WEIGHT". Overrides can be set by writing
978 "$MAJ:$MIN $WEIGHT" and unset by writing "$MAJ:$MIN default".
979
980 An example read output follows.
981
982 default 100
983 8:16 200
984 8:0 50
985
986 io.max
987
988 A read-write nested-keyed file which exists on non-root
989 cgroups.
990
991 BPS and IOPS based IO limit. Lines are keyed by $MAJ:$MIN
992 device numbers and not ordered. The following nested keys are
993 defined.
994
995 rbps Max read bytes per second
996 wbps Max write bytes per second
997 riops Max read IO operations per second
998 wiops Max write IO operations per second
999
1000 When writing, any number of nested key-value pairs can be
1001 specified in any order. "max" can be specified as the value
1002 to remove a specific limit. If the same key is specified
1003 multiple times, the outcome is undefined.
1004
1005 BPS and IOPS are measured in each IO direction and IOs are
1006 delayed if limit is reached. Temporary bursts are allowed.
1007
1008 Setting read limit at 2M BPS and write at 120 IOPS for 8:16.
1009
1010 echo "8:16 rbps=2097152 wiops=120" > io.max
1011
1012 Reading returns the following.
1013
1014 8:16 rbps=2097152 wbps=max riops=max wiops=120
1015
1016 Write IOPS limit can be removed by writing the following.
1017
1018 echo "8:16 wiops=max" > io.max
1019
1020 Reading now returns the following.
1021
1022 8:16 rbps=2097152 wbps=max riops=max wiops=max
1023
1024
10255-3-2. Writeback
1026
1027Page cache is dirtied through buffered writes and shared mmaps and
1028written asynchronously to the backing filesystem by the writeback
1029mechanism. Writeback sits between the memory and IO domains and
1030regulates the proportion of dirty memory by balancing dirtying and
1031write IOs.
1032
1033The io controller, in conjunction with the memory controller,
1034implements control of page cache writeback IOs. The memory controller
1035defines the memory domain that dirty memory ratio is calculated and
1036maintained for and the io controller defines the io domain which
1037writes out dirty pages for the memory domain. Both system-wide and
1038per-cgroup dirty memory states are examined and the more restrictive
1039of the two is enforced.
1040
1041cgroup writeback requires explicit support from the underlying
1042filesystem. Currently, cgroup writeback is implemented on ext2, ext4
1043and btrfs. On other filesystems, all writeback IOs are attributed to
1044the root cgroup.
1045
1046There are inherent differences in memory and writeback management
1047which affects how cgroup ownership is tracked. Memory is tracked per
1048page while writeback per inode. For the purpose of writeback, an
1049inode is assigned to a cgroup and all IO requests to write dirty pages
1050from the inode are attributed to that cgroup.
1051
1052As cgroup ownership for memory is tracked per page, there can be pages
1053which are associated with different cgroups than the one the inode is
1054associated with. These are called foreign pages. The writeback
1055constantly keeps track of foreign pages and, if a particular foreign
1056cgroup becomes the majority over a certain period of time, switches
1057the ownership of the inode to that cgroup.
1058
1059While this model is enough for most use cases where a given inode is
1060mostly dirtied by a single cgroup even when the main writing cgroup
1061changes over time, use cases where multiple cgroups write to a single
1062inode simultaneously are not supported well. In such circumstances, a
1063significant portion of IOs are likely to be attributed incorrectly.
1064As memory controller assigns page ownership on the first use and
1065doesn't update it until the page is released, even if writeback
1066strictly follows page ownership, multiple cgroups dirtying overlapping
1067areas wouldn't work as expected. It's recommended to avoid such usage
1068patterns.
1069
1070The sysctl knobs which affect writeback behavior are applied to cgroup
1071writeback as follows.
1072
1073 vm.dirty_background_ratio
1074 vm.dirty_ratio
1075
1076 These ratios apply the same to cgroup writeback with the
1077 amount of available memory capped by limits imposed by the
1078 memory controller and system-wide clean memory.
1079
1080 vm.dirty_background_bytes
1081 vm.dirty_bytes
1082
1083 For cgroup writeback, this is calculated into ratio against
1084 total available memory and applied the same way as
1085 vm.dirty[_background]_ratio.
1086
1087
1088P. Information on Kernel Programming
1089
1090This section contains kernel programming information in the areas
1091where interacting with cgroup is necessary. cgroup core and
1092controllers are not covered.
1093
1094
1095P-1. Filesystem Support for Writeback
1096
1097A filesystem can support cgroup writeback by updating
1098address_space_operations->writepage[s]() to annotate bio's using the
1099following two functions.
1100
1101 wbc_init_bio(@wbc, @bio)
1102
1103 Should be called for each bio carrying writeback data and
1104 associates the bio with the inode's owner cgroup. Can be
1105 called anytime between bio allocation and submission.
1106
1107 wbc_account_io(@wbc, @page, @bytes)
1108
1109 Should be called for each data segment being written out.
1110 While this function doesn't care exactly when it's called
1111 during the writeback session, it's the easiest and most
1112 natural to call it as data segments are added to a bio.
1113
1114With writeback bio's annotated, cgroup support can be enabled per
1115super_block by setting SB_I_CGROUPWB in ->s_iflags. This allows for
1116selective disabling of cgroup writeback support which is helpful when
1117certain filesystem features, e.g. journaled data mode, are
1118incompatible.
1119
1120wbc_init_bio() binds the specified bio to its cgroup. Depending on
1121the configuration, the bio may be executed at a lower priority and if
1122the writeback session is holding shared resources, e.g. a journal
1123entry, may lead to priority inversion. There is no one easy solution
1124for the problem. Filesystems can try to work around specific problem
1125cases by skipping wbc_init_bio() or using bio_associate_blkcg()
1126directly.
1127
1128
1129D. Deprecated v1 Core Features
1130
1131- Multiple hierarchies including named ones are not supported.
1132
1133- All mount options and remounting are not supported.
1134
1135- The "tasks" file is removed and "cgroup.procs" is not sorted.
1136
1137- "cgroup.clone_children" is removed.
1138
1139- /proc/cgroups is meaningless for v2. Use "cgroup.controllers" file
1140 at the root instead.
1141
1142
1143R. Issues with v1 and Rationales for v2
1144
1145R-1. Multiple Hierarchies
1146
1147cgroup v1 allowed an arbitrary number of hierarchies and each
1148hierarchy could host any number of controllers. While this seemed to
1149provide a high level of flexibility, it wasn't useful in practice.
1150
1151For example, as there is only one instance of each controller, utility
1152type controllers such as freezer which can be useful in all
1153hierarchies could only be used in one. The issue is exacerbated by
1154the fact that controllers couldn't be moved to another hierarchy once
1155hierarchies were populated. Another issue was that all controllers
1156bound to a hierarchy were forced to have exactly the same view of the
1157hierarchy. It wasn't possible to vary the granularity depending on
1158the specific controller.
1159
1160In practice, these issues heavily limited which controllers could be
1161put on the same hierarchy and most configurations resorted to putting
1162each controller on its own hierarchy. Only closely related ones, such
1163as the cpu and cpuacct controllers, made sense to be put on the same
1164hierarchy. This often meant that userland ended up managing multiple
1165similar hierarchies repeating the same steps on each hierarchy
1166whenever a hierarchy management operation was necessary.
1167
1168Furthermore, support for multiple hierarchies came at a steep cost.
1169It greatly complicated cgroup core implementation but more importantly
1170the support for multiple hierarchies restricted how cgroup could be
1171used in general and what controllers was able to do.
1172
1173There was no limit on how many hierarchies there might be, which meant
1174that a thread's cgroup membership couldn't be described in finite
1175length. The key might contain any number of entries and was unlimited
1176in length, which made it highly awkward to manipulate and led to
1177addition of controllers which existed only to identify membership,
1178which in turn exacerbated the original problem of proliferating number
1179of hierarchies.
1180
1181Also, as a controller couldn't have any expectation regarding the
1182topologies of hierarchies other controllers might be on, each
1183controller had to assume that all other controllers were attached to
1184completely orthogonal hierarchies. This made it impossible, or at
1185least very cumbersome, for controllers to cooperate with each other.
1186
1187In most use cases, putting controllers on hierarchies which are
1188completely orthogonal to each other isn't necessary. What usually is
1189called for is the ability to have differing levels of granularity
1190depending on the specific controller. In other words, hierarchy may
1191be collapsed from leaf towards root when viewed from specific
1192controllers. For example, a given configuration might not care about
1193how memory is distributed beyond a certain level while still wanting
1194to control how CPU cycles are distributed.
1195
1196
1197R-2. Thread Granularity
1198
1199cgroup v1 allowed threads of a process to belong to different cgroups.
1200This didn't make sense for some controllers and those controllers
1201ended up implementing different ways to ignore such situations but
1202much more importantly it blurred the line between API exposed to
1203individual applications and system management interface.
1204
1205Generally, in-process knowledge is available only to the process
1206itself; thus, unlike service-level organization of processes,
1207categorizing threads of a process requires active participation from
1208the application which owns the target process.
1209
1210cgroup v1 had an ambiguously defined delegation model which got abused
1211in combination with thread granularity. cgroups were delegated to
1212individual applications so that they can create and manage their own
1213sub-hierarchies and control resource distributions along them. This
1214effectively raised cgroup to the status of a syscall-like API exposed
1215to lay programs.
1216
1217First of all, cgroup has a fundamentally inadequate interface to be
1218exposed this way. For a process to access its own knobs, it has to
1219extract the path on the target hierarchy from /proc/self/cgroup,
1220construct the path by appending the name of the knob to the path, open
1221and then read and/or write to it. This is not only extremely clunky
1222and unusual but also inherently racy. There is no conventional way to
1223define transaction across the required steps and nothing can guarantee
1224that the process would actually be operating on its own sub-hierarchy.
1225
1226cgroup controllers implemented a number of knobs which would never be
1227accepted as public APIs because they were just adding control knobs to
1228system-management pseudo filesystem. cgroup ended up with interface
1229knobs which were not properly abstracted or refined and directly
1230revealed kernel internal details. These knobs got exposed to
1231individual applications through the ill-defined delegation mechanism
1232effectively abusing cgroup as a shortcut to implementing public APIs
1233without going through the required scrutiny.
1234
1235This was painful for both userland and kernel. Userland ended up with
1236misbehaving and poorly abstracted interfaces and kernel exposing and
1237locked into constructs inadvertently.
1238
1239
1240R-3. Competition Between Inner Nodes and Threads
1241
1242cgroup v1 allowed threads to be in any cgroups which created an
1243interesting problem where threads belonging to a parent cgroup and its
1244children cgroups competed for resources. This was nasty as two
1245different types of entities competed and there was no obvious way to
1246settle it. Different controllers did different things.
1247
1248The cpu controller considered threads and cgroups as equivalents and
1249mapped nice levels to cgroup weights. This worked for some cases but
1250fell flat when children wanted to be allocated specific ratios of CPU
1251cycles and the number of internal threads fluctuated - the ratios
1252constantly changed as the number of competing entities fluctuated.
1253There also were other issues. The mapping from nice level to weight
1254wasn't obvious or universal, and there were various other knobs which
1255simply weren't available for threads.
1256
1257The io controller implicitly created a hidden leaf node for each
1258cgroup to host the threads. The hidden leaf had its own copies of all
1259the knobs with "leaf_" prefixed. While this allowed equivalent
1260control over internal threads, it was with serious drawbacks. It
1261always added an extra layer of nesting which wouldn't be necessary
1262otherwise, made the interface messy and significantly complicated the
1263implementation.
1264
1265The memory controller didn't have a way to control what happened
1266between internal tasks and child cgroups and the behavior was not
1267clearly defined. There were attempts to add ad-hoc behaviors and
1268knobs to tailor the behavior to specific workloads which would have
1269led to problems extremely difficult to resolve in the long term.
1270
1271Multiple controllers struggled with internal tasks and came up with
1272different ways to deal with it; unfortunately, all the approaches were
1273severely flawed and, furthermore, the widely different behaviors
1274made cgroup as a whole highly inconsistent.
1275
1276This clearly is a problem which needs to be addressed from cgroup core
1277in a uniform way.
1278
1279
1280R-4. Other Interface Issues
1281
1282cgroup v1 grew without oversight and developed a large number of
1283idiosyncrasies and inconsistencies. One issue on the cgroup core side
1284was how an empty cgroup was notified - a userland helper binary was
1285forked and executed for each event. The event delivery wasn't
1286recursive or delegatable. The limitations of the mechanism also led
1287to in-kernel event delivery filtering mechanism further complicating
1288the interface.
1289
1290Controller interfaces were problematic too. An extreme example is
1291controllers completely ignoring hierarchical organization and treating
1292all cgroups as if they were all located directly under the root
1293cgroup. Some controllers exposed a large amount of inconsistent
1294implementation details to userland.
1295
1296There also was no consistency across controllers. When a new cgroup
1297was created, some controllers defaulted to not imposing extra
1298restrictions while others disallowed any resource usage until
1299explicitly configured. Configuration knobs for the same type of
1300control used widely differing naming schemes and formats. Statistics
1301and information knobs were named arbitrarily and used different
1302formats and units even in the same controller.
1303
1304cgroup v2 establishes common conventions where appropriate and updates
1305controllers so that they expose minimal and consistent interfaces.
1306
1307
1308R-5. Controller Issues and Remedies
1309
1310R-5-1. Memory
1311
1312The original lower boundary, the soft limit, is defined as a limit
1313that is per default unset. As a result, the set of cgroups that
1314global reclaim prefers is opt-in, rather than opt-out. The costs for
1315optimizing these mostly negative lookups are so high that the
1316implementation, despite its enormous size, does not even provide the
1317basic desirable behavior. First off, the soft limit has no
1318hierarchical meaning. All configured groups are organized in a global
1319rbtree and treated like equal peers, regardless where they are located
1320in the hierarchy. This makes subtree delegation impossible. Second,
1321the soft limit reclaim pass is so aggressive that it not just
1322introduces high allocation latencies into the system, but also impacts
1323system performance due to overreclaim, to the point where the feature
1324becomes self-defeating.
1325
1326The memory.low boundary on the other hand is a top-down allocated
1327reserve. A cgroup enjoys reclaim protection when it and all its
1328ancestors are below their low boundaries, which makes delegation of
1329subtrees possible. Secondly, new cgroups have no reserve per default
1330and in the common case most cgroups are eligible for the preferred
1331reclaim pass. This allows the new low boundary to be efficiently
1332implemented with just a minor addition to the generic reclaim code,
1333without the need for out-of-band data structures and reclaim passes.
1334Because the generic reclaim code considers all cgroups except for the
1335ones running low in the preferred first reclaim pass, overreclaim of
1336individual groups is eliminated as well, resulting in much better
1337overall workload performance.
1338
1339The original high boundary, the hard limit, is defined as a strict
1340limit that can not budge, even if the OOM killer has to be called.
1341But this generally goes against the goal of making the most out of the
1342available memory. The memory consumption of workloads varies during
1343runtime, and that requires users to overcommit. But doing that with a
1344strict upper limit requires either a fairly accurate prediction of the
1345working set size or adding slack to the limit. Since working set size
1346estimation is hard and error prone, and getting it wrong results in
1347OOM kills, most users tend to err on the side of a looser limit and
1348end up wasting precious resources.
1349
1350The memory.high boundary on the other hand can be set much more
1351conservatively. When hit, it throttles allocations by forcing them
1352into direct reclaim to work off the excess, but it never invokes the
1353OOM killer. As a result, a high boundary that is chosen too
1354aggressively will not terminate the processes, but instead it will
1355lead to gradual performance degradation. The user can monitor this
1356and make corrections until the minimal memory footprint that still
1357gives acceptable performance is found.
1358
1359In extreme cases, with many concurrent allocations and a complete
1360breakdown of reclaim progress within the group, the high boundary can
1361be exceeded. But even then it's mostly better to satisfy the
1362allocation from the slack available in other groups or the rest of the
1363system than killing the group. Otherwise, memory.max is there to
1364limit this type of spillover and ultimately contain buggy or even
1365malicious applications.
1366
1367The combined memory+swap accounting and limiting is replaced by real
1368control over swap space.
1369
1370The main argument for a combined memory+swap facility in the original
1371cgroup design was that global or parental pressure would always be
1372able to swap all anonymous memory of a child group, regardless of the
1373child's own (possibly untrusted) configuration. However, untrusted
1374groups can sabotage swapping by other means - such as referencing its
1375anonymous memory in a tight loop - and an admin can not assume full
1376swappability when overcommitting untrusted jobs.
1377
1378For trusted jobs, on the other hand, a combined counter is not an
1379intuitive userspace interface, and it flies in the face of the idea
1380that cgroup controllers should account and limit specific physical
1381resources. Swap space is a resource like all others in the system,
1382and that's why unified hierarchy allows distributing it separately.
diff --git a/Documentation/cgroups/unified-hierarchy.txt b/Documentation/cgroups/unified-hierarchy.txt
deleted file mode 100644
index 781b1d475bcf..000000000000
--- a/Documentation/cgroups/unified-hierarchy.txt
+++ /dev/null
@@ -1,647 +0,0 @@
1
2Cgroup unified hierarchy
3
4April, 2014 Tejun Heo <tj@kernel.org>
5
6This document describes the changes made by unified hierarchy and
7their rationales. It will eventually be merged into the main cgroup
8documentation.
9
10CONTENTS
11
121. Background
132. Basic Operation
14 2-1. Mounting
15 2-2. cgroup.subtree_control
16 2-3. cgroup.controllers
173. Structural Constraints
18 3-1. Top-down
19 3-2. No internal tasks
204. Delegation
21 4-1. Model of delegation
22 4-2. Common ancestor rule
235. Other Changes
24 5-1. [Un]populated Notification
25 5-2. Other Core Changes
26 5-3. Controller File Conventions
27 5-3-1. Format
28 5-3-2. Control Knobs
29 5-4. Per-Controller Changes
30 5-4-1. io
31 5-4-2. cpuset
32 5-4-3. memory
336. Planned Changes
34 6-1. CAP for resource control
35
36
371. Background
38
39cgroup allows an arbitrary number of hierarchies and each hierarchy
40can host any number of controllers. While this seems to provide a
41high level of flexibility, it isn't quite useful in practice.
42
43For example, as there is only one instance of each controller, utility
44type controllers such as freezer which can be useful in all
45hierarchies can only be used in one. The issue is exacerbated by the
46fact that controllers can't be moved around once hierarchies are
47populated. Another issue is that all controllers bound to a hierarchy
48are forced to have exactly the same view of the hierarchy. It isn't
49possible to vary the granularity depending on the specific controller.
50
51In practice, these issues heavily limit which controllers can be put
52on the same hierarchy and most configurations resort to putting each
53controller on its own hierarchy. Only closely related ones, such as
54the cpu and cpuacct controllers, make sense to put on the same
55hierarchy. This often means that userland ends up managing multiple
56similar hierarchies repeating the same steps on each hierarchy
57whenever a hierarchy management operation is necessary.
58
59Unfortunately, support for multiple hierarchies comes at a steep cost.
60Internal implementation in cgroup core proper is dazzlingly
61complicated but more importantly the support for multiple hierarchies
62restricts how cgroup is used in general and what controllers can do.
63
64There's no limit on how many hierarchies there may be, which means
65that a task's cgroup membership can't be described in finite length.
66The key may contain any varying number of entries and is unlimited in
67length, which makes it highly awkward to handle and leads to addition
68of controllers which exist only to identify membership, which in turn
69exacerbates the original problem.
70
71Also, as a controller can't have any expectation regarding what shape
72of hierarchies other controllers would be on, each controller has to
73assume that all other controllers are operating on completely
74orthogonal hierarchies. This makes it impossible, or at least very
75cumbersome, for controllers to cooperate with each other.
76
77In most use cases, putting controllers on hierarchies which are
78completely orthogonal to each other isn't necessary. What usually is
79called for is the ability to have differing levels of granularity
80depending on the specific controller. In other words, hierarchy may
81be collapsed from leaf towards root when viewed from specific
82controllers. For example, a given configuration might not care about
83how memory is distributed beyond a certain level while still wanting
84to control how CPU cycles are distributed.
85
86Unified hierarchy is the next version of cgroup interface. It aims to
87address the aforementioned issues by having more structure while
88retaining enough flexibility for most use cases. Various other
89general and controller-specific interface issues are also addressed in
90the process.
91
92
932. Basic Operation
94
952-1. Mounting
96
97Currently, unified hierarchy can be mounted with the following mount
98command. Note that this is still under development and scheduled to
99change soon.
100
101 mount -t cgroup -o __DEVEL__sane_behavior cgroup $MOUNT_POINT
102
103All controllers which support the unified hierarchy and are not bound
104to other hierarchies are automatically bound to unified hierarchy and
105show up at the root of it. Controllers which are enabled only in the
106root of unified hierarchy can be bound to other hierarchies. This
107allows mixing unified hierarchy with the traditional multiple
108hierarchies in a fully backward compatible way.
109
110A controller can be moved across hierarchies only after the controller
111is no longer referenced in its current hierarchy. Because per-cgroup
112controller states are destroyed asynchronously and controllers may
113have lingering references, a controller may not show up immediately on
114the unified hierarchy after the final umount of the previous
115hierarchy. Similarly, a controller should be fully disabled to be
116moved out of the unified hierarchy and it may take some time for the
117disabled controller to become available for other hierarchies;
118furthermore, due to dependencies among controllers, other controllers
119may need to be disabled too.
120
121While useful for development and manual configurations, dynamically
122moving controllers between the unified and other hierarchies is
123strongly discouraged for production use. It is recommended to decide
124the hierarchies and controller associations before starting using the
125controllers.
126
127
1282-2. cgroup.subtree_control
129
130All cgroups on unified hierarchy have a "cgroup.subtree_control" file
131which governs which controllers are enabled on the children of the
132cgroup. Let's assume a hierarchy like the following.
133
134 root - A - B - C
135 \ D
136
137root's "cgroup.subtree_control" file determines which controllers are
138enabled on A. A's on B. B's on C and D. This coincides with the
139fact that controllers on the immediate sub-level are used to
140distribute the resources of the parent. In fact, it's natural to
141assume that resource control knobs of a child belong to its parent.
142Enabling a controller in a "cgroup.subtree_control" file declares that
143distribution of the respective resources of the cgroup will be
144controlled. Note that this means that controller enable states are
145shared among siblings.
146
147When read, the file contains a space-separated list of currently
148enabled controllers. A write to the file should contain a
149space-separated list of controllers with '+' or '-' prefixed (without
150the quotes). Controllers prefixed with '+' are enabled and '-'
151disabled. If a controller is listed multiple times, the last entry
152wins. The specific operations are executed atomically - either all
153succeed or fail.
154
155
1562-3. cgroup.controllers
157
158Read-only "cgroup.controllers" file contains a space-separated list of
159controllers which can be enabled in the cgroup's
160"cgroup.subtree_control" file.
161
162In the root cgroup, this lists controllers which are not bound to
163other hierarchies and the content changes as controllers are bound to
164and unbound from other hierarchies.
165
166In non-root cgroups, the content of this file equals that of the
167parent's "cgroup.subtree_control" file as only controllers enabled
168from the parent can be used in its children.
169
170
1713. Structural Constraints
172
1733-1. Top-down
174
175As it doesn't make sense to nest control of an uncontrolled resource,
176all non-root "cgroup.subtree_control" files can only contain
177controllers which are enabled in the parent's "cgroup.subtree_control"
178file. A controller can be enabled only if the parent has the
179controller enabled and a controller can't be disabled if one or more
180children have it enabled.
181
182
1833-2. No internal tasks
184
185One long-standing issue that cgroup faces is the competition between
186tasks belonging to the parent cgroup and its children cgroups. This
187is inherently nasty as two different types of entities compete and
188there is no agreed-upon obvious way to handle it. Different
189controllers are doing different things.
190
191The cpu controller considers tasks and cgroups as equivalents and maps
192nice levels to cgroup weights. This works for some cases but falls
193flat when children should be allocated specific ratios of CPU cycles
194and the number of internal tasks fluctuates - the ratios constantly
195change as the number of competing entities fluctuates. There also are
196other issues. The mapping from nice level to weight isn't obvious or
197universal, and there are various other knobs which simply aren't
198available for tasks.
199
200The io controller implicitly creates a hidden leaf node for each
201cgroup to host the tasks. The hidden leaf has its own copies of all
202the knobs with "leaf_" prefixed. While this allows equivalent control
203over internal tasks, it's with serious drawbacks. It always adds an
204extra layer of nesting which may not be necessary, makes the interface
205messy and significantly complicates the implementation.
206
207The memory controller currently doesn't have a way to control what
208happens between internal tasks and child cgroups and the behavior is
209not clearly defined. There have been attempts to add ad-hoc behaviors
210and knobs to tailor the behavior to specific workloads. Continuing
211this direction will lead to problems which will be extremely difficult
212to resolve in the long term.
213
214Multiple controllers struggle with internal tasks and came up with
215different ways to deal with it; unfortunately, all the approaches in
216use now are severely flawed and, furthermore, the widely different
217behaviors make cgroup as whole highly inconsistent.
218
219It is clear that this is something which needs to be addressed from
220cgroup core proper in a uniform way so that controllers don't need to
221worry about it and cgroup as a whole shows a consistent and logical
222behavior. To achieve that, unified hierarchy enforces the following
223structural constraint:
224
225 Except for the root, only cgroups which don't contain any task may
226 have controllers enabled in their "cgroup.subtree_control" files.
227
228Combined with other properties, this guarantees that, when a
229controller is looking at the part of the hierarchy which has it
230enabled, tasks are always only on the leaves. This rules out
231situations where child cgroups compete against internal tasks of the
232parent.
233
234There are two things to note. Firstly, the root cgroup is exempt from
235the restriction. Root contains tasks and anonymous resource
236consumption which can't be associated with any other cgroup and
237requires special treatment from most controllers. How resource
238consumption in the root cgroup is governed is up to each controller.
239
240Secondly, the restriction doesn't take effect if there is no enabled
241controller in the cgroup's "cgroup.subtree_control" file. This is
242important as otherwise it wouldn't be possible to create children of a
243populated cgroup. To control resource distribution of a cgroup, the
244cgroup must create children and transfer all its tasks to the children
245before enabling controllers in its "cgroup.subtree_control" file.
246
247
2484. Delegation
249
2504-1. Model of delegation
251
252A cgroup can be delegated to a less privileged user by granting write
253access of the directory and its "cgroup.procs" file to the user. Note
254that the resource control knobs in a given directory concern the
255resources of the parent and thus must not be delegated along with the
256directory.
257
258Once delegated, the user can build sub-hierarchy under the directory,
259organize processes as it sees fit and further distribute the resources
260it got from the parent. The limits and other settings of all resource
261controllers are hierarchical and regardless of what happens in the
262delegated sub-hierarchy, nothing can escape the resource restrictions
263imposed by the parent.
264
265Currently, cgroup doesn't impose any restrictions on the number of
266cgroups in or nesting depth of a delegated sub-hierarchy; however,
267this may in the future be limited explicitly.
268
269
2704-2. Common ancestor rule
271
272On the unified hierarchy, to write to a "cgroup.procs" file, in
273addition to the usual write permission to the file and uid match, the
274writer must also have write access to the "cgroup.procs" file of the
275common ancestor of the source and destination cgroups. This prevents
276delegatees from smuggling processes across disjoint sub-hierarchies.
277
278Let's say cgroups C0 and C1 have been delegated to user U0 who created
279C00, C01 under C0 and C10 under C1 as follows.
280
281 ~~~~~~~~~~~~~ - C0 - C00
282 ~ cgroup ~ \ C01
283 ~ hierarchy ~
284 ~~~~~~~~~~~~~ - C1 - C10
285
286C0 and C1 are separate entities in terms of resource distribution
287regardless of their relative positions in the hierarchy. The
288resources the processes under C0 are entitled to are controlled by
289C0's ancestors and may be completely different from C1. It's clear
290that the intention of delegating C0 to U0 is allowing U0 to organize
291the processes under C0 and further control the distribution of C0's
292resources.
293
294On traditional hierarchies, if a task has write access to "tasks" or
295"cgroup.procs" file of a cgroup and its uid agrees with the target, it
296can move the target to the cgroup. In the above example, U0 will not
297only be able to move processes in each sub-hierarchy but also across
298the two sub-hierarchies, effectively allowing it to violate the
299organizational and resource restrictions implied by the hierarchical
300structure above C0 and C1.
301
302On the unified hierarchy, let's say U0 wants to write the pid of a
303process which has a matching uid and is currently in C10 into
304"C00/cgroup.procs". U0 obviously has write access to the file and
305migration permission on the process; however, the common ancestor of
306the source cgroup C10 and the destination cgroup C00 is above the
307points of delegation and U0 would not have write access to its
308"cgroup.procs" and thus be denied with -EACCES.
309
310
3115. Other Changes
312
3135-1. [Un]populated Notification
314
315cgroup users often need a way to determine when a cgroup's
316subhierarchy becomes empty so that it can be cleaned up. cgroup
317currently provides release_agent for it; unfortunately, this mechanism
318is riddled with issues.
319
320- It delivers events by forking and execing a userland binary
321 specified as the release_agent. This is a long deprecated method of
322 notification delivery. It's extremely heavy, slow and cumbersome to
323 integrate with larger infrastructure.
324
325- There is single monitoring point at the root. There's no way to
326 delegate management of a subtree.
327
328- The event isn't recursive. It triggers when a cgroup doesn't have
329 any tasks or child cgroups. Events for internal nodes trigger only
330 after all children are removed. This again makes it impossible to
331 delegate management of a subtree.
332
333- Events are filtered from the kernel side. A "notify_on_release"
334 file is used to subscribe to or suppress release events. This is
335 unnecessarily complicated and probably done this way because event
336 delivery itself was expensive.
337
338Unified hierarchy implements "populated" field in "cgroup.events"
339interface file which can be used to monitor whether the cgroup's
340subhierarchy has tasks in it or not. Its value is 0 if there is no
341task in the cgroup and its descendants; otherwise, 1. poll and
342[id]notify events are triggered when the value changes.
343
344This is significantly lighter and simpler and trivially allows
345delegating management of subhierarchy - subhierarchy monitoring can
346block further propagation simply by putting itself or another process
347in the subhierarchy and monitor events that it's interested in from
348there without interfering with monitoring higher in the tree.
349
350In unified hierarchy, the release_agent mechanism is no longer
351supported and the interface files "release_agent" and
352"notify_on_release" do not exist.
353
354
3555-2. Other Core Changes
356
357- None of the mount options is allowed.
358
359- remount is disallowed.
360
361- rename(2) is disallowed.
362
363- The "tasks" file is removed. Everything should at process
364 granularity. Use the "cgroup.procs" file instead.
365
366- The "cgroup.procs" file is not sorted. pids will be unique unless
367 they got recycled in-between reads.
368
369- The "cgroup.clone_children" file is removed.
370
371- /proc/PID/cgroup keeps reporting the cgroup that a zombie belonged
372 to before exiting. If the cgroup is removed before the zombie is
373 reaped, " (deleted)" is appeneded to the path.
374
375
3765-3. Controller File Conventions
377
3785-3-1. Format
379
380In general, all controller files should be in one of the following
381formats whenever possible.
382
383- Values only files
384
385 VAL0 VAL1...\n
386
387- Flat keyed files
388
389 KEY0 VAL0\n
390 KEY1 VAL1\n
391 ...
392
393- Nested keyed files
394
395 KEY0 SUB_KEY0=VAL00 SUB_KEY1=VAL01...
396 KEY1 SUB_KEY0=VAL10 SUB_KEY1=VAL11...
397 ...
398
399For a writeable file, the format for writing should generally match
400reading; however, controllers may allow omitting later fields or
401implement restricted shortcuts for most common use cases.
402
403For both flat and nested keyed files, only the values for a single key
404can be written at a time. For nested keyed files, the sub key pairs
405may be specified in any order and not all pairs have to be specified.
406
407
4085-3-2. Control Knobs
409
410- Settings for a single feature should generally be implemented in a
411 single file.
412
413- In general, the root cgroup should be exempt from resource control
414 and thus shouldn't have resource control knobs.
415
416- If a controller implements ratio based resource distribution, the
417 control knob should be named "weight" and have the range [1, 10000]
418 and 100 should be the default value. The values are chosen to allow
419 enough and symmetric bias in both directions while keeping it
420 intuitive (the default is 100%).
421
422- If a controller implements an absolute resource guarantee and/or
423 limit, the control knobs should be named "min" and "max"
424 respectively. If a controller implements best effort resource
425 gurantee and/or limit, the control knobs should be named "low" and
426 "high" respectively.
427
428 In the above four control files, the special token "max" should be
429 used to represent upward infinity for both reading and writing.
430
431- If a setting has configurable default value and specific overrides,
432 the default settings should be keyed with "default" and appear as
433 the first entry in the file. Specific entries can use "default" as
434 its value to indicate inheritance of the default value.
435
436- For events which are not very high frequency, an interface file
437 "events" should be created which lists event key value pairs.
438 Whenever a notifiable event happens, file modified event should be
439 generated on the file.
440
441
4425-4. Per-Controller Changes
443
4445-4-1. io
445
446- blkio is renamed to io. The interface is overhauled anyway. The
447 new name is more in line with the other two major controllers, cpu
448 and memory, and better suited given that it may be used for cgroup
449 writeback without involving block layer.
450
451- Everything including stat is always hierarchical making separate
452 recursive stat files pointless and, as no internal node can have
453 tasks, leaf weights are meaningless. The operation model is
454 simplified and the interface is overhauled accordingly.
455
456 io.stat
457
458 The stat file. The reported stats are from the point where
459 bio's are issued to request_queue. The stats are counted
460 independent of which policies are enabled. Each line in the
461 file follows the following format. More fields may later be
462 added at the end.
463
464 $MAJ:$MIN rbytes=$RBYTES wbytes=$WBYTES rios=$RIOS wrios=$WIOS
465
466 io.weight
467
468 The weight setting, currently only available and effective if
469 cfq-iosched is in use for the target device. The weight is
470 between 1 and 10000 and defaults to 100. The first line
471 always contains the default weight in the following format to
472 use when per-device setting is missing.
473
474 default $WEIGHT
475
476 Subsequent lines list per-device weights of the following
477 format.
478
479 $MAJ:$MIN $WEIGHT
480
481 Writing "$WEIGHT" or "default $WEIGHT" changes the default
482 setting. Writing "$MAJ:$MIN $WEIGHT" sets per-device weight
483 while "$MAJ:$MIN default" clears it.
484
485 This file is available only on non-root cgroups.
486
487 io.max
488
489 The maximum bandwidth and/or iops setting, only available if
490 blk-throttle is enabled. The file is of the following format.
491
492 $MAJ:$MIN rbps=$RBPS wbps=$WBPS riops=$RIOPS wiops=$WIOPS
493
494 ${R|W}BPS are read/write bytes per second and ${R|W}IOPS are
495 read/write IOs per second. "max" indicates no limit. Writing
496 to the file follows the same format but the individual
497 settings may be omitted or specified in any order.
498
499 This file is available only on non-root cgroups.
500
501
5025-4-2. cpuset
503
504- Tasks are kept in empty cpusets after hotplug and take on the masks
505 of the nearest non-empty ancestor, instead of being moved to it.
506
507- A task can be moved into an empty cpuset, and again it takes on the
508 masks of the nearest non-empty ancestor.
509
510
5115-4-3. memory
512
513- use_hierarchy is on by default and the cgroup file for the flag is
514 not created.
515
516- The original lower boundary, the soft limit, is defined as a limit
517 that is per default unset. As a result, the set of cgroups that
518 global reclaim prefers is opt-in, rather than opt-out. The costs
519 for optimizing these mostly negative lookups are so high that the
520 implementation, despite its enormous size, does not even provide the
521 basic desirable behavior. First off, the soft limit has no
522 hierarchical meaning. All configured groups are organized in a
523 global rbtree and treated like equal peers, regardless where they
524 are located in the hierarchy. This makes subtree delegation
525 impossible. Second, the soft limit reclaim pass is so aggressive
526 that it not just introduces high allocation latencies into the
527 system, but also impacts system performance due to overreclaim, to
528 the point where the feature becomes self-defeating.
529
530 The memory.low boundary on the other hand is a top-down allocated
531 reserve. A cgroup enjoys reclaim protection when it and all its
532 ancestors are below their low boundaries, which makes delegation of
533 subtrees possible. Secondly, new cgroups have no reserve per
534 default and in the common case most cgroups are eligible for the
535 preferred reclaim pass. This allows the new low boundary to be
536 efficiently implemented with just a minor addition to the generic
537 reclaim code, without the need for out-of-band data structures and
538 reclaim passes. Because the generic reclaim code considers all
539 cgroups except for the ones running low in the preferred first
540 reclaim pass, overreclaim of individual groups is eliminated as
541 well, resulting in much better overall workload performance.
542
543- The original high boundary, the hard limit, is defined as a strict
544 limit that can not budge, even if the OOM killer has to be called.
545 But this generally goes against the goal of making the most out of
546 the available memory. The memory consumption of workloads varies
547 during runtime, and that requires users to overcommit. But doing
548 that with a strict upper limit requires either a fairly accurate
549 prediction of the working set size or adding slack to the limit.
550 Since working set size estimation is hard and error prone, and
551 getting it wrong results in OOM kills, most users tend to err on the
552 side of a looser limit and end up wasting precious resources.
553
554 The memory.high boundary on the other hand can be set much more
555 conservatively. When hit, it throttles allocations by forcing them
556 into direct reclaim to work off the excess, but it never invokes the
557 OOM killer. As a result, a high boundary that is chosen too
558 aggressively will not terminate the processes, but instead it will
559 lead to gradual performance degradation. The user can monitor this
560 and make corrections until the minimal memory footprint that still
561 gives acceptable performance is found.
562
563 In extreme cases, with many concurrent allocations and a complete
564 breakdown of reclaim progress within the group, the high boundary
565 can be exceeded. But even then it's mostly better to satisfy the
566 allocation from the slack available in other groups or the rest of
567 the system than killing the group. Otherwise, memory.max is there
568 to limit this type of spillover and ultimately contain buggy or even
569 malicious applications.
570
571- The original control file names are unwieldy and inconsistent in
572 many different ways. For example, the upper boundary hit count is
573 exported in the memory.failcnt file, but an OOM event count has to
574 be manually counted by listening to memory.oom_control events, and
575 lower boundary / soft limit events have to be counted by first
576 setting a threshold for that value and then counting those events.
577 Also, usage and limit files encode their units in the filename.
578 That makes the filenames very long, even though this is not
579 information that a user needs to be reminded of every time they type
580 out those names.
581
582 To address these naming issues, as well as to signal clearly that
583 the new interface carries a new configuration model, the naming
584 conventions in it necessarily differ from the old interface.
585
586- The original limit files indicate the state of an unset limit with a
587 Very High Number, and a configured limit can be unset by echoing -1
588 into those files. But that very high number is implementation and
589 architecture dependent and not very descriptive. And while -1 can
590 be understood as an underflow into the highest possible value, -2 or
591 -10M etc. do not work, so it's not consistent.
592
593 memory.low, memory.high, and memory.max will use the string "max" to
594 indicate and set the highest possible value.
595
5966. Planned Changes
597
5986-1. CAP for resource control
599
600Unified hierarchy will require one of the capabilities(7), which is
601yet to be decided, for all resource control related knobs. Process
602organization operations - creation of sub-cgroups and migration of
603processes in sub-hierarchies may be delegated by changing the
604ownership and/or permissions on the cgroup directory and
605"cgroup.procs" interface file; however, all operations which affect
606resource control - writes to a "cgroup.subtree_control" file or any
607controller-specific knobs - will require an explicit CAP privilege.
608
609This, in part, is to prevent the cgroup interface from being
610inadvertently promoted to programmable API used by non-privileged
611binaries. cgroup exposes various aspects of the system in ways which
612aren't properly abstracted for direct consumption by regular programs.
613This is an administration interface much closer to sysctl knobs than
614system calls. Even the basic access model, being filesystem path
615based, isn't suitable for direct consumption. There's no way to
616access "my cgroup" in a race-free way or make multiple operations
617atomic against migration to another cgroup.
618
619Another aspect is that, for better or for worse, the cgroup interface
620goes through far less scrutiny than regular interfaces for
621unprivileged userland. The upside is that cgroup is able to expose
622useful features which may not be suitable for general consumption in a
623reasonable time frame. It provides a relatively short path between
624internal details and userland-visible interface. Of course, this
625shortcut comes with high risk. We go through what we go through for
626general kernel APIs for good reasons. It may end up leaking internal
627details in a way which can exert significant pain by locking the
628kernel into a contract that can't be maintained in a reasonable
629manner.
630
631Also, due to the specific nature, cgroup and its controllers don't
632tend to attract attention from a wide scope of developers. cgroup's
633short history is already fraught with severely mis-designed
634interfaces, unnecessary commitments to and exposing of internal
635details, broken and dangerous implementations of various features.
636
637Keeping cgroup as an administration interface is both advantageous for
638its role and imperative given its nature. Some of the cgroup features
639may make sense for unprivileged access. If deemed justified, those
640must be further abstracted and implemented as a different interface,
641be it a system call or process-private filesystem, and survive through
642the scrutiny that any interface for general consumption is required to
643go through.
644
645Requiring CAP is not a complete solution but should serve as a
646significant deterrent against spraying cgroup usages in non-privileged
647programs.
diff --git a/Documentation/cpu-freq/intel-pstate.txt b/Documentation/cpu-freq/intel-pstate.txt
index be8d4006bf76..f7b12c071d53 100644
--- a/Documentation/cpu-freq/intel-pstate.txt
+++ b/Documentation/cpu-freq/intel-pstate.txt
@@ -1,61 +1,131 @@
1Intel P-state driver 1Intel P-State driver
2-------------------- 2--------------------
3 3
4This driver provides an interface to control the P state selection for 4This driver provides an interface to control the P-State selection for the
5SandyBridge+ Intel processors. The driver can operate two different 5SandyBridge+ Intel processors.
6modes based on the processor model, legacy mode and Hardware P state (HWP) 6
7mode. 7The following document explains P-States:
8 8http://events.linuxfoundation.org/sites/events/files/slides/LinuxConEurope_2015.pdf
9In legacy mode, the Intel P-state implements two internal governors, 9As stated in the document, P-State doesn’t exactly mean a frequency. However, for
10performance and powersave, that differ from the general cpufreq governors of 10the sake of the relationship with cpufreq, P-State and frequency are used
11the same name (the general cpufreq governors implement target(), whereas the 11interchangeably.
12internal Intel P-state governors implement setpolicy()). The internal 12
13performance governor sets the max_perf_pct and min_perf_pct to 100; that is, 13Understanding the cpufreq core governors and policies are important before
14the governor selects the highest available P state to maximize the performance 14discussing more details about the Intel P-State driver. Based on what callbacks
15of the core. The internal powersave governor selects the appropriate P state 15a cpufreq driver provides to the cpufreq core, it can support two types of
16based on the current load on the CPU. 16drivers:
17 17- with target_index() callback: In this mode, the drivers using cpufreq core
18In HWP mode P state selection is implemented in the processor 18simply provide the minimum and maximum frequency limits and an additional
19itself. The driver provides the interfaces between the cpufreq core and 19interface target_index() to set the current frequency. The cpufreq subsystem
20the processor to control P state selection based on user preferences 20has a number of scaling governors ("performance", "powersave", "ondemand",
21and reporting frequency to the cpufreq core. In this mode the 21etc.). Depending on which governor is in use, cpufreq core will call for
22internal Intel P-state governor code is disabled. 22transitions to a specific frequency using target_index() callback.
23 23- setpolicy() callback: In this mode, drivers do not provide target_index()
24In addition to the interfaces provided by the cpufreq core for 24callback, so cpufreq core can't request a transition to a specific frequency.
25controlling frequency the driver provides sysfs files for 25The driver provides minimum and maximum frequency limits and callbacks to set a
26controlling P state selection. These files have been added to 26policy. The policy in cpufreq sysfs is referred to as the "scaling governor".
27/sys/devices/system/cpu/intel_pstate/ 27The cpufreq core can request the driver to operate in any of the two policies:
28 28"performance: and "powersave". The driver decides which frequency to use based
29 max_perf_pct: limits the maximum P state that will be requested by 29on the above policy selection considering minimum and maximum frequency limits.
30 the driver stated as a percentage of the available performance. The 30
31 available (P states) performance may be reduced by the no_turbo 31The Intel P-State driver falls under the latter category, which implements the
32setpolicy() callback. This driver decides what P-State to use based on the
33requested policy from the cpufreq core. If the processor is capable of
34selecting its next P-State internally, then the driver will offload this
35responsibility to the processor (aka HWP: Hardware P-States). If not, the
36driver implements algorithms to select the next P-State.
37
38Since these policies are implemented in the driver, they are not same as the
39cpufreq scaling governors implementation, even if they have the same name in
40the cpufreq sysfs (scaling_governors). For example the "performance" policy is
41similar to cpufreq’s "performance" governor, but "powersave" is completely
42different than the cpufreq "powersave" governor. The strategy here is similar
43to cpufreq "ondemand", where the requested P-State is related to the system load.
44
45Sysfs Interface
46
47In addition to the frequency-controlling interfaces provided by the cpufreq
48core, the driver provides its own sysfs files to control the P-State selection.
49These files have been added to /sys/devices/system/cpu/intel_pstate/.
50Any changes made to these files are applicable to all CPUs (even in a
51multi-package system).
52
53 max_perf_pct: Limits the maximum P-State that will be requested by
54 the driver. It states it as a percentage of the available performance. The
55 available (P-State) performance may be reduced by the no_turbo
32 setting described below. 56 setting described below.
33 57
34 min_perf_pct: limits the minimum P state that will be requested by 58 min_perf_pct: Limits the minimum P-State that will be requested by
35 the driver stated as a percentage of the max (non-turbo) 59 the driver. It states it as a percentage of the max (non-turbo)
36 performance level. 60 performance level.
37 61
38 no_turbo: limits the driver to selecting P states below the turbo 62 no_turbo: Limits the driver to selecting P-State below the turbo
39 frequency range. 63 frequency range.
40 64
41 turbo_pct: displays the percentage of the total performance that 65 turbo_pct: Displays the percentage of the total performance that
42 is supported by hardware that is in the turbo range. This number 66 is supported by hardware that is in the turbo range. This number
43 is independent of whether turbo has been disabled or not. 67 is independent of whether turbo has been disabled or not.
44 68
45 num_pstates: displays the number of pstates that are supported 69 num_pstates: Displays the number of P-States that are supported
46 by hardware. This number is independent of whether turbo has 70 by hardware. This number is independent of whether turbo has
47 been disabled or not. 71 been disabled or not.
48 72
73For example, if a system has these parameters:
74 Max 1 core turbo ratio: 0x21 (Max 1 core ratio is the maximum P-State)
75 Max non turbo ratio: 0x17
76 Minimum ratio : 0x08 (Here the ratio is called max efficiency ratio)
77
78Sysfs will show :
79 max_perf_pct:100, which corresponds to 1 core ratio
80 min_perf_pct:24, max_efficiency_ratio / max 1 Core ratio
81 no_turbo:0, turbo is not disabled
82 num_pstates:26 = (max 1 Core ratio - Max Efficiency Ratio + 1)
83 turbo_pct:39 = (max 1 core ratio - max non turbo ratio) / num_pstates
84
85Refer to "Intel® 64 and IA-32 Architectures Software Developer’s Manual
86Volume 3: System Programming Guide" to understand ratios.
87
88cpufreq sysfs for Intel P-State
89
90Since this driver registers with cpufreq, cpufreq sysfs is also presented.
91There are some important differences, which need to be considered.
92
93scaling_cur_freq: This displays the real frequency which was used during
94the last sample period instead of what is requested. Some other cpufreq driver,
95like acpi-cpufreq, displays what is requested (Some changes are on the
96way to fix this for acpi-cpufreq driver). The same is true for frequencies
97displayed at /proc/cpuinfo.
98
99scaling_governor: This displays current active policy. Since each CPU has a
100cpufreq sysfs, it is possible to set a scaling governor to each CPU. But this
101is not possible with Intel P-States, as there is one common policy for all
102CPUs. Here, the last requested policy will be applicable to all CPUs. It is
103suggested that one use the cpupower utility to change policy to all CPUs at the
104same time.
105
106scaling_setspeed: This attribute can never be used with Intel P-State.
107
108scaling_max_freq/scaling_min_freq: This interface can be used similarly to
109the max_perf_pct/min_perf_pct of Intel P-State sysfs. However since frequencies
110are converted to nearest possible P-State, this is prone to rounding errors.
111This method is not preferred to limit performance.
112
113affected_cpus: Not used
114related_cpus: Not used
115
49For contemporary Intel processors, the frequency is controlled by the 116For contemporary Intel processors, the frequency is controlled by the
50processor itself and the P-states exposed to software are related to 117processor itself and the P-State exposed to software is related to
51performance levels. The idea that frequency can be set to a single 118performance levels. The idea that frequency can be set to a single
52frequency is fiction for Intel Core processors. Even if the scaling 119frequency is fictional for Intel Core processors. Even if the scaling
53driver selects a single P state the actual frequency the processor 120driver selects a single P-State, the actual frequency the processor
54will run at is selected by the processor itself. 121will run at is selected by the processor itself.
55 122
56For legacy mode debugfs files have also been added to allow tuning of 123Tuning Intel P-State driver
57the internal governor algorythm. These files are located at 124
58/sys/kernel/debug/pstate_snb/ These files are NOT present in HWP mode. 125When HWP mode is not used, debugfs files have also been added to allow the
126tuning of the internal governor algorithm. These files are located at
127/sys/kernel/debug/pstate_snb/. The algorithm uses a PID (Proportional
128Integral Derivative) controller. The PID tunable parameters are:
59 129
60 deadband 130 deadband
61 d_gain_pct 131 d_gain_pct
@@ -63,3 +133,90 @@ the internal governor algorythm. These files are located at
63 p_gain_pct 133 p_gain_pct
64 sample_rate_ms 134 sample_rate_ms
65 setpoint 135 setpoint
136
137To adjust these parameters, some understanding of driver implementation is
138necessary. There are some tweeks described here, but be very careful. Adjusting
139them requires expert level understanding of power and performance relationship.
140These limits are only useful when the "powersave" policy is active.
141
142-To make the system more responsive to load changes, sample_rate_ms can
143be adjusted (current default is 10ms).
144-To make the system use higher performance, even if the load is lower, setpoint
145can be adjusted to a lower number. This will also lead to faster ramp up time
146to reach the maximum P-State.
147If there are no derivative and integral coefficients, The next P-State will be
148equal to:
149 current P-State - ((setpoint - current cpu load) * p_gain_pct)
150
151For example, if the current PID parameters are (Which are defaults for the core
152processors like SandyBridge):
153 deadband = 0
154 d_gain_pct = 0
155 i_gain_pct = 0
156 p_gain_pct = 20
157 sample_rate_ms = 10
158 setpoint = 97
159
160If the current P-State = 0x08 and current load = 100, this will result in the
161next P-State = 0x08 - ((97 - 100) * 0.2) = 8.6 (rounded to 9). Here the P-State
162goes up by only 1. If during next sample interval the current load doesn't
163change and still 100, then P-State goes up by one again. This process will
164continue as long as the load is more than the setpoint until the maximum P-State
165is reached.
166
167For the same load at setpoint = 60, this will result in the next P-State
168= 0x08 - ((60 - 100) * 0.2) = 16
169So by changing the setpoint from 97 to 60, there is an increase of the
170next P-State from 9 to 16. So this will make processor execute at higher
171P-State for the same CPU load. If the load continues to be more than the
172setpoint during next sample intervals, then P-State will go up again till the
173maximum P-State is reached. But the ramp up time to reach the maximum P-State
174will be much faster when the setpoint is 60 compared to 97.
175
176Debugging Intel P-State driver
177
178Event tracing
179To debug P-State transition, the Linux event tracing interface can be used.
180There are two specific events, which can be enabled (Provided the kernel
181configs related to event tracing are enabled).
182
183# cd /sys/kernel/debug/tracing/
184# echo 1 > events/power/pstate_sample/enable
185# echo 1 > events/power/cpu_frequency/enable
186# cat trace
187gnome-terminal--4510 [001] ..s. 1177.680733: pstate_sample: core_busy=107
188 scaled=94 from=26 to=26 mperf=1143818 aperf=1230607 tsc=29838618
189 freq=2474476
190cat-5235 [002] ..s. 1177.681723: cpu_frequency: state=2900000 cpu_id=2
191
192
193Using ftrace
194
195If function level tracing is required, the Linux ftrace interface can be used.
196For example if we want to check how often a function to set a P-State is
197called, we can set ftrace filter to intel_pstate_set_pstate.
198
199# cd /sys/kernel/debug/tracing/
200# cat available_filter_functions | grep -i pstate
201intel_pstate_set_pstate
202intel_pstate_cpu_init
203...
204
205# echo intel_pstate_set_pstate > set_ftrace_filter
206# echo function > current_tracer
207# cat trace | head -15
208# tracer: function
209#
210# entries-in-buffer/entries-written: 80/80 #P:4
211#
212# _-----=> irqs-off
213# / _----=> need-resched
214# | / _---=> hardirq/softirq
215# || / _--=> preempt-depth
216# ||| / delay
217# TASK-PID CPU# |||| TIMESTAMP FUNCTION
218# | | | |||| | |
219 Xorg-3129 [000] ..s. 2537.644844: intel_pstate_set_pstate <-intel_pstate_timer_func
220 gnome-terminal--4510 [002] ..s. 2537.649844: intel_pstate_set_pstate <-intel_pstate_timer_func
221 gnome-shell-3409 [001] ..s. 2537.650850: intel_pstate_set_pstate <-intel_pstate_timer_func
222 <idle>-0 [000] ..s. 2537.654843: intel_pstate_set_pstate <-intel_pstate_timer_func
diff --git a/Documentation/cpu-freq/pcc-cpufreq.txt b/Documentation/cpu-freq/pcc-cpufreq.txt
index 9e3c3b33514c..0a94224ad296 100644
--- a/Documentation/cpu-freq/pcc-cpufreq.txt
+++ b/Documentation/cpu-freq/pcc-cpufreq.txt
@@ -159,8 +159,8 @@ to be strictly associated with a P-state.
159 159
1602.2 cpuinfo_transition_latency: 1602.2 cpuinfo_transition_latency:
161------------------------------- 161-------------------------------
162The cpuinfo_transition_latency field is 0. The PCC specification does 162The cpuinfo_transition_latency field is CPUFREQ_ETERNAL. The PCC specification
163not include a field to expose this value currently. 163does not include a field to expose this value currently.
164 164
1652.3 cpuinfo_cur_freq: 1652.3 cpuinfo_cur_freq:
166--------------------- 166---------------------
diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt
index f9ad5e048b11..dd68821c22d4 100644
--- a/Documentation/cpu-hotplug.txt
+++ b/Documentation/cpu-hotplug.txt
@@ -150,7 +150,7 @@ an entry as shown below in the output.
150 150
151If this is not mounted, do the following. 151If this is not mounted, do the following.
152 152
153 #mkdir /sysfs 153 #mkdir /sys
154 #mount -t sysfs sys /sys 154 #mount -t sysfs sys /sys
155 155
156Now you should see entries for all present cpu, the following is an example 156Now you should see entries for all present cpu, the following is an example
diff --git a/Documentation/device-mapper/verity.txt b/Documentation/device-mapper/verity.txt
index e15bc1a0fb98..89fd8f9a259f 100644
--- a/Documentation/device-mapper/verity.txt
+++ b/Documentation/device-mapper/verity.txt
@@ -18,11 +18,11 @@ Construction Parameters
18 18
19 0 is the original format used in the Chromium OS. 19 0 is the original format used in the Chromium OS.
20 The salt is appended when hashing, digests are stored continuously and 20 The salt is appended when hashing, digests are stored continuously and
21 the rest of the block is padded with zeros. 21 the rest of the block is padded with zeroes.
22 22
23 1 is the current format that should be used for new devices. 23 1 is the current format that should be used for new devices.
24 The salt is prepended when hashing and each digest is 24 The salt is prepended when hashing and each digest is
25 padded with zeros to the power of two. 25 padded with zeroes to the power of two.
26 26
27<dev> 27<dev>
28 This is the device containing data, the integrity of which needs to be 28 This is the device containing data, the integrity of which needs to be
@@ -79,6 +79,37 @@ restart_on_corruption
79 not compatible with ignore_corruption and requires user space support to 79 not compatible with ignore_corruption and requires user space support to
80 avoid restart loops. 80 avoid restart loops.
81 81
82ignore_zero_blocks
83 Do not verify blocks that are expected to contain zeroes and always return
84 zeroes instead. This may be useful if the partition contains unused blocks
85 that are not guaranteed to contain zeroes.
86
87use_fec_from_device <fec_dev>
88 Use forward error correction (FEC) to recover from corruption if hash
89 verification fails. Use encoding data from the specified device. This
90 may be the same device where data and hash blocks reside, in which case
91 fec_start must be outside data and hash areas.
92
93 If the encoding data covers additional metadata, it must be accessible
94 on the hash device after the hash blocks.
95
96 Note: block sizes for data and hash devices must match. Also, if the
97 verity <dev> is encrypted the <fec_dev> should be too.
98
99fec_roots <num>
100 Number of generator roots. This equals to the number of parity bytes in
101 the encoding data. For example, in RS(M, N) encoding, the number of roots
102 is M-N.
103
104fec_blocks <num>
105 The number of encoding data blocks on the FEC device. The block size for
106 the FEC device is <data_block_size>.
107
108fec_start <offset>
109 This is the offset, in <data_block_size> blocks, from the start of the
110 FEC device to the beginning of the encoding data.
111
112
82Theory of operation 113Theory of operation
83=================== 114===================
84 115
@@ -98,6 +129,11 @@ per-block basis. This allows for a lightweight hash computation on first read
98into the page cache. Block hashes are stored linearly, aligned to the nearest 129into the page cache. Block hashes are stored linearly, aligned to the nearest
99block size. 130block size.
100 131
132If forward error correction (FEC) support is enabled any recovery of
133corrupted data will be verified using the cryptographic hash of the
134corresponding data. This is why combining error correction with
135integrity checking is essential.
136
101Hash Tree 137Hash Tree
102--------- 138---------
103 139
diff --git a/Documentation/devicetree/bindings/arm/arm,scpi.txt b/Documentation/devicetree/bindings/arm/arm,scpi.txt
index 86302de67c2c..313dabdc14f9 100644
--- a/Documentation/devicetree/bindings/arm/arm,scpi.txt
+++ b/Documentation/devicetree/bindings/arm/arm,scpi.txt
@@ -63,7 +63,7 @@ Required properties:
63- compatible : should be "arm,juno-sram-ns" for Non-secure SRAM on Juno 63- compatible : should be "arm,juno-sram-ns" for Non-secure SRAM on Juno
64 64
65The rest of the properties should follow the generic mmio-sram description 65The rest of the properties should follow the generic mmio-sram description
66found in ../../misc/sysram.txt 66found in ../../sram/sram.txt
67 67
68Each sub-node represents the reserved area for SCPI. 68Each sub-node represents the reserved area for SCPI.
69 69
diff --git a/Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt b/Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt
index c78576bb7729..11d3056dc2bd 100644
--- a/Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt
+++ b/Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt
@@ -26,6 +26,10 @@ Raspberry Pi Model B+
26Required root node properties: 26Required root node properties:
27compatible = "raspberrypi,model-b-plus", "brcm,bcm2835"; 27compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
28 28
29Raspberry Pi 2 Model B
30Required root node properties:
31compatible = "raspberrypi,2-model-b", "brcm,bcm2836";
32
29Raspberry Pi Compute Module 33Raspberry Pi Compute Module
30Required root node properties: 34Required root node properties:
31compatible = "raspberrypi,compute-module", "brcm,bcm2835"; 35compatible = "raspberrypi,compute-module", "brcm,bcm2835";
diff --git a/Documentation/devicetree/bindings/arm/bcm/brcm,bcm4708.txt b/Documentation/devicetree/bindings/arm/bcm/brcm,bcm4708.txt
index 6b0f49f6f499..8608a776caa7 100644
--- a/Documentation/devicetree/bindings/arm/bcm/brcm,bcm4708.txt
+++ b/Documentation/devicetree/bindings/arm/bcm/brcm,bcm4708.txt
@@ -5,4 +5,11 @@ Boards with the BCM4708 SoC shall have the following properties:
5 5
6Required root node property: 6Required root node property:
7 7
8bcm4708
8compatible = "brcm,bcm4708"; 9compatible = "brcm,bcm4708";
10
11bcm4709
12compatible = "brcm,bcm4709";
13
14bcm53012
15compatible = "brcm,bcm53012";
diff --git a/Documentation/devicetree/bindings/arm/bcm/brcm,nsp-cpu-method.txt b/Documentation/devicetree/bindings/arm/bcm/brcm,nsp-cpu-method.txt
new file mode 100644
index 000000000000..677ef9d9f445
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/bcm/brcm,nsp-cpu-method.txt
@@ -0,0 +1,39 @@
1Broadcom Northstar Plus SoC CPU Enable Method
2---------------------------------------------
3This binding defines the enable method used for starting secondary
4CPU in the following Broadcom SoCs:
5 BCM58522, BCM58525, BCM58535, BCM58622, BCM58623, BCM58625, BCM88312
6
7The enable method is specified by defining the following required
8properties in the corresponding secondary "cpu" device tree node:
9 - enable-method = "brcm,bcm-nsp-smp";
10 - secondary-boot-reg = <...>;
11
12The secondary-boot-reg property is a u32 value that specifies the
13physical address of the register which should hold the common
14entry point for a secondary CPU. This entry is cpu node specific
15and should be added per cpu. E.g., in case of NSP (BCM58625) which
16is a dual core CPU SoC, this entry should be added to cpu1 node.
17
18
19Example:
20 cpus {
21 #address-cells = <1>;
22 #size-cells = <0>;
23
24 cpu0: cpu@0 {
25 device_type = "cpu";
26 compatible = "arm,cortex-a9";
27 next-level-cache = <&L2>;
28 reg = <0>;
29 };
30
31 cpu1: cpu@1 {
32 device_type = "cpu";
33 compatible = "arm,cortex-a9";
34 next-level-cache = <&L2>;
35 enable-method = "brcm,bcm-nsp-smp";
36 secondary-boot-reg = <0xffff042c>;
37 reg = <1>;
38 };
39 };
diff --git a/Documentation/devicetree/bindings/arm/compulab-boards.txt b/Documentation/devicetree/bindings/arm/compulab-boards.txt
new file mode 100644
index 000000000000..42a10285af9c
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/compulab-boards.txt
@@ -0,0 +1,25 @@
1CompuLab SB-SOM is a multi-module baseboard capable of carrying:
2 - CM-T43
3 - CM-T54
4 - CM-QS600
5 - CL-SOM-AM57x
6 - CL-SOM-iMX7
7modules with minor modifications to the SB-SOM assembly.
8
9Required root node properties:
10 - compatible = should be "compulab,sb-som"
11
12Compulab CL-SOM-iMX7 is a miniature System-on-Module (SoM) based on
13Freescale i.MX7 ARM Cortex-A7 System-on-Chip.
14
15Required root node properties:
16 - compatible = "compulab,cl-som-imx7", "fsl,imx7d";
17
18Compulab SBC-iMX7 is a single board computer based on the
19Freescale i.MX7 system-on-chip. SBC-iMX7 is implemented with
20the CL-SOM-iMX7 System-on-Module providing most of the functions,
21and SB-SOM-iMX7 carrier board providing additional peripheral
22functions and connectors.
23
24Required root node properties:
25 - compatible = "compulab,sbc-imx7", "compulab,cl-som-imx7", "fsl,imx7d";
diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
index 3a07a87fef20..ae9be074d09f 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -157,6 +157,7 @@ nodes to be present and contain the properties described below.
157 "arm,cortex-a17" 157 "arm,cortex-a17"
158 "arm,cortex-a53" 158 "arm,cortex-a53"
159 "arm,cortex-a57" 159 "arm,cortex-a57"
160 "arm,cortex-a72"
160 "arm,cortex-m0" 161 "arm,cortex-m0"
161 "arm,cortex-m0+" 162 "arm,cortex-m0+"
162 "arm,cortex-m1" 163 "arm,cortex-m1"
@@ -190,6 +191,8 @@ nodes to be present and contain the properties described below.
190 "allwinner,sun6i-a31" 191 "allwinner,sun6i-a31"
191 "allwinner,sun8i-a23" 192 "allwinner,sun8i-a23"
192 "arm,psci" 193 "arm,psci"
194 "arm,realview-smp"
195 "brcm,bcm-nsp-smp"
193 "brcm,brahma-b15" 196 "brcm,brahma-b15"
194 "marvell,armada-375-smp" 197 "marvell,armada-375-smp"
195 "marvell,armada-380-smp" 198 "marvell,armada-380-smp"
@@ -200,6 +203,7 @@ nodes to be present and contain the properties described below.
200 "qcom,gcc-msm8660" 203 "qcom,gcc-msm8660"
201 "qcom,kpss-acc-v1" 204 "qcom,kpss-acc-v1"
202 "qcom,kpss-acc-v2" 205 "qcom,kpss-acc-v2"
206 "rockchip,rk3036-smp"
203 "rockchip,rk3066-smp" 207 "rockchip,rk3066-smp"
204 "ste,dbx500-smp" 208 "ste,dbx500-smp"
205 209
@@ -242,6 +246,23 @@ nodes to be present and contain the properties described below.
242 Definition: Specifies the syscon node controlling the cpu core 246 Definition: Specifies the syscon node controlling the cpu core
243 power domains. 247 power domains.
244 248
249 - dynamic-power-coefficient
250 Usage: optional
251 Value type: <prop-encoded-array>
252 Definition: A u32 value that represents the running time dynamic
253 power coefficient in units of mW/MHz/uVolt^2. The
254 coefficient can either be calculated from power
255 measurements or derived by analysis.
256
257 The dynamic power consumption of the CPU is
258 proportional to the square of the Voltage (V) and
259 the clock frequency (f). The coefficient is used to
260 calculate the dynamic power as below -
261
262 Pdyn = dynamic-power-coefficient * V^2 * f
263
264 where voltage is in uV, frequency is in MHz.
265
245Example 1 (dual-cluster big.LITTLE system 32-bit): 266Example 1 (dual-cluster big.LITTLE system 32-bit):
246 267
247 cpus { 268 cpus {
diff --git a/Documentation/devicetree/bindings/arm/fsl.txt b/Documentation/devicetree/bindings/arm/fsl.txt
index 34c88b0c7ab4..752a685d926f 100644
--- a/Documentation/devicetree/bindings/arm/fsl.txt
+++ b/Documentation/devicetree/bindings/arm/fsl.txt
@@ -131,6 +131,10 @@ Example:
131Freescale ARMv8 based Layerscape SoC family Device Tree Bindings 131Freescale ARMv8 based Layerscape SoC family Device Tree Bindings
132---------------------------------------------------------------- 132----------------------------------------------------------------
133 133
134LS1043A ARMv8 based RDB Board
135Required root node properties:
136 - compatible = "fsl,ls1043a-rdb", "fsl,ls1043a";
137
134LS2080A ARMv8 based Simulator model 138LS2080A ARMv8 based Simulator model
135Required root node properties: 139Required root node properties:
136 - compatible = "fsl,ls2080a-simu", "fsl,ls2080a"; 140 - compatible = "fsl,ls2080a-simu", "fsl,ls2080a";
diff --git a/Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt b/Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt
index 6ac7c000af22..e3ccab114006 100644
--- a/Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt
+++ b/Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt
@@ -187,6 +187,22 @@ Example:
187 reg = <0xb0000000 0x10000>; 187 reg = <0xb0000000 0x10000>;
188 }; 188 };
189 189
190Hisilicon HiP05 PERISUB system controller
191
192Required properties:
193- compatible : "hisilicon,hip05-perisubc", "syscon";
194- reg : Register address and size
195
196The HiP05 PERISUB system controller is shared by peripheral controllers in
197HiP05 Soc to implement some basic configurations. The peripheral
198controllers include mdio, ddr, iic, uart, timer and so on.
199
200Example:
201 /* for HiP05 perisub-ctrl-c system */
202 peri_c_subctrl: syscon@80000000 {
203 compatible = "hisilicon,hip05-perisubc", "syscon";
204 reg = <0x0 0x80000000 0x0 0x10000>;
205 };
190----------------------------------------------------------------------- 206-----------------------------------------------------------------------
191Hisilicon CPU controller 207Hisilicon CPU controller
192 208
diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2c2x0.txt
index 06c88a4d28ac..fe0398c5c77b 100644
--- a/Documentation/devicetree/bindings/arm/l2cc.txt
+++ b/Documentation/devicetree/bindings/arm/l2c2x0.txt
@@ -1,7 +1,8 @@
1* ARM L2 Cache Controller 1* ARM L2 Cache Controller
2 2
3ARM cores often have a separate level 2 cache controller. There are various 3ARM cores often have a separate L2C210/L2C220/L2C310 (also known as PL210/PL220/
4implementations of the L2 cache controller with compatible programming models. 4PL310 and variants) based level 2 cache controller. All these various implementations
5of the L2 cache controller have compatible programming models (Note 1).
5Some of the properties that are just prefixed "cache-*" are taken from section 6Some of the properties that are just prefixed "cache-*" are taken from section
63.7.3 of the ePAPR v1.1 specification which can be found at: 73.7.3 of the ePAPR v1.1 specification which can be found at:
7https://www.power.org/wp-content/uploads/2012/06/Power_ePAPR_APPROVED_v1.1.pdf 8https://www.power.org/wp-content/uploads/2012/06/Power_ePAPR_APPROVED_v1.1.pdf
@@ -67,12 +68,17 @@ Optional properties:
67 disable if zero. 68 disable if zero.
68- arm,prefetch-offset : Override prefetch offset value. Valid values are 69- arm,prefetch-offset : Override prefetch offset value. Valid values are
69 0-7, 15, 23, and 31. 70 0-7, 15, 23, and 31.
70- arm,shared-override : The default behavior of the pl310 cache controller with 71- arm,shared-override : The default behavior of the L220 or PL310 cache
71 respect to the shareable attribute is to transform "normal memory 72 controllers with respect to the shareable attribute is to transform "normal
72 non-cacheable transactions" into "cacheable no allocate" (for reads) or 73 memory non-cacheable transactions" into "cacheable no allocate" (for reads)
73 "write through no write allocate" (for writes). 74 or "write through no write allocate" (for writes).
74 On systems where this may cause DMA buffer corruption, this property must be 75 On systems where this may cause DMA buffer corruption, this property must be
75 specified to indicate that such transforms are precluded. 76 specified to indicate that such transforms are precluded.
77- arm,parity-enable : enable parity checking on the L2 cache (L220 or PL310).
78- arm,parity-disable : disable parity checking on the L2 cache (L220 or PL310).
79- arm,outer-sync-disable : disable the outer sync operation on the L2 cache.
80 Some core tiles, especially ARM PB11MPCore have a faulty L220 cache that
81 will randomly hang unless outer sync operations are disabled.
76- prefetch-data : Data prefetch. Value: <0> (forcibly disable), <1> 82- prefetch-data : Data prefetch. Value: <0> (forcibly disable), <1>
77 (forcibly enable), property absent (retain settings set by firmware) 83 (forcibly enable), property absent (retain settings set by firmware)
78- prefetch-instr : Instruction prefetch. Value: <0> (forcibly disable), 84- prefetch-instr : Instruction prefetch. Value: <0> (forcibly disable),
@@ -91,3 +97,9 @@ L2: cache-controller {
91 cache-level = <2>; 97 cache-level = <2>;
92 interrupts = <45>; 98 interrupts = <45>;
93}; 99};
100
101Note 1: The description in this document doesn't apply to integrated L2
102 cache controllers as found in e.g. Cortex-A15/A7/A57/A53. These
103 integrated L2 controllers are assumed to be all preconfigured by
104 early secure boot code. Thus no need to deal with their configuration
105 in the kernel at all.
diff --git a/Documentation/devicetree/bindings/arm/marvell,kirkwood.txt b/Documentation/devicetree/bindings/arm/marvell,kirkwood.txt
index 5171ad8f48ff..ab0c9cdf388e 100644
--- a/Documentation/devicetree/bindings/arm/marvell,kirkwood.txt
+++ b/Documentation/devicetree/bindings/arm/marvell,kirkwood.txt
@@ -24,6 +24,8 @@ board. Currently known boards are:
24"buffalo,lswxl" 24"buffalo,lswxl"
25"buffalo,lsxhl" 25"buffalo,lsxhl"
26"buffalo,lsxl" 26"buffalo,lsxl"
27"cloudengines,pogo02"
28"cloudengines,pogoplugv4"
27"dlink,dns-320" 29"dlink,dns-320"
28"dlink,dns-320-a1" 30"dlink,dns-320-a1"
29"dlink,dns-325" 31"dlink,dns-325"
diff --git a/Documentation/devicetree/bindings/arm/mediatek.txt b/Documentation/devicetree/bindings/arm/mediatek.txt
index 618a91994a18..54f43bc2df44 100644
--- a/Documentation/devicetree/bindings/arm/mediatek.txt
+++ b/Documentation/devicetree/bindings/arm/mediatek.txt
@@ -6,6 +6,7 @@ following property:
6Required root node property: 6Required root node property:
7 7
8compatible: Must contain one of 8compatible: Must contain one of
9 "mediatek,mt2701"
9 "mediatek,mt6580" 10 "mediatek,mt6580"
10 "mediatek,mt6589" 11 "mediatek,mt6589"
11 "mediatek,mt6592" 12 "mediatek,mt6592"
@@ -17,6 +18,9 @@ compatible: Must contain one of
17 18
18Supported boards: 19Supported boards:
19 20
21- Evaluation board for MT2701:
22 Required root node properties:
23 - compatible = "mediatek,mt2701-evb", "mediatek,mt2701";
20- Evaluation board for MT6580: 24- Evaluation board for MT6580:
21 Required root node properties: 25 Required root node properties:
22 - compatible = "mediatek,mt6580-evbp1", "mediatek,mt6580"; 26 - compatible = "mediatek,mt6580-evbp1", "mediatek,mt6580";
diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,infracfg.txt b/Documentation/devicetree/bindings/arm/mediatek/mediatek,infracfg.txt
index f6cd3e4192ff..aaf8d1460c4d 100644
--- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,infracfg.txt
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,infracfg.txt
@@ -18,7 +18,7 @@ The available clocks are defined in dt-bindings/clock/mt*-clk.h.
18Also it uses the common reset controller binding from 18Also it uses the common reset controller binding from
19Documentation/devicetree/bindings/reset/reset.txt. 19Documentation/devicetree/bindings/reset/reset.txt.
20The available reset outputs are defined in 20The available reset outputs are defined in
21dt-bindings/reset-controller/mt*-resets.h 21dt-bindings/reset/mt*-resets.h
22 22
23Example: 23Example:
24 24
diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,pericfg.txt b/Documentation/devicetree/bindings/arm/mediatek/mediatek,pericfg.txt
index f25b85499a6f..2f6ff86df49f 100644
--- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,pericfg.txt
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,pericfg.txt
@@ -18,7 +18,7 @@ The available clocks are defined in dt-bindings/clock/mt*-clk.h.
18Also it uses the common reset controller binding from 18Also it uses the common reset controller binding from
19Documentation/devicetree/bindings/reset/reset.txt. 19Documentation/devicetree/bindings/reset/reset.txt.
20The available reset outputs are defined in 20The available reset outputs are defined in
21dt-bindings/reset-controller/mt*-resets.h 21dt-bindings/reset/mt*-resets.h
22 22
23Example: 23Example:
24 24
diff --git a/Documentation/devicetree/bindings/arm/omap/omap.txt b/Documentation/devicetree/bindings/arm/omap/omap.txt
index 9f4e5136e568..a2bd593881ca 100644
--- a/Documentation/devicetree/bindings/arm/omap/omap.txt
+++ b/Documentation/devicetree/bindings/arm/omap/omap.txt
@@ -138,9 +138,21 @@ Boards:
138- AM335X phyBOARD-WEGA: Single Board Computer dev kit 138- AM335X phyBOARD-WEGA: Single Board Computer dev kit
139 compatible = "phytec,am335x-wega", "phytec,am335x-phycore-som", "ti,am33xx" 139 compatible = "phytec,am335x-wega", "phytec,am335x-phycore-som", "ti,am33xx"
140 140
141- AM335X CM-T335 : System On Module, built around the Sitara AM3352/4
142 compatible = "compulab,cm-t335", "ti,am33xx"
143
144- AM335X SBC-T335 : single board computer, built around the Sitara AM3352/4
145 compatible = "compulab,sbc-t335", "compulab,cm-t335", "ti,am33xx"
146
141- OMAP5 EVM : Evaluation Module 147- OMAP5 EVM : Evaluation Module
142 compatible = "ti,omap5-evm", "ti,omap5" 148 compatible = "ti,omap5-evm", "ti,omap5"
143 149
150- AM437x CM-T43
151 compatible = "compulab,am437x-cm-t43", "ti,am4372", "ti,am43"
152
153- AM437x SBC-T43
154 compatible = "compulab,am437x-sbc-t43", "compulab,am437x-cm-t43", "ti,am4372", "ti,am43"
155
144- AM43x EPOS EVM 156- AM43x EPOS EVM
145 compatible = "ti,am43x-epos-evm", "ti,am4372", "ti,am43" 157 compatible = "ti,am43x-epos-evm", "ti,am4372", "ti,am43"
146 158
@@ -150,6 +162,12 @@ Boards:
150- AM437x SK EVM: AM437x StarterKit Evaluation Module 162- AM437x SK EVM: AM437x StarterKit Evaluation Module
151 compatible = "ti,am437x-sk-evm", "ti,am4372", "ti,am43" 163 compatible = "ti,am437x-sk-evm", "ti,am4372", "ti,am43"
152 164
165- AM57XX CL-SOM-AM57x
166 compatible = "compulab,cl-som-am57x", "ti,am5728", "ti,dra742", "ti,dra74", "ti,dra7"
167
168- AM57XX SBC-AM57x
169 compatible = "compulab,sbc-am57x", "compulab,cl-som-am57x", "ti,am5728", "ti,dra742", "ti,dra74", "ti,dra7"
170
153- DRA742 EVM: Software Development Board for DRA742 171- DRA742 EVM: Software Development Board for DRA742
154 compatible = "ti,dra7-evm", "ti,dra742", "ti,dra74", "ti,dra7" 172 compatible = "ti,dra7-evm", "ti,dra742", "ti,dra74", "ti,dra7"
155 173
diff --git a/Documentation/devicetree/bindings/arm/pmu.txt b/Documentation/devicetree/bindings/arm/pmu.txt
index 97ba45af04fc..56518839f52a 100644
--- a/Documentation/devicetree/bindings/arm/pmu.txt
+++ b/Documentation/devicetree/bindings/arm/pmu.txt
@@ -9,8 +9,9 @@ Required properties:
9- compatible : should be one of 9- compatible : should be one of
10 "apm,potenza-pmu" 10 "apm,potenza-pmu"
11 "arm,armv8-pmuv3" 11 "arm,armv8-pmuv3"
12 "arm.cortex-a57-pmu" 12 "arm,cortex-a72-pmu"
13 "arm.cortex-a53-pmu" 13 "arm,cortex-a57-pmu"
14 "arm,cortex-a53-pmu"
14 "arm,cortex-a17-pmu" 15 "arm,cortex-a17-pmu"
15 "arm,cortex-a15-pmu" 16 "arm,cortex-a15-pmu"
16 "arm,cortex-a12-pmu" 17 "arm,cortex-a12-pmu"
diff --git a/Documentation/devicetree/bindings/arm/psci.txt b/Documentation/devicetree/bindings/arm/psci.txt
index a9adab84e2fe..a2c4f1d52492 100644
--- a/Documentation/devicetree/bindings/arm/psci.txt
+++ b/Documentation/devicetree/bindings/arm/psci.txt
@@ -23,17 +23,20 @@ Main node required properties:
23 23
24 - compatible : should contain at least one of: 24 - compatible : should contain at least one of:
25 25
26 * "arm,psci" : for implementations complying to PSCI versions prior to 26 * "arm,psci" : For implementations complying to PSCI versions prior
27 0.2. For these cases function IDs must be provided. 27 to 0.2.
28 28 For these cases function IDs must be provided.
29 * "arm,psci-0.2" : for implementations complying to PSCI 0.2. Function 29
30 IDs are not required and should be ignored by an OS with PSCI 0.2 30 * "arm,psci-0.2" : For implementations complying to PSCI 0.2.
31 support, but are permitted to be present for compatibility with 31 Function IDs are not required and should be ignored by
32 existing software when "arm,psci" is later in the compatible list. 32 an OS with PSCI 0.2 support, but are permitted to be
33 33 present for compatibility with existing software when
34 * "arm,psci-1.0" : for implementations complying to PSCI 1.0. PSCI 1.0 is 34 "arm,psci" is later in the compatible list.
35 backward compatible with PSCI 0.2 with minor specification updates, 35
36 as defined in the PSCI specification[2]. 36 * "arm,psci-1.0" : For implementations complying to PSCI 1.0.
37 PSCI 1.0 is backward compatible with PSCI 0.2 with
38 minor specification updates, as defined in the PSCI
39 specification[2].
37 40
38 - method : The method of calling the PSCI firmware. Permitted 41 - method : The method of calling the PSCI firmware. Permitted
39 values are: 42 values are:
diff --git a/Documentation/devicetree/bindings/arm/rockchip.txt b/Documentation/devicetree/bindings/arm/rockchip.txt
index 8e985dd2f181..078c14fcdaaa 100644
--- a/Documentation/devicetree/bindings/arm/rockchip.txt
+++ b/Documentation/devicetree/bindings/arm/rockchip.txt
@@ -1,6 +1,10 @@
1Rockchip platforms device tree bindings 1Rockchip platforms device tree bindings
2--------------------------------------- 2---------------------------------------
3 3
4- Kylin RK3036 board:
5 Required root node properties:
6 - compatible = "rockchip,kylin-rk3036", "rockchip,rk3036";
7
4- MarsBoard RK3066 board: 8- MarsBoard RK3066 board:
5 Required root node properties: 9 Required root node properties:
6 - compatible = "haoyu,marsboard-rk3066", "rockchip,rk3066a"; 10 - compatible = "haoyu,marsboard-rk3066", "rockchip,rk3066a";
@@ -35,6 +39,11 @@ Rockchip platforms device tree bindings
35 Required root node properties: 39 Required root node properties:
36 - compatible = "netxeon,r89", "rockchip,rk3288"; 40 - compatible = "netxeon,r89", "rockchip,rk3288";
37 41
42- Google Brain (dev-board):
43 Required root node properties:
44 - compatible = "google,veyron-brain-rev0", "google,veyron-brain",
45 "google,veyron", "rockchip,rk3288";
46
38- Google Jaq (Haier Chromebook 11 and more): 47- Google Jaq (Haier Chromebook 11 and more):
39 Required root node properties: 48 Required root node properties:
40 - compatible = "google,veyron-jaq-rev5", "google,veyron-jaq-rev4", 49 - compatible = "google,veyron-jaq-rev5", "google,veyron-jaq-rev4",
@@ -49,6 +58,15 @@ Rockchip platforms device tree bindings
49 "google,veyron-jerry-rev3", "google,veyron-jerry", 58 "google,veyron-jerry-rev3", "google,veyron-jerry",
50 "google,veyron", "rockchip,rk3288"; 59 "google,veyron", "rockchip,rk3288";
51 60
61- Google Mickey (Asus Chromebit CS10):
62 Required root node properties:
63 - compatible = "google,veyron-mickey-rev8", "google,veyron-mickey-rev7",
64 "google,veyron-mickey-rev6", "google,veyron-mickey-rev5",
65 "google,veyron-mickey-rev4", "google,veyron-mickey-rev3",
66 "google,veyron-mickey-rev2", "google,veyron-mickey-rev1",
67 "google,veyron-mickey-rev0", "google,veyron-mickey",
68 "google,veyron", "rockchip,rk3288";
69
52- Google Minnie (Asus Chromebook Flip C100P): 70- Google Minnie (Asus Chromebook Flip C100P):
53 Required root node properties: 71 Required root node properties:
54 - compatible = "google,veyron-minnie-rev4", "google,veyron-minnie-rev3", 72 - compatible = "google,veyron-minnie-rev4", "google,veyron-minnie-rev3",
@@ -69,6 +87,14 @@ Rockchip platforms device tree bindings
69 "google,veyron-speedy-rev3", "google,veyron-speedy-rev2", 87 "google,veyron-speedy-rev3", "google,veyron-speedy-rev2",
70 "google,veyron-speedy", "google,veyron", "rockchip,rk3288"; 88 "google,veyron-speedy", "google,veyron", "rockchip,rk3288";
71 89
90- Rockchip RK3368 evb:
91 Required root node properties:
92 - compatible = "rockchip,rk3368-evb-act8846", "rockchip,rk3368";
93
72- Rockchip R88 board: 94- Rockchip R88 board:
73 Required root node properties: 95 Required root node properties:
74 - compatible = "rockchip,r88", "rockchip,rk3368"; 96 - compatible = "rockchip,r88", "rockchip,rk3368";
97
98- Rockchip RK3228 Evaluation board:
99 Required root node properties:
100 - compatible = "rockchip,rk3228-evb", "rockchip,rk3228";
diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
index f46ca9a316a2..ccaaec6014bd 100644
--- a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
+++ b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
@@ -47,6 +47,9 @@ Required properties:
47 47
48- samsung,syscon-phandle Contains the PMU system controller node 48- samsung,syscon-phandle Contains the PMU system controller node
49 (To access the ADC_PHY register on Exynos5250/5420/5800/3250) 49 (To access the ADC_PHY register on Exynos5250/5420/5800/3250)
50Optional properties:
51- has-touchscreen: If present, indicates that a touchscreen is
52 connected an usable.
50 53
51Note: child nodes can be added for auto probing from device tree. 54Note: child nodes can be added for auto probing from device tree.
52 55
diff --git a/Documentation/devicetree/bindings/arm/scu.txt b/Documentation/devicetree/bindings/arm/scu.txt
index c447680519bb..08a587875996 100644
--- a/Documentation/devicetree/bindings/arm/scu.txt
+++ b/Documentation/devicetree/bindings/arm/scu.txt
@@ -10,10 +10,13 @@ References:
10 Revision r2p0 10 Revision r2p0
11- Cortex-A5: see DDI0434B Cortex-A5 MPCore Technical Reference Manual 11- Cortex-A5: see DDI0434B Cortex-A5 MPCore Technical Reference Manual
12 Revision r0p1 12 Revision r0p1
13- ARM11 MPCore: see DDI0360F ARM 11 MPCore Processor Technical Reference
14 Manial Revision r2p0
13 15
14- compatible : Should be: 16- compatible : Should be:
15 "arm,cortex-a9-scu" 17 "arm,cortex-a9-scu"
16 "arm,cortex-a5-scu" 18 "arm,cortex-a5-scu"
19 "arm,arm11mp-scu"
17 20
18- reg : Specify the base address and the size of the SCU register window. 21- reg : Specify the base address and the size of the SCU register window.
19 22
diff --git a/Documentation/devicetree/bindings/arm/secure.txt b/Documentation/devicetree/bindings/arm/secure.txt
new file mode 100644
index 000000000000..e31303fb233a
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/secure.txt
@@ -0,0 +1,53 @@
1* ARM Secure world bindings
2
3ARM CPUs with TrustZone support have two distinct address spaces,
4"Normal" and "Secure". Most devicetree consumers (including the Linux
5kernel) are not TrustZone aware and run entirely in either the Normal
6world or the Secure world. However some devicetree consumers are
7TrustZone aware and need to be able to determine whether devices are
8visible only in the Secure address space, only in the Normal address
9space, or visible in both. (One example of that situation would be a
10virtual machine which boots Secure firmware and wants to tell the
11firmware about the layout of the machine via devicetree.)
12
13The general principle of the naming scheme for Secure world bindings
14is that any property that needs a different value in the Secure world
15can be supported by prefixing the property name with "secure-". So for
16instance "secure-foo" would override "foo". For property names with
17a vendor prefix, the Secure variant of "vendor,foo" would be
18"vendor,secure-foo". If there is no "secure-" property then the Secure
19world value is the same as specified for the Normal world by the
20non-prefixed property. However, only the properties listed below may
21validly have "secure-" versions; this list will be enlarged on a
22case-by-case basis.
23
24Defining the bindings in this way means that a device tree which has
25been annotated to indicate the presence of Secure-only devices can
26still be processed unmodified by existing Non-secure software (and in
27particular by the kernel).
28
29Note that it is still valid for bindings intended for purely Secure
30world consumers (like kernels that run entirely in Secure) to simply
31describe the view of Secure world using the standard bindings. These
32secure- bindings only need to be used where both the Secure and Normal
33world views need to be described in a single device tree.
34
35Valid Secure world properties:
36
37- secure-status : specifies whether the device is present and usable
38 in the secure world. The combination of this with "status" allows
39 the various possible combinations of device visibility to be
40 specified. If "secure-status" is not specified it defaults to the
41 same value as "status"; if "status" is not specified either then
42 both default to "okay". This means the following combinations are
43 possible:
44
45 /* Neither specified: default to visible in both S and NS */
46 secure-status = "okay"; /* visible in both */
47 status = "okay"; /* visible in both */
48 status = "okay"; secure-status = "okay"; /* visible in both */
49 secure-status = "disabled"; /* NS-only */
50 status = "okay"; secure-status = "disabled"; /* NS-only */
51 status = "disabled"; secure-status = "okay"; /* S-only */
52 status = "disabled"; /* disabled in both */
53 status = "disabled"; secure-status = "disabled"; /* disabled in both */
diff --git a/Documentation/devicetree/bindings/arm/shmobile.txt b/Documentation/devicetree/bindings/arm/shmobile.txt
index 40bb9007cd0d..9cf67e48f222 100644
--- a/Documentation/devicetree/bindings/arm/shmobile.txt
+++ b/Documentation/devicetree/bindings/arm/shmobile.txt
@@ -27,6 +27,8 @@ SoCs:
27 compatible = "renesas,r8a7793" 27 compatible = "renesas,r8a7793"
28 - R-Car E2 (R8A77940) 28 - R-Car E2 (R8A77940)
29 compatible = "renesas,r8a7794" 29 compatible = "renesas,r8a7794"
30 - R-Car H3 (R8A77950)
31 compatible = "renesas,r8a7795"
30 32
31 33
32Boards: 34Boards:
@@ -57,5 +59,7 @@ Boards:
57 compatible = "renesas,marzen", "renesas,r8a7779" 59 compatible = "renesas,marzen", "renesas,r8a7779"
58 - Porter (M2-LCDP) 60 - Porter (M2-LCDP)
59 compatible = "renesas,porter", "renesas,r8a7791" 61 compatible = "renesas,porter", "renesas,r8a7791"
62 - Salvator-X (RTP0RC7795SIPB0010S)
63 compatible = "renesas,salvator-x", "renesas,r8a7795";
60 - SILK (RTP0RC7794LCB00011S) 64 - SILK (RTP0RC7794LCB00011S)
61 compatible = "renesas,silk", "renesas,r8a7794" 65 compatible = "renesas,silk", "renesas,r8a7794"
diff --git a/Documentation/devicetree/bindings/arm/technologic.txt b/Documentation/devicetree/bindings/arm/technologic.txt
new file mode 100644
index 000000000000..842298894cf0
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/technologic.txt
@@ -0,0 +1,6 @@
1Technologic Systems Platforms Device Tree Bindings
2--------------------------------------------------
3
4TS-4800 board
5Required root node properties:
6 - compatible = "technologic,imx51-ts4800", "fsl,imx51";
diff --git a/Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt b/Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt
index 20ac9bbfa1fd..60872838f1ad 100644
--- a/Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt
+++ b/Documentation/devicetree/bindings/ata/brcm,sata-brcmstb.txt
@@ -4,7 +4,9 @@ SATA nodes are defined to describe on-chip Serial ATA controllers.
4Each SATA controller should have its own node. 4Each SATA controller should have its own node.
5 5
6Required properties: 6Required properties:
7- compatible : compatible list, may contain "brcm,bcm7445-ahci" and/or 7- compatible : should be one or more of
8 "brcm,bcm7425-ahci"
9 "brcm,bcm7445-ahci"
8 "brcm,sata3-ahci" 10 "brcm,sata3-ahci"
9- reg : register mappings for AHCI and SATA_TOP_CTRL 11- reg : register mappings for AHCI and SATA_TOP_CTRL
10- reg-names : "ahci" and "top-ctrl" 12- reg-names : "ahci" and "top-ctrl"
diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt
index 2493a5a31655..0764f9ab63dc 100644
--- a/Documentation/devicetree/bindings/ata/sata_rcar.txt
+++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt
@@ -8,6 +8,7 @@ Required properties:
8 - "renesas,sata-r8a7790" for R-Car H2 other than ES1 8 - "renesas,sata-r8a7790" for R-Car H2 other than ES1
9 - "renesas,sata-r8a7791" for R-Car M2-W 9 - "renesas,sata-r8a7791" for R-Car M2-W
10 - "renesas,sata-r8a7793" for R-Car M2-N 10 - "renesas,sata-r8a7793" for R-Car M2-N
11 - "renesas,sata-r8a7795" for R-Car H3
11- reg : address and length of the SATA registers; 12- reg : address and length of the SATA registers;
12- interrupts : must consist of one interrupt specifier. 13- interrupts : must consist of one interrupt specifier.
13- clocks : must contain a reference to the functional clock. 14- clocks : must contain a reference to the functional clock.
diff --git a/Documentation/devicetree/bindings/bus/uniphier-system-bus.txt b/Documentation/devicetree/bindings/bus/uniphier-system-bus.txt
new file mode 100644
index 000000000000..68ef80afff16
--- /dev/null
+++ b/Documentation/devicetree/bindings/bus/uniphier-system-bus.txt
@@ -0,0 +1,66 @@
1UniPhier System Bus
2
3The UniPhier System Bus is an external bus that connects on-board devices to
4the UniPhier SoC. It is a simple (semi-)parallel bus with address, data, and
5some control signals. It supports up to 8 banks (chip selects).
6
7Before any access to the bus, the bus controller must be configured; the bus
8controller registers provide the control for the translation from the offset
9within each bank to the CPU-viewed address. The needed setup includes the base
10address, the size of each bank. Optionally, some timing parameters can be
11optimized for faster bus access.
12
13Required properties:
14- compatible: should be "socionext,uniphier-system-bus".
15- reg: offset and length of the register set for the bus controller device.
16- #address-cells: should be 2. The first cell is the bank number (chip select).
17 The second cell is the address offset within the bank.
18- #size-cells: should be 1.
19- ranges: should provide a proper address translation from the System Bus to
20 the parent bus.
21
22Note:
23The address region(s) that can be assigned for the System Bus is implementation
24defined. Some SoCs can use 0x00000000-0x0fffffff and 0x40000000-0x4fffffff,
25while other SoCs can only use 0x40000000-0x4fffffff. There might be additional
26limitations depending on SoCs and the boot mode. The address translation is
27arbitrary as long as the banks are assigned in the supported address space with
28the required alignment and they do not overlap one another.
29For example, it is possible to map:
30 bank 0 to 0x42000000-0x43ffffff, bank 5 to 0x46000000-0x46ffffff
31It is also possible to map:
32 bank 0 to 0x48000000-0x49ffffff, bank 5 to 0x44000000-0x44ffffff
33There is no reason to stick to a particular translation mapping, but the
34"ranges" property should provide a "reasonable" default that is known to work.
35The software should initialize the bus controller according to it.
36
37Example:
38
39 system-bus {
40 compatible = "socionext,uniphier-system-bus";
41 reg = <0x58c00000 0x400>;
42 #address-cells = <2>;
43 #size-cells = <1>;
44 ranges = <1 0x00000000 0x42000000 0x02000000
45 5 0x00000000 0x46000000 0x01000000>;
46
47 ethernet@1,01f00000 {
48 compatible = "smsc,lan9115";
49 reg = <1 0x01f00000 0x1000>;
50 interrupts = <0 48 4>
51 phy-mode = "mii";
52 };
53
54 uart@5,00200000 {
55 compatible = "ns16550a";
56 reg = <5 0x00200000 0x20>;
57 interrupts = <0 49 4>
58 clock-frequency = <12288000>;
59 };
60 };
61
62In this example,
63 - the Ethernet device is connected at the offset 0x01f00000 of CS1 and
64 mapped to 0x43f00000 of the parent bus.
65 - the UART device is connected at the offset 0x00200000 of CS5 and
66 mapped to 0x46200000 of the parent bus.
diff --git a/Documentation/devicetree/bindings/clock/arm-syscon-icst.txt b/Documentation/devicetree/bindings/clock/arm-syscon-icst.txt
new file mode 100644
index 000000000000..8b7177cecb36
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/arm-syscon-icst.txt
@@ -0,0 +1,40 @@
1ARM System Controller ICST clocks
2
3The ICS525 and ICS307 oscillators are produced by Integrated Devices
4Technology (IDT). ARM integrated these oscillators deeply into their
5reference designs by adding special control registers that manage such
6oscillators to their system controllers.
7
8The ARM system controller contains logic to serialize and initialize
9an ICST clock request after a write to the 32 bit register at an offset
10into the system controller. Furthermore, to even be able to alter one of
11these frequencies, the system controller must first be unlocked by
12writing a special token to another offset in the system controller.
13
14The ICST oscillator must be provided inside a system controller node.
15
16Required properties:
17- lock-offset: the offset address into the system controller where the
18 unlocking register is located
19- vco-offset: the offset address into the system controller where the
20 ICST control register is located (even 32 bit address)
21- compatible: must be one of "arm,syscon-icst525" or "arm,syscon-icst307"
22- #clock-cells: must be <0>
23- clocks: parent clock, since the ICST needs a parent clock to derive its
24 frequency from, this attribute is compulsory.
25
26Example:
27
28syscon: syscon@10000000 {
29 compatible = "syscon";
30 reg = <0x10000000 0x1000>;
31
32 oscclk0: osc0@0c {
33 compatible = "arm,syscon-icst307";
34 #clock-cells = <0>;
35 lock-offset = <0x20>;
36 vco-offset = <0x0c>;
37 clocks = <&xtal24mhz>;
38 };
39 (...)
40};
diff --git a/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt b/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt
new file mode 100644
index 000000000000..7a837d2182ac
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt
@@ -0,0 +1,31 @@
1Broadcom BCM2835 auxiliary peripheral support
2
3This binding uses the common clock binding:
4 Documentation/devicetree/bindings/clock/clock-bindings.txt
5
6The auxiliary peripherals (UART, SPI1, and SPI2) have a small register
7area controlling clock gating to the peripherals, and providing an IRQ
8status register.
9
10Required properties:
11- compatible: Should be "brcm,bcm2835-aux"
12- #clock-cells: Should be <1>. The permitted clock-specifier values can be
13 found in include/dt-bindings/clock/bcm2835-aux.h
14- reg: Specifies base physical address and size of the registers
15- clocks: The parent clock phandle
16
17Example:
18
19 clocks: cprman@7e101000 {
20 compatible = "brcm,bcm2835-cprman";
21 #clock-cells = <1>;
22 reg = <0x7e101000 0x2000>;
23 clocks = <&clk_osc>;
24 };
25
26 aux: aux@0x7e215004 {
27 compatible = "brcm,bcm2835-aux";
28 #clock-cells = <1>;
29 reg = <0x7e215000 0x8>;
30 clocks = <&clocks BCM2835_CLOCK_VPU>;
31 };
diff --git a/Documentation/devicetree/bindings/clock/brcm,iproc-clocks.txt b/Documentation/devicetree/bindings/clock/brcm,iproc-clocks.txt
index ede65a55e21b..0b35e71b39e8 100644
--- a/Documentation/devicetree/bindings/clock/brcm,iproc-clocks.txt
+++ b/Documentation/devicetree/bindings/clock/brcm,iproc-clocks.txt
@@ -208,3 +208,8 @@ These clock IDs are defined in:
208 ch3_unused lcpll_ports 4 BCM_NS2_LCPLL_PORTS_CH3_UNUSED 208 ch3_unused lcpll_ports 4 BCM_NS2_LCPLL_PORTS_CH3_UNUSED
209 ch4_unused lcpll_ports 5 BCM_NS2_LCPLL_PORTS_CH4_UNUSED 209 ch4_unused lcpll_ports 5 BCM_NS2_LCPLL_PORTS_CH4_UNUSED
210 ch5_unused lcpll_ports 6 BCM_NS2_LCPLL_PORTS_CH5_UNUSED 210 ch5_unused lcpll_ports 6 BCM_NS2_LCPLL_PORTS_CH5_UNUSED
211
212BCM63138
213--------
214PLL and leaf clock compatible strings for BCM63138 are:
215 "brcm,bcm63138-armpll"
diff --git a/Documentation/devicetree/bindings/clock/cs2000-cp.txt b/Documentation/devicetree/bindings/clock/cs2000-cp.txt
new file mode 100644
index 000000000000..54e6df0bee8a
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/cs2000-cp.txt
@@ -0,0 +1,22 @@
1CIRRUS LOGIC Fractional-N Clock Synthesizer & Clock Multiplier
2
3Required properties:
4
5- compatible: "cirrus,cs2000-cp"
6- reg: The chip select number on the I2C bus
7- clocks: common clock binding for CLK_IN, XTI/REF_CLK
8- clock-names: CLK_IN : clk_in, XTI/REF_CLK : ref_clk
9- #clock-cells: must be <0>
10
11Example:
12
13&i2c2 {
14 ...
15 cs2000: clk_multiplier@4f {
16 #clock-cells = <0>;
17 compatible = "cirrus,cs2000-cp";
18 reg = <0x4f>;
19 clocks = <&rcar_sound 0>, <&x12_clk>;
20 clock-names = "clk_in", "ref_clk";
21 };
22};
diff --git a/Documentation/devicetree/bindings/clock/dove-divider-clock.txt b/Documentation/devicetree/bindings/clock/dove-divider-clock.txt
new file mode 100644
index 000000000000..e3eb0f657c5e
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/dove-divider-clock.txt
@@ -0,0 +1,28 @@
1PLL divider based Dove clocks
2
3Marvell Dove has a 2GHz PLL, which feeds into a set of dividers to provide
4high speed clocks for a number of peripherals. These dividers are part of
5the PMU, and thus this node should be a child of the PMU node.
6
7The following clocks are provided:
8
9ID Clock
10-------------
110 AXI bus clock
121 GPU clock
132 VMeta clock
143 LCD clock
15
16Required properties:
17- compatible : shall be "marvell,dove-divider-clock"
18- reg : shall be the register address of the Core PLL and Clock Divider
19 Control 0 register. This will cover that register, as well as the
20 Core PLL and Clock Divider Control 1 register. Thus, it will have
21 a size of 8.
22- #clock-cells : from common clock binding; shall be set to 1
23
24divider_clk: core-clock@0064 {
25 compatible = "marvell,dove-divider-clock";
26 reg = <0x0064 0x8>;
27 #clock-cells = <1>;
28};
diff --git a/Documentation/devicetree/bindings/clock/nvidia,tegra210-car.txt b/Documentation/devicetree/bindings/clock/nvidia,tegra210-car.txt
new file mode 100644
index 000000000000..26f237f641b7
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/nvidia,tegra210-car.txt
@@ -0,0 +1,56 @@
1NVIDIA Tegra210 Clock And Reset Controller
2
3This binding uses the common clock binding:
4Documentation/devicetree/bindings/clock/clock-bindings.txt
5
6The CAR (Clock And Reset) Controller on Tegra is the HW module responsible
7for muxing and gating Tegra's clocks, and setting their rates.
8
9Required properties :
10- compatible : Should be "nvidia,tegra210-car"
11- reg : Should contain CAR registers location and length
12- clocks : Should contain phandle and clock specifiers for two clocks:
13 the 32 KHz "32k_in".
14- #clock-cells : Should be 1.
15 In clock consumers, this cell represents the clock ID exposed by the
16 CAR. The assignments may be found in header file
17 <dt-bindings/clock/tegra210-car.h>.
18- #reset-cells : Should be 1.
19 In clock consumers, this cell represents the bit number in the CAR's
20 array of CLK_RST_CONTROLLER_RST_DEVICES_* registers.
21
22Example SoC include file:
23
24/ {
25 tegra_car: clock {
26 compatible = "nvidia,tegra210-car";
27 reg = <0x60006000 0x1000>;
28 #clock-cells = <1>;
29 #reset-cells = <1>;
30 };
31
32 usb@c5004000 {
33 clocks = <&tegra_car TEGRA210_CLK_USB2>;
34 };
35};
36
37Example board file:
38
39/ {
40 clocks {
41 compatible = "simple-bus";
42 #address-cells = <1>;
43 #size-cells = <0>;
44
45 clk_32k: clock@1 {
46 compatible = "fixed-clock";
47 reg = <1>;
48 #clock-cells = <0>;
49 clock-frequency = <32768>;
50 };
51 };
52
53 &tegra_car {
54 clocks = <&clk_32k>;
55 };
56};
diff --git a/Documentation/devicetree/bindings/clock/nxp,lpc3220-clk.txt b/Documentation/devicetree/bindings/clock/nxp,lpc3220-clk.txt
new file mode 100644
index 000000000000..20cbca3f41d8
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/nxp,lpc3220-clk.txt
@@ -0,0 +1,30 @@
1NXP LPC32xx Clock Controller
2
3Required properties:
4- compatible: should be "nxp,lpc3220-clk"
5- reg: should contain clock controller registers location and length
6- #clock-cells: must be 1, the cell holds id of a clock provided by the
7 clock controller
8- clocks: phandles of external oscillators, the list must contain one
9 32768 Hz oscillator and may have one optional high frequency oscillator
10- clock-names: list of external oscillator clock names, must contain
11 "xtal_32k" and may have optional "xtal"
12
13Examples:
14
15 /* System Control Block */
16 scb {
17 compatible = "simple-bus";
18 ranges = <0x0 0x040004000 0x00001000>;
19 #address-cells = <1>;
20 #size-cells = <1>;
21
22 clk: clock-controller@0 {
23 compatible = "nxp,lpc3220-clk";
24 reg = <0x00 0x114>;
25 #clock-cells = <1>;
26
27 clocks = <&xtal_32k>, <&xtal>;
28 clock-names = "xtal_32k", "xtal";
29 };
30 };
diff --git a/Documentation/devicetree/bindings/clock/nxp,lpc3220-usb-clk.txt b/Documentation/devicetree/bindings/clock/nxp,lpc3220-usb-clk.txt
new file mode 100644
index 000000000000..0aa249409b51
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/nxp,lpc3220-usb-clk.txt
@@ -0,0 +1,22 @@
1NXP LPC32xx USB Clock Controller
2
3Required properties:
4- compatible: should be "nxp,lpc3220-usb-clk"
5- reg: should contain clock controller registers location and length
6- #clock-cells: must be 1, the cell holds id of a clock provided by the
7 USB clock controller
8
9Examples:
10
11 usb {
12 #address-cells = <1>;
13 #size-cells = <1>;
14 compatible = "simple-bus";
15 ranges = <0x0 0x31020000 0x00001000>;
16
17 usbclk: clock-controller@f00 {
18 compatible = "nxp,lpc3220-usb-clk";
19 reg = <0xf00 0x100>;
20 #clock-cells = <1>;
21 };
22 };
diff --git a/Documentation/devicetree/bindings/clock/qcom,gcc.txt b/Documentation/devicetree/bindings/clock/qcom,gcc.txt
index 152dfaab2575..72f82f444091 100644
--- a/Documentation/devicetree/bindings/clock/qcom,gcc.txt
+++ b/Documentation/devicetree/bindings/clock/qcom,gcc.txt
@@ -13,6 +13,7 @@ Required properties :
13 "qcom,gcc-msm8974" 13 "qcom,gcc-msm8974"
14 "qcom,gcc-msm8974pro" 14 "qcom,gcc-msm8974pro"
15 "qcom,gcc-msm8974pro-ac" 15 "qcom,gcc-msm8974pro-ac"
16 "qcom,gcc-msm8996"
16 17
17- reg : shall contain base register location and length 18- reg : shall contain base register location and length
18- #clock-cells : shall contain 1 19- #clock-cells : shall contain 1
diff --git a/Documentation/devicetree/bindings/clock/qcom,mmcc.txt b/Documentation/devicetree/bindings/clock/qcom,mmcc.txt
index 34e7614d5074..8b0f7841af8d 100644
--- a/Documentation/devicetree/bindings/clock/qcom,mmcc.txt
+++ b/Documentation/devicetree/bindings/clock/qcom,mmcc.txt
@@ -9,6 +9,7 @@ Required properties :
9 "qcom,mmcc-msm8660" 9 "qcom,mmcc-msm8660"
10 "qcom,mmcc-msm8960" 10 "qcom,mmcc-msm8960"
11 "qcom,mmcc-msm8974" 11 "qcom,mmcc-msm8974"
12 "qcom,mmcc-msm8996"
12 13
13- reg : shall contain base register location and length 14- reg : shall contain base register location and length
14- #clock-cells : shall contain 1 15- #clock-cells : shall contain 1
diff --git a/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt
index 38dcf0370143..ae36ab842919 100644
--- a/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt
+++ b/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt
@@ -20,6 +20,10 @@ Required Properties:
20 clocks must be specified. For clocks with multiple parents, invalid 20 clocks must be specified. For clocks with multiple parents, invalid
21 settings must be specified as "<0>". 21 settings must be specified as "<0>".
22 - #clock-cells: Must be 0 22 - #clock-cells: Must be 0
23
24
25Optional Properties:
26
23 - clock-output-names: The name of the clock as a free-form string 27 - clock-output-names: The name of the clock as a free-form string
24 28
25 29
diff --git a/Documentation/devicetree/bindings/clock/renesas,h8300-div-clock.txt b/Documentation/devicetree/bindings/clock/renesas,h8300-div-clock.txt
index 36c2b528245c..399e0da22348 100644
--- a/Documentation/devicetree/bindings/clock/renesas,h8300-div-clock.txt
+++ b/Documentation/devicetree/bindings/clock/renesas,h8300-div-clock.txt
@@ -2,7 +2,7 @@
2 2
3Required Properties: 3Required Properties:
4 4
5 - compatible: Must be "renesas,sh73a0-h8300-div-clock" 5 - compatible: Must be "renesas,h8300-div-clock"
6 6
7 - clocks: Reference to the parent clocks ("extal1" and "extal2") 7 - clocks: Reference to the parent clocks ("extal1" and "extal2")
8 8
diff --git a/Documentation/devicetree/bindings/clock/rockchip,rk3036-cru.txt b/Documentation/devicetree/bindings/clock/rockchip,rk3036-cru.txt
new file mode 100644
index 000000000000..ace05992a262
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/rockchip,rk3036-cru.txt
@@ -0,0 +1,56 @@
1* Rockchip RK3036 Clock and Reset Unit
2
3The RK3036 clock controller generates and supplies clock to various
4controllers within the SoC and also implements a reset controller for SoC
5peripherals.
6
7Required Properties:
8
9- compatible: should be "rockchip,rk3036-cru"
10- reg: physical base address of the controller and length of memory mapped
11 region.
12- #clock-cells: should be 1.
13- #reset-cells: should be 1.
14
15Optional Properties:
16
17- rockchip,grf: phandle to the syscon managing the "general register files"
18 If missing pll rates are not changeable, due to the missing pll lock status.
19
20Each clock is assigned an identifier and client nodes can use this identifier
21to specify the clock which they consume. All available clocks are defined as
22preprocessor macros in the dt-bindings/clock/rk3036-cru.h headers and can be
23used in device tree sources. Similar macros exist for the reset sources in
24these files.
25
26External clocks:
27
28There are several clocks that are generated outside the SoC. It is expected
29that they are defined using standard clock bindings with following
30clock-output-names:
31 - "xin24m" - crystal input - required,
32 - "ext_i2s" - external I2S clock - optional,
33 - "ext_gmac" - external GMAC clock - optional
34
35Example: Clock controller node:
36
37 cru: cru@20000000 {
38 compatible = "rockchip,rk3036-cru";
39 reg = <0x20000000 0x1000>;
40 rockchip,grf = <&grf>;
41
42 #clock-cells = <1>;
43 #reset-cells = <1>;
44 };
45
46Example: UART controller node that consumes the clock generated by the clock
47 controller:
48
49 uart0: serial@20060000 {
50 compatible = "snps,dw-apb-uart";
51 reg = <0x20060000 0x100>;
52 interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
53 reg-shift = <2>;
54 reg-io-width = <4>;
55 clocks = <&cru SCLK_UART0>;
56 };
diff --git a/Documentation/devicetree/bindings/clock/rockchip,rk3228-cru.txt b/Documentation/devicetree/bindings/clock/rockchip,rk3228-cru.txt
new file mode 100644
index 000000000000..f323048127eb
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/rockchip,rk3228-cru.txt
@@ -0,0 +1,58 @@
1* Rockchip RK3228 Clock and Reset Unit
2
3The RK3228 clock controller generates and supplies clock to various
4controllers within the SoC and also implements a reset controller for SoC
5peripherals.
6
7Required Properties:
8
9- compatible: should be "rockchip,rk3228-cru"
10- reg: physical base address of the controller and length of memory mapped
11 region.
12- #clock-cells: should be 1.
13- #reset-cells: should be 1.
14
15Optional Properties:
16
17- rockchip,grf: phandle to the syscon managing the "general register files"
18 If missing pll rates are not changeable, due to the missing pll lock status.
19
20Each clock is assigned an identifier and client nodes can use this identifier
21to specify the clock which they consume. All available clocks are defined as
22preprocessor macros in the dt-bindings/clock/rk3228-cru.h headers and can be
23used in device tree sources. Similar macros exist for the reset sources in
24these files.
25
26External clocks:
27
28There are several clocks that are generated outside the SoC. It is expected
29that they are defined using standard clock bindings with following
30clock-output-names:
31 - "xin24m" - crystal input - required,
32 - "ext_i2s" - external I2S clock - optional,
33 - "ext_gmac" - external GMAC clock - optional
34 - "ext_hsadc" - external HSADC clock - optional
35 - "phy_50m_out" - output clock of the pll in the mac phy
36
37Example: Clock controller node:
38
39 cru: cru@20000000 {
40 compatible = "rockchip,rk3228-cru";
41 reg = <0x20000000 0x1000>;
42 rockchip,grf = <&grf>;
43
44 #clock-cells = <1>;
45 #reset-cells = <1>;
46 };
47
48Example: UART controller node that consumes the clock generated by the clock
49 controller:
50
51 uart0: serial@10110000 {
52 compatible = "snps,dw-apb-uart";
53 reg = <0x10110000 0x100>;
54 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
55 reg-shift = <2>;
56 reg-io-width = <4>;
57 clocks = <&cru SCLK_UART0>;
58 };
diff --git a/Documentation/devicetree/bindings/clock/samsung,s2mps11.txt b/Documentation/devicetree/bindings/clock/samsung,s2mps11.txt
new file mode 100644
index 000000000000..2726c1d58a79
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s2mps11.txt
@@ -0,0 +1,49 @@
1Binding for Samsung S2M and S5M family clock generator block
2============================================================
3
4This is a part of device tree bindings for S2M and S5M family multi-function
5devices.
6More information can be found in bindings/mfd/sec-core.txt file.
7
8The S2MPS11/13/15 and S5M8767 provide three(AP/CP/BT) buffered 32.768 kHz
9outputs. The S2MPS14 provides two (AP/BT) buffered 32.768 KHz outputs.
10
11To register these as clocks with common clock framework instantiate under
12main device node a sub-node named "clocks".
13
14It uses the common clock binding documented in:
15 - Documentation/devicetree/bindings/clock/clock-bindings.txt
16
17
18Required properties of the "clocks" sub-node:
19 - #clock-cells: should be 1.
20 - compatible: Should be one of: "samsung,s2mps11-clk", "samsung,s2mps13-clk",
21 "samsung,s2mps14-clk", "samsung,s5m8767-clk"
22 The S2MPS15 uses the same compatible as S2MPS13, as both provides similar
23 clocks.
24
25
26Each clock is assigned an identifier and client nodes use this identifier
27to specify the clock which they consume.
28 Clock ID Devices
29 ----------------------------------------------------------
30 32KhzAP 0 S2MPS11/13/14/15, S5M8767
31 32KhzCP 1 S2MPS11/13/15, S5M8767
32 32KhzBT 2 S2MPS11/13/14/15, S5M8767
33
34Include dt-bindings/clock/samsung,s2mps11.h file to use preprocessor defines
35in device tree sources.
36
37
38Example:
39
40 s2mps11_pmic@66 {
41 compatible = "samsung,s2mps11-pmic";
42 reg = <0x66>;
43
44 s2m_osc: clocks {
45 compatible = "samsung,s2mps11-clk";
46 #clock-cells = <1>;
47 clock-output-names = "xx", "yy", "zz";
48 };
49 };
diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt b/Documentation/devicetree/bindings/clock/sunxi.txt
index 8a47b77abfca..e59f57b24777 100644
--- a/Documentation/devicetree/bindings/clock/sunxi.txt
+++ b/Documentation/devicetree/bindings/clock/sunxi.txt
@@ -27,7 +27,9 @@ Required properties:
27 "allwinner,sun5i-a10s-ahb-gates-clk" - for the AHB gates on A10s 27 "allwinner,sun5i-a10s-ahb-gates-clk" - for the AHB gates on A10s
28 "allwinner,sun7i-a20-ahb-gates-clk" - for the AHB gates on A20 28 "allwinner,sun7i-a20-ahb-gates-clk" - for the AHB gates on A20
29 "allwinner,sun6i-a31-ar100-clk" - for the AR100 on A31 29 "allwinner,sun6i-a31-ar100-clk" - for the AR100 on A31
30 "allwinner,sun9i-a80-cpus-clk" - for the CPUS on A80
30 "allwinner,sun6i-a31-ahb1-clk" - for the AHB1 clock on A31 31 "allwinner,sun6i-a31-ahb1-clk" - for the AHB1 clock on A31
32 "allwinner,sun8i-h3-ahb2-clk" - for the AHB2 clock on H3
31 "allwinner,sun6i-a31-ahb1-gates-clk" - for the AHB1 gates on A31 33 "allwinner,sun6i-a31-ahb1-gates-clk" - for the AHB1 gates on A31
32 "allwinner,sun8i-a23-ahb1-gates-clk" - for the AHB1 gates on A23 34 "allwinner,sun8i-a23-ahb1-gates-clk" - for the AHB1 gates on A23
33 "allwinner,sun9i-a80-ahb0-gates-clk" - for the AHB0 gates on A80 35 "allwinner,sun9i-a80-ahb0-gates-clk" - for the AHB0 gates on A80
@@ -55,6 +57,9 @@ Required properties:
55 "allwinner,sun9i-a80-apb1-gates-clk" - for the APB1 gates on A80 57 "allwinner,sun9i-a80-apb1-gates-clk" - for the APB1 gates on A80
56 "allwinner,sun6i-a31-apb2-gates-clk" - for the APB2 gates on A31 58 "allwinner,sun6i-a31-apb2-gates-clk" - for the APB2 gates on A31
57 "allwinner,sun8i-a23-apb2-gates-clk" - for the APB2 gates on A23 59 "allwinner,sun8i-a23-apb2-gates-clk" - for the APB2 gates on A23
60 "allwinner,sun8i-h3-bus-gates-clk" - for the bus gates on H3
61 "allwinner,sun9i-a80-apbs-gates-clk" - for the APBS gates on A80
62 "allwinner,sun4i-a10-dram-gates-clk" - for the DRAM gates on A10
58 "allwinner,sun5i-a13-mbus-clk" - for the MBUS clock on A13 63 "allwinner,sun5i-a13-mbus-clk" - for the MBUS clock on A13
59 "allwinner,sun4i-a10-mmc-clk" - for the MMC clock 64 "allwinner,sun4i-a10-mmc-clk" - for the MMC clock
60 "allwinner,sun9i-a80-mmc-clk" - for mmc module clocks on A80 65 "allwinner,sun9i-a80-mmc-clk" - for mmc module clocks on A80
@@ -68,8 +73,10 @@ Required properties:
68 "allwinner,sun5i-a13-usb-clk" - for usb gates + resets on A13 73 "allwinner,sun5i-a13-usb-clk" - for usb gates + resets on A13
69 "allwinner,sun6i-a31-usb-clk" - for usb gates + resets on A31 74 "allwinner,sun6i-a31-usb-clk" - for usb gates + resets on A31
70 "allwinner,sun8i-a23-usb-clk" - for usb gates + resets on A23 75 "allwinner,sun8i-a23-usb-clk" - for usb gates + resets on A23
76 "allwinner,sun8i-h3-usb-clk" - for usb gates + resets on H3
71 "allwinner,sun9i-a80-usb-mod-clk" - for usb gates + resets on A80 77 "allwinner,sun9i-a80-usb-mod-clk" - for usb gates + resets on A80
72 "allwinner,sun9i-a80-usb-phy-clk" - for usb phy gates + resets on A80 78 "allwinner,sun9i-a80-usb-phy-clk" - for usb phy gates + resets on A80
79 "allwinner,sun4i-a10-ve-clk" - for the Video Engine clock
73 80
74Required properties for all clocks: 81Required properties for all clocks:
75- reg : shall be the control register address for the clock. 82- reg : shall be the control register address for the clock.
@@ -89,6 +96,9 @@ Required properties for all clocks:
89And "allwinner,*-usb-clk" clocks also require: 96And "allwinner,*-usb-clk" clocks also require:
90- reset-cells : shall be set to 1 97- reset-cells : shall be set to 1
91 98
99The "allwinner,sun4i-a10-ve-clk" clock also requires:
100- reset-cells : shall be set to 0
101
92The "allwinner,sun9i-a80-mmc-config-clk" clock also requires: 102The "allwinner,sun9i-a80-mmc-config-clk" clock also requires:
93- #reset-cells : shall be set to 1 103- #reset-cells : shall be set to 1
94- resets : shall be the reset control phandle for the mmc block. 104- resets : shall be the reset control phandle for the mmc block.
diff --git a/Documentation/devicetree/bindings/clock/tango4-clock.txt b/Documentation/devicetree/bindings/clock/tango4-clock.txt
new file mode 100644
index 000000000000..19c580a7bda2
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/tango4-clock.txt
@@ -0,0 +1,23 @@
1* Sigma Designs Tango4 Clock Generator
2
3The Tango4 clock generator outputs cpu_clk and sys_clk (the latter is used
4for RAM and various peripheral devices). The clock binding described here
5is applicable to all Tango4 SoCs.
6
7Required Properties:
8
9- compatible: should be "sigma,tango4-clkgen".
10- reg: physical base address of the device and length of memory mapped region.
11- clocks: phandle of the input clock (crystal oscillator).
12- clock-output-names: should be "cpuclk" and "sysclk".
13- #clock-cells: should be set to 1.
14
15Example:
16
17 clkgen: clkgen@10000 {
18 compatible = "sigma,tango4-clkgen";
19 reg = <0x10000 0x40>;
20 clocks = <&xtal>;
21 clock-output-names = "cpuclk", "sysclk";
22 #clock-cells = <1>;
23 };
diff --git a/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt b/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt
index 0715695e94a9..2aa06ac0fac5 100644
--- a/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt
+++ b/Documentation/devicetree/bindings/cpufreq/arm_big_little_dt.txt
@@ -12,7 +12,7 @@ must be present contiguously. Generic DT driver will check only node 'x' for
12cpu:x. 12cpu:x.
13 13
14Required properties: 14Required properties:
15- operating-points: Refer to Documentation/devicetree/bindings/power/opp.txt 15- operating-points: Refer to Documentation/devicetree/bindings/opp/opp.txt
16 for details 16 for details
17 17
18Optional properties: 18Optional properties:
diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-dt.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-dt.txt
index e41c98ffbccb..dd3929e85dec 100644
--- a/Documentation/devicetree/bindings/cpufreq/cpufreq-dt.txt
+++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-dt.txt
@@ -11,7 +11,7 @@ Required properties:
11- None 11- None
12 12
13Optional properties: 13Optional properties:
14- operating-points: Refer to Documentation/devicetree/bindings/power/opp.txt for 14- operating-points: Refer to Documentation/devicetree/bindings/opp/opp.txt for
15 details. OPPs *must* be supplied either via DT, i.e. this property, or 15 details. OPPs *must* be supplied either via DT, i.e. this property, or
16 populated at runtime. 16 populated at runtime.
17- clock-latency: Specify the possible maximum transition latency for clock, 17- clock-latency: Specify the possible maximum transition latency for clock,
diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-st.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-st.txt
new file mode 100644
index 000000000000..d91a02a3b6b0
--- /dev/null
+++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-st.txt
@@ -0,0 +1,91 @@
1Binding for ST's CPUFreq driver
2===============================
3
4ST's CPUFreq driver attempts to read 'process' and 'version' attributes
5from the SoC, then supplies the OPP framework with 'prop' and 'supported
6hardware' information respectively. The framework is then able to read
7the DT and operate in the usual way.
8
9For more information about the expected DT format [See: ../opp/opp.txt].
10
11Frequency Scaling only
12----------------------
13
14No vendor specific driver required for this.
15
16Located in CPU's node:
17
18- operating-points : [See: ../power/opp.txt]
19
20Example [safe]
21--------------
22
23cpus {
24 cpu@0 {
25 /* kHz uV */
26 operating-points = <1500000 0
27 1200000 0
28 800000 0
29 500000 0>;
30 };
31};
32
33Dynamic Voltage and Frequency Scaling (DVFS)
34--------------------------------------------
35
36This requires the ST CPUFreq driver to supply 'process' and 'version' info.
37
38Located in CPU's node:
39
40- operating-points-v2 : [See ../power/opp.txt]
41
42Example [unsafe]
43----------------
44
45cpus {
46 cpu@0 {
47 operating-points-v2 = <&cpu0_opp_table>;
48 };
49};
50
51cpu0_opp_table: opp_table {
52 compatible = "operating-points-v2";
53
54 /* ############################################################### */
55 /* # WARNING: Do not attempt to copy/replicate these nodes, # */
56 /* # they are only to be supplied by the bootloader !!! # */
57 /* ############################################################### */
58 opp0 {
59 /* Major Minor Substrate */
60 /* 2 all all */
61 opp-supported-hw = <0x00000004 0xffffffff 0xffffffff>;
62 opp-hz = /bits/ 64 <1500000000>;
63 clock-latency-ns = <10000000>;
64
65 opp-microvolt-pcode0 = <1200000>;
66 opp-microvolt-pcode1 = <1200000>;
67 opp-microvolt-pcode2 = <1200000>;
68 opp-microvolt-pcode3 = <1200000>;
69 opp-microvolt-pcode4 = <1170000>;
70 opp-microvolt-pcode5 = <1140000>;
71 opp-microvolt-pcode6 = <1100000>;
72 opp-microvolt-pcode7 = <1070000>;
73 };
74
75 opp1 {
76 /* Major Minor Substrate */
77 /* all all all */
78 opp-supported-hw = <0xffffffff 0xffffffff 0xffffffff>;
79 opp-hz = /bits/ 64 <1200000000>;
80 clock-latency-ns = <10000000>;
81
82 opp-microvolt-pcode0 = <1110000>;
83 opp-microvolt-pcode1 = <1150000>;
84 opp-microvolt-pcode2 = <1100000>;
85 opp-microvolt-pcode3 = <1080000>;
86 opp-microvolt-pcode4 = <1040000>;
87 opp-microvolt-pcode5 = <1020000>;
88 opp-microvolt-pcode6 = <980000>;
89 opp-microvolt-pcode7 = <930000>;
90 };
91};
diff --git a/Documentation/devicetree/bindings/crypto/rockchip-crypto.txt b/Documentation/devicetree/bindings/crypto/rockchip-crypto.txt
new file mode 100644
index 000000000000..096df34b11c1
--- /dev/null
+++ b/Documentation/devicetree/bindings/crypto/rockchip-crypto.txt
@@ -0,0 +1,29 @@
1Rockchip Electronics And Security Accelerator
2
3Required properties:
4- compatible: Should be "rockchip,rk3288-crypto"
5- reg: Base physical address of the engine and length of memory mapped
6 region
7- interrupts: Interrupt number
8- clocks: Reference to the clocks about crypto
9- clock-names: "aclk" used to clock data
10 "hclk" used to clock data
11 "sclk" used to clock crypto accelerator
12 "apb_pclk" used to clock dma
13- resets: Must contain an entry for each entry in reset-names.
14 See ../reset/reset.txt for details.
15- reset-names: Must include the name "crypto-rst".
16
17Examples:
18
19 crypto: cypto-controller@ff8a0000 {
20 compatible = "rockchip,rk3288-crypto";
21 reg = <0xff8a0000 0x4000>;
22 interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
23 clocks = <&cru ACLK_CRYPTO>, <&cru HCLK_CRYPTO>,
24 <&cru SCLK_CRYPTO>, <&cru ACLK_DMAC1>;
25 clock-names = "aclk", "hclk", "sclk", "apb_pclk";
26 resets = <&cru SRST_CRYPTO>;
27 reset-names = "crypto-rst";
28 status = "okay";
29 };
diff --git a/Documentation/devicetree/bindings/display/bridge/tda998x.txt b/Documentation/devicetree/bindings/display/bridge/tda998x.txt
index e9e4bce40760..e178e6b9f9ee 100644
--- a/Documentation/devicetree/bindings/display/bridge/tda998x.txt
+++ b/Documentation/devicetree/bindings/display/bridge/tda998x.txt
@@ -5,6 +5,10 @@ Required properties;
5 5
6 - reg: I2C address 6 - reg: I2C address
7 7
8Required node:
9 - port: Input port node with endpoint definition, as described
10 in Documentation/devicetree/bindings/graph.txt
11
8Optional properties: 12Optional properties:
9 - interrupts: interrupt number and trigger type 13 - interrupts: interrupt number and trigger type
10 default: polling 14 default: polling
diff --git a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt b/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
new file mode 100644
index 000000000000..ed5e0a7894ad
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
@@ -0,0 +1,54 @@
1Etnaviv DRM master device
2=========================
3
4The Etnaviv DRM master device is a virtual device needed to list all
5Vivante GPU cores that comprise the GPU subsystem.
6
7Required properties:
8- compatible: Should be one of
9 "fsl,imx-gpu-subsystem"
10 "marvell,dove-gpu-subsystem"
11- cores: Should contain a list of phandles pointing to Vivante GPU devices
12
13example:
14
15gpu-subsystem {
16 compatible = "fsl,imx-gpu-subsystem";
17 cores = <&gpu_2d>, <&gpu_3d>;
18};
19
20
21Vivante GPU core devices
22========================
23
24Required properties:
25- compatible: Should be "vivante,gc"
26 A more specific compatible is not needed, as the cores contain chip
27 identification registers at fixed locations, which provide all the
28 necessary information to the driver.
29- reg: should be register base and length as documented in the
30 datasheet
31- interrupts: Should contain the cores interrupt line
32- clocks: should contain one clock for entry in clock-names
33 see Documentation/devicetree/bindings/clock/clock-bindings.txt
34- clock-names:
35 - "bus": AXI/register clock
36 - "core": GPU core clock
37 - "shader": Shader clock (only required if GPU has feature PIPE_3D)
38
39Optional properties:
40- power-domains: a power domain consumer specifier according to
41 Documentation/devicetree/bindings/power/power_domain.txt
42
43example:
44
45gpu_3d: gpu@00130000 {
46 compatible = "vivante,gc";
47 reg = <0x00130000 0x4000>;
48 interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
49 clocks = <&clks IMX6QDL_CLK_GPU3D_AXI>,
50 <&clks IMX6QDL_CLK_GPU3D_CORE>,
51 <&clks IMX6QDL_CLK_GPU3D_SHADER>;
52 clock-names = "bus", "core", "shader";
53 power-domains = <&gpc 1>;
54};
diff --git a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
index 64693f2ebc51..fe4a7a2dea9c 100644
--- a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
+++ b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
@@ -1,3 +1,20 @@
1Device-Tree bindings for Samsung Exynos Embedded DisplayPort Transmitter(eDP)
2
3DisplayPort is industry standard to accommodate the growing board adoption
4of digital display technology within the PC and CE industries.
5It consolidates the internal and external connection methods to reduce device
6complexity and cost. It also supports necessary features for important cross
7industry applications and provides performance scalability to enable the next
8generation of displays that feature higher color depths, refresh rates, and
9display resolutions.
10
11eDP (embedded display port) device is compliant with Embedded DisplayPort
12standard as follows,
13- DisplayPort standard 1.1a for Exynos5250 and Exynos5260.
14- DisplayPort standard 1.3 for Exynos5422s and Exynos5800.
15
16eDP resides between FIMD and panel or FIMD and bridge such as LVDS.
17
1The Exynos display port interface should be configured based on 18The Exynos display port interface should be configured based on
2the type of panel connected to it. 19the type of panel connected to it.
3 20
@@ -66,8 +83,15 @@ Optional properties for dp-controller:
66 Hotplug detect GPIO. 83 Hotplug detect GPIO.
67 Indicates which GPIO should be used for hotplug 84 Indicates which GPIO should be used for hotplug
68 detection 85 detection
69 -video interfaces: Device node can contain video interface port 86Video interfaces:
70 nodes according to [1]. 87 Device node can contain video interface port nodes according to [1].
88 The following are properties specific to those nodes:
89
90 endpoint node connected to bridge or panel node:
91 - remote-endpoint: specifies the endpoint in panel or bridge node.
92 This node is required in all kinds of exynos dp
93 to represent the connection between dp and bridge
94 or dp and panel.
71 95
72[1]: Documentation/devicetree/bindings/media/video-interfaces.txt 96[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
73 97
@@ -111,9 +135,18 @@ Board Specific portion:
111 }; 135 };
112 136
113 ports { 137 ports {
114 port@0 { 138 port {
115 dp_out: endpoint { 139 dp_out: endpoint {
116 remote-endpoint = <&bridge_in>; 140 remote-endpoint = <&dp_in>;
141 };
142 };
143 };
144
145 panel {
146 ...
147 port {
148 dp_in: endpoint {
149 remote-endpoint = <&dp_out>;
117 }; 150 };
118 }; 151 };
119 }; 152 };
diff --git a/Documentation/devicetree/bindings/display/exynos/exynos_hdmi.txt b/Documentation/devicetree/bindings/display/exynos/exynos_hdmi.txt
index 1fd8cf9cbfac..d474f59be6d6 100644
--- a/Documentation/devicetree/bindings/display/exynos/exynos_hdmi.txt
+++ b/Documentation/devicetree/bindings/display/exynos/exynos_hdmi.txt
@@ -2,10 +2,9 @@ Device-Tree bindings for drm hdmi driver
2 2
3Required properties: 3Required properties:
4- compatible: value should be one among the following: 4- compatible: value should be one among the following:
5 1) "samsung,exynos5-hdmi" <DEPRECATED> 5 1) "samsung,exynos4210-hdmi"
6 2) "samsung,exynos4210-hdmi" 6 2) "samsung,exynos4212-hdmi"
7 3) "samsung,exynos4212-hdmi" 7 3) "samsung,exynos5420-hdmi"
8 4) "samsung,exynos5420-hdmi"
9- reg: physical base address of the hdmi and length of memory mapped 8- reg: physical base address of the hdmi and length of memory mapped
10 region. 9 region.
11- interrupts: interrupt number to the cpu. 10- interrupts: interrupt number to the cpu.
diff --git a/Documentation/devicetree/bindings/display/msm/dsi.txt b/Documentation/devicetree/bindings/display/msm/dsi.txt
index f344b9e49198..e7423bea1424 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi.txt
+++ b/Documentation/devicetree/bindings/display/msm/dsi.txt
@@ -14,17 +14,20 @@ Required properties:
14- clocks: device clocks 14- clocks: device clocks
15 See Documentation/devicetree/bindings/clocks/clock-bindings.txt for details. 15 See Documentation/devicetree/bindings/clocks/clock-bindings.txt for details.
16- clock-names: the following clocks are required: 16- clock-names: the following clocks are required:
17 * "mdp_core_clk"
18 * "iface_clk"
17 * "bus_clk" 19 * "bus_clk"
18 * "byte_clk"
19 * "core_clk"
20 * "core_mmss_clk" 20 * "core_mmss_clk"
21 * "iface_clk" 21 * "byte_clk"
22 * "mdp_core_clk"
23 * "pixel_clk" 22 * "pixel_clk"
23 * "core_clk"
24 For DSIv2, we need an additional clock:
25 * "src_clk"
24- vdd-supply: phandle to vdd regulator device node 26- vdd-supply: phandle to vdd regulator device node
25- vddio-supply: phandle to vdd-io regulator device node 27- vddio-supply: phandle to vdd-io regulator device node
26- vdda-supply: phandle to vdda regulator device node 28- vdda-supply: phandle to vdda regulator device node
27- qcom,dsi-phy: phandle to DSI PHY device node 29- qcom,dsi-phy: phandle to DSI PHY device node
30- syscon-sfpb: A phandle to mmss_sfpb syscon node (only for DSIv2)
28 31
29Optional properties: 32Optional properties:
30- panel@0: Node of panel connected to this DSI controller. 33- panel@0: Node of panel connected to this DSI controller.
@@ -51,6 +54,7 @@ Required properties:
51 * "qcom,dsi-phy-28nm-hpm" 54 * "qcom,dsi-phy-28nm-hpm"
52 * "qcom,dsi-phy-28nm-lp" 55 * "qcom,dsi-phy-28nm-lp"
53 * "qcom,dsi-phy-20nm" 56 * "qcom,dsi-phy-20nm"
57 * "qcom,dsi-phy-28nm-8960"
54- reg: Physical base address and length of the registers of PLL, PHY and PHY 58- reg: Physical base address and length of the registers of PLL, PHY and PHY
55 regulator 59 regulator
56- reg-names: The names of register regions. The following regions are required: 60- reg-names: The names of register regions. The following regions are required:
diff --git a/Documentation/devicetree/bindings/display/msm/mdp.txt b/Documentation/devicetree/bindings/display/msm/mdp.txt
index 0833edaba4c3..a214f6cd0363 100644
--- a/Documentation/devicetree/bindings/display/msm/mdp.txt
+++ b/Documentation/devicetree/bindings/display/msm/mdp.txt
@@ -2,18 +2,28 @@ Qualcomm adreno/snapdragon display controller
2 2
3Required properties: 3Required properties:
4- compatible: 4- compatible:
5 * "qcom,mdp" - mdp4 5 * "qcom,mdp4" - mdp4
6 * "qcom,mdp5" - mdp5
6- reg: Physical base address and length of the controller's registers. 7- reg: Physical base address and length of the controller's registers.
7- interrupts: The interrupt signal from the display controller. 8- interrupts: The interrupt signal from the display controller.
8- connectors: array of phandles for output device(s) 9- connectors: array of phandles for output device(s)
9- clocks: device clocks 10- clocks: device clocks
10 See ../clocks/clock-bindings.txt for details. 11 See ../clocks/clock-bindings.txt for details.
11- clock-names: the following clocks are required: 12- clock-names: the following clocks are required.
12 * "core_clk" 13 For MDP4:
13 * "iface_clk" 14 * "core_clk"
14 * "src_clk" 15 * "iface_clk"
15 * "hdmi_clk" 16 * "lut_clk"
16 * "mpd_clk" 17 * "src_clk"
18 * "hdmi_clk"
19 * "mdp_clk"
20 For MDP5:
21 * "bus_clk"
22 * "iface_clk"
23 * "core_clk_src"
24 * "core_clk"
25 * "lut_clk" (some MDP5 versions may not need this)
26 * "vsync_clk"
17 27
18Optional properties: 28Optional properties:
19- gpus: phandle for gpu device 29- gpus: phandle for gpu device
@@ -26,7 +36,7 @@ Example:
26 ... 36 ...
27 37
28 mdp: qcom,mdp@5100000 { 38 mdp: qcom,mdp@5100000 {
29 compatible = "qcom,mdp"; 39 compatible = "qcom,mdp4";
30 reg = <0x05100000 0xf0000>; 40 reg = <0x05100000 0xf0000>;
31 interrupts = <GIC_SPI 75 0>; 41 interrupts = <GIC_SPI 75 0>;
32 connectors = <&hdmi>; 42 connectors = <&hdmi>;
diff --git a/Documentation/devicetree/bindings/display/panel/boe,tv080wum-nl0.txt b/Documentation/devicetree/bindings/display/panel/boe,tv080wum-nl0.txt
new file mode 100644
index 000000000000..50be5e2438b2
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/boe,tv080wum-nl0.txt
@@ -0,0 +1,7 @@
1Boe Corporation 8.0" WUXGA TFT LCD panel
2
3Required properties:
4- compatible: should be "boe,tv080wum-nl0"
5
6This binding is compatible with the simple-panel binding, which is specified
7in simple-panel.txt in this directory.
diff --git a/Documentation/devicetree/bindings/display/panel/innolux,g121x1-l03.txt b/Documentation/devicetree/bindings/display/panel/innolux,g121x1-l03.txt
new file mode 100644
index 000000000000..649744620ae1
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/innolux,g121x1-l03.txt
@@ -0,0 +1,7 @@
1Innolux Corporation 12.1" G121X1-L03 XGA (1024x768) TFT LCD panel
2
3Required properties:
4- compatible: should be "innolux,g121x1-l03"
5
6This binding is compatible with the simple-panel binding, which is specified
7in simple-panel.txt in this directory.
diff --git a/Documentation/devicetree/bindings/display/panel/kyo,tcg121xglp.txt b/Documentation/devicetree/bindings/display/panel/kyo,tcg121xglp.txt
new file mode 100644
index 000000000000..a8e940fe731e
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/kyo,tcg121xglp.txt
@@ -0,0 +1,7 @@
1Kyocera Corporation 12.1" XGA (1024x768) TFT LCD panel
2
3Required properties:
4- compatible: should be "kyo,tcg121xglp"
5
6This binding is compatible with the simple-panel binding, which is specified
7in simple-panel.txt in this directory.
diff --git a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt b/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
new file mode 100644
index 000000000000..37dedf6a6702
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
@@ -0,0 +1,20 @@
1Panasonic 10" WUXGA TFT LCD panel
2
3Required properties:
4- compatible: should be "panasonic,vvx10f034n00"
5- reg: DSI virtual channel of the peripheral
6- power-supply: phandle of the regulator that provides the supply voltage
7
8Optional properties:
9- backlight: phandle of the backlight device attached to the panel
10
11Example:
12
13 mdss_dsi@fd922800 {
14 panel@0 {
15 compatible = "panasonic,vvx10f034n00";
16 reg = <0>;
17 power-supply = <&vreg_vsp>;
18 backlight = <&lp8566_wled>;
19 };
20 };
diff --git a/Documentation/devicetree/bindings/display/panel/qiaodian,qd43003c0-40.txt b/Documentation/devicetree/bindings/display/panel/qiaodian,qd43003c0-40.txt
new file mode 100644
index 000000000000..0fbdab89ac3d
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/qiaodian,qd43003c0-40.txt
@@ -0,0 +1,7 @@
1QiaoDian XianShi Corporation 4"3 TFT LCD panel
2
3Required properties:
4- compatible: should be "qiaodian,qd43003c0-40"
5
6This binding is compatible with the simple-panel binding, which is specified
7in simple-panel.txt in this directory.
diff --git a/Documentation/devicetree/bindings/display/panel/sharp,ls043t1le01.txt b/Documentation/devicetree/bindings/display/panel/sharp,ls043t1le01.txt
new file mode 100644
index 000000000000..3770a111968b
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/sharp,ls043t1le01.txt
@@ -0,0 +1,22 @@
1Sharp Microelectronics 4.3" qHD TFT LCD panel
2
3Required properties:
4- compatible: should be "sharp,ls043t1le01-qhd"
5- reg: DSI virtual channel of the peripheral
6- power-supply: phandle of the regulator that provides the supply voltage
7
8Optional properties:
9- backlight: phandle of the backlight device attached to the panel
10- reset-gpios: a GPIO spec for the reset pin
11
12Example:
13
14 mdss_dsi@fd922800 {
15 panel@0 {
16 compatible = "sharp,ls043t1le01-qhd";
17 reg = <0>;
18 avdd-supply = <&pm8941_l22>;
19 backlight = <&pm8941_wled>;
20 reset-gpios = <&pm8941_gpios 19 GPIO_ACTIVE_HIGH>;
21 };
22 };
diff --git a/Documentation/devicetree/bindings/display/panel/startek,startek-kd050c.txt b/Documentation/devicetree/bindings/display/panel/startek,startek-kd050c.txt
new file mode 100644
index 000000000000..70cd8d18d841
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/startek,startek-kd050c.txt
@@ -0,0 +1,4 @@
1Startek Electronic Technology Co. KD050C 5.0" WVGA TFT LCD panel
2
3Required properties:
4- compatible: should be "startek,startek-kd050c"
diff --git a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
new file mode 100644
index 000000000000..1753f0cc6fad
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
@@ -0,0 +1,60 @@
1Rockchip specific extensions to the Synopsys Designware MIPI DSI
2================================
3
4Required properties:
5- #address-cells: Should be <1>.
6- #size-cells: Should be <0>.
7- compatible: "rockchip,rk3288-mipi-dsi", "snps,dw-mipi-dsi".
8- reg: Represent the physical address range of the controller.
9- interrupts: Represent the controller's interrupt to the CPU(s).
10- clocks, clock-names: Phandles to the controller's pll reference
11 clock(ref) and APB clock(pclk), as described in [1].
12- rockchip,grf: this soc should set GRF regs to mux vopl/vopb.
13- ports: contain a port node with endpoint definitions as defined in [2].
14 For vopb,set the reg = <0> and set the reg = <1> for vopl.
15
16[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
17[2] Documentation/devicetree/bindings/media/video-interfaces.txt
18
19Example:
20 mipi_dsi: mipi@ff960000 {
21 #address-cells = <1>;
22 #size-cells = <0>;
23 compatible = "rockchip,rk3288-mipi-dsi", "snps,dw-mipi-dsi";
24 reg = <0xff960000 0x4000>;
25 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
26 clocks = <&cru SCLK_MIPI_24M>, <&cru PCLK_MIPI_DSI0>;
27 clock-names = "ref", "pclk";
28 rockchip,grf = <&grf>;
29 status = "okay";
30
31 ports {
32 #address-cells = <1>;
33 #size-cells = <0>;
34 reg = <1>;
35
36 mipi_in: port {
37 #address-cells = <1>;
38 #size-cells = <0>;
39 mipi_in_vopb: endpoint@0 {
40 reg = <0>;
41 remote-endpoint = <&vopb_out_mipi>;
42 };
43 mipi_in_vopl: endpoint@1 {
44 reg = <1>;
45 remote-endpoint = <&vopl_out_mipi>;
46 };
47 };
48 };
49
50 panel {
51 compatible ="boe,tv080wum-nl0";
52 reg = <0>;
53
54 enable-gpios = <&gpio7 3 GPIO_ACTIVE_HIGH>;
55 pinctrl-names = "default";
56 pinctrl-0 = <&lcd_en>;
57 backlight = <&backlight>;
58 status = "okay";
59 };
60 };
diff --git a/Documentation/devicetree/bindings/display/rockchip/rockchip-vop.txt b/Documentation/devicetree/bindings/display/rockchip/rockchip-vop.txt
index d15351f2313d..5489b59e3d41 100644
--- a/Documentation/devicetree/bindings/display/rockchip/rockchip-vop.txt
+++ b/Documentation/devicetree/bindings/display/rockchip/rockchip-vop.txt
@@ -7,6 +7,7 @@ buffer to an external LCD interface.
7Required properties: 7Required properties:
8- compatible: value should be one of the following 8- compatible: value should be one of the following
9 "rockchip,rk3288-vop"; 9 "rockchip,rk3288-vop";
10 "rockchip,rk3036-vop";
10 11
11- interrupts: should contain a list of all VOP IP block interrupts in the 12- interrupts: should contain a list of all VOP IP block interrupts in the
12 order: VSYNC, LCD_SYSTEM. The interrupt specifier 13 order: VSYNC, LCD_SYSTEM. The interrupt specifier
diff --git a/Documentation/devicetree/bindings/display/simple-framebuffer.txt b/Documentation/devicetree/bindings/display/simple-framebuffer.txt
index 4474ef6e0b95..8c9e9f515c87 100644
--- a/Documentation/devicetree/bindings/display/simple-framebuffer.txt
+++ b/Documentation/devicetree/bindings/display/simple-framebuffer.txt
@@ -47,10 +47,14 @@ Required properties:
47 - a8b8g8r8 (32-bit pixels, d[31:24]=a, d[23:16]=b, d[15:8]=g, d[7:0]=r). 47 - a8b8g8r8 (32-bit pixels, d[31:24]=a, d[23:16]=b, d[15:8]=g, d[7:0]=r).
48 48
49Optional properties: 49Optional properties:
50- clocks : List of clocks used by the framebuffer. Clocks listed here 50- clocks : List of clocks used by the framebuffer.
51 are expected to already be configured correctly. The OS must 51- *-supply : Any number of regulators used by the framebuffer. These should
52 ensure these clocks are not modified or disabled while the 52 be named according to the names in the device's design.
53 simple framebuffer remains active. 53
54 The above resources are expected to already be configured correctly.
55 The OS must ensure they are not modified or disabled while the simple
56 framebuffer remains active.
57
54- display : phandle pointing to the primary display hardware node 58- display : phandle pointing to the primary display hardware node
55 59
56Example: 60Example:
@@ -68,6 +72,7 @@ chosen {
68 stride = <(1600 * 2)>; 72 stride = <(1600 * 2)>;
69 format = "r5g6b5"; 73 format = "r5g6b5";
70 clocks = <&ahb_gates 36>, <&ahb_gates 43>, <&ahb_gates 44>; 74 clocks = <&ahb_gates 36>, <&ahb_gates 43>, <&ahb_gates 44>;
75 lcd-supply = <&reg_dc1sw>;
71 display = <&lcdc0>; 76 display = <&lcdc0>;
72 }; 77 };
73 stdout-path = "display0"; 78 stdout-path = "display0";
diff --git a/Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt b/Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt
index 09daeef1ff22..5b902ac8d97e 100644
--- a/Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt
+++ b/Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt
@@ -14,7 +14,14 @@ not described in these device tree bindings.
14 14
15Required Properties: 15Required Properties:
16 16
17- compatible: must contain "renesas,rcar-dmac" 17- compatible: "renesas,dmac-<soctype>", "renesas,rcar-dmac" as fallback.
18 Examples with soctypes are:
19 - "renesas,dmac-r8a7790" (R-Car H2)
20 - "renesas,dmac-r8a7791" (R-Car M2-W)
21 - "renesas,dmac-r8a7792" (R-Car V2H)
22 - "renesas,dmac-r8a7793" (R-Car M2-N)
23 - "renesas,dmac-r8a7794" (R-Car E2)
24 - "renesas,dmac-r8a7795" (R-Car H3)
18 25
19- reg: base address and length of the registers block for the DMAC 26- reg: base address and length of the registers block for the DMAC
20 27
@@ -35,7 +42,7 @@ Required Properties:
35Example: R8A7790 (R-Car H2) SYS-DMACs 42Example: R8A7790 (R-Car H2) SYS-DMACs
36 43
37 dmac0: dma-controller@e6700000 { 44 dmac0: dma-controller@e6700000 {
38 compatible = "renesas,rcar-dmac"; 45 compatible = "renesas,dmac-r8a7790", "renesas,rcar-dmac";
39 reg = <0 0xe6700000 0 0x20000>; 46 reg = <0 0xe6700000 0 0x20000>;
40 interrupts = <0 197 IRQ_TYPE_LEVEL_HIGH 47 interrupts = <0 197 IRQ_TYPE_LEVEL_HIGH
41 0 200 IRQ_TYPE_LEVEL_HIGH 48 0 200 IRQ_TYPE_LEVEL_HIGH
@@ -65,7 +72,7 @@ Example: R8A7790 (R-Car H2) SYS-DMACs
65 }; 72 };
66 73
67 dmac1: dma-controller@e6720000 { 74 dmac1: dma-controller@e6720000 {
68 compatible = "renesas,rcar-dmac"; 75 compatible = "renesas,dmac-r8a7790", "renesas,rcar-dmac";
69 reg = <0 0xe6720000 0 0x20000>; 76 reg = <0 0xe6720000 0 0x20000>;
70 interrupts = <0 220 IRQ_TYPE_LEVEL_HIGH 77 interrupts = <0 220 IRQ_TYPE_LEVEL_HIGH
71 0 216 IRQ_TYPE_LEVEL_HIGH 78 0 216 IRQ_TYPE_LEVEL_HIGH
diff --git a/Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt b/Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt
index 040f365954cc..e7780a186a36 100644
--- a/Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt
+++ b/Documentation/devicetree/bindings/dma/renesas,usb-dmac.txt
@@ -1,7 +1,13 @@
1* Renesas USB DMA Controller Device Tree bindings 1* Renesas USB DMA Controller Device Tree bindings
2 2
3Required Properties: 3Required Properties:
4- compatible: must contain "renesas,usb-dmac" 4-compatible: "renesas,<soctype>-usb-dmac", "renesas,usb-dmac" as fallback.
5 Examples with soctypes are:
6 - "renesas,r8a7790-usb-dmac" (R-Car H2)
7 - "renesas,r8a7791-usb-dmac" (R-Car M2-W)
8 - "renesas,r8a7793-usb-dmac" (R-Car M2-N)
9 - "renesas,r8a7794-usb-dmac" (R-Car E2)
10 - "renesas,r8a7795-usb-dmac" (R-Car H3)
5- reg: base address and length of the registers block for the DMAC 11- reg: base address and length of the registers block for the DMAC
6- interrupts: interrupt specifiers for the DMAC, one for each entry in 12- interrupts: interrupt specifiers for the DMAC, one for each entry in
7 interrupt-names. 13 interrupt-names.
@@ -15,7 +21,7 @@ Required Properties:
15Example: R8A7790 (R-Car H2) USB-DMACs 21Example: R8A7790 (R-Car H2) USB-DMACs
16 22
17 usb_dmac0: dma-controller@e65a0000 { 23 usb_dmac0: dma-controller@e65a0000 {
18 compatible = "renesas,usb-dmac"; 24 compatible = "renesas,r8a7790-usb-dmac", "renesas,usb-dmac";
19 reg = <0 0xe65a0000 0 0x100>; 25 reg = <0 0xe65a0000 0 0x100>;
20 interrupts = <0 109 IRQ_TYPE_LEVEL_HIGH 26 interrupts = <0 109 IRQ_TYPE_LEVEL_HIGH
21 0 109 IRQ_TYPE_LEVEL_HIGH>; 27 0 109 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/Documentation/devicetree/bindings/dma/stm32-dma.txt b/Documentation/devicetree/bindings/dma/stm32-dma.txt
new file mode 100644
index 000000000000..70cd13f1588a
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/stm32-dma.txt
@@ -0,0 +1,82 @@
1* STMicroelectronics STM32 DMA controller
2
3The STM32 DMA is a general-purpose direct memory access controller capable of
4supporting 8 independent DMA channels. Each channel can have up to 8 requests.
5
6Required properties:
7- compatible: Should be "st,stm32-dma"
8- reg: Should contain DMA registers location and length. This should include
9 all of the per-channel registers.
10- interrupts: Should contain all of the per-channel DMA interrupts in
11 ascending order with respect to the DMA channel index.
12- clocks: Should contain the input clock of the DMA instance.
13- #dma-cells : Must be <4>. See DMA client paragraph for more details.
14
15Optional properties:
16- resets: Reference to a reset controller asserting the DMA controller
17- st,mem2mem: boolean; if defined, it indicates that the controller supports
18 memory-to-memory transfer
19
20Example:
21
22 dma2: dma-controller@40026400 {
23 compatible = "st,stm32-dma";
24 reg = <0x40026400 0x400>;
25 interrupts = <56>,
26 <57>,
27 <58>,
28 <59>,
29 <60>,
30 <68>,
31 <69>,
32 <70>;
33 clocks = <&clk_hclk>;
34 #dma-cells = <4>;
35 st,mem2mem;
36 resets = <&rcc 150>;
37 };
38
39* DMA client
40
41DMA clients connected to the STM32 DMA controller must use the format
42described in the dma.txt file, using a five-cell specifier for each
43channel: a phandle plus four integer cells.
44The four cells in order are:
45
461. The channel id
472. The request line number
483. A 32bit mask specifying the DMA channel configuration which are device
49 dependent:
50 -bit 9: Peripheral Increment Address
51 0x0: no address increment between transfers
52 0x1: increment address between transfers
53 -bit 10: Memory Increment Address
54 0x0: no address increment between transfers
55 0x1: increment address between transfers
56 -bit 15: Peripheral Increment Offset Size
57 0x0: offset size is linked to the peripheral bus width
58 0x1: offset size is fixed to 4 (32-bit alignment)
59 -bit 16-17: Priority level
60 0x0: low
61 0x1: medium
62 0x2: high
63 0x3: very high
645. A 32bit mask specifying the DMA FIFO threshold configuration which are device
65 dependent:
66 -bit 0-1: Fifo threshold
67 0x0: 1/4 full FIFO
68 0x1: 1/2 full FIFO
69 0x2: 3/4 full FIFO
70 0x3: full FIFO
71
72Example:
73
74 usart1: serial@40011000 {
75 compatible = "st,stm32-usart", "st,stm32-uart";
76 reg = <0x40011000 0x400>;
77 interrupts = <37>;
78 clocks = <&clk_pclk2>;
79 dmas = <&dma2 2 4 0x10400 0x3>,
80 <&dma2 7 5 0x10200 0x3>;
81 dma-names = "rx", "tx";
82 };
diff --git a/Documentation/devicetree/bindings/dma/ti-dma-crossbar.txt b/Documentation/devicetree/bindings/dma/ti-dma-crossbar.txt
index b152a75dceae..aead5869a28d 100644
--- a/Documentation/devicetree/bindings/dma/ti-dma-crossbar.txt
+++ b/Documentation/devicetree/bindings/dma/ti-dma-crossbar.txt
@@ -14,6 +14,10 @@ The DMA controller node need to have the following poroperties:
14 14
15Optional properties: 15Optional properties:
16- ti,dma-safe-map: Safe routing value for unused request lines 16- ti,dma-safe-map: Safe routing value for unused request lines
17- ti,reserved-dma-request-ranges: DMA request ranges which should not be used
18 when mapping xbar input to DMA request, they are either
19 allocated to be used by for example the DSP or they are used as
20 memcpy channels in eDMA.
17 21
18Notes: 22Notes:
19When requesting channel via ti,dra7-dma-crossbar, the DMA clinet must request 23When requesting channel via ti,dra7-dma-crossbar, the DMA clinet must request
@@ -46,6 +50,8 @@ sdma_xbar: dma-router@4a002b78 {
46 #dma-cells = <1>; 50 #dma-cells = <1>;
47 dma-requests = <205>; 51 dma-requests = <205>;
48 ti,dma-safe-map = <0>; 52 ti,dma-safe-map = <0>;
53 /* Protect the sDMA request ranges: 10-14 and 100-126 */
54 ti,reserved-dma-request-ranges = <10 5>, <100 27>;
49 dma-masters = <&sdma>; 55 dma-masters = <&sdma>;
50}; 56};
51 57
diff --git a/Documentation/devicetree/bindings/eeprom/eeprom.txt b/Documentation/devicetree/bindings/eeprom/eeprom.txt
index 4342c10de1bf..735bc94444bb 100644
--- a/Documentation/devicetree/bindings/eeprom/eeprom.txt
+++ b/Documentation/devicetree/bindings/eeprom/eeprom.txt
@@ -2,11 +2,22 @@ EEPROMs (I2C)
2 2
3Required properties: 3Required properties:
4 4
5 - compatible : should be "<manufacturer>,<type>" 5 - compatible : should be "<manufacturer>,<type>", like these:
6 If there is no specific driver for <manufacturer>, a generic 6
7 driver based on <type> is selected. Possible types are: 7 "atmel,24c00", "atmel,24c01", "atmel,24c02", "atmel,24c04",
8 24c00, 24c01, 24c02, 24c04, 24c08, 24c16, 24c32, 24c64, 8 "atmel,24c08", "atmel,24c16", "atmel,24c32", "atmel,24c64",
9 24c128, 24c256, 24c512, 24c1024, spd 9 "atmel,24c128", "atmel,24c256", "atmel,24c512", "atmel,24c1024"
10
11 "catalyst,24c32"
12
13 "ramtron,24c64"
14
15 "renesas,r1ex24002"
16
17 If there is no specific driver for <manufacturer>, a generic
18 driver based on <type> is selected. Possible types are:
19 "24c00", "24c01", "24c02", "24c04", "24c08", "24c16", "24c32", "24c64",
20 "24c128", "24c256", "24c512", "24c1024", "spd"
10 21
11 - reg : the I2C address of the EEPROM 22 - reg : the I2C address of the EEPROM
12 23
diff --git a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
index e1705fae63a8..e27341f8a4c7 100644
--- a/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
+++ b/Documentation/devicetree/bindings/extcon/extcon-arizona.txt
@@ -13,3 +13,63 @@ Optional properties:
13 ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR 13 ARIZONA_ACCDET_MODE_HPR or 2 - Headphone detect mode is set to HPDETR
14 If this node is not mentioned or if the value is unknown, then 14 If this node is not mentioned or if the value is unknown, then
15 headphone detection mode is set to HPDETL. 15 headphone detection mode is set to HPDETL.
16
17 - wlf,use-jd2 : Use the additional JD input along with JD1 for dual pin jack
18 detection.
19 - wlf,use-jd2-nopull : Internal pull on JD2 is disabled when used for
20 jack detection.
21 - wlf,jd-invert : Invert the polarity of the jack detection switch
22
23 - wlf,micd-software-compare : Use a software comparison to determine mic
24 presence
25 - wlf,micd-detect-debounce : Additional software microphone detection
26 debounce specified in milliseconds.
27 - wlf,micd-pol-gpio : GPIO specifier for the GPIO controlling the headset
28 polarity if one exists.
29 - wlf,micd-bias-start-time : Time allowed for MICBIAS to startup prior to
30 performing microphone detection, specified as per the ARIZONA_MICD_TIME_XXX
31 defines.
32 - wlf,micd-rate : Delay between successive microphone detection measurements,
33 specified as per the ARIZONA_MICD_TIME_XXX defines.
34 - wlf,micd-dbtime : Microphone detection hardware debounces specified as the
35 number of measurements to take, valid values being 2 and 4.
36 - wlf,micd-timeout-ms : Timeout for microphone detection, specified in
37 milliseconds.
38 - wlf,micd-force-micbias : Force MICBIAS continuously on during microphone
39 detection.
40 - wlf,micd-configs : Headset polarity configurations (generally used for
41 detection of CTIA / OMTP headsets), the field can be of variable length
42 but should always be a multiple of 3 cells long, each three cell group
43 represents one polarity configuration.
44 The first cell defines the accessory detection pin, zero will use MICDET1
45 and all other values will use MICDET2.
46 The second cell represents the MICBIAS to be used.
47 The third cell represents the value of the micd-pol-gpio pin.
48
49 - wlf,gpsw : Settings for the general purpose switch
50
51Example:
52
53codec: wm8280@0 {
54 compatible = "wlf,wm8280";
55 reg = <0>;
56 ...
57
58 wlf,use-jd2;
59 wlf,use-jd2-nopull;
60 wlf,jd-invert;
61
62 wlf,micd-software-compare;
63 wlf,micd-detect-debounce = <0>;
64 wlf,micd-pol-gpio = <&codec 2 0>;
65 wlf,micd-rate = <ARIZONA_MICD_TIME_8MS>;
66 wlf,micd-dbtime = <4>;
67 wlf,micd-timeout-ms = <100>;
68 wlf,micd-force-micbias;
69 wlf,micd-configs = <
70 0 1 0 /* MICDET1 MICBIAS1 GPIO=low */
71 1 2 1 /* MICDET2 MICBIAS2 GPIO=high */
72 >;
73
74 wlf,gpsw = <0>;
75};
diff --git a/Documentation/devicetree/bindings/extcon/extcon-max3355.txt b/Documentation/devicetree/bindings/extcon/extcon-max3355.txt
new file mode 100644
index 000000000000..f2288ea9eb82
--- /dev/null
+++ b/Documentation/devicetree/bindings/extcon/extcon-max3355.txt
@@ -0,0 +1,21 @@
1Maxim Integrated MAX3355 USB OTG chip
2-------------------------------------
3
4MAX3355 integrates a charge pump and comparators to enable a system with an
5integrated USB OTG dual-role transceiver to function as a USB OTG dual-role
6device.
7
8Required properties:
9- compatible: should be "maxim,max3355";
10- maxim,shdn-gpios: should contain a phandle and GPIO specifier for the GPIO pin
11 connected to the MAX3355's SHDN# pin;
12- id-gpios: should contain a phandle and GPIO specifier for the GPIO pin
13 connected to the MAX3355's ID_OUT pin.
14
15Example:
16
17 usb-otg {
18 compatible = "maxim,max3355";
19 maxim,shdn-gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
20 id-gpios = <&gpio5 31 GPIO_ACTIVE_HIGH>;
21 };
diff --git a/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt b/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt
index 13df9933f4cd..6b4a98f74be3 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt
@@ -25,6 +25,7 @@ Required properties:
25 ti,tca6416 25 ti,tca6416
26 ti,tca6424 26 ti,tca6424
27 ti,tca9539 27 ti,tca9539
28 onsemi,pca9654
28 exar,xra1202 29 exar,xra1202
29 30
30Example: 31Example:
diff --git a/Documentation/devicetree/bindings/gpio/gpio-sx150x.txt b/Documentation/devicetree/bindings/gpio/gpio-sx150x.txt
index ba2bb84eeac3..c809acb9c71b 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-sx150x.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-sx150x.txt
@@ -5,7 +5,8 @@ Required properties:
5 5
6- compatible: should be "semtech,sx1506q", 6- compatible: should be "semtech,sx1506q",
7 "semtech,sx1508q", 7 "semtech,sx1508q",
8 "semtech,sx1509q". 8 "semtech,sx1509q",
9 "semtech,sx1502q".
9 10
10- reg: The I2C slave address for this device. 11- reg: The I2C slave address for this device.
11 12
diff --git a/Documentation/devicetree/bindings/gpio/gpio-tps65086.txt b/Documentation/devicetree/bindings/gpio/gpio-tps65086.txt
new file mode 100644
index 000000000000..ba051074bedc
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-tps65086.txt
@@ -0,0 +1,16 @@
1* TPS65086 GPO Controller bindings
2
3Required properties:
4 - compatible : Should be "ti,tps65086-gpio".
5 - gpio-controller : Marks the device node as a GPIO Controller.
6 - #gpio-cells : Should be two. The first cell is the pin number
7 and the second cell is used to specify flags.
8 See ../gpio/gpio.txt for possible values.
9
10Example:
11
12 gpio4: gpio {
13 compatible = "ti,tps65086-gpio";
14 gpio-controller;
15 #gpio-cells = <2>;
16 };
diff --git a/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt
index dd5d2c0394b1..4d6c8cdc8586 100644
--- a/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt
@@ -24,7 +24,7 @@ controller.
24- #interrupt-cells : Specifies the number of cells needed to encode an 24- #interrupt-cells : Specifies the number of cells needed to encode an
25 interrupt. Shall be set to 2. The first cell defines the interrupt number, 25 interrupt. Shall be set to 2. The first cell defines the interrupt number,
26 the second encodes the triger flags encoded as described in 26 the second encodes the triger flags encoded as described in
27 Documentation/devicetree/bindings/interrupts.txt 27 Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
28- interrupt-parent : The parent interrupt controller. 28- interrupt-parent : The parent interrupt controller.
29- interrupts : The interrupt to the parent controller raised when GPIOs 29- interrupts : The interrupt to the parent controller raised when GPIOs
30 generate the interrupts. 30 generate the interrupts.
diff --git a/Documentation/devicetree/bindings/i2c/i2c-at91.txt b/Documentation/devicetree/bindings/i2c/i2c-at91.txt
index 6e81dc153f3b..ef973a0343c7 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-at91.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-at91.txt
@@ -3,7 +3,7 @@ I2C for Atmel platforms
3Required properties : 3Required properties :
4- compatible : Must be "atmel,at91rm9200-i2c", "atmel,at91sam9261-i2c", 4- compatible : Must be "atmel,at91rm9200-i2c", "atmel,at91sam9261-i2c",
5 "atmel,at91sam9260-i2c", "atmel,at91sam9g20-i2c", "atmel,at91sam9g10-i2c", 5 "atmel,at91sam9260-i2c", "atmel,at91sam9g20-i2c", "atmel,at91sam9g10-i2c",
6 "atmel,at91sam9x5-i2c" or "atmel,sama5d2-i2c" 6 "atmel,at91sam9x5-i2c", "atmel,sama5d4-i2c" or "atmel,sama5d2-i2c"
7- reg: physical base address of the controller and length of memory mapped 7- reg: physical base address of the controller and length of memory mapped
8 region. 8 region.
9- interrupts: interrupt number to the cpu. 9- interrupts: interrupt number to the cpu.
@@ -17,6 +17,8 @@ Optional properties:
17- dma-names: should contain "tx" and "rx". 17- dma-names: should contain "tx" and "rx".
18- atmel,fifo-size: maximum number of data the RX and TX FIFOs can store for FIFO 18- atmel,fifo-size: maximum number of data the RX and TX FIFOs can store for FIFO
19 capable I2C controllers. 19 capable I2C controllers.
20- i2c-sda-hold-time-ns: TWD hold time, only available for "atmel,sama5d4-i2c"
21 and "atmel,sama5d2-i2c".
20- Child nodes conforming to i2c bus binding 22- Child nodes conforming to i2c bus binding
21 23
22Examples : 24Examples :
@@ -52,6 +54,7 @@ i2c0: i2c@f8034600 {
52 #size-cells = <0>; 54 #size-cells = <0>;
53 clocks = <&flx0>; 55 clocks = <&flx0>;
54 atmel,fifo-size = <16>; 56 atmel,fifo-size = <16>;
57 i2c-sda-hold-time-ns = <336>;
55 58
56 wm8731: wm8731@1a { 59 wm8731: wm8731@1a {
57 compatible = "wm8731"; 60 compatible = "wm8731";
diff --git a/Documentation/devicetree/bindings/i2c/i2c-brcmstb.txt b/Documentation/devicetree/bindings/i2c/i2c-brcmstb.txt
index d6f724efdcf2..aeceaceba3c5 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-brcmstb.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-brcmstb.txt
@@ -2,7 +2,7 @@ Broadcom stb bsc iic master controller
2 2
3Required properties: 3Required properties:
4 4
5- compatible: should be "brcm,brcmstb-i2c" 5- compatible: should be "brcm,brcmstb-i2c" or "brcm,brcmper-i2c"
6- clock-frequency: 32-bit decimal value of iic master clock freqency in Hz 6- clock-frequency: 32-bit decimal value of iic master clock freqency in Hz
7 valid values are 375000, 390000, 187500, 200000 7 valid values are 375000, 390000, 187500, 200000
8 93750, 97500, 46875 and 50000 8 93750, 97500, 46875 and 50000
diff --git a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
index ea406eb20fa5..95e97223a71c 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
@@ -20,6 +20,10 @@ Optional properties:
20 propoerty indicates the default frequency 100 kHz. 20 propoerty indicates the default frequency 100 kHz.
21- clocks: clock specifier. 21- clocks: clock specifier.
22 22
23- i2c-scl-falling-time-ns: see i2c.txt
24- i2c-scl-internal-delay-ns: see i2c.txt
25- i2c-scl-rising-time-ns: see i2c.txt
26
23Examples : 27Examples :
24 28
25i2c0: i2c@e6508000 { 29i2c0: i2c@e6508000 {
diff --git a/Documentation/devicetree/bindings/i2c/i2c.txt b/Documentation/devicetree/bindings/i2c/i2c.txt
index 8a99150ac3a7..c8d977ed847f 100644
--- a/Documentation/devicetree/bindings/i2c/i2c.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c.txt
@@ -29,12 +29,38 @@ Optional properties
29These properties may not be supported by all drivers. However, if a driver 29These properties may not be supported by all drivers. However, if a driver
30wants to support one of the below features, it should adapt the bindings below. 30wants to support one of the below features, it should adapt the bindings below.
31 31
32- clock-frequency - frequency of bus clock in Hz. 32- clock-frequency
33- wakeup-source - device can be used as a wakeup source. 33 frequency of bus clock in Hz.
34 34
35- interrupts - interrupts used by the device. 35- i2c-scl-falling-time-ns
36- interrupt-names - "irq" and "wakeup" names are recognized by I2C core, 36 Number of nanoseconds the SCL signal takes to fall; t(f) in the I2C
37 other names are left to individual drivers. 37 specification.
38
39- i2c-scl-internal-delay-ns
40 Number of nanoseconds the IP core additionally needs to setup SCL.
41
42- i2c-scl-rising-time-ns
43 Number of nanoseconds the SCL signal takes to rise; t(r) in the I2C
44 specification.
45
46- i2c-sda-falling-time-ns
47 Number of nanoseconds the SDA signal takes to fall; t(f) in the I2C
48 specification.
49
50- interrupts
51 interrupts used by the device.
52
53- interrupt-names
54 "irq" and "wakeup" names are recognized by I2C core, other names are
55 left to individual drivers.
56
57- multi-master
58 states that there is another master active on this bus. The OS can use
59 this information to adapt power management to keep the arbitration awake
60 all the time, for example.
61
62- wakeup-source
63 device can be used as a wakeup source.
38 64
39Binding may contain optional "interrupts" property, describing interrupts 65Binding may contain optional "interrupts" property, describing interrupts
40used by the device. I2C core will assign "irq" interrupt (or the very first 66used by the device. I2C core will assign "irq" interrupt (or the very first
diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
index c50cf13c852e..539874490492 100644
--- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt
+++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
@@ -20,22 +20,11 @@ adi,adt7476 +/-1C TDM Extended Temp Range I.C
20adi,adt7490 +/-1C TDM Extended Temp Range I.C 20adi,adt7490 +/-1C TDM Extended Temp Range I.C
21adi,adxl345 Three-Axis Digital Accelerometer 21adi,adxl345 Three-Axis Digital Accelerometer
22adi,adxl346 Three-Axis Digital Accelerometer (backward-compatibility value "adi,adxl345" must be listed too) 22adi,adxl346 Three-Axis Digital Accelerometer (backward-compatibility value "adi,adxl345" must be listed too)
23ams,iaq-core AMS iAQ-Core VOC Sensor
23at,24c08 i2c serial eeprom (24cxx) 24at,24c08 i2c serial eeprom (24cxx)
24atmel,24c00 i2c serial eeprom (24cxx)
25atmel,24c01 i2c serial eeprom (24cxx)
26atmel,24c02 i2c serial eeprom (24cxx)
27atmel,24c04 i2c serial eeprom (24cxx)
28atmel,24c16 i2c serial eeprom (24cxx)
29atmel,24c32 i2c serial eeprom (24cxx)
30atmel,24c64 i2c serial eeprom (24cxx)
31atmel,24c128 i2c serial eeprom (24cxx)
32atmel,24c256 i2c serial eeprom (24cxx)
33atmel,24c512 i2c serial eeprom (24cxx)
34atmel,24c1024 i2c serial eeprom (24cxx)
35atmel,at97sc3204t i2c trusted platform module (TPM) 25atmel,at97sc3204t i2c trusted platform module (TPM)
36capella,cm32181 CM32181: Ambient Light Sensor 26capella,cm32181 CM32181: Ambient Light Sensor
37capella,cm3232 CM3232: Ambient Light Sensor 27capella,cm3232 CM3232: Ambient Light Sensor
38catalyst,24c32 i2c serial eeprom
39cirrus,cs42l51 Cirrus Logic CS42L51 audio codec 28cirrus,cs42l51 Cirrus Logic CS42L51 audio codec
40dallas,ds1307 64 x 8, Serial, I2C Real-Time Clock 29dallas,ds1307 64 x 8, Serial, I2C Real-Time Clock
41dallas,ds1338 I2C RTC with 56-Byte NV RAM 30dallas,ds1338 I2C RTC with 56-Byte NV RAM
@@ -49,11 +38,13 @@ dallas,ds4510 CPU Supervisor with Nonvolatile Memory and Programmable I/O
49dallas,ds75 Digital Thermometer and Thermostat 38dallas,ds75 Digital Thermometer and Thermostat
50dlg,da9053 DA9053: flexible system level PMIC with multicore support 39dlg,da9053 DA9053: flexible system level PMIC with multicore support
51dlg,da9063 DA9063: system PMIC for quad-core application processors 40dlg,da9063 DA9063: system PMIC for quad-core application processors
41epson,rx8010 I2C-BUS INTERFACE REAL TIME CLOCK MODULE
52epson,rx8025 High-Stability. I2C-Bus INTERFACE REAL TIME CLOCK MODULE 42epson,rx8025 High-Stability. I2C-Bus INTERFACE REAL TIME CLOCK MODULE
53epson,rx8581 I2C-BUS INTERFACE REAL TIME CLOCK MODULE 43epson,rx8581 I2C-BUS INTERFACE REAL TIME CLOCK MODULE
54fsl,mag3110 MAG3110: Xtrinsic High Accuracy, 3D Magnetometer 44fsl,mag3110 MAG3110: Xtrinsic High Accuracy, 3D Magnetometer
55fsl,mc13892 MC13892: Power Management Integrated Circuit (PMIC) for i.MX35/51 45fsl,mc13892 MC13892: Power Management Integrated Circuit (PMIC) for i.MX35/51
56fsl,mma8450 MMA8450Q: Xtrinsic Low-power, 3-axis Xtrinsic Accelerometer 46fsl,mma8450 MMA8450Q: Xtrinsic Low-power, 3-axis Xtrinsic Accelerometer
47fsl,mpl3115 MPL3115: Absolute Digital Pressure Sensor
57fsl,mpr121 MPR121: Proximity Capacitive Touch Sensor Controller 48fsl,mpr121 MPR121: Proximity Capacitive Touch Sensor Controller
58fsl,sgtl5000 SGTL5000: Ultra Low-Power Audio Codec 49fsl,sgtl5000 SGTL5000: Ultra Low-Power Audio Codec
59gmt,g751 G751: Digital Temperature Sensor and Thermal Watchdog with Two-Wire Interface 50gmt,g751 G751: Digital Temperature Sensor and Thermal Watchdog with Two-Wire Interface
@@ -80,7 +71,6 @@ ovti,ov5642 OV5642: Color CMOS QSXGA (5-megapixel) Image Sensor with OmniBSI an
80pericom,pt7c4338 Real-time Clock Module 71pericom,pt7c4338 Real-time Clock Module
81plx,pex8648 48-Lane, 12-Port PCI Express Gen 2 (5.0 GT/s) Switch 72plx,pex8648 48-Lane, 12-Port PCI Express Gen 2 (5.0 GT/s) Switch
82pulsedlight,lidar-lite-v2 Pulsedlight LIDAR range-finding sensor 73pulsedlight,lidar-lite-v2 Pulsedlight LIDAR range-finding sensor
83ramtron,24c64 i2c serial eeprom (24cxx)
84ricoh,r2025sd I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC 74ricoh,r2025sd I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
85ricoh,r2221tl I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC 75ricoh,r2221tl I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
86ricoh,rs5c372a I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC 76ricoh,rs5c372a I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
diff --git a/Documentation/devicetree/bindings/iio/accel/mma8452.txt b/Documentation/devicetree/bindings/iio/accel/mma8452.txt
index e3c37467d7da..3c10e8581144 100644
--- a/Documentation/devicetree/bindings/iio/accel/mma8452.txt
+++ b/Documentation/devicetree/bindings/iio/accel/mma8452.txt
@@ -7,13 +7,18 @@ Required properties:
7 * "fsl,mma8453" 7 * "fsl,mma8453"
8 * "fsl,mma8652" 8 * "fsl,mma8652"
9 * "fsl,mma8653" 9 * "fsl,mma8653"
10
10 - reg: the I2C address of the chip 11 - reg: the I2C address of the chip
11 12
12Optional properties: 13Optional properties:
13 14
14 - interrupt-parent: should be the phandle for the interrupt controller 15 - interrupt-parent: should be the phandle for the interrupt controller
16
15 - interrupts: interrupt mapping for GPIO IRQ 17 - interrupts: interrupt mapping for GPIO IRQ
16 18
19 - interrupt-names: should contain "INT1" and/or "INT2", the accelerometer's
20 interrupt line in use.
21
17Example: 22Example:
18 23
19 mma8453fc@1d { 24 mma8453fc@1d {
@@ -21,4 +26,5 @@ Example:
21 reg = <0x1d>; 26 reg = <0x1d>;
22 interrupt-parent = <&gpio1>; 27 interrupt-parent = <&gpio1>;
23 interrupts = <5 0>; 28 interrupts = <5 0>;
29 interrupt-names = "INT2";
24 }; 30 };
diff --git a/Documentation/devicetree/bindings/iio/adc/imx7d-adc.txt b/Documentation/devicetree/bindings/iio/adc/imx7d-adc.txt
new file mode 100644
index 000000000000..5c184b940669
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/imx7d-adc.txt
@@ -0,0 +1,22 @@
1Freescale imx7d ADC bindings
2
3The devicetree bindings are for the ADC driver written for
4imx7d SoC.
5
6Required properties:
7- compatible: Should be "fsl,imx7d-adc"
8- reg: Offset and length of the register set for the ADC device
9- interrupts: The interrupt number for the ADC device
10- clocks: The root clock of the ADC controller
11- clock-names: Must contain "adc", matching entry in the clocks property
12- vref-supply: The regulator supply ADC reference voltage
13
14Example:
15adc1: adc@30610000 {
16 compatible = "fsl,imx7d-adc";
17 reg = <0x30610000 0x10000>;
18 interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
19 clocks = <&clks IMX7D_ADC_ROOT_CLK>;
20 clock-names = "adc";
21 vref-supply = <&reg_vcc_3v3_mcu>;
22};
diff --git a/Documentation/devicetree/bindings/iio/adc/mcp320x.txt b/Documentation/devicetree/bindings/iio/adc/mcp320x.txt
index 2a1f3af30155..bcd3ac8e6e0c 100644
--- a/Documentation/devicetree/bindings/iio/adc/mcp320x.txt
+++ b/Documentation/devicetree/bindings/iio/adc/mcp320x.txt
@@ -10,16 +10,28 @@ must be specified.
10Required properties: 10Required properties:
11 - compatible: Must be one of the following, depending on the 11 - compatible: Must be one of the following, depending on the
12 model: 12 model:
13 "mcp3001" 13 "mcp3001" (DEPRECATED)
14 "mcp3002" 14 "mcp3002" (DEPRECATED)
15 "mcp3004" 15 "mcp3004" (DEPRECATED)
16 "mcp3008" 16 "mcp3008" (DEPRECATED)
17 "mcp3201" 17 "mcp3201" (DEPRECATED)
18 "mcp3202" 18 "mcp3202" (DEPRECATED)
19 "mcp3204" 19 "mcp3204" (DEPRECATED)
20 "mcp3208" 20 "mcp3208" (DEPRECATED)
21 "mcp3301" 21 "mcp3301" (DEPRECATED)
22 22
23 "microchip,mcp3001"
24 "microchip,mcp3002"
25 "microchip,mcp3004"
26 "microchip,mcp3008"
27 "microchip,mcp3201"
28 "microchip,mcp3202"
29 "microchip,mcp3204"
30 "microchip,mcp3208"
31 "microchip,mcp3301"
32
33 NOTE: The use of the compatibles with no vendor prefix
34 is deprecated and only listed because old DT use them.
23 35
24Examples: 36Examples:
25spi_controller { 37spi_controller {
diff --git a/Documentation/devicetree/bindings/iio/adc/mcp3422.txt b/Documentation/devicetree/bindings/iio/adc/mcp3422.txt
index 333139cc0bfb..dcae4ccfcc52 100644
--- a/Documentation/devicetree/bindings/iio/adc/mcp3422.txt
+++ b/Documentation/devicetree/bindings/iio/adc/mcp3422.txt
@@ -1,7 +1,8 @@
1* Microchip mcp3422/3/4/6/7/8 chip family (ADC) 1* Microchip mcp3421/2/3/4/6/7/8 chip family (ADC)
2 2
3Required properties: 3Required properties:
4 - compatible: Should be 4 - compatible: Should be
5 "microchip,mcp3421" or
5 "microchip,mcp3422" or 6 "microchip,mcp3422" or
6 "microchip,mcp3423" or 7 "microchip,mcp3423" or
7 "microchip,mcp3424" or 8 "microchip,mcp3424" or
diff --git a/Documentation/devicetree/bindings/iio/adc/palmas-gpadc.txt b/Documentation/devicetree/bindings/iio/adc/palmas-gpadc.txt
new file mode 100644
index 000000000000..4bb9a86065d1
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/palmas-gpadc.txt
@@ -0,0 +1,48 @@
1* Palmas general purpose ADC IP block devicetree bindings
2
3Channels list:
4 0 battery type
5 1 battery temp NTC (optional current source)
6 2 GP
7 3 temp (with ext. diode, optional current source)
8 4 GP
9 5 GP
10 6 VBAT_SENSE
11 7 VCC_SENSE
12 8 Backup Battery voltage
13 9 external charger (VCHG)
14 10 VBUS
15 11 DC-DC current probe (how does this work?)
16 12 internal die temp
17 13 internal die temp
18 14 USB ID pin voltage
19 15 test network
20
21Required properties:
22- compatible : Must be "ti,palmas-gpadc".
23- #io-channel-cells: Should be set to <1>.
24
25Optional sub-nodes:
26ti,channel0-current-microamp: Channel 0 current in uA.
27 Values are rounded to derive 0uA, 5uA, 15uA, 20uA.
28ti,channel3-current-microamp: Channel 3 current in uA.
29 Values are rounded to derive 0uA, 10uA, 400uA, 800uA.
30ti,enable-extended-delay: Enable extended delay.
31
32Example:
33
34pmic {
35 compatible = "ti,twl6035-pmic", "ti,palmas-pmic";
36 ...
37 gpadc {
38 compatible = "ti,palmas-gpadc";
39 interrupts = <18 0
40 16 0
41 17 0>;
42 #io-channel-cells = <1>;
43 ti,channel0-current-microamp = <5>;
44 ti,channel3-current-microamp = <10>;
45 };
46 };
47 ...
48};
diff --git a/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt b/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt
index 15ca6b47958e..daa2b2c29428 100644
--- a/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt
+++ b/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt
@@ -1,7 +1,7 @@
1* Texas Instruments' ADC128S052 and ADC122S021 ADC chip 1* Texas Instruments' ADC128S052, ADC122S021 and ADC124S021 ADC chip
2 2
3Required properties: 3Required properties:
4 - compatible: Should be "ti,adc128s052" or "ti,adc122s021" 4 - compatible: Should be "ti,adc128s052", "ti,adc122s021" or "ti,adc124s021"
5 - reg: spi chip select number for the device 5 - reg: spi chip select number for the device
6 - vref-supply: The regulator supply for ADC reference voltage 6 - vref-supply: The regulator supply for ADC reference voltage
7 7
diff --git a/Documentation/devicetree/bindings/iio/adc/ti-ads8688.txt b/Documentation/devicetree/bindings/iio/adc/ti-ads8688.txt
new file mode 100644
index 000000000000..a02337d7efa4
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/ti-ads8688.txt
@@ -0,0 +1,20 @@
1* Texas Instruments' ADS8684 and ADS8688 ADC chip
2
3Required properties:
4 - compatible: Should be "ti,ads8684" or "ti,ads8688"
5 - reg: spi chip select number for the device
6
7Recommended properties:
8 - spi-max-frequency: Definition as per
9 Documentation/devicetree/bindings/spi/spi-bus.txt
10
11Optional properties:
12 - vref-supply: The regulator supply for ADC reference voltage
13
14Example:
15adc@0 {
16 compatible = "ti,ads8688";
17 reg = <0>;
18 vref-supply = <&vdd_supply>;
19 spi-max-frequency = <1000000>;
20};
diff --git a/Documentation/devicetree/bindings/iio/health/max30100.txt b/Documentation/devicetree/bindings/iio/health/max30100.txt
new file mode 100644
index 000000000000..f6fbac66ad06
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/health/max30100.txt
@@ -0,0 +1,21 @@
1Maxim MAX30100 heart rate and pulse oximeter sensor
2
3* https://datasheets.maximintegrated.com/en/ds/MAX30100.pdf
4
5Required properties:
6 - compatible: must be "maxim,max30100"
7 - reg: the I2C address of the sensor
8 - interrupt-parent: should be the phandle for the interrupt controller
9 - interrupts: the sole interrupt generated by the device
10
11 Refer to interrupt-controller/interrupts.txt for generic
12 interrupt client node bindings.
13
14Example:
15
16max30100@057 {
17 compatible = "maxim,max30100";
18 reg = <57>;
19 interrupt-parent = <&gpio1>;
20 interrupts = <16 2>;
21};
diff --git a/Documentation/devicetree/bindings/iio/light/us5182d.txt b/Documentation/devicetree/bindings/iio/light/us5182d.txt
index 6f0a530144fd..a61979997f37 100644
--- a/Documentation/devicetree/bindings/iio/light/us5182d.txt
+++ b/Documentation/devicetree/bindings/iio/light/us5182d.txt
@@ -7,13 +7,24 @@ Required properties:
7Optional properties: 7Optional properties:
8- upisemi,glass-coef: glass attenuation factor - compensation factor of 8- upisemi,glass-coef: glass attenuation factor - compensation factor of
9 resolution 1000 for material transmittance. 9 resolution 1000 for material transmittance.
10
10- upisemi,dark-ths: array of 8 elements containing 16-bit thresholds (adc 11- upisemi,dark-ths: array of 8 elements containing 16-bit thresholds (adc
11 counts) corresponding to every scale. 12 counts) corresponding to every scale.
13
12- upisemi,upper-dark-gain: 8-bit dark gain compensation factor(4 int and 4 14- upisemi,upper-dark-gain: 8-bit dark gain compensation factor(4 int and 4
13 fractional bits - Q4.4) applied when light > threshold 15 fractional bits - Q4.4) applied when light > threshold
16
14- upisemi,lower-dark-gain: 8-bit dark gain compensation factor(4 int and 4 17- upisemi,lower-dark-gain: 8-bit dark gain compensation factor(4 int and 4
15 fractional bits - Q4.4) applied when light < threshold 18 fractional bits - Q4.4) applied when light < threshold
16 19
20- upisemi,continuous: This chip has two power modes: one-shot (chip takes one
21 measurement and then shuts itself down) and continuous (
22 chip takes continuous measurements). The one-shot mode is
23 more power-friendly but the continuous mode may be more
24 reliable. If this property is specified the continuous
25 mode will be used instead of the default one-shot one for
26 raw reads.
27
17If the optional properties are not specified these factors will default to the 28If the optional properties are not specified these factors will default to the
18values in the below example. 29values in the below example.
19The glass-coef defaults to no compensation for the covering material. 30The glass-coef defaults to no compensation for the covering material.
diff --git a/Documentation/devicetree/bindings/iio/st-sensors.txt b/Documentation/devicetree/bindings/iio/st-sensors.txt
index d3ccdb190c53..d4b87cc1e446 100644
--- a/Documentation/devicetree/bindings/iio/st-sensors.txt
+++ b/Documentation/devicetree/bindings/iio/st-sensors.txt
@@ -36,6 +36,7 @@ Accelerometers:
36- st,lsm303dlm-accel 36- st,lsm303dlm-accel
37- st,lsm330-accel 37- st,lsm330-accel
38- st,lsm303agr-accel 38- st,lsm303agr-accel
39- st,lis2dh12-accel
39 40
40Gyroscopes: 41Gyroscopes:
41- st,l3g4200d-gyro 42- st,l3g4200d-gyro
diff --git a/Documentation/devicetree/bindings/input/gpio-keys.txt b/Documentation/devicetree/bindings/input/gpio-keys.txt
index cf1333d1dd52..21641236c095 100644
--- a/Documentation/devicetree/bindings/input/gpio-keys.txt
+++ b/Documentation/devicetree/bindings/input/gpio-keys.txt
@@ -6,6 +6,7 @@ Required properties:
6Optional properties: 6Optional properties:
7 - autorepeat: Boolean, Enable auto repeat feature of Linux input 7 - autorepeat: Boolean, Enable auto repeat feature of Linux input
8 subsystem. 8 subsystem.
9 - label: String, name of the input device.
9 10
10Each button (key) is represented as a sub-node of "gpio-keys": 11Each button (key) is represented as a sub-node of "gpio-keys":
11Subnode properties: 12Subnode properties:
diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
index 8ba98eec765b..c98757a69110 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
@@ -13,6 +13,17 @@ Required properties:
13 - interrupt-parent : Interrupt controller to which the chip is connected 13 - interrupt-parent : Interrupt controller to which the chip is connected
14 - interrupts : Interrupt to which the chip is connected 14 - interrupts : Interrupt to which the chip is connected
15 15
16Optional properties:
17
18 - irq-gpios : GPIO pin used for IRQ. The driver uses the
19 interrupt gpio pin as output to reset the device.
20 - reset-gpios : GPIO pin used for reset
21
22 - touchscreen-inverted-x : X axis is inverted (boolean)
23 - touchscreen-inverted-y : Y axis is inverted (boolean)
24 - touchscreen-swapped-x-y : X and Y axis are swapped (boolean)
25 (swapping is done after inverting the axis)
26
16Example: 27Example:
17 28
18 i2c@00000000 { 29 i2c@00000000 {
@@ -23,6 +34,9 @@ Example:
23 reg = <0x5d>; 34 reg = <0x5d>;
24 interrupt-parent = <&gpio>; 35 interrupt-parent = <&gpio>;
25 interrupts = <0 0>; 36 interrupts = <0 0>;
37
38 irq-gpios = <&gpio1 0 0>;
39 reset-gpios = <&gpio1 1 0>;
26 }; 40 };
27 41
28 /* ... */ 42 /* ... */
diff --git a/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
index 8eb240a287c8..697a3e7831e7 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
@@ -9,7 +9,9 @@ Required properties:
9- touchscreen-size-y: vertical resolution of touchscreen (in pixels) 9- touchscreen-size-y: vertical resolution of touchscreen (in pixels)
10 10
11Optional properties: 11Optional properties:
12- reset-gpio: GPIO connected to the RESET line of the chip 12- reset-gpios: GPIO connected to the RESET line of the chip
13- enable-gpios: GPIO connected to the ENABLE line of the chip
14- wake-gpios: GPIO connected to the WAKE line of the chip
13 15
14Example: 16Example:
15 17
diff --git a/Documentation/devicetree/bindings/input/touchscreen/ts4800-ts.txt b/Documentation/devicetree/bindings/input/touchscreen/ts4800-ts.txt
new file mode 100644
index 000000000000..4c1c092c276b
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/ts4800-ts.txt
@@ -0,0 +1,11 @@
1* TS-4800 Touchscreen bindings
2
3Required properties:
4- compatible: must be "technologic,ts4800-ts"
5- reg: physical base address of the controller and length of memory mapped
6 region.
7- syscon: phandle / integers array that points to the syscon node which
8 describes the FPGA's syscon registers.
9 - phandle to FPGA's syscon
10 - offset to the touchscreen register
11 - offset to the touchscreen enable bit
diff --git a/Documentation/devicetree/bindings/interrupt-controller/allwinner,sun67i-sc-nmi.txt b/Documentation/devicetree/bindings/interrupt-controller/allwinner,sunxi-nmi.txt
index d1c5cdabc3e0..81cd3692405e 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/allwinner,sun67i-sc-nmi.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/allwinner,sunxi-nmi.txt
@@ -4,7 +4,7 @@ Allwinner Sunxi NMI Controller
4Required properties: 4Required properties:
5 5
6- compatible : should be "allwinner,sun7i-a20-sc-nmi" or 6- compatible : should be "allwinner,sun7i-a20-sc-nmi" or
7 "allwinner,sun6i-a31-sc-nmi" 7 "allwinner,sun6i-a31-sc-nmi" or "allwinner,sun9i-a80-nmi"
8- reg : Specifies base physical address and size of the registers. 8- reg : Specifies base physical address and size of the registers.
9- interrupt-controller : Identifies the node as an interrupt controller 9- interrupt-controller : Identifies the node as an interrupt controller
10- #interrupt-cells : Specifies the number of cells needed to encode an 10- #interrupt-cells : Specifies the number of cells needed to encode an
diff --git a/Documentation/devicetree/bindings/interrupt-controller/arm,gic.txt b/Documentation/devicetree/bindings/interrupt-controller/arm,gic.txt
index cc56021eb60b..5a1cb4bc3dfe 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/arm,gic.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/arm,gic.txt
@@ -18,6 +18,7 @@ Main node required properties:
18 "arm,cortex-a9-gic" 18 "arm,cortex-a9-gic"
19 "arm,gic-400" 19 "arm,gic-400"
20 "arm,pl390" 20 "arm,pl390"
21 "arm,tc11mp-gic"
21 "brcm,brahma-b15-gic" 22 "brcm,brahma-b15-gic"
22 "qcom,msm-8660-qgic" 23 "qcom,msm-8660-qgic"
23 "qcom,msm-qgic2" 24 "qcom,msm-qgic2"
diff --git a/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt b/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt
new file mode 100644
index 000000000000..720f7c92e9a1
--- /dev/null
+++ b/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt
@@ -0,0 +1,74 @@
1Hisilicon mbigen device tree bindings.
2=======================================
3
4Mbigen means: message based interrupt generator.
5
6MBI is kind of msi interrupt only used on Non-PCI devices.
7
8To reduce the wired interrupt number connected to GIC,
9Hisilicon designed mbigen to collect and generate interrupt.
10
11
12Non-pci devices can connect to mbigen and generate the
13interrupt by writing ITS register.
14
15The mbigen chip and devices connect to mbigen have the following properties:
16
17Mbigen main node required properties:
18-------------------------------------------
19- compatible: Should be "hisilicon,mbigen-v2"
20
21- reg: Specifies the base physical address and size of the Mbigen
22 registers.
23
24- interrupt controller: Identifies the node as an interrupt controller
25
26- msi-parent: Specifies the MSI controller this mbigen use.
27 For more detail information,please refer to the generic msi-parent binding in
28 Documentation/devicetree/bindings/interrupt-controller/msi.txt.
29
30- num-pins: the total number of pins implemented in this Mbigen
31 instance.
32
33- #interrupt-cells : Specifies the number of cells needed to encode an
34 interrupt source. The value must be 2.
35
36 The 1st cell is hardware pin number of the interrupt.This number is local to
37 each mbigen chip and in the range from 0 to the maximum interrupts number
38 of the mbigen.
39
40 The 2nd cell is the interrupt trigger type.
41 The value of this cell should be:
42 1: rising edge triggered
43 or
44 4: high level triggered
45
46Examples:
47
48 mbigen_device_gmac:intc {
49 compatible = "hisilicon,mbigen-v2";
50 reg = <0x0 0xc0080000 0x0 0x10000>;
51 interrupt-controller;
52 msi-parent = <&its_dsa 0x40b1c>;
53 num-pins = <9>;
54 #interrupt-cells = <2>;
55 };
56
57Devices connect to mbigen required properties:
58----------------------------------------------------
59-interrupt-parent: Specifies the mbigen device node which device connected.
60
61-interrupts:Specifies the interrupt source.
62 For the specific information of each cell in this property,please refer to
63 the "interrupt-cells" description mentioned above.
64
65Examples:
66 gmac0: ethernet@c2080000 {
67 #address-cells = <1>;
68 #size-cells = <0>;
69 reg = <0 0xc2080000 0 0x20000>,
70 <0 0xc0000000 0 0x1000>;
71 interrupt-parent = <&mbigen_device_gmac>;
72 interrupts = <656 1>,
73 <657 1>;
74 };
diff --git a/Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt b/Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt
index afef6a85ac51..b8e1674c7837 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/mediatek,sysirq.txt
@@ -14,6 +14,7 @@ Required properties:
14 "mediatek,mt6582-sysirq" 14 "mediatek,mt6582-sysirq"
15 "mediatek,mt6580-sysirq" 15 "mediatek,mt6580-sysirq"
16 "mediatek,mt6577-sysirq" 16 "mediatek,mt6577-sysirq"
17 "mediatek,mt2701-sysirq"
17- interrupt-controller : Identifies the node as an interrupt controller 18- interrupt-controller : Identifies the node as an interrupt controller
18- #interrupt-cells : Use the same format as specified by GIC in 19- #interrupt-cells : Use the same format as specified by GIC in
19 Documentation/devicetree/bindings/arm/gic.txt 20 Documentation/devicetree/bindings/arm/gic.txt
diff --git a/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt
index ec96b1f01478..475ae9bd562b 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt
@@ -22,7 +22,7 @@ Interrupt Controllers bindings used by client devices.
22Example: 22Example:
23 23
24 interrupt-controller@18060010 { 24 interrupt-controller@18060010 {
25 compatible = "qca,ar9132-misc-intc", qca,ar7100-misc-intc"; 25 compatible = "qca,ar9132-misc-intc", "qca,ar7100-misc-intc";
26 reg = <0x18060010 0x4>; 26 reg = <0x18060010 0x4>;
27 27
28 interrupt-parent = <&cpuintc>; 28 interrupt-parent = <&cpuintc>;
diff --git a/Documentation/devicetree/bindings/interrupt-controller/technologic,ts4800.txt b/Documentation/devicetree/bindings/interrupt-controller/technologic,ts4800.txt
new file mode 100644
index 000000000000..7f15f1b0325b
--- /dev/null
+++ b/Documentation/devicetree/bindings/interrupt-controller/technologic,ts4800.txt
@@ -0,0 +1,16 @@
1TS-4800 FPGA interrupt controller
2
3TS-4800 FPGA has an internal interrupt controller. When one of the
4interrupts is triggered, the SoC is notified, usually using a GPIO as
5parent interrupt source.
6
7Required properties:
8- compatible: should be "technologic,ts4800-irqc"
9- interrupt-controller: identifies the node as an interrupt controller
10- reg: physical base address of the controller and length of memory mapped
11 region
12- #interrupt-cells: specifies the number of cells needed to encode an interrupt
13 source, should be 1.
14- interrupt-parent: phandle to the parent interrupt controller this one is
15 cascaded from
16- interrupts: specifies the interrupt line in the interrupt-parent controller
diff --git a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
index cd29083e16ec..48ffb38f699e 100644
--- a/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
+++ b/Documentation/devicetree/bindings/iommu/renesas,ipmmu-vmsa.txt
@@ -7,7 +7,15 @@ connected to the IPMMU through a port called micro-TLB.
7 7
8Required Properties: 8Required Properties:
9 9
10 - compatible: Must contain "renesas,ipmmu-vmsa". 10 - compatible: Must contain SoC-specific and generic entries from below.
11
12 - "renesas,ipmmu-r8a73a4" for the R8A73A4 (R-Mobile APE6) IPMMU.
13 - "renesas,ipmmu-r8a7790" for the R8A7790 (R-Car H2) IPMMU.
14 - "renesas,ipmmu-r8a7791" for the R8A7791 (R-Car M2-W) IPMMU.
15 - "renesas,ipmmu-r8a7793" for the R8A7793 (R-Car M2-N) IPMMU.
16 - "renesas,ipmmu-r8a7794" for the R8A7794 (R-Car E2) IPMMU.
17 - "renesas,ipmmu-vmsa" for generic R-Car Gen2 VMSA-compatible IPMMU.
18
11 - reg: Base address and size of the IPMMU registers. 19 - reg: Base address and size of the IPMMU registers.
12 - interrupts: Specifiers for the MMU fault interrupts. For instances that 20 - interrupts: Specifiers for the MMU fault interrupts. For instances that
13 support secure mode two interrupts must be specified, for non-secure and 21 support secure mode two interrupts must be specified, for non-secure and
@@ -27,7 +35,7 @@ node with the following property:
27Example: R8A7791 IPMMU-MX and VSP1-D0 bus master 35Example: R8A7791 IPMMU-MX and VSP1-D0 bus master
28 36
29 ipmmu_mx: mmu@fe951000 { 37 ipmmu_mx: mmu@fe951000 {
30 compatible = "renasas,ipmmu-vmsa"; 38 compatible = "renasas,ipmmu-r8a7791", "renasas,ipmmu-vmsa";
31 reg = <0 0xfe951000 0 0x1000>; 39 reg = <0 0xfe951000 0 0x1000>;
32 interrupts = <0 222 IRQ_TYPE_LEVEL_HIGH>, 40 interrupts = <0 222 IRQ_TYPE_LEVEL_HIGH>,
33 <0 221 IRQ_TYPE_LEVEL_HIGH>; 41 <0 221 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/Documentation/devicetree/bindings/media/exynos5-gsc.txt b/Documentation/devicetree/bindings/media/exynos5-gsc.txt
index 0604d42f38d1..5fe9372abb37 100644
--- a/Documentation/devicetree/bindings/media/exynos5-gsc.txt
+++ b/Documentation/devicetree/bindings/media/exynos5-gsc.txt
@@ -7,6 +7,10 @@ Required properties:
7- reg: should contain G-Scaler physical address location and length. 7- reg: should contain G-Scaler physical address location and length.
8- interrupts: should contain G-Scaler interrupt number 8- interrupts: should contain G-Scaler interrupt number
9 9
10Optional properties:
11- samsung,sysreg: handle to syscon used to control the system registers to
12 set writeback input and destination
13
10Example: 14Example:
11 15
12gsc_0: gsc@0x13e00000 { 16gsc_0: gsc@0x13e00000 {
diff --git a/Documentation/devicetree/bindings/media/i2c/adp1653.txt b/Documentation/devicetree/bindings/media/i2c/adp1653.txt
index 5ce66f2104e3..4cce0de40ee9 100644
--- a/Documentation/devicetree/bindings/media/i2c/adp1653.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adp1653.txt
@@ -12,12 +12,13 @@ There are two LED outputs available - flash and indicator. One LED is
12represented by one child node, nodes need to be named "flash" and "indicator". 12represented by one child node, nodes need to be named "flash" and "indicator".
13 13
14Required properties of the LED child node: 14Required properties of the LED child node:
15- max-microamp : see Documentation/devicetree/bindings/leds/common.txt 15- led-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
16 16
17Required properties of the flash LED child node: 17Required properties of the flash LED child node:
18 18
19- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt 19- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
20- flash-timeout-us : see Documentation/devicetree/bindings/leds/common.txt 20- flash-timeout-us : see Documentation/devicetree/bindings/leds/common.txt
21- led-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
21 22
22Example: 23Example:
23 24
@@ -29,9 +30,9 @@ Example:
29 flash { 30 flash {
30 flash-timeout-us = <500000>; 31 flash-timeout-us = <500000>;
31 flash-max-microamp = <320000>; 32 flash-max-microamp = <320000>;
32 max-microamp = <50000>; 33 led-max-microamp = <50000>;
33 }; 34 };
34 indicator { 35 indicator {
35 max-microamp = <17500>; 36 led-max-microamp = <17500>;
36 }; 37 };
37 }; 38 };
diff --git a/Documentation/devicetree/bindings/media/stih407-c8sectpfe.txt b/Documentation/devicetree/bindings/media/stih407-c8sectpfe.txt
index d4def767bdfe..cc51b1fd6e0c 100644
--- a/Documentation/devicetree/bindings/media/stih407-c8sectpfe.txt
+++ b/Documentation/devicetree/bindings/media/stih407-c8sectpfe.txt
@@ -35,7 +35,7 @@ Required properties (tsin (child) node):
35 35
36- tsin-num : tsin id of the InputBlock (must be between 0 to 6) 36- tsin-num : tsin id of the InputBlock (must be between 0 to 6)
37- i2c-bus : phandle to the I2C bus DT node which the demodulators & tuners on this tsin channel are connected. 37- i2c-bus : phandle to the I2C bus DT node which the demodulators & tuners on this tsin channel are connected.
38- rst-gpio : reset gpio for this tsin channel. 38- reset-gpios : reset gpio for this tsin channel.
39 39
40Optional properties (tsin (child) node): 40Optional properties (tsin (child) node):
41 41
@@ -55,27 +55,27 @@ Example:
55 status = "okay"; 55 status = "okay";
56 reg = <0x08a20000 0x10000>, <0x08a00000 0x4000>; 56 reg = <0x08a20000 0x10000>, <0x08a00000 0x4000>;
57 reg-names = "stfe", "stfe-ram"; 57 reg-names = "stfe", "stfe-ram";
58 interrupts = <0 34 0>, <0 35 0>; 58 interrupts = <GIC_SPI 34 IRQ_TYPE_NONE>, <GIC_SPI 35 IRQ_TYPE_NONE>;
59 interrupt-names = "stfe-error-irq", "stfe-idle-irq"; 59 interrupt-names = "stfe-error-irq", "stfe-idle-irq";
60
61 pinctrl-names = "tsin0-serial", "tsin0-parallel", "tsin3-serial",
62 "tsin4-serial", "tsin5-serial";
63
64 pinctrl-0 = <&pinctrl_tsin0_serial>; 60 pinctrl-0 = <&pinctrl_tsin0_serial>;
65 pinctrl-1 = <&pinctrl_tsin0_parallel>; 61 pinctrl-1 = <&pinctrl_tsin0_parallel>;
66 pinctrl-2 = <&pinctrl_tsin3_serial>; 62 pinctrl-2 = <&pinctrl_tsin3_serial>;
67 pinctrl-3 = <&pinctrl_tsin4_serial_alt3>; 63 pinctrl-3 = <&pinctrl_tsin4_serial_alt3>;
68 pinctrl-4 = <&pinctrl_tsin5_serial_alt1>; 64 pinctrl-4 = <&pinctrl_tsin5_serial_alt1>;
69 65 pinctrl-names = "tsin0-serial",
66 "tsin0-parallel",
67 "tsin3-serial",
68 "tsin4-serial",
69 "tsin5-serial";
70 clocks = <&clk_s_c0_flexgen CLK_PROC_STFE>; 70 clocks = <&clk_s_c0_flexgen CLK_PROC_STFE>;
71 clock-names = "stfe"; 71 clock-names = "c8sectpfe";
72 72
73 /* tsin0 is TSA on NIMA */ 73 /* tsin0 is TSA on NIMA */
74 tsin0: port@0 { 74 tsin0: port@0 {
75 tsin-num = <0>; 75 tsin-num = <0>;
76 serial-not-parallel; 76 serial-not-parallel;
77 i2c-bus = <&ssc2>; 77 i2c-bus = <&ssc2>;
78 rst-gpio = <&pio15 4 0>; 78 reset-gpios = <&pio15 4 GPIO_ACTIVE_HIGH>;
79 dvb-card = <STV0367_TDA18212_NIMA_1>; 79 dvb-card = <STV0367_TDA18212_NIMA_1>;
80 }; 80 };
81 81
@@ -83,7 +83,7 @@ Example:
83 tsin-num = <3>; 83 tsin-num = <3>;
84 serial-not-parallel; 84 serial-not-parallel;
85 i2c-bus = <&ssc3>; 85 i2c-bus = <&ssc3>;
86 rst-gpio = <&pio15 7 0>; 86 reset-gpios = <&pio15 7 GPIO_ACTIVE_HIGH>;
87 dvb-card = <STV0367_TDA18212_NIMB_1>; 87 dvb-card = <STV0367_TDA18212_NIMB_1>;
88 }; 88 };
89 }; 89 };
diff --git a/Documentation/devicetree/bindings/memory-controllers/ath79-ddr-controller.txt b/Documentation/devicetree/bindings/memory-controllers/ath79-ddr-controller.txt
index efe35a065714..c81af75bcd88 100644
--- a/Documentation/devicetree/bindings/memory-controllers/ath79-ddr-controller.txt
+++ b/Documentation/devicetree/bindings/memory-controllers/ath79-ddr-controller.txt
@@ -1,6 +1,6 @@
1Binding for Qualcomm Atheros AR7xxx/AR9xxx DDR controller 1Binding for Qualcomm Atheros AR7xxx/AR9xxx DDR controller
2 2
3The DDR controller of the ARxxx and AR9xxx families provides an interface 3The DDR controller of the AR7xxx and AR9xxx families provides an interface
4to flush the FIFO between various devices and the DDR. This is mainly used 4to flush the FIFO between various devices and the DDR. This is mainly used
5by the IRQ controller to flush the FIFO before running the interrupt handler 5by the IRQ controller to flush the FIFO before running the interrupt handler
6of such devices. 6of such devices.
@@ -11,9 +11,9 @@ Required properties:
11 "qca,[ar7100|ar7240]-ddr-controller" as fallback. 11 "qca,[ar7100|ar7240]-ddr-controller" as fallback.
12 On SoC with PCI support "qca,ar7100-ddr-controller" should be used as 12 On SoC with PCI support "qca,ar7100-ddr-controller" should be used as
13 fallback, otherwise "qca,ar7240-ddr-controller" should be used. 13 fallback, otherwise "qca,ar7240-ddr-controller" should be used.
14- reg: Base address and size of the controllers memory area 14- reg: Base address and size of the controller's memory area
15- #qca,ddr-wb-channel-cells: has to be 1, the index of the write buffer 15- #qca,ddr-wb-channel-cells: Specifies the number of cells needed to encode
16 channel 16 the write buffer channel index, should be 1.
17 17
18Example: 18Example:
19 19
diff --git a/Documentation/devicetree/bindings/mfd/arizona.txt b/Documentation/devicetree/bindings/mfd/arizona.txt
index 18be0cbfb456..9b30011ecabe 100644
--- a/Documentation/devicetree/bindings/mfd/arizona.txt
+++ b/Documentation/devicetree/bindings/mfd/arizona.txt
@@ -1,4 +1,4 @@
1Wolfson Arizona class audio SoCs 1Cirrus Logic/Wolfson Microelectronics Arizona class audio SoCs
2 2
3These devices are audio SoCs with extensive digital capabilites and a range 3These devices are audio SoCs with extensive digital capabilites and a range
4of analogue I/O. 4of analogue I/O.
@@ -6,12 +6,14 @@ of analogue I/O.
6Required properties: 6Required properties:
7 7
8 - compatible : One of the following chip-specific strings: 8 - compatible : One of the following chip-specific strings:
9 "cirrus,cs47l24"
9 "wlf,wm5102" 10 "wlf,wm5102"
10 "wlf,wm5110" 11 "wlf,wm5110"
11 "wlf,wm8280" 12 "wlf,wm8280"
12 "wlf,wm8997" 13 "wlf,wm8997"
13 "wlf,wm8998" 14 "wlf,wm8998"
14 "wlf,wm1814" 15 "wlf,wm1814"
16 "wlf,wm1831"
15 17
16 - reg : I2C slave address when connected using I2C, chip select number when 18 - reg : I2C slave address when connected using I2C, chip select number when
17 using SPI. 19 using SPI.
@@ -24,7 +26,7 @@ Required properties:
24 - #interrupt-cells: the number of cells to describe an IRQ, this should be 2. 26 - #interrupt-cells: the number of cells to describe an IRQ, this should be 2.
25 The first cell is the IRQ number. 27 The first cell is the IRQ number.
26 The second cell is the flags, encoded as the trigger masks from 28 The second cell is the flags, encoded as the trigger masks from
27 Documentation/devicetree/bindings/interrupts.txt 29 Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
28 30
29 - gpio-controller : Indicates this device is a GPIO controller. 31 - gpio-controller : Indicates this device is a GPIO controller.
30 - #gpio-cells : Must be 2. The first cell is the pin number and the 32 - #gpio-cells : Must be 2. The first cell is the pin number and the
@@ -41,10 +43,21 @@ Required properties:
41 43
42 - SPKVDD-supply : Speaker driver power supply (wm8997) 44 - SPKVDD-supply : Speaker driver power supply (wm8997)
43 45
46 - DCVDD-supply : Main power supply (cs47l24, wm1831)
47
48 - MICVDD-supply : Microphone power supply (cs47l24, wm1831)
49
44Optional properties: 50Optional properties:
45 51
46 - wlf,reset : GPIO specifier for the GPIO controlling /RESET 52 - wlf,reset : GPIO specifier for the GPIO controlling /RESET
47 53
54 - clocks: Should reference the clocks supplied on MCLK1 and MCLK2
55 - clock-names: Should contains two strings:
56 "mclk1" for the clock supplied on MCLK1, recommended to be a high
57 quality audio reference clock
58 "mclk2" for the clock supplied on MCLK2, recommended to be an always on
59 32k clock
60
48 - wlf,gpio-defaults : A list of GPIO configuration register values. Defines 61 - wlf,gpio-defaults : A list of GPIO configuration register values. Defines
49 for the appropriate values can found in <dt-bindings/mfd/arizona.txt>. If 62 for the appropriate values can found in <dt-bindings/mfd/arizona.txt>. If
50 absent, no configuration of these registers is performed. If any entry has 63 absent, no configuration of these registers is performed. If any entry has
@@ -59,6 +72,12 @@ Optional properties:
59 that have not been specified are set to 0 by default. Entries are: 72 that have not been specified are set to 0 by default. Entries are:
60 <IN1, IN2, IN3, IN4> (wm5102, wm5110, wm8280, wm8997) 73 <IN1, IN2, IN3, IN4> (wm5102, wm5110, wm8280, wm8997)
61 <IN1A, IN2A, IN1B, IN2B> (wm8998, wm1814) 74 <IN1A, IN2A, IN1B, IN2B> (wm8998, wm1814)
75 - wlf,out-mono : A list of boolean values indicating whether each output is
76 mono or stereo. Position within the list indicates the output affected
77 (eg. First entry in the list corresponds to output 1). A non-zero value
78 indicates a mono output. If present, the number of values should be less
79 than or equal to the number of outputs, if less values are supplied the
80 additional outputs will be treated as stereo.
62 81
63 - wlf,dmic-ref : DMIC reference voltage source for each input, can be 82 - wlf,dmic-ref : DMIC reference voltage source for each input, can be
64 selected from either MICVDD or one of the MICBIAS's, defines 83 selected from either MICVDD or one of the MICBIAS's, defines
@@ -69,6 +88,7 @@ Optional properties:
69 - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if 88 - DCVDD-supply, MICVDD-supply : Power supplies, only need to be specified if
70 they are being externally supplied. As covered in 89 they are being externally supplied. As covered in
71 Documentation/devicetree/bindings/regulator/regulator.txt 90 Documentation/devicetree/bindings/regulator/regulator.txt
91 (wm5102, wm5110, wm8280, wm8997, wm8998, wm1814)
72 92
73Also see child specific device properties: 93Also see child specific device properties:
74 Regulator - ../regulator/arizona-regulator.txt 94 Regulator - ../regulator/arizona-regulator.txt
diff --git a/Documentation/devicetree/bindings/mfd/palmas.txt b/Documentation/devicetree/bindings/mfd/palmas.txt
index eda898978d33..8ae1a32bfb7e 100644
--- a/Documentation/devicetree/bindings/mfd/palmas.txt
+++ b/Documentation/devicetree/bindings/mfd/palmas.txt
@@ -24,7 +24,7 @@ and also the generic series names
24- #interrupt-cells : should be set to 2 for IRQ number and flags 24- #interrupt-cells : should be set to 2 for IRQ number and flags
25 The first cell is the IRQ number. 25 The first cell is the IRQ number.
26 The second cell is the flags, encoded as the trigger masks from 26 The second cell is the flags, encoded as the trigger masks from
27 Documentation/devicetree/bindings/interrupts.txt 27 Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
28- interrupt-parent : The parent interrupt controller. 28- interrupt-parent : The parent interrupt controller.
29 29
30Optional properties: 30Optional properties:
diff --git a/Documentation/devicetree/bindings/mfd/s2mpa01.txt b/Documentation/devicetree/bindings/mfd/s2mpa01.txt
deleted file mode 100644
index c13d3d8c3947..000000000000
--- a/Documentation/devicetree/bindings/mfd/s2mpa01.txt
+++ /dev/null
@@ -1,90 +0,0 @@
1
2* Samsung S2MPA01 Voltage and Current Regulator
3
4The Samsung S2MPA01 is a multi-function device which includes high
5efficiency buck converters including Dual-Phase buck converter, various LDOs,
6and an RTC. It is interfaced to the host controller using an I2C interface.
7Each sub-block is addressed by the host system using different I2C slave
8addresses.
9
10Required properties:
11- compatible: Should be "samsung,s2mpa01-pmic".
12- reg: Specifies the I2C slave address of the PMIC block. It should be 0x66.
13
14Optional properties:
15- interrupt-parent: Specifies the phandle of the interrupt controller to which
16 the interrupts from s2mpa01 are delivered to.
17- interrupts: An interrupt specifier for the sole interrupt generated by the
18 device.
19
20Optional nodes:
21- regulators: The regulators of s2mpa01 that have to be instantiated should be
22 included in a sub-node named 'regulators'. Regulator nodes and constraints
23 included in this sub-node use the standard regulator bindings which are
24 documented elsewhere.
25
26Properties for BUCK regulator nodes:
27- regulator-ramp-delay: ramp delay in uV/us. May be 6250, 12500
28 (default), 25000, or 50000. May be 0 for disabling the ramp delay on
29 BUCK{1,2,3,4}.
30
31 In the absence of the regulator-ramp-delay property, the default ramp
32 delay will be used.
33
34 NOTE: Some BUCKs share the ramp rate setting i.e. same ramp value will be set
35 for a particular group of BUCKs. So provide same regulator-ramp-delay=<value>.
36
37 The following BUCKs share ramp settings:
38 * 1 and 6
39 * 2 and 4
40 * 8, 9, and 10
41
42The following are the names of the regulators that the s2mpa01 PMIC block
43supports. Note: The 'n' in LDOn and BUCKn represents the LDO or BUCK number
44as per the datasheet of s2mpa01.
45
46 - LDOn
47 - valid values for n are 1 to 26
48 - Example: LDO1, LD02, LDO26
49 - BUCKn
50 - valid values for n are 1 to 10.
51 - Example: BUCK1, BUCK2, BUCK9
52
53Example:
54
55 s2mpa01_pmic@66 {
56 compatible = "samsung,s2mpa01-pmic";
57 reg = <0x66>;
58
59 regulators {
60 ldo1_reg: LDO1 {
61 regulator-name = "VDD_ALIVE";
62 regulator-min-microvolt = <1000000>;
63 regulator-max-microvolt = <1000000>;
64 };
65
66 ldo2_reg: LDO2 {
67 regulator-name = "VDDQ_MMC2";
68 regulator-min-microvolt = <2800000>;
69 regulator-max-microvolt = <2800000>;
70 regulator-always-on;
71 };
72
73 buck1_reg: BUCK1 {
74 regulator-name = "vdd_mif";
75 regulator-min-microvolt = <950000>;
76 regulator-max-microvolt = <1350000>;
77 regulator-always-on;
78 regulator-boot-on;
79 };
80
81 buck2_reg: BUCK2 {
82 regulator-name = "vdd_arm";
83 regulator-min-microvolt = <950000>;
84 regulator-max-microvolt = <1350000>;
85 regulator-always-on;
86 regulator-boot-on;
87 regulator-ramp-delay = <50000>;
88 };
89 };
90 };
diff --git a/Documentation/devicetree/bindings/mfd/s2mps11.txt b/Documentation/devicetree/bindings/mfd/s2mps11.txt
deleted file mode 100644
index 09b94c97faac..000000000000
--- a/Documentation/devicetree/bindings/mfd/s2mps11.txt
+++ /dev/null
@@ -1,153 +0,0 @@
1
2* Samsung S2MPS11/13/14/15 and S2MPU02 Voltage and Current Regulator
3
4The Samsung S2MPS11 is a multi-function device which includes voltage and
5current regulators, RTC, charger controller and other sub-blocks. It is
6interfaced to the host controller using an I2C interface. Each sub-block is
7addressed by the host system using different I2C slave addresses.
8
9Required properties:
10- compatible: Should be one of the following
11 - "samsung,s2mps11-pmic"
12 - "samsung,s2mps13-pmic"
13 - "samsung,s2mps14-pmic"
14 - "samsung,s2mps15-pmic"
15 - "samsung,s2mpu02-pmic".
16- reg: Specifies the I2C slave address of the pmic block. It should be 0x66.
17
18Optional properties:
19- interrupt-parent: Specifies the phandle of the interrupt controller to which
20 the interrupts from s2mps11 are delivered to.
21- interrupts: Interrupt specifiers for interrupt sources.
22- samsung,s2mps11-wrstbi-ground: Indicates that WRSTBI pin of PMIC is pulled
23 down. When the system is suspended it will always go down thus triggerring
24 unwanted buck warm reset (setting buck voltages to default values).
25- samsung,s2mps11-acokb-ground: Indicates that ACOKB pin of S2MPS11 PMIC is
26 connected to the ground so the PMIC must manually set PWRHOLD bit in CTRL1
27 register to turn off the power. Usually the ACOKB is pulled up to VBATT so
28 when PWRHOLD pin goes low, the rising ACOKB will trigger power off.
29
30Optional nodes:
31- clocks: s2mps11, s2mps13, s2mps15 and s5m8767 provide three(AP/CP/BT) buffered 32.768
32 KHz outputs, so to register these as clocks with common clock framework
33 instantiate a sub-node named "clocks". It uses the common clock binding
34 documented in :
35 [Documentation/devicetree/bindings/clock/clock-bindings.txt]
36 The s2mps14 provides two (AP/BT) buffered 32.768 KHz outputs.
37 - #clock-cells: should be 1.
38
39 - The following is the list of clocks generated by the controller. Each clock
40 is assigned an identifier and client nodes use this identifier to specify
41 the clock which they consume.
42 Clock ID Devices
43 ----------------------------------------------------------
44 32KhzAP 0 S2MPS11, S2MPS13, S2MPS14, S2MPS15, S5M8767
45 32KhzCP 1 S2MPS11, S2MPS13, S2MPS15, S5M8767
46 32KhzBT 2 S2MPS11, S2MPS13, S2MPS14, S2MPS15, S5M8767
47
48 - compatible: Should be one of: "samsung,s2mps11-clk", "samsung,s2mps13-clk",
49 "samsung,s2mps14-clk", "samsung,s5m8767-clk"
50 The s2msp15 uses the same compatible as s2mps13, as both provides similar clocks.
51
52- regulators: The regulators of s2mps11 that have to be instantiated should be
53included in a sub-node named 'regulators'. Regulator nodes included in this
54sub-node should be of the format as listed below.
55
56 regulator_name {
57 [standard regulator constraints....];
58 };
59
60 regulator-ramp-delay for BUCKs = [6250/12500/25000(default)/50000] uV/us
61
62 BUCK[2/3/4/6] supports disabling ramp delay on hardware, so explicitly
63 regulator-ramp-delay = <0> can be used for them to disable ramp delay.
64 In the absence of the regulator-ramp-delay property, the default ramp
65 delay will be used.
66
67NOTE: Some BUCKs share the ramp rate setting i.e. same ramp value will be set
68for a particular group of BUCKs. So provide same regulator-ramp-delay<value>.
69Grouping of BUCKs sharing ramp rate setting is as follow : BUCK[1, 6],
70BUCK[3, 4], and BUCK[7, 8, 10]
71
72On S2MPS14 the LDO10, LDO11 and LDO12 can be configured to external control
73over GPIO. To turn this feature on this property must be added to the regulator
74sub-node:
75 - samsung,ext-control-gpios: GPIO specifier for one GPIO
76 controlling this regulator (enable/disable);
77Example:
78 LDO12 {
79 regulator-name = "V_EMMC_2.8V";
80 regulator-min-microvolt = <2800000>;
81 regulator-max-microvolt = <2800000>;
82 samsung,ext-control-gpios = <&gpk0 2 0>;
83 };
84
85
86The regulator constraints inside the regulator nodes use the standard regulator
87bindings which are documented elsewhere.
88
89The following are the names of the regulators that the s2mps11 pmic block
90supports. Note: The 'n' in LDOn and BUCKn represents the LDO or BUCK number
91as per the datasheet of s2mps11.
92
93 - LDOn
94 - valid values for n are:
95 - S2MPS11: 1 to 38
96 - S2MPS13: 1 to 40
97 - S2MPS14: 1 to 25
98 - S2MPS15: 1 to 27
99 - S2MPU02: 1 to 28
100 - Example: LDO1, LDO2, LDO28
101 - BUCKn
102 - valid values for n are:
103 - S2MPS11: 1 to 10
104 - S2MPS13: 1 to 10
105 - S2MPS14: 1 to 5
106 - S2MPS15: 1 to 10
107 - S2MPU02: 1 to 7
108 - Example: BUCK1, BUCK2, BUCK9
109
110Example:
111
112 s2mps11_pmic@66 {
113 compatible = "samsung,s2mps11-pmic";
114 reg = <0x66>;
115
116 s2m_osc: clocks {
117 compatible = "samsung,s2mps11-clk";
118 #clock-cells = <1>;
119 clock-output-names = "xx", "yy", "zz";
120 };
121
122 regulators {
123 ldo1_reg: LDO1 {
124 regulator-name = "VDD_ABB_3.3V";
125 regulator-min-microvolt = <3300000>;
126 regulator-max-microvolt = <3300000>;
127 };
128
129 ldo2_reg: LDO2 {
130 regulator-name = "VDD_ALIVE_1.1V";
131 regulator-min-microvolt = <1100000>;
132 regulator-max-microvolt = <1100000>;
133 regulator-always-on;
134 };
135
136 buck1_reg: BUCK1 {
137 regulator-name = "vdd_mif";
138 regulator-min-microvolt = <950000>;
139 regulator-max-microvolt = <1350000>;
140 regulator-always-on;
141 regulator-boot-on;
142 };
143
144 buck2_reg: BUCK2 {
145 regulator-name = "vdd_arm";
146 regulator-min-microvolt = <950000>;
147 regulator-max-microvolt = <1350000>;
148 regulator-always-on;
149 regulator-boot-on;
150 regulator-ramp-delay = <50000>;
151 };
152 };
153 };
diff --git a/Documentation/devicetree/bindings/mfd/samsung,sec-core.txt b/Documentation/devicetree/bindings/mfd/samsung,sec-core.txt
new file mode 100644
index 000000000000..cdd079bfc287
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/samsung,sec-core.txt
@@ -0,0 +1,88 @@
1Binding for Samsung S2M and S5M family multi-function device
2============================================================
3
4This is a part of device tree bindings for S2M and S5M family multi-function
5devices.
6
7The Samsung S2MPA01, S2MPS11/13/14/15, S2MPU02 and S5M8767 is a family
8of multi-function devices which include voltage and current regulators, RTC,
9charger controller, clock outputs and other sub-blocks. It is interfaced
10to the host controller using an I2C interface. Each sub-block is usually
11addressed by the host system using different I2C slave addresses.
12
13
14This document describes bindings for main device node. Optional sub-blocks
15must be a sub-nodes to it. Bindings for them can be found in:
16 - bindings/regulator/samsung,s2mpa01.txt
17 - bindings/regulator/samsung,s2mps11.txt
18 - bindings/regulator/samsung,s5m8767.txt
19 - bindings/clock/samsung,s2mps11.txt
20
21
22Required properties:
23 - compatible: Should be one of the following
24 - "samsung,s2mpa01-pmic",
25 - "samsung,s2mps11-pmic",
26 - "samsung,s2mps13-pmic",
27 - "samsung,s2mps14-pmic",
28 - "samsung,s2mps15-pmic",
29 - "samsung,s2mpu02-pmic",
30 - "samsung,s5m8767-pmic".
31 - reg: Specifies the I2C slave address of the pmic block. It should be 0x66.
32
33Optional properties:
34 - interrupt-parent: Specifies the phandle of the interrupt controller to which
35 the interrupts from s2mps11 are delivered to.
36 - interrupts: Interrupt specifiers for interrupt sources.
37 - samsung,s2mps11-wrstbi-ground: Indicates that WRSTBI pin of PMIC is pulled
38 down. When the system is suspended it will always go down thus triggerring
39 unwanted buck warm reset (setting buck voltages to default values).
40 - samsung,s2mps11-acokb-ground: Indicates that ACOKB pin of S2MPS11 PMIC is
41 connected to the ground so the PMIC must manually set PWRHOLD bit in CTRL1
42 register to turn off the power. Usually the ACOKB is pulled up to VBATT so
43 when PWRHOLD pin goes low, the rising ACOKB will trigger power off.
44
45Example:
46
47 s2mps11_pmic@66 {
48 compatible = "samsung,s2mps11-pmic";
49 reg = <0x66>;
50
51 s2m_osc: clocks {
52 compatible = "samsung,s2mps11-clk";
53 #clock-cells = <1>;
54 clock-output-names = "xx", "yy", "zz";
55 };
56
57 regulators {
58 ldo1_reg: LDO1 {
59 regulator-name = "VDD_ABB_3.3V";
60 regulator-min-microvolt = <3300000>;
61 regulator-max-microvolt = <3300000>;
62 };
63
64 ldo2_reg: LDO2 {
65 regulator-name = "VDD_ALIVE_1.1V";
66 regulator-min-microvolt = <1100000>;
67 regulator-max-microvolt = <1100000>;
68 regulator-always-on;
69 };
70
71 buck1_reg: BUCK1 {
72 regulator-name = "vdd_mif";
73 regulator-min-microvolt = <950000>;
74 regulator-max-microvolt = <1350000>;
75 regulator-always-on;
76 regulator-boot-on;
77 };
78
79 buck2_reg: BUCK2 {
80 regulator-name = "vdd_arm";
81 regulator-min-microvolt = <950000>;
82 regulator-max-microvolt = <1350000>;
83 regulator-always-on;
84 regulator-boot-on;
85 regulator-ramp-delay = <50000>;
86 };
87 };
88 };
diff --git a/Documentation/devicetree/bindings/mfd/syscon.txt b/Documentation/devicetree/bindings/mfd/syscon.txt
index fe8150bb3248..408f768686f1 100644
--- a/Documentation/devicetree/bindings/mfd/syscon.txt
+++ b/Documentation/devicetree/bindings/mfd/syscon.txt
@@ -13,6 +13,10 @@ Required properties:
13- compatible: Should contain "syscon". 13- compatible: Should contain "syscon".
14- reg: the register region can be accessed from syscon 14- reg: the register region can be accessed from syscon
15 15
16Optional property:
17- reg-io-width: the size (in bytes) of the IO accesses that should be
18 performed on the device.
19
16Examples: 20Examples:
17gpr: iomuxc-gpr@020e0000 { 21gpr: iomuxc-gpr@020e0000 {
18 compatible = "fsl,imx6q-iomuxc-gpr", "syscon"; 22 compatible = "fsl,imx6q-iomuxc-gpr", "syscon";
diff --git a/Documentation/devicetree/bindings/mmc/renesas,mmcif.txt b/Documentation/devicetree/bindings/mmc/renesas,mmcif.txt
index cae29eb5733d..ff611fa66871 100644
--- a/Documentation/devicetree/bindings/mmc/renesas,mmcif.txt
+++ b/Documentation/devicetree/bindings/mmc/renesas,mmcif.txt
@@ -11,6 +11,7 @@ Required properties:
11 - "renesas,mmcif-r8a7740" for the MMCIF found in r8a7740 SoCs 11 - "renesas,mmcif-r8a7740" for the MMCIF found in r8a7740 SoCs
12 - "renesas,mmcif-r8a7790" for the MMCIF found in r8a7790 SoCs 12 - "renesas,mmcif-r8a7790" for the MMCIF found in r8a7790 SoCs
13 - "renesas,mmcif-r8a7791" for the MMCIF found in r8a7791 SoCs 13 - "renesas,mmcif-r8a7791" for the MMCIF found in r8a7791 SoCs
14 - "renesas,mmcif-r8a7793" for the MMCIF found in r8a7793 SoCs
14 - "renesas,mmcif-r8a7794" for the MMCIF found in r8a7794 SoCs 15 - "renesas,mmcif-r8a7794" for the MMCIF found in r8a7794 SoCs
15 16
16- clocks: reference to the functional clock 17- clocks: reference to the functional clock
diff --git a/Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt b/Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt
index 4ff7128ee3b2..c2546ced9c02 100644
--- a/Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt
+++ b/Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt
@@ -45,6 +45,8 @@ Required properties:
45- #size-cells : <0> 45- #size-cells : <0>
46 46
47Optional properties: 47Optional properties:
48- clock : reference to the clock for the NAND controller
49- clock-names : "nand" (required for the above clock)
48- brcm,nand-has-wp : Some versions of this IP include a write-protect 50- brcm,nand-has-wp : Some versions of this IP include a write-protect
49 (WP) control bit. It is always available on >= 51 (WP) control bit. It is always available on >=
50 v7.0. Use this property to describe the rare 52 v7.0. Use this property to describe the rare
@@ -72,6 +74,12 @@ we define additional 'compatible' properties and associated register resources w
72 and enable registers 74 and enable registers
73 - reg-names: (required) "nand-int-base" 75 - reg-names: (required) "nand-int-base"
74 76
77 * "brcm,nand-bcm6368"
78 - compatible: should contain "brcm,nand-bcm<soc>", "brcm,nand-bcm6368"
79 - reg: (required) the 'NAND_INTR_BASE' register range, with combined status
80 and enable registers, and boot address registers
81 - reg-names: (required) "nand-int-base"
82
75 * "brcm,nand-iproc" 83 * "brcm,nand-iproc"
76 - reg: (required) the "IDM" register range, for interrupt enable and APB 84 - reg: (required) the "IDM" register range, for interrupt enable and APB
77 bus access endianness configuration, and the "EXT" register range, 85 bus access endianness configuration, and the "EXT" register range,
@@ -148,3 +156,27 @@ nand@f0442800 {
148 }; 156 };
149 }; 157 };
150}; 158};
159
160nand@10000200 {
161 compatible = "brcm,nand-bcm63168", "brcm,nand-bcm6368",
162 "brcm,brcmnand-v4.0", "brcm,brcmnand";
163 reg = <0x10000200 0x180>,
164 <0x10000600 0x200>,
165 <0x100000b0 0x10>;
166 reg-names = "nand", "nand-cache", "nand-int-base";
167 interrupt-parent = <&periph_intc>;
168 interrupts = <50>;
169 clocks = <&periph_clk 20>;
170 clock-names = "nand";
171
172 #address-cells = <1>;
173 #size-cells = <0>;
174
175 nand0: nandcs@0 {
176 compatible = "brcm,nandcs";
177 reg = <0>;
178 nand-on-flash-bbt;
179 nand-ecc-strength = <1>;
180 nand-ecc-step-size = <512>;
181 };
182};
diff --git a/Documentation/devicetree/bindings/mtd/fsl-quadspi.txt b/Documentation/devicetree/bindings/mtd/fsl-quadspi.txt
index 862aa2f8837a..00c587b3d3ae 100644
--- a/Documentation/devicetree/bindings/mtd/fsl-quadspi.txt
+++ b/Documentation/devicetree/bindings/mtd/fsl-quadspi.txt
@@ -2,7 +2,8 @@
2 2
3Required properties: 3Required properties:
4 - compatible : Should be "fsl,vf610-qspi", "fsl,imx6sx-qspi", 4 - compatible : Should be "fsl,vf610-qspi", "fsl,imx6sx-qspi",
5 "fsl,imx7d-qspi", "fsl,imx6ul-qspi" 5 "fsl,imx7d-qspi", "fsl,imx6ul-qspi",
6 "fsl,ls1021-qspi"
6 - reg : the first contains the register location and length, 7 - reg : the first contains the register location and length,
7 the second contains the memory mapping address and length 8 the second contains the memory mapping address and length
8 - reg-names: Should contain the reg names "QuadSPI" and "QuadSPI-memory" 9 - reg-names: Should contain the reg names "QuadSPI" and "QuadSPI-memory"
diff --git a/Documentation/devicetree/bindings/mtd/ingenic,jz4780-nand.txt b/Documentation/devicetree/bindings/mtd/ingenic,jz4780-nand.txt
new file mode 100644
index 000000000000..29ea5853ca91
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/ingenic,jz4780-nand.txt
@@ -0,0 +1,86 @@
1* Ingenic JZ4780 NAND/BCH
2
3This file documents the device tree bindings for NAND flash devices on the
4JZ4780. NAND devices are connected to the NEMC controller (described in
5memory-controllers/ingenic,jz4780-nemc.txt), and thus NAND device nodes must
6be children of the NEMC node.
7
8Required NAND controller device properties:
9- compatible: Should be set to "ingenic,jz4780-nand".
10- reg: For each bank with a NAND chip attached, should specify a bank number,
11 an offset of 0 and a size of 0x1000000 (i.e. the whole NEMC bank).
12
13Optional NAND controller device properties:
14- ingenic,bch-controller: To make use of the hardware BCH controller, this
15 property must contain a phandle for the BCH controller node. The required
16 properties for this node are described below. If this is not specified,
17 software BCH will be used instead.
18
19Optional children nodes:
20- Individual NAND chips are children of the NAND controller node.
21
22Required children node properties:
23- reg: An integer ranging from 1 to 6 representing the CS line to use.
24
25Optional children node properties:
26- nand-ecc-step-size: ECC block size in bytes.
27- nand-ecc-strength: ECC strength (max number of correctable bits).
28- nand-ecc-mode: String, operation mode of the NAND ecc mode. "hw" by default
29- nand-on-flash-bbt: boolean to enable on flash bbt option, if not present false
30- rb-gpios: GPIO specifier for the busy pin.
31- wp-gpios: GPIO specifier for the write protect pin.
32
33Optional child node of NAND chip nodes:
34- partitions: see Documentation/devicetree/bindings/mtd/partition.txt
35
36Example:
37
38nemc: nemc@13410000 {
39 ...
40
41 nandc: nand-controller@1 {
42 compatible = "ingenic,jz4780-nand";
43 reg = <1 0 0x1000000>; /* Bank 1 */
44
45 #address-cells = <1>;
46 #size-cells = <0>;
47
48 ingenic,bch-controller = <&bch>;
49
50 nand@1 {
51 reg = <1>;
52
53 nand-ecc-step-size = <1024>;
54 nand-ecc-strength = <24>;
55 nand-ecc-mode = "hw";
56 nand-on-flash-bbt;
57
58 rb-gpios = <&gpa 20 GPIO_ACTIVE_LOW>;
59 wp-gpios = <&gpf 22 GPIO_ACTIVE_LOW>;
60
61 partitions {
62 #address-cells = <2>;
63 #size-cells = <2>;
64 ...
65 }
66 };
67 };
68};
69
70The BCH controller is a separate SoC component used for error correction on
71NAND devices. The following is a description of the device properties for a
72BCH controller.
73
74Required BCH properties:
75- compatible: Should be set to "ingenic,jz4780-bch".
76- reg: Should specify the BCH controller registers location and length.
77- clocks: Clock for the BCH controller.
78
79Example:
80
81bch: bch@134d0000 {
82 compatible = "ingenic,jz4780-bch";
83 reg = <0x134d0000 0x10000>;
84
85 clocks = <&cgu JZ4780_CLK_BCH>;
86};
diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt
index 2bee68103b01..2c91c03e7eb0 100644
--- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt
+++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt
@@ -1,15 +1,61 @@
1* MTD SPI driver for ST M25Pxx (and similar) serial flash chips 1* SPI NOR flash: ST M25Pxx (and similar) serial flash chips
2 2
3Required properties: 3Required properties:
4- #address-cells, #size-cells : Must be present if the device has sub-nodes 4- #address-cells, #size-cells : Must be present if the device has sub-nodes
5 representing partitions. 5 representing partitions.
6- compatible : May include a device-specific string consisting of the 6- compatible : May include a device-specific string consisting of the
7 manufacturer and name of the chip. Bear in mind the DT binding 7 manufacturer and name of the chip. A list of supported chip
8 is not Linux-only, but in case of Linux, see the "m25p_ids" 8 names follows.
9 table in drivers/mtd/devices/m25p80.c for the list of supported
10 chips.
11 Must also include "jedec,spi-nor" for any SPI NOR flash that can 9 Must also include "jedec,spi-nor" for any SPI NOR flash that can
12 be identified by the JEDEC READ ID opcode (0x9F). 10 be identified by the JEDEC READ ID opcode (0x9F).
11
12 Supported chip names:
13 at25df321a
14 at25df641
15 at26df081a
16 mr25h256
17 mx25l4005a
18 mx25l1606e
19 mx25l6405d
20 mx25l12805d
21 mx25l25635e
22 n25q064
23 n25q128a11
24 n25q128a13
25 n25q512a
26 s25fl256s1
27 s25fl512s
28 s25sl12801
29 s25fl008k
30 s25fl064k
31 sst25vf040b
32 m25p40
33 m25p80
34 m25p16
35 m25p32
36 m25p64
37 m25p128
38 w25x80
39 w25x32
40 w25q32
41 w25q32dw
42 w25q80bl
43 w25q128
44 w25q256
45
46 The following chip names have been used historically to
47 designate quirky versions of flash chips that do not support the
48 JEDEC READ ID opcode (0x9F):
49 m25p05-nonjedec
50 m25p10-nonjedec
51 m25p20-nonjedec
52 m25p40-nonjedec
53 m25p80-nonjedec
54 m25p16-nonjedec
55 m25p32-nonjedec
56 m25p64-nonjedec
57 m25p128-nonjedec
58
13- reg : Chip-Select number 59- reg : Chip-Select number
14- spi-max-frequency : Maximum frequency of the SPI bus the chip can operate at 60- spi-max-frequency : Maximum frequency of the SPI bus the chip can operate at
15 61
diff --git a/Documentation/devicetree/bindings/mtd/mtk-quadspi.txt b/Documentation/devicetree/bindings/mtd/mtk-quadspi.txt
new file mode 100644
index 000000000000..fb314f09861b
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/mtk-quadspi.txt
@@ -0,0 +1,41 @@
1* Serial NOR flash controller for MTK MT81xx (and similar)
2
3Required properties:
4- compatible: should be "mediatek,mt8173-nor";
5- reg: physical base address and length of the controller's register
6- clocks: the phandle of the clocks needed by the nor controller
7- clock-names: the names of the clocks
8 the clocks should be named "spi" and "sf". "spi" is used for spi bus,
9 and "sf" is used for controller, these are the clocks witch
10 hardware needs to enabling nor flash and nor flash controller.
11 See Documentation/devicetree/bindings/clock/clock-bindings.txt for details.
12- #address-cells: should be <1>
13- #size-cells: should be <0>
14
15The SPI flash must be a child of the nor_flash node and must have a
16compatible property. Also see jedec,spi-nor.txt.
17
18Required properties:
19- compatible: May include a device-specific string consisting of the manufacturer
20 and name of the chip. Must also include "jedec,spi-nor" for any
21 SPI NOR flash that can be identified by the JEDEC READ ID opcode (0x9F).
22- reg : Chip-Select number
23
24Example:
25
26nor_flash: spi@1100d000 {
27 compatible = "mediatek,mt8173-nor";
28 reg = <0 0x1100d000 0 0xe0>;
29 clocks = <&pericfg CLK_PERI_SPI>,
30 <&topckgen CLK_TOP_SPINFI_IFR_SEL>;
31 clock-names = "spi", "sf";
32 #address-cells = <1>;
33 #size-cells = <0>;
34 status = "disabled";
35
36 flash@0 {
37 compatible = "jedec,spi-nor";
38 reg = <0>;
39 };
40};
41
diff --git a/Documentation/devicetree/bindings/mtd/partition.txt b/Documentation/devicetree/bindings/mtd/partition.txt
index 1c63e40659fc..81a224da63be 100644
--- a/Documentation/devicetree/bindings/mtd/partition.txt
+++ b/Documentation/devicetree/bindings/mtd/partition.txt
@@ -32,6 +32,8 @@ Optional properties:
32 partition should only be mounted read-only. This is usually used for flash 32 partition should only be mounted read-only. This is usually used for flash
33 partitions containing early-boot firmware images or data which should not be 33 partitions containing early-boot firmware images or data which should not be
34 clobbered. 34 clobbered.
35- lock : Do not unlock the partition at initialization time (not supported on
36 all devices)
35 37
36Examples: 38Examples:
37 39
diff --git a/Documentation/devicetree/bindings/net/cdns-emac.txt b/Documentation/devicetree/bindings/net/cdns-emac.txt
deleted file mode 100644
index 4451ee973223..000000000000
--- a/Documentation/devicetree/bindings/net/cdns-emac.txt
+++ /dev/null
@@ -1,20 +0,0 @@
1* Cadence EMAC Ethernet controller
2
3Required properties:
4- compatible: Should be "cdns,[<chip>-]{emac}"
5 Use "cdns,at91rm9200-emac" Atmel at91rm9200 SoC.
6 Use "cdns,zynq-gem" Xilinx Zynq-7xxx SoC.
7 Or the generic form: "cdns,emac".
8- reg: Address and length of the register set for the device
9- interrupts: Should contain macb interrupt
10- phy-mode: see ethernet.txt file in the same directory.
11
12Examples:
13
14 macb0: ethernet@fffc4000 {
15 compatible = "cdns,at91rm9200-emac";
16 reg = <0xfffc4000 0x4000>;
17 interrupts = <21>;
18 phy-mode = "rmii";
19 local-mac-address = [3a 0e 03 04 05 06];
20 };
diff --git a/Documentation/devicetree/bindings/net/cpsw.txt b/Documentation/devicetree/bindings/net/cpsw.txt
index 9853f8e70966..28a4781ab6d7 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -40,18 +40,18 @@ Optional properties:
40 40
41Slave Properties: 41Slave Properties:
42Required properties: 42Required properties:
43- phy_id : Specifies slave phy id
44- phy-mode : See ethernet.txt file in the same directory 43- phy-mode : See ethernet.txt file in the same directory
45 44
46Optional properties: 45Optional properties:
47- dual_emac_res_vlan : Specifies VID to be used to segregate the ports 46- dual_emac_res_vlan : Specifies VID to be used to segregate the ports
48- mac-address : See ethernet.txt file in the same directory 47- mac-address : See ethernet.txt file in the same directory
48- phy_id : Specifies slave phy id
49- phy-handle : See ethernet.txt file in the same directory 49- phy-handle : See ethernet.txt file in the same directory
50 50
51Slave sub-nodes: 51Slave sub-nodes:
52- fixed-link : See fixed-link.txt file in the same directory 52- fixed-link : See fixed-link.txt file in the same directory
53 Either the properties phy_id and phy-mode, 53 Either the property phy_id, or the sub-node
54 or the sub-node fixed-link can be specified 54 fixed-link can be specified
55 55
56Note: "ti,hwmods" field is used to fetch the base address and irq 56Note: "ti,hwmods" field is used to fetch the base address and irq
57resources from TI, omap hwmod data base during device registration. 57resources from TI, omap hwmod data base during device registration.
diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.txt b/Documentation/devicetree/bindings/net/dsa/dsa.txt
index 04e6bef3ac3f..5fdbbcdf8c4b 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.txt
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.txt
@@ -31,6 +31,8 @@ A switch child node has the following optional property:
31 switch. Must be set if the switch can not detect 31 switch. Must be set if the switch can not detect
32 the presence and/or size of a connected EEPROM, 32 the presence and/or size of a connected EEPROM,
33 otherwise optional. 33 otherwise optional.
34- reset-gpios : phandle and specifier to a gpio line connected to
35 reset pin of the switch chip.
34 36
35A switch may have multiple "port" children nodes 37A switch may have multiple "port" children nodes
36 38
@@ -114,6 +116,7 @@ Example:
114 #size-cells = <0>; 116 #size-cells = <0>;
115 reg = <17 1>; /* MDIO address 17, switch 1 in tree */ 117 reg = <17 1>; /* MDIO address 17, switch 1 in tree */
116 mii-bus = <&mii_bus1>; 118 mii-bus = <&mii_bus1>;
119 reset-gpios = <&gpio5 1 GPIO_ACTIVE_LOW>;
117 120
118 switch1port0: port@0 { 121 switch1port0: port@0 {
119 reg = <0>; 122 reg = <0>;
diff --git a/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt b/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
index 9c23fdf25018..4a7ede9657b0 100644
--- a/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
+++ b/Documentation/devicetree/bindings/net/hisilicon-hns-mdio.txt
@@ -1,7 +1,12 @@
1Hisilicon MDIO bus controller 1Hisilicon MDIO bus controller
2 2
3Properties: 3Properties:
4- compatible: "hisilicon,mdio","hisilicon,hns-mdio". 4- compatible: can be one of:
5 "hisilicon,hns-mdio"
6 "hisilicon,mdio"
7 "hisilicon,hns-mdio" is recommended to be used for hip05 and later SOCs,
8 while "hisilicon,mdio" is optional for backwards compatibility only on
9 hip04 Soc.
5- reg: The base address of the MDIO bus controller register bank. 10- reg: The base address of the MDIO bus controller register bank.
6- #address-cells: Must be <1>. 11- #address-cells: Must be <1>.
7- #size-cells: Must be <0>. MDIO addresses have no size component. 12- #size-cells: Must be <0>. MDIO addresses have no size component.
diff --git a/Documentation/devicetree/bindings/net/ieee802154/adf7242.txt b/Documentation/devicetree/bindings/net/ieee802154/adf7242.txt
new file mode 100644
index 000000000000..dea5124cdc52
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/ieee802154/adf7242.txt
@@ -0,0 +1,18 @@
1* ADF7242 IEEE 802.15.4 *
2
3Required properties:
4 - compatible: should be "adi,adf7242"
5 - spi-max-frequency: maximal bus speed (12.5 MHz)
6 - reg: the chipselect index
7 - interrupts: the interrupt generated by the device via pin IRQ1.
8 IRQ_TYPE_LEVEL_HIGH (4) or IRQ_TYPE_EDGE_FALLING (1)
9
10Example:
11
12 adf7242@0 {
13 compatible = "adi,adf7242";
14 spi-max-frequency = <10000000>;
15 reg = <0>;
16 interrupts = <98 IRQ_TYPE_LEVEL_HIGH>;
17 interrupt-parent = <&gpio3>;
18 };
diff --git a/Documentation/devicetree/bindings/net/macb.txt b/Documentation/devicetree/bindings/net/macb.txt
index b5d79761ac97..d2e243b1ec0e 100644
--- a/Documentation/devicetree/bindings/net/macb.txt
+++ b/Documentation/devicetree/bindings/net/macb.txt
@@ -2,15 +2,19 @@
2 2
3Required properties: 3Required properties:
4- compatible: Should be "cdns,[<chip>-]{macb|gem}" 4- compatible: Should be "cdns,[<chip>-]{macb|gem}"
5 Use "cdns,at91rm9200-emac" Atmel at91rm9200 SoC.
5 Use "cdns,at91sam9260-macb" for Atmel at91sam9 SoCs or the 10/100Mbit IP 6 Use "cdns,at91sam9260-macb" for Atmel at91sam9 SoCs or the 10/100Mbit IP
6 available on sama5d3 SoCs. 7 available on sama5d3 SoCs.
8 Use "cdns,np4-macb" for NP4 SoC devices.
7 Use "cdns,at32ap7000-macb" for other 10/100 usage or use the generic form: "cdns,macb". 9 Use "cdns,at32ap7000-macb" for other 10/100 usage or use the generic form: "cdns,macb".
8 Use "cdns,pc302-gem" for Picochip picoXcell pc302 and later devices based on 10 Use "cdns,pc302-gem" for Picochip picoXcell pc302 and later devices based on
9 the Cadence GEM, or the generic form: "cdns,gem". 11 the Cadence GEM, or the generic form: "cdns,gem".
10 Use "atmel,sama5d2-gem" for the GEM IP (10/100) available on Atmel sama5d2 SoCs. 12 Use "atmel,sama5d2-gem" for the GEM IP (10/100) available on Atmel sama5d2 SoCs.
11 Use "atmel,sama5d3-gem" for the Gigabit IP available on Atmel sama5d3 SoCs. 13 Use "atmel,sama5d3-gem" for the Gigabit IP available on Atmel sama5d3 SoCs.
12 Use "atmel,sama5d4-gem" for the GEM IP (10/100) available on Atmel sama5d4 SoCs. 14 Use "atmel,sama5d4-gem" for the GEM IP (10/100) available on Atmel sama5d4 SoCs.
15 Use "cdns,zynq-gem" Xilinx Zynq-7xxx SoC.
13 Use "cdns,zynqmp-gem" for Zynq Ultrascale+ MPSoC. 16 Use "cdns,zynqmp-gem" for Zynq Ultrascale+ MPSoC.
17 Or the generic form: "cdns,emac".
14- reg: Address and length of the register set for the device 18- reg: Address and length of the register set for the device
15- interrupts: Should contain macb interrupt 19- interrupts: Should contain macb interrupt
16- phy-mode: See ethernet.txt file in the same directory. 20- phy-mode: See ethernet.txt file in the same directory.
@@ -19,6 +23,9 @@ Required properties:
19 Optional elements: 'tx_clk' 23 Optional elements: 'tx_clk'
20- clocks: Phandles to input clocks. 24- clocks: Phandles to input clocks.
21 25
26Optional properties for PHY child node:
27- reset-gpios : Should specify the gpio for phy reset
28
22Examples: 29Examples:
23 30
24 macb0: ethernet@fffc4000 { 31 macb0: ethernet@fffc4000 {
@@ -29,4 +36,8 @@ Examples:
29 local-mac-address = [3a 0e 03 04 05 06]; 36 local-mac-address = [3a 0e 03 04 05 06];
30 clock-names = "pclk", "hclk", "tx_clk"; 37 clock-names = "pclk", "hclk", "tx_clk";
31 clocks = <&clkc 30>, <&clkc 30>, <&clkc 13>; 38 clocks = <&clkc 30>, <&clkc 30>, <&clkc 13>;
39 ethernet-phy@1 {
40 reg = <0x1>;
41 reset-gpios = <&pioE 6 1>;
42 };
32 }; 43 };
diff --git a/Documentation/devicetree/bindings/net/micrel-ksz90x1.txt b/Documentation/devicetree/bindings/net/micrel-ksz90x1.txt
index 692076fda0e5..f9c32adab5c6 100644
--- a/Documentation/devicetree/bindings/net/micrel-ksz90x1.txt
+++ b/Documentation/devicetree/bindings/net/micrel-ksz90x1.txt
@@ -1,8 +1,9 @@
1Micrel KSZ9021/KSZ9031 Gigabit Ethernet PHY 1Micrel KSZ9021/KSZ9031 Gigabit Ethernet PHY
2 2
3Some boards require special tuning values, particularly when it comes to 3Some boards require special tuning values, particularly when it comes
4clock delays. You can specify clock delay values by adding 4to clock delays. You can specify clock delay values in the PHY OF
5micrel-specific properties to an Ethernet OF device node. 5device node. Deprecated, but still supported, these properties can
6also be added to an Ethernet OF device node.
6 7
7Note that these settings are applied after any phy-specific fixup from 8Note that these settings are applied after any phy-specific fixup from
8phy_fixup_list (see phy_init_hw() from drivers/net/phy/phy_device.c), 9phy_fixup_list (see phy_init_hw() from drivers/net/phy/phy_device.c),
@@ -57,16 +58,6 @@ KSZ9031:
57 58
58Examples: 59Examples:
59 60
60 /* Attach to an Ethernet device with autodetected PHY */
61 &enet {
62 rxc-skew-ps = <3000>;
63 rxdv-skew-ps = <0>;
64 txc-skew-ps = <3000>;
65 txen-skew-ps = <0>;
66 status = "okay";
67 };
68
69 /* Attach to an explicitly-specified PHY */
70 mdio { 61 mdio {
71 phy0: ethernet-phy@0 { 62 phy0: ethernet-phy@0 {
72 rxc-skew-ps = <3000>; 63 rxc-skew-ps = <3000>;
diff --git a/Documentation/devicetree/bindings/net/nfc/st95hf.txt b/Documentation/devicetree/bindings/net/nfc/st95hf.txt
new file mode 100644
index 000000000000..ea3178bc9ddd
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/nfc/st95hf.txt
@@ -0,0 +1,50 @@
1* STMicroelectronics : NFC Transceiver ST95HF
2
3ST NFC Transceiver is required to attach with SPI bus.
4ST95HF node should be defined in DT as SPI slave device of SPI
5master with which ST95HF transceiver is physically connected.
6The properties defined below are required to be the part of DT
7to include ST95HF transceiver into the platform.
8
9Required properties:
10===================
11- reg: Address of SPI slave "ST95HF transceiver" on SPI master bus.
12
13- compatible: should be "st,st95hf" for ST95HF NFC transceiver
14
15- spi-max-frequency: Max. operating SPI frequency for ST95HF
16 transceiver.
17
18- enable-gpio: GPIO line to enable ST95HF transceiver.
19
20- interrupt-parent : Standard way to specify the controller to which
21 ST95HF transceiver's interrupt is routed.
22
23- interrupts : Standard way to define ST95HF transceiver's out
24 interrupt.
25
26Optional property:
27=================
28- st95hfvin-supply : This is an optional property. It contains a
29 phandle to ST95HF transceiver's regulator supply node in DT.
30
31Example:
32=======
33spi@9840000 {
34 reg = <0x9840000 0x110>;
35 #address-cells = <1>;
36 #size-cells = <0>;
37 cs-gpios = <&pio0 4>;
38 status = "okay";
39
40 st95hf@0{
41 reg = <0>;
42 compatible = "st,st95hf";
43 status = "okay";
44 spi-max-frequency = <1000000>;
45 enable-gpio = <&pio4 0>;
46 interrupt-parent = <&pio0>;
47 interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
48 };
49
50};
diff --git a/Documentation/devicetree/bindings/net/renesas,ravb.txt b/Documentation/devicetree/bindings/net/renesas,ravb.txt
index b486f3f5f6a3..81a9f9e6b45f 100644
--- a/Documentation/devicetree/bindings/net/renesas,ravb.txt
+++ b/Documentation/devicetree/bindings/net/renesas,ravb.txt
@@ -5,8 +5,18 @@ interface contains.
5 5
6Required properties: 6Required properties:
7- compatible: "renesas,etheravb-r8a7790" if the device is a part of R8A7790 SoC. 7- compatible: "renesas,etheravb-r8a7790" if the device is a part of R8A7790 SoC.
8 "renesas,etheravb-r8a7791" if the device is a part of R8A7791 SoC.
9 "renesas,etheravb-r8a7792" if the device is a part of R8A7792 SoC.
10 "renesas,etheravb-r8a7793" if the device is a part of R8A7793 SoC.
8 "renesas,etheravb-r8a7794" if the device is a part of R8A7794 SoC. 11 "renesas,etheravb-r8a7794" if the device is a part of R8A7794 SoC.
9 "renesas,etheravb-r8a7795" if the device is a part of R8A7795 SoC. 12 "renesas,etheravb-r8a7795" if the device is a part of R8A7795 SoC.
13 "renesas,etheravb-rcar-gen2" for generic R-Car Gen 2 compatible interface.
14 "renesas,etheravb-rcar-gen3" for generic R-Car Gen 3 compatible interface.
15
16 When compatible with the generic version, nodes must list the
17 SoC-specific version corresponding to the platform first
18 followed by the generic version.
19
10- reg: offset and length of (1) the register block and (2) the stream buffer. 20- reg: offset and length of (1) the register block and (2) the stream buffer.
11- interrupts: A list of interrupt-specifiers, one for each entry in 21- interrupts: A list of interrupt-specifiers, one for each entry in
12 interrupt-names. 22 interrupt-names.
@@ -37,7 +47,7 @@ Optional properties:
37Example: 47Example:
38 48
39 ethernet@e6800000 { 49 ethernet@e6800000 {
40 compatible = "renesas,etheravb-r8a7795"; 50 compatible = "renesas,etheravb-r8a7795", "renesas,etheravb-rcar-gen3";
41 reg = <0 0xe6800000 0 0x800>, <0 0xe6a00000 0 0x10000>; 51 reg = <0 0xe6800000 0 0x800>, <0 0xe6a00000 0 0x10000>;
42 interrupt-parent = <&gic>; 52 interrupt-parent = <&gic>;
43 interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>, 53 interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>,
diff --git a/Documentation/devicetree/bindings/net/socfpga-dwmac.txt b/Documentation/devicetree/bindings/net/socfpga-dwmac.txt
index 3a9d67951606..72d82d684342 100644
--- a/Documentation/devicetree/bindings/net/socfpga-dwmac.txt
+++ b/Documentation/devicetree/bindings/net/socfpga-dwmac.txt
@@ -11,6 +11,8 @@ Required properties:
11 designware version numbers documented in stmmac.txt 11 designware version numbers documented in stmmac.txt
12 - altr,sysmgr-syscon : Should be the phandle to the system manager node that 12 - altr,sysmgr-syscon : Should be the phandle to the system manager node that
13 encompasses the glue register, the register offset, and the register shift. 13 encompasses the glue register, the register offset, and the register shift.
14 - altr,f2h_ptp_ref_clk use f2h_ptp_ref_clk instead of default eosc1 clock
15 for ptp ref clk. This affects all emacs as the clock is common.
14 16
15Optional properties: 17Optional properties:
16altr,emac-splitter: Should be the phandle to the emac splitter soft IP node if 18altr,emac-splitter: Should be the phandle to the emac splitter soft IP node if
diff --git a/Documentation/devicetree/bindings/net/stmmac.txt b/Documentation/devicetree/bindings/net/stmmac.txt
index f34fc3c81a75..e862a922bd3f 100644
--- a/Documentation/devicetree/bindings/net/stmmac.txt
+++ b/Documentation/devicetree/bindings/net/stmmac.txt
@@ -35,18 +35,18 @@ Optional properties:
35- reset-names: Should contain the reset signal name "stmmaceth", if a 35- reset-names: Should contain the reset signal name "stmmaceth", if a
36 reset phandle is given 36 reset phandle is given
37- max-frame-size: See ethernet.txt file in the same directory 37- max-frame-size: See ethernet.txt file in the same directory
38- clocks: If present, the first clock should be the GMAC main clock and 38- clocks: If present, the first clock should be the GMAC main clock
39 the second clock should be peripheral's register interface clock. Further 39 The optional second clock should be peripheral's register interface clock.
40 clocks may be specified in derived bindings. 40 The third optional clock should be the ptp reference clock.
41- clock-names: One name for each entry in the clocks property, the 41 Further clocks may be specified in derived bindings.
42 first one should be "stmmaceth" and the second one should be "pclk". 42- clock-names: One name for each entry in the clocks property.
43- clk_ptp_ref: this is the PTP reference clock; in case of the PTP is 43 The first one should be "stmmaceth".
44 available this clock is used for programming the Timestamp Addend Register. 44 The optional second one should be "pclk".
45 If not passed then the system clock will be used and this is fine on some 45 The optional third one should be "clk_ptp_ref".
46 platforms.
47- snps,burst_len: The AXI burst lenth value of the AXI BUS MODE register. 46- snps,burst_len: The AXI burst lenth value of the AXI BUS MODE register.
48- tx-fifo-depth: See ethernet.txt file in the same directory 47- tx-fifo-depth: See ethernet.txt file in the same directory
49- rx-fifo-depth: See ethernet.txt file in the same directory 48- rx-fifo-depth: See ethernet.txt file in the same directory
49- mdio: with compatible = "snps,dwmac-mdio", create and register mdio bus.
50 50
51Examples: 51Examples:
52 52
@@ -65,4 +65,11 @@ Examples:
65 tx-fifo-depth = <16384>; 65 tx-fifo-depth = <16384>;
66 clocks = <&clock>; 66 clocks = <&clock>;
67 clock-names = "stmmaceth"; 67 clock-names = "stmmaceth";
68 mdio0 {
69 #address-cells = <1>;
70 #size-cells = <0>;
71 compatible = "snps,dwmac-mdio";
72 phy1: ethernet-phy@0 {
73 };
74 };
68 }; 75 };
diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt
index 0cb44dc21f97..601256fe8c0d 100644
--- a/Documentation/devicetree/bindings/opp/opp.txt
+++ b/Documentation/devicetree/bindings/opp/opp.txt
@@ -45,21 +45,10 @@ Devices supporting OPPs must set their "operating-points-v2" property with
45phandle to a OPP table in their DT node. The OPP core will use this phandle to 45phandle to a OPP table in their DT node. The OPP core will use this phandle to
46find the operating points for the device. 46find the operating points for the device.
47 47
48Devices may want to choose OPP tables at runtime and so can provide a list of
49phandles here. But only *one* of them should be chosen at runtime. This must be
50accompanied by a corresponding "operating-points-names" property, to uniquely
51identify the OPP tables.
52
53If required, this can be extended for SoC vendor specfic bindings. Such bindings 48If required, this can be extended for SoC vendor specfic bindings. Such bindings
54should be documented as Documentation/devicetree/bindings/power/<vendor>-opp.txt 49should be documented as Documentation/devicetree/bindings/power/<vendor>-opp.txt
55and should have a compatible description like: "operating-points-v2-<vendor>". 50and should have a compatible description like: "operating-points-v2-<vendor>".
56 51
57Optional properties:
58- operating-points-names: Names of OPP tables (required if multiple OPP
59 tables are present), to uniquely identify them. The same list must be present
60 for all the CPUs which are sharing clock/voltage rails and hence the OPP
61 tables.
62
63* OPP Table Node 52* OPP Table Node
64 53
65This describes the OPPs belonging to a device. This node can have following 54This describes the OPPs belonging to a device. This node can have following
@@ -100,6 +89,14 @@ Optional properties:
100 Entries for multiple regulators must be present in the same order as 89 Entries for multiple regulators must be present in the same order as
101 regulators are specified in device's DT node. 90 regulators are specified in device's DT node.
102 91
92- opp-microvolt-<name>: Named opp-microvolt property. This is exactly similar to
93 the above opp-microvolt property, but allows multiple voltage ranges to be
94 provided for the same OPP. At runtime, the platform can pick a <name> and
95 matching opp-microvolt-<name> property will be enabled for all OPPs. If the
96 platform doesn't pick a specific <name> or the <name> doesn't match with any
97 opp-microvolt-<name> properties, then opp-microvolt property shall be used, if
98 present.
99
103- opp-microamp: The maximum current drawn by the device in microamperes 100- opp-microamp: The maximum current drawn by the device in microamperes
104 considering system specific parameters (such as transients, process, aging, 101 considering system specific parameters (such as transients, process, aging,
105 maximum operating temperature range etc.) as necessary. This may be used to 102 maximum operating temperature range etc.) as necessary. This may be used to
@@ -112,6 +109,9 @@ Optional properties:
112 for few regulators, then this should be marked as zero for them. If it isn't 109 for few regulators, then this should be marked as zero for them. If it isn't
113 required for any regulator, then this property need not be present. 110 required for any regulator, then this property need not be present.
114 111
112- opp-microamp-<name>: Named opp-microamp property. Similar to
113 opp-microvolt-<name> property, but for microamp instead.
114
115- clock-latency-ns: Specifies the maximum possible transition latency (in 115- clock-latency-ns: Specifies the maximum possible transition latency (in
116 nanoseconds) for switching to this OPP from any other OPP. 116 nanoseconds) for switching to this OPP from any other OPP.
117 117
@@ -123,6 +123,26 @@ Optional properties:
123- opp-suspend: Marks the OPP to be used during device suspend. Only one OPP in 123- opp-suspend: Marks the OPP to be used during device suspend. Only one OPP in
124 the table should have this. 124 the table should have this.
125 125
126- opp-supported-hw: This enables us to select only a subset of OPPs from the
127 larger OPP table, based on what version of the hardware we are running on. We
128 still can't have multiple nodes with the same opp-hz value in OPP table.
129
130 It's an user defined array containing a hierarchy of hardware version numbers,
131 supported by the OPP. For example: a platform with hierarchy of three levels
132 of versions (A, B and C), this field should be like <X Y Z>, where X
133 corresponds to Version hierarchy A, Y corresponds to version hierarchy B and Z
134 corresponds to version hierarchy C.
135
136 Each level of hierarchy is represented by a 32 bit value, and so there can be
137 only 32 different supported version per hierarchy. i.e. 1 bit per version. A
138 value of 0xFFFFFFFF will enable the OPP for all versions for that hierarchy
139 level. And a value of 0x00000000 will disable the OPP completely, and so we
140 never want that to happen.
141
142 If 32 values aren't sufficient for a version hierarchy, than that version
143 hierarchy can be contained in multiple 32 bit values. i.e. <X Y Z1 Z2> in the
144 above example, Z1 & Z2 refer to the version hierarchy Z.
145
126- status: Marks the node enabled/disabled. 146- status: Marks the node enabled/disabled.
127 147
128Example 1: Single cluster Dual-core ARM cortex A9, switch DVFS states together. 148Example 1: Single cluster Dual-core ARM cortex A9, switch DVFS states together.
@@ -157,20 +177,20 @@ Example 1: Single cluster Dual-core ARM cortex A9, switch DVFS states together.
157 compatible = "operating-points-v2"; 177 compatible = "operating-points-v2";
158 opp-shared; 178 opp-shared;
159 179
160 opp00 { 180 opp@1000000000 {
161 opp-hz = /bits/ 64 <1000000000>; 181 opp-hz = /bits/ 64 <1000000000>;
162 opp-microvolt = <970000 975000 985000>; 182 opp-microvolt = <970000 975000 985000>;
163 opp-microamp = <70000>; 183 opp-microamp = <70000>;
164 clock-latency-ns = <300000>; 184 clock-latency-ns = <300000>;
165 opp-suspend; 185 opp-suspend;
166 }; 186 };
167 opp01 { 187 opp@1100000000 {
168 opp-hz = /bits/ 64 <1100000000>; 188 opp-hz = /bits/ 64 <1100000000>;
169 opp-microvolt = <980000 1000000 1010000>; 189 opp-microvolt = <980000 1000000 1010000>;
170 opp-microamp = <80000>; 190 opp-microamp = <80000>;
171 clock-latency-ns = <310000>; 191 clock-latency-ns = <310000>;
172 }; 192 };
173 opp02 { 193 opp@1200000000 {
174 opp-hz = /bits/ 64 <1200000000>; 194 opp-hz = /bits/ 64 <1200000000>;
175 opp-microvolt = <1025000>; 195 opp-microvolt = <1025000>;
176 clock-latency-ns = <290000>; 196 clock-latency-ns = <290000>;
@@ -236,20 +256,20 @@ independently.
236 * independently. 256 * independently.
237 */ 257 */
238 258
239 opp00 { 259 opp@1000000000 {
240 opp-hz = /bits/ 64 <1000000000>; 260 opp-hz = /bits/ 64 <1000000000>;
241 opp-microvolt = <970000 975000 985000>; 261 opp-microvolt = <970000 975000 985000>;
242 opp-microamp = <70000>; 262 opp-microamp = <70000>;
243 clock-latency-ns = <300000>; 263 clock-latency-ns = <300000>;
244 opp-suspend; 264 opp-suspend;
245 }; 265 };
246 opp01 { 266 opp@1100000000 {
247 opp-hz = /bits/ 64 <1100000000>; 267 opp-hz = /bits/ 64 <1100000000>;
248 opp-microvolt = <980000 1000000 1010000>; 268 opp-microvolt = <980000 1000000 1010000>;
249 opp-microamp = <80000>; 269 opp-microamp = <80000>;
250 clock-latency-ns = <310000>; 270 clock-latency-ns = <310000>;
251 }; 271 };
252 opp02 { 272 opp@1200000000 {
253 opp-hz = /bits/ 64 <1200000000>; 273 opp-hz = /bits/ 64 <1200000000>;
254 opp-microvolt = <1025000>; 274 opp-microvolt = <1025000>;
255 opp-microamp = <90000; 275 opp-microamp = <90000;
@@ -312,20 +332,20 @@ DVFS state together.
312 compatible = "operating-points-v2"; 332 compatible = "operating-points-v2";
313 opp-shared; 333 opp-shared;
314 334
315 opp00 { 335 opp@1000000000 {
316 opp-hz = /bits/ 64 <1000000000>; 336 opp-hz = /bits/ 64 <1000000000>;
317 opp-microvolt = <970000 975000 985000>; 337 opp-microvolt = <970000 975000 985000>;
318 opp-microamp = <70000>; 338 opp-microamp = <70000>;
319 clock-latency-ns = <300000>; 339 clock-latency-ns = <300000>;
320 opp-suspend; 340 opp-suspend;
321 }; 341 };
322 opp01 { 342 opp@1100000000 {
323 opp-hz = /bits/ 64 <1100000000>; 343 opp-hz = /bits/ 64 <1100000000>;
324 opp-microvolt = <980000 1000000 1010000>; 344 opp-microvolt = <980000 1000000 1010000>;
325 opp-microamp = <80000>; 345 opp-microamp = <80000>;
326 clock-latency-ns = <310000>; 346 clock-latency-ns = <310000>;
327 }; 347 };
328 opp02 { 348 opp@1200000000 {
329 opp-hz = /bits/ 64 <1200000000>; 349 opp-hz = /bits/ 64 <1200000000>;
330 opp-microvolt = <1025000>; 350 opp-microvolt = <1025000>;
331 opp-microamp = <90000>; 351 opp-microamp = <90000>;
@@ -338,20 +358,20 @@ DVFS state together.
338 compatible = "operating-points-v2"; 358 compatible = "operating-points-v2";
339 opp-shared; 359 opp-shared;
340 360
341 opp10 { 361 opp@1300000000 {
342 opp-hz = /bits/ 64 <1300000000>; 362 opp-hz = /bits/ 64 <1300000000>;
343 opp-microvolt = <1045000 1050000 1055000>; 363 opp-microvolt = <1045000 1050000 1055000>;
344 opp-microamp = <95000>; 364 opp-microamp = <95000>;
345 clock-latency-ns = <400000>; 365 clock-latency-ns = <400000>;
346 opp-suspend; 366 opp-suspend;
347 }; 367 };
348 opp11 { 368 opp@1400000000 {
349 opp-hz = /bits/ 64 <1400000000>; 369 opp-hz = /bits/ 64 <1400000000>;
350 opp-microvolt = <1075000>; 370 opp-microvolt = <1075000>;
351 opp-microamp = <100000>; 371 opp-microamp = <100000>;
352 clock-latency-ns = <400000>; 372 clock-latency-ns = <400000>;
353 }; 373 };
354 opp12 { 374 opp@1500000000 {
355 opp-hz = /bits/ 64 <1500000000>; 375 opp-hz = /bits/ 64 <1500000000>;
356 opp-microvolt = <1010000 1100000 1110000>; 376 opp-microvolt = <1010000 1100000 1110000>;
357 opp-microamp = <95000>; 377 opp-microamp = <95000>;
@@ -378,7 +398,7 @@ Example 4: Handling multiple regulators
378 compatible = "operating-points-v2"; 398 compatible = "operating-points-v2";
379 opp-shared; 399 opp-shared;
380 400
381 opp00 { 401 opp@1000000000 {
382 opp-hz = /bits/ 64 <1000000000>; 402 opp-hz = /bits/ 64 <1000000000>;
383 opp-microvolt = <970000>, /* Supply 0 */ 403 opp-microvolt = <970000>, /* Supply 0 */
384 <960000>, /* Supply 1 */ 404 <960000>, /* Supply 1 */
@@ -391,7 +411,7 @@ Example 4: Handling multiple regulators
391 411
392 /* OR */ 412 /* OR */
393 413
394 opp00 { 414 opp@1000000000 {
395 opp-hz = /bits/ 64 <1000000000>; 415 opp-hz = /bits/ 64 <1000000000>;
396 opp-microvolt = <970000 975000 985000>, /* Supply 0 */ 416 opp-microvolt = <970000 975000 985000>, /* Supply 0 */
397 <960000 965000 975000>, /* Supply 1 */ 417 <960000 965000 975000>, /* Supply 1 */
@@ -404,7 +424,7 @@ Example 4: Handling multiple regulators
404 424
405 /* OR */ 425 /* OR */
406 426
407 opp00 { 427 opp@1000000000 {
408 opp-hz = /bits/ 64 <1000000000>; 428 opp-hz = /bits/ 64 <1000000000>;
409 opp-microvolt = <970000 975000 985000>, /* Supply 0 */ 429 opp-microvolt = <970000 975000 985000>, /* Supply 0 */
410 <960000 965000 975000>, /* Supply 1 */ 430 <960000 965000 975000>, /* Supply 1 */
@@ -417,7 +437,8 @@ Example 4: Handling multiple regulators
417 }; 437 };
418}; 438};
419 439
420Example 5: Multiple OPP tables 440Example 5: opp-supported-hw
441(example: three level hierarchy of versions: cuts, substrate and process)
421 442
422/ { 443/ {
423 cpus { 444 cpus {
@@ -426,40 +447,73 @@ Example 5: Multiple OPP tables
426 ... 447 ...
427 448
428 cpu-supply = <&cpu_supply> 449 cpu-supply = <&cpu_supply>
429 operating-points-v2 = <&cpu0_opp_table_slow>, <&cpu0_opp_table_fast>; 450 operating-points-v2 = <&cpu0_opp_table_slow>;
430 operating-points-names = "slow", "fast";
431 }; 451 };
432 }; 452 };
433 453
434 cpu0_opp_table_slow: opp_table_slow { 454 opp_table {
435 compatible = "operating-points-v2"; 455 compatible = "operating-points-v2";
436 status = "okay"; 456 status = "okay";
437 opp-shared; 457 opp-shared;
438 458
439 opp00 { 459 opp@600000000 {
460 /*
461 * Supports all substrate and process versions for 0xF
462 * cuts, i.e. only first four cuts.
463 */
464 opp-supported-hw = <0xF 0xFFFFFFFF 0xFFFFFFFF>
440 opp-hz = /bits/ 64 <600000000>; 465 opp-hz = /bits/ 64 <600000000>;
466 opp-microvolt = <900000 915000 925000>;
441 ... 467 ...
442 }; 468 };
443 469
444 opp01 { 470 opp@800000000 {
471 /*
472 * Supports:
473 * - cuts: only one, 6th cut (represented by 6th bit).
474 * - substrate: supports 16 different substrate versions
475 * - process: supports 9 different process versions
476 */
477 opp-supported-hw = <0x20 0xff0000ff 0x0000f4f0>
445 opp-hz = /bits/ 64 <800000000>; 478 opp-hz = /bits/ 64 <800000000>;
479 opp-microvolt = <900000 915000 925000>;
446 ... 480 ...
447 }; 481 };
448 }; 482 };
483};
484
485Example 6: opp-microvolt-<name>, opp-microamp-<name>:
486(example: device with two possible microvolt ranges: slow and fast)
449 487
450 cpu0_opp_table_fast: opp_table_fast { 488/ {
489 cpus {
490 cpu@0 {
491 compatible = "arm,cortex-a7";
492 ...
493
494 operating-points-v2 = <&cpu0_opp_table>;
495 };
496 };
497
498 cpu0_opp_table: opp_table0 {
451 compatible = "operating-points-v2"; 499 compatible = "operating-points-v2";
452 status = "okay";
453 opp-shared; 500 opp-shared;
454 501
455 opp10 { 502 opp@1000000000 {
456 opp-hz = /bits/ 64 <1000000000>; 503 opp-hz = /bits/ 64 <1000000000>;
457 ... 504 opp-microvolt-slow = <900000 915000 925000>;
505 opp-microvolt-fast = <970000 975000 985000>;
506 opp-microamp-slow = <70000>;
507 opp-microamp-fast = <71000>;
458 }; 508 };
459 509
460 opp11 { 510 opp@1200000000 {
461 opp-hz = /bits/ 64 <1100000000>; 511 opp-hz = /bits/ 64 <1200000000>;
462 ... 512 opp-microvolt-slow = <900000 915000 925000>, /* Supply vcc0 */
513 <910000 925000 935000>; /* Supply vcc1 */
514 opp-microvolt-fast = <970000 975000 985000>, /* Supply vcc0 */
515 <960000 965000 975000>; /* Supply vcc1 */
516 opp-microamp = <70000>; /* Will be used for both slow/fast */
463 }; 517 };
464 }; 518 };
465}; 519};
diff --git a/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt b/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt
index 45c2a8094a9f..01b88f4e0d5b 100644
--- a/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/brcm,iproc-pcie.txt
@@ -1,7 +1,10 @@
1* Broadcom iProc PCIe controller with the platform bus interface 1* Broadcom iProc PCIe controller with the platform bus interface
2 2
3Required properties: 3Required properties:
4- compatible: Must be "brcm,iproc-pcie" 4- compatible: Must be "brcm,iproc-pcie" for PAXB, or "brcm,iproc-pcie-paxc"
5 for PAXC. PAXB-based root complex is used for external endpoint devices.
6 PAXC-based root complex is connected to emulated endpoint devices
7 internal to the ASIC
5- reg: base address and length of the PCIe controller I/O register space 8- reg: base address and length of the PCIe controller I/O register space
6- #interrupt-cells: set to <1> 9- #interrupt-cells: set to <1>
7- interrupt-map-mask and interrupt-map, standard PCI properties to define the 10- interrupt-map-mask and interrupt-map, standard PCI properties to define the
@@ -32,6 +35,28 @@ Optional:
32- brcm,pcie-ob-oarr-size: Some iProc SoCs need the OARR size bit to be set to 35- brcm,pcie-ob-oarr-size: Some iProc SoCs need the OARR size bit to be set to
33increase the outbound window size 36increase the outbound window size
34 37
38MSI support (optional):
39
40For older platforms without MSI integrated in the GIC, iProc PCIe core provides
41an event queue based MSI support. The iProc MSI uses host memories to store
42MSI posted writes in the event queues
43
44- msi-parent: Link to the device node of the MSI controller. On newer iProc
45platforms, the MSI controller may be gicv2m or gicv3-its. On older iProc
46platforms without MSI support in its interrupt controller, one may use the
47event queue based MSI support integrated within the iProc PCIe core.
48
49When the iProc event queue based MSI is used, one needs to define the
50following properties in the MSI device node:
51- compatible: Must be "brcm,iproc-msi"
52- msi-controller: claims itself as an MSI controller
53- interrupt-parent: Link to its parent interrupt device
54- interrupts: List of interrupt IDs from its parent interrupt device
55
56Optional properties:
57- brcm,pcie-msi-inten: Needs to be present for some older iProc platforms that
58require the interrupt enable registers to be set explicitly to enable MSI
59
35Example: 60Example:
36 pcie0: pcie@18012000 { 61 pcie0: pcie@18012000 {
37 compatible = "brcm,iproc-pcie"; 62 compatible = "brcm,iproc-pcie";
@@ -58,6 +83,19 @@ Example:
58 brcm,pcie-ob-oarr-size; 83 brcm,pcie-ob-oarr-size;
59 brcm,pcie-ob-axi-offset = <0x00000000>; 84 brcm,pcie-ob-axi-offset = <0x00000000>;
60 brcm,pcie-ob-window-size = <256>; 85 brcm,pcie-ob-window-size = <256>;
86
87 msi-parent = <&msi0>;
88
89 /* iProc event queue based MSI */
90 msi0: msi@18012000 {
91 compatible = "brcm,iproc-msi";
92 msi-controller;
93 interrupt-parent = <&gic>;
94 interrupts = <GIC_SPI 96 IRQ_TYPE_NONE>,
95 <GIC_SPI 97 IRQ_TYPE_NONE>,
96 <GIC_SPI 98 IRQ_TYPE_NONE>,
97 <GIC_SPI 99 IRQ_TYPE_NONE>,
98 };
61 }; 99 };
62 100
63 pcie1: pcie@18013000 { 101 pcie1: pcie@18013000 {
diff --git a/Documentation/devicetree/bindings/pci/hisilicon-pcie.txt b/Documentation/devicetree/bindings/pci/hisilicon-pcie.txt
index 17c6ed9c6059..b721beacfe4d 100644
--- a/Documentation/devicetree/bindings/pci/hisilicon-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/hisilicon-pcie.txt
@@ -1,4 +1,4 @@
1HiSilicon PCIe host bridge DT description 1HiSilicon Hip05 and Hip06 PCIe host bridge DT description
2 2
3HiSilicon PCIe host controller is based on Designware PCI core. 3HiSilicon PCIe host controller is based on Designware PCI core.
4It shares common functions with PCIe Designware core driver and inherits 4It shares common functions with PCIe Designware core driver and inherits
@@ -7,8 +7,8 @@ Documentation/devicetree/bindings/pci/designware-pci.txt.
7 7
8Additional properties are described here: 8Additional properties are described here:
9 9
10Required properties: 10Required properties
11- compatible: Should contain "hisilicon,hip05-pcie". 11- compatible: Should contain "hisilicon,hip05-pcie" or "hisilicon,hip06-pcie".
12- reg: Should contain rc_dbi, config registers location and length. 12- reg: Should contain rc_dbi, config registers location and length.
13- reg-names: Must include the following entries: 13- reg-names: Must include the following entries:
14 "rc_dbi": controller configuration registers; 14 "rc_dbi": controller configuration registers;
@@ -20,7 +20,7 @@ Optional properties:
20- status: Either "ok" or "disabled". 20- status: Either "ok" or "disabled".
21- dma-coherent: Present if DMA operations are coherent. 21- dma-coherent: Present if DMA operations are coherent.
22 22
23Example: 23Hip05 Example (note that Hip06 is the same except compatible):
24 pcie@0xb0080000 { 24 pcie@0xb0080000 {
25 compatible = "hisilicon,hip05-pcie", "snps,dw-pcie"; 25 compatible = "hisilicon,hip05-pcie", "snps,dw-pcie";
26 reg = <0 0xb0080000 0 0x10000>, <0x220 0x00000000 0 0x2000>; 26 reg = <0 0xb0080000 0 0x10000>, <0x220 0x00000000 0 0x2000>;
diff --git a/Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt b/Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt
index 7fab84b33531..4e8b90e43dd8 100644
--- a/Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt
+++ b/Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt
@@ -8,7 +8,14 @@ OHCI and EHCI controllers.
8Required properties: 8Required properties:
9- compatible: "renesas,pci-r8a7790" for the R8A7790 SoC; 9- compatible: "renesas,pci-r8a7790" for the R8A7790 SoC;
10 "renesas,pci-r8a7791" for the R8A7791 SoC; 10 "renesas,pci-r8a7791" for the R8A7791 SoC;
11 "renesas,pci-r8a7794" for the R8A7794 SoC. 11 "renesas,pci-r8a7794" for the R8A7794 SoC;
12 "renesas,pci-rcar-gen2" for a generic R-Car Gen2 compatible device
13
14
15 When compatible with the generic version, nodes must list the
16 SoC-specific version corresponding to the platform first
17 followed by the generic version.
18
12- reg: A list of physical regions to access the device: the first is 19- reg: A list of physical regions to access the device: the first is
13 the operational registers for the OHCI/EHCI controllers and the 20 the operational registers for the OHCI/EHCI controllers and the
14 second is for the bridge configuration and control registers. 21 second is for the bridge configuration and control registers.
@@ -24,10 +31,15 @@ Required properties:
24- interrupt-map-mask: standard property that helps to define the interrupt 31- interrupt-map-mask: standard property that helps to define the interrupt
25 mapping. 32 mapping.
26 33
34Optional properties:
35- dma-ranges: a single range for the inbound memory region. If not supplied,
36 defaults to 1GiB at 0x40000000. Note there are hardware restrictions on the
37 allowed combinations of address and size.
38
27Example SoC configuration: 39Example SoC configuration:
28 40
29 pci0: pci@ee090000 { 41 pci0: pci@ee090000 {
30 compatible = "renesas,pci-r8a7790"; 42 compatible = "renesas,pci-r8a7790", "renesas,pci-rcar-gen2";
31 clocks = <&mstp7_clks R8A7790_CLK_EHCI>; 43 clocks = <&mstp7_clks R8A7790_CLK_EHCI>;
32 reg = <0x0 0xee090000 0x0 0xc00>, 44 reg = <0x0 0xee090000 0x0 0xc00>,
33 <0x0 0xee080000 0x0 0x1100>; 45 <0x0 0xee080000 0x0 0x1100>;
@@ -38,6 +50,7 @@ Example SoC configuration:
38 #address-cells = <3>; 50 #address-cells = <3>;
39 #size-cells = <2>; 51 #size-cells = <2>;
40 #interrupt-cells = <1>; 52 #interrupt-cells = <1>;
53 dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0 0x40000000>;
41 interrupt-map-mask = <0xff00 0 0 0x7>; 54 interrupt-map-mask = <0xff00 0 0 0x7>;
42 interrupt-map = <0x0000 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH 55 interrupt-map = <0x0000 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
43 0x0800 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH 56 0x0800 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.txt b/Documentation/devicetree/bindings/pci/qcom,pcie.txt
new file mode 100644
index 000000000000..4059a6f89bc1
--- /dev/null
+++ b/Documentation/devicetree/bindings/pci/qcom,pcie.txt
@@ -0,0 +1,233 @@
1* Qualcomm PCI express root complex
2
3- compatible:
4 Usage: required
5 Value type: <stringlist>
6 Definition: Value should contain
7 - "qcom,pcie-ipq8064" for ipq8064
8 - "qcom,pcie-apq8064" for apq8064
9 - "qcom,pcie-apq8084" for apq8084
10
11- reg:
12 Usage: required
13 Value type: <prop-encoded-array>
14 Definition: Register ranges as listed in the reg-names property
15
16- reg-names:
17 Usage: required
18 Value type: <stringlist>
19 Definition: Must include the following entries
20 - "parf" Qualcomm specific registers
21 - "dbi" Designware PCIe registers
22 - "elbi" External local bus interface registers
23 - "config" PCIe configuration space
24
25- device_type:
26 Usage: required
27 Value type: <string>
28 Definition: Should be "pci". As specified in designware-pcie.txt
29
30- #address-cells:
31 Usage: required
32 Value type: <u32>
33 Definition: Should be 3. As specified in designware-pcie.txt
34
35- #size-cells:
36 Usage: required
37 Value type: <u32>
38 Definition: Should be 2. As specified in designware-pcie.txt
39
40- ranges:
41 Usage: required
42 Value type: <prop-encoded-array>
43 Definition: As specified in designware-pcie.txt
44
45- interrupts:
46 Usage: required
47 Value type: <prop-encoded-array>
48 Definition: MSI interrupt
49
50- interrupt-names:
51 Usage: required
52 Value type: <stringlist>
53 Definition: Should contain "msi"
54
55- #interrupt-cells:
56 Usage: required
57 Value type: <u32>
58 Definition: Should be 1. As specified in designware-pcie.txt
59
60- interrupt-map-mask:
61 Usage: required
62 Value type: <prop-encoded-array>
63 Definition: As specified in designware-pcie.txt
64
65- interrupt-map:
66 Usage: required
67 Value type: <prop-encoded-array>
68 Definition: As specified in designware-pcie.txt
69
70- clocks:
71 Usage: required
72 Value type: <prop-encoded-array>
73 Definition: List of phandle and clock specifier pairs as listed
74 in clock-names property
75
76- clock-names:
77 Usage: required
78 Value type: <stringlist>
79 Definition: Should contain the following entries
80 - "iface" Configuration AHB clock
81
82- clock-names:
83 Usage: required for ipq/apq8064
84 Value type: <stringlist>
85 Definition: Should contain the following entries
86 - "core" Clocks the pcie hw block
87 - "phy" Clocks the pcie PHY block
88- clock-names:
89 Usage: required for apq8084
90 Value type: <stringlist>
91 Definition: Should contain the following entries
92 - "aux" Auxiliary (AUX) clock
93 - "bus_master" Master AXI clock
94 - "bus_slave" Slave AXI clock
95- resets:
96 Usage: required
97 Value type: <prop-encoded-array>
98 Definition: List of phandle and reset specifier pairs as listed
99 in reset-names property
100
101- reset-names:
102 Usage: required for ipq/apq8064
103 Value type: <stringlist>
104 Definition: Should contain the following entries
105 - "axi" AXI reset
106 - "ahb" AHB reset
107 - "por" POR reset
108 - "pci" PCI reset
109 - "phy" PHY reset
110
111- reset-names:
112 Usage: required for apq8084
113 Value type: <stringlist>
114 Definition: Should contain the following entries
115 - "core" Core reset
116
117- power-domains:
118 Usage: required for apq8084
119 Value type: <prop-encoded-array>
120 Definition: A phandle and power domain specifier pair to the
121 power domain which is responsible for collapsing
122 and restoring power to the peripheral
123
124- vdda-supply:
125 Usage: required
126 Value type: <phandle>
127 Definition: A phandle to the core analog power supply
128
129- vdda_phy-supply:
130 Usage: required for ipq/apq8064
131 Value type: <phandle>
132 Definition: A phandle to the analog power supply for PHY
133
134- vdda_refclk-supply:
135 Usage: required for ipq/apq8064
136 Value type: <phandle>
137 Definition: A phandle to the analog power supply for IC which generates
138 reference clock
139
140- phys:
141 Usage: required for apq8084
142 Value type: <phandle>
143 Definition: List of phandle(s) as listed in phy-names property
144
145- phy-names:
146 Usage: required for apq8084
147 Value type: <stringlist>
148 Definition: Should contain "pciephy"
149
150- <name>-gpios:
151 Usage: optional
152 Value type: <prop-encoded-array>
153 Definition: List of phandle and gpio specifier pairs. Should contain
154 - "perst-gpios" PCIe endpoint reset signal line
155 - "wake-gpios" PCIe endpoint wake signal line
156
157* Example for ipq/apq8064
158 pcie@1b500000 {
159 compatible = "qcom,pcie-apq8064", "qcom,pcie-ipq8064", "snps,dw-pcie";
160 reg = <0x1b500000 0x1000
161 0x1b502000 0x80
162 0x1b600000 0x100
163 0x0ff00000 0x100000>;
164 reg-names = "dbi", "elbi", "parf", "config";
165 device_type = "pci";
166 linux,pci-domain = <0>;
167 bus-range = <0x00 0xff>;
168 num-lanes = <1>;
169 #address-cells = <3>;
170 #size-cells = <2>;
171 ranges = <0x81000000 0 0 0x0fe00000 0 0x00100000 /* I/O */
172 0x82000000 0 0 0x08000000 0 0x07e00000>; /* memory */
173 interrupts = <GIC_SPI 238 IRQ_TYPE_NONE>;
174 interrupt-names = "msi";
175 #interrupt-cells = <1>;
176 interrupt-map-mask = <0 0 0 0x7>;
177 interrupt-map = <0 0 0 1 &intc 0 36 IRQ_TYPE_LEVEL_HIGH>, /* int_a */
178 <0 0 0 2 &intc 0 37 IRQ_TYPE_LEVEL_HIGH>, /* int_b */
179 <0 0 0 3 &intc 0 38 IRQ_TYPE_LEVEL_HIGH>, /* int_c */
180 <0 0 0 4 &intc 0 39 IRQ_TYPE_LEVEL_HIGH>; /* int_d */
181 clocks = <&gcc PCIE_A_CLK>,
182 <&gcc PCIE_H_CLK>,
183 <&gcc PCIE_PHY_CLK>;
184 clock-names = "core", "iface", "phy";
185 resets = <&gcc PCIE_ACLK_RESET>,
186 <&gcc PCIE_HCLK_RESET>,
187 <&gcc PCIE_POR_RESET>,
188 <&gcc PCIE_PCI_RESET>,
189 <&gcc PCIE_PHY_RESET>;
190 reset-names = "axi", "ahb", "por", "pci", "phy";
191 pinctrl-0 = <&pcie_pins_default>;
192 pinctrl-names = "default";
193 };
194
195* Example for apq8084
196 pcie0@fc520000 {
197 compatible = "qcom,pcie-apq8084", "snps,dw-pcie";
198 reg = <0xfc520000 0x2000>,
199 <0xff000000 0x1000>,
200 <0xff001000 0x1000>,
201 <0xff002000 0x2000>;
202 reg-names = "parf", "dbi", "elbi", "config";
203 device_type = "pci";
204 linux,pci-domain = <0>;
205 bus-range = <0x00 0xff>;
206 num-lanes = <1>;
207 #address-cells = <3>;
208 #size-cells = <2>;
209 ranges = <0x81000000 0 0 0xff200000 0 0x00100000 /* I/O */
210 0x82000000 0 0x00300000 0xff300000 0 0x00d00000>; /* memory */
211 interrupts = <GIC_SPI 243 IRQ_TYPE_NONE>;
212 interrupt-names = "msi";
213 #interrupt-cells = <1>;
214 interrupt-map-mask = <0 0 0 0x7>;
215 interrupt-map = <0 0 0 1 &intc 0 244 IRQ_TYPE_LEVEL_HIGH>, /* int_a */
216 <0 0 0 2 &intc 0 245 IRQ_TYPE_LEVEL_HIGH>, /* int_b */
217 <0 0 0 3 &intc 0 247 IRQ_TYPE_LEVEL_HIGH>, /* int_c */
218 <0 0 0 4 &intc 0 248 IRQ_TYPE_LEVEL_HIGH>; /* int_d */
219 clocks = <&gcc GCC_PCIE_0_CFG_AHB_CLK>,
220 <&gcc GCC_PCIE_0_MSTR_AXI_CLK>,
221 <&gcc GCC_PCIE_0_SLV_AXI_CLK>,
222 <&gcc GCC_PCIE_0_AUX_CLK>;
223 clock-names = "iface", "master_bus", "slave_bus", "aux";
224 resets = <&gcc GCC_PCIE_0_BCR>;
225 reset-names = "core";
226 power-domains = <&gcc PCIE0_GDSC>;
227 vdda-supply = <&pma8084_l3>;
228 phys = <&pciephy0>;
229 phy-names = "pciephy";
230 perst-gpio = <&tlmm 70 GPIO_ACTIVE_LOW>;
231 pinctrl-0 = <&pcie0_pins_default>;
232 pinctrl-names = "default";
233 };
diff --git a/Documentation/devicetree/bindings/pci/rcar-pci.txt b/Documentation/devicetree/bindings/pci/rcar-pci.txt
index 29d3b989d3b0..558fe528ae19 100644
--- a/Documentation/devicetree/bindings/pci/rcar-pci.txt
+++ b/Documentation/devicetree/bindings/pci/rcar-pci.txt
@@ -1,8 +1,16 @@
1* Renesas RCar PCIe interface 1* Renesas RCar PCIe interface
2 2
3Required properties: 3Required properties:
4- compatible: should contain one of the following 4compatible: "renesas,pcie-r8a7779" for the R8A7779 SoC;
5 "renesas,pcie-r8a7779", "renesas,pcie-r8a7790", "renesas,pcie-r8a7791" 5 "renesas,pcie-r8a7790" for the R8A7790 SoC;
6 "renesas,pcie-r8a7791" for the R8A7791 SoC;
7 "renesas,pcie-r8a7795" for the R8A7795 SoC;
8 "renesas,pcie-rcar-gen2" for a generic R-Car Gen2 compatible device.
9
10 When compatible with the generic version, nodes must list the
11 SoC-specific version corresponding to the platform first
12 followed by the generic version.
13
6- reg: base address and length of the pcie controller registers. 14- reg: base address and length of the pcie controller registers.
7- #address-cells: set to <3> 15- #address-cells: set to <3>
8- #size-cells: set to <2> 16- #size-cells: set to <2>
@@ -25,7 +33,7 @@ Example:
25SoC specific DT Entry: 33SoC specific DT Entry:
26 34
27 pcie: pcie@fe000000 { 35 pcie: pcie@fe000000 {
28 compatible = "renesas,pcie-r8a7791"; 36 compatible = "renesas,pcie-r8a7791", "renesas,pcie-rcar-gen2";
29 reg = <0 0xfe000000 0 0x80000>; 37 reg = <0 0xfe000000 0 0x80000>;
30 #address-cells = <3>; 38 #address-cells = <3>;
31 #size-cells = <2>; 39 #size-cells = <2>;
diff --git a/Documentation/devicetree/bindings/phy/brcm,brcmstb-sata-phy.txt b/Documentation/devicetree/bindings/phy/brcm,brcmstb-sata-phy.txt
index 7f81ef90146a..d87ab7c127b8 100644
--- a/Documentation/devicetree/bindings/phy/brcm,brcmstb-sata-phy.txt
+++ b/Documentation/devicetree/bindings/phy/brcm,brcmstb-sata-phy.txt
@@ -2,6 +2,7 @@
2 2
3Required properties: 3Required properties:
4- compatible: should be one or more of 4- compatible: should be one or more of
5 "brcm,bcm7425-sata-phy"
5 "brcm,bcm7445-sata-phy" 6 "brcm,bcm7445-sata-phy"
6 "brcm,phy-sata3" 7 "brcm,phy-sata3"
7- address-cells: should be 1 8- address-cells: should be 1
diff --git a/Documentation/devicetree/bindings/phy/phy-hi6220-usb.txt b/Documentation/devicetree/bindings/phy/phy-hi6220-usb.txt
new file mode 100644
index 000000000000..f17a56e2152f
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/phy-hi6220-usb.txt
@@ -0,0 +1,16 @@
1Hisilicon hi6220 usb PHY
2-----------------------
3
4Required properties:
5- compatible: should be "hisilicon,hi6220-usb-phy"
6- #phy-cells: must be 0
7- hisilicon,peripheral-syscon: phandle of syscon used to control phy.
8Refer to phy/phy-bindings.txt for the generic PHY binding properties
9
10Example:
11 usb_phy: usbphy {
12 compatible = "hisilicon,hi6220-usb-phy";
13 #phy-cells = <0>;
14 phy-supply = <&fixed_5v_hub>;
15 hisilicon,peripheral-syscon = <&sys_ctrl>;
16 };
diff --git a/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt b/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt
new file mode 100644
index 000000000000..2390e4e9c84c
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/rcar-gen3-phy-usb2.txt
@@ -0,0 +1,39 @@
1* Renesas R-Car generation 3 USB 2.0 PHY
2
3This file provides information on what the device node for the R-Car generation
43 USB 2.0 PHY contains.
5
6Required properties:
7- compatible: "renesas,usb2-phy-r8a7795" if the device is a part of an R8A7795
8 SoC.
9- reg: offset and length of the partial USB 2.0 Host register block.
10- reg-names: must be "usb2_host".
11- clocks: clock phandle and specifier pair(s).
12- #phy-cells: see phy-bindings.txt in the same directory, must be <0>.
13
14Optional properties:
15To use a USB channel where USB 2.0 Host and HSUSB (USB 2.0 Peripheral) are
16combined, the device tree node should set HSUSB properties to reg and reg-names
17properties. This is because HSUSB has registers to select USB 2.0 host or
18peripheral at that channel:
19- reg: offset and length of the partial HSUSB register block.
20- reg-names: must be "hsusb".
21- interrupts: interrupt specifier for the PHY.
22
23Example (R-Car H3):
24
25 usb-phy@ee080200 {
26 compatible = "renesas,usb2-phy-r8a7795";
27 reg = <0 0xee080200 0 0x700>, <0 0xe6590100 0 0x100>;
28 reg-names = "usb2_host", "hsusb";
29 interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
30 clocks = <&mstp7_clks R8A7795_CLK_EHCI0>,
31 <&mstp7_clks R8A7795_CLK_HSUSB>;
32 };
33
34 usb-phy@ee0a0200 {
35 compatible = "renesas,usb2-phy-r8a7795";
36 reg = <0 0xee0a0200 0 0x700>;
37 reg-names = "usb2_host";
38 clocks = <&mstp7_clks R8A7795_CLK_EHCI0>;
39 };
diff --git a/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
index 826454ac43bb..68498d560354 100644
--- a/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
+++ b/Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt
@@ -1,7 +1,10 @@
1ROCKCHIP USB2 PHY 1ROCKCHIP USB2 PHY
2 2
3Required properties: 3Required properties:
4 - compatible: rockchip,rk3288-usb-phy 4 - compatible: matching the soc type, one of
5 "rockchip,rk3066a-usb-phy"
6 "rockchip,rk3188-usb-phy"
7 "rockchip,rk3288-usb-phy"
5 - rockchip,grf : phandle to the syscon managing the "general 8 - rockchip,grf : phandle to the syscon managing the "general
6 register files" 9 register files"
7 - #address-cells: should be 1 10 - #address-cells: should be 1
@@ -21,6 +24,7 @@ required properties:
21Optional Properties: 24Optional Properties:
22- clocks : phandle + clock specifier for the phy clocks 25- clocks : phandle + clock specifier for the phy clocks
23- clock-names: string, clock name, must be "phyclk" 26- clock-names: string, clock name, must be "phyclk"
27- #clock-cells: for users of the phy-pll, should be 0
24 28
25Example: 29Example:
26 30
diff --git a/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt b/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt
index 0cebf7454517..95736d77fbb7 100644
--- a/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt
+++ b/Documentation/devicetree/bindings/phy/sun4i-usb-phy.txt
@@ -9,6 +9,7 @@ Required properties:
9 * allwinner,sun7i-a20-usb-phy 9 * allwinner,sun7i-a20-usb-phy
10 * allwinner,sun8i-a23-usb-phy 10 * allwinner,sun8i-a23-usb-phy
11 * allwinner,sun8i-a33-usb-phy 11 * allwinner,sun8i-a33-usb-phy
12 * allwinner,sun8i-h3-usb-phy
12- reg : a list of offset + length pairs 13- reg : a list of offset + length pairs
13- reg-names : 14- reg-names :
14 * "phy_ctrl" 15 * "phy_ctrl"
diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index 9cf9446eaf2e..a3b394587874 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -31,6 +31,8 @@ OMAP USB2 PHY
31 31
32Required properties: 32Required properties:
33 - compatible: Should be "ti,omap-usb2" 33 - compatible: Should be "ti,omap-usb2"
34 Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY
35 in DRA7x
34 - reg : Address and length of the register set for the device. 36 - reg : Address and length of the register set for the device.
35 - #phy-cells: determine the number of cells that should be given in the 37 - #phy-cells: determine the number of cells that should be given in the
36 phandle while referencing this phy. 38 phandle while referencing this phy.
@@ -40,10 +42,14 @@ Required properties:
40 * "wkupclk" - wakeup clock. 42 * "wkupclk" - wakeup clock.
41 * "refclk" - reference clock (optional). 43 * "refclk" - reference clock (optional).
42 44
43Optional properties: 45Deprecated properties:
44 - ctrl-module : phandle of the control module used by PHY driver to power on 46 - ctrl-module : phandle of the control module used by PHY driver to power on
45 the PHY. 47 the PHY.
46 48
49Recommended properies:
50- syscon-phy-power : phandle/offset pair. Phandle to the system control
51 module and the register offset to power on/off the PHY.
52
47This is usually a subnode of ocp2scp to which it is connected. 53This is usually a subnode of ocp2scp to which it is connected.
48 54
49usb2phy@4a0ad080 { 55usb2phy@4a0ad080 {
@@ -77,14 +83,22 @@ Required properties:
77 * "div-clk" - apll clock 83 * "div-clk" - apll clock
78 84
79Optional properties: 85Optional properties:
80 - ctrl-module : phandle of the control module used by PHY driver to power on
81 the PHY.
82 - id: If there are multiple instance of the same type, in order to 86 - id: If there are multiple instance of the same type, in order to
83 differentiate between each instance "id" can be used (e.g., multi-lane PCIe 87 differentiate between each instance "id" can be used (e.g., multi-lane PCIe
84 PHY). If "id" is not provided, it is set to default value of '1'. 88 PHY). If "id" is not provided, it is set to default value of '1'.
85 - syscon-pllreset: Handle to system control region that contains the 89 - syscon-pllreset: Handle to system control region that contains the
86 CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0 90 CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
87 register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy. 91 register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
92 - syscon-pcs : phandle/offset pair. Phandle to the system control module and the
93 register offset to write the PCS delay value.
94
95Deprecated properties:
96 - ctrl-module : phandle of the control module used by PHY driver to power on
97 the PHY.
98
99Recommended properies:
100 - syscon-phy-power : phandle/offset pair. Phandle to the system control
101 module and the register offset to power on/off the PHY.
88 102
89This is usually a subnode of ocp2scp to which it is connected. 103This is usually a subnode of ocp2scp to which it is connected.
90 104
diff --git a/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt
index b321b26780dc..9213b27e1036 100644
--- a/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt
@@ -17,7 +17,10 @@ Required properties:
17 "allwinner,sun8i-a23-pinctrl" 17 "allwinner,sun8i-a23-pinctrl"
18 "allwinner,sun8i-a23-r-pinctrl" 18 "allwinner,sun8i-a23-r-pinctrl"
19 "allwinner,sun8i-a33-pinctrl" 19 "allwinner,sun8i-a33-pinctrl"
20 "allwinner,sun9i-a80-pinctrl"
21 "allwinner,sun9i-a80-r-pinctrl"
20 "allwinner,sun8i-a83t-pinctrl" 22 "allwinner,sun8i-a83t-pinctrl"
23 "allwinner,sun8i-h3-pinctrl"
21 24
22- reg: Should contain the register physical address and length for the 25- reg: Should contain the register physical address and length for the
23 pin controller. 26 pin controller.
diff --git a/Documentation/devicetree/bindings/pinctrl/brcm,cygnus-gpio.txt b/Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt
index 16589fb6f420..e4277921f3e3 100644
--- a/Documentation/devicetree/bindings/pinctrl/brcm,cygnus-gpio.txt
+++ b/Documentation/devicetree/bindings/pinctrl/brcm,iproc-gpio.txt
@@ -1,4 +1,4 @@
1Broadcom Cygnus GPIO/PINCONF Controller 1Broadcom iProc GPIO/PINCONF Controller
2 2
3Required properties: 3Required properties:
4 4
@@ -7,9 +7,12 @@ Required properties:
7 "brcm,cygnus-crmu-gpio" or "brcm,iproc-gpio" 7 "brcm,cygnus-crmu-gpio" or "brcm,iproc-gpio"
8 8
9- reg: 9- reg:
10 Define the base and range of the I/O address space that contains the Cygnus 10 Define the base and range of the I/O address space that contains SoC
11GPIO/PINCONF controller registers 11GPIO/PINCONF controller registers
12 12
13- ngpios:
14 Total number of in-use slots in GPIO controller
15
13- #gpio-cells: 16- #gpio-cells:
14 Must be two. The first cell is the GPIO pin number (within the 17 Must be two. The first cell is the GPIO pin number (within the
15controller's pin space) and the second cell is used for the following: 18controller's pin space) and the second cell is used for the following:
@@ -57,6 +60,7 @@ Example:
57 compatible = "brcm,cygnus-ccm-gpio"; 60 compatible = "brcm,cygnus-ccm-gpio";
58 reg = <0x1800a000 0x50>, 61 reg = <0x1800a000 0x50>,
59 <0x0301d164 0x20>; 62 <0x0301d164 0x20>;
63 ngpios = <24>;
60 #gpio-cells = <2>; 64 #gpio-cells = <2>;
61 gpio-controller; 65 gpio-controller;
62 interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>; 66 interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
@@ -78,6 +82,7 @@ Example:
78 gpio_asiu: gpio@180a5000 { 82 gpio_asiu: gpio@180a5000 {
79 compatible = "brcm,cygnus-asiu-gpio"; 83 compatible = "brcm,cygnus-asiu-gpio";
80 reg = <0x180a5000 0x668>; 84 reg = <0x180a5000 0x668>;
85 ngpios = <146>;
81 #gpio-cells = <2>; 86 #gpio-cells = <2>;
82 gpio-controller; 87 gpio-controller;
83 interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>; 88 interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/Documentation/devicetree/bindings/pinctrl/brcm,nsp-gpio.txt b/Documentation/devicetree/bindings/pinctrl/brcm,nsp-gpio.txt
new file mode 100644
index 000000000000..0844168a6dd4
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/brcm,nsp-gpio.txt
@@ -0,0 +1,80 @@
1Broadcom Northstar plus (NSP) GPIO/PINCONF Controller
2
3Required properties:
4- compatible:
5 Must be "brcm,nsp-gpio-a"
6
7- reg:
8 Should contain the register physical address and length for each of
9 GPIO base, IO control registers
10
11- #gpio-cells:
12 Must be two. The first cell is the GPIO pin number (within the
13 controller's pin space) and the second cell is used for the following:
14 bit[0]: polarity (0 for active high and 1 for active low)
15
16- gpio-controller:
17 Specifies that the node is a GPIO controller
18
19- ngpios:
20 Number of gpios supported (58x25 supports 32 and 58x23 supports 24)
21
22Optional properties:
23- interrupts:
24 Interrupt ID
25
26- interrupt-controller:
27 Specifies that the node is an interrupt controller
28
29- gpio-ranges:
30 Specifies the mapping between gpio controller and pin-controllers pins.
31 This requires 4 fields in cells defined as -
32 1. Phandle of pin-controller.
33 2. GPIO base pin offset.
34 3 Pin-control base pin offset.
35 4. number of gpio pins which are linearly mapped from pin base.
36
37Supported generic PINCONF properties in child nodes:
38- pins:
39 The list of pins (within the controller's own pin space) that properties
40 in the node apply to. Pin names are "gpio-<pin>"
41
42- bias-disable:
43 Disable pin bias
44
45- bias-pull-up:
46 Enable internal pull up resistor
47
48- bias-pull-down:
49 Enable internal pull down resistor
50
51- drive-strength:
52 Valid drive strength values include 2, 4, 6, 8, 10, 12, 14, 16 (mA)
53
54Example:
55
56 gpioa: gpio@18000020 {
57 compatible = "brcm,nsp-gpio-a";
58 reg = <0x18000020 0x100>,
59 <0x1803f1c4 0x1c>;
60 #gpio-cells = <2>;
61 gpio-controller;
62 ngpios = <32>;
63 gpio-ranges = <&pinctrl 0 0 31>;
64 interrupt-controller;
65 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
66
67 /* Hog a few default settings */
68 pinctrl-names = "default";
69 pinctrl-0 = <&led>;
70 led: led {
71 pins = "gpio-1";
72 bias-pull-up;
73 };
74
75 pwr: pwr {
76 gpio-hog;
77 gpios = <3 1>;
78 output-high;
79 };
80 };
diff --git a/Documentation/devicetree/bindings/pinctrl/lantiq,pinctrl-xway.txt b/Documentation/devicetree/bindings/pinctrl/lantiq,pinctrl-xway.txt
index e89b4677567d..8e5216bcd748 100644
--- a/Documentation/devicetree/bindings/pinctrl/lantiq,pinctrl-xway.txt
+++ b/Documentation/devicetree/bindings/pinctrl/lantiq,pinctrl-xway.txt
@@ -1,7 +1,16 @@
1Lantiq XWAY pinmux controller 1Lantiq XWAY pinmux controller
2 2
3Required properties: 3Required properties:
4- compatible: "lantiq,pinctrl-xway" or "lantiq,pinctrl-xr9" 4- compatible: "lantiq,pinctrl-xway", (DEPRECATED: Use "lantiq,pinctrl-danube")
5 "lantiq,pinctrl-xr9", (DEPRECATED: Use "lantiq,xrx100-pinctrl" or
6 "lantiq,xrx200-pinctrl")
7 "lantiq,pinctrl-ase", (DEPRECATED: Use "lantiq,ase-pinctrl")
8 "lantiq,<chip>-pinctrl", where <chip> is:
9 "ase" (XWAY AMAZON Family)
10 "danube" (XWAY DANUBE Family)
11 "xrx100" (XWAY xRX100 Family)
12 "xrx200" (XWAY xRX200 Family)
13 "xrx300" (XWAY xRX300 Family)
5- reg: Should contain the physical address and length of the gpio/pinmux 14- reg: Should contain the physical address and length of the gpio/pinmux
6 register range 15 register range
7 16
@@ -36,19 +45,87 @@ Required subnode-properties:
36 45
37Valid values for group and function names: 46Valid values for group and function names:
38 47
48XWAY: (DEPRECATED: Use DANUBE)
39 mux groups: 49 mux groups:
40 exin0, exin1, exin2, jtag, ebu a23, ebu a24, ebu a25, ebu clk, ebu cs1, 50 exin0, exin1, exin2, jtag, ebu a23, ebu a24, ebu a25, ebu clk, ebu cs1,
41 ebu wait, nand ale, nand cs1, nand cle, spi, spi_cs1, spi_cs2, spi_cs3, 51 ebu wait, nand ale, nand cs1, nand cle, spi, spi_cs1, spi_cs2, spi_cs3,
42 spi_cs4, spi_cs5, spi_cs6, asc0, asc0 cts rts, stp, nmi , gpt1, gpt2, 52 spi_cs4, spi_cs5, spi_cs6, asc0, asc0 cts rts, stp, nmi, gpt1, gpt2,
43 gpt3, clkout0, clkout1, clkout2, clkout3, gnt1, gnt2, gnt3, req1, req2, 53 gpt3, clkout0, clkout1, clkout2, clkout3, gnt1, gnt2, gnt3, req1, req2,
44 req3 54 req3
45 55
46 additional mux groups (XR9 only): 56 functions:
47 mdio, nand rdy, nand rd, exin3, exin4, gnt4, req4 57 spi, asc, cgu, jtag, exin, stp, gpt, nmi, pci, ebu
58
59XR9: ( DEPRECATED: Use xRX100/xRX200)
60 mux groups:
61 exin0, exin1, exin2, exin3, exin4, jtag, ebu a23, ebu a24, ebu a25,
62 ebu clk, ebu cs1, ebu wait, nand ale, nand cs1, nand cle, nand rdy,
63 nand rd, spi, spi_cs1, spi_cs2, spi_cs3, spi_cs4, spi_cs5, spi_cs6,
64 asc0, asc0 cts rts, stp, nmi, gpt1, gpt2, gpt3, clkout0, clkout1,
65 clkout2, clkout3, gnt1, gnt2, gnt3, gnt4, req1, req2, req3, req4, mdio,
66 gphy0 led0, gphy0 led1, gphy0 led2, gphy1 led0, gphy1 led1, gphy1 led2
67
68 functions:
69 spi, asc, cgu, jtag, exin, stp, gpt, nmi, pci, ebu, mdio, gphy
70
71AMAZON:
72 mux groups:
73 exin0, exin1, exin2, jtag, spi_di, spi_do, spi_clk, spi_cs1, spi_cs2,
74 spi_cs3, spi_cs4, spi_cs5, spi_cs6, asc, stp, gpt1, gpt2, gpt3, clkout0,
75 clkout1, clkout2, mdio, dfe led0, dfe led1, ephy led0, ephy led1, ephy led2
76
77 functions:
78 spi, asc, cgu, jtag, exin, stp, gpt, mdio, ephy, dfe
79
80DANUBE:
81 mux groups:
82 exin0, exin1, exin2, jtag, ebu a23, ebu a24, ebu a25, ebu clk, ebu cs1,
83 ebu wait, nand ale, nand cs1, nand cle, spi_di, spi_do, spi_clk, spi_cs1,
84 spi_cs2, spi_cs3, spi_cs4, spi_cs5, spi_cs6, asc0, asc0 cts rts, stp, nmi,
85 gpt1, gpt2, gpt3, clkout0, clkout1, clkout2, clkout3, gnt1, gnt2, gnt3,
86 req1, req2, req3, dfe led0, dfe led1
48 87
49 functions: 88 functions:
50 spi, asc, cgu, jtag, exin, stp, gpt, nmi, pci, ebu, mdio 89 spi, asc, cgu, jtag, exin, stp, gpt, nmi, pci, ebu, dfe
51 90
91xRX100:
92 mux groups:
93 exin0, exin1, exin2, exin3, exin4, ebu a23, ebu a24, ebu a25, ebu clk,
94 ebu cs1, ebu wait, nand ale, nand cs1, nand cle, nand rdy, nand rd,
95 spi_di, spi_do, spi_clk, spi_cs1, spi_cs2, spi_cs3, spi_cs4, spi_cs5,
96 spi_cs6, asc0, asc0 cts rts, stp, nmi, gpt1, gpt2, gpt3, clkout0, clkout1,
97 clkout2, clkout3, gnt1, gnt2, gnt3, gnt4, req1, req2, req3, req4, mdio,
98 dfe led0, dfe led1
99
100 functions:
101 spi, asc, cgu, exin, stp, gpt, nmi, pci, ebu, mdio, dfe
102
103xRX200:
104 mux groups:
105 exin0, exin1, exin2, exin3, exin4, ebu a23, ebu a24, ebu a25, ebu clk,
106 ebu cs1, ebu wait, nand ale, nand cs1, nand cle, nand rdy, nand rd,
107 spi_di, spi_do, spi_clk, spi_cs1, spi_cs2, spi_cs3, spi_cs4, spi_cs5,
108 spi_cs6, usif uart_rx, usif uart_tx, usif uart_rts, usif uart_cts,
109 usif uart_dtr, usif uart_dsr, usif uart_dcd, usif uart_ri, usif spi_di,
110 usif spi_do, usif spi_clk, usif spi_cs0, usif spi_cs1, usif spi_cs2,
111 stp, nmi, gpt1, gpt2, gpt3, clkout0, clkout1, clkout2, clkout3, gnt1,
112 gnt2, gnt3, gnt4, req1, req2, req3, req4, mdio, dfe led0, dfe led1,
113 gphy0 led0, gphy0 led1, gphy0 led2, gphy1 led0, gphy1 led1, gphy1 led2
114
115 functions:
116 spi, usif, cgu, exin, stp, gpt, nmi, pci, ebu, mdio, dfe, gphy
117
118xRX300:
119 mux groups:
120 exin0, exin1, exin2, exin4, nand ale, nand cs0, nand cs1, nand cle,
121 nand rdy, nand rd, nand_d0, nand_d1, nand_d2, nand_d3, nand_d4, nand_d5,
122 nand_d6, nand_d7, nand_d1, nand wr, nand wp, nand se, spi_di, spi_do,
123 spi_clk, spi_cs1, spi_cs4, spi_cs6, usif uart_rx, usif uart_tx,
124 usif spi_di, usif spi_do, usif spi_clk, usif spi_cs0, stp, clkout2,
125 mdio, dfe led0, dfe led1, ephy0 led0, ephy0 led1, ephy1 led0, ephy1 led1
126
127 functions:
128 spi, usif, cgu, exin, stp, ebu, mdio, dfe, ephy
52 129
53 130
54Definition of pin configurations: 131Definition of pin configurations:
@@ -62,15 +139,32 @@ Optional subnode-properties:
62 0: none, 1: down, 2: up. 139 0: none, 1: down, 2: up.
63- lantiq,open-drain: Boolean, enables open-drain on the defined pin. 140- lantiq,open-drain: Boolean, enables open-drain on the defined pin.
64 141
65Valid values for XWAY pin names: 142Valid values for XWAY pin names: (DEPRECATED: Use DANUBE)
66 Pinconf pins can be referenced via the names io0-io31. 143 Pinconf pins can be referenced via the names io0-io31.
67 144
68Valid values for XR9 pin names: 145Valid values for XR9 pin names: (DEPRECATED: Use xrX100/xRX200)
69 Pinconf pins can be referenced via the names io0-io55. 146 Pinconf pins can be referenced via the names io0-io55.
70 147
148Valid values for AMAZON pin names:
149 Pinconf pins can be referenced via the names io0-io31.
150
151Valid values for DANUBE pin names:
152 Pinconf pins can be referenced via the names io0-io31.
153
154Valid values for xRX100 pin names:
155 Pinconf pins can be referenced via the names io0-io55.
156
157Valid values for xRX200 pin names:
158 Pinconf pins can be referenced via the names io0-io49.
159
160Valid values for xRX300 pin names:
161 Pinconf pins can be referenced via the names io0-io1,io3-io6,io8-io11,
162 io13-io19,io23-io27,io34-io36,
163 io42-io43,io48-io61.
164
71Example: 165Example:
72 gpio: pinmux@E100B10 { 166 gpio: pinmux@E100B10 {
73 compatible = "lantiq,pinctrl-xway"; 167 compatible = "lantiq,danube-pinctrl";
74 pinctrl-names = "default"; 168 pinctrl-names = "default";
75 pinctrl-0 = <&state_default>; 169 pinctrl-0 = <&state_default>;
76 170
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt
index 0480bc31bfd7..9ffb0b276bb4 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt
@@ -4,10 +4,11 @@ The Mediatek's Pin controller is used to control SoC pins.
4 4
5Required properties: 5Required properties:
6- compatible: value should be one of the following. 6- compatible: value should be one of the following.
7 (a) "mediatek,mt8135-pinctrl", compatible with mt8135 pinctrl. 7 "mediatek,mt2701-pinctrl", compatible with mt2701 pinctrl.
8 (b) "mediatek,mt8173-pinctrl", compatible with mt8173 pinctrl. 8 "mediatek,mt6397-pinctrl", compatible with mt6397 pinctrl.
9 (c) "mediatek,mt6397-pinctrl", compatible with mt6397 pinctrl. 9 "mediatek,mt8127-pinctrl", compatible with mt8127 pinctrl.
10 (d) "mediatek,mt8127-pinctrl", compatible with mt8127 pinctrl. 10 "mediatek,mt8135-pinctrl", compatible with mt8135 pinctrl.
11 "mediatek,mt8173-pinctrl", compatible with mt8173 pinctrl.
11- pins-are-numbered: Specify the subnodes are using numbered pinmux to 12- pins-are-numbered: Specify the subnodes are using numbered pinmux to
12 specify pins. 13 specify pins.
13- gpio-controller : Marks the device node as a gpio controller. 14- gpio-controller : Marks the device node as a gpio controller.
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,msm8996-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,msm8996-pinctrl.txt
new file mode 100644
index 000000000000..e312a71b2f94
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,msm8996-pinctrl.txt
@@ -0,0 +1,199 @@
1Qualcomm MSM8996 TLMM block
2
3This binding describes the Top Level Mode Multiplexer block found in the
4MSM8996 platform.
5
6- compatible:
7 Usage: required
8 Value type: <string>
9 Definition: must be "qcom,msm8996-pinctrl"
10
11- reg:
12 Usage: required
13 Value type: <prop-encoded-array>
14 Definition: the base address and size of the TLMM register space.
15
16- interrupts:
17 Usage: required
18 Value type: <prop-encoded-array>
19 Definition: should specify the TLMM summary IRQ.
20
21- interrupt-controller:
22 Usage: required
23 Value type: <none>
24 Definition: identifies this node as an interrupt controller
25
26- #interrupt-cells:
27 Usage: required
28 Value type: <u32>
29 Definition: must be 2. Specifying the pin number and flags, as defined
30 in <dt-bindings/interrupt-controller/irq.h>
31
32- gpio-controller:
33 Usage: required
34 Value type: <none>
35 Definition: identifies this node as a gpio controller
36
37- #gpio-cells:
38 Usage: required
39 Value type: <u32>
40 Definition: must be 2. Specifying the pin number and flags, as defined
41 in <dt-bindings/gpio/gpio.h>
42
43Please refer to ../gpio/gpio.txt and ../interrupt-controller/interrupts.txt for
44a general description of GPIO and interrupt bindings.
45
46Please refer to pinctrl-bindings.txt in this directory for details of the
47common pinctrl bindings used by client devices, including the meaning of the
48phrase "pin configuration node".
49
50The pin configuration nodes act as a container for an arbitrary number of
51subnodes. Each of these subnodes represents some desired configuration for a
52pin, a group, or a list of pins or groups. This configuration can include the
53mux function to select on those pin(s)/group(s), and various pin configuration
54parameters, such as pull-up, drive strength, etc.
55
56
57PIN CONFIGURATION NODES:
58
59The name of each subnode is not important; all subnodes should be enumerated
60and processed purely based on their content.
61
62Each subnode only affects those parameters that are explicitly listed. In
63other words, a subnode that lists a mux function but no pin configuration
64parameters implies no information about any pin configuration parameters.
65Similarly, a pin subnode that describes a pullup parameter implies no
66information about e.g. the mux function.
67
68
69The following generic properties as defined in pinctrl-bindings.txt are valid
70to specify in a pin configuration subnode:
71
72- pins:
73 Usage: required
74 Value type: <string-array>
75 Definition: List of gpio pins affected by the properties specified in
76 this subnode.
77
78 Valid pins are:
79 gpio0-gpio149
80 Supports mux, bias and drive-strength
81
82 sdc1_clk, sdc1_cmd, sdc1_data sdc2_clk, sdc2_cmd,
83 sdc2_data sdc1_rclk
84 Supports bias and drive-strength
85
86- function:
87 Usage: required
88 Value type: <string>
89 Definition: Specify the alternative function to be configured for the
90 specified pins. Functions are only valid for gpio pins.
91 Valid values are:
92
93 blsp_uart1, blsp_spi1, blsp_i2c1, blsp_uim1, atest_tsens,
94 bimc_dte1, dac_calib0, blsp_spi8, blsp_uart8, blsp_uim8,
95 qdss_cti_trig_out_b, bimc_dte0, dac_calib1, qdss_cti_trig_in_b,
96 dac_calib2, atest_tsens2, atest_usb1, blsp_spi10, blsp_uart10,
97 blsp_uim10, atest_bbrx1, atest_usb13, atest_bbrx0, atest_usb12,
98 mdp_vsync, edp_lcd, blsp_i2c10, atest_gpsadc1, atest_usb11,
99 atest_gpsadc0, edp_hot, atest_usb10, m_voc, dac_gpio, atest_char,
100 cam_mclk, pll_bypassnl, qdss_stm7, blsp_i2c8, qdss_tracedata_b,
101 pll_reset, qdss_stm6, qdss_stm5, qdss_stm4, atest_usb2, cci_i2c,
102 qdss_stm3, dac_calib3, atest_usb23, atest_char3, dac_calib4,
103 qdss_stm2, atest_usb22, atest_char2, qdss_stm1, dac_calib5,
104 atest_usb21, atest_char1, dbg_out, qdss_stm0, dac_calib6,
105 atest_usb20, atest_char0, dac_calib10, qdss_stm10,
106 qdss_cti_trig_in_a, cci_timer4, blsp_spi6, blsp_uart6, blsp_uim6,
107 blsp2_spi, qdss_stm9, qdss_cti_trig_out_a, dac_calib11,
108 qdss_stm8, cci_timer0, qdss_stm13, dac_calib7, cci_timer1,
109 qdss_stm12, dac_calib8, cci_timer2, blsp1_spi, qdss_stm11,
110 dac_calib9, cci_timer3, cci_async, dac_calib12, blsp_i2c6,
111 qdss_tracectl_a, dac_calib13, qdss_traceclk_a, dac_calib14,
112 dac_calib15, hdmi_rcv, dac_calib16, hdmi_cec, pwr_modem,
113 dac_calib17, hdmi_ddc, pwr_nav, dac_calib18, pwr_crypto,
114 dac_calib19, hdmi_hot, dac_calib20, dac_calib21, pci_e0,
115 dac_calib22, dac_calib23, dac_calib24, tsif1_sync, dac_calib25,
116 sd_write, tsif1_error, blsp_spi2, blsp_uart2, blsp_uim2,
117 qdss_cti, blsp_i2c2, blsp_spi3, blsp_uart3, blsp_uim3, blsp_i2c3,
118 uim3, blsp_spi9, blsp_uart9, blsp_uim9, blsp10_spi, blsp_i2c9,
119 blsp_spi7, blsp_uart7, blsp_uim7, qdss_tracedata_a, blsp_i2c7,
120 qua_mi2s, gcc_gp1_clk_a, ssc_irq, uim4, blsp_spi11, blsp_uart11,
121 blsp_uim11, gcc_gp2_clk_a, gcc_gp3_clk_a, blsp_i2c11, cri_trng0,
122 cri_trng1, cri_trng, qdss_stm18, pri_mi2s, qdss_stm17, blsp_spi4,
123 blsp_uart4, blsp_uim4, qdss_stm16, qdss_stm15, blsp_i2c4,
124 qdss_stm14, dac_calib26, spkr_i2s, audio_ref, lpass_slimbus,
125 isense_dbg, tsense_pwm1, tsense_pwm2, btfm_slimbus, ter_mi2s,
126 qdss_stm22, qdss_stm21, qdss_stm20, qdss_stm19, gcc_gp1_clk_b,
127 sec_mi2s, blsp_spi5, blsp_uart5, blsp_uim5, gcc_gp2_clk_b,
128 gcc_gp3_clk_b, blsp_i2c5, blsp_spi12, blsp_uart12, blsp_uim12,
129 qdss_stm25, qdss_stm31, blsp_i2c12, qdss_stm30, qdss_stm29,
130 tsif1_clk, qdss_stm28, tsif1_en, tsif1_data, sdc4_cmd, qdss_stm27,
131 qdss_traceclk_b, tsif2_error, sdc43, vfr_1, qdss_stm26, tsif2_clk,
132 sdc4_clk, qdss_stm24, tsif2_en, sdc42, qdss_stm23, qdss_tracectl_b,
133 sd_card, tsif2_data, sdc41, tsif2_sync, sdc40, mdp_vsync_p_b,
134 ldo_en, mdp_vsync_s_b, ldo_update, blsp11_uart_tx_b, blsp11_uart_rx_b,
135 blsp11_i2c_sda_b, prng_rosc, blsp11_i2c_scl_b, uim2, uim1, uim_batt,
136 pci_e2, pa_indicator, adsp_ext, ddr_bist, qdss_tracedata_11,
137 qdss_tracedata_12, modem_tsync, nav_dr, nav_pps, pci_e1, gsm_tx,
138 qspi_cs, ssbi2, ssbi1, mss_lte, qspi_clk, qspi0, qspi1, qspi2, qspi3,
139 gpio
140
141- bias-disable:
142 Usage: optional
143 Value type: <none>
144 Definition: The specified pins should be configued as no pull.
145
146- bias-pull-down:
147 Usage: optional
148 Value type: <none>
149 Definition: The specified pins should be configued as pull down.
150
151- bias-pull-up:
152 Usage: optional
153 Value type: <none>
154 Definition: The specified pins should be configued as pull up.
155
156- output-high:
157 Usage: optional
158 Value type: <none>
159 Definition: The specified pins are configured in output mode, driven
160 high.
161 Not valid for sdc pins.
162
163- output-low:
164 Usage: optional
165 Value type: <none>
166 Definition: The specified pins are configured in output mode, driven
167 low.
168 Not valid for sdc pins.
169
170- drive-strength:
171 Usage: optional
172 Value type: <u32>
173 Definition: Selects the drive strength for the specified pins, in mA.
174 Valid values are: 2, 4, 6, 8, 10, 12, 14 and 16
175
176Example:
177
178 tlmm: pinctrl@01010000 {
179 compatible = "qcom,msm8996-pinctrl";
180 reg = <0x01010000 0x300000>;
181 interrupts = <0 208 0>;
182 gpio-controller;
183 #gpio-cells = <2>;
184 interrupt-controller;
185 #interrupt-cells = <2>;
186
187 uart_console_active: uart_console_active {
188 mux {
189 pins = "gpio4", "gpio5";
190 function = "blsp_uart8";
191 };
192
193 config {
194 pins = "gpio4", "gpio5";
195 drive-strength = <2>;
196 bias-disable;
197 };
198 };
199 };
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.txt b/Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.txt
index 1ae63c0acd40..a90c812ad642 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,pmic-gpio.txt
@@ -14,6 +14,7 @@ PMIC's from Qualcomm.
14 "qcom,pm8917-gpio" 14 "qcom,pm8917-gpio"
15 "qcom,pm8921-gpio" 15 "qcom,pm8921-gpio"
16 "qcom,pm8941-gpio" 16 "qcom,pm8941-gpio"
17 "qcom,pm8994-gpio"
17 "qcom,pma8084-gpio" 18 "qcom,pma8084-gpio"
18 19
19- reg: 20- reg:
@@ -79,6 +80,7 @@ to specify in a pin configuration subnode:
79 gpio1-gpio38 for pm8917 80 gpio1-gpio38 for pm8917
80 gpio1-gpio44 for pm8921 81 gpio1-gpio44 for pm8921
81 gpio1-gpio36 for pm8941 82 gpio1-gpio36 for pm8941
83 gpio1-gpio22 for pm8994
82 gpio1-gpio22 for pma8084 84 gpio1-gpio22 for pma8084
83 85
84- function: 86- function:
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.txt b/Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.txt
index d7803a2a94e9..d74e631e10da 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.txt
@@ -15,6 +15,7 @@ of PMIC's from Qualcomm.
15 "qcom,pm8917-mpp", 15 "qcom,pm8917-mpp",
16 "qcom,pm8921-mpp", 16 "qcom,pm8921-mpp",
17 "qcom,pm8941-mpp", 17 "qcom,pm8941-mpp",
18 "qcom,pm8994-mpp",
18 "qcom,pma8084-mpp", 19 "qcom,pma8084-mpp",
19 20
20- reg: 21- reg:
diff --git a/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
index 391ef4be8d50..0cd701b1947f 100644
--- a/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/rockchip,pinctrl.txt
@@ -21,7 +21,8 @@ defined as gpio sub-nodes of the pinmux controller.
21Required properties for iomux controller: 21Required properties for iomux controller:
22 - compatible: one of "rockchip,rk2928-pinctrl", "rockchip,rk3066a-pinctrl" 22 - compatible: one of "rockchip,rk2928-pinctrl", "rockchip,rk3066a-pinctrl"
23 "rockchip,rk3066b-pinctrl", "rockchip,rk3188-pinctrl" 23 "rockchip,rk3066b-pinctrl", "rockchip,rk3188-pinctrl"
24 "rockchip,rk3288-pinctrl", "rockchip,rk3368-pinctrl" 24 "rockchip,rk3228-pinctrl", "rockchip,rk3288-pinctrl"
25 "rockchip,rk3368-pinctrl"
25 - rockchip,grf: phandle referencing a syscon providing the 26 - rockchip,grf: phandle referencing a syscon providing the
26 "general register files" 27 "general register files"
27 28
diff --git a/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
index 9d2a995293e6..6db16b90873a 100644
--- a/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
@@ -17,6 +17,7 @@ Required Properties:
17 - "samsung,exynos4x12-pinctrl": for Exynos4x12 compatible pin-controller. 17 - "samsung,exynos4x12-pinctrl": for Exynos4x12 compatible pin-controller.
18 - "samsung,exynos5250-pinctrl": for Exynos5250 compatible pin-controller. 18 - "samsung,exynos5250-pinctrl": for Exynos5250 compatible pin-controller.
19 - "samsung,exynos5260-pinctrl": for Exynos5260 compatible pin-controller. 19 - "samsung,exynos5260-pinctrl": for Exynos5260 compatible pin-controller.
20 - "samsung,exynos5410-pinctrl": for Exynos5410 compatible pin-controller.
20 - "samsung,exynos5420-pinctrl": for Exynos5420 compatible pin-controller. 21 - "samsung,exynos5420-pinctrl": for Exynos5420 compatible pin-controller.
21 - "samsung,exynos7-pinctrl": for Exynos7 compatible pin-controller. 22 - "samsung,exynos7-pinctrl": for Exynos7 compatible pin-controller.
22 23
diff --git a/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
index cfe1db3bb6e9..74b5bc5dd19a 100644
--- a/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
+++ b/Documentation/devicetree/bindings/pwm/lpc32xx-pwm.txt
@@ -6,7 +6,12 @@ Required properties:
6 6
7Examples: 7Examples:
8 8
9pwm@0x4005C000 { 9pwm@4005c000 {
10 compatible = "nxp,lpc3220-pwm"; 10 compatible = "nxp,lpc3220-pwm";
11 reg = <0x4005C000 0x8>; 11 reg = <0x4005c000 0x4>;
12};
13
14pwm@4005c004 {
15 compatible = "nxp,lpc3220-pwm";
16 reg = <0x4005c004 0x4>;
12}; 17};
diff --git a/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt b/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt
new file mode 100644
index 000000000000..5befb538db95
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt
@@ -0,0 +1,18 @@
1* OMAP PWM for dual-mode timers
2
3Required properties:
4- compatible: Shall contain "ti,omap-dmtimer-pwm".
5- ti,timers: phandle to PWM capable OMAP timer. See arm/omap/timer.txt for info
6 about these timers.
7- #pwm-cells: Should be 3. See pwm.txt in this directory for a description of
8 the cells format.
9
10Optional properties:
11- ti,prescaler: Should be a value between 0 and 7, see the timers datasheet
12
13Example:
14 pwm9: dmtimer-pwm@9 {
15 compatible = "ti,omap-dmtimer-pwm";
16 ti,timers = <&timer9>;
17 #pwm-cells = <3>;
18 };
diff --git a/Documentation/devicetree/bindings/regulator/lm363x-regulator.txt b/Documentation/devicetree/bindings/regulator/lm363x-regulator.txt
new file mode 100644
index 000000000000..8f14df9d1205
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/lm363x-regulator.txt
@@ -0,0 +1,34 @@
1TI LMU LM363x regulator device tree bindings
2
3LM363x regulator driver supports LM3631 and LM3632.
4LM3631 has five regulators and LM3632 supports three regulators.
5
6Required property:
7 - compatible: "ti,lm363x-regulator"
8
9Optional properties:
10 LM3632 has external enable pins for two LDOs.
11 - ti,lcm-en1-gpio: A GPIO specifier for Vpos control pin.
12 - ti,lcm-en2-gpio: A GPIO specifier for Vneg control pin.
13
14Child nodes:
15 LM3631
16 - vboost
17 - vcont
18 - voref
19 - vpos
20 - vneg
21
22 LM3632
23 - vboost
24 - vpos
25 - vneg
26
27 Optional properties of a child node:
28 Each sub-node should contain the constraints and initialization.
29 Please refer to [1].
30
31Examples: Please refer to ti-lmu dt-bindings [2].
32
33[1] ../regulator/regulator.txt
34[2] ../mfd/ti-lmu.txt
diff --git a/Documentation/devicetree/bindings/regulator/pv88060.txt b/Documentation/devicetree/bindings/regulator/pv88060.txt
new file mode 100644
index 000000000000..10a6dadc008e
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/pv88060.txt
@@ -0,0 +1,124 @@
1* Powerventure Semiconductor PV88060 Voltage Regulator
2
3Required properties:
4- compatible: "pvs,pv88060".
5- reg: I2C slave address, usually 0x49.
6- interrupts: the interrupt outputs of the controller
7- regulators: A node that houses a sub-node for each regulator within the
8 device. Each sub-node is identified using the node's name, with valid
9 values listed below. The content of each sub-node is defined by the
10 standard binding for regulators; see regulator.txt.
11 BUCK1, LDO1, LDO2, LDO3, LDO4, LDO5, LDO6, LDO7, SW1, SW2, SW3, SW4,
12 SW5, and SW6.
13
14Optional properties:
15- Any optional property defined in regulator.txt
16
17Example
18
19 pmic: pv88060@49 {
20 compatible = "pvs,pv88060";
21 reg = <0x49>;
22 interrupt-parent = <&gpio>;
23 interrupts = <24 24>;
24
25 regulators {
26 BUCK1 {
27 regulator-name = "buck1";
28 regulator-min-microvolt = <2800000>;
29 regulator-max-microvolt = <4387500>;
30 regulator-min-microamp = <1496000>;
31 regulator-max-microamp = <4189000>;
32 regulator-boot-on;
33 };
34
35 LDO1 {
36 regulator-name = "ldo1";
37 regulator-min-microvolt = <1200000>;
38 regulator-max-microvolt = <3350000>;
39 regulator-boot-on;
40 };
41
42 LDO2 {
43 regulator-name = "ldo2";
44 regulator-min-microvolt = <1200000>;
45 regulator-max-microvolt = <3350000>;
46 regulator-boot-on;
47 };
48
49 LDO3 {
50 regulator-name = "ldo3";
51 regulator-min-microvolt = <1200000>;
52 regulator-max-microvolt = <3350000>;
53 regulator-boot-on;
54 };
55
56 LDO4 {
57 regulator-name = "ldo4";
58 regulator-min-microvolt = <1200000>;
59 regulator-max-microvolt = <3350000>;
60 regulator-boot-on;
61 };
62
63 LDO5 {
64 regulator-name = "ldo5";
65 regulator-min-microvolt = <1200000>;
66 regulator-max-microvolt = <3350000>;
67 regulator-boot-on;
68 };
69
70 LDO6 {
71 regulator-name = "ldo6";
72 regulator-min-microvolt = <1200000>;
73 regulator-max-microvolt = <3350000>;
74 regulator-boot-on;
75 };
76
77 LDO7 {
78 regulator-name = "ldo7";
79 regulator-min-microvolt = <1200000>;
80 regulator-max-microvolt = <3350000>;
81 regulator-boot-on;
82 };
83
84 SW1 {
85 regulator-name = "sw1";
86 regulator-min-microvolt = <5000000>;
87 regulator-max-microvolt = <5000000>;
88 };
89
90 SW2 {
91 regulator-name = "sw2";
92 regulator-min-microvolt = <5000000>;
93 regulator-max-microvolt = <5000000>;
94 regulator-boot-on;
95 };
96
97 SW3 {
98 regulator-name = "sw3";
99 regulator-min-microvolt = <5000000>;
100 regulator-max-microvolt = <5000000>;
101 regulator-boot-on;
102 };
103
104 SW4 {
105 regulator-name = "sw4";
106 regulator-min-microvolt = <5000000>;
107 regulator-max-microvolt = <5000000>;
108 regulator-boot-on;
109 };
110
111 SW5 {
112 regulator-name = "sw5";
113 regulator-min-microvolt = <5000000>;
114 regulator-max-microvolt = <5000000>;
115 regulator-boot-on;
116 };
117
118 SW6 {
119 regulator-name = "sw6";
120 regulator-min-microvolt = <5000000>;
121 regulator-max-microvolt = <5000000>;
122 };
123 };
124 }; \ No newline at end of file
diff --git a/Documentation/devicetree/bindings/regulator/pv88090.txt b/Documentation/devicetree/bindings/regulator/pv88090.txt
new file mode 100644
index 000000000000..e52b2a95cdde
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/pv88090.txt
@@ -0,0 +1,65 @@
1* Powerventure Semiconductor PV88090 Voltage Regulator
2
3Required properties:
4- compatible: "pvs,pv88090".
5- reg: I2C slave address, usually 0x48.
6- interrupts: the interrupt outputs of the controller
7- regulators: A node that houses a sub-node for each regulator within the
8 device. Each sub-node is identified using the node's name, with valid
9 values listed below. The content of each sub-node is defined by the
10 standard binding for regulators; see regulator.txt.
11 BUCK1, BUCK2, BUCK3, LDO1, and LDO2.
12
13Optional properties:
14- Any optional property defined in regulator.txt
15
16Example
17
18 pmic: pv88090@48 {
19 compatible = "pvs,pv88090";
20 reg = <0x48>;
21 interrupt-parent = <&gpio>;
22 interrupts = <24 24>;
23
24 regulators {
25 BUCK1 {
26 regulator-name = "buck1";
27 regulator-min-microvolt = < 600000>;
28 regulator-max-microvolt = <1393750>;
29 regulator-min-microamp = < 220000>;
30 regulator-max-microamp = <7040000>;
31 regulator-boot-on;
32 };
33
34 BUCK2 {
35 regulator-name = "buck2";
36 regulator-min-microvolt = < 600000>;
37 regulator-max-microvolt = <1393750>;
38 regulator-min-microamp = <1496000>;
39 regulator-max-microamp = <4189000>;
40 };
41
42 BUCK3 {
43 regulator-name = "buck3";
44 regulator-min-microvolt = <600000>;
45 regulator-max-microvolt = <1393750>;
46 regulator-min-microamp = <1496000>;
47 regulator-max-microamp = <4189000>;
48 regulator-boot-on;
49 };
50
51 LDO1 {
52 regulator-name = "ldo1";
53 regulator-min-microvolt = <1200000>;
54 regulator-max-microvolt = <4350000>;
55 regulator-boot-on;
56 };
57
58 LDO2 {
59 regulator-name = "ldo2";
60 regulator-min-microvolt = < 650000>;
61 regulator-max-microvolt = <2225000>;
62 regulator-boot-on;
63 };
64 };
65 };
diff --git a/Documentation/devicetree/bindings/soc/qcom,smd-rpm.txt b/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
index e27f5c4c54fd..1f8d6f84b657 100644
--- a/Documentation/devicetree/bindings/soc/qcom,smd-rpm.txt
+++ b/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
@@ -1,27 +1,17 @@
1Qualcomm Resource Power Manager (RPM) over SMD 1QCOM SMD RPM REGULATOR
2 2
3This driver is used to interface with the Resource Power Manager (RPM) found in 3The Qualcomm RPM over SMD regulator is modelled as a subdevice of the RPM.
4various Qualcomm platforms. The RPM allows each component in the system to vote 4Because SMD is used as the communication transport mechanism, the RPM resides as
5for state of the system resources, such as clocks, regulators and bus 5a subnode of the SMD. As such, the SMD-RPM regulator requires that the SMD and
6frequencies. 6RPM nodes be present.
7 7
8- compatible: 8Please refer to Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt for
9 Usage: required 9information pertaining to the SMD node.
10 Value type: <string>
11 Definition: must be one of:
12 "qcom,rpm-msm8974"
13 10
14- qcom,smd-channels: 11Please refer to Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt for
15 Usage: required 12information regarding the RPM node.
16 Value type: <stringlist>
17 Definition: Shared Memory channel used for communication with the RPM
18 13
19= SUBDEVICES 14== Regulator
20
21The RPM exposes resources to its subnodes. The below bindings specify the set
22of valid subnodes that can operate on these resources.
23
24== Regulators
25 15
26Regulator nodes are identified by their compatible: 16Regulator nodes are identified by their compatible:
27 17
@@ -30,7 +20,9 @@ Regulator nodes are identified by their compatible:
30 Value type: <string> 20 Value type: <string>
31 Definition: must be one of: 21 Definition: must be one of:
32 "qcom,rpm-pm8841-regulators" 22 "qcom,rpm-pm8841-regulators"
23 "qcom,rpm-pm8916-regulators"
33 "qcom,rpm-pm8941-regulators" 24 "qcom,rpm-pm8941-regulators"
25 "qcom,rpm-pma8084-regulators"
34 26
35- vdd_s1-supply: 27- vdd_s1-supply:
36- vdd_s2-supply: 28- vdd_s2-supply:
@@ -48,6 +40,19 @@ Regulator nodes are identified by their compatible:
48- vdd_s1-supply: 40- vdd_s1-supply:
49- vdd_s2-supply: 41- vdd_s2-supply:
50- vdd_s3-supply: 42- vdd_s3-supply:
43- vdd_s4-supply:
44- vdd_l1_l2_l3-supply:
45- vdd_l4_l5_l6-supply:
46- vdd_l7-supply:
47- vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18-supply:
48 Usage: optional (pm8916 only)
49 Value type: <phandle>
50 Definition: reference to regulator supplying the input pin, as
51 described in the data sheet
52
53- vdd_s1-supply:
54- vdd_s2-supply:
55- vdd_s3-supply:
51- vdd_l1_l3-supply: 56- vdd_l1_l3-supply:
52- vdd_l2_lvs1_2_3-supply: 57- vdd_l2_lvs1_2_3-supply:
53- vdd_l4_l11-supply: 58- vdd_l4_l11-supply:
@@ -63,6 +68,35 @@ Regulator nodes are identified by their compatible:
63 Definition: reference to regulator supplying the input pin, as 68 Definition: reference to regulator supplying the input pin, as
64 described in the data sheet 69 described in the data sheet
65 70
71- vdd_s1-supply:
72- vdd_s2-supply:
73- vdd_s3-supply:
74- vdd_s4-supply:
75- vdd_s5-supply:
76- vdd_s6-supply:
77- vdd_s7-supply:
78- vdd_s8-supply:
79- vdd_s9-supply:
80- vdd_s10-supply:
81- vdd_s11-supply:
82- vdd_s12-supply:
83- vdd_l1_l11-supply:
84- vdd_l2_l3_l4_l27-supply:
85- vdd_l5_l7-supply:
86- vdd_l6_l12_l14_l15_l26-supply:
87- vdd_l8-supply:
88- vdd_l9_l10_l13_l20_l23_l24-supply:
89- vdd_l16_l25-supply:
90- vdd_l17-supply:
91- vdd_l18-supply:
92- vdd_l19-supply:
93- vdd_l21-supply:
94- vdd_l22-supply:
95 Usage: optional (pma8084 only)
96 Value type: <phandle>
97 Definition: reference to regulator supplying the input pin, as
98 described in the data sheet
99
66The regulator node houses sub-nodes for each regulator within the device. Each 100The regulator node houses sub-nodes for each regulator within the device. Each
67sub-node is identified using the node's name, with valid values listed for each 101sub-node is identified using the node's name, with valid values listed for each
68of the pmics below. 102of the pmics below.
@@ -70,11 +104,20 @@ of the pmics below.
70pm8841: 104pm8841:
71 s1, s2, s3, s4, s5, s6, s7, s8 105 s1, s2, s3, s4, s5, s6, s7, s8
72 106
107pm8916:
108 s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13,
109 l14, l15, l16, l17, l18
110
73pm8941: 111pm8941:
74 s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, 112 s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13,
75 l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, 113 l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2,
76 lvs3, 5vs1, 5vs2 114 lvs3, 5vs1, 5vs2
77 115
116pma8084:
117 s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, l1, l2, l3, l4, l5,
118 l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19, l20,
119 l21, l22, l23, l24, l25, l26, l27, lvs1, lvs2, lvs3, lvs4, 5vs1
120
78The content of each sub-node is defined by the standard binding for regulators - 121The content of each sub-node is defined by the standard binding for regulators -
79see regulator.txt. 122see regulator.txt.
80 123
@@ -114,4 +157,3 @@ see regulator.txt.
114 }; 157 };
115 }; 158 };
116 }; 159 };
117
diff --git a/Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt b/Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt
deleted file mode 100644
index 20191315e444..000000000000
--- a/Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt
+++ /dev/null
@@ -1,163 +0,0 @@
1* Samsung S5M8767 Voltage and Current Regulator
2
3The Samsung S5M8767 is a multi-function device which includes voltage and
4current regulators, rtc, charger controller and other sub-blocks. It is
5interfaced to the host controller using a i2c interface. Each sub-block is
6addressed by the host system using different i2c slave address. This document
7describes the bindings for 'pmic' sub-block of s5m8767.
8
9Required properties:
10- compatible: Should be "samsung,s5m8767-pmic".
11- reg: Specifies the i2c slave address of the pmic block. It should be 0x66.
12
13- s5m8767,pmic-buck2-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
14 units for buck2 when changing voltage using gpio dvs. Refer to [1] below
15 for additional information.
16
17- s5m8767,pmic-buck3-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
18 units for buck3 when changing voltage using gpio dvs. Refer to [1] below
19 for additional information.
20
21- s5m8767,pmic-buck4-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
22 units for buck4 when changing voltage using gpio dvs. Refer to [1] below
23 for additional information.
24
25- s5m8767,pmic-buck-ds-gpios: GPIO specifiers for three host gpio's used
26 for selecting GPIO DVS lines. It is one-to-one mapped to dvs gpio lines.
27
28[1] If none of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional
29 property is specified, the 's5m8767,pmic-buck[2/3/4]-dvs-voltage'
30 property should specify atleast one voltage level (which would be a
31 safe operating voltage).
32
33 If either of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional
34 property is specified, then all the eight voltage values for the
35 's5m8767,pmic-buck[2/3/4]-dvs-voltage' should be specified.
36
37Optional properties:
38- interrupt-parent: Specifies the phandle of the interrupt controller to which
39 the interrupts from s5m8767 are delivered to.
40- interrupts: Interrupt specifiers for two interrupt sources.
41 - First interrupt specifier is for 'irq1' interrupt.
42 - Second interrupt specifier is for 'alert' interrupt.
43- s5m8767,pmic-buck2-uses-gpio-dvs: 'buck2' can be controlled by gpio dvs.
44- s5m8767,pmic-buck3-uses-gpio-dvs: 'buck3' can be controlled by gpio dvs.
45- s5m8767,pmic-buck4-uses-gpio-dvs: 'buck4' can be controlled by gpio dvs.
46
47Additional properties required if either of the optional properties are used:
48
49- s5m8767,pmic-buck234-default-dvs-idx: Default voltage setting selected from
50 the possible 8 options selectable by the dvs gpios. The value of this
51 property should be between 0 and 7. If not specified or if out of range, the
52 default value of this property is set to 0.
53
54- s5m8767,pmic-buck-dvs-gpios: GPIO specifiers for three host gpio's used
55 for dvs. The format of the gpio specifier depends in the gpio controller.
56
57Regulators: The regulators of s5m8767 that have to be instantiated should be
58included in a sub-node named 'regulators'. Regulator nodes included in this
59sub-node should be of the format as listed below.
60
61 regulator_name {
62 ldo1_reg: LDO1 {
63 regulator-name = "VDD_ALIVE_1.0V";
64 regulator-min-microvolt = <1100000>;
65 regulator-max-microvolt = <1100000>;
66 regulator-always-on;
67 regulator-boot-on;
68 op_mode = <1>; /* Normal Mode */
69 };
70 };
71The above regulator entries are defined in regulator bindings documentation
72except these properties:
73 - op_mode: describes the different operating modes of the LDO's with
74 power mode change in SOC. The different possible values are,
75 0 - always off mode
76 1 - on in normal mode
77 2 - low power mode
78 3 - suspend mode
79 - s5m8767,pmic-ext-control-gpios: (optional) GPIO specifier for one
80 GPIO controlling this regulator (enable/disable); This is
81 valid only for buck9.
82
83The following are the names of the regulators that the s5m8767 pmic block
84supports. Note: The 'n' in LDOn and BUCKn represents the LDO or BUCK number
85as per the datasheet of s5m8767.
86
87 - LDOn
88 - valid values for n are 1 to 28
89 - Example: LDO1, LDO2, LDO28
90 - BUCKn
91 - valid values for n are 1 to 9.
92 - Example: BUCK1, BUCK2, BUCK9
93
94The bindings inside the regulator nodes use the standard regulator bindings
95which are documented elsewhere.
96
97Example:
98
99 s5m8767_pmic@66 {
100 compatible = "samsung,s5m8767-pmic";
101 reg = <0x66>;
102
103 s5m8767,pmic-buck2-uses-gpio-dvs;
104 s5m8767,pmic-buck3-uses-gpio-dvs;
105 s5m8767,pmic-buck4-uses-gpio-dvs;
106
107 s5m8767,pmic-buck-default-dvs-idx = <0>;
108
109 s5m8767,pmic-buck-dvs-gpios = <&gpx0 0 0>, /* DVS1 */
110 <&gpx0 1 0>, /* DVS2 */
111 <&gpx0 2 0>; /* DVS3 */
112
113 s5m8767,pmic-buck-ds-gpios = <&gpx2 3 0>, /* SET1 */
114 <&gpx2 4 0>, /* SET2 */
115 <&gpx2 5 0>; /* SET3 */
116
117 s5m8767,pmic-buck2-dvs-voltage = <1350000>, <1300000>,
118 <1250000>, <1200000>,
119 <1150000>, <1100000>,
120 <1000000>, <950000>;
121
122 s5m8767,pmic-buck3-dvs-voltage = <1100000>, <1100000>,
123 <1100000>, <1100000>,
124 <1000000>, <1000000>,
125 <1000000>, <1000000>;
126
127 s5m8767,pmic-buck4-dvs-voltage = <1200000>, <1200000>,
128 <1200000>, <1200000>,
129 <1200000>, <1200000>,
130 <1200000>, <1200000>;
131
132 regulators {
133 ldo1_reg: LDO1 {
134 regulator-name = "VDD_ABB_3.3V";
135 regulator-min-microvolt = <3300000>;
136 regulator-max-microvolt = <3300000>;
137 op_mode = <1>; /* Normal Mode */
138 };
139
140 ldo2_reg: LDO2 {
141 regulator-name = "VDD_ALIVE_1.1V";
142 regulator-min-microvolt = <1100000>;
143 regulator-max-microvolt = <1100000>;
144 regulator-always-on;
145 };
146
147 buck1_reg: BUCK1 {
148 regulator-name = "VDD_MIF_1.2V";
149 regulator-min-microvolt = <950000>;
150 regulator-max-microvolt = <1350000>;
151 regulator-always-on;
152 regulator-boot-on;
153 };
154
155 vemmc_reg: BUCK9 {
156 regulator-name = "VMEM_VDD_2.8V";
157 regulator-min-microvolt = <2800000>;
158 regulator-max-microvolt = <2800000>;
159 op_mode = <3>; /* Standby Mode */
160 s5m8767,pmic-ext-control-gpios = <&gpk0 2 0>;
161 };
162 };
163 };
diff --git a/Documentation/devicetree/bindings/regulator/samsung,s2mpa01.txt b/Documentation/devicetree/bindings/regulator/samsung,s2mpa01.txt
new file mode 100644
index 000000000000..bae3c7f838cf
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/samsung,s2mpa01.txt
@@ -0,0 +1,79 @@
1Binding for Samsung S2MPA01 regulator block
2===========================================
3
4This is a part of device tree bindings for S2M family multi-function devices.
5More information can be found in bindings/mfd/sec-core.txt file.
6
7The S2MPA01 device provide buck and LDO regulators.
8
9To register these with regulator framework instantiate under main device node
10a sub-node named "regulators" with more sub-nodes for each regulator using the
11common regulator binding documented in:
12 - Documentation/devicetree/bindings/regulator/regulator.txt
13
14
15Names of regulators supported by S2MPA01 device:
16 - LDOn
17 - valid values for n are 1 to 26
18 - Example: LDO1, LD02, LDO26
19 - BUCKn
20 - valid values for n are 1 to 10.
21 - Example: BUCK1, BUCK2, BUCK9
22Note: The 'n' in LDOn and BUCKn represents the LDO or BUCK number
23as per the datasheet of device.
24
25
26Optional properties of buck regulator nodes under "regulators" sub-node:
27 - regulator-ramp-delay: ramp delay in uV/us. May be 6250, 12500
28 (default), 25000, or 50000. May be 0 for disabling the ramp delay on
29 BUCK{1,2,3,4}.
30
31 In the absence of the regulator-ramp-delay property, the default ramp
32 delay will be used.
33
34 Note: Some bucks share the ramp rate setting i.e. same ramp value
35 will be set for a particular group of bucks so provide the same
36 regulator-ramp-delay value for them.
37 Groups sharing ramp rate:
38 - buck{1,6},
39 - buck{2,4},
40 - buck{8,9,10}.
41
42Example:
43
44 s2mpa01_pmic@66 {
45 compatible = "samsung,s2mpa01-pmic";
46 reg = <0x66>;
47
48 regulators {
49 ldo1_reg: LDO1 {
50 regulator-name = "VDD_ALIVE";
51 regulator-min-microvolt = <1000000>;
52 regulator-max-microvolt = <1000000>;
53 };
54
55 ldo2_reg: LDO2 {
56 regulator-name = "VDDQ_MMC2";
57 regulator-min-microvolt = <2800000>;
58 regulator-max-microvolt = <2800000>;
59 regulator-always-on;
60 };
61
62 buck1_reg: BUCK1 {
63 regulator-name = "vdd_mif";
64 regulator-min-microvolt = <950000>;
65 regulator-max-microvolt = <1350000>;
66 regulator-always-on;
67 regulator-boot-on;
68 };
69
70 buck2_reg: BUCK2 {
71 regulator-name = "vdd_arm";
72 regulator-min-microvolt = <950000>;
73 regulator-max-microvolt = <1350000>;
74 regulator-always-on;
75 regulator-boot-on;
76 regulator-ramp-delay = <50000>;
77 };
78 };
79 };
diff --git a/Documentation/devicetree/bindings/regulator/samsung,s2mps11.txt b/Documentation/devicetree/bindings/regulator/samsung,s2mps11.txt
new file mode 100644
index 000000000000..27a48bf1b185
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/samsung,s2mps11.txt
@@ -0,0 +1,102 @@
1Binding for Samsung S2M family regulator block
2==============================================
3
4This is a part of device tree bindings for S2M family multi-function devices.
5More information can be found in bindings/mfd/sec-core.txt file.
6
7The S2MPS11/13/14/15 and S2MPU02 devices provide buck and LDO regulators.
8
9To register these with regulator framework instantiate under main device node
10a sub-node named "regulators" with more sub-nodes for each regulator using the
11common regulator binding documented in:
12 - Documentation/devicetree/bindings/regulator/regulator.txt
13
14
15Names of regulators supported by different devices:
16 - LDOn
17 - valid values for n are:
18 - S2MPS11: 1 to 38
19 - S2MPS13: 1 to 40
20 - S2MPS14: 1 to 25
21 - S2MPS15: 1 to 27
22 - S2MPU02: 1 to 28
23 - Example: LDO1, LDO2, LDO28
24 - BUCKn
25 - valid values for n are:
26 - S2MPS11: 1 to 10
27 - S2MPS13: 1 to 10
28 - S2MPS14: 1 to 5
29 - S2MPS15: 1 to 10
30 - S2MPU02: 1 to 7
31 - Example: BUCK1, BUCK2, BUCK9
32Note: The 'n' in LDOn and BUCKn represents the LDO or BUCK number
33as per the datasheet of device.
34
35
36Optional properties of the nodes under "regulators" sub-node:
37 - regulator-ramp-delay: ramp delay in uV/us. May be 6250, 12500,
38 25000 (default) or 50000.
39
40 Additionally S2MPS11 supports disabling ramp delay for BUCK{2,3,4,6}
41 by setting it to <0>.
42
43 Note: On S2MPS11 some bucks share the ramp rate setting i.e. same ramp value
44 will be set for a particular group of bucks so provide the same
45 regulator-ramp-delay value for them.
46 Groups sharing ramp rate:
47 - buck{1,6},
48 - buck{3,4},
49 - buck{7,8,10}.
50
51 - samsung,ext-control-gpios: On S2MPS14 the LDO10, LDO11 and LDO12 can be
52 configured to external control over GPIO. To turn this feature on this
53 property must be added to the regulator sub-node:
54 - samsung,ext-control-gpios: GPIO specifier for one GPIO
55 controlling this regulator (enable/disable)
56 Example:
57 LDO12 {
58 regulator-name = "V_EMMC_2.8V";
59 regulator-min-microvolt = <2800000>;
60 regulator-max-microvolt = <2800000>;
61 samsung,ext-control-gpios = <&gpk0 2 0>;
62 };
63
64
65Example:
66
67 s2mps11_pmic@66 {
68 compatible = "samsung,s2mps11-pmic";
69 reg = <0x66>;
70
71 regulators {
72 ldo1_reg: LDO1 {
73 regulator-name = "VDD_ABB_3.3V";
74 regulator-min-microvolt = <3300000>;
75 regulator-max-microvolt = <3300000>;
76 };
77
78 ldo2_reg: LDO2 {
79 regulator-name = "VDD_ALIVE_1.1V";
80 regulator-min-microvolt = <1100000>;
81 regulator-max-microvolt = <1100000>;
82 regulator-always-on;
83 };
84
85 buck1_reg: BUCK1 {
86 regulator-name = "vdd_mif";
87 regulator-min-microvolt = <950000>;
88 regulator-max-microvolt = <1350000>;
89 regulator-always-on;
90 regulator-boot-on;
91 };
92
93 buck2_reg: BUCK2 {
94 regulator-name = "vdd_arm";
95 regulator-min-microvolt = <950000>;
96 regulator-max-microvolt = <1350000>;
97 regulator-always-on;
98 regulator-boot-on;
99 regulator-ramp-delay = <50000>;
100 };
101 };
102 };
diff --git a/Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt b/Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt
new file mode 100644
index 000000000000..093edda0c8df
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt
@@ -0,0 +1,145 @@
1Binding for Samsung S5M8767 regulator block
2===========================================
3
4This is a part of device tree bindings for S5M family multi-function devices.
5More information can be found in bindings/mfd/sec-core.txt file.
6
7The S5M8767 device provide buck and LDO regulators.
8
9To register these with regulator framework instantiate under main device node
10a sub-node named "regulators" with more sub-nodes for each regulator using the
11common regulator binding documented in:
12 - Documentation/devicetree/bindings/regulator/regulator.txt
13
14
15Required properties of the main device node (the parent!):
16 - s5m8767,pmic-buck2-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
17 units for buck2 when changing voltage using gpio dvs. Refer to [1] below
18 for additional information.
19
20 - s5m8767,pmic-buck3-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
21 units for buck3 when changing voltage using gpio dvs. Refer to [1] below
22 for additional information.
23
24 - s5m8767,pmic-buck4-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
25 units for buck4 when changing voltage using gpio dvs. Refer to [1] below
26 for additional information.
27
28 - s5m8767,pmic-buck-ds-gpios: GPIO specifiers for three host gpio's used
29 for selecting GPIO DVS lines. It is one-to-one mapped to dvs gpio lines.
30
31 [1] If none of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional
32 property is specified, the 's5m8767,pmic-buck[2/3/4]-dvs-voltage'
33 property should specify atleast one voltage level (which would be a
34 safe operating voltage).
35
36 If either of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional
37 property is specified, then all the eight voltage values for the
38 's5m8767,pmic-buck[2/3/4]-dvs-voltage' should be specified.
39
40Optional properties of the main device node (the parent!):
41 - s5m8767,pmic-buck2-uses-gpio-dvs: 'buck2' can be controlled by gpio dvs.
42 - s5m8767,pmic-buck3-uses-gpio-dvs: 'buck3' can be controlled by gpio dvs.
43 - s5m8767,pmic-buck4-uses-gpio-dvs: 'buck4' can be controlled by gpio dvs.
44
45Additional properties required if either of the optional properties are used:
46
47 - s5m8767,pmic-buck234-default-dvs-idx: Default voltage setting selected from
48 the possible 8 options selectable by the dvs gpios. The value of this
49 property should be between 0 and 7. If not specified or if out of range, the
50 default value of this property is set to 0.
51
52 - s5m8767,pmic-buck-dvs-gpios: GPIO specifiers for three host gpio's used
53 for dvs. The format of the gpio specifier depends in the gpio controller.
54
55
56Names of regulators supported by S5M8767 device:
57 - LDOn
58 - valid values for n are 1 to 28
59 - Example: LDO1, LDO2, LDO28
60 - BUCKn
61 - valid values for n are 1 to 9.
62 - Example: BUCK1, BUCK2, BUCK9
63Note: The 'n' in LDOn and BUCKn represents the LDO or BUCK number
64as per the datasheet of device.
65
66
67Optional properties of the nodes under "regulators" sub-node:
68 - op_mode: describes the different operating modes of the LDO's with
69 power mode change in SOC. The different possible values are,
70 0 - always off mode
71 1 - on in normal mode
72 2 - low power mode
73 3 - suspend mode
74 - s5m8767,pmic-ext-control-gpios: (optional) GPIO specifier for one
75 GPIO controlling this regulator
76 (enable/disable); This is valid only
77 for buck9.
78
79Example:
80
81 s5m8767_pmic@66 {
82 compatible = "samsung,s5m8767-pmic";
83 reg = <0x66>;
84
85 s5m8767,pmic-buck2-uses-gpio-dvs;
86 s5m8767,pmic-buck3-uses-gpio-dvs;
87 s5m8767,pmic-buck4-uses-gpio-dvs;
88
89 s5m8767,pmic-buck-default-dvs-idx = <0>;
90
91 s5m8767,pmic-buck-dvs-gpios = <&gpx0 0 0>, /* DVS1 */
92 <&gpx0 1 0>, /* DVS2 */
93 <&gpx0 2 0>; /* DVS3 */
94
95 s5m8767,pmic-buck-ds-gpios = <&gpx2 3 0>, /* SET1 */
96 <&gpx2 4 0>, /* SET2 */
97 <&gpx2 5 0>; /* SET3 */
98
99 s5m8767,pmic-buck2-dvs-voltage = <1350000>, <1300000>,
100 <1250000>, <1200000>,
101 <1150000>, <1100000>,
102 <1000000>, <950000>;
103
104 s5m8767,pmic-buck3-dvs-voltage = <1100000>, <1100000>,
105 <1100000>, <1100000>,
106 <1000000>, <1000000>,
107 <1000000>, <1000000>;
108
109 s5m8767,pmic-buck4-dvs-voltage = <1200000>, <1200000>,
110 <1200000>, <1200000>,
111 <1200000>, <1200000>,
112 <1200000>, <1200000>;
113
114 regulators {
115 ldo1_reg: LDO1 {
116 regulator-name = "VDD_ABB_3.3V";
117 regulator-min-microvolt = <3300000>;
118 regulator-max-microvolt = <3300000>;
119 op_mode = <1>; /* Normal Mode */
120 };
121
122 ldo2_reg: LDO2 {
123 regulator-name = "VDD_ALIVE_1.1V";
124 regulator-min-microvolt = <1100000>;
125 regulator-max-microvolt = <1100000>;
126 regulator-always-on;
127 };
128
129 buck1_reg: BUCK1 {
130 regulator-name = "VDD_MIF_1.2V";
131 regulator-min-microvolt = <950000>;
132 regulator-max-microvolt = <1350000>;
133 regulator-always-on;
134 regulator-boot-on;
135 };
136
137 vemmc_reg: BUCK9 {
138 regulator-name = "VMEM_VDD_2.8V";
139 regulator-min-microvolt = <2800000>;
140 regulator-max-microvolt = <2800000>;
141 op_mode = <3>; /* Standby Mode */
142 s5m8767,pmic-ext-control-gpios = <&gpk0 2 0>;
143 };
144 };
145 };
diff --git a/Documentation/devicetree/bindings/regulator/tps65217.txt b/Documentation/devicetree/bindings/regulator/tps65217.txt
index 4f05d208c95c..d18109657da6 100644
--- a/Documentation/devicetree/bindings/regulator/tps65217.txt
+++ b/Documentation/devicetree/bindings/regulator/tps65217.txt
@@ -26,7 +26,11 @@ Example:
26 ti,pmic-shutdown-controller; 26 ti,pmic-shutdown-controller;
27 27
28 regulators { 28 regulators {
29 #address-cells = <1>;
30 #size-cells = <0>;
31
29 dcdc1_reg: dcdc1 { 32 dcdc1_reg: dcdc1 {
33 reg = <0>;
30 regulator-min-microvolt = <900000>; 34 regulator-min-microvolt = <900000>;
31 regulator-max-microvolt = <1800000>; 35 regulator-max-microvolt = <1800000>;
32 regulator-boot-on; 36 regulator-boot-on;
@@ -34,6 +38,7 @@ Example:
34 }; 38 };
35 39
36 dcdc2_reg: dcdc2 { 40 dcdc2_reg: dcdc2 {
41 reg = <1>;
37 regulator-min-microvolt = <900000>; 42 regulator-min-microvolt = <900000>;
38 regulator-max-microvolt = <3300000>; 43 regulator-max-microvolt = <3300000>;
39 regulator-boot-on; 44 regulator-boot-on;
@@ -41,6 +46,7 @@ Example:
41 }; 46 };
42 47
43 dcdc3_reg: dcc3 { 48 dcdc3_reg: dcc3 {
49 reg = <2>;
44 regulator-min-microvolt = <900000>; 50 regulator-min-microvolt = <900000>;
45 regulator-max-microvolt = <1500000>; 51 regulator-max-microvolt = <1500000>;
46 regulator-boot-on; 52 regulator-boot-on;
@@ -48,6 +54,7 @@ Example:
48 }; 54 };
49 55
50 ldo1_reg: ldo1 { 56 ldo1_reg: ldo1 {
57 reg = <3>;
51 regulator-min-microvolt = <1000000>; 58 regulator-min-microvolt = <1000000>;
52 regulator-max-microvolt = <3300000>; 59 regulator-max-microvolt = <3300000>;
53 regulator-boot-on; 60 regulator-boot-on;
@@ -55,6 +62,7 @@ Example:
55 }; 62 };
56 63
57 ldo2_reg: ldo2 { 64 ldo2_reg: ldo2 {
65 reg = <4>;
58 regulator-min-microvolt = <900000>; 66 regulator-min-microvolt = <900000>;
59 regulator-max-microvolt = <3300000>; 67 regulator-max-microvolt = <3300000>;
60 regulator-boot-on; 68 regulator-boot-on;
@@ -62,6 +70,7 @@ Example:
62 }; 70 };
63 71
64 ldo3_reg: ldo3 { 72 ldo3_reg: ldo3 {
73 reg = <5>;
65 regulator-min-microvolt = <1800000>; 74 regulator-min-microvolt = <1800000>;
66 regulator-max-microvolt = <3300000>; 75 regulator-max-microvolt = <3300000>;
67 regulator-boot-on; 76 regulator-boot-on;
@@ -69,6 +78,7 @@ Example:
69 }; 78 };
70 79
71 ldo4_reg: ldo4 { 80 ldo4_reg: ldo4 {
81 reg = <6>;
72 regulator-min-microvolt = <1800000>; 82 regulator-min-microvolt = <1800000>;
73 regulator-max-microvolt = <3300000>; 83 regulator-max-microvolt = <3300000>;
74 regulator-boot-on; 84 regulator-boot-on;
diff --git a/Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt b/Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt
new file mode 100644
index 000000000000..e0b185a944ba
--- /dev/null
+++ b/Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt
@@ -0,0 +1,34 @@
1Hisilicon System Reset Controller
2======================================
3
4Please also refer to reset.txt in this directory for common reset
5controller binding usage.
6
7The reset controller registers are part of the system-ctl block on
8hi6220 SoC.
9
10Required properties:
11- compatible: may be "hisilicon,hi6220-sysctrl"
12- reg: should be register base and length as documented in the
13 datasheet
14- #reset-cells: 1, see below
15
16Example:
17sys_ctrl: sys_ctrl@f7030000 {
18 compatible = "hisilicon,hi6220-sysctrl", "syscon";
19 reg = <0x0 0xf7030000 0x0 0x2000>;
20 #clock-cells = <1>;
21 #reset-cells = <1>;
22};
23
24Specifying reset lines connected to IP modules
25==============================================
26example:
27
28 uart1: serial@..... {
29 ...
30 resets = <&sys_ctrl PERIPH_RSTEN3_UART1>;
31 ...
32 };
33
34The index could be found in <dt-bindings/reset/hisi,hi6220-resets.h>.
diff --git a/Documentation/devicetree/bindings/scsi/hisilicon-sas.txt b/Documentation/devicetree/bindings/scsi/hisilicon-sas.txt
new file mode 100644
index 000000000000..f67e761bcc18
--- /dev/null
+++ b/Documentation/devicetree/bindings/scsi/hisilicon-sas.txt
@@ -0,0 +1,69 @@
1* HiSilicon SAS controller
2
3The HiSilicon SAS controller supports SAS/SATA.
4
5Main node required properties:
6 - compatible : value should be as follows:
7 (a) "hisilicon,hip05-sas-v1" for v1 hw in hip05 chipset
8 - sas-addr : array of 8 bytes for host SAS address
9 - reg : Address and length of the SAS register
10 - hisilicon,sas-syscon: phandle of syscon used for sas control
11 - ctrl-reset-reg : offset to controller reset register in ctrl reg
12 - ctrl-reset-sts-reg : offset to controller reset status register in ctrl reg
13 - ctrl-clock-ena-reg : offset to controller clock enable register in ctrl reg
14 - queue-count : number of delivery and completion queues in the controller
15 - phy-count : number of phys accessible by the controller
16 - interrupts : Interrupts for phys, completion queues, and fatal
17 sources; the interrupts are ordered in 3 groups, as follows:
18 - Phy interrupts
19 - Completion queue interrupts
20 - Fatal interrupts
21 Phy interrupts : Each phy has 3 interrupt sources:
22 - broadcast
23 - phyup
24 - abnormal
25 The phy interrupts are ordered into groups of 3 per phy
26 (broadcast, phyup, and abnormal) in increasing order.
27 Completion queue interrupts : each completion queue has 1
28 interrupt source.
29 The interrupts are ordered in increasing order.
30 Fatal interrupts : the fatal interrupts are ordered as follows:
31 - ECC
32 - AXI bus
33
34Example:
35 sas0: sas@c1000000 {
36 compatible = "hisilicon,hip05-sas-v1";
37 sas-addr = [50 01 88 20 16 00 00 0a];
38 reg = <0x0 0xc1000000 0x0 0x10000>;
39 hisilicon,sas-syscon = <&pcie_sas>;
40 ctrl-reset-reg = <0xa60>;
41 ctrl-reset-sts-reg = <0x5a30>;
42 ctrl-clock-ena-reg = <0x338>;
43 queue-count = <32>;
44 phy-count = <8>;
45 dma-coherent;
46 interrupt-parent = <&mbigen_dsa>;
47 interrupts = <259 4>,<263 4>,<264 4>,/* phy0 */
48 <269 4>,<273 4>,<274 4>,/* phy1 */
49 <279 4>,<283 4>,<284 4>,/* phy2 */
50 <289 4>,<293 4>,<294 4>,/* phy3 */
51 <299 4>,<303 4>,<304 4>,/* phy4 */
52 <309 4>,<313 4>,<314 4>,/* phy5 */
53 <319 4>,<323 4>,<324 4>,/* phy6 */
54 <329 4>,<333 4>,<334 4>,/* phy7 */
55 <336 1>,<337 1>,<338 1>,/* cq0-2 */
56 <339 1>,<340 1>,<341 1>,/* cq3-5 */
57 <342 1>,<343 1>,<344 1>,/* cq6-8 */
58 <345 1>,<346 1>,<347 1>,/* cq9-11 */
59 <348 1>,<349 1>,<350 1>,/* cq12-14 */
60 <351 1>,<352 1>,<353 1>,/* cq15-17 */
61 <354 1>,<355 1>,<356 1>,/* cq18-20 */
62 <357 1>,<358 1>,<359 1>,/* cq21-23 */
63 <360 1>,<361 1>,<362 1>,/* cq24-26 */
64 <363 1>,<364 1>,<365 1>,/* cq27-29 */
65 <366 1>,<367 1>/* cq30-31 */
66 <376 4>,/* fatal ecc */
67 <381 4>;/* fatal axi */
68 status = "disabled";
69 };
diff --git a/Documentation/devicetree/bindings/serial/8250.txt b/Documentation/devicetree/bindings/serial/8250.txt
index 91d5ab0e60fc..936ab5b87324 100644
--- a/Documentation/devicetree/bindings/serial/8250.txt
+++ b/Documentation/devicetree/bindings/serial/8250.txt
@@ -14,7 +14,6 @@ Required properties:
14 tegra132, or tegra210. 14 tegra132, or tegra210.
15 - "nxp,lpc3220-uart" 15 - "nxp,lpc3220-uart"
16 - "ralink,rt2880-uart" 16 - "ralink,rt2880-uart"
17 - "ibm,qpace-nwp-serial"
18 - "altr,16550-FIFO32" 17 - "altr,16550-FIFO32"
19 - "altr,16550-FIFO64" 18 - "altr,16550-FIFO64"
20 - "altr,16550-FIFO128" 19 - "altr,16550-FIFO128"
diff --git a/Documentation/devicetree/bindings/serial/mtk-uart.txt b/Documentation/devicetree/bindings/serial/mtk-uart.txt
index 2d47add34765..a833a016f656 100644
--- a/Documentation/devicetree/bindings/serial/mtk-uart.txt
+++ b/Documentation/devicetree/bindings/serial/mtk-uart.txt
@@ -2,15 +2,15 @@
2 2
3Required properties: 3Required properties:
4- compatible should contain: 4- compatible should contain:
5 * "mediatek,mt8135-uart" for MT8135 compatible UARTS 5 * "mediatek,mt2701-uart" for MT2701 compatible UARTS
6 * "mediatek,mt6580-uart" for MT6580 compatible UARTS
7 * "mediatek,mt6582-uart" for MT6582 compatible UARTS
8 * "mediatek,mt6589-uart" for MT6589 compatible UARTS
9 * "mediatek,mt6795-uart" for MT6795 compatible UARTS
6 * "mediatek,mt8127-uart" for MT8127 compatible UARTS 10 * "mediatek,mt8127-uart" for MT8127 compatible UARTS
11 * "mediatek,mt8135-uart" for MT8135 compatible UARTS
7 * "mediatek,mt8173-uart" for MT8173 compatible UARTS 12 * "mediatek,mt8173-uart" for MT8173 compatible UARTS
8 * "mediatek,mt6795-uart" for MT6795 compatible UARTS 13 * "mediatek,mt6577-uart" for MT6577 and all of the above
9 * "mediatek,mt6589-uart" for MT6589 compatible UARTS
10 * "mediatek,mt6582-uart" for MT6582 compatible UARTS
11 * "mediatek,mt6580-uart" for MT6580 compatible UARTS
12 * "mediatek,mt6577-uart" for all compatible UARTS (MT8173, MT6795,
13 MT6589, MT6582, MT6580, MT6577)
14 14
15- reg: The base address of the UART register bank. 15- reg: The base address of the UART register bank.
16 16
diff --git a/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt b/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
index 73f825e5e644..401b1b33c2c4 100644
--- a/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
+++ b/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
@@ -2,7 +2,7 @@
2 2
3Required properties: 3Required properties:
4 4
5 - compatible: Must contain one of the following: 5 - compatible: Must contain one or more of the following:
6 6
7 - "renesas,scif-r7s72100" for R7S72100 (RZ/A1H) SCIF compatible UART. 7 - "renesas,scif-r7s72100" for R7S72100 (RZ/A1H) SCIF compatible UART.
8 - "renesas,scifa-r8a73a4" for R8A73A4 (R-Mobile APE6) SCIFA compatible UART. 8 - "renesas,scifa-r8a73a4" for R8A73A4 (R-Mobile APE6) SCIFA compatible UART.
@@ -15,10 +15,14 @@ Required properties:
15 - "renesas,scifa-r8a7790" for R8A7790 (R-Car H2) SCIFA compatible UART. 15 - "renesas,scifa-r8a7790" for R8A7790 (R-Car H2) SCIFA compatible UART.
16 - "renesas,scifb-r8a7790" for R8A7790 (R-Car H2) SCIFB compatible UART. 16 - "renesas,scifb-r8a7790" for R8A7790 (R-Car H2) SCIFB compatible UART.
17 - "renesas,hscif-r8a7790" for R8A7790 (R-Car H2) HSCIF compatible UART. 17 - "renesas,hscif-r8a7790" for R8A7790 (R-Car H2) HSCIF compatible UART.
18 - "renesas,scif-r8a7791" for R8A7791 (R-Car M2) SCIF compatible UART. 18 - "renesas,scif-r8a7791" for R8A7791 (R-Car M2-W) SCIF compatible UART.
19 - "renesas,scifa-r8a7791" for R8A7791 (R-Car M2) SCIFA compatible UART. 19 - "renesas,scifa-r8a7791" for R8A7791 (R-Car M2-W) SCIFA compatible UART.
20 - "renesas,scifb-r8a7791" for R8A7791 (R-Car M2) SCIFB compatible UART. 20 - "renesas,scifb-r8a7791" for R8A7791 (R-Car M2-W) SCIFB compatible UART.
21 - "renesas,hscif-r8a7791" for R8A7791 (R-Car M2) HSCIF compatible UART. 21 - "renesas,hscif-r8a7791" for R8A7791 (R-Car M2-W) HSCIF compatible UART.
22 - "renesas,scif-r8a7793" for R8A7793 (R-Car M2-N) SCIF compatible UART.
23 - "renesas,scifa-r8a7793" for R8A7793 (R-Car M2-N) SCIFA compatible UART.
24 - "renesas,scifb-r8a7793" for R8A7793 (R-Car M2-N) SCIFB compatible UART.
25 - "renesas,hscif-r8a7793" for R8A7793 (R-Car M2-N) HSCIF compatible UART.
22 - "renesas,scif-r8a7794" for R8A7794 (R-Car E2) SCIF compatible UART. 26 - "renesas,scif-r8a7794" for R8A7794 (R-Car E2) SCIF compatible UART.
23 - "renesas,scifa-r8a7794" for R8A7794 (R-Car E2) SCIFA compatible UART. 27 - "renesas,scifa-r8a7794" for R8A7794 (R-Car E2) SCIFA compatible UART.
24 - "renesas,scifb-r8a7794" for R8A7794 (R-Car E2) SCIFB compatible UART. 28 - "renesas,scifb-r8a7794" for R8A7794 (R-Car E2) SCIFB compatible UART.
@@ -27,6 +31,14 @@ Required properties:
27 - "renesas,hscif-r8a7795" for R8A7795 (R-Car H3) HSCIF compatible UART. 31 - "renesas,hscif-r8a7795" for R8A7795 (R-Car H3) HSCIF compatible UART.
28 - "renesas,scifa-sh73a0" for SH73A0 (SH-Mobile AG5) SCIFA compatible UART. 32 - "renesas,scifa-sh73a0" for SH73A0 (SH-Mobile AG5) SCIFA compatible UART.
29 - "renesas,scifb-sh73a0" for SH73A0 (SH-Mobile AG5) SCIFB compatible UART. 33 - "renesas,scifb-sh73a0" for SH73A0 (SH-Mobile AG5) SCIFB compatible UART.
34 - "renesas,rcar-gen1-scif" for R-Car Gen1 SCIF compatible UART,
35 - "renesas,rcar-gen2-scif" for R-Car Gen2 SCIF compatible UART,
36 - "renesas,rcar-gen3-scif" for R-Car Gen3 SCIF compatible UART,
37 - "renesas,rcar-gen2-scifa" for R-Car Gen2 SCIFA compatible UART,
38 - "renesas,rcar-gen2-scifb" for R-Car Gen2 SCIFB compatible UART,
39 - "renesas,rcar-gen1-hscif" for R-Car Gen1 HSCIF compatible UART,
40 - "renesas,rcar-gen2-hscif" for R-Car Gen2 HSCIF compatible UART,
41 - "renesas,rcar-gen3-hscif" for R-Car Gen3 HSCIF compatible UART,
30 - "renesas,scif" for generic SCIF compatible UART. 42 - "renesas,scif" for generic SCIF compatible UART.
31 - "renesas,scifa" for generic SCIFA compatible UART. 43 - "renesas,scifa" for generic SCIFA compatible UART.
32 - "renesas,scifb" for generic SCIFB compatible UART. 44 - "renesas,scifb" for generic SCIFB compatible UART.
@@ -34,15 +46,26 @@ Required properties:
34 - "renesas,sci" for generic SCI compatible UART. 46 - "renesas,sci" for generic SCI compatible UART.
35 47
36 When compatible with the generic version, nodes must list the 48 When compatible with the generic version, nodes must list the
37 SoC-specific version corresponding to the platform first followed by the 49 SoC-specific version corresponding to the platform first, followed by the
38 generic version. 50 family-specific and/or generic versions.
39 51
40 - reg: Base address and length of the I/O registers used by the UART. 52 - reg: Base address and length of the I/O registers used by the UART.
41 - interrupts: Must contain an interrupt-specifier for the SCIx interrupt. 53 - interrupts: Must contain an interrupt-specifier for the SCIx interrupt.
42 54
43 - clocks: Must contain a phandle and clock-specifier pair for each entry 55 - clocks: Must contain a phandle and clock-specifier pair for each entry
44 in clock-names. 56 in clock-names.
45 - clock-names: Must contain "sci_ick" for the SCIx UART interface clock. 57 - clock-names: Must contain "fck" for the SCIx UART functional clock.
58 Apart from the divided functional clock, there may be other possible
59 sources for the sampling clock, depending on SCIx variant.
60 On (H)SCI(F) and some SCIFA, an additional clock may be specified:
61 - "hsck" for the optional external clock input (on HSCIF),
62 - "sck" for the optional external clock input (on other variants).
63 On UARTs equipped with a Baud Rate Generator for External Clock (BRG)
64 (some SCIF and HSCIF), additional clocks may be specified:
65 - "brg_int" for the optional internal clock source for the frequency
66 divider (typically the (AXI or SHwy) bus clock),
67 - "scif_clk" for the optional external clock source for the frequency
68 divider (SCIF_CLK).
46 69
47Note: Each enabled SCIx UART should have an alias correctly numbered in the 70Note: Each enabled SCIx UART should have an alias correctly numbered in the
48"aliases" node. 71"aliases" node.
@@ -58,12 +81,13 @@ Example:
58 }; 81 };
59 82
60 scifa0: serial@e6c40000 { 83 scifa0: serial@e6c40000 {
61 compatible = "renesas,scifa-r8a7790", "renesas,scifa"; 84 compatible = "renesas,scifa-r8a7790",
85 "renesas,rcar-gen2-scifa", "renesas,scifa";
62 reg = <0 0xe6c40000 0 64>; 86 reg = <0 0xe6c40000 0 64>;
63 interrupt-parent = <&gic>; 87 interrupt-parent = <&gic>;
64 interrupts = <0 144 IRQ_TYPE_LEVEL_HIGH>; 88 interrupts = <0 144 IRQ_TYPE_LEVEL_HIGH>;
65 clocks = <&mstp2_clks R8A7790_CLK_SCIFA0>; 89 clocks = <&mstp2_clks R8A7790_CLK_SCIFA0>;
66 clock-names = "sci_ick"; 90 clock-names = "fck";
67 dmas = <&dmac0 0x21>, <&dmac0 0x22>; 91 dmas = <&dmac0 0x21>, <&dmac0 0x22>;
68 dma-names = "tx", "rx"; 92 dma-names = "tx", "rx";
69 }; 93 };
diff --git a/Documentation/devicetree/bindings/soc/bcm/raspberrypi,bcm2835-power.txt b/Documentation/devicetree/bindings/soc/bcm/raspberrypi,bcm2835-power.txt
new file mode 100644
index 000000000000..30942cf7992b
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/bcm/raspberrypi,bcm2835-power.txt
@@ -0,0 +1,47 @@
1Raspberry Pi power domain driver
2
3Required properties:
4
5- compatible: Should be "raspberrypi,bcm2835-power".
6- firmware: Reference to the RPi firmware device node.
7- #power-domain-cells: Should be <1>, we providing multiple power domains.
8
9The valid defines for power domain are:
10
11 RPI_POWER_DOMAIN_I2C0
12 RPI_POWER_DOMAIN_I2C1
13 RPI_POWER_DOMAIN_I2C2
14 RPI_POWER_DOMAIN_VIDEO_SCALER
15 RPI_POWER_DOMAIN_VPU1
16 RPI_POWER_DOMAIN_HDMI
17 RPI_POWER_DOMAIN_USB
18 RPI_POWER_DOMAIN_VEC
19 RPI_POWER_DOMAIN_JPEG
20 RPI_POWER_DOMAIN_H264
21 RPI_POWER_DOMAIN_V3D
22 RPI_POWER_DOMAIN_ISP
23 RPI_POWER_DOMAIN_UNICAM0
24 RPI_POWER_DOMAIN_UNICAM1
25 RPI_POWER_DOMAIN_CCP2RX
26 RPI_POWER_DOMAIN_CSI2
27 RPI_POWER_DOMAIN_CPI
28 RPI_POWER_DOMAIN_DSI0
29 RPI_POWER_DOMAIN_DSI1
30 RPI_POWER_DOMAIN_TRANSPOSER
31 RPI_POWER_DOMAIN_CCP2TX
32 RPI_POWER_DOMAIN_CDP
33 RPI_POWER_DOMAIN_ARM
34
35Example:
36
37power: power {
38 compatible = "raspberrypi,bcm2835-power";
39 firmware = <&firmware>;
40 #power-domain-cells = <1>;
41};
42
43Example for using power domain:
44
45&usb {
46 power-domains = <&power RPI_POWER_DOMAIN_USB>;
47};
diff --git a/Documentation/devicetree/bindings/soc/dove/pmu.txt b/Documentation/devicetree/bindings/soc/dove/pmu.txt
new file mode 100644
index 000000000000..edd40b796b74
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/dove/pmu.txt
@@ -0,0 +1,56 @@
1Device Tree bindings for Marvell PMU
2
3Required properties:
4 - compatible: value should be "marvell,dove-pmu".
5 May also include "simple-bus" if there are child devices, in which
6 case the ranges node is required.
7 - reg: two base addresses and sizes of the PM controller and PMU.
8 - interrupts: single interrupt number for the PMU interrupt
9 - interrupt-controller: must be specified as the PMU itself is an
10 interrupt controller.
11 - #interrupt-cells: must be 1.
12 - #reset-cells: must be 1.
13 - domains: sub-node containing domain descriptions
14
15Optional properties:
16 - ranges: defines the address mapping for child devices, as per the
17 standard property of this name. Required when compatible includes
18 "simple-bus".
19
20Power domain descriptions are listed as child nodes of the "domains"
21sub-node. Each domain has the following properties:
22
23Required properties:
24 - #power-domain-cells: must be 0.
25
26Optional properties:
27 - marvell,pmu_pwr_mask: specifies the mask value for PMU power register
28 - marvell,pmu_iso_mask: specifies the mask value for PMU isolation register
29 - resets: points to the reset manager (PMU node) and reset index.
30
31Example:
32
33 pmu: power-management@d0000 {
34 compatible = "marvell,dove-pmu";
35 reg = <0xd0000 0x8000>, <0xd8000 0x8000>;
36 interrupts = <33>;
37 interrupt-controller;
38 #interrupt-cells = <1>;
39 #reset-cells = <1>;
40
41 domains {
42 vpu_domain: vpu-domain {
43 #power-domain-cells = <0>;
44 marvell,pmu_pwr_mask = <0x00000008>;
45 marvell,pmu_iso_mask = <0x00000001>;
46 resets = <&pmu 16>;
47 };
48
49 gpu_domain: gpu-domain {
50 #power-domain-cells = <0>;
51 marvell,pmu_pwr_mask = <0x00000004>;
52 marvell,pmu_iso_mask = <0x00000002>;
53 resets = <&pmu 18>;
54 };
55 };
56 };
diff --git a/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt b/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
index a6c8afc8385a..e8f15e34027f 100644
--- a/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
+++ b/Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
@@ -21,6 +21,18 @@ Required properties:
21 These are the clocks which hardware needs to be enabled 21 These are the clocks which hardware needs to be enabled
22 before enabling certain power domains. 22 before enabling certain power domains.
23 23
24Optional properties:
25- vdec-supply: Power supply for the vdec power domain
26- venc-supply: Power supply for the venc power domain
27- isp-supply: Power supply for the isp power domain
28- mm-supply: Power supply for the mm power domain
29- venc_lt-supply: Power supply for the venc_lt power domain
30- audio-supply: Power supply for the audio power domain
31- usb-supply: Power supply for the usb power domain
32- mfg_async-supply: Power supply for the mfg_async power domain
33- mfg_2d-supply: Power supply for the mfg_2d power domain
34- mfg-supply: Power supply for the mfg power domain
35
24Example: 36Example:
25 37
26 scpsys: scpsys@10006000 { 38 scpsys: scpsys@10006000 {
diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt
new file mode 100644
index 000000000000..a48049ccf6d0
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt
@@ -0,0 +1,58 @@
1Qualcomm Resource Power Manager (RPM) over SMD
2
3This driver is used to interface with the Resource Power Manager (RPM) found in
4various Qualcomm platforms. The RPM allows each component in the system to vote
5for state of the system resources, such as clocks, regulators and bus
6frequencies.
7
8The SMD information for the RPM edge should be filled out. See qcom,smd.txt for
9the required edge properties. All SMD related properties will reside within the
10RPM node itself.
11
12= SUBDEVICES
13
14The RPM exposes resources to its subnodes. The rpm_requests node must be
15present and this subnode may contain children that designate regulator
16resources.
17
18- compatible:
19 Usage: required
20 Value type: <string>
21 Definition: must be one of:
22 "qcom,rpm-apq8084"
23 "qcom,rpm-msm8916"
24 "qcom,rpm-msm8974"
25
26- qcom,smd-channels:
27 Usage: required
28 Value type: <string>
29 Definition: must be "rpm_requests"
30
31Refer to Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
32for information on the regulator subnodes that can exist under the rpm_requests.
33
34Example:
35
36 soc {
37 apcs: syscon@f9011000 {
38 compatible = "syscon";
39 reg = <0xf9011000 0x1000>;
40 };
41 };
42
43 smd {
44 compatible = "qcom,smd";
45
46 rpm {
47 interrupts = <0 168 1>;
48 qcom,ipc = <&apcs 8 0>;
49 qcom,smd-edge = <15>;
50
51 rpm_requests {
52 compatible = "qcom,rpm-msm8974";
53 qcom,smd-channels = "rpm_requests";
54
55 ...
56 };
57 };
58 };
diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smp2p.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,smp2p.txt
new file mode 100644
index 000000000000..5cc82b8353d8
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smp2p.txt
@@ -0,0 +1,104 @@
1Qualcomm Shared Memory Point 2 Point binding
2
3The Shared Memory Point to Point (SMP2P) protocol facilitates communication of
4a single 32-bit value between two processors. Each value has a single writer
5(the local side) and a single reader (the remote side). Values are uniquely
6identified in the system by the directed edge (local processor ID to remote
7processor ID) and a string identifier.
8
9- compatible:
10 Usage: required
11 Value type: <string>
12 Definition: must be one of:
13 "qcom,smp2p"
14
15- interrupts:
16 Usage: required
17 Value type: <prop-encoded-array>
18 Definition: one entry specifying the smp2p notification interrupt
19
20- qcom,ipc:
21 Usage: required
22 Value type: <prop-encoded-array>
23 Definition: three entries specifying the outgoing ipc bit used for
24 signaling the remote end of the smp2p edge:
25 - phandle to a syscon node representing the apcs registers
26 - u32 representing offset to the register within the syscon
27 - u32 representing the ipc bit within the register
28
29- qcom,smem:
30 Usage: required
31 Value type: <u32 array>
32 Definition: two identifiers of the inbound and outbound smem items used
33 for this edge
34
35- qcom,local-pid:
36 Usage: required
37 Value type: <u32>
38 Definition: specifies the identfier of the local endpoint of this edge
39
40- qcom,remote-pid:
41 Usage: required
42 Value type: <u32>
43 Definition: specifies the identfier of the remote endpoint of this edge
44
45= SUBNODES
46Each SMP2P pair contain a set of inbound and outbound entries, these are
47described in subnodes of the smp2p device node. The node names are not
48important.
49
50- qcom,entry-name:
51 Usage: required
52 Value type: <string>
53 Definition: specifies the name of this entry, for inbound entries this
54 will be used to match against the remotely allocated entry
55 and for outbound entries this name is used for allocating
56 entries
57
58- interrupt-controller:
59 Usage: required for incoming entries
60 Value type: <empty>
61 Definition: marks the entry as inbound; the node should be specified
62 as a two cell interrupt-controller as defined in
63 "../interrupt-controller/interrupts.txt"
64 If not specified this node will denote the outgoing entry
65
66- #interrupt-cells:
67 Usage: required for incoming entries
68 Value type: <u32>
69 Definition: must be 2 - denoting the bit in the entry and IRQ flags
70
71- #qcom,state-cells:
72 Usage: required for outgoing entries
73 Value type: <u32>
74 Definition: must be 1 - denoting the bit in the entry
75
76= EXAMPLE
77The following example shows the SMP2P setup with the wireless processor,
78defined from the 8974 apps processor's point-of-view. It encompasses one
79inbound and one outbound entry:
80
81wcnss-smp2p {
82 compatible = "qcom,smp2p";
83 qcom,smem = <431>, <451>;
84
85 interrupts = <0 143 1>;
86
87 qcom,ipc = <&apcs 8 18>;
88
89 qcom,local-pid = <0>;
90 qcom,remote-pid = <4>;
91
92 wcnss_smp2p_out: master-kernel {
93 qcom,entry-name = "master-kernel";
94
95 #qcom,state-cells = <1>;
96 };
97
98 wcnss_smp2p_in: slave-kernel {
99 qcom,entry-name = "slave-kernel";
100
101 interrupt-controller;
102 #interrupt-cells = <2>;
103 };
104};
diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smsm.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,smsm.txt
new file mode 100644
index 000000000000..a6634c70850d
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smsm.txt
@@ -0,0 +1,104 @@
1Qualcomm Shared Memory State Machine
2
3The Shared Memory State Machine facilitates broadcasting of single bit state
4information between the processors in a Qualcomm SoC. Each processor is
5assigned 32 bits of state that can be modified. A processor can through a
6matrix of bitmaps signal subscription of notifications upon changes to a
7certain bit owned by a certain remote processor.
8
9- compatible:
10 Usage: required
11 Value type: <string>
12 Definition: must be one of:
13 "qcom,smsm"
14
15- qcom,ipc-N:
16 Usage: required
17 Value type: <prop-encoded-array>
18 Definition: three entries specifying the outgoing ipc bit used for
19 signaling the N:th remote processor
20 - phandle to a syscon node representing the apcs registers
21 - u32 representing offset to the register within the syscon
22 - u32 representing the ipc bit within the register
23
24- qcom,local-host:
25 Usage: optional
26 Value type: <u32>
27 Definition: identifier of the local processor in the list of hosts, or
28 in other words specifier of the column in the subscription
29 matrix representing the local processor
30 defaults to host 0
31
32- #address-cells:
33 Usage: required
34 Value type: <u32>
35 Definition: must be 1
36
37- #size-cells:
38 Usage: required
39 Value type: <u32>
40 Definition: must be 0
41
42= SUBNODES
43Each processor's state bits are described by a subnode of the smsm device node.
44Nodes can either be flagged as an interrupt-controller to denote a remote
45processor's state bits or the local processors bits. The node names are not
46important.
47
48- reg:
49 Usage: required
50 Value type: <u32>
51 Definition: specifies the offset, in words, of the first bit for this
52 entry
53
54- #qcom,state-cells:
55 Usage: required for local entry
56 Value type: <u32>
57 Definition: must be 1 - denotes bit number
58
59- interrupt-controller:
60 Usage: required for remote entries
61 Value type: <empty>
62 Definition: marks the entry as a interrupt-controller and the state bits
63 to belong to a remote processor
64
65- #interrupt-cells:
66 Usage: required for remote entries
67 Value type: <u32>
68 Definition: must be 2 - denotes bit number and IRQ flags
69
70- interrupts:
71 Usage: required for remote entries
72 Value type: <prop-encoded-array>
73 Definition: one entry specifying remote IRQ used by the remote processor
74 to signal changes of its state bits
75
76
77= EXAMPLE
78The following example shows the SMEM setup for controlling properties of the
79wireless processor, defined from the 8974 apps processor's point-of-view. It
80encompasses one outbound entry and the outgoing interrupt for the wireless
81processor.
82
83smsm {
84 compatible = "qcom,smsm";
85
86 #address-cells = <1>;
87 #size-cells = <0>;
88
89 qcom,ipc-3 = <&apcs 8 19>;
90
91 apps_smsm: apps@0 {
92 reg = <0>;
93
94 #qcom,state-cells = <1>;
95 };
96
97 wcnss_smsm: wcnss@7 {
98 reg = <7>;
99 interrupts = <0 144 1>;
100
101 interrupt-controller;
102 #interrupt-cells = <2>;
103 };
104};
diff --git a/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt b/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt
new file mode 100644
index 000000000000..401550487ed6
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/ti/wkup_m3_ipc.txt
@@ -0,0 +1,57 @@
1Wakeup M3 IPC Driver
2=====================
3
4The TI AM33xx and AM43xx family of devices use a small Cortex M3 co-processor
5(commonly referred to as Wakeup M3 or CM3) to help with various low power tasks
6that cannot be controlled from the MPU, like suspend/resume and certain deep
7C-states for CPU Idle. Once the wkup_m3_ipc driver uses the wkup_m3_rproc driver
8to boot the wkup_m3, it handles communication with the CM3 using IPC registers
9present in the SoC's control module and a mailbox. The wkup_m3_ipc exposes an
10API to allow the SoC PM code to execute specific PM tasks.
11
12Wkup M3 Device Node:
13====================
14A wkup_m3_ipc device node is used to represent the IPC registers within an
15SoC.
16
17Required properties:
18--------------------
19- compatible: Should be,
20 "ti,am3352-wkup-m3-ipc" for AM33xx SoCs
21 "ti,am4372-wkup-m3-ipc" for AM43xx SoCs
22- reg: Contains the IPC register address space to communicate
23 with the Wakeup M3 processor
24- interrupts: Contains the interrupt information for the wkup_m3
25 interrupt that signals the MPU.
26- ti,rproc: phandle to the wkup_m3 rproc node so the IPC driver
27 can boot it.
28- mboxes: phandles used by IPC framework to get correct mbox
29 channel for communication. Must point to appropriate
30 mbox_wkupm3 child node.
31
32Example:
33--------
34/* AM33xx */
35 l4_wkup: l4_wkup@44c00000 {
36 ...
37
38 scm: scm@210000 {
39 compatible = "ti,am3-scm", "simple-bus";
40 reg = <0x210000 0x2000>;
41 #address-cells = <1>;
42 #size-cells = <1>;
43 ranges = <0 0x210000 0x2000>;
44
45 ...
46
47 wkup_m3_ipc: wkup_m3_ipc@1324 {
48 compatible = "ti,am3352-wkup-m3-ipc";
49 reg = <0x1324 0x24>;
50 interrupts = <78>;
51 ti,rproc = <&wkup_m3>;
52 mboxes = <&mailbox &mbox_wkupm3>;
53 };
54
55 ...
56 };
57 };
diff --git a/Documentation/devicetree/bindings/sound/ak4613.txt b/Documentation/devicetree/bindings/sound/ak4613.txt
index 15a919522b42..1783f9ef0930 100644
--- a/Documentation/devicetree/bindings/sound/ak4613.txt
+++ b/Documentation/devicetree/bindings/sound/ak4613.txt
@@ -7,6 +7,16 @@ Required properties:
7- compatible : "asahi-kasei,ak4613" 7- compatible : "asahi-kasei,ak4613"
8- reg : The chip select number on the I2C bus 8- reg : The chip select number on the I2C bus
9 9
10Optional properties:
11- asahi-kasei,in1-single-end : Boolean. Indicate input / output pins are single-ended.
12- asahi-kasei,in2-single-end rather than differential.
13- asahi-kasei,out1-single-end
14- asahi-kasei,out2-single-end
15- asahi-kasei,out3-single-end
16- asahi-kasei,out4-single-end
17- asahi-kasei,out5-single-end
18- asahi-kasei,out6-single-end
19
10Example: 20Example:
11 21
12&i2c { 22&i2c {
diff --git a/Documentation/devicetree/bindings/sound/atmel-classd.txt b/Documentation/devicetree/bindings/sound/atmel-classd.txt
index 0018451c4351..549e701cb7a1 100644
--- a/Documentation/devicetree/bindings/sound/atmel-classd.txt
+++ b/Documentation/devicetree/bindings/sound/atmel-classd.txt
@@ -16,6 +16,10 @@ Required properties:
16 Required elements: "pclk", "gclk" and "aclk". 16 Required elements: "pclk", "gclk" and "aclk".
17- clocks 17- clocks
18 Please refer to clock-bindings.txt. 18 Please refer to clock-bindings.txt.
19- assigned-clocks
20 Should be <&classd_gclk>.
21- assigned-clock-parents
22 Should be <&audio_pll_pmc>.
19 23
20Optional properties: 24Optional properties:
21- pinctrl-names, pinctrl-0 25- pinctrl-names, pinctrl-0
@@ -43,6 +47,8 @@ classd: classd@fc048000 {
43 dma-names = "tx"; 47 dma-names = "tx";
44 clocks = <&classd_clk>, <&classd_gclk>, <&audio_pll_pmc>; 48 clocks = <&classd_clk>, <&classd_gclk>, <&audio_pll_pmc>;
45 clock-names = "pclk", "gclk", "aclk"; 49 clock-names = "pclk", "gclk", "aclk";
50 assigned-clocks = <&classd_gclk>;
51 assigned-clock-parents = <&audio_pll_pmc>;
46 52
47 pinctrl-names = "default"; 53 pinctrl-names = "default";
48 pinctrl-0 = <&pinctrl_classd_default>; 54 pinctrl-0 = <&pinctrl_classd_default>;
diff --git a/Documentation/devicetree/bindings/sound/atmel-pdmic.txt b/Documentation/devicetree/bindings/sound/atmel-pdmic.txt
new file mode 100644
index 000000000000..e0875f17c229
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/atmel-pdmic.txt
@@ -0,0 +1,55 @@
1* Atmel PDMIC driver under ALSA SoC architecture
2
3Required properties:
4- compatible
5 Should be "atmel,sama5d2-pdmic".
6- reg
7 Should contain PDMIC registers location and length.
8- interrupts
9 Should contain the IRQ line for the PDMIC.
10- dmas
11 One DMA specifiers as described in atmel-dma.txt and dma.txt files.
12- dma-names
13 Must be "rx".
14- clock-names
15 Required elements:
16 - "pclk" peripheral clock
17 - "gclk" generated clock
18- clocks
19 Must contain an entry for each required entry in clock-names.
20 Please refer to clock-bindings.txt.
21- atmel,mic-min-freq
22 The minimal frequency that the micphone supports.
23- atmel,mic-max-freq
24 The maximal frequency that the micphone supports.
25
26Optional properties:
27- pinctrl-names, pinctrl-0
28 Please refer to pinctrl-bindings.txt.
29- atmel,model
30 The user-visible name of this sound card.
31 The default value is "PDMIC".
32- atmel,mic-offset
33 The offset that should be added.
34 The range is from -32768 to 32767.
35 The default value is 0.
36
37Example:
38 pdmic@f8018000 {
39 compatible = "atmel,sama5d2-pdmic";
40 reg = <0xf8018000 0x124>;
41 interrupts = <48 IRQ_TYPE_LEVEL_HIGH 7>;
42 dmas = <&dma0
43 (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1)
44 | AT91_XDMAC_DT_PERID(50))>;
45 dma-names = "rx";
46 clocks = <&pdmic_clk>, <&pdmic_gclk>;
47 clock-names = "pclk", "gclk";
48
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_pdmic_default>;
51 atmel,model = "PDMIC @ sama5d2_xplained";
52 atmel,mic-min-freq = <1000000>;
53 atmel,mic-max-freq = <3246000>;
54 atmel,mic-offset = <0x0>;
55 };
diff --git a/Documentation/devicetree/bindings/sound/da7218.txt b/Documentation/devicetree/bindings/sound/da7218.txt
new file mode 100644
index 000000000000..5ca5a709b6aa
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/da7218.txt
@@ -0,0 +1,104 @@
1Dialog Semiconductor DA7218 Audio Codec bindings
2
3DA7218 is an audio codec with HP detect feature.
4
5======
6
7Required properties:
8- compatible : Should be "dlg,da7217" or "dlg,da7218"
9- reg: Specifies the I2C slave address
10
11- VDD-supply: VDD power supply for the device
12- VDDMIC-supply: VDDMIC power supply for the device
13- VDDIO-supply: VDDIO power supply for the device
14 (See Documentation/devicetree/bindings/regulator/regulator.txt for further
15 information relating to regulators)
16
17Optional properties:
18- interrupt-parent: Specifies the phandle of the interrupt controller to which
19 the IRQs from DA7218 are delivered to.
20- interrupts: IRQ line info for DA7218 chip.
21 (See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt for
22 further information relating to interrupt properties)
23- interrupt-names : Name associated with interrupt line. Should be "wakeup" if
24 interrupt is to be used to wake system, otherwise "irq" should be used.
25- wakeup-source: Flag to indicate this device can wake system (suspend/resume).
26
27- clocks : phandle and clock specifier for codec MCLK.
28- clock-names : Clock name string for 'clocks' attribute, should be "mclk".
29
30- dlg,micbias1-lvl-millivolt : Voltage (mV) for Mic Bias 1
31 [<1200>, <1600>, <1800>, <2000>, <2200>, <2400>, <2600>, <2800>, <3000>]
32- dlg,micbias2-lvl-millivolt : Voltage (mV) for Mic Bias 2
33 [<1200>, <1600>, <1800>, <2000>, <2200>, <2400>, <2600>, <2800>, <3000>]
34- dlg,mic1-amp-in-sel : Mic1 input source type
35 ["diff", "se_p", "se_n"]
36- dlg,mic2-amp-in-sel : Mic2 input source type
37 ["diff", "se_p", "se_n"]
38- dlg,dmic1-data-sel : DMIC1 channel select based on clock edge.
39 ["lrise_rfall", "lfall_rrise"]
40- dlg,dmic1-samplephase : When to sample audio from DMIC1.
41 ["on_clkedge", "between_clkedge"]
42- dlg,dmic1-clkrate-hz : DMic1 clock frequency (Hz).
43 [<1500000>, <3000000>]
44- dlg,dmic2-data-sel : DMic2 channel select based on clock edge.
45 ["lrise_rfall", "lfall_rrise"]
46- dlg,dmic2-samplephase : When to sample audio from DMic2.
47 ["on_clkedge", "between_clkedge"]
48- dlg,dmic2-clkrate-hz : DMic2 clock frequency (Hz).
49 [<1500000>, <3000000>]
50- dlg,hp-diff-single-supply : Boolean flag, use single supply for HP
51 (DA7217 only)
52
53======
54
55Optional Child node - 'da7218_hpldet' (DA7218 only):
56
57Optional properties:
58- dlg,jack-rate-us : Time between jack detect measurements (us)
59 [<5>, <10>, <20>, <40>, <80>, <160>, <320>, <640>]
60- dlg,jack-debounce : Number of debounce measurements taken for jack detect
61 [<0>, <2>, <3>, <4>]
62- dlg,jack-threshold-pct : Threshold level for jack detection (% of VDD)
63 [<84>, <88>, <92>, <96>]
64- dlg,comp-inv : Boolean flag, invert comparator output
65- dlg,hyst : Boolean flag, enable hysteresis
66- dlg,discharge : Boolean flag, auto discharge of Mic Bias on jack removal
67
68======
69
70Example:
71
72 codec: da7218@1a {
73 compatible = "dlg,da7218";
74 reg = <0x1a>;
75 interrupt-parent = <&gpio6>;
76 interrupts = <11 IRQ_TYPE_LEVEL_HIGH>;
77 wakeup-source;
78
79 VDD-supply = <&reg_audio>;
80 VDDMIC-supply = <&reg_audio>;
81 VDDIO-supply = <&reg_audio>;
82
83 clocks = <&clks 201>;
84 clock-names = "mclk";
85
86 dlg,micbias1-lvl-millivolt = <2600>;
87 dlg,micbias2-lvl-millivolt = <2600>;
88 dlg,mic1-amp-in-sel = "diff";
89 dlg,mic2-amp-in-sel = "diff";
90
91 dlg,dmic1-data-sel = "lrise_rfall";
92 dlg,dmic1-samplephase = "on_clkedge";
93 dlg,dmic1-clkrate-hz = <3000000>;
94 dlg,dmic2-data-sel = "lrise_rfall";
95 dlg,dmic2-samplephase = "on_clkedge";
96 dlg,dmic2-clkrate-hz = <3000000>;
97
98 da7218_hpldet {
99 dlg,jack-rate-us = <40>;
100 dlg,jack-debounce = <2>;
101 dlg,jack-threshold-pct = <84>;
102 dlg,hyst;
103 };
104 };
diff --git a/Documentation/devicetree/bindings/sound/da7219.txt b/Documentation/devicetree/bindings/sound/da7219.txt
index 1b7030911a3b..cf61681826b6 100644
--- a/Documentation/devicetree/bindings/sound/da7219.txt
+++ b/Documentation/devicetree/bindings/sound/da7219.txt
@@ -28,13 +28,15 @@ Optional properties:
28- clocks : phandle and clock specifier for codec MCLK. 28- clocks : phandle and clock specifier for codec MCLK.
29- clock-names : Clock name string for 'clocks' attribute, should be "mclk". 29- clock-names : Clock name string for 'clocks' attribute, should be "mclk".
30 30
31- dlg,ldo-lvl : Required internal LDO voltage (mV) level for digital engine
32 [<1050>, <1100>, <1200>, <1400>]
33- dlg,micbias-lvl : Voltage (mV) for Mic Bias 31- dlg,micbias-lvl : Voltage (mV) for Mic Bias
34 [<1800>, <2000>, <2200>, <2400>, <2600>] 32 [<1600>, <1800>, <2000>, <2200>, <2400>, <2600>]
35- dlg,mic-amp-in-sel : Mic input source type 33- dlg,mic-amp-in-sel : Mic input source type
36 ["diff", "se_p", "se_n"] 34 ["diff", "se_p", "se_n"]
37 35
36Deprecated properties:
37- dlg,ldo-lvl : Required internal LDO voltage (mV) level for digital engine
38 (LDO unavailable in production HW so property no longer required).
39
38====== 40======
39 41
40Child node - 'da7219_aad': 42Child node - 'da7219_aad':
diff --git a/Documentation/devicetree/bindings/sound/fsl,asrc.txt b/Documentation/devicetree/bindings/sound/fsl,asrc.txt
index b93362a570be..3e26a9478e57 100644
--- a/Documentation/devicetree/bindings/sound/fsl,asrc.txt
+++ b/Documentation/devicetree/bindings/sound/fsl,asrc.txt
@@ -25,6 +25,11 @@ Required properties:
25 "mem" Peripheral access clock to access registers. 25 "mem" Peripheral access clock to access registers.
26 "ipg" Peripheral clock to driver module. 26 "ipg" Peripheral clock to driver module.
27 "asrck_<0-f>" Clock sources for input and output clock. 27 "asrck_<0-f>" Clock sources for input and output clock.
28 "spba" The spba clock is required when ASRC is placed as a
29 bus slave of the Shared Peripheral Bus and when two
30 or more bus masters (CPU, DMA or DSP) try to access
31 it. This property is optional depending on the SoC
32 design.
28 33
29 - big-endian : If this property is absent, the little endian mode 34 - big-endian : If this property is absent, the little endian mode
30 will be in use as default. Otherwise, the big endian 35 will be in use as default. Otherwise, the big endian
diff --git a/Documentation/devicetree/bindings/sound/fsl,esai.txt b/Documentation/devicetree/bindings/sound/fsl,esai.txt
index d3b6b5f48010..cd3ee5d84f03 100644
--- a/Documentation/devicetree/bindings/sound/fsl,esai.txt
+++ b/Documentation/devicetree/bindings/sound/fsl,esai.txt
@@ -27,6 +27,11 @@ Required properties:
27 derive HCK, SCK and FS. 27 derive HCK, SCK and FS.
28 "fsys" The system clock derived from ahb clock used to 28 "fsys" The system clock derived from ahb clock used to
29 derive HCK, SCK and FS. 29 derive HCK, SCK and FS.
30 "spba" The spba clock is required when ESAI is placed as a
31 bus slave of the Shared Peripheral Bus and when two
32 or more bus masters (CPU, DMA or DSP) try to access
33 it. This property is optional depending on the SoC
34 design.
30 35
31 - fsl,fifo-depth : The number of elements in the transmit and receive 36 - fsl,fifo-depth : The number of elements in the transmit and receive
32 FIFOs. This number is the maximum allowed value for 37 FIFOs. This number is the maximum allowed value for
diff --git a/Documentation/devicetree/bindings/sound/fsl,spdif.txt b/Documentation/devicetree/bindings/sound/fsl,spdif.txt
index b5ee32ee3706..4ca39ddc0417 100644
--- a/Documentation/devicetree/bindings/sound/fsl,spdif.txt
+++ b/Documentation/devicetree/bindings/sound/fsl,spdif.txt
@@ -27,6 +27,11 @@ Required properties:
27 Transceiver Clock Diagram" of SoC reference manual. 27 Transceiver Clock Diagram" of SoC reference manual.
28 It can also be referred to TxClk_Source bit of 28 It can also be referred to TxClk_Source bit of
29 register SPDIF_STC. 29 register SPDIF_STC.
30 "spba" The spba clock is required when SPDIF is placed as a
31 bus slave of the Shared Peripheral Bus and when two
32 or more bus masters (CPU, DMA or DSP) try to access
33 it. This property is optional depending on the SoC
34 design.
30 35
31 - big-endian : If this property is absent, the native endian mode 36 - big-endian : If this property is absent, the native endian mode
32 will be in use as default, or the big endian mode 37 will be in use as default, or the big endian mode
diff --git a/Documentation/devicetree/bindings/sound/img,i2s-in.txt b/Documentation/devicetree/bindings/sound/img,i2s-in.txt
new file mode 100644
index 000000000000..423265cfc3d6
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/img,i2s-in.txt
@@ -0,0 +1,47 @@
1Imagination Technologies I2S Input Controller
2
3Required Properties:
4
5 - compatible : Compatible list, must contain "img,i2s-in"
6
7 - #sound-dai-cells : Must be equal to 0
8
9 - reg : Offset and length of the register set for the device
10
11 - clocks : Contains an entry for each entry in clock-names
12
13 - clock-names : Must include the following entry:
14 "sys" The system clock
15
16 - dmas: Contains an entry for each entry in dma-names.
17
18 - dma-names: Must include the following entry:
19 "rx" Single DMA channel used by all active I2S channels
20
21 - img,i2s-channels : Number of I2S channels instantiated in the I2S in block
22
23Optional Properties:
24
25 - interrupts : Contains the I2S in interrupts. Depending on
26 the configuration, there may be no interrupts, one interrupt,
27 or an interrupt per I2S channel. For the case where there is
28 one interrupt per channel, the interrupts should be listed
29 in ascending channel order
30
31 - resets: Contains a phandle to the I2S in reset signal
32
33 - reset-names: Contains the reset signal name "rst"
34
35Example:
36
37i2s_in: i2s-in@18100800 {
38 compatible = "img,i2s-in";
39 reg = <0x18100800 0x200>;
40 interrupts = <GIC_SHARED 7 IRQ_TYPE_LEVEL_HIGH>;
41 dmas = <&mdc 30 0xffffffff 0>;
42 dma-names = "rx";
43 clocks = <&cr_periph SYS_CLK_I2S_IN>;
44 clock-names = "sys";
45 img,i2s-channels = <6>;
46 #sound-dai-cells = <0>;
47};
diff --git a/Documentation/devicetree/bindings/sound/img,i2s-out.txt b/Documentation/devicetree/bindings/sound/img,i2s-out.txt
new file mode 100644
index 000000000000..0159415b3338
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/img,i2s-out.txt
@@ -0,0 +1,51 @@
1Imagination Technologies I2S Output Controller
2
3Required Properties:
4
5 - compatible : Compatible list, must contain "img,i2s-out"
6
7 - #sound-dai-cells : Must be equal to 0
8
9 - reg : Offset and length of the register set for the device
10
11 - clocks : Contains an entry for each entry in clock-names
12
13 - clock-names : Must include the following entries:
14 "sys" The system clock
15 "ref" The reference clock
16
17 - dmas: Contains an entry for each entry in dma-names.
18
19 - dma-names: Must include the following entry:
20 "tx" Single DMA channel used by all active I2S channels
21
22 - img,i2s-channels : Number of I2S channels instantiated in the I2S out block
23
24 - resets: Contains a phandle to the I2S out reset signal
25
26 - reset-names: Contains the reset signal name "rst"
27
28Optional Properties:
29
30 - interrupts : Contains the I2S out interrupts. Depending on
31 the configuration, there may be no interrupts, one interrupt,
32 or an interrupt per I2S channel. For the case where there is
33 one interrupt per channel, the interrupts should be listed
34 in ascending channel order
35
36Example:
37
38i2s_out: i2s-out@18100A00 {
39 compatible = "img,i2s-out";
40 reg = <0x18100A00 0x200>;
41 interrupts = <GIC_SHARED 13 IRQ_TYPE_LEVEL_HIGH>;
42 dmas = <&mdc 23 0xffffffff 0>;
43 dma-names = "tx";
44 clocks = <&cr_periph SYS_CLK_I2S_OUT>,
45 <&clk_core CLK_I2S>;
46 clock-names = "sys", "ref";
47 img,i2s-channels = <6>;
48 resets = <&pistachio_reset PISTACHIO_RESET_I2S_OUT>;
49 reset-names = "rst";
50 #sound-dai-cells = <0>;
51};
diff --git a/Documentation/devicetree/bindings/sound/img,parallel-out.txt b/Documentation/devicetree/bindings/sound/img,parallel-out.txt
new file mode 100644
index 000000000000..a3015d2a06e0
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/img,parallel-out.txt
@@ -0,0 +1,44 @@
1Imagination Technologies Parallel Output Controller
2
3Required Properties:
4
5 - compatible : Compatible list, must contain "img,parallel-out".
6
7 - #sound-dai-cells : Must be equal to 0
8
9 - reg : Offset and length of the register set for the device.
10
11 - dmas: Contains an entry for each entry in dma-names.
12
13 - dma-names: Must include the following entry:
14 "tx"
15
16 - clocks : Contains an entry for each entry in clock-names.
17
18 - clock-names : Includes the following entries:
19 "sys" The system clock
20 "ref" The reference clock
21
22 - resets: Contains a phandle to the parallel out reset signal
23
24 - reset-names: Contains the reset signal name "rst"
25
26Optional Properties:
27
28 - interrupts : Contains the parallel out interrupt, if present
29
30Example:
31
32parallel_out: parallel-out@18100C00 {
33 compatible = "img,parallel-out";
34 reg = <0x18100C00 0x100>;
35 interrupts = <GIC_SHARED 19 IRQ_TYPE_LEVEL_HIGH>;
36 dmas = <&mdc 16 0xffffffff 0>;
37 dma-names = "tx";
38 clocks = <&cr_periph SYS_CLK_PAUD_OUT>,
39 <&clk_core CLK_AUDIO_DAC>;
40 clock-names = "sys", "ref";
41 resets = <&pistachio_reset PISTACHIO_RESET_PRL_OUT>;
42 reset-names = "rst";
43 #sound-dai-cells = <0>;
44};
diff --git a/Documentation/devicetree/bindings/sound/img,pistachio-internal-dac.txt b/Documentation/devicetree/bindings/sound/img,pistachio-internal-dac.txt
new file mode 100644
index 000000000000..4cc18fc0477e
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/img,pistachio-internal-dac.txt
@@ -0,0 +1,18 @@
1Pistachio internal DAC DT bindings
2
3Required properties:
4
5 - compatible: "img,pistachio-internal-dac"
6
7 - img,cr-top : Must contain a phandle to the top level control syscon
8 node which contains the internal dac control registers
9
10 - VDD-supply : Digital power supply regulator (+1.8V or +3.3V)
11
12Examples:
13
14internal_dac: internal-dac {
15 compatible = "img,pistachio-internal-dac";
16 img,cr-top = <&cr_top>;
17 VDD-supply = <&supply3v3>;
18};
diff --git a/Documentation/devicetree/bindings/sound/img,spdif-in.txt b/Documentation/devicetree/bindings/sound/img,spdif-in.txt
new file mode 100644
index 000000000000..aab9a81f7e13
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/img,spdif-in.txt
@@ -0,0 +1,41 @@
1Imagination Technologies SPDIF Input Controller
2
3Required Properties:
4
5 - compatible : Compatible list, must contain "img,spdif-in"
6
7 - #sound-dai-cells : Must be equal to 0
8
9 - reg : Offset and length of the register set for the device
10
11 - dmas: Contains an entry for each entry in dma-names.
12
13 - dma-names: Must include the following entry:
14 "rx"
15
16 - clocks : Contains an entry for each entry in clock-names
17
18 - clock-names : Includes the following entries:
19 "sys" The system clock
20
21Optional Properties:
22
23 - resets: Should contain a phandle to the spdif in reset signal, if any
24
25 - reset-names: Should contain the reset signal name "rst", if a
26 reset phandle is given
27
28 - interrupts : Contains the spdif in interrupt, if present
29
30Example:
31
32spdif_in: spdif-in@18100E00 {
33 compatible = "img,spdif-in";
34 reg = <0x18100E00 0x100>;
35 interrupts = <GIC_SHARED 20 IRQ_TYPE_LEVEL_HIGH>;
36 dmas = <&mdc 15 0xffffffff 0>;
37 dma-names = "rx";
38 clocks = <&cr_periph SYS_CLK_SPDIF_IN>;
39 clock-names = "sys";
40 #sound-dai-cells = <0>;
41};
diff --git a/Documentation/devicetree/bindings/sound/img,spdif-out.txt b/Documentation/devicetree/bindings/sound/img,spdif-out.txt
new file mode 100644
index 000000000000..470a5191e101
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/img,spdif-out.txt
@@ -0,0 +1,44 @@
1Imagination Technologies SPDIF Output Controller
2
3Required Properties:
4
5 - compatible : Compatible list, must contain "img,spdif-out"
6
7 - #sound-dai-cells : Must be equal to 0
8
9 - reg : Offset and length of the register set for the device
10
11 - dmas: Contains an entry for each entry in dma-names.
12
13 - dma-names: Must include the following entry:
14 "tx"
15
16 - clocks : Contains an entry for each entry in clock-names.
17
18 - clock-names : Includes the following entries:
19 "sys" The system clock
20 "ref" The reference clock
21
22 - resets: Contains a phandle to the spdif out reset signal
23
24 - reset-names: Contains the reset signal name "rst"
25
26Optional Properties:
27
28 - interrupts : Contains the parallel out interrupt, if present
29
30Example:
31
32spdif_out: spdif-out@18100D00 {
33 compatible = "img,spdif-out";
34 reg = <0x18100D00 0x100>;
35 interrupts = <GIC_SHARED 21 IRQ_TYPE_LEVEL_HIGH>;
36 dmas = <&mdc 14 0xffffffff 0>;
37 dma-names = "tx";
38 clocks = <&cr_periph SYS_CLK_SPDIF_OUT>,
39 <&clk_core CLK_SPDIF>;
40 clock-names = "sys", "ref";
41 resets = <&pistachio_reset PISTACHIO_RESET_SPDIF_OUT>;
42 reset-names = "rst";
43 #sound-dai-cells = <0>;
44};
diff --git a/Documentation/devicetree/bindings/sound/inno-rk3036.txt b/Documentation/devicetree/bindings/sound/inno-rk3036.txt
new file mode 100644
index 000000000000..758de8e27561
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/inno-rk3036.txt
@@ -0,0 +1,20 @@
1Inno audio codec for RK3036
2
3Inno audio codec is integrated inside RK3036 SoC.
4
5Required properties:
6- compatible : Should be "rockchip,rk3036-codec".
7- reg : The registers of codec.
8- clock-names : Should be "acodec_pclk".
9- clocks : The clock of codec.
10- rockchip,grf : The phandle of grf device node.
11
12Example:
13
14 acodec: acodec-ana@20030000 {
15 compatible = "rk3036-codec";
16 reg = <0x20030000 0x4000>;
17 rockchip,grf = <&grf>;
18 clock-names = "acodec_pclk";
19 clocks = <&cru ACLK_VCODEC>;
20 };
diff --git a/Documentation/devicetree/bindings/sound/pcm1792a.txt b/Documentation/devicetree/bindings/sound/pcm179x.txt
index 970ba1ed576f..4ae70d3462d6 100644
--- a/Documentation/devicetree/bindings/sound/pcm1792a.txt
+++ b/Documentation/devicetree/bindings/sound/pcm179x.txt
@@ -1,4 +1,4 @@
1Texas Instruments pcm1792a DT bindings 1Texas Instruments pcm179x DT bindings
2 2
3This driver supports the SPI bus. 3This driver supports the SPI bus.
4 4
diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index c57cbd65736c..8ee0fa91e4a0 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -7,8 +7,11 @@ Required properties:
7 "renesas,rcar_sound-gen3" if generation3 7 "renesas,rcar_sound-gen3" if generation3
8 Examples with soctypes are: 8 Examples with soctypes are:
9 - "renesas,rcar_sound-r8a7778" (R-Car M1A) 9 - "renesas,rcar_sound-r8a7778" (R-Car M1A)
10 - "renesas,rcar_sound-r8a7779" (R-Car H1)
10 - "renesas,rcar_sound-r8a7790" (R-Car H2) 11 - "renesas,rcar_sound-r8a7790" (R-Car H2)
11 - "renesas,rcar_sound-r8a7791" (R-Car M2-W) 12 - "renesas,rcar_sound-r8a7791" (R-Car M2-W)
13 - "renesas,rcar_sound-r8a7793" (R-Car M2-N)
14 - "renesas,rcar_sound-r8a7794" (R-Car E2)
12 - "renesas,rcar_sound-r8a7795" (R-Car H3) 15 - "renesas,rcar_sound-r8a7795" (R-Car H3)
13- reg : Should contain the register physical address. 16- reg : Should contain the register physical address.
14 required register is 17 required register is
@@ -34,6 +37,8 @@ Required properties:
34 see below for detail. 37 see below for detail.
35- #sound-dai-cells : it must be 0 if your system is using single DAI 38- #sound-dai-cells : it must be 0 if your system is using single DAI
36 it must be 1 if your system is using multi DAI 39 it must be 1 if your system is using multi DAI
40
41Optional properties:
37- #clock-cells : it must be 0 if your system has audio_clkout 42- #clock-cells : it must be 0 if your system has audio_clkout
38 it must be 1 if your system has audio_clkout0/1/2/3 43 it must be 1 if your system has audio_clkout0/1/2/3
39- clock-frequency : for all audio_clkout0/1/2/3 44- clock-frequency : for all audio_clkout0/1/2/3
@@ -244,3 +249,80 @@ rcar_sound: sound@ec500000 {
244 }; 249 };
245 }; 250 };
246}; 251};
252
253Example: simple sound card
254
255 rsnd_ak4643: sound {
256 compatible = "simple-audio-card";
257
258 simple-audio-card,format = "left_j";
259 simple-audio-card,bitclock-master = <&sndcodec>;
260 simple-audio-card,frame-master = <&sndcodec>;
261
262 sndcpu: simple-audio-card,cpu {
263 sound-dai = <&rcar_sound>;
264 };
265
266 sndcodec: simple-audio-card,codec {
267 sound-dai = <&ak4643>;
268 clocks = <&audio_clock>;
269 };
270 };
271
272&rcar_sound {
273 pinctrl-0 = <&sound_pins &sound_clk_pins>;
274 pinctrl-names = "default";
275
276 /* Single DAI */
277 #sound-dai-cells = <0>;
278
279 status = "okay";
280
281 rcar_sound,dai {
282 dai0 {
283 playback = <&ssi0 &src2 &dvc0>;
284 capture = <&ssi1 &src3 &dvc1>;
285 };
286 };
287};
288
289&ssi1 {
290 shared-pin;
291};
292
293Example: simple sound card for TDM
294
295 rsnd_tdm: sound {
296 compatible = "simple-audio-card";
297
298 simple-audio-card,format = "left_j";
299 simple-audio-card,bitclock-master = <&sndcodec>;
300 simple-audio-card,frame-master = <&sndcodec>;
301
302 sndcpu: simple-audio-card,cpu {
303 sound-dai = <&rcar_sound>;
304 dai-tdm-slot-num = <6>;
305 };
306
307 sndcodec: simple-audio-card,codec {
308 sound-dai = <&xxx>;
309 };
310 };
311
312Example: simple sound card for Multi channel
313
314&rcar_sound {
315 pinctrl-0 = <&sound_pins &sound_clk_pins>;
316 pinctrl-names = "default";
317
318 /* Single DAI */
319 #sound-dai-cells = <0>;
320
321 status = "okay";
322
323 rcar_sound,dai {
324 dai0 {
325 playback = <&ssi0 &ssi1 &ssi2 &src0 &dvc0>;
326 };
327 };
328};
diff --git a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
index 962748a8d919..2b2caa281ce3 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
@@ -4,8 +4,8 @@ Renesas Sampling Rate Convert Sound Card specifies audio DAI connections of SoC
4 4
5Required properties: 5Required properties:
6 6
7- compatible : "renesas,rsrc-card,<board>" 7- compatible : "renesas,rsrc-card{,<board>}"
8 Examples with soctypes are: 8 Examples with boards are:
9 - "renesas,rsrc-card" 9 - "renesas,rsrc-card"
10 - "renesas,rsrc-card,lager" 10 - "renesas,rsrc-card,lager"
11 - "renesas,rsrc-card,koelsch" 11 - "renesas,rsrc-card,koelsch"
diff --git a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
index 2267d249ca0e..b7f3a9325ebd 100644
--- a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
+++ b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
@@ -19,6 +19,7 @@ Required properties:
19- clock-names: should contain followings: 19- clock-names: should contain followings:
20 - "i2s_hclk": clock for I2S BUS 20 - "i2s_hclk": clock for I2S BUS
21 - "i2s_clk" : clock for I2S controller 21 - "i2s_clk" : clock for I2S controller
22- rockchip,playback-channels: max playback channels, if not set, 8 channels default.
22- rockchip,capture-channels: max capture channels, if not set, 2 channels default. 23- rockchip,capture-channels: max capture channels, if not set, 2 channels default.
23 24
24Example for rk3288 I2S controller: 25Example for rk3288 I2S controller:
@@ -31,5 +32,6 @@ i2s@ff890000 {
31 dma-names = "tx", "rx"; 32 dma-names = "tx", "rx";
32 clock-names = "i2s_hclk", "i2s_clk"; 33 clock-names = "i2s_hclk", "i2s_clk";
33 clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>; 34 clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>;
35 rockchip,playback-channels = <8>;
34 rockchip,capture-channels = <2>; 36 rockchip,capture-channels = <2>;
35}; 37};
diff --git a/Documentation/devicetree/bindings/sound/rt5616.txt b/Documentation/devicetree/bindings/sound/rt5616.txt
new file mode 100644
index 000000000000..efc48c65198d
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/rt5616.txt
@@ -0,0 +1,26 @@
1RT5616 audio CODEC
2
3This device supports I2C only.
4
5Required properties:
6
7- compatible : "realtek,rt5616".
8
9- reg : The I2C address of the device.
10
11Pins on the device (for linking into audio routes) for RT5616:
12
13 * IN1P
14 * IN2P
15 * IN2N
16 * LOUTL
17 * LOUTR
18 * HPOL
19 * HPOR
20
21Example:
22
23codec: rt5616@1b {
24 compatible = "realtek,rt5616";
25 reg = <0x1b>;
26};
diff --git a/Documentation/devicetree/bindings/sound/rt5651.txt b/Documentation/devicetree/bindings/sound/rt5651.txt
new file mode 100644
index 000000000000..3875233095f5
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/rt5651.txt
@@ -0,0 +1,41 @@
1RT5651 audio CODEC
2
3This device supports I2C only.
4
5Required properties:
6
7- compatible : "realtek,rt5651".
8
9- reg : The I2C address of the device.
10
11Optional properties:
12
13- realtek,in2-differential
14 Boolean. Indicate MIC2 input are differential, rather than single-ended.
15
16- realtek,dmic-en
17 Boolean. true if dmic is used.
18
19Pins on the device (for linking into audio routes) for RT5651:
20
21 * DMIC L1
22 * DMIC R1
23 * IN1P
24 * IN2P
25 * IN2N
26 * IN3P
27 * HPOL
28 * HPOR
29 * LOUTL
30 * LOUTR
31 * PDML
32 * PDMR
33
34Example:
35
36codec: rt5651@1a {
37 compatible = "realtek,rt5651";
38 reg = <0x1a>;
39 realtek,dmic-en = "true";
40 realtek,in2-diff = "false";
41};
diff --git a/Documentation/devicetree/bindings/sound/rt5659.txt b/Documentation/devicetree/bindings/sound/rt5659.txt
new file mode 100644
index 000000000000..5f79e7fde032
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/rt5659.txt
@@ -0,0 +1,75 @@
1RT5659/RT5658 audio CODEC
2
3This device supports I2C only.
4
5Required properties:
6
7- compatible : One of "realtek,rt5659" or "realtek,rt5658".
8
9- reg : The I2C address of the device.
10
11- interrupts : The CODEC's interrupt output.
12
13Optional properties:
14
15- realtek,in1-differential
16- realtek,in3-differential
17- realtek,in4-differential
18 Boolean. Indicate MIC1/3/4 input are differential, rather than single-ended.
19
20- realtek,dmic1-data-pin
21 0: dmic1 is not used
22 1: using IN2N pin as dmic1 data pin
23 2: using GPIO5 pin as dmic1 data pin
24 3: using GPIO9 pin as dmic1 data pin
25 4: using GPIO11 pin as dmic1 data pin
26
27- realtek,dmic2-data-pin
28 0: dmic2 is not used
29 1: using IN2P pin as dmic2 data pin
30 2: using GPIO6 pin as dmic2 data pin
31 3: using GPIO10 pin as dmic2 data pin
32 4: using GPIO12 pin as dmic2 data pin
33
34- realtek,jd-src
35 0: No JD is used
36 1: using JD3 as JD source
37
38- realtek,ldo1-en-gpios : The GPIO that controls the CODEC's LDO1_EN pin.
39- realtek,reset-gpios : The GPIO that controls the CODEC's RESET pin.
40
41Pins on the device (for linking into audio routes) for RT5659/RT5658:
42
43 * DMIC L1
44 * DMIC R1
45 * DMIC L2
46 * DMIC R2
47 * IN1P
48 * IN1N
49 * IN2P
50 * IN2N
51 * IN3P
52 * IN3N
53 * IN4P
54 * IN4N
55 * HPOL
56 * HPOR
57 * SPOL
58 * SPOR
59 * LOUTL
60 * LOUTR
61 * MONOOUT
62 * PDML
63 * PDMR
64 * SPDIF
65
66Example:
67
68rt5659 {
69 compatible = "realtek,rt5659";
70 reg = <0x1b>;
71 interrupt-parent = <&gpio>;
72 interrupts = <TEGRA_GPIO(W, 3) GPIO_ACTIVE_HIGH>;
73 realtek,ldo1-en-gpios =
74 <&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_HIGH>;
75};
diff --git a/Documentation/devicetree/bindings/sound/rt5677.txt b/Documentation/devicetree/bindings/sound/rt5677.txt
index f07078997f87..1b3c13d206ff 100644
--- a/Documentation/devicetree/bindings/sound/rt5677.txt
+++ b/Documentation/devicetree/bindings/sound/rt5677.txt
@@ -18,7 +18,7 @@ Required properties:
18Optional properties: 18Optional properties:
19 19
20- realtek,pow-ldo2-gpio : The GPIO that controls the CODEC's POW_LDO2 pin. 20- realtek,pow-ldo2-gpio : The GPIO that controls the CODEC's POW_LDO2 pin.
21- realtek,reset-gpio : The GPIO that controls the CODEC's RESET pin. 21- realtek,reset-gpio : The GPIO that controls the CODEC's RESET pin. Active low.
22 22
23- realtek,in1-differential 23- realtek,in1-differential
24- realtek,in2-differential 24- realtek,in2-differential
diff --git a/Documentation/devicetree/bindings/sound/sun4i-codec.txt b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
index c92966bd5488..0dce690f78f5 100644
--- a/Documentation/devicetree/bindings/sound/sun4i-codec.txt
+++ b/Documentation/devicetree/bindings/sound/sun4i-codec.txt
@@ -14,6 +14,9 @@ Required properties:
14 - "apb": the parent APB clock for this controller 14 - "apb": the parent APB clock for this controller
15 - "codec": the parent module clock 15 - "codec": the parent module clock
16 16
17Optional properties:
18- allwinner,pa-gpios: gpio to enable external amplifier
19
17Example: 20Example:
18codec: codec@01c22c00 { 21codec: codec@01c22c00 {
19 #sound-dai-cells = <0>; 22 #sound-dai-cells = <0>;
diff --git a/Documentation/devicetree/bindings/sound/ti,pcm3168a.txt b/Documentation/devicetree/bindings/sound/ti,pcm3168a.txt
new file mode 100644
index 000000000000..5d9cb84c661d
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/ti,pcm3168a.txt
@@ -0,0 +1,48 @@
1Texas Instruments pcm3168a DT bindings
2
3This driver supports both SPI and I2C bus access for this codec
4
5Required properties:
6
7 - compatible: "ti,pcm3168a"
8
9 - clocks : Contains an entry for each entry in clock-names
10
11 - clock-names : Includes the following entries:
12 "scki" The system clock
13
14 - VDD1-supply : Digital power supply regulator 1 (+3.3V)
15
16 - VDD2-supply : Digital power supply regulator 2 (+3.3V)
17
18 - VCCAD1-supply : ADC power supply regulator 1 (+5V)
19
20 - VCCAD2-supply : ADC power supply regulator 2 (+5V)
21
22 - VCCDA1-supply : DAC power supply regulator 1 (+5V)
23
24 - VCCDA2-supply : DAC power supply regulator 2 (+5V)
25
26For required properties on SPI/I2C, consult SPI/I2C device tree documentation
27
28Examples:
29
30i2c0: i2c0@0 {
31
32 ...
33
34 pcm3168a: audio-codec@44 {
35 compatible = "ti,pcm3168a";
36 reg = <0x44>;
37 clocks = <&clk_core CLK_AUDIO>;
38 clock-names = "scki";
39 VDD1-supply = <&supply3v3>;
40 VDD2-supply = <&supply3v3>;
41 VCCAD1-supply = <&supply5v0>;
42 VCCAD2-supply = <&supply5v0>;
43 VCCDA1-supply = <&supply5v0>;
44 VCCDA2-supply = <&supply5v0>;
45 pinctrl-names = "default";
46 pinctrl-0 = <&dac_clk_pin>;
47 };
48};
diff --git a/Documentation/devicetree/bindings/sound/wlf,wm8974.txt b/Documentation/devicetree/bindings/sound/wlf,wm8974.txt
new file mode 100644
index 000000000000..01d3a7c83419
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/wlf,wm8974.txt
@@ -0,0 +1,15 @@
1WM8974 audio CODEC
2
3This device supports both I2C and SPI (configured with pin strapping
4on the board).
5
6Required properties:
7 - compatible: "wlf,wm8974"
8 - reg: the I2C address or SPI chip select number of the device
9
10Examples:
11
12codec: wm8974@1a {
13 compatible = "wlf,wm8974";
14 reg = <0x1a>;
15};
diff --git a/Documentation/devicetree/bindings/sound/wm8994.txt b/Documentation/devicetree/bindings/sound/wm8994.txt
index e045e90a0924..68c4e8d96bed 100644
--- a/Documentation/devicetree/bindings/sound/wm8994.txt
+++ b/Documentation/devicetree/bindings/sound/wm8994.txt
@@ -30,7 +30,7 @@ Optional properties:
30 - #interrupt-cells: the number of cells to describe an IRQ, this should be 2. 30 - #interrupt-cells: the number of cells to describe an IRQ, this should be 2.
31 The first cell is the IRQ number. 31 The first cell is the IRQ number.
32 The second cell is the flags, encoded as the trigger masks from 32 The second cell is the flags, encoded as the trigger masks from
33 Documentation/devicetree/bindings/interrupts.txt 33 Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
34 34
35 - clocks : A list of up to two phandle and clock specifier pairs 35 - clocks : A list of up to two phandle and clock specifier pairs
36 - clock-names : A list of clock names sorted in the same order as clocks. 36 - clock-names : A list of clock names sorted in the same order as clocks.
diff --git a/Documentation/devicetree/bindings/spi/sh-msiof.txt b/Documentation/devicetree/bindings/spi/sh-msiof.txt
index 705075da2f10..aa005c1d10d9 100644
--- a/Documentation/devicetree/bindings/spi/sh-msiof.txt
+++ b/Documentation/devicetree/bindings/spi/sh-msiof.txt
@@ -10,6 +10,7 @@ Required properties:
10 "renesas,msiof-r8a7792" (R-Car V2H) 10 "renesas,msiof-r8a7792" (R-Car V2H)
11 "renesas,msiof-r8a7793" (R-Car M2-N) 11 "renesas,msiof-r8a7793" (R-Car M2-N)
12 "renesas,msiof-r8a7794" (R-Car E2) 12 "renesas,msiof-r8a7794" (R-Car E2)
13 "renesas,msiof-sh73a0" (SH-Mobile AG5)
13- reg : A list of offsets and lengths of the register sets for 14- reg : A list of offsets and lengths of the register sets for
14 the device. 15 the device.
15 If only one register set is present, it is to be used 16 If only one register set is present, it is to be used
diff --git a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
index ce363c923f44..e43f4cf4cf35 100644
--- a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
+++ b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
@@ -2,9 +2,10 @@ Binding for MTK SPI controller
2 2
3Required properties: 3Required properties:
4- compatible: should be one of the following. 4- compatible: should be one of the following.
5 - mediatek,mt8173-spi: for mt8173 platforms 5 - mediatek,mt2701-spi: for mt2701 platforms
6 - mediatek,mt8135-spi: for mt8135 platforms
7 - mediatek,mt6589-spi: for mt6589 platforms 6 - mediatek,mt6589-spi: for mt6589 platforms
7 - mediatek,mt8135-spi: for mt8135 platforms
8 - mediatek,mt8173-spi: for mt8173 platforms
8 9
9- #address-cells: should be 1. 10- #address-cells: should be 1.
10 11
@@ -29,10 +30,10 @@ Required properties:
29 muxes clock, and "spi-clk" for the clock gate. 30 muxes clock, and "spi-clk" for the clock gate.
30 31
31Optional properties: 32Optional properties:
32-cs-gpios: see spi-bus.txt, only required for MT8173. 33-cs-gpios: see spi-bus.txt.
33 34
34- mediatek,pad-select: specify which pins group(ck/mi/mo/cs) spi 35- mediatek,pad-select: specify which pins group(ck/mi/mo/cs) spi
35 controller used. This is a array, the element value should be 0~3, 36 controller used. This is an array, the element value should be 0~3,
36 only required for MT8173. 37 only required for MT8173.
37 0: specify GPIO69,70,71,72 for spi pins. 38 0: specify GPIO69,70,71,72 for spi pins.
38 1: specify GPIO102,103,104,105 for spi pins. 39 1: specify GPIO102,103,104,105 for spi pins.
diff --git a/Documentation/devicetree/bindings/spi/ti_qspi.txt b/Documentation/devicetree/bindings/spi/ti_qspi.txt
index 601a360531a5..cc8304aa64ac 100644
--- a/Documentation/devicetree/bindings/spi/ti_qspi.txt
+++ b/Documentation/devicetree/bindings/spi/ti_qspi.txt
@@ -15,14 +15,32 @@ Recommended properties:
15- spi-max-frequency: Definition as per 15- spi-max-frequency: Definition as per
16 Documentation/devicetree/bindings/spi/spi-bus.txt 16 Documentation/devicetree/bindings/spi/spi-bus.txt
17 17
18Optional properties:
19- syscon-chipselects: Handle to system control region contains QSPI
20 chipselect register and offset of that register.
21
18Example: 22Example:
19 23
24For am4372:
20qspi: qspi@4b300000 { 25qspi: qspi@4b300000 {
21 compatible = "ti,dra7xxx-qspi"; 26 compatible = "ti,am4372-qspi";
22 reg = <0x47900000 0x100>, <0x30000000 0x3ffffff>; 27 reg = <0x47900000 0x100>, <0x30000000 0x4000000>;
23 reg-names = "qspi_base", "qspi_mmap"; 28 reg-names = "qspi_base", "qspi_mmap";
24 #address-cells = <1>; 29 #address-cells = <1>;
25 #size-cells = <0>; 30 #size-cells = <0>;
26 spi-max-frequency = <25000000>; 31 spi-max-frequency = <25000000>;
27 ti,hwmods = "qspi"; 32 ti,hwmods = "qspi";
28}; 33};
34
35For dra7xx:
36qspi: qspi@4b300000 {
37 compatible = "ti,dra7xxx-qspi";
38 reg = <0x4b300000 0x100>,
39 <0x5c000000 0x4000000>,
40 reg-names = "qspi_base", "qspi_mmap";
41 syscon-chipselects = <&scm_conf 0x558>;
42 #address-cells = <1>;
43 #size-cells = <0>;
44 spi-max-frequency = <48000000>;
45 ti,hwmods = "qspi";
46};
diff --git a/Documentation/devicetree/bindings/arm/rockchip/pmu-sram.txt b/Documentation/devicetree/bindings/sram/rockchip-pmu-sram.txt
index 6b42fda306ff..6b42fda306ff 100644
--- a/Documentation/devicetree/bindings/arm/rockchip/pmu-sram.txt
+++ b/Documentation/devicetree/bindings/sram/rockchip-pmu-sram.txt
diff --git a/Documentation/devicetree/bindings/arm/rockchip/smp-sram.txt b/Documentation/devicetree/bindings/sram/rockchip-smp-sram.txt
index d9416fb8db6f..800701ecffca 100644
--- a/Documentation/devicetree/bindings/arm/rockchip/smp-sram.txt
+++ b/Documentation/devicetree/bindings/sram/rockchip-smp-sram.txt
@@ -12,7 +12,7 @@ Required sub-node properties:
12- compatible : should be "rockchip,rk3066-smp-sram" 12- compatible : should be "rockchip,rk3066-smp-sram"
13 13
14The rest of the properties should follow the generic mmio-sram discription 14The rest of the properties should follow the generic mmio-sram discription
15found in ../../misc/sram.txt 15found in Documentation/devicetree/bindings/sram/sram.txt
16 16
17Example: 17Example:
18 18
diff --git a/Documentation/devicetree/bindings/arm/exynos/smp-sysram.txt b/Documentation/devicetree/bindings/sram/samsung-sram.txt
index 4a0a4f70a0ce..6bc474b2b885 100644
--- a/Documentation/devicetree/bindings/arm/exynos/smp-sysram.txt
+++ b/Documentation/devicetree/bindings/sram/samsung-sram.txt
@@ -15,7 +15,7 @@ Required sub-node properties:
15 "samsung,exynos4210-sysram-ns" : for Non-secure SYSRAM 15 "samsung,exynos4210-sysram-ns" : for Non-secure SYSRAM
16 16
17The rest of the properties should follow the generic mmio-sram discription 17The rest of the properties should follow the generic mmio-sram discription
18found in ../../misc/sysram.txt 18found in Documentation/devicetree/bindings/sram/sram.txt
19 19
20Example: 20Example:
21 21
diff --git a/Documentation/devicetree/bindings/misc/sram.txt b/Documentation/devicetree/bindings/sram/sram.txt
index 42ee9438b771..42ee9438b771 100644
--- a/Documentation/devicetree/bindings/misc/sram.txt
+++ b/Documentation/devicetree/bindings/sram/sram.txt
diff --git a/Documentation/devicetree/bindings/soc/sunxi/sram.txt b/Documentation/devicetree/bindings/sram/sunxi-sram.txt
index 067698112f5f..8d5665468fe7 100644
--- a/Documentation/devicetree/bindings/soc/sunxi/sram.txt
+++ b/Documentation/devicetree/bindings/sram/sunxi-sram.txt
@@ -16,7 +16,7 @@ SRAM nodes
16---------- 16----------
17 17
18Each SRAM is described using the mmio-sram bindings documented in 18Each SRAM is described using the mmio-sram bindings documented in
19Documentation/devicetree/bindings/misc/sram.txt 19Documentation/devicetree/bindings/sram/sram.txt
20 20
21Each SRAM will have SRAM sections that are going to be handled by the 21Each SRAM will have SRAM sections that are going to be handled by the
22SRAM controller as subnodes. These sections are represented following 22SRAM controller as subnodes. These sections are represented following
diff --git a/Documentation/devicetree/bindings/staging/ion/hi6220-ion.txt b/Documentation/devicetree/bindings/staging/ion/hi6220-ion.txt
new file mode 100644
index 000000000000..c59e27c632c1
--- /dev/null
+++ b/Documentation/devicetree/bindings/staging/ion/hi6220-ion.txt
@@ -0,0 +1,31 @@
1Hi6220 SoC ION
2===================================================================
3Required properties:
4- compatible : "hisilicon,hi6220-ion"
5- list of the ION heaps
6 - heap name : maybe heap_sys_user@0
7 - heap id : id should be unique in the system.
8 - heap base : base ddr address of the heap,0 means that
9 it is dynamic.
10 - heap size : memory size and 0 means it is dynamic.
11 - heap type : the heap type of the heap, please also
12 see the define in ion.h(drivers/staging/android/uapi/ion.h)
13-------------------------------------------------------------------
14Example:
15 hi6220-ion {
16 compatible = "hisilicon,hi6220-ion";
17 heap_sys_user@0 {
18 heap-name = "sys_user";
19 heap-id = <0x0>;
20 heap-base = <0x0>;
21 heap-size = <0x0>;
22 heap-type = "ion_system";
23 };
24 heap_sys_contig@0 {
25 heap-name = "sys_contig";
26 heap-id = <0x1>;
27 heap-base = <0x0>;
28 heap-size = <0x0>;
29 heap-type = "ion_system_contig";
30 };
31 };
diff --git a/Documentation/devicetree/bindings/thermal/qoriq-thermal.txt b/Documentation/devicetree/bindings/thermal/qoriq-thermal.txt
new file mode 100644
index 000000000000..66223d561972
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/qoriq-thermal.txt
@@ -0,0 +1,63 @@
1* Thermal Monitoring Unit (TMU) on Freescale QorIQ SoCs
2
3Required properties:
4- compatible : Must include "fsl,qoriq-tmu". The version of the device is
5 determined by the TMU IP Block Revision Register (IPBRR0) at
6 offset 0x0BF8.
7 Table of correspondences between IPBRR0 values and example chips:
8 Value Device
9 ---------- -----
10 0x01900102 T1040
11- reg : Address range of TMU registers.
12- interrupts : Contains the interrupt for TMU.
13- fsl,tmu-range : The values to be programmed into TTRnCR, as specified by
14 the SoC reference manual. The first cell is TTR0CR, the second is
15 TTR1CR, etc.
16- fsl,tmu-calibration : A list of cell pairs containing temperature
17 calibration data, as specified by the SoC reference manual.
18 The first cell of each pair is the value to be written to TTCFGR,
19 and the second is the value to be written to TSCFGR.
20
21Example:
22
23tmu@f0000 {
24 compatible = "fsl,qoriq-tmu";
25 reg = <0xf0000 0x1000>;
26 interrupts = <18 2 0 0>;
27 fsl,tmu-range = <0x000a0000 0x00090026 0x0008004a 0x0001006a>;
28 fsl,tmu-calibration = <0x00000000 0x00000025
29 0x00000001 0x00000028
30 0x00000002 0x0000002d
31 0x00000003 0x00000031
32 0x00000004 0x00000036
33 0x00000005 0x0000003a
34 0x00000006 0x00000040
35 0x00000007 0x00000044
36 0x00000008 0x0000004a
37 0x00000009 0x0000004f
38 0x0000000a 0x00000054
39
40 0x00010000 0x0000000d
41 0x00010001 0x00000013
42 0x00010002 0x00000019
43 0x00010003 0x0000001f
44 0x00010004 0x00000025
45 0x00010005 0x0000002d
46 0x00010006 0x00000033
47 0x00010007 0x00000043
48 0x00010008 0x0000004b
49 0x00010009 0x00000053
50
51 0x00020000 0x00000010
52 0x00020001 0x00000017
53 0x00020002 0x0000001f
54 0x00020003 0x00000029
55 0x00020004 0x00000031
56 0x00020005 0x0000003c
57 0x00020006 0x00000042
58 0x00020007 0x0000004d
59 0x00020008 0x00000056
60
61 0x00030000 0x00000012
62 0x00030001 0x0000001d>;
63};
diff --git a/Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt b/Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt
index 64083bc5633c..8ff54eb464dc 100644
--- a/Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt
+++ b/Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt
@@ -3,6 +3,7 @@ Mediatek MT6577, MT6572 and MT6589 Timers
3 3
4Required properties: 4Required properties:
5- compatible should contain: 5- compatible should contain:
6 * "mediatek,mt2701-timer" for MT2701 compatible timers
6 * "mediatek,mt6580-timer" for MT6580 compatible timers 7 * "mediatek,mt6580-timer" for MT6580 compatible timers
7 * "mediatek,mt6589-timer" for MT6589 compatible timers 8 * "mediatek,mt6589-timer" for MT6589 compatible timers
8 * "mediatek,mt8127-timer" for MT8127 compatible timers 9 * "mediatek,mt8127-timer" for MT8127 compatible timers
diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt
index fd132cbee70e..221368207ca4 100644
--- a/Documentation/devicetree/bindings/usb/dwc2.txt
+++ b/Documentation/devicetree/bindings/usb/dwc2.txt
@@ -4,6 +4,7 @@ Platform DesignWare HS OTG USB 2.0 controller
4Required properties: 4Required properties:
5- compatible : One of: 5- compatible : One of:
6 - brcm,bcm2835-usb: The DWC2 USB controller instance in the BCM2835 SoC. 6 - brcm,bcm2835-usb: The DWC2 USB controller instance in the BCM2835 SoC.
7 - hisilicon,hi6220-usb: The DWC2 USB controller instance in the hi6220 SoC.
7 - rockchip,rk3066-usb: The DWC2 USB controller instance in the rk3066 Soc; 8 - rockchip,rk3066-usb: The DWC2 USB controller instance in the rk3066 Soc;
8 - "rockchip,rk3188-usb", "rockchip,rk3066-usb", "snps,dwc2": for rk3188 Soc; 9 - "rockchip,rk3188-usb", "rockchip,rk3066-usb", "snps,dwc2": for rk3188 Soc;
9 - "rockchip,rk3288-usb", "rockchip,rk3066-usb", "snps,dwc2": for rk3288 Soc; 10 - "rockchip,rk3288-usb", "rockchip,rk3066-usb", "snps,dwc2": for rk3288 Soc;
diff --git a/Documentation/devicetree/bindings/usb/dwc3-xilinx.txt b/Documentation/devicetree/bindings/usb/dwc3-xilinx.txt
new file mode 100644
index 000000000000..30361b32a460
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/dwc3-xilinx.txt
@@ -0,0 +1,33 @@
1Xilinx SuperSpeed DWC3 USB SoC controller
2
3Required properties:
4- compatible: Should contain "xlnx,zynqmp-dwc3"
5- clocks: A list of phandles for the clocks listed in clock-names
6- clock-names: Should contain the following:
7 "bus_clk" Master/Core clock, have to be >= 125 MHz for SS
8 operation and >= 60MHz for HS operation
9
10 "ref_clk" Clock source to core during PHY power down
11
12Required child node:
13A child node must exist to represent the core DWC3 IP block. The name of
14the node is not important. The content of the node is defined in dwc3.txt.
15
16Example device node:
17
18 usb@0 {
19 #address-cells = <0x2>;
20 #size-cells = <0x1>;
21 status = "okay";
22 compatible = "xlnx,zynqmp-dwc3";
23 clock-names = "bus_clk" "ref_clk";
24 clocks = <&clk125>, <&clk125>;
25 ranges;
26
27 dwc3@fe200000 {
28 compatible = "snps,dwc3";
29 reg = <0x0 0xfe200000 0x40000>;
30 interrupts = <0x0 0x41 0x4>;
31 dr_mode = "host";
32 };
33 };
diff --git a/Documentation/devicetree/bindings/usb/mt8173-xhci.txt b/Documentation/devicetree/bindings/usb/mt8173-xhci.txt
new file mode 100644
index 000000000000..b3a7ffa48852
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/mt8173-xhci.txt
@@ -0,0 +1,51 @@
1MT8173 xHCI
2
3The device node for Mediatek SOC USB3.0 host controller
4
5Required properties:
6 - compatible : should contain "mediatek,mt8173-xhci"
7 - reg : specifies physical base address and size of the registers,
8 the first one for MAC, the second for IPPC
9 - interrupts : interrupt used by the controller
10 - power-domains : a phandle to USB power domain node to control USB's
11 mtcmos
12 - vusb33-supply : regulator of USB avdd3.3v
13
14 - clocks : a list of phandle + clock-specifier pairs, one for each
15 entry in clock-names
16 - clock-names : must contain
17 "sys_ck": for clock of xHCI MAC
18 "wakeup_deb_p0": for USB wakeup debounce clock of port0
19 "wakeup_deb_p1": for USB wakeup debounce clock of port1
20
21 - phys : a list of phandle + phy specifier pairs
22
23Optional properties:
24 - mediatek,wakeup-src : 1: ip sleep wakeup mode; 2: line state wakeup
25 mode;
26 - mediatek,syscon-wakeup : phandle to syscon used to access USB wakeup
27 control register, it depends on "mediatek,wakeup-src".
28 - vbus-supply : reference to the VBUS regulator;
29 - usb3-lpm-capable : supports USB3.0 LPM
30
31Example:
32usb30: usb@11270000 {
33 compatible = "mediatek,mt8173-xhci";
34 reg = <0 0x11270000 0 0x1000>,
35 <0 0x11280700 0 0x0100>;
36 interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_LOW>;
37 power-domains = <&scpsys MT8173_POWER_DOMAIN_USB>;
38 clocks = <&topckgen CLK_TOP_USB30_SEL>,
39 <&pericfg CLK_PERI_USB0>,
40 <&pericfg CLK_PERI_USB1>;
41 clock-names = "sys_ck",
42 "wakeup_deb_p0",
43 "wakeup_deb_p1";
44 phys = <&phy_port0 PHY_TYPE_USB3>,
45 <&phy_port1 PHY_TYPE_USB2>;
46 vusb33-supply = <&mt6397_vusb_reg>;
47 vbus-supply = <&usb_p1_vbus>;
48 usb3-lpm-capable;
49 mediatek,syscon-wakeup = <&pericfg>;
50 mediatek,wakeup-src = <1>;
51};
diff --git a/Documentation/devicetree/bindings/usb/octeon-usb.txt b/Documentation/devicetree/bindings/usb/octeon-usb.txt
new file mode 100644
index 000000000000..205c8d24d6e3
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/octeon-usb.txt
@@ -0,0 +1,62 @@
1OCTEON/OCTEON+ USB BLOCK
2
31) Main node
4
5 Required properties:
6
7 - compatible: must be "cavium,octeon-5750-usbn"
8
9 - reg: specifies the physical base address of the USBN block and
10 the length of the memory mapped region.
11
12 - #address-cells: specifies the number of cells needed to encode an
13 address. The value must be 2.
14
15 - #size-cells: specifies the number of cells used to represent the size
16 of an address. The value must be 2.
17
18 - ranges: specifies the translation between child address space and parent
19 address space.
20
21 - clock-frequency: speed of the USB reference clock. Allowed values are
22 12000000, 24000000 or 48000000.
23
24 - cavium,refclk-type: type of the USB reference clock. Allowed values are
25 "crystal" or "external".
26
27 - refclk-frequency: deprecated, use "clock-frequency".
28
29 - refclk-type: deprecated, use "cavium,refclk-type".
30
312) Child node
32
33 The main node must have one child node which describes the built-in
34 USB controller.
35
36 Required properties:
37
38 - compatible: must be "cavium,octeon-5750-usbc"
39
40 - reg: specifies the physical base address of the USBC block and
41 the length of the memory mapped region.
42
43 - interrupts: specifies the interrupt number for the USB controller.
44
453) Example:
46
47 usbn: usbn@1180068000000 {
48 compatible = "cavium,octeon-5750-usbn";
49 reg = <0x11800 0x68000000 0x0 0x1000>;
50 ranges; /* Direct mapping */
51 #address-cells = <2>;
52 #size-cells = <2>;
53 clock-frequency = <12000000>;
54 cavium,refclk-type = "crystal";
55
56 usbc@16f0010000000 {
57 compatible = "cavium,octeon-5750-usbc";
58 reg = <0x16f00 0x10000000 0x0 0x80000>;
59 interrupts = <0 56>;
60 };
61 };
62
diff --git a/Documentation/devicetree/bindings/usb/renesas_usb3.txt b/Documentation/devicetree/bindings/usb/renesas_usb3.txt
new file mode 100644
index 000000000000..8d52766f07b9
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/renesas_usb3.txt
@@ -0,0 +1,23 @@
1Renesas Electronics USB3.0 Peripheral driver
2
3Required properties:
4 - compatible: Must contain one of the following:
5 - "renesas,r8a7795-usb3-peri"
6 - reg: Base address and length of the register for the USB3.0 Peripheral
7 - interrupts: Interrupt specifier for the USB3.0 Peripheral
8 - clocks: clock phandle and specifier pair
9
10Example:
11 usb3_peri0: usb@ee020000 {
12 compatible = "renesas,r8a7795-usb3-peri";
13 reg = <0 0xee020000 0 0x400>;
14 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>;
15 clocks = <&cpg CPG_MOD 328>;
16 };
17
18 usb3_peri1: usb@ee060000 {
19 compatible = "renesas,r8a7795-usb3-peri";
20 reg = <0 0xee060000 0 0x400>;
21 interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
22 clocks = <&cpg CPG_MOD 327>;
23 };
diff --git a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
index 7d48f63db44e..b6040563e51a 100644
--- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
+++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
@@ -1,11 +1,21 @@
1Renesas Electronics USBHS driver 1Renesas Electronics USBHS driver
2 2
3Required properties: 3Required properties:
4 - compatible: Must contain one of the following: 4 - compatible: Must contain one or more of the following:
5 - "renesas,usbhs-r8a7790" 5
6 - "renesas,usbhs-r8a7791" 6 - "renesas,usbhs-r8a7790" for r8a7790 (R-Car H2) compatible device
7 - "renesas,usbhs-r8a7794" 7 - "renesas,usbhs-r8a7791" for r8a7791 (R-Car M2-W) compatible device
8 - "renesas,usbhs-r8a7795" 8 - "renesas,usbhs-r8a7792" for r8a7792 (R-Car V2H) compatible device
9 - "renesas,usbhs-r8a7793" for r8a7793 (R-Car M2-N) compatible device
10 - "renesas,usbhs-r8a7794" for r8a7794 (R-Car E2) compatible device
11 - "renesas,usbhs-r8a7795" for r8a7795 (R-Car H3) compatible device
12 - "renesas,rcar-gen2-usbhs" for R-Car Gen2 compatible device
13 - "renesas,rcar-gen3-usbhs" for R-Car Gen3 compatible device
14
15 When compatible with the generic version, nodes must list the
16 SoC-specific version corresponding to the platform first followed
17 by the generic version.
18
9 - reg: Base address and length of the register for the USBHS 19 - reg: Base address and length of the register for the USBHS
10 - interrupts: Interrupt specifier for the USBHS 20 - interrupts: Interrupt specifier for the USBHS
11 - clocks: A list of phandle + clock specifier pairs 21 - clocks: A list of phandle + clock specifier pairs
@@ -22,7 +32,7 @@ Optional properties:
22 32
23Example: 33Example:
24 usbhs: usb@e6590000 { 34 usbhs: usb@e6590000 {
25 compatible = "renesas,usbhs-r8a7790"; 35 compatible = "renesas,usbhs-r8a7790", "renesas,rcar-gen2-usbhs";
26 reg = <0 0xe6590000 0 0x100>; 36 reg = <0 0xe6590000 0 0x100>;
27 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>; 37 interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
28 clocks = <&mstp7_clks R8A7790_CLK_HSUSB>; 38 clocks = <&mstp7_clks R8A7790_CLK_HSUSB>;
diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt b/Documentation/devicetree/bindings/usb/usb-xhci.txt
index 86f67f0886bc..082573289f1e 100644
--- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
@@ -3,8 +3,8 @@ USB xHCI controllers
3Required properties: 3Required properties:
4 - compatible: should be one of "generic-xhci", 4 - compatible: should be one of "generic-xhci",
5 "marvell,armada-375-xhci", "marvell,armada-380-xhci", 5 "marvell,armada-375-xhci", "marvell,armada-380-xhci",
6 "renesas,xhci-r8a7790", "renesas,xhci-r8a7791" (deprecated: 6 "renesas,xhci-r8a7790", "renesas,xhci-r8a7791", "renesas,xhci-r8a7793",
7 "xhci-platform"). 7 "renesas,xhci-r8a7795" (deprecated: "xhci-platform").
8 - reg: should contain address and length of the standard XHCI 8 - reg: should contain address and length of the standard XHCI
9 register set for the device. 9 register set for the device.
10 - interrupts: one XHCI interrupt should be described here. 10 - interrupts: one XHCI interrupt should be described here.
diff --git a/Documentation/devicetree/bindings/usb/usb3503.txt b/Documentation/devicetree/bindings/usb/usb3503.txt
index 52493b1480e2..c1a0a9191d26 100644
--- a/Documentation/devicetree/bindings/usb/usb3503.txt
+++ b/Documentation/devicetree/bindings/usb/usb3503.txt
@@ -18,7 +18,8 @@ Optional properties:
18- refclk: Clock used for driving REFCLK signal (optional, if not provided 18- refclk: Clock used for driving REFCLK signal (optional, if not provided
19 the driver assumes that clock signal is always available, its 19 the driver assumes that clock signal is always available, its
20 rate is specified by REF_SEL pins and a value from the primary 20 rate is specified by REF_SEL pins and a value from the primary
21 reference clock frequencies table is used) 21 reference clock frequencies table is used). Use clocks and
22 clock-names in order to assign it
22- refclk-frequency: Frequency of the REFCLK signal as defined by REF_SEL 23- refclk-frequency: Frequency of the REFCLK signal as defined by REF_SEL
23 pins (optional, if not provided, driver will not set rate of the 24 pins (optional, if not provided, driver will not set rate of the
24 REFCLK signal and assume that a value from the primary reference 25 REFCLK signal and assume that a value from the primary reference
@@ -33,4 +34,6 @@ Examples:
33 intn-gpios = <&gpx3 4 1>; 34 intn-gpios = <&gpx3 4 1>;
34 reset-gpios = <&gpx3 5 1>; 35 reset-gpios = <&gpx3 5 1>;
35 initial-mode = <1>; 36 initial-mode = <1>;
37 clocks = <&clks 80>;
38 clock-names = "refclk";
36 }; 39 };
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 55df1d444e9f..72e2c5a2b327 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -33,6 +33,7 @@ auo AU Optronics Corporation
33avago Avago Technologies 33avago Avago Technologies
34avic Shanghai AVIC Optoelectronics Co., Ltd. 34avic Shanghai AVIC Optoelectronics Co., Ltd.
35axis Axis Communications AB 35axis Axis Communications AB
36boe BOE Technology Group Co., Ltd.
36bosch Bosch Sensortec GmbH 37bosch Bosch Sensortec GmbH
37boundary Boundary Devices Inc. 38boundary Boundary Devices Inc.
38brcm Broadcom Corporation 39brcm Broadcom Corporation
@@ -123,6 +124,8 @@ jedec JEDEC Solid State Technology Association
123karo Ka-Ro electronics GmbH 124karo Ka-Ro electronics GmbH
124keymile Keymile GmbH 125keymile Keymile GmbH
125kinetic Kinetic Technologies 126kinetic Kinetic Technologies
127kosagi Sutajio Ko-Usagi PTE Ltd.
128kyo Kyocera Corporation
126lacie LaCie 129lacie LaCie
127lantiq Lantiq Semiconductor 130lantiq Lantiq Semiconductor
128lenovo Lenovo Group Ltd. 131lenovo Lenovo Group Ltd.
@@ -161,6 +164,7 @@ nuvoton Nuvoton Technology Corporation
161nvidia NVIDIA 164nvidia NVIDIA
162nxp NXP Semiconductors 165nxp NXP Semiconductors
163okaya Okaya Electric America, Inc. 166okaya Okaya Electric America, Inc.
167olimex OLIMEX Ltd.
164onnn ON Semiconductor Corp. 168onnn ON Semiconductor Corp.
165opencores OpenCores.org 169opencores OpenCores.org
166option Option NV 170option Option NV
@@ -180,6 +184,7 @@ qca Qualcomm Atheros, Inc.
180qcom Qualcomm Technologies, Inc 184qcom Qualcomm Technologies, Inc
181qemu QEMU, a generic and open source machine emulator and virtualizer 185qemu QEMU, a generic and open source machine emulator and virtualizer
182qi Qi Hardware 186qi Qi Hardware
187qiaodian QiaoDian XianShi Corporation
183qnap QNAP Systems, Inc. 188qnap QNAP Systems, Inc.
184radxa Radxa 189radxa Radxa
185raidsonic RaidSonic Technology GmbH 190raidsonic RaidSonic Technology GmbH
@@ -218,11 +223,13 @@ sony Sony Corporation
218spansion Spansion Inc. 223spansion Spansion Inc.
219sprd Spreadtrum Communications Inc. 224sprd Spreadtrum Communications Inc.
220st STMicroelectronics 225st STMicroelectronics
226startek Startek
221ste ST-Ericsson 227ste ST-Ericsson
222stericsson ST-Ericsson 228stericsson ST-Ericsson
223synology Synology, Inc. 229synology Synology, Inc.
224tbs TBS Technologies 230tbs TBS Technologies
225tcl Toby Churchill Ltd. 231tcl Toby Churchill Ltd.
232technologic Technologic Systems
226thine THine Electronics, Inc. 233thine THine Electronics, Inc.
227ti Texas Instruments 234ti Texas Instruments
228tlm Trusted Logic Mobility 235tlm Trusted Logic Mobility
@@ -238,6 +245,7 @@ v3 V3 Semiconductor
238variscite Variscite Ltd. 245variscite Variscite Ltd.
239via VIA Technologies, Inc. 246via VIA Technologies, Inc.
240virtio Virtual I/O Device Specification, developed by the OASIS consortium 247virtio Virtual I/O Device Specification, developed by the OASIS consortium
248vivante Vivante Corporation
241voipac Voipac Technologies s.r.o. 249voipac Voipac Technologies s.r.o.
242wexler Wexler 250wexler Wexler
243winbond Winbond Electronics corp. 251winbond Winbond Electronics corp.
diff --git a/Documentation/devicetree/bindings/watchdog/alphascale-asm9260.txt b/Documentation/devicetree/bindings/watchdog/alphascale-asm9260.txt
new file mode 100644
index 000000000000..75b265a04047
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/alphascale-asm9260.txt
@@ -0,0 +1,35 @@
1Alphascale asm9260 Watchdog timer
2
3Required properties:
4
5- compatible : should be "alphascale,asm9260-wdt".
6- reg : Specifies base physical address and size of the registers.
7- clocks : the clocks feeding the watchdog timer. See clock-bindings.txt
8- clock-names : should be set to
9 "mod" - source for tick counter.
10 "ahb" - ahb gate.
11- resets : phandle pointing to the system reset controller with
12 line index for the watchdog.
13- reset-names : should be set to "wdt_rst".
14
15Optional properties:
16- timeout-sec : shall contain the default watchdog timeout in seconds,
17 if unset, the default timeout is 30 seconds.
18- alphascale,mode : three modes are supported
19 "hw" - hw reset (default).
20 "sw" - sw reset.
21 "debug" - no action is taken.
22
23Example:
24
25watchdog0: watchdog@80048000 {
26 compatible = "alphascale,asm9260-wdt";
27 reg = <0x80048000 0x10>;
28 clocks = <&acc CLKID_SYS_WDT>, <&acc CLKID_AHB_WDT>;
29 clock-names = "mod", "ahb";
30 interrupts = <55>;
31 resets = <&rst WDT_RESET>;
32 reset-names = "wdt_rst";
33 timeout-sec = <30>;
34 alphascale,mode = "hw";
35};
diff --git a/Documentation/devicetree/bindings/watchdog/meson6-wdt.txt b/Documentation/devicetree/bindings/watchdog/meson-wdt.txt
index 9200fc2d508c..ae70185d96e6 100644
--- a/Documentation/devicetree/bindings/watchdog/meson6-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/meson-wdt.txt
@@ -2,7 +2,7 @@ Meson SoCs Watchdog timer
2 2
3Required properties: 3Required properties:
4 4
5- compatible : should be "amlogic,meson6-wdt" 5- compatible : should be "amlogic,meson6-wdt" or "amlogic,meson8b-wdt"
6- reg : Specifies base physical address and size of the registers. 6- reg : Specifies base physical address and size of the registers.
7 7
8Example: 8Example:
diff --git a/Documentation/devicetree/bindings/watchdog/mt7621-wdt.txt b/Documentation/devicetree/bindings/watchdog/mt7621-wdt.txt
new file mode 100644
index 000000000000..c15ef0ef609f
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/mt7621-wdt.txt
@@ -0,0 +1,12 @@
1Ralink Watchdog Timers
2
3Required properties:
4- compatible: must be "mediatek,mt7621-wdt"
5- reg: physical base address of the controller and length of the register range
6
7Example:
8
9 watchdog@100 {
10 compatible = "mediatek,mt7621-wdt";
11 reg = <0x100 0x10>;
12 };
diff --git a/Documentation/devicetree/bindings/watchdog/mtk-wdt.txt b/Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
index af9eb5b8a253..6a00939a059a 100644
--- a/Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/mtk-wdt.txt
@@ -2,7 +2,11 @@ Mediatek SoCs Watchdog timer
2 2
3Required properties: 3Required properties:
4 4
5- compatible : should be "mediatek,mt6589-wdt" 5- compatible should contain:
6 * "mediatek,mt2701-wdt" for MT2701 compatible watchdog timers
7 * "mediatek,mt6589-wdt" for all compatible watchdog timers (MT2701,
8 MT6589)
9
6- reg : Specifies base physical address and size of the registers. 10- reg : Specifies base physical address and size of the registers.
7 11
8Example: 12Example:
diff --git a/Documentation/devicetree/bindings/watchdog/sigma,smp8642-wdt.txt b/Documentation/devicetree/bindings/watchdog/sigma,smp8642-wdt.txt
new file mode 100644
index 000000000000..5b7ec2c707d8
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/sigma,smp8642-wdt.txt
@@ -0,0 +1,18 @@
1Sigma Designs SMP86xx/SMP87xx watchdog
2
3Required properties:
4- compatible: Should be "sigma,smp8642-wdt"
5- reg: Specifies the physical address region
6- clocks: Should be a phandle to the clock
7
8Optional properties:
9- timeout-sec: watchdog timeout in seconds
10
11Example:
12
13watchdog@1fd00 {
14 compatible = "sigma,smp8642-wdt";
15 reg = <0x1fd00 8>;
16 clocks = <&xtal_in_clk>;
17 timeout-sec = <30>;
18};
diff --git a/Documentation/devicetree/bindings/watchdog/sp805-wdt.txt b/Documentation/devicetree/bindings/watchdog/sp805-wdt.txt
new file mode 100644
index 000000000000..edc4f0ea54a3
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/sp805-wdt.txt
@@ -0,0 +1,31 @@
1* ARM SP805 Watchdog Timer (WDT) Controller
2
3SP805 WDT is a ARM Primecell Peripheral and has a standard-id register that
4can be used to identify the peripheral type, vendor, and revision.
5This value can be used for driver matching.
6
7As SP805 WDT is a primecell IP, it follows the base bindings specified in
8'arm/primecell.txt'
9
10Required properties:
11- compatible : Should be "arm,sp805-wdt", "arm,primecell"
12- reg : Base address and size of the watchdog timer registers.
13- clocks : From common clock binding.
14 First clock is PCLK and the second is WDOGCLK.
15 WDOGCLK can be equal to or be a sub-multiple of the PCLK frequency.
16- clock-names : From common clock binding.
17 Shall be "apb_pclk" for first clock and "wdog_clk" for the
18 second one.
19
20Optional properties:
21- interrupts : Should specify WDT interrupt number.
22
23Examples:
24
25 cluster1_core0_watchdog: wdt@c000000 {
26 compatible = "arm,sp805-wdt", "arm,primecell";
27 reg = <0x0 0xc000000 0x0 0x1000>;
28 clocks = <&clockgen 4 3>, <&clockgen 4 3>;
29 clock-names = "apb_pclk", "wdog_clk";
30 };
31
diff --git a/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt
new file mode 100644
index 000000000000..8f6caad4258d
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/ts4800-wdt.txt
@@ -0,0 +1,25 @@
1Technologic Systems Watchdog
2
3Required properties:
4- compatible: must be "technologic,ts4800-wdt"
5- syscon: phandle / integer array that points to the syscon node which
6 describes the FPGA's syscon registers.
7 - phandle to FPGA's syscon
8 - offset to the watchdog register
9
10Optional property:
11- timeout-sec: contains the watchdog timeout in seconds.
12
13Example:
14
15syscon: syscon@b0010000 {
16 compatible = "syscon", "simple-mfd";
17 reg = <0xb0010000 0x3d>;
18 reg-io-width = <2>;
19
20 wdt@e {
21 compatible = "technologic,ts4800-wdt";
22 syscon = <&syscon 0xe>;
23 timeout-sec = <10>;
24 };
25}
diff --git a/Documentation/devicetree/bindings/watchdog/ziirave-wdt.txt b/Documentation/devicetree/bindings/watchdog/ziirave-wdt.txt
new file mode 100644
index 000000000000..3d878184ec3f
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/ziirave-wdt.txt
@@ -0,0 +1,19 @@
1Zodiac RAVE Watchdog Timer
2
3Required properties:
4- compatible: must be "zii,rave-wdt"
5- reg: i2c slave address of device, usually 0x38
6
7Optional Properties:
8- timeout-sec: Watchdog timeout value in seconds.
9- reset-duration-ms: Duration of the pulse generated when the watchdog times
10 out. Value in milliseconds.
11
12Example:
13
14 watchdog@38 {
15 compatible = "zii,rave-wdt";
16 reg = <0x38>;
17 timeout-sec = <30>;
18 reset-duration-ms = <30>;
19 };
diff --git a/Documentation/dmaengine/client.txt b/Documentation/dmaengine/client.txt
index 11fb87ff6cd0..9e33189745f0 100644
--- a/Documentation/dmaengine/client.txt
+++ b/Documentation/dmaengine/client.txt
@@ -22,25 +22,14 @@ The slave DMA usage consists of following steps:
22 Channel allocation is slightly different in the slave DMA context, 22 Channel allocation is slightly different in the slave DMA context,
23 client drivers typically need a channel from a particular DMA 23 client drivers typically need a channel from a particular DMA
24 controller only and even in some cases a specific channel is desired. 24 controller only and even in some cases a specific channel is desired.
25 To request a channel dma_request_channel() API is used. 25 To request a channel dma_request_chan() API is used.
26 26
27 Interface: 27 Interface:
28 struct dma_chan *dma_request_channel(dma_cap_mask_t mask, 28 struct dma_chan *dma_request_chan(struct device *dev, const char *name);
29 dma_filter_fn filter_fn,
30 void *filter_param);
31 where dma_filter_fn is defined as:
32 typedef bool (*dma_filter_fn)(struct dma_chan *chan, void *filter_param);
33 29
34 The 'filter_fn' parameter is optional, but highly recommended for 30 Which will find and return the 'name' DMA channel associated with the 'dev'
35 slave and cyclic channels as they typically need to obtain a specific 31 device. The association is done via DT, ACPI or board file based
36 DMA channel. 32 dma_slave_map matching table.
37
38 When the optional 'filter_fn' parameter is NULL, dma_request_channel()
39 simply returns the first channel that satisfies the capability mask.
40
41 Otherwise, the 'filter_fn' routine will be called once for each free
42 channel which has a capability in 'mask'. 'filter_fn' is expected to
43 return 'true' when the desired DMA channel is found.
44 33
45 A channel allocated via this interface is exclusive to the caller, 34 A channel allocated via this interface is exclusive to the caller,
46 until dma_release_channel() is called. 35 until dma_release_channel() is called.
@@ -128,7 +117,7 @@ The slave DMA usage consists of following steps:
128 transaction. 117 transaction.
129 118
130 For cyclic DMA, a callback function may wish to terminate the 119 For cyclic DMA, a callback function may wish to terminate the
131 DMA via dmaengine_terminate_all(). 120 DMA via dmaengine_terminate_async().
132 121
133 Therefore, it is important that DMA engine drivers drop any 122 Therefore, it is important that DMA engine drivers drop any
134 locks before calling the callback function which may cause a 123 locks before calling the callback function which may cause a
@@ -166,12 +155,29 @@ The slave DMA usage consists of following steps:
166 155
167Further APIs: 156Further APIs:
168 157
1691. int dmaengine_terminate_all(struct dma_chan *chan) 1581. int dmaengine_terminate_sync(struct dma_chan *chan)
159 int dmaengine_terminate_async(struct dma_chan *chan)
160 int dmaengine_terminate_all(struct dma_chan *chan) /* DEPRECATED */
170 161
171 This causes all activity for the DMA channel to be stopped, and may 162 This causes all activity for the DMA channel to be stopped, and may
172 discard data in the DMA FIFO which hasn't been fully transferred. 163 discard data in the DMA FIFO which hasn't been fully transferred.
173 No callback functions will be called for any incomplete transfers. 164 No callback functions will be called for any incomplete transfers.
174 165
166 Two variants of this function are available.
167
168 dmaengine_terminate_async() might not wait until the DMA has been fully
169 stopped or until any running complete callbacks have finished. But it is
170 possible to call dmaengine_terminate_async() from atomic context or from
171 within a complete callback. dmaengine_synchronize() must be called before it
172 is safe to free the memory accessed by the DMA transfer or free resources
173 accessed from within the complete callback.
174
175 dmaengine_terminate_sync() will wait for the transfer and any running
176 complete callbacks to finish before it returns. But the function must not be
177 called from atomic context or from within a complete callback.
178
179 dmaengine_terminate_all() is deprecated and should not be used in new code.
180
1752. int dmaengine_pause(struct dma_chan *chan) 1812. int dmaengine_pause(struct dma_chan *chan)
176 182
177 This pauses activity on the DMA channel without data loss. 183 This pauses activity on the DMA channel without data loss.
@@ -197,3 +203,20 @@ Further APIs:
197 a running DMA channel. It is recommended that DMA engine users 203 a running DMA channel. It is recommended that DMA engine users
198 pause or stop (via dmaengine_terminate_all()) the channel before 204 pause or stop (via dmaengine_terminate_all()) the channel before
199 using this API. 205 using this API.
206
2075. void dmaengine_synchronize(struct dma_chan *chan)
208
209 Synchronize the termination of the DMA channel to the current context.
210
211 This function should be used after dmaengine_terminate_async() to synchronize
212 the termination of the DMA channel to the current context. The function will
213 wait for the transfer and any running complete callbacks to finish before it
214 returns.
215
216 If dmaengine_terminate_async() is used to stop the DMA channel this function
217 must be called before it is safe to free memory accessed by previously
218 submitted descriptors or to free any resources accessed within the complete
219 callback of previously submitted descriptors.
220
221 The behavior of this function is undefined if dma_async_issue_pending() has
222 been called between dmaengine_terminate_async() and this function.
diff --git a/Documentation/dmaengine/provider.txt b/Documentation/dmaengine/provider.txt
index 67d4ce4df109..122b7f4876bb 100644
--- a/Documentation/dmaengine/provider.txt
+++ b/Documentation/dmaengine/provider.txt
@@ -327,8 +327,24 @@ supported.
327 327
328 * device_terminate_all 328 * device_terminate_all
329 - Aborts all the pending and ongoing transfers on the channel 329 - Aborts all the pending and ongoing transfers on the channel
330 - This command should operate synchronously on the channel, 330 - For aborted transfers the complete callback should not be called
331 terminating right away all the channels 331 - Can be called from atomic context or from within a complete
332 callback of a descriptor. Must not sleep. Drivers must be able
333 to handle this correctly.
334 - Termination may be asynchronous. The driver does not have to
335 wait until the currently active transfer has completely stopped.
336 See device_synchronize.
337
338 * device_synchronize
339 - Must synchronize the termination of a channel to the current
340 context.
341 - Must make sure that memory for previously submitted
342 descriptors is no longer accessed by the DMA controller.
343 - Must make sure that all complete callbacks for previously
344 submitted descriptors have finished running and none are
345 scheduled to run.
346 - May sleep.
347
332 348
333Misc notes (stuff that should be documented, but don't really know 349Misc notes (stuff that should be documented, but don't really know
334where to put them) 350where to put them)
diff --git a/Documentation/dvb/README.dvb-usb b/Documentation/dvb/README.dvb-usb
index 8eb92264ee04..669dc6ce4330 100644
--- a/Documentation/dvb/README.dvb-usb
+++ b/Documentation/dvb/README.dvb-usb
@@ -45,7 +45,7 @@ Supported devices
45See the LinuxTV DVB Wiki at www.linuxtv.org for a complete list of 45See the LinuxTV DVB Wiki at www.linuxtv.org for a complete list of
46cards/drivers/firmwares: 46cards/drivers/firmwares:
47 47
48http://www.linuxtv.org/wiki/index.php/DVB_USB 48https://linuxtv.org/wiki/index.php/DVB_USB
49 49
500. History & News: 500. History & News:
51 2005-06-30 - added support for WideView WT-220U (Thanks to Steve Chang) 51 2005-06-30 - added support for WideView WT-220U (Thanks to Steve Chang)
@@ -121,7 +121,7 @@ working.
121Have a look at the Wikipage for the DVB-USB-drivers to find out, which firmware 121Have a look at the Wikipage for the DVB-USB-drivers to find out, which firmware
122you need for your device: 122you need for your device:
123 123
124http://www.linuxtv.org/wiki/index.php/DVB_USB 124https://linuxtv.org/wiki/index.php/DVB_USB
125 125
1261.2. Compiling 1261.2. Compiling
127 127
diff --git a/Documentation/dvb/faq.txt b/Documentation/dvb/faq.txt
index 97b1373f2428..a0be92012877 100644
--- a/Documentation/dvb/faq.txt
+++ b/Documentation/dvb/faq.txt
@@ -76,7 +76,7 @@ Some very frequently asked questions about linuxtv-dvb
76 the TuxBox CVS many interesting DVB applications and the dBox2 76 the TuxBox CVS many interesting DVB applications and the dBox2
77 DVB source 77 DVB source
78 78
79 http://www.linuxtv.org/downloads/ 79 https://linuxtv.org/downloads
80 DVB Swiss Army Knife library and utilities 80 DVB Swiss Army Knife library and utilities
81 81
82 http://www.nenie.org/misc/mpsys/ 82 http://www.nenie.org/misc/mpsys/
diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware
index 91b43d2738c7..1a0a04125f71 100755
--- a/Documentation/dvb/get_dvb_firmware
+++ b/Documentation/dvb/get_dvb_firmware
@@ -152,7 +152,7 @@ sub tda10046lifeview {
152 152
153sub av7110 { 153sub av7110 {
154 my $sourcefile = "dvb-ttpci-01.fw-261d"; 154 my $sourcefile = "dvb-ttpci-01.fw-261d";
155 my $url = "http://www.linuxtv.org/downloads/firmware/$sourcefile"; 155 my $url = "https://linuxtv.org/downloads/firmware/$sourcefile";
156 my $hash = "603431b6259715a8e88f376a53b64e2f"; 156 my $hash = "603431b6259715a8e88f376a53b64e2f";
157 my $outfile = "dvb-ttpci-01.fw"; 157 my $outfile = "dvb-ttpci-01.fw";
158 158
@@ -303,7 +303,7 @@ sub vp7049 {
303} 303}
304 304
305sub dibusb { 305sub dibusb {
306 my $url = "http://www.linuxtv.org/downloads/firmware/dvb-usb-dibusb-5.0.0.11.fw"; 306 my $url = "https://linuxtv.org/downloads/firmware/dvb-usb-dibusb-5.0.0.11.fw";
307 my $outfile = "dvb-dibusb-5.0.0.11.fw"; 307 my $outfile = "dvb-dibusb-5.0.0.11.fw";
308 my $hash = "fa490295a527360ca16dcdf3224ca243"; 308 my $hash = "fa490295a527360ca16dcdf3224ca243";
309 309
@@ -351,7 +351,7 @@ sub nxt2004 {
351 351
352sub or51211 { 352sub or51211 {
353 my $fwfile = "dvb-fe-or51211.fw"; 353 my $fwfile = "dvb-fe-or51211.fw";
354 my $url = "http://linuxtv.org/downloads/firmware/$fwfile"; 354 my $url = "https://linuxtv.org/downloads/firmware/$fwfile";
355 my $hash = "d830949c771a289505bf9eafc225d491"; 355 my $hash = "d830949c771a289505bf9eafc225d491";
356 356
357 checkstandard(); 357 checkstandard();
@@ -364,7 +364,7 @@ sub or51211 {
364 364
365sub cx231xx { 365sub cx231xx {
366 my $fwfile = "v4l-cx231xx-avcore-01.fw"; 366 my $fwfile = "v4l-cx231xx-avcore-01.fw";
367 my $url = "http://linuxtv.org/downloads/firmware/$fwfile"; 367 my $url = "https://linuxtv.org/downloads/firmware/$fwfile";
368 my $hash = "7d3bb956dc9df0eafded2b56ba57cc42"; 368 my $hash = "7d3bb956dc9df0eafded2b56ba57cc42";
369 369
370 checkstandard(); 370 checkstandard();
@@ -376,7 +376,7 @@ sub cx231xx {
376} 376}
377 377
378sub cx18 { 378sub cx18 {
379 my $url = "http://linuxtv.org/downloads/firmware/"; 379 my $url = "https://linuxtv.org/downloads/firmware/";
380 380
381 my %files = ( 381 my %files = (
382 'v4l-cx23418-apu.fw' => '588f081b562f5c653a3db1ad8f65939a', 382 'v4l-cx23418-apu.fw' => '588f081b562f5c653a3db1ad8f65939a',
@@ -450,7 +450,7 @@ sub mpc718 {
450} 450}
451 451
452sub cx23885 { 452sub cx23885 {
453 my $url = "http://linuxtv.org/downloads/firmware/"; 453 my $url = "https://linuxtv.org/downloads/firmware/";
454 454
455 my %files = ( 455 my %files = (
456 'v4l-cx23885-avcore-01.fw' => 'a9f8f5d901a7fb42f552e1ee6384f3bb', 456 'v4l-cx23885-avcore-01.fw' => 'a9f8f5d901a7fb42f552e1ee6384f3bb',
@@ -472,7 +472,7 @@ sub cx23885 {
472} 472}
473 473
474sub pvrusb2 { 474sub pvrusb2 {
475 my $url = "http://linuxtv.org/downloads/firmware/"; 475 my $url = "https://linuxtv.org/downloads/firmware/";
476 476
477 my %files = ( 477 my %files = (
478 'v4l-cx25840.fw' => 'dadb79e9904fc8af96e8111d9cb59320', 478 'v4l-cx25840.fw' => 'dadb79e9904fc8af96e8111d9cb59320',
@@ -494,7 +494,7 @@ sub pvrusb2 {
494 494
495sub or51132_qam { 495sub or51132_qam {
496 my $fwfile = "dvb-fe-or51132-qam.fw"; 496 my $fwfile = "dvb-fe-or51132-qam.fw";
497 my $url = "http://linuxtv.org/downloads/firmware/$fwfile"; 497 my $url = "https://linuxtv.org/downloads/firmware/$fwfile";
498 my $hash = "7702e8938612de46ccadfe9b413cb3b5"; 498 my $hash = "7702e8938612de46ccadfe9b413cb3b5";
499 499
500 checkstandard(); 500 checkstandard();
@@ -507,7 +507,7 @@ sub or51132_qam {
507 507
508sub or51132_vsb { 508sub or51132_vsb {
509 my $fwfile = "dvb-fe-or51132-vsb.fw"; 509 my $fwfile = "dvb-fe-or51132-vsb.fw";
510 my $url = "http://linuxtv.org/downloads/firmware/$fwfile"; 510 my $url = "https://linuxtv.org/downloads/firmware/$fwfile";
511 my $hash = "c16208e02f36fc439a557ad4c613364a"; 511 my $hash = "c16208e02f36fc439a557ad4c613364a";
512 512
513 checkstandard(); 513 checkstandard();
@@ -519,7 +519,7 @@ sub or51132_vsb {
519} 519}
520 520
521sub bluebird { 521sub bluebird {
522 my $url = "http://www.linuxtv.org/download/dvb/firmware/dvb-usb-bluebird-01.fw"; 522 my $url = "https://linuxtv.org/download/dvb/firmware/dvb-usb-bluebird-01.fw";
523 my $outfile = "dvb-usb-bluebird-01.fw"; 523 my $outfile = "dvb-usb-bluebird-01.fw";
524 my $hash = "658397cb9eba9101af9031302671f49d"; 524 my $hash = "658397cb9eba9101af9031302671f49d";
525 525
@@ -677,7 +677,7 @@ sub drxk_hauppauge_hvr930c {
677} 677}
678 678
679sub drxk_terratec_h5 { 679sub drxk_terratec_h5 {
680 my $url = "http://www.linuxtv.org/downloads/firmware/"; 680 my $url = "https://linuxtv.org/downloads/firmware/";
681 my $hash = "19000dada8e2741162ccc50cc91fa7f1"; 681 my $hash = "19000dada8e2741162ccc50cc91fa7f1";
682 my $fwfile = "dvb-usb-terratec-h5-drxk.fw"; 682 my $fwfile = "dvb-usb-terratec-h5-drxk.fw";
683 683
diff --git a/Documentation/dvb/readme.txt b/Documentation/dvb/readme.txt
index 0b0380c91990..89965041a266 100644
--- a/Documentation/dvb/readme.txt
+++ b/Documentation/dvb/readme.txt
@@ -2,12 +2,12 @@ Linux Digital Video Broadcast (DVB) subsystem
2============================================= 2=============================================
3 3
4The main development site and CVS repository for these 4The main development site and CVS repository for these
5drivers is http://linuxtv.org/. 5drivers is https://linuxtv.org.
6 6
7The developer mailing list linux-dvb is also hosted there, 7The developer mailing list linux-dvb is also hosted there,
8see http://linuxtv.org/lists.php. Please check 8see https://linuxtv.org/lists.php. Please check
9the archive http://linuxtv.org/pipermail/linux-dvb/ 9the archive https://linuxtv.org/pipermail/linux-dvb/
10and the Wiki http://linuxtv.org/wiki/ 10and the Wiki https://linuxtv.org/wiki/
11before asking newbie questions on the list. 11before asking newbie questions on the list.
12 12
13API documentation, utilities and test/example programs 13API documentation, utilities and test/example programs
@@ -16,7 +16,7 @@ are available as part of the old driver package for Linux 2.4
16We plan to split this into separate packages, but it's not 16We plan to split this into separate packages, but it's not
17been done yet. 17been done yet.
18 18
19http://linuxtv.org/downloads/ 19https://linuxtv.org/downloads/
20 20
21What's inside this directory: 21What's inside this directory:
22 22
diff --git a/Documentation/edac.txt b/Documentation/edac.txt
index 80841a2d640c..f89cfd85ae13 100644
--- a/Documentation/edac.txt
+++ b/Documentation/edac.txt
@@ -1,9 +1,13 @@
1EDAC - Error Detection And Correction 1EDAC - Error Detection And Correction
2===================================== 2=====================================
3 3
4"bluesmoke" was the name for this device driver when it was "out-of-tree" 4"bluesmoke" was the name for this device driver when it
5and maintained at sourceforge.net. When it was pushed into 2.6.16 for the 5was "out-of-tree" and maintained at sourceforge.net -
6first time, it was renamed to 'EDAC'. 6bluesmoke.sourceforge.net. That site is mostly archaic now and can be
7used only for historical purposes.
8
9When the subsystem was pushed into 2.6.16 for the first time, it was
10renamed to 'EDAC'.
7 11
8PURPOSE 12PURPOSE
9------- 13-------
diff --git a/Documentation/fault-injection/notifier-error-inject.txt b/Documentation/fault-injection/notifier-error-inject.txt
index 09adabef513f..83d3f4e43e91 100644
--- a/Documentation/fault-injection/notifier-error-inject.txt
+++ b/Documentation/fault-injection/notifier-error-inject.txt
@@ -10,6 +10,7 @@ modules that can be used to test the following notifiers.
10 * PM notifier 10 * PM notifier
11 * Memory hotplug notifier 11 * Memory hotplug notifier
12 * powerpc pSeries reconfig notifier 12 * powerpc pSeries reconfig notifier
13 * Netdevice notifier
13 14
14CPU notifier error injection module 15CPU notifier error injection module
15----------------------------------- 16-----------------------------------
@@ -87,6 +88,30 @@ Possible pSeries reconfig notifier events to be failed are:
87 * PSERIES_DRCONF_MEM_ADD 88 * PSERIES_DRCONF_MEM_ADD
88 * PSERIES_DRCONF_MEM_REMOVE 89 * PSERIES_DRCONF_MEM_REMOVE
89 90
91Netdevice notifier error injection module
92----------------------------------------------
93This feature is controlled through debugfs interface
94/sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error
95
96Netdevice notifier events which can be failed are:
97
98 * NETDEV_REGISTER
99 * NETDEV_CHANGEMTU
100 * NETDEV_CHANGENAME
101 * NETDEV_PRE_UP
102 * NETDEV_PRE_TYPE_CHANGE
103 * NETDEV_POST_INIT
104 * NETDEV_PRECHANGEMTU
105 * NETDEV_PRECHANGEUPPER
106 * NETDEV_CHANGEUPPER
107
108Example: Inject netdevice mtu change error (-22 == -EINVAL)
109
110 # cd /sys/kernel/debug/notifier-error-inject/netdev
111 # echo -22 > actions/NETDEV_CHANGEMTU/error
112 # ip link set eth0 mtu 1024
113 RTNETLINK answers: Invalid argument
114
90For more usage examples 115For more usage examples
91----------------------- 116-----------------------
92There are tools/testing/selftests using the notifier error injection features 117There are tools/testing/selftests using the notifier error injection features
diff --git a/Documentation/features/io/dma_map_attrs/arch-support.txt b/Documentation/features/io/dma_map_attrs/arch-support.txt
deleted file mode 100644
index 51d0f1c02a3e..000000000000
--- a/Documentation/features/io/dma_map_attrs/arch-support.txt
+++ /dev/null
@@ -1,40 +0,0 @@
1#
2# Feature name: dma_map_attrs
3# Kconfig: HAVE_DMA_ATTRS
4# description: arch provides dma_*map*_attrs() APIs
5#
6 -----------------------
7 | arch |status|
8 -----------------------
9 | alpha: | ok |
10 | arc: | TODO |
11 | arm: | ok |
12 | arm64: | ok |
13 | avr32: | TODO |
14 | blackfin: | TODO |
15 | c6x: | TODO |
16 | cris: | TODO |
17 | frv: | TODO |
18 | h8300: | ok |
19 | hexagon: | ok |
20 | ia64: | ok |
21 | m32r: | TODO |
22 | m68k: | TODO |
23 | metag: | TODO |
24 | microblaze: | ok |
25 | mips: | ok |
26 | mn10300: | TODO |
27 | nios2: | TODO |
28 | openrisc: | ok |
29 | parisc: | TODO |
30 | powerpc: | ok |
31 | s390: | ok |
32 | score: | TODO |
33 | sh: | ok |
34 | sparc: | ok |
35 | tile: | ok |
36 | um: | TODO |
37 | unicore32: | ok |
38 | x86: | ok |
39 | xtensa: | TODO |
40 -----------------------
diff --git a/Documentation/features/seccomp/seccomp-filter/arch-support.txt b/Documentation/features/seccomp/seccomp-filter/arch-support.txt
index 76d39d66a5d7..4f66ec133951 100644
--- a/Documentation/features/seccomp/seccomp-filter/arch-support.txt
+++ b/Documentation/features/seccomp/seccomp-filter/arch-support.txt
@@ -33,7 +33,7 @@
33 | sh: | TODO | 33 | sh: | TODO |
34 | sparc: | TODO | 34 | sparc: | TODO |
35 | tile: | ok | 35 | tile: | ok |
36 | um: | TODO | 36 | um: | ok |
37 | unicore32: | TODO | 37 | unicore32: | TODO |
38 | x86: | ok | 38 | x86: | ok |
39 | xtensa: | TODO | 39 | xtensa: | TODO |
diff --git a/Documentation/features/time/irq-time-acct/arch-support.txt b/Documentation/features/time/irq-time-acct/arch-support.txt
index e63316239938..4199ffecc0ff 100644
--- a/Documentation/features/time/irq-time-acct/arch-support.txt
+++ b/Documentation/features/time/irq-time-acct/arch-support.txt
@@ -9,7 +9,7 @@
9 | alpha: | .. | 9 | alpha: | .. |
10 | arc: | TODO | 10 | arc: | TODO |
11 | arm: | ok | 11 | arm: | ok |
12 | arm64: | .. | 12 | arm64: | ok |
13 | avr32: | TODO | 13 | avr32: | TODO |
14 | blackfin: | TODO | 14 | blackfin: | TODO |
15 | c6x: | TODO | 15 | c6x: | TODO |
diff --git a/Documentation/features/vm/pmdp_splitting_flush/arch-support.txt b/Documentation/features/vm/pmdp_splitting_flush/arch-support.txt
deleted file mode 100644
index 26f74b457e0b..000000000000
--- a/Documentation/features/vm/pmdp_splitting_flush/arch-support.txt
+++ /dev/null
@@ -1,40 +0,0 @@
1#
2# Feature name: pmdp_splitting_flush
3# Kconfig: __HAVE_ARCH_PMDP_SPLITTING_FLUSH
4# description: arch supports the pmdp_splitting_flush() VM API
5#
6 -----------------------
7 | arch |status|
8 -----------------------
9 | alpha: | TODO |
10 | arc: | TODO |
11 | arm: | ok |
12 | arm64: | ok |
13 | avr32: | TODO |
14 | blackfin: | TODO |
15 | c6x: | TODO |
16 | cris: | TODO |
17 | frv: | TODO |
18 | h8300: | TODO |
19 | hexagon: | TODO |
20 | ia64: | TODO |
21 | m32r: | TODO |
22 | m68k: | TODO |
23 | metag: | TODO |
24 | microblaze: | TODO |
25 | mips: | ok |
26 | mn10300: | TODO |
27 | nios2: | TODO |
28 | openrisc: | TODO |
29 | parisc: | TODO |
30 | powerpc: | ok |
31 | s390: | ok |
32 | score: | TODO |
33 | sh: | TODO |
34 | sparc: | TODO |
35 | tile: | TODO |
36 | um: | TODO |
37 | unicore32: | TODO |
38 | x86: | ok |
39 | xtensa: | TODO |
40 -----------------------
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 06d443450f21..619af9bfdcb3 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -50,8 +50,7 @@ prototypes:
50 int (*rename2) (struct inode *, struct dentry *, 50 int (*rename2) (struct inode *, struct dentry *,
51 struct inode *, struct dentry *, unsigned int); 51 struct inode *, struct dentry *, unsigned int);
52 int (*readlink) (struct dentry *, char __user *,int); 52 int (*readlink) (struct dentry *, char __user *,int);
53 const char *(*follow_link) (struct dentry *, void **); 53 const char *(*get_link) (struct dentry *, struct inode *, void **);
54 void (*put_link) (struct inode *, void *);
55 void (*truncate) (struct inode *); 54 void (*truncate) (struct inode *);
56 int (*permission) (struct inode *, int, unsigned int); 55 int (*permission) (struct inode *, int, unsigned int);
57 int (*get_acl)(struct inode *, int); 56 int (*get_acl)(struct inode *, int);
@@ -83,8 +82,7 @@ rmdir: yes (both) (see below)
83rename: yes (all) (see below) 82rename: yes (all) (see below)
84rename2: yes (all) (see below) 83rename2: yes (all) (see below)
85readlink: no 84readlink: no
86follow_link: no 85get_link: no
87put_link: no
88setattr: yes 86setattr: yes
89permission: no (may not block if called in rcu-walk mode) 87permission: no (may not block if called in rcu-walk mode)
90get_acl: no 88get_acl: no
diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt
index af68efdbbfad..e5fe521eea1d 100644
--- a/Documentation/filesystems/configfs/configfs.txt
+++ b/Documentation/filesystems/configfs/configfs.txt
@@ -51,15 +51,27 @@ configfs tree is always there, whether mounted on /config or not.
51An item is created via mkdir(2). The item's attributes will also 51An item is created via mkdir(2). The item's attributes will also
52appear at this time. readdir(3) can determine what the attributes are, 52appear at this time. readdir(3) can determine what the attributes are,
53read(2) can query their default values, and write(2) can store new 53read(2) can query their default values, and write(2) can store new
54values. Like sysfs, attributes should be ASCII text files, preferably 54values. Don't mix more than one attribute in one attribute file.
55with only one value per file. The same efficiency caveats from sysfs 55
56apply. Don't mix more than one attribute in one attribute file. 56There are two types of configfs attributes:
57 57
58Like sysfs, configfs expects write(2) to store the entire buffer at 58* Normal attributes, which similar to sysfs attributes, are small ASCII text
59once. When writing to configfs attributes, userspace processes should 59files, with a maximum size of one page (PAGE_SIZE, 4096 on i386). Preferably
60first read the entire file, modify the portions they wish to change, and 60only one value per file should be used, and the same caveats from sysfs apply.
61then write the entire buffer back. Attribute files have a maximum size 61Configfs expects write(2) to store the entire buffer at once. When writing to
62of one page (PAGE_SIZE, 4096 on i386). 62normal configfs attributes, userspace processes should first read the entire
63file, modify the portions they wish to change, and then write the entire
64buffer back.
65
66* Binary attributes, which are somewhat similar to sysfs binary attributes,
67but with a few slight changes to semantics. The PAGE_SIZE limitation does not
68apply, but the whole binary item must fit in single kernel vmalloc'ed buffer.
69The write(2) calls from user space are buffered, and the attributes'
70write_bin_attribute method will be invoked on the final close, therefore it is
71imperative for user-space to check the return code of close(2) in order to
72verify that the operation finished successfully.
73To avoid a malicious user OOMing the kernel, there's a per-binary attribute
74maximum buffer value.
63 75
64When an item needs to be destroyed, remove it with rmdir(2). An 76When an item needs to be destroyed, remove it with rmdir(2). An
65item cannot be destroyed if any other item has a link to it (via 77item cannot be destroyed if any other item has a link to it (via
@@ -171,6 +183,7 @@ among other things. For that, it needs a type.
171 struct configfs_item_operations *ct_item_ops; 183 struct configfs_item_operations *ct_item_ops;
172 struct configfs_group_operations *ct_group_ops; 184 struct configfs_group_operations *ct_group_ops;
173 struct configfs_attribute **ct_attrs; 185 struct configfs_attribute **ct_attrs;
186 struct configfs_bin_attribute **ct_bin_attrs;
174 }; 187 };
175 188
176The most basic function of a config_item_type is to define what 189The most basic function of a config_item_type is to define what
@@ -201,6 +214,32 @@ be called whenever userspace asks for a read(2) on the attribute. If an
201attribute is writable and provides a ->store method, that method will be 214attribute is writable and provides a ->store method, that method will be
202be called whenever userspace asks for a write(2) on the attribute. 215be called whenever userspace asks for a write(2) on the attribute.
203 216
217[struct configfs_bin_attribute]
218
219 struct configfs_attribute {
220 struct configfs_attribute cb_attr;
221 void *cb_private;
222 size_t cb_max_size;
223 };
224
225The binary attribute is used when the one needs to use binary blob to
226appear as the contents of a file in the item's configfs directory.
227To do so add the binary attribute to the NULL-terminated array
228config_item_type->ct_bin_attrs, and the item appears in configfs, the
229attribute file will appear with the configfs_bin_attribute->cb_attr.ca_name
230filename. configfs_bin_attribute->cb_attr.ca_mode specifies the file
231permissions.
232The cb_private member is provided for use by the driver, while the
233cb_max_size member specifies the maximum amount of vmalloc buffer
234to be used.
235
236If binary attribute is readable and the config_item provides a
237ct_item_ops->read_bin_attribute() method, that method will be called
238whenever userspace asks for a read(2) on the attribute. The converse
239will happen for write(2). The reads/writes are bufferred so only a
240single read/write will occur; the attributes' need not concern itself
241with it.
242
204[struct config_group] 243[struct config_group]
205 244
206A config_item cannot live in a vacuum. The only way one can be created 245A config_item cannot live in a vacuum. The only way one can be created
diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt
index b102b436563e..e1c9f0849da6 100644
--- a/Documentation/filesystems/f2fs.txt
+++ b/Documentation/filesystems/f2fs.txt
@@ -102,7 +102,7 @@ background_gc=%s Turn on/off cleaning operations, namely garbage
102 collection, triggered in background when I/O subsystem is 102 collection, triggered in background when I/O subsystem is
103 idle. If background_gc=on, it will turn on the garbage 103 idle. If background_gc=on, it will turn on the garbage
104 collection and if background_gc=off, garbage collection 104 collection and if background_gc=off, garbage collection
105 will be truned off. If background_gc=sync, it will turn 105 will be turned off. If background_gc=sync, it will turn
106 on synchronous garbage collection running in background. 106 on synchronous garbage collection running in background.
107 Default value for this option is on. So garbage 107 Default value for this option is on. So garbage
108 collection is on by default. 108 collection is on by default.
@@ -145,10 +145,12 @@ extent_cache Enable an extent cache based on rb-tree, it can cache
145 as many as extent which map between contiguous logical 145 as many as extent which map between contiguous logical
146 address and physical address per inode, resulting in 146 address and physical address per inode, resulting in
147 increasing the cache hit ratio. Set by default. 147 increasing the cache hit ratio. Set by default.
148noextent_cache Diable an extent cache based on rb-tree explicitly, see 148noextent_cache Disable an extent cache based on rb-tree explicitly, see
149 the above extent_cache mount option. 149 the above extent_cache mount option.
150noinline_data Disable the inline data feature, inline data feature is 150noinline_data Disable the inline data feature, inline data feature is
151 enabled by default. 151 enabled by default.
152data_flush Enable data flushing before checkpoint in order to
153 persist data of regular and symlink.
152 154
153================================================================================ 155================================================================================
154DEBUGFS ENTRIES 156DEBUGFS ENTRIES
@@ -192,7 +194,7 @@ Files in /sys/fs/f2fs/<devname>
192 policy for garbage collection. Setting gc_idle = 0 194 policy for garbage collection. Setting gc_idle = 0
193 (default) will disable this option. Setting 195 (default) will disable this option. Setting
194 gc_idle = 1 will select the Cost Benefit approach 196 gc_idle = 1 will select the Cost Benefit approach
195 & setting gc_idle = 2 will select the greedy aproach. 197 & setting gc_idle = 2 will select the greedy approach.
196 198
197 reclaim_segments This parameter controls the number of prefree 199 reclaim_segments This parameter controls the number of prefree
198 segments to be reclaimed. If the number of prefree 200 segments to be reclaimed. If the number of prefree
@@ -298,7 +300,7 @@ The dump.f2fs shows the information of specific inode and dumps SSA and SIT to
298file. Each file is dump_ssa and dump_sit. 300file. Each file is dump_ssa and dump_sit.
299 301
300The dump.f2fs is used to debug on-disk data structures of the f2fs filesystem. 302The dump.f2fs is used to debug on-disk data structures of the f2fs filesystem.
301It shows on-disk inode information reconized by a given inode number, and is 303It shows on-disk inode information recognized by a given inode number, and is
302able to dump all the SSA and SIT entries into predefined files, ./dump_ssa and 304able to dump all the SSA and SIT entries into predefined files, ./dump_ssa and
303./dump_sit respectively. 305./dump_sit respectively.
304 306
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index f24d1b833957..f1b87d8aa2da 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -504,3 +504,24 @@ in your dentry operations instead.
504[mandatory] 504[mandatory]
505 __fd_install() & fd_install() can now sleep. Callers should not 505 __fd_install() & fd_install() can now sleep. Callers should not
506 hold a spinlock or other resources that do not allow a schedule. 506 hold a spinlock or other resources that do not allow a schedule.
507--
508[mandatory]
509 any symlink that might use page_follow_link_light/page_put_link() must
510 have inode_nohighmem(inode) called before anything might start playing with
511 its pagecache. No highmem pages should end up in the pagecache of such
512 symlinks. That includes any preseeding that might be done during symlink
513 creation. __page_symlink() will honour the mapping gfp flags, so once
514 you've done inode_nohighmem() it's safe to use, but if you allocate and
515 insert the page manually, make sure to use the right gfp flags.
516--
517[mandatory]
518 ->follow_link() is replaced with ->get_link(); same API, except that
519 * ->get_link() gets inode as a separate argument
520 * ->get_link() may be called in RCU mode - in that case NULL
521 dentry is passed
522--
523[mandatory]
524 ->get_link() gets struct delayed_call *done now, and should do
525 set_delayed_call() where it used to set *cookie.
526 ->put_link() is gone - just give the destructor to set_delayed_call()
527 in ->get_link().
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index 402ab99e409f..fde9fd06fa98 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -169,6 +169,9 @@ read the file /proc/PID/status:
169 VmLck: 0 kB 169 VmLck: 0 kB
170 VmHWM: 476 kB 170 VmHWM: 476 kB
171 VmRSS: 476 kB 171 VmRSS: 476 kB
172 RssAnon: 352 kB
173 RssFile: 120 kB
174 RssShmem: 4 kB
172 VmData: 156 kB 175 VmData: 156 kB
173 VmStk: 88 kB 176 VmStk: 88 kB
174 VmExe: 68 kB 177 VmExe: 68 kB
@@ -231,14 +234,20 @@ Table 1-2: Contents of the status files (as of 4.1)
231 VmSize total program size 234 VmSize total program size
232 VmLck locked memory size 235 VmLck locked memory size
233 VmHWM peak resident set size ("high water mark") 236 VmHWM peak resident set size ("high water mark")
234 VmRSS size of memory portions 237 VmRSS size of memory portions. It contains the three
238 following parts (VmRSS = RssAnon + RssFile + RssShmem)
239 RssAnon size of resident anonymous memory
240 RssFile size of resident file mappings
241 RssShmem size of resident shmem memory (includes SysV shm,
242 mapping of tmpfs and shared anonymous mappings)
235 VmData size of data, stack, and text segments 243 VmData size of data, stack, and text segments
236 VmStk size of data, stack, and text segments 244 VmStk size of data, stack, and text segments
237 VmExe size of text segment 245 VmExe size of text segment
238 VmLib size of shared library code 246 VmLib size of shared library code
239 VmPTE size of page table entries 247 VmPTE size of page table entries
240 VmPMD size of second level page tables 248 VmPMD size of second level page tables
241 VmSwap size of swap usage (the number of referred swapents) 249 VmSwap amount of swap used by anonymous private data
250 (shmem swap usage is not included)
242 HugetlbPages size of hugetlb memory portions 251 HugetlbPages size of hugetlb memory portions
243 Threads number of threads 252 Threads number of threads
244 SigQ number of signals queued/max. number for queue 253 SigQ number of signals queued/max. number for queue
@@ -265,7 +274,8 @@ Table 1-3: Contents of the statm files (as of 2.6.8-rc3)
265 Field Content 274 Field Content
266 size total program size (pages) (same as VmSize in status) 275 size total program size (pages) (same as VmSize in status)
267 resident size of memory portions (pages) (same as VmRSS in status) 276 resident size of memory portions (pages) (same as VmRSS in status)
268 shared number of pages that are shared (i.e. backed by a file) 277 shared number of pages that are shared (i.e. backed by a file, same
278 as RssFile+RssShmem in status)
269 trs number of pages that are 'code' (not including libs; broken, 279 trs number of pages that are 'code' (not including libs; broken,
270 includes data segment) 280 includes data segment)
271 lrs number of pages of library (always 0 on 2.6) 281 lrs number of pages of library (always 0 on 2.6)
@@ -459,7 +469,10 @@ and a page is modified, the file page is replaced by a private anonymous copy.
459hugetlbfs page which is *not* counted in "RSS" or "PSS" field for historical 469hugetlbfs page which is *not* counted in "RSS" or "PSS" field for historical
460reasons. And these are not included in {Shared,Private}_{Clean,Dirty} field. 470reasons. And these are not included in {Shared,Private}_{Clean,Dirty} field.
461"Swap" shows how much would-be-anonymous memory is also used, but out on swap. 471"Swap" shows how much would-be-anonymous memory is also used, but out on swap.
462"SwapPss" shows proportional swap share of this mapping. 472For shmem mappings, "Swap" includes also the size of the mapped (and not
473replaced by copy-on-write) part of the underlying shmem object out on swap.
474"SwapPss" shows proportional swap share of this mapping. Unlike "Swap", this
475does not take into account swapped out page of underlying shmem objects.
463"Locked" indicates whether the mapping is locked in memory or not. 476"Locked" indicates whether the mapping is locked in memory or not.
464 477
465"VmFlags" field deserves a separate description. This member represents the kernel 478"VmFlags" field deserves a separate description. This member represents the kernel
@@ -807,7 +820,7 @@ by migrate-type and finishes with details on how many page blocks of each
807type exist. 820type exist.
808 821
809If min_free_kbytes has been tuned correctly (recommendations made by hugeadm 822If min_free_kbytes has been tuned correctly (recommendations made by hugeadm
810from libhugetlbfs http://sourceforge.net/projects/libhugetlbfs/), one can 823from libhugetlbfs https://github.com/libhugetlbfs/libhugetlbfs/), one can
811make an estimate of the likely number of huge pages that can be allocated 824make an estimate of the likely number of huge pages that can be allocated
812at a given point in time. All the "Movable" blocks should be allocatable 825at a given point in time. All the "Movable" blocks should be allocatable
813unless memory has been mlock()'d. Some of the Reclaimable blocks should 826unless memory has been mlock()'d. Some of the Reclaimable blocks should
@@ -842,6 +855,7 @@ Dirty: 968 kB
842Writeback: 0 kB 855Writeback: 0 kB
843AnonPages: 861800 kB 856AnonPages: 861800 kB
844Mapped: 280372 kB 857Mapped: 280372 kB
858Shmem: 644 kB
845Slab: 284364 kB 859Slab: 284364 kB
846SReclaimable: 159856 kB 860SReclaimable: 159856 kB
847SUnreclaim: 124508 kB 861SUnreclaim: 124508 kB
@@ -898,6 +912,7 @@ MemAvailable: An estimate of how much memory is available for starting new
898 AnonPages: Non-file backed pages mapped into userspace page tables 912 AnonPages: Non-file backed pages mapped into userspace page tables
899AnonHugePages: Non-file backed huge pages mapped into userspace page tables 913AnonHugePages: Non-file backed huge pages mapped into userspace page tables
900 Mapped: files which have been mmaped, such as libraries 914 Mapped: files which have been mmaped, such as libraries
915 Shmem: Total memory used by shared memory (shmem) and tmpfs
901 Slab: in-kernel data structures cache 916 Slab: in-kernel data structures cache
902SReclaimable: Part of Slab, that might be reclaimed, such as caches 917SReclaimable: Part of Slab, that might be reclaimed, such as caches
903 SUnreclaim: Part of Slab, that cannot be reclaimed on memory pressure 918 SUnreclaim: Part of Slab, that cannot be reclaimed on memory pressure
diff --git a/Documentation/filesystems/sharedsubtree.txt b/Documentation/filesystems/sharedsubtree.txt
index 32a173dd3158..e3f4c778eb98 100644
--- a/Documentation/filesystems/sharedsubtree.txt
+++ b/Documentation/filesystems/sharedsubtree.txt
@@ -664,7 +664,7 @@ replicas continue to be exactly same.
664 if one rbind mounts a tree within the same subtree 'n' times 664 if one rbind mounts a tree within the same subtree 'n' times
665 the number of mounts created is an exponential function of 'n'. 665 the number of mounts created is an exponential function of 'n'.
666 Having unbindable mount can help prune the unneeded bind 666 Having unbindable mount can help prune the unneeded bind
667 mounts. Here is a example. 667 mounts. Here is an example.
668 668
669 step 1: 669 step 1:
670 let's say the root tree has just two directories with 670 let's say the root tree has just two directories with
diff --git a/Documentation/filesystems/tmpfs.txt b/Documentation/filesystems/tmpfs.txt
index 98ef55124158..d392e1505f17 100644
--- a/Documentation/filesystems/tmpfs.txt
+++ b/Documentation/filesystems/tmpfs.txt
@@ -17,10 +17,10 @@ RAM, where you have to create an ordinary filesystem on top. Ramdisks
17cannot swap and you do not have the possibility to resize them. 17cannot swap and you do not have the possibility to resize them.
18 18
19Since tmpfs lives completely in the page cache and on swap, all tmpfs 19Since tmpfs lives completely in the page cache and on swap, all tmpfs
20pages currently in memory will show up as cached. It will not show up 20pages will be shown as "Shmem" in /proc/meminfo and "Shared" in
21as shared or something like that. Further on you can check the actual 21free(1). Notice that these counters also include shared memory
22RAM+swap use of a tmpfs instance with df(1) and du(1). 22(shmem, see ipcs(1)). The most reliable way to get the count is
23 23using df(1) and du(1).
24 24
25tmpfs has the following uses: 25tmpfs has the following uses:
26 26
diff --git a/Documentation/filesystems/vfat.txt b/Documentation/filesystems/vfat.txt
index ce1126aceed8..223c32171dcc 100644
--- a/Documentation/filesystems/vfat.txt
+++ b/Documentation/filesystems/vfat.txt
@@ -180,6 +180,16 @@ dos1xfloppy -- If set, use a fallback default BIOS Parameter Block
180 180
181<bool>: 0,1,yes,no,true,false 181<bool>: 0,1,yes,no,true,false
182 182
183LIMITATION
184---------------------------------------------------------------------
185* The fallocated region of file is discarded at umount/evict time
186 when using fallocate with FALLOC_FL_KEEP_SIZE.
187 So, User should assume that fallocated region can be discarded at
188 last close if there is memory pressure resulting in eviction of
189 the inode from the memory. As a result, for any dependency on
190 the fallocated region, user should make sure to recheck fallocate
191 after reopening the file.
192
183TODO 193TODO
184---------------------------------------------------------------------- 194----------------------------------------------------------------------
185* Need to get rid of the raw scanning stuff. Instead, always use 195* Need to get rid of the raw scanning stuff. Instead, always use
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 8c6f07ad373a..b02a7d598258 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -350,8 +350,8 @@ struct inode_operations {
350 int (*rename2) (struct inode *, struct dentry *, 350 int (*rename2) (struct inode *, struct dentry *,
351 struct inode *, struct dentry *, unsigned int); 351 struct inode *, struct dentry *, unsigned int);
352 int (*readlink) (struct dentry *, char __user *,int); 352 int (*readlink) (struct dentry *, char __user *,int);
353 const char *(*follow_link) (struct dentry *, void **); 353 const char *(*get_link) (struct dentry *, struct inode *,
354 void (*put_link) (struct inode *, void *); 354 struct delayed_call *);
355 int (*permission) (struct inode *, int); 355 int (*permission) (struct inode *, int);
356 int (*get_acl)(struct inode *, int); 356 int (*get_acl)(struct inode *, int);
357 int (*setattr) (struct dentry *, struct iattr *); 357 int (*setattr) (struct dentry *, struct iattr *);
@@ -434,20 +434,19 @@ otherwise noted.
434 readlink: called by the readlink(2) system call. Only required if 434 readlink: called by the readlink(2) system call. Only required if
435 you want to support reading symbolic links 435 you want to support reading symbolic links
436 436
437 follow_link: called by the VFS to follow a symbolic link to the 437 get_link: called by the VFS to follow a symbolic link to the
438 inode it points to. Only required if you want to support 438 inode it points to. Only required if you want to support
439 symbolic links. This method returns the symlink body 439 symbolic links. This method returns the symlink body
440 to traverse (and possibly resets the current position with 440 to traverse (and possibly resets the current position with
441 nd_jump_link()). If the body won't go away until the inode 441 nd_jump_link()). If the body won't go away until the inode
442 is gone, nothing else is needed; if it needs to be otherwise 442 is gone, nothing else is needed; if it needs to be otherwise
443 pinned, the data needed to release whatever we'd grabbed 443 pinned, arrange for its release by having get_link(..., ..., done)
444 is to be stored in void * variable passed by address to 444 do set_delayed_call(done, destructor, argument).
445 follow_link() instance. 445 In that case destructor(argument) will be called once VFS is
446 446 done with the body you've returned.
447 put_link: called by the VFS to release resources allocated by 447 May be called in RCU mode; that is indicated by NULL dentry
448 follow_link(). The cookie stored by follow_link() is passed 448 argument. If request can't be handled without leaving RCU mode,
449 to this method as the last parameter; only called when 449 have it return ERR_PTR(-ECHILD).
450 cookie isn't NULL.
451 450
452 permission: called by the VFS to check for access rights on a POSIX-like 451 permission: called by the VFS to check for access rights on a POSIX-like
453 filesystem. 452 filesystem.
diff --git a/Documentation/gpio/consumer.txt b/Documentation/gpio/consumer.txt
index e000502fde20..05676fdacfe3 100644
--- a/Documentation/gpio/consumer.txt
+++ b/Documentation/gpio/consumer.txt
@@ -260,7 +260,7 @@ will be driven low.
260 260
261To summarize: 261To summarize:
262 262
263Function (example) active-low proporty physical line 263Function (example) active-low property physical line
264gpiod_set_raw_value(desc, 0); don't care low 264gpiod_set_raw_value(desc, 0); don't care low
265gpiod_set_raw_value(desc, 1); don't care high 265gpiod_set_raw_value(desc, 1); don't care high
266gpiod_set_value(desc, 0); default (active-high) low 266gpiod_set_value(desc, 0); default (active-high) low
diff --git a/Documentation/gpio/driver.txt b/Documentation/gpio/driver.txt
index 12a61948ec91..bbeec415f406 100644
--- a/Documentation/gpio/driver.txt
+++ b/Documentation/gpio/driver.txt
@@ -113,8 +113,8 @@ GPIO irqchips usually fall in one of two categories:
113 it will be threaded IRQ handler on -RT and hard IRQ handler on non-RT 113 it will be threaded IRQ handler on -RT and hard IRQ handler on non-RT
114 (for example, see [3]). 114 (for example, see [3]).
115 Know W/A: The generic_handle_irq() is expected to be called with IRQ disabled, 115 Know W/A: The generic_handle_irq() is expected to be called with IRQ disabled,
116 so IRQ core will complain if it will be called from IRQ handler wich is forced 116 so IRQ core will complain if it will be called from IRQ handler which is
117 thread. The "fake?" raw lock can be used to W/A this problem: 117 forced thread. The "fake?" raw lock can be used to W/A this problem:
118 118
119 raw_spinlock_t wa_lock; 119 raw_spinlock_t wa_lock;
120 static irqreturn_t omap_gpio_irq_handler(int irq, void *gpiobank) 120 static irqreturn_t omap_gpio_irq_handler(int irq, void *gpiobank)
@@ -224,7 +224,7 @@ Real-Time compliance for GPIO IRQ chips
224--------------------------------------- 224---------------------------------------
225 225
226Any provider of irqchips needs to be carefully tailored to support Real Time 226Any provider of irqchips needs to be carefully tailored to support Real Time
227preemption. It is desireable that all irqchips in the GPIO subsystem keep this 227preemption. It is desirable that all irqchips in the GPIO subsystem keep this
228in mind and does the proper testing to assure they are real time-enabled. 228in mind and does the proper testing to assure they are real time-enabled.
229So, pay attention on above " RT_FULL:" notes, please. 229So, pay attention on above " RT_FULL:" notes, please.
230The following is a checklist to follow when preparing a driver for real 230The following is a checklist to follow when preparing a driver for real
diff --git a/Documentation/gpio/drivers-on-gpio.txt b/Documentation/gpio/drivers-on-gpio.txt
index f6121328630f..14bf95a13bae 100644
--- a/Documentation/gpio/drivers-on-gpio.txt
+++ b/Documentation/gpio/drivers-on-gpio.txt
@@ -54,7 +54,7 @@ hardware descriptions such as device tree or ACPI:
54 drivers for the I2C devices on the bus like any other I2C bus driver. 54 drivers for the I2C devices on the bus like any other I2C bus driver.
55 55
56- spi_gpio: drivers/spi/spi-gpio.c is used to drive an SPI bus (variable number 56- spi_gpio: drivers/spi/spi-gpio.c is used to drive an SPI bus (variable number
57 of wires, atleast SCK and optionally MISO, MOSI and chip select lines) using 57 of wires, at least SCK and optionally MISO, MOSI and chip select lines) using
58 GPIO hammering (bitbang). It will appear as any other SPI bus on the system 58 GPIO hammering (bitbang). It will appear as any other SPI bus on the system
59 and makes it possible to connect drivers for SPI devices on the bus like 59 and makes it possible to connect drivers for SPI devices on the bus like
60 any other SPI bus driver. For example any MMC/SD card can then be connected 60 any other SPI bus driver. For example any MMC/SD card can then be connected
@@ -75,7 +75,7 @@ hardware descriptions such as device tree or ACPI:
75 75
76- gpio-wdt: drivers/watchdog/gpio_wdt.c is used to provide a watchdog timer 76- gpio-wdt: drivers/watchdog/gpio_wdt.c is used to provide a watchdog timer
77 that will periodically "ping" a hardware connected to a GPIO line by toggling 77 that will periodically "ping" a hardware connected to a GPIO line by toggling
78 it from 1-to-0-to-1. If that hardware does not recieve its "ping" 78 it from 1-to-0-to-1. If that hardware does not receive its "ping"
79 periodically, it will reset the system. 79 periodically, it will reset the system.
80 80
81- gpio-nand: drivers/mtd/nand/gpio.c is used to connect a NAND flash chip to 81- gpio-nand: drivers/mtd/nand/gpio.c is used to connect a NAND flash chip to
@@ -91,5 +91,5 @@ usually connected directly to the flash.
91 91
92Use those instead of talking directly to the GPIOs using sysfs; they integrate 92Use those instead of talking directly to the GPIOs using sysfs; they integrate
93with kernel frameworks better than your userspace code could. Needless to say, 93with kernel frameworks better than your userspace code could. Needless to say,
94just using the apropriate kernel drivers will simplify and speed up your 94just using the appropriate kernel drivers will simplify and speed up your
95embedded hacking in particular by providing ready-made components. 95embedded hacking in particular by providing ready-made components.
diff --git a/Documentation/hwmon/htu21 b/Documentation/hwmon/htu21
deleted file mode 100644
index f39a215fb6ae..000000000000
--- a/Documentation/hwmon/htu21
+++ /dev/null
@@ -1,46 +0,0 @@
1Kernel driver htu21
2===================
3
4Supported chips:
5 * Measurement Specialties HTU21D
6 Prefix: 'htu21'
7 Addresses scanned: none
8 Datasheet: Publicly available at the Measurement Specialties website
9 http://www.meas-spec.com/downloads/HTU21D.pdf
10
11
12Author:
13 William Markezana <william.markezana@meas-spec.com>
14
15Description
16-----------
17
18The HTU21D is a humidity and temperature sensor in a DFN package of
19only 3 x 3 mm footprint and 0.9 mm height.
20
21The devices communicate with the I2C protocol. All sensors are set to the
22same I2C address 0x40, so an entry with I2C_BOARD_INFO("htu21", 0x40) can
23be used in the board setup code.
24
25This driver does not auto-detect devices. You will have to instantiate the
26devices explicitly. Please see Documentation/i2c/instantiating-devices
27for details.
28
29sysfs-Interface
30---------------
31
32temp1_input - temperature input
33humidity1_input - humidity input
34
35Notes
36-----
37
38The driver uses the default resolution settings of 12 bit for humidity and 14
39bit for temperature, which results in typical measurement times of 11 ms for
40humidity and 44 ms for temperature. To keep self heating below 0.1 degree
41Celsius, the device should not be active for more than 10% of the time. For
42this reason, the driver performs no more than two measurements per second and
43reports cached information if polled more frequently.
44
45Different resolutions, the on-chip heater, using the CRC checksum and reading
46the serial number are not supported yet.
diff --git a/Documentation/hwmon/ltc3815 b/Documentation/hwmon/ltc3815
new file mode 100644
index 000000000000..eb7db2d13587
--- /dev/null
+++ b/Documentation/hwmon/ltc3815
@@ -0,0 +1,61 @@
1Kernel driver ltc3815
2=====================
3
4Supported chips:
5 * Linear Technology LTC3815
6 Prefix: 'ltc3815'
7 Addresses scanned: -
8 Datasheet: http://www.linear.com/product/ltc3815
9
10Author: Guenter Roeck <linux@roeck-us.net>
11
12
13Description
14-----------
15
16LTC3815 is a Monolithic Synchronous DC/DC Step-Down Converter.
17
18
19Usage Notes
20-----------
21
22This driver does not probe for PMBus devices. You will have to instantiate
23devices explicitly.
24
25Example: the following commands will load the driver for an LTC3815
26at address 0x20 on I2C bus #1:
27
28# modprobe ltc3815
29# echo ltc3815 0x20 > /sys/bus/i2c/devices/i2c-1/new_device
30
31
32Sysfs attributes
33----------------
34
35in1_label "vin"
36in1_input Measured input voltage.
37in1_alarm Input voltage alarm.
38in1_highest Highest input voltage.
39in1_reset_history Reset input voltage history.
40
41in2_label "vout1".
42in2_input Measured output voltage.
43in2_alarm Output voltage alarm.
44in2_highest Highest output voltage.
45in2_reset_history Reset output voltage history.
46
47temp1_input Measured chip temperature.
48temp1_alarm Temperature alarm.
49temp1_highest Highest measured temperature.
50temp1_reset_history Reset temperature history.
51
52curr1_label "iin".
53curr1_input Measured input current.
54curr1_highest Highest input current.
55curr1_reset_history Reset input current history.
56
57curr2_label "iout1".
58curr2_input Measured output current.
59curr2_alarm Output current alarm.
60curr2_highest Highest output current.
61curr2_reset_history Reset output current history.
diff --git a/Documentation/iio/iio_configfs.txt b/Documentation/iio/iio_configfs.txt
new file mode 100644
index 000000000000..f0add35cd52e
--- /dev/null
+++ b/Documentation/iio/iio_configfs.txt
@@ -0,0 +1,93 @@
1Industrial IIO configfs support
2
31. Overview
4
5Configfs is a filesystem-based manager of kernel objects. IIO uses some
6objects that could be easily configured using configfs (e.g.: devices,
7triggers).
8
9See Documentation/filesystems/configfs/configfs.txt for more information
10about how configfs works.
11
122. Usage
13
14In order to use configfs support in IIO we need to select it at compile
15time via CONFIG_IIO_CONFIGFS config option.
16
17Then, mount the configfs filesystem (usually under /config directory):
18
19$ mkdir /config
20$ mount -t configfs none /config
21
22At this point, all default IIO groups will be created and can be accessed
23under /config/iio. Next chapters will describe available IIO configuration
24objects.
25
263. Software triggers
27
28One of the IIO default configfs groups is the "triggers" group. It is
29automagically accessible when the configfs is mounted and can be found
30under /config/iio/triggers.
31
32IIO software triggers implementation offers support for creating multiple
33trigger types. A new trigger type is usually implemented as a separate
34kernel module following the interface in include/linux/iio/sw_trigger.h:
35
36/*
37 * drivers/iio/trigger/iio-trig-sample.c
38 * sample kernel module implementing a new trigger type
39 */
40#include <linux/iio/sw_trigger.h>
41
42
43static struct iio_sw_trigger *iio_trig_sample_probe(const char *name)
44{
45 /*
46 * This allocates and registers an IIO trigger plus other
47 * trigger type specific initialization.
48 */
49}
50
51static int iio_trig_hrtimer_remove(struct iio_sw_trigger *swt)
52{
53 /*
54 * This undoes the actions in iio_trig_sample_probe
55 */
56}
57
58static const struct iio_sw_trigger_ops iio_trig_sample_ops = {
59 .probe = iio_trig_sample_probe,
60 .remove = iio_trig_sample_remove,
61};
62
63static struct iio_sw_trigger_type iio_trig_sample = {
64 .name = "trig-sample",
65 .owner = THIS_MODULE,
66 .ops = &iio_trig_sample_ops,
67};
68
69module_iio_sw_trigger_driver(iio_trig_sample);
70
71Each trigger type has its own directory under /config/iio/triggers. Loading
72iio-trig-sample module will create 'trig-sample' trigger type directory
73/config/iio/triggers/trig-sample.
74
75We support the following interrupt sources (trigger types):
76 * hrtimer, uses high resolution timers as interrupt source
77
783.1 Hrtimer triggers creation and destruction
79
80Loading iio-trig-hrtimer module will register hrtimer trigger types allowing
81users to create hrtimer triggers under /config/iio/triggers/hrtimer.
82
83e.g:
84
85$ mkdir /config/triggers/hrtimer/instance1
86$ rmdir /config/triggers/hrtimer/instance1
87
88Each trigger can have one or more attributes specific to the trigger type.
89
903.2 "hrtimer" trigger types attributes
91
92"hrtimer" trigger type doesn't have any configurable attribute from /config dir.
93It does introduce the sampling_frequency attribute to trigger directory.
diff --git a/Documentation/ioctl/botching-up-ioctls.txt b/Documentation/ioctl/botching-up-ioctls.txt
index 45fe78c58019..cc30b14791cb 100644
--- a/Documentation/ioctl/botching-up-ioctls.txt
+++ b/Documentation/ioctl/botching-up-ioctls.txt
@@ -122,7 +122,7 @@ Time, Waiting and Missing it
122---------------------------- 122----------------------------
123 123
124GPUs do most everything asynchronously, so we have a need to time operations and 124GPUs do most everything asynchronously, so we have a need to time operations and
125wait for oustanding ones. This is really tricky business; at the moment none of 125wait for outstanding ones. This is really tricky business; at the moment none of
126the ioctls supported by the drm/i915 get this fully right, which means there's 126the ioctls supported by the drm/i915 get this fully right, which means there's
127still tons more lessons to learn here. 127still tons more lessons to learn here.
128 128
@@ -146,7 +146,7 @@ still tons more lessons to learn here.
146 ioctl restartable relative timeouts tend to be too coarse and can 146 ioctl restartable relative timeouts tend to be too coarse and can
147 indefinitely extend your wait time due to rounding on each restart. 147 indefinitely extend your wait time due to rounding on each restart.
148 Especially if your reference clock is something really slow like the display 148 Especially if your reference clock is something really slow like the display
149 frame counter. With a spec laywer hat on this isn't a bug since timeouts can 149 frame counter. With a spec lawyer hat on this isn't a bug since timeouts can
150 always be extended - but users will surely hate you if their neat animations 150 always be extended - but users will surely hate you if their neat animations
151 starts to stutter due to this. 151 starts to stutter due to this.
152 152
@@ -176,7 +176,7 @@ entails its own little set of pitfalls:
176 176
177 * Ensure that you have sufficient insulation between different clients. By 177 * Ensure that you have sufficient insulation between different clients. By
178 default pick a private per-fd namespace which forces any sharing to be done 178 default pick a private per-fd namespace which forces any sharing to be done
179 explictly. Only go with a more global per-device namespace if the objects 179 explicitly. Only go with a more global per-device namespace if the objects
180 are truly device-unique. One counterexample in the drm modeset interfaces is 180 are truly device-unique. One counterexample in the drm modeset interfaces is
181 that the per-device modeset objects like connectors share a namespace with 181 that the per-device modeset objects like connectors share a namespace with
182 framebuffer objects, which mostly are not shared at all. A separate 182 framebuffer objects, which mostly are not shared at all. A separate
diff --git a/Documentation/ja_JP/HOWTO b/Documentation/ja_JP/HOWTO
index 5a0f2bdc2cf9..8d5465d3fdef 100644
--- a/Documentation/ja_JP/HOWTO
+++ b/Documentation/ja_JP/HOWTO
@@ -245,7 +245,7 @@ Linux カーネルソースツリーの中に含まれる、きれいにし、
245自己参照方式で、索引がついた web 形式で、ソースコードを参照することが 245自己参照方式で、索引がついた web 形式で、ソースコードを参照することが
246できます。この最新の素晴しいカーネルコードのリポジトリは以下で見つかり 246できます。この最新の素晴しいカーネルコードのリポジトリは以下で見つかり
247ます- 247ます-
248 http://lxr.linux.no/+trees 248 http://lxr.free-electrons.com/
249 249
250開発プロセス 250開発プロセス
251----------------------- 251-----------------------
@@ -366,7 +366,6 @@ http://patchwork.kernel.org/ でリストされています。
366に全サブシステムツリーからほぼ毎日プルされてできる特別なテスト用のリ 366に全サブシステムツリーからほぼ毎日プルされてできる特別なテスト用のリ
367ポジトリが存在します- 367ポジトリが存在します-
368 http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git 368 http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git
369 http://linux.f-seidel.de/linux-next/pmwiki/
370 369
371このやり方によって、-next カーネルは次のマージ機会でどんなものがメイン 370このやり方によって、-next カーネルは次のマージ機会でどんなものがメイン
372ラインカーネルにマージされるか、おおまかなの展望を提供します。-next 371ラインカーネルにマージされるか、おおまかなの展望を提供します。-next
diff --git a/Documentation/kernel-docs.txt b/Documentation/kernel-docs.txt
index 08913361e054..fe217c1c2f7f 100644
--- a/Documentation/kernel-docs.txt
+++ b/Documentation/kernel-docs.txt
@@ -631,7 +631,7 @@
631 between two versions of a file". 631 between two versions of a file".
632 632
633 * Name: "Cross-Referencing Linux" 633 * Name: "Cross-Referencing Linux"
634 URL: http://lxr.linux.no/source/ 634 URL: http://lxr.free-electrons.com/
635 Keywords: Browsing source code. 635 Keywords: Browsing source code.
636 Description: Another web-based Linux kernel source code browser. 636 Description: Another web-based Linux kernel source code browser.
637 Lots of cross references to variables and functions. You can see 637 Lots of cross references to variables and functions. You can see
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 742f69d18fc8..cfb2c0f1a4a8 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -472,6 +472,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
472 Change the amount of debugging information output 472 Change the amount of debugging information output
473 when initialising the APIC and IO-APIC components. 473 when initialising the APIC and IO-APIC components.
474 474
475 apic_extnmi= [APIC,X86] External NMI delivery setting
476 Format: { bsp (default) | all | none }
477 bsp: External NMI is delivered only to CPU 0
478 all: External NMIs are broadcast to all CPUs as a
479 backup of CPU 0
480 none: External NMI is masked for all CPUs. This is
481 useful so that a dump capture kernel won't be
482 shot down by NMI
483
475 autoconf= [IPV6] 484 autoconf= [IPV6]
476 See Documentation/networking/ipv6.txt. 485 See Documentation/networking/ipv6.txt.
477 486
@@ -599,6 +608,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
599 cut the overhead, others just disable the usage. So 608 cut the overhead, others just disable the usage. So
600 only cgroup_disable=memory is actually worthy} 609 only cgroup_disable=memory is actually worthy}
601 610
611 cgroup.memory= [KNL] Pass options to the cgroup memory controller.
612 Format: <string>
613 nosocket -- Disable socket memory accounting.
614 nokmem -- Disable kernel memory accounting.
615
602 checkreqprot [SELINUX] Set initial checkreqprot flag value. 616 checkreqprot [SELINUX] Set initial checkreqprot flag value.
603 Format: { "0" | "1" } 617 Format: { "0" | "1" }
604 See security/selinux/Kconfig help text. 618 See security/selinux/Kconfig help text.
@@ -721,16 +735,17 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
721 735
722 uart[8250],io,<addr>[,options] 736 uart[8250],io,<addr>[,options]
723 uart[8250],mmio,<addr>[,options] 737 uart[8250],mmio,<addr>[,options]
738 uart[8250],mmio16,<addr>[,options]
724 uart[8250],mmio32,<addr>[,options] 739 uart[8250],mmio32,<addr>[,options]
725 uart[8250],0x<addr>[,options] 740 uart[8250],0x<addr>[,options]
726 Start an early, polled-mode console on the 8250/16550 741 Start an early, polled-mode console on the 8250/16550
727 UART at the specified I/O port or MMIO address, 742 UART at the specified I/O port or MMIO address,
728 switching to the matching ttyS device later. 743 switching to the matching ttyS device later.
729 MMIO inter-register address stride is either 8-bit 744 MMIO inter-register address stride is either 8-bit
730 (mmio) or 32-bit (mmio32). 745 (mmio), 16-bit (mmio16), or 32-bit (mmio32).
731 If none of [io|mmio|mmio32], <addr> is assumed to be 746 If none of [io|mmio|mmio16|mmio32], <addr> is assumed
732 equivalent to 'mmio'. 'options' are specified in the 747 to be equivalent to 'mmio'. 'options' are specified in
733 same format described for ttyS above; if unspecified, 748 the same format described for ttyS above; if unspecified,
734 the h/w is not re-initialized. 749 the h/w is not re-initialized.
735 750
736 hvc<n> Use the hypervisor console device <n>. This is for 751 hvc<n> Use the hypervisor console device <n>. This is for
@@ -1002,10 +1017,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
1002 unspecified, the h/w is not initialized. 1017 unspecified, the h/w is not initialized.
1003 1018
1004 pl011,<addr> 1019 pl011,<addr>
1020 pl011,mmio32,<addr>
1005 Start an early, polled-mode console on a pl011 serial 1021 Start an early, polled-mode console on a pl011 serial
1006 port at the specified address. The pl011 serial port 1022 port at the specified address. The pl011 serial port
1007 must already be setup and configured. Options are not 1023 must already be setup and configured. Options are not
1008 yet supported. 1024 yet supported. If 'mmio32' is specified, then only
1025 the driver will use only 32-bit accessors to read/write
1026 the device registers.
1009 1027
1010 msm_serial,<addr> 1028 msm_serial,<addr>
1011 Start an early, polled-mode console on an msm serial 1029 Start an early, polled-mode console on an msm serial
@@ -2575,8 +2593,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
2575 2593
2576 notsc [BUGS=X86-32] Disable Time Stamp Counter 2594 notsc [BUGS=X86-32] Disable Time Stamp Counter
2577 2595
2578 nousb [USB] Disable the USB subsystem
2579
2580 nowatchdog [KNL] Disable both lockup detectors, i.e. 2596 nowatchdog [KNL] Disable both lockup detectors, i.e.
2581 soft-lockup and NMI watchdog (hard-lockup). 2597 soft-lockup and NMI watchdog (hard-lockup).
2582 2598
@@ -2733,10 +2749,16 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
2733 hardware access methods are allowed. Use this 2749 hardware access methods are allowed. Use this
2734 if you experience crashes upon bootup and you 2750 if you experience crashes upon bootup and you
2735 suspect they are caused by the BIOS. 2751 suspect they are caused by the BIOS.
2736 conf1 [X86] Force use of PCI Configuration 2752 conf1 [X86] Force use of PCI Configuration Access
2737 Mechanism 1. 2753 Mechanism 1 (config address in IO port 0xCF8,
2738 conf2 [X86] Force use of PCI Configuration 2754 data in IO port 0xCFC, both 32-bit).
2739 Mechanism 2. 2755 conf2 [X86] Force use of PCI Configuration Access
2756 Mechanism 2 (IO port 0xCF8 is an 8-bit port for
2757 the function, IO port 0xCFA, also 8-bit, sets
2758 bus number. The config space is then accessed
2759 through ports 0xC000-0xCFFF).
2760 See http://wiki.osdev.org/PCI for more info
2761 on the configuration access mechanisms.
2740 noaer [PCIE] If the PCIEAER kernel config parameter is 2762 noaer [PCIE] If the PCIEAER kernel config parameter is
2741 enabled, this kernel boot option can be used to 2763 enabled, this kernel boot option can be used to
2742 disable the use of PCIE advanced error reporting. 2764 disable the use of PCIE advanced error reporting.
@@ -2978,6 +3000,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
2978 may be specified. 3000 may be specified.
2979 Format: <port>,<port>.... 3001 Format: <port>,<port>....
2980 3002
3003 ppc_strict_facility_enable
3004 [PPC] This option catches any kernel floating point,
3005 Altivec, VSX and SPE outside of regions specifically
3006 allowed (eg kernel_enable_fpu()/kernel_disable_fpu()).
3007 There is some performance impact when enabling this.
3008
2981 print-fatal-signals= 3009 print-fatal-signals=
2982 [KNL] debug: print fatal signals 3010 [KNL] debug: print fatal signals
2983 3011
@@ -3050,9 +3078,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
3050 raid= [HW,RAID] 3078 raid= [HW,RAID]
3051 See Documentation/md.txt. 3079 See Documentation/md.txt.
3052 3080
3053 ramdisk_blocksize= [RAM]
3054 See Documentation/blockdev/ramdisk.txt.
3055
3056 ramdisk_size= [RAM] Sizes of RAM disks in kilobytes 3081 ramdisk_size= [RAM] Sizes of RAM disks in kilobytes
3057 See Documentation/blockdev/ramdisk.txt. 3082 See Documentation/blockdev/ramdisk.txt.
3058 3083
@@ -3296,18 +3321,35 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
3296 rcutorture.verbose= [KNL] 3321 rcutorture.verbose= [KNL]
3297 Enable additional printk() statements. 3322 Enable additional printk() statements.
3298 3323
3324 rcupdate.rcu_cpu_stall_suppress= [KNL]
3325 Suppress RCU CPU stall warning messages.
3326
3327 rcupdate.rcu_cpu_stall_timeout= [KNL]
3328 Set timeout for RCU CPU stall warning messages.
3329
3299 rcupdate.rcu_expedited= [KNL] 3330 rcupdate.rcu_expedited= [KNL]
3300 Use expedited grace-period primitives, for 3331 Use expedited grace-period primitives, for
3301 example, synchronize_rcu_expedited() instead 3332 example, synchronize_rcu_expedited() instead
3302 of synchronize_rcu(). This reduces latency, 3333 of synchronize_rcu(). This reduces latency,
3303 but can increase CPU utilization, degrade 3334 but can increase CPU utilization, degrade
3304 real-time latency, and degrade energy efficiency. 3335 real-time latency, and degrade energy efficiency.
3305 3336 No effect on CONFIG_TINY_RCU kernels.
3306 rcupdate.rcu_cpu_stall_suppress= [KNL] 3337
3307 Suppress RCU CPU stall warning messages. 3338 rcupdate.rcu_normal= [KNL]
3308 3339 Use only normal grace-period primitives,
3309 rcupdate.rcu_cpu_stall_timeout= [KNL] 3340 for example, synchronize_rcu() instead of
3310 Set timeout for RCU CPU stall warning messages. 3341 synchronize_rcu_expedited(). This improves
3342 real-time latency, CPU utilization, and
3343 energy efficiency, but can expose users to
3344 increased grace-period latency. This parameter
3345 overrides rcupdate.rcu_expedited. No effect on
3346 CONFIG_TINY_RCU kernels.
3347
3348 rcupdate.rcu_normal_after_boot= [KNL]
3349 Once boot has completed (that is, after
3350 rcu_end_inkernel_boot() has been invoked), use
3351 only normal grace-period primitives. No effect
3352 on CONFIG_TINY_RCU kernels.
3311 3353
3312 rcupdate.rcu_task_stall_timeout= [KNL] 3354 rcupdate.rcu_task_stall_timeout= [KNL]
3313 Set timeout in jiffies for RCU task stall warning 3355 Set timeout in jiffies for RCU task stall warning
@@ -3874,6 +3916,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
3874 usbcore.usbfs_snoop= 3916 usbcore.usbfs_snoop=
3875 [USB] Set to log all usbfs traffic (default 0 = off). 3917 [USB] Set to log all usbfs traffic (default 0 = off).
3876 3918
3919 usbcore.usbfs_snoop_max=
3920 [USB] Maximum number of bytes to snoop in each URB
3921 (default = 65536).
3922
3877 usbcore.blinkenlights= 3923 usbcore.blinkenlights=
3878 [USB] Set to cycle leds on hubs (default 0 = off). 3924 [USB] Set to cycle leds on hubs (default 0 = off).
3879 3925
@@ -3894,6 +3940,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
3894 USB_REQ_GET_DESCRIPTOR request in milliseconds 3940 USB_REQ_GET_DESCRIPTOR request in milliseconds
3895 (default 5000 = 5.0 seconds). 3941 (default 5000 = 5.0 seconds).
3896 3942
3943 usbcore.nousb [USB] Disable the USB subsystem
3944
3897 usbhid.mousepoll= 3945 usbhid.mousepoll=
3898 [USBHID] The interval which mice are to be polled at. 3946 [USBHID] The interval which mice are to be polled at.
3899 3947
@@ -4114,6 +4162,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
4114 or other driver-specific files in the 4162 or other driver-specific files in the
4115 Documentation/watchdog/ directory. 4163 Documentation/watchdog/ directory.
4116 4164
4165 workqueue.watchdog_thresh=
4166 If CONFIG_WQ_WATCHDOG is configured, workqueue can
4167 warn stall conditions and dump internal state to
4168 help debugging. 0 disables workqueue stall
4169 detection; otherwise, it's the stall threshold
4170 duration in seconds. The default value is 30 and
4171 it can be updated at runtime by writing to the
4172 corresponding sysfs file.
4173
4117 workqueue.disable_numa 4174 workqueue.disable_numa
4118 By default, all work items queued to unbound 4175 By default, all work items queued to unbound
4119 workqueues are affine to the NUMA nodes they're 4176 workqueues are affine to the NUMA nodes they're
diff --git a/Documentation/ko_KR/HOWTO b/Documentation/ko_KR/HOWTO
index dc2ff8f611e0..1aef53e6cb98 100644
--- a/Documentation/ko_KR/HOWTO
+++ b/Documentation/ko_KR/HOWTO
@@ -213,7 +213,7 @@ Documentation/DocBook/ 디렉토리 내에서 만들어지며 PDF, Postscript, H
213것은 Linux Cross-Reference project이며 그것은 자기 참조 방식이며 213것은 Linux Cross-Reference project이며 그것은 자기 참조 방식이며
214소스코드를 인덱스된 웹 페이지들의 형태로 보여준다. 최신의 멋진 커널 214소스코드를 인덱스된 웹 페이지들의 형태로 보여준다. 최신의 멋진 커널
215코드 저장소는 다음을 통하여 참조할 수 있다. 215코드 저장소는 다음을 통하여 참조할 수 있다.
216 http://lxr.linux.no/+trees 216 http://lxr.free-electrons.com/
217 217
218 218
219개발 프로세스 219개발 프로세스
@@ -222,16 +222,16 @@ Documentation/DocBook/ 디렉토리 내에서 만들어지며 PDF, Postscript, H
222리눅스 커널 개발 프로세스는 현재 몇몇 다른 메인 커널 "브랜치들"과 222리눅스 커널 개발 프로세스는 현재 몇몇 다른 메인 커널 "브랜치들"과
223서브시스템에 특화된 커널 브랜치들로 구성된다. 몇몇 다른 메인 223서브시스템에 특화된 커널 브랜치들로 구성된다. 몇몇 다른 메인
224브랜치들은 다음과 같다. 224브랜치들은 다음과 같다.
225 - main 3.x 커널 트리 225 - main 4.x 커널 트리
226 - 3.x.y - 안정된 커널 트리 226 - 4.x.y - 안정된 커널 트리
227 - 3.x -git 커널 패치들 227 - 4.x -git 커널 패치들
228 - 서브시스템을 위한 커널 트리들과 패치들 228 - 서브시스템을 위한 커널 트리들과 패치들
229 - 3.x - 통합 테스트를 위한 next 커널 트리 229 - 4.x - 통합 테스트를 위한 next 커널 트리
230 230
2313.x 커널 트리 2314.x 커널 트리
232--------------- 232---------------
233 233
2343.x 커널들은 Linux Torvalds가 관리하며 kernel.org의 pub/linux/kernel/v3.x/ 2344.x 커널들은 Linux Torvalds가 관리하며 kernel.org의 pub/linux/kernel/v4.x/
235디렉토리에서 참조될 수 있다.개발 프로세스는 다음과 같다. 235디렉토리에서 참조될 수 있다.개발 프로세스는 다음과 같다.
236 - 새로운 커널이 배포되자마자 2주의 시간이 주어진다. 이 기간동은 236 - 새로운 커널이 배포되자마자 2주의 시간이 주어진다. 이 기간동은
237 메인테이너들은 큰 diff들을 Linus에게 제출할 수 있다. 대개 이 패치들은 237 메인테이너들은 큰 diff들을 Linus에게 제출할 수 있다. 대개 이 패치들은
@@ -262,20 +262,20 @@ Andrew Morton의 글이 있다.
262 버그의 상황에 따라 배포되는 것이지 미리정해 놓은 시간에 따라 262 버그의 상황에 따라 배포되는 것이지 미리정해 놓은 시간에 따라
263 배포되는 것은 아니기 때문이다." 263 배포되는 것은 아니기 때문이다."
264 264
2653.x.y - 안정 커널 트리 2654.x.y - 안정 커널 트리
266------------------------ 266------------------------
267 267
2683 자리 숫자로 이루어진 버젼의 커널들은 -stable 커널들이다. 그것들은 3.x 2683 자리 숫자로 이루어진 버젼의 커널들은 -stable 커널들이다. 그것들은 4.x
269커널에서 발견된 큰 회귀들이나 보안 문제들 중 비교적 작고 중요한 수정들을 269커널에서 발견된 큰 회귀들이나 보안 문제들 중 비교적 작고 중요한 수정들을
270포함한다. 270포함한다.
271 271
272이것은 가장 최근의 안정적인 커널을 원하는 사용자에게 추천되는 브랜치이며, 272이것은 가장 최근의 안정적인 커널을 원하는 사용자에게 추천되는 브랜치이며,
273개발/실험적 버젼을 테스트하는 것을 돕고자 하는 사용자들과는 별로 관련이 없다. 273개발/실험적 버젼을 테스트하는 것을 돕고자 하는 사용자들과는 별로 관련이 없다.
274 274
275어떤 3.x.y 커널도 사용할 수 없다면 그때는 가장 높은 숫자의 3.x 275어떤 4.x.y 커널도 사용할 수 없다면 그때는 가장 높은 숫자의 4.x
276커널이 현재의 안정 커널이다. 276커널이 현재의 안정 커널이다.
277 277
2783.x.y는 "stable" 팀<stable@vger.kernel.org>에 의해 관리되며 거의 매번 격주로 2784.x.y는 "stable" 팀<stable@vger.kernel.org>에 의해 관리되며 거의 매번 격주로
279배포된다. 279배포된다.
280 280
281커널 트리 문서들 내에 Documentation/stable_kernel_rules.txt 파일은 어떤 281커널 트리 문서들 내에 Documentation/stable_kernel_rules.txt 파일은 어떤
@@ -283,7 +283,7 @@ Andrew Morton의 글이 있다.
283진행되는지를 설명한다. 283진행되는지를 설명한다.
284 284
285 285
2863.x -git 패치들 2864.x -git 패치들
287------------------ 287------------------
288git 저장소(그러므로 -git이라는 이름이 붙음)에는 날마다 관리되는 Linus의 288git 저장소(그러므로 -git이라는 이름이 붙음)에는 날마다 관리되는 Linus의
289커널 트리의 snapshot 들이 있다. 이 패치들은 일반적으로 날마다 배포되며 289커널 트리의 snapshot 들이 있다. 이 패치들은 일반적으로 날마다 배포되며
@@ -312,13 +312,12 @@ Linus의 트리의 현재 상태를 나타낸다. 이 패치들은 정상적인
312대부분의 이러한 patchwork 사이트는 http://patchwork.kernel.org/ 또는 312대부분의 이러한 patchwork 사이트는 http://patchwork.kernel.org/ 또는
313http://patchwork.ozlabs.org/ 에 나열되어 있다. 313http://patchwork.ozlabs.org/ 에 나열되어 있다.
314 314
3153.x - 통합 테스트를 위한 next 커널 트리 3154.x - 통합 테스트를 위한 next 커널 트리
316----------------------------------------- 316-----------------------------------------
317서브시스템 트리들의 변경사항들은 mainline 3.x 트리로 들어오기 전에 통합 317서브시스템 트리들의 변경사항들은 mainline 4.x 트리로 들어오기 전에 통합
318테스트를 거쳐야 한다. 이런 목적으로, 모든 서브시스템 트리의 변경사항을 거의 318테스트를 거쳐야 한다. 이런 목적으로, 모든 서브시스템 트리의 변경사항을 거의
319매일 받아가는 특수한 테스트 저장소가 존재한다: 319매일 받아가는 특수한 테스트 저장소가 존재한다:
320 http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git 320 http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git
321 http://linux.f-seidel.de/linux-next/pmwiki/
322 321
323이런 식으로, -next 커널을 통해 다음 머지 기간에 메인라인 커널에 어떤 변경이 322이런 식으로, -next 커널을 통해 다음 머지 기간에 메인라인 커널에 어떤 변경이
324가해질 것인지 간략히 알 수 있다. 모험심 강한 테스터라면 -next 커널에서 테스트를 323가해질 것인지 간략히 알 수 있다. 모험심 강한 테스터라면 -next 커널에서 테스트를
diff --git a/Documentation/leds/leds-class.txt b/Documentation/leds/leds-class.txt
index 62261c04060a..d406d98339b2 100644
--- a/Documentation/leds/leds-class.txt
+++ b/Documentation/leds/leds-class.txt
@@ -52,6 +52,19 @@ above leaves scope for further attributes should they be needed. If sections
52of the name don't apply, just leave that section blank. 52of the name don't apply, just leave that section blank.
53 53
54 54
55Brightness setting API
56======================
57
58LED subsystem core exposes following API for setting brightness:
59
60 - led_set_brightness : it is guaranteed not to sleep, passing LED_OFF stops
61 blinking,
62 - led_set_brightness_sync : for use cases when immediate effect is desired -
63 it can block the caller for the time required for accessing
64 device registers and can sleep, passing LED_OFF stops hardware
65 blinking, returns -EBUSY if software blink fallback is enabled.
66
67
55Hardware accelerated blink of LEDs 68Hardware accelerated blink of LEDs
56================================== 69==================================
57 70
diff --git a/Documentation/md-cluster.txt b/Documentation/md-cluster.txt
index 1b794369e03a..c100c7163507 100644
--- a/Documentation/md-cluster.txt
+++ b/Documentation/md-cluster.txt
@@ -3,7 +3,7 @@ The cluster MD is a shared-device RAID for a cluster.
3 3
41. On-disk format 41. On-disk format
5 5
6Separate write-intent-bitmap are used for each cluster node. 6Separate write-intent-bitmaps are used for each cluster node.
7The bitmaps record all writes that may have been started on that node, 7The bitmaps record all writes that may have been started on that node,
8and may not yet have finished. The on-disk layout is: 8and may not yet have finished. The on-disk layout is:
9 9
@@ -14,117 +14,161 @@ and may not yet have finished. The on-disk layout is:
14| bm super[2] + bits | bm bits [2, contd] | bm super[3] + bits | 14| bm super[2] + bits | bm bits [2, contd] | bm super[3] + bits |
15| bm bits [3, contd] | | | 15| bm bits [3, contd] | | |
16 16
17During "normal" functioning we assume the filesystem ensures that only one 17During "normal" functioning we assume the filesystem ensures that only
18node writes to any given block at a time, so a write 18one node writes to any given block at a time, so a write request will
19request will 19
20 - set the appropriate bit (if not already set) 20 - set the appropriate bit (if not already set)
21 - commit the write to all mirrors 21 - commit the write to all mirrors
22 - schedule the bit to be cleared after a timeout. 22 - schedule the bit to be cleared after a timeout.
23 23
24Reads are just handled normally. It is up to the filesystem to 24Reads are just handled normally. It is up to the filesystem to ensure
25ensure one node doesn't read from a location where another node (or the same 25one node doesn't read from a location where another node (or the same
26node) is writing. 26node) is writing.
27 27
28 28
292. DLM Locks for management 292. DLM Locks for management
30 30
31There are two locks for managing the device: 31There are three groups of locks for managing the device:
32 32
332.1 Bitmap lock resource (bm_lockres) 332.1 Bitmap lock resource (bm_lockres)
34 34
35 The bm_lockres protects individual node bitmaps. They are named in the 35 The bm_lockres protects individual node bitmaps. They are named in
36 form bitmap001 for node 1, bitmap002 for node and so on. When a node 36 the form bitmap000 for node 1, bitmap001 for node 2 and so on. When a
37 joins the cluster, it acquires the lock in PW mode and it stays so 37 node joins the cluster, it acquires the lock in PW mode and it stays
38 during the lifetime the node is part of the cluster. The lock resource 38 so during the lifetime the node is part of the cluster. The lock
39 number is based on the slot number returned by the DLM subsystem. Since 39 resource number is based on the slot number returned by the DLM
40 DLM starts node count from one and bitmap slots start from zero, one is 40 subsystem. Since DLM starts node count from one and bitmap slots
41 subtracted from the DLM slot number to arrive at the bitmap slot number. 41 start from zero, one is subtracted from the DLM slot number to arrive
42 at the bitmap slot number.
43
44 The LVB of the bitmap lock for a particular node records the range
45 of sectors that are being re-synced by that node. No other
46 node may write to those sectors. This is used when a new nodes
47 joins the cluster.
48
492.2 Message passing locks
50
51 Each node has to communicate with other nodes when starting or ending
52 resync, and for metadata superblock updates. This communication is
53 managed through three locks: "token", "message", and "ack", together
54 with the Lock Value Block (LVB) of one of the "message" lock.
55
562.3 new-device management
57
58 A single lock: "no-new-dev" is used to co-ordinate the addition of
59 new devices - this must be synchronized across the array.
60 Normally all nodes hold a concurrent-read lock on this device.
42 61
433. Communication 623. Communication
44 63
45Each node has to communicate with other nodes when starting or ending 64 Messages can be broadcast to all nodes, and the sender waits for all
46resync, and metadata superblock updates. 65 other nodes to acknowledge the message before proceeding. Only one
66 message can be processed at a time.
47 67
483.1 Message Types 683.1 Message Types
49 69
50 There are 3 types, of messages which are passed 70 There are six types of messages which are passed:
51 71
52 3.1.1 METADATA_UPDATED: informs other nodes that the metadata has been 72 3.1.1 METADATA_UPDATED: informs other nodes that the metadata has
53 updated, and the node must re-read the md superblock. This is performed 73 been updated, and the node must re-read the md superblock. This is
54 synchronously. 74 performed synchronously. It is primarily used to signal device
75 failure.
55 76
56 3.1.2 RESYNC: informs other nodes that a resync is initiated or ended 77 3.1.2 RESYNCING: informs other nodes that a resync is initiated or
57 so that each node may suspend or resume the region. 78 ended so that each node may suspend or resume the region. Each
79 RESYNCING message identifies a range of the devices that the
80 sending node is about to resync. This over-rides any pervious
81 notification from that node: only one ranged can be resynced at a
82 time per-node.
83
84 3.1.3 NEWDISK: informs other nodes that a device is being added to
85 the array. Message contains an identifier for that device. See
86 below for further details.
87
88 3.1.4 REMOVE: A failed or spare device is being removed from the
89 array. The slot-number of the device is included in the message.
90
91 3.1.5 RE_ADD: A failed device is being re-activated - the assumption
92 is that it has been determined to be working again.
93
94 3.1.6 BITMAP_NEEDS_SYNC: if a node is stopped locally but the bitmap
95 isn't clean, then another node is informed to take the ownership of
96 resync.
58 97
593.2 Communication mechanism 983.2 Communication mechanism
60 99
61 The DLM LVB is used to communicate within nodes of the cluster. There 100 The DLM LVB is used to communicate within nodes of the cluster. There
62 are three resources used for the purpose: 101 are three resources used for the purpose:
63 102
64 3.2.1 Token: The resource which protects the entire communication 103 3.2.1 token: The resource which protects the entire communication
65 system. The node having the token resource is allowed to 104 system. The node having the token resource is allowed to
66 communicate. 105 communicate.
67 106
68 3.2.2 Message: The lock resource which carries the data to 107 3.2.2 message: The lock resource which carries the data to
69 communicate. 108 communicate.
70 109
71 3.2.3 Ack: The resource, acquiring which means the message has been 110 3.2.3 ack: The resource, acquiring which means the message has been
72 acknowledged by all nodes in the cluster. The BAST of the resource 111 acknowledged by all nodes in the cluster. The BAST of the resource
73 is used to inform the receive node that a node wants to communicate. 112 is used to inform the receiving node that a node wants to
113 communicate.
74 114
75The algorithm is: 115The algorithm is:
76 116
77 1. receive status 117 1. receive status - all nodes have concurrent-reader lock on "ack".
78 118
79 sender receiver receiver 119 sender receiver receiver
80 ACK:CR ACK:CR ACK:CR 120 "ack":CR "ack":CR "ack":CR
81 121
82 2. sender get EX of TOKEN 122 2. sender get EX on "token"
83 sender get EX of MESSAGE 123 sender get EX on "message"
84 sender receiver receiver 124 sender receiver receiver
85 TOKEN:EX ACK:CR ACK:CR 125 "token":EX "ack":CR "ack":CR
86 MESSAGE:EX 126 "message":EX
87 ACK:CR 127 "ack":CR
88 128
89 Sender checks that it still needs to send a message. Messages received 129 Sender checks that it still needs to send a message. Messages
90 or other events that happened while waiting for the TOKEN may have made 130 received or other events that happened while waiting for the
91 this message inappropriate or redundant. 131 "token" may have made this message inappropriate or redundant.
92 132
93 3. sender write LVB. 133 3. sender writes LVB.
94 sender down-convert MESSAGE from EX to CW 134 sender down-convert "message" from EX to CW
95 sender try to get EX of ACK 135 sender try to get EX of "ack"
96 [ wait until all receiver has *processed* the MESSAGE ] 136 [ wait until all receivers have *processed* the "message" ]
97 137
98 [ triggered by bast of ACK ] 138 [ triggered by bast of "ack" ]
99 receiver get CR of MESSAGE 139 receiver get CR on "message"
100 receiver read LVB 140 receiver read LVB
101 receiver processes the message 141 receiver processes the message
102 [ wait finish ] 142 [ wait finish ]
103 receiver release ACK 143 receiver releases "ack"
104 144 receiver tries to get PR on "message"
105 sender receiver receiver 145
106 TOKEN:EX MESSAGE:CR MESSAGE:CR 146 sender receiver receiver
107 MESSAGE:CR 147 "token":EX "message":CR "message":CR
108 ACK:EX 148 "message":CW
109 149 "ack":EX
110 4. triggered by grant of EX on ACK (indicating all receivers have processed 150
111 message) 151 4. triggered by grant of EX on "ack" (indicating all receivers
112 sender down-convert ACK from EX to CR 152 have processed message)
113 sender release MESSAGE 153 sender down-converts "ack" from EX to CR
114 sender release TOKEN 154 sender releases "message"
115 receiver upconvert to PR of MESSAGE 155 sender releases "token"
116 receiver get CR of ACK 156 receiver upconvert to PR on "message"
117 receiver release MESSAGE 157 receiver get CR of "ack"
158 receiver release "message"
118 159
119 sender receiver receiver 160 sender receiver receiver
120 ACK:CR ACK:CR ACK:CR 161 "ack":CR "ack":CR "ack":CR
121 162
122 163
1234. Handling Failures 1644. Handling Failures
124 165
1254.1 Node Failure 1664.1 Node Failure
126 When a node fails, the DLM informs the cluster with the slot. The node 167
127 starts a cluster recovery thread. The cluster recovery thread: 168 When a node fails, the DLM informs the cluster with the slot
169 number. The node starts a cluster recovery thread. The cluster
170 recovery thread:
171
128 - acquires the bitmap<number> lock of the failed node 172 - acquires the bitmap<number> lock of the failed node
129 - opens the bitmap 173 - opens the bitmap
130 - reads the bitmap of the failed node 174 - reads the bitmap of the failed node
@@ -132,45 +176,143 @@ The algorithm is:
132 - cleans the bitmap of the failed node 176 - cleans the bitmap of the failed node
133 - releases bitmap<number> lock of the failed node 177 - releases bitmap<number> lock of the failed node
134 - initiates resync of the bitmap on the current node 178 - initiates resync of the bitmap on the current node
179 md_check_recovery is invoked within recover_bitmaps,
180 then md_check_recovery -> metadata_update_start/finish,
181 it will lock the communication by lock_comm.
182 Which means when one node is resyncing it blocks all
183 other nodes from writing anywhere on the array.
135 184
136 The resync process, is the regular md resync. However, in a clustered 185 The resync process is the regular md resync. However, in a clustered
137 environment when a resync is performed, it needs to tell other nodes 186 environment when a resync is performed, it needs to tell other nodes
138 of the areas which are suspended. Before a resync starts, the node 187 of the areas which are suspended. Before a resync starts, the node
139 send out RESYNC_START with the (lo,hi) range of the area which needs 188 send out RESYNCING with the (lo,hi) range of the area which needs to
140 to be suspended. Each node maintains a suspend_list, which contains 189 be suspended. Each node maintains a suspend_list, which contains the
141 the list of ranges which are currently suspended. On receiving 190 list of ranges which are currently suspended. On receiving RESYNCING,
142 RESYNC_START, the node adds the range to the suspend_list. Similarly, 191 the node adds the range to the suspend_list. Similarly, when the node
143 when the node performing resync finishes, it send RESYNC_FINISHED 192 performing resync finishes, it sends RESYNCING with an empty range to
144 to other nodes and other nodes remove the corresponding entry from 193 other nodes and other nodes remove the corresponding entry from the
145 the suspend_list. 194 suspend_list.
146 195
147 A helper function, should_suspend() can be used to check if a particular 196 A helper function, ->area_resyncing() can be used to check if a
148 I/O range should be suspended or not. 197 particular I/O range should be suspended or not.
149 198
1504.2 Device Failure 1994.2 Device Failure
200
151 Device failures are handled and communicated with the metadata update 201 Device failures are handled and communicated with the metadata update
152 routine. 202 routine. When a node detects a device failure it does not allow
203 any further writes to that device until the failure has been
204 acknowledged by all other nodes.
153 205
1545. Adding a new Device 2065. Adding a new Device
155For adding a new device, it is necessary that all nodes "see" the new device 207
156to be added. For this, the following algorithm is used: 208 For adding a new device, it is necessary that all nodes "see" the new
209 device to be added. For this, the following algorithm is used:
157 210
158 1. Node 1 issues mdadm --manage /dev/mdX --add /dev/sdYY which issues 211 1. Node 1 issues mdadm --manage /dev/mdX --add /dev/sdYY which issues
159 ioctl(ADD_NEW_DISC with disc.state set to MD_DISK_CLUSTER_ADD) 212 ioctl(ADD_NEW_DISK with disc.state set to MD_DISK_CLUSTER_ADD)
160 2. Node 1 sends NEWDISK with uuid and slot number 213 2. Node 1 sends a NEWDISK message with uuid and slot number
161 3. Other nodes issue kobject_uevent_env with uuid and slot number 214 3. Other nodes issue kobject_uevent_env with uuid and slot number
162 (Steps 4,5 could be a udev rule) 215 (Steps 4,5 could be a udev rule)
163 4. In userspace, the node searches for the disk, perhaps 216 4. In userspace, the node searches for the disk, perhaps
164 using blkid -t SUB_UUID="" 217 using blkid -t SUB_UUID=""
165 5. Other nodes issue either of the following depending on whether the disk 218 5. Other nodes issue either of the following depending on whether
166 was found: 219 the disk was found:
167 ioctl(ADD_NEW_DISK with disc.state set to MD_DISK_CANDIDATE and 220 ioctl(ADD_NEW_DISK with disc.state set to MD_DISK_CANDIDATE and
168 disc.number set to slot number) 221 disc.number set to slot number)
169 ioctl(CLUSTERED_DISK_NACK) 222 ioctl(CLUSTERED_DISK_NACK)
170 6. Other nodes drop lock on no-new-devs (CR) if device is found 223 6. Other nodes drop lock on "no-new-devs" (CR) if device is found
171 7. Node 1 attempts EX lock on no-new-devs 224 7. Node 1 attempts EX lock on "no-new-dev"
172 8. If node 1 gets the lock, it sends METADATA_UPDATED after unmarking the disk 225 8. If node 1 gets the lock, it sends METADATA_UPDATED after
173 as SpareLocal 226 unmarking the disk as SpareLocal
174 9. If not (get no-new-dev lock), it fails the operation and sends METADATA_UPDATED 227 9. If not (get "no-new-dev" lock), it fails the operation and sends
175 10. Other nodes get the information whether a disk is added or not 228 METADATA_UPDATED.
176 by the following METADATA_UPDATED. 229 10. Other nodes get the information whether a disk is added or not
230 by the following METADATA_UPDATED.
231
2326. Module interface.
233
234 There are 17 call-backs which the md core can make to the cluster
235 module. Understanding these can give a good overview of the whole
236 process.
237
2386.1 join(nodes) and leave()
239
240 These are called when an array is started with a clustered bitmap,
241 and when the array is stopped. join() ensures the cluster is
242 available and initializes the various resources.
243 Only the first 'nodes' nodes in the cluster can use the array.
244
2456.2 slot_number()
246
247 Reports the slot number advised by the cluster infrastructure.
248 Range is from 0 to nodes-1.
249
2506.3 resync_info_update()
251
252 This updates the resync range that is stored in the bitmap lock.
253 The starting point is updated as the resync progresses. The
254 end point is always the end of the array.
255 It does *not* send a RESYNCING message.
256
2576.4 resync_start(), resync_finish()
258
259 These are called when resync/recovery/reshape starts or stops.
260 They update the resyncing range in the bitmap lock and also
261 send a RESYNCING message. resync_start reports the whole
262 array as resyncing, resync_finish reports none of it.
263
264 resync_finish() also sends a BITMAP_NEEDS_SYNC message which
265 allows some other node to take over.
266
2676.5 metadata_update_start(), metadata_update_finish(),
268 metadata_update_cancel().
269
270 metadata_update_start is used to get exclusive access to
271 the metadata. If a change is still needed once that access is
272 gained, metadata_update_finish() will send a METADATA_UPDATE
273 message to all other nodes, otherwise metadata_update_cancel()
274 can be used to release the lock.
275
2766.6 area_resyncing()
277
278 This combines two elements of functionality.
279
280 Firstly, it will check if any node is currently resyncing
281 anything in a given range of sectors. If any resync is found,
282 then the caller will avoid writing or read-balancing in that
283 range.
284
285 Secondly, while node recovery is happening it reports that
286 all areas are resyncing for READ requests. This avoids races
287 between the cluster-filesystem and the cluster-RAID handling
288 a node failure.
289
2906.7 add_new_disk_start(), add_new_disk_finish(), new_disk_ack()
291
292 These are used to manage the new-disk protocol described above.
293 When a new device is added, add_new_disk_start() is called before
294 it is bound to the array and, if that succeeds, add_new_disk_finish()
295 is called the device is fully added.
296
297 When a device is added in acknowledgement to a previous
298 request, or when the device is declared "unavailable",
299 new_disk_ack() is called.
300
3016.8 remove_disk()
302
303 This is called when a spare or failed device is removed from
304 the array. It causes a REMOVE message to be send to other nodes.
305
3066.9 gather_bitmaps()
307
308 This sends a RE_ADD message to all other nodes and then
309 gathers bitmap information from all bitmaps. This combined
310 bitmap is then used to recovery the re-added device.
311
3126.10 lock_all_bitmaps() and unlock_all_bitmaps()
313
314 These are called when change bitmap to none. If a node plans
315 to clear the cluster raid's bitmap, it need to make sure no other
316 nodes are using the raid which is achieved by lock all bitmap
317 locks within the cluster, and also those locks are unlocked
318 accordingly.
diff --git a/Documentation/media-framework.txt b/Documentation/media-framework.txt
deleted file mode 100644
index f552a75c0e70..000000000000
--- a/Documentation/media-framework.txt
+++ /dev/null
@@ -1,372 +0,0 @@
1Linux kernel media framework
2============================
3
4This document describes the Linux kernel media framework, its data structures,
5functions and their usage.
6
7
8Introduction
9------------
10
11The media controller API is documented in DocBook format in
12Documentation/DocBook/media/v4l/media-controller.xml. This document will focus
13on the kernel-side implementation of the media framework.
14
15
16Abstract media device model
17---------------------------
18
19Discovering a device internal topology, and configuring it at runtime, is one
20of the goals of the media framework. To achieve this, hardware devices are
21modelled as an oriented graph of building blocks called entities connected
22through pads.
23
24An entity is a basic media hardware building block. It can correspond to
25a large variety of logical blocks such as physical hardware devices
26(CMOS sensor for instance), logical hardware devices (a building block
27in a System-on-Chip image processing pipeline), DMA channels or physical
28connectors.
29
30A pad is a connection endpoint through which an entity can interact with
31other entities. Data (not restricted to video) produced by an entity
32flows from the entity's output to one or more entity inputs. Pads should
33not be confused with physical pins at chip boundaries.
34
35A link is a point-to-point oriented connection between two pads, either
36on the same entity or on different entities. Data flows from a source
37pad to a sink pad.
38
39
40Media device
41------------
42
43A media device is represented by a struct media_device instance, defined in
44include/media/media-device.h. Allocation of the structure is handled by the
45media device driver, usually by embedding the media_device instance in a
46larger driver-specific structure.
47
48Drivers register media device instances by calling
49
50 media_device_register(struct media_device *mdev);
51
52The caller is responsible for initializing the media_device structure before
53registration. The following fields must be set:
54
55 - dev must point to the parent device (usually a pci_dev, usb_interface or
56 platform_device instance).
57
58 - model must be filled with the device model name as a NUL-terminated UTF-8
59 string. The device/model revision must not be stored in this field.
60
61The following fields are optional:
62
63 - serial is a unique serial number stored as a NUL-terminated ASCII string.
64 The field is big enough to store a GUID in text form. If the hardware
65 doesn't provide a unique serial number this field must be left empty.
66
67 - bus_info represents the location of the device in the system as a
68 NUL-terminated ASCII string. For PCI/PCIe devices bus_info must be set to
69 "PCI:" (or "PCIe:") followed by the value of pci_name(). For USB devices,
70 the usb_make_path() function must be used. This field is used by
71 applications to distinguish between otherwise identical devices that don't
72 provide a serial number.
73
74 - hw_revision is the hardware device revision in a driver-specific format.
75 When possible the revision should be formatted with the KERNEL_VERSION
76 macro.
77
78 - driver_version is formatted with the KERNEL_VERSION macro. The version
79 minor must be incremented when new features are added to the userspace API
80 without breaking binary compatibility. The version major must be
81 incremented when binary compatibility is broken.
82
83Upon successful registration a character device named media[0-9]+ is created.
84The device major and minor numbers are dynamic. The model name is exported as
85a sysfs attribute.
86
87Drivers unregister media device instances by calling
88
89 media_device_unregister(struct media_device *mdev);
90
91Unregistering a media device that hasn't been registered is *NOT* safe.
92
93
94Entities, pads and links
95------------------------
96
97- Entities
98
99Entities are represented by a struct media_entity instance, defined in
100include/media/media-entity.h. The structure is usually embedded into a
101higher-level structure, such as a v4l2_subdev or video_device instance,
102although drivers can allocate entities directly.
103
104Drivers initialize entities by calling
105
106 media_entity_init(struct media_entity *entity, u16 num_pads,
107 struct media_pad *pads, u16 extra_links);
108
109The media_entity name, type, flags, revision and group_id fields can be
110initialized before or after calling media_entity_init. Entities embedded in
111higher-level standard structures can have some of those fields set by the
112higher-level framework.
113
114As the number of pads is known in advance, the pads array is not allocated
115dynamically but is managed by the entity driver. Most drivers will embed the
116pads array in a driver-specific structure, avoiding dynamic allocation.
117
118Drivers must set the direction of every pad in the pads array before calling
119media_entity_init. The function will initialize the other pads fields.
120
121Unlike the number of pads, the total number of links isn't always known in
122advance by the entity driver. As an initial estimate, media_entity_init
123pre-allocates a number of links equal to the number of pads plus an optional
124number of extra links. The links array will be reallocated if it grows beyond
125the initial estimate.
126
127Drivers register entities with a media device by calling
128
129 media_device_register_entity(struct media_device *mdev,
130 struct media_entity *entity);
131
132Entities are identified by a unique positive integer ID. Drivers can provide an
133ID by filling the media_entity id field prior to registration, or request the
134media controller framework to assign an ID automatically. Drivers that provide
135IDs manually must ensure that all IDs are unique. IDs are not guaranteed to be
136contiguous even when they are all assigned automatically by the framework.
137
138Drivers unregister entities by calling
139
140 media_device_unregister_entity(struct media_entity *entity);
141
142Unregistering an entity will not change the IDs of the other entities, and the
143ID will never be reused for a newly registered entity.
144
145When a media device is unregistered, all its entities are unregistered
146automatically. No manual entities unregistration is then required.
147
148Drivers free resources associated with an entity by calling
149
150 media_entity_cleanup(struct media_entity *entity);
151
152This function must be called during the cleanup phase after unregistering the
153entity. Note that the media_entity instance itself must be freed explicitly by
154the driver if required.
155
156Entities have flags that describe the entity capabilities and state.
157
158 MEDIA_ENT_FL_DEFAULT indicates the default entity for a given type.
159 This can be used to report the default audio and video devices or the
160 default camera sensor.
161
162Logical entity groups can be defined by setting the group ID of all member
163entities to the same non-zero value. An entity group serves no purpose in the
164kernel, but is reported to userspace during entities enumeration. The group_id
165field belongs to the media device driver and must not by touched by entity
166drivers.
167
168Media device drivers should define groups if several entities are logically
169bound together. Example usages include reporting
170
171 - ALSA, VBI and video nodes that carry the same media stream
172 - lens and flash controllers associated with a sensor
173
174- Pads
175
176Pads are represented by a struct media_pad instance, defined in
177include/media/media-entity.h. Each entity stores its pads in a pads array
178managed by the entity driver. Drivers usually embed the array in a
179driver-specific structure.
180
181Pads are identified by their entity and their 0-based index in the pads array.
182Both information are stored in the media_pad structure, making the media_pad
183pointer the canonical way to store and pass link references.
184
185Pads have flags that describe the pad capabilities and state.
186
187 MEDIA_PAD_FL_SINK indicates that the pad supports sinking data.
188 MEDIA_PAD_FL_SOURCE indicates that the pad supports sourcing data.
189
190One and only one of MEDIA_PAD_FL_SINK and MEDIA_PAD_FL_SOURCE must be set for
191each pad.
192
193- Links
194
195Links are represented by a struct media_link instance, defined in
196include/media/media-entity.h. Each entity stores all links originating at or
197targeting any of its pads in a links array. A given link is thus stored
198twice, once in the source entity and once in the target entity. The array is
199pre-allocated and grows dynamically as needed.
200
201Drivers create links by calling
202
203 media_entity_create_link(struct media_entity *source, u16 source_pad,
204 struct media_entity *sink, u16 sink_pad,
205 u32 flags);
206
207An entry in the link array of each entity is allocated and stores pointers
208to source and sink pads.
209
210Links have flags that describe the link capabilities and state.
211
212 MEDIA_LNK_FL_ENABLED indicates that the link is enabled and can be used
213 to transfer media data. When two or more links target a sink pad, only
214 one of them can be enabled at a time.
215 MEDIA_LNK_FL_IMMUTABLE indicates that the link enabled state can't be
216 modified at runtime. If MEDIA_LNK_FL_IMMUTABLE is set, then
217 MEDIA_LNK_FL_ENABLED must also be set since an immutable link is always
218 enabled.
219
220
221Graph traversal
222---------------
223
224The media framework provides APIs to iterate over entities in a graph.
225
226To iterate over all entities belonging to a media device, drivers can use the
227media_device_for_each_entity macro, defined in include/media/media-device.h.
228
229 struct media_entity *entity;
230
231 media_device_for_each_entity(entity, mdev) {
232 /* entity will point to each entity in turn */
233 ...
234 }
235
236Drivers might also need to iterate over all entities in a graph that can be
237reached only through enabled links starting at a given entity. The media
238framework provides a depth-first graph traversal API for that purpose.
239
240Note that graphs with cycles (whether directed or undirected) are *NOT*
241supported by the graph traversal API. To prevent infinite loops, the graph
242traversal code limits the maximum depth to MEDIA_ENTITY_ENUM_MAX_DEPTH,
243currently defined as 16.
244
245Drivers initiate a graph traversal by calling
246
247 media_entity_graph_walk_start(struct media_entity_graph *graph,
248 struct media_entity *entity);
249
250The graph structure, provided by the caller, is initialized to start graph
251traversal at the given entity.
252
253Drivers can then retrieve the next entity by calling
254
255 media_entity_graph_walk_next(struct media_entity_graph *graph);
256
257When the graph traversal is complete the function will return NULL.
258
259Graph traversal can be interrupted at any moment. No cleanup function call is
260required and the graph structure can be freed normally.
261
262Helper functions can be used to find a link between two given pads, or a pad
263connected to another pad through an enabled link
264
265 media_entity_find_link(struct media_pad *source,
266 struct media_pad *sink);
267
268 media_entity_remote_pad(struct media_pad *pad);
269
270Refer to the kerneldoc documentation for more information.
271
272
273Use count and power handling
274----------------------------
275
276Due to the wide differences between drivers regarding power management needs,
277the media controller does not implement power management. However, the
278media_entity structure includes a use_count field that media drivers can use to
279track the number of users of every entity for power management needs.
280
281The use_count field is owned by media drivers and must not be touched by entity
282drivers. Access to the field must be protected by the media device graph_mutex
283lock.
284
285
286Links setup
287-----------
288
289Link properties can be modified at runtime by calling
290
291 media_entity_setup_link(struct media_link *link, u32 flags);
292
293The flags argument contains the requested new link flags.
294
295The only configurable property is the ENABLED link flag to enable/disable a
296link. Links marked with the IMMUTABLE link flag can not be enabled or disabled.
297
298When a link is enabled or disabled, the media framework calls the
299link_setup operation for the two entities at the source and sink of the link,
300in that order. If the second link_setup call fails, another link_setup call is
301made on the first entity to restore the original link flags.
302
303Media device drivers can be notified of link setup operations by setting the
304media_device::link_notify pointer to a callback function. If provided, the
305notification callback will be called before enabling and after disabling
306links.
307
308Entity drivers must implement the link_setup operation if any of their links
309is non-immutable. The operation must either configure the hardware or store
310the configuration information to be applied later.
311
312Link configuration must not have any side effect on other links. If an enabled
313link at a sink pad prevents another link at the same pad from being enabled,
314the link_setup operation must return -EBUSY and can't implicitly disable the
315first enabled link.
316
317
318Pipelines and media streams
319---------------------------
320
321When starting streaming, drivers must notify all entities in the pipeline to
322prevent link states from being modified during streaming by calling
323
324 media_entity_pipeline_start(struct media_entity *entity,
325 struct media_pipeline *pipe);
326
327The function will mark all entities connected to the given entity through
328enabled links, either directly or indirectly, as streaming.
329
330The media_pipeline instance pointed to by the pipe argument will be stored in
331every entity in the pipeline. Drivers should embed the media_pipeline structure
332in higher-level pipeline structures and can then access the pipeline through
333the media_entity pipe field.
334
335Calls to media_entity_pipeline_start() can be nested. The pipeline pointer must
336be identical for all nested calls to the function.
337
338media_entity_pipeline_start() may return an error. In that case, it will
339clean up any of the changes it did by itself.
340
341When stopping the stream, drivers must notify the entities with
342
343 media_entity_pipeline_stop(struct media_entity *entity);
344
345If multiple calls to media_entity_pipeline_start() have been made the same
346number of media_entity_pipeline_stop() calls are required to stop streaming. The
347media_entity pipe field is reset to NULL on the last nested stop call.
348
349Link configuration will fail with -EBUSY by default if either end of the link is
350a streaming entity. Links that can be modified while streaming must be marked
351with the MEDIA_LNK_FL_DYNAMIC flag.
352
353If other operations need to be disallowed on streaming entities (such as
354changing entities configuration parameters) drivers can explicitly check the
355media_entity stream_count field to find out if an entity is streaming. This
356operation must be done with the media_device graph_mutex held.
357
358
359Link validation
360---------------
361
362Link validation is performed by media_entity_pipeline_start() for any
363entity which has sink pads in the pipeline. The
364media_entity::link_validate() callback is used for that purpose. In
365link_validate() callback, entity driver should check that the properties of
366the source pad of the connected entity and its own sink pad match. It is up
367to the type of the entity (and in the end, the properties of the hardware)
368what matching actually means.
369
370Subsystems should facilitate link validation by providing subsystem specific
371helper functions to provide easy access for commonly needed information, and
372in the end provide a way to use driver-specific callbacks.
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index aef9487303d0..904ee42d078e 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -194,7 +194,7 @@ There are some minimal guarantees that may be expected of a CPU:
194 (*) On any given CPU, dependent memory accesses will be issued in order, with 194 (*) On any given CPU, dependent memory accesses will be issued in order, with
195 respect to itself. This means that for: 195 respect to itself. This means that for:
196 196
197 WRITE_ONCE(Q, P); smp_read_barrier_depends(); D = READ_ONCE(*Q); 197 Q = READ_ONCE(P); smp_read_barrier_depends(); D = READ_ONCE(*Q);
198 198
199 the CPU will issue the following memory operations: 199 the CPU will issue the following memory operations:
200 200
@@ -202,9 +202,9 @@ There are some minimal guarantees that may be expected of a CPU:
202 202
203 and always in that order. On most systems, smp_read_barrier_depends() 203 and always in that order. On most systems, smp_read_barrier_depends()
204 does nothing, but it is required for DEC Alpha. The READ_ONCE() 204 does nothing, but it is required for DEC Alpha. The READ_ONCE()
205 and WRITE_ONCE() are required to prevent compiler mischief. Please 205 is required to prevent compiler mischief. Please note that you
206 note that you should normally use something like rcu_dereference() 206 should normally use something like rcu_dereference() instead of
207 instead of open-coding smp_read_barrier_depends(). 207 open-coding smp_read_barrier_depends().
208 208
209 (*) Overlapping loads and stores within a particular CPU will appear to be 209 (*) Overlapping loads and stores within a particular CPU will appear to be
210 ordered within that CPU. This means that for: 210 ordered within that CPU. This means that for:
@@ -1655,17 +1655,18 @@ macro is a good place to start looking.
1655SMP memory barriers are reduced to compiler barriers on uniprocessor compiled 1655SMP memory barriers are reduced to compiler barriers on uniprocessor compiled
1656systems because it is assumed that a CPU will appear to be self-consistent, 1656systems because it is assumed that a CPU will appear to be self-consistent,
1657and will order overlapping accesses correctly with respect to itself. 1657and will order overlapping accesses correctly with respect to itself.
1658However, see the subsection on "Virtual Machine Guests" below.
1658 1659
1659[!] Note that SMP memory barriers _must_ be used to control the ordering of 1660[!] Note that SMP memory barriers _must_ be used to control the ordering of
1660references to shared memory on SMP systems, though the use of locking instead 1661references to shared memory on SMP systems, though the use of locking instead
1661is sufficient. 1662is sufficient.
1662 1663
1663Mandatory barriers should not be used to control SMP effects, since mandatory 1664Mandatory barriers should not be used to control SMP effects, since mandatory
1664barriers unnecessarily impose overhead on UP systems. They may, however, be 1665barriers impose unnecessary overhead on both SMP and UP systems. They may,
1665used to control MMIO effects on accesses through relaxed memory I/O windows. 1666however, be used to control MMIO effects on accesses through relaxed memory I/O
1666These are required even on non-SMP systems as they affect the order in which 1667windows. These barriers are required even on non-SMP systems as they affect
1667memory operations appear to a device by prohibiting both the compiler and the 1668the order in which memory operations appear to a device by prohibiting both the
1668CPU from reordering them. 1669compiler and the CPU from reordering them.
1669 1670
1670 1671
1671There are some more advanced barrier functions: 1672There are some more advanced barrier functions:
@@ -1673,8 +1674,8 @@ There are some more advanced barrier functions:
1673 (*) smp_store_mb(var, value) 1674 (*) smp_store_mb(var, value)
1674 1675
1675 This assigns the value to the variable and then inserts a full memory 1676 This assigns the value to the variable and then inserts a full memory
1676 barrier after it, depending on the function. It isn't guaranteed to 1677 barrier after it. It isn't guaranteed to insert anything more than a
1677 insert anything more than a compiler barrier in a UP compilation. 1678 compiler barrier in a UP compilation.
1678 1679
1679 1680
1680 (*) smp_mb__before_atomic(); 1681 (*) smp_mb__before_atomic();
@@ -2948,6 +2949,23 @@ The Alpha defines the Linux kernel's memory barrier model.
2948 2949
2949See the subsection on "Cache Coherency" above. 2950See the subsection on "Cache Coherency" above.
2950 2951
2952VIRTUAL MACHINE GUESTS
2953-------------------
2954
2955Guests running within virtual machines might be affected by SMP effects even if
2956the guest itself is compiled without SMP support. This is an artifact of
2957interfacing with an SMP host while running an UP kernel. Using mandatory
2958barriers for this use-case would be possible but is often suboptimal.
2959
2960To handle this case optimally, low-level virt_mb() etc macros are available.
2961These have the same effect as smp_mb() etc when SMP is enabled, but generate
2962identical code for SMP and non-SMP systems. For example, virtual machine guests
2963should use virt_mb() rather than smp_mb() when synchronizing against a
2964(possibly SMP) host.
2965
2966These are equivalent to smp_mb() etc counterparts in all other respects,
2967in particular, they do not control MMIO effects: to control
2968MMIO effects, use mandatory barriers.
2951 2969
2952============ 2970============
2953EXAMPLE USES 2971EXAMPLE USES
diff --git a/Documentation/mtd/nand_ecc.txt b/Documentation/mtd/nand_ecc.txt
index e129b2479ea8..f8c3284bf6a7 100644
--- a/Documentation/mtd/nand_ecc.txt
+++ b/Documentation/mtd/nand_ecc.txt
@@ -107,7 +107,7 @@ for (i = 0; i < 256; i++)
107 if (i & 0x01) 107 if (i & 0x01)
108 rp1 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp1; 108 rp1 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp1;
109 else 109 else
110 rp0 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp1; 110 rp0 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp0;
111 if (i & 0x02) 111 if (i & 0x02)
112 rp3 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp3; 112 rp3 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp3;
113 else 113 else
@@ -127,7 +127,7 @@ for (i = 0; i < 256; i++)
127 if (i & 0x20) 127 if (i & 0x20)
128 rp11 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp11; 128 rp11 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp11;
129 else 129 else
130 rp10 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp10; 130 rp10 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp10;
131 if (i & 0x40) 131 if (i & 0x40)
132 rp13 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp13; 132 rp13 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp13;
133 else 133 else
@@ -158,7 +158,7 @@ the values in any order. So instead of calculating all the bits
158individually, let us try to rearrange things. 158individually, let us try to rearrange things.
159For the column parity this is easy. We can just xor the bytes and in the 159For the column parity this is easy. We can just xor the bytes and in the
160end filter out the relevant bits. This is pretty nice as it will bring 160end filter out the relevant bits. This is pretty nice as it will bring
161all cp calculation out of the if loop. 161all cp calculation out of the for loop.
162 162
163Similarly we can first xor the bytes for the various rows. 163Similarly we can first xor the bytes for the various rows.
164This leads to: 164This leads to:
@@ -271,11 +271,11 @@ to write our code in such a way that we process data in 32 bit chunks.
271Of course this means some modification as the row parity is byte by 271Of course this means some modification as the row parity is byte by
272byte. A quick analysis: 272byte. A quick analysis:
273for the column parity we use the par variable. When extending to 32 bits 273for the column parity we use the par variable. When extending to 32 bits
274we can in the end easily calculate p0 and p1 from it. 274we can in the end easily calculate rp0 and rp1 from it.
275(because par now consists of 4 bytes, contributing to rp1, rp0, rp1, rp0 275(because par now consists of 4 bytes, contributing to rp1, rp0, rp1, rp0
276respectively) 276respectively, from MSB to LSB)
277also rp2 and rp3 can be easily retrieved from par as rp3 covers the 277also rp2 and rp3 can be easily retrieved from par as rp3 covers the
278first two bytes and rp2 the last two bytes. 278first two MSBs and rp2 covers the last two LSBs.
279 279
280Note that of course now the loop is executed only 64 times (256/4). 280Note that of course now the loop is executed only 64 times (256/4).
281And note that care must taken wrt byte ordering. The way bytes are 281And note that care must taken wrt byte ordering. The way bytes are
@@ -387,11 +387,11 @@ Analysis 2
387 387
388The code (of course) works, and hurray: we are a little bit faster than 388The code (of course) works, and hurray: we are a little bit faster than
389the linux driver code (about 15%). But wait, don't cheer too quickly. 389the linux driver code (about 15%). But wait, don't cheer too quickly.
390THere is more to be gained. 390There is more to be gained.
391If we look at e.g. rp14 and rp15 we see that we either xor our data with 391If we look at e.g. rp14 and rp15 we see that we either xor our data with
392rp14 or with rp15. However we also have par which goes over all data. 392rp14 or with rp15. However we also have par which goes over all data.
393This means there is no need to calculate rp14 as it can be calculated from 393This means there is no need to calculate rp14 as it can be calculated from
394rp15 through rp14 = par ^ rp15; 394rp15 through rp14 = par ^ rp15, because par = rp14 ^ rp15;
395(or if desired we can avoid calculating rp15 and calculate it from 395(or if desired we can avoid calculating rp15 and calculate it from
396rp14). That is why some places refer to inverse parity. 396rp14). That is why some places refer to inverse parity.
397Of course the same thing holds for rp4/5, rp6/7, rp8/9, rp10/11 and rp12/13. 397Of course the same thing holds for rp4/5, rp6/7, rp8/9, rp10/11 and rp12/13.
@@ -419,12 +419,12 @@ with
419 if (i & 0x20) rp15 ^= cur; 419 if (i & 0x20) rp15 ^= cur;
420 420
421 and outside the loop added: 421 and outside the loop added:
422 rp4 = par ^ rp5; 422 rp4 = par ^ rp5;
423 rp6 = par ^ rp7; 423 rp6 = par ^ rp7;
424 rp8 = par ^ rp9; 424 rp8 = par ^ rp9;
425 rp10 = par ^ rp11; 425 rp10 = par ^ rp11;
426 rp12 = par ^ rp13; 426 rp12 = par ^ rp13;
427 rp14 = par ^ rp15; 427 rp14 = par ^ rp15;
428 428
429And after that the code takes about 30% more time, although the number of 429And after that the code takes about 30% more time, although the number of
430statements is reduced. This is also reflected in the assembly code. 430statements is reduced. This is also reflected in the assembly code.
@@ -524,12 +524,12 @@ THe code within the for loop was changed to:
524 524
525 cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; 525 cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur;
526 cur = *bp++; tmppar ^= cur; rp6 ^= cur; 526 cur = *bp++; tmppar ^= cur; rp6 ^= cur;
527 cur = *bp++; tmppar ^= cur; rp4 ^= cur; 527 cur = *bp++; tmppar ^= cur; rp4 ^= cur;
528 cur = *bp++; tmppar ^= cur; rp10 ^= tmppar; 528 cur = *bp++; tmppar ^= cur; rp10 ^= tmppar;
529 529
530 cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; rp8 ^= cur; 530 cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; rp8 ^= cur;
531 cur = *bp++; tmppar ^= cur; rp6 ^= cur; rp8 ^= cur; 531 cur = *bp++; tmppar ^= cur; rp6 ^= cur; rp8 ^= cur;
532 cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp8 ^= cur; 532 cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp8 ^= cur;
533 cur = *bp++; tmppar ^= cur; rp8 ^= cur; 533 cur = *bp++; tmppar ^= cur; rp8 ^= cur;
534 534
535 cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; 535 cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur;
@@ -537,7 +537,7 @@ THe code within the for loop was changed to:
537 cur = *bp++; tmppar ^= cur; rp4 ^= cur; 537 cur = *bp++; tmppar ^= cur; rp4 ^= cur;
538 cur = *bp++; tmppar ^= cur; 538 cur = *bp++; tmppar ^= cur;
539 539
540 par ^= tmppar; 540 par ^= tmppar;
541 if ((i & 0x1) == 0) rp12 ^= tmppar; 541 if ((i & 0x1) == 0) rp12 ^= tmppar;
542 if ((i & 0x2) == 0) rp14 ^= tmppar; 542 if ((i & 0x2) == 0) rp14 ^= tmppar;
543 } 543 }
@@ -548,8 +548,8 @@ to rp12 and rp14.
548 548
549While making the changes I also found that I could exploit that tmppar 549While making the changes I also found that I could exploit that tmppar
550contains the running parity for this iteration. So instead of having: 550contains the running parity for this iteration. So instead of having:
551rp4 ^= cur; rp6 = cur; 551rp4 ^= cur; rp6 ^= cur;
552I removed the rp6 = cur; statement and did rp6 ^= tmppar; on next 552I removed the rp6 ^= cur; statement and did rp6 ^= tmppar; on next
553statement. A similar change was done for rp8 and rp10 553statement. A similar change was done for rp8 and rp10
554 554
555 555
@@ -593,22 +593,22 @@ The new code now looks like:
593 593
594 cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; 594 cur = *bp++; tmppar ^= cur; rp4_6 ^= cur;
595 cur = *bp++; tmppar ^= cur; rp6 ^= cur; 595 cur = *bp++; tmppar ^= cur; rp6 ^= cur;
596 cur = *bp++; tmppar ^= cur; rp4 ^= cur; 596 cur = *bp++; tmppar ^= cur; rp4 ^= cur;
597 cur = *bp++; tmppar ^= cur; rp10 ^= tmppar; 597 cur = *bp++; tmppar ^= cur; rp10 ^= tmppar;
598 598
599 notrp8 = tmppar; 599 notrp8 = tmppar;
600 cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; 600 cur = *bp++; tmppar ^= cur; rp4_6 ^= cur;
601 cur = *bp++; tmppar ^= cur; rp6 ^= cur; 601 cur = *bp++; tmppar ^= cur; rp6 ^= cur;
602 cur = *bp++; tmppar ^= cur; rp4 ^= cur; 602 cur = *bp++; tmppar ^= cur; rp4 ^= cur;
603 cur = *bp++; tmppar ^= cur; 603 cur = *bp++; tmppar ^= cur;
604 rp8 = rp8 ^ tmppar ^ notrp8; 604 rp8 = rp8 ^ tmppar ^ notrp8;
605 605
606 cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; 606 cur = *bp++; tmppar ^= cur; rp4_6 ^= cur;
607 cur = *bp++; tmppar ^= cur; rp6 ^= cur; 607 cur = *bp++; tmppar ^= cur; rp6 ^= cur;
608 cur = *bp++; tmppar ^= cur; rp4 ^= cur; 608 cur = *bp++; tmppar ^= cur; rp4 ^= cur;
609 cur = *bp++; tmppar ^= cur; 609 cur = *bp++; tmppar ^= cur;
610 610
611 par ^= tmppar; 611 par ^= tmppar;
612 if ((i & 0x1) == 0) rp12 ^= tmppar; 612 if ((i & 0x1) == 0) rp12 ^= tmppar;
613 if ((i & 0x2) == 0) rp14 ^= tmppar; 613 if ((i & 0x2) == 0) rp14 ^= tmppar;
614 } 614 }
@@ -700,7 +700,7 @@ Conclusion
700The gain when calculating the ecc is tremendous. Om my development hardware 700The gain when calculating the ecc is tremendous. Om my development hardware
701a speedup of a factor of 18 for ecc calculation was achieved. On a test on an 701a speedup of a factor of 18 for ecc calculation was achieved. On a test on an
702embedded system with a MIPS core a factor 7 was obtained. 702embedded system with a MIPS core a factor 7 was obtained.
703On a test with a Linksys NSLU2 (ARMv5TE processor) the speedup was a factor 703On a test with a Linksys NSLU2 (ARMv5TE processor) the speedup was a factor
7045 (big endian mode, gcc 4.1.2, -O3) 7045 (big endian mode, gcc 4.1.2, -O3)
705For correction not much gain could be obtained (as bitflips are rare). Then 705For correction not much gain could be obtained (as bitflips are rare). Then
706again there are also much less cycles spent there. 706again there are also much less cycles spent there.
diff --git a/Documentation/networking/batman-adv.txt b/Documentation/networking/batman-adv.txt
index 58e49042fc20..ff23b755f5e4 100644
--- a/Documentation/networking/batman-adv.txt
+++ b/Documentation/networking/batman-adv.txt
@@ -115,14 +115,17 @@ The "bat0" interface can be used like any other regular inter-
115face. It needs an IP address which can be either statically con- 115face. It needs an IP address which can be either statically con-
116figured or dynamically (by using DHCP or similar services): 116figured or dynamically (by using DHCP or similar services):
117 117
118# NodeA: ifconfig bat0 192.168.0.1 118# NodeA: ip link set up dev bat0
119# NodeB: ifconfig bat0 192.168.0.2 119# NodeA: ip addr add 192.168.0.1/24 dev bat0
120
121# NodeB: ip link set up dev bat0
122# NodeB: ip addr add 192.168.0.2/24 dev bat0
120# NodeB: ping 192.168.0.1 123# NodeB: ping 192.168.0.1
121 124
122Note: In order to avoid problems remove all IP addresses previ- 125Note: In order to avoid problems remove all IP addresses previ-
123ously assigned to interfaces now used by batman advanced, e.g. 126ously assigned to interfaces now used by batman advanced, e.g.
124 127
125# ifconfig eth0 0.0.0.0 128# ip addr flush dev eth0
126 129
127 130
128LOGGING/DEBUGGING 131LOGGING/DEBUGGING
diff --git a/Documentation/networking/can.txt b/Documentation/networking/can.txt
index 05fd83bb3596..6ab619fcc517 100644
--- a/Documentation/networking/can.txt
+++ b/Documentation/networking/can.txt
@@ -372,6 +372,15 @@ solution for a couple of reasons:
372 nbytes = sendto(s, &frame, sizeof(struct can_frame), 372 nbytes = sendto(s, &frame, sizeof(struct can_frame),
373 0, (struct sockaddr*)&addr, sizeof(addr)); 373 0, (struct sockaddr*)&addr, sizeof(addr));
374 374
375 An accurate timestamp can be obtained with an ioctl(2) call after reading
376 a message from the socket:
377
378 struct timeval tv;
379 ioctl(s, SIOCGSTAMP, &tv);
380
381 The timestamp has a resolution of one microsecond and is set automatically
382 at the reception of a CAN frame.
383
375 Remark about CAN FD (flexible data rate) support: 384 Remark about CAN FD (flexible data rate) support:
376 385
377 Generally the handling of CAN FD is very similar to the formerly described 386 Generally the handling of CAN FD is very similar to the formerly described
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 2ea4c45cf1c8..ceb44a095a27 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -335,6 +335,14 @@ tcp_keepalive_intvl - INTEGER
335 after probes started. Default value: 75sec i.e. connection 335 after probes started. Default value: 75sec i.e. connection
336 will be aborted after ~11 minutes of retries. 336 will be aborted after ~11 minutes of retries.
337 337
338tcp_l3mdev_accept - BOOLEAN
339 Enables child sockets to inherit the L3 master device index.
340 Enabling this option allows a "global" listen socket to work
341 across L3 master domains (e.g., VRFs) with connected sockets
342 derived from the listen socket to be bound to the L3 domain in
343 which the packets originated. Only valid when the kernel was
344 compiled with CONFIG_NET_L3_MASTER_DEV.
345
338tcp_low_latency - BOOLEAN 346tcp_low_latency - BOOLEAN
339 If set, the TCP stack makes decisions that prefer lower 347 If set, the TCP stack makes decisions that prefer lower
340 latency as opposed to higher throughput. By default, this 348 latency as opposed to higher throughput. By default, this
@@ -1723,6 +1731,25 @@ addip_enable - BOOLEAN
1723 1731
1724 Default: 0 1732 Default: 0
1725 1733
1734pf_enable - INTEGER
1735 Enable or disable pf (pf is short for potentially failed) state. A value
1736 of pf_retrans > path_max_retrans also disables pf state. That is, one of
1737 both pf_enable and pf_retrans > path_max_retrans can disable pf state.
1738 Since pf_retrans and path_max_retrans can be changed by userspace
1739 application, sometimes user expects to disable pf state by the value of
1740 pf_retrans > path_max_retrans, but occasionally the value of pf_retrans
1741 or path_max_retrans is changed by the user application, this pf state is
1742 enabled. As such, it is necessary to add this to dynamically enable
1743 and disable pf state. See:
1744 https://datatracker.ietf.org/doc/draft-ietf-tsvwg-sctp-failover for
1745 details.
1746
1747 1: Enable pf.
1748
1749 0: Disable pf.
1750
1751 Default: 1
1752
1726addip_noauth_enable - BOOLEAN 1753addip_noauth_enable - BOOLEAN
1727 Dynamic Address Reconfiguration (ADD-IP) requires the use of 1754 Dynamic Address Reconfiguration (ADD-IP) requires the use of
1728 authentication to protect the operations of adding or removing new 1755 authentication to protect the operations of adding or removing new
@@ -1799,7 +1826,9 @@ pf_retrans - INTEGER
1799 having to reduce path_max_retrans to a very low value. See: 1826 having to reduce path_max_retrans to a very low value. See:
1800 http://www.ietf.org/id/draft-nishida-tsvwg-sctp-failover-05.txt 1827 http://www.ietf.org/id/draft-nishida-tsvwg-sctp-failover-05.txt
1801 for details. Note also that a value of pf_retrans > path_max_retrans 1828 for details. Note also that a value of pf_retrans > path_max_retrans
1802 disables this feature 1829 disables this feature. Since both pf_retrans and path_max_retrans can
1830 be changed by userspace application, a variable pf_enable is used to
1831 disable pf state.
1803 1832
1804 Default: 0 1833 Default: 0
1805 1834
diff --git a/Documentation/networking/switchdev.txt b/Documentation/networking/switchdev.txt
index 91994134efca..fad63136ee3e 100644
--- a/Documentation/networking/switchdev.txt
+++ b/Documentation/networking/switchdev.txt
@@ -304,8 +304,12 @@ certain netdevs from flooding unicast traffic for which there is no FDB entry.
304IGMP Snooping 304IGMP Snooping
305^^^^^^^^^^^^^ 305^^^^^^^^^^^^^
306 306
307XXX: complete this section 307In order to support IGMP snooping, the port netdevs should trap to the bridge
308 308driver all IGMP join and leave messages.
309The bridge multicast module will notify port netdevs on every multicast group
310changed whether it is static configured or dynamically joined/leave.
311The hardware implementation should be forwarding all registered multicast
312traffic groups only to the configured ports.
309 313
310L3 Routing Offload 314L3 Routing Offload
311------------------ 315------------------
diff --git a/Documentation/power/pci.txt b/Documentation/power/pci.txt
index b0e911e0e8f5..44558882aa60 100644
--- a/Documentation/power/pci.txt
+++ b/Documentation/power/pci.txt
@@ -999,7 +999,7 @@ from its probe routine to make runtime PM work for the device.
999 999
1000It is important to remember that the driver's runtime_suspend() callback 1000It is important to remember that the driver's runtime_suspend() callback
1001may be executed right after the usage counter has been decremented, because 1001may be executed right after the usage counter has been decremented, because
1002user space may already have cuased the pm_runtime_allow() helper function 1002user space may already have caused the pm_runtime_allow() helper function
1003unblocking the runtime PM of the device to run via sysfs, so the driver must 1003unblocking the runtime PM of the device to run via sysfs, so the driver must
1004be prepared to cope with that. 1004be prepared to cope with that.
1005 1005
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt
index 0784bc3a2ab5..7328cf85236c 100644
--- a/Documentation/power/runtime_pm.txt
+++ b/Documentation/power/runtime_pm.txt
@@ -371,6 +371,12 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
371 - increment the device's usage counter, run pm_runtime_resume(dev) and 371 - increment the device's usage counter, run pm_runtime_resume(dev) and
372 return its result 372 return its result
373 373
374 int pm_runtime_get_if_in_use(struct device *dev);
375 - return -EINVAL if 'power.disable_depth' is nonzero; otherwise, if the
376 runtime PM status is RPM_ACTIVE and the runtime PM usage counter is
377 nonzero, increment the counter and return 1; otherwise return 0 without
378 changing the counter
379
374 void pm_runtime_put_noidle(struct device *dev); 380 void pm_runtime_put_noidle(struct device *dev);
375 - decrement the device's usage counter 381 - decrement the device's usage counter
376 382
diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
index b784c270105f..5d1128bf0282 100644
--- a/Documentation/printk-formats.txt
+++ b/Documentation/printk-formats.txt
@@ -250,6 +250,12 @@ dentry names:
250 250
251 Passed by reference. 251 Passed by reference.
252 252
253block_device names:
254
255 %pg sda, sda1 or loop0p1
256
257 For printing name of block_device pointers.
258
253struct va_format: 259struct va_format:
254 260
255 %pV 261 %pV
@@ -300,15 +306,6 @@ Network device features:
300 306
301 Passed by reference. 307 Passed by reference.
302 308
303Command from struct task_struct
304
305 %pT ls
306
307 For printing executable name excluding path from struct
308 task_struct.
309
310 Passed by reference.
311
312If you add other %p extensions, please extend lib/test_printf.c with 309If you add other %p extensions, please extend lib/test_printf.c with
313one or more test cases, if at all feasible. 310one or more test cases, if at all feasible.
314 311
diff --git a/Documentation/s390/zfcpdump.txt b/Documentation/s390/zfcpdump.txt
index dc929be96016..b064aa59714d 100644
--- a/Documentation/s390/zfcpdump.txt
+++ b/Documentation/s390/zfcpdump.txt
@@ -15,19 +15,15 @@ the s390-tools package) to make the device bootable. The operator of a Linux
15system can then trigger a SCSI dump by booting the SCSI disk, where zfcpdump 15system can then trigger a SCSI dump by booting the SCSI disk, where zfcpdump
16resides on. 16resides on.
17 17
18The kernel part of zfcpdump is implemented as a debugfs file under "zcore/mem", 18The user space dump tool accesses the memory of the crashed system by means
19which exports memory and registers of the crashed Linux in an s390 19of the /proc/vmcore interface. This interface exports the crashed system's
20standalone dump format. It can be used in the same way as e.g. /dev/mem. The 20memory and registers in ELF core dump format. To access the memory which has
21dump format defines a 4K header followed by plain uncompressed memory. The 21been saved by the hardware SCLP requests will be created at the time the data
22register sets are stored in the prefix pages of the respective CPUs. To build a 22is needed by /proc/vmcore. The tail part of the crashed systems memory which
23dump enabled kernel with the zcore driver, the kernel config option 23has not been stashed by hardware can just be copied from real memory.
24CONFIG_CRASH_DUMP has to be set. When reading from "zcore/mem", the part of 24
25memory, which has been saved by hardware is read by the driver via the SCLP 25To build a dump enabled kernel the kernel config option CONFIG_CRASH_DUMP
26hardware interface. The second part is just copied from the non overwritten real 26has to be set.
27memory.
28
29Since kernel version 3.12 also the /proc/vmcore file can also be used to access
30the dump.
31 27
32To get a valid zfcpdump kernel configuration use "make zfcpdump_defconfig". 28To get a valid zfcpdump kernel configuration use "make zfcpdump_defconfig".
33 29
diff --git a/Documentation/security/keys-trusted-encrypted.txt b/Documentation/security/keys-trusted-encrypted.txt
index e105ae97a4f5..324ddf5223b3 100644
--- a/Documentation/security/keys-trusted-encrypted.txt
+++ b/Documentation/security/keys-trusted-encrypted.txt
@@ -27,17 +27,26 @@ Usage:
27 keyctl print keyid 27 keyctl print keyid
28 28
29 options: 29 options:
30 keyhandle= ascii hex value of sealing key default 0x40000000 (SRK) 30 keyhandle= ascii hex value of sealing key default 0x40000000 (SRK)
31 keyauth= ascii hex auth for sealing key default 0x00...i 31 keyauth= ascii hex auth for sealing key default 0x00...i
32 (40 ascii zeros) 32 (40 ascii zeros)
33 blobauth= ascii hex auth for sealed data default 0x00... 33 blobauth= ascii hex auth for sealed data default 0x00...
34 (40 ascii zeros) 34 (40 ascii zeros)
35 blobauth= ascii hex auth for sealed data default 0x00... 35 blobauth= ascii hex auth for sealed data default 0x00...
36 (40 ascii zeros) 36 (40 ascii zeros)
37 pcrinfo= ascii hex of PCR_INFO or PCR_INFO_LONG (no default) 37 pcrinfo= ascii hex of PCR_INFO or PCR_INFO_LONG (no default)
38 pcrlock= pcr number to be extended to "lock" blob 38 pcrlock= pcr number to be extended to "lock" blob
39 migratable= 0|1 indicating permission to reseal to new PCR values, 39 migratable= 0|1 indicating permission to reseal to new PCR values,
40 default 1 (resealing allowed) 40 default 1 (resealing allowed)
41 hash= hash algorithm name as a string. For TPM 1.x the only
42 allowed value is sha1. For TPM 2.x the allowed values
43 are sha1, sha256, sha384, sha512 and sm3-256.
44 policydigest= digest for the authorization policy. must be calculated
45 with the same hash algorithm as specified by the 'hash='
46 option.
47 policyhandle= handle to an authorization policy session that defines the
48 same policy and with the same hash algorithm as was used to
49 seal the key.
41 50
42"keyctl print" returns an ascii hex copy of the sealed key, which is in standard 51"keyctl print" returns an ascii hex copy of the sealed key, which is in standard
43TPM_STORED_DATA format. The key length for new keys are always in bytes. 52TPM_STORED_DATA format. The key length for new keys are always in bytes.
diff --git a/Documentation/sound/alsa/img,spdif-in.txt b/Documentation/sound/alsa/img,spdif-in.txt
new file mode 100644
index 000000000000..8b7505785fa6
--- /dev/null
+++ b/Documentation/sound/alsa/img,spdif-in.txt
@@ -0,0 +1,49 @@
1The Imagination Technologies SPDIF Input controller contains the following
2controls:
3
4name='IEC958 Capture Mask',index=0
5
6This control returns a mask that shows which of the IEC958 status bits
7can be read using the 'IEC958 Capture Default' control.
8
9name='IEC958 Capture Default',index=0
10
11This control returns the status bits contained within the SPDIF stream that
12is being received. The 'IEC958 Capture Mask' shows which bits can be read
13from this control.
14
15name='SPDIF In Multi Frequency Acquire',index=0
16name='SPDIF In Multi Frequency Acquire',index=1
17name='SPDIF In Multi Frequency Acquire',index=2
18name='SPDIF In Multi Frequency Acquire',index=3
19
20This control is used to attempt acquisition of up to four different sample
21rates. The active rate can be obtained by reading the 'SPDIF In Lock Frequency'
22control.
23
24When the value of this control is set to {0,0,0,0}, the rate given to hw_params
25will determine the single rate the block will capture. Else, the rate given to
26hw_params will be ignored, and the block will attempt capture for each of the
27four sample rates set here.
28
29If less than four rates are required, the same rate can be specified more than
30once
31
32name='SPDIF In Lock Frequency',index=0
33
34This control returns the active capture rate, or 0 if a lock has not been
35acquired
36
37name='SPDIF In Lock TRK',index=0
38
39This control is used to modify the locking/jitter rejection characteristics
40of the block. Larger values increase the locking range, but reduce jitter
41rejection.
42
43name='SPDIF In Lock Acquire Threshold',index=0
44
45This control is used to change the threshold at which a lock is acquired.
46
47name='SPDIF In Lock Release Threshold',index=0
48
49This control is used to change the threshold at which a lock is released.
diff --git a/Documentation/spi/.gitignore b/Documentation/spi/.gitignore
deleted file mode 100644
index 4280576397e8..000000000000
--- a/Documentation/spi/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
1spidev_fdx
2spidev_test
diff --git a/Documentation/spi/00-INDEX b/Documentation/spi/00-INDEX
index a128fa835512..4644bf0d9832 100644
--- a/Documentation/spi/00-INDEX
+++ b/Documentation/spi/00-INDEX
@@ -10,13 +10,9 @@ pxa2xx
10 - PXA2xx SPI master controller build by spi_message fifo wq 10 - PXA2xx SPI master controller build by spi_message fifo wq
11spidev 11spidev
12 - Intro to the userspace API for spi devices 12 - Intro to the userspace API for spi devices
13spidev_fdx.c
14 - spidev example file
15spi-lm70llp 13spi-lm70llp
16 - Connecting an LM70-LLP sensor to the kernel via the SPI subsys. 14 - Connecting an LM70-LLP sensor to the kernel via the SPI subsys.
17spi-sc18is602 15spi-sc18is602
18 - NXP SC18IS602/603 I2C-bus to SPI bridge 16 - NXP SC18IS602/603 I2C-bus to SPI bridge
19spi-summary 17spi-summary
20 - (Linux) SPI overview. If unsure about SPI or SPI in Linux, start here. 18 - (Linux) SPI overview. If unsure about SPI or SPI in Linux, start here.
21spidev_test.c
22 - SPI testing utility.
diff --git a/Documentation/spi/Makefile b/Documentation/spi/Makefile
deleted file mode 100644
index efa255813e9d..000000000000
--- a/Documentation/spi/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
1# List of programs to build
2hostprogs-y := spidev_test spidev_fdx
3
4# Tell kbuild to always build the programs
5always := $(hostprogs-y)
6
7HOSTCFLAGS_spidev_test.o += -I$(objtree)/usr/include
8HOSTCFLAGS_spidev_fdx.o += -I$(objtree)/usr/include
diff --git a/Documentation/spi/spidev_fdx.c b/Documentation/spi/spidev_fdx.c
deleted file mode 100644
index 0ea3e51292fc..000000000000
--- a/Documentation/spi/spidev_fdx.c
+++ /dev/null
@@ -1,158 +0,0 @@
1#include <stdio.h>
2#include <unistd.h>
3#include <stdlib.h>
4#include <fcntl.h>
5#include <string.h>
6
7#include <sys/ioctl.h>
8#include <sys/types.h>
9#include <sys/stat.h>
10
11#include <linux/types.h>
12#include <linux/spi/spidev.h>
13
14
15static int verbose;
16
17static void do_read(int fd, int len)
18{
19 unsigned char buf[32], *bp;
20 int status;
21
22 /* read at least 2 bytes, no more than 32 */
23 if (len < 2)
24 len = 2;
25 else if (len > sizeof(buf))
26 len = sizeof(buf);
27 memset(buf, 0, sizeof buf);
28
29 status = read(fd, buf, len);
30 if (status < 0) {
31 perror("read");
32 return;
33 }
34 if (status != len) {
35 fprintf(stderr, "short read\n");
36 return;
37 }
38
39 printf("read(%2d, %2d): %02x %02x,", len, status,
40 buf[0], buf[1]);
41 status -= 2;
42 bp = buf + 2;
43 while (status-- > 0)
44 printf(" %02x", *bp++);
45 printf("\n");
46}
47
48static void do_msg(int fd, int len)
49{
50 struct spi_ioc_transfer xfer[2];
51 unsigned char buf[32], *bp;
52 int status;
53
54 memset(xfer, 0, sizeof xfer);
55 memset(buf, 0, sizeof buf);
56
57 if (len > sizeof buf)
58 len = sizeof buf;
59
60 buf[0] = 0xaa;
61 xfer[0].tx_buf = (unsigned long)buf;
62 xfer[0].len = 1;
63
64 xfer[1].rx_buf = (unsigned long) buf;
65 xfer[1].len = len;
66
67 status = ioctl(fd, SPI_IOC_MESSAGE(2), xfer);
68 if (status < 0) {
69 perror("SPI_IOC_MESSAGE");
70 return;
71 }
72
73 printf("response(%2d, %2d): ", len, status);
74 for (bp = buf; len; len--)
75 printf(" %02x", *bp++);
76 printf("\n");
77}
78
79static void dumpstat(const char *name, int fd)
80{
81 __u8 lsb, bits;
82 __u32 mode, speed;
83
84 if (ioctl(fd, SPI_IOC_RD_MODE32, &mode) < 0) {
85 perror("SPI rd_mode");
86 return;
87 }
88 if (ioctl(fd, SPI_IOC_RD_LSB_FIRST, &lsb) < 0) {
89 perror("SPI rd_lsb_fist");
90 return;
91 }
92 if (ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits) < 0) {
93 perror("SPI bits_per_word");
94 return;
95 }
96 if (ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) < 0) {
97 perror("SPI max_speed_hz");
98 return;
99 }
100
101 printf("%s: spi mode 0x%x, %d bits %sper word, %d Hz max\n",
102 name, mode, bits, lsb ? "(lsb first) " : "", speed);
103}
104
105int main(int argc, char **argv)
106{
107 int c;
108 int readcount = 0;
109 int msglen = 0;
110 int fd;
111 const char *name;
112
113 while ((c = getopt(argc, argv, "hm:r:v")) != EOF) {
114 switch (c) {
115 case 'm':
116 msglen = atoi(optarg);
117 if (msglen < 0)
118 goto usage;
119 continue;
120 case 'r':
121 readcount = atoi(optarg);
122 if (readcount < 0)
123 goto usage;
124 continue;
125 case 'v':
126 verbose++;
127 continue;
128 case 'h':
129 case '?':
130usage:
131 fprintf(stderr,
132 "usage: %s [-h] [-m N] [-r N] /dev/spidevB.D\n",
133 argv[0]);
134 return 1;
135 }
136 }
137
138 if ((optind + 1) != argc)
139 goto usage;
140 name = argv[optind];
141
142 fd = open(name, O_RDWR);
143 if (fd < 0) {
144 perror("open");
145 return 1;
146 }
147
148 dumpstat(name, fd);
149
150 if (msglen)
151 do_msg(fd, msglen);
152
153 if (readcount)
154 do_read(fd, readcount);
155
156 close(fd);
157 return 0;
158}
diff --git a/Documentation/spi/spidev_test.c b/Documentation/spi/spidev_test.c
deleted file mode 100644
index 135b3f592b83..000000000000
--- a/Documentation/spi/spidev_test.c
+++ /dev/null
@@ -1,318 +0,0 @@
1/*
2 * SPI testing utility (using spidev driver)
3 *
4 * Copyright (c) 2007 MontaVista Software, Inc.
5 * Copyright (c) 2007 Anton Vorontsov <avorontsov@ru.mvista.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.
10 *
11 * Cross-compile with cross-gcc -I/path/to/cross-kernel/include
12 */
13
14#include <stdint.h>
15#include <unistd.h>
16#include <stdio.h>
17#include <stdlib.h>
18#include <string.h>
19#include <getopt.h>
20#include <fcntl.h>
21#include <sys/ioctl.h>
22#include <linux/types.h>
23#include <linux/spi/spidev.h>
24
25#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
26
27static void pabort(const char *s)
28{
29 perror(s);
30 abort();
31}
32
33static const char *device = "/dev/spidev1.1";
34static uint32_t mode;
35static uint8_t bits = 8;
36static uint32_t speed = 500000;
37static uint16_t delay;
38static int verbose;
39
40uint8_t default_tx[] = {
41 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
42 0x40, 0x00, 0x00, 0x00, 0x00, 0x95,
43 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
44 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
45 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
46 0xF0, 0x0D,
47};
48
49uint8_t default_rx[ARRAY_SIZE(default_tx)] = {0, };
50char *input_tx;
51
52static void hex_dump(const void *src, size_t length, size_t line_size, char *prefix)
53{
54 int i = 0;
55 const unsigned char *address = src;
56 const unsigned char *line = address;
57 unsigned char c;
58
59 printf("%s | ", prefix);
60 while (length-- > 0) {
61 printf("%02X ", *address++);
62 if (!(++i % line_size) || (length == 0 && i % line_size)) {
63 if (length == 0) {
64 while (i++ % line_size)
65 printf("__ ");
66 }
67 printf(" | "); /* right close */
68 while (line < address) {
69 c = *line++;
70 printf("%c", (c < 33 || c == 255) ? 0x2E : c);
71 }
72 printf("\n");
73 if (length > 0)
74 printf("%s | ", prefix);
75 }
76 }
77}
78
79/*
80 * Unescape - process hexadecimal escape character
81 * converts shell input "\x23" -> 0x23
82 */
83static int unescape(char *_dst, char *_src, size_t len)
84{
85 int ret = 0;
86 char *src = _src;
87 char *dst = _dst;
88 unsigned int ch;
89
90 while (*src) {
91 if (*src == '\\' && *(src+1) == 'x') {
92 sscanf(src + 2, "%2x", &ch);
93 src += 4;
94 *dst++ = (unsigned char)ch;
95 } else {
96 *dst++ = *src++;
97 }
98 ret++;
99 }
100 return ret;
101}
102
103static void transfer(int fd, uint8_t const *tx, uint8_t const *rx, size_t len)
104{
105 int ret;
106
107 struct spi_ioc_transfer tr = {
108 .tx_buf = (unsigned long)tx,
109 .rx_buf = (unsigned long)rx,
110 .len = len,
111 .delay_usecs = delay,
112 .speed_hz = speed,
113 .bits_per_word = bits,
114 };
115
116 if (mode & SPI_TX_QUAD)
117 tr.tx_nbits = 4;
118 else if (mode & SPI_TX_DUAL)
119 tr.tx_nbits = 2;
120 if (mode & SPI_RX_QUAD)
121 tr.rx_nbits = 4;
122 else if (mode & SPI_RX_DUAL)
123 tr.rx_nbits = 2;
124 if (!(mode & SPI_LOOP)) {
125 if (mode & (SPI_TX_QUAD | SPI_TX_DUAL))
126 tr.rx_buf = 0;
127 else if (mode & (SPI_RX_QUAD | SPI_RX_DUAL))
128 tr.tx_buf = 0;
129 }
130
131 ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
132 if (ret < 1)
133 pabort("can't send spi message");
134
135 if (verbose)
136 hex_dump(tx, len, 32, "TX");
137 hex_dump(rx, len, 32, "RX");
138}
139
140static void print_usage(const char *prog)
141{
142 printf("Usage: %s [-DsbdlHOLC3]\n", prog);
143 puts(" -D --device device to use (default /dev/spidev1.1)\n"
144 " -s --speed max speed (Hz)\n"
145 " -d --delay delay (usec)\n"
146 " -b --bpw bits per word \n"
147 " -l --loop loopback\n"
148 " -H --cpha clock phase\n"
149 " -O --cpol clock polarity\n"
150 " -L --lsb least significant bit first\n"
151 " -C --cs-high chip select active high\n"
152 " -3 --3wire SI/SO signals shared\n"
153 " -v --verbose Verbose (show tx buffer)\n"
154 " -p Send data (e.g. \"1234\\xde\\xad\")\n"
155 " -N --no-cs no chip select\n"
156 " -R --ready slave pulls low to pause\n"
157 " -2 --dual dual transfer\n"
158 " -4 --quad quad transfer\n");
159 exit(1);
160}
161
162static void parse_opts(int argc, char *argv[])
163{
164 while (1) {
165 static const struct option lopts[] = {
166 { "device", 1, 0, 'D' },
167 { "speed", 1, 0, 's' },
168 { "delay", 1, 0, 'd' },
169 { "bpw", 1, 0, 'b' },
170 { "loop", 0, 0, 'l' },
171 { "cpha", 0, 0, 'H' },
172 { "cpol", 0, 0, 'O' },
173 { "lsb", 0, 0, 'L' },
174 { "cs-high", 0, 0, 'C' },
175 { "3wire", 0, 0, '3' },
176 { "no-cs", 0, 0, 'N' },
177 { "ready", 0, 0, 'R' },
178 { "dual", 0, 0, '2' },
179 { "verbose", 0, 0, 'v' },
180 { "quad", 0, 0, '4' },
181 { NULL, 0, 0, 0 },
182 };
183 int c;
184
185 c = getopt_long(argc, argv, "D:s:d:b:lHOLC3NR24p:v", lopts, NULL);
186
187 if (c == -1)
188 break;
189
190 switch (c) {
191 case 'D':
192 device = optarg;
193 break;
194 case 's':
195 speed = atoi(optarg);
196 break;
197 case 'd':
198 delay = atoi(optarg);
199 break;
200 case 'b':
201 bits = atoi(optarg);
202 break;
203 case 'l':
204 mode |= SPI_LOOP;
205 break;
206 case 'H':
207 mode |= SPI_CPHA;
208 break;
209 case 'O':
210 mode |= SPI_CPOL;
211 break;
212 case 'L':
213 mode |= SPI_LSB_FIRST;
214 break;
215 case 'C':
216 mode |= SPI_CS_HIGH;
217 break;
218 case '3':
219 mode |= SPI_3WIRE;
220 break;
221 case 'N':
222 mode |= SPI_NO_CS;
223 break;
224 case 'v':
225 verbose = 1;
226 break;
227 case 'R':
228 mode |= SPI_READY;
229 break;
230 case 'p':
231 input_tx = optarg;
232 break;
233 case '2':
234 mode |= SPI_TX_DUAL;
235 break;
236 case '4':
237 mode |= SPI_TX_QUAD;
238 break;
239 default:
240 print_usage(argv[0]);
241 break;
242 }
243 }
244 if (mode & SPI_LOOP) {
245 if (mode & SPI_TX_DUAL)
246 mode |= SPI_RX_DUAL;
247 if (mode & SPI_TX_QUAD)
248 mode |= SPI_RX_QUAD;
249 }
250}
251
252int main(int argc, char *argv[])
253{
254 int ret = 0;
255 int fd;
256 uint8_t *tx;
257 uint8_t *rx;
258 int size;
259
260 parse_opts(argc, argv);
261
262 fd = open(device, O_RDWR);
263 if (fd < 0)
264 pabort("can't open device");
265
266 /*
267 * spi mode
268 */
269 ret = ioctl(fd, SPI_IOC_WR_MODE32, &mode);
270 if (ret == -1)
271 pabort("can't set spi mode");
272
273 ret = ioctl(fd, SPI_IOC_RD_MODE32, &mode);
274 if (ret == -1)
275 pabort("can't get spi mode");
276
277 /*
278 * bits per word
279 */
280 ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
281 if (ret == -1)
282 pabort("can't set bits per word");
283
284 ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits);
285 if (ret == -1)
286 pabort("can't get bits per word");
287
288 /*
289 * max speed hz
290 */
291 ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed);
292 if (ret == -1)
293 pabort("can't set max speed hz");
294
295 ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed);
296 if (ret == -1)
297 pabort("can't get max speed hz");
298
299 printf("spi mode: 0x%x\n", mode);
300 printf("bits per word: %d\n", bits);
301 printf("max speed: %d Hz (%d KHz)\n", speed, speed/1000);
302
303 if (input_tx) {
304 size = strlen(input_tx+1);
305 tx = malloc(size);
306 rx = malloc(size);
307 size = unescape((char *)tx, input_tx, size);
308 transfer(fd, tx, rx, size);
309 free(rx);
310 free(tx);
311 } else {
312 transfer(fd, default_tx, default_rx, sizeof(default_tx));
313 }
314
315 close(fd);
316
317 return ret;
318}
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt
index 3049a612291b..ffd4575ec9f2 100644
--- a/Documentation/stable_kernel_rules.txt
+++ b/Documentation/stable_kernel_rules.txt
@@ -93,7 +93,7 @@ format in the sign-off area:
93Also, some patches may have kernel version prerequisites. This can be 93Also, some patches may have kernel version prerequisites. This can be
94specified in the following format in the sign-off area: 94specified in the following format in the sign-off area:
95 95
96 Cc: <stable@vger.kernel.org> # 3.3.x- 96 Cc: <stable@vger.kernel.org> # 3.3.x-
97 97
98 The tag has the meaning of: 98 The tag has the meaning of:
99 git cherry-pick <this commit> 99 git cherry-pick <this commit>
diff --git a/Documentation/sysctl/fs.txt b/Documentation/sysctl/fs.txt
index 88152f214f48..302b5ed616a6 100644
--- a/Documentation/sysctl/fs.txt
+++ b/Documentation/sysctl/fs.txt
@@ -32,6 +32,8 @@ Currently, these files are in /proc/sys/fs:
32- nr_open 32- nr_open
33- overflowuid 33- overflowuid
34- overflowgid 34- overflowgid
35- pipe-user-pages-hard
36- pipe-user-pages-soft
35- protected_hardlinks 37- protected_hardlinks
36- protected_symlinks 38- protected_symlinks
37- suid_dumpable 39- suid_dumpable
@@ -159,6 +161,27 @@ The default is 65534.
159 161
160============================================================== 162==============================================================
161 163
164pipe-user-pages-hard:
165
166Maximum total number of pages a non-privileged user may allocate for pipes.
167Once this limit is reached, no new pipes may be allocated until usage goes
168below the limit again. When set to 0, no limit is applied, which is the default
169setting.
170
171==============================================================
172
173pipe-user-pages-soft:
174
175Maximum total number of pages a non-privileged user may allocate for pipes
176before the pipe size gets limited to a single page. Once this limit is reached,
177new pipes will be limited to a single page in size for this user in order to
178limit total memory usage, and trying to increase them using fcntl() will be
179denied until usage goes below the limit again. The default value allows to
180allocate up to 1024 pipes at their default size. When set to 0, no limit is
181applied.
182
183==============================================================
184
162protected_hardlinks: 185protected_hardlinks:
163 186
164A long-standing class of security issues is the hardlink-based 187A long-standing class of security issues is the hardlink-based
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index af70d1541d3a..a93b414672a7 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -551,6 +551,21 @@ the recommended setting is 60.
551 551
552============================================================== 552==============================================================
553 553
554panic_on_io_nmi:
555
556Controls the kernel's behavior when a CPU receives an NMI caused by
557an IO error.
558
5590: try to continue operation (default)
560
5611: panic immediately. The IO error triggered an NMI. This indicates a
562 serious system condition which could result in IO data corruption.
563 Rather than continuing, panicking might be a better choice. Some
564 servers issue this sort of NMI when the dump button is pushed,
565 and you can use this option to take a crash dump.
566
567==============================================================
568
554panic_on_oops: 569panic_on_oops:
555 570
556Controls the kernel's behaviour when an oops or BUG is encountered. 571Controls the kernel's behaviour when an oops or BUG is encountered.
@@ -810,14 +825,13 @@ via the /proc/sys interface:
810 Each write syscall must fully contain the sysctl value to be 825 Each write syscall must fully contain the sysctl value to be
811 written, and multiple writes on the same sysctl file descriptor 826 written, and multiple writes on the same sysctl file descriptor
812 will rewrite the sysctl value, regardless of file position. 827 will rewrite the sysctl value, regardless of file position.
813 0 - (default) Same behavior as above, but warn about processes that 828 0 - Same behavior as above, but warn about processes that perform writes
814 perform writes to a sysctl file descriptor when the file position 829 to a sysctl file descriptor when the file position is not 0.
815 is not 0. 830 1 - (default) Respect file position when writing sysctl strings. Multiple
816 1 - Respect file position when writing sysctl strings. Multiple writes 831 writes will append to the sysctl value buffer. Anything past the max
817 will append to the sysctl value buffer. Anything past the max length 832 length of the sysctl value buffer will be ignored. Writes to numeric
818 of the sysctl value buffer will be ignored. Writes to numeric sysctl 833 sysctl entries must always be at file position 0 and the value must
819 entries must always be at file position 0 and the value must be 834 be fully contained in the buffer sent in the write syscall.
820 fully contained in the buffer sent in the write syscall.
821 835
822============================================================== 836==============================================================
823 837
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index f72370b440b1..89a887c76629 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -42,6 +42,8 @@ Currently, these files are in /proc/sys/vm:
42- min_slab_ratio 42- min_slab_ratio
43- min_unmapped_ratio 43- min_unmapped_ratio
44- mmap_min_addr 44- mmap_min_addr
45- mmap_rnd_bits
46- mmap_rnd_compat_bits
45- nr_hugepages 47- nr_hugepages
46- nr_overcommit_hugepages 48- nr_overcommit_hugepages
47- nr_trim_pages (only if CONFIG_MMU=n) 49- nr_trim_pages (only if CONFIG_MMU=n)
@@ -135,7 +137,7 @@ Contains, as a percentage of total available memory that contains free pages
135and reclaimable pages, the number of pages at which the background kernel 137and reclaimable pages, the number of pages at which the background kernel
136flusher threads will start writing out dirty data. 138flusher threads will start writing out dirty data.
137 139
138The total avaiable memory is not equal to total system memory. 140The total available memory is not equal to total system memory.
139 141
140============================================================== 142==============================================================
141 143
@@ -170,7 +172,7 @@ Contains, as a percentage of total available memory that contains free pages
170and reclaimable pages, the number of pages at which a process which is 172and reclaimable pages, the number of pages at which a process which is
171generating disk writes will itself start writing out dirty data. 173generating disk writes will itself start writing out dirty data.
172 174
173The total avaiable memory is not equal to total system memory. 175The total available memory is not equal to total system memory.
174 176
175============================================================== 177==============================================================
176 178
@@ -485,6 +487,33 @@ against future potential kernel bugs.
485 487
486============================================================== 488==============================================================
487 489
490mmap_rnd_bits:
491
492This value can be used to select the number of bits to use to
493determine the random offset to the base address of vma regions
494resulting from mmap allocations on architectures which support
495tuning address space randomization. This value will be bounded
496by the architecture's minimum and maximum supported values.
497
498This value can be changed after boot using the
499/proc/sys/vm/mmap_rnd_bits tunable
500
501==============================================================
502
503mmap_rnd_compat_bits:
504
505This value can be used to select the number of bits to use to
506determine the random offset to the base address of vma regions
507resulting from mmap allocations for applications run in
508compatibility mode on architectures which support tuning address
509space randomization. This value will be bounded by the
510architecture's minimum and maximum supported values.
511
512This value can be changed after boot using the
513/proc/sys/vm/mmap_rnd_compat_bits tunable
514
515==============================================================
516
488nr_hugepages 517nr_hugepages
489 518
490Change the minimum size of the hugepage pool. 519Change the minimum size of the hugepage pool.
diff --git a/Documentation/thermal/sysfs-api.txt b/Documentation/thermal/sysfs-api.txt
index 10f062ea6bc2..8c745c8931da 100644
--- a/Documentation/thermal/sysfs-api.txt
+++ b/Documentation/thermal/sysfs-api.txt
@@ -364,6 +364,7 @@ integral_cutoff
364 accumulates error when temperature is above the desired 364 accumulates error when temperature is above the desired
365 temperature trip point. For more information see 365 temperature trip point. For more information see
366 Documentation/thermal/power_allocator.txt 366 Documentation/thermal/power_allocator.txt
367 Unit: millidegree Celsius
367 RW, Optional 368 RW, Optional
368 369
369slope 370slope
diff --git a/Documentation/trace/events-msr.txt b/Documentation/trace/events-msr.txt
new file mode 100644
index 000000000000..78c383bf06aa
--- /dev/null
+++ b/Documentation/trace/events-msr.txt
@@ -0,0 +1,37 @@
1
2The x86 kernel supports tracing most MSR (Model Specific Register) accesses.
3To see the definition of the MSRs on Intel systems please see the SDM
4at http://www.intel.com/sdm (Volume 3)
5
6Available trace points:
7
8/sys/kernel/debug/tracing/events/msr/
9
10Trace MSR reads
11
12read_msr
13
14msr: MSR number
15val: Value written
16failed: 1 if the access failed, otherwise 0
17
18
19Trace MSR writes
20
21write_msr
22
23msr: MSR number
24val: Value written
25failed: 1 if the access failed, otherwise 0
26
27
28Trace RDPMC in kernel
29
30rdpmc
31
32The trace data can be post processed with the postprocess/decode_msr.py script
33
34cat /sys/kernel/debug/tracing/trace | decode_msr.py /usr/src/linux/include/asm/msr-index.h
35
36to add symbolic MSR names.
37
diff --git a/Documentation/trace/postprocess/decode_msr.py b/Documentation/trace/postprocess/decode_msr.py
new file mode 100644
index 000000000000..0ab40e0db580
--- /dev/null
+++ b/Documentation/trace/postprocess/decode_msr.py
@@ -0,0 +1,37 @@
1#!/usr/bin/python
2# add symbolic names to read_msr / write_msr in trace
3# decode_msr msr-index.h < trace
4import sys
5import re
6
7msrs = dict()
8
9with open(sys.argv[1] if len(sys.argv) > 1 else "msr-index.h", "r") as f:
10 for j in f:
11 m = re.match(r'#define (MSR_\w+)\s+(0x[0-9a-fA-F]+)', j)
12 if m:
13 msrs[int(m.group(2), 16)] = m.group(1)
14
15extra_ranges = (
16 ( "MSR_LASTBRANCH_%d_FROM_IP", 0x680, 0x69F ),
17 ( "MSR_LASTBRANCH_%d_TO_IP", 0x6C0, 0x6DF ),
18 ( "LBR_INFO_%d", 0xdc0, 0xddf ),
19)
20
21for j in sys.stdin:
22 m = re.search(r'(read|write)_msr:\s+([0-9a-f]+)', j)
23 if m:
24 r = None
25 num = int(m.group(2), 16)
26 if num in msrs:
27 r = msrs[num]
28 else:
29 for er in extra_ranges:
30 if er[1] <= num <= er[2]:
31 r = er[0] % (num - er[1],)
32 break
33 if r:
34 j = j.replace(" " + m.group(2), " " + r + "(" + m.group(2) + ")")
35 print j,
36
37
diff --git a/Documentation/ubsan.txt b/Documentation/ubsan.txt
new file mode 100644
index 000000000000..f58215ef5797
--- /dev/null
+++ b/Documentation/ubsan.txt
@@ -0,0 +1,84 @@
1Undefined Behavior Sanitizer - UBSAN
2
3Overview
4--------
5
6UBSAN is a runtime undefined behaviour checker.
7
8UBSAN uses compile-time instrumentation to catch undefined behavior (UB).
9Compiler inserts code that perform certain kinds of checks before operations
10that may cause UB. If check fails (i.e. UB detected) __ubsan_handle_*
11function called to print error message.
12
13GCC has that feature since 4.9.x [1] (see -fsanitize=undefined option and
14its suboptions). GCC 5.x has more checkers implemented [2].
15
16Report example
17---------------
18
19 ================================================================================
20 UBSAN: Undefined behaviour in ../include/linux/bitops.h:110:33
21 shift exponent 32 is to large for 32-bit type 'unsigned int'
22 CPU: 0 PID: 0 Comm: swapper Not tainted 4.4.0-rc1+ #26
23 0000000000000000 ffffffff82403cc8 ffffffff815e6cd6 0000000000000001
24 ffffffff82403cf8 ffffffff82403ce0 ffffffff8163a5ed 0000000000000020
25 ffffffff82403d78 ffffffff8163ac2b ffffffff815f0001 0000000000000002
26 Call Trace:
27 [<ffffffff815e6cd6>] dump_stack+0x45/0x5f
28 [<ffffffff8163a5ed>] ubsan_epilogue+0xd/0x40
29 [<ffffffff8163ac2b>] __ubsan_handle_shift_out_of_bounds+0xeb/0x130
30 [<ffffffff815f0001>] ? radix_tree_gang_lookup_slot+0x51/0x150
31 [<ffffffff8173c586>] _mix_pool_bytes+0x1e6/0x480
32 [<ffffffff83105653>] ? dmi_walk_early+0x48/0x5c
33 [<ffffffff8173c881>] add_device_randomness+0x61/0x130
34 [<ffffffff83105b35>] ? dmi_save_one_device+0xaa/0xaa
35 [<ffffffff83105653>] dmi_walk_early+0x48/0x5c
36 [<ffffffff831066ae>] dmi_scan_machine+0x278/0x4b4
37 [<ffffffff8111d58a>] ? vprintk_default+0x1a/0x20
38 [<ffffffff830ad120>] ? early_idt_handler_array+0x120/0x120
39 [<ffffffff830b2240>] setup_arch+0x405/0xc2c
40 [<ffffffff830ad120>] ? early_idt_handler_array+0x120/0x120
41 [<ffffffff830ae053>] start_kernel+0x83/0x49a
42 [<ffffffff830ad120>] ? early_idt_handler_array+0x120/0x120
43 [<ffffffff830ad386>] x86_64_start_reservations+0x2a/0x2c
44 [<ffffffff830ad4f3>] x86_64_start_kernel+0x16b/0x17a
45 ================================================================================
46
47Usage
48-----
49
50To enable UBSAN configure kernel with:
51
52 CONFIG_UBSAN=y
53
54and to check the entire kernel:
55
56 CONFIG_UBSAN_SANITIZE_ALL=y
57
58To enable instrumentation for specific files or directories, add a line
59similar to the following to the respective kernel Makefile:
60
61 For a single file (e.g. main.o):
62 UBSAN_SANITIZE_main.o := y
63
64 For all files in one directory:
65 UBSAN_SANITIZE := y
66
67To exclude files from being instrumented even if
68CONFIG_UBSAN_SANITIZE_ALL=y, use:
69
70 UBSAN_SANITIZE_main.o := n
71 and:
72 UBSAN_SANITIZE := n
73
74Detection of unaligned accesses controlled through the separate option -
75CONFIG_UBSAN_ALIGNMENT. It's off by default on architectures that support
76unaligned accesses (CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y). One could
77still enable it in config, just note that it will produce a lot of UBSAN
78reports.
79
80References
81----------
82
83[1] - https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Debugging-Options.html
84[2] - https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html
diff --git a/Documentation/usb/chipidea.txt b/Documentation/usb/chipidea.txt
index 3f848c1f2940..05f735a1b5a5 100644
--- a/Documentation/usb/chipidea.txt
+++ b/Documentation/usb/chipidea.txt
@@ -7,8 +7,8 @@ with 2 Freescale i.MX6Q sabre SD boards.
7--------------------------------------- 7---------------------------------------
8Select CONFIG_USB_OTG_FSM, rebuild kernel Image and modules. 8Select CONFIG_USB_OTG_FSM, rebuild kernel Image and modules.
9If you want to check some internal variables for otg fsm, 9If you want to check some internal variables for otg fsm,
10select CONFIG_USB_CHIPIDEA_DEBUG, there are 2 files which 10mount debugfs, there are 2 files which can show otg fsm
11can show otg fsm variables and some controller registers value: 11variables and some controller registers value:
12cat /sys/kernel/debug/ci_hdrc.0/otg 12cat /sys/kernel/debug/ci_hdrc.0/otg
13cat /sys/kernel/debug/ci_hdrc.0/registers 13cat /sys/kernel/debug/ci_hdrc.0/registers
14 14
diff --git a/Documentation/usb/gadget-testing.txt b/Documentation/usb/gadget-testing.txt
index b24d3ef89166..581960574889 100644
--- a/Documentation/usb/gadget-testing.txt
+++ b/Documentation/usb/gadget-testing.txt
@@ -434,7 +434,7 @@ On host: serialc -v <vendorID> -p <productID> -i<interface#> -a1 -s1024 \
434 434
435where seriald and serialc are Felipe's utilities found here: 435where seriald and serialc are Felipe's utilities found here:
436 436
437https://git.gitorious.org/usb/usb-tools.git master 437https://github.com/felipebalbi/usb-tools.git master
438 438
43912. PHONET function 43912. PHONET function
440=================== 440===================
@@ -579,6 +579,8 @@ The SOURCESINK function provides these attributes in its function directory:
579 isoc_mult - 0..2 (hs/ss only) 579 isoc_mult - 0..2 (hs/ss only)
580 isoc_maxburst - 0..15 (ss only) 580 isoc_maxburst - 0..15 (ss only)
581 bulk_buflen - buffer length 581 bulk_buflen - buffer length
582 bulk_qlen - depth of queue for bulk
583 iso_qlen - depth of queue for iso
582 584
583Testing the SOURCESINK function 585Testing the SOURCESINK function
584------------------------------- 586-------------------------------
diff --git a/Documentation/usb/power-management.txt b/Documentation/usb/power-management.txt
index 4a15c90bc11d..0a94ffe17ab6 100644
--- a/Documentation/usb/power-management.txt
+++ b/Documentation/usb/power-management.txt
@@ -537,17 +537,18 @@ relevant attribute files are usb2_hardware_lpm and usb3_hardware_lpm.
537 can write y/Y/1 or n/N/0 to the file to enable/disable 537 can write y/Y/1 or n/N/0 to the file to enable/disable
538 USB2 hardware LPM manually. This is for test purpose mainly. 538 USB2 hardware LPM manually. This is for test purpose mainly.
539 539
540 power/usb3_hardware_lpm 540 power/usb3_hardware_lpm_u1
541 power/usb3_hardware_lpm_u2
541 542
542 When a USB 3.0 lpm-capable device is plugged in to a 543 When a USB 3.0 lpm-capable device is plugged in to a
543 xHCI host which supports link PM, it will check if U1 544 xHCI host which supports link PM, it will check if U1
544 and U2 exit latencies have been set in the BOS 545 and U2 exit latencies have been set in the BOS
545 descriptor; if the check is is passed and the host 546 descriptor; if the check is is passed and the host
546 supports USB3 hardware LPM, USB3 hardware LPM will be 547 supports USB3 hardware LPM, USB3 hardware LPM will be
547 enabled for the device and this file will be created. 548 enabled for the device and these files will be created.
548 The file holds a string value (enable or disable) 549 The files hold a string value (enable or disable)
549 indicating whether or not USB3 hardware LPM is 550 indicating whether or not USB3 hardware LPM U1 or U2
550 enabled for the device. 551 is enabled for the device.
551 552
552 USB Port Power Control 553 USB Port Power Control
553 ---------------------- 554 ----------------------
diff --git a/Documentation/video4linux/API.html b/Documentation/video4linux/API.html
index 256f8efa992c..eaf948cf1ae7 100644
--- a/Documentation/video4linux/API.html
+++ b/Documentation/video4linux/API.html
@@ -9,7 +9,7 @@
9 <table border="0"> 9 <table border="0">
10 <tr> 10 <tr>
11 <td> 11 <td>
12 <a href="http://linuxtv.org/downloads/legacy/video4linux/API/V4L1_API.html">V4L original API</a> 12 <a href="https://linuxtv.org/downloads/legacy/video4linux/API/V4L1_API.html">V4L original API</a>
13 </td> 13 </td>
14 <td> 14 <td>
15 Obsoleted by V4L2 API 15 Obsoleted by V4L2 API
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx
index 9e57ce43c4f4..67209998a439 100644
--- a/Documentation/video4linux/CARDLIST.em28xx
+++ b/Documentation/video4linux/CARDLIST.em28xx
@@ -41,8 +41,8 @@
41 40 -> Plextor ConvertX PX-TV100U (em2861) [093b:a005] 41 40 -> Plextor ConvertX PX-TV100U (em2861) [093b:a005]
42 41 -> Kworld 350 U DVB-T (em2870) [eb1a:e350] 42 41 -> Kworld 350 U DVB-T (em2870) [eb1a:e350]
43 42 -> Kworld 355 U DVB-T (em2870) [eb1a:e355,eb1a:e357,eb1a:e359] 43 42 -> Kworld 355 U DVB-T (em2870) [eb1a:e355,eb1a:e357,eb1a:e359]
44 43 -> Terratec Cinergy T XS (em2870) [0ccd:0043] 44 43 -> Terratec Cinergy T XS (em2870)
45 44 -> Terratec Cinergy T XS (MT2060) (em2870) 45 44 -> Terratec Cinergy T XS (MT2060) (em2870) [0ccd:0043]
46 45 -> Pinnacle PCTV DVB-T (em2870) 46 45 -> Pinnacle PCTV DVB-T (em2870)
47 46 -> Compro, VideoMate U3 (em2870) [185b:2870] 47 46 -> Compro, VideoMate U3 (em2870) [185b:2870]
48 47 -> KWorld DVB-T 305U (em2880) [eb1a:e305] 48 47 -> KWorld DVB-T 305U (em2880) [eb1a:e305]
diff --git a/Documentation/video4linux/fimc.txt b/Documentation/video4linux/fimc.txt
index e0c6b8bc4743..4fab231be52e 100644
--- a/Documentation/video4linux/fimc.txt
+++ b/Documentation/video4linux/fimc.txt
@@ -58,7 +58,7 @@ Not currently supported:
584.1. Media device interface 584.1. Media device interface
59 59
60The driver supports Media Controller API as defined at 60The driver supports Media Controller API as defined at
61http://linuxtv.org/downloads/v4l-dvb-apis/media_common.html 61https://linuxtv.org/downloads/v4l-dvb-apis/media_common.html
62The media device driver name is "SAMSUNG S5P FIMC". 62The media device driver name is "SAMSUNG S5P FIMC".
63 63
64The purpose of this interface is to allow changing assignment of FIMC instances 64The purpose of this interface is to allow changing assignment of FIMC instances
@@ -83,11 +83,11 @@ undefined behaviour.
834.3. Capture video node 834.3. Capture video node
84 84
85The driver supports V4L2 Video Capture Interface as defined at: 85The driver supports V4L2 Video Capture Interface as defined at:
86http://linuxtv.org/downloads/v4l-dvb-apis/devices.html 86https://linuxtv.org/downloads/v4l-dvb-apis/devices.html
87 87
88At the capture and mem-to-mem video nodes only the multi-planar API is 88At the capture and mem-to-mem video nodes only the multi-planar API is
89supported. For more details see: 89supported. For more details see:
90http://linuxtv.org/downloads/v4l-dvb-apis/planar-apis.html 90https://linuxtv.org/downloads/v4l-dvb-apis/planar-apis.html
91 91
924.4. Camera capture subdevs 924.4. Camera capture subdevs
93 93
diff --git a/Documentation/video4linux/omap4_camera.txt b/Documentation/video4linux/omap4_camera.txt
index 25d9b40a4651..a6734aa77242 100644
--- a/Documentation/video4linux/omap4_camera.txt
+++ b/Documentation/video4linux/omap4_camera.txt
@@ -47,7 +47,7 @@ Tested platforms
47File list 47File list
48--------- 48---------
49drivers/staging/media/omap4iss/ 49drivers/staging/media/omap4iss/
50include/media/omap4iss.h 50include/linux/platform_data/media/omap4iss.h
51 51
52References 52References
53---------- 53----------
diff --git a/Documentation/video4linux/si4713.txt b/Documentation/video4linux/si4713.txt
index 2e7392a4fee1..2ddc6b095a76 100644
--- a/Documentation/video4linux/si4713.txt
+++ b/Documentation/video4linux/si4713.txt
@@ -157,7 +157,7 @@ int main (int argc, char *argv[])
157} 157}
158 158
159The struct si4713_rnl and SI4713_IOC_MEASURE_RNL are defined under 159The struct si4713_rnl and SI4713_IOC_MEASURE_RNL are defined under
160include/media/si4713.h. 160include/linux/platform_data/media/si4713.h.
161 161
162Stereo/Mono and RDS subchannels 162Stereo/Mono and RDS subchannels
163=============================== 163===============================
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt
index 75d5c18d689a..fa41608ab2b4 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -295,16 +295,16 @@ module owner. This is done for you if you use the i2c helper functions.
295 295
296If integration with the media framework is needed, you must initialize the 296If integration with the media framework is needed, you must initialize the
297media_entity struct embedded in the v4l2_subdev struct (entity field) by 297media_entity struct embedded in the v4l2_subdev struct (entity field) by
298calling media_entity_init(): 298calling media_entity_pads_init(), if the entity has pads:
299 299
300 struct media_pad *pads = &my_sd->pads; 300 struct media_pad *pads = &my_sd->pads;
301 int err; 301 int err;
302 302
303 err = media_entity_init(&sd->entity, npads, pads, 0); 303 err = media_entity_pads_init(&sd->entity, npads, pads);
304 304
305The pads array must have been previously initialized. There is no need to 305The pads array must have been previously initialized. There is no need to
306manually set the struct media_entity type and name fields, but the revision 306manually set the struct media_entity function and name fields, but the
307field must be initialized if needed. 307revision field must be initialized if needed.
308 308
309A reference to the entity will be automatically acquired/released when the 309A reference to the entity will be automatically acquired/released when the
310subdev device node (if any) is opened/closed. 310subdev device node (if any) is opened/closed.
@@ -695,12 +695,12 @@ difference is that the inode argument is omitted since it is never used.
695 695
696If integration with the media framework is needed, you must initialize the 696If integration with the media framework is needed, you must initialize the
697media_entity struct embedded in the video_device struct (entity field) by 697media_entity struct embedded in the video_device struct (entity field) by
698calling media_entity_init(): 698calling media_entity_pads_init():
699 699
700 struct media_pad *pad = &my_vdev->pad; 700 struct media_pad *pad = &my_vdev->pad;
701 int err; 701 int err;
702 702
703 err = media_entity_init(&vdev->entity, 1, pad, 0); 703 err = media_entity_pads_init(&vdev->entity, 1, pad);
704 704
705The pads array must have been previously initialized. There is no need to 705The pads array must have been previously initialized. There is no need to
706manually set the struct media_entity type and name fields. 706manually set the struct media_entity type and name fields.
diff --git a/Documentation/video4linux/v4l2-pci-skeleton.c b/Documentation/video4linux/v4l2-pci-skeleton.c
index 95ae82860092..79af0c041056 100644
--- a/Documentation/video4linux/v4l2-pci-skeleton.c
+++ b/Documentation/video4linux/v4l2-pci-skeleton.c
@@ -163,11 +163,10 @@ static irqreturn_t skeleton_irq(int irq, void *dev_id)
163 * minimum number: many DMA engines need a minimum of 2 buffers in the 163 * minimum number: many DMA engines need a minimum of 2 buffers in the
164 * queue and you need to have another available for userspace processing. 164 * queue and you need to have another available for userspace processing.
165 */ 165 */
166static int queue_setup(struct vb2_queue *vq, const void *parg, 166static int queue_setup(struct vb2_queue *vq,
167 unsigned int *nbuffers, unsigned int *nplanes, 167 unsigned int *nbuffers, unsigned int *nplanes,
168 unsigned int sizes[], void *alloc_ctxs[]) 168 unsigned int sizes[], void *alloc_ctxs[])
169{ 169{
170 const struct v4l2_format *fmt = parg;
171 struct skeleton *skel = vb2_get_drv_priv(vq); 170 struct skeleton *skel = vb2_get_drv_priv(vq);
172 171
173 skel->field = skel->format.field; 172 skel->field = skel->format.field;
@@ -183,12 +182,12 @@ static int queue_setup(struct vb2_queue *vq, const void *parg,
183 182
184 if (vq->num_buffers + *nbuffers < 3) 183 if (vq->num_buffers + *nbuffers < 3)
185 *nbuffers = 3 - vq->num_buffers; 184 *nbuffers = 3 - vq->num_buffers;
185 alloc_ctxs[0] = skel->alloc_ctx;
186 186
187 if (fmt && fmt->fmt.pix.sizeimage < skel->format.sizeimage) 187 if (*nplanes)
188 return -EINVAL; 188 return sizes[0] < skel->format.sizeimage ? -EINVAL : 0;
189 *nplanes = 1; 189 *nplanes = 1;
190 sizes[0] = fmt ? fmt->fmt.pix.sizeimage : skel->format.sizeimage; 190 sizes[0] = skel->format.sizeimage;
191 alloc_ctxs[0] = skel->alloc_ctx;
192 return 0; 191 return 0;
193} 192}
194 193
@@ -509,7 +508,7 @@ static int skeleton_s_dv_timings(struct file *file, void *_fh,
509 return -EINVAL; 508 return -EINVAL;
510 509
511 /* Return 0 if the new timings are the same as the current timings. */ 510 /* Return 0 if the new timings are the same as the current timings. */
512 if (v4l2_match_dv_timings(timings, &skel->timings, 0)) 511 if (v4l2_match_dv_timings(timings, &skel->timings, 0, false))
513 return 0; 512 return 0;
514 513
515 /* 514 /*
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 092ee9fbaf2b..053f613fc9a9 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -1451,6 +1451,7 @@ struct kvm_irq_routing_entry {
1451 struct kvm_irq_routing_irqchip irqchip; 1451 struct kvm_irq_routing_irqchip irqchip;
1452 struct kvm_irq_routing_msi msi; 1452 struct kvm_irq_routing_msi msi;
1453 struct kvm_irq_routing_s390_adapter adapter; 1453 struct kvm_irq_routing_s390_adapter adapter;
1454 struct kvm_irq_routing_hv_sint hv_sint;
1454 __u32 pad[8]; 1455 __u32 pad[8];
1455 } u; 1456 } u;
1456}; 1457};
@@ -1459,6 +1460,7 @@ struct kvm_irq_routing_entry {
1459#define KVM_IRQ_ROUTING_IRQCHIP 1 1460#define KVM_IRQ_ROUTING_IRQCHIP 1
1460#define KVM_IRQ_ROUTING_MSI 2 1461#define KVM_IRQ_ROUTING_MSI 2
1461#define KVM_IRQ_ROUTING_S390_ADAPTER 3 1462#define KVM_IRQ_ROUTING_S390_ADAPTER 3
1463#define KVM_IRQ_ROUTING_HV_SINT 4
1462 1464
1463No flags are specified so far, the corresponding field must be set to zero. 1465No flags are specified so far, the corresponding field must be set to zero.
1464 1466
@@ -1482,6 +1484,10 @@ struct kvm_irq_routing_s390_adapter {
1482 __u32 adapter_id; 1484 __u32 adapter_id;
1483}; 1485};
1484 1486
1487struct kvm_irq_routing_hv_sint {
1488 __u32 vcpu;
1489 __u32 sint;
1490};
1485 1491
14864.53 KVM_ASSIGN_SET_MSIX_NR (deprecated) 14924.53 KVM_ASSIGN_SET_MSIX_NR (deprecated)
1487 1493
@@ -3331,6 +3337,28 @@ the userspace IOAPIC should process the EOI and retrigger the interrupt if
3331it is still asserted. Vector is the LAPIC interrupt vector for which the 3337it is still asserted. Vector is the LAPIC interrupt vector for which the
3332EOI was received. 3338EOI was received.
3333 3339
3340 struct kvm_hyperv_exit {
3341#define KVM_EXIT_HYPERV_SYNIC 1
3342 __u32 type;
3343 union {
3344 struct {
3345 __u32 msr;
3346 __u64 control;
3347 __u64 evt_page;
3348 __u64 msg_page;
3349 } synic;
3350 } u;
3351 };
3352 /* KVM_EXIT_HYPERV */
3353 struct kvm_hyperv_exit hyperv;
3354Indicates that the VCPU exits into userspace to process some tasks
3355related to Hyper-V emulation.
3356Valid values for 'type' are:
3357 KVM_EXIT_HYPERV_SYNIC -- synchronously notify user-space about
3358Hyper-V SynIC state change. Notification is used to remap SynIC
3359event/message pages and to enable/disable SynIC messages/events processing
3360in userspace.
3361
3334 /* Fix the size of the union. */ 3362 /* Fix the size of the union. */
3335 char padding[256]; 3363 char padding[256];
3336 }; 3364 };
@@ -3685,3 +3713,16 @@ available, means that that the kernel has an implementation of the
3685H_RANDOM hypercall backed by a hardware random-number generator. 3713H_RANDOM hypercall backed by a hardware random-number generator.
3686If present, the kernel H_RANDOM handler can be enabled for guest use 3714If present, the kernel H_RANDOM handler can be enabled for guest use
3687with the KVM_CAP_PPC_ENABLE_HCALL capability. 3715with the KVM_CAP_PPC_ENABLE_HCALL capability.
3716
37178.2 KVM_CAP_HYPERV_SYNIC
3718
3719Architectures: x86
3720This capability, if KVM_CHECK_EXTENSION indicates that it is
3721available, means that that the kernel has an implementation of the
3722Hyper-V Synthetic interrupt controller(SynIC). Hyper-V SynIC is
3723used to support Windows Hyper-V based guest paravirt drivers(VMBus).
3724
3725In order to use SynIC, it has to be activated by setting this
3726capability via KVM_ENABLE_CAP ioctl on the vcpu fd. Note that this
3727will disable the use of APIC hardware virtualization even if supported
3728by the CPU, as it's incompatible with SynIC auto-EOI behavior.
diff --git a/Documentation/virtual/kvm/devices/vm.txt b/Documentation/virtual/kvm/devices/vm.txt
index 2d09d1ed86d0..f083a168eb35 100644
--- a/Documentation/virtual/kvm/devices/vm.txt
+++ b/Documentation/virtual/kvm/devices/vm.txt
@@ -37,7 +37,8 @@ Returns: -EFAULT if the given address is not accessible
37Allows userspace to query the actual limit and set a new limit for 37Allows userspace to query the actual limit and set a new limit for
38the maximum guest memory size. The limit will be rounded up to 38the maximum guest memory size. The limit will be rounded up to
392048 MB, 4096 GB, 8192 TB respectively, as this limit is governed by 392048 MB, 4096 GB, 8192 TB respectively, as this limit is governed by
40the number of page table levels. 40the number of page table levels. In the case that there is no limit we will set
41the limit to KVM_S390_NO_MEM_LIMIT (U64_MAX).
41 42
422. GROUP: KVM_S390_VM_CPU_MODEL 432. GROUP: KVM_S390_VM_CPU_MODEL
43Architectures: s390 44Architectures: s390
diff --git a/Documentation/virtual/kvm/mmu.txt b/Documentation/virtual/kvm/mmu.txt
index 3a4d681c3e98..daf9c0f742d2 100644
--- a/Documentation/virtual/kvm/mmu.txt
+++ b/Documentation/virtual/kvm/mmu.txt
@@ -203,10 +203,10 @@ Shadow pages contain the following information:
203 page cannot be destroyed. See role.invalid. 203 page cannot be destroyed. See role.invalid.
204 parent_ptes: 204 parent_ptes:
205 The reverse mapping for the pte/ptes pointing at this page's spt. If 205 The reverse mapping for the pte/ptes pointing at this page's spt. If
206 parent_ptes bit 0 is zero, only one spte points at this pages and 206 parent_ptes bit 0 is zero, only one spte points at this page and
207 parent_ptes points at this single spte, otherwise, there exists multiple 207 parent_ptes points at this single spte, otherwise, there exists multiple
208 sptes pointing at this page and (parent_ptes & ~0x1) points at a data 208 sptes pointing at this page and (parent_ptes & ~0x1) points at a data
209 structure with a list of parent_ptes. 209 structure with a list of parent sptes.
210 unsync: 210 unsync:
211 If true, then the translations in this page may not match the guest's 211 If true, then the translations in this page may not match the guest's
212 translation. This is equivalent to the state of the tlb when a pte is 212 translation. This is equivalent to the state of the tlb when a pte is
diff --git a/Documentation/vm/slub.txt b/Documentation/vm/slub.txt
index 699d8ea5c230..f0d340959319 100644
--- a/Documentation/vm/slub.txt
+++ b/Documentation/vm/slub.txt
@@ -8,7 +8,7 @@ SLUB can enable debugging only for selected slabs in order to avoid
8an impact on overall system performance which may make a bug more 8an impact on overall system performance which may make a bug more
9difficult to find. 9difficult to find.
10 10
11In order to switch debugging on one can add a option "slub_debug" 11In order to switch debugging on one can add an option "slub_debug"
12to the kernel command line. That will enable full debugging for 12to the kernel command line. That will enable full debugging for
13all slabs. 13all slabs.
14 14
diff --git a/Documentation/vm/transhuge.txt b/Documentation/vm/transhuge.txt
index 8a282687ee06..21cf34f3ddb2 100644
--- a/Documentation/vm/transhuge.txt
+++ b/Documentation/vm/transhuge.txt
@@ -35,10 +35,10 @@ miss is going to run faster.
35 35
36== Design == 36== Design ==
37 37
38- "graceful fallback": mm components which don't have transparent 38- "graceful fallback": mm components which don't have transparent hugepage
39 hugepage knowledge fall back to breaking a transparent hugepage and 39 knowledge fall back to breaking huge pmd mapping into table of ptes and,
40 working on the regular pages and their respective regular pmd/pte 40 if necessary, split a transparent hugepage. Therefore these components
41 mappings 41 can continue working on the regular pages or regular pte mappings.
42 42
43- if a hugepage allocation fails because of memory fragmentation, 43- if a hugepage allocation fails because of memory fragmentation,
44 regular pages should be gracefully allocated instead and mixed in 44 regular pages should be gracefully allocated instead and mixed in
@@ -221,9 +221,18 @@ thp_collapse_alloc_failed is incremented if khugepaged found a range
221 of pages that should be collapsed into one huge page but failed 221 of pages that should be collapsed into one huge page but failed
222 the allocation. 222 the allocation.
223 223
224thp_split is incremented every time a huge page is split into base 224thp_split_page is incremented every time a huge page is split into base
225 pages. This can happen for a variety of reasons but a common 225 pages. This can happen for a variety of reasons but a common
226 reason is that a huge page is old and is being reclaimed. 226 reason is that a huge page is old and is being reclaimed.
227 This action implies splitting all PMD the page mapped with.
228
229thp_split_page_failed is is incremented if kernel fails to split huge
230 page. This can happen if the page was pinned by somebody.
231
232thp_split_pmd is incremented every time a PMD split into table of PTEs.
233 This can happen, for instance, when application calls mprotect() or
234 munmap() on part of huge page. It doesn't split huge page, only
235 page table entry.
227 236
228thp_zero_page_alloc is incremented every time a huge zero page is 237thp_zero_page_alloc is incremented every time a huge zero page is
229 successfully allocated. It includes allocations which where 238 successfully allocated. It includes allocations which where
@@ -274,10 +283,8 @@ is complete, so they won't ever notice the fact the page is huge. But
274if any driver is going to mangle over the page structure of the tail 283if any driver is going to mangle over the page structure of the tail
275page (like for checking page->mapping or other bits that are relevant 284page (like for checking page->mapping or other bits that are relevant
276for the head page and not the tail page), it should be updated to jump 285for the head page and not the tail page), it should be updated to jump
277to check head page instead (while serializing properly against 286to check head page instead. Taking reference on any head/tail page would
278split_huge_page() to avoid the head and tail pages to disappear from 287prevent page from being split by anyone.
279under it, see the futex code to see an example of that, hugetlbfs also
280needed special handling in futex code for similar reasons).
281 288
282NOTE: these aren't new constraints to the GUP API, and they match the 289NOTE: these aren't new constraints to the GUP API, and they match the
283same constrains that applies to hugetlbfs too, so any driver capable 290same constrains that applies to hugetlbfs too, so any driver capable
@@ -312,9 +319,9 @@ unaffected. libhugetlbfs will also work fine as usual.
312== Graceful fallback == 319== Graceful fallback ==
313 320
314Code walking pagetables but unware about huge pmds can simply call 321Code walking pagetables but unware about huge pmds can simply call
315split_huge_page_pmd(vma, addr, pmd) where the pmd is the one returned by 322split_huge_pmd(vma, pmd, addr) where the pmd is the one returned by
316pmd_offset. It's trivial to make the code transparent hugepage aware 323pmd_offset. It's trivial to make the code transparent hugepage aware
317by just grepping for "pmd_offset" and adding split_huge_page_pmd where 324by just grepping for "pmd_offset" and adding split_huge_pmd where
318missing after pmd_offset returns the pmd. Thanks to the graceful 325missing after pmd_offset returns the pmd. Thanks to the graceful
319fallback design, with a one liner change, you can avoid to write 326fallback design, with a one liner change, you can avoid to write
320hundred if not thousand of lines of complex code to make your code 327hundred if not thousand of lines of complex code to make your code
@@ -323,7 +330,8 @@ hugepage aware.
323If you're not walking pagetables but you run into a physical hugepage 330If you're not walking pagetables but you run into a physical hugepage
324but you can't handle it natively in your code, you can split it by 331but you can't handle it natively in your code, you can split it by
325calling split_huge_page(page). This is what the Linux VM does before 332calling split_huge_page(page). This is what the Linux VM does before
326it tries to swapout the hugepage for example. 333it tries to swapout the hugepage for example. split_huge_page() can fail
334if the page is pinned and you must handle this correctly.
327 335
328Example to make mremap.c transparent hugepage aware with a one liner 336Example to make mremap.c transparent hugepage aware with a one liner
329change: 337change:
@@ -335,14 +343,14 @@ diff --git a/mm/mremap.c b/mm/mremap.c
335 return NULL; 343 return NULL;
336 344
337 pmd = pmd_offset(pud, addr); 345 pmd = pmd_offset(pud, addr);
338+ split_huge_page_pmd(vma, addr, pmd); 346+ split_huge_pmd(vma, pmd, addr);
339 if (pmd_none_or_clear_bad(pmd)) 347 if (pmd_none_or_clear_bad(pmd))
340 return NULL; 348 return NULL;
341 349
342== Locking in hugepage aware code == 350== Locking in hugepage aware code ==
343 351
344We want as much code as possible hugepage aware, as calling 352We want as much code as possible hugepage aware, as calling
345split_huge_page() or split_huge_page_pmd() has a cost. 353split_huge_page() or split_huge_pmd() has a cost.
346 354
347To make pagetable walks huge pmd aware, all you need to do is to call 355To make pagetable walks huge pmd aware, all you need to do is to call
348pmd_trans_huge() on the pmd returned by pmd_offset. You must hold the 356pmd_trans_huge() on the pmd returned by pmd_offset. You must hold the
@@ -351,47 +359,80 @@ created from under you by khugepaged (khugepaged collapse_huge_page
351takes the mmap_sem in write mode in addition to the anon_vma lock). If 359takes the mmap_sem in write mode in addition to the anon_vma lock). If
352pmd_trans_huge returns false, you just fallback in the old code 360pmd_trans_huge returns false, you just fallback in the old code
353paths. If instead pmd_trans_huge returns true, you have to take the 361paths. If instead pmd_trans_huge returns true, you have to take the
354mm->page_table_lock and re-run pmd_trans_huge. Taking the 362page table lock (pmd_lock()) and re-run pmd_trans_huge. Taking the
355page_table_lock will prevent the huge pmd to be converted into a 363page table lock will prevent the huge pmd to be converted into a
356regular pmd from under you (split_huge_page can run in parallel to the 364regular pmd from under you (split_huge_pmd can run in parallel to the
357pagetable walk). If the second pmd_trans_huge returns false, you 365pagetable walk). If the second pmd_trans_huge returns false, you
358should just drop the page_table_lock and fallback to the old code as 366should just drop the page table lock and fallback to the old code as
359before. Otherwise you should run pmd_trans_splitting on the pmd. In 367before. Otherwise you can proceed to process the huge pmd and the
360case pmd_trans_splitting returns true, it means split_huge_page is 368hugepage natively. Once finished you can drop the page table lock.
361already in the middle of splitting the page. So if pmd_trans_splitting 369
362returns true it's enough to drop the page_table_lock and call 370== Refcounts and transparent huge pages ==
363wait_split_huge_page and then fallback the old code paths. You are 371
364guaranteed by the time wait_split_huge_page returns, the pmd isn't 372Refcounting on THP is mostly consistent with refcounting on other compound
365huge anymore. If pmd_trans_splitting returns false, you can proceed to 373pages:
366process the huge pmd and the hugepage natively. Once finished you can 374
367drop the page_table_lock. 375 - get_page()/put_page() and GUP operate in head page's ->_count.
368 376
369== compound_lock, get_user_pages and put_page == 377 - ->_count in tail pages is always zero: get_page_unless_zero() never
378 succeed on tail pages.
379
380 - map/unmap of the pages with PTE entry increment/decrement ->_mapcount
381 on relevant sub-page of the compound page.
382
383 - map/unmap of the whole compound page accounted in compound_mapcount
384 (stored in first tail page).
385
386PageDoubleMap() indicates that ->_mapcount in all subpages is offset up by one.
387This additional reference is required to get race-free detection of unmap of
388subpages when we have them mapped with both PMDs and PTEs.
389
390This is optimization required to lower overhead of per-subpage mapcount
391tracking. The alternative is alter ->_mapcount in all subpages on each
392map/unmap of the whole compound page.
393
394We set PG_double_map when a PMD of the page got split for the first time,
395but still have PMD mapping. The addtional references go away with last
396compound_mapcount.
370 397
371split_huge_page internally has to distribute the refcounts in the head 398split_huge_page internally has to distribute the refcounts in the head
372page to the tail pages before clearing all PG_head/tail bits from the 399page to the tail pages before clearing all PG_head/tail bits from the page
373page structures. It can do that easily for refcounts taken by huge pmd 400structures. It can be done easily for refcounts taken by page table
374mappings. But the GUI API as created by hugetlbfs (that returns head 401entries. But we don't have enough information on how to distribute any
375and tail pages if running get_user_pages on an address backed by any 402additional pins (i.e. from get_user_pages). split_huge_page() fails any
376hugepage), requires the refcount to be accounted on the tail pages and 403requests to split pinned huge page: it expects page count to be equal to
377not only in the head pages, if we want to be able to run 404sum of mapcount of all sub-pages plus one (split_huge_page caller must
378split_huge_page while there are gup pins established on any tail 405have reference for head page).
379page. Failure to be able to run split_huge_page if there's any gup pin 406
380on any tail page, would mean having to split all hugepages upfront in 407split_huge_page uses migration entries to stabilize page->_count and
381get_user_pages which is unacceptable as too many gup users are 408page->_mapcount.
382performance critical and they must work natively on hugepages like 409
383they work natively on hugetlbfs already (hugetlbfs is simpler because 410We safe against physical memory scanners too: the only legitimate way
384hugetlbfs pages cannot be split so there wouldn't be requirement of 411scanner can get reference to a page is get_page_unless_zero().
385accounting the pins on the tail pages for hugetlbfs). If we wouldn't 412
386account the gup refcounts on the tail pages during gup, we won't know 413All tail pages has zero ->_count until atomic_add(). It prevent scanner
387anymore which tail page is pinned by gup and which is not while we run 414from geting reference to tail page up to the point. After the atomic_add()
388split_huge_page. But we still have to add the gup pin to the head page 415we don't care about ->_count value. We already known how many references
389too, to know when we can free the compound page in case it's never 416with should uncharge from head page.
390split during its lifetime. That requires changing not just 417
391get_page, but put_page as well so that when put_page runs on a tail 418For head page get_page_unless_zero() will succeed and we don't mind. It's
392page (and only on a tail page) it will find its respective head page, 419clear where reference should go after split: it will stay on head page.
393and then it will decrease the head page refcount in addition to the 420
394tail page refcount. To obtain a head page reliably and to decrease its 421Note that split_huge_pmd() doesn't have any limitation on refcounting:
395refcount without race conditions, put_page has to serialize against 422pmd can be split at any point and never fails.
396__split_huge_page_refcount using a special per-page lock called 423
397compound_lock. 424== Partial unmap and deferred_split_huge_page() ==
425
426Unmapping part of THP (with munmap() or other way) is not going to free
427memory immediately. Instead, we detect that a subpage of THP is not in use
428in page_remove_rmap() and queue the THP for splitting if memory pressure
429comes. Splitting will free up unused subpages.
430
431Splitting the page right away is not an option due to locking context in
432the place where we can detect partial unmap. It's also might be
433counterproductive since in many cases partial unmap unmap happens during
434exit(2) if an THP crosses VMA boundary.
435
436Function deferred_split_huge_page() is used to queue page for splitting.
437The splitting itself will happen when we get memory pressure via shrinker
438interface.
diff --git a/Documentation/watchdog/watchdog-kernel-api.txt b/Documentation/watchdog/watchdog-kernel-api.txt
index d8b0d3367706..55120a055a14 100644
--- a/Documentation/watchdog/watchdog-kernel-api.txt
+++ b/Documentation/watchdog/watchdog-kernel-api.txt
@@ -44,17 +44,18 @@ The watchdog device structure looks like this:
44 44
45struct watchdog_device { 45struct watchdog_device {
46 int id; 46 int id;
47 struct cdev cdev;
48 struct device *dev;
49 struct device *parent; 47 struct device *parent;
48 const struct attribute_group **groups;
50 const struct watchdog_info *info; 49 const struct watchdog_info *info;
51 const struct watchdog_ops *ops; 50 const struct watchdog_ops *ops;
52 unsigned int bootstatus; 51 unsigned int bootstatus;
53 unsigned int timeout; 52 unsigned int timeout;
54 unsigned int min_timeout; 53 unsigned int min_timeout;
55 unsigned int max_timeout; 54 unsigned int max_timeout;
55 struct notifier_block reboot_nb;
56 struct notifier_block restart_nb;
56 void *driver_data; 57 void *driver_data;
57 struct mutex lock; 58 struct watchdog_core_data *wd_data;
58 unsigned long status; 59 unsigned long status;
59 struct list_head deferred; 60 struct list_head deferred;
60}; 61};
@@ -64,27 +65,32 @@ It contains following fields:
64 /dev/watchdog0 cdev (dynamic major, minor 0) as well as the old 65 /dev/watchdog0 cdev (dynamic major, minor 0) as well as the old
65 /dev/watchdog miscdev. The id is set automatically when calling 66 /dev/watchdog miscdev. The id is set automatically when calling
66 watchdog_register_device. 67 watchdog_register_device.
67* cdev: cdev for the dynamic /dev/watchdog<id> device nodes. This
68 field is also populated by watchdog_register_device.
69* dev: device under the watchdog class (created by watchdog_register_device).
70* parent: set this to the parent device (or NULL) before calling 68* parent: set this to the parent device (or NULL) before calling
71 watchdog_register_device. 69 watchdog_register_device.
70* groups: List of sysfs attribute groups to create when creating the watchdog
71 device.
72* info: a pointer to a watchdog_info structure. This structure gives some 72* info: a pointer to a watchdog_info structure. This structure gives some
73 additional information about the watchdog timer itself. (Like it's unique name) 73 additional information about the watchdog timer itself. (Like it's unique name)
74* ops: a pointer to the list of watchdog operations that the watchdog supports. 74* ops: a pointer to the list of watchdog operations that the watchdog supports.
75* timeout: the watchdog timer's timeout value (in seconds). 75* timeout: the watchdog timer's timeout value (in seconds).
76* min_timeout: the watchdog timer's minimum timeout value (in seconds). 76* min_timeout: the watchdog timer's minimum timeout value (in seconds).
77* max_timeout: the watchdog timer's maximum timeout value (in seconds). 77* max_timeout: the watchdog timer's maximum timeout value (in seconds).
78* reboot_nb: notifier block that is registered for reboot notifications, for
79 internal use only. If the driver calls watchdog_stop_on_reboot, watchdog core
80 will stop the watchdog on such notifications.
81* restart_nb: notifier block that is registered for machine restart, for
82 internal use only. If a watchdog is capable of restarting the machine, it
83 should define ops->restart. Priority can be changed through
84 watchdog_set_restart_priority.
78* bootstatus: status of the device after booting (reported with watchdog 85* bootstatus: status of the device after booting (reported with watchdog
79 WDIOF_* status bits). 86 WDIOF_* status bits).
80* driver_data: a pointer to the drivers private data of a watchdog device. 87* driver_data: a pointer to the drivers private data of a watchdog device.
81 This data should only be accessed via the watchdog_set_drvdata and 88 This data should only be accessed via the watchdog_set_drvdata and
82 watchdog_get_drvdata routines. 89 watchdog_get_drvdata routines.
83* lock: Mutex for WatchDog Timer Driver Core internal use only. 90* wd_data: a pointer to watchdog core internal data.
84* status: this field contains a number of status bits that give extra 91* status: this field contains a number of status bits that give extra
85 information about the status of the device (Like: is the watchdog timer 92 information about the status of the device (Like: is the watchdog timer
86 running/active, is the nowayout bit set, is the device opened via 93 running/active, or is the nowayout bit set).
87 the /dev/watchdog interface or not, ...).
88* deferred: entry in wtd_deferred_reg_list which is used to 94* deferred: entry in wtd_deferred_reg_list which is used to
89 register early initialized watchdogs. 95 register early initialized watchdogs.
90 96
@@ -100,8 +106,9 @@ struct watchdog_ops {
100 unsigned int (*status)(struct watchdog_device *); 106 unsigned int (*status)(struct watchdog_device *);
101 int (*set_timeout)(struct watchdog_device *, unsigned int); 107 int (*set_timeout)(struct watchdog_device *, unsigned int);
102 unsigned int (*get_timeleft)(struct watchdog_device *); 108 unsigned int (*get_timeleft)(struct watchdog_device *);
103 void (*ref)(struct watchdog_device *); 109 int (*restart)(struct watchdog_device *);
104 void (*unref)(struct watchdog_device *); 110 void (*ref)(struct watchdog_device *) __deprecated;
111 void (*unref)(struct watchdog_device *) __deprecated;
105 long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); 112 long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
106}; 113};
107 114
@@ -110,20 +117,6 @@ driver's operations. This module owner will be used to lock the module when
110the watchdog is active. (This to avoid a system crash when you unload the 117the watchdog is active. (This to avoid a system crash when you unload the
111module and /dev/watchdog is still open). 118module and /dev/watchdog is still open).
112 119
113If the watchdog_device struct is dynamically allocated, just locking the module
114is not enough and a driver also needs to define the ref and unref operations to
115ensure the structure holding the watchdog_device does not go away.
116
117The simplest (and usually sufficient) implementation of this is to:
1181) Add a kref struct to the same structure which is holding the watchdog_device
1192) Define a release callback for the kref which frees the struct holding both
1203) Call kref_init on this kref *before* calling watchdog_register_device()
1214) Define a ref operation calling kref_get on this kref
1225) Define a unref operation calling kref_put on this kref
1236) When it is time to cleanup:
124 * Do not kfree() the struct holding both, the last kref_put will do this!
125 * *After* calling watchdog_unregister_device() call kref_put on the kref
126
127Some operations are mandatory and some are optional. The mandatory operations 120Some operations are mandatory and some are optional. The mandatory operations
128are: 121are:
129* start: this is a pointer to the routine that starts the watchdog timer 122* start: this is a pointer to the routine that starts the watchdog timer
@@ -164,34 +157,23 @@ they are supported. These optional routines/operations are:
164 (Note: the WDIOF_SETTIMEOUT needs to be set in the options field of the 157 (Note: the WDIOF_SETTIMEOUT needs to be set in the options field of the
165 watchdog's info structure). 158 watchdog's info structure).
166* get_timeleft: this routines returns the time that's left before a reset. 159* get_timeleft: this routines returns the time that's left before a reset.
167* ref: the operation that calls kref_get on the kref of a dynamically 160* restart: this routine restarts the machine. It returns 0 on success or a
168 allocated watchdog_device struct. 161 negative errno code for failure.
169* unref: the operation that calls kref_put on the kref of a dynamically
170 allocated watchdog_device struct.
171* ioctl: if this routine is present then it will be called first before we do 162* ioctl: if this routine is present then it will be called first before we do
172 our own internal ioctl call handling. This routine should return -ENOIOCTLCMD 163 our own internal ioctl call handling. This routine should return -ENOIOCTLCMD
173 if a command is not supported. The parameters that are passed to the ioctl 164 if a command is not supported. The parameters that are passed to the ioctl
174 call are: watchdog_device, cmd and arg. 165 call are: watchdog_device, cmd and arg.
175 166
167The 'ref' and 'unref' operations are no longer used and deprecated.
168
176The status bits should (preferably) be set with the set_bit and clear_bit alike 169The status bits should (preferably) be set with the set_bit and clear_bit alike
177bit-operations. The status bits that are defined are: 170bit-operations. The status bits that are defined are:
178* WDOG_ACTIVE: this status bit indicates whether or not a watchdog timer device 171* WDOG_ACTIVE: this status bit indicates whether or not a watchdog timer device
179 is active or not. When the watchdog is active after booting, then you should 172 is active or not. When the watchdog is active after booting, then you should
180 set this status bit (Note: when you register the watchdog timer device with 173 set this status bit (Note: when you register the watchdog timer device with
181 this bit set, then opening /dev/watchdog will skip the start operation) 174 this bit set, then opening /dev/watchdog will skip the start operation)
182* WDOG_DEV_OPEN: this status bit shows whether or not the watchdog device
183 was opened via /dev/watchdog.
184 (This bit should only be used by the WatchDog Timer Driver Core).
185* WDOG_ALLOW_RELEASE: this bit stores whether or not the magic close character
186 has been sent (so that we can support the magic close feature).
187 (This bit should only be used by the WatchDog Timer Driver Core).
188* WDOG_NO_WAY_OUT: this bit stores the nowayout setting for the watchdog. 175* WDOG_NO_WAY_OUT: this bit stores the nowayout setting for the watchdog.
189 If this bit is set then the watchdog timer will not be able to stop. 176 If this bit is set then the watchdog timer will not be able to stop.
190* WDOG_UNREGISTERED: this bit gets set by the WatchDog Timer Driver Core
191 after calling watchdog_unregister_device, and then checked before calling
192 any watchdog_ops, so that you can be sure that no operations (other then
193 unref) will get called after unregister, even if userspace still holds a
194 reference to /dev/watchdog
195 177
196 To set the WDOG_NO_WAY_OUT status bit (before registering your watchdog 178 To set the WDOG_NO_WAY_OUT status bit (before registering your watchdog
197 timer device) you can either: 179 timer device) you can either:
@@ -231,3 +213,18 @@ the device tree (if the module timeout parameter is invalid). Best practice is
231to set the default timeout value as timeout value in the watchdog_device and 213to set the default timeout value as timeout value in the watchdog_device and
232then use this function to set the user "preferred" timeout value. 214then use this function to set the user "preferred" timeout value.
233This routine returns zero on success and a negative errno code for failure. 215This routine returns zero on success and a negative errno code for failure.
216
217To disable the watchdog on reboot, the user must call the following helper:
218
219static inline void watchdog_stop_on_reboot(struct watchdog_device *wdd);
220
221To change the priority of the restart handler the following helper should be
222used:
223
224void watchdog_set_restart_priority(struct watchdog_device *wdd, int priority);
225
226User should follow the following guidelines for setting the priority:
227* 0: should be called in last resort, has limited restart capabilities
228* 128: default restart handler, use if no other handler is expected to be
229 available, and/or if restart is sufficient to restart the entire system
230* 255: highest priority, will preempt all other restart handlers
diff --git a/Documentation/zh_CN/video4linux/v4l2-framework.txt b/Documentation/zh_CN/video4linux/v4l2-framework.txt
index 2b828e631e31..698660b7f21f 100644
--- a/Documentation/zh_CN/video4linux/v4l2-framework.txt
+++ b/Documentation/zh_CN/video4linux/v4l2-framework.txt
@@ -289,13 +289,13 @@ struct v4l2_subdev_ops {
289然后,你必须用一个唯一的名字初始化 subdev->name,并初始化模块的 289然后,你必须用一个唯一的名字初始化 subdev->name,并初始化模块的
290owner 域。若使用 i2c 辅助函数,这些都会帮你处理好。 290owner 域。若使用 i2c 辅助函数,这些都会帮你处理好。
291 291
292若需同媒体框架整合,你必须调用 media_entity_init() 初始化 v4l2_subdev 292若需同媒体框架整合,你必须调用 media_entity_pads_init() 初始化 v4l2_subdev
293结构体中的 media_entity 结构体(entity 域): 293结构体中的 media_entity 结构体(entity 域):
294 294
295 struct media_pad *pads = &my_sd->pads; 295 struct media_pad *pads = &my_sd->pads;
296 int err; 296 int err;
297 297
298 err = media_entity_init(&sd->entity, npads, pads, 0); 298 err = media_entity_pads_init(&sd->entity, npads, pads);
299 299
300pads 数组必须预先初始化。无须手动设置 media_entity 的 type 和 300pads 数组必须预先初始化。无须手动设置 media_entity 的 type 和
301name 域,但如有必要,revision 域必须初始化。 301name 域,但如有必要,revision 域必须初始化。
@@ -596,13 +596,13 @@ void v4l2_disable_ioctl(struct video_device *vdev, unsigned int cmd);
596v4l2_file_operations 结构体是 file_operations 的一个子集。其主要 596v4l2_file_operations 结构体是 file_operations 的一个子集。其主要
597区别在于:因 inode 参数从未被使用,它将被忽略。 597区别在于:因 inode 参数从未被使用,它将被忽略。
598 598
599如果需要与媒体框架整合,你必须通过调用 media_entity_init() 初始化 599如果需要与媒体框架整合,你必须通过调用 media_entity_pads_init() 初始化
600嵌入在 video_device 结构体中的 media_entity(entity 域)结构体: 600嵌入在 video_device 结构体中的 media_entity(entity 域)结构体:
601 601
602 struct media_pad *pad = &my_vdev->pad; 602 struct media_pad *pad = &my_vdev->pad;
603 int err; 603 int err;
604 604
605 err = media_entity_init(&vdev->entity, 1, pad, 0); 605 err = media_entity_pads_init(&vdev->entity, 1, pad);
606 606
607pads 数组必须预先初始化。没有必要手动设置 media_entity 的 type 和 607pads 数组必须预先初始化。没有必要手动设置 media_entity 的 type 和
608name 域。 608name 域。