History

Merge tag 'soc-fixes-5.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull ARM SoC fixes from Arnd Bergmann: "Lots of small fixes for Arm SoCs this time, nothing too worrying: - omap/beaglebone boot regression fix in gpt12 timer - revert for i.mx8 soc driver breaking as a platform_driver - kexec/kdump fixes for op-tee - various fixes for incorrect DT settings on imx, mvebu, omap, stm32, and tegra causing problems. - device tree fixes for static checks in nomadik, versatile, stm32 - code fixes for issues found in build testing and with static checking on tegra, ixp4xx, imx, omap" * tag 'soc-fixes-5.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (36 commits) soc: ixp4xx/qmgr: fix invalid __iomem access soc: ixp4xx: fix printing resources ARM: ixp4xx: goramo_mlr depends on old PCI driver ARM: ixp4xx: fix compile-testing soc drivers soc/tegra: Make regulator couplers depend on CONFIG_REGULATOR ARM: dts: nomadik: Fix up interrupt controller node names ARM: dts: stm32: Fix touchscreen IRQ line assignment on DHCOM ARM: dts: stm32: Disable LAN8710 EDPD on DHCOM ARM: dts: stm32: Prefer HW RTC on DHCOM SoM omap5-board-common: remove not physically existing vdds_1v8_main fixed-regulator ARM: dts: am437x-l4: fix typo in can@0 node ARM: dts: am43x-epos-evm: Reduce i2c0 bus speed for tps65218 bus: ti-sysc: AM3: RNG is GP only ARM: omap2+: hwmod: fix potential NULL pointer access arm64: dts: armada-3720-turris-mox: remove mrvl,i2c-fast-mode arm64: dts: armada-3720-turris-mox: fixed indices for the SDHC controllers ARM: dts: imx: Swap M53Menlo pinctrl_power_button/pinctrl_power_out pins ARM: imx: fix missing 3rd argument in macro imx_mmdc_perf_init ARM: dts: colibri-imx6ull: limit SDIO clock to 25MHz arm64: dts: ls1028: sl28: fix networking for variant 2 ...

Linus Torvalds committed 5 years ago

Commit 3dc064d2 parents 73f2553 19c1eb332 files · +292 −151Browse files

Unified · Split

32 files
  1. arch/arm/boot/dts/am437x-l4.dtsi +1 −1
  2. arch/arm/boot/dts/am43x-epos-evm.dts +1 −1
  3. arch/arm/boot/dts/imx53-m53menlo.dts +2 −2
  4. arch/arm/boot/dts/imx6qdl-sr-som.dtsi +7 −1
  5. arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi +1 −0
  6. arch/arm/boot/dts/omap5-board-common.dtsi +1 −8
  7. arch/arm/boot/dts/ste-nomadik-stn8815.dtsi +2 −2
  8. arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi +14 −10
  9. arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +4 −1
  10. arch/arm/mach-imx/common.h +1 −1
  11. arch/arm/mach-imx/mmdc.c +14 −3
  12. arch/arm/mach-ixp4xx/Kconfig +1 −0
  13. arch/arm/mach-omap2/omap_hwmod.c +9 −1
  14. arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var2.dts +2 −0
  15. arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +1 −1
  16. arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts +3 −0
  17. arch/arm64/boot/dts/nvidia/tegra194.dtsi +54 −6
  18. drivers/bus/ti-sysc.c +15 −7
  19. drivers/char/tpm/tpm_ftpm_tee.c +4 −4
  20. drivers/firmware/broadcom/tee_bnxt_fw.c +11 −3
  21. drivers/soc/Makefile +1 −1
  22. drivers/soc/imx/soc-imx8m.c +12 −72
  23. drivers/soc/ixp4xx/ixp4xx-npe.c +5 −7
  24. drivers/soc/ixp4xx/ixp4xx-qmgr.c +5 −5
  25. drivers/soc/tegra/Kconfig +4 −2
  26. drivers/tee/optee/call.c +34 −4
  27. drivers/tee/optee/core.c +42 −1
  28. drivers/tee/optee/optee_private.h +1 −0
  29. drivers/tee/optee/rpc.c +3 −2
  30. drivers/tee/optee/shm_pool.c +16 −4
  31. drivers/tee/tee_shm.c +19 −1
  32. include/linux/tee_drv.h +2 −0
arch/arm/boot/dts/am437x-l4.dtsi+1−1
@@ -1595,7 +1595,7 @@ · 1594 unmodified lines
15951595 compatible = "ti,am4372-d_can", "ti,am3352-d_can";
15961596 reg = <0x0 0x2000>;
15971597 clocks = <&dcan1_fck>;
1598− clock-name = "fck";
1598+ clock-names = "fck";
15991599 syscon-raminit = <&scm_conf 0x644 1>;
16001600 interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
16011601 status = "disabled";
arch/arm/boot/dts/am43x-epos-evm.dts+1−1
@@ -582,7 +582,7 @@ · 581 unmodified lines
582582 status = "okay";
583583 pinctrl-names = "default";
584584 pinctrl-0 = <&i2c0_pins>;
585− clock-frequency = <400000>;
585+ clock-frequency = <100000>;
586586
587587 tps65218: tps65218@24 {
588588 reg = <0x24>;
arch/arm/boot/dts/imx53-m53menlo.dts+2−2
@@ -388,13 +388,13 @@ · 387 unmodified lines
388388
389389 pinctrl_power_button: powerbutgrp {
390390 fsl,pins = <
391− MX53_PAD_SD2_DATA2__GPIO1_13 0x1e4
391+ MX53_PAD_SD2_DATA0__GPIO1_15 0x1e4
392392 >;
393393 };
394394
395395 pinctrl_power_out: poweroutgrp {
396396 fsl,pins = <
397− MX53_PAD_SD2_DATA0__GPIO1_15 0x1e4
397+ MX53_PAD_SD2_DATA2__GPIO1_13 0x1e4
398398 >;
399399 };
400400
arch/arm/boot/dts/imx6qdl-sr-som.dtsi+7−1
@@ -54,7 +54,13 @@ · 53 unmodified lines
5454 pinctrl-names = "default";
5555 pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
5656 phy-mode = "rgmii-id";
57− phy-reset-duration = <2>;
57+
58+ /*
59+ * The PHY seems to require a long-enough reset duration to avoid
60+ * some rare issues where the PHY gets stuck in an inconsistent and
61+ * non-functional state at boot-up. 10ms proved to be fine .
62+ */
63+ phy-reset-duration = <10>;
5864 phy-reset-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
5965 status = "okay";
6066
arch/arm/boot/dts/imx6ull-colibri-wifi.dtsi+1−0
@@ -43,6 +43,7 @@ · 42 unmodified lines
4343 assigned-clock-rates = <0>, <198000000>;
4444 cap-power-off-card;
4545 keep-power-in-suspend;
46+ max-frequency = <25000000>;
4647 mmc-pwrseq = <&wifi_pwrseq>;
4748 no-1-8-v;
4849 non-removable;
arch/arm/boot/dts/omap5-board-common.dtsi+1−8
@@ -30,14 +30,6 @@ · 29 unmodified lines
3030 regulator-max-microvolt = <5000000>;
3131 };
3232
33− vdds_1v8_main: fixedregulator-vdds_1v8_main {
34− compatible = "regulator-fixed";
35− regulator-name = "vdds_1v8_main";
36− vin-supply = <&smps7_reg>;
37− regulator-min-microvolt = <1800000>;
38− regulator-max-microvolt = <1800000>;
39− };
40−
4133 vmmcsd_fixed: fixedregulator-mmcsd {
4234 compatible = "regulator-fixed";
4335 regulator-name = "vmmcsd_fixed";
@@ -487,6 +479,7 @@ · 443 unmodified lines
487479 regulator-boot-on;
488480 };
489481
482+ vdds_1v8_main:
490483 smps7_reg: smps7 {
491484 /* VDDS_1v8_OMAP over VDDS_1v8_MAIN */
492485 regulator-name = "smps7";
arch/arm/boot/dts/ste-nomadik-stn8815.dtsi+2−2
@@ -755,14 +755,14 @@ · 754 unmodified lines
755755 status = "disabled";
756756 };
757757
758− vica: intc@10140000 {
758+ vica: interrupt-controller@10140000 {
759759 compatible = "arm,versatile-vic";
760760 interrupt-controller;
761761 #interrupt-cells = <1>;
762762 reg = <0x10140000 0x20>;
763763 };
764764
765− vicb: intc@10140020 {
765+ vicb: interrupt-controller@10140020 {
766766 compatible = "arm,versatile-vic";
767767 interrupt-controller;
768768 #interrupt-cells = <1>;
arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi+14−10
@@ -37,7 +37,7 @@ · 36 unmodified lines
3737 poll-interval = <20>;
3838
3939 /*
40− * The EXTi IRQ line 3 is shared with touchscreen and ethernet,
40+ * The EXTi IRQ line 3 is shared with ethernet,
4141 * so mark this as polled GPIO key.
4242 */
4343 button-0 {
@@ -46,6 +46,16 @@ · 2 unmodified lines
4646 gpios = <&gpiof 3 GPIO_ACTIVE_LOW>;
4747 };
4848
49+ /*
50+ * The EXTi IRQ line 6 is shared with touchscreen,
51+ * so mark this as polled GPIO key.
52+ */
53+ button-1 {
54+ label = "TA2-GPIO-B";
55+ linux,code = <KEY_B>;
56+ gpios = <&gpiod 6 GPIO_ACTIVE_LOW>;
57+ };
58+
4959 /*
5060 * The EXTi IRQ line 0 is shared with PMIC,
5161 * so mark this as polled GPIO key.
@@ -60,13 +70,6 @@ · 8 unmodified lines
6070 gpio-keys {
6171 compatible = "gpio-keys";
6272
63− button-1 {
64− label = "TA2-GPIO-B";
65− linux,code = <KEY_B>;
66− gpios = <&gpiod 6 GPIO_ACTIVE_LOW>;
67− wakeup-source;
68− };
69−
7073 button-3 {
7174 label = "TA4-GPIO-D";
7275 linux,code = <KEY_D>;
@@ -82,6 +85,7 @@ · 9 unmodified lines
8285 label = "green:led5";
8386 gpios = <&gpioc 6 GPIO_ACTIVE_HIGH>;
8487 default-state = "off";
88+ status = "disabled";
8589 };
8690
8791 led-1 {
@@ -185,8 +189,8 @@ · 97 unmodified lines
185189 touchscreen@38 {
186190 compatible = "edt,edt-ft5406";
187191 reg = <0x38>;
188− interrupt-parent = <&gpiog>;
189− interrupts = <2 IRQ_TYPE_EDGE_FALLING>; /* GPIO E */
192+ interrupt-parent = <&gpioc>;
193+ interrupts = <6 IRQ_TYPE_EDGE_FALLING>; /* GPIO E */
190194 };
191195 };
192196
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi+4−1
@@ -12,6 +12,8 @@ · 11 unmodified lines
1212 aliases {
1313 ethernet0 = &ethernet0;
1414 ethernet1 = &ksz8851;
15+ rtc0 = &hwrtc;
16+ rtc1 = &rtc;
1517 };
1618
1719 memory@c0000000 {
@@ -138,6 +140,7 @@ · 120 unmodified lines
138140 reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>;
139141 reset-assert-us = <500>;
140142 reset-deassert-us = <500>;
143+ smsc,disable-energy-detect;
141144 interrupt-parent = <&gpioi>;
142145 interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
143146 };
@@ -248,7 +251,7 @@ · 104 unmodified lines
248251 /delete-property/dmas;
249252 /delete-property/dma-names;
250253
251− rtc@32 {
254+ hwrtc: rtc@32 {
252255 compatible = "microcrystal,rv8803";
253256 reg = <0x32>;
254257 };
arch/arm/mach-imx/common.h+1−1
@@ -68,7 +68,6 @@ void imx_set_cpu_arg(int cpu, u32 arg); · 67 unmodified lines
6868 void v7_secondary_startup(void);
6969 void imx_scu_map_io(void);
7070 void imx_smp_prepare(void);
71−void imx_gpcv2_set_core1_pdn_pup_by_software(bool pdn);
7271 #else
7372 static inline void imx_scu_map_io(void) {}
7473 static inline void imx_smp_prepare(void) {}
@@ -81,6 +80,7 @@ void imx_gpc_mask_all(void); · 6 unmodified lines
8180 void imx_gpc_restore_all(void);
8281 void imx_gpc_hwirq_mask(unsigned int hwirq);
8382 void imx_gpc_hwirq_unmask(unsigned int hwirq);
83+void imx_gpcv2_set_core1_pdn_pup_by_software(bool pdn);
8484 void imx_anatop_init(void);
8585 void imx_anatop_pre_suspend(void);
8686 void imx_anatop_post_resume(void);
arch/arm/mach-imx/mmdc.c+14−3
@@ -103,6 +103,7 @@ struct mmdc_pmu { · 102 unmodified lines
103103 struct perf_event *mmdc_events[MMDC_NUM_COUNTERS];
104104 struct hlist_node node;
105105 struct fsl_mmdc_devtype_data *devtype_data;
106+ struct clk *mmdc_ipg_clk;
106107 };
107108
108109 /*
@@ -462,11 +463,14 @@ static int imx_mmdc_remove(struct platform_device *pdev) · 353 unmodified lines
462463
463464 cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
464465 perf_pmu_unregister(&pmu_mmdc->pmu);
466+ iounmap(pmu_mmdc->mmdc_base);
467+ clk_disable_unprepare(pmu_mmdc->mmdc_ipg_clk);
465468 kfree(pmu_mmdc);
466469 return 0;
467470 }
468471
469−static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base)
472+static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base,
473+ struct clk *mmdc_ipg_clk)
470474 {
471475 struct mmdc_pmu *pmu_mmdc;
472476 char *name;
@@ -494,6 +498,7 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b · 21 unmodified lines
494498 }
495499
496500 mmdc_num = mmdc_pmu_init(pmu_mmdc, mmdc_base, &pdev->dev);
501+ pmu_mmdc->mmdc_ipg_clk = mmdc_ipg_clk;
497502 if (mmdc_num == 0)
498503 name = "mmdc";
499504 else
@@ -529,7 +534,7 @@ pmu_free: · 29 unmodified lines
529534
530535 #else
531536 #define imx_mmdc_remove NULL
532−#define imx_mmdc_perf_init(pdev, mmdc_base) 0
537+#define imx_mmdc_perf_init(pdev, mmdc_base, mmdc_ipg_clk) 0
533538 #endif
534539
535540 static int imx_mmdc_probe(struct platform_device *pdev)
@@ -567,7 +572,13 @@ static int imx_mmdc_probe(struct platform_device *pdev) · 31 unmodified lines
567572 val &= ~(1 << BP_MMDC_MAPSR_PSD);
568573 writel_relaxed(val, reg);
569574
570− return imx_mmdc_perf_init(pdev, mmdc_base);
575+ err = imx_mmdc_perf_init(pdev, mmdc_base, mmdc_ipg_clk);
576+ if (err) {
577+ iounmap(mmdc_base);
578+ clk_disable_unprepare(mmdc_ipg_clk);
579+ }
580+
581+ return err;
571582 }
572583
573584 int imx_mmdc_get_ddr_type(void)
arch/arm/mach-ixp4xx/Kconfig+1−0
@@ -91,6 +91,7 @@ config MACH_IXDP465 · 90 unmodified lines
9191
9292 config MACH_GORAMO_MLR
9393 bool "GORAMO Multi Link Router"
94+ depends on IXP4XX_PCI_LEGACY
9495 help
9596 Say 'Y' here if you want your kernel to support GORAMO
9697 MultiLink router.
arch/arm/mach-omap2/omap_hwmod.c+9−1
@@ -3776,6 +3776,7 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) · 3775 unmodified lines
37763776 struct omap_hwmod_ocp_if *oi;
37773777 struct clockdomain *clkdm;
37783778 struct clk_hw_omap *clk;
3779+ struct clk_hw *hw;
37793780
37803781 if (!oh)
37813782 return NULL;
@@ -3792,7 +3793,14 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) · 10 unmodified lines
37923793 c = oi->_clk;
37933794 }
37943795
3795− clk = to_clk_hw_omap(__clk_get_hw(c));
3796+ hw = __clk_get_hw(c);
3797+ if (!hw)
3798+ return NULL;
3799+
3800+ clk = to_clk_hw_omap(hw);
3801+ if (!clk)
3802+ return NULL;
3803+
37963804 clkdm = clk->clkdm;
37973805 if (!clkdm)
37983806 return NULL;
arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var2.dts+2−0
@@ -54,6 +54,7 @@ · 53 unmodified lines
5454
5555 &mscc_felix_port0 {
5656 label = "swp0";
57+ managed = "in-band-status";
5758 phy-handle = <&phy0>;
5859 phy-mode = "sgmii";
5960 status = "okay";
@@ -61,6 +62,7 @@ · 1 unmodified line
6162
6263 &mscc_felix_port1 {
6364 label = "swp1";
65+ managed = "in-band-status";
6466 phy-handle = <&phy1>;
6567 phy-mode = "sgmii";
6668 status = "okay";
arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi+1−1
@@ -66,7 +66,7 @@ · 65 unmodified lines
6666 };
6767 };
6868
69− sysclk: clock-sysclk {
69+ sysclk: sysclk {
7070 compatible = "fixed-clock";
7171 #clock-cells = <0>;
7272 clock-frequency = <100000000>;
arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts+3−0
@@ -19,6 +19,8 @@ · 18 unmodified lines
1919 aliases {
2020 spi0 = &spi0;
2121 ethernet1 = &eth1;
22+ mmc0 = &sdhci0;
23+ mmc1 = &sdhci1;
2224 };
2325
2426 chosen {
@@ -119,6 +121,7 @@ · 94 unmodified lines
119121 pinctrl-names = "default";
120122 pinctrl-0 = <&i2c1_pins>;
121123 clock-frequency = <100000>;
124+ /delete-property/ mrvl,i2c-fast-mode;
122125 status = "okay";
123126
124127 rtc@6f {
arch/arm64/boot/dts/nvidia/tegra194.dtsi+54−6
@@ -1840,7 +1840,11 @@ · 1839 unmodified lines
18401840
18411841 interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE1R &emc>,
18421842 <&mc TEGRA194_MEMORY_CLIENT_PCIE1W &emc>;
1843− interconnect-names = "read", "write";
1843+ interconnect-names = "dma-mem", "write";
1844+ iommus = <&smmu TEGRA194_SID_PCIE1>;
1845+ iommu-map = <0x0 &smmu TEGRA194_SID_PCIE1 0x1000>;
1846+ iommu-map-mask = <0x0>;
1847+ dma-coherent;
18441848 };
18451849
18461850 pcie@14120000 {
@@ -1890,7 +1894,11 @@ · 43 unmodified lines
18901894
18911895 interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE2AR &emc>,
18921896 <&mc TEGRA194_MEMORY_CLIENT_PCIE2AW &emc>;
1893− interconnect-names = "read", "write";
1897+ interconnect-names = "dma-mem", "write";
1898+ iommus = <&smmu TEGRA194_SID_PCIE2>;
1899+ iommu-map = <0x0 &smmu TEGRA194_SID_PCIE2 0x1000>;
1900+ iommu-map-mask = <0x0>;
1901+ dma-coherent;
18941902 };
18951903
18961904 pcie@14140000 {
@@ -1940,7 +1948,11 @@ · 43 unmodified lines
19401948
19411949 interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE3R &emc>,
19421950 <&mc TEGRA194_MEMORY_CLIENT_PCIE3W &emc>;
1943− interconnect-names = "read", "write";
1951+ interconnect-names = "dma-mem", "write";
1952+ iommus = <&smmu TEGRA194_SID_PCIE3>;
1953+ iommu-map = <0x0 &smmu TEGRA194_SID_PCIE3 0x1000>;
1954+ iommu-map-mask = <0x0>;
1955+ dma-coherent;
19441956 };
19451957
19461958 pcie@14160000 {
@@ -1990,7 +2002,11 @@ · 43 unmodified lines
19902002
19912003 interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE4R &emc>,
19922004 <&mc TEGRA194_MEMORY_CLIENT_PCIE4W &emc>;
1993− interconnect-names = "read", "write";
2005+ interconnect-names = "dma-mem", "write";
2006+ iommus = <&smmu TEGRA194_SID_PCIE4>;
2007+ iommu-map = <0x0 &smmu TEGRA194_SID_PCIE4 0x1000>;
2008+ iommu-map-mask = <0x0>;
2009+ dma-coherent;
19942010 };
19952011
19962012 pcie@14180000 {
@@ -2040,7 +2056,11 @@ · 43 unmodified lines
20402056
20412057 interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE0R &emc>,
20422058 <&mc TEGRA194_MEMORY_CLIENT_PCIE0W &emc>;
2043− interconnect-names = "read", "write";
2059+ interconnect-names = "dma-mem", "write";
2060+ iommus = <&smmu TEGRA194_SID_PCIE0>;
2061+ iommu-map = <0x0 &smmu TEGRA194_SID_PCIE0 0x1000>;
2062+ iommu-map-mask = <0x0>;
2063+ dma-coherent;
20442064 };
20452065
20462066 pcie@141a0000 {
@@ -2094,7 +2114,11 @@ · 47 unmodified lines
20942114
20952115 interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE5R &emc>,
20962116 <&mc TEGRA194_MEMORY_CLIENT_PCIE5W &emc>;
2097− interconnect-names = "read", "write";
2117+ interconnect-names = "dma-mem", "write";
2118+ iommus = <&smmu TEGRA194_SID_PCIE5>;
2119+ iommu-map = <0x0 &smmu TEGRA194_SID_PCIE5 0x1000>;
2120+ iommu-map-mask = <0x0>;
2121+ dma-coherent;
20982122 };
20992123
21002124 pcie_ep@14160000 {
@@ -2127,6 +2151,14 @@ · 26 unmodified lines
21272151 nvidia,aspm-cmrt-us = <60>;
21282152 nvidia,aspm-pwr-on-t-us = <20>;
21292153 nvidia,aspm-l0s-entrance-latency-us = <3>;
2154+
2155+ interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE4R &emc>,
2156+ <&mc TEGRA194_MEMORY_CLIENT_PCIE4W &emc>;
2157+ interconnect-names = "dma-mem", "write";
2158+ iommus = <&smmu TEGRA194_SID_PCIE4>;
2159+ iommu-map = <0x0 &smmu TEGRA194_SID_PCIE4 0x1000>;
2160+ iommu-map-mask = <0x0>;
2161+ dma-coherent;
21302162 };
21312163
21322164 pcie_ep@14180000 {
@@ -2159,6 +2191,14 @@ · 26 unmodified lines
21592191 nvidia,aspm-cmrt-us = <60>;
21602192 nvidia,aspm-pwr-on-t-us = <20>;
21612193 nvidia,aspm-l0s-entrance-latency-us = <3>;
2194+
2195+ interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE0R &emc>,
2196+ <&mc TEGRA194_MEMORY_CLIENT_PCIE0W &emc>;
2197+ interconnect-names = "dma-mem", "write";
2198+ iommus = <&smmu TEGRA194_SID_PCIE0>;
2199+ iommu-map = <0x0 &smmu TEGRA194_SID_PCIE0 0x1000>;
2200+ iommu-map-mask = <0x0>;
2201+ dma-coherent;
21622202 };
21632203
21642204 pcie_ep@141a0000 {
@@ -2194,6 +2234,14 @@ · 29 unmodified lines
21942234 nvidia,aspm-cmrt-us = <60>;
21952235 nvidia,aspm-pwr-on-t-us = <20>;
21962236 nvidia,aspm-l0s-entrance-latency-us = <3>;
2237+
2238+ interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE5R &emc>,
2239+ <&mc TEGRA194_MEMORY_CLIENT_PCIE5W &emc>;
2240+ interconnect-names = "dma-mem", "write";
2241+ iommus = <&smmu TEGRA194_SID_PCIE5>;
2242+ iommu-map = <0x0 &smmu TEGRA194_SID_PCIE5 0x1000>;
2243+ iommu-map-mask = <0x0>;
2244+ dma-coherent;
21972245 };
21982246
21992247 sram@40000000 {
drivers/bus/ti-sysc.c+15−7
@@ -100,6 +100,7 @@ static const char * const clock_names[SYSC_MAX_CLOCKS] = { · 99 unmodified lines
100100 * @cookie: data used by legacy platform callbacks
101101 * @name: name if available
102102 * @revision: interconnect target module revision
103+ * @reserved: target module is reserved and already in use
103104 * @enabled: sysc runtime enabled status
104105 * @needs_resume: runtime resume needed on resume from suspend
105106 * @child_needs_resume: runtime resume needed for child on resume from suspend
@@ -130,6 +131,7 @@ struct sysc { · 24 unmodified lines
130131 struct ti_sysc_cookie cookie;
131132 const char *name;
132133 u32 revision;
134+ unsigned int reserved:1;
133135 unsigned int enabled:1;
134136 unsigned int needs_resume:1;
135137 unsigned int child_needs_resume:1;
@@ -2951,6 +2953,8 @@ static int sysc_init_soc(struct sysc *ddata) · 2815 unmodified lines
29512953 case SOC_3430 ... SOC_3630:
29522954 sysc_add_disabled(0x48304000); /* timer12 */
29532955 break;
2956+ case SOC_AM3:
2957+ sysc_add_disabled(0x48310000); /* rng */
29542958 default:
29552959 break;
29562960 }
@@ -3093,8 +3097,8 @@ static int sysc_probe(struct platform_device *pdev) · 136 unmodified lines
30933097 return error;
30943098
30953099 error = sysc_check_active_timer(ddata);
3096− if (error)
3097− return error;
3100+ if (error == -EBUSY)
3101+ ddata->reserved = true;
30983102
30993103 error = sysc_get_clocks(ddata);
31003104 if (error)
@@ -3130,11 +3134,15 @@ static int sysc_probe(struct platform_device *pdev) · 29 unmodified lines
31303134 sysc_show_registers(ddata);
31313135
31323136 ddata->dev->type = &sysc_device_type;
3133− error = of_platform_populate(ddata->dev->of_node, sysc_match_table,
3134− pdata ? pdata->auxdata : NULL,
3135− ddata->dev);
3136− if (error)
3137− goto err;
3137+
3138+ if (!ddata->reserved) {
3139+ error = of_platform_populate(ddata->dev->of_node,
3140+ sysc_match_table,
3141+ pdata ? pdata->auxdata : NULL,
3142+ ddata->dev);
3143+ if (error)
3144+ goto err;
3145+ }
31383146
31393147 INIT_DELAYED_WORK(&ddata->idle_work, ti_sysc_idle);
31403148
drivers/char/tpm/tpm_ftpm_tee.c+4−4
@@ -254,11 +254,11 @@ static int ftpm_tee_probe(struct device *dev) · 253 unmodified lines
254254 pvt_data->session = sess_arg.session;
255255
256256 /* Allocate dynamic shared memory with fTPM TA */
257− pvt_data->shm = tee_shm_alloc(pvt_data->ctx,
258− MAX_COMMAND_SIZE + MAX_RESPONSE_SIZE,
259− TEE_SHM_MAPPED | TEE_SHM_DMA_BUF);
257+ pvt_data->shm = tee_shm_alloc_kernel_buf(pvt_data->ctx,
258+ MAX_COMMAND_SIZE +
259+ MAX_RESPONSE_SIZE);
260260 if (IS_ERR(pvt_data->shm)) {
261− dev_err(dev, "%s: tee_shm_alloc failed\n", __func__);
261+ dev_err(dev, "%s: tee_shm_alloc_kernel_buf failed\n", __func__);
262262 rc = -ENOMEM;
263263 goto out_shm_alloc;
264264 }
drivers/firmware/broadcom/tee_bnxt_fw.c+11−3
@@ -212,10 +212,9 @@ static int tee_bnxt_fw_probe(struct device *dev) · 211 unmodified lines
212212
213213 pvt_data.dev = dev;
214214
215− fw_shm_pool = tee_shm_alloc(pvt_data.ctx, MAX_SHM_MEM_SZ,
216− TEE_SHM_MAPPED | TEE_SHM_DMA_BUF);
215+ fw_shm_pool = tee_shm_alloc_kernel_buf(pvt_data.ctx, MAX_SHM_MEM_SZ);
217216 if (IS_ERR(fw_shm_pool)) {
218− dev_err(pvt_data.dev, "tee_shm_alloc failed\n");
217+ dev_err(pvt_data.dev, "tee_shm_alloc_kernel_buf failed\n");
219218 err = PTR_ERR(fw_shm_pool);
220219 goto out_sess;
221220 }
@@ -242,6 +241,14 @@ static int tee_bnxt_fw_remove(struct device *dev) · 20 unmodified lines
242241 return 0;
243242 }
244243
244+static void tee_bnxt_fw_shutdown(struct device *dev)
245+{
246+ tee_shm_free(pvt_data.fw_shm_pool);
247+ tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
248+ tee_client_close_context(pvt_data.ctx);
249+ pvt_data.ctx = NULL;
250+}
251+
245252 static const struct tee_client_device_id tee_bnxt_fw_id_table[] = {
246253 {UUID_INIT(0x6272636D, 0x2019, 0x0716,
247254 0x42, 0x43, 0x4D, 0x5F, 0x53, 0x43, 0x48, 0x49)},
@@ -257,6 +264,7 @@ static struct tee_client_driver tee_bnxt_fw_driver = { · 9 unmodified lines
257264 .bus = &tee_bus_type,
258265 .probe = tee_bnxt_fw_probe,
259266 .remove = tee_bnxt_fw_remove,
267+ .shutdown = tee_bnxt_fw_shutdown,
260268 },
261269 };
262270
drivers/soc/Makefile+1−1
@@ -13,7 +13,7 @@ obj-$(CONFIG_MACH_DOVE) += dove/ · 12 unmodified lines
1313 obj-y += fsl/
1414 obj-$(CONFIG_ARCH_GEMINI) += gemini/
1515 obj-y += imx/
16−obj-$(CONFIG_ARCH_IXP4XX) += ixp4xx/
16+obj-y += ixp4xx/
1717 obj-$(CONFIG_SOC_XWAY) += lantiq/
1818 obj-$(CONFIG_LITEX_SOC_CONTROLLER) += litex/
1919 obj-y += mediatek/
drivers/soc/imx/soc-imx8m.c+12−72
@@ -5,8 +5,6 @@ · 4 unmodified lines
55
66 #include <linux/init.h>
77 #include <linux/io.h>
8−#include <linux/module.h>
9−#include <linux/nvmem-consumer.h>
108 #include <linux/of_address.h>
119 #include <linux/slab.h>
1210 #include <linux/sys_soc.h>
@@ -31,7 +29,7 @@ · 18 unmodified lines
3129
3230 struct imx8_soc_data {
3331 char *name;
34− u32 (*soc_revision)(struct device *dev);
32+ u32 (*soc_revision)(void);
3533 };
3634
3735 static u64 soc_uid;
@@ -52,7 +50,7 @@ static u32 imx8mq_soc_revision_from_atf(void) · 14 unmodified lines
5250 static inline u32 imx8mq_soc_revision_from_atf(void) { return 0; };
5351 #endif
5452
55−static u32 __init imx8mq_soc_revision(struct device *dev)
53+static u32 __init imx8mq_soc_revision(void)
5654 {
5755 struct device_node *np;
5856 void __iomem *ocotp_base;
@@ -77,20 +75,9 @@ static u32 __init imx8mq_soc_revision(struct device *dev) · 18 unmodified lines
7775 rev = REV_B1;
7876 }
7977
80− if (dev) {
81− int ret;
82−
83− ret = nvmem_cell_read_u64(dev, "soc_unique_id", &soc_uid);
84− if (ret) {
85− iounmap(ocotp_base);
86− of_node_put(np);
87− return ret;
88− }
89− } else {
90− soc_uid = readl_relaxed(ocotp_base + OCOTP_UID_HIGH);
91− soc_uid <<= 32;
92− soc_uid |= readl_relaxed(ocotp_base + OCOTP_UID_LOW);
93− }
78+ soc_uid = readl_relaxed(ocotp_base + OCOTP_UID_HIGH);
79+ soc_uid <<= 32;
80+ soc_uid |= readl_relaxed(ocotp_base + OCOTP_UID_LOW);
9481
9582 iounmap(ocotp_base);
9683 of_node_put(np);
@@ -120,7 +107,7 @@ static void __init imx8mm_soc_uid(void) · 23 unmodified lines
120107 of_node_put(np);
121108 }
122109
123−static u32 __init imx8mm_soc_revision(struct device *dev)
110+static u32 __init imx8mm_soc_revision(void)
124111 {
125112 struct device_node *np;
126113 void __iomem *anatop_base;
@@ -138,15 +125,7 @@ static u32 __init imx8mm_soc_revision(struct device *dev) · 11 unmodified lines
138125 iounmap(anatop_base);
139126 of_node_put(np);
140127
141− if (dev) {
142− int ret;
143−
144− ret = nvmem_cell_read_u64(dev, "soc_unique_id", &soc_uid);
145− if (ret)
146− return ret;
147− } else {
148− imx8mm_soc_uid();
149− }
128+ imx8mm_soc_uid();
150129
151130 return rev;
152131 }
@@ -171,7 +150,7 @@ static const struct imx8_soc_data imx8mp_soc_data = { · 18 unmodified lines
171150 .soc_revision = imx8mm_soc_revision,
172151 };
173152
174−static __maybe_unused const struct of_device_id imx8_machine_match[] = {
153+static __maybe_unused const struct of_device_id imx8_soc_match[] = {
175154 { .compatible = "fsl,imx8mq", .data = &imx8mq_soc_data, },
176155 { .compatible = "fsl,imx8mm", .data = &imx8mm_soc_data, },
177156 { .compatible = "fsl,imx8mn", .data = &imx8mn_soc_data, },
@@ -179,20 +158,12 @@ static __maybe_unused const struct of_device_id imx8_machine_match[] = { · 1 unmodified line
179158 { }
180159 };
181160
182−static __maybe_unused const struct of_device_id imx8_soc_match[] = {
183− { .compatible = "fsl,imx8mq-soc", .data = &imx8mq_soc_data, },
184− { .compatible = "fsl,imx8mm-soc", .data = &imx8mm_soc_data, },
185− { .compatible = "fsl,imx8mn-soc", .data = &imx8mn_soc_data, },
186− { .compatible = "fsl,imx8mp-soc", .data = &imx8mp_soc_data, },
187− { }
188−};
189−
190161 #define imx8_revision(soc_rev) \
191162 soc_rev ? \
192163 kasprintf(GFP_KERNEL, "%d.%d", (soc_rev >> 4) & 0xf, soc_rev & 0xf) : \
193164 "unknown"
194165
195−static int imx8_soc_info(struct platform_device *pdev)
166+static int __init imx8_soc_init(void)
196167 {
197168 struct soc_device_attribute *soc_dev_attr;
198169 struct soc_device *soc_dev;
@@ -211,10 +182,7 @@ static int imx8_soc_info(struct platform_device *pdev) · 12 unmodified lines
211182 if (ret)
212183 goto free_soc;
213184
214− if (pdev)
215− id = of_match_node(imx8_soc_match, pdev->dev.of_node);
216− else
217− id = of_match_node(imx8_machine_match, of_root);
185+ id = of_match_node(imx8_soc_match, of_root);
218186 if (!id) {
219187 ret = -ENODEV;
220188 goto free_soc;
@@ -223,16 +191,8 @@ static int imx8_soc_info(struct platform_device *pdev) · 2 unmodified lines
223191 data = id->data;
224192 if (data) {
225193 soc_dev_attr->soc_id = data->name;
226− if (data->soc_revision) {
227− if (pdev) {
228− soc_rev = data->soc_revision(&pdev->dev);
229− ret = soc_rev;
230− if (ret < 0)
231− goto free_soc;
232− } else {
233− soc_rev = data->soc_revision(NULL);
234− }
235− }
194+ if (data->soc_revision)
195+ soc_rev = data->soc_revision();
236196 }
237197
238198 soc_dev_attr->revision = imx8_revision(soc_rev);
@@ -270,24 +230,4 @@ free_soc: · 31 unmodified lines
270230 kfree(soc_dev_attr);
271231 return ret;
272232 }
273−
274−/* Retain device_initcall is for backward compatibility with DTS. */
275−static int __init imx8_soc_init(void)
276−{
277− if (of_find_matching_node_and_match(NULL, imx8_soc_match, NULL))
278− return 0;
279−
280− return imx8_soc_info(NULL);
281−}
282233 device_initcall(imx8_soc_init);
283−
284−static struct platform_driver imx8_soc_info_driver = {
285− .probe = imx8_soc_info,
286− .driver = {
287− .name = "imx8_soc_info",
288− .of_match_table = imx8_soc_match,
289− },
290−};
291−
292−module_platform_driver(imx8_soc_info_driver);
293−MODULE_LICENSE("GPL v2");
drivers/soc/ixp4xx/ixp4xx-npe.c+5−7
@@ -21,7 +21,6 @@ · 20 unmodified lines
2121 #include <linux/of_platform.h>
2222 #include <linux/platform_device.h>
2323 #include <linux/soc/ixp4xx/npe.h>
24−#include <mach/hardware.h>
2524 #include <linux/soc/ixp4xx/cpu.h>
2625
2726 #define DEBUG_MSG 0
@@ -694,8 +693,8 @@ static int ixp4xx_npe_probe(struct platform_device *pdev) · 666 unmodified lines
694693
695694 if (!(ixp4xx_read_feature_bits() &
696695 (IXP4XX_FEATURE_RESET_NPEA << i))) {
697− dev_info(dev, "NPE%d at 0x%08x-0x%08x not available\n",
698− i, res->start, res->end);
696+ dev_info(dev, "NPE%d at %pR not available\n",
697+ i, res);
699698 continue; /* NPE already disabled or not present */
700699 }
701700 npe->regs = devm_ioremap_resource(dev, res);
@@ -703,13 +702,12 @@ static int ixp4xx_npe_probe(struct platform_device *pdev) · 1 unmodified line
703702 return PTR_ERR(npe->regs);
704703
705704 if (npe_reset(npe)) {
706− dev_info(dev, "NPE%d at 0x%08x-0x%08x does not reset\n",
707− i, res->start, res->end);
705+ dev_info(dev, "NPE%d at %pR does not reset\n",
706+ i, res);
708707 continue;
709708 }
710709 npe->valid = 1;
711− dev_info(dev, "NPE%d at 0x%08x-0x%08x registered\n",
712− i, res->start, res->end);
710+ dev_info(dev, "NPE%d at %pR registered\n", i, res);
713711 found++;
714712 }
715713
drivers/soc/ixp4xx/ixp4xx-qmgr.c+5−5
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212 #include <linux/of.h>
1313 #include <linux/platform_device.h>
1414 #include <linux/soc/ixp4xx/qmgr.h>
15−#include <mach/hardware.h>
1615 #include <linux/soc/ixp4xx/cpu.h>
1716
1817 static struct qmgr_regs __iomem *qmgr_regs;
@@ -147,12 +146,12 @@ static irqreturn_t qmgr_irq1_a0(int irq, void *pdev) · 128 unmodified lines
147146 /* ACK - it may clear any bits so don't rely on it */
148147 __raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[0]);
149148
150− en_bitmap = qmgr_regs->irqen[0];
149+ en_bitmap = __raw_readl(&qmgr_regs->irqen[0]);
151150 while (en_bitmap) {
152151 i = __fls(en_bitmap); /* number of the last "low" queue */
153152 en_bitmap &= ~BIT(i);
154− src = qmgr_regs->irqsrc[i >> 3];
155− stat = qmgr_regs->stat1[i >> 3];
153+ src = __raw_readl(&qmgr_regs->irqsrc[i >> 3]);
154+ stat = __raw_readl(&qmgr_regs->stat1[i >> 3]);
156155 if (src & 4) /* the IRQ condition is inverted */
157156 stat = ~stat;
158157 if (stat & BIT(src & 3)) {
@@ -172,7 +171,8 @@ static irqreturn_t qmgr_irq2_a0(int irq, void *pdev) · 13 unmodified lines
172171 /* ACK - it may clear any bits so don't rely on it */
173172 __raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[1]);
174173
175− req_bitmap = qmgr_regs->irqen[1] & qmgr_regs->statne_h;
174+ req_bitmap = __raw_readl(&qmgr_regs->irqen[1]) &
175+ __raw_readl(&qmgr_regs->statne_h);
176176 while (req_bitmap) {
177177 i = __fls(req_bitmap); /* number of the last "high" queue */
178178 req_bitmap &= ~BIT(i);
drivers/soc/tegra/Kconfig+4−2
@@ -15,7 +15,7 @@ config ARCH_TEGRA_2x_SOC · 14 unmodified lines
1515 select PL310_ERRATA_769419 if CACHE_L2X0
1616 select SOC_TEGRA_FLOWCTRL
1717 select SOC_TEGRA_PMC
18− select SOC_TEGRA20_VOLTAGE_COUPLER
18+ select SOC_TEGRA20_VOLTAGE_COUPLER if REGULATOR
1919 select TEGRA_TIMER
2020 help
2121 Support for NVIDIA Tegra AP20 and T20 processors, based on the
@@ -29,7 +29,7 @@ config ARCH_TEGRA_3x_SOC · 7 unmodified lines
2929 select PL310_ERRATA_769419 if CACHE_L2X0
3030 select SOC_TEGRA_FLOWCTRL
3131 select SOC_TEGRA_PMC
32− select SOC_TEGRA30_VOLTAGE_COUPLER
32+ select SOC_TEGRA30_VOLTAGE_COUPLER if REGULATOR
3333 select TEGRA_TIMER
3434 help
3535 Support for NVIDIA Tegra T30 processor family, based on the
@@ -155,7 +155,9 @@ config SOC_TEGRA_POWERGATE_BPMP · 119 unmodified lines
155155 config SOC_TEGRA20_VOLTAGE_COUPLER
156156 bool "Voltage scaling support for Tegra20 SoCs"
157157 depends on ARCH_TEGRA_2x_SOC || COMPILE_TEST
158+ depends on REGULATOR
158159
159160 config SOC_TEGRA30_VOLTAGE_COUPLER
160161 bool "Voltage scaling support for Tegra30 SoCs"
161162 depends on ARCH_TEGRA_3x_SOC || COMPILE_TEST
163+ depends on REGULATOR
drivers/tee/optee/call.c+34−4
@@ -184,7 +184,7 @@ static struct tee_shm *get_msg_arg(struct tee_context *ctx, size_t num_params, · 183 unmodified lines
184184 struct optee_msg_arg *ma;
185185
186186 shm = tee_shm_alloc(ctx, OPTEE_MSG_GET_ARG_SIZE(num_params),
187− TEE_SHM_MAPPED);
187+ TEE_SHM_MAPPED | TEE_SHM_PRIV);
188188 if (IS_ERR(shm))
189189 return shm;
190190
@@ -416,11 +416,13 @@ void optee_enable_shm_cache(struct optee *optee) · 225 unmodified lines
416416 }
417417
418418 /**
419− * optee_disable_shm_cache() - Disables caching of some shared memory allocation
420− * in OP-TEE
419+ * __optee_disable_shm_cache() - Disables caching of some shared memory
420+ * allocation in OP-TEE
421421 * @optee: main service struct
422+ * @is_mapped: true if the cached shared memory addresses were mapped by this
423+ * kernel, are safe to dereference, and should be freed
422424 */
423−void optee_disable_shm_cache(struct optee *optee)
425+static void __optee_disable_shm_cache(struct optee *optee, bool is_mapped)
424426 {
425427 struct optee_call_waiter w;
426428
@@ -439,6 +441,13 @@ void optee_disable_shm_cache(struct optee *optee) · 12 unmodified lines
439441 if (res.result.status == OPTEE_SMC_RETURN_OK) {
440442 struct tee_shm *shm;
441443
444+ /*
445+ * Shared memory references that were not mapped by
446+ * this kernel must be ignored to prevent a crash.
447+ */
448+ if (!is_mapped)
449+ continue;
450+
442451 shm = reg_pair_to_ptr(res.result.shm_upper32,
443452 res.result.shm_lower32);
444453 tee_shm_free(shm);
@@ -449,6 +458,27 @@ void optee_disable_shm_cache(struct optee *optee) · 4 unmodified lines
449458 optee_cq_wait_final(&optee->call_queue, &w);
450459 }
451460
461+/**
462+ * optee_disable_shm_cache() - Disables caching of mapped shared memory
463+ * allocations in OP-TEE
464+ * @optee: main service struct
465+ */
466+void optee_disable_shm_cache(struct optee *optee)
467+{
468+ return __optee_disable_shm_cache(optee, true);
469+}
470+
471+/**
472+ * optee_disable_unmapped_shm_cache() - Disables caching of shared memory
473+ * allocations in OP-TEE which are not
474+ * currently mapped
475+ * @optee: main service struct
476+ */
477+void optee_disable_unmapped_shm_cache(struct optee *optee)
478+{
479+ return __optee_disable_shm_cache(optee, false);
480+}
481+
452482 #define PAGELIST_ENTRIES_PER_PAGE \
453483 ((OPTEE_MSG_NONCONTIG_PAGE_SIZE / sizeof(u64)) - 1)
454484
drivers/tee/optee/core.c+42−1
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
77
88 #include <linux/arm-smccc.h>
9+#include <linux/crash_dump.h>
910 #include <linux/errno.h>
1011 #include <linux/io.h>
1112 #include <linux/module.h>
@@ -277,7 +278,8 @@ static void optee_release(struct tee_context *ctx) · 265 unmodified lines
277278 if (!ctxdata)
278279 return;
279280
280− shm = tee_shm_alloc(ctx, sizeof(struct optee_msg_arg), TEE_SHM_MAPPED);
281+ shm = tee_shm_alloc(ctx, sizeof(struct optee_msg_arg),
282+ TEE_SHM_MAPPED | TEE_SHM_PRIV);
281283 if (!IS_ERR(shm)) {
282284 arg = tee_shm_get_va(shm, 0);
283285 /*
@@ -572,6 +574,13 @@ static optee_invoke_fn *get_invoke_func(struct device *dev) · 288 unmodified lines
572574 return ERR_PTR(-EINVAL);
573575 }
574576
577+/* optee_remove - Device Removal Routine
578+ * @pdev: platform device information struct
579+ *
580+ * optee_remove is called by platform subsystem to alert the driver
581+ * that it should release the device
582+ */
583+
575584 static int optee_remove(struct platform_device *pdev)
576585 {
577586 struct optee *optee = platform_get_drvdata(pdev);
@@ -602,6 +611,18 @@ static int optee_remove(struct platform_device *pdev) · 24 unmodified lines
602611 return 0;
603612 }
604613
614+/* optee_shutdown - Device Removal Routine
615+ * @pdev: platform device information struct
616+ *
617+ * platform_shutdown is called by the platform subsystem to alert
618+ * the driver that a shutdown, reboot, or kexec is happening and
619+ * device must be disabled.
620+ */
621+static void optee_shutdown(struct platform_device *pdev)
622+{
623+ optee_disable_shm_cache(platform_get_drvdata(pdev));
624+}
625+
605626 static int optee_probe(struct platform_device *pdev)
606627 {
607628 optee_invoke_fn *invoke_fn;
@@ -612,6 +633,16 @@ static int optee_probe(struct platform_device *pdev) · 4 unmodified lines
612633 u32 sec_caps;
613634 int rc;
614635
636+ /*
637+ * The kernel may have crashed at the same time that all available
638+ * secure world threads were suspended and we cannot reschedule the
639+ * suspended threads without access to the crashed kernel's wait_queue.
640+ * Therefore, we cannot reliably initialize the OP-TEE driver in the
641+ * kdump kernel.
642+ */
643+ if (is_kdump_kernel())
644+ return -ENODEV;
645+
615646 invoke_fn = get_invoke_func(&pdev->dev);
616647 if (IS_ERR(invoke_fn))
617648 return PTR_ERR(invoke_fn);
@@ -686,6 +717,15 @@ static int optee_probe(struct platform_device *pdev) · 68 unmodified lines
686717 optee->memremaped_shm = memremaped_shm;
687718 optee->pool = pool;
688719
720+ /*
721+ * Ensure that there are no pre-existing shm objects before enabling
722+ * the shm cache so that there's no chance of receiving an invalid
723+ * address during shutdown. This could occur, for example, if we're
724+ * kexec booting from an older kernel that did not properly cleanup the
725+ * shm cache.
726+ */
727+ optee_disable_unmapped_shm_cache(optee);
728+
689729 optee_enable_shm_cache(optee);
690730
691731 if (optee->sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)
@@ -728,6 +768,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match); · 36 unmodified lines
728768 static struct platform_driver optee_driver = {
729769 .probe = optee_probe,
730770 .remove = optee_remove,
771+ .shutdown = optee_shutdown,
731772 .driver = {
732773 .name = "optee",
733774 .of_match_table = optee_dt_match,
drivers/tee/optee/optee_private.h+1−0
@@ -159,6 +159,7 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session); · 158 unmodified lines
159159
160160 void optee_enable_shm_cache(struct optee *optee);
161161 void optee_disable_shm_cache(struct optee *optee);
162+void optee_disable_unmapped_shm_cache(struct optee *optee);
162163
163164 int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
164165 struct page **pages, size_t num_pages,
drivers/tee/optee/rpc.c+3−2
@@ -314,7 +314,7 @@ static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx, · 313 unmodified lines
314314 shm = cmd_alloc_suppl(ctx, sz);
315315 break;
316316 case OPTEE_RPC_SHM_TYPE_KERNEL:
317− shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED);
317+ shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED | TEE_SHM_PRIV);
318318 break;
319319 default:
320320 arg->ret = TEEC_ERROR_BAD_PARAMETERS;
@@ -502,7 +502,8 @@ void optee_handle_rpc(struct tee_context *ctx, struct optee_rpc_param *param, · 181 unmodified lines
502502
503503 switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) {
504504 case OPTEE_SMC_RPC_FUNC_ALLOC:
505− shm = tee_shm_alloc(ctx, param->a1, TEE_SHM_MAPPED);
505+ shm = tee_shm_alloc(ctx, param->a1,
506+ TEE_SHM_MAPPED | TEE_SHM_PRIV);
506507 if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) {
507508 reg_pair_from_64(&param->a1, &param->a2, pa);
508509 reg_pair_from_64(&param->a4, &param->a5,
drivers/tee/optee/shm_pool.c+16−4
@@ -27,13 +27,19 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, · 26 unmodified lines
2727 shm->paddr = page_to_phys(page);
2828 shm->size = PAGE_SIZE << order;
2929
30− if (shm->flags & TEE_SHM_DMA_BUF) {
30+ /*
31+ * Shared memory private to the OP-TEE driver doesn't need
32+ * to be registered with OP-TEE.
33+ */
34+ if (!(shm->flags & TEE_SHM_PRIV)) {
3135 unsigned int nr_pages = 1 << order, i;
3236 struct page **pages;
3337
3438 pages = kcalloc(nr_pages, sizeof(pages), GFP_KERNEL);
35− if (!pages)
36− return -ENOMEM;
39+ if (!pages) {
40+ rc = -ENOMEM;
41+ goto err;
42+ }
3743
3844 for (i = 0; i < nr_pages; i++) {
3945 pages[i] = page;
@@ -44,15 +50,21 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, · 4 unmodified lines
4450 rc = optee_shm_register(shm->ctx, shm, pages, nr_pages,
4551 (unsigned long)shm->kaddr);
4652 kfree(pages);
53+ if (rc)
54+ goto err;
4755 }
4856
57+ return 0;
58+
59+err:
60+ __free_pages(page, order);
4961 return rc;
5062 }
5163
5264 static void pool_op_free(struct tee_shm_pool_mgr *poolm,
5365 struct tee_shm *shm)
5466 {
55− if (shm->flags & TEE_SHM_DMA_BUF)
67+ if (!(shm->flags & TEE_SHM_PRIV))
5668 optee_shm_unregister(shm->ctx, shm);
5769
5870 free_pages((unsigned long)shm->kaddr, get_order(shm->size));
drivers/tee/tee_shm.c+19−1
@@ -117,7 +117,7 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags) · 116 unmodified lines
117117 return ERR_PTR(-EINVAL);
118118 }
119119
120− if ((flags & ~(TEE_SHM_MAPPED | TEE_SHM_DMA_BUF))) {
120+ if ((flags & ~(TEE_SHM_MAPPED | TEE_SHM_DMA_BUF | TEE_SHM_PRIV))) {
121121 dev_err(teedev->dev.parent, "invalid shm flags 0x%x", flags);
122122 return ERR_PTR(-EINVAL);
123123 }
@@ -193,6 +193,24 @@ err_dev_put: · 69 unmodified lines
193193 }
194194 EXPORT_SYMBOL_GPL(tee_shm_alloc);
195195
196+/**
197+ * tee_shm_alloc_kernel_buf() - Allocate shared memory for kernel buffer
198+ * @ctx: Context that allocates the shared memory
199+ * @size: Requested size of shared memory
200+ *
201+ * The returned memory registered in secure world and is suitable to be
202+ * passed as a memory buffer in parameter argument to
203+ * tee_client_invoke_func(). The memory allocated is later freed with a
204+ * call to tee_shm_free().
205+ *
206+ * @returns a pointer to 'struct tee_shm'
207+ */
208+struct tee_shm *tee_shm_alloc_kernel_buf(struct tee_context *ctx, size_t size)
209+{
210+ return tee_shm_alloc(ctx, size, TEE_SHM_MAPPED);
211+}
212+EXPORT_SYMBOL_GPL(tee_shm_alloc_kernel_buf);
213+
196214 struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
197215 size_t length, u32 flags)
198216 {
include/linux/tee_drv.h+2−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #define TEE_SHM_USER_MAPPED BIT(4) /* Memory mapped in user space */
2828 #define TEE_SHM_POOL BIT(5) /* Memory allocated from pool */
2929 #define TEE_SHM_KERNEL_MAPPED BIT(6) /* Memory mapped in kernel space */
30+#define TEE_SHM_PRIV BIT(7) /* Memory private to TEE driver */
3031
3132 struct device;
3233 struct tee_device;
@@ -332,6 +333,7 @@ void *tee_get_drvdata(struct tee_device *teedev); · 299 unmodified lines
332333 * @returns a pointer to 'struct tee_shm'
333334 */
334335 struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags);
336+struct tee_shm *tee_shm_alloc_kernel_buf(struct tee_context *ctx, size_t size);
335337
336338 /**
337339 * tee_shm_register() - Register shared memory buffer