reserved-memory.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. *** Reserved memory regions ***
  2. Reserved memory is specified as a node under the /reserved-memory node.
  3. The operating system shall exclude reserved memory from normal usage
  4. one can create child nodes describing particular reserved (excluded from
  5. normal use) memory regions. Such memory regions are usually designed for
  6. the special usage by various device drivers.
  7. Parameters for each memory region can be encoded into the device tree
  8. with the following nodes:
  9. /reserved-memory node
  10. ---------------------
  11. #address-cells, #size-cells (required) - standard definition
  12. - Should use the same values as the root node
  13. ranges (required) - standard definition
  14. - Should be empty
  15. /reserved-memory/ child nodes
  16. -----------------------------
  17. Each child of the reserved-memory node specifies one or more regions of
  18. reserved memory. Each child node may either use a 'reg' property to
  19. specify a specific range of reserved memory, or a 'size' property with
  20. optional constraints to request a dynamically allocated block of memory.
  21. Following the generic-names recommended practice, node names should
  22. reflect the purpose of the node (ie. "framebuffer" or "dma-pool"). Unit
  23. address (@<address>) should be appended to the name if the node is a
  24. static allocation.
  25. Properties:
  26. Requires either a) or b) below.
  27. a) static allocation
  28. reg (required) - standard definition
  29. b) dynamic allocation
  30. size (required) - length based on parent's #size-cells
  31. - Size in bytes of memory to reserve.
  32. alignment (optional) - length based on parent's #size-cells
  33. - Address boundary for alignment of allocation.
  34. alloc-ranges (optional) - prop-encoded-array (address, length pairs).
  35. - Specifies regions of memory that are
  36. acceptable to allocate from.
  37. If both reg and size are present, then the reg property takes precedence
  38. and size is ignored.
  39. Additional properties:
  40. compatible (optional) - standard definition
  41. - may contain the following strings:
  42. - shared-dma-pool: This indicates a region of memory meant to be
  43. used as a shared pool of DMA buffers for a set of devices. It can
  44. be used by an operating system to instanciate the necessary pool
  45. management subsystem if necessary.
  46. - vendor specific string in the form <vendor>,[<device>-]<usage>
  47. no-map (optional) - empty property
  48. - Indicates the operating system must not create a virtual mapping
  49. of the region as part of its standard mapping of system memory,
  50. nor permit speculative access to it under any circumstances other
  51. than under the control of the device driver using the region.
  52. reusable (optional) - empty property
  53. - The operating system can use the memory in this region with the
  54. limitation that the device driver(s) owning the region need to be
  55. able to reclaim it back. Typically that means that the operating
  56. system can use that region to store volatile or cached data that
  57. can be otherwise regenerated or migrated elsewhere.
  58. Linux implementation note:
  59. - If a "linux,cma-default" property is present, then Linux will use the
  60. region for the default pool of the contiguous memory allocator.
  61. Device node references to reserved memory
  62. -----------------------------------------
  63. Regions in the /reserved-memory node may be referenced by other device
  64. nodes by adding a memory-region property to the device node.
  65. memory-region (optional) - phandle, specifier pairs to children of /reserved-memory
  66. Example
  67. -------
  68. This example defines 3 contiguous regions are defined for Linux kernel:
  69. one default of all device drivers (named linux,cma@72000000 and 64MiB in size),
  70. one dedicated to the framebuffer device (named framebuffer@78000000, 8MiB), and
  71. one for multimedia processing (named multimedia-memory@77000000, 64MiB).
  72. / {
  73. #address-cells = <1>;
  74. #size-cells = <1>;
  75. memory {
  76. reg = <0x40000000 0x40000000>;
  77. };
  78. reserved-memory {
  79. #address-cells = <1>;
  80. #size-cells = <1>;
  81. ranges;
  82. /* global autoconfigured region for contiguous allocations */
  83. linux,cma {
  84. compatible = "shared-dma-pool";
  85. reusable;
  86. size = <0x4000000>;
  87. alignment = <0x2000>;
  88. linux,cma-default;
  89. };
  90. display_reserved: framebuffer@78000000 {
  91. reg = <0x78000000 0x800000>;
  92. };
  93. multimedia_reserved: multimedia@77000000 {
  94. compatible = "acme,multimedia-memory";
  95. reg = <0x77000000 0x4000000>;
  96. };
  97. };
  98. /* ... */
  99. fb0: video@12300000 {
  100. memory-region = <&display_reserved>;
  101. /* ... */
  102. };
  103. scaler: scaler@12500000 {
  104. memory-region = <&multimedia_reserved>;
  105. /* ... */
  106. };
  107. codec: codec@12600000 {
  108. memory-region = <&multimedia_reserved>;
  109. /* ... */
  110. };
  111. };