reserved-memory.txt 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 instantiate 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. - If a "linux,dma-default" property is present, then Linux will use the
  62. region for the default pool of the consistent DMA allocator.
  63. Device node references to reserved memory
  64. -----------------------------------------
  65. Regions in the /reserved-memory node may be referenced by other device
  66. nodes by adding a memory-region property to the device node.
  67. memory-region (optional) - phandle, specifier pairs to children of /reserved-memory
  68. Example
  69. -------
  70. This example defines 3 contiguous regions are defined for Linux kernel:
  71. one default of all device drivers (named linux,cma@72000000 and 64MiB in size),
  72. one dedicated to the framebuffer device (named framebuffer@78000000, 8MiB), and
  73. one for multimedia processing (named multimedia-memory@77000000, 64MiB).
  74. / {
  75. #address-cells = <1>;
  76. #size-cells = <1>;
  77. memory {
  78. reg = <0x40000000 0x40000000>;
  79. };
  80. reserved-memory {
  81. #address-cells = <1>;
  82. #size-cells = <1>;
  83. ranges;
  84. /* global autoconfigured region for contiguous allocations */
  85. linux,cma {
  86. compatible = "shared-dma-pool";
  87. reusable;
  88. size = <0x4000000>;
  89. alignment = <0x2000>;
  90. linux,cma-default;
  91. };
  92. display_reserved: framebuffer@78000000 {
  93. reg = <0x78000000 0x800000>;
  94. };
  95. multimedia_reserved: multimedia@77000000 {
  96. compatible = "acme,multimedia-memory";
  97. reg = <0x77000000 0x4000000>;
  98. };
  99. };
  100. /* ... */
  101. fb0: video@12300000 {
  102. memory-region = <&display_reserved>;
  103. /* ... */
  104. };
  105. scaler: scaler@12500000 {
  106. memory-region = <&multimedia_reserved>;
  107. /* ... */
  108. };
  109. codec: codec@12600000 {
  110. memory-region = <&multimedia_reserved>;
  111. /* ... */
  112. };
  113. };