082-ARM-dts-ipq4019-Add-TZ-and-SMEM-reserved-regions.patch 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. From fc566294610fa49e9d8c31c4ecc9c82f49b11f59 Mon Sep 17 00:00:00 2001
  2. From: Sven Eckelmann <[email protected]>
  3. Date: Wed, 18 Apr 2018 09:10:44 +0200
  4. Subject: [PATCH] ARM: dts: ipq4019: Add TZ and SMEM reserved regions
  5. The QSEE (trustzone) is started on IPQ4019 before Linux is started.
  6. According to QCA, it is placed in in the the memory region
  7. 0x87e80000-0x88000000 and must not be accessed directly. There is an
  8. additional memory region 0x87e00000-0x87E80000 smem which which can be used
  9. for communication with the TZ. The driver for the latter is not yet ready
  10. but it is still not allowed to use this memory region like any other
  11. memory region.
  12. Not reserving this memory region either leads to kernel crashes, kernel
  13. hangs (often during the boot) or bus errors for userspace programs. The
  14. latter happens when a program is using a memory region which is mapped to
  15. these physical memory regions.
  16. [ 571.758058] Unhandled fault: imprecise external abort (0xc06) at 0x01715ff8
  17. [ 571.758099] pgd = cebec000
  18. [ 571.763826] [01715ff8] *pgd=8e7fa835, *pte=87e7f75f, *ppte=87e7fc7f
  19. Bus error
  20. Signed-off-by: Sven Eckelmann <[email protected]>
  21. Forwarded: https://patchwork.kernel.org/patch/10347459/
  22. ---
  23. Cc: Sricharan Ramabadhran <[email protected]>
  24. Cc: Senthilkumar N L <[email protected]>
  25. There are additional memory regions which have to be initialized first by
  26. Linux. So they are currently not used. We were told by QCA that the
  27. features QSDK uses them for are:
  28. * crash dump feature
  29. - a couple of regions used when 'qca,scm_restart_reason' dt node has the
  30. value 'dload_status' not set to 1
  31. + apps_bl <0x87000000 0x400000>
  32. + sbl <0x87400000 0x100000>
  33. + cnss_debug <0x87400000 0x100000>
  34. + cpu_context_dump <0x87b00000 0x080000>
  35. - required driver not available in Linux
  36. - safe to remove
  37. * QSEE app execution
  38. - region tz_apps <0x87b80000 0x280000>
  39. - required driver not available in Linux
  40. - safe to remove
  41. * communication with TZ/QSEE
  42. - region smem <0x87b80000 0x280000>
  43. - driver changes not yet upstreamed
  44. - must not be removed because any access can crash kernel/program
  45. * trustzone (QSEE) private memory
  46. - region tz <0x87e80000 0x180000>
  47. - must not be removed because any access can crash kernel/program
  48. The problem with the missing regions was reported in 2016 [1]. So maybe
  49. this change qualifies for a [email protected] submission.
  50. [1] https://www.spinics.net/lists/linux-arm-msm/msg21536.html
  51. ---
  52. arch/arm/boot/dts/qcom-ipq4019.dtsi | 16 ++++++++++++++++
  53. 1 file changed, 16 insertions(+)
  54. --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi
  55. +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
  56. @@ -23,6 +23,22 @@
  57. compatible = "qcom,ipq4019";
  58. interrupt-parent = <&intc>;
  59. + reserved-memory {
  60. + #address-cells = <0x1>;
  61. + #size-cells = <0x1>;
  62. + ranges;
  63. +
  64. + smem_region: smem@87e00000 {
  65. + reg = <0x87e00000 0x080000>;
  66. + no-map;
  67. + };
  68. +
  69. + tz@87e80000 {
  70. + reg = <0x87e80000 0x180000>;
  71. + no-map;
  72. + };
  73. + };
  74. +
  75. aliases {
  76. spi0 = &blsp1_spi1;
  77. spi1 = &blsp1_spi2;