History

Merge tag 'devicetree-for-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull devicetree updates from Rob Herring: - Refactor powerpc and arm64 kexec DT handling to common code. This enables IMA on arm64. - Add kbuild support for applying DT overlays at build time. The first user are the DT unittests. - Fix kerneldoc formatting and W=1 warnings in drivers/of/ - Fix handling 64-bit flag on PCI resources - Bump dtschema version required to v2021.2.1 - Enable undocumented compatible checks for dtbs_check. This allows tracking of missing binding schemas. - DT docs improvements. Regroup the DT docs and add the example schema and DT kernel ABI docs to the doc build. - Convert Broadcom Bluetooth and video-mux bindings to schema - Add QCom sm8250 Venus video codec binding schema - Add vendor prefixes for AESOP, YIC System Co., Ltd, and Siliconfile Technologies Inc. - Cleanup of DT schema type references on common properties and standard unit properties * tag 'devicetree-for-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (64 commits) powerpc: If kexec_build_elf_info() fails return immediately from elf64_load() powerpc: Free fdt on error in elf64_load() of: overlay: Fix kerneldoc warning in of_overlay_remove() of: linux/of.h: fix kernel-doc warnings of/pci: Add IORESOURCE_MEM_64 to resource flags for 64-bit memory addresses dt-bindings: bcm4329-fmac: add optional brcm,ccode-map docs: dt: update writing-schema.rst references dt-bindings: media: venus: Add sm8250 dt schema of: base: Fix spelling issue with function param 'prop' docs: dt: Add DT API documentation of: Add missing 'Return' section in kerneldoc comments of: Fix kerneldoc output formatting docs: dt: Group DT docs into relevant sub-sections docs: dt: Make 'Devicetree' wording more consistent docs: dt: writing-schema: Include the example schema in the doc build docs: dt: writing-schema: Remove spurious indentation dt-bindings: Fix reference in submitting-patches.rst to the DT ABI doc dt-bindings: ddr: Add optional manufacturer and revision ID to LPDDR3 dt-bindings: media: video-interfaces: Drop the example devicetree: bindings: clock: Minor typo fix in the file armada3700-tbg-clock.txt ...

Linus Torvalds committed 5 years ago

Commit 00806652 parents 5a69e9b 031cc26102 files · +1671 −1457Browse files

Unified · Split

102 files
  1. Documentation/devicetree/bindings/Makefile +4 −1
  2. Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml +1 −4
  3. Documentation/devicetree/bindings/arm/cpus.yaml +0 −2
  4. Documentation/devicetree/bindings/clock/allwinner,sun4i-a10-pll1-clk.yaml +1 −1
  5. Documentation/devicetree/bindings/clock/armada3700-tbg-clock.txt +1 −1
  6. Documentation/devicetree/bindings/clock/milbeaut-clock.yaml +7 −5
  7. Documentation/devicetree/bindings/ddr/lpddr3.txt +5 −0
  8. Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tcon.yaml +0 −1
  9. Documentation/devicetree/bindings/display/brcm,bcm2835-dsi0.yaml +0 −6
  10. Documentation/devicetree/bindings/display/msm/dpu.txt +2 −2
  11. Documentation/devicetree/bindings/display/panel/panel-dpi.yaml +1 −1
  12. Documentation/devicetree/bindings/dma/qcom,gpi.yaml +1 −1
  13. Documentation/devicetree/bindings/gpio/socionext,uniphier-gpio.yaml +1 −2
  14. Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml +1 −1
  15. Documentation/devicetree/bindings/i3c/i3c.yaml +4 −3
  16. Documentation/devicetree/bindings/iio/adc/brcm,iproc-static-adc.yaml +0 −5
  17. Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.yaml +1 −1
  18. Documentation/devicetree/bindings/iio/light/capella,cm3605.yaml +0 −1
  19. Documentation/devicetree/bindings/iio/light/upisemi,us5182.yaml +2 −2
  20. Documentation/devicetree/bindings/index.rst +2 −5
  21. Documentation/devicetree/bindings/input/input.yaml +0 −1
  22. Documentation/devicetree/bindings/interrupt-controller/loongson,htpic.yaml +1 −1
  23. Documentation/devicetree/bindings/leds/leds-lgm.yaml +22 −4
  24. Documentation/devicetree/bindings/media/qcom,sm8250-venus.yaml +167 −0
  25. Documentation/devicetree/bindings/media/video-interfaces.yaml +0 −127
  26. Documentation/devicetree/bindings/media/video-mux.txt +0 −60
  27. Documentation/devicetree/bindings/media/video-mux.yaml +106 −0
  28. Documentation/devicetree/bindings/memory-controllers/nvidia,tegra210-emc.yaml +1 −1
  29. Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +0 −1
  30. Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml +109 −0
  31. Documentation/devicetree/bindings/net/wireless/brcm,bcm43xx-fmac.txt +0 −38
  32. Documentation/devicetree/bindings/nvmem/nvmem-consumer.yaml +1 −3
  33. Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml +1 −1
  34. Documentation/devicetree/bindings/power/supply/bq256xx.yaml +0 −1
  35. Documentation/devicetree/bindings/power/supply/cw2015_battery.yaml +1 −1
  36. Documentation/devicetree/bindings/power/supply/ltc4162-l.yaml +0 −2
  37. Documentation/devicetree/bindings/power/supply/power-supply.yaml +0 −22
  38. Documentation/devicetree/bindings/regulator/qcom-labibb-regulator.yaml +0 −1
  39. Documentation/devicetree/bindings/remoteproc/ti,omap-remoteproc.yaml +1 −1
  40. Documentation/devicetree/bindings/serial/serial.yaml +1 −1
  41. Documentation/devicetree/bindings/sound/ak4642.yaml +0 −2
  42. Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml +1 −1
  43. Documentation/devicetree/bindings/sound/renesas,rsnd.yaml +0 −1
  44. Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml +2 −2
  45. Documentation/devicetree/bindings/spi/spi-controller.yaml +11 −10
  46. Documentation/devicetree/bindings/spi/spi-mux.yaml +2 −6
  47. Documentation/devicetree/bindings/spi/st,stm32-spi.yaml +0 −6
  48. Documentation/devicetree/bindings/submitting-patches.rst +3 −3
  49. Documentation/devicetree/bindings/thermal/qcom-spmi-adc-tm5.yaml +0 −2
  50. Documentation/devicetree/bindings/trivial-devices.yaml +3 −0
  51. Documentation/devicetree/bindings/usb/usb.yaml +0 −1
  52. Documentation/devicetree/bindings/vendor-prefixes.yaml +6 −0
  53. Documentation/devicetree/bindings/writing-schema.rst +14 −3
  54. Documentation/devicetree/changesets.rst +4 −4
  55. Documentation/devicetree/dynamic-resolution-notes.rst +4 −4
  56. Documentation/devicetree/index.rst +16 −3
  57. Documentation/devicetree/kernel-api.rst +57 −0
  58. Documentation/devicetree/of_unittest.rst +3 −3
  59. Documentation/devicetree/overlay-notes.rst +4 −4
  60. Documentation/devicetree/usage-model.rst +4 −4
  61. arch/arm64/Kconfig +1 −0
  62. arch/arm64/include/asm/kexec.h +0 −4
  63. arch/arm64/kernel/machine_kexec_file.c +15 −181
  64. arch/powerpc/Kconfig +1 −1
  65. arch/powerpc/include/asm/ima.h +0 −30
  66. arch/powerpc/include/asm/kexec.h +2 −14
  67. arch/powerpc/kexec/Makefile +0 −7
  68. arch/powerpc/kexec/elf_64.c +17 −15
  69. arch/powerpc/kexec/file_load.c +1 −182
  70. arch/powerpc/kexec/file_load_64.c +18 −29
  71. arch/powerpc/kexec/ima.c +0 −219
  72. arch/x86/include/asm/kexec.h +0 −5
  73. arch/x86/kernel/crash.c +7 −7
  74. arch/x86/kernel/kexec-bzimage64.c +1 −1
  75. arch/x86/kernel/machine_kexec_64.c +2 −2
  76. drivers/of/Makefile +6 −0
  77. drivers/of/address.c +7 −1
  78. drivers/of/base.c +168 −160
  79. drivers/of/device.c +6 −1
  80. drivers/of/dynamic.c +15 −8
  81. drivers/of/fdt.c +20 −20
  82. drivers/of/irq.c +7 −7
  83. drivers/of/kexec.c +458 −0
  84. drivers/of/of_net.c +3 −0
  85. drivers/of/of_reserved_mem.c +3 −3
  86. drivers/of/overlay.c +10 −9
  87. drivers/of/platform.c +6 −6
  88. drivers/of/property.c +44 −28
  89. drivers/of/unittest-data/Makefile +48 −0
  90. drivers/of/unittest-data/overlay_base.dts +1 −89
  91. drivers/of/unittest-data/overlay_common.dtsi +91 −0
  92. drivers/of/unittest-data/static_base_1.dts +4 −0
  93. drivers/of/unittest-data/static_base_2.dts +4 −0
  94. drivers/of/unittest-data/testcases.dts +12 −11
  95. drivers/of/unittest-data/testcases_common.dtsi +19 −0
  96. drivers/of/unittest-data/tests-interrupts.dtsi +5 −6
  97. include/linux/kexec.h +8 −0
  98. include/linux/of.h +50 −24
  99. scripts/Makefile.lib +28 −6
  100. scripts/checkpatch.pl +1 −1
  101. security/integrity/ima/ima.h +0 −4
  102. security/integrity/ima/ima_kexec.c +3 −6
Documentation/devicetree/bindings/Makefile+4−1
@@ -5,7 +5,7 @@ DT_MK_SCHEMA ?= dt-mk-schema · 4 unmodified lines
55
66 DT_SCHEMA_LINT = $(shell which yamllint)
77
8−DT_SCHEMA_MIN_VERSION = 2020.8.1
8+DT_SCHEMA_MIN_VERSION = 2021.2.1
99
1010 PHONY += check_dtschema_version
1111 check_dtschema_version:
@@ -55,6 +55,9 @@ override DTC_FLAGS := \ · 43 unmodified lines
5555 -Wno-graph_child_address \
5656 -Wno-interrupt_provider
5757
58+# Disable undocumented compatible checks until warning free
59+override DT_CHECKER_FLAGS ?=
60+
5861 $(obj)/processed-schema-examples.json: $(DT_DOCS) $(src)/.yamllint check_dtschema_version FORCE
5962 $(call if_changed_rule,chkdt)
6063
Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml+1−4
@@ -26,10 +26,7 @@ properties: · 25 unmodified lines
2626 - const: simple-mfd
2727
2828 mboxes:
29− $ref: '/schemas/types.yaml#/definitions/phandle'
30− description: |
31− Phandle to the firmware device's Mailbox.
32− (See: ../mailbox/mailbox.txt for more information)
29+ maxItems: 1
3330
3431 clocks:
3532 type: object
Documentation/devicetree/bindings/arm/cpus.yaml+0−2
@@ -258,13 +258,11 @@ properties: · 257 unmodified lines
258258 where voltage is in V, frequency is in MHz.
259259
260260 power-domains:
261− $ref: '/schemas/types.yaml#/definitions/phandle-array'
262261 description:
263262 List of phandles and PM domain specifiers, as defined by bindings of the
264263 PM domain provider (see also ../power_domain.txt).
265264
266265 power-domain-names:
267− $ref: '/schemas/types.yaml#/definitions/string-array'
268266 description:
269267 A list of power domain name strings sorted in the same order as the
270268 power-domains property.
Documentation/devicetree/bindings/clock/allwinner,sun4i-a10-pll1-clk.yaml+1−1
@@ -44,7 +44,7 @@ examples: · 43 unmodified lines
4444 - |
4545 clk@1c20000 {
4646 #clock-cells = <0>;
47− compatible = "allwinner,sun4i-a10-pll1";
47+ compatible = "allwinner,sun4i-a10-pll1-clk";
4848 reg = <0x01c20000 0x4>;
4949 clocks = <&osc24M>;
5050 clock-output-names = "osc24M";
Documentation/devicetree/bindings/clock/armada3700-tbg-clock.txt+1−1
@@ -1,6 +1,6 @@
11 * Time Base Generator Clock bindings for Marvell Armada 37xx SoCs
22
3−Marvell Armada 37xx SoCs provde Time Base Generator clocks which are
3+Marvell Armada 37xx SoCs provide Time Base Generator clocks which are
44 used as parent clocks for the peripheral clocks.
55
66 The TBG clock consumer should specify the desired clock by having the
Documentation/devicetree/bindings/clock/milbeaut-clock.yaml+7−5
@@ -18,10 +18,12 @@ description: | · 17 unmodified lines
1818
1919 properties:
2020 compatible:
21− oneOf:
22− - items:
23− - enum:
24− - socionext,milbeaut-m10v-ccu
21+ enum:
22+ - socionext,milbeaut-m10v-ccu
23+
24+ reg:
25+ maxItems: 1
26+
2527 clocks:
2628 maxItems: 1
2729 description: external clock
@@ -41,7 +43,7 @@ examples: · 13 unmodified lines
4143 # Clock controller node:
4244 - |
4345 m10v-clk-ctrl@1d021000 {
44− compatible = "socionext,milbeaut-m10v-clk-ccu";
46+ compatible = "socionext,milbeaut-m10v-ccu";
4547 reg = <0x1d021000 0x4000>;
4648 #clock-cells = <1>;
4749 clocks = <&clki40mhz>;
Documentation/devicetree/bindings/ddr/lpddr3.txt+5−0
@@ -12,6 +12,9 @@ Required properties: · 11 unmodified lines
1212
1313 Optional properties:
1414
15+- manufacturer-id : <u32> Manufacturer ID value read from Mode Register 5
16+- revision-id : <u32 u32> Revision IDs read from Mode Registers 6 and 7
17+
1518 The following optional properties represent the minimum value of some AC
1619 timing parameters of the DDR device in terms of number of clock cycles.
1720 These values shall be obtained from the device data-sheet.
@@ -49,6 +52,8 @@ samsung_K3QF2F20DB: lpddr3 { · 31 unmodified lines
4952 compatible = "samsung,K3QF2F20DB", "jedec,lpddr3";
5053 density = <16384>;
5154 io-width = <32>;
55+ manufacturer-id = <1>;
56+ revision-id = <123 234>;
5257 #address-cells = <1>;
5358 #size-cells = <0>;
5459
Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tcon.yaml+0−1
@@ -73,7 +73,6 @@ properties: · 72 unmodified lines
7373 clock-output-names:
7474 description:
7575 Name of the LCD pixel clock created.
76− $ref: /schemas/types.yaml#/definitions/string-array
7776 maxItems: 1
7877
7978 dmas:
Documentation/devicetree/bindings/display/brcm,bcm2835-dsi0.yaml+0−6
@@ -77,12 +77,6 @@ examples: · 76 unmodified lines
7777
7878 clock-output-names = "dsi1_byte", "dsi1_ddr2", "dsi1_ddr";
7979
80− pitouchscreen: panel@0 {
81− compatible = "raspberrypi,touchscreen";
82− reg = <0>;
83−
84− /* ... */
85− };
8680 };
8781
8882 ...
Documentation/devicetree/bindings/display/msm/dpu.txt+2−2
@@ -2,14 +2,14 @@ Qualcomm Technologies, Inc. DPU KMS · 1 unmodified line
22
33 Description:
44
5−Device tree bindings for MSM Mobile Display Subsytem(MDSS) that encapsulates
5+Device tree bindings for MSM Mobile Display Subsystem(MDSS) that encapsulates
66 sub-blocks like DPU display controller, DSI and DP interfaces etc.
77 The DPU display controller is found in SDM845 SoC.
88
99 MDSS:
1010 Required properties:
1111 - compatible: "qcom,sdm845-mdss", "qcom,sc7180-mdss"
12−- reg: physical base address and length of contoller's registers.
12+- reg: physical base address and length of controller's registers.
1313 - reg-names: register region names. The following region is required:
1414 * "mdss"
1515 - power-domains: a power domain consumer specifier according to
Documentation/devicetree/bindings/display/panel/panel-dpi.yaml+1−1
@@ -40,7 +40,7 @@ additionalProperties: false · 39 unmodified lines
4040 examples:
4141 - |
4242 panel {
43− compatible = "osddisplays,osd057T0559-34ts", "panel-dpi";
43+ compatible = "startek,startek-kd050c", "panel-dpi";
4444 label = "osddisplay";
4545 power-supply = <&vcc_supply>;
4646 backlight = <&backlight>;
Documentation/devicetree/bindings/dma/qcom,gpi.yaml+1−1
@@ -64,7 +64,7 @@ examples: · 63 unmodified lines
6464 #include <dt-bindings/interrupt-controller/arm-gic.h>
6565 #include <dt-bindings/dma/qcom-gpi.h>
6666 gpi_dma0: dma-controller@800000 {
67− compatible = "qcom,gpi-dma";
67+ compatible = "qcom,sdm845-gpi-dma";
6868 #dma-cells = <3>;
6969 reg = <0x00800000 0x60000>;
7070 iommus = <&apps_smmu 0x0016 0x0>;
Documentation/devicetree/bindings/gpio/socionext,uniphier-gpio.yaml+1−2
@@ -43,8 +43,7 @@ properties: · 42 unmodified lines
4343
4444 gpio-ranges: true
4545
46− gpio-ranges-group-names:
47− $ref: /schemas/types.yaml#/definitions/string-array
46+ gpio-ranges-group-names: true
4847
4948 socionext,interrupt-ranges:
5049 description: |
Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml+1−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44 $id: "http://devicetree.org/schemas/i2c/xlnx,xps-iic-2.00.a.yaml#"
55 $schema: "http://devicetree.org/meta-schemas/core.yaml#"
66
7−title: ilinx IIC controller Device Tree Bindings
7+title: Xilinx IIC controller Device Tree Bindings
88
99 maintainers:
1010 - info@mocean-labs.com
Documentation/devicetree/bindings/i3c/i3c.yaml+4−3
@@ -157,9 +157,10 @@ examples: · 156 unmodified lines
157157 i2c-scl-hz = <100000>;
158158
159159 /* I2C device. */
160− nunchuk: nunchuk@52 {
161− compatible = "nintendo,nunchuk";
162− reg = <0x52 0x0 0x10>;
160+ eeprom@57 {
161+ compatible = "atmel,24c01";
162+ reg = <0x57 0x0 0x10>;
163+ pagesize = <0x8>;
163164 };
164165
165166 /* I3C device with a static I2C address. */
Documentation/devicetree/bindings/iio/adc/brcm,iproc-static-adc.yaml+0−5
@@ -53,11 +53,6 @@ examples: · 52 unmodified lines
5353 #address-cells = <1>;
5454 #size-cells = <1>;
5555
56− ts_adc_syscon: ts_adc_syscon@180a6000 {
57− compatible = "brcm,iproc-ts-adc-syscon","syscon";
58− reg = <0x180a6000 0xc30>;
59− };
60−
6156 adc {
6257 compatible = "brcm,iproc-static-adc";
6358 adc-syscon = <&ts_adc_syscon>;
Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.yaml+1−1
@@ -83,7 +83,7 @@ examples: · 82 unmodified lines
8383 #size-cells = <0>;
8484
8585 gyroscope@0 {
86− compatible = "nxp,fxas2102c";
86+ compatible = "nxp,fxas21002c";
8787 reg = <0x0>;
8888
8989 spi-max-frequency = <2000000>;
Documentation/devicetree/bindings/iio/light/capella,cm3605.yaml+0−1
@@ -48,7 +48,6 @@ properties: · 47 unmodified lines
4848 vdd-supply: true
4949
5050 capella,aset-resistance-ohms:
51− $ref: /schemas/types.yaml#/definitions/uint32
5251 enum: [50000, 100000, 300000, 600000]
5352 description: >
5453 Sensitivity calibration resistance. Note that calibration curves
Documentation/devicetree/bindings/iio/light/upisemi,us5182.yaml+2−2
@@ -11,12 +11,12 @@ maintainers: · 10 unmodified lines
1111
1212 properties:
1313 compatible:
14− const: upisemi,asd5182
14+ const: upisemi,usd5182
1515
1616 reg:
1717 maxItems: 1
1818
19− upsemi,glass-coef:
19+ upisemi,glass-coef:
2020 $ref: /schemas/types.yaml#/definitions/uint32
2121 description: |
2222 glass attenuation factor - compensation factor of resolution 1000
Documentation/devicetree/bindings/index.rst+2−5
@@ -1,12 +1,9 @@
11 .. SPDX-License-Identifier: GPL-2.0
22
3−===========
4−Device Tree
5−===========
6−
73 .. toctree::
84 :maxdepth: 1
95
106 ABI
11− submitting-patches
127 writing-bindings
8+ writing-schema
9+ submitting-patches
Documentation/devicetree/bindings/input/input.yaml+0−1
@@ -32,6 +32,5 @@ properties: · 31 unmodified lines
3232 Duration in seconds which the key should be kept pressed for device to
3333 power off automatically. Device with key pressed shutdown feature can
3434 specify this property.
35− $ref: /schemas/types.yaml#/definitions/uint32
3635
3736 additionalProperties: true
Documentation/devicetree/bindings/interrupt-controller/loongson,htpic.yaml+1−1
@@ -47,7 +47,7 @@ examples: · 46 unmodified lines
4747 - |
4848 #include <dt-bindings/interrupt-controller/irq.h>
4949 htintc: interrupt-controller@1fb000080 {
50− compatible = "loongson,htintc-1.0";
50+ compatible = "loongson,htpic-1.0";
5151 reg = <0xfb000080 0x40>;
5252 interrupt-controller;
5353 #interrupt-cells = <1>;
Documentation/devicetree/bindings/leds/leds-lgm.yaml+22−4
@@ -14,6 +14,17 @@ properties: · 13 unmodified lines
1414 compatible:
1515 const: intel,lgm-ssoled
1616
17+ reg:
18+ maxItems: 1
19+
20+ clocks:
21+ maxItems: 2
22+
23+ clock-names:
24+ items:
25+ - const: sso
26+ - const: fpid
27+
1728 gpio-controller: true
1829
1930 '#gpio-cells':
@@ -36,8 +47,15 @@ properties: · 16 unmodified lines
3647
3748 additionalProperties: false
3849
50+ properties:
51+ '#address-cells':
52+ const: 1
53+
54+ '#size-cells':
55+ const: 0
56+
3957 patternProperties:
40− "^led@[0-23]$":
58+ "^led@[0-2]$":
4159 type: object
4260
4361 properties:
@@ -81,7 +99,7 @@ examples: · 37 unmodified lines
8199 #include <dt-bindings/leds/common.h>
82100
83101 ssogpio: ssogpio@e0d40000 {
84− compatible = "intel,sso-led";
102+ compatible = "intel,lgm-ssoled";
85103 reg = <0xE0D40000 0x2E4>;
86104 gpio-controller;
87105 #gpio-cells = <2>;
@@ -103,8 +121,8 @@ examples: · 15 unmodified lines
103121 led-gpio = <&ssogpio 0 0>;
104122 };
105123
106− led@23 {
107− reg = <23>;
124+ led@2 {
125+ reg = <2>;
108126 function = LED_FUNCTION_POWER;
109127 color = <LED_COLOR_ID_GREEN>;
110128 led-gpio = <&ssogpio 23 0>;
Documentation/devicetree/bindings/media/qcom,sm8250-venus.yaml+167−0
@@ -0,0 +1,167 @@
1+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+
3+%YAML 1.2
4+---
5+$id: "http://devicetree.org/schemas/media/qcom,sm8250-venus.yaml#"
6+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
7+
8+title: Qualcomm Venus video encode and decode accelerators
9+
10+maintainers:
11+ - Stanimir Varbanov <stanimir.varbanov@linaro.org>
12+
13+description: |
14+ The Venus IP is a video encode and decode accelerator present
15+ on Qualcomm platforms
16+
17+properties:
18+ compatible:
19+ const: qcom,sm8250-venus
20+
21+ reg:
22+ maxItems: 1
23+
24+ interrupts:
25+ maxItems: 1
26+
27+ power-domains:
28+ minItems: 2
29+ maxItems: 3
30+
31+ power-domain-names:
32+ minItems: 2
33+ maxItems: 3
34+ items:
35+ - const: venus
36+ - const: vcodec0
37+ - const: mx
38+
39+ clocks:
40+ maxItems: 3
41+
42+ clock-names:
43+ items:
44+ - const: iface
45+ - const: core
46+ - const: vcodec0_core
47+
48+ iommus:
49+ maxItems: 1
50+
51+ memory-region:
52+ maxItems: 1
53+
54+ interconnects:
55+ maxItems: 2
56+
57+ interconnect-names:
58+ items:
59+ - const: cpu-cfg
60+ - const: video-mem
61+
62+ resets:
63+ maxItems: 2
64+
65+ reset-names:
66+ items:
67+ - const: bus
68+ - const: core
69+
70+ video-decoder:
71+ type: object
72+
73+ properties:
74+ compatible:
75+ const: venus-decoder
76+
77+ required:
78+ - compatible
79+
80+ additionalProperties: false
81+
82+ video-encoder:
83+ type: object
84+
85+ properties:
86+ compatible:
87+ const: venus-encoder
88+
89+ required:
90+ - compatible
91+
92+ additionalProperties: false
93+
94+ video-firmware:
95+ type: object
96+
97+ description: |
98+ Firmware subnode is needed when the platform does not
99+ have TrustZone.
100+
101+ properties:
102+ iommus:
103+ maxItems: 1
104+
105+ required:
106+ - iommus
107+
108+required:
109+ - compatible
110+ - reg
111+ - interrupts
112+ - power-domains
113+ - power-domain-names
114+ - clocks
115+ - clock-names
116+ - interconnects
117+ - interconnect-names
118+ - iommus
119+ - memory-region
120+ - resets
121+ - reset-names
122+ - video-decoder
123+ - video-encoder
124+
125+additionalProperties: false
126+
127+examples:
128+ - |
129+ #include <dt-bindings/interrupt-controller/arm-gic.h>
130+ #include <dt-bindings/clock/qcom,videocc-sm8250.h>
131+ #include <dt-bindings/interconnect/qcom,sm8250.h>
132+ #include <dt-bindings/clock/qcom,gcc-sm8250.h>
133+ #include <dt-bindings/power/qcom-rpmpd.h>
134+
135+ venus: video-codec@aa00000 {
136+ compatible = "qcom,sm8250-venus";
137+ reg = <0x0aa00000 0xff000>;
138+ interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
139+ power-domains = <&videocc MVS0C_GDSC>,
140+ <&videocc MVS0_GDSC>,
141+ <&rpmhpd SM8250_MX>;
142+ power-domain-names = "venus", "vcodec0", "mx";
143+
144+ clocks = <&gcc GCC_VIDEO_AXI0_CLK>,
145+ <&videocc VIDEO_CC_MVS0C_CLK>,
146+ <&videocc VIDEO_CC_MVS0_CLK>;
147+ clock-names = "iface", "core", "vcodec0_core";
148+
149+ interconnects = <&gem_noc MASTER_AMPSS_M0 &config_noc SLAVE_VENUS_CFG>,
150+ <&mmss_noc MASTER_VIDEO_P0 &mc_virt SLAVE_EBI_CH0>;
151+ interconnect-names = "cpu-cfg", "video-mem";
152+
153+ iommus = <&apps_smmu 0x2100 0x0400>;
154+ memory-region = <&video_mem>;
155+
156+ resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>,
157+ <&videocc VIDEO_CC_MVS0C_CLK_ARES>;
158+ reset-names = "bus", "core";
159+
160+ video-decoder {
161+ compatible = "venus-decoder";
162+ };
163+
164+ video-encoder {
165+ compatible = "venus-encoder";
166+ };
167+ };
Documentation/devicetree/bindings/media/video-interfaces.yaml+0−127
@@ -215,130 +215,3 @@ properties: · 214 unmodified lines
215215 CCP2, for instance.
216216
217217 additionalProperties: true
218−
219−examples:
220− # The example snippet below describes two data pipelines. ov772x and imx074
221− # are camera sensors with a parallel and serial (MIPI CSI-2) video bus
222− # respectively. Both sensors are on the I2C control bus corresponding to the
223− # i2c0 controller node. ov772x sensor is linked directly to the ceu0 video
224− # host interface. imx074 is linked to ceu0 through the MIPI CSI-2 receiver
225− # (csi2). ceu0 has a (single) DMA engine writing captured data to memory.
226− # ceu0 node has a single 'port' node which may indicate that at any time
227− # only one of the following data pipelines can be active:
228− # ov772x -> ceu0 or imx074 -> csi2 -> ceu0.
229− - |
230− ceu@fe910000 {
231− compatible = "renesas,sh-mobile-ceu";
232− reg = <0xfe910000 0xa0>;
233− interrupts = <0x880>;
234−
235− mclk: master_clock {
236− compatible = "renesas,ceu-clock";
237− #clock-cells = <1>;
238− clock-frequency = <50000000>; /* Max clock frequency */
239− clock-output-names = "mclk";
240− };
241−
242− port {
243− #address-cells = <1>;
244− #size-cells = <0>;
245−
246− /* Parallel bus endpoint */
247− ceu0_1: endpoint@1 {
248− reg = <1>; /* Local endpoint # */
249− remote-endpoint = <&ov772x_1_1>; /* Remote phandle */
250− bus-width = <8>; /* Used data lines */
251− data-shift = <2>; /* Lines 9:2 are used */
252−
253− /* If hsync-active/vsync-active are missing,
254− embedded BT.656 sync is used */
255− hsync-active = <0>; /* Active low */
256− vsync-active = <0>; /* Active low */
257− data-active = <1>; /* Active high */
258− pclk-sample = <1>; /* Rising */
259− };
260−
261− /* MIPI CSI-2 bus endpoint */
262− ceu0_0: endpoint@0 {
263− reg = <0>;
264− remote-endpoint = <&csi2_2>;
265− };
266− };
267− };
268−
269− i2c {
270− #address-cells = <1>;
271− #size-cells = <0>;
272−
273− camera@21 {
274− compatible = "ovti,ov772x";
275− reg = <0x21>;
276− vddio-supply = <&regulator1>;
277− vddcore-supply = <&regulator2>;
278−
279− clock-frequency = <20000000>;
280− clocks = <&mclk 0>;
281− clock-names = "xclk";
282−
283− port {
284− /* With 1 endpoint per port no need for addresses. */
285− ov772x_1_1: endpoint {
286− bus-width = <8>;
287− remote-endpoint = <&ceu0_1>;
288− hsync-active = <1>;
289− vsync-active = <0>; /* Who came up with an
290− inverter here ?... */
291− data-active = <1>;
292− pclk-sample = <1>;
293− };
294− };
295− };
296−
297− camera@1a {
298− compatible = "sony,imx074";
299− reg = <0x1a>;
300− vddio-supply = <&regulator1>;
301− vddcore-supply = <&regulator2>;
302−
303− clock-frequency = <30000000>; /* Shared clock with ov772x_1 */
304− clocks = <&mclk 0>;
305− clock-names = "sysclk"; /* Assuming this is the
306− name in the datasheet */
307− port {
308− imx074_1: endpoint {
309− clock-lanes = <0>;
310− data-lanes = <1 2>;
311− remote-endpoint = <&csi2_1>;
312− };
313− };
314− };
315− };
316−
317− csi2: csi2@ffc90000 {
318− compatible = "renesas,sh-mobile-csi2";
319− reg = <0xffc90000 0x1000>;
320− interrupts = <0x17a0>;
321− #address-cells = <1>;
322− #size-cells = <0>;
323−
324− port@1 {
325− compatible = "renesas,csi2c"; /* One of CSI2I and CSI2C. */
326− reg = <1>; /* CSI-2 PHY #1 of 2: PHY_S,
327− PHY_M has port address 0,
328− is unused. */
329− csi2_1: endpoint {
330− clock-lanes = <0>;
331− data-lanes = <2 1>;
332− remote-endpoint = <&imx074_1>;
333− };
334− };
335− port@2 {
336− reg = <2>; /* port 2: link to the CEU */
337−
338− csi2_2: endpoint {
339− remote-endpoint = <&ceu0_0>;
340− };
341− };
342− };
343−
344−...
Documentation/devicetree/bindings/media/video-mux.txt+0−60
@@ -1,60 +0,0 @@
1−Video Multiplexer
2−=================
3−
4−Video multiplexers allow to select between multiple input ports. Video received
5−on the active input port is passed through to the output port. Muxes described
6−by this binding are controlled by a multiplexer controller that is described by
7−the bindings in Documentation/devicetree/bindings/mux/mux-controller.txt
8−
9−Required properties:
10−- compatible : should be "video-mux"
11−- mux-controls : mux controller node to use for operating the mux
12−- #address-cells: should be <1>
13−- #size-cells: should be <0>
14−- port@*: at least three port nodes containing endpoints connecting to the
15− source and sink devices according to of_graph bindings. The last port is
16− the output port, all others are inputs.
17−
18−Optionally, #address-cells, #size-cells, and port nodes can be grouped under a
19−ports node as described in Documentation/devicetree/bindings/graph.txt.
20−
21−Example:
22−
23− mux: mux-controller {
24− compatible = "gpio-mux";
25− #mux-control-cells = <0>;
26−
27− mux-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
28− };
29−
30− video-mux {
31− compatible = "video-mux";
32− mux-controls = <&mux>;
33− #address-cells = <1>;
34− #size-cells = <0>;
35−
36− port@0 {
37− reg = <0>;
38−
39− mux_in0: endpoint {
40− remote-endpoint = <&video_source0_out>;
41− };
42− };
43−
44− port@1 {
45− reg = <1>;
46−
47− mux_in1: endpoint {
48− remote-endpoint = <&video_source1_out>;
49− };
50− };
51−
52− port@2 {
53− reg = <2>;
54−
55− mux_out: endpoint {
56− remote-endpoint = <&capture_interface_in>;
57− };
58− };
59− };
60−};
Documentation/devicetree/bindings/media/video-mux.yaml+106−0
@@ -0,0 +1,106 @@
1+# SPDX-License-Identifier: GPL-2.0
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/media/video-mux.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Video Multiplexer
8+
9+maintainers:
10+ - Sakari Ailus <sakari.ailus@linux.intel.com>
11+ - Laurent Pinchart <laurent.pinchart@ideasonboard.com>
12+
13+description:
14+ Video multiplexers allow to select between multiple input ports. Video
15+ received on the active input port is passed through to the output port. Muxes
16+ described by this binding are controlled by a multiplexer controller.
17+
18+properties:
19+ compatible:
20+ const: video-mux
21+
22+ mux-controls:
23+ maxItems: 1
24+
25+ '#address-cells':
26+ const: 1
27+
28+ '#size-cells':
29+ const: 0
30+
31+ ports:
32+ $ref: /schemas/graph.yaml#/properties/ports
33+
34+ patternProperties:
35+ '^port@':
36+ $ref: /schemas/graph.yaml#/properties/port
37+
38+ required:
39+ - port@0
40+ - port@1
41+ - port@2
42+
43+patternProperties:
44+ '^port@':
45+ $ref: /schemas/graph.yaml#/properties/port
46+ description:
47+ At least three port nodes containing endpoints connecting to the source
48+ and sink devices according to of_graph bindings. The last port is the
49+ output port, all others are inputs.
50+
51+required:
52+ - compatible
53+ - mux-controls
54+
55+oneOf:
56+ - required:
57+ - ports
58+ - required:
59+ - port@0
60+ - port@1
61+ - port@2
62+
63+additionalProperties: false
64+
65+examples:
66+ - |
67+ #include <dt-bindings/gpio/gpio.h>
68+
69+ mux: mux-controller {
70+ compatible = "gpio-mux";
71+ #mux-control-cells = <0>;
72+
73+ mux-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
74+ };
75+
76+ video-mux {
77+ compatible = "video-mux";
78+ mux-controls = <&mux>;
79+ #address-cells = <1>;
80+ #size-cells = <0>;
81+
82+ port@0 {
83+ reg = <0>;
84+
85+ mux_in0: endpoint {
86+ remote-endpoint = <&video_source0_out>;
87+ };
88+ };
89+
90+ port@1 {
91+ reg = <1>;
92+
93+ mux_in1: endpoint {
94+ remote-endpoint = <&video_source1_out>;
95+ };
96+ };
97+
98+ port@2 {
99+ reg = <2>;
100+
101+ mux_out: endpoint {
102+ remote-endpoint = <&capture_interface_in>;
103+ };
104+ };
105+ };
106+...
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra210-emc.yaml+1−1
@@ -34,7 +34,7 @@ properties: · 33 unmodified lines
3434 - description: EMC general interrupt
3535
3636 memory-region:
37− $ref: /schemas/types.yaml#/definitions/phandle
37+ maxItems: 1
3838 description:
3939 phandle to a reserved memory region describing the table of EMC
4040 frequencies trained by the firmware
Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml+0−1
@@ -57,7 +57,6 @@ properties: · 56 unmodified lines
5757 - const: per
5858
5959 clock-frequency:
60− $ref: /schemas/types.yaml#/definitions/uint32
6160 description: |
6261 The oscillator frequency driving the flexcan device, filled in by the
6362 boot loader. This property should only be used the used operating system
Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml+109−0
@@ -0,0 +1,109 @@
1+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/net/wireless/brcm,bcm4329-fmac.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Broadcom BCM4329 family fullmac wireless SDIO devices
8+
9+maintainers:
10+ - Arend van Spriel <arend@broadcom.com>
11+
12+description:
13+ The Broadcom Single chip MAC part for the BCM4329 family and
14+ later Cypress chips in the same family named CYW4373 and similar.
15+ These chips also have a Bluetooth portion described in a separate
16+ binding.
17+
18+properties:
19+ compatible:
20+ oneOf:
21+ - items:
22+ - enum:
23+ - brcm,bcm43143-fmac
24+ - brcm,bcm4341b0-fmac
25+ - brcm,bcm4341b4-fmac
26+ - brcm,bcm4341b5-fmac
27+ - brcm,bcm4329-fmac
28+ - brcm,bcm4330-fmac
29+ - brcm,bcm4334-fmac
30+ - brcm,bcm43340-fmac
31+ - brcm,bcm4335-fmac
32+ - brcm,bcm43362-fmac
33+ - brcm,bcm4339-fmac
34+ - brcm,bcm43430a0-fmac
35+ - brcm,bcm43430a1-fmac
36+ - brcm,bcm43455-fmac
37+ - brcm,bcm43456-fmac
38+ - brcm,bcm4354-fmac
39+ - brcm,bcm4356-fmac
40+ - brcm,bcm4359-fmac
41+ - cypress,cyw4373-fmac
42+ - cypress,cyw43012-fmac
43+ - const: brcm,bcm4329-fmac
44+ - const: brcm,bcm4329-fmac
45+
46+ reg:
47+ description: SDIO function number for the device, for most cases
48+ this will be 1.
49+
50+ interrupts:
51+ maxItems: 1
52+ description: Out-of-band (OOB) IRQ line for waking up the host
53+ in response to WLAN activity. This corresponds to the HOST_WAKE
54+ line into the chip.
55+
56+ interrupt-names:
57+ description: Name for the OOB IRQ, this must be set to "host-wake".
58+ const: host-wake
59+
60+ brcm,drive-strength:
61+ $ref: /schemas/types.yaml#/definitions/uint32
62+ description: Drive strength used for the SDIO pins on the device in mA.
63+ minimum: 0
64+ maximum: 32
65+
66+ reset-gpios:
67+ maxItems: 1
68+ description: A GPIO line connected to the WL_RST line, if present
69+ this shall be flagged as active low.
70+
71+ brcm,ccode-map:
72+ $ref: /schemas/types.yaml#/definitions/string-array
73+ description: Multiple strings for translating ISO3166 country code to
74+ brcmfmac firmware country code and revision.
75+ items:
76+ pattern: '^[A-Z][A-Z]-[A-Z][0-9A-Z]-[0-9]+$'
77+
78+required:
79+ - compatible
80+ - reg
81+
82+additionalProperties: false
83+
84+examples:
85+ - |
86+ #include <dt-bindings/interrupt-controller/irq.h>
87+ #include <dt-bindings/gpio/gpio.h>
88+ mmc@80118000 {
89+ compatible = "arm,pl18x", "arm,primecell";
90+ reg = <0x80118000 0x1000>;
91+ clocks = <&clk 0>, <&clk 1>;
92+ clock-names = "mclk", "apb_pclk";
93+ interrupts = <0 60 IRQ_TYPE_LEVEL_HIGH>;
94+ bus-width = <4>;
95+ non-removable;
96+ vmmc-supply = <&wl_bt_reg>;
97+ #address-cells = <1>;
98+ #size-cells = <0>;
99+
100+ wifi@1 {
101+ compatible = "brcm,bcm4334-fmac", "brcm,bcm4329-fmac";
102+ reg = <1>;
103+ interrupt-parent = <&gpio>;
104+ interrupts = <24 IRQ_TYPE_EDGE_FALLING>;
105+ interrupt-names = "host-wake";
106+ reset-gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
107+ brcm,ccode-map = "JP-JP-78", "US-Q2-86";
108+ };
109+ };
Documentation/devicetree/bindings/net/wireless/brcm,bcm43xx-fmac.txt+0−38
@@ -1,38 +0,0 @@
1−Broadcom BCM43xx Fullmac wireless SDIO devices
2−
3−This node provides properties for controlling the Broadcom wireless device. The
4−node is expected to be specified as a child node to the SDIO controller that
5−connects the device to the system.
6−
7−Required properties:
8−
9− - compatible : Should be "brcm,bcm4329-fmac".
10−
11−Optional properties:
12− - brcm,drive-strength : drive strength used for SDIO pins on device in mA
13− (default = 6).
14− - interrupts : specifies attributes for the out-of-band interrupt (host-wake).
15− When not specified the device will use in-band SDIO interrupts.
16− - interrupt-names : name of the out-of-band interrupt, which must be set
17− to "host-wake".
18−
19−Example:
20−
21−mmc3: mmc@1c12000 {
22− #address-cells = <1>;
23− #size-cells = <0>;
24−
25− pinctrl-names = "default";
26− pinctrl-0 = <&mmc3_pins_a>;
27− vmmc-supply = <&reg_vmmc3>;
28− bus-width = <4>;
29− non-removable;
30−
31− brcmf: wifi@1 {
32− reg = <1>;
33− compatible = "brcm,bcm4329-fmac";
34− interrupt-parent = <&pio>;
35− interrupts = <10 8>; /* PH10 / EINT10 */
36− interrupt-names = "host-wake";
37− };
38−};
Documentation/devicetree/bindings/nvmem/nvmem-consumer.yaml+1−3
@@ -2,7 +2,7 @@ · 1 unmodified line
22 %YAML 1.2
33 ---
44 $id: http://devicetree.org/schemas/nvmem/nvmem-consumer.yaml#
5−$schema: http://devicetree.org/meta-schemas/core.yaml#
5+$schema: http://devicetree.org/meta-schemas/base.yaml#
66
77 title: NVMEM (Non Volatile Memory) Consumer Device Tree Bindings
88
@@ -23,12 +23,10 @@ properties: · 14 unmodified lines
2323 List of phandle to the nvmem data cells.
2424
2525 nvmem-names:
26− $ref: /schemas/types.yaml#/definitions/string-array
2726 description:
2827 Names for the each nvmem provider.
2928
3029 nvmem-cell-names:
31− $ref: /schemas/types.yaml#/definitions/string-array
3230 description:
3331 Names for each nvmem-cells specified.
3432
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml+1−1
@@ -222,7 +222,7 @@ examples: · 221 unmodified lines
222222 };
223223
224224 serdes@5000000 {
225− compatible = "cdns,ti,sierra-phy-t0";
225+ compatible = "ti,sierra-phy-t0";
226226 reg-names = "serdes";
227227 reg = <0x5000000 0x10000>;
228228 #address-cells = <1>;
Documentation/devicetree/bindings/power/supply/bq256xx.yaml+0−1
@@ -39,7 +39,6 @@ properties: · 38 unmodified lines
3939 maxItems: 1
4040
4141 ti,watchdog-timeout-ms:
42− $ref: /schemas/types.yaml#/definitions/uint32
4342 default: 0
4443 description: |
4544 Watchdog timer in ms. 0 (default) disables the watchdog
Documentation/devicetree/bindings/power/supply/cw2015_battery.yaml+1−1
@@ -61,7 +61,7 @@ examples: · 60 unmodified lines
6161 #size-cells = <0>;
6262
6363 cw2015@62 {
64− compatible = "cellwise,cw201x";
64+ compatible = "cellwise,cw2015";
6565 reg = <0x62>;
6666 cellwise,battery-profile = /bits/ 8 <
6767 0x17 0x67 0x80 0x73 0x6E 0x6C 0x6B 0x63
Documentation/devicetree/bindings/power/supply/ltc4162-l.yaml+0−2
@@ -29,12 +29,10 @@ properties: · 28 unmodified lines
2929 description: I2C address of the charger.
3030
3131 lltc,rsnsb-micro-ohms:
32− $ref: /schemas/types.yaml#/definitions/uint32
3332 description: Battery sense resistor in microohm.
3433 minimum: 1000
3534
3635 lltc,rsnsi-micro-ohms:
37− $ref: /schemas/types.yaml#/definitions/uint32
3836 description: Input current sense resistor in microohm.
3937 minimum: 1000
4038
Documentation/devicetree/bindings/power/supply/power-supply.yaml+0−22
@@ -18,25 +18,3 @@ properties: · 17 unmodified lines
1818
1919 additionalProperties: true
2020
21−examples:
22− - |
23− power {
24− #address-cells = <1>;
25− #size-cells = <0>;
26−
27− usb_charger:charger@e {
28− compatible = "some,usb-charger";
29− reg = <0xe>;
30− };
31−
32− ac_charger:charger@c {
33− compatible = "some,ac-charger";
34− reg = <0xc>;
35− };
36−
37− battery:battery@b {
38− compatible = "some,battery";
39− reg = <0xb>;
40− power-supplies = <&usb_charger>, <&ac_charger>;
41− };
42− };
Documentation/devicetree/bindings/regulator/qcom-labibb-regulator.yaml+0−1
@@ -23,7 +23,6 @@ properties: · 22 unmodified lines
2323
2424 properties:
2525 qcom,soft-start-us:
26− $ref: /schemas/types.yaml#/definitions/uint32
2726 description: Regulator soft start time in microseconds.
2827 enum: [200, 400, 600, 800]
2928 default: 200
Documentation/devicetree/bindings/remoteproc/ti,omap-remoteproc.yaml+1−1
@@ -93,7 +93,7 @@ properties: · 92 unmodified lines
9393 # The following are the optional properties:
9494
9595 memory-region:
96− $ref: /schemas/types.yaml#/definitions/phandle
96+ maxItems: 1
9797 description: |
9898 phandle to the reserved memory node to be associated
9999 with the remoteproc device. The reserved memory node
Documentation/devicetree/bindings/serial/serial.yaml+1−1
@@ -144,7 +144,7 @@ examples: · 143 unmodified lines
144144 interrupts = <1>;
145145
146146 bluetooth {
147− compatible = "brcm,bcm43341-bt";
147+ compatible = "brcm,bcm4330-bt";
148148 interrupt-parent = <&gpio>;
149149 interrupts = <10>;
150150 };
Documentation/devicetree/bindings/sound/ak4642.yaml+0−2
@@ -29,11 +29,9 @@ properties: · 28 unmodified lines
2929
3030 clock-frequency:
3131 description: common clock binding; frequency of MCKO
32− $ref: /schemas/types.yaml#/definitions/uint32
3332
3433 clock-output-names:
3534 description: common clock name
36− $ref: /schemas/types.yaml#/definitions/string
3735
3836 required:
3937 - compatible
Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml+1−1
@@ -32,7 +32,7 @@ properties: · 31 unmodified lines
3232 The last one integer is the length of the shared memory.
3333
3434 memory-region:
35− $ref: '/schemas/types.yaml#/definitions/phandle'
35+ maxItems: 1
3636 description: |
3737 Shared memory region to EC. A "shared-dma-pool".
3838 See ../reserved-memory/reserved-memory.txt for details.
Documentation/devicetree/bindings/sound/renesas,rsnd.yaml+0−1
@@ -78,7 +78,6 @@ properties: · 77 unmodified lines
7878
7979 clock-frequency:
8080 description: for audio_clkout0/1/2/3
81− $ref: /schemas/types.yaml#/definitions/uint32-array
8281
8382 clkout-lr-asynchronous:
8483 description: audio_clkoutn is asynchronizes with lr-clock.
Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml+2−2
@@ -90,8 +90,8 @@ examples: · 89 unmodified lines
9090 #address-cells = <1>;
9191 #size-cells = <0>;
9292
93− ethernet-switch@0 {
94− compatible = "micrel,ks8995m";
93+ display@0 {
94+ compatible = "lg,lg4573";
9595 spi-max-frequency = <1000000>;
9696 reg = <0>;
9797 };
Documentation/devicetree/bindings/spi/spi-controller.yaml+11−10
@@ -181,22 +181,23 @@ additionalProperties: true · 180 unmodified lines
181181
182182 examples:
183183 - |
184− spi@f00 {
184+ spi@80010000 {
185185 #address-cells = <1>;
186186 #size-cells = <0>;
187− compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi";
188− reg = <0xf00 0x20>;
189− interrupts = <2 13 0 2 14 0>;
190− interrupt-parent = <&mpc5200_pic>;
191−
192− ethernet-switch@0 {
193− compatible = "micrel,ks8995m";
187+ compatible = "fsl,imx28-spi";
188+ reg = <0x80010000 0x2000>;
189+ interrupts = <96>;
190+ dmas = <&dma_apbh 0>;
191+ dma-names = "rx-tx";
192+
193+ display@0 {
194+ compatible = "lg,lg4573";
194195 spi-max-frequency = <1000000>;
195196 reg = <0>;
196197 };
197198
198− codec@1 {
199− compatible = "ti,tlv320aic26";
199+ sensor@1 {
200+ compatible = "bosch,bme680";
200201 spi-max-frequency = <100000>;
201202 reg = <1>;
202203 };
Documentation/devicetree/bindings/spi/spi-mux.yaml+2−6
@@ -75,16 +75,12 @@ examples: · 74 unmodified lines
7575 spi-flash@0 {
7676 compatible = "jedec,spi-nor";
7777 reg = <0>;
78− #address-cells = <1>;
79− #size-cells = <0>;
8078 spi-max-frequency = <40000000>;
8179 };
8280
83− spi-device@1 {
84− compatible = "lineartechnology,ltc2488";
81+ sensor@1 {
82+ compatible = "bosch,bme680";
8583 reg = <1>;
86− #address-cells = <1>;
87− #size-cells = <0>;
8884 spi-max-frequency = <10000000>;
8985 };
9086 };
Documentation/devicetree/bindings/spi/st,stm32-spi.yaml+0−6
@@ -96,12 +96,6 @@ examples: · 95 unmodified lines
9696 dma-names = "rx", "tx";
9797 cs-gpios = <&gpioa 11 0>;
9898
99− aardvark@0 {
100− compatible = "totalphase,aardvark";
101− reg = <0>;
102− spi-max-frequency = <4000000>;
103− st,spi-midi-ns = <4000>;
104− };
10599 };
106100
107101 ...
Documentation/devicetree/bindings/submitting-patches.rst+3−3
@@ -1,7 +1,7 @@
11 .. SPDX-License-Identifier: GPL-2.0
22
33 ==========================================
4−Submitting devicetree (DT) binding patches
4+Submitting Devicetree (DT) binding patches
55 ==========================================
66
77 I. For patch submitters
@@ -25,7 +25,7 @@ I. For patch submitters · 17 unmodified lines
2525
2626 make dt_binding_check
2727
28− See Documentation/devicetree/writing-schema.rst for more details about
28+ See Documentation/devicetree/bindings/writing-schema.rst for more details about
2929 schema and tools setup.
3030
3131 3) DT binding files should be dual licensed. The preferred license tag is
@@ -84,7 +84,7 @@ II. For kernel maintainers · 52 unmodified lines
8484 III. Notes
8585 ==========
8686
87− 0) Please see ...bindings/ABI.txt for details regarding devicetree ABI.
87+ 0) Please see :doc:`ABI` for details regarding devicetree ABI.
8888
8989 1) This document is intended as a general familiarization with the process as
9090 decided at the 2013 Kernel Summit. When in doubt, the current word of the
Documentation/devicetree/bindings/thermal/qcom-spmi-adc-tm5.yaml+0−2
@@ -59,7 +59,6 @@ patternProperties: · 58 unmodified lines
5959
6060 properties:
6161 reg:
62− $ref: /schemas/types.yaml#/definitions/uint32
6362 description: Specify the sensor channel. There are 8 channels in PMIC5's ADC TM
6463 minimum: 0
6564 maximum: 7
@@ -78,7 +77,6 @@ patternProperties: · 12 unmodified lines
7877 also known as absolute calibration.
7978
8079 qcom,hw-settle-time-us:
81− $ref: /schemas/types.yaml#/definitions/uint32
8280 description: Time between AMUX getting configured and the ADC starting conversion.
8381 enum: [15, 100, 200, 300, 400, 500, 600, 700, 1000, 2000, 4000, 8000, 16000, 32000, 64000, 128000]
8482
Documentation/devicetree/bindings/trivial-devices.yaml+3−0
@@ -23,6 +23,9 @@ properties: · 22 unmodified lines
2323 maxItems: 1
2424 interrupts:
2525 maxItems: 1
26+
27+ spi-max-frequency: true
28+
2629 compatible:
2730 items:
2831 - enum:
Documentation/devicetree/bindings/usb/usb.yaml+0−1
@@ -16,7 +16,6 @@ properties: · 15 unmodified lines
1616 pattern: "^usb(@.*)?"
1717
1818 phys:
19− $ref: /schemas/types.yaml#/definitions/phandle-array
2019 description:
2120 List of all the USB PHYs on this HCD
2221
Documentation/devicetree/bindings/vendor-prefixes.yaml+6−0
@@ -57,6 +57,8 @@ patternProperties: · 56 unmodified lines
5757 description: Advantech Corporation
5858 "^aeroflexgaisler,.*":
5959 description: Aeroflex Gaisler AB
60+ "^aesop,.*":
61+ description: AESOP Embedded Forum
6062 "^al,.*":
6163 description: Annapurna Labs
6264 "^alcatel,.*":
@@ -1030,6 +1032,8 @@ patternProperties: · 967 unmodified lines
10301032 description: Silergy Corp.
10311033 "^silex-insight,.*":
10321034 description: Silex Insight
1035+ "^siliconfile,.*":
1036+ description: Siliconfile Technologies lnc.
10331037 "^siliconmitus,.*":
10341038 description: Silicon Mitus, Inc.
10351039 "^siemens,.*":
@@ -1282,6 +1286,8 @@ patternProperties: · 246 unmodified lines
12821286 description: Yamaha Corporation
12831287 "^yes-optoelectronics,.*":
12841288 description: Yes Optoelectronics Co.,Ltd.
1289+ "^yic,.*":
1290+ description: YIC System Co., Ltd.
12851291 "^ylm,.*":
12861292 description: Shenzhen Yangliming Electronic Technology Co., Ltd.
12871293 "^yna,.*":
Documentation/devicetree/bindings/writing-schema.rstrenamed from Documentation/devicetree/writing-schema.rst+14−3
@@ -1,6 +1,6 @@
11 .. SPDX-License-Identifier: GPL-2.0
22
3−Writing DeviceTree Bindings in json-schema
3+Writing Devicetree Bindings in json-schema
44 ==========================================
55
66 Devicetree bindings are written using json-schema vocabulary. Schema files are
@@ -8,6 +8,8 @@ written in a JSON compatible subset of YAML. YAML is used instead of JSON as it · 1 unmodified line
88 is considered more human readable and has some advantages such as allowing
99 comments (Prefixed with '#').
1010
11+Also see :ref:`example-schema`.
12+
1113 Schema Contents
1214 ---------------
1315
@@ -46,12 +48,12 @@ select · 32 unmodified lines
4648 schema. By default without 'select', nodes are matched against their possible
4749 compatible string values or node name. Most bindings should not need select.
4850
49− allOf
51+allOf
5052 Optional. A list of other schemas to include. This is used to
5153 include other schemas the binding conforms to. This may be schemas for a
5254 particular class of devices such as I2C or SPI controllers.
5355
54− properties
56+properties
5557 A set of sub-schema defining all the DT properties for the
5658 binding. The exact schema syntax depends on whether properties are known,
5759 common properties (e.g. 'interrupts') or are binding/vendor specific properties.
@@ -170,3 +172,12 @@ json-schema Resources · 112 unmodified lines
170172 `JSON-Schema Specifications <http://json-schema.org/>`_
171173
172174 `Using JSON Schema Book <http://usingjsonschema.com/>`_
175+
176+.. _example-schema:
177+
178+Annotated Example Schema
179+------------------------
180+
181+Also available as a separate file: :download:`example-schema.yaml`
182+
183+.. literalinclude:: example-schema.yaml
Documentation/devicetree/changesets.rst+4−4
@@ -1,10 +1,10 @@
11 .. SPDX-License-Identifier: GPL-2.0
22
3−=============
4−DT Changesets
5−=============
3+=====================
4+Devicetree Changesets
5+=====================
66
7−A DT changeset is a method which allows one to apply changes
7+A Devicetree changeset is a method which allows one to apply changes
88 in the live tree in such a way that either the full set of changes
99 will be applied, or none of them will be. If an error occurs partway
1010 through applying the changeset, then the tree will be rolled back to the
Documentation/devicetree/dynamic-resolution-notes.rst+4−4
@@ -1,11 +1,11 @@
11 .. SPDX-License-Identifier: GPL-2.0
22
3−==================================
4−Device Tree Dynamic Resolver Notes
5−==================================
3+=================================
4+Devicetree Dynamic Resolver Notes
5+=================================
66
77 This document describes the implementation of the in-kernel
8−Device Tree resolver, residing in drivers/of/resolver.c
8+DeviceTree resolver, residing in drivers/of/resolver.c
99
1010 How the resolver works
1111 ----------------------
Documentation/devicetree/index.rst+16−3
@@ -1,17 +1,30 @@
11 .. SPDX-License-Identifier: GPL-2.0
22
33 =============================
4−Open Firmware and Device Tree
4+Open Firmware and Devicetree
55 =============================
66
7+Kernel Devicetree Usage
8+=======================
79 .. toctree::
810 :maxdepth: 1
911
1012 usage-model
11− writing-schema
13+ of_unittest
14+ kernel-api
15+
16+Devicetree Overlays
17+===================
18+.. toctree::
19+ :maxdepth: 1
20+
1221 changesets
1322 dynamic-resolution-notes
14− of_unittest
1523 overlay-notes
1624
25+Devicetree Bindings
26+===================
27+.. toctree::
28+ :maxdepth: 1
29+
1730 bindings/index
Documentation/devicetree/kernel-api.rst+57−0
@@ -0,0 +1,57 @@
1+.. SPDX-License-Identifier: GPL-2.0
2+.. _devicetree:
3+
4+======================================
5+DeviceTree Kernel API
6+======================================
7+
8+Core functions
9+--------------
10+
11+.. kernel-doc:: drivers/of/base.c
12+ :export:
13+
14+.. kernel-doc:: include/linux/of.h
15+ :internal:
16+
17+.. kernel-doc:: drivers/of/property.c
18+ :export:
19+
20+.. kernel-doc:: include/linux/of_graph.h
21+ :internal:
22+
23+.. kernel-doc:: drivers/of/address.c
24+ :export:
25+
26+.. kernel-doc:: drivers/of/irq.c
27+ :export:
28+
29+.. kernel-doc:: drivers/of/fdt.c
30+ :export:
31+
32+Driver model functions
33+----------------------
34+
35+.. kernel-doc:: include/linux/of_device.h
36+ :internal:
37+
38+.. kernel-doc:: drivers/of/device.c
39+ :export:
40+
41+.. kernel-doc:: include/linux/of_platform.h
42+ :internal:
43+
44+.. kernel-doc:: drivers/of/platform.c
45+ :export:
46+
47+Overlay and Dynamic DT functions
48+--------------------------------
49+
50+.. kernel-doc:: drivers/of/resolver.c
51+ :export:
52+
53+.. kernel-doc:: drivers/of/dynamic.c
54+ :export:
55+
56+.. kernel-doc:: drivers/of/overlay.c
57+ :export:
Documentation/devicetree/of_unittest.rst+3−3
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0
22
3−==================================
4−Open Firmware Device Tree Unittest
5−==================================
3+=================================
4+Open Firmware Devicetree Unittest
5+=================================
66
77 Author: Gaurav Minocha <gaurav.minocha.os@gmail.com>
88
Documentation/devicetree/overlay-notes.rst+4−4
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0
22
3−=========================
4−Device Tree Overlay Notes
5−=========================
3+========================
4+Devicetree Overlay Notes
5+========================
66
77 This document describes the implementation of the in-kernel
88 device tree overlay functionality residing in drivers/of/overlay.c and is a
@@ -11,7 +11,7 @@ companion document to Documentation/devicetree/dynamic-resolution-notes.rst[1] · 2 unmodified lines
1111 How overlays work
1212 -----------------
1313
14−A Device Tree's overlay purpose is to modify the kernel's live tree, and
14+A Devicetree's overlay purpose is to modify the kernel's live tree, and
1515 have the modification affecting the state of the kernel in a way that
1616 is reflecting the changes.
1717 Since the kernel mainly deals with devices, any new device node that result
Documentation/devicetree/usage-model.rst+4−4
@@ -1,8 +1,8 @@
11 .. SPDX-License-Identifier: GPL-2.0
22
3−=========================
4−Linux and the Device Tree
5−=========================
3+========================
4+Linux and the Devicetree
5+========================
66
77 The Linux usage model for device tree data
88
@@ -14,7 +14,7 @@ at devicetree.org\ [1]_. · 5 unmodified lines
1414
1515 .. [1] https://www.devicetree.org/specifications/
1616
17−The "Open Firmware Device Tree", or simply Device Tree (DT), is a data
17+The "Open Firmware Device Tree", or simply Devicetree (DT), is a data
1818 structure and language for describing hardware. More specifically, it
1919 is a description of hardware that is readable by an operating system
2020 so that the operating system doesn't need to hard code details of the
arch/arm64/Kconfig+1−0
@@ -1113,6 +1113,7 @@ config KEXEC · 1112 unmodified lines
11131113 config KEXEC_FILE
11141114 bool "kexec file based system call"
11151115 select KEXEC_CORE
1116+ select HAVE_IMA_KEXEC if IMA
11161117 help
11171118 This is new version of kexec system call. This system call is
11181119 file based and takes file descriptors as system call argument
arch/arm64/include/asm/kexec.h+0−4
@@ -96,10 +96,6 @@ struct kimage_arch { · 95 unmodified lines
9696 void *dtb;
9797 phys_addr_t dtb_mem;
9898 phys_addr_t kern_reloc;
99− /* Core ELF header buffer */
100− void *elf_headers;
101− unsigned long elf_headers_mem;
102− unsigned long elf_headers_sz;
10399 };
104100
105101 #ifdef CONFIG_KEXEC_FILE
arch/arm64/kernel/machine_kexec_file.c+15−181
@@ -15,23 +15,12 @@ · 14 unmodified lines
1515 #include <linux/kexec.h>
1616 #include <linux/libfdt.h>
1717 #include <linux/memblock.h>
18+#include <linux/of.h>
1819 #include <linux/of_fdt.h>
19−#include <linux/random.h>
2020 #include <linux/slab.h>
2121 #include <linux/string.h>
2222 #include <linux/types.h>
2323 #include <linux/vmalloc.h>
24−#include <asm/byteorder.h>
25−
26−/* relevant device tree properties */
27−#define FDT_PROP_KEXEC_ELFHDR "linux,elfcorehdr"
28−#define FDT_PROP_MEM_RANGE "linux,usable-memory-range"
29−#define FDT_PROP_INITRD_START "linux,initrd-start"
30−#define FDT_PROP_INITRD_END "linux,initrd-end"
31−#define FDT_PROP_BOOTARGS "bootargs"
32−#define FDT_PROP_KASLR_SEED "kaslr-seed"
33−#define FDT_PROP_RNG_SEED "rng-seed"
34−#define RNG_SEED_SIZE 128
3524
3625 const struct kexec_file_ops * const kexec_file_loaders[] = {
3726 &kexec_image_ops,
@@ -40,174 +29,16 @@ const struct kexec_file_ops * const kexec_file_loaders[] = { · 2 unmodified lines
4029
4130 int arch_kimage_file_post_load_cleanup(struct kimage *image)
4231 {
43− vfree(image->arch.dtb);
32+ kvfree(image->arch.dtb);
4433 image->arch.dtb = NULL;
4534
46− vfree(image->arch.elf_headers);
47− image->arch.elf_headers = NULL;
48− image->arch.elf_headers_sz = 0;
35+ vfree(image->elf_headers);
36+ image->elf_headers = NULL;
37+ image->elf_headers_sz = 0;
4938
5039 return kexec_image_post_load_cleanup_default(image);
5140 }
5241
53−static int setup_dtb(struct kimage *image,
54− unsigned long initrd_load_addr, unsigned long initrd_len,
55− char *cmdline, void *dtb)
56−{
57− int off, ret;
58−
59− ret = fdt_path_offset(dtb, "/chosen");
60− if (ret < 0)
61− goto out;
62−
63− off = ret;
64−
65− ret = fdt_delprop(dtb, off, FDT_PROP_KEXEC_ELFHDR);
66− if (ret && ret != -FDT_ERR_NOTFOUND)
67− goto out;
68− ret = fdt_delprop(dtb, off, FDT_PROP_MEM_RANGE);
69− if (ret && ret != -FDT_ERR_NOTFOUND)
70− goto out;
71−
72− if (image->type == KEXEC_TYPE_CRASH) {
73− /* add linux,elfcorehdr */
74− ret = fdt_appendprop_addrrange(dtb, 0, off,
75− FDT_PROP_KEXEC_ELFHDR,
76− image->arch.elf_headers_mem,
77− image->arch.elf_headers_sz);
78− if (ret)
79− return (ret == -FDT_ERR_NOSPACE ? -ENOMEM : -EINVAL);
80−
81− /* add linux,usable-memory-range */
82− ret = fdt_appendprop_addrrange(dtb, 0, off,
83− FDT_PROP_MEM_RANGE,
84− crashk_res.start,
85− crashk_res.end - crashk_res.start + 1);
86− if (ret)
87− return (ret == -FDT_ERR_NOSPACE ? -ENOMEM : -EINVAL);
88− }
89−
90− /* add bootargs */
91− if (cmdline) {
92− ret = fdt_setprop_string(dtb, off, FDT_PROP_BOOTARGS, cmdline);
93− if (ret)
94− goto out;
95− } else {
96− ret = fdt_delprop(dtb, off, FDT_PROP_BOOTARGS);
97− if (ret && (ret != -FDT_ERR_NOTFOUND))
98− goto out;
99− }
100−
101− /* add initrd-* */
102− if (initrd_load_addr) {
103− ret = fdt_setprop_u64(dtb, off, FDT_PROP_INITRD_START,
104− initrd_load_addr);
105− if (ret)
106− goto out;
107−
108− ret = fdt_setprop_u64(dtb, off, FDT_PROP_INITRD_END,
109− initrd_load_addr + initrd_len);
110− if (ret)
111− goto out;
112− } else {
113− ret = fdt_delprop(dtb, off, FDT_PROP_INITRD_START);
114− if (ret && (ret != -FDT_ERR_NOTFOUND))
115− goto out;
116−
117− ret = fdt_delprop(dtb, off, FDT_PROP_INITRD_END);
118− if (ret && (ret != -FDT_ERR_NOTFOUND))
119− goto out;
120− }
121−
122− /* add kaslr-seed */
123− ret = fdt_delprop(dtb, off, FDT_PROP_KASLR_SEED);
124− if (ret == -FDT_ERR_NOTFOUND)
125− ret = 0;
126− else if (ret)
127− goto out;
128−
129− if (rng_is_initialized()) {
130− u64 seed = get_random_u64();
131− ret = fdt_setprop_u64(dtb, off, FDT_PROP_KASLR_SEED, seed);
132− if (ret)
133− goto out;
134− } else {
135− pr_notice("RNG is not initialised: omitting \"%s\" property\n",
136− FDT_PROP_KASLR_SEED);
137− }
138−
139− /* add rng-seed */
140− if (rng_is_initialized()) {
141− void *rng_seed;
142− ret = fdt_setprop_placeholder(dtb, off, FDT_PROP_RNG_SEED,
143− RNG_SEED_SIZE, &rng_seed);
144− if (ret)
145− goto out;
146− get_random_bytes(rng_seed, RNG_SEED_SIZE);
147− } else {
148− pr_notice("RNG is not initialised: omitting \"%s\" property\n",
149− FDT_PROP_RNG_SEED);
150− }
151−
152−out:
153− if (ret)
154− return (ret == -FDT_ERR_NOSPACE) ? -ENOMEM : -EINVAL;
155−
156− return 0;
157−}
158−
159−/*
160− * More space needed so that we can add initrd, bootargs, kaslr-seed,
161− * rng-seed, userable-memory-range and elfcorehdr.
162− */
163−#define DTB_EXTRA_SPACE 0x1000
164−
165−static int create_dtb(struct kimage *image,
166− unsigned long initrd_load_addr, unsigned long initrd_len,
167− char *cmdline, void **dtb)
168−{
169− void *buf;
170− size_t buf_size;
171− size_t cmdline_len;
172− int ret;
173−
174− cmdline_len = cmdline ? strlen(cmdline) : 0;
175− buf_size = fdt_totalsize(initial_boot_params)
176− + cmdline_len + DTB_EXTRA_SPACE;
177−
178− for (;;) {
179− buf = vmalloc(buf_size);
180− if (!buf)
181− return -ENOMEM;
182−
183− /* duplicate a device tree blob */
184− ret = fdt_open_into(initial_boot_params, buf, buf_size);
185− if (ret) {
186− vfree(buf);
187− return -EINVAL;
188− }
189−
190− ret = setup_dtb(image, initrd_load_addr, initrd_len,
191− cmdline, buf);
192− if (ret) {
193− vfree(buf);
194− if (ret == -ENOMEM) {
195− /* unlikely, but just in case */
196− buf_size += DTB_EXTRA_SPACE;
197− continue;
198− } else {
199− return ret;
200− }
201− }
202−
203− /* trim it */
204− fdt_pack(buf);
205− *dtb = buf;
206−
207− return 0;
208− }
209−}
210−
21142 static int prepare_elf_headers(void **addr, unsigned long *sz)
21243 {
21344 struct crash_mem *cmem;
@@ -284,12 +115,12 @@ int load_other_segments(struct kimage *image, · 70 unmodified lines
284115 vfree(headers);
285116 goto out_err;
286117 }
287− image->arch.elf_headers = headers;
288− image->arch.elf_headers_mem = kbuf.mem;
289− image->arch.elf_headers_sz = headers_sz;
118+ image->elf_headers = headers;
119+ image->elf_load_addr = kbuf.mem;
120+ image->elf_headers_sz = headers_sz;
290121
291122 pr_debug("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
292− image->arch.elf_headers_mem, kbuf.bufsz, kbuf.memsz);
123+ image->elf_load_addr, kbuf.bufsz, kbuf.memsz);
293124 }
294125
295126 /* load initrd */
@@ -314,12 +145,15 @@ int load_other_segments(struct kimage *image, · 18 unmodified lines
314145 }
315146
316147 /* load dtb */
317− ret = create_dtb(image, initrd_load_addr, initrd_len, cmdline, &dtb);
318− if (ret) {
148+ dtb = of_kexec_alloc_and_setup_fdt(image, initrd_load_addr,
149+ initrd_len, cmdline, 0);
150+ if (!dtb) {
319151 pr_err("Preparing for new dtb failed\n");
320152 goto out_err;
321153 }
322154
155+ /* trim it */
156+ fdt_pack(dtb);
323157 dtb_len = fdt_totalsize(dtb);
324158 kbuf.buffer = dtb;
325159 kbuf.bufsz = dtb_len;
@@ -343,6 +177,6 @@ int load_other_segments(struct kimage *image, · 17 unmodified lines
343177
344178 out_err:
345179 image->nr_segments = orig_segments;
346− vfree(dtb);
180+ kvfree(dtb);
347181 return ret;
348182 }
arch/powerpc/Kconfig+1−1
@@ -548,7 +548,7 @@ config KEXEC · 547 unmodified lines
548548 config KEXEC_FILE
549549 bool "kexec file based system call"
550550 select KEXEC_CORE
551− select HAVE_IMA_KEXEC
551+ select HAVE_IMA_KEXEC if IMA
552552 select BUILD_BIN2C
553553 select KEXEC_ELF
554554 depends on PPC64
arch/powerpc/include/asm/ima.h+0−30
@@ -1,30 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
2−#ifndef _ASM_POWERPC_IMA_H
3−#define _ASM_POWERPC_IMA_H
4−
5−struct kimage;
6−
7−int ima_get_kexec_buffer(void **addr, size_t *size);
8−int ima_free_kexec_buffer(void);
9−
10−#ifdef CONFIG_IMA
11−void remove_ima_buffer(void *fdt, int chosen_node);
12−#else
13−static inline void remove_ima_buffer(void *fdt, int chosen_node) {}
14−#endif
15−
16−#ifdef CONFIG_IMA_KEXEC
17−int arch_ima_add_kexec_buffer(struct kimage *image, unsigned long load_addr,
18− size_t size);
19−
20−int setup_ima_buffer(const struct kimage *image, void *fdt, int chosen_node);
21−#else
22−static inline int setup_ima_buffer(const struct kimage *image, void *fdt,
23− int chosen_node)
24−{
25− remove_ima_buffer(fdt, chosen_node);
26− return 0;
27−}
28−#endif /* CONFIG_IMA_KEXEC */
29−
30−#endif /* _ASM_POWERPC_IMA_H */
arch/powerpc/include/asm/kexec.h+2−14
@@ -107,15 +107,7 @@ struct kimage_arch { · 106 unmodified lines
107107
108108 unsigned long backup_start;
109109 void *backup_buf;
110−
111− unsigned long elfcorehdr_addr;
112− unsigned long elf_headers_sz;
113− void *elf_headers;
114−
115−#ifdef CONFIG_IMA_KEXEC
116− phys_addr_t ima_buffer_addr;
117− size_t ima_buffer_size;
118−#endif
110+ void *fdt;
119111 };
120112
121113 char *setup_kdump_cmdline(struct kimage *image, char *cmdline,
@@ -123,10 +115,6 @@ char *setup_kdump_cmdline(struct kimage *image, char *cmdline, · 1 unmodified line
123115 int setup_purgatory(struct kimage *image, const void *slave_code,
124116 const void *fdt, unsigned long kernel_load_addr,
125117 unsigned long fdt_load_addr);
126−int setup_new_fdt(const struct kimage *image, void *fdt,
127− unsigned long initrd_load_addr, unsigned long initrd_len,
128− const char *cmdline);
129−int delete_fdt_mem_rsv(void *fdt, unsigned long start, unsigned long size);
130118
131119 #ifdef CONFIG_PPC64
132120 struct kexec_buf;
@@ -136,7 +124,7 @@ int load_crashdump_segments_ppc64(struct kimage *image, · 3 unmodified lines
136124 int setup_purgatory_ppc64(struct kimage *image, const void *slave_code,
137125 const void *fdt, unsigned long kernel_load_addr,
138126 unsigned long fdt_load_addr);
139−unsigned int kexec_fdt_totalsize_ppc64(struct kimage *image);
127+unsigned int kexec_extra_fdt_size_ppc64(struct kimage *image);
140128 int setup_new_fdt_ppc64(const struct kimage *image, void *fdt,
141129 unsigned long initrd_load_addr,
142130 unsigned long initrd_len, const char *cmdline);
arch/powerpc/kexec/Makefile+0−7
@@ -9,13 +9,6 @@ obj-$(CONFIG_PPC32) += relocate_32.o · 8 unmodified lines
99
1010 obj-$(CONFIG_KEXEC_FILE) += file_load.o ranges.o file_load_$(BITS).o elf_$(BITS).o
1111
12−ifdef CONFIG_HAVE_IMA_KEXEC
13−ifdef CONFIG_IMA
14−obj-y += ima.o
15−endif
16−endif
17−
18−
1912 # Disable GCOV, KCOV & sanitizers in odd or sensitive code
2013 GCOV_PROFILE_core_$(BITS).o := n
2114 KCOV_INSTRUMENT_core_$(BITS).o := n
arch/powerpc/kexec/elf_64.c+17−15
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <linux/kexec.h>
2020 #include <linux/libfdt.h>
2121 #include <linux/module.h>
22+#include <linux/of.h>
2223 #include <linux/of_fdt.h>
2324 #include <linux/slab.h>
2425 #include <linux/types.h>
@@ -29,7 +30,6 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, · 4 unmodified lines
2930 unsigned long cmdline_len)
3031 {
3132 int ret;
32− unsigned int fdt_size;
3333 unsigned long kernel_load_addr;
3434 unsigned long initrd_load_addr = 0, fdt_load_addr;
3535 void *fdt;
@@ -45,7 +45,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, · 9 unmodified lines
4545
4646 ret = kexec_build_elf_info(kernel_buf, kernel_len, &ehdr, &elf_info);
4747 if (ret)
48− goto out;
48+ return ERR_PTR(ret);
4949
5050 if (image->type == KEXEC_TYPE_CRASH) {
5151 /* min & max buffer values for kdump case */
@@ -102,15 +102,10 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, · 50 unmodified lines
102102 pr_debug("Loaded initrd at 0x%lx\n", initrd_load_addr);
103103 }
104104
105− fdt_size = kexec_fdt_totalsize_ppc64(image);
106− fdt = kmalloc(fdt_size, GFP_KERNEL);
105+ fdt = of_kexec_alloc_and_setup_fdt(image, initrd_load_addr,
106+ initrd_len, cmdline,
107+ kexec_extra_fdt_size_ppc64(image));
107108 if (!fdt) {
108− pr_err("Not enough memory for the device tree.\n");
109− ret = -ENOMEM;
110− goto out;
111− }
112− ret = fdt_open_into(initial_boot_params, fdt, fdt_size);
113− if (ret < 0) {
114109 pr_err("Error setting up the new device tree.\n");
115110 ret = -EINVAL;
116111 goto out;
@@ -119,18 +114,22 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, · 2 unmodified lines
119114 ret = setup_new_fdt_ppc64(image, fdt, initrd_load_addr,
120115 initrd_len, cmdline);
121116 if (ret)
122− goto out;
117+ goto out_free_fdt;
123118
124119 fdt_pack(fdt);
125120
126121 kbuf.buffer = fdt;
127− kbuf.bufsz = kbuf.memsz = fdt_size;
122+ kbuf.bufsz = kbuf.memsz = fdt_totalsize(fdt);
128123 kbuf.buf_align = PAGE_SIZE;
129124 kbuf.top_down = true;
130125 kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
131126 ret = kexec_add_buffer(&kbuf);
132127 if (ret)
133− goto out;
128+ goto out_free_fdt;
129+
130+ /* FDT will be freed in arch_kimage_file_post_load_cleanup */
131+ image->arch.fdt = fdt;
132+
134133 fdt_load_addr = kbuf.mem;
135134
136135 pr_debug("Loaded device tree at 0x%lx\n", fdt_load_addr);
@@ -141,12 +140,15 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, · 4 unmodified lines
141140 if (ret)
142141 pr_err("Error setting up the purgatory.\n");
143142
143+ goto out;
144+
145+out_free_fdt:
146+ kvfree(fdt);
144147 out:
145148 kfree(modified_cmdline);
146149 kexec_free_elf_info(&elf_info);
147150
148− /* Make kimage_file_post_load_cleanup free the fdt buffer for us. */
149− return ret ? ERR_PTR(ret) : fdt;
151+ return ret ? ERR_PTR(ret) : NULL;
150152 }
151153
152154 const struct kexec_file_ops kexec_elf64_ops = {
arch/powerpc/kexec/file_load.c+1−182
@@ -19,7 +19,6 @@ · 18 unmodified lines
1919 #include <linux/of_fdt.h>
2020 #include <linux/libfdt.h>
2121 #include <asm/setup.h>
22−#include <asm/ima.h>
2322
2423 #define SLAVE_CODE_SIZE 256 /* First 0x100 bytes */
2524
@@ -45,7 +44,7 @@ char *setup_kdump_cmdline(struct kimage *image, char *cmdline, · 19 unmodified lines
4544 return NULL;
4645
4746 elfcorehdr_strlen = sprintf(cmdline_ptr, "elfcorehdr=0x%lx ",
48− image->arch.elfcorehdr_addr);
47+ image->elf_load_addr);
4948
5049 if (elfcorehdr_strlen + cmdline_len > COMMAND_LINE_SIZE) {
5150 pr_err("Appending elfcorehdr=<addr> exceeds cmdline size\n");
@@ -108,183 +107,3 @@ int setup_purgatory(struct kimage *image, const void *slave_code, · 56 unmodified lines
108107
109108 return 0;
110109 }
111−
112−/**
113− * delete_fdt_mem_rsv - delete memory reservation with given address and size
114− *
115− * Return: 0 on success, or negative errno on error.
116− */
117−int delete_fdt_mem_rsv(void *fdt, unsigned long start, unsigned long size)
118−{
119− int i, ret, num_rsvs = fdt_num_mem_rsv(fdt);
120−
121− for (i = 0; i < num_rsvs; i++) {
122− uint64_t rsv_start, rsv_size;
123−
124− ret = fdt_get_mem_rsv(fdt, i, &rsv_start, &rsv_size);
125− if (ret) {
126− pr_err("Malformed device tree.\n");
127− return -EINVAL;
128− }
129−
130− if (rsv_start == start && rsv_size == size) {
131− ret = fdt_del_mem_rsv(fdt, i);
132− if (ret) {
133− pr_err("Error deleting device tree reservation.\n");
134− return -EINVAL;
135− }
136−
137− return 0;
138− }
139− }
140−
141− return -ENOENT;
142−}
143−
144−/*
145− * setup_new_fdt - modify /chosen and memory reservation for the next kernel
146− * @image: kexec image being loaded.
147− * @fdt: Flattened device tree for the next kernel.
148− * @initrd_load_addr: Address where the next initrd will be loaded.
149− * @initrd_len: Size of the next initrd, or 0 if there will be none.
150− * @cmdline: Command line for the next kernel, or NULL if there will
151− * be none.
152− *
153− * Return: 0 on success, or negative errno on error.
154− */
155−int setup_new_fdt(const struct kimage *image, void *fdt,
156− unsigned long initrd_load_addr, unsigned long initrd_len,
157− const char *cmdline)
158−{
159− int ret, chosen_node;
160− const void *prop;
161−
162− /* Remove memory reservation for the current device tree. */
163− ret = delete_fdt_mem_rsv(fdt, __pa(initial_boot_params),
164− fdt_totalsize(initial_boot_params));
165− if (ret == 0)
166− pr_debug("Removed old device tree reservation.\n");
167− else if (ret != -ENOENT)
168− return ret;
169−
170− chosen_node = fdt_path_offset(fdt, "/chosen");
171− if (chosen_node == -FDT_ERR_NOTFOUND) {
172− chosen_node = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"),
173− "chosen");
174− if (chosen_node < 0) {
175− pr_err("Error creating /chosen.\n");
176− return -EINVAL;
177− }
178− } else if (chosen_node < 0) {
179− pr_err("Malformed device tree: error reading /chosen.\n");
180− return -EINVAL;
181− }
182−
183− /* Did we boot using an initrd? */
184− prop = fdt_getprop(fdt, chosen_node, "linux,initrd-start", NULL);
185− if (prop) {
186− uint64_t tmp_start, tmp_end, tmp_size;
187−
188− tmp_start = fdt64_to_cpu(*((const fdt64_t *) prop));
189−
190− prop = fdt_getprop(fdt, chosen_node, "linux,initrd-end", NULL);
191− if (!prop) {
192− pr_err("Malformed device tree.\n");
193− return -EINVAL;
194− }
195− tmp_end = fdt64_to_cpu(*((const fdt64_t *) prop));
196−
197− /*
198− * kexec reserves exact initrd size, while firmware may
199− * reserve a multiple of PAGE_SIZE, so check for both.
200− */
201− tmp_size = tmp_end - tmp_start;
202− ret = delete_fdt_mem_rsv(fdt, tmp_start, tmp_size);
203− if (ret == -ENOENT)
204− ret = delete_fdt_mem_rsv(fdt, tmp_start,
205− round_up(tmp_size, PAGE_SIZE));
206− if (ret == 0)
207− pr_debug("Removed old initrd reservation.\n");
208− else if (ret != -ENOENT)
209− return ret;
210−
211− /* If there's no new initrd, delete the old initrd's info. */
212− if (initrd_len == 0) {
213− ret = fdt_delprop(fdt, chosen_node,
214− "linux,initrd-start");
215− if (ret) {
216− pr_err("Error deleting linux,initrd-start.\n");
217− return -EINVAL;
218− }
219−
220− ret = fdt_delprop(fdt, chosen_node, "linux,initrd-end");
221− if (ret) {
222− pr_err("Error deleting linux,initrd-end.\n");
223− return -EINVAL;
224− }
225− }
226− }
227−
228− if (initrd_len) {
229− ret = fdt_setprop_u64(fdt, chosen_node,
230− "linux,initrd-start",
231− initrd_load_addr);
232− if (ret < 0)
233− goto err;
234−
235− /* initrd-end is the first address after the initrd image. */
236− ret = fdt_setprop_u64(fdt, chosen_node, "linux,initrd-end",
237− initrd_load_addr + initrd_len);
238− if (ret < 0)
239− goto err;
240−
241− ret = fdt_add_mem_rsv(fdt, initrd_load_addr, initrd_len);
242− if (ret) {
243− pr_err("Error reserving initrd memory: %s\n",
244− fdt_strerror(ret));
245− return -EINVAL;
246− }
247− }
248−
249− if (cmdline != NULL) {
250− ret = fdt_setprop_string(fdt, chosen_node, "bootargs", cmdline);
251− if (ret < 0)
252− goto err;
253− } else {
254− ret = fdt_delprop(fdt, chosen_node, "bootargs");
255− if (ret && ret != -FDT_ERR_NOTFOUND) {
256− pr_err("Error deleting bootargs.\n");
257− return -EINVAL;
258− }
259− }
260−
261− if (image->type == KEXEC_TYPE_CRASH) {
262− /*
263− * Avoid elfcorehdr from being stomped on in kdump kernel by
264− * setting up memory reserve map.
265− */
266− ret = fdt_add_mem_rsv(fdt, image->arch.elfcorehdr_addr,
267− image->arch.elf_headers_sz);
268− if (ret) {
269− pr_err("Error reserving elfcorehdr memory: %s\n",
270− fdt_strerror(ret));
271− goto err;
272− }
273− }
274−
275− ret = setup_ima_buffer(image, fdt, chosen_node);
276− if (ret) {
277− pr_err("Error setting up the new device tree.\n");
278− return ret;
279− }
280−
281− ret = fdt_setprop(fdt, chosen_node, "linux,booted-from-kexec", NULL, 0);
282− if (ret)
283− goto err;
284−
285− return 0;
286−
287−err:
288− pr_err("Error setting up the new device tree.\n");
289− return -EINVAL;
290−}
arch/powerpc/kexec/file_load_64.c+18−29
@@ -816,9 +816,9 @@ static int load_elfcorehdr_segment(struct kimage *image, struct kexec_buf *kbuf) · 815 unmodified lines
816816 goto out;
817817 }
818818
819− image->arch.elfcorehdr_addr = kbuf->mem;
820− image->arch.elf_headers_sz = headers_sz;
821− image->arch.elf_headers = headers;
819+ image->elf_load_addr = kbuf->mem;
820+ image->elf_headers_sz = headers_sz;
821+ image->elf_headers = headers;
822822 out:
823823 kfree(cmem);
824824 return ret;
@@ -852,7 +852,7 @@ int load_crashdump_segments_ppc64(struct kimage *image, · 27 unmodified lines
852852 return ret;
853853 }
854854 pr_debug("Loaded elf core header at 0x%lx, bufsz=0x%lx memsz=0x%lx\n",
855− image->arch.elfcorehdr_addr, kbuf->bufsz, kbuf->memsz);
855+ image->elf_load_addr, kbuf->bufsz, kbuf->memsz);
856856
857857 return 0;
858858 }
@@ -927,37 +927,27 @@ out: · 68 unmodified lines
927927 }
928928
929929 /**
930− * kexec_fdt_totalsize_ppc64 - Return the estimated size needed to setup FDT
931− * for kexec/kdump kernel.
932− * @image: kexec image being loaded.
930+ * kexec_extra_fdt_size_ppc64 - Return the estimated additional size needed to
931+ * setup FDT for kexec/kdump kernel.
932+ * @image: kexec image being loaded.
933933 *
934− * Returns the estimated size needed for kexec/kdump kernel FDT.
934+ * Returns the estimated extra size needed for kexec/kdump kernel FDT.
935935 */
936−unsigned int kexec_fdt_totalsize_ppc64(struct kimage *image)
936+unsigned int kexec_extra_fdt_size_ppc64(struct kimage *image)
937937 {
938− unsigned int fdt_size;
939938 u64 usm_entries;
940939
941− /*
942− * The below estimate more than accounts for a typical kexec case where
943− * the additional space is to accommodate things like kexec cmdline,
944− * chosen node with properties for initrd start & end addresses and
945− * a property to indicate kexec boot..
946− */
947− fdt_size = fdt_totalsize(initial_boot_params) + (2 * COMMAND_LINE_SIZE);
948940 if (image->type != KEXEC_TYPE_CRASH)
949− return fdt_size;
941+ return 0;
950942
951943 /*
952− * For kdump kernel, also account for linux,usable-memory and
944+ * For kdump kernel, account for linux,usable-memory and
953945 * linux,drconf-usable-memory properties. Get an approximate on the
954946 * number of usable memory entries and use for FDT size estimation.
955947 */
956948 usm_entries = ((memblock_end_of_DRAM() / drmem_lmb_size()) +
957949 (2 * (resource_size(&crashk_res) / drmem_lmb_size())));
958− fdt_size += (unsigned int)(usm_entries * sizeof(u64));
959−
960− return fdt_size;
950+ return (unsigned int)(usm_entries * sizeof(u64));
961951 }
962952
963953 /**
@@ -979,10 +969,6 @@ int setup_new_fdt_ppc64(const struct kimage *image, void *fdt, · 15 unmodified lines
979969 struct crash_mem *umem = NULL, *rmem = NULL;
980970 int i, nr_ranges, ret;
981971
982− ret = setup_new_fdt(image, fdt, initrd_load_addr, initrd_len, cmdline);
983− if (ret)
984− goto out;
985−
986972 /*
987973 * Restrict memory usage for kdump kernel by setting up
988974 * usable memory ranges and memory reserve map.
@@ -1142,9 +1128,12 @@ int arch_kimage_file_post_load_cleanup(struct kimage *image) · 153 unmodified lines
11421128 vfree(image->arch.backup_buf);
11431129 image->arch.backup_buf = NULL;
11441130
1145− vfree(image->arch.elf_headers);
1146− image->arch.elf_headers = NULL;
1147− image->arch.elf_headers_sz = 0;
1131+ vfree(image->elf_headers);
1132+ image->elf_headers = NULL;
1133+ image->elf_headers_sz = 0;
1134+
1135+ kvfree(image->arch.fdt);
1136+ image->arch.fdt = NULL;
11481137
11491138 return kexec_image_post_load_cleanup_default(image);
11501139 }
arch/powerpc/kexec/ima.c+0−219
@@ -1,219 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0-or-later
2−/*
3− * Copyright (C) 2016 IBM Corporation
4− *
5− * Authors:
6− * Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
7− */
8−
9−#include <linux/slab.h>
10−#include <linux/kexec.h>
11−#include <linux/of.h>
12−#include <linux/memblock.h>
13−#include <linux/libfdt.h>
14−
15−static int get_addr_size_cells(int *addr_cells, int *size_cells)
16−{
17− struct device_node *root;
18−
19− root = of_find_node_by_path("/");
20− if (!root)
21− return -EINVAL;
22−
23− *addr_cells = of_n_addr_cells(root);
24− *size_cells = of_n_size_cells(root);
25−
26− of_node_put(root);
27−
28− return 0;
29−}
30−
31−static int do_get_kexec_buffer(const void *prop, int len, unsigned long *addr,
32− size_t *size)
33−{
34− int ret, addr_cells, size_cells;
35−
36− ret = get_addr_size_cells(&addr_cells, &size_cells);
37− if (ret)
38− return ret;
39−
40− if (len < 4 * (addr_cells + size_cells))
41− return -ENOENT;
42−
43− *addr = of_read_number(prop, addr_cells);
44− *size = of_read_number(prop + 4 * addr_cells, size_cells);
45−
46− return 0;
47−}
48−
49−/**
50− * ima_get_kexec_buffer - get IMA buffer from the previous kernel
51− * @addr: On successful return, set to point to the buffer contents.
52− * @size: On successful return, set to the buffer size.
53− *
54− * Return: 0 on success, negative errno on error.
55− */
56−int ima_get_kexec_buffer(void **addr, size_t *size)
57−{
58− int ret, len;
59− unsigned long tmp_addr;
60− size_t tmp_size;
61− const void *prop;
62−
63− prop = of_get_property(of_chosen, "linux,ima-kexec-buffer", &len);
64− if (!prop)
65− return -ENOENT;
66−
67− ret = do_get_kexec_buffer(prop, len, &tmp_addr, &tmp_size);
68− if (ret)
69− return ret;
70−
71− *addr = __va(tmp_addr);
72− *size = tmp_size;
73−
74− return 0;
75−}
76−
77−/**
78− * ima_free_kexec_buffer - free memory used by the IMA buffer
79− */
80−int ima_free_kexec_buffer(void)
81−{
82− int ret;
83− unsigned long addr;
84− size_t size;
85− struct property *prop;
86−
87− prop = of_find_property(of_chosen, "linux,ima-kexec-buffer", NULL);
88− if (!prop)
89− return -ENOENT;
90−
91− ret = do_get_kexec_buffer(prop->value, prop->length, &addr, &size);
92− if (ret)
93− return ret;
94−
95− ret = of_remove_property(of_chosen, prop);
96− if (ret)
97− return ret;
98−
99− return memblock_free(addr, size);
100−
101−}
102−
103−/**
104− * remove_ima_buffer - remove the IMA buffer property and reservation from @fdt
105− *
106− * The IMA measurement buffer is of no use to a subsequent kernel, so we always
107− * remove it from the device tree.
108− */
109−void remove_ima_buffer(void *fdt, int chosen_node)
110−{
111− int ret, len;
112− unsigned long addr;
113− size_t size;
114− const void *prop;
115−
116− prop = fdt_getprop(fdt, chosen_node, "linux,ima-kexec-buffer", &len);
117− if (!prop)
118− return;
119−
120− ret = do_get_kexec_buffer(prop, len, &addr, &size);
121− fdt_delprop(fdt, chosen_node, "linux,ima-kexec-buffer");
122− if (ret)
123− return;
124−
125− ret = delete_fdt_mem_rsv(fdt, addr, size);
126− if (!ret)
127− pr_debug("Removed old IMA buffer reservation.\n");
128−}
129−
130−#ifdef CONFIG_IMA_KEXEC
131−/**
132− * arch_ima_add_kexec_buffer - do arch-specific steps to add the IMA buffer
133− *
134− * Architectures should use this function to pass on the IMA buffer
135− * information to the next kernel.
136− *
137− * Return: 0 on success, negative errno on error.
138− */
139−int arch_ima_add_kexec_buffer(struct kimage *image, unsigned long load_addr,
140− size_t size)
141−{
142− image->arch.ima_buffer_addr = load_addr;
143− image->arch.ima_buffer_size = size;
144−
145− return 0;
146−}
147−
148−static int write_number(void *p, u64 value, int cells)
149−{
150− if (cells == 1) {
151− u32 tmp;
152−
153− if (value > U32_MAX)
154− return -EINVAL;
155−
156− tmp = cpu_to_be32(value);
157− memcpy(p, &tmp, sizeof(tmp));
158− } else if (cells == 2) {
159− u64 tmp;
160−
161− tmp = cpu_to_be64(value);
162− memcpy(p, &tmp, sizeof(tmp));
163− } else
164− return -EINVAL;
165−
166− return 0;
167−}
168−
169−/**
170− * setup_ima_buffer - add IMA buffer information to the fdt
171− * @image: kexec image being loaded.
172− * @fdt: Flattened device tree for the next kernel.
173− * @chosen_node: Offset to the chosen node.
174− *
175− * Return: 0 on success, or negative errno on error.
176− */
177−int setup_ima_buffer(const struct kimage *image, void *fdt, int chosen_node)
178−{
179− int ret, addr_cells, size_cells, entry_size;
180− u8 value[16];
181−
182− remove_ima_buffer(fdt, chosen_node);
183− if (!image->arch.ima_buffer_size)
184− return 0;
185−
186− ret = get_addr_size_cells(&addr_cells, &size_cells);
187− if (ret)
188− return ret;
189−
190− entry_size = 4 * (addr_cells + size_cells);
191−
192− if (entry_size > sizeof(value))
193− return -EINVAL;
194−
195− ret = write_number(value, image->arch.ima_buffer_addr, addr_cells);
196− if (ret)
197− return ret;
198−
199− ret = write_number(value + 4 * addr_cells, image->arch.ima_buffer_size,
200− size_cells);
201− if (ret)
202− return ret;
203−
204− ret = fdt_setprop(fdt, chosen_node, "linux,ima-kexec-buffer", value,
205− entry_size);
206− if (ret < 0)
207− return -EINVAL;
208−
209− ret = fdt_add_mem_rsv(fdt, image->arch.ima_buffer_addr,
210− image->arch.ima_buffer_size);
211− if (ret)
212− return -EINVAL;
213−
214− pr_debug("IMA buffer at 0x%llx, size = 0x%zx\n",
215− image->arch.ima_buffer_addr, image->arch.ima_buffer_size);
216−
217− return 0;
218−}
219−#endif /* CONFIG_IMA_KEXEC */
arch/x86/include/asm/kexec.h+0−5
@@ -150,11 +150,6 @@ struct kimage_arch { · 149 unmodified lines
150150 pud_t *pud;
151151 pmd_t *pmd;
152152 pte_t *pte;
153−
154− /* Core ELF header buffer */
155− void *elf_headers;
156− unsigned long elf_headers_sz;
157− unsigned long elf_load_addr;
158153 };
159154 #endif /* CONFIG_X86_32 */
160155
arch/x86/kernel/crash.c+7−7
@@ -323,8 +323,8 @@ static int memmap_exclude_ranges(struct kimage *image, struct crash_mem *cmem, · 322 unmodified lines
323323 cmem->nr_ranges = 1;
324324
325325 /* Exclude elf header region */
326− start = image->arch.elf_load_addr;
327− end = start + image->arch.elf_headers_sz - 1;
326+ start = image->elf_load_addr;
327+ end = start + image->elf_headers_sz - 1;
328328 return crash_exclude_mem_range(cmem, start, end);
329329 }
330330
@@ -407,20 +407,20 @@ int crash_load_segments(struct kimage *image) · 76 unmodified lines
407407 if (ret)
408408 return ret;
409409
410− image->arch.elf_headers = kbuf.buffer;
411− image->arch.elf_headers_sz = kbuf.bufsz;
410+ image->elf_headers = kbuf.buffer;
411+ image->elf_headers_sz = kbuf.bufsz;
412412
413413 kbuf.memsz = kbuf.bufsz;
414414 kbuf.buf_align = ELF_CORE_HEADER_ALIGN;
415415 kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
416416 ret = kexec_add_buffer(&kbuf);
417417 if (ret) {
418− vfree((void *)image->arch.elf_headers);
418+ vfree((void *)image->elf_headers);
419419 return ret;
420420 }
421− image->arch.elf_load_addr = kbuf.mem;
421+ image->elf_load_addr = kbuf.mem;
422422 pr_debug("Loaded ELF headers at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
423− image->arch.elf_load_addr, kbuf.bufsz, kbuf.bufsz);
423+ image->elf_load_addr, kbuf.bufsz, kbuf.bufsz);
424424
425425 return ret;
426426 }
arch/x86/kernel/kexec-bzimage64.c+1−1
@@ -75,7 +75,7 @@ static int setup_cmdline(struct kimage *image, struct boot_params *params, · 74 unmodified lines
7575
7676 if (image->type == KEXEC_TYPE_CRASH) {
7777 len = sprintf(cmdline_ptr,
78− "elfcorehdr=0x%lx ", image->arch.elf_load_addr);
78+ "elfcorehdr=0x%lx ", image->elf_load_addr);
7979 }
8080 memcpy(cmdline_ptr + len, cmdline, cmdline_len);
8181 cmdline_len += len;
arch/x86/kernel/machine_kexec_64.c+2−2
@@ -402,8 +402,8 @@ void machine_kexec(struct kimage *image) · 401 unmodified lines
402402 #ifdef CONFIG_KEXEC_FILE
403403 void *arch_kexec_kernel_image_load(struct kimage *image)
404404 {
405− vfree(image->arch.elf_headers);
406− image->arch.elf_headers = NULL;
405+ vfree(image->elf_headers);
406+ image->elf_headers = NULL;
407407
408408 if (!image->fops || !image->fops->load)
409409 return ERR_PTR(-ENOEXEC);
drivers/of/Makefile+6−0
@@ -14,4 +14,10 @@ obj-$(CONFIG_OF_RESOLVE) += resolver.o · 13 unmodified lines
1414 obj-$(CONFIG_OF_OVERLAY) += overlay.o
1515 obj-$(CONFIG_OF_NUMA) += of_numa.o
1616
17+ifdef CONFIG_KEXEC_FILE
18+ifdef CONFIG_OF_FLATTREE
19+obj-y += kexec.o
20+endif
21+endif
22+
1723 obj-$(CONFIG_OF_UNITTEST) += unittest-data/
drivers/of/address.c+7−1
@@ -117,9 +117,12 @@ static unsigned int of_bus_pci_get_flags(const __be32 *addr) · 116 unmodified lines
117117 flags |= IORESOURCE_IO;
118118 break;
119119 case 0x02: /* 32 bits */
120− case 0x03: /* 64 bits */
121120 flags |= IORESOURCE_MEM;
122121 break;
122+
123+ case 0x03: /* 64 bits */
124+ flags |= IORESOURCE_MEM | IORESOURCE_MEM_64;
125+ break;
123126 }
124127 if (w & 0x40000000)
125128 flags |= IORESOURCE_PREFETCH;
@@ -861,6 +864,9 @@ static int __of_address_to_resource(struct device_node *dev, · 735 unmodified lines
861864
862865 /**
863866 * of_address_to_resource - Translate device tree address and return as resource
867+ * @dev: Caller's Device Node
868+ * @index: Index into the array
869+ * @r: Pointer to resource array
864870 *
865871 * Note that if your address is a PIO address, the conversion will fail if
866872 * the physical address can't be internally converted to an IO token with
drivers/of/base.c+168−160
@@ -244,7 +244,7 @@ struct device_node *__of_find_all_nodes(struct device_node *prev) · 243 unmodified lines
244244 * @prev: Previous node or NULL to start iteration
245245 * of_node_put() will be called on it
246246 *
247− * Returns a node pointer with refcount incremented, use
247+ * Return: A node pointer with refcount incremented, use
248248 * of_node_put() on it when done.
249249 */
250250 struct device_node *of_find_all_nodes(struct device_node *prev)
@@ -305,7 +305,7 @@ bool __weak arch_match_cpu_phys_id(int cpu, u64 phys_id) · 54 unmodified lines
305305 return (u32)phys_id == cpu;
306306 }
307307
308−/**
308+/*
309309 * Checks if the given "prop_name" property holds the physical id of the
310310 * core/thread corresponding to the logical cpu 'cpu'. If 'thread' is not
311311 * NULL, local thread number within the core is returned in it.
@@ -374,7 +374,7 @@ bool __weak arch_find_n_match_cpu_physical_id(struct device_node *cpun, · 62 unmodified lines
374374 * before booting secondary cores. This function uses arch_match_cpu_phys_id
375375 * which can be overridden by architecture specific implementation.
376376 *
377− * Returns a node pointer for the logical cpu with refcount incremented, use
377+ * Return: A node pointer for the logical cpu with refcount incremented, use
378378 * of_node_put() on it when done. Returns NULL if not found.
379379 */
380380 struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
@@ -394,8 +394,8 @@ EXPORT_SYMBOL(of_get_cpu_node); · 13 unmodified lines
394394 *
395395 * @cpu_node: Pointer to the device_node for CPU.
396396 *
397− * Returns the logical CPU number of the given CPU device_node.
398− * Returns -ENODEV if the CPU is not found.
397+ * Return: The logical CPU number of the given CPU device_node or -ENODEV if the
398+ * CPU is not found.
399399 */
400400 int of_cpu_node_to_id(struct device_node *cpu_node)
401401 {
@@ -427,7 +427,7 @@ EXPORT_SYMBOL(of_cpu_node_to_id); · 25 unmodified lines
427427 * bindings. This function check for both and returns the idle state node for
428428 * the requested index.
429429 *
430− * In case an idle state node is found at @index, the refcount is incremented
430+ * Return: An idle state node if found at @index. The refcount is incremented
431431 * for it, so call of_node_put() on it when done. Returns NULL if not found.
432432 */
433433 struct device_node *of_get_cpu_state_node(struct device_node *cpu_node,
@@ -561,7 +561,7 @@ int of_device_compatible_match(struct device_node *device, · 127 unmodified lines
561561 * of_machine_is_compatible - Test root of device tree for a given compatible value
562562 * @compat: compatible string to look for in root node's compatible property.
563563 *
564− * Returns a positive integer if the root node has the given value in its
564+ * Return: A positive integer if the root node has the given value in its
565565 * compatible property.
566566 */
567567 int of_machine_is_compatible(const char *compat)
@@ -583,7 +583,7 @@ EXPORT_SYMBOL(of_machine_is_compatible); · 15 unmodified lines
583583 *
584584 * @device: Node to check for availability, with locks already held
585585 *
586− * Returns true if the status property is absent or set to "okay" or "ok",
586+ * Return: True if the status property is absent or set to "okay" or "ok",
587587 * false otherwise
588588 */
589589 static bool __of_device_is_available(const struct device_node *device)
@@ -611,7 +611,7 @@ static bool __of_device_is_available(const struct device_node *device) · 21 unmodified lines
611611 *
612612 * @device: Node to check for availability
613613 *
614− * Returns true if the status property is absent or set to "okay" or "ok",
614+ * Return: True if the status property is absent or set to "okay" or "ok",
615615 * false otherwise
616616 */
617617 bool of_device_is_available(const struct device_node *device)
@@ -632,7 +632,7 @@ EXPORT_SYMBOL(of_device_is_available); · 14 unmodified lines
632632 *
633633 * @device: Node to check for endianness
634634 *
635− * Returns true if the device has a "big-endian" property, or if the kernel
635+ * Return: True if the device has a "big-endian" property, or if the kernel
636636 * was compiled for BE *and* the device has a "native-endian" property.
637637 * Returns false otherwise.
638638 *
@@ -651,11 +651,11 @@ bool of_device_is_big_endian(const struct device_node *device) · 12 unmodified lines
651651 EXPORT_SYMBOL(of_device_is_big_endian);
652652
653653 /**
654− * of_get_parent - Get a node's parent if any
655− * @node: Node to get parent
654+ * of_get_parent - Get a node's parent if any
655+ * @node: Node to get parent
656656 *
657− * Returns a node pointer with refcount incremented, use
658− * of_node_put() on it when done.
657+ * Return: A node pointer with refcount incremented, use
658+ * of_node_put() on it when done.
659659 */
660660 struct device_node *of_get_parent(const struct device_node *node)
661661 {
@@ -673,15 +673,15 @@ struct device_node *of_get_parent(const struct device_node *node) · 11 unmodified lines
673673 EXPORT_SYMBOL(of_get_parent);
674674
675675 /**
676− * of_get_next_parent - Iterate to a node's parent
677− * @node: Node to get parent of
676+ * of_get_next_parent - Iterate to a node's parent
677+ * @node: Node to get parent of
678678 *
679− * This is like of_get_parent() except that it drops the
680− * refcount on the passed node, making it suitable for iterating
681− * through a node's parents.
679+ * This is like of_get_parent() except that it drops the
680+ * refcount on the passed node, making it suitable for iterating
681+ * through a node's parents.
682682 *
683− * Returns a node pointer with refcount incremented, use
684− * of_node_put() on it when done.
683+ * Return: A node pointer with refcount incremented, use
684+ * of_node_put() on it when done.
685685 */
686686 struct device_node *of_get_next_parent(struct device_node *node)
687687 {
@@ -719,13 +719,13 @@ static struct device_node *__of_get_next_child(const struct device_node *node, · 31 unmodified lines
719719 child = __of_get_next_child(parent, child))
720720
721721 /**
722− * of_get_next_child - Iterate a node childs
723− * @node: parent node
724− * @prev: previous child of the parent node, or NULL to get first
722+ * of_get_next_child - Iterate a node childs
723+ * @node: parent node
724+ * @prev: previous child of the parent node, or NULL to get first
725725 *
726− * Returns a node pointer with refcount incremented, use of_node_put() on
727− * it when done. Returns NULL when prev is the last child. Decrements the
728− * refcount of prev.
726+ * Return: A node pointer with refcount incremented, use of_node_put() on
727+ * it when done. Returns NULL when prev is the last child. Decrements the
728+ * refcount of prev.
729729 */
730730 struct device_node *of_get_next_child(const struct device_node *node,
731731 struct device_node *prev)
@@ -741,12 +741,12 @@ struct device_node *of_get_next_child(const struct device_node *node, · 9 unmodified lines
741741 EXPORT_SYMBOL(of_get_next_child);
742742
743743 /**
744− * of_get_next_available_child - Find the next available child node
745− * @node: parent node
746− * @prev: previous child of the parent node, or NULL to get first
744+ * of_get_next_available_child - Find the next available child node
745+ * @node: parent node
746+ * @prev: previous child of the parent node, or NULL to get first
747747 *
748− * This function is like of_get_next_child(), except that it
749− * automatically skips any disabled nodes (i.e. status = "disabled").
748+ * This function is like of_get_next_child(), except that it
749+ * automatically skips any disabled nodes (i.e. status = "disabled").
750750 */
751751 struct device_node *of_get_next_available_child(const struct device_node *node,
752752 struct device_node *prev)
@@ -772,12 +772,12 @@ struct device_node *of_get_next_available_child(const struct device_node *node, · 19 unmodified lines
772772 EXPORT_SYMBOL(of_get_next_available_child);
773773
774774 /**
775− * of_get_next_cpu_node - Iterate on cpu nodes
776− * @prev: previous child of the /cpus node, or NULL to get first
775+ * of_get_next_cpu_node - Iterate on cpu nodes
776+ * @prev: previous child of the /cpus node, or NULL to get first
777777 *
778− * Returns a cpu node pointer with refcount incremented, use of_node_put()
779− * on it when done. Returns NULL when prev is the last child. Decrements
780− * the refcount of prev.
778+ * Return: A cpu node pointer with refcount incremented, use of_node_put()
779+ * on it when done. Returns NULL when prev is the last child. Decrements
780+ * the refcount of prev.
781781 */
782782 struct device_node *of_get_next_cpu_node(struct device_node *prev)
783783 {
@@ -816,7 +816,7 @@ EXPORT_SYMBOL(of_get_next_cpu_node); · 32 unmodified lines
816816 * Lookup child node whose compatible property contains the given compatible
817817 * string.
818818 *
819− * Returns a node pointer with refcount incremented, use of_node_put() on it
819+ * Return: a node pointer with refcount incremented, use of_node_put() on it
820820 * when done; or NULL if not found.
821821 */
822822 struct device_node *of_get_compatible_child(const struct device_node *parent,
@@ -834,15 +834,15 @@ struct device_node *of_get_compatible_child(const struct device_node *parent, · 11 unmodified lines
834834 EXPORT_SYMBOL(of_get_compatible_child);
835835
836836 /**
837− * of_get_child_by_name - Find the child node by name for a given parent
838− * @node: parent node
839− * @name: child name to look for.
837+ * of_get_child_by_name - Find the child node by name for a given parent
838+ * @node: parent node
839+ * @name: child name to look for.
840840 *
841− * This function looks for child node for given matching name
841+ * This function looks for child node for given matching name
842842 *
843− * Returns a node pointer if found, with refcount incremented, use
844− * of_node_put() on it when done.
845− * Returns NULL if node is not found.
843+ * Return: A node pointer if found, with refcount incremented, use
844+ * of_node_put() on it when done.
845+ * Returns NULL if node is not found.
846846 */
847847 struct device_node *of_get_child_by_name(const struct device_node *node,
848848 const char *name)
@@ -893,22 +893,22 @@ struct device_node *__of_find_node_by_full_path(struct device_node *node, · 44 unmodified lines
893893 }
894894
895895 /**
896− * of_find_node_opts_by_path - Find a node matching a full OF path
897− * @path: Either the full path to match, or if the path does not
898− * start with '/', the name of a property of the /aliases
899− * node (an alias). In the case of an alias, the node
900− * matching the alias' value will be returned.
901− * @opts: Address of a pointer into which to store the start of
902− * an options string appended to the end of the path with
903− * a ':' separator.
904− *
905− * Valid paths:
906− * /foo/bar Full path
907− * foo Valid alias
908− * foo/bar Valid alias + relative path
909− *
910− * Returns a node pointer with refcount incremented, use
911− * of_node_put() on it when done.
896+ * of_find_node_opts_by_path - Find a node matching a full OF path
897+ * @path: Either the full path to match, or if the path does not
898+ * start with '/', the name of a property of the /aliases
899+ * node (an alias). In the case of an alias, the node
900+ * matching the alias' value will be returned.
901+ * @opts: Address of a pointer into which to store the start of
902+ * an options string appended to the end of the path with
903+ * a ':' separator.
904+ *
905+ * Valid paths:
906+ * * /foo/bar Full path
907+ * * foo Valid alias
908+ * * foo/bar Valid alias + relative path
909+ *
910+ * Return: A node pointer with refcount incremented, use
911+ * of_node_put() on it when done.
912912 */
913913 struct device_node *of_find_node_opts_by_path(const char *path, const char **opts)
914914 {
@@ -958,15 +958,15 @@ struct device_node *of_find_node_opts_by_path(const char *path, const char **opt · 43 unmodified lines
958958 EXPORT_SYMBOL(of_find_node_opts_by_path);
959959
960960 /**
961− * of_find_node_by_name - Find a node by its "name" property
962− * @from: The node to start searching from or NULL; the node
961+ * of_find_node_by_name - Find a node by its "name" property
962+ * @from: The node to start searching from or NULL; the node
963963 * you pass will not be searched, only the next one
964964 * will. Typically, you pass what the previous call
965965 * returned. of_node_put() will be called on @from.
966− * @name: The name string to match against
966+ * @name: The name string to match against
967967 *
968− * Returns a node pointer with refcount incremented, use
969− * of_node_put() on it when done.
968+ * Return: A node pointer with refcount incremented, use
969+ * of_node_put() on it when done.
970970 */
971971 struct device_node *of_find_node_by_name(struct device_node *from,
972972 const char *name)
@@ -985,16 +985,16 @@ struct device_node *of_find_node_by_name(struct device_node *from, · 12 unmodified lines
985985 EXPORT_SYMBOL(of_find_node_by_name);
986986
987987 /**
988− * of_find_node_by_type - Find a node by its "device_type" property
989− * @from: The node to start searching from, or NULL to start searching
988+ * of_find_node_by_type - Find a node by its "device_type" property
989+ * @from: The node to start searching from, or NULL to start searching
990990 * the entire device tree. The node you pass will not be
991991 * searched, only the next one will; typically, you pass
992992 * what the previous call returned. of_node_put() will be
993993 * called on from for you.
994− * @type: The type string to match against
994+ * @type: The type string to match against
995995 *
996− * Returns a node pointer with refcount incremented, use
997− * of_node_put() on it when done.
996+ * Return: A node pointer with refcount incremented, use
997+ * of_node_put() on it when done.
998998 */
999999 struct device_node *of_find_node_by_type(struct device_node *from,
10001000 const char *type)
@@ -1013,18 +1013,18 @@ struct device_node *of_find_node_by_type(struct device_node *from, · 12 unmodified lines
10131013 EXPORT_SYMBOL(of_find_node_by_type);
10141014
10151015 /**
1016− * of_find_compatible_node - Find a node based on type and one of the
1016+ * of_find_compatible_node - Find a node based on type and one of the
10171017 * tokens in its "compatible" property
1018− * @from: The node to start searching from or NULL, the node
1019− * you pass will not be searched, only the next one
1020− * will; typically, you pass what the previous call
1021− * returned. of_node_put() will be called on it
1022− * @type: The type string to match "device_type" or NULL to ignore
1023− * @compatible: The string to match to one of the tokens in the device
1024− * "compatible" list.
1025− *
1026− * Returns a node pointer with refcount incremented, use
1027− * of_node_put() on it when done.
1018+ * @from: The node to start searching from or NULL, the node
1019+ * you pass will not be searched, only the next one
1020+ * will; typically, you pass what the previous call
1021+ * returned. of_node_put() will be called on it
1022+ * @type: The type string to match "device_type" or NULL to ignore
1023+ * @compatible: The string to match to one of the tokens in the device
1024+ * "compatible" list.
1025+ *
1026+ * Return: A node pointer with refcount incremented, use
1027+ * of_node_put() on it when done.
10281028 */
10291029 struct device_node *of_find_compatible_node(struct device_node *from,
10301030 const char *type, const char *compatible)
@@ -1044,16 +1044,16 @@ struct device_node *of_find_compatible_node(struct device_node *from, · 13 unmodified lines
10441044 EXPORT_SYMBOL(of_find_compatible_node);
10451045
10461046 /**
1047− * of_find_node_with_property - Find a node which has a property with
1048− * the given name.
1049− * @from: The node to start searching from or NULL, the node
1050− * you pass will not be searched, only the next one
1051− * will; typically, you pass what the previous call
1052− * returned. of_node_put() will be called on it
1053− * @prop_name: The name of the property to look for.
1054− *
1055− * Returns a node pointer with refcount incremented, use
1056− * of_node_put() on it when done.
1047+ * of_find_node_with_property - Find a node which has a property with
1048+ * the given name.
1049+ * @from: The node to start searching from or NULL, the node
1050+ * you pass will not be searched, only the next one
1051+ * will; typically, you pass what the previous call
1052+ * returned. of_node_put() will be called on it
1053+ * @prop_name: The name of the property to look for.
1054+ *
1055+ * Return: A node pointer with refcount incremented, use
1056+ * of_node_put() on it when done.
10571057 */
10581058 struct device_node *of_find_node_with_property(struct device_node *from,
10591059 const char *prop_name)
@@ -1102,10 +1102,10 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches, · 42 unmodified lines
11021102
11031103 /**
11041104 * of_match_node - Tell if a device_node has a matching of_match structure
1105− * @matches: array of of device match structures to search in
1106− * @node: the of device structure to match against
1105+ * @matches: array of of device match structures to search in
1106+ * @node: the of device structure to match against
11071107 *
1108− * Low level utility function used by device matching.
1108+ * Low level utility function used by device matching.
11091109 */
11101110 const struct of_device_id *of_match_node(const struct of_device_id *matches,
11111111 const struct device_node *node)
@@ -1121,17 +1121,17 @@ const struct of_device_id *of_match_node(const struct of_device_id *matches, · 9 unmodified lines
11211121 EXPORT_SYMBOL(of_match_node);
11221122
11231123 /**
1124− * of_find_matching_node_and_match - Find a node based on an of_device_id
1125− * match table.
1126− * @from: The node to start searching from or NULL, the node
1127− * you pass will not be searched, only the next one
1128− * will; typically, you pass what the previous call
1129− * returned. of_node_put() will be called on it
1130− * @matches: array of of device match structures to search in
1131− * @match Updated to point at the matches entry which matched
1132− *
1133− * Returns a node pointer with refcount incremented, use
1134− * of_node_put() on it when done.
1124+ * of_find_matching_node_and_match - Find a node based on an of_device_id
1125+ * match table.
1126+ * @from: The node to start searching from or NULL, the node
1127+ * you pass will not be searched, only the next one
1128+ * will; typically, you pass what the previous call
1129+ * returned. of_node_put() will be called on it
1130+ * @matches: array of of device match structures to search in
1131+ * @match: Updated to point at the matches entry which matched
1132+ *
1133+ * Return: A node pointer with refcount incremented, use
1134+ * of_node_put() on it when done.
11351135 */
11361136 struct device_node *of_find_matching_node_and_match(struct device_node *from,
11371137 const struct of_device_id *matches,
@@ -1170,7 +1170,7 @@ EXPORT_SYMBOL(of_find_matching_node_and_match); · 32 unmodified lines
11701170 * It does this by stripping the manufacturer prefix (as delimited by a ',')
11711171 * from the first entry in the compatible list property.
11721172 *
1173− * This routine returns 0 on success, <0 on failure.
1173+ * Return: This routine returns 0 on success, <0 on failure.
11741174 */
11751175 int of_modalias_node(struct device_node *node, char *modalias, int len)
11761176 {
@@ -1190,7 +1190,7 @@ EXPORT_SYMBOL_GPL(of_modalias_node); · 13 unmodified lines
11901190 * of_find_node_by_phandle - Find a node given a phandle
11911191 * @handle: phandle of the node to find
11921192 *
1193− * Returns a node pointer with refcount incremented, use
1193+ * Return: A node pointer with refcount incremented, use
11941194 * of_node_put() on it when done.
11951195 */
11961196 struct device_node *of_find_node_by_phandle(phandle handle)
@@ -1426,7 +1426,7 @@ static int __of_parse_phandle_with_args(const struct device_node *np, · 229 unmodified lines
14261426 * @index: For properties holding a table of phandles, this is the index into
14271427 * the table
14281428 *
1429− * Returns the device_node pointer with refcount incremented. Use
1429+ * Return: The device_node pointer with refcount incremented. Use
14301430 * of_node_put() on it when done.
14311431 */
14321432 struct device_node *of_parse_phandle(const struct device_node *np,
@@ -1460,21 +1460,21 @@ EXPORT_SYMBOL(of_parse_phandle); · 27 unmodified lines
14601460 * Caller is responsible to call of_node_put() on the returned out_args->np
14611461 * pointer.
14621462 *
1463− * Example:
1463+ * Example::
14641464 *
1465− * phandle1: node1 {
1465+ * phandle1: node1 {
14661466 * #list-cells = <2>;
1467− * }
1467+ * };
14681468 *
1469− * phandle2: node2 {
1469+ * phandle2: node2 {
14701470 * #list-cells = <1>;
1471− * }
1471+ * };
14721472 *
1473− * node3 {
1473+ * node3 {
14741474 * list = <&phandle1 1 2 &phandle2 3>;
1475− * }
1475+ * };
14761476 *
1477− * To get a device_node of the `node2' node you may call this:
1477+ * To get a device_node of the ``node2`` node you may call this:
14781478 * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args);
14791479 */
14801480 int of_parse_phandle_with_args(const struct device_node *np, const char *list_name,
@@ -1512,29 +1512,29 @@ EXPORT_SYMBOL(of_parse_phandle_with_args); · 31 unmodified lines
15121512 * Caller is responsible to call of_node_put() on the returned out_args->np
15131513 * pointer.
15141514 *
1515− * Example:
1515+ * Example::
15161516 *
1517− * phandle1: node1 {
1518− * #list-cells = <2>;
1519− * }
1517+ * phandle1: node1 {
1518+ * #list-cells = <2>;
1519+ * };
15201520 *
1521− * phandle2: node2 {
1522− * #list-cells = <1>;
1523− * }
1521+ * phandle2: node2 {
1522+ * #list-cells = <1>;
1523+ * };
15241524 *
1525− * phandle3: node3 {
1526− * #list-cells = <1>;
1527− * list-map = <0 &phandle2 3>,
1528− * <1 &phandle2 2>,
1529− * <2 &phandle1 5 1>;
1530− * list-map-mask = <0x3>;
1531− * };
1525+ * phandle3: node3 {
1526+ * #list-cells = <1>;
1527+ * list-map = <0 &phandle2 3>,
1528+ * <1 &phandle2 2>,
1529+ * <2 &phandle1 5 1>;
1530+ * list-map-mask = <0x3>;
1531+ * };
15321532 *
1533− * node4 {
1534− * list = <&phandle1 1 2 &phandle3 0>;
1535− * }
1533+ * node4 {
1534+ * list = <&phandle1 1 2 &phandle3 0>;
1535+ * };
15361536 *
1537− * To get a device_node of the `node2' node you may call this:
1537+ * To get a device_node of the ``node2`` node you may call this:
15381538 * of_parse_phandle_with_args(node4, "list", "list", 1, &args);
15391539 */
15401540 int of_parse_phandle_with_args_map(const struct device_node *np,
@@ -1694,19 +1694,19 @@ EXPORT_SYMBOL(of_parse_phandle_with_args_map); · 153 unmodified lines
16941694 * Caller is responsible to call of_node_put() on the returned out_args->np
16951695 * pointer.
16961696 *
1697− * Example:
1697+ * Example::
16981698 *
1699− * phandle1: node1 {
1700− * }
1699+ * phandle1: node1 {
1700+ * };
17011701 *
1702− * phandle2: node2 {
1703− * }
1702+ * phandle2: node2 {
1703+ * };
17041704 *
1705− * node3 {
1706− * list = <&phandle1 0 2 &phandle2 2 3>;
1707− * }
1705+ * node3 {
1706+ * list = <&phandle1 0 2 &phandle2 2 3>;
1707+ * };
17081708 *
1709− * To get a device_node of the `node2' node you may call this:
1709+ * To get a device_node of the ``node2`` node you may call this:
17101710 * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args);
17111711 */
17121712 int of_parse_phandle_with_fixed_args(const struct device_node *np,
@@ -1726,7 +1726,7 @@ EXPORT_SYMBOL(of_parse_phandle_with_fixed_args); · 13 unmodified lines
17261726 * @list_name: property name that contains a list
17271727 * @cells_name: property name that specifies phandles' arguments count
17281728 *
1729− * Returns the number of phandle + argument tuples within a property. It
1729+ * Return: The number of phandle + argument tuples within a property. It
17301730 * is a typical pattern to encode a list of phandle and variable
17311731 * arguments into a single property. The number of arguments is encoded
17321732 * by a property in the phandle-target node. For example, a gpios
@@ -1774,6 +1774,8 @@ EXPORT_SYMBOL(of_count_phandle_with_args); · 41 unmodified lines
17741774
17751775 /**
17761776 * __of_add_property - Add a property to a node without lock operations
1777+ * @np: Caller's Device Node
1778+ * @prop: Property to add
17771779 */
17781780 int __of_add_property(struct device_node *np, struct property *prop)
17791781 {
@@ -1795,6 +1797,8 @@ int __of_add_property(struct device_node *np, struct property *prop) · 15 unmodified lines
17951797
17961798 /**
17971799 * of_add_property - Add a property to a node
1800+ * @np: Caller's Device Node
1801+ * @prop: Property to add
17981802 */
17991803 int of_add_property(struct device_node *np, struct property *prop)
18001804 {
@@ -1839,6 +1843,8 @@ int __of_remove_property(struct device_node *np, struct property *prop) · 38 unmodified lines
18391843
18401844 /**
18411845 * of_remove_property - Remove a property from a node.
1846+ * @np: Caller's Device Node
1847+ * @prop: Property to remove
18421848 *
18431849 * Note that we don't actually remove it, since we have given out
18441850 * who-knows-how-many pointers to the data using get-property.
@@ -1946,13 +1952,12 @@ static void of_alias_add(struct alias_prop *ap, struct device_node *np, · 101 unmodified lines
19461952
19471953 /**
19481954 * of_alias_scan - Scan all properties of the 'aliases' node
1955+ * @dt_alloc: An allocator that provides a virtual address to memory
1956+ * for storing the resulting tree
19491957 *
19501958 * The function scans all the properties of the 'aliases' node and populates
19511959 * the global lookup table with the properties. It returns the
19521960 * number of alias properties found, or an error code in case of failure.
1953− *
1954− * @dt_alloc: An allocator that provides a virtual address to memory
1955− * for storing the resulting tree
19561961 */
19571962 void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
19581963 {
@@ -2021,7 +2026,9 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) · 62 unmodified lines
20212026 * @stem: Alias stem of the given device_node
20222027 *
20232028 * The function travels the lookup table to get the alias id for the given
2024− * device_node and alias stem. It returns the alias id if found.
2029+ * device_node and alias stem.
2030+ *
2031+ * Return: The alias id if found.
20252032 */
20262033 int of_alias_get_id(struct device_node *np, const char *stem)
20272034 {
@@ -2125,13 +2132,14 @@ EXPORT_SYMBOL_GPL(of_alias_get_highest_id); · 97 unmodified lines
21252132
21262133 /**
21272134 * of_console_check() - Test and setup console for DT setup
2128− * @dn - Pointer to device node
2129− * @name - Name to use for preferred console without index. ex. "ttyS"
2130− * @index - Index to use for preferred console.
2135+ * @dn: Pointer to device node
2136+ * @name: Name to use for preferred console without index. ex. "ttyS"
2137+ * @index: Index to use for preferred console.
21312138 *
21322139 * Check if the given device node matches the stdout-path property in the
2133− * /chosen node. If it does then register it as the preferred console and return
2134− * TRUE. Otherwise return FALSE.
2140+ * /chosen node. If it does then register it as the preferred console.
2141+ *
2142+ * Return: TRUE if console successfully setup. Otherwise return FALSE.
21352143 */
21362144 bool of_console_check(struct device_node *dn, char *name, int index)
21372145 {
@@ -2147,12 +2155,12 @@ bool of_console_check(struct device_node *dn, char *name, int index) · 9 unmodified lines
21472155 EXPORT_SYMBOL_GPL(of_console_check);
21482156
21492157 /**
2150− * of_find_next_cache_node - Find a node's subsidiary cache
2151− * @np: node of type "cpu" or "cache"
2158+ * of_find_next_cache_node - Find a node's subsidiary cache
2159+ * @np: node of type "cpu" or "cache"
21522160 *
2153− * Returns a node pointer with refcount incremented, use
2154− * of_node_put() on it when done. Caller should hold a reference
2155− * to np.
2161+ * Return: A node pointer with refcount incremented, use
2162+ * of_node_put() on it when done. Caller should hold a reference
2163+ * to np.
21562164 */
21572165 struct device_node *of_find_next_cache_node(const struct device_node *np)
21582166 {
@@ -2182,7 +2190,7 @@ struct device_node *of_find_next_cache_node(const struct device_node *np) · 23 unmodified lines
21822190 *
21832191 * @cpu: cpu number(logical index) for which the last cache level is needed
21842192 *
2185− * Returns the the level at which the last cache is present. It is exactly
2193+ * Return: The the level at which the last cache is present. It is exactly
21862194 * same as the total number of cache levels for the given logical cpu.
21872195 */
21882196 int of_find_last_cache_level(unsigned int cpu)
drivers/of/device.c+6−1
@@ -53,7 +53,7 @@ int of_device_add(struct platform_device *ofdev) · 52 unmodified lines
5353 }
5454
5555 /**
56− * of_dma_configure - Setup DMA configuration
56+ * of_dma_configure_id - Setup DMA configuration
5757 * @dev: Device to apply DMA configuration
5858 * @np: Pointer to OF node having DMA configuration
5959 * @force_dma: Whether device is to be set up by of_dma_configure() even if
@@ -258,6 +258,9 @@ EXPORT_SYMBOL_GPL(of_device_request_module); · 198 unmodified lines
258258
259259 /**
260260 * of_device_modalias - Fill buffer with newline terminated modalias string
261+ * @dev: Calling device
262+ * @str: Modalias string
263+ * @len: Size of @str
261264 */
262265 ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len)
263266 {
@@ -275,6 +278,8 @@ EXPORT_SYMBOL_GPL(of_device_modalias); · 11 unmodified lines
275278
276279 /**
277280 * of_device_uevent - Display OF related uevent information
281+ * @dev: Device to apply DMA configuration
282+ * @env: Kernel object's userspace event reference
278283 */
279284 void of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
280285 {
drivers/of/dynamic.c+15−8
@@ -27,7 +27,7 @@ static struct device_node *kobj_to_device_node(struct kobject *kobj) · 26 unmodified lines
2727 * @node: Node to inc refcount, NULL is supported to simplify writing of
2828 * callers
2929 *
30− * Returns node.
30+ * Return: The node with refcount incremented.
3131 */
3232 struct device_node *of_node_get(struct device_node *node)
3333 {
@@ -104,7 +104,8 @@ int of_reconfig_notify(unsigned long action, struct of_reconfig_data *p) · 70 unmodified lines
104104 * @arg - argument of the of notifier
105105 *
106106 * Returns the new state of a device based on the notifier used.
107− * Returns 0 on device going from enabled to disabled, 1 on device
107+ *
108+ * Return: 0 on device going from enabled to disabled, 1 on device
108109 * going from disabled to enabled and -1 on no change.
109110 */
110111 int of_reconfig_get_state_change(unsigned long action, struct of_reconfig_data *pr)
@@ -229,6 +230,7 @@ static void __of_attach_node(struct device_node *np) · 118 unmodified lines
229230
230231 /**
231232 * of_attach_node() - Plug a device node into the tree and global list.
233+ * @np: Pointer to the caller's Device Node
232234 */
233235 int of_attach_node(struct device_node *np)
234236 {
@@ -281,6 +283,7 @@ void __of_detach_node(struct device_node *np) · 46 unmodified lines
281283
282284 /**
283285 * of_detach_node() - "Unplug" a node from the device tree.
286+ * @np: Pointer to the caller's Device Node
284287 */
285288 int of_detach_node(struct device_node *np)
286289 {
@@ -318,7 +321,7 @@ static void property_list_free(struct property *prop_list) · 31 unmodified lines
318321
319322 /**
320323 * of_node_release() - release a dynamically allocated node
321− * @kref: kref element of the node to be released
324+ * @kobj: kernel object of the node to be released
322325 *
323326 * In of_node_put() this function is passed to kref_put() as the destructor.
324327 */
@@ -372,7 +375,8 @@ void of_node_release(struct kobject *kobj) · 47 unmodified lines
372375 * property structure and the property name & contents. The property's
373376 * flags have the OF_DYNAMIC bit set so that we can differentiate between
374377 * dynamically allocated properties and not.
375− * Returns the newly allocated property or NULL on out of memory error.
378+ *
379+ * Return: The newly allocated property or NULL on out of memory error.
376380 */
377381 struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags)
378382 {
@@ -415,7 +419,7 @@ struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags) · 36 unmodified lines
415419 * another node. The node data are dynamically allocated and all the node
416420 * flags have the OF_DYNAMIC & OF_DETACHED bits set.
417421 *
418− * Returns the newly allocated node or NULL on out of memory error.
422+ * Return: The newly allocated node or NULL on out of memory error.
419423 */
420424 struct device_node *__of_node_dup(const struct device_node *np,
421425 const char *full_name)
@@ -781,7 +785,8 @@ static int __of_changeset_apply(struct of_changeset *ocs) · 359 unmodified lines
781785 * Any side-effects of live tree state changes are applied here on
782786 * success, like creation/destruction of devices and side-effects
783787 * like creation of sysfs properties and directories.
784− * Returns 0 on success, a negative error value in case of an error.
788+ *
789+ * Return: 0 on success, a negative error value in case of an error.
785790 * On error the partially applied effects are reverted.
786791 */
787792 int of_changeset_apply(struct of_changeset *ocs)
@@ -875,7 +880,8 @@ static int __of_changeset_revert(struct of_changeset *ocs) · 87 unmodified lines
875880 * was before the application.
876881 * Any side-effects like creation/destruction of devices and
877882 * removal of sysfs properties and directories are applied.
878− * Returns 0 on success, a negative error value in case of an error.
883+ *
884+ * Return: 0 on success, a negative error value in case of an error.
879885 */
880886 int of_changeset_revert(struct of_changeset *ocs)
881887 {
@@ -903,7 +909,8 @@ EXPORT_SYMBOL_GPL(of_changeset_revert); · 21 unmodified lines
903909 * + OF_RECONFIG_ADD_PROPERTY
904910 * + OF_RECONFIG_REMOVE_PROPERTY,
905911 * + OF_RECONFIG_UPDATE_PROPERTY
906− * Returns 0 on success, a negative error value in case of an error.
912+ *
913+ * Return: 0 on success, a negative error value in case of an error.
907914 */
908915 int of_changeset_action(struct of_changeset *ocs, unsigned long action,
909916 struct device_node *np, struct property *prop)
drivers/of/fdt.c+20−20
@@ -282,7 +282,7 @@ static void reverse_nodes(struct device_node *parent) · 281 unmodified lines
282282 * @dad: Parent struct device_node
283283 * @nodepp: The device_node tree created by the call
284284 *
285− * It returns the size of unflattened device tree or error code
285+ * Return: The size of unflattened device tree or error code
286286 */
287287 static int unflatten_dt_nodes(const void *blob,
288288 void *mem,
@@ -351,11 +351,6 @@ static int unflatten_dt_nodes(const void *blob, · 62 unmodified lines
351351
352352 /**
353353 * __unflatten_device_tree - create tree of device_nodes from flat blob
354− *
355− * unflattens a device-tree, creating the
356− * tree of struct device_node. It also fills the "name" and "type"
357− * pointers of the nodes so the normal device-tree walking functions
358− * can be used.
359354 * @blob: The blob to expand
360355 * @dad: Parent device node
361356 * @mynodes: The device_node tree created by the call
@@ -363,7 +358,11 @@ static int unflatten_dt_nodes(const void *blob, · 1 unmodified line
363358 * for the resulting tree
364359 * @detached: if true set OF_DETACHED on @mynodes
365360 *
366− * Returns NULL on failure or the memory chunk containing the unflattened
361+ * unflattens a device-tree, creating the tree of struct device_node. It also
362+ * fills the "name" and "type" pointers of the nodes so the normal device-tree
363+ * walking functions can be used.
364+ *
365+ * Return: NULL on failure or the memory chunk containing the unflattened
367366 * device tree on success.
368367 */
369368 void *__unflatten_device_tree(const void *blob,
@@ -452,7 +451,7 @@ static DEFINE_MUTEX(of_fdt_unflatten_mutex); · 82 unmodified lines
452451 * pointers of the nodes so the normal device-tree walking functions
453452 * can be used.
454453 *
455− * Returns NULL on failure or the memory chunk containing the unflattened
454+ * Return: NULL on failure or the memory chunk containing the unflattened
456455 * device tree on success.
457456 */
458457 void *of_fdt_unflatten_tree(const unsigned long *blob,
@@ -480,7 +479,7 @@ void *initial_boot_params __ro_after_init; · 21 unmodified lines
480479
481480 static u32 of_fdt_crc32;
482481
483−/**
482+/*
484483 * __reserved_mem_reserve_reg() - reserve all memory described in 'reg' property
485484 */
486485 static int __init __reserved_mem_reserve_reg(unsigned long node,
@@ -526,7 +525,7 @@ static int __init __reserved_mem_reserve_reg(unsigned long node, · 39 unmodified lines
526525 return 0;
527526 }
528527
529−/**
528+/*
530529 * __reserved_mem_check_root() - check if #size-cells, #address-cells provided
531530 * in /reserved-memory matches the values supported by the current implementation,
532531 * also check if ranges property has been provided
@@ -549,8 +548,8 @@ static int __init __reserved_mem_check_root(unsigned long node) · 16 unmodified lines
549548 return 0;
550549 }
551550
552−/**
553− * fdt_scan_reserved_mem() - scan a single FDT node for reserved memory
551+/*
552+ * __fdt_scan_reserved_mem() - scan a single FDT node for reserved memory
554553 */
555554 static int __init __fdt_scan_reserved_mem(unsigned long node, const char *uname,
556555 int depth, void *data)
@@ -660,6 +659,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, · 103 unmodified lines
660659
661660 /**
662661 * of_scan_flat_dt_subnodes - scan sub-nodes of a node call callback on each.
662+ * @parent: parent node
663663 * @it: callback function
664664 * @data: context data pointer
665665 *
@@ -699,7 +699,7 @@ int __init of_get_flat_dt_subnode_by_name(unsigned long node, const char *uname) · 33 unmodified lines
699699 return fdt_subnode_offset(initial_boot_params, node, uname);
700700 }
701701
702−/**
702+/*
703703 * of_get_flat_dt_root - find the root node in the flat blob
704704 */
705705 unsigned long __init of_get_flat_dt_root(void)
@@ -707,7 +707,7 @@ unsigned long __init of_get_flat_dt_root(void) · 1 unmodified line
707707 return 0;
708708 }
709709
710−/**
710+/*
711711 * of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr
712712 *
713713 * This function can be used within scan_flattened_dt callback to get
@@ -726,7 +726,7 @@ const void *__init of_get_flat_dt_prop(unsigned long node, const char *name, · 12 unmodified lines
726726 * @node: node to test
727727 * @compat: compatible string to compare with compatible list.
728728 *
729− * On match, returns a non-zero value with smaller values returned for more
729+ * Return: a non-zero value on match with smaller values returned for more
730730 * specific compatible values.
731731 */
732732 static int of_fdt_is_compatible(const void *blob,
@@ -761,7 +761,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat) · 28 unmodified lines
761761 return of_fdt_is_compatible(initial_boot_params, node, compat);
762762 }
763763
764−/**
764+/*
765765 * of_flat_dt_match - Return true if node matches a list of compatible values
766766 */
767767 static int __init of_flat_dt_match(unsigned long node, const char *const *compat)
@@ -781,8 +781,8 @@ static int __init of_flat_dt_match(unsigned long node, const char *const *compat · 13 unmodified lines
781781 return score;
782782 }
783783
784−/**
785− * of_get_flat_dt_prop - Given a node in the flat blob, return the phandle
784+/*
785+ * of_get_flat_dt_phandle - Given a node in the flat blob, return the phandle
786786 */
787787 uint32_t __init of_get_flat_dt_phandle(unsigned long node)
788788 {
@@ -957,7 +957,7 @@ int __init early_init_dt_scan_chosen_stdout(void) · 168 unmodified lines
957957 }
958958 #endif
959959
960−/**
960+/*
961961 * early_init_dt_scan_root - fetch the top level address and size cells
962962 */
963963 int __init early_init_dt_scan_root(unsigned long node, const char *uname,
@@ -993,7 +993,7 @@ u64 __init dt_mem_next_cell(int s, const __be32 **cellp) · 29 unmodified lines
993993 return of_read_number(p, s);
994994 }
995995
996−/**
996+/*
997997 * early_init_dt_scan_memory - Look for and parse memory nodes
998998 */
999999 int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
drivers/of/irq.c+7−7
@@ -48,7 +48,7 @@ EXPORT_SYMBOL_GPL(irq_of_parse_and_map); · 47 unmodified lines
4848 * of_irq_find_parent - Given a device node, find its interrupt parent node
4949 * @child: pointer to device node
5050 *
51− * Returns a pointer to the interrupt parent node, or NULL if the interrupt
51+ * Return: A pointer to the interrupt parent node, or NULL if the interrupt
5252 * parent could not be determined.
5353 */
5454 struct device_node *of_irq_find_parent(struct device_node *child)
@@ -81,14 +81,14 @@ EXPORT_SYMBOL_GPL(of_irq_find_parent); · 26 unmodified lines
8181 * @addr: address specifier (start of "reg" property of the device) in be32 format
8282 * @out_irq: structure of_phandle_args updated by this function
8383 *
84− * Returns 0 on success and a negative number on error
85− *
8684 * This function is a low-level interrupt tree walking function. It
8785 * can be used to do a partial walk with synthetized reg and interrupts
8886 * properties, for example when resolving PCI interrupts when no device
8987 * node exist for the parent. It takes an interrupt specifier structure as
9088 * input, walks the tree looking for any interrupt-map properties, translates
9189 * the specifier for each map, and then returns the translated map.
90+ *
91+ * Return: 0 on success and a negative number on error
9292 */
9393 int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
9494 {
@@ -380,7 +380,7 @@ EXPORT_SYMBOL_GPL(of_irq_to_resource); · 285 unmodified lines
380380 * @dev: pointer to device tree node
381381 * @index: zero-based index of the IRQ
382382 *
383− * Returns Linux IRQ number on success, or 0 on the IRQ mapping failure, or
383+ * Return: Linux IRQ number on success, or 0 on the IRQ mapping failure, or
384384 * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case
385385 * of any other failure.
386386 */
@@ -407,7 +407,7 @@ EXPORT_SYMBOL_GPL(of_irq_get); · 20 unmodified lines
407407 * @dev: pointer to device tree node
408408 * @name: IRQ name
409409 *
410− * Returns Linux IRQ number on success, or 0 on the IRQ mapping failure, or
410+ * Return: Linux IRQ number on success, or 0 on the IRQ mapping failure, or
411411 * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case
412412 * of any other failure.
413413 */
@@ -447,7 +447,7 @@ int of_irq_count(struct device_node *dev) · 33 unmodified lines
447447 * @res: array of resources to fill in
448448 * @nr_irqs: the number of IRQs (and upper bound for num of @res elements)
449449 *
450− * Returns the size of the filled in table (up to @nr_irqs).
450+ * Return: The size of the filled in table (up to @nr_irqs).
451451 */
452452 int of_irq_to_resource_table(struct device_node *dev, struct resource *res,
453453 int nr_irqs)
@@ -602,7 +602,7 @@ static u32 __of_msi_map_id(struct device *dev, struct device_node **np, · 148 unmodified lines
602602 * Walk up the device hierarchy looking for devices with a "msi-map"
603603 * property. If found, apply the mapping to @id_in.
604604 *
605− * Returns the mapped MSI ID.
605+ * Return: The mapped MSI ID.
606606 */
607607 u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in)
608608 {
drivers/of/kexec.c+458−0
@@ -0,0 +1,458 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+/*
3+ * Copyright (C) 2020 Arm Limited
4+ *
5+ * Based on arch/arm64/kernel/machine_kexec_file.c:
6+ * Copyright (C) 2018 Linaro Limited
7+ *
8+ * And arch/powerpc/kexec/file_load.c:
9+ * Copyright (C) 2016 IBM Corporation
10+ */
11+
12+#include <linux/kernel.h>
13+#include <linux/kexec.h>
14+#include <linux/memblock.h>
15+#include <linux/libfdt.h>
16+#include <linux/of.h>
17+#include <linux/of_fdt.h>
18+#include <linux/random.h>
19+#include <linux/types.h>
20+
21+/* relevant device tree properties */
22+#define FDT_PROP_KEXEC_ELFHDR "linux,elfcorehdr"
23+#define FDT_PROP_MEM_RANGE "linux,usable-memory-range"
24+#define FDT_PROP_INITRD_START "linux,initrd-start"
25+#define FDT_PROP_INITRD_END "linux,initrd-end"
26+#define FDT_PROP_BOOTARGS "bootargs"
27+#define FDT_PROP_KASLR_SEED "kaslr-seed"
28+#define FDT_PROP_RNG_SEED "rng-seed"
29+#define RNG_SEED_SIZE 128
30+
31+/*
32+ * Additional space needed for the FDT buffer so that we can add initrd,
33+ * bootargs, kaslr-seed, rng-seed, useable-memory-range and elfcorehdr.
34+ */
35+#define FDT_EXTRA_SPACE 0x1000
36+
37+/**
38+ * fdt_find_and_del_mem_rsv - delete memory reservation with given address and size
39+ *
40+ * @fdt: Flattened device tree for the current kernel.
41+ * @start: Starting address of the reserved memory.
42+ * @size: Size of the reserved memory.
43+ *
44+ * Return: 0 on success, or negative errno on error.
45+ */
46+static int fdt_find_and_del_mem_rsv(void *fdt, unsigned long start, unsigned long size)
47+{
48+ int i, ret, num_rsvs = fdt_num_mem_rsv(fdt);
49+
50+ for (i = 0; i < num_rsvs; i++) {
51+ u64 rsv_start, rsv_size;
52+
53+ ret = fdt_get_mem_rsv(fdt, i, &rsv_start, &rsv_size);
54+ if (ret) {
55+ pr_err("Malformed device tree.\n");
56+ return -EINVAL;
57+ }
58+
59+ if (rsv_start == start && rsv_size == size) {
60+ ret = fdt_del_mem_rsv(fdt, i);
61+ if (ret) {
62+ pr_err("Error deleting device tree reservation.\n");
63+ return -EINVAL;
64+ }
65+
66+ return 0;
67+ }
68+ }
69+
70+ return -ENOENT;
71+}
72+
73+/**
74+ * get_addr_size_cells - Get address and size of root node
75+ *
76+ * @addr_cells: Return address of the root node
77+ * @size_cells: Return size of the root node
78+ *
79+ * Return: 0 on success, or negative errno on error.
80+ */
81+static int get_addr_size_cells(int *addr_cells, int *size_cells)
82+{
83+ struct device_node *root;
84+
85+ root = of_find_node_by_path("/");
86+ if (!root)
87+ return -EINVAL;
88+
89+ *addr_cells = of_n_addr_cells(root);
90+ *size_cells = of_n_size_cells(root);
91+
92+ of_node_put(root);
93+
94+ return 0;
95+}
96+
97+/**
98+ * do_get_kexec_buffer - Get address and size of device tree property
99+ *
100+ * @prop: Device tree property
101+ * @len: Size of @prop
102+ * @addr: Return address of the node
103+ * @size: Return size of the node
104+ *
105+ * Return: 0 on success, or negative errno on error.
106+ */
107+static int do_get_kexec_buffer(const void *prop, int len, unsigned long *addr,
108+ size_t *size)
109+{
110+ int ret, addr_cells, size_cells;
111+
112+ ret = get_addr_size_cells(&addr_cells, &size_cells);
113+ if (ret)
114+ return ret;
115+
116+ if (len < 4 * (addr_cells + size_cells))
117+ return -ENOENT;
118+
119+ *addr = of_read_number(prop, addr_cells);
120+ *size = of_read_number(prop + 4 * addr_cells, size_cells);
121+
122+ return 0;
123+}
124+
125+/**
126+ * ima_get_kexec_buffer - get IMA buffer from the previous kernel
127+ * @addr: On successful return, set to point to the buffer contents.
128+ * @size: On successful return, set to the buffer size.
129+ *
130+ * Return: 0 on success, negative errno on error.
131+ */
132+int ima_get_kexec_buffer(void **addr, size_t *size)
133+{
134+ int ret, len;
135+ unsigned long tmp_addr;
136+ size_t tmp_size;
137+ const void *prop;
138+
139+ if (!IS_ENABLED(CONFIG_HAVE_IMA_KEXEC))
140+ return -ENOTSUPP;
141+
142+ prop = of_get_property(of_chosen, "linux,ima-kexec-buffer", &len);
143+ if (!prop)
144+ return -ENOENT;
145+
146+ ret = do_get_kexec_buffer(prop, len, &tmp_addr, &tmp_size);
147+ if (ret)
148+ return ret;
149+
150+ *addr = __va(tmp_addr);
151+ *size = tmp_size;
152+
153+ return 0;
154+}
155+
156+/**
157+ * ima_free_kexec_buffer - free memory used by the IMA buffer
158+ */
159+int ima_free_kexec_buffer(void)
160+{
161+ int ret;
162+ unsigned long addr;
163+ size_t size;
164+ struct property *prop;
165+
166+ if (!IS_ENABLED(CONFIG_HAVE_IMA_KEXEC))
167+ return -ENOTSUPP;
168+
169+ prop = of_find_property(of_chosen, "linux,ima-kexec-buffer", NULL);
170+ if (!prop)
171+ return -ENOENT;
172+
173+ ret = do_get_kexec_buffer(prop->value, prop->length, &addr, &size);
174+ if (ret)
175+ return ret;
176+
177+ ret = of_remove_property(of_chosen, prop);
178+ if (ret)
179+ return ret;
180+
181+ return memblock_free(addr, size);
182+
183+}
184+
185+/**
186+ * remove_ima_buffer - remove the IMA buffer property and reservation from @fdt
187+ *
188+ * @fdt: Flattened Device Tree to update
189+ * @chosen_node: Offset to the chosen node in the device tree
190+ *
191+ * The IMA measurement buffer is of no use to a subsequent kernel, so we always
192+ * remove it from the device tree.
193+ */
194+static void remove_ima_buffer(void *fdt, int chosen_node)
195+{
196+ int ret, len;
197+ unsigned long addr;
198+ size_t size;
199+ const void *prop;
200+
201+ if (!IS_ENABLED(CONFIG_HAVE_IMA_KEXEC))
202+ return;
203+
204+ prop = fdt_getprop(fdt, chosen_node, "linux,ima-kexec-buffer", &len);
205+ if (!prop)
206+ return;
207+
208+ ret = do_get_kexec_buffer(prop, len, &addr, &size);
209+ fdt_delprop(fdt, chosen_node, "linux,ima-kexec-buffer");
210+ if (ret)
211+ return;
212+
213+ ret = fdt_find_and_del_mem_rsv(fdt, addr, size);
214+ if (!ret)
215+ pr_debug("Removed old IMA buffer reservation.\n");
216+}
217+
218+#ifdef CONFIG_IMA_KEXEC
219+/**
220+ * setup_ima_buffer - add IMA buffer information to the fdt
221+ * @image: kexec image being loaded.
222+ * @fdt: Flattened device tree for the next kernel.
223+ * @chosen_node: Offset to the chosen node.
224+ *
225+ * Return: 0 on success, or negative errno on error.
226+ */
227+static int setup_ima_buffer(const struct kimage *image, void *fdt,
228+ int chosen_node)
229+{
230+ int ret;
231+
232+ if (!image->ima_buffer_size)
233+ return 0;
234+
235+ ret = fdt_appendprop_addrrange(fdt, 0, chosen_node,
236+ "linux,ima-kexec-buffer",
237+ image->ima_buffer_addr,
238+ image->ima_buffer_size);
239+ if (ret < 0)
240+ return -EINVAL;
241+
242+ ret = fdt_add_mem_rsv(fdt, image->ima_buffer_addr,
243+ image->ima_buffer_size);
244+ if (ret)
245+ return -EINVAL;
246+
247+ pr_debug("IMA buffer at 0x%llx, size = 0x%zx\n",
248+ image->ima_buffer_addr, image->ima_buffer_size);
249+
250+ return 0;
251+}
252+#else /* CONFIG_IMA_KEXEC */
253+static inline int setup_ima_buffer(const struct kimage *image, void *fdt,
254+ int chosen_node)
255+{
256+ return 0;
257+}
258+#endif /* CONFIG_IMA_KEXEC */
259+
260+/*
261+ * of_kexec_alloc_and_setup_fdt - Alloc and setup a new Flattened Device Tree
262+ *
263+ * @image: kexec image being loaded.
264+ * @initrd_load_addr: Address where the next initrd will be loaded.
265+ * @initrd_len: Size of the next initrd, or 0 if there will be none.
266+ * @cmdline: Command line for the next kernel, or NULL if there will
267+ * be none.
268+ * @extra_fdt_size: Additional size for the new FDT buffer.
269+ *
270+ * Return: fdt on success, or NULL errno on error.
271+ */
272+void *of_kexec_alloc_and_setup_fdt(const struct kimage *image,
273+ unsigned long initrd_load_addr,
274+ unsigned long initrd_len,
275+ const char *cmdline, size_t extra_fdt_size)
276+{
277+ void *fdt;
278+ int ret, chosen_node;
279+ const void *prop;
280+ size_t fdt_size;
281+
282+ fdt_size = fdt_totalsize(initial_boot_params) +
283+ (cmdline ? strlen(cmdline) : 0) +
284+ FDT_EXTRA_SPACE +
285+ extra_fdt_size;
286+ fdt = kvmalloc(fdt_size, GFP_KERNEL);
287+ if (!fdt)
288+ return NULL;
289+
290+ ret = fdt_open_into(initial_boot_params, fdt, fdt_size);
291+ if (ret < 0) {
292+ pr_err("Error %d setting up the new device tree.\n", ret);
293+ goto out;
294+ }
295+
296+ /* Remove memory reservation for the current device tree. */
297+ ret = fdt_find_and_del_mem_rsv(fdt, __pa(initial_boot_params),
298+ fdt_totalsize(initial_boot_params));
299+ if (ret == -EINVAL) {
300+ pr_err("Error removing memory reservation.\n");
301+ goto out;
302+ }
303+
304+ chosen_node = fdt_path_offset(fdt, "/chosen");
305+ if (chosen_node == -FDT_ERR_NOTFOUND)
306+ chosen_node = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"),
307+ "chosen");
308+ if (chosen_node < 0) {
309+ ret = chosen_node;
310+ goto out;
311+ }
312+
313+ ret = fdt_delprop(fdt, chosen_node, FDT_PROP_KEXEC_ELFHDR);
314+ if (ret && ret != -FDT_ERR_NOTFOUND)
315+ goto out;
316+ ret = fdt_delprop(fdt, chosen_node, FDT_PROP_MEM_RANGE);
317+ if (ret && ret != -FDT_ERR_NOTFOUND)
318+ goto out;
319+
320+ /* Did we boot using an initrd? */
321+ prop = fdt_getprop(fdt, chosen_node, "linux,initrd-start", NULL);
322+ if (prop) {
323+ u64 tmp_start, tmp_end, tmp_size;
324+
325+ tmp_start = fdt64_to_cpu(*((const fdt64_t *) prop));
326+
327+ prop = fdt_getprop(fdt, chosen_node, "linux,initrd-end", NULL);
328+ if (!prop) {
329+ ret = -EINVAL;
330+ goto out;
331+ }
332+
333+ tmp_end = fdt64_to_cpu(*((const fdt64_t *) prop));
334+
335+ /*
336+ * kexec reserves exact initrd size, while firmware may
337+ * reserve a multiple of PAGE_SIZE, so check for both.
338+ */
339+ tmp_size = tmp_end - tmp_start;
340+ ret = fdt_find_and_del_mem_rsv(fdt, tmp_start, tmp_size);
341+ if (ret == -ENOENT)
342+ ret = fdt_find_and_del_mem_rsv(fdt, tmp_start,
343+ round_up(tmp_size, PAGE_SIZE));
344+ if (ret == -EINVAL)
345+ goto out;
346+ }
347+
348+ /* add initrd-* */
349+ if (initrd_load_addr) {
350+ ret = fdt_setprop_u64(fdt, chosen_node, FDT_PROP_INITRD_START,
351+ initrd_load_addr);
352+ if (ret)
353+ goto out;
354+
355+ ret = fdt_setprop_u64(fdt, chosen_node, FDT_PROP_INITRD_END,
356+ initrd_load_addr + initrd_len);
357+ if (ret)
358+ goto out;
359+
360+ ret = fdt_add_mem_rsv(fdt, initrd_load_addr, initrd_len);
361+ if (ret)
362+ goto out;
363+
364+ } else {
365+ ret = fdt_delprop(fdt, chosen_node, FDT_PROP_INITRD_START);
366+ if (ret && (ret != -FDT_ERR_NOTFOUND))
367+ goto out;
368+
369+ ret = fdt_delprop(fdt, chosen_node, FDT_PROP_INITRD_END);
370+ if (ret && (ret != -FDT_ERR_NOTFOUND))
371+ goto out;
372+ }
373+
374+ if (image->type == KEXEC_TYPE_CRASH) {
375+ /* add linux,elfcorehdr */
376+ ret = fdt_appendprop_addrrange(fdt, 0, chosen_node,
377+ FDT_PROP_KEXEC_ELFHDR,
378+ image->elf_load_addr,
379+ image->elf_headers_sz);
380+ if (ret)
381+ goto out;
382+
383+ /*
384+ * Avoid elfcorehdr from being stomped on in kdump kernel by
385+ * setting up memory reserve map.
386+ */
387+ ret = fdt_add_mem_rsv(fdt, image->elf_load_addr,
388+ image->elf_headers_sz);
389+ if (ret)
390+ goto out;
391+
392+ /* add linux,usable-memory-range */
393+ ret = fdt_appendprop_addrrange(fdt, 0, chosen_node,
394+ FDT_PROP_MEM_RANGE,
395+ crashk_res.start,
396+ crashk_res.end - crashk_res.start + 1);
397+ if (ret)
398+ goto out;
399+ }
400+
401+ /* add bootargs */
402+ if (cmdline) {
403+ ret = fdt_setprop_string(fdt, chosen_node, FDT_PROP_BOOTARGS, cmdline);
404+ if (ret)
405+ goto out;
406+ } else {
407+ ret = fdt_delprop(fdt, chosen_node, FDT_PROP_BOOTARGS);
408+ if (ret && (ret != -FDT_ERR_NOTFOUND))
409+ goto out;
410+ }
411+
412+ /* add kaslr-seed */
413+ ret = fdt_delprop(fdt, chosen_node, FDT_PROP_KASLR_SEED);
414+ if (ret == -FDT_ERR_NOTFOUND)
415+ ret = 0;
416+ else if (ret)
417+ goto out;
418+
419+ if (rng_is_initialized()) {
420+ u64 seed = get_random_u64();
421+
422+ ret = fdt_setprop_u64(fdt, chosen_node, FDT_PROP_KASLR_SEED, seed);
423+ if (ret)
424+ goto out;
425+ } else {
426+ pr_notice("RNG is not initialised: omitting \"%s\" property\n",
427+ FDT_PROP_KASLR_SEED);
428+ }
429+
430+ /* add rng-seed */
431+ if (rng_is_initialized()) {
432+ void *rng_seed;
433+
434+ ret = fdt_setprop_placeholder(fdt, chosen_node, FDT_PROP_RNG_SEED,
435+ RNG_SEED_SIZE, &rng_seed);
436+ if (ret)
437+ goto out;
438+ get_random_bytes(rng_seed, RNG_SEED_SIZE);
439+ } else {
440+ pr_notice("RNG is not initialised: omitting \"%s\" property\n",
441+ FDT_PROP_RNG_SEED);
442+ }
443+
444+ ret = fdt_setprop(fdt, chosen_node, "linux,booted-from-kexec", NULL, 0);
445+ if (ret)
446+ goto out;
447+
448+ remove_ima_buffer(fdt, chosen_node);
449+ ret = setup_ima_buffer(image, fdt, fdt_path_offset(fdt, "/chosen"));
450+
451+out:
452+ if (ret) {
453+ kvfree(fdt);
454+ fdt = NULL;
455+ }
456+
457+ return fdt;
458+}
drivers/of/of_net.c+3−0
@@ -79,6 +79,9 @@ static const void *of_get_mac_addr_nvmem(struct device_node *np) · 78 unmodified lines
7979 }
8080
8181 /**
82+ * of_get_mac_address()
83+ * @np: Caller's Device Node
84+ *
8285 * Search the device tree for the best MAC address to use. 'mac-address' is
8386 * checked first, because that is supposed to contain to "most recent" MAC
8487 * address. If that isn't set, then 'local-mac-address' is checked next,
drivers/of/of_reserved_mem.c+3−3
@@ -45,7 +45,7 @@ static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, · 44 unmodified lines
4545 return memblock_reserve(base, size);
4646 }
4747
48−/**
48+/*
4949 * fdt_reserved_mem_save_node() - save fdt node for second pass initialization
5050 */
5151 void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname,
@@ -67,7 +67,7 @@ void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname, · 15 unmodified lines
6767 return;
6868 }
6969
70−/**
70+/*
7171 * __reserved_mem_alloc_size() - allocate reserved memory described by
7272 * 'size', 'alignment' and 'alloc-ranges' properties.
7373 */
@@ -164,7 +164,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node, · 90 unmodified lines
164164 static const struct of_device_id __rmem_of_table_sentinel
165165 __used __section("__reservedmem_of_table_end");
166166
167−/**
167+/*
168168 * __reserved_mem_init_node() - call region specific reserved memory init code
169169 */
170170 static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
drivers/of/overlay.c+10−9
@@ -140,7 +140,7 @@ int of_overlay_notifier_register(struct notifier_block *nb) · 139 unmodified lines
140140 EXPORT_SYMBOL_GPL(of_overlay_notifier_register);
141141
142142 /**
143− * of_overlay_notifier_register() - Unregister notifier for overlay operations
143+ * of_overlay_notifier_unregister() - Unregister notifier for overlay operations
144144 * @nb: Notifier block to unregister
145145 */
146146 int of_overlay_notifier_unregister(struct notifier_block *nb)
@@ -298,7 +298,7 @@ err_free_target_path: · 151 unmodified lines
298298 *
299299 * Update of property in symbols node is not allowed.
300300 *
301− * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if
301+ * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if
302302 * invalid @overlay.
303303 */
304304 static int add_changeset_property(struct overlay_changeset *ovcs,
@@ -403,7 +403,7 @@ static int add_changeset_property(struct overlay_changeset *ovcs, · 98 unmodified lines
403403 *
404404 * NOTE_2: Multiple mods of created nodes not supported.
405405 *
406− * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if
406+ * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if
407407 * invalid @overlay.
408408 */
409409 static int add_changeset_node(struct overlay_changeset *ovcs,
@@ -475,7 +475,7 @@ static int add_changeset_node(struct overlay_changeset *ovcs, · 65 unmodified lines
475475 *
476476 * Do not allow symbols node to have any children.
477477 *
478− * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if
478+ * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if
479479 * invalid @overlay_node.
480480 */
481481 static int build_changeset_next_level(struct overlay_changeset *ovcs,
@@ -606,7 +606,7 @@ static int find_dup_cset_prop(struct overlay_changeset *ovcs, · 124 unmodified lines
606606 * the same node or duplicate {add, delete, or update} properties entries
607607 * for the same property.
608608 *
609− * Returns 0 on success, or -EINVAL if duplicate changeset entry found.
609+ * Return: 0 on success, or -EINVAL if duplicate changeset entry found.
610610 */
611611 static int changeset_dup_entry_check(struct overlay_changeset *ovcs)
612612 {
@@ -630,7 +630,7 @@ static int changeset_dup_entry_check(struct overlay_changeset *ovcs) · 17 unmodified lines
630630 * any portions of the changeset that were successfully created will remain
631631 * in @ovcs->cset.
632632 *
633− * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if
633+ * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if
634634 * invalid overlay in @ovcs->fragments[].
635635 */
636636 static int build_changeset(struct overlay_changeset *ovcs)
@@ -726,7 +726,7 @@ static struct device_node *find_target(struct device_node *info_node) · 89 unmodified lines
726726 * the top level of @tree. The relevant top level nodes are the fragment
727727 * nodes and the __symbols__ node. Any other top level node will be ignored.
728728 *
729− * Returns 0 on success, -ENOMEM if memory allocation failure, -EINVAL if error
729+ * Return: 0 on success, -ENOMEM if memory allocation failure, -EINVAL if error
730730 * detected in @tree, or -ENOSPC if idr_alloc() error.
731731 */
732732 static int init_overlay_changeset(struct overlay_changeset *ovcs,
@@ -796,6 +796,7 @@ static int init_overlay_changeset(struct overlay_changeset *ovcs, · 63 unmodified lines
796796 if (!fragment->target) {
797797 of_node_put(fragment->overlay);
798798 ret = -EINVAL;
799+ of_node_put(node);
799800 goto err_free_fragments;
800801 }
801802
@@ -1186,7 +1187,7 @@ static int overlay_removal_is_ok(struct overlay_changeset *remove_ovcs) · 384 unmodified lines
11861187 * If an error is returned by an overlay changeset post-remove notifier
11871188 * then no further overlay changeset post-remove notifier will be called.
11881189 *
1189− * Returns 0 on success, or a negative error number. *ovcs_id is set to
1190+ * Return: 0 on success, or a negative error number. *@ovcs_id is set to
11901191 * zero after reverting the changeset, even if a subsequent error occurs.
11911192 */
11921193 int of_overlay_remove(int *ovcs_id)
@@ -1264,7 +1265,7 @@ EXPORT_SYMBOL_GPL(of_overlay_remove); · 71 unmodified lines
12641265 *
12651266 * Removes all overlays from the system in the correct order.
12661267 *
1267− * Returns 0 on success, or a negative error number
1268+ * Return: 0 on success, or a negative error number
12681269 */
12691270 int of_overlay_remove_all(void)
12701271 {
drivers/of/platform.c+6−6
@@ -44,7 +44,7 @@ static const struct of_device_id of_skipped_node_table[] = { · 43 unmodified lines
4444 * Takes a reference to the embedded struct device which needs to be dropped
4545 * after use.
4646 *
47− * Returns platform_device pointer, or NULL if not found
47+ * Return: platform_device pointer, or NULL if not found
4848 */
4949 struct platform_device *of_find_device_by_node(struct device_node *np)
5050 {
@@ -160,7 +160,7 @@ EXPORT_SYMBOL(of_device_alloc); · 109 unmodified lines
160160 * @platform_data: pointer to populate platform_data pointer with
161161 * @parent: Linux device model parent device.
162162 *
163− * Returns pointer to created platform device, or NULL if a device was not
163+ * Return: Pointer to created platform device, or NULL if a device was not
164164 * registered. Unavailable devices will not get registered.
165165 */
166166 static struct platform_device *of_platform_device_create_pdata(
@@ -204,7 +204,7 @@ err_clear_flag: · 37 unmodified lines
204204 * @bus_id: name to assign device
205205 * @parent: Linux device model parent device.
206206 *
207− * Returns pointer to created platform device, or NULL if a device was not
207+ * Return: Pointer to created platform device, or NULL if a device was not
208208 * registered. Unavailable devices will not get registered.
209209 */
210210 struct platform_device *of_platform_device_create(struct device_node *np,
@@ -290,7 +290,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node, · 79 unmodified lines
290290 }
291291 #endif /* CONFIG_ARM_AMBA */
292292
293−/**
293+/*
294294 * of_dev_lookup() - Given a device node, lookup the preferred Linux name
295295 */
296296 static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *lookup,
@@ -463,7 +463,7 @@ EXPORT_SYMBOL(of_platform_bus_probe); · 166 unmodified lines
463463 * New board support should be using this function instead of
464464 * of_platform_bus_probe().
465465 *
466− * Returns 0 on success, < 0 on failure.
466+ * Return: 0 on success, < 0 on failure.
467467 */
468468 int of_platform_populate(struct device_node *root,
469469 const struct of_device_id *matches,
@@ -607,7 +607,7 @@ static void devm_of_platform_populate_release(struct device *dev, void *res) · 137 unmodified lines
607607 * Similar to of_platform_populate(), but will automatically call
608608 * of_platform_depopulate() when the device is unbound from the bus.
609609 *
610− * Returns 0 on success, < 0 on failure.
610+ * Return: 0 on success, < 0 on failure.
611611 */
612612 int devm_of_platform_populate(struct device *dev)
613613 {
drivers/of/property.c+44−28
@@ -61,9 +61,11 @@ EXPORT_SYMBOL(of_graph_is_present); · 60 unmodified lines
6161 * @elem_size: size of the individual element
6262 *
6363 * Search for a property in a device node and count the number of elements of
64− * size elem_size in it. Returns number of elements on sucess, -EINVAL if the
65− * property does not exist or its length does not match a multiple of elem_size
66− * and -ENODATA if the property does not have a value.
64+ * size elem_size in it.
65+ *
66+ * Return: The number of elements on sucess, -EINVAL if the property does not
67+ * exist or its length does not match a multiple of elem_size and -ENODATA if
68+ * the property does not have a value.
6769 */
6870 int of_property_count_elems_of_size(const struct device_node *np,
6971 const char *propname, int elem_size)
@@ -95,8 +97,9 @@ EXPORT_SYMBOL_GPL(of_property_count_elems_of_size); · 25 unmodified lines
9597 * @len: if !=NULL, actual length is written to here
9698 *
9799 * Search for a property in a device node and valid the requested size.
98− * Returns the property value on success, -EINVAL if the property does not
99− * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the
100+ *
101+ * Return: The property value on success, -EINVAL if the property does not
102+ * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the
100103 * property data is too small or too large.
101104 *
102105 */
@@ -129,7 +132,9 @@ static void *of_find_property_value_of_size(const struct device_node *np, · 26 unmodified lines
129132 * @out_value: pointer to return value, modified only if no error.
130133 *
131134 * Search for a property in a device node and read nth 32-bit value from
132− * it. Returns 0 on success, -EINVAL if the property does not exist,
135+ * it.
136+ *
137+ * Return: 0 on success, -EINVAL if the property does not exist,
133138 * -ENODATA if property does not have a value, and -EOVERFLOW if the
134139 * property data isn't large enough.
135140 *
@@ -161,7 +166,9 @@ EXPORT_SYMBOL_GPL(of_property_read_u32_index); · 25 unmodified lines
161166 * @out_value: pointer to return value, modified only if no error.
162167 *
163168 * Search for a property in a device node and read nth 64-bit value from
164− * it. Returns 0 on success, -EINVAL if the property does not exist,
169+ * it.
170+ *
171+ * Return: 0 on success, -EINVAL if the property does not exist,
165172 * -ENODATA if property does not have a value, and -EOVERFLOW if the
166173 * property data isn't large enough.
167174 *
@@ -196,12 +203,14 @@ EXPORT_SYMBOL_GPL(of_property_read_u64_index); · 28 unmodified lines
196203 * sz_min will be read.
197204 *
198205 * Search for a property in a device node and read 8-bit value(s) from
199− * it. Returns number of elements read on success, -EINVAL if the property
200− * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW
201− * if the property data is smaller than sz_min or longer than sz_max.
206+ * it.
202207 *
203208 * dts entry of array should be like:
204− * property = /bits/ 8 <0x50 0x60 0x70>;
209+ * ``property = /bits/ 8 <0x50 0x60 0x70>;``
210+ *
211+ * Return: The number of elements read on success, -EINVAL if the property
212+ * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW
213+ * if the property data is smaller than sz_min or longer than sz_max.
205214 *
206215 * The out_values is modified only if a valid u8 value can be decoded.
207216 */
@@ -244,12 +253,14 @@ EXPORT_SYMBOL_GPL(of_property_read_variable_u8_array); · 36 unmodified lines
244253 * sz_min will be read.
245254 *
246255 * Search for a property in a device node and read 16-bit value(s) from
247− * it. Returns number of elements read on success, -EINVAL if the property
248− * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW
249− * if the property data is smaller than sz_min or longer than sz_max.
256+ * it.
250257 *
251258 * dts entry of array should be like:
252− * property = /bits/ 16 <0x5000 0x6000 0x7000>;
259+ * ``property = /bits/ 16 <0x5000 0x6000 0x7000>;``
260+ *
261+ * Return: The number of elements read on success, -EINVAL if the property
262+ * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW
263+ * if the property data is smaller than sz_min or longer than sz_max.
253264 *
254265 * The out_values is modified only if a valid u16 value can be decoded.
255266 */
@@ -292,7 +303,9 @@ EXPORT_SYMBOL_GPL(of_property_read_variable_u16_array); · 36 unmodified lines
292303 * sz_min will be read.
293304 *
294305 * Search for a property in a device node and read 32-bit value(s) from
295− * it. Returns number of elements read on success, -EINVAL if the property
306+ * it.
307+ *
308+ * Return: The number of elements read on success, -EINVAL if the property
296309 * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW
297310 * if the property data is smaller than sz_min or longer than sz_max.
298311 *
@@ -331,7 +344,9 @@ EXPORT_SYMBOL_GPL(of_property_read_variable_u32_array); · 32 unmodified lines
331344 * @out_value: pointer to return value, modified only if return value is 0.
332345 *
333346 * Search for a property in a device node and read a 64-bit value from
334− * it. Returns 0 on success, -EINVAL if the property does not exist,
347+ * it.
348+ *
349+ * Return: 0 on success, -EINVAL if the property does not exist,
335350 * -ENODATA if property does not have a value, and -EOVERFLOW if the
336351 * property data isn't large enough.
337352 *
@@ -366,7 +381,9 @@ EXPORT_SYMBOL_GPL(of_property_read_u64); · 28 unmodified lines
366381 * sz_min will be read.
367382 *
368383 * Search for a property in a device node and read 64-bit value(s) from
369− * it. Returns number of elements read on success, -EINVAL if the property
384+ * it.
385+ *
386+ * Return: The number of elements read on success, -EINVAL if the property
370387 * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW
371388 * if the property data is smaller than sz_min or longer than sz_max.
372389 *
@@ -408,10 +425,11 @@ EXPORT_SYMBOL_GPL(of_property_read_variable_u64_array); · 35 unmodified lines
408425 * return value is 0.
409426 *
410427 * Search for a property in a device tree node and retrieve a null
411− * terminated string value (pointer to data, not a copy). Returns 0 on
412− * success, -EINVAL if the property does not exist, -ENODATA if property
413− * does not have a value, and -EILSEQ if the string is not null-terminated
414− * within the length of the property data.
428+ * terminated string value (pointer to data, not a copy).
429+ *
430+ * Return: 0 on success, -EINVAL if the property does not exist, -ENODATA if
431+ * property does not have a value, and -EILSEQ if the string is not
432+ * null-terminated within the length of the property data.
415433 *
416434 * The out_string pointer is modified only if a valid string can be decoded.
417435 */
@@ -775,7 +793,7 @@ EXPORT_SYMBOL(of_graph_get_remote_port_parent); · 357 unmodified lines
775793 * @node: pointer to a local endpoint device_node
776794 *
777795 * Return: Remote port node associated with remote endpoint node linked
778− * to @node. Use of_node_put() on it when done.
796+ * to @node. Use of_node_put() on it when done.
779797 */
780798 struct device_node *of_graph_get_remote_port(const struct device_node *node)
781799 {
@@ -808,7 +826,7 @@ EXPORT_SYMBOL(of_graph_get_endpoint_count); · 26 unmodified lines
808826 * @endpoint: identifier (value of reg property) of the endpoint node
809827 *
810828 * Return: Remote device node associated with remote endpoint node linked
811− * to @node. Use of_node_put() on it when done.
829+ * to @node. Use of_node_put() on it when done.
812830 */
813831 struct device_node *of_graph_get_remote_node(const struct device_node *node,
814832 u32 port, u32 endpoint)
@@ -1230,7 +1248,7 @@ static struct device_node *parse_##fname(struct device_node *np, \ · 415 unmodified lines
12301248 * @parse_prop.prop_name: Name of property holding a phandle value
12311249 * @parse_prop.index: For properties holding a list of phandles, this is the
12321250 * index into the list
1233− * @optional: The property can be an optional dependency.
1251+ * @optional: Describes whether a supplier is mandatory or not
12341252 * @node_not_dev: The consumer node containing the property is never a device.
12351253 *
12361254 * Returns:
@@ -1363,7 +1381,6 @@ static const struct supplier_bindings of_supplier_bindings[] = { · 126 unmodified lines
13631381
13641382 /**
13651383 * of_link_property - Create device links to suppliers listed in a property
1366− * @dev: Consumer device
13671384 * @con_np: The consumer device tree node which contains the property
13681385 * @prop_name: Name of property to be parsed
13691386 *
@@ -1387,7 +1404,6 @@ static int of_link_property(struct device_node *con_np, const char *prop_name) · 17 unmodified lines
13871404 const struct supplier_bindings *s = of_supplier_bindings;
13881405 unsigned int i = 0;
13891406 bool matched = false;
1390− int ret = 0;
13911407
13921408 /* Do not stop at first failed link, link all available suppliers. */
13931409 while (!matched && s->parse_prop) {
@@ -1410,7 +1426,7 @@ static int of_link_property(struct device_node *con_np, const char *prop_name) · 16 unmodified lines
14101426 }
14111427 s++;
14121428 }
1413− return ret;
1429+ return 0;
14141430 }
14151431
14161432 static int of_fwnode_add_links(struct fwnode_handle *fwnode)
drivers/of/unittest-data/Makefile+48−0
@@ -38,3 +38,51 @@ DTC_FLAGS_testcases += -@ · 37 unmodified lines
3838
3939 # suppress warnings about intentional errors
4040 DTC_FLAGS_testcases += -Wno-interrupts_property
41+
42+# Apply overlays statically with fdtoverlay. This is a build time test that
43+# the overlays can be applied successfully by fdtoverlay. This does not
44+# guarantee that the overlays can be applied successfully at run time by
45+# unittest, but it provides a bit of build time test coverage for those
46+# who do not execute unittest.
47+#
48+# The overlays are applied on top of static_base_1.dtb and static_base_2.dtb to
49+# create static_test_1.dtb and static_test_2.dtb. If fdtoverlay detects an
50+# error than the kernel build will fail. static_test_1.dtb and
51+# static_test_2.dtb are not consumed by unittest.
52+#
53+# Some unittest overlays deliberately contain errors that unittest checks for.
54+# These overlays will cause fdtoverlay to fail, and are thus not included
55+# in the static test:
56+# overlay_bad_add_dup_node.dtbo \
57+# overlay_bad_add_dup_prop.dtbo \
58+# overlay_bad_phandle.dtbo \
59+# overlay_bad_symbol.dtbo \
60+
61+apply_static_overlay_1 := overlay_0.dtbo \
62+ overlay_1.dtbo \
63+ overlay_2.dtbo \
64+ overlay_3.dtbo \
65+ overlay_4.dtbo \
66+ overlay_5.dtbo \
67+ overlay_6.dtbo \
68+ overlay_7.dtbo \
69+ overlay_8.dtbo \
70+ overlay_9.dtbo \
71+ overlay_10.dtbo \
72+ overlay_11.dtbo \
73+ overlay_12.dtbo \
74+ overlay_13.dtbo \
75+ overlay_15.dtbo \
76+ overlay_gpio_01.dtbo \
77+ overlay_gpio_02a.dtbo \
78+ overlay_gpio_02b.dtbo \
79+ overlay_gpio_03.dtbo \
80+ overlay_gpio_04a.dtbo \
81+ overlay_gpio_04b.dtbo
82+
83+apply_static_overlay_2 := overlay.dtbo
84+
85+static_test_1-dtbs := static_base_1.dtb $(apply_static_overlay_1)
86+static_test_2-dtbs := static_base_2.dtb $(apply_static_overlay_2)
87+
88+dtb-$(CONFIG_OF_OVERLAY) += static_test_1.dtb static_test_2.dtb
drivers/of/unittest-data/overlay_base.dts+1−89
@@ -2,92 +2,4 @@ · 1 unmodified line
22 /dts-v1/;
33 /plugin/;
44
5−/*
6− * Base device tree that overlays will be applied against.
7− *
8− * Do not add any properties in node "/".
9− * Do not add any nodes other than "/testcase-data-2" in node "/".
10− * Do not add anything that would result in dtc creating node "/__fixups__".
11− * dtc will create nodes "/__symbols__" and "/__local_fixups__".
12− */
13−
14−/ {
15− testcase-data-2 {
16− #address-cells = <1>;
17− #size-cells = <1>;
18−
19− electric_1: substation@100 {
20− compatible = "ot,big-volts-control";
21− reg = < 0x00000100 0x100 >;
22− status = "disabled";
23−
24− hvac_1: hvac-medium-1 {
25− compatible = "ot,hvac-medium";
26− heat-range = < 50 75 >;
27− cool-range = < 60 80 >;
28− };
29−
30− spin_ctrl_1: motor-1 {
31− compatible = "ot,ferris-wheel-motor";
32− spin = "clockwise";
33− rpm_avail = < 50 >;
34− };
35−
36− spin_ctrl_2: motor-8 {
37− compatible = "ot,roller-coaster-motor";
38− };
39− };
40−
41− rides_1: fairway-1 {
42− #address-cells = <1>;
43− #size-cells = <1>;
44− compatible = "ot,rides";
45− status = "disabled";
46− orientation = < 127 >;
47−
48− ride@100 {
49− #address-cells = <1>;
50− #size-cells = <1>;
51− compatible = "ot,roller-coaster";
52− reg = < 0x00000100 0x100 >;
53− hvac-provider = < &hvac_1 >;
54− hvac-thermostat = < 29 > ;
55− hvac-zones = < 14 >;
56− hvac-zone-names = "operator";
57− spin-controller = < &spin_ctrl_2 5 &spin_ctrl_2 7 >;
58− spin-controller-names = "track_1", "track_2";
59− queues = < 2 >;
60−
61− track@30 {
62− reg = < 0x00000030 0x10 >;
63− };
64−
65− track@40 {
66− reg = < 0x00000040 0x10 >;
67− };
68−
69− };
70− };
71−
72− lights_1: lights@30000 {
73− compatible = "ot,work-lights";
74− reg = < 0x00030000 0x1000 >;
75− status = "disabled";
76− };
77−
78− lights_2: lights@40000 {
79− compatible = "ot,show-lights";
80− reg = < 0x00040000 0x1000 >;
81− status = "disabled";
82− rate = < 13 138 >;
83− };
84−
85− retail_1: vending@50000 {
86− reg = < 0x00050000 0x1000 >;
87− compatible = "ot,tickets";
88− status = "disabled";
89− };
90−
91− };
92−};
93−
5+#include "overlay_common.dtsi"
drivers/of/unittest-data/overlay_common.dtsi+91−0
@@ -0,0 +1,91 @@
1+// SPDX-License-Identifier: GPL-2.0
2+
3+/*
4+ * Base device tree that overlays will be applied against.
5+ *
6+ * Do not add any properties in node "/".
7+ * Do not add any nodes other than "/testcase-data-2" in node "/".
8+ * Do not add anything that would result in dtc creating node "/__fixups__".
9+ * dtc will create nodes "/__symbols__" and "/__local_fixups__".
10+ */
11+
12+/ {
13+ testcase-data-2 {
14+ #address-cells = <1>;
15+ #size-cells = <1>;
16+
17+ electric_1: substation@100 {
18+ compatible = "ot,big-volts-control";
19+ reg = < 0x00000100 0x100 >;
20+ status = "disabled";
21+
22+ hvac_1: hvac-medium-1 {
23+ compatible = "ot,hvac-medium";
24+ heat-range = < 50 75 >;
25+ cool-range = < 60 80 >;
26+ };
27+
28+ spin_ctrl_1: motor-1 {
29+ compatible = "ot,ferris-wheel-motor";
30+ spin = "clockwise";
31+ rpm_avail = < 50 >;
32+ };
33+
34+ spin_ctrl_2: motor-8 {
35+ compatible = "ot,roller-coaster-motor";
36+ };
37+ };
38+
39+ rides_1: fairway-1 {
40+ #address-cells = <1>;
41+ #size-cells = <1>;
42+ compatible = "ot,rides";
43+ status = "disabled";
44+ orientation = < 127 >;
45+
46+ ride@100 {
47+ #address-cells = <1>;
48+ #size-cells = <1>;
49+ compatible = "ot,roller-coaster";
50+ reg = < 0x00000100 0x100 >;
51+ hvac-provider = < &hvac_1 >;
52+ hvac-thermostat = < 29 > ;
53+ hvac-zones = < 14 >;
54+ hvac-zone-names = "operator";
55+ spin-controller = < &spin_ctrl_2 5 &spin_ctrl_2 7 >;
56+ spin-controller-names = "track_1", "track_2";
57+ queues = < 2 >;
58+
59+ track@30 {
60+ reg = < 0x00000030 0x10 >;
61+ };
62+
63+ track@40 {
64+ reg = < 0x00000040 0x10 >;
65+ };
66+
67+ };
68+ };
69+
70+ lights_1: lights@30000 {
71+ compatible = "ot,work-lights";
72+ reg = < 0x00030000 0x1000 >;
73+ status = "disabled";
74+ };
75+
76+ lights_2: lights@40000 {
77+ compatible = "ot,show-lights";
78+ reg = < 0x00040000 0x1000 >;
79+ status = "disabled";
80+ rate = < 13 138 >;
81+ };
82+
83+ retail_1: vending@50000 {
84+ reg = < 0x00050000 0x1000 >;
85+ compatible = "ot,tickets";
86+ status = "disabled";
87+ };
88+
89+ };
90+};
91+
drivers/of/unittest-data/static_base_1.dts+4−0
@@ -0,0 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/dts-v1/;
3+
4+#include "testcases_common.dtsi"
drivers/of/unittest-data/static_base_2.dts+4−0
@@ -0,0 +1,4 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/dts-v1/;
3+
4+#include "overlay_common.dtsi"
drivers/of/unittest-data/testcases.dts+12−11
@@ -2,19 +2,20 @@ · 1 unmodified line
22 /dts-v1/;
33 /plugin/;
44
5+#include "testcases_common.dtsi"
6+
57 / {
8+ /*
9+ * testcase data that intentionally results in an error is located here
10+ * instead of in testcases_common.dtsi so that the static overlay apply
11+ * tests will not include the error.
12+ */
613 testcase-data {
7− changeset {
8− prop-update = "hello";
9− prop-remove = "world";
10− node-remove {
11− };
14+ testcase-device2 {
15+ compatible = "testcase-device";
16+ interrupt-parent = <&test_intc2>;
17+ interrupts = <1>; /* invalid specifier - too short */
1218 };
1319 };
20+
1421 };
15−#include "tests-phandle.dtsi"
16−#include "tests-interrupts.dtsi"
17−#include "tests-match.dtsi"
18−#include "tests-address.dtsi"
19−#include "tests-platform.dtsi"
20−#include "tests-overlay.dtsi"
drivers/of/unittest-data/testcases_common.dtsi+19−0
@@ -0,0 +1,19 @@
1+// SPDX-License-Identifier: GPL-2.0
2+
3+/ {
4+ testcase-data {
5+ changeset {
6+ prop-update = "hello";
7+ prop-remove = "world";
8+ node-remove {
9+ };
10+ };
11+ };
12+};
13+
14+#include "tests-phandle.dtsi"
15+#include "tests-interrupts.dtsi"
16+#include "tests-match.dtsi"
17+#include "tests-address.dtsi"
18+#include "tests-platform.dtsi"
19+#include "tests-overlay.dtsi"
drivers/of/unittest-data/tests-interrupts.dtsi+5−6
@@ -62,11 +62,10 @@ · 61 unmodified lines
6262 interrupts = <1>;
6363 };
6464
65− testcase-device2 {
66− compatible = "testcase-device";
67− interrupt-parent = <&test_intc2>;
68− interrupts = <1>; /* invalid specifier - too short */
69− };
65+ /*
66+ * testcase data that intentionally results in an error is
67+ * located in testcases.dts instead of in this file so that the
68+ * static overlay apply tests will not include the error.
69+ */
7070 };
71−
7271 };
include/linux/kexec.h+8−0
@@ -304,7 +304,15 @@ struct kimage { · 303 unmodified lines
304304 #ifdef CONFIG_IMA_KEXEC
305305 /* Virtual address of IMA measurement buffer for kexec syscall */
306306 void *ima_buffer;
307+
308+ phys_addr_t ima_buffer_addr;
309+ size_t ima_buffer_size;
307310 #endif
311+
312+ /* Core ELF header buffer */
313+ void *elf_headers;
314+ unsigned long elf_headers_sz;
315+ unsigned long elf_load_addr;
308316 };
309317
310318 /* kexec interface functions */
include/linux/of.h+50−24
@@ -424,12 +424,14 @@ extern int of_detach_node(struct device_node *); · 423 unmodified lines
424424 * @sz: number of array elements to read
425425 *
426426 * Search for a property in a device node and read 8-bit value(s) from
427− * it. Returns 0 on success, -EINVAL if the property does not exist,
428− * -ENODATA if property does not have a value, and -EOVERFLOW if the
429− * property data isn't large enough.
427+ * it.
430428 *
431429 * dts entry of array should be like:
432− * property = /bits/ 8 <0x50 0x60 0x70>;
430+ * ``property = /bits/ 8 <0x50 0x60 0x70>;``
431+ *
432+ * Return: 0 on success, -EINVAL if the property does not exist,
433+ * -ENODATA if property does not have a value, and -EOVERFLOW if the
434+ * property data isn't large enough.
433435 *
434436 * The out_values is modified only if a valid u8 value can be decoded.
435437 */
@@ -454,12 +456,14 @@ static inline int of_property_read_u8_array(const struct device_node *np, · 18 unmodified lines
454456 * @sz: number of array elements to read
455457 *
456458 * Search for a property in a device node and read 16-bit value(s) from
457− * it. Returns 0 on success, -EINVAL if the property does not exist,
458− * -ENODATA if property does not have a value, and -EOVERFLOW if the
459− * property data isn't large enough.
459+ * it.
460460 *
461461 * dts entry of array should be like:
462− * property = /bits/ 16 <0x5000 0x6000 0x7000>;
462+ * ``property = /bits/ 16 <0x5000 0x6000 0x7000>;``
463+ *
464+ * Return: 0 on success, -EINVAL if the property does not exist,
465+ * -ENODATA if property does not have a value, and -EOVERFLOW if the
466+ * property data isn't large enough.
463467 *
464468 * The out_values is modified only if a valid u16 value can be decoded.
465469 */
@@ -485,7 +489,9 @@ static inline int of_property_read_u16_array(const struct device_node *np, · 19 unmodified lines
485489 * @sz: number of array elements to read
486490 *
487491 * Search for a property in a device node and read 32-bit value(s) from
488− * it. Returns 0 on success, -EINVAL if the property does not exist,
492+ * it.
493+ *
494+ * Return: 0 on success, -EINVAL if the property does not exist,
489495 * -ENODATA if property does not have a value, and -EOVERFLOW if the
490496 * property data isn't large enough.
491497 *
@@ -513,7 +519,9 @@ static inline int of_property_read_u32_array(const struct device_node *np, · 21 unmodified lines
513519 * @sz: number of array elements to read
514520 *
515521 * Search for a property in a device node and read 64-bit value(s) from
516− * it. Returns 0 on success, -EINVAL if the property does not exist,
522+ * it.
523+ *
524+ * Return: 0 on success, -EINVAL if the property does not exist,
517525 * -ENODATA if property does not have a value, and -EOVERFLOW if the
518526 * property data isn't large enough.
519527 *
@@ -560,6 +568,13 @@ int of_map_id(struct device_node *np, u32 id, · 40 unmodified lines
560568
561569 phys_addr_t of_dma_get_max_cpu_address(struct device_node *np);
562570
571+struct kimage;
572+void *of_kexec_alloc_and_setup_fdt(const struct kimage *image,
573+ unsigned long initrd_load_addr,
574+ unsigned long initrd_len,
575+ const char *cmdline, size_t extra_fdt_size);
576+int ima_get_kexec_buffer(void **addr, size_t *size);
577+int ima_free_kexec_buffer(void);
563578 #else /* CONFIG_OF */
564579
565580 static inline void of_core_init(void)
@@ -1063,7 +1078,9 @@ static inline bool of_node_is_type(const struct device_node *np, const char *typ · 497 unmodified lines
10631078 * @propname: name of the property to be searched.
10641079 *
10651080 * Search for a property in a device node and count the number of u8 elements
1066− * in it. Returns number of elements on sucess, -EINVAL if the property does
1081+ * in it.
1082+ *
1083+ * Return: The number of elements on sucess, -EINVAL if the property does
10671084 * not exist or its length does not match a multiple of u8 and -ENODATA if the
10681085 * property does not have a value.
10691086 */
@@ -1080,7 +1097,9 @@ static inline int of_property_count_u8_elems(const struct device_node *np, · 10 unmodified lines
10801097 * @propname: name of the property to be searched.
10811098 *
10821099 * Search for a property in a device node and count the number of u16 elements
1083− * in it. Returns number of elements on sucess, -EINVAL if the property does
1100+ * in it.
1101+ *
1102+ * Return: The number of elements on sucess, -EINVAL if the property does
10841103 * not exist or its length does not match a multiple of u16 and -ENODATA if the
10851104 * property does not have a value.
10861105 */
@@ -1097,7 +1116,9 @@ static inline int of_property_count_u16_elems(const struct device_node *np, · 10 unmodified lines
10971116 * @propname: name of the property to be searched.
10981117 *
10991118 * Search for a property in a device node and count the number of u32 elements
1100− * in it. Returns number of elements on sucess, -EINVAL if the property does
1119+ * in it.
1120+ *
1121+ * Return: The number of elements on sucess, -EINVAL if the property does
11011122 * not exist or its length does not match a multiple of u32 and -ENODATA if the
11021123 * property does not have a value.
11031124 */
@@ -1114,7 +1135,9 @@ static inline int of_property_count_u32_elems(const struct device_node *np, · 10 unmodified lines
11141135 * @propname: name of the property to be searched.
11151136 *
11161137 * Search for a property in a device node and count the number of u64 elements
1117− * in it. Returns number of elements on sucess, -EINVAL if the property does
1138+ * in it.
1139+ *
1140+ * Return: The number of elements on sucess, -EINVAL if the property does
11181141 * not exist or its length does not match a multiple of u64 and -ENODATA if the
11191142 * property does not have a value.
11201143 */
@@ -1135,7 +1158,7 @@ static inline int of_property_count_u64_elems(const struct device_node *np, · 14 unmodified lines
11351158 * Search for a property in a device tree node and retrieve a list of
11361159 * terminated string values (pointer to data, not a copy) in that property.
11371160 *
1138− * If @out_strs is NULL, the number of strings in the property is returned.
1161+ * Return: If @out_strs is NULL, the number of strings in the property is returned.
11391162 */
11401163 static inline int of_property_read_string_array(const struct device_node *np,
11411164 const char *propname, const char **out_strs,
@@ -1151,10 +1174,11 @@ static inline int of_property_read_string_array(const struct device_node *np, · 9 unmodified lines
11511174 * @propname: name of the property to be searched.
11521175 *
11531176 * Search for a property in a device tree node and retrieve the number of null
1154− * terminated string contain in it. Returns the number of strings on
1155− * success, -EINVAL if the property does not exist, -ENODATA if property
1156− * does not have a value, and -EILSEQ if the string is not null-terminated
1157− * within the length of the property data.
1177+ * terminated string contain in it.
1178+ *
1179+ * Return: The number of strings on success, -EINVAL if the property does not
1180+ * exist, -ENODATA if property does not have a value, and -EILSEQ if the string
1181+ * is not null-terminated within the length of the property data.
11581182 */
11591183 static inline int of_property_count_strings(const struct device_node *np,
11601184 const char *propname)
@@ -1168,13 +1192,14 @@ static inline int of_property_count_strings(const struct device_node *np, · 7 unmodified lines
11681192 * @np: device node from which the property value is to be read.
11691193 * @propname: name of the property to be searched.
11701194 * @index: index of the string in the list of strings
1171− * @out_string: pointer to null terminated return string, modified only if
1195+ * @output: pointer to null terminated return string, modified only if
11721196 * return value is 0.
11731197 *
11741198 * Search for a property in a device tree node and retrieve a null
11751199 * terminated string value (pointer to data, not a copy) in the list of strings
11761200 * contained in that property.
1177− * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
1201+ *
1202+ * Return: 0 on success, -EINVAL if the property does not exist, -ENODATA if
11781203 * property does not have a value, and -EILSEQ if the string is not
11791204 * null-terminated within the length of the property data.
11801205 *
@@ -1194,7 +1219,8 @@ static inline int of_property_read_string_index(const struct device_node *np, · 13 unmodified lines
11941219 * @propname: name of the property to be searched.
11951220 *
11961221 * Search for a property in a device node.
1197− * Returns true if the property exists false otherwise.
1222+ *
1223+ * Return: true if the property exists false otherwise.
11981224 */
11991225 static inline bool of_property_read_bool(const struct device_node *np,
12001226 const char *propname)
@@ -1440,14 +1466,14 @@ static inline int of_reconfig_get_state_change(unsigned long action, · 239 unmodified lines
14401466 * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node
14411467 * @np: Pointer to the given device_node
14421468 *
1443− * return true if present false otherwise
1469+ * Return: true if present false otherwise
14441470 */
14451471 static inline bool of_device_is_system_power_controller(const struct device_node *np)
14461472 {
14471473 return of_property_read_bool(np, "system-power-controller");
14481474 }
14491475
1450−/**
1476+/*
14511477 * Overlay support
14521478 */
14531479
scripts/Makefile.lib+28−6
@@ -73,14 +73,26 @@ always-y += $(userprogs-always-y) $(userprogs-always-m) · 72 unmodified lines
7373
7474 # DTB
7575 # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
76+dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-)
77+
78+# List all dtbs to be generated by fdtoverlay
79+overlay-y := $(foreach m,$(dtb-y), $(if $(strip $($(m:.dtb=-dtbs))),$(m),))
80+
81+# Generate symbols for the base files so overlays can be applied to them.
82+$(foreach m,$(overlay-y), $(eval DTC_FLAGS_$(basename $(firstword $($(m:.dtb=-dtbs)))) += -@))
83+
84+# Add base dtb and overlay dtbo
85+dtb-y += $(foreach m,$(overlay-y), $($(m:.dtb=-dtbs)))
86+
7687 always-y += $(dtb-y)
77−always-$(CONFIG_OF_ALL_DTBS) += $(dtb-)
7888
7989 ifneq ($(CHECK_DTBS),)
80−always-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
81−always-y += $(patsubst %.dtbo,%.dt.yaml, $(dtb-y))
82−always-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
83−always-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtbo,%.dt.yaml, $(dtb-))
90+# Don't run schema checks for dtbs created by fdtoverlay as they don't
91+# have corresponding dts files.
92+dt-yaml-y := $(filter-out $(overlay-y),$(dtb-y))
93+
94+always-y += $(patsubst %.dtb,%.dt.yaml, $(dt-yaml-y))
95+always-y += $(patsubst %.dtbo,%.dt.yaml, $(dt-yaml-y))
8496 endif
8597
8698 # Add subdir path
@@ -338,13 +350,23 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE · 251 unmodified lines
338350 $(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
339351 $(call if_changed_dep,dtc)
340352
353+overlay-y := $(addprefix $(obj)/, $(overlay-y))
354+
355+quiet_cmd_fdtoverlay = DTOVL $@
356+ cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
357+
358+$(overlay-y): FORCE
359+ $(call if_changed,fdtoverlay)
360+$(call multi_depend, $(overlay-y), .dtb, -dtbs)
361+
341362 DT_CHECKER ?= dt-validate
363+DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),,-m)
342364 DT_BINDING_DIR := Documentation/devicetree/bindings
343365 # DT_TMP_SCHEMA may be overridden from Documentation/devicetree/bindings/Makefile
344366 DT_TMP_SCHEMA ?= $(objtree)/$(DT_BINDING_DIR)/processed-schema.json
345367
346368 quiet_cmd_dtb_check = CHECK $@
347− cmd_dtb_check = $(DT_CHECKER) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@
369+ cmd_dtb_check = $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@
348370
349371 define rule_dtc
350372 $(call cmd_and_fixdep,dtc)
scripts/checkpatch.pl+1−1
@@ -3245,7 +3245,7 @@ sub process { · 3244 unmodified lines
32453245 ($line =~ /^new file mode\s*\d+\s*$/) &&
32463246 ($realfile =~ m@^Documentation/devicetree/bindings/.*\.txt$@)) {
32473247 WARN("DT_SCHEMA_BINDING_PATCH",
3248− "DT bindings should be in DT schema format. See: Documentation/devicetree/writing-schema.rst\n");
3248+ "DT bindings should be in DT schema format. See: Documentation/devicetree/bindings/writing-schema.rst\n");
32493249 }
32503250
32513251 # Check for wrappage within a valid hunk of the file
security/integrity/ima/ima.h+0−4
@@ -24,10 +24,6 @@ · 23 unmodified lines
2424
2525 #include "../integrity.h"
2626
27−#ifdef CONFIG_HAVE_IMA_KEXEC
28−#include <asm/ima.h>
29−#endif
30−
3127 enum ima_show_type { IMA_SHOW_BINARY, IMA_SHOW_BINARY_NO_FIELD_LEN,
3228 IMA_SHOW_BINARY_OLD_STRING_FMT, IMA_SHOW_ASCII };
3329 enum tpm_pcrs { TPM_PCR0 = 0, TPM_PCR8 = 8, TPM_PCR10 = 10 };
security/integrity/ima/ima_kexec.c+3−6
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include <linux/seq_file.h>
1111 #include <linux/vmalloc.h>
1212 #include <linux/kexec.h>
13+#include <linux/of.h>
1314 #include "ima.h"
1415
1516 #ifdef CONFIG_IMA_KEXEC
@@ -123,12 +124,8 @@ void ima_add_kexec_buffer(struct kimage *image) · 107 unmodified lines
123124 return;
124125 }
125126
126− ret = arch_ima_add_kexec_buffer(image, kbuf.mem, kexec_segment_size);
127− if (ret) {
128− pr_err("Error passing over kexec measurement buffer.\n");
129− return;
130− }
131−
127+ image->ima_buffer_addr = kbuf.mem;
128+ image->ima_buffer_size = kexec_segment_size;
132129 image->ima_buffer = kexec_buffer;
133130
134131 pr_debug("kexec measurement buffer for the loaded kernel at 0x%lx.\n",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t